@overmap-ai/forms 1.0.32-react-flow-david-fixes.38 → 1.0.32-react-flow-david-fixes.40

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.
@@ -1,28 +1,10 @@
1
1
  (function(global2, factory) {
2
- typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("react/jsx-runtime"), require("@overmap-ai/blocks"), require("class-variance-authority"), require("react"), require("@xyflow/react/dist/style.css"), require("@xyflow/react"), require("formik"), require("graphology"), require("graphology-dag"), require("uuid"), require("@hello-pangea/dnd"), require("lucide-react"), require("react-dom"), require("file-saver"), require("react-zxing"), require("lodash.get"), require("@dagrejs/dagre"), require("lodash.set")) : typeof define === "function" && define.amd ? define(["exports", "react/jsx-runtime", "@overmap-ai/blocks", "class-variance-authority", "react", "@xyflow/react/dist/style.css", "@xyflow/react", "formik", "graphology", "graphology-dag", "uuid", "@hello-pangea/dnd", "lucide-react", "react-dom", "file-saver", "react-zxing", "lodash.get", "@dagrejs/dagre", "lodash.set"], factory) : (global2 = typeof globalThis !== "undefined" ? globalThis : global2 || self, factory(global2.forms = {}, global2.jsxRuntime, global2.blocks, global2.classVarianceAuthority, global2.React, null, global2.react, global2.formik, global2.graphology, global2.graphologyDag, global2.uuid, global2.dnd, global2.lucideReact, global2.ReactDOM, global2.fileSaver, global2.reactZxing, global2.get, global2.Dagre, global2.set));
3
- })(this, function(exports2, jsxRuntime, blocks, classVarianceAuthority, React, style_css, react, formik, graphology, graphologyDag, uuid, dnd, lucideReact, ReactDOM, fileSaver, reactZxing, get, Dagre, set) {
2
+ typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("react/jsx-runtime"), require("@overmap-ai/blocks"), require("class-variance-authority"), require("react"), require("@xyflow/react/dist/style.css"), require("@xyflow/react"), require("formik"), require("graphology"), require("graphology-dag"), require("uuid"), require("@hello-pangea/dnd"), require("file-saver"), require("react-zxing"), require("lodash.get"), require("@dagrejs/dagre"), require("lodash.set")) : typeof define === "function" && define.amd ? define(["exports", "react/jsx-runtime", "@overmap-ai/blocks", "class-variance-authority", "react", "@xyflow/react/dist/style.css", "@xyflow/react", "formik", "graphology", "graphology-dag", "uuid", "@hello-pangea/dnd", "file-saver", "react-zxing", "lodash.get", "@dagrejs/dagre", "lodash.set"], factory) : (global2 = typeof globalThis !== "undefined" ? globalThis : global2 || self, factory(global2.forms = {}, global2.jsxRuntime, global2.blocks, global2.classVarianceAuthority, global2.React, null, global2.react, global2.formik, global2.graphology, global2.graphologyDag, global2.uuid, global2.dnd, global2.fileSaver, global2.reactZxing, global2.get, global2.Dagre, global2.set));
3
+ })(this, function(exports2, jsxRuntime, blocks, classVarianceAuthority, React, style_css, react, formik, graphology, graphologyDag, uuid, dnd, fileSaver, reactZxing, get, Dagre, set) {
4
4
  "use strict";var __defProp = Object.defineProperty;
5
5
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6
6
  var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
7
7
 
8
- function _interopNamespaceDefault(e) {
9
- const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
10
- if (e) {
11
- for (const k in e) {
12
- if (k !== "default") {
13
- const d = Object.getOwnPropertyDescriptor(e, k);
14
- Object.defineProperty(n, k, d.get ? d : {
15
- enumerable: true,
16
- get: () => e[k]
17
- });
18
- }
19
- }
20
- }
21
- n.default = e;
22
- return Object.freeze(n);
23
- }
24
- const React__namespace = /* @__PURE__ */ _interopNamespaceDefault(React);
25
- const ReactDOM__namespace = /* @__PURE__ */ _interopNamespaceDefault(ReactDOM);
26
8
  const FileCard = React.memo(
27
9
  React.forwardRef((props, ref) => {
28
10
  const { file, className, error, rightSlot, ...rest } = props;
@@ -61,8 +43,8 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
61
43
  }
62
44
  }
63
45
  class BaseFormElement extends Observable {
64
- constructor(options2) {
65
- const { identifier } = options2;
46
+ constructor(options) {
47
+ const { identifier } = options;
66
48
  super();
67
49
  __publicField(this, "identifier");
68
50
  this.identifier = identifier;
@@ -72,8 +54,8 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
72
54
  identifier: this.identifier
73
55
  };
74
56
  }
75
- setOptions(options2) {
76
- this.identifier = options2.identifier ?? this.identifier;
57
+ setOptions(options) {
58
+ this.identifier = options.identifier ?? this.identifier;
77
59
  this.notify(this);
78
60
  }
79
61
  serialize() {
@@ -84,8 +66,8 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
84
66
  }
85
67
  }
86
68
  class BaseField extends BaseFormElement {
87
- constructor(options2) {
88
- const { label, description = null, required, image, fieldValidators = [], ...base } = options2;
69
+ constructor(options) {
70
+ const { label, description = null, required, image, fieldValidators = [], ...base } = options;
89
71
  super(base);
90
72
  __publicField(this, "label");
91
73
  __publicField(this, "description");
@@ -133,8 +115,8 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
133
115
  fieldValidators: this.fieldValidators
134
116
  };
135
117
  }
136
- setOptions(options2) {
137
- const { label, description = null, required, image, fieldValidators, ...base } = options2;
118
+ setOptions(options) {
119
+ const { label, description = null, required, image, fieldValidators, ...base } = options;
138
120
  this.label = label ?? this.label;
139
121
  this.description = description ?? this.description;
140
122
  this.required = required ?? this.required;
@@ -163,1976 +145,6 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
163
145
  throw new Error("No ImageViewerProvider found");
164
146
  });
165
147
  const useImageViewer = () => React.useContext(ImageViewerContext);
166
- function composeEventHandlers(originalEventHandler, ourEventHandler, { checkForDefaultPrevented = true } = {}) {
167
- return function handleEvent(event) {
168
- originalEventHandler == null ? void 0 : originalEventHandler(event);
169
- if (checkForDefaultPrevented === false || !event.defaultPrevented) {
170
- return ourEventHandler == null ? void 0 : ourEventHandler(event);
171
- }
172
- };
173
- }
174
- function setRef(ref, value) {
175
- if (typeof ref === "function") {
176
- return ref(value);
177
- } else if (ref !== null && ref !== void 0) {
178
- ref.current = value;
179
- }
180
- }
181
- function composeRefs(...refs) {
182
- return (node) => {
183
- let hasCleanup = false;
184
- const cleanups = refs.map((ref) => {
185
- const cleanup = setRef(ref, node);
186
- if (!hasCleanup && typeof cleanup == "function") {
187
- hasCleanup = true;
188
- }
189
- return cleanup;
190
- });
191
- if (hasCleanup) {
192
- return () => {
193
- for (let i = 0; i < cleanups.length; i++) {
194
- const cleanup = cleanups[i];
195
- if (typeof cleanup == "function") {
196
- cleanup();
197
- } else {
198
- setRef(refs[i], null);
199
- }
200
- }
201
- };
202
- }
203
- };
204
- }
205
- function useComposedRefs(...refs) {
206
- return React__namespace.useCallback(composeRefs(...refs), refs);
207
- }
208
- function createContext2(rootComponentName, defaultContext) {
209
- const Context = React__namespace.createContext(defaultContext);
210
- const Provider = (props) => {
211
- const { children, ...context } = props;
212
- const value = React__namespace.useMemo(() => context, Object.values(context));
213
- return /* @__PURE__ */ jsxRuntime.jsx(Context.Provider, { value, children });
214
- };
215
- Provider.displayName = rootComponentName + "Provider";
216
- function useContext2(consumerName) {
217
- const context = React__namespace.useContext(Context);
218
- if (context) return context;
219
- if (defaultContext !== void 0) return defaultContext;
220
- throw new Error(`\`${consumerName}\` must be used within \`${rootComponentName}\``);
221
- }
222
- return [Provider, useContext2];
223
- }
224
- function createContextScope(scopeName, createContextScopeDeps = []) {
225
- let defaultContexts = [];
226
- function createContext3(rootComponentName, defaultContext) {
227
- const BaseContext = React__namespace.createContext(defaultContext);
228
- const index = defaultContexts.length;
229
- defaultContexts = [...defaultContexts, defaultContext];
230
- const Provider = (props) => {
231
- var _a2;
232
- const { scope, children, ...context } = props;
233
- const Context = ((_a2 = scope == null ? void 0 : scope[scopeName]) == null ? void 0 : _a2[index]) || BaseContext;
234
- const value = React__namespace.useMemo(() => context, Object.values(context));
235
- return /* @__PURE__ */ jsxRuntime.jsx(Context.Provider, { value, children });
236
- };
237
- Provider.displayName = rootComponentName + "Provider";
238
- function useContext2(consumerName, scope) {
239
- var _a2;
240
- const Context = ((_a2 = scope == null ? void 0 : scope[scopeName]) == null ? void 0 : _a2[index]) || BaseContext;
241
- const context = React__namespace.useContext(Context);
242
- if (context) return context;
243
- if (defaultContext !== void 0) return defaultContext;
244
- throw new Error(`\`${consumerName}\` must be used within \`${rootComponentName}\``);
245
- }
246
- return [Provider, useContext2];
247
- }
248
- const createScope = () => {
249
- const scopeContexts = defaultContexts.map((defaultContext) => {
250
- return React__namespace.createContext(defaultContext);
251
- });
252
- return function useScope(scope) {
253
- const contexts = (scope == null ? void 0 : scope[scopeName]) || scopeContexts;
254
- return React__namespace.useMemo(
255
- () => ({ [`__scope${scopeName}`]: { ...scope, [scopeName]: contexts } }),
256
- [scope, contexts]
257
- );
258
- };
259
- };
260
- createScope.scopeName = scopeName;
261
- return [createContext3, composeContextScopes(createScope, ...createContextScopeDeps)];
262
- }
263
- function composeContextScopes(...scopes) {
264
- const baseScope = scopes[0];
265
- if (scopes.length === 1) return baseScope;
266
- const createScope = () => {
267
- const scopeHooks = scopes.map((createScope2) => ({
268
- useScope: createScope2(),
269
- scopeName: createScope2.scopeName
270
- }));
271
- return function useComposedScopes(overrideScopes) {
272
- const nextScopes = scopeHooks.reduce((nextScopes2, { useScope, scopeName }) => {
273
- const scopeProps = useScope(overrideScopes);
274
- const currentScope = scopeProps[`__scope${scopeName}`];
275
- return { ...nextScopes2, ...currentScope };
276
- }, {});
277
- return React__namespace.useMemo(() => ({ [`__scope${baseScope.scopeName}`]: nextScopes }), [nextScopes]);
278
- };
279
- };
280
- createScope.scopeName = baseScope.scopeName;
281
- return createScope;
282
- }
283
- var useLayoutEffect2 = (globalThis == null ? void 0 : globalThis.document) ? React__namespace.useLayoutEffect : () => {
284
- };
285
- var useReactId = React__namespace[" useId ".trim().toString()] || (() => void 0);
286
- var count$1 = 0;
287
- function useId(deterministicId) {
288
- const [id, setId] = React__namespace.useState(useReactId());
289
- useLayoutEffect2(() => {
290
- setId((reactId) => reactId ?? String(count$1++));
291
- }, [deterministicId]);
292
- return deterministicId || (id ? `radix-${id}` : "");
293
- }
294
- var useInsertionEffect = React__namespace[" useInsertionEffect ".trim().toString()] || useLayoutEffect2;
295
- function useControllableState({
296
- prop,
297
- defaultProp,
298
- onChange = () => {
299
- },
300
- caller
301
- }) {
302
- const [uncontrolledProp, setUncontrolledProp, onChangeRef] = useUncontrolledState({
303
- defaultProp,
304
- onChange
305
- });
306
- const isControlled = prop !== void 0;
307
- const value = isControlled ? prop : uncontrolledProp;
308
- {
309
- const isControlledRef = React__namespace.useRef(prop !== void 0);
310
- React__namespace.useEffect(() => {
311
- const wasControlled = isControlledRef.current;
312
- if (wasControlled !== isControlled) {
313
- const from = wasControlled ? "controlled" : "uncontrolled";
314
- const to = isControlled ? "controlled" : "uncontrolled";
315
- console.warn(
316
- `${caller} is changing from ${from} to ${to}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`
317
- );
318
- }
319
- isControlledRef.current = isControlled;
320
- }, [isControlled, caller]);
321
- }
322
- const setValue = React__namespace.useCallback(
323
- (nextValue) => {
324
- var _a2;
325
- if (isControlled) {
326
- const value2 = isFunction(nextValue) ? nextValue(prop) : nextValue;
327
- if (value2 !== prop) {
328
- (_a2 = onChangeRef.current) == null ? void 0 : _a2.call(onChangeRef, value2);
329
- }
330
- } else {
331
- setUncontrolledProp(nextValue);
332
- }
333
- },
334
- [isControlled, prop, setUncontrolledProp, onChangeRef]
335
- );
336
- return [value, setValue];
337
- }
338
- function useUncontrolledState({
339
- defaultProp,
340
- onChange
341
- }) {
342
- const [value, setValue] = React__namespace.useState(defaultProp);
343
- const prevValueRef = React__namespace.useRef(value);
344
- const onChangeRef = React__namespace.useRef(onChange);
345
- useInsertionEffect(() => {
346
- onChangeRef.current = onChange;
347
- }, [onChange]);
348
- React__namespace.useEffect(() => {
349
- var _a2;
350
- if (prevValueRef.current !== value) {
351
- (_a2 = onChangeRef.current) == null ? void 0 : _a2.call(onChangeRef, value);
352
- prevValueRef.current = value;
353
- }
354
- }, [value, prevValueRef]);
355
- return [value, setValue, onChangeRef];
356
- }
357
- function isFunction(value) {
358
- return typeof value === "function";
359
- }
360
- // @__NO_SIDE_EFFECTS__
361
- function createSlot(ownerName) {
362
- const SlotClone = /* @__PURE__ */ createSlotClone(ownerName);
363
- const Slot2 = React__namespace.forwardRef((props, forwardedRef) => {
364
- const { children, ...slotProps } = props;
365
- const childrenArray = React__namespace.Children.toArray(children);
366
- const slottable = childrenArray.find(isSlottable);
367
- if (slottable) {
368
- const newElement = slottable.props.children;
369
- const newChildren = childrenArray.map((child) => {
370
- if (child === slottable) {
371
- if (React__namespace.Children.count(newElement) > 1) return React__namespace.Children.only(null);
372
- return React__namespace.isValidElement(newElement) ? newElement.props.children : null;
373
- } else {
374
- return child;
375
- }
376
- });
377
- return /* @__PURE__ */ jsxRuntime.jsx(SlotClone, { ...slotProps, ref: forwardedRef, children: React__namespace.isValidElement(newElement) ? React__namespace.cloneElement(newElement, void 0, newChildren) : null });
378
- }
379
- return /* @__PURE__ */ jsxRuntime.jsx(SlotClone, { ...slotProps, ref: forwardedRef, children });
380
- });
381
- Slot2.displayName = `${ownerName}.Slot`;
382
- return Slot2;
383
- }
384
- // @__NO_SIDE_EFFECTS__
385
- function createSlotClone(ownerName) {
386
- const SlotClone = React__namespace.forwardRef((props, forwardedRef) => {
387
- const { children, ...slotProps } = props;
388
- if (React__namespace.isValidElement(children)) {
389
- const childrenRef = getElementRef$1(children);
390
- const props2 = mergeProps(slotProps, children.props);
391
- if (children.type !== React__namespace.Fragment) {
392
- props2.ref = forwardedRef ? composeRefs(forwardedRef, childrenRef) : childrenRef;
393
- }
394
- return React__namespace.cloneElement(children, props2);
395
- }
396
- return React__namespace.Children.count(children) > 1 ? React__namespace.Children.only(null) : null;
397
- });
398
- SlotClone.displayName = `${ownerName}.SlotClone`;
399
- return SlotClone;
400
- }
401
- var SLOTTABLE_IDENTIFIER = Symbol("radix.slottable");
402
- function isSlottable(child) {
403
- return React__namespace.isValidElement(child) && typeof child.type === "function" && "__radixId" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER;
404
- }
405
- function mergeProps(slotProps, childProps) {
406
- const overrideProps = { ...childProps };
407
- for (const propName in childProps) {
408
- const slotPropValue = slotProps[propName];
409
- const childPropValue = childProps[propName];
410
- const isHandler = /^on[A-Z]/.test(propName);
411
- if (isHandler) {
412
- if (slotPropValue && childPropValue) {
413
- overrideProps[propName] = (...args) => {
414
- const result = childPropValue(...args);
415
- slotPropValue(...args);
416
- return result;
417
- };
418
- } else if (slotPropValue) {
419
- overrideProps[propName] = slotPropValue;
420
- }
421
- } else if (propName === "style") {
422
- overrideProps[propName] = { ...slotPropValue, ...childPropValue };
423
- } else if (propName === "className") {
424
- overrideProps[propName] = [slotPropValue, childPropValue].filter(Boolean).join(" ");
425
- }
426
- }
427
- return { ...slotProps, ...overrideProps };
428
- }
429
- function getElementRef$1(element) {
430
- var _a2, _b;
431
- let getter = (_a2 = Object.getOwnPropertyDescriptor(element.props, "ref")) == null ? void 0 : _a2.get;
432
- let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
433
- if (mayWarn) {
434
- return element.ref;
435
- }
436
- getter = (_b = Object.getOwnPropertyDescriptor(element, "ref")) == null ? void 0 : _b.get;
437
- mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
438
- if (mayWarn) {
439
- return element.props.ref;
440
- }
441
- return element.props.ref || element.ref;
442
- }
443
- var NODES = [
444
- "a",
445
- "button",
446
- "div",
447
- "form",
448
- "h2",
449
- "h3",
450
- "img",
451
- "input",
452
- "label",
453
- "li",
454
- "nav",
455
- "ol",
456
- "p",
457
- "select",
458
- "span",
459
- "svg",
460
- "ul"
461
- ];
462
- var Primitive = NODES.reduce((primitive, node) => {
463
- const Slot2 = /* @__PURE__ */ createSlot(`Primitive.${node}`);
464
- const Node = React__namespace.forwardRef((props, forwardedRef) => {
465
- const { asChild, ...primitiveProps } = props;
466
- const Comp = asChild ? Slot2 : node;
467
- if (typeof window !== "undefined") {
468
- window[Symbol.for("radix-ui")] = true;
469
- }
470
- return /* @__PURE__ */ jsxRuntime.jsx(Comp, { ...primitiveProps, ref: forwardedRef });
471
- });
472
- Node.displayName = `Primitive.${node}`;
473
- return { ...primitive, [node]: Node };
474
- }, {});
475
- function dispatchDiscreteCustomEvent(target, event) {
476
- if (target) ReactDOM__namespace.flushSync(() => target.dispatchEvent(event));
477
- }
478
- function useCallbackRef$1(callback) {
479
- const callbackRef = React__namespace.useRef(callback);
480
- React__namespace.useEffect(() => {
481
- callbackRef.current = callback;
482
- });
483
- return React__namespace.useMemo(() => (...args) => {
484
- var _a2;
485
- return (_a2 = callbackRef.current) == null ? void 0 : _a2.call(callbackRef, ...args);
486
- }, []);
487
- }
488
- function useEscapeKeydown(onEscapeKeyDownProp, ownerDocument = globalThis == null ? void 0 : globalThis.document) {
489
- const onEscapeKeyDown = useCallbackRef$1(onEscapeKeyDownProp);
490
- React__namespace.useEffect(() => {
491
- const handleKeyDown = (event) => {
492
- if (event.key === "Escape") {
493
- onEscapeKeyDown(event);
494
- }
495
- };
496
- ownerDocument.addEventListener("keydown", handleKeyDown, { capture: true });
497
- return () => ownerDocument.removeEventListener("keydown", handleKeyDown, { capture: true });
498
- }, [onEscapeKeyDown, ownerDocument]);
499
- }
500
- var DISMISSABLE_LAYER_NAME = "DismissableLayer";
501
- var CONTEXT_UPDATE = "dismissableLayer.update";
502
- var POINTER_DOWN_OUTSIDE = "dismissableLayer.pointerDownOutside";
503
- var FOCUS_OUTSIDE = "dismissableLayer.focusOutside";
504
- var originalBodyPointerEvents;
505
- var DismissableLayerContext = React__namespace.createContext({
506
- layers: /* @__PURE__ */ new Set(),
507
- layersWithOutsidePointerEventsDisabled: /* @__PURE__ */ new Set(),
508
- branches: /* @__PURE__ */ new Set()
509
- });
510
- var DismissableLayer = React__namespace.forwardRef(
511
- (props, forwardedRef) => {
512
- const {
513
- disableOutsidePointerEvents = false,
514
- onEscapeKeyDown,
515
- onPointerDownOutside,
516
- onFocusOutside,
517
- onInteractOutside,
518
- onDismiss,
519
- ...layerProps
520
- } = props;
521
- const context = React__namespace.useContext(DismissableLayerContext);
522
- const [node, setNode] = React__namespace.useState(null);
523
- const ownerDocument = (node == null ? void 0 : node.ownerDocument) ?? (globalThis == null ? void 0 : globalThis.document);
524
- const [, force] = React__namespace.useState({});
525
- const composedRefs = useComposedRefs(forwardedRef, (node2) => setNode(node2));
526
- const layers = Array.from(context.layers);
527
- const [highestLayerWithOutsidePointerEventsDisabled] = [...context.layersWithOutsidePointerEventsDisabled].slice(-1);
528
- const highestLayerWithOutsidePointerEventsDisabledIndex = layers.indexOf(highestLayerWithOutsidePointerEventsDisabled);
529
- const index = node ? layers.indexOf(node) : -1;
530
- const isBodyPointerEventsDisabled = context.layersWithOutsidePointerEventsDisabled.size > 0;
531
- const isPointerEventsEnabled = index >= highestLayerWithOutsidePointerEventsDisabledIndex;
532
- const pointerDownOutside = usePointerDownOutside((event) => {
533
- const target = event.target;
534
- const isPointerDownOnBranch = [...context.branches].some((branch) => branch.contains(target));
535
- if (!isPointerEventsEnabled || isPointerDownOnBranch) return;
536
- onPointerDownOutside == null ? void 0 : onPointerDownOutside(event);
537
- onInteractOutside == null ? void 0 : onInteractOutside(event);
538
- if (!event.defaultPrevented) onDismiss == null ? void 0 : onDismiss();
539
- }, ownerDocument);
540
- const focusOutside = useFocusOutside((event) => {
541
- const target = event.target;
542
- const isFocusInBranch = [...context.branches].some((branch) => branch.contains(target));
543
- if (isFocusInBranch) return;
544
- onFocusOutside == null ? void 0 : onFocusOutside(event);
545
- onInteractOutside == null ? void 0 : onInteractOutside(event);
546
- if (!event.defaultPrevented) onDismiss == null ? void 0 : onDismiss();
547
- }, ownerDocument);
548
- useEscapeKeydown((event) => {
549
- const isHighestLayer = index === context.layers.size - 1;
550
- if (!isHighestLayer) return;
551
- onEscapeKeyDown == null ? void 0 : onEscapeKeyDown(event);
552
- if (!event.defaultPrevented && onDismiss) {
553
- event.preventDefault();
554
- onDismiss();
555
- }
556
- }, ownerDocument);
557
- React__namespace.useEffect(() => {
558
- if (!node) return;
559
- if (disableOutsidePointerEvents) {
560
- if (context.layersWithOutsidePointerEventsDisabled.size === 0) {
561
- originalBodyPointerEvents = ownerDocument.body.style.pointerEvents;
562
- ownerDocument.body.style.pointerEvents = "none";
563
- }
564
- context.layersWithOutsidePointerEventsDisabled.add(node);
565
- }
566
- context.layers.add(node);
567
- dispatchUpdate();
568
- return () => {
569
- if (disableOutsidePointerEvents && context.layersWithOutsidePointerEventsDisabled.size === 1) {
570
- ownerDocument.body.style.pointerEvents = originalBodyPointerEvents;
571
- }
572
- };
573
- }, [node, ownerDocument, disableOutsidePointerEvents, context]);
574
- React__namespace.useEffect(() => {
575
- return () => {
576
- if (!node) return;
577
- context.layers.delete(node);
578
- context.layersWithOutsidePointerEventsDisabled.delete(node);
579
- dispatchUpdate();
580
- };
581
- }, [node, context]);
582
- React__namespace.useEffect(() => {
583
- const handleUpdate = () => force({});
584
- document.addEventListener(CONTEXT_UPDATE, handleUpdate);
585
- return () => document.removeEventListener(CONTEXT_UPDATE, handleUpdate);
586
- }, []);
587
- return /* @__PURE__ */ jsxRuntime.jsx(
588
- Primitive.div,
589
- {
590
- ...layerProps,
591
- ref: composedRefs,
592
- style: {
593
- pointerEvents: isBodyPointerEventsDisabled ? isPointerEventsEnabled ? "auto" : "none" : void 0,
594
- ...props.style
595
- },
596
- onFocusCapture: composeEventHandlers(props.onFocusCapture, focusOutside.onFocusCapture),
597
- onBlurCapture: composeEventHandlers(props.onBlurCapture, focusOutside.onBlurCapture),
598
- onPointerDownCapture: composeEventHandlers(
599
- props.onPointerDownCapture,
600
- pointerDownOutside.onPointerDownCapture
601
- )
602
- }
603
- );
604
- }
605
- );
606
- DismissableLayer.displayName = DISMISSABLE_LAYER_NAME;
607
- var BRANCH_NAME = "DismissableLayerBranch";
608
- var DismissableLayerBranch = React__namespace.forwardRef((props, forwardedRef) => {
609
- const context = React__namespace.useContext(DismissableLayerContext);
610
- const ref = React__namespace.useRef(null);
611
- const composedRefs = useComposedRefs(forwardedRef, ref);
612
- React__namespace.useEffect(() => {
613
- const node = ref.current;
614
- if (node) {
615
- context.branches.add(node);
616
- return () => {
617
- context.branches.delete(node);
618
- };
619
- }
620
- }, [context.branches]);
621
- return /* @__PURE__ */ jsxRuntime.jsx(Primitive.div, { ...props, ref: composedRefs });
622
- });
623
- DismissableLayerBranch.displayName = BRANCH_NAME;
624
- function usePointerDownOutside(onPointerDownOutside, ownerDocument = globalThis == null ? void 0 : globalThis.document) {
625
- const handlePointerDownOutside = useCallbackRef$1(onPointerDownOutside);
626
- const isPointerInsideReactTreeRef = React__namespace.useRef(false);
627
- const handleClickRef = React__namespace.useRef(() => {
628
- });
629
- React__namespace.useEffect(() => {
630
- const handlePointerDown = (event) => {
631
- if (event.target && !isPointerInsideReactTreeRef.current) {
632
- let handleAndDispatchPointerDownOutsideEvent2 = function() {
633
- handleAndDispatchCustomEvent(
634
- POINTER_DOWN_OUTSIDE,
635
- handlePointerDownOutside,
636
- eventDetail,
637
- { discrete: true }
638
- );
639
- };
640
- const eventDetail = { originalEvent: event };
641
- if (event.pointerType === "touch") {
642
- ownerDocument.removeEventListener("click", handleClickRef.current);
643
- handleClickRef.current = handleAndDispatchPointerDownOutsideEvent2;
644
- ownerDocument.addEventListener("click", handleClickRef.current, { once: true });
645
- } else {
646
- handleAndDispatchPointerDownOutsideEvent2();
647
- }
648
- } else {
649
- ownerDocument.removeEventListener("click", handleClickRef.current);
650
- }
651
- isPointerInsideReactTreeRef.current = false;
652
- };
653
- const timerId = window.setTimeout(() => {
654
- ownerDocument.addEventListener("pointerdown", handlePointerDown);
655
- }, 0);
656
- return () => {
657
- window.clearTimeout(timerId);
658
- ownerDocument.removeEventListener("pointerdown", handlePointerDown);
659
- ownerDocument.removeEventListener("click", handleClickRef.current);
660
- };
661
- }, [ownerDocument, handlePointerDownOutside]);
662
- return {
663
- // ensures we check React component tree (not just DOM tree)
664
- onPointerDownCapture: () => isPointerInsideReactTreeRef.current = true
665
- };
666
- }
667
- function useFocusOutside(onFocusOutside, ownerDocument = globalThis == null ? void 0 : globalThis.document) {
668
- const handleFocusOutside = useCallbackRef$1(onFocusOutside);
669
- const isFocusInsideReactTreeRef = React__namespace.useRef(false);
670
- React__namespace.useEffect(() => {
671
- const handleFocus = (event) => {
672
- if (event.target && !isFocusInsideReactTreeRef.current) {
673
- const eventDetail = { originalEvent: event };
674
- handleAndDispatchCustomEvent(FOCUS_OUTSIDE, handleFocusOutside, eventDetail, {
675
- discrete: false
676
- });
677
- }
678
- };
679
- ownerDocument.addEventListener("focusin", handleFocus);
680
- return () => ownerDocument.removeEventListener("focusin", handleFocus);
681
- }, [ownerDocument, handleFocusOutside]);
682
- return {
683
- onFocusCapture: () => isFocusInsideReactTreeRef.current = true,
684
- onBlurCapture: () => isFocusInsideReactTreeRef.current = false
685
- };
686
- }
687
- function dispatchUpdate() {
688
- const event = new CustomEvent(CONTEXT_UPDATE);
689
- document.dispatchEvent(event);
690
- }
691
- function handleAndDispatchCustomEvent(name, handler, detail, { discrete }) {
692
- const target = detail.originalEvent.target;
693
- const event = new CustomEvent(name, { bubbles: false, cancelable: true, detail });
694
- if (handler) target.addEventListener(name, handler, { once: true });
695
- if (discrete) {
696
- dispatchDiscreteCustomEvent(target, event);
697
- } else {
698
- target.dispatchEvent(event);
699
- }
700
- }
701
- var AUTOFOCUS_ON_MOUNT = "focusScope.autoFocusOnMount";
702
- var AUTOFOCUS_ON_UNMOUNT = "focusScope.autoFocusOnUnmount";
703
- var EVENT_OPTIONS = { bubbles: false, cancelable: true };
704
- var FOCUS_SCOPE_NAME = "FocusScope";
705
- var FocusScope = React__namespace.forwardRef((props, forwardedRef) => {
706
- const {
707
- loop = false,
708
- trapped = false,
709
- onMountAutoFocus: onMountAutoFocusProp,
710
- onUnmountAutoFocus: onUnmountAutoFocusProp,
711
- ...scopeProps
712
- } = props;
713
- const [container, setContainer] = React__namespace.useState(null);
714
- const onMountAutoFocus = useCallbackRef$1(onMountAutoFocusProp);
715
- const onUnmountAutoFocus = useCallbackRef$1(onUnmountAutoFocusProp);
716
- const lastFocusedElementRef = React__namespace.useRef(null);
717
- const composedRefs = useComposedRefs(forwardedRef, (node) => setContainer(node));
718
- const focusScope = React__namespace.useRef({
719
- paused: false,
720
- pause() {
721
- this.paused = true;
722
- },
723
- resume() {
724
- this.paused = false;
725
- }
726
- }).current;
727
- React__namespace.useEffect(() => {
728
- if (trapped) {
729
- let handleFocusIn2 = function(event) {
730
- if (focusScope.paused || !container) return;
731
- const target = event.target;
732
- if (container.contains(target)) {
733
- lastFocusedElementRef.current = target;
734
- } else {
735
- focus(lastFocusedElementRef.current, { select: true });
736
- }
737
- }, handleFocusOut2 = function(event) {
738
- if (focusScope.paused || !container) return;
739
- const relatedTarget = event.relatedTarget;
740
- if (relatedTarget === null) return;
741
- if (!container.contains(relatedTarget)) {
742
- focus(lastFocusedElementRef.current, { select: true });
743
- }
744
- }, handleMutations2 = function(mutations) {
745
- const focusedElement = document.activeElement;
746
- if (focusedElement !== document.body) return;
747
- for (const mutation of mutations) {
748
- if (mutation.removedNodes.length > 0) focus(container);
749
- }
750
- };
751
- document.addEventListener("focusin", handleFocusIn2);
752
- document.addEventListener("focusout", handleFocusOut2);
753
- const mutationObserver = new MutationObserver(handleMutations2);
754
- if (container) mutationObserver.observe(container, { childList: true, subtree: true });
755
- return () => {
756
- document.removeEventListener("focusin", handleFocusIn2);
757
- document.removeEventListener("focusout", handleFocusOut2);
758
- mutationObserver.disconnect();
759
- };
760
- }
761
- }, [trapped, container, focusScope.paused]);
762
- React__namespace.useEffect(() => {
763
- if (container) {
764
- focusScopesStack.add(focusScope);
765
- const previouslyFocusedElement = document.activeElement;
766
- const hasFocusedCandidate = container.contains(previouslyFocusedElement);
767
- if (!hasFocusedCandidate) {
768
- const mountEvent = new CustomEvent(AUTOFOCUS_ON_MOUNT, EVENT_OPTIONS);
769
- container.addEventListener(AUTOFOCUS_ON_MOUNT, onMountAutoFocus);
770
- container.dispatchEvent(mountEvent);
771
- if (!mountEvent.defaultPrevented) {
772
- focusFirst(removeLinks(getTabbableCandidates(container)), { select: true });
773
- if (document.activeElement === previouslyFocusedElement) {
774
- focus(container);
775
- }
776
- }
777
- }
778
- return () => {
779
- container.removeEventListener(AUTOFOCUS_ON_MOUNT, onMountAutoFocus);
780
- setTimeout(() => {
781
- const unmountEvent = new CustomEvent(AUTOFOCUS_ON_UNMOUNT, EVENT_OPTIONS);
782
- container.addEventListener(AUTOFOCUS_ON_UNMOUNT, onUnmountAutoFocus);
783
- container.dispatchEvent(unmountEvent);
784
- if (!unmountEvent.defaultPrevented) {
785
- focus(previouslyFocusedElement ?? document.body, { select: true });
786
- }
787
- container.removeEventListener(AUTOFOCUS_ON_UNMOUNT, onUnmountAutoFocus);
788
- focusScopesStack.remove(focusScope);
789
- }, 0);
790
- };
791
- }
792
- }, [container, onMountAutoFocus, onUnmountAutoFocus, focusScope]);
793
- const handleKeyDown = React__namespace.useCallback(
794
- (event) => {
795
- if (!loop && !trapped) return;
796
- if (focusScope.paused) return;
797
- const isTabKey = event.key === "Tab" && !event.altKey && !event.ctrlKey && !event.metaKey;
798
- const focusedElement = document.activeElement;
799
- if (isTabKey && focusedElement) {
800
- const container2 = event.currentTarget;
801
- const [first, last] = getTabbableEdges(container2);
802
- const hasTabbableElementsInside = first && last;
803
- if (!hasTabbableElementsInside) {
804
- if (focusedElement === container2) event.preventDefault();
805
- } else {
806
- if (!event.shiftKey && focusedElement === last) {
807
- event.preventDefault();
808
- if (loop) focus(first, { select: true });
809
- } else if (event.shiftKey && focusedElement === first) {
810
- event.preventDefault();
811
- if (loop) focus(last, { select: true });
812
- }
813
- }
814
- }
815
- },
816
- [loop, trapped, focusScope.paused]
817
- );
818
- return /* @__PURE__ */ jsxRuntime.jsx(Primitive.div, { tabIndex: -1, ...scopeProps, ref: composedRefs, onKeyDown: handleKeyDown });
819
- });
820
- FocusScope.displayName = FOCUS_SCOPE_NAME;
821
- function focusFirst(candidates, { select = false } = {}) {
822
- const previouslyFocusedElement = document.activeElement;
823
- for (const candidate of candidates) {
824
- focus(candidate, { select });
825
- if (document.activeElement !== previouslyFocusedElement) return;
826
- }
827
- }
828
- function getTabbableEdges(container) {
829
- const candidates = getTabbableCandidates(container);
830
- const first = findVisible(candidates, container);
831
- const last = findVisible(candidates.reverse(), container);
832
- return [first, last];
833
- }
834
- function getTabbableCandidates(container) {
835
- const nodes = [];
836
- const walker = document.createTreeWalker(container, NodeFilter.SHOW_ELEMENT, {
837
- acceptNode: (node) => {
838
- const isHiddenInput = node.tagName === "INPUT" && node.type === "hidden";
839
- if (node.disabled || node.hidden || isHiddenInput) return NodeFilter.FILTER_SKIP;
840
- return node.tabIndex >= 0 ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
841
- }
842
- });
843
- while (walker.nextNode()) nodes.push(walker.currentNode);
844
- return nodes;
845
- }
846
- function findVisible(elements, container) {
847
- for (const element of elements) {
848
- if (!isHidden(element, { upTo: container })) return element;
849
- }
850
- }
851
- function isHidden(node, { upTo }) {
852
- if (getComputedStyle(node).visibility === "hidden") return true;
853
- while (node) {
854
- if (upTo !== void 0 && node === upTo) return false;
855
- if (getComputedStyle(node).display === "none") return true;
856
- node = node.parentElement;
857
- }
858
- return false;
859
- }
860
- function isSelectableInput(element) {
861
- return element instanceof HTMLInputElement && "select" in element;
862
- }
863
- function focus(element, { select = false } = {}) {
864
- if (element && element.focus) {
865
- const previouslyFocusedElement = document.activeElement;
866
- element.focus({ preventScroll: true });
867
- if (element !== previouslyFocusedElement && isSelectableInput(element) && select)
868
- element.select();
869
- }
870
- }
871
- var focusScopesStack = createFocusScopesStack();
872
- function createFocusScopesStack() {
873
- let stack = [];
874
- return {
875
- add(focusScope) {
876
- const activeFocusScope = stack[0];
877
- if (focusScope !== activeFocusScope) {
878
- activeFocusScope == null ? void 0 : activeFocusScope.pause();
879
- }
880
- stack = arrayRemove(stack, focusScope);
881
- stack.unshift(focusScope);
882
- },
883
- remove(focusScope) {
884
- var _a2;
885
- stack = arrayRemove(stack, focusScope);
886
- (_a2 = stack[0]) == null ? void 0 : _a2.resume();
887
- }
888
- };
889
- }
890
- function arrayRemove(array, item) {
891
- const updatedArray = [...array];
892
- const index = updatedArray.indexOf(item);
893
- if (index !== -1) {
894
- updatedArray.splice(index, 1);
895
- }
896
- return updatedArray;
897
- }
898
- function removeLinks(items) {
899
- return items.filter((item) => item.tagName !== "A");
900
- }
901
- var PORTAL_NAME$1 = "Portal";
902
- var Portal$1 = React__namespace.forwardRef((props, forwardedRef) => {
903
- var _a2;
904
- const { container: containerProp, ...portalProps } = props;
905
- const [mounted, setMounted] = React__namespace.useState(false);
906
- useLayoutEffect2(() => setMounted(true), []);
907
- const container = containerProp || mounted && ((_a2 = globalThis == null ? void 0 : globalThis.document) == null ? void 0 : _a2.body);
908
- return container ? ReactDOM.createPortal(/* @__PURE__ */ jsxRuntime.jsx(Primitive.div, { ...portalProps, ref: forwardedRef }), container) : null;
909
- });
910
- Portal$1.displayName = PORTAL_NAME$1;
911
- function useStateMachine(initialState, machine) {
912
- return React__namespace.useReducer((state, event) => {
913
- const nextState = machine[state][event];
914
- return nextState ?? state;
915
- }, initialState);
916
- }
917
- var Presence = (props) => {
918
- const { present, children } = props;
919
- const presence = usePresence(present);
920
- const child = typeof children === "function" ? children({ present: presence.isPresent }) : React__namespace.Children.only(children);
921
- const ref = useComposedRefs(presence.ref, getElementRef(child));
922
- const forceMount = typeof children === "function";
923
- return forceMount || presence.isPresent ? React__namespace.cloneElement(child, { ref }) : null;
924
- };
925
- Presence.displayName = "Presence";
926
- function usePresence(present) {
927
- const [node, setNode] = React__namespace.useState();
928
- const stylesRef = React__namespace.useRef(null);
929
- const prevPresentRef = React__namespace.useRef(present);
930
- const prevAnimationNameRef = React__namespace.useRef("none");
931
- const initialState = present ? "mounted" : "unmounted";
932
- const [state, send] = useStateMachine(initialState, {
933
- mounted: {
934
- UNMOUNT: "unmounted",
935
- ANIMATION_OUT: "unmountSuspended"
936
- },
937
- unmountSuspended: {
938
- MOUNT: "mounted",
939
- ANIMATION_END: "unmounted"
940
- },
941
- unmounted: {
942
- MOUNT: "mounted"
943
- }
944
- });
945
- React__namespace.useEffect(() => {
946
- const currentAnimationName = getAnimationName(stylesRef.current);
947
- prevAnimationNameRef.current = state === "mounted" ? currentAnimationName : "none";
948
- }, [state]);
949
- useLayoutEffect2(() => {
950
- const styles = stylesRef.current;
951
- const wasPresent = prevPresentRef.current;
952
- const hasPresentChanged = wasPresent !== present;
953
- if (hasPresentChanged) {
954
- const prevAnimationName = prevAnimationNameRef.current;
955
- const currentAnimationName = getAnimationName(styles);
956
- if (present) {
957
- send("MOUNT");
958
- } else if (currentAnimationName === "none" || (styles == null ? void 0 : styles.display) === "none") {
959
- send("UNMOUNT");
960
- } else {
961
- const isAnimating = prevAnimationName !== currentAnimationName;
962
- if (wasPresent && isAnimating) {
963
- send("ANIMATION_OUT");
964
- } else {
965
- send("UNMOUNT");
966
- }
967
- }
968
- prevPresentRef.current = present;
969
- }
970
- }, [present, send]);
971
- useLayoutEffect2(() => {
972
- if (node) {
973
- let timeoutId;
974
- const ownerWindow = node.ownerDocument.defaultView ?? window;
975
- const handleAnimationEnd = (event) => {
976
- const currentAnimationName = getAnimationName(stylesRef.current);
977
- const isCurrentAnimation = currentAnimationName.includes(event.animationName);
978
- if (event.target === node && isCurrentAnimation) {
979
- send("ANIMATION_END");
980
- if (!prevPresentRef.current) {
981
- const currentFillMode = node.style.animationFillMode;
982
- node.style.animationFillMode = "forwards";
983
- timeoutId = ownerWindow.setTimeout(() => {
984
- if (node.style.animationFillMode === "forwards") {
985
- node.style.animationFillMode = currentFillMode;
986
- }
987
- });
988
- }
989
- }
990
- };
991
- const handleAnimationStart = (event) => {
992
- if (event.target === node) {
993
- prevAnimationNameRef.current = getAnimationName(stylesRef.current);
994
- }
995
- };
996
- node.addEventListener("animationstart", handleAnimationStart);
997
- node.addEventListener("animationcancel", handleAnimationEnd);
998
- node.addEventListener("animationend", handleAnimationEnd);
999
- return () => {
1000
- ownerWindow.clearTimeout(timeoutId);
1001
- node.removeEventListener("animationstart", handleAnimationStart);
1002
- node.removeEventListener("animationcancel", handleAnimationEnd);
1003
- node.removeEventListener("animationend", handleAnimationEnd);
1004
- };
1005
- } else {
1006
- send("ANIMATION_END");
1007
- }
1008
- }, [node, send]);
1009
- return {
1010
- isPresent: ["mounted", "unmountSuspended"].includes(state),
1011
- ref: React__namespace.useCallback((node2) => {
1012
- stylesRef.current = node2 ? getComputedStyle(node2) : null;
1013
- setNode(node2);
1014
- }, [])
1015
- };
1016
- }
1017
- function getAnimationName(styles) {
1018
- return (styles == null ? void 0 : styles.animationName) || "none";
1019
- }
1020
- function getElementRef(element) {
1021
- var _a2, _b;
1022
- let getter = (_a2 = Object.getOwnPropertyDescriptor(element.props, "ref")) == null ? void 0 : _a2.get;
1023
- let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
1024
- if (mayWarn) {
1025
- return element.ref;
1026
- }
1027
- getter = (_b = Object.getOwnPropertyDescriptor(element, "ref")) == null ? void 0 : _b.get;
1028
- mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
1029
- if (mayWarn) {
1030
- return element.props.ref;
1031
- }
1032
- return element.props.ref || element.ref;
1033
- }
1034
- var count = 0;
1035
- function useFocusGuards() {
1036
- React__namespace.useEffect(() => {
1037
- const edgeGuards = document.querySelectorAll("[data-radix-focus-guard]");
1038
- document.body.insertAdjacentElement("afterbegin", edgeGuards[0] ?? createFocusGuard());
1039
- document.body.insertAdjacentElement("beforeend", edgeGuards[1] ?? createFocusGuard());
1040
- count++;
1041
- return () => {
1042
- if (count === 1) {
1043
- document.querySelectorAll("[data-radix-focus-guard]").forEach((node) => node.remove());
1044
- }
1045
- count--;
1046
- };
1047
- }, []);
1048
- }
1049
- function createFocusGuard() {
1050
- const element = document.createElement("span");
1051
- element.setAttribute("data-radix-focus-guard", "");
1052
- element.tabIndex = 0;
1053
- element.style.outline = "none";
1054
- element.style.opacity = "0";
1055
- element.style.position = "fixed";
1056
- element.style.pointerEvents = "none";
1057
- return element;
1058
- }
1059
- var __assign = function() {
1060
- __assign = Object.assign || function __assign2(t) {
1061
- for (var s, i = 1, n = arguments.length; i < n; i++) {
1062
- s = arguments[i];
1063
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
1064
- }
1065
- return t;
1066
- };
1067
- return __assign.apply(this, arguments);
1068
- };
1069
- function __rest(s, e) {
1070
- var t = {};
1071
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
1072
- t[p] = s[p];
1073
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
1074
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
1075
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
1076
- t[p[i]] = s[p[i]];
1077
- }
1078
- return t;
1079
- }
1080
- function __spreadArray(to, from, pack) {
1081
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
1082
- if (ar || !(i in from)) {
1083
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
1084
- ar[i] = from[i];
1085
- }
1086
- }
1087
- return to.concat(ar || Array.prototype.slice.call(from));
1088
- }
1089
- typeof SuppressedError === "function" ? SuppressedError : function(error, suppressed, message) {
1090
- var e = new Error(message);
1091
- return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
1092
- };
1093
- var zeroRightClassName = "right-scroll-bar-position";
1094
- var fullWidthClassName = "width-before-scroll-bar";
1095
- var noScrollbarsClassName = "with-scroll-bars-hidden";
1096
- var removedBarSizeVariable = "--removed-body-scroll-bar-size";
1097
- function assignRef(ref, value) {
1098
- if (typeof ref === "function") {
1099
- ref(value);
1100
- } else if (ref) {
1101
- ref.current = value;
1102
- }
1103
- return ref;
1104
- }
1105
- function useCallbackRef(initialValue, callback) {
1106
- var ref = React.useState(function() {
1107
- return {
1108
- // value
1109
- value: initialValue,
1110
- // last callback
1111
- callback,
1112
- // "memoized" public interface
1113
- facade: {
1114
- get current() {
1115
- return ref.value;
1116
- },
1117
- set current(value) {
1118
- var last = ref.value;
1119
- if (last !== value) {
1120
- ref.value = value;
1121
- ref.callback(value, last);
1122
- }
1123
- }
1124
- }
1125
- };
1126
- })[0];
1127
- ref.callback = callback;
1128
- return ref.facade;
1129
- }
1130
- var useIsomorphicLayoutEffect = typeof window !== "undefined" ? React__namespace.useLayoutEffect : React__namespace.useEffect;
1131
- var currentValues = /* @__PURE__ */ new WeakMap();
1132
- function useMergeRefs(refs, defaultValue) {
1133
- var callbackRef = useCallbackRef(null, function(newValue) {
1134
- return refs.forEach(function(ref) {
1135
- return assignRef(ref, newValue);
1136
- });
1137
- });
1138
- useIsomorphicLayoutEffect(function() {
1139
- var oldValue = currentValues.get(callbackRef);
1140
- if (oldValue) {
1141
- var prevRefs_1 = new Set(oldValue);
1142
- var nextRefs_1 = new Set(refs);
1143
- var current_1 = callbackRef.current;
1144
- prevRefs_1.forEach(function(ref) {
1145
- if (!nextRefs_1.has(ref)) {
1146
- assignRef(ref, null);
1147
- }
1148
- });
1149
- nextRefs_1.forEach(function(ref) {
1150
- if (!prevRefs_1.has(ref)) {
1151
- assignRef(ref, current_1);
1152
- }
1153
- });
1154
- }
1155
- currentValues.set(callbackRef, refs);
1156
- }, [refs]);
1157
- return callbackRef;
1158
- }
1159
- function ItoI(a) {
1160
- return a;
1161
- }
1162
- function innerCreateMedium(defaults, middleware) {
1163
- if (middleware === void 0) {
1164
- middleware = ItoI;
1165
- }
1166
- var buffer = [];
1167
- var assigned = false;
1168
- var medium = {
1169
- read: function() {
1170
- if (assigned) {
1171
- throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");
1172
- }
1173
- if (buffer.length) {
1174
- return buffer[buffer.length - 1];
1175
- }
1176
- return defaults;
1177
- },
1178
- useMedium: function(data) {
1179
- var item = middleware(data, assigned);
1180
- buffer.push(item);
1181
- return function() {
1182
- buffer = buffer.filter(function(x) {
1183
- return x !== item;
1184
- });
1185
- };
1186
- },
1187
- assignSyncMedium: function(cb) {
1188
- assigned = true;
1189
- while (buffer.length) {
1190
- var cbs = buffer;
1191
- buffer = [];
1192
- cbs.forEach(cb);
1193
- }
1194
- buffer = {
1195
- push: function(x) {
1196
- return cb(x);
1197
- },
1198
- filter: function() {
1199
- return buffer;
1200
- }
1201
- };
1202
- },
1203
- assignMedium: function(cb) {
1204
- assigned = true;
1205
- var pendingQueue = [];
1206
- if (buffer.length) {
1207
- var cbs = buffer;
1208
- buffer = [];
1209
- cbs.forEach(cb);
1210
- pendingQueue = buffer;
1211
- }
1212
- var executeQueue = function() {
1213
- var cbs2 = pendingQueue;
1214
- pendingQueue = [];
1215
- cbs2.forEach(cb);
1216
- };
1217
- var cycle = function() {
1218
- return Promise.resolve().then(executeQueue);
1219
- };
1220
- cycle();
1221
- buffer = {
1222
- push: function(x) {
1223
- pendingQueue.push(x);
1224
- cycle();
1225
- },
1226
- filter: function(filter) {
1227
- pendingQueue = pendingQueue.filter(filter);
1228
- return buffer;
1229
- }
1230
- };
1231
- }
1232
- };
1233
- return medium;
1234
- }
1235
- function createSidecarMedium(options2) {
1236
- if (options2 === void 0) {
1237
- options2 = {};
1238
- }
1239
- var medium = innerCreateMedium(null);
1240
- medium.options = __assign({ async: true, ssr: false }, options2);
1241
- return medium;
1242
- }
1243
- var SideCar$1 = function(_a2) {
1244
- var sideCar = _a2.sideCar, rest = __rest(_a2, ["sideCar"]);
1245
- if (!sideCar) {
1246
- throw new Error("Sidecar: please provide `sideCar` property to import the right car");
1247
- }
1248
- var Target = sideCar.read();
1249
- if (!Target) {
1250
- throw new Error("Sidecar medium not found");
1251
- }
1252
- return React__namespace.createElement(Target, __assign({}, rest));
1253
- };
1254
- SideCar$1.isSideCarExport = true;
1255
- function exportSidecar(medium, exported) {
1256
- medium.useMedium(exported);
1257
- return SideCar$1;
1258
- }
1259
- var effectCar = createSidecarMedium();
1260
- var nothing = function() {
1261
- return;
1262
- };
1263
- var RemoveScroll = React__namespace.forwardRef(function(props, parentRef) {
1264
- var ref = React__namespace.useRef(null);
1265
- var _a2 = React__namespace.useState({
1266
- onScrollCapture: nothing,
1267
- onWheelCapture: nothing,
1268
- onTouchMoveCapture: nothing
1269
- }), callbacks = _a2[0], setCallbacks = _a2[1];
1270
- var forwardProps = props.forwardProps, children = props.children, className = props.className, removeScrollBar = props.removeScrollBar, enabled = props.enabled, shards = props.shards, sideCar = props.sideCar, noIsolation = props.noIsolation, inert = props.inert, allowPinchZoom = props.allowPinchZoom, _b = props.as, Container = _b === void 0 ? "div" : _b, gapMode = props.gapMode, rest = __rest(props, ["forwardProps", "children", "className", "removeScrollBar", "enabled", "shards", "sideCar", "noIsolation", "inert", "allowPinchZoom", "as", "gapMode"]);
1271
- var SideCar2 = sideCar;
1272
- var containerRef = useMergeRefs([ref, parentRef]);
1273
- var containerProps = __assign(__assign({}, rest), callbacks);
1274
- return React__namespace.createElement(
1275
- React__namespace.Fragment,
1276
- null,
1277
- enabled && React__namespace.createElement(SideCar2, { sideCar: effectCar, removeScrollBar, shards, noIsolation, inert, setCallbacks, allowPinchZoom: !!allowPinchZoom, lockRef: ref, gapMode }),
1278
- forwardProps ? React__namespace.cloneElement(React__namespace.Children.only(children), __assign(__assign({}, containerProps), { ref: containerRef })) : React__namespace.createElement(Container, __assign({}, containerProps, { className, ref: containerRef }), children)
1279
- );
1280
- });
1281
- RemoveScroll.defaultProps = {
1282
- enabled: true,
1283
- removeScrollBar: true,
1284
- inert: false
1285
- };
1286
- RemoveScroll.classNames = {
1287
- fullWidth: fullWidthClassName,
1288
- zeroRight: zeroRightClassName
1289
- };
1290
- var getNonce = function() {
1291
- if (typeof __webpack_nonce__ !== "undefined") {
1292
- return __webpack_nonce__;
1293
- }
1294
- return void 0;
1295
- };
1296
- function makeStyleTag() {
1297
- if (!document)
1298
- return null;
1299
- var tag = document.createElement("style");
1300
- tag.type = "text/css";
1301
- var nonce = getNonce();
1302
- if (nonce) {
1303
- tag.setAttribute("nonce", nonce);
1304
- }
1305
- return tag;
1306
- }
1307
- function injectStyles(tag, css) {
1308
- if (tag.styleSheet) {
1309
- tag.styleSheet.cssText = css;
1310
- } else {
1311
- tag.appendChild(document.createTextNode(css));
1312
- }
1313
- }
1314
- function insertStyleTag(tag) {
1315
- var head = document.head || document.getElementsByTagName("head")[0];
1316
- head.appendChild(tag);
1317
- }
1318
- var stylesheetSingleton = function() {
1319
- var counter = 0;
1320
- var stylesheet = null;
1321
- return {
1322
- add: function(style) {
1323
- if (counter == 0) {
1324
- if (stylesheet = makeStyleTag()) {
1325
- injectStyles(stylesheet, style);
1326
- insertStyleTag(stylesheet);
1327
- }
1328
- }
1329
- counter++;
1330
- },
1331
- remove: function() {
1332
- counter--;
1333
- if (!counter && stylesheet) {
1334
- stylesheet.parentNode && stylesheet.parentNode.removeChild(stylesheet);
1335
- stylesheet = null;
1336
- }
1337
- }
1338
- };
1339
- };
1340
- var styleHookSingleton = function() {
1341
- var sheet = stylesheetSingleton();
1342
- return function(styles, isDynamic) {
1343
- React__namespace.useEffect(function() {
1344
- sheet.add(styles);
1345
- return function() {
1346
- sheet.remove();
1347
- };
1348
- }, [styles && isDynamic]);
1349
- };
1350
- };
1351
- var styleSingleton = function() {
1352
- var useStyle = styleHookSingleton();
1353
- var Sheet = function(_a2) {
1354
- var styles = _a2.styles, dynamic = _a2.dynamic;
1355
- useStyle(styles, dynamic);
1356
- return null;
1357
- };
1358
- return Sheet;
1359
- };
1360
- var zeroGap = {
1361
- left: 0,
1362
- top: 0,
1363
- right: 0,
1364
- gap: 0
1365
- };
1366
- var parse = function(x) {
1367
- return parseInt(x || "", 10) || 0;
1368
- };
1369
- var getOffset = function(gapMode) {
1370
- var cs = window.getComputedStyle(document.body);
1371
- var left = cs[gapMode === "padding" ? "paddingLeft" : "marginLeft"];
1372
- var top = cs[gapMode === "padding" ? "paddingTop" : "marginTop"];
1373
- var right = cs[gapMode === "padding" ? "paddingRight" : "marginRight"];
1374
- return [parse(left), parse(top), parse(right)];
1375
- };
1376
- var getGapWidth = function(gapMode) {
1377
- if (gapMode === void 0) {
1378
- gapMode = "margin";
1379
- }
1380
- if (typeof window === "undefined") {
1381
- return zeroGap;
1382
- }
1383
- var offsets = getOffset(gapMode);
1384
- var documentWidth = document.documentElement.clientWidth;
1385
- var windowWidth = window.innerWidth;
1386
- return {
1387
- left: offsets[0],
1388
- top: offsets[1],
1389
- right: offsets[2],
1390
- gap: Math.max(0, windowWidth - documentWidth + offsets[2] - offsets[0])
1391
- };
1392
- };
1393
- var Style = styleSingleton();
1394
- var lockAttribute = "data-scroll-locked";
1395
- var getStyles = function(_a2, allowRelative, gapMode, important) {
1396
- var left = _a2.left, top = _a2.top, right = _a2.right, gap = _a2.gap;
1397
- if (gapMode === void 0) {
1398
- gapMode = "margin";
1399
- }
1400
- return "\n .".concat(noScrollbarsClassName, " {\n overflow: hidden ").concat(important, ";\n padding-right: ").concat(gap, "px ").concat(important, ";\n }\n body[").concat(lockAttribute, "] {\n overflow: hidden ").concat(important, ";\n overscroll-behavior: contain;\n ").concat([
1401
- allowRelative && "position: relative ".concat(important, ";"),
1402
- gapMode === "margin" && "\n padding-left: ".concat(left, "px;\n padding-top: ").concat(top, "px;\n padding-right: ").concat(right, "px;\n margin-left:0;\n margin-top:0;\n margin-right: ").concat(gap, "px ").concat(important, ";\n "),
1403
- gapMode === "padding" && "padding-right: ".concat(gap, "px ").concat(important, ";")
1404
- ].filter(Boolean).join(""), "\n }\n \n .").concat(zeroRightClassName, " {\n right: ").concat(gap, "px ").concat(important, ";\n }\n \n .").concat(fullWidthClassName, " {\n margin-right: ").concat(gap, "px ").concat(important, ";\n }\n \n .").concat(zeroRightClassName, " .").concat(zeroRightClassName, " {\n right: 0 ").concat(important, ";\n }\n \n .").concat(fullWidthClassName, " .").concat(fullWidthClassName, " {\n margin-right: 0 ").concat(important, ";\n }\n \n body[").concat(lockAttribute, "] {\n ").concat(removedBarSizeVariable, ": ").concat(gap, "px;\n }\n");
1405
- };
1406
- var getCurrentUseCounter = function() {
1407
- var counter = parseInt(document.body.getAttribute(lockAttribute) || "0", 10);
1408
- return isFinite(counter) ? counter : 0;
1409
- };
1410
- var useLockAttribute = function() {
1411
- React__namespace.useEffect(function() {
1412
- document.body.setAttribute(lockAttribute, (getCurrentUseCounter() + 1).toString());
1413
- return function() {
1414
- var newCounter = getCurrentUseCounter() - 1;
1415
- if (newCounter <= 0) {
1416
- document.body.removeAttribute(lockAttribute);
1417
- } else {
1418
- document.body.setAttribute(lockAttribute, newCounter.toString());
1419
- }
1420
- };
1421
- }, []);
1422
- };
1423
- var RemoveScrollBar = function(_a2) {
1424
- var noRelative = _a2.noRelative, noImportant = _a2.noImportant, _b = _a2.gapMode, gapMode = _b === void 0 ? "margin" : _b;
1425
- useLockAttribute();
1426
- var gap = React__namespace.useMemo(function() {
1427
- return getGapWidth(gapMode);
1428
- }, [gapMode]);
1429
- return React__namespace.createElement(Style, { styles: getStyles(gap, !noRelative, gapMode, !noImportant ? "!important" : "") });
1430
- };
1431
- var passiveSupported = false;
1432
- if (typeof window !== "undefined") {
1433
- try {
1434
- var options = Object.defineProperty({}, "passive", {
1435
- get: function() {
1436
- passiveSupported = true;
1437
- return true;
1438
- }
1439
- });
1440
- window.addEventListener("test", options, options);
1441
- window.removeEventListener("test", options, options);
1442
- } catch (err) {
1443
- passiveSupported = false;
1444
- }
1445
- }
1446
- var nonPassive = passiveSupported ? { passive: false } : false;
1447
- var alwaysContainsScroll = function(node) {
1448
- return node.tagName === "TEXTAREA";
1449
- };
1450
- var elementCanBeScrolled = function(node, overflow) {
1451
- if (!(node instanceof Element)) {
1452
- return false;
1453
- }
1454
- var styles = window.getComputedStyle(node);
1455
- return (
1456
- // not-not-scrollable
1457
- styles[overflow] !== "hidden" && // contains scroll inside self
1458
- !(styles.overflowY === styles.overflowX && !alwaysContainsScroll(node) && styles[overflow] === "visible")
1459
- );
1460
- };
1461
- var elementCouldBeVScrolled = function(node) {
1462
- return elementCanBeScrolled(node, "overflowY");
1463
- };
1464
- var elementCouldBeHScrolled = function(node) {
1465
- return elementCanBeScrolled(node, "overflowX");
1466
- };
1467
- var locationCouldBeScrolled = function(axis, node) {
1468
- var ownerDocument = node.ownerDocument;
1469
- var current = node;
1470
- do {
1471
- if (typeof ShadowRoot !== "undefined" && current instanceof ShadowRoot) {
1472
- current = current.host;
1473
- }
1474
- var isScrollable = elementCouldBeScrolled(axis, current);
1475
- if (isScrollable) {
1476
- var _a2 = getScrollVariables(axis, current), scrollHeight = _a2[1], clientHeight = _a2[2];
1477
- if (scrollHeight > clientHeight) {
1478
- return true;
1479
- }
1480
- }
1481
- current = current.parentNode;
1482
- } while (current && current !== ownerDocument.body);
1483
- return false;
1484
- };
1485
- var getVScrollVariables = function(_a2) {
1486
- var scrollTop = _a2.scrollTop, scrollHeight = _a2.scrollHeight, clientHeight = _a2.clientHeight;
1487
- return [
1488
- scrollTop,
1489
- scrollHeight,
1490
- clientHeight
1491
- ];
1492
- };
1493
- var getHScrollVariables = function(_a2) {
1494
- var scrollLeft = _a2.scrollLeft, scrollWidth = _a2.scrollWidth, clientWidth = _a2.clientWidth;
1495
- return [
1496
- scrollLeft,
1497
- scrollWidth,
1498
- clientWidth
1499
- ];
1500
- };
1501
- var elementCouldBeScrolled = function(axis, node) {
1502
- return axis === "v" ? elementCouldBeVScrolled(node) : elementCouldBeHScrolled(node);
1503
- };
1504
- var getScrollVariables = function(axis, node) {
1505
- return axis === "v" ? getVScrollVariables(node) : getHScrollVariables(node);
1506
- };
1507
- var getDirectionFactor = function(axis, direction) {
1508
- return axis === "h" && direction === "rtl" ? -1 : 1;
1509
- };
1510
- var handleScroll = function(axis, endTarget, event, sourceDelta, noOverscroll) {
1511
- var directionFactor = getDirectionFactor(axis, window.getComputedStyle(endTarget).direction);
1512
- var delta = directionFactor * sourceDelta;
1513
- var target = event.target;
1514
- var targetInLock = endTarget.contains(target);
1515
- var shouldCancelScroll = false;
1516
- var isDeltaPositive = delta > 0;
1517
- var availableScroll = 0;
1518
- var availableScrollTop = 0;
1519
- do {
1520
- var _a2 = getScrollVariables(axis, target), position = _a2[0], scroll_1 = _a2[1], capacity = _a2[2];
1521
- var elementScroll = scroll_1 - capacity - directionFactor * position;
1522
- if (position || elementScroll) {
1523
- if (elementCouldBeScrolled(axis, target)) {
1524
- availableScroll += elementScroll;
1525
- availableScrollTop += position;
1526
- }
1527
- }
1528
- if (target instanceof ShadowRoot) {
1529
- target = target.host;
1530
- } else {
1531
- target = target.parentNode;
1532
- }
1533
- } while (
1534
- // portaled content
1535
- !targetInLock && target !== document.body || // self content
1536
- targetInLock && (endTarget.contains(target) || endTarget === target)
1537
- );
1538
- if (isDeltaPositive && (Math.abs(availableScroll) < 1 || false)) {
1539
- shouldCancelScroll = true;
1540
- } else if (!isDeltaPositive && (Math.abs(availableScrollTop) < 1 || false)) {
1541
- shouldCancelScroll = true;
1542
- }
1543
- return shouldCancelScroll;
1544
- };
1545
- var getTouchXY = function(event) {
1546
- return "changedTouches" in event ? [event.changedTouches[0].clientX, event.changedTouches[0].clientY] : [0, 0];
1547
- };
1548
- var getDeltaXY = function(event) {
1549
- return [event.deltaX, event.deltaY];
1550
- };
1551
- var extractRef = function(ref) {
1552
- return ref && "current" in ref ? ref.current : ref;
1553
- };
1554
- var deltaCompare = function(x, y) {
1555
- return x[0] === y[0] && x[1] === y[1];
1556
- };
1557
- var generateStyle = function(id) {
1558
- return "\n .block-interactivity-".concat(id, " {pointer-events: none;}\n .allow-interactivity-").concat(id, " {pointer-events: all;}\n");
1559
- };
1560
- var idCounter = 0;
1561
- var lockStack = [];
1562
- function RemoveScrollSideCar(props) {
1563
- var shouldPreventQueue = React__namespace.useRef([]);
1564
- var touchStartRef = React__namespace.useRef([0, 0]);
1565
- var activeAxis = React__namespace.useRef();
1566
- var id = React__namespace.useState(idCounter++)[0];
1567
- var Style2 = React__namespace.useState(styleSingleton)[0];
1568
- var lastProps = React__namespace.useRef(props);
1569
- React__namespace.useEffect(function() {
1570
- lastProps.current = props;
1571
- }, [props]);
1572
- React__namespace.useEffect(function() {
1573
- if (props.inert) {
1574
- document.body.classList.add("block-interactivity-".concat(id));
1575
- var allow_1 = __spreadArray([props.lockRef.current], (props.shards || []).map(extractRef), true).filter(Boolean);
1576
- allow_1.forEach(function(el) {
1577
- return el.classList.add("allow-interactivity-".concat(id));
1578
- });
1579
- return function() {
1580
- document.body.classList.remove("block-interactivity-".concat(id));
1581
- allow_1.forEach(function(el) {
1582
- return el.classList.remove("allow-interactivity-".concat(id));
1583
- });
1584
- };
1585
- }
1586
- return;
1587
- }, [props.inert, props.lockRef.current, props.shards]);
1588
- var shouldCancelEvent = React__namespace.useCallback(function(event, parent) {
1589
- if ("touches" in event && event.touches.length === 2 || event.type === "wheel" && event.ctrlKey) {
1590
- return !lastProps.current.allowPinchZoom;
1591
- }
1592
- var touch = getTouchXY(event);
1593
- var touchStart = touchStartRef.current;
1594
- var deltaX = "deltaX" in event ? event.deltaX : touchStart[0] - touch[0];
1595
- var deltaY = "deltaY" in event ? event.deltaY : touchStart[1] - touch[1];
1596
- var currentAxis;
1597
- var target = event.target;
1598
- var moveDirection = Math.abs(deltaX) > Math.abs(deltaY) ? "h" : "v";
1599
- if ("touches" in event && moveDirection === "h" && target.type === "range") {
1600
- return false;
1601
- }
1602
- var canBeScrolledInMainDirection = locationCouldBeScrolled(moveDirection, target);
1603
- if (!canBeScrolledInMainDirection) {
1604
- return true;
1605
- }
1606
- if (canBeScrolledInMainDirection) {
1607
- currentAxis = moveDirection;
1608
- } else {
1609
- currentAxis = moveDirection === "v" ? "h" : "v";
1610
- canBeScrolledInMainDirection = locationCouldBeScrolled(moveDirection, target);
1611
- }
1612
- if (!canBeScrolledInMainDirection) {
1613
- return false;
1614
- }
1615
- if (!activeAxis.current && "changedTouches" in event && (deltaX || deltaY)) {
1616
- activeAxis.current = currentAxis;
1617
- }
1618
- if (!currentAxis) {
1619
- return true;
1620
- }
1621
- var cancelingAxis = activeAxis.current || currentAxis;
1622
- return handleScroll(cancelingAxis, parent, event, cancelingAxis === "h" ? deltaX : deltaY);
1623
- }, []);
1624
- var shouldPrevent = React__namespace.useCallback(function(_event) {
1625
- var event = _event;
1626
- if (!lockStack.length || lockStack[lockStack.length - 1] !== Style2) {
1627
- return;
1628
- }
1629
- var delta = "deltaY" in event ? getDeltaXY(event) : getTouchXY(event);
1630
- var sourceEvent = shouldPreventQueue.current.filter(function(e) {
1631
- return e.name === event.type && (e.target === event.target || event.target === e.shadowParent) && deltaCompare(e.delta, delta);
1632
- })[0];
1633
- if (sourceEvent && sourceEvent.should) {
1634
- if (event.cancelable) {
1635
- event.preventDefault();
1636
- }
1637
- return;
1638
- }
1639
- if (!sourceEvent) {
1640
- var shardNodes = (lastProps.current.shards || []).map(extractRef).filter(Boolean).filter(function(node) {
1641
- return node.contains(event.target);
1642
- });
1643
- var shouldStop = shardNodes.length > 0 ? shouldCancelEvent(event, shardNodes[0]) : !lastProps.current.noIsolation;
1644
- if (shouldStop) {
1645
- if (event.cancelable) {
1646
- event.preventDefault();
1647
- }
1648
- }
1649
- }
1650
- }, []);
1651
- var shouldCancel = React__namespace.useCallback(function(name, delta, target, should) {
1652
- var event = { name, delta, target, should, shadowParent: getOutermostShadowParent(target) };
1653
- shouldPreventQueue.current.push(event);
1654
- setTimeout(function() {
1655
- shouldPreventQueue.current = shouldPreventQueue.current.filter(function(e) {
1656
- return e !== event;
1657
- });
1658
- }, 1);
1659
- }, []);
1660
- var scrollTouchStart = React__namespace.useCallback(function(event) {
1661
- touchStartRef.current = getTouchXY(event);
1662
- activeAxis.current = void 0;
1663
- }, []);
1664
- var scrollWheel = React__namespace.useCallback(function(event) {
1665
- shouldCancel(event.type, getDeltaXY(event), event.target, shouldCancelEvent(event, props.lockRef.current));
1666
- }, []);
1667
- var scrollTouchMove = React__namespace.useCallback(function(event) {
1668
- shouldCancel(event.type, getTouchXY(event), event.target, shouldCancelEvent(event, props.lockRef.current));
1669
- }, []);
1670
- React__namespace.useEffect(function() {
1671
- lockStack.push(Style2);
1672
- props.setCallbacks({
1673
- onScrollCapture: scrollWheel,
1674
- onWheelCapture: scrollWheel,
1675
- onTouchMoveCapture: scrollTouchMove
1676
- });
1677
- document.addEventListener("wheel", shouldPrevent, nonPassive);
1678
- document.addEventListener("touchmove", shouldPrevent, nonPassive);
1679
- document.addEventListener("touchstart", scrollTouchStart, nonPassive);
1680
- return function() {
1681
- lockStack = lockStack.filter(function(inst) {
1682
- return inst !== Style2;
1683
- });
1684
- document.removeEventListener("wheel", shouldPrevent, nonPassive);
1685
- document.removeEventListener("touchmove", shouldPrevent, nonPassive);
1686
- document.removeEventListener("touchstart", scrollTouchStart, nonPassive);
1687
- };
1688
- }, []);
1689
- var removeScrollBar = props.removeScrollBar, inert = props.inert;
1690
- return React__namespace.createElement(
1691
- React__namespace.Fragment,
1692
- null,
1693
- inert ? React__namespace.createElement(Style2, { styles: generateStyle(id) }) : null,
1694
- removeScrollBar ? React__namespace.createElement(RemoveScrollBar, { gapMode: props.gapMode }) : null
1695
- );
1696
- }
1697
- function getOutermostShadowParent(node) {
1698
- var shadowParent = null;
1699
- while (node !== null) {
1700
- if (node instanceof ShadowRoot) {
1701
- shadowParent = node.host;
1702
- node = node.host;
1703
- }
1704
- node = node.parentNode;
1705
- }
1706
- return shadowParent;
1707
- }
1708
- const SideCar = exportSidecar(effectCar, RemoveScrollSideCar);
1709
- var ReactRemoveScroll = React__namespace.forwardRef(function(props, ref) {
1710
- return React__namespace.createElement(RemoveScroll, __assign({}, props, { ref, sideCar: SideCar }));
1711
- });
1712
- ReactRemoveScroll.classNames = RemoveScroll.classNames;
1713
- var getDefaultParent = function(originalTarget) {
1714
- if (typeof document === "undefined") {
1715
- return null;
1716
- }
1717
- var sampleTarget = Array.isArray(originalTarget) ? originalTarget[0] : originalTarget;
1718
- return sampleTarget.ownerDocument.body;
1719
- };
1720
- var counterMap = /* @__PURE__ */ new WeakMap();
1721
- var uncontrolledNodes = /* @__PURE__ */ new WeakMap();
1722
- var markerMap = {};
1723
- var lockCount = 0;
1724
- var unwrapHost = function(node) {
1725
- return node && (node.host || unwrapHost(node.parentNode));
1726
- };
1727
- var correctTargets = function(parent, targets) {
1728
- return targets.map(function(target) {
1729
- if (parent.contains(target)) {
1730
- return target;
1731
- }
1732
- var correctedTarget = unwrapHost(target);
1733
- if (correctedTarget && parent.contains(correctedTarget)) {
1734
- return correctedTarget;
1735
- }
1736
- console.error("aria-hidden", target, "in not contained inside", parent, ". Doing nothing");
1737
- return null;
1738
- }).filter(function(x) {
1739
- return Boolean(x);
1740
- });
1741
- };
1742
- var applyAttributeToOthers = function(originalTarget, parentNode, markerName, controlAttribute) {
1743
- var targets = correctTargets(parentNode, Array.isArray(originalTarget) ? originalTarget : [originalTarget]);
1744
- if (!markerMap[markerName]) {
1745
- markerMap[markerName] = /* @__PURE__ */ new WeakMap();
1746
- }
1747
- var markerCounter = markerMap[markerName];
1748
- var hiddenNodes = [];
1749
- var elementsToKeep = /* @__PURE__ */ new Set();
1750
- var elementsToStop = new Set(targets);
1751
- var keep = function(el) {
1752
- if (!el || elementsToKeep.has(el)) {
1753
- return;
1754
- }
1755
- elementsToKeep.add(el);
1756
- keep(el.parentNode);
1757
- };
1758
- targets.forEach(keep);
1759
- var deep = function(parent) {
1760
- if (!parent || elementsToStop.has(parent)) {
1761
- return;
1762
- }
1763
- Array.prototype.forEach.call(parent.children, function(node) {
1764
- if (elementsToKeep.has(node)) {
1765
- deep(node);
1766
- } else {
1767
- try {
1768
- var attr = node.getAttribute(controlAttribute);
1769
- var alreadyHidden = attr !== null && attr !== "false";
1770
- var counterValue = (counterMap.get(node) || 0) + 1;
1771
- var markerValue = (markerCounter.get(node) || 0) + 1;
1772
- counterMap.set(node, counterValue);
1773
- markerCounter.set(node, markerValue);
1774
- hiddenNodes.push(node);
1775
- if (counterValue === 1 && alreadyHidden) {
1776
- uncontrolledNodes.set(node, true);
1777
- }
1778
- if (markerValue === 1) {
1779
- node.setAttribute(markerName, "true");
1780
- }
1781
- if (!alreadyHidden) {
1782
- node.setAttribute(controlAttribute, "true");
1783
- }
1784
- } catch (e) {
1785
- console.error("aria-hidden: cannot operate on ", node, e);
1786
- }
1787
- }
1788
- });
1789
- };
1790
- deep(parentNode);
1791
- elementsToKeep.clear();
1792
- lockCount++;
1793
- return function() {
1794
- hiddenNodes.forEach(function(node) {
1795
- var counterValue = counterMap.get(node) - 1;
1796
- var markerValue = markerCounter.get(node) - 1;
1797
- counterMap.set(node, counterValue);
1798
- markerCounter.set(node, markerValue);
1799
- if (!counterValue) {
1800
- if (!uncontrolledNodes.has(node)) {
1801
- node.removeAttribute(controlAttribute);
1802
- }
1803
- uncontrolledNodes.delete(node);
1804
- }
1805
- if (!markerValue) {
1806
- node.removeAttribute(markerName);
1807
- }
1808
- });
1809
- lockCount--;
1810
- if (!lockCount) {
1811
- counterMap = /* @__PURE__ */ new WeakMap();
1812
- counterMap = /* @__PURE__ */ new WeakMap();
1813
- uncontrolledNodes = /* @__PURE__ */ new WeakMap();
1814
- markerMap = {};
1815
- }
1816
- };
1817
- };
1818
- var hideOthers = function(originalTarget, parentNode, markerName) {
1819
- if (markerName === void 0) {
1820
- markerName = "data-aria-hidden";
1821
- }
1822
- var targets = Array.from(Array.isArray(originalTarget) ? originalTarget : [originalTarget]);
1823
- var activeParentNode = getDefaultParent(originalTarget);
1824
- if (!activeParentNode) {
1825
- return function() {
1826
- return null;
1827
- };
1828
- }
1829
- targets.push.apply(targets, Array.from(activeParentNode.querySelectorAll("[aria-live]")));
1830
- return applyAttributeToOthers(targets, activeParentNode, markerName, "aria-hidden");
1831
- };
1832
- var DIALOG_NAME = "Dialog";
1833
- var [createDialogContext, createDialogScope] = createContextScope(DIALOG_NAME);
1834
- var [DialogProvider, useDialogContext] = createDialogContext(DIALOG_NAME);
1835
- var Dialog = (props) => {
1836
- const {
1837
- __scopeDialog,
1838
- children,
1839
- open: openProp,
1840
- defaultOpen,
1841
- onOpenChange,
1842
- modal = true
1843
- } = props;
1844
- const triggerRef = React__namespace.useRef(null);
1845
- const contentRef = React__namespace.useRef(null);
1846
- const [open, setOpen] = useControllableState({
1847
- prop: openProp,
1848
- defaultProp: defaultOpen ?? false,
1849
- onChange: onOpenChange,
1850
- caller: DIALOG_NAME
1851
- });
1852
- return /* @__PURE__ */ jsxRuntime.jsx(
1853
- DialogProvider,
1854
- {
1855
- scope: __scopeDialog,
1856
- triggerRef,
1857
- contentRef,
1858
- contentId: useId(),
1859
- titleId: useId(),
1860
- descriptionId: useId(),
1861
- open,
1862
- onOpenChange: setOpen,
1863
- onOpenToggle: React__namespace.useCallback(() => setOpen((prevOpen) => !prevOpen), [setOpen]),
1864
- modal,
1865
- children
1866
- }
1867
- );
1868
- };
1869
- Dialog.displayName = DIALOG_NAME;
1870
- var TRIGGER_NAME = "DialogTrigger";
1871
- var DialogTrigger = React__namespace.forwardRef(
1872
- (props, forwardedRef) => {
1873
- const { __scopeDialog, ...triggerProps } = props;
1874
- const context = useDialogContext(TRIGGER_NAME, __scopeDialog);
1875
- const composedTriggerRef = useComposedRefs(forwardedRef, context.triggerRef);
1876
- return /* @__PURE__ */ jsxRuntime.jsx(
1877
- Primitive.button,
1878
- {
1879
- type: "button",
1880
- "aria-haspopup": "dialog",
1881
- "aria-expanded": context.open,
1882
- "aria-controls": context.contentId,
1883
- "data-state": getState(context.open),
1884
- ...triggerProps,
1885
- ref: composedTriggerRef,
1886
- onClick: composeEventHandlers(props.onClick, context.onOpenToggle)
1887
- }
1888
- );
1889
- }
1890
- );
1891
- DialogTrigger.displayName = TRIGGER_NAME;
1892
- var PORTAL_NAME = "DialogPortal";
1893
- var [PortalProvider, usePortalContext] = createDialogContext(PORTAL_NAME, {
1894
- forceMount: void 0
1895
- });
1896
- var DialogPortal = (props) => {
1897
- const { __scopeDialog, forceMount, children, container } = props;
1898
- const context = useDialogContext(PORTAL_NAME, __scopeDialog);
1899
- return /* @__PURE__ */ jsxRuntime.jsx(PortalProvider, { scope: __scopeDialog, forceMount, children: React__namespace.Children.map(children, (child) => /* @__PURE__ */ jsxRuntime.jsx(Presence, { present: forceMount || context.open, children: /* @__PURE__ */ jsxRuntime.jsx(Portal$1, { asChild: true, container, children: child }) })) });
1900
- };
1901
- DialogPortal.displayName = PORTAL_NAME;
1902
- var OVERLAY_NAME = "DialogOverlay";
1903
- var DialogOverlay = React__namespace.forwardRef(
1904
- (props, forwardedRef) => {
1905
- const portalContext = usePortalContext(OVERLAY_NAME, props.__scopeDialog);
1906
- const { forceMount = portalContext.forceMount, ...overlayProps } = props;
1907
- const context = useDialogContext(OVERLAY_NAME, props.__scopeDialog);
1908
- return context.modal ? /* @__PURE__ */ jsxRuntime.jsx(Presence, { present: forceMount || context.open, children: /* @__PURE__ */ jsxRuntime.jsx(DialogOverlayImpl, { ...overlayProps, ref: forwardedRef }) }) : null;
1909
- }
1910
- );
1911
- DialogOverlay.displayName = OVERLAY_NAME;
1912
- var Slot = /* @__PURE__ */ createSlot("DialogOverlay.RemoveScroll");
1913
- var DialogOverlayImpl = React__namespace.forwardRef(
1914
- (props, forwardedRef) => {
1915
- const { __scopeDialog, ...overlayProps } = props;
1916
- const context = useDialogContext(OVERLAY_NAME, __scopeDialog);
1917
- return (
1918
- // Make sure `Content` is scrollable even when it doesn't live inside `RemoveScroll`
1919
- // ie. when `Overlay` and `Content` are siblings
1920
- /* @__PURE__ */ jsxRuntime.jsx(ReactRemoveScroll, { as: Slot, allowPinchZoom: true, shards: [context.contentRef], children: /* @__PURE__ */ jsxRuntime.jsx(
1921
- Primitive.div,
1922
- {
1923
- "data-state": getState(context.open),
1924
- ...overlayProps,
1925
- ref: forwardedRef,
1926
- style: { pointerEvents: "auto", ...overlayProps.style }
1927
- }
1928
- ) })
1929
- );
1930
- }
1931
- );
1932
- var CONTENT_NAME = "DialogContent";
1933
- var DialogContent = React__namespace.forwardRef(
1934
- (props, forwardedRef) => {
1935
- const portalContext = usePortalContext(CONTENT_NAME, props.__scopeDialog);
1936
- const { forceMount = portalContext.forceMount, ...contentProps } = props;
1937
- const context = useDialogContext(CONTENT_NAME, props.__scopeDialog);
1938
- return /* @__PURE__ */ jsxRuntime.jsx(Presence, { present: forceMount || context.open, children: context.modal ? /* @__PURE__ */ jsxRuntime.jsx(DialogContentModal, { ...contentProps, ref: forwardedRef }) : /* @__PURE__ */ jsxRuntime.jsx(DialogContentNonModal, { ...contentProps, ref: forwardedRef }) });
1939
- }
1940
- );
1941
- DialogContent.displayName = CONTENT_NAME;
1942
- var DialogContentModal = React__namespace.forwardRef(
1943
- (props, forwardedRef) => {
1944
- const context = useDialogContext(CONTENT_NAME, props.__scopeDialog);
1945
- const contentRef = React__namespace.useRef(null);
1946
- const composedRefs = useComposedRefs(forwardedRef, context.contentRef, contentRef);
1947
- React__namespace.useEffect(() => {
1948
- const content = contentRef.current;
1949
- if (content) return hideOthers(content);
1950
- }, []);
1951
- return /* @__PURE__ */ jsxRuntime.jsx(
1952
- DialogContentImpl,
1953
- {
1954
- ...props,
1955
- ref: composedRefs,
1956
- trapFocus: context.open,
1957
- disableOutsidePointerEvents: true,
1958
- onCloseAutoFocus: composeEventHandlers(props.onCloseAutoFocus, (event) => {
1959
- var _a2;
1960
- event.preventDefault();
1961
- (_a2 = context.triggerRef.current) == null ? void 0 : _a2.focus();
1962
- }),
1963
- onPointerDownOutside: composeEventHandlers(props.onPointerDownOutside, (event) => {
1964
- const originalEvent = event.detail.originalEvent;
1965
- const ctrlLeftClick = originalEvent.button === 0 && originalEvent.ctrlKey === true;
1966
- const isRightClick = originalEvent.button === 2 || ctrlLeftClick;
1967
- if (isRightClick) event.preventDefault();
1968
- }),
1969
- onFocusOutside: composeEventHandlers(
1970
- props.onFocusOutside,
1971
- (event) => event.preventDefault()
1972
- )
1973
- }
1974
- );
1975
- }
1976
- );
1977
- var DialogContentNonModal = React__namespace.forwardRef(
1978
- (props, forwardedRef) => {
1979
- const context = useDialogContext(CONTENT_NAME, props.__scopeDialog);
1980
- const hasInteractedOutsideRef = React__namespace.useRef(false);
1981
- const hasPointerDownOutsideRef = React__namespace.useRef(false);
1982
- return /* @__PURE__ */ jsxRuntime.jsx(
1983
- DialogContentImpl,
1984
- {
1985
- ...props,
1986
- ref: forwardedRef,
1987
- trapFocus: false,
1988
- disableOutsidePointerEvents: false,
1989
- onCloseAutoFocus: (event) => {
1990
- var _a2, _b;
1991
- (_a2 = props.onCloseAutoFocus) == null ? void 0 : _a2.call(props, event);
1992
- if (!event.defaultPrevented) {
1993
- if (!hasInteractedOutsideRef.current) (_b = context.triggerRef.current) == null ? void 0 : _b.focus();
1994
- event.preventDefault();
1995
- }
1996
- hasInteractedOutsideRef.current = false;
1997
- hasPointerDownOutsideRef.current = false;
1998
- },
1999
- onInteractOutside: (event) => {
2000
- var _a2, _b;
2001
- (_a2 = props.onInteractOutside) == null ? void 0 : _a2.call(props, event);
2002
- if (!event.defaultPrevented) {
2003
- hasInteractedOutsideRef.current = true;
2004
- if (event.detail.originalEvent.type === "pointerdown") {
2005
- hasPointerDownOutsideRef.current = true;
2006
- }
2007
- }
2008
- const target = event.target;
2009
- const targetIsTrigger = (_b = context.triggerRef.current) == null ? void 0 : _b.contains(target);
2010
- if (targetIsTrigger) event.preventDefault();
2011
- if (event.detail.originalEvent.type === "focusin" && hasPointerDownOutsideRef.current) {
2012
- event.preventDefault();
2013
- }
2014
- }
2015
- }
2016
- );
2017
- }
2018
- );
2019
- var DialogContentImpl = React__namespace.forwardRef(
2020
- (props, forwardedRef) => {
2021
- const { __scopeDialog, trapFocus, onOpenAutoFocus, onCloseAutoFocus, ...contentProps } = props;
2022
- const context = useDialogContext(CONTENT_NAME, __scopeDialog);
2023
- const contentRef = React__namespace.useRef(null);
2024
- const composedRefs = useComposedRefs(forwardedRef, contentRef);
2025
- useFocusGuards();
2026
- return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
2027
- /* @__PURE__ */ jsxRuntime.jsx(
2028
- FocusScope,
2029
- {
2030
- asChild: true,
2031
- loop: true,
2032
- trapped: trapFocus,
2033
- onMountAutoFocus: onOpenAutoFocus,
2034
- onUnmountAutoFocus: onCloseAutoFocus,
2035
- children: /* @__PURE__ */ jsxRuntime.jsx(
2036
- DismissableLayer,
2037
- {
2038
- role: "dialog",
2039
- id: context.contentId,
2040
- "aria-describedby": context.descriptionId,
2041
- "aria-labelledby": context.titleId,
2042
- "data-state": getState(context.open),
2043
- ...contentProps,
2044
- ref: composedRefs,
2045
- onDismiss: () => context.onOpenChange(false)
2046
- }
2047
- )
2048
- }
2049
- ),
2050
- /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
2051
- /* @__PURE__ */ jsxRuntime.jsx(TitleWarning, { titleId: context.titleId }),
2052
- /* @__PURE__ */ jsxRuntime.jsx(DescriptionWarning, { contentRef, descriptionId: context.descriptionId })
2053
- ] })
2054
- ] });
2055
- }
2056
- );
2057
- var TITLE_NAME = "DialogTitle";
2058
- var DialogTitle = React__namespace.forwardRef(
2059
- (props, forwardedRef) => {
2060
- const { __scopeDialog, ...titleProps } = props;
2061
- const context = useDialogContext(TITLE_NAME, __scopeDialog);
2062
- return /* @__PURE__ */ jsxRuntime.jsx(Primitive.h2, { id: context.titleId, ...titleProps, ref: forwardedRef });
2063
- }
2064
- );
2065
- DialogTitle.displayName = TITLE_NAME;
2066
- var DESCRIPTION_NAME = "DialogDescription";
2067
- var DialogDescription = React__namespace.forwardRef(
2068
- (props, forwardedRef) => {
2069
- const { __scopeDialog, ...descriptionProps } = props;
2070
- const context = useDialogContext(DESCRIPTION_NAME, __scopeDialog);
2071
- return /* @__PURE__ */ jsxRuntime.jsx(Primitive.p, { id: context.descriptionId, ...descriptionProps, ref: forwardedRef });
2072
- }
2073
- );
2074
- DialogDescription.displayName = DESCRIPTION_NAME;
2075
- var CLOSE_NAME = "DialogClose";
2076
- var DialogClose = React__namespace.forwardRef(
2077
- (props, forwardedRef) => {
2078
- const { __scopeDialog, ...closeProps } = props;
2079
- const context = useDialogContext(CLOSE_NAME, __scopeDialog);
2080
- return /* @__PURE__ */ jsxRuntime.jsx(
2081
- Primitive.button,
2082
- {
2083
- type: "button",
2084
- ...closeProps,
2085
- ref: forwardedRef,
2086
- onClick: composeEventHandlers(props.onClick, () => context.onOpenChange(false))
2087
- }
2088
- );
2089
- }
2090
- );
2091
- DialogClose.displayName = CLOSE_NAME;
2092
- function getState(open) {
2093
- return open ? "open" : "closed";
2094
- }
2095
- var TITLE_WARNING_NAME = "DialogTitleWarning";
2096
- var [WarningProvider, useWarningContext] = createContext2(TITLE_WARNING_NAME, {
2097
- contentName: CONTENT_NAME,
2098
- titleName: TITLE_NAME,
2099
- docsSlug: "dialog"
2100
- });
2101
- var TitleWarning = ({ titleId }) => {
2102
- const titleWarningContext = useWarningContext(TITLE_WARNING_NAME);
2103
- const MESSAGE = `\`${titleWarningContext.contentName}\` requires a \`${titleWarningContext.titleName}\` for the component to be accessible for screen reader users.
2104
-
2105
- If you want to hide the \`${titleWarningContext.titleName}\`, you can wrap it with our VisuallyHidden component.
2106
-
2107
- For more information, see https://radix-ui.com/primitives/docs/components/${titleWarningContext.docsSlug}`;
2108
- React__namespace.useEffect(() => {
2109
- if (titleId) {
2110
- const hasTitle = document.getElementById(titleId);
2111
- if (!hasTitle) console.error(MESSAGE);
2112
- }
2113
- }, [MESSAGE, titleId]);
2114
- return null;
2115
- };
2116
- var DESCRIPTION_WARNING_NAME = "DialogDescriptionWarning";
2117
- var DescriptionWarning = ({ contentRef, descriptionId }) => {
2118
- const descriptionWarningContext = useWarningContext(DESCRIPTION_WARNING_NAME);
2119
- const MESSAGE = `Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${descriptionWarningContext.contentName}}.`;
2120
- React__namespace.useEffect(() => {
2121
- var _a2;
2122
- const describedById = (_a2 = contentRef.current) == null ? void 0 : _a2.getAttribute("aria-describedby");
2123
- if (descriptionId && describedById) {
2124
- const hasDescription = document.getElementById(descriptionId);
2125
- if (!hasDescription) console.warn(MESSAGE);
2126
- }
2127
- }, [MESSAGE, contentRef, descriptionId]);
2128
- return null;
2129
- };
2130
- var Root = Dialog;
2131
- var Trigger = DialogTrigger;
2132
- var Portal = DialogPortal;
2133
- var Overlay = DialogOverlay;
2134
- var Content = DialogContent;
2135
- var Close = DialogClose;
2136
148
  const ImageViewer = React.memo((props) => {
2137
149
  const { file, onClose } = props;
2138
150
  const imageRef = React.useRef(null);
@@ -2151,52 +163,37 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
2151
163
  const handleDownload = React.useCallback(() => {
2152
164
  fileSaver.saveAs(file, file.name);
2153
165
  }, [file]);
2154
- return /* @__PURE__ */ jsxRuntime.jsx(Root, { open: true, onOpenChange: onClose, children: /* @__PURE__ */ jsxRuntime.jsx(Portal, { children: /* @__PURE__ */ jsxRuntime.jsx(
2155
- Overlay,
2156
- {
2157
- className: "bg-(--color-background) fixed inset-0 data-[state='open']:fade-in-0 data-[state='open']:zoom-in-95 data-[state='closed']:animate-out data-[state='closed']:fade-out-0 data-[state='closed']:zoom-out-95 data-[state='open']:animate-in",
2158
- "data-floating-content": "",
2159
- children: /* @__PURE__ */ jsxRuntime.jsxs(
2160
- Content,
2161
- {
2162
- className: "absolute inset-0 py-12",
2163
- "data-floating-content": "",
2164
- onOpenAutoFocus: (e) => e.preventDefault(),
2165
- children: [
2166
- /* @__PURE__ */ jsxRuntime.jsxs(
2167
- blocks.ButtonGroup,
2168
- {
2169
- className: "flex gap-2 items-center top-0 absolute right-0 p-2",
2170
- accentColor: "base",
2171
- variant: "ghost",
2172
- children: [
2173
- /* @__PURE__ */ jsxRuntime.jsxs(blocks.Tooltip.Root, { children: [
2174
- /* @__PURE__ */ jsxRuntime.jsx(blocks.Tooltip.Trigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(blocks.IconButton, { onClick: handleCopy, "aria-label": "copy to clipboard", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Copy, { className: "h-4 w-4" }) }) }),
2175
- /* @__PURE__ */ jsxRuntime.jsx(blocks.Tooltip.Content, { size: "sm", children: "Copy" })
2176
- ] }),
2177
- /* @__PURE__ */ jsxRuntime.jsxs(blocks.Tooltip.Root, { children: [
2178
- /* @__PURE__ */ jsxRuntime.jsx(blocks.Tooltip.Trigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(blocks.IconButton, { onClick: handleDownload, "aria-label": "download", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Download, { className: "h-4 w-4" }) }) }),
2179
- /* @__PURE__ */ jsxRuntime.jsx(blocks.Tooltip.Content, { size: "sm", children: "Download" })
2180
- ] }),
2181
- /* @__PURE__ */ jsxRuntime.jsx(blocks.Separator, { orientation: "vertical", size: "sm" }),
2182
- /* @__PURE__ */ jsxRuntime.jsx(Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(blocks.IconButton, { onClick: onClose, "aria-label": "close", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, { className: "h-4 w-4" }) }) })
2183
- ]
2184
- }
2185
- ),
2186
- /* @__PURE__ */ jsxRuntime.jsx("figure", { className: "size-full overflow-hidden p-4 flex justify-center items-center", children: /* @__PURE__ */ jsxRuntime.jsx(
2187
- "img",
2188
- {
2189
- ref: imageRef,
2190
- className: "max-w-full max-h-full",
2191
- src: URL.createObjectURL(file),
2192
- alt: file.name
2193
- }
2194
- ) })
2195
- ]
2196
- }
2197
- )
2198
- }
2199
- ) }) });
166
+ return /* @__PURE__ */ jsxRuntime.jsx(blocks.Overlay.Root, { open: true, onOpenChange: onClose, children: /* @__PURE__ */ jsxRuntime.jsxs(blocks.Overlay.Content, { onOpenAutoFocus: (e) => e.preventDefault(), children: [
167
+ /* @__PURE__ */ jsxRuntime.jsxs(
168
+ blocks.ButtonGroup,
169
+ {
170
+ className: "flex gap-2 items-center top-0 absolute right-0 p-2",
171
+ accentColor: "base",
172
+ variant: "ghost",
173
+ children: [
174
+ /* @__PURE__ */ jsxRuntime.jsxs(blocks.Tooltip.Root, { children: [
175
+ /* @__PURE__ */ jsxRuntime.jsx(blocks.Tooltip.Trigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(blocks.IconButton, { onClick: handleCopy, "aria-label": "copy to clipboard", children: /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: "copy" }) }) }),
176
+ /* @__PURE__ */ jsxRuntime.jsx(blocks.Tooltip.Content, { size: "sm", children: "Copy" })
177
+ ] }),
178
+ /* @__PURE__ */ jsxRuntime.jsxs(blocks.Tooltip.Root, { children: [
179
+ /* @__PURE__ */ jsxRuntime.jsx(blocks.Tooltip.Trigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(blocks.IconButton, { onClick: handleDownload, "aria-label": "download", children: /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: "download" }) }) }),
180
+ /* @__PURE__ */ jsxRuntime.jsx(blocks.Tooltip.Content, { size: "sm", children: "Download" })
181
+ ] }),
182
+ /* @__PURE__ */ jsxRuntime.jsx(blocks.Separator, { orientation: "vertical", size: "sm" }),
183
+ /* @__PURE__ */ jsxRuntime.jsx(blocks.Overlay.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(blocks.IconButton, { onClick: onClose, "aria-label": "close", children: /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: "x" }) }) })
184
+ ]
185
+ }
186
+ ),
187
+ /* @__PURE__ */ jsxRuntime.jsx("figure", { className: "size-full overflow-hidden p-4 flex justify-center items-center", children: /* @__PURE__ */ jsxRuntime.jsx(
188
+ "img",
189
+ {
190
+ ref: imageRef,
191
+ className: "max-w-full max-h-full",
192
+ src: URL.createObjectURL(file),
193
+ alt: file.name
194
+ }
195
+ ) })
196
+ ] }) });
2200
197
  });
