@photon-ai/pho-ui 2.4.0 → 2.5.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.
@@ -0,0 +1,1284 @@
1
+ "use client";
2
+ import { t as d } from "./cn-ChIgwEl3.js";
3
+ import { n as Ce } from "./link-provider-9TFNyDqO.js";
4
+ import { a as le, o as oe } from "./button-DNNs5RsT.js";
5
+ import { t as Ve } from "./createReactComponent-BqCmnqfX.js";
6
+ import { t as Ge } from "./error-Crs-wqMC.js";
7
+ import { t as q } from "./IconChevronLeft-CSWMKQ4C.js";
8
+ import { t as ze } from "./IconX-pZ9vrtSr.js";
9
+ import { t as $e } from "./toast-DoXaRPIZ.js";
10
+ import { t as je } from "./animated-height-C2eQstGy.js";
11
+ import { t as K } from "./scroll-area-Bu7egArU.js";
12
+ import { t as We } from "./form-AiHbbw4m.js";
13
+ import { i as z } from "./menu-BQeprfxB.js";
14
+ import { Children as J, Fragment as Xe, createContext as G, isValidElement as Ke, useContext as S, useEffect as P, useId as Ye, useLayoutEffect as F, useMemo as V, useRef as w, useState as y, useSyncExternalStore as qe } from "react";
15
+ import { Fragment as re, jsx as n, jsxs as b } from "react/jsx-runtime";
16
+ import { AnimatePresence as j, motion as x, useIsPresent as Ue, useReducedMotion as I } from "motion/react";
17
+ import { createPortal as ge } from "react-dom";
18
+ var Qe = [["path", {
19
+ d: "M9 6l6 6l-6 6",
20
+ key: "svg-0"
21
+ }]], Je = Ve("outline", "chevron-right", "ChevronRight", Qe), ce = "rounded-base border border-pho-secondary bg-pho-primary", U = "divide-y divide-pho-secondary [&>:has(+[data-basic-page-alert])]:border-b-0", Ze = `${ce} ${U}`, ve = "flex min-w-0 flex-col gap-3 rounded-base border border-pho-secondary bg-pho-page p-5", et = "flex min-h-[4.25rem] min-w-0 flex-col gap-3 px-5 py-4 sm:flex-row sm:items-center sm:justify-between sm:gap-6", tt = "flex flex-col gap-3 px-5 py-4", nt = "-mx-5 -mb-4 flex items-center rounded-b-[calc(0.75rem-1px)] bg-pho-secondary py-1 pr-3 pl-5", at = "-mx-2 -mt-1.5 flex items-center rounded-sm bg-pho-secondary px-2 py-0.5", R = {
22
+ type: "spring",
23
+ stiffness: 400,
24
+ damping: 40
25
+ }, H = {
26
+ duration: 0.25,
27
+ ease: "easeOut"
28
+ }, W = 12, rt = 768;
29
+ function it(e) {
30
+ return Math.round(Math.min(Math.max(e * 0.4, 320), 576));
31
+ }
32
+ var Ee = G(null), _e = G(null);
33
+ function st(e, t) {
34
+ const [a, r] = y(null), [s, l] = y(!1), [c, o] = y(() => ({
35
+ width: typeof window > "u" ? 0 : window.innerWidth,
36
+ height: null
37
+ }));
38
+ return F(() => {
39
+ const i = e.current;
40
+ if (!t || i == null) return;
41
+ const u = fe(i), f = () => {
42
+ const p = i.offsetWidth, h = u?.clientHeight ?? null;
43
+ o((g) => g.width === p && g.height === h ? g : {
44
+ width: p,
45
+ height: h
46
+ });
47
+ };
48
+ if (f(), typeof ResizeObserver > "u") return;
49
+ const m = new ResizeObserver(f);
50
+ return m.observe(i), u != null && m.observe(u), () => m.disconnect();
51
+ }, [e, t]), {
52
+ host: V(() => t ? {
53
+ slot: a,
54
+ presentation: c.width >= rt ? "panel" : "page",
55
+ width: it(c.width),
56
+ paneHeight: c.height,
57
+ setOpen: l
58
+ } : null, [
59
+ t,
60
+ a,
61
+ c
62
+ ]),
63
+ setSlot: r,
64
+ open: s
65
+ };
66
+ }
67
+ function lt(e) {
68
+ return e == null ? window.scrollY : e.scrollTop;
69
+ }
70
+ function ye(e, t) {
71
+ e == null ? window.scrollTo({ top: t }) : e.scrollTop = t;
72
+ }
73
+ function ot({ condense: e = !0, width: t = "base", className: a, children: r, ref: s, ...l }) {
74
+ const c = S(Z)?.adopt ?? !1, o = S(_e), i = t === "wide", u = w(null), [f, m] = y(null), [p, h] = y(null), g = V(() => ({
75
+ setTitle: m,
76
+ setTail: h
77
+ }), []);
78
+ P(() => {
79
+ if (o != null)
80
+ return o.setBack(p), () => o.setBack(null);
81
+ }, [o, p]);
82
+ const { host: A, setSlot: T, open: _ } = st(u, i), C = _ && A?.presentation === "page", v = w(!1), L = w(0);
83
+ F(() => {
84
+ const k = u.current;
85
+ if (C === v.current || k == null) return;
86
+ v.current = C;
87
+ const M = fe(k);
88
+ C ? (L.current = lt(M), ye(M, 0)) : ye(M, L.current);
89
+ }, [C]);
90
+ const B = e ? /* @__PURE__ */ n(ct, {
91
+ title: f,
92
+ tail: o == null ? p : null,
93
+ silent: C || o != null
94
+ }) : null, O = /* @__PURE__ */ n("div", {
95
+ "data-basic-page-column": "",
96
+ className: d("mx-auto flex w-full min-w-0 flex-1 flex-col px-5 pt-12 pb-12 *:min-w-0", i ? "max-w-[82.5rem]" : "max-w-[44.5rem]", c || o != null ? "[&_[data-basic-page-back]]:hidden" : "has-[[data-basic-page-back]]:pt-16"),
97
+ children: e ? /* @__PURE__ */ n(de.Provider, {
98
+ value: g,
99
+ children: r
100
+ }) : r
101
+ });
102
+ return /* @__PURE__ */ n("div", {
103
+ "data-basic-page-root": "",
104
+ "data-basic-page-width": i ? "wide" : void 0,
105
+ className: d("relative flex min-h-full w-full min-w-0", i ? "flex-row" : "flex-col", a),
106
+ ...l,
107
+ ref: (k) => {
108
+ u.current = k, typeof s == "function" ? s(k) : s != null && (s.current = k);
109
+ },
110
+ children: /* @__PURE__ */ n(Ee.Provider, {
111
+ value: A,
112
+ children: i ? /* @__PURE__ */ b(re, { children: [/* @__PURE__ */ b("div", {
113
+ "data-basic-page-main": "",
114
+ className: d("flex min-w-0 flex-1 flex-col", C && "hidden"),
115
+ children: [B, O]
116
+ }), /* @__PURE__ */ n("div", {
117
+ ref: T,
118
+ className: "contents"
119
+ })] }) : /* @__PURE__ */ b(re, { children: [B, O] })
120
+ })
121
+ });
122
+ }
123
+ function ct({ title: e, tail: t, silent: a = !1 }) {
124
+ const r = I(), [s, l] = y(!1), c = S(Z), o = Ye();
125
+ P(() => {
126
+ if (c != null) {
127
+ if (a) {
128
+ c.store.clear(o);
129
+ return;
130
+ }
131
+ c.store.set(o, {
132
+ condensed: s,
133
+ title: e?.label ?? null,
134
+ back: t
135
+ });
136
+ }
137
+ }, [
138
+ c,
139
+ o,
140
+ s,
141
+ e,
142
+ t,
143
+ a
144
+ ]), P(() => {
145
+ if (c != null)
146
+ return () => c.store.clear(o);
147
+ }, [c, o]);
148
+ const i = e?.el ?? null;
149
+ return P(() => {
150
+ if (i == null || typeof IntersectionObserver > "u") return;
151
+ const u = new IntersectionObserver(([f]) => l(f != null && !f.isIntersecting), { root: fe(i) });
152
+ return u.observe(i), () => u.disconnect();
153
+ }, [i]), /* @__PURE__ */ n("div", {
154
+ "data-basic-page-condense": "",
155
+ className: "sticky top-0 z-20 h-0 overflow-visible",
156
+ children: /* @__PURE__ */ n(j, { children: s && !(c?.adopt ?? !1) && /* @__PURE__ */ b(x.div, {
157
+ initial: {
158
+ opacity: 0,
159
+ y: r ? 0 : -8
160
+ },
161
+ animate: {
162
+ opacity: 1,
163
+ y: 0
164
+ },
165
+ exit: {
166
+ opacity: 0,
167
+ y: r ? 0 : -8
168
+ },
169
+ transition: {
170
+ ...ee,
171
+ y: Se
172
+ },
173
+ className: "border-pho-secondary bg-pho-page/85 relative grid h-12 grid-cols-[1fr_minmax(0,auto)_1fr] items-center border-b px-3 backdrop-blur",
174
+ children: [/* @__PURE__ */ n("div", {
175
+ className: "flex min-w-0 items-center justify-start",
176
+ children: t != null && /* @__PURE__ */ n(oe, {
177
+ variant: "ghost",
178
+ size: "sm",
179
+ href: t.href,
180
+ onClick: t.onClick,
181
+ prefix: /* @__PURE__ */ n("span", {
182
+ className: "inline-flex [&>svg]:size-[1.125em] [&>svg]:shrink-0",
183
+ children: /* @__PURE__ */ n(q, {})
184
+ }),
185
+ className: "min-w-max",
186
+ children: t.label
187
+ })
188
+ }), /* @__PURE__ */ n("span", {
189
+ className: "text-pho-primary block max-w-full min-w-0 truncate text-center text-base font-medium",
190
+ children: e?.label
191
+ })]
192
+ }) })
193
+ });
194
+ }
195
+ function ut(e) {
196
+ return e.normalize("NFKD").replace(/[\u0300-\u036f]/g, "").toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
197
+ }
198
+ function dt(e) {
199
+ if (!(typeof e != "string" && typeof e != "number"))
200
+ return ut(String(e)) || void 0;
201
+ }
202
+ function ue(e, t) {
203
+ if (e !== "")
204
+ return e ?? dt(t);
205
+ }
206
+ var ft = (e) => `basic-page-morph-${e}`, mt = { layout: R }, be = 10, xe = {
207
+ delay: 0.2,
208
+ duration: 0.12,
209
+ ease: "easeOut"
210
+ }, pt = {
211
+ duration: 0.18,
212
+ ease: "easeOut"
213
+ }, ht = -8, gt = {
214
+ duration: 0.16,
215
+ ease: "easeOut"
216
+ }, vt = {
217
+ delay: 0.14,
218
+ duration: 0.16,
219
+ ease: "easeOut"
220
+ }, ke = {
221
+ duration: 0.12,
222
+ ease: "easeOut"
223
+ }, $ = [];
224
+ function yt(e) {
225
+ const t = w({ labels: e });
226
+ t.current.labels = e, F(() => {
227
+ const a = t.current;
228
+ return $.push(a), () => {
229
+ $.splice($.indexOf(a), 1);
230
+ };
231
+ }, []);
232
+ }
233
+ function Re() {
234
+ const [e] = y(() => {
235
+ const t = $[$.length - 1];
236
+ return t ? { labels: [...t.labels] } : null;
237
+ });
238
+ return e;
239
+ }
240
+ var de = G(null), ie = {
241
+ condensed: !1,
242
+ title: null,
243
+ back: null
244
+ }, Z = G(null), bt = () => () => {
245
+ }, we = () => ie;
246
+ function xt({ adopt: e = !0, children: t }) {
247
+ const [a] = y(() => {
248
+ let s = ie, l = null;
249
+ const c = /* @__PURE__ */ new Set(), o = () => {
250
+ for (const i of c) i();
251
+ };
252
+ return {
253
+ get: () => s,
254
+ set(i, u) {
255
+ l = i, s = u, o();
256
+ },
257
+ clear(i) {
258
+ l === i && (l = null, s = ie, o());
259
+ },
260
+ subscribe(i) {
261
+ return c.add(i), () => c.delete(i);
262
+ }
263
+ };
264
+ }), r = V(() => ({
265
+ store: a,
266
+ adopt: e
267
+ }), [a, e]);
268
+ return /* @__PURE__ */ n(Z.Provider, {
269
+ value: r,
270
+ children: t
271
+ });
272
+ }
273
+ function Cn() {
274
+ const e = S(Z);
275
+ return qe(e?.store.subscribe ?? bt, e?.store.get ?? we, e?.store.get ?? we);
276
+ }
277
+ var ee = {
278
+ duration: 0.2,
279
+ ease: "easeOut"
280
+ }, Se = {
281
+ duration: ee.duration,
282
+ ease: "linear"
283
+ }, En = -8;
284
+ function fe(e) {
285
+ if (typeof getComputedStyle != "function") return null;
286
+ for (let t = e.parentElement; t != null && t !== document.body; t = t.parentElement) {
287
+ const { overflowY: a } = getComputedStyle(t);
288
+ if (a === "auto" || a === "scroll") return t;
289
+ }
290
+ return null;
291
+ }
292
+ var ne = /* @__PURE__ */ new Map(), wt = 96;
293
+ function Nt(e) {
294
+ const t = e.closest("[data-basic-page-root]"), a = t?.querySelector("[data-basic-page-column]");
295
+ return !t || !a ? 0 : a.getBoundingClientRect().left - t.getBoundingClientRect().left;
296
+ }
297
+ function Te(e) {
298
+ const [t] = y(() => {
299
+ if (e == null) return !1;
300
+ const r = ne.get(e);
301
+ return r != null && r.visible && r.el.isConnected && Nt(r.el) <= wt;
302
+ }), a = w(null);
303
+ return P(() => {
304
+ if (e == null || typeof IntersectionObserver > "u") return;
305
+ const r = a.current;
306
+ if (!r) return;
307
+ const s = new IntersectionObserver(([l]) => {
308
+ l && ne.set(e, {
309
+ visible: l.isIntersecting,
310
+ el: r
311
+ });
312
+ });
313
+ return s.observe(r), () => {
314
+ s.disconnect(), ne.delete(e);
315
+ };
316
+ }, [e]), {
317
+ fly: t,
318
+ ref: a
319
+ };
320
+ }
321
+ var At = {
322
+ fade: {
323
+ initial: { opacity: 0 },
324
+ animate: { opacity: 1 },
325
+ transition: { opacity: H }
326
+ },
327
+ rise: {
328
+ initial: {
329
+ opacity: 0,
330
+ y: W
331
+ },
332
+ animate: {
333
+ opacity: 1,
334
+ y: 0
335
+ },
336
+ transition: {
337
+ y: R,
338
+ opacity: H
339
+ }
340
+ },
341
+ slide: {
342
+ initial: { x: "-100%" },
343
+ animate: { x: 0 },
344
+ transition: { x: vt }
345
+ }
346
+ };
347
+ function Oe({ morphId: e, fromClassName: t, fly: a, morphRef: r, arrival: s, className: l, children: c }) {
348
+ const [o, i] = y(!1), u = !a && s != null ? At[s] : null;
349
+ return /* @__PURE__ */ b(x.span, {
350
+ ref: r,
351
+ layoutId: ft(e),
352
+ initial: u?.initial,
353
+ animate: u?.animate,
354
+ transition: a ? mt : {
355
+ layout: { duration: 0 },
356
+ ...u?.transition
357
+ },
358
+ onLayoutAnimationStart: () => {
359
+ a && i(!0);
360
+ },
361
+ onLayoutAnimationComplete: () => i(!1),
362
+ className: d("relative inline-block", l),
363
+ children: [c, o && /* @__PURE__ */ n(x.span, {
364
+ "aria-hidden": !0,
365
+ initial: { opacity: 1 },
366
+ animate: { opacity: 0 },
367
+ transition: pt,
368
+ onAnimationComplete: () => i(!1),
369
+ className: d("absolute inset-0", t),
370
+ children: c
371
+ })]
372
+ });
373
+ }
374
+ var Ne = "max-w-full min-w-0 truncate align-top";
375
+ function Ct({ id: e, morphId: t, enter: a, className: r, children: s, ...l }) {
376
+ const c = ue(e, s), o = I(), i = Te(t), u = Re(), f = !o && (t != null || a === !0), m = a || u != null ? "rise" : void 0, p = S(de), h = w(null);
377
+ F(() => {
378
+ if (p != null)
379
+ return p.setTitle({
380
+ label: s,
381
+ el: h.current
382
+ }), () => p.setTitle(null);
383
+ }, [p, s]);
384
+ const [g, A] = y(i.fly && u != null);
385
+ return F(() => {
386
+ $.length > 0 && A(!1);
387
+ }, []), /* @__PURE__ */ b("h1", {
388
+ id: c,
389
+ className: d("text-display-base text-pho-primary max-w-full min-w-0 scroll-mt-12 px-5 font-medium", f ? "whitespace-nowrap" : "truncate", r),
390
+ ...l,
391
+ ref: (T) => {
392
+ h.current = T;
393
+ const _ = l.ref;
394
+ typeof _ == "function" ? _(T) : _ != null && (_.current = T);
395
+ },
396
+ children: [t != null && !o ? /* @__PURE__ */ n(Oe, {
397
+ morphId: t,
398
+ fromClassName: "text-pho-secondary",
399
+ fly: i.fly,
400
+ morphRef: i.ref,
401
+ arrival: m,
402
+ className: Ne,
403
+ children: s
404
+ }) : a && !o ? /* @__PURE__ */ n(x.span, {
405
+ initial: {
406
+ opacity: 0,
407
+ y: W
408
+ },
409
+ animate: {
410
+ opacity: 1,
411
+ y: 0
412
+ },
413
+ transition: {
414
+ y: R,
415
+ opacity: H
416
+ },
417
+ className: d("inline-block", Ne),
418
+ children: s
419
+ }) : s, g && /* @__PURE__ */ n(x.span, {
420
+ "aria-hidden": !0,
421
+ initial: { opacity: 1 },
422
+ animate: { opacity: 0 },
423
+ transition: ke,
424
+ onAnimationComplete: () => A(!1),
425
+ className: d("text-pho-secondary pointer-events-none absolute inline-flex items-center", Qt),
426
+ children: /* @__PURE__ */ n(q, {})
427
+ })]
428
+ });
429
+ }
430
+ var Pe = G(!1);
431
+ function Et() {
432
+ const e = S(Pe), t = I(), [a] = y(() => e && !t);
433
+ return a;
434
+ }
435
+ var _t = {
436
+ height: 0,
437
+ opacity: 0,
438
+ paddingTop: 0,
439
+ paddingBottom: 0,
440
+ borderTopWidth: 0
441
+ }, kt = {
442
+ y: R,
443
+ opacity: H,
444
+ height: R,
445
+ paddingTop: R,
446
+ paddingBottom: R,
447
+ borderTopWidth: R
448
+ };
449
+ function me() {
450
+ const e = Et(), t = Ue(), a = I();
451
+ return {
452
+ initial: e ? {
453
+ opacity: 0,
454
+ y: W
455
+ } : !1,
456
+ animate: {
457
+ opacity: 1,
458
+ y: 0
459
+ },
460
+ exit: _t,
461
+ transition: a ? { duration: 0 } : kt,
462
+ leaving: !t
463
+ };
464
+ }
465
+ var Rt = typeof process < "u" && process.env.NODE_ENV !== "production";
466
+ function Ie(e, t, a, r) {
467
+ P(() => {
468
+ if (!Rt || e.current == null || typeof getComputedStyle != "function") return;
469
+ const s = (c) => {
470
+ const o = getComputedStyle(c).rowGap;
471
+ return o === "" || o === "normal" ? null : parseFloat(o);
472
+ }, l = s(e.current);
473
+ l != null && l !== a && console.warn(`[BasicPage.${t}] spaced at ${l}px instead of ${a}px. Spacing is the system's: Stack gap-10 between blocks, a block gap-3, Fields gap-5. Remove the class and move the wrapper instead.`, e.current);
474
+ for (const c of Array.from(e.current.children)) {
475
+ const o = r(c);
476
+ if (o == null || getComputedStyle(c).display === "contents") continue;
477
+ const i = s(c);
478
+ i != null && i !== o && console.warn(`[BasicPage.${t}] a child is spaced at ${i}px instead of ${o}px. Spacing is the system's: Stack gap-10 between blocks, a block gap-3, Fields gap-5. Remove the class and move the wrapper instead.`, c);
479
+ }
480
+ });
481
+ }
482
+ function St({ className: e, children: t, ...a }) {
483
+ const r = I(), s = w(null);
484
+ Ie(s, "Stack", 40, (u) => u.hasAttribute("data-basic-page-fields") ? 20 : 12);
485
+ const l = a["aria-busy"], c = l === !0 || l === "true", o = w(c), i = o.current && !c;
486
+ return P(() => {
487
+ o.current = c;
488
+ }), /* @__PURE__ */ n(x.div, {
489
+ ref: (u) => {
490
+ s.current = u;
491
+ const f = a.ref;
492
+ typeof f == "function" ? f(u) : f != null && (f.current = u);
493
+ },
494
+ "data-basic-page-stack": "",
495
+ initial: r ? !1 : {
496
+ opacity: 0,
497
+ y: W
498
+ },
499
+ animate: {
500
+ opacity: 1,
501
+ y: 0
502
+ },
503
+ transition: {
504
+ y: R,
505
+ opacity: H
506
+ },
507
+ className: d("mt-6 flex min-w-0 flex-col gap-10", "*:flex *:min-w-0 *:flex-col [&>*:not([data-basic-page-fields])]:gap-3", e),
508
+ ...a,
509
+ children: /* @__PURE__ */ n(Pe.Provider, {
510
+ value: i,
511
+ children: t
512
+ })
513
+ });
514
+ }
515
+ var Ae = "flex min-w-0 flex-col mb-3 [[data-basic-page-callout]_&]:mb-0 [[data-basic-page-stack]>*>&]:mb-0";
516
+ function Tt({ enter: e, className: t, ...a }) {
517
+ const r = I();
518
+ return e && !r ? /* @__PURE__ */ n(x.div, {
519
+ initial: {
520
+ opacity: 0,
521
+ y: W
522
+ },
523
+ animate: {
524
+ opacity: 1,
525
+ y: 0
526
+ },
527
+ transition: {
528
+ y: R,
529
+ opacity: H
530
+ },
531
+ "data-basic-page-header": "",
532
+ className: d(Ae, t),
533
+ ...a
534
+ }) : /* @__PURE__ */ n("div", {
535
+ "data-basic-page-header": "",
536
+ className: d(Ae, t),
537
+ ...a
538
+ });
539
+ }
540
+ function Ot({ id: e, className: t, children: a, ...r }) {
541
+ const s = ue(e, a);
542
+ return /* @__PURE__ */ n("h2", {
543
+ id: s,
544
+ className: d("text-display-xs text-pho-primary max-w-full min-w-0 scroll-mt-12 truncate px-5 font-medium", "mb-3 [[data-basic-page-callout]_&]:mb-0 [[data-basic-page-header]>&]:mb-0 [[data-basic-page-stack]>*>&]:mb-0", t),
545
+ ...r,
546
+ children: a
547
+ });
548
+ }
549
+ function Pt({ className: e, ...t }) {
550
+ return /* @__PURE__ */ n("p", {
551
+ className: d("text-display-xs text-pho-description px-5 font-normal", e),
552
+ ...t
553
+ });
554
+ }
555
+ function It({ className: e, ...t }) {
556
+ return /* @__PURE__ */ n("p", {
557
+ className: d("text-pho-description px-5 text-xs font-normal", "mt-3 [[data-basic-page-callout]_&]:mt-0 [[data-basic-page-stack]>*>&]:mt-0", e),
558
+ ...t
559
+ });
560
+ }
561
+ function Lt({ animateHeight: e, className: t, children: a, ...r }) {
562
+ const s = /* @__PURE__ */ n(j, { children: J.toArray(a) });
563
+ return e ? /* @__PURE__ */ n("div", {
564
+ className: d(ce, "min-h-0 overflow-hidden", t),
565
+ ...r,
566
+ children: /* @__PURE__ */ n(je, {
567
+ transition: R,
568
+ className: U,
569
+ children: s
570
+ })
571
+ }) : /* @__PURE__ */ n("div", {
572
+ className: d(Ze, t),
573
+ ...r,
574
+ children: s
575
+ });
576
+ }
577
+ function Bt({ className: e, ...t }) {
578
+ const { leaving: a, ...r } = me();
579
+ return /* @__PURE__ */ n(x.div, {
580
+ ...r,
581
+ className: d(tt, a && "overflow-hidden", e),
582
+ ...t
583
+ });
584
+ }
585
+ function Mt({ divided: e = !1, className: t, ...a }) {
586
+ return /* @__PURE__ */ n("div", {
587
+ className: d(e ? at : nt, t),
588
+ ...a
589
+ });
590
+ }
591
+ function Ht({ className: e, icon: t, children: a, ...r }) {
592
+ if (t == null || t === !1 || t === !0) return /* @__PURE__ */ n("div", {
593
+ "data-basic-page-callout": "",
594
+ className: d(ve, e),
595
+ ...r,
596
+ children: a
597
+ });
598
+ const [s, ...l] = J.toArray(a);
599
+ return /* @__PURE__ */ b("div", {
600
+ "data-basic-page-callout": "",
601
+ className: d(ve, e),
602
+ ...r,
603
+ children: [/* @__PURE__ */ b("div", {
604
+ className: "relative",
605
+ children: [/* @__PURE__ */ n("div", {
606
+ className: "min-w-0 pr-16",
607
+ children: s
608
+ }), /* @__PURE__ */ n("div", {
609
+ "aria-hidden": !0,
610
+ className: "text-pho-primary pointer-events-none absolute top-0 right-0 size-14 opacity-[0.275] [&>svg]:size-full",
611
+ children: t
612
+ })]
613
+ }), l]
614
+ });
615
+ }
616
+ function Dt({ id: e, className: t, children: a, ...r }) {
617
+ const s = ue(e, a);
618
+ return /* @__PURE__ */ n("h2", {
619
+ id: s,
620
+ className: d("text-display-xs text-pho-primary max-w-full min-w-0 scroll-mt-12 truncate font-medium", t),
621
+ ...r,
622
+ children: a
623
+ });
624
+ }
625
+ function Ft({ className: e, ...t }) {
626
+ return /* @__PURE__ */ n("p", {
627
+ className: d("text-display-xs text-pho-description font-normal", e),
628
+ ...t
629
+ });
630
+ }
631
+ function Vt({ label: e, description: t, htmlFor: a, stacked: r = !1, className: s, children: l, ...c }) {
632
+ const { leaving: o, ...i } = me();
633
+ return /* @__PURE__ */ b(x.div, {
634
+ ...i,
635
+ className: d(et, r && "sm:flex-col sm:items-stretch sm:justify-start sm:gap-3", o && "overflow-hidden", s),
636
+ ...c,
637
+ children: [/* @__PURE__ */ b("div", {
638
+ className: "min-w-0",
639
+ children: [a ? /* @__PURE__ */ n("label", {
640
+ htmlFor: a,
641
+ className: "text-pho-primary block text-base font-normal",
642
+ children: e
643
+ }) : /* @__PURE__ */ n("div", {
644
+ className: "text-pho-primary text-base font-normal",
645
+ children: e
646
+ }), t ? /* @__PURE__ */ n("p", {
647
+ className: "text-pho-description text-xs",
648
+ children: t
649
+ }) : null]
650
+ }), /* @__PURE__ */ n("div", {
651
+ className: d("flex w-full min-w-0 items-center gap-2 sm:w-auto", r && "sm:w-full"),
652
+ children: l
653
+ })]
654
+ });
655
+ }
656
+ function Gt({ className: e, ...t }) {
657
+ return /* @__PURE__ */ n("p", {
658
+ className: d("text-pho-description max-w-full min-w-0 truncate text-base", e),
659
+ ...t
660
+ });
661
+ }
662
+ function zt({ error: e, show: t, className: a, children: r, ...s }) {
663
+ const l = I(), c = S(X), o = e ?? c?.error ?? void 0;
664
+ return /* @__PURE__ */ n(j, {
665
+ initial: !1,
666
+ children: (t ?? !0) && (o != null || r != null) ? /* @__PURE__ */ n(x.div, {
667
+ "data-basic-page-alert": "",
668
+ className: "overflow-hidden",
669
+ initial: {
670
+ height: 0,
671
+ opacity: 0
672
+ },
673
+ animate: {
674
+ height: "auto",
675
+ opacity: 1
676
+ },
677
+ exit: {
678
+ height: 0,
679
+ opacity: 0
680
+ },
681
+ transition: l ? { duration: 0 } : {
682
+ height: R,
683
+ opacity: H
684
+ },
685
+ children: /* @__PURE__ */ n(Ge, {
686
+ error: o,
687
+ className: d("px-5 pb-3", a),
688
+ ...s,
689
+ children: r
690
+ })
691
+ }) : null
692
+ });
693
+ }
694
+ function _n() {
695
+ return S(X)?.requestSave ?? null;
696
+ }
697
+ var kn = 800, ae = $e.createToastManager(), X = G(null);
698
+ function $t({ action: e, errors: t, autoSave: a = !1, className: r, children: s, onChange: l, onBlur: c, ...o }) {
699
+ const [i, u] = y(!1), [f, m] = y(!1), [p, h] = y(null), [g, A] = y(t ?? {}), [T, _] = y(null), C = w(null), v = w(null), L = w(null), B = w(!1), O = w(!1), k = w(null), M = w(async () => {
700
+ });
701
+ P(() => () => {
702
+ v.current != null && clearTimeout(v.current);
703
+ }, []);
704
+ const te = async () => {
705
+ const E = C.current;
706
+ if (E == null || e == null) return;
707
+ if (B.current) {
708
+ O.current = !0;
709
+ return;
710
+ }
711
+ if (!E.checkValidity()) return;
712
+ const N = Object.fromEntries(new FormData(E).entries()), Y = L.current;
713
+ B.current = !0, _({
714
+ field: Y,
715
+ phase: "saving"
716
+ }), h(null);
717
+ try {
718
+ const D = (await e(N))?.errors;
719
+ if (D != null && Object.keys(D).length > 0) {
720
+ A(D), _(null);
721
+ return;
722
+ }
723
+ A({}), m(!1), _({
724
+ field: Y,
725
+ phase: "saved"
726
+ }), k.current != null && (ae.close(k.current), k.current = null);
727
+ } catch (D) {
728
+ _(null), h(D), k.current != null && ae.close(k.current), k.current = ae.add({
729
+ type: "error",
730
+ title: "Couldn't save",
731
+ description: D instanceof Error && D.message !== "" ? D.message : "The change is still here — try again.",
732
+ timeout: 0,
733
+ actionProps: {
734
+ children: "Retry",
735
+ onClick: () => {
736
+ M.current();
737
+ }
738
+ }
739
+ });
740
+ } finally {
741
+ B.current = !1, O.current && (O.current = !1, M.current());
742
+ }
743
+ };
744
+ M.current = te;
745
+ const pe = () => {
746
+ v.current != null && clearTimeout(v.current), v.current = setTimeout(() => {
747
+ v.current = null, M.current();
748
+ }, 800);
749
+ }, he = V(() => a ? (E) => {
750
+ E != null && (L.current = E), m(!0), pe();
751
+ } : null, [a]), De = V(() => ({
752
+ pending: i,
753
+ dirty: f,
754
+ error: p,
755
+ auto: T,
756
+ requestSave: he
757
+ }), [
758
+ i,
759
+ f,
760
+ p,
761
+ T,
762
+ he
763
+ ]);
764
+ return /* @__PURE__ */ n(X.Provider, {
765
+ value: De,
766
+ children: /* @__PURE__ */ n(We, {
767
+ errors: g,
768
+ onFormSubmit: async (E) => {
769
+ if (e != null) {
770
+ u(!0), h(null);
771
+ try {
772
+ const N = (await e(E))?.errors;
773
+ if (N != null && Object.keys(N).length > 0) {
774
+ A(N);
775
+ return;
776
+ }
777
+ A({}), m(!1);
778
+ } catch (N) {
779
+ h(N);
780
+ } finally {
781
+ u(!1);
782
+ }
783
+ }
784
+ },
785
+ onChange: (E) => {
786
+ m(!0), h(null);
787
+ const N = E.target.name;
788
+ N && N in g && A((Y) => {
789
+ const { [N]: D, ...Fe } = Y;
790
+ return Fe;
791
+ }), a && (N && (L.current = N), pe()), l?.(E);
792
+ },
793
+ onBlur: (E) => {
794
+ a && f && v.current != null && (clearTimeout(v.current), v.current = null, M.current()), c?.(E);
795
+ },
796
+ className: d("contents [[data-basic-page-stack]>&]:flex [[data-basic-page-stack]>&]:min-w-0 [[data-basic-page-stack]>&]:flex-col", r),
797
+ ...o,
798
+ ref: (E) => {
799
+ C.current = E;
800
+ const N = o.ref;
801
+ typeof N == "function" ? N(E) : N != null && (N.current = E);
802
+ },
803
+ children: /* @__PURE__ */ n("fieldset", {
804
+ disabled: i,
805
+ "aria-busy": i || void 0,
806
+ className: "contents",
807
+ children: s
808
+ })
809
+ })
810
+ });
811
+ }
812
+ function jt({ name: e, className: t, ...a }) {
813
+ const r = S(X), s = I(), l = r?.auto ?? null, c = l != null && (e == null || l.field === e), [o, i] = y(!1), u = c ? l.phase : null;
814
+ P(() => {
815
+ if (u !== "saved") return;
816
+ i(!0);
817
+ const p = setTimeout(() => i(!1), 1800);
818
+ return () => clearTimeout(p);
819
+ }, [u, l]);
820
+ const f = u === "saving" ? "Saving…" : u === "saved" && o ? "Saved" : null, m = s ? "blur(0px)" : "blur(1px)";
821
+ return /* @__PURE__ */ n("span", {
822
+ className: "grid justify-items-end",
823
+ children: /* @__PURE__ */ n(j, {
824
+ initial: !1,
825
+ children: f != null && /* @__PURE__ */ n(x.output, {
826
+ initial: {
827
+ opacity: 0,
828
+ filter: m
829
+ },
830
+ animate: {
831
+ opacity: 1,
832
+ filter: "blur(0px)"
833
+ },
834
+ exit: {
835
+ opacity: 0,
836
+ filter: m
837
+ },
838
+ transition: ee,
839
+ className: d("text-pho-description pl-8 [grid-area:1/1]", t),
840
+ style: { background: "linear-gradient(to left, var(--background-color-pho-primary) calc(100% - 2rem), transparent)" },
841
+ ...a,
842
+ children: f
843
+ }, f)
844
+ })
845
+ });
846
+ }
847
+ var Wt = "flex min-w-0 flex-col gap-5 p-5 [&>[data-basic-page-alert]]:-mx-5 [&>[data-basic-page-alert]]:-mt-2 [&>[data-basic-page-alert]]:-mb-5 [&>[data-basic-page-footer]]:pr-0 [&>[data-basic-page-reveal]]:flex [&>[data-basic-page-reveal]]:flex-col [&>[data-basic-page-reveal]]:gap-5";
848
+ function Xt({ className: e, ...t }) {
849
+ const a = w(null);
850
+ return Ie(a, "Fields", 20, () => null), /* @__PURE__ */ n("div", {
851
+ "data-basic-page-fields": "",
852
+ className: d(ce, Wt, e),
853
+ ...t,
854
+ ref: (r) => {
855
+ a.current = r;
856
+ const s = t.ref;
857
+ typeof s == "function" ? s(r) : s != null && (s.current = r);
858
+ }
859
+ });
860
+ }
861
+ function Kt({ className: e, ...t }) {
862
+ return /* @__PURE__ */ n("div", {
863
+ className: d("flex min-w-0 flex-col gap-5 *:min-w-0 sm:flex-row sm:gap-3 sm:*:flex-1", e),
864
+ ...t
865
+ });
866
+ }
867
+ function Yt({ children: e = "Save changes", ...t }) {
868
+ const a = S(X);
869
+ return /* @__PURE__ */ n(le, {
870
+ type: "submit",
871
+ variant: "effect",
872
+ size: "sm",
873
+ loading: a?.pending,
874
+ ...t,
875
+ children: e
876
+ });
877
+ }
878
+ function qt({ show: e, className: t, ...a }) {
879
+ const r = S(X), s = e === "dirty" ? r?.dirty ?? !1 : e, l = /* @__PURE__ */ n("div", {
880
+ "data-basic-page-footer": "",
881
+ className: d("flex items-center justify-end gap-3 pr-[calc(1.25rem+2.5px)]", t),
882
+ ...a
883
+ });
884
+ return s === void 0 ? l : /* @__PURE__ */ n(Le, {
885
+ show: s,
886
+ gap: "block",
887
+ clip: !1,
888
+ children: l
889
+ });
890
+ }
891
+ var Ut = {
892
+ stack: "-2.5rem",
893
+ block: "-0.75rem",
894
+ fields: "-1.25rem",
895
+ none: "0px"
896
+ };
897
+ function Le({ show: e, clip: t = !0, gap: a = "stack", dividers: r, className: s, ...l }) {
898
+ const c = I(), o = Ut[r ? "none" : a], i = w(null), u = w(e !== !0);
899
+ P(() => {
900
+ u.current = !0;
901
+ }, []);
902
+ const f = () => {
903
+ t && i.current && (i.current.style.overflow = "hidden");
904
+ }, m = () => {
905
+ i.current && (i.current.style.overflow = "");
906
+ };
907
+ return e === void 0 ? /* @__PURE__ */ n(x.div, {
908
+ initial: c ? !1 : {
909
+ opacity: 0,
910
+ y: W
911
+ },
912
+ animate: {
913
+ opacity: 1,
914
+ y: 0
915
+ },
916
+ transition: {
917
+ y: R,
918
+ opacity: H
919
+ },
920
+ className: d(r && U, s),
921
+ ...l
922
+ }) : /* @__PURE__ */ n(j, {
923
+ initial: !1,
924
+ children: e ? /* @__PURE__ */ n(x.div, {
925
+ "data-basic-page-reveal": "",
926
+ ref: (p) => {
927
+ i.current = p, t && p && u.current && (p.style.overflow = "hidden");
928
+ },
929
+ onAnimationStart: f,
930
+ onAnimationComplete: m,
931
+ initial: {
932
+ height: 0,
933
+ opacity: 0,
934
+ marginTop: o
935
+ },
936
+ animate: {
937
+ height: "auto",
938
+ opacity: 1,
939
+ marginTop: 0
940
+ },
941
+ exit: {
942
+ height: 0,
943
+ opacity: 0,
944
+ marginTop: o
945
+ },
946
+ transition: c ? { duration: 0 } : {
947
+ height: R,
948
+ marginTop: R,
949
+ opacity: H
950
+ },
951
+ className: d(r && U, s),
952
+ ...l
953
+ }) : null
954
+ });
955
+ }
956
+ var Qt = "top-4 left-5 h-8 text-base [&>svg]:size-[1.125em] [&>svg]:shrink-0", Jt = "(min-width: 40rem)";
957
+ function Zt() {
958
+ return typeof window < "u" && typeof window.matchMedia == "function" && !window.matchMedia(Jt).matches;
959
+ }
960
+ var Be = G(null);
961
+ function Me({ className: e, children: t, ...a }) {
962
+ const r = J.toArray(t).filter(Ke), s = r.map((C) => C.props.children ?? null), l = Re();
963
+ yt(s);
964
+ const [c] = y(Zt), o = I(), i = r.length, u = Ce(), f = !c && i >= en, m = S(de), p = i > 0 ? r[i - 1]?.props : null, h = p?.children ?? "Back", g = p?.href, A = p?.onClick;
965
+ F(() => {
966
+ if (!(m == null || g == null))
967
+ return m.setTail({
968
+ label: h,
969
+ href: g,
970
+ onClick: A
971
+ }), () => m.setTail(null);
972
+ }, [
973
+ m,
974
+ h,
975
+ g,
976
+ A
977
+ ]);
978
+ const [T, _] = y(!o && !c && l != null && l.labels.length > i);
979
+ return /* @__PURE__ */ n("nav", {
980
+ "aria-label": "Breadcrumb",
981
+ "data-basic-page-back": "",
982
+ className: d("absolute top-4 left-3 flex min-w-max items-center", e),
983
+ ...a,
984
+ children: /* @__PURE__ */ b("ol", {
985
+ className: "m-0 flex list-none items-center p-0",
986
+ children: [r.map((C, v) => f && v > 0 && v < i - 2 ? null : /* @__PURE__ */ b(Xe, { children: [f && v === i - 2 && /* @__PURE__ */ b("li", {
987
+ className: "m-0 flex items-center max-sm:hidden",
988
+ children: [/* @__PURE__ */ n("span", {
989
+ "aria-hidden": !0,
990
+ className: se,
991
+ children: Q
992
+ }), /* @__PURE__ */ b(z.Root, { children: [/* @__PURE__ */ n(z.Trigger, { render: /* @__PURE__ */ n(le, {
993
+ variant: "ghost",
994
+ size: "sm",
995
+ "aria-label": "Hidden pages",
996
+ className: "px-2",
997
+ children: tn
998
+ }) }), /* @__PURE__ */ n(z.Portal, { children: /* @__PURE__ */ n(z.Positioner, {
999
+ align: "start",
1000
+ sideOffset: 4,
1001
+ children: /* @__PURE__ */ n(z.Popup, { children: r.slice(1, i - 2).map((L, B) => {
1002
+ const O = L.props;
1003
+ return /* @__PURE__ */ n(z.LinkItem, {
1004
+ render: /* @__PURE__ */ n(u, {
1005
+ href: O.href,
1006
+ onClick: O.onClick
1007
+ }),
1008
+ children: O.children ?? "Back"
1009
+ }, L.key ?? B);
1010
+ }) })
1011
+ }) })] })]
1012
+ }), /* @__PURE__ */ n("li", {
1013
+ className: d("m-0 flex items-center", v < i - 1 && "max-sm:hidden"),
1014
+ children: /* @__PURE__ */ n(Be.Provider, {
1015
+ value: {
1016
+ index: v,
1017
+ count: i,
1018
+ departing: l,
1019
+ narrow: c
1020
+ },
1021
+ children: C
1022
+ })
1023
+ })] }, C.key ?? v)), T && /* @__PURE__ */ n("li", {
1024
+ "aria-hidden": !0,
1025
+ className: "m-0 flex items-center max-sm:hidden",
1026
+ children: /* @__PURE__ */ n(x.span, {
1027
+ initial: { opacity: 1 },
1028
+ animate: { opacity: 0 },
1029
+ transition: ke,
1030
+ onAnimationComplete: () => _(!1),
1031
+ className: se,
1032
+ children: Q
1033
+ })
1034
+ })]
1035
+ })
1036
+ });
1037
+ }
1038
+ var se = "text-pho-description -mx-1 inline-flex shrink-0 text-base select-none", Q = "/", en = 4, tn = "…";
1039
+ function He({ href: e, className: t, morphId: a, children: r = "Back", ...s }) {
1040
+ const l = S(Be), c = I(), o = a != null && !c, i = Te(o ? a : void 0);
1041
+ if (l == null) throw new Error("BasicPage.Crumb must be rendered inside BasicPage.Breadcrumbs");
1042
+ const { index: u, count: f, departing: m, narrow: p } = l, h = u === 0, g = u === f - 1, A = m != null && m.labels.length < f, T = m != null && m.labels.length > f, _ = g && (m == null || A || p), C = h || g, v = h && g ? "" : h ? "max-sm:hidden" : "sm:hidden", L = m != null, B = g ? p ? T ? "slide" : "fade" : _ ? "fade" : void 0 : void 0, [O, k] = y(o && p && i.fly && m != null && !T ? m.labels[m.labels.length - 1] : null), M = o && C && !L, te = o && !h && g && (m == null || A);
1043
+ return /* @__PURE__ */ b(re, { children: [!h && /* @__PURE__ */ n("span", {
1044
+ "aria-hidden": !0,
1045
+ className: d(se, "max-sm:hidden"),
1046
+ children: te ? /* @__PURE__ */ n(x.span, {
1047
+ initial: i.fly ? {
1048
+ opacity: 0,
1049
+ x: be
1050
+ } : { opacity: 0 },
1051
+ animate: i.fly ? {
1052
+ opacity: 1,
1053
+ x: 0
1054
+ } : { opacity: 1 },
1055
+ transition: i.fly ? xe : H,
1056
+ className: "inline-flex",
1057
+ children: Q
1058
+ }) : Q
1059
+ }), /* @__PURE__ */ n(oe, {
1060
+ variant: "ghost",
1061
+ size: "sm",
1062
+ href: e,
1063
+ prefix: C ? M ? /* @__PURE__ */ n(x.span, {
1064
+ initial: i.fly ? {
1065
+ opacity: 0,
1066
+ x: be
1067
+ } : { opacity: 0 },
1068
+ animate: i.fly ? {
1069
+ opacity: 1,
1070
+ x: 0
1071
+ } : { opacity: 1 },
1072
+ transition: i.fly ? xe : H,
1073
+ className: d("inline-flex [&>svg]:size-[1.125em] [&>svg]:shrink-0", v),
1074
+ children: /* @__PURE__ */ n(q, {})
1075
+ }) : /* @__PURE__ */ n("span", {
1076
+ className: d("inline-flex [&>svg]:size-[1.125em] [&>svg]:shrink-0", v),
1077
+ children: /* @__PURE__ */ n(q, {})
1078
+ }) : /* @__PURE__ */ n("span", { className: "hidden" }),
1079
+ className: d("min-w-max", t),
1080
+ ...s,
1081
+ children: o && a != null ? /* @__PURE__ */ b("span", {
1082
+ className: d("relative block", !i.fly && B === "slide" && "overflow-hidden", !g && "max-w-40 truncate"),
1083
+ children: [/* @__PURE__ */ n(Oe, {
1084
+ morphId: a,
1085
+ fromClassName: "text-pho-primary",
1086
+ fly: i.fly,
1087
+ morphRef: i.ref,
1088
+ arrival: B,
1089
+ children: r
1090
+ }), O != null && /* @__PURE__ */ n(x.span, {
1091
+ "aria-hidden": !0,
1092
+ initial: {
1093
+ x: 0,
1094
+ opacity: 1
1095
+ },
1096
+ animate: {
1097
+ x: ht,
1098
+ opacity: 0
1099
+ },
1100
+ transition: gt,
1101
+ onAnimationComplete: () => k(null),
1102
+ className: "pointer-events-none absolute inset-y-0 left-0 whitespace-nowrap",
1103
+ children: O
1104
+ })]
1105
+ }) : /* @__PURE__ */ n("span", {
1106
+ className: d("block", !g && "max-w-40 truncate"),
1107
+ children: r
1108
+ })
1109
+ })] });
1110
+ }
1111
+ function nn({ className: e, ...t }) {
1112
+ return /* @__PURE__ */ n(Me, {
1113
+ className: e,
1114
+ children: /* @__PURE__ */ n(He, { ...t })
1115
+ });
1116
+ }
1117
+ function an({ label: e, description: t, leading: a, href: r, className: s, children: l, ...c }) {
1118
+ const o = Ce(), i = V(() => x.create(o), [o]), { leaving: u, ...f } = me();
1119
+ return /* @__PURE__ */ b(i, {
1120
+ href: r,
1121
+ ...f,
1122
+ ...c,
1123
+ className: d("flex min-h-[4.25rem] min-w-0 flex-row items-center justify-between gap-6 px-5 py-4", "group outline-pho-brand hover:bg-pho-primary-hover cursor-pointer transition-colors focus-visible:outline-2 focus-visible:-outline-offset-2", "aria-[current=page]:bg-pho-primary-hover", "first:rounded-t-[calc(var(--radius-base)-1px)] last:rounded-b-[calc(var(--radius-base)-1px)]", u && "overflow-hidden", s),
1124
+ children: [/* @__PURE__ */ b("div", {
1125
+ className: d("flex min-w-0 flex-1 items-center", a != null && "gap-3"),
1126
+ children: [a, /* @__PURE__ */ b("div", {
1127
+ className: "min-w-0",
1128
+ children: [/* @__PURE__ */ n("div", {
1129
+ className: "flex min-w-0 items-center gap-1",
1130
+ children: typeof e == "string" || typeof e == "number" ? /* @__PURE__ */ n("p", {
1131
+ className: "text-pho-primary truncate text-base font-medium",
1132
+ children: e
1133
+ }) : e
1134
+ }), t ? /* @__PURE__ */ n("div", {
1135
+ className: "text-pho-description truncate text-xs",
1136
+ children: t
1137
+ }) : null]
1138
+ })]
1139
+ }), /* @__PURE__ */ b("div", {
1140
+ className: "flex min-w-0 items-center justify-end gap-2",
1141
+ children: [l != null ? /* @__PURE__ */ n("div", {
1142
+ className: "min-w-0",
1143
+ children: l
1144
+ }) : null, /* @__PURE__ */ n(Je, {
1145
+ "aria-hidden": !0,
1146
+ className: "text-pho-secondary group-hover:text-pho-secondary-hover size-4 shrink-0 transition-colors"
1147
+ })]
1148
+ })]
1149
+ });
1150
+ }
1151
+ function rn({ open: e, onClose: t, children: a }) {
1152
+ const r = S(Ee), s = e ?? J.toArray(a).length > 0, l = r?.setOpen;
1153
+ return F(() => {
1154
+ if (l != null)
1155
+ return l(s), () => l(!1);
1156
+ }, [l, s]), P(() => {
1157
+ r == null && typeof process < "u" && process.env.NODE_ENV !== "production" && console.warn('BasicPage.Aside: needs a `BasicPage.Root width="wide"` around it.');
1158
+ }, [r]), r == null || r.slot == null ? null : r.presentation === "page" ? ge(s ? /* @__PURE__ */ n("div", {
1159
+ "data-basic-page-aside": "page",
1160
+ className: "flex min-w-0 flex-1 flex-col",
1161
+ children: a
1162
+ }) : null, r.slot) : ge(/* @__PURE__ */ n(j, {
1163
+ initial: !1,
1164
+ children: s && /* @__PURE__ */ n(sn, {
1165
+ width: r.width,
1166
+ paneHeight: r.paneHeight,
1167
+ onClose: t,
1168
+ children: a
1169
+ }, "panel")
1170
+ }), r.slot);
1171
+ }
1172
+ function sn({ width: e, paneHeight: t, onClose: a, children: r }) {
1173
+ const s = I(), [l, c] = y(null), o = V(() => ({ setBack: c }), []), i = w(null), u = s ? "blur(0px)" : "blur(1px)", f = t ?? "100dvh", m = {
1174
+ variant: "ghost",
1175
+ size: "sm",
1176
+ svgOnly: !0,
1177
+ "aria-label": "Close",
1178
+ children: /* @__PURE__ */ n(ze, {})
1179
+ };
1180
+ return P(() => {
1181
+ const p = (h) => {
1182
+ h.key !== "Escape" || h.defaultPrevented || (h.preventDefault(), i.current?.querySelector("a, button")?.click());
1183
+ };
1184
+ return document.addEventListener("keydown", p), () => document.removeEventListener("keydown", p);
1185
+ }, []), /* @__PURE__ */ n(x.aside, {
1186
+ "data-basic-page-aside": "panel",
1187
+ initial: { width: 0 },
1188
+ animate: { width: e },
1189
+ exit: { width: 0 },
1190
+ transition: s ? { duration: 0 } : Se,
1191
+ className: "relative flex shrink-0 justify-end overflow-clip",
1192
+ style: { minHeight: f },
1193
+ children: /* @__PURE__ */ b(x.div, {
1194
+ initial: {
1195
+ opacity: 0,
1196
+ filter: u
1197
+ },
1198
+ animate: {
1199
+ opacity: 1,
1200
+ filter: "blur(0px)"
1201
+ },
1202
+ exit: {
1203
+ opacity: 0,
1204
+ filter: u
1205
+ },
1206
+ transition: ee,
1207
+ className: "border-pho-secondary bg-pho-primary shadow-pho-xl sticky top-0 flex shrink-0 flex-col border-l",
1208
+ style: {
1209
+ width: e,
1210
+ height: f
1211
+ },
1212
+ children: [/* @__PURE__ */ n("span", {
1213
+ ref: i,
1214
+ className: "absolute top-2 right-2 z-30",
1215
+ children: l != null ? /* @__PURE__ */ n(oe, {
1216
+ ...m,
1217
+ href: l.href,
1218
+ onClick: l.onClick
1219
+ }) : /* @__PURE__ */ n(le, {
1220
+ ...m,
1221
+ onClick: a
1222
+ })
1223
+ }), /* @__PURE__ */ b(K.Root, {
1224
+ className: "min-h-0 flex-1",
1225
+ children: [/* @__PURE__ */ n(K.Viewport, { children: /* @__PURE__ */ n(K.Content, {
1226
+ className: "flex min-h-full flex-col",
1227
+ children: /* @__PURE__ */ n(_e.Provider, {
1228
+ value: o,
1229
+ children: r
1230
+ })
1231
+ }) }), /* @__PURE__ */ n(K.Scrollbar, { children: /* @__PURE__ */ n(K.Thumb, {}) })]
1232
+ })]
1233
+ })
1234
+ });
1235
+ }
1236
+ var Rn = {
1237
+ Root: ot,
1238
+ Aside: rn,
1239
+ CondenseScope: xt,
1240
+ Breadcrumbs: Me,
1241
+ Crumb: He,
1242
+ Back: nn,
1243
+ Title: Ct,
1244
+ Stack: St,
1245
+ Header: Tt,
1246
+ SectionTitle: Ot,
1247
+ Description: Pt,
1248
+ SectionFooter: It,
1249
+ Card: Lt,
1250
+ Item: Bt,
1251
+ ItemPanel: Mt,
1252
+ Callout: Ht,
1253
+ CalloutTitle: Dt,
1254
+ CalloutDescription: Ft,
1255
+ Row: Vt,
1256
+ RowLink: an,
1257
+ Value: Gt,
1258
+ Alert: zt,
1259
+ Footer: qt,
1260
+ Form: $t,
1261
+ Saved: jt,
1262
+ Fields: Xt,
1263
+ Inline: Kt,
1264
+ Submit: Yt,
1265
+ Reveal: Le
1266
+ };
1267
+ export {
1268
+ nt as a,
1269
+ Rn as c,
1270
+ Se as d,
1271
+ ae as f,
1272
+ tt as i,
1273
+ ee as l,
1274
+ Cn as m,
1275
+ ve as n,
1276
+ at as o,
1277
+ _n as p,
1278
+ Ze as r,
1279
+ et as s,
1280
+ kn as t,
1281
+ En as u
1282
+ };
1283
+
1284
+ //# sourceMappingURL=basic-page-w6ftlo0h.js.map