UNPKG

@form-create/tdesign

Version:

TDesign 版本低代码表单 | FormCreate 是一个可以通过 JSON 生成具有动态渲染、数据收集、验证和提交功能的低代码表单生成组件。

5,969 lines • 199 kB
/*!
 * FormCreate 低代码表单渲染器
 * @form-create/tdesign v3.3.6
 * (c) 2018-2026 xaboy
 * Github https://github.com/xaboy/form-create
 * Site https://form-create.com/
 * Released under the MIT License.
 */
(function(){"use strict";try{if(typeof document!="undefined"){var r=document.createElement("style");r.appendChild(document.createTextNode('._fc-frame ._fc-files img{width:100%;height:100%;display:inline-block;vertical-align:top}._fc-frame ._fc-upload-cover{opacity:0;position:absolute;inset:0;background:#0009;transition:opacity .3s}._fc-frame ._fc-upload-cover ._fc-frame-icon{color:#fff;font-size:20px;margin:0 2px}._fc-frame ._fc-files:hover ._fc-upload-cover{opacity:1}._fc-frame .t-upload{display:block}._fc-frame ._fc-upload-btn,._fc-frame ._fc-frame-icon{cursor:pointer;font-size:20px;width:20px}._fc-frame._fc-disabled ._fc-upload-btn,._fc-frame._fc-disabled ._fc-frame-icon{cursor:not-allowed!important;color:#999}._fc-frame .t-input-adornment__append ._fc-frame-icon{margin:5px 12px 0}._fc-frame ._fc-upload-btn,._fc-files{display:inline-block;width:112px;height:112px;text-align:center;line-height:112px;border:1px solid #c0ccda;overflow:hidden;background:#fff;position:relative;box-shadow:2px 2px 5px #0000001a;margin-right:4px;box-sizing:border-box}._fc-group{display:flex;min-height:38px;justify-content:center;flex-direction:column;width:100%}._fc-group-disabled ._fc-group-btn,._fc-group-disabled ._fc-group-add{cursor:not-allowed}._fc-group-handle{display:flex;flex-direction:row;position:absolute;bottom:-15px;right:30px;border-radius:15px;border:1px dashed #d9d9d9;padding:3px 8px;background-color:#fff}._fc-group-btn{cursor:pointer}._fc-group-idx._fc-group-drag{cursor:grab;width:auto;min-width:30px;padding:0 8px;gap:4px;user-select:none}._fc-group-idx._fc-group-drag:active{cursor:grabbing}._fc-group-grip{flex-shrink:0;color:#666;font-weight:500;line-height:1;font-size:14px}._fc-group-dragging{opacity:.55}._fc-group-idx{position:absolute;bottom:-15px;left:10px;width:30px;height:30px;display:flex;align-items:center;justify-content:center;background:#eee;border-radius:15px;font-weight:500}._fc-group-handle ._fc-group-btn+._fc-group-btn{margin-left:7px}._fc-group-container{position:relative;display:flex;flex-direction:column;border:1px dashed #d9d9d9;border-radius:5px;margin:5px 5px 25px;padding:20px 20px 25px}._fc-group-plus-minus{width:20px;height:20px;position:relative;cursor:pointer}._fc-group-plus-minus:before,._fc-group-plus-minus:after{content:"";position:absolute;top:50%;left:50%;width:60%;height:2px;background-color:#409eff;transform:translate(-50%,-50%)}._fc-group-plus-minus:before{transform:translate(-50%,-50%) rotate(90deg)}._fc-group-plus-minus._fc-group-minus:before{display:none}._fc-group-plus-minus._fc-group-minus:after{background-color:#f56c6c}._fc-group-add{cursor:pointer;width:25px;height:25px;border:1px solid rgb(64 158 255 / 50%);border-radius:15px}._fc-group-add._fc-group-plus-minus:before,._fc-group-add._fc-group-plus-minus:after{width:50%}._fc-group._fc-group-card{display:flex;flex-direction:column;width:100%;gap:16px}._fc-group._fc-group-card._fc-group-disabled ._fc-group-btn,._fc-group._fc-group-card._fc-group-disabled ._fc-group-add{cursor:not-allowed;opacity:.5}._fc-group._fc-group-card ._fc-group-container{position:relative;background:#fff;border:1px solid #f0f0f0;border-radius:6px;overflow:hidden;display:flex;flex-direction:column;padding:0;margin:0}._fc-group._fc-group-card ._fc-group-header{display:flex;align-items:center;justify-content:space-between;padding:16px 20px 12px;border-bottom:1px solid #f0f0f0;background:#fafafa}._fc-group._fc-group-card ._fc-group-idx{display:flex;align-items:center;justify-content:center;width:24px;height:24px;background:#f0f0f0;color:#666;border-radius:6px;font-size:12px;font-weight:500;margin-right:12px;flex-shrink:0;position:static;border:1px solid #e0e0e0}._fc-group._fc-group-card ._fc-group-title{flex:1;font-size:14px;font-weight:500;color:#000000d9;line-height:1.5715}._fc-group._fc-group-card ._fc-group-handle{display:flex;align-items:center;gap:4px;margin-left:12px;flex-shrink:0;position:static;bottom:auto;right:auto;border-radius:0;border:none;padding:0;background-color:transparent;flex-direction:row}._fc-group._fc-group-card ._fc-group-idx._fc-group-drag{width:auto;min-width:24px;height:24px;padding:0 6px;gap:3px;cursor:grab}._fc-group._fc-group-card ._fc-group-drag-btn{cursor:grab;margin-right:8px;flex-shrink:0;color:#00000073;font-size:18px;font-weight:500;line-height:1;letter-spacing:-1px;user-select:none}._fc-group._fc-group-card ._fc-group-drag-btn:active{cursor:grabbing}._fc-group._fc-group-card ._fc-group-btn{cursor:pointer;display:flex;align-items:center;justify-content:center;width:24px;height:24px;border-radius:4px;border:1px solid #d9d9d9;background:#fff;color:#00000073;position:relative}._fc-group._fc-group-card ._fc-group-btn:hover{color:#1890ff;border-color:#1890ff;background:#f0f8ff}._fc-group._fc-group-card ._fc-group-btn:active{color:#096dd9;border-color:#096dd9}._fc-group._fc-group-card ._fc-group-plus-minus{position:relative;background:#409eff;border-color:#409eff;color:#fff;width:24px;height:24px}._fc-group._fc-group-card ._fc-group-plus-minus:hover{background:#66b1ff;border-color:#66b1ff;color:#fff}._fc-group._fc-group-card ._fc-group-plus-minus:before,._fc-group._fc-group-card ._fc-group-plus-minus:after{content:"";position:absolute;top:50%;left:50%;background-color:currentColor;transform:translate(-50%,-50%)}._fc-group._fc-group-card ._fc-group-plus-minus:before{transform:translate(-50%,-50%) rotate(90deg)}._fc-group._fc-group-card ._fc-group-plus-minus._fc-group-minus{background:#f56c6c;border-color:#f56c6c}._fc-group._fc-group-card ._fc-group-plus-minus._fc-group-minus:hover{background:#f78989;border-color:#f78989}._fc-group._fc-group-card ._fc-group-plus-minus._fc-group-minus:before{display:none}._fc-group._fc-group-card ._fc-group-content{padding:20px}._fc-group._fc-group-card ._fc-group-add{cursor:pointer;display:flex;align-items:center;justify-content:center;width:24px;height:24px;border-radius:4px;border:1px solid #d9d9d9;background:#fff;color:#00000073;position:relative}._fc-group._fc-group-card ._fc-group-add:hover{color:#409eff;border-color:#409eff;background:#f0f8ff}._fc-group._fc-group-card ._fc-group-add._fc-group-plus-minus{width:24px;height:24px;background:#409eff;border-color:#409eff;color:#fff}._fc-group._fc-group-card ._fc-group-add._fc-group-plus-minus:hover{background:#66b1ff;border-color:#66b1ff;color:#fff}._fc-group._fc-group-card ._fc-group-add._fc-group-plus-minus:before,._fc-group._fc-group-card ._fc-group-add._fc-group-plus-minus:after{content:"";position:absolute;top:50%;left:50%;background-color:currentColor;transform:translate(-50%,-50%)}._fc-group._fc-group-card ._fc-group-add._fc-group-plus-minus:before{transform:translate(-50%,-50%) rotate(90deg)}._fc-group-container._fc-group-drag-over,._fc-group._fc-group-card ._fc-group-container._fc-group-drag-over{border-color:#409eff}._fc-group._fc-group-card ._fc-group-empty{text-align:center;padding:40px 20px;color:#00000073;font-size:14px}@media (max-width: 768px){._fc-group._fc-group-card ._fc-group-container{margin:0 -8px;border-radius:0;border-left:none;border-right:none}._fc-group._fc-group-card ._fc-group-header{padding:12px 16px 8px}._fc-group._fc-group-card ._fc-group-content{padding:16px}._fc-group._fc-group-card ._fc-group-handle{gap:2px}._fc-group._fc-group-card ._fc-group-btn{width:22px;height:22px}}.form-create{width:100%}.form-create .t-tree .t-tree__icon{line-height:inherit}.form-create.t-form:not(.t-form-inline) .t-form__item:last-of-type{margin-bottom:24px}.form-create .form-create .t-is-error .t-input__extra{color:var(--td-error-color)}.form-create .form-create .t-is-warning .t-input__extra{color:var(--td-warning-color)}.form-create.is-preview .fc-clock,.form-create .fc-none,.form-create.is-preview .t-form__label--required>label:before{display:none!important}.fc-form-footer{margin-top:12px}.form-create.is-numbered{counter-reset:q}.form-create.is-numbered .fc-form-title{counter-increment:q}.form-create.is-numbered .fc-form-title:before{content:counter(q) ". ";color:var(--fc-number-color, inherit);font-weight:600}.form-create.is-numbered.is-number-chinese .fc-form-title:before{content:counter(q,simp-chinese-informal) "、"}')),document.head.appendChild(r)}}catch(o){console.error("vite-plugin-css-injected-by-js",o)}})();
var Cr = Object.defineProperty, Dr = Object.defineProperties;
var Fr = Object.getOwnPropertyDescriptors;
var Et = Object.getOwnPropertySymbols;
var Er = Object.prototype.hasOwnProperty, kr = Object.prototype.propertyIsEnumerable;
var kt = (t, e, r) => e in t ? Cr(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, D = (t, e) => {
  for (var r in e || (e = {}))
    Er.call(e, r) && kt(t, r, e[r]);
  if (Et)
    for (var r of Et(e))
      kr.call(e, r) && kt(t, r, e[r]);
  return t;
}, ae = (t, e) => Dr(t, Fr(e));
import { openBlock as it, createElementBlock as st, createElementVNode as xe, defineComponent as Be, h as Ye, createVNode as M, resolveComponent as ye, mergeProps as et, createTextVNode as Rt, nextTick as X, markRaw as Ve, reactive as _e, isVNode as Rr, getCurrentInstance as mt, provide as Vr, inject as Ar, toRefs as Vt, onBeforeMount as jr, watchEffect as Mr, onMounted as Pr, onBeforeUnmount as Ir, onUpdated as Tr, watch as ue, computed as Ne, toRef as tt, withDirectives as Lr, resolveDirective as Br, ref as Nr, createApp as xr } from "vue";
function be(t) {
  return Array.isArray(t) ? t : [null, void 0, ""].indexOf(t) > -1 ? [] : [t];
}
function Qt(t) {
  t = t || /* @__PURE__ */ new Map();
  const e = {
    $on(r, n) {
      const o = t.get(r);
      o && o.push(n) || t.set(r, [n]);
    },
    $once(r, n) {
      n._once = !0, e.$on(r, n);
    },
    $off(r, n) {
      const o = t.get(r);
      o && o.splice(o.indexOf(n) >>> 0, 1);
    },
    $emit(r, ...n) {
      (t.get(r) || []).slice().map((o) => {
        o._once && (e.$off(r, o), delete o._once), o(...n);
      }), (t.get("*") || []).slice().map((o) => {
        o(r, n);
      });
    }
  };
  return e;
}
const ot = (t, e) => {
  const r = t.__vccOpts || t;
  for (const [n, o] of e)
    r[n] = o;
  return r;
}, qr = {
  name: "IconFolder"
}, Ur = {
  xmlns: "http://www.w3.org/2000/svg",
  viewBox: "0 0 32 32"
};
function Yr(t, e, r, n, o, i) {
  return it(), st("svg", Ur, [...e[0] || (e[0] = [
    xe("path", {
      d: "M26 20h-2v4h-4v2h4v4h2v-4h4v-2h-4z",
      fill: "currentColor"
    }, null, -1),
    xe("path", {
      d: "M28 8H16l-3.4-3.4c-.4-.4-.9-.6-1.4-.6H4c-1.1 0-2 .9-2 2v20c0 1.1.9 2 2 2h14v-2H4V6h7.2l3.4 3.4l.6.6H28v8h2v-8c0-1.1-.9-2-2-2z",
      fill: "currentColor"
    }, null, -1)
  ])]);
}
const Hr = /* @__PURE__ */ ot(qr, [["render", Yr]]), Wr = Be({
  name: "IconFile",
  render() {
    return Ye(
      "svg",
      {
        style: { width: "20px", fontSize: "20px" },
        viewBox: "0 0 24 24",
        version: "1.1",
        xmlns: "http://www.w3.org/2000/svg"
      },
      Ye(
        "g",
        {
          fill: "none",
          stroke: "currentColor",
          "stroke-width": "2",
          "stroke-linecap": "round",
          "stroke-linejoin": "round"
        },
        Ye("path", { d: "M14 3v4a1 1 0 0 0 1 1h4" }),
        Ye("path", { d: "M17 21H7a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7l5 5v11a2 2 0 0 1-2 2z" })
      )
    );
  }
}), Gr = {
  name: "DeleteOutlined"
}, zr = {
  height: "1em",
  width: "1em",
  xmlns: "http://www.w3.org/2000/svg",
  viewBox: "0 0 1024 1024"
};
function Jr(t, e, r, n, o, i) {
  return it(), st("svg", zr, [...e[0] || (e[0] = [
    xe("path", {
      d: "M360 184h-8c4.4 0 8-3.6 8-8v8h304v-8c0 4.4 3.6 8 8 8h-8v72h72v-80c0-35.3-28.7-64-64-64H352c-35.3 0-64 28.7-64 64v80h72v-72zm504 72H160c-17.7 0-32 14.3-32 32v32c0 4.4 3.6 8 8 8h60.4l24.7 523c1.6 34.1 29.8 61 63.9 61h454c34.2 0 62.3-26.8 63.9-61l24.7-523H888c4.4 0 8-3.6 8-8v-32c0-17.7-14.3-32-32-32zM731.3 840H292.7l-24.2-512h487l-24.2 512z",
      fill: "currentColor"
    }, null, -1)
  ])]);
}
const Qr = /* @__PURE__ */ ot(Gr, [["render", Jr]]), Kr = {
  name: "EyeOutlined"
}, Zr = {
  height: "1em",
  width: "1em",
  xmlns: "http://www.w3.org/2000/svg",
  viewBox: "0 0 1024 1024"
};
function Xr(t, e, r, n, o, i) {
  return it(), st("svg", Zr, [...e[0] || (e[0] = [
    xe("path", {
      d: "M942.2 486.2C847.4 286.5 704.1 186 512 186c-192.2 0-335.4 100.5-430.2 300.3a60.3 60.3 0 0 0 0 51.5C176.6 737.5 319.9 838 512 838c192.2 0 335.4-100.5 430.2-300.3c7.7-16.2 7.7-35 0-51.5zM512 766c-161.3 0-279.4-81.8-362.7-254C232.6 339.8 350.7 258 512 258c161.3 0 279.4 81.8 362.7 254C791.5 684.2 673.4 766 512 766zm-4-430c-97.2 0-176 78.8-176 176s78.8 176 176 176s176-78.8 176-176s-78.8-176-176-176zm0 288c-61.9 0-112-50.1-112-112s50.1-112 112-112s112 50.1 112 112s-50.1 112-112 112z",
      fill: "currentColor"
    }, null, -1)
  ])]);
}
const en = /* @__PURE__ */ ot(Kr, [["render", Xr]]), tn = "fcFrame", rn = /* @__PURE__ */ Be({
  name: tn,
  props: {
    type: {
      type: String,
      default: "input"
    },
    field: String,
    helper: {
      type: Boolean,
      default: !0
    },
    disabled: {
      type: Boolean,
      default: !1
    },
    src: {
      type: String,
      required: !0
    },
    icon: {
      type: String,
      default: "icon-folder"
    },
    width: {
      type: [Number, String],
      default: "500px"
    },
    height: {
      type: [Number, String],
      default: "370px"
    },
    maxLength: {
      type: Number,
      default: 0
    },
    okBtnText: {
      type: String,
      default: ""
    },
    closeBtnText: {
      type: String,
      default: ""
    },
    modalTitle: String,
    handleIcon: {
      type: [String, Boolean],
      default: void 0
    },
    title: String,
    allowRemove: {
      type: Boolean,
      default: !0
    },
    onOpen: {
      type: Function,
      default: () => {
      }
    },
    onOk: {
      type: Function,
      default: () => {
      }
    },
    onCancel: {
      type: Function,
      default: () => {
      }
    },
    onLoad: {
      type: Function,
      default: () => {
      }
    },
    onBeforeRemove: {
      type: Function,
      default: () => {
      }
    },
    onRemove: {
      type: Function,
      default: () => {
      }
    },
    onHandle: Function,
    modal: {
      type: Object,
      default: () => ({})
    },
    srcKey: [String, Number],
    modelValue: [Array, String, Number, Object],
    previewMask: void 0,
    footer: {
      type: Boolean,
      default: !0
    },
    reload: {
      type: Boolean,
      default: !0
    },
    closeBtn: {
      type: Boolean,
      default: !0
    },
    okBtn: {
      type: Boolean,
      default: !0
    },
    formCreateInject: Object
  },
  emits: ["update:modelValue", "change"],
  components: {
    IconFolder: Hr,
    EyeOutlined: en
  },
  data() {
    return {
      fileList: be(this.modelValue),
      previewVisible: !1,
      frameVisible: !1,
      previewImage: "",
      bus: new Qt()
    };
  },
  watch: {
    modelValue(t) {
      this.fileList = be(t);
    }
  },
  methods: {
    key(t) {
      return t;
    },
    close() {
      this.closeModal(!0);
    },
    closeModal(t) {
      this.bus.$emit(t ? "$close" : "$ok"), this.reload && (this.bus.$off("$ok"), this.bus.$off("$close")), this.frameVisible = !1;
    },
    handleCancel() {
      this.previewVisible = !1;
    },
    showModal() {
      this.disabled || this.onOpen() === !1 || (this.frameVisible = !0);
    },
    input() {
      const t = this.fileList, e = this.maxLength === 1 ? t[0] || "" : t;
      this.$emit("update:modelValue", e), this.$emit("change", e);
    },
    makeInput() {
      const t = ye(this.icon);
      return M(ye("t-input-adornment"), {
        append: () => M(t, {
          onClick: this.showModal,
          class: "_fc-frame-icon"
        }, null)
      }, {
        default: () => [M(ye("TInput"), {
          readonly: !0,
          clearable: !this.disabled,
          showClearIconOnEmpty: !this.disabled,
          value: this.fileList.map((e) => this.getSrc(e)).toString(),
          onClear: () => {
            this.fileList = [], this.input();
          },
          key: 1
        }, null)]
      });
    },
    makeGroup(t) {
      return (!this.maxLength || this.fileList.length < this.maxLength) && t.push(this.makeBtn()), M("div", {
        key: 2
      }, [t]);
    },
    makeItem(t, e) {
      return M("div", {
        class: "_fc-files",
        key: "3" + t
      }, [e]);
    },
    valid(t) {
      const e = this.formCreateInject.field || this.field;
      if (e && t !== e)
        throw new Error("[frame]无效的字段值");
    },
    makeIcons(t, e) {
      if (this.handleIcon !== !1 || this.allowRemove === !0) {
        const r = [];
        return (this.type !== "file" && this.handleIcon !== !1 || this.type === "file" && this.handleIcon) && r.push(this.makeHandleIcon(t, e)), this.allowRemove && r.push(this.makeRemoveIcon(t, e)), M("div", {
          class: "_fc-upload-cover",
          key: 4
        }, [r]);
      }
    },
    makeHandleIcon(t, e) {
      const r = ye(this.handleIcon === !0 || this.handleIcon === void 0 ? "EyeOutlined" : this.handleIcon);
      return M(r, {
        class: "_fc-frame-icon",
        onClick: () => this.handleClick(t),
        key: "5" + e
      }, null);
    },
    makeRemoveIcon(t, e) {
      return M(Qr, {
        class: "_fc-frame-icon",
        onClick: () => this.handleRemove(t),
        key: "6" + e
      }, null);
    },
    makeFiles() {
      return this.makeGroup(this.fileList.map((t, e) => this.makeItem(e, [M(Wr, {
        size: "20",
        onClick: () => this.handleClick(t)
      }, null), this.makeIcons(t, e)])));
    },
    makeImages() {
      return this.makeGroup(this.fileList.map((t, e) => this.makeItem(e, [M("img", {
        src: this.getSrc(t)
      }, null), this.makeIcons(t, e)])));
    },
    makeBtn() {
      const t = ye(this.icon);
      return M("div", {
        class: "_fc-upload-btn",
        onClick: () => this.showModal(),
        key: 7
      }, [M(t, {
        class: "_fc-frame-icon"
      }, null)]);
    },
    handleClick(t) {
      if (this.onHandle)
        return this.onHandle(t);
      this.previewImage = this.getSrc(t), this.previewVisible = !0;
    },
    handleRemove(t) {
      this.disabled || this.onBeforeRemove(t) !== !1 && (this.fileList.splice(this.fileList.indexOf(t), 1), this.input(), this.onRemove(t));
    },
    getSrc(t) {
      return this.srcKey ? t[this.srcKey] : t;
    },
    onFrameLoad(t) {
      this.frameLoad(t.target.contentWindow || {});
    },
    frameLoad(t) {
      this.onLoad(t);
      try {
        this.helper === !0 && (t.form_create_helper = {
          api: this.formCreateInject.api,
          close: (e) => {
            this.valid(e), this.closeModal();
          },
          set: (e, r) => {
            this.valid(e), this.disabled || (this.$emit("update:modelValue", r), this.$emit("change", r));
          },
          get: (e) => (this.valid(e), this.modelValue),
          onOk: (e) => this.bus.$on("$ok", e),
          onClose: (e) => this.bus.$on("$close", e)
        });
      } catch (e) {
        console.error(e);
      }
    },
    makeFooter() {
      const {
        okBtnText: t,
        closeBtnText: e,
        closeBtn: r,
        okBtn: n,
        footer: o
      } = this.$props, i = [];
      return o && (r && i.push(M(ye("TButton"), {
        onClick: () => this.onCancel() !== !1 && this.closeModal(!0)
      }, {
        default: () => [e || this.formCreateInject.t("close") || "关闭"]
      })), n && i.push(M(ye("TButton"), {
        theme: "primary",
        onClick: () => this.onOk() !== !1 && this.closeModal()
      }, {
        default: () => [t || this.formCreateInject.t("ok") || "确定"]
      }))), i;
    }
  },
  render() {
    const t = this.type;
    let e;
    t === "input" ? e = this.makeInput() : t === "image" ? e = this.makeImages() : e = this.makeFiles();
    const {
      width: r = "30%",
      height: n,
      src: o,
      title: i,
      modalTitle: s
    } = this.$props;
    return M("div", {
      class: {
        "_fc-frame": !0,
        "_fc-disabled": this.disabled
      }
    }, [e, M(ye("TDialog"), {
      mask: this.previewMask,
      header: s,
      visible: this.previewVisible,
      style: "width: 600px;",
      attach: "body",
      "onUpdate:visible": (a) => this.previewVisible = a,
      footer: !1
    }, {
      default: () => [M("img", {
        style: "width: 100%",
        src: this.previewImage,
        key: 1
      }, null)]
    }), M(ye("TDialog"), et(D({
      width: r,
      header: i
    }, this.modal), {
      visible: this.frameVisible,
      attach: "body",
      style: {
        width: r
      },
      onClose: () => this.frameVisible = !1,
      onConfirm: () => this.closeModal(!0),
      key: 2
    }), {
      default: () => [this.frameVisible || !this.reload ? M("iframe", {
        ref: "frame",
        src: o,
        frameborder: "0",
        onLoad: this.onFrameLoad,
        style: {
          height: n,
          border: "0 none",
          width: "100%"
        }
      }, null) : null],
      action: () => this.makeFooter()
    })]);
  },
  beforeMount() {
    const {
      name: t,
      field: e,
      api: r
    } = this.formCreateInject;
    t && r.on("fc:closeModal:" + t, this.close), e && r.on("fc:closeModal:" + e, this.close);
  },
  beforeUnmount() {
    const {
      name: t,
      field: e,
      api: r
    } = this.formCreateInject;
    t && r.off("fc:closeModal:" + t, this.close), e && r.off("fc:closeModal:" + e, this.close);
  }
}), nn = "fcUpload";
function At(t, e) {
  return typeof t == "object" ? t : {
    url: t,
    is_string: !0,
    name: sn(t),
    status: "success",
    uid: e
  };
}
function jt(t) {
  return ae(D({}, t), {
    file: t,
    value: t
  });
}
function sn(t) {
  return ("" + t).split("/").pop();
}
const on = /* @__PURE__ */ Be({
  name: nn,
  inheritAttrs: !1,
  formCreateParser: {
    toFormValue(t) {
      return be(t);
    },
    toValue(t, e) {
      return e.prop.props.limit === 1 ? t[0] || "" : t;
    }
  },
  props: {
    limit: {
      type: Number,
      default: 0
    },
    formCreateInject: Object,
    modelValue: {
      type: [Array, String, Object],
      default: []
    },
    onSuccess: {
      type: Function
    },
    onRemove: {
      type: Function
    },
    name: String,
    requestMethod: Function
  },
  emits: ["update:modelValue", "fc.el"],
  data() {
    return {
      uploadList: be(this.modelValue).map(At).map(jt)
    };
  },
  watch: {
    modelValue(t) {
      this.uploadList = be(t).map(At).map(jt);
    }
  },
  methods: {
    handleRemove({
      index: t
    }) {
      this.uploadList.splice(t, 1), this.onRemove && this.onRemove(...arguments), this.input();
    },
    handleSuccess({
      file: t,
      fileList: e
    }) {
      this.uploadList = e, t.status === "success" && this.onSuccess && this.onSuccess(...arguments), this.input();
    },
    input() {
      this.$emit("update:modelValue", this.uploadList.map((t) => t.is_string ? t.url : t.value || t.url).filter((t) => t !== void 0));
    },
    doRequestMethod(t) {
      const e = this.requestMethod;
      if (e)
        return e(t);
      const r = Array.isArray(t) ? t[0] : t, n = (r == null ? void 0 : r.raw) || (r == null ? void 0 : r.file) || r;
      return new Promise((o, i) => {
        var a;
        const s = {
          method: ((a = this.$attrs) == null ? void 0 : a.method) || "post",
          file: n,
          filename: this.name || "file",
          source: "upload",
          onSuccess: (l) => o({
            status: "success",
            response: l
          }),
          onError: (l) => i(l)
        };
        this.formCreateInject.api.fetch(s);
      });
    }
  },
  render() {
    const {
      uploadList: t,
      handleSuccess: e,
      handleRemove: r,
      $slots: n
    } = this;
    return M("div", {
      class: "_fc-upload",
      style: "width: 100%;"
    }, [M(ye("t-upload"), et({
      max: this.limit || void 0,
      theme: "image",
      accept: "image/*",
      modelValue: t,
      name: this.name
    }, this.$attrs, {
      requestMethod: this.doRequestMethod,
      onSuccess: e,
      onRemove: r,
      ref: "el"
    }), n)]);
  },
  mounted() {
    this.$emit("fc.el", this.$refs.el);
  }
}), m = {
  type(t, e) {
    return Object.prototype.toString.call(t) === "[object " + e + "]";
  },
  Undef(t) {
    return t == null;
  },
  Element(t) {
    return typeof t == "object" && t !== null && t.nodeType === 1 && !m.Object(t);
  },
  trueArray(t) {
    return Array.isArray(t) && t.length > 0;
  },
  Function(t) {
    const e = this.getType(t);
    return e === "Function" || e === "AsyncFunction";
  },
  getType(t) {
    const e = Object.prototype.toString.call(t);
    return /^\[object (.*)\]$/.exec(e)[1];
  },
  empty(t) {
    return t == null || Array.isArray(t) && Array.isArray(t) && !t.length ? !0 : typeof t == "string" && !t;
  }
};
["Date", "Object", "String", "Boolean", "Array", "Number"].forEach((t) => {
  m[t] = function(e) {
    return m.type(e, t);
  };
});
function G(t, e) {
  return {}.hasOwnProperty.call(t, e);
}
function fe(t, e, r) {
  t[e] = r;
}
function Te(t, e) {
  delete t[e];
}
function ze(t, e = {}, r) {
  let n = !1;
  for (let o in e)
    if (Object.prototype.hasOwnProperty.call(e, o)) {
      let i = e[o];
      if ((n = Array.isArray(i)) || m.Object(i)) {
        let s = t[o] === void 0;
        if (n)
          n = !1, s && fe(t, o, []);
        else if (i._clone && r !== void 0)
          if (r)
            i = i.getRule(), s && fe(t, o, {});
          else {
            fe(t, o, i._clone());
            continue;
          }
        else
          s && fe(t, o, {});
        t[o] = ze(t[o], i, r);
      } else
        fe(t, o, i), m.Undef(i) || (m.Undef(i.__json) || (t[o].__json = i.__json), m.Undef(i.__origin) || (t[o].__origin = i.__origin));
    }
  return r !== void 0 && Array.isArray(t) ? t.filter((o) => !o || !o.__ctrl) : t;
}
function Oe(t) {
  return ze({}, { value: t }).value;
}
const an = Object.assign || function(t) {
  for (let e, r = 1; r < arguments.length; r++)
    for (let n in e = arguments[r], e)
      Object.prototype.hasOwnProperty.call(e, n) && fe(t, n, e[n]);
  return t;
};
function R() {
  return an.apply(this, arguments);
}
function gt(t) {
  return typeof t != "object" || t === null ? t : t instanceof Array ? [...t] : D({}, t);
}
function Ae(t, e) {
  var r = null;
  return function(...n) {
    r !== null && clearTimeout(r), r = setTimeout(() => t.call(this, ...n), e);
  };
}
function Kt(t) {
  return t == null ? "" : typeof t == "object" ? JSON.stringify(t, null, 2) : String(t);
}
function ln(t) {
  return t && typeof t == "object" && typeof t.then == "function";
}
function rt(t) {
  return ln(t) ? t : Promise.resolve(t);
}
function We(t) {
  let e = t.replace(/([A-Z])/g, "-$1").toLocaleLowerCase();
  return e.indexOf("-") === 0 && (e = e.substr(1)), e;
}
function Zt(t) {
  return t.replace(t[0], t[0].toLocaleUpperCase());
}
function Xt(t, e, r) {
  return `[form-create ${t}]: ${e}`;
}
function vt(t, e) {
  console.error(Xt("err", t));
}
function un(t) {
  vt(t.toString()), console.error(t);
}
const yt = "[[FORM-CREATE-PREFIX-", bt = "-FORM-CREATE-SUFFIX]]";
function Ge(t, e) {
  return JSON.stringify(ze(Array.isArray(t) ? [] : {}, t, !0), function(r, n) {
    if (!(n && n._isVue === !0)) {
      if (typeof n != "function")
        return n;
      if (n.__json)
        return n.__json;
      if (n.__origin && (n = n.__origin), !n.__emit)
        return yt + n + bt;
    }
  }, e);
}
function ft(t) {
  return new Function("return " + t)();
}
function we(t, e) {
  if (t && m.String(t) && t.length > 4) {
    let r = t.trim(), n = !1;
    try {
      if (r.indexOf(bt) > 0 && r.indexOf(yt) === 0)
        r = r.replace(bt, "").replace(yt, ""), n = !0;
      else if (r.indexOf("$FN:") === 0)
        r = r.substring(4), n = !0;
      else if (r.indexOf("$EXEC:") === 0)
        r = r.substring(6), n = !0;
      else if (r.indexOf("$GLOBAL:") === 0) {
        const i = r.substring(8);
        return r = function(...s) {
          const a = s[0].api.getGlobalEvent(i);
          if (a)
            return a.call(this, ...s);
        }, r.__json = t, r.__inject = !0, r;
      } else {
        if (r.indexOf("$FNX:") === 0)
          return r = ft(`function($inject){
` + r.substring(5) + `
}`), r.__json = t, r.__inject = !0, r;
        (!e && r.indexOf("function ") === 0 && r !== "function " || !e && r.indexOf("function(") === 0 && r !== "function(") && (n = !0);
      }
      if (!n) return t;
      let o;
      try {
        o = ft(r);
      } catch (i) {
        o = ft("function " + r);
      }
      return o.__json = t, o;
    } catch (o) {
      vt(`解析失败:${r}

err: ${o}`);
      return;
    }
  }
  return t;
}
function er(t, e) {
  return JSON.parse(t, function(r, n) {
    return m.Undef(n) || !n.indexOf ? n : we(n, e);
  });
}
let fn = 0;
function at() {
  const t = 370 + ++fn;
  return "F" + Math.random().toString(36).substr(3, 3) + (+`${Date.now()}`).toString(36) + t.toString(36) + "c";
}
function Me(t, e, r) {
  let n = t, o;
  return (e || "").split(".").forEach((i) => {
    o && ((!n[o] || typeof n[o] != "object") && (n[o] = {}), n = n[o]), o = i;
  }), n[o] = r, n;
}
const Je = 4;
function cn(t, e, r) {
  let n = null, o = 1 / 0;
  return t.forEach((i, s) => {
    if (e < i.left || e > i.right || r < i.top || r > i.bottom)
      return;
    const a = e - (i.left + i.right) / 2, l = r - (i.top + i.bottom) / 2, u = a * a + l * l;
    u < o && (o = u, n = s);
  }), n;
}
const dn = "fcGroup", hn = /* @__PURE__ */ Be({
  name: dn,
  props: {
    field: String,
    rule: Array,
    expand: Number,
    options: Object,
    button: {
      type: Boolean,
      default: !0
    },
    max: {
      type: Number,
      default: 0
    },
    min: {
      type: Number,
      default: 0
    },
    modelValue: {
      type: Array,
      default: () => []
    },
    defaultValue: Object,
    sortBtn: {
      type: Boolean,
      default: !0
    },
    disabled: {
      type: Boolean,
      default: !1
    },
    syncDisabled: {
      type: Boolean,
      default: !0
    },
    title: {
      type: [String, Function],
      default: null
    },
    type: {
      type: String,
      default: "default"
    },
    onBeforeRemove: {
      type: Function,
      default: () => {
      }
    },
    onBeforeAdd: {
      type: Function,
      default: () => {
      }
    },
    formCreateInject: Object,
    parse: Function
  },
  data() {
    return {
      len: 0,
      cacheRule: {},
      cacheValue: {},
      sort: [],
      dragFrom: null,
      dragOverIndex: null,
      form: Ve(this.formCreateInject.form.$form())
    };
  },
  emits: ["update:modelValue", "change", "itemMounted", "remove", "add"],
  watch: {
    rule: {
      handler(t, e) {
        Object.keys(this.cacheRule).forEach((r) => {
          const n = this.cacheRule[r];
          if (n.$f) {
            const o = n.$f.formData();
            if (t === e)
              n.$f.deferSyncValue(() => {
                ze(n.rule, t), n.$f.setValue(o);
              }, !0);
            else {
              const i = n.$f.formData();
              n.$f.once("reloading", () => {
                n.$f.setValue(i);
              }), n.rule = Oe(t);
            }
          }
        });
      },
      deep: !0
    },
    expand(t) {
      let e = t - this.modelValue.length;
      e > 0 && this.expandRule(e);
    },
    modelValue: {
      handler(t) {
        t = t || [];
        let e = this.sort, r = e.length, n = r - t.length;
        if (n < 0) {
          for (let o = n; o < 0; o++)
            this.addRule(t.length + o, !0);
          for (let o = 0; o < r; o++)
            this.setValue(e[o], t[o]);
        } else {
          if (n > 0)
            for (let o = 0; o < n; o++)
              this.removeRule(e[r - o - 1]);
          t.forEach((o, i) => {
            this.setValue(e[i], t[i]);
          });
        }
      },
      deep: !0
    }
  },
  methods: {
    _value(t) {
      return t && G(t, this.field) ? t[this.field] : t;
    },
    cache(t, e) {
      this.cacheValue[t] = JSON.stringify(e);
    },
    input(t) {
      this.$emit("update:modelValue", t), this.$emit("change", t);
    },
    formData(t, e) {
      const r = this.cacheRule, n = this.sort;
      if (n.filter((i) => r[i] && r[i].$f).length !== n.length)
        return;
      const o = n.map((i) => {
        const s = t === i ? e : D({}, this.cacheRule[i].$f.form), a = this.field ? m.Undef(s[this.field]) ? null : s[this.field] : s;
        return this.cache(i, a), a;
      });
      this.input(o);
    },
    setValue(t, e) {
      const r = this.field;
      r && (e = {
        [r]: this._value(e)
      }), this.cacheValue[t] !== JSON.stringify(r ? e[r] : e) && (this.cacheRule[t].$f && this.cacheRule[t].$f.coverValue(e), this.cache(t, e));
    },
    addRule(t, e) {
      const r = this.formCreateInject.form.copyRules(this.rule || []), n = this.options ? D({}, this.options) : {
        submitBtn: !1,
        resetBtn: !1
      };
      if (this.defaultValue) {
        n.formData || (n.formData = {});
        const o = Oe(this.defaultValue);
        R(n.formData, this.field ? {
          [this.field]: o
        } : o);
      }
      this.parse && this.parse({
        rule: r,
        options: n,
        index: this.sort.length
      }), this.cacheRule[++this.len] = {
        rule: r,
        options: n
      }, this.sort = Object.keys(this.cacheRule), e && X(() => this.$emit("add", r, Object.keys(this.cacheRule).length - 1));
    },
    add$f(t, e, r) {
      this.cacheRule[e].$f = r, X(() => {
        this.$emit("itemMounted", r, Object.keys(this.cacheRule).indexOf(e));
      });
    },
    removeRule(t, e) {
      const r = Object.keys(this.cacheRule).indexOf(t);
      delete this.cacheRule[t], delete this.cacheValue[t], this.sort = Object.keys(this.cacheRule), e && X(() => this.$emit("remove", r));
    },
    add(t) {
      if (this.disabled || this.onBeforeAdd(this.modelValue) === !1)
        return;
      const e = [...this.modelValue];
      e.push(this.defaultValue ? Oe(this.defaultValue) : this.field ? null : {}), this.input(e);
    },
    del(t, e) {
      if (this.disabled)
        return;
      const r = () => {
        this.removeRule(e, !0);
        const n = [...this.modelValue];
        n.splice(t, 1), this.input(n);
      };
      rt(this.onBeforeRemove(this.modelValue, t)).then((n) => {
        n !== !1 && r();
      });
    },
    addIcon(t) {
      return M("div", {
        class: "_fc-group-btn _fc-group-plus-minus",
        onClick: this.add
      }, null);
    },
    delIcon(t, e) {
      return M("div", {
        class: "_fc-group-btn _fc-group-plus-minus _fc-group-minus",
        onClick: () => this.del(t, e)
      }, null);
    },
    moveSort(t, e) {
      if (t === e || t < 0 || e < 0 || t >= this.sort.length || e >= this.sort.length)
        return;
      const r = this.sort.slice(), [n] = r.splice(t, 1);
      r.splice(e, 0, n), this.sort = r, this.formCreateInject.subForm(this.sort.map((o) => this.cacheRule[o].$f)), this.formData(0);
    },
    dragStart(t, e) {
      if (this.dragFrom = e, this.dragOverIndex = null, !t.dataTransfer)
        return;
      t.dataTransfer.effectAllowed = "move", t.dataTransfer.setData("text/plain", String(e));
      const r = t.currentTarget.closest("._fc-group-container");
      if (r) {
        const n = r.getBoundingClientRect();
        t.dataTransfer.setDragImage(r, t.clientX - n.left, t.clientY - n.top);
      }
    },
    dragEnd() {
      this.dragFrom = null, this.dragOverIndex = null;
    },
    itemBounds(t) {
      const e = t.getBoundingClientRect();
      let r = e.top, n = e.right, o = e.bottom, i = e.left;
      return t.querySelectorAll(":scope > ._fc-group-handle, :scope > ._fc-group-idx").forEach((s) => {
        const a = s.getBoundingClientRect();
        r = Math.min(r, a.top), n = Math.max(n, a.right), o = Math.max(o, a.bottom), i = Math.min(i, a.left);
      }), {
        top: r - Je,
        right: n + Je,
        bottom: o + Je,
        left: i - Je
      };
    },
    locateDrag(t) {
      const e = t.currentTarget.querySelectorAll(":scope > ._fc-group-container");
      return cn(Array.from(e, (r) => this.itemBounds(r)), t.clientX, t.clientY);
    },
    groupDragOver(t) {
      if (this.dragFrom == null || this.disabled)
        return;
      const e = this.locateDrag(t);
      this.dragOverIndex !== e && (this.dragOverIndex = e), t.preventDefault(), t.dataTransfer && (t.dataTransfer.dropEffect = e == null || e === this.dragFrom ? "none" : "move");
    },
    groupDragLeave(t) {
      if (this.dragFrom == null)
        return;
      const e = t.relatedTarget;
      if (e && t.currentTarget.contains(e))
        return;
      const r = t.currentTarget.getBoundingClientRect();
      t.clientX >= r.left && t.clientX <= r.right && t.clientY >= r.top && t.clientY <= r.bottom || (this.dragOverIndex = null);
    },
    groupDrop(t) {
      if (this.dragFrom == null)
        return;
      t.preventDefault();
      const e = this.dragFrom, r = this.locateDrag(t);
      this.dragFrom = null, this.dragOverIndex = null, !(r == null || e === r) && this.moveSort(e, r);
    },
    canDrag(t) {
      return this.sortBtn && !this.disabled && t > 1;
    },
    indexIcon(t, e) {
      const r = this.canDrag(e);
      return M("div", {
        class: {
          "_fc-group-idx": !0,
          "_fc-group-drag": r
        },
        draggable: r,
        role: r ? "button" : void 0,
        "aria-label": r ? "拖动排序" : void 0,
        title: r ? "拖动排序" : void 0,
        onDragstart: r ? (n) => this.dragStart(n, t) : void 0,
        onDragend: r ? this.dragEnd : void 0
      }, [r ? M("span", {
        class: "_fc-group-grip",
        lang: "en"
      }, [Rt("⋮⋮")]) : null, M("span", null, [t + 1])]);
    },
    dragHandle(t, e) {
      return this.canDrag(e) ? M("div", {
        class: "_fc-group-drag-btn",
        lang: "en",
        draggable: !0,
        role: "button",
        "aria-label": "拖动排序",
        title: "拖动排序",
        onDragstart: (r) => this.dragStart(r, t),
        onDragend: this.dragEnd
      }, [Rt("⋮⋮")]) : null;
    },
    makeIcon(t, e, r) {
      if (this.$slots.button)
        return this.$slots.button({
          total: t,
          index: e,
          vm: this,
          key: r,
          del: () => this.del(e, r),
          add: this.add
        });
      const n = [];
      return (!this.max || t < this.max) && t === e + 1 && n.push(this.addIcon(r)), t > this.min && n.push(this.delIcon(e, r)), n;
    },
    expandRule(t) {
      for (let e = 0; e < t; e++)
        this.modelValue.push(this.field ? null : {});
      this.input([...this.modelValue]);
    },
    getTitle(t, e) {
      return typeof this.title == "function" ? this.title(t, this.modelValue[t], e) : typeof this.title == "string" ? this.title.replace("{index}", t + 1) : !1;
    }
  },
  created() {
    const t = (this.expand || 0) - this.modelValue.length;
    for (let e = 0; e < this.modelValue.length; e++)
      this.addRule(e);
    t > 0 && this.expandRule(t);
  },
  render() {
    const t = this.sort, e = this.button, r = this.form, n = this.disabled, o = this.type === "card", i = t.length === 0 ? this.$slots.default ? this.$slots.default({
      vm: this,
      add: this.add
    }) : M("div", {
      key: "a_def",
      class: "_fc-group-plus-minus _fc-group-add fc-clock",
      onClick: this.add
    }, null) : t.map((s, a) => {
      const {
        rule: l,
        options: u
      } = this.cacheRule[s], f = e && !n ? this.makeIcon(t.length, a, s) : [], d = this.getTitle(a, s);
      return o ? M("div", {
        class: {
          "_fc-group-container": !0,
          "_fc-group-dragging": this.dragFrom === a,
          "_fc-group-drag-over": this.dragOverIndex === a && this.dragFrom !== a
        },
        key: s
      }, [M("div", {
        class: "_fc-group-header"
      }, [d === !1 ? this.indexIcon(a, t.length) : this.dragHandle(a, t.length), d !== !1 ? M("div", {
        class: "_fc-group-title"
      }, [d]) : null, M("div", {
        class: "_fc-group-handle fc-clock"
      }, [f.length ? f : null])]), M("div", {
        class: "_fc-group-content"
      }, [M(r, et({
        key: s
      }, {
        disabled: n,
        "onUpdate:modelValue": (p) => this.formData(s, p),
        "onUpdate:api": (p) => this.add$f(a, s, p),
        inFor: !0,
        modelValue: this.field ? {
          [this.field]: this._value(this.modelValue[a])
        } : this.modelValue[a],
        rule: l,
        option: u,
        extendOption: !0
      }), null)])]) : M("div", {
        class: {
          "_fc-group-container": !0,
          "_fc-group-dragging": this.dragFrom === a,
          "_fc-group-drag-over": this.dragOverIndex === a && this.dragFrom !== a
        },
        key: s
      }, [M(r, et({
        key: s
      }, {
        disabled: n,
        "onUpdate:modelValue": (p) => this.formData(s, p),
        "onUpdate:api": (p) => this.add$f(a, s, p),
        inFor: !0,
        modelValue: this.field ? {
          [this.field]: this._value(this.modelValue[a])
        } : this.modelValue[a],
        rule: l,
        option: u,
        extendOption: !0
      }), null), this.indexIcon(a, t.length), f.length ? M("div", {
        class: "_fc-group-handle fc-clock"
      }, [f]) : null]);
    });
    return M("div", {
      key: "con",
      class: "_fc-group " + (n ? "_fc-group-disabled" : "") + (o ? " _fc-group-card" : ""),
      onDragenter: this.groupDragOver,
      onDragover: this.groupDragOver,
      onDragleave: this.groupDragLeave,
      onDrop: this.groupDrop
    }, [i]);
  }
}), pn = "fcSubForm", mn = /* @__PURE__ */ Be({
  name: pn,
  props: {
    rule: Array,
    options: {
      type: Object,
      default: () => _e({
        submitBtn: !1,
        resetBtn: !1
      })
    },
    modelValue: {
      type: Object,
      default: () => ({})
    },
    disabled: {
      type: Boolean,
      default: !1
    },
    syncDisabled: {
      type: Boolean,
      default: !0
    },
    formCreateInject: Object
  },
  data() {
    return {
      cacheValue: {},
      subApi: {},
      form: Ve(this.formCreateInject.form.$form())
    };
  },
  emits: ["fc:subform", "update:modelValue", "change", "itemMounted"],
  watch: {
    modelValue(t) {
      this.setValue(t);
    }
  },
  methods: {
    formData(t) {
      this.cacheValue = JSON.stringify(t), this.$emit("update:modelValue", t), this.$emit("change", t);
    },
    setValue(t) {
      const e = JSON.stringify(t);
      this.cacheValue !== e && (this.cacheValue = e, this.subApi.coverValue(t || {}));
    },
    add$f(t) {
      this.subApi = t, X(() => {
        this.$emit("itemMounted", t);
      });
    }
  },
  render() {
    const t = this.form;
    return M(t, {
      disabled: this.disabled,
      "onUpdate:modelValue": this.formData,
      modelValue: this.modelValue,
      "onUpdate:api": this.add$f,
      rule: this.rule,
      option: this.options,
      extendOption: !0
    }, null);
  }
}), gn = {
  name: "QuestionCircleOutlined"
}, yn = {
  height: "1em",
  width: "1em",
  xmlns: "http://www.w3.org/2000/svg",
  viewBox: "0 0 1024 1024"
};
function bn(t, e, r, n, o, i) {
  return it(), st("svg", yn, [...e[0] || (e[0] = [
    xe("path", {
      d: "M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448s448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372s372 166.6 372 372s-166.6 372-372 372z",
      fill: "currentColor"
    }, null, -1),
    xe("path", {
      d: "M623.6 316.7C593.6 290.4 554 276 512 276s-81.6 14.5-111.6 40.7C369.2 344 352 380.7 352 420v7.6c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V420c0-44.1 43.1-80 96-80s96 35.9 96 80c0 31.1-22 59.6-56.1 72.7c-21.2 8.1-39.2 22.3-52.1 40.9c-13.1 19-19.9 41.8-19.9 64.9V620c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8v-22.7a48.3 48.3 0 0 1 30.9-44.8c59-22.7 97.1-74.7 97.1-132.5c.1-39.3-17.1-76-48.3-103.3zM472 732a40 40 0 1 0 80 0a40 40 0 1 0-80 0z",
      fill: "currentColor"
    }, null, -1)
  ])]);
}
const $n = /* @__PURE__ */ ot(gn, [["render", bn]]), vn = [
  rn,
  on,
  hn,
  mn,
  $n
], tr = ["props"], rr = ["class", "style", "directives"], nr = ["on", "hook"], De = (t, e = {}, r = {}) => {
  const n = [...tr, ...r.normal || []], o = [...rr, ...r.array || []], i = [...nr, ...r.functional || []], s = r.props || [];
  return t.reduce((a, l) => {
    for (const u in l)
      if (a[u])
        if (s.indexOf(u) > -1)
          a[u] = De([l[u]], a[u]);
        else if (n.indexOf(u) > -1)
          a[u] = D(D({}, a[u]), l[u]);
        else if (o.indexOf(u) > -1) {
          const f = a[u] instanceof Array ? a[u] : [a[u]], d = l[u] instanceof Array ? l[u] : [l[u]];
          a[u] = [...f, ...d];
        } else if (i.indexOf(u) > -1)
          for (const f in l[u])
            if (a[u][f]) {
              const d = a[u][f] instanceof Array ? a[u][f] : [a[u][f]], p = l[u][f] instanceof Array ? l[u][f] : [l[u][f]];
              a[u][f] = [...d, ...p];
            } else
              a[u][f] = l[u][f];
        else if (u === "hook")
          for (let f in l[u])
            a[u][f] ? a[u][f] = _n(a[u][f], l[u][f]) : a[u][f] = l[u][f];
        else
          a[u] = l[u];
      else
        n.indexOf(u) > -1 || i.indexOf(u) > -1 || s.indexOf(u) > -1 ? a[u] = D({}, l[u]) : o.indexOf(u) > -1 ? a[u] = l[u] instanceof Array ? [...l[u]] : typeof l[u] == "object" ? D({}, l[u]) : l[u] : a[u] = l[u];
    return a;
  }, e);
}, _n = (t, e) => function() {
  t && t.apply(this, arguments), e && e.apply(this, arguments);
}, ir = ["type", "slot", "ignore", "emitPrefix", "value", "name", "native", "hidden", "display", "inject", "options", "emit", "link", "prefix", "suffix", "update", "sync", "optionsTo", "key", "slotUpdate", "computed", "preview", "component", "cache", "modelEmit"], _t = ["validate", "children", "control"], Ot = ["effect", "deep", "renderSlots"];
function sr() {
  return [...ir, ...tr, ...rr, ...nr, ..._t, ...Ot];
}
var lt = typeof globalThis != "undefined" ? globalThis : typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : {};
function ut(t) {
  return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
}
var or = { exports: {} };
(function(t, e) {
  (function(r, n) {
    t.exports = n();
  })(lt, function() {
    var r = 1e3, n = 6e4, o = 36e5, i = "millisecond", s = "second", a = "minute", l = "hour", u = "day", f = "week", d = "month", p = "quarter", h = "year", b = "date", S = "Invalid Date", w = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/, j = /\[([^\]]+)]|YYYY|YY|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g, A = { name: "en", weekdays: "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"), months: "January_February_March_April_May_June_July_August_September_October_November_December".split("_"), ordinal: function(F) {
      var O = ["th", "st", "nd", "rd"], v = F % 100;
      return "[" + F + (O[(v - 20) % 10] || O[v] || O[0]) + "]";
    } }, L = function(F, O, v) {
      var C = String(F);
      return !C || C.length >= O ? F : "" + Array(O + 1 - C.length).join(v) + F;
    }, te = { s: L, z: function(F) {
      var O = -F.utcOffset(), v = Math.abs(O), C = Math.floor(v / 60), _ = v % 60;
      return (O <= 0 ? "+" : "-") + L(C, 2, "0") + ":" + L(_, 2, "0");
    }, m: function F(O, v) {
      if (O.date() < v.date()) return -F(v, O);
      var C = 12 * (v.year() - O.year()) + (v.month() - O.month()), _ = O.clone().add(C, d), E = v - _ < 0, V = O.clone().add(C + (E ? -1 : 1), d);
      return +(-(C + (v - _) / (E ? _ - V : V - _)) || 0);
    }, a: function(F) {
      return F < 0 ? Math.ceil(F) || 0 : Math.floor(F);
    }, p: function(F) {
      return { M: d, y: h, w: f, d: u, D: b, h: l, m: a, s, ms: i, Q: p }[F] || String(F || "").toLowerCase().replace(/s$/, "");
    }, u: function(F) {
      return F === void 0;
    } }, ee = "en", Z = {};
    Z[ee] = A;
    var N = "$isDayjsObject", B = function(F) {
      return F instanceof J || !(!F || !F[N]);
    }, W = function F(O, v, C) {
      var _;
      if (!O) return ee;
      if (typeof O == "string") {
        var E = O.toLowerCase();
        Z[E] && (_ = E), v && (Z[E] = v, _ = E);
        var V = O.split("-");
        if (!_ && V.length > 1) return F(V[0]);
      } else {
        var T = O.name;
        Z[T] = O, _ = T;
      }
      return !C && _ && (ee = _), _ || !C && ee;
    }, x = function(F, O) {
      if (B(F)) return F.clone();
      var v = typeof O == "object" ? O : {};
      return v.date = F, v.args = arguments, new J(v);
    }, I = te;
    I.l = W, I.i = B, I.w = function(F, O) {
      return x(F, { locale: O.$L, utc: O.$u, x: O.$x, $offset: O.$offset });
    };
    var J = function() {
      function F(v) {
        this.$L = W(v.locale, null, !0), this.parse(v), this.$x = this.$x || v.x || {}, this[N] = !0;
      }
      var O = F.prototype;
      return O.parse = function(v) {
        this.$d = function(C) {
          var _ = C.date, E = C.utc;
          if (_ === null) return /* @__PURE__ */ new Date(NaN);
          if (I.u(_)) return /* @__PURE__ */ new Date();
          if (_ instanceof Date) return new Date(_);
          if (typeof _ == "string" && !/Z$/i.test(_)) {
            var V = _.match(w);
            if (V) {
              var T = V[2] - 1 || 0, H = (V[7] || "0").substring(0, 3);
              return E ? new Date(Date.UTC(V[1], T, V[3] || 1, V[4] || 0, V[5] || 0, V[6] || 0, H)) : new Date(V[1], T, V[3] || 1, V[4] || 0, V[5] || 0, V[6] || 0, H);
            }
          }
          return new Date(_);
        }(v), this.init();
      }, O.init = function() {
        var v = this.$d;
        this.$y = v.getFullYear(), this.$M = v.getMonth(), this.$D = v.getDate(), this.$W = v.getDay(), this.$H = v.getHours(), this.$m = v.getMinutes(), this.$s = v.getSeconds(), this.$ms = v.getMilliseconds();
      }, O.$utils = function() {
        return I;
      }, O.isValid = function() {
        return this.$d.toString() !== S;
      }, O.isSame = function(v, C) {
        var _ = x(v);
        return this.startOf(C) <= _ && _ <= this.endOf(C);
      }, O.isAfter = function(v, C) {
        return x(v) < this.startOf(C);
      }, O.isBefore = function(v, C) {
        return this.endOf(C) < x(v);
      }, O.$g = function(v, C, _) {
        return I.u(v) ? this[C] : this.set(_, v);
      }, O.unix = function() {
        return Math.floor(this.valueOf() / 1e3);
      }, O.valueOf = function() {
        return this.$d.getTime();
      }, O.startOf = function(v, C) {
        var _ = this, E = !!I.u(C) || C, V = I.p(v), T = function(g, y) {
          var $ = I.w(_.$u ? Date.UTC(_.$y, y, g) : new Date(_.$y, y, g), _);
          return E ? $ : $.endOf(u);
        }, H = function(g, y) {
          return I.w(_.toDate()[g].apply(_.toDate("s"), (E ? [0, 0, 0, 0] : [23, 59, 59, 999]).slice(y)), _);
        }, z = this.$W, Q = this.$M, re = this.$D, $e = "set" + (this.$u ? "UTC" : "");
        switch (V) {
          case h:
            return E ? T(1, 0) : T(31, 11);
          case d:
            return E ? T(1, Q) : T(0, Q + 1);
          case f:
            var se = this.$locale().weekStart || 0, c = (z < se ? z + 7 : z) - se;
            return T(E ? re - c : re + (6 - c), Q);
          case u:
          case b:
            return H($e + "Hours", 0);
          case l:
            return H($e + "Minutes", 1);
          case a:
            return H($e + "Seconds", 2);
          case s:
            return H($e + "Milliseconds", 3);
          default:
            return this.clone();
        }
      }, O.endOf = function(v) {
        return this.startOf(v, !1);
      }, O.$set = function(v, C) {
        var _, E = I.p(v), V = "set" + (this.$u ? "UTC" : ""), T = (_ = {}, _[u] = V + "Date", _[b] = V + "Date", _[d] = V + "Month", _[h] = V + "FullYear", _[l] = V + "Hours", _[a] = V + "Minutes", _[s] = V + "Seconds", _[i] = V + "Milliseconds", _)[E], H = E === u ? this.$D + (C - this.$W) : C;
        if (E === d || E === h) {
          var z = this.clone().set(b, 1);
          z.$d[T](H), z.init(), this.$d = z.set(b, Math.min(this.$D, z.daysInMonth())).$d;
        } else T && this.$d[T](H);
        return this.init(), this;
      }, O.set = function(v, C) {
        return this.clone().$set(v, C);
      }, O.get = function(v) {
        return this[I.p(v)]();
      }, O.add = function(v, C) {
        var _, E = this;
        v = Number(v);
        var V = I.p(C), T = function(Q) {
          var re = x(E);
          return I.w(re.date(re.date() + Math.round(Q * v)), E);
        };
        if (V === d) return this.set(d, this.$M + v);
        if (V === h) return this.set(h, this.$y + v);
        if (V === u) return T(1);
        if (V === f) return T(7);
        var H = (_ = {}, _[a] = n, _[l] = o, _[s] = r, _)[V] || 1, z = this.$d.getTime() + v * H;
        return I.w(z, this);
      }, O.subtract = function(v, C) {
        return this.add(-1 * v, C);
      }, O.format = function(v) {
        var C = this, _ = this.$locale();
        if (!this.isValid()) return _.invalidDate || S;
        var E = v || "YYYY-MM-DDTHH:mm:ssZ", V = I.z(this), T = this.$H, H = this.$m, z = this.$M, Q = _.weekdays, re = _.months, $e = _.meridiem, se = function(y, $, k, q) {
          return y && (y[$] || y(C, E)) || k[$].slice(0, q);
        }, c = function(y) {
          return I.s(T % 12 || 12, y, "0");
        }, g = $e || function(y, $, k) {
          var q = y < 12 ? "AM" : "PM";
          return k ? q.toLowerCase() : q;
        };
        return E.replace(j, function(y, $) {
          return $ || function(k) {
            switch (k) {
              case "YY":
                return String(C.$y).slice(-2);
              case "YYYY":
                return I.s(C.$y, 4, "0");
              case "M":
                return z + 1;
              case "MM":
                return I.s(z + 1, 2, "0");
              case "MMM":
                return se(_.monthsShort, z, re, 3);
              case "MMMM":
                return se(re, z);
              case "D":
                return C.$D;
              case "DD":
                return I.s(C.$D, 2, "0");
              case "d":
                return String(C.$W);
              case "dd":
                return se(_.weekdaysMin, C.$W, Q, 2);
              case "ddd":
                return se(_.weekdaysShort, C.$W, Q, 3);
              case "dddd":
                return Q[C.$W];
              case "H":
                return String(T);
              case "HH":
                return I.s(T, 2, "0");
              case "h":
                return c(1);
              case "hh":
                return c(2);
              case "a":
                return g(T, H, !0);
              case "A":
                return g(T, H, !1);
              case "m":
                return String(H);
              case "mm":
                return I.s(H, 2, "0");
              case "s":
                return String(C.$s);
              case "ss":
                return I.s(C.$s, 2, "0");
              case "SSS":
                return I.s(C.$ms, 3, "0");
              case "Z":
                return V;
            }
            return null;
          }(y) || V.replace(":", "");
        });
      }, O.utcOffset = function() {
        return 15 * -Math.round(this.$d.getTimezoneOffset() / 15);
      }, O.diff = function(v, C, _) {
        var E, V = this, T = I.p(C), H = x(v), z = (H.utcOffset() - this.utcOffset()) * n, Q = this - H, re = function() {
          return I.m(V, H);
        };
        switch (T) {
          case h:
            E = re() / 12;
            break;
          case d:
            E = re();
            break;
          case p:
            E = re() / 3;
            break;
          case f:
            E = (Q - z) / 6048e5;
            break;
          case u:
            E = (Q - z) / 864e5;
            break;
          case l:
            E = Q / o;
            break;
          case a:
            E = Q / n;
            break;
          case s:
            E = Q / r;
            break;
          default:
            E = Q;
        }
        return _ ? E : I.a(E);
      }, O.daysInMonth = function() {
        return this.endOf(d).$D;
      }, O.$locale = function() {
        return Z[this.$L];
      }, O.locale = function(v, C) {
        if (!v) return this.$L;
        var _ = this.clone(), E = W(v, C, !0);
        return E && (_.$L = E), _;
      }, O.clone = function() {
        return I.w(this.$d, this);
      }, O.toDate = function() {
        return new Date(this.valueOf());
      }, O.toJSON = function() {
        return this.isValid() ? this.toISOString() : null;
      }, O.toISOString = function() {
        return this.$d.toISOString();
      }, O.toString = function() {
        return this.$d.toUTCString();
      }, F;
    }(), ne = J.prototype;
    return x.prototype = ne, [["$ms", i], ["$s", s], ["$m", a], ["$H", l], ["$W", u], ["$M", d], ["$y", h], ["$D", b]].forEach(function(F) {
      ne[F[1]] = function(O) {
        return this.$g(O, F[0], F[1]);
      };
    }), x.extend = function(F, O) {
      return F.$i || (F(O, J, x), F.$i = !0), x;
    }, x.locale = W, x.isDayjs = B, x.unix = function(F) {
      return x(1e3 * F);
    }, x.en = Z[ee], x.Ls = Z, x.p = {}, x;
  });
})(or);
var On = or.exports;
const je = /* @__PURE__ */ ut(On);
var ar = { exports: {} };
(function(t, e) {
  (function(r, n) {
    t.exports = n();
  })(lt, function() {
    var r = { LTS: "h:mm:ss A", LT: "h:mm A", L: "MM/DD/YYYY", LL: "MMMM D, YYYY", LLL: "MMMM D, YYYY h:mm A", LLLL: "dddd, MMMM D, YYYY h:mm A" }, n = /(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|Q|YYYY|YY?|ww?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g, o = /\d/, i = /\d\d/, s = /\d\d?/, a = /\d*[^-_:/,()\s\d]+/, l = {}, u = function(w) {
      return (w = +w) + (w > 68 ? 1900 : 2e3);
    }, f = function(w) {
      return function(j) {
        this[w] = +j;
      };
    }, d = [/[+-]\d\d:?(\d\d)?|Z/, function(w) {
      (this.zone || (this.zone = {})).offset = function(j) {
        if (!j || j === "Z") return 0;
        var A = j.match(/([+-]|\d\d)/g), L = 60 * A[1] + (+A[2] || 0);
        return L === 0 ? 0 : A[0] === "+" ? -L : L;
      }(w);
    }], p = function(w) {
      var j = l[w];
      return j && (j.indexOf ? j : j.s.concat(j.f));
    }, h = function(w, j) {
      var A, L = l.meridiem;
      if (L) {
        for (var te = 1; te <= 24; te += 1) if (w.indexOf(L(te, 0, j)) > -1) {
          A = te > 12;
          break;
        }
      } else A = w === (j ? "pm" : "PM");
      return A;
    }, b = { A: [a, function(w) {
      this.afternoon = h(w, !1);
    }], a: [a, function(w) {
      this.afternoon = h(w, !0);
    }], Q: [o, function(w) {
      this.month = 3 * (w - 1) + 1;
    }], S: [o, function(w) {
      this.milliseconds = 100 * +w;
    }], SS: [i, function(w) {
      this.milliseconds = 10 * +w;
    }], SSS: [/\d{3}/, function(w) {
      this.milliseconds = +w;
    }], s: [s, f("seconds")], ss: [s, f("seconds")], m: [s, f("minutes")], mm: [s, f("minutes")], H: [s, f("hours")], h: [s, f("hours")], HH: [s, f("hours")], hh: [s, f("hours")], D: [s, f("day")], DD: [i, f("day")], Do: [a, function(w) {
      var j = l.ordinal, A = w.match(/\d+/);
      if (this.day = A[0], j) for (var L = 1; L <= 31; L += 1) j(L).replace(/\[|\]/g, "") === w && (this.day = L);
    }], w: [s, f("week")], ww: [i, f("week")], M: [s, f("month")], MM: [i, f("month")], MMM: [a, function(w) {
      var j = p("months"), A = (p("monthsShort") || j.map(function(L) {
        return L.slice(0, 3);
      })).indexOf(w) + 1;
      if (A < 1) throw new Error();
      this.month = A % 12 || A;
    }], MMMM: [a, function(w) {
      var j = p("months").indexOf(w) + 1;
      if (j < 1) throw new Error();
      this.month = j % 12 || j;
    }], Y: [/[+-]?\d+/, f("year")], YY: [i, function(w) {
      this.year = u(w);
    }], YYYY: [/\d{4}/, f("year")], Z: d, ZZ: d };
    function S(w) {
      var j, A;
      j = w, A = l && l.formats;
      for (var L = (w = j.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g, function(x, I, J) {
        var ne = J && J.toUpperCase();
        return I || A[J] || r[J] || A[ne].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g, function(F, O, v) {
          return O || v.slice(1);
        });
      })).match(n), te = L.length, ee = 0; ee < te; ee += 1) {
        var Z = L[ee], N = b[Z], B = N && N[0], W = N && N[1];
        L[ee] = W ? { regex: B, parser: W } : Z.replace(/^\[|\]$/g, "");
      }
      return function(x) {
        for (var I = {}, J = 0, ne = 0; J < te; J += 1) {
          var F = L[J];
          if (typeof F == "string") ne += F.length;
          else {
            var O = F.regex, v = F.parser, C = x.slice(ne), _ = O.exec(C)[0];
            v.call(I, _), x = x.replace(_, "");
          }
        }
        return function(E) {
          var V = E.afternoon;
          if (V !== void 0) {
            var T = E.hours;
            V ? T < 12 && (E.hours += 12) : T === 12 && (E.hours = 0), delete E.afternoon;
          }
        }(I), I;
      };
    }
    return function(w, j, A) {
      A.p.customParseFormat = !0, w && w.parseTwoDigitYear && (u = w.parseTwoDigitYear);
      var L = j.prototype, te = L.parse;
      L.parse = function(ee) {
        var Z = ee.date, N = ee.utc, B = ee.args;
        this.$u = N;
        var W = B[1];
        if (typeof W == "string") {
          var x = B[2] === !0, I = B[3] === !0, J = x || I, ne = B[2];
          I && (ne = B[2]), l = this.$locale(), !x && ne && (l = A.Ls[ne]), this.$d = function(C, _, E, V) {
            try {
              if (["x", "X"].indexOf(_) > -1) return new Date((_ === "X" ? 1e3 : 1) * C);
              var T = S(_)(C), H = T.year, z = T.month, Q = T.day, re = T.hours, $e = T.minutes, se = T.seconds, c = T.milliseconds, g = T.zone, y = T.week, $ = /* @__PURE__ */ new Date(), k = Q || (H || z ? 1 : $.getDate()), q = H || $.getFullYear(), U = 0;
              H && !z || (U = z > 0 ? z - 1 : $.getMonth());
              var ce, pe = re || 0, me = $e || 0, oe = se || 0, ge = c || 0;
              return g ? new Date(Date.UTC(q, U, k, pe, me, oe, ge + 60 * g.offset * 1e3)) : E ? new Date(Date.UTC(q, U, k, pe, me, oe, ge)) : (ce = new Date(q, U, k, pe, me, oe, ge), y && (ce = V(ce).week(y).toDate()), ce);
            } catch (Ee) {
              return /* @__PURE__ */ new Date("");
            }
          }(Z, W, N, A), this.init(), ne && ne !== !0 && (this.$L = this.locale(ne).$L), J && Z != this.format(W) && (this.$d = /* @__PURE__ */ new Date("")), l = {};
        } else if (W instanceof Array) for (var F = W.length, O = 1; O <= F; O += 1) {
          B[1] = W[O - 1];
          var v = A.apply(this, B);
          if (v.isValid()) {
            this.$d = v.$d, this.$L = v.$L, this.init();
            break;
          }
          O === F && (this.$d = /* @__PURE__ */ new Date(""));
        }
        else te.call(this, ee);
      };
    };
  });
})(ar);
var wn = ar.exports;
const Sn = /* @__PURE__ */ ut(wn);
var lr = { exports: {} };
(function(t, e) {
  (function(r, n) {
    t.exports = n();
  })(lt, function() {
    var r = "day";
    return function(n, o, i) {
      var s = function(u) {
        return u.add(4 - u.isoWeekday(), r);
      }, a = o.prototype;
      a.isoWeekYear = function() {
        return s(this).year();
      }, a.isoWeek = function(u) {
        if (!this.$utils().u(u)) return this.add(7 * (u - this.isoWeek()), r);
        var f, d, p, h, b = s(this), S = (f = this.isoWeekYear(), d = this.$u, p = (d ? i.utc : i)().year(f).startOf("year"), h = 4 - p.isoWeekday(), p.isoWeekday() > 4 && (h += 7), p.add(h, r));
        return b.diff(S, "week") + 1;
      }, a.isoWeekday = function(u) {
        return this.$utils().u(u) ? this.day() || 7 : this.day(this.day() % 7 ? u : u - 7);
      };
      var l = a.startOf;
      a.startOf = function(u, f) {
        var d = this.$utils(), p = !!d.u(f) || f;
        return d.p(u) === "isoweek" ? p ? this.date(this.date() - (this.isoWeekday() - 1)).startOf("day") : this.date(this.date() - 1 - (this.isoWeekday() - 1) + 7).endOf("day") : l.bind(this)(u, f);
      };
    };
  });
})(lr);
var Cn = lr.exports;
const Dn = /* @__PURE__ */ ut(Cn);
var ur = { exports: {} };
(function(t, e) {
  (function(r, n) {
    t.exports = n();
  })(lt, function() {
    var r = "month", n = "quarter";
    return function(o, i) {
      var s = i.prototype;
      s.quarter = function(u) {
        return this.$utils().u(u) ? Math.ceil((this.month() + 1) / 3) : this.month(this.month() % 3 + 3 * (u - 1));
      };
      var a = s.add;
      s.add = function(u, f) {
        return u = Number(u), this.$utils().p(f) === n ? this.add(3 * u, r) : a.bind(this)(u, f);
      };
      var l = s.startOf;
      s.startOf = function(u, f) {
        var d = this.$utils(), p = !!d.u(f) || f;
        if (d.p(u) === n) {
          var h = this.quarter() - 1;
          return p ? this.month(3 * h).startOf(r).startOf("day") : this.month(3 * h + 2).endOf(r).endOf("day");
        }
        return l.bind(this)(u, f);
      };
    };
  });
})(ur);
var Fn = ur.exports;
const En = /* @__PURE__ */ ut(Fn);
function le(t) {
  const e = t.replace(/(-[a-z])/g, function(r) {
    return r.replace("-", "").toLocaleUpperCase();
  });
  return fr(e);
}
function fr(t) {
  return t.replace(t[0], t[0].toLowerCase());
}
je.extend(Sn);
je.extend(Dn);
je.extend(En);
function $t(t, e) {
  return {
    value: t,
    enumerable: !1,
    configurable: !1,
    writable: !0
  };
}
function cr(t, e) {
  return dr([t], e || !1)[0];
}
function dr(t, e) {
  return ze([], [...t], e || !1);
}
const kn = { array: _t, normal: Ot };
function Fe(t, e) {
  return De(Array.isArray(e) ? e : [e], t, kn), t;
}
function Mt(t) {
  const e = m.Function(t.getRule) ? t.getRule() : t;
  return e.type || (e.type = "input"), e;
}
function Rn(t, e) {
  return t ? (Object.keys(e || {}).forEach((r) => {
    e[r] && (t[r] = Fe(t[r] || {}, e[r]));
  }), t) : e;
}
function hr(t, e) {
  Object.defineProperties(t, Object.keys(e).reduce((r, n) => (r[n] = {
    get() {
      return e[n]();
    }
  }, r), {}));
}
function ve(t) {
  return t.__fc__ || (t.__origin__ ? t.__origin__.__fc__ : null);
}
function P(t, e) {
  try {
    e = t();
  } catch (r) {
    un(r);
  }
  return e;
}
function Qe() {
  const t = {}, e = (r) => r || "default";
  return {
    setSlot(r, n) {
      r = e(r), !(!n || Array.isArray(n) && n.length) && (t[r] || (t[r] = []), t[r].push(n));
    },
    getSlot(r, n) {
      r = e(r);
      const o = [];
      return (t[r] || []).forEach((i) => {
        if (Array.isArray(i))
          o.push(...i);
        else if (m.Function(i)) {
          const s = i(...n || []);
          Array.isArray(s) ? o.push(...s) : o.push(s);
        } else m.Undef(i) || o.push(i);
      }), o;
    },
    getSlots() {
      const r = {};
      return Object.keys(t).forEach((n) => {
        r[n] = (...o) => this.getSlot(n, o);
      }), r;
    },
    slotLen(r) {
      return r = e(r), t[r] ? t[r].length : 0;
    },
    mergeBag(r) {
      if (!r) return this;
      const n = m.Function(r.getSlots) ? r.getSlots() : r;
      return Array.isArray(r) || Rr(r) ? this.setSlot(void 0, () => r) : Object.keys(n).forEach((o) => {
        this.setSlot(o, n[o]);
      }), this;
    }
  };
}
function Pt(t) {
  const e = D({}, t.props || {});
  return Object.keys(t.on || {}).forEach((r) => {
    r.indexOf("-") > 0 && (r = le(r));
    const n = `on${Zt(r)}`;
    Array.isArray(e[n]) ? e[n] = [...e[n], t.on[r]] : e[n] ? e[n] = [e[n], t.on[r]] : e[n] = t.on[r];
  }), e.key = t.key, e.ref = t.ref, e.class = t.class, e.id = t.id, e.style = t.style, e.slot && delete e.slot, e;
}
function Ke(t, e) {
  return Object.setPrototypeOf(t, e), t;
}
const It = (t, e) => typeof t == "string" ? String(e) : typeof t == "number" ? Number(e) : e;
function Vn(t) {
  if (m.Number(t))
    return !Number.isFinite(t) || t < 1e9 ? NaN : t >= 1e11 ? t : t * 1e3;
  if (!m.String(t))
    return NaN;
  const e = t.trim();
  return /^\d{11,}$/.test(e) ? Number(e) : /^\d{10}$/.test(e) ? Number(e) * 1e3 : NaN;
}
function nt(t) {
  let e;
  if (m.Date(t))
    e = je(t);
  else {
    const r = Vn(t);
    Number.isNaN(r) ? m.String(t) && (e = je(t.trim().replace("T", " "), ["YYYY-MM-DD HH:mm:ss", "YYYY-MM-DD"], !0)) : e = je(r);
  }
  return e && e.isValid() ? e : null;
}
function An(t) {
  return typeof t != "number" || !Number.isInteger(t) || t < 0 ? NaN : t;
}
function K(t, e) {
  return [t.valueOf(), e.valueOf()];
}
function wt(t, e) {
  return Array.isArray(t) ? t.length > 0 && t.every((r) => e(r)) : e(t);
}
function Re(t, e, r, n) {
  const o = An(e);
  if (Number.isNaN(o))
    return !1;
  const i = je().add(n * o, r).valueOf();
  return wt(t, (s) => {
    const a = nt(s);
    if (!a)
      return !1;
    const l = a.valueOf();
    return n < 0 ? l < i : l > i;
  });
}
function Tt(t, e, r) {
  const n = nt(e);
  if (!n)
    return !1;
  const o = n.valueOf();
  return wt(t, (i) => {
    const s = nt(i);
    return s ? r < 0 ? s.valueOf() < o : s.valueOf() > o : !1;
  });
}
const jn = {
  recent7Day(t) {
    return K(t.startOf("day").subtract(6, "day"), t.endOf("day"));
  },
  recent30Day(t) {
    return K(t.startOf("day").subtract(29, "day"), t.endOf("day"));
  },
  coming7Day(t) {
    return K(t.startOf("day"), t.add(6, "day").endOf("day"));
  },
  coming30Day(t) {
    return K(t.startOf("day"), t.add(29, "day").endOf("day"));
  },
  thisWeek(t) {
    return K(t.startOf("isoWeek"), t.endOf("isoWeek"));
  },
  lastWeek(t) {
    const e = t.startOf("isoWeek").subtract(1, "week");
    return K(e, e.endOf("isoWeek"));
  },
  nextWeek(t) {
    const e = t.startOf("isoWeek").add(1, "week");
    return K(e, e.endOf("isoWeek"));
  },
  thisMonth(t) {
    return K(t.startOf("month"), t.endOf("month"));
  },
  lastMonth(t) {
    const e = t.startOf("month").subtract(1, "month");
    return K(e, e.endOf("month"));
  },
  nextMonth(t) {
    const e = t.startOf("month").add(1, "month");
    return K(e, e.endOf("month"));
  },
  recentMonth(t) {
    return K(t.subtract(1, "month").startOf("day"), t.endOf("day"));
  },
  comingMonth(t) {
    return K(t.startOf("day"), t.add(1, "month").endOf("day"));
  },
  recent3Month(t) {
    return K(t.subtract(3, "month").startOf("day"), t.endOf("day"));
  },
  recent6Month(t) {
    return K(t.subtract(6, "month").startOf("day"), t.endOf("day"));
  },
  thisQuarter(t) {
    return K(t.startOf("quarter"), t.endOf("quarter"));
  },
  lastQuarter(t) {
    const e = t.startOf("quarter").subtract(1, "quarter");
    return K(e, e.endOf("quarter"));
  },
  nextQuarter(t) {
    const e = t.startOf("quarter").add(1, "quarter");
    return K(e, e.endOf("quarter"));
  },
  thisYear(t) {
    return K(t.startOf("year"), t.endOf("year"));
  },
  lastYear(t) {
    const e = t.startOf("year").subtract(1, "year");
    return K(e, e.endOf("year"));
  },
  nextYear(t) {
    const e = t.startOf("year").add(1, "year");
    return K(e, e.endOf("year"));
  },
  recentYear(t) {
    return K(t.subtract(1, "year").startOf("day"), t.endOf("day"));
  },
  comingYear(t) {
    return K(t.startOf("day"), t.add(1, "year").endOf("day"));
  }
};
function Mn(t, e) {
  const r = m.String(e) ? jn[e] : null;
  if (!r)
    return !1;
  const [n, o] = r(je());
  return wt(t, (i) => {
    const s = nt(i);
    return !!s && s.valueOf() >= n && s.valueOf() <= o;
  });
}
const Le = {
  "==": (t, e) => JSON.stringify(t) === JSON.stringify(It(t, e)),
  "!=": (t, e) => !Le["=="](t, e),
  ">": (t, e) => t > e,
  ">=": (t, e) => t >= e,
  "<": (t, e) => t < e,
  "<=": (t, e) => t <= e,
  on(t, e) {
    return t && t.indexOf && t.indexOf(It(t[0], e)) > -1;
  },
  notOn(t, e) {
    return !Le.on(t, e);
  },
  in(t, e) {
    return e && e.indexOf && e.indexOf(t) > -1;
  },
  notIn(t, e) {
    return !Le.in(t, e);
  },
  between(t, e) {
    return t > e[0] && t < e[1];
  },
  notBetween(t, e) {
    return t < e[0] || t > e[1];
  },
  empty(t) {
    return m.empty(t);
  },
  notEmpty(t) {
    return !m.empty(t);
  },
  pattern(t, e) {
    return new RegExp(e, "g").test(t);
  },
  beforeDay(t, e) {
    return Re(t, e, "day", -1);
  },
  afterDay(t, e) {
    return Re(t, e, "day", 1);
  },
  beforeWeek(t, e) {
    return Re(t, e, "week", -1);
  },
  afterWeek(t, e) {
    return Re(t, e, "week", 1);
  },
  beforeMonth(t, e) {
    return Re(t, e, "month", -1);
  },
  afterMonth(t, e) {
    return Re(t, e, "month", 1);
  },
  beforeYear(t, e) {
    return Re(t, e, "year", -1);
  },
  afterYear(t, e) {
    return Re(t, e, "year", 1);
  },
  beforeDate(t, e) {
    return Tt(t, e, -1);
  },
  afterDate(t, e) {
    return Tt(t, e, 1);
  },
  period(t, e) {
    return Mn(t, e);
  }
};
function ie(t, e) {
  return (Array.isArray(e) ? e : (e || "").split(".")).forEach((r) => {
    t != null && (t = t[r]);
  }), t;
}
function Pn(t) {
  const e = /{{\s*(.*?)\s*}}/g;
  let r;
  const n = {};
  for (; (r = e.exec(t)) !== null; )
    r[1] && (n[r[1]] = !0);
  return Object.keys(n);
}
function Lt(t) {
  let e = t.split("."), r = [], n = "";
  return e.forEach((o, i) => {
    i === 0 ? n = o : n += "." + o, r.push(n);
  }), r.join(" && ");
}
function pr(t) {
  const e = [];
  let r = "", n = 0;
  for (let o = 0; o < t.length; o++) {
    const i = t[o];
    i === "[" ? (n === 0 && r && (e.push({ type: "key", value: r }), r = ""), n++, r += i) : i === "]" ? (n--, r += i, n === 0 && (e.push({
      type: "bracket",
      value: pr(r.slice(1, -1))
    }), r = "")) : i === "." && n === 0 ? r && (e.push({ type: "key", value: r }), r = "") : r += i;
  }
  return r && e.push({ type: "key", value: r }), e.map((o) => o.type === "key" ? { key: o.value } : { children: o.value });
}
const Xe = (t, e) => {
  if (!(!t || t === e)) {
    if (t.props.formCreateInject)
      return t.props.formCreateInject;
    if (t.parent)
      return Xe(t.parent, e);
  }
};
function In() {
  return typeof document != "undefined" && typeof document.createElement == "function" && document.head != null;
}
function Tn(t, e, r) {
  return Be({
    name: "FormCreate" + (t.isMobile ? "Mobile" : ""),
    components: e,
    directives: r,
    props: {
      rule: {
        type: Array,
        required: !0,
        default: () => []
      },
      option: {
        type: Object,
        default: () => ({})
      },
      extendOption: Boolean,
      driver: [String, Object],
      modelValue: Object,
      disabled: {
        type: Boolean,
        default: void 0
      },
      preview: {
        type: Boolean,
        default: void 0
      },
      index: [String, Number],
      api: Object,
      locale: [String, Object],
      t: Function,
      name: String,
      subForm: {
        type: Boolean,
        default: !0
      },
      inFor: Boolean
    },
    emits: ["update:api", "update:modelValue", "mounted", "beforeUnmount", "submit", "reset", "change", "emit-event", "control", "remove-rule", "remove-field", "sync", "reload", "repeat-field", "update", "validate-field-fail", "validate-fail", "created"],
    render() {
      return this.fc.render();
    },
    setup(n) {
      const o = mt();
      Vr("parentFC", o);
      const i = Ar("parentFC", null);
      let s = i;
      if (i)
        for (; s.setupState.parent; )
          s = s.setupState.parent;
      else
        s = o;
      const { rule: a, modelValue: l, subForm: u, inFor: f } = Vt(n), d = _e({
        ctxInject: {},
        destroyed: !1,
        isShow: !0,
        unique: 1,
        renderRule: [...a.value || []]
      });
      let p = JSON.stringify(l.value || {});
      const h = new t(o), b = h.api(), S = f.value, w = () => {
        if (i) {
          const N = Xe(o, i);
          if (N) {
            let B;
            S ? (B = be(N.getSubForm()), B.push(b)) : B = b, N.subForm(B);
          }
        }
      }, j = () => {
        const N = Xe(o, i);
        if (N)
          if (S) {
            const B = be(N.getSubForm()), W = B.indexOf(b);
            W > -1 && B.splice(W, 1);
          } else
            N.subForm();
      };
      let A = null;
      jr(() => {
        In() && Mr(() => {
          let N = "";
          const B = n.option && n.option.globalClass || {};
          Object.keys(B).forEach((W) => {
            let x = "";
            B[W].style && Object.keys(B[W].style).forEach((I) => {
              x += We(I) + ":" + B[W].style[I] + ";";
            }), B[W].content && (x += B[W].content + ";"), x && (N += `.${W}{${x}}`);
          }), n.option && n.option.style && (N += n.option.style), A || (A = document.createElement("style"), A.type = "text/css", document.head.appendChild(A)), A.innerHTML = N || "";
        });
      });
      const L = Ae(() => {
        h.bus.$emit("$loadData.$topForm");
      }, 100), te = Ae(function() {
        h.bus.$emit("$loadData.$scopeForm");
      }, 100), ee = Ae(() => {
        h.bus.$emit("$loadData.$form");
      }, 100), Z = (N) => {
        h.bus.$emit("change-$form." + N);
      };
      return Pr(() => {
        i && (b.top.bus.$on("$loadData.$form", L), b.top.bus.$on("change", Z)), b !== b.scope && b.scope.bus.$on("$loadData.$scopeForm", te), h.mounted();
      }), Ir(() => {
        i && (b.top.bus.$off("$loadData.$form", L), b.top.bus.$off("change", Z)), b !== b.scope && b.scope.bus.$off("$loadData.$scopeForm", te), j(), d.destroyed = !0, h.unmount(), A && A.parentNode && A.parentNode.removeChild(A);
      }), Tr(() => {
        h.updated();
      }), w(), ue(() => n.option, () => {
        h.initOptions(), b.refresh();
      }, { deep: !0, flush: "sync" }), ue(() => [...a.value], (N) => {
        h.$handle.isBreakWatch() || N.length === d.renderRule.length && N.every((B) => d.renderRule.indexOf(B) > -1) || (h.$handle.updateAppendData(), h.$handle.reloadRule(a.value), o.setupState.renderRule());
      }), ue(() => [n.disabled, n.preview], () => {
        b.refresh();
      }), ue(l, (N) => {
        Ge(N || {}) !== p && (b.config.forceCoverValue ? b.coverValue(N || {}) : b.setValue(N || {}));
      }, { deep: !0, flush: "post" }), ue(() => n.index, () => {
        b.coverValue({}), h.$handle.updateAppendData(), X(() => {
          X(() => {
            b.clearValidateState();
          });
        });
      }, { flush: "sync" }), ae(D({
        fc: Ve(h),
        parent: i && Ve(i),
        top: Ve(s),
        fapi: Ve(b)
      }, Vt(d)), {
        getGroupInject: () => Xe(o, i),
        refresh() {
          ++d.unique;
        },
        renderRule() {
          d.renderRule = [...a.value || []];
        },
        updateValue(N) {
          if (d.destroyed) return;
          const B = Ge(N);
          p !== B && (p = B, o.emit("update:modelValue", N), X(() => {
            ee(), i ? u.value || te() : (L(), te());
          }));
        }
      });
    },
    created() {
      const n = mt();
      n.emit("update:api", n.setupState.fapi), n.setupState.fc.init();
    }
  });
}
function mr() {
  return {
    props: {},
    on: {},
    options: [],
    children: [],
    hidden: !1,
    display: !0,
    value: void 0
  };
}
function he(t, e) {
  return (r, n, o, i = {}) => {
    const s = new St(t, r, n, o, i);
    return e && (m.Function(e) ? e(s) : s.props(e)), s;
  };
}
function St(t, e, r, n, o) {
  this._data = R(mr(), { type: t, title: e, field: r, value: n, props: o || {} }), this.event = this.on;
}
R(St.prototype, {
  getRule() {
    return this._data;
  },
  setProp(t, e) {
    return fe(this._data, t, e), this;
  },
  modelField(t) {
    return this._data.modelField = t, this;
  },
  _clone() {
    const t = new this.constructor();
    return t._data = cr(this._data), t;
  }
});
function gr(t) {
  t.forEach((e) => {
    St.prototype[e] = function(r) {
      return Fe(this._data, { [e]: arguments.length < 2 ? r : { [r]: arguments[1] } }), this;
    };
  });
}
gr(sr());
const Ln = he("");
function Bn(t, e, r) {
  let n = Ln("", e);
  return n._data.type = t, n._data.title = r, n;
}
function Nn() {
  return {
    create: Bn,
    factory: he
  };
}
function xn(t, e, r) {
  const n = `fail to ${t} ${r.status}'`, o = new Error(n);
  return o.status = r.status, o.url = t, o;
}
function Bt(t) {
  const e = t.responseText || t.response;
  if (!e)
    return e;
  try {
    return JSON.parse(e);
  } catch (r) {
    return e;
  }
}
function yr(t) {
  if (typeof XMLHttpRequest == "undefined")
    return;
  const e = new XMLHttpRequest();
  let r = t.action || "";
  if (e.upload && t.onProgress && e.upload.addEventListener("progress", (i) => {
    i.percent = i.total > 0 ? i.loaded / i.total * 100 : 0, t.onProgress(i);
  }), t.query) {
    const i = m.String(t.query) ? t.query : Object.keys(t.query).reduce((a, l) => (a[l] = t.query[l] === null || t.query[l] === void 0 ? "" : t.query[l], a), {}), s = new URLSearchParams(i).toString();
    s && (r.includes("?") ? r += `&${s}` : r += `?${s}`);
  }
  e.onerror = function(s) {
    t.onError(s);
  }, e.onload = function() {
    if (e.status < 200 || e.status >= 300)
      return t.onError(xn(r, t, e), Bt(e));
    t.onSuccess(Bt(e));
  }, e.open(t.method || "get", r, !0);
  let n;
  (t.data || t.file) && (t.file || (t.dataType || "").toLowerCase() !== "json" ? (n = new FormData(), Object.keys(t.data || {}).map((i) => {
    n.append(i, t.data[i]);
  })) : (n = JSON.stringify(t.data || {}), e.setRequestHeader("content-type", "application/json"))), t.file && n.append(t.filename, t.file, t.file.name), t.withCredentials && "withCredentials" in e && (e.withCredentials = !0);
  const o = t.headers || {};
  Object.keys(o).forEach((i) => {
    o[i] != null && e.setRequestHeader(i, o[i]);
  }), e.send(n);
}
function Nt(t, e, r) {
  return new Promise((n, o) => {
    (e || yr)(ae(D({}, t), {
      onSuccess(i) {
        let s = (l) => l;
        const a = we(t.parse);
        m.Function(a) ? s = a : a && m.String(a) && (s = (l) => ie(l, a)), rt(s(i, t.targetRule, r)).then((l) => {
          n(l);
        });
      },
      onError(i) {
        o(i);
      }
    }));
  });
}
function qe(t) {
  return Oe(t);
}
function qn(t) {
  function e(i) {
    return m.Undef(i) ? i = t.fields() : Array.isArray(i) || (i = [i]), i;
  }
  function r(i, s, a) {
    m.Undef(i) ? i = Object.keys(D(D({}, t.fieldCtx), t.nameCtx)) : Array.isArray(i) || (i = [i]), i.forEach((l) => {
      const u = t.fieldCtx[l] || t.nameCtx[l];
      u && u.forEach((f) => {
        fe(f.rule, s, a), t.$render.clearCache(f);
      });
    });
  }
  function n() {
    const i = t.subForm;
    return Object.keys(i).reduce((s, a) => {
      const l = i[a];
      return l && (Array.isArray(l) ? s.push(...l) : s.push(l)), s;
    }, []);
  }
  const o = {
    get isScope() {
      return t.vm.props.subForm === !1;
    },
    get isPreview() {
      return t.preview;
    },
    get config() {
      return t.options;
    },
    set config(i) {
      t.fc.options.value = i;
    },
    get options() {
      return t.options;
    },
    set options(i) {
      t.fc.options.value = i;
    },
    get form() {
      return t.form;
    },
    get rule() {
      return t.rules;
    },
    get parent() {
      return t.vm.setupState.parent && t.vm.setupState.parent.setupState.fapi;
    },
    get top() {
      return o.parent ? o.parent.top : o;
    },
    get scope() {
      let i = t.vm;
      for (; i && i.setupState.fapi; )
        if (i.props.subForm)
          i = i.setupState.parent;
        else
          return i.setupState.fapi;
      return o.top;
    },
    get children() {
      return n();
    },
    get siblings() {
      const i = t.vm.setupState.getGroupInject();
      if (i) {
        const s = i.getSubForm();
        if (Array.isArray(s))
          return [...s];
      }
    },
    get index() {
      const i = o.siblings;
      if (i) {
        const s = i.indexOf(o);
        return s > -1 ? s : void 0;
      }
    },
    get formulas() {
      return D({}, t.fc.formulas);
    },
    formData(i) {
      if (i == null || typeof i == "boolean") {
        const s = {};
        return Object.keys(t.form).forEach((a) => {
          (i === !0 || t.ignoreFields.indexOf(a) === -1) && (s[a] = qe(t.form[a]));
        }), s;
      } else
        return e(i).reduce((s, a) => (s[a] = o.getValue(a), s), {});
    },
    getValue(i) {
      const s = t.getFieldCtx(i);
      return s ? qe(s.rule.value) : t.options.appendValue !== !1 && G(t.appendData, i) ? qe(t.appendData[i]) : void 0;
    },
    coverValue(i) {
      const s = D({}, i || {});
      t.deferSyncValue(() => {
        t.appendData = {}, o.fields().forEach((a) => {
          const l = t.fieldCtx[a];
          if (l) {
            const u = G(i, a);
            l.forEach((f) => {
              f.rule.value = u ? i[a] : void 0;
            }), delete s[a];
          }
        }), R(t.appendData, s);
      }, !0);
    },
    setValue(i) {
      let s = i;
      arguments.length >= 2 && (s = { [i]: arguments[1] }), t.deferSyncValue(() => {
        Object.keys(s).forEach((a) => {
          const l = t.fieldCtx[a];
          if (!l) return t.appendData[a] = s[a];
          l.forEach((u) => {
            u.rule.value = s[a];
          });
        });
      }, !0);
    },
    removeField(i) {
      const s = t.getCtx(i);
      return t.deferSyncValue(() => {
        t.getCtxs(i).forEach((a) => {
          a.rm();
        });
      }, !0), s ? s.origin : void 0;
    },
    removeRule(i) {
      const s = i && ve(i);
      if (s)
        return s.rm(), s.origin;
    },
    fields: () => t.fields(),
    append: (i, s, a) => {
      let l = t.sort.length - 1, u;
      const f = t.getCtx(s);
      if (f)
        if (a) {
          if (u = f.getPending("children", f.rule.children), !Array.isArray(u)) return;
          l = f.rule.children.length - 1;
        } else
          l = f.root.indexOf(f.origin), u = f.root;
      else u = t.rules;
      u.splice(l + 1, 0, i);
    },
    prepend: (i, s, a) => {
      let l = 0, u;
      const f = t.getCtx(s);
      if (f)
        if (a) {
          if (u = f.getPending("children", f.rule.children), !Array.isArray(u)) return;
        } else
          l = f.root.indexOf(f.origin), u = f.root;
      else u = t.rules;
      u.splice(l, 0, i);
    },
    hidden(i, s) {
      r(s, "hidden", !!i), t.refresh();
    },
    hiddenStatus(i) {
      const s = t.getCtx(i);
      if (s)
        return !!s.rule.hidden;
    },
    display(i, s) {
      r(s, "display", !!i), t.refresh();
    },
    displayStatus(i) {
      const s = t.getCtx(i);
      if (s)
        return !!s.rule.display;
    },
    disabled(i, s) {
      e(s).forEach((a) => {
        t.getCtxs(a).forEach((l) => {
          fe(l.rule.props, "disabled", !!i);
        });
      }), t.refresh();
    },
    required(i, s) {
      const a = !!i;
      e(s).forEach((l) => {
        t.getCtxs(l).forEach((u) => {
          const f = G(u.rule, "$required") ? u.rule.$required : u.rule.effect && u.rule.effect.required;
          m.Object(f) ? fe(f, "required", a) : o.setEffect(u.id, "required", a);
        });
      }), t.refresh();
    },
    all(i) {
      return Object.keys(t.ctxs).map((s) => {
        const a = t.ctxs[s];
        return i ? a.origin : a.rule;
      });
    },
    model(i) {
      return t.fields().reduce((s, a) => {
        const l = t.fieldCtx[a][0];
        return s[a] = i ? l.origin : l.rule, s;
      }, {});
    },
    component(i) {
      return Object.keys(t.nameCtx).reduce((s, a) => {
        const l = t.nameCtx[a].map((u) => i ? u.origin : u.rule);
        return s[a] = l.length === 1 ? l[0] : l, s;
      }, {});
    },
    bind() {
      return o.form;
    },
    reload: (i) => {
      t.reloadRule(i);
    },
    updateOptions(i) {
      t.fc.updateOptions(i), o.refresh();
    },
    onSubmit(i) {
      o.updateOptions({ onSubmit: i });
    },
    sync: (i) => {
      if (Array.isArray(i)) {
        i.forEach((a) => o.sync(a));
        return;
      }
      let s = m.Object(i) ? ve(i) : t.getCtxs(i);
      s && (s = Array.isArray(s) ? s : [s], s.forEach((a) => {
        if (!a.deleted) {
          const l = t.subForm[a.id];
          l && (Array.isArray(l) ? l.forEach((u) => {
            u.refresh();
          }) : l && l.refresh()), t.$render.clearCache(a);
        }
      }), t.refresh());
    },
    refresh: () => {
      n().forEach((i) => {
        i.refresh();
      }), t.$render.clearCacheAll(), t.refresh();
    },
    refreshOptions() {
      t.$manager.updateOptions(t.options), o.refresh();
    },
    hideForm: (i) => {
      t.vm.setupState.isShow = !i;
    },
    changeStatus: () => t.changeStatus,
    clearChangeStatus: () => {
      t.changeStatus = !1;
    },
    updateRule(i, s) {
      t.getCtxs(i).forEach((a) => {
        R(a.rule, s);
      });
    },
    updateRules(i) {
      Object.keys(i).forEach((s) => {
        o.updateRule(s, i[s]);
      });
    },
    mergeRule: (i, s) => {
      t.getCtxs(i).forEach((a) => {
        Fe(a.rule, s);
      });
    },
    mergeRules(i) {
      Object.keys(i).forEach((s) => {
        o.mergeRule(s, i[s]);
      });
    },
    getRule: (i, s) => {
      const a = t.getCtx(i);
      if (a)
        return s ? a.origin : a.rule;
    },
    findType(i, s) {
      let a;
      return Object.keys(t.ctxs).forEach((l) => {
        const u = t.ctxs[l];
        u.rule.type === i && (a = s ? u.origin : u.rule);
      }), a;
    },
    findTypes(i, s) {
      let a = [];
      return Object.keys(t.ctxs).forEach((l) => {
        const u = t.ctxs[l];
        u.rule.type === i && a.push(s ? u.origin : u.rule);
      }), a;
    },
    getRenderRule: (i) => {
      const s = t.getCtx(i);
      if (s)
        return s.prop;
    },
    getRefRule: (i) => {
      const s = t.getCtxs(i);
      if (s) {
        const a = s.map((l) => l.rule);
        return a.length === 1 ? a[0] : a;
      }
    },
    setEffect(i, s, a) {
      const l = t.getCtx(i);
      l && s && (s[0] === "$" && (s = s.substr(1)), G(l.rule, "$" + s) && fe(l.rule, "$" + s, a), G(l.rule, "effect") || (l.rule.effect = {}), fe(l.rule.effect, s, a));
    },
    clearEffectData(i, s) {
      const a = t.getCtx(i);
      a && (s && s[0] === "$" && (s = s.substr(1)), a.clearEffectData(s), o.sync(i));
    },
    updateValidate(i, s, a) {
      a ? o.mergeRule(i, { validate: s }) : r(i, "validate", s);
    },
    updateValidates(i, s) {
      Object.keys(i).forEach((a) => {
        o.updateValidate(a, i[a], s);
      });
    },
    refreshValidate() {
      o.refresh();
    },
    resetFields(i) {
      e(i).forEach((s) => {
        t.getCtxs(s).forEach((a) => {
          t.$render.clearCache(a), a.rule.value = qe(a.defaultValue);
        });
      }), X(() => {
        X(() => {
          X(() => {
            o.clearValidateState(i);
          });
        });
      }), i == null && (m.Function(t.options.onReset) && P(() => t.options.onReset(o)), t.vm.emit("reset", o));
    },
    method(i, s) {
      const a = o.el(i);
      if (!a || !a[s])
        throw new Error(Xt("err", `${s} 方法不存在`));
      return (...l) => a[s](...l);
    },
    exec(i, s, ...a) {
      return P(() => o.method(i, s)(...a));
    },
    toJson(i) {
      return Ge(o.rule, i);
    },
    trigger(i, s, ...a) {
      const l = o.el(i);
      l && l.$emit(s, ...a);
    },
    el(i) {
      const s = t.getCtx(i);
      if (s) return s.el || t.vm.refs[s.ref];
    },
    scrollTo(i, s = { block: "center", inline: "nearest", behavior: "smooth" }) {
      const a = o.el(i);
      if (!a) return;
      const l = a.$el !== void 0 ? a.$el : a;
      if (!l) return;
      const u = l.nodeType === 1 ? l : l.firstElementChild;
      u && typeof u.scrollIntoView == "function" && u.scrollIntoView(s);
    },
    focus(i) {
      const s = o.el(i);
      if (!s) return;
      const a = (d) => !d || typeof d.focus != "function" ? !1 : (P(() => d.focus()), !0);
      if (a(s)) return;
      const l = s.$el !== void 0 ? s.$el : s;
      if (a(l)) return;
      const u = l && (l.nodeType === 1 ? l : l.firstElementChild);
      if (a(u) || !u || !u.querySelector) return;
      const f = u.querySelector('input:not([type=hidden]):not([disabled]),textarea:not([disabled]),select:not([disabled]),[tabindex]:not([tabindex="-1"])');
      a(f);
    },
    closeModal: (i) => {
      t.bus.$emit("fc:closeModal:" + i);
    },
    getSubForm(i) {
      const s = t.getCtx(i);
      return s ? t.subForm[s.id] : void 0;
    },
    getChildrenRuleList(i) {
      const s = typeof i == "object", a = s ? ve(i) : t.getCtx(i), l = a ? a.rule : s ? i : o.getRule(i);
      if (!l)
        return [];
      const u = [];
      return ((d) => {
        d && d.forEach((p) => {
          typeof p == "object" && (p.field && u.push(p), u.push(...o.getChildrenRuleList(p)));
        });
      })(a ? a.loadChildrenPending() : l.children), u;
    },
    getParentRule(i) {
      return (typeof i == "object" ? ve(i) : t.getCtx(i)).parent.rule;
    },
    getParentSubRule(i) {
      const a = typeof i == "object" ? ve(i) : t.getCtx(i);
      if (a) {
        const l = a.getParentGroup();
        if (l)
          return l.rule;
      }
    },
    getChildrenFormData(i, s) {
      return o.getChildrenRuleList(i).reduce((l, u) => ((u.ignore !== !0 || s === !0) && (l[u.field] = qe(u.value)), l), {});
    },
    setChildrenFormData(i, s, a) {
      const l = o.getChildrenRuleList(i);
      t.deferSyncValue(() => {
        l.forEach((u) => {
          G(s, u.field) ? u.value = s[u.field] : a && (u.value = void 0);
        });
      });
    },
    getGlobalEvent(i) {
      let s = o.options.globalEvent[i];
      if (s)
        return typeof s == "object" && (s = s.handle), we(s);
    },
    getGlobalData(i) {
      return new Promise((s, a) => {
        let l = o.options.globalData[i];
        l ? l.type === "fetch" ? o.fetch(l).then((u) => {
          s(u);
        }).catch(a) : s(l.data) : s(t.fc.loadData[i]);
      });
    },
    emitGlobalEvent(i, ...s) {
      const a = o.getGlobalEvent(i);
      if (a) {
        const l = t.getInjectData({}, void 0);
        return l.args = [...s], s.unshift(l), a.apply(null, s);
      }
    },
    setGlobalData(i, s) {
      o.setData("$globalData." + i, s);
    },
    setGlobalVar(i, s) {
      o.setData("$var." + i, s);
    },
    renderRule(i, s, a) {
      const u = typeof i == "object" ? ve(i) : t.getCtx(i);
      return u ? t.$render.createRuleVnode(u, s, a) : void 0;
    },
    renderChildren(i, s, a) {
      const u = typeof i == "object" ? ve(i) : t.getCtx(i);
      return u ? t.$render.createChildrenVnodes(u, s, a) : void 0;
    },
    nextTick(i) {
      t.bus.$once("next-tick", i), t.refresh();
    },
    nextRefresh(i) {
      t.nextRefresh(), i && P(i);
    },
    deferSyncValue(i, s) {
      t.deferSyncValue(i, s);
    },
    emit(i, ...s) {
      t.vm.emitsOptions && !t.vm.emitsOptions[i] && (t.vm.emitsOptions[i] = null), t.vm.emit(i, ...s);
    },
    bus: t.bus,
    getCurrentFormRule() {
      var i;
      return (i = t.vm.setupState.getGroupInject()) == null ? void 0 : i.rule;
    },
    fetch(i) {
      return new Promise((s, a) => {
        let l = D({}, i);
        l = t.loadFetchVar(l);
        const u = (f) => {
          P(() => l.onError && l.onError(f)), a(f);
        };
        t.beforeFetch(l).then(() => Nt(l, t.fc.create.fetch, o).then((f) => {
          P(() => l.onSuccess && l.onSuccess(f)), s(f);
        }).catch((f) => {
          u(f);
        })).catch((f) => {
          u(f);
        });
      });
    },
    watchFetch(i, s, a, l) {
      return t.fc.watchLoadData((u, f) => {
        let d = D({}, i);
        if (d = t.loadFetchVar(d, u), l && l(d, f) === !1)
          return;
        const p = (h) => {
          P(() => d.onError && d.onError(h)), a && a(h);
        };
        t.beforeFetch(d).then(() => Nt(d, t.fc.create.fetch, o).then((h) => {
          P(() => d.onSuccess && d.onSuccess(h)), s && s(h, f);
        }).catch((h) => {
          p(h);
        })).catch((h) => {
          p(h);
        });
      }, i.wait == null ? 1e3 : i.wait);
    },
    getData(i, s) {
      return t.fc.get ? t.fc.get(i, s) : t.fc.getLoadData(i, s);
    },
    watchData(i) {
      return t.fc.watchLoadData((s, a) => {
        P(() => i(s, a));
      });
    },
    setData(i, s, a) {
      return t.fc.setData(i, s, a);
    },
    refreshData(i) {
      return t.fc.refreshData(i);
    },
    t(i, s) {
      return t.fc.t(i, s);
    },
    getLocale() {
      return t.fc.getLocale();
    },
    helper: {
      tidyFields: e,
      props: r
    }
  };
  return ["on", "once", "off"].forEach((i) => {
    o[i] = function(...s) {
      t.bus[`$${i}`](...s);
    };
  }), o.changeValue = o.changeField = o.setValue, o;
}
function Un(t) {
  R(t.prototype, {
    initCache() {
      this.clearCacheAll();
    },
    clearCache(e) {
      if (!e.rule.cache) {
        if (!this.cache[e.id]) {
          e.parent && this.clearCache(e.parent);
          return;
        }
        (this.cache[e.id].use === !0 || this.cache[e.id].parent) && this.$handle.refresh(), this.cache[e.id].parent && this.clearCache(this.cache[e.id].parent), this.cache[e.id] = null;
      }
    },
    clearCacheAll() {
      this.cache = {};
    },
    setCache(e, r, n) {
      this.cache[e.id] = {
        vnode: r,
        use: !1,
        parent: n,
        slot: e.rule.slot
      };
    },
    getCache(e) {
      const r = this.cache[e.id];
      if (r)
        return r.use = !0, r.vnode;
    }
  });
}
function Yn(t) {
  R(t.prototype, {
    initRender() {
      this.cacheConfig = {};
    },
    getTypeSlot(e) {
      const r = (n) => {
        if (n) {
          let o;
          return e.rule.field && (o = n.slots["field-" + We(e.rule.field)] || n.slots["field-" + e.rule.field]), o || (o = n.slots["type-" + We(e.type)] || n.slots["type-" + e.type]), o || r(n.setupState.parent);
        }
      };
      return r(this.vm);
    },
    render() {
      if (!this.vm.setupState.isShow)
        return;
      this.$manager.beforeRender(), this.applyShowNumber(this.$manager.rule);
      const e = Qe();
      return this.sort.forEach((r) => {
        this.renderSlot(e, this.$handle.ctxs[r]);
      }), this.$manager.render(e);
    },
    applyShowNumber(e) {
      const r = this.$handle.options || {};
      if (!r.showNumber || !e)
        return;
      e.class = this.mergeClass(e.class, "is-numbered"), r.showNumber === "chinese" && (e.class = this.mergeClass(e.class, "is-number-chinese"));
      const n = r.numberColor, o = (r.form || {}).style;
      if (!n) {
        e.style = o;
        return;
      }
      m.String(o) ? e.style = `${o};--fc-number-color:${n}` : Array.isArray(o) ? e.style = o.concat({ "--fc-number-color": n }) : e.style = ae(D({}, o || {}), { "--fc-number-color": n });
    },
    renderSlot(e, r, n) {
      if (this.isFragment(r)) {
        r.initProp(), this.mergeGlobal(r), r.initNone();
        const o = this.renderChildren(r.loadChildrenPending(), r), i = o.default;
        i && e.setSlot(r.rule.slot, () => i()), delete o.default, e.mergeBag(o);
      } else
        e.setSlot(r.rule.slot, this.renderCtx(r, n));
    },
    mergeGlobal(e) {
      if (!this.$handle.options.global) return;
      const { trueType: n, originType: o, type: i } = e;
      this.cacheConfig[n] || (this.cacheConfig[n] = Ne(() => {
        const s = this.$handle.options.global;
        return Fe({}, [s["*"] || s.default || {}, s[o] || s[i] || {}]);
      })), e.prop = Fe({}, [this.cacheConfig[e.trueType].value, e.prop]);
    },
    setOptions(e) {
      const r = e.loadPending({ key: "options", origin: e.prop.options, def: [] });
      e.prop.options = r, e.prop.optionsTo && r && Me(e.prop, e.prop.optionsTo, r);
    },
    deepSet(e) {
      const r = e.prop.deep;
      r && Object.keys(r).sort((n, o) => n.length < o.length ? -1 : 1).forEach((n) => {
        Me(e.prop, n, r[n]);
      });
    },
    parseSide(e, r) {
      return m.Object(e) ? Fe({ props: { formCreateInject: r.prop.props.formCreateInject } }, e) : e;
    },
    renderSides(e, r, n) {
      const o = r[n ? "rule" : "prop"];
      return [this.renderRule(this.parseSide(o.prefix, r)), e, this.renderRule(this.parseSide(o.suffix, r))];
    },
    renderId(e, r) {
      const n = this.$handle[r === "field" ? "fieldCtx" : "nameCtx"][e];
      return n ? n.map((o) => this.renderCtx(o, o.parent)) : void 0;
    },
    renderCtx(e, r) {
      try {
        if (e.type === "hidden") return;
        const n = e.rule;
        if (this.force || !this.cache[e.id] || this.cache[e.id].slot !== n.slot) {
          let o;
          e.initProp(), this.mergeGlobal(e), e.initNone(), this.$manager.tidyRule(e), this.deepSet(e), this.setOptions(e), this.ctxProp(e);
          let i = e.prop;
          i.preview = !!(i.preview != null ? i.preview : this.$handle.preview), i.props.formCreateInject = this.injectProp(e);
          let s = i.cache !== !1;
          const a = i.preview;
          if (i.hidden) {
            this.setCache(e, void 0, r);
            return;
          }
          o = (...l) => {
            var b, S;
            const u = {
              rule: n,
              prop: i,
              preview: a,
              api: this.$handle.api,
              model: i.model || {},
              slotValue: l
            };
            l.length && n.slotUpdate && P(() => n.slotUpdate(u));
            let f = {};
            const d = e.loadChildrenPending();
            e.parser.renderChildren ? f = e.parser.renderChildren(d, e) : e.parser.loadChildren !== !1 && (f = this.renderChildren(d, e)), Object.keys(i.renderSlots || {}).forEach((w) => {
              f[w] = (...j) => {
                if (m.Function(i.renderSlots[w]))
                  return P(() => i.renderSlots[w](...j));
                const A = this.parseSide(i.renderSlots[w], e);
                return this.renderRule(A);
              };
            });
            const p = this.getTypeSlot(e);
            let h;
            return p ? (u.children = f, h = p(u)) : h = a ? e.parser.preview(gt(f), e) : e.parser.render(gt(f), e), h = this.renderSides(h, e), (b = i.title) != null && b.show && (i.wrap = D({ show: !0 }, i.wrap || {}), i.native || (i.native = !1)), (!(!e.input && m.Undef(i.native)) || ((S = i.col) == null ? void 0 : S.show) === !0) && i.native !== !0 && (this.fc.targetFormDriver("updateWrap", e), h = this.$manager.makeWrap(e, h)), e.none && (Array.isArray(h) ? h = h.map((w) => !w || !w.__v_isVNode ? w : this.none(w)) : h = this.none(h)), s && this.setCache(e, () => this.stable(h), r), h;
          }, this.setCache(e, o, r);
        }
        return (...o) => {
          const i = this.getCache(e);
          if (i)
            return i(...o);
          if (this.cache[e.id])
            return;
          const s = this.renderCtx(e, e.parent);
          if (s)
            return s();
        };
      } catch (n) {
        console.error(n);
        return;
      }
    },
    none(e) {
      if (e)
        return e.props.class = this.mergeClass(e.props.class, "fc-none"), e;
    },
    mergeClass(e, r) {
      if (Array.isArray(e))
        e.push(r);
      else
        return e ? [e, r] : r;
      return e;
    },
    stable(e) {
      return (Array.isArray(e) ? e : [e]).forEach((n) => {
        n && n.__v_isVNode && n.children && typeof n.children == "object" && (n.children.$stable = !0, this.stable(n.children));
      }), e;
    },
    getModelField(e) {
      return e.prop.modelField || e.parser.modelField || this.fc.modelFields[this.vNode.aliasMap[e.type]] || this.fc.modelFields[e.type] || this.fc.modelFields[e.originType] || "modelValue";
    },
    isFragment(e) {
      return e.type === "fragment" || e.type === "template";
    },
    injectProp(e) {
      const r = this.vm.setupState;
      r.ctxInject[e.id] || (r.ctxInject[e.id] = {
        api: this.$handle.api,
        form: this.fc.create,
        subForm: (o) => {
          this.$handle.addSubForm(e, o);
        },
        getSubForm: () => this.$handle.subForm[e.id],
        slots: () => this.vm.setupState.top.slots,
        getWrap: () => this.vm.refs[e.wrapRef],
        options: [],
        children: [],
        preview: !1,
        id: e.id,
        field: e.field,
        rule: e.rule,
        input: e.input,
        t: (...o) => this.$handle.api.t(...o),
        updateValue: (o) => {
          this.$handle.onUpdateValue(e, o);
        }
      });
      const n = r.ctxInject[e.id];
      return R(n, {
        preview: e.prop.preview,
        options: e.prop.options,
        children: e.loadChildrenPending()
      }), n;
    },
    //事件回调挂在 ctx 上复用,避免 cache miss 时换新函数逼迫子组件更新
    ensureCtxHandlers(e) {
      if (e.handlers)
        return e.handlers;
      const r = this;
      return e.handlers = {
        vnodeMounted(n) {
          n.el.__rule__ = e.rule, r.onMounted(e, n.el);
        },
        vnodeBeforeUnmount() {
          r.$handle.effect(e, "beforeUnmount"), r.$handle.targetHook(e, "beforeUnmount");
        },
        fcUpdateValue(n) {
          r.$handle.onUpdateValue(e, n);
        },
        fcEl(n) {
          e.exportEl = n, n && ((n.$el || n).__rule__ = e.rule);
        },
        modelCallback(n) {
          r.tmpInput && r.tmpInput(e.field, n, e.rule), r.onInput(e, n);
        },
        modelEmit() {
          r.onEmitInput(e);
        }
      }, e.handlers;
    },
    ctxProp(e) {
      const { ref: r, key: n, rule: o } = e;
      this.$manager.mergeProp(e), e.parser.mergeProp(e);
      const i = this.ensureCtxHandlers(e), s = [
        {
          ref: r,
          key: o.key || `${n}fc`,
          slot: void 0,
          on: {
            vnodeMounted: i.vnodeMounted,
            vnodeBeforeUnmount: i.vnodeBeforeUnmount,
            "fc.updateValue": i.fcUpdateValue,
            "fc.el": i.fcEl
          }
        }
      ];
      if (e.input) {
        this.vm.props.disabled === !0 && (e.prop.props.disabled = !0);
        const a = this.getModelField(e), l = {
          callback: i.modelCallback,
          modelField: a,
          value: this.$handle.getFormData(e)
        };
        s.push({
          on: D({
            [`update:${a}`]: l.callback
          }, e.prop.modelEmit ? {
            [e.prop.modelEmit]: i.modelEmit
          } : {}),
          props: {
            [a]: l.value
          }
        }), e.prop.model = l;
      }
      return De(s, e.prop), e.prop;
    },
    onMounted(e, r) {
      e.el = this.vm.refs[e.ref] || r, e.parser.mounted(e), this.$handle.effect(e, "mounted"), this.$handle.targetHook(e, "mounted");
    },
    onInput(e, r) {
      if (e.prop.modelEmit) {
        this.$handle.onBaseInput(e, r);
        return;
      }
      this.$handle.onInput(e, r);
    },
    onEmitInput(e) {
      this.$handle.setValue(e, e.parser.toValue(e.modelValue, e), e.modelValue);
    },
    renderChildren(e, r) {
      if (!m.trueArray(e)) return {};
      const n = Qe();
      return e.map((o) => {
        if (o) {
          if (m.String(o) || m.Number(o)) return n.setSlot(null, `${o}`);
          if (o.__fc__)
            return this.renderSlot(n, o.__fc__, r);
          o.type && X(() => {
            this.$handle.loadChildren(e, r), this.$handle.refresh();
          });
        }
      }), n.getSlots();
    },
    defaultRender(e, r) {
      const n = e.prop;
      return n.component ? typeof n.component == "string" ? this.vNode.make(n.component, n, r) : this.vNode.makeComponent(n.component, n, r) : this.vNode[e.type] ? this.vNode[e.type](n, r) : this.vNode[e.originType] ? this.vNode[e.originType](n, r) : this.vNode.make(fr(n.type), n, r);
    },
    createChildrenVnodes(e, r, n) {
      this.force = n !== !1, this.tmpInput = r;
      const o = this.renderChildren(e.rule.children, e);
      return this.force = !1, this.tmpInput = null, o;
    },
    createRuleVnode(e, r, n) {
      this.force = n !== !1, this.tmpInput = r;
      const o = Qe();
      return this.renderSlot(o, e, e.parent), this.force = !1, this.tmpInput = null, o.getSlots();
    },
    renderRule(e, r, n) {
      if (!e) return;
      if (m.String(e) || m.Number(e)) return `${e}`;
      let o;
      if (n)
        o = e.type;
      else if (o = e.is, e.type) {
        o = le(e.type);
        const a = this.vNode.aliasMap[o];
        a && (o = le(a));
      }
      if (!o) return;
      const i = Qe();
      m.trueArray(e.children) && e.children.forEach((a) => {
        a && i.setSlot(a == null ? void 0 : a.slot, () => this.renderRule(a));
      });
      const s = D({}, e);
      return delete s.type, delete s.is, this.vNode.make(o, s, i.mergeBag(r).getSlots());
    }
  });
}
let Hn = 1;
function Ct(t) {
  R(this, {
    $handle: t,
    fc: t.fc,
    vm: t.vm,
    $manager: t.$manager,
    vNode: new t.fc.CreateNode(t),
    force: !1,
    tmpInput: null,
    id: Hn++
  }), hr(this, {
    options() {
      return t.options;
    },
    sort() {
      return t.sort;
    }
  }), this.initCache(), this.initRender();
}
Un(Ct);
Yn(Ct);
function Wn(t) {
  R(t.prototype, {
    parseInjectEvent(e, r) {
      const n = e.inject || this.options.injectEvent;
      return this.parseEventLst(e, r, n);
    },
    parseEventLst(e, r, n, o) {
      return Object.keys(r).forEach((i) => {
        const s = this.parseEvent(e, r[i], n, o);
        s && (r[i] = s);
      }), r;
    },
    parseEvent(e, r, n, o) {
      if (m.Function(r) && (n !== !1 && !m.Undef(n) || r.__inject))
        return this.inject(e, r, n);
      if (!o && Array.isArray(r) && r[0] && (m.String(r[0]) || m.Function(r[0])))
        return this.parseEventLst(e, r, n, !0);
      if (m.String(r)) {
        const i = we(r);
        if (i && r !== i)
          return i.__inject ? this.parseEvent(e, i, n, !0) : i;
      }
    },
    parseEmit(e) {
      let r = {}, n = e.rule, { emitPrefix: o, field: i, name: s, inject: a } = n, l = n.emit || [];
      return m.trueArray(l) && l.forEach((u) => {
        if (!u) return;
        let f, d = o || i || s;
        if (m.Object(u) && (f = u.inject, u = u.name, d = u.prefix || d), d) {
          const p = We(`${d}-${u}`), h = (...b) => {
            this.vm.emitsOptions && !this.vm.emitsOptions[p] && (this.vm.emitsOptions[p] = null), this.vm.emit(p, ...b), this.vm.emit("emit-event", p, ...b), this.bus.$emit(p, ...b);
          };
          if (h.__emit = !0, !f && a === !1)
            r[le(u)] = h;
          else {
            let b = f || a || this.options.injectEvent;
            r[le(u)] = m.Undef(b) ? h : this.inject(n, h, b);
          }
        }
      }), e.computed.on = r, r;
    },
    getInjectData(e, r) {
      const n = e.__fc__ && e.__fc__.$api, o = e.__fc__ && e.__fc__.$handle.vm || this.vm, { option: i, rule: s } = o.props;
      return {
        $f: n || this.api,
        api: n || this.api,
        rule: s,
        self: e.__origin__,
        option: i,
        inject: r
      };
    },
    inject(e, r, n) {
      if (r.__origin) {
        if (this.watching && !this.loading)
          return r;
        r = r.__origin;
      }
      const o = this, i = function(...s) {
        const a = o.getInjectData(e, n);
        return a.args = [...s], s.unshift(a), r.apply(this, s);
      };
      return i.__origin = r, i.__json = r.__json, i;
    },
    loadStrVar(e, r, n) {
      if (e && typeof e == "string" && e.indexOf("{{") > -1 && e.indexOf("}}") > -1) {
        const o = e, i = Pn(e), s = (u) => {
          let f = !1, d;
          if (n && u.indexOf("$form.") === 0) {
            const p = u.split(".");
            p.shift(), G(n.value, p[0]) && (f = !0, d = r ? r({
              id: "$form." + p[0] + "_" + n.rule.__fc__.id,
              getValue: () => ie(n.value, p)
            }) : ie(n.value, p));
          }
          return f || (d = r ? r(u) : this.fc.getLoadData(u)), d;
        }, a = (u) => {
          const f = [];
          u.forEach((p) => {
            p.key ? f.push(p.key) : p.children && f.push(a(p.children));
          });
          let d = !1;
          return f.forEach((p, h) => {
            p != null && (p.indexOf("'") === 0 || p.indexOf('"') === 0) && (f[h] = p.slice(1, -1), d = !0);
          }), f.length === 1 && (d || !isNaN(Number(f[0]))) ? f[0] : s(f.join("."));
        };
        let l;
        if (i.forEach((u) => {
          const f = u.split("||"), d = f[0].trim();
          if (d) {
            const p = (f[1] || "").trim(), h = pr(d);
            let b = P(() => a(h));
            (b == null || b === "") && f.length > 1 && (b = p), l = b, e = e.replaceAll(`{{${u}}}`, b == null ? "" : b);
          }
        }), i.length === 1 && o === `{{${i[0]}}}`)
          return l;
      }
      return e;
    },
    loadFetchVar(e, r, n) {
      let o;
      n && n.__fc__ && (o = n.__fc__.getParentGroup()), !o && e.targetRule && e.targetRule.__fc__ && (o = e.targetRule.__fc__.getParentGroup());
      const i = (s) => this.loadStrVar(s, r, o ? { rule: n, value: this.subRuleData[o.id] || {} } : null);
      return e.action = i(e.action || ""), ["headers", "data", "query"].forEach((s) => {
        if (e[s]) {
          const a = Array.isArray(e[s]) ? [] : {};
          Object.keys(e[s]).forEach((l) => {
            a[i(l)] = i(e[s][l]);
          }), e[s] = a;
        }
      }), e;
    }
  });
}
const xt = ["hook:updated", "hook:mounted"];
function Gn(t) {
  R(t.prototype, {
    usePage() {
      const e = this.options.page;
      if (!e) return;
      let r = 25, n = zn(this.rules);
      m.Object(e) && (e.first && (r = parseInt(e.first, 10) || r), e.limit && (n = parseInt(e.limit, 10) || n)), R(this, {
        first: r,
        limit: n,
        pageEnd: this.rules.length <= r
      }), this.bus.$on("page-end", () => this.vm.emit("page-end", this.api)), this.pageLoad();
    },
    pageLoad() {
      const e = () => {
        this.pageEnd ? (this.bus.$off(xt, e), this.bus.$emit("page-end")) : (this.first += this.limit, this.pageEnd = this.rules.length <= this.first, this.loadRule(), this.refresh());
      };
      this.bus.$on(xt, e);
    }
  });
}
function zn(t) {
  return t.length < 31 ? 31 : Math.ceil(t.length / 3);
}
function Jn(t) {
  R(t.prototype, {
    clearNextTick() {
      this.nextTick && clearTimeout(this.nextTick), this.nextTick = null;
    },
    bindNextTick(e) {
      this.clearNextTick(), this.nextTick = setTimeout(() => {
        e(), this.nextTick = null;
      }, 10);
    },
    render() {
      return ++this.loadedId, this.vm.setupState.unique > 0 ? this.$render.render() : (this.vm.setupState.unique = 1, []);
    }
  });
}
function Qn(t) {
  Object.defineProperties(t.origin, {
    __fc__: $t(Ve(t))
  }), t.rule !== t.origin && Object.defineProperties(t.rule, {
    __fc__: $t(Ve(t))
  });
}
function br(t, e, r) {
  const n = at(), o = !!e.field;
  R(this, {
    id: n,
    ref: n,
    wrapRef: n + "fi",
    rule: e,
    origin: e.__origin__ || e,
    name: e.name,
    pending: {},
    none: !1,
    watch: [],
    linkOn: [],
    root: [],
    ctrlRule: [],
    children: [],
    parent: null,
    group: e.subRule ? this : null,
    cacheConfig: null,
    prop: D({}, e),
    computed: {},
    payload: {},
    refRule: {},
    handlers: null,
    input: o,
    el: void 0,
    exportEl: void 0,
    defaultValue: o ? Oe(r) : void 0,
    field: e.field || void 0
  }), this.updateKey(), Qn(this), this.update(t, !0);
}
R(br.prototype, {
  getParentGroup() {
    let t = this.parent;
    for (; t; ) {
      if (t.group)
        return t;
      t = t.parent;
    }
  },
  loadChildrenPending() {
    const t = this.rule.children || [];
    return Array.isArray(t) ? t : this.loadPending({
      key: "children",
      origin: t,
      def: [],
      onLoad: (e) => {
        this.$handle && this.$handle.loadChildren(e, this);
      },
      onUpdate: (e, r) => {
        this.$handle && (e === r ? this.$handle.loadChildren(e, this) : this.$handle.updateChildren(this, e, r));
      },
      onReload: (e) => {
        this.$handle ? this.$handle.updateChildren(this, [], e) : delete this.pending.children;
      }
    });
  },
  loadPending(t) {
    const { key: e, origin: r, def: n, onLoad: o, onReload: i, onUpdate: s } = t;
    if (this.pending[e] && this.pending[e].origin === r)
      return this.getPending(e, n);
    delete this.pending[e];
    let a = r;
    if (m.Function(r)) {
      let l = P(() => r({
        rule: this.rule,
        api: this.$api,
        update: (u) => {
          const f = u || n, d = this.getPending(e, n);
          this.setPending(e, r, f), s && s(f, d);
        },
        reload: () => {
          const u = this.getPending(e, n);
          delete this.pending[e], i && i(u), this.$api && this.$api.sync(this.rule);
        }
      }));
      l && m.Function(l.then) ? (l.then((u) => {
        const f = u || n;
        this.setPending(e, r, f), o && o(f), this.$api && this.$api.sync(this.rule);
      }).catch((u) => {
        console.error(u);
      }), a = n, this.setPending(e, r, a)) : (a = l || n, this.setPending(e, r, a), o && o(a));
    }
    return a;
  },
  getPending(t, e) {
    return this.pending[t] && this.pending[t].value || e;
  },
  setPending(t, e, r) {
    this.pending[t] = {
      origin: e,
      value: _e(r)
    };
  },
  effectData(t) {
    return this.payload[t] || (this.payload[t] = {}), this.payload[t];
  },
  clearEffectData(t) {
    t === void 0 ? this.payload = {} : delete this.payload[t];
  },
  updateKey(t) {
    this.key = at(), t && this.parent && this.parent.updateKey(t);
  },
  updateType() {
    this.originType = this.rule.type, this.type = le(this.rule.type), this.trueType = this.$handle.getType(this.originType);
  },
  setParser(t) {
    this.parser = t, t.init(this);
  },
  initProp() {
    var e, r, n;
    const t = D({}, this.rule);
    delete t.children, delete t.validate, this.prop = Fe({}, [t, ...Object.keys(this.payload).map((o) => this.payload[o]), this.computed]), t.col && ((e = t.col) == null ? void 0 : e.show) !== !1 && (this.prop.col.show = !0), this.prop.validate = [...((n = (r = this.refRule) == null ? void 0 : r.__$validate) == null ? void 0 : n.value) || [], ...this.prop.validate || []];
  },
  initNone() {
    this.none = !(m.Undef(this.prop.display) || this.prop.display);
  },
  hasHidden() {
    return !!this.rule.hidden || (this.parent ? this.parent.hasHidden() : !1);
  },
  injectValidate() {
    return this.prop.validate;
  },
  check(t) {
    return this.vm === t.vm;
  },
  unwatch() {
    this.watch.forEach((t) => t()), this.watch = [], Object.keys(this.refRule).forEach((t) => {
      t.indexOf("__$") !== 0 && delete this.refRule[t];
    });
  },
  unlink() {
    this.linkOn.forEach((t) => t()), this.linkOn = [];
  },
  link() {
    this.unlink(), this.$handle.appendLink(this);
  },
  watchTo() {
    this.$handle.watchCtx(this);
  },
  delete() {
    this.unwatch(), this.unlink(), this.rmCtrl(), this.parent && this.parent.children.splice(this.parent.children.indexOf(this) >>> 0, 1), R(this, {
      deleted: !0,
      computed: {},
      parent: null,
      children: [],
      cacheConfig: null,
      none: !1,
      handlers: null,
      //rule.__fc__ 是不可配置的强引用,ctx 往往比表单活得更久,
      //这里必须主动释放 DOM,否则已卸载的节点会一直被规则树持有
      el: void 0,
      exportEl: void 0
    });
  },
  rmCtrl() {
    this.ctrlRule.forEach((t) => t.__fc__ && t.__fc__.rm()), this.ctrlRule = [];
  },
  rm() {
    const t = () => {
      let e = this.root.indexOf(this.origin);
      e > -1 && (this.root.splice(e, 1), this.$handle && this.$handle.refresh());
    };
    if (this.deleted) {
      t();
      return;
    }
    this.$handle.noWatch(() => {
      this.$handle.deferSyncValue(() => {
        this.rmCtrl(), t(), this.$handle.rmCtx(this), R(this, {
          root: []
        });
      }, this.input);
    });
  },
  update(t, e) {
    R(this, {
      deleted: !1,
      $handle: t,
      $render: t.$render,
      $api: t.api,
      vm: t.vm,
      vNode: t.$render.vNode,
      updated: !1,
      cacheValue: this.rule.value
    }), !e && this.unwatch(), this.watchTo(), this.link(), this.updateType();
  }
});
function Kn(t) {
  R(t.prototype, {
    nextRefresh(e) {
      const r = this.loadedId;
      X(() => {
        r === this.loadedId && (e ? e() : this.refresh());
      });
    },
    parseRule(e) {
      const r = Mt(e);
      return Object.defineProperties(r, {
        __origin__: $t(e)
      }), Zn(r), this.appendValue(r), [r, r.prefix, r.suffix].forEach((n) => {
        n && this.loadFn(n, r);
      }), this.loadCtrl(r), r.update && (r.update = we(r.update)), r;
    },
    loadFn(e, r) {
      ["on", "props", "deep"].forEach((n) => {
        e[n] && this.parseInjectEvent(r, e[n]);
      });
    },
    loadCtrl(e) {
      e.control && e.control.forEach((r) => {
        r.handle && (r.handle = we(r.handle));
      });
    },
    syncProp(e) {
      const r = e.rule;
      m.trueArray(r.sync) && De([{
        on: r.sync.reduce((n, o) => (n[typeof o == "object" && o.event || `update:${o}`] = (i) => {
          r.props[typeof o == "object" && o.prop || o] = i, this.vm.emit("sync", o, i, r, this.fapi);
        }, n), {})
      }], e.computed);
    },
    loadRule() {
      this.cycleLoad = !1, this.loading = !0, this.pageEnd && this.bus.$emit("load-start"), this.deferSyncValue(() => {
        if (this._loadRule(this.rules), this.loading = !1, this.cycleLoad && this.pageEnd)
          return this.loadRule();
        this.syncForm(), this.pageEnd && this.bus.$emit("load-end"), this.vm.setupState.renderRule();
      });
    },
    loadChildren(e, r) {
      if (this.cycleLoad = !1, this.loading = !0, this.bus.$emit("load-start"), this._loadRule(e, r), this.loading = !1, this.cycleLoad)
        return this.loadRule();
      this.syncForm(), this.bus.$emit("load-end"), this.$render.clearCache(r);
    },
    _loadRule(e, r) {
      const n = (s) => {
        let a = e[s - 1];
        if (!a || !a.__fc__)
          return s > 0 ? n(s - 1) : -1;
        let l = this.sort.indexOf(a.__fc__.id);
        return l > -1 ? l : n(s - 1);
      }, o = (s, a) => {
        m.trueArray(s) && this._loadRule(s, a);
      }, i = e.map((s, a) => {
        if (r && !m.Object(s) || !this.pageEnd && !r && a >= this.first) return;
        if (s.__fc__ && s.__fc__.root === e && this.ctxs[s.__fc__.id])
          return o(s.__fc__.loadChildrenPending(), s.__fc__), s.__fc__;
        let l = Mt(s);
        const u = () => !!(l.field && this.fieldCtx[l.field] && this.fieldCtx[l.field][0] !== s.__fc__);
        this.fc.targetFormDriver("loadRule", { rule: l, api: this.api }, this.fc), this.ruleEffect(l, "init", { repeat: u() }), u() && this.vm.emit("repeat-field", s, this.api);
        let f, d = !1, p = !!s.__fc__, h = l.value;
        if (p) {
          if (f = s.__fc__, h = f.defaultValue, f.deleted) {
            if (qt(f))
              return;
            f.update(this);
          } else if (!f.check(this)) {
            if (qt(f))
              return;
            e[a] = s = s._clone ? s._clone() : er(Ge(s)), f = null, d = !0;
          }
        }
        if (f)
          f.originType !== f.rule.type && f.updateType(), this.bindParser(f), this.appendValue(f.rule), f.parent && f.parent !== r && this.rmSubRuleData(f);
        else {
          const w = this.parseRule(s);
          f = new br(this, w, h), this.bindParser(f);
        }
        this.parseEmit(f), this.syncProp(f), f.parent = r || null, f.root = e, this.setCtx(f), !d && !p && (this.effect(f, "load"), this.targetHook(f, "load")), this.effect(f, "created");
        const b = f.loadChildrenPending();
        if (f.parser.loadChildren === !1 || o(b, f), !r) {
          const w = n(a);
          w > -1 || !a ? this.sort.splice(w + 1, 0, f.id) : this.sort.push(f.id);
        }
        const S = f.rule;
        return f.updated || (f.updated = !0, m.Function(S.update) && this.bus.$once("load-end", () => {
          this.refreshUpdate(f, S.value, "init");
        }), this.effect(f, "loaded")), this.refreshControl(f) && (this.cycleLoad = !0), f;
      }).filter((s) => !!s);
      r && (r.children = i);
    },
    refreshControl(e) {
      return e.input && e.rule.control && this.useCtrl(e);
    },
    useCtrl(e) {
      const r = Xn(e), n = [], o = this.api;
      if (!r.length) return !1;
      for (let a = 0; a < r.length; a++) {
        const l = r[a], u = l.handle || function(d) {
          return (Le[l.condition || "=="] || Le["=="])(d, l.value);
        };
        if (!m.trueArray(l.rule)) continue;
        const f = ae(D({}, l), {
          valid: P(() => u(e.rule.value, o)),
          ctrl: ei(e, l.rule),
          isHidden: m.String(l.rule[0])
        });
        f.valid && f.ctrl || !f.valid && !f.ctrl && !f.isHidden || n.push(f);
      }
      if (!n.length) return !1;
      const i = [];
      let s = !1;
      return this.deferSyncValue(() => {
        n.reverse().forEach(({ isHidden: a, valid: l, rule: u, prepend: f, append: d, child: p, ctrl: h, method: b }) => {
          if (a) {
            l ? e.ctrlRule.push({
              __ctrl: !0,
              children: u,
              valid: l
            }) : h && e.ctrlRule.splice(e.ctrlRule.indexOf(h) >>> 0, 1), i[l ? "push" : "unshift"](() => {
              b === "disabled" || b === "enabled" ? this.api.disabled(!l, u) : b === "display" || b === "show" ? this.api.display(l, u) : b === "required" ? (u.forEach((S) => {
                this.api.setEffect(S, "required", l);
              }), l || this.api.clearValidateState(u)) : b === "if" ? this.api.hidden(!l, u) : this.api.hidden(!l, u);
            });
            return;
          }
          if (l) {
            s = !0;
            const S = {
              type: "fragment",
              native: !0,
              __ctrl: !0,
              children: u
            };
            e.ctrlRule.push(S), this.bus.$once("load-start", () => {
              f ? o.prepend(S, f, p) : d || p ? o.append(S, d || e.id, p) : e.root.splice(e.root.indexOf(e.origin) + 1, 0, S);
            });
          } else {
            e.ctrlRule.splice(e.ctrlRule.indexOf(h), 1);
            const S = ve(h);
            S && S.rm();
          }
        });
      }), i.length && (this.loading ? i.length && this.bus.$once("load-end", () => {
        i.forEach((a) => a());
      }) : i.length && X(() => {
        i.forEach((a) => a());
      })), this.vm.emit("control", e.origin, this.api), this.effect(e, "control"), s;
    },
    reloadRule(e) {
      return this._reloadRule(e);
    },
    _reloadRule(e) {
      e || (e = this.rules);
      const r = D({}, this.ctxs);
      this.clearNextTick(), this.initData(e), this.fc.rules = e, this.deferSyncValue(() => {
        this.bus.$once("load-end", () => {
          Object.keys(r).filter((n) => this.ctxs[n] === void 0).forEach((n) => this.rmCtx(r[n])), this.$render.clearCacheAll();
        }), this.reloading = !0, this.loadRule(), this.reloading = !1, this.refresh(), this.bus.$emit("reloading", this.api);
      }), this.bus.$off("next-tick", this.nextReload), this.bus.$once("next-tick", this.nextReload), this.bus.$emit("update", this.api);
    },
    //todo 组件生成全部通过 alias
    refresh() {
      this.vm.setupState.refresh();
    }
  });
}
function Zn(t) {
  const e = mr();
  return Object.keys(e).forEach((r) => {
    G(t, r) || (t[r] = e[r]);
  }), t;
}
function Xn(t) {
  const e = t.rule.control || [];
  return m.Object(e) ? [e] : e;
}
function ei(t, e) {
  for (let r = 0; r < t.ctrlRule.length; r++) {
    const n = t.ctrlRule[r];
    if (n.children === e)
      return n;
  }
}
function qt(t) {
  return !!t.rule.__ctrl;
}
function ti(t) {
  R(t.prototype, {
    setValue(e, r, n, o) {
      e.deleted || this.options.trim && (m.String(r) && (r = r.trim()), m.String(n) && (n = n.trim()), r === e.rule.value) || (e.rule.value = r, this.changeStatus = !0, this.setFormData(e, n), this.$render.clearCache(e), this.nextRefresh(), this.syncValue(), this.valueChange(e, r), this.vm.emit("change", e.field, r, e.origin, this.api, o || !1), this.effect(e, "value"), this.targetHook(e, "value", { value: r }), this.emitEvent("change", e.field, r, {
        rule: e.origin,
        api: this.api,
        setFlag: o || !1
      }), o && X(() => {
        X(() => {
          X(() => {
            this.api.clearValidateState(e.id);
          });
        });
      }), this.$manager.fieldChange(e, r, n, o));
    },
    onInput(e, r) {
      let n;
      e.input && (this.isQuote(e, n = e.parser.toValue(r, e)) || this.isChange(e, r)) && this.setValue(e, n, r);
    },
    onUpdateValue(e, r) {
      this.deferSyncValue(() => {
        const n = e.getParentGroup(), o = n ? this.subRuleData[n.id] : null, i = {};
        Object.keys(r || {}).forEach((s) => {
          o && G(o, s) ? i[s] = r[s] : G(this.api.form, s) ? this.api.form[s] = r[s] : this.api.top !== this.api && G(this.api.top.form, s) && (this.api.top.form[s] = r[s]);
        }), Object.keys(i).length && this.api.setChildrenFormData(n.rule, i);
      });
    },
    onBaseInput(e, r) {
      this.setFormData(e, r), this.$render.clearCache(e), this.nextRefresh();
    },
    setFormData(e, r) {
      e.modelValue = r;
      const n = e.getParentGroup();
      n && (this.subRuleData[n.id] || (this.subRuleData[n.id] = {}), this.subRuleData[n.id][e.field] = e.rule.value), fe(this.formData, e.id, r);
    },
    rmSubRuleData(e) {
      const r = e.getParentGroup();
      r && this.subRuleData[r.id] && delete this.subRuleData[r.id][e.field];
    },
    getFormData(e) {
      return this.formData[e.id];
    },
    syncForm() {
      const e = _e({}), r = this.fields(), n = [];
      this.options.appendValue !== !1 && Object.keys(this.appendData).reduce((o, i) => (r.indexOf(i) === -1 && (o[i] = tt(this.appendData, i)), o), e), r.reduce((o, i) => {
        let s = (this.fieldCtx[i] || []).filter((a) => !this.isIgnore(a))[0];
        return s || (s = this.fieldCtx[i][0], n.push(i)), o[i] = tt(s.rule, "value"), o;
      }, e), this.form = e, this.ignoreFields = n, this.syncValue();
    },
    isIgnore(e) {
      return e.rule.ignore === !0 || (e.rule.ignore === "hidden" || this.options.ignoreHiddenFields) && e.hasHidden();
    },
    appendValue(e) {
      (!e.field || !G(this.appendData, e.field)) && (!m.Undef(e.value) || !this.options.forceCoverValue) || (e.value = this.appendData[e.field], delete this.appendData[e.field]);
    },
    addSubForm(e, r) {
      this.subForm[e.id] = r;
    },
    deferSyncValue(e, r) {
      this.deferSyncFn || (this.deferSyncFn = e), this.deferSyncFn.sync || (this.deferSyncFn.sync = r), P(e), this.deferSyncFn === e && (this.deferSyncFn = null, e.sync && this.syncForm());
    },
    syncValue() {
      if (this.deferSyncFn)
        return this.deferSyncFn.sync = !0;
      const e = {};
      Object.keys(this.form).forEach((r) => {
        this.ignoreFields.indexOf(r) === -1 && (e[r] = this.form[r]);
      }), this.vm.setupState.updateValue(e);
    },
    isChange(e, r) {
      const n = this.getFormData(e);
      if (n === r)
        return !1;
      const o = typeof n;
      return o === typeof r && (o === "string" || o === "boolean" || o === "number" && Number.isFinite(n) && Number.isFinite(r)) ? !0 : JSON.stringify(n, Ut) !== JSON.stringify(r, Ut);
    },
    isQuote(e, r) {
      return (r instanceof Function || m.Object(r) || Array.isArray(r)) && r === e.rule.value;
    },
    refreshUpdate(e, r, n, o) {
      if (m.Function(e.rule.update)) {
        const i = P(() => e.rule.update(r, e.origin, this.api, {
          origin: n || "change",
          linkField: o
        }));
        if (i === void 0) return;
        e.rule.hidden = i === !0;
      }
    },
    valueChange(e, r) {
      this.refreshRule(e, r), this.bus.$emit("change-" + e.field, r);
    },
    refreshRule(e, r, n, o) {
      this.refreshControl(e) && (this.$render.clearCacheAll(), this.loadRule(), this.bus.$emit("update", this.api), this.refresh()), this.refreshUpdate(e, r, n, o);
    },
    appendLink(e) {
      const r = e.rule.link;
      m.trueArray(r) && r.forEach((n) => {
        const o = () => this.refreshRule(e, e.rule.value, "link", n);
        this.bus.$on("change-" + n, o), e.linkOn.push(() => this.bus.$off("change-" + n, o));
      });
    },
    fields() {
      return Object.keys(this.fieldCtx);
    }
  });
}
function Ut(t, e) {
  return typeof e == "function" ? "" + e : e;
}
const He = {
  init(t) {
  },
  toFormValue(t, e) {
    return t;
  },
  toValue(t, e) {
    return t;
  },
  mounted(t) {
  },
  render(t, e) {
    return e.$handle.fc.renderDriver && e.$handle.fc.renderDriver.defaultRender ? e.$handle.fc.renderDriver.defaultRender(e, t) : e.$render.defaultRender(e, t);
  },
  preview(t, e) {
    return e.$handle.fc.renderDriver && e.$handle.fc.renderDriver.defaultPreview ? e.$handle.fc.renderDriver.defaultPreview(e, t) : this.render(t, e);
  },
  mergeProp(t) {
  }
}, ri = ["field", "value", "vm", "template", "name", "config", "control", "inject", "sync", "payload", "optionsTo", "update", "slotUpdate", "computed", "component", "cache"], Ue = Symbol("oldValue"), ni = ["$condition", "$variableVal", "$val", "$form", "$scope", "$group", "$rule"], ii = ["$formulas", "$form", "$scope", "$group", "$rule", "$api"], Ze = /* @__PURE__ */ new Map(), si = 1e3;
function Yt(t, e) {
  const r = t.join(",") + "|" + e;
  let n = Ze.get(r);
  return n || (Ze.size >= si && Ze.clear(), n = new Function(...t, e), Ze.set(r, n)), n;
}
function oi(t) {
  R(t.prototype, {
    //computed 更新原先各自 setTimeout(0),N 个字段同时联动就会拆成 N 个宏任务,
    //Vue 在任务之间各 flush 一次,render 被放大 N 倍。
    //这里改成按入队顺序在同一个宏任务里串行执行,并在 flush 期间继续吞掉级联入队,
    //相对顺序与原先一致,只是把中间多余的渲染合并掉。
    scheduleComputedUpdate(e) {
      (this._computedQueue || (this._computedQueue = [])).push(e), !(this._computedFlushing || this._computedScheduled) && (this._computedScheduled = !0, setTimeout(() => {
        this._computedScheduled = !1, this._computedFlushing = !0;
        try {
          const r = this._computedQueue || [];
          this._computedQueue = [];
          for (let n = 0; n < r.length; n++)
            P(r[n]), this._computedQueue && this._computedQueue.length && (r.push(...this._computedQueue), this._computedQueue = []);
        } finally {
          this._computedFlushing = !1;
        }
      }));
    },
    getCtx(e) {
      return this.getFieldCtx(e) || this.getNameCtx(e)[0] || this.ctxs[e];
    },
    getCtxs(e) {
      return this.fieldCtx[e] || this.nameCtx[e] || (this.ctxs[e] ? [this.ctxs[e]] : []);
    },
    setIdCtx(e, r, n) {
      const o = `${n}Ctx`;
      this[o][r] ? this[o][r].push(e) : this[o][r] = [e];
    },
    rmIdCtx(e, r, n) {
      const o = `${n}Ctx`, i = this[o][r];
      if (!i) return !1;
      const s = i.splice(i.indexOf(e) >>> 0, 1).length > 0;
      return i.length || delete this[o][r], s;
    },
    getFieldCtx(e) {
      return (this.fieldCtx[e] || [])[0];
    },
    getNameCtx(e) {
      return this.nameCtx[e] || [];
    },
    setCtx(e) {
      let { id: r, field: n, name: o, rule: i } = e;
      this.ctxs[r] = e, o && this.setIdCtx(e, o, "name"), e.input && (this.setIdCtx(e, n, "field"), this.setFormData(e, e.parser.toFormValue(i.value, e)), this.isMounted && !this.reloading && this.vm.emit("change", e.field, i.value, e.origin, this.api, !1, !0));
    },
    getParser(e) {
      const r = this.fc.parsers, n = this.fc.renderDriver;
      if (n) {
        const o = n.parsers || {}, i = o[e.originType] || o[le(e.type)] || o[e.trueType];
        if (i)
          return i;
      }
      return r[e.originType] || r[le(e.type)] || r[e.trueType] || He;
    },
    bindParser(e) {
      e.setParser(this.getParser(e));
    },
    getType(e) {
      const r = this.fc.CreateNode.aliasMap, n = r[e] || r[le(e)] || e;
      return le(n);
    },
    noWatch(e) {
      this.noWatchFn || (this.noWatchFn = e), P(e), this.noWatchFn === e && (this.noWatchFn = null);
    },
    watchCtx(e) {
      const r = sr().filter((s) => s[0] !== "_" && s[0] !== "$" && ri.indexOf(s) === -1), n = {}, o = (s, a, l) => (u, f) => {
        let d = a.value;
        if (!this.isBreakWatch()) {
          if (l && e.parser.loadChildren === !1) {
            this.$render.clearCache(e), this.nextRefresh();
            return;
          }
          if (this.watching = !0, X(() => {
            this.targetHook(e, "watch", { key: s, oldValue: f, newValue: d });
          }), s === "hidden" && !!d != !!f && X(() => {
            this.targetHook(e, "hidden", { value: d });
          }), s === "ignore" && e.input || s === "hidden" && (e.rule.ignore === "hidden" || this.options.ignoreHiddenFields))
            this.syncForm();
          else if (s === "link") {
            e.link();
            return;
          } else ["props", "on", "deep"].indexOf(s) > -1 ? (this.parseInjectEvent(e.rule, d || {}), s === "props" && e.input && this.setFormData(e, e.parser.toFormValue(e.rule.value, e))) : s === "emit" ? this.parseEmit(e) : ["prefix", "suffix"].indexOf(s) > -1 ? d && this.loadFn(d, e.rule) : s === "type" ? (e.updateType(), this.bindParser(e)) : l && (m.Function(f) && (f = e.getPending("children", [])), m.Function(d) && (d = e.loadChildrenPending()), this.updateChildren(e, d, f));
          this.$render.clearCache(e), this.refresh(), this.watching = !1;
        }
      }, i = (s, a) => {
        if (n[s]) return;
        n[s] = !0;
        const l = e.refRule[s], u = s === "children", f = o(s, l, u);
        e.watch.push(ue(u ? () => m.Function(l.value) ? l.value : [...l.value || []] : () => l.value, f, { deep: !u, sync: u })), a && f(l.value, void 0);
      };
      if (r.forEach((s) => {
        e.refRule[s] = tt(e.rule, s), G(e.rule, s) && i(s);
      }), e.watch.push(ue(() => Object.keys(e.rule).join("|"), () => {
        r.forEach((s) => {
          !n[s] && G(e.rule, s) && i(s, !0);
        });
      })), e.refRule.__$title = Ne(() => {
        let s = (typeof e.rule.title == "object" ? e.rule.title.title : e.rule.title) || "";
        if (s) {
          const a = s.match(/^\{\{\s*\$t\.(.+)\s*\}\}$/);
          a && (s = this.api.t(a[1]));
        }
        return s;
      }), e.refRule.__$info = Ne(() => {
        let s = (typeof e.rule.info == "object" ? e.rule.info.info : e.rule.info) || "";
        if (s) {
          const a = s.match(/^\{\{\s*\$t\.(.+)\s*\}\}$/);
          a && (s = this.api.t(a[1]));
        }
        return s;
      }), e.refRule.__$validate = Ne(() => {
        const s = (a) => {
          var u, f;
          const l = a.match(/^\{\{\s*\$t\.(.+)\s*\}\}$/);
          return l ? this.api.t(l[1], { title: (f = (u = e.refRule) == null ? void 0 : u.__$title) == null ? void 0 : f.value }) : a;
        };
        return be(e.rule.validate).map((a) => {
          const l = D({}, a);
          if (l.message && (l.message = s(l.message)), m.Function(l.validator)) {
            const u = e;
            l.validator = function(...f) {
              return a.validator.call({
                that: this,
                id: u.id,
                field: u.field,
                rule: u.rule,
                api: u.$handle.api
              }, ...f);
            };
          }
          if (l.adapter) {
            if (typeof l.error == "object") {
              const u = D({}, l.error);
              Object.keys(u).forEach((f) => {
                u[f] = s(u[f]);
              }), l.error = u;
            }
            return this.adapterValidate(l, e);
          }
          return l;
        });
      }), e.input) {
        const s = tt(e.rule, "value");
        e.watch.push(ue(() => s.value, () => {
          let a = e.parser.toFormValue(s.value, e);
          this.isChange(e, a) && this.setValue(e, s.value, a, !0);
        }));
      }
      this.bus.$once("load-end", () => {
        let s = e.rule.computed;
        s && (typeof s != "object" && (s = { value: s }), Object.keys(s).forEach((a) => {
          const l = Ne(() => {
            const f = s[a];
            if (!f) return;
            const d = this.compute(e, f);
            return (f.linkage || f.linkageVariable) && d === Ue ? Ue : d;
          }), u = (f) => {
            a === "value" ? this.onInput(e, f) : a[0] === "$" ? this.api.setEffect(e.id, a, f) : Me(e.rule, a, f);
          };
          (a === "value" ? [void 0, null, ""].indexOf(e.rule.value) > -1 : l.value !== ie(e.rule, a)) && u(l.value), e.watch.push(ue(l, (f) => {
            f !== Ue && this.scheduleComputedUpdate(() => u(f));
          }, { deep: !0 }));
        }));
      }), this.watchEffect(e);
    },
    adapterValidate(e, r) {
      const n = (o, i) => {
        if ((e.beforeValidate && P(() => e.beforeValidate({
          value: o,
          api: this.api,
          validate: e,
          rule: r.rule
        }))) === !1)
          i();
        else {
          const a = this.validator(r, o, e);
          if (a) {
            let l = "";
            typeof e.error == "object" && (l = e.error[a] || e.error.default), !l && typeof e.message == "string" && (l = e.message), l || (l = this.getValidateMessage(r, { key: a, rule: e[a] })), i(l);
          } else if (e.validator) {
            const l = e.validator && P(() => e.validator(o, i));
            l && m.Function(l.then) && l.then(() => i()).catch((u) => i(u));
          } else
            i();
        }
      };
      return this.$manager.adapterValidate({
        required: e.required,
        message: e.message,
        trigger: e.trigger
      }, n);
    },
    getValidateMessage(e, r) {
      var o, i;
      const n = Array.isArray(r.rule) ? r.rule.join(",") : "" + r.rule;
      return this.api.t(r.key === "required" ? r.key : "validate." + r.key, {
        [r.key]: n,
        title: (i = (o = e.refRule) == null ? void 0 : o.__$title) == null ? void 0 : i.value
      });
    },
    validator(e, r, n) {
      if (m.empty(r))
        return n.required ? "required" : void 0;
      for (const [i, s] of Object.entries(n))
        switch (i) {
          case "len":
          case "maxLen":
          case "minLen":
            const a = (b) => i === "len" ? b === s : i === "maxLen" ? b <= s : b >= s;
            if (Array.isArray(r)) {
              if (!a(r.length))
                return i;
            } else {
              if (typeof r == "object")
                return i;
              if (!a(("" + r).length))
                return i;
            }
            break;
          case "pattern":
            if (!(typeof s == "string" ? new RegExp(s) : s).test("" + r))
              return i;
            break;
          case "uppercase":
            if (s && (typeof r != "string" || !/^[A-Z]*$/.test(r)))
              return i;
            break;
          case "lowercase":
            if (s && (typeof r != "string" || !/^[a-z]*$/.test(r)))
              return i;
            break;
          case "min":
          case "max":
          case "positive":
          case "negative":
          case "integer":
          case "number":
            const u = Number(r);
            if (Number.isNaN(u) || i === "min" && u < s || i === "max" && u > s || i === "positive" && u <= 0 || i === "negative" && u >= 0 || i === "integer" && !Number.isInteger(u))
              return i;
            break;
          case "equal":
            if (r !== s)
              return i;
            break;
          case "enum":
            if (Array.isArray(s) && !s.includes(r))
              return i;
            break;
          case "hasKeys":
            if (typeof r != "object" || Array.isArray(s) && s.some((b) => !(b in r)))
              return i;
            break;
          case "email":
            if (!/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test("" + r))
              return i;
            break;
          case "url":
            if (!new RegExp(
              "^(?!mailto:)(?:(?:http|https|ftp)://)(?:\\S+(?::\\S*)?@)?(?:(?:(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}(?:\\.(?:[0-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))|(?:(?:[a-z\\u00a1-\\uffff0-9]+-?)*[a-z\\u00a1-\\uffff0-9]+)(?:\\.(?:[a-z\\u00a1-\\uffff0-9]+-?)*[a-z\\u00a1-\\uffff0-9]+)*(?:\\.(?:[a-z\\u00a1-\\uffff]{2,})))|localhost)(?::\\d{2,5})?(?:(/|\\?|#)[^\\s]*)?$",
              "i"
            ).test("" + r))
              return i;
            break;
          case "ip":
            if (!/^(2(5[0-5]{1}|[0-4]\d{1})|[0-1]?\d{1,2})(\.(2(5[0-5]{1}|[0-4]\d{1})|[0-1]?\d{1,2})){3}$/.test("" + r))
              return i;
            break;
          case "phone":
            if (!/^(?:(?:\+|00)86)?1[3-9]\d{9}$/.test("" + r))
              return i;
            break;
          case "computed":
            if (!this.compute(e, s))
              return i;
            break;
        }
    },
    compute(e, r) {
      let n;
      if (typeof r == "object") {
        const o = e.getParentGroup(), i = (a) => {
          if (a = Array.isArray(a) ? { mode: "AND", group: a } : a, !m.trueArray(a.group))
            return !0;
          const l = a.mode === "OR";
          let u = !0;
          for (let f = 0; f < a.group.length; f++) {
            const d = a.group[f];
            let p, h = null, b = null;
            if (d.variable)
              b = this.fc.getLoadData(d.variable);
            else if (d.field)
              h = Lt(d.field || "");
            else if (!d.mode)
              return !0;
            let S = d.compare;
            if (S && (S = Lt(S || "")), d.mode ? p = i(d) : Le[d.condition] ? m.Function(d.handler) ? p = P(() => d.handler(this.api, e.rule)) : p = P(() => Yt(ni, `with($form){with($scope){with(this){with($group){ return $condition['${d.condition}'](${d.variable ? "$variableVal" : h}, ${S || "$val"}); }}}}`).call(this.api.form, Le, b, d.value, this.api.top.form, this.api.top === this.api.scope ? {} : this.api.scope.form, o ? this.subRuleData[o.id] || {} : {}, e.rule)) : p = !1, l && p)
              return !0;
            l || (u = u && p);
          }
          return l ? !1 : u;
        };
        let s = i(r);
        return s = r.invert === !0 ? !s : s, r.linkage ? s ? P(() => this.computeValue(r.linkage, e, o), void 0) : Ue : r.linkageVariable ? s ? P(() => this.fc.getLoadData(r.linkageVariable), void 0) : Ue : s;
      } else if (m.Function(r))
        n = () => r(this.api.form, this.api, e.rule);
      else {
        const o = e.getParentGroup();
        n = () => this.computeValue(r, e, o);
      }
      return P(n, void 0);
    },
    computeValue(e, r, n) {
      const o = this, i = Object.keys(this.fc.formulas).reduce((s, a) => (s[a] = function(...l) {
        return o.fc.formulas[a].call({
          that: this,
          rule: r.rule,
          api: o.api,
          fc: o.fc
        }, ...l);
      }, s), {});
      return P(() => Yt(ii, `with($form){with($scope){with(this){with($group){with($formulas){ return ${e} }}}}}`).call(this.api.form, i, this.api.top.form, this.api.top === this.api.scope ? {} : this.api.scope.form, n ? this.subRuleData[n.id] || {} : {}, r.rule, this.api), void 0);
    },
    updateChildren(e, r, n) {
      this.deferSyncValue(() => {
        n && n.forEach((o) => {
          (r || []).indexOf(o) === -1 && o && !m.String(o) && o.__fc__ && o.__fc__.parent === e && this.rmCtx(o.__fc__);
        }), m.trueArray(r) && (this.loadChildren(r, e), this.bus.$emit("update", this.api));
      });
    },
    rmSub(e) {
      m.trueArray(e) && e.forEach((r) => {
        r && r.__fc__ && this.rmCtx(r.__fc__);
      });
    },
    rmCtx(e) {
      if (e.deleted) return;
      const { id: r, field: n, input: o, name: i } = e;
      Te(this.ctxs, r), Te(this.formData, r), Te(this.subForm, r), Te(this.vm.setupState.ctxInject, r);
      const s = e.getParentGroup();
      s && this.subRuleData[s.id] && Te(this.subRuleData[s.id], n), e.group && Te(this.subRuleData, r), o && this.rmIdCtx(e, n, "field"), i && this.rmIdCtx(e, i, "name"), o && !G(this.fieldCtx, n) && Te(this.form, n), this.deferSyncValue(() => {
        if (!this.reloading) {
          if (e.parser.loadChildren !== !1) {
            const l = e.getPending("children", e.rule.children);
            m.trueArray(l) && l.forEach((u) => u && u.__fc__ && this.rmCtx(u.__fc__));
          }
          e.root === this.rules && this.vm.setupState.renderRule();
        }
      }, o);
      const a = this.sort.indexOf(r);
      return a > -1 && this.sort.splice(a, 1), this.$render.clearCache(e), e.delete(), this.effect(e, "deleted"), this.targetHook(e, "deleted"), o && !this.fieldCtx[n] && this.vm.emit("remove-field", n, e.rule, this.api), e.rule.__ctrl || this.vm.emit("remove-rule", e.rule, this.api), e;
    }
  });
}
function ai(t) {
  R(t.prototype, {
    mounted() {
      const e = () => {
        this.isMounted = !0, this.lifecycle("mounted");
      };
      this.pageEnd ? e() : this.bus.$once("page-end", e);
    },
    lifecycle(e) {
      this.fc.targetFormDriver(e, this.api, this.fc), this.vm.emit(e, this.api), this.emitEvent(e, this.api);
    },
    emitEvent(e, ...r) {
      const n = this.options[e] || this.options[le("on-" + e)];
      if (n) {
        const o = we(n);
        m.Function(o) && P(() => o(...r));
      }
      this.bus.$emit(e, ...r);
    },
    targetHook(e, r, n) {
      var l, u, f, d;
      let o = (u = (l = e.prop) == null ? void 0 : l.hook) == null ? void 0 : u[r], i = (p, h) => {
        p && (p = Array.isArray(p) ? p : [p], p.forEach((b) => {
          P(() => b(ae(D({ args: Object.values(n || {}) }, n || {}), { self: e.rule, rule: e.rule, parent: h == null ? void 0 : h.rule, $f: this.api, api: this.api, option: this.vm.props.option })));
        }));
      };
      i(o);
      let s = "deep" + Zt(r), a = e.parent;
      for (; a; ) {
        let p = (d = (f = a.prop) == null ? void 0 : f.hook) == null ? void 0 : d[s];
        i(p, a), a = a.parent;
      }
    }
  });
}
function li(t) {
  R(t.prototype, {
    useProvider() {
      const e = this.fc.providers;
      Object.keys(e).forEach((r) => {
        let n = e[r];
        m.Function(n) && (n = n(this.fc)), n._c = fi(n), this.onEffect(n, r), this.providers[r] = n;
      });
    },
    onEffect(e, r) {
      const n = [];
      (e._c || ["*"]).forEach((o) => {
        const i = o === "*" ? "*" : this.getType(o);
        n.indexOf(i) > -1 || (n.push(i), this.bus.$on(`p:${r || e.name}:${i}:${e.input ? 1 : 0}`, (s, a) => {
          e[s] && e[s](...a);
        }));
      }), e._used = n;
    },
    watchEffect(e) {
      let r = {
        required: () => {
          var n, o;
          return (G(e.rule, "$required") ? e.rule.$required : (o = (n = e.rule) == null ? void 0 : n.effect) == null ? void 0 : o.required) || !1;
        }
      };
      Object.keys(e.rule.effect || {}).forEach((n) => {
        r[n] = () => e.rule.effect[n];
      }), Object.keys(e.rule).forEach((n) => {
        n[0] === "$" && (r[n.substr(1)] = () => e.rule[n]);
      }), Object.keys(r).forEach((n) => {
        e.watch.push(ue(r[n], (o) => {
          this.effect(e, "watch", { [n]: o });
        }, { deep: !0 }));
      });
    },
    ruleEffect(e, r, n) {
      this.emitEffect({
        rule: e,
        input: !!e.field,
        type: this.getType(e.type)
      }, r, n);
    },
    effect(e, r, n) {
      this.emitEffect({
        rule: e.rule,
        input: e.input,
        type: e.trueType,
        ctx: e,
        custom: n
      }, r);
    },
    getEffect(e, r) {
      if (G(e, "$" + r))
        return e["$" + r];
      if (G(e, "effect") && G(e.effect, r))
        return e.effect[r];
    },
    emitEffect({ ctx: e, rule: r, input: n, type: o, custom: i }, s, a) {
      if (!o || ["fcFragment", "fragment"].indexOf(o) > -1) return;
      const l = i || Object.keys(r).reduce((u, f) => (f[0] === "$" && (u[f.substr(1)] = r[f]), u), D({}, r.effect || {}));
      Object.keys(l).forEach((u) => {
        const f = this.providers[u];
        if (!f || f.input && !n) return;
        let d;
        if (!f._c)
          d = "*";
        else if (f._used.indexOf(o) > -1)
          d = o;
        else
          return;
        const p = D({ value: l[u], getValue: () => this.getEffect(r, u) }, a || {});
        e && (p.getProp = () => e.effectData(u), p.clearProp = () => e.clearEffectData(u), p.mergeProp = (h) => Fe(p.getProp(), [h]), p.id = e.id), this.bus.$emit(`p:${u}:${d}:${f.input ? 1 : 0}`, s, [p, r, this.api]);
      });
    }
  });
}
function ui(t) {
  return t.filter(function(e, r, n) {
    return n.indexOf(e, 0) === r;
  });
}
function fi(t) {
  const e = t.components;
  if (Array.isArray(e)) {
    const r = ui(e.filter((n) => n !== "*"));
    return r.length ? r : !1;
  } else return m.String(e) ? [e] : !1;
}
function Se(t) {
  hr(this, {
    options() {
      return t.options.value || {};
    },
    bus() {
      return t.bus;
    },
    preview() {
      return t.vm.props.preview != null ? t.vm.props.preview : t.vm.setupState.parent && t.vm.setupState.parent.props.preview != null ? t.vm.setupState.parent.props.preview : t.options.value.preview || !1;
    }
  }), R(this, {
    fc: t,
    vm: t.vm,
    watching: !1,
    loading: !1,
    reloading: !1,
    noWatchFn: null,
    deferSyncFn: null,
    isMounted: !1,
    formData: _e({}),
    subRuleData: _e({}),
    subForm: {},
    form: _e({}),
    appendData: {},
    ignoreFields: [],
    providers: {},
    cycleLoad: null,
    loadedId: 1,
    nextTick: null,
    changeStatus: !1,
    pageEnd: !0,
    nextReload: () => {
      this.lifecycle("reload");
    }
  }), this.initData(t.rules), this.$manager = new t.manager(this), this.$render = new Ct(this), this.api = t.extendApiFn.reduce((e, r) => {
    const n = P(() => r(e, this));
    return n && n !== e && R(e, n), e;
  }, qn(this));
}
R(Se.prototype, {
  initData(t) {
    R(this, {
      ctxs: {},
      fieldCtx: {},
      nameCtx: {},
      sort: [],
      rules: t
    });
  },
  init() {
    this.updateAppendData(), this.useProvider(), this.usePage(), this.loadRule(), this.$manager.__init(), this.lifecycle("created");
  },
  updateAppendData() {
    this.appendData = D(D(D({}, Oe(this.options.formData || {})), this.fc.vm.props.modelValue || {}), this.appendData);
  },
  isBreakWatch() {
    return this.loading || this.noWatchFn || this.reloading;
  },
  globalBeforeFetch(t) {
    return new Promise((e, r) => {
      const n = this.options.beforeFetch && P(() => this.options.beforeFetch(t, { api: this.api }));
      n && m.Function(n.then) ? n.then(e).catch(r) : e();
    });
  },
  beforeFetch(t) {
    return new Promise((e, r) => {
      const n = t && t.beforeFetch && P(() => t.beforeFetch(t, { api: this.api }));
      n && m.Function(n.then) ? n.then(e).catch(r) : n === !1 ? r() : e();
    }).then(() => this.globalBeforeFetch(t));
  },
  beforeSubmit(t) {
    return new Promise((e, r) => {
      const n = this.options.beforeSubmit && P(() => this.options.beforeSubmit(t, { api: this.api }));
      n && m.Function(n.then) ? n.then(e).catch(r) : n === !1 ? r() : e();
    });
  }
});
Wn(Se);
Gn(Se);
Jn(Se);
Kn(Se);
ti(Se);
oi(Se);
ai(Se);
li(Se);
const ci = "fcFragment", ct = Be({
  name: ci,
  inheritAttrs: !1,
  props: ["vnode"],
  render() {
    return this.vnode;
  }
});
function di(t) {
  return Object.keys(t).map((e) => {
    const r = t[e], n = Br(e);
    if (n)
      return [
        n,
        r.value,
        r.arg,
        r.modifiers
      ];
  }).filter((e) => !!e);
}
function Ht(t, e) {
  let r = t.directives;
  return r ? (Array.isArray(r) || (r = [r]), Lr(e, r.reduce((n, o) => n.concat(di(o)), []))) : e;
}
function hi() {
  const t = {};
  function e(r) {
    this.vm = r.vm, this.handle = r;
  }
  return R(e.prototype, {
    make(r, n, o) {
      return Ht(n, this.h(r, Pt(n), o));
    },
    makeComponent(r, n, o) {
      try {
        return Ht(n, M(r, Pt(n), o));
      } catch (i) {
        return console.error(i), M("");
      }
    },
    h(r, n, o) {
      const s = (this.vm || mt()).appContext.config.isNativeTag(r), a = this.handle.fc.prop.components[r];
      !a && s && delete n.formCreateInject;
      try {
        return M(a || (s ? r : ye(r)), n, o);
      } catch (l) {
        return console.error(l), M("");
      }
    },
    aliasMap: t
  }), R(e, {
    aliasMap: t,
    alias(r, n) {
      t[r] = n;
    },
    use(r) {
      Object.keys(r).forEach((n) => {
        const o = We(n), i = Kt(n).toLocaleLowerCase(), s = r[n];
        e.alias(n, s), [n, o, i].forEach((a) => {
          e.prototype[a] = function(l, u) {
            return this.make(t[n] || a, l, u);
          };
        });
      });
    }
  }), e;
}
function pi(t) {
  class e extends $r {
  }
  return Object.assign(e.prototype, t), e;
}
function $r(t) {
  R(this, {
    $handle: t,
    vm: t.vm,
    options: {},
    ref: "fcForm",
    mergeOptionsRule: {
      normal: ["form", "row", "info", "submitBtn", "resetBtn"]
    }
  }), this.updateKey(), this.init();
}
R($r.prototype, {
  __init() {
    this.$render = this.$handle.$render, this.$r = (...t) => this.$render.renderRule(...t);
  },
  updateKey() {
    this.key = at();
  },
  //TODO interface
  init() {
  },
  update() {
  },
  beforeRender() {
  },
  form() {
    return this.vm.refs[this.ref];
  },
  adapterValidate(t, e) {
    return t.validator = (r, n, o) => e(n, o), t;
  },
  getSlot(t) {
    const e = (r) => {
      if (r) {
        let n = r.slots[t];
        return n || e(r.setupState.parent);
      }
    };
    return e(this.vm);
  },
  mergeOptions(t, e) {
    return De(t.map((r) => this.tidyOptions(r)), e, this.mergeOptionsRule);
  },
  updateOptions(t) {
    this.$handle.fc.targetFormDriver("updateOptions", t, { handle: this.$handle, api: this.$handle.api }), this.options = this.mergeOptions([t], this.getDefaultOptions()), this.update();
  },
  tidyOptions(t) {
    return t;
  },
  tidyRule(t) {
  },
  mergeProp(t) {
  },
  getDefaultOptions() {
    return {};
  },
  fieldChange(t, e, r, n) {
  },
  render(t) {
  }
});
const mi = function(t) {
  const e = {
    name: "loadData",
    _fn: [],
    loaded(r, n, o) {
      this.deleted(r), X(() => {
        let i = be(r.getValue());
        const s = [];
        i.forEach((a) => {
          if (a && (a.attr || a.template || a.handler)) {
            let l = (d) => {
              let p;
              n && n.__fc__ && (p = n.__fc__.getParentGroup());
              let h;
              a.template ? h = t.$handle.loadStrVar(a.template, d, p ? { rule: n, value: t.$handle.subRuleData[p.id] || {} } : null) : a.handler && m.Function(a.handler) ? h = a.handler(d, n, o) : h = t.$handle.loadStrVar(`{{${a.attr}}}`, d, p ? { rule: n, value: t.$handle.subRuleData[p.id] || {} } : null), (h == null || h === "") && a.default != null && (h = a.default), a.copy !== !1 && (h = Oe(h));
              const b = a.modify ? n : r.getProp();
              a.to === "child" ? b.children ? b.children[0] = h : b.children = [h] : Me(b, a.to || "options", h), o.sync(n);
            }, u = (d) => l(d);
            const f = t.watchLoadData(u);
            l = Ae(l, a.wait || 300), a.watch !== !1 ? s.push(f) : f();
          }
        }), this._fn[r.id] = s;
      });
    },
    deleted(r) {
      this._fn[r.id] && (this._fn[r.id].forEach((n) => {
        n();
      }), delete this._fn[r.id]), r.clearProp();
    }
  };
  return e.watch = e.loaded, e;
}, gi = function(t) {
  const e = {
    name: "t",
    _fn: [],
    loaded(r, n, o) {
      this.deleted(r);
      let i = r.getValue() || {};
      const s = [];
      Object.keys(i).forEach((a) => {
        const l = i[a];
        if (l) {
          const u = typeof l == "object";
          let f = (h) => {
            let b = t.t(u ? l.attr : l, u ? l.params : null, h);
            const S = u && l.modify ? n : r.getProp();
            a === "child" ? S.children ? S.children[0] = b : S.children = [b] : Me(S, a, b), o.sync(n);
          }, d = (h) => f(h);
          const p = t.watchLoadData(d);
          f = Ae(f, l.wait || 300), l.watch !== !1 ? s.push(p) : p();
        }
      }), this._fn[r.id] = s;
    },
    deleted(r) {
      this._fn[r.id] && (this._fn[r.id].forEach((n) => {
        n();
      }), delete this._fn[r.id]), r.clearProp();
    }
  };
  return e.watch = e.loaded, e;
}, vr = {
  name: "componentValidate",
  load(t, e, r) {
    let n = t.getValue();
    if (!n || n.method === !1)
      t.clearProp(), r.clearValidateState([e.field]);
    else {
      m.Object(n) || (n = { method: n });
      const o = n.method, i = ae(D({}, n), {
        validator(...s) {
          const a = ve(e);
          if (a)
            return r.exec(a.id, m.String(o) ? o : "formCreateValidate", ...s, {
              attr: t,
              rule: e,
              api: r
            });
        }
      });
      delete i.method, t.getProp().validate = [i];
    }
  },
  watch(...t) {
    vr.load(...t);
  }
}, yi = function(t) {
  function e(o) {
    return m.String(o) && (o = {
      action: o,
      to: "options"
    }), o;
  }
  function r(o, i, s) {
    let a = o.value;
    n.deleted(o), m.Function(a) && (a = a(i, s)), a = e(a);
    const l = (d) => {
      d === void 0 ? o.clearProp() : Me(o.getProp(), a.to || "options", d), d != null && a && a.key && t.$handle.options.globalData[a.key] && t.fetchCache.set(t.$handle.options.globalData[a.key], { status: !0, data: d }), s.sync(i);
    };
    if (!a || !a.action && !a.key) {
      l(void 0);
      return;
    }
    a = Oe(a), a.to || (a.to = "options");
    const u = a.onError, f = () => {
      if (!o.getValue())
        return o.clearProp(), s.sync(i), !0;
    };
    n._fn[o.id] = t.watchLoadData(Ae((d, p) => {
      if (p && a.watch === !1)
        return n._fn[o.id]();
      if (a.key) {
        t.targetRule = i;
        const S = d("$globalData." + a.key);
        if (delete t.targetRule, S) {
          if (f()) return;
          l(S);
        }
        return;
      }
      const h = t.$handle.loadFetchVar(Oe(a), d, i), b = ae(D({
        headers: {}
      }, h), {
        onSuccess(S, w) {
          if (f()) return;
          let j = (L) => w ? L : G(L, "data") ? L.data : L;
          const A = we(h.parse);
          m.Function(A) ? j = A : A && m.String(A) && (j = (L) => ie(L, A)), rt(j(S, i, s)).then((L) => {
            l(L);
          });
        },
        onError(S) {
          l(void 0), !f() && (u || ((w) => vt(w.message || "fetch fail " + h.action)))(S, i, s);
        }
      });
      t.$handle.beforeFetch(b, { rule: i, api: s }).then(() => {
        if (m.Function(h.action)) {
          rt(h.action(i, s)).then((S) => {
            b.onSuccess(S, !0);
          }).catch((S) => {
            b.onError(S);
          });
          return;
        }
        P(() => t.create.fetch(b, { inject: o, rule: i, api: s }));
      }).catch((S) => {
      });
    }, a.wait || 600));
  }
  const n = {
    name: "fetch",
    _fn: [],
    loaded(...o) {
      r(...o);
    },
    watch(...o) {
      r(...o);
    },
    deleted(o) {
      this._fn[o.id] && (this._fn[o.id](), delete this._fn[o.id]), o.clearProp();
    }
  };
  return n;
}, bi = {
  fetch: yi,
  loadData: mi,
  t: gi,
  componentValidate: vr
}, $i = "html", vi = {
  name: $i,
  loadChildren: !1,
  render(t, e) {
    return e.prop.props.innerHTML = t.default(), e.vNode.make(e.prop.props.tag || "div", e.prop);
  },
  renderChildren(t) {
    return {
      default: () => t.filter((e) => m.String(e)).join("")
    };
  }
};
function _i(t) {
  t = t + "=";
  const r = decodeURIComponent(document.cookie).split(";");
  for (let n = 0; n < r.length; n++) {
    let o = r[n];
    for (; o.charAt(0) === " "; )
      o = o.substring(1);
    if (o.indexOf(t) === 0) {
      o = o.substring(t.length, o.length);
      try {
        return JSON.parse(o);
      } catch (i) {
        return o;
      }
    }
  }
  return null;
}
function Oi(t) {
  const e = localStorage.getItem(t);
  if (e)
    try {
      return JSON.parse(e);
    } catch (r) {
      return e;
    }
  return null;
}
function wi(t) {
  const e = sessionStorage.getItem(t);
  if (e)
    try {
      return JSON.parse(e);
    } catch (r) {
      return e;
    }
  return null;
}
function Dt(t, e) {
  if (!e)
    return null;
  const r = e.split(".");
  let n = t(r.shift());
  return r.length ? n == null ? null : ie(n, r) : n;
}
function Si(t) {
  return Dt(_i, t);
}
function Ci(t) {
  return Dt(Oi, t);
}
function Di(t) {
  return Dt(wi, t);
}
const Fi = {
  en: {
    required: "{title} is required",
    validate: {
      url: "{title} is not a valid url",
      email: "{title} is not a valid email",
      ip: "{title} {title} is not a valid ip",
      phone: "{title} {title} is not a valid phone",
      pattern: "{title} does not match pattern {pattern}",
      uppercase: "{title} must be all uppercase",
      lowercase: "{title} must be all lowercased",
      positive: "{title} is not a positive number",
      negative: "{title} is not a negative number",
      equal: "{title} is not equal to {equal}",
      min: "{title} cannot be less than {min}",
      max: "{title} cannot be greater than {max}",
      enum: "{title} must be one of {enum}",
      hasKeys: "{title} does not contain required fields {hasKeys}",
      minLen: "{title} must be at least {minLen}",
      maxLen: "{title} cannot be longer than {maxLen}",
      len: "{title} must be exactly {len}",
      integer: "{title} is not an integer",
      number: "{title} is not an number"
    }
  },
  "zh-cn": {
    required: "{title}不能为空",
    validate: {
      url: "{title}不是有效的 url 地址",
      email: "{title}不是有效的邮箱地址",
      ip: "{title}不是有效的 IP 地址",
      phone: "{title}不是正确的手机号",
      pattern: "{title}必须匹配 {pattern}",
      uppercase: "{title}必须全大写",
      lowercase: "{title}必须全小写",
      positive: "{title}不是正数",
      negative: "{title}不是负数",
      equal: "{title}必须等于 {equal}",
      min: "{title}必须大于等于 {min}",
      max: "{title}必须小于等于 {max}",
      enum: "{title}必须是 {enum} 之一",
      hasKeys: "{title}必须包含 {hasKeys} 字段",
      minLen: "{title}长度必须大于 {minLen}",
      maxLen: "{title}长度必须小于 {maxLen}",
      len: "{title}长度必须为 {len}",
      integer: "{title}必须为整数",
      number: "{title}必须为数字"
    }
  }
};
function Ei(t, e) {
  let r;
  return arguments.length === 2 ? (r = arguments[1], e = r[t]) : r = arguments[2], { id: e, prop: r };
}
function dt() {
  return Ei("name", ...arguments);
}
function ki(t) {
  const e = t.key || [], r = t.array || [], n = t.normal || [];
  ir.push(...e), _t.push(...r), Ot.push(...n), gr([...e, ...r, ...n]);
}
let Ri = 1;
const de = {}, Wt = Symbol("defValue");
function _r(t) {
  const e = {
    [ct.name]: ct
  }, r = {}, n = {}, o = {}, i = {}, s = [], a = [], l = [
    t.extendApi
  ], u = D({}, bi), f = Nn();
  let d = { global: {} };
  const p = t.isMobile === !0, h = _e({
    $mobile: p
  }), b = hi(), S = {}, w = {};
  ki(t.attrs || {});
  function j(c) {
    const g = de[c];
    if (Array.isArray(g))
      return g.map((y) => y.api());
    if (g)
      return g.api();
  }
  function A(c) {
    s.push(c);
  }
  function L() {
    const c = dt(...arguments);
    c.id && c.prop && (n[c.id] = c.prop);
  }
  function te() {
    const c = dt(...arguments);
    c.id && c.prop && (u[c.id] = m.Function(c.prop) ? c.prop : ae(D({}, c.prop), {
      name: c.id
    }));
  }
  function ee(c) {
    b.use(c);
  }
  function Z(c) {
    if (arguments.length === 0)
      return He;
    if (typeof c == "string" && arguments.length === 1)
      return r[le(c)];
    const g = dt(...arguments);
    if (!g.id || !g.prop) return He;
    const y = le(g.id), $ = g.prop, k = $.merge === !0 ? r[y] : void 0;
    r[y] = Ke($, k || He), f[y] = he(y), $.maker && R(f, $.maker);
  }
  function N(c, g) {
    let y;
    if (m.String(c)) {
      if (y = c, g === void 0)
        return e[y];
    } else
      y = c.displayName || c.name, g = c;
    if (!y || !g) return;
    const $ = le(y);
    e[y] = g, e[$] = g, delete b.aliasMap[y], delete b.aliasMap[$], delete r[y], delete r[$], g.formCreateParser && Z(y, g.formCreateParser);
  }
  function B() {
    return Tn(Q, e, n);
  }
  function W(c, g) {
    const y = B();
    return xr({
      data() {
        return _e({
          rule: c,
          option: g
        });
      },
      render() {
        return Ye(y, D({ ref: "fc" }, this.$data));
      }
    });
  }
  function x() {
    return ct;
  }
  function I(c, g) {
    return m.Function(c.install) ? c.install(J, g) : m.Function(c) && c(J, g), this;
  }
  function J(c, g) {
    let y = W(c, g || {});
    s.forEach((q) => {
      P(() => q(J, y));
    });
    const $ = document.createElement("div");
    return ((g == null ? void 0 : g.el) || document.body).appendChild($), y.mount($).$refs.fc.fapi;
  }
  Ke(J, w);
  function ne(c) {
    let g = D({}, t);
    return c ? g.inherit = {
      components: e,
      parsers: r,
      directives: n,
      modelFields: o,
      providers: u,
      useApps: s,
      maker: f,
      formulas: S,
      loadData: h
    } : delete g.inherit, _r(g);
  }
  function F(c, g) {
    o[c] = g;
  }
  function O(c, g) {
    S[c] = g;
  }
  function v(c, g) {
    const y = i[c] || {}, $ = y.parsers || {};
    g.parsers && Object.keys(g.parsers).forEach((k) => {
      $[k] = Ke(g.parsers[k], He);
    }), g.name = c, i[c] = ae(D(D({}, y), g), { parsers: $ });
  }
  function C(c) {
    c && Object.keys(de).forEach((g) => {
      (Array.isArray(de[g]) ? de[g] : [de[g]]).forEach(($) => {
        $.bus.$emit("$loadData." + c);
      });
    });
  }
  function _(c, g) {
    Me(h, c, g), C(c);
  }
  function E(c, g) {
    const y = (...$) => P(() => g(...$));
    y._driver = !0, _(c, y);
  }
  function V(c, g) {
    const y = (c || "").split(".");
    c = y.shift();
    const $ = y.join(".");
    if (G(h, c) || (h[c] = Wt), h[c] !== Wt) {
      let k = h[c];
      return k && k._driver ? k = k($) : y.length && (k = ie(k, y)), k == null || k === "" ? g : k;
    } else
      return g;
  }
  function T(c) {
    l.push(c);
  }
  function H(c) {
    delete h[c], C(c);
  }
  function z(c, g) {
    a.push({ name: c, callback: g });
  }
  function Q(c) {
    R(this, {
      id: Ri++,
      create: J,
      vm: c,
      manager: pi(t.manager),
      parsers: r,
      providers: u,
      modelFields: o,
      formulas: S,
      isMobile: p,
      rules: c.props.rule,
      name: c.props.name || at(),
      inFor: c.props.inFor,
      prop: {
        components: e,
        directives: n
      },
      get: null,
      drivers: i,
      renderDriver: null,
      refreshData: C,
      loadData: h,
      CreateNode: b,
      bus: new Qt(),
      //使用 Set 保存,停止侦听时可以自行摘除,避免长期运行下无限堆积
      unwatch: /* @__PURE__ */ new Set(),
      options: Nr({}),
      extendApiFn: l,
      fetchCache: /* @__PURE__ */ new WeakMap(),
      tmpData: _e({})
    }), this.unwatch.push = this.unwatch.add, a.forEach((g) => {
      this.bus.$on(g.name, g.callback);
    }), X(() => {
      ue(this.options, () => {
        this.$handle.$manager.updateOptions(this.options.value), this.api().refresh();
      }, { deep: !0 });
    }), R(c.appContext.components, e), R(c.appContext.directives, n), this.$handle = new Se(this), this.name && (this.inFor ? (de[this.name] || (de[this.name] = []), de[this.name].push(this)) : de[this.name] = this);
  }
  Q.isMobile = p, R(Q.prototype, {
    init() {
      this.isSub() && this.unwatch.add(ue(() => this.vm.setupState.parent.setupState.fc.options.value, () => {
        this.initOptions(), this.$handle.api.refresh();
      }, { deep: !0, flush: "sync" })), this.vm.props.driver && (this.renderDriver = typeof this.vm.props.driver == "object" ? this.vm.props.driver : this.drivers[this.vm.props.driver]), !this.renderDriver && this.vm.setupState.parent && (this.renderDriver = this.vm.setupState.parent.setupState.fc.renderDriver), this.renderDriver || (this.renderDriver = this.drivers.default), this.initOptions(), this.$handle.init();
    },
    targetFormDriver(c, ...g) {
      if (this.bus.$emit(c, ...g), this.renderDriver && this.renderDriver[c])
        return P(() => this.renderDriver[c](...g));
    },
    t(c, g, y) {
      let $ = y ? y("$t." + c) : this.globalLanguageDriver(c);
      return $ == null && ($ = ""), $ && g && Object.keys(g).forEach((k) => {
        const q = new RegExp(`{${k}}`, "g");
        $ = $.replace(q, g[k]);
      }), $;
    },
    globalDataDriver(c) {
      let g = c.split(".");
      const y = g.shift(), $ = this.options.value.globalData && this.options.value.globalData[y];
      if ($) {
        if ($.type === "static")
          return ie($.data, g);
        {
          let k;
          const q = this.fetchCache.get($);
          if (q) {
            if (q.status && (k = ie(q.data, g)), !q.loading)
              return k;
            q.loading = !1, this.fetchCache.set($, q);
          } else
            this.fetchCache.set($, { status: !1 });
          const U = Ae(() => {
            me();
            const oe = this.fetchCache.get($);
            this.options.value.globalData && Object.values(this.options.value.globalData).indexOf($) !== -1 ? (oe && (oe.loading = !0, this.fetchCache.set($, oe)), this.bus.$emit("$loadData.$globalData." + y)) : this.fetchCache.delete($);
          }, $.wait || 600), ce = (oe) => {
            this.fetchCache.set($, { status: !0, data: oe }), this.bus.$emit("$loadData.$globalData." + y);
          }, pe = (oe, ge) => {
            if (ge && $.watch === !1)
              return me();
            if (ge) {
              U();
              return;
            }
            const Ee = this.$handle.loadFetchVar(gt($), oe);
            Ee.targetRule = this.targetRule, this.$handle.api.fetch(Ee).then((ke) => {
              ce(ke);
            }).catch((ke) => {
              ce(null);
            });
          }, me = this.watchLoadData(pe);
          return $.watch === !1 && me(), k;
        }
      }
    },
    getLocale() {
      let c = this.vm.setupState.top.props.locale;
      return c && typeof c == "object" ? c.name : typeof c == "string" ? c : "zh-cn";
    },
    globalLanguageDriver(c) {
      let g = this.vm.setupState.top.props.t, y = this.vm.setupState.top.props.locale, $;
      if (g && ($ = P(() => g(c))), $ == null && y && typeof y == "object" && ($ = ie(y, c)), $ == null) {
        const k = this.options.value.language || {}, q = this.getLocale();
        $ = ie(k[q] || {}, c), $ == null && ($ = ie(Fi[q] || {}, c));
      }
      return $;
    },
    globalVarDriver(c) {
      let g = c.split(".");
      const y = g.shift(), $ = this.options.value.globalVariable && this.options.value.globalVariable[y];
      if ($) {
        const k = m.Function($) ? $ : we($.handle);
        if (k) {
          let q = k((...U) => this.$handle.api.getData(...U), this.$handle.api);
          return ie(q, g);
        }
      }
    },
    setData(c, g, y) {
      y ? _(c, g) : (Me(this.vm.setupState.top.setupState.fc.tmpData, c, g), this.bus.$emit("$loadData." + c));
    },
    getLoadData(c, g) {
      let y = null;
      if (c != null) {
        let $ = c.split(".");
        const k = $.shift();
        if (y = ie(this.vm.setupState.top.setupState.fc.tmpData, c), y != null)
          return y;
        if (k === "$topForm")
          y = this.$handle.api.top.formData(!0);
        else if (k === "$scopeForm")
          y = this.$handle.api.scope.formData(!0);
        else if (k === "$form")
          y = this.$handle.api.formData(!0);
        else if (k === "$options")
          y = this.options.value;
        else if (k === "$globalData")
          y = this.globalDataDriver($.join(".")), $ = [];
        else if (k === "$var")
          y = this.globalVarDriver($.join(".")), $ = [];
        else if (k === "$locale")
          y = this.getLocale(), $ = [];
        else if (k === "$t")
          y = this.globalLanguageDriver($.join(".")), $ = [];
        else {
          if (k === "$preview")
            return this.$handle.preview;
          y = V(c), $ = [];
        }
        y && $.length && (y = ie(y, $));
      }
      return y == null || y === "" ? g : y;
    },
    watchLoadData(c, g) {
      let y = {};
      const $ = (U) => {
        this.get || (this.get = k), P(() => {
          c(k, U);
        }), this.get === k && (this.get = void 0);
      }, k = (U, ce) => {
        let pe;
        if (typeof U == "object" && (pe = U.getValue, U = U.id), y[U])
          return y[U].val;
        const me = Ne(() => pe ? pe() : this.getLoadData(U, ce)), oe = U.split("."), ge = oe.shift(), Ee = oe.shift() || "", ke = Ae(() => {
          const Ie = pe ? pe() : this.getLoadData(U, ce);
          if (y[U])
            ((Ie instanceof Function || m.Object(Ie) || Array.isArray(Ie)) && Ie === y[U].val || JSON.stringify(Ie) !== JSON.stringify(y[U].val)) && (y[U].val = Ie, $(!0));
          else return;
        }, g || 0), Sr = ue(me, (Ie) => {
          ke();
        });
        return this.bus.$on("$loadData." + ge, ke), Ee && this.bus.$on("$loadData." + ge + "." + Ee, ke), y[U] = {
          fn: () => {
            this.bus.$off("$loadData." + ge, ke), Ee && this.bus.$off("$loadData." + ge + "." + Ee, ke), Sr();
          },
          val: me.value
        }, me.value;
      };
      $(!1);
      const q = () => {
        Object.keys(y).forEach((U) => y[U].fn()), y = {}, this.unwatch.delete(q);
      };
      return this.unwatch.add(q), q;
    },
    isSub() {
      return this.vm.setupState.parent && this.vm.props.extendOption;
    },
    initOptions() {
      this.options.value = {};
      let c = D({
        formData: {},
        submitBtn: {},
        resetBtn: {},
        globalEvent: {},
        globalData: {}
      }, Oe(d));
      const g = this.isSub();
      g && (c = this.mergeOptions(c, this.vm.setupState.parent.setupState.fc.options.value || {}, !0)), c = this.mergeOptions(c, this.vm.props.option);
      const y = this.api();
      this.targetFormDriver("initOptions", c, { api: y, isSubForm: g }), this.updateOptions(c);
    },
    mergeOptions(c, g, y) {
      return g = D({}, g || {}), y && ["page", "onSubmit", "onReset", "onCreated", "onChange", "onMounted", "mounted", "beforeUnmount", "beforeSubmit", "onBeforeUnmount", "onReload", "reload", "formData", "el", "globalClass", "style"].forEach(($) => {
        delete g[$];
      }), g.global && (c.global = Rn(c.global, g.global), delete g.global), this.$handle.$manager.mergeOptions([g], c), c;
    },
    updateOptions(c) {
      this.options.value = this.mergeOptions(this.options.value, c), this.$handle.$manager.updateOptions(this.options.value), this.bus.$emit("$loadData.$options");
    },
    api() {
      return this.$handle.api;
    },
    render() {
      return this.$handle.render();
    },
    mounted() {
      this.$handle.mounted();
    },
    unmount() {
      if (P(() => this.$handle.lifecycle("beforeUnmount")), this.name)
        if (this.inFor) {
          const c = de[this.name].indexOf(this);
          de[this.name].splice(c, 1);
        } else
          delete de[this.name];
      a.forEach((c) => {
        this.bus.$off(c.name, c.callback);
      }), this.tmpData = {}, [...this.unwatch].forEach((c) => c()), this.unwatch.clear(), this.$handle.reloadRule([]);
    },
    updated() {
      this.$handle.bindNextTick(() => this.bus.$emit("next-tick", this.$handle.api));
    }
  });
  function re(c) {
    R(c, {
      version: t.version,
      ui: t.ui,
      isMobile: p,
      extendApi: T,
      getData: V,
      setDataDriver: E,
      setData: _,
      removeData: H,
      refreshData: C,
      maker: f,
      component: N,
      directive: L,
      setModelField: F,
      setFormula: O,
      setDriver: v,
      register: te,
      $vnode: x,
      parser: Z,
      use: I,
      factory: ne,
      componentAlias: ee,
      copyRule: cr,
      copyRules: dr,
      mergeRule: Fe,
      fetch: yr,
      $form: B,
      parseFn: we,
      parseJson: er,
      toJson: Ge,
      useApp: A,
      getApi: j,
      on: z
    });
  }
  function $e(c) {
    R(c, {
      create: J,
      install(g, y) {
        d = D(D({}, d), y || {});
        const $ = `_installedFormCreate${p ? "Mobile" : ""}_${t.ui}`;
        if (g[$] === !0) return;
        g[$] = !0;
        const k = function(U, ce = {}) {
          return J(U, ce);
        };
        re(k), g.config.globalProperties.$formCreate = k;
        const q = B();
        g.component(q.name, q), s.forEach((U) => {
          P(() => U(c, g));
        });
      }
    });
  }
  if (re(w), $e(w), E("$cookie", Si), E("$localStorage", Ci), E("$sessionStorage", Di), b.use({ fragment: "fcFragment" }), t.install && J.use(t), A((c, g) => {
    g.mixin({
      props: ["formCreateInject"],
      emits: ["fc.updateValue", "fc.el"]
    });
  }), Z(vi), t.inherit) {
    const c = t.inherit;
    c.components && R(e, c.components), c.parsers && R(r, c.parsers), c.directives && R(n, c.directives), c.modelFields && R(o, c.modelFields), c.providers && R(u, c.providers), c.useApps && R(s, c.useApps), c.maker && R(f, c.maker), c.loadData && R(h, c.loadData), c.formulas && R(S, c.formulas);
  }
  const se = B();
  return Ke(se, w), Object.defineProperties(se, {
    fetch: {
      get() {
        return w.fetch;
      },
      set(c) {
        w.fetch = c;
      }
    }
  }), se.util = w, se;
}
const ht = "hidden", Vi = {
  name: ht,
  maker: {
    [ht]: (t, e) => he(ht)("", t, e)
  },
  render() {
    return [];
  }
}, Gt = "slider", Ai = {
  name: Gt,
  maker: {
    sliderRange: he(Gt, { range: !0 })
  },
  toFormValue(t, e) {
    let r = Array.isArray(t), n = e.prop.props, o = n.min || 0, i;
    return n.range === !0 ? i = r ? t : [o, parseFloat(t) || o] : i = r ? parseFloat(t[0]) || o : parseFloat(t), i;
  }
}, ji = {
  name: "FcRow",
  render(t, e) {
    return e.vNode.col({ props: { span: 12 } }, {
      default: () => [
        e.vNode.row(e.prop, t)
      ]
    });
  }
}, Ft = {
  name: "checkbox",
  mergeProp(t) {
    const e = t.prop.props;
    G(e, "options") || (e.options = t.prop.options || []);
  }
}, Mi = "select", Pi = ae(D({}, Ft), {
  name: Mi,
  toFormValue(t, e) {
    return e.prop.props.multiple && !Array.isArray(t) ? be(t) : t;
  }
}), Ii = ae(D({}, Ft), {
  name: "radio"
}), Ti = {
  name: "tree",
  mergeProp(t) {
    t.prop.props.checkable = !0;
  }
}, Li = [
  Vi,
  Ii,
  Ft,
  Ti,
  Ai,
  ji,
  Pi
], Y = "t", Bi = {
  button: Y + "Button",
  icon: Y + "Icon",
  slider: Y + "Slider",
  upload: "fcUpload",
  cascader: Y + "Cascader",
  autoComplete: Y + "AutoComplete",
  auto: Y + "AutoComplete",
  popup: Y + "Popup",
  tooltip: Y + "Tooltip",
  colorPicker: Y + "ColorPicker",
  dateRangePicker: Y + "DateRangePicker",
  datePicker: Y + "DatePicker",
  timePicker: Y + "TimePicker",
  timeRangePicker: Y + "TimeRangePicker",
  switch: Y + "Switch",
  select: Y + "Select",
  checkbox: Y + "CheckboxGroup",
  radio: Y + "RadioGroup",
  inputNumber: Y + "InputNumber",
  number: Y + "InputNumber",
  input: Y + "Input",
  rate: Y + "Rate",
  rangeInput: Y + "RangeInput",
  tagInput: Y + "TagInput",
  textarea: Y + "Textarea",
  formItem: Y + "FormItem",
  form: Y + "Form",
  frame: "fcFrame",
  col: Y + "Col",
  row: Y + "Row",
  treeSelect: Y + "TreeSelect",
  transfer: Y + "Transfer",
  tree: Y + "Tree",
  group: "fcGroup",
  array: "fcGroup",
  object: "fcSubForm",
  subForm: "fcSubForm"
};
function Ni() {
  return {
    form: {
      layout: "vertical",
      labelAlign: "right",
      labelWidth: "125px"
    },
    row: {
      show: !0,
      gutter: 0
    },
    submitBtn: {
      theme: "primary",
      loading: !1,
      disabled: !1,
      innerText: "",
      show: !0,
      col: void 0,
      click: void 0
    },
    resetBtn: {
      theme: "default",
      loading: !1,
      disabled: !1,
      innerText: "",
      show: !1,
      col: void 0,
      click: void 0
    },
    info: {
      type: "popup",
      render: "html"
    }
  };
}
function zt(t, e) {
  G(t, e) && m.String(t[e]) && (t[e] = { [e]: t[e], show: !0 });
}
function Ce(t) {
  return t === !1;
}
function xi(t) {
  return t.render === "text" || t.render === "innerText";
}
function qi(t) {
  return {
    type: "div",
    props: { innerHTML: t == null ? "" : String(t) }
  };
}
function Ui(t, e) {
  G(t, e) && !m.Object(t[e]) && (t[e] = { show: !!t[e] });
}
function pt(t) {
  const e = D({}, t);
  return delete e.children, e;
}
const Yi = {
  validate(t) {
    return new Promise((e, r) => {
      const n = this.form();
      if (n)
        return n.validate(t).then((o) => {
          o === !0 ? e(o) : r(o);
        }).catch((o) => {
        });
      e(!0);
    });
  },
  validateField(t) {
    return this.validate({ fields: [t] });
  },
  clearValidateState(t) {
    const e = this.form();
    if (e)
      return e.clearValidate(t);
  },
  tidyOptions(t) {
    return ["submitBtn", "resetBtn", "row", "info", "wrap", "col", "title"].forEach((e) => {
      Ui(t, e);
    }), t;
  },
  tidyRule({ prop: t }) {
    return zt(t, "title"), zt(t, "info"), t;
  },
  mergeProp(t) {
    const e = {
      info: {
        type: "popup",
        render: "html",
        placement: "top-left",
        showArrow: !0,
        icon: "QuestionCircleOutlined"
      },
      title: {},
      col: { span: 12 },
      wrap: {}
    };
    ["info", "wrap", "col", "title"].forEach((r) => {
      t.prop[r] = De([this.options[r] || {}, t.prop[r] || {}], e[r]);
    });
  },
  getDefaultOptions() {
    return Ni();
  },
  adapterValidate(t, e) {
    return t.validator = (r) => new Promise((n) => e(r, (i) => {
      n(i ? { message: i } : { result: !0 });
    })), t;
  },
  update() {
    const t = this.options.form;
    this.rule = {
      props: D({}, t),
      on: {
        submit: (e) => {
          e.preventDefault && e.preventDefault();
        }
      },
      style: t.style,
      type: "form"
    };
  },
  beforeRender() {
    const { key: t, ref: e, $handle: r } = this, n = this.options.form;
    R(this.rule, { key: t, ref: e, class: [n.className, n.class, "form-create", this.$handle.preview ? "is-preview" : ""] }), R(this.rule.props, {
      data: r.formData
    });
  },
  render(t) {
    return t.slotLen() && !this.$handle.preview && t.setSlot(void 0, () => this.makeFormBtn()), this.$r(this.rule, Ce(this.options.row.show) ? t.getSlots() : [this.makeRow(t)]);
  },
  makeWrap(t, e) {
    const r = t.prop, n = `${this.key}${t.key}`, o = r.col, i = this.isTitle(r) && r.wrap.title !== !1, s = !(o != null && o.labelWidth) && !i ? 0 : o == null ? void 0 : o.labelWidth, { layout: a, col: l } = this.rule.props, u = r.wrap.class;
    delete r.wrap.class, delete r.wrap.title;
    let f;
    return (m.Undef(r.wrap.show) ? !t.input : Ce(r.wrap.show)) ? f = e : f = this.$r(De([r.wrap, {
      props: ae(D({
        labelWidth: s === void 0 ? s : Kt(s)
      }, pt(r.wrap || {})), {
        name: t.id,
        rules: r.validate,
        label: i ? () => this.makeInfo(r, n, t) : void 0
      }),
      class: this.$render.mergeClass(u || r.className, "fc-form-item"),
      key: `${n}fi`,
      ref: t.wrapRef,
      type: "formItem"
    }]), { default: () => e }), a === "inline" || Ce(l) || Ce(o.show) ? f : this.makeCol(r, n, [f]);
  },
  isTitle(t) {
    if (this.options.form.title === !1) return !1;
    const e = t.title;
    return !(!e.title && !e.native || Ce(e.show));
  },
  makeInfo(t, e, r) {
    var u, f, d, p, h, b;
    const n = D({}, t.title), o = D({}, t.info), i = this.options.form, s = this.getSlot("title"), a = [s ? s({ title: (f = (u = r.refRule) == null ? void 0 : u.__$title) == null ? void 0 : f.value, rule: r.rule, options: this.options }) : ((p = (d = r.refRule) == null ? void 0 : d.__$title) == null ? void 0 : p.value) + (i.labelSuffix || i["label-suffix"] || "")];
    if (!Ce(o.show) && (o.info || o.native) && !Ce(o.icon)) {
      const S = {
        type: o.type || "popup",
        props: pt(o),
        key: `${e}pop`
      };
      delete S.props.icon, delete S.props.show, delete S.props.info, delete S.props.align, delete S.props.native, delete S.props.render;
      const w = "content";
      if (o.info && !G(S.props, w)) {
        const j = (b = (h = r.refRule) == null ? void 0 : h.__$info) == null ? void 0 : b.value;
        S.props[w] = xi(o) ? j == null ? "" : String(j) : () => this.$r(qi(j));
      }
      a[o.align !== "left" ? "unshift" : "push"](this.$r(De([o, S]), {
        [n.slot || "default"]: () => this.$r({
          type: o.icon === !0 ? "QuestionCircleOutlined" : o.icon || "",
          key: `${e}i`
        })
      }));
    }
    const l = De([n, {
      props: pt(n),
      key: `${e}tit`,
      class: "fc-form-title",
      type: n.type || "span",
      on: {
        click: (...S) => {
          this.$handle.targetHook(r, "titleClick", { args: S });
        }
      }
    }]);
    return delete l.props.show, delete l.props.title, delete l.props.native, this.$r(l, a);
  },
  makeCol(t, e, r) {
    const n = D({}, t.col);
    return delete n.show, this.$r({
      class: this.$render.mergeClass(n.class, "fc-form-col"),
      type: "col",
      props: n || { span: 12 },
      key: `${e}col`
    }, r);
  },
  makeRow(t) {
    const e = this.options.row || {};
    return this.$r({
      type: "row",
      props: e,
      class: this.$render.mergeClass(e.class, "fc-form-row"),
      key: `${this.key}row`
    }, t);
  },
  makeFormBtn() {
    let t = [];
    if (Ce(this.options.submitBtn.show) || t.push(this.makeSubmitBtn()), Ce(this.options.resetBtn.show) || t.push(this.makeResetBtn()), !t.length)
      return;
    const e = this.$r({
      type: "formItem",
      class: "fc-form-item",
      props: {
        label: this.rule.props.layout === "inline" ? "" : " "
      },
      key: `${this.key}fb`
    }, t);
    return this.rule.props.layout === "inline" ? e : this.$r({
      type: "col",
      class: "fc-form-col fc-form-footer",
      props: { span: 12 },
      key: `${this.key}fc`
    }, [e]);
  },
  makeResetBtn() {
    const t = D({}, this.options.resetBtn), e = t.innerText || this.$handle.api.t("reset") || "重置";
    return delete t.innerText, delete t.click, delete t.col, delete t.show, this.$r({
      type: "button",
      props: t,
      class: "fc-reset-btn",
      style: { width: t.width, marginLeft: "10px" },
      on: {
        click: () => {
          const r = this.$handle.api;
          this.options.resetBtn.click ? this.options.resetBtn.click(r) : r.resetFields();
        }
      },
      key: `${this.key}b2`
    }, [e]);
  },
  makeSubmitBtn() {
    const t = D({}, this.options.submitBtn), e = t.innerText || this.$handle.api.t("submit") || "提交";
    return delete t.innerText, delete t.click, delete t.col, delete t.show, this.$r({
      type: "button",
      props: t,
      class: "fc-submit-btn",
      style: { width: t.width },
      on: {
        click: () => {
          const r = this.$handle.api;
          this.options.submitBtn.click ? this.options.submitBtn.click(r) : r.submit().catch(() => {
          });
        }
      },
      key: `${this.key}b1`
    }, [e]);
  }
}, Pe = {};
Hi(Pe);
Wi(Pe);
Gi(Pe);
zi(Pe);
Ji(Pe);
Qi(Pe);
function Hi(t) {
  ["group", "tree", "treeSelect", "switch", "upload", "cascader", "autoComplete", "rangeInput", "transfer", "tagInput", "colorPicker", "datePicker", "dateRangePicker", "timePicker", "timeRangePicker", "textarea", "input", "frame", "inputNumber"].forEach((e) => {
    t[e] = he(e);
  }), t.auto = t.autoComplete, t.number = t.inputNumber, t.color = t.colorPicker, t.date = t.datePicker, t.dateRange = t.dateRangePicker, t.time = t.timePicker, t.timeRange = t.timeRangePicker, t.tag = t.tagInput;
}
function Wi(t) {
  t.treeSelectMultiple = he("treeSelect", { multiple: !0 });
}
function Gi(t) {
  ["password", "url", "text", "tel"].reduce((e, r) => (e[r] = he("input", { type: r }), e), t);
}
function zi(t) {
  const e = "select", r = "multiple";
  t.selectMultiple = he(e, { [r]: !0 }), t.selectOne = he(e, { [r]: !1 });
}
function Ji(t) {
  const e = "upload", r = {
    image: ["image", 0],
    file: ["file", 0],
    uploadFileOne: ["file", 1],
    uploadImageOne: ["image", 1]
  };
  Object.keys(r).reduce((n, o) => (n[o] = he(e, (i) => i.props({ uploadType: r[o][0], max: r[o][1] })), n), t), t.uploadImage = t.image, t.uploadFile = t.file;
}
function Qi(t) {
  const e = {
    frameInputs: ["input", 0],
    frameFiles: ["file", 0],
    frameImages: ["image", 0],
    frameInputOne: ["input", 1],
    frameFileOne: ["file", 1],
    frameImageOne: ["image", 1]
  };
  return Object.keys(e).reduce((r, n) => (r[n] = he("frame", (o) => o.props({ type: e[n][0], maxLength: e[n][1] })), r), t), t.frameInput = t.frameInputs, t.frameFile = t.frameFiles, t.frameImage = t.frameImages, t;
}
function Jt(t, e) {
  return m.Boolean(t) ? t = { show: t } : !m.Undef(t) && !m.Object(t) && (t = { show: e }), t;
}
function Ki(t, e) {
  return {
    formEl() {
      return e.$manager.form();
    },
    wrapEl(r) {
      const n = e.getFieldCtx(r);
      if (n)
        return e.vm.refs[n.wrapRef];
    },
    validate(r) {
      return new Promise((n, o) => {
        const i = t.children, s = [e.$manager.validate()];
        i.filter((a) => !a.isScope).forEach((a) => {
          s.push(a.validate());
        }), Promise.all(s).then(() => {
          n(!0), r && r(!0);
        }).catch((a) => {
          o(a), r && r(a), e.vm.emit("validate-fail", a, { api: t }), e.emitEvent("validate-fail", a, { api: t });
        });
      });
    },
    validateField(r, n) {
      return new Promise((o, i) => {
        const a = typeof r == "object" ? ve(r) : e.getCtx(r);
        if (!a) {
          o(null), n && n(null);
          return;
        }
        const l = e.subForm[a.id], u = [e.$manager.validateField(a.id)];
        be(l).filter((f) => !f.isScope).forEach((f) => {
          u.push(f.validate());
        }), Promise.all(u).then(() => {
          o(!0), n && n(!0);
        }).catch((f) => {
          i(f), n && n(f), e.vm.emit("validate-field-fail", f, { field: r, api: t });
        });
      });
    },
    validateFields(r, n) {
      return new Promise((o, i) => {
        Array.isArray(r) || (r = [r]);
        const s = r.map((a) => t.validateField(a));
        Promise.all(s).then(() => {
          o(null), n && n(null);
        }).catch((a) => {
          i(a), n && n(a);
        });
      });
    },
    clearValidateState(r, n = !0) {
      let o = [];
      t.helper.tidyFields(r).forEach((i) => {
        n && this.clearSubValidateState(i), r && (o = o.concat(e.getCtxs(i).map((s) => s.id)));
      }), r && o.length ? e.$manager.clearValidateState(o) : r || e.$manager.clearValidateState();
    },
    clearSubValidateState(r) {
      t.helper.tidyFields(r).forEach((n) => {
        e.getCtxs(n).forEach((o) => {
          const i = e.subForm[o.id];
          i && (Array.isArray(i) ? i.forEach((s) => {
            s.clearValidateState();
          }) : i && i.clearValidateState());
        });
      });
    },
    btn: {
      loading: (r = !0) => {
        t.submitBtnProps({ loading: !!r });
      },
      disabled: (r = !0) => {
        t.submitBtnProps({ disabled: !!r });
      },
      show: (r = !0) => {
        t.submitBtnProps({ show: !!r });
      }
    },
    resetBtn: {
      loading: (r = !0) => {
        t.resetBtnProps({ loading: !!r });
      },
      disabled: (r = !0) => {
        t.resetBtnProps({ disabled: !!r });
      },
      show: (r = !0) => {
        t.resetBtnProps({ show: !!r });
      }
    },
    submitBtnProps: (r = {}) => {
      let n = Jt(e.options.submitBtn, !0);
      R(n, r), e.options.submitBtn = n, t.refreshOptions();
    },
    resetBtnProps: (r = {}) => {
      let n = Jt(e.options.resetBtn, !1);
      R(n, r), e.options.resetBtn = n, t.refreshOptions();
    },
    submit(r, n) {
      return new Promise((o, i) => {
        (e.options.validateOnSubmit === !1 ? Promise.resolve() : t.validate()).then(() => {
          let a = t.formData();
          e.beforeSubmit(a).then(() => {
            m.Function(r) && P(() => r(a, t)), m.Function(e.options.onSubmit) && P(() => e.options.onSubmit(a, t)), e.vm.emit("submit", a, t), o(a);
          }).catch((l) => {
          });
        }).catch((...a) => {
          m.Function(n) && P(() => n(t, ...a)), i(...a);
        });
      });
    }
  };
}
const Or = {
  name: "required",
  load(t, e, r) {
    const n = Zi(t.getValue());
    let o;
    if (n.required === !1)
      t.clearProp(), r.clearValidateState([e.field]);
    else {
      const i = D({
        trigger: "change",
        validator(a) {
          return s(), !m.empty(a);
        }
      }, n), s = () => {
        var l;
        const a = (l = e.__fc__.refRule.__$title) == null ? void 0 : l.value;
        if (o !== a)
          if (o = a, !n.message)
            i.message = r.t("required", { title: a }) || a + (r.getLocale() === "en" ? " is required" : "不能为空");
          else {
            const u = n.message.match(/^\{\{\s*\$t\.(.+)\s*\}\}$/);
            u && (i.message = r.t(u[1], { title: a }));
          }
      };
      s(), t.getProp().validate = [i];
    }
    r.sync(e);
  },
  watch(...t) {
    Or.load(...t);
  }
};
function Zi(t) {
  return m.Boolean(t) ? { required: t } : m.String(t) ? { message: t } : m.Undef(t) ? { required: !1 } : m.Function(t) ? { asyncValidator: t } : m.Object(t) ? t : {};
}
function Xi(t) {
  t.componentAlias(Bi), vn.forEach((e) => {
    t.component(e.name, e);
  }), t.register(Or), Li.forEach((e) => {
    t.parser(e);
  }), Object.keys(Pe).forEach((e) => {
    t.maker[e] = Pe[e];
  });
}
function es() {
  return _r({
    ui: "tdesign",
    version: "3.3.6",
    manager: Yi,
    extendApi: Ki,
    install: Xi,
    attrs: {
      normal: ["col", "wrap"],
      array: ["className"],
      key: ["title", "info"]
    }
  });
}
const wr = es();
typeof window != "undefined" && (window.formCreate = wr);
const ns = wr.maker;
export {
  wr as default,
  ns as maker
};