2201
198
  ImageViewer.displayName = "ImageViewer";
2202
199
  const ImageViewerProvider = React.memo((props) => {
@@ -2216,8 +213,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
2216
213
  if (config.onClose) config.onClose();
2217
214
  closeFileViewer();
2218
215
  }, [closeFileViewer, config]);
2219
- const value = React.useMemo(() => openFileViewer, [openFileViewer]);
2220
- return /* @__PURE__ */ jsxRuntime.jsxs(ImageViewerContext.Provider, { value, children: [
216
+ return /* @__PURE__ */ jsxRuntime.jsxs(ImageViewerContext.Provider, { value: openFileViewer, children: [
2221
217
  children,
2222
218
  config && /* @__PURE__ */ jsxRuntime.jsx(ImageViewer, { file: config.file, onClose: handleClose })
2223
219
  ] });
@@ -2423,7 +419,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
2423
419
  "aria-label": "Add option",
2424
420
  disabled: !!internalError || disabled,
2425
421
  onClick: addOption,
2426
- children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Plus, {})
422
+ children: /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: "plus" })
2427
423
  }
2428
424
  )
2429
425
  ] })
@@ -2470,7 +466,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
2470
466
  onClick: () => {
2471
467
  handleDeleteOption(index);
2472
468
  },
