var K = Object.defineProperty;
var Q = (e, t, s) => t in e ? K(e, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : e[t] = s;
var k = (e, t, s) => (Q(e, typeof t != "symbol" ? t + "" : t, s), s);
import { GridFieldColumnController as V, GridRowController as X, WFStepTraceViewController as Z, UploadEditorController as M } from "@ibiz-template/controller";
import { defineComponent as E, computed as G, h as c, getCurrentInstance as P, ref as m, watch as T, toRefs as L } from "vue";
import { useNamespace as S, useViewController as ee, usePropsWatch as j, getUploadProps as te, getEditorEmits as se, getGridUploadProps as _, useClickOutside as oe, useEventListener as ie, useWFStepTraceViewController as re, useWFDynaEditView3Controller as ne, useEditView3Controller as ae } from "@ibiz-template/vue-util";
import { colorBlend as le, IBizContext as ce, isImage as de, uploadFile as ue, RuntimeError as me } from "@ibiz-template/core";
import { getCookie as pe } from "qx-util";
import { ViewMode as z } from "@ibiz-template/runtime";
import { ViewType as he } from "@ibiz-template/model";
const fe = E({
  name: "CodeListGridColumn",
  props: {
    controller: {
      type: V,
      required: !0
    },
    row: {
      type: X,
      required: !0
    }
  },
  setup(e) {
    const t = S("grid-field-column"), s = G(() => {
      var a;
      if (e.controller.model.source.cLConvertMode !== "FRONT")
        return [];
      const n = e.row.data[e.controller.model.codeName];
      return ((a = e.controller.codeListItems) == null ? void 0 : a.length) && n ? n.split(",").map((y) => {
        const h = e.controller.codeListItems.find((f) => f.value === y);
        if (h) {
          const f = h.color || "#515a6e";
          return {
            text: h.text,
            colorStyle: t.cssVarBlock({
              color: f,
              "border-color": f,
              "bg-color": le(f, "#fff")
            })
          };
        }
      }).filter(Boolean) : [];
    }), o = (n) => {
      e.controller.isLinkColumn && e.controller.openLinkView(e.row, n);
    }, i = G(() => {
      let n = "";
      switch (e.controller.model.align) {
        case "LEFT":
          n = "flex-start";
          break;
        case "RIGHT":
          n = "flex-end";
          break;
        default:
          n = "center";
          break;
      }
      return t.cssVarBlock({
        "justify-content": n
      });
    });
    return {
      ns: t,
      alignStyle: i,
      selectedItems: s,
      onCellClick: o
    };
  },
  render() {
    const e = this.controller, t = this.row.data[e.model.codeName];
    return c("div", {
      class: [this.ns.b(), e.isLinkColumn && this.ns.m("link-column")],
      style: this.alignStyle,
      on: {
        click: this.onCellClick
      }
    }, [this.selectedItems.length > 0 ? this.selectedItems.map((s) => c("span", {
      class: this.ns.e("code-list-item"),
      style: s.colorStyle
    }, [s.text])) : c("span", {
      class: this.ns.e("text")
    }, [t])]);
  }
});
class be extends Z {
  constructor() {
    super(...arguments);
    k(this, "imgSrc");
  }
  async getUIData() {
    const s = new ce(this.params, this.context), o = await this.entityService.wf.getWFProcessDiagram(s), i = new Blob([o.data]);
    this.imgSrc = URL.createObjectURL(i);
  }
}
const ve = E({
  name: "PresetWFChartView",
  props: {
    context: Object,
    params: {
      type: Object
    },
    modelPath: {
      type: String,
      required: !0
    },
    modal: {
      type: Object
    },
    deName: {
      type: String,
      required: !0
    }
  },
  setup(e) {
    const t = S("preset-wf-chart-view"), {
      proxy: s
    } = P(), o = ee(s, (i, n) => new be(e.modelPath, i, n));
    return j(s, "deName", o.setDeName.bind(o)), {
      c: o,
      ns: t
    };
  },
  render() {
    return c("div", {
      class: this.ns.b()
    }, [c("img", {
      attrs: {
        src: this.c.imgSrc
      }
    })]);
  }
});
const we = E({
  name: "WFToolbar",
  props: {
    wfLinks: {
      type: Array,
      required: !0
    }
  },
  setup(e, {
    emit: t
  }) {
    return {
      ns: S("wf-toolbar"),
      handleClick: async (i, n) => {
        t("wf-link-click", i, n);
      }
    };
  },
  render() {
    const e = this.wfLinks || [];
    return c("div", {
      class: `${this.ns.b()}`
    }, [e.length > 0 && e.map((t) => {
      const s = t.sequenceFlowName == "\u9A73\u56DE" || t.sequenceFlowName == "\u53D6\u6D88";
      return c("div", {
        key: t.sequenceFlowId,
        class: [this.ns.e("item"), s ? this.ns.em("item", "reject") : ""]
      }, [c("i-button", {
        attrs: {
          title: t.sequenceFlowName
        },
        on: {
          click: (o) => this.handleClick(t, o)
        }
      }, [t.sequenceFlowName || ""])]);
    })]);
  }
}), ye = typeof btoa == "function", A = typeof Buffer == "function";
typeof TextDecoder == "function" && new TextDecoder();
const W = typeof TextEncoder == "function" ? new TextEncoder() : void 0, Fe = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=", D = Array.prototype.slice.call(Fe);
((e) => {
  let t = {};
  return e.forEach((s, o) => t[s] = o), t;
})(D);
const x = String.fromCharCode.bind(String);
typeof Uint8Array.from == "function" && Uint8Array.from.bind(Uint8Array);
const ge = (e) => e.replace(/=/g, "").replace(/[+\/]/g, (t) => t == "+" ? "-" : "_"), Ce = (e) => {
  let t, s, o, i, n = "";
  const a = e.length % 3;
  for (let d = 0; d < e.length; ) {
    if ((s = e.charCodeAt(d++)) > 255 || (o = e.charCodeAt(d++)) > 255 || (i = e.charCodeAt(d++)) > 255)
      throw new TypeError("invalid character found");
    t = s << 16 | o << 8 | i, n += D[t >> 18 & 63] + D[t >> 12 & 63] + D[t >> 6 & 63] + D[t & 63];
  }
  return a ? n.slice(0, a - 3) + "===".substring(a) : n;
}, R = ye ? (e) => btoa(e) : A ? (e) => Buffer.from(e, "binary").toString("base64") : Ce, Ue = A ? (e) => Buffer.from(e).toString("base64") : (e) => {
  let s = [];
  for (let o = 0, i = e.length; o < i; o += 4096)
    s.push(x.apply(null, e.subarray(o, o + 4096)));
  return R(s.join(""));
}, Ee = (e) => {
  if (e.length < 2) {
    var t = e.charCodeAt(0);
    return t < 128 ? e : t < 2048 ? x(192 | t >>> 6) + x(128 | t & 63) : x(224 | t >>> 12 & 15) + x(128 | t >>> 6 & 63) + x(128 | t & 63);
  } else {
    var t = 65536 + (e.charCodeAt(0) - 55296) * 1024 + (e.charCodeAt(1) - 56320);
    return x(240 | t >>> 18 & 7) + x(128 | t >>> 12 & 63) + x(128 | t >>> 6 & 63) + x(128 | t & 63);
  }
}, xe = /[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g, Se = (e) => e.replace(xe, Ee), O = A ? (e) => Buffer.from(e, "utf8").toString("base64") : W ? (e) => Ue(W.encode(e)) : (e) => R(Se(e)), q = (e, t = !1) => t ? ge(O(e)) : O(e);
function ke(e, t, s) {
  const o = m([]), i = m({
    Authorization: `Bearer ${pe("access_token")}`
  }), n = m(""), a = m(""), d = {
    count: 0,
    cacheFiles: []
  };
  T(
    () => e.value,
    (r) => {
      o.value = r ? JSON.parse(r) : [];
    },
    { immediate: !0 }
  ), T(
    () => e.data,
    (r) => {
      if (r) {
        const l = s.calcBaseUrl(r);
        n.value = l.uploadUrl, a.value = l.downloadUrl;
      }
    },
    { immediate: !0, deep: !0 }
  ), T(
    o,
    (r) => {
      (r == null ? void 0 : r.length) && a.value && r.forEach((l) => {
        l.url = l.url || a.value.replace("%fileId%", l.id);
      });
    },
    { immediate: !0 }
  ), T(
    a,
    (r) => {
      r && o.value.length && o.value.forEach((l) => {
        l.url = a.value.replace("%fileId%", l.id);
      });
    },
    { immediate: !0 }
  );
  const u = () => {
    const r = [...o.value, ...d.cacheFiles], l = r.length > 0 ? JSON.stringify(r.map((w) => ({ name: w.name, id: w.id }))) : null;
    d.cacheFiles = [], t(l);
  }, y = (r) => {
    const l = ["html", "js", "exe", "sh"], w = r.name.trim().toLowerCase();
    if (l.some((N) => w.endsWith(`.${N}`)))
      return ibiz.message.error("\u4E0D\u53EF\u4E0A\u4F20 html\u3001js\u3001 exe\u3001sh\u7C7B\u578B\u7684\u6587\u4EF6\uFF01"), !1;
    d.count += 1;
  }, h = (r) => {
    !r || (d.cacheFiles.push({
      name: r.filename,
      id: r.fileid
    }), d.count -= 1, d.count === 0 && u());
  }, f = (r) => {
    throw d.count -= 1, r;
  }, F = (r) => {
    if (e.disabled)
      return;
    const l = o.value.findIndex((w) => w.id === r.id);
    l !== -1 && o.value.splice(l, 1), u();
  }, U = (r) => {
    const l = r.url || a.value.replace("%fileId%", r.id);
    s.fileDownload({ url: l, name: r.name });
  }, p = m(!1), g = m(""), C = m("");
  return {
    uploadUrl: n,
    downloadUrl: a,
    headers: i,
    files: o,
    onDownload: U,
    onError: f,
    onRemove: F,
    onSuccess: h,
    beforeUpload: y,
    showModal: p,
    modalTitle: g,
    iframeUrl: C,
    onModalCancel: () => {
      p.value = !1, g.value = "", C.value = "";
    },
    previewFile: (r) => {
      p.value = !0, g.value = r.name;
      const l = window.Environment.previewFileUrl;
      if (l) {
        const w = encodeURIComponent(
          q(
            `${window.location.origin}${r.url}?fullfilename=${r.name}`
          )
        );
        C.value = `${l}/onlinePreview?url=${w}`;
      }
    }
  };
}
const Te = E({
  name: "SyFileUpload",
  props: te(),
  emits: se(),
  setup(e, {
    emit: t
  }) {
    const s = S("sy-file-upload"), o = e.controller, {
      uploadUrl: i,
      headers: n,
      files: a,
      onDownload: d,
      onError: u,
      onRemove: y,
      onSuccess: h,
      beforeUpload: f,
      showModal: F,
      modalTitle: U,
      iframeUrl: p,
      onModalCancel: g,
      previewFile: C
    } = ke(e, (b) => {
      t("change", b);
    }, o);
    return {
      ns: s,
      c: o,
      uploadUrl: i,
      headers: n,
      files: a,
      onDownload: d,
      onError: u,
      onRemove: y,
      onSuccess: h,
      beforeUpload: f,
      showModal: F,
      modalTitle: U,
      iframeUrl: p,
      onModalCancel: g,
      previewFile: C
    };
  },
  render(e) {
    return e("div", {
      class: [this.ns.b(), this.disabled ? this.ns.m("disabled") : "", this.readonly ? this.ns.m("readonly") : ""]
    }, [e("IUpload", {
      ref: "fileUpload",
      props: {
        action: this.uploadUrl,
        headers: this.headers,
        disabled: this.disabled,
        "default-file-list": this.files,
        multiple: this.c.model.multiple,
        type: this.c.model.isDrag ? "drag" : "select",
        accept: this.c.model.accept,
        "before-upload": this.beforeUpload,
        "on-success": this.onSuccess,
        "on-error": this.onError,
        "on-remove": this.onRemove,
        "on-preview": this.onDownload,
        "show-upload-list": !1
      }
    }, [this.c.model.isDrag ? e("div", {
      class: this.ns.bm("box", "drag")
    }, [e("i-icon", {
      attrs: {
        type: "md-cloud-upload"
      }
    }), e("div", {
      class: this.ns.be("box", "title")
    }, [e("span", ["\u5C06\u6587\u4EF6\u62D6\u5230\u6B64\u5904\uFF0C\u6216"]), e("span", ["\u70B9\u51FB\u4E0A\u4F20"])])]) : e("i-button", {
      attrs: {
        icon: "ios-cloud-upload-outline"
      },
      class: this.ns.bm("box", "select")
    }, ["\u4E0A\u4F20\u6587\u4EF6"])]), e("div", {
      class: this.ns.b("file-list")
    }, [this.files.map((t) => e("div", {
      class: this.ns.b("file-item"),
      key: t.id
    }, [e("div", {
      class: this.ns.b("file-item-left")
    }, [e("i-icon", {
      attrs: {
        type: "md-document"
      }
    })]), e("div", {
      class: this.ns.b("file-item-right")
    }, [e("div", {
      class: this.ns.b("file-item-right-title"),
      on: {
        click: () => this.previewFile(t)
      }
    }, [t.name]), e("div", {
      class: this.ns.b("file-item-right-action")
    }, [e("i-icon", {
      attrs: {
        type: "md-download"
      },
      on: {
        click: () => this.onDownload(t)
      }
    }), e("i-icon", {
      attrs: {
        type: "md-eye"
      },
      on: {
        click: () => this.previewFile(t)
      }
    }), this.disabled || this.readonly ? null : e("i-icon", {
      attrs: {
        type: "md-close"
      },
      on: {
        click: () => this.onRemove(t)
      }
    })])])]))]), e("i-modal", {
      attrs: {
        value: this.showModal,
        title: this.modalTitle,
        "class-name": this.ns.b("modal"),
        width: "70%",
        transfer: !1,
        "footer-hide": !0
      },
      on: {
        "on-cancel": this.onModalCancel
      }
    }, [e("iframe", {
      class: this.ns.b("iframe"),
      attrs: {
        src: this.iframeUrl
      }
    })])]);
  }
});
function I(e, t) {
  if (e.url = t.replace("%fileId%", e.id), e.status || (e.status = "finished"), !e.fileName) {
    const s = e.name.lastIndexOf(".");
    e.fileName = e.name.substring(0, s), e.fileExt = e.name.substring(s), e.isImage = de(e.name);
  }
  return e;
}
function $(e) {
  const t = m(""), s = m(""), o = m([]);
  return T(
    e.data,
    (i) => {
      if (i) {
        const n = e.controller.value.calcBaseUrl(i);
        t.value = n.uploadUrl, s.value = n.downloadUrl;
      }
    },
    { immediate: !0, deep: !0 }
  ), T(
    e.value,
    (i) => {
      o.value = i ? JSON.parse(i) : [], o.value.length && s.value && o.value.forEach((n) => {
        I(n, s.value);
      });
    },
    { immediate: !0 }
  ), T(
    s,
    (i) => {
      i && o.value.length && o.value.forEach((n) => {
        I(n, i);
      });
    },
    { immediate: !0 }
  ), {
    downloadUrl: s,
    uploadUrl: t,
    valueList: o
  };
}
function J(e) {
  const t = m("undo"), s = m([]), { downloadUrl: o, value: i, uploadUrl: n } = e;
  T(
    i,
    (b) => {
      b.length > 0 && (s.value = [], b.forEach((v) => {
        s.value.push(I(v, o.value));
      }));
    },
    {
      immediate: !0,
      deep: !0
    }
  );
  const a = (b, v) => {
    const r = ["html", "js", "exe", "sh"], l = [];
    return v.forEach((w, B) => {
      const N = w.name.trim().toLowerCase();
      if (r.some((Y) => N.endsWith(`.${Y}`))) {
        l.push(B);
        return;
      }
      s.value.push({
        name: w.name,
        status: w.status,
        percentage: w.percentage,
        id: w.uid,
        url: ""
      });
    }), l.length === v.length ? (ibiz.message.error("\u4E0D\u53EF\u4E0A\u4F20 html\u3001js\u3001 exe\u3001sh\u7C7B\u578B\u7684\u6587\u4EF6\uFF01"), !1) : (l.length && (l.forEach((w) => {
      b.splice(w, 1), v.splice(w, 1);
    }), ibiz.message.error("\u4E0D\u53EF\u4E0A\u4F20 html\u3001js\u3001 exe\u3001sh\u7C7B\u578B\u7684\u6587\u4EF6\uFF01")), !0);
  }, d = (b) => {
    b.forEach((v) => {
      s.value.find((r) => r.id === v.uid ? (r.percentage = v.percentage, !0) : !1);
    });
  }, u = (b, v) => {
    b.forEach((r) => {
      s.value.find((l) => l.id === r.uid ? (l.status = r.status, l.id = v.data.fileid, l.name = v.data.filename, I(l, o.value), !0) : !1);
    });
  }, y = (b) => {
    b.forEach((v) => {
      s.value.find((r) => r.id === v.uid ? (r.status = v.status, !0) : !1);
    });
  }, h = (b) => {
    t.value = "done";
  }, f = () => {
    ue({
      multiple: e.multiple,
      accept: e.accept,
      uploadUrl: n.value,
      beforeUpload: a,
      progress: d,
      success: u,
      error: y,
      finish: h
    });
  }, F = m(!1), U = m(""), p = m("");
  return {
    selectFile: f,
    fileList: s,
    uploadState: t,
    showModal: F,
    modalTitle: U,
    iframeUrl: p,
    onModalCancel: () => {
      F.value = !1, U.value = "", p.value = "";
    },
    previewFile: (b) => {
      F.value = !0, U.value = b.name;
      const v = window.Environment.previewFileUrl;
      if (v) {
        const r = encodeURIComponent(
          q(
            `${window.location.origin}${b.url}?fullfilename=${b.name}`
          )
        );
        p.value = `${v}/onlinePreview?url=${r}`;
      }
    }
  };
}
const De = E({
  name: "SyGridFileUpload",
  props: _(),
  setup(e) {
    const t = S("sy-grid-file-upload"), {
      value: s,
      data: o,
      controller: i
    } = L(e), {
      downloadUrl: n,
      uploadUrl: a,
      valueList: d
    } = $({
      value: s,
      data: o,
      controller: i
    }), {
      fileList: u,
      showModal: y,
      modalTitle: h,
      iframeUrl: f,
      previewFile: F,
      onModalCancel: U
    } = J({
      downloadUrl: n,
      uploadUrl: a,
      value: d
    });
    return {
      ns: t,
      fileList: u,
      showModal: y,
      modalTitle: h,
      iframeUrl: f,
      downloadFile: (g) => {
        e.controller.fileDownload(g);
      },
      previewFile: F,
      onModalCancel: U
    };
  },
  render() {
    return c("grid-editor", {
      attrs: {
        disabled: this.disabled,
        readonly: this.readonly
      },
      class: [this.ns.b(), this.disabled ? this.ns.m("disabled") : "", this.readonly ? this.ns.m("readonly") : ""]
    }, [c("div", {
      class: this.ns.b("file-list")
    }, [this.fileList.map((e) => c("div", {
      class: this.ns.b("file-item"),
      key: e.id
    }, [c("div", {
      class: this.ns.b("file-item-title"),
      on: {
        click: () => this.previewFile(e)
      }
    }, [e.name]), c("div", {
      class: this.ns.b("file-item-action")
    }, [c("i-icon", {
      attrs: {
        type: "md-download"
      },
      on: {
        click: () => this.downloadFile(e)
      }
    }), c("i-icon", {
      attrs: {
        type: "md-eye"
      },
      on: {
        click: () => this.previewFile(e)
      }
    })])]))]), c("i-modal", {
      attrs: {
        value: this.showModal,
        title: this.modalTitle,
        "class-name": this.ns.b("modal"),
        width: "70%",
        transfer: !1,
        "footer-hide": !0
      },
      on: {
        "on-cancel": this.onModalCancel
      }
    }, [c("iframe", {
      class: this.ns.b("iframe"),
      attrs: {
        src: this.iframeUrl
      }
    })])]);
  }
}), Ie = E({
  name: "SyGridFileUploadContainer",
  props: _(),
  render(e) {
    return this.disabled || this.readonly ? e("SyGridFileUpload", {
      props: {
        ...this.$props
      }
    }) : e("SyEditGridFileUpload", {
      props: {
        ...this.$props
      }
    });
  }
});
const Pe = E({
  name: "SyEditGridFileUploadPopover",
  props: {
    uploadUrl: {
      type: String,
      required: !0
    },
    downloadUrl: {
      type: String,
      required: !0
    },
    value: {
      type: Array,
      required: !0
    },
    controller: {
      type: M,
      required: !0
    }
  },
  emits: {
    close: (e) => !0
  },
  setup(e, {
    emit: t
  }) {
    const s = S("sy-edit-grid-file-upload-popover"), {
      downloadUrl: o,
      value: i,
      uploadUrl: n
    } = L(e), {
      fileList: a,
      uploadState: d,
      selectFile: u
    } = J({
      downloadUrl: o,
      value: i,
      uploadUrl: n
    }), y = m(), h = m(!1), f = oe(y, async (p) => {
      t("close", {
        isModified: h.value,
        resultFiles: a.value
      });
    });
    return T(d, (p) => {
      p === "done" ? (h.value = !0, f.proceed()) : p === "loading" && f.pause();
    }), {
      ns: s,
      componentRef: y,
      fileList: a,
      deleteFile: (p) => {
        const g = a.value.findIndex((C) => C.id === p.id);
        a.value.splice(g, 1), h.value = !0;
      },
      selectFile: u,
      downloadFile: (p) => {
        e.controller.fileDownload(p);
      }
    };
  },
  render() {
    return c("div", {
      ref: "componentRef",
      style: "width:300px",
      class: this.ns.b()
    }, [c("div", {
      class: this.ns.b("file-list")
    }, [this.fileList.map((e) => c("div", {
      class: this.ns.b("file-item"),
      key: e.id
    }, [c("div", {
      class: this.ns.b("file-item-title"),
      on: {
        click: () => this.downloadFile(e)
      }
    }, [e.name]), c("div", {
      class: this.ns.b("file-item-action")
    }, [c("i-icon", {
      attrs: {
        type: "md-close"
      },
      on: {
        click: () => this.deleteFile(e)
      }
    })])]))]), c("div", {
      on: {
        click: () => this.selectFile()
      },
      class: this.ns.e("button")
    }, [c("i-icon", {
      attrs: {
        type: "md-add"
      }
    }), "\u6DFB\u52A0\u6587\u4EF6"])]);
  }
});
const Ne = E({
  name: "SyEditGridFileUpload",
  props: _(),
  setup(e) {
    const t = S("sy-edit-grid-file-upload"), {
      value: s,
      data: o,
      controller: i
    } = L(e), {
      downloadUrl: n,
      uploadUrl: a,
      valueList: d
    } = $({
      value: s,
      data: o,
      controller: i
    }), u = m(), y = async () => {
      if (!u.value)
        throw new me("\u5BB9\u5668\u5143\u7D20\u4E0D\u5B58\u5728");
      const h = u.value.$el, f = h.offsetHeight, F = ibiz.overlay.createPopover((g) => g(Pe, {
        props: {
          value: d.value,
          uploadUrl: a.value,
          downloadUrl: n.value,
          controller: i.value
        },
        on: {
          close: (C) => {
            F.dismiss(C);
          }
        }
      }), void 0, {
        noArrow: !0,
        placement: "bottom-start",
        offsetOpts: {
          mainAxis: -f,
          crossAxis: 0
        }
      });
      await F.present(h);
      const {
        isModified: U,
        resultFiles: p
      } = await F.onWillDismiss();
      if (U) {
        const g = p.length > 0 ? JSON.stringify(p.map((C) => ({
          name: C.name,
          id: C.id
        }))) : null;
        await e.rowDataChange(g), await e.rowSave();
      }
    };
    return ie(u, "click", (h) => {
      e.disabled || y();
    }), {
      ns: t,
      valueList: d,
      componentRef: u
    };
  },
  render() {
    return c("grid-editor", {
      attrs: {
        disabled: this.disabled,
        readonly: this.readonly
      },
      ref: "componentRef",
      class: this.ns.b()
    }, [c("div", {
      class: this.ns.b("file-list")
    }, [this.valueList.map((e) => c("div", {
      class: this.ns.b("file-item"),
      key: e.id
    }, [c("div", {
      class: this.ns.b("file-item-title")
    }, [e.name])]))])]);
  }
});
class Le {
  constructor() {
    k(this, "component", ve);
  }
}
class _e {
  constructor() {
    k(this, "component", fe);
  }
  async createController(t, s) {
    const o = new V(t, s);
    return await o.init(), o;
  }
}
class Ae {
  constructor() {
    k(this, "component", "IndexView");
  }
}
const H = E({
  name: "WFStepTraceGrid",
  props: {
    context: Object,
    params: {
      type: Object
    },
    modelPath: {
      type: String,
      required: !0
    },
    modal: {
      type: Object
    },
    deName: {
      type: String,
      required: !0
    }
  },
  setup(e) {
    const {
      proxy: t
    } = P(), s = re(t, e.modelPath);
    j(t, "deName", s.setDeName.bind(s));
    const o = S("wf-step-trace-grid"), i = m([]);
    s.nerve.self.evt.on("mounted", () => {
      var a;
      !s.data || (a = s.data.usertasks) == null || a.forEach((d) => {
        d.identitylinks.length > 0 || (d.comments.length > 0 && d.comments.forEach((u) => {
          i.value.push({
            nodeName: d.userTaskName,
            personName: u.authorName,
            time: u.time,
            content: u.type,
            comment: u.fullMessage
          });
        }), i.value.sort((u, y) => Date.parse(y.time) - Date.parse(u.time)));
      });
    });
    const n = m([{
      title: "\u5904\u7406\u73AF\u8282",
      key: "nodeName",
      width: 180,
      resizable: !0
    }, {
      title: "\u5904\u7406\u4EBA",
      key: "personName",
      width: 180,
      resizable: !0
    }, {
      title: "\u5904\u7406\u65F6\u95F4",
      key: "time",
      width: 180,
      resizable: !0
    }, {
      title: "\u5904\u7406\u5185\u5BB9",
      key: "content",
      width: 180,
      resizable: !0
    }, {
      title: "\u5904\u7406\u610F\u89C1",
      key: "comment"
    }]);
    return {
      c: s,
      ns: o,
      gridData: i,
      columns: n
    };
  },
  render() {
    return c("div", {
      class: this.ns.b()
    }, [c("div", {
      class: this.ns.e("title")
    }, ["\u5BA1\u6279\u4FE1\u606F"]), c("i-table", {
      attrs: {
        "disabled-hover": !0,
        columns: this.columns,
        data: this.gridData
      },
      class: this.ns.e("grid")
    })]);
  }
}), Be = E({
  props: {
    context: Object,
    params: {
      type: Object
    },
    modelPath: {
      type: String,
      required: !0
    },
    modal: {
      type: Object
    }
  },
  setup(e) {
    const {
      proxy: t
    } = P(), s = ne(t, e.modelPath), o = S(`view-${he.DE_WF_DYNA_EDIT_VIEW3}`.toLowerCase()), i = m(["mainForm"]);
    return {
      c: s,
      ns: o,
      onTabClick: (a) => {
        i.value.includes(a) || i.value.push(a);
      },
      lazyList: i
    };
  },
  render(e) {
    const t = [];
    if (this.c.complete) {
      const {
        activeForm: s
      } = this.c;
      s && this.c.providers[s.name] && t.push(e(this.c.providers[s.name].component, {
        props: {
          modelData: s,
          context: this.c.context,
          params: this.c.params
        },
        style: {
          height: "auto"
        },
        on: {
          neuronInit: this.c.nerve.onNeuronInit("form")
        }
      }));
    }
    if (this.c.complete && this.c.model.drTab.pages[0]) {
      const s = this.c.model.drTab.pages[0], o = this.c.drPages[s.source.name];
      t.push(e(H, {
        attrs: {
          context: o.context,
          params: o.params,
          deName: this.c.model.appEntity.source.codeName,
          modal: this.modal,
          modelPath: s.embedView.source.modelPath
        }
      }));
    }
    return e("view-base", {
      attrs: {
        controller: this.c
      },
      scopedSlots: {
        toolbar: () => this.c.complete ? [this.c.wfLinks.length > 0 && e("wf-toolbar", {
          attrs: {
            wfLinks: this.c.wfLinks
          },
          on: {
            "wf-link-click": (s) => {
              this.c.onLinkClick(s);
            }
          }
        })] : null
      }
    }, [this.c.complete && e("i-tabs", {
      class: [this.ns.be("", "tab")],
      attrs: {
        name: this.c.model.drTab.source.name
      },
      on: {
        "on-click": this.onTabClick
      }
    }, [e("i-tab-pane", {
      class: this.ns.be("", "tab-item"),
      attrs: {
        tab: this.c.model.drTab.source.name,
        label: this.c.model.drTab.source.editItemCaption,
        name: "mainForm"
      }
    }, [t]), this.c.model.drTab.pages.map((s) => {
      const o = this.c.drPages[s.source.name];
      return e("i-tab-pane", {
        class: this.ns.be("", "tab-item"),
        attrs: {
          tab: this.c.model.drTab.source.name,
          disabled: this.c.isNewData,
          label: s.source.caption,
          name: s.source.name
        }
      }, [!this.c.isNewData && this.lazyList.includes(s.source.name) && e("ViewShell", {
        props: {
          context: o.context,
          params: o.params,
          modal: {
            mode: z.EMBED
          },
          modelPath: s.embedView.source.modelPath,
          deName: this.c.model.appEntity.source.codeName
        },
        on: {
          neuronInit: this.c.nerve.onNeuronInit(s.source.name)
        },
        key: o.key
      })]);
    })])]);
  }
});
class Ge {
  constructor() {
    k(this, "component", Be);
  }
}
const We = E({
  name: "SyEditView3",
  props: {
    context: Object,
    params: {
      type: Object
    },
    modelPath: {
      type: String,
      required: !0
    },
    modal: {
      type: Object
    }
  },
  setup(e) {
    const {
      proxy: t
    } = P(), s = ae(t, e.modelPath), o = S("view-deeditview3"), i = m(["mainForm"]);
    return {
      c: s,
      ns: o,
      onTabClick: (a) => {
        i.value.includes(a) || i.value.push(a);
      },
      lazyList: i
    };
  },
  render(e) {
    return e("view-base", {
      attrs: {
        controller: this.c
      }
    }, [this.c.complete && e("i-tabs", {
      class: [this.ns.be("", "tab")],
      attrs: {
        name: this.c.model.drTab.source.name
      },
      on: {
        "on-click": this.onTabClick
      }
    }, [e("i-tab-pane", {
      class: this.ns.be("", "tab-item"),
      attrs: {
        tab: this.c.model.drTab.source.name,
        label: this.c.model.drTab.source.editItemCaption,
        name: "mainForm"
      }
    }, [e("edit-form-control", {
      attrs: {
        modelData: this.c.model.form,
        context: this.c.context,
        params: this.c.params
      },
      style: {
        height: "auto"
      },
      on: {
        neuronInit: this.c.nerve.onNeuronInit(this.c.model.form.source.name)
      }
    }), e(H, {
      attrs: {
        context: this.c.drPages[this.c.model.drTab.pages[0].source.name].context,
        params: this.c.drPages[this.c.model.drTab.pages[0].source.name].params,
        deName: this.c.model.appEntity.source.codeName,
        modal: this.modal,
        modelPath: this.c.model.drTab.pages[0].embedView.source.modelPath
      }
    })]), this.c.model.drTab.pages.map((t) => {
      const s = this.c.drPages[t.source.name];
      if (!!s)
        return e("i-tab-pane", {
          class: this.ns.be("", "tab-item"),
          attrs: {
            tab: this.c.model.drTab.source.name,
            disabled: this.c.isNewData,
            label: t.source.caption,
            name: t.source.name
          }
        }, [!this.c.isNewData && this.lazyList.includes(t.source.name) && e("ViewShell", {
          props: {
            context: s.context,
            params: s.params,
            modal: {
              mode: z.EMBED
            },
            modelPath: t.embedView.source.modelPath,
            deName: this.c.model.appEntity.source.codeName
          },
          on: {
            neuronInit: this.c.nerve.onNeuronInit(t.source.name)
          },
          key: s.key
        })]);
    })])]);
  }
});
class Oe {
  constructor() {
    k(this, "component", We);
  }
}
class Ve {
  constructor() {
    k(this, "formEditor", "SyFileUpload");
    k(this, "gridEditor", "SyGridFileUploadContainer");
  }
  async createController(t, s) {
    const o = new M(t, s);
    return await o.init(), o;
  }
}
const Ke = {
  mateUrl: import.meta.url,
  install(e) {
    ibiz.config.enableDataInfoBar = !1, e.component("WfToolbar", we), ibiz.register.view.register(
      "VIEW_CUSTOM_SyWebIndexView",
      new Ae()
    ), ibiz.register.view.register(
      "VIEW_CUSTOM_PresetWFChartView",
      new Le()
    ), ibiz.register.gridColumn.register(
      "GRID_COLRENDER_CodeListGridColumn",
      new _e()
    ), ibiz.register.view.register(
      "VIEW_CUSTOM_SyWfDynaEditView3",
      new Ge()
    ), ibiz.register.view.register(
      "VIEW_CUSTOM_SyEditView3",
      new Oe()
    ), e.component("SyFileUpload", Te), e.component("SyGridFileUpload", De), e.component("SyEditGridFileUpload", Ne), e.component("SyGridFileUploadContainer", Ie), ibiz.register.editor.register(
      "EDITOR_CUSTOMSTYLE_SyFileUpload",
      new Ve()
    );
  }
};
export {
  Ke as default
};
