likec4 1.57.0 → 1.58.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/__app__/codegen/react.mjs +7 -8
- package/__app__/codegen/webcomponent.mjs +70 -881
- package/__app__/src/aichat/index.mjs +8 -1
- package/__app__/src/chunks/AIChat.mjs +959 -0
- package/__app__/src/chunks/DiagramActorProvider.mjs +7638 -0
- package/__app__/src/chunks/LikeC4Styles.mjs +1866 -0
- package/__app__/src/chunks/Markdown.mjs +146 -0
- package/__app__/src/chunks/NavigationPanel.mjs +61 -0
- package/__app__/src/chunks/ProjectsOverview.mjs +540 -0
- package/__app__/src/chunks/adhoc-editor.mjs +3386 -0
- package/__app__/src/chunks/es.mjs +439 -0
- package/__app__/src/chunks/hooks.mjs +145 -0
- package/__app__/src/chunks/libs/@dagrejs/dagre.mjs +1894 -0
- package/__app__/src/chunks/libs/@floating-ui.mjs +2218 -0
- package/__app__/src/chunks/libs/@mantine.mjs +12070 -0
- package/__app__/src/chunks/libs/@tabler/icons-react.mjs +252 -0
- package/__app__/src/chunks/libs/@tanstack-ai.mjs +1768 -0
- package/__app__/src/chunks/libs/@tanstack.mjs +2718 -0
- package/__app__/src/chunks/libs/@xstate/react.mjs +1982 -0
- package/__app__/src/chunks/libs/@xyflow/react.mjs +5256 -0
- package/__app__/src/chunks/libs/bezier-js.mjs +1003 -0
- package/__app__/src/chunks/libs/d3.mjs +2842 -0
- package/__app__/src/chunks/libs/fast-equals.mjs +268 -0
- package/__app__/src/chunks/libs/framer.mjs +5872 -0
- package/__app__/src/chunks/libs/remeda.mjs +642 -0
- package/__app__/src/chunks/libs/zod.mjs +3170 -0
- package/__app__/src/chunks/rolldown-runtime.mjs +23 -0
- package/__app__/src/chunks/styled-system.mjs +1040 -0
- package/__app__/src/fonts.css +1 -1
- package/__app__/src/main.mjs +14816 -14
- package/__app__/src/style.css +1 -1
- package/dist/chunks/enableServer.mjs +1 -1
- package/dist/chunks/filenames.mjs +2 -2
- package/dist/chunks/index2.d.mts +1877 -734
- package/dist/chunks/libs/@chevrotain/gast.mjs +1 -1
- package/dist/chunks/libs/@logtape/logtape.mjs +4 -3
- package/dist/chunks/libs/chevrotain-allstar.mjs +2 -2
- package/dist/chunks/libs/chevrotain.mjs +25 -25
- package/dist/chunks/libs/langium.mjs +1 -1
- package/dist/chunks/libs/merge-error-cause.mjs +1 -1
- package/dist/chunks/libs/pretty-ms.mjs +1 -1
- package/dist/chunks/libs/remeda.mjs +1 -1
- package/dist/chunks/libs/ufo.mjs +1 -1
- package/dist/chunks/libs/unstorage.mjs +1 -1
- package/dist/chunks/libs/which.mjs +1 -1
- package/dist/chunks/libs/zod.mjs +65 -0
- package/dist/chunks/node.mjs +73 -62
- package/dist/chunks/{plugin.mjs → vite-plugin.mjs} +41 -41
- package/dist/cli/index.mjs +184 -144
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +1 -1
- package/dist/model/index.d.mts +1 -1
- package/dist/vite-plugin/index.mjs +1 -1
- package/dist/vite-plugin/internal/index.d.mts +52 -57
- package/dist/vite-plugin/internal/index.mjs +946 -1
- package/package.json +46 -47
- package/react/index.d.mts +92 -23
- package/react/index.mjs +44551 -42605
- package/__app__/chunks/AIChat2.mjs +0 -2
- package/__app__/chunks/DiagramActorProvider.mjs +0 -10
- package/__app__/chunks/EmbedPage.mjs +0 -1
- package/__app__/chunks/ExportPage.mjs +0 -2
- package/__app__/chunks/LikeC4Diagram.mjs +0 -19
- package/__app__/chunks/LikeC4Styles.mjs +0 -48
- package/__app__/chunks/Markdown.mjs +0 -1
- package/__app__/chunks/NavigationPanel.mjs +0 -1
- package/__app__/chunks/ViewReact.mjs +0 -1
- package/__app__/chunks/adhoc-editor.mjs +0 -1
- package/__app__/chunks/aichat.mjs +0 -1
- package/__app__/chunks/box.mjs +0 -1
- package/__app__/chunks/create-style-context.mjs +0 -1
- package/__app__/chunks/css.mjs +0 -1
- package/__app__/chunks/factory.mjs +0 -1
- package/__app__/chunks/hooks.mjs +0 -1
- package/__app__/chunks/hstack.mjs +0 -1
- package/__app__/chunks/libs/@dagrejs/dagre.mjs +0 -1
- package/__app__/chunks/libs/@floating-ui/core.mjs +0 -1
- package/__app__/chunks/libs/@floating-ui/dom.mjs +0 -1
- package/__app__/chunks/libs/@floating-ui/react.mjs +0 -1
- package/__app__/chunks/libs/@mantine/core.mjs +0 -41
- package/__app__/chunks/libs/@mantine/hooks.mjs +0 -1
- package/__app__/chunks/libs/@nanostores/react.mjs +0 -1
- package/__app__/chunks/libs/@react-hookz/web.mjs +0 -1
- package/__app__/chunks/libs/@tabler/icons-react.mjs +0 -358
- package/__app__/chunks/libs/@tanstack/ai-client.mjs +0 -2
- package/__app__/chunks/libs/@tanstack/ai-react-ui.mjs +0 -1
- package/__app__/chunks/libs/@tanstack/ai-react.mjs +0 -1
- package/__app__/chunks/libs/@tanstack/ai.mjs +0 -2
- package/__app__/chunks/libs/@tanstack/history.mjs +0 -1
- package/__app__/chunks/libs/@tanstack/react-router.mjs +0 -3
- package/__app__/chunks/libs/@tanstack/router-core.mjs +0 -1
- package/__app__/chunks/libs/@xstate/react.mjs +0 -1
- package/__app__/chunks/libs/@xstate/store.mjs +0 -1
- package/__app__/chunks/libs/@xyflow/react.mjs +0 -7
- package/__app__/chunks/libs/@zag-js/anatomy.mjs +0 -1
- package/__app__/chunks/libs/@zag-js/collection.mjs +0 -1
- package/__app__/chunks/libs/@zag-js/core.mjs +0 -1
- package/__app__/chunks/libs/@zag-js/react.mjs +0 -1
- package/__app__/chunks/libs/@zag-js/tree-view.mjs +0 -1
- package/__app__/chunks/libs/bezier-js.mjs +0 -1
- package/__app__/chunks/libs/copy-anything.mjs +0 -1
- package/__app__/chunks/libs/d3-path.mjs +0 -1
- package/__app__/chunks/libs/d3-shape.mjs +0 -1
- package/__app__/chunks/libs/fast-equals.mjs +0 -1
- package/__app__/chunks/libs/framer-motion.mjs +0 -9
- package/__app__/chunks/libs/html-to-image.mjs +0 -2
- package/__app__/chunks/libs/motion-dom.mjs +0 -1
- package/__app__/chunks/libs/nanostores.mjs +0 -1
- package/__app__/chunks/libs/react-error-boundary.mjs +0 -1
- package/__app__/chunks/libs/react-resizable-panels.mjs +0 -1
- package/__app__/chunks/libs/remeda.mjs +0 -1
- package/__app__/chunks/libs/superjson.mjs +0 -1
- package/__app__/chunks/libs/zod.mjs +0 -64
- package/__app__/chunks/rolldown-runtime.mjs +0 -1
- package/__app__/chunks/styles.css.mjs +0 -1
- package/__app__/chunks/txt.mjs +0 -1
- package/__app__/chunks/useLikeC4Project.mjs +0 -1
- package/__app__/src/pages/AdHocViewEditor.mjs +0 -1
- package/__app__/src/pages/EmbedPage.mjs +0 -1
- package/__app__/src/pages/ExportPage.mjs +0 -1
- package/__app__/src/pages/ProjectsOverview.mjs +0 -1
- package/__app__/src/pages/ViewAsD2.mjs +0 -1
- package/__app__/src/pages/ViewAsDot.mjs +0 -1
- package/__app__/src/pages/ViewAsMmd.mjs +0 -1
- package/__app__/src/pages/ViewAsPuml.mjs +0 -1
- package/__app__/src/pages/ViewEditor.mjs +0 -1
- package/__app__/src/pages/ViewReact.mjs +0 -1
- package/dist/chunks/libs/@chevrotain/utils.mjs +0 -1
- package/dist/chunks/libs/@hono/mcp.mjs +0 -70
- package/dist/chunks/libs/@hono/node-server.mjs +0 -1
- package/dist/chunks/libs/@logtape/logtape.d.mts +0 -1023
- package/dist/chunks/libs/@modelcontextprotocol/sdk.mjs +0 -12
- package/dist/chunks/libs/ajv.mjs +0 -1
- package/dist/chunks/libs/ansi-align.mjs +0 -2
- package/dist/chunks/libs/ansi-regex.mjs +0 -1
- package/dist/chunks/libs/ansi-styles.mjs +0 -1
- package/dist/chunks/libs/atomically.mjs +0 -1
- package/dist/chunks/libs/boxen.mjs +0 -22
- package/dist/chunks/libs/conf.mjs +0 -1
- package/dist/chunks/libs/defu.mjs +0 -1
- package/dist/chunks/libs/destr.mjs +0 -1
- package/dist/chunks/libs/find-up-simple.mjs +0 -1
- package/dist/chunks/libs/get-port.mjs +0 -1
- package/dist/chunks/libs/hono.mjs +0 -1
- package/dist/chunks/libs/is-docker.mjs +0 -1
- package/dist/chunks/libs/is-error-instance.mjs +0 -1
- package/dist/chunks/libs/is-inside-container.mjs +0 -1
- package/dist/chunks/libs/is-plain-obj.mjs +0 -1
- package/dist/chunks/libs/isexe.mjs +0 -1
- package/dist/chunks/libs/ky.mjs +0 -3
- package/dist/chunks/libs/p-debounce.mjs +0 -1
- package/dist/chunks/libs/p-limit.mjs +0 -1
- package/dist/chunks/libs/p-timeout.mjs +0 -1
- package/dist/chunks/libs/package-up.mjs +0 -1
- package/dist/chunks/libs/parse-ms.mjs +0 -1
- package/dist/chunks/libs/safe-stringify.mjs +0 -1
- package/dist/chunks/libs/strip-indent.mjs +0 -1
- package/dist/chunks/libs/tinyrainbow.mjs +0 -1
- package/dist/chunks/libs/ts-graphviz.mjs +0 -1
- package/dist/chunks/libs/unctx.mjs +0 -1
- package/dist/chunks/libs/vscode-languageserver.mjs +0 -1
- package/dist/chunks/libs/word-wrap.mjs +0 -12
- package/dist/vite-plugin/internal/chunks/libs/@nanostores/react.mjs +0 -1
- package/dist/vite-plugin/internal/chunks/libs/birpc.mjs +0 -1
- package/dist/vite-plugin/internal/chunks/libs/fast-equals.mjs +0 -1
- package/dist/vite-plugin/internal/chunks/libs/nanostores.mjs +0 -1
- package/dist/vite-plugin/internal/chunks/libs/remeda.mjs +0 -1
- package/dist/vite-plugin/internal/chunks/rolldown-runtime.mjs +0 -1
|
@@ -0,0 +1,3386 @@
|
|
|
1
|
+
import { i as e } from "./rolldown-runtime.mjs";
|
|
2
|
+
import { B as n, E as r, H as i, U as a, W as o, g as s, h as c, i as l, p as u, s as d } from "./libs/remeda.mjs";
|
|
3
|
+
import { mt as f, pt as p, ut as m, wt as h } from "./libs/@mantine.mjs";
|
|
4
|
+
import { A as g, C as _, D as v, E as y, M as b, N as ee, _ as te, j as ne, x as re } from "./styled-system.mjs";
|
|
5
|
+
import { h as ie, y as ae } from "./libs/@tabler/icons-react.mjs";
|
|
6
|
+
import { $ as oe, D as se, N as ce, T as le, X as ue, Z as de, n as fe, t as pe, w as me, y as he } from "./LikeC4Styles.mjs";
|
|
7
|
+
import { o as ge } from "./Markdown.mjs";
|
|
8
|
+
import { E as _e, T as ve, n as ye, t as be, v as xe, y as Se } from "./DiagramActorProvider.mjs";
|
|
9
|
+
import { u as Ce } from "./hooks.mjs";
|
|
10
|
+
import { s as we } from "./libs/@xyflow/react.mjs";
|
|
11
|
+
import { m as Te } from "./libs/framer.mjs";
|
|
12
|
+
import { a as Ee, d as De, i as Oe, l as ke, n as Ae, r as x, s as S, t as je } from "./libs/@xstate/react.mjs";
|
|
13
|
+
import { Profiler as Me, Suspense as Ne, createContext as Pe, memo as C, useCallback as Fe, useContext as Ie, useDeferredValue as Le, useEffect as w, useLayoutEffect as Re, useMemo as T, useRef as E, useState as D, useSyncExternalStore as ze } from "react";
|
|
14
|
+
import { c as O } from "react/compiler-runtime";
|
|
15
|
+
import { jsx as k, jsxs as A } from "react/jsx-runtime";
|
|
16
|
+
import { flushSync as j } from "react-dom";
|
|
17
|
+
import { ModelFqnExpr as M, nonNullable as Be } from "@likec4/core";
|
|
18
|
+
import { compareNaturalHierarchically as Ve, difference as He, invariant as Ue, nonexhaustive as We, objectHash as Ge, stringHash as Ke, toArray as qe, toSet as N } from "@likec4/core/utils";
|
|
19
|
+
//#region ../../node_modules/.pnpm/remeda@2.37.0/node_modules/remeda/dist/piped.js
|
|
20
|
+
function t(...e) {
|
|
21
|
+
return (n) => o(n, ...e);
|
|
22
|
+
}
|
|
23
|
+
var Je = ae("outline", "trash", "Trash", [
|
|
24
|
+
["path", {
|
|
25
|
+
d: "M4 7l16 0",
|
|
26
|
+
key: "svg-0"
|
|
27
|
+
}],
|
|
28
|
+
["path", {
|
|
29
|
+
d: "M10 11l0 6",
|
|
30
|
+
key: "svg-1"
|
|
31
|
+
}],
|
|
32
|
+
["path", {
|
|
33
|
+
d: "M14 11l0 6",
|
|
34
|
+
key: "svg-2"
|
|
35
|
+
}],
|
|
36
|
+
["path", {
|
|
37
|
+
d: "M5 7l1 12a2 2 0 0 0 2 2h8a2 2 0 0 0 2 -2l1 -12",
|
|
38
|
+
key: "svg-3"
|
|
39
|
+
}],
|
|
40
|
+
["path", {
|
|
41
|
+
d: "M9 7v-3a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v3",
|
|
42
|
+
key: "svg-4"
|
|
43
|
+
}]
|
|
44
|
+
]);
|
|
45
|
+
//#endregion
|
|
46
|
+
//#region ../../node_modules/.pnpm/@zag-js+utils@1.33.1/node_modules/@zag-js/utils/dist/index.mjs
|
|
47
|
+
function toArray$1(e) {
|
|
48
|
+
return e == null ? [] : Array.isArray(e) ? e : [e];
|
|
49
|
+
}
|
|
50
|
+
e(toArray$1, "toArray");
|
|
51
|
+
var first = (e) => e[0], last = (e) => e[e.length - 1], has = (e, n) => e.indexOf(n) !== -1, add = (e, ...n) => e.concat(n), P = /* @__PURE__ */ e((e, ...n) => e.filter((e) => !n.includes(e)), "remove"), uniq = (e) => Array.from(new Set(e)), diff = (e, n) => {
|
|
52
|
+
let r = new Set(n);
|
|
53
|
+
return e.filter((e) => !r.has(e));
|
|
54
|
+
}, addOrRemove = (e, n) => has(e, n) ? P(e, n) : add(e, n);
|
|
55
|
+
function partition(e, n) {
|
|
56
|
+
return e.reduce(([e, r], i) => (n(i) ? e.push(i) : r.push(i), [e, r]), [[], []]);
|
|
57
|
+
}
|
|
58
|
+
var isArrayLike = (e) => e?.constructor.name === "Array", isArrayEqual = (e, n) => {
|
|
59
|
+
if (e.length !== n.length) return !1;
|
|
60
|
+
for (let r = 0; r < e.length; r++) if (!isEqual(e[r], n[r])) return !1;
|
|
61
|
+
return !0;
|
|
62
|
+
}, isEqual = (e, n) => {
|
|
63
|
+
if (Object.is(e, n)) return !0;
|
|
64
|
+
if (e == null && n != null || e != null && n == null) return !1;
|
|
65
|
+
if (typeof e?.isEqual == "function" && typeof n?.isEqual == "function") return e.isEqual(n);
|
|
66
|
+
if (typeof e == "function" && typeof n == "function") return e.toString() === n.toString();
|
|
67
|
+
if (isArrayLike(e) && isArrayLike(n)) return isArrayEqual(Array.from(e), Array.from(n));
|
|
68
|
+
if (typeof e != "object" || typeof n != "object") return !1;
|
|
69
|
+
let r = Object.keys(n ?? /* @__PURE__ */ Object.create(null)), i = r.length;
|
|
70
|
+
for (let n = 0; n < i; n++) if (!Reflect.has(e, r[n])) return !1;
|
|
71
|
+
for (let a = 0; a < i; a++) {
|
|
72
|
+
let i = r[a];
|
|
73
|
+
if (!isEqual(e[i], n[i])) return !1;
|
|
74
|
+
}
|
|
75
|
+
return !0;
|
|
76
|
+
}, isArray = (e) => Array.isArray(e), isObjectLike = (e) => typeof e == "object" && !!e, F = /* @__PURE__ */ e((e) => isObjectLike(e) && !isArray(e), "isObject"), isString = (e) => typeof e == "string", isFunction = (e) => typeof e == "function", I = /* @__PURE__ */ e((e, n) => Object.prototype.hasOwnProperty.call(e, n), "hasProp"), baseGetTag = (e) => Object.prototype.toString.call(e), Ye = Function.prototype.toString, Xe = Ye.call(Object), isPlainObject = (e) => {
|
|
77
|
+
if (!isObjectLike(e) || baseGetTag(e) != "[object Object]" || isFrameworkElement(e)) return !1;
|
|
78
|
+
let n = Object.getPrototypeOf(e);
|
|
79
|
+
if (n === null) return !0;
|
|
80
|
+
let r = I(n, "constructor") && n.constructor;
|
|
81
|
+
return typeof r == "function" && r instanceof r && Ye.call(r) == Xe;
|
|
82
|
+
}, isReactElement = (e) => typeof e == "object" && !!e && "$$typeof" in e && "props" in e, isVueElement = (e) => typeof e == "object" && !!e && "__v_isVNode" in e, isFrameworkElement = (e) => isReactElement(e) || isVueElement(e), Ze = /* @__PURE__ */ e((e) => e(), "identity"), callAll = (...e) => (...n) => {
|
|
83
|
+
e.forEach(function(e) {
|
|
84
|
+
e?.(...n);
|
|
85
|
+
});
|
|
86
|
+
}, { floor: Qe, abs: $e, round: et, min: tt, max: nt, pow: rt, sign: it } = Math;
|
|
87
|
+
function compact(e) {
|
|
88
|
+
if (!isPlainObject(e) || e === void 0) return e;
|
|
89
|
+
let n = Reflect.ownKeys(e).filter((e) => typeof e == "string"), r = {};
|
|
90
|
+
for (let i of n) {
|
|
91
|
+
let n = e[i];
|
|
92
|
+
n !== void 0 && (r[i] = compact(n));
|
|
93
|
+
}
|
|
94
|
+
return r;
|
|
95
|
+
}
|
|
96
|
+
function splitProps$1(e, n) {
|
|
97
|
+
let r = {}, i = {}, a = new Set(n), o = Reflect.ownKeys(e);
|
|
98
|
+
for (let n of o) a.has(n) ? i[n] = e[n] : r[n] = e[n];
|
|
99
|
+
return [i, r];
|
|
100
|
+
}
|
|
101
|
+
e(splitProps$1, "splitProps");
|
|
102
|
+
function warn(...e) {
|
|
103
|
+
e.length === 1 ? e[0] : e[1], e.length === 2 && e[0];
|
|
104
|
+
}
|
|
105
|
+
function ensure(e, n) {
|
|
106
|
+
if (e == null) throw Error(n());
|
|
107
|
+
}
|
|
108
|
+
//#endregion
|
|
109
|
+
//#region ../../node_modules/.pnpm/@zag-js+dom-query@1.33.1/node_modules/@zag-js/dom-query/dist/index.mjs
|
|
110
|
+
var at = Object.defineProperty, ot = /* @__PURE__ */ e((e, n, r) => n in e ? at(e, n, {
|
|
111
|
+
enumerable: !0,
|
|
112
|
+
configurable: !0,
|
|
113
|
+
writable: !0,
|
|
114
|
+
value: r
|
|
115
|
+
}) : e[n] = r, "__defNormalProp"), L = /* @__PURE__ */ e((e, n, r) => ot(e, typeof n == "symbol" ? n : n + "", r), "__publicField"), wrap = (e, n) => e.map((r, i) => e[(Math.max(n, 0) + i) % e.length]), isObject = (e) => typeof e == "object" && !!e, dataAttr = (e) => e ? "" : void 0, ariaAttr = (e) => e ? "true" : void 0, st = 1, ct = 9, lt = 11, isHTMLElement = (e) => isObject(e) && e.nodeType === st && typeof e.nodeName == "string", isDocument = (e) => isObject(e) && e.nodeType === ct, isWindow = (e) => isObject(e) && e === e.window, isNode = (e) => isObject(e) && e.nodeType !== void 0, isShadowRoot = (e) => isNode(e) && e.nodeType === lt && "host" in e, isInputElement = (e) => isHTMLElement(e) && e.localName === "input", isAnchorElement = (e) => !!e?.matches("a[href]");
|
|
116
|
+
function isActiveElement(e) {
|
|
117
|
+
return e ? getActiveElement(e.getRootNode()) === e : !1;
|
|
118
|
+
}
|
|
119
|
+
var ut = /(textarea|select)/;
|
|
120
|
+
function isEditableElement(e) {
|
|
121
|
+
if (e == null || !isHTMLElement(e)) return !1;
|
|
122
|
+
try {
|
|
123
|
+
return isInputElement(e) && e.selectionStart != null || ut.test(e.localName) || e.isContentEditable || e.getAttribute("contenteditable") === "true" || e.getAttribute("contenteditable") === "";
|
|
124
|
+
} catch {
|
|
125
|
+
return !1;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
function getDocument(e) {
|
|
129
|
+
return isDocument(e) ? e : isWindow(e) ? e.document : e?.ownerDocument ?? document;
|
|
130
|
+
}
|
|
131
|
+
function getWindow(e) {
|
|
132
|
+
return isShadowRoot(e) ? getWindow(e.host) : isDocument(e) ? e.defaultView ?? window : isHTMLElement(e) ? e.ownerDocument?.defaultView ?? window : window;
|
|
133
|
+
}
|
|
134
|
+
function getActiveElement(e) {
|
|
135
|
+
let n = e.activeElement;
|
|
136
|
+
for (; n?.shadowRoot;) {
|
|
137
|
+
let e = n.shadowRoot.activeElement;
|
|
138
|
+
if (!e || e === n) break;
|
|
139
|
+
n = e;
|
|
140
|
+
}
|
|
141
|
+
return n;
|
|
142
|
+
}
|
|
143
|
+
function getComposedPath(e) {
|
|
144
|
+
return e.composedPath?.() ?? e.nativeEvent?.composedPath?.();
|
|
145
|
+
}
|
|
146
|
+
function getEventTarget(e) {
|
|
147
|
+
return getComposedPath(e)?.[0] ?? e.target;
|
|
148
|
+
}
|
|
149
|
+
function isComposingEvent(e) {
|
|
150
|
+
return getNativeEvent(e).isComposing || e.keyCode === 229;
|
|
151
|
+
}
|
|
152
|
+
var isLeftClick = (e) => e.button === 0, isModifierKey = (e) => e.ctrlKey || e.altKey || e.metaKey, dt = {
|
|
153
|
+
Up: "ArrowUp",
|
|
154
|
+
Down: "ArrowDown",
|
|
155
|
+
Esc: "Escape",
|
|
156
|
+
" ": "Space",
|
|
157
|
+
",": "Comma",
|
|
158
|
+
Left: "ArrowLeft",
|
|
159
|
+
Right: "ArrowRight"
|
|
160
|
+
}, ft = {
|
|
161
|
+
ArrowLeft: "ArrowRight",
|
|
162
|
+
ArrowRight: "ArrowLeft"
|
|
163
|
+
};
|
|
164
|
+
function getEventKey(e, n = {}) {
|
|
165
|
+
let { dir: r = "ltr", orientation: i = "horizontal" } = n, a = e.key;
|
|
166
|
+
return a = dt[a] ?? a, r === "rtl" && i === "horizontal" && a in ft && (a = ft[a]), a;
|
|
167
|
+
}
|
|
168
|
+
function getNativeEvent(e) {
|
|
169
|
+
return e.nativeEvent ?? e;
|
|
170
|
+
}
|
|
171
|
+
function getDescriptor(e, n) {
|
|
172
|
+
let { type: r = "HTMLInputElement", property: i = "value" } = n, a = getWindow(e)[r].prototype;
|
|
173
|
+
return Object.getOwnPropertyDescriptor(a, i) ?? {};
|
|
174
|
+
}
|
|
175
|
+
function getElementType(e) {
|
|
176
|
+
if (e.localName === "input") return "HTMLInputElement";
|
|
177
|
+
if (e.localName === "textarea") return "HTMLTextAreaElement";
|
|
178
|
+
if (e.localName === "select") return "HTMLSelectElement";
|
|
179
|
+
}
|
|
180
|
+
function setElementValue(e, n, r = "value") {
|
|
181
|
+
if (!e) return;
|
|
182
|
+
let i = getElementType(e);
|
|
183
|
+
i && getDescriptor(e, {
|
|
184
|
+
type: i,
|
|
185
|
+
property: r
|
|
186
|
+
}).set?.call(e, n), e.setAttribute(r, n);
|
|
187
|
+
}
|
|
188
|
+
var pt = class _AnimationFrame {
|
|
189
|
+
constructor() {
|
|
190
|
+
L(this, "id", null), L(this, "fn_cleanup"), L(this, "cleanup", () => {
|
|
191
|
+
this.cancel();
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
static create() {
|
|
195
|
+
return new _AnimationFrame();
|
|
196
|
+
}
|
|
197
|
+
request(e) {
|
|
198
|
+
this.cancel(), this.id = globalThis.requestAnimationFrame(() => {
|
|
199
|
+
this.id = null, this.fn_cleanup = e?.();
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
cancel() {
|
|
203
|
+
this.id !== null && (globalThis.cancelAnimationFrame(this.id), this.id = null), this.fn_cleanup?.(), this.fn_cleanup = void 0;
|
|
204
|
+
}
|
|
205
|
+
isActive() {
|
|
206
|
+
return this.id !== null;
|
|
207
|
+
}
|
|
208
|
+
};
|
|
209
|
+
function raf(e) {
|
|
210
|
+
let n = pt.create();
|
|
211
|
+
return n.request(e), n.cleanup;
|
|
212
|
+
}
|
|
213
|
+
var defaultItemToId = (e) => e.id;
|
|
214
|
+
function itemById(e, n, r = defaultItemToId) {
|
|
215
|
+
return e.find((e) => r(e) === n);
|
|
216
|
+
}
|
|
217
|
+
function indexOfId(e, n, r = defaultItemToId) {
|
|
218
|
+
let i = itemById(e, n, r);
|
|
219
|
+
return i ? e.indexOf(i) : -1;
|
|
220
|
+
}
|
|
221
|
+
var sanitize = (e) => e.split("").map((e) => {
|
|
222
|
+
let n = e.charCodeAt(0);
|
|
223
|
+
return n > 0 && n < 128 ? e : n >= 128 && n <= 255 ? `/x${n.toString(16)}`.replace("/", "\\") : "";
|
|
224
|
+
}).join("").trim(), getValueText = (e) => sanitize(e.dataset?.valuetext ?? e.textContent ?? ""), match = (e, n) => e.trim().toLowerCase().startsWith(n.toLowerCase());
|
|
225
|
+
function getByText(e, n, r, i = defaultItemToId) {
|
|
226
|
+
let a = r ? indexOfId(e, r, i) : -1, o = r ? wrap(e, a) : e;
|
|
227
|
+
return n.length === 1 && (o = o.filter((e) => i(e) !== r)), o.find((e) => match(getValueText(e), n));
|
|
228
|
+
}
|
|
229
|
+
function getByTypeaheadImpl(e, n) {
|
|
230
|
+
let { state: r, activeId: i, key: a, timeout: o = 350, itemToId: s } = n, c = r.keysSoFar + a, l = c.length > 1 && Array.from(c).every((e) => e === c[0]) ? c[0] : c, u = getByText(e.slice(), l, i, s);
|
|
231
|
+
function cleanup() {
|
|
232
|
+
clearTimeout(r.timer), r.timer = -1;
|
|
233
|
+
}
|
|
234
|
+
function update(e) {
|
|
235
|
+
r.keysSoFar = e, cleanup(), e !== "" && (r.timer = +setTimeout(() => {
|
|
236
|
+
update(""), cleanup();
|
|
237
|
+
}, o));
|
|
238
|
+
}
|
|
239
|
+
return update(c), u;
|
|
240
|
+
}
|
|
241
|
+
var R = /* @__PURE__ */ Object.assign(getByTypeaheadImpl, {
|
|
242
|
+
defaultOptions: {
|
|
243
|
+
keysSoFar: "",
|
|
244
|
+
timer: -1
|
|
245
|
+
},
|
|
246
|
+
isValidEvent: isValidTypeaheadEvent
|
|
247
|
+
});
|
|
248
|
+
function isValidTypeaheadEvent(e) {
|
|
249
|
+
return e.key.length === 1 && !e.ctrlKey && !e.metaKey;
|
|
250
|
+
}
|
|
251
|
+
//#endregion
|
|
252
|
+
//#region ../../node_modules/.pnpm/@zag-js+core@1.33.1/node_modules/@zag-js/core/dist/index.mjs
|
|
253
|
+
var clsx = (...e) => e.map((e) => e?.trim?.()).filter(Boolean).join(" "), mt = /((?:--)?(?:\w+-?)+)\s*:\s*([^;]*)/g, serialize = (e) => {
|
|
254
|
+
let n = {}, r;
|
|
255
|
+
for (; r = mt.exec(e);) n[r[1]] = r[2];
|
|
256
|
+
return n;
|
|
257
|
+
}, css = (e, n) => {
|
|
258
|
+
if (isString(e)) {
|
|
259
|
+
if (isString(n)) return `${e};${n}`;
|
|
260
|
+
e = serialize(e);
|
|
261
|
+
} else isString(n) && (n = serialize(n));
|
|
262
|
+
return Object.assign({}, e ?? {}, n ?? {});
|
|
263
|
+
};
|
|
264
|
+
function mergeProps(...e) {
|
|
265
|
+
let n = {};
|
|
266
|
+
for (let r of e) {
|
|
267
|
+
if (!r) continue;
|
|
268
|
+
for (let e in n) {
|
|
269
|
+
if (e.startsWith("on") && typeof n[e] == "function" && typeof r[e] == "function") {
|
|
270
|
+
n[e] = callAll(r[e], n[e]);
|
|
271
|
+
continue;
|
|
272
|
+
}
|
|
273
|
+
if (e === "className" || e === "class") {
|
|
274
|
+
n[e] = clsx(n[e], r[e]);
|
|
275
|
+
continue;
|
|
276
|
+
}
|
|
277
|
+
if (e === "style") {
|
|
278
|
+
n[e] = css(n[e], r[e]);
|
|
279
|
+
continue;
|
|
280
|
+
}
|
|
281
|
+
n[e] = r[e] === void 0 ? n[e] : r[e];
|
|
282
|
+
}
|
|
283
|
+
for (let e in r) n[e] === void 0 && (n[e] = r[e]);
|
|
284
|
+
let e = Object.getOwnPropertySymbols(r);
|
|
285
|
+
for (let i of e) n[i] = r[i];
|
|
286
|
+
}
|
|
287
|
+
return n;
|
|
288
|
+
}
|
|
289
|
+
function createGuards() {
|
|
290
|
+
return {
|
|
291
|
+
and: (...e) => function andGuard(n) {
|
|
292
|
+
return e.every((e) => n.guard(e));
|
|
293
|
+
},
|
|
294
|
+
or: (...e) => function orGuard(n) {
|
|
295
|
+
return e.some((e) => n.guard(e));
|
|
296
|
+
},
|
|
297
|
+
not: (e) => function notGuard(n) {
|
|
298
|
+
return !n.guard(e);
|
|
299
|
+
}
|
|
300
|
+
};
|
|
301
|
+
}
|
|
302
|
+
function createMachine(e) {
|
|
303
|
+
return e;
|
|
304
|
+
}
|
|
305
|
+
var z = /* @__PURE__ */ ((e) => (e.NotStarted = "Not Started", e.Started = "Started", e.Stopped = "Stopped", e))(z || {}), ht = "__init__";
|
|
306
|
+
function createScope(e) {
|
|
307
|
+
let getRootNode = () => e.getRootNode?.() ?? document, getDoc = () => getDocument(getRootNode()), getWin = () => getDoc().defaultView ?? window, getActiveElementFn = () => getActiveElement(getRootNode()), getById = (e) => getRootNode().getElementById(e);
|
|
308
|
+
return {
|
|
309
|
+
...e,
|
|
310
|
+
getRootNode,
|
|
311
|
+
getDoc,
|
|
312
|
+
getWin,
|
|
313
|
+
getActiveElement: getActiveElementFn,
|
|
314
|
+
isActiveElement,
|
|
315
|
+
getById
|
|
316
|
+
};
|
|
317
|
+
}
|
|
318
|
+
//#endregion
|
|
319
|
+
//#region ../../node_modules/.pnpm/@zag-js+types@1.33.1/node_modules/@zag-js/types/dist/index.mjs
|
|
320
|
+
function createNormalizer(e) {
|
|
321
|
+
return new Proxy({}, { get(n, r) {
|
|
322
|
+
return r === "style" ? (n) => e({ style: n }).style : e;
|
|
323
|
+
} });
|
|
324
|
+
}
|
|
325
|
+
var createProps = () => (e) => Array.from(new Set(e)), gt = globalThis.document === void 0 ? w : Re;
|
|
326
|
+
function useBindable(e) {
|
|
327
|
+
let n = e().value ?? e().defaultValue, r = e().isEqual ?? Object.is, [i] = D(n), [a, o] = D(i), s = e().value !== void 0, c = E(a);
|
|
328
|
+
c.current = s ? e().value : a;
|
|
329
|
+
let l = E(c.current);
|
|
330
|
+
gt(() => {
|
|
331
|
+
l.current = c.current;
|
|
332
|
+
}, [a, e().value]);
|
|
333
|
+
let setFn = (n) => {
|
|
334
|
+
let i = l.current, a = isFunction(n) ? n(i) : n;
|
|
335
|
+
e().debug && console.log(`[bindable > ${e().debug}] setValue`, {
|
|
336
|
+
next: a,
|
|
337
|
+
prev: i
|
|
338
|
+
}), s || o(a), r(a, i) || e().onChange?.(a, i);
|
|
339
|
+
};
|
|
340
|
+
function get() {
|
|
341
|
+
return s ? e().value : a;
|
|
342
|
+
}
|
|
343
|
+
return {
|
|
344
|
+
initial: i,
|
|
345
|
+
ref: c,
|
|
346
|
+
get,
|
|
347
|
+
set(n) {
|
|
348
|
+
(e().sync ? j : Ze)(() => setFn(n));
|
|
349
|
+
},
|
|
350
|
+
invoke(n, r) {
|
|
351
|
+
e().onChange?.(n, r);
|
|
352
|
+
},
|
|
353
|
+
hash(n) {
|
|
354
|
+
return e().hash?.(n) ?? String(n);
|
|
355
|
+
}
|
|
356
|
+
};
|
|
357
|
+
}
|
|
358
|
+
useBindable.cleanup = (e) => {
|
|
359
|
+
w(() => e, []);
|
|
360
|
+
}, useBindable.ref = (e) => {
|
|
361
|
+
let n = E(e);
|
|
362
|
+
return {
|
|
363
|
+
get: () => n.current,
|
|
364
|
+
set: (e) => {
|
|
365
|
+
n.current = e;
|
|
366
|
+
}
|
|
367
|
+
};
|
|
368
|
+
};
|
|
369
|
+
function useRefs(e) {
|
|
370
|
+
let n = E(e);
|
|
371
|
+
return {
|
|
372
|
+
get(e) {
|
|
373
|
+
return n.current[e];
|
|
374
|
+
},
|
|
375
|
+
set(e, r) {
|
|
376
|
+
n.current[e] = r;
|
|
377
|
+
}
|
|
378
|
+
};
|
|
379
|
+
}
|
|
380
|
+
var useTrack = (e, n) => {
|
|
381
|
+
let r = E(!1), i = E(!1);
|
|
382
|
+
w(() => {
|
|
383
|
+
if (r.current && i.current) return n();
|
|
384
|
+
i.current = !0;
|
|
385
|
+
}, [...(e ?? []).map((e) => typeof e == "function" ? e() : e)]), w(() => (r.current = !0, () => {
|
|
386
|
+
r.current = !1;
|
|
387
|
+
}), []);
|
|
388
|
+
};
|
|
389
|
+
function useMachine(e, n = {}) {
|
|
390
|
+
let r = T(() => {
|
|
391
|
+
let { id: e, ids: r, getRootNode: i } = n;
|
|
392
|
+
return createScope({
|
|
393
|
+
id: e,
|
|
394
|
+
ids: r,
|
|
395
|
+
getRootNode: i
|
|
396
|
+
});
|
|
397
|
+
}, [n]), debug = (...n) => {
|
|
398
|
+
e.debug && console.log(...n);
|
|
399
|
+
}, i = useProp(e.props?.({
|
|
400
|
+
props: compact(n),
|
|
401
|
+
scope: r
|
|
402
|
+
}) ?? n), a = e.context?.({
|
|
403
|
+
prop: i,
|
|
404
|
+
bindable: useBindable,
|
|
405
|
+
scope: r,
|
|
406
|
+
flush: flush$1,
|
|
407
|
+
getContext() {
|
|
408
|
+
return s;
|
|
409
|
+
},
|
|
410
|
+
getComputed() {
|
|
411
|
+
return computed;
|
|
412
|
+
},
|
|
413
|
+
getRefs() {
|
|
414
|
+
return f;
|
|
415
|
+
},
|
|
416
|
+
getEvent() {
|
|
417
|
+
return getEvent();
|
|
418
|
+
}
|
|
419
|
+
}), o = useLiveRef(a), s = {
|
|
420
|
+
get(e) {
|
|
421
|
+
return o.current?.[e].ref.current;
|
|
422
|
+
},
|
|
423
|
+
set(e, n) {
|
|
424
|
+
o.current?.[e].set(n);
|
|
425
|
+
},
|
|
426
|
+
initial(e) {
|
|
427
|
+
return o.current?.[e].initial;
|
|
428
|
+
},
|
|
429
|
+
hash(e) {
|
|
430
|
+
let n = o.current?.[e].get();
|
|
431
|
+
return o.current?.[e].hash(n);
|
|
432
|
+
}
|
|
433
|
+
}, c = E(/* @__PURE__ */ new Map()), l = E(null), u = E(null), d = E({ type: "" }), getEvent = () => ({
|
|
434
|
+
...d.current,
|
|
435
|
+
current() {
|
|
436
|
+
return d.current;
|
|
437
|
+
},
|
|
438
|
+
previous() {
|
|
439
|
+
return u.current;
|
|
440
|
+
}
|
|
441
|
+
}), getState = () => ({
|
|
442
|
+
...p,
|
|
443
|
+
matches(...e) {
|
|
444
|
+
return e.includes(p.ref.current);
|
|
445
|
+
},
|
|
446
|
+
hasTag(n) {
|
|
447
|
+
return !!e.states[p.ref.current]?.tags?.includes(n);
|
|
448
|
+
}
|
|
449
|
+
}), f = useRefs(e.refs?.({
|
|
450
|
+
prop: i,
|
|
451
|
+
context: s
|
|
452
|
+
}) ?? {}), getParams = () => ({
|
|
453
|
+
state: getState(),
|
|
454
|
+
context: s,
|
|
455
|
+
event: getEvent(),
|
|
456
|
+
prop: i,
|
|
457
|
+
send,
|
|
458
|
+
action,
|
|
459
|
+
guard,
|
|
460
|
+
track: useTrack,
|
|
461
|
+
refs: f,
|
|
462
|
+
computed,
|
|
463
|
+
flush: flush$1,
|
|
464
|
+
scope: r,
|
|
465
|
+
choose
|
|
466
|
+
}), action = (n) => {
|
|
467
|
+
let r = isFunction(n) ? n(getParams()) : n;
|
|
468
|
+
if (!r) return;
|
|
469
|
+
let i = r.map((n) => {
|
|
470
|
+
let r = e.implementations?.actions?.[n];
|
|
471
|
+
return r || warn(`[zag-js] No implementation found for action "${JSON.stringify(n)}"`), r;
|
|
472
|
+
});
|
|
473
|
+
for (let e of i) e?.(getParams());
|
|
474
|
+
}, guard = (n) => isFunction(n) ? n(getParams()) : e.implementations?.guards?.[n](getParams()), effect = (n) => {
|
|
475
|
+
let r = isFunction(n) ? n(getParams()) : n;
|
|
476
|
+
if (!r) return;
|
|
477
|
+
let i = r.map((n) => {
|
|
478
|
+
let r = e.implementations?.effects?.[n];
|
|
479
|
+
return r || warn(`[zag-js] No implementation found for effect "${JSON.stringify(n)}"`), r;
|
|
480
|
+
}), a = [];
|
|
481
|
+
for (let e of i) {
|
|
482
|
+
let n = e?.(getParams());
|
|
483
|
+
n && a.push(n);
|
|
484
|
+
}
|
|
485
|
+
return () => a.forEach((e) => e?.());
|
|
486
|
+
}, choose = (e) => toArray$1(e).find((e) => {
|
|
487
|
+
let n = !e.guard;
|
|
488
|
+
return isString(e.guard) ? n = !!guard(e.guard) : isFunction(e.guard) && (n = e.guard(getParams())), n;
|
|
489
|
+
}), computed = (n) => {
|
|
490
|
+
ensure(e.computed, () => "[zag-js] No computed object found on machine");
|
|
491
|
+
let a = e.computed[n];
|
|
492
|
+
return a({
|
|
493
|
+
context: s,
|
|
494
|
+
event: getEvent(),
|
|
495
|
+
prop: i,
|
|
496
|
+
refs: f,
|
|
497
|
+
scope: r,
|
|
498
|
+
computed
|
|
499
|
+
});
|
|
500
|
+
}, p = useBindable(() => ({
|
|
501
|
+
defaultValue: e.initialState({ prop: i }),
|
|
502
|
+
onChange(n, r) {
|
|
503
|
+
r && (c.current.get(r)?.(), c.current.delete(r)), r && action(e.states[r]?.exit), action(l.current?.actions);
|
|
504
|
+
let i = effect(e.states[n]?.effects);
|
|
505
|
+
if (i && c.current.set(n, i), r === "__init__") {
|
|
506
|
+
action(e.entry);
|
|
507
|
+
let n = effect(e.effects);
|
|
508
|
+
n && c.current.set(ht, n);
|
|
509
|
+
}
|
|
510
|
+
action(e.states[n]?.entry);
|
|
511
|
+
}
|
|
512
|
+
})), m = E(void 0), h = E(z.NotStarted);
|
|
513
|
+
gt(() => {
|
|
514
|
+
queueMicrotask(() => {
|
|
515
|
+
let e = h.current === z.Started;
|
|
516
|
+
h.current = z.Started, debug(e ? "rehydrating..." : "initializing...");
|
|
517
|
+
let n = m.current ?? p.initial;
|
|
518
|
+
p.invoke(n, e ? p.get() : ht);
|
|
519
|
+
});
|
|
520
|
+
let n = c.current, r = p.ref.current;
|
|
521
|
+
return () => {
|
|
522
|
+
debug("unmounting..."), m.current = r, h.current = z.Stopped, n.forEach((e) => e?.()), c.current = /* @__PURE__ */ new Map(), l.current = null, queueMicrotask(() => {
|
|
523
|
+
action(e.exit);
|
|
524
|
+
});
|
|
525
|
+
};
|
|
526
|
+
}, []);
|
|
527
|
+
let getCurrentState = () => "ref" in p ? p.ref.current : p.get(), send = (n) => {
|
|
528
|
+
queueMicrotask(() => {
|
|
529
|
+
if (h.current !== z.Started) return;
|
|
530
|
+
u.current = d.current, d.current = n;
|
|
531
|
+
let r = getCurrentState(), i = choose(e.states[r].on?.[n.type] ?? e.on?.[n.type]);
|
|
532
|
+
if (!i) return;
|
|
533
|
+
l.current = i;
|
|
534
|
+
let a = i.target ?? r;
|
|
535
|
+
debug("transition", n.type, i.target || r, `(${i.actions})`);
|
|
536
|
+
let o = a !== r;
|
|
537
|
+
o ? j(() => p.set(a)) : i.reenter && !o ? p.invoke(r, r) : action(i.actions ?? []);
|
|
538
|
+
});
|
|
539
|
+
};
|
|
540
|
+
return e.watch?.(getParams()), {
|
|
541
|
+
state: getState(),
|
|
542
|
+
send,
|
|
543
|
+
context: s,
|
|
544
|
+
prop: i,
|
|
545
|
+
scope: r,
|
|
546
|
+
refs: f,
|
|
547
|
+
computed,
|
|
548
|
+
event: getEvent(),
|
|
549
|
+
getStatus: () => h.current
|
|
550
|
+
};
|
|
551
|
+
}
|
|
552
|
+
function useLiveRef(e) {
|
|
553
|
+
let n = E(e);
|
|
554
|
+
return n.current = e, n;
|
|
555
|
+
}
|
|
556
|
+
function useProp(e) {
|
|
557
|
+
let n = useLiveRef(e);
|
|
558
|
+
return function get(e) {
|
|
559
|
+
return n.current[e];
|
|
560
|
+
};
|
|
561
|
+
}
|
|
562
|
+
function flush$1(e) {
|
|
563
|
+
queueMicrotask(() => {
|
|
564
|
+
j(() => e());
|
|
565
|
+
});
|
|
566
|
+
}
|
|
567
|
+
e(flush$1, "flush");
|
|
568
|
+
var _t = createNormalizer((e) => e), vt = ne({
|
|
569
|
+
base: {
|
|
570
|
+
border: "none",
|
|
571
|
+
display: "inline-flex",
|
|
572
|
+
alignItems: "center",
|
|
573
|
+
justifyContent: "center",
|
|
574
|
+
justifySelf: "flex-end",
|
|
575
|
+
fontSize: "[8px]",
|
|
576
|
+
fontFamily: "mono",
|
|
577
|
+
fontWeight: "bold",
|
|
578
|
+
letterSpacing: "[0.5px]",
|
|
579
|
+
marginLeft: "2",
|
|
580
|
+
py: "1",
|
|
581
|
+
px: "1.5",
|
|
582
|
+
lineHeight: "1",
|
|
583
|
+
rounded: "sm",
|
|
584
|
+
minWidth: 32,
|
|
585
|
+
transition: "normal",
|
|
586
|
+
_hover: { color: "text.bright" }
|
|
587
|
+
},
|
|
588
|
+
variants: { state: {
|
|
589
|
+
"include-explicit": {
|
|
590
|
+
backgroundColor: "grass.6",
|
|
591
|
+
color: "text"
|
|
592
|
+
},
|
|
593
|
+
"include-implicit": {
|
|
594
|
+
backgroundColor: "grass.6",
|
|
595
|
+
color: "text"
|
|
596
|
+
},
|
|
597
|
+
exclude: {
|
|
598
|
+
backgroundColor: "red.6",
|
|
599
|
+
color: "text"
|
|
600
|
+
},
|
|
601
|
+
disabled: { color: "text.dimmed" },
|
|
602
|
+
"not-present": {
|
|
603
|
+
color: "text.dimmed",
|
|
604
|
+
backgroundColor: "default.hover/50"
|
|
605
|
+
}
|
|
606
|
+
} },
|
|
607
|
+
defaultVariants: { state: "not-present" }
|
|
608
|
+
}), yt = ee.raw({
|
|
609
|
+
flex: 0,
|
|
610
|
+
display: "flex",
|
|
611
|
+
alignItems: "center",
|
|
612
|
+
color: "text.dimmed",
|
|
613
|
+
_groupHover: { color: "text" },
|
|
614
|
+
_groupFocusWithin: { color: "mantine.colors.primary.lightColor!" },
|
|
615
|
+
_groupFocusVisible: { color: "mantine.colors.primary.lightColor!" },
|
|
616
|
+
"& :where(.likec4-shape-icon, .likec4-element-icon)": { display: "contents" },
|
|
617
|
+
"& :where(svg, img)": {
|
|
618
|
+
width: "10px",
|
|
619
|
+
height: "10px"
|
|
620
|
+
},
|
|
621
|
+
"@/md": { "& :where(svg, img)": {
|
|
622
|
+
width: "14px",
|
|
623
|
+
height: "14px"
|
|
624
|
+
} },
|
|
625
|
+
"@/lg": { "& :where(svg, img)": {
|
|
626
|
+
width: "16px",
|
|
627
|
+
height: "16px"
|
|
628
|
+
} },
|
|
629
|
+
opacity: {
|
|
630
|
+
base: .8,
|
|
631
|
+
_groupFocusVisible: 1,
|
|
632
|
+
_groupHover: 1
|
|
633
|
+
}
|
|
634
|
+
}), bt = ee.raw({
|
|
635
|
+
paddingLeft: "[calc((var(--depth, 1) - 1) * {spacing.2} + {spacing.1})]",
|
|
636
|
+
px: "1",
|
|
637
|
+
py: "1",
|
|
638
|
+
mb: "0",
|
|
639
|
+
columnGap: "1",
|
|
640
|
+
"@/md": {
|
|
641
|
+
paddingLeft: "[calc((var(--depth, 1) - 1) * {spacing.2} + {spacing.2})]",
|
|
642
|
+
px: "2",
|
|
643
|
+
py: "1.5",
|
|
644
|
+
mb: "0.5",
|
|
645
|
+
columnGap: "2"
|
|
646
|
+
},
|
|
647
|
+
"@/lg": {
|
|
648
|
+
paddingLeft: "[calc((var(--depth, 1) - 1) * {spacing.3} + {spacing.2.5})]",
|
|
649
|
+
py: "2.5"
|
|
650
|
+
},
|
|
651
|
+
cursor: "pointer",
|
|
652
|
+
border: "none",
|
|
653
|
+
appearance: "none",
|
|
654
|
+
width: "full",
|
|
655
|
+
alignItems: "center",
|
|
656
|
+
display: "grid",
|
|
657
|
+
gridTemplateColumns: "auto 1fr auto",
|
|
658
|
+
gridTemplateRows: "auto auto",
|
|
659
|
+
rounded: "sm",
|
|
660
|
+
backgroundColor: {
|
|
661
|
+
base: "transparent",
|
|
662
|
+
_hover: {
|
|
663
|
+
base: "mantine.colors.gray[1]",
|
|
664
|
+
_dark: "mantine.colors.dark[5]"
|
|
665
|
+
},
|
|
666
|
+
_focusWithin: "mantine.colors.primary.lightHover!",
|
|
667
|
+
_focusVisible: "mantine.colors.primary.lightHover!"
|
|
668
|
+
},
|
|
669
|
+
color: {
|
|
670
|
+
base: "text",
|
|
671
|
+
_hover: "text.bright",
|
|
672
|
+
_focusWithin: "mantine.colors.primary.lightColor!",
|
|
673
|
+
_focusVisible: "mantine.colors.primary.lightColor!"
|
|
674
|
+
},
|
|
675
|
+
_focusVisible: { outline: "none" }
|
|
676
|
+
}), { withRootProvider: xt, withContext: B } = v(g({
|
|
677
|
+
slots: [
|
|
678
|
+
"branch",
|
|
679
|
+
"item",
|
|
680
|
+
"control",
|
|
681
|
+
"state",
|
|
682
|
+
"icon",
|
|
683
|
+
"label",
|
|
684
|
+
"content",
|
|
685
|
+
"indicator"
|
|
686
|
+
],
|
|
687
|
+
base: {
|
|
688
|
+
branch: {},
|
|
689
|
+
item: { ...bt },
|
|
690
|
+
control: { ...bt },
|
|
691
|
+
state: {
|
|
692
|
+
border: "none",
|
|
693
|
+
display: "inline-flex",
|
|
694
|
+
alignItems: "center",
|
|
695
|
+
justifySelf: "flex-end",
|
|
696
|
+
marginLeft: "2",
|
|
697
|
+
"--chip-fz": "9px",
|
|
698
|
+
"--chip-checked-padding": "{spacing.1}",
|
|
699
|
+
"--chip-padding": "{spacing.1}",
|
|
700
|
+
"--chip-spacing": "0",
|
|
701
|
+
"--chip-size": "16px",
|
|
702
|
+
transition: "opacity 150ms ease-out"
|
|
703
|
+
},
|
|
704
|
+
icon: { ...yt },
|
|
705
|
+
label: {
|
|
706
|
+
cursor: "inherit",
|
|
707
|
+
color: "inherit",
|
|
708
|
+
userSelect: "none",
|
|
709
|
+
textStyle: "xxs",
|
|
710
|
+
truncate: "ellipsis",
|
|
711
|
+
"@/sm": { textStyle: "xs" },
|
|
712
|
+
"@/md": { textStyle: "sm" },
|
|
713
|
+
fontWeight: "[450]",
|
|
714
|
+
display: "inline-flex",
|
|
715
|
+
alignItems: "center",
|
|
716
|
+
gap: "2"
|
|
717
|
+
},
|
|
718
|
+
indicator: {
|
|
719
|
+
color: "inherit",
|
|
720
|
+
transition: "transform 150ms ease-out",
|
|
721
|
+
width: "12px",
|
|
722
|
+
opacity: .75,
|
|
723
|
+
"@/md": { width: "14px" },
|
|
724
|
+
_open: { transform: "rotate(90deg)" }
|
|
725
|
+
},
|
|
726
|
+
content: {}
|
|
727
|
+
},
|
|
728
|
+
variants: {},
|
|
729
|
+
defaultVariants: {}
|
|
730
|
+
})), St = xt("div"), Ct = B("div", "branch"), wt = B("div", "item", {
|
|
731
|
+
forwardProps: [],
|
|
732
|
+
defaultProps: { className: "group" }
|
|
733
|
+
}), Tt = B("div", "control", {
|
|
734
|
+
forwardProps: [],
|
|
735
|
+
defaultProps: { className: "group" }
|
|
736
|
+
}), ElementState = (e) => {
|
|
737
|
+
let n = O(13), r, i, a, o;
|
|
738
|
+
if (n[0] !== e) {
|
|
739
|
+
let { node: s, state: c, onClick: l, className: u, ...d } = e;
|
|
740
|
+
o = c, i = l, r = u, a = d, n[0] = e, n[1] = r, n[2] = i, n[3] = a, n[4] = o;
|
|
741
|
+
} else r = n[1], i = n[2], a = n[3], o = n[4];
|
|
742
|
+
let s;
|
|
743
|
+
n[5] !== r || n[6] !== o ? (s = b(r, "mantine-active", vt({ state: o })), n[5] = r, n[6] = o, n[7] = s) : s = n[7];
|
|
744
|
+
let c = s, l;
|
|
745
|
+
return n[8] !== c || n[9] !== i || n[10] !== a || n[11] !== o ? (l = /* @__PURE__ */ k("div", {
|
|
746
|
+
...a,
|
|
747
|
+
onClick: i,
|
|
748
|
+
className: c,
|
|
749
|
+
children: o
|
|
750
|
+
}), n[8] = c, n[9] = i, n[10] = a, n[11] = o, n[12] = l) : l = n[12], l;
|
|
751
|
+
}, V = {
|
|
752
|
+
Root: St,
|
|
753
|
+
Branch: Ct,
|
|
754
|
+
Item: wt,
|
|
755
|
+
Control: Tt,
|
|
756
|
+
State: B(ElementState, "state", { forwardProps: [
|
|
757
|
+
"node",
|
|
758
|
+
"state",
|
|
759
|
+
"onClick",
|
|
760
|
+
"className"
|
|
761
|
+
] }),
|
|
762
|
+
Icon: B(de, "icon", { forwardProps: ["element", "className"] }),
|
|
763
|
+
Label: B("div", "label", { forwardProps: [] }),
|
|
764
|
+
Content: B("div", "content", { forwardProps: [] }),
|
|
765
|
+
Indicator: B(ie, "indicator", {
|
|
766
|
+
forwardProps: [],
|
|
767
|
+
defaultProps: { size: 14 }
|
|
768
|
+
})
|
|
769
|
+
}, H = /* @__PURE__ */ function(e) {
|
|
770
|
+
return e[e.None = 0] = "None", e[e.Mutable = 1] = "Mutable", e[e.Watching = 2] = "Watching", e[e.RecursedCheck = 4] = "RecursedCheck", e[e.Recursed = 8] = "Recursed", e[e.Dirty = 16] = "Dirty", e[e.Pending = 32] = "Pending", e;
|
|
771
|
+
}({});
|
|
772
|
+
function createReactiveSystem({ update: e, notify: n, unwatched: r }) {
|
|
773
|
+
return {
|
|
774
|
+
link,
|
|
775
|
+
unlink,
|
|
776
|
+
propagate,
|
|
777
|
+
checkDirty,
|
|
778
|
+
shallowPropagate
|
|
779
|
+
};
|
|
780
|
+
function link(e, n, r) {
|
|
781
|
+
let i = n.depsTail;
|
|
782
|
+
if (i !== void 0 && i.dep === e) return;
|
|
783
|
+
let a = i === void 0 ? n.deps : i.nextDep;
|
|
784
|
+
if (a !== void 0 && a.dep === e) {
|
|
785
|
+
a.version = r, n.depsTail = a;
|
|
786
|
+
return;
|
|
787
|
+
}
|
|
788
|
+
let o = e.subsTail;
|
|
789
|
+
if (o !== void 0 && o.version === r && o.sub === n) return;
|
|
790
|
+
let s = n.depsTail = e.subsTail = {
|
|
791
|
+
version: r,
|
|
792
|
+
dep: e,
|
|
793
|
+
sub: n,
|
|
794
|
+
prevDep: i,
|
|
795
|
+
nextDep: a,
|
|
796
|
+
prevSub: o,
|
|
797
|
+
nextSub: void 0
|
|
798
|
+
};
|
|
799
|
+
a !== void 0 && (a.prevDep = s), i === void 0 ? n.deps = s : i.nextDep = s, o === void 0 ? e.subs = s : o.nextSub = s;
|
|
800
|
+
}
|
|
801
|
+
function unlink(e, n = e.sub) {
|
|
802
|
+
let i = e.dep, a = e.prevDep, o = e.nextDep, s = e.nextSub, c = e.prevSub;
|
|
803
|
+
return o === void 0 ? n.depsTail = a : o.prevDep = a, a === void 0 ? n.deps = o : a.nextDep = o, s === void 0 ? i.subsTail = c : s.prevSub = c, c === void 0 ? (i.subs = s) === void 0 && r(i) : c.nextSub = s, o;
|
|
804
|
+
}
|
|
805
|
+
function propagate(e) {
|
|
806
|
+
let r = e.nextSub, i;
|
|
807
|
+
top: do {
|
|
808
|
+
let a = e.sub, o = a.flags;
|
|
809
|
+
if (o & (H.RecursedCheck | H.Recursed | H.Dirty | H.Pending) ? o & (H.RecursedCheck | H.Recursed) ? o & H.RecursedCheck ? !(o & (H.Dirty | H.Pending)) && isValidLink(e, a) ? (a.flags = o | (H.Recursed | H.Pending), o &= H.Mutable) : o = H.None : a.flags = o & ~H.Recursed | H.Pending : o = H.None : a.flags = o | H.Pending, o & H.Watching && n(a), o & H.Mutable) {
|
|
810
|
+
let n = a.subs;
|
|
811
|
+
if (n !== void 0) {
|
|
812
|
+
let a = (e = n).nextSub;
|
|
813
|
+
a !== void 0 && (i = {
|
|
814
|
+
value: r,
|
|
815
|
+
prev: i
|
|
816
|
+
}, r = a);
|
|
817
|
+
continue;
|
|
818
|
+
}
|
|
819
|
+
}
|
|
820
|
+
if ((e = r) !== void 0) {
|
|
821
|
+
r = e.nextSub;
|
|
822
|
+
continue;
|
|
823
|
+
}
|
|
824
|
+
for (; i !== void 0;) if (e = i.value, i = i.prev, e !== void 0) {
|
|
825
|
+
r = e.nextSub;
|
|
826
|
+
continue top;
|
|
827
|
+
}
|
|
828
|
+
break;
|
|
829
|
+
} while (!0);
|
|
830
|
+
}
|
|
831
|
+
function checkDirty(n, r) {
|
|
832
|
+
let i, a = 0, o = !1;
|
|
833
|
+
top: do {
|
|
834
|
+
let s = n.dep, c = s.flags;
|
|
835
|
+
if (r.flags & H.Dirty) o = !0;
|
|
836
|
+
else if ((c & (H.Mutable | H.Dirty)) === (H.Mutable | H.Dirty)) {
|
|
837
|
+
if (e(s)) {
|
|
838
|
+
let e = s.subs;
|
|
839
|
+
e.nextSub !== void 0 && shallowPropagate(e), o = !0;
|
|
840
|
+
}
|
|
841
|
+
} else if ((c & (H.Mutable | H.Pending)) === (H.Mutable | H.Pending)) {
|
|
842
|
+
(n.nextSub !== void 0 || n.prevSub !== void 0) && (i = {
|
|
843
|
+
value: n,
|
|
844
|
+
prev: i
|
|
845
|
+
}), n = s.deps, r = s, ++a;
|
|
846
|
+
continue;
|
|
847
|
+
}
|
|
848
|
+
if (!o) {
|
|
849
|
+
let e = n.nextDep;
|
|
850
|
+
if (e !== void 0) {
|
|
851
|
+
n = e;
|
|
852
|
+
continue;
|
|
853
|
+
}
|
|
854
|
+
}
|
|
855
|
+
for (; a--;) {
|
|
856
|
+
let a = r.subs, s = a.nextSub !== void 0;
|
|
857
|
+
if (s ? (n = i.value, i = i.prev) : n = a, o) {
|
|
858
|
+
if (e(r)) {
|
|
859
|
+
s && shallowPropagate(a), r = n.sub;
|
|
860
|
+
continue;
|
|
861
|
+
}
|
|
862
|
+
o = !1;
|
|
863
|
+
} else r.flags &= ~H.Pending;
|
|
864
|
+
r = n.sub;
|
|
865
|
+
let c = n.nextDep;
|
|
866
|
+
if (c !== void 0) {
|
|
867
|
+
n = c;
|
|
868
|
+
continue top;
|
|
869
|
+
}
|
|
870
|
+
}
|
|
871
|
+
return o;
|
|
872
|
+
} while (!0);
|
|
873
|
+
}
|
|
874
|
+
function shallowPropagate(e) {
|
|
875
|
+
do {
|
|
876
|
+
let r = e.sub, i = r.flags;
|
|
877
|
+
(i & (H.Pending | H.Dirty)) === H.Pending && (r.flags = i | H.Dirty, (i & (H.Watching | H.RecursedCheck)) === H.Watching && n(r));
|
|
878
|
+
} while ((e = e.nextSub) !== void 0);
|
|
879
|
+
}
|
|
880
|
+
function isValidLink(e, n) {
|
|
881
|
+
let r = n.depsTail;
|
|
882
|
+
for (; r !== void 0;) {
|
|
883
|
+
if (r === e) return !0;
|
|
884
|
+
r = r.prevDep;
|
|
885
|
+
}
|
|
886
|
+
return !1;
|
|
887
|
+
}
|
|
888
|
+
}
|
|
889
|
+
function toObserver(e, n, r) {
|
|
890
|
+
let i = typeof e == "object", a = i ? e : void 0;
|
|
891
|
+
return {
|
|
892
|
+
next: (i ? e.next : e)?.bind(a),
|
|
893
|
+
error: (i ? e.error : n)?.bind(a),
|
|
894
|
+
complete: (i ? e.complete : r)?.bind(a)
|
|
895
|
+
};
|
|
896
|
+
}
|
|
897
|
+
var U = [], W = 0, { link: Et, unlink: Dt, propagate: Ot, checkDirty: kt, shallowPropagate: At } = createReactiveSystem({
|
|
898
|
+
update(e) {
|
|
899
|
+
return e._update();
|
|
900
|
+
},
|
|
901
|
+
notify(e) {
|
|
902
|
+
U[jt++] = e, e.flags &= ~H.Watching;
|
|
903
|
+
},
|
|
904
|
+
unwatched(e) {
|
|
905
|
+
e.depsTail !== void 0 && (e.depsTail = void 0, e.flags = H.Mutable | H.Dirty, purgeDeps(e));
|
|
906
|
+
}
|
|
907
|
+
}), G = 0, jt = 0, K;
|
|
908
|
+
function purgeDeps(e) {
|
|
909
|
+
let n = e.depsTail, r = n === void 0 ? e.deps : n.nextDep;
|
|
910
|
+
for (; r !== void 0;) r = Dt(r, e);
|
|
911
|
+
}
|
|
912
|
+
function flush() {
|
|
913
|
+
for (; G < jt;) {
|
|
914
|
+
let e = U[G];
|
|
915
|
+
U[G++] = void 0, e.notify();
|
|
916
|
+
}
|
|
917
|
+
G = 0, jt = 0;
|
|
918
|
+
}
|
|
919
|
+
function createAtom(e, n) {
|
|
920
|
+
let r = typeof e == "function", i = e, a = {
|
|
921
|
+
_snapshot: r ? void 0 : e,
|
|
922
|
+
subs: void 0,
|
|
923
|
+
subsTail: void 0,
|
|
924
|
+
deps: void 0,
|
|
925
|
+
depsTail: void 0,
|
|
926
|
+
flags: r ? H.None : H.Mutable,
|
|
927
|
+
get() {
|
|
928
|
+
return K !== void 0 && Et(a, K, W), a._snapshot;
|
|
929
|
+
},
|
|
930
|
+
subscribe(e) {
|
|
931
|
+
let n = toObserver(e), r = { current: !1 }, i = effect(() => {
|
|
932
|
+
if (a.get(), !r.current) r.current = !0;
|
|
933
|
+
else {
|
|
934
|
+
let e = K;
|
|
935
|
+
K = void 0;
|
|
936
|
+
try {
|
|
937
|
+
n.next?.(a._snapshot);
|
|
938
|
+
} finally {
|
|
939
|
+
K = e;
|
|
940
|
+
}
|
|
941
|
+
a.get();
|
|
942
|
+
}
|
|
943
|
+
});
|
|
944
|
+
return { unsubscribe: () => {
|
|
945
|
+
i.stop();
|
|
946
|
+
} };
|
|
947
|
+
},
|
|
948
|
+
_update(e) {
|
|
949
|
+
let o = K, s = n?.compare ?? Object.is;
|
|
950
|
+
K = a, ++W, a.depsTail = void 0, r && (a.flags = H.Mutable | H.RecursedCheck);
|
|
951
|
+
try {
|
|
952
|
+
let n = a._snapshot, read = (e) => e.get(), o = typeof e == "function" ? e(n) : e === void 0 && r ? i(read, n) : e;
|
|
953
|
+
return n === void 0 || !s(n, o) ? (a._snapshot = o, !0) : !1;
|
|
954
|
+
} finally {
|
|
955
|
+
K = o, r && (a.flags &= ~H.RecursedCheck), purgeDeps(a);
|
|
956
|
+
}
|
|
957
|
+
}
|
|
958
|
+
};
|
|
959
|
+
return r ? (a.flags = H.Mutable | H.Dirty, a.get = function() {
|
|
960
|
+
let e = a.flags;
|
|
961
|
+
if (e & H.Dirty || e & H.Pending && kt(a.deps, a)) {
|
|
962
|
+
if (a._update()) {
|
|
963
|
+
let e = a.subs;
|
|
964
|
+
e !== void 0 && At(e);
|
|
965
|
+
}
|
|
966
|
+
} else e & H.Pending && (a.flags = e & ~H.Pending);
|
|
967
|
+
return K !== void 0 && Et(a, K, W), a._snapshot;
|
|
968
|
+
}) : a.set = function(e) {
|
|
969
|
+
if (a._update(e)) {
|
|
970
|
+
let e = a.subs;
|
|
971
|
+
e !== void 0 && (Ot(e), At(e), flush());
|
|
972
|
+
}
|
|
973
|
+
}, a;
|
|
974
|
+
}
|
|
975
|
+
function effect(e) {
|
|
976
|
+
let run = () => {
|
|
977
|
+
let r = K;
|
|
978
|
+
K = n, ++W, n.depsTail = void 0, n.flags = H.Watching | H.RecursedCheck;
|
|
979
|
+
try {
|
|
980
|
+
return e();
|
|
981
|
+
} finally {
|
|
982
|
+
K = r, n.flags &= ~H.RecursedCheck, purgeDeps(n);
|
|
983
|
+
}
|
|
984
|
+
}, n = {
|
|
985
|
+
deps: void 0,
|
|
986
|
+
depsTail: void 0,
|
|
987
|
+
subs: void 0,
|
|
988
|
+
subsTail: void 0,
|
|
989
|
+
flags: H.Watching | H.RecursedCheck,
|
|
990
|
+
notify() {
|
|
991
|
+
let e = this.flags;
|
|
992
|
+
e & H.Dirty || e & H.Pending && kt(this.deps, this) ? run() : this.flags = H.Watching;
|
|
993
|
+
},
|
|
994
|
+
stop() {
|
|
995
|
+
this.flags = H.None, this.depsTail = void 0, purgeDeps(this);
|
|
996
|
+
}
|
|
997
|
+
};
|
|
998
|
+
return run(), n;
|
|
999
|
+
}
|
|
1000
|
+
var Mt = typeof Symbol == "function" && Symbol.observable || "@@observable", q = /* @__PURE__ */ new WeakMap();
|
|
1001
|
+
function createStoreCore(e, n) {
|
|
1002
|
+
let r, i = e.getInitialSnapshot(), a = i, o = createAtom(a), emit = (e) => {
|
|
1003
|
+
if (!r) return;
|
|
1004
|
+
let n = e.type, i = r.get(n);
|
|
1005
|
+
i && i.forEach((n) => n(e));
|
|
1006
|
+
let a = r.get("*");
|
|
1007
|
+
a && a.forEach((n) => n(e));
|
|
1008
|
+
}, s = e.transition;
|
|
1009
|
+
function receive(e) {
|
|
1010
|
+
let [r, i] = s(a, e);
|
|
1011
|
+
a = r, q.get(c)?.forEach((n) => {
|
|
1012
|
+
n.next?.({
|
|
1013
|
+
type: "@xstate.snapshot",
|
|
1014
|
+
event: e,
|
|
1015
|
+
snapshot: r,
|
|
1016
|
+
actorRef: c,
|
|
1017
|
+
rootId: c.sessionId
|
|
1018
|
+
});
|
|
1019
|
+
}), o.set(r);
|
|
1020
|
+
for (let e of i) typeof e == "function" ? e() : (n?.[e.type]?.(e), emit(e));
|
|
1021
|
+
}
|
|
1022
|
+
let c = {
|
|
1023
|
+
get _snapshot() {
|
|
1024
|
+
return o._snapshot;
|
|
1025
|
+
},
|
|
1026
|
+
on(e, n) {
|
|
1027
|
+
r ||= /* @__PURE__ */ new Map();
|
|
1028
|
+
let i = r.get(e);
|
|
1029
|
+
i || (i = /* @__PURE__ */ new Set(), r.set(e, i));
|
|
1030
|
+
let a = n.bind(void 0);
|
|
1031
|
+
return i.add(a), { unsubscribe() {
|
|
1032
|
+
i.delete(a);
|
|
1033
|
+
} };
|
|
1034
|
+
},
|
|
1035
|
+
transition: e.transition,
|
|
1036
|
+
sessionId: uniqueId(),
|
|
1037
|
+
send(e) {
|
|
1038
|
+
q.get(c)?.forEach((n) => {
|
|
1039
|
+
n.next?.({
|
|
1040
|
+
type: "@xstate.event",
|
|
1041
|
+
event: e,
|
|
1042
|
+
sourceRef: void 0,
|
|
1043
|
+
actorRef: c,
|
|
1044
|
+
rootId: c.sessionId
|
|
1045
|
+
});
|
|
1046
|
+
}), receive(e);
|
|
1047
|
+
},
|
|
1048
|
+
getSnapshot() {
|
|
1049
|
+
return a;
|
|
1050
|
+
},
|
|
1051
|
+
get() {
|
|
1052
|
+
return o.get();
|
|
1053
|
+
},
|
|
1054
|
+
getInitialSnapshot() {
|
|
1055
|
+
return i;
|
|
1056
|
+
},
|
|
1057
|
+
subscribe: o.subscribe.bind(o),
|
|
1058
|
+
[Mt]() {
|
|
1059
|
+
return this;
|
|
1060
|
+
},
|
|
1061
|
+
inspect: (e) => {
|
|
1062
|
+
let n = toObserver(e);
|
|
1063
|
+
return q.set(c, q.get(c) ?? /* @__PURE__ */ new Set()), q.get(c).add(n), n.next?.({
|
|
1064
|
+
type: "@xstate.actor",
|
|
1065
|
+
actorRef: c,
|
|
1066
|
+
rootId: c.sessionId
|
|
1067
|
+
}), n.next?.({
|
|
1068
|
+
type: "@xstate.snapshot",
|
|
1069
|
+
snapshot: i,
|
|
1070
|
+
event: { type: "@xstate.init" },
|
|
1071
|
+
actorRef: c,
|
|
1072
|
+
rootId: c.sessionId
|
|
1073
|
+
}), { unsubscribe() {
|
|
1074
|
+
return q.get(c)?.delete(n);
|
|
1075
|
+
} };
|
|
1076
|
+
},
|
|
1077
|
+
trigger: new Proxy({}, { get: (e, n) => (e) => {
|
|
1078
|
+
c.send({
|
|
1079
|
+
...e,
|
|
1080
|
+
type: n
|
|
1081
|
+
});
|
|
1082
|
+
} }),
|
|
1083
|
+
select(e, n = Object.is) {
|
|
1084
|
+
return createAtom(() => e(c.get().context), { compare: n });
|
|
1085
|
+
},
|
|
1086
|
+
with(r) {
|
|
1087
|
+
return createStoreCore(r(e), n);
|
|
1088
|
+
}
|
|
1089
|
+
};
|
|
1090
|
+
return c;
|
|
1091
|
+
}
|
|
1092
|
+
function createStore(e) {
|
|
1093
|
+
return "transition" in e ? createStoreCore(e) : createStoreCore({
|
|
1094
|
+
getInitialSnapshot: () => ({
|
|
1095
|
+
status: "active",
|
|
1096
|
+
context: e.context,
|
|
1097
|
+
output: void 0,
|
|
1098
|
+
error: void 0
|
|
1099
|
+
}),
|
|
1100
|
+
transition: createStoreTransition(e.on)
|
|
1101
|
+
}, e.emits);
|
|
1102
|
+
}
|
|
1103
|
+
function createStoreTransition(e, n) {
|
|
1104
|
+
return (r, i) => {
|
|
1105
|
+
let a = r.context, o = e?.[i.type], s = [], c = {
|
|
1106
|
+
emit: new Proxy({}, { get: (e, n) => (e) => {
|
|
1107
|
+
s.push({
|
|
1108
|
+
...e,
|
|
1109
|
+
type: n
|
|
1110
|
+
});
|
|
1111
|
+
} }),
|
|
1112
|
+
effect: (e) => {
|
|
1113
|
+
s.push(e);
|
|
1114
|
+
}
|
|
1115
|
+
};
|
|
1116
|
+
if (!o) return [r, s];
|
|
1117
|
+
let l = n ? n(a, (e) => o(e, i, c)) : o(a, i, c) ?? a;
|
|
1118
|
+
return [l === a ? r : {
|
|
1119
|
+
...r,
|
|
1120
|
+
context: l
|
|
1121
|
+
}, s];
|
|
1122
|
+
};
|
|
1123
|
+
}
|
|
1124
|
+
function uniqueId() {
|
|
1125
|
+
return Math.random().toString(36).slice(6);
|
|
1126
|
+
}
|
|
1127
|
+
//#endregion
|
|
1128
|
+
//#region ../../node_modules/.pnpm/@xstate+store@3.17.5_react@19.2.7/node_modules/@xstate/store/dist/xstate-store.esm.js
|
|
1129
|
+
function is(e, n) {
|
|
1130
|
+
return e === n ? e !== 0 || n !== 0 || 1 / e == 1 / n : e !== e && n !== n;
|
|
1131
|
+
}
|
|
1132
|
+
function shallowEqual(e, n) {
|
|
1133
|
+
if (is(e, n)) return !0;
|
|
1134
|
+
if (typeof e != "object" || !e || typeof n != "object" || !n) return !1;
|
|
1135
|
+
let r = Object.keys(e), i = Object.keys(n);
|
|
1136
|
+
if (r.length !== i.length) return !1;
|
|
1137
|
+
for (let i = 0; i < r.length; i++) if (!Object.prototype.hasOwnProperty.call(n, r[i]) || !is(e[r[i]], n[r[i]])) return !1;
|
|
1138
|
+
return !0;
|
|
1139
|
+
}
|
|
1140
|
+
//#endregion
|
|
1141
|
+
//#region ../../node_modules/.pnpm/@xstate+store@3.17.5_react@19.2.7/node_modules/@xstate/store/react/dist/xstate-store-react.esm.js
|
|
1142
|
+
function defaultCompare(e, n) {
|
|
1143
|
+
return e === n;
|
|
1144
|
+
}
|
|
1145
|
+
function identity(e) {
|
|
1146
|
+
return e;
|
|
1147
|
+
}
|
|
1148
|
+
function useSelectorWithCompare(e, n) {
|
|
1149
|
+
let r = E(void 0);
|
|
1150
|
+
return (i) => {
|
|
1151
|
+
let a = e(i);
|
|
1152
|
+
return r.current && n(r.current, a) ? r.current : r.current = a;
|
|
1153
|
+
};
|
|
1154
|
+
}
|
|
1155
|
+
function useSelector(e, n = identity, r = defaultCompare) {
|
|
1156
|
+
let i = useSelectorWithCompare(n, r);
|
|
1157
|
+
return ze(Fe((n) => e.subscribe(n).unsubscribe, [e]), () => i(e.get()), () => i(e.get()));
|
|
1158
|
+
}
|
|
1159
|
+
//#endregion
|
|
1160
|
+
//#region ../diagram/src/adhoc-editor/hooks.ts
|
|
1161
|
+
var Nt = Pe(null), Pt = Nt.Provider;
|
|
1162
|
+
function useAdhocEditorActor() {
|
|
1163
|
+
let e = O(2), n = Ie(Nt), r;
|
|
1164
|
+
return e[0] === n ? r = e[1] : (r = Be(n, "No AdhocEditorActorContext"), e[0] = n, e[1] = r), r;
|
|
1165
|
+
}
|
|
1166
|
+
var Ft = {
|
|
1167
|
+
id: "adhoc",
|
|
1168
|
+
_type: "element",
|
|
1169
|
+
autoLayout: { direction: "LR" },
|
|
1170
|
+
nodes: [],
|
|
1171
|
+
edges: [],
|
|
1172
|
+
bounds: {
|
|
1173
|
+
x: 0,
|
|
1174
|
+
y: 0,
|
|
1175
|
+
width: 0,
|
|
1176
|
+
height: 0
|
|
1177
|
+
},
|
|
1178
|
+
_stage: "layouted",
|
|
1179
|
+
title: null,
|
|
1180
|
+
description: null,
|
|
1181
|
+
hash: ""
|
|
1182
|
+
}, selectView = ({ context: e }) => e.view ?? Ft;
|
|
1183
|
+
function useAdhocView() {
|
|
1184
|
+
return Ae(useAdhocEditorActor(), selectView);
|
|
1185
|
+
}
|
|
1186
|
+
//#endregion
|
|
1187
|
+
//#region ../../node_modules/.pnpm/@zag-js+anatomy@1.33.1/node_modules/@zag-js/anatomy/dist/index.mjs
|
|
1188
|
+
var createAnatomy = (e, n = []) => ({
|
|
1189
|
+
parts: (...r) => {
|
|
1190
|
+
if (isEmpty(n)) return createAnatomy(e, r);
|
|
1191
|
+
throw Error("createAnatomy().parts(...) should only be called once. Did you mean to use .extendWith(...) ?");
|
|
1192
|
+
},
|
|
1193
|
+
extendWith: (...r) => createAnatomy(e, [...n, ...r]),
|
|
1194
|
+
omit: (...r) => createAnatomy(e, n.filter((e) => !r.includes(e))),
|
|
1195
|
+
rename: (e) => createAnatomy(e, n),
|
|
1196
|
+
keys: () => n,
|
|
1197
|
+
build: () => [...new Set(n)].reduce((n, r) => Object.assign(n, { [r]: {
|
|
1198
|
+
selector: [`&[data-scope="${toKebabCase(e)}"][data-part="${toKebabCase(r)}"]`, `& [data-scope="${toKebabCase(e)}"][data-part="${toKebabCase(r)}"]`].join(", "),
|
|
1199
|
+
attrs: {
|
|
1200
|
+
"data-scope": toKebabCase(e),
|
|
1201
|
+
"data-part": toKebabCase(r)
|
|
1202
|
+
}
|
|
1203
|
+
} }), {})
|
|
1204
|
+
}), toKebabCase = (e) => e.replace(/([A-Z])([A-Z])/g, "$1-$2").replace(/([a-z])([A-Z])/g, "$1-$2").replace(/[\s_]+/g, "-").toLowerCase(), isEmpty = (e) => e.length === 0, It = Object.defineProperty, __defNormalProp = (e, n, r) => n in e ? It(e, n, {
|
|
1205
|
+
enumerable: !0,
|
|
1206
|
+
configurable: !0,
|
|
1207
|
+
writable: !0,
|
|
1208
|
+
value: r
|
|
1209
|
+
}) : e[n] = r, __publicField = (e, n, r) => __defNormalProp(e, typeof n == "symbol" ? n : n + "", r);
|
|
1210
|
+
function access(e, n, r) {
|
|
1211
|
+
for (let i = 0; i < n.length; i++) e = r.getChildren(e, n.slice(i + 1))[n[i]];
|
|
1212
|
+
return e;
|
|
1213
|
+
}
|
|
1214
|
+
function ancestorIndexPaths(e) {
|
|
1215
|
+
let n = sortIndexPaths(e), r = [], i = /* @__PURE__ */ new Set();
|
|
1216
|
+
for (let e of n) {
|
|
1217
|
+
let n = e.join();
|
|
1218
|
+
i.has(n) || (i.add(n), r.push(e));
|
|
1219
|
+
}
|
|
1220
|
+
return r;
|
|
1221
|
+
}
|
|
1222
|
+
function compareIndexPaths(e, n) {
|
|
1223
|
+
for (let r = 0; r < Math.min(e.length, n.length); r++) {
|
|
1224
|
+
if (e[r] < n[r]) return -1;
|
|
1225
|
+
if (e[r] > n[r]) return 1;
|
|
1226
|
+
}
|
|
1227
|
+
return e.length - n.length;
|
|
1228
|
+
}
|
|
1229
|
+
function sortIndexPaths(e) {
|
|
1230
|
+
return e.sort(compareIndexPaths);
|
|
1231
|
+
}
|
|
1232
|
+
function find(e, n) {
|
|
1233
|
+
let r;
|
|
1234
|
+
return visit(e, {
|
|
1235
|
+
...n,
|
|
1236
|
+
onEnter: (e, i) => {
|
|
1237
|
+
if (n.predicate(e, i)) return r = e, "stop";
|
|
1238
|
+
}
|
|
1239
|
+
}), r;
|
|
1240
|
+
}
|
|
1241
|
+
function findAll(e, n) {
|
|
1242
|
+
let r = [];
|
|
1243
|
+
return visit(e, {
|
|
1244
|
+
onEnter: (e, i) => {
|
|
1245
|
+
n.predicate(e, i) && r.push(e);
|
|
1246
|
+
},
|
|
1247
|
+
getChildren: n.getChildren
|
|
1248
|
+
}), r;
|
|
1249
|
+
}
|
|
1250
|
+
function findIndexPath(e, n) {
|
|
1251
|
+
let r;
|
|
1252
|
+
return visit(e, {
|
|
1253
|
+
onEnter: (e, i) => {
|
|
1254
|
+
if (n.predicate(e, i)) return r = [...i], "stop";
|
|
1255
|
+
},
|
|
1256
|
+
getChildren: n.getChildren
|
|
1257
|
+
}), r;
|
|
1258
|
+
}
|
|
1259
|
+
function reduce(e, n) {
|
|
1260
|
+
let r = n.initialResult;
|
|
1261
|
+
return visit(e, {
|
|
1262
|
+
...n,
|
|
1263
|
+
onEnter: (e, i) => {
|
|
1264
|
+
r = n.nextResult(r, e, i);
|
|
1265
|
+
}
|
|
1266
|
+
}), r;
|
|
1267
|
+
}
|
|
1268
|
+
function flatMap(e, n) {
|
|
1269
|
+
return reduce(e, {
|
|
1270
|
+
...n,
|
|
1271
|
+
initialResult: [],
|
|
1272
|
+
nextResult: (e, r, i) => (e.push(...n.transform(r, i)), e)
|
|
1273
|
+
});
|
|
1274
|
+
}
|
|
1275
|
+
function filter(e, n) {
|
|
1276
|
+
let { predicate: r, create: i, getChildren: a } = n, filterRecursive = (e, n) => {
|
|
1277
|
+
let o = a(e, n), s = [];
|
|
1278
|
+
o.forEach((e, r) => {
|
|
1279
|
+
let i = filterRecursive(e, [...n, r]);
|
|
1280
|
+
i && s.push(i);
|
|
1281
|
+
});
|
|
1282
|
+
let c = n.length === 0, l = r(e, n), u = s.length > 0;
|
|
1283
|
+
return c || l || u ? i(e, s, n) : null;
|
|
1284
|
+
};
|
|
1285
|
+
return filterRecursive(e, []) || i(e, [], []);
|
|
1286
|
+
}
|
|
1287
|
+
function flatten(e, n) {
|
|
1288
|
+
let r = [], i = 0, a = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map();
|
|
1289
|
+
return visit(e, {
|
|
1290
|
+
getChildren: n.getChildren,
|
|
1291
|
+
onEnter: (e, s) => {
|
|
1292
|
+
a.has(e) || a.set(e, i++);
|
|
1293
|
+
let c = n.getChildren(e, s);
|
|
1294
|
+
c.forEach((n) => {
|
|
1295
|
+
o.has(n) || o.set(n, e), a.has(n) || a.set(n, i++);
|
|
1296
|
+
});
|
|
1297
|
+
let l = c.length > 0 ? c.map((e) => a.get(e)) : void 0, u = o.get(e), d = u ? a.get(u) : void 0, f = a.get(e);
|
|
1298
|
+
r.push({
|
|
1299
|
+
...e,
|
|
1300
|
+
_children: l,
|
|
1301
|
+
_parent: d,
|
|
1302
|
+
_index: f
|
|
1303
|
+
});
|
|
1304
|
+
}
|
|
1305
|
+
}), r;
|
|
1306
|
+
}
|
|
1307
|
+
function insertOperation(e, n) {
|
|
1308
|
+
return {
|
|
1309
|
+
type: "insert",
|
|
1310
|
+
index: e,
|
|
1311
|
+
nodes: n
|
|
1312
|
+
};
|
|
1313
|
+
}
|
|
1314
|
+
function removeOperation(e) {
|
|
1315
|
+
return {
|
|
1316
|
+
type: "remove",
|
|
1317
|
+
indexes: e
|
|
1318
|
+
};
|
|
1319
|
+
}
|
|
1320
|
+
function replaceOperation() {
|
|
1321
|
+
return { type: "replace" };
|
|
1322
|
+
}
|
|
1323
|
+
function splitIndexPath(e) {
|
|
1324
|
+
return [e.slice(0, -1), e[e.length - 1]];
|
|
1325
|
+
}
|
|
1326
|
+
function getInsertionOperations(e, n, r = /* @__PURE__ */ new Map()) {
|
|
1327
|
+
let [i, a] = splitIndexPath(e);
|
|
1328
|
+
for (let e = i.length - 1; e >= 0; e--) {
|
|
1329
|
+
let n = i.slice(0, e).join();
|
|
1330
|
+
switch (r.get(n)?.type) {
|
|
1331
|
+
case "remove": continue;
|
|
1332
|
+
}
|
|
1333
|
+
r.set(n, replaceOperation());
|
|
1334
|
+
}
|
|
1335
|
+
let o = r.get(i.join());
|
|
1336
|
+
switch (o?.type) {
|
|
1337
|
+
case "remove":
|
|
1338
|
+
r.set(i.join(), {
|
|
1339
|
+
type: "removeThenInsert",
|
|
1340
|
+
removeIndexes: o.indexes,
|
|
1341
|
+
insertIndex: a,
|
|
1342
|
+
insertNodes: n
|
|
1343
|
+
});
|
|
1344
|
+
break;
|
|
1345
|
+
default: r.set(i.join(), insertOperation(a, n));
|
|
1346
|
+
}
|
|
1347
|
+
return r;
|
|
1348
|
+
}
|
|
1349
|
+
function getRemovalOperations(e) {
|
|
1350
|
+
let n = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map();
|
|
1351
|
+
for (let n of e) {
|
|
1352
|
+
let e = n.slice(0, -1).join(), i = r.get(e) ?? [];
|
|
1353
|
+
i.push(n[n.length - 1]), r.set(e, i.sort((e, n) => e - n));
|
|
1354
|
+
}
|
|
1355
|
+
for (let r of e) for (let e = r.length - 2; e >= 0; e--) {
|
|
1356
|
+
let i = r.slice(0, e).join();
|
|
1357
|
+
n.has(i) || n.set(i, replaceOperation());
|
|
1358
|
+
}
|
|
1359
|
+
for (let [e, i] of r) n.set(e, removeOperation(i));
|
|
1360
|
+
return n;
|
|
1361
|
+
}
|
|
1362
|
+
function getReplaceOperations(e, n) {
|
|
1363
|
+
let r = /* @__PURE__ */ new Map(), [i, a] = splitIndexPath(e);
|
|
1364
|
+
for (let e = i.length - 1; e >= 0; e--) {
|
|
1365
|
+
let n = i.slice(0, e).join();
|
|
1366
|
+
r.set(n, replaceOperation());
|
|
1367
|
+
}
|
|
1368
|
+
return r.set(i.join(), {
|
|
1369
|
+
type: "removeThenInsert",
|
|
1370
|
+
removeIndexes: [a],
|
|
1371
|
+
insertIndex: a,
|
|
1372
|
+
insertNodes: [n]
|
|
1373
|
+
}), r;
|
|
1374
|
+
}
|
|
1375
|
+
function mutate(e, n, r) {
|
|
1376
|
+
return map(e, {
|
|
1377
|
+
...r,
|
|
1378
|
+
getChildren: (e, i) => {
|
|
1379
|
+
let a = i.join();
|
|
1380
|
+
switch (n.get(a)?.type) {
|
|
1381
|
+
case "replace":
|
|
1382
|
+
case "remove":
|
|
1383
|
+
case "removeThenInsert":
|
|
1384
|
+
case "insert": return r.getChildren(e, i);
|
|
1385
|
+
default: return [];
|
|
1386
|
+
}
|
|
1387
|
+
},
|
|
1388
|
+
transform: (e, i, a) => {
|
|
1389
|
+
let o = a.join(), s = n.get(o);
|
|
1390
|
+
switch (s?.type) {
|
|
1391
|
+
case "remove": return r.create(e, i.filter((e, n) => !s.indexes.includes(n)), a);
|
|
1392
|
+
case "removeThenInsert":
|
|
1393
|
+
let n = i.filter((e, n) => !s.removeIndexes.includes(n)), o = s.removeIndexes.reduce((e, n) => n < e ? e - 1 : e, s.insertIndex);
|
|
1394
|
+
return r.create(e, splice(n, o, 0, ...s.insertNodes), a);
|
|
1395
|
+
case "insert": return r.create(e, splice(i, s.index, 0, ...s.nodes), a);
|
|
1396
|
+
case "replace": return r.create(e, i, a);
|
|
1397
|
+
default: return e;
|
|
1398
|
+
}
|
|
1399
|
+
}
|
|
1400
|
+
});
|
|
1401
|
+
}
|
|
1402
|
+
function splice(e, n, r, ...i) {
|
|
1403
|
+
return [
|
|
1404
|
+
...e.slice(0, n),
|
|
1405
|
+
...i,
|
|
1406
|
+
...e.slice(n + r)
|
|
1407
|
+
];
|
|
1408
|
+
}
|
|
1409
|
+
function map(e, n) {
|
|
1410
|
+
let r = {};
|
|
1411
|
+
return visit(e, {
|
|
1412
|
+
...n,
|
|
1413
|
+
onLeave: (e, i) => {
|
|
1414
|
+
let a = [0, ...i], o = a.join(), s = n.transform(e, r[o] ?? [], i), c = a.slice(0, -1).join(), l = r[c] ?? [];
|
|
1415
|
+
l.push(s), r[c] = l;
|
|
1416
|
+
}
|
|
1417
|
+
}), r[""][0];
|
|
1418
|
+
}
|
|
1419
|
+
function insert2(e, n) {
|
|
1420
|
+
let { nodes: r, at: i } = n;
|
|
1421
|
+
if (i.length === 0) throw Error("Can't insert nodes at the root");
|
|
1422
|
+
return mutate(e, getInsertionOperations(i, r), n);
|
|
1423
|
+
}
|
|
1424
|
+
function replace(e, n) {
|
|
1425
|
+
return n.at.length === 0 ? n.node : mutate(e, getReplaceOperations(n.at, n.node), n);
|
|
1426
|
+
}
|
|
1427
|
+
function remove(e, n) {
|
|
1428
|
+
if (n.indexPaths.length === 0) return e;
|
|
1429
|
+
for (let e of n.indexPaths) if (e.length === 0) throw Error("Can't remove the root node");
|
|
1430
|
+
return mutate(e, getRemovalOperations(n.indexPaths), n);
|
|
1431
|
+
}
|
|
1432
|
+
function move2(e, n) {
|
|
1433
|
+
if (n.indexPaths.length === 0) return e;
|
|
1434
|
+
for (let e of n.indexPaths) if (e.length === 0) throw Error("Can't move the root node");
|
|
1435
|
+
if (n.to.length === 0) throw Error("Can't move nodes to the root");
|
|
1436
|
+
let r = ancestorIndexPaths(n.indexPaths), i = r.map((r) => access(e, r, n));
|
|
1437
|
+
return mutate(e, getInsertionOperations(n.to, i, getRemovalOperations(r)), n);
|
|
1438
|
+
}
|
|
1439
|
+
function visit(e, n) {
|
|
1440
|
+
let { onEnter: r, onLeave: i, getChildren: a } = n, o = [], s = [{ node: e }], c = n.reuseIndexPath ? () => o : () => o.slice();
|
|
1441
|
+
for (; s.length > 0;) {
|
|
1442
|
+
let e = s[s.length - 1];
|
|
1443
|
+
if (e.state === void 0) {
|
|
1444
|
+
let n = r?.(e.node, c());
|
|
1445
|
+
if (n === "stop") return;
|
|
1446
|
+
e.state = n === "skip" ? -1 : 0;
|
|
1447
|
+
}
|
|
1448
|
+
let n = e.children || a(e.node, c());
|
|
1449
|
+
if (e.children ||= n, e.state !== -1) {
|
|
1450
|
+
if (e.state < n.length) {
|
|
1451
|
+
let r = e.state;
|
|
1452
|
+
o.push(r), s.push({ node: n[r] }), e.state = r + 1;
|
|
1453
|
+
continue;
|
|
1454
|
+
}
|
|
1455
|
+
if (i?.(e.node, c()) === "stop") return;
|
|
1456
|
+
}
|
|
1457
|
+
o.pop(), s.pop();
|
|
1458
|
+
}
|
|
1459
|
+
}
|
|
1460
|
+
var Lt = class _TreeCollection {
|
|
1461
|
+
constructor(e) {
|
|
1462
|
+
this.options = e, __publicField(this, "rootNode"), __publicField(this, "isEqual", (e) => isEqual(this.rootNode, e.rootNode)), __publicField(this, "getNodeChildren", (e) => this.options.nodeToChildren?.(e) ?? J.nodeToChildren(e) ?? []), __publicField(this, "resolveIndexPath", (e) => typeof e == "string" ? this.getIndexPath(e) : e), __publicField(this, "resolveNode", (e) => {
|
|
1463
|
+
let n = this.resolveIndexPath(e);
|
|
1464
|
+
return n ? this.at(n) : void 0;
|
|
1465
|
+
}), __publicField(this, "getNodeChildrenCount", (e) => this.options.nodeToChildrenCount?.(e) ?? J.nodeToChildrenCount(e)), __publicField(this, "getNodeValue", (e) => this.options.nodeToValue?.(e) ?? J.nodeToValue(e)), __publicField(this, "getNodeDisabled", (e) => this.options.isNodeDisabled?.(e) ?? J.isNodeDisabled(e)), __publicField(this, "stringify", (e) => {
|
|
1466
|
+
let n = this.findNode(e);
|
|
1467
|
+
return n ? this.stringifyNode(n) : null;
|
|
1468
|
+
}), __publicField(this, "stringifyNode", (e) => this.options.nodeToString?.(e) ?? J.nodeToString(e)), __publicField(this, "getFirstNode", (e = this.rootNode, n = {}) => {
|
|
1469
|
+
let r;
|
|
1470
|
+
return visit(e, {
|
|
1471
|
+
getChildren: this.getNodeChildren,
|
|
1472
|
+
onEnter: (i, a) => {
|
|
1473
|
+
if (!this.isSameNode(i, e)) {
|
|
1474
|
+
if (n.skip?.({
|
|
1475
|
+
value: this.getNodeValue(i),
|
|
1476
|
+
node: i,
|
|
1477
|
+
indexPath: a
|
|
1478
|
+
})) return "skip";
|
|
1479
|
+
if (!r && a.length > 0 && !this.getNodeDisabled(i)) return r = i, "stop";
|
|
1480
|
+
}
|
|
1481
|
+
}
|
|
1482
|
+
}), r;
|
|
1483
|
+
}), __publicField(this, "getLastNode", (e = this.rootNode, n = {}) => {
|
|
1484
|
+
let r;
|
|
1485
|
+
return visit(e, {
|
|
1486
|
+
getChildren: this.getNodeChildren,
|
|
1487
|
+
onEnter: (i, a) => {
|
|
1488
|
+
if (!this.isSameNode(i, e)) {
|
|
1489
|
+
if (n.skip?.({
|
|
1490
|
+
value: this.getNodeValue(i),
|
|
1491
|
+
node: i,
|
|
1492
|
+
indexPath: a
|
|
1493
|
+
})) return "skip";
|
|
1494
|
+
a.length > 0 && !this.getNodeDisabled(i) && (r = i);
|
|
1495
|
+
}
|
|
1496
|
+
}
|
|
1497
|
+
}), r;
|
|
1498
|
+
}), __publicField(this, "at", (e) => access(this.rootNode, e, { getChildren: this.getNodeChildren })), __publicField(this, "findNode", (e, n = this.rootNode) => find(n, {
|
|
1499
|
+
getChildren: this.getNodeChildren,
|
|
1500
|
+
predicate: (n) => this.getNodeValue(n) === e
|
|
1501
|
+
})), __publicField(this, "findNodes", (e, n = this.rootNode) => {
|
|
1502
|
+
let r = new Set(e.filter((e) => e != null));
|
|
1503
|
+
return findAll(n, {
|
|
1504
|
+
getChildren: this.getNodeChildren,
|
|
1505
|
+
predicate: (e) => r.has(this.getNodeValue(e))
|
|
1506
|
+
});
|
|
1507
|
+
}), __publicField(this, "sort", (e) => e.reduce((e, n) => {
|
|
1508
|
+
let r = this.getIndexPath(n);
|
|
1509
|
+
return r && e.push({
|
|
1510
|
+
value: n,
|
|
1511
|
+
indexPath: r
|
|
1512
|
+
}), e;
|
|
1513
|
+
}, []).sort((e, n) => compareIndexPaths(e.indexPath, n.indexPath)).map(({ value: e }) => e)), __publicField(this, "getIndexPath", (e) => findIndexPath(this.rootNode, {
|
|
1514
|
+
getChildren: this.getNodeChildren,
|
|
1515
|
+
predicate: (n) => this.getNodeValue(n) === e
|
|
1516
|
+
})), __publicField(this, "getValue", (e) => {
|
|
1517
|
+
let n = this.at(e);
|
|
1518
|
+
return n ? this.getNodeValue(n) : void 0;
|
|
1519
|
+
}), __publicField(this, "getValuePath", (e) => {
|
|
1520
|
+
if (!e) return [];
|
|
1521
|
+
let n = [], r = [...e];
|
|
1522
|
+
for (; r.length > 0;) {
|
|
1523
|
+
let e = this.at(r);
|
|
1524
|
+
e && n.unshift(this.getNodeValue(e)), r.pop();
|
|
1525
|
+
}
|
|
1526
|
+
return n;
|
|
1527
|
+
}), __publicField(this, "getDepth", (e) => findIndexPath(this.rootNode, {
|
|
1528
|
+
getChildren: this.getNodeChildren,
|
|
1529
|
+
predicate: (n) => this.getNodeValue(n) === e
|
|
1530
|
+
})?.length ?? 0), __publicField(this, "isSameNode", (e, n) => this.getNodeValue(e) === this.getNodeValue(n)), __publicField(this, "isRootNode", (e) => this.isSameNode(e, this.rootNode)), __publicField(this, "contains", (e, n) => !e || !n ? !1 : n.slice(0, e.length).every((r, i) => e[i] === n[i])), __publicField(this, "getNextNode", (e, n = {}) => {
|
|
1531
|
+
let r = !1, i;
|
|
1532
|
+
return visit(this.rootNode, {
|
|
1533
|
+
getChildren: this.getNodeChildren,
|
|
1534
|
+
onEnter: (a, o) => {
|
|
1535
|
+
if (this.isRootNode(a)) return;
|
|
1536
|
+
let s = this.getNodeValue(a);
|
|
1537
|
+
if (n.skip?.({
|
|
1538
|
+
value: s,
|
|
1539
|
+
node: a,
|
|
1540
|
+
indexPath: o
|
|
1541
|
+
})) return s === e && (r = !0), "skip";
|
|
1542
|
+
if (r && !this.getNodeDisabled(a)) return i = a, "stop";
|
|
1543
|
+
s === e && (r = !0);
|
|
1544
|
+
}
|
|
1545
|
+
}), i;
|
|
1546
|
+
}), __publicField(this, "getPreviousNode", (e, n = {}) => {
|
|
1547
|
+
let r, i = !1;
|
|
1548
|
+
return visit(this.rootNode, {
|
|
1549
|
+
getChildren: this.getNodeChildren,
|
|
1550
|
+
onEnter: (a, o) => {
|
|
1551
|
+
if (this.isRootNode(a)) return;
|
|
1552
|
+
let s = this.getNodeValue(a);
|
|
1553
|
+
if (n.skip?.({
|
|
1554
|
+
value: s,
|
|
1555
|
+
node: a,
|
|
1556
|
+
indexPath: o
|
|
1557
|
+
})) return "skip";
|
|
1558
|
+
if (s === e) return i = !0, "stop";
|
|
1559
|
+
this.getNodeDisabled(a) || (r = a);
|
|
1560
|
+
}
|
|
1561
|
+
}), i ? r : void 0;
|
|
1562
|
+
}), __publicField(this, "getParentNodes", (e) => {
|
|
1563
|
+
let n = this.resolveIndexPath(e)?.slice();
|
|
1564
|
+
if (!n) return [];
|
|
1565
|
+
let r = [];
|
|
1566
|
+
for (; n.length > 0;) {
|
|
1567
|
+
n.pop();
|
|
1568
|
+
let e = this.at(n);
|
|
1569
|
+
e && !this.isRootNode(e) && r.unshift(e);
|
|
1570
|
+
}
|
|
1571
|
+
return r;
|
|
1572
|
+
}), __publicField(this, "getDescendantNodes", (e, n) => {
|
|
1573
|
+
let r = this.resolveNode(e);
|
|
1574
|
+
if (!r) return [];
|
|
1575
|
+
let i = [];
|
|
1576
|
+
return visit(r, {
|
|
1577
|
+
getChildren: this.getNodeChildren,
|
|
1578
|
+
onEnter: (e, r) => {
|
|
1579
|
+
r.length !== 0 && (!n?.withBranch && this.isBranchNode(e) || i.push(e));
|
|
1580
|
+
}
|
|
1581
|
+
}), i;
|
|
1582
|
+
}), __publicField(this, "getDescendantValues", (e, n) => this.getDescendantNodes(e, n).map((e) => this.getNodeValue(e))), __publicField(this, "getParentIndexPath", (e) => e.slice(0, -1)), __publicField(this, "getParentNode", (e) => {
|
|
1583
|
+
let n = this.resolveIndexPath(e);
|
|
1584
|
+
return n ? this.at(this.getParentIndexPath(n)) : void 0;
|
|
1585
|
+
}), __publicField(this, "visit", (e) => {
|
|
1586
|
+
let { skip: n, ...r } = e;
|
|
1587
|
+
visit(this.rootNode, {
|
|
1588
|
+
...r,
|
|
1589
|
+
getChildren: this.getNodeChildren,
|
|
1590
|
+
onEnter: (e, i) => {
|
|
1591
|
+
if (!this.isRootNode(e)) return n?.({
|
|
1592
|
+
value: this.getNodeValue(e),
|
|
1593
|
+
node: e,
|
|
1594
|
+
indexPath: i
|
|
1595
|
+
}) ? "skip" : r.onEnter?.(e, i);
|
|
1596
|
+
}
|
|
1597
|
+
});
|
|
1598
|
+
}), __publicField(this, "getPreviousSibling", (e) => {
|
|
1599
|
+
let n = this.getParentNode(e);
|
|
1600
|
+
if (!n) return;
|
|
1601
|
+
let r = this.getNodeChildren(n), i = e[e.length - 1];
|
|
1602
|
+
for (; --i >= 0;) {
|
|
1603
|
+
let e = r[i];
|
|
1604
|
+
if (!this.getNodeDisabled(e)) return e;
|
|
1605
|
+
}
|
|
1606
|
+
}), __publicField(this, "getNextSibling", (e) => {
|
|
1607
|
+
let n = this.getParentNode(e);
|
|
1608
|
+
if (!n) return;
|
|
1609
|
+
let r = this.getNodeChildren(n), i = e[e.length - 1];
|
|
1610
|
+
for (; ++i < r.length;) {
|
|
1611
|
+
let e = r[i];
|
|
1612
|
+
if (!this.getNodeDisabled(e)) return e;
|
|
1613
|
+
}
|
|
1614
|
+
}), __publicField(this, "getSiblingNodes", (e) => {
|
|
1615
|
+
let n = this.getParentNode(e);
|
|
1616
|
+
return n ? this.getNodeChildren(n) : [];
|
|
1617
|
+
}), __publicField(this, "getValues", (e = this.rootNode) => flatMap(e, {
|
|
1618
|
+
getChildren: this.getNodeChildren,
|
|
1619
|
+
transform: (e) => [this.getNodeValue(e)]
|
|
1620
|
+
}).slice(1)), __publicField(this, "isValidDepth", (e, n) => n == null ? !0 : typeof n == "function" ? n(e.length) : e.length === n), __publicField(this, "isBranchNode", (e) => this.getNodeChildren(e).length > 0 || this.getNodeChildrenCount(e) != null), __publicField(this, "getBranchValues", (e = this.rootNode, n = {}) => {
|
|
1621
|
+
let r = [];
|
|
1622
|
+
return visit(e, {
|
|
1623
|
+
getChildren: this.getNodeChildren,
|
|
1624
|
+
onEnter: (e, i) => {
|
|
1625
|
+
if (i.length === 0) return;
|
|
1626
|
+
let a = this.getNodeValue(e);
|
|
1627
|
+
if (n.skip?.({
|
|
1628
|
+
value: a,
|
|
1629
|
+
node: e,
|
|
1630
|
+
indexPath: i
|
|
1631
|
+
})) return "skip";
|
|
1632
|
+
this.isBranchNode(e) && this.isValidDepth(i, n.depth) && r.push(this.getNodeValue(e));
|
|
1633
|
+
}
|
|
1634
|
+
}), r;
|
|
1635
|
+
}), __publicField(this, "flatten", (e = this.rootNode) => flatten(e, { getChildren: this.getNodeChildren })), __publicField(this, "_create", (e, n) => this.getNodeChildren(e).length > 0 || n.length > 0 ? {
|
|
1636
|
+
...e,
|
|
1637
|
+
children: n
|
|
1638
|
+
} : { ...e }), __publicField(this, "_insert", (e, n, r) => this.copy(insert2(e, {
|
|
1639
|
+
at: n,
|
|
1640
|
+
nodes: r,
|
|
1641
|
+
getChildren: this.getNodeChildren,
|
|
1642
|
+
create: this._create
|
|
1643
|
+
}))), __publicField(this, "copy", (e) => new _TreeCollection({
|
|
1644
|
+
...this.options,
|
|
1645
|
+
rootNode: e
|
|
1646
|
+
})), __publicField(this, "_replace", (e, n, r) => this.copy(replace(e, {
|
|
1647
|
+
at: n,
|
|
1648
|
+
node: r,
|
|
1649
|
+
getChildren: this.getNodeChildren,
|
|
1650
|
+
create: this._create
|
|
1651
|
+
}))), __publicField(this, "_move", (e, n, r) => this.copy(move2(e, {
|
|
1652
|
+
indexPaths: n,
|
|
1653
|
+
to: r,
|
|
1654
|
+
getChildren: this.getNodeChildren,
|
|
1655
|
+
create: this._create
|
|
1656
|
+
}))), __publicField(this, "_remove", (e, n) => this.copy(remove(e, {
|
|
1657
|
+
indexPaths: n,
|
|
1658
|
+
getChildren: this.getNodeChildren,
|
|
1659
|
+
create: this._create
|
|
1660
|
+
}))), __publicField(this, "replace", (e, n) => this._replace(this.rootNode, e, n)), __publicField(this, "remove", (e) => this._remove(this.rootNode, e)), __publicField(this, "insertBefore", (e, n) => this.getParentNode(e) ? this._insert(this.rootNode, e, n) : void 0), __publicField(this, "insertAfter", (e, n) => {
|
|
1661
|
+
if (!this.getParentNode(e)) return;
|
|
1662
|
+
let r = [...e.slice(0, -1), e[e.length - 1] + 1];
|
|
1663
|
+
return this._insert(this.rootNode, r, n);
|
|
1664
|
+
}), __publicField(this, "move", (e, n) => this._move(this.rootNode, e, n)), __publicField(this, "filter", (e) => {
|
|
1665
|
+
let n = filter(this.rootNode, {
|
|
1666
|
+
predicate: e,
|
|
1667
|
+
getChildren: this.getNodeChildren,
|
|
1668
|
+
create: this._create
|
|
1669
|
+
});
|
|
1670
|
+
return this.copy(n);
|
|
1671
|
+
}), __publicField(this, "toJSON", () => this.getValues(this.rootNode)), this.rootNode = e.rootNode;
|
|
1672
|
+
}
|
|
1673
|
+
}, J = {
|
|
1674
|
+
nodeToValue(e) {
|
|
1675
|
+
return typeof e == "string" ? e : F(e) && I(e, "value") ? e.value : "";
|
|
1676
|
+
},
|
|
1677
|
+
nodeToString(e) {
|
|
1678
|
+
return typeof e == "string" ? e : F(e) && I(e, "label") ? e.label : J.nodeToValue(e);
|
|
1679
|
+
},
|
|
1680
|
+
isNodeDisabled(e) {
|
|
1681
|
+
return F(e) && I(e, "disabled") ? !!e.disabled : !1;
|
|
1682
|
+
},
|
|
1683
|
+
nodeToChildren(e) {
|
|
1684
|
+
return e.children;
|
|
1685
|
+
},
|
|
1686
|
+
nodeToChildrenCount(e) {
|
|
1687
|
+
if (F(e) && I(e, "childrenCount")) return e.childrenCount;
|
|
1688
|
+
}
|
|
1689
|
+
}, Y = createAnatomy("tree-view").parts("branch", "branchContent", "branchControl", "branchIndentGuide", "branchIndicator", "branchText", "branchTrigger", "item", "itemIndicator", "itemText", "label", "nodeCheckbox", "nodeRenameInput", "root", "tree").build(), collection = (e) => new Lt(e);
|
|
1690
|
+
collection.empty = () => new Lt({ rootNode: { children: [] } });
|
|
1691
|
+
var getRootId = (e) => e.ids?.root ?? `tree:${e.id}:root`, getLabelId = (e) => e.ids?.label ?? `tree:${e.id}:label`, getNodeId = (e, n) => e.ids?.node?.(n) ?? `tree:${e.id}:node:${n}`, getTreeId = (e) => e.ids?.tree ?? `tree:${e.id}:tree`, focusNode = (e, n) => {
|
|
1692
|
+
n != null && e.getById(getNodeId(e, n))?.focus();
|
|
1693
|
+
}, getRenameInputId = (e, n) => `tree:${e.id}:rename-input:${n}`, getRenameInputEl = (e, n) => e.getById(getRenameInputId(e, n));
|
|
1694
|
+
function getCheckedState(e, n, r) {
|
|
1695
|
+
let i = e.getNodeValue(n);
|
|
1696
|
+
if (!e.isBranchNode(n)) return r.includes(i);
|
|
1697
|
+
let a = e.getDescendantValues(i), o = a.every((e) => r.includes(e)), s = a.some((e) => r.includes(e));
|
|
1698
|
+
return o ? !0 : s ? "indeterminate" : !1;
|
|
1699
|
+
}
|
|
1700
|
+
function toggleBranchChecked(e, n, r) {
|
|
1701
|
+
let i = e.getDescendantValues(n);
|
|
1702
|
+
return uniq(i.every((e) => r.includes(e)) ? P(r, ...i) : add(r, ...i));
|
|
1703
|
+
}
|
|
1704
|
+
function getCheckedValueMap(e, n) {
|
|
1705
|
+
let r = /* @__PURE__ */ new Map();
|
|
1706
|
+
return e.visit({ onEnter: (i) => {
|
|
1707
|
+
let a = e.getNodeValue(i), o = e.isBranchNode(i), s = getCheckedState(e, i, n);
|
|
1708
|
+
r.set(a, {
|
|
1709
|
+
type: o ? "branch" : "leaf",
|
|
1710
|
+
checked: s
|
|
1711
|
+
});
|
|
1712
|
+
} }), r;
|
|
1713
|
+
}
|
|
1714
|
+
function connect(e, n) {
|
|
1715
|
+
let { context: r, scope: i, computed: a, prop: o, send: s } = e, c = o("collection"), l = Array.from(r.get("expandedValue")), u = Array.from(r.get("selectedValue")), d = Array.from(r.get("checkedValue")), f = a("isTypingAhead"), p = r.get("focusedValue"), m = r.get("loadingStatus"), h = r.get("renamingValue"), skip = ({ indexPath: e }) => c.getValuePath(e).slice(0, -1).some((e) => !l.includes(e)), g = c.getFirstNode(void 0, { skip }), _ = g ? c.getNodeValue(g) : null;
|
|
1716
|
+
function getNodeState(e) {
|
|
1717
|
+
let { node: n, indexPath: r } = e, a = c.getNodeValue(n);
|
|
1718
|
+
return {
|
|
1719
|
+
id: getNodeId(i, a),
|
|
1720
|
+
value: a,
|
|
1721
|
+
indexPath: r,
|
|
1722
|
+
valuePath: c.getValuePath(r),
|
|
1723
|
+
disabled: !!n.disabled,
|
|
1724
|
+
focused: p == null ? _ === a : p === a,
|
|
1725
|
+
selected: u.includes(a),
|
|
1726
|
+
expanded: l.includes(a),
|
|
1727
|
+
loading: m[a] === "loading",
|
|
1728
|
+
depth: r.length,
|
|
1729
|
+
isBranch: c.isBranchNode(n),
|
|
1730
|
+
renaming: h === a,
|
|
1731
|
+
get checked() {
|
|
1732
|
+
return getCheckedState(c, n, d);
|
|
1733
|
+
}
|
|
1734
|
+
};
|
|
1735
|
+
}
|
|
1736
|
+
return {
|
|
1737
|
+
collection: c,
|
|
1738
|
+
expandedValue: l,
|
|
1739
|
+
selectedValue: u,
|
|
1740
|
+
checkedValue: d,
|
|
1741
|
+
toggleChecked(e, n) {
|
|
1742
|
+
s({
|
|
1743
|
+
type: "CHECKED.TOGGLE",
|
|
1744
|
+
value: e,
|
|
1745
|
+
isBranch: n
|
|
1746
|
+
});
|
|
1747
|
+
},
|
|
1748
|
+
setChecked(e) {
|
|
1749
|
+
s({
|
|
1750
|
+
type: "CHECKED.SET",
|
|
1751
|
+
value: e
|
|
1752
|
+
});
|
|
1753
|
+
},
|
|
1754
|
+
clearChecked() {
|
|
1755
|
+
s({ type: "CHECKED.CLEAR" });
|
|
1756
|
+
},
|
|
1757
|
+
getCheckedMap() {
|
|
1758
|
+
return getCheckedValueMap(c, d);
|
|
1759
|
+
},
|
|
1760
|
+
expand(e) {
|
|
1761
|
+
s({
|
|
1762
|
+
type: e ? "BRANCH.EXPAND" : "EXPANDED.ALL",
|
|
1763
|
+
value: e
|
|
1764
|
+
});
|
|
1765
|
+
},
|
|
1766
|
+
collapse(e) {
|
|
1767
|
+
s({
|
|
1768
|
+
type: e ? "BRANCH.COLLAPSE" : "EXPANDED.CLEAR",
|
|
1769
|
+
value: e
|
|
1770
|
+
});
|
|
1771
|
+
},
|
|
1772
|
+
deselect(e) {
|
|
1773
|
+
s({
|
|
1774
|
+
type: e ? "NODE.DESELECT" : "SELECTED.CLEAR",
|
|
1775
|
+
value: e
|
|
1776
|
+
});
|
|
1777
|
+
},
|
|
1778
|
+
select(e) {
|
|
1779
|
+
s({
|
|
1780
|
+
type: e ? "NODE.SELECT" : "SELECTED.ALL",
|
|
1781
|
+
value: e,
|
|
1782
|
+
isTrusted: !1
|
|
1783
|
+
});
|
|
1784
|
+
},
|
|
1785
|
+
getVisibleNodes() {
|
|
1786
|
+
return a("visibleNodes");
|
|
1787
|
+
},
|
|
1788
|
+
focus(e) {
|
|
1789
|
+
focusNode(i, e);
|
|
1790
|
+
},
|
|
1791
|
+
selectParent(e) {
|
|
1792
|
+
let n = c.getParentNode(e);
|
|
1793
|
+
n && s({
|
|
1794
|
+
type: "SELECTED.SET",
|
|
1795
|
+
value: add(u, c.getNodeValue(n)),
|
|
1796
|
+
src: "select.parent"
|
|
1797
|
+
});
|
|
1798
|
+
},
|
|
1799
|
+
expandParent(e) {
|
|
1800
|
+
let n = c.getParentNode(e);
|
|
1801
|
+
n && s({
|
|
1802
|
+
type: "EXPANDED.SET",
|
|
1803
|
+
value: add(l, c.getNodeValue(n)),
|
|
1804
|
+
src: "expand.parent"
|
|
1805
|
+
});
|
|
1806
|
+
},
|
|
1807
|
+
setExpandedValue(e) {
|
|
1808
|
+
s({
|
|
1809
|
+
type: "EXPANDED.SET",
|
|
1810
|
+
value: uniq(e)
|
|
1811
|
+
});
|
|
1812
|
+
},
|
|
1813
|
+
setSelectedValue(e) {
|
|
1814
|
+
s({
|
|
1815
|
+
type: "SELECTED.SET",
|
|
1816
|
+
value: uniq(e)
|
|
1817
|
+
});
|
|
1818
|
+
},
|
|
1819
|
+
startRenaming(e) {
|
|
1820
|
+
s({
|
|
1821
|
+
type: "NODE.RENAME",
|
|
1822
|
+
value: e
|
|
1823
|
+
});
|
|
1824
|
+
},
|
|
1825
|
+
submitRenaming(e, n) {
|
|
1826
|
+
s({
|
|
1827
|
+
type: "RENAME.SUBMIT",
|
|
1828
|
+
value: e,
|
|
1829
|
+
label: n
|
|
1830
|
+
});
|
|
1831
|
+
},
|
|
1832
|
+
cancelRenaming() {
|
|
1833
|
+
s({ type: "RENAME.CANCEL" });
|
|
1834
|
+
},
|
|
1835
|
+
getRootProps() {
|
|
1836
|
+
return n.element({
|
|
1837
|
+
...Y.root.attrs,
|
|
1838
|
+
id: getRootId(i),
|
|
1839
|
+
dir: o("dir")
|
|
1840
|
+
});
|
|
1841
|
+
},
|
|
1842
|
+
getLabelProps() {
|
|
1843
|
+
return n.element({
|
|
1844
|
+
...Y.label.attrs,
|
|
1845
|
+
id: getLabelId(i),
|
|
1846
|
+
dir: o("dir")
|
|
1847
|
+
});
|
|
1848
|
+
},
|
|
1849
|
+
getTreeProps() {
|
|
1850
|
+
return n.element({
|
|
1851
|
+
...Y.tree.attrs,
|
|
1852
|
+
id: getTreeId(i),
|
|
1853
|
+
dir: o("dir"),
|
|
1854
|
+
role: "tree",
|
|
1855
|
+
"aria-label": "Tree View",
|
|
1856
|
+
"aria-labelledby": getLabelId(i),
|
|
1857
|
+
"aria-multiselectable": o("selectionMode") === "multiple" || void 0,
|
|
1858
|
+
tabIndex: -1,
|
|
1859
|
+
onKeyDown(e) {
|
|
1860
|
+
if (e.defaultPrevented || isComposingEvent(e)) return;
|
|
1861
|
+
let n = getEventTarget(e);
|
|
1862
|
+
if (isEditableElement(n)) return;
|
|
1863
|
+
let r = n?.closest("[data-part=branch-control], [data-part=item]");
|
|
1864
|
+
if (!r) return;
|
|
1865
|
+
let i = r.dataset.value;
|
|
1866
|
+
if (i == null) {
|
|
1867
|
+
console.warn("[zag-js/tree-view] Node id not found for node", r);
|
|
1868
|
+
return;
|
|
1869
|
+
}
|
|
1870
|
+
let a = r.matches("[data-part=branch-control]"), l = {
|
|
1871
|
+
ArrowDown(e) {
|
|
1872
|
+
isModifierKey(e) || (e.preventDefault(), s({
|
|
1873
|
+
type: "NODE.ARROW_DOWN",
|
|
1874
|
+
id: i,
|
|
1875
|
+
shiftKey: e.shiftKey
|
|
1876
|
+
}));
|
|
1877
|
+
},
|
|
1878
|
+
ArrowUp(e) {
|
|
1879
|
+
isModifierKey(e) || (e.preventDefault(), s({
|
|
1880
|
+
type: "NODE.ARROW_UP",
|
|
1881
|
+
id: i,
|
|
1882
|
+
shiftKey: e.shiftKey
|
|
1883
|
+
}));
|
|
1884
|
+
},
|
|
1885
|
+
ArrowLeft(e) {
|
|
1886
|
+
isModifierKey(e) || r.dataset.disabled || (e.preventDefault(), s({
|
|
1887
|
+
type: a ? "BRANCH_NODE.ARROW_LEFT" : "NODE.ARROW_LEFT",
|
|
1888
|
+
id: i
|
|
1889
|
+
}));
|
|
1890
|
+
},
|
|
1891
|
+
ArrowRight(e) {
|
|
1892
|
+
!a || r.dataset.disabled || (e.preventDefault(), s({
|
|
1893
|
+
type: "BRANCH_NODE.ARROW_RIGHT",
|
|
1894
|
+
id: i
|
|
1895
|
+
}));
|
|
1896
|
+
},
|
|
1897
|
+
Home(e) {
|
|
1898
|
+
isModifierKey(e) || (e.preventDefault(), s({
|
|
1899
|
+
type: "NODE.HOME",
|
|
1900
|
+
id: i,
|
|
1901
|
+
shiftKey: e.shiftKey
|
|
1902
|
+
}));
|
|
1903
|
+
},
|
|
1904
|
+
End(e) {
|
|
1905
|
+
isModifierKey(e) || (e.preventDefault(), s({
|
|
1906
|
+
type: "NODE.END",
|
|
1907
|
+
id: i,
|
|
1908
|
+
shiftKey: e.shiftKey
|
|
1909
|
+
}));
|
|
1910
|
+
},
|
|
1911
|
+
Space(e) {
|
|
1912
|
+
r.dataset.disabled || (f ? s({
|
|
1913
|
+
type: "TREE.TYPEAHEAD",
|
|
1914
|
+
key: e.key
|
|
1915
|
+
}) : l.Enter?.(e));
|
|
1916
|
+
},
|
|
1917
|
+
Enter(e) {
|
|
1918
|
+
r.dataset.disabled || isAnchorElement(n) && isModifierKey(e) || (s({
|
|
1919
|
+
type: a ? "BRANCH_NODE.CLICK" : "NODE.CLICK",
|
|
1920
|
+
id: i,
|
|
1921
|
+
src: "keyboard"
|
|
1922
|
+
}), isAnchorElement(n) || e.preventDefault());
|
|
1923
|
+
},
|
|
1924
|
+
"*"(e) {
|
|
1925
|
+
r.dataset.disabled || (e.preventDefault(), s({
|
|
1926
|
+
type: "SIBLINGS.EXPAND",
|
|
1927
|
+
id: i
|
|
1928
|
+
}));
|
|
1929
|
+
},
|
|
1930
|
+
a(e) {
|
|
1931
|
+
!e.metaKey || r.dataset.disabled || (e.preventDefault(), s({
|
|
1932
|
+
type: "SELECTED.ALL",
|
|
1933
|
+
moveFocus: !0
|
|
1934
|
+
}));
|
|
1935
|
+
},
|
|
1936
|
+
F2(e) {
|
|
1937
|
+
if (r.dataset.disabled) return;
|
|
1938
|
+
let n = o("canRename");
|
|
1939
|
+
if (!n) return;
|
|
1940
|
+
let a = c.getIndexPath(i);
|
|
1941
|
+
if (a) {
|
|
1942
|
+
let e = c.at(a);
|
|
1943
|
+
if (e && !n(e, a)) return;
|
|
1944
|
+
}
|
|
1945
|
+
e.preventDefault(), s({
|
|
1946
|
+
type: "NODE.RENAME",
|
|
1947
|
+
value: i
|
|
1948
|
+
});
|
|
1949
|
+
}
|
|
1950
|
+
}, u = l[getEventKey(e, { dir: o("dir") })];
|
|
1951
|
+
if (u) {
|
|
1952
|
+
u(e);
|
|
1953
|
+
return;
|
|
1954
|
+
}
|
|
1955
|
+
R.isValidEvent(e) && (s({
|
|
1956
|
+
type: "TREE.TYPEAHEAD",
|
|
1957
|
+
key: e.key,
|
|
1958
|
+
id: i
|
|
1959
|
+
}), e.preventDefault());
|
|
1960
|
+
}
|
|
1961
|
+
});
|
|
1962
|
+
},
|
|
1963
|
+
getNodeState,
|
|
1964
|
+
getItemProps(e) {
|
|
1965
|
+
let r = getNodeState(e);
|
|
1966
|
+
return n.element({
|
|
1967
|
+
...Y.item.attrs,
|
|
1968
|
+
id: r.id,
|
|
1969
|
+
dir: o("dir"),
|
|
1970
|
+
"data-ownedby": getTreeId(i),
|
|
1971
|
+
"data-path": e.indexPath.join("/"),
|
|
1972
|
+
"data-value": r.value,
|
|
1973
|
+
tabIndex: r.focused ? 0 : -1,
|
|
1974
|
+
"data-focus": dataAttr(r.focused),
|
|
1975
|
+
role: "treeitem",
|
|
1976
|
+
"aria-current": r.selected ? "true" : void 0,
|
|
1977
|
+
"aria-selected": r.disabled ? void 0 : r.selected,
|
|
1978
|
+
"data-selected": dataAttr(r.selected),
|
|
1979
|
+
"aria-disabled": ariaAttr(r.disabled),
|
|
1980
|
+
"data-disabled": dataAttr(r.disabled),
|
|
1981
|
+
"data-renaming": dataAttr(r.renaming),
|
|
1982
|
+
"aria-level": r.depth,
|
|
1983
|
+
"data-depth": r.depth,
|
|
1984
|
+
style: { "--depth": r.depth },
|
|
1985
|
+
onFocus(e) {
|
|
1986
|
+
e.stopPropagation(), s({
|
|
1987
|
+
type: "NODE.FOCUS",
|
|
1988
|
+
id: r.value
|
|
1989
|
+
});
|
|
1990
|
+
},
|
|
1991
|
+
onClick(e) {
|
|
1992
|
+
if (r.disabled || !isLeftClick(e) || isAnchorElement(e.currentTarget) && isModifierKey(e)) return;
|
|
1993
|
+
let n = e.metaKey || e.ctrlKey;
|
|
1994
|
+
s({
|
|
1995
|
+
type: "NODE.CLICK",
|
|
1996
|
+
id: r.value,
|
|
1997
|
+
shiftKey: e.shiftKey,
|
|
1998
|
+
ctrlKey: n
|
|
1999
|
+
}), e.stopPropagation(), isAnchorElement(e.currentTarget) || e.preventDefault();
|
|
2000
|
+
}
|
|
2001
|
+
});
|
|
2002
|
+
},
|
|
2003
|
+
getItemTextProps(e) {
|
|
2004
|
+
let r = getNodeState(e);
|
|
2005
|
+
return n.element({
|
|
2006
|
+
...Y.itemText.attrs,
|
|
2007
|
+
"data-disabled": dataAttr(r.disabled),
|
|
2008
|
+
"data-selected": dataAttr(r.selected),
|
|
2009
|
+
"data-focus": dataAttr(r.focused)
|
|
2010
|
+
});
|
|
2011
|
+
},
|
|
2012
|
+
getItemIndicatorProps(e) {
|
|
2013
|
+
let r = getNodeState(e);
|
|
2014
|
+
return n.element({
|
|
2015
|
+
...Y.itemIndicator.attrs,
|
|
2016
|
+
"aria-hidden": !0,
|
|
2017
|
+
"data-disabled": dataAttr(r.disabled),
|
|
2018
|
+
"data-selected": dataAttr(r.selected),
|
|
2019
|
+
"data-focus": dataAttr(r.focused),
|
|
2020
|
+
hidden: !r.selected
|
|
2021
|
+
});
|
|
2022
|
+
},
|
|
2023
|
+
getBranchProps(e) {
|
|
2024
|
+
let r = getNodeState(e);
|
|
2025
|
+
return n.element({
|
|
2026
|
+
...Y.branch.attrs,
|
|
2027
|
+
"data-depth": r.depth,
|
|
2028
|
+
dir: o("dir"),
|
|
2029
|
+
"data-branch": r.value,
|
|
2030
|
+
role: "treeitem",
|
|
2031
|
+
"data-ownedby": getTreeId(i),
|
|
2032
|
+
"data-value": r.value,
|
|
2033
|
+
"aria-level": r.depth,
|
|
2034
|
+
"aria-selected": r.disabled ? void 0 : r.selected,
|
|
2035
|
+
"data-path": e.indexPath.join("/"),
|
|
2036
|
+
"data-selected": dataAttr(r.selected),
|
|
2037
|
+
"aria-expanded": r.expanded,
|
|
2038
|
+
"data-state": r.expanded ? "open" : "closed",
|
|
2039
|
+
"aria-disabled": ariaAttr(r.disabled),
|
|
2040
|
+
"data-disabled": dataAttr(r.disabled),
|
|
2041
|
+
"data-loading": dataAttr(r.loading),
|
|
2042
|
+
"aria-busy": ariaAttr(r.loading),
|
|
2043
|
+
style: { "--depth": r.depth }
|
|
2044
|
+
});
|
|
2045
|
+
},
|
|
2046
|
+
getBranchIndicatorProps(e) {
|
|
2047
|
+
let r = getNodeState(e);
|
|
2048
|
+
return n.element({
|
|
2049
|
+
...Y.branchIndicator.attrs,
|
|
2050
|
+
"aria-hidden": !0,
|
|
2051
|
+
"data-state": r.expanded ? "open" : "closed",
|
|
2052
|
+
"data-disabled": dataAttr(r.disabled),
|
|
2053
|
+
"data-selected": dataAttr(r.selected),
|
|
2054
|
+
"data-focus": dataAttr(r.focused),
|
|
2055
|
+
"data-loading": dataAttr(r.loading)
|
|
2056
|
+
});
|
|
2057
|
+
},
|
|
2058
|
+
getBranchTriggerProps(e) {
|
|
2059
|
+
let r = getNodeState(e);
|
|
2060
|
+
return n.element({
|
|
2061
|
+
...Y.branchTrigger.attrs,
|
|
2062
|
+
role: "button",
|
|
2063
|
+
dir: o("dir"),
|
|
2064
|
+
"data-disabled": dataAttr(r.disabled),
|
|
2065
|
+
"data-state": r.expanded ? "open" : "closed",
|
|
2066
|
+
"data-value": r.value,
|
|
2067
|
+
"data-loading": dataAttr(r.loading),
|
|
2068
|
+
disabled: r.loading,
|
|
2069
|
+
onClick(e) {
|
|
2070
|
+
r.disabled || r.loading || (s({
|
|
2071
|
+
type: "BRANCH_TOGGLE.CLICK",
|
|
2072
|
+
id: r.value
|
|
2073
|
+
}), e.stopPropagation());
|
|
2074
|
+
}
|
|
2075
|
+
});
|
|
2076
|
+
},
|
|
2077
|
+
getBranchControlProps(e) {
|
|
2078
|
+
let r = getNodeState(e);
|
|
2079
|
+
return n.element({
|
|
2080
|
+
...Y.branchControl.attrs,
|
|
2081
|
+
role: "button",
|
|
2082
|
+
id: r.id,
|
|
2083
|
+
dir: o("dir"),
|
|
2084
|
+
tabIndex: r.focused ? 0 : -1,
|
|
2085
|
+
"data-path": e.indexPath.join("/"),
|
|
2086
|
+
"data-state": r.expanded ? "open" : "closed",
|
|
2087
|
+
"data-disabled": dataAttr(r.disabled),
|
|
2088
|
+
"data-selected": dataAttr(r.selected),
|
|
2089
|
+
"data-focus": dataAttr(r.focused),
|
|
2090
|
+
"data-renaming": dataAttr(r.renaming),
|
|
2091
|
+
"data-value": r.value,
|
|
2092
|
+
"data-depth": r.depth,
|
|
2093
|
+
"data-loading": dataAttr(r.loading),
|
|
2094
|
+
"aria-busy": ariaAttr(r.loading),
|
|
2095
|
+
onFocus(e) {
|
|
2096
|
+
s({
|
|
2097
|
+
type: "NODE.FOCUS",
|
|
2098
|
+
id: r.value
|
|
2099
|
+
}), e.stopPropagation();
|
|
2100
|
+
},
|
|
2101
|
+
onClick(e) {
|
|
2102
|
+
if (r.disabled || r.loading || !isLeftClick(e) || isAnchorElement(e.currentTarget) && isModifierKey(e)) return;
|
|
2103
|
+
let n = e.metaKey || e.ctrlKey;
|
|
2104
|
+
s({
|
|
2105
|
+
type: "BRANCH_NODE.CLICK",
|
|
2106
|
+
id: r.value,
|
|
2107
|
+
shiftKey: e.shiftKey,
|
|
2108
|
+
ctrlKey: n
|
|
2109
|
+
}), e.stopPropagation();
|
|
2110
|
+
}
|
|
2111
|
+
});
|
|
2112
|
+
},
|
|
2113
|
+
getBranchTextProps(e) {
|
|
2114
|
+
let r = getNodeState(e);
|
|
2115
|
+
return n.element({
|
|
2116
|
+
...Y.branchText.attrs,
|
|
2117
|
+
dir: o("dir"),
|
|
2118
|
+
"data-disabled": dataAttr(r.disabled),
|
|
2119
|
+
"data-state": r.expanded ? "open" : "closed",
|
|
2120
|
+
"data-loading": dataAttr(r.loading)
|
|
2121
|
+
});
|
|
2122
|
+
},
|
|
2123
|
+
getBranchContentProps(e) {
|
|
2124
|
+
let r = getNodeState(e);
|
|
2125
|
+
return n.element({
|
|
2126
|
+
...Y.branchContent.attrs,
|
|
2127
|
+
role: "group",
|
|
2128
|
+
dir: o("dir"),
|
|
2129
|
+
"data-state": r.expanded ? "open" : "closed",
|
|
2130
|
+
"data-depth": r.depth,
|
|
2131
|
+
"data-path": e.indexPath.join("/"),
|
|
2132
|
+
"data-value": r.value,
|
|
2133
|
+
hidden: !r.expanded
|
|
2134
|
+
});
|
|
2135
|
+
},
|
|
2136
|
+
getBranchIndentGuideProps(e) {
|
|
2137
|
+
let r = getNodeState(e);
|
|
2138
|
+
return n.element({
|
|
2139
|
+
...Y.branchIndentGuide.attrs,
|
|
2140
|
+
"data-depth": r.depth
|
|
2141
|
+
});
|
|
2142
|
+
},
|
|
2143
|
+
getNodeCheckboxProps(e) {
|
|
2144
|
+
let r = getNodeState(e), i = r.checked;
|
|
2145
|
+
return n.element({
|
|
2146
|
+
...Y.nodeCheckbox.attrs,
|
|
2147
|
+
tabIndex: -1,
|
|
2148
|
+
role: "checkbox",
|
|
2149
|
+
"data-state": i === !0 ? "checked" : i === !1 ? "unchecked" : "indeterminate",
|
|
2150
|
+
"aria-checked": i === !0 ? "true" : i === !1 ? "false" : "mixed",
|
|
2151
|
+
"data-disabled": dataAttr(r.disabled),
|
|
2152
|
+
onClick(e) {
|
|
2153
|
+
e.defaultPrevented || r.disabled || isLeftClick(e) && (s({
|
|
2154
|
+
type: "CHECKED.TOGGLE",
|
|
2155
|
+
value: r.value,
|
|
2156
|
+
isBranch: r.isBranch
|
|
2157
|
+
}), e.stopPropagation(), e.currentTarget.closest("[role=treeitem]")?.focus({ preventScroll: !0 }));
|
|
2158
|
+
}
|
|
2159
|
+
});
|
|
2160
|
+
},
|
|
2161
|
+
getNodeRenameInputProps(e) {
|
|
2162
|
+
let r = getNodeState(e);
|
|
2163
|
+
return n.input({
|
|
2164
|
+
...Y.nodeRenameInput.attrs,
|
|
2165
|
+
id: getRenameInputId(i, r.value),
|
|
2166
|
+
type: "text",
|
|
2167
|
+
"aria-label": "Rename tree item",
|
|
2168
|
+
hidden: !r.renaming,
|
|
2169
|
+
onKeyDown(e) {
|
|
2170
|
+
isComposingEvent(e) || (e.key === "Escape" && (s({ type: "RENAME.CANCEL" }), e.preventDefault()), e.key === "Enter" && (s({
|
|
2171
|
+
type: "RENAME.SUBMIT",
|
|
2172
|
+
label: e.currentTarget.value
|
|
2173
|
+
}), e.preventDefault()), e.stopPropagation());
|
|
2174
|
+
},
|
|
2175
|
+
onBlur(e) {
|
|
2176
|
+
s({
|
|
2177
|
+
type: "RENAME.SUBMIT",
|
|
2178
|
+
label: e.currentTarget.value
|
|
2179
|
+
});
|
|
2180
|
+
}
|
|
2181
|
+
});
|
|
2182
|
+
}
|
|
2183
|
+
};
|
|
2184
|
+
}
|
|
2185
|
+
function expandBranches(e, n) {
|
|
2186
|
+
let { context: r, prop: i, refs: a } = e;
|
|
2187
|
+
if (!i("loadChildren")) {
|
|
2188
|
+
r.set("expandedValue", (e) => uniq(add(e, ...n)));
|
|
2189
|
+
return;
|
|
2190
|
+
}
|
|
2191
|
+
let o = r.get("loadingStatus"), [s, c] = partition(n, (e) => o[e] === "loaded");
|
|
2192
|
+
if (s.length > 0 && r.set("expandedValue", (e) => uniq(add(e, ...s))), c.length === 0) return;
|
|
2193
|
+
let l = i("collection"), [u, d] = partition(c, (e) => {
|
|
2194
|
+
let n = l.findNode(e);
|
|
2195
|
+
return l.getNodeChildren(n).length > 0;
|
|
2196
|
+
});
|
|
2197
|
+
if (u.length > 0 && r.set("expandedValue", (e) => uniq(add(e, ...u))), d.length === 0) return;
|
|
2198
|
+
r.set("loadingStatus", (e) => ({
|
|
2199
|
+
...e,
|
|
2200
|
+
...d.reduce((e, n) => ({
|
|
2201
|
+
...e,
|
|
2202
|
+
[n]: "loading"
|
|
2203
|
+
}), {})
|
|
2204
|
+
}));
|
|
2205
|
+
let f = d.map((e) => {
|
|
2206
|
+
let n = l.getIndexPath(e);
|
|
2207
|
+
return {
|
|
2208
|
+
id: e,
|
|
2209
|
+
indexPath: n,
|
|
2210
|
+
valuePath: l.getValuePath(n),
|
|
2211
|
+
node: l.findNode(e)
|
|
2212
|
+
};
|
|
2213
|
+
}), p = a.get("pendingAborts"), m = i("loadChildren");
|
|
2214
|
+
ensure(m, () => "[zag-js/tree-view] `loadChildren` is required for async expansion");
|
|
2215
|
+
let h = f.map(({ id: e, indexPath: n, valuePath: r, node: i }) => {
|
|
2216
|
+
let a = p.get(e);
|
|
2217
|
+
a && (a.abort(), p.delete(e));
|
|
2218
|
+
let o = new AbortController();
|
|
2219
|
+
return p.set(e, o), m({
|
|
2220
|
+
valuePath: r,
|
|
2221
|
+
indexPath: n,
|
|
2222
|
+
node: i,
|
|
2223
|
+
signal: o.signal
|
|
2224
|
+
});
|
|
2225
|
+
});
|
|
2226
|
+
Promise.allSettled(h).then((e) => {
|
|
2227
|
+
let n = [], a = [], o = r.get("loadingStatus"), s = i("collection");
|
|
2228
|
+
e.forEach((e, r) => {
|
|
2229
|
+
let { id: i, indexPath: c, node: l, valuePath: u } = f[r];
|
|
2230
|
+
e.status === "fulfilled" ? (o[i] = "loaded", n.push(i), s = s.replace(c, {
|
|
2231
|
+
...l,
|
|
2232
|
+
children: e.value
|
|
2233
|
+
})) : (p.delete(i), Reflect.deleteProperty(o, i), a.push({
|
|
2234
|
+
node: l,
|
|
2235
|
+
error: e.reason,
|
|
2236
|
+
indexPath: c,
|
|
2237
|
+
valuePath: u
|
|
2238
|
+
}));
|
|
2239
|
+
}), r.set("loadingStatus", o), n.length && (r.set("expandedValue", (e) => uniq(add(e, ...n))), i("onLoadChildrenComplete")?.({ collection: s })), a.length && i("onLoadChildrenError")?.({ nodes: a });
|
|
2240
|
+
});
|
|
2241
|
+
}
|
|
2242
|
+
function skipFn(e) {
|
|
2243
|
+
let { prop: n, context: r } = e;
|
|
2244
|
+
return function skip({ indexPath: e }) {
|
|
2245
|
+
return n("collection").getValuePath(e).slice(0, -1).some((e) => !r.get("expandedValue").includes(e));
|
|
2246
|
+
};
|
|
2247
|
+
}
|
|
2248
|
+
var { and: X } = createGuards(), Rt = createMachine({
|
|
2249
|
+
props({ props: e }) {
|
|
2250
|
+
return {
|
|
2251
|
+
selectionMode: "single",
|
|
2252
|
+
collection: collection.empty(),
|
|
2253
|
+
typeahead: !0,
|
|
2254
|
+
expandOnClick: !0,
|
|
2255
|
+
defaultExpandedValue: [],
|
|
2256
|
+
defaultSelectedValue: [],
|
|
2257
|
+
...e
|
|
2258
|
+
};
|
|
2259
|
+
},
|
|
2260
|
+
initialState() {
|
|
2261
|
+
return "idle";
|
|
2262
|
+
},
|
|
2263
|
+
context({ prop: e, bindable: n, getContext: r }) {
|
|
2264
|
+
return {
|
|
2265
|
+
expandedValue: n(() => ({
|
|
2266
|
+
defaultValue: e("defaultExpandedValue"),
|
|
2267
|
+
value: e("expandedValue"),
|
|
2268
|
+
isEqual,
|
|
2269
|
+
onChange(n) {
|
|
2270
|
+
let i = r().get("focusedValue");
|
|
2271
|
+
e("onExpandedChange")?.({
|
|
2272
|
+
expandedValue: n,
|
|
2273
|
+
focusedValue: i,
|
|
2274
|
+
get expandedNodes() {
|
|
2275
|
+
return e("collection").findNodes(n);
|
|
2276
|
+
}
|
|
2277
|
+
});
|
|
2278
|
+
}
|
|
2279
|
+
})),
|
|
2280
|
+
selectedValue: n(() => ({
|
|
2281
|
+
defaultValue: e("defaultSelectedValue"),
|
|
2282
|
+
value: e("selectedValue"),
|
|
2283
|
+
isEqual,
|
|
2284
|
+
onChange(n) {
|
|
2285
|
+
let i = r().get("focusedValue");
|
|
2286
|
+
e("onSelectionChange")?.({
|
|
2287
|
+
selectedValue: n,
|
|
2288
|
+
focusedValue: i,
|
|
2289
|
+
get selectedNodes() {
|
|
2290
|
+
return e("collection").findNodes(n);
|
|
2291
|
+
}
|
|
2292
|
+
});
|
|
2293
|
+
}
|
|
2294
|
+
})),
|
|
2295
|
+
focusedValue: n(() => ({
|
|
2296
|
+
defaultValue: e("defaultFocusedValue") || null,
|
|
2297
|
+
value: e("focusedValue"),
|
|
2298
|
+
onChange(n) {
|
|
2299
|
+
e("onFocusChange")?.({
|
|
2300
|
+
focusedValue: n,
|
|
2301
|
+
get focusedNode() {
|
|
2302
|
+
return n ? e("collection").findNode(n) : null;
|
|
2303
|
+
}
|
|
2304
|
+
});
|
|
2305
|
+
}
|
|
2306
|
+
})),
|
|
2307
|
+
loadingStatus: n(() => ({ defaultValue: {} })),
|
|
2308
|
+
checkedValue: n(() => ({
|
|
2309
|
+
defaultValue: e("defaultCheckedValue") || [],
|
|
2310
|
+
value: e("checkedValue"),
|
|
2311
|
+
isEqual,
|
|
2312
|
+
onChange(n) {
|
|
2313
|
+
e("onCheckedChange")?.({ checkedValue: n });
|
|
2314
|
+
}
|
|
2315
|
+
})),
|
|
2316
|
+
renamingValue: n(() => ({
|
|
2317
|
+
sync: !0,
|
|
2318
|
+
defaultValue: null
|
|
2319
|
+
}))
|
|
2320
|
+
};
|
|
2321
|
+
},
|
|
2322
|
+
refs() {
|
|
2323
|
+
return {
|
|
2324
|
+
typeaheadState: { ...R.defaultOptions },
|
|
2325
|
+
pendingAborts: /* @__PURE__ */ new Map()
|
|
2326
|
+
};
|
|
2327
|
+
},
|
|
2328
|
+
computed: {
|
|
2329
|
+
isMultipleSelection: ({ prop: e }) => e("selectionMode") === "multiple",
|
|
2330
|
+
isTypingAhead: ({ refs: e }) => e.get("typeaheadState").keysSoFar.length > 0,
|
|
2331
|
+
visibleNodes: ({ prop: e, context: n }) => {
|
|
2332
|
+
let r = [];
|
|
2333
|
+
return e("collection").visit({
|
|
2334
|
+
skip: skipFn({
|
|
2335
|
+
prop: e,
|
|
2336
|
+
context: n
|
|
2337
|
+
}),
|
|
2338
|
+
onEnter: (e, n) => {
|
|
2339
|
+
r.push({
|
|
2340
|
+
node: e,
|
|
2341
|
+
indexPath: n
|
|
2342
|
+
});
|
|
2343
|
+
}
|
|
2344
|
+
}), r;
|
|
2345
|
+
}
|
|
2346
|
+
},
|
|
2347
|
+
on: {
|
|
2348
|
+
"EXPANDED.SET": { actions: ["setExpanded"] },
|
|
2349
|
+
"EXPANDED.CLEAR": { actions: ["clearExpanded"] },
|
|
2350
|
+
"EXPANDED.ALL": { actions: ["expandAllBranches"] },
|
|
2351
|
+
"BRANCH.EXPAND": { actions: ["expandBranches"] },
|
|
2352
|
+
"BRANCH.COLLAPSE": { actions: ["collapseBranches"] },
|
|
2353
|
+
"SELECTED.SET": { actions: ["setSelected"] },
|
|
2354
|
+
"SELECTED.ALL": [{
|
|
2355
|
+
guard: X("isMultipleSelection", "moveFocus"),
|
|
2356
|
+
actions: ["selectAllNodes", "focusTreeLastNode"]
|
|
2357
|
+
}, {
|
|
2358
|
+
guard: "isMultipleSelection",
|
|
2359
|
+
actions: ["selectAllNodes"]
|
|
2360
|
+
}],
|
|
2361
|
+
"SELECTED.CLEAR": { actions: ["clearSelected"] },
|
|
2362
|
+
"NODE.SELECT": { actions: ["selectNode"] },
|
|
2363
|
+
"NODE.DESELECT": { actions: ["deselectNode"] },
|
|
2364
|
+
"CHECKED.TOGGLE": { actions: ["toggleChecked"] },
|
|
2365
|
+
"CHECKED.SET": { actions: ["setChecked"] },
|
|
2366
|
+
"CHECKED.CLEAR": { actions: ["clearChecked"] },
|
|
2367
|
+
"NODE.FOCUS": { actions: ["setFocusedNode"] },
|
|
2368
|
+
"NODE.ARROW_DOWN": [{
|
|
2369
|
+
guard: X("isShiftKey", "isMultipleSelection"),
|
|
2370
|
+
actions: ["focusTreeNextNode", "extendSelectionToNextNode"]
|
|
2371
|
+
}, { actions: ["focusTreeNextNode"] }],
|
|
2372
|
+
"NODE.ARROW_UP": [{
|
|
2373
|
+
guard: X("isShiftKey", "isMultipleSelection"),
|
|
2374
|
+
actions: ["focusTreePrevNode", "extendSelectionToPrevNode"]
|
|
2375
|
+
}, { actions: ["focusTreePrevNode"] }],
|
|
2376
|
+
"NODE.ARROW_LEFT": { actions: ["focusBranchNode"] },
|
|
2377
|
+
"BRANCH_NODE.ARROW_LEFT": [{
|
|
2378
|
+
guard: "isBranchExpanded",
|
|
2379
|
+
actions: ["collapseBranch"]
|
|
2380
|
+
}, { actions: ["focusBranchNode"] }],
|
|
2381
|
+
"BRANCH_NODE.ARROW_RIGHT": [{
|
|
2382
|
+
guard: X("isBranchFocused", "isBranchExpanded"),
|
|
2383
|
+
actions: ["focusBranchFirstNode"]
|
|
2384
|
+
}, { actions: ["expandBranch"] }],
|
|
2385
|
+
"SIBLINGS.EXPAND": { actions: ["expandSiblingBranches"] },
|
|
2386
|
+
"NODE.HOME": [{
|
|
2387
|
+
guard: X("isShiftKey", "isMultipleSelection"),
|
|
2388
|
+
actions: ["extendSelectionToFirstNode", "focusTreeFirstNode"]
|
|
2389
|
+
}, { actions: ["focusTreeFirstNode"] }],
|
|
2390
|
+
"NODE.END": [{
|
|
2391
|
+
guard: X("isShiftKey", "isMultipleSelection"),
|
|
2392
|
+
actions: ["extendSelectionToLastNode", "focusTreeLastNode"]
|
|
2393
|
+
}, { actions: ["focusTreeLastNode"] }],
|
|
2394
|
+
"NODE.CLICK": [
|
|
2395
|
+
{
|
|
2396
|
+
guard: X("isCtrlKey", "isMultipleSelection"),
|
|
2397
|
+
actions: ["toggleNodeSelection"]
|
|
2398
|
+
},
|
|
2399
|
+
{
|
|
2400
|
+
guard: X("isShiftKey", "isMultipleSelection"),
|
|
2401
|
+
actions: ["extendSelectionToNode"]
|
|
2402
|
+
},
|
|
2403
|
+
{ actions: ["selectNode"] }
|
|
2404
|
+
],
|
|
2405
|
+
"BRANCH_NODE.CLICK": [
|
|
2406
|
+
{
|
|
2407
|
+
guard: X("isCtrlKey", "isMultipleSelection"),
|
|
2408
|
+
actions: ["toggleNodeSelection"]
|
|
2409
|
+
},
|
|
2410
|
+
{
|
|
2411
|
+
guard: X("isShiftKey", "isMultipleSelection"),
|
|
2412
|
+
actions: ["extendSelectionToNode"]
|
|
2413
|
+
},
|
|
2414
|
+
{
|
|
2415
|
+
guard: "expandOnClick",
|
|
2416
|
+
actions: ["selectNode", "toggleBranchNode"]
|
|
2417
|
+
},
|
|
2418
|
+
{ actions: ["selectNode"] }
|
|
2419
|
+
],
|
|
2420
|
+
"BRANCH_TOGGLE.CLICK": { actions: ["toggleBranchNode"] },
|
|
2421
|
+
"TREE.TYPEAHEAD": { actions: ["focusMatchedNode"] }
|
|
2422
|
+
},
|
|
2423
|
+
exit: ["clearPendingAborts"],
|
|
2424
|
+
states: {
|
|
2425
|
+
idle: { on: { "NODE.RENAME": {
|
|
2426
|
+
target: "renaming",
|
|
2427
|
+
actions: ["setRenamingValue"]
|
|
2428
|
+
} } },
|
|
2429
|
+
renaming: {
|
|
2430
|
+
entry: ["syncRenameInput", "focusRenameInput"],
|
|
2431
|
+
on: {
|
|
2432
|
+
"RENAME.SUBMIT": {
|
|
2433
|
+
guard: "isRenameLabelValid",
|
|
2434
|
+
target: "idle",
|
|
2435
|
+
actions: ["submitRenaming"]
|
|
2436
|
+
},
|
|
2437
|
+
"RENAME.CANCEL": {
|
|
2438
|
+
target: "idle",
|
|
2439
|
+
actions: ["cancelRenaming"]
|
|
2440
|
+
}
|
|
2441
|
+
}
|
|
2442
|
+
}
|
|
2443
|
+
},
|
|
2444
|
+
implementations: {
|
|
2445
|
+
guards: {
|
|
2446
|
+
isBranchFocused: ({ context: e, event: n }) => e.get("focusedValue") === n.id,
|
|
2447
|
+
isBranchExpanded: ({ context: e, event: n }) => e.get("expandedValue").includes(n.id),
|
|
2448
|
+
isShiftKey: ({ event: e }) => e.shiftKey,
|
|
2449
|
+
isCtrlKey: ({ event: e }) => e.ctrlKey,
|
|
2450
|
+
hasSelectedItems: ({ context: e }) => e.get("selectedValue").length > 0,
|
|
2451
|
+
isMultipleSelection: ({ prop: e }) => e("selectionMode") === "multiple",
|
|
2452
|
+
moveFocus: ({ event: e }) => !!e.moveFocus,
|
|
2453
|
+
expandOnClick: ({ prop: e }) => !!e("expandOnClick"),
|
|
2454
|
+
isRenameLabelValid: ({ event: e }) => e.label.trim() !== ""
|
|
2455
|
+
},
|
|
2456
|
+
actions: {
|
|
2457
|
+
selectNode({ context: e, event: n }) {
|
|
2458
|
+
let r = n.id || n.value;
|
|
2459
|
+
e.set("selectedValue", (e) => r == null ? e : !n.isTrusted && isArray(r) ? e.concat(...r) : [isArray(r) ? last(r) : r].filter(Boolean));
|
|
2460
|
+
},
|
|
2461
|
+
deselectNode({ context: e, event: n }) {
|
|
2462
|
+
let r = toArray$1(n.id || n.value);
|
|
2463
|
+
e.set("selectedValue", (e) => P(e, ...r));
|
|
2464
|
+
},
|
|
2465
|
+
setFocusedNode({ context: e, event: n }) {
|
|
2466
|
+
e.set("focusedValue", n.id);
|
|
2467
|
+
},
|
|
2468
|
+
clearFocusedNode({ context: e }) {
|
|
2469
|
+
e.set("focusedValue", null);
|
|
2470
|
+
},
|
|
2471
|
+
clearSelectedItem({ context: e }) {
|
|
2472
|
+
e.set("selectedValue", []);
|
|
2473
|
+
},
|
|
2474
|
+
toggleBranchNode({ context: e, event: n, action: r }) {
|
|
2475
|
+
r(e.get("expandedValue").includes(n.id) ? ["collapseBranch"] : ["expandBranch"]);
|
|
2476
|
+
},
|
|
2477
|
+
expandBranch(e) {
|
|
2478
|
+
let { event: n } = e;
|
|
2479
|
+
expandBranches(e, [n.id]);
|
|
2480
|
+
},
|
|
2481
|
+
expandBranches(e) {
|
|
2482
|
+
let { context: n, event: r } = e;
|
|
2483
|
+
expandBranches(e, diff(toArray$1(r.value), n.get("expandedValue")));
|
|
2484
|
+
},
|
|
2485
|
+
collapseBranch({ context: e, event: n }) {
|
|
2486
|
+
e.set("expandedValue", (e) => P(e, n.id));
|
|
2487
|
+
},
|
|
2488
|
+
collapseBranches(e) {
|
|
2489
|
+
let { context: n, event: r } = e, i = toArray$1(r.value);
|
|
2490
|
+
n.set("expandedValue", (e) => P(e, ...i));
|
|
2491
|
+
},
|
|
2492
|
+
setExpanded({ context: e, event: n }) {
|
|
2493
|
+
isArray(n.value) && e.set("expandedValue", n.value);
|
|
2494
|
+
},
|
|
2495
|
+
clearExpanded({ context: e }) {
|
|
2496
|
+
e.set("expandedValue", []);
|
|
2497
|
+
},
|
|
2498
|
+
setSelected({ context: e, event: n }) {
|
|
2499
|
+
isArray(n.value) && e.set("selectedValue", n.value);
|
|
2500
|
+
},
|
|
2501
|
+
clearSelected({ context: e }) {
|
|
2502
|
+
e.set("selectedValue", []);
|
|
2503
|
+
},
|
|
2504
|
+
focusTreeFirstNode(e) {
|
|
2505
|
+
let { prop: n, scope: r } = e, i = n("collection"), a = i.getFirstNode(void 0, { skip: skipFn(e) });
|
|
2506
|
+
if (!a) return;
|
|
2507
|
+
let o = i.getNodeValue(a);
|
|
2508
|
+
scrollToNode(e, o) ? raf(() => focusNode(r, o)) : focusNode(r, o);
|
|
2509
|
+
},
|
|
2510
|
+
focusTreeLastNode(e) {
|
|
2511
|
+
let { prop: n, scope: r } = e, i = n("collection"), a = i.getLastNode(void 0, { skip: skipFn(e) }), o = i.getNodeValue(a);
|
|
2512
|
+
scrollToNode(e, o) ? raf(() => focusNode(r, o)) : focusNode(r, o);
|
|
2513
|
+
},
|
|
2514
|
+
focusBranchFirstNode(e) {
|
|
2515
|
+
let { event: n, prop: r, scope: i } = e, a = r("collection"), o = a.findNode(n.id), s = a.getFirstNode(o, { skip: skipFn(e) });
|
|
2516
|
+
if (!s) return;
|
|
2517
|
+
let c = a.getNodeValue(s);
|
|
2518
|
+
scrollToNode(e, c) ? raf(() => focusNode(i, c)) : focusNode(i, c);
|
|
2519
|
+
},
|
|
2520
|
+
focusTreeNextNode(e) {
|
|
2521
|
+
let { event: n, prop: r, scope: i } = e, a = r("collection"), o = a.getNextNode(n.id, { skip: skipFn(e) });
|
|
2522
|
+
if (!o) return;
|
|
2523
|
+
let s = a.getNodeValue(o);
|
|
2524
|
+
scrollToNode(e, s) ? raf(() => focusNode(i, s)) : focusNode(i, s);
|
|
2525
|
+
},
|
|
2526
|
+
focusTreePrevNode(e) {
|
|
2527
|
+
let { event: n, prop: r, scope: i } = e, a = r("collection"), o = a.getPreviousNode(n.id, { skip: skipFn(e) });
|
|
2528
|
+
if (!o) return;
|
|
2529
|
+
let s = a.getNodeValue(o);
|
|
2530
|
+
scrollToNode(e, s) ? raf(() => focusNode(i, s)) : focusNode(i, s);
|
|
2531
|
+
},
|
|
2532
|
+
focusBranchNode(e) {
|
|
2533
|
+
let { event: n, prop: r, scope: i } = e, a = r("collection"), o = a.getParentNode(n.id), s = o ? a.getNodeValue(o) : void 0;
|
|
2534
|
+
s && (scrollToNode(e, s) ? raf(() => focusNode(i, s)) : focusNode(i, s));
|
|
2535
|
+
},
|
|
2536
|
+
selectAllNodes({ context: e, prop: n }) {
|
|
2537
|
+
e.set("selectedValue", n("collection").getValues());
|
|
2538
|
+
},
|
|
2539
|
+
focusMatchedNode(e) {
|
|
2540
|
+
let { context: n, prop: r, refs: i, event: a, scope: o, computed: s } = e, c = R(s("visibleNodes").map(({ node: e }) => ({
|
|
2541
|
+
textContent: r("collection").stringifyNode(e),
|
|
2542
|
+
id: r("collection").getNodeValue(e)
|
|
2543
|
+
})), {
|
|
2544
|
+
state: i.get("typeaheadState"),
|
|
2545
|
+
activeId: n.get("focusedValue"),
|
|
2546
|
+
key: a.key
|
|
2547
|
+
});
|
|
2548
|
+
c?.id && (scrollToNode(e, c.id) ? raf(() => focusNode(o, c.id)) : focusNode(o, c.id));
|
|
2549
|
+
},
|
|
2550
|
+
toggleNodeSelection({ context: e, event: n }) {
|
|
2551
|
+
let r = addOrRemove(e.get("selectedValue"), n.id);
|
|
2552
|
+
e.set("selectedValue", r);
|
|
2553
|
+
},
|
|
2554
|
+
expandAllBranches(e) {
|
|
2555
|
+
let { context: n, prop: r } = e;
|
|
2556
|
+
expandBranches(e, diff(r("collection").getBranchValues(), n.get("expandedValue")));
|
|
2557
|
+
},
|
|
2558
|
+
expandSiblingBranches(e) {
|
|
2559
|
+
let { context: n, event: r, prop: i } = e, a = i("collection"), o = a.getIndexPath(r.id);
|
|
2560
|
+
o && expandBranches(e, diff(a.getSiblingNodes(o).map((e) => a.getNodeValue(e)), n.get("expandedValue")));
|
|
2561
|
+
},
|
|
2562
|
+
extendSelectionToNode(e) {
|
|
2563
|
+
let { context: n, event: r, prop: i, computed: a } = e, o = i("collection"), s = first(n.get("selectedValue")) || o.getNodeValue(o.getFirstNode()), c = r.id, l = [s, c], u = 0;
|
|
2564
|
+
a("visibleNodes").forEach(({ node: e }) => {
|
|
2565
|
+
let n = o.getNodeValue(e);
|
|
2566
|
+
u === 1 && l.push(n), (n === s || n === c) && u++;
|
|
2567
|
+
}), n.set("selectedValue", uniq(l));
|
|
2568
|
+
},
|
|
2569
|
+
extendSelectionToNextNode(e) {
|
|
2570
|
+
let { context: n, event: r, prop: i } = e, a = i("collection"), o = a.getNextNode(r.id, { skip: skipFn(e) });
|
|
2571
|
+
if (!o) return;
|
|
2572
|
+
let s = new Set(n.get("selectedValue")), c = a.getNodeValue(o);
|
|
2573
|
+
c != null && (s.has(r.id) && s.has(c) ? s.delete(r.id) : s.has(c) || s.add(c), n.set("selectedValue", Array.from(s)));
|
|
2574
|
+
},
|
|
2575
|
+
extendSelectionToPrevNode(e) {
|
|
2576
|
+
let { context: n, event: r, prop: i } = e, a = i("collection"), o = a.getPreviousNode(r.id, { skip: skipFn(e) });
|
|
2577
|
+
if (!o) return;
|
|
2578
|
+
let s = new Set(n.get("selectedValue")), c = a.getNodeValue(o);
|
|
2579
|
+
c != null && (s.has(r.id) && s.has(c) ? s.delete(r.id) : s.has(c) || s.add(c), n.set("selectedValue", Array.from(s)));
|
|
2580
|
+
},
|
|
2581
|
+
extendSelectionToFirstNode(e) {
|
|
2582
|
+
let { context: n, prop: r } = e, i = r("collection"), a = first(n.get("selectedValue")), o = [];
|
|
2583
|
+
i.visit({
|
|
2584
|
+
skip: skipFn(e),
|
|
2585
|
+
onEnter: (e) => {
|
|
2586
|
+
let n = i.getNodeValue(e);
|
|
2587
|
+
if (o.push(n), n === a) return "stop";
|
|
2588
|
+
}
|
|
2589
|
+
}), n.set("selectedValue", o);
|
|
2590
|
+
},
|
|
2591
|
+
extendSelectionToLastNode(e) {
|
|
2592
|
+
let { context: n, prop: r } = e, i = r("collection"), a = first(n.get("selectedValue")), o = [], s = !1;
|
|
2593
|
+
i.visit({
|
|
2594
|
+
skip: skipFn(e),
|
|
2595
|
+
onEnter: (e) => {
|
|
2596
|
+
let n = i.getNodeValue(e);
|
|
2597
|
+
n === a && (s = !0), s && o.push(n);
|
|
2598
|
+
}
|
|
2599
|
+
}), n.set("selectedValue", o);
|
|
2600
|
+
},
|
|
2601
|
+
clearPendingAborts({ refs: e }) {
|
|
2602
|
+
let n = e.get("pendingAborts");
|
|
2603
|
+
n.forEach((e) => e.abort()), n.clear();
|
|
2604
|
+
},
|
|
2605
|
+
toggleChecked({ context: e, event: n, prop: r }) {
|
|
2606
|
+
let i = r("collection");
|
|
2607
|
+
e.set("checkedValue", (e) => n.isBranch ? toggleBranchChecked(i, n.value, e) : addOrRemove(e, n.value));
|
|
2608
|
+
},
|
|
2609
|
+
setChecked({ context: e, event: n }) {
|
|
2610
|
+
e.set("checkedValue", n.value);
|
|
2611
|
+
},
|
|
2612
|
+
clearChecked({ context: e }) {
|
|
2613
|
+
e.set("checkedValue", []);
|
|
2614
|
+
},
|
|
2615
|
+
setRenamingValue({ context: e, event: n, prop: r }) {
|
|
2616
|
+
e.set("renamingValue", n.value);
|
|
2617
|
+
let i = r("onRenameStart");
|
|
2618
|
+
if (i) {
|
|
2619
|
+
let e = r("collection"), a = e.getIndexPath(n.value);
|
|
2620
|
+
if (a) {
|
|
2621
|
+
let r = e.at(a);
|
|
2622
|
+
r && i({
|
|
2623
|
+
value: n.value,
|
|
2624
|
+
node: r,
|
|
2625
|
+
indexPath: a
|
|
2626
|
+
});
|
|
2627
|
+
}
|
|
2628
|
+
}
|
|
2629
|
+
},
|
|
2630
|
+
submitRenaming({ context: e, event: n, prop: r, scope: i }) {
|
|
2631
|
+
let a = e.get("renamingValue");
|
|
2632
|
+
if (!a) return;
|
|
2633
|
+
let o = r("collection").getIndexPath(a);
|
|
2634
|
+
if (!o) return;
|
|
2635
|
+
let s = n.label.trim(), c = r("onBeforeRename");
|
|
2636
|
+
if (c && !c({
|
|
2637
|
+
value: a,
|
|
2638
|
+
label: s,
|
|
2639
|
+
indexPath: o
|
|
2640
|
+
})) {
|
|
2641
|
+
e.set("renamingValue", null), focusNode(i, a);
|
|
2642
|
+
return;
|
|
2643
|
+
}
|
|
2644
|
+
r("onRenameComplete")?.({
|
|
2645
|
+
value: a,
|
|
2646
|
+
label: s,
|
|
2647
|
+
indexPath: o
|
|
2648
|
+
}), e.set("renamingValue", null), focusNode(i, a);
|
|
2649
|
+
},
|
|
2650
|
+
cancelRenaming({ context: e, scope: n }) {
|
|
2651
|
+
let r = e.get("renamingValue");
|
|
2652
|
+
e.set("renamingValue", null), r && focusNode(n, r);
|
|
2653
|
+
},
|
|
2654
|
+
syncRenameInput({ context: e, scope: n, prop: r }) {
|
|
2655
|
+
let i = e.get("renamingValue");
|
|
2656
|
+
if (!i) return;
|
|
2657
|
+
let a = r("collection"), o = a.findNode(i);
|
|
2658
|
+
if (!o) return;
|
|
2659
|
+
let s = a.stringifyNode(o);
|
|
2660
|
+
setElementValue(getRenameInputEl(n, i), s);
|
|
2661
|
+
},
|
|
2662
|
+
focusRenameInput({ context: e, scope: n }) {
|
|
2663
|
+
let r = e.get("renamingValue");
|
|
2664
|
+
if (!r) return;
|
|
2665
|
+
let i = getRenameInputEl(n, r);
|
|
2666
|
+
i && (i.focus(), i.select());
|
|
2667
|
+
}
|
|
2668
|
+
}
|
|
2669
|
+
}
|
|
2670
|
+
});
|
|
2671
|
+
function scrollToNode(e, n) {
|
|
2672
|
+
let { prop: r, scope: i, computed: a } = e, o = r("scrollToIndexFn");
|
|
2673
|
+
if (!o) return !1;
|
|
2674
|
+
let s = r("collection"), c = a("visibleNodes");
|
|
2675
|
+
for (let e = 0; e < c.length; e++) {
|
|
2676
|
+
let { node: r, indexPath: a } = c[e];
|
|
2677
|
+
if (s.getNodeValue(r) === n) return o({
|
|
2678
|
+
index: e,
|
|
2679
|
+
node: r,
|
|
2680
|
+
indexPath: a,
|
|
2681
|
+
getElement: () => i.getById(getNodeId(i, n))
|
|
2682
|
+
}), !0;
|
|
2683
|
+
}
|
|
2684
|
+
return !1;
|
|
2685
|
+
}
|
|
2686
|
+
createProps()(/* @__PURE__ */ "ids.collection.dir.expandedValue.expandOnClick.defaultFocusedValue.focusedValue.getRootNode.id.onExpandedChange.onFocusChange.onSelectionChange.checkedValue.selectedValue.selectionMode.typeahead.defaultExpandedValue.defaultSelectedValue.defaultCheckedValue.onCheckedChange.onLoadChildrenComplete.onLoadChildrenError.loadChildren.canRename.onRenameStart.onBeforeRename.onRenameComplete.scrollToIndexFn".split(".")), createProps()(["node", "indexPath"]);
|
|
2687
|
+
//#endregion
|
|
2688
|
+
//#region ../diagram/src/adhoc-editor/useElementsTree.ts
|
|
2689
|
+
function getElementState(e, n) {
|
|
2690
|
+
return n ? n.disabled.has(e) ? "disabled" : n.includedExplicit.has(e) ? "include-explicit" : n.includedImplicit.has(e) ? "include-implicit" : n.excluded.has(e) ? "exclude" : "not-present" : "not-present";
|
|
2691
|
+
}
|
|
2692
|
+
function mapToTreeNodes(e, n) {
|
|
2693
|
+
return qe(e).map((e) => ({
|
|
2694
|
+
id: e.id,
|
|
2695
|
+
title: e.title,
|
|
2696
|
+
shape: e.shape,
|
|
2697
|
+
icon: e.icon ?? void 0,
|
|
2698
|
+
children: mapToTreeNodes(e.children(), n),
|
|
2699
|
+
state: getElementState(e.id, n)
|
|
2700
|
+
}));
|
|
2701
|
+
}
|
|
2702
|
+
function createTreeCollection(e, n) {
|
|
2703
|
+
return collection({
|
|
2704
|
+
rootNode: {
|
|
2705
|
+
id: "@ROOT",
|
|
2706
|
+
title: "",
|
|
2707
|
+
shape: "rectangle",
|
|
2708
|
+
icon: void 0,
|
|
2709
|
+
children: mapToTreeNodes(e.roots(), n),
|
|
2710
|
+
state: "not-present"
|
|
2711
|
+
},
|
|
2712
|
+
nodeToValue(e) {
|
|
2713
|
+
return e.id;
|
|
2714
|
+
},
|
|
2715
|
+
nodeToString(e) {
|
|
2716
|
+
return e.title;
|
|
2717
|
+
},
|
|
2718
|
+
nodeToChildren(e) {
|
|
2719
|
+
return e.children;
|
|
2720
|
+
},
|
|
2721
|
+
isNodeDisabled() {
|
|
2722
|
+
return !1;
|
|
2723
|
+
}
|
|
2724
|
+
});
|
|
2725
|
+
}
|
|
2726
|
+
var zt = selectEditorPanelState((e) => ({
|
|
2727
|
+
searchInput: e.searchInput.length > 2 ? e.searchInput.toLowerCase() : "",
|
|
2728
|
+
collection: e.collection
|
|
2729
|
+
}), (e, n) => e?.searchInput === n.searchInput && e?.collection.isEqual(n.collection));
|
|
2730
|
+
function useElementsTree() {
|
|
2731
|
+
let e = O(21), { searchInput: n, collection: r } = useEditorPanelState(zt), o = Le(n), s;
|
|
2732
|
+
bb0: {
|
|
2733
|
+
if (!o) {
|
|
2734
|
+
s = r;
|
|
2735
|
+
break bb0;
|
|
2736
|
+
}
|
|
2737
|
+
let n;
|
|
2738
|
+
if (e[0] !== r || e[1] !== o) {
|
|
2739
|
+
let t2;
|
|
2740
|
+
e[3] === o ? t2 = e[4] : (t2 = (e) => e.title.toLowerCase().includes(o), e[3] = o, e[4] = t2), n = r.filter(t2), e[0] = r, e[1] = o, e[2] = n;
|
|
2741
|
+
} else n = e[2];
|
|
2742
|
+
s = n;
|
|
2743
|
+
}
|
|
2744
|
+
let c = s, u;
|
|
2745
|
+
e[5] === Symbol.for("react.memo_cache_sentinel") ? (u = [], e[5] = u) : u = e[5];
|
|
2746
|
+
let [d, f] = D(u), t2;
|
|
2747
|
+
e[6] !== r || e[7] !== c ? (t2 = () => {
|
|
2748
|
+
c !== r && f((e) => {
|
|
2749
|
+
let n = a(c.getBranchValues(), e);
|
|
2750
|
+
return i(n, 1) ? l([...e, ...n], Ve()) : e;
|
|
2751
|
+
});
|
|
2752
|
+
}, e[6] = r, e[7] = c, e[8] = t2) : t2 = e[8];
|
|
2753
|
+
let p;
|
|
2754
|
+
e[9] === c ? p = e[10] : (p = [c], e[9] = c, e[10] = p), w(t2, p);
|
|
2755
|
+
let m = he(), h, g;
|
|
2756
|
+
e[11] === Symbol.for("react.memo_cache_sentinel") ? (h = [], g = [], e[11] = h, e[12] = g) : (h = e[11], g = e[12]);
|
|
2757
|
+
let _;
|
|
2758
|
+
e[13] !== d || e[14] !== c || e[15] !== m ? (_ = {
|
|
2759
|
+
id: m,
|
|
2760
|
+
collection: c,
|
|
2761
|
+
defaultCheckedValue: h,
|
|
2762
|
+
defaultSelectedValue: g,
|
|
2763
|
+
expandedValue: d,
|
|
2764
|
+
onExpandedChange(e) {
|
|
2765
|
+
let { expandedValue: n } = e;
|
|
2766
|
+
f(n);
|
|
2767
|
+
},
|
|
2768
|
+
onFocusChange(e) {
|
|
2769
|
+
console.log("Focus change", e);
|
|
2770
|
+
},
|
|
2771
|
+
onSelectionChange(e) {
|
|
2772
|
+
console.log("Selection change", e);
|
|
2773
|
+
}
|
|
2774
|
+
}, e[13] = d, e[14] = c, e[15] = m, e[16] = _) : _ = e[16];
|
|
2775
|
+
let v = useMachine(Rt, _);
|
|
2776
|
+
v.context.get("focusedValue")?.slice;
|
|
2777
|
+
let y;
|
|
2778
|
+
e[17] === v ? y = e[18] : (y = connect(v, _t), e[17] = v, e[18] = y);
|
|
2779
|
+
let b = y, t9;
|
|
2780
|
+
return e[19] === b ? t9 = e[20] : (t9 = () => {
|
|
2781
|
+
let e = b.collection.getFirstNode()?.id;
|
|
2782
|
+
e && b.focus(e);
|
|
2783
|
+
}, e[19] = b, e[20] = t9), useOnEditorPanelEvent("inputKeyDown", t9), b;
|
|
2784
|
+
}
|
|
2785
|
+
//#endregion
|
|
2786
|
+
//#region ../diagram/src/adhoc-editor/state/utils.ts
|
|
2787
|
+
function deriveElementStates({ rules: e, view: i }) {
|
|
2788
|
+
let a = new Set(i ? i.nodes.map((e) => e.modelRef ?? null).filter(r) : []), s = o(e, n((e) => e.type === "include" && e.enabled), c((e) => e.expr.ref.model), N()), l = o(e, n((e) => e.type === "exclude" && e.enabled), c((e) => e.expr.ref.model), N());
|
|
2789
|
+
return {
|
|
2790
|
+
disabled: o(e, n((e) => !e.enabled), c((e) => e.expr.ref.model), N()),
|
|
2791
|
+
includedExplicit: s,
|
|
2792
|
+
includedImplicit: He(a, s),
|
|
2793
|
+
excluded: He(l, a)
|
|
2794
|
+
};
|
|
2795
|
+
}
|
|
2796
|
+
//#endregion
|
|
2797
|
+
//#region ../diagram/src/adhoc-editor/state/panel.tsx
|
|
2798
|
+
var createEditorPanelStore = ({ initial: e, sideEffects: n }) => createStore({
|
|
2799
|
+
context: {
|
|
2800
|
+
searchInput: "",
|
|
2801
|
+
expandedValue: [],
|
|
2802
|
+
collection: e
|
|
2803
|
+
},
|
|
2804
|
+
emits: { inputKeyDown: (e) => {} },
|
|
2805
|
+
on: {
|
|
2806
|
+
inputChange: (e, n) => ({
|
|
2807
|
+
...e,
|
|
2808
|
+
searchInput: n.value
|
|
2809
|
+
}),
|
|
2810
|
+
inputKeyDown: (e, n, r) => {
|
|
2811
|
+
r.emit.inputKeyDown();
|
|
2812
|
+
},
|
|
2813
|
+
modelUpdate: (e, n) => ({
|
|
2814
|
+
...e,
|
|
2815
|
+
collection: n.collection
|
|
2816
|
+
}),
|
|
2817
|
+
elementClick: (e, r, i) => {
|
|
2818
|
+
let a = e.collection.findNode(r.id), o = e.collection.getIndexPath(r.id);
|
|
2819
|
+
return !a || !o || i.effect(() => {
|
|
2820
|
+
n.onElementStateClick({ id: r.id });
|
|
2821
|
+
}), e;
|
|
2822
|
+
}
|
|
2823
|
+
}
|
|
2824
|
+
}), Bt = Pe(null), EditorPanelStoreProvider = (e) => {
|
|
2825
|
+
let n = Se(), r = E(n);
|
|
2826
|
+
r.current = n;
|
|
2827
|
+
let i = useAdhocEditorActor(), a = T(() => createEditorPanelStore({
|
|
2828
|
+
initial: createTreeCollection(n),
|
|
2829
|
+
sideEffects: { onElementStateClick({ id: e }) {
|
|
2830
|
+
i.send({
|
|
2831
|
+
type: "toggle.element",
|
|
2832
|
+
id: e
|
|
2833
|
+
});
|
|
2834
|
+
} }
|
|
2835
|
+
}), [i]);
|
|
2836
|
+
return ge(() => {
|
|
2837
|
+
a.trigger.modelUpdate({ collection: createTreeCollection(n, deriveElementStates(i.getSnapshot().context)) });
|
|
2838
|
+
}, [n]), w(() => {
|
|
2839
|
+
let e = i.on("view.update", () => {
|
|
2840
|
+
a.trigger.modelUpdate({ collection: createTreeCollection(r.current, deriveElementStates(i.getSnapshot().context)) });
|
|
2841
|
+
});
|
|
2842
|
+
return () => {
|
|
2843
|
+
e.unsubscribe();
|
|
2844
|
+
};
|
|
2845
|
+
}, [i]), /* @__PURE__ */ k(Bt.Provider, {
|
|
2846
|
+
value: a,
|
|
2847
|
+
children: e.children
|
|
2848
|
+
});
|
|
2849
|
+
};
|
|
2850
|
+
function selectEditorPanelState(e, n) {
|
|
2851
|
+
return [(n) => e(n.context), n ?? shallowEqual];
|
|
2852
|
+
}
|
|
2853
|
+
function useEditorPanelStore() {
|
|
2854
|
+
return Ie(Bt);
|
|
2855
|
+
}
|
|
2856
|
+
function useEditorPanelState(...e) {
|
|
2857
|
+
let n = O(4), r = e, a = useEditorPanelStore(), o, s;
|
|
2858
|
+
if (r.length === 2) [o, s] = r;
|
|
2859
|
+
else if (r.length === 1 && Array.isArray(r[0]) && i(r[0], 2)) [o, s] = r[0];
|
|
2860
|
+
else if (r.length === 1 && Array.isArray(r[0]) && i(r[0], 1)) {
|
|
2861
|
+
let e = r[0], i;
|
|
2862
|
+
n[0] === e ? i = n[1] : (i = [e, shallowEqual], n[0] = e, n[1] = i), [o, s] = i;
|
|
2863
|
+
} else if (r.length === 1 && typeof r[0] == "function") {
|
|
2864
|
+
let e = r[0], i;
|
|
2865
|
+
n[2] === e ? i = n[3] : (i = [e, shallowEqual], n[2] = e, n[3] = i), [o, s] = i;
|
|
2866
|
+
} else throw Error("Invalid arguments for useEditorPanelState");
|
|
2867
|
+
return useSelector(a, o, s);
|
|
2868
|
+
}
|
|
2869
|
+
function useOnEditorPanelEvent(...e) {
|
|
2870
|
+
let n = O(7), r = e, i = useEditorPanelStore(), a = r[0], o = ue(r[1]), t1;
|
|
2871
|
+
n[0] !== a || n[1] !== o || n[2] !== i ? (t1 = () => {
|
|
2872
|
+
let e = i.on(a, o);
|
|
2873
|
+
return () => {
|
|
2874
|
+
e.unsubscribe();
|
|
2875
|
+
};
|
|
2876
|
+
}, n[0] = a, n[1] = o, n[2] = i, n[3] = t1) : t1 = n[3];
|
|
2877
|
+
let s;
|
|
2878
|
+
n[4] !== a || n[5] !== i ? (s = [a, i], n[4] = a, n[5] = i, n[6] = s) : s = n[6], w(t1, s);
|
|
2879
|
+
}
|
|
2880
|
+
function useEditorPanelTrigger(...e) {
|
|
2881
|
+
let n = useEditorPanelStore();
|
|
2882
|
+
if (e.length === 0) return n.trigger;
|
|
2883
|
+
let r = e[0];
|
|
2884
|
+
return ue((...e) => {
|
|
2885
|
+
r(n.trigger, ...e);
|
|
2886
|
+
});
|
|
2887
|
+
}
|
|
2888
|
+
//#endregion
|
|
2889
|
+
//#region ../diagram/src/adhoc-editor/ElementsTree.tsx
|
|
2890
|
+
var Vt = C(() => {
|
|
2891
|
+
let e = O(20), n = useElementsTree(), t0;
|
|
2892
|
+
e[0] === n ? t0 = e[1] : (t0 = (e, r) => {
|
|
2893
|
+
let i = r.currentTarget.closest("[data-value]")?.getAttribute("data-value");
|
|
2894
|
+
if (i) try {
|
|
2895
|
+
r.stopPropagation(), r.preventDefault(), n.expand([i]), e.elementClick({ id: i });
|
|
2896
|
+
} catch (e) {
|
|
2897
|
+
console.error("Failed to handle element click", e);
|
|
2898
|
+
}
|
|
2899
|
+
}, e[0] = n, e[1] = t0);
|
|
2900
|
+
let r = useEditorPanelTrigger(t0), i;
|
|
2901
|
+
if (e[2] !== n) {
|
|
2902
|
+
let t2;
|
|
2903
|
+
e[4] === n.selectedValue ? t2 = e[5] : (t2 = (e) => {
|
|
2904
|
+
bb32: switch (e.key) {
|
|
2905
|
+
case "Escape": {
|
|
2906
|
+
let n = document.getElementById("search-input");
|
|
2907
|
+
n && (e.stopPropagation(), e.preventDefault(), n.focus());
|
|
2908
|
+
break bb32;
|
|
2909
|
+
}
|
|
2910
|
+
case "ArrowUp": break bb32;
|
|
2911
|
+
default: return;
|
|
2912
|
+
}
|
|
2913
|
+
}, e[4] = n.selectedValue, e[5] = t2), i = mergeProps(n.getRootProps(), { onKeyDown: t2 }), e[2] = n, e[3] = i;
|
|
2914
|
+
} else i = e[3];
|
|
2915
|
+
let a = i, o;
|
|
2916
|
+
e[6] === n ? o = e[7] : (o = n.getTreeProps(), e[6] = n, e[7] = o);
|
|
2917
|
+
let s;
|
|
2918
|
+
e[8] !== n || e[9] !== r ? (s = n.collection.rootNode.children.map((e, i) => /* @__PURE__ */ k(TreeNode, {
|
|
2919
|
+
node: e,
|
|
2920
|
+
api: n,
|
|
2921
|
+
onClick: r
|
|
2922
|
+
}, e.id)), e[8] = n, e[9] = r, e[10] = s) : s = e[10];
|
|
2923
|
+
let c;
|
|
2924
|
+
e[11] === n.collection ? c = e[12] : (c = !n.collection.getFirstNode() && /* @__PURE__ */ k(y, {
|
|
2925
|
+
css: {
|
|
2926
|
+
p: "4",
|
|
2927
|
+
textAlign: "center"
|
|
2928
|
+
},
|
|
2929
|
+
children: "Nothing found"
|
|
2930
|
+
}), e[11] = n.collection, e[12] = c);
|
|
2931
|
+
let l;
|
|
2932
|
+
e[13] !== o || e[14] !== s || e[15] !== c ? (l = /* @__PURE__ */ A(V.Root, {
|
|
2933
|
+
...o,
|
|
2934
|
+
children: [s, c]
|
|
2935
|
+
}), e[13] = o, e[14] = s, e[15] = c, e[16] = l) : l = e[16];
|
|
2936
|
+
let u;
|
|
2937
|
+
return e[17] !== a || e[18] !== l ? (u = /* @__PURE__ */ k(h, {
|
|
2938
|
+
flex: "1 1 100%",
|
|
2939
|
+
scrollbars: "y",
|
|
2940
|
+
type: "scroll",
|
|
2941
|
+
scrollbarSize: "4px",
|
|
2942
|
+
...a,
|
|
2943
|
+
children: l
|
|
2944
|
+
}), e[17] = a, e[18] = l, e[19] = u) : u = e[19], u;
|
|
2945
|
+
}), TreeNode = (e) => {
|
|
2946
|
+
let n = O(29), { api: r, node: i, onClick: a } = e, o = r.collection, s, c, l, u, d, f;
|
|
2947
|
+
if (n[0] !== r || n[1] !== i || n[2] !== a) {
|
|
2948
|
+
f = Symbol.for("react.early_return_sentinel");
|
|
2949
|
+
bb0: {
|
|
2950
|
+
let e = o.getIndexPath(i.id);
|
|
2951
|
+
Ue(e, "Node not found in collection");
|
|
2952
|
+
let p = {
|
|
2953
|
+
indexPath: e,
|
|
2954
|
+
node: i
|
|
2955
|
+
}, m = r.getNodeState(p);
|
|
2956
|
+
if (m.isBranch) {
|
|
2957
|
+
let e;
|
|
2958
|
+
n[9] === i ? e = n[10] : (e = /* @__PURE__ */ k(V.Icon, { element: i }), n[9] = i, n[10] = e);
|
|
2959
|
+
let o;
|
|
2960
|
+
n[11] !== i || n[12] !== a ? (o = /* @__PURE__ */ k(V.State, {
|
|
2961
|
+
node: i,
|
|
2962
|
+
state: i.state,
|
|
2963
|
+
onClick: a
|
|
2964
|
+
}), n[11] = i, n[12] = a, n[13] = o) : o = n[13], f = /* @__PURE__ */ A(V.Branch, {
|
|
2965
|
+
...r.getBranchProps(p),
|
|
2966
|
+
children: [/* @__PURE__ */ A(V.Control, {
|
|
2967
|
+
...r.getBranchControlProps(p),
|
|
2968
|
+
children: [
|
|
2969
|
+
e,
|
|
2970
|
+
/* @__PURE__ */ A(V.Label, {
|
|
2971
|
+
...r.getBranchTextProps(p),
|
|
2972
|
+
children: [i.title, /* @__PURE__ */ k(V.Indicator, { ...r.getBranchIndicatorProps(p) })]
|
|
2973
|
+
}),
|
|
2974
|
+
o
|
|
2975
|
+
]
|
|
2976
|
+
}), /* @__PURE__ */ k(V.Content, {
|
|
2977
|
+
...r.getBranchContentProps(p),
|
|
2978
|
+
children: m.expanded && i.children.map((e, n) => /* @__PURE__ */ k(TreeNode, {
|
|
2979
|
+
node: e,
|
|
2980
|
+
api: r,
|
|
2981
|
+
onClick: a
|
|
2982
|
+
}, e.id))
|
|
2983
|
+
})]
|
|
2984
|
+
});
|
|
2985
|
+
break bb0;
|
|
2986
|
+
}
|
|
2987
|
+
c = V.Item, u = r.getItemProps(p), n[14] === i ? d = n[15] : (d = /* @__PURE__ */ k(V.Icon, { element: i }), n[14] = i, n[15] = d), s = V.Label, l = r.getItemTextProps(p);
|
|
2988
|
+
}
|
|
2989
|
+
n[0] = r, n[1] = i, n[2] = a, n[3] = s, n[4] = c, n[5] = l, n[6] = u, n[7] = d, n[8] = f;
|
|
2990
|
+
} else s = n[3], c = n[4], l = n[5], u = n[6], d = n[7], f = n[8];
|
|
2991
|
+
if (f !== Symbol.for("react.early_return_sentinel")) return f;
|
|
2992
|
+
let p;
|
|
2993
|
+
n[16] !== s || n[17] !== i.title || n[18] !== l ? (p = /* @__PURE__ */ k(s, {
|
|
2994
|
+
...l,
|
|
2995
|
+
children: i.title
|
|
2996
|
+
}), n[16] = s, n[17] = i.title, n[18] = l, n[19] = p) : p = n[19];
|
|
2997
|
+
let m;
|
|
2998
|
+
n[20] !== i || n[21] !== a ? (m = /* @__PURE__ */ k(V.State, {
|
|
2999
|
+
node: i,
|
|
3000
|
+
state: i.state,
|
|
3001
|
+
onClick: a
|
|
3002
|
+
}), n[20] = i, n[21] = a, n[22] = m) : m = n[22];
|
|
3003
|
+
let h;
|
|
3004
|
+
return n[23] !== c || n[24] !== u || n[25] !== d || n[26] !== p || n[27] !== m ? (h = /* @__PURE__ */ A(c, {
|
|
3005
|
+
...u,
|
|
3006
|
+
children: [
|
|
3007
|
+
d,
|
|
3008
|
+
p,
|
|
3009
|
+
m
|
|
3010
|
+
]
|
|
3011
|
+
}), n[23] = c, n[24] = u, n[25] = d, n[26] = p, n[27] = m, n[28] = h) : h = n[28], h;
|
|
3012
|
+
}, EditorPanel = () => {
|
|
3013
|
+
let e = O(6), n;
|
|
3014
|
+
e[0] === Symbol.for("react.memo_cache_sentinel") ? (n = {
|
|
3015
|
+
position: "fixed",
|
|
3016
|
+
top: "0",
|
|
3017
|
+
left: "0",
|
|
3018
|
+
gap: "1",
|
|
3019
|
+
bottom: "0",
|
|
3020
|
+
height: "auto",
|
|
3021
|
+
overflow: "hidden",
|
|
3022
|
+
layerStyle: "likec4.panel",
|
|
3023
|
+
width: "[300px]",
|
|
3024
|
+
rounded: "0"
|
|
3025
|
+
}, e[0] = n) : n = e[0];
|
|
3026
|
+
let r, i;
|
|
3027
|
+
e[1] === Symbol.for("react.memo_cache_sentinel") ? (r = /* @__PURE__ */ k(fe, { style: { height: 16 } }), i = /* @__PURE__ */ k(te, {
|
|
3028
|
+
size: "sm",
|
|
3029
|
+
fontWeight: "medium",
|
|
3030
|
+
flex: "1",
|
|
3031
|
+
children: "Explore"
|
|
3032
|
+
}), e[1] = r, e[2] = i) : (r = e[1], i = e[2]);
|
|
3033
|
+
let a;
|
|
3034
|
+
e[3] === Symbol.for("react.memo_cache_sentinel") ? (a = /* @__PURE__ */ A(re, {
|
|
3035
|
+
p: "2",
|
|
3036
|
+
gap: "4",
|
|
3037
|
+
justifyItems: "stretch",
|
|
3038
|
+
children: [
|
|
3039
|
+
r,
|
|
3040
|
+
i,
|
|
3041
|
+
/* @__PURE__ */ k(re, {
|
|
3042
|
+
gap: "1",
|
|
3043
|
+
children: /* @__PURE__ */ k(f, { children: /* @__PURE__ */ k(Je, {}) })
|
|
3044
|
+
})
|
|
3045
|
+
]
|
|
3046
|
+
}), e[3] = a) : a = e[3];
|
|
3047
|
+
let o;
|
|
3048
|
+
e[4] === Symbol.for("react.memo_cache_sentinel") ? (o = /* @__PURE__ */ k(y, { children: /* @__PURE__ */ k(SearchInput, {}) }), e[4] = o) : o = e[4];
|
|
3049
|
+
let s;
|
|
3050
|
+
return e[5] === Symbol.for("react.memo_cache_sentinel") ? (s = /* @__PURE__ */ k(EditorPanelStoreProvider, { children: /* @__PURE__ */ k(Te, {
|
|
3051
|
+
mode: "popLayout",
|
|
3052
|
+
children: /* @__PURE__ */ A(_, {
|
|
3053
|
+
css: n,
|
|
3054
|
+
onClick: _temp,
|
|
3055
|
+
children: [
|
|
3056
|
+
a,
|
|
3057
|
+
o,
|
|
3058
|
+
/* @__PURE__ */ k(Ne, { children: /* @__PURE__ */ k(Vt, {}) })
|
|
3059
|
+
]
|
|
3060
|
+
})
|
|
3061
|
+
}) }), e[5] = s) : s = e[5], s;
|
|
3062
|
+
}, Ht = selectEditorPanelState(d("searchInput"));
|
|
3063
|
+
function SearchInput() {
|
|
3064
|
+
let e = O(13), n = useEditorPanelState(Ht), r = useEditorPanelTrigger(), i = useEditorPanelTrigger(_temp2), a = useEditorPanelTrigger(_temp3), o = n ? void 0 : "none", s;
|
|
3065
|
+
e[0] === o ? s = e[1] : (s = { display: o }, e[0] = o, e[1] = s);
|
|
3066
|
+
let c;
|
|
3067
|
+
e[2] !== a || e[3] !== s ? (c = /* @__PURE__ */ k(p, {
|
|
3068
|
+
size: "sm",
|
|
3069
|
+
"aria-label": "Clear input",
|
|
3070
|
+
onClick: a,
|
|
3071
|
+
style: s
|
|
3072
|
+
}), e[2] = a, e[3] = s, e[4] = c) : c = e[4];
|
|
3073
|
+
let t3;
|
|
3074
|
+
e[5] !== a || e[6] !== r ? (t3 = (e) => {
|
|
3075
|
+
bb8: switch (e.key) {
|
|
3076
|
+
case "Escape":
|
|
3077
|
+
e.stopPropagation(), e.preventDefault(), a();
|
|
3078
|
+
break bb8;
|
|
3079
|
+
case "Enter":
|
|
3080
|
+
e.stopPropagation(), e.preventDefault();
|
|
3081
|
+
break bb8;
|
|
3082
|
+
case "ArrowDown":
|
|
3083
|
+
e.stopPropagation(), e.preventDefault(), r.inputKeyDown();
|
|
3084
|
+
break bb8;
|
|
3085
|
+
default: return;
|
|
3086
|
+
}
|
|
3087
|
+
}, e[5] = a, e[6] = r, e[7] = t3) : t3 = e[7];
|
|
3088
|
+
let l;
|
|
3089
|
+
return e[8] !== n || e[9] !== i || e[10] !== c || e[11] !== t3 ? (l = /* @__PURE__ */ k(y, { children: /* @__PURE__ */ k(m, {
|
|
3090
|
+
id: "search-input",
|
|
3091
|
+
size: "xs",
|
|
3092
|
+
variant: "filled",
|
|
3093
|
+
placeholder: "Search by title, description or start with # or kind:",
|
|
3094
|
+
value: n,
|
|
3095
|
+
onChange: i,
|
|
3096
|
+
"data-likec4-search-input": !0,
|
|
3097
|
+
rightSectionPointerEvents: "all",
|
|
3098
|
+
rightSection: c,
|
|
3099
|
+
onKeyDownCapture: t3
|
|
3100
|
+
}) }), e[8] = n, e[9] = i, e[10] = c, e[11] = t3, e[12] = l) : l = e[12], l;
|
|
3101
|
+
}
|
|
3102
|
+
function _temp3(e) {
|
|
3103
|
+
e.inputChange({ value: "" });
|
|
3104
|
+
}
|
|
3105
|
+
function _temp2(e, n) {
|
|
3106
|
+
e.inputChange({ value: n.currentTarget.value });
|
|
3107
|
+
}
|
|
3108
|
+
function _temp(e) {
|
|
3109
|
+
e.stopPropagation();
|
|
3110
|
+
let n = document.getElementById("search-input");
|
|
3111
|
+
n && n.focus();
|
|
3112
|
+
}
|
|
3113
|
+
//#endregion
|
|
3114
|
+
//#region ../diagram/src/adhoc-editor/state/actor.types.ts
|
|
3115
|
+
function ruleToPredicate(e) {
|
|
3116
|
+
return e.type === "include" ? { include: [e.expr] } : { exclude: [e.expr] };
|
|
3117
|
+
}
|
|
3118
|
+
var Z = Oe({
|
|
3119
|
+
types: {
|
|
3120
|
+
context: {},
|
|
3121
|
+
tags: "",
|
|
3122
|
+
events: {},
|
|
3123
|
+
emitted: {}
|
|
3124
|
+
},
|
|
3125
|
+
actors: { service: {} },
|
|
3126
|
+
guards: { hasView: ({ context: e }) => e.view !== null }
|
|
3127
|
+
});
|
|
3128
|
+
function createContext$1() {
|
|
3129
|
+
return {
|
|
3130
|
+
view: null,
|
|
3131
|
+
error: void 0,
|
|
3132
|
+
rules: []
|
|
3133
|
+
};
|
|
3134
|
+
}
|
|
3135
|
+
e(createContext$1, "createContext");
|
|
3136
|
+
//#endregion
|
|
3137
|
+
//#region ../diagram/src/adhoc-editor/state/actor.layouter.ts
|
|
3138
|
+
var Q = {
|
|
3139
|
+
idle: { target: "#layouter-idle" },
|
|
3140
|
+
call: { target: "#layouter-call" }
|
|
3141
|
+
}, Ut = Z.createStateConfig({
|
|
3142
|
+
id: Q.idle.target.substring(1),
|
|
3143
|
+
entry: S("entry idle ->"),
|
|
3144
|
+
exit: S(" -> idle exit "),
|
|
3145
|
+
on: { layout: { ...Q.call } }
|
|
3146
|
+
}), emitViewUpdate = () => Z.emit({ type: "view.update" }), Wt = t(n((e) => e.enabled), c(ruleToPredicate)), Gt = Z.createStateConfig({
|
|
3147
|
+
id: Q.call.target.substring(1),
|
|
3148
|
+
entry: S("entry call ->"),
|
|
3149
|
+
exit: S(" -> call exit "),
|
|
3150
|
+
invoke: {
|
|
3151
|
+
src: "service",
|
|
3152
|
+
input: ({ context: e }) => ({ predicates: Wt(e.rules) }),
|
|
3153
|
+
onDone: {
|
|
3154
|
+
actions: [ke({
|
|
3155
|
+
view: ({ context: e, event: n }) => {
|
|
3156
|
+
let r = Ge(Wt(e.rules));
|
|
3157
|
+
return {
|
|
3158
|
+
...n.output.view,
|
|
3159
|
+
hash: r,
|
|
3160
|
+
id: r
|
|
3161
|
+
};
|
|
3162
|
+
},
|
|
3163
|
+
error: void 0
|
|
3164
|
+
}), Ee({ type: "view.update" })],
|
|
3165
|
+
...Q.idle
|
|
3166
|
+
},
|
|
3167
|
+
onError: {
|
|
3168
|
+
actions: [S(({ event: e }) => `error: ${e.error}`), ke({ error: ({ event: e }) => `${e.error}` })],
|
|
3169
|
+
...Q.idle
|
|
3170
|
+
}
|
|
3171
|
+
}
|
|
3172
|
+
}), Kt = Z.createStateConfig({
|
|
3173
|
+
initial: "idle",
|
|
3174
|
+
states: {
|
|
3175
|
+
idle: Ut,
|
|
3176
|
+
call: Gt
|
|
3177
|
+
}
|
|
3178
|
+
}), $ = {
|
|
3179
|
+
idle: { target: "#idle" },
|
|
3180
|
+
selecting: { target: "#selecting" },
|
|
3181
|
+
layouting: { target: "#layouting" }
|
|
3182
|
+
};
|
|
3183
|
+
function nextId({ rules: e }, n = "") {
|
|
3184
|
+
return Ke((e.at(-1)?.id ?? (/* @__PURE__ */ new Date()).toISOString()) + n);
|
|
3185
|
+
}
|
|
3186
|
+
var isRuleOf = (e) => (n) => M.isModelRef(n.expr) && n.expr.ref.model === e, isIncludeOf = (e) => (n) => n.type === "include" && M.isModelRef(n.expr) && n.expr.ref.model === e, isExcludeOf = (e) => (n) => n.type === "exclude" && M.isModelRef(n.expr) && n.expr.ref.model === e;
|
|
3187
|
+
function deriveElementState(e, { rules: n, view: r }) {
|
|
3188
|
+
let i = n.find(isRuleOf(e));
|
|
3189
|
+
if (i && !i.enabled) return {
|
|
3190
|
+
state: "disabled",
|
|
3191
|
+
ruleId: i.id
|
|
3192
|
+
};
|
|
3193
|
+
let a = r ? r.nodes.some((n) => n.modelRef === e) : !1, o = n.find(isIncludeOf(e)), s = n.find(isExcludeOf(e));
|
|
3194
|
+
switch (!0) {
|
|
3195
|
+
case o && a: return {
|
|
3196
|
+
state: "include-explicit",
|
|
3197
|
+
ruleId: o.id
|
|
3198
|
+
};
|
|
3199
|
+
case !o && a: return {
|
|
3200
|
+
state: "include-implicit",
|
|
3201
|
+
ruleId: void 0
|
|
3202
|
+
};
|
|
3203
|
+
case o && !a: return {
|
|
3204
|
+
state: "not-present",
|
|
3205
|
+
ruleId: o.id
|
|
3206
|
+
};
|
|
3207
|
+
case !!s: return {
|
|
3208
|
+
state: "exclude",
|
|
3209
|
+
ruleId: s.id
|
|
3210
|
+
};
|
|
3211
|
+
default: return Ue(a === !1, "Element not in view should not be included or excluded by any rule"), {
|
|
3212
|
+
state: "not-present",
|
|
3213
|
+
ruleId: void 0
|
|
3214
|
+
};
|
|
3215
|
+
}
|
|
3216
|
+
}
|
|
3217
|
+
var enableRule = (e) => Z.assign(({ context: n }) => ({ rules: n.rules.map((n) => n.id === e && !n.enabled ? {
|
|
3218
|
+
...n,
|
|
3219
|
+
enabled: !0
|
|
3220
|
+
} : n) })), addElementRules = (e, n) => Z.assign(({ context: r }) => ({ rules: [...r.rules, {
|
|
3221
|
+
id: nextId(r, n + e),
|
|
3222
|
+
expr: { ref: { model: e } },
|
|
3223
|
+
enabled: !0,
|
|
3224
|
+
type: n
|
|
3225
|
+
}] })), removeElementRules = (e) => Z.assign(({ context: n }) => {
|
|
3226
|
+
let r = isRuleOf(e);
|
|
3227
|
+
return { rules: n.rules.filter((e) => !r(e)) };
|
|
3228
|
+
}), toggleElement = () => Z.enqueueActions(({ context: e, event: n, enqueue: r }) => {
|
|
3229
|
+
x(n, "toggle.element");
|
|
3230
|
+
let i = isRuleOf(n.id), a = s(e.rules);
|
|
3231
|
+
if (a && i(a)) {
|
|
3232
|
+
r.assign({ rules: e.rules.slice(0, -1) });
|
|
3233
|
+
return;
|
|
3234
|
+
}
|
|
3235
|
+
let o = deriveElementState(n.id, e);
|
|
3236
|
+
switch (o.state) {
|
|
3237
|
+
case "disabled":
|
|
3238
|
+
r(enableRule(o.ruleId));
|
|
3239
|
+
break;
|
|
3240
|
+
case "not-present":
|
|
3241
|
+
r(removeElementRules(n.id)), r(addElementRules(n.id, "include"));
|
|
3242
|
+
break;
|
|
3243
|
+
case "include-implicit":
|
|
3244
|
+
r(removeElementRules(n.id)), r(addElementRules(n.id, "exclude"));
|
|
3245
|
+
break;
|
|
3246
|
+
case "include-explicit":
|
|
3247
|
+
case "exclude":
|
|
3248
|
+
r(removeElementRules(n.id));
|
|
3249
|
+
break;
|
|
3250
|
+
default: We(o);
|
|
3251
|
+
}
|
|
3252
|
+
}), toggleRule = () => Z.assign(({ context: e, event: n }) => (x(n, "toggle.rule"), { rules: e.rules.map((e) => e.id === n.ruleId ? {
|
|
3253
|
+
...e,
|
|
3254
|
+
enabled: !e.enabled
|
|
3255
|
+
} : e) })), deleteRule = () => Z.assign(({ context: e, event: n }) => (x(n, "delete.rule"), { rules: e.rules.filter((e) => e.id !== n.ruleId) })), scheduleLayout = () => Z.raise({ type: "layout" }), qt = Z.createStateConfig({
|
|
3256
|
+
id: "idle",
|
|
3257
|
+
on: {
|
|
3258
|
+
"select.open": { ...$.selecting },
|
|
3259
|
+
"toggle.rule": {
|
|
3260
|
+
actions: toggleRule(),
|
|
3261
|
+
...$.layouting
|
|
3262
|
+
},
|
|
3263
|
+
"delete.rule": {
|
|
3264
|
+
actions: deleteRule(),
|
|
3265
|
+
...$.layouting
|
|
3266
|
+
}
|
|
3267
|
+
}
|
|
3268
|
+
}), Jt = Z.createStateConfig({
|
|
3269
|
+
id: "selecting",
|
|
3270
|
+
on: {
|
|
3271
|
+
"toggle.element": { actions: [
|
|
3272
|
+
toggleElement(),
|
|
3273
|
+
emitViewUpdate(),
|
|
3274
|
+
scheduleLayout()
|
|
3275
|
+
] },
|
|
3276
|
+
"select.close": { ...$.idle }
|
|
3277
|
+
}
|
|
3278
|
+
}), Yt = Z.createStateConfig({
|
|
3279
|
+
id: "layouting",
|
|
3280
|
+
always: {
|
|
3281
|
+
actions: scheduleLayout(),
|
|
3282
|
+
...$.idle
|
|
3283
|
+
}
|
|
3284
|
+
}), Xt = Z.createStateConfig({
|
|
3285
|
+
initial: "selecting",
|
|
3286
|
+
states: {
|
|
3287
|
+
idle: qt,
|
|
3288
|
+
selecting: Jt,
|
|
3289
|
+
layouting: Yt
|
|
3290
|
+
}
|
|
3291
|
+
}), Zt = Z.createMachine({
|
|
3292
|
+
id: "adhoc-editor",
|
|
3293
|
+
context: createContext$1,
|
|
3294
|
+
type: "parallel",
|
|
3295
|
+
states: {
|
|
3296
|
+
layouter: Kt,
|
|
3297
|
+
editor: Xt
|
|
3298
|
+
}
|
|
3299
|
+
}), Qt = {
|
|
3300
|
+
read: () => JSON.parse(sessionStorage.getItem("adhoc-editor-state") || "null") ?? void 0,
|
|
3301
|
+
write: (e) => sessionStorage.setItem("adhoc-editor-state", JSON.stringify(e))
|
|
3302
|
+
};
|
|
3303
|
+
function AdhocEditorActorProvider({ children: e, service: n }) {
|
|
3304
|
+
let r = E(n);
|
|
3305
|
+
r.current = n;
|
|
3306
|
+
let i = T(() => ({ actors: { service: De(({ input: e }) => r.current.process(e)) } }), []), a = je(Zt.provide(i), {
|
|
3307
|
+
id: "adhoc-editor",
|
|
3308
|
+
snapshot: Qt.read(),
|
|
3309
|
+
systemId: "adhoc-editor",
|
|
3310
|
+
inspect: (e) => {
|
|
3311
|
+
console.log("[AdhocEditorActor]", e);
|
|
3312
|
+
}
|
|
3313
|
+
});
|
|
3314
|
+
return w(() => {
|
|
3315
|
+
let e = a.subscribe((e) => {
|
|
3316
|
+
Qt.write(e);
|
|
3317
|
+
});
|
|
3318
|
+
return () => e.unsubscribe();
|
|
3319
|
+
}, [a]), /* @__PURE__ */ k(Pt, {
|
|
3320
|
+
value: a,
|
|
3321
|
+
children: e
|
|
3322
|
+
});
|
|
3323
|
+
}
|
|
3324
|
+
//#endregion
|
|
3325
|
+
//#region ../diagram/src/adhoc-editor/LikeC4AdHocViewEditor.tsx
|
|
3326
|
+
var noop = () => {}, $t = {
|
|
3327
|
+
...u(ve, () => !1),
|
|
3328
|
+
enableFitView: !0,
|
|
3329
|
+
enableReadOnly: !0
|
|
3330
|
+
};
|
|
3331
|
+
function LikeC4AdHocViewEditor({ service: e }) {
|
|
3332
|
+
let n = he(), r = E({
|
|
3333
|
+
fitView: !0,
|
|
3334
|
+
defaultNodes: [],
|
|
3335
|
+
defaultEdges: []
|
|
3336
|
+
});
|
|
3337
|
+
return /* @__PURE__ */ k(le, { children: /* @__PURE__ */ k(me, { children: /* @__PURE__ */ k(Me, {
|
|
3338
|
+
id: "LikeC4AdHocViewEditor",
|
|
3339
|
+
onRender: noop,
|
|
3340
|
+
children: /* @__PURE__ */ k(oe, {
|
|
3341
|
+
value: null,
|
|
3342
|
+
children: /* @__PURE__ */ k(AdhocEditorActorProvider, {
|
|
3343
|
+
service: e,
|
|
3344
|
+
children: /* @__PURE__ */ A(_e, {
|
|
3345
|
+
features: $t,
|
|
3346
|
+
children: [/* @__PURE__ */ k(pe, { id: n }), /* @__PURE__ */ k(xe, {
|
|
3347
|
+
rootSelector: `#${n}`,
|
|
3348
|
+
children: /* @__PURE__ */ k(se, {
|
|
3349
|
+
id: n,
|
|
3350
|
+
children: /* @__PURE__ */ A(we, {
|
|
3351
|
+
...r.current,
|
|
3352
|
+
children: [/* @__PURE__ */ k(en, { id: n }), /* @__PURE__ */ k(EditorPanel, {})]
|
|
3353
|
+
})
|
|
3354
|
+
})
|
|
3355
|
+
})]
|
|
3356
|
+
})
|
|
3357
|
+
})
|
|
3358
|
+
})
|
|
3359
|
+
}) }) });
|
|
3360
|
+
}
|
|
3361
|
+
var en = C((e) => {
|
|
3362
|
+
let n = O(5), { id: r } = e, i = useAdhocView(), a, o;
|
|
3363
|
+
n[0] === Symbol.for("react.memo_cache_sentinel") ? (a = /* @__PURE__ */ k(ye, {}), o = /* @__PURE__ */ k(tn, {}), n[0] = a, n[1] = o) : (a = n[0], o = n[1]);
|
|
3364
|
+
let s;
|
|
3365
|
+
return n[2] !== r || n[3] !== i ? (s = /* @__PURE__ */ A(be, {
|
|
3366
|
+
id: r,
|
|
3367
|
+
view: i,
|
|
3368
|
+
zoomable: !0,
|
|
3369
|
+
pannable: !0,
|
|
3370
|
+
fitViewPadding: ce.withControls,
|
|
3371
|
+
nodesDraggable: !1,
|
|
3372
|
+
nodesSelectable: !0,
|
|
3373
|
+
children: [a, o]
|
|
3374
|
+
}), n[2] = r, n[3] = i, n[4] = s) : s = n[4], s;
|
|
3375
|
+
}), tn = C(() => {
|
|
3376
|
+
let e = O(4), n = useAdhocEditorActor(), r = Ce(), t0, i;
|
|
3377
|
+
return e[0] !== n || e[1] !== r ? (t0 = () => {
|
|
3378
|
+
let e = n.on("click.element", (e) => {
|
|
3379
|
+
let { id: n } = e;
|
|
3380
|
+
r.focusOnElement(n);
|
|
3381
|
+
});
|
|
3382
|
+
return () => e.unsubscribe();
|
|
3383
|
+
}, i = [n, r], e[0] = n, e[1] = r, e[2] = t0, e[3] = i) : (t0 = e[2], i = e[3]), w(t0, i), null;
|
|
3384
|
+
});
|
|
3385
|
+
//#endregion
|
|
3386
|
+
export { LikeC4AdHocViewEditor };
|