@nation-a/ui 0.4.0 → 0.5.1

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.cjs CHANGED
@@ -3,6 +3,23 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const jsxRuntime = require("react/jsx-runtime");
4
4
  const React = require("react");
5
5
  const reactDom = require("react-dom");
6
+ function _interopNamespaceDefault(e) {
7
+ const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
8
+ if (e) {
9
+ for (const k in e) {
10
+ if (k !== "default") {
11
+ const d = Object.getOwnPropertyDescriptor(e, k);
12
+ Object.defineProperty(n, k, d.get ? d : {
13
+ enumerable: true,
14
+ get: () => e[k]
15
+ });
16
+ }
17
+ }
18
+ }
19
+ n.default = e;
20
+ return Object.freeze(n);
21
+ }
22
+ const React__namespace = /* @__PURE__ */ _interopNamespaceDefault(React);
6
23
  function isObject$1(value) {
7
24
  return typeof value === "object" && value != null && !Array.isArray(value);
8
25
  }
@@ -74,14 +91,14 @@ function mergeProps$1(...sources) {
74
91
  }
75
92
  var isNotNullish = (element) => element != null;
76
93
  function walkObject(target, predicate, options = {}) {
77
- const { stop, getKey } = options;
94
+ const { stop: stop2, getKey } = options;
78
95
  function inner(value, path = []) {
79
96
  if (isObjectOrArray(value)) {
80
97
  const result = {};
81
98
  for (const [prop, child] of Object.entries(value)) {
82
99
  const key = (getKey == null ? void 0 : getKey(prop, child)) ?? prop;
83
100
  const childPath = [...path, key];
84
- if (stop == null ? void 0 : stop(value, childPath)) {
101
+ if (stop2 == null ? void 0 : stop2(value, childPath)) {
85
102
  return predicate(value, path);
86
103
  }
87
104
  const next = inner(child, childPath);
@@ -344,15 +361,15 @@ function cx() {
344
361
  }
345
362
  return str;
346
363
  }
347
- const defaults = (conf) => ({
364
+ const defaults$1 = (conf) => ({
348
365
  base: {},
349
366
  variants: {},
350
367
  defaultVariants: {},
351
368
  compoundVariants: [],
352
369
  ...conf
353
370
  });
354
- function cva(config) {
355
- const { base, variants, defaultVariants, compoundVariants } = defaults(config);
371
+ function cva(config2) {
372
+ const { base, variants, defaultVariants, compoundVariants } = defaults$1(config2);
356
373
  const getVariantProps = (variants2) => ({ ...defaultVariants, ...compact$1(variants2) });
357
374
  function resolve(props = {}) {
358
375
  var _a;
@@ -367,7 +384,7 @@ function cva(config) {
367
384
  return mergeCss(variantCss, compoundVariantCss);
368
385
  }
369
386
  function merge(__cva) {
370
- const override = defaults(__cva.config);
387
+ const override = defaults$1(__cva.config);
371
388
  const variantKeys2 = uniq(__cva.variantKeys, Object.keys(variants));
372
389
  return cva({
373
390
  base: mergeCss(base, override.base),
@@ -391,7 +408,7 @@ function cva(config) {
391
408
  variantMap,
392
409
  variantKeys,
393
410
  raw: resolve,
394
- config,
411
+ config: config2,
395
412
  merge,
396
413
  splitVariantProps,
397
414
  getVariantProps
@@ -412,18 +429,18 @@ function getCompoundVariantCss(compoundVariants, variantMap) {
412
429
  return result;
413
430
  }
414
431
  const slotClass = (className, slot) => className + "__" + slot;
415
- function sva(config) {
416
- const slots = Object.entries(getSlotRecipes(config)).map(([slot, slotCva]) => [slot, cva(slotCva)]);
417
- const defaultVariants = config.defaultVariants ?? {};
432
+ function sva(config2) {
433
+ const slots = Object.entries(getSlotRecipes(config2)).map(([slot, slotCva]) => [slot, cva(slotCva)]);
434
+ const defaultVariants = config2.defaultVariants ?? {};
418
435
  function svaFn(props) {
419
- const result = slots.map(([slot, cvaFn]) => [slot, cx(cvaFn(props), config.className && slotClass(config.className, slot))]);
436
+ const result = slots.map(([slot, cvaFn]) => [slot, cx(cvaFn(props), config2.className && slotClass(config2.className, slot))]);
420
437
  return Object.fromEntries(result);
421
438
  }
422
439
  function raw(props) {
423
440
  const result = slots.map(([slot, cvaFn]) => [slot, cvaFn.raw(props)]);
424
441
  return Object.fromEntries(result);
425
442
  }
426
- const variants = config.variants ?? {};
443
+ const variants = config2.variants ?? {};
427
444
  const variantKeys = Object.keys(variants);
428
445
  function splitVariantProps(props) {
429
446
  return splitProps(props, variantKeys);
@@ -461,7 +478,7 @@ const composeCvaFn = (cvaA, cvaB) => {
461
478
  (_a = TypeError.captureStackTrace) == null ? void 0 : _a.call(TypeError, error);
462
479
  throw error;
463
480
  };
464
- const getDisplayName = (Component) => {
481
+ const getDisplayName$1 = (Component) => {
465
482
  if (typeof Component === "string") return Component;
466
483
  return (Component == null ? void 0 : Component.displayName) || (Component == null ? void 0 : Component.name) || "Component";
467
484
  };
@@ -502,7 +519,7 @@ function styledFn(Dynamic, configOrCva = {}, options = {}) {
502
519
  className: classes()
503
520
  }, combinedProps.children ?? children);
504
521
  });
505
- const name = getDisplayName(__base__);
522
+ const name = getDisplayName$1(__base__);
506
523
  StyledComponent.displayName = `styled.${name}`;
507
524
  StyledComponent.__cva__ = __cvaFn__;
508
525
  StyledComponent.__base__ = __base__;
@@ -572,7 +589,7 @@ function createContext(options = {}) {
572
589
  }
573
590
  return [Context.Provider, useContext$1, Context];
574
591
  }
575
- function toArray(v2) {
592
+ function toArray$1(v2) {
576
593
  if (!v2) return [];
577
594
  return Array.isArray(v2) ? v2 : [v2];
578
595
  }
@@ -780,7 +797,7 @@ function nextTick(fn) {
780
797
  set2.forEach((fn2) => fn2());
781
798
  };
782
799
  }
783
- function raf$1(fn) {
800
+ function raf$2(fn) {
784
801
  let cleanup;
785
802
  const id = globalThis.requestAnimationFrame(() => {
786
803
  cleanup = fn();
@@ -918,8 +935,8 @@ function mergeProps(...args) {
918
935
  }
919
936
  return result;
920
937
  }
921
- function createMachine(config) {
922
- return config;
938
+ function createMachine(config2) {
939
+ return config2;
923
940
  }
924
941
  function createScope(props) {
925
942
  const getRootNode = () => {
@@ -1041,16 +1058,16 @@ function useMachine(machine2, userProps = {}) {
1041
1058
  prop,
1042
1059
  bindable: useBindable,
1043
1060
  scope,
1044
- flush,
1061
+ flush: flush$1,
1045
1062
  getContext() {
1046
- return ctx;
1063
+ return ctx2;
1047
1064
  },
1048
1065
  getComputed() {
1049
1066
  return computed;
1050
1067
  }
1051
1068
  });
1052
1069
  const contextRef = useLiveRef(context2);
1053
- const ctx = {
1070
+ const ctx2 = {
1054
1071
  get(key) {
1055
1072
  var _a2;
1056
1073
  return (_a2 = contextRef.current) == null ? void 0 : _a2[key].ref.current;
@@ -1092,10 +1109,10 @@ function useMachine(machine2, userProps = {}) {
1092
1109
  return !!((_b2 = (_a2 = machine2.states[state.ref.current]) == null ? void 0 : _a2.tags) == null ? void 0 : _b2.includes(tag));
1093
1110
  }
1094
1111
  });
1095
- const refs = useRefs(((_c = machine2.refs) == null ? void 0 : _c.call(machine2, { prop, context: ctx })) ?? {});
1112
+ const refs = useRefs(((_c = machine2.refs) == null ? void 0 : _c.call(machine2, { prop, context: ctx2 })) ?? {});
1096
1113
  const getParams = () => ({
1097
1114
  state: getState(),
1098
- context: ctx,
1115
+ context: ctx2,
1099
1116
  event: getEvent(),
1100
1117
  prop,
1101
1118
  send,
@@ -1104,7 +1121,7 @@ function useMachine(machine2, userProps = {}) {
1104
1121
  track: useTrack,
1105
1122
  refs,
1106
1123
  computed,
1107
- flush,
1124
+ flush: flush$1,
1108
1125
  scope,
1109
1126
  choose
1110
1127
  });
@@ -1143,7 +1160,7 @@ function useMachine(machine2, userProps = {}) {
1143
1160
  return () => cleanups2.forEach((fn) => fn == null ? void 0 : fn());
1144
1161
  };
1145
1162
  const choose = (transitions) => {
1146
- return toArray(transitions).find((t) => {
1163
+ return toArray$1(transitions).find((t) => {
1147
1164
  let result = !t.guard;
1148
1165
  if (isString(t.guard)) result = !!guard(t.guard);
1149
1166
  else if (isFunction(t.guard)) result = t.guard(getParams());
@@ -1154,7 +1171,7 @@ function useMachine(machine2, userProps = {}) {
1154
1171
  ensure(machine2.computed, `[zag-js] No computed object found on machine`);
1155
1172
  const fn = machine2.computed[key];
1156
1173
  return fn({
1157
- context: ctx,
1174
+ context: ctx2,
1158
1175
  event: getEvent(),
1159
1176
  prop,
1160
1177
  refs,
@@ -1237,7 +1254,7 @@ function useMachine(machine2, userProps = {}) {
1237
1254
  return {
1238
1255
  state: getState(),
1239
1256
  send,
1240
- context: ctx,
1257
+ context: ctx2,
1241
1258
  prop,
1242
1259
  scope,
1243
1260
  refs,
@@ -1256,7 +1273,7 @@ function useProp(value) {
1256
1273
  return ref.current[key];
1257
1274
  };
1258
1275
  }
1259
- function flush(fn) {
1276
+ function flush$1(fn) {
1260
1277
  queueMicrotask(() => {
1261
1278
  reactDom.flushSync(() => fn());
1262
1279
  });
@@ -1510,7 +1527,7 @@ function trackInteractOutsideImpl(node, options) {
1510
1527
  function onPointerDown(event) {
1511
1528
  function handler() {
1512
1529
  var _a;
1513
- const func = defer ? raf$1 : (v2) => v2();
1530
+ const func = defer ? raf$2 : (v2) => v2();
1514
1531
  const composedPath = ((_a = event.composedPath) == null ? void 0 : _a.call(event)) ?? [event.target];
1515
1532
  func(() => {
1516
1533
  if (!node || !isEventOutside(event)) return;
@@ -1545,7 +1562,7 @@ function trackInteractOutsideImpl(node, options) {
1545
1562
  cleanups2.add(frames.addEventListener("pointerdown", onPointerDown, true));
1546
1563
  }, 0);
1547
1564
  function onFocusin(event) {
1548
- const func = defer ? raf$1 : (v2) => v2();
1565
+ const func = defer ? raf$2 : (v2) => v2();
1549
1566
  func(() => {
1550
1567
  if (!node || !isEventOutside(event)) return;
1551
1568
  if (onFocusOutside || onInteractOutside) {
@@ -1574,7 +1591,7 @@ function trackInteractOutsideImpl(node, options) {
1574
1591
  }
1575
1592
  function trackInteractOutside(nodeOrFn, options) {
1576
1593
  const { defer } = options;
1577
- const func = defer ? raf$1 : (v2) => v2();
1594
+ const func = defer ? raf$2 : (v2) => v2();
1578
1595
  const cleanups2 = [];
1579
1596
  cleanups2.push(
1580
1597
  func(() => {
@@ -1769,7 +1786,7 @@ function trackDismissableElementImpl(node, options) {
1769
1786
  }
1770
1787
  function trackDismissableElement(nodeOrFn, options) {
1771
1788
  const { defer } = options;
1772
- const func = defer ? raf$1 : (v2) => v2();
1789
+ const func = defer ? raf$2 : (v2) => v2();
1773
1790
  const cleanups2 = [];
1774
1791
  cleanups2.push(
1775
1792
  func(() => {
@@ -1788,19 +1805,19 @@ const [RenderStrategyPropsProvider, useRenderStrategyPropsContext] = createConte
1788
1805
  });
1789
1806
  const splitRenderStrategyProps = (props) => createSplitProps()(props, ["lazyMount", "unmountOnExit"]);
1790
1807
  function useEvent(callback, opts = {}) {
1791
- const { sync = false } = opts;
1808
+ const { sync: sync2 = false } = opts;
1792
1809
  const callbackRef = useLatestRef(callback);
1793
1810
  return React.useCallback(
1794
1811
  // biome-ignore lint/suspicious/noExplicitAny: <explanation>
1795
1812
  (...args) => {
1796
1813
  var _a;
1797
- if (sync) return queueMicrotask(() => {
1814
+ if (sync2) return queueMicrotask(() => {
1798
1815
  var _a2;
1799
1816
  return (_a2 = callbackRef.current) == null ? void 0 : _a2.call(callbackRef, ...args);
1800
1817
  });
1801
1818
  return (_a = callbackRef.current) == null ? void 0 : _a.call(callbackRef, ...args);
1802
1819
  },
1803
- [sync, callbackRef]
1820
+ [sync2, callbackRef]
1804
1821
  );
1805
1822
  }
1806
1823
  function useLatestRef(value) {
@@ -1932,7 +1949,7 @@ var machine$1 = createMachine({
1932
1949
  if (!presentProp && (node == null ? void 0 : node.ownerDocument.visibilityState) === "hidden") {
1933
1950
  return send({ type: "UNMOUNT", src: "visibilitychange" });
1934
1951
  }
1935
- raf$1(() => {
1952
+ raf$2(() => {
1936
1953
  var _a, _b;
1937
1954
  const animationName = getAnimationName(refs.get("styles"));
1938
1955
  context2.set("unmountAnimationName", animationName);
@@ -1944,7 +1961,7 @@ var machine$1 = createMachine({
1944
1961
  });
1945
1962
  },
1946
1963
  setPrevAnimationName: ({ context: context2, refs }) => {
1947
- raf$1(() => {
1964
+ raf$2(() => {
1948
1965
  context2.set("prevAnimationName", getAnimationName(refs.get("styles")));
1949
1966
  });
1950
1967
  },
@@ -2119,13 +2136,13 @@ var hideOthers = (originalTarget, parentNode = getParentNode(originalTarget), ma
2119
2136
  controlAttribute: "aria-hidden"
2120
2137
  });
2121
2138
  };
2122
- var raf = (fn) => {
2139
+ var raf$1 = (fn) => {
2123
2140
  const frameId = requestAnimationFrame(() => fn());
2124
2141
  return () => cancelAnimationFrame(frameId);
2125
2142
  };
2126
2143
  function ariaHidden(targetsOrFn, options = {}) {
2127
2144
  const { defer = true } = options;
2128
- const func = defer ? raf : (v2) => v2();
2145
+ const func = defer ? raf$1 : (v2) => v2();
2129
2146
  const cleanups2 = [];
2130
2147
  cleanups2.push(
2131
2148
  func(() => {
@@ -2155,6 +2172,12 @@ const DialogBackdrop = React.forwardRef((props, ref) => {
2155
2172
  return /* @__PURE__ */ jsxRuntime.jsx(ark.div, { ...mergedProps, ref: composeRefs(presence.ref, ref) });
2156
2173
  });
2157
2174
  DialogBackdrop.displayName = "DialogBackdrop";
2175
+ const DialogCloseTrigger = React.forwardRef((props, ref) => {
2176
+ const dialog = useDialogContext();
2177
+ const mergedProps = mergeProps(dialog.getCloseTriggerProps(), props);
2178
+ return /* @__PURE__ */ jsxRuntime.jsx(ark.button, { ...mergedProps, ref });
2179
+ });
2180
+ DialogCloseTrigger.displayName = "DialogCloseTrigger";
2158
2181
  const DialogContent = React.forwardRef((props, ref) => {
2159
2182
  const dialog = useDialogContext();
2160
2183
  const presence = usePresenceContext();
@@ -2181,8 +2204,8 @@ const DialogPositioner = React.forwardRef((props, ref) => {
2181
2204
  return /* @__PURE__ */ jsxRuntime.jsx(ark.div, { ...mergedProps, ref });
2182
2205
  });
2183
2206
  DialogPositioner.displayName = "DialogPositioner";
2184
- var __defProp = Object.defineProperty;
2185
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2207
+ var __defProp$1 = Object.defineProperty;
2208
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2186
2209
  var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
2187
2210
  var activeFocusTraps = {
2188
2211
  activateTrap(trapStack, trap) {
@@ -2547,7 +2570,7 @@ var FocusTrap = class {
2547
2570
  return destinationNode;
2548
2571
  });
2549
2572
  this.trapStack = options.trapStack || sharedTrapStack;
2550
- const config = {
2573
+ const config2 = {
2551
2574
  returnFocusOnDeactivate: true,
2552
2575
  escapeDeactivates: true,
2553
2576
  delayInitialFocus: true,
@@ -2559,8 +2582,8 @@ var FocusTrap = class {
2559
2582
  },
2560
2583
  ...options
2561
2584
  };
2562
- this.doc = config.document || getDocument(Array.isArray(elements) ? elements[0] : elements);
2563
- this.config = config;
2585
+ this.doc = config2.document || getDocument(Array.isArray(elements) ? elements[0] : elements);
2586
+ this.config = config2;
2564
2587
  this.updateContainerElements(elements);
2565
2588
  this.setupMutationObserver();
2566
2589
  }
@@ -2678,7 +2701,7 @@ var delay = (fn) => setTimeout(fn, 0);
2678
2701
  var isSelectableInput = (node) => node.localName === "input" && "select" in node && typeof node.select === "function";
2679
2702
  function trapFocus(el, options = {}) {
2680
2703
  let trap;
2681
- const cleanup = raf$1(() => {
2704
+ const cleanup = raf$2(() => {
2682
2705
  const contentEl = typeof el === "function" ? el() : el;
2683
2706
  if (!contentEl) return;
2684
2707
  trap = new FocusTrap(contentEl, {
@@ -2780,41 +2803,41 @@ var anatomy = createAnatomy("dialog").parts(
2780
2803
  "closeTrigger"
2781
2804
  );
2782
2805
  var parts = anatomy.build();
2783
- var getPositionerId = (ctx) => {
2806
+ var getPositionerId = (ctx2) => {
2784
2807
  var _a;
2785
- return ((_a = ctx.ids) == null ? void 0 : _a.positioner) ?? `dialog:${ctx.id}:positioner`;
2808
+ return ((_a = ctx2.ids) == null ? void 0 : _a.positioner) ?? `dialog:${ctx2.id}:positioner`;
2786
2809
  };
2787
- var getBackdropId = (ctx) => {
2810
+ var getBackdropId = (ctx2) => {
2788
2811
  var _a;
2789
- return ((_a = ctx.ids) == null ? void 0 : _a.backdrop) ?? `dialog:${ctx.id}:backdrop`;
2812
+ return ((_a = ctx2.ids) == null ? void 0 : _a.backdrop) ?? `dialog:${ctx2.id}:backdrop`;
2790
2813
  };
2791
- var getContentId = (ctx) => {
2814
+ var getContentId = (ctx2) => {
2792
2815
  var _a;
2793
- return ((_a = ctx.ids) == null ? void 0 : _a.content) ?? `dialog:${ctx.id}:content`;
2816
+ return ((_a = ctx2.ids) == null ? void 0 : _a.content) ?? `dialog:${ctx2.id}:content`;
2794
2817
  };
2795
- var getTriggerId = (ctx) => {
2818
+ var getTriggerId = (ctx2) => {
2796
2819
  var _a;
2797
- return ((_a = ctx.ids) == null ? void 0 : _a.trigger) ?? `dialog:${ctx.id}:trigger`;
2820
+ return ((_a = ctx2.ids) == null ? void 0 : _a.trigger) ?? `dialog:${ctx2.id}:trigger`;
2798
2821
  };
2799
- var getTitleId = (ctx) => {
2822
+ var getTitleId = (ctx2) => {
2800
2823
  var _a;
2801
- return ((_a = ctx.ids) == null ? void 0 : _a.title) ?? `dialog:${ctx.id}:title`;
2824
+ return ((_a = ctx2.ids) == null ? void 0 : _a.title) ?? `dialog:${ctx2.id}:title`;
2802
2825
  };
2803
- var getDescriptionId = (ctx) => {
2826
+ var getDescriptionId = (ctx2) => {
2804
2827
  var _a;
2805
- return ((_a = ctx.ids) == null ? void 0 : _a.description) ?? `dialog:${ctx.id}:description`;
2828
+ return ((_a = ctx2.ids) == null ? void 0 : _a.description) ?? `dialog:${ctx2.id}:description`;
2806
2829
  };
2807
- var getCloseTriggerId = (ctx) => {
2830
+ var getCloseTriggerId = (ctx2) => {
2808
2831
  var _a;
2809
- return ((_a = ctx.ids) == null ? void 0 : _a.closeTrigger) ?? `dialog:${ctx.id}:close`;
2832
+ return ((_a = ctx2.ids) == null ? void 0 : _a.closeTrigger) ?? `dialog:${ctx2.id}:close`;
2810
2833
  };
2811
- var getContentEl = (ctx) => ctx.getById(getContentId(ctx));
2812
- var getPositionerEl = (ctx) => ctx.getById(getPositionerId(ctx));
2813
- var getBackdropEl = (ctx) => ctx.getById(getBackdropId(ctx));
2814
- var getTriggerEl = (ctx) => ctx.getById(getTriggerId(ctx));
2815
- var getTitleEl = (ctx) => ctx.getById(getTitleId(ctx));
2816
- var getDescriptionEl = (ctx) => ctx.getById(getDescriptionId(ctx));
2817
- var getCloseTriggerEl = (ctx) => ctx.getById(getCloseTriggerId(ctx));
2834
+ var getContentEl = (ctx2) => ctx2.getById(getContentId(ctx2));
2835
+ var getPositionerEl = (ctx2) => ctx2.getById(getPositionerId(ctx2));
2836
+ var getBackdropEl = (ctx2) => ctx2.getById(getBackdropId(ctx2));
2837
+ var getTriggerEl = (ctx2) => ctx2.getById(getTriggerId(ctx2));
2838
+ var getTitleEl = (ctx2) => ctx2.getById(getTitleId(ctx2));
2839
+ var getDescriptionEl = (ctx2) => ctx2.getById(getDescriptionId(ctx2));
2840
+ var getCloseTriggerEl = (ctx2) => ctx2.getById(getCloseTriggerId(ctx2));
2818
2841
  function connect(service, normalize) {
2819
2842
  const { state, send, context: context2, prop, scope } = service;
2820
2843
  const ariaLabel = prop("aria-label");
@@ -3054,7 +3077,7 @@ var machine = createMachine({
3054
3077
  },
3055
3078
  actions: {
3056
3079
  checkRenderedElements({ context: context2, scope }) {
3057
- raf$1(() => {
3080
+ raf$2(() => {
3058
3081
  context2.set("rendered", {
3059
3082
  title: !!getTitleEl(scope),
3060
3083
  description: !!getDescriptionEl(scope)
@@ -3062,7 +3085,7 @@ var machine = createMachine({
3062
3085
  });
3063
3086
  },
3064
3087
  syncZIndex({ scope }) {
3065
- raf$1(() => {
3088
+ raf$2(() => {
3066
3089
  const contentEl = getContentEl(scope);
3067
3090
  if (!contentEl) return;
3068
3091
  const styles = getComputedStyle(contentEl);
@@ -3700,6 +3723,14 @@ const textRecipe = cva({
3700
3723
  variant: "body.md"
3701
3724
  },
3702
3725
  variants: {
3726
+ font: {
3727
+ inter: {
3728
+ fontFamily: "inter"
3729
+ },
3730
+ notoSans: {
3731
+ fontFamily: "notoSans"
3732
+ }
3733
+ },
3703
3734
  variant: {
3704
3735
  "display.lg": {
3705
3736
  textStyle: "display.lg"
@@ -3719,6 +3750,9 @@ const textRecipe = cva({
3719
3750
  "title.md": {
3720
3751
  textStyle: "title.md"
3721
3752
  },
3753
+ "title.sm": {
3754
+ textStyle: "title.sm"
3755
+ },
3722
3756
  "body.lg": {
3723
3757
  textStyle: "body.lg"
3724
3758
  },
@@ -3738,7 +3772,7 @@ const textRecipe = cva({
3738
3772
  }
3739
3773
  });
3740
3774
  const Text = React.forwardRef((props, ref) => {
3741
- const { variant = "body.md", children, ...rest } = props;
3775
+ const { variant = "body.md", font = "notoSans", children, ...rest } = props;
3742
3776
  const textType = (variant == null ? void 0 : variant.split(".")[0]) || "body";
3743
3777
  const componentMap = {
3744
3778
  display: styled("h1", textRecipe),
@@ -3748,7 +3782,7 @@ const Text = React.forwardRef((props, ref) => {
3748
3782
  label: styled("span", textRecipe)
3749
3783
  };
3750
3784
  const TextComponent = componentMap[textType];
3751
- return /* @__PURE__ */ jsxRuntime.jsx(TextComponent, { ref, textStyle: variant, ...rest, children });
3785
+ return /* @__PURE__ */ jsxRuntime.jsx(TextComponent, { ref, textStyle: variant, font, ...rest, children });
3752
3786
  });
3753
3787
  Text.displayName = "Text";
3754
3788
  const shouldForwardProp = (prop, variantKeys, options = {}) => {
@@ -3798,7 +3832,7 @@ const createStyleContext = (recipe) => {
3798
3832
  };
3799
3833
  const dialogRecipe = sva({
3800
3834
  className: "dialog",
3801
- slots: anatomy.keys(),
3835
+ slots: [...anatomy.keys(), "header", "footer", "body"],
3802
3836
  base: {
3803
3837
  backdrop: {
3804
3838
  backdropFilter: "blur(4px)",
@@ -3827,17 +3861,22 @@ const dialogRecipe = sva({
3827
3861
  overflow: "auto",
3828
3862
  position: "fixed",
3829
3863
  top: "0",
3830
- width: "full",
3831
- height: "full",
3832
- zIndex: "modal"
3864
+ width: "100vw",
3865
+ height: "100vh",
3866
+ zIndex: "modal",
3867
+ p: "4"
3833
3868
  },
3834
3869
  content: {
3835
- background: "white",
3836
- borderRadius: "sm",
3837
- boxShadow: "overlay",
3838
- minW: "sm",
3839
3870
  position: "relative",
3840
- p: "3",
3871
+ backgroundColor: "surface.layer_1",
3872
+ borderRadius: "lg",
3873
+ width: "full",
3874
+ minW: "xs",
3875
+ maxW: "md",
3876
+ display: "flex",
3877
+ flexDirection: "column",
3878
+ gap: "6",
3879
+ py: "4",
3841
3880
  _open: {
3842
3881
  animation: "dialog-in"
3843
3882
  },
@@ -3845,31 +3884,80 @@ const dialogRecipe = sva({
3845
3884
  animation: "dialog-out"
3846
3885
  }
3847
3886
  },
3887
+ closeTrigger: {
3888
+ position: "absolute",
3889
+ top: "4",
3890
+ right: "4"
3891
+ },
3848
3892
  title: {
3849
- textStyle: "title.lg"
3893
+ display: "flex",
3894
+ alignItems: "center",
3895
+ gap: "1",
3896
+ color: "content.neutral.default",
3897
+ textStyle: "headline.sm"
3850
3898
  },
3851
3899
  description: {
3852
- color: "content.neutral.default_inverse",
3900
+ color: "content.neutral.default",
3853
3901
  textStyle: "body.md"
3902
+ },
3903
+ header: {
3904
+ display: "flex",
3905
+ flexDirection: "column",
3906
+ gap: "2",
3907
+ px: "6"
3908
+ },
3909
+ footer: {
3910
+ display: "flex",
3911
+ gap: "2",
3912
+ px: "4",
3913
+ justifyContent: "flex-end"
3914
+ },
3915
+ body: {
3916
+ px: "4"
3854
3917
  }
3855
3918
  }
3856
3919
  });
3857
3920
  const { withRootProvider, withContext } = createStyleContext(dialogRecipe);
3858
3921
  const Root = withRootProvider(DialogRoot);
3859
- const Backdrop = withContext(DialogBackdrop, "backdrop");
3922
+ const Backdrop$1 = withContext(DialogBackdrop, "backdrop");
3860
3923
  const Trigger = withContext(DialogTrigger, "trigger");
3861
3924
  const Content = withContext(DialogContent, "content");
3862
3925
  const Title = withContext(DialogTitle, "title");
3863
3926
  const Description = withContext(DialogDescription, "description");
3864
3927
  const Positioner = withContext(DialogPositioner, "positioner");
3928
+ const Header = withContext(ark.header, "header");
3929
+ const Footer = withContext(
3930
+ ({ orientation = "horizontal", className, ...props }) => {
3931
+ return /* @__PURE__ */ jsxRuntime.jsx(
3932
+ ark.footer,
3933
+ {
3934
+ className: cx(
3935
+ css$1({
3936
+ display: "flex",
3937
+ flexDirection: orientation === "horizontal" ? "row" : "column"
3938
+ }),
3939
+ className
3940
+ ),
3941
+ ...props
3942
+ }
3943
+ );
3944
+ },
3945
+ "footer"
3946
+ );
3947
+ const Body = withContext(ark.main, "body");
3948
+ const CloseTrigger = withContext(DialogCloseTrigger, "closeTrigger");
3865
3949
  const Dialog = {
3866
3950
  Root,
3867
- Backdrop,
3951
+ Backdrop: Backdrop$1,
3868
3952
  Trigger,
3869
3953
  Content,
3870
3954
  Title,
3871
3955
  Description,
3872
- Positioner
3956
+ Positioner,
3957
+ Header,
3958
+ Footer,
3959
+ Body,
3960
+ CloseTrigger
3873
3961
  };
3874
3962
  const iconButtonRecipe = cva({
3875
3963
  base: {
@@ -4046,6 +4134,3622 @@ const IconButton = React.forwardRef(
4046
4134
  }
4047
4135
  );
4048
4136
  IconButton.displayName = "IconButton";
4137
+ var updateQueue = makeQueue();
4138
+ var raf = (fn) => schedule(fn, updateQueue);
4139
+ var writeQueue = makeQueue();
4140
+ raf.write = (fn) => schedule(fn, writeQueue);
4141
+ var onStartQueue = makeQueue();
4142
+ raf.onStart = (fn) => schedule(fn, onStartQueue);
4143
+ var onFrameQueue = makeQueue();
4144
+ raf.onFrame = (fn) => schedule(fn, onFrameQueue);
4145
+ var onFinishQueue = makeQueue();
4146
+ raf.onFinish = (fn) => schedule(fn, onFinishQueue);
4147
+ var timeouts = [];
4148
+ raf.setTimeout = (handler, ms) => {
4149
+ const time = raf.now() + ms;
4150
+ const cancel = () => {
4151
+ const i = timeouts.findIndex((t) => t.cancel == cancel);
4152
+ if (~i)
4153
+ timeouts.splice(i, 1);
4154
+ pendingCount -= ~i ? 1 : 0;
4155
+ };
4156
+ const timeout = { time, handler, cancel };
4157
+ timeouts.splice(findTimeout(time), 0, timeout);
4158
+ pendingCount += 1;
4159
+ start();
4160
+ return timeout;
4161
+ };
4162
+ var findTimeout = (time) => ~(~timeouts.findIndex((t) => t.time > time) || ~timeouts.length);
4163
+ raf.cancel = (fn) => {
4164
+ onStartQueue.delete(fn);
4165
+ onFrameQueue.delete(fn);
4166
+ onFinishQueue.delete(fn);
4167
+ updateQueue.delete(fn);
4168
+ writeQueue.delete(fn);
4169
+ };
4170
+ raf.sync = (fn) => {
4171
+ sync = true;
4172
+ raf.batchedUpdates(fn);
4173
+ sync = false;
4174
+ };
4175
+ raf.throttle = (fn) => {
4176
+ let lastArgs;
4177
+ function queuedFn() {
4178
+ try {
4179
+ fn(...lastArgs);
4180
+ } finally {
4181
+ lastArgs = null;
4182
+ }
4183
+ }
4184
+ function throttled(...args) {
4185
+ lastArgs = args;
4186
+ raf.onStart(queuedFn);
4187
+ }
4188
+ throttled.handler = fn;
4189
+ throttled.cancel = () => {
4190
+ onStartQueue.delete(queuedFn);
4191
+ lastArgs = null;
4192
+ };
4193
+ return throttled;
4194
+ };
4195
+ var nativeRaf = typeof window != "undefined" ? window.requestAnimationFrame : (
4196
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
4197
+ () => {
4198
+ }
4199
+ );
4200
+ raf.use = (impl) => nativeRaf = impl;
4201
+ raf.now = typeof performance != "undefined" ? () => performance.now() : Date.now;
4202
+ raf.batchedUpdates = (fn) => fn();
4203
+ raf.catch = console.error;
4204
+ raf.frameLoop = "always";
4205
+ raf.advance = () => {
4206
+ if (raf.frameLoop !== "demand") {
4207
+ console.warn(
4208
+ "Cannot call the manual advancement of rafz whilst frameLoop is not set as demand"
4209
+ );
4210
+ } else {
4211
+ update();
4212
+ }
4213
+ };
4214
+ var ts = -1;
4215
+ var pendingCount = 0;
4216
+ var sync = false;
4217
+ function schedule(fn, queue) {
4218
+ if (sync) {
4219
+ queue.delete(fn);
4220
+ fn(0);
4221
+ } else {
4222
+ queue.add(fn);
4223
+ start();
4224
+ }
4225
+ }
4226
+ function start() {
4227
+ if (ts < 0) {
4228
+ ts = 0;
4229
+ if (raf.frameLoop !== "demand") {
4230
+ nativeRaf(loop);
4231
+ }
4232
+ }
4233
+ }
4234
+ function stop() {
4235
+ ts = -1;
4236
+ }
4237
+ function loop() {
4238
+ if (~ts) {
4239
+ nativeRaf(loop);
4240
+ raf.batchedUpdates(update);
4241
+ }
4242
+ }
4243
+ function update() {
4244
+ const prevTs = ts;
4245
+ ts = raf.now();
4246
+ const count = findTimeout(ts);
4247
+ if (count) {
4248
+ eachSafely(timeouts.splice(0, count), (t) => t.handler());
4249
+ pendingCount -= count;
4250
+ }
4251
+ if (!pendingCount) {
4252
+ stop();
4253
+ return;
4254
+ }
4255
+ onStartQueue.flush();
4256
+ updateQueue.flush(prevTs ? Math.min(64, ts - prevTs) : 16.667);
4257
+ onFrameQueue.flush();
4258
+ writeQueue.flush();
4259
+ onFinishQueue.flush();
4260
+ }
4261
+ function makeQueue() {
4262
+ let next = /* @__PURE__ */ new Set();
4263
+ let current = next;
4264
+ return {
4265
+ add(fn) {
4266
+ pendingCount += current == next && !next.has(fn) ? 1 : 0;
4267
+ next.add(fn);
4268
+ },
4269
+ delete(fn) {
4270
+ pendingCount -= current == next && next.has(fn) ? 1 : 0;
4271
+ return next.delete(fn);
4272
+ },
4273
+ flush(arg) {
4274
+ if (current.size) {
4275
+ next = /* @__PURE__ */ new Set();
4276
+ pendingCount -= current.size;
4277
+ eachSafely(current, (fn) => fn(arg) && next.add(fn));
4278
+ pendingCount += next.size;
4279
+ current = next;
4280
+ }
4281
+ }
4282
+ };
4283
+ }
4284
+ function eachSafely(values, each2) {
4285
+ values.forEach((value) => {
4286
+ try {
4287
+ each2(value);
4288
+ } catch (e) {
4289
+ raf.catch(e);
4290
+ }
4291
+ });
4292
+ }
4293
+ var __defProp = Object.defineProperty;
4294
+ var __export = (target, all) => {
4295
+ for (var name in all)
4296
+ __defProp(target, name, { get: all[name], enumerable: true });
4297
+ };
4298
+ var globals_exports = {};
4299
+ __export(globals_exports, {
4300
+ assign: () => assign,
4301
+ colors: () => colors,
4302
+ createStringInterpolator: () => createStringInterpolator,
4303
+ skipAnimation: () => skipAnimation,
4304
+ to: () => to,
4305
+ willAdvance: () => willAdvance
4306
+ });
4307
+ function noop() {
4308
+ }
4309
+ var defineHidden = (obj, key, value) => Object.defineProperty(obj, key, { value, writable: true, configurable: true });
4310
+ var is = {
4311
+ arr: Array.isArray,
4312
+ obj: (a) => !!a && a.constructor.name === "Object",
4313
+ fun: (a) => typeof a === "function",
4314
+ str: (a) => typeof a === "string",
4315
+ num: (a) => typeof a === "number",
4316
+ und: (a) => a === void 0
4317
+ };
4318
+ function isEqual(a, b) {
4319
+ if (is.arr(a)) {
4320
+ if (!is.arr(b) || a.length !== b.length)
4321
+ return false;
4322
+ for (let i = 0; i < a.length; i++) {
4323
+ if (a[i] !== b[i])
4324
+ return false;
4325
+ }
4326
+ return true;
4327
+ }
4328
+ return a === b;
4329
+ }
4330
+ var each = (obj, fn) => obj.forEach(fn);
4331
+ function eachProp(obj, fn, ctx2) {
4332
+ if (is.arr(obj)) {
4333
+ for (let i = 0; i < obj.length; i++) {
4334
+ fn.call(ctx2, obj[i], `${i}`);
4335
+ }
4336
+ return;
4337
+ }
4338
+ for (const key in obj) {
4339
+ if (obj.hasOwnProperty(key)) {
4340
+ fn.call(ctx2, obj[key], key);
4341
+ }
4342
+ }
4343
+ }
4344
+ var toArray = (a) => is.und(a) ? [] : is.arr(a) ? a : [a];
4345
+ function flush(queue, iterator) {
4346
+ if (queue.size) {
4347
+ const items = Array.from(queue);
4348
+ queue.clear();
4349
+ each(items, iterator);
4350
+ }
4351
+ }
4352
+ var flushCalls = (queue, ...args) => flush(queue, (fn) => fn(...args));
4353
+ var isSSR = () => typeof window === "undefined" || !window.navigator || /ServerSideRendering|^Deno\//.test(window.navigator.userAgent);
4354
+ var createStringInterpolator;
4355
+ var to;
4356
+ var colors = null;
4357
+ var skipAnimation = false;
4358
+ var willAdvance = noop;
4359
+ var assign = (globals) => {
4360
+ if (globals.to)
4361
+ to = globals.to;
4362
+ if (globals.now)
4363
+ raf.now = globals.now;
4364
+ if (globals.colors !== void 0)
4365
+ colors = globals.colors;
4366
+ if (globals.skipAnimation != null)
4367
+ skipAnimation = globals.skipAnimation;
4368
+ if (globals.createStringInterpolator)
4369
+ createStringInterpolator = globals.createStringInterpolator;
4370
+ if (globals.requestAnimationFrame)
4371
+ raf.use(globals.requestAnimationFrame);
4372
+ if (globals.batchedUpdates)
4373
+ raf.batchedUpdates = globals.batchedUpdates;
4374
+ if (globals.willAdvance)
4375
+ willAdvance = globals.willAdvance;
4376
+ if (globals.frameLoop)
4377
+ raf.frameLoop = globals.frameLoop;
4378
+ };
4379
+ var startQueue = /* @__PURE__ */ new Set();
4380
+ var currentFrame = [];
4381
+ var prevFrame = [];
4382
+ var priority = 0;
4383
+ var frameLoop = {
4384
+ get idle() {
4385
+ return !startQueue.size && !currentFrame.length;
4386
+ },
4387
+ /** Advance the given animation on every frame until idle. */
4388
+ start(animation) {
4389
+ if (priority > animation.priority) {
4390
+ startQueue.add(animation);
4391
+ raf.onStart(flushStartQueue);
4392
+ } else {
4393
+ startSafely(animation);
4394
+ raf(advance);
4395
+ }
4396
+ },
4397
+ /** Advance all animations by the given time. */
4398
+ advance,
4399
+ /** Call this when an animation's priority changes. */
4400
+ sort(animation) {
4401
+ if (priority) {
4402
+ raf.onFrame(() => frameLoop.sort(animation));
4403
+ } else {
4404
+ const prevIndex = currentFrame.indexOf(animation);
4405
+ if (~prevIndex) {
4406
+ currentFrame.splice(prevIndex, 1);
4407
+ startUnsafely(animation);
4408
+ }
4409
+ }
4410
+ },
4411
+ /**
4412
+ * Clear all animations. For testing purposes.
4413
+ *
4414
+ * ☠️ Never call this from within the frameloop.
4415
+ */
4416
+ clear() {
4417
+ currentFrame = [];
4418
+ startQueue.clear();
4419
+ }
4420
+ };
4421
+ function flushStartQueue() {
4422
+ startQueue.forEach(startSafely);
4423
+ startQueue.clear();
4424
+ raf(advance);
4425
+ }
4426
+ function startSafely(animation) {
4427
+ if (!currentFrame.includes(animation))
4428
+ startUnsafely(animation);
4429
+ }
4430
+ function startUnsafely(animation) {
4431
+ currentFrame.splice(
4432
+ findIndex(currentFrame, (other) => other.priority > animation.priority),
4433
+ 0,
4434
+ animation
4435
+ );
4436
+ }
4437
+ function advance(dt) {
4438
+ const nextFrame = prevFrame;
4439
+ for (let i = 0; i < currentFrame.length; i++) {
4440
+ const animation = currentFrame[i];
4441
+ priority = animation.priority;
4442
+ if (!animation.idle) {
4443
+ willAdvance(animation);
4444
+ animation.advance(dt);
4445
+ if (!animation.idle) {
4446
+ nextFrame.push(animation);
4447
+ }
4448
+ }
4449
+ }
4450
+ priority = 0;
4451
+ prevFrame = currentFrame;
4452
+ prevFrame.length = 0;
4453
+ currentFrame = nextFrame;
4454
+ return currentFrame.length > 0;
4455
+ }
4456
+ function findIndex(arr, test) {
4457
+ const index = arr.findIndex(test);
4458
+ return index < 0 ? arr.length : index;
4459
+ }
4460
+ var colors2 = {
4461
+ transparent: 0,
4462
+ aliceblue: 4042850303,
4463
+ antiquewhite: 4209760255,
4464
+ aqua: 16777215,
4465
+ aquamarine: 2147472639,
4466
+ azure: 4043309055,
4467
+ beige: 4126530815,
4468
+ bisque: 4293182719,
4469
+ black: 255,
4470
+ blanchedalmond: 4293643775,
4471
+ blue: 65535,
4472
+ blueviolet: 2318131967,
4473
+ brown: 2771004159,
4474
+ burlywood: 3736635391,
4475
+ burntsienna: 3934150143,
4476
+ cadetblue: 1604231423,
4477
+ chartreuse: 2147418367,
4478
+ chocolate: 3530104575,
4479
+ coral: 4286533887,
4480
+ cornflowerblue: 1687547391,
4481
+ cornsilk: 4294499583,
4482
+ crimson: 3692313855,
4483
+ cyan: 16777215,
4484
+ darkblue: 35839,
4485
+ darkcyan: 9145343,
4486
+ darkgoldenrod: 3095792639,
4487
+ darkgray: 2846468607,
4488
+ darkgreen: 6553855,
4489
+ darkgrey: 2846468607,
4490
+ darkkhaki: 3182914559,
4491
+ darkmagenta: 2332068863,
4492
+ darkolivegreen: 1433087999,
4493
+ darkorange: 4287365375,
4494
+ darkorchid: 2570243327,
4495
+ darkred: 2332033279,
4496
+ darksalmon: 3918953215,
4497
+ darkseagreen: 2411499519,
4498
+ darkslateblue: 1211993087,
4499
+ darkslategray: 793726975,
4500
+ darkslategrey: 793726975,
4501
+ darkturquoise: 13554175,
4502
+ darkviolet: 2483082239,
4503
+ deeppink: 4279538687,
4504
+ deepskyblue: 12582911,
4505
+ dimgray: 1768516095,
4506
+ dimgrey: 1768516095,
4507
+ dodgerblue: 512819199,
4508
+ firebrick: 2988581631,
4509
+ floralwhite: 4294635775,
4510
+ forestgreen: 579543807,
4511
+ fuchsia: 4278255615,
4512
+ gainsboro: 3705462015,
4513
+ ghostwhite: 4177068031,
4514
+ gold: 4292280575,
4515
+ goldenrod: 3668254975,
4516
+ gray: 2155905279,
4517
+ green: 8388863,
4518
+ greenyellow: 2919182335,
4519
+ grey: 2155905279,
4520
+ honeydew: 4043305215,
4521
+ hotpink: 4285117695,
4522
+ indianred: 3445382399,
4523
+ indigo: 1258324735,
4524
+ ivory: 4294963455,
4525
+ khaki: 4041641215,
4526
+ lavender: 3873897215,
4527
+ lavenderblush: 4293981695,
4528
+ lawngreen: 2096890111,
4529
+ lemonchiffon: 4294626815,
4530
+ lightblue: 2916673279,
4531
+ lightcoral: 4034953471,
4532
+ lightcyan: 3774873599,
4533
+ lightgoldenrodyellow: 4210742015,
4534
+ lightgray: 3553874943,
4535
+ lightgreen: 2431553791,
4536
+ lightgrey: 3553874943,
4537
+ lightpink: 4290167295,
4538
+ lightsalmon: 4288707327,
4539
+ lightseagreen: 548580095,
4540
+ lightskyblue: 2278488831,
4541
+ lightslategray: 2005441023,
4542
+ lightslategrey: 2005441023,
4543
+ lightsteelblue: 2965692159,
4544
+ lightyellow: 4294959359,
4545
+ lime: 16711935,
4546
+ limegreen: 852308735,
4547
+ linen: 4210091775,
4548
+ magenta: 4278255615,
4549
+ maroon: 2147483903,
4550
+ mediumaquamarine: 1724754687,
4551
+ mediumblue: 52735,
4552
+ mediumorchid: 3126187007,
4553
+ mediumpurple: 2473647103,
4554
+ mediumseagreen: 1018393087,
4555
+ mediumslateblue: 2070474495,
4556
+ mediumspringgreen: 16423679,
4557
+ mediumturquoise: 1221709055,
4558
+ mediumvioletred: 3340076543,
4559
+ midnightblue: 421097727,
4560
+ mintcream: 4127193855,
4561
+ mistyrose: 4293190143,
4562
+ moccasin: 4293178879,
4563
+ navajowhite: 4292783615,
4564
+ navy: 33023,
4565
+ oldlace: 4260751103,
4566
+ olive: 2155872511,
4567
+ olivedrab: 1804477439,
4568
+ orange: 4289003775,
4569
+ orangered: 4282712319,
4570
+ orchid: 3664828159,
4571
+ palegoldenrod: 4008225535,
4572
+ palegreen: 2566625535,
4573
+ paleturquoise: 2951671551,
4574
+ palevioletred: 3681588223,
4575
+ papayawhip: 4293907967,
4576
+ peachpuff: 4292524543,
4577
+ peru: 3448061951,
4578
+ pink: 4290825215,
4579
+ plum: 3718307327,
4580
+ powderblue: 2967529215,
4581
+ purple: 2147516671,
4582
+ rebeccapurple: 1714657791,
4583
+ red: 4278190335,
4584
+ rosybrown: 3163525119,
4585
+ royalblue: 1097458175,
4586
+ saddlebrown: 2336560127,
4587
+ salmon: 4202722047,
4588
+ sandybrown: 4104413439,
4589
+ seagreen: 780883967,
4590
+ seashell: 4294307583,
4591
+ sienna: 2689740287,
4592
+ silver: 3233857791,
4593
+ skyblue: 2278484991,
4594
+ slateblue: 1784335871,
4595
+ slategray: 1887473919,
4596
+ slategrey: 1887473919,
4597
+ snow: 4294638335,
4598
+ springgreen: 16744447,
4599
+ steelblue: 1182971135,
4600
+ tan: 3535047935,
4601
+ teal: 8421631,
4602
+ thistle: 3636451583,
4603
+ tomato: 4284696575,
4604
+ turquoise: 1088475391,
4605
+ violet: 4001558271,
4606
+ wheat: 4125012991,
4607
+ white: 4294967295,
4608
+ whitesmoke: 4126537215,
4609
+ yellow: 4294902015,
4610
+ yellowgreen: 2597139199
4611
+ };
4612
+ var NUMBER = "[-+]?\\d*\\.?\\d+";
4613
+ var PERCENTAGE = NUMBER + "%";
4614
+ function call(...parts2) {
4615
+ return "\\(\\s*(" + parts2.join(")\\s*,\\s*(") + ")\\s*\\)";
4616
+ }
4617
+ var rgb = new RegExp("rgb" + call(NUMBER, NUMBER, NUMBER));
4618
+ var rgba = new RegExp("rgba" + call(NUMBER, NUMBER, NUMBER, NUMBER));
4619
+ var hsl = new RegExp("hsl" + call(NUMBER, PERCENTAGE, PERCENTAGE));
4620
+ var hsla = new RegExp(
4621
+ "hsla" + call(NUMBER, PERCENTAGE, PERCENTAGE, NUMBER)
4622
+ );
4623
+ var hex3 = /^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/;
4624
+ var hex4 = /^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/;
4625
+ var hex6 = /^#([0-9a-fA-F]{6})$/;
4626
+ var hex8 = /^#([0-9a-fA-F]{8})$/;
4627
+ function normalizeColor(color) {
4628
+ let match;
4629
+ if (typeof color === "number") {
4630
+ return color >>> 0 === color && color >= 0 && color <= 4294967295 ? color : null;
4631
+ }
4632
+ if (match = hex6.exec(color))
4633
+ return parseInt(match[1] + "ff", 16) >>> 0;
4634
+ if (colors && colors[color] !== void 0) {
4635
+ return colors[color];
4636
+ }
4637
+ if (match = rgb.exec(color)) {
4638
+ return (parse255(match[1]) << 24 | // r
4639
+ parse255(match[2]) << 16 | // g
4640
+ parse255(match[3]) << 8 | // b
4641
+ 255) >>> // a
4642
+ 0;
4643
+ }
4644
+ if (match = rgba.exec(color)) {
4645
+ return (parse255(match[1]) << 24 | // r
4646
+ parse255(match[2]) << 16 | // g
4647
+ parse255(match[3]) << 8 | // b
4648
+ parse1(match[4])) >>> // a
4649
+ 0;
4650
+ }
4651
+ if (match = hex3.exec(color)) {
4652
+ return parseInt(
4653
+ match[1] + match[1] + // r
4654
+ match[2] + match[2] + // g
4655
+ match[3] + match[3] + // b
4656
+ "ff",
4657
+ // a
4658
+ 16
4659
+ ) >>> 0;
4660
+ }
4661
+ if (match = hex8.exec(color))
4662
+ return parseInt(match[1], 16) >>> 0;
4663
+ if (match = hex4.exec(color)) {
4664
+ return parseInt(
4665
+ match[1] + match[1] + // r
4666
+ match[2] + match[2] + // g
4667
+ match[3] + match[3] + // b
4668
+ match[4] + match[4],
4669
+ // a
4670
+ 16
4671
+ ) >>> 0;
4672
+ }
4673
+ if (match = hsl.exec(color)) {
4674
+ return (hslToRgb(
4675
+ parse360(match[1]),
4676
+ // h
4677
+ parsePercentage(match[2]),
4678
+ // s
4679
+ parsePercentage(match[3])
4680
+ // l
4681
+ ) | 255) >>> // a
4682
+ 0;
4683
+ }
4684
+ if (match = hsla.exec(color)) {
4685
+ return (hslToRgb(
4686
+ parse360(match[1]),
4687
+ // h
4688
+ parsePercentage(match[2]),
4689
+ // s
4690
+ parsePercentage(match[3])
4691
+ // l
4692
+ ) | parse1(match[4])) >>> // a
4693
+ 0;
4694
+ }
4695
+ return null;
4696
+ }
4697
+ function hue2rgb(p, q, t) {
4698
+ if (t < 0)
4699
+ t += 1;
4700
+ if (t > 1)
4701
+ t -= 1;
4702
+ if (t < 1 / 6)
4703
+ return p + (q - p) * 6 * t;
4704
+ if (t < 1 / 2)
4705
+ return q;
4706
+ if (t < 2 / 3)
4707
+ return p + (q - p) * (2 / 3 - t) * 6;
4708
+ return p;
4709
+ }
4710
+ function hslToRgb(h, s, l) {
4711
+ const q = l < 0.5 ? l * (1 + s) : l + s - l * s;
4712
+ const p = 2 * l - q;
4713
+ const r = hue2rgb(p, q, h + 1 / 3);
4714
+ const g2 = hue2rgb(p, q, h);
4715
+ const b = hue2rgb(p, q, h - 1 / 3);
4716
+ return Math.round(r * 255) << 24 | Math.round(g2 * 255) << 16 | Math.round(b * 255) << 8;
4717
+ }
4718
+ function parse255(str) {
4719
+ const int = parseInt(str, 10);
4720
+ if (int < 0)
4721
+ return 0;
4722
+ if (int > 255)
4723
+ return 255;
4724
+ return int;
4725
+ }
4726
+ function parse360(str) {
4727
+ const int = parseFloat(str);
4728
+ return (int % 360 + 360) % 360 / 360;
4729
+ }
4730
+ function parse1(str) {
4731
+ const num = parseFloat(str);
4732
+ if (num < 0)
4733
+ return 0;
4734
+ if (num > 1)
4735
+ return 255;
4736
+ return Math.round(num * 255);
4737
+ }
4738
+ function parsePercentage(str) {
4739
+ const int = parseFloat(str);
4740
+ if (int < 0)
4741
+ return 0;
4742
+ if (int > 100)
4743
+ return 1;
4744
+ return int / 100;
4745
+ }
4746
+ function colorToRgba(input) {
4747
+ let int32Color = normalizeColor(input);
4748
+ if (int32Color === null)
4749
+ return input;
4750
+ int32Color = int32Color || 0;
4751
+ const r = (int32Color & 4278190080) >>> 24;
4752
+ const g2 = (int32Color & 16711680) >>> 16;
4753
+ const b = (int32Color & 65280) >>> 8;
4754
+ const a = (int32Color & 255) / 255;
4755
+ return `rgba(${r}, ${g2}, ${b}, ${a})`;
4756
+ }
4757
+ var createInterpolator = (range, output, extrapolate) => {
4758
+ if (is.fun(range)) {
4759
+ return range;
4760
+ }
4761
+ if (is.arr(range)) {
4762
+ return createInterpolator({
4763
+ range,
4764
+ output,
4765
+ extrapolate
4766
+ });
4767
+ }
4768
+ if (is.str(range.output[0])) {
4769
+ return createStringInterpolator(range);
4770
+ }
4771
+ const config2 = range;
4772
+ const outputRange = config2.output;
4773
+ const inputRange = config2.range || [0, 1];
4774
+ const extrapolateLeft = config2.extrapolateLeft || config2.extrapolate || "extend";
4775
+ const extrapolateRight = config2.extrapolateRight || config2.extrapolate || "extend";
4776
+ const easing = config2.easing || ((t) => t);
4777
+ return (input) => {
4778
+ const range2 = findRange(input, inputRange);
4779
+ return interpolate(
4780
+ input,
4781
+ inputRange[range2],
4782
+ inputRange[range2 + 1],
4783
+ outputRange[range2],
4784
+ outputRange[range2 + 1],
4785
+ easing,
4786
+ extrapolateLeft,
4787
+ extrapolateRight,
4788
+ config2.map
4789
+ );
4790
+ };
4791
+ };
4792
+ function interpolate(input, inputMin, inputMax, outputMin, outputMax, easing, extrapolateLeft, extrapolateRight, map) {
4793
+ let result = map ? map(input) : input;
4794
+ if (result < inputMin) {
4795
+ if (extrapolateLeft === "identity")
4796
+ return result;
4797
+ else if (extrapolateLeft === "clamp")
4798
+ result = inputMin;
4799
+ }
4800
+ if (result > inputMax) {
4801
+ if (extrapolateRight === "identity")
4802
+ return result;
4803
+ else if (extrapolateRight === "clamp")
4804
+ result = inputMax;
4805
+ }
4806
+ if (outputMin === outputMax)
4807
+ return outputMin;
4808
+ if (inputMin === inputMax)
4809
+ return input <= inputMin ? outputMin : outputMax;
4810
+ if (inputMin === -Infinity)
4811
+ result = -result;
4812
+ else if (inputMax === Infinity)
4813
+ result = result - inputMin;
4814
+ else
4815
+ result = (result - inputMin) / (inputMax - inputMin);
4816
+ result = easing(result);
4817
+ if (outputMin === -Infinity)
4818
+ result = -result;
4819
+ else if (outputMax === Infinity)
4820
+ result = result + outputMin;
4821
+ else
4822
+ result = result * (outputMax - outputMin) + outputMin;
4823
+ return result;
4824
+ }
4825
+ function findRange(input, inputRange) {
4826
+ for (var i = 1; i < inputRange.length - 1; ++i)
4827
+ if (inputRange[i] >= input)
4828
+ break;
4829
+ return i - 1;
4830
+ }
4831
+ var easings$1 = {
4832
+ linear: (x) => x
4833
+ };
4834
+ var $get = Symbol.for("FluidValue.get");
4835
+ var $observers = Symbol.for("FluidValue.observers");
4836
+ var hasFluidValue = (arg) => Boolean(arg && arg[$get]);
4837
+ var getFluidValue = (arg) => arg && arg[$get] ? arg[$get]() : arg;
4838
+ var getFluidObservers = (target) => target[$observers] || null;
4839
+ function callFluidObserver(observer2, event) {
4840
+ if (observer2.eventObserved) {
4841
+ observer2.eventObserved(event);
4842
+ } else {
4843
+ observer2(event);
4844
+ }
4845
+ }
4846
+ function callFluidObservers(target, event) {
4847
+ const observers = target[$observers];
4848
+ if (observers) {
4849
+ observers.forEach((observer2) => {
4850
+ callFluidObserver(observer2, event);
4851
+ });
4852
+ }
4853
+ }
4854
+ var FluidValue = class {
4855
+ constructor(get) {
4856
+ if (!get && !(get = this.get)) {
4857
+ throw Error("Unknown getter");
4858
+ }
4859
+ setFluidGetter(this, get);
4860
+ }
4861
+ };
4862
+ var setFluidGetter = (target, get) => setHidden(target, $get, get);
4863
+ function addFluidObserver(target, observer2) {
4864
+ if (target[$get]) {
4865
+ let observers = target[$observers];
4866
+ if (!observers) {
4867
+ setHidden(target, $observers, observers = /* @__PURE__ */ new Set());
4868
+ }
4869
+ if (!observers.has(observer2)) {
4870
+ observers.add(observer2);
4871
+ if (target.observerAdded) {
4872
+ target.observerAdded(observers.size, observer2);
4873
+ }
4874
+ }
4875
+ }
4876
+ return observer2;
4877
+ }
4878
+ function removeFluidObserver(target, observer2) {
4879
+ const observers = target[$observers];
4880
+ if (observers && observers.has(observer2)) {
4881
+ const count = observers.size - 1;
4882
+ if (count) {
4883
+ observers.delete(observer2);
4884
+ } else {
4885
+ target[$observers] = null;
4886
+ }
4887
+ if (target.observerRemoved) {
4888
+ target.observerRemoved(count, observer2);
4889
+ }
4890
+ }
4891
+ }
4892
+ var setHidden = (target, key, value) => Object.defineProperty(target, key, {
4893
+ value,
4894
+ writable: true,
4895
+ configurable: true
4896
+ });
4897
+ var numberRegex = /[+\-]?(?:0|[1-9]\d*)(?:\.\d*)?(?:[eE][+\-]?\d+)?/g;
4898
+ var colorRegex = /(#(?:[0-9a-f]{2}){2,4}|(#[0-9a-f]{3})|(rgb|hsl)a?\((-?\d+%?[,\s]+){2,3}\s*[\d\.]+%?\))/gi;
4899
+ var unitRegex = new RegExp(`(${numberRegex.source})(%|[a-z]+)`, "i");
4900
+ var rgbaRegex = /rgba\(([0-9\.-]+), ([0-9\.-]+), ([0-9\.-]+), ([0-9\.-]+)\)/gi;
4901
+ var cssVariableRegex = /var\((--[a-zA-Z0-9-_]+),? ?([a-zA-Z0-9 ()%#.,-]+)?\)/;
4902
+ var variableToRgba = (input) => {
4903
+ const [token, fallback] = parseCSSVariable(input);
4904
+ if (!token || isSSR()) {
4905
+ return input;
4906
+ }
4907
+ const value = window.getComputedStyle(document.documentElement).getPropertyValue(token);
4908
+ if (value) {
4909
+ return value.trim();
4910
+ } else if (fallback && fallback.startsWith("--")) {
4911
+ const value2 = window.getComputedStyle(document.documentElement).getPropertyValue(fallback);
4912
+ if (value2) {
4913
+ return value2;
4914
+ } else {
4915
+ return input;
4916
+ }
4917
+ } else if (fallback && cssVariableRegex.test(fallback)) {
4918
+ return variableToRgba(fallback);
4919
+ } else if (fallback) {
4920
+ return fallback;
4921
+ }
4922
+ return input;
4923
+ };
4924
+ var parseCSSVariable = (current) => {
4925
+ const match = cssVariableRegex.exec(current);
4926
+ if (!match)
4927
+ return [,];
4928
+ const [, token, fallback] = match;
4929
+ return [token, fallback];
4930
+ };
4931
+ var namedColorRegex;
4932
+ var rgbaRound = (_, p1, p2, p3, p4) => `rgba(${Math.round(p1)}, ${Math.round(p2)}, ${Math.round(p3)}, ${p4})`;
4933
+ var createStringInterpolator2 = (config2) => {
4934
+ if (!namedColorRegex)
4935
+ namedColorRegex = colors ? (
4936
+ // match color names, ignore partial matches
4937
+ new RegExp(`(${Object.keys(colors).join("|")})(?!\\w)`, "g")
4938
+ ) : (
4939
+ // never match
4940
+ /^\b$/
4941
+ );
4942
+ const output = config2.output.map((value) => {
4943
+ return getFluidValue(value).replace(cssVariableRegex, variableToRgba).replace(colorRegex, colorToRgba).replace(namedColorRegex, colorToRgba);
4944
+ });
4945
+ const keyframes2 = output.map((value) => value.match(numberRegex).map(Number));
4946
+ const outputRanges = keyframes2[0].map(
4947
+ (_, i) => keyframes2.map((values) => {
4948
+ if (!(i in values)) {
4949
+ throw Error('The arity of each "output" value must be equal');
4950
+ }
4951
+ return values[i];
4952
+ })
4953
+ );
4954
+ const interpolators = outputRanges.map(
4955
+ (output2) => createInterpolator({ ...config2, output: output2 })
4956
+ );
4957
+ return (input) => {
4958
+ var _a;
4959
+ const missingUnit = !unitRegex.test(output[0]) && ((_a = output.find((value) => unitRegex.test(value))) == null ? void 0 : _a.replace(numberRegex, ""));
4960
+ let i = 0;
4961
+ return output[0].replace(
4962
+ numberRegex,
4963
+ () => `${interpolators[i++](input)}${missingUnit || ""}`
4964
+ ).replace(rgbaRegex, rgbaRound);
4965
+ };
4966
+ };
4967
+ var prefix = "react-spring: ";
4968
+ var once = (fn) => {
4969
+ const func = fn;
4970
+ let called = false;
4971
+ if (typeof func != "function") {
4972
+ throw new TypeError(`${prefix}once requires a function parameter`);
4973
+ }
4974
+ return (...args) => {
4975
+ if (!called) {
4976
+ func(...args);
4977
+ called = true;
4978
+ }
4979
+ };
4980
+ };
4981
+ var warnInterpolate = once(console.warn);
4982
+ function deprecateInterpolate() {
4983
+ warnInterpolate(
4984
+ `${prefix}The "interpolate" function is deprecated in v9 (use "to" instead)`
4985
+ );
4986
+ }
4987
+ var warnDirectCall = once(console.warn);
4988
+ function deprecateDirectCall() {
4989
+ warnDirectCall(
4990
+ `${prefix}Directly calling start instead of using the api object is deprecated in v9 (use ".start" instead), this will be removed in later 0.X.0 versions`
4991
+ );
4992
+ }
4993
+ function isAnimatedString(value) {
4994
+ return is.str(value) && (value[0] == "#" || /\d/.test(value) || // Do not identify a CSS variable as an AnimatedString if its SSR
4995
+ !isSSR() && cssVariableRegex.test(value) || value in (colors || {}));
4996
+ }
4997
+ var useIsomorphicLayoutEffect = isSSR() ? React.useEffect : React.useLayoutEffect;
4998
+ var useIsMounted = () => {
4999
+ const isMounted = React.useRef(false);
5000
+ useIsomorphicLayoutEffect(() => {
5001
+ isMounted.current = true;
5002
+ return () => {
5003
+ isMounted.current = false;
5004
+ };
5005
+ }, []);
5006
+ return isMounted;
5007
+ };
5008
+ function useForceUpdate() {
5009
+ const update2 = React.useState()[1];
5010
+ const isMounted = useIsMounted();
5011
+ return () => {
5012
+ if (isMounted.current) {
5013
+ update2(Math.random());
5014
+ }
5015
+ };
5016
+ }
5017
+ function useMemoOne(getResult, inputs) {
5018
+ const [initial] = React.useState(
5019
+ () => ({
5020
+ inputs,
5021
+ result: getResult()
5022
+ })
5023
+ );
5024
+ const committed = React.useRef();
5025
+ const prevCache = committed.current;
5026
+ let cache = prevCache;
5027
+ if (cache) {
5028
+ const useCache = Boolean(
5029
+ inputs && cache.inputs && areInputsEqual(inputs, cache.inputs)
5030
+ );
5031
+ if (!useCache) {
5032
+ cache = {
5033
+ inputs,
5034
+ result: getResult()
5035
+ };
5036
+ }
5037
+ } else {
5038
+ cache = initial;
5039
+ }
5040
+ React.useEffect(() => {
5041
+ committed.current = cache;
5042
+ if (prevCache == initial) {
5043
+ initial.inputs = initial.result = void 0;
5044
+ }
5045
+ }, [cache]);
5046
+ return cache.result;
5047
+ }
5048
+ function areInputsEqual(next, prev) {
5049
+ if (next.length !== prev.length) {
5050
+ return false;
5051
+ }
5052
+ for (let i = 0; i < next.length; i++) {
5053
+ if (next[i] !== prev[i]) {
5054
+ return false;
5055
+ }
5056
+ }
5057
+ return true;
5058
+ }
5059
+ var useOnce = (effect) => React.useEffect(effect, emptyDeps);
5060
+ var emptyDeps = [];
5061
+ function usePrev(value) {
5062
+ const prevRef = React.useRef();
5063
+ React.useEffect(() => {
5064
+ prevRef.current = value;
5065
+ });
5066
+ return prevRef.current;
5067
+ }
5068
+ var $node = Symbol.for("Animated:node");
5069
+ var isAnimated = (value) => !!value && value[$node] === value;
5070
+ var getAnimated = (owner) => owner && owner[$node];
5071
+ var setAnimated = (owner, node) => defineHidden(owner, $node, node);
5072
+ var getPayload = (owner) => owner && owner[$node] && owner[$node].getPayload();
5073
+ var Animated = class {
5074
+ constructor() {
5075
+ setAnimated(this, this);
5076
+ }
5077
+ /** Get every `AnimatedValue` used by this node. */
5078
+ getPayload() {
5079
+ return this.payload || [];
5080
+ }
5081
+ };
5082
+ var AnimatedValue = class extends Animated {
5083
+ constructor(_value) {
5084
+ super();
5085
+ this._value = _value;
5086
+ this.done = true;
5087
+ this.durationProgress = 0;
5088
+ if (is.num(this._value)) {
5089
+ this.lastPosition = this._value;
5090
+ }
5091
+ }
5092
+ /** @internal */
5093
+ static create(value) {
5094
+ return new AnimatedValue(value);
5095
+ }
5096
+ getPayload() {
5097
+ return [this];
5098
+ }
5099
+ getValue() {
5100
+ return this._value;
5101
+ }
5102
+ setValue(value, step) {
5103
+ if (is.num(value)) {
5104
+ this.lastPosition = value;
5105
+ if (step) {
5106
+ value = Math.round(value / step) * step;
5107
+ if (this.done) {
5108
+ this.lastPosition = value;
5109
+ }
5110
+ }
5111
+ }
5112
+ if (this._value === value) {
5113
+ return false;
5114
+ }
5115
+ this._value = value;
5116
+ return true;
5117
+ }
5118
+ reset() {
5119
+ const { done } = this;
5120
+ this.done = false;
5121
+ if (is.num(this._value)) {
5122
+ this.elapsedTime = 0;
5123
+ this.durationProgress = 0;
5124
+ this.lastPosition = this._value;
5125
+ if (done)
5126
+ this.lastVelocity = null;
5127
+ this.v0 = null;
5128
+ }
5129
+ }
5130
+ };
5131
+ var AnimatedString = class extends AnimatedValue {
5132
+ constructor(value) {
5133
+ super(0);
5134
+ this._string = null;
5135
+ this._toString = createInterpolator({
5136
+ output: [value, value]
5137
+ });
5138
+ }
5139
+ /** @internal */
5140
+ static create(value) {
5141
+ return new AnimatedString(value);
5142
+ }
5143
+ getValue() {
5144
+ const value = this._string;
5145
+ return value == null ? this._string = this._toString(this._value) : value;
5146
+ }
5147
+ setValue(value) {
5148
+ if (is.str(value)) {
5149
+ if (value == this._string) {
5150
+ return false;
5151
+ }
5152
+ this._string = value;
5153
+ this._value = 1;
5154
+ } else if (super.setValue(value)) {
5155
+ this._string = null;
5156
+ } else {
5157
+ return false;
5158
+ }
5159
+ return true;
5160
+ }
5161
+ reset(goal) {
5162
+ if (goal) {
5163
+ this._toString = createInterpolator({
5164
+ output: [this.getValue(), goal]
5165
+ });
5166
+ }
5167
+ this._value = 0;
5168
+ super.reset();
5169
+ }
5170
+ };
5171
+ var TreeContext = { dependencies: null };
5172
+ var AnimatedObject = class extends Animated {
5173
+ constructor(source) {
5174
+ super();
5175
+ this.source = source;
5176
+ this.setValue(source);
5177
+ }
5178
+ getValue(animated2) {
5179
+ const values = {};
5180
+ eachProp(this.source, (source, key) => {
5181
+ if (isAnimated(source)) {
5182
+ values[key] = source.getValue(animated2);
5183
+ } else if (hasFluidValue(source)) {
5184
+ values[key] = getFluidValue(source);
5185
+ } else if (!animated2) {
5186
+ values[key] = source;
5187
+ }
5188
+ });
5189
+ return values;
5190
+ }
5191
+ /** Replace the raw object data */
5192
+ setValue(source) {
5193
+ this.source = source;
5194
+ this.payload = this._makePayload(source);
5195
+ }
5196
+ reset() {
5197
+ if (this.payload) {
5198
+ each(this.payload, (node) => node.reset());
5199
+ }
5200
+ }
5201
+ /** Create a payload set. */
5202
+ _makePayload(source) {
5203
+ if (source) {
5204
+ const payload = /* @__PURE__ */ new Set();
5205
+ eachProp(source, this._addToPayload, payload);
5206
+ return Array.from(payload);
5207
+ }
5208
+ }
5209
+ /** Add to a payload set. */
5210
+ _addToPayload(source) {
5211
+ if (TreeContext.dependencies && hasFluidValue(source)) {
5212
+ TreeContext.dependencies.add(source);
5213
+ }
5214
+ const payload = getPayload(source);
5215
+ if (payload) {
5216
+ each(payload, (node) => this.add(node));
5217
+ }
5218
+ }
5219
+ };
5220
+ var AnimatedArray = class extends AnimatedObject {
5221
+ constructor(source) {
5222
+ super(source);
5223
+ }
5224
+ /** @internal */
5225
+ static create(source) {
5226
+ return new AnimatedArray(source);
5227
+ }
5228
+ getValue() {
5229
+ return this.source.map((node) => node.getValue());
5230
+ }
5231
+ setValue(source) {
5232
+ const payload = this.getPayload();
5233
+ if (source.length == payload.length) {
5234
+ return payload.map((node, i) => node.setValue(source[i])).some(Boolean);
5235
+ }
5236
+ super.setValue(source.map(makeAnimated));
5237
+ return true;
5238
+ }
5239
+ };
5240
+ function makeAnimated(value) {
5241
+ const nodeType = isAnimatedString(value) ? AnimatedString : AnimatedValue;
5242
+ return nodeType.create(value);
5243
+ }
5244
+ function getAnimatedType(value) {
5245
+ const parentNode = getAnimated(value);
5246
+ return parentNode ? parentNode.constructor : is.arr(value) ? AnimatedArray : isAnimatedString(value) ? AnimatedString : AnimatedValue;
5247
+ }
5248
+ var withAnimated = (Component, host2) => {
5249
+ const hasInstance = (
5250
+ // Function components must use "forwardRef" to avoid being
5251
+ // re-rendered on every animation frame.
5252
+ !is.fun(Component) || Component.prototype && Component.prototype.isReactComponent
5253
+ );
5254
+ return React.forwardRef((givenProps, givenRef) => {
5255
+ const instanceRef = React.useRef(null);
5256
+ const ref = hasInstance && // eslint-disable-next-line react-hooks/rules-of-hooks
5257
+ React.useCallback(
5258
+ (value) => {
5259
+ instanceRef.current = updateRef(givenRef, value);
5260
+ },
5261
+ [givenRef]
5262
+ );
5263
+ const [props, deps] = getAnimatedState(givenProps, host2);
5264
+ const forceUpdate = useForceUpdate();
5265
+ const callback = () => {
5266
+ const instance = instanceRef.current;
5267
+ if (hasInstance && !instance) {
5268
+ return;
5269
+ }
5270
+ const didUpdate = instance ? host2.applyAnimatedValues(instance, props.getValue(true)) : false;
5271
+ if (didUpdate === false) {
5272
+ forceUpdate();
5273
+ }
5274
+ };
5275
+ const observer = new PropsObserver(callback, deps);
5276
+ const observerRef = React.useRef();
5277
+ useIsomorphicLayoutEffect(() => {
5278
+ observerRef.current = observer;
5279
+ each(deps, (dep) => addFluidObserver(dep, observer));
5280
+ return () => {
5281
+ if (observerRef.current) {
5282
+ each(
5283
+ observerRef.current.deps,
5284
+ (dep) => removeFluidObserver(dep, observerRef.current)
5285
+ );
5286
+ raf.cancel(observerRef.current.update);
5287
+ }
5288
+ };
5289
+ });
5290
+ React.useEffect(callback, []);
5291
+ useOnce(() => () => {
5292
+ const observer2 = observerRef.current;
5293
+ each(observer2.deps, (dep) => removeFluidObserver(dep, observer2));
5294
+ });
5295
+ const usedProps = host2.getComponentProps(props.getValue());
5296
+ return /* @__PURE__ */ React__namespace.createElement(Component, { ...usedProps, ref });
5297
+ });
5298
+ };
5299
+ var PropsObserver = class {
5300
+ constructor(update2, deps) {
5301
+ this.update = update2;
5302
+ this.deps = deps;
5303
+ }
5304
+ eventObserved(event) {
5305
+ if (event.type == "change") {
5306
+ raf.write(this.update);
5307
+ }
5308
+ }
5309
+ };
5310
+ function getAnimatedState(props, host2) {
5311
+ const dependencies = /* @__PURE__ */ new Set();
5312
+ TreeContext.dependencies = dependencies;
5313
+ if (props.style)
5314
+ props = {
5315
+ ...props,
5316
+ style: host2.createAnimatedStyle(props.style)
5317
+ };
5318
+ props = new AnimatedObject(props);
5319
+ TreeContext.dependencies = null;
5320
+ return [props, dependencies];
5321
+ }
5322
+ function updateRef(ref, value) {
5323
+ if (ref) {
5324
+ if (is.fun(ref))
5325
+ ref(value);
5326
+ else
5327
+ ref.current = value;
5328
+ }
5329
+ return value;
5330
+ }
5331
+ var cacheKey = Symbol.for("AnimatedComponent");
5332
+ var createHost = (components, {
5333
+ applyAnimatedValues: applyAnimatedValues2 = () => false,
5334
+ createAnimatedStyle = (style) => new AnimatedObject(style),
5335
+ getComponentProps = (props) => props
5336
+ } = {}) => {
5337
+ const hostConfig = {
5338
+ applyAnimatedValues: applyAnimatedValues2,
5339
+ createAnimatedStyle,
5340
+ getComponentProps
5341
+ };
5342
+ const animated2 = (Component) => {
5343
+ const displayName = getDisplayName(Component) || "Anonymous";
5344
+ if (is.str(Component)) {
5345
+ Component = animated2[Component] || (animated2[Component] = withAnimated(Component, hostConfig));
5346
+ } else {
5347
+ Component = Component[cacheKey] || (Component[cacheKey] = withAnimated(Component, hostConfig));
5348
+ }
5349
+ Component.displayName = `Animated(${displayName})`;
5350
+ return Component;
5351
+ };
5352
+ eachProp(components, (Component, key) => {
5353
+ if (is.arr(components)) {
5354
+ key = getDisplayName(Component);
5355
+ }
5356
+ animated2[key] = animated2(Component);
5357
+ });
5358
+ return {
5359
+ animated: animated2
5360
+ };
5361
+ };
5362
+ var getDisplayName = (arg) => is.str(arg) ? arg : arg && is.str(arg.displayName) ? arg.displayName : is.fun(arg) && arg.name || null;
5363
+ function callProp(value, ...args) {
5364
+ return is.fun(value) ? value(...args) : value;
5365
+ }
5366
+ var matchProp = (value, key) => value === true || !!(key && value && (is.fun(value) ? value(key) : toArray(value).includes(key)));
5367
+ var resolveProp = (prop, key) => is.obj(prop) ? key && prop[key] : prop;
5368
+ var getDefaultProp = (props, key) => props.default === true ? props[key] : props.default ? props.default[key] : void 0;
5369
+ var noopTransform = (value) => value;
5370
+ var getDefaultProps = (props, transform = noopTransform) => {
5371
+ let keys = DEFAULT_PROPS;
5372
+ if (props.default && props.default !== true) {
5373
+ props = props.default;
5374
+ keys = Object.keys(props);
5375
+ }
5376
+ const defaults2 = {};
5377
+ for (const key of keys) {
5378
+ const value = transform(props[key], key);
5379
+ if (!is.und(value)) {
5380
+ defaults2[key] = value;
5381
+ }
5382
+ }
5383
+ return defaults2;
5384
+ };
5385
+ var DEFAULT_PROPS = [
5386
+ "config",
5387
+ "onProps",
5388
+ "onStart",
5389
+ "onChange",
5390
+ "onPause",
5391
+ "onResume",
5392
+ "onRest"
5393
+ ];
5394
+ var RESERVED_PROPS = {
5395
+ config: 1,
5396
+ from: 1,
5397
+ to: 1,
5398
+ ref: 1,
5399
+ loop: 1,
5400
+ reset: 1,
5401
+ pause: 1,
5402
+ cancel: 1,
5403
+ reverse: 1,
5404
+ immediate: 1,
5405
+ default: 1,
5406
+ delay: 1,
5407
+ onProps: 1,
5408
+ onStart: 1,
5409
+ onChange: 1,
5410
+ onPause: 1,
5411
+ onResume: 1,
5412
+ onRest: 1,
5413
+ onResolve: 1,
5414
+ // Transition props
5415
+ items: 1,
5416
+ trail: 1,
5417
+ sort: 1,
5418
+ expires: 1,
5419
+ initial: 1,
5420
+ enter: 1,
5421
+ update: 1,
5422
+ leave: 1,
5423
+ children: 1,
5424
+ onDestroyed: 1,
5425
+ // Internal props
5426
+ keys: 1,
5427
+ callId: 1,
5428
+ parentId: 1
5429
+ };
5430
+ function getForwardProps(props) {
5431
+ const forward = {};
5432
+ let count = 0;
5433
+ eachProp(props, (value, prop) => {
5434
+ if (!RESERVED_PROPS[prop]) {
5435
+ forward[prop] = value;
5436
+ count++;
5437
+ }
5438
+ });
5439
+ if (count) {
5440
+ return forward;
5441
+ }
5442
+ }
5443
+ function inferTo(props) {
5444
+ const to2 = getForwardProps(props);
5445
+ if (to2) {
5446
+ const out = { to: to2 };
5447
+ eachProp(props, (val, key) => key in to2 || (out[key] = val));
5448
+ return out;
5449
+ }
5450
+ return { ...props };
5451
+ }
5452
+ function computeGoal(value) {
5453
+ value = getFluidValue(value);
5454
+ return is.arr(value) ? value.map(computeGoal) : isAnimatedString(value) ? globals_exports.createStringInterpolator({
5455
+ range: [0, 1],
5456
+ output: [value, value]
5457
+ })(1) : value;
5458
+ }
5459
+ function hasProps(props) {
5460
+ for (const _ in props)
5461
+ return true;
5462
+ return false;
5463
+ }
5464
+ function isAsyncTo(to2) {
5465
+ return is.fun(to2) || is.arr(to2) && is.obj(to2[0]);
5466
+ }
5467
+ function detachRefs(ctrl, ref) {
5468
+ var _a;
5469
+ (_a = ctrl.ref) == null ? void 0 : _a.delete(ctrl);
5470
+ ref == null ? void 0 : ref.delete(ctrl);
5471
+ }
5472
+ function replaceRef(ctrl, ref) {
5473
+ var _a;
5474
+ if (ref && ctrl.ref !== ref) {
5475
+ (_a = ctrl.ref) == null ? void 0 : _a.delete(ctrl);
5476
+ ref.add(ctrl);
5477
+ ctrl.ref = ref;
5478
+ }
5479
+ }
5480
+ var config = {
5481
+ default: { tension: 170, friction: 26 }
5482
+ };
5483
+ var defaults = {
5484
+ ...config.default,
5485
+ mass: 1,
5486
+ damping: 1,
5487
+ easing: easings$1.linear,
5488
+ clamp: false
5489
+ };
5490
+ var AnimationConfig = class {
5491
+ constructor() {
5492
+ this.velocity = 0;
5493
+ Object.assign(this, defaults);
5494
+ }
5495
+ };
5496
+ function mergeConfig(config2, newConfig, defaultConfig) {
5497
+ if (defaultConfig) {
5498
+ defaultConfig = { ...defaultConfig };
5499
+ sanitizeConfig(defaultConfig, newConfig);
5500
+ newConfig = { ...defaultConfig, ...newConfig };
5501
+ }
5502
+ sanitizeConfig(config2, newConfig);
5503
+ Object.assign(config2, newConfig);
5504
+ for (const key in defaults) {
5505
+ if (config2[key] == null) {
5506
+ config2[key] = defaults[key];
5507
+ }
5508
+ }
5509
+ let { frequency, damping } = config2;
5510
+ const { mass } = config2;
5511
+ if (!is.und(frequency)) {
5512
+ if (frequency < 0.01)
5513
+ frequency = 0.01;
5514
+ if (damping < 0)
5515
+ damping = 0;
5516
+ config2.tension = Math.pow(2 * Math.PI / frequency, 2) * mass;
5517
+ config2.friction = 4 * Math.PI * damping * mass / frequency;
5518
+ }
5519
+ return config2;
5520
+ }
5521
+ function sanitizeConfig(config2, props) {
5522
+ if (!is.und(props.decay)) {
5523
+ config2.duration = void 0;
5524
+ } else {
5525
+ const isTensionConfig = !is.und(props.tension) || !is.und(props.friction);
5526
+ if (isTensionConfig || !is.und(props.frequency) || !is.und(props.damping) || !is.und(props.mass)) {
5527
+ config2.duration = void 0;
5528
+ config2.decay = void 0;
5529
+ }
5530
+ if (isTensionConfig) {
5531
+ config2.frequency = void 0;
5532
+ }
5533
+ }
5534
+ }
5535
+ var emptyArray = [];
5536
+ var Animation = class {
5537
+ constructor() {
5538
+ this.changed = false;
5539
+ this.values = emptyArray;
5540
+ this.toValues = null;
5541
+ this.fromValues = emptyArray;
5542
+ this.config = new AnimationConfig();
5543
+ this.immediate = false;
5544
+ }
5545
+ };
5546
+ function scheduleProps(callId, { key, props, defaultProps, state, actions }) {
5547
+ return new Promise((resolve, reject) => {
5548
+ let delay2;
5549
+ let timeout;
5550
+ let cancel = matchProp(props.cancel ?? (defaultProps == null ? void 0 : defaultProps.cancel), key);
5551
+ if (cancel) {
5552
+ onStart();
5553
+ } else {
5554
+ if (!is.und(props.pause)) {
5555
+ state.paused = matchProp(props.pause, key);
5556
+ }
5557
+ let pause = defaultProps == null ? void 0 : defaultProps.pause;
5558
+ if (pause !== true) {
5559
+ pause = state.paused || matchProp(pause, key);
5560
+ }
5561
+ delay2 = callProp(props.delay || 0, key);
5562
+ if (pause) {
5563
+ state.resumeQueue.add(onResume);
5564
+ actions.pause();
5565
+ } else {
5566
+ actions.resume();
5567
+ onResume();
5568
+ }
5569
+ }
5570
+ function onPause() {
5571
+ state.resumeQueue.add(onResume);
5572
+ state.timeouts.delete(timeout);
5573
+ timeout.cancel();
5574
+ delay2 = timeout.time - raf.now();
5575
+ }
5576
+ function onResume() {
5577
+ if (delay2 > 0 && !globals_exports.skipAnimation) {
5578
+ state.delayed = true;
5579
+ timeout = raf.setTimeout(onStart, delay2);
5580
+ state.pauseQueue.add(onPause);
5581
+ state.timeouts.add(timeout);
5582
+ } else {
5583
+ onStart();
5584
+ }
5585
+ }
5586
+ function onStart() {
5587
+ if (state.delayed) {
5588
+ state.delayed = false;
5589
+ }
5590
+ state.pauseQueue.delete(onPause);
5591
+ state.timeouts.delete(timeout);
5592
+ if (callId <= (state.cancelId || 0)) {
5593
+ cancel = true;
5594
+ }
5595
+ try {
5596
+ actions.start({ ...props, callId, cancel }, resolve);
5597
+ } catch (err) {
5598
+ reject(err);
5599
+ }
5600
+ }
5601
+ });
5602
+ }
5603
+ var getCombinedResult = (target, results) => results.length == 1 ? results[0] : results.some((result) => result.cancelled) ? getCancelledResult(target.get()) : results.every((result) => result.noop) ? getNoopResult(target.get()) : getFinishedResult(
5604
+ target.get(),
5605
+ results.every((result) => result.finished)
5606
+ );
5607
+ var getNoopResult = (value) => ({
5608
+ value,
5609
+ noop: true,
5610
+ finished: true,
5611
+ cancelled: false
5612
+ });
5613
+ var getFinishedResult = (value, finished, cancelled = false) => ({
5614
+ value,
5615
+ finished,
5616
+ cancelled
5617
+ });
5618
+ var getCancelledResult = (value) => ({
5619
+ value,
5620
+ cancelled: true,
5621
+ finished: false
5622
+ });
5623
+ function runAsync(to2, props, state, target) {
5624
+ const { callId, parentId, onRest } = props;
5625
+ const { asyncTo: prevTo, promise: prevPromise } = state;
5626
+ if (!parentId && to2 === prevTo && !props.reset) {
5627
+ return prevPromise;
5628
+ }
5629
+ return state.promise = (async () => {
5630
+ state.asyncId = callId;
5631
+ state.asyncTo = to2;
5632
+ const defaultProps = getDefaultProps(
5633
+ props,
5634
+ (value, key) => (
5635
+ // The `onRest` prop is only called when the `runAsync` promise is resolved.
5636
+ key === "onRest" ? void 0 : value
5637
+ )
5638
+ );
5639
+ let preventBail;
5640
+ let bail;
5641
+ const bailPromise = new Promise(
5642
+ (resolve, reject) => (preventBail = resolve, bail = reject)
5643
+ );
5644
+ const bailIfEnded = (bailSignal) => {
5645
+ const bailResult = (
5646
+ // The `cancel` prop or `stop` method was used.
5647
+ callId <= (state.cancelId || 0) && getCancelledResult(target) || // The async `to` prop was replaced.
5648
+ callId !== state.asyncId && getFinishedResult(target, false)
5649
+ );
5650
+ if (bailResult) {
5651
+ bailSignal.result = bailResult;
5652
+ bail(bailSignal);
5653
+ throw bailSignal;
5654
+ }
5655
+ };
5656
+ const animate = (arg1, arg2) => {
5657
+ const bailSignal = new BailSignal();
5658
+ const skipAnimationSignal = new SkipAnimationSignal();
5659
+ return (async () => {
5660
+ if (globals_exports.skipAnimation) {
5661
+ stopAsync(state);
5662
+ skipAnimationSignal.result = getFinishedResult(target, false);
5663
+ bail(skipAnimationSignal);
5664
+ throw skipAnimationSignal;
5665
+ }
5666
+ bailIfEnded(bailSignal);
5667
+ const props2 = is.obj(arg1) ? { ...arg1 } : { ...arg2, to: arg1 };
5668
+ props2.parentId = callId;
5669
+ eachProp(defaultProps, (value, key) => {
5670
+ if (is.und(props2[key])) {
5671
+ props2[key] = value;
5672
+ }
5673
+ });
5674
+ const result2 = await target.start(props2);
5675
+ bailIfEnded(bailSignal);
5676
+ if (state.paused) {
5677
+ await new Promise((resume) => {
5678
+ state.resumeQueue.add(resume);
5679
+ });
5680
+ }
5681
+ return result2;
5682
+ })();
5683
+ };
5684
+ let result;
5685
+ if (globals_exports.skipAnimation) {
5686
+ stopAsync(state);
5687
+ return getFinishedResult(target, false);
5688
+ }
5689
+ try {
5690
+ let animating;
5691
+ if (is.arr(to2)) {
5692
+ animating = (async (queue) => {
5693
+ for (const props2 of queue) {
5694
+ await animate(props2);
5695
+ }
5696
+ })(to2);
5697
+ } else {
5698
+ animating = Promise.resolve(to2(animate, target.stop.bind(target)));
5699
+ }
5700
+ await Promise.all([animating.then(preventBail), bailPromise]);
5701
+ result = getFinishedResult(target.get(), true, false);
5702
+ } catch (err) {
5703
+ if (err instanceof BailSignal) {
5704
+ result = err.result;
5705
+ } else if (err instanceof SkipAnimationSignal) {
5706
+ result = err.result;
5707
+ } else {
5708
+ throw err;
5709
+ }
5710
+ } finally {
5711
+ if (callId == state.asyncId) {
5712
+ state.asyncId = parentId;
5713
+ state.asyncTo = parentId ? prevTo : void 0;
5714
+ state.promise = parentId ? prevPromise : void 0;
5715
+ }
5716
+ }
5717
+ if (is.fun(onRest)) {
5718
+ raf.batchedUpdates(() => {
5719
+ onRest(result, target, target.item);
5720
+ });
5721
+ }
5722
+ return result;
5723
+ })();
5724
+ }
5725
+ function stopAsync(state, cancelId) {
5726
+ flush(state.timeouts, (t) => t.cancel());
5727
+ state.pauseQueue.clear();
5728
+ state.resumeQueue.clear();
5729
+ state.asyncId = state.asyncTo = state.promise = void 0;
5730
+ if (cancelId)
5731
+ state.cancelId = cancelId;
5732
+ }
5733
+ var BailSignal = class extends Error {
5734
+ constructor() {
5735
+ super(
5736
+ "An async animation has been interrupted. You see this error because you forgot to use `await` or `.catch(...)` on its returned promise."
5737
+ );
5738
+ }
5739
+ };
5740
+ var SkipAnimationSignal = class extends Error {
5741
+ constructor() {
5742
+ super("SkipAnimationSignal");
5743
+ }
5744
+ };
5745
+ var isFrameValue = (value) => value instanceof FrameValue;
5746
+ var nextId = 1;
5747
+ var FrameValue = class extends FluidValue {
5748
+ constructor() {
5749
+ super(...arguments);
5750
+ this.id = nextId++;
5751
+ this._priority = 0;
5752
+ }
5753
+ get priority() {
5754
+ return this._priority;
5755
+ }
5756
+ set priority(priority2) {
5757
+ if (this._priority != priority2) {
5758
+ this._priority = priority2;
5759
+ this._onPriorityChange(priority2);
5760
+ }
5761
+ }
5762
+ /** Get the current value */
5763
+ get() {
5764
+ const node = getAnimated(this);
5765
+ return node && node.getValue();
5766
+ }
5767
+ /** Create a spring that maps our value to another value */
5768
+ to(...args) {
5769
+ return globals_exports.to(this, args);
5770
+ }
5771
+ /** @deprecated Use the `to` method instead. */
5772
+ interpolate(...args) {
5773
+ deprecateInterpolate();
5774
+ return globals_exports.to(this, args);
5775
+ }
5776
+ toJSON() {
5777
+ return this.get();
5778
+ }
5779
+ observerAdded(count) {
5780
+ if (count == 1)
5781
+ this._attach();
5782
+ }
5783
+ observerRemoved(count) {
5784
+ if (count == 0)
5785
+ this._detach();
5786
+ }
5787
+ /** Called when the first child is added. */
5788
+ _attach() {
5789
+ }
5790
+ /** Called when the last child is removed. */
5791
+ _detach() {
5792
+ }
5793
+ /** Tell our children about our new value */
5794
+ _onChange(value, idle = false) {
5795
+ callFluidObservers(this, {
5796
+ type: "change",
5797
+ parent: this,
5798
+ value,
5799
+ idle
5800
+ });
5801
+ }
5802
+ /** Tell our children about our new priority */
5803
+ _onPriorityChange(priority2) {
5804
+ if (!this.idle) {
5805
+ frameLoop.sort(this);
5806
+ }
5807
+ callFluidObservers(this, {
5808
+ type: "priority",
5809
+ parent: this,
5810
+ priority: priority2
5811
+ });
5812
+ }
5813
+ };
5814
+ var $P = Symbol.for("SpringPhase");
5815
+ var HAS_ANIMATED = 1;
5816
+ var IS_ANIMATING = 2;
5817
+ var IS_PAUSED = 4;
5818
+ var hasAnimated = (target) => (target[$P] & HAS_ANIMATED) > 0;
5819
+ var isAnimating = (target) => (target[$P] & IS_ANIMATING) > 0;
5820
+ var isPaused = (target) => (target[$P] & IS_PAUSED) > 0;
5821
+ var setActiveBit = (target, active) => active ? target[$P] |= IS_ANIMATING | HAS_ANIMATED : target[$P] &= -3;
5822
+ var setPausedBit = (target, paused) => paused ? target[$P] |= IS_PAUSED : target[$P] &= -5;
5823
+ var SpringValue = class extends FrameValue {
5824
+ constructor(arg1, arg2) {
5825
+ super();
5826
+ this.animation = new Animation();
5827
+ this.defaultProps = {};
5828
+ this._state = {
5829
+ paused: false,
5830
+ delayed: false,
5831
+ pauseQueue: /* @__PURE__ */ new Set(),
5832
+ resumeQueue: /* @__PURE__ */ new Set(),
5833
+ timeouts: /* @__PURE__ */ new Set()
5834
+ };
5835
+ this._pendingCalls = /* @__PURE__ */ new Set();
5836
+ this._lastCallId = 0;
5837
+ this._lastToId = 0;
5838
+ this._memoizedDuration = 0;
5839
+ if (!is.und(arg1) || !is.und(arg2)) {
5840
+ const props = is.obj(arg1) ? { ...arg1 } : { ...arg2, from: arg1 };
5841
+ if (is.und(props.default)) {
5842
+ props.default = true;
5843
+ }
5844
+ this.start(props);
5845
+ }
5846
+ }
5847
+ /** Equals true when not advancing on each frame. */
5848
+ get idle() {
5849
+ return !(isAnimating(this) || this._state.asyncTo) || isPaused(this);
5850
+ }
5851
+ get goal() {
5852
+ return getFluidValue(this.animation.to);
5853
+ }
5854
+ get velocity() {
5855
+ const node = getAnimated(this);
5856
+ return node instanceof AnimatedValue ? node.lastVelocity || 0 : node.getPayload().map((node2) => node2.lastVelocity || 0);
5857
+ }
5858
+ /**
5859
+ * When true, this value has been animated at least once.
5860
+ */
5861
+ get hasAnimated() {
5862
+ return hasAnimated(this);
5863
+ }
5864
+ /**
5865
+ * When true, this value has an unfinished animation,
5866
+ * which is either active or paused.
5867
+ */
5868
+ get isAnimating() {
5869
+ return isAnimating(this);
5870
+ }
5871
+ /**
5872
+ * When true, all current and future animations are paused.
5873
+ */
5874
+ get isPaused() {
5875
+ return isPaused(this);
5876
+ }
5877
+ /**
5878
+ *
5879
+ *
5880
+ */
5881
+ get isDelayed() {
5882
+ return this._state.delayed;
5883
+ }
5884
+ /** Advance the current animation by a number of milliseconds */
5885
+ advance(dt) {
5886
+ let idle = true;
5887
+ let changed = false;
5888
+ const anim = this.animation;
5889
+ let { toValues } = anim;
5890
+ const { config: config2 } = anim;
5891
+ const payload = getPayload(anim.to);
5892
+ if (!payload && hasFluidValue(anim.to)) {
5893
+ toValues = toArray(getFluidValue(anim.to));
5894
+ }
5895
+ anim.values.forEach((node2, i) => {
5896
+ if (node2.done)
5897
+ return;
5898
+ const to2 = (
5899
+ // Animated strings always go from 0 to 1.
5900
+ node2.constructor == AnimatedString ? 1 : payload ? payload[i].lastPosition : toValues[i]
5901
+ );
5902
+ let finished = anim.immediate;
5903
+ let position = to2;
5904
+ if (!finished) {
5905
+ position = node2.lastPosition;
5906
+ if (config2.tension <= 0) {
5907
+ node2.done = true;
5908
+ return;
5909
+ }
5910
+ let elapsed = node2.elapsedTime += dt;
5911
+ const from = anim.fromValues[i];
5912
+ const v0 = node2.v0 != null ? node2.v0 : node2.v0 = is.arr(config2.velocity) ? config2.velocity[i] : config2.velocity;
5913
+ let velocity;
5914
+ const precision = config2.precision || (from == to2 ? 5e-3 : Math.min(1, Math.abs(to2 - from) * 1e-3));
5915
+ if (!is.und(config2.duration)) {
5916
+ let p = 1;
5917
+ if (config2.duration > 0) {
5918
+ if (this._memoizedDuration !== config2.duration) {
5919
+ this._memoizedDuration = config2.duration;
5920
+ if (node2.durationProgress > 0) {
5921
+ node2.elapsedTime = config2.duration * node2.durationProgress;
5922
+ elapsed = node2.elapsedTime += dt;
5923
+ }
5924
+ }
5925
+ p = (config2.progress || 0) + elapsed / this._memoizedDuration;
5926
+ p = p > 1 ? 1 : p < 0 ? 0 : p;
5927
+ node2.durationProgress = p;
5928
+ }
5929
+ position = from + config2.easing(p) * (to2 - from);
5930
+ velocity = (position - node2.lastPosition) / dt;
5931
+ finished = p == 1;
5932
+ } else if (config2.decay) {
5933
+ const decay = config2.decay === true ? 0.998 : config2.decay;
5934
+ const e = Math.exp(-(1 - decay) * elapsed);
5935
+ position = from + v0 / (1 - decay) * (1 - e);
5936
+ finished = Math.abs(node2.lastPosition - position) <= precision;
5937
+ velocity = v0 * e;
5938
+ } else {
5939
+ velocity = node2.lastVelocity == null ? v0 : node2.lastVelocity;
5940
+ const restVelocity = config2.restVelocity || precision / 10;
5941
+ const bounceFactor = config2.clamp ? 0 : config2.bounce;
5942
+ const canBounce = !is.und(bounceFactor);
5943
+ const isGrowing = from == to2 ? node2.v0 > 0 : from < to2;
5944
+ let isMoving;
5945
+ let isBouncing = false;
5946
+ const step = 1;
5947
+ const numSteps = Math.ceil(dt / step);
5948
+ for (let n = 0; n < numSteps; ++n) {
5949
+ isMoving = Math.abs(velocity) > restVelocity;
5950
+ if (!isMoving) {
5951
+ finished = Math.abs(to2 - position) <= precision;
5952
+ if (finished) {
5953
+ break;
5954
+ }
5955
+ }
5956
+ if (canBounce) {
5957
+ isBouncing = position == to2 || position > to2 == isGrowing;
5958
+ if (isBouncing) {
5959
+ velocity = -velocity * bounceFactor;
5960
+ position = to2;
5961
+ }
5962
+ }
5963
+ const springForce = -config2.tension * 1e-6 * (position - to2);
5964
+ const dampingForce = -config2.friction * 1e-3 * velocity;
5965
+ const acceleration = (springForce + dampingForce) / config2.mass;
5966
+ velocity = velocity + acceleration * step;
5967
+ position = position + velocity * step;
5968
+ }
5969
+ }
5970
+ node2.lastVelocity = velocity;
5971
+ if (Number.isNaN(position)) {
5972
+ console.warn(`Got NaN while animating:`, this);
5973
+ finished = true;
5974
+ }
5975
+ }
5976
+ if (payload && !payload[i].done) {
5977
+ finished = false;
5978
+ }
5979
+ if (finished) {
5980
+ node2.done = true;
5981
+ } else {
5982
+ idle = false;
5983
+ }
5984
+ if (node2.setValue(position, config2.round)) {
5985
+ changed = true;
5986
+ }
5987
+ });
5988
+ const node = getAnimated(this);
5989
+ const currVal = node.getValue();
5990
+ if (idle) {
5991
+ const finalVal = getFluidValue(anim.to);
5992
+ if ((currVal !== finalVal || changed) && !config2.decay) {
5993
+ node.setValue(finalVal);
5994
+ this._onChange(finalVal);
5995
+ } else if (changed && config2.decay) {
5996
+ this._onChange(currVal);
5997
+ }
5998
+ this._stop();
5999
+ } else if (changed) {
6000
+ this._onChange(currVal);
6001
+ }
6002
+ }
6003
+ /** Set the current value, while stopping the current animation */
6004
+ set(value) {
6005
+ raf.batchedUpdates(() => {
6006
+ this._stop();
6007
+ this._focus(value);
6008
+ this._set(value);
6009
+ });
6010
+ return this;
6011
+ }
6012
+ /**
6013
+ * Freeze the active animation in time, as well as any updates merged
6014
+ * before `resume` is called.
6015
+ */
6016
+ pause() {
6017
+ this._update({ pause: true });
6018
+ }
6019
+ /** Resume the animation if paused. */
6020
+ resume() {
6021
+ this._update({ pause: false });
6022
+ }
6023
+ /** Skip to the end of the current animation. */
6024
+ finish() {
6025
+ if (isAnimating(this)) {
6026
+ const { to: to2, config: config2 } = this.animation;
6027
+ raf.batchedUpdates(() => {
6028
+ this._onStart();
6029
+ if (!config2.decay) {
6030
+ this._set(to2, false);
6031
+ }
6032
+ this._stop();
6033
+ });
6034
+ }
6035
+ return this;
6036
+ }
6037
+ /** Push props into the pending queue. */
6038
+ update(props) {
6039
+ const queue = this.queue || (this.queue = []);
6040
+ queue.push(props);
6041
+ return this;
6042
+ }
6043
+ start(to2, arg2) {
6044
+ let queue;
6045
+ if (!is.und(to2)) {
6046
+ queue = [is.obj(to2) ? to2 : { ...arg2, to: to2 }];
6047
+ } else {
6048
+ queue = this.queue || [];
6049
+ this.queue = [];
6050
+ }
6051
+ return Promise.all(
6052
+ queue.map((props) => {
6053
+ const up = this._update(props);
6054
+ return up;
6055
+ })
6056
+ ).then((results) => getCombinedResult(this, results));
6057
+ }
6058
+ /**
6059
+ * Stop the current animation, and cancel any delayed updates.
6060
+ *
6061
+ * Pass `true` to call `onRest` with `cancelled: true`.
6062
+ */
6063
+ stop(cancel) {
6064
+ const { to: to2 } = this.animation;
6065
+ this._focus(this.get());
6066
+ stopAsync(this._state, cancel && this._lastCallId);
6067
+ raf.batchedUpdates(() => this._stop(to2, cancel));
6068
+ return this;
6069
+ }
6070
+ /** Restart the animation. */
6071
+ reset() {
6072
+ this._update({ reset: true });
6073
+ }
6074
+ /** @internal */
6075
+ eventObserved(event) {
6076
+ if (event.type == "change") {
6077
+ this._start();
6078
+ } else if (event.type == "priority") {
6079
+ this.priority = event.priority + 1;
6080
+ }
6081
+ }
6082
+ /**
6083
+ * Parse the `to` and `from` range from the given `props` object.
6084
+ *
6085
+ * This also ensures the initial value is available to animated components
6086
+ * during the render phase.
6087
+ */
6088
+ _prepareNode(props) {
6089
+ const key = this.key || "";
6090
+ let { to: to2, from } = props;
6091
+ to2 = is.obj(to2) ? to2[key] : to2;
6092
+ if (to2 == null || isAsyncTo(to2)) {
6093
+ to2 = void 0;
6094
+ }
6095
+ from = is.obj(from) ? from[key] : from;
6096
+ if (from == null) {
6097
+ from = void 0;
6098
+ }
6099
+ const range = { to: to2, from };
6100
+ if (!hasAnimated(this)) {
6101
+ if (props.reverse)
6102
+ [to2, from] = [from, to2];
6103
+ from = getFluidValue(from);
6104
+ if (!is.und(from)) {
6105
+ this._set(from);
6106
+ } else if (!getAnimated(this)) {
6107
+ this._set(to2);
6108
+ }
6109
+ }
6110
+ return range;
6111
+ }
6112
+ /** Every update is processed by this method before merging. */
6113
+ _update({ ...props }, isLoop) {
6114
+ const { key, defaultProps } = this;
6115
+ if (props.default)
6116
+ Object.assign(
6117
+ defaultProps,
6118
+ getDefaultProps(
6119
+ props,
6120
+ (value, prop) => /^on/.test(prop) ? resolveProp(value, key) : value
6121
+ )
6122
+ );
6123
+ mergeActiveFn(this, props, "onProps");
6124
+ sendEvent(this, "onProps", props, this);
6125
+ const range = this._prepareNode(props);
6126
+ if (Object.isFrozen(this)) {
6127
+ throw Error(
6128
+ "Cannot animate a `SpringValue` object that is frozen. Did you forget to pass your component to `animated(...)` before animating its props?"
6129
+ );
6130
+ }
6131
+ const state = this._state;
6132
+ return scheduleProps(++this._lastCallId, {
6133
+ key,
6134
+ props,
6135
+ defaultProps,
6136
+ state,
6137
+ actions: {
6138
+ pause: () => {
6139
+ if (!isPaused(this)) {
6140
+ setPausedBit(this, true);
6141
+ flushCalls(state.pauseQueue);
6142
+ sendEvent(
6143
+ this,
6144
+ "onPause",
6145
+ getFinishedResult(this, checkFinished(this, this.animation.to)),
6146
+ this
6147
+ );
6148
+ }
6149
+ },
6150
+ resume: () => {
6151
+ if (isPaused(this)) {
6152
+ setPausedBit(this, false);
6153
+ if (isAnimating(this)) {
6154
+ this._resume();
6155
+ }
6156
+ flushCalls(state.resumeQueue);
6157
+ sendEvent(
6158
+ this,
6159
+ "onResume",
6160
+ getFinishedResult(this, checkFinished(this, this.animation.to)),
6161
+ this
6162
+ );
6163
+ }
6164
+ },
6165
+ start: this._merge.bind(this, range)
6166
+ }
6167
+ }).then((result) => {
6168
+ if (props.loop && result.finished && !(isLoop && result.noop)) {
6169
+ const nextProps = createLoopUpdate(props);
6170
+ if (nextProps) {
6171
+ return this._update(nextProps, true);
6172
+ }
6173
+ }
6174
+ return result;
6175
+ });
6176
+ }
6177
+ /** Merge props into the current animation */
6178
+ _merge(range, props, resolve) {
6179
+ if (props.cancel) {
6180
+ this.stop(true);
6181
+ return resolve(getCancelledResult(this));
6182
+ }
6183
+ const hasToProp = !is.und(range.to);
6184
+ const hasFromProp = !is.und(range.from);
6185
+ if (hasToProp || hasFromProp) {
6186
+ if (props.callId > this._lastToId) {
6187
+ this._lastToId = props.callId;
6188
+ } else {
6189
+ return resolve(getCancelledResult(this));
6190
+ }
6191
+ }
6192
+ const { key, defaultProps, animation: anim } = this;
6193
+ const { to: prevTo, from: prevFrom } = anim;
6194
+ let { to: to2 = prevTo, from = prevFrom } = range;
6195
+ if (hasFromProp && !hasToProp && (!props.default || is.und(to2))) {
6196
+ to2 = from;
6197
+ }
6198
+ if (props.reverse)
6199
+ [to2, from] = [from, to2];
6200
+ const hasFromChanged = !isEqual(from, prevFrom);
6201
+ if (hasFromChanged) {
6202
+ anim.from = from;
6203
+ }
6204
+ from = getFluidValue(from);
6205
+ const hasToChanged = !isEqual(to2, prevTo);
6206
+ if (hasToChanged) {
6207
+ this._focus(to2);
6208
+ }
6209
+ const hasAsyncTo = isAsyncTo(props.to);
6210
+ const { config: config2 } = anim;
6211
+ const { decay, velocity } = config2;
6212
+ if (hasToProp || hasFromProp) {
6213
+ config2.velocity = 0;
6214
+ }
6215
+ if (props.config && !hasAsyncTo) {
6216
+ mergeConfig(
6217
+ config2,
6218
+ callProp(props.config, key),
6219
+ // Avoid calling the same "config" prop twice.
6220
+ props.config !== defaultProps.config ? callProp(defaultProps.config, key) : void 0
6221
+ );
6222
+ }
6223
+ let node = getAnimated(this);
6224
+ if (!node || is.und(to2)) {
6225
+ return resolve(getFinishedResult(this, true));
6226
+ }
6227
+ const reset = (
6228
+ // When `reset` is undefined, the `from` prop implies `reset: true`,
6229
+ // except for declarative updates. When `reset` is defined, there
6230
+ // must exist a value to animate from.
6231
+ is.und(props.reset) ? hasFromProp && !props.default : !is.und(from) && matchProp(props.reset, key)
6232
+ );
6233
+ const value = reset ? from : this.get();
6234
+ const goal = computeGoal(to2);
6235
+ const isAnimatable = is.num(goal) || is.arr(goal) || isAnimatedString(goal);
6236
+ const immediate = !hasAsyncTo && (!isAnimatable || matchProp(defaultProps.immediate || props.immediate, key));
6237
+ if (hasToChanged) {
6238
+ const nodeType = getAnimatedType(to2);
6239
+ if (nodeType !== node.constructor) {
6240
+ if (immediate) {
6241
+ node = this._set(goal);
6242
+ } else
6243
+ throw Error(
6244
+ `Cannot animate between ${node.constructor.name} and ${nodeType.name}, as the "to" prop suggests`
6245
+ );
6246
+ }
6247
+ }
6248
+ const goalType = node.constructor;
6249
+ let started = hasFluidValue(to2);
6250
+ let finished = false;
6251
+ if (!started) {
6252
+ const hasValueChanged = reset || !hasAnimated(this) && hasFromChanged;
6253
+ if (hasToChanged || hasValueChanged) {
6254
+ finished = isEqual(computeGoal(value), goal);
6255
+ started = !finished;
6256
+ }
6257
+ if (!isEqual(anim.immediate, immediate) && !immediate || !isEqual(config2.decay, decay) || !isEqual(config2.velocity, velocity)) {
6258
+ started = true;
6259
+ }
6260
+ }
6261
+ if (finished && isAnimating(this)) {
6262
+ if (anim.changed && !reset) {
6263
+ started = true;
6264
+ } else if (!started) {
6265
+ this._stop(prevTo);
6266
+ }
6267
+ }
6268
+ if (!hasAsyncTo) {
6269
+ if (started || hasFluidValue(prevTo)) {
6270
+ anim.values = node.getPayload();
6271
+ anim.toValues = hasFluidValue(to2) ? null : goalType == AnimatedString ? [1] : toArray(goal);
6272
+ }
6273
+ if (anim.immediate != immediate) {
6274
+ anim.immediate = immediate;
6275
+ if (!immediate && !reset) {
6276
+ this._set(prevTo);
6277
+ }
6278
+ }
6279
+ if (started) {
6280
+ const { onRest } = anim;
6281
+ each(ACTIVE_EVENTS, (type) => mergeActiveFn(this, props, type));
6282
+ const result = getFinishedResult(this, checkFinished(this, prevTo));
6283
+ flushCalls(this._pendingCalls, result);
6284
+ this._pendingCalls.add(resolve);
6285
+ if (anim.changed)
6286
+ raf.batchedUpdates(() => {
6287
+ var _a;
6288
+ anim.changed = !reset;
6289
+ onRest == null ? void 0 : onRest(result, this);
6290
+ if (reset) {
6291
+ callProp(defaultProps.onRest, result);
6292
+ } else {
6293
+ (_a = anim.onStart) == null ? void 0 : _a.call(anim, result, this);
6294
+ }
6295
+ });
6296
+ }
6297
+ }
6298
+ if (reset) {
6299
+ this._set(value);
6300
+ }
6301
+ if (hasAsyncTo) {
6302
+ resolve(runAsync(props.to, props, this._state, this));
6303
+ } else if (started) {
6304
+ this._start();
6305
+ } else if (isAnimating(this) && !hasToChanged) {
6306
+ this._pendingCalls.add(resolve);
6307
+ } else {
6308
+ resolve(getNoopResult(value));
6309
+ }
6310
+ }
6311
+ /** Update the `animation.to` value, which might be a `FluidValue` */
6312
+ _focus(value) {
6313
+ const anim = this.animation;
6314
+ if (value !== anim.to) {
6315
+ if (getFluidObservers(this)) {
6316
+ this._detach();
6317
+ }
6318
+ anim.to = value;
6319
+ if (getFluidObservers(this)) {
6320
+ this._attach();
6321
+ }
6322
+ }
6323
+ }
6324
+ _attach() {
6325
+ let priority2 = 0;
6326
+ const { to: to2 } = this.animation;
6327
+ if (hasFluidValue(to2)) {
6328
+ addFluidObserver(to2, this);
6329
+ if (isFrameValue(to2)) {
6330
+ priority2 = to2.priority + 1;
6331
+ }
6332
+ }
6333
+ this.priority = priority2;
6334
+ }
6335
+ _detach() {
6336
+ const { to: to2 } = this.animation;
6337
+ if (hasFluidValue(to2)) {
6338
+ removeFluidObserver(to2, this);
6339
+ }
6340
+ }
6341
+ /**
6342
+ * Update the current value from outside the frameloop,
6343
+ * and return the `Animated` node.
6344
+ */
6345
+ _set(arg, idle = true) {
6346
+ const value = getFluidValue(arg);
6347
+ if (!is.und(value)) {
6348
+ const oldNode = getAnimated(this);
6349
+ if (!oldNode || !isEqual(value, oldNode.getValue())) {
6350
+ const nodeType = getAnimatedType(value);
6351
+ if (!oldNode || oldNode.constructor != nodeType) {
6352
+ setAnimated(this, nodeType.create(value));
6353
+ } else {
6354
+ oldNode.setValue(value);
6355
+ }
6356
+ if (oldNode) {
6357
+ raf.batchedUpdates(() => {
6358
+ this._onChange(value, idle);
6359
+ });
6360
+ }
6361
+ }
6362
+ }
6363
+ return getAnimated(this);
6364
+ }
6365
+ _onStart() {
6366
+ const anim = this.animation;
6367
+ if (!anim.changed) {
6368
+ anim.changed = true;
6369
+ sendEvent(
6370
+ this,
6371
+ "onStart",
6372
+ getFinishedResult(this, checkFinished(this, anim.to)),
6373
+ this
6374
+ );
6375
+ }
6376
+ }
6377
+ _onChange(value, idle) {
6378
+ if (!idle) {
6379
+ this._onStart();
6380
+ callProp(this.animation.onChange, value, this);
6381
+ }
6382
+ callProp(this.defaultProps.onChange, value, this);
6383
+ super._onChange(value, idle);
6384
+ }
6385
+ // This method resets the animation state (even if already animating) to
6386
+ // ensure the latest from/to range is used, and it also ensures this spring
6387
+ // is added to the frameloop.
6388
+ _start() {
6389
+ const anim = this.animation;
6390
+ getAnimated(this).reset(getFluidValue(anim.to));
6391
+ if (!anim.immediate) {
6392
+ anim.fromValues = anim.values.map((node) => node.lastPosition);
6393
+ }
6394
+ if (!isAnimating(this)) {
6395
+ setActiveBit(this, true);
6396
+ if (!isPaused(this)) {
6397
+ this._resume();
6398
+ }
6399
+ }
6400
+ }
6401
+ _resume() {
6402
+ if (globals_exports.skipAnimation) {
6403
+ this.finish();
6404
+ } else {
6405
+ frameLoop.start(this);
6406
+ }
6407
+ }
6408
+ /**
6409
+ * Exit the frameloop and notify `onRest` listeners.
6410
+ *
6411
+ * Always wrap `_stop` calls with `batchedUpdates`.
6412
+ */
6413
+ _stop(goal, cancel) {
6414
+ if (isAnimating(this)) {
6415
+ setActiveBit(this, false);
6416
+ const anim = this.animation;
6417
+ each(anim.values, (node) => {
6418
+ node.done = true;
6419
+ });
6420
+ if (anim.toValues) {
6421
+ anim.onChange = anim.onPause = anim.onResume = void 0;
6422
+ }
6423
+ callFluidObservers(this, {
6424
+ type: "idle",
6425
+ parent: this
6426
+ });
6427
+ const result = cancel ? getCancelledResult(this.get()) : getFinishedResult(this.get(), checkFinished(this, goal ?? anim.to));
6428
+ flushCalls(this._pendingCalls, result);
6429
+ if (anim.changed) {
6430
+ anim.changed = false;
6431
+ sendEvent(this, "onRest", result, this);
6432
+ }
6433
+ }
6434
+ }
6435
+ };
6436
+ function checkFinished(target, to2) {
6437
+ const goal = computeGoal(to2);
6438
+ const value = computeGoal(target.get());
6439
+ return isEqual(value, goal);
6440
+ }
6441
+ function createLoopUpdate(props, loop2 = props.loop, to2 = props.to) {
6442
+ const loopRet = callProp(loop2);
6443
+ if (loopRet) {
6444
+ const overrides = loopRet !== true && inferTo(loopRet);
6445
+ const reverse = (overrides || props).reverse;
6446
+ const reset = !overrides || overrides.reset;
6447
+ return createUpdate({
6448
+ ...props,
6449
+ loop: loop2,
6450
+ // Avoid updating default props when looping.
6451
+ default: false,
6452
+ // Never loop the `pause` prop.
6453
+ pause: void 0,
6454
+ // For the "reverse" prop to loop as expected, the "to" prop
6455
+ // must be undefined. The "reverse" prop is ignored when the
6456
+ // "to" prop is an array or function.
6457
+ to: !reverse || isAsyncTo(to2) ? to2 : void 0,
6458
+ // Ignore the "from" prop except on reset.
6459
+ from: reset ? props.from : void 0,
6460
+ reset,
6461
+ // The "loop" prop can return a "useSpring" props object to
6462
+ // override any of the original props.
6463
+ ...overrides
6464
+ });
6465
+ }
6466
+ }
6467
+ function createUpdate(props) {
6468
+ const { to: to2, from } = props = inferTo(props);
6469
+ const keys = /* @__PURE__ */ new Set();
6470
+ if (is.obj(to2))
6471
+ findDefined(to2, keys);
6472
+ if (is.obj(from))
6473
+ findDefined(from, keys);
6474
+ props.keys = keys.size ? Array.from(keys) : null;
6475
+ return props;
6476
+ }
6477
+ function declareUpdate(props) {
6478
+ const update2 = createUpdate(props);
6479
+ if (is.und(update2.default)) {
6480
+ update2.default = getDefaultProps(update2);
6481
+ }
6482
+ return update2;
6483
+ }
6484
+ function findDefined(values, keys) {
6485
+ eachProp(values, (value, key) => value != null && keys.add(key));
6486
+ }
6487
+ var ACTIVE_EVENTS = [
6488
+ "onStart",
6489
+ "onRest",
6490
+ "onChange",
6491
+ "onPause",
6492
+ "onResume"
6493
+ ];
6494
+ function mergeActiveFn(target, props, type) {
6495
+ target.animation[type] = props[type] !== getDefaultProp(props, type) ? resolveProp(props[type], target.key) : void 0;
6496
+ }
6497
+ function sendEvent(target, type, ...args) {
6498
+ var _a, _b, _c, _d;
6499
+ (_b = (_a = target.animation)[type]) == null ? void 0 : _b.call(_a, ...args);
6500
+ (_d = (_c = target.defaultProps)[type]) == null ? void 0 : _d.call(_c, ...args);
6501
+ }
6502
+ var BATCHED_EVENTS = ["onStart", "onChange", "onRest"];
6503
+ var nextId2 = 1;
6504
+ var Controller = class {
6505
+ constructor(props, flush3) {
6506
+ this.id = nextId2++;
6507
+ this.springs = {};
6508
+ this.queue = [];
6509
+ this._lastAsyncId = 0;
6510
+ this._active = /* @__PURE__ */ new Set();
6511
+ this._changed = /* @__PURE__ */ new Set();
6512
+ this._started = false;
6513
+ this._state = {
6514
+ paused: false,
6515
+ pauseQueue: /* @__PURE__ */ new Set(),
6516
+ resumeQueue: /* @__PURE__ */ new Set(),
6517
+ timeouts: /* @__PURE__ */ new Set()
6518
+ };
6519
+ this._events = {
6520
+ onStart: /* @__PURE__ */ new Map(),
6521
+ onChange: /* @__PURE__ */ new Map(),
6522
+ onRest: /* @__PURE__ */ new Map()
6523
+ };
6524
+ this._onFrame = this._onFrame.bind(this);
6525
+ if (flush3) {
6526
+ this._flush = flush3;
6527
+ }
6528
+ if (props) {
6529
+ this.start({ default: true, ...props });
6530
+ }
6531
+ }
6532
+ /**
6533
+ * Equals `true` when no spring values are in the frameloop, and
6534
+ * no async animation is currently active.
6535
+ */
6536
+ get idle() {
6537
+ return !this._state.asyncTo && Object.values(this.springs).every((spring) => {
6538
+ return spring.idle && !spring.isDelayed && !spring.isPaused;
6539
+ });
6540
+ }
6541
+ get item() {
6542
+ return this._item;
6543
+ }
6544
+ set item(item) {
6545
+ this._item = item;
6546
+ }
6547
+ /** Get the current values of our springs */
6548
+ get() {
6549
+ const values = {};
6550
+ this.each((spring, key) => values[key] = spring.get());
6551
+ return values;
6552
+ }
6553
+ /** Set the current values without animating. */
6554
+ set(values) {
6555
+ for (const key in values) {
6556
+ const value = values[key];
6557
+ if (!is.und(value)) {
6558
+ this.springs[key].set(value);
6559
+ }
6560
+ }
6561
+ }
6562
+ /** Push an update onto the queue of each value. */
6563
+ update(props) {
6564
+ if (props) {
6565
+ this.queue.push(createUpdate(props));
6566
+ }
6567
+ return this;
6568
+ }
6569
+ /**
6570
+ * Start the queued animations for every spring, and resolve the returned
6571
+ * promise once all queued animations have finished or been cancelled.
6572
+ *
6573
+ * When you pass a queue (instead of nothing), that queue is used instead of
6574
+ * the queued animations added with the `update` method, which are left alone.
6575
+ */
6576
+ start(props) {
6577
+ let { queue } = this;
6578
+ if (props) {
6579
+ queue = toArray(props).map(createUpdate);
6580
+ } else {
6581
+ this.queue = [];
6582
+ }
6583
+ if (this._flush) {
6584
+ return this._flush(this, queue);
6585
+ }
6586
+ prepareKeys(this, queue);
6587
+ return flushUpdateQueue(this, queue);
6588
+ }
6589
+ /** @internal */
6590
+ stop(arg, keys) {
6591
+ if (arg !== !!arg) {
6592
+ keys = arg;
6593
+ }
6594
+ if (keys) {
6595
+ const springs = this.springs;
6596
+ each(toArray(keys), (key) => springs[key].stop(!!arg));
6597
+ } else {
6598
+ stopAsync(this._state, this._lastAsyncId);
6599
+ this.each((spring) => spring.stop(!!arg));
6600
+ }
6601
+ return this;
6602
+ }
6603
+ /** Freeze the active animation in time */
6604
+ pause(keys) {
6605
+ if (is.und(keys)) {
6606
+ this.start({ pause: true });
6607
+ } else {
6608
+ const springs = this.springs;
6609
+ each(toArray(keys), (key) => springs[key].pause());
6610
+ }
6611
+ return this;
6612
+ }
6613
+ /** Resume the animation if paused. */
6614
+ resume(keys) {
6615
+ if (is.und(keys)) {
6616
+ this.start({ pause: false });
6617
+ } else {
6618
+ const springs = this.springs;
6619
+ each(toArray(keys), (key) => springs[key].resume());
6620
+ }
6621
+ return this;
6622
+ }
6623
+ /** Call a function once per spring value */
6624
+ each(iterator) {
6625
+ eachProp(this.springs, iterator);
6626
+ }
6627
+ /** @internal Called at the end of every animation frame */
6628
+ _onFrame() {
6629
+ const { onStart, onChange, onRest } = this._events;
6630
+ const active = this._active.size > 0;
6631
+ const changed = this._changed.size > 0;
6632
+ if (active && !this._started || changed && !this._started) {
6633
+ this._started = true;
6634
+ flush(onStart, ([onStart2, result]) => {
6635
+ result.value = this.get();
6636
+ onStart2(result, this, this._item);
6637
+ });
6638
+ }
6639
+ const idle = !active && this._started;
6640
+ const values = changed || idle && onRest.size ? this.get() : null;
6641
+ if (changed && onChange.size) {
6642
+ flush(onChange, ([onChange2, result]) => {
6643
+ result.value = values;
6644
+ onChange2(result, this, this._item);
6645
+ });
6646
+ }
6647
+ if (idle) {
6648
+ this._started = false;
6649
+ flush(onRest, ([onRest2, result]) => {
6650
+ result.value = values;
6651
+ onRest2(result, this, this._item);
6652
+ });
6653
+ }
6654
+ }
6655
+ /** @internal */
6656
+ eventObserved(event) {
6657
+ if (event.type == "change") {
6658
+ this._changed.add(event.parent);
6659
+ if (!event.idle) {
6660
+ this._active.add(event.parent);
6661
+ }
6662
+ } else if (event.type == "idle") {
6663
+ this._active.delete(event.parent);
6664
+ } else
6665
+ return;
6666
+ raf.onFrame(this._onFrame);
6667
+ }
6668
+ };
6669
+ function flushUpdateQueue(ctrl, queue) {
6670
+ return Promise.all(queue.map((props) => flushUpdate(ctrl, props))).then(
6671
+ (results) => getCombinedResult(ctrl, results)
6672
+ );
6673
+ }
6674
+ async function flushUpdate(ctrl, props, isLoop) {
6675
+ const { keys, to: to2, from, loop: loop2, onRest, onResolve } = props;
6676
+ const defaults2 = is.obj(props.default) && props.default;
6677
+ if (loop2) {
6678
+ props.loop = false;
6679
+ }
6680
+ if (to2 === false)
6681
+ props.to = null;
6682
+ if (from === false)
6683
+ props.from = null;
6684
+ const asyncTo = is.arr(to2) || is.fun(to2) ? to2 : void 0;
6685
+ if (asyncTo) {
6686
+ props.to = void 0;
6687
+ props.onRest = void 0;
6688
+ if (defaults2) {
6689
+ defaults2.onRest = void 0;
6690
+ }
6691
+ } else {
6692
+ each(BATCHED_EVENTS, (key) => {
6693
+ const handler = props[key];
6694
+ if (is.fun(handler)) {
6695
+ const queue = ctrl["_events"][key];
6696
+ props[key] = ({ finished, cancelled }) => {
6697
+ const result2 = queue.get(handler);
6698
+ if (result2) {
6699
+ if (!finished)
6700
+ result2.finished = false;
6701
+ if (cancelled)
6702
+ result2.cancelled = true;
6703
+ } else {
6704
+ queue.set(handler, {
6705
+ value: null,
6706
+ finished: finished || false,
6707
+ cancelled: cancelled || false
6708
+ });
6709
+ }
6710
+ };
6711
+ if (defaults2) {
6712
+ defaults2[key] = props[key];
6713
+ }
6714
+ }
6715
+ });
6716
+ }
6717
+ const state = ctrl["_state"];
6718
+ if (props.pause === !state.paused) {
6719
+ state.paused = props.pause;
6720
+ flushCalls(props.pause ? state.pauseQueue : state.resumeQueue);
6721
+ } else if (state.paused) {
6722
+ props.pause = true;
6723
+ }
6724
+ const promises = (keys || Object.keys(ctrl.springs)).map(
6725
+ (key) => ctrl.springs[key].start(props)
6726
+ );
6727
+ const cancel = props.cancel === true || getDefaultProp(props, "cancel") === true;
6728
+ if (asyncTo || cancel && state.asyncId) {
6729
+ promises.push(
6730
+ scheduleProps(++ctrl["_lastAsyncId"], {
6731
+ props,
6732
+ state,
6733
+ actions: {
6734
+ pause: noop,
6735
+ resume: noop,
6736
+ start(props2, resolve) {
6737
+ if (cancel) {
6738
+ stopAsync(state, ctrl["_lastAsyncId"]);
6739
+ resolve(getCancelledResult(ctrl));
6740
+ } else {
6741
+ props2.onRest = onRest;
6742
+ resolve(
6743
+ runAsync(
6744
+ asyncTo,
6745
+ props2,
6746
+ state,
6747
+ ctrl
6748
+ )
6749
+ );
6750
+ }
6751
+ }
6752
+ }
6753
+ })
6754
+ );
6755
+ }
6756
+ if (state.paused) {
6757
+ await new Promise((resume) => {
6758
+ state.resumeQueue.add(resume);
6759
+ });
6760
+ }
6761
+ const result = getCombinedResult(ctrl, await Promise.all(promises));
6762
+ if (loop2 && result.finished && !(isLoop && result.noop)) {
6763
+ const nextProps = createLoopUpdate(props, loop2, to2);
6764
+ if (nextProps) {
6765
+ prepareKeys(ctrl, [nextProps]);
6766
+ return flushUpdate(ctrl, nextProps, true);
6767
+ }
6768
+ }
6769
+ if (onResolve) {
6770
+ raf.batchedUpdates(() => onResolve(result, ctrl, ctrl.item));
6771
+ }
6772
+ return result;
6773
+ }
6774
+ function getSprings(ctrl, props) {
6775
+ const springs = { ...ctrl.springs };
6776
+ if (props) {
6777
+ each(toArray(props), (props2) => {
6778
+ if (is.und(props2.keys)) {
6779
+ props2 = createUpdate(props2);
6780
+ }
6781
+ if (!is.obj(props2.to)) {
6782
+ props2 = { ...props2, to: void 0 };
6783
+ }
6784
+ prepareSprings(springs, props2, (key) => {
6785
+ return createSpring(key);
6786
+ });
6787
+ });
6788
+ }
6789
+ setSprings(ctrl, springs);
6790
+ return springs;
6791
+ }
6792
+ function setSprings(ctrl, springs) {
6793
+ eachProp(springs, (spring, key) => {
6794
+ if (!ctrl.springs[key]) {
6795
+ ctrl.springs[key] = spring;
6796
+ addFluidObserver(spring, ctrl);
6797
+ }
6798
+ });
6799
+ }
6800
+ function createSpring(key, observer) {
6801
+ const spring = new SpringValue();
6802
+ spring.key = key;
6803
+ if (observer) {
6804
+ addFluidObserver(spring, observer);
6805
+ }
6806
+ return spring;
6807
+ }
6808
+ function prepareSprings(springs, props, create) {
6809
+ if (props.keys) {
6810
+ each(props.keys, (key) => {
6811
+ const spring = springs[key] || (springs[key] = create(key));
6812
+ spring["_prepareNode"](props);
6813
+ });
6814
+ }
6815
+ }
6816
+ function prepareKeys(ctrl, queue) {
6817
+ each(queue, (props) => {
6818
+ prepareSprings(ctrl.springs, props, (key) => {
6819
+ return createSpring(key, ctrl);
6820
+ });
6821
+ });
6822
+ }
6823
+ var SpringContext = ({
6824
+ children,
6825
+ ...props
6826
+ }) => {
6827
+ const inherited = React.useContext(ctx);
6828
+ const pause = props.pause || !!inherited.pause, immediate = props.immediate || !!inherited.immediate;
6829
+ props = useMemoOne(() => ({ pause, immediate }), [pause, immediate]);
6830
+ const { Provider } = ctx;
6831
+ return /* @__PURE__ */ React__namespace.createElement(Provider, { value: props }, children);
6832
+ };
6833
+ var ctx = makeContext(SpringContext, {});
6834
+ SpringContext.Provider = ctx.Provider;
6835
+ SpringContext.Consumer = ctx.Consumer;
6836
+ function makeContext(target, init) {
6837
+ Object.assign(target, React__namespace.createContext(init));
6838
+ target.Provider._context = target;
6839
+ target.Consumer._context = target;
6840
+ return target;
6841
+ }
6842
+ var SpringRef = () => {
6843
+ const current = [];
6844
+ const SpringRef2 = function(props) {
6845
+ deprecateDirectCall();
6846
+ const results = [];
6847
+ each(current, (ctrl, i) => {
6848
+ if (is.und(props)) {
6849
+ results.push(ctrl.start());
6850
+ } else {
6851
+ const update2 = _getProps(props, ctrl, i);
6852
+ if (update2) {
6853
+ results.push(ctrl.start(update2));
6854
+ }
6855
+ }
6856
+ });
6857
+ return results;
6858
+ };
6859
+ SpringRef2.current = current;
6860
+ SpringRef2.add = function(ctrl) {
6861
+ if (!current.includes(ctrl)) {
6862
+ current.push(ctrl);
6863
+ }
6864
+ };
6865
+ SpringRef2.delete = function(ctrl) {
6866
+ const i = current.indexOf(ctrl);
6867
+ if (~i)
6868
+ current.splice(i, 1);
6869
+ };
6870
+ SpringRef2.pause = function() {
6871
+ each(current, (ctrl) => ctrl.pause(...arguments));
6872
+ return this;
6873
+ };
6874
+ SpringRef2.resume = function() {
6875
+ each(current, (ctrl) => ctrl.resume(...arguments));
6876
+ return this;
6877
+ };
6878
+ SpringRef2.set = function(values) {
6879
+ each(current, (ctrl, i) => {
6880
+ const update2 = is.fun(values) ? values(i, ctrl) : values;
6881
+ if (update2) {
6882
+ ctrl.set(update2);
6883
+ }
6884
+ });
6885
+ };
6886
+ SpringRef2.start = function(props) {
6887
+ const results = [];
6888
+ each(current, (ctrl, i) => {
6889
+ if (is.und(props)) {
6890
+ results.push(ctrl.start());
6891
+ } else {
6892
+ const update2 = this._getProps(props, ctrl, i);
6893
+ if (update2) {
6894
+ results.push(ctrl.start(update2));
6895
+ }
6896
+ }
6897
+ });
6898
+ return results;
6899
+ };
6900
+ SpringRef2.stop = function() {
6901
+ each(current, (ctrl) => ctrl.stop(...arguments));
6902
+ return this;
6903
+ };
6904
+ SpringRef2.update = function(props) {
6905
+ each(current, (ctrl, i) => ctrl.update(this._getProps(props, ctrl, i)));
6906
+ return this;
6907
+ };
6908
+ const _getProps = function(arg, ctrl, index) {
6909
+ return is.fun(arg) ? arg(index, ctrl) : arg;
6910
+ };
6911
+ SpringRef2._getProps = _getProps;
6912
+ return SpringRef2;
6913
+ };
6914
+ function useSprings(length, props, deps) {
6915
+ const propsFn = is.fun(props) && props;
6916
+ if (propsFn && !deps)
6917
+ deps = [];
6918
+ const ref = React.useMemo(
6919
+ () => propsFn || arguments.length == 3 ? SpringRef() : void 0,
6920
+ []
6921
+ );
6922
+ const layoutId = React.useRef(0);
6923
+ const forceUpdate = useForceUpdate();
6924
+ const state = React.useMemo(
6925
+ () => ({
6926
+ ctrls: [],
6927
+ queue: [],
6928
+ flush(ctrl, updates2) {
6929
+ const springs2 = getSprings(ctrl, updates2);
6930
+ const canFlushSync = layoutId.current > 0 && !state.queue.length && !Object.keys(springs2).some((key) => !ctrl.springs[key]);
6931
+ return canFlushSync ? flushUpdateQueue(ctrl, updates2) : new Promise((resolve) => {
6932
+ setSprings(ctrl, springs2);
6933
+ state.queue.push(() => {
6934
+ resolve(flushUpdateQueue(ctrl, updates2));
6935
+ });
6936
+ forceUpdate();
6937
+ });
6938
+ }
6939
+ }),
6940
+ []
6941
+ );
6942
+ const ctrls = React.useRef([...state.ctrls]);
6943
+ const updates = [];
6944
+ const prevLength = usePrev(length) || 0;
6945
+ React.useMemo(() => {
6946
+ each(ctrls.current.slice(length, prevLength), (ctrl) => {
6947
+ detachRefs(ctrl, ref);
6948
+ ctrl.stop(true);
6949
+ });
6950
+ ctrls.current.length = length;
6951
+ declareUpdates(prevLength, length);
6952
+ }, [length]);
6953
+ React.useMemo(() => {
6954
+ declareUpdates(0, Math.min(prevLength, length));
6955
+ }, deps);
6956
+ function declareUpdates(startIndex, endIndex) {
6957
+ for (let i = startIndex; i < endIndex; i++) {
6958
+ const ctrl = ctrls.current[i] || (ctrls.current[i] = new Controller(null, state.flush));
6959
+ const update2 = propsFn ? propsFn(i, ctrl) : props[i];
6960
+ if (update2) {
6961
+ updates[i] = declareUpdate(update2);
6962
+ }
6963
+ }
6964
+ }
6965
+ const springs = ctrls.current.map((ctrl, i) => getSprings(ctrl, updates[i]));
6966
+ const context2 = React.useContext(SpringContext);
6967
+ const prevContext = usePrev(context2);
6968
+ const hasContext = context2 !== prevContext && hasProps(context2);
6969
+ useIsomorphicLayoutEffect(() => {
6970
+ layoutId.current++;
6971
+ state.ctrls = ctrls.current;
6972
+ const { queue } = state;
6973
+ if (queue.length) {
6974
+ state.queue = [];
6975
+ each(queue, (cb) => cb());
6976
+ }
6977
+ each(ctrls.current, (ctrl, i) => {
6978
+ ref == null ? void 0 : ref.add(ctrl);
6979
+ if (hasContext) {
6980
+ ctrl.start({ default: context2 });
6981
+ }
6982
+ const update2 = updates[i];
6983
+ if (update2) {
6984
+ replaceRef(ctrl, update2.ref);
6985
+ if (ctrl.ref) {
6986
+ ctrl.queue.push(update2);
6987
+ } else {
6988
+ ctrl.start(update2);
6989
+ }
6990
+ }
6991
+ });
6992
+ });
6993
+ useOnce(() => () => {
6994
+ each(state.ctrls, (ctrl) => ctrl.stop(true));
6995
+ });
6996
+ const values = springs.map((x) => ({ ...x }));
6997
+ return ref ? [values, ref] : values;
6998
+ }
6999
+ function useSpring(props, deps) {
7000
+ const isFn = is.fun(props);
7001
+ const [[values], ref] = useSprings(
7002
+ 1,
7003
+ isFn ? props : [props],
7004
+ isFn ? deps || [] : deps
7005
+ );
7006
+ return isFn || arguments.length == 2 ? [values, ref] : values;
7007
+ }
7008
+ var Interpolation = class extends FrameValue {
7009
+ constructor(source, args) {
7010
+ super();
7011
+ this.source = source;
7012
+ this.idle = true;
7013
+ this._active = /* @__PURE__ */ new Set();
7014
+ this.calc = createInterpolator(...args);
7015
+ const value = this._get();
7016
+ const nodeType = getAnimatedType(value);
7017
+ setAnimated(this, nodeType.create(value));
7018
+ }
7019
+ advance(_dt) {
7020
+ const value = this._get();
7021
+ const oldValue = this.get();
7022
+ if (!isEqual(value, oldValue)) {
7023
+ getAnimated(this).setValue(value);
7024
+ this._onChange(value, this.idle);
7025
+ }
7026
+ if (!this.idle && checkIdle(this._active)) {
7027
+ becomeIdle(this);
7028
+ }
7029
+ }
7030
+ _get() {
7031
+ const inputs = is.arr(this.source) ? this.source.map(getFluidValue) : toArray(getFluidValue(this.source));
7032
+ return this.calc(...inputs);
7033
+ }
7034
+ _start() {
7035
+ if (this.idle && !checkIdle(this._active)) {
7036
+ this.idle = false;
7037
+ each(getPayload(this), (node) => {
7038
+ node.done = false;
7039
+ });
7040
+ if (globals_exports.skipAnimation) {
7041
+ raf.batchedUpdates(() => this.advance());
7042
+ becomeIdle(this);
7043
+ } else {
7044
+ frameLoop.start(this);
7045
+ }
7046
+ }
7047
+ }
7048
+ // Observe our sources only when we're observed.
7049
+ _attach() {
7050
+ let priority2 = 1;
7051
+ each(toArray(this.source), (source) => {
7052
+ if (hasFluidValue(source)) {
7053
+ addFluidObserver(source, this);
7054
+ }
7055
+ if (isFrameValue(source)) {
7056
+ if (!source.idle) {
7057
+ this._active.add(source);
7058
+ }
7059
+ priority2 = Math.max(priority2, source.priority + 1);
7060
+ }
7061
+ });
7062
+ this.priority = priority2;
7063
+ this._start();
7064
+ }
7065
+ // Stop observing our sources once we have no observers.
7066
+ _detach() {
7067
+ each(toArray(this.source), (source) => {
7068
+ if (hasFluidValue(source)) {
7069
+ removeFluidObserver(source, this);
7070
+ }
7071
+ });
7072
+ this._active.clear();
7073
+ becomeIdle(this);
7074
+ }
7075
+ /** @internal */
7076
+ eventObserved(event) {
7077
+ if (event.type == "change") {
7078
+ if (event.idle) {
7079
+ this.advance();
7080
+ } else {
7081
+ this._active.add(event.parent);
7082
+ this._start();
7083
+ }
7084
+ } else if (event.type == "idle") {
7085
+ this._active.delete(event.parent);
7086
+ } else if (event.type == "priority") {
7087
+ this.priority = toArray(this.source).reduce(
7088
+ (highest, parent) => Math.max(highest, (isFrameValue(parent) ? parent.priority : 0) + 1),
7089
+ 0
7090
+ );
7091
+ }
7092
+ }
7093
+ };
7094
+ function isIdle(source) {
7095
+ return source.idle !== false;
7096
+ }
7097
+ function checkIdle(active) {
7098
+ return !active.size || Array.from(active).every(isIdle);
7099
+ }
7100
+ function becomeIdle(self) {
7101
+ if (!self.idle) {
7102
+ self.idle = true;
7103
+ each(getPayload(self), (node) => {
7104
+ node.done = true;
7105
+ });
7106
+ callFluidObservers(self, {
7107
+ type: "idle",
7108
+ parent: self
7109
+ });
7110
+ }
7111
+ }
7112
+ globals_exports.assign({
7113
+ createStringInterpolator: createStringInterpolator2,
7114
+ to: (source, args) => new Interpolation(source, args)
7115
+ });
7116
+ var isCustomPropRE = /^--/;
7117
+ function dangerousStyleValue(name, value) {
7118
+ if (value == null || typeof value === "boolean" || value === "")
7119
+ return "";
7120
+ if (typeof value === "number" && value !== 0 && !isCustomPropRE.test(name) && !(isUnitlessNumber.hasOwnProperty(name) && isUnitlessNumber[name]))
7121
+ return value + "px";
7122
+ return ("" + value).trim();
7123
+ }
7124
+ var attributeCache = {};
7125
+ function applyAnimatedValues(instance, props) {
7126
+ if (!instance.nodeType || !instance.setAttribute) {
7127
+ return false;
7128
+ }
7129
+ const isFilterElement = instance.nodeName === "filter" || instance.parentNode && instance.parentNode.nodeName === "filter";
7130
+ const {
7131
+ className,
7132
+ style,
7133
+ children,
7134
+ scrollTop,
7135
+ scrollLeft,
7136
+ viewBox,
7137
+ ...attributes
7138
+ } = props;
7139
+ const values = Object.values(attributes);
7140
+ const names = Object.keys(attributes).map(
7141
+ (name) => isFilterElement || instance.hasAttribute(name) ? name : attributeCache[name] || (attributeCache[name] = name.replace(
7142
+ /([A-Z])/g,
7143
+ // Attributes are written in dash case
7144
+ (n) => "-" + n.toLowerCase()
7145
+ ))
7146
+ );
7147
+ if (children !== void 0) {
7148
+ instance.textContent = children;
7149
+ }
7150
+ for (const name in style) {
7151
+ if (style.hasOwnProperty(name)) {
7152
+ const value = dangerousStyleValue(name, style[name]);
7153
+ if (isCustomPropRE.test(name)) {
7154
+ instance.style.setProperty(name, value);
7155
+ } else {
7156
+ instance.style[name] = value;
7157
+ }
7158
+ }
7159
+ }
7160
+ names.forEach((name, i) => {
7161
+ instance.setAttribute(name, values[i]);
7162
+ });
7163
+ if (className !== void 0) {
7164
+ instance.className = className;
7165
+ }
7166
+ if (scrollTop !== void 0) {
7167
+ instance.scrollTop = scrollTop;
7168
+ }
7169
+ if (scrollLeft !== void 0) {
7170
+ instance.scrollLeft = scrollLeft;
7171
+ }
7172
+ if (viewBox !== void 0) {
7173
+ instance.setAttribute("viewBox", viewBox);
7174
+ }
7175
+ }
7176
+ var isUnitlessNumber = {
7177
+ animationIterationCount: true,
7178
+ borderImageOutset: true,
7179
+ borderImageSlice: true,
7180
+ borderImageWidth: true,
7181
+ boxFlex: true,
7182
+ boxFlexGroup: true,
7183
+ boxOrdinalGroup: true,
7184
+ columnCount: true,
7185
+ columns: true,
7186
+ flex: true,
7187
+ flexGrow: true,
7188
+ flexPositive: true,
7189
+ flexShrink: true,
7190
+ flexNegative: true,
7191
+ flexOrder: true,
7192
+ gridRow: true,
7193
+ gridRowEnd: true,
7194
+ gridRowSpan: true,
7195
+ gridRowStart: true,
7196
+ gridColumn: true,
7197
+ gridColumnEnd: true,
7198
+ gridColumnSpan: true,
7199
+ gridColumnStart: true,
7200
+ fontWeight: true,
7201
+ lineClamp: true,
7202
+ lineHeight: true,
7203
+ opacity: true,
7204
+ order: true,
7205
+ orphans: true,
7206
+ tabSize: true,
7207
+ widows: true,
7208
+ zIndex: true,
7209
+ zoom: true,
7210
+ // SVG-related properties
7211
+ fillOpacity: true,
7212
+ floodOpacity: true,
7213
+ stopOpacity: true,
7214
+ strokeDasharray: true,
7215
+ strokeDashoffset: true,
7216
+ strokeMiterlimit: true,
7217
+ strokeOpacity: true,
7218
+ strokeWidth: true
7219
+ };
7220
+ var prefixKey = (prefix2, key) => prefix2 + key.charAt(0).toUpperCase() + key.substring(1);
7221
+ var prefixes = ["Webkit", "Ms", "Moz", "O"];
7222
+ isUnitlessNumber = Object.keys(isUnitlessNumber).reduce((acc, prop) => {
7223
+ prefixes.forEach((prefix2) => acc[prefixKey(prefix2, prop)] = acc[prop]);
7224
+ return acc;
7225
+ }, isUnitlessNumber);
7226
+ var domTransforms = /^(matrix|translate|scale|rotate|skew)/;
7227
+ var pxTransforms = /^(translate)/;
7228
+ var degTransforms = /^(rotate|skew)/;
7229
+ var addUnit = (value, unit) => is.num(value) && value !== 0 ? value + unit : value;
7230
+ var isValueIdentity = (value, id) => is.arr(value) ? value.every((v2) => isValueIdentity(v2, id)) : is.num(value) ? value === id : parseFloat(value) === id;
7231
+ var AnimatedStyle = class extends AnimatedObject {
7232
+ constructor({ x, y, z, ...style }) {
7233
+ const inputs = [];
7234
+ const transforms = [];
7235
+ if (x || y || z) {
7236
+ inputs.push([x || 0, y || 0, z || 0]);
7237
+ transforms.push((xyz) => [
7238
+ `translate3d(${xyz.map((v2) => addUnit(v2, "px")).join(",")})`,
7239
+ // prettier-ignore
7240
+ isValueIdentity(xyz, 0)
7241
+ ]);
7242
+ }
7243
+ eachProp(style, (value, key) => {
7244
+ if (key === "transform") {
7245
+ inputs.push([value || ""]);
7246
+ transforms.push((transform) => [transform, transform === ""]);
7247
+ } else if (domTransforms.test(key)) {
7248
+ delete style[key];
7249
+ if (is.und(value))
7250
+ return;
7251
+ const unit = pxTransforms.test(key) ? "px" : degTransforms.test(key) ? "deg" : "";
7252
+ inputs.push(toArray(value));
7253
+ transforms.push(
7254
+ key === "rotate3d" ? ([x2, y2, z2, deg]) => [
7255
+ `rotate3d(${x2},${y2},${z2},${addUnit(deg, unit)})`,
7256
+ isValueIdentity(deg, 0)
7257
+ ] : (input) => [
7258
+ `${key}(${input.map((v2) => addUnit(v2, unit)).join(",")})`,
7259
+ isValueIdentity(input, key.startsWith("scale") ? 1 : 0)
7260
+ ]
7261
+ );
7262
+ }
7263
+ });
7264
+ if (inputs.length) {
7265
+ style.transform = new FluidTransform(inputs, transforms);
7266
+ }
7267
+ super(style);
7268
+ }
7269
+ };
7270
+ var FluidTransform = class extends FluidValue {
7271
+ constructor(inputs, transforms) {
7272
+ super();
7273
+ this.inputs = inputs;
7274
+ this.transforms = transforms;
7275
+ this._value = null;
7276
+ }
7277
+ get() {
7278
+ return this._value || (this._value = this._get());
7279
+ }
7280
+ _get() {
7281
+ let transform = "";
7282
+ let identity2 = true;
7283
+ each(this.inputs, (input, i) => {
7284
+ const arg1 = getFluidValue(input[0]);
7285
+ const [t, id] = this.transforms[i](
7286
+ is.arr(arg1) ? arg1 : input.map(getFluidValue)
7287
+ );
7288
+ transform += " " + t;
7289
+ identity2 = identity2 && id;
7290
+ });
7291
+ return identity2 ? "none" : transform;
7292
+ }
7293
+ // Start observing our inputs once we have an observer.
7294
+ observerAdded(count) {
7295
+ if (count == 1)
7296
+ each(
7297
+ this.inputs,
7298
+ (input) => each(
7299
+ input,
7300
+ (value) => hasFluidValue(value) && addFluidObserver(value, this)
7301
+ )
7302
+ );
7303
+ }
7304
+ // Stop observing our inputs once we have no observers.
7305
+ observerRemoved(count) {
7306
+ if (count == 0)
7307
+ each(
7308
+ this.inputs,
7309
+ (input) => each(
7310
+ input,
7311
+ (value) => hasFluidValue(value) && removeFluidObserver(value, this)
7312
+ )
7313
+ );
7314
+ }
7315
+ eventObserved(event) {
7316
+ if (event.type == "change") {
7317
+ this._value = null;
7318
+ }
7319
+ callFluidObservers(this, event);
7320
+ }
7321
+ };
7322
+ var primitives = [
7323
+ "a",
7324
+ "abbr",
7325
+ "address",
7326
+ "area",
7327
+ "article",
7328
+ "aside",
7329
+ "audio",
7330
+ "b",
7331
+ "base",
7332
+ "bdi",
7333
+ "bdo",
7334
+ "big",
7335
+ "blockquote",
7336
+ "body",
7337
+ "br",
7338
+ "button",
7339
+ "canvas",
7340
+ "caption",
7341
+ "cite",
7342
+ "code",
7343
+ "col",
7344
+ "colgroup",
7345
+ "data",
7346
+ "datalist",
7347
+ "dd",
7348
+ "del",
7349
+ "details",
7350
+ "dfn",
7351
+ "dialog",
7352
+ "div",
7353
+ "dl",
7354
+ "dt",
7355
+ "em",
7356
+ "embed",
7357
+ "fieldset",
7358
+ "figcaption",
7359
+ "figure",
7360
+ "footer",
7361
+ "form",
7362
+ "h1",
7363
+ "h2",
7364
+ "h3",
7365
+ "h4",
7366
+ "h5",
7367
+ "h6",
7368
+ "head",
7369
+ "header",
7370
+ "hgroup",
7371
+ "hr",
7372
+ "html",
7373
+ "i",
7374
+ "iframe",
7375
+ "img",
7376
+ "input",
7377
+ "ins",
7378
+ "kbd",
7379
+ "keygen",
7380
+ "label",
7381
+ "legend",
7382
+ "li",
7383
+ "link",
7384
+ "main",
7385
+ "map",
7386
+ "mark",
7387
+ "menu",
7388
+ "menuitem",
7389
+ "meta",
7390
+ "meter",
7391
+ "nav",
7392
+ "noscript",
7393
+ "object",
7394
+ "ol",
7395
+ "optgroup",
7396
+ "option",
7397
+ "output",
7398
+ "p",
7399
+ "param",
7400
+ "picture",
7401
+ "pre",
7402
+ "progress",
7403
+ "q",
7404
+ "rp",
7405
+ "rt",
7406
+ "ruby",
7407
+ "s",
7408
+ "samp",
7409
+ "script",
7410
+ "section",
7411
+ "select",
7412
+ "small",
7413
+ "source",
7414
+ "span",
7415
+ "strong",
7416
+ "style",
7417
+ "sub",
7418
+ "summary",
7419
+ "sup",
7420
+ "table",
7421
+ "tbody",
7422
+ "td",
7423
+ "textarea",
7424
+ "tfoot",
7425
+ "th",
7426
+ "thead",
7427
+ "time",
7428
+ "title",
7429
+ "tr",
7430
+ "track",
7431
+ "u",
7432
+ "ul",
7433
+ "var",
7434
+ "video",
7435
+ "wbr",
7436
+ // SVG
7437
+ "circle",
7438
+ "clipPath",
7439
+ "defs",
7440
+ "ellipse",
7441
+ "foreignObject",
7442
+ "g",
7443
+ "image",
7444
+ "line",
7445
+ "linearGradient",
7446
+ "mask",
7447
+ "path",
7448
+ "pattern",
7449
+ "polygon",
7450
+ "polyline",
7451
+ "radialGradient",
7452
+ "rect",
7453
+ "stop",
7454
+ "svg",
7455
+ "text",
7456
+ "tspan"
7457
+ ];
7458
+ globals_exports.assign({
7459
+ batchedUpdates: reactDom.unstable_batchedUpdates,
7460
+ createStringInterpolator: createStringInterpolator2,
7461
+ colors: colors2
7462
+ });
7463
+ var host = createHost(primitives, {
7464
+ applyAnimatedValues,
7465
+ createAnimatedStyle: (style) => new AnimatedStyle(style),
7466
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
7467
+ getComponentProps: ({ scrollTop, scrollLeft, ...props }) => props
7468
+ });
7469
+ var animated = host.animated;
7470
+ const SNAP_TO_MAX_THRESHOLD = 5;
7471
+ const SNAP_TO_MIN_THRESHOLD = 100;
7472
+ const BOTTOM_SHEET_HANDLE_HEIGHT = 45;
7473
+ const INTERACTIVE_ELEMENTS = 'input, button, a, textarea, select, label, [role="button"], [onClick]';
7474
+ const SPRING_CONFIG = {
7475
+ up: {
7476
+ tension: 80,
7477
+ // 튕기기
7478
+ friction: 10,
7479
+ // 묵직함
7480
+ mass: 0.1,
7481
+ velocity: 0
7482
+ },
7483
+ down: {
7484
+ tension: 70,
7485
+ friction: 10,
7486
+ mass: 0.1,
7487
+ velocity: 0
7488
+ },
7489
+ moving: {
7490
+ tension: 600,
7491
+ friction: 30,
7492
+ mass: 0.1,
7493
+ velocity: 0.1
7494
+ }
7495
+ };
7496
+ const useBottomSheet = (props) => {
7497
+ const { isOpen, onOpen, onClose, snapPercent, expendOnContentDrag } = props;
7498
+ const bottomSheetRef = React.useRef(null);
7499
+ const contentRef = React.useRef(null);
7500
+ const metrics = React.useRef({
7501
+ initTouchPosition: null,
7502
+ initTransformValue: 0,
7503
+ canDragRef: true,
7504
+ maxTransformValue: 0,
7505
+ initialOpenHeightPx: 0
7506
+ });
7507
+ const [springs, api] = useSpring(() => ({
7508
+ transform: "translateY(0px)",
7509
+ config: SPRING_CONFIG.down
7510
+ }));
7511
+ const snapToMax = () => {
7512
+ const { maxTransformValue } = metrics.current;
7513
+ api.start({
7514
+ transform: `translateY(${maxTransformValue}px)`,
7515
+ config: SPRING_CONFIG.up
7516
+ });
7517
+ if (onOpen) onOpen();
7518
+ };
7519
+ const snapToMin = () => {
7520
+ api.start({
7521
+ transform: "translateY(0px)",
7522
+ config: SPRING_CONFIG.down
7523
+ });
7524
+ if (onClose) onClose();
7525
+ };
7526
+ const handleContentTouch = (e) => {
7527
+ const target = e.target;
7528
+ if (!target.matches(INTERACTIVE_ELEMENTS) && expendOnContentDrag) {
7529
+ metrics.current.canDragRef = true;
7530
+ } else {
7531
+ metrics.current.canDragRef = false;
7532
+ }
7533
+ };
7534
+ const handleStart = (clientY, e) => {
7535
+ if (!bottomSheetRef.current) {
7536
+ return;
7537
+ }
7538
+ const contentElement = contentRef.current;
7539
+ const target = e.target;
7540
+ if ((contentElement == null ? void 0 : contentElement.scrollTop) !== 0 && target.matches(INTERACTIVE_ELEMENTS)) {
7541
+ return;
7542
+ }
7543
+ const currentTransform = springs.transform.get();
7544
+ const initTransformValue = Number(
7545
+ currentTransform.replace("translateY(", "").replace("px)", "") || 0
7546
+ );
7547
+ metrics.current.initTransformValue = initTransformValue;
7548
+ metrics.current.initTouchPosition = clientY;
7549
+ };
7550
+ const handleMove = (clientY, e) => {
7551
+ var _a;
7552
+ const { initTouchPosition, initTransformValue, canDragRef, initialOpenHeightPx } = metrics.current;
7553
+ if (!initTouchPosition || !bottomSheetRef.current) return;
7554
+ const currTouchPosition = clientY;
7555
+ const yDiff = (initTouchPosition - currTouchPosition) * -1 + initTransformValue;
7556
+ const isMovingDown = initTransformValue < yDiff;
7557
+ if (!canDragRef && !(isMovingDown && ((_a = contentRef.current) == null ? void 0 : _a.scrollTop) === 0)) return;
7558
+ e.preventDefault();
7559
+ const currTopYOffset = yDiff * -1 + initialOpenHeightPx;
7560
+ const translateYOffset = window.innerHeight < currTopYOffset ? window.innerHeight * -1 + initialOpenHeightPx : yDiff;
7561
+ api.start({
7562
+ transform: `translateY(${translateYOffset}px)`,
7563
+ config: SPRING_CONFIG.moving
7564
+ });
7565
+ };
7566
+ const handleEnd = () => {
7567
+ const { initTouchPosition, initTransformValue } = metrics.current;
7568
+ if (!initTouchPosition || !bottomSheetRef.current) {
7569
+ return;
7570
+ }
7571
+ const currentTransform = springs.transform.get();
7572
+ const finalTransformValue = Number(
7573
+ currentTransform.replace("translateY(", "").replace("px)", "") || 0
7574
+ );
7575
+ const transformedDistance = initTransformValue - finalTransformValue;
7576
+ if (transformedDistance < 0 && SNAP_TO_MIN_THRESHOLD < Math.abs(transformedDistance)) {
7577
+ snapToMin();
7578
+ } else if (transformedDistance > 0 && SNAP_TO_MAX_THRESHOLD < Math.abs(transformedDistance)) {
7579
+ snapToMax();
7580
+ } else {
7581
+ const isMovingUp = finalTransformValue > initTransformValue;
7582
+ api.start({
7583
+ transform: `translateY(${initTransformValue}px)`,
7584
+ config: isMovingUp ? SPRING_CONFIG.up : SPRING_CONFIG.down
7585
+ });
7586
+ }
7587
+ metrics.current.canDragRef = true;
7588
+ metrics.current.initTouchPosition = null;
7589
+ };
7590
+ const handleTouch = {
7591
+ start: (e) => handleStart(e.touches[0].clientY, e),
7592
+ move: (e) => handleMove(e.touches[0].clientY, e),
7593
+ end: handleEnd
7594
+ };
7595
+ const handleMouse = {
7596
+ down: (e) => handleStart(e.clientY, e),
7597
+ move: (e) => handleMove(e.clientY, e),
7598
+ up: handleEnd,
7599
+ leave: handleEnd
7600
+ };
7601
+ React.useEffect(() => {
7602
+ if (isOpen) snapToMax();
7603
+ else snapToMin();
7604
+ const handleTouchMove = (e) => {
7605
+ if (bottomSheetRef.current && !bottomSheetRef.current.contains(e.target)) {
7606
+ e.preventDefault();
7607
+ }
7608
+ };
7609
+ if (isOpen) {
7610
+ document.addEventListener("touchmove", handleTouchMove, { passive: false });
7611
+ } else {
7612
+ document.removeEventListener("touchmove", handleTouchMove);
7613
+ }
7614
+ return () => {
7615
+ document.removeEventListener("touchmove", handleTouchMove);
7616
+ };
7617
+ }, [isOpen]);
7618
+ React.useEffect(() => {
7619
+ const bottomSheetElement = bottomSheetRef.current;
7620
+ const contentElement = contentRef.current;
7621
+ metrics.current.initialOpenHeightPx = window.innerHeight * (snapPercent.min > 1 ? 1 : snapPercent.min);
7622
+ if (snapPercent.max === "INNER_HEIGHT" && contentElement) {
7623
+ metrics.current.maxTransformValue = (contentElement.clientHeight - BOTTOM_SHEET_HANDLE_HEIGHT) * -1;
7624
+ } else if (typeof snapPercent.max === "number") {
7625
+ metrics.current.maxTransformValue = (window.innerHeight - metrics.current.initialOpenHeightPx) * (snapPercent.max > 1 ? 1 : snapPercent.max) * -1;
7626
+ }
7627
+ bottomSheetElement == null ? void 0 : bottomSheetElement.addEventListener("touchstart", handleTouch.start);
7628
+ bottomSheetElement == null ? void 0 : bottomSheetElement.addEventListener("touchmove", handleTouch.move);
7629
+ bottomSheetElement == null ? void 0 : bottomSheetElement.addEventListener("touchend", handleTouch.end);
7630
+ bottomSheetElement == null ? void 0 : bottomSheetElement.addEventListener("mousedown", handleMouse.down);
7631
+ bottomSheetElement == null ? void 0 : bottomSheetElement.addEventListener("mousemove", handleMouse.move);
7632
+ bottomSheetElement == null ? void 0 : bottomSheetElement.addEventListener("mouseup", handleMouse.up);
7633
+ bottomSheetElement == null ? void 0 : bottomSheetElement.addEventListener("mouseleave", handleMouse.leave);
7634
+ contentElement == null ? void 0 : contentElement.addEventListener("touchstart", handleContentTouch);
7635
+ contentElement == null ? void 0 : contentElement.addEventListener("mousedown", handleContentTouch);
7636
+ return () => {
7637
+ bottomSheetElement == null ? void 0 : bottomSheetElement.removeEventListener("touchstart", handleTouch.start);
7638
+ bottomSheetElement == null ? void 0 : bottomSheetElement.removeEventListener("touchmove", handleTouch.move);
7639
+ bottomSheetElement == null ? void 0 : bottomSheetElement.removeEventListener("touchend", handleTouch.end);
7640
+ bottomSheetElement == null ? void 0 : bottomSheetElement.removeEventListener("mousedown", handleMouse.down);
7641
+ bottomSheetElement == null ? void 0 : bottomSheetElement.removeEventListener("mousemove", handleMouse.move);
7642
+ bottomSheetElement == null ? void 0 : bottomSheetElement.removeEventListener("mouseup", handleMouse.up);
7643
+ bottomSheetElement == null ? void 0 : bottomSheetElement.removeEventListener("mouseleave", handleMouse.leave);
7644
+ contentElement == null ? void 0 : contentElement.removeEventListener("touchstart", handleContentTouch);
7645
+ contentElement == null ? void 0 : contentElement.removeEventListener("mousedown", handleContentTouch);
7646
+ };
7647
+ }, []);
7648
+ return { bottomSheetRef, contentRef, snapToMax, snapToMin, springs };
7649
+ };
7650
+ const DEFAULT_MIN_SNAP = 0;
7651
+ const DEFAULT_MAX_SNAP = "INNER_HEIGHT";
7652
+ const DEFAULT_BACKDROP_OPACITY = 0.5;
7653
+ const BottomSheetFrame = React.forwardRef(
7654
+ ({ children, className, initialOpenHeightPx, springs }, ref) => {
7655
+ return /* @__PURE__ */ jsxRuntime.jsx(
7656
+ animated.section,
7657
+ {
7658
+ ref,
7659
+ className: cx(css$1({
7660
+ position: "fixed",
7661
+ touchAction: "pan-y",
7662
+ display: "flex",
7663
+ flexDirection: "column",
7664
+ width: "100%",
7665
+ pointerEvents: "auto",
7666
+ // 제스처 이벤트 허용
7667
+ overflow: "hidden",
7668
+ borderRadius: "40px 40px 0 0",
7669
+ height: "100%",
7670
+ zIndex: 999,
7671
+ backgroundColor: "#ffffff",
7672
+ shadow: "0 -15px 15px 0px rgba(0, 0, 0, 0.05)",
7673
+ willChange: "auto"
7674
+ }), className),
7675
+ style: {
7676
+ bottom: `calc(${initialOpenHeightPx}px - 100dvh)`,
7677
+ transform: springs.transform
7678
+ },
7679
+ children
7680
+ }
7681
+ );
7682
+ }
7683
+ );
7684
+ const Backdrop = React.forwardRef(({ onBackdropClick, isBackdropOpen, opacity: bgOpacity }, ref) => {
7685
+ const [springs] = useSpring(() => ({
7686
+ from: { opacity: 0 },
7687
+ to: { opacity: isBackdropOpen ? 1 : 0 },
7688
+ config: {
7689
+ tension: 200,
7690
+ friction: 25,
7691
+ mass: 0.8
7692
+ }
7693
+ }), [isBackdropOpen]);
7694
+ return /* @__PURE__ */ jsxRuntime.jsx(
7695
+ animated.div,
7696
+ {
7697
+ className: css$1({
7698
+ zIndex: 99,
7699
+ position: "fixed",
7700
+ top: 0,
7701
+ width: "100%",
7702
+ height: "100dvh",
7703
+ willChange: "opacity",
7704
+ overflow: "hidden",
7705
+ touchAction: "none"
7706
+ }),
7707
+ style: {
7708
+ backgroundColor: springs.opacity.to((o) => `rgba(0, 0, 0, ${o * bgOpacity})`),
7709
+ opacity: springs.opacity,
7710
+ visibility: isBackdropOpen ? "visible" : "hidden"
7711
+ },
7712
+ onClick: () => onBackdropClick(),
7713
+ ref
7714
+ }
7715
+ );
7716
+ });
7717
+ const BottomSheetHandle = () => /* @__PURE__ */ jsxRuntime.jsx("div", { className: css$1({ margin: "22px auto", height: 1.5, minHeight: 1.5, width: "45px", borderRadius: 999, background: "#bebebe" }) });
7718
+ const BottomSheet = (props) => {
7719
+ const { isOpen = true, onClose, onOpen, children, className = "", snapPercent, bgBlocking = true, backdropOpacity = DEFAULT_BACKDROP_OPACITY, hideHandle = false, expendOnContentDrag = false } = props;
7720
+ const { bottomSheetRef, contentRef, snapToMin, springs } = useBottomSheet({
7721
+ isOpen,
7722
+ onOpen,
7723
+ onClose,
7724
+ snapPercent: {
7725
+ min: (snapPercent == null ? void 0 : snapPercent.min) ?? DEFAULT_MIN_SNAP,
7726
+ max: (snapPercent == null ? void 0 : snapPercent.max) ?? DEFAULT_MAX_SNAP
7727
+ },
7728
+ expendOnContentDrag
7729
+ });
7730
+ const [initialOpenHeightPx, setInitialOpenHeightPx] = React.useState(DEFAULT_MIN_SNAP);
7731
+ React.useEffect(() => {
7732
+ if (snapPercent == null ? void 0 : snapPercent.min) setInitialOpenHeightPx(window.innerHeight * (snapPercent == null ? void 0 : snapPercent.min));
7733
+ }, [snapPercent == null ? void 0 : snapPercent.min]);
7734
+ return /* @__PURE__ */ jsxRuntime.jsxs(animated.div, { children: [
7735
+ bgBlocking && /* @__PURE__ */ jsxRuntime.jsx(Backdrop, { isBackdropOpen: isOpen, opacity: backdropOpacity, onBackdropClick: () => snapToMin() }),
7736
+ /* @__PURE__ */ jsxRuntime.jsxs(
7737
+ BottomSheetFrame,
7738
+ {
7739
+ ref: bottomSheetRef,
7740
+ className,
7741
+ springs,
7742
+ initialOpenHeightPx,
7743
+ children: [
7744
+ !hideHandle && /* @__PURE__ */ jsxRuntime.jsx(BottomSheetHandle, {}),
7745
+ /* @__PURE__ */ jsxRuntime.jsx("section", { ref: contentRef, className: css$1({ overflowY: "auto" }), children })
7746
+ ]
7747
+ }
7748
+ )
7749
+ ] });
7750
+ };
7751
+ BottomSheetFrame.displayName = "BottomSheetFrame";
7752
+ Backdrop.displayName = "Backdrop";
4049
7753
  function definePreset(preset2) {
4050
7754
  return preset2;
4051
7755
  }
@@ -4346,6 +8050,7 @@ const preset = definePreset({
4346
8050
  }
4347
8051
  }
4348
8052
  });
8053
+ exports.BottomSheet = BottomSheet;
4349
8054
  exports.Button = Button;
4350
8055
  exports.Dialog = Dialog;
4351
8056
  exports.IconButton = IconButton;