@plastic-js/tsumiki 0.1.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/dist/index.js ADDED
@@ -0,0 +1,2715 @@
1
+ import { Accordion, Avatar, Carousel, Checkbox, Clipboard, Collapsible, ColorPicker, Combobox, DateInput, DatePicker, Dialog, Drawer, Field, Fieldset, FileUpload, FocusTrap, HoverCard, Listbox, Menu, NumberInput, Pagination, Popover, Portal, Presence, Progress, RadioGroup, RatingGroup, Select, SignaturePad, Slider, Splitter, Steps, Switch, Tabs, TagsInput, Toast, Toggle, ToggleGroup, Tooltip, Tour, TreeView, createToaster, useComboboxContext } from "@plastic-js/ark";
2
+ import { css, keyframes } from "@emotion/css";
3
+ import { Loop, createComputed, createContext, createEffect, createSignal, splitProps, useContext } from "@plastic-js/plastic";
4
+ import { collection } from "@zag-js/combobox";
5
+ //#region src/components/Accordion.jsx
6
+ var Accordion_default = Accordion;
7
+ //#endregion
8
+ //#region src/components/Avatar.jsx
9
+ var Avatar_default = Avatar;
10
+ //#endregion
11
+ //#region node_modules/alien-signals/esm/system.mjs
12
+ function createReactiveSystem({ update, notify, unwatched }) {
13
+ return {
14
+ link,
15
+ unlink,
16
+ propagate,
17
+ checkDirty,
18
+ shallowPropagate
19
+ };
20
+ function link(dep, sub, version) {
21
+ const prevDep = sub.depsTail;
22
+ if (prevDep !== void 0 && prevDep.dep === dep) return;
23
+ const nextDep = prevDep !== void 0 ? prevDep.nextDep : sub.deps;
24
+ if (nextDep !== void 0 && nextDep.dep === dep) {
25
+ nextDep.version = version;
26
+ sub.depsTail = nextDep;
27
+ return;
28
+ }
29
+ const prevSub = dep.subsTail;
30
+ if (prevSub !== void 0 && prevSub.version === version && prevSub.sub === sub) return;
31
+ const newLink = sub.depsTail = dep.subsTail = {
32
+ version,
33
+ dep,
34
+ sub,
35
+ prevDep,
36
+ nextDep,
37
+ prevSub,
38
+ nextSub: void 0
39
+ };
40
+ if (nextDep !== void 0) nextDep.prevDep = newLink;
41
+ if (prevDep !== void 0) prevDep.nextDep = newLink;
42
+ else sub.deps = newLink;
43
+ if (prevSub !== void 0) prevSub.nextSub = newLink;
44
+ else dep.subs = newLink;
45
+ }
46
+ function unlink(link, sub = link.sub) {
47
+ const { dep, prevDep, nextDep, nextSub, prevSub } = link;
48
+ if (nextDep !== void 0) nextDep.prevDep = prevDep;
49
+ else sub.depsTail = prevDep;
50
+ if (prevDep !== void 0) prevDep.nextDep = nextDep;
51
+ else sub.deps = nextDep;
52
+ if (nextSub !== void 0) nextSub.prevSub = prevSub;
53
+ else dep.subsTail = prevSub;
54
+ if (prevSub !== void 0) prevSub.nextSub = nextSub;
55
+ else if ((dep.subs = nextSub) === void 0) unwatched(dep);
56
+ return nextDep;
57
+ }
58
+ function propagate(link, innerWrite) {
59
+ let next = link.nextSub;
60
+ let stack;
61
+ top: do {
62
+ const sub = link.sub;
63
+ let flags = sub.flags;
64
+ if (!(flags & 60)) {
65
+ sub.flags = flags | 32;
66
+ if (innerWrite) sub.flags |= 8;
67
+ } else if (!(flags & 12)) flags = 0;
68
+ else if (!(flags & 4)) sub.flags = flags & -9 | 32;
69
+ else if (!(flags & 48) && isValidLink(link, sub)) {
70
+ sub.flags = flags | 40;
71
+ flags &= 1;
72
+ } else flags = 0;
73
+ if (flags & 2) notify(sub);
74
+ if (flags & 1) {
75
+ const subSubs = sub.subs;
76
+ if (subSubs !== void 0) {
77
+ const nextSub = (link = subSubs).nextSub;
78
+ if (nextSub !== void 0) {
79
+ stack = {
80
+ value: next,
81
+ prev: stack
82
+ };
83
+ next = nextSub;
84
+ }
85
+ continue;
86
+ }
87
+ }
88
+ if ((link = next) !== void 0) {
89
+ next = link.nextSub;
90
+ continue;
91
+ }
92
+ while (stack !== void 0) {
93
+ link = stack.value;
94
+ stack = stack.prev;
95
+ if (link !== void 0) {
96
+ next = link.nextSub;
97
+ continue top;
98
+ }
99
+ }
100
+ break;
101
+ } while (true);
102
+ }
103
+ function checkDirty(link, sub) {
104
+ let stack;
105
+ let checkDepth = 0;
106
+ let dirty = false;
107
+ top: do {
108
+ const dep = link.dep;
109
+ const flags = dep.flags;
110
+ if (sub.flags & 16) dirty = true;
111
+ else if ((flags & 17) === 17) {
112
+ const subs = dep.subs;
113
+ if (update(dep)) {
114
+ if (subs.nextSub !== void 0) shallowPropagate(subs);
115
+ dirty = true;
116
+ }
117
+ } else if ((flags & 33) === 33) {
118
+ stack = {
119
+ value: link,
120
+ prev: stack
121
+ };
122
+ link = dep.deps;
123
+ sub = dep;
124
+ ++checkDepth;
125
+ continue;
126
+ }
127
+ if (!dirty) {
128
+ const nextDep = link.nextDep;
129
+ if (nextDep !== void 0) {
130
+ link = nextDep;
131
+ continue;
132
+ }
133
+ }
134
+ while (checkDepth--) {
135
+ link = stack.value;
136
+ stack = stack.prev;
137
+ if (dirty) {
138
+ const subs = sub.subs;
139
+ if (update(sub)) {
140
+ if (subs.nextSub !== void 0) shallowPropagate(subs);
141
+ sub = link.sub;
142
+ continue;
143
+ }
144
+ dirty = false;
145
+ } else sub.flags &= -33;
146
+ sub = link.sub;
147
+ const nextDep = link.nextDep;
148
+ if (nextDep !== void 0) {
149
+ link = nextDep;
150
+ continue top;
151
+ }
152
+ }
153
+ return dirty && !!sub.flags;
154
+ } while (true);
155
+ }
156
+ function shallowPropagate(link) {
157
+ do {
158
+ const sub = link.sub;
159
+ const flags = sub.flags;
160
+ if ((flags & 48) === 32) {
161
+ sub.flags = flags | 16;
162
+ if ((flags & 6) === 2) notify(sub);
163
+ }
164
+ } while ((link = link.nextSub) !== void 0);
165
+ }
166
+ function isValidLink(checkLink, sub) {
167
+ let link = sub.depsTail;
168
+ while (link !== void 0) {
169
+ if (link === checkLink) return true;
170
+ link = link.prevDep;
171
+ }
172
+ return false;
173
+ }
174
+ }
175
+ //#endregion
176
+ //#region node_modules/alien-signals/esm/index.mjs
177
+ var HasChildEffect = 64;
178
+ var cycle = 0;
179
+ var runDepth = 0;
180
+ var batchDepth = 0;
181
+ var notifyIndex = 0;
182
+ var queuedLength = 0;
183
+ var activeSub;
184
+ var queued = [];
185
+ var { link, unlink, propagate, checkDirty, shallowPropagate } = createReactiveSystem({
186
+ update(node) {
187
+ if ("getter" in node) return updateComputed(node);
188
+ if ("currentValue" in node) return updateSignal(node);
189
+ node.flags = 1;
190
+ return true;
191
+ },
192
+ notify(effect) {
193
+ let insertIndex = queuedLength;
194
+ let firstInsertedIndex = insertIndex;
195
+ do {
196
+ queued[insertIndex++] = effect;
197
+ effect.flags &= -3;
198
+ effect = effect.subs?.sub;
199
+ if (effect === void 0 || !(effect.flags & 2)) break;
200
+ } while (true);
201
+ queuedLength = insertIndex;
202
+ while (firstInsertedIndex < --insertIndex) {
203
+ const left = queued[firstInsertedIndex];
204
+ queued[firstInsertedIndex++] = queued[insertIndex];
205
+ queued[insertIndex] = left;
206
+ }
207
+ },
208
+ unwatched(node) {
209
+ if ("getter" in node) {
210
+ if (node.depsTail !== void 0) {
211
+ node.flags = 17;
212
+ disposeAllDepsInReverse(node);
213
+ }
214
+ } else if ("currentValue" in node) {} else if ("fn" in node) effectOper.call(node);
215
+ else effectScopeOper.call(node);
216
+ }
217
+ });
218
+ function getActiveSub() {
219
+ return activeSub;
220
+ }
221
+ function setActiveSub(sub) {
222
+ const prevSub = activeSub;
223
+ activeSub = sub;
224
+ return prevSub;
225
+ }
226
+ function startBatch() {
227
+ ++batchDepth;
228
+ }
229
+ function endBatch() {
230
+ if (!--batchDepth) flush();
231
+ }
232
+ function isSignal$1(fn) {
233
+ return fn.name === "bound " + signalOper.name;
234
+ }
235
+ function isComputed$1(fn) {
236
+ return fn.name === "bound " + computedOper.name;
237
+ }
238
+ function signal(initialValue) {
239
+ return signalOper.bind({
240
+ currentValue: initialValue,
241
+ pendingValue: initialValue,
242
+ subs: void 0,
243
+ subsTail: void 0,
244
+ flags: 1
245
+ });
246
+ }
247
+ function effect$1(fn) {
248
+ const e = {
249
+ fn,
250
+ cleanup: void 0,
251
+ subs: void 0,
252
+ subsTail: void 0,
253
+ deps: void 0,
254
+ depsTail: void 0,
255
+ flags: 6
256
+ };
257
+ const prevSub = setActiveSub(e);
258
+ if (prevSub !== void 0) {
259
+ link(e, prevSub, 0);
260
+ prevSub.flags |= HasChildEffect;
261
+ }
262
+ try {
263
+ ++runDepth;
264
+ e.cleanup = e.fn();
265
+ } finally {
266
+ --runDepth;
267
+ activeSub = prevSub;
268
+ e.flags &= -5;
269
+ }
270
+ return effectOper.bind(e);
271
+ }
272
+ function updateComputed(c) {
273
+ if (c.flags & HasChildEffect) {
274
+ let link = c.depsTail;
275
+ while (link !== void 0) {
276
+ const prev = link.prevDep;
277
+ const dep = link.dep;
278
+ if (!("getter" in dep) && !("currentValue" in dep)) unlink(link, c);
279
+ link = prev;
280
+ }
281
+ }
282
+ c.depsTail = void 0;
283
+ c.flags = 5;
284
+ const prevSub = setActiveSub(c);
285
+ try {
286
+ ++cycle;
287
+ const oldValue = c.value;
288
+ return oldValue !== (c.value = c.getter(oldValue));
289
+ } finally {
290
+ activeSub = prevSub;
291
+ c.flags &= -5;
292
+ purgeDeps(c);
293
+ }
294
+ }
295
+ function updateSignal(s) {
296
+ s.flags = 1;
297
+ return s.currentValue !== (s.currentValue = s.pendingValue);
298
+ }
299
+ function run(e) {
300
+ const flags = e.flags;
301
+ if (flags & 16 || flags & 32 && checkDirty(e.deps, e)) {
302
+ if (flags & HasChildEffect) {
303
+ let link = e.depsTail;
304
+ while (link !== void 0) {
305
+ const prev = link.prevDep;
306
+ const dep = link.dep;
307
+ if (!("getter" in dep) && !("currentValue" in dep)) unlink(link, e);
308
+ link = prev;
309
+ }
310
+ }
311
+ if (e.cleanup) {
312
+ runCleanup(e);
313
+ if (!e.flags) return;
314
+ }
315
+ e.depsTail = void 0;
316
+ e.flags = 6;
317
+ const prevSub = setActiveSub(e);
318
+ try {
319
+ ++cycle;
320
+ ++runDepth;
321
+ e.cleanup = e.fn();
322
+ } finally {
323
+ --runDepth;
324
+ activeSub = prevSub;
325
+ e.flags &= -5;
326
+ purgeDeps(e);
327
+ }
328
+ } else if (e.deps !== void 0) e.flags = 2 | flags & HasChildEffect;
329
+ }
330
+ function flush() {
331
+ try {
332
+ while (notifyIndex < queuedLength) {
333
+ const effect = queued[notifyIndex];
334
+ queued[notifyIndex++] = void 0;
335
+ run(effect);
336
+ }
337
+ } finally {
338
+ while (notifyIndex < queuedLength) {
339
+ const effect = queued[notifyIndex];
340
+ queued[notifyIndex++] = void 0;
341
+ effect.flags |= 10;
342
+ }
343
+ notifyIndex = 0;
344
+ queuedLength = 0;
345
+ }
346
+ }
347
+ function computedOper() {
348
+ const flags = this.flags;
349
+ if (flags & 16 || flags & 32 && (checkDirty(this.deps, this) || (this.flags = flags & -33, false))) {
350
+ if (updateComputed(this)) {
351
+ const subs = this.subs;
352
+ if (subs !== void 0) shallowPropagate(subs);
353
+ }
354
+ } else if (!flags) {
355
+ this.flags = 5;
356
+ const prevSub = setActiveSub(this);
357
+ try {
358
+ this.value = this.getter();
359
+ } finally {
360
+ activeSub = prevSub;
361
+ this.flags &= -5;
362
+ }
363
+ }
364
+ const sub = activeSub;
365
+ if (sub !== void 0) link(this, sub, cycle);
366
+ return this.value;
367
+ }
368
+ function signalOper(...value) {
369
+ if (value.length) {
370
+ if (this.pendingValue !== (this.pendingValue = value[0])) {
371
+ this.flags = 17;
372
+ const subs = this.subs;
373
+ if (subs !== void 0) {
374
+ propagate(subs, !!runDepth);
375
+ if (!batchDepth) flush();
376
+ }
377
+ }
378
+ } else {
379
+ if (this.flags & 16) {
380
+ if (updateSignal(this)) {
381
+ const subs = this.subs;
382
+ if (subs !== void 0) shallowPropagate(subs);
383
+ }
384
+ }
385
+ const sub = activeSub;
386
+ if (sub !== void 0) link(this, sub, cycle);
387
+ return this.currentValue;
388
+ }
389
+ }
390
+ function runCleanup(e) {
391
+ const cleanup = e.cleanup;
392
+ e.cleanup = void 0;
393
+ const prevSub = activeSub;
394
+ activeSub = void 0;
395
+ try {
396
+ cleanup();
397
+ } finally {
398
+ activeSub = prevSub;
399
+ }
400
+ }
401
+ function effectOper() {
402
+ effectScopeOper.call(this);
403
+ if (this.cleanup) runCleanup(this);
404
+ }
405
+ function effectScopeOper() {
406
+ this.flags = 0;
407
+ disposeAllDepsInReverse(this);
408
+ const sub = this.subs;
409
+ if (sub !== void 0) unlink(sub);
410
+ }
411
+ function disposeAllDepsInReverse(sub) {
412
+ let link = sub.depsTail;
413
+ while (link !== void 0) {
414
+ const prev = link.prevDep;
415
+ unlink(link, sub);
416
+ link = prev;
417
+ }
418
+ }
419
+ function purgeDeps(sub) {
420
+ const depsTail = sub.depsTail;
421
+ let dep = depsTail !== void 0 ? depsTail.nextDep : sub.deps;
422
+ while (dep !== void 0) dep = unlink(dep, sub);
423
+ }
424
+ //#endregion
425
+ //#region node_modules/@plastic-js/plastic/src/utils.js
426
+ var isObject = (value) => {
427
+ return value !== null && typeof value === "object";
428
+ };
429
+ var isPlainObject = (value) => value != null && typeof value === "object" && !Array.isArray(value);
430
+ var flattenChildren = (children) => children.flat(Infinity);
431
+ var isEventProp = (key) => /^on[A-Za-z]/.test(key);
432
+ var normalizeTextNodeValue = (value) => {
433
+ if (value == null) return "";
434
+ return String(value);
435
+ };
436
+ var toClassTokens = (value) => {
437
+ if (typeof value !== "string") return /* @__PURE__ */ new Set();
438
+ return new Set(value.split(/\s+/).filter(Boolean));
439
+ };
440
+ var toClassMap = (value) => {
441
+ if (!value) return /* @__PURE__ */ new Map();
442
+ const tokens = toClassTokens(value);
443
+ const map = /* @__PURE__ */ new Map();
444
+ tokens.forEach((token) => {
445
+ map.set(token, true);
446
+ });
447
+ return map;
448
+ };
449
+ //#endregion
450
+ //#region node_modules/@plastic-js/plastic/src/reactivity.js
451
+ /**
452
+ * reactivity.js — Reactive system for the Plastic framework.
453
+ *
454
+ * Built on top of the `alien-signals` library, which provides fine-grained
455
+ * signal primitives (`signal`, `computed`, `effect`) suited for primitive values.
456
+ * This module extends that foundation with deep object reactivity.
457
+ *
458
+ * ## Core concepts
459
+ *
460
+ * ### Signals (`createSignal`)
461
+ * A thin public wrapper around `alien-signals`'s `signal()`. Calling
462
+ * `createSignal(x)` on an already-signal value is a no-op — the original
463
+ * signal is returned unchanged.
464
+ *
465
+ * ### Reactive trees (`tree` / `createTree`)
466
+ * `tree(obj)` wraps a plain object (or array) in an ES Proxy that makes every
467
+ * property access and mutation reactive. It is conceptually equivalent to
468
+ * Vue 3's `reactive()`.
469
+ *
470
+ * Key implementation details:
471
+ * - **Per-property signals**: Each accessed property is lazily backed by an
472
+ * `alien-signals` signal stored in a `signals` map (keyed by property name
473
+ * or symbol). Reads subscribe the current effect; writes trigger updates.
474
+ * - **Proxy cache**: A `WeakMap` (proxyCache) ensures that wrapping the same
475
+ * raw object multiple times always returns the same proxy, preventing
476
+ * duplicate subscriptions.
477
+ * - **`RAW` / `IS_TREE` sentinels**: Two well-known symbols allow consumers to
478
+ * unwrap to the original object (`toRaw`) and to test whether a value is
479
+ * already a reactive tree (`isTree`), avoiding double-wrapping.
480
+ * - **Iterate tracking**: A dedicated `ITERATE_KEY` signal is used to track
481
+ * structural changes (property addition/deletion, array length changes).
482
+ * Operations like `for…in`, `Object.keys`, and spread trigger this signal so
483
+ * effects that iterate over an object re-run when its shape changes.
484
+ * - **Non-trackable keys**: Built-in symbols (`Symbol.iterator`, etc.) and a
485
+ * small set of Vue-compatibility keys are excluded from tracking to avoid
486
+ * spurious subscriptions.
487
+ * - **Array instrumentations**: Mutating array methods (`push`, `pop`, `shift`,
488
+ * `unshift`, `splice`) temporarily pause dependency tracking while executing
489
+ * to prevent the read of `length` inside those methods from creating
490
+ * unintended subscriptions. Search methods (`includes`, `indexOf`,
491
+ * `lastIndexOf`) explicitly track all indices and also fall back to comparing
492
+ * raw (unwrapped) values, supporting reactive proxies as search arguments.
493
+ * - **Nested reactivity**: When `get` returns an object value it is recursively
494
+ * wrapped with `tree()`, providing deep reactivity on demand.
495
+ * - **Raw value storage**: `set` always unwraps values through `toRaw` before
496
+ * writing to the underlying target, keeping raw objects free of proxy
497
+ * references and preventing double-wrapping in the signal store.
498
+ *
499
+ * ### Tracking pause/resume
500
+ * `pauseTracking` / `resumeTracking` manipulate `alien-signals`'s active
501
+ * subscriber stack via `getActiveSub` / `setActiveSub`, temporarily
502
+ * suspending dependency collection for mutation-only code paths.
503
+ *
504
+ * ## Public API
505
+ * Re-exports from `alien-signals`: `computed`, `effect`, `isSignal`, `isComputed`
506
+ * Added by this module: `tree`, `createSignal`, `createTree`, `isTree`, `toRaw`
507
+ */
508
+ var effect = (fn) => effect$1(() => {
509
+ const result = fn();
510
+ return typeof result === "function" ? result : void 0;
511
+ });
512
+ var IS_TREE = Symbol("isTree");
513
+ new Set(Object.getOwnPropertyNames(Symbol).map((key) => Symbol[key]).filter((symbol) => typeof symbol === "symbol"));
514
+ var isSignal = (value) => {
515
+ if (typeof value === "function" && isSignal$1(value)) return true;
516
+ return false;
517
+ };
518
+ var isComputed = (value) => {
519
+ if (typeof value === "function" && isComputed$1(value)) return true;
520
+ return false;
521
+ };
522
+ var runUntracked = (fn) => {
523
+ if (getActiveSub() === void 0) return fn();
524
+ const prevSub = setActiveSub(void 0);
525
+ try {
526
+ return fn();
527
+ } finally {
528
+ setActiveSub(prevSub);
529
+ }
530
+ };
531
+ var createSignal$1 = (value) => {
532
+ if (isSignal(value)) return value;
533
+ if (isComputed(value)) console.warn("[reactivity] createSignal: wrapping a computed in a signal is redundant, use the computed directly.");
534
+ return signal(value);
535
+ };
536
+ var isTree = (value) => isObject(value) && value[IS_TREE] === true;
537
+ var batch = (fn) => {
538
+ startBatch();
539
+ try {
540
+ return fn();
541
+ } finally {
542
+ endBatch();
543
+ }
544
+ };
545
+ //#endregion
546
+ //#region node_modules/@plastic-js/plastic/src/computation-context.js
547
+ var currentComputation = null;
548
+ var getCurrentComputation = () => currentComputation;
549
+ var setCurrentComputation = (value) => {
550
+ currentComputation = value;
551
+ };
552
+ //#endregion
553
+ //#region node_modules/@plastic-js/plastic/src/control-flow.js
554
+ var createControlFlow = ({ createOwner, runOwnerMounts, runWithOwner, disposeOwner, createBindingEffect, renderInOwner, getCurrentOwner, registerCleanup, appendChild, flushPendingDescriptors }) => {
555
+ const NO_BRANCH = Symbol("no-branch");
556
+ const mountDynamic = (anchor, selectBranch) => {
557
+ let prevNodes = [];
558
+ let prevOwner = null;
559
+ let prevBranch = NO_BRANCH;
560
+ const hostOwner = getCurrentOwner();
561
+ const update = () => {
562
+ const branch = selectBranch();
563
+ if (branch === prevBranch) return;
564
+ prevBranch = branch;
565
+ if (prevOwner) {
566
+ disposeOwner(prevOwner);
567
+ prevOwner = null;
568
+ }
569
+ prevNodes.forEach((n) => n.remove());
570
+ prevNodes = [];
571
+ const owner = createOwner(hostOwner);
572
+ const prevComp = getCurrentComputation();
573
+ setCurrentComputation(null);
574
+ const node = renderInOwner(owner, runUntracked(() => runWithOwner(owner, () => typeof branch === "function" ? branch() : null)) ?? null);
575
+ setCurrentComputation(prevComp);
576
+ if (node instanceof DocumentFragment && flushPendingDescriptors) runWithOwner(owner, () => flushPendingDescriptors(node));
577
+ if (node instanceof DocumentFragment) prevNodes = [...node.childNodes];
578
+ else prevNodes = [node];
579
+ anchor.after(node);
580
+ prevOwner = owner;
581
+ if (anchor.isConnected) runOwnerMounts(owner);
582
+ };
583
+ const stop = createBindingEffect(update);
584
+ return () => {
585
+ if (typeof stop === "function") stop();
586
+ if (prevOwner) {
587
+ disposeOwner(prevOwner);
588
+ prevOwner = null;
589
+ }
590
+ prevNodes.forEach((n) => n.remove());
591
+ prevNodes = [];
592
+ };
593
+ };
594
+ const True = ({ children }) => children;
595
+ const False = ({ children }) => children;
596
+ const Case = ({ children }) => children;
597
+ const Default = ({ children }) => children;
598
+ const Either = ({ condition, trueBranch, falseBranch }) => {
599
+ const anchor = document.createComment("if");
600
+ const fragment = document.createDocumentFragment();
601
+ fragment.appendChild(anchor);
602
+ const activeTrue = trueBranch;
603
+ const activeFalse = falseBranch;
604
+ mountDynamic(anchor, () => {
605
+ return (typeof condition === "function" ? condition() : condition) ? activeTrue : activeFalse;
606
+ });
607
+ return fragment;
608
+ };
609
+ const Match = ({ value, cases = [], defaultBranch }) => {
610
+ const anchor = document.createComment("match");
611
+ const fragment = document.createDocumentFragment();
612
+ fragment.appendChild(anchor);
613
+ const resolve = (source) => {
614
+ return typeof source === "function" ? source() : source;
615
+ };
616
+ mountDynamic(anchor, () => {
617
+ const resolvedCases = typeof cases === "function" ? cases() : cases;
618
+ const activeCases = Array.isArray(resolvedCases) ? resolvedCases : [];
619
+ const valueToMatch = resolve(value);
620
+ for (const slot of activeCases) {
621
+ if (!slot || typeof slot !== "object") continue;
622
+ let matched = false;
623
+ if (Object.prototype.hasOwnProperty.call(slot, "when")) matched = Object.is(valueToMatch, resolve(slot.when));
624
+ if (!matched) continue;
625
+ return typeof slot.branch === "function" ? slot.branch : null;
626
+ }
627
+ return typeof defaultBranch === "function" ? defaultBranch : null;
628
+ });
629
+ return fragment;
630
+ };
631
+ const Loop = ({ each, children }) => {
632
+ const anchor = document.createComment("for");
633
+ const fragment = document.createDocumentFragment();
634
+ fragment.appendChild(anchor);
635
+ const hostOwner = getCurrentOwner();
636
+ let rows = [];
637
+ const resolveList = () => {
638
+ const list = typeof each === "function" ? each() : each;
639
+ return Array.isArray(list) ? list : [];
640
+ };
641
+ const renderRow = (item, indexValue) => {
642
+ const owner = createOwner(hostOwner);
643
+ const indexSignal = createSignal$1(indexValue);
644
+ const prevComp = getCurrentComputation();
645
+ setCurrentComputation(null);
646
+ const result = runUntracked(() => runWithOwner(owner, () => {
647
+ if (typeof children !== "function") return null;
648
+ return children(item, indexSignal);
649
+ }));
650
+ const node = runUntracked(() => renderInOwner(owner, result));
651
+ setCurrentComputation(prevComp);
652
+ return {
653
+ owner,
654
+ indexSignal,
655
+ nodes: node instanceof DocumentFragment ? [...node.childNodes] : [node]
656
+ };
657
+ };
658
+ const mountRows = (nextRows) => {
659
+ const nodeFragment = document.createDocumentFragment();
660
+ nextRows.forEach((row) => {
661
+ row.nodes.forEach((node) => {
662
+ nodeFragment.appendChild(node);
663
+ });
664
+ });
665
+ anchor.before(nodeFragment);
666
+ };
667
+ const reconcileRows = (nextItems) => {
668
+ const prevRows = rows;
669
+ const nextRows = new Array(nextItems.length);
670
+ const createdRows = [];
671
+ const reusedPrevIndices = /* @__PURE__ */ new Set();
672
+ const prevRowsByIdentity = /* @__PURE__ */ new Map();
673
+ prevRows.forEach((row, prevIndex) => {
674
+ const bucket = prevRowsByIdentity.get(row.identity);
675
+ if (bucket) bucket.push(prevIndex);
676
+ else prevRowsByIdentity.set(row.identity, [prevIndex]);
677
+ });
678
+ nextItems.forEach((item, nextIndex) => {
679
+ const bucket = prevRowsByIdentity.get(item);
680
+ if (!bucket || bucket.length === 0) return;
681
+ const prevIndex = bucket.shift();
682
+ nextRows[nextIndex] = prevRows[prevIndex];
683
+ reusedPrevIndices.add(prevIndex);
684
+ });
685
+ for (let nextIndex = 0; nextIndex < nextRows.length; nextIndex++) {
686
+ const row = nextRows[nextIndex];
687
+ if (row) {
688
+ row.indexSignal(nextIndex);
689
+ continue;
690
+ }
691
+ const created = renderRow(nextItems[nextIndex], nextIndex);
692
+ created.identity = nextItems[nextIndex];
693
+ nextRows[nextIndex] = created;
694
+ createdRows.push(created);
695
+ }
696
+ prevRows.forEach((row, prevIndex) => {
697
+ if (reusedPrevIndices.has(prevIndex)) return;
698
+ disposeOwner(row.owner);
699
+ row.nodes.forEach((node) => node.remove());
700
+ });
701
+ rows = nextRows;
702
+ mountRows(rows);
703
+ if (anchor.isConnected) createdRows.forEach((row) => {
704
+ runOwnerMounts(row.owner);
705
+ });
706
+ };
707
+ const stop = createBindingEffect(() => {
708
+ reconcileRows(resolveList());
709
+ });
710
+ registerCleanup(() => {
711
+ if (typeof stop === "function") stop();
712
+ rows.forEach((row) => {
713
+ disposeOwner(row.owner);
714
+ row.nodes.forEach((node) => node.remove());
715
+ });
716
+ rows = [];
717
+ });
718
+ return fragment;
719
+ };
720
+ const Portal = ({ container, children }) => {
721
+ const target = (typeof container === "function" ? container() : container) ?? document.body;
722
+ const owner = createOwner(getCurrentOwner());
723
+ const prevComp = getCurrentComputation();
724
+ setCurrentComputation(null);
725
+ const node = renderInOwner(owner, runWithOwner(owner, () => typeof children === "function" ? children() : children) ?? null);
726
+ setCurrentComputation(prevComp);
727
+ const childCountBefore = target.childNodes.length;
728
+ if (node instanceof DocumentFragment && appendChild) appendChild(target, node);
729
+ else target.appendChild(node);
730
+ if (flushPendingDescriptors) flushPendingDescriptors(target);
731
+ const portalNodes = [...target.childNodes].slice(childCountBefore);
732
+ if (target.isConnected) runOwnerMounts(owner);
733
+ registerCleanup(() => {
734
+ disposeOwner(owner);
735
+ portalNodes.forEach((n) => n.remove());
736
+ });
737
+ return document.createComment("portal");
738
+ };
739
+ return {
740
+ mountDynamic,
741
+ Either,
742
+ True,
743
+ False,
744
+ Match,
745
+ Case,
746
+ Default,
747
+ Loop,
748
+ Portal
749
+ };
750
+ };
751
+ //#endregion
752
+ //#region node_modules/@plastic-js/plastic/src/merge-props.js
753
+ var CLASS_KEYS = ["class", "className"];
754
+ var STYLE_KEYS = ["style"];
755
+ var MAX_MERGE_VALUE_RESOLVE_STEPS = 16;
756
+ var normalizeClassValue = (value) => {
757
+ if (value == null || value === false || value === "") return;
758
+ if (typeof value !== "string") return;
759
+ return value;
760
+ };
761
+ var isClassKey = (key) => key === "class" || key === "className";
762
+ var resolveThunkValue = (value) => {
763
+ let resolved = value;
764
+ let steps = 0;
765
+ while (typeof resolved === "function" && steps < MAX_MERGE_VALUE_RESOLVE_STEPS) {
766
+ resolved = resolved();
767
+ steps += 1;
768
+ }
769
+ return resolved;
770
+ };
771
+ var mergeClassValues = (values) => {
772
+ if (values.some((value) => value != null && typeof value !== "string" && value !== false)) return values[values.length - 1];
773
+ const parts = values.map(normalizeClassValue).filter(Boolean);
774
+ return parts.length ? parts.join(" ") : void 0;
775
+ };
776
+ var mergeStyleValues = (values) => {
777
+ let result;
778
+ for (const value of values) {
779
+ if (value == null) continue;
780
+ if (isPlainObject(result) && isPlainObject(value)) result = {
781
+ ...result,
782
+ ...value
783
+ };
784
+ else if (typeof result === "string" && typeof value === "string") result = `${result}; ${value}`;
785
+ else result = value;
786
+ }
787
+ return result;
788
+ };
789
+ var resolveSource = (source) => typeof source === "function" ? source() : source;
790
+ var collectPresentKeys = (source, keys) => {
791
+ const matches = [];
792
+ const seen = /* @__PURE__ */ new Set();
793
+ for (const key of Reflect.ownKeys(source)) {
794
+ if (typeof key !== "string" || !keys.includes(key) || seen.has(key)) continue;
795
+ seen.add(key);
796
+ matches.push(key);
797
+ }
798
+ for (const key of keys) {
799
+ if (seen.has(key) || !(key in source)) continue;
800
+ matches.push(key);
801
+ }
802
+ return matches;
803
+ };
804
+ var collectValues = (sources, keys) => {
805
+ const values = [];
806
+ for (const source of sources) {
807
+ const resolved = resolveSource(source);
808
+ if (resolved == null) continue;
809
+ for (const key of collectPresentKeys(resolved, keys)) values.push(resolved[key]);
810
+ }
811
+ return values;
812
+ };
813
+ var getKeyFamily = (key) => {
814
+ if (isClassKey(key)) return CLASS_KEYS;
815
+ if (key === "style") return STYLE_KEYS;
816
+ return [key];
817
+ };
818
+ var resolveKey = (sources, key) => {
819
+ const values = collectValues(sources, getKeyFamily(key));
820
+ if (values.length === 0) return;
821
+ if (key === "class" || key === "className") {
822
+ if (values.some((value) => typeof value === "function")) return () => mergeClassValues(values.map(resolveThunkValue));
823
+ return mergeClassValues(values);
824
+ }
825
+ if (key === "style") {
826
+ if (values.some((value) => typeof value === "function")) return () => mergeStyleValues(values.map(resolveThunkValue));
827
+ return mergeStyleValues(values);
828
+ }
829
+ return values[values.length - 1];
830
+ };
831
+ var hasKey = (sources, key) => {
832
+ const keys = getKeyFamily(key);
833
+ for (const source of sources) {
834
+ const resolved = resolveSource(source);
835
+ if (resolved == null) continue;
836
+ if (keys.some((candidate) => candidate in resolved)) return true;
837
+ }
838
+ return false;
839
+ };
840
+ var getCanonicalClassKey = (sources) => {
841
+ let canonicalKey;
842
+ for (const source of sources) {
843
+ const resolved = resolveSource(source);
844
+ if (resolved == null) continue;
845
+ for (const key of collectPresentKeys(resolved, CLASS_KEYS)) canonicalKey = key;
846
+ }
847
+ return canonicalKey;
848
+ };
849
+ var collectKeys = (sources) => {
850
+ const seen = /* @__PURE__ */ new Set();
851
+ const keys = [];
852
+ let hasClassAlias = false;
853
+ for (const source of sources) {
854
+ const resolved = resolveSource(source);
855
+ if (resolved == null) continue;
856
+ for (const key of Reflect.ownKeys(resolved)) {
857
+ if (isClassKey(key)) {
858
+ hasClassAlias = true;
859
+ continue;
860
+ }
861
+ if (!seen.has(key)) {
862
+ seen.add(key);
863
+ keys.push(key);
864
+ }
865
+ }
866
+ }
867
+ if (hasClassAlias) keys.push(getCanonicalClassKey(sources) ?? "class");
868
+ return keys;
869
+ };
870
+ var readOnlyTrap = () => {
871
+ throw new Error("mergeProps result is read-only");
872
+ };
873
+ var IS_MERGED_PROPS = Symbol("mergeProps");
874
+ var HAS_STATIC_KEYS = Symbol("mergeProps.staticKeys");
875
+ var mergeProps = (...sources) => {
876
+ if (sources.length === 1 && sources[0] != null && typeof sources[0] === "object" && isPlainObject(sources[0])) return sources[0];
877
+ let hasStaticKeys = true;
878
+ for (const source of sources) if (typeof source === "function") {
879
+ hasStaticKeys = false;
880
+ break;
881
+ }
882
+ return new Proxy({}, {
883
+ get: (_, key) => {
884
+ if (key === IS_MERGED_PROPS) return true;
885
+ if (key === HAS_STATIC_KEYS) return hasStaticKeys;
886
+ return resolveKey(sources, key);
887
+ },
888
+ has: (_, key) => hasKey(sources, key),
889
+ ownKeys: () => collectKeys(sources),
890
+ getOwnPropertyDescriptor: (_, key) => {
891
+ if (!hasKey(sources, key)) return;
892
+ return {
893
+ enumerable: true,
894
+ configurable: true,
895
+ get: () => resolveKey(sources, key)
896
+ };
897
+ },
898
+ set: readOnlyTrap,
899
+ deleteProperty: readOnlyTrap
900
+ });
901
+ };
902
+ var isMergedProps = (value) => value != null && typeof value === "object" && value[IS_MERGED_PROPS] === true;
903
+ var hasMergedPropsStaticKeys = (value) => value != null && typeof value === "object" && value[HAS_STATIC_KEYS] === true;
904
+ //#endregion
905
+ //#region node_modules/@plastic-js/plastic/src/jsx-runtime.js
906
+ var Fragment = Symbol("Fragment");
907
+ var OWNER = Symbol("owner");
908
+ var COMPONENT_DESCRIPTOR = Symbol("component-descriptor");
909
+ var PENDING_DESCRIPTORS = Symbol("pending-descriptors");
910
+ var currentOwner = null;
911
+ var getCurrentOwner = () => currentOwner;
912
+ var createOwner = (parent = null) => {
913
+ const owner = {
914
+ parent,
915
+ children: void 0,
916
+ cleanups: void 0,
917
+ effects: void 0,
918
+ contexts: void 0,
919
+ refs: void 0,
920
+ mounts: void 0,
921
+ mounted: false
922
+ };
923
+ if (parent) (parent.children ??= /* @__PURE__ */ new Set()).add(owner);
924
+ return owner;
925
+ };
926
+ var runOwnerMounts = (owner) => {
927
+ runUntracked(() => {
928
+ owner.children?.forEach((child) => runOwnerMounts(child));
929
+ owner.refs?.forEach((fn) => {
930
+ fn();
931
+ });
932
+ owner.mounts?.forEach((fn) => {
933
+ fn();
934
+ });
935
+ owner.mounted = true;
936
+ });
937
+ };
938
+ var runWithOwner = (owner, fn) => {
939
+ const prev = currentOwner;
940
+ currentOwner = owner;
941
+ try {
942
+ return fn();
943
+ } finally {
944
+ currentOwner = prev;
945
+ }
946
+ };
947
+ var renderInOwner = (owner, result) => runWithOwner(owner, () => node2Element(result));
948
+ var mountOwnedSubtree = (node, { force = false } = {}) => {
949
+ if (!(node instanceof Node)) return;
950
+ const stack = [node];
951
+ while (stack.length) {
952
+ const current = stack.pop();
953
+ const owner = current[OWNER];
954
+ if (owner && !owner.mounted && (force || current.isConnected)) runOwnerMounts(owner);
955
+ for (const child of current.childNodes) stack.push(child);
956
+ }
957
+ };
958
+ var disposeOwner = (owner) => {
959
+ if (owner.parent) owner.parent.children?.delete(owner);
960
+ if (owner.children) {
961
+ owner.children.forEach((child) => disposeOwner(child));
962
+ owner.children.clear();
963
+ }
964
+ if (owner.effects) {
965
+ for (let i = owner.effects.length - 1; i >= 0; i -= 1) {
966
+ const stop = owner.effects[i];
967
+ if (typeof stop === "function") stop();
968
+ }
969
+ owner.effects.length = 0;
970
+ }
971
+ if (owner.cleanups) {
972
+ for (let i = owner.cleanups.length - 1; i >= 0; i -= 1) {
973
+ const cleanup = owner.cleanups[i];
974
+ if (typeof cleanup === "function") cleanup();
975
+ }
976
+ owner.cleanups.length = 0;
977
+ }
978
+ if (owner.refs) owner.refs.length = 0;
979
+ if (owner.mounts) owner.mounts.length = 0;
980
+ };
981
+ var flushCleanups = (list) => {
982
+ runUntracked(() => {
983
+ [...list].reverse().forEach((l) => {
984
+ l();
985
+ });
986
+ list.length = 0;
987
+ });
988
+ };
989
+ var createBindingEffect = (runner) => {
990
+ const owner = currentOwner;
991
+ const local = [];
992
+ const stop = effect(() => {
993
+ flushCleanups(local);
994
+ const prevComp = getCurrentComputation();
995
+ setCurrentComputation({ cleanups: local });
996
+ const prevOwner = currentOwner;
997
+ currentOwner = owner;
998
+ try {
999
+ runner();
1000
+ } finally {
1001
+ setCurrentComputation(prevComp);
1002
+ currentOwner = prevOwner;
1003
+ }
1004
+ });
1005
+ if (!owner) return stop;
1006
+ (owner.effects ??= []).push(stop);
1007
+ (owner.cleanups ??= []).push(() => {
1008
+ flushCleanups(local);
1009
+ });
1010
+ return stop;
1011
+ };
1012
+ var registerCleanup = (fn) => {
1013
+ const currentComputation = getCurrentComputation();
1014
+ if (!currentOwner && !currentComputation) throw new Error("registerCleanup must be called within a component or effect scope");
1015
+ if (currentComputation) currentComputation.cleanups.push(fn);
1016
+ else (currentOwner.cleanups ??= []).push(fn);
1017
+ };
1018
+ var createComponentDescriptor = (tag, props, children) => ({
1019
+ [COMPONENT_DESCRIPTOR]: true,
1020
+ tag,
1021
+ props,
1022
+ children,
1023
+ instance: null
1024
+ });
1025
+ var isComponentDescriptor = (value) => value != null && typeof value === "object" && value[COMPONENT_DESCRIPTOR] === true;
1026
+ var isReactivePrimitive = (value) => value != null && (isSignal(value) || isComputed(value));
1027
+ var isReactive = (value) => isReactivePrimitive(value) || typeof value === "function";
1028
+ var createPlaceholder = () => document.createComment("null");
1029
+ var isSupportedEvent = (element, eventName) => `on${eventName}` in element;
1030
+ var isBooleanDomProp = (element, key) => key in element && typeof element[key] === "boolean";
1031
+ var JSX_PROP_MAP = {
1032
+ autoComplete: "autocomplete",
1033
+ autoFocus: "autofocus",
1034
+ autoPlay: "autoplay",
1035
+ encType: "enctype",
1036
+ hrefLang: "hreflang"
1037
+ };
1038
+ var MAX_REACTIVE_RESOLVE_STEPS = 16;
1039
+ var resolveReactiveValue = (value) => {
1040
+ let resolved = value;
1041
+ let steps = 0;
1042
+ while (steps < MAX_REACTIVE_RESOLVE_STEPS) {
1043
+ if (resolved == null) break;
1044
+ if (isSignal(resolved) || isComputed(resolved)) {
1045
+ resolved = resolved();
1046
+ steps++;
1047
+ continue;
1048
+ }
1049
+ if (typeof resolved === "function") {
1050
+ resolved = resolved();
1051
+ steps++;
1052
+ continue;
1053
+ }
1054
+ break;
1055
+ }
1056
+ return resolved;
1057
+ };
1058
+ var createReactiveTextNode = (reactiveValue) => {
1059
+ const textNode = document.createTextNode("");
1060
+ let prev = textNode.data;
1061
+ createBindingEffect(() => {
1062
+ const next = normalizeTextNodeValue(resolveReactiveValue(reactiveValue));
1063
+ if (prev === next) return;
1064
+ textNode.data = next;
1065
+ prev = next;
1066
+ });
1067
+ return textNode;
1068
+ };
1069
+ var materializeComponentDescriptor = (descriptor) => {
1070
+ if (descriptor.instance instanceof Node) if (descriptor.instance instanceof DocumentFragment && descriptor.instance.childNodes.length === 0) {
1071
+ if (descriptor._owner) {
1072
+ disposeOwner(descriptor._owner);
1073
+ descriptor._owner = null;
1074
+ }
1075
+ descriptor.instance = null;
1076
+ } else return descriptor.instance;
1077
+ const owner = createOwner(currentOwner);
1078
+ let componentProps = descriptor.props ?? {};
1079
+ if (descriptor.children && descriptor.children.length > 0) {
1080
+ const kids = descriptor.children.length === 1 ? descriptor.children[0] : descriptor.children;
1081
+ componentProps = mergeProps(componentProps, { children: kids });
1082
+ }
1083
+ const prevOwner = currentOwner;
1084
+ const prevSub = getActiveSub();
1085
+ currentOwner = owner;
1086
+ setActiveSub(void 0);
1087
+ let normalized;
1088
+ try {
1089
+ normalized = node2Element(descriptor.tag(componentProps));
1090
+ } finally {
1091
+ currentOwner = prevOwner;
1092
+ setActiveSub(prevSub);
1093
+ }
1094
+ if (normalized instanceof DocumentFragment) {
1095
+ if (normalized.firstChild) normalized.firstChild[OWNER] = owner;
1096
+ } else if (normalized instanceof Node) normalized[OWNER] = owner;
1097
+ descriptor._owner = owner;
1098
+ descriptor.instance = normalized;
1099
+ return normalized;
1100
+ };
1101
+ var createReactiveChildNode = (reactiveValue) => {
1102
+ const start = document.createComment("dynamic-start");
1103
+ const end = document.createComment("dynamic-end");
1104
+ const fragment = document.createDocumentFragment();
1105
+ fragment.append(start, end);
1106
+ let mountedNodes = [];
1107
+ createBindingEffect(() => {
1108
+ const nextNode = node2Element(resolveReactiveValue(reactiveValue));
1109
+ if (nextNode instanceof DocumentFragment && nextNode[PENDING_DESCRIPTORS]) flushPendingDescriptors(nextNode);
1110
+ const parent = end.parentNode;
1111
+ if (!parent) return;
1112
+ mountedNodes.forEach((node) => {
1113
+ if (node.parentNode) node.parentNode.removeChild(node);
1114
+ });
1115
+ mountedNodes = [];
1116
+ if (nextNode instanceof DocumentFragment) mountedNodes = [...nextNode.childNodes];
1117
+ else mountedNodes = [nextNode];
1118
+ parent.insertBefore(nextNode, end);
1119
+ if (start.isConnected) mountedNodes.forEach((node) => mountOwnedSubtree(node));
1120
+ });
1121
+ if (currentOwner || getCurrentComputation()) registerCleanup(() => {
1122
+ mountedNodes.forEach((node) => {
1123
+ if (node.parentNode) node.parentNode.removeChild(node);
1124
+ });
1125
+ mountedNodes = [];
1126
+ if (start.parentNode) start.parentNode.removeChild(start);
1127
+ if (end.parentNode) end.parentNode.removeChild(end);
1128
+ });
1129
+ return fragment;
1130
+ };
1131
+ var applyClassNameMap = (element, classNameMap) => {
1132
+ if (!(classNameMap instanceof Map)) {
1133
+ const temp = /* @__PURE__ */ new Map();
1134
+ Object.entries(classNameMap).forEach(([className, enabled]) => {
1135
+ temp.set(className, enabled);
1136
+ });
1137
+ classNameMap = temp;
1138
+ }
1139
+ classNameMap.forEach((enabled, className) => {
1140
+ if (enabled && !element.classList.contains(className)) element.classList.add(className);
1141
+ if (!enabled && element.classList.contains(className)) element.classList.remove(className);
1142
+ });
1143
+ };
1144
+ var applyClassProp = (element, value) => {
1145
+ const expectedClass = toClassMap(value);
1146
+ const shouldRemove = [...new Set(element.classList)].filter((className) => !expectedClass.has(className));
1147
+ applyClassNameMap(element, new Map([...expectedClass, ...shouldRemove.map((className) => [className, false])]));
1148
+ };
1149
+ var applyStyleObject = (element, styles, prevStyles = {}) => {
1150
+ const nextStyles = styles ?? {};
1151
+ Object.keys(prevStyles).forEach((property) => {
1152
+ if (nextStyles[property] != null && nextStyles[property] !== false) return;
1153
+ clearStyleKey(element, property);
1154
+ delete prevStyles[property];
1155
+ });
1156
+ Object.entries(nextStyles).forEach(([property, value]) => {
1157
+ if (value == null || value === false) return;
1158
+ const nextValue = String(value);
1159
+ if (prevStyles[property] === nextValue) return;
1160
+ if (property.startsWith("--")) element.style.setProperty(property, nextValue);
1161
+ else element.style[property] = nextValue;
1162
+ prevStyles[property] = nextValue;
1163
+ });
1164
+ return prevStyles;
1165
+ };
1166
+ var clearStyleKey = (element, key) => {
1167
+ if (key.startsWith("--")) element.style.removeProperty(key);
1168
+ else element.style[key] = "";
1169
+ };
1170
+ var applyStyleProp = (element, value, prevValue) => {
1171
+ if (value == null || value === false) {
1172
+ element.style.cssText = "";
1173
+ return;
1174
+ }
1175
+ if (typeof value === "string") {
1176
+ element.style.cssText = value;
1177
+ return value;
1178
+ }
1179
+ if (typeof value === "object") return applyStyleObject(element, value, typeof prevValue === "string" ? void 0 : prevValue);
1180
+ return prevValue;
1181
+ };
1182
+ var clearDomProp = (element, key) => {
1183
+ if (key in element) try {
1184
+ element[key] = "";
1185
+ } catch {}
1186
+ element.removeAttribute(key);
1187
+ };
1188
+ var setDomProp = (element, key, value) => {
1189
+ if (isBooleanDomProp(element, key)) {
1190
+ const next = Boolean(value);
1191
+ const prev = element[key];
1192
+ const hasAttribute = element.hasAttribute(key);
1193
+ if (prev === next && (next && hasAttribute || !next && !hasAttribute)) return;
1194
+ element[key] = next;
1195
+ if (next) {
1196
+ element.setAttribute(key, "");
1197
+ return;
1198
+ }
1199
+ element.removeAttribute(key);
1200
+ return;
1201
+ }
1202
+ if (value == null || value === false) {
1203
+ if (!(value === false && typeof key === "string" && key.startsWith("aria-"))) {
1204
+ if ((key in element ? element[key] : "") === "" && !element.hasAttribute(key)) return;
1205
+ clearDomProp(element, key);
1206
+ return;
1207
+ }
1208
+ }
1209
+ if (key in element) {
1210
+ if (element[key] === value) return;
1211
+ try {
1212
+ element[key] = value;
1213
+ return;
1214
+ } catch {}
1215
+ }
1216
+ const next = String(value);
1217
+ if (element.getAttribute(key) === next) return;
1218
+ element.setAttribute(key, next);
1219
+ };
1220
+ var applyRefProp = (element, ref) => {
1221
+ if (typeof ref !== "function") return;
1222
+ const assignRef = (value) => ref(value);
1223
+ const owner = currentOwner;
1224
+ if (owner && !owner.mounted) (owner.refs ??= []).push(() => assignRef(element));
1225
+ else assignRef(element);
1226
+ if (owner || getCurrentComputation()) registerCleanup(() => {
1227
+ assignRef(null);
1228
+ });
1229
+ };
1230
+ var bindReactiveProp = (element, props, key, propsIsTracked) => {
1231
+ const rawValue = props[key];
1232
+ const descriptor = propsIsTracked ? null : Object.getOwnPropertyDescriptor(props, key);
1233
+ const hasGetter = descriptor != null && typeof descriptor.get === "function";
1234
+ if (!propsIsTracked && !hasGetter && !isReactive(rawValue)) {
1235
+ let prevStyleValue;
1236
+ if (key === "className" || key === "class") applyClassProp(element, rawValue);
1237
+ else if (key === "style") prevStyleValue = applyStyleProp(element, rawValue, void 0);
1238
+ else setDomProp(element, JSX_PROP_MAP[key] ?? key, rawValue);
1239
+ return () => {
1240
+ if (key === "className" || key === "class") {
1241
+ element.removeAttribute("class");
1242
+ return;
1243
+ }
1244
+ if (key === "style") {
1245
+ if (prevStyleValue && typeof prevStyleValue === "object") Object.keys(prevStyleValue).forEach((prop) => clearStyleKey(element, prop));
1246
+ else if (typeof prevStyleValue === "string") element.style.cssText = "";
1247
+ return;
1248
+ }
1249
+ clearDomProp(element, JSX_PROP_MAP[key] ?? key);
1250
+ };
1251
+ }
1252
+ let prevStyleValue;
1253
+ const stop = createBindingEffect(() => {
1254
+ const value = resolveReactiveValue(props[key]);
1255
+ if (key === "className" || key === "class") {
1256
+ applyClassProp(element, value);
1257
+ return;
1258
+ }
1259
+ if (key === "style") {
1260
+ prevStyleValue = applyStyleProp(element, value, prevStyleValue);
1261
+ return;
1262
+ }
1263
+ setDomProp(element, JSX_PROP_MAP[key] ?? key, value);
1264
+ });
1265
+ return () => {
1266
+ stop?.();
1267
+ if (key === "className" || key === "class") {
1268
+ element.removeAttribute("class");
1269
+ return;
1270
+ }
1271
+ if (key === "style") {
1272
+ if (prevStyleValue && typeof prevStyleValue === "object") Object.keys(prevStyleValue).forEach((prop) => clearStyleKey(element, prop));
1273
+ else if (typeof prevStyleValue === "string") element.style.cssText = "";
1274
+ return;
1275
+ }
1276
+ clearDomProp(element, JSX_PROP_MAP[key] ?? key);
1277
+ };
1278
+ };
1279
+ var bindReactiveEvent = (element, props, key) => {
1280
+ const eventName = key.slice(2).toLowerCase();
1281
+ if (!isSupportedEvent(element, eventName)) return () => {};
1282
+ const listener = (...args) => {
1283
+ const handler = props[key];
1284
+ if (typeof handler === "function") handler(...args);
1285
+ };
1286
+ element.addEventListener(eventName, listener);
1287
+ if (currentOwner || getCurrentComputation()) registerCleanup(() => {
1288
+ element.removeEventListener(eventName, listener);
1289
+ });
1290
+ return () => {
1291
+ element.removeEventListener(eventName, listener);
1292
+ };
1293
+ };
1294
+ var applyProps = (element, props = {}) => {
1295
+ const propsIsTracked = isMergedProps(props) || isTree(props);
1296
+ const bindings = /* @__PURE__ */ new Map();
1297
+ const createBindingForKey = (key) => {
1298
+ if (key === "classList") throw new Error("classList prop is not supported. Use className instead.");
1299
+ const prevComp = getCurrentComputation();
1300
+ const prevSub = getActiveSub();
1301
+ setCurrentComputation(null);
1302
+ setActiveSub(void 0);
1303
+ try {
1304
+ if (key === "ref") {
1305
+ const ref = props[key];
1306
+ applyRefProp(element, ref);
1307
+ return () => {
1308
+ if (typeof ref === "function") ref(null);
1309
+ };
1310
+ }
1311
+ if (isEventProp(key)) return bindReactiveEvent(element, props, key);
1312
+ return bindReactiveProp(element, props, key, propsIsTracked);
1313
+ } finally {
1314
+ setCurrentComputation(prevComp);
1315
+ setActiveSub(prevSub);
1316
+ }
1317
+ };
1318
+ const setup = () => {
1319
+ const nextKeys = /* @__PURE__ */ new Set();
1320
+ for (const key of Reflect.ownKeys(props)) {
1321
+ if (typeof key === "symbol" || key === "children" || key === "key") continue;
1322
+ nextKeys.add(key);
1323
+ }
1324
+ for (const [key, dispose] of bindings) {
1325
+ if (nextKeys.has(key)) continue;
1326
+ if (typeof dispose === "function") dispose();
1327
+ bindings.delete(key);
1328
+ }
1329
+ for (const key of nextKeys) {
1330
+ if (bindings.has(key)) continue;
1331
+ bindings.set(key, createBindingForKey(key));
1332
+ }
1333
+ };
1334
+ if (currentOwner || getCurrentComputation()) registerCleanup(() => {
1335
+ for (const dispose of bindings.values()) if (typeof dispose === "function") dispose();
1336
+ bindings.clear();
1337
+ });
1338
+ if (isMergedProps(props) && !hasMergedPropsStaticKeys(props) || isTree(props)) createBindingEffect(setup);
1339
+ else setup();
1340
+ return element;
1341
+ };
1342
+ var node2Element = (node) => {
1343
+ switch (typeof node) {
1344
+ case "string":
1345
+ case "number": return document.createTextNode(String(node));
1346
+ case "function":
1347
+ if (isReactivePrimitive(node)) return createReactiveTextNode(node);
1348
+ return createReactiveChildNode(node);
1349
+ case "undefined": return createPlaceholder();
1350
+ case "object":
1351
+ if (node === null) return createPlaceholder();
1352
+ if (typeof node.nodeType === "number") {
1353
+ flushPendingDescriptors(node);
1354
+ return node;
1355
+ }
1356
+ if (node[COMPONENT_DESCRIPTOR] === true) return materializeComponentDescriptor(node);
1357
+ if (Array.isArray(node)) {
1358
+ const fragment = document.createDocumentFragment();
1359
+ appendChildren(fragment, node);
1360
+ return fragment;
1361
+ }
1362
+ return createPlaceholder();
1363
+ default: return createPlaceholder();
1364
+ }
1365
+ };
1366
+ var flushPendingDescriptors = (root) => {
1367
+ if (!(root instanceof Element) && !(root instanceof DocumentFragment)) return;
1368
+ const stack = [root];
1369
+ while (stack.length) {
1370
+ const node = stack.pop();
1371
+ const pending = node[PENDING_DESCRIPTORS];
1372
+ if (pending) {
1373
+ node[PENDING_DESCRIPTORS] = void 0;
1374
+ pending.forEach(({ placeholder, descriptor }) => {
1375
+ if (!placeholder.parentNode) return;
1376
+ const materialized = node2Element(descriptor);
1377
+ if (materialized instanceof DocumentFragment && materialized[PENDING_DESCRIPTORS]) flushPendingDescriptors(materialized);
1378
+ placeholder.parentNode.replaceChild(materialized, placeholder);
1379
+ });
1380
+ }
1381
+ for (const child of node.childNodes) if (child instanceof Element) stack.push(child);
1382
+ }
1383
+ };
1384
+ var appendChild = (parent, child) => {
1385
+ if (child == null) return parent;
1386
+ if ((isComponentDescriptor(child) || typeof child === "function") && currentOwner != null && (parent instanceof Element || parent instanceof DocumentFragment)) {
1387
+ const placeholder = document.createComment("pending");
1388
+ parent.appendChild(placeholder);
1389
+ (parent[PENDING_DESCRIPTORS] ?? (parent[PENDING_DESCRIPTORS] = [])).push({
1390
+ placeholder,
1391
+ descriptor: child
1392
+ });
1393
+ return parent;
1394
+ }
1395
+ if (child instanceof Element && currentOwner != null && (parent instanceof Element || parent instanceof DocumentFragment)) {
1396
+ const stack = [child];
1397
+ while (stack.length) {
1398
+ const node = stack.pop();
1399
+ const pending = node[PENDING_DESCRIPTORS];
1400
+ if (pending) {
1401
+ node[PENDING_DESCRIPTORS] = void 0;
1402
+ (parent[PENDING_DESCRIPTORS] ?? (parent[PENDING_DESCRIPTORS] = [])).push(...pending);
1403
+ }
1404
+ for (const grandchild of node.childNodes) if (grandchild instanceof Element) stack.push(grandchild);
1405
+ }
1406
+ parent.appendChild(child);
1407
+ return parent;
1408
+ }
1409
+ const childNode = node2Element(child);
1410
+ if (childNode instanceof DocumentFragment && childNode[PENDING_DESCRIPTORS] && (parent instanceof Element || parent instanceof DocumentFragment)) {
1411
+ (parent[PENDING_DESCRIPTORS] ?? (parent[PENDING_DESCRIPTORS] = [])).push(...childNode[PENDING_DESCRIPTORS]);
1412
+ childNode[PENDING_DESCRIPTORS] = void 0;
1413
+ }
1414
+ parent.appendChild(childNode);
1415
+ return parent;
1416
+ };
1417
+ var appendChildren = (parent, children) => {
1418
+ flattenChildren(children).forEach((child) => {
1419
+ appendChild(parent, child);
1420
+ });
1421
+ return parent;
1422
+ };
1423
+ var { mountDynamic, Either, True, False, Match, Case, Default, Loop: Loop$1, Portal: Portal$1 } = createControlFlow({
1424
+ createOwner,
1425
+ runOwnerMounts,
1426
+ runWithOwner,
1427
+ disposeOwner,
1428
+ createBindingEffect,
1429
+ renderInOwner,
1430
+ getCurrentOwner,
1431
+ registerCleanup,
1432
+ batch,
1433
+ appendChild,
1434
+ flushPendingDescriptors
1435
+ });
1436
+ var SVG_TAGS = new Set([
1437
+ "svg",
1438
+ "animate",
1439
+ "animateMotion",
1440
+ "animateTransform",
1441
+ "circle",
1442
+ "clipPath",
1443
+ "defs",
1444
+ "desc",
1445
+ "ellipse",
1446
+ "feBlend",
1447
+ "feColorMatrix",
1448
+ "feComponentTransfer",
1449
+ "feComposite",
1450
+ "feConvolveMatrix",
1451
+ "feDiffuseLighting",
1452
+ "feDisplacementMap",
1453
+ "feDistantLight",
1454
+ "feDropShadow",
1455
+ "feFlood",
1456
+ "feFuncA",
1457
+ "feFuncB",
1458
+ "feFuncG",
1459
+ "feFuncR",
1460
+ "feGaussianBlur",
1461
+ "feImage",
1462
+ "feMerge",
1463
+ "feMergeNode",
1464
+ "feMorphology",
1465
+ "feOffset",
1466
+ "fePointLight",
1467
+ "feSpecularLighting",
1468
+ "feSpotLight",
1469
+ "feTile",
1470
+ "feTurbulence",
1471
+ "filter",
1472
+ "foreignObject",
1473
+ "g",
1474
+ "image",
1475
+ "line",
1476
+ "linearGradient",
1477
+ "marker",
1478
+ "mask",
1479
+ "metadata",
1480
+ "mpath",
1481
+ "path",
1482
+ "pattern",
1483
+ "polygon",
1484
+ "polyline",
1485
+ "radialGradient",
1486
+ "rect",
1487
+ "set",
1488
+ "stop",
1489
+ "switch",
1490
+ "symbol",
1491
+ "text",
1492
+ "textPath",
1493
+ "tspan",
1494
+ "use",
1495
+ "view"
1496
+ ]);
1497
+ var h = (tag, props, ...children) => {
1498
+ const nextProps = props || {};
1499
+ if (tag === Fragment) {
1500
+ const propChildren = nextProps.children ?? [];
1501
+ const mergedChildren = [...Array.isArray(propChildren) ? propChildren : [propChildren], ...children];
1502
+ const fragment = document.createDocumentFragment();
1503
+ appendChildren(fragment, mergedChildren);
1504
+ return fragment;
1505
+ }
1506
+ if (typeof tag === "function") return createComponentDescriptor(tag, nextProps, children);
1507
+ if (typeof tag !== "string") throw new Error("Only static string tags and Fragment are supported.");
1508
+ const element = SVG_TAGS.has(tag) ? document.createElementNS("http://www.w3.org/2000/svg", tag) : document.createElement(tag);
1509
+ applyProps(element, nextProps);
1510
+ const propChildren = nextProps.children ?? [];
1511
+ appendChildren(element, [...Array.isArray(propChildren) ? propChildren : [propChildren], ...children]);
1512
+ return element;
1513
+ };
1514
+ var jsx = (tag, props, key) => {
1515
+ if (key === void 0) return h(tag, props);
1516
+ return h(tag, mergeProps(props, { key }));
1517
+ };
1518
+ var applyStaticProp = (element, key, value) => {
1519
+ if (key === "className" || key === "class") {
1520
+ applyClassProp(element, value);
1521
+ return;
1522
+ }
1523
+ if (key === "style") {
1524
+ applyStyleProp(element, value, void 0);
1525
+ return;
1526
+ }
1527
+ setDomProp(element, JSX_PROP_MAP[key] ?? key, value);
1528
+ };
1529
+ var template = (html, isSVG = false) => {
1530
+ const t = document.createElement("template");
1531
+ if (isSVG) {
1532
+ t.innerHTML = `<svg>${html}</svg>`;
1533
+ const svgRoot = t.content.firstChild;
1534
+ return svgRoot.firstChild ?? svgRoot;
1535
+ }
1536
+ t.innerHTML = html;
1537
+ return t.content.firstChild;
1538
+ };
1539
+ var resolveChildToNodes = (value, out) => {
1540
+ let v = value;
1541
+ let steps = 0;
1542
+ while (typeof v === "function" && !isReactivePrimitive(v) && steps < MAX_REACTIVE_RESOLVE_STEPS) {
1543
+ v = v();
1544
+ steps += 1;
1545
+ }
1546
+ if (v == null || v === true || v === false) return;
1547
+ if (v instanceof Node) {
1548
+ out.push(v);
1549
+ return;
1550
+ }
1551
+ if (Array.isArray(v)) {
1552
+ for (const item of v) resolveChildToNodes(item, out);
1553
+ return;
1554
+ }
1555
+ if (isComponentDescriptor(v)) {
1556
+ out.push(materializeComponentDescriptor(v));
1557
+ return;
1558
+ }
1559
+ if (isReactivePrimitive(v)) {
1560
+ out.push(createReactiveTextNode(v));
1561
+ return;
1562
+ }
1563
+ out.push(document.createTextNode(String(v)));
1564
+ };
1565
+ var insert = (parent, accessor, marker = null) => {
1566
+ if (typeof accessor !== "function") {
1567
+ const nodes = [];
1568
+ resolveChildToNodes(accessor, nodes);
1569
+ for (const n of nodes) parent.insertBefore(n, marker);
1570
+ return;
1571
+ }
1572
+ let current = [];
1573
+ createBindingEffect(() => {
1574
+ const next = accessor();
1575
+ if (current.length === 1 && current[0].nodeType === 3 && (typeof next === "string" || typeof next === "number")) {
1576
+ const str = String(next);
1577
+ if (current[0].data !== str) current[0].data = str;
1578
+ return;
1579
+ }
1580
+ const nodes = [];
1581
+ resolveChildToNodes(next, nodes);
1582
+ for (const n of current) if (n.parentNode === parent) parent.removeChild(n);
1583
+ for (const n of nodes) parent.insertBefore(n, marker);
1584
+ if (parent.isConnected) for (const n of nodes) mountOwnedSubtree(n);
1585
+ current = nodes;
1586
+ });
1587
+ };
1588
+ var setProp = (element, key, accessor) => {
1589
+ if (key === "ref") {
1590
+ applyRefProp(element, typeof accessor === "function" && accessor.length === 0 ? accessor() : accessor);
1591
+ return;
1592
+ }
1593
+ if (isEventProp(key)) {
1594
+ const eventName = key.slice(2).toLowerCase();
1595
+ if (!isSupportedEvent(element, eventName)) return;
1596
+ const listener = (...args) => {
1597
+ const handler = accessor;
1598
+ if (typeof handler === "function") {
1599
+ const unwrapped = handler(...args);
1600
+ if (typeof unwrapped === "function") unwrapped(...args);
1601
+ }
1602
+ };
1603
+ element.addEventListener(eventName, listener);
1604
+ if (currentOwner || getCurrentComputation()) registerCleanup(() => {
1605
+ element.removeEventListener(eventName, listener);
1606
+ });
1607
+ return;
1608
+ }
1609
+ if (typeof accessor !== "function" || isReactivePrimitive(accessor)) {
1610
+ if (!isReactive(accessor)) {
1611
+ applyStaticProp(element, key, accessor);
1612
+ return;
1613
+ }
1614
+ }
1615
+ let prevStyle;
1616
+ createBindingEffect(() => {
1617
+ const v = resolveReactiveValue(accessor);
1618
+ if (key === "className" || key === "class") {
1619
+ applyClassProp(element, v);
1620
+ return;
1621
+ }
1622
+ if (key === "style") {
1623
+ prevStyle = applyStyleProp(element, v, prevStyle);
1624
+ return;
1625
+ }
1626
+ setDomProp(element, JSX_PROP_MAP[key] ?? key, v);
1627
+ });
1628
+ };
1629
+ //#endregion
1630
+ //#region src/components/CardNumberInput.jsx
1631
+ var _tmpl$8 = template("<div></div>");
1632
+ var wrapperClass$3 = css({
1633
+ display: "flex",
1634
+ alignItems: "center",
1635
+ width: "100%",
1636
+ boxSizing: "border-box",
1637
+ height: "44px",
1638
+ background: "var(--bg, rgba(0,0,0,0.2))",
1639
+ border: "1px solid var(--border)",
1640
+ borderRadius: "10px",
1641
+ padding: "0 14px",
1642
+ "&:focus-within": { borderColor: "var(--accent)" }
1643
+ });
1644
+ var errorClass$1 = css({ borderColor: "var(--danger) !important" });
1645
+ var inputClass$2 = css({
1646
+ flex: 1,
1647
+ minWidth: 0,
1648
+ height: "100%",
1649
+ background: "transparent",
1650
+ border: "none",
1651
+ color: "var(--ink)",
1652
+ fontSize: "15px",
1653
+ fontFamily: "inherit",
1654
+ outline: "none",
1655
+ letterSpacing: "1.5px",
1656
+ "&::placeholder": {
1657
+ color: "var(--muted)",
1658
+ letterSpacing: "normal"
1659
+ }
1660
+ });
1661
+ var read$1 = (value) => {
1662
+ return typeof value === "function" ? value() : value;
1663
+ };
1664
+ var groupDigits = (digits) => {
1665
+ if (!digits) return "";
1666
+ return digits.replace(/(\d{4})(?=\d)/g, "$1-");
1667
+ };
1668
+ var CardNumberInput = (props) => {
1669
+ const [local, rest] = splitProps(props, [
1670
+ "value",
1671
+ "onValueChange",
1672
+ "invalid",
1673
+ "placeholder"
1674
+ ]);
1675
+ return (() => {
1676
+ const _el0 = _tmpl$8.cloneNode(true);
1677
+ insert(_el0, () => jsx("input", mergeProps({
1678
+ className: inputClass$2,
1679
+ inputMode: "numeric",
1680
+ onInput: (e) => local.onValueChange?.(e.target.value.replace(/\D/g, "")),
1681
+ get placeholder() {
1682
+ return local.placeholder ?? "0000-0000-0000-0000";
1683
+ },
1684
+ value: () => groupDigits(read$1(local.value))
1685
+ }, rest)));
1686
+ setProp(_el0, "className", () => `${wrapperClass$3} ${read$1(local.invalid) ? errorClass$1 : ""}`);
1687
+ return _el0;
1688
+ })();
1689
+ };
1690
+ //#endregion
1691
+ //#region src/components/Carousel.jsx
1692
+ var Carousel_default = Carousel;
1693
+ //#endregion
1694
+ //#region src/components/Checkbox.jsx
1695
+ var Checkbox_default = Checkbox;
1696
+ //#endregion
1697
+ //#region src/components/Clipboard.jsx
1698
+ var Clipboard_default = Clipboard;
1699
+ //#endregion
1700
+ //#region src/components/Collapsible.jsx
1701
+ var Collapsible_default = Collapsible;
1702
+ //#endregion
1703
+ //#region src/components/ColorPicker.jsx
1704
+ var ColorPicker_default = ColorPicker;
1705
+ //#endregion
1706
+ //#region src/components/Combobox.jsx
1707
+ var OriginalRoot$1 = Combobox.Root;
1708
+ var Root$2 = (props = {}) => jsx(OriginalRoot$1, mergeProps(props));
1709
+ var Input$1 = (props = {}) => {
1710
+ const combobox = useComboboxContext();
1711
+ return jsx(Combobox.Input, mergeProps(props, { onInput: (event) => combobox().getInputProps().onChange?.(event) }));
1712
+ };
1713
+ var Combobox_default = Object.assign(Root$2, {
1714
+ ...Combobox,
1715
+ OriginalRoot: OriginalRoot$1,
1716
+ Root: Root$2,
1717
+ Input: Input$1
1718
+ });
1719
+ //#endregion
1720
+ //#region src/components/Portal.jsx
1721
+ var Portal_default = Portal;
1722
+ //#endregion
1723
+ //#region src/components/Icon.jsx
1724
+ var _tmpl$7 = template("<span></span>");
1725
+ var iconClass$1 = css({
1726
+ display: "inline-flex",
1727
+ alignItems: "center",
1728
+ justifyContent: "center",
1729
+ color: "currentColor",
1730
+ "& svg": {
1731
+ width: "100%",
1732
+ height: "100%",
1733
+ display: "block",
1734
+ strokeWidth: "var(--icon-sw)"
1735
+ }
1736
+ });
1737
+ var Icon = ({ svg, size = 22, strokeWidth = 1.25, className }) => {
1738
+ const style = {
1739
+ width: `${size}px`,
1740
+ height: `${size}px`,
1741
+ "--icon-sw": strokeWidth
1742
+ };
1743
+ const setEl = (el) => {
1744
+ if (el && el.innerHTML !== svg) el.innerHTML = svg;
1745
+ };
1746
+ return (() => {
1747
+ const _el0 = _tmpl$7.cloneNode(true);
1748
+ setProp(_el0, "className", () => className ? `${iconClass$1} ${className}` : iconClass$1);
1749
+ setProp(_el0, "ref", () => setEl);
1750
+ setProp(_el0, "style", () => style);
1751
+ return _el0;
1752
+ })();
1753
+ };
1754
+ //#endregion
1755
+ //#region src/components/Dialog.jsx
1756
+ var _tmpl4 = template("<button type=\"button\"></button>");
1757
+ var _tmpl3$1 = template("<div><!><!></div>");
1758
+ var _tmpl2$4 = template("<div></div>");
1759
+ var _tmpl$6 = template("<div><div><!><!></div><!></div>");
1760
+ var backdropClass = css({
1761
+ position: "fixed",
1762
+ inset: 0,
1763
+ background: "rgba(0, 0, 0, 0.6)",
1764
+ backdropFilter: "blur(4px)",
1765
+ zIndex: 9998,
1766
+ "&[hidden]": { display: "none" }
1767
+ });
1768
+ var positionerClass = css({
1769
+ position: "fixed",
1770
+ inset: 0,
1771
+ display: "flex",
1772
+ alignItems: "flex-end",
1773
+ justifyContent: "center",
1774
+ zIndex: 9999,
1775
+ "@media (min-width: 640px)": {
1776
+ alignItems: "center",
1777
+ padding: "24px"
1778
+ }
1779
+ });
1780
+ var contentClass$1 = css({
1781
+ background: "var(--surface)",
1782
+ border: "1px solid var(--border)",
1783
+ borderRadius: "20px 20px 0 0",
1784
+ width: "100%",
1785
+ maxWidth: "480px",
1786
+ maxHeight: "92vh",
1787
+ display: "flex",
1788
+ flexDirection: "column",
1789
+ color: "var(--ink)",
1790
+ boxShadow: "0 -8px 32px rgba(0,0,0,0.4)",
1791
+ "&[hidden]": { display: "none" },
1792
+ "@media (min-width: 640px)": { borderRadius: "20px" }
1793
+ });
1794
+ var headClass = css({
1795
+ display: "flex",
1796
+ alignItems: "center",
1797
+ justifyContent: "space-between",
1798
+ padding: "18px 20px",
1799
+ borderBottom: "1px solid var(--border)"
1800
+ });
1801
+ var titleWrapClass = css({
1802
+ display: "flex",
1803
+ alignItems: "center",
1804
+ gap: "10px",
1805
+ minWidth: 0
1806
+ });
1807
+ var titleIconClass = css({
1808
+ flexShrink: 0,
1809
+ color: "var(--accent)"
1810
+ });
1811
+ var titleClass = css({
1812
+ fontSize: "18px",
1813
+ fontWeight: 700,
1814
+ margin: 0
1815
+ });
1816
+ var closeBtnClass = css({
1817
+ width: "32px",
1818
+ height: "32px",
1819
+ borderRadius: "50%",
1820
+ background: "transparent",
1821
+ border: "none",
1822
+ color: "var(--muted)",
1823
+ fontSize: "22px",
1824
+ lineHeight: 1,
1825
+ cursor: "pointer",
1826
+ display: "flex",
1827
+ alignItems: "center",
1828
+ justifyContent: "center",
1829
+ "&:hover": {
1830
+ background: "rgba(255,255,255,0.06)",
1831
+ color: "var(--ink)"
1832
+ },
1833
+ "&[hidden]": { display: "none" }
1834
+ });
1835
+ var bodyClass = css({
1836
+ padding: "20px",
1837
+ overflowY: "auto"
1838
+ });
1839
+ var footClass = css({
1840
+ display: "flex",
1841
+ gap: "10px",
1842
+ padding: "14px 20px 20px",
1843
+ borderTop: "1px solid var(--border)"
1844
+ });
1845
+ var btnClass = css({
1846
+ flex: 1,
1847
+ height: "46px",
1848
+ borderRadius: "10px",
1849
+ border: "1px solid var(--border)",
1850
+ background: "transparent",
1851
+ color: "var(--ink)",
1852
+ fontSize: "15px",
1853
+ fontWeight: 600,
1854
+ fontFamily: "inherit",
1855
+ cursor: "pointer",
1856
+ "&:hover": { borderColor: "rgba(255,255,255,0.2)" }
1857
+ });
1858
+ var btnPrimaryClass = css({
1859
+ background: "var(--accent)",
1860
+ borderColor: "var(--accent)",
1861
+ color: "#fff",
1862
+ "&:hover": { filter: "brightness(1.08)" },
1863
+ "&:disabled": {
1864
+ opacity: .5,
1865
+ cursor: "not-allowed"
1866
+ }
1867
+ });
1868
+ var OriginalRoot = Dialog.Root;
1869
+ var Root$1 = (props = {}) => {
1870
+ const [local, rest] = splitProps(props, [
1871
+ "onOpen",
1872
+ "onClose",
1873
+ "onOpenChange",
1874
+ "closeOnInteractOutside"
1875
+ ]);
1876
+ return OriginalRoot({
1877
+ ...rest,
1878
+ closeOnInteractOutside: local.closeOnInteractOutside ?? false,
1879
+ onOpenChange: (open) => {
1880
+ local.onOpenChange?.(open);
1881
+ if (open) local.onOpen?.();
1882
+ else local.onClose?.();
1883
+ }
1884
+ });
1885
+ };
1886
+ var Preset = (props) => {
1887
+ const [local, rootProps] = splitProps(props, [
1888
+ "title",
1889
+ "icon",
1890
+ "cancelText",
1891
+ "confirmText",
1892
+ "onConfirm",
1893
+ "loading",
1894
+ "children"
1895
+ ]);
1896
+ return jsx(Root$1, mergeProps(rootProps, { children: jsx(Portal_default, mergeProps({ children: [jsx(Dialog.Backdrop, mergeProps({ className: backdropClass })), jsx(Dialog.Positioner, mergeProps({
1897
+ className: positionerClass,
1898
+ children: jsx(Dialog.Content, mergeProps({
1899
+ className: contentClass$1,
1900
+ children: [
1901
+ () => {
1902
+ const _el0 = _tmpl$6.cloneNode(true);
1903
+ const _el1 = _el0.firstChild;
1904
+ const _el2 = _el1.firstChild;
1905
+ const _el3 = _el1.firstChild.nextSibling;
1906
+ const _el4 = _el0.firstChild.nextSibling;
1907
+ insert(_el1, () => local.icon && jsx(Icon, mergeProps({
1908
+ className: titleIconClass,
1909
+ size: 20,
1910
+ get svg() {
1911
+ return local.icon;
1912
+ }
1913
+ })), _el2);
1914
+ insert(_el1, () => jsx(Dialog.Title, mergeProps({
1915
+ className: titleClass,
1916
+ children: () => local.title
1917
+ })), _el3);
1918
+ setProp(_el1, "className", () => titleWrapClass);
1919
+ insert(_el0, () => jsx(Dialog.CloseTrigger, mergeProps({
1920
+ "aria-label": "Close",
1921
+ className: closeBtnClass,
1922
+ hidden: true,
1923
+ children: "×"
1924
+ })), _el4);
1925
+ setProp(_el0, "className", () => headClass);
1926
+ return _el0;
1927
+ },
1928
+ () => {
1929
+ const _el0 = _tmpl2$4.cloneNode(true);
1930
+ insert(_el0, () => local.children);
1931
+ setProp(_el0, "className", () => bodyClass);
1932
+ return _el0;
1933
+ },
1934
+ () => ((local.cancelText ?? "Cancel") || (local.confirmText ?? "Confirm")) && (() => {
1935
+ const _el0 = _tmpl3$1.cloneNode(true);
1936
+ const _el1 = _el0.firstChild;
1937
+ const _el2 = _el0.firstChild.nextSibling;
1938
+ insert(_el0, () => jsx(Dialog.CloseTrigger, mergeProps({
1939
+ className: btnClass,
1940
+ type: "button",
1941
+ children: () => local.cancelText ?? "Cancel"
1942
+ })), _el1);
1943
+ insert(_el0, () => (local.confirmText ?? "Confirm") && (() => {
1944
+ const _el0 = _tmpl4.cloneNode(true);
1945
+ insert(_el0, () => local.loading?.() ? "Loading…" : local.confirmText ?? "Confirm");
1946
+ setProp(_el0, "className", () => `${btnClass} ${btnPrimaryClass}`);
1947
+ setProp(_el0, "disabled", () => local.loading?.());
1948
+ setProp(_el0, "onClick", () => local.onConfirm);
1949
+ return _el0;
1950
+ }), _el2);
1951
+ setProp(_el0, "className", () => footClass);
1952
+ return _el0;
1953
+ })
1954
+ ]
1955
+ }))
1956
+ }))] })) }));
1957
+ };
1958
+ var Dialog_default = Object.assign(Root$1, {
1959
+ ...Dialog,
1960
+ OriginalRoot: Root$1,
1961
+ Root: Preset
1962
+ });
1963
+ //#endregion
1964
+ //#region src/components/ConfirmDialog.jsx
1965
+ var _tmpl$5 = template("<p></p>");
1966
+ var messageClass = css({
1967
+ fontSize: "15px",
1968
+ lineHeight: 1.5,
1969
+ color: "var(--ink)",
1970
+ textAlign: "center",
1971
+ padding: "8px 0"
1972
+ });
1973
+ var ConfirmDialog = ({ open, onOpenChange, onConfirm, loading, title, message, confirmText, cancelText }) => {
1974
+ const handleConfirm = () => {
1975
+ onConfirm?.();
1976
+ };
1977
+ return jsx(Dialog_default.Root, mergeProps({
1978
+ cancelText: cancelText ?? "Cancel",
1979
+ confirmText: confirmText ?? "Delete",
1980
+ loading,
1981
+ onConfirm: handleConfirm,
1982
+ onOpenChange,
1983
+ open,
1984
+ title: title ?? "Confirm",
1985
+ children: () => {
1986
+ const _el0 = _tmpl$5.cloneNode(true);
1987
+ insert(_el0, () => message);
1988
+ setProp(_el0, "className", () => messageClass);
1989
+ return _el0;
1990
+ }
1991
+ }));
1992
+ };
1993
+ //#endregion
1994
+ //#region src/components/DateInput.jsx
1995
+ var DateInput_default = DateInput;
1996
+ //#endregion
1997
+ //#region src/components/DatePicker.jsx
1998
+ var DatePicker_default = DatePicker;
1999
+ //#endregion
2000
+ //#region src/components/Drawer.jsx
2001
+ var Drawer_default = Drawer;
2002
+ //#endregion
2003
+ //#region src/components/Field.jsx
2004
+ var Field_default = Field;
2005
+ //#endregion
2006
+ //#region src/components/Fieldset.jsx
2007
+ var Fieldset_default = Fieldset;
2008
+ //#endregion
2009
+ //#region src/components/FileUpload.jsx
2010
+ var FileUpload_default = FileUpload;
2011
+ //#endregion
2012
+ //#region src/components/FilteredSelect.jsx
2013
+ var _tmpl3 = template("<span></span>");
2014
+ var _tmpl2$3 = template("<svg fill=\"none\" stroke=\"currentColor\" strokeLinecap=\"round\" strokeLinejoin=\"round\" strokeWidth=\"2.5\" viewBox=\"0 0 24 24\"><polyline points=\"20 6 9 17 4 12\"></polyline></svg>");
2015
+ var _tmpl$4 = template("<svg fill=\"none\" stroke=\"currentColor\" strokeLinecap=\"round\" strokeLinejoin=\"round\" strokeWidth=\"2\" viewBox=\"0 0 24 24\"><polyline points=\"6 9 12 15 18 9\"></polyline></svg>");
2016
+ var access = (value) => {
2017
+ return typeof value === "function" ? value() : value;
2018
+ };
2019
+ var FilterContext = createContext(null);
2020
+ var defaultItemToValue = (item) => String(item?.value ?? item?.id ?? item);
2021
+ var defaultItemToString = (item) => String(item?.label ?? item?.name ?? item);
2022
+ var defaultFilter = (item, query, itemToString) => itemToString(item).toLowerCase().includes(query);
2023
+ var Root = (props = {}) => {
2024
+ const [local, rest] = splitProps(props, [
2025
+ "items",
2026
+ "itemToValue",
2027
+ "itemToString",
2028
+ "filter",
2029
+ "inputValue",
2030
+ "onInputValueChange",
2031
+ "children"
2032
+ ]);
2033
+ const itemToValue = local.itemToValue ?? defaultItemToValue;
2034
+ const itemToString = local.itemToString ?? defaultItemToString;
2035
+ const filter = local.filter ?? defaultFilter;
2036
+ const query = createSignal(access(local.inputValue) ?? "");
2037
+ const filteredItems = createComputed(() => {
2038
+ const q = query().trim().toLowerCase();
2039
+ const list = access(local.items) ?? [];
2040
+ return q ? list.filter((item) => filter(item, q, itemToString)) : list;
2041
+ });
2042
+ const collection$1 = createComputed(() => collection({
2043
+ items: filteredItems(),
2044
+ itemToValue,
2045
+ itemToString
2046
+ }));
2047
+ return jsx(FilterContext.Provider, mergeProps({
2048
+ value: filteredItems,
2049
+ children: () => jsx(Combobox.Root, mergeProps(rest, {
2050
+ collection: collection$1,
2051
+ inputValue: query,
2052
+ onInputValueChange: (value) => {
2053
+ query(value);
2054
+ local.onInputValueChange?.(value);
2055
+ },
2056
+ children: [jsx(HighlightSingleMatch, mergeProps({
2057
+ itemToValue,
2058
+ items: filteredItems
2059
+ })), () => local.children]
2060
+ }))
2061
+ }));
2062
+ };
2063
+ var HighlightSingleMatch = (props = {}) => {
2064
+ const combobox = useComboboxContext();
2065
+ createEffect(() => {
2066
+ const api = combobox();
2067
+ const list = props.items();
2068
+ if (!api.open || list.length !== 1) return;
2069
+ const value = props.itemToValue(list[0]);
2070
+ if (api.highlightedValue !== value) api.setHighlightValue(value);
2071
+ });
2072
+ return null;
2073
+ };
2074
+ var Input = (props = {}) => {
2075
+ const combobox = useComboboxContext();
2076
+ return jsx(Combobox.Input, mergeProps(props, { onInput: (event) => combobox().getInputProps().onChange?.(event) }));
2077
+ };
2078
+ var Items = (props = {}) => {
2079
+ return jsx(Loop, mergeProps({
2080
+ each: useContext(FilterContext) ?? [],
2081
+ children: (item) => props.children?.(item)
2082
+ }));
2083
+ };
2084
+ function ChevronIcon() {
2085
+ return _tmpl$4.cloneNode(true);
2086
+ }
2087
+ function CheckIcon() {
2088
+ return _tmpl2$3.cloneNode(true);
2089
+ }
2090
+ var FilteredSelect = (props = {}) => {
2091
+ const [local, rest] = splitProps(props, [
2092
+ "items",
2093
+ "itemToString",
2094
+ "itemToValue",
2095
+ "placeholder",
2096
+ "label",
2097
+ "openOnClick",
2098
+ "disabled",
2099
+ "classNames",
2100
+ "emptyText"
2101
+ ]);
2102
+ const cn = local.classNames ?? {};
2103
+ return jsx(Root, mergeProps({
2104
+ get itemToString() {
2105
+ return local.itemToString;
2106
+ },
2107
+ get itemToValue() {
2108
+ return local.itemToValue;
2109
+ },
2110
+ get items() {
2111
+ return local.items;
2112
+ },
2113
+ get openOnClick() {
2114
+ return local.openOnClick ?? true;
2115
+ }
2116
+ }, rest, { children: [
2117
+ () => local.label && jsx(Combobox.Label, mergeProps({
2118
+ get className() {
2119
+ return cn.label;
2120
+ },
2121
+ children: () => local.label
2122
+ })),
2123
+ jsx(Combobox.Control, mergeProps({
2124
+ get className() {
2125
+ return cn.control;
2126
+ },
2127
+ children: [jsx(Input, mergeProps({
2128
+ get className() {
2129
+ return cn.input;
2130
+ },
2131
+ get disabled() {
2132
+ return local.disabled;
2133
+ },
2134
+ get placeholder() {
2135
+ return local.placeholder ?? "Type to search...";
2136
+ }
2137
+ })), jsx(Combobox.Trigger, mergeProps({
2138
+ get className() {
2139
+ return cn.trigger;
2140
+ },
2141
+ type: "button",
2142
+ children: jsx(ChevronIcon, {})
2143
+ }))]
2144
+ })),
2145
+ jsx(Combobox.Content, mergeProps({
2146
+ get className() {
2147
+ return cn.content;
2148
+ },
2149
+ children: [jsx(Combobox.Empty, mergeProps({
2150
+ get className() {
2151
+ return cn.empty;
2152
+ },
2153
+ children: () => local.emptyText ?? "No results found"
2154
+ })), jsx(Items, mergeProps({ children: (item) => jsx(Combobox.Item, mergeProps({
2155
+ get className() {
2156
+ return cn.item;
2157
+ },
2158
+ item,
2159
+ get key() {
2160
+ return local.itemToValue?.(item) ?? item;
2161
+ },
2162
+ children: [jsx(Combobox.ItemText, mergeProps({
2163
+ get className() {
2164
+ return cn.itemText;
2165
+ },
2166
+ children: () => local.itemToString?.(item) ?? String(item)
2167
+ })), () => {
2168
+ const _el0 = _tmpl3.cloneNode(true);
2169
+ insert(_el0, () => jsx(CheckIcon, {}));
2170
+ setProp(_el0, "className", () => cn.check);
2171
+ return _el0;
2172
+ }]
2173
+ })) }))]
2174
+ }))
2175
+ ] }));
2176
+ };
2177
+ //#endregion
2178
+ //#region src/components/FocusTrap.jsx
2179
+ var FocusTrap_default = FocusTrap;
2180
+ //#endregion
2181
+ //#region src/components/HoverCard.jsx
2182
+ var HoverCard_default = HoverCard;
2183
+ //#endregion
2184
+ //#region src/components/Listbox.jsx
2185
+ var Listbox_default = Listbox;
2186
+ //#endregion
2187
+ //#region src/components/Menu.jsx
2188
+ var Menu_default = Menu;
2189
+ //#endregion
2190
+ //#region src/components/MoneyInput.jsx
2191
+ var _tmpl2$2 = template("<span></span>");
2192
+ var _tmpl$3 = template("<div><span></span><!><!></div>");
2193
+ var wrapperClass$2 = css({
2194
+ display: "flex",
2195
+ alignItems: "center",
2196
+ width: "100%",
2197
+ boxSizing: "border-box",
2198
+ height: "44px",
2199
+ background: "var(--bg, rgba(0,0,0,0.2))",
2200
+ border: "1px solid var(--border)",
2201
+ borderRadius: "10px",
2202
+ padding: "0 14px",
2203
+ "&:focus-within": { borderColor: "var(--accent)" }
2204
+ });
2205
+ var errorClass = css({ borderColor: "var(--danger) !important" });
2206
+ var affixTextClass = css({
2207
+ color: "var(--muted)",
2208
+ fontSize: "14px",
2209
+ whiteSpace: "nowrap",
2210
+ userSelect: "none",
2211
+ marginRight: "2px"
2212
+ });
2213
+ var affixSuffixClass = css({
2214
+ color: "var(--ink)",
2215
+ fontSize: "14px",
2216
+ fontWeight: 600,
2217
+ whiteSpace: "nowrap",
2218
+ userSelect: "none",
2219
+ paddingLeft: "10px",
2220
+ marginLeft: "4px",
2221
+ borderLeft: "1px solid var(--border)"
2222
+ });
2223
+ var affixSuffixDisabledClass = css({ opacity: .5 });
2224
+ var inputClass$1 = css({
2225
+ flex: 1,
2226
+ minWidth: 0,
2227
+ height: "100%",
2228
+ background: "transparent",
2229
+ border: "none",
2230
+ color: "var(--ink)",
2231
+ fontSize: "15px",
2232
+ fontFamily: "inherit",
2233
+ outline: "none",
2234
+ "&::placeholder": { color: "var(--muted)" },
2235
+ "&:disabled": {
2236
+ opacity: .5,
2237
+ cursor: "not-allowed",
2238
+ WebkitTextFillColor: "var(--ink)"
2239
+ }
2240
+ });
2241
+ var read = (value) => {
2242
+ return typeof value === "function" ? value() : value;
2243
+ };
2244
+ var groupThousands = (digits) => {
2245
+ if (!digits) return "";
2246
+ return Number(digits).toLocaleString("en-US");
2247
+ };
2248
+ /**
2249
+ * Currency amount input. Keeps an integer digits-only string as its value and
2250
+ * renders it grouped by thousands with a currency prefix.
2251
+ *
2252
+ * @param value digits-only string, or an accessor returning one
2253
+ * @param onValueChange called with the next digits-only string on input
2254
+ * @param invalid boolean or accessor; toggles the error border
2255
+ * @param currency prefix symbol, defaults to ₱
2256
+ * @param affix optional suffix text (e.g. K, M), defaults to empty
2257
+ */
2258
+ var MoneyInput = (props) => {
2259
+ const [local, rest] = splitProps(props, [
2260
+ "value",
2261
+ "onValueChange",
2262
+ "invalid",
2263
+ "currency",
2264
+ "affix",
2265
+ "placeholder",
2266
+ "disabled"
2267
+ ]);
2268
+ return () => {
2269
+ const _el0 = _tmpl$3.cloneNode(true);
2270
+ const _el1 = _el0.firstChild;
2271
+ const _el2 = _el0.firstChild.nextSibling;
2272
+ const _el3 = _el0.firstChild.nextSibling.nextSibling;
2273
+ insert(_el1, () => local.currency ?? "₱");
2274
+ setProp(_el1, "className", () => affixTextClass);
2275
+ insert(_el0, () => jsx("input", mergeProps({
2276
+ className: inputClass$1,
2277
+ get disabled() {
2278
+ return local.disabled;
2279
+ },
2280
+ inputMode: "numeric",
2281
+ onInput: (e) => local.onValueChange?.(e.target.value.replace(/\D/g, "")),
2282
+ get placeholder() {
2283
+ return local.placeholder;
2284
+ },
2285
+ value: () => groupThousands(read(local.value))
2286
+ }, rest)), _el2);
2287
+ insert(_el0, () => read(local.affix) && (() => {
2288
+ const _el0 = _tmpl2$2.cloneNode(true);
2289
+ insert(_el0, () => read(local.affix));
2290
+ setProp(_el0, "className", () => `${affixSuffixClass} ${read(local.disabled) ? affixSuffixDisabledClass : ""}`);
2291
+ return _el0;
2292
+ }), _el3);
2293
+ setProp(_el0, "className", () => `${wrapperClass$2} ${read(local.invalid) ? errorClass : ""}`);
2294
+ return _el0;
2295
+ };
2296
+ };
2297
+ //#endregion
2298
+ //#region src/components/MyFilteredSelect.jsx
2299
+ var classNames = {
2300
+ control: css({
2301
+ position: "relative",
2302
+ display: "flex",
2303
+ alignItems: "center",
2304
+ width: "100%",
2305
+ height: "46px",
2306
+ background: "var(--surface)",
2307
+ border: "1px solid var(--border)",
2308
+ borderRadius: "10px",
2309
+ transition: "border-color 150ms ease",
2310
+ "&:focus-within": { borderColor: "var(--accent)" }
2311
+ }),
2312
+ input: css({
2313
+ flex: 1,
2314
+ minWidth: 0,
2315
+ height: "100%",
2316
+ background: "transparent",
2317
+ border: "none",
2318
+ outline: "none",
2319
+ padding: "0 0 0 14px",
2320
+ color: "var(--ink)",
2321
+ fontSize: "15px",
2322
+ fontFamily: "inherit",
2323
+ "&::placeholder": { color: "var(--muted)" }
2324
+ }),
2325
+ trigger: css({
2326
+ flexShrink: 0,
2327
+ width: "36px",
2328
+ height: "100%",
2329
+ display: "flex",
2330
+ alignItems: "center",
2331
+ justifyContent: "center",
2332
+ background: "transparent",
2333
+ border: "none",
2334
+ color: "var(--muted)",
2335
+ cursor: "pointer",
2336
+ padding: 0,
2337
+ transition: "transform 180ms ease, color 180ms ease",
2338
+ "&[data-state=\"open\"]": {
2339
+ transform: "rotate(180deg)",
2340
+ color: "var(--accent)"
2341
+ },
2342
+ "& svg": {
2343
+ width: "18px",
2344
+ height: "18px"
2345
+ }
2346
+ }),
2347
+ content: css({
2348
+ background: "var(--surface)",
2349
+ border: "1px solid var(--border)",
2350
+ borderRadius: "12px",
2351
+ padding: "6px",
2352
+ boxShadow: "0 8px 32px rgba(0,0,0,0.5)",
2353
+ maxHeight: "280px",
2354
+ overflowY: "auto",
2355
+ minWidth: "220px",
2356
+ zIndex: 9999,
2357
+ marginTop: "4px",
2358
+ "&[hidden]": { display: "none" },
2359
+ "&::-webkit-scrollbar": { width: "4px" },
2360
+ "&::-webkit-scrollbar-track": { background: "transparent" },
2361
+ "&::-webkit-scrollbar-thumb": {
2362
+ background: "var(--border)",
2363
+ borderRadius: "4px"
2364
+ }
2365
+ }),
2366
+ item: css({
2367
+ display: "flex",
2368
+ alignItems: "center",
2369
+ gap: "10px",
2370
+ padding: "10px 12px",
2371
+ borderRadius: "8px",
2372
+ cursor: "pointer",
2373
+ color: "var(--ink)",
2374
+ fontSize: "14px",
2375
+ transition: "background 120ms ease",
2376
+ "&[data-highlighted]": { background: "var(--surface-2)" },
2377
+ "&[data-selected]": {
2378
+ color: "var(--accent)",
2379
+ background: "rgba(47, 123, 255, 0.1)"
2380
+ }
2381
+ }),
2382
+ itemText: css({
2383
+ flex: 1,
2384
+ minWidth: 0
2385
+ }),
2386
+ check: css({
2387
+ flexShrink: 0,
2388
+ width: "18px",
2389
+ height: "18px",
2390
+ color: "var(--accent)",
2391
+ opacity: 0,
2392
+ transition: "opacity 120ms ease",
2393
+ "[data-selected] &": { opacity: 1 }
2394
+ }),
2395
+ empty: css({
2396
+ padding: "24px 12px",
2397
+ textAlign: "center",
2398
+ color: "var(--muted)",
2399
+ fontSize: "14px"
2400
+ }),
2401
+ label: css({
2402
+ display: "block",
2403
+ fontSize: "13px",
2404
+ fontWeight: 600,
2405
+ color: "var(--muted)",
2406
+ marginBottom: "6px"
2407
+ })
2408
+ };
2409
+ var MyFilteredSelect = (props = {}) => jsx(FilteredSelect, mergeProps({ classNames }, props));
2410
+ //#endregion
2411
+ //#region src/components/NumberInput.jsx
2412
+ var NumberInput_default = NumberInput;
2413
+ //#endregion
2414
+ //#region src/components/Pagination.jsx
2415
+ var Pagination_default = Pagination;
2416
+ //#endregion
2417
+ //#region src/components/Popover.jsx
2418
+ var Popover_default = Popover;
2419
+ //#endregion
2420
+ //#region src/components/Presence.jsx
2421
+ var Presence_default = Presence;
2422
+ //#endregion
2423
+ //#region src/components/Progress.jsx
2424
+ var Progress_default = Progress;
2425
+ //#endregion
2426
+ //#region src/components/RadioGroup.jsx
2427
+ var RadioGroup_default = RadioGroup;
2428
+ //#endregion
2429
+ //#region src/components/RatingGroup.jsx
2430
+ var RatingGroup_default = RatingGroup;
2431
+ //#endregion
2432
+ //#region src/components/SearchInput.jsx
2433
+ var _tmpl2$1 = template("<svg fill=\"none\" stroke=\"currentColor\" strokeLinecap=\"round\" strokeLinejoin=\"round\" strokeWidth=\"2\" viewBox=\"0 0 24 24\"><circle cx=\"11\" cy=\"11\" r=\"7\"></circle><path d=\"M21 21l-4.35-4.35\"></path></svg>");
2434
+ var _tmpl$2 = template("<div><span aria-hidden=\"true\"></span><!></div>");
2435
+ var wrapperClass$1 = css({
2436
+ flex: 1,
2437
+ minWidth: 0,
2438
+ position: "relative"
2439
+ });
2440
+ var inputClass = css({
2441
+ width: "100%",
2442
+ height: "44px",
2443
+ background: "var(--surface)",
2444
+ border: "1px solid var(--border)",
2445
+ borderRadius: "10px",
2446
+ padding: "0 14px 0 44px",
2447
+ color: "var(--ink)",
2448
+ fontSize: "15px",
2449
+ fontFamily: "inherit",
2450
+ outline: "none",
2451
+ "&::placeholder": { color: "var(--muted)" },
2452
+ "&:focus": { borderColor: "var(--accent)" }
2453
+ });
2454
+ var iconClass = css({
2455
+ position: "absolute",
2456
+ left: "13px",
2457
+ top: "50%",
2458
+ transform: "translateY(-50%)",
2459
+ color: "var(--muted)",
2460
+ pointerEvents: "none",
2461
+ "& svg": {
2462
+ width: "18px",
2463
+ height: "18px"
2464
+ }
2465
+ });
2466
+ var SearchInput = (props) => {
2467
+ const [local, rest] = splitProps(props, ["placeholder", "onInput"]);
2468
+ return () => {
2469
+ const _el0 = _tmpl$2.cloneNode(true);
2470
+ const _el1 = _el0.firstChild;
2471
+ const _el2 = _el0.firstChild.nextSibling;
2472
+ insert(_el1, () => jsx(SearchIcon, {}));
2473
+ setProp(_el1, "className", () => iconClass);
2474
+ insert(_el0, () => jsx("input", mergeProps({
2475
+ className: inputClass,
2476
+ get onInput() {
2477
+ return local.onInput;
2478
+ },
2479
+ get placeholder() {
2480
+ return local.placeholder ?? "Search...";
2481
+ },
2482
+ type: "search"
2483
+ }, rest)), _el2);
2484
+ setProp(_el0, "className", () => wrapperClass$1);
2485
+ return _el0;
2486
+ };
2487
+ };
2488
+ function SearchIcon() {
2489
+ return _tmpl2$1.cloneNode(true);
2490
+ }
2491
+ //#endregion
2492
+ //#region src/components/Select.jsx
2493
+ var Select_default = Select;
2494
+ //#endregion
2495
+ //#region src/components/SignaturePad.jsx
2496
+ var SignaturePad_default = SignaturePad;
2497
+ //#endregion
2498
+ //#region src/components/Skeleton.jsx
2499
+ var _tmpl$1 = template("<span></span>");
2500
+ var baseClass = css({
2501
+ display: "block",
2502
+ background: "linear-gradient(90deg, var(--border) 0%, var(--surface) 50%, var(--border) 100%)",
2503
+ backgroundSize: "200% 100%",
2504
+ animation: `${keyframes({
2505
+ "0%": { backgroundPosition: "-200% 0" },
2506
+ "100%": { backgroundPosition: "200% 0" }
2507
+ })} 1.4s ease-in-out infinite`,
2508
+ borderRadius: "6px"
2509
+ });
2510
+ var Skeleton = ({ width = "100%", height = "14px", radius, className, style }) => (() => {
2511
+ const _el0 = _tmpl$1.cloneNode(true);
2512
+ setProp(_el0, "className", () => className ? `${baseClass} ${className}` : baseClass);
2513
+ setProp(_el0, "style", () => ({
2514
+ width,
2515
+ height,
2516
+ borderRadius: radius,
2517
+ ...style
2518
+ }));
2519
+ return _el0;
2520
+ })();
2521
+ //#endregion
2522
+ //#region src/components/Slider.jsx
2523
+ var Slider_default = Slider;
2524
+ //#endregion
2525
+ //#region src/components/Splitter.jsx
2526
+ var Splitter_default = Splitter;
2527
+ //#endregion
2528
+ //#region src/components/Steps.jsx
2529
+ var Steps_default = Steps;
2530
+ //#endregion
2531
+ //#region src/components/SwipeReveal.jsx
2532
+ var _tmpl2 = template("<button type=\"button\"></button>");
2533
+ var _tmpl = template("<div><div data-dragging=\"false\"><div></div><div></div></div></div>");
2534
+ var ACTIONS_WIDTH = 160;
2535
+ var wrapperClass = css`
2536
+ position: relative;
2537
+ overflow: hidden;
2538
+ border-radius: 12px;
2539
+ user-select: none;
2540
+ `;
2541
+ var trackClass = css`
2542
+ display: flex;
2543
+ align-items: stretch;
2544
+ will-change: transform;
2545
+ transition: transform 220ms ease;
2546
+ touch-action: pan-y;
2547
+ &[data-dragging="true"] { transition: none; }
2548
+ `;
2549
+ var actionsClass = css`
2550
+ flex: 0 0 ${ACTIONS_WIDTH}px;
2551
+ display: flex;
2552
+ `;
2553
+ var actionBtnClass = css`
2554
+ flex: 1;
2555
+ display: flex;
2556
+ align-items: center;
2557
+ justify-content: center;
2558
+ border: none;
2559
+ color: #fff;
2560
+ font-size: 14px;
2561
+ font-weight: 600;
2562
+ cursor: pointer;
2563
+ font-family: inherit;
2564
+ `;
2565
+ var contentClass = css`
2566
+ flex: 0 0 100%;
2567
+ `;
2568
+ var SwipeReveal = ({ actions, children, onSwipeStart, onOpenChange, activeId, thisId }) => {
2569
+ const isOpen = createSignal(false);
2570
+ let trackEl = null;
2571
+ let startX = 0;
2572
+ let startY = 0;
2573
+ let baseOffset = 0;
2574
+ let currentOffset = 0;
2575
+ let dragging = false;
2576
+ let axisLocked = false;
2577
+ let horizontal = false;
2578
+ let moved = false;
2579
+ const setTrackRef = (el) => {
2580
+ trackEl = el;
2581
+ };
2582
+ const applyTransform = (px) => {
2583
+ if (trackEl) trackEl.style.transform = `translateX(${px}px)`;
2584
+ };
2585
+ const snap = (toOpen) => {
2586
+ currentOffset = toOpen ? -160 : 0;
2587
+ if (trackEl) {
2588
+ trackEl.dataset.dragging = "false";
2589
+ applyTransform(currentOffset);
2590
+ }
2591
+ onOpenChange?.(toOpen);
2592
+ isOpen(toOpen);
2593
+ };
2594
+ createEffect(() => {
2595
+ const currentActive = typeof activeId === "function" ? activeId() : activeId;
2596
+ if (currentActive !== void 0 && currentActive !== thisId && isOpen()) {
2597
+ isOpen(false);
2598
+ currentOffset = 0;
2599
+ if (trackEl) {
2600
+ trackEl.dataset.dragging = "false";
2601
+ applyTransform(0);
2602
+ }
2603
+ }
2604
+ });
2605
+ const onPointerDown = (e) => {
2606
+ if (e.pointerType === "mouse" && e.button !== 0) return;
2607
+ startX = e.clientX;
2608
+ startY = e.clientY;
2609
+ baseOffset = isOpen() ? -160 : 0;
2610
+ dragging = true;
2611
+ axisLocked = false;
2612
+ horizontal = false;
2613
+ moved = false;
2614
+ e.currentTarget.setPointerCapture?.(e.pointerId);
2615
+ };
2616
+ const onPointerMove = (e) => {
2617
+ if (!dragging) return;
2618
+ const dx = e.clientX - startX;
2619
+ const dy = e.clientY - startY;
2620
+ if (!axisLocked) {
2621
+ if (Math.abs(dx) < 6 && Math.abs(dy) < 6) return;
2622
+ horizontal = Math.abs(dx) > Math.abs(dy);
2623
+ axisLocked = true;
2624
+ if (horizontal && trackEl) trackEl.dataset.dragging = "true";
2625
+ }
2626
+ if (!horizontal) return;
2627
+ moved = true;
2628
+ let next = baseOffset + dx;
2629
+ if (next > 0) next = 0;
2630
+ if (next < -160) next = -160 - (next + ACTIONS_WIDTH) * .2;
2631
+ currentOffset = next;
2632
+ applyTransform(next);
2633
+ };
2634
+ const onPointerUp = (e) => {
2635
+ if (!dragging) return;
2636
+ dragging = false;
2637
+ e.currentTarget.releasePointerCapture?.(e.pointerId);
2638
+ if (!horizontal) return;
2639
+ snap(currentOffset < -80);
2640
+ };
2641
+ const handleContentClick = (e) => {
2642
+ if (moved) {
2643
+ e.stopPropagation();
2644
+ return;
2645
+ }
2646
+ if (isOpen()) {
2647
+ e.stopPropagation();
2648
+ snap(false);
2649
+ return;
2650
+ }
2651
+ };
2652
+ const handleActionClick = (action) => (e) => {
2653
+ e.stopPropagation();
2654
+ snap(false);
2655
+ action.onClick?.(e);
2656
+ };
2657
+ return () => {
2658
+ const _el0 = _tmpl.cloneNode(true);
2659
+ const _el1 = _el0.firstChild;
2660
+ const _el2 = _el1.firstChild;
2661
+ const _el3 = _el1.firstChild.nextSibling;
2662
+ insert(_el2, () => children);
2663
+ setProp(_el2, "className", () => contentClass);
2664
+ setProp(_el2, "onClick", () => handleContentClick);
2665
+ insert(_el3, () => actions.map((action) => () => {
2666
+ const _el0 = _tmpl2.cloneNode(true);
2667
+ insert(_el0, () => action.label);
2668
+ setProp(_el0, "className", () => actionBtnClass);
2669
+ setProp(_el0, "onClick", () => handleActionClick(action));
2670
+ setProp(_el0, "style", () => ({ background: action.color }));
2671
+ setProp(_el0, "tabIndex", () => isOpen() ? 0 : -1);
2672
+ return _el0;
2673
+ }));
2674
+ setProp(_el3, "className", () => actionsClass);
2675
+ setProp(_el1, "className", () => trackClass);
2676
+ setProp(_el1, "onPointerCancel", () => onPointerUp);
2677
+ setProp(_el1, "onPointerDown", () => onPointerDown);
2678
+ setProp(_el1, "onPointerMove", () => onPointerMove);
2679
+ setProp(_el1, "onPointerUp", () => onPointerUp);
2680
+ setProp(_el1, "ref", () => setTrackRef);
2681
+ setProp(_el0, "className", () => wrapperClass);
2682
+ return _el0;
2683
+ };
2684
+ };
2685
+ //#endregion
2686
+ //#region src/components/Switch.jsx
2687
+ var Switch_default = Switch;
2688
+ //#endregion
2689
+ //#region src/components/Tabs.jsx
2690
+ var Tabs_default = Tabs;
2691
+ //#endregion
2692
+ //#region src/components/TagsInput.jsx
2693
+ var TagsInput_default = TagsInput;
2694
+ //#endregion
2695
+ //#region src/components/Toast.jsx
2696
+ var Toast_default = Object.assign(Toast, { createToaster });
2697
+ //#endregion
2698
+ //#region src/components/Toggle.jsx
2699
+ var Toggle_default = Toggle;
2700
+ //#endregion
2701
+ //#region src/components/ToggleGroup.jsx
2702
+ var ToggleGroup_default = ToggleGroup;
2703
+ //#endregion
2704
+ //#region src/components/Tooltip.jsx
2705
+ var Tooltip_default = Tooltip;
2706
+ //#endregion
2707
+ //#region src/components/Tour.jsx
2708
+ var Tour_default = Tour;
2709
+ //#endregion
2710
+ //#region src/components/TreeView.jsx
2711
+ var TreeView_default = TreeView;
2712
+ //#endregion
2713
+ export { Accordion_default as Accordion, Avatar_default as Avatar, CardNumberInput, Carousel_default as Carousel, Checkbox_default as Checkbox, Clipboard_default as Clipboard, Collapsible_default as Collapsible, ColorPicker_default as ColorPicker, Combobox_default as Combobox, ConfirmDialog, DateInput_default as DateInput, DatePicker_default as DatePicker, Dialog_default as Dialog, Drawer_default as Drawer, Field_default as Field, Fieldset_default as Fieldset, FileUpload_default as FileUpload, FilteredSelect, FocusTrap_default as FocusTrap, HoverCard_default as HoverCard, Icon, Listbox_default as Listbox, Menu_default as Menu, MoneyInput, MyFilteredSelect, NumberInput_default as NumberInput, Pagination_default as Pagination, Popover_default as Popover, Portal_default as Portal, Presence_default as Presence, Progress_default as Progress, RadioGroup_default as RadioGroup, RatingGroup_default as RatingGroup, SearchInput, Select_default as Select, SignaturePad_default as SignaturePad, Skeleton, Slider_default as Slider, Splitter_default as Splitter, Steps_default as Steps, SwipeReveal, Switch_default as Switch, Tabs_default as Tabs, TagsInput_default as TagsInput, Toast_default as Toast, Toggle_default as Toggle, ToggleGroup_default as ToggleGroup, Tooltip_default as Tooltip, Tour_default as Tour, TreeView_default as TreeView };
2714
+
2715
+ //# sourceMappingURL=index.js.map