var Nn = Object.defineProperty; var fr = (t) => { throw TypeError(t); }; var Tn = (t, e, r) => e in t ? Nn(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r; var N = (t, e, r) => Tn(t, typeof e != "symbol" ? e + "" : e, r), yr = (t, e, r) => e.has(t) || fr("Cannot " + r); var d = (t, e, r) => (yr(t, e, "read from private field"), r ? r.call(t) : e.get(t)), v = (t, e, r) => e.has(t) ? fr("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, r), K = (t, e, r, n) => (yr(t, e, "write to private field"), n ? n.call(t, r) : e.set(t, r), r); import { jsx as m, jsxs as I } from "react/jsx-runtime"; import E, { useEffect as z, useState as L, useCallback as H, useRef as J, useContext as de, useMemo as W, useId as Lt, isValidElement as On, useLayoutEffect as Rn, Suspense as Fn } from "react"; import ue from "pathe"; import C from "prop-types"; import j from "classnames"; import { useNotification as jn } from "rc-notification"; import w from "lodash"; import { useMountedState as An, useDeepCompareEffect as Yt, useUpdateEffect as Gt, usePrevious as Fr } from "react-use"; import ie, { Field as Xt, FieldContext as jr } from "rc-field-form"; import { _ as wr, C as Zt, L as In, M as Rt, N as Xe, b as Le, s as Vt, c as Ln, S as Vn } from "./vender-CIG7ep61.js"; import Dn from "rc-util/lib/hooks/useMergedState"; import Ar from "immutability-helper"; import { Space as Dt, Form as ft, Input as Mn, Button as wt, Pagination as Bn, Tree as Un, Breadcrumb as Wn, Empty as Mt, Table as br, Popover as zn, Popconfirm as qn, Tooltip as Kn, Divider as _n } from "antd"; import { useMergedState as Jn } from "rc-util"; import { generatePath as Hn, useInRouterContext as Ir, useParams as Yn, useLocation as Gn, createBrowserRouter as Xn, Navigate as Zn } from "react-router-dom"; import Qn from "rc-drawer"; import ei from "rc-dialog"; import * as Cr from "react-is"; var ze, Qe, qe, xe, Ve, De; class ti { constructor(e, r) { v(this, ze, /* @__PURE__ */ new Map()); v(this, Qe, !0); v(this, qe, []); v(this, xe); v(this, Ve, () => d(this, xe)); v(this, De, () => Promise.resolve()); N(this, "get", (...e) => new Promise((r, n) => { const i = JSON.stringify(e); if (d(this, ze).has(i)) return r(d(this, De).call(this, d(this, xe), ...e)); if (d(this, xe) === void 0) d(this, qe).push([e, r, n]), d(this, Qe) && (K(this, Qe, !1), Promise.resolve(typeof d(this, Ve) == "function" ? d(this, Ve).call(this) : d(this, Ve)).then((o) => K(this, xe, o || null)).finally(() => { d(this, qe).forEach(([o, s, a]) => { try { const l = d(this, De).call(this, d(this, xe), ...o); d(this, ze).set(JSON.stringify(o), l), s(l); } catch (l) { a(l); } }), d(this, qe).length = 0; })); else { const o = d(this, De).call(this, d(this, xe), ...e); d(this, ze).set(i, o), r(o); } })); K(this, De, r), K(this, Ve, e); } } ze = new WeakMap(), Qe = new WeakMap(), qe = new WeakMap(), xe = new WeakMap(), Ve = new WeakMap(), De = new WeakMap(); const ri = () => m("div", { children: "Empty" }), ut = E.createContext({ ele: {}, mount: () => { }, unmount: () => { } }), re = ({ rootClassName: t, className: e, children: r, actions: n, title: i, subTitle: o, extras: s, style: a = {} }) => { const { mount: l, unmount: c } = E.useContext(ut); return re.Action({ children: n }), re.Title({ children: i }), re.SubTitle({ children: o }), re.Extra({ children: s }), z(() => (l("rootClassName", t), () => c(t)), [t]), m("div", { className: j("ff-container", e), style: a, children: r }); }, ht = (t) => ({ children: e, className: r }) => { const { mount: n, unmount: i } = E.useContext(ut); return z(() => (e && n(t, E.createElement("div", { key: `ff-${t}`, className: j(`ff-popup-${t}`, r) }, e)), () => i(t)), [r, e]), null; }; re.Action = ht("actions"), re.Title = ht("title"), re.SubTitle = ht("sub-title"), re.Extra = ht("extras"), re.propTypes = { className: C.string, style: C.object, title: C.any, subTitle: C.any, actions: C.any, extras: C.any }; const Po = () => m(re, { className: "ff-loading", children: I("div", { className: "loader", children: [I("div", { className: "square", children: [m("span", {}), m("span", {}), m("span", {})] }), I("div", { className: "square", children: [m("span", {}), m("span", {}), m("span", {})] }), I("div", { className: "square", children: [m("span", {}), m("span", {}), m("span", {})] }), I("div", { className: "square", children: [m("span", {}), m("span", {}), m("span", {})] })] }) }), vo = () => m("div", { children: "NotFound" }), Lr = ({ children: t }) => { const [e, r] = L({}), n = H((o, s) => r((a) => ({ ...a, [o]: s })), []), i = H((o) => r((s) => ({ ...s, [o]: void 0 })), []); return typeof (t == null ? void 0 : t.type) == "string" ? t : m(ut.Provider, { value: { ele: e, mount: n, unmount: i }, children: E.cloneElement(t, { className: e.rootClassName, title: e.title, subTitle: e["sub-title"], actions: e.actions, extras: e.extras }) }); }; Lr.propTypes = { children: C.element.isRequired }; const kr = { close: ["M563.8 512l262.5-312.9c4.4-5.2 0.7-13.1-6.1-13.1h-79.8c-4.7 0-9.2 2.1-12.3 5.7L511.6 449.8 295.1 191.7c-3-3.6-7.5-5.7-12.3-5.7H203c-6.8 0-10.5 7.9-6.1 13.1L459.4 512 196.9 824.9c-4.4 5.2-0.7 13.1 6.1 13.1h79.8c4.7 0 9.2-2.1 12.3-5.7l216.5-258.1 216.5 258.1c3 3.6 7.5 5.7 12.3 5.7h79.8c6.8 0 10.5-7.9 6.1-13.1L563.8 512z"], check: ["M912 190h-69.9c-9.8 0-19.1 4.5-25.1 12.2L404.7 724.5 207 474c-6.1-7.7-15.3-12.2-25.1-12.2H112c-6.7 0-10.4 7.7-6.3 12.9l273.9 347c12.8 16.2 37.4 16.2 50.3 0l488.4-618.9c4.1-5.1 0.4-12.8-6.3-12.8z"], info: ["M512 224m-64 0a64 64 0 1 0 128 0 64 64 0 1 0-128 0Z", "M544 392h-64c-4.4 0-8 3.6-8 8v464c0 4.4 3.6 8 8 8h64c4.4 0 8-3.6 8-8V400c0-4.4-3.6-8-8-8z"] }, Qt = ({ type: t, props: e }) => m("i", { ...e, children: m("svg", { viewBox: "0 0 1024 1024", width: "1em", height: "1em", fill: "currentColor", children: (kr[t] || kr.info).map((r, n) => m("path", { d: r }, n)) }) }), Vr = ({ className: t, content: e, icon: r, $close: n }) => I(E.Fragment, { children: [r && m("div", { className: j("ff-notification-icon", t), children: m(Qt, { type: r }) }), e] }), ni = ({}) => m(re, { children: "Confirm" }); var Te, Ke; const pe = class pe { constructor() { v(this, Ke, /* @__PURE__ */ new Map()); N(this, "init", (e) => K(this, Ke, new Map(e))); N(this, "check", (e) => !d(this, Ke).has(e) || d(this, Ke).get(e)); if (d(pe, Te)) return d(pe, Te); } }; Te = new WeakMap(), Ke = new WeakMap(), v(pe, Te, null), N(pe, "getInstance", () => (d(pe, Te) || K(pe, Te, new pe()), d(pe, Te))); let Bt = pe; const Dr = Bt.getInstance(), ii = (t, e, r = "children") => { if (w.isEmpty(t)) return {}; const n = w.find(t, ["value", e]); if (!w.isEmpty(n)) return n; const i = t.length; for (let o = 0; o < i; o++) { const { [r]: s } = t[o], a = ii(s, e, r); if (!w.isEmpty(a)) return a; } return {}; }, Mr = (t = "Input", e = "@pkg/ff/grid-layout-forms") => t != null && t.startsWith("@") || t != null && t.startsWith("blob:") ? t : `${e}/${t}`; var Oe, et; const ge = class ge { constructor() { v(this, et, null); N(this, "init", (e) => K(this, et, e)); N(this, "get", (e, r) => w.get(d(this, et), e, r)); if (d(ge, Oe)) return d(ge, Oe); } }; Oe = new WeakMap(), et = new WeakMap(), v(ge, Oe, null), N(ge, "getInstance", () => (d(ge, Oe) || K(ge, Oe, new ge()), d(ge, Oe))); let Ut = ge; const Ue = Ut.getInstance(); var _e, kt, tt, rt, St; const Ne = class Ne { constructor(...e) { v(this, tt, []); v(this, rt, (e) => { var r; for (let n of e) Array.isArray(n[0]) ? d(this, rt).call(this, n) : d(this, tt).push(d(r = Ne, kt).call(r, n[0], n[1])); }); N(this, "toValue", async (e, r = null) => { const n = { getValue: () => e, getRecord: () => r }; let i = e; for (const o of d(this, tt)) try { const s = await o; if (typeof s != "function") { console.warn("middleware is not a function, skip:", s); continue; } i = await s.call(n, i); } catch (s) { console.error("middleware error, skip:", s); } return i; }); N(this, "toRender", (e, r, n = null) => E.createElement(d(this, St), { value: e, record: r }, n)); v(this, St, ({ value: e, record: r, children: n }) => { const [i, o] = L(n), s = An(); return Yt(() => { o(n), this.toValue(e, r).then((a) => s() && o(a)).catch((a) => s() && o(`${a}`)); }, [e, r]), i; }); d(this, rt).call(this, e); } }; _e = new WeakMap(), kt = new WeakMap(), tt = new WeakMap(), rt = new WeakMap(), St = new WeakMap(), v(Ne, _e, null), v(Ne, kt, w.memoize((e, r) => { if (typeof e == "function") return e(r); if (typeof e == "string") return Z.getWidgetComponent(e).then((n) => { var i; return ((i = n.default) == null ? void 0 : i.call(n, r)) || ((o) => o); }); throw new TypeError("middleware must be a string or a function"); }, (...e) => { var r; return d(Ne, _e) || K(Ne, _e, Fi()), d(r = Ne, _e).call(r, ...e); })); let bt = Ne; const oe = E.createContext({ listCode: "", classNames: {}, getBase62params: (t, e) => { }, getSelectedRows: () => [], onReload: () => { }, onClickCallback: () => { }, onConditionChange: () => { }, onTabChange: () => { }, onSiderChange: () => { }, onKeywordChange: () => { }, onPageChange: () => { }, onPageSizeChange: () => { }, reload: () => { }, setPage: () => { }, setPageSize: () => { }, setTab: () => { }, setSider: () => { }, setKeyword: () => { }, setCondition: () => { } }), Sr = ({ className: t, record: e, column: r, ...n }) => { if (r != null && r.editableByJs && (r != null && r.uuid)) { const { formSetting: i = { primaryKey: "id" }, widgetSetting: o = {}, widgetContainerSetting: s = {} } = (r == null ? void 0 : r.editableByJsSetting) || {}; return m(R.Popover, { widget: Br, widgetData: { record: e, column: r }, widgetSetting: { widgetSetting: o, formSetting: i }, widgetContainerProps: { title: r != null && r.title ? `${r.title} - 编辑` : "编辑", width: 260, zIndex: 1050, arrow: !0, ...s }, children: m("td", { className: j("ff-data-list-cell-editable", t), ...n }) }); } return m("td", { className: t, ...n }); }, Br = ({ record: t, column: e, $close: r, $setting: n }) => { const i = J(Oi(w.get(t, e == null ? void 0 : e.dataIndex))), { listCode: o, onClickCallback: s } = de(oe), [a] = ie.useForm(), { formSetting: l, widgetSetting: c } = n, { primaryKey: u = "id", help: p, validators: h } = l || {}, g = () => { a.setFieldsValue({ value: w.get(t, e == null ? void 0 : e.dataIndex), __PROPS__: t }); }; return vt(() => g(), [t, e == null ? void 0 : e.dataIndex, o]), m(re, { actions: I(E.Fragment, { children: [m(R, { size: "small", onClick: g, children: "重置" }), I(Dt.Compact, { block: !0, children: [m(R, { size: "small", widget: r, children: "取消" }), m(R, { type: "primary", size: "small", widget: () => a.validateFields().then(({ value: f }) => { const y = w.get(t, u.substring(u.indexOf(".") + 1)); if (!y) throw "获取更新主键失败!"; B.put(`/api/${o}-storeBy-${e == null ? void 0 : e.uuid}/${y}`, { value: f }).msg(() => s(2, t)).then(r); }).catch(console.warn), children: "保存" })] })] }), children: I(ie, { form: a, children: [m(nr, { label: "", code: "value", type: i.current, widget: e == null ? void 0 : e.editableByJs, help: p, extras: c, validators: h }), m(Xt, { noStyle: !0, name: ["__PROPS__"], children: () => { } })] }) }); }; Br.displayName = "DataListCellEditableContainer"; const oi = (t) => function(e) { return t(e, getRecord()); }, si = async ({ widgetByJs: t, widgetByJsSetting: e }) => { const r = await Z.getWidgetComponent(t).then((n) => n.default || ((i) => i)); return function(n) { return m(r, { value: n, $setting: e }); }; }, ai = (t, e = {}) => W(() => { var r; return (r = t == null ? void 0 : t.filter(Boolean)) == null ? void 0 : r.map(({ widgetByJs: n, widgetByJsSetting: i, middlewares: o, ...s }, a) => { const l = (c) => ({ record: c, column: s }); return o || (o = []), n && o.push([si, { widgetByJs: n, widgetByJsSetting: i }]), o.length > 0 ? (s != null && s.render && o.push([oi, s.render]), { ...s, onCell: l, render: (c, u) => new bt(o).toRender(c, u, "-") }) : { ...s, onCell: l }; }); }, [t, e]), li = (t = {}) => W(() => { var e; return t.body ?? (t.body = { cell: Sr }), (e = t.body).cell ?? (e.cell = Sr), t; }, [t]), No = (t) => { const [e, r] = L({}); return z(() => { let n = !1; return t && B.get(`/api/_/${t}`).then((i) => w.pick(i, ["uuid", "name", "code", "resource", "marginX", "marginY", "cols", "rowHeight", "primaryKey", "columns", "itemOperations", "batchOperations", "isConditionFormLayout", "layout", "tabs", "pageSize", "layoutConfig", "selectionType"])).then((i) => !n && r(i)), () => n = !0; }, [t]), e; }, To = (t, e = {}) => { const [r, n] = L({ dataSource: [] }); return pt(() => { let i = !1; return t && B.get(`/api/${t}/${B.encode({ page: 1, ...e })}`).then((o) => !i && n(o)), () => i = !0; }, [t, e]), r; }, Ur = (t = [], e = /* @__PURE__ */ new Map(), r = "id", n) => { const i = H(n ? (o) => w.get(o, r, w.get(o, [n, r])) : (o) => w.get(o, r), [r, n]); return H((o) => t == null ? void 0 : t.filter((s) => !s.uuid || !e.has(s.uuid) || e.get(s.uuid).some((a) => a == i(o))), [t, e, i]); }, Wt = (t = [], e = /* @__PURE__ */ new Map(), r = [], n = "id", i) => { const o = H(i ? (s) => w.get(s, n, w.get(s, [i, n])) : (s) => w.get(s, n), [n, i]); return W(() => { if (w.isEmpty(t) || !t.some(({ uuid: a }) => Dr.check(a))) return !1; if (w.isEmpty(e) || w.isEmpty(r)) return !0; const s = r.map((a) => o(a)); return t.some(({ uuid: a }) => !a || !e.has(a) || e.get(a).some((l) => s.some((c) => c == l))); }, [t, r, e, o]); }, ci = (t, e, r = "id", n = null) => { const i = Pt(), o = J(!1), s = J(t.dataSource), a = J(t.itemOperationsAccess); return z(() => (s.current = t.dataSource, a.current = t.itemOperationsAccess, () => o.current = !1), [t.dataSource, t.itemOperationsAccess]), o.current && (t.dataSource = s.current, t.itemOperationsAccess = a.current), [t, (l = 0, c = null) => { var u, p; if (o.current = !1, l === 1) return (u = t.onReload) == null ? void 0 : u.call(t); if (l === 2) { const h = w.get(c, "__PARENT_ID__", ""), g = w.get(c, r, w.get(c, [n, r], "")), f = w.findIndex(s.current, ["__PARENT_ID__", h]), y = w.findIndex(f > -1 ? w.get(s.current, [f, "children"]) : s.current, [r, g]); if (y === -1) return (p = t.onReload) == null ? void 0 : p.call(t); Promise.all([B.get(`/api/${e}/detail/${g}`), B.post(`/api/${e}/list-operations-access`, { ids: g })]).then(([k, b]) => { const x = w.get(s.current, f > -1 ? [f, "children", y, "children"] : [y, "children"]); s.current = Ar(s.current, f > -1 ? { [f]: { children: { $splice: [[y, 1, { ...k, children: x }]] } } } : { $splice: [[y, 1, { ...k, children: x }]] }); const S = new Map(b); a.current.forEach(($, F) => { var A; (A = S.get(F)) != null && A.some((O) => O == g) || a.current.set(F, $.filter((O) => O !== g)); }), S.forEach(($, F) => { a.current.has(F) ? a.current.set(F, w.uniq([...a.current.get(F) || [], ...$])) : a.current.set(F, $); }); }).then(() => { o.current = !0, i(); }); } }]; }, di = (t, e) => { const r = Pt(), n = J(e), i = J(/* @__PURE__ */ new Map()), o = J([]), s = w.throttle((l) => { o.current = [], B.list(t, w.pick({ ...n.current, ...l }, ["tab", "page", "pageSize", "condition", "sider", "keyword"])).then(({ keyword: c, condition: u, total: p, tab: h, sider: g, page: f, pageSize: y, operationsAccess: k, dataSource: b }) => { n.current = { tab: h, condition: u, sider: g, keyword: c, total: p, pageSize: y, page: b != null && b.length ? f : 1 }, o.current = b, i.current = new Map(k), r(); }); }, 380, { leading: !1, trailing: !0 }); vt(() => { o.current = [], t && s(e); }, [t, e]); const a = W(() => w.pick(n.current, ["total", "tab", "page", "pageSize", "condition", "sider", "keyword", "primaryKey"]), [n.current]); return Object.assign(a, { onTabChange: (l) => s({ tab: l, page: 1 }), onPageChange: (l, c) => s({ page: l, pageSize: c }), onPageSizeChange: (l) => s({ pageSize: l, page: 1 }), onConditionChange: (l, c) => s({ keyword: c, condition: Ar(n.current.condition || {}, { $merge: l || {} }), page: 1 }), onSiderChange: (l) => s({ sider: l, page: 1 }), onKeywordChange: (l) => s({ keyword: l, page: 1 }), itemOperationsAccess: i.current, dataSource: o.current, onReload: s, payload: e == null ? void 0 : e.payload }); }, ui = ({ listCode: t, className: e, layouts: r = {}, dataSource: n, isPaginate: i, isItemOperations: o, isBatchOperations: s, batchOperations: a, itemOperations: l, itemOperationsAccess: c, resource: u, primaryKey: p, title: h, itemGridLayout: g, $setting: f, tabs: y, isConditionFormLayout: k, isTreeSider: b, treeSiderConfig: x, rowSelection: S }) => { const { classNames: $, onClickCallback: F } = de(oe), A = w.pick(f, ["column", "colWidth", "beforeRender", "afterRender", "style", "itemMargin", "containerPadding"]), O = f == null ? void 0 : f.isMarkSelected, T = Ur(l, c, p, u), D = H((P, V, M) => m(pi, { isMarkSelected: O, className: j("ff-data-list-framework-item", $ == null ? void 0 : $.item), operations: o ? T(V) : [], data: u ? { [u]: V } : V, children: P, onClickCallback: F }), [O, u, p, o, F, l, c]); return I("div", { className: j("ff-data-list-framework", e), children: [m(r.sider, { isTreeSider: b, ...x }), I("div", { className: j("ff-data-list-container", $ == null ? void 0 : $.container), children: [m(r.filter, { isConditionFormLayout: k }), m(r.toolbar, { title: h, tabs: y }), m(Pi, { ...g, ...A, rowSelection: S, empty: m(r.empty, { className: $ == null ? void 0 : $.empty }), primaryKey: p, itemRender: D, dataSource: n }), m(r.footer, { isPaginate: i, isOperations: s, operations: a })] })] }); }, pi = ({ className: t, operations: e, children: r, data: n, onClickCallback: i, onSelect: o, isMarkSelected: s, isSelected: a, selectionType: l }) => I("div", { className: j("data-list-grid-layout-item", { "is-mark-selected": s, "is-selected": a, "is-selectable": !!l }, t), onClick: o, children: [m("div", { className: "data-list-grid-layout-item-container", children: r }), !!(e != null && e.length) && m("div", { className: "data-list-grid-layout-item-actions", children: e.map((c) => m("span", { className: "data-list-grid-layout-item-action", children: m(R.Link, { uuid: c.uuid, type: c.type, name: c.name, widget: c.widget, widgetType: c.widgetType, widgetProps: c.widgetProps, widgetSetting: c.widgetSetting, widgetContainerProps: c.widgetContainerSetting, data: n, confirm: c.confirm, onAfterClick: (u) => u !== !1 && (i == null ? void 0 : i(c.isRefresh, n)) }, c.uuid || Lt()) }, (c == null ? void 0 : c.uuid) || Lt())) })] }), gi = ({ listCode: t, className: e, layouts: r = {}, dataSource: n, columns: i, isItemOperations: o, isBatchOperations: s, batchOperations: a, itemOperations: l, itemOperationsAccess: c, resource: u, primaryKey: p, title: h, tabs: g, isPaginate: f, rowSelection: y, isTreeSider: k, treeSiderConfig: b, isConditionFormLayout: x, ...S }) => { const { classNames: $, onClickCallback: F } = de(oe), A = Ur(l, c, p, u), O = Wt(l, c, n, p, u); return I("div", { className: j("ff-data-table-framework", e), children: [m(r.sider, { isTreeSider: k, ...b }), I("div", { className: j("ff-data-table-container", $ == null ? void 0 : $.container), children: [m(r.filter, { isConditionFormLayout: x }), m(r.toolbar, { title: h, tabs: g }), m(Ci, { ...S, primaryKey: p, className: "ff-data-table-content", columns: i, dataSource: n, rowSelection: y, operationRender: O ? (T) => { var D; return m("div", { className: "ff-data-table-actions", children: (D = A(T)) == null ? void 0 : D.map((P, V) => m(R, { size: "small", uuid: P.uuid, type: P.type, name: P.name, widget: P.widget, widgetType: P.widgetType, widgetProps: P.widgetProps, widgetData: P.widgetData, widgetSetting: P.widgetSetting, widgetContainerProps: P.widgetContainerSetting, data: T, confirm: P.confirm, onAfterClick: (M) => M !== !1 && (F == null ? void 0 : F(P.isRefresh, T)) }, P.uuid || V)) }); } : null }), m(r.footer, { isPaginate: f, isOperations: s, operations: a })] })] }); }, er = (t = [], e, r = null) => { var n; return (n = w.sortBy(t, ["y", "x"])) == null ? void 0 : n.map(({ i, x: o, y: s, w: a, h: l, field: { boxStyle: c, ...u } = {} }, p) => m("div", { className: "grid-layout-item", style: Wr(o, s, a, l, c), children: m(e, { ...u, basicForm: r }) }, i ?? p)); }, Wr = (t, e, r, n, i = {}, o = 0) => { const s = { "--grid-layout-h": `${n}`, "--grid-layout-w": `${r}`, "--grid-layout-x": `${t}`, "--grid-layout-y": `${e}`, "--grid-layout-row-height-offset": "0px" }; return i != null && i.autoHeight ? s.height = "fit-content" : s["--grid-layout-row"] = `${n}`, i != null && i.alignItems && (s["--grid-layout-box-align-items"] = i.alignItems), i != null && i.justifyContent && (s["--grid-layout-box-justify-content"] = i.justifyContent), s["--grid-layout-box-margin"] = Er(i == null ? void 0 : i.marginTop, i == null ? void 0 : i.marginRight, i == null ? void 0 : i.marginBottom, i == null ? void 0 : i.marginLeft), s["--grid-layout-box-padding"] = Er(i == null ? void 0 : i.paddingTop, i == null ? void 0 : i.paddingRight, i == null ? void 0 : i.paddingBottom, i == null ? void 0 : i.paddingLeft), o && (s.height = `${o}px`), s; }, Er = (t, e, r, n) => `${t || 0}px ${e || 0}px ${r || 0}px ${n || 0}px`, Oo = (t = "Text", e = "@pkg/ff/grid-layouts") => t != null && t.startsWith("@") || t != null && t.startsWith("blob:") ? t : `${e}/${t}`, zr = (t) => Object.keys(t).reduce((e, r) => (/^on[A-Z]/.test(r) && (e[r] = t[r]), e), {}), qr = ({ className: t, isConditionFormLayout: e }) => { var h, g; const [r, n] = L({}), { listCode: i, onKeywordChange: o, onConditionChange: s, getBase62params: a, classNames: l } = E.useContext(oe), { keyword: c, condition: u } = (a == null ? void 0 : a()) || {}, [p] = ft.useForm(); return z(() => { i && e && B.get(`/api/_/${i}/list-condition-form-layout`).then(({ resource: f, marginX: y, marginY: k, rowHeight: b, cols: x, fields: S }) => { n({ resource: f, itemMargin: [y, k], rowHeight: b, cols: x, fields: S }); }).catch(() => n({})); }, [i, e]), z(() => { p.setFieldsValue({ keyword: c, ...u }); }, [JSON.stringify([c, u])]), m("div", { className: j("ff-data-list-filter", l.filter, t), children: m(ft, { form: p, layout: "vertical", autoComplete: "off", onFinish: ((h = r.fields) == null ? void 0 : h.length) > 1 ? (f) => s({ [r.resource]: f[r.resource] }, f.keyword) : () => { }, onValuesChange: (f) => { w.isEmpty(w.omit(f, ["keyword"])) || p.submit(); }, children: ((g = r.fields) == null ? void 0 : g.length) > 1 ? m(ir, { ...r, children: m(mi, { onReset: () => { const { keyword: f, condition: y } = a("init") || {}; p.setFieldsValue({ keyword: f, ...y }); } }) }) : m("div", { className: "ff-data-list-filter-default-form ff-grid-layout-form", children: m("div", { className: "grid-layout-item", style: Wr(20, 0, 5, 2), children: m(ft.Item, { name: ["keyword"], children: m(Mn.Search, { allowClear: !0, enterButton: "搜索", placeholder: "多关键字 | 分割", onSearch: (f) => o(f) }) }) }) }) }) }); }, mi = ({ cols: t, fields: e, onReset: r }) => { const [n, i] = L(!1), o = W(() => e == null ? void 0 : e.toReversed().some((s) => s.y > 1 || s.x + s.w >= t - 5), [t, e]); return I(ft.Item, { label: " ", style: { "--item-span": 5 }, className: j("ff-data-list-filter-actions", { expanded: n }), children: [m(wt, { onClick: r, children: "重置" }), m(wt, { type: "primary", htmlType: "submit", children: "查询" }), o && m(R.Link, { className: "ff-data-list-filter-expanded-button", widget: () => i((s) => !s), type: "primary", name: n ? "关闭" : "展开", icon: n ? "icon-up" : "icon-down", iconPosition: "end" })] }); }; qr.reservedFields = [{ x: 0, y: 0, h: 3, w: 5, field: { isVirtual: !0, widgetPrefix: "@pkg/ff/grid-layout-forms", widget: "Input", code: "keyword", label: "关键字", placeholder: "多关键字 | 分割", extras: { prefix: "icon-search" } } }]; const hi = ({ className: t, operations: e, isOperations: r, isPaginate: n }) => { const { onPageChange: i, onPageSizeChange: o, onClickCallback: s, getBase62params: a } = E.useContext(oe), { total: l, page: c, pageSize: u } = (a == null ? void 0 : a()) || {}; return r && !w.isEmpty(e) || n ? I("div", { className: j("ff-data-list-footer", t), children: [m("div", { className: "ff-data-list-actions", children: e == null ? void 0 : e.map((p, h) => m(R, { uuid: p.uuid, type: p.type, name: p.name, widget: p.widget, widgetType: p.widgetType, widgetProps: p.widgetProps, widgetData: p.widgetData, widgetSetting: p.widgetSetting, widgetContainerProps: p.widgetContainerSetting, onAfterClick: (g) => g !== !1 && (s == null ? void 0 : s(p.isRefresh, null)) }, p.uuid || h)) }), n && m(Bn, { size: "small", total: l, pageSize: u, showSizeChanger: !1, showTotal: (p) => `第 ${c} 页 / 总共 ${p} 条`, onChange: i, onShowSizeChange: o })] }) : null; }, fi = [{ title: "parent 1", key: "0-0", children: [{ title: "parent 1-0", key: "0-0-0", disabled: !0, children: [{ title: "leaf", key: "0-0-0-0", disableCheckbox: !0 }, { title: "leaf", key: "0-0-0-1" }] }, { title: "parent 1-1", key: "0-0-1", children: [{ title: m("span", { style: { color: "#1677ff" }, children: "sss" }), key: "0-0-1-0" }] }] }], yi = ({ className: t, width: e = 280, isTreeSider: r }) => { const { classNames: n } = de(oe); return r ? m(Un.DirectoryTree, { className: j("ff-data-list-sider", n.sider, t), style: { "--sider-width": e }, showLine: !0, showIcon: !1, treeData: fi }) : null; }, wi = ({ className: t, title: e, tabs: r }) => { const { getBase62params: n, onTabChange: i, onReload: o, classNames: s } = de(oe), { tab: a } = (n == null ? void 0 : n()) || {}, [l, c] = Jn((r == null ? void 0 : r[0].value) ?? (r == null ? void 0 : r[0].code), { value: a, onChange: i }); return I("div", { className: j("ff-data-list-toolbar", s.toolbar, t), children: [m("div", { className: "ff-data-list-title", children: e }), m(Wn, { className: "ff-data-list-tabs", itemRender: ({ label: u, code: p, value: h }) => m("span", { onClick: () => c(h ?? p), className: j("ff-data-list-tab", { active: (h ?? p) == l }), children: u }), items: r }), I("div", { className: "ff-data-list-actions", children: [m(R.Link, { icon: "icon-reload", widget: () => o() }), m(R.Link, { icon: "icon-setting" })] })] }); }, bi = ({ className: t, ...e }) => m(Mt, { className: j(t, "ff-data-list-empty"), image: Mt.PRESENTED_IMAGE_SIMPLE, ...e }), Kr = ({ isItemGridLayout: t, theme: e, themeProps: r, onClickCallback: n, onReload: i, listCode: o, total: s = 0, page: a = 0, onPageChange: l, pageSize: c = 30, onPageSizeChange: u, tab: p, onTabChange: h, keyword: g, onKeywordChange: f, condition: y, onConditionChange: k, sider: b, onSiderChange: x, layouts: S, classNames: $ = {}, payload: F = {}, dataSource: A = [], rowSelection: O, getSelectedRows: T, primaryKey: D, ...P }) => { const [V, M] = L(), U = T ?? (() => A), X = H((q, se) => { const _ = { tab: p, page: a, pageSize: c, keyword: g, sider: b, condition: y, total: s, payload: F }; return q && q != "init" ? w.get(_, q, se) : _; }, [JSON.stringify(y), JSON.stringify(F), p, a, c, g, b, s]), Ee = W(() => { let q = { sider: yi, filter: qr, footer: hi, toolbar: wi, empty: bi }; S === !1 ? q = { sider: null, filter: null, footer: null, toolbar: null, empty: null } : w.isPlainObject(S) && (q = Object.assign({}, q, S)); for (const se in q) if (q[se]) { if (On(q[se])) { const _ = q[se]; q[se] = (mt) => E.cloneElement(_, mt); } } else q[se] = () => m(E.Fragment, {}); return q; }, [S]); return z(() => { e ? Z.getWidgetComponent(e).then((q) => { if (!q) throw `${e} not found`; return q; }).catch((q) => ({ default: () => `${q}` })).then((q) => M(E.createElement(q.default, { ...P, layouts: Ee, $setting: r }))) : M(m(t ? ui : gi, { ...P, layouts: Ee, $setting: r })); }, [e, r]), m(oe.Provider, { value: { classNames: $, listCode: o, onClickCallback: n, onReload: i, getBase62params: X, onPageChange: l, onPageSizeChange: u, onTabChange: h, onSiderChange: x, onKeywordChange: f, onConditionChange: k, setPage: l, setPageSize: u, setTab: h, setSider: x, setKeyword: f, setCondition: k, getSelectedRows: U }, children: V && E.cloneElement(V, { dataSource: A, primaryKey: D, rowSelection: O, ...P }) }); }; Kr.propTypes = { classNames: C.exact({ sider: C.string, filter: C.string, footer: C.string, toolbar: C.string, container: C.string, content: C.string, item: C.string, empty: C.string }), layouts: C.oneOfType([C.exact({ sider: C.oneOfType([C.elementType, C.element]), filter: C.oneOfType([C.elementType, C.element]), footer: C.oneOfType([C.elementType, C.element]), toolbar: C.oneOfType([C.elementType, C.element]), empty: C.oneOfType([C.elementType, C.element]) }), C.bool]) }; var Re, $e, Me, Et; const me = class me { constructor() { v(this, $e, null); v(this, Me, /* @__PURE__ */ new Map()); v(this, Et, () => { if (d(this, $e)) return d(this, $e).port.postMessage({ command: "status", data: [] }); K(this, $e, new SharedWorker(new URL("/ff-worker/res-ws.js", self.location))), d(this, $e).port.onmessage = (e) => { var r, n; (r = e.data) != null && r.uuid ? d(this, Me).forEach((i, o) => { var s; (i == "*" || (s = i == null ? void 0 : i.includes) != null && s.call(i, e.data.uuid)) && o(e.data); }) : ((n = e.data) == null ? void 0 : n.readyState) == WebSocket.CLOSED && B.get("/api/user-api-token").then(({ token: i, expire_at: o }) => { d(this, $e).port.postMessage({ command: "initWs", data: [`ws${w.trimStart(B.appUrl, "http")}api/user-resource-status-ws?token=${i}`] }); }); }, d(this, $e).port.postMessage({ command: "status", data: [] }); }); N(this, "subscribe", (e, r = []) => (r ? Array.isArray(r) && r.length == 0 ? r = "*" : Array.isArray(r) || (r = [r].flat()) : r = "*", d(this, Me).set(e, r), d(this, Me).size == 1 && d(this, Et).call(this), () => this.unsubscribe(e))); N(this, "unsubscribe", (e) => d(this, Me).delete(e)); if (d(me, Re)) return d(me, Re); } }; Re = new WeakMap(), $e = new WeakMap(), Me = new WeakMap(), Et = new WeakMap(), v(me, Re, null), N(me, "getInstance", () => (d(me, Re) || K(me, Re, new me()), d(me, Re))); let zt = me; const _r = zt.getInstance(), tr = E.forwardRef(({ listCode: t, base62params: e, className: r, theme: n, themeProps: i, layouts: o, classNames: s, rowSelection: a = null, onDataSourceChange: l }, c) => { const [{ resource: u, primaryKey: p, batchOperations: h = [], itemOperations: g = [], columns: f = [], isConditionFormLayout: y = !1, isTreeSider: k, treeSiderConfig: b, theme: x, themeConfig: S, isItemGridLayout: $, itemGridLayout: { themeConfig: F, ...A } = {}, title: O, isPaginate: T, tabs: D, selectionType: P }, V] = L({ isItemGridLayout: !1, itemGridLayout: {} }), { type: M = P, selectedRowKeys: U, defaultSelectedRowKeys: X, onChange: Ee, ...q } = a ?? {}, se = di(t, e), [{ dataSource: _, itemOperationsAccess: mt, condition: ln, tab: cn, keyword: dn, page: ar, total: lr, pageSize: cr, sider: un, onConditionChange: pn, onTabChange: gn, onKeywordChange: mn, onPageChange: hn, onPageSizeChange: fn, onSiderChange: yn, onReload: Tt, payload: wn }, dr] = ci(se, t, p, u), bn = wr(l); Gt(() => { bn(_, { primaryKey: p, page: ar, pageSize: cr, total: lr }); }, [_]); const [ur, Cn] = Dn([], { defaultValue: X ?? [], value: U }), [pr, kn] = L([]), gr = H(() => M ? pr : _, [M, pr, _]), Sn = Wt(g, mt, _, p), En = Wt(h); z(() => { let Q = null; return t && B.get(`/api/_/${t}`).resp(({ data: Ie, res: Ot }) => { Ie != null && Ie.isDynamicRefresh && (Q = _r.subscribe(() => Tt(), Ot)), V(Ie); }).catch(() => V({})), () => Q == null ? void 0 : Q(); }, [t]), E.useImperativeHandle(c, () => ({ onReload: Tt, onClickCallback: dr, getSelectedRows: gr })); const mr = wr((Q, Ie) => { kn((Ot) => { const hr = new Map(Ot.map((ae) => [ae == null ? void 0 : ae[p], ae])); return Ie.forEach((ae) => hr.set(ae == null ? void 0 : ae[p], ae)), Q.map((ae) => hr.get(ae)).filter(Boolean); }), Cn(Q), Ee == null || Ee(Q, Ie); }), xn = W(() => M ? { columnWidth: 80, ...q, type: M, selectedRowKeys: ur, onChange: mr } : void 0, [M, ur, mr, a]), $n = W(() => w.merge({}, S, i), [S, i]), Pn = W(() => g == null ? void 0 : g.map((Q) => w.isEmpty(Q == null ? void 0 : Q.confirm) ? Q : { ...Q, confirm: Object.assign({}, Q.confirm, { getPopupContainer: () => document.body }) }), [g]), vn = W(() => ({ ...A, themeProps: F }), [A, F]); return m(Kr, { listCode: t, title: O, classNames: s, layouts: o, resource: u, primaryKey: p, theme: n || x, themeProps: $n, isTreeSider: k, treeSiderConfig: b, isPaginate: T, rowSelection: xn, getSelectedRows: gr, tabs: D, isItemOperations: Sn, itemOperations: Pn, isBatchOperations: En, batchOperations: h, isItemGridLayout: $, columns: f, itemGridLayout: vn, isConditionFormLayout: y, itemOperationsAccess: mt, dataSource: _, onConditionChange: pn, onTabChange: gn, onKeywordChange: mn, onPageChange: hn, onPageSizeChange: fn, onSiderChange: yn, condition: ln, tab: cn, keyword: dn, page: ar, total: lr, pageSize: cr, sider: un, payload: wn, className: j("ff-data-list-helper", r), onReload: Tt, onClickCallback: dr }); }), Jr = (t, e, r = !0) => r !== !0 && r-- <= 0 ? [] : w.isArray(t) && !w.isEmpty(t) ? t.reduce((n, i) => (Reflect.has(i, e) && Reflect.has(i, "children") && n.push(i[e]), Reflect.has(i, "children") && !w.isEmpty(i.children) ? n.concat(Jr(i.children, e, r)) : n), []) : [], Ci = ({ className: t, primaryKey: e, columns: r = [], dataSource: n = [], operationRender: i, operationWidth: o = 180, components: s = {}, rowSelection: a, ...l }) => { const { classNames: c } = de(oe), u = J(null), p = J(null), [h, g] = L([]), [f, y] = L({ width: 0, height: 0 }); z(() => { g(Jr(n, e)); }, [n, e]), Rn(() => { const S = new ResizeObserver(() => { var $; y({ width: (($ = u.current) == null ? void 0 : $.nativeElement.querySelector(".ant-table-body").scrollWidth) || p.current.offsetWidth, height: p.current.offsetHeight }); }); return p.current && S.observe(p.current), () => { p.current && S.unobserve(p.current); }; }, []); const k = W(() => { if (!(f != null && f.width) || !(r != null && r.length)) return r; const S = (a ? a.columnWidth ?? 32 : 0) + (i ? o : 0), $ = r.reduce((O, T) => O + (T != null && T.isWidthFixed && T.width ? T.width : 0), 0), F = r.filter((O) => !(O != null && O.isWidthFixed)).reduce((O, T) => O + ((T == null ? void 0 : T.width) ?? 100), 0); if ($ + F + S >= f.width) return r; const A = f.width - $ - S; return r.map((O) => O != null && O.isWidthFixed ? O : { ...O, width: Math.floor(A * ((O == null ? void 0 : O.width) ?? 100) / F) }); }, [r, f.width, a, i, o]), b = ai(k), x = li(s); return m("div", { ref: p, className: j("ff-data-list-table", c.content, t), children: f.height ? m(br, { bordered: !0, ...l, components: x, ref: u, rowKey: (S) => (S == null ? void 0 : S[e]) ?? Math.random(), rowSelection: a, columns: (() => { var $, F; const S = [...b ?? []]; return a && S.splice((F = ($ = S[0]) == null ? void 0 : $.key) != null && F.startsWith("__") ? 1 : 0, 0, br.SELECTION_COLUMN), i && S.push({ title: "操作", align: "center", fixed: "right", className: "ff-data-list-table-operations", width: `${Math.ceil(o / f.width * 100).toFixed(2)}%`, render: (A, O, T) => i(O, T) }), S; })(), dataSource: n, size: "middle", scroll: { x: "max-content", y: f.height - 50 }, pagination: !1, expandable: { defaultExpandAllRows: !0, expandRowByClick: !0, onExpandedRowsChange: g, expandedRowKeys: h } }) : null }); }, ki = "RC_FORM_INTERNAL_HOOKS", Si = (t) => { const [e, r] = E.useState({ items: [] }); return z(() => { t && B.get(`/api/_/${t}`).then(({ uuid: n, code: i, name: o, resource: s, primaryKey: a, marginX: l, marginY: c, cols: u, rowHeight: p, fields: h, theme: g, themeSetting: f, groups: y }) => ({ uuid: n, code: i, name: o, resource: s, primaryKey: a, marginX: l, marginY: c, cols: u, rowHeight: p, theme: g, themeProps: f, groups: y, items: h })).then(r); }, [t]), e; }, Ei = (t, { initialValue: e, initialValueLanguage: r, convertJs: n, convertJsSetting: i, type: o = "string" }, s = null) => { const a = J(!1), l = de(jr), [c, u] = L(), [p, h] = L(r != "javascript" && t ? l.getFieldValue(t) : void 0), { registerWatch: g } = l.getInternalHooks(ki) || {}; return z(() => g == null ? void 0 : g((f, y, k) => { if (!a.current) return; const b = w.get(y, t); w.isEqual(b, p) || h(ce(b, o)); }), [p]), z(() => { r == "javascript" && e ? We.exec(e, {}, { getFieldValueForBasicForm: (f) => s ? s.getFieldValue(f) : l.getFieldValue(f), getFieldValue: (f) => l.getFieldValue(f) }).then((f) => h(ce(f, o))).catch((f) => notification.error({ message: `布局数据错误: ${JSON.stringify(f)}` })).finally(() => a.current = !0) : (e && h(ce(e ?? l.getFieldValue(t), o)), a.current = !0); }, [e, r]), pt(() => { a.current && n && new bt([n, i]).toValue(p, l.getFieldsValue(!0)).then(u).catch((f) => { u(f), console.error("布局数据转换错误: ", f, n); }); }, [p, n, i]), [c ?? p, p]; }, Ro = (t, e, r = null) => W(() => er(t, e, r), [t]), Hr = (t, e, r = {}, n = {}, i = {}, o = null) => { const s = de(jr), a = Pt(), l = J(!0), c = J([]), [u, p] = L(e), [h, g] = L(), f = ie.useWatch((y) => JSON.stringify(w.pick(y, c.current)), s) || "{}"; return vt(() => { t && We.exec(t, r, { ...n, getFieldValueForBasicForm: (y) => i ? i.getFieldValue(y) : null, getFieldValue: w.wrap(s.getFieldValue, (y, k) => (c.current.some((b) => w.isEqual(b, k)) || (c.current.push(k), a()), y == null ? void 0 : y(k))), isFieldTouched: s.isFieldTouched, isFieldsTouched: s.isFieldsTouched }).then((y) => { l.current && (p(y), g(null)); }).catch((y) => { l.current && (p(e), g(y)); }); }, [t, f, s, r, n]), z(() => () => l.current = !1, []), t ? [o ? ce(u, o) : u, h] : [o ? ce(e, o) : e, null]; }, xi = ({ widget: t, widgetPrefix: e = "@pkg/ff/grid-layouts", basicForm: r, ...n }) => { const i = t != null && t.startsWith("@") || t != null && t.startsWith("blob:") ? t : `${e}/${t}`, [o, s] = L(); return z(() => { i && Z.getWidgetComponent(i).then(({ defaultProps: a = {}, default: l }) => ({ default: $i(l, a, r) })).catch((a) => ({ default: () => `${a}` })).then((a) => s(E.createElement(a.default, n))); }, [i]), o; }, $i = (t, e = {}, r = null) => (n) => { const { code: i, label: o, extras: s, isVirtual: a, initialValue: l, initialValueLanguage: c, convertJs: u, convertJsSetting: p, value: h, ...g } = w.merge({}, e, n), [f, y] = Ei(a ? null : i, { initialValue: l, initialValueLanguage: c, convertJs: u, convertJsSetting: p, type: (g == null ? void 0 : g.type) || "string" }, r), k = W(() => { const S = Object.keys((e == null ? void 0 : e.extras) || {}); return w.over([w.partialRight(w.pick, S), w.partialRight(w.omit, S)]); }, [e == null ? void 0 : e.extras]), [b, x] = k(g); return m(t, { ...x, value: f, rawValue: y, $setting: Object.assign({}, s, b) }); }, Yr = ({ theme: t, basicForm: e, items: r = [{ key: "default", label: "默认" }], fields: n = [], itemRender: i, chunks: o = [], children: s, $setting: a = {}, ...l }) => { const [c, u] = L(); z(() => { t ? Z.getWidgetComponent(t).then((h) => { if (!(h != null && h.default)) throw "not found"; return h; }).catch((h) => ({ default: () => `${t} ${h}` })).then((h) => u(E.createElement(h.default, {}))) : u(null); }, [t]); const p = W(() => r == null ? void 0 : r.map((h) => ({ ...h, children: i(h, n == null ? void 0 : n.filter((g) => !(g != null && g.group) && h.key == "default" || g.group == h.key), h.key == "default" ? s : null) })).concat(o), [r, s, o]); return c && E.cloneElement(c, { items: p, basicForm: e, $setting: { ...a, ...l } }); }, Gr = ({ name: t, form: e = null, basicForm: r = null, style: n = {}, className: i, cols: o = 12, rowHeight: s = 21, containerPadding: a = [0, 0], itemMargin: l = [4, 0], formProps: c = {}, formFields: u = [], fields: p = [], data: h, theme: g, themeProps: f = {}, groups: y = [{ key: "default", label: "默认" }], children: k, ...b }) => { const [x] = ie.useForm(e), S = W(() => [{ name: "__PROPS__", value: c }].concat(u), [c, u]); pt(() => (x.setFieldsValue(h), () => x.resetFields()), [h]); const $ = (F, A, O) => { const T = er(A, xi, r), D = zr(b); return I("div", { ...D, className: j("ff-grid-layout", i), style: { ...n, "--grid-layout-item-margin-y": `${(l == null ? void 0 : l[0]) || 0}px`, "--grid-layout-item-margin-x": `${(l == null ? void 0 : l[1]) || 0}px`, "--grid-layout-container-padding-y": `${(a == null ? void 0 : a[0]) || 0}px`, "--grid-layout-container-padding-x": `${(a == null ? void 0 : a[1]) || 0}px`, "--grid-layout-cols": o, "--grid-layout-row-height": `${s}px` }, children: [T, O && E.cloneElement(O, { cols: o, rowHeight: s, itemMargin: l, containerPadding: a, fields: A, basicForm: r })] }); }; return m(ie, { ...b, fields: S, form: x, component: !1, children: g ? m(Yr, { ...f, items: y, theme: g, itemRender: $, fields: p, children: k, basicForm: r }) : $(0, p, k) }); }, Fo = /* @__PURE__ */ ((t) => function({ code: e, data: r, ...n }) { const { uuid: i, resource: o, items: s, hides: a, rowHeight: l, marginX: c, marginY: u, cols: p, theme: h, themeProps: g, groups: f } = Si(e) || {}, y = W(() => [{ name: "__RESOURCE__", value: o }, { name: "__LAYOUT_KEY__", value: e }, { name: "__LAYOUT_UUID__", value: i }], [e, i, o]); return o && m(t, { name: e, theme: h, themeProps: g, groups: f, ...n, fields: s, formFields: y, rowHeight: l, cols: p, itemMargin: [c, u], data: o ? { [o]: r } : r }); })(Gr), Pi = ({ column: t = 0, colWidth: e = 0, cols: r, rowHeight: n, itemMargin: i, containerPadding: o, fields: s, primaryKey: a, dataSource: l, beforeRender: c = null, afterRender: u = null, itemClassName: p, itemRender: h = ($, F, A) => $, empty: g = m(Mt, { description: null }), className: f, style: y = {}, theme: k, themeProps: b = {}, groups: x = [{ key: "default", label: "默认" }], rowSelection: S }) => { const { classNames: $ } = de(oe), F = H((T) => { if (!S) return; const { selectedRowKeys: D = [], onChange: P, type: V = "checkbox" } = S, M = T == null ? void 0 : T[a]; let U; U = V === "radio" ? [M] : D.includes(M) ? D.filter((X) => X !== M) : [...D, M], P == null || P(U, l.filter((X) => U.includes(X == null ? void 0 : X[a]))); }, [S, a, l]), A = W(() => m(Gr, { groups: x, theme: k, themeProps: b, cols: r, rowHeight: n, itemMargin: i, containerPadding: o, fields: s, className: p }), [s, r, n, i, o, x, k, b]), O = w.isEmpty(l); return I("div", { className: j("ff-data-list-content", $.content, f), style: Object.assign({}, y, t && { "--col-num": t }, e && { "--col-width": e }), children: [c == null ? void 0 : c(l), O ? g : l.map((T, D) => { var U; const P = (T == null ? void 0 : T[a]) ?? D, V = `${P}-${Ri(T)}`, M = h(E.cloneElement(A, { data: T }), T, D); return E.cloneElement(M, { key: V, ...S && { isSelected: (U = S == null ? void 0 : S.selectedRowKeys) == null ? void 0 : U.includes(P), selectionType: S.type ?? "checkbox", onSelect: () => F(T) } }); }), u == null ? void 0 : u(l)] }); }, vi = ({ component: t, $props: e }) => { const { base62params: r } = $t(e, {}); return m(re, { children: m(tr, { listCode: t, base62params: B.decode(r) }) }); }, jo = () => m(Xr, {}), Xr = () => "Empty", Ni = ({ component: t, $setting: e, $props: r }) => { const [n, i] = L(), [o, s] = rr(r); return z(() => { if (!t) return i(m(Xr, { description: null })); Z.getWidgetComponent(t).catch((a) => ({ default: () => `${a}` })).then((a) => E.createElement(a.default, { $setting: e })).then(i); }, [t]), n ? E.cloneElement(n, { ...o, $setProps: s }) : null; }, Ao = () => "NotFoundPage"; var Fe, le, je, ye, nt, it; const he = class he { constructor() { v(this, le, /* @__PURE__ */ new Map()); v(this, je, {}); v(this, ye, null); N(this, "init", (e, r) => { K(this, le, e), K(this, je, r); }); N(this, "get", (e) => (d(this, le).has(e) || (e = Array.from(d(this, le).keys()).find((r) => d(this, le).get(r).uri === e)), d(this, le).get(e) || {})); N(this, "redirect", (e, r, n = {}) => { var f; const { uri: i, type: o, widgetProps: s } = this.get(e) || {}, { router: a, query: l, ...c } = r || {}, u = Object.assign({}, c, a), p = Object.assign({}, c, l); o == "list" && (u.base62params = B.encode(u != null && u.base62params ? u.base62params : u)); let h = Hn(i || e, u); const g = new URLSearchParams(); for (const y in s || {}) ((f = s[y]) == null ? void 0 : f.type) == "query" && Object.has(p, y) && g.append(y, JSON.stringify(p[y])); return g.size > 0 && (h = `${h}?${g.toString()}`), n != null && n.isOpenWindow ? window.open(h) : d(this, ye).navigate(h, { replace: !!(n != null && n.isReplaceRouteHistory) }); }); N(this, "getMenus", (e) => { var r; return ((r = d(this, je)) == null ? void 0 : r[e]) || []; }); N(this, "findMenuPathByUuid", (e) => { let r = []; for (const n in d(this, je)) if (r = d(this, nt).call(this, d(this, je)[n], e, [n]), r.length > 1) return r; return r; }); N(this, "getMenusByRouteUuid", (e) => d(this, it).call(this, e, Object.values(d(this, je)).flat())); v(this, nt, (e, r, n = []) => { if (w.isEmpty(e)) return n; for (const { uuid: i, children: o } of e) { if (i == r) return n.concat(i); if (!w.isEmpty(o)) return n.concat(i, d(this, nt).call(this, o, r)); } return n; }); v(this, it, (e, r) => { var i; let n = []; for (const o of r) o.widgetType == "redirect" && (o.uuid == e || o.widget == e ? n.push(o) : (i = o.children) != null && i.length && (n = n.concat(d(this, it).call(this, e, o.children)))); return n; }); N(this, "getCurrentMenu", () => { const { uuid: e } = this.getCurrentRoute() || {}; if (!e) return; const r = this.getMenusByRouteUuid(e); return w.isEmpty(r) ? void 0 : r[0]; }); N(this, "getCurrentRoute", (e = 0) => { var n; const r = (n = d(this, ye).state.matches[d(this, ye).state.matches.length - 1 - e]) == null ? void 0 : n.route; if (!r) return null; for (let [i, o] of d(this, le)) if (o.uri === r.path) return o; return null; }); N(this, "getPageParams", (e) => { var s, a; const { location: r = {}, matches: n = [] } = ((s = d(this, ye)) == null ? void 0 : s.state) || {}, i = { ...((a = n[n.length - 1]) == null ? void 0 : a.params) || {} }, o = r.search; return o && new URLSearchParams(o).forEach((l, c) => { i[c] = l; }), e ? w.get(i, e) : i; }); N(this, "usePageParams", (e) => { var n; let r = Ir() ? { ...Yn(), ...Object.fromEntries(new URLSearchParams(((n = Gn()) == null ? void 0 : n.search) ?? "")) } : this.getPageParams(); return e ? w.get(r, e) : r; }); N(this, "createBrowserRouter", (e = {}) => { if (d(this, le).size == 0) return null; if (d(this, ye)) return d(this, ye); const r = Ue.get("Common.WEBSITE_DEFAULT_THEME", "@pkg/ff/frameworks/DefaultTheme"), n = Ue.get(Z.checkUserToken() ? "Common.WEBSITE_LOGIN_REDIRECT" : "Common.WEBSITE_DEFAULT", "/index"), i = { [r]: 0 }, o = (a, l) => () => Promise.all([Z.getWidgetComponent(a), $t(l)]).then(([c, u]) => [c.default || function() { return `${a}`; }, u]).then(([c, u]) => ({ Component: () => E.createElement(Lr, {}, E.createElement(c, { $setting: u })) })), s = Array.from(d(this, le).values()).reduce((a, { uuid: l, uri: c, name: u, type: p, component: h, widgetSetting: g, widgetProps: f, isLogin: y, isLayout: k, extra: b }) => { let x = {}, S = 0; switch (p) { case "list": x.element = E.createElement(vi, { component: h, $props: f }); break; case "fsdpf-component": x.element = E.createElement(Ni, { key: c, component: h, $setting: g, $props: f }); } const $ = (b == null ? void 0 : b.theme) ?? (b == null ? void 0 : b.layout); if ($) { const F = (b == null ? void 0 : b.themeProps) ?? (b == null ? void 0 : b.layoutProps); if (!i[$]) return i[$] = a.length, [...a, { path: "/", lazy: o($, F), children: [{ path: c, ...x }] }]; S = i[$]; } return k && S > -1 ? (a[S].children.push({ path: c, ...x }), a) : [...a, { path: c, ...x }]; }, [{ path: "/", lazy: o(r, {}), children: [] }]); return s.push({ index: !0, element: E.createElement(Ti, { to: n, replace: !0 }) }), K(this, ye, Xn(s, e)); }); if (d(he, Fe)) return d(he, Fe); } }; Fe = new WeakMap(), le = new WeakMap(), je = new WeakMap(), ye = new WeakMap(), nt = new WeakMap(), it = new WeakMap(), v(he, Fe, null), N(he, "getInstance", () => (d(he, Fe) || K(he, Fe, new he()), d(he, Fe))); let qt = he; const Ti = ({ to: t, replace: e }) => Ir() ? E.createElement(Zn, { to: t, replace: e }) : (window.document.location = t, "redirect"), ke = qt.getInstance(); Zt.chainableTypes = [In]; const We = Zt.getInstance(new URL("/ff-worker-pipe/worker.js", self.location), { type: "module" }); Zt.fns = { http: Object.fromEntries(["get", "post", "put", "del", "list", "decode", "encode", "cache", "refreshCache"].map((t) => [t, (...e) => B[t](...e)])), generateUUID: () => Ai(), user: { logout: () => Z.logout(() => window.location.replace(Ue.get("Common.WEBSITE_LOGIN_PAGE", "/index"))), getUserInfo: (t = !0) => Z.getUserInfo(t), checkUserToken: () => Z.checkUserToken(), getUserToken: () => Z.getUserToken() }, getConfigure: (t) => Ue.get(t), route: Object.fromEntries(["redirect", "getPageParams", "getCurrentRoute", "get", "getMenus", "findMenuPathByUuid"].map((t) => [t, (...e) => ke[t](...e)])), popup: Object.fromEntries(["notification", "success", "error", "form", "modal", "confirm"].map((t) => [t, (...e) => Se[t](...e)])) }; const xr = { null2json: (t) => Object.create(), null2array: (t) => [], null2number: (t) => 0, null2bool: (t) => !1, null2string: (t) => "", null2integer: (t) => 0, null2float: (t) => 0, string2json: (t) => t ? JSON.parse(t) : "{}", string2array: (t) => t.substr(0, 1) === "[" && t.substr(-1) === "]" ? JSON.parse(t) : t.split(","), string2number: (t) => t == "" ? 0 : +t, string2integer: (t) => t == "" ? 0 : +t, string2float: (t) => t == "" ? 0 : +t, string2bool: (t) => { switch (`${t}`.toLowerCase()) { case "0": case "false": case "[]": case "{}": return !1; } return !!t; }, string2string: (t) => t, json2json: (t) => t, json2array: (t) => t ? Object.values(t) : [], json2number: (t) => Object.keys(t).length, json2integer: (t) => Object.keys(t).length, json2float: (t) => Object.keys(t).length, json2bool: (t) => Object.keys(t).length > 0, json2string: (t) => t ? JSON.stringify(t) : "", array2json: (t) => ({ ...t }), array2array: (t) => t, array2number: (t) => t.length, array2integer: (t) => t.length, array2float: (t) => t.length, array2bool: (t) => t.length > 0, array2string: (t) => JSON.stringify(t), number2json: (t) => ({}), number2array: (t) => [t], number2number: (t) => t, number2integer: (t) => t, number2float: (t) => t, number2bool: (t) => !!t, number2string: (t) => t.toString(), boolean2json: (t) => ({}), boolean2array: (t) => [], boolean2number: (t) => +t, boolean2integer: (t) => +t, boolean2float: (t) => +t, boolean2bool: (t) => t, boolean2string: (t) => t ? "true" : "false" }, ce = (t, e) => { let r = "string"; r = Array.isArray(t) ? "array" : typeof t, w.isObject(t) && (r = "json"); const n = `${r}2${e}`; return Reflect.has(xr, n) ? xr[n](t) : t; }, Oi = (t) => t === null ? "null" : Array.isArray(t) ? "array" : typeof t == "object" ? "json" : typeof t == "boolean" ? "bool" : typeof t == "string" ? "string" : typeof t == "number" ? Number.isInteger(t) ? "integer" : "float" : typeof t, $t = (t = {}, e = {}, r = {}, n = "") => Zr(t, (i, o) => o === "type" && i === "code") ? Qr(t, e, r, n) : en(t, e, n), Zr = (t, e = () => !1) => w.some(t, (r) => !!w.some(r, e) || (w.isEmpty(r) || !w.isPlainObject(r) && !w.isArray(r) ? void 0 : Zr(r, e))), Qr = async (t = {}, e = {}, r = {}, n = "") => { let i = /* @__PURE__ */ Object.create(null); for (let o in t) { let s; if (Reflect.has(t[o], "type") && ["code", "field", "router", "query", "string"].includes(t[o].type)) { const { type: a, value: l = "", default: c = n } = t[o]; switch (a) { case "code": try { s = await We.exec(l, e, r); } catch (u) { console.error("getWidgetPropsData", u); } break; case "field": s = w.get(e, l) ?? w.get(e, l.substring(l.indexOf(".") + 1)); break; case "router": case "query": s = ke.getPageParams(l); break; case "string": s = l; } s ?? (s = c); } else s = await Qr(t[o], e, r, n); w.set(i, o, s); } return i; }, en = (t = {}, e = {}, r = "") => Object.keys(t || {}).reduce((n, i) => { if (w.isPlainObject(t[i])) { let o; if (Reflect.has(t[i], "type") && ["field", "router", "query", "string"].includes(t[i].type)) { const { type: s, value: a = "", default: l = r } = t[i]; switch (s) { case "field": o = w.get(e, a) ?? w.get(e, a.substring(a.indexOf(".") + 1)); break; case "router": case "query": o = ke.getPageParams(a); break; case "string": o = a; } o ?? (o = l); } else o = en(t[i], e, r); w.set(n, i, o); } return n; }, {}), Ft = (t, e) => t && typeof t == "object" ? Array.isArray(t) ? t.map((r) => Ft(r, e)) : Object.keys(t).reduce((r, n) => (e[n] ? r[e[n]] = Ft(t[n], e) : r[n] = Ft(t[n], e), r), {}) : t, Io = () => "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (t) => { const e = 16 * Math.random() | 0; return (t === "x" ? e : 3 & e | 8).toString(16); }), Lo = (t) => { var e, r; return t ? (r = (e = t.match(/^@pkg(?:[^\/]*\/){3}(?[^\/]+)/)) == null ? void 0 : e.groups) == null ? void 0 : r.name : ""; }, Vo = (t) => { var e, r; return t ? (r = (e = t.match(/^@pkg(?:[^\/]*\/){2}(?[^\/]+)/)) == null ? void 0 : e.groups) == null ? void 0 : r.category : ""; }, Do = (t) => { var e, r; return t ? (r = (e = t.match(/^@pkg(?:[^\/]*\/){1}(?[^\/]+)/)) == null ? void 0 : e.groups) == null ? void 0 : r.owner : ""; }, Ri = (t, e = 32, r = "auto") => { const n = Kt(t), i = r === "auto" ? "x64" : r; if (e === 32) return Rt.x86.hash32(n).toString(); if (e === 128) return i === "x64" ? Rt.x64.hash128(n) : Rt.x86.hash128(n); throw new Error("bits 只能是 32 或 128"); }, Kt = (t) => t == null ? "null" : typeof t == "string" ? t : typeof t == "number" || typeof t == "boolean" ? String(t) : typeof t == "function" ? t.toString() : Array.isArray(t) ? "[" + t.map(Kt).join(",") + "]" : typeof t == "object" ? "{" + Object.keys(t).sort().map((e) => `${e}:${Kt(t[e])}`).join(",") + "}" : String(t), Fi = () => { let t = 1; const e = /* @__PURE__ */ new WeakMap(), r = /* @__PURE__ */ new Map(); return (...n) => n.length === 0 ? "" : n.map((i) => { return String((o = i) === null || typeof o != "object" && typeof o != "function" ? (r.has(o) || r.set(o, t++), r.get(o)) : (e.has(o) || e.set(o, t++), e.get(o))); var o; }).join("::"); }, ji = (t) => { if (!t || typeof t != "string" || t.startsWith("/") || t.startsWith("./") || t.startsWith("../")) return !1; try { let e = t.startsWith("//") ? `http:${t}` : t; return e.includes("://") || e.startsWith("//") || (e = `http://${e}`), !!new URL(e).hostname; } catch { return !1; } }, Mo = (t, e = "") => { if (!t || typeof t != "string" || ji(t)) return t; let r = e; return !r && typeof window < "u" && window.location && (r = `${window.location.protocol}//${window.location.host}`), t.startsWith("/") ? r ? `${r}${t}` : t : r ? `${r}/${t}` : t; }, Ai = () => typeof crypto < "u" && crypto.randomUUID ? crypto.randomUUID() : typeof crypto < "u" && crypto.getRandomValues ? "10000000-1000-4000-8000-100000000000".replace(/[018]/g, (t) => (+t ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> +t / 4).toString(16)) : "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (t) => { const e = 16 * Math.random() | 0; return (t === "x" ? e : 3 & e | 8).toString(16); }), Pt = () => { const t = J(!0), [, e] = E.useReducer((r) => r + 1, 0); return z(() => () => t.current = !1, []), () => t.current && e(); }, Bo = (t) => { const [e, r] = L(t), n = J(null), i = H((o, s) => { n.current = s, r(o); }, []); return z(() => { n.current && (n.current(e), n.current = null); }, [e]), [e, i]; }, pt = (t = (n) => { }, e, r = w.isEqual) => { const n = E.useRef(); r(e, n.current) || (n.current = w.cloneDeep(e)), E.useEffect(t, [n.current]); }, vt = pt, tn = (t, e = "string") => { var r; if (!Array.isArray(t)) return t; for (let n = 0; n < t.length; n++) t[n].value = ce((r = t[n]) == null ? void 0 : r.value, e), t[n] && Reflect.has(t[n], "children") && (t[n].children = tn(t[n].children, e)); return t; }, Uo = (t, e = "json", r = "string", n = null, i = null) => { const [o] = ie.useForm(n), [s, a] = L([{ label: "无", value: "", disabled: !0 }]), l = J([]), c = ie.useWatch((u) => l.current.length === 0 ? null : w.pick(u, l.current), o) || null; return z(() => { Array.isArray(t) ? a(t) : e === "javascript" && t ? We.exec(t, {}, { getFieldValue: (u) => (l.current.includes(u) || l.current.push(u), o.getFieldValue(u)), getFieldValueForBasicForm: (u) => (l.current.includes(u) || l.current.push(u), i ? i.getFieldValue(u) : o.getFieldValue(u)) }).then((u) => { a(ce(u, "array")); }).catch((u) => console.error("useOptions", u)) : t && a(ce(t, "array")); }, [t, e, c]), tn(s, r); }, Wo = (t) => { const [e, r] = L(), n = { type: "GET" }; if (typeof t == "string" ? n.url = t : w.isPlainObject(t) && Object.assign(n, t), !(n != null && n.url)) throw "url is required"; const i = (o) => B.request(n, !1).resp((s) => (console.log("useSubscribeRequest", o), r(s), s)); return pt(() => { let o = null; return i().then((s) => { o = _r.subscribe(w.throttle(i, 180, { leading: !1, trailing: !0 }), s.res); }), () => o == null ? void 0 : o(); }, n), e; }, Ii = (t, e) => H((r) => { const n = {}; for (const [i, o] of Object.entries(r)) { const s = t == null ? void 0 : t[i]; if ((s == null ? void 0 : s.type) === "router" || (s == null ? void 0 : s.type) === "query") { const a = ke.getCurrentRoute(); a != null && a.uuid && ke.redirect(a.uuid, { ...ke.getPageParams(), [s.type]: { [s.value || i]: o } }, { isReplaceRouteHistory: !0 }); } else n[i] = o; } Object.keys(n).length > 0 && e(n); }, [t, e]), rr = (t, e = {}, r = {}, n = []) => { const [i, o] = L({}), [s, a] = L({}), l = Fr(s), c = ke.usePageParams(); Yt(() => { Promise.resolve($t(t, e, r)).then(a); }, [t, e, c, ...n]), Gt(() => { const h = l ?? {}, g = Object.keys({ ...h, ...s }).reduce((f, y) => (h[y] !== s[y] && (f[y] = s[y]), f), {}); Object.keys(g).length > 0 && o((f) => ({ ...f, ...g })); }, [s]); const u = Ii(t, (h) => { o((g) => ({ ...g, ...h })); }), p = W(() => Object.fromEntries(Object.entries(i).filter(([h, g]) => g !== s[h])), [i, s]); return [i, u, p]; }, Li = (t) => { const [e, r] = E.useState({ items: [], hides: [] }); return E.useEffect(() => { t && B.get(`/api/_/${t}`).then(({ pk: n, uuid: i, code: o, resource: s, align: a, cols: l, rowHeight: c, marginX: u, marginY: p, listenChangeFields: h, listenChangeFieldsFunc: g, fields: f, theme: y, themeSetting: k, groups: b }) => ({ pk: n, uuid: i, code: o, resource: s, align: a, cols: l, rowHeight: c, marginX: u, marginY: p, theme: y, themeProps: k, groups: b, listenChangeFields: h, listenChangeFieldsFunc: g, ...f.reduce((x, S) => { var $; return ($ = S == null ? void 0 : S.field) != null && $.hidden ? x.hides.push(S == null ? void 0 : S.field) : x.items.push(S), x; }, { items: [], hides: [] }) })).then(r); }, [t]), e; }, Vi = ({ max: t = 0, min: e = 0, type: r = "", message: n, pattern: i, required: o = !1, validator: s } = {}, a, l) => { const [c, u] = L([]); return z(() => { const p = []; if (o) { let h = l; switch (l) { case "number": case "string": case "array": break; case "bool": h = "boolean"; break; case "json": h = "object"; } p.push({ type: h, required: !0, whitespace: !0, message: "该项必填" }); } switch (r) { case "string": p.push({ type: r, max: t, min: e, message: n || (e && t ? `字符必须在 ${e} ~ ${t} 之间` : `${t ? "最多能有" : "最少要有"} ${e || t} 个字符`) }); break; case "pattern": p.push({ type: "string", pattern: i, message: n }); break; case "validator": s && p.push(({ getFieldValue: h }) => ({ validator: async (g, f) => { const y = await We.exec(s, { value: f, fieldName: a }, { getFieldValue: h }); return w.isString(y) && y ? Promise.reject(y) : w.isBoolean(y) && !y ? Promise.reject(n) : Promise.resolve(); } })); } u(p); }, [t, e, r, n, i, o, s]), c; }, Di = (t, e, r) => { const [n, i] = L(null); return z(() => { const { initDataUri: o = `/api/${t}`, initDataMethod: s = "GET" } = r || {}; e && B.request({ method: s, url: w.trimEnd(`${o}/${e}`, "/") }).then((a) => { i(a); }); }, [t, e, r]), n; }, Mi = (t, e, r) => H((n, i = { serialize: (o) => o, onSuccess: () => { }, onFail: (o) => (o == null ? void 0 : o.errorFields) && Se.error("请先完善表单信息", { duration: 2e3 }) }) => { const o = n.getFieldValue("__RESOURCE__"), { submitDataUri: s = `/api/${t}`, submitDataMethod: a = "POST" } = r || {}; return n.validateFields().then((l) => o ? w.pick(l, [o]) : l).then(i.serialize).then((l) => B.request({ method: a, url: w.trimEnd(`${s}/${e || ""}`, "/"), data: l }).msg(i.onSuccess)).catch(i.onFail); }, [t, e, r]), Bi = (t, e, r, n) => { const i = Di(e, r, n); z(() => { i ? t.setFieldsValue(i) : t.resetFields(); }, [t, i]); const o = Mi(e, r, n); return w.partial(o, t); }, Ui = (t, e, r = [], n = {}) => { const i = J({}), o = J(), s = w.debounce(Pt(), 180), a = ["disabled", "required"], l = (h, g) => { a.includes(h) && (i.current[h] = g), s(); }, c = W(() => ({ setDisabled: (h) => l("disabled", h), setRequired: (h) => l("required", h), getDisabled: () => i.current.disabled, getRequired: () => i.current.required }), [e]), [u, p] = Hr(e, -1, {}, c, n); if (!p && o.current != u && (u >= 0 || !w.isEmpty(r == null ? void 0 : r[u]))) { o.current = u; const { widget: h, widgetPrefix: g, props: f } = r == null ? void 0 : r[u]; t = Mr(h, g), i.current = w.merge(f, w.pick(i.current, a)); } return [t, i.current]; }, $r = (t) => t === void 0 || t === !1 ? "" : (Array.isArray(t) ? t : [t]).join("_"), zo = ({ value: t, onChange: e }, r = null) => { const n = J(), [i] = ie.useForm(r), o = J({}); return vt(() => { w.isEqual(n.current, t) || i.setFieldsValue(t); }, [t]), z(() => () => i.resetFields(), []), [W(() => i.__INTERNAL__ ? i : { ...i, __INTERNAL__: { itemRef: (s) => (a) => { const l = $r(s); a ? o.current[l] = a : delete o.current[l]; } }, scrollToField: (s, a = {}) => { console.warn("useMergedFormValuesChange scrollToField not work, unreferenced antd form"); }, focusField: (s) => { console.warn("useMergedFormValuesChange focusField not work, unreferenced antd form"); }, getFieldInstance: (s) => { const a = $r(s); return o.current[a]; } }, [i]), (s, a) => { n.current = a, e == null || e(a); }]; }, nr = ({ widget: t = "Input", widgetPrefix: e = "@pkg/ff/grid-layout-forms", widgetDecorator: r, subWidgets: n = [], basicForm: i, ...o }) => { const s = Mr(t, e), [a, l] = Ui(s, r, n, i), [c, u] = L(); return z(() => { a && Z.getWidgetComponent(a).then(({ defaultProps: p = {}, default: h }) => ({ default: Wi(h, p, i) })).catch((p) => ({ default: () => `${p}` })).then((p) => u(E.createElement(p.default, o))); }, [a]), c && E.cloneElement(c, { ...o, ...l }); }, Wi = (t, e = {}, r = null) => (n) => { const { type: i, code: o, label: s, noStyle: a, style: l, placeholder: c, required: u = !1, extras: p, validators: h, help: g, isVirtual: f, $isReserved: y, initialValue: k, initialValueLanguage: b, ...x } = w.omit(w.merge({}, e, n), ["convertJs", "convertJsSetting", "widget", "widgetPerfix", "widgetDecorator", "subWidgets", "boxStyle"]), S = Vi(Object.assign({}, h, u ? { required: !0 } : {}), o, i), $ = W(() => { const D = Object.keys((e == null ? void 0 : e.extras) || {}); return w.over([w.partialRight(w.pick, D), w.partialRight(w.omit, D)]); }, [e == null ? void 0 : e.extras]), [F, A] = $(x), O = { label: s, noStyle: a, style: l, colon: !1, layout: "vertical" }, T = H((D) => D == null ? void 0 : ce(D, i), [i]); return m(Xt, { name: o, rules: S, initialValue: T(k), normalize: T, children: (D, P, V) => { var M; return m(t, { type: i, rcform: V, basicForm: r, itemProps: { validateStatus: P.errors.length > 0 ? "error" : "success", tooltip: g || null, help: P.errors.length > 0 ? P.errors.join("、") : null, required: ((M = S == null ? void 0 : S[0]) == null ? void 0 : M.required) || !1, ...O }, fieldProps: { placeholder: c, ...A, ...D }, $setting: Object.assign({}, p, F) }); } }); }, ir = ({ name: t, form: e = null, basicForm: r = null, style: n = {}, className: i, cols: o = 24, rowHeight: s = 16, itemMargin: a = [8, 16], containerPadding: l = [0, 0], fields: c = [], hides: u = [], primaryKey: p = 0, formProps: h = {}, formFields: g = [], listenChangeFields: f, listenChangeFieldsFunc: y, onValuesChange: k, theme: b, themeProps: x = {}, groups: S = [{ key: "default", label: "默认" }], children: $, ...F }) => { const [A] = ie.useForm(e), O = H((P, V) => { k == null || k(P, V), y && Array.isArray(f) && We.exec(y, { changedValues: P, allValues: V }, { getFieldValue: A.getFieldValue, setFieldValue: A.setFieldValue, setFieldsValue: A.setFieldsValue, isFieldTouched: A.isFieldTouched, isFieldsTouched: A.isFieldsTouched }).catch((M) => console.error("onFormValuesChange", t, M)); }, [t, A, k, f, y]), T = W(() => [{ name: "__PROPS__", value: h }, { name: "__PRIMARY_KEY__", value: p }].concat(g), [p, h, g]), D = (P, V, M) => { const U = er(V, nr, r), X = zr(F); return I("div", { ...X, className: j("ff-grid-layout-form", i), style: { ...n, "--grid-layout-item-margin-x": `${(a == null ? void 0 : a[0]) ?? 8}px`, "--grid-layout-item-margin-y": `${(a == null ? void 0 : a[1]) ?? 16}px`, "--grid-layout-container-padding-y": `${(l == null ? void 0 : l[0]) || 0}px`, "--grid-layout-container-padding-x": `${(l == null ? void 0 : l[1]) || 0}px`, "--grid-layout-cols": o, "--grid-layout-row-height": `${s}px` }, children: [U, M && E.cloneElement(M, { cols: o, rowHeight: s, itemMargin: a, containerPadding: l, fields: V, basicForm: r })] }); }; return I(ie, { ...F, form: A, fields: T, onValuesChange: O, children: [b ? m(Yr, { ...x, items: S, theme: b, itemRender: D, fields: c, children: $, basicForm: r }) : D(0, c, $), u == null ? void 0 : u.map((P) => { var V; return m(Xt, { name: P.code, children: m(zi, { form: A, basicForm: r, name: P.code, type: P.type, initialValue: P.initialValue, initialValueLanguage: (V = P.extras) == null ? void 0 : V.initialValueLanguage }) }, JSON.stringify(P.code)); })] }); }, zi = ({ type: t, initialValue: e, initialValueLanguage: r, onChange: n, basicForm: i }) => { const [o, s] = Hr(r == "javascript" && e, r == "javascript" ? void 0 : e, {}, {}, i); return z(() => { r == "javascript" ? n(ce(o, t)) : e && n(ce(e, t)); }, [t, e, o]), null; }; ir.propTypes = { fields: C.array, hides: C.array }; const qi = /* @__PURE__ */ ((t) => ({ code: e, isPreview: r = !1, ...n }) => { const { align: i, autoComplete: o, resource: s, items: a, hides: l, rowHeight: c, marginX: u, marginY: p, cols: h, listenChangeFields: g, listenChangeFieldsFunc: f, pk: y, uuid: k, theme: b, themeProps: x, groups: S } = Li(e), $ = W(() => [{ name: "__PK__", value: y }, { name: "__RESOURCE__", value: s }, { name: "__LAYOUT_KEY__", value: e }, { name: "__LAYOUT_UUID__", value: k }], [y, e, k, s]); return m(t, { name: e, autoComplete: o, theme: b, themeProps: x, groups: S, ...n, formFields: $, listenChangeFields: g, listenChangeFieldsFunc: f, fields: a, hides: l, cols: h, rowHeight: c, itemMargin: [u, p] }); })(ir), rn = ({ $setting: t, $close: e, extras: r, code: n, primaryKey: i, ...o }) => { const [s] = ie.useForm(), a = Bi(s, n, i, t); return m(re, { actions: I(E.Fragment, { children: [m(R, { name: (t == null ? void 0 : t.okText) || "保存", type: "primary", widget: () => a({ onSuccess: e }) }), m(R, { name: (t == null ? void 0 : t.cancelText) || "取消", widget: () => e(!1) })] }), extras: r, children: m(qi, { form: s, code: n, primaryKey: i, ...o }) }); }, Pr = /* @__PURE__ */ new Set(), _t = (t = [], e = 0) => { const r = t[e]; if (r.length && !Pr.has(r)) { const n = document.createElement("script"); n.setAttribute("src", r), n.setAttribute("data-namespace", r), t.length > e + 1 && (n.onload = () => { _t(t, e + 1); }, n.onerror = () => { _t(t, e + 1); }), Pr.add(r), document.body.appendChild(n); } }, Ct = ({ className: t, type: e, style: r = {}, rotate: n, spin: i, twoToneColor: o, compact: s, ...a }) => m("span", { role: "img", className: j("ff-iconfont", s && "ff-iconfont--compact", t), style: r, ...a, children: m("svg", { style: { width: "1em", height: "1em", fill: "currentColor", overflow: "hidden", ...n != null && { transform: `rotate(${n}deg)` }, ...i && { animation: "ff-iconfont-spin 1s linear infinite" }, ...o && { "--ff-icon-second-color": o } }, viewBox: "0 0 1024 1024", children: m("use", { xlinkHref: `#${e}` }) }) }); Ct.propTypes = { className: C.string, type: C.string.isRequired, style: C.object }, Ct.init = _t; const Ki = (t, e, r, n) => ke.redirect(r, e, n), _i = (t, e = {}, r, n = {}) => { var o; const i = (o = n.router) == null ? void 0 : o.reduce((s, [a, l, c]) => { const u = w.get(e, ["router", a]); if (!u && u !== 0 && l) throw `请传入 ${c}`; return `${s}/${u}`; }, `/api/${r}`); return B.del(i, e.param).msg(); }, vr = (t, e, r, { status: { loading: n, disabled: i }, setStatus: o, listFn: s }) => { const a = { loading: (l) => l === void 0 ? n : o((c) => ({ ...c, loading: l })), disabled: (l) => l === void 0 ? i : o((c) => ({ ...c, disabled: l })), list: s }; return w.isFunction(r) ? r.call(null, e, a) : w.isString(r) && r ? We.exec(r, e, a) : null; }, Nr = (t, e, r, n, i) => w.isString(r) && r ? Z.getWidgetComponent(r).then(({ default: o }) => Se.modal(o, { ...e, $setting: n }, i != null && i.title ? { ...i, title: w.template(i.title)(t) } : i)).catch((o) => { Se.error(r, { content: o.toString() }); }) : Se.modal(r, { ...e, $setting: n }, i != null && i.title ? { ...i, title: w.template(i.title)(t) } : i), Ji = (t, e, r, n, i) => Se.modal(rn, { ...e, $setting: n, code: r }, i != null && i.title ? { ...i, title: w.template(i.title)(t) } : i), Hi = (t, e, r, n, i) => Se.modal(tr, { ...n, base62params: e, listCode: r }, i != null && i.title ? { ...i, title: w.template(i.title)(t) } : i), Yi = ({ widget: t, widgetType: e, widgetData: r, widgetProps: n, widgetSetting: i, widgetContainerProps: o }, { onAfterClick: s, onBeforeClick: a } = {}) => { const l = de(oe), [c, u] = L({ leading: !0, trailing: !1 }), p = J(null), [h, g] = W(() => { switch (e) { case "redirect": return [w.partialRight(Ki, t, i), null]; case "func": return [w.partialRight(vr, (i == null ? void 0 : i.code) ?? t, { status: c, setStatus: u, listFn: l }), null]; case "component": case "fsdpf-component": return [w.partialRight(Nr, t, i, o), (y) => ({ $setting: y })]; case "grid-layout-form": return [w.partialRight(Ji, t, i, o), (y) => ({ $setting: y })]; case "data-list": return [w.partialRight(Hi, t, i, o), (y) => y]; case "destroy": return [w.partialRight(_i, t, i, o), null]; default: if (an(t) || E.isValidElement(t)) return [w.partialRight(Nr, t, i, o), (y) => ({ $setting: y })]; if (w.isFunction(t)) return [w.partialRight(vr, (i == null ? void 0 : i.code) || t, { status: c, setStatus: u }), null]; } return [(...y) => console.error("useButton unknown widgetType", e, ...y), null]; }, [t, e, i, o, l.getBase62params, l.getSelectedRows]), f = w.debounce((y) => (a == null || a(y), Promise.resolve($t(n, y, { list: l })).then((k) => { const b = h(y, { ...r, ...k }); return b != null && b.update && g && (p.current = (x, S) => b.update(g(x), S)), b; }).then((k) => s == null ? void 0 : s(k)).catch(console.error)), 300, { leading: !0, trailing: !1 }); return Gt(() => { var y; (y = p.current) == null || y.call(p, i, o); }, [i, o]), [f, c]; }, nn = ({ type: t, name: e, className: r, icon: n, iconPosition: i, size: o }, s = "default") => W(() => { const a = { type: "primary", className: j("ff-button", r), iconPosition: i, size: o }; return t === "danger" ? a.danger = !0 : t === "default" && (a.type = t), s === "link" || s === "dashed" ? (a.type = s, t === "default" && (a.className = j(a.className, "ff-default"))) : s !== "circle" && s !== "round" || (a.shape = s), n && (a.icon = m(Ct, { type: n })), e && (a.children = e), a; }, [s, t, r, n, i]), Nt = ({ data: t, widget: e, widgetType: r = "fsdpf-component", widgetData: n, widgetProps: i, widgetSetting: o, widgetContainerProps: s, onAfterClick: a, onBeforeClick: l, children: c, extras: u }) => { const p = de(oe), [h, g] = L(!1), [f, y] = L("hover"), [k, b] = rr(i, t, { list: p }, [p.getBase62params, p.getSelectedRows]), [x, S] = L(), { placement: $, align: F, zIndex: A, arrow: O = { pointAtCenter: !0 }, getPopupContainer: T, isPopupMountBodyContainer: D = !0, ...P } = s || {}; z(() => { r == "grid-layout-form" ? S(E.createElement(rn, { ...n, $setting: o, code: e })) : r == "data-list" ? S(E.createElement(tr, { base62params: t, $setting: o, listCode: e })) : w.isString(e) ? Z.getWidgetComponent(e).then(({ default: U }) => { S(E.createElement(U, { ...n, $setting: o })); }).catch((U) => S(U.toString())) : E.isValidElement(e) ? S(E.cloneElement(e, { ...n, $setting: o })) : (an(e) || w.isFunction(e) && ["component", "fsdpf-component"].includes(r)) && S(E.createElement(e, { ...n, $setting: o })); }, [e, r, n]); const V = (U, X = !1) => (g(U), !U && y("hover"), U ? l == null ? void 0 : l(k) : a == null ? void 0 : a(X)), M = (U) => { g(!0), y("click"); }; return m(zn, { zIndex: A, placement: $, onPopupClick: M, onClick: M, open: h, align: F, arrow: O, trigger: f, getPopupContainer: T || D ? void 0 : (U) => U, content: m(Gi, { ...P, extras: u, children: x && E.cloneElement(x, { ...k, $setProps: b, $close: (U) => V(!1, U) }) }), children: c, onOpenChange: V }); }, Gi = ({ title: t, className: e, classNames: r, children: n, extras: i, width: o, height: s, style: a, ...l }) => { const [c, u] = L({}), p = H((y, k) => u((b) => ({ ...b, [y]: k })), []), h = H((y) => u((k) => ({ ...k, [y]: void 0 })), []), g = t ? E.createElement("div", { className: "ff-popup-title" }, t) : c == null ? void 0 : c.title, f = i ?? E.createElement("div", { className: "ff-popup-reserved-extras" }, i); return m(ut.Provider, { value: { ele: c, mount: p, unmount: h }, children: I("div", { className: j("ff-popup ff-popover", e, c.rootClassName), style: { ...a, width: o ?? 260, height: s }, ...l, children: [I("div", { className: j("ff-popup-header", "ff-popover-header", r == null ? void 0 : r.header), children: [g, c == null ? void 0 : c["sub-title"]] }), m("div", { className: j("ff-popup-body", "ff-popover-body", r == null ? void 0 : r.body), children: n }), I("div", { className: j("ff-popup-footer", "ff-popover-footer", r == null ? void 0 : r.footer), children: [f, c == null ? void 0 : c.extras, c == null ? void 0 : c.actions] })] }) }); }; Nt.propTypes = { widgetType: C.oneOf(["fsdpf-component", "grid-layout-form", "data-list"]) }; const gt = (t) => function({ className: e, variant: r, children: n, name: i, icon: o, type: s = "default", iconPosition: a = "start", noAuthType: l, onAfterClick: c, onBeforeClick: u, data: p, loading: h, disabled: g, tooltip: f, confirm: y, widget: k = () => { }, widgetType: b, widgetData: x, widgetProps: S, widgetSetting: $, widgetContainerProps: F, ...A }) { const { mode: O, ...T } = F || {}, D = nn({ className: e, name: i, type: s, icon: o, iconPosition: a }, r ?? t), P = m(wt, { ...D, ...A, children: n || i }); if (O === "popover" && !["destroy", "redirect", "func"].includes(b)) return m(Nt, { data: p, widget: k, widgetType: b, widgetData: x, widgetProps: S, widgetSetting: $, widgetContainerProps: T, onAfterClick: c, onBeforeClick: u, children: P }); const V = w.isEmpty(f) || !f.enabled ? {} : f, M = w.isEmpty(y) ? { enabled: !1 } : Object.assign({ enabled: !0 }, y), [U, X] = L(!1), [Ee, { disabled: q, loading: se }] = Yi({ widget: k, widgetType: b, widgetData: x, widgetProps: S, widgetSetting: $, widgetContainerProps: T }, { onAfterClick: c, onBeforeClick: u }); return m(qn, { okText: "确定", cancelText: "取消", getPopupContainer: (_) => _, ...M, disabled: q || g, open: U, onOpenChange: (_) => { if (!_) return X(_); M.enabled ? X(_) : Ee(p); }, onConfirm: (_) => { Ee(p, _); }, onClick: (_) => { _.stopPropagation(); }, children: m(Kn, { getPopupContainer: (_) => _, ...V, title: U ? null : V == null ? void 0 : V.title, trigger: ["hover", "click"], children: E.cloneElement(P, { loading: se || h, disabled: q || g }) }) }); }, R = gt("default"); R.propTypes = { type: C.oneOf(["primary", "default", "danger", ""]), size: C.oneOf(["large", "middle", "small"]), name: C.string, icon: C.string, iconPosition: C.oneOf(["start", "end"]), data: C.any, widget: C.any, widgetType: C.oneOf(["destroy", "redirect", "func", "component", "fsdpf-component", "grid-layout-form", "grid-layout", "data-list"]), widgetData: C.object, widgetProps: C.object, widgetSetting: C.object, widgetContainerProps: C.object, tooltip: C.exact({ title: C.string.isRequired, placement: C.oneOf(["top", "left", "right", "bottom", "topLeft", "topRight", "bottomLeft", "bottomRight", "leftTop", "leftBottom", "rightTop", "rightBottom"]), enabled: C.oneOfType([C.bool, C.number]), getPopupContainer: C.func }), confirm: C.exact({ title: C.string.isRequired, cancelText: C.string, okText: C.string, okType: C.oneOf(["primary", "default", "danger", ""]), placement: C.oneOf(["top", "left", "right", "bottom", "topLeft", "topRight", "bottomLeft", "bottomRight", "leftTop", "leftBottom", "rightTop", "rightBottom"]), enabled: C.oneOfType([C.bool, C.number]), getPopupContainer: C.func, arrow: C.oneOfType([C.bool, C.exact({ pointAtCenter: C.bool })]) }) }; const Xi = gt("link"), Zi = gt("circle"), Qi = gt("round"), eo = gt("dashed"), Tr = ({ options: t = [], triggerWeights: e = ["grid-layout-form", "grid-layout", "fsdpf-component", "print"], onAfterClick: r = (g, f, y) => { }, onBeforeClick: n = (g, f, y) => { }, labelVariant: i = "link", labelSize: o, labelRender: s, btnVariant: a, btnSize: l, btnRender: c = (g, f) => m(R, { ...g, data: f }, g.uuid || Lt()), widgetContainerProps: u = {}, children: p, data: h }) => { if (w.isEmpty(t)) return p; l ?? (l = o), a ?? (a = i); const [g, f] = W(() => (t || []).reduce((b, x) => { const S = e.indexOf(x.widgetType); return S === -1 ? b[1].push(x) : b[0] ? S < e.indexOf(b[0].widgetType) ? (b[1].push(b[0]), b[0] = x) : b[1].push(x) : b[0] = x, b; }, [null, []]), [t, e]); s ? p = s(g, h) || p : p || (p = m(wt, { ...nn(Object.assign(g != null && g.name || g != null && g.icon ? {} : { icon: "icon-location" }, g, { size: o }), i) })); const y = f.map((b) => c(Object.assign({ uuid: b.uuid, type: b.type, name: b.name, widget: b.widget, widgetType: b.widgetType, widgetProps: b.widgetProps, widgetData: b.widgetData, widgetSetting: b.widgetSetting, widgetContainerProps: b.widgetContainerSetting, confirm: b.confirm, onAfterClick: w.partialRight(r, b, h), onBeforeClick: w.partialRight(n, b, h) }, { size: l, variant: a }), h)); let k = y; return (y == null ? void 0 : y.length) > 1 && (k = a == "link" ? m(Dt, { split: m(_n, { type: "vertical" }), size: l, children: y }) : m(Dt.Compact, { size: l, children: y })), g ? m(Nt, { widget: g == null ? void 0 : g.widget, widgetType: g == null ? void 0 : g.widgetType, widgetProps: g == null ? void 0 : g.widgetProps, widgetSetting: g == null ? void 0 : g.widgetSetting, widgetContainerProps: Object.assign({}, u, g == null ? void 0 : g.widgetContainerProps), data: h, widgetData: g == null ? void 0 : g.widgetData, extras: k, onAfterClick: w.partialRight(r, g, h), onBeforeClick: w.partialRight(n, g, h), children: p }) : k; }; Tr.propTypes = { triggerWeights: C.array, options: C.arrayOf(C.shape({ ...R.propTypes, widgetType: R.propTypes.widgetType.isRequired })), btnSize: R.propTypes.size, btnRender: C.func, btnVariant: C.oneOf(["", "default", "link", "circle", "round", "dashed"]), labelVariant: C.oneOf(["", "default", "link", "circle", "round", "dashed"]), labelRender: C.func, labelSize: R.propTypes.size, onAfterClick: C.func, onBeforeClick: C.func, widgetContainerProps: R.propTypes.widgetContainerProps, data: R.propTypes.data }, R.Link = Xi, R.Link.defaultProps = R.defaultProps, R.Link.propTypes = R.propTypes, R.Circle = Zi, R.Circle.defaultProps = R.defaultProps, R.Circle.propTypes = R.propTypes, R.Round = Qi, R.Round.defaultProps = R.defaultProps, R.Round.propTypes = R.propTypes, R.Dashed = eo, R.Dashed.defaultProps = R.defaultProps, R.Dashed.propTypes = R.propTypes, R.Popover = Nt, R.GroupPopover = Tr; const to = ({ fields: t, formProps: e, $close: r }) => { const [n] = ie.useForm(), i = W(() => [{ name: "__PROPS__", value: e }], [e]); return m(re, { actions: I(E.Fragment, { children: [m(R, { name: "取消", widget: () => r(!1) }), m(R, { name: "确定", type: "primary", widget: () => n.validateFields(!0).then(r) })] }), children: m(ie, { fields: i, form: n, className: "ff-modal-form", children: t == null ? void 0 : t.map(({ code: o, ...s }) => m(nr, { code: o, ...s }, o)) }) }); }, ro = ({ className: t, classNames: e, $close: r, children: n, title: i, subTitle: o, actions: s, extras: a, ...l }) => I(Qn, { ...l, prefixCls: "ff-drawer", className: j("ff-popup", t), maskMotion: { motionAppear: !0, motionName: "mask-motion" }, motion: (c) => ({ motionAppear: !0, motionName: `panel-motion-${c}` }), children: [I("div", { className: j("ff-popup-header", "ff-drawer-header", e == null ? void 0 : e.header), children: [m("button", { "aria-label": "Close", className: j("ff-popup-close", "ff-drawer-close", e == null ? void 0 : e.close), onClick: l.onClose, children: m(Qt, { type: "close" }) }), i, o] }), m("div", { className: j("ff-popup-body", "ff-drawer-body", e == null ? void 0 : e.body), children: n }), I("div", { className: j("ff-popup-footer", "ff-drawer-footer", e == null ? void 0 : e.footer), children: [a, s] })] }), no = ({ className: t, classNames: e, $close: r, $event: n, children: i, title: o, subTitle: s, actions: a, extras: l, placement: c, ...u }) => { const { style: p, rest: h } = ((f, y = ["height", "width", "style"]) => { const k = { ...f }, b = {}; for (const x of y) x === "style" ? Object.assign(b, k.style) : k[x] !== void 0 && (b[x] = k[x]), delete k[x]; return { style: b, rest: k }; })(u), g = (n == null ? void 0 : n.pageX) === void 0 ? { animation: null, maskAnimation: null, mousePosition: { x: null, y: null } } : { animation: "zoom", maskAnimation: "fade", mousePosition: { x: n == null ? void 0 : n.pageX, y: n == null ? void 0 : n.pageY } }; return m(ei, { ...h, ...g, prefixCls: "ff-modal", className: j("ff-popup", t), modalRender: () => I(E.Fragment, { children: [m("button", { className: j("ff-popup-close", "ff-modal-close", e == null ? void 0 : e.close), onClick: h.onClose, children: m(Qt, { type: "close" }) }), I("div", { className: j("ff-modal-content"), style: p, children: [I("div", { className: j("ff-popup-header", "ff-modal-header", e == null ? void 0 : e.header), children: [o, s] }), m("div", { className: j("ff-popup-body", "ff-modal-body", e == null ? void 0 : e.body), children: i }), I("div", { className: j("ff-popup-footer", "ff-modal-footer", e == null ? void 0 : e.footer), children: [l, a] })] })] }) }); }, on = ({ placement: t, $close: e, $event: r, children: n, title: i, ...o }) => { const [s, a] = L({}), [l, c] = L(!0), u = H((f, y) => a((k) => ({ ...k, [f]: y })), []), p = H((f) => a((y) => ({ ...y, [f]: void 0 })), []); let h = { ...o, className: s.rootClassName, title: s.title || i && E.createElement("div", { className: j("ff-popup-title") }, i), subTitle: s["sub-title"], actions: s.actions, extras: s.extras, children: n, $close: e, $event: r, onClose: () => c(!1) }; const g = () => { e(!1); }; return m(ut.Provider, { value: { ele: s, mount: u, unmount: p }, children: t && t !== "center" ? m(ro, { ...h, placement: t, open: l, afterOpenChange: (f) => !f && g() }) : m(no, { ...h, visible: l, afterClose: g }) }); }; on.propTypes = { placement: C.oneOf(["center", "left", "top", "right", "bottom"]) }; const io = ({ widget: t, widgetProps: e, $close: r, onSetProps: n }) => { const [i, o] = L(e || {}), s = Fr(e); Yt(() => { const l = s ?? {}, c = e ?? {}, u = Object.keys({ ...l, ...c }).reduce((p, h) => (l[h] !== c[h] && (p[h] = c[h]), p), {}); Object.keys(u).length > 0 && o((p) => ({ ...p, ...u })); }, [e]); const a = H((l) => { o((c) => ({ ...c, ...l })), n == null || n(l); }, [n]); return E.isValidElement(t) ? E.cloneElement(t, { ...i, $close: r, $setProps: a }) : t != null && t.name || Cr.isForwardRef(t) || (t == null ? void 0 : t.$$typeof) === Cr.ForwardRef ? E.createElement(t, { ...i, $close: r, $setProps: a }) : t; }, G = () => { const [t, e] = jn({ maxCount: 6, motion: { motionName: "ff-notification-fade", motionAppear: !0, motionEnter: !0, motionLeave: !0, onLeaveStart: (o) => { const { offsetHeight: s } = o; return { height: s }; }, onLeaveActive: () => ({ height: 0, opacity: 0, margin: 0 }) }, prefixCls: "ff-notification" }), [, r] = E.useReducer((o) => o + 1, 0); z(() => { G.$onClick = n, G.$queue.forEach(([o, s, a, l]) => { l == null || l(i([s, a], ...o)); }), G.$queue = []; }, []); const n = (o, s = {}, a = {}) => { let l; const c = new Promise((u, p) => { l = i([u, p], o, s, a); }); return c.update = l, c; }, i = ([o, s], a, l = {}, c = {}) => { const u = G.$index++, p = (f) => ((y, k) => (G.$popups.delete(y), r(), k == null ? void 0 : k()))(u, () => o(f)); if (a === Vr) return t.open({ ...c, key: u, content: E.createElement(a, { ...l, $close: () => t.close(u) }), onClose: () => p() }), () => { }; const { $setProps: h, ...g } = l; return G.$popups.set(u, { widget: a, widgetProps: g, widgetContainerProps: c, $close: p, onSetProps: h }), r(), (f, y) => { const k = G.$popups.get(u); k && (G.$popups.set(u, { ...k, widgetProps: f ? { ...k.widgetProps, ...f } : k.widgetProps, widgetContainerProps: y ? { ...k.widgetContainerProps, ...y } : k.widgetContainerProps }), r()); }; }; return I(E.Fragment, { children: [Array.from(G.$popups).map(([o, { widget: s, widgetProps: a, widgetContainerProps: l, $close: c, onSetProps: u }]) => m(on, { maskClosable: !1, $event: a == null ? void 0 : a.$event, ...l, $close: c, children: m(io, { widget: s, widgetProps: a, $close: c, onSetProps: u }) }, o)), e] }); }; G.$popups = /* @__PURE__ */ new Map(), G.$index = 0, G.$queue = [], G.$onClick = (...t) => { const e = new Promise((r, n) => { G.$queue.push([t, r, n, (i) => { e.update = i; }]); }); return e; }; const Or = (t, e, r = {}) => G.$onClick(t, e, r), jt = (t, { showProgress: e, duration: r, ...n } = { duration: 1.5 }) => G.$onClick(Vr, { content: t, ...n }, { showProgress: e, duration: r }), Se = { modal: Or, confirm: (t, e = {}) => G.$onClick(ni, { content: t, ...e }, { placement: "center" }), form: (t, e = {}, r = {}) => Or(to, { formProps: r, fields: t }, { placement: "center", ...e }).then((n) => { if (n === !1) throw !1; return n; }), notification: jt, success: (t, e = { duration: 1.5 }) => jt(t, { ...e, className: "ff-notification-success", icon: "check" }), error: (t, e = { duration: 1.5 }) => jt(t, { ...e, className: "ff-notification-error", icon: "close" }) }; Xe.configure({ showSpinner: !1 }); const sn = () => { const t = window.localStorage.getItem(yt); return Object.freeze({ Platform: "web", SaaS: window.localStorage.getItem("SaaS"), Authorization: t ? `Bearer ${t} ` : void 0 }); }; Le.interceptors.request.use((t) => (Object.assign(t.headers, sn()), Xe.inc(), t), (t) => (Xe.done(), Promise.reject({ code: -1, msg: t }))), Le.interceptors.response.use(({ data: t, headers: e }) => (Xe.done(), { ...t, res: e == null ? void 0 : e.res }), function(t) { return Xe.done(), Promise.reject(t.message); }), window.addEventListener("unhandledrejection", Vt.onUnhandledRejection), Vt.onMsg = (t, e) => Se[[0, 1].includes(t) ? "success" : "error"](e).then(() => t === 20300 && ke.redirect(Ue.get("Common.WEBSITE_LOGIN_PAGE"))); var Je, Be, He; const ee = class ee { constructor() { N(this, "appUrl", ""); v(this, Je, null); return d(ee, Be) || (K(ee, He, new Vt()), K(ee, Be, new Proxy(this, { get(e, r) { if (r in e) { const n = Object.getOwnPropertyDescriptor(Object.getPrototypeOf(e), r); return n != null && n.get ? Reflect.get(e, r, e) : typeof e[r] == "function" ? e[r].bind(e) : e[r]; } return d(ee, He)[r]; } }))), d(ee, Be); } init(e, r, n) { Le.defaults.baseURL = this.appUrl = n, Le.defaults.timeout = 15e3, d(ee, He).init(e, r, Le); } get driver() { return Le; } get headers() { return sn(); } mock(e = {}) { return d(this, Je) ?? K(this, Je, new Ln(Le, { onNoMatch: "passthrough", ...e })); } unmock() { var e; (e = d(this, Je)) == null || e.restore(), K(this, Je, null); } }; Je = new WeakMap(), Be = new WeakMap(), He = new WeakMap(), v(ee, Be), v(ee, He), N(ee, "getInstance", () => d(ee, Be) ?? K(ee, Be, new ee())); let Jt = ee; const B = Jt.getInstance(); class or extends Error { constructor(e, r) { super(r), Error.captureStackTrace && Error.captureStackTrace(this, or), !r instanceof Ze && (this.name = `${e} Error Runtime`); } } class Ze extends Error { constructor(e, ...r) { super(...r), Error.captureStackTrace && Error.captureStackTrace(this, Ze), this.name = `${e} Not Found`; } } const At = "mine", yt = "token", It = "user-login-intended-url"; var Ae, Ye, ot; const fe = class fe { constructor() { v(this, Ye, /* @__PURE__ */ new Map()); v(this, ot, (/* @__PURE__ */ new Date()).toISOString().slice(0, 10)); N(this, "setPkgVersion", (e) => { K(this, ot, e); }); N(this, "setVendor", (e, r) => d(this, Ye).set(e, new ti(r, async (n, i) => { var s, a; if (!(n != null && n.default)) throw "@pkg not found"; let o = () => i; switch ("function") { case typeof (o = (s = n.default) == null ? void 0 : s[`./${i}/index.jsx`]): case typeof (o = (a = n.default) == null ? void 0 : a[`./${i}/index.js`]): return o(); } throw new Ze(i); }))); N(this, "getWidgetComponent", async (e) => { if (!e) throw "getWidgetComponent widget is required"; if (e != null && e.startsWith("blob:") || e != null && e.startsWith("http:") || e != null && e.startsWith("https:")) return await import(e); const [, r] = e == null ? void 0 : e.split("@pkg/"); if (!r) throw new Ze(e); try { return d(this, Ye).has("pkg") ? await d(this, Ye).get("pkg").get(r) : await import(`${B.appUrl}/api/pkg-import/web?name=${e}&v=${d(this, ot)}`); } catch (n) { throw new or(e, n); } }); N(this, "getRoutes", () => B.get("/api/my-router").then((e) => [...e, { uuid: "data-list-setting", isLayout: !0, uri: "/data-list-setting/:category/:categoryUuid", type: "fsdpf-component", component: "@pkg/ff-design/components/DataListSetting", extra: { layout: "@pkg/ff-design/frameworks/DesignTheme" } }, { uuid: "grid-layout-setting", isLayout: !0, uri: "/grid-layout-setting/:category/:categoryUuid", type: "fsdpf-component", component: "@pkg/ff-design/components/GridLayoutSetting", extra: { layout: "@pkg/ff-design/frameworks/DesignTheme" } }, { uuid: "grid-layout-form-setting", isLayout: !0, uri: "/grid-layout-form-setting/:category/:categoryUuid", type: "fsdpf-component", component: "@pkg/ff-design/components/GridLayoutFormSetting", extra: { layout: "@pkg/ff-design/frameworks/DesignTheme" } }, { uuid: "resource-api-setting", isLayout: !0, uri: "/resource-api-setting/:category/:categoryUuid", type: "fsdpf-component", component: "@pkg/ff-design/components/ResourceApiSetting", extra: { layout: "@pkg/ff-design/frameworks/DesignTheme" } }, { uuid: "charts-setting", isLayout: !0, uri: "/resource-api-setting/:category/:categoryUuid", type: "fsdpf-component", component: "@pkg/ff-design/components/ChartsSetting", extra: { layout: "@pkg/ff-design/frameworks/DesignTheme" } }, { uuid: "fsm-setting", isLayout: !0, uri: "/fsm-setting/:category/:categoryUuid", type: "fsdpf-component", component: "@pkg/ff-design/components/FsmSetting", extra: { layout: "@pkg/ff-design/frameworks/DesignTheme" } }, { uuid: "component-setting", isLayout: !0, uri: "/component-setting/:category/:categoryUuid", type: "fsdpf-component", component: "@pkg/ff-design/components/ComponentSetting", extra: { layout: "@pkg/ff-design/frameworks/DesignTheme" } }, { uuid: "login", uri: "/login", name: "登录", type: "fsdpf-component", isLogin: !1, component: "@pkg/ff/components/Login" }, { uuid: "not-found", uri: "*", name: "Not Found", type: "fsdpf-component", isLogin: !1, component: "@pkg/ff/components/NotFound" }].map(({ uuid: r, ...n }) => [r, { uuid: r, ...n }])).then((e) => new Map(e))); N(this, "getMenus", () => B.get("/api/my-menu")); N(this, "getConfigure", () => B.get("api/init-configure")); N(this, "getWidgetOperationAuth", () => B.get("/api/init-widget-operation-auth").then((e) => e.reduce((r, { uuid: n, auth: i }) => [...r, [n, i]], []))); N(this, "getPhoneNumber", (e) => B.get(`/api/user-wx-phone-number/${e}`)); N(this, "getUserToken", () => { const e = window.localStorage.getItem(yt); if (!e) return ""; const r = e.split("."); if (!Array.isArray(r) || r.length !== 3) throw "登录令牌无效!"; const { iat: n } = JSON.parse(window.atob(r[1])); if (Math.floor((/* @__PURE__ */ new Date()).getTime() / 1e3) - n > 2592e3) throw "登录令牌已过期, 请重新登录!"; return e; }); N(this, "checkUserToken", () => { try { return !!this.getUserToken(); } catch { return !1; } }); N(this, "getUserInfo", (e = !0) => { var r; try { const n = this.getUserToken(); if (!n) return Promise.resolve(null); const { iat: i } = JSON.parse(window.atob((r = n == null ? void 0 : n.split(".")) == null ? void 0 : r[1])), { iat: o, ...s } = B.decode(window.localStorage.getItem(At) || "", {}); return o === i ? Promise.resolve(s) : B.get("/api/mine-info").then(({ User: a = null }) => (window.localStorage.setItem(At, B.encode({ ...a, iat: i })), a)).catch((a) => (console.error(a), e && Se.error("请登录").then(this.logout), null)); } catch (n) { console.error(n), e && Se.error("请登录").then(this.logout); } return Promise.resolve(null); }); N(this, "login", (e, r, n = {}) => B.post("/api/user-token", { username: e, passwd: Vn.hash(r), platform: "web", ...n }).then(({ token: i }) => (window.localStorage.setItem(yt, i), i)).then(async (i) => (await this.initAppEnv(), i))); N(this, "setLoginIntendedUrl", (e) => sessionStorage.setItem(It, e)); N(this, "getLoginIntendedUrl", (e = !1) => { const r = sessionStorage.getItem(It); return e && sessionStorage.removeItem(It), r; }); N(this, "logout", (e) => (window.localStorage.removeItem(At), window.localStorage.removeItem(yt), e == null ? void 0 : e())); N(this, "initAppEnv", async () => { const [e, r, n, i] = await Promise.all([this.getWidgetOperationAuth(), this.getRoutes(), this.getMenus(), this.getConfigure()]); return Dr.init(e), Ue.init(i), ke.init(r, n), Ct.init(Ue.get("Common.ICONFONT")), { widgetOperationAuth: e, routes: r, menus: n, configures: i }; }); if (d(fe, Ae)) return d(fe, Ae); } }; Ae = new WeakMap(), Ye = new WeakMap(), ot = new WeakMap(), v(fe, Ae, null), N(fe, "getInstance", () => (d(fe, Ae) || K(fe, Ae, new fe()), d(fe, Ae))); let Ht = fe; const Z = Ht.getInstance(), qo = E.createContext({ user: {}, initUser: () => { }, initUserComplete: !1 }), Ko = E.createContext({ set: () => { }, get: () => { }, assign: () => { }, currentRoute: () => { } }), an = (t) => { if (!t) return !1; if (t.prototype instanceof E.Component || t.$$typeof) return !0; if (typeof t == "function") { const e = t.displayName || t.name; return !e || /^[A-Z]/.test(e); } return !1; }, _o = (t, e) => { if (!t || typeof window > "u") return; let r = document.querySelector(`style[ff-style-token="${e}"]`); return r ? (r.innerHTML = t, t) : (r = document.createElement("style"), r.setAttribute("ff-style-token", e), r.setAttribute("type", "text/css"), r.innerHTML = t, document.head.appendChild(r), t); }; var Pe, Ge, ve, we, be, ne, te, Y, Ce, st, at, lt, ct, xt, dt; const sr = class sr { constructor(e, r = "/") { v(this, Pe, "/"); v(this, Ge, /* @__PURE__ */ new Set()); v(this, ve, (e) => { for (const r of d(this, Ge)) try { r(e); } catch (n) { console.error("Error in VirtualFS event listener:", n); } }); v(this, we, (e) => { const r = Date.now(); if (e && (e.lastModified = r), d(this, Pe) != "/") { const n = d(this, Y).call(this, d(this, Pe)); n && (n.lastModified = r); } this.root.lastModified = r; }); v(this, be, (e) => { let r = ue.normalize(e); return r.startsWith("/") || (r = "/" + r), r.length > 1 && r.endsWith("/") && (r = r.slice(0, -1)), r; }); v(this, ne, (e) => { const r = ue.join(d(this, Pe), e); return d(this, be).call(this, r); }); v(this, te, (e) => { if (!e || typeof e != "string") return !1; const r = d(this, be).call(this, e); return !r.includes("..") && r.startsWith("/"); }); v(this, Y, (e) => { var o; const r = d(this, be).call(this, e); if (r === "/") return this.root; const n = r.split("/").filter((s) => s); let i = this.root; for (const s of n) { if (i.type !== "dir") return null; const a = (o = i.children) == null ? void 0 : o.find((l) => l.name === s); if (!a) return null; i = a; } return i; }); v(this, Ce, (e) => { const r = d(this, be).call(this, e), n = ue.basename(r), i = ue.dirname(r); return { parent: d(this, Y).call(this, i), name: n }; }); v(this, st, (e, r, n) => n === !1 ? e : n === "root" ? e.map((i) => ue.join(r, i)) : n === !0 || n === "working" ? e.map((i) => ue.relative(d(this, Pe), ue.join(r, i))) : e); v(this, at, async (e, r, n, i = "") => { const o = [], s = d(this, Y).call(this, e); if (!s || s.type !== "dir") return o; const a = s.children; for (const l of a) { const c = l.name, u = e === "/" ? `/${c}` : `${e}/${c}`, p = i ? `${i}/${c}` : c; try { if (l.type === "file") r(n ? p : c) && o.push(p); else if (l.type === "dir" && n) { const h = await d(this, at).call(this, u, r, n, p); o.push(...h); } } catch { continue; } } return o; }); v(this, lt, async (e, r, n, i = "") => { const o = [], s = Array.isArray(r) ? r : [r], a = d(this, Y).call(this, e); if (!a || a.type !== "dir") return o; if (!n) { for (const c of s) if (d(this, ct).call(this, c)) { const u = await d(this, xt).call(this, e, c); o.push(...u); } else { const u = ue.join(e, c), p = d(this, be).call(this, u); d(this, Y).call(this, p) && o.push(c); } return o; } const l = a.children; for (const c of l) { const u = c.name, p = e === "/" ? `/${u}` : `${e}/${u}`, h = i ? `${i}/${u}` : u; try { if (c.type === "file") for (const g of s) { let f = !1; if (f = d(this, ct).call(this, g) ? d(this, dt).call(this, u, g) : u === g, f) { o.push(h); break; } } else if (c.type === "dir") { const g = await d(this, lt).call(this, p, r, n, h); o.push(...g); } } catch { continue; } } return o; }); v(this, ct, (e) => /[*?[\]{}]/.test(e)); v(this, xt, async (e, r) => { const n = [], i = d(this, Y).call(this, e); if (!i || i.type !== "dir") return n; const o = i.children.map((s) => s.name); for (const s of o) d(this, dt).call(this, s, r) && n.push(s); return n; }); v(this, dt, (e, r) => { const n = r.replace(/\./g, "\\.").replace(/\*/g, ".*").replace(/\?/g, ".").replace(/\{([^}]+)\}/g, (i, o) => "(" + o.split(",").join("|") + ")"); return new RegExp(`^${n}$`).test(e); }); var n, i, o; K(this, Pe, r), this.root = { name: "/", type: "dir", children: [], lastModified: Date.now() }, Array.isArray(e) ? this.root.children = e : e && typeof e == "object" && (e.name && e.name !== "/" ? this.root.children.push(e) : (this.root = e, (n = this.root).name ?? (n.name = "/"), (i = this.root).children ?? (i.children = []), (o = this.root).lastModified ?? (o.lastModified = Date.now()))); } async stat(e) { const r = d(this, ne).call(this, e); if (!d(this, te).call(this, r)) throw new Error(`EINVAL: invalid path '${e}'`); const n = d(this, Y).call(this, r); if (!n) throw new Error(`ENOENT: no such file or directory, stat '${e}'`); return { isFile: () => n.type === "file", isDirectory: () => n.type === "dir", lastModified: n.lastModified }; } async dir(e) { const r = d(this, ne).call(this, e); if (!d(this, te).call(this, r)) throw new Error(`EINVAL: invalid path '${e}'`); const n = d(this, Y).call(this, r); if (!n) throw new Error(`ENOENT: no such file or directory, scandir '${e}'`); if (n.type !== "dir") throw new Error(`ENOTDIR: not a directory, scandir '${e}'`); return n.children.map((i) => i.name); } async readFile(e) { const r = d(this, ne).call(this, e); if (!d(this, te).call(this, r)) throw new Error(`EINVAL: invalid path '${e}'`); const n = d(this, Y).call(this, r); if (!n) throw new Error(`ENOENT: no such file or directory, open '${e}'`); if (n.type !== "file") throw new Error("EISDIR: illegal operation on a directory, read"); return n.content || ""; } async writeFile(e, r) { const n = d(this, ne).call(this, e); if (!d(this, te).call(this, n)) throw new Error(`EINVAL: invalid path '${e}'`); const { parent: i, name: o } = d(this, Ce).call(this, n); if (!i) throw new Error(`ENOENT: no such file or directory, open '${e}'`); if (i.type !== "dir") throw new Error("ENOTDIR: not a directory"); const s = i.children.findIndex((c) => c.name === o), a = s >= 0, l = { name: o, type: "file", content: r, lastModified: Date.now() }; a ? i.children[s] = l : i.children.push(l), d(this, we).call(this, i), d(this, ve).call(this, { action: a ? "update" : "create", path: n, type: "file", timestamp: Date.now() }); } async mkdir(e, r = {}) { const n = d(this, ne).call(this, e); if (!d(this, te).call(this, n)) throw new Error(`EINVAL: invalid path '${e}'`); const { recursive: i } = r; if (i) { const o = n.split("/").filter((a) => a); let s = "/"; for (const a of o) if (s = ue.join(s, a), !d(this, Y).call(this, s)) { const { parent: l, name: c } = d(this, Ce).call(this, s); if (l && l.type === "dir") { const u = { name: c, type: "dir", children: [], lastModified: Date.now() }; l.children.push(u), d(this, we).call(this, l), d(this, ve).call(this, { action: "create", path: d(this, be).call(this, s), type: "dir", timestamp: Date.now() }); } } } else { const { parent: o, name: s } = d(this, Ce).call(this, n); if (!o) throw new Error(`ENOENT: no such file or directory, mkdir '${e}'`); if (o.type !== "dir") throw new Error("ENOTDIR: not a directory"); if (o.children.find((l) => l.name === s)) throw new Error(`EEXIST: file already exists, mkdir '${e}'`); const a = { name: s, type: "dir", children: [], lastModified: Date.now() }; o.children.push(a), d(this, we).call(this, o), d(this, ve).call(this, { action: "create", path: n, type: "dir", timestamp: Date.now() }); } } async unlink(e) { const r = d(this, ne).call(this, e); if (!d(this, te).call(this, r)) throw new Error(`EINVAL: invalid path '${e}'`); const { parent: n, name: i } = d(this, Ce).call(this, r); if (!n) throw new Error(`ENOENT: no such file or directory, unlink '${e}'`); const o = n.children.findIndex((s) => s.name === i); if (o < 0) throw new Error(`ENOENT: no such file or directory, unlink '${e}'`); if (n.children[o].type !== "file") throw new Error(`EISDIR: illegal operation on a directory, unlink '${e}'`); n.children.splice(o, 1), d(this, we).call(this, n), d(this, ve).call(this, { action: "delete", path: r, type: "file", timestamp: Date.now() }); } async rmdir(e, r = {}) { const n = d(this, ne).call(this, e); if (!d(this, te).call(this, n)) throw new Error(`EINVAL: invalid path '${e}'`); const { parent: i, name: o } = d(this, Ce).call(this, n); if (!i) throw new Error(`ENOENT: no such file or directory, rmdir '${e}'`); const s = i.children.findIndex((l) => l.name === o); if (s < 0) throw new Error(`ENOENT: no such file or directory, rmdir '${e}'`); const a = i.children[s]; if (a.type !== "dir") throw new Error(`ENOTDIR: not a directory, rmdir '${e}'`); if (!r.recursive && a.children.length > 0) throw new Error(`ENOTEMPTY: directory not empty, rmdir '${e}'`); i.children.splice(s, 1), d(this, we).call(this, i), d(this, ve).call(this, { action: "delete", path: n, type: "dir", timestamp: Date.now() }); } async rename(e, r) { const n = d(this, ne).call(this, e), i = d(this, ne).call(this, r); if (!d(this, te).call(this, n)) throw new Error(`EINVAL: invalid path '${e}'`); if (!d(this, te).call(this, i)) throw new Error(`EINVAL: invalid path '${r}'`); if (!d(this, Y).call(this, n)) throw new Error(`ENOENT: no such file or directory, rename '${e}' -> '${r}'`); const { parent: o, name: s } = d(this, Ce).call(this, n), { parent: a, name: l } = d(this, Ce).call(this, i); if (!a) throw new Error(`ENOENT: no such file or directory, rename '${e}' -> '${r}'`); if (d(this, Y).call(this, i)) throw new Error(`EEXIST: file already exists, rename '${e}' -> '${r}'`); const c = o.children.findIndex((p) => p.name === s), u = { ...o.children[c], name: l, lastModified: Date.now() }; o.children.splice(c, 1), a.children.push(u), d(this, we).call(this, o), o !== a && d(this, we).call(this, a), d(this, ve).call(this, { action: "rename", path: i, oldPath: n, type: u.type, timestamp: Date.now() }); } async exists(e) { const r = d(this, ne).call(this, e); return d(this, te).call(this, r) ? d(this, Y).call(this, r) !== null : !1; } getLastModified() { return this.root.lastModified; } subscribe(e) { if (typeof e != "function") throw new Error("Callback must be a function"); return d(this, Ge).add(e), () => { d(this, Ge).delete(e); }; } getWorkingDirectory() { return d(this, Pe); } scope(e = "/") { const r = d(this, be).call(this, e); if (!d(this, te).call(this, r)) throw new Error(`EINVAL: invalid path '${e}'`); const n = d(this, Y).call(this, r); if (!n) throw new Error(`ENOENT: no such file or directory '${e}'`); if (n.type !== "dir") throw new Error(`ENOTDIR: not a directory '${e}'`); return n.children ?? (n.children = []), n.lastModified ?? (n.lastModified = Date.now()), new sr(this.root, r); } async findFiles(e, r, n = {}) { const i = d(this, ne).call(this, e); if (!d(this, te).call(this, i)) throw new Error(`EINVAL: invalid path '${e}'`); const o = d(this, Y).call(this, i); if (!o) throw new Error(`ENOENT: no such file or directory '${e}'`); if (o.type !== "dir") throw new Error(`ENOTDIR: not a directory '${e}'`); const { recursive: s = !1, fullPath: a = !1 } = n; if (typeof r == "function") { const c = await d(this, at).call(this, i, r, s); return d(this, st).call(this, c, i, a); } const l = await d(this, lt).call(this, i, r, s); return d(this, st).call(this, l, i, a); } }; Pe = new WeakMap(), Ge = new WeakMap(), ve = new WeakMap(), we = new WeakMap(), be = new WeakMap(), ne = new WeakMap(), te = new WeakMap(), Y = new WeakMap(), Ce = new WeakMap(), st = new WeakMap(), at = new WeakMap(), lt = new WeakMap(), ct = new WeakMap(), xt = new WeakMap(), dt = new WeakMap(); let Rr = sr; const oo = async (t, e = "/", r = "") => { try { const n = await t.stat(e), i = e === "/" ? "/" : ue.basename(e), o = { title: i, key: r ? `${r}${e}` : e, isLeaf: n.isFile() }; if (n.isDirectory()) { const s = await t.dir(e); if (s.length > 0) { o.children = []; const a = [], l = []; for (const c of s) { const u = e === "/" ? `/${c}` : `${e}/${c}`; try { (await t.stat(u)).isDirectory() ? a.push(c) : l.push(c); } catch (p) { console.warn(`Failed to stat ${u}:`, p.message); } } a.sort(), l.sort(); for (const c of [...a, ...l]) { const u = e === "/" ? `/${c}` : `${e}/${c}`; try { const p = await oo(t, u, r); o.children.push(p); } catch (p) { console.warn(`Failed to process ${u}:`, p.message); } } } } return o; } catch { return null; } }; class so extends E.Component { constructor() { super(...arguments); N(this, "state", { error: null }); N(this, "reset", () => { var r, n; (n = (r = this.props).onReset) == null || n.call(r), this.setState({ error: null }); }); } static getDerivedStateFromError(r) { return { error: r }; } componentDidCatch(r, n) { var i, o; console.error("[ErrorBoundary]", r), (o = (i = this.props).onError) == null || o.call(i, r, n); } componentDidUpdate(r) { const { resetKeys: n } = this.props; this.state.error && (n != null && n.length) && n.some((i, o) => { var s; return i !== ((s = r.resetKeys) == null ? void 0 : s[o]); }) && this.reset(); } render() { const { error: r } = this.state; if (r) { const { fallback: n } = this.props; return typeof n == "function" ? n(r, this.reset) : n !== void 0 ? n : String(r); } return this.props.children; } } const Jo = ({ widget: t, widgetSetting: e, widgetProps: r, fallback: n = null, fallbackOnError: i, onError: o }) => { const [s, a] = rr(r), l = W(() => t ? E.lazy(() => Z.getWidgetComponent(t).catch((c) => ({ default: () => `${c}` }))) : null, [t]); return l ? m(so, { fallback: i, onError: o, children: m(Fn, { fallback: n, children: m(l, { ...s, $setProps: a, $setting: e }) }) }) : m(ri, {}); }; export { Mo as $, li as A, No as B, To as C, bt as D, Ur as E, Wt as F, Fo as G, ki as H, ci as I, di as J, vi as K, Ni as L, jo as M, Ao as N, ce as O, Oi as P, $t as Q, _r as R, Zr as S, Ft as T, Io as U, Lo as V, Vo as W, Do as X, Ri as Y, Fi as Z, ji as _, Mr as a, Ai as a0, Pt as a1, Bo as a2, pt as a3, vt as a4, Uo as a5, Wo as a6, Ii as a7, rr as a8, qi as a9, ti as aA, Ue as aB, We as aC, ke as aD, qo as aE, Ko as aF, Rr as aG, oo as aH, io as aI, so as aJ, Jo as aK, ir as aa, nr as ab, rn as ac, Li as ad, Vi as ae, Di as af, Mi as ag, Bi as ah, Ui as ai, zo as aj, Ct as ak, R as al, Dr as am, Yi as an, re as ao, ut as ap, Lr as aq, G as ar, Se as as, ri as at, Po as au, vo as av, Z as aw, an as ax, _o as ay, B as az, Wr as b, Oo as c, zr as d, er as e, Jr as f, ii as g, Gr as h, xi as i, Yr as j, Ei as k, Ro as l, Hr as m, Kr as n, qr as o, wi as p, yi as q, hi as r, tr as s, oe as t, Si as u, Ci as v, Pi as w, ui as x, gi as y, ai as z };