@inkandswitch/patchwork-pkg-base 0.0.7 → 0.0.8

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.
Files changed (48) hide show
  1. package/modules.json +4 -0
  2. package/package.json +1 -1
  3. package/packages/account-history/dist/assets/HistoryRecorder-HO_sxeuE.js +248 -0
  4. package/packages/account-history/dist/assets/HistoryRecorder-HO_sxeuE.js.map +1 -0
  5. package/packages/account-history/dist/assets/HistoryViewer-Ct5g7zek.js +308 -0
  6. package/packages/account-history/dist/assets/HistoryViewer-Ct5g7zek.js.map +1 -0
  7. package/packages/account-history/dist/assets/NotebookViewer-BkYJL6Jc.js +504 -0
  8. package/packages/account-history/dist/assets/NotebookViewer-BkYJL6Jc.js.map +1 -0
  9. package/packages/account-history/dist/assets/index-CFzuSuJg.js +148 -0
  10. package/packages/account-history/dist/assets/index-CFzuSuJg.js.map +1 -0
  11. package/packages/account-history/dist/assets/makeDocumentProjection-DXgEZYyv.js +706 -0
  12. package/packages/account-history/dist/assets/makeDocumentProjection-DXgEZYyv.js.map +1 -0
  13. package/packages/account-history/dist/assets/store-CRmRL4Cv.js +1079 -0
  14. package/packages/account-history/dist/assets/store-CRmRL4Cv.js.map +1 -0
  15. package/packages/account-history/dist/index.js +5 -0
  16. package/packages/account-history/dist/index.js.map +1 -0
  17. package/packages/account-history/package.json +33 -0
  18. package/packages/chat/dist/ChatRoot-BXsklgz7.js +6113 -0
  19. package/packages/chat/dist/context-tool-CenQrztX.js +107 -0
  20. package/packages/chat/dist/datatype-1niKKK-c.js +15 -0
  21. package/packages/chat/dist/index-DYFHDHZ9.js +368 -0
  22. package/packages/chat/dist/index.js +5 -0
  23. package/packages/chat/dist/tool-D9BTS5wc.js +38 -0
  24. package/packages/chat/package.json +42 -0
  25. package/packages/comments-view/dist/assets/comments-D9lwpHOh.js +50 -0
  26. package/packages/comments-view/dist/assets/comments-D9lwpHOh.js.map +1 -0
  27. package/packages/comments-view/dist/assets/datatype-C4SMwWiO.js +22 -0
  28. package/packages/comments-view/dist/assets/datatype-C4SMwWiO.js.map +1 -0
  29. package/packages/comments-view/dist/assets/main-C8GVksuY.js +2973 -0
  30. package/packages/comments-view/dist/assets/main-C8GVksuY.js.map +1 -0
  31. package/packages/comments-view/dist/index.js +115 -0
  32. package/packages/comments-view/dist/index.js.map +1 -0
  33. package/packages/comments-view/package.json +36 -0
  34. package/packages/drafts/dist/assets/DraftDatatype-Dn8VF6oC.js +14 -0
  35. package/packages/drafts/dist/assets/DraftDatatype-Dn8VF6oC.js.map +1 -0
  36. package/packages/drafts/dist/assets/DraftListProvider-DVhUGU1x.js +362 -0
  37. package/packages/drafts/dist/assets/DraftListProvider-DVhUGU1x.js.map +1 -0
  38. package/packages/drafts/dist/assets/DraftOverlayProvider-NMDqnpBV.js +123 -0
  39. package/packages/drafts/dist/assets/DraftOverlayProvider-NMDqnpBV.js.map +1 -0
  40. package/packages/drafts/dist/assets/clone-policy-D4XOfZxs.js +15 -0
  41. package/packages/drafts/dist/assets/clone-policy-D4XOfZxs.js.map +1 -0
  42. package/packages/drafts/dist/assets/index-DAqs20jZ.js +65 -0
  43. package/packages/drafts/dist/assets/index-DAqs20jZ.js.map +1 -0
  44. package/packages/drafts/dist/assets/main-Cdev7z-t.js +2366 -0
  45. package/packages/drafts/dist/assets/main-Cdev7z-t.js.map +1 -0
  46. package/packages/drafts/dist/index.js +140 -0
  47. package/packages/drafts/dist/index.js.map +1 -0
  48. package/packages/drafts/package.json +34 -0