2473
- children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, { className: "h-3 w-3" })
469
+ children: /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: "x" })
2474
470
  }
2475
471
  )
2476
472
  ]
@@ -2487,8 +483,8 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
2487
483
  });
2488
484
  MultiStringInput.displayName = "MultiStringInput";
2489
485
  const _MultiStringField = class _MultiStringField extends BaseField {
2490
- constructor(options2) {
2491
- const { minimum_length, maximum_length, placeholder, ...rest } = options2;
486
+ constructor(options) {
487
+ const { minimum_length, maximum_length, placeholder, ...rest } = options;
2492
488
  super(rest);
2493
489
  __publicField(this, "type", "multi-string");
2494
490
  __publicField(this, "minLength");
@@ -2524,8 +520,8 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
2524
520
  identifier
2525
521
  });
2526
522
  }
2527
- setOptions(options2) {
2528
- const { minimum_length, maximum_length, placeholder, ...rest } = options2;
523
+ setOptions(options) {
524
+ const { minimum_length, maximum_length, placeholder, ...rest } = options;
2529
525
  this.minLength = minimum_length ?? this.minLength;
2530
526
  this.maxLength = maximum_length ?? this.maxLength;
2531
527
  this.placeholder = placeholder ?? this.placeholder;
@@ -2571,8 +567,8 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
2571
567
  __publicField(_MultiStringField, "fieldTypeDescription", "Allows the user to provide multiple unique strings.");
2572
568
  let MultiStringField = _MultiStringField;
2573
569
  class BaseOptionsField extends BaseField {
2574
- constructor(options2) {
2575
- const { options: _options, ...base } = options2;
570
+ constructor(options) {
571
+ const { options: _options, ...base } = options;
2576
572
  super(base);
2577
573
  __publicField(this, "options");
2578
574
  __publicField(this, "onlyValidateAfterTouched", false);
@@ -2595,8 +591,8 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
2595
591
  options: this.options
2596
592
  };
2597
593
  }
2598
- setOptions(options2) {
2599
- const { options: _options, ...base } = options2;
594
+ setOptions(options) {
595
+ const { options: _options, ...base } = options;
2600
596
  this.options = (_options == null ? void 0 : _options.map((option) => {
2601
597
  if (typeof option === "string") {
2602
598
  option = { label: option, value: option };
@@ -2658,7 +654,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
2658
654
  accentColor: "primary",
2659
655
  variant: "surface",
2660
656
  ...rest,
2661
- children: /* @__PURE__ */ jsxRuntime.jsx(blocks.Checkbox.Indicator, { children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Check, { className: "h-4 w-4" }) })
657
+ children: /* @__PURE__ */ jsxRuntime.jsx(blocks.Checkbox.Indicator, { children: /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: "check" }) })
2662
658
  }
2663
659
  )
2664
660
  }
@@ -2666,8 +662,8 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
2666
662
  });
2667
663
  BooleanInput.displayName = "BooleanInput";
2668
664
  const _BooleanField = class _BooleanField extends BaseField {
2669
- constructor(options2) {
2670
- super(options2);
665
+ constructor(options) {
666
+ super(options);
2671
667
  __publicField(this, "type", "boolean");
2672
668
  __publicField(this, "onlyValidateAfterTouched", false);
2673
669
  }
@@ -2677,8 +673,8 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
2677
673
  getOptions() {
2678
674
  return super.getOptions();
2679
675
  }
2680
- setOptions(options2) {
2681
- super.setOptions(options2);
676
+ setOptions(options) {
677
+ super.setOptions(options);
2682
678
  }
2683
679
  duplicate(identifier) {
2684
680
  return new _BooleanField({
@@ -2772,14 +768,14 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
2772
768
  });
2773
769
  NumberInput.displayName = "NumberInput";
2774
770
  const _NumberField = class _NumberField extends BaseField {
2775
- constructor(options2) {
771
+ constructor(options) {
2776
772
  const {
2777
773
  minimum = Number.MIN_SAFE_INTEGER,
2778
774
  maximum = Number.MAX_SAFE_INTEGER,
2779
775
  integers = false,
2780
776
  placeholder,
2781
777
  ...rest
2782
- } = options2;
778
+ } = options;
2783
779
  super(rest);
2784
780
  __publicField(this, "type", "number");
2785
781
  __publicField(this, "minimum");
@@ -2878,8 +874,8 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
2878
874
  identifier
2879
875
  });
2880
876
  }
2881
- setOptions(options2) {
2882
- const { minimum, maximum, integers, placeholder, ...rest } = options2;
877
+ setOptions(options) {
878
+ const { minimum, maximum, integers, placeholder, ...rest } = options;
2883
879
  this.minimum = minimum ?? this.minimum;
2884
880
  this.maximum = maximum ?? this.maximum;
2885
881
  this.integers = integers ?? this.integers;
@@ -2916,8 +912,8 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
2916
912
  let NumberField = _NumberField;
2917
913
  const LONG_TEXT_FIELD_MAX_LENGTH = 1e4;
2918
914
  class BaseStringField extends BaseField {
2919
- constructor(options2) {
2920
- const { minLength, maxLength, placeholder = "", ...base } = options2;
915
+ constructor(options) {
916
+ const { minLength, maxLength, placeholder = "", ...base } = options;
2921
917
  super(base);
2922
918
  __publicField(this, "minLength");
2923
919
  __publicField(this, "maxLength");
@@ -2994,8 +990,8 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
2994
990
  placeholder: this.placeholder
2995
991
  };
2996
992
  }
2997
- setOptions(options2) {
2998
- const { minLength, maxLength, placeholder, ...base } = options2;
993
+ setOptions(options) {
994
+ const { minLength, maxLength, placeholder, ...base } = options;
2999
995
  this.minLength = minLength;
3000
996
  this.maxLength = maxLength ?? this.maxLength;
3001
997
  this.placeholder = placeholder;
@@ -3054,7 +1050,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
3054
1050
  onValuesChange: handleChange,
3055
1051
  ...rest,
3056
1052
  children: field.options.map((option, index) => /* @__PURE__ */ jsxRuntime.jsxs("label", { className: "flex gap-2 items-center min-w-0", children: [
3057
- /* @__PURE__ */ jsxRuntime.jsx(blocks.CheckboxGroup.Item, { value: option.value, children: /* @__PURE__ */ jsxRuntime.jsx(blocks.CheckboxGroup.ItemIndicator, { children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Check, { className: "h-4 w-4" }) }) }),
1053
+ /* @__PURE__ */ jsxRuntime.jsx(blocks.CheckboxGroup.Item, { value: option.value, children: /* @__PURE__ */ jsxRuntime.jsx(blocks.CheckboxGroup.ItemIndicator, { children: /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: "check" }) }) }),
3058
1054
  /* @__PURE__ */ jsxRuntime.jsx(blocks.Text, { size: "sm", accentColor: "base", className: "truncate", children: option.label })
3059
1055
  ] }, `${inputId}-${option.value}-${index}`))
3060
1056
  }
@@ -3064,8 +1060,8 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
3064
1060
  });
3065
1061
  CheckboxListInput.displayName = "CheckboxListInput";
3066
1062
  const _CheckboxListField = class _CheckboxListField extends BaseOptionsField {
3067
- constructor(options2) {
3068
- super(options2);
1063
+ constructor(options) {
1064
+ super(options);
3069
1065
  __publicField(this, "type", "checkbox-list");
3070
1066
  __publicField(this, "onlyValidateAfterTouched", false);
3071
1067
  }
@@ -3156,7 +1152,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
3156
1152
  month: "2-digit",
3157
1153
  day: "2-digit"
3158
1154
  }) : "yyyy-mm-dd",
3159
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronDown, { className: "h-4 w-4" })
1155
+ /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: "chevron-down" })
3160
1156
  ]
