mado-ui 0.2.2 → 0.3.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 CHANGED
@@ -2,9 +2,29 @@
2
2
 
3
3
  var jsxRuntime = require('react/jsx-runtime');
4
4
  var tailwindMerge = require('tailwind-merge');
5
- var react = require('react');
6
- var react$1 = require('@headlessui/react');
7
- var reactDom = require('react-dom');
5
+ var React = require('react');
6
+ var react = require('@headlessui/react');
7
+ var ReactDOM = require('react-dom');
8
+
9
+ function _interopNamespaceDefault(e) {
10
+ var n = Object.create(null);
11
+ if (e) {
12
+ Object.keys(e).forEach(function (k) {
13
+ if (k !== 'default') {
14
+ var d = Object.getOwnPropertyDescriptor(e, k);
15
+ Object.defineProperty(n, k, d.get ? d : {
16
+ enumerable: true,
17
+ get: function () { return e[k]; }
18
+ });
19
+ }
20
+ });
21
+ }
22
+ n.default = e;
23
+ return Object.freeze(n);
24
+ }
25
+
26
+ var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
27
+ var ReactDOM__namespace = /*#__PURE__*/_interopNamespaceDefault(ReactDOM);
8
28
 
9
29
  const integerList = Array.from({ length: 100 }, (_, i) => `${i + 1}`);