@@ -0,0 +1,1079 @@
1
+ (function() {
2
+ "use strict";
3
+ try {
4
+ if (typeof document != "undefined") {
5
+ var elementStyle = document.createElement("style");
6
+ elementStyle.appendChild(document.createTextNode("@layer package {\n:root,\n:host,\n[theme] {\n /* Colors derived from studio variables */\n --account-history-primary: var(--studio-secondary, #33ccf8);\n /* invert ink for text/icons sitting ON the primary (accent) surface. must be\n the accent's own luminance-adaptive line, NOT --account-history-bg (the page\n fill), which is only legible when the accent happens to be dark. */\n --account-history-primary-line: var(--studio-secondary-line, var(--studio-fill, white));\n --account-history-bg: var(--studio-fill, white);\n --account-history-text: var(--studio-line, black);\n --account-history-text-secondary: var(--studio-line-offset-40, #666);\n --account-history-text-tertiary: var(--studio-line-offset-50, #999);\n --account-history-border: var(--studio-fill-offset-20, #ccc);\n --account-history-hover: var(--studio-fill-offset-10, #e5e5e5);\n --account-history-family: var(--studio-family-sans, system-ui, sans-serif);\n --account-history-family-code: var(--studio-family-code, ui-monospace, monospace);\n --account-history-radius: 4px;\n\n /* Danger/delete colors */\n --account-history-danger: var(--studio-danger, #ff6a90);\n --account-history-danger-bg: color-mix(in oklch, var(--studio-danger, #ff6a90), transparent 90%);\n\n /* Fluid spacing scale - scales smoothly from mobile to desktop */\n --account-history-space-2xs: 0.25rem; /* 4px - fixed minimal spacing */\n --account-history-space-xs: clamp(0.375rem, 0.5vw, 0.5rem); /* 6px → 8px */\n --account-history-space-sm: clamp(0.5rem, 1vw, 0.75rem); /* 8px → 12px */\n --account-history-space-md: clamp(0.75rem, 2vw, 1rem); /* 12px → 16px */\n --account-history-space-lg: clamp(1rem, 2.5vw, 1.5rem); /* 16px → 24px */\n --account-history-space-xl: 2rem; /* 32px - fixed large spacing */\n --account-history-space-2xl: 4rem; /* 64px - fixed extra large spacing */\n\n /* Fluid typography scale - scales smoothly across viewports */\n --account-history-text-2xs: clamp(0.625rem, 0.5vw + 0.5rem, 0.6875rem); /* 10px → 11px */\n --account-history-text-xs: clamp(0.6875rem, 0.5vw + 0.625rem, 0.8125rem); /* 11px → 13px */\n --account-history-text-sm: clamp(0.75rem, 0.5vw + 0.6875rem, 0.875rem); /* 12px → 14px */\n --account-history-text-base: clamp(0.8125rem, 0.5vw + 0.75rem, 0.9375rem); /* 13px → 15px */\n --account-history-text-md: clamp(0.875rem, 0.5vw + 0.8125rem, 1rem); /* 14px → 16px */\n --account-history-text-lg: clamp(1rem, 1vw + 0.875rem, 1.125rem); /* 16px → 18px */\n --account-history-text-xl: clamp(1.125rem, 1.5vw + 0.9375rem, 1.25rem); /* 18px → 20px */\n --account-history-text-2xl: clamp(1.25rem, 2vw + 1rem, 1.375rem); /* 20px → 22px */\n\n /* Icon sizes */\n --account-history-icon-xs: 0.875rem; /* 14px */\n --account-history-icon-sm: 1rem; /* 16px */\n --account-history-icon-md: 1.125rem; /* 18px */\n --account-history-icon-lg: 1.25rem; /* 20px */\n --account-history-icon-xl: 1.5rem; /* 24px */\n --account-history-icon-2xl: 1.75rem; /* 28px */\n\n /* Button/touch target sizes */\n --account-history-touch-sm: 1.75rem; /* 28px */\n --account-history-touch-md: 2rem; /* 32px */\n --account-history-touch-lg: 2.75rem; /* 44px - WCAG minimum touch target */\n\n /* Transition timing */\n --account-history-transition-fast: 0.15s;\n --account-history-transition-base: 0.2s;\n --easing: ease;\n\n /* Z-index scale */\n --account-history-z-sticky-date: 5;\n --account-history-z-sticky-header: 10;\n}\n}\n\n\n/* History Recorder (toolbar button) */\n.account-history-toolbar-button {\n padding: 0.5rem;\n cursor: pointer;\n background: transparent;\n border: none;\n display: flex;\n align-items: center;\n justify-content: center;\n color: var(--account-history-text);\n transition: opacity 0.2s ease;\n}\n\n.account-history-toolbar-button:hover {\n opacity: 0.7;\n}\n\n/* History Viewer */\n.account-history-viewer {\n padding: var(--account-history-space-md);\n width: 100%;\n height: 100%;\n margin: 0 auto;\n font-family: var(--account-history-family);\n color: var(--account-history-text);\n background: var(--account-history-bg);\n display: flex;\n flex-direction: column;\n overflow: hidden;\n box-sizing: border-box;\n}\n\n.account-history-header {\n display: flex;\n justify-content: space-between;\n align-items: center;\n margin-bottom: var(--account-history-space-md);\n padding-bottom: var(--account-history-space-md);\n border-bottom: 1px solid var(--account-history-border);\n flex-shrink: 0;\n gap: var(--account-history-space-md);\n flex-wrap: wrap;\n background: var(--account-history-bg);\n position: sticky;\n top: 0;\n z-index: var(--account-history-z-sticky-header);\n margin-left: calc(-1 * var(--account-history-space-md));\n margin-right: calc(-1 * var(--account-history-space-md));\n margin-top: calc(-1 * var(--account-history-space-md));\n padding-left: var(--account-history-space-md);\n padding-right: var(--account-history-space-md);\n padding-top: var(--account-history-space-md);\n}\n\n.account-history-header-controls {\n display: flex;\n gap: var(--account-history-space-xs);\n align-items: center;\n}\n\n.account-history-group-label {\n font-size: var(--account-history-text-base);\n color: var(--account-history-text-secondary);\n font-weight: 500;\n}\n\n.account-history-search {\n position: relative;\n width: 100%;\n display: flex;\n align-items: center;\n}\n\n.account-history-search-icon {\n position: absolute;\n left: var(--account-history-space-sm);\n width: var(--account-history-icon-md);\n height: var(--account-history-icon-md);\n color: var(--account-history-text-tertiary);\n pointer-events: none;\n}\n\n.account-history-search-input {\n width: 100%;\n padding: var(--account-history-space-xs) var(--account-history-space-sm) var(--account-history-space-xs) 2.375rem;\n border: 1px solid var(--account-history-border);\n border-radius: var(--account-history-radius);\n background: var(--account-history-bg);\n color: var(--account-history-text);\n font-size: var(--account-history-text-md);\n font-family: inherit;\n transition: border-color var(--account-history-transition-fast) var(--easing);\n}\n\n.account-history-search-input::placeholder {\n color: var(--account-history-text-tertiary);\n}\n\n.account-history-search-input:focus {\n outline: none;\n border-color: var(--account-history-primary);\n}\n\n.account-history-sort-label {\n font-size: var(--account-history-text-base);\n color: var(--account-history-text-secondary);\n font-weight: 500;\n margin-left: var(--account-history-space-md);\n}\n\n.account-history-sort-button {\n padding: 0.375rem var(--account-history-space-sm);\n border-radius: var(--account-history-radius);\n border: 1px solid var(--account-history-border);\n background: var(--account-history-bg);\n cursor: pointer;\n font-size: var(--account-history-text-base);\n color: var(--account-history-text);\n transition: background-color var(--account-history-transition-fast) var(--easing);\n font-weight: 500;\n}\n\n.account-history-sort-button:hover {\n background: var(--account-history-hover);\n}\n\n.account-history-sort-button.active {\n background: var(--account-history-primary);\n color: var(--account-history-primary-line);\n border-color: var(--account-history-primary);\n}\n\n.account-history-title {\n margin: 0;\n font-size: var(--account-history-text-2xl);\n font-weight: 600;\n color: var(--account-history-text);\n}\n\n.account-history-toggle-button {\n padding: var(--account-history-space-xs) var(--account-history-space-md);\n border-radius: var(--account-history-radius);\n border: 1px solid var(--account-history-border);\n background: var(--account-history-bg);\n cursor: pointer;\n font-size: var(--account-history-text-base);\n color: var(--account-history-text);\n transition: background-color var(--account-history-transition-fast) var(--easing);\n font-weight: 500;\n}\n\n.account-history-toggle-button:hover {\n background: var(--account-history-hover);\n}\n\n.account-history-toggle-button.active {\n background: var(--account-history-primary);\n color: var(--account-history-primary-line);\n border-color: var(--account-history-primary);\n}\n\n/* Scrollable Content Area */\n.account-history-content {\n flex: 1;\n overflow-y: auto;\n overflow-x: hidden;\n min-height: 0;\n}\n\n/* History Groups - Flat Design */\n\n.account-history-group-header {\n margin-bottom: var(--account-history-space-xs);\n padding: var(--account-history-space-xs) 0;\n}\n\n/* Sticky date headers in date grouping mode */\n.account-history-group-header:not(.account-history-group-header-clickable) {\n position: sticky;\n top: 0;\n background: var(--account-history-bg);\n z-index: var(--account-history-z-sticky-date);\n padding-top: var(--account-history-space-sm);\n margin-top: calc(-1 * var(--account-history-space-2xs));\n}\n\n.account-history-group-header-clickable {\n display: flex;\n justify-content: space-between;\n align-items: center;\n cursor: pointer;\n transition: background-color var(--account-history-transition-fast) var(--easing);\n border-radius: var(--account-history-radius);\n padding: var(--account-history-space-xs) var(--account-history-space-sm);\n}\n\n.account-history-group-header-clickable:hover {\n background: var(--account-history-hover);\n}\n\n.account-history-group-header-content {\n flex: 1;\n min-width: 0;\n}\n\n.account-history-group-toggle {\n width: var(--account-history-touch-sm);\n height: var(--account-history-touch-sm);\n min-width: var(--account-history-touch-sm);\n border: 1px solid var(--account-history-border);\n background: var(--account-history-bg);\n cursor: pointer;\n border-radius: var(--account-history-radius);\n display: flex;\n align-items: center;\n justify-content: center;\n color: var(--account-history-text-secondary);\n font-size: var(--account-history-text-xl);\n font-weight: 300;\n transition: all var(--account-history-transition-fast) var(--easing);\n padding: 0;\n line-height: 1;\n}\n\n.account-history-group-toggle:hover {\n background: var(--account-history-primary);\n color: var(--account-history-primary-line);\n border-color: var(--account-history-primary);\n}\n\n.account-history-group-title {\n font-size: var(--account-history-text-base);\n font-weight: 600;\n margin: 0;\n color: var(--account-history-text-secondary);\n}\n\n.account-history-group-meta {\n font-size: var(--account-history-text-sm);\n color: var(--account-history-text-tertiary);\n margin: var(--account-history-space-2xs) 0 0 0;\n}\n\n.account-history-entries {\n display: flex;\n flex-direction: column;\n margin-bottom: 1rem;\n}\n\n/* History Entry - Flat List Design */\n.account-history-entry {\n display: grid;\n /* TODO: icon */\n /* grid-template-columns: auto 28px 1fr 32px; */\n grid-template-columns: auto 1fr var(--account-history-touch-md);\n gap: var(--account-history-space-sm);\n align-items: center;\n padding: var(--account-history-space-xs) var(--account-history-space-sm);\n border-bottom: 1px solid var(--account-history-border);\n background: var(--account-history-bg);\n transition: background-color var(--account-history-transition-fast) var(--easing);\n min-height: var(--account-history-touch-lg);\n}\n\n.account-history-entry:hover {\n background: var(--account-history-hover);\n}\n\n/* Time Column */\n.account-history-entry-time {\n font-size: var(--account-history-text-sm);\n color: var(--account-history-text-secondary);\n white-space: nowrap;\n font-variant-numeric: tabular-nums;\n}\n\n/* Content Column - Clickable */\n.account-history-entry-content {\n display: flex;\n flex-direction: row;\n align-items: baseline;\n gap: var(--account-history-space-xs);\n min-width: 0;\n cursor: pointer;\n}\n\n.account-history-entry-title {\n font-size: var(--account-history-text-base);\n font-weight: 500;\n color: var(--account-history-text);\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n\n.account-history-entry-content:hover .account-history-entry-title {\n color: var(--account-history-primary);\n}\n\n.account-history-entry-tool {\n font-size: var(--account-history-text-base);\n color: var(--account-history-text-secondary);\n white-space: nowrap;\n flex-shrink: 0;\n}\n\n/* URL - Secondary Appearance (inline with title/tool) */\n.account-history-entry-url {\n font-size: var(--account-history-text-xs);\n color: var(--account-history-text-tertiary);\n opacity: 0.6;\n font-family: var(--account-history-family-code);\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n flex-shrink: 1;\n min-width: 0;\n}\n\n/* Actions Column */\n.account-history-entry-actions {\n display: flex;\n align-items: center;\n justify-content: center;\n}\n\n.account-history-entry-delete {\n width: var(--account-history-icon-xl);\n height: var(--account-history-icon-xl);\n border: none;\n background: transparent;\n cursor: pointer;\n border-radius: var(--account-history-radius);\n display: flex;\n align-items: center;\n justify-content: center;\n color: var(--account-history-text-tertiary);\n transition: all var(--account-history-transition-fast) var(--easing);\n padding: 0;\n opacity: 0;\n}\n\n.account-history-entry:hover .account-history-entry-delete {\n opacity: 1;\n}\n\n.account-history-entry-delete:hover {\n background: var(--account-history-danger-bg);\n color: var(--account-history-danger);\n}\n\n.account-history-entry-delete svg {\n width: var(--account-history-icon-sm);\n height: var(--account-history-icon-sm);\n}\n\n/* Empty State */\n.account-history-empty {\n padding: var(--account-history-space-2xl) var(--account-history-space-lg);\n text-align: center;\n color: var(--account-history-text-tertiary);\n font-size: var(--account-history-text-md);\n}\n\n/* Responsive Design */\n\n/* Mobile (<640px) */\n@media (max-width: 640px) {\n .account-history-header {\n flex-direction: column;\n align-items: flex-start;\n }\n\n .account-history-header-controls {\n width: 100%;\n flex-wrap: wrap;\n }\n\n .account-history-toggle-button {\n flex: 1;\n }\n\n .account-history-sort-label {\n margin-left: 0;\n margin-top: var(--account-history-space-xs);\n width: 100%;\n }\n\n .account-history-sort-button {\n flex: 1;\n }\n\n .account-history-group {\n margin-bottom: var(--account-history-space-lg);\n }\n\n .account-history-entry {\n grid-template-columns: 1fr var(--account-history-touch-sm);\n grid-template-rows: auto auto;\n gap: var(--account-history-space-2xs) var(--account-history-space-xs);\n min-height: auto;\n }\n\n .account-history-entry-time {\n grid-column: 1 / 2;\n grid-row: 1 / 2;\n }\n\n .account-history-entry-content {\n grid-column: 1 / 2;\n grid-row: 2 / 3;\n }\n\n .account-history-entry-url {\n display: none;\n }\n\n .account-history-entry-actions {\n grid-column: 2 / 3;\n grid-row: 1 / 3;\n }\n\n .account-history-entry-delete {\n opacity: 1;\n }\n\n}"));
7
+ document.head.appendChild(elementStyle);
8
+ }
9
+ } catch (e) {
10
+ console.error("vite-plugin-css-injected-by-js", e);
11
+ }
12
+ })();
13
+ const IS_DEV = false;
14
+ const equalFn = (a, b) => a === b;
15
+ const $PROXY = /* @__PURE__ */ Symbol("solid-proxy");
16
+ const $TRACK = /* @__PURE__ */ Symbol("solid-track");
17
+ const signalOptions = {
18
+ equals: equalFn
19
+ };
20
+ let runEffects = runQueue;
21
+ const STALE = 1;
22
+ const PENDING = 2;
23
+ const UNOWNED = {
24
+ owned: null,
25
+ cleanups: null,
26
+ context: null,
27
+ owner: null
28
+ };
29
+ var Owner = null;
30
+ let Transition = null;
31
+ let ExternalSourceConfig = null;
32
+ let Listener = null;
33
+ let Updates = null;
34
+ let Effects = null;
35
+ let ExecCount = 0;
36
+ function createRoot(fn, detachedOwner) {
37
+ const listener = Listener, owner = Owner, unowned = fn.length === 0, current = detachedOwner === void 0 ? owner : detachedOwner, root = unowned ? UNOWNED : {
38
+ owned: null,
39
+ cleanups: null,
40
+ context: current ? current.context : null,
41
+ owner: current
42
+ }, updateFn = unowned ? fn : () => fn(() => untrack(() => cleanNode(root)));
43
+ Owner = root;
44
+ Listener = null;
45
+ try {
46
+ return runUpdates(updateFn, true);
47
+ } finally {
48
+ Listener = listener;
49
+ Owner = owner;
50
+ }
51
+ }
52
+ function createSignal(value, options) {
53
+ options = options ? Object.assign({}, signalOptions, options) : signalOptions;
54
+ const s = {
55
+ value,
56
+ observers: null,
57
+ observerSlots: null,
58
+ comparator: options.equals || void 0
59
+ };
60
+ const setter = (value2) => {
61
+ if (typeof value2 === "function") {
62
+ value2 = value2(s.value);
63
+ }
64
+ return writeSignal(s, value2);
65
+ };
66
+ return [readSignal.bind(s), setter];
67
+ }
68
+ function createRenderEffect(fn, value, options) {
69
+ const c = createComputation(fn, value, false, STALE);
70
+ updateComputation(c);
71
+ }
72
+ function createEffect(fn, value, options) {
73
+ runEffects = runUserEffects;
74
+ const c = createComputation(fn, value, false, STALE);
75
+ c.user = true;
76
+ Effects ? Effects.push(c) : updateComputation(c);
77
+ }
78
+ function createMemo(fn, value, options) {
79
+ options = options ? Object.assign({}, signalOptions, options) : signalOptions;
80
+ const c = createComputation(fn, value, true, 0);
81
+ c.observers = null;
82
+ c.observerSlots = null;
83
+ c.comparator = options.equals || void 0;
84
+ updateComputation(c);
85
+ return readSignal.bind(c);
86
+ }
87
+ function batch(fn) {
88
+ return runUpdates(fn, false);
89
+ }
90
+ function untrack(fn) {
91
+ if (Listener === null) return fn();
92
+ const listener = Listener;
93
+ Listener = null;
94
+ try {
95
+ if (ExternalSourceConfig) ;
96
+ return fn();
97
+ } finally {
98
+ Listener = listener;
99
+ }
100
+ }
101
+ function onMount(fn) {
102
+ createEffect(() => untrack(fn));
103
+ }
104
+ function onCleanup(fn) {
105
+ if (Owner === null) ;
106
+ else if (Owner.cleanups === null) Owner.cleanups = [fn];
107
+ else Owner.cleanups.push(fn);
108
+ return fn;
109
+ }
110
+ function getListener() {
111
+ return Listener;
112
+ }
113
+ function getOwner() {
114
+ return Owner;
115
+ }
116
+ function readSignal() {
117
+ if (this.sources && this.state) {
118
+ if (this.state === STALE) updateComputation(this);
119
+ else {
120
+ const updates = Updates;
121
+ Updates = null;
122
+ runUpdates(() => lookUpstream(this), false);
123
+ Updates = updates;
124
+ }
125
+ }
126
+ if (Listener) {
127
+ const observers = this.observers;
128
+ if (!observers || observers[observers.length - 1] !== Listener) {
129
+ const sSlot = observers ? observers.length : 0;
130
+ if (!Listener.sources) {
131
+ Listener.sources = [this];
132
+ Listener.sourceSlots = [sSlot];
133
+ } else {
134
+ Listener.sources.push(this);
135
+ Listener.sourceSlots.push(sSlot);
136
+ }
137
+ if (!observers) {
138
+ this.observers = [Listener];
139
+ this.observerSlots = [Listener.sources.length - 1];
140
+ } else {
141
+ observers.push(Listener);
142
+ this.observerSlots.push(Listener.sources.length - 1);
143
+ }
144
+ }
145
+ }
146
+ return this.value;
147
+ }
148
+ function writeSignal(node, value, isComp) {
149
+ let current = node.value;
150
+ if (!node.comparator || !node.comparator(current, value)) {
151
+ node.value = value;
152
+ if (node.observers && node.observers.length) {
153
+ runUpdates(() => {
154
+ for (let i = 0; i < node.observers.length; i += 1) {
155
+ const o = node.observers[i];
156
+ const TransitionRunning = Transition && Transition.running;
157
+ if (TransitionRunning && Transition.disposed.has(o)) ;
158
+ if (TransitionRunning ? !o.tState : !o.state) {
159
+ if (o.pure) Updates.push(o);
160
+ else Effects.push(o);
161
+ if (o.observers) markDownstream(o);
162
+ }
163
+ if (!TransitionRunning) o.state = STALE;
164
+ }
165
+ if (Updates.length > 1e6) {
166
+ Updates = [];
167
+ if (IS_DEV) ;
168
+ throw new Error();
169
+ }
170
+ }, false);
171
+ }
172
+ }
173
+ return value;
174
+ }
175
+ function updateComputation(node) {
176
+ if (!node.fn) return;
177
+ cleanNode(node);
178
+ const time = ExecCount;
179
+ runComputation(node, node.value, time);
180
+ }
181
+ function runComputation(node, value, time) {
182
+ let nextValue;
183
+ const owner = Owner, listener = Listener;
184
+ Listener = Owner = node;
185
+ try {
186
+ nextValue = node.fn(value);
187
+ } catch (err) {
188
+ if (node.pure) {
189
+ {
190
+ node.state = STALE;
191
+ node.owned && node.owned.forEach(cleanNode);
192
+ node.owned = null;
193
+ }
194
+ }
195
+ node.updatedAt = time + 1;
196
+ return handleError(err);
197
+ } finally {
198
+ Listener = listener;
199
+ Owner = owner;
200
+ }
201
+ if (!node.updatedAt || node.updatedAt <= time) {
202
+ if (node.updatedAt != null && "observers" in node) {
203
+ writeSignal(node, nextValue);
204
+ } else node.value = nextValue;
205
+ node.updatedAt = time;
206
+ }
207
+ }
208
+ function createComputation(fn, init, pure, state = STALE, options) {
209
+ const c = {
210
+ fn,
211
+ state,
212
+ updatedAt: null,
213
+ owned: null,
214
+ sources: null,
215
+ sourceSlots: null,
216
+ cleanups: null,
217
+ value: init,
218
+ owner: Owner,
219
+ context: Owner ? Owner.context : null,
220
+ pure
221
+ };
222
+ if (Owner === null) ;
223
+ else if (Owner !== UNOWNED) {
224
+ {
225
+ if (!Owner.owned) Owner.owned = [c];
226
+ else Owner.owned.push(c);
227
+ }
228
+ }
229
+ return c;
230
+ }
231
+ function runTop(node) {
232
+ if (node.state === 0) return;
233
+ if (node.state === PENDING) return lookUpstream(node);
234
+ if (node.suspense && untrack(node.suspense.inFallback)) return node.suspense.effects.push(node);
235
+ const ancestors = [node];
236
+ while ((node = node.owner) && (!node.updatedAt || node.updatedAt < ExecCount)) {
237
+ if (node.state) ancestors.push(node);
238
+ }
239
+ for (let i = ancestors.length - 1; i >= 0; i--) {
240
+ node = ancestors[i];
241
+ if (node.state === STALE) {
242
+ updateComputation(node);
243
+ } else if (node.state === PENDING) {
244
+ const updates = Updates;
245
+ Updates = null;
246
+ runUpdates(() => lookUpstream(node, ancestors[0]), false);
247
+ Updates = updates;
248
+ }
249
+ }
250
+ }
251
+ function runUpdates(fn, init) {
252
+ if (Updates) return fn();
253
+ let wait = false;
254
+ if (!init) Updates = [];
255
+ if (Effects) wait = true;
256
+ else Effects = [];
257
+ ExecCount++;
258
+ try {
259
+ const res = fn();
260
+ completeUpdates(wait);
261
+ return res;
262
+ } catch (err) {
263
+ if (!wait) Effects = null;
264
+ Updates = null;
265
+ handleError(err);
266
+ }
267
+ }
268
+ function completeUpdates(wait) {
269
+ if (Updates) {
270
+ runQueue(Updates);
271
+ Updates = null;
272
+ }
273
+ if (wait) return;
274
+ const e = Effects;
275
+ Effects = null;
276
+ if (e.length) runUpdates(() => runEffects(e), false);
277
+ }
278
+ function runQueue(queue) {
279
+ for (let i = 0; i < queue.length; i++) runTop(queue[i]);
280
+ }
281
+ function runUserEffects(queue) {
282
+ let i, userLength = 0;
283
+ for (i = 0; i < queue.length; i++) {
284
+ const e = queue[i];
285
+ if (!e.user) runTop(e);
286
+ else queue[userLength++] = e;
287
+ }
288
+ for (i = 0; i < userLength; i++) runTop(queue[i]);
289
+ }
290
+ function lookUpstream(node, ignore) {
291
+ node.state = 0;
292
+ for (let i = 0; i < node.sources.length; i += 1) {
293
+ const source = node.sources[i];
294
+ if (source.sources) {
295
+ const state = source.state;
296
+ if (state === STALE) {
297
+ if (source !== ignore && (!source.updatedAt || source.updatedAt < ExecCount)) runTop(source);
298
+ } else if (state === PENDING) lookUpstream(source, ignore);
299
+ }
300
+ }
301
+ }
302
+ function markDownstream(node) {
303
+ for (let i = 0; i < node.observers.length; i += 1) {
304
+ const o = node.observers[i];
305
+ if (!o.state) {
306
+ o.state = PENDING;
307
+ if (o.pure) Updates.push(o);
308
+ else Effects.push(o);
309
+ o.observers && markDownstream(o);
310
+ }
311
+ }
312
+ }
313
+ function cleanNode(node) {
314
+ let i;
315
+ if (node.sources) {
316
+ while (node.sources.length) {
317
+ const source = node.sources.pop(), index = node.sourceSlots.pop(), obs = source.observers;
318
+ if (obs && obs.length) {
319
+ const n = obs.pop(), s = source.observerSlots.pop();
320
+ if (index < obs.length) {
321
+ n.sourceSlots[s] = index;
322
+ obs[index] = n;
323
+ source.observerSlots[index] = s;
324
+ }
325
+ }
326
+ }
327
+ }
328
+ if (node.tOwned) {
329
+ for (i = node.tOwned.length - 1; i >= 0; i--) cleanNode(node.tOwned[i]);
330
+ delete node.tOwned;
331
+ }
332
+ if (node.owned) {
333
+ for (i = node.owned.length - 1; i >= 0; i--) cleanNode(node.owned[i]);
334
+ node.owned = null;
335
+ }
336
+ if (node.cleanups) {
337
+ for (i = node.cleanups.length - 1; i >= 0; i--) node.cleanups[i]();
338
+ node.cleanups = null;
339
+ }
340
+ node.state = 0;
341
+ }
342
+ function castError(err) {
343
+ if (err instanceof Error) return err;
344
+ return new Error(typeof err === "string" ? err : "Unknown error", {
345
+ cause: err
346
+ });
347
+ }
348
+ function handleError(err, owner = Owner) {
349
+ const error = castError(err);
350
+ throw error;
351
+ }
352
+ const FALLBACK = /* @__PURE__ */ Symbol("fallback");
353
+ function dispose(d) {
354
+ for (let i = 0; i < d.length; i++) d[i]();
355
+ }
356
+ function mapArray(list, mapFn, options = {}) {
357
+ let items = [], mapped = [], disposers = [], len = 0, indexes = mapFn.length > 1 ? [] : null;
358
+ onCleanup(() => dispose(disposers));
359
+ return () => {
360
+ let newItems = list() || [], newLen = newItems.length, i, j;
361
+ newItems[$TRACK];
362
+ return untrack(() => {
363
+ let newIndices, newIndicesNext, temp, tempdisposers, tempIndexes, start, end, newEnd, item;
364
+ if (newLen === 0) {
365
+ if (len !== 0) {
366
+ dispose(disposers);
367
+ disposers = [];
368
+ items = [];
369
+ mapped = [];
370
+ len = 0;
371
+ indexes && (indexes = []);
372
+ }
373
+ if (options.fallback) {
374
+ items = [FALLBACK];
375
+ mapped[0] = createRoot((disposer) => {
376
+ disposers[0] = disposer;
377
+ return options.fallback();
378
+ });
379
+ len = 1;
380
+ }
381
+ } else if (len === 0) {
382
+ mapped = new Array(newLen);
383
+ for (j = 0; j < newLen; j++) {
384
+ items[j] = newItems[j];
385
+ mapped[j] = createRoot(mapper);
386
+ }
387
+ len = newLen;
388
+ } else {
389
+ temp = new Array(newLen);
390
+ tempdisposers = new Array(newLen);
391
+ indexes && (tempIndexes = new Array(newLen));
392
+ for (start = 0, end = Math.min(len, newLen); start < end && items[start] === newItems[start]; start++) ;
393
+ for (end = len - 1, newEnd = newLen - 1; end >= start && newEnd >= start && items[end] === newItems[newEnd]; end--, newEnd--) {
394
+ temp[newEnd] = mapped[end];
395
+ tempdisposers[newEnd] = disposers[end];
396
+ indexes && (tempIndexes[newEnd] = indexes[end]);
397
+ }
398
+ newIndices = /* @__PURE__ */ new Map();
399
+ newIndicesNext = new Array(newEnd + 1);
400
+ for (j = newEnd; j >= start; j--) {
401
+ item = newItems[j];
402
+ i = newIndices.get(item);
403
+ newIndicesNext[j] = i === void 0 ? -1 : i;
404
+ newIndices.set(item, j);
405
+ }
406
+ for (i = start; i <= end; i++) {
407
+ item = items[i];
408
+ j = newIndices.get(item);
409
+ if (j !== void 0 && j !== -1) {
410
+ temp[j] = mapped[i];
411
+ tempdisposers[j] = disposers[i];
412
+ indexes && (tempIndexes[j] = indexes[i]);
413
+ j = newIndicesNext[j];
414
+ newIndices.set(item, j);
415
+ } else disposers[i]();
416
+ }
417
+ for (j = start; j < newLen; j++) {
418
+ if (j in temp) {
419
+ mapped[j] = temp[j];
420
+ disposers[j] = tempdisposers[j];
421
+ if (indexes) {
422
+ indexes[j] = tempIndexes[j];
423
+ indexes[j](j);
424
+ }
425
+ } else mapped[j] = createRoot(mapper);
426
+ }
427
+ mapped = mapped.slice(0, len = newLen);
428
+ items = newItems.slice(0);
429
+ }
430
+ return mapped;
431
+ });
432
+ function mapper(disposer) {
433
+ disposers[j] = disposer;
434
+ if (indexes) {
435
+ const [s, set] = createSignal(j);
436
+ indexes[j] = set;
437
+ return mapFn(newItems[j], s);
438
+ }
439
+ return mapFn(newItems[j]);
440
+ }
441
+ };
442
+ }
443
+ function createComponent(Comp, props) {
444
+ return untrack(() => Comp(props || {}));
445
+ }
446
+ const narrowedError = (name) => `Stale read from <${name}>.`;
447
+ function For(props) {
448
+ const fallback = "fallback" in props && {
449
+ fallback: () => props.fallback
450
+ };
451
+ return createMemo(mapArray(() => props.each, props.children, fallback || void 0));
452
+ }
453
+ function Show(props) {
454
+ const keyed = props.keyed;
455
+ const conditionValue = createMemo(() => props.when, void 0, void 0);
456
+ const condition = keyed ? conditionValue : createMemo(conditionValue, void 0, {
457
+ equals: (a, b) => !a === !b
458
+ });
459
+ return createMemo(() => {
460
+ const c = condition();
461
+ if (c) {
462
+ const child = props.children;
463
+ const fn = typeof child === "function" && child.length > 0;
464
+ return fn ? untrack(() => child(keyed ? c : () => {
465
+ if (!untrack(condition)) throw narrowedError("Show");
466
+ return conditionValue();
467
+ })) : child;
468
+ }
469
+ return props.fallback;
470
+ }, void 0, void 0);
471
+ }
472
+ const memo = (fn) => createMemo(() => fn());
473
+ function reconcileArrays(parentNode, a, b) {
474
+ let bLength = b.length, aEnd = a.length, bEnd = bLength, aStart = 0, bStart = 0, after = a[aEnd - 1].nextSibling, map = null;
475
+ while (aStart < aEnd || bStart < bEnd) {
476
+ if (a[aStart] === b[bStart]) {
477
+ aStart++;
478
+ bStart++;
479
+ continue;
480
+ }
481
+ while (a[aEnd - 1] === b[bEnd - 1]) {
482
+ aEnd--;
483
+ bEnd--;
484
+ }
485
+ if (aEnd === aStart) {
486
+ const node = bEnd < bLength ? bStart ? b[bStart - 1].nextSibling : b[bEnd - bStart] : after;
487
+ while (bStart < bEnd) parentNode.insertBefore(b[bStart++], node);
488
+ } else if (bEnd === bStart) {
489
+ while (aStart < aEnd) {
490
+ if (!map || !map.has(a[aStart])) a[aStart].remove();
491
+ aStart++;
492
+ }
493
+ } else if (a[aStart] === b[bEnd - 1] && b[bStart] === a[aEnd - 1]) {
494
+ const node = a[--aEnd].nextSibling;
495
+ parentNode.insertBefore(b[bStart++], a[aStart++].nextSibling);
496
+ parentNode.insertBefore(b[--bEnd], node);
497
+ a[aEnd] = b[bEnd];
498
+ } else {
499
+ if (!map) {
500
+ map = /* @__PURE__ */ new Map();
501
+ let i = bStart;
502
+ while (i < bEnd) map.set(b[i], i++);
503
+ }
504
+ const index = map.get(a[aStart]);
505
+ if (index != null) {
506
+ if (bStart < index && index < bEnd) {
507
+ let i = aStart, sequence = 1, t;
508
+ while (++i < aEnd && i < bEnd) {
509
+ if ((t = map.get(a[i])) == null || t !== index + sequence) break;
510
+ sequence++;
511
+ }
512
+ if (sequence > index - bStart) {
513
+ const node = a[aStart];
514
+ while (bStart < index) parentNode.insertBefore(b[bStart++], node);
515
+ } else parentNode.replaceChild(b[bStart++], a[aStart++]);
516
+ } else aStart++;
517
+ } else a[aStart++].remove();
518
+ }
519
+ }
520
+ }
521
+ const $$EVENTS = "_$DX_DELEGATE";
522
+ function render(code, element, init, options = {}) {
523
+ let disposer;
524
+ createRoot((dispose2) => {
525
+ disposer = dispose2;
526
+ element === document ? code() : insert(element, code(), element.firstChild ? null : void 0, init);
527
+ }, options.owner);
528
+ return () => {
529
+ disposer();
530
+ element.textContent = "";
531
+ };
532
+ }
533
+ function template(html, isImportNode, isSVG, isMathML) {
534
+ let node;
535
+ const create = () => {
536
+ const t = isMathML ? document.createElementNS("http://www.w3.org/1998/Math/MathML", "template") : document.createElement("template");
537
+ t.innerHTML = html;
538
+ return isSVG ? t.content.firstChild.firstChild : isMathML ? t.firstChild : t.content.firstChild;
539
+ };
540
+ const fn = isImportNode ? () => untrack(() => document.importNode(node || (node = create()), true)) : () => (node || (node = create())).cloneNode(true);
541
+ fn.cloneNode = fn;
542
+ return fn;
543
+ }
544
+ function delegateEvents(eventNames, document2 = window.document) {
545
+ const e = document2[$$EVENTS] || (document2[$$EVENTS] = /* @__PURE__ */ new Set());
546
+ for (let i = 0, l = eventNames.length; i < l; i++) {
547
+ const name = eventNames[i];
548
+ if (!e.has(name)) {
549
+ e.add(name);
550
+ document2.addEventListener(name, eventHandler);
551
+ }
552
+ }
553
+ }
554
+ function setAttribute(node, name, value) {
555
+ if (value == null) node.removeAttribute(name);
556
+ else node.setAttribute(name, value);
557
+ }
558
+ function className(node, value) {
559
+ if (value == null) node.removeAttribute("class");
560
+ else node.className = value;
561
+ }
562
+ function insert(parent, accessor, marker, initial) {
563
+ if (marker !== void 0 && !initial) initial = [];
564
+ if (typeof accessor !== "function") return insertExpression(parent, accessor, initial, marker);
565
+ createRenderEffect((current) => insertExpression(parent, accessor(), current, marker), initial);
566
+ }
567
+ function eventHandler(e) {
568
+ let node = e.target;
569
+ const key = `$$${e.type}`;
570
+ const oriTarget = e.target;
571
+ const oriCurrentTarget = e.currentTarget;
572
+ const retarget = (value) => Object.defineProperty(e, "target", {
573
+ configurable: true,
574
+ value
575
+ });
576
+ const handleNode = () => {
577
+ const handler = node[key];
578
+ if (handler && !node.disabled) {
579
+ const data = node[`${key}Data`];
580
+ data !== void 0 ? handler.call(node, data, e) : handler.call(node, e);
581
+ if (e.cancelBubble) return;
582
+ }
583
+ node.host && typeof node.host !== "string" && !node.host._$host && node.contains(e.target) && retarget(node.host);
584
+ return true;
585
+ };
586
+ const walkUpTree = () => {
587
+ while (handleNode() && (node = node._$host || node.parentNode || node.host)) ;
588
+ };
589
+ Object.defineProperty(e, "currentTarget", {
590
+ configurable: true,
591
+ get() {
592
+ return node || document;
593
+ }
594
+ });
595
+ if (e.composedPath) {
596
+ const path = e.composedPath();
597
+ retarget(path[0]);
598
+ for (let i = 0; i < path.length - 2; i++) {
599
+ node = path[i];
600
+ if (!handleNode()) break;
601
+ if (node._$host) {
602
+ node = node._$host;
603
+ walkUpTree();
604
+ break;
605
+ }
606
+ if (node.parentNode === oriCurrentTarget) {
607
+ break;
608
+ }
609
+ }
610
+ } else walkUpTree();
611
+ retarget(oriTarget);
612
+ }
613
+ function insertExpression(parent, value, current, marker, unwrapArray) {
614
+ while (typeof current === "function") current = current();
615
+ if (value === current) return current;
616
+ const t = typeof value, multi = marker !== void 0;
617
+ parent = multi && current[0] && current[0].parentNode || parent;
618
+ if (t === "string" || t === "number") {
619
+ if (t === "number") {
620
+ value = value.toString();
621
+ if (value === current) return current;
622
+ }
623
+ if (multi) {
624
+ let node = current[0];
625
+ if (node && node.nodeType === 3) {
626
+ node.data !== value && (node.data = value);
627
+ } else node = document.createTextNode(value);
628
+ current = cleanChildren(parent, current, marker, node);
629
+ } else {
630
+ if (current !== "" && typeof current === "string") {
631
+ current = parent.firstChild.data = value;
632
+ } else current = parent.textContent = value;
633
+ }
634
+ } else if (value == null || t === "boolean") {
635
+ current = cleanChildren(parent, current, marker);
636
+ } else if (t === "function") {
637
+ createRenderEffect(() => {
638
+ let v = value();
639
+ while (typeof v === "function") v = v();
640
+ current = insertExpression(parent, v, current, marker);
641
+ });
642
+ return () => current;
643
+ } else if (Array.isArray(value)) {
644
+ const array = [];
645
+ const currentArray = current && Array.isArray(current);
646
+ if (normalizeIncomingArray(array, value, current, unwrapArray)) {
647
+ createRenderEffect(() => current = insertExpression(parent, array, current, marker, true));
648
+ return () => current;
649
+ }
650
+ if (array.length === 0) {
651
+ current = cleanChildren(parent, current, marker);
652
+ if (multi) return current;
653
+ } else if (currentArray) {
654
+ if (current.length === 0) {
655
+ appendNodes(parent, array, marker);
656
+ } else reconcileArrays(parent, current, array);
657
+ } else {
658
+ current && cleanChildren(parent);
659
+ appendNodes(parent, array);
660
+ }
661
+ current = array;
662
+ } else if (value.nodeType) {
663
+ if (Array.isArray(current)) {
664
+ if (multi) return current = cleanChildren(parent, current, marker, value);
665
+ cleanChildren(parent, current, null, value);
666
+ } else if (current == null || current === "" || !parent.firstChild) {
667
+ parent.appendChild(value);
668
+ } else parent.replaceChild(value, parent.firstChild);
669
+ current = value;
670
+ } else ;
671
+ return current;
672
+ }
673
+ function normalizeIncomingArray(normalized, array, current, unwrap2) {
674
+ let dynamic = false;
675
+ for (let i = 0, len = array.length; i < len; i++) {
676
+ let item = array[i], prev = current && current[normalized.length], t;
677
+ if (item == null || item === true || item === false) ;
678
+ else if ((t = typeof item) === "object" && item.nodeType) {
679
+ normalized.push(item);
680
+ } else if (Array.isArray(item)) {
681
+ dynamic = normalizeIncomingArray(normalized, item, prev) || dynamic;
682
+ } else if (t === "function") {
683
+ if (unwrap2) {
684
+ while (typeof item === "function") item = item();
685
+ dynamic = normalizeIncomingArray(normalized, Array.isArray(item) ? item : [item], Array.isArray(prev) ? prev : [prev]) || dynamic;
686
+ } else {
687
+ normalized.push(item);
688
+ dynamic = true;
689
+ }
690
+ } else {
691
+ const value = String(item);
692
+ if (prev && prev.nodeType === 3 && prev.data === value) normalized.push(prev);
693
+ else normalized.push(document.createTextNode(value));
694
+ }
695
+ }
696
+ return dynamic;
697
+ }
698
+ function appendNodes(parent, array, marker = null) {
699
+ for (let i = 0, len = array.length; i < len; i++) parent.insertBefore(array[i], marker);
700
+ }
701
+ function cleanChildren(parent, current, marker, replacement) {
702
+ if (marker === void 0) return parent.textContent = "";
703
+ const node = replacement || document.createTextNode("");
704
+ if (current.length) {
705
+ let inserted = false;
706
+ for (let i = current.length - 1; i >= 0; i--) {
707
+ const el = current[i];
708
+ if (node !== el) {
709
+ const isParent = el.parentNode === parent;
710
+ if (!inserted && !i) isParent ? parent.replaceChild(node, el) : parent.insertBefore(node, marker);
711
+ else isParent && el.remove();
712
+ } else inserted = true;
713
+ }
714
+ } else parent.insertBefore(node, marker);
715
+ return [node];
716
+ }
717
+ const $RAW = /* @__PURE__ */ Symbol("store-raw"), $NODE = /* @__PURE__ */ Symbol("store-node"), $HAS = /* @__PURE__ */ Symbol("store-has"), $SELF = /* @__PURE__ */ Symbol("store-self");
718
+ function wrap$1(value) {
719
+ let p = value[$PROXY];
720
+ if (!p) {
721
+ Object.defineProperty(value, $PROXY, {
722
+ value: p = new Proxy(value, proxyTraps$1)
723
+ });
724
+ if (!Array.isArray(value)) {
725
+ const keys = Object.keys(value), desc = Object.getOwnPropertyDescriptors(value), proto = Object.getPrototypeOf(value);
726
+ const isClass = proto !== null && value !== null && typeof value === "object" && !Array.isArray(value) && proto !== Object.prototype;
727
+ if (isClass) {
728
+ const descriptors = Object.getOwnPropertyDescriptors(proto);
729
+ keys.push(...Object.keys(descriptors));
730
+ Object.assign(desc, descriptors);
731
+ }
732
+ for (let i = 0, l = keys.length; i < l; i++) {
733
+ const prop = keys[i];
734
+ if (isClass && prop === "constructor") continue;
735
+ if (desc[prop].get) {
736
+ Object.defineProperty(value, prop, {
737
+ configurable: true,
738
+ enumerable: desc[prop].enumerable,
739
+ get: desc[prop].get.bind(p)
740
+ });
741
+ }
742
+ }
743
+ }
744
+ }
745
+ return p;
746
+ }
747
+ function isWrappable(obj) {
748
+ let proto;
749
+ return obj != null && typeof obj === "object" && (obj[$PROXY] || !(proto = Object.getPrototypeOf(obj)) || proto === Object.prototype || Array.isArray(obj));
750
+ }
751
+ function unwrap(item, set = /* @__PURE__ */ new Set()) {
752
+ let result, unwrapped, v, prop;
753
+ if (result = item != null && item[$RAW]) return result;
754
+ if (!isWrappable(item) || set.has(item)) return item;
755
+ if (Array.isArray(item)) {
756
+ if (Object.isFrozen(item)) item = item.slice(0);
757
+ else set.add(item);
758
+ for (let i = 0, l = item.length; i < l; i++) {
759
+ v = item[i];
760
+ if ((unwrapped = unwrap(v, set)) !== v) item[i] = unwrapped;
761
+ }
762
+ } else {
763
+ if (Object.isFrozen(item)) item = Object.assign({}, item);
764
+ else set.add(item);
765
+ const keys = Object.keys(item), desc = Object.getOwnPropertyDescriptors(item);
766
+ for (let i = 0, l = keys.length; i < l; i++) {
767
+ prop = keys[i];
768
+ if (desc[prop].get) continue;
769
+ v = item[prop];
770
+ if ((unwrapped = unwrap(v, set)) !== v) item[prop] = unwrapped;
771
+ }
772
+ }
773
+ return item;
774
+ }
775
+ function getNodes(target, symbol) {
776
+ let nodes = target[symbol];
777
+ if (!nodes) Object.defineProperty(target, symbol, {
778
+ value: nodes = /* @__PURE__ */ Object.create(null)
779
+ });
780
+ return nodes;
781
+ }
782
+ function getNode(nodes, property, value) {
783
+ if (nodes[property]) return nodes[property];
784
+ const [s, set] = createSignal(value, {
785
+ equals: false,
786
+ internal: true
787
+ });
788
+ s.$ = set;
789
+ return nodes[property] = s;
790
+ }
791
+ function proxyDescriptor$1(target, property) {
792
+ const desc = Reflect.getOwnPropertyDescriptor(target, property);
793
+ if (!desc || desc.get || !desc.configurable || property === $PROXY || property === $NODE) return desc;
794
+ delete desc.value;
795
+ delete desc.writable;
796
+ desc.get = () => target[$PROXY][property];
797
+ return desc;
798
+ }
799
+ function trackSelf(target) {
800
+ getListener() && getNode(getNodes(target, $NODE), $SELF)();
801
+ }
802
+ function ownKeys(target) {
803
+ trackSelf(target);
804
+ return Reflect.ownKeys(target);
805
+ }
806
+ const proxyTraps$1 = {
807
+ get(target, property, receiver) {
808
+ if (property === $RAW) return target;
809
+ if (property === $PROXY) return receiver;
810
+ if (property === $TRACK) {
811
+ trackSelf(target);
812
+ return receiver;
813
+ }
814
+ const nodes = getNodes(target, $NODE);
815
+ const tracked = nodes[property];
816
+ let value = tracked ? tracked() : target[property];
817
+ if (property === $NODE || property === $HAS || property === "__proto__") return value;
818
+ if (!tracked) {
819
+ const desc = Object.getOwnPropertyDescriptor(target, property);
820
+ if (getListener() && (typeof value !== "function" || target.hasOwnProperty(property)) && !(desc && desc.get)) value = getNode(nodes, property, value)();
821
+ }
822
+ return isWrappable(value) ? wrap$1(value) : value;
823
+ },
824
+ has(target, property) {
825
+ if (property === $RAW || property === $PROXY || property === $TRACK || property === $NODE || property === $HAS || property === "__proto__") return true;
826
+ getListener() && getNode(getNodes(target, $HAS), property)();
827
+ return property in target;
828
+ },
829
+ set() {
830
+ return true;
831
+ },
832
+ deleteProperty() {
833
+ return true;
834
+ },
835
+ ownKeys,
836
+ getOwnPropertyDescriptor: proxyDescriptor$1
837
+ };
838
+ function setProperty(state, property, value, deleting = false) {
839
+ if (property === "__proto__") {
840
+ return;
841
+ }
842
+ if (!deleting && state[property] === value) return;
843
+ const prev = state[property], len = state.length;
844
+ if (value === void 0) {
845
+ delete state[property];
846
+ if (state[$HAS] && state[$HAS][property] && prev !== void 0) state[$HAS][property].$();
847
+ } else {
848
+ state[property] = value;
849
+ if (state[$HAS] && state[$HAS][property] && prev === void 0) state[$HAS][property].$();
850
+ }
851
+ let nodes = getNodes(state, $NODE), node;
852
+ if (node = getNode(nodes, property, prev)) node.$(() => value);
853
+ if (Array.isArray(state) && state.length !== len) {
854
+ for (let i = state.length; i < len; i++) (node = nodes[i]) && node.$();
855
+ (node = getNode(nodes, "length", len)) && node.$(state.length);
856
+ }
857
+ (node = nodes[$SELF]) && node.$();
858
+ }
859
+ function mergeStoreNode(state, value) {
860
+ const keys = Object.keys(value);
861
+ for (let i = 0; i < keys.length; i += 1) {
862
+ const key = keys[i];
863
+ if (isUnsafeKey$1(key)) continue;
864
+ setProperty(state, key, value[key]);
865
+ }
866
+ }
867
+ function isUnsafeKey$1(property) {
868
+ return property === "__proto__" || property === "constructor" || property === "prototype";
869
+ }
870
+ function updateArray(current, next) {
871
+ if (typeof next === "function") next = next(current);
872
+ next = unwrap(next);
873
+ if (Array.isArray(next)) {
874
+ if (current === next) return;
875
+ let i = 0, len = next.length;
876
+ for (; i < len; i++) {
877
+ const value = next[i];
878
+ if (current[i] !== value) setProperty(current, i, value);
879
+ }
880
+ setProperty(current, "length", len);
881
+ } else mergeStoreNode(current, next);
882
+ }
883
+ function updatePath(current, path, traversed = []) {
884
+ let part, prev = current;
885
+ if (path.length > 1) {
886
+ part = path.shift();
887
+ const partType = typeof part, isArray = Array.isArray(current);
888
+ if (partType === "string" && (part === "__proto__" || path.length > 1 && isUnsafeKey$1(part))) {
889
+ return;
890
+ }
891
+ if (Array.isArray(part)) {
892
+ for (let i = 0; i < part.length; i++) {
893
+ updatePath(current, [part[i]].concat(path), traversed);
894
+ }
895
+ return;
896
+ } else if (isArray && partType === "function") {
897
+ for (let i = 0; i < current.length; i++) {
898
+ if (part(current[i], i)) updatePath(current, [i].concat(path), traversed);
899
+ }
900
+ return;
901
+ } else if (isArray && partType === "object") {
902
+ const {
903
+ from = 0,
904
+ to = current.length - 1,
905
+ by = 1
906
+ } = part;
907
+ for (let i = from; i <= to; i += by) {
908
+ updatePath(current, [i].concat(path), traversed);
909
+ }
910
+ return;
911
+ } else if (path.length > 1) {
912
+ updatePath(current[part], path, [part].concat(traversed));
913
+ return;
914
+ }
915
+ prev = current[part];
916
+ traversed = [part].concat(traversed);
917
+ }
918
+ let value = path[0];
919
+ if (typeof value === "function") {
920
+ value = value(prev, traversed);
921
+ if (value === prev) return;
922
+ }
923
+ if (part === void 0 && value == void 0) return;
924
+ value = unwrap(value);
925
+ if (part === void 0 || isWrappable(prev) && isWrappable(value) && !Array.isArray(value)) {
926
+ mergeStoreNode(prev, value);
927
+ } else setProperty(current, part, value);
928
+ }
929
+ function createStore(...[store, options]) {
930
+ const unwrappedStore = unwrap(store || {});
931
+ const isArray = Array.isArray(unwrappedStore);
932
+ const wrappedStore = wrap$1(unwrappedStore);
933
+ function setStore(...args) {
934
+ batch(() => {
935
+ isArray && args.length === 1 ? updateArray(unwrappedStore, args[0]) : updatePath(unwrappedStore, args);
936
+ });
937
+ }
938
+ return [wrappedStore, setStore];
939
+ }
940
+ const $ROOT = /* @__PURE__ */ Symbol("store-root");
941
+ function isUnsafeKey(property) {
942
+ return property === "__proto__" || property === "constructor" || property === "prototype";
943
+ }
944
+ function applyState(target, parent, property, merge, key) {
945
+ if (isUnsafeKey(property)) return;
946
+ const previous = parent[property];
947
+ if (target === previous) return;
948
+ const isArray = Array.isArray(target);
949
+ if (property !== $ROOT && (!isWrappable(target) || !isWrappable(previous) || isArray !== Array.isArray(previous) || key && target[key] !== previous[key])) {
950
+ setProperty(parent, property, target);
951
+ return;
952
+ }
953
+ if (isArray) {
954
+ if (target.length && previous.length && (!merge || key && target[0] && target[0][key] != null)) {
955
+ let i, j, start, end, newEnd, item, newIndicesNext, keyVal;
956
+ for (start = 0, end = Math.min(previous.length, target.length); start < end && (previous[start] === target[start] || key && previous[start] && target[start] && previous[start][key] && previous[start][key] === target[start][key]); start++) {
957
+ applyState(target[start], previous, start, merge, key);
958
+ }
959
+ const temp = new Array(target.length), newIndices = /* @__PURE__ */ new Map();
960
+ for (end = previous.length - 1, newEnd = target.length - 1; end >= start && newEnd >= start && (previous[end] === target[newEnd] || key && previous[end] && target[newEnd] && previous[end][key] && previous[end][key] === target[newEnd][key]); end--, newEnd--) {
961
+ temp[newEnd] = previous[end];
962
+ }
963
+ if (start > newEnd || start > end) {
964
+ for (j = start; j <= newEnd; j++) setProperty(previous, j, target[j]);
965
+ for (; j < target.length; j++) {
966
+ setProperty(previous, j, temp[j]);
967
+ applyState(target[j], previous, j, merge, key);
968
+ }
969
+ if (previous.length > target.length) setProperty(previous, "length", target.length);
970
+ return;
971
+ }
972
+ newIndicesNext = new Array(newEnd + 1);
973
+ for (j = newEnd; j >= start; j--) {
974
+ item = target[j];
975
+ keyVal = key && item ? item[key] : item;
976
+ i = newIndices.get(keyVal);
977
+ newIndicesNext[j] = i === void 0 ? -1 : i;
978
+ newIndices.set(keyVal, j);
979
+ }
980
+ for (i = start; i <= end; i++) {
981
+ item = previous[i];
982
+ keyVal = key && item ? item[key] : item;
983
+ j = newIndices.get(keyVal);
984
+ if (j !== void 0 && j !== -1) {
985
+ temp[j] = previous[i];
986
+ j = newIndicesNext[j];
987
+ newIndices.set(keyVal, j);
988
+ }
989
+ }
990
+ for (j = start; j < target.length; j++) {
991
+ if (j in temp) {
992
+ setProperty(previous, j, temp[j]);
993
+ applyState(target[j], previous, j, merge, key);
994
+ } else setProperty(previous, j, target[j]);
995
+ }
996
+ } else {
997
+ for (let i = 0, len = target.length; i < len; i++) {
998
+ applyState(target[i], previous, i, merge, key);
999
+ }
1000
+ }
1001
+ if (previous.length > target.length) setProperty(previous, "length", target.length);
1002
+ return;
1003
+ }
1004
+ const targetKeys = Object.keys(target);
1005
+ for (let i = 0, len = targetKeys.length; i < len; i++) {
1006
+ if (isUnsafeKey(targetKeys[i])) continue;
1007
+ applyState(target[targetKeys[i]], previous, targetKeys[i], merge, key);
1008
+ }
1009
+ const previousKeys = Object.keys(previous);
1010
+ for (let i = 0, len = previousKeys.length; i < len; i++) {
1011
+ if (target[previousKeys[i]] === void 0) setProperty(previous, previousKeys[i], void 0);
1012
+ }
1013
+ }
1014
+ function reconcile(value, options = {}) {
1015
+ const {
1016
+ merge,
1017
+ key = "id"
1018
+ } = options, v = unwrap(value);
1019
+ return (state) => {
1020
+ if (!isWrappable(state) || !isWrappable(v)) return v;
1021
+ const res = applyState(v, {
1022
+ [$ROOT]: state
1023
+ }, $ROOT, merge, key);
1024
+ return res === void 0 ? state : res;
1025
+ };
1026
+ }
1027
+ const producers = /* @__PURE__ */ new WeakMap();
1028
+ const setterTraps = {
1029
+ get(target, property) {
1030
+ if (property === $RAW) return target;
1031
+ const value = target[property];
1032
+ if (property === $PROXY || property === $TRACK || property === $NODE || property === $HAS || property === "__proto__") return value;
1033
+ let proxy;
1034
+ return isWrappable(value) ? producers.get(value) || (producers.set(value, proxy = new Proxy(value, setterTraps)), proxy) : value;
1035
+ },
1036
+ set(target, property, value) {
1037
+ setProperty(target, property, unwrap(value));
1038
+ return true;
1039
+ },
1040
+ deleteProperty(target, property) {
1041
+ setProperty(target, property, void 0, true);
1042
+ return true;
1043
+ }
1044
+ };
1045
+ function produce(fn) {
1046
+ return (state) => {
1047
+ if (isWrappable(state)) {
1048
+ let proxy;
1049
+ if (!(proxy = producers.get(state))) {
1050
+ producers.set(state, proxy = new Proxy(state, setterTraps));
1051
+ }
1052
+ fn(proxy);
1053
+ }
1054
+ return state;
1055
+ };
1056
+ }
1057
+ export {
1058
+ For as F,
1059
+ Show as S,
1060
+ createStore as a,
1061
+ createSignal as b,
1062
+ createMemo as c,
1063
+ onMount as d,
1064
+ render as e,
1065
+ createComponent as f,
1066
+ delegateEvents as g,
1067
+ createEffect as h,
1068
+ insert as i,
1069
+ createRenderEffect as j,
1070
+ className as k,
1071
+ getOwner as l,
1072
+ memo as m,
1073
+ onCleanup as o,
1074
+ produce as p,
1075
+ reconcile as r,
1076
+ setAttribute as s,
1077
+ template as t
1078
+ };
1079
+ //# sourceMappingURL=store-CRmRL4Cv.js.map