3161
1157
  }
3162
1158
  ) }),
@@ -3176,8 +1172,8 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
3176
1172
  });
3177
1173
  DateInput.displayName = "DateInput";
3178
1174
  const _DateField = class _DateField extends BaseField {
3179
- constructor(options2) {
3180
- super(options2);
1175
+ constructor(options) {
1176
+ super(options);
3181
1177
  __publicField(this, "type", "date");
3182
1178
  __publicField(this, "onlyValidateAfterTouched", false);
3183
1179
  }
@@ -3196,8 +1192,8 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
3196
1192
  static deserialize(data) {
3197
1193
  return new _DateField(data);
3198
1194
  }
3199
- setOptions(options2) {
3200
- super.setOptions(options2);
1195
+ setOptions(options) {
1196
+ super.setOptions(options);
3201
1197
  }
3202
1198
  serializeValue(value) {
3203
1199
  return value ? value.toISOString() : null;
@@ -3267,13 +1263,13 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
3267
1263
  ...rest,
3268
1264
  children: [
3269
1265
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate", children: value && value.length > 0 ? value.join(", ") : field.placeholder ?? "Select one or more..." }),
3270
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronDown, { className: "h-4 w-4" })
1266
+ /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: "chevron-down" })
3271
1267
  ]
3272
1268
  }
3273
1269
  ) }),
3274
1270
  /* @__PURE__ */ jsxRuntime.jsx(blocks.Menu.Content, { children: /* @__PURE__ */ jsxRuntime.jsx(blocks.Menu.Scroll, { children: /* @__PURE__ */ jsxRuntime.jsxs(blocks.Menu.MultiSelectGroup, { values: value, onValuesChange: handleChange, children: [
3275
1271
  /* @__PURE__ */ jsxRuntime.jsxs(blocks.Menu.SelectAllItem, { children: [
3276
- /* @__PURE__ */ jsxRuntime.jsx(blocks.Menu.CheckboxItemIndicator, { children: (indeterminate) => indeterminate ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Minus, { className: "h-4 w-4" }) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Check, { className: "h-4 w-4" }) }),
1272
+ /* @__PURE__ */ jsxRuntime.jsx(blocks.Menu.CheckboxItemIndicator, { children: (indeterminate) => indeterminate ? /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: "minus" }) : /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: "check" }) }),
3277
1273
  "Select all"
3278
1274
  ] }),
3279
1275
  field.options.map((option, index) => /* @__PURE__ */ jsxRuntime.jsxs(
@@ -3281,7 +1277,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
3281
1277
  {
3282
1278
  value: option.value,
3283
1279
  children: [
3284
- /* @__PURE__ */ jsxRuntime.jsx(blocks.Menu.SelectedIndicator, { children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Check, { className: "h-4 w-4" }) }),
1280
+ /* @__PURE__ */ jsxRuntime.jsx(blocks.Menu.SelectedIndicator, { children: /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: "check" }) }),
3285
1281
  option.label
3286
1282
  ]
3287
1283
  },
@@ -3294,8 +1290,8 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
3294
1290
  });
3295
1291
  MultiSelectInput.displayName = "MultiSelectInput";
3296
1292
  const _MultiSelectField = class _MultiSelectField extends BaseOptionsField {
3297
- constructor(options2) {
3298
- const { placeholder, ...base } = options2;
1293
+ constructor(options) {
1294
+ const { placeholder, ...base } = options;
3299
1295
  super(base);
3300
1296
  __publicField(this, "type", "multi-select");
3301
1297
  __publicField(this, "placeholder");
@@ -3316,10 +1312,10 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
3316
1312
  identifier
3317
1313
  });
3318
1314
  }
3319
- setOptions(options2) {
3320
- const { placeholder } = options2;
1315
+ setOptions(options) {
1316
+ const { placeholder } = options;
3321
1317
  this.placeholder = placeholder;
3322
- super.setOptions(options2);
1318
+ super.setOptions(options);
3323
1319
  }
3324
1320
  static deserialize(data) {
3325
1321
  return new _MultiSelectField(data);
@@ -3401,8 +1397,8 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
3401
1397
  });
3402
1398
  SelectInput.displayName = "SelectInput";
3403
1399
  const _SelectField = class _SelectField extends BaseOptionsField {
3404
- constructor(options2) {
3405
- const { placeholder, ...base } = options2;
1400
+ constructor(options) {
1401
+ const { placeholder, ...base } = options;
3406
1402
  super(base);
3407
1403
  __publicField(this, "type", "select");
3408
1404
  __publicField(this, "placeholder");
@@ -3423,10 +1419,10 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
3423
1419
  identifier
3424
1420
  });
3425
1421
  }
3426
- setOptions(options2) {
3427
- const { placeholder } = options2;
1422
+ setOptions(options) {
1423
+ const { placeholder } = options;
3428
1424
  this.placeholder = placeholder;
3429
- super.setOptions(options2);
1425
+ super.setOptions(options);
3430
1426
  }
3431
1427
  static deserialize(data) {
3432
1428
  return new _SelectField(data);
@@ -3529,8 +1525,8 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
3529
1525
  });
3530
1526
  OTPInput.displayName = "NumberInput";
3531
1527
  const _OTPField = class _OTPField extends BaseField {
3532
- constructor(options2) {
3533
- const { length, validationType, ...rest } = options2;
1528
+ constructor(options) {
1529
+ const { length, validationType, ...rest } = options;
3534
1530
  super(rest);
3535
1531
  __publicField(this, "type", "otp");
3536
1532
  __publicField(this, "length");
@@ -3612,8 +1608,8 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
3612
1608
  identifier
3613
1609
  });
3614
1610
  }
3615
- setOptions(options2) {
3616
- const { length, validationType, ...rest } = options2;
1611
+ setOptions(options) {
1612
+ const { length, validationType, ...rest } = options;
3617
1613
  this.length = length ?? this.length;
3618
1614
  this.validationType = validationType ?? this.validationType;
3619
1615
  super.setOptions(rest);
@@ -3685,7 +1681,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
3685
1681
  ...rest,
3686
1682
  children: [
3687
1683
  field.options.map((option, index) => /* @__PURE__ */ jsxRuntime.jsxs("label", { className: "flex gap-2 items-center min-w-0", children: [
3688
- /* @__PURE__ */ jsxRuntime.jsx(blocks.RadioGroup.Item, { value: option.value, children: /* @__PURE__ */ jsxRuntime.jsx(blocks.RadioGroup.Indicator, { children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Circle, { className: "h-3 w-3 fill-current" }) }) }),
1684
+ /* @__PURE__ */ jsxRuntime.jsx(blocks.RadioGroup.Item, { value: option.value, children: /* @__PURE__ */ jsxRuntime.jsx(blocks.RadioGroup.Indicator, { children: /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: "chevron-down", className: "fill-current" }) }) }),
3689
1685
  /* @__PURE__ */ jsxRuntime.jsx(blocks.Text, { size: "sm", accentColor: "base", className: "truncate", children: option.label })
3690
1686
  ] }, `${inputId}-${option.value}-${index}`)),
3691
1687
  !!value && /* @__PURE__ */ jsxRuntime.jsxs(
@@ -3698,8 +1694,8 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
3698
1694
  accentColor: "base",
3699
1695
  size: "sm",
3700
1696
  children: [
3701
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, { className: "h-4 w-4" }),
3702
- " Clear"
1697
+ /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: "x" }),
1698
+ "Clear"
3703
1699
  ]
3704
1700
  }
3705
1701
  )
@@ -3711,8 +1707,8 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
3711
1707
  });
3712
1708
  RadioInput.displayName = "SelectInput";
3713
1709
  const _RadioField = class _RadioField extends BaseOptionsField {
3714
- constructor(options2) {
3715
- super(options2);
1710
+ constructor(options) {
1711
+ super(options);
3716
1712
  __publicField(this, "type", "radio");
3717
1713
  __publicField(this, "onlyValidateAfterTouched", false);
3718
1714
  }
@@ -3728,8 +1724,8 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
3728
1724
  identifier
3729
1725
  });
3730
1726
  }