10
30
  const twMerge = tailwindMerge.extendTailwindMerge({
@@ -227,14 +247,14 @@ function getWeekdayName(weekday = d) {
227
247
  }
228
248
 
229
249
  function findComponentByType(children, componentType) {
230
- const childrenArray = react.Children.toArray(children);
250
+ const childrenArray = React.Children.toArray(children);
231
251
  for (const child of childrenArray) {
232
- if (react.isValidElement(child) && child.type === componentType)
252
+ if (React.isValidElement(child) && child.type === componentType)
233
253
  return child;
234
254
  }
235
255
  for (const child of childrenArray) {
236
- if (react.isValidElement(child)) {
237
- if (child.type === react.Fragment && child.props.children) {
256
+ if (React.isValidElement(child)) {
257
+ if (child.type === React.Fragment && child.props.children) {
238
258
  const found = findComponentByType(child.props.children, componentType);
239
259
  if (found)
240
260
  return found;
@@ -310,7 +330,7 @@ function twSort(className) {
310
330
  return className;
311
331
  }
312
332
 
313
- function Anchor({ className, disabled, href, onClick, ref, target, rel, ...props }) {
333
+ function Anchor({ as, className, disabled, href, onClick, target, rel, ...props }) {
314
334
  const isExternal = `${href}`.startsWith('http'), hasHash = `${href}`.includes('#');
315
335
  const handleClick = e => {
316
336
  if (disabled)
@@ -318,7 +338,8 @@ function Anchor({ className, disabled, href, onClick, ref, target, rel, ...props
318
338
  onClick?.(e);
319
339
  setTimeout(() => history.replaceState({}, document.title, location.pathname), 100);
320
340
  };
321
- return (jsxRuntime.jsx("a", { ref: ref, ...props, "aria-disabled": disabled, className: twMerge(className, disabled && 'pointer-events-none'), href: href, target: target || (isExternal ? '_blank' : '_self'), onClick: hasHash ? handleClick : onClick, rel: rel !== undefined
341
+ const AnchorElement = as || 'a';
342
+ return (jsxRuntime.jsx(AnchorElement, { ...props, "aria-disabled": disabled, className: twMerge(className, disabled && 'pointer-events-none'), href: href, target: target || (isExternal ? '_blank' : '_self'), onClick: hasHash ? handleClick : onClick, rel: rel !== undefined
322
343
  ? rel === 'nofollow'
323
344
  ? `${rel} noreferrer noopener`
324
345
  : `${rel} prefetch`
@@ -347,68 +368,104 @@ const lineLiftClasses = tailwindMerge.twJoin([
347
368
  ]);
348
369
  const fillClasses = tailwindMerge.twJoin(baseClasses, 'whitespace-nowrap transition-[transform_color] after:top-1/2 after:h-[calc(100%+0.05rem)] after:w-[calc(100%+0.25rem)] after:-translate-y-1/2 after:rounded after:ease-exponential active:text-zinc-50 pointer-fine:hover:text-zinc-50');
349
370
  // Define theme-specific fill color transition classes
350
- const getFillColorTransitionClasses = (theme = 'blue') => {
371
+ const getFillColorTransitionClasses = (theme = 'blue', customTheme) => {
372
+ let fillColorTransitionClasses = tailwindMerge.twJoin(fillClasses, 'transition-transform after:bg-(--theme-color)');
351
373
  switch (theme) {
374
+ case 'blue':
375
+ fillColorTransitionClasses = tailwindMerge.twJoin(fillColorTransitionClasses, 'after:[--theme-color:var(--color-ui-blue)]');
376
+ break;
352
377
  case 'brown':
353
- return tailwindMerge.twJoin(fillClasses, 'after:bg-ui-brown after:transition-transform contrast-more:after:bg-ui-brown');
378
+ fillColorTransitionClasses = tailwindMerge.twJoin(fillColorTransitionClasses, 'after:[--theme-color:var(--color-ui-brow)]');
379
+ break;
354
380
  case 'green':
355
- return tailwindMerge.twJoin(fillClasses, 'after:bg-ui-green after:transition-transform contrast-more:after:bg-ui-green');
381
+ fillColorTransitionClasses = tailwindMerge.twJoin(fillColorTransitionClasses, 'after:[--theme-color:var(--color-ui-green)]');
382
+ break;
356
383
  case 'grey':
357
- return tailwindMerge.twJoin(fillClasses, 'after:bg-ui-grey after:transition-transform contrast-more:after:bg-ui-grey');
384
+ fillColorTransitionClasses = tailwindMerge.twJoin(fillColorTransitionClasses, 'after:[--theme-color:var(--color-ui-grey)]');
385
+ break;
358
386
  case 'sky-blue':
359
- return tailwindMerge.twJoin(fillClasses, 'after:bg-ui-sky-blue after:transition-transform contrast-more:after:bg-ui-sky-blue');
387
+ fillColorTransitionClasses = tailwindMerge.twJoin(fillColorTransitionClasses, 'after:[--theme-color:var(--color-ui-sky-blue)]');
388
+ break;
360
389
  case 'magenta':
361
- return tailwindMerge.twJoin(fillClasses, 'after:bg-ui-magenta after:transition-transform contrast-more:after:bg-ui-magenta');
362
- case 'neutral':
363
- return tailwindMerge.twJoin(fillClasses, 'after:bg-zinc-700 after:transition-transform contrast-more:after:bg-zinc-700 dark:after:bg-zinc-300 dark:contrast-more:after:bg-zinc-300');
390
+ fillColorTransitionClasses = tailwindMerge.twJoin(fillColorTransitionClasses, 'after:[--theme-color:var(--color-ui-magenta)]');
391
+ break;
364
392
  case 'orange':
365
- return tailwindMerge.twJoin(fillClasses, 'after:bg-ui-orange after:transition-transform contrast-more:after:bg-ui-orange');
393
+ fillColorTransitionClasses = tailwindMerge.twJoin(fillColorTransitionClasses, 'after:[--theme-color:var(--color-ui-orange)]');
394
+ break;
366
395
  case 'pink':
367
- return tailwindMerge.twJoin(fillClasses, 'after:bg-ui-pink after:transition-transform contrast-more:after:bg-ui-pink');
396
+ fillColorTransitionClasses = tailwindMerge.twJoin(fillColorTransitionClasses, 'after:[--theme-color:var(--color-ui-pink)]');
397
+ break;
368
398
  case 'purple':
369
- return tailwindMerge.twJoin(fillClasses, 'after:bg-ui-purple after:transition-transform contrast-more:after:bg-ui-purple');
399
+ fillColorTransitionClasses = tailwindMerge.twJoin(fillColorTransitionClasses, 'after:[--theme-color:var(--color-ui-purple)]');
400
+ break;
370
401
  case 'red':
371
- return tailwindMerge.twJoin(fillClasses, 'after:bg-ui-red after:transition-transform contrast-more:after:bg-ui-red');
402
+ fillColorTransitionClasses = tailwindMerge.twJoin(fillColorTransitionClasses, 'after:[--theme-color:var(--color-ui-red)]');
403
+ break;
372
404
  case 'violet':
373
- return tailwindMerge.twJoin(fillClasses, 'after:bg-ui-violet after:transition-transform contrast-more:after:bg-ui-violet');
405
+ fillColorTransitionClasses = tailwindMerge.twJoin(fillColorTransitionClasses, 'after:[--theme-color:var(--color-ui-violet)]');
406
+ break;
374
407
  case 'yellow':
375
- return tailwindMerge.twJoin(fillClasses, 'after:bg-ui-yellow after:transition-transform contrast-more:after:bg-ui-yellow');
376
- case 'blue':
377
- default:
378
- return tailwindMerge.twJoin(fillClasses, 'after:bg-ui-blue after:transition-transform contrast-more:after:bg-ui-blue');
408
+ fillColorTransitionClasses = tailwindMerge.twJoin(fillColorTransitionClasses, 'after:[--theme-color:var(--color-ui-yellow)]');
409
+ break;
410
+ case 'custom':
411
+ if (customTheme && customTheme.themeColor && !customTheme.themeColor.includes('after:[--theme-color:'))
412
+ throw new Error('`customTheme.themeColor` must modify the `--theme-color` variable on the ::after pseudo element. Otherwise, please use `customTheme.classes`.');
413
+ fillColorTransitionClasses = customTheme.themeColor
414
+ ? twMerge(fillColorTransitionClasses, customTheme.themeColor)
415
+ : twMerge(fillClasses, customTheme.classes);
416
+ break;
379
417
  }
418
+ return fillColorTransitionClasses;
380
419
  };
381
420
  // Define theme-specific fill center classes
382
- const getFillCenterClasses = (theme = 'blue') => {
421
+ const getFillCenterClasses = (theme = 'blue', customTheme) => {
422
+ let fillCenterColorClasses = tailwindMerge.twJoin(fillClasses, 'after:scale-x-50 after:scale-y-[0.25] after:bg-(--theme-color)/0 after:transition-[transform_background-color] active:after:scale-x-100 active:after:scale-y-100 active:after:bg-(--theme-color) pointer-fine:hover:after:scale-x-100 pointer-fine:hover:after:scale-y-100 pointer-fine:hover:after:bg-(--theme-color)');
383
423
  switch (theme) {
424
+ case 'blue':
425
+ fillCenterColorClasses = tailwindMerge.twJoin(fillCenterColorClasses, 'after:[--theme-color:var(--color-ui-blue)]');
426
+ break;
384
427
  case 'brown':
385
- return tailwindMerge.twJoin(fillClasses, 'after:scale-x-50 after:scale-y-[0.25] after:bg-ui-brown/0 after:transition-[transform_background-color] active:after:scale-x-100 active:after:scale-y-100 active:after:bg-ui-brown pointer-fine:hover:after:scale-x-100 pointer-fine:hover:after:scale-y-100 pointer-fine:hover:after:bg-ui-brown');
428
+ fillCenterColorClasses = tailwindMerge.twJoin(fillCenterColorClasses, 'after:[--theme-color:var(--color-ui-brown)]');
429
+ break;
386
430
  case 'green':
387
- return tailwindMerge.twJoin(fillClasses, 'after:scale-x-50 after:scale-y-[0.25] after:bg-ui-green/0 after:transition-[transform_background-color] active:after:scale-x-100 active:after:scale-y-100 active:after:bg-ui-green pointer-fine:hover:after:scale-x-100 pointer-fine:hover:after:scale-y-100 pointer-fine:hover:after:bg-ui-green');
431
+ fillCenterColorClasses = tailwindMerge.twJoin(fillCenterColorClasses, 'after:[--theme-color:var(--color-ui-green)]');
432
+ break;
388
433
  case 'grey':
389
- return tailwindMerge.twJoin(fillClasses, 'after:scale-x-50 after:scale-y-[0.25] after:bg-ui-grey/0 after:transition-[transform_background-color] active:after:scale-x-100 active:after:scale-y-100 active:after:bg-ui-grey pointer-fine:hover:after:scale-x-100 pointer-fine:hover:after:scale-y-100 pointer-fine:hover:after:bg-ui-grey');
434
+ fillCenterColorClasses = tailwindMerge.twJoin(fillCenterColorClasses, 'after:[--theme-color:var(--color-ui-grey)]');
435
+ break;
390
436
  case 'sky-blue':
391
- return tailwindMerge.twJoin(fillClasses, 'after:scale-x-50 after:scale-y-[0.25] after:bg-ui-sky-blue/0 after:transition-[transform_background-color] active:after:scale-x-100 active:after:scale-y-100 active:after:bg-ui-sky-blue pointer-fine:hover:after:scale-x-100 pointer-fine:hover:after:scale-y-100 pointer-fine:hover:after:bg-ui-sky-blue');
437
+ fillCenterColorClasses = tailwindMerge.twJoin(fillCenterColorClasses, 'after:[--theme-color:var(--color-ui-sky-blue)]');
438
+ break;
392
439
  case 'magenta':
393
- return tailwindMerge.twJoin(fillClasses, 'after:scale-x-50 after:scale-y-[0.25] after:bg-ui-magenta/0 after:transition-[transform_background-color] active:after:scale-x-100 active:after:scale-y-100 active:after:bg-ui-magenta pointer-fine:hover:after:scale-x-100 pointer-fine:hover:after:scale-y-100 pointer-fine:hover:after:bg-ui-magenta');
394
- case 'neutral':
395
- return tailwindMerge.twJoin(fillClasses, 'after:scale-x-50 after:scale-y-[0.25] after:bg-zinc-700/0 after:transition-[transform_background-color] active:after:scale-x-100 active:after:scale-y-100 active:after:bg-zinc-700 dark:after:bg-zinc-300/0 dark:active:after:bg-zinc-300 pointer-fine:hover:after:scale-x-100 pointer-fine:hover:after:scale-y-100 pointer-fine:hover:after:bg-zinc-700 dark:pointer-fine:hover:after:bg-zinc-300');
440
+ fillCenterColorClasses = tailwindMerge.twJoin(fillCenterColorClasses, 'after:[--theme-color:var(--color-ui-magenta)]');
441
+ break;
396
442
  case 'orange':
397
- return tailwindMerge.twJoin(fillClasses, 'after:scale-x-50 after:scale-y-[0.25] after:bg-ui-orange/0 after:transition-[transform_background-color] active:after:scale-x-100 active:after:scale-y-100 active:after:bg-ui-orange pointer-fine:hover:after:scale-x-100 pointer-fine:hover:after:scale-y-100 pointer-fine:hover:after:bg-ui-orange');
443
+ fillCenterColorClasses = tailwindMerge.twJoin(fillCenterColorClasses, 'after:[--theme-color:var(--color-ui-orange)]');
444
+ break;
398
445
  case 'pink':
399
- return tailwindMerge.twJoin(fillClasses, 'after:scale-x-50 after:scale-y-[0.25] after:bg-ui-pink/0 after:transition-[transform_background-color] active:after:scale-x-100 active:after:scale-y-100 active:after:bg-ui-pink pointer-fine:hover:after:scale-x-100 pointer-fine:hover:after:scale-y-100 pointer-fine:hover:after:bg-ui-pink');
446
+ fillCenterColorClasses = tailwindMerge.twJoin(fillCenterColorClasses, 'after:[--theme-color:var(--color-ui-pink)]');
447
+ break;
400
448
  case 'purple':
401
- return tailwindMerge.twJoin(fillClasses, 'after:scale-x-50 after:scale-y-[0.25] after:bg-ui-purple/0 after:transition-[transform_background-color] active:after:scale-x-100 active:after:scale-y-100 active:after:bg-ui-purple pointer-fine:hover:after:scale-x-100 pointer-fine:hover:after:scale-y-100 pointer-fine:hover:after:bg-ui-purple');
449
+ fillCenterColorClasses = tailwindMerge.twJoin(fillCenterColorClasses, 'after:[--theme-color:var(--color-ui-purple)]');
450
+ break;
402
451
  case 'red':
403
- return tailwindMerge.twJoin(fillClasses, 'after:scale-x-50 after:scale-y-[0.25] after:bg-ui-red/0 after:transition-[transform_background-color] active:after:scale-x-100 active:after:scale-y-100 active:after:bg-ui-red pointer-fine:hover:after:scale-x-100 pointer-fine:hover:after:scale-y-100 pointer-fine:hover:after:bg-ui-red');
452
+ fillCenterColorClasses = tailwindMerge.twJoin(fillCenterColorClasses, 'after:[--theme-color:var(--color-ui-red)]');
453
+ break;
404
454
  case 'violet':
405
- return tailwindMerge.twJoin(fillClasses, 'after:scale-x-50 after:scale-y-[0.25] after:bg-ui-violet/0 after:transition-[transform_background-color] active:after:scale-x-100 active:after:scale-y-100 active:after:bg-ui-violet pointer-fine:hover:after:scale-x-100 pointer-fine:hover:after:scale-y-100 pointer-fine:hover:after:bg-ui-violet');
455
+ fillCenterColorClasses = tailwindMerge.twJoin(fillCenterColorClasses, 'after:[--theme-color:var(--color-ui-violet)]');
456
+ break;
406
457
  case 'yellow':
407
- return tailwindMerge.twJoin(fillClasses, 'after:scale-x-50 after:scale-y-[0.25] after:bg-ui-yellow/0 after:transition-[transform_background-color] active:after:scale-x-100 active:after:scale-y-100 active:after:bg-ui-yellow pointer-fine:hover:after:scale-x-100 pointer-fine:hover:after:scale-y-100 pointer-fine:hover:after:bg-ui-yellow');
408
- case 'blue':
409
- default:
410
- return tailwindMerge.twJoin(fillClasses, 'after:scale-x-50 after:scale-y-[0.25] after:bg-ui-blue/0 after:transition-[transform_background-color] active:after:scale-x-100 active:after:scale-y-100 active:after:bg-ui-blue pointer-fine:hover:after:scale-x-100 pointer-fine:hover:after:scale-y-100 pointer-fine:hover:after:bg-ui-blue');
458
+ fillCenterColorClasses = tailwindMerge.twJoin(fillCenterColorClasses, 'after:[--theme-color:var(--color-ui-yellow)]');
459
+ break;
460
+ case 'custom':
461
+ if (customTheme && customTheme.themeColor && !customTheme.themeColor.includes('after:[--theme-color:'))
462
+ throw new Error('`customTheme.themeColor` must modify the `--theme-color` variable on the ::after pseudo element. Otherwise, please use `customTheme.classes`.');
463
+ fillCenterColorClasses = customTheme.themeColor
464
+ ? twMerge(fillCenterColorClasses, customTheme.themeColor)
465
+ : twMerge(fillClasses, customTheme.classes);
466
+ break;
411
467
  }
468
+ return fillCenterColorClasses;
412
469
  };
413
470
  const multilineBaseClasses = twSort('bg-linear-to-r from-current to-current bg-no-repeat active:scale-95');
414
471
  const multilineLineStaticClasses = 'underline';
@@ -420,80 +477,115 @@ const multilineLineRtlClasses = tailwindMerge.twJoin([multilineXClasses, 'bg-[po
420
477
  const multilineLineCenterClasses = tailwindMerge.twJoin([multilineXClasses, 'bg-[position:50%_100%]']);
421
478
  const multilineLineLiftClasses = tailwindMerge.twJoin(multilineLineClasses, 'bg-[size:auto_0px] focus-visible:bg-[size:auto_2px] active:bg-[size:auto_2px] pointer-fine:hover:bg-[size:auto_2px]');
422
479
  const multilineFillBaseClasses = tailwindMerge.twJoin(multilineBaseClasses, 'rounded px-0.5 py-0.75 focus-visible:text-zinc-50 active:text-zinc-50 pointer-fine:hover:text-zinc-50');
423
- const getMultilineFillColorClasses = (theme = 'blue') => {
480
+ const getMultilineFillColorClasses = (theme = 'blue', customTheme) => {
481
+ let multilineFillColorClasses = tailwindMerge.twJoin(multilineFillBaseClasses, 'from-(--theme-color) to-(--theme-color) transition-[background-size_color]');
424
482
  switch (theme) {
483
+ case 'blue':
484
+ multilineFillColorClasses = tailwindMerge.twJoin(multilineFillColorClasses, '[--theme-color:var(--color-ui-blue)]');
485
+ break;
425
486
  case 'brown':
426
- return tailwindMerge.twJoin(multilineFillBaseClasses, 'from-ui-brown to-ui-brown transition-[background-size_color] contrast-more:from-ui-brown contrast-more:to-ui-brown');
487
+ multilineFillColorClasses = tailwindMerge.twJoin(multilineFillColorClasses, '[--theme-color:var(--color-ui-brown)]');
488
+ break;
427
489
  case 'green':
428
- return tailwindMerge.twJoin(multilineFillBaseClasses, 'from-ui-green to-ui-green transition-[background-size_color] contrast-more:from-ui-green contrast-more:to-ui-green');
490
+ multilineFillColorClasses = tailwindMerge.twJoin(multilineFillColorClasses, '[--theme-color:var(--color-ui-green)]');
491
+ break;
429
492
  case 'grey':
430
- return tailwindMerge.twJoin(multilineFillBaseClasses, 'from-ui-grey to-ui-grey transition-[background-size_color] contrast-more:from-ui-grey contrast-more:to-ui-grey');
493
+ multilineFillColorClasses = tailwindMerge.twJoin(multilineFillColorClasses, '[--theme-color:var(--color-ui-grey)]');
494
+ break;
431
495
  case 'sky-blue':
432
- return tailwindMerge.twJoin(multilineFillBaseClasses, 'from-ui-sky-blue to-ui-sky-blue transition-[background-size_color] contrast-more:from-ui-sky-blue contrast-more:to-ui-sky-blue');
496
+ multilineFillColorClasses = tailwindMerge.twJoin(multilineFillColorClasses, '[--theme-color:var(--color-ui-sky-blue)]');
497
+ break;
433
498
  case 'magenta':
434
- return tailwindMerge.twJoin(multilineFillBaseClasses, 'from-ui-magenta to-ui-magenta transition-[background-size_color] contrast-more:from-ui-magenta contrast-more:to-ui-magenta');
435
- case 'neutral':
436
- return tailwindMerge.twJoin(multilineFillBaseClasses, 'from-zinc-700 to-zinc-700 transition-[background-size_color] contrast-more:from-zinc-700 contrast-more:to-zinc-700 dark:from-zinc-300 dark:to-zinc-300 dark:contrast-more:from-zinc-300 dark:contrast-more:to-zinc-300');
499
+ multilineFillColorClasses = tailwindMerge.twJoin(multilineFillColorClasses, '[--theme-color:var(--color-ui-magenta)]');
500
+ break;
437
501
  case 'orange':
438
- return tailwindMerge.twJoin(multilineFillBaseClasses, 'from-ui-orange to-ui-orange transition-[background-size_color] contrast-more:from-ui-orange contrast-more:to-ui-orange');
502
+ multilineFillColorClasses = tailwindMerge.twJoin(multilineFillColorClasses, '[--theme-color:var(--color-ui-orange)]');
503
+ break;
439
504
  case 'pink':
440
- return tailwindMerge.twJoin(multilineFillBaseClasses, 'from-ui-pink to-ui-pink transition-[background-size_color] contrast-more:from-ui-pink contrast-more:to-ui-pink');
505
+ multilineFillColorClasses = tailwindMerge.twJoin(multilineFillColorClasses, '[--theme-color:var(--color-ui-pink)]');
506
+ break;
441
507
  case 'purple':
442
- return tailwindMerge.twJoin(multilineFillBaseClasses, 'from-ui-purple to-ui-purple transition-[background-size_color] contrast-more:from-ui-purple contrast-more:to-ui-purple');
508
+ multilineFillColorClasses = tailwindMerge.twJoin(multilineFillColorClasses, '[--theme-color:var(--color-ui-purple)]');
509
+ break;
443
510
  case 'red':
444
- return tailwindMerge.twJoin(multilineFillBaseClasses, 'from-ui-red to-ui-red transition-[background-size_color] contrast-more:from-ui-red contrast-more:to-ui-red');
511
+ multilineFillColorClasses = tailwindMerge.twJoin(multilineFillColorClasses, '[--theme-color:var(--color-ui-red)]');
512
+ break;
445
513
  case 'violet':
446
- return tailwindMerge.twJoin(multilineFillBaseClasses, 'from-ui-violet to-ui-violet transition-[background-size_color] contrast-more:from-ui-violet contrast-more:to-ui-violet');
514
+ multilineFillColorClasses = tailwindMerge.twJoin(multilineFillColorClasses, '[--theme-color:var(--color-ui-violet)]');
515
+ break;
447
516
  case 'yellow':
448
- return tailwindMerge.twJoin(multilineFillBaseClasses, 'from-ui-yellow to-ui-yellow transition-[background-size_color] contrast-more:from-ui-yellow contrast-more:to-ui-yellow');
449
- case 'blue':
450
- default:
451
- return tailwindMerge.twJoin(multilineFillBaseClasses, 'from-ui-blue to-ui-blue transition-[background-size_color] contrast-more:from-ui-blue contrast-more:to-ui-blue');
517
+ multilineFillColorClasses = tailwindMerge.twJoin(multilineFillColorClasses, '[--theme-color:var(--color-ui-yellow)]');
518
+ break;
519
+ case 'custom':
520
+ if (customTheme && customTheme.themeColor && !customTheme.themeColor.includes('[--theme-color:'))
521
+ throw new Error('`customTheme.themeColor` must modify the `--theme-color` variable. Otherwise, please use `customTheme.classes`.');
522
+ multilineFillColorClasses = customTheme.themeColor
523
+ ? twMerge(multilineFillColorClasses, customTheme.themeColor)
524
+ : twMerge(multilineFillBaseClasses, customTheme.classes);
525
+ break;
452
526
  }
527
+ return multilineFillColorClasses;
453
528
  };
454
- // Define theme-specific multiline fill classes
455
- const getMultilineFillClasses = (theme = 'blue') => {
529
+ const getMultilineFillClasses = (theme = 'blue', customTheme) => {
530
+ let multilineFillColorClasses = tailwindMerge.twJoin(multilineFillBaseClasses, 'from-(--theme-color)/0 to-(--theme-color)/0 bg-[size:50%_0px] bg-[position:50%_50%] transition-[background-size_background-image_color] focus-visible:from-(--theme-color) focus-visible:to-(--theme-color) focus-visible:bg-[size:100%_100%] active:from-(--theme-color) active:to-(--theme-color) active:bg-[size:100%_100%] contrast-more:from-(--theme-color)/0 pointer-fine:hover:from-(--theme-color) pointer-fine:hover:to-(--theme-color) pointer-fine:hover:bg-[size:100%_100%]');
456
531
  switch (theme) {
532
+ case 'blue':
533
+ multilineFillColorClasses = tailwindMerge.twJoin(multilineFillColorClasses, '[--theme-color:var(--color-ui-blue)]');
534
+ break;
457
535
  case 'brown':
458
- return tailwindMerge.twJoin(multilineFillBaseClasses, 'from-ui-brown/0 to-ui-brown/0 bg-[size:50%_0px] bg-[position:50%_50%] transition-[background-size_background-image_color] focus-visible:from-ui-brown focus-visible:to-ui-brown focus-visible:bg-[size:100%_100%] active:from-ui-brown active:to-ui-brown active:bg-[size:100%_100%] contrast-more:from-ui-brown/0 contrast-more:to-ui-brown/0 focus-visible:contrast-more:from-ui-brown focus-visible:contrast-more:to-ui-brown active:contrast-more:from-ui-brown active:contrast-more:to-ui-brown pointer-fine:hover:from-ui-brown pointer-fine:hover:to-ui-brown pointer-fine:hover:bg-[size:100%_100%] pointer-fine:hover:contrast-more:from-ui-brown pointer-fine:hover:contrast-more:to-ui-brown');
536
+ multilineFillColorClasses = tailwindMerge.twJoin(multilineFillColorClasses, '[--theme-color:var(--color-ui-brown)]');
537
+ break;
459
538
  case 'green':
460
- return tailwindMerge.twJoin(multilineFillBaseClasses, 'from-ui-green/0 to-ui-green/0 bg-[size:50%_0px] bg-[position:50%_50%] transition-[background-size_background-image_color] focus-visible:from-ui-green focus-visible:to-ui-green focus-visible:bg-[size:100%_100%] active:from-ui-green active:to-ui-green active:bg-[size:100%_100%] contrast-more:from-ui-green/0 contrast-more:to-ui-green/0 focus-visible:contrast-more:from-ui-green focus-visible:contrast-more:to-ui-green active:contrast-more:from-ui-green active:contrast-more:to-ui-green pointer-fine:hover:from-ui-green pointer-fine:hover:to-ui-green pointer-fine:hover:bg-[size:100%_100%] pointer-fine:hover:contrast-more:from-ui-green pointer-fine:hover:contrast-more:to-ui-green');
539
+ multilineFillColorClasses = tailwindMerge.twJoin(multilineFillColorClasses, '[--theme-color:var(--color-ui-green)]');
540
+ break;
461
541
  case 'grey':
462
- return tailwindMerge.twJoin(multilineFillBaseClasses, 'from-ui-grey/0 to-ui-grey/0 bg-[size:50%_0px] bg-[position:50%_50%] transition-[background-size_background-image_color] focus-visible:from-ui-grey focus-visible:to-ui-grey focus-visible:bg-[size:100%_100%] active:from-ui-grey active:to-ui-grey active:bg-[size:100%_100%] contrast-more:from-ui-grey/0 contrast-more:to-ui-grey/0 focus-visible:contrast-more:from-ui-grey focus-visible:contrast-more:to-ui-grey active:contrast-more:from-ui-grey active:contrast-more:to-ui-grey pointer-fine:hover:from-ui-grey pointer-fine:hover:to-ui-grey pointer-fine:hover:bg-[size:100%_100%] pointer-fine:hover:contrast-more:from-ui-grey pointer-fine:hover:contrast-more:to-ui-grey');
542
+ multilineFillColorClasses = tailwindMerge.twJoin(multilineFillColorClasses, '[--theme-color:var(--color-ui-grey)]');
543
+ break;
463
544
  case 'sky-blue':
464
- return tailwindMerge.twJoin(multilineFillBaseClasses, 'from-ui-sky-blue/0 to-ui-sky-blue/0 bg-[size:50%_0px] bg-[position:50%_50%] transition-[background-size_background-image_color] focus-visible:from-ui-sky-blue focus-visible:to-ui-sky-blue focus-visible:bg-[size:100%_100%] active:from-ui-sky-blue active:to-ui-sky-blue active:bg-[size:100%_100%] contrast-more:from-ui-sky-blue/0 contrast-more:to-ui-sky-blue/0 focus-visible:contrast-more:from-ui-sky-blue focus-visible:contrast-more:to-ui-sky-blue active:contrast-more:from-ui-sky-blue active:contrast-more:to-ui-sky-blue pointer-fine:hover:from-ui-sky-blue pointer-fine:hover:to-ui-sky-blue pointer-fine:hover:bg-[size:100%_100%] pointer-fine:hover:contrast-more:from-ui-sky-blue pointer-fine:hover:contrast-more:to-ui-sky-blue');
545
+ multilineFillColorClasses = tailwindMerge.twJoin(multilineFillColorClasses, '[--theme-color:var(--color-ui-sky-blue)]');
546
+ break;
465
547
  case 'magenta':
466
- return tailwindMerge.twJoin(multilineFillBaseClasses, 'from-ui-magenta/0 to-ui-magenta/0 bg-[size:50%_0px] bg-[position:50%_50%] transition-[background-size_background-image_color] focus-visible:from-ui-magenta focus-visible:to-ui-magenta focus-visible:bg-[size:100%_100%] active:from-ui-magenta active:to-ui-magenta active:bg-[size:100%_100%] contrast-more:from-ui-magenta/0 contrast-more:to-ui-magenta/0 focus-visible:contrast-more:from-ui-magenta focus-visible:contrast-more:to-ui-magenta active:contrast-more:from-ui-magenta active:contrast-more:to-ui-magenta pointer-fine:hover:from-ui-magenta pointer-fine:hover:to-ui-magenta pointer-fine:hover:bg-[size:100%_100%] pointer-fine:hover:contrast-more:from-ui-magenta pointer-fine:hover:contrast-more:to-ui-magenta');
467
- case 'neutral':
468
- return tailwindMerge.twJoin(multilineFillBaseClasses, 'from-zinc-700/0 to-zinc-700/0 bg-[size:50%_0px] bg-[position:50%_50%] transition-[background-size_background-image_color] focus-visible:from-zinc-700 focus-visible:to-zinc-700 focus-visible:bg-[size:100%_100%] active:from-zinc-700 active:to-zinc-700 active:bg-[size:100%_100%] contrast-more:from-zinc-700/0 contrast-more:to-zinc-700/0 focus-visible:contrast-more:from-zinc-700 focus-visible:contrast-more:to-zinc-700 active:contrast-more:from-zinc-700 active:contrast-more:to-zinc-700 dark:from-zinc-300/0 dark:to-zinc-300/0 dark:focus-visible:from-zinc-300 dark:focus-visible:to-zinc-300 dark:active:from-zinc-300 dark:active:to-zinc-300 dark:contrast-more:from-zinc-300/0 dark:contrast-more:to-zinc-300/0 dark:focus-visible:contrast-more:from-zinc-300 dark:focus-visible:contrast-more:to-zinc-300 dark:active:contrast-more:from-zinc-300 dark:active:contrast-more:to-zinc-300 pointer-fine:hover:from-zinc-700 pointer-fine:hover:to-zinc-700 pointer-fine:hover:bg-[size:100%_100%] pointer-fine:hover:contrast-more:from-zinc-700 pointer-fine:hover:contrast-more:to-zinc-700 dark:pointer-fine:hover:from-zinc-300 dark:pointer-fine:hover:to-zinc-300 dark:pointer-fine:hover:contrast-more:from-zinc-300 dark:pointer-fine:hover:contrast-more:to-zinc-300');
548
+ multilineFillColorClasses = tailwindMerge.twJoin(multilineFillColorClasses, '[--theme-color:var(--color-ui-magenta)]');
549
+ break;
469
550
  case 'orange':
470
- return tailwindMerge.twJoin(multilineFillBaseClasses, 'from-ui-orange/0 to-ui-orange/0 bg-[size:50%_0px] bg-[position:50%_50%] transition-[background-size_background-image_color] focus-visible:from-ui-orange focus-visible:to-ui-orange focus-visible:bg-[size:100%_100%] active:from-ui-orange active:to-ui-orange active:bg-[size:100%_100%] contrast-more:from-ui-orange/0 contrast-more:to-ui-orange/0 focus-visible:contrast-more:from-ui-orange focus-visible:contrast-more:to-ui-orange active:contrast-more:from-ui-orange active:contrast-more:to-ui-orange pointer-fine:hover:from-ui-orange pointer-fine:hover:to-ui-orange pointer-fine:hover:bg-[size:100%_100%] pointer-fine:hover:contrast-more:from-ui-orange pointer-fine:hover:contrast-more:to-ui-orange');
551
+ multilineFillColorClasses = tailwindMerge.twJoin(multilineFillColorClasses, '[--theme-color:var(--color-ui-orange)]');
552
+ break;
471
553
  case 'pink':
472
- return tailwindMerge.twJoin(multilineFillBaseClasses, 'from-ui-pink/0 to-ui-pink/0 bg-[size:50%_0px] bg-[position:50%_50%] transition-[background-size_background-image_color] focus-visible:from-ui-pink focus-visible:to-ui-pink focus-visible:bg-[size:100%_100%] active:from-ui-pink active:to-ui-pink active:bg-[size:100%_100%] contrast-more:from-ui-pink/0 contrast-more:to-ui-pink/0 focus-visible:contrast-more:from-ui-pink focus-visible:contrast-more:to-ui-pink active:contrast-more:from-ui-pink active:contrast-more:to-ui-pink pointer-fine:hover:from-ui-pink pointer-fine:hover:to-ui-pink pointer-fine:hover:bg-[size:100%_100%] pointer-fine:hover:contrast-more:from-ui-pink pointer-fine:hover:contrast-more:to-ui-pink');
554
+ multilineFillColorClasses = tailwindMerge.twJoin(multilineFillColorClasses, '[--theme-color:var(--color-ui-pink)]');
555
+ break;
473
556
  case 'purple':
474
- return tailwindMerge.twJoin(multilineFillBaseClasses, 'from-ui-purple/0 to-ui-purple/0 bg-[size:50%_0px] bg-[position:50%_50%] transition-[background-size_background-image_color] focus-visible:from-ui-purple focus-visible:to-ui-purple focus-visible:bg-[size:100%_100%] active:from-ui-purple active:to-ui-purple active:bg-[size:100%_100%] contrast-more:from-ui-purple/0 contrast-more:to-ui-purple/0 focus-visible:contrast-more:from-ui-purple focus-visible:contrast-more:to-ui-purple active:contrast-more:from-ui-purple active:contrast-more:to-ui-purple pointer-fine:hover:from-ui-purple pointer-fine:hover:to-ui-purple pointer-fine:hover:bg-[size:100%_100%] pointer-fine:hover:contrast-more:from-ui-purple pointer-fine:hover:contrast-more:to-ui-purple');
557
+ multilineFillColorClasses = tailwindMerge.twJoin(multilineFillColorClasses, '[--theme-color:var(--color-ui-purple)]');
558
+ break;
475
559
  case 'red':
476
- return tailwindMerge.twJoin(multilineFillBaseClasses, 'from-ui-red/0 to-ui-red/0 bg-[size:50%_0px] bg-[position:50%_50%] transition-[background-size_background-image_color] focus-visible:from-ui-red focus-visible:to-ui-red focus-visible:bg-[size:100%_100%] active:from-ui-red active:to-ui-red active:bg-[size:100%_100%] contrast-more:from-ui-red/0 contrast-more:to-ui-red/0 focus-visible:contrast-more:from-ui-red focus-visible:contrast-more:to-ui-red active:contrast-more:from-ui-red active:contrast-more:to-ui-red pointer-fine:hover:from-ui-red pointer-fine:hover:to-ui-red pointer-fine:hover:bg-[size:100%_100%] pointer-fine:hover:contrast-more:from-ui-red pointer-fine:hover:contrast-more:to-ui-red');
560
+ multilineFillColorClasses = tailwindMerge.twJoin(multilineFillColorClasses, '[--theme-color:var(--color-ui-red)]');
561
+ break;
477
562
  case 'violet':
478
- return tailwindMerge.twJoin(multilineFillBaseClasses, 'from-ui-violet/0 to-ui-violet/0 bg-[size:50%_0px] bg-[position:50%_50%] transition-[background-size_background-image_color] focus-visible:from-ui-violet focus-visible:to-ui-violet focus-visible:bg-[size:100%_100%] active:from-ui-violet active:to-ui-violet active:bg-[size:100%_100%] contrast-more:from-ui-violet/0 contrast-more:to-ui-violet/0 focus-visible:contrast-more:from-ui-violet focus-visible:contrast-more:to-ui-violet active:contrast-more:from-ui-violet active:contrast-more:to-ui-violet pointer-fine:hover:from-ui-violet pointer-fine:hover:to-ui-violet pointer-fine:hover:bg-[size:100%_100%] pointer-fine:hover:contrast-more:from-ui-violet pointer-fine:hover:contrast-more:to-ui-violet');
563
+ multilineFillColorClasses = tailwindMerge.twJoin(multilineFillColorClasses, '[--theme-color:var(--color-ui-violet)]');
564
+ break;
479
565
  case 'yellow':
480
- return tailwindMerge.twJoin(multilineFillBaseClasses, 'from-ui-yellow/0 to-ui-yellow/0 bg-[size:50%_0px] bg-[position:50%_50%] transition-[background-size_background-image_color] focus-visible:from-ui-yellow focus-visible:to-ui-yellow focus-visible:bg-[size:100%_100%] active:from-ui-yellow active:to-ui-yellow active:bg-[size:100%_100%] contrast-more:from-ui-yellow/0 contrast-more:to-ui-yellow/0 focus-visible:contrast-more:from-ui-yellow focus-visible:contrast-more:to-ui-yellow active:contrast-more:from-ui-yellow active:contrast-more:to-ui-yellow pointer-fine:hover:from-ui-yellow pointer-fine:hover:to-ui-yellow pointer-fine:hover:bg-[size:100%_100%] pointer-fine:hover:contrast-more:from-ui-yellow pointer-fine:hover:contrast-more:to-ui-yellow');
481
- case 'blue':
482
- default:
483
- return tailwindMerge.twJoin(multilineFillBaseClasses, 'from-ui-blue/0 to-ui-blue/0 bg-[size:50%_0px] bg-[position:50%_50%] transition-[background-size_background-image_color] focus-visible:from-ui-blue focus-visible:to-ui-blue focus-visible:bg-[size:100%_100%] active:from-ui-blue active:to-ui-blue active:bg-[size:100%_100%] contrast-more:from-ui-blue/0 contrast-more:to-ui-blue/0 focus-visible:contrast-more:from-ui-blue focus-visible:contrast-more:to-ui-blue active:contrast-more:from-ui-blue active:contrast-more:to-ui-blue pointer-fine:hover:from-ui-blue pointer-fine:hover:to-ui-blue pointer-fine:hover:bg-[size:100%_100%] pointer-fine:hover:contrast-more:from-ui-blue pointer-fine:hover:contrast-more:to-ui-blue');
566
+ multilineFillColorClasses = tailwindMerge.twJoin(multilineFillColorClasses, '[--theme-color:var(--color-ui-yellow)]');
567
+ break;
568
+ case 'custom':
569
+ if (customTheme && customTheme.themeColor && !customTheme.themeColor.includes('[--theme-color:'))
570
+ throw new Error('`customTheme.themeColor` must modify the `--theme-color` variable. Otherwise, please use `customTheme.classes`.');
571
+ multilineFillColorClasses = customTheme.themeColor
572
+ ? twMerge(multilineFillColorClasses, customTheme.themeColor)
573
+ : twMerge(multilineFillBaseClasses, customTheme.classes);
574
+ break;
484
575
  }
576
+ return multilineFillColorClasses;
485
577
  };
486
- const getMultilineFillLiftClasses = (theme = 'blue') => {
487
- return tailwindMerge.twJoin(getMultilineFillColorClasses(theme), 'bg-[size:auto_0px] bg-[position:50%_100%] focus-visible:bg-[size:auto_100%] active:bg-[size:auto_100%] pointer-fine:hover:bg-[size:auto_100%]');
578
+ const getMultilineFillLiftClasses = (theme = 'blue', customTheme) => {
579
+ return tailwindMerge.twJoin(getMultilineFillColorClasses(theme, customTheme), 'bg-[size:auto_0px] bg-[position:50%_100%] focus-visible:bg-[size:auto_100%] active:bg-[size:auto_100%] pointer-fine:hover:bg-[size:auto_100%]');
488
580
  };
489
- const getMultilineFillXClasses = (theme = 'blue') => {
490
- return tailwindMerge.twJoin(getMultilineFillColorClasses(theme), 'bg-[size:0%_100%] focus-visible:bg-[size:100%_100%] active:bg-[size:100%_100%] pointer-fine:hover:bg-[size:100%_100%]');
581
+ const getMultilineFillXClasses = (theme = 'blue', customTheme) => {
582
+ return tailwindMerge.twJoin(getMultilineFillColorClasses(theme, customTheme), 'bg-[size:0%_100%] focus-visible:bg-[size:100%_100%] active:bg-[size:100%_100%] pointer-fine:hover:bg-[size:100%_100%]');
491
583
  };
492
- const getMultilineFillRtlClasses = (theme = 'blue') => {
493
- return tailwindMerge.twJoin(getMultilineFillXClasses(theme), 'bg-[position:100%_auto]');
584
+ const getMultilineFillRtlClasses = (theme = 'blue', customTheme) => {
585
+ return tailwindMerge.twJoin(getMultilineFillXClasses(theme, customTheme), 'bg-[position:100%_auto]');
494
586
  };
495
- const getMultilineFillCenterClasses = (theme = 'blue') => {
496
- return tailwindMerge.twJoin(getMultilineFillXClasses(theme), 'bg-[position:50%_auto]');
587
+ const getMultilineFillCenterClasses = (theme = 'blue', customTheme) => {
588
+ return tailwindMerge.twJoin(getMultilineFillXClasses(theme, customTheme), 'bg-[position:50%_auto]');
497
589
  };
498
590
  /**
499
591
  * # Link
@@ -524,7 +616,7 @@ const getMultilineFillCenterClasses = (theme = 'blue') => {
524
616
  * @example
525
617
  * <Link href='/about' type='fill-ltr' theme='red' title='About Us'>Learn more about our company</Link>
526
618
  */
527
- function Link({ as, className, ref, theme = 'blue', type, ...props }) {
619
+ function Link({ as, className, customTheme, theme = 'blue', type, ...props }) {
528
620
  const getLinkClasses = () => {
529
621
  switch (type) {
530
622
  case 'static':
@@ -538,13 +630,13 @@ function Link({ as, className, ref, theme = 'blue', type, ...props }) {
538
630
  case 'lift':
539
631
  return lineLiftClasses;
540
632
  case 'fill':
541
- return getFillCenterClasses(theme);
633
+ return getFillCenterClasses(theme, customTheme);
542
634
  case 'fill-ltr':
543
- return tailwindMerge.twJoin([getFillColorTransitionClasses(theme), scaleXClasses, 'after:origin-left']);
635
+ return tailwindMerge.twJoin([getFillColorTransitionClasses(theme, customTheme), scaleXClasses, 'after:origin-left']);
544
636
  case 'fill-rtl':
545
- return tailwindMerge.twJoin([getFillColorTransitionClasses(theme), scaleXClasses, 'after:origin-right']);
637
+ return tailwindMerge.twJoin([getFillColorTransitionClasses(theme, customTheme), scaleXClasses, 'after:origin-right']);
546
638
  case 'fill-lift':
547
- return tailwindMerge.twJoin([getFillColorTransitionClasses(theme), scaleYClasses, 'after:origin-bottom']);
639
+ return tailwindMerge.twJoin([getFillColorTransitionClasses(theme, customTheme), scaleYClasses, 'after:origin-bottom']);
548
640
  case 'multiline':
549
641
  return multilineNormalClasses;
550
642
  case 'multiline-static':
@@ -558,29 +650,29 @@ function Link({ as, className, ref, theme = 'blue', type, ...props }) {
558
650
  case 'multiline-lift':
559
651
  return multilineLineLiftClasses;
560
652
  case 'multiline-fill':
561
- return getMultilineFillClasses(theme);
653
+ return getMultilineFillClasses(theme, customTheme);
562
654
  case 'multiline-fill-ltr':
563
- return getMultilineFillXClasses(theme);
655
+ return getMultilineFillXClasses(theme, customTheme);
564
656
  case 'multiline-fill-rtl':
565
- return getMultilineFillRtlClasses(theme);
657
+ return getMultilineFillRtlClasses(theme, customTheme);
566
658
  case 'multiline-fill-center':
567
- return getMultilineFillCenterClasses(theme);
659
+ return getMultilineFillCenterClasses(theme, customTheme);
568
660
  case 'multiline-fill-lift':
569
- return getMultilineFillLiftClasses(theme);
661
+ return getMultilineFillLiftClasses(theme, customTheme);
570
662
  default:
571
663
  return lineNormalClasses;
572
664
  }
573
665
  };
574
666
  const linkClasses = getLinkClasses();
575
667
  const LinkElement = as || Anchor;
576
- return jsxRuntime.jsx(LinkElement, { ...props, className: twMerge(linkClasses, className), ref: ref });
668
+ return jsxRuntime.jsx(LinkElement, { ...props, className: twMerge(linkClasses, className) });
577
669
  }
578
670
 
579
671
  /**
580
672
  * # Button
581
673
  * - A pre-styled button with utility props for easy customization depending on use case.
582
674
  */
583
- function Button({ className, padding = 'md', rounded = 'lg', theme = 'blue', ref, ...props }) {
675
+ function Button({ className, customTheme, gradient = false, padding = 'md', rounded = 'lg', theme = 'blue', ...props }) {
584
676
  const getPaddingClasses = () => {
585
677
  switch (padding) {
586
678
  case 'xs':
@@ -611,578 +703,90 @@ function Button({ className, padding = 'md', rounded = 'lg', theme = 'blue', ref
611
703
  return 'rounded-full';
612
704
  }
613
705
  };
614
- const getThemeClasses = () => {
615
- const classList = [];
706
+ const getThemeColorVariable = () => {
616
707
  switch (theme) {
617
708
  case 'blue':
618
- classList.push(twSort('text-white shadow-lg shadow-ui-blue/25 transition-transform before:absolute before:inset-0 before:-z-10 before:rounded-[inherit] before:bg-ui-blue before:transition-[filter] before:duration-300 before:ease-exponential active:before:brightness-90 pointer-fine:hover:before:brightness-110 pointer-fine:active:before:brightness-90'));
619
- break;
620
- case 'blue-gradient':
621
- classList.push(twSort('bg-ui-blue text-white shadow-lg shadow-ui-blue/25 transition-transform before:absolute before:inset-0 before:rounded-[inherit] before:bg-linear-to-t before:from-black/75 before:via-transparent before:to-white/75 before:opacity-75 before:mix-blend-soft-light before:transition-[filter] before:duration-300 before:ease-exponential active:before:brightness-90 pointer-fine:hover:before:brightness-110 pointer-fine:active:before:brightness-90'));
622
- break;
709
+ return twSort('text-white [--theme-color:var(--color-ui-blue)]');
623
710
  case 'brown':
624
- classList.push(twSort('text-white shadow-lg shadow-ui-brown/25 transition-transform before:absolute before:inset-0 before:-z-10 before:rounded-[inherit] before:bg-ui-brown before:transition-[filter] before:duration-300 before:ease-exponential active:before:brightness-90 pointer-fine:hover:before:brightness-110 pointer-fine:active:before:brightness-90'));
625
- break;
626
- case 'brown-gradient':
627
- classList.push(twSort('bg-ui-brown text-white shadow-lg shadow-ui-brown/25 transition-transform before:absolute before:inset-0 before:rounded-[inherit] before:bg-linear-to-t before:from-black/75 before:via-transparent before:to-white/75 before:opacity-75 before:mix-blend-soft-light before:transition-[filter] before:duration-300 before:ease-exponential active:before:brightness-90 pointer-fine:hover:before:brightness-110 pointer-fine:active:before:brightness-90'));
628
- break;
711
+ return twSort('text-white [--theme-color:var(--color-ui-brown)]');
629
712
  case 'green':
630
- classList.push(twSort('text-white shadow-lg shadow-ui-green/25 transition-transform before:absolute before:inset-0 before:-z-10 before:rounded-[inherit] before:bg-ui-green before:transition-[filter] before:duration-300 before:ease-exponential active:before:brightness-90 pointer-fine:hover:before:brightness-110 pointer-fine:active:before:brightness-90'));
631
- break;
632
- case 'green-gradient':
633
- classList.push(twSort('bg-ui-green text-white shadow-lg shadow-ui-green/25 transition-transform before:absolute before:inset-0 before:rounded-[inherit] before:bg-linear-to-t before:from-black/75 before:via-transparent before:to-white/75 before:opacity-75 before:mix-blend-soft-light before:transition-[filter] before:duration-300 before:ease-exponential active:before:brightness-90 pointer-fine:hover:before:brightness-110 pointer-fine:active:before:brightness-90'));
634
- break;
713
+ return twSort('text-white [--theme-color:var(--color-ui-green)]');
635
714
  case 'grey':
636
- classList.push(twSort('text-white shadow-lg shadow-ui-grey/25 transition-transform before:absolute before:inset-0 before:-z-10 before:rounded-[inherit] before:bg-ui-grey before:transition-[filter] before:duration-300 before:ease-exponential active:before:brightness-90 pointer-fine:hover:before:brightness-110 pointer-fine:active:before:brightness-90'));
637
- break;
638
- case 'grey-gradient':
639
- classList.push(twSort('bg-ui-grey text-white shadow-lg shadow-ui-grey/25 transition-transform before:absolute before:inset-0 before:rounded-[inherit] before:bg-linear-to-t before:from-black/75 before:via-transparent before:to-white/75 before:opacity-75 before:mix-blend-soft-light before:transition-[filter] before:duration-300 before:ease-exponential active:before:brightness-90 pointer-fine:hover:before:brightness-110 pointer-fine:active:before:brightness-90'));
640
- break;
641
- case 'sky-blue':
642
- classList.push(twSort('text-white shadow-lg shadow-ui-sky-blue/25 transition-transform before:absolute before:inset-0 before:-z-10 before:rounded-[inherit] before:bg-ui-sky-blue before:transition-[filter] before:duration-300 before:ease-exponential active:before:brightness-90 pointer-fine:hover:before:brightness-110 pointer-fine:active:before:brightness-90'));
643
- break;
644
- case 'sky-blue-gradient':
645
- classList.push(twSort('bg-ui-sky-blue text-white shadow-lg shadow-ui-sky-blue/25 transition-transform before:absolute before:inset-0 before:rounded-[inherit] before:bg-linear-to-t before:from-black/75 before:via-transparent before:to-white/75 before:opacity-75 before:mix-blend-soft-light before:transition-[filter] before:duration-300 before:ease-exponential active:before:brightness-90 pointer-fine:hover:before:brightness-110 pointer-fine:active:before:brightness-90'));
646
- break;
715
+ return twSort('text-white [--theme-color:var(--color-ui-grey)]');
647
716
  case 'magenta':
648
- classList.push(twSort('text-white shadow-lg shadow-ui-magenta/25 transition-transform before:absolute before:inset-0 before:-z-10 before:rounded-[inherit] before:bg-ui-magenta before:transition-[filter] before:duration-300 before:ease-exponential active:before:brightness-90 pointer-fine:hover:before:brightness-110 pointer-fine:active:before:brightness-90'));
649
- break;
650
- case 'magenta-gradient':
651
- classList.push(twSort('bg-ui-magenta text-white shadow-lg shadow-ui-magenta/25 transition-transform before:absolute before:inset-0 before:rounded-[inherit] before:bg-linear-to-t before:from-black/75 before:via-transparent before:to-white/75 before:opacity-75 before:mix-blend-soft-light before:transition-[filter] before:duration-300 before:ease-exponential active:before:brightness-90 pointer-fine:hover:before:brightness-110 pointer-fine:active:before:brightness-90'));
652
- break;
653
- case 'neutral':
654
- classList.push(twSort('pointer-fine:active:before:brightness-90text-white dark bg-zinc-200 text-black before:absolute before:inset-0 before:rounded-[inherit] before:transition-[filter] before:duration-300 before:ease-exponential active:before:brightness-90 dark:bg-zinc-800 pointer-fine:hover:before:brightness-110'));
655
- break;
656
- case 'neutral-gradient':
657
- classList.push(twSort('dark bg-linear-to-t from-zinc-300 via-zinc-200 to-zinc-100 text-black before:transition-[filter] before:duration-300 before:ease-exponential active:before:brightness-90 dark:from-zinc-900 dark:via-zinc-800 dark:to-zinc-700 pointer-fine:hover:before:brightness-110 pointer-fine:active:before:brightness-90'));
658
- break;
717
+ return twSort('text-white [--theme-color:var(--color-ui-magenta)]');
659
718
  case 'orange':
660
- classList.push(twSort('text-white shadow-lg shadow-ui-orange/25 transition-transform before:absolute before:inset-0 before:-z-10 before:rounded-[inherit] before:bg-ui-orange before:transition-[filter] before:duration-300 before:ease-exponential active:before:brightness-90 pointer-fine:hover:before:brightness-110 pointer-fine:active:before:brightness-90'));
661
- break;
662
- case 'orange-gradient':
663
- classList.push(twSort('bg-ui-orange text-white shadow-lg shadow-ui-orange/25 transition-transform before:absolute before:inset-0 before:rounded-[inherit] before:bg-linear-to-t before:from-black/75 before:via-transparent before:to-white/75 before:opacity-75 before:mix-blend-soft-light before:transition-[filter] before:duration-300 before:ease-exponential active:before:brightness-90 pointer-fine:hover:before:brightness-110 pointer-fine:active:before:brightness-90'));
664
- break;
719
+ return twSort('text-white [--theme-color:var(--color-ui-orange)]');
665
720
  case 'pink':
666
- classList.push(twSort('text-white shadow-lg shadow-ui-pink/25 transition-transform before:absolute before:inset-0 before:-z-10 before:rounded-[inherit] before:bg-ui-pink before:transition-[filter] before:duration-300 before:ease-exponential active:before:brightness-90 pointer-fine:hover:before:brightness-110 pointer-fine:active:before:brightness-90'));
667
- break;
668
- case 'pink-gradient':
669
- classList.push(twSort('before:to-white/75/75 bg-ui-pink text-white shadow-lg shadow-ui-pink/25 transition-transform before:absolute before:inset-0 before:rounded-[inherit] before:bg-linear-to-t before:from-black/75 before:via-transparent before:opacity-75 before:mix-blend-soft-light before:transition-[filter] before:duration-300 before:ease-exponential active:before:brightness-90 pointer-fine:hover:before:brightness-110 pointer-fine:active:before:brightness-90'));
670
- break;
721
+ return twSort('text-white [--theme-color:var(--color-ui-pink)]');
671
722
  case 'purple':
672
- classList.push(twSort('text-white shadow-lg shadow-ui-purple/25 transition-transform before:absolute before:inset-0 before:-z-10 before:rounded-[inherit] before:bg-ui-purple before:transition-[filter] before:duration-300 before:ease-exponential active:before:brightness-90 pointer-fine:hover:before:brightness-110 pointer-fine:active:before:brightness-90'));
673
- break;
674
- case 'purple-gradient':
675
- classList.push(twSort('bg-ui-purple text-white shadow-lg shadow-ui-purple/25 transition-transform before:absolute before:inset-0 before:rounded-[inherit] before:bg-linear-to-t before:from-black/75 before:via-transparent before:to-white/75 before:opacity-75 before:mix-blend-soft-light before:transition-[filter] before:duration-300 before:ease-exponential active:before:brightness-90 pointer-fine:hover:before:brightness-110 pointer-fine:active:before:brightness-90'));
676
- break;
723
+ return twSort('text-white [--theme-color:var(--color-ui-purple)]');
677
724
  case 'red':
678
- classList.push(twSort('text-white shadow-lg shadow-ui-red/25 transition-transform before:absolute before:inset-0 before:-z-10 before:rounded-[inherit] before:bg-ui-red before:transition-[filter] before:duration-300 before:ease-exponential active:before:brightness-90 pointer-fine:hover:before:brightness-110 pointer-fine:active:before:brightness-90'));
679
- break;
680
- case 'red-gradient':
681
- classList.push(twSort('bg-ui-red text-white shadow-lg shadow-ui-red/25 transition-transform before:absolute before:inset-0 before:rounded-[inherit] before:bg-linear-to-t before:from-black/75 before:via-transparent before:to-white/75 before:opacity-75 before:mix-blend-soft-light before:transition-[filter] before:duration-300 before:ease-exponential active:before:brightness-90 pointer-fine:hover:before:brightness-110 pointer-fine:active:before:brightness-90'));
682
- break;
725
+ return twSort('text-white [--theme-color:var(--color-ui-red)]');
726
+ case 'sky-blue':
727
+ return twSort('text-white [--theme-color:var(--color-ui-sky-blue)]');
683
728
  case 'violet':
684
- classList.push(twSort('text-white shadow-lg shadow-ui-violet/25 transition-transform before:absolute before:inset-0 before:-z-10 before:rounded-[inherit] before:bg-ui-violet before:transition-[filter] before:duration-300 before:ease-exponential active:before:brightness-90 pointer-fine:hover:before:brightness-110 pointer-fine:active:before:brightness-90'));
685
- break;
686
- case 'violet-gradient':
687
- classList.push(twSort('bg-ui-violet text-white shadow-lg shadow-ui-violet/25 transition-transform before:absolute before:inset-0 before:rounded-[inherit] before:bg-linear-to-t before:from-black/75 before:via-transparent before:to-white/75 before:opacity-75 before:mix-blend-soft-light before:transition-[filter] before:duration-300 before:ease-exponential active:before:brightness-90 pointer-fine:hover:before:brightness-110 pointer-fine:active:before:brightness-90'));
688
- break;
729
+ return twSort('text-white [--theme-color:var(--color-ui-violet)]');
689
730
  case 'yellow':
690
- classList.push(twSort('text-black shadow-lg shadow-ui-yellow/25 transition-transform before:absolute before:inset-0 before:-z-10 before:rounded-[inherit] before:bg-ui-yellow before:transition-[filter] before:duration-300 before:ease-exponential active:before:brightness-90 pointer-fine:hover:before:brightness-110 pointer-fine:active:before:brightness-90'));
691
- break;
692
- case 'yellow-gradient':
693
- classList.push(twSort('bg-ui-yellow text-black shadow-lg shadow-ui-yellow/25 transition-transform before:absolute before:inset-0 before:rounded-[inherit] before:bg-linear-to-t before:from-black before:via-black/50 before:to-white/50 before:opacity-75 before:mix-blend-soft-light before:transition-[filter] before:duration-300 before:ease-exponential active:before:brightness-90 pointer-fine:hover:before:brightness-110 pointer-fine:active:before:brightness-90'));
694
- break;
731
+ return twSort('text-black [--theme-color:var(--color-ui-yellow)]');
732
+ case 'custom':
733
+ if (customTheme && customTheme.themeColor && !customTheme.themeColor.includes('[--theme-color:'))
734
+ throw new Error('`customTheme.themeColor` must modify the `--theme-color` variable. Otherwise, please use `customTheme.classes`.');
735
+ return customTheme.themeColor || customTheme.classes;
695
736
  }
696
- return classList.join(' ');
697
737
  };
698
- const paddingClasses = getPaddingClasses(), roundedClasses = getRoundedClasses(), themeClasses = getThemeClasses();
738
+ const paddingClasses = getPaddingClasses(), roundedClasses = getRoundedClasses(), themeColorVariable = getThemeColorVariable();
739
+ const themeClasses = customTheme && customTheme.classes
740
+ ? customTheme.classes
741
+ : [
742
+ gradient
743
+ ? twSort('bg-linear-to-t from-[color-mix(in_oklab,var(--theme-color),var(--color-black)_20%)] via-(--theme-color) to-[color-mix(in_oklab,var(--theme-color),var(--color-white)_20%)] bg-[size:100%_200%] transition-[scale,background-position-y] [background-position-y:50%] active:[background-position-y:100%] data-focus:[background-position-y:0%] pointer-fine:hover:[background-position-y:0%] pointer-fine:hover:active:[background-position-y:100%]')
744
+ : twSort('bg-(--theme-color) transition-[scale,background-color] active:bg-[color-mix(in_oklab,var(--theme-color),var(--color-black)_10%)] data-focus:bg-[color-mix(in_oklab,var(--theme-color),var(--color-white)_10%)] pointer-fine:hover:bg-[color-mix(in_oklab,var(--theme-color),var(--color-white)_10%)] pointer-fine:hover:active:bg-[color-mix(in_oklab,var(--theme-color),var(--color-black)_10%)]'),
745
+ 'shadow-(--theme-color)/25',
746
+ ].join(' ');
699
747
  const buttonClasses = twMerge([
700
- 'block w-fit min-w-fit text-center font-semibold duration-300 ease-exponential focus-visible:scale-101 active:scale-95 pointer-fine:hover:scale-101 pointer-fine:active:scale-99',
748
+ 'block w-fit min-w-fit text-center font-semibold shadow-lg duration-300 ease-exponential active:scale-99 data-focus:scale-101 pointer-fine:hover:scale-101 pointer-fine:hover:active:scale-99',
701
749
  paddingClasses,
702
750
  roundedClasses,
751
+ themeColorVariable,
703
752
  themeClasses,
704
753
  className,
705
754
  ]);
706
- return 'href' in props && typeof props.href === 'string' ? (jsxRuntime.jsx(Anchor, { ref: ref, ...props, className: buttonClasses })) : (jsxRuntime.jsx(react$1.Button, { ref: ref, ...props, className: buttonClasses }));
755
+ const ButtonElement = 'as' in props ? props.as : props.href ? Anchor : react.Button;
756
+ const { as, ...restProps } = 'as' in props ? props : { ...props, as: undefined };
757
+ return jsxRuntime.jsx(ButtonElement, { ...restProps, className: buttonClasses });
707
758
  }
708
759
 
709
- function createFastContext(defaultInitialState) {
710
- function useStoreData(initialState = defaultInitialState) {
711
- const store = react.useRef(initialState), get = () => store.current, subscribers = react.useRef(new Set());
712
- const set = (value) => {
713
- if (typeof value === 'function') {
714
- store.current = value(store.current);
715
- }
716
- else {
717
- store.current = value;
718
- }
719
- subscribers.current.forEach(callback => callback());
720
- };
721
- const subscribe = (callback) => {
722
- subscribers.current.add(callback);
723
- return () => subscribers.current.delete(callback);
724
- };
725
- return {
726
- get,
727
- set,
728
- subscribe,
729
- };
730
- }
731
- const StoreContext = react.createContext(null);
732
- function Provider({ initialValue = defaultInitialState, ...props }) {
733
- return jsxRuntime.jsx(StoreContext.Provider, { value: useStoreData(initialValue), ...props });
734
- }
735
- function useStore(selector, initialValue) {
736
- const store = react.useContext(StoreContext);
737
- if (!store) {
738
- const localStoreValue = initialValue !== undefined ? initialValue : defaultInitialState;
739
- const selectedValue = selector(localStoreValue);
740
- const noOpSet = () => console.warn('Attempting to set store value outside of Provider');
741
- return [selectedValue, noOpSet];
742
- }
743
- const state = react.useSyncExternalStore(store.subscribe, () => selector(store.get()), () => selector(initialValue !== undefined ? initialValue : defaultInitialState));
744
- return [state, store.set];
745
- }
746
- return {
747
- Provider,
748
- useStore,
749
- };
760
+ function Airplane(props) {
761
+ return (jsxRuntime.jsx("svg", { viewBox: '0 0 64 63.9', ...props, children: jsxRuntime.jsx("path", { d: 'M62.7,1.3c-0.9-0.9-2-1.3-3.4-1.2c-1.4,0.1-3,0.5-4.5,1.2c-1.6,0.8-3.2,1.9-4.6,3.4L41,13.7c-0.7,0.7-1.2,1.1-1.6,1.2 c-0.5,0.2-1.1,0.3-1.9,0.2L5.5,13.8c-1.1-0.1-1.9,0.3-2.6,0.9l-2.6,2.6C0.1,17.6,0,18,0,18.4c0.1,0.4,0.3,0.7,0.9,0.8l25.3,9.5 L15.9,41.5L4.3,38.1c-0.9-0.3-1.6,0-2.4,0.7l-1,1c-0.3,0.3-0.5,0.6-0.5,1c0,0.4,0.1,0.7,0.5,1l21.3,21.3c0.3,0.3,0.6,0.5,1,0.4 c0.4-0.1,0.7-0.1,1-0.5l1-1c0.7-0.7,1-1.5,0.7-2.4L22.5,48l12.8-10.2l9.5,25.3c0.2,0.5,0.5,0.7,0.8,0.9c0.4,0.1,0.7,0,1-0.3l2.6-2.6 c0.7-0.7,1-1.5,0.9-2.6l-1.4-31.9c-0.1-0.8,0-1.4,0.2-1.9c0.2-0.5,0.6-1,1.2-1.6l9.1-9.1c1.4-1.4,2.6-3,3.4-4.6 C63.5,7.6,64,6.1,64,4.7S63.5,2.2,62.7,1.3z' }) }));
750
762
  }
751
763
 
752
- /**
753
- * # Define Field
754
- *
755
- * This is a helper function to define a field in a form context with type safety.
756
- */
757
- function defineField(fieldDefinition) {
758
- return fieldDefinition;
764
+ function ArrowTriangle2CirclepathCircle(props) {
765
+ return (jsxRuntime.jsxs("svg", { viewBox: '0 0 64 64', ...props, children: [jsxRuntime.jsx("path", { d: 'M61.5,19.6c-1.7-3.9-4-7.3-6.9-10.2c-3-3-6.4-5.3-10.2-6.9C40.5,0.8,36.3,0,31.9,0c-4.4,0-8.5,0.8-12.3,2.5 c-3.9,1.7-7.3,4-10.2,6.9c-2.9,3-5.2,6.4-6.9,10.2C0.8,23.5,0,27.6,0,32c0,4.4,0.8,8.5,2.5,12.3c1.7,3.9,4,7.3,6.9,10.2 c2.9,3,6.3,5.3,10.2,6.9c3.9,1.7,8,2.5,12.3,2.5c4.4,0,8.5-0.8,12.4-2.5c3.9-1.7,7.3-4,10.2-6.9c2.9-3,5.3-6.4,6.9-10.2 S64,36.3,64,32C64,27.6,63.2,23.5,61.5,19.6z M56.6,42.4c-1.4,3.2-3.3,6.1-5.7,8.5c-2.4,2.4-5.3,4.4-8.5,5.7 c-3.2,1.4-6.7,2.1-10.4,2.1c-3.7,0-7.1-0.7-10.4-2.1c-3.2-1.4-6-3.3-8.5-5.7c-2.4-2.4-4.3-5.3-5.7-8.5C6.1,39.1,5.4,35.7,5.4,32 s0.7-7.1,2-10.4s3.3-6.1,5.7-8.5c2.4-2.4,5.3-4.4,8.5-5.7c3.2-1.4,6.7-2.1,10.4-2.1c3.7,0,7.2,0.7,10.4,2.1c3.2,1.4,6.1,3.3,8.5,5.7 c2.4,2.4,4.4,5.3,5.7,8.5s2.1,6.7,2.1,10.4S58,39.1,56.6,42.4z' }), jsxRuntime.jsx("path", { d: 'M32.1,49.5c2,0,3.9-0.3,5.7-1c1.9-0.6,3.5-1.5,4.8-2.6c0.7-0.6,1.2-1.3,1.3-2c0.2-0.7,0-1.4-0.6-2c-0.6-0.6-1.2-0.9-1.9-0.8 c-0.7,0-1.3,0.3-1.9,0.7c-1.1,0.9-2.3,1.6-3.5,2c-1.2,0.5-2.6,0.7-4.1,0.7c-2.1,0-4-0.4-5.8-1.3s-3.3-2-4.5-3.5 c-1.2-1.5-2.1-3.1-2.5-5h3.3c0.7,0,1.2-0.3,1.3-0.8c0.2-0.6,0-1.1-0.3-1.7l-5.1-7.1c-0.4-0.6-1-0.9-1.6-0.9c-0.6,0-1.2,0.3-1.6,0.9 l-5,7.1c-0.4,0.6-0.5,1.1-0.4,1.7s0.6,0.8,1.3,0.8h3.3c0.5,2.9,1.6,5.4,3.2,7.7c1.6,2.2,3.7,3.9,6.1,5.2 C26.4,48.9,29.1,49.5,32.1,49.5z' }), jsxRuntime.jsx("path", { d: 'M32,14.4c-2,0-3.9,0.3-5.7,1c-1.9,0.6-3.5,1.5-4.8,2.7c-0.8,0.6-1.2,1.2-1.4,2c-0.1,0.7,0.1,1.4,0.6,2 c0.5,0.6,1.1,0.9,1.8,0.8c0.7,0,1.3-0.3,1.9-0.8c1.1-0.9,2.3-1.5,3.5-2c1.2-0.5,2.6-0.7,4.1-0.7c2.1,0,4,0.4,5.8,1.3 c1.8,0.9,3.3,2,4.5,3.5c1.2,1.5,2.1,3.1,2.6,5h-3.5c-0.7,0-1.2,0.3-1.3,0.8c-0.2,0.6-0.1,1.1,0.4,1.7l5.1,7.1 c0.4,0.6,0.9,0.9,1.6,0.9c0.6,0,1.2-0.3,1.6-0.9l5-7.1c0.4-0.6,0.5-1.1,0.4-1.7c-0.2-0.6-0.6-0.8-1.3-0.8h-3.1 c-0.5-2.9-1.6-5.5-3.2-7.7s-3.7-3.9-6.2-5.2C37.8,15,35,14.4,32,14.4z' })] }));
759
766
  }
760
- const { Provider: Provider$1, useStore: useStore$1 } = createFastContext([]);
761
- function FormContextProvider({ children }) {
762
- return jsxRuntime.jsx(Provider$1, { children: children });
767
+
768
+ function ArrowTriangle2CirclepathCircleFill(props) {
769
+ return (jsxRuntime.jsx("svg", { viewBox: '0 0 64 64', ...props, children: jsxRuntime.jsx("path", { d: 'M61.5,19.6c-1.7-3.9-4-7.3-6.9-10.2c-3-3-6.4-5.3-10.2-6.9C40.5,0.8,36.3,0,31.9,0c-4.4,0-8.5,0.8-12.3,2.5 c-3.9,1.7-7.3,4-10.2,6.9c-2.9,3-5.2,6.4-6.9,10.2C0.8,23.5,0,27.6,0,32s0.8,8.5,2.5,12.3c1.7,3.9,4,7.3,6.9,10.2 c2.9,3,6.3,5.3,10.2,6.9c3.9,1.7,8,2.5,12.3,2.5c4.4,0,8.5-0.8,12.4-2.5c3.9-1.7,7.3-4,10.2-6.9c2.9-3,5.3-6.4,6.9-10.2 S64,36.3,64,32S63.2,23.5,61.5,19.6z M44.5,44.2c-0.2,0.8-0.6,1.5-1.4,2.1c-1.4,1.1-3,2-4.9,2.7c-1.9,0.7-3.9,1-5.9,1 c-3.1,0-5.9-0.6-8.4-1.9c-2.5-1.3-4.6-3.1-6.3-5.3c-1.7-2.3-2.8-4.9-3.3-7.9h-3.4c-0.8,0-1.2-0.3-1.4-0.9c-0.2-0.6,0-1.2,0.4-1.7 l5.1-7.3c0.5-0.6,1-0.9,1.7-0.9c0.7,0,1.2,0.3,1.6,0.9l5.2,7.3c0.4,0.6,0.6,1.2,0.4,1.7s-0.6,0.9-1.4,0.9H19 c0.7,2.9,2.3,5.3,4.7,7.2c2.4,1.9,5.3,2.9,8.5,2.9c1.6,0,3-0.2,4.2-0.7s2.4-1.2,3.6-2.1c0.6-0.5,1.3-0.7,2-0.8 c0.7-0.1,1.3,0.2,1.9,0.8C44.4,42.8,44.6,43.5,44.5,44.2z M54.4,31.6l-5.2,7.3c-0.5,0.7-1,1-1.7,0.9c-0.7,0-1.2-0.3-1.6-0.9 l-5.3-7.3c-0.4-0.6-0.5-1.2-0.4-1.7c0.2-0.6,0.6-0.9,1.4-0.9h3.6c-0.7-2.9-2.3-5.3-4.7-7.2c-2.4-1.9-5.2-2.9-8.4-2.9 c-1.6,0-3,0.2-4.2,0.7s-2.4,1.2-3.6,2.1c-0.6,0.5-1.3,0.7-2,0.8c-0.7,0-1.3-0.2-1.9-0.8c-0.6-0.6-0.8-1.3-0.6-2 c0.2-0.8,0.6-1.5,1.4-2.1c1.4-1.1,3-2,4.9-2.7c1.9-0.7,3.9-1,5.9-1c3.1,0,5.9,0.6,8.4,1.9c2.5,1.3,4.6,3.1,6.3,5.3s2.8,4.9,3.3,7.9 h3.2c0.8,0,1.2,0.3,1.4,0.9S54.8,31,54.4,31.6z' }) }));
763
770
  }
764
- function useFormContext() {
765
- return useStore$1(store => store);
771
+
772
+ function BagFill(props) {
773
+ return (jsxRuntime.jsx("svg", { viewBox: '0 0 55.6 64', ...props, children: jsxRuntime.jsx("path", { d: 'M53.1,14.6c-1.6-1.6-4.1-2.4-7.4-2.4h-5c-0.1-2.2-0.7-4.2-1.9-6s-2.7-3.3-4.7-4.4C32.3,0.6,30.1,0,27.8,0 c-2.3,0-4.5,0.6-6.4,1.7c-1.9,1.1-3.5,2.6-4.7,4.4c-1.2,1.8-1.8,3.9-1.9,6h-5c-3.3,0-5.7,0.8-7.4,2.4C0.8,16.2,0,18.7,0,21.9v32.4 c0,3.2,0.8,5.7,2.5,7.3S6.6,64,9.8,64h36.8c2.8,0,5-0.8,6.6-2.4c1.6-1.6,2.3-4.1,2.3-7.3V21.9C55.6,18.7,54.7,16.2,53.1,14.6z M19.8,12.2c0-1.4,0.4-2.6,1.1-3.7c0.7-1.1,1.6-2,2.8-2.7c1.2-0.7,2.5-1,4-1c1.5,0,2.8,0.3,4,1c1.2,0.7,2.1,1.6,2.8,2.7 c0.7,1.1,1.1,2.4,1.1,3.7H19.8z' }) }));
766
774
  }
767
775
 
768
- const DEFAULT_STATUS = 'incomplete';
769
- const { Provider, useStore } = createFastContext(DEFAULT_STATUS);
770
- function FormStatusProvider({ children, initialStatus = DEFAULT_STATUS, }) {
771
- return (jsxRuntime.jsx(react.Suspense, { children: jsxRuntime.jsx(Provider, { initialValue: initialStatus, children: children }) }));
776
+ function Banknote(props) {
777
+ return (jsxRuntime.jsxs("svg", { viewBox: '0 0 64 40.1', ...props, children: [jsxRuntime.jsx("path", { d: 'M62.1,0H1.9C0.8,0,0,0.8,0,1.9v36.2c0,1.2,0.8,2,1.9,2h60.1c1.2,0,1.9-0.8,1.9-2V1.9C64,0.8,63.2,0,62.1,0z M60.1,35.5 c0,0.5-0.2,0.7-0.7,0.7H4.6c-0.5,0-0.7-0.2-0.7-0.7V4.6c0-0.5,0.2-0.7,0.7-0.7h54.8c0.5,0,0.7,0.2,0.7,0.7V35.5z' }), jsxRuntime.jsx("path", { d: 'M56.1,6.5H7.9C7,6.5,6.5,7,6.5,7.9v24.2c0,0.9,0.5,1.4,1.4,1.4h48.2c0.9,0,1.4-0.5,1.4-1.4V7.9C57.5,7,57,6.5,56.1,6.5z M55,30.5c0,0.4-0.2,0.6-0.5,0.6h-45c-0.4,0-0.5-0.2-0.5-0.6v-21c0-0.4,0.2-0.6,0.5-0.6h45c0.4,0,0.5,0.2,0.5,0.6V30.5z' }), jsxRuntime.jsx("path", { d: 'M31.9,6.5c-5.1,0-9.2,5.2-9.2,13.5c0,8.3,4.1,13.5,9.2,13.5c5.2,0,9.4-5.2,9.4-13.5C41.3,11.7,37.1,6.5,31.9,6.5z M31.9,30.7c-3.5,0-6.4-4.1-6.4-10.7c0-6.6,2.9-10.6,6.4-10.6c3.6,0,6.6,4.1,6.6,10.6C38.5,26.6,35.5,30.7,31.9,30.7z' })] }));
772
778
  }
773
- function useFormStatus() {
774
- return useStore(store => store);
779
+
780
+ function BellFill(props) {
781
+ return (jsxRuntime.jsxs("svg", { viewBox: '0 0 57.4 64', ...props, children: [jsxRuntime.jsx("path", { d: 'M4.6,51.9h48.2c1.4,0,2.6-0.3,3.4-1c0.8-0.7,1.2-1.6,1.2-2.7c0-1.5-0.6-3-1.9-4.4c-1.3-1.4-2.5-2.8-3.8-4.1 c-0.7-0.7-1.2-1.6-1.6-2.7c-0.4-1.1-0.7-2.3-0.8-3.6s-0.3-2.5-0.4-3.6c-0.1-5.8-1-10.7-2.7-14.6c-1.7-3.9-4.6-6.6-8.7-8.1 c-0.6-2-1.6-3.6-3.1-5C32.8,0.7,31,0,28.7,0c-2.2,0-4.1,0.7-5.7,2.1c-1.5,1.4-2.6,3-3.1,5c-4.1,1.5-6.9,4.2-8.7,8.1 C9.5,19,8.6,23.9,8.5,29.7c-0.1,1.2-0.2,2.4-0.4,3.6c-0.2,1.3-0.5,2.4-0.8,3.6c-0.4,1.1-0.9,2-1.6,2.7c-1.3,1.3-2.6,2.7-3.9,4.1 C0.6,45.2,0,46.6,0,48.1c0,1.1,0.4,2,1.2,2.7C2,51.5,3.2,51.9,4.6,51.9z' }), jsxRuntime.jsx("path", { d: 'M28.7,64c2.6,0,4.7-0.8,6.4-2.4c1.7-1.6,2.7-3.5,2.9-5.6H19.4c0.2,2.1,1.1,4,2.9,5.6C24,63.2,26.1,64,28.7,64z' })] }));
775
782
  }
776
783
 
777
- function validateField$1(value, { required, type }) {
778
- const noValue = !value || value === '';
779
- if (!required && noValue)
780
- return true;
781
- if (noValue)
782
- return false;
783
- switch (type) {
784
- case 'email':
785
- return isEmail(value);
786
- case 'number':
787
- return !isNaN(Number(value));
788
- case 'tel':
789
- return isPhoneNumber(value);
790
- default:
791
- return true;
792
- }
784
+ function BoltCar(props) {
785
+ return (jsxRuntime.jsxs("svg", { viewBox: '0 0 64 50.1', ...props, children: [jsxRuntime.jsx("path", { d: 'M60.5,20.6l-2.3-3c-1-4.9-2.8-10-3.7-12c-1.4-3-4.3-4.9-7.8-5.3C44.9,0.1,39-0.1,32-0.1S19.1,0.1,17.3,0.3 c-3.6,0.4-6.4,2.3-7.8,5.3c-0.9,2-2.7,7.1-3.7,12l-2.3,3C1,23.8,0.1,26.5,0.1,31.1v4.8c0,3.5,2.1,5.5,5.7,5.9c4.9,0.6,17,1,26.1,1 s21.2-0.4,26.3-1c3.7-0.4,5.7-2.4,5.7-5.9v-4.8C63.9,26.5,63,24,60.5,20.6z M60.4,34.9c0,2.1-0.8,3.3-3.1,3.5 c-4.4,0.5-16.2,0.9-25.4,0.9s-21-0.4-25.3-0.9c-2.3-0.3-3.1-1.5-3.1-3.5v-3.7c0-3.7,0.6-5.4,2.7-8.2L9,19.4 c0.7-3.9,2.5-9.4,3.6-11.9c0.9-1.9,2.6-3,5.1-3.3C19.4,4,24.9,3.7,32,3.7c7.1,0,12.7,0.3,14.2,0.5c2.6,0.3,4.2,1.5,5.1,3.3 c1.2,2.5,2.9,8,3.6,11.9l2.8,3.6c2.1,2.7,2.7,4.5,2.7,8.2V34.9z' }), jsxRuntime.jsx("path", { d: 'M4.8,50.2H8c2,0,3.6-1.5,3.6-3.5v-6.4L1.2,38.8v7.9C1.3,48.7,2.8,50.2,4.8,50.2z' }), jsxRuntime.jsx("path", { d: 'M55.7,50.2h3.2c2,0,3.6-1.5,3.6-3.5v-7.9l-10.4,1.5v6.4C52.1,48.7,53.7,50.2,55.7,50.2z' }), jsxRuntime.jsx("path", { d: 'M23.3,23.1c0,0.5,0.4,0.9,0.9,0.9h6.7l-3.6,9.6c-0.5,1.3,0.9,2,1.7,0.9l10.8-13.6c0.2-0.2,0.4-0.5,0.4-0.8 c0-0.5-0.4-0.9-0.9-0.9h-6.7l3.5-9.6c0.5-1.3-0.9-2-1.7-0.9L23.6,22.3C23.4,22.6,23.3,22.8,23.3,23.1z' })] }));
793
786
  }
794
- function Input({ checked, className, defaultValue, description, descriptionProps, disabled, fieldProps, invalid = true, label, labelProps, name, onBlur, onChange, placeholder, ref, required = true, type, value, ...props }) {
795
- const [formContext, setFormContext] = useFormContext();
796
- if (placeholder === '*')
797
- placeholder = name + (required && !label ? '*' : '');
798
- if (label === '*')
799
- label = name;
800
- const uniqueID = react.useId(), fieldContextID = toLowerCase(name, [, '_']) + '§' + uniqueID;
801
- if (Boolean(formContext?.find(field => field.id === fieldContextID)?.invalid))
802
- invalid = true;
803
- const getFieldContextType = () => {
804
- switch (type) {
805
- case 'email':
806
- return 'email';
807
- case 'file':
808
- return 'file';
809
- case 'number':
810
- return 'number';
811
- case 'tel':
812
- return 'tel';
813
- case 'url':
814
- return 'url';
815
- default:
816
- return 'string';
817
- }
818
- };
819
- const fieldContextType = getFieldContextType();
820
- const initialFieldContext = defineField({
821
- type: fieldContextType,
822
- id: fieldContextID,
823
- invalid,
824
- name,
825
- required,
826
- value: value ? `${value}` : defaultValue ? `${defaultValue}` : '',
827
- });
828
- react.useEffect(() => {
829
- if (!setFormContext)
830
- return;
831
- setFormContext(prevContext => {
832
- const otherFields = (prevContext || []).filter(field => field.id !== initialFieldContext.id);
833
- return [...otherFields, initialFieldContext];
834
- });
835
- return () => {
836
- setFormContext(prevContext => (prevContext || []).filter(field => field.id !== initialFieldContext.id));
837
- };
838
- }, [setFormContext]);
839
- const fieldContext = formContext?.find(({ id: fieldID }) => fieldID === initialFieldContext.id) || initialFieldContext;
840
- const debounceTimerRef = react.useRef(undefined);
841
- const handleChange = e => {
842
- if (disabled) {
843
- e.preventDefault();
844
- return;
845
- }
846
- clearTimeout(debounceTimerRef.current);
847
- const { currentTarget } = e, { value: newValue } = currentTarget;
848
- setFormContext?.(prevContext => {
849
- if (!prevContext)
850
- return [];
851
- const field = prevContext.find(({ id: fieldID }) => fieldID === initialFieldContext.id);
852
- if (!field)
853
- throw new Error(`Field with id "${initialFieldContext.id}" not found in form context.`);
854
- const otherFields = prevContext.filter(({ id: fieldID }) => fieldID !== initialFieldContext.id);
855
- const updatedField = { ...field, value: newValue };
856
- return [...otherFields, updatedField];
857
- });
858
- debounceTimerRef.current = setTimeout(() => {
859
- const field = formContext?.find(({ id: fieldID }) => fieldID === initialFieldContext.id);
860
- if (!field)
861
- return;
862
- const invalid = validateField$1(newValue, field) === false;
863
- if (invalid !== field.invalid)
864
- setFormContext?.(prevContext => {
865
- if (!prevContext)
866
- return [];
867
- const field = prevContext.find(({ id: fieldID }) => fieldID === initialFieldContext.id);
868
- if (!field)
869
- throw new Error(`Field with id "${initialFieldContext.id}" not found in form context.`);
870
- const otherFields = prevContext.filter(({ id: fieldID }) => fieldID !== initialFieldContext.id);
871
- const updatedField = { ...field, invalid };
872
- return [...otherFields, updatedField];
873
- });
874
- }, 500);
875
- onChange?.(e);
876
- };
877
- const handleBlur = e => {
878
- if (disabled) {
879
- e.preventDefault();
880
- return;
881
- }
882
- const { currentTarget } = e, { value: newValue } = currentTarget;
883
- switch (type) {
884
- case 'email':
885
- setFormContext?.(prevContext => {
886
- if (!prevContext)
887
- return [];
888
- const field = prevContext.find(({ id: fieldID }) => fieldID === initialFieldContext.id);
889
- if (!field)
890
- throw new Error(`Field with id "${initialFieldContext.id}" not found in form context.`);
891
- const otherFields = prevContext.filter(({ id: fieldID }) => fieldID !== initialFieldContext.id);
892
- const updatedField = { ...field, value: newValue.toLowerCase() };
893
- return [...otherFields, updatedField];
894
- });
895
- break;
896
- case 'tel':
897
- setFormContext?.(prevContext => {
898
- if (!prevContext)
899
- return [];
900
- const field = prevContext.find(({ id: fieldID }) => fieldID === initialFieldContext.id);
901
- if (!field)
902
- throw new Error(`Field with id "${initialFieldContext.id}" not found in form context.`);
903
- const otherFields = prevContext.filter(({ id: fieldID }) => fieldID !== initialFieldContext.id);
904
- const updatedField = { ...field, value: formatPhoneNumber(newValue, '1') };
905
- return [...otherFields, updatedField];
906
- });
907
- break;
908
- }
909
- onBlur?.(e);
910
- };
911
- const restFieldProps = fieldProps
912
- ? Object.fromEntries(Object.entries(fieldProps).filter(([key]) => key !== 'className'))
913
- : {};
914
- const restLabelProps = labelProps
915
- ? Object.fromEntries(Object.entries(labelProps).filter(([key]) => key !== 'className'))
916
- : {};
917
- const restDescriptionProps = descriptionProps
918
- ? Object.fromEntries(Object.entries(descriptionProps).filter(([key]) => key !== 'className'))
919
- : {};
920
- return (jsxRuntime.jsxs(react$1.Field, { ...restFieldProps, className: bag => twMerge('grid gap-1', typeof fieldProps?.className === 'function' ? fieldProps?.className(bag) : fieldProps?.className), disabled: disabled, children: [label && (jsxRuntime.jsx(react$1.Label, { ...restLabelProps, className: bag => twMerge('text-sm font-medium', required ? 'after:text-ui-red after:content-["_*"]' : '', typeof labelProps?.className === 'function' ? labelProps?.className(bag) : labelProps?.className), children: label })), jsxRuntime.jsx(react$1.Input, { ...props, className: bag => twMerge(
921
- // Base styles
922
- 'rounded-xl border-1 border-neutral-500/50 bg-neutral-100 py-1 pl-2 text-neutral-950 outline-offset-1 outline-ui-sky-blue/95 transition-[background-color] duration-300 ease-exponential dark:bg-neutral-700 dark:text-neutral-50',
923
- // Pseudo styles
924
- 'focus-visible:bg-neutral-50 focus-visible:outline-3 active:bg-neutral-200 dark:focus-visible:bg-neutral-600 dark:active:bg-neutral-800 pointer-fine:hover:bg-neutral-50 pointer-fine:active:bg-neutral-200 dark:pointer-fine:hover:bg-neutral-600 dark:pointer-fine:active:bg-neutral-800',
925
- // user-invalid styles
926
- 'user-invalid:border-ui-red user-invalid:bg-[color-mix(in_oklab,var(--color-ui-red)_20%,var(--color-neutral-100))] user-invalid:focus-visible:bg-[color-mix(in_oklab,var(--color-ui-red)_1%,var(--color-neutral-100))] user-invalid:active:bg-[color-mix(in_oklab,var(--color-ui-red)_25%,var(--color-neutral-100))] dark:user-invalid:bg-[color-mix(in_oklab,var(--color-ui-red)_20%,var(--color-neutral-800))] dark:user-invalid:focus-visible:bg-[color-mix(in_oklab,var(--color-ui-red)_1%,var(--color-neutral-800))] dark:user-invalid:active:bg-[color-mix(in_oklab,var(--color-ui-red)_25%,var(--color-neutral-800))] user-invalid:pointer-fine:hover:bg-[color-mix(in_oklab,var(--color-ui-red)_10%,var(--color-neutral-100))] user-invalid:pointer-fine:focus-visible:bg-[color-mix(in_oklab,var(--color-ui-red)_1%,var(--color-neutral-100))] user-invalid:pointer-fine:active:bg-[color-mix(in_oklab,var(--color-ui-red)_25%,var(--color-neutral-100))] dark:user-invalid:pointer-fine:hover:bg-[color-mix(in_oklab,var(--color-ui-red)_10%,var(--color-neutral-800))] dark:user-invalid:pointer-fine:focus-visible:bg-[color-mix(in_oklab,var(--color-ui-red)_1%,var(--color-neutral-800))] dark:user-invalid:pointer-fine:active:bg-[color-mix(in_oklab,var(--color-ui-red)_25%,var(--color-neutral-800))]',
927
- // Custom styles
928
- typeof className === 'function' ? className(bag) : className), id: fieldContext?.id, invalid: invalid, onBlur: handleBlur, onChange: handleChange, placeholder: placeholder, ref: ref, required: required, type: type, value: fieldContext?.value }), description && (jsxRuntime.jsx(react$1.Description, { ...restDescriptionProps, className: bag => twMerge('text-xs', typeof descriptionProps?.className === 'function'
929
- ? descriptionProps?.className(bag)
930
- : descriptionProps?.className), children: description }))] }));
931
- }
932
-
933
- function SubmitButton({ children, className, error, incomplete, loading, success, theme, type = 'submit', ref, ...props }) {
934
- const [formStatus] = useFormStatus();
935
- const getFormStatusButtonClasses = () => {
936
- switch (formStatus) {
937
- case 'loading':
938
- return twSort('animate-pulse cursor-wait text-lg leading-6 font-black tracking-widest');
939
- case 'error':
940
- case 'success':
941
- return 'cursor-not-allowed';
942
- default:
943
- return undefined;
944
- }
945
- };
946
- const formStatusButtonClasses = getFormStatusButtonClasses();
947
- const getFormStatusButtonTheme = () => {
948
- switch (formStatus) {
949
- case 'incomplete':
950
- return 'grey';
951
- case 'loading':
952
- return 'blue';
953
- case 'error':
954
- return 'red';
955
- case 'success':
956
- return 'green';
957
- default:
958
- return theme;
959
- }
960
- };
961
- const formStatusButtonTheme = getFormStatusButtonTheme();
962
- const getButtonText = () => {
963
- switch (formStatus) {
964
- case 'incomplete':
965
- return incomplete || 'Complete Form';
966
- case 'loading':
967
- return (loading || (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("span", { className: 'inline-block animate-wave animation-delay-300', children: "\u2022" }), jsxRuntime.jsx("span", { className: 'inline-block animate-wave animation-delay-150', children: "\u2022" }), jsxRuntime.jsx("span", { className: 'inline-block animate-wave', children: "\u2022" })] })));
968
- case 'error':
969
- return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [error || 'Error', ' ', jsxRuntime.jsx("span", { className: 'absolute top-1/2 ml-1.5 translate-y-[calc(-50%-1.5px)] text-2xl', children: "\u00D7" })] }));
970
- case 'success':
971
- return success || 'Successfully Submitted';
972
- default:
973
- return children || 'Submit';
974
- }
975
- };
976
- const buttonText = getButtonText();
977
- return (jsxRuntime.jsx(Button, { ...props, className: twMerge([formStatusButtonClasses, 'w-full', className]), ref: ref, theme: formStatusButtonTheme, type: type, children: buttonText }));
978
- }
979
-
980
- function validateField(value, { required }) {
981
- const noValue = !value || value === '';
982
- if (!required && noValue)
983
- return true;
984
- if (noValue)
985
- return false;
986
- return true;
987
- }
988
- function Textarea({ className, defaultValue, description, descriptionProps, disabled, fieldProps, invalid = true, label, labelProps, name, onBlur, onChange, placeholder, ref, required = true, value, ...props }) {
989
- const [formContext, setFormContext] = useFormContext();
990
- if (placeholder === '*')
991
- placeholder = name + (required && !label ? '*' : '');
992
- if (label === '*')
993
- label = name;
994
- const uniqueID = react.useId(), fieldContextID = toLowerCase(name, [, '_']) + '§' + uniqueID;
995
- if (Boolean(formContext?.find(field => field.id === fieldContextID)?.invalid))
996
- invalid = true;
997
- const initialFieldContext = defineField({
998
- type: 'textarea',
999
- id: fieldContextID,
1000
- invalid,
1001
- name,
1002
- required,
1003
- value: value ? `${value}` : defaultValue ? `${defaultValue}` : '',
1004
- });
1005
- react.useEffect(() => {
1006
- if (!setFormContext)
1007
- return;
1008
- setFormContext(prevContext => {
1009
- const otherFields = (prevContext || []).filter(field => field.id !== initialFieldContext.id);
1010
- return [...otherFields, initialFieldContext];
1011
- });
1012
- return () => {
1013
- setFormContext(prevContext => (prevContext || []).filter(field => field.id !== initialFieldContext.id));
1014
- };
1015
- }, [setFormContext]);
1016
- const fieldContext = formContext?.find(({ id: fieldID }) => fieldID === initialFieldContext.id) || initialFieldContext;
1017
- const debounceTimerRef = react.useRef(undefined);
1018
- const handleChange = e => {
1019
- if (disabled) {
1020
- e.preventDefault();
1021
- return;
1022
- }
1023
- clearTimeout(debounceTimerRef.current);
1024
- const { currentTarget } = e, { value: newValue } = currentTarget;
1025
- setFormContext?.(prevContext => {
1026
- if (!prevContext)
1027
- return [];
1028
- const field = prevContext.find(({ id: fieldID }) => fieldID === initialFieldContext.id);
1029
- if (!field)
1030
- throw new Error(`Field with id "${initialFieldContext.id}" not found in form context.`);
1031
- const otherFields = prevContext.filter(({ id: fieldID }) => fieldID !== initialFieldContext.id);
1032
- const updatedField = { ...field, value: newValue };
1033
- return [...otherFields, updatedField];
1034
- });
1035
- debounceTimerRef.current = setTimeout(() => {
1036
- const field = formContext?.find(({ id: fieldID }) => fieldID === initialFieldContext.id);
1037
- if (!field)
1038
- return;
1039
- const invalid = validateField(newValue, field) === false;
1040
- if (invalid !== field.invalid)
1041
- setFormContext?.(prevContext => {
1042
- if (!prevContext)
1043
- return [];
1044
- const field = prevContext.find(({ id: fieldID }) => fieldID === initialFieldContext.id);
1045
- if (!field)
1046
- throw new Error(`Field with id "${initialFieldContext.id}" not found in form context.`);
1047
- const otherFields = prevContext.filter(({ id: fieldID }) => fieldID !== initialFieldContext.id);
1048
- const updatedField = { ...field, invalid };
1049
- return [...otherFields, updatedField];
1050
- });
1051
- }, 500);
1052
- onChange?.(e);
1053
- };
1054
- const restFieldProps = fieldProps
1055
- ? Object.fromEntries(Object.entries(fieldProps).filter(([key]) => key !== 'className'))
1056
- : {};
1057
- const restLabelProps = labelProps
1058
- ? Object.fromEntries(Object.entries(labelProps).filter(([key]) => key !== 'className'))
1059
- : {};
1060
- const restDescriptionProps = descriptionProps
1061
- ? Object.fromEntries(Object.entries(descriptionProps).filter(([key]) => key !== 'className'))
1062
- : {};
1063
- return (jsxRuntime.jsxs(react$1.Field, { ...restFieldProps, className: bag => twMerge('grid gap-1', typeof fieldProps?.className === 'function' ? fieldProps?.className(bag) : fieldProps?.className), disabled: disabled, children: [label && (jsxRuntime.jsx(react$1.Label, { ...restLabelProps, className: bag => twMerge('text-sm font-medium', required ? 'after:text-ui-red after:content-["_*"]' : '', typeof labelProps?.className === 'function' ? labelProps?.className(bag) : labelProps?.className), children: label })), jsxRuntime.jsx(react$1.Textarea, { ...props, className: bag => twMerge(
1064
- // Base styles
1065
- 'field-sizing-content resize-none rounded-xl border-1 border-neutral-500/50 bg-neutral-100 py-1 pl-2 text-neutral-950 outline-offset-1 outline-ui-sky-blue/95 transition-[background-color] duration-300 ease-exponential dark:bg-neutral-700 dark:text-neutral-50',
1066
- // Pseudo styles
1067
- 'focus-visible:bg-neutral-50 focus-visible:outline-3 active:bg-neutral-200 dark:focus-visible:bg-neutral-600 dark:active:bg-neutral-800 pointer-fine:hover:bg-neutral-50 pointer-fine:active:bg-neutral-200 dark:pointer-fine:hover:bg-neutral-600 dark:pointer-fine:active:bg-neutral-800',
1068
- // user-invalid styles
1069
- 'user-invalid:border-ui-red user-invalid:bg-[color-mix(in_oklab,var(--color-ui-red)_20%,var(--color-neutral-100))] user-invalid:focus-visible:bg-[color-mix(in_oklab,var(--color-ui-red)_1%,var(--color-neutral-100))] user-invalid:active:bg-[color-mix(in_oklab,var(--color-ui-red)_25%,var(--color-neutral-100))] dark:user-invalid:bg-[color-mix(in_oklab,var(--color-ui-red)_20%,var(--color-neutral-800))] dark:user-invalid:focus-visible:bg-[color-mix(in_oklab,var(--color-ui-red)_1%,var(--color-neutral-800))] dark:user-invalid:active:bg-[color-mix(in_oklab,var(--color-ui-red)_25%,var(--color-neutral-800))] user-invalid:pointer-fine:hover:bg-[color-mix(in_oklab,var(--color-ui-red)_10%,var(--color-neutral-100))] user-invalid:pointer-fine:focus-visible:bg-[color-mix(in_oklab,var(--color-ui-red)_1%,var(--color-neutral-100))] user-invalid:pointer-fine:active:bg-[color-mix(in_oklab,var(--color-ui-red)_25%,var(--color-neutral-100))] dark:user-invalid:pointer-fine:hover:bg-[color-mix(in_oklab,var(--color-ui-red)_10%,var(--color-neutral-800))] dark:user-invalid:pointer-fine:focus-visible:bg-[color-mix(in_oklab,var(--color-ui-red)_1%,var(--color-neutral-800))] dark:user-invalid:pointer-fine:active:bg-[color-mix(in_oklab,var(--color-ui-red)_25%,var(--color-neutral-800))]',
1070
- // Custom styles
1071
- typeof className === 'function' ? className(bag) : className), id: fieldContext?.id, invalid: invalid, onChange: handleChange, placeholder: placeholder, ref: ref, required: required, value: fieldContext?.value }), description && (jsxRuntime.jsx(react$1.Description, { ...restDescriptionProps, className: bag => twMerge('text-xs', typeof descriptionProps?.className === 'function'
1072
- ? descriptionProps?.className(bag)
1073
- : descriptionProps?.className), children: description }))] }));
1074
- }
1075
-
1076
- // import { findComponentByType } from '../../utils'
1077
- function FormComponent({ as, children, className, handleSubmit, onError, onSubmit, onSuccess, ...props }) {
1078
- const [formContext] = useFormContext(), [formStatus, setFormStatus] = useFormStatus();
1079
- // const submitButton = findComponentByType(children, SubmitButton)
1080
- react.useEffect(() => {
1081
- if (!formContext)
1082
- return;
1083
- if (formStatus !== 'incomplete' && formContext.find(({ invalid }) => invalid))
1084
- setFormStatus?.('incomplete');
1085
- if (formStatus !== 'ready' && formContext.every(({ invalid }) => !invalid))
1086
- setFormStatus?.('ready');
1087
- }, [formContext]);
1088
- const processSubmit = handleSubmit ||
1089
- (async (e) => {
1090
- e.preventDefault();
1091
- e.stopPropagation();
1092
- setFormStatus?.('loading');
1093
- const response = await onSubmit?.({ event: e, formContext });
1094
- if (response && ('error' in response || response.status === 'error')) {
1095
- setFormStatus?.('error');
1096
- onError?.({ event: e, error: response.error || 'An error occurred when submitting the form.' });
1097
- return;
1098
- }
1099
- if ((response && response.status === 'success') || !response) {
1100
- setFormStatus?.('success');
1101
- onSuccess?.({ event: e });
1102
- }
1103
- });
1104
- const FormElement = as || 'form';
1105
- return (jsxRuntime.jsx(FormElement, { ...props, className: twMerge(className, 'grid gap-3'), onSubmit: processSubmit, children: children }));
1106
- }
1107
- function Form({ controlled = 'auto', initialStatus = 'incomplete', ...props }) {
1108
- const FormContextOrNotProvider = controlled === 'auto' ? FormContextProvider : react.Fragment;
1109
- return (jsxRuntime.jsx(FormStatusProvider, { initialStatus: initialStatus, children: jsxRuntime.jsx(FormContextOrNotProvider, { children: jsxRuntime.jsx(FormComponent, { ...props }) }) }));
1110
- }
1111
-
1112
- function Ghost({ children, className, ...props }) {
1113
- return (jsxRuntime.jsx("div", { ...props, className: twMerge('block w-24 max-w-full animate-pulse rounded bg-white/50', className), children: children || jsxRuntime.jsx(jsxRuntime.Fragment, { children: "\u00A0" }) }));
1114
- }
1115
-
1116
- function getTextFromChildren(children) {
1117
- let text = '';
1118
- react.Children.forEach(children, child => {
1119
- if (typeof child === 'string' || typeof child === 'number') {
1120
- text += child;
1121
- }
1122
- else if (react.isValidElement(child)) {
1123
- text += getTextFromChildren(child.props.children);
1124
- }
1125
- });
1126
- return text;
1127
- }
1128
- /**
1129
- * # Heading
1130
- * A heading component that renders HTML heading elements (h1-h6) with appropriate styling.
1131
- * Automatically generates an ID for the heading based on its content if none is provided.
1132
- */
1133
- function Heading({ as = 'h2', children, customize, className, id, ref, ...props }) {
1134
- const H = as;
1135
- const targetableID = id || getTextFromChildren(children).replace(/\s+/g, '-').toLowerCase();
1136
- const getBaseClasses = () => {
1137
- switch (as) {
1138
- case 'h1':
1139
- return customize?.h1 || twSort('pb-2.5 text-6xl font-black last:pb-0');
1140
- case 'h3':
1141
- return customize?.h3 || twSort('pb-2 text-4xl font-extralight last:pb-0');
1142
- case 'h4':
1143
- return customize?.h4 || twSort('pb-2 text-3xl font-extrabold last:pb-0');
1144
- case 'h5':
1145
- return customize?.h5 || twSort('pb-1.5 text-2xl font-semibold last:pb-0');
1146
- case 'h6':
1147
- return customize?.h6 || twSort('pb-1 text-xl font-bold last:pb-0');
1148
- default:
1149
- return customize?.h2 || twSort('pb-2.5 text-5xl font-medium last:pb-0');
1150
- }
1151
- };
1152
- const baseClasses = getBaseClasses();
1153
- return (jsxRuntime.jsx(H, { ref: ref, id: targetableID, ...props, className: twMerge(baseClasses, className), children: children }));
1154
- }
1155
-
1156
- function Airplane(props) {
1157
- return (jsxRuntime.jsx("svg", { viewBox: '0 0 64 63.9', ...props, children: jsxRuntime.jsx("path", { d: 'M62.7,1.3c-0.9-0.9-2-1.3-3.4-1.2c-1.4,0.1-3,0.5-4.5,1.2c-1.6,0.8-3.2,1.9-4.6,3.4L41,13.7c-0.7,0.7-1.2,1.1-1.6,1.2 c-0.5,0.2-1.1,0.3-1.9,0.2L5.5,13.8c-1.1-0.1-1.9,0.3-2.6,0.9l-2.6,2.6C0.1,17.6,0,18,0,18.4c0.1,0.4,0.3,0.7,0.9,0.8l25.3,9.5 L15.9,41.5L4.3,38.1c-0.9-0.3-1.6,0-2.4,0.7l-1,1c-0.3,0.3-0.5,0.6-0.5,1c0,0.4,0.1,0.7,0.5,1l21.3,21.3c0.3,0.3,0.6,0.5,1,0.4 c0.4-0.1,0.7-0.1,1-0.5l1-1c0.7-0.7,1-1.5,0.7-2.4L22.5,48l12.8-10.2l9.5,25.3c0.2,0.5,0.5,0.7,0.8,0.9c0.4,0.1,0.7,0,1-0.3l2.6-2.6 c0.7-0.7,1-1.5,0.9-2.6l-1.4-31.9c-0.1-0.8,0-1.4,0.2-1.9c0.2-0.5,0.6-1,1.2-1.6l9.1-9.1c1.4-1.4,2.6-3,3.4-4.6 C63.5,7.6,64,6.1,64,4.7S63.5,2.2,62.7,1.3z' }) }));
1158
- }
1159
-
1160
- function ArrowTriangle2CirclepathCircle(props) {
1161
- return (jsxRuntime.jsxs("svg", { viewBox: '0 0 64 64', ...props, children: [jsxRuntime.jsx("path", { d: 'M61.5,19.6c-1.7-3.9-4-7.3-6.9-10.2c-3-3-6.4-5.3-10.2-6.9C40.5,0.8,36.3,0,31.9,0c-4.4,0-8.5,0.8-12.3,2.5 c-3.9,1.7-7.3,4-10.2,6.9c-2.9,3-5.2,6.4-6.9,10.2C0.8,23.5,0,27.6,0,32c0,4.4,0.8,8.5,2.5,12.3c1.7,3.9,4,7.3,6.9,10.2 c2.9,3,6.3,5.3,10.2,6.9c3.9,1.7,8,2.5,12.3,2.5c4.4,0,8.5-0.8,12.4-2.5c3.9-1.7,7.3-4,10.2-6.9c2.9-3,5.3-6.4,6.9-10.2 S64,36.3,64,32C64,27.6,63.2,23.5,61.5,19.6z M56.6,42.4c-1.4,3.2-3.3,6.1-5.7,8.5c-2.4,2.4-5.3,4.4-8.5,5.7 c-3.2,1.4-6.7,2.1-10.4,2.1c-3.7,0-7.1-0.7-10.4-2.1c-3.2-1.4-6-3.3-8.5-5.7c-2.4-2.4-4.3-5.3-5.7-8.5C6.1,39.1,5.4,35.7,5.4,32 s0.7-7.1,2-10.4s3.3-6.1,5.7-8.5c2.4-2.4,5.3-4.4,8.5-5.7c3.2-1.4,6.7-2.1,10.4-2.1c3.7,0,7.2,0.7,10.4,2.1c3.2,1.4,6.1,3.3,8.5,5.7 c2.4,2.4,4.4,5.3,5.7,8.5s2.1,6.7,2.1,10.4S58,39.1,56.6,42.4z' }), jsxRuntime.jsx("path", { d: 'M32.1,49.5c2,0,3.9-0.3,5.7-1c1.9-0.6,3.5-1.5,4.8-2.6c0.7-0.6,1.2-1.3,1.3-2c0.2-0.7,0-1.4-0.6-2c-0.6-0.6-1.2-0.9-1.9-0.8 c-0.7,0-1.3,0.3-1.9,0.7c-1.1,0.9-2.3,1.6-3.5,2c-1.2,0.5-2.6,0.7-4.1,0.7c-2.1,0-4-0.4-5.8-1.3s-3.3-2-4.5-3.5 c-1.2-1.5-2.1-3.1-2.5-5h3.3c0.7,0,1.2-0.3,1.3-0.8c0.2-0.6,0-1.1-0.3-1.7l-5.1-7.1c-0.4-0.6-1-0.9-1.6-0.9c-0.6,0-1.2,0.3-1.6,0.9 l-5,7.1c-0.4,0.6-0.5,1.1-0.4,1.7s0.6,0.8,1.3,0.8h3.3c0.5,2.9,1.6,5.4,3.2,7.7c1.6,2.2,3.7,3.9,6.1,5.2 C26.4,48.9,29.1,49.5,32.1,49.5z' }), jsxRuntime.jsx("path", { d: 'M32,14.4c-2,0-3.9,0.3-5.7,1c-1.9,0.6-3.5,1.5-4.8,2.7c-0.8,0.6-1.2,1.2-1.4,2c-0.1,0.7,0.1,1.4,0.6,2 c0.5,0.6,1.1,0.9,1.8,0.8c0.7,0,1.3-0.3,1.9-0.8c1.1-0.9,2.3-1.5,3.5-2c1.2-0.5,2.6-0.7,4.1-0.7c2.1,0,4,0.4,5.8,1.3 c1.8,0.9,3.3,2,4.5,3.5c1.2,1.5,2.1,3.1,2.6,5h-3.5c-0.7,0-1.2,0.3-1.3,0.8c-0.2,0.6-0.1,1.1,0.4,1.7l5.1,7.1 c0.4,0.6,0.9,0.9,1.6,0.9c0.6,0,1.2-0.3,1.6-0.9l5-7.1c0.4-0.6,0.5-1.1,0.4-1.7c-0.2-0.6-0.6-0.8-1.3-0.8h-3.1 c-0.5-2.9-1.6-5.5-3.2-7.7s-3.7-3.9-6.2-5.2C37.8,15,35,14.4,32,14.4z' })] }));
1162
- }
1163
-
1164
- function ArrowTriangle2CirclepathCircleFill(props) {
1165
- return (jsxRuntime.jsx("svg", { viewBox: '0 0 64 64', ...props, children: jsxRuntime.jsx("path", { d: 'M61.5,19.6c-1.7-3.9-4-7.3-6.9-10.2c-3-3-6.4-5.3-10.2-6.9C40.5,0.8,36.3,0,31.9,0c-4.4,0-8.5,0.8-12.3,2.5 c-3.9,1.7-7.3,4-10.2,6.9c-2.9,3-5.2,6.4-6.9,10.2C0.8,23.5,0,27.6,0,32s0.8,8.5,2.5,12.3c1.7,3.9,4,7.3,6.9,10.2 c2.9,3,6.3,5.3,10.2,6.9c3.9,1.7,8,2.5,12.3,2.5c4.4,0,8.5-0.8,12.4-2.5c3.9-1.7,7.3-4,10.2-6.9c2.9-3,5.3-6.4,6.9-10.2 S64,36.3,64,32S63.2,23.5,61.5,19.6z M44.5,44.2c-0.2,0.8-0.6,1.5-1.4,2.1c-1.4,1.1-3,2-4.9,2.7c-1.9,0.7-3.9,1-5.9,1 c-3.1,0-5.9-0.6-8.4-1.9c-2.5-1.3-4.6-3.1-6.3-5.3c-1.7-2.3-2.8-4.9-3.3-7.9h-3.4c-0.8,0-1.2-0.3-1.4-0.9c-0.2-0.6,0-1.2,0.4-1.7 l5.1-7.3c0.5-0.6,1-0.9,1.7-0.9c0.7,0,1.2,0.3,1.6,0.9l5.2,7.3c0.4,0.6,0.6,1.2,0.4,1.7s-0.6,0.9-1.4,0.9H19 c0.7,2.9,2.3,5.3,4.7,7.2c2.4,1.9,5.3,2.9,8.5,2.9c1.6,0,3-0.2,4.2-0.7s2.4-1.2,3.6-2.1c0.6-0.5,1.3-0.7,2-0.8 c0.7-0.1,1.3,0.2,1.9,0.8C44.4,42.8,44.6,43.5,44.5,44.2z M54.4,31.6l-5.2,7.3c-0.5,0.7-1,1-1.7,0.9c-0.7,0-1.2-0.3-1.6-0.9 l-5.3-7.3c-0.4-0.6-0.5-1.2-0.4-1.7c0.2-0.6,0.6-0.9,1.4-0.9h3.6c-0.7-2.9-2.3-5.3-4.7-7.2c-2.4-1.9-5.2-2.9-8.4-2.9 c-1.6,0-3,0.2-4.2,0.7s-2.4,1.2-3.6,2.1c-0.6,0.5-1.3,0.7-2,0.8c-0.7,0-1.3-0.2-1.9-0.8c-0.6-0.6-0.8-1.3-0.6-2 c0.2-0.8,0.6-1.5,1.4-2.1c1.4-1.1,3-2,4.9-2.7c1.9-0.7,3.9-1,5.9-1c3.1,0,5.9,0.6,8.4,1.9c2.5,1.3,4.6,3.1,6.3,5.3s2.8,4.9,3.3,7.9 h3.2c0.8,0,1.2,0.3,1.4,0.9S54.8,31,54.4,31.6z' }) }));
1166
- }
1167
-
1168
- function BagFill(props) {
1169
- return (jsxRuntime.jsx("svg", { viewBox: '0 0 55.6 64', ...props, children: jsxRuntime.jsx("path", { d: 'M53.1,14.6c-1.6-1.6-4.1-2.4-7.4-2.4h-5c-0.1-2.2-0.7-4.2-1.9-6s-2.7-3.3-4.7-4.4C32.3,0.6,30.1,0,27.8,0 c-2.3,0-4.5,0.6-6.4,1.7c-1.9,1.1-3.5,2.6-4.7,4.4c-1.2,1.8-1.8,3.9-1.9,6h-5c-3.3,0-5.7,0.8-7.4,2.4C0.8,16.2,0,18.7,0,21.9v32.4 c0,3.2,0.8,5.7,2.5,7.3S6.6,64,9.8,64h36.8c2.8,0,5-0.8,6.6-2.4c1.6-1.6,2.3-4.1,2.3-7.3V21.9C55.6,18.7,54.7,16.2,53.1,14.6z M19.8,12.2c0-1.4,0.4-2.6,1.1-3.7c0.7-1.1,1.6-2,2.8-2.7c1.2-0.7,2.5-1,4-1c1.5,0,2.8,0.3,4,1c1.2,0.7,2.1,1.6,2.8,2.7 c0.7,1.1,1.1,2.4,1.1,3.7H19.8z' }) }));
1170
- }
1171
-
1172
- function Banknote(props) {
1173
- return (jsxRuntime.jsxs("svg", { viewBox: '0 0 64 40.1', ...props, children: [jsxRuntime.jsx("path", { d: 'M62.1,0H1.9C0.8,0,0,0.8,0,1.9v36.2c0,1.2,0.8,2,1.9,2h60.1c1.2,0,1.9-0.8,1.9-2V1.9C64,0.8,63.2,0,62.1,0z M60.1,35.5 c0,0.5-0.2,0.7-0.7,0.7H4.6c-0.5,0-0.7-0.2-0.7-0.7V4.6c0-0.5,0.2-0.7,0.7-0.7h54.8c0.5,0,0.7,0.2,0.7,0.7V35.5z' }), jsxRuntime.jsx("path", { d: 'M56.1,6.5H7.9C7,6.5,6.5,7,6.5,7.9v24.2c0,0.9,0.5,1.4,1.4,1.4h48.2c0.9,0,1.4-0.5,1.4-1.4V7.9C57.5,7,57,6.5,56.1,6.5z M55,30.5c0,0.4-0.2,0.6-0.5,0.6h-45c-0.4,0-0.5-0.2-0.5-0.6v-21c0-0.4,0.2-0.6,0.5-0.6h45c0.4,0,0.5,0.2,0.5,0.6V30.5z' }), jsxRuntime.jsx("path", { d: 'M31.9,6.5c-5.1,0-9.2,5.2-9.2,13.5c0,8.3,4.1,13.5,9.2,13.5c5.2,0,9.4-5.2,9.4-13.5C41.3,11.7,37.1,6.5,31.9,6.5z M31.9,30.7c-3.5,0-6.4-4.1-6.4-10.7c0-6.6,2.9-10.6,6.4-10.6c3.6,0,6.6,4.1,6.6,10.6C38.5,26.6,35.5,30.7,31.9,30.7z' })] }));
1174
- }
1175
-
1176
- function BellFill(props) {
1177
- return (jsxRuntime.jsxs("svg", { viewBox: '0 0 57.4 64', ...props, children: [jsxRuntime.jsx("path", { d: 'M4.6,51.9h48.2c1.4,0,2.6-0.3,3.4-1c0.8-0.7,1.2-1.6,1.2-2.7c0-1.5-0.6-3-1.9-4.4c-1.3-1.4-2.5-2.8-3.8-4.1 c-0.7-0.7-1.2-1.6-1.6-2.7c-0.4-1.1-0.7-2.3-0.8-3.6s-0.3-2.5-0.4-3.6c-0.1-5.8-1-10.7-2.7-14.6c-1.7-3.9-4.6-6.6-8.7-8.1 c-0.6-2-1.6-3.6-3.1-5C32.8,0.7,31,0,28.7,0c-2.2,0-4.1,0.7-5.7,2.1c-1.5,1.4-2.6,3-3.1,5c-4.1,1.5-6.9,4.2-8.7,8.1 C9.5,19,8.6,23.9,8.5,29.7c-0.1,1.2-0.2,2.4-0.4,3.6c-0.2,1.3-0.5,2.4-0.8,3.6c-0.4,1.1-0.9,2-1.6,2.7c-1.3,1.3-2.6,2.7-3.9,4.1 C0.6,45.2,0,46.6,0,48.1c0,1.1,0.4,2,1.2,2.7C2,51.5,3.2,51.9,4.6,51.9z' }), jsxRuntime.jsx("path", { d: 'M28.7,64c2.6,0,4.7-0.8,6.4-2.4c1.7-1.6,2.7-3.5,2.9-5.6H19.4c0.2,2.1,1.1,4,2.9,5.6C24,63.2,26.1,64,28.7,64z' })] }));
1178
- }
1179
-
1180
- function BoltCar(props) {
1181
- return (jsxRuntime.jsxs("svg", { viewBox: '0 0 64 50.1', ...props, children: [jsxRuntime.jsx("path", { d: 'M60.5,20.6l-2.3-3c-1-4.9-2.8-10-3.7-12c-1.4-3-4.3-4.9-7.8-5.3C44.9,0.1,39-0.1,32-0.1S19.1,0.1,17.3,0.3 c-3.6,0.4-6.4,2.3-7.8,5.3c-0.9,2-2.7,7.1-3.7,12l-2.3,3C1,23.8,0.1,26.5,0.1,31.1v4.8c0,3.5,2.1,5.5,5.7,5.9c4.9,0.6,17,1,26.1,1 s21.2-0.4,26.3-1c3.7-0.4,5.7-2.4,5.7-5.9v-4.8C63.9,26.5,63,24,60.5,20.6z M60.4,34.9c0,2.1-0.8,3.3-3.1,3.5 c-4.4,0.5-16.2,0.9-25.4,0.9s-21-0.4-25.3-0.9c-2.3-0.3-3.1-1.5-3.1-3.5v-3.7c0-3.7,0.6-5.4,2.7-8.2L9,19.4 c0.7-3.9,2.5-9.4,3.6-11.9c0.9-1.9,2.6-3,5.1-3.3C19.4,4,24.9,3.7,32,3.7c7.1,0,12.7,0.3,14.2,0.5c2.6,0.3,4.2,1.5,5.1,3.3 c1.2,2.5,2.9,8,3.6,11.9l2.8,3.6c2.1,2.7,2.7,4.5,2.7,8.2V34.9z' }), jsxRuntime.jsx("path", { d: 'M4.8,50.2H8c2,0,3.6-1.5,3.6-3.5v-6.4L1.2,38.8v7.9C1.3,48.7,2.8,50.2,4.8,50.2z' }), jsxRuntime.jsx("path", { d: 'M55.7,50.2h3.2c2,0,3.6-1.5,3.6-3.5v-7.9l-10.4,1.5v6.4C52.1,48.7,53.7,50.2,55.7,50.2z' }), jsxRuntime.jsx("path", { d: 'M23.3,23.1c0,0.5,0.4,0.9,0.9,0.9h6.7l-3.6,9.6c-0.5,1.3,0.9,2,1.7,0.9l10.8-13.6c0.2-0.2,0.4-0.5,0.4-0.8 c0-0.5-0.4-0.9-0.9-0.9h-6.7l3.5-9.6c0.5-1.3-0.9-2-1.7-0.9L23.6,22.3C23.4,22.6,23.3,22.8,23.3,23.1z' })] }));
1182
- }
1183
-
1184
- function BoltFill(props) {
1185
- return (jsxRuntime.jsx("svg", { viewBox: '0 0 40.3 64', ...props, children: jsxRuntime.jsx("path", { d: 'M0,35.6c0,0.5,0.2,1,0.6,1.4C1,37.3,1.5,37.5,2,37.5h16.2L9.7,60.7c-0.4,1-0.3,1.8,0.1,2.4c0.4,0.6,1,0.9,1.7,0.9 c0.7,0,1.4-0.4,2.1-1.2l26-32.5c0.5-0.6,0.7-1.3,0.7-1.8c0-0.5-0.2-1-0.6-1.4c-0.4-0.4-0.9-0.6-1.5-0.6H22.1l8.6-23.2 c0.4-1,0.3-1.8-0.1-2.4c-0.4-0.6-1-0.9-1.7-0.9c-0.8,0-1.5,0.4-2.1,1.2l-26,32.5C0.2,34.4,0,35,0,35.6z' }) }));
787
+
788
+ function BoltFill(props) {
789
+ return (jsxRuntime.jsx("svg", { viewBox: '0 0 40.3 64', ...props, children: jsxRuntime.jsx("path", { d: 'M0,35.6c0,0.5,0.2,1,0.6,1.4C1,37.3,1.5,37.5,2,37.5h16.2L9.7,60.7c-0.4,1-0.3,1.8,0.1,2.4c0.4,0.6,1,0.9,1.7,0.9 c0.7,0,1.4-0.4,2.1-1.2l26-32.5c0.5-0.6,0.7-1.3,0.7-1.8c0-0.5-0.2-1-0.6-1.4c-0.4-0.4-0.9-0.6-1.5-0.6H22.1l8.6-23.2 c0.4-1,0.3-1.8-0.1-2.4c-0.4-0.6-1-0.9-1.7-0.9c-0.8,0-1.5,0.4-2.1,1.2l-26,32.5C0.2,34.4,0,35,0,35.6z' }) }));
1186
790
  }
1187
791
 
1188
792
  function BoltRingClosed(props) {
@@ -1565,31 +1169,2714 @@ function xmark(props) {
1565
1169
  return (jsxRuntime.jsx("svg", { viewBox: '0 0 64 64', ...props, children: jsxRuntime.jsx("path", { d: 'M1,63c0.7,0.7,1.6,1,2.6,1s1.9-0.3,2.6-1L32,37.1L57.8,63c0.7,0.7,1.5,1,2.5,1c1,0,1.9-0.3,2.6-1c0.7-0.7,1-1.6,1-2.6 c0-1-0.3-1.8-1-2.5L37.1,32L63,6.2c0.7-0.7,1-1.6,1-2.6S63.7,1.7,63,1c-0.7-0.7-1.6-1-2.6-1c-1,0-1.8,0.3-2.5,1L32,26.9L6.2,1 C5.5,0.3,4.6,0,3.6,0C2.6,0,1.7,0.3,1,1C0.3,1.7,0,2.6,0,3.6c0,1,0.3,1.9,1,2.6L26.9,32L1,57.8c-0.7,0.7-1,1.5-1,2.6 C0,61.4,0.3,62.3,1,63z' }) }));
1566
1170
  }
1567
1171
 
1568
- function ModalTrigger({ as, ...props }) {
1569
- const Element = as || react$1.Button;
1570
- return jsxRuntime.jsx(Element, { ...props });
1172
+ function DetailsSummary({ arrow = true, as, children, className, ...props }) {
1173
+ return (
1174
+ // @ts-expect-error Button has some extra props
1175
+ jsxRuntime.jsx(react.DisclosureButton, { ...props, as: as || (Button), className: twMerge('w-full', className, Boolean(arrow) && 'grid grid-cols-[1fr_1rem] gap-2'), role: 'summary', children: bag => (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [typeof children === 'function' ? children(bag) : children, arrow &&
1176
+ (typeof arrow === 'boolean' ? (jsxRuntime.jsx(ChevronDown, { className: 'absolute top-1/2 right-3 block w-4 -translate-y-1/2' })) : (arrow))] })) }));
1571
1177
  }
1572
- function ModalDialog(props) {
1573
- return jsxRuntime.jsx("div", { ...props });
1178
+ function DetailsBody({ children, className, ...props }) {
1179
+ return (jsxRuntime.jsx(react.DisclosurePanel, { ...props, className: twMerge('grid grid-rows-1fr transition-rows duration-500 ease-exponential data-closed:grid-rows-0fr', className), transition: true, children: bag => (jsxRuntime.jsx("div", { className: 'overflow-y-hidden px-2 pt-3 pb-1', children: typeof children === 'function' ? children(bag) : children })) }));
1574
1180
  }
1575
- function Modal({ children, className, onClose, onOpen, place = 'bottom' }) {
1576
- const [bodyElement, setBodyElement] = react.useState(null);
1577
- react.useEffect(() => {
1578
- if (!bodyElement && typeof window !== 'undefined')
1579
- setBodyElement(document.body);
1580
- }, [bodyElement]);
1581
- const [isOpen, setIsOpen] = react.useState(false);
1582
- const dialogPanelRef = react.useRef(null), dragMoveBoxRef = react.useRef(null),
1583
- // lastTouchYRef = useRef(0),
1584
- startDragCoords = react.useRef({ x: 0, y: 0 });
1585
- const [allowDragClose, setAllowDragClose] = react.useState(false), [readyToClose, setReadyToClose] = react.useState(false);
1586
- const openModal = () => {
1587
- console.log('open');
1588
- setIsOpen(true);
1589
- onOpen?.();
1181
+ function Details({ as = 'div', className, ...props }) {
1182
+ return (jsxRuntime.jsx(react.Disclosure, { ...props, as: as, className: twMerge('rounded-2xl bg-neutral-50/20 p-2 backdrop-blur-md backdrop-brightness-150', className), role: 'details' }));
1183
+ }
1184
+
1185
+ function DropDownButton({ arrow = true, as, children, className, ...props }) {
1186
+ return (jsxRuntime.jsxs(react.MenuButton, { ...props, as: as || 'button', className: tailwindMerge.twJoin('group/button', className), children: [children, arrow &&
1187
+ (typeof arrow === 'boolean' ? (jsxRuntime.jsx(ChevronDown, { className: '-top-px -mr-1 ml-2 w-4 animate-flip-again group-data-open/button:animate-flip' })) : (arrow))] }));
1188
+ }
1189
+ function DropDownItem({ as, ...props }) {
1190
+ return jsxRuntime.jsx(react.MenuItem, { as: as || 'div', ...props });
1191
+ }
1192
+ function DropDownItems({ anchor, children, className, style, ...props }) {
1193
+ const getAnchorProps = () => {
1194
+ let initialAnchor = { gap: '1rem', padding: '1rem', to: 'bottom start' };
1195
+ if (anchor) {
1196
+ if (typeof anchor === 'string')
1197
+ initialAnchor.to = anchor;
1198
+ if (typeof anchor === 'object')
1199
+ initialAnchor = { ...initialAnchor, ...anchor };
1200
+ }
1201
+ return initialAnchor;
1590
1202
  };
1591
- const closeModal = () => {
1592
- console.log('close');
1203
+ const anchorProps = getAnchorProps();
1204
+ return (jsxRuntime.jsx(react.MenuItems, { ...props, anchor: anchorProps, className: 'grid grid-rows-1fr rounded-xl shadow-xl transition-rows duration-500 ease-exponential data-closed:grid-rows-0fr', transition: true, style: { ...style, minWidth: 'var(--button-width)' }, children: bag => (jsxRuntime.jsx("div", { className: 'overflow-y-hidden', children: jsxRuntime.jsx("div", { className: twMerge('bg-neutral-50/20 px-6 py-5 backdrop-blur-md backdrop-brightness-150', className), children: typeof children === 'function' ? children(bag) : children }) })) }));
1205
+ }
1206
+ function DropDownSection({ children, label, labelProps, separatorAbove, separatorBelow, ...props }) {
1207
+ const { labelClassName, ...restLabelProps } = { labelClassName: labelProps?.className || '', ...labelProps };
1208
+ return (jsxRuntime.jsx(react.MenuSection, { ...props, children: sectionBag => (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [separatorAbove && jsxRuntime.jsx(DropDownSeparator, {}), jsxRuntime.jsx(react.MenuHeading, { ...restLabelProps, className: headingBag => twMerge('text-[size:larger] font-bold', typeof labelClassName === 'function' ? labelClassName(headingBag) : labelClassName), children: label }), typeof children === 'function' ? children(sectionBag) : children, separatorBelow && jsxRuntime.jsx(DropDownSeparator, {})] })) }));
1209
+ }
1210
+ function DropDownSeparator({ className, ...props }) {
1211
+ return (jsxRuntime.jsx(react.MenuSeparator, { ...props, className: bag => twMerge('my-4 block h-px rounded-full bg-neutral-950/20', typeof className === 'function' ? className(bag) : className) }));
1212
+ }
1213
+ function DropDown(props) {
1214
+ return jsxRuntime.jsx(react.Menu, { ...props });
1215
+ }
1216
+
1217
+ function createFastContext(defaultInitialState) {
1218
+ function useStoreData(initialState = defaultInitialState) {
1219
+ const store = React.useRef(initialState), get = () => store.current, subscribers = React.useRef(new Set());
1220
+ const set = (value) => {
1221
+ if (typeof value === 'function') {
1222
+ store.current = value(store.current);
1223
+ }
1224
+ else {
1225
+ store.current = value;
1226
+ }
1227
+ subscribers.current.forEach(callback => callback());
1228
+ };
1229
+ const subscribe = (callback) => {
1230
+ subscribers.current.add(callback);
1231
+ return () => subscribers.current.delete(callback);
1232
+ };
1233
+ return {
1234
+ get,
1235
+ set,
1236
+ subscribe,
1237
+ };
1238
+ }
1239
+ const StoreContext = React.createContext(null);
1240
+ function Provider({ initialValue = defaultInitialState, ...props }) {
1241
+ return jsxRuntime.jsx(StoreContext.Provider, { value: useStoreData(initialValue), ...props });
1242
+ }
1243
+ function useStore(selector, initialValue) {
1244
+ const store = React.useContext(StoreContext);
1245
+ if (!store) {
1246
+ const localStoreValue = initialValue !== undefined ? initialValue : defaultInitialState;
1247
+ const selectedValue = selector(localStoreValue);
1248
+ const noOpSet = () => console.warn('Attempting to set store value outside of Provider');
1249
+ return [selectedValue, noOpSet];
1250
+ }
1251
+ const state = React.useSyncExternalStore(store.subscribe, () => selector(store.get()), () => selector(initialValue !== undefined ? initialValue : defaultInitialState));
1252
+ return [state, store.set];
1253
+ }
1254
+ return {
1255
+ Provider,
1256
+ useStore,
1257
+ };
1258
+ }
1259
+
1260
+ /**
1261
+ * # Define Field
1262
+ *
1263
+ * This is a helper function to define a field in a form context with type safety.
1264
+ */
1265
+ function defineField(fieldDefinition) {
1266
+ return fieldDefinition;
1267
+ }
1268
+ const { Provider: Provider$1, useStore: useStore$1 } = createFastContext([]);
1269
+ function FormContextProvider({ children }) {
1270
+ return jsxRuntime.jsx(Provider$1, { children: children });
1271
+ }
1272
+ function useFormContext() {
1273
+ return useStore$1(store => store);
1274
+ }
1275
+
1276
+ const DEFAULT_STATUS = 'incomplete';
1277
+ const { Provider, useStore } = createFastContext(DEFAULT_STATUS);
1278
+ function FormStatusProvider({ children, initialStatus = DEFAULT_STATUS, }) {
1279
+ return (jsxRuntime.jsx(React.Suspense, { children: jsxRuntime.jsx(Provider, { initialValue: initialStatus, children: children }) }));
1280
+ }
1281
+ function useFormStatus() {
1282
+ return useStore(store => store);
1283
+ }
1284
+
1285
+ function Fieldset({ children, className, legend, legendProps, ...props }) {
1286
+ const { className: legendClassName, ...restLegendProps } = legendProps || {};
1287
+ return (jsxRuntime.jsx(react.Fieldset, { ...props, className: bag => twMerge('contents', typeof className === 'function' ? className(bag) : className), children: bag => (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(react.Legend, { ...restLegendProps, className: twMerge('text-lg font-bold sm:text-xl', typeof legendClassName === 'function' ? legendClassName(bag) : legendClassName), children: legend }), typeof children === 'function' ? children(bag) : children] })) }));
1288
+ }
1289
+
1290
+ /**
1291
+ * Custom positioning reference element.
1292
+ * @see https://floating-ui.com/docs/virtual-elements
1293
+ */
1294
+
1295
+ const min = Math.min;
1296
+ const max = Math.max;
1297
+ const round = Math.round;
1298
+ const floor = Math.floor;
1299
+ const createCoords = v => ({
1300
+ x: v,
1301
+ y: v
1302
+ });
1303
+ const oppositeSideMap = {
1304
+ left: 'right',
1305
+ right: 'left',
1306
+ bottom: 'top',
1307
+ top: 'bottom'
1308
+ };
1309
+ const oppositeAlignmentMap = {
1310
+ start: 'end',
1311
+ end: 'start'
1312
+ };
1313
+ function clamp(start, value, end) {
1314
+ return max(start, min(value, end));
1315
+ }
1316
+ function evaluate(value, param) {
1317
+ return typeof value === 'function' ? value(param) : value;
1318
+ }
1319
+ function getSide(placement) {
1320
+ return placement.split('-')[0];
1321
+ }
1322
+ function getAlignment(placement) {
1323
+ return placement.split('-')[1];
1324
+ }
1325
+ function getOppositeAxis(axis) {
1326
+ return axis === 'x' ? 'y' : 'x';
1327
+ }
1328
+ function getAxisLength(axis) {
1329
+ return axis === 'y' ? 'height' : 'width';
1330
+ }
1331
+ const yAxisSides = /*#__PURE__*/new Set(['top', 'bottom']);
1332
+ function getSideAxis(placement) {
1333
+ return yAxisSides.has(getSide(placement)) ? 'y' : 'x';
1334
+ }
1335
+ function getAlignmentAxis(placement) {
1336
+ return getOppositeAxis(getSideAxis(placement));
1337
+ }
1338
+ function getAlignmentSides(placement, rects, rtl) {
1339
+ if (rtl === void 0) {
1340
+ rtl = false;
1341
+ }
1342
+ const alignment = getAlignment(placement);
1343
+ const alignmentAxis = getAlignmentAxis(placement);
1344
+ const length = getAxisLength(alignmentAxis);
1345
+ let mainAlignmentSide = alignmentAxis === 'x' ? alignment === (rtl ? 'end' : 'start') ? 'right' : 'left' : alignment === 'start' ? 'bottom' : 'top';
1346
+ if (rects.reference[length] > rects.floating[length]) {
1347
+ mainAlignmentSide = getOppositePlacement(mainAlignmentSide);
1348
+ }
1349
+ return [mainAlignmentSide, getOppositePlacement(mainAlignmentSide)];
1350
+ }
1351
+ function getExpandedPlacements(placement) {
1352
+ const oppositePlacement = getOppositePlacement(placement);
1353
+ return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)];
1354
+ }
1355
+ function getOppositeAlignmentPlacement(placement) {
1356
+ return placement.replace(/start|end/g, alignment => oppositeAlignmentMap[alignment]);
1357
+ }
1358
+ const lrPlacement = ['left', 'right'];
1359
+ const rlPlacement = ['right', 'left'];
1360
+ const tbPlacement = ['top', 'bottom'];
1361
+ const btPlacement = ['bottom', 'top'];
1362
+ function getSideList(side, isStart, rtl) {
1363
+ switch (side) {
1364
+ case 'top':
1365
+ case 'bottom':
1366
+ if (rtl) return isStart ? rlPlacement : lrPlacement;
1367
+ return isStart ? lrPlacement : rlPlacement;
1368
+ case 'left':
1369
+ case 'right':
1370
+ return isStart ? tbPlacement : btPlacement;
1371
+ default:
1372
+ return [];
1373
+ }
1374
+ }
1375
+ function getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) {
1376
+ const alignment = getAlignment(placement);
1377
+ let list = getSideList(getSide(placement), direction === 'start', rtl);
1378
+ if (alignment) {
1379
+ list = list.map(side => side + "-" + alignment);
1380
+ if (flipAlignment) {
1381
+ list = list.concat(list.map(getOppositeAlignmentPlacement));
1382
+ }
1383
+ }
1384
+ return list;
1385
+ }
1386
+ function getOppositePlacement(placement) {
1387
+ return placement.replace(/left|right|bottom|top/g, side => oppositeSideMap[side]);
1388
+ }
1389
+ function expandPaddingObject(padding) {
1390
+ return {
1391
+ top: 0,
1392
+ right: 0,
1393
+ bottom: 0,
1394
+ left: 0,
1395
+ ...padding
1396
+ };
1397
+ }
1398
+ function getPaddingObject(padding) {
1399
+ return typeof padding !== 'number' ? expandPaddingObject(padding) : {
1400
+ top: padding,
1401
+ right: padding,
1402
+ bottom: padding,
1403
+ left: padding
1404
+ };
1405
+ }
1406
+ function rectToClientRect(rect) {
1407
+ const {
1408
+ x,
1409
+ y,
1410
+ width,
1411
+ height
1412
+ } = rect;
1413
+ return {
1414
+ width,
1415
+ height,
1416
+ top: y,
1417
+ left: x,
1418
+ right: x + width,
1419
+ bottom: y + height,
1420
+ x,
1421
+ y
1422
+ };
1423
+ }
1424
+
1425
+ function computeCoordsFromPlacement(_ref, placement, rtl) {
1426
+ let {
1427
+ reference,
1428
+ floating
1429
+ } = _ref;
1430
+ const sideAxis = getSideAxis(placement);
1431
+ const alignmentAxis = getAlignmentAxis(placement);
1432
+ const alignLength = getAxisLength(alignmentAxis);
1433
+ const side = getSide(placement);
1434
+ const isVertical = sideAxis === 'y';
1435
+ const commonX = reference.x + reference.width / 2 - floating.width / 2;
1436
+ const commonY = reference.y + reference.height / 2 - floating.height / 2;
1437
+ const commonAlign = reference[alignLength] / 2 - floating[alignLength] / 2;
1438
+ let coords;
1439
+ switch (side) {
1440
+ case 'top':
1441
+ coords = {
1442
+ x: commonX,
1443
+ y: reference.y - floating.height
1444
+ };
1445
+ break;
1446
+ case 'bottom':
1447
+ coords = {
1448
+ x: commonX,
1449
+ y: reference.y + reference.height
1450
+ };
1451
+ break;
1452
+ case 'right':
1453
+ coords = {
1454
+ x: reference.x + reference.width,
1455
+ y: commonY
1456
+ };
1457
+ break;
1458
+ case 'left':
1459
+ coords = {
1460
+ x: reference.x - floating.width,
1461
+ y: commonY
1462
+ };
1463
+ break;
1464
+ default:
1465
+ coords = {
1466
+ x: reference.x,
1467
+ y: reference.y
1468
+ };
1469
+ }
1470
+ switch (getAlignment(placement)) {
1471
+ case 'start':
1472
+ coords[alignmentAxis] -= commonAlign * (rtl && isVertical ? -1 : 1);
1473
+ break;
1474
+ case 'end':
1475
+ coords[alignmentAxis] += commonAlign * (rtl && isVertical ? -1 : 1);
1476
+ break;
1477
+ }
1478
+ return coords;
1479
+ }
1480
+
1481
+ /**
1482
+ * Computes the `x` and `y` coordinates that will place the floating element
1483
+ * next to a given reference element.
1484
+ *
1485
+ * This export does not have any `platform` interface logic. You will need to
1486
+ * write one for the platform you are using Floating UI with.
1487
+ */
1488
+ const computePosition$1 = async (reference, floating, config) => {
1489
+ const {
1490
+ placement = 'bottom',
1491
+ strategy = 'absolute',
1492
+ middleware = [],
1493
+ platform
1494
+ } = config;
1495
+ const validMiddleware = middleware.filter(Boolean);
1496
+ const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(floating));
1497
+ let rects = await platform.getElementRects({
1498
+ reference,
1499
+ floating,
1500
+ strategy
1501
+ });
1502
+ let {
1503
+ x,
1504
+ y
1505
+ } = computeCoordsFromPlacement(rects, placement, rtl);
1506
+ let statefulPlacement = placement;
1507
+ let middlewareData = {};
1508
+ let resetCount = 0;
1509
+ for (let i = 0; i < validMiddleware.length; i++) {
1510
+ const {
1511
+ name,
1512
+ fn
1513
+ } = validMiddleware[i];
1514
+ const {
1515
+ x: nextX,
1516
+ y: nextY,
1517
+ data,
1518
+ reset
1519
+ } = await fn({
1520
+ x,
1521
+ y,
1522
+ initialPlacement: placement,
1523
+ placement: statefulPlacement,
1524
+ strategy,
1525
+ middlewareData,
1526
+ rects,
1527
+ platform,
1528
+ elements: {
1529
+ reference,
1530
+ floating
1531
+ }
1532
+ });
1533
+ x = nextX != null ? nextX : x;
1534
+ y = nextY != null ? nextY : y;
1535
+ middlewareData = {
1536
+ ...middlewareData,
1537
+ [name]: {
1538
+ ...middlewareData[name],
1539
+ ...data
1540
+ }
1541
+ };
1542
+ if (reset && resetCount <= 50) {
1543
+ resetCount++;
1544
+ if (typeof reset === 'object') {
1545
+ if (reset.placement) {
1546
+ statefulPlacement = reset.placement;
1547
+ }
1548
+ if (reset.rects) {
1549
+ rects = reset.rects === true ? await platform.getElementRects({
1550
+ reference,
1551
+ floating,
1552
+ strategy
1553
+ }) : reset.rects;
1554
+ }
1555
+ ({
1556
+ x,
1557
+ y
1558
+ } = computeCoordsFromPlacement(rects, statefulPlacement, rtl));
1559
+ }
1560
+ i = -1;
1561
+ }
1562
+ }
1563
+ return {
1564
+ x,
1565
+ y,
1566
+ placement: statefulPlacement,
1567
+ strategy,
1568
+ middlewareData
1569
+ };
1570
+ };
1571
+
1572
+ /**
1573
+ * Resolves with an object of overflow side offsets that determine how much the
1574
+ * element is overflowing a given clipping boundary on each side.
1575
+ * - positive = overflowing the boundary by that number of pixels
1576
+ * - negative = how many pixels left before it will overflow
1577
+ * - 0 = lies flush with the boundary
1578
+ * @see https://floating-ui.com/docs/detectOverflow
1579
+ */
1580
+ async function detectOverflow(state, options) {
1581
+ var _await$platform$isEle;
1582
+ if (options === void 0) {
1583
+ options = {};
1584
+ }
1585
+ const {
1586
+ x,
1587
+ y,
1588
+ platform,
1589
+ rects,
1590
+ elements,
1591
+ strategy
1592
+ } = state;
1593
+ const {
1594
+ boundary = 'clippingAncestors',
1595
+ rootBoundary = 'viewport',
1596
+ elementContext = 'floating',
1597
+ altBoundary = false,
1598
+ padding = 0
1599
+ } = evaluate(options, state);
1600
+ const paddingObject = getPaddingObject(padding);
1601
+ const altContext = elementContext === 'floating' ? 'reference' : 'floating';
1602
+ const element = elements[altBoundary ? altContext : elementContext];
1603
+ const clippingClientRect = rectToClientRect(await platform.getClippingRect({
1604
+ element: ((_await$platform$isEle = await (platform.isElement == null ? void 0 : platform.isElement(element))) != null ? _await$platform$isEle : true) ? element : element.contextElement || (await (platform.getDocumentElement == null ? void 0 : platform.getDocumentElement(elements.floating))),
1605
+ boundary,
1606
+ rootBoundary,
1607
+ strategy
1608
+ }));
1609
+ const rect = elementContext === 'floating' ? {
1610
+ x,
1611
+ y,
1612
+ width: rects.floating.width,
1613
+ height: rects.floating.height
1614
+ } : rects.reference;
1615
+ const offsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(elements.floating));
1616
+ const offsetScale = (await (platform.isElement == null ? void 0 : platform.isElement(offsetParent))) ? (await (platform.getScale == null ? void 0 : platform.getScale(offsetParent))) || {
1617
+ x: 1,
1618
+ y: 1
1619
+ } : {
1620
+ x: 1,
1621
+ y: 1
1622
+ };
1623
+ const elementClientRect = rectToClientRect(platform.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform.convertOffsetParentRelativeRectToViewportRelativeRect({
1624
+ elements,
1625
+ rect,
1626
+ offsetParent,
1627
+ strategy
1628
+ }) : rect);
1629
+ return {
1630
+ top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y,
1631
+ bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y,
1632
+ left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x,
1633
+ right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x
1634
+ };
1635
+ }
1636
+
1637
+ /**
1638
+ * Provides data to position an inner element of the floating element so that it
1639
+ * appears centered to the reference element.
1640
+ * @see https://floating-ui.com/docs/arrow
1641
+ */
1642
+ const arrow$3 = options => ({
1643
+ name: 'arrow',
1644
+ options,
1645
+ async fn(state) {
1646
+ const {
1647
+ x,
1648
+ y,
1649
+ placement,
1650
+ rects,
1651
+ platform,
1652
+ elements,
1653
+ middlewareData
1654
+ } = state;
1655
+ // Since `element` is required, we don't Partial<> the type.
1656
+ const {
1657
+ element,
1658
+ padding = 0
1659
+ } = evaluate(options, state) || {};
1660
+ if (element == null) {
1661
+ return {};
1662
+ }
1663
+ const paddingObject = getPaddingObject(padding);
1664
+ const coords = {
1665
+ x,
1666
+ y
1667
+ };
1668
+ const axis = getAlignmentAxis(placement);
1669
+ const length = getAxisLength(axis);
1670
+ const arrowDimensions = await platform.getDimensions(element);
1671
+ const isYAxis = axis === 'y';
1672
+ const minProp = isYAxis ? 'top' : 'left';
1673
+ const maxProp = isYAxis ? 'bottom' : 'right';
1674
+ const clientProp = isYAxis ? 'clientHeight' : 'clientWidth';
1675
+ const endDiff = rects.reference[length] + rects.reference[axis] - coords[axis] - rects.floating[length];
1676
+ const startDiff = coords[axis] - rects.reference[axis];
1677
+ const arrowOffsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(element));
1678
+ let clientSize = arrowOffsetParent ? arrowOffsetParent[clientProp] : 0;
1679
+
1680
+ // DOM platform can return `window` as the `offsetParent`.
1681
+ if (!clientSize || !(await (platform.isElement == null ? void 0 : platform.isElement(arrowOffsetParent)))) {
1682
+ clientSize = elements.floating[clientProp] || rects.floating[length];
1683
+ }
1684
+ const centerToReference = endDiff / 2 - startDiff / 2;
1685
+
1686
+ // If the padding is large enough that it causes the arrow to no longer be
1687
+ // centered, modify the padding so that it is centered.
1688
+ const largestPossiblePadding = clientSize / 2 - arrowDimensions[length] / 2 - 1;
1689
+ const minPadding = min(paddingObject[minProp], largestPossiblePadding);
1690
+ const maxPadding = min(paddingObject[maxProp], largestPossiblePadding);
1691
+
1692
+ // Make sure the arrow doesn't overflow the floating element if the center
1693
+ // point is outside the floating element's bounds.
1694
+ const min$1 = minPadding;
1695
+ const max = clientSize - arrowDimensions[length] - maxPadding;
1696
+ const center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference;
1697
+ const offset = clamp(min$1, center, max);
1698
+
1699
+ // If the reference is small enough that the arrow's padding causes it to
1700
+ // to point to nothing for an aligned placement, adjust the offset of the
1701
+ // floating element itself. To ensure `shift()` continues to take action,
1702
+ // a single reset is performed when this is true.
1703
+ const shouldAddOffset = !middlewareData.arrow && getAlignment(placement) != null && center !== offset && rects.reference[length] / 2 - (center < min$1 ? minPadding : maxPadding) - arrowDimensions[length] / 2 < 0;
1704
+ const alignmentOffset = shouldAddOffset ? center < min$1 ? center - min$1 : center - max : 0;
1705
+ return {
1706
+ [axis]: coords[axis] + alignmentOffset,
1707
+ data: {
1708
+ [axis]: offset,
1709
+ centerOffset: center - offset - alignmentOffset,
1710
+ ...(shouldAddOffset && {
1711
+ alignmentOffset
1712
+ })
1713
+ },
1714
+ reset: shouldAddOffset
1715
+ };
1716
+ }
1717
+ });
1718
+
1719
+ /**
1720
+ * Optimizes the visibility of the floating element by flipping the `placement`
1721
+ * in order to keep it in view when the preferred placement(s) will overflow the
1722
+ * clipping boundary. Alternative to `autoPlacement`.
1723
+ * @see https://floating-ui.com/docs/flip
1724
+ */
1725
+ const flip$2 = function (options) {
1726
+ if (options === void 0) {
1727
+ options = {};
1728
+ }
1729
+ return {
1730
+ name: 'flip',
1731
+ options,
1732
+ async fn(state) {
1733
+ var _middlewareData$arrow, _middlewareData$flip;
1734
+ const {
1735
+ placement,
1736
+ middlewareData,
1737
+ rects,
1738
+ initialPlacement,
1739
+ platform,
1740
+ elements
1741
+ } = state;
1742
+ const {
1743
+ mainAxis: checkMainAxis = true,
1744
+ crossAxis: checkCrossAxis = true,
1745
+ fallbackPlacements: specifiedFallbackPlacements,
1746
+ fallbackStrategy = 'bestFit',
1747
+ fallbackAxisSideDirection = 'none',
1748
+ flipAlignment = true,
1749
+ ...detectOverflowOptions
1750
+ } = evaluate(options, state);
1751
+
1752
+ // If a reset by the arrow was caused due to an alignment offset being
1753
+ // added, we should skip any logic now since `flip()` has already done its
1754
+ // work.
1755
+ // https://github.com/floating-ui/floating-ui/issues/2549#issuecomment-1719601643
1756
+ if ((_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {
1757
+ return {};
1758
+ }
1759
+ const side = getSide(placement);
1760
+ const initialSideAxis = getSideAxis(initialPlacement);
1761
+ const isBasePlacement = getSide(initialPlacement) === initialPlacement;
1762
+ const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));
1763
+ const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement));
1764
+ const hasFallbackAxisSideDirection = fallbackAxisSideDirection !== 'none';
1765
+ if (!specifiedFallbackPlacements && hasFallbackAxisSideDirection) {
1766
+ fallbackPlacements.push(...getOppositeAxisPlacements(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl));
1767
+ }
1768
+ const placements = [initialPlacement, ...fallbackPlacements];
1769
+ const overflow = await detectOverflow(state, detectOverflowOptions);
1770
+ const overflows = [];
1771
+ let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || [];
1772
+ if (checkMainAxis) {
1773
+ overflows.push(overflow[side]);
1774
+ }
1775
+ if (checkCrossAxis) {
1776
+ const sides = getAlignmentSides(placement, rects, rtl);
1777
+ overflows.push(overflow[sides[0]], overflow[sides[1]]);
1778
+ }
1779
+ overflowsData = [...overflowsData, {
1780
+ placement,
1781
+ overflows
1782
+ }];
1783
+
1784
+ // One or more sides is overflowing.
1785
+ if (!overflows.every(side => side <= 0)) {
1786
+ var _middlewareData$flip2, _overflowsData$filter;
1787
+ const nextIndex = (((_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) || 0) + 1;
1788
+ const nextPlacement = placements[nextIndex];
1789
+ if (nextPlacement) {
1790
+ const ignoreCrossAxisOverflow = checkCrossAxis === 'alignment' ? initialSideAxis !== getSideAxis(nextPlacement) : false;
1791
+ if (!ignoreCrossAxisOverflow ||
1792
+ // We leave the current main axis only if every placement on that axis
1793
+ // overflows the main axis.
1794
+ overflowsData.every(d => d.overflows[0] > 0 && getSideAxis(d.placement) === initialSideAxis)) {
1795
+ // Try next placement and re-run the lifecycle.
1796
+ return {
1797
+ data: {
1798
+ index: nextIndex,
1799
+ overflows: overflowsData
1800
+ },
1801
+ reset: {
1802
+ placement: nextPlacement
1803
+ }
1804
+ };
1805
+ }
1806
+ }
1807
+
1808
+ // First, find the candidates that fit on the mainAxis side of overflow,
1809
+ // then find the placement that fits the best on the main crossAxis side.
1810
+ let resetPlacement = (_overflowsData$filter = overflowsData.filter(d => d.overflows[0] <= 0).sort((a, b) => a.overflows[1] - b.overflows[1])[0]) == null ? void 0 : _overflowsData$filter.placement;
1811
+
1812
+ // Otherwise fallback.
1813
+ if (!resetPlacement) {
1814
+ switch (fallbackStrategy) {
1815
+ case 'bestFit':
1816
+ {
1817
+ var _overflowsData$filter2;
1818
+ const placement = (_overflowsData$filter2 = overflowsData.filter(d => {
1819
+ if (hasFallbackAxisSideDirection) {
1820
+ const currentSideAxis = getSideAxis(d.placement);
1821
+ return currentSideAxis === initialSideAxis ||
1822
+ // Create a bias to the `y` side axis due to horizontal
1823
+ // reading directions favoring greater width.
1824
+ currentSideAxis === 'y';
1825
+ }
1826
+ return true;
1827
+ }).map(d => [d.placement, d.overflows.filter(overflow => overflow > 0).reduce((acc, overflow) => acc + overflow, 0)]).sort((a, b) => a[1] - b[1])[0]) == null ? void 0 : _overflowsData$filter2[0];
1828
+ if (placement) {
1829
+ resetPlacement = placement;
1830
+ }
1831
+ break;
1832
+ }
1833
+ case 'initialPlacement':
1834
+ resetPlacement = initialPlacement;
1835
+ break;
1836
+ }
1837
+ }
1838
+ if (placement !== resetPlacement) {
1839
+ return {
1840
+ reset: {
1841
+ placement: resetPlacement
1842
+ }
1843
+ };
1844
+ }
1845
+ }
1846
+ return {};
1847
+ }
1848
+ };
1849
+ };
1850
+
1851
+ const originSides = /*#__PURE__*/new Set(['left', 'top']);
1852
+
1853
+ // For type backwards-compatibility, the `OffsetOptions` type was also
1854
+ // Derivable.
1855
+
1856
+ async function convertValueToCoords(state, options) {
1857
+ const {
1858
+ placement,
1859
+ platform,
1860
+ elements
1861
+ } = state;
1862
+ const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));
1863
+ const side = getSide(placement);
1864
+ const alignment = getAlignment(placement);
1865
+ const isVertical = getSideAxis(placement) === 'y';
1866
+ const mainAxisMulti = originSides.has(side) ? -1 : 1;
1867
+ const crossAxisMulti = rtl && isVertical ? -1 : 1;
1868
+ const rawValue = evaluate(options, state);
1869
+
1870
+ // eslint-disable-next-line prefer-const
1871
+ let {
1872
+ mainAxis,
1873
+ crossAxis,
1874
+ alignmentAxis
1875
+ } = typeof rawValue === 'number' ? {
1876
+ mainAxis: rawValue,
1877
+ crossAxis: 0,
1878
+ alignmentAxis: null
1879
+ } : {
1880
+ mainAxis: rawValue.mainAxis || 0,
1881
+ crossAxis: rawValue.crossAxis || 0,
1882
+ alignmentAxis: rawValue.alignmentAxis
1883
+ };
1884
+ if (alignment && typeof alignmentAxis === 'number') {
1885
+ crossAxis = alignment === 'end' ? alignmentAxis * -1 : alignmentAxis;
1886
+ }
1887
+ return isVertical ? {
1888
+ x: crossAxis * crossAxisMulti,
1889
+ y: mainAxis * mainAxisMulti
1890
+ } : {
1891
+ x: mainAxis * mainAxisMulti,
1892
+ y: crossAxis * crossAxisMulti
1893
+ };
1894
+ }
1895
+
1896
+ /**
1897
+ * Modifies the placement by translating the floating element along the
1898
+ * specified axes.
1899
+ * A number (shorthand for `mainAxis` or distance), or an axes configuration
1900
+ * object may be passed.
1901
+ * @see https://floating-ui.com/docs/offset
1902
+ */
1903
+ const offset$2 = function (options) {
1904
+ if (options === void 0) {
1905
+ options = 0;
1906
+ }
1907
+ return {
1908
+ name: 'offset',
1909
+ options,
1910
+ async fn(state) {
1911
+ var _middlewareData$offse, _middlewareData$arrow;
1912
+ const {
1913
+ x,
1914
+ y,
1915
+ placement,
1916
+ middlewareData
1917
+ } = state;
1918
+ const diffCoords = await convertValueToCoords(state, options);
1919
+
1920
+ // If the placement is the same and the arrow caused an alignment offset
1921
+ // then we don't need to change the positioning coordinates.
1922
+ if (placement === ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse.placement) && (_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {
1923
+ return {};
1924
+ }
1925
+ return {
1926
+ x: x + diffCoords.x,
1927
+ y: y + diffCoords.y,
1928
+ data: {
1929
+ ...diffCoords,
1930
+ placement
1931
+ }
1932
+ };
1933
+ }
1934
+ };
1935
+ };
1936
+
1937
+ /**
1938
+ * Optimizes the visibility of the floating element by shifting it in order to
1939
+ * keep it in view when it will overflow the clipping boundary.
1940
+ * @see https://floating-ui.com/docs/shift
1941
+ */
1942
+ const shift$2 = function (options) {
1943
+ if (options === void 0) {
1944
+ options = {};
1945
+ }
1946
+ return {
1947
+ name: 'shift',
1948
+ options,
1949
+ async fn(state) {
1950
+ const {
1951
+ x,
1952
+ y,
1953
+ placement
1954
+ } = state;
1955
+ const {
1956
+ mainAxis: checkMainAxis = true,
1957
+ crossAxis: checkCrossAxis = false,
1958
+ limiter = {
1959
+ fn: _ref => {
1960
+ let {
1961
+ x,
1962
+ y
1963
+ } = _ref;
1964
+ return {
1965
+ x,
1966
+ y
1967
+ };
1968
+ }
1969
+ },
1970
+ ...detectOverflowOptions
1971
+ } = evaluate(options, state);
1972
+ const coords = {
1973
+ x,
1974
+ y
1975
+ };
1976
+ const overflow = await detectOverflow(state, detectOverflowOptions);
1977
+ const crossAxis = getSideAxis(getSide(placement));
1978
+ const mainAxis = getOppositeAxis(crossAxis);
1979
+ let mainAxisCoord = coords[mainAxis];
1980
+ let crossAxisCoord = coords[crossAxis];
1981
+ if (checkMainAxis) {
1982
+ const minSide = mainAxis === 'y' ? 'top' : 'left';
1983
+ const maxSide = mainAxis === 'y' ? 'bottom' : 'right';
1984
+ const min = mainAxisCoord + overflow[minSide];
1985
+ const max = mainAxisCoord - overflow[maxSide];
1986
+ mainAxisCoord = clamp(min, mainAxisCoord, max);
1987
+ }
1988
+ if (checkCrossAxis) {
1989
+ const minSide = crossAxis === 'y' ? 'top' : 'left';
1990
+ const maxSide = crossAxis === 'y' ? 'bottom' : 'right';
1991
+ const min = crossAxisCoord + overflow[minSide];
1992
+ const max = crossAxisCoord - overflow[maxSide];
1993
+ crossAxisCoord = clamp(min, crossAxisCoord, max);
1994
+ }
1995
+ const limitedCoords = limiter.fn({
1996
+ ...state,
1997
+ [mainAxis]: mainAxisCoord,
1998
+ [crossAxis]: crossAxisCoord
1999
+ });
2000
+ return {
2001
+ ...limitedCoords,
2002
+ data: {
2003
+ x: limitedCoords.x - x,
2004
+ y: limitedCoords.y - y,
2005
+ enabled: {
2006
+ [mainAxis]: checkMainAxis,
2007
+ [crossAxis]: checkCrossAxis
2008
+ }
2009
+ }
2010
+ };
2011
+ }
2012
+ };
2013
+ };
2014
+
2015
+ /**
2016
+ * Provides data that allows you to change the size of the floating element —
2017
+ * for instance, prevent it from overflowing the clipping boundary or match the
2018
+ * width of the reference element.
2019
+ * @see https://floating-ui.com/docs/size
2020
+ */
2021
+ const size$2 = function (options) {
2022
+ if (options === void 0) {
2023
+ options = {};
2024
+ }
2025
+ return {
2026
+ name: 'size',
2027
+ options,
2028
+ async fn(state) {
2029
+ var _state$middlewareData, _state$middlewareData2;
2030
+ const {
2031
+ placement,
2032
+ rects,
2033
+ platform,
2034
+ elements
2035
+ } = state;
2036
+ const {
2037
+ apply = () => {},
2038
+ ...detectOverflowOptions
2039
+ } = evaluate(options, state);
2040
+ const overflow = await detectOverflow(state, detectOverflowOptions);
2041
+ const side = getSide(placement);
2042
+ const alignment = getAlignment(placement);
2043
+ const isYAxis = getSideAxis(placement) === 'y';
2044
+ const {
2045
+ width,
2046
+ height
2047
+ } = rects.floating;
2048
+ let heightSide;
2049
+ let widthSide;
2050
+ if (side === 'top' || side === 'bottom') {
2051
+ heightSide = side;
2052
+ widthSide = alignment === ((await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating))) ? 'start' : 'end') ? 'left' : 'right';
2053
+ } else {
2054
+ widthSide = side;
2055
+ heightSide = alignment === 'end' ? 'top' : 'bottom';
2056
+ }
2057
+ const maximumClippingHeight = height - overflow.top - overflow.bottom;
2058
+ const maximumClippingWidth = width - overflow.left - overflow.right;
2059
+ const overflowAvailableHeight = min(height - overflow[heightSide], maximumClippingHeight);
2060
+ const overflowAvailableWidth = min(width - overflow[widthSide], maximumClippingWidth);
2061
+ const noShift = !state.middlewareData.shift;
2062
+ let availableHeight = overflowAvailableHeight;
2063
+ let availableWidth = overflowAvailableWidth;
2064
+ if ((_state$middlewareData = state.middlewareData.shift) != null && _state$middlewareData.enabled.x) {
2065
+ availableWidth = maximumClippingWidth;
2066
+ }
2067
+ if ((_state$middlewareData2 = state.middlewareData.shift) != null && _state$middlewareData2.enabled.y) {
2068
+ availableHeight = maximumClippingHeight;
2069
+ }
2070
+ if (noShift && !alignment) {
2071
+ const xMin = max(overflow.left, 0);
2072
+ const xMax = max(overflow.right, 0);
2073
+ const yMin = max(overflow.top, 0);
2074
+ const yMax = max(overflow.bottom, 0);
2075
+ if (isYAxis) {
2076
+ availableWidth = width - 2 * (xMin !== 0 || xMax !== 0 ? xMin + xMax : max(overflow.left, overflow.right));
2077
+ } else {
2078
+ availableHeight = height - 2 * (yMin !== 0 || yMax !== 0 ? yMin + yMax : max(overflow.top, overflow.bottom));
2079
+ }
2080
+ }
2081
+ await apply({
2082
+ ...state,
2083
+ availableWidth,
2084
+ availableHeight
2085
+ });
2086
+ const nextDimensions = await platform.getDimensions(elements.floating);
2087
+ if (width !== nextDimensions.width || height !== nextDimensions.height) {
2088
+ return {
2089
+ reset: {
2090
+ rects: true
2091
+ }
2092
+ };
2093
+ }
2094
+ return {};
2095
+ }
2096
+ };
2097
+ };
2098
+
2099
+ function hasWindow() {
2100
+ return typeof window !== 'undefined';
2101
+ }
2102
+ function getNodeName(node) {
2103
+ if (isNode(node)) {
2104
+ return (node.nodeName || '').toLowerCase();
2105
+ }
2106
+ // Mocked nodes in testing environments may not be instances of Node. By
2107
+ // returning `#document` an infinite loop won't occur.
2108
+ // https://github.com/floating-ui/floating-ui/issues/2317
2109
+ return '#document';
2110
+ }
2111
+ function getWindow(node) {
2112
+ var _node$ownerDocument;
2113
+ return (node == null || (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window;
2114
+ }
2115
+ function getDocumentElement(node) {
2116
+ var _ref;
2117
+ return (_ref = (isNode(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement;
2118
+ }
2119
+ function isNode(value) {
2120
+ if (!hasWindow()) {
2121
+ return false;
2122
+ }
2123
+ return value instanceof Node || value instanceof getWindow(value).Node;
2124
+ }
2125
+ function isElement(value) {
2126
+ if (!hasWindow()) {
2127
+ return false;
2128
+ }
2129
+ return value instanceof Element || value instanceof getWindow(value).Element;
2130
+ }
2131
+ function isHTMLElement(value) {
2132
+ if (!hasWindow()) {
2133
+ return false;
2134
+ }
2135
+ return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement;
2136
+ }
2137
+ function isShadowRoot(value) {
2138
+ if (!hasWindow() || typeof ShadowRoot === 'undefined') {
2139
+ return false;
2140
+ }
2141
+ return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot;
2142
+ }
2143
+ const invalidOverflowDisplayValues = /*#__PURE__*/new Set(['inline', 'contents']);
2144
+ function isOverflowElement(element) {
2145
+ const {
2146
+ overflow,
2147
+ overflowX,
2148
+ overflowY,
2149
+ display
2150
+ } = getComputedStyle(element);
2151
+ return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && !invalidOverflowDisplayValues.has(display);
2152
+ }
2153
+ const tableElements = /*#__PURE__*/new Set(['table', 'td', 'th']);
2154
+ function isTableElement(element) {
2155
+ return tableElements.has(getNodeName(element));
2156
+ }
2157
+ const topLayerSelectors = [':popover-open', ':modal'];
2158
+ function isTopLayer(element) {
2159
+ return topLayerSelectors.some(selector => {
2160
+ try {
2161
+ return element.matches(selector);
2162
+ } catch (_e) {
2163
+ return false;
2164
+ }
2165
+ });
2166
+ }
2167
+ const transformProperties = ['transform', 'translate', 'scale', 'rotate', 'perspective'];
2168
+ const willChangeValues = ['transform', 'translate', 'scale', 'rotate', 'perspective', 'filter'];
2169
+ const containValues = ['paint', 'layout', 'strict', 'content'];
2170
+ function isContainingBlock(elementOrCss) {
2171
+ const webkit = isWebKit();
2172
+ const css = isElement(elementOrCss) ? getComputedStyle(elementOrCss) : elementOrCss;
2173
+
2174
+ // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
2175
+ // https://drafts.csswg.org/css-transforms-2/#individual-transforms
2176
+ return transformProperties.some(value => css[value] ? css[value] !== 'none' : false) || (css.containerType ? css.containerType !== 'normal' : false) || !webkit && (css.backdropFilter ? css.backdropFilter !== 'none' : false) || !webkit && (css.filter ? css.filter !== 'none' : false) || willChangeValues.some(value => (css.willChange || '').includes(value)) || containValues.some(value => (css.contain || '').includes(value));
2177
+ }
2178
+ function getContainingBlock(element) {
2179
+ let currentNode = getParentNode(element);
2180
+ while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) {
2181
+ if (isContainingBlock(currentNode)) {
2182
+ return currentNode;
2183
+ } else if (isTopLayer(currentNode)) {
2184
+ return null;
2185
+ }
2186
+ currentNode = getParentNode(currentNode);
2187
+ }
2188
+ return null;
2189
+ }
2190
+ function isWebKit() {
2191
+ if (typeof CSS === 'undefined' || !CSS.supports) return false;
2192
+ return CSS.supports('-webkit-backdrop-filter', 'none');
2193
+ }
2194
+ const lastTraversableNodeNames = /*#__PURE__*/new Set(['html', 'body', '#document']);
2195
+ function isLastTraversableNode(node) {
2196
+ return lastTraversableNodeNames.has(getNodeName(node));
2197
+ }
2198
+ function getComputedStyle(element) {
2199
+ return getWindow(element).getComputedStyle(element);
2200
+ }
2201
+ function getNodeScroll(element) {
2202
+ if (isElement(element)) {
2203
+ return {
2204
+ scrollLeft: element.scrollLeft,
2205
+ scrollTop: element.scrollTop
2206
+ };
2207
+ }
2208
+ return {
2209
+ scrollLeft: element.scrollX,
2210
+ scrollTop: element.scrollY
2211
+ };
2212
+ }
2213
+ function getParentNode(node) {
2214
+ if (getNodeName(node) === 'html') {
2215
+ return node;
2216
+ }
2217
+ const result =
2218
+ // Step into the shadow DOM of the parent of a slotted node.
2219
+ node.assignedSlot ||
2220
+ // DOM Element detected.
2221
+ node.parentNode ||
2222
+ // ShadowRoot detected.
2223
+ isShadowRoot(node) && node.host ||
2224
+ // Fallback.
2225
+ getDocumentElement(node);
2226
+ return isShadowRoot(result) ? result.host : result;
2227
+ }
2228
+ function getNearestOverflowAncestor(node) {
2229
+ const parentNode = getParentNode(node);
2230
+ if (isLastTraversableNode(parentNode)) {
2231
+ return node.ownerDocument ? node.ownerDocument.body : node.body;
2232
+ }
2233
+ if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) {
2234
+ return parentNode;
2235
+ }
2236
+ return getNearestOverflowAncestor(parentNode);
2237
+ }
2238
+ function getOverflowAncestors(node, list, traverseIframes) {
2239
+ var _node$ownerDocument2;
2240
+ if (list === void 0) {
2241
+ list = [];
2242
+ }
2243
+ if (traverseIframes === void 0) {
2244
+ traverseIframes = true;
2245
+ }
2246
+ const scrollableAncestor = getNearestOverflowAncestor(node);
2247
+ const isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? void 0 : _node$ownerDocument2.body);
2248
+ const win = getWindow(scrollableAncestor);
2249
+ if (isBody) {
2250
+ const frameElement = getFrameElement(win);
2251
+ return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], frameElement && traverseIframes ? getOverflowAncestors(frameElement) : []);
2252
+ }
2253
+ return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes));
2254
+ }
2255
+ function getFrameElement(win) {
2256
+ return win.parent && Object.getPrototypeOf(win.parent) ? win.frameElement : null;
2257
+ }
2258
+
2259
+ function getCssDimensions(element) {
2260
+ const css = getComputedStyle(element);
2261
+ // In testing environments, the `width` and `height` properties are empty
2262
+ // strings for SVG elements, returning NaN. Fallback to `0` in this case.
2263
+ let width = parseFloat(css.width) || 0;
2264
+ let height = parseFloat(css.height) || 0;
2265
+ const hasOffset = isHTMLElement(element);
2266
+ const offsetWidth = hasOffset ? element.offsetWidth : width;
2267
+ const offsetHeight = hasOffset ? element.offsetHeight : height;
2268
+ const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight;
2269
+ if (shouldFallback) {
2270
+ width = offsetWidth;
2271
+ height = offsetHeight;
2272
+ }
2273
+ return {
2274
+ width,
2275
+ height,
2276
+ $: shouldFallback
2277
+ };
2278
+ }
2279
+
2280
+ function unwrapElement(element) {
2281
+ return !isElement(element) ? element.contextElement : element;
2282
+ }
2283
+
2284
+ function getScale(element) {
2285
+ const domElement = unwrapElement(element);
2286
+ if (!isHTMLElement(domElement)) {
2287
+ return createCoords(1);
2288
+ }
2289
+ const rect = domElement.getBoundingClientRect();
2290
+ const {
2291
+ width,
2292
+ height,
2293
+ $
2294
+ } = getCssDimensions(domElement);
2295
+ let x = ($ ? round(rect.width) : rect.width) / width;
2296
+ let y = ($ ? round(rect.height) : rect.height) / height;
2297
+
2298
+ // 0, NaN, or Infinity should always fallback to 1.
2299
+
2300
+ if (!x || !Number.isFinite(x)) {
2301
+ x = 1;
2302
+ }
2303
+ if (!y || !Number.isFinite(y)) {
2304
+ y = 1;
2305
+ }
2306
+ return {
2307
+ x,
2308
+ y
2309
+ };
2310
+ }
2311
+
2312
+ const noOffsets = /*#__PURE__*/createCoords(0);
2313
+ function getVisualOffsets(element) {
2314
+ const win = getWindow(element);
2315
+ if (!isWebKit() || !win.visualViewport) {
2316
+ return noOffsets;
2317
+ }
2318
+ return {
2319
+ x: win.visualViewport.offsetLeft,
2320
+ y: win.visualViewport.offsetTop
2321
+ };
2322
+ }
2323
+ function shouldAddVisualOffsets(element, isFixed, floatingOffsetParent) {
2324
+ if (isFixed === void 0) {
2325
+ isFixed = false;
2326
+ }
2327
+ if (!floatingOffsetParent || isFixed && floatingOffsetParent !== getWindow(element)) {
2328
+ return false;
2329
+ }
2330
+ return isFixed;
2331
+ }
2332
+
2333
+ function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) {
2334
+ if (includeScale === void 0) {
2335
+ includeScale = false;
2336
+ }
2337
+ if (isFixedStrategy === void 0) {
2338
+ isFixedStrategy = false;
2339
+ }
2340
+ const clientRect = element.getBoundingClientRect();
2341
+ const domElement = unwrapElement(element);
2342
+ let scale = createCoords(1);
2343
+ if (includeScale) {
2344
+ if (offsetParent) {
2345
+ if (isElement(offsetParent)) {
2346
+ scale = getScale(offsetParent);
2347
+ }
2348
+ } else {
2349
+ scale = getScale(element);
2350
+ }
2351
+ }
2352
+ const visualOffsets = shouldAddVisualOffsets(domElement, isFixedStrategy, offsetParent) ? getVisualOffsets(domElement) : createCoords(0);
2353
+ let x = (clientRect.left + visualOffsets.x) / scale.x;
2354
+ let y = (clientRect.top + visualOffsets.y) / scale.y;
2355
+ let width = clientRect.width / scale.x;
2356
+ let height = clientRect.height / scale.y;
2357
+ if (domElement) {
2358
+ const win = getWindow(domElement);
2359
+ const offsetWin = offsetParent && isElement(offsetParent) ? getWindow(offsetParent) : offsetParent;
2360
+ let currentWin = win;
2361
+ let currentIFrame = getFrameElement(currentWin);
2362
+ while (currentIFrame && offsetParent && offsetWin !== currentWin) {
2363
+ const iframeScale = getScale(currentIFrame);
2364
+ const iframeRect = currentIFrame.getBoundingClientRect();
2365
+ const css = getComputedStyle(currentIFrame);
2366
+ const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x;
2367
+ const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y;
2368
+ x *= iframeScale.x;
2369
+ y *= iframeScale.y;
2370
+ width *= iframeScale.x;
2371
+ height *= iframeScale.y;
2372
+ x += left;
2373
+ y += top;
2374
+ currentWin = getWindow(currentIFrame);
2375
+ currentIFrame = getFrameElement(currentWin);
2376
+ }
2377
+ }
2378
+ return rectToClientRect({
2379
+ width,
2380
+ height,
2381
+ x,
2382
+ y
2383
+ });
2384
+ }
2385
+
2386
+ // If <html> has a CSS width greater than the viewport, then this will be
2387
+ // incorrect for RTL.
2388
+ function getWindowScrollBarX(element, rect) {
2389
+ const leftScroll = getNodeScroll(element).scrollLeft;
2390
+ if (!rect) {
2391
+ return getBoundingClientRect(getDocumentElement(element)).left + leftScroll;
2392
+ }
2393
+ return rect.left + leftScroll;
2394
+ }
2395
+
2396
+ function getHTMLOffset(documentElement, scroll, ignoreScrollbarX) {
2397
+ if (ignoreScrollbarX === void 0) {
2398
+ ignoreScrollbarX = false;
2399
+ }
2400
+ const htmlRect = documentElement.getBoundingClientRect();
2401
+ const x = htmlRect.left + scroll.scrollLeft - (ignoreScrollbarX ? 0 :
2402
+ // RTL <body> scrollbar.
2403
+ getWindowScrollBarX(documentElement, htmlRect));
2404
+ const y = htmlRect.top + scroll.scrollTop;
2405
+ return {
2406
+ x,
2407
+ y
2408
+ };
2409
+ }
2410
+
2411
+ function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
2412
+ let {
2413
+ elements,
2414
+ rect,
2415
+ offsetParent,
2416
+ strategy
2417
+ } = _ref;
2418
+ const isFixed = strategy === 'fixed';
2419
+ const documentElement = getDocumentElement(offsetParent);
2420
+ const topLayer = elements ? isTopLayer(elements.floating) : false;
2421
+ if (offsetParent === documentElement || topLayer && isFixed) {
2422
+ return rect;
2423
+ }
2424
+ let scroll = {
2425
+ scrollLeft: 0,
2426
+ scrollTop: 0
2427
+ };
2428
+ let scale = createCoords(1);
2429
+ const offsets = createCoords(0);
2430
+ const isOffsetParentAnElement = isHTMLElement(offsetParent);
2431
+ if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
2432
+ if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
2433
+ scroll = getNodeScroll(offsetParent);
2434
+ }
2435
+ if (isHTMLElement(offsetParent)) {
2436
+ const offsetRect = getBoundingClientRect(offsetParent);
2437
+ scale = getScale(offsetParent);
2438
+ offsets.x = offsetRect.x + offsetParent.clientLeft;
2439
+ offsets.y = offsetRect.y + offsetParent.clientTop;
2440
+ }
2441
+ }
2442
+ const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll, true) : createCoords(0);
2443
+ return {
2444
+ width: rect.width * scale.x,
2445
+ height: rect.height * scale.y,
2446
+ x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x + htmlOffset.x,
2447
+ y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y + htmlOffset.y
2448
+ };
2449
+ }
2450
+
2451
+ function getClientRects(element) {
2452
+ return Array.from(element.getClientRects());
2453
+ }
2454
+
2455
+ // Gets the entire size of the scrollable document area, even extending outside
2456
+ // of the `<html>` and `<body>` rect bounds if horizontally scrollable.
2457
+ function getDocumentRect(element) {
2458
+ const html = getDocumentElement(element);
2459
+ const scroll = getNodeScroll(element);
2460
+ const body = element.ownerDocument.body;
2461
+ const width = max(html.scrollWidth, html.clientWidth, body.scrollWidth, body.clientWidth);
2462
+ const height = max(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight);
2463
+ let x = -scroll.scrollLeft + getWindowScrollBarX(element);
2464
+ const y = -scroll.scrollTop;
2465
+ if (getComputedStyle(body).direction === 'rtl') {
2466
+ x += max(html.clientWidth, body.clientWidth) - width;
2467
+ }
2468
+ return {
2469
+ width,
2470
+ height,
2471
+ x,
2472
+ y
2473
+ };
2474
+ }
2475
+
2476
+ function getViewportRect(element, strategy) {
2477
+ const win = getWindow(element);
2478
+ const html = getDocumentElement(element);
2479
+ const visualViewport = win.visualViewport;
2480
+ let width = html.clientWidth;
2481
+ let height = html.clientHeight;
2482
+ let x = 0;
2483
+ let y = 0;
2484
+ if (visualViewport) {
2485
+ width = visualViewport.width;
2486
+ height = visualViewport.height;
2487
+ const visualViewportBased = isWebKit();
2488
+ if (!visualViewportBased || visualViewportBased && strategy === 'fixed') {
2489
+ x = visualViewport.offsetLeft;
2490
+ y = visualViewport.offsetTop;
2491
+ }
2492
+ }
2493
+ return {
2494
+ width,
2495
+ height,
2496
+ x,
2497
+ y
2498
+ };
2499
+ }
2500
+
2501
+ const absoluteOrFixed = /*#__PURE__*/new Set(['absolute', 'fixed']);
2502
+ // Returns the inner client rect, subtracting scrollbars if present.
2503
+ function getInnerBoundingClientRect(element, strategy) {
2504
+ const clientRect = getBoundingClientRect(element, true, strategy === 'fixed');
2505
+ const top = clientRect.top + element.clientTop;
2506
+ const left = clientRect.left + element.clientLeft;
2507
+ const scale = isHTMLElement(element) ? getScale(element) : createCoords(1);
2508
+ const width = element.clientWidth * scale.x;
2509
+ const height = element.clientHeight * scale.y;
2510
+ const x = left * scale.x;
2511
+ const y = top * scale.y;
2512
+ return {
2513
+ width,
2514
+ height,
2515
+ x,
2516
+ y
2517
+ };
2518
+ }
2519
+ function getClientRectFromClippingAncestor(element, clippingAncestor, strategy) {
2520
+ let rect;
2521
+ if (clippingAncestor === 'viewport') {
2522
+ rect = getViewportRect(element, strategy);
2523
+ } else if (clippingAncestor === 'document') {
2524
+ rect = getDocumentRect(getDocumentElement(element));
2525
+ } else if (isElement(clippingAncestor)) {
2526
+ rect = getInnerBoundingClientRect(clippingAncestor, strategy);
2527
+ } else {
2528
+ const visualOffsets = getVisualOffsets(element);
2529
+ rect = {
2530
+ x: clippingAncestor.x - visualOffsets.x,
2531
+ y: clippingAncestor.y - visualOffsets.y,
2532
+ width: clippingAncestor.width,
2533
+ height: clippingAncestor.height
2534
+ };
2535
+ }
2536
+ return rectToClientRect(rect);
2537
+ }
2538
+ function hasFixedPositionAncestor(element, stopNode) {
2539
+ const parentNode = getParentNode(element);
2540
+ if (parentNode === stopNode || !isElement(parentNode) || isLastTraversableNode(parentNode)) {
2541
+ return false;
2542
+ }
2543
+ return getComputedStyle(parentNode).position === 'fixed' || hasFixedPositionAncestor(parentNode, stopNode);
2544
+ }
2545
+
2546
+ // A "clipping ancestor" is an `overflow` element with the characteristic of
2547
+ // clipping (or hiding) child elements. This returns all clipping ancestors
2548
+ // of the given element up the tree.
2549
+ function getClippingElementAncestors(element, cache) {
2550
+ const cachedResult = cache.get(element);
2551
+ if (cachedResult) {
2552
+ return cachedResult;
2553
+ }
2554
+ let result = getOverflowAncestors(element, [], false).filter(el => isElement(el) && getNodeName(el) !== 'body');
2555
+ let currentContainingBlockComputedStyle = null;
2556
+ const elementIsFixed = getComputedStyle(element).position === 'fixed';
2557
+ let currentNode = elementIsFixed ? getParentNode(element) : element;
2558
+
2559
+ // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
2560
+ while (isElement(currentNode) && !isLastTraversableNode(currentNode)) {
2561
+ const computedStyle = getComputedStyle(currentNode);
2562
+ const currentNodeIsContaining = isContainingBlock(currentNode);
2563
+ if (!currentNodeIsContaining && computedStyle.position === 'fixed') {
2564
+ currentContainingBlockComputedStyle = null;
2565
+ }
2566
+ const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === 'static' && !!currentContainingBlockComputedStyle && absoluteOrFixed.has(currentContainingBlockComputedStyle.position) || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode);
2567
+ if (shouldDropCurrentNode) {
2568
+ // Drop non-containing blocks.
2569
+ result = result.filter(ancestor => ancestor !== currentNode);
2570
+ } else {
2571
+ // Record last containing block for next iteration.
2572
+ currentContainingBlockComputedStyle = computedStyle;
2573
+ }
2574
+ currentNode = getParentNode(currentNode);
2575
+ }
2576
+ cache.set(element, result);
2577
+ return result;
2578
+ }
2579
+
2580
+ // Gets the maximum area that the element is visible in due to any number of
2581
+ // clipping ancestors.
2582
+ function getClippingRect(_ref) {
2583
+ let {
2584
+ element,
2585
+ boundary,
2586
+ rootBoundary,
2587
+ strategy
2588
+ } = _ref;
2589
+ const elementClippingAncestors = boundary === 'clippingAncestors' ? isTopLayer(element) ? [] : getClippingElementAncestors(element, this._c) : [].concat(boundary);
2590
+ const clippingAncestors = [...elementClippingAncestors, rootBoundary];
2591
+ const firstClippingAncestor = clippingAncestors[0];
2592
+ const clippingRect = clippingAncestors.reduce((accRect, clippingAncestor) => {
2593
+ const rect = getClientRectFromClippingAncestor(element, clippingAncestor, strategy);
2594
+ accRect.top = max(rect.top, accRect.top);
2595
+ accRect.right = min(rect.right, accRect.right);
2596
+ accRect.bottom = min(rect.bottom, accRect.bottom);
2597
+ accRect.left = max(rect.left, accRect.left);
2598
+ return accRect;
2599
+ }, getClientRectFromClippingAncestor(element, firstClippingAncestor, strategy));
2600
+ return {
2601
+ width: clippingRect.right - clippingRect.left,
2602
+ height: clippingRect.bottom - clippingRect.top,
2603
+ x: clippingRect.left,
2604
+ y: clippingRect.top
2605
+ };
2606
+ }
2607
+
2608
+ function getDimensions(element) {
2609
+ const {
2610
+ width,
2611
+ height
2612
+ } = getCssDimensions(element);
2613
+ return {
2614
+ width,
2615
+ height
2616
+ };
2617
+ }
2618
+
2619
+ function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
2620
+ const isOffsetParentAnElement = isHTMLElement(offsetParent);
2621
+ const documentElement = getDocumentElement(offsetParent);
2622
+ const isFixed = strategy === 'fixed';
2623
+ const rect = getBoundingClientRect(element, true, isFixed, offsetParent);
2624
+ let scroll = {
2625
+ scrollLeft: 0,
2626
+ scrollTop: 0
2627
+ };
2628
+ const offsets = createCoords(0);
2629
+
2630
+ // If the <body> scrollbar appears on the left (e.g. RTL systems). Use
2631
+ // Firefox with layout.scrollbar.side = 3 in about:config to test this.
2632
+ function setLeftRTLScrollbarOffset() {
2633
+ offsets.x = getWindowScrollBarX(documentElement);
2634
+ }
2635
+ if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
2636
+ if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
2637
+ scroll = getNodeScroll(offsetParent);
2638
+ }
2639
+ if (isOffsetParentAnElement) {
2640
+ const offsetRect = getBoundingClientRect(offsetParent, true, isFixed, offsetParent);
2641
+ offsets.x = offsetRect.x + offsetParent.clientLeft;
2642
+ offsets.y = offsetRect.y + offsetParent.clientTop;
2643
+ } else if (documentElement) {
2644
+ setLeftRTLScrollbarOffset();
2645
+ }
2646
+ }
2647
+ if (isFixed && !isOffsetParentAnElement && documentElement) {
2648
+ setLeftRTLScrollbarOffset();
2649
+ }
2650
+ const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);
2651
+ const x = rect.left + scroll.scrollLeft - offsets.x - htmlOffset.x;
2652
+ const y = rect.top + scroll.scrollTop - offsets.y - htmlOffset.y;
2653
+ return {
2654
+ x,
2655
+ y,
2656
+ width: rect.width,
2657
+ height: rect.height
2658
+ };
2659
+ }
2660
+
2661
+ function isStaticPositioned(element) {
2662
+ return getComputedStyle(element).position === 'static';
2663
+ }
2664
+
2665
+ function getTrueOffsetParent(element, polyfill) {
2666
+ if (!isHTMLElement(element) || getComputedStyle(element).position === 'fixed') {
2667
+ return null;
2668
+ }
2669
+ if (polyfill) {
2670
+ return polyfill(element);
2671
+ }
2672
+ let rawOffsetParent = element.offsetParent;
2673
+
2674
+ // Firefox returns the <html> element as the offsetParent if it's non-static,
2675
+ // while Chrome and Safari return the <body> element. The <body> element must
2676
+ // be used to perform the correct calculations even if the <html> element is
2677
+ // non-static.
2678
+ if (getDocumentElement(element) === rawOffsetParent) {
2679
+ rawOffsetParent = rawOffsetParent.ownerDocument.body;
2680
+ }
2681
+ return rawOffsetParent;
2682
+ }
2683
+
2684
+ // Gets the closest ancestor positioned element. Handles some edge cases,
2685
+ // such as table ancestors and cross browser bugs.
2686
+ function getOffsetParent(element, polyfill) {
2687
+ const win = getWindow(element);
2688
+ if (isTopLayer(element)) {
2689
+ return win;
2690
+ }
2691
+ if (!isHTMLElement(element)) {
2692
+ let svgOffsetParent = getParentNode(element);
2693
+ while (svgOffsetParent && !isLastTraversableNode(svgOffsetParent)) {
2694
+ if (isElement(svgOffsetParent) && !isStaticPositioned(svgOffsetParent)) {
2695
+ return svgOffsetParent;
2696
+ }
2697
+ svgOffsetParent = getParentNode(svgOffsetParent);
2698
+ }
2699
+ return win;
2700
+ }
2701
+ let offsetParent = getTrueOffsetParent(element, polyfill);
2702
+ while (offsetParent && isTableElement(offsetParent) && isStaticPositioned(offsetParent)) {
2703
+ offsetParent = getTrueOffsetParent(offsetParent, polyfill);
2704
+ }
2705
+ if (offsetParent && isLastTraversableNode(offsetParent) && isStaticPositioned(offsetParent) && !isContainingBlock(offsetParent)) {
2706
+ return win;
2707
+ }
2708
+ return offsetParent || getContainingBlock(element) || win;
2709
+ }
2710
+
2711
+ const getElementRects = async function (data) {
2712
+ const getOffsetParentFn = this.getOffsetParent || getOffsetParent;
2713
+ const getDimensionsFn = this.getDimensions;
2714
+ const floatingDimensions = await getDimensionsFn(data.floating);
2715
+ return {
2716
+ reference: getRectRelativeToOffsetParent(data.reference, await getOffsetParentFn(data.floating), data.strategy),
2717
+ floating: {
2718
+ x: 0,
2719
+ y: 0,
2720
+ width: floatingDimensions.width,
2721
+ height: floatingDimensions.height
2722
+ }
2723
+ };
2724
+ };
2725
+
2726
+ function isRTL(element) {
2727
+ return getComputedStyle(element).direction === 'rtl';
2728
+ }
2729
+
2730
+ const platform = {
2731
+ convertOffsetParentRelativeRectToViewportRelativeRect,
2732
+ getDocumentElement,
2733
+ getClippingRect,
2734
+ getOffsetParent,
2735
+ getElementRects,
2736
+ getClientRects,
2737
+ getDimensions,
2738
+ getScale,
2739
+ isElement,
2740
+ isRTL
2741
+ };
2742
+
2743
+ function rectsAreEqual(a, b) {
2744
+ return a.x === b.x && a.y === b.y && a.width === b.width && a.height === b.height;
2745
+ }
2746
+
2747
+ // https://samthor.au/2021/observing-dom/
2748
+ function observeMove(element, onMove) {
2749
+ let io = null;
2750
+ let timeoutId;
2751
+ const root = getDocumentElement(element);
2752
+ function cleanup() {
2753
+ var _io;
2754
+ clearTimeout(timeoutId);
2755
+ (_io = io) == null || _io.disconnect();
2756
+ io = null;
2757
+ }
2758
+ function refresh(skip, threshold) {
2759
+ if (skip === void 0) {
2760
+ skip = false;
2761
+ }
2762
+ if (threshold === void 0) {
2763
+ threshold = 1;
2764
+ }
2765
+ cleanup();
2766
+ const elementRectForRootMargin = element.getBoundingClientRect();
2767
+ const {
2768
+ left,
2769
+ top,
2770
+ width,
2771
+ height
2772
+ } = elementRectForRootMargin;
2773
+ if (!skip) {
2774
+ onMove();
2775
+ }
2776
+ if (!width || !height) {
2777
+ return;
2778
+ }
2779
+ const insetTop = floor(top);
2780
+ const insetRight = floor(root.clientWidth - (left + width));
2781
+ const insetBottom = floor(root.clientHeight - (top + height));
2782
+ const insetLeft = floor(left);
2783
+ const rootMargin = -insetTop + "px " + -insetRight + "px " + -insetBottom + "px " + -insetLeft + "px";
2784
+ const options = {
2785
+ rootMargin,
2786
+ threshold: max(0, min(1, threshold)) || 1
2787
+ };
2788
+ let isFirstUpdate = true;
2789
+ function handleObserve(entries) {
2790
+ const ratio = entries[0].intersectionRatio;
2791
+ if (ratio !== threshold) {
2792
+ if (!isFirstUpdate) {
2793
+ return refresh();
2794
+ }
2795
+ if (!ratio) {
2796
+ // If the reference is clipped, the ratio is 0. Throttle the refresh
2797
+ // to prevent an infinite loop of updates.
2798
+ timeoutId = setTimeout(() => {
2799
+ refresh(false, 1e-7);
2800
+ }, 1000);
2801
+ } else {
2802
+ refresh(false, ratio);
2803
+ }
2804
+ }
2805
+ if (ratio === 1 && !rectsAreEqual(elementRectForRootMargin, element.getBoundingClientRect())) {
2806
+ // It's possible that even though the ratio is reported as 1, the
2807
+ // element is not actually fully within the IntersectionObserver's root
2808
+ // area anymore. This can happen under performance constraints. This may
2809
+ // be a bug in the browser's IntersectionObserver implementation. To
2810
+ // work around this, we compare the element's bounding rect now with
2811
+ // what it was at the time we created the IntersectionObserver. If they
2812
+ // are not equal then the element moved, so we refresh.
2813
+ refresh();
2814
+ }
2815
+ isFirstUpdate = false;
2816
+ }
2817
+
2818
+ // Older browsers don't support a `document` as the root and will throw an
2819
+ // error.
2820
+ try {
2821
+ io = new IntersectionObserver(handleObserve, {
2822
+ ...options,
2823
+ // Handle <iframe>s
2824
+ root: root.ownerDocument
2825
+ });
2826
+ } catch (_e) {
2827
+ io = new IntersectionObserver(handleObserve, options);
2828
+ }
2829
+ io.observe(element);
2830
+ }
2831
+ refresh(true);
2832
+ return cleanup;
2833
+ }
2834
+
2835
+ /**
2836
+ * Automatically updates the position of the floating element when necessary.
2837
+ * Should only be called when the floating element is mounted on the DOM or
2838
+ * visible on the screen.
2839
+ * @returns cleanup function that should be invoked when the floating element is
2840
+ * removed from the DOM or hidden from the screen.
2841
+ * @see https://floating-ui.com/docs/autoUpdate
2842
+ */
2843
+ function autoUpdate(reference, floating, update, options) {
2844
+ if (options === void 0) {
2845
+ options = {};
2846
+ }
2847
+ const {
2848
+ ancestorScroll = true,
2849
+ ancestorResize = true,
2850
+ elementResize = typeof ResizeObserver === 'function',
2851
+ layoutShift = typeof IntersectionObserver === 'function',
2852
+ animationFrame = false
2853
+ } = options;
2854
+ const referenceEl = unwrapElement(reference);
2855
+ const ancestors = ancestorScroll || ancestorResize ? [...(referenceEl ? getOverflowAncestors(referenceEl) : []), ...getOverflowAncestors(floating)] : [];
2856
+ ancestors.forEach(ancestor => {
2857
+ ancestorScroll && ancestor.addEventListener('scroll', update, {
2858
+ passive: true
2859
+ });
2860
+ ancestorResize && ancestor.addEventListener('resize', update);
2861
+ });
2862
+ const cleanupIo = referenceEl && layoutShift ? observeMove(referenceEl, update) : null;
2863
+ let reobserveFrame = -1;
2864
+ let resizeObserver = null;
2865
+ if (elementResize) {
2866
+ resizeObserver = new ResizeObserver(_ref => {
2867
+ let [firstEntry] = _ref;
2868
+ if (firstEntry && firstEntry.target === referenceEl && resizeObserver) {
2869
+ // Prevent update loops when using the `size` middleware.
2870
+ // https://github.com/floating-ui/floating-ui/issues/1740
2871
+ resizeObserver.unobserve(floating);
2872
+ cancelAnimationFrame(reobserveFrame);
2873
+ reobserveFrame = requestAnimationFrame(() => {
2874
+ var _resizeObserver;
2875
+ (_resizeObserver = resizeObserver) == null || _resizeObserver.observe(floating);
2876
+ });
2877
+ }
2878
+ update();
2879
+ });
2880
+ if (referenceEl && !animationFrame) {
2881
+ resizeObserver.observe(referenceEl);
2882
+ }
2883
+ resizeObserver.observe(floating);
2884
+ }
2885
+ let frameId;
2886
+ let prevRefRect = animationFrame ? getBoundingClientRect(reference) : null;
2887
+ if (animationFrame) {
2888
+ frameLoop();
2889
+ }
2890
+ function frameLoop() {
2891
+ const nextRefRect = getBoundingClientRect(reference);
2892
+ if (prevRefRect && !rectsAreEqual(prevRefRect, nextRefRect)) {
2893
+ update();
2894
+ }
2895
+ prevRefRect = nextRefRect;
2896
+ frameId = requestAnimationFrame(frameLoop);
2897
+ }
2898
+ update();
2899
+ return () => {
2900
+ var _resizeObserver2;
2901
+ ancestors.forEach(ancestor => {
2902
+ ancestorScroll && ancestor.removeEventListener('scroll', update);
2903
+ ancestorResize && ancestor.removeEventListener('resize', update);
2904
+ });
2905
+ cleanupIo == null || cleanupIo();
2906
+ (_resizeObserver2 = resizeObserver) == null || _resizeObserver2.disconnect();
2907
+ resizeObserver = null;
2908
+ if (animationFrame) {
2909
+ cancelAnimationFrame(frameId);
2910
+ }
2911
+ };
2912
+ }
2913
+
2914
+ /**
2915
+ * Modifies the placement by translating the floating element along the
2916
+ * specified axes.
2917
+ * A number (shorthand for `mainAxis` or distance), or an axes configuration
2918
+ * object may be passed.
2919
+ * @see https://floating-ui.com/docs/offset
2920
+ */
2921
+ const offset$1 = offset$2;
2922
+
2923
+ /**
2924
+ * Optimizes the visibility of the floating element by shifting it in order to
2925
+ * keep it in view when it will overflow the clipping boundary.
2926
+ * @see https://floating-ui.com/docs/shift
2927
+ */
2928
+ const shift$1 = shift$2;
2929
+
2930
+ /**
2931
+ * Optimizes the visibility of the floating element by flipping the `placement`
2932
+ * in order to keep it in view when the preferred placement(s) will overflow the
2933
+ * clipping boundary. Alternative to `autoPlacement`.
2934
+ * @see https://floating-ui.com/docs/flip
2935
+ */
2936
+ const flip$1 = flip$2;
2937
+
2938
+ /**
2939
+ * Provides data that allows you to change the size of the floating element —
2940
+ * for instance, prevent it from overflowing the clipping boundary or match the
2941
+ * width of the reference element.
2942
+ * @see https://floating-ui.com/docs/size
2943
+ */
2944
+ const size$1 = size$2;
2945
+
2946
+ /**
2947
+ * Provides data to position an inner element of the floating element so that it
2948
+ * appears centered to the reference element.
2949
+ * @see https://floating-ui.com/docs/arrow
2950
+ */
2951
+ const arrow$2 = arrow$3;
2952
+
2953
+ /**
2954
+ * Computes the `x` and `y` coordinates that will place the floating element
2955
+ * next to a given reference element.
2956
+ */
2957
+ const computePosition = (reference, floating, options) => {
2958
+ // This caches the expensive `getClippingElementAncestors` function so that
2959
+ // multiple lifecycle resets re-use the same result. It only lives for a
2960
+ // single call. If other functions become expensive, we can add them as well.
2961
+ const cache = new Map();
2962
+ const mergedOptions = {
2963
+ platform,
2964
+ ...options
2965
+ };
2966
+ const platformWithCache = {
2967
+ ...mergedOptions.platform,
2968
+ _c: cache
2969
+ };
2970
+ return computePosition$1(reference, floating, {
2971
+ ...mergedOptions,
2972
+ platform: platformWithCache
2973
+ });
2974
+ };
2975
+
2976
+ var isClient = typeof document !== 'undefined';
2977
+
2978
+ var noop = function noop() {};
2979
+ var index = isClient ? React.useLayoutEffect : noop;
2980
+
2981
+ // Fork of `fast-deep-equal` that only does the comparisons we need and compares
2982
+ // functions
2983
+ function deepEqual(a, b) {
2984
+ if (a === b) {
2985
+ return true;
2986
+ }
2987
+ if (typeof a !== typeof b) {
2988
+ return false;
2989
+ }
2990
+ if (typeof a === 'function' && a.toString() === b.toString()) {
2991
+ return true;
2992
+ }
2993
+ let length;
2994
+ let i;
2995
+ let keys;
2996
+ if (a && b && typeof a === 'object') {
2997
+ if (Array.isArray(a)) {
2998
+ length = a.length;
2999
+ if (length !== b.length) return false;
3000
+ for (i = length; i-- !== 0;) {
3001
+ if (!deepEqual(a[i], b[i])) {
3002
+ return false;
3003
+ }
3004
+ }
3005
+ return true;
3006
+ }
3007
+ keys = Object.keys(a);
3008
+ length = keys.length;
3009
+ if (length !== Object.keys(b).length) {
3010
+ return false;
3011
+ }
3012
+ for (i = length; i-- !== 0;) {
3013
+ if (!{}.hasOwnProperty.call(b, keys[i])) {
3014
+ return false;
3015
+ }
3016
+ }
3017
+ for (i = length; i-- !== 0;) {
3018
+ const key = keys[i];
3019
+ if (key === '_owner' && a.$$typeof) {
3020
+ continue;
3021
+ }
3022
+ if (!deepEqual(a[key], b[key])) {
3023
+ return false;
3024
+ }
3025
+ }
3026
+ return true;
3027
+ }
3028
+ return a !== a && b !== b;
3029
+ }
3030
+
3031
+ function getDPR(element) {
3032
+ if (typeof window === 'undefined') {
3033
+ return 1;
3034
+ }
3035
+ const win = element.ownerDocument.defaultView || window;
3036
+ return win.devicePixelRatio || 1;
3037
+ }
3038
+
3039
+ function roundByDPR(element, value) {
3040
+ const dpr = getDPR(element);
3041
+ return Math.round(value * dpr) / dpr;
3042
+ }
3043
+
3044
+ function useLatestRef(value) {
3045
+ const ref = React__namespace.useRef(value);
3046
+ index(() => {
3047
+ ref.current = value;
3048
+ });
3049
+ return ref;
3050
+ }
3051
+
3052
+ /**
3053
+ * Provides data to position a floating element.
3054
+ * @see https://floating-ui.com/docs/useFloating
3055
+ */
3056
+ function useFloating(options) {
3057
+ if (options === void 0) {
3058
+ options = {};
3059
+ }
3060
+ const {
3061
+ placement = 'bottom',
3062
+ strategy = 'absolute',
3063
+ middleware = [],
3064
+ platform,
3065
+ elements: {
3066
+ reference: externalReference,
3067
+ floating: externalFloating
3068
+ } = {},
3069
+ transform = true,
3070
+ whileElementsMounted,
3071
+ open
3072
+ } = options;
3073
+ const [data, setData] = React__namespace.useState({
3074
+ x: 0,
3075
+ y: 0,
3076
+ strategy,
3077
+ placement,
3078
+ middlewareData: {},
3079
+ isPositioned: false
3080
+ });
3081
+ const [latestMiddleware, setLatestMiddleware] = React__namespace.useState(middleware);
3082
+ if (!deepEqual(latestMiddleware, middleware)) {
3083
+ setLatestMiddleware(middleware);
3084
+ }
3085
+ const [_reference, _setReference] = React__namespace.useState(null);
3086
+ const [_floating, _setFloating] = React__namespace.useState(null);
3087
+ const setReference = React__namespace.useCallback(node => {
3088
+ if (node !== referenceRef.current) {
3089
+ referenceRef.current = node;
3090
+ _setReference(node);
3091
+ }
3092
+ }, []);
3093
+ const setFloating = React__namespace.useCallback(node => {
3094
+ if (node !== floatingRef.current) {
3095
+ floatingRef.current = node;
3096
+ _setFloating(node);
3097
+ }
3098
+ }, []);
3099
+ const referenceEl = externalReference || _reference;
3100
+ const floatingEl = externalFloating || _floating;
3101
+ const referenceRef = React__namespace.useRef(null);
3102
+ const floatingRef = React__namespace.useRef(null);
3103
+ const dataRef = React__namespace.useRef(data);
3104
+ const hasWhileElementsMounted = whileElementsMounted != null;
3105
+ const whileElementsMountedRef = useLatestRef(whileElementsMounted);
3106
+ const platformRef = useLatestRef(platform);
3107
+ const openRef = useLatestRef(open);
3108
+ const update = React__namespace.useCallback(() => {
3109
+ if (!referenceRef.current || !floatingRef.current) {
3110
+ return;
3111
+ }
3112
+ const config = {
3113
+ placement,
3114
+ strategy,
3115
+ middleware: latestMiddleware
3116
+ };
3117
+ if (platformRef.current) {
3118
+ config.platform = platformRef.current;
3119
+ }
3120
+ computePosition(referenceRef.current, floatingRef.current, config).then(data => {
3121
+ const fullData = {
3122
+ ...data,
3123
+ // The floating element's position may be recomputed while it's closed
3124
+ // but still mounted (such as when transitioning out). To ensure
3125
+ // `isPositioned` will be `false` initially on the next open, avoid
3126
+ // setting it to `true` when `open === false` (must be specified).
3127
+ isPositioned: openRef.current !== false
3128
+ };
3129
+ if (isMountedRef.current && !deepEqual(dataRef.current, fullData)) {
3130
+ dataRef.current = fullData;
3131
+ ReactDOM__namespace.flushSync(() => {
3132
+ setData(fullData);
3133
+ });
3134
+ }
3135
+ });
3136
+ }, [latestMiddleware, placement, strategy, platformRef, openRef]);
3137
+ index(() => {
3138
+ if (open === false && dataRef.current.isPositioned) {
3139
+ dataRef.current.isPositioned = false;
3140
+ setData(data => ({
3141
+ ...data,
3142
+ isPositioned: false
3143
+ }));
3144
+ }
3145
+ }, [open]);
3146
+ const isMountedRef = React__namespace.useRef(false);
3147
+ index(() => {
3148
+ isMountedRef.current = true;
3149
+ return () => {
3150
+ isMountedRef.current = false;
3151
+ };
3152
+ }, []);
3153
+ index(() => {
3154
+ if (referenceEl) referenceRef.current = referenceEl;
3155
+ if (floatingEl) floatingRef.current = floatingEl;
3156
+ if (referenceEl && floatingEl) {
3157
+ if (whileElementsMountedRef.current) {
3158
+ return whileElementsMountedRef.current(referenceEl, floatingEl, update);
3159
+ }
3160
+ update();
3161
+ }
3162
+ }, [referenceEl, floatingEl, update, whileElementsMountedRef, hasWhileElementsMounted]);
3163
+ const refs = React__namespace.useMemo(() => ({
3164
+ reference: referenceRef,
3165
+ floating: floatingRef,
3166
+ setReference,
3167
+ setFloating
3168
+ }), [setReference, setFloating]);
3169
+ const elements = React__namespace.useMemo(() => ({
3170
+ reference: referenceEl,
3171
+ floating: floatingEl
3172
+ }), [referenceEl, floatingEl]);
3173
+ const floatingStyles = React__namespace.useMemo(() => {
3174
+ const initialStyles = {
3175
+ position: strategy,
3176
+ left: 0,
3177
+ top: 0
3178
+ };
3179
+ if (!elements.floating) {
3180
+ return initialStyles;
3181
+ }
3182
+ const x = roundByDPR(elements.floating, data.x);
3183
+ const y = roundByDPR(elements.floating, data.y);
3184
+ if (transform) {
3185
+ return {
3186
+ ...initialStyles,
3187
+ transform: "translate(" + x + "px, " + y + "px)",
3188
+ ...(getDPR(elements.floating) >= 1.5 && {
3189
+ willChange: 'transform'
3190
+ })
3191
+ };
3192
+ }
3193
+ return {
3194
+ position: strategy,
3195
+ left: x,
3196
+ top: y
3197
+ };
3198
+ }, [strategy, transform, elements.floating, data.x, data.y]);
3199
+ return React__namespace.useMemo(() => ({
3200
+ ...data,
3201
+ update,
3202
+ refs,
3203
+ elements,
3204
+ floatingStyles
3205
+ }), [data, update, refs, elements, floatingStyles]);
3206
+ }
3207
+
3208
+ /**
3209
+ * Provides data to position an inner element of the floating element so that it
3210
+ * appears centered to the reference element.
3211
+ * This wraps the core `arrow` middleware to allow React refs as the element.
3212
+ * @see https://floating-ui.com/docs/arrow
3213
+ */
3214
+ const arrow$1 = options => {
3215
+ function isRef(value) {
3216
+ return {}.hasOwnProperty.call(value, 'current');
3217
+ }
3218
+ return {
3219
+ name: 'arrow',
3220
+ options,
3221
+ fn(state) {
3222
+ const {
3223
+ element,
3224
+ padding
3225
+ } = typeof options === 'function' ? options(state) : options;
3226
+ if (element && isRef(element)) {
3227
+ if (element.current != null) {
3228
+ return arrow$2({
3229
+ element: element.current,
3230
+ padding
3231
+ }).fn(state);
3232
+ }
3233
+ return {};
3234
+ }
3235
+ if (element) {
3236
+ return arrow$2({
3237
+ element,
3238
+ padding
3239
+ }).fn(state);
3240
+ }
3241
+ return {};
3242
+ }
3243
+ };
3244
+ };
3245
+
3246
+ /**
3247
+ * Modifies the placement by translating the floating element along the
3248
+ * specified axes.
3249
+ * A number (shorthand for `mainAxis` or distance), or an axes configuration
3250
+ * object may be passed.
3251
+ * @see https://floating-ui.com/docs/offset
3252
+ */
3253
+ const offset = (options, deps) => ({
3254
+ ...offset$1(options),
3255
+ options: [options, deps]
3256
+ });
3257
+
3258
+ /**
3259
+ * Optimizes the visibility of the floating element by shifting it in order to
3260
+ * keep it in view when it will overflow the clipping boundary.
3261
+ * @see https://floating-ui.com/docs/shift
3262
+ */
3263
+ const shift = (options, deps) => ({
3264
+ ...shift$1(options),
3265
+ options: [options, deps]
3266
+ });
3267
+
3268
+ /**
3269
+ * Optimizes the visibility of the floating element by flipping the `placement`
3270
+ * in order to keep it in view when the preferred placement(s) will overflow the
3271
+ * clipping boundary. Alternative to `autoPlacement`.
3272
+ * @see https://floating-ui.com/docs/flip
3273
+ */
3274
+ const flip = (options, deps) => ({
3275
+ ...flip$1(options),
3276
+ options: [options, deps]
3277
+ });
3278
+
3279
+ /**
3280
+ * Provides data that allows you to change the size of the floating element —
3281
+ * for instance, prevent it from overflowing the clipping boundary or match the
3282
+ * width of the reference element.
3283
+ * @see https://floating-ui.com/docs/size
3284
+ */
3285
+ const size = (options, deps) => ({
3286
+ ...size$1(options),
3287
+ options: [options, deps]
3288
+ });
3289
+
3290
+ /**
3291
+ * Provides data to position an inner element of the floating element so that it
3292
+ * appears centered to the reference element.
3293
+ * This wraps the core `arrow` middleware to allow React refs as the element.
3294
+ * @see https://floating-ui.com/docs/arrow
3295
+ */
3296
+ const arrow = (options, deps) => ({
3297
+ ...arrow$1(options),
3298
+ options: [options, deps]
3299
+ });
3300
+
3301
+ function TooltipTrigger({ as, asChild = false, children, ...props }) {
3302
+ const TooltipTriggerElement = as || react.Button;
3303
+ if (asChild && React.isValidElement(children))
3304
+ return React.cloneElement(children, props);
3305
+ return jsxRuntime.jsx(TooltipTriggerElement, { ...props, children: children });
3306
+ }
3307
+ function TooltipPanel({ as, children, className, style, ...props }) {
3308
+ const TooltipPanelElement = as || 'div';
3309
+ return (jsxRuntime.jsx(TooltipPanelElement, { ...props, className: twMerge('absolute top-0 left-0 z-50 w-max rounded-md bg-neutral-50 px-2 py-1 text-sm text-neutral-950 opacity-0 shadow-lg outline-1 outline-neutral-400 data-portal:fixed data-ready:animate-fade-in dark:bg-neutral-800 dark:text-neutral-50 dark:shadow-none dark:-outline-offset-1 dark:outline-neutral-600', className), style: style, children: children }));
3310
+ }
3311
+ function Tooltip({ anchor = 'top', arrow: arrow$1, arrowClassName, children, delay = 500, offset: offset$1 = 8, onClose, onOpen, portal, }) {
3312
+ const [isOpen, setIsOpen] = React.useState(false), timeoutRef = React.useRef(undefined), arrowRef = React.useRef(null);
3313
+ const [bodyElement, setBodyElement] = React.useState(() => typeof window !== 'undefined' ? document.body : null);
3314
+ React.useEffect(() => {
3315
+ if (typeof window !== 'undefined' && !bodyElement) {
3316
+ const documentBody = document.body;
3317
+ setBodyElement(documentBody);
3318
+ }
3319
+ }, [bodyElement, portal]);
3320
+ const { refs, floatingStyles, isPositioned, placement, middlewareData } = useFloating({
3321
+ middleware: [
3322
+ offset(offset$1),
3323
+ flip({ padding: 20 }),
3324
+ shift({ padding: 20 }),
3325
+ size({
3326
+ apply({ availableHeight, availableWidth, elements }) {
3327
+ const height = `${Math.max(0, availableHeight) / 16}rem`, width = `${Math.min(418, availableWidth) / 16}rem`;
3328
+ elements.floating.style.maxHeight = height;
3329
+ elements.floating.style.maxWidth = width;
3330
+ },
3331
+ }),
3332
+ ...(arrowRef.current ? [arrow({ element: arrowRef.current })] : []),
3333
+ ],
3334
+ placement: anchor,
3335
+ strategy: portal ? 'fixed' : 'absolute',
3336
+ whileElementsMounted: autoUpdate,
3337
+ open: isOpen,
3338
+ });
3339
+ const openTooltip = React.useCallback(() => {
3340
+ clearTimeout(timeoutRef.current);
3341
+ if (delay > 0) {
3342
+ timeoutRef.current = setTimeout(() => {
3343
+ setIsOpen(true);
3344
+ onOpen?.();
3345
+ }, delay);
3346
+ }
3347
+ else {
3348
+ setIsOpen(true);
3349
+ onOpen?.();
3350
+ }
3351
+ }, [delay, onOpen]);
3352
+ const closeTooltip = React.useCallback(() => {
3353
+ clearTimeout(timeoutRef.current);
3354
+ setIsOpen(false);
3355
+ onClose?.();
3356
+ }, [onClose]);
3357
+ React.useEffect(() => {
3358
+ return () => {
3359
+ clearTimeout(timeoutRef.current);
3360
+ };
3361
+ }, []);
3362
+ const content = typeof children === 'function' ? children({ openTooltip, closeTooltip }) : children;
3363
+ const triggerElement = findComponentByType(content, TooltipTrigger), contentElement = findComponentByType(content, TooltipPanel);
3364
+ if (!contentElement)
3365
+ throw new Error('TooltipPanel must be defined in Tooltip children');
3366
+ if (!triggerElement && typeof children !== 'function')
3367
+ throw new Error('TooltipTrigger must be provided when not using render prop pattern');
3368
+ const arrowStyles = {};
3369
+ const reversedAnchor = {
3370
+ top: 'bottom',
3371
+ right: 'left',
3372
+ bottom: 'top',
3373
+ left: 'right',
3374
+ 'top-start': 'bottom left',
3375
+ 'top-end': 'bottom right',
3376
+ 'right-start': 'top left',
3377
+ 'right-end': 'bottom left',
3378
+ 'bottom-start': 'top left',
3379
+ 'bottom-end': 'top right',
3380
+ 'left-start': 'top right',
3381
+ 'left-end': 'bottom right',
3382
+ }[placement];
3383
+ if (middlewareData.arrow && arrow$1) {
3384
+ const { x, y } = middlewareData.arrow;
3385
+ const staticSide = {
3386
+ top: 'bottom',
3387
+ right: 'left',
3388
+ bottom: 'top',
3389
+ left: 'right',
3390
+ }[placement.split('-')[0]];
3391
+ if (staticSide) {
3392
+ arrowStyles[staticSide] = '-4px';
3393
+ if (x != null)
3394
+ arrowStyles.left = `${x}px`;
3395
+ if (y != null)
3396
+ arrowStyles.top = `${y}px`;
3397
+ }
3398
+ }
3399
+ const getArrowLocationClasses = () => {
3400
+ switch (placement) {
3401
+ case 'bottom':
3402
+ case 'bottom-end':
3403
+ case 'bottom-start':
3404
+ return '-translate-y-1';
3405
+ case 'top':
3406
+ case 'top-end':
3407
+ case 'top-start':
3408
+ return 'rotate-180 translate-y-1';
3409
+ case 'left':
3410
+ case 'left-end':
3411
+ case 'left-start':
3412
+ return 'rotate-90 translate-x-2';
3413
+ case 'right':
3414
+ case 'right-end':
3415
+ case 'right-start':
3416
+ return '-rotate-90 -translate-x-2';
3417
+ }
3418
+ };
3419
+ const arrowLocationClasses = getArrowLocationClasses();
3420
+ const handleMouseEnter = e => {
3421
+ openTooltip();
3422
+ triggerElement?.props.onMouseEnter?.(e);
3423
+ };
3424
+ const handleMouseLeave = e => {
3425
+ triggerElement?.props.onMouseLeave?.(e);
3426
+ closeTooltip();
3427
+ };
3428
+ const handleTouchStart = e => {
3429
+ openTooltip();
3430
+ triggerElement?.props.onTouchStart?.(e);
3431
+ };
3432
+ const handleFocus = e => {
3433
+ triggerElement?.props.onFocus?.(e);
3434
+ openTooltip();
3435
+ };
3436
+ const handleBlur = e => {
3437
+ triggerElement?.props.onBlur?.(e);
3438
+ closeTooltip();
3439
+ };
3440
+ const tooltipContent = (jsxRuntime.jsx(jsxRuntime.Fragment, { children: isOpen &&
3441
+ contentElement &&
3442
+ React.cloneElement(contentElement, {
3443
+ children: (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [contentElement.props.children, arrow$1 && (jsxRuntime.jsx(ArrowSvg, { className: twMerge('absolute', arrowLocationClasses, arrowClassName), style: arrowStyles, "data-tooltip-arrow": true }))] })),
3444
+ ...(portal ? { 'data-portal': true } : {}),
3445
+ ...(isPositioned ? { 'data-ready': true } : {}),
3446
+ onMouseEnter: openTooltip,
3447
+ onMouseLeave: closeTooltip,
3448
+ onTouchStart: handleTouchStart,
3449
+ ref: (node) => {
3450
+ refs.setFloating(node);
3451
+ if (node && arrow$1) {
3452
+ const arrowElement = node.querySelector('[data-tooltip-arrow]');
3453
+ if (arrowElement)
3454
+ arrowRef.current = arrowElement;
3455
+ }
3456
+ },
3457
+ role: 'tooltip',
3458
+ style: {
3459
+ ...contentElement.props.style,
3460
+ ...floatingStyles,
3461
+ transformOrigin: reversedAnchor,
3462
+ pointerEvents: 'none',
3463
+ },
3464
+ }) }));
3465
+ return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [triggerElement &&
3466
+ React.cloneElement(triggerElement, {
3467
+ ref: refs.setReference,
3468
+ onMouseEnter: handleMouseEnter,
3469
+ onMouseLeave: handleMouseLeave,
3470
+ onFocus: handleFocus,
3471
+ onBlur: handleBlur,
3472
+ 'aria-describedby': isOpen ? 'tooltip' : undefined,
3473
+ }), portal ? bodyElement && ReactDOM.createPortal(tooltipContent, bodyElement) : tooltipContent] }));
3474
+ }
3475
+ function ArrowSvg({ className, ...props }) {
3476
+ return (jsxRuntime.jsxs("svg", { viewBox: '0 0 20 10', className: twMerge('h-2.5 w-5 fill-none', className), ...props, children: [jsxRuntime.jsx("path", { d: 'M9.66437 2.60207L4.80758 6.97318C4.07308 7.63423 3.11989 8 2.13172 8H0V10H20V8H18.5349C17.5468 8 16.5936 7.63423 15.8591 6.97318L11.0023 2.60207C10.622 2.2598 10.0447 2.25979 9.66437 2.60207Z', className: 'fill-neutral-50 dark:fill-neutral-800' }), jsxRuntime.jsx("path", { d: 'M8.99542 1.85876C9.75604 1.17425 10.9106 1.17422 11.6713 1.85878L16.5281 6.22989C17.0789 6.72568 17.7938 7.00001 18.5349 7.00001L15.89 7L11.0023 2.60207C10.622 2.2598 10.0447 2.2598 9.66436 2.60207L4.77734 7L2.13171 7.00001C2.87284 7.00001 3.58774 6.72568 4.13861 6.22989L8.99542 1.85876Z', className: 'fill-neutral-400 dark:fill-none' }), jsxRuntime.jsx("path", { d: 'M10.3333 3.34539L5.47654 7.71648C4.55842 8.54279 3.36693 9 2.13172 9H0V8H2.13172C3.11989 8 4.07308 7.63423 4.80758 6.97318L9.66437 2.60207C10.0447 2.25979 10.622 2.2598 11.0023 2.60207L15.8591 6.97318C16.5936 7.63423 17.5468 8 18.5349 8H20V9H18.5349C17.2998 9 16.1083 8.54278 15.1901 7.71648L10.3333 3.34539Z', className: 'dark:fill-neutral-600' })] }));
3477
+ }
3478
+
3479
+ function Input({ checked, className, defaultValue, description, descriptionProps, disabled, fieldProps, invalid = true, label, labelProps, name, onBlur, onChange, placeholder, ref, required = true, type, value, ...props }) {
3480
+ const [formContext, setFormContext] = useFormContext(), [errorMessage, setErrorMessage] = React.useState(undefined);
3481
+ if (placeholder === '*')
3482
+ placeholder = name + (required && !label ? '*' : '');
3483
+ if (label === '*')
3484
+ label = name;
3485
+ const uniqueID = React.useId(), fieldContextID = toLowerCase(name, [, '_']) + '§' + uniqueID;
3486
+ if (Boolean(formContext?.find(field => field.id === fieldContextID)?.invalid))
3487
+ invalid = true;
3488
+ const getFieldContextType = () => {
3489
+ switch (type) {
3490
+ case 'email':
3491
+ return 'email';
3492
+ case 'file':
3493
+ return 'file';
3494
+ case 'number':
3495
+ return 'number';
3496
+ case 'tel':
3497
+ return 'tel';
3498
+ case 'url':
3499
+ return 'url';
3500
+ default:
3501
+ return 'string';
3502
+ }
3503
+ };
3504
+ const fieldContextType = getFieldContextType();
3505
+ const initialFieldContext = defineField({
3506
+ type: fieldContextType,
3507
+ id: fieldContextID,
3508
+ invalid,
3509
+ name,
3510
+ required,
3511
+ value: value ? `${value}` : defaultValue ? `${defaultValue}` : '',
3512
+ });
3513
+ React.useEffect(() => {
3514
+ if (!setFormContext)
3515
+ return;
3516
+ setFormContext(prevContext => {
3517
+ const otherFields = (prevContext || []).filter(field => field.id !== initialFieldContext.id);
3518
+ return [...otherFields, initialFieldContext];
3519
+ });
3520
+ return () => {
3521
+ setFormContext(prevContext => (prevContext || []).filter(field => field.id !== initialFieldContext.id));
3522
+ };
3523
+ }, [setFormContext]);
3524
+ const fieldContext = formContext?.find(({ id: fieldID }) => fieldID === initialFieldContext.id) || initialFieldContext;
3525
+ const validateField = (validValue) => {
3526
+ const noValue = !validValue || validValue === '';
3527
+ if (!required && noValue)
3528
+ return true;
3529
+ const errorMessageList = [];
3530
+ if (noValue) {
3531
+ errorMessageList.push('This field is required.');
3532
+ setErrorMessage(errorMessageList.join(' '));
3533
+ return false;
3534
+ }
3535
+ switch (type) {
3536
+ case 'email':
3537
+ if (!isEmail(validValue))
3538
+ errorMessageList.push('This is not a valid email.');
3539
+ break;
3540
+ case 'number':
3541
+ if (isNaN(Number(validValue)))
3542
+ errorMessageList.push('This is not a valid number.');
3543
+ break;
3544
+ case 'tel':
3545
+ if (!isPhoneNumber(validValue))
3546
+ errorMessageList.push('This is not a valid phone number.');
3547
+ break;
3548
+ }
3549
+ if (errorMessageList.length === 0)
3550
+ return true;
3551
+ setErrorMessage(errorMessageList.join(' '));
3552
+ return false;
3553
+ };
3554
+ const handleChange = e => {
3555
+ if (disabled) {
3556
+ e.preventDefault();
3557
+ return;
3558
+ }
3559
+ const { currentTarget } = e, { value: newValue } = currentTarget;
3560
+ setFormContext?.(prevContext => {
3561
+ if (!prevContext)
3562
+ return [];
3563
+ const field = prevContext.find(({ id: fieldID }) => fieldID === initialFieldContext.id);
3564
+ if (!field)
3565
+ throw new Error(`Field with id "${initialFieldContext.id}" not found in form context.`);
3566
+ const otherFields = prevContext.filter(({ id: fieldID }) => fieldID !== initialFieldContext.id);
3567
+ const updatedField = { ...field, value: newValue };
3568
+ const invalidField = validateField(newValue) === false;
3569
+ if (invalidField !== field.invalid)
3570
+ updatedField.invalid = invalidField;
3571
+ return [...otherFields, updatedField];
3572
+ });
3573
+ onChange?.(e);
3574
+ };
3575
+ const handleBlur = e => {
3576
+ if (disabled) {
3577
+ e.preventDefault();
3578
+ return;
3579
+ }
3580
+ const { currentTarget } = e, { value: newValue } = currentTarget;
3581
+ if (required)
3582
+ validateField(newValue);
3583
+ switch (type) {
3584
+ case 'email':
3585
+ setFormContext?.(prevContext => {
3586
+ if (!prevContext)
3587
+ return [];
3588
+ const field = prevContext.find(({ id: fieldID }) => fieldID === initialFieldContext.id);
3589
+ if (!field)
3590
+ throw new Error(`Field with id "${initialFieldContext.id}" not found in form context.`);
3591
+ const otherFields = prevContext.filter(({ id: fieldID }) => fieldID !== initialFieldContext.id);
3592
+ const updatedField = { ...field, value: newValue.toLowerCase() };
3593
+ return [...otherFields, updatedField];
3594
+ });
3595
+ break;
3596
+ case 'tel':
3597
+ setFormContext?.(prevContext => {
3598
+ if (!prevContext)
3599
+ return [];
3600
+ const field = prevContext.find(({ id: fieldID }) => fieldID === initialFieldContext.id);
3601
+ if (!field)
3602
+ throw new Error(`Field with id "${initialFieldContext.id}" not found in form context.`);
3603
+ const otherFields = prevContext.filter(({ id: fieldID }) => fieldID !== initialFieldContext.id);
3604
+ const updatedField = { ...field, value: formatPhoneNumber(newValue, '1') };
3605
+ return [...otherFields, updatedField];
3606
+ });
3607
+ break;
3608
+ }
3609
+ onBlur?.(e);
3610
+ };
3611
+ const restFieldProps = fieldProps
3612
+ ? Object.fromEntries(Object.entries(fieldProps).filter(([key]) => key !== 'className'))
3613
+ : {};
3614
+ const restLabelProps = labelProps
3615
+ ? Object.fromEntries(Object.entries(labelProps).filter(([key]) => key !== 'className'))
3616
+ : {};
3617
+ const restDescriptionProps = descriptionProps
3618
+ ? Object.fromEntries(Object.entries(descriptionProps).filter(([key]) => key !== 'className'))
3619
+ : {};
3620
+ return (jsxRuntime.jsxs(react.Field, { ...restFieldProps, className: bag => twMerge('grid gap-1', typeof fieldProps?.className === 'function' ? fieldProps?.className(bag) : fieldProps?.className), disabled: disabled, children: [label && (jsxRuntime.jsx(react.Label, { ...restLabelProps, className: bag => twMerge('text-sm font-medium', required ? 'after:text-ui-red after:content-["_*"]' : '', typeof labelProps?.className === 'function' ? labelProps?.className(bag) : labelProps?.className), children: label })), jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx(react.Input, { ...props, className: bag => twMerge(
3621
+ // Base styles
3622
+ 'w-full rounded-xl border-1 border-neutral-500/50 bg-neutral-100 py-1 pl-2 text-neutral-950 outline-offset-1 outline-ui-sky-blue/95 transition-[background-color] duration-300 ease-exponential dark:bg-neutral-700 dark:text-neutral-50',
3623
+ // Pseudo styles
3624
+ 'focus-visible:bg-neutral-50 focus-visible:outline-3 active:bg-neutral-200 dark:focus-visible:bg-neutral-600 dark:active:bg-neutral-800 pointer-fine:hover:bg-neutral-50 pointer-fine:active:bg-neutral-200 dark:pointer-fine:hover:bg-neutral-600 dark:pointer-fine:active:bg-neutral-800',
3625
+ // user-invalid styles
3626
+ 'user-invalid:border-ui-red user-invalid:bg-[color-mix(in_oklab,var(--color-ui-red)_20%,var(--color-neutral-100))] user-invalid:focus-visible:bg-[color-mix(in_oklab,var(--color-ui-red)_1%,var(--color-neutral-100))] user-invalid:active:bg-[color-mix(in_oklab,var(--color-ui-red)_25%,var(--color-neutral-100))] dark:user-invalid:bg-[color-mix(in_oklab,var(--color-ui-red)_20%,var(--color-neutral-800))] dark:user-invalid:focus-visible:bg-[color-mix(in_oklab,var(--color-ui-red)_1%,var(--color-neutral-800))] dark:user-invalid:active:bg-[color-mix(in_oklab,var(--color-ui-red)_25%,var(--color-neutral-800))] user-invalid:pointer-fine:hover:bg-[color-mix(in_oklab,var(--color-ui-red)_10%,var(--color-neutral-100))] user-invalid:pointer-fine:focus-visible:bg-[color-mix(in_oklab,var(--color-ui-red)_1%,var(--color-neutral-100))] user-invalid:pointer-fine:active:bg-[color-mix(in_oklab,var(--color-ui-red)_25%,var(--color-neutral-100))] dark:user-invalid:pointer-fine:hover:bg-[color-mix(in_oklab,var(--color-ui-red)_10%,var(--color-neutral-800))] dark:user-invalid:pointer-fine:focus-visible:bg-[color-mix(in_oklab,var(--color-ui-red)_1%,var(--color-neutral-800))] dark:user-invalid:pointer-fine:active:bg-[color-mix(in_oklab,var(--color-ui-red)_25%,var(--color-neutral-800))]',
3627
+ // Custom styles
3628
+ typeof className === 'function' ? className(bag) : className), invalid: invalid, onBlur: handleBlur, onChange: handleChange, placeholder: placeholder, ref: ref, required: required, type: type, value: fieldContext?.value }), fieldContext.invalid && errorMessage && (jsxRuntime.jsxs(Tooltip, { anchor: 'top-end', arrow: true, portal: true, children: [jsxRuntime.jsx(TooltipTrigger, { as: Button, className: 'absolute top-1.25 right-1.25 z-10 size-6 min-w-0', padding: 'none', rounded: 'md', theme: 'red', children: jsxRuntime.jsx(ExclamationmarkOctagon, { className: 'absolute top-1/2 left-1/2 size-full -translate-x-1/2 -translate-y-1/2 scale-70' }) }), jsxRuntime.jsx(TooltipPanel, { children: errorMessage })] }))] }), description && (jsxRuntime.jsx(react.Description, { ...restDescriptionProps, className: bag => twMerge('text-xs', typeof descriptionProps?.className === 'function'
3629
+ ? descriptionProps?.className(bag)
3630
+ : descriptionProps?.className), children: description }))] }));
3631
+ }
3632
+
3633
+ function SubmitButton({ children, className, customTheme, error, incomplete, loading, success, type = 'submit', ...props }) {
3634
+ const [formStatus] = useFormStatus();
3635
+ const getFormStatusButtonClasses = () => {
3636
+ switch (formStatus) {
3637
+ case 'loading':
3638
+ return twSort('animate-pulse cursor-wait text-lg leading-6 font-black tracking-widest');
3639
+ case 'error':
3640
+ case 'success':
3641
+ return 'cursor-not-allowed';
3642
+ default:
3643
+ return undefined;
3644
+ }
3645
+ };
3646
+ const formStatusButtonClasses = getFormStatusButtonClasses();
3647
+ const getButtonText = () => {
3648
+ switch (formStatus) {
3649
+ case 'incomplete':
3650
+ return incomplete || 'Complete Form';
3651
+ case 'loading':
3652
+ return (loading || (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("span", { className: 'inline-block animate-wave animation-delay-300', children: "\u2022" }), jsxRuntime.jsx("span", { className: 'inline-block animate-wave animation-delay-150', children: "\u2022" }), jsxRuntime.jsx("span", { className: 'inline-block animate-wave', children: "\u2022" })] })));
3653
+ case 'error':
3654
+ return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [error || 'Error', ' ', jsxRuntime.jsx("span", { className: 'absolute top-1/2 ml-1.5 translate-y-[calc(-50%-1.5px)] text-2xl', children: "\u00D7" })] }));
3655
+ case 'success':
3656
+ return success || 'Successfully Submitted';
3657
+ default:
3658
+ return children || 'Submit';
3659
+ }
3660
+ };
3661
+ const buttonText = getButtonText();
3662
+ const getDataFormState = () => {
3663
+ switch (formStatus) {
3664
+ case 'error':
3665
+ return { 'data-error': true };
3666
+ case 'incomplete':
3667
+ return { 'data-incomplete': true };
3668
+ case 'loading':
3669
+ return { 'data-loading': true };
3670
+ case 'readonly':
3671
+ return { 'data-readonly': true };
3672
+ case 'ready':
3673
+ return { 'data-ready': true };
3674
+ case 'success':
3675
+ return { 'data-success': true };
3676
+ default:
3677
+ return {};
3678
+ }
3679
+ };
3680
+ const dataFormState = getDataFormState();
3681
+ return (jsxRuntime.jsx(Button, { ...props, ...dataFormState, as: 'button', className: twMerge([formStatusButtonClasses, 'w-full text-white data-loading:text-black', className]), customTheme: {
3682
+ themeColor: twMerge('data-error:[--theme-color:var(--color-ui-red)] data-incomplete:[--theme-color:var(--color-ui-grey)] data-loading:[--theme-color:var(--color-ui-yellow)] data-readonly:[--theme-color:var(--color-ui-grey)] data-ready:[--theme-color:var(--color-ui-blue)] data-success:[--theme-color:var(--color-ui-green)]', customTheme?.themeColor),
3683
+ }, theme: 'custom', type: type, children: buttonText }));
3684
+ }
3685
+
3686
+ function Textarea({ className, defaultValue, description, descriptionProps, disabled, fieldProps, invalid = true, label, labelProps, name, onBlur, onChange, placeholder, ref, required = true, value, ...props }) {
3687
+ const [formContext, setFormContext] = useFormContext(), [errorMessage, setErrorMessage] = React.useState(undefined);
3688
+ if (placeholder === '*')
3689
+ placeholder = name + (required && !label ? '*' : '');
3690
+ if (label === '*')
3691
+ label = name;
3692
+ const uniqueID = React.useId(), fieldContextID = toLowerCase(name, [, '_']) + '§' + uniqueID;
3693
+ if (Boolean(formContext?.find(field => field.id === fieldContextID)?.invalid))
3694
+ invalid = true;
3695
+ const initialFieldContext = defineField({
3696
+ type: 'textarea',
3697
+ id: fieldContextID,
3698
+ invalid,
3699
+ name,
3700
+ required,
3701
+ value: value ? `${value}` : defaultValue ? `${defaultValue}` : '',
3702
+ });
3703
+ React.useEffect(() => {
3704
+ if (!setFormContext)
3705
+ return;
3706
+ setFormContext(prevContext => {
3707
+ const otherFields = (prevContext || []).filter(field => field.id !== initialFieldContext.id);
3708
+ return [...otherFields, initialFieldContext];
3709
+ });
3710
+ return () => {
3711
+ setFormContext(prevContext => (prevContext || []).filter(field => field.id !== initialFieldContext.id));
3712
+ };
3713
+ }, [setFormContext]);
3714
+ const fieldContext = formContext?.find(({ id: fieldID }) => fieldID === initialFieldContext.id) || initialFieldContext;
3715
+ const validateField = (validValue) => {
3716
+ const noValue = !validValue || validValue === '';
3717
+ if (!required && noValue)
3718
+ return true;
3719
+ const errorMessageList = [];
3720
+ if (noValue) {
3721
+ errorMessageList.push('This field is required.');
3722
+ setErrorMessage(errorMessageList.join(' '));
3723
+ return false;
3724
+ }
3725
+ if (errorMessageList.length === 0)
3726
+ return true;
3727
+ setErrorMessage(errorMessageList.join(' '));
3728
+ return false;
3729
+ };
3730
+ const handleChange = e => {
3731
+ if (disabled) {
3732
+ e.preventDefault();
3733
+ return;
3734
+ }
3735
+ const { currentTarget } = e, { value: newValue } = currentTarget;
3736
+ setFormContext?.(prevContext => {
3737
+ if (!prevContext)
3738
+ return [];
3739
+ const field = prevContext.find(({ id: fieldID }) => fieldID === initialFieldContext.id);
3740
+ if (!field)
3741
+ throw new Error(`Field with id "${initialFieldContext.id}" not found in form context.`);
3742
+ const otherFields = prevContext.filter(({ id: fieldID }) => fieldID !== initialFieldContext.id);
3743
+ const updatedField = { ...field, value: newValue };
3744
+ const invalidField = validateField(newValue) === false;
3745
+ if (invalidField !== field.invalid)
3746
+ updatedField.invalid = invalidField;
3747
+ return [...otherFields, updatedField];
3748
+ });
3749
+ onChange?.(e);
3750
+ };
3751
+ const restFieldProps = fieldProps
3752
+ ? Object.fromEntries(Object.entries(fieldProps).filter(([key]) => key !== 'className'))
3753
+ : {};
3754
+ const restLabelProps = labelProps
3755
+ ? Object.fromEntries(Object.entries(labelProps).filter(([key]) => key !== 'className'))
3756
+ : {};
3757
+ const restDescriptionProps = descriptionProps
3758
+ ? Object.fromEntries(Object.entries(descriptionProps).filter(([key]) => key !== 'className'))
3759
+ : {};
3760
+ return (jsxRuntime.jsxs(react.Field, { ...restFieldProps, className: bag => twMerge('grid gap-1', typeof fieldProps?.className === 'function' ? fieldProps?.className(bag) : fieldProps?.className), disabled: disabled, children: [label && (jsxRuntime.jsx(react.Label, { ...restLabelProps, className: bag => twMerge('text-sm font-medium', required ? 'after:text-ui-red after:content-["_*"]' : '', typeof labelProps?.className === 'function' ? labelProps?.className(bag) : labelProps?.className), children: label })), jsxRuntime.jsxs("div", { className: 'z-10 -mb-1.5', children: [jsxRuntime.jsx(react.Textarea, { ...props, className: bag => twMerge(
3761
+ // Base styles
3762
+ 'field-sizing-content w-full resize-none rounded-xl border-1 border-neutral-500/50 bg-neutral-100 py-1 pl-2 text-neutral-950 outline-offset-1 outline-ui-sky-blue/95 transition-[background-color] duration-300 ease-exponential dark:bg-neutral-700 dark:text-neutral-50',
3763
+ // Pseudo styles
3764
+ 'focus-visible:bg-neutral-50 focus-visible:outline-3 active:bg-neutral-200 dark:focus-visible:bg-neutral-600 dark:active:bg-neutral-800 pointer-fine:hover:bg-neutral-50 pointer-fine:active:bg-neutral-200 dark:pointer-fine:hover:bg-neutral-600 dark:pointer-fine:active:bg-neutral-800',
3765
+ // user-invalid styles
3766
+ 'user-invalid:border-ui-red user-invalid:bg-[color-mix(in_oklab,var(--color-ui-red)_20%,var(--color-neutral-100))] user-invalid:focus-visible:bg-[color-mix(in_oklab,var(--color-ui-red)_1%,var(--color-neutral-100))] user-invalid:active:bg-[color-mix(in_oklab,var(--color-ui-red)_25%,var(--color-neutral-100))] dark:user-invalid:bg-[color-mix(in_oklab,var(--color-ui-red)_20%,var(--color-neutral-800))] dark:user-invalid:focus-visible:bg-[color-mix(in_oklab,var(--color-ui-red)_1%,var(--color-neutral-800))] dark:user-invalid:active:bg-[color-mix(in_oklab,var(--color-ui-red)_25%,var(--color-neutral-800))] user-invalid:pointer-fine:hover:bg-[color-mix(in_oklab,var(--color-ui-red)_10%,var(--color-neutral-100))] user-invalid:pointer-fine:focus-visible:bg-[color-mix(in_oklab,var(--color-ui-red)_1%,var(--color-neutral-100))] user-invalid:pointer-fine:active:bg-[color-mix(in_oklab,var(--color-ui-red)_25%,var(--color-neutral-100))] dark:user-invalid:pointer-fine:hover:bg-[color-mix(in_oklab,var(--color-ui-red)_10%,var(--color-neutral-800))] dark:user-invalid:pointer-fine:focus-visible:bg-[color-mix(in_oklab,var(--color-ui-red)_1%,var(--color-neutral-800))] dark:user-invalid:pointer-fine:active:bg-[color-mix(in_oklab,var(--color-ui-red)_25%,var(--color-neutral-800))]',
3767
+ // Custom styles
3768
+ typeof className === 'function' ? className(bag) : className), id: fieldContext?.id, invalid: invalid, onChange: handleChange, placeholder: placeholder, ref: ref, required: required, value: fieldContext?.value }), fieldContext.invalid && errorMessage && (jsxRuntime.jsxs(Tooltip, { anchor: 'top-end', arrow: true, portal: true, children: [jsxRuntime.jsx(TooltipTrigger, { as: Button, className: 'absolute top-1.25 right-1.25 z-10 size-6 min-w-0', padding: 'none', rounded: 'md', theme: 'red', children: jsxRuntime.jsx(ExclamationmarkOctagon, { className: 'absolute top-1/2 left-1/2 size-full -translate-x-1/2 -translate-y-1/2 scale-70' }) }), jsxRuntime.jsx(TooltipPanel, { children: errorMessage })] }))] }), description && (jsxRuntime.jsx(react.Description, { ...restDescriptionProps, className: bag => twMerge('text-xs', typeof descriptionProps?.className === 'function'
3769
+ ? descriptionProps?.className(bag)
3770
+ : descriptionProps?.className), children: description }))] }));
3771
+ }
3772
+
3773
+ // import { findComponentByType } from '../../utils'
3774
+ function FormComponent({ as, children, className, handleSubmit, onError, onSubmit, onSuccess, ...props }) {
3775
+ const [formContext] = useFormContext(), [formStatus, setFormStatus] = useFormStatus();
3776
+ // const submitButton = findComponentByType(children, SubmitButton)
3777
+ React.useEffect(() => {
3778
+ if (!formContext)
3779
+ return;
3780
+ if (formStatus !== 'incomplete' && formContext.find(({ invalid }) => invalid))
3781
+ setFormStatus?.('incomplete');
3782
+ if (formStatus !== 'ready' && formContext.every(({ invalid }) => !invalid))
3783
+ setFormStatus?.('ready');
3784
+ }, [formContext]);
3785
+ const processSubmit = handleSubmit ||
3786
+ (async (e) => {
3787
+ e.preventDefault();
3788
+ e.stopPropagation();
3789
+ setFormStatus?.('loading');
3790
+ const response = await onSubmit?.({ event: e, formContext });
3791
+ if (response && ('error' in response || response.status === 'error')) {
3792
+ setFormStatus?.('error');
3793
+ onError?.({ event: e, error: response.error || 'An error occurred when submitting the form.', formContext });
3794
+ return;
3795
+ }
3796
+ if ((response && response.status === 'success') || !response) {
3797
+ setFormStatus?.('success');
3798
+ onSuccess?.({ event: e, formContext });
3799
+ }
3800
+ });
3801
+ const FormElement = as || 'form';
3802
+ return (jsxRuntime.jsx(FormElement, { ...props, className: twMerge(className, 'grid gap-3'), onSubmit: processSubmit, children: children }));
3803
+ }
3804
+ function Form({ controlled = 'auto', initialStatus = 'incomplete', ...props }) {
3805
+ const FormContextOrNotProvider = controlled === 'auto' ? FormContextProvider : React.Fragment;
3806
+ return (jsxRuntime.jsx(FormStatusProvider, { initialStatus: initialStatus, children: jsxRuntime.jsx(FormContextOrNotProvider, { children: jsxRuntime.jsx(FormComponent, { ...props }) }) }));
3807
+ }
3808
+
3809
+ function Ghost({ children, className, ...props }) {
3810
+ return (jsxRuntime.jsx("div", { ...props, className: twMerge('block w-24 max-w-full animate-pulse rounded bg-white/50', className), children: children || jsxRuntime.jsx(jsxRuntime.Fragment, { children: "\u00A0" }) }));
3811
+ }
3812
+
3813
+ function getTextFromChildren(children) {
3814
+ let text = '';
3815
+ React.Children.forEach(children, child => {
3816
+ if (typeof child === 'string' || typeof child === 'number') {
3817
+ text += child;
3818
+ }
3819
+ else if (React.isValidElement(child)) {
3820
+ text += getTextFromChildren(child.props.children);
3821
+ }
3822
+ });
3823
+ return text;
3824
+ }
3825
+ /**
3826
+ * # Heading
3827
+ * A heading component that renders HTML heading elements (h1-h6) with appropriate styling.
3828
+ * Automatically generates an ID for the heading based on its content if none is provided.
3829
+ */
3830
+ function Heading({ as = 'h2', children, customize, className, id, ref, ...props }) {
3831
+ const H = as;
3832
+ const targetableID = id || getTextFromChildren(children).replace(/\s+/g, '-').toLowerCase();
3833
+ const getBaseClasses = () => {
3834
+ switch (as) {
3835
+ case 'h1':
3836
+ return twMerge('pb-2.5 text-6xl font-black last:pb-0', customize?.h1);
3837
+ case 'h3':
3838
+ return twMerge('pb-2 text-4xl font-extralight last:pb-0', customize?.h3);
3839
+ case 'h4':
3840
+ return twMerge('pb-2 text-3xl font-extrabold last:pb-0', customize?.h4);
3841
+ case 'h5':
3842
+ return twMerge('pb-1.5 text-2xl font-semibold last:pb-0', customize?.h5);
3843
+ case 'h6':
3844
+ return twMerge('pb-1 text-xl font-bold last:pb-0', customize?.h6);
3845
+ default:
3846
+ return twMerge('pb-2.5 text-5xl font-medium last:pb-0', customize?.h2);
3847
+ }
3848
+ };
3849
+ const baseClasses = getBaseClasses();
3850
+ return (jsxRuntime.jsx(H, { ref: ref, id: targetableID, ...props, className: twMerge(baseClasses, className), children: children }));
3851
+ }
3852
+
3853
+ function ModalTrigger({ as, ...props }) {
3854
+ const Element = as || react.Button;
3855
+ return jsxRuntime.jsx(Element, { ...props });
3856
+ }
3857
+ function ModalDialog(props) {
3858
+ return jsxRuntime.jsx("div", { ...props });
3859
+ }
3860
+ function Modal({ children, className, onClose, onOpen, place = 'bottom' }) {
3861
+ const [bodyElement, setBodyElement] = React.useState(null);
3862
+ React.useEffect(() => {
3863
+ if (!bodyElement && typeof window !== 'undefined')
3864
+ setBodyElement(document.body);
3865
+ }, [bodyElement]);
3866
+ const [isOpen, setIsOpen] = React.useState(false);
3867
+ const dialogPanelRef = React.useRef(null), dragMoveBoxRef = React.useRef(null),
3868
+ // lastTouchYRef = useRef(0),
3869
+ startDragCoords = React.useRef({ x: 0, y: 0 });
3870
+ const [allowDragClose, setAllowDragClose] = React.useState(false), [readyToClose, setReadyToClose] = React.useState(false);
3871
+ const openModal = () => {
3872
+ if (isOpen)
3873
+ return;
3874
+ setIsOpen(true);
3875
+ onOpen?.();
3876
+ };
3877
+ const closeModal = () => {
3878
+ if (!isOpen)
3879
+ return;
1593
3880
  setIsOpen(false);
1594
3881
  onClose?.();
1595
3882
  };
@@ -1664,28 +3951,28 @@ function Modal({ children, className, onClose, onOpen, place = 'bottom' }) {
1664
3951
  }
1665
3952
  return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [allowDragClose &&
1666
3953
  bodyElement &&
1667
- reactDom.createPortal(jsxRuntime.jsx("div", { ref: dragMoveBoxRef, className: 'z-99 pointer-coarse:hidden fixed inset-0 h-dvh w-screen bg-transparent active:cursor-grabbing', onMouseMove: handleMouseMove, onMouseUp: disableMouseDragClose }), bodyElement), triggerElement &&
1668
- react.cloneElement(triggerElement, { onClick: openModal }), jsxRuntime.jsxs(react$1.Dialog, { open: isOpen, onClose: closeModal, className: [
3954
+ ReactDOM.createPortal(jsxRuntime.jsx("div", { ref: dragMoveBoxRef, className: 'fixed inset-0 z-99 h-dvh w-screen bg-transparent active:cursor-grabbing pointer-coarse:hidden', onMouseMove: handleMouseMove, onMouseUp: disableMouseDragClose }), bodyElement), triggerElement &&
3955
+ React.cloneElement(triggerElement, { onClick: openModal }), jsxRuntime.jsxs(react.Dialog, { open: isOpen, onClose: closeModal, className: [
1669
3956
  'isolate z-50',
1670
3957
  place === 'bottom' &&
1671
3958
  'after:fixed after:inset-x-0 after:bottom-0 after:-z-10 after:h-16 after:bg-neutral-50 sm:after:hidden',
1672
- ].join(' '), children: [jsxRuntime.jsx(react$1.DialogBackdrop, { transition: true, className: [
1673
- 'duration-750 ease-exponential data-closed:opacity-0 fixed inset-0 cursor-pointer transition-[opacity_background-color_backdrop-filter_-webkit-backdrop-filter] delay-100',
3959
+ ].join(' '), children: [jsxRuntime.jsx(react.DialogBackdrop, { transition: true, className: [
3960
+ 'fixed inset-0 cursor-pointer transition-[opacity_background-color_backdrop-filter_-webkit-backdrop-filter] delay-100 duration-750 ease-exponential data-closed:opacity-0',
1674
3961
  readyToClose
1675
3962
  ? 'bg-neutral-50/5 backdrop-blur-[1px] dark:bg-neutral-950/5'
1676
3963
  : 'bg-neutral-50/25 backdrop-blur-sm dark:bg-neutral-950/25',
1677
- ].join(' '), children: jsxRuntime.jsx(Button, { theme: 'blue', padding: 'none', rounded: 'full', className: 'group/button pointer-fine:hover:w-20 fixed right-4 top-4 h-7 w-7 overflow-x-hidden transition-[scale_width_filter]', children: jsxRuntime.jsxs("div", { className: 'pointer-fine:group-hover/button:-translate-x-0.5 ease-exponential absolute right-1 top-1 flex items-center gap-1 pt-px transition-transform duration-300', children: [jsxRuntime.jsxs("span", { className: 'block text-xs font-medium uppercase leading-none text-neutral-50', children: ["Close", jsxRuntime.jsx("span", { className: 'sr-only', children: " Modal" })] }), jsxRuntime.jsx(xmark, { className: '-top-px block size-5 rotate-90 scale-75 fill-white stroke-white stroke-1 transition-transform duration-300 ease-in-out group-hover/button:rotate-0' })] }) }) }), jsxRuntime.jsxs(react$1.DialogPanel, { ref: dialogPanelRef, transition: true, className: twMerge('duration-750 ease-exponential data-closed:opacity-0 data-closed:scale-50 fixed left-1/2 -translate-x-1/2 overflow-y-scroll bg-neutral-50 p-4 shadow-[0_-15px_50px_-12px] shadow-neutral-950/25 transition-[transform_translate_opacity] sm:w-[calc(100vw-2rem)] sm:max-w-fit sm:p-6 sm:shadow-2xl lg:p-8 dark:bg-neutral-900', place === 'center'
1678
- ? 'data-enter:translate-y-[calc(-50%+12rem)] data-leave:translate-y-[calc(-50%-8rem)] top-1/2 -translate-y-1/2 rounded-2xl'
1679
- : 'rounded-t-4xl pointer-fine:top-1/2 pointer-fine:bottom-auto pointer-fine:-translate-y-1/2 pointer-fine:rounded-2xl data-enter:translate-y-full sm:data-enter:translate-y-[calc(-50%+12rem)] data-leave:translate-y-full sm:data-leave:translate-y-[calc(-50%-8rem)] sm:data-open:-translate-y-1/2 bottom-0 h-fit max-h-[calc(100dvh-4rem)] translate-y-0 sm:bottom-auto sm:top-1/2 sm:rounded-b-2xl sm:rounded-t-2xl', className), children: [jsxRuntime.jsx("button", { onTouchStart: enableTouchClose, onMouseDown: enableMouseClose, className: [
1680
- 'after:ease-exponential absolute inset-x-0 top-0 z-10 flex h-6 cursor-grab items-center justify-center after:h-1 after:w-8 after:rounded-full after:transition-[transform_background-color] after:duration-500 active:cursor-grabbing',
3964
+ ].join(' '), children: jsxRuntime.jsx(Button, { theme: 'blue', padding: 'none', rounded: 'full', className: 'group/button fixed top-4 right-4 h-7 w-7 overflow-x-hidden transition-[scale_width_filter] pointer-fine:hover:w-20', children: jsxRuntime.jsxs("div", { className: 'absolute top-1 right-1 flex items-center gap-1 pt-px transition-transform duration-300 ease-exponential pointer-fine:group-hover/button:-translate-x-0.5', children: [jsxRuntime.jsxs("span", { className: 'block text-xs leading-none font-medium text-neutral-50 uppercase', children: ["Close", jsxRuntime.jsx("span", { className: 'sr-only', children: " Modal" })] }), jsxRuntime.jsx(xmark, { className: '-top-px block size-5 scale-75 rotate-90 fill-white stroke-white stroke-1 transition-transform duration-300 ease-in-out group-hover/button:rotate-0' })] }) }) }), jsxRuntime.jsxs(react.DialogPanel, { ref: dialogPanelRef, transition: true, className: twMerge('fixed left-1/2 -translate-x-1/2 overflow-y-scroll bg-neutral-50 p-4 shadow-[0_-15px_50px_-12px] shadow-neutral-950/25 transition-[transform_translate_opacity] duration-750 ease-exponential data-closed:scale-50 data-closed:opacity-0 sm:w-[calc(100vw-2rem)] sm:max-w-fit sm:p-6 sm:shadow-2xl lg:p-8 dark:bg-neutral-900', place === 'center'
3965
+ ? 'top-1/2 -translate-y-1/2 rounded-2xl data-enter:translate-y-[calc(-50%+12rem)] data-leave:translate-y-[calc(-50%-8rem)]'
3966
+ : 'bottom-0 h-fit max-h-[calc(100dvh-4rem)] translate-y-0 rounded-t-4xl data-enter:translate-y-full data-leave:translate-y-full sm:top-1/2 sm:bottom-auto sm:rounded-t-2xl sm:rounded-b-2xl sm:data-enter:translate-y-[calc(-50%+12rem)] sm:data-leave:translate-y-[calc(-50%-8rem)] sm:data-open:-translate-y-1/2 pointer-fine:top-1/2 pointer-fine:bottom-auto pointer-fine:-translate-y-1/2 pointer-fine:rounded-2xl', className), children: [jsxRuntime.jsx("button", { onTouchStart: enableTouchClose, onMouseDown: enableMouseClose, className: [
3967
+ 'absolute inset-x-0 top-0 z-10 flex h-6 cursor-grab items-center justify-center after:h-1 after:w-8 after:rounded-full after:transition-[transform_background-color] after:duration-500 after:ease-exponential active:cursor-grabbing',
1681
3968
  readyToClose
1682
3969
  ? 'after:scale-x-200 after:scale-y-200 after:bg-ui-blue'
1683
- : 'after:bg-ui-grey/50 active:after:bg-ui-grey pointer-fine:hover:after:scale-x-125 pointer-fine:hover:after:bg-neutral-500/75 pointer-fine:active:after:scale-x-150 pointer-fine:active:after:bg-ui-grey active:after:scale-x-150 active:after:scale-y-125',
3970
+ : 'after:bg-ui-grey/50 active:after:scale-x-150 active:after:scale-y-125 active:after:bg-ui-grey pointer-fine:hover:after:scale-x-125 pointer-fine:hover:after:bg-neutral-500/75 pointer-fine:active:after:scale-x-150 pointer-fine:active:after:bg-ui-grey',
1684
3971
  ].join(' '), children: jsxRuntime.jsx("span", { className: 'sr-only', children: "Drag down to close" }) }), dialogElement] })] })] }));
1685
3972
  }
1686
3973
 
1687
3974
  function Time({ children, dateObject, dateTime, day, hours, milliseconds, minutes, month, seconds, year, ref, ...props }) {
1688
- const [date, setDate] = react.useState(dateObject || undefined);
3975
+ const [date, setDate] = React.useState(dateObject || undefined);
1689
3976
  const getDateAndTime = () => {
1690
3977
  if (dateTime)
1691
3978
  return dateTime;
@@ -1724,7 +4011,7 @@ function Time({ children, dateObject, dateTime, day, hours, milliseconds, minute
1724
4011
  .join(' ');
1725
4012
  };
1726
4013
  const dateDisplay = getDateDisplay();
1727
- react.useEffect(() => {
4014
+ React.useEffect(() => {
1728
4015
  if (date === undefined &&
1729
4016
  dateObject === undefined &&
1730
4017
  dateTime === undefined &&
@@ -1771,6 +4058,9 @@ exports.ClockFill = ClockFill;
1771
4058
  exports.CloudFill = CloudFill;
1772
4059
  exports.CubeFill = CubeFill;
1773
4060
  exports.CurvePointLeft = CurvePointLeft;
4061
+ exports.Details = Details;
4062
+ exports.DetailsBody = DetailsBody;
4063
+ exports.DetailsSummary = DetailsSummary;
1774
4064
  exports.DialHigh = DialHigh;
1775
4065
  exports.DocFill = DocFill;
1776
4066
  exports.DocOnClipboard = DocOnClipboard;
@@ -1778,12 +4068,19 @@ exports.DocOnDoc = DocOnDoc;
1778
4068
  exports.DocOnDocFill = DocOnDocFill;
1779
4069
  exports.DocTextMagnifyingglass = DocOnMagnifyingglass;
1780
4070
  exports.DollarSign = DollarSign;
4071
+ exports.DropDown = DropDown;
4072
+ exports.DropDownButton = DropDownButton;
4073
+ exports.DropDownItem = DropDownItem;
4074
+ exports.DropDownItems = DropDownItems;
4075
+ exports.DropDownSection = DropDownSection;
4076
+ exports.DropDownSeparator = DropDownSeparator;
1781
4077
  exports.EllipsisCircle = EllipsisCircle;
1782
4078
  exports.EllipsisCircleFill = EllipsisCircleFill;
1783
4079
  exports.Envelope = Envelope;
1784
4080
  exports.EnvelopeFill = EnvelopeFill;
1785
4081
  exports.ExclamationmarkOctagon = ExclamationmarkOctagon;
1786
4082
  exports.Eye = Eye;
4083
+ exports.Fieldset = Fieldset;
1787
4084
  exports.FigureWaterFitness = FigureWaterFitness;
1788
4085
  exports.FlagFill = FlagFill;
1789
4086
  exports.FlameFill = FlameFill;
@@ -1848,11 +4145,15 @@ exports.ThreePeople = ThreePeople;
1848
4145
  exports.ThreeRectanglesDesktop = ThreeRectanglesDesktop;
1849
4146
  exports.ThreeRectanglesDesktopFill = ThreeRectanglesDesktopFill;
1850
4147
  exports.Time = Time;
4148
+ exports.Tooltip = Tooltip;
4149
+ exports.TooltipPanel = TooltipPanel;
4150
+ exports.TooltipTrigger = TooltipTrigger;
1851
4151
  exports.Trash = Trash;
1852
4152
  exports.TrashFill = TrashFill;
1853
4153
  exports.Tree = Tree;
1854
4154
  exports.UmbrellaFill = UmbrellaFill;
1855
4155
  exports.Xmark = xmark;
4156
+ exports.createFastContext = createFastContext;
1856
4157
  exports.defineField = defineField;
1857
4158
  exports.useFormContext = useFormContext;
1858
4159
  exports.useFormStatus = useFormStatus;