3731
- setOptions(options2) {
3732
- super.setOptions(options2);
1727
+ setOptions(options) {
1728
+ super.setOptions(options);
3733
1729
  }
3734
1730
  static deserialize(data) {
3735
1731
  return new _RadioField(data);
@@ -3794,9 +1790,9 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
3794
1790
  }();
3795
1791
  var CustomError = function(_super) {
3796
1792
  __extends$19(CustomError2, _super);
3797
- function CustomError2(message, options2) {
1793
+ function CustomError2(message, options) {
3798
1794
  var _newTarget = this.constructor;
3799
- var _this = _super.call(this, message, options2) || this;
1795
+ var _this = _super.call(this, message, options) || this;
3800
1796
  Object.defineProperty(_this, "name", {
3801
1797
  value: _newTarget.name,
3802
1798
  enumerable: false,
@@ -4856,9 +2852,9 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
4856
2852
  var e = encoding ? encoding.getName() : this.ISO88591;
4857
2853
  return StringEncoding.decode(new Uint8Array([code]), e);
4858
2854
  };
4859
- StringUtils2.guessEncoding = function(bytes, hints2) {
4860
- if (hints2 !== null && hints2 !== void 0 && void 0 !== hints2.get(DecodeHintType$1.CHARACTER_SET)) {
4861
- return hints2.get(DecodeHintType$1.CHARACTER_SET).toString();
2855
+ StringUtils2.guessEncoding = function(bytes, hints) {
2856
+ if (hints !== null && hints !== void 0 && void 0 !== hints.get(DecodeHintType$1.CHARACTER_SET)) {
2857
+ return hints.get(DecodeHintType$1.CHARACTER_SET).toString();
4862
2858
  }
4863
2859
  var length = bytes.length;
4864
2860
  var canBeISO88591 = true;
@@ -6204,8 +4200,8 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
6204
4200
  /**
6205
4201
  * Sets the hints.
6206
4202
  */
6207
- set: function(hints2) {
6208
- this._hints = hints2 || null;
4203
+ set: function(hints) {
4204
+ this._hints = hints || null;
6209
4205
  },
6210
4206
  enumerable: false,
6211
4207
  configurable: true
@@ -8031,12 +6027,12 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
8031
6027
  );
8032
6028
  };
8033
6029
  MathUtils2.sum = function(array) {
8034
- var count2 = 0;
6030
+ var count = 0;
8035
6031
  for (var i = 0, length_1 = array.length; i !== length_1; i++) {
8036
6032
  var a = array[i];
8037
- count2 += a;
6033
+ count += a;
8038
6034
  }
8039
- return count2;
6035
+ return count;
8040
6036
  };
8041
6037
  return MathUtils2;
8042
6038
  }()
@@ -8944,9 +6940,9 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
8944
6940
  function() {
8945
6941
  function AztecReader2() {
8946
6942
  }
8947
- AztecReader2.prototype.decode = function(image, hints2) {
8948
- if (hints2 === void 0) {
8949
- hints2 = null;
6943
+ AztecReader2.prototype.decode = function(image, hints) {
6944
+ if (hints === void 0) {
6945
+ hints = null;
8950
6946
  }
8951
6947
  var exception = null;
8952
6948
  var detector = new Detector$3(image.getBlackMatrix());
@@ -8955,7 +6951,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
8955
6951
  try {
8956
6952
  var detectorResult = detector.detectMirror(false);
8957
6953
  points = detectorResult.getPoints();
8958
- this.reportFoundResultPoints(hints2, points);
6954
+ this.reportFoundResultPoints(hints, points);
8959
6955
  decoderResult = new Decoder$2().decode(detectorResult);
8960
6956
  } catch (e) {
8961
6957
  exception = e;
@@ -8964,7 +6960,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
8964
6960
  try {
8965
6961
  var detectorResult = detector.detectMirror(true);
8966
6962
  points = detectorResult.getPoints();
8967
- this.reportFoundResultPoints(hints2, points);
6963
+ this.reportFoundResultPoints(hints, points);
8968
6964
  decoderResult = new Decoder$2().decode(detectorResult);
8969
6965
  } catch (e) {
8970
6966
  if (exception != null) {
@@ -8984,9 +6980,9 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
8984
6980
  }
8985
6981
  return result;
8986
6982
  };
8987
- AztecReader2.prototype.reportFoundResultPoints = function(hints2, points) {
8988
- if (hints2 != null) {
8989
- var rpcb_1 = hints2.get(DecodeHintType$1.NEED_RESULT_POINT_CALLBACK);
6983
+ AztecReader2.prototype.reportFoundResultPoints = function(hints, points) {
6984
+ if (hints != null) {
6985
+ var rpcb_1 = hints.get(DecodeHintType$1.NEED_RESULT_POINT_CALLBACK);
8990
6986
  if (rpcb_1 != null) {
8991
6987
  points.forEach(function(point, idx, arr) {
8992
6988
  rpcb_1.foundPossibleResultPoint(point);
@@ -9031,14 +7027,14 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
9031
7027
  function() {
9032
7028
  function OneDReader2() {
9033
7029
  }
9034
- OneDReader2.prototype.decode = function(image, hints2) {
7030
+ OneDReader2.prototype.decode = function(image, hints) {
9035
7031
  try {
9036
- return this.doDecode(image, hints2);
7032
+ return this.doDecode(image, hints);
9037
7033
  } catch (nfe) {
9038
- var tryHarder = hints2 && hints2.get(DecodeHintType$1.TRY_HARDER) === true;
7034
+ var tryHarder = hints && hints.get(DecodeHintType$1.TRY_HARDER) === true;
9039
7035
  if (tryHarder && image.isRotateSupported()) {
9040
7036
  var rotatedImage = image.rotateCounterClockwise();
9041
- var result = this.doDecode(rotatedImage, hints2);
7037
+ var result = this.doDecode(rotatedImage, hints);
9042
7038
  var metadata = result.getResultMetadata();
9043
7039
  var orientation_1 = 270;
9044
7040
  if (metadata !== null && metadata.get(ResultMetadataType$1.ORIENTATION) === true) {
@@ -9060,11 +7056,11 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
9060
7056
  };
9061
7057
  OneDReader2.prototype.reset = function() {
9062
7058
  };
9063
- OneDReader2.prototype.doDecode = function(image, hints2) {
7059
+ OneDReader2.prototype.doDecode = function(image, hints) {
9064
7060
  var width = image.getWidth();
9065
7061
  var height = image.getHeight();
9066
7062
  var row = new BitArray(width);
9067
- var tryHarder = hints2 && hints2.get(DecodeHintType$1.TRY_HARDER) === true;
7063
+ var tryHarder = hints && hints.get(DecodeHintType$1.TRY_HARDER) === true;
9068
7064
  var rowStep = Math.max(1, height >> (tryHarder ? 8 : 5));
9069
7065
  var maxLines;
9070
7066
  if (tryHarder) {
@@ -9088,17 +7084,17 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
9088
7084
  var _loop_1 = function(attempt2) {
9089
7085
  if (attempt2 === 1) {
9090
7086
  row.reverse();
9091
- if (hints2 && hints2.get(DecodeHintType$1.NEED_RESULT_POINT_CALLBACK) === true) {
7087
+ if (hints && hints.get(DecodeHintType$1.NEED_RESULT_POINT_CALLBACK) === true) {
9092
7088
  var newHints_1 = /* @__PURE__ */ new Map();
9093
- hints2.forEach(function(hint, key) {
7089
+ hints.forEach(function(hint, key) {
9094
7090
  return newHints_1.set(key, hint);
9095
7091
  });
9096
7092
  newHints_1.delete(DecodeHintType$1.NEED_RESULT_POINT_CALLBACK);
9097
- hints2 = newHints_1;
7093
+ hints = newHints_1;
9098
7094
  }
9099
7095
  }
9100
7096
  try {
9101
- var result = this_1.decodeRow(rowNumber, row, hints2);
7097
+ var result = this_1.decodeRow(rowNumber, row, hints);
9102
7098
  if (attempt2 === 1) {
9103
7099
  result.putMetadata(ResultMetadataType$1.ORIENTATION, 180);
9104
7100
  var points = result.getResultPoints();
@@ -9271,8 +7267,8 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
9271
7267
  throw new NotFoundException();
9272
7268
  }
9273
7269
  };
9274
- Code128Reader2.prototype.decodeRow = function(rowNumber, row, hints2) {
9275
- var convertFNC1 = hints2 && hints2.get(DecodeHintType$1.ASSUME_GS1) === true;
7270
+ Code128Reader2.prototype.decodeRow = function(rowNumber, row, hints) {
7271
+ var convertFNC1 = hints && hints.get(DecodeHintType$1.ASSUME_GS1) === true;
9276
7272
  var startPatternInfo = Code128Reader2.findStartPattern(row);
9277
7273
  var startCode = startPatternInfo[2];
9278
7274
  var currentRawCodesIndex = 0;
@@ -9680,7 +7676,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
9680
7676
  _this.counters = new Int32Array(9);
9681
7677
  return _this;
9682
7678
  }
9683
- Code39Reader2.prototype.decodeRow = function(rowNumber, row, hints2) {
7679
+ Code39Reader2.prototype.decodeRow = function(rowNumber, row, hints) {
9684
7680
  var e_1, _a2, e_2, _b;
9685
7681
  var theCounters = this.counters;
9686
7682
  theCounters.fill(0);
@@ -10000,7 +7996,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
10000
7996
  _this.counters = new Int32Array(6);
10001
7997
  return _this;
10002
7998
  }
10003
- Code93Reader2.prototype.decodeRow = function(rowNumber, row, hints2) {
7999
+ Code93Reader2.prototype.decodeRow = function(rowNumber, row, hints) {
10004
8000
  var e_1, _a2, e_2, _b;
10005
8001
  var start = this.findAsteriskPattern(row);
10006
8002
  var nextStart = row.getNextSet(start[1]);
@@ -10312,7 +8308,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
10312
8308
  _this.narrowLineWidth = -1;
10313
8309
  return _this;
10314
8310
  }
10315
- ITFReader2.prototype.decodeRow = function(rowNumber, row, hints2) {
8311
+ ITFReader2.prototype.decodeRow = function(rowNumber, row, hints) {
10316
8312
  var e_1, _a2;
10317
8313
  var startRange = this.decodeStart(row);
10318
8314
  var endRange = this.decodeEnd(row);
@@ -10320,8 +8316,8 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
10320
8316
  ITFReader2.decodeMiddle(row, startRange[1], endRange[0], result);
10321
8317
  var resultString = result.toString();
10322
8318
  var allowedLengths = null;
10323
- if (hints2 != null) {
10324
- allowedLengths = hints2.get(DecodeHintType$1.ALLOWED_LENGTHS);
8319
+ if (hints != null) {
8320
+ allowedLengths = hints.get(DecodeHintType$1.ALLOWED_LENGTHS);
10325
8321
  }
10326
8322
  if (allowedLengths == null) {
10327
8323
  allowedLengths = ITFReader2.DEFAULT_ALLOWED_LENGTHS;
@@ -10957,9 +8953,9 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
10957
8953
  }
10958
8954
  return _this;
10959
8955
  }
10960
- UPCEANReader2.prototype.decodeRow = function(rowNumber, row, hints2) {
8956
+ UPCEANReader2.prototype.decodeRow = function(rowNumber, row, hints) {
10961
8957
  var startGuardRange = UPCEANReader2.findStartGuardPattern(row);
10962
- var resultPointCallback = hints2 == null ? null : hints2.get(DecodeHintType$1.NEED_RESULT_POINT_CALLBACK);
8958
+ var resultPointCallback = hints == null ? null : hints.get(DecodeHintType$1.NEED_RESULT_POINT_CALLBACK);
10963
8959
  if (resultPointCallback != null) {
10964
8960
  var resultPoint_1 = new ResultPoint((startGuardRange[0] + startGuardRange[1]) / 2, rowNumber);
10965
8961
  resultPointCallback.foundPossibleResultPoint(resultPoint_1);
@@ -11002,7 +8998,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
11002
8998
  extensionLength = extensionResult.getText().length;
11003
8999
  } catch (err) {
11004
9000
  }
11005
- var allowedExtensions = hints2 == null ? null : hints2.get(DecodeHintType$1.ALLOWED_EAN_EXTENSIONS);
9001
+ var allowedExtensions = hints == null ? null : hints.get(DecodeHintType$1.ALLOWED_EAN_EXTENSIONS);
11006
9002
  if (allowedExtensions != null) {
11007
9003
  var valid = false;
11008
9004
  for (var length_1 in allowedExtensions) {
@@ -11282,11 +9278,11 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
11282
9278
  UPCAReader2.prototype.getBarcodeFormat = function() {
11283
9279
  return BarcodeFormat$1.UPC_A;
11284
9280
  };
11285
- UPCAReader2.prototype.decode = function(image, hints2) {
9281
+ UPCAReader2.prototype.decode = function(image, hints) {
11286
9282
  return this.maybeReturnResult(this.ean13Reader.decode(image));
11287
9283
  };
11288
- UPCAReader2.prototype.decodeRow = function(rowNumber, row, hints2) {
11289
- return this.maybeReturnResult(this.ean13Reader.decodeRow(rowNumber, row, hints2));
9284
+ UPCAReader2.prototype.decodeRow = function(rowNumber, row, hints) {
9285
+ return this.maybeReturnResult(this.ean13Reader.decodeRow(rowNumber, row, hints));
11290
9286
  };
11291
9287
  UPCAReader2.prototype.decodeMiddle = function(row, startRange, resultString) {
11292
9288
  return this.ean13Reader.decodeMiddle(row, startRange, resultString);
@@ -11489,9 +9485,9 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
11489
9485
  /** @class */
11490
9486
  function(_super) {
11491
9487
  __extends$G(MultiFormatUPCEANReader2, _super);
11492
- function MultiFormatUPCEANReader2(hints2) {
9488
+ function MultiFormatUPCEANReader2(hints) {
11493
9489
  var _this = _super.call(this) || this;
11494
- var possibleFormats = hints2 == null ? null : hints2.get(DecodeHintType$1.POSSIBLE_FORMATS);
9490
+ var possibleFormats = hints == null ? null : hints.get(DecodeHintType$1.POSSIBLE_FORMATS);
11495
9491
  var readers = [];
11496
9492
  if (possibleFormats != null) {
11497
9493
  if (possibleFormats.indexOf(BarcodeFormat$1.EAN_13) > -1) {
@@ -11516,15 +9512,15 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
11516
9512
  _this.readers = readers;
11517
9513
  return _this;
11518
9514
  }
11519
- MultiFormatUPCEANReader2.prototype.decodeRow = function(rowNumber, row, hints2) {
9515
+ MultiFormatUPCEANReader2.prototype.decodeRow = function(rowNumber, row, hints) {
11520
9516
  var e_1, _a2;
11521
9517
  try {
11522
9518
  for (var _b = __values$y(this.readers), _c = _b.next(); !_c.done; _c = _b.next()) {
11523
9519
  var reader = _c.value;
11524
9520
  try {
11525
- var result = reader.decodeRow(rowNumber, row, hints2);
9521
+ var result = reader.decodeRow(rowNumber, row, hints);
11526
9522
  var ean13MayBeUPCA = result.getBarcodeFormat() === BarcodeFormat$1.EAN_13 && result.getText().charAt(0) === "0";
11527
- var possibleFormats = hints2 == null ? null : hints2.get(DecodeHintType$1.POSSIBLE_FORMATS);
9523
+ var possibleFormats = hints == null ? null : hints.get(DecodeHintType$1.POSSIBLE_FORMATS);
11528
9524
  var canReturnUPCA = possibleFormats == null || possibleFormats.includes(BarcodeFormat$1.UPC_A);
11529
9525
  if (ean13MayBeUPCA && canReturnUPCA) {
11530
9526
  var rawBytes = result.getRawBytes();
@@ -11614,7 +9610,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
11614
9610
  };
11615
9611
  return _this;
11616
9612
  }
11617
- CodaBarReader2.prototype.decodeRow = function(rowNumber, row, hints2) {
9613
+ CodaBarReader2.prototype.decodeRow = function(rowNumber, row, hints) {
11618
9614
  var validRowData = this.getValidRowData(row);
11619
9615
  if (!validRowData)
11620
9616
  throw new NotFoundException();
@@ -13448,7 +11444,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
13448
11444
  _this.startEnd = [2];
13449
11445
  return _this;
13450
11446
  }
13451
- RSSExpandedReader2.prototype.decodeRow = function(rowNumber, row, hints2) {
11447
+ RSSExpandedReader2.prototype.decodeRow = function(rowNumber, row, hints) {
13452
11448
  this.pairs.length = 0;
13453
11449
  this.startFromEven = false;
13454
11450
  try {
@@ -13924,25 +11920,25 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
13924
11920
  var evenRoundingErrors = this.getEvenRoundingErrors();
13925
11921
  for (var i = 0; i < counters.length; i++) {
13926
11922
  var value_1 = 1 * counters[i] / elementWidth;
13927
- var count2 = value_1 + 0.5;
13928
- if (count2 < 1) {
11923
+ var count = value_1 + 0.5;
11924
+ if (count < 1) {
13929
11925
  if (value_1 < 0.3) {
13930
11926
  throw new NotFoundException();
13931
11927
  }
13932
- count2 = 1;
13933
- } else if (count2 > 8) {
11928
+ count = 1;
11929
+ } else if (count > 8) {
13934
11930
  if (value_1 > 8.7) {
13935
11931
  throw new NotFoundException();
13936
11932
  }
13937
- count2 = 8;
11933
+ count = 8;
13938
11934
  }
13939
11935
  var offset = i / 2;
13940
11936
  if ((i & 1) === 0) {
13941
- oddCounts[offset] = count2;
13942
- oddRoundingErrors[offset] = value_1 - count2;
11937
+ oddCounts[offset] = count;
11938
+ oddRoundingErrors[offset] = value_1 - count;
13943
11939
  } else {
13944
- evenCounts[offset] = count2;
13945
- evenRoundingErrors[offset] = value_1 - count2;
11940
+ evenCounts[offset] = count;
11941
+ evenRoundingErrors[offset] = value_1 - count;
13946
11942
  }
13947
11943
  }
13948
11944
  this.adjustOddEvenCounts(numModules);
@@ -14270,12 +12266,12 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
14270
12266
  _this.possibleRightPairs = [];
14271
12267
  return _this;
14272
12268
  }
14273
- RSS14Reader2.prototype.decodeRow = function(rowNumber, row, hints2) {
12269
+ RSS14Reader2.prototype.decodeRow = function(rowNumber, row, hints) {
14274
12270
  var e_1, _a2, e_2, _b;
14275
- var leftPair = this.decodePair(row, false, rowNumber, hints2);
12271
+ var leftPair = this.decodePair(row, false, rowNumber, hints);
14276
12272
  RSS14Reader2.addOrTally(this.possibleLeftPairs, leftPair);
14277
12273
  row.reverse();
14278
- var rightPair = this.decodePair(row, true, rowNumber, hints2);
12274
+ var rightPair = this.decodePair(row, true, rowNumber, hints);
14279
12275
  RSS14Reader2.addOrTally(this.possibleRightPairs, rightPair);
14280
12276
  row.reverse();
14281
12277
  try {
@@ -14376,11 +12372,11 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
14376
12372
  }
14377
12373
  return checkValue === targetCheckValue;
14378
12374
  };
14379
- RSS14Reader2.prototype.decodePair = function(row, right, rowNumber, hints2) {
12375
+ RSS14Reader2.prototype.decodePair = function(row, right, rowNumber, hints) {
14380
12376
  try {
14381
12377
  var startEnd = this.findFinderPattern(row, right);
14382
12378
  var pattern = this.parseFoundFinderPattern(row, rowNumber, right, startEnd);
14383
- var resultPointCallback = hints2 == null ? null : hints2.get(DecodeHintType$1.NEED_RESULT_POINT_CALLBACK);
12379
+ var resultPointCallback = hints == null ? null : hints.get(DecodeHintType$1.NEED_RESULT_POINT_CALLBACK);
14384
12380
  if (resultPointCallback != null) {
14385
12381
  var center = (startEnd[0] + startEnd[1]) / 2;
14386
12382
  if (right) {
@@ -14418,19 +12414,19 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
14418
12414
  var evenRoundingErrors = this.getEvenRoundingErrors();
14419
12415
  for (var i = 0; i < counters.length; i++) {
14420
12416
  var value = counters[i] / elementWidth;
14421
- var count2 = Math.floor(value + 0.5);
14422
- if (count2 < 1) {
14423
- count2 = 1;
14424
- } else if (count2 > 8) {
14425
- count2 = 8;
12417
+ var count = Math.floor(value + 0.5);
12418
+ if (count < 1) {
12419
+ count = 1;
12420
+ } else if (count > 8) {
12421
+ count = 8;
14426
12422
  }
14427
12423
  var offset = Math.floor(i / 2);
14428
12424
  if ((i & 1) === 0) {
14429
- oddCounts[offset] = count2;
14430
- oddRoundingErrors[offset] = value - count2;
12425
+ oddCounts[offset] = count;
12426
+ oddRoundingErrors[offset] = value - count;
14431
12427
  } else {
14432
- evenCounts[offset] = count2;
14433
- evenRoundingErrors[offset] = value - count2;
12428
+ evenCounts[offset] = count;
12429
+ evenRoundingErrors[offset] = value - count;
14434
12430
  }
14435
12431
  }
14436
12432
  this.adjustOddEvenCounts(outsideChar, numModules);
@@ -14674,14 +12670,14 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
14674
12670
  /** @class */
14675
12671
  function(_super) {
14676
12672
  __extends$n(MultiFormatOneDReader2, _super);
14677
- function MultiFormatOneDReader2(hints2) {
12673
+ function MultiFormatOneDReader2(hints) {
14678
12674
  var _this = _super.call(this) || this;
14679
12675
  _this.readers = [];
14680
- var possibleFormats = !hints2 ? null : hints2.get(DecodeHintType$1.POSSIBLE_FORMATS);
14681
- var useCode39CheckDigit = hints2 && hints2.get(DecodeHintType$1.ASSUME_CODE_39_CHECK_DIGIT) !== void 0;
12676
+ var possibleFormats = !hints ? null : hints.get(DecodeHintType$1.POSSIBLE_FORMATS);
12677
+ var useCode39CheckDigit = hints && hints.get(DecodeHintType$1.ASSUME_CODE_39_CHECK_DIGIT) !== void 0;
14682
12678
  if (possibleFormats) {
14683
12679
  if (possibleFormats.includes(BarcodeFormat$1.EAN_13) || possibleFormats.includes(BarcodeFormat$1.UPC_A) || possibleFormats.includes(BarcodeFormat$1.EAN_8) || possibleFormats.includes(BarcodeFormat$1.UPC_E)) {
14684
- _this.readers.push(new MultiFormatUPCEANReader(hints2));
12680
+ _this.readers.push(new MultiFormatUPCEANReader(hints));
14685
12681
  }
14686
12682
  if (possibleFormats.includes(BarcodeFormat$1.CODE_39)) {
14687
12683
  _this.readers.push(new Code39Reader(useCode39CheckDigit));
@@ -14707,20 +12703,20 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
14707
12703
  }
14708
12704
  }
14709
12705
  if (_this.readers.length === 0) {
14710
- _this.readers.push(new MultiFormatUPCEANReader(hints2));
12706
+ _this.readers.push(new MultiFormatUPCEANReader(hints));
14711
12707
  _this.readers.push(new Code39Reader());
14712
12708
  _this.readers.push(new Code93Reader());
14713
- _this.readers.push(new MultiFormatUPCEANReader(hints2));
12709
+ _this.readers.push(new MultiFormatUPCEANReader(hints));
14714
12710
  _this.readers.push(new Code128Reader());
14715
12711
  _this.readers.push(new ITFReader());
14716
12712
  _this.readers.push(new RSS14Reader());
14717
12713
  }
14718
12714
  return _this;
14719
12715
  }
14720
- MultiFormatOneDReader2.prototype.decodeRow = function(rowNumber, row, hints2) {
12716
+ MultiFormatOneDReader2.prototype.decodeRow = function(rowNumber, row, hints) {
14721
12717
  for (var i = 0; i < this.readers.length; i++) {
14722
12718
  try {
14723
- return this.readers[i].decodeRow(rowNumber, row, hints2);
12719
+ return this.readers[i].decodeRow(rowNumber, row, hints);
14724
12720
  } catch (re) {
14725
12721
  }
14726
12722
  }
@@ -14753,11 +12749,11 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
14753
12749
  }();
14754
12750
  (function(_super) {
14755
12751
  __extends$m(BrowserBarcodeReader, _super);
14756
- function BrowserBarcodeReader(timeBetweenScansMillis, hints2) {
12752
+ function BrowserBarcodeReader(timeBetweenScansMillis, hints) {
14757
12753
  if (timeBetweenScansMillis === void 0) {
14758
12754
  timeBetweenScansMillis = 500;
14759
12755
  }
14760
- return _super.call(this, new MultiFormatOneDReader(hints2), timeBetweenScansMillis, hints2) || this;
12756
+ return _super.call(this, new MultiFormatOneDReader(hints), timeBetweenScansMillis, hints) || this;
14761
12757
  }
14762
12758
  return BrowserBarcodeReader;
14763
12759
  })(BrowserCodeReader);
@@ -14792,8 +12788,8 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
14792
12788
  var ECB$1 = (
14793
12789
  /** @class */
14794
12790
  function() {
14795
- function ECB2(count2, dataCodewords) {
14796
- this.count = count2;
12791
+ function ECB2(count, dataCodewords) {
12792
+ this.count = count;
14797
12793
  this.dataCodewords = dataCodewords;
14798
12794
  }
14799
12795
  ECB2.prototype.getCount = function() {
@@ -15718,19 +13714,19 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
15718
13714
  DecodedBitStreamParser2.decodeBase256Segment = function(bits, result, byteSegments) {
15719
13715
  var codewordPosition = 1 + bits.getByteOffset();
15720
13716
  var d1 = this.unrandomize255State(bits.readBits(8), codewordPosition++);
15721
- var count2;
13717
+ var count;
15722
13718
  if (d1 === 0) {
15723
- count2 = bits.available() / 8 | 0;
13719
+ count = bits.available() / 8 | 0;
15724
13720
  } else if (d1 < 250) {
15725
- count2 = d1;
13721
+ count = d1;
15726
13722
  } else {
15727
- count2 = 250 * (d1 - 249) + this.unrandomize255State(bits.readBits(8), codewordPosition++);
13723
+ count = 250 * (d1 - 249) + this.unrandomize255State(bits.readBits(8), codewordPosition++);
15728
13724
  }
15729
- if (count2 < 0) {
13725
+ if (count < 0) {
15730
13726
  throw new FormatException();
15731
13727
  }
15732
- var bytes = new Uint8Array(count2);
15733
- for (var i = 0; i < count2; i++) {
13728
+ var bytes = new Uint8Array(count);
13729
+ for (var i = 0; i < count; i++) {
15734
13730
  if (bits.available() < 8) {
15735
13731
  throw new FormatException();
15736
13732
  }
@@ -16193,13 +14189,13 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
16193
14189
  function DataMatrixReader2() {
16194
14190
  this.decoder = new Decoder$1();
16195
14191
  }
16196
- DataMatrixReader2.prototype.decode = function(image, hints2) {
16197
- if (hints2 === void 0) {
16198
- hints2 = null;
14192
+ DataMatrixReader2.prototype.decode = function(image, hints) {
14193
+ if (hints === void 0) {
14194
+ hints = null;
16199
14195
  }
16200
14196
  var decoderResult;
16201
14197
  var points;
16202
- if (hints2 != null && hints2.has(DecodeHintType$1.PURE_BARCODE)) {
14198
+ if (hints != null && hints.has(DecodeHintType$1.PURE_BARCODE)) {
16203
14199
  var bits = DataMatrixReader2.extractPureBits(image.getBlackMatrix());
16204
14200
  decoderResult = this.decoder.decode(bits);
16205
14201
  points = DataMatrixReader2.NO_POINTS;
@@ -16539,8 +14535,8 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
16539
14535
  var ECB = (
16540
14536
  /** @class */
16541
14537
  function() {
16542
- function ECB2(count2, dataCodewords) {
16543
- this.count = count2;
14538
+ function ECB2(count, dataCodewords) {
14539
+ this.count = count;
16544
14540
  this.dataCodewords = dataCodewords;
16545
14541
  }
16546
14542
  ECB2.prototype.getCount = function() {
@@ -16928,8 +14924,8 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
16928
14924
  if (j === 6) {
16929
14925
  j--;
16930
14926
  }
16931
- for (var count2 = 0; count2 < dimension; count2++) {
16932
- var i = readingUp ? dimension - 1 - count2 : count2;
14927
+ for (var count = 0; count < dimension; count++) {
14928
+ var i = readingUp ? dimension - 1 - count : count;
16933
14929
  for (var col = 0; col < 2; col++) {
16934
14930
  if (!functionPattern.get(j - col, i)) {
16935
14931
  bitsRead++;
@@ -17157,7 +15153,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
17157
15153
  function() {
17158
15154
  function DecodedBitStreamParser2() {
17159
15155
  }
17160
- DecodedBitStreamParser2.decode = function(bytes, version, ecLevel, hints2) {
15156
+ DecodedBitStreamParser2.decode = function(bytes, version, ecLevel, hints) {
17161
15157
  var bits = new BitSource(bytes);
17162
15158
  var result = new StringBuilder();
17163
15159
  var byteSegments = new Array();
@@ -17203,19 +15199,19 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
17203
15199
  }
17204
15200
  break;
17205
15201
  default:
17206
- var count2 = bits.readBits(mode.getCharacterCountBits(version));
15202
+ var count = bits.readBits(mode.getCharacterCountBits(version));
17207
15203
  switch (mode) {
17208
15204
  case Mode$2.NUMERIC:
17209
- DecodedBitStreamParser2.decodeNumericSegment(bits, result, count2);
15205
+ DecodedBitStreamParser2.decodeNumericSegment(bits, result, count);
17210
15206
  break;
17211
15207
  case Mode$2.ALPHANUMERIC:
17212
- DecodedBitStreamParser2.decodeAlphanumericSegment(bits, result, count2, fc1InEffect);
15208
+ DecodedBitStreamParser2.decodeAlphanumericSegment(bits, result, count, fc1InEffect);
17213
15209
  break;
17214
15210
  case Mode$2.BYTE:
17215
- DecodedBitStreamParser2.decodeByteSegment(bits, result, count2, currentCharacterSetECI, byteSegments, hints2);
15211
+ DecodedBitStreamParser2.decodeByteSegment(bits, result, count, currentCharacterSetECI, byteSegments, hints);
17216
15212
  break;
17217
15213
  case Mode$2.KANJI:
17218
- DecodedBitStreamParser2.decodeKanjiSegment(bits, result, count2);
15214
+ DecodedBitStreamParser2.decodeKanjiSegment(bits, result, count);
17219
15215
  break;
17220
15216
  default:
17221
15217
  throw new FormatException();
@@ -17228,13 +15224,13 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
17228
15224
  }
17229
15225
  return new DecoderResult(bytes, result.toString(), byteSegments.length === 0 ? null : byteSegments, ecLevel === null ? null : ecLevel.toString(), symbolSequence, parityData);
17230
15226
  };
17231
- DecodedBitStreamParser2.decodeHanziSegment = function(bits, result, count2) {
17232
- if (count2 * 13 > bits.available()) {
15227
+ DecodedBitStreamParser2.decodeHanziSegment = function(bits, result, count) {
15228
+ if (count * 13 > bits.available()) {
17233
15229
  throw new FormatException();
17234
15230
  }
17235
- var buffer = new Uint8Array(2 * count2);
15231
+ var buffer = new Uint8Array(2 * count);
17236
15232
  var offset = 0;
17237
- while (count2 > 0) {
15233
+ while (count > 0) {
17238
15234
  var twoBytes = bits.readBits(13);
17239
15235
  var assembledTwoBytes = twoBytes / 96 << 8 & 4294967295 | twoBytes % 96;
17240
15236
  if (assembledTwoBytes < 959) {
@@ -17247,7 +15243,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
17247
15243
  buffer[offset + 1] = /*(byte) */
17248
15244
  assembledTwoBytes & 255;
17249
15245
  offset += 2;
17250
- count2--;
15246
+ count--;
17251
15247
  }
17252
15248
  try {
17253
15249
  result.append(StringEncoding.decode(buffer, StringUtils.GB2312));
@@ -17255,13 +15251,13 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
17255
15251
  throw new FormatException(ignored);
17256
15252
  }
17257
15253
  };
17258
- DecodedBitStreamParser2.decodeKanjiSegment = function(bits, result, count2) {
17259
- if (count2 * 13 > bits.available()) {
15254
+ DecodedBitStreamParser2.decodeKanjiSegment = function(bits, result, count) {
15255
+ if (count * 13 > bits.available()) {
17260
15256
  throw new FormatException();
17261
15257
  }
17262
- var buffer = new Uint8Array(2 * count2);
15258
+ var buffer = new Uint8Array(2 * count);
17263
15259
  var offset = 0;
17264
- while (count2 > 0) {
15260
+ while (count > 0) {
17265
15261
  var twoBytes = bits.readBits(13);
17266
15262
  var assembledTwoBytes = twoBytes / 192 << 8 & 4294967295 | twoBytes % 192;
17267
15263
  if (assembledTwoBytes < 7936) {
@@ -17274,7 +15270,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
17274
15270
  buffer[offset + 1] = /*(byte) */
17275
15271
  assembledTwoBytes;
17276
15272
  offset += 2;
17277
- count2--;
15273
+ count--;
17278
15274
  }
17279
15275
  try {
17280
15276
  result.append(StringEncoding.decode(buffer, StringUtils.SHIFT_JIS));
@@ -17282,18 +15278,18 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
17282
15278
  throw new FormatException(ignored);
17283
15279
  }
17284
15280
  };
17285
- DecodedBitStreamParser2.decodeByteSegment = function(bits, result, count2, currentCharacterSetECI, byteSegments, hints2) {
17286
- if (8 * count2 > bits.available()) {
15281
+ DecodedBitStreamParser2.decodeByteSegment = function(bits, result, count, currentCharacterSetECI, byteSegments, hints) {
15282
+ if (8 * count > bits.available()) {
17287
15283
  throw new FormatException();
17288
15284
  }
17289
- var readBytes = new Uint8Array(count2);
17290
- for (var i = 0; i < count2; i++) {
15285
+ var readBytes = new Uint8Array(count);
15286
+ for (var i = 0; i < count; i++) {
17291
15287
  readBytes[i] = /*(byte) */
17292
15288
  bits.readBits(8);
17293
15289
  }
17294
15290
  var encoding;
17295
15291
  if (currentCharacterSetECI === null) {
17296
- encoding = StringUtils.guessEncoding(readBytes, hints2);
15292
+ encoding = StringUtils.guessEncoding(readBytes, hints);
17297
15293
  } else {
17298
15294
  encoding = currentCharacterSetECI.getName();
17299
15295
  }
@@ -17310,18 +15306,18 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
17310
15306
  }
17311
15307
  return DecodedBitStreamParser2.ALPHANUMERIC_CHARS[value];
17312
15308
  };
17313
- DecodedBitStreamParser2.decodeAlphanumericSegment = function(bits, result, count2, fc1InEffect) {
15309
+ DecodedBitStreamParser2.decodeAlphanumericSegment = function(bits, result, count, fc1InEffect) {
17314
15310
  var start = result.length();
17315
- while (count2 > 1) {
15311
+ while (count > 1) {
17316
15312
  if (bits.available() < 11) {
17317
15313
  throw new FormatException();
17318
15314
  }
17319
15315
  var nextTwoCharsBits = bits.readBits(11);
17320
15316
  result.append(DecodedBitStreamParser2.toAlphaNumericChar(Math.floor(nextTwoCharsBits / 45)));
17321
15317
  result.append(DecodedBitStreamParser2.toAlphaNumericChar(nextTwoCharsBits % 45));
17322
- count2 -= 2;
15318
+ count -= 2;
17323
15319
  }
17324
- if (count2 === 1) {
15320
+ if (count === 1) {
17325
15321
  if (bits.available() < 6) {
17326
15322
  throw new FormatException();
17327
15323
  }
@@ -17339,8 +15335,8 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
17339
15335
  }
17340
15336
  }
17341
15337
  };
17342
- DecodedBitStreamParser2.decodeNumericSegment = function(bits, result, count2) {
17343
- while (count2 >= 3) {
15338
+ DecodedBitStreamParser2.decodeNumericSegment = function(bits, result, count) {
15339
+ while (count >= 3) {
17344
15340
  if (bits.available() < 10) {
17345
15341
  throw new FormatException();
17346
15342
  }
@@ -17351,9 +15347,9 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
17351
15347
  result.append(DecodedBitStreamParser2.toAlphaNumericChar(Math.floor(threeDigitsBits / 100)));
17352
15348
  result.append(DecodedBitStreamParser2.toAlphaNumericChar(Math.floor(threeDigitsBits / 10) % 10));
17353
15349
  result.append(DecodedBitStreamParser2.toAlphaNumericChar(threeDigitsBits % 10));
17354
- count2 -= 3;
15350
+ count -= 3;
17355
15351
  }
17356
- if (count2 === 2) {
15352
+ if (count === 2) {
17357
15353
  if (bits.available() < 7) {
17358
15354
  throw new FormatException();
17359
15355
  }
@@ -17363,7 +15359,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
17363
15359
  }
17364
15360
  result.append(DecodedBitStreamParser2.toAlphaNumericChar(Math.floor(twoDigitsBits / 10)));
17365
15361
  result.append(DecodedBitStreamParser2.toAlphaNumericChar(twoDigitsBits % 10));
17366
- } else if (count2 === 1) {
15362
+ } else if (count === 1) {
17367
15363
  if (bits.available() < 4) {
17368
15364
  throw new FormatException();
17369
15365
  }
@@ -17431,14 +15427,14 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
17431
15427
  function Decoder2() {
17432
15428
  this.rsDecoder = new ReedSolomonDecoder(GenericGF.QR_CODE_FIELD_256);
17433
15429
  }
17434
- Decoder2.prototype.decodeBooleanArray = function(image, hints2) {
17435
- return this.decodeBitMatrix(BitMatrix.parseFromBooleanArray(image), hints2);
15430
+ Decoder2.prototype.decodeBooleanArray = function(image, hints) {
15431
+ return this.decodeBitMatrix(BitMatrix.parseFromBooleanArray(image), hints);
17436
15432
  };
17437
- Decoder2.prototype.decodeBitMatrix = function(bits, hints2) {
15433
+ Decoder2.prototype.decodeBitMatrix = function(bits, hints) {
17438
15434
  var parser = new BitMatrixParser(bits);
17439
15435
  var ex = null;
17440
15436
  try {
17441
- return this.decodeBitMatrixParser(parser, hints2);
15437
+ return this.decodeBitMatrixParser(parser, hints);
17442
15438
  } catch (e) {
17443
15439
  ex = e;
17444
15440
  }
@@ -17448,7 +15444,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
17448
15444
  parser.readVersion();
17449
15445
  parser.readFormatInformation();
17450
15446
  parser.mirror();
17451
- var result = this.decodeBitMatrixParser(parser, hints2);
15447
+ var result = this.decodeBitMatrixParser(parser, hints);
17452
15448
  result.setOther(new QRCodeDecoderMetaData(true));
17453
15449
  return result;
17454
15450
  } catch (e) {
@@ -17458,7 +15454,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
17458
15454
  throw e;
17459
15455
  }
17460
15456
  };
17461
- Decoder2.prototype.decodeBitMatrixParser = function(parser, hints2) {
15457
+ Decoder2.prototype.decodeBitMatrixParser = function(parser, hints) {
17462
15458
  var e_1, _a2, e_2, _b;
17463
15459
  var version = parser.readVersion();
17464
15460
  var ecLevel = parser.readFormatInformation().getErrorCorrectionLevel();
@@ -17500,7 +15496,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
17500
15496
  if (e_2) throw e_2.error;
17501
15497
  }
17502
15498
  }
17503
- return DecodedBitStreamParser$1.decode(resultBytes, version, ecLevel, hints2);
15499
+ return DecodedBitStreamParser$1.decode(resultBytes, version, ecLevel, hints);
17504
15500
  };
17505
15501
  Decoder2.prototype.correctErrors = function(codewordBytes, numDataCodewords) {
17506
15502
  var codewordsInts = new Int32Array(codewordBytes);
@@ -17759,11 +15755,11 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
17759
15755
  /** @class */
17760
15756
  function(_super) {
17761
15757
  __extends$j(FinderPattern2, _super);
17762
- function FinderPattern2(posX, posY, estimatedModuleSize, count2) {
15758
+ function FinderPattern2(posX, posY, estimatedModuleSize, count) {
17763
15759
  var _this = _super.call(this, posX, posY) || this;
17764
15760
  _this.estimatedModuleSize = estimatedModuleSize;
17765
- _this.count = count2;
17766
- if (void 0 === count2) {
15761
+ _this.count = count;
15762
+ if (void 0 === count) {
17767
15763
  _this.count = 1;
17768
15764
  }
17769
15765
  return _this;
@@ -17838,9 +15834,9 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
17838
15834
  FinderPatternFinder2.prototype.getPossibleCenters = function() {
17839
15835
  return this.possibleCenters;
17840
15836
  };
17841
- FinderPatternFinder2.prototype.find = function(hints2) {
17842
- var tryHarder = hints2 !== null && hints2 !== void 0 && void 0 !== hints2.get(DecodeHintType$1.TRY_HARDER);
17843
- var pureBarcode = hints2 !== null && hints2 !== void 0 && void 0 !== hints2.get(DecodeHintType$1.PURE_BARCODE);
15837
+ FinderPatternFinder2.prototype.find = function(hints) {
15838
+ var tryHarder = hints !== null && hints !== void 0 && void 0 !== hints.get(DecodeHintType$1.TRY_HARDER);
15839
+ var pureBarcode = hints !== null && hints !== void 0 && void 0 !== hints.get(DecodeHintType$1.PURE_BARCODE);
17844
15840
  var image = this.image;
17845
15841
  var maxI = image.getHeight();
17846
15842
  var maxJ = image.getWidth();
@@ -17930,11 +15926,11 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
17930
15926
  FinderPatternFinder2.foundPatternCross = function(stateCount) {
17931
15927
  var totalModuleSize = 0;
17932
15928
  for (var i = 0; i < 5; i++) {
17933
- var count2 = stateCount[i];
17934
- if (count2 === 0) {
15929
+ var count = stateCount[i];
15930
+ if (count === 0) {
17935
15931
  return false;
17936
15932
  }
17937
- totalModuleSize += count2;
15933
+ totalModuleSize += count;
17938
15934
  }
17939
15935
  if (totalModuleSize < 7) {
17940
15936
  return false;
@@ -18345,13 +16341,13 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
18345
16341
  Detector2.prototype.getResultPointCallback = function() {
18346
16342
  return this.resultPointCallback;
18347
16343
  };
18348
- Detector2.prototype.detect = function(hints2) {
18349
- this.resultPointCallback = hints2 === null || hints2 === void 0 ? null : (
16344
+ Detector2.prototype.detect = function(hints) {
16345
+ this.resultPointCallback = hints === null || hints === void 0 ? null : (
18350
16346
  /*(ResultPointCallback) */
18351
- hints2.get(DecodeHintType$1.NEED_RESULT_POINT_CALLBACK)
16347
+ hints.get(DecodeHintType$1.NEED_RESULT_POINT_CALLBACK)
18352
16348
  );
18353
16349
  var finder = new FinderPatternFinder(this.image, this.resultPointCallback);
18354
- var info = finder.find(hints2);
16350
+ var info = finder.find(hints);
18355
16351
  return this.processFinderPatternInfo(info);
18356
16352
  };
18357
16353
  Detector2.prototype.processFinderPatternInfo = function(info) {
@@ -18574,16 +16570,16 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
18574
16570
  QRCodeReader2.prototype.getDecoder = function() {
18575
16571
  return this.decoder;
18576
16572
  };
18577
- QRCodeReader2.prototype.decode = function(image, hints2) {
16573
+ QRCodeReader2.prototype.decode = function(image, hints) {
18578
16574
  var decoderResult;
18579
16575
  var points;
18580
- if (hints2 !== void 0 && hints2 !== null && void 0 !== hints2.get(DecodeHintType$1.PURE_BARCODE)) {
16576
+ if (hints !== void 0 && hints !== null && void 0 !== hints.get(DecodeHintType$1.PURE_BARCODE)) {
18581
16577
  var bits = QRCodeReader2.extractPureBits(image.getBlackMatrix());
18582
- decoderResult = this.decoder.decodeBitMatrix(bits, hints2);
16578
+ decoderResult = this.decoder.decodeBitMatrix(bits, hints);
18583
16579
  points = QRCodeReader2.NO_POINTS;
18584
16580
  } else {
18585
- var detectorResult = new Detector$1(image.getBlackMatrix()).detect(hints2);
18586
- decoderResult = this.decoder.decodeBitMatrix(detectorResult.getBits(), hints2);
16581
+ var detectorResult = new Detector$1(image.getBlackMatrix()).detect(hints);
16582
+ decoderResult = this.decoder.decodeBitMatrix(detectorResult.getBits(), hints);
18587
16583
  points = detectorResult.getPoints();
18588
16584
  }
18589
16585
  if (decoderResult.getOther() instanceof QRCodeDecoderMetaData) {
@@ -24367,7 +22363,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
24367
22363
  function() {
24368
22364
  function Detector2() {
24369
22365
  }
24370
- Detector2.detectMultiple = function(image, hints2, multiple) {
22366
+ Detector2.detectMultiple = function(image, hints, multiple) {
24371
22367
  var bitMatrix = image.getBlackMatrix();
24372
22368
  var barcodeCoordinates = Detector2.detect(multiple, bitMatrix);
24373
22369
  if (!barcodeCoordinates.length) {
@@ -26754,7 +24750,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
26754
24750
  };
26755
24751
  DecodedBitStreamParser2.byteCompaction = function(mode, codewords, encoding, codeIndex, result) {
26756
24752
  var decodedBytes = new ByteArrayOutputStream();
26757
- var count2 = 0;
24753
+ var count = 0;
26758
24754
  var value = (
26759
24755
  /*long*/
26760
24756
  0
@@ -26765,7 +24761,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
26765
24761
  var byteCompactedCodewords = new Int32Array(6);
26766
24762
  var nextCode = codewords[codeIndex++];
26767
24763
  while (codeIndex < codewords[0] && !end) {
26768
- byteCompactedCodewords[count2++] = nextCode;
24764
+ byteCompactedCodewords[count++] = nextCode;
26769
24765
  value = 900 * value + nextCode;
26770
24766
  nextCode = codewords[codeIndex++];
26771
24767
  switch (nextCode) {
@@ -26780,7 +24776,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
26780
24776
  end = true;
26781
24777
  break;
26782
24778
  default:
26783
- if (count2 % 5 === 0 && count2 > 0) {
24779
+ if (count % 5 === 0 && count > 0) {
26784
24780
  for (var j = 0; j < 6; ++j) {
26785
24781
  decodedBytes.write(
26786
24782
  /*(byte)*/
@@ -26788,15 +24784,15 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
26788
24784
  );
26789
24785
  }
26790
24786
  value = 0;
26791
- count2 = 0;
24787
+ count = 0;
26792
24788
  }
26793
24789
  break;
26794
24790
  }
26795
24791
  }
26796
24792
  if (codeIndex === codewords[0] && nextCode < DecodedBitStreamParser2.TEXT_COMPACTION_MODE_LATCH) {
26797
- byteCompactedCodewords[count2++] = nextCode;
24793
+ byteCompactedCodewords[count++] = nextCode;
26798
24794
  }
26799
- for (var i = 0; i < count2; i++) {
24795
+ for (var i = 0; i < count; i++) {
26800
24796
  decodedBytes.write(
26801
24797
  /*(byte)*/
26802
24798
  byteCompactedCodewords[i]
@@ -26807,7 +24803,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
26807
24803
  while (codeIndex < codewords[0] && !end) {
26808
24804
  var code = codewords[codeIndex++];
26809
24805
  if (code < DecodedBitStreamParser2.TEXT_COMPACTION_MODE_LATCH) {
26810
- count2++;
24806
+ count++;
26811
24807
  value = 900 * value + code;
26812
24808
  } else {
26813
24809
  switch (code) {
@@ -26823,7 +24819,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
26823
24819
  break;
26824
24820
  }
26825
24821
  }
26826
- if (count2 % 5 === 0 && count2 > 0) {
24822
+ if (count % 5 === 0 && count > 0) {
26827
24823
  for (var j = 0; j < 6; ++j) {
26828
24824
  decodedBytes.write(
26829
24825
  /*(byte)*/
@@ -26831,7 +24827,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
26831
24827
  );
26832
24828
  }
26833
24829
  value = 0;
26834
- count2 = 0;
24830
+ count = 0;
26835
24831
  }
26836
24832
  }
26837
24833
  break;
@@ -26840,7 +24836,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
26840
24836
  return codeIndex;
26841
24837
  };
26842
24838
  DecodedBitStreamParser2.numericCompaction = function(codewords, codeIndex, result) {
26843
- var count2 = 0;
24839
+ var count = 0;
26844
24840
  var end = false;
26845
24841
  var numericCodewords = new Int32Array(DecodedBitStreamParser2.MAX_NUMERIC_CODEWORDS);
26846
24842
  while (codeIndex < codewords[0] && !end) {
@@ -26849,8 +24845,8 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
26849
24845
  end = true;
26850
24846
  }
26851
24847
  if (code < DecodedBitStreamParser2.TEXT_COMPACTION_MODE_LATCH) {
26852
- numericCodewords[count2] = code;
26853
- count2++;
24848
+ numericCodewords[count] = code;
24849
+ count++;
26854
24850
  } else {
26855
24851
  switch (code) {
26856
24852
  case DecodedBitStreamParser2.TEXT_COMPACTION_MODE_LATCH:
@@ -26864,17 +24860,17 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
26864
24860
  break;
26865
24861
  }
26866
24862
  }
26867
- if ((count2 % DecodedBitStreamParser2.MAX_NUMERIC_CODEWORDS === 0 || code === DecodedBitStreamParser2.NUMERIC_COMPACTION_MODE_LATCH || end) && count2 > 0) {
26868
- result.append(DecodedBitStreamParser2.decodeBase900toBase10(numericCodewords, count2));
26869
- count2 = 0;
24863
+ if ((count % DecodedBitStreamParser2.MAX_NUMERIC_CODEWORDS === 0 || code === DecodedBitStreamParser2.NUMERIC_COMPACTION_MODE_LATCH || end) && count > 0) {
24864
+ result.append(DecodedBitStreamParser2.decodeBase900toBase10(numericCodewords, count));
24865
+ count = 0;
26870
24866
  }
26871
24867
  }
26872
24868
  return codeIndex;
26873
24869
  };
26874
- DecodedBitStreamParser2.decodeBase900toBase10 = function(codewords, count2) {
24870
+ DecodedBitStreamParser2.decodeBase900toBase10 = function(codewords, count) {
26875
24871
  var result = createBigInt(0);
26876
- for (var i = 0; i < count2; i++) {
26877
- result += DecodedBitStreamParser2.EXP900[count2 - i - 1] * createBigInt(codewords[i]);
24872
+ for (var i = 0; i < count; i++) {
24873
+ result += DecodedBitStreamParser2.EXP900[count - i - 1] * createBigInt(codewords[i]);
26878
24874
  }
26879
24875
  var resultString = result.toString();
26880
24876
  if (resultString.charAt(0) !== "1") {
@@ -27447,22 +25443,22 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
27447
25443
  function() {
27448
25444
  function PDF417Reader2() {
27449
25445
  }
27450
- PDF417Reader2.prototype.decode = function(image, hints2) {
27451
- if (hints2 === void 0) {
27452
- hints2 = null;
25446
+ PDF417Reader2.prototype.decode = function(image, hints) {
25447
+ if (hints === void 0) {
25448
+ hints = null;
27453
25449
  }
27454
- var result = PDF417Reader2.decode(image, hints2, false);
25450
+ var result = PDF417Reader2.decode(image, hints, false);
27455
25451
  if (result == null || result.length === 0 || result[0] == null) {
27456
25452
  throw NotFoundException.getNotFoundInstance();
27457
25453
  }
27458
25454
  return result[0];
27459
25455
  };
27460
- PDF417Reader2.prototype.decodeMultiple = function(image, hints2) {
27461
- if (hints2 === void 0) {
27462
- hints2 = null;
25456
+ PDF417Reader2.prototype.decodeMultiple = function(image, hints) {
25457
+ if (hints === void 0) {
25458
+ hints = null;
27463
25459
  }
27464
25460
  try {
27465
- return PDF417Reader2.decode(image, hints2, true);
25461
+ return PDF417Reader2.decode(image, hints, true);
27466
25462
  } catch (ignored) {
27467
25463
  if (ignored instanceof FormatException || ignored instanceof ChecksumException) {
27468
25464
  throw NotFoundException.getNotFoundInstance();
@@ -27470,10 +25466,10 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
27470
25466
  throw ignored;
27471
25467
  }
27472
25468
  };
27473
- PDF417Reader2.decode = function(image, hints2, multiple) {
25469
+ PDF417Reader2.decode = function(image, hints, multiple) {
27474
25470
  var e_1, _a2;
27475
25471
  var results = new Array();
27476
- var detectorResult = Detector.detectMultiple(image, hints2, multiple);
25472
+ var detectorResult = Detector.detectMultiple(image, hints, multiple);
27477
25473
  try {
27478
25474
  for (var _b = __values$9(detectorResult.getPoints()), _c = _b.next(); !_c.done; _c = _b.next()) {
27479
25475
  var points = _c.value;
@@ -27566,8 +25562,8 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
27566
25562
  function() {
27567
25563
  function MultiFormatReader2() {
27568
25564
  }
27569
- MultiFormatReader2.prototype.decode = function(image, hints2) {
27570
- this.setHints(hints2);
25565
+ MultiFormatReader2.prototype.decode = function(image, hints) {
25566
+ this.setHints(hints);
27571
25567
  return this.decodeInternal(image);
27572
25568
  };
27573
25569
  MultiFormatReader2.prototype.decodeWithState = function(image) {
@@ -27576,17 +25572,17 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
27576
25572
  }
27577
25573
  return this.decodeInternal(image);
27578
25574
  };
27579
- MultiFormatReader2.prototype.setHints = function(hints2) {
27580
- this.hints = hints2;
27581
- var tryHarder = hints2 !== null && hints2 !== void 0 && void 0 !== hints2.get(DecodeHintType$1.TRY_HARDER);
27582
- var formats = hints2 === null || hints2 === void 0 ? null : hints2.get(DecodeHintType$1.POSSIBLE_FORMATS);
25575
+ MultiFormatReader2.prototype.setHints = function(hints) {
25576
+ this.hints = hints;
25577
+ var tryHarder = hints !== null && hints !== void 0 && void 0 !== hints.get(DecodeHintType$1.TRY_HARDER);
25578
+ var formats = hints === null || hints === void 0 ? null : hints.get(DecodeHintType$1.POSSIBLE_FORMATS);
27583
25579
  var readers = new Array();
27584
25580
  if (formats !== null && formats !== void 0) {
27585
25581
  var addOneDReader = formats.some(function(f) {
27586
25582
  return f === BarcodeFormat$1.UPC_A || f === BarcodeFormat$1.UPC_E || f === BarcodeFormat$1.EAN_13 || f === BarcodeFormat$1.EAN_8 || f === BarcodeFormat$1.CODABAR || f === BarcodeFormat$1.CODE_39 || f === BarcodeFormat$1.CODE_93 || f === BarcodeFormat$1.CODE_128 || f === BarcodeFormat$1.ITF || f === BarcodeFormat$1.RSS_14 || f === BarcodeFormat$1.RSS_EXPANDED;
27587
25583
  });
27588
25584
  if (addOneDReader && !tryHarder) {
27589
- readers.push(new MultiFormatOneDReader(hints2));
25585
+ readers.push(new MultiFormatOneDReader(hints));
27590
25586
  }
27591
25587
  if (formats.includes(BarcodeFormat$1.QR_CODE)) {
27592
25588
  readers.push(new QRCodeReader());
@@ -27601,19 +25597,19 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
27601
25597
  readers.push(new PDF417Reader());
27602
25598
  }
27603
25599
  if (addOneDReader && tryHarder) {
27604
- readers.push(new MultiFormatOneDReader(hints2));
25600
+ readers.push(new MultiFormatOneDReader(hints));
27605
25601
  }
27606
25602
  }
27607
25603
  if (readers.length === 0) {
27608
25604
  if (!tryHarder) {
27609
- readers.push(new MultiFormatOneDReader(hints2));
25605
+ readers.push(new MultiFormatOneDReader(hints));
27610
25606
  }
27611
25607
  readers.push(new QRCodeReader());
27612
25608
  readers.push(new DataMatrixReader());
27613
25609
  readers.push(new AztecReader());
27614
25610
  readers.push(new PDF417Reader());
27615
25611
  if (tryHarder) {
27616
- readers.push(new MultiFormatOneDReader(hints2));
25612
+ readers.push(new MultiFormatOneDReader(hints));
27617
25613
  }
27618
25614
  }
27619
25615
  this.readers = readers;
@@ -27686,16 +25682,16 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
27686
25682
  }();
27687
25683
  (function(_super) {
27688
25684
  __extends$c(BrowserMultiFormatReader, _super);
27689
- function BrowserMultiFormatReader(hints2, timeBetweenScansMillis) {
27690
- if (hints2 === void 0) {
27691
- hints2 = null;
25685
+ function BrowserMultiFormatReader(hints, timeBetweenScansMillis) {
25686
+ if (hints === void 0) {
25687
+ hints = null;
27692
25688
  }
27693
25689
  if (timeBetweenScansMillis === void 0) {
27694
25690
  timeBetweenScansMillis = 500;
27695
25691
  }
27696
25692
  var _this = this;
27697
25693
  var reader = new MultiFormatReader();
27698
- reader.setHints(hints2);
25694
+ reader.setHints(hints);
27699
25695
  _this = _super.call(this, reader, timeBetweenScansMillis) || this;
27700
25696
  return _this;
27701
25697
  }
@@ -28498,14 +26494,14 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
28498
26494
  Encoder.calculateMaskPenalty = function(matrix) {
28499
26495
  return MaskUtil.applyMaskPenaltyRule1(matrix) + MaskUtil.applyMaskPenaltyRule2(matrix) + MaskUtil.applyMaskPenaltyRule3(matrix) + MaskUtil.applyMaskPenaltyRule4(matrix);
28500
26496
  };
28501
- Encoder.encode = function(content, ecLevel, hints2) {
28502
- if (hints2 === void 0) {
28503
- hints2 = null;
26497
+ Encoder.encode = function(content, ecLevel, hints) {
26498
+ if (hints === void 0) {
26499
+ hints = null;
28504
26500
  }
28505
26501
  var encoding = Encoder.DEFAULT_BYTE_MODE_ENCODING;
28506
- var hasEncodingHint = hints2 !== null && void 0 !== hints2.get(EncodeHintType$1.CHARACTER_SET);
26502
+ var hasEncodingHint = hints !== null && void 0 !== hints.get(EncodeHintType$1.CHARACTER_SET);
28507
26503
  if (hasEncodingHint) {
28508
- encoding = hints2.get(EncodeHintType$1.CHARACTER_SET).toString();
26504
+ encoding = hints.get(EncodeHintType$1.CHARACTER_SET).toString();
28509
26505
  }
28510
26506
  var mode = this.chooseMode(content, encoding);
28511
26507
  var headerBits = new BitArray();
@@ -28519,8 +26515,8 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
28519
26515
  var dataBits = new BitArray();
28520
26516
  this.appendBytes(content, mode, dataBits, encoding);
28521
26517
  var version;
28522
- if (hints2 !== null && void 0 !== hints2.get(EncodeHintType$1.QR_VERSION)) {
28523
- var versionNumber = Number.parseInt(hints2.get(EncodeHintType$1.QR_VERSION).toString(), 10);
26518
+ if (hints !== null && void 0 !== hints.get(EncodeHintType$1.QR_VERSION)) {
26519
+ var versionNumber = Number.parseInt(hints.get(EncodeHintType$1.QR_VERSION).toString(), 10);
28524
26520
  version = Version.getVersionForNumber(versionNumber);
28525
26521
  var bitsNeeded = this.calculateBitsNeeded(mode, headerBits, dataBits, version);
28526
26522
  if (!this.willFit(bitsNeeded, version, ecLevel)) {
@@ -29458,8 +27454,8 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
29458
27454
  }
29459
27455
  break;
29460
27456
  }
29461
- var count2 = buffer.length();
29462
- if (count2 % 3 === 0) {
27457
+ var count = buffer.length();
27458
+ if (count % 3 === 0) {
29463
27459
  var newMode = HighLevelEncoder$1.lookAheadTest(context.getMessage(), context.pos, this.getEncodingMode());
29464
27460
  if (newMode !== this.getEncodingMode()) {
29465
27461
  context.signalEncoderChange(ASCII_ENCODATION);
@@ -29470,8 +27466,8 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
29470
27466
  this.handleEOD(context, buffer);
29471
27467
  };
29472
27468
  C40Encoder2.prototype.backtrackOneCharacter = function(context, buffer, removed, lastCharSize) {
29473
- var count2 = buffer.length();
29474
- var test = buffer.toString().substring(0, count2 - lastCharSize);
27469
+ var count = buffer.length();
27470
+ var test = buffer.toString().substring(0, count - lastCharSize);
29475
27471
  buffer.setLengthToZero();
29476
27472
  buffer.append(test);
29477
27473
  context.pos--;
@@ -29589,8 +27585,8 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
29589
27585
  var c = context.getCurrentChar();
29590
27586
  this.encodeChar(c, buffer);
29591
27587
  context.pos++;
29592
- var count2 = buffer.length();
29593
- if (count2 >= 4) {
27588
+ var count = buffer.length();
27589
+ if (count >= 4) {
29594
27590
  context.writeCodewords(this.encodeToCodewords(buffer.toString()));
29595
27591
  var test_1 = buffer.toString().substring(4);
29596
27592
  buffer.setLengthToZero();
@@ -29607,11 +27603,11 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
29607
27603
  };
29608
27604
  EdifactEncoder2.prototype.handleEOD = function(context, buffer) {
29609
27605
  try {
29610
- var count2 = buffer.length();
29611
- if (count2 === 0) {
27606
+ var count = buffer.length();
27607
+ if (count === 0) {
29612
27608
  return;
29613
27609
  }
29614
- if (count2 === 1) {
27610
+ if (count === 1) {
29615
27611
  context.updateSymbolInfo();
29616
27612
  var available = context.getSymbolInfo().getDataCapacity() - context.getCodewordCount();
29617
27613
  var remaining = context.getRemainingCharacters();
@@ -29623,10 +27619,10 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
29623
27619
  return;
29624
27620
  }
29625
27621
  }
29626
- if (count2 > 4) {
27622
+ if (count > 4) {
29627
27623
  throw new Error("Count must not exceed 4");
29628
27624
  }
29629
- var restChars = count2 - 1;
27625
+ var restChars = count - 1;
29630
27626
  var encoded = this.encodeToCodewords(buffer.toString());
29631
27627
  var endOfSymbolReached = !context.hasMoreCharacters();
29632
27628
  var restInAscii = endOfSymbolReached && restChars <= 2;
@@ -29929,8 +27925,8 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
29929
27925
  EncoderContext2.prototype.getMessage = function() {
29930
27926
  return this.msg;
29931
27927
  };
29932
- EncoderContext2.prototype.setSkipAtEnd = function(count2) {
29933
- this.skipAtEnd = count2;
27928
+ EncoderContext2.prototype.setSkipAtEnd = function(count) {
27929
+ this.skipAtEnd = count;
29934
27930
  };
29935
27931
  EncoderContext2.prototype.getCurrentChar = function() {
29936
27932
  return this.msg.charCodeAt(this.pos);
@@ -30018,8 +28014,8 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
30018
28014
  var c = context.getCurrentChar();
30019
28015
  context.pos++;
30020
28016
  this.encodeChar(c, buffer);
30021
- var count2 = buffer.length();
30022
- if (count2 % 3 === 0) {
28017
+ var count = buffer.length();
28018
+ if (count % 3 === 0) {
30023
28019
  this.writeNextTriplet(context, buffer);
30024
28020
  var newMode = HighLevelEncoder$1.lookAheadTest(context.getMessage(), context.pos, this.getEncodingMode());
30025
28021
  if (newMode !== this.getEncodingMode()) {
@@ -30059,8 +28055,8 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
30059
28055
  X12Encoder2.prototype.handleEOD = function(context, buffer) {
30060
28056
  context.updateSymbolInfo();
30061
28057
  var available = context.getSymbolInfo().getDataCapacity() - context.getCodewordCount();
30062
- var count2 = buffer.length();
30063
- context.pos -= count2;
28058
+ var count = buffer.length();
28059
+ context.pos -= count;
30064
28060
  if (context.getRemainingCharacters() > 1 || available > 1 || context.getRemainingCharacters() !== available) {
30065
28061
  context.writeCodeword(X12_UNLATCH);
30066
28062
  }
@@ -31846,6 +29842,58 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
31846
29842
  ]);
31847
29843
  return Encoder;
31848
29844
  })();
29845
+ const SCANNER_HINTS = /* @__PURE__ */ new Map([
29846
+ [
29847
+ reactZxing.DecodeHintType.POSSIBLE_FORMATS,
29848
+ [
29849
+ BarcodeFormat$1.AZTEC,
29850
+ BarcodeFormat$1.CODABAR,
29851
+ BarcodeFormat$1.CODE_39,
29852
+ BarcodeFormat$1.CODE_93,
29853
+ BarcodeFormat$1.CODE_128,
29854
+ BarcodeFormat$1.DATA_MATRIX,
29855
+ BarcodeFormat$1.EAN_8,
29856
+ BarcodeFormat$1.EAN_13,
29857
+ BarcodeFormat$1.ITF,
29858
+ BarcodeFormat$1.MAXICODE,
29859
+ BarcodeFormat$1.PDF_417,
29860
+ BarcodeFormat$1.QR_CODE,
29861
+ BarcodeFormat$1.RSS_14,
29862
+ BarcodeFormat$1.RSS_EXPANDED,
29863
+ BarcodeFormat$1.UPC_A,
29864
+ BarcodeFormat$1.UPC_E,
29865
+ BarcodeFormat$1.UPC_EAN_EXTENSION
29866
+ ]
29867
+ ]
29868
+ ]);
29869
+ const Scanner = React.memo((props) => {
29870
+ const { children, open, onOpenChange, defaultOpen, modal, ...rest } = props;
29871
+ return /* @__PURE__ */ jsxRuntime.jsxs(blocks.Overlay.Root, { open, onOpenChange, defaultOpen, modal, children: [
29872
+ !!children && /* @__PURE__ */ jsxRuntime.jsx(blocks.Overlay.Trigger, { asChild: true, children }),
29873
+ /* @__PURE__ */ jsxRuntime.jsxs(blocks.Overlay.Content, { children: [
29874
+ /* @__PURE__ */ jsxRuntime.jsx(blocks.Overlay.Title, { className: "sr-only", children: "Scanner" }),
29875
+ /* @__PURE__ */ jsxRuntime.jsx(blocks.Overlay.Description, { className: "sr-only", children: "Scan a barcode or a qr code." }),
29876
+ /* @__PURE__ */ jsxRuntime.jsx(ScannerInternal, { ...rest })
29877
+ ] })
29878
+ ] });
29879
+ });
29880
+ Scanner.displayName = "Scanner";
29881
+ const ScannerInternal = React.memo((props) => {
29882
+ const { paused, timeBetweenDecodingAttempts, onDecodeResult, onDecodeError, onError } = props;
29883
+ const { ref } = reactZxing.useZxing({
29884
+ paused,
29885
+ timeBetweenDecodingAttempts,
29886
+ onDecodeResult,
29887
+ onDecodeError,
29888
+ onError,
29889
+ hints: SCANNER_HINTS
29890
+ });
29891
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex size-full flex-col justify-center overflow-hidden bg-(--color-background)", children: [
29892
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex w-full justify-end p-4", children: /* @__PURE__ */ jsxRuntime.jsx(blocks.Overlay.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(blocks.IconButton, { "aria-label": "close", variant: "soft", accentColor: "base", children: /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: "x" }) }) }) }),
29893
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "grow w-full max-h-full overflow-hidden p-4", children: /* @__PURE__ */ jsxRuntime.jsx("video", { className: "size-full", ref }) })
29894
+ ] });
29895
+ });
29896
+ ScannerInternal.displayName = "ScannerInternal";
31849
29897
  const ScanInput = React.memo((props) => {
31850
29898
  const [
31851
29899
  { inputId, labelId, label, helpText, size, severity, showInputOnly, field, fieldProps, helpers, touched },
@@ -31875,20 +29923,18 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
31875
29923
  }, [internalValue, onBlur, onChange]);
31876
29924
  const handleScan = React.useCallback(
31877
29925
  (data) => {
31878
- onChange(data);
29926
+ onChange(data.getText());
31879
29927
  setShowScanner(false);
31880
29928
  },
31881
29929
  [onChange]
31882
29930
  );
31883
- const handleScannerOpenChange = React.useCallback(
31884
- (open) => {
31885
- setShowScanner(open);
31886
- if (!open) {
31887
- onBlur(value);
31888
- }
31889
- },
31890
- [onBlur, value]
31891
- );
29931
+ const handleOpenScanner = React.useCallback(() => {
29932
+ setShowScanner(true);
29933
+ }, []);
29934
+ const handleScannerOpenChange = React.useCallback(() => {
29935
+ setShowScanner(false);
29936
+ onBlur(value);
29937
+ }, [onBlur, value]);
31892
29938
  return /* @__PURE__ */ jsxRuntime.jsx(InputWithLabelAndHelpText, { helpText: computedHelpText, severity, children: /* @__PURE__ */ jsxRuntime.jsxs(
31893
29939
  InputWithLabel,
31894
29940
  {
@@ -31916,74 +29962,30 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
31916
29962
  ...rest
31917
29963
  }
31918
29964
  ),
31919
- /* @__PURE__ */ jsxRuntime.jsxs(Root, { open: showScanner, onOpenChange: handleScannerOpenChange, children: [
31920
- /* @__PURE__ */ jsxRuntime.jsx(Trigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(blocks.Button, { className: "w-max", type: "button", variant: "soft", size: "sm", accentColor: "base", children: [
31921
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Maximize, { className: "h-4 w-4" }),
31922
- "Scan"
31923
- ] }) }),
31924
- /* @__PURE__ */ jsxRuntime.jsxs(Portal, { children: [
31925
- /* @__PURE__ */ jsxRuntime.jsx(Overlay, { className: "light:bg-(--black-a6) fixed inset-0 dark:bg-(--black-a8)" }),
31926
- /* @__PURE__ */ jsxRuntime.jsx(Content, { className: "fixed inset-0", children: /* @__PURE__ */ jsxRuntime.jsx(Scanner, { onScan: handleScan }) })
31927
- ] })
31928
- ] })
29965
+ /* @__PURE__ */ jsxRuntime.jsxs(
29966
+ blocks.Button,
29967
+ {
29968
+ onClick: handleOpenScanner,
29969
+ className: "w-max",
29970
+ type: "button",
29971
+ variant: "soft",
29972
+ size: "sm",
29973
+ accentColor: "base",
29974
+ children: [
29975
+ /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: "maximize" }),
29976
+ "Scan"
29977
+ ]
29978
+ }
29979
+ ),
29980
+ /* @__PURE__ */ jsxRuntime.jsx(Scanner, { open: showScanner, onDecodeResult: handleScan, onOpenChange: handleScannerOpenChange })
31929
29981
  ]
31930
29982
  }
31931
29983
  ) });
31932
29984
  });
31933
29985
  ScanInput.displayName = "QrInput";
31934
- const hints = /* @__PURE__ */ new Map([
31935
- [
31936
- reactZxing.DecodeHintType.POSSIBLE_FORMATS,
31937
- [
31938
- BarcodeFormat$1.AZTEC,
31939
- BarcodeFormat$1.CODABAR,
31940
- BarcodeFormat$1.CODE_39,
31941
- BarcodeFormat$1.CODE_93,
31942
- BarcodeFormat$1.CODE_128,
31943
- BarcodeFormat$1.DATA_MATRIX,
31944
- BarcodeFormat$1.EAN_8,
31945
- BarcodeFormat$1.EAN_13,
31946
- BarcodeFormat$1.ITF,
31947
- BarcodeFormat$1.MAXICODE,
31948
- BarcodeFormat$1.PDF_417,
31949
- BarcodeFormat$1.QR_CODE,
31950
- BarcodeFormat$1.RSS_14,
31951
- BarcodeFormat$1.RSS_EXPANDED,
31952
- BarcodeFormat$1.UPC_A,
31953
- BarcodeFormat$1.UPC_E,
31954
- BarcodeFormat$1.UPC_EAN_EXTENSION
31955
- ]
31956
- ]
31957
- ]);
31958
- const Scanner = React.memo((props) => {
31959
- const { onScan } = props;
31960
- const { showError } = blocks.useToast();
31961
- const handleDecodeResult = React.useCallback(
31962
- (result) => {
31963
- onScan(result.getText());
31964
- },
31965
- [onScan]
31966
- );
31967
- const handleError = React.useCallback(() => {
31968
- showError({
31969
- title: "Scan Error",
31970
- description: "An unknown error occurred while scanning."
31971
- });
31972
- }, [showError]);
31973
- const { ref } = reactZxing.useZxing({
31974
- onDecodeResult: handleDecodeResult,
31975
- onError: handleError,
31976
- hints
31977
- });
31978
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative flex size-full flex-col justify-center overflow-hidden p-4 gap-4 bg-(--color-background)", children: [
31979
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex w-full", children: /* @__PURE__ */ jsxRuntime.jsx(Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(blocks.IconButton, { "aria-label": "close", variant: "soft", accentColor: "base", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, { className: "h-4 w-4" }) }) }) }),
31980
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "relative grow w-full max-h-full overflow-hidden", children: /* @__PURE__ */ jsxRuntime.jsx("video", { className: "size-full", ref }) })
31981
- ] });
31982
- });
31983
- Scanner.displayName = "QrScanner";
31984
29986
  const _ScanField = class _ScanField extends BaseField {
31985
- constructor(options2) {
31986
- super(options2);
29987
+ constructor(options) {
29988
+ super(options);
31987
29989
  __publicField(this, "type", "qr");
31988
29990
  __publicField(this, "onlyValidateAfterTouched", false);
31989
29991
  }
@@ -31999,8 +30001,8 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
31999
30001
  identifier
32000
30002
  });
32001
30003
  }
32002
- setOptions(options2) {
32003
- super.setOptions(options2);
30004
+ setOptions(options) {
30005
+ super.setOptions(options);
32004
30006
  }
32005
30007
  static deserialize(data) {
32006
30008
  return new _ScanField(data);
@@ -32085,10 +30087,10 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
32085
30087
  });
32086
30088
  StringInput.displayName = "StringInput";
32087
30089
  const _StringField = class _StringField extends BaseStringField {
32088
- constructor(options2) {
32089
- const { ...rest } = options2;
32090
- const maxLength = options2.maxLength ? Math.min(SHORT_TEXT_FIELD_MAX_LENGTH, options2.maxLength) : SHORT_TEXT_FIELD_MAX_LENGTH;
32091
- const minLength = options2.minLength ? Math.min(options2.minLength, maxLength) : void 0;
30090
+ constructor(options) {
30091
+ const { ...rest } = options;
30092
+ const maxLength = options.maxLength ? Math.min(SHORT_TEXT_FIELD_MAX_LENGTH, options.maxLength) : SHORT_TEXT_FIELD_MAX_LENGTH;
30093
+ const minLength = options.minLength ? Math.min(options.minLength, maxLength) : void 0;
32092
30094
  super({ ...rest, maxLength, minLength });
32093
30095
  __publicField(this, "type", "string");
32094
30096
  }
@@ -32104,8 +30106,8 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
32104
30106
  identifier
32105
30107
  });
32106
30108
  }
32107
- setOptions(options2) {
32108
- super.setOptions(options2);
30109
+ setOptions(options) {
30110
+ super.setOptions(options);
32109
30111
  }
32110
30112
  static deserialize(data) {
32111
30113
  if (data.type !== "string") throw new Error("Type mismatch.");
@@ -32181,10 +30183,10 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
32181
30183
  });
32182
30184
  TextInput.displayName = "TextInput";
32183
30185
  const _TextField = class _TextField extends BaseStringField {
32184
- constructor(options2) {
32185
- const maxLength = options2.maxLength ? Math.min(LONG_TEXT_FIELD_MAX_LENGTH, options2.maxLength) : LONG_TEXT_FIELD_MAX_LENGTH;
32186
- const minLength = options2.minLength ? Math.min(options2.minLength, maxLength) : void 0;
32187
- super({ ...options2, maxLength, minLength });
30186
+ constructor(options) {
30187
+ const maxLength = options.maxLength ? Math.min(LONG_TEXT_FIELD_MAX_LENGTH, options.maxLength) : LONG_TEXT_FIELD_MAX_LENGTH;
30188
+ const minLength = options.minLength ? Math.min(options.minLength, maxLength) : void 0;
30189
+ super({ ...options, maxLength, minLength });
32188
30190
  __publicField(this, "type", "text");
32189
30191
  }
32190
30192
  serialize() {
@@ -32199,8 +30201,8 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
32199
30201
  identifier
32200
30202
  });
32201
30203
  }
32202
- setOptions(options2) {
32203
- super.setOptions(options2);
30204
+ setOptions(options) {
30205
+ super.setOptions(options);
32204
30206
  }
32205
30207
  static deserialize(data) {
32206
30208
  const { maximum_length, minimum_length, ...rest } = data;
@@ -32244,7 +30246,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
32244
30246
  "bg-transparent": !file
32245
30247
  }),
32246
30248
  children: [
32247
- error ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.FileWarning, { className: "h-4 w-4" }) : file && /* @__PURE__ */ jsxRuntime.jsx(lucideReact.File, { className: "h-4 w-4", style: { color: "var(--base-a11)" } }),
30249
+ error ? /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: "file-warning" }) : file && /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: "file" }),
32248
30250
  /* @__PURE__ */ jsxRuntime.jsx(blocks.Text, { className: "truncate", size: "sm", children: error ?? (file == null ? void 0 : file.name) }),
32249
30251
  rightSlot
32250
30252
  ]
@@ -32399,8 +30401,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
32399
30401
  type: "button",
32400
30402
  ...rest,
32401
30403
  children: [
32402
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Upload, { className: "h-4 w-4" }),
32403
- " ",
30404
+ /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: "upload" }),
32404
30405
  buttonText
32405
30406
  ]
32406
30407
  }
@@ -32505,10 +30506,10 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
32505
30506
  type: "button",
32506
30507
  onClick: handleDownload,
32507
30508
  disabled: !resolvedFile,
32508
- children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Download, { className: "h-4 w-4" })
30509
+ children: /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: "download" })
32509
30510
  }
32510
30511
  ),
32511
- !disabled && /* @__PURE__ */ jsxRuntime.jsx(blocks.IconButton, { type: "button", "aria-label": `Remove ${name}`, disabled, onClick: handleDelete, children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Trash2, { className: "h-4 w-4" }) })
30512
+ !disabled && /* @__PURE__ */ jsxRuntime.jsx(blocks.IconButton, { type: "button", "aria-label": `Remove ${name}`, disabled, onClick: handleDelete, children: /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: "trash" }) })
32512
30513
  ] }),
32513
30514
  [disabled, handleDelete, handleDownload, name, resolvedFile]
32514
30515
  );
@@ -32525,8 +30526,8 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
32525
30526
  });
32526
30527
  DisplayFile.displayName = "DisplayFile";
32527
30528
  const _UploadField = class _UploadField extends BaseField {
32528
- constructor(options2) {
32529
- const { extensions, maximum_files, maximum_size, ...base } = options2;
30529
+ constructor(options) {
30530
+ const { extensions, maximum_files, maximum_size, ...base } = options;
32530
30531
  super(base);
32531
30532
  __publicField(this, "type", "upload");
32532
30533
  __publicField(this, "extensions");
@@ -32636,8 +30637,8 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
32636
30637
  identifier
32637
30638
  });
32638
30639
  }
32639
- setOptions(options2) {
32640
- const { extensions, maximum_files, maximum_size, ...rest } = options2;
30640
+ setOptions(options) {
30641
+ const { extensions, maximum_files, maximum_size, ...rest } = options;
32641
30642
  this.maxFileSize = typeof maximum_size === "number" ? maximum_size : this.maxFileSize;
32642
30643
  this.maxFiles = typeof maximum_files === "number" ? maximum_files : this.maxFiles;
32643
30644
  this.extensions = extensions;
@@ -33435,8 +31436,8 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
33435
31436
  })
33436
31437
  };
33437
31438
  class BooleanFieldCondition extends BaseCondition {
33438
- constructor(options2) {
33439
- super(options2);
31439
+ constructor(options) {
31440
+ super(options);
33440
31441
  __publicField(this, "defaultConditionModifier", "equals");
33441
31442
  __publicField(this, "defaultConditionValue");
33442
31443
  __publicField(this, "modifiers", modifiers$c);
@@ -33532,8 +31533,8 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
33532
31533
  })
33533
31534
  };
33534
31535
  class CheckboxListFieldCondition extends BaseCondition {
33535
- constructor(options2) {
33536
- super(options2);
31536
+ constructor(options) {
31537
+ super(options);
33537
31538
  __publicField(this, "defaultConditionModifier", "equals");
33538
31539
  __publicField(this, "defaultConditionValue");
33539
31540
  __publicField(this, "modifiers", modifiers$b);
@@ -33654,8 +31655,8 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
33654
31655
  })
33655
31656
  };
33656
31657
  class DateFieldCondition extends BaseCondition {
33657
- constructor(options2) {
33658
- super(options2);
31658
+ constructor(options) {
31659
+ super(options);
33659
31660
  __publicField(this, "defaultConditionModifier", "equals");
33660
31661
  __publicField(this, "defaultConditionValue");
33661
31662
  __publicField(this, "modifiers", modifiers$a);
@@ -33751,8 +31752,8 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
33751
31752
  })
33752
31753
  };
33753
31754
  class MultiSelectFieldCondition extends BaseCondition {
33754
- constructor(options2) {
33755
- super(options2);
31755
+ constructor(options) {
31756
+ super(options);
33756
31757
  __publicField(this, "defaultConditionValue");
33757
31758
  __publicField(this, "defaultConditionModifier", "equals");
33758
31759
  __publicField(this, "modifiers", modifiers$9);
@@ -33836,8 +31837,8 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
33836
31837
  })
33837
31838
  };
33838
31839
  class MultiStringFieldCondition extends BaseCondition {
33839
- constructor(options2) {
33840
- super(options2);
31840
+ constructor(options) {
31841
+ super(options);
33841
31842
  __publicField(this, "defaultConditionValue");
33842
31843
  __publicField(this, "defaultConditionModifier", "equals");
33843
31844
  __publicField(this, "modifiers", modifiers$8);
@@ -33974,8 +31975,8 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
33974
31975
  })
33975
31976
  };
33976
31977
  class NumberFieldCondition extends BaseCondition {
33977
- constructor(options2) {
33978
- super(options2);
31978
+ constructor(options) {
31979
+ super(options);
33979
31980
  __publicField(this, "defaultConditionValue");
33980
31981
  __publicField(this, "defaultConditionModifier", "equals");
33981
31982
  __publicField(this, "modifiers", modifiers$7);
@@ -34053,8 +32054,8 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
34053
32054
  })
34054
32055
  };
34055
32056
  class OTPFieldCondition extends BaseCondition {
34056
- constructor(options2) {
34057
- super(options2);
32057
+ constructor(options) {
32058
+ super(options);
34058
32059
  __publicField(this, "defaultConditionValue");
34059
32060
  __publicField(this, "defaultConditionModifier", "equals");
34060
32061
  __publicField(this, "modifiers", modifiers$6);
@@ -34173,8 +32174,8 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
34173
32174
  })
34174
32175
  };
34175
32176
  class RadioFieldCondition extends BaseCondition {
34176
- constructor(options2) {
34177
- super(options2);
32177
+ constructor(options) {
32178
+ super(options);
34178
32179
  __publicField(this, "defaultConditionValue");
34179
32180
  __publicField(this, "defaultConditionModifier", "equals");
34180
32181
  __publicField(this, "modifiers", modifiers$5);
@@ -34252,8 +32253,8 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
34252
32253
  })
34253
32254
  };
34254
32255
  class ScanFieldCondition extends BaseCondition {
34255
- constructor(options2) {
34256
- super(options2);
32256
+ constructor(options) {
32257
+ super(options);
34257
32258
  __publicField(this, "defaultConditionValue");
34258
32259
  __publicField(this, "defaultConditionModifier", "equals");
34259
32260
  __publicField(this, "modifiers", modifiers$4);
@@ -34372,8 +32373,8 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
34372
32373
  })
34373
32374
  };
34374
32375
  class SelectFieldCondition extends BaseCondition {
34375
- constructor(options2) {
34376
- super(options2);
32376
+ constructor(options) {
32377
+ super(options);
34377
32378
  __publicField(this, "defaultConditionValue");
34378
32379
  __publicField(this, "defaultConditionModifier", "equals");
34379
32380
  __publicField(this, "modifiers", modifiers$3);
@@ -34451,8 +32452,8 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
34451
32452
  })
34452
32453
  };
34453
32454
  class StringFieldCondition extends BaseCondition {
34454
- constructor(options2) {
34455
- super(options2);
32455
+ constructor(options) {
32456
+ super(options);
34456
32457
  __publicField(this, "defaultConditionValue");
34457
32458
  __publicField(this, "defaultConditionModifier", "equals");
34458
32459
  __publicField(this, "modifiers", modifiers$2);
@@ -34527,8 +32528,8 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
34527
32528
  })
34528
32529
  };
34529
32530
  class TextFieldCondition extends BaseCondition {
34530
- constructor(options2) {
34531
- super(options2);
32531
+ constructor(options) {
32532
+ super(options);
34532
32533
  __publicField(this, "defaultConditionValue");
34533
32534
  __publicField(this, "defaultConditionModifier", "equals");
34534
32535
  __publicField(this, "modifiers", modifiers$1);
@@ -34599,8 +32600,8 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
34599
32600
  })
34600
32601
  };
34601
32602
  class UploadFieldCondition extends BaseCondition {
34602
- constructor(options2) {
34603
- super(options2);
32603
+ constructor(options) {
32604
+ super(options);
34604
32605
  __publicField(this, "defaultConditionValue");
34605
32606
  __publicField(this, "defaultConditionModifier", "equals");
34606
32607
  __publicField(this, "modifiers", modifiers);
@@ -34795,8 +32796,8 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
34795
32796
  });
34796
32797
  FieldSectionLayout.displayName = "FieldSectionLayout";
34797
32798
  const _FieldSection = class _FieldSection extends BaseFormElement {
34798
- constructor(options2) {
34799
- const { label = null, description = null, fields, conditions = {}, ...base } = options2;
32799
+ constructor(options) {
32800
+ const { label = null, description = null, fields, conditions = {}, ...base } = options;
34800
32801
  super(base);
34801
32802
  __publicField(this, "type", "section");
34802
32803
  __publicField(this, "label");
@@ -34862,8 +32863,8 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
34862
32863
  fields: this.fields.map((field) => field.duplicate(uuid.v4()))
34863
32864
  });
34864
32865
  }
34865
- setOptions(options2) {
34866
- const { label, description, fields, conditions, ...base } = options2;
32866
+ setOptions(options) {
32867
+ const { label, description, fields, conditions, ...base } = options;
34867
32868
  this.label = label ?? this.label;
34868
32869
  this.description = description ?? this.description;
34869
32870
  this.fields = fields || this.fields;
@@ -35256,7 +33257,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
35256
33257
  accentColor: "base",
35257
33258
  ...hasError && { color: SEVERITY_COLOR_MAPPING.danger },
35258
33259
  children: [
35259
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Settings, { className: "h-4 w-4" }),
33260
+ /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: "settings" }),
35260
33261
  "Settings"
35261
33262
  ]
35262
33263
  },
@@ -36508,6 +34509,33 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
36508
34509
  ListBuilder: FormBuilderListBuilder,
36509
34510
  Preview: FormBuilderPreview
36510
34511
  };
34512
+ const ScannerContext = React.createContext(() => {
34513
+ throw new Error("No ScannerProvider found");
34514
+ });
34515
+ const useScanner = () => React.use(ScannerContext);
34516
+ const ScannerProvider = React.memo((props) => {
34517
+ const { children } = props;
34518
+ const [config, setConfig] = React.useState(null);
34519
+ const closeFileViewer = React.useCallback(() => {
34520
+ setConfig(null);
34521
+ }, []);
34522
+ const openFileViewer = React.useCallback(
34523
+ (func) => {
34524
+ setConfig(func(closeFileViewer));
34525
+ },
34526
+ [closeFileViewer]
34527
+ );
34528
+ const handleClose = React.useCallback(() => {
34529
+ if (!config) return;
34530
+ if (config.onClose) config.onClose();
34531
+ closeFileViewer();
34532
+ }, [closeFileViewer, config]);
34533
+ return /* @__PURE__ */ jsxRuntime.jsxs(ScannerContext.Provider, { value: openFileViewer, children: [
34534
+ children,
34535
+ config && /* @__PURE__ */ jsxRuntime.jsx(Scanner, { open: true, onOpenChange: handleClose, ...config })
34536
+ ] });
34537
+ });
34538
+ ScannerProvider.displayName = "FileViewerProvider";
36511
34539
  exports2.BaseCondition = BaseCondition;
36512
34540
  exports2.BaseField = BaseField;
36513
34541
  exports2.BaseFormElement = BaseFormElement;
@@ -36584,6 +34612,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
36584
34612
  exports2.ScanFieldConditionCell = ScanFieldConditionCell;
36585
34613
  exports2.ScanInput = ScanInput;
36586
34614
  exports2.Scanner = Scanner;
34615
+ exports2.ScannerProvider = ScannerProvider;
36587
34616
  exports2.SelectField = SelectField;
36588
34617
  exports2.SelectFieldCondition = SelectFieldCondition;
36589
34618
  exports2.SelectFieldConditionCell = SelectFieldConditionCell;
@@ -36643,6 +34672,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
36643
34672
  exports2.useFieldInputs = useFieldInputs;
36644
34673
  exports2.useFormikInput = useFormikInput;
36645
34674
  exports2.useImageViewer = useImageViewer;
34675
+ exports2.useScanner = useScanner;
36646
34676
  exports2.validateFields = validateFields;
36647
34677
  Object.defineProperty(exports2, Symbol.toStringTag, { value: "Module" });
36648
34678
  });