@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.
package/dist/forms.js CHANGED
@@ -1,11 +1,10 @@
1
1
  var __defProp = Object.defineProperty;
2
2
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
3
  var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
4
- import { jsxs, jsx, Fragment } from "react/jsx-runtime";
5
- import { Card, LuIcon, Text, Spinner, ButtonGroup, Tooltip, IconButton, Separator, Input, Badge, Checkbox, CheckboxGroup, Popover, Button, DayPicker, Menu, OneTimePasswordField, RadioGroup, TextArea, useToast, stopPropagation, Heading, ToggleGroup } from "@overmap-ai/blocks";
4
+ import { jsxs, jsx, Fragment as Fragment$1 } from "react/jsx-runtime";
5
+ import { Card, LuIcon, Text, Spinner, Overlay, ButtonGroup, Tooltip, IconButton, Separator, Input, Badge, Checkbox, CheckboxGroup, Popover, Button, DayPicker, Menu, OneTimePasswordField, RadioGroup, TextArea, stopPropagation, Heading, useToast, ToggleGroup } from "@overmap-ai/blocks";
6
6
  import { cx } from "class-variance-authority";
7
- import * as React from "react";
8
- import { memo, forwardRef, createContext, useContext, useState, useRef, useCallback, useMemo, useEffect, Fragment as Fragment$1, use, useLayoutEffect, useId as useId$1 } from "react";
7
+ import { memo, forwardRef, createContext, useContext, useRef, useCallback, useState, useEffect, useMemo, Fragment, use, useLayoutEffect, useId } from "react";
9
8
  import "@xyflow/react/dist/style.css";
10
9
  import { getBezierPath, Position, BaseEdge, EdgeLabelRenderer, NodeToolbar, Handle, MarkerType, useNodesState, useEdgesState, ReactFlow, Panel } from "@xyflow/react";
11
10
  import { useField, useFormikContext, useFormik, FormikProvider } from "formik";
@@ -13,9 +12,6 @@ import { DirectedGraph } from "graphology";
13
12
  import { willCreateCycle } from "graphology-dag";
14
13
  import { v4 } from "uuid";
15
14
  import { DragDropContext, Droppable, Draggable } from "@hello-pangea/dnd";
16
- import { Copy, Download, X, Plus, Check, ChevronDown, Minus, Circle, Maximize, FileWarning, File as File$1, Upload, Trash2, Settings } from "lucide-react";
17
- import * as ReactDOM from "react-dom";
18
- import ReactDOM__default from "react-dom";
19
15
  import { saveAs } from "file-saver";
20
16
  import { DecodeHintType as DecodeHintType$2, useZxing } from "react-zxing";
21
17
  import get from "lodash.get";
@@ -161,1976 +157,6 @@ const ImageViewerContext = createContext(() => {
161
157
  throw new Error("No ImageViewerProvider found");
162
158
  });
163
159
  const useImageViewer = () => useContext(ImageViewerContext);
164
- function composeEventHandlers(originalEventHandler, ourEventHandler, { checkForDefaultPrevented = true } = {}) {
165
- return function handleEvent(event) {
166
- originalEventHandler == null ? void 0 : originalEventHandler(event);
167
- if (checkForDefaultPrevented === false || !event.defaultPrevented) {
168
- return ourEventHandler == null ? void 0 : ourEventHandler(event);
169
- }
170
- };
171
- }
172
- function setRef(ref, value) {
173
- if (typeof ref === "function") {
174
- return ref(value);
175
- } else if (ref !== null && ref !== void 0) {
176
- ref.current = value;
177
- }
178
- }
179
- function composeRefs(...refs) {
180
- return (node) => {
181
- let hasCleanup = false;
182
- const cleanups = refs.map((ref) => {
183
- const cleanup = setRef(ref, node);
184
- if (!hasCleanup && typeof cleanup == "function") {
185
- hasCleanup = true;
186
- }
187
- return cleanup;
188
- });
189
- if (hasCleanup) {
190
- return () => {
191
- for (let i = 0; i < cleanups.length; i++) {
192
- const cleanup = cleanups[i];
193
- if (typeof cleanup == "function") {
194
- cleanup();
195
- } else {
196
- setRef(refs[i], null);
197
- }
198
- }
199
- };
200
- }
201
- };
202
- }
203
- function useComposedRefs(...refs) {
204
- return React.useCallback(composeRefs(...refs), refs);
205
- }
206
- function createContext2(rootComponentName, defaultContext) {
207
- const Context = React.createContext(defaultContext);
208
- const Provider = (props) => {
209
- const { children, ...context } = props;
210
- const value = React.useMemo(() => context, Object.values(context));
211
- return /* @__PURE__ */ jsx(Context.Provider, { value, children });
212
- };
213
- Provider.displayName = rootComponentName + "Provider";
214
- function useContext2(consumerName) {
215
- const context = React.useContext(Context);
216
- if (context) return context;
217
- if (defaultContext !== void 0) return defaultContext;
218
- throw new Error(`\`${consumerName}\` must be used within \`${rootComponentName}\``);
219
- }
220
- return [Provider, useContext2];
221
- }
222
- function createContextScope(scopeName, createContextScopeDeps = []) {
223
- let defaultContexts = [];
224
- function createContext3(rootComponentName, defaultContext) {
225
- const BaseContext = React.createContext(defaultContext);
226
- const index = defaultContexts.length;
227
- defaultContexts = [...defaultContexts, defaultContext];
228
- const Provider = (props) => {
229
- var _a2;
230
- const { scope, children, ...context } = props;
231
- const Context = ((_a2 = scope == null ? void 0 : scope[scopeName]) == null ? void 0 : _a2[index]) || BaseContext;
232
- const value = React.useMemo(() => context, Object.values(context));
233
- return /* @__PURE__ */ jsx(Context.Provider, { value, children });
234
- };
235
- Provider.displayName = rootComponentName + "Provider";
236
- function useContext2(consumerName, scope) {
237
- var _a2;
238
- const Context = ((_a2 = scope == null ? void 0 : scope[scopeName]) == null ? void 0 : _a2[index]) || BaseContext;
239
- const context = React.useContext(Context);
240
- if (context) return context;
241
- if (defaultContext !== void 0) return defaultContext;
242
- throw new Error(`\`${consumerName}\` must be used within \`${rootComponentName}\``);
243
- }
244
- return [Provider, useContext2];
245
- }
246
- const createScope = () => {
247
- const scopeContexts = defaultContexts.map((defaultContext) => {
248
- return React.createContext(defaultContext);
249
- });
250
- return function useScope(scope) {
251
- const contexts = (scope == null ? void 0 : scope[scopeName]) || scopeContexts;
252
- return React.useMemo(
253
- () => ({ [`__scope${scopeName}`]: { ...scope, [scopeName]: contexts } }),
254
- [scope, contexts]
255
- );
256
- };
257
- };
258
- createScope.scopeName = scopeName;
259
- return [createContext3, composeContextScopes(createScope, ...createContextScopeDeps)];
260
- }
261
- function composeContextScopes(...scopes) {
262
- const baseScope = scopes[0];
263
- if (scopes.length === 1) return baseScope;
264
- const createScope = () => {
265
- const scopeHooks = scopes.map((createScope2) => ({
266
- useScope: createScope2(),
267
- scopeName: createScope2.scopeName
268
- }));
269
- return function useComposedScopes(overrideScopes) {
270
- const nextScopes = scopeHooks.reduce((nextScopes2, { useScope, scopeName }) => {
271
- const scopeProps = useScope(overrideScopes);
272
- const currentScope = scopeProps[`__scope${scopeName}`];
273
- return { ...nextScopes2, ...currentScope };
274
- }, {});
275
- return React.useMemo(() => ({ [`__scope${baseScope.scopeName}`]: nextScopes }), [nextScopes]);
276
- };
277
- };
278
- createScope.scopeName = baseScope.scopeName;
279
- return createScope;
280
- }
281
- var useLayoutEffect2 = (globalThis == null ? void 0 : globalThis.document) ? React.useLayoutEffect : () => {
282
- };
283
- var useReactId = React[" useId ".trim().toString()] || (() => void 0);
284
- var count$1 = 0;
285
- function useId(deterministicId) {
286
- const [id, setId] = React.useState(useReactId());
287
- useLayoutEffect2(() => {
288
- setId((reactId) => reactId ?? String(count$1++));
289
- }, [deterministicId]);
290
- return deterministicId || (id ? `radix-${id}` : "");
291
- }
292
- var useInsertionEffect = React[" useInsertionEffect ".trim().toString()] || useLayoutEffect2;
293
- function useControllableState({
294
- prop,
295
- defaultProp,
296
- onChange = () => {
297
- },
298
- caller
299
- }) {
300
- const [uncontrolledProp, setUncontrolledProp, onChangeRef] = useUncontrolledState({
301
- defaultProp,
302
- onChange
303
- });
304
- const isControlled = prop !== void 0;
305
- const value = isControlled ? prop : uncontrolledProp;
306
- {
307
- const isControlledRef = React.useRef(prop !== void 0);
308
- React.useEffect(() => {
309
- const wasControlled = isControlledRef.current;
310
- if (wasControlled !== isControlled) {
311
- const from = wasControlled ? "controlled" : "uncontrolled";
312
- const to = isControlled ? "controlled" : "uncontrolled";
313
- console.warn(
314
- `${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.`
315
- );
316
- }
317
- isControlledRef.current = isControlled;
318
- }, [isControlled, caller]);
319
- }
320
- const setValue = React.useCallback(
321
- (nextValue) => {
322
- var _a2;
323
- if (isControlled) {
324
- const value2 = isFunction(nextValue) ? nextValue(prop) : nextValue;
325
- if (value2 !== prop) {
326
- (_a2 = onChangeRef.current) == null ? void 0 : _a2.call(onChangeRef, value2);
327
- }
328
- } else {
329
- setUncontrolledProp(nextValue);
330
- }
331
- },
332
- [isControlled, prop, setUncontrolledProp, onChangeRef]
333
- );
334
- return [value, setValue];
335
- }
336
- function useUncontrolledState({
337
- defaultProp,
338
- onChange
339
- }) {
340
- const [value, setValue] = React.useState(defaultProp);
341
- const prevValueRef = React.useRef(value);
342
- const onChangeRef = React.useRef(onChange);
343
- useInsertionEffect(() => {
344
- onChangeRef.current = onChange;
345
- }, [onChange]);
346
- React.useEffect(() => {
347
- var _a2;
348
- if (prevValueRef.current !== value) {
349
- (_a2 = onChangeRef.current) == null ? void 0 : _a2.call(onChangeRef, value);
350
- prevValueRef.current = value;
351
- }
352
- }, [value, prevValueRef]);
353
- return [value, setValue, onChangeRef];
354
- }
355
- function isFunction(value) {
356
- return typeof value === "function";
357
- }
358
- // @__NO_SIDE_EFFECTS__
359
- function createSlot(ownerName) {
360
- const SlotClone = /* @__PURE__ */ createSlotClone(ownerName);
361
- const Slot2 = React.forwardRef((props, forwardedRef) => {
362
- const { children, ...slotProps } = props;
363
- const childrenArray = React.Children.toArray(children);
364
- const slottable = childrenArray.find(isSlottable);
365
- if (slottable) {
366
- const newElement = slottable.props.children;
367
- const newChildren = childrenArray.map((child) => {
368
- if (child === slottable) {
369
- if (React.Children.count(newElement) > 1) return React.Children.only(null);
370
- return React.isValidElement(newElement) ? newElement.props.children : null;
371
- } else {
372
- return child;
373
- }
374
- });
375
- return /* @__PURE__ */ jsx(SlotClone, { ...slotProps, ref: forwardedRef, children: React.isValidElement(newElement) ? React.cloneElement(newElement, void 0, newChildren) : null });
376
- }
377
- return /* @__PURE__ */ jsx(SlotClone, { ...slotProps, ref: forwardedRef, children });
378
- });
379
- Slot2.displayName = `${ownerName}.Slot`;
380
- return Slot2;
381
- }
382
- // @__NO_SIDE_EFFECTS__
383
- function createSlotClone(ownerName) {
384
- const SlotClone = React.forwardRef((props, forwardedRef) => {
385
- const { children, ...slotProps } = props;
386
- if (React.isValidElement(children)) {
387
- const childrenRef = getElementRef$1(children);
388
- const props2 = mergeProps(slotProps, children.props);
389
- if (children.type !== React.Fragment) {
390
- props2.ref = forwardedRef ? composeRefs(forwardedRef, childrenRef) : childrenRef;
391
- }
392
- return React.cloneElement(children, props2);
393
- }
394
- return React.Children.count(children) > 1 ? React.Children.only(null) : null;
395
- });
396
- SlotClone.displayName = `${ownerName}.SlotClone`;
397
- return SlotClone;
398
- }
399
- var SLOTTABLE_IDENTIFIER = Symbol("radix.slottable");
400
- function isSlottable(child) {
401
- return React.isValidElement(child) && typeof child.type === "function" && "__radixId" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER;
402
- }
403
- function mergeProps(slotProps, childProps) {
404
- const overrideProps = { ...childProps };
405
- for (const propName in childProps) {
406
- const slotPropValue = slotProps[propName];
407
- const childPropValue = childProps[propName];
408
- const isHandler = /^on[A-Z]/.test(propName);
409
- if (isHandler) {
410
- if (slotPropValue && childPropValue) {
411
- overrideProps[propName] = (...args) => {
412
- const result = childPropValue(...args);
413
- slotPropValue(...args);
414
- return result;
415
- };
416
- } else if (slotPropValue) {
417
- overrideProps[propName] = slotPropValue;
418
- }
419
- } else if (propName === "style") {
420
- overrideProps[propName] = { ...slotPropValue, ...childPropValue };
421
- } else if (propName === "className") {
422
- overrideProps[propName] = [slotPropValue, childPropValue].filter(Boolean).join(" ");
423
- }
424
- }
425
- return { ...slotProps, ...overrideProps };
426
- }
427
- function getElementRef$1(element) {
428
- var _a2, _b;
429
- let getter = (_a2 = Object.getOwnPropertyDescriptor(element.props, "ref")) == null ? void 0 : _a2.get;
430
- let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
431
- if (mayWarn) {
432
- return element.ref;
433
- }
434
- getter = (_b = Object.getOwnPropertyDescriptor(element, "ref")) == null ? void 0 : _b.get;
435
- mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
436
- if (mayWarn) {
437
- return element.props.ref;
438
- }
439
- return element.props.ref || element.ref;
440
- }
441
- var NODES = [
442
- "a",
443
- "button",
444
- "div",
445
- "form",
446
- "h2",
447
- "h3",
448
- "img",
449
- "input",
450
- "label",
451
- "li",
452
- "nav",
453
- "ol",
454
- "p",
455
- "select",
456
- "span",
457
- "svg",
458
- "ul"
459
- ];
460
- var Primitive = NODES.reduce((primitive, node) => {
461
- const Slot2 = /* @__PURE__ */ createSlot(`Primitive.${node}`);
462
- const Node = React.forwardRef((props, forwardedRef) => {
463
- const { asChild, ...primitiveProps } = props;
464
- const Comp = asChild ? Slot2 : node;
465
- if (typeof window !== "undefined") {
466
- window[Symbol.for("radix-ui")] = true;
467
- }
468
- return /* @__PURE__ */ jsx(Comp, { ...primitiveProps, ref: forwardedRef });
469
- });
470
- Node.displayName = `Primitive.${node}`;
471
- return { ...primitive, [node]: Node };
472
- }, {});
473
- function dispatchDiscreteCustomEvent(target, event) {
474
- if (target) ReactDOM.flushSync(() => target.dispatchEvent(event));
475
- }
476
- function useCallbackRef$1(callback) {
477
- const callbackRef = React.useRef(callback);
478
- React.useEffect(() => {
479
- callbackRef.current = callback;
480
- });
481
- return React.useMemo(() => (...args) => {
482
- var _a2;
483
- return (_a2 = callbackRef.current) == null ? void 0 : _a2.call(callbackRef, ...args);
484
- }, []);
485
- }
486
- function useEscapeKeydown(onEscapeKeyDownProp, ownerDocument = globalThis == null ? void 0 : globalThis.document) {
487
- const onEscapeKeyDown = useCallbackRef$1(onEscapeKeyDownProp);
488
- React.useEffect(() => {
489
- const handleKeyDown = (event) => {
490
- if (event.key === "Escape") {
491
- onEscapeKeyDown(event);
492
- }
493
- };
494
- ownerDocument.addEventListener("keydown", handleKeyDown, { capture: true });
495
- return () => ownerDocument.removeEventListener("keydown", handleKeyDown, { capture: true });
496
- }, [onEscapeKeyDown, ownerDocument]);
497
- }
498
- var DISMISSABLE_LAYER_NAME = "DismissableLayer";
499
- var CONTEXT_UPDATE = "dismissableLayer.update";
500
- var POINTER_DOWN_OUTSIDE = "dismissableLayer.pointerDownOutside";
501
- var FOCUS_OUTSIDE = "dismissableLayer.focusOutside";
502
- var originalBodyPointerEvents;
503
- var DismissableLayerContext = React.createContext({
504
- layers: /* @__PURE__ */ new Set(),
505
- layersWithOutsidePointerEventsDisabled: /* @__PURE__ */ new Set(),
506
- branches: /* @__PURE__ */ new Set()
507
- });
508
- var DismissableLayer = React.forwardRef(
509
- (props, forwardedRef) => {
510
- const {
511
- disableOutsidePointerEvents = false,
512
- onEscapeKeyDown,
513
- onPointerDownOutside,
514
- onFocusOutside,
515
- onInteractOutside,
516
- onDismiss,
517
- ...layerProps
518
- } = props;
519
- const context = React.useContext(DismissableLayerContext);
520
- const [node, setNode] = React.useState(null);
521
- const ownerDocument = (node == null ? void 0 : node.ownerDocument) ?? (globalThis == null ? void 0 : globalThis.document);
522
- const [, force] = React.useState({});
523
- const composedRefs = useComposedRefs(forwardedRef, (node2) => setNode(node2));
524
- const layers = Array.from(context.layers);
525
- const [highestLayerWithOutsidePointerEventsDisabled] = [...context.layersWithOutsidePointerEventsDisabled].slice(-1);
526
- const highestLayerWithOutsidePointerEventsDisabledIndex = layers.indexOf(highestLayerWithOutsidePointerEventsDisabled);
527
- const index = node ? layers.indexOf(node) : -1;
528
- const isBodyPointerEventsDisabled = context.layersWithOutsidePointerEventsDisabled.size > 0;
529
- const isPointerEventsEnabled = index >= highestLayerWithOutsidePointerEventsDisabledIndex;
530
- const pointerDownOutside = usePointerDownOutside((event) => {
531
- const target = event.target;
532
- const isPointerDownOnBranch = [...context.branches].some((branch) => branch.contains(target));
533
- if (!isPointerEventsEnabled || isPointerDownOnBranch) return;
534
- onPointerDownOutside == null ? void 0 : onPointerDownOutside(event);
535
- onInteractOutside == null ? void 0 : onInteractOutside(event);
536
- if (!event.defaultPrevented) onDismiss == null ? void 0 : onDismiss();
537
- }, ownerDocument);
538
- const focusOutside = useFocusOutside((event) => {
539
- const target = event.target;
540
- const isFocusInBranch = [...context.branches].some((branch) => branch.contains(target));
541
- if (isFocusInBranch) return;
542
- onFocusOutside == null ? void 0 : onFocusOutside(event);
543
- onInteractOutside == null ? void 0 : onInteractOutside(event);
544
- if (!event.defaultPrevented) onDismiss == null ? void 0 : onDismiss();
545
- }, ownerDocument);
546
- useEscapeKeydown((event) => {
547
- const isHighestLayer = index === context.layers.size - 1;
548
- if (!isHighestLayer) return;
549
- onEscapeKeyDown == null ? void 0 : onEscapeKeyDown(event);
550
- if (!event.defaultPrevented && onDismiss) {
551
- event.preventDefault();
552
- onDismiss();
553
- }
554
- }, ownerDocument);
555
- React.useEffect(() => {
556
- if (!node) return;
557
- if (disableOutsidePointerEvents) {
558
- if (context.layersWithOutsidePointerEventsDisabled.size === 0) {
559
- originalBodyPointerEvents = ownerDocument.body.style.pointerEvents;
560
- ownerDocument.body.style.pointerEvents = "none";
561
- }
562
- context.layersWithOutsidePointerEventsDisabled.add(node);
563
- }
564
- context.layers.add(node);
565
- dispatchUpdate();
566
- return () => {
567
- if (disableOutsidePointerEvents && context.layersWithOutsidePointerEventsDisabled.size === 1) {
568
- ownerDocument.body.style.pointerEvents = originalBodyPointerEvents;
569
- }
570
- };
571
- }, [node, ownerDocument, disableOutsidePointerEvents, context]);
572
- React.useEffect(() => {
573
- return () => {
574
- if (!node) return;
575
- context.layers.delete(node);
576
- context.layersWithOutsidePointerEventsDisabled.delete(node);
577
- dispatchUpdate();
578
- };
579
- }, [node, context]);
580
- React.useEffect(() => {
581
- const handleUpdate = () => force({});
582
- document.addEventListener(CONTEXT_UPDATE, handleUpdate);
583
- return () => document.removeEventListener(CONTEXT_UPDATE, handleUpdate);
584
- }, []);
585
- return /* @__PURE__ */ jsx(
586
- Primitive.div,
587
- {
588
- ...layerProps,
589
- ref: composedRefs,
590
- style: {
591
- pointerEvents: isBodyPointerEventsDisabled ? isPointerEventsEnabled ? "auto" : "none" : void 0,
592
- ...props.style
593
- },
594
- onFocusCapture: composeEventHandlers(props.onFocusCapture, focusOutside.onFocusCapture),
595
- onBlurCapture: composeEventHandlers(props.onBlurCapture, focusOutside.onBlurCapture),
596
- onPointerDownCapture: composeEventHandlers(
597
- props.onPointerDownCapture,
598
- pointerDownOutside.onPointerDownCapture
599
- )
600
- }
601
- );
602
- }
603
- );
604
- DismissableLayer.displayName = DISMISSABLE_LAYER_NAME;
605
- var BRANCH_NAME = "DismissableLayerBranch";
606
- var DismissableLayerBranch = React.forwardRef((props, forwardedRef) => {
607
- const context = React.useContext(DismissableLayerContext);
608
- const ref = React.useRef(null);
609
- const composedRefs = useComposedRefs(forwardedRef, ref);
610
- React.useEffect(() => {
611
- const node = ref.current;
612
- if (node) {
613
- context.branches.add(node);
614
- return () => {
615
- context.branches.delete(node);
616
- };
617
- }
618
- }, [context.branches]);
619
- return /* @__PURE__ */ jsx(Primitive.div, { ...props, ref: composedRefs });
620
- });
621
- DismissableLayerBranch.displayName = BRANCH_NAME;
622
- function usePointerDownOutside(onPointerDownOutside, ownerDocument = globalThis == null ? void 0 : globalThis.document) {
623
- const handlePointerDownOutside = useCallbackRef$1(onPointerDownOutside);
624
- const isPointerInsideReactTreeRef = React.useRef(false);
625
- const handleClickRef = React.useRef(() => {
626
- });
627
- React.useEffect(() => {
628
- const handlePointerDown = (event) => {
629
- if (event.target && !isPointerInsideReactTreeRef.current) {
630
- let handleAndDispatchPointerDownOutsideEvent2 = function() {
631
- handleAndDispatchCustomEvent(
632
- POINTER_DOWN_OUTSIDE,
633
- handlePointerDownOutside,
634
- eventDetail,
635
- { discrete: true }
636
- );
637
- };
638
- const eventDetail = { originalEvent: event };
639
- if (event.pointerType === "touch") {
640
- ownerDocument.removeEventListener("click", handleClickRef.current);
641
- handleClickRef.current = handleAndDispatchPointerDownOutsideEvent2;
642
- ownerDocument.addEventListener("click", handleClickRef.current, { once: true });
643
- } else {
644
- handleAndDispatchPointerDownOutsideEvent2();
645
- }
646
- } else {
647
- ownerDocument.removeEventListener("click", handleClickRef.current);
648
- }
649
- isPointerInsideReactTreeRef.current = false;
650
- };
651
- const timerId = window.setTimeout(() => {
652
- ownerDocument.addEventListener("pointerdown", handlePointerDown);
653
- }, 0);
654
- return () => {
655
- window.clearTimeout(timerId);
656
- ownerDocument.removeEventListener("pointerdown", handlePointerDown);
657
- ownerDocument.removeEventListener("click", handleClickRef.current);
658
- };
659
- }, [ownerDocument, handlePointerDownOutside]);
660
- return {
661
- // ensures we check React component tree (not just DOM tree)
662
- onPointerDownCapture: () => isPointerInsideReactTreeRef.current = true
663
- };
664
- }
665
- function useFocusOutside(onFocusOutside, ownerDocument = globalThis == null ? void 0 : globalThis.document) {
666
- const handleFocusOutside = useCallbackRef$1(onFocusOutside);
667
- const isFocusInsideReactTreeRef = React.useRef(false);
668
- React.useEffect(() => {
669
- const handleFocus = (event) => {
670
- if (event.target && !isFocusInsideReactTreeRef.current) {
671
- const eventDetail = { originalEvent: event };
672
- handleAndDispatchCustomEvent(FOCUS_OUTSIDE, handleFocusOutside, eventDetail, {
673
- discrete: false
674
- });
675
- }
676
- };
677
- ownerDocument.addEventListener("focusin", handleFocus);
678
- return () => ownerDocument.removeEventListener("focusin", handleFocus);
679
- }, [ownerDocument, handleFocusOutside]);
680
- return {
681
- onFocusCapture: () => isFocusInsideReactTreeRef.current = true,
682
- onBlurCapture: () => isFocusInsideReactTreeRef.current = false
683
- };
684
- }
685
- function dispatchUpdate() {
686
- const event = new CustomEvent(CONTEXT_UPDATE);
687
- document.dispatchEvent(event);
688
- }
689
- function handleAndDispatchCustomEvent(name, handler, detail, { discrete }) {
690
- const target = detail.originalEvent.target;
691
- const event = new CustomEvent(name, { bubbles: false, cancelable: true, detail });
692
- if (handler) target.addEventListener(name, handler, { once: true });
693
- if (discrete) {
694
- dispatchDiscreteCustomEvent(target, event);
695
- } else {
696
- target.dispatchEvent(event);
697
- }
698
- }
699
- var AUTOFOCUS_ON_MOUNT = "focusScope.autoFocusOnMount";
700
- var AUTOFOCUS_ON_UNMOUNT = "focusScope.autoFocusOnUnmount";
701
- var EVENT_OPTIONS = { bubbles: false, cancelable: true };
702
- var FOCUS_SCOPE_NAME = "FocusScope";
703
- var FocusScope = React.forwardRef((props, forwardedRef) => {
704
- const {
705
- loop = false,
706
- trapped = false,
707
- onMountAutoFocus: onMountAutoFocusProp,
708
- onUnmountAutoFocus: onUnmountAutoFocusProp,
709
- ...scopeProps
710
- } = props;
711
- const [container, setContainer] = React.useState(null);
712
- const onMountAutoFocus = useCallbackRef$1(onMountAutoFocusProp);
713
- const onUnmountAutoFocus = useCallbackRef$1(onUnmountAutoFocusProp);
714
- const lastFocusedElementRef = React.useRef(null);
715
- const composedRefs = useComposedRefs(forwardedRef, (node) => setContainer(node));
716
- const focusScope = React.useRef({
717
- paused: false,
718
- pause() {
719
- this.paused = true;
720
- },
721
- resume() {
722
- this.paused = false;
723
- }
724
- }).current;
725
- React.useEffect(() => {
726
- if (trapped) {
727
- let handleFocusIn2 = function(event) {
728
- if (focusScope.paused || !container) return;
729
- const target = event.target;
730
- if (container.contains(target)) {
731
- lastFocusedElementRef.current = target;
732
- } else {
733
- focus(lastFocusedElementRef.current, { select: true });
734
- }
735
- }, handleFocusOut2 = function(event) {
736
- if (focusScope.paused || !container) return;
737
- const relatedTarget = event.relatedTarget;
738
- if (relatedTarget === null) return;
739
- if (!container.contains(relatedTarget)) {
740
- focus(lastFocusedElementRef.current, { select: true });
741
- }
742
- }, handleMutations2 = function(mutations) {
743
- const focusedElement = document.activeElement;
744
- if (focusedElement !== document.body) return;
745
- for (const mutation of mutations) {
746
- if (mutation.removedNodes.length > 0) focus(container);
747
- }
748
- };
749
- document.addEventListener("focusin", handleFocusIn2);
750
- document.addEventListener("focusout", handleFocusOut2);
751
- const mutationObserver = new MutationObserver(handleMutations2);
752
- if (container) mutationObserver.observe(container, { childList: true, subtree: true });
753
- return () => {
754
- document.removeEventListener("focusin", handleFocusIn2);
755
- document.removeEventListener("focusout", handleFocusOut2);
756
- mutationObserver.disconnect();
757
- };
758
- }
759
- }, [trapped, container, focusScope.paused]);
760
- React.useEffect(() => {
761
- if (container) {
762
- focusScopesStack.add(focusScope);
763
- const previouslyFocusedElement = document.activeElement;
764
- const hasFocusedCandidate = container.contains(previouslyFocusedElement);
765
- if (!hasFocusedCandidate) {
766
- const mountEvent = new CustomEvent(AUTOFOCUS_ON_MOUNT, EVENT_OPTIONS);
767
- container.addEventListener(AUTOFOCUS_ON_MOUNT, onMountAutoFocus);
768
- container.dispatchEvent(mountEvent);
769
- if (!mountEvent.defaultPrevented) {
770
- focusFirst(removeLinks(getTabbableCandidates(container)), { select: true });
771
- if (document.activeElement === previouslyFocusedElement) {
772
- focus(container);
773
- }
774
- }
775
- }
776
- return () => {
777
- container.removeEventListener(AUTOFOCUS_ON_MOUNT, onMountAutoFocus);
778
- setTimeout(() => {
779
- const unmountEvent = new CustomEvent(AUTOFOCUS_ON_UNMOUNT, EVENT_OPTIONS);
780
- container.addEventListener(AUTOFOCUS_ON_UNMOUNT, onUnmountAutoFocus);
781
- container.dispatchEvent(unmountEvent);
782
- if (!unmountEvent.defaultPrevented) {
783
- focus(previouslyFocusedElement ?? document.body, { select: true });
784
- }
785
- container.removeEventListener(AUTOFOCUS_ON_UNMOUNT, onUnmountAutoFocus);
786
- focusScopesStack.remove(focusScope);
787
- }, 0);
788
- };
789
- }
790
- }, [container, onMountAutoFocus, onUnmountAutoFocus, focusScope]);
791
- const handleKeyDown = React.useCallback(
792
- (event) => {
793
- if (!loop && !trapped) return;
794
- if (focusScope.paused) return;
795
- const isTabKey = event.key === "Tab" && !event.altKey && !event.ctrlKey && !event.metaKey;
796
- const focusedElement = document.activeElement;
797
- if (isTabKey && focusedElement) {
798
- const container2 = event.currentTarget;
799
- const [first, last] = getTabbableEdges(container2);
800
- const hasTabbableElementsInside = first && last;
801
- if (!hasTabbableElementsInside) {
802
- if (focusedElement === container2) event.preventDefault();
803
- } else {
804
- if (!event.shiftKey && focusedElement === last) {
805
- event.preventDefault();
806
- if (loop) focus(first, { select: true });
807
- } else if (event.shiftKey && focusedElement === first) {
808
- event.preventDefault();
809
- if (loop) focus(last, { select: true });
810
- }
811
- }
812
- }
813
- },
814
- [loop, trapped, focusScope.paused]
815
- );
816
- return /* @__PURE__ */ jsx(Primitive.div, { tabIndex: -1, ...scopeProps, ref: composedRefs, onKeyDown: handleKeyDown });
817
- });
818
- FocusScope.displayName = FOCUS_SCOPE_NAME;
819
- function focusFirst(candidates, { select = false } = {}) {
820
- const previouslyFocusedElement = document.activeElement;
821
- for (const candidate of candidates) {
822
- focus(candidate, { select });
823
- if (document.activeElement !== previouslyFocusedElement) return;
824
- }
825
- }
826
- function getTabbableEdges(container) {
827
- const candidates = getTabbableCandidates(container);
828
- const first = findVisible(candidates, container);
829
- const last = findVisible(candidates.reverse(), container);
830
- return [first, last];
831
- }
832
- function getTabbableCandidates(container) {
833
- const nodes = [];
834
- const walker = document.createTreeWalker(container, NodeFilter.SHOW_ELEMENT, {
835
- acceptNode: (node) => {
836
- const isHiddenInput = node.tagName === "INPUT" && node.type === "hidden";
837
- if (node.disabled || node.hidden || isHiddenInput) return NodeFilter.FILTER_SKIP;
838
- return node.tabIndex >= 0 ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
839
- }
840
- });
841
- while (walker.nextNode()) nodes.push(walker.currentNode);
842
- return nodes;
843
- }
844
- function findVisible(elements, container) {
845
- for (const element of elements) {
846
- if (!isHidden(element, { upTo: container })) return element;
847
- }
848
- }
849
- function isHidden(node, { upTo }) {
850
- if (getComputedStyle(node).visibility === "hidden") return true;
851
- while (node) {
852
- if (upTo !== void 0 && node === upTo) return false;
853
- if (getComputedStyle(node).display === "none") return true;
854
- node = node.parentElement;
855
- }
856
- return false;
857
- }
858
- function isSelectableInput(element) {
859
- return element instanceof HTMLInputElement && "select" in element;
860
- }
861
- function focus(element, { select = false } = {}) {
862
- if (element && element.focus) {
863
- const previouslyFocusedElement = document.activeElement;
864
- element.focus({ preventScroll: true });
865
- if (element !== previouslyFocusedElement && isSelectableInput(element) && select)
866
- element.select();
867
- }
868
- }
869
- var focusScopesStack = createFocusScopesStack();
870
- function createFocusScopesStack() {
871
- let stack = [];
872
- return {
873
- add(focusScope) {
874
- const activeFocusScope = stack[0];
875
- if (focusScope !== activeFocusScope) {
876
- activeFocusScope == null ? void 0 : activeFocusScope.pause();
877
- }
878
- stack = arrayRemove(stack, focusScope);
879
- stack.unshift(focusScope);
880
- },
881
- remove(focusScope) {
882
- var _a2;
883
- stack = arrayRemove(stack, focusScope);
884
- (_a2 = stack[0]) == null ? void 0 : _a2.resume();
885
- }
886
- };
887
- }
888
- function arrayRemove(array, item) {
889
- const updatedArray = [...array];
890
- const index = updatedArray.indexOf(item);
891
- if (index !== -1) {
892
- updatedArray.splice(index, 1);
893
- }
894
- return updatedArray;
895
- }
896
- function removeLinks(items) {
897
- return items.filter((item) => item.tagName !== "A");
898
- }
899
- var PORTAL_NAME$1 = "Portal";
900
- var Portal$1 = React.forwardRef((props, forwardedRef) => {
901
- var _a2;
902
- const { container: containerProp, ...portalProps } = props;
903
- const [mounted, setMounted] = React.useState(false);
904
- useLayoutEffect2(() => setMounted(true), []);
905
- const container = containerProp || mounted && ((_a2 = globalThis == null ? void 0 : globalThis.document) == null ? void 0 : _a2.body);
906
- return container ? ReactDOM__default.createPortal(/* @__PURE__ */ jsx(Primitive.div, { ...portalProps, ref: forwardedRef }), container) : null;
907
- });
908
- Portal$1.displayName = PORTAL_NAME$1;
909
- function useStateMachine(initialState, machine) {
910
- return React.useReducer((state, event) => {
911
- const nextState = machine[state][event];
912
- return nextState ?? state;
913
- }, initialState);
914
- }
915
- var Presence = (props) => {
916
- const { present, children } = props;
917
- const presence = usePresence(present);
918
- const child = typeof children === "function" ? children({ present: presence.isPresent }) : React.Children.only(children);
919
- const ref = useComposedRefs(presence.ref, getElementRef(child));
920
- const forceMount = typeof children === "function";
921
- return forceMount || presence.isPresent ? React.cloneElement(child, { ref }) : null;
922
- };
923
- Presence.displayName = "Presence";
924
- function usePresence(present) {
925
- const [node, setNode] = React.useState();
926
- const stylesRef = React.useRef(null);
927
- const prevPresentRef = React.useRef(present);
928
- const prevAnimationNameRef = React.useRef("none");
929
- const initialState = present ? "mounted" : "unmounted";
930
- const [state, send] = useStateMachine(initialState, {
931
- mounted: {
932
- UNMOUNT: "unmounted",
933
- ANIMATION_OUT: "unmountSuspended"
934
- },
935
- unmountSuspended: {
936
- MOUNT: "mounted",
937
- ANIMATION_END: "unmounted"
938
- },
939
- unmounted: {
940
- MOUNT: "mounted"
941
- }
942
- });
943
- React.useEffect(() => {
944
- const currentAnimationName = getAnimationName(stylesRef.current);
945
- prevAnimationNameRef.current = state === "mounted" ? currentAnimationName : "none";
946
- }, [state]);
947
- useLayoutEffect2(() => {
948
- const styles = stylesRef.current;
949
- const wasPresent = prevPresentRef.current;
950
- const hasPresentChanged = wasPresent !== present;
951
- if (hasPresentChanged) {
952
- const prevAnimationName = prevAnimationNameRef.current;
953
- const currentAnimationName = getAnimationName(styles);
954
- if (present) {
955
- send("MOUNT");
956
- } else if (currentAnimationName === "none" || (styles == null ? void 0 : styles.display) === "none") {
957
- send("UNMOUNT");
958
- } else {
959
- const isAnimating = prevAnimationName !== currentAnimationName;
960
- if (wasPresent && isAnimating) {
961
- send("ANIMATION_OUT");
962
- } else {
963
- send("UNMOUNT");
964
- }
965
- }
966
- prevPresentRef.current = present;
967
- }
968
- }, [present, send]);
969
- useLayoutEffect2(() => {
970
- if (node) {
971
- let timeoutId;
972
- const ownerWindow = node.ownerDocument.defaultView ?? window;
973
- const handleAnimationEnd = (event) => {
974
- const currentAnimationName = getAnimationName(stylesRef.current);
975
- const isCurrentAnimation = currentAnimationName.includes(event.animationName);
976
- if (event.target === node && isCurrentAnimation) {
977
- send("ANIMATION_END");
978
- if (!prevPresentRef.current) {
979
- const currentFillMode = node.style.animationFillMode;
980
- node.style.animationFillMode = "forwards";
981
- timeoutId = ownerWindow.setTimeout(() => {
982
- if (node.style.animationFillMode === "forwards") {
983
- node.style.animationFillMode = currentFillMode;
984
- }
985
- });
986
- }
987
- }
988
- };
989
- const handleAnimationStart = (event) => {
990
- if (event.target === node) {
991
- prevAnimationNameRef.current = getAnimationName(stylesRef.current);
992
- }
993
- };
994
- node.addEventListener("animationstart", handleAnimationStart);
995
- node.addEventListener("animationcancel", handleAnimationEnd);
996
- node.addEventListener("animationend", handleAnimationEnd);
997
- return () => {
998
- ownerWindow.clearTimeout(timeoutId);
999
- node.removeEventListener("animationstart", handleAnimationStart);
1000
- node.removeEventListener("animationcancel", handleAnimationEnd);
1001
- node.removeEventListener("animationend", handleAnimationEnd);
1002
- };
1003
- } else {
1004
- send("ANIMATION_END");
1005
- }
1006
- }, [node, send]);
1007
- return {
1008
- isPresent: ["mounted", "unmountSuspended"].includes(state),
1009
- ref: React.useCallback((node2) => {
1010
- stylesRef.current = node2 ? getComputedStyle(node2) : null;
1011
- setNode(node2);
1012
- }, [])
1013
- };
1014
- }
1015
- function getAnimationName(styles) {
1016
- return (styles == null ? void 0 : styles.animationName) || "none";
1017
- }
1018
- function getElementRef(element) {
1019
- var _a2, _b;
1020
- let getter = (_a2 = Object.getOwnPropertyDescriptor(element.props, "ref")) == null ? void 0 : _a2.get;
1021
- let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
1022
- if (mayWarn) {
1023
- return element.ref;
1024
- }
1025
- getter = (_b = Object.getOwnPropertyDescriptor(element, "ref")) == null ? void 0 : _b.get;
1026
- mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
1027
- if (mayWarn) {
1028
- return element.props.ref;
1029
- }
1030
- return element.props.ref || element.ref;
1031
- }
1032
- var count = 0;
1033
- function useFocusGuards() {
1034
- React.useEffect(() => {
1035
- const edgeGuards = document.querySelectorAll("[data-radix-focus-guard]");
1036
- document.body.insertAdjacentElement("afterbegin", edgeGuards[0] ?? createFocusGuard());
1037
- document.body.insertAdjacentElement("beforeend", edgeGuards[1] ?? createFocusGuard());
1038
- count++;
1039
- return () => {
1040
- if (count === 1) {
1041
- document.querySelectorAll("[data-radix-focus-guard]").forEach((node) => node.remove());
1042
- }
1043
- count--;
1044
- };
1045
- }, []);
1046
- }
1047
- function createFocusGuard() {
1048
- const element = document.createElement("span");
1049
- element.setAttribute("data-radix-focus-guard", "");
1050
- element.tabIndex = 0;
1051
- element.style.outline = "none";
1052
- element.style.opacity = "0";
1053
- element.style.position = "fixed";
1054
- element.style.pointerEvents = "none";
1055
- return element;
1056
- }
1057
- var __assign = function() {
1058
- __assign = Object.assign || function __assign2(t) {
1059
- for (var s, i = 1, n = arguments.length; i < n; i++) {
1060
- s = arguments[i];
1061
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
1062
- }
1063
- return t;
1064
- };
1065
- return __assign.apply(this, arguments);
1066
- };
1067
- function __rest(s, e) {
1068
- var t = {};
1069
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
1070
- t[p] = s[p];
1071
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
1072
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
1073
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
1074
- t[p[i]] = s[p[i]];
1075
- }
1076
- return t;
1077
- }
1078
- function __spreadArray(to, from, pack) {
1079
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
1080
- if (ar || !(i in from)) {
1081
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
1082
- ar[i] = from[i];
1083
- }
1084
- }
1085
- return to.concat(ar || Array.prototype.slice.call(from));
1086
- }
1087
- typeof SuppressedError === "function" ? SuppressedError : function(error, suppressed, message) {
1088
- var e = new Error(message);
1089
- return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
1090
- };
1091
- var zeroRightClassName = "right-scroll-bar-position";
1092
- var fullWidthClassName = "width-before-scroll-bar";
1093
- var noScrollbarsClassName = "with-scroll-bars-hidden";
1094
- var removedBarSizeVariable = "--removed-body-scroll-bar-size";
1095
- function assignRef(ref, value) {
1096
- if (typeof ref === "function") {
1097
- ref(value);
1098
- } else if (ref) {
1099
- ref.current = value;
1100
- }
1101
- return ref;
1102
- }
1103
- function useCallbackRef(initialValue, callback) {
1104
- var ref = useState(function() {
1105
- return {
1106
- // value
1107
- value: initialValue,
1108
- // last callback
1109
- callback,
1110
- // "memoized" public interface
1111
- facade: {
1112
- get current() {
1113
- return ref.value;
1114
- },
1115
- set current(value) {
1116
- var last = ref.value;
1117
- if (last !== value) {
1118
- ref.value = value;
1119
- ref.callback(value, last);
1120
- }
1121
- }
1122
- }
1123
- };
1124
- })[0];
1125
- ref.callback = callback;
1126
- return ref.facade;
1127
- }
1128
- var useIsomorphicLayoutEffect = typeof window !== "undefined" ? React.useLayoutEffect : React.useEffect;
1129
- var currentValues = /* @__PURE__ */ new WeakMap();
1130
- function useMergeRefs(refs, defaultValue) {
1131
- var callbackRef = useCallbackRef(null, function(newValue) {
1132
- return refs.forEach(function(ref) {
1133
- return assignRef(ref, newValue);
1134
- });
1135
- });
1136
- useIsomorphicLayoutEffect(function() {
1137
- var oldValue = currentValues.get(callbackRef);
1138
- if (oldValue) {
1139
- var prevRefs_1 = new Set(oldValue);
1140
- var nextRefs_1 = new Set(refs);
1141
- var current_1 = callbackRef.current;
1142
- prevRefs_1.forEach(function(ref) {
1143
- if (!nextRefs_1.has(ref)) {
1144
- assignRef(ref, null);
1145
- }
1146
- });
1147
- nextRefs_1.forEach(function(ref) {
1148
- if (!prevRefs_1.has(ref)) {
1149
- assignRef(ref, current_1);
1150
- }
1151
- });
1152
- }
1153
- currentValues.set(callbackRef, refs);
1154
- }, [refs]);
1155
- return callbackRef;
1156
- }
1157
- function ItoI(a) {
1158
- return a;
1159
- }
1160
- function innerCreateMedium(defaults, middleware) {
1161
- if (middleware === void 0) {
1162
- middleware = ItoI;
1163
- }
1164
- var buffer = [];
1165
- var assigned = false;
1166
- var medium = {
1167
- read: function() {
1168
- if (assigned) {
1169
- throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");
1170
- }
1171
- if (buffer.length) {
1172
- return buffer[buffer.length - 1];
1173
- }
1174
- return defaults;
1175
- },
1176
- useMedium: function(data) {
1177
- var item = middleware(data, assigned);
1178
- buffer.push(item);
1179
- return function() {
1180
- buffer = buffer.filter(function(x) {
1181
- return x !== item;
1182
- });
1183
- };
1184
- },
1185
- assignSyncMedium: function(cb) {
1186
- assigned = true;
1187
- while (buffer.length) {
1188
- var cbs = buffer;
1189
- buffer = [];
1190
- cbs.forEach(cb);
1191
- }
1192
- buffer = {
1193
- push: function(x) {
1194
- return cb(x);
1195
- },
1196
- filter: function() {
1197
- return buffer;
1198
- }
1199
- };
1200
- },
1201
- assignMedium: function(cb) {
1202
- assigned = true;
1203
- var pendingQueue = [];
1204
- if (buffer.length) {
1205
- var cbs = buffer;
1206
- buffer = [];
1207
- cbs.forEach(cb);
1208
- pendingQueue = buffer;
1209
- }
1210
- var executeQueue = function() {
1211
- var cbs2 = pendingQueue;
1212
- pendingQueue = [];
1213
- cbs2.forEach(cb);
1214
- };
1215
- var cycle = function() {
1216
- return Promise.resolve().then(executeQueue);
1217
- };
1218
- cycle();
1219
- buffer = {
1220
- push: function(x) {
1221
- pendingQueue.push(x);
1222
- cycle();
1223
- },
1224
- filter: function(filter) {
1225
- pendingQueue = pendingQueue.filter(filter);
1226
- return buffer;
1227
- }
1228
- };
1229
- }
1230
- };
1231
- return medium;
1232
- }
1233
- function createSidecarMedium(options) {
1234
- if (options === void 0) {
1235
- options = {};
1236
- }
1237
- var medium = innerCreateMedium(null);
1238
- medium.options = __assign({ async: true, ssr: false }, options);
1239
- return medium;
1240
- }
1241
- var SideCar$1 = function(_a2) {
1242
- var sideCar = _a2.sideCar, rest = __rest(_a2, ["sideCar"]);
1243
- if (!sideCar) {
1244
- throw new Error("Sidecar: please provide `sideCar` property to import the right car");
1245
- }
1246
- var Target = sideCar.read();
1247
- if (!Target) {
1248
- throw new Error("Sidecar medium not found");
1249
- }
1250
- return React.createElement(Target, __assign({}, rest));
1251
- };
1252
- SideCar$1.isSideCarExport = true;
1253
- function exportSidecar(medium, exported) {
1254
- medium.useMedium(exported);
1255
- return SideCar$1;
1256
- }
1257
- var effectCar = createSidecarMedium();
1258
- var nothing = function() {
1259
- return;
1260
- };
1261
- var RemoveScroll = React.forwardRef(function(props, parentRef) {
1262
- var ref = React.useRef(null);
1263
- var _a2 = React.useState({
1264
- onScrollCapture: nothing,
1265
- onWheelCapture: nothing,
1266
- onTouchMoveCapture: nothing
1267
- }), callbacks = _a2[0], setCallbacks = _a2[1];
1268
- 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"]);
1269
- var SideCar2 = sideCar;
1270
- var containerRef = useMergeRefs([ref, parentRef]);
1271
- var containerProps = __assign(__assign({}, rest), callbacks);
1272
- return React.createElement(
1273
- React.Fragment,
1274
- null,
1275
- enabled && React.createElement(SideCar2, { sideCar: effectCar, removeScrollBar, shards, noIsolation, inert, setCallbacks, allowPinchZoom: !!allowPinchZoom, lockRef: ref, gapMode }),
1276
- forwardProps ? React.cloneElement(React.Children.only(children), __assign(__assign({}, containerProps), { ref: containerRef })) : React.createElement(Container, __assign({}, containerProps, { className, ref: containerRef }), children)
1277
- );
1278
- });
1279
- RemoveScroll.defaultProps = {
1280
- enabled: true,
1281
- removeScrollBar: true,
1282
- inert: false
1283
- };
1284
- RemoveScroll.classNames = {
1285
- fullWidth: fullWidthClassName,
1286
- zeroRight: zeroRightClassName
1287
- };
1288
- var getNonce = function() {
1289
- if (typeof __webpack_nonce__ !== "undefined") {
1290
- return __webpack_nonce__;
1291
- }
1292
- return void 0;
1293
- };
1294
- function makeStyleTag() {
1295
- if (!document)
1296
- return null;
1297
- var tag = document.createElement("style");
1298
- tag.type = "text/css";
1299
- var nonce = getNonce();
1300
- if (nonce) {
1301
- tag.setAttribute("nonce", nonce);
1302
- }
1303
- return tag;
1304
- }
1305
- function injectStyles(tag, css) {
1306
- if (tag.styleSheet) {
1307
- tag.styleSheet.cssText = css;
1308
- } else {
1309
- tag.appendChild(document.createTextNode(css));
1310
- }
1311
- }
1312
- function insertStyleTag(tag) {
1313
- var head = document.head || document.getElementsByTagName("head")[0];
1314
- head.appendChild(tag);
1315
- }
1316
- var stylesheetSingleton = function() {
1317
- var counter = 0;
1318
- var stylesheet = null;
1319
- return {
1320
- add: function(style) {
1321
- if (counter == 0) {
1322
- if (stylesheet = makeStyleTag()) {
1323
- injectStyles(stylesheet, style);
1324
- insertStyleTag(stylesheet);
1325
- }
1326
- }
1327
- counter++;
1328
- },
1329
- remove: function() {
1330
- counter--;
1331
- if (!counter && stylesheet) {
1332
- stylesheet.parentNode && stylesheet.parentNode.removeChild(stylesheet);
1333
- stylesheet = null;
1334
- }
1335
- }
1336
- };
1337
- };
1338
- var styleHookSingleton = function() {
1339
- var sheet = stylesheetSingleton();
1340
- return function(styles, isDynamic) {
1341
- React.useEffect(function() {
1342
- sheet.add(styles);
1343
- return function() {
1344
- sheet.remove();
1345
- };
1346
- }, [styles && isDynamic]);
1347
- };
1348
- };
1349
- var styleSingleton = function() {
1350
- var useStyle = styleHookSingleton();
1351
- var Sheet = function(_a2) {
1352
- var styles = _a2.styles, dynamic = _a2.dynamic;
1353
- useStyle(styles, dynamic);
1354
- return null;
1355
- };
1356
- return Sheet;
1357
- };
1358
- var zeroGap = {
1359
- left: 0,
1360
- top: 0,
1361
- right: 0,
1362
- gap: 0
1363
- };
1364
- var parse = function(x) {
1365
- return parseInt(x || "", 10) || 0;
1366
- };
1367
- var getOffset = function(gapMode) {
1368
- var cs = window.getComputedStyle(document.body);
1369
- var left = cs[gapMode === "padding" ? "paddingLeft" : "marginLeft"];
1370
- var top = cs[gapMode === "padding" ? "paddingTop" : "marginTop"];
1371
- var right = cs[gapMode === "padding" ? "paddingRight" : "marginRight"];
1372
- return [parse(left), parse(top), parse(right)];
1373
- };
1374
- var getGapWidth = function(gapMode) {
1375
- if (gapMode === void 0) {
1376
- gapMode = "margin";
1377
- }
1378
- if (typeof window === "undefined") {
1379
- return zeroGap;
1380
- }
1381
- var offsets = getOffset(gapMode);
1382
- var documentWidth = document.documentElement.clientWidth;
1383
- var windowWidth = window.innerWidth;
1384
- return {
1385
- left: offsets[0],
1386
- top: offsets[1],
1387
- right: offsets[2],
1388
- gap: Math.max(0, windowWidth - documentWidth + offsets[2] - offsets[0])
1389
- };
1390
- };
1391
- var Style = styleSingleton();
1392
- var lockAttribute = "data-scroll-locked";
1393
- var getStyles = function(_a2, allowRelative, gapMode, important) {
1394
- var left = _a2.left, top = _a2.top, right = _a2.right, gap = _a2.gap;
1395
- if (gapMode === void 0) {
1396
- gapMode = "margin";
1397
- }
1398
- 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([
1399
- allowRelative && "position: relative ".concat(important, ";"),
1400
- 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 "),
1401
- gapMode === "padding" && "padding-right: ".concat(gap, "px ").concat(important, ";")
1402
- ].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");
1403
- };
1404
- var getCurrentUseCounter = function() {
1405
- var counter = parseInt(document.body.getAttribute(lockAttribute) || "0", 10);
1406
- return isFinite(counter) ? counter : 0;
1407
- };
1408
- var useLockAttribute = function() {
1409
- React.useEffect(function() {
1410
- document.body.setAttribute(lockAttribute, (getCurrentUseCounter() + 1).toString());
1411
- return function() {
1412
- var newCounter = getCurrentUseCounter() - 1;
1413
- if (newCounter <= 0) {
1414
- document.body.removeAttribute(lockAttribute);
1415
- } else {
1416
- document.body.setAttribute(lockAttribute, newCounter.toString());
1417
- }
1418
- };
1419
- }, []);
1420
- };
1421
- var RemoveScrollBar = function(_a2) {
1422
- var noRelative = _a2.noRelative, noImportant = _a2.noImportant, _b = _a2.gapMode, gapMode = _b === void 0 ? "margin" : _b;
1423
- useLockAttribute();
1424
- var gap = React.useMemo(function() {
1425
- return getGapWidth(gapMode);
1426
- }, [gapMode]);
1427
- return React.createElement(Style, { styles: getStyles(gap, !noRelative, gapMode, !noImportant ? "!important" : "") });
1428
- };
1429
- var passiveSupported = false;
1430
- if (typeof window !== "undefined") {
1431
- try {
1432
- var options = Object.defineProperty({}, "passive", {
1433
- get: function() {
1434
- passiveSupported = true;
1435
- return true;
1436
- }
1437
- });
1438
- window.addEventListener("test", options, options);
1439
- window.removeEventListener("test", options, options);
1440
- } catch (err) {
1441
- passiveSupported = false;
1442
- }
1443
- }
1444
- var nonPassive = passiveSupported ? { passive: false } : false;
1445
- var alwaysContainsScroll = function(node) {
1446
- return node.tagName === "TEXTAREA";
1447
- };
1448
- var elementCanBeScrolled = function(node, overflow) {
1449
- if (!(node instanceof Element)) {
1450
- return false;
1451
- }
1452
- var styles = window.getComputedStyle(node);
1453
- return (
1454
- // not-not-scrollable
1455
- styles[overflow] !== "hidden" && // contains scroll inside self
1456
- !(styles.overflowY === styles.overflowX && !alwaysContainsScroll(node) && styles[overflow] === "visible")
1457
- );
1458
- };
1459
- var elementCouldBeVScrolled = function(node) {
1460
- return elementCanBeScrolled(node, "overflowY");
1461
- };
1462
- var elementCouldBeHScrolled = function(node) {
1463
- return elementCanBeScrolled(node, "overflowX");
1464
- };
1465
- var locationCouldBeScrolled = function(axis, node) {
1466
- var ownerDocument = node.ownerDocument;
1467
- var current = node;
1468
- do {
1469
- if (typeof ShadowRoot !== "undefined" && current instanceof ShadowRoot) {
1470
- current = current.host;
1471
- }
1472
- var isScrollable = elementCouldBeScrolled(axis, current);
1473
- if (isScrollable) {
1474
- var _a2 = getScrollVariables(axis, current), scrollHeight = _a2[1], clientHeight = _a2[2];
1475
- if (scrollHeight > clientHeight) {
1476
- return true;
1477
- }
1478
- }
1479
- current = current.parentNode;
1480
- } while (current && current !== ownerDocument.body);
1481
- return false;
1482
- };
1483
- var getVScrollVariables = function(_a2) {
1484
- var scrollTop = _a2.scrollTop, scrollHeight = _a2.scrollHeight, clientHeight = _a2.clientHeight;
1485
- return [
1486
- scrollTop,
1487
- scrollHeight,
1488
- clientHeight
1489
- ];
1490
- };
1491
- var getHScrollVariables = function(_a2) {
1492
- var scrollLeft = _a2.scrollLeft, scrollWidth = _a2.scrollWidth, clientWidth = _a2.clientWidth;
1493
- return [
1494
- scrollLeft,
1495
- scrollWidth,
1496
- clientWidth
1497
- ];
1498
- };
1499
- var elementCouldBeScrolled = function(axis, node) {
1500
- return axis === "v" ? elementCouldBeVScrolled(node) : elementCouldBeHScrolled(node);
1501
- };
1502
- var getScrollVariables = function(axis, node) {
1503
- return axis === "v" ? getVScrollVariables(node) : getHScrollVariables(node);
1504
- };
1505
- var getDirectionFactor = function(axis, direction) {
1506
- return axis === "h" && direction === "rtl" ? -1 : 1;
1507
- };
1508
- var handleScroll = function(axis, endTarget, event, sourceDelta, noOverscroll) {
1509
- var directionFactor = getDirectionFactor(axis, window.getComputedStyle(endTarget).direction);
1510
- var delta = directionFactor * sourceDelta;
1511
- var target = event.target;
1512
- var targetInLock = endTarget.contains(target);
1513
- var shouldCancelScroll = false;
1514
- var isDeltaPositive = delta > 0;
1515
- var availableScroll = 0;
1516
- var availableScrollTop = 0;
1517
- do {
1518
- var _a2 = getScrollVariables(axis, target), position = _a2[0], scroll_1 = _a2[1], capacity = _a2[2];
1519
- var elementScroll = scroll_1 - capacity - directionFactor * position;
1520
- if (position || elementScroll) {
1521
- if (elementCouldBeScrolled(axis, target)) {
1522
- availableScroll += elementScroll;
1523
- availableScrollTop += position;
1524
- }
1525
- }
1526
- if (target instanceof ShadowRoot) {
1527
- target = target.host;
1528
- } else {
1529
- target = target.parentNode;
1530
- }
1531
- } while (
1532
- // portaled content
1533
- !targetInLock && target !== document.body || // self content
1534
- targetInLock && (endTarget.contains(target) || endTarget === target)
1535
- );
1536
- if (isDeltaPositive && (Math.abs(availableScroll) < 1 || false)) {
1537
- shouldCancelScroll = true;
1538
- } else if (!isDeltaPositive && (Math.abs(availableScrollTop) < 1 || false)) {
1539
- shouldCancelScroll = true;
1540
- }
1541
- return shouldCancelScroll;
1542
- };
1543
- var getTouchXY = function(event) {
1544
- return "changedTouches" in event ? [event.changedTouches[0].clientX, event.changedTouches[0].clientY] : [0, 0];
1545
- };
1546
- var getDeltaXY = function(event) {
1547
- return [event.deltaX, event.deltaY];
1548
- };
1549
- var extractRef = function(ref) {
1550
- return ref && "current" in ref ? ref.current : ref;
1551
- };
1552
- var deltaCompare = function(x, y) {
1553
- return x[0] === y[0] && x[1] === y[1];
1554
- };
1555
- var generateStyle = function(id) {
1556
- return "\n .block-interactivity-".concat(id, " {pointer-events: none;}\n .allow-interactivity-").concat(id, " {pointer-events: all;}\n");
1557
- };
1558
- var idCounter = 0;
1559
- var lockStack = [];
1560
- function RemoveScrollSideCar(props) {
1561
- var shouldPreventQueue = React.useRef([]);
1562
- var touchStartRef = React.useRef([0, 0]);
1563
- var activeAxis = React.useRef();
1564
- var id = React.useState(idCounter++)[0];
1565
- var Style2 = React.useState(styleSingleton)[0];
1566
- var lastProps = React.useRef(props);
1567
- React.useEffect(function() {
1568
- lastProps.current = props;
1569
- }, [props]);
1570
- React.useEffect(function() {
1571
- if (props.inert) {
1572
- document.body.classList.add("block-interactivity-".concat(id));
1573
- var allow_1 = __spreadArray([props.lockRef.current], (props.shards || []).map(extractRef), true).filter(Boolean);
1574
- allow_1.forEach(function(el) {
1575
- return el.classList.add("allow-interactivity-".concat(id));
1576
- });
1577
- return function() {
1578
- document.body.classList.remove("block-interactivity-".concat(id));
1579
- allow_1.forEach(function(el) {
1580
- return el.classList.remove("allow-interactivity-".concat(id));
1581
- });
1582
- };
1583
- }
1584
- return;
1585
- }, [props.inert, props.lockRef.current, props.shards]);
1586
- var shouldCancelEvent = React.useCallback(function(event, parent) {
1587
- if ("touches" in event && event.touches.length === 2 || event.type === "wheel" && event.ctrlKey) {
1588
- return !lastProps.current.allowPinchZoom;
1589
- }
1590
- var touch = getTouchXY(event);
1591
- var touchStart = touchStartRef.current;
1592
- var deltaX = "deltaX" in event ? event.deltaX : touchStart[0] - touch[0];
1593
- var deltaY = "deltaY" in event ? event.deltaY : touchStart[1] - touch[1];
1594
- var currentAxis;
1595
- var target = event.target;
1596
- var moveDirection = Math.abs(deltaX) > Math.abs(deltaY) ? "h" : "v";
1597
- if ("touches" in event && moveDirection === "h" && target.type === "range") {
1598
- return false;
1599
- }
1600
- var canBeScrolledInMainDirection = locationCouldBeScrolled(moveDirection, target);
1601
- if (!canBeScrolledInMainDirection) {
1602
- return true;
1603
- }
1604
- if (canBeScrolledInMainDirection) {
1605
- currentAxis = moveDirection;
1606
- } else {
1607
- currentAxis = moveDirection === "v" ? "h" : "v";
1608
- canBeScrolledInMainDirection = locationCouldBeScrolled(moveDirection, target);
1609
- }
1610
- if (!canBeScrolledInMainDirection) {
1611
- return false;
1612
- }
1613
- if (!activeAxis.current && "changedTouches" in event && (deltaX || deltaY)) {
1614
- activeAxis.current = currentAxis;
1615
- }
1616
- if (!currentAxis) {
1617
- return true;
1618
- }
1619
- var cancelingAxis = activeAxis.current || currentAxis;
1620
- return handleScroll(cancelingAxis, parent, event, cancelingAxis === "h" ? deltaX : deltaY);
1621
- }, []);
1622
- var shouldPrevent = React.useCallback(function(_event) {
1623
- var event = _event;
1624
- if (!lockStack.length || lockStack[lockStack.length - 1] !== Style2) {
1625
- return;
1626
- }
1627
- var delta = "deltaY" in event ? getDeltaXY(event) : getTouchXY(event);
1628
- var sourceEvent = shouldPreventQueue.current.filter(function(e) {
1629
- return e.name === event.type && (e.target === event.target || event.target === e.shadowParent) && deltaCompare(e.delta, delta);
1630
- })[0];
1631
- if (sourceEvent && sourceEvent.should) {
1632
- if (event.cancelable) {
1633
- event.preventDefault();
1634
- }
1635
- return;
1636
- }
1637
- if (!sourceEvent) {
1638
- var shardNodes = (lastProps.current.shards || []).map(extractRef).filter(Boolean).filter(function(node) {
1639
- return node.contains(event.target);
1640
- });
1641
- var shouldStop = shardNodes.length > 0 ? shouldCancelEvent(event, shardNodes[0]) : !lastProps.current.noIsolation;
1642
- if (shouldStop) {
1643
- if (event.cancelable) {
1644
- event.preventDefault();
1645
- }
1646
- }
1647
- }
1648
- }, []);
1649
- var shouldCancel = React.useCallback(function(name, delta, target, should) {
1650
- var event = { name, delta, target, should, shadowParent: getOutermostShadowParent(target) };
1651
- shouldPreventQueue.current.push(event);
1652
- setTimeout(function() {
1653
- shouldPreventQueue.current = shouldPreventQueue.current.filter(function(e) {
1654
- return e !== event;
1655
- });
1656
- }, 1);
1657
- }, []);
1658
- var scrollTouchStart = React.useCallback(function(event) {
1659
- touchStartRef.current = getTouchXY(event);
1660
- activeAxis.current = void 0;
1661
- }, []);
1662
- var scrollWheel = React.useCallback(function(event) {
1663
- shouldCancel(event.type, getDeltaXY(event), event.target, shouldCancelEvent(event, props.lockRef.current));
1664
- }, []);
1665
- var scrollTouchMove = React.useCallback(function(event) {
1666
- shouldCancel(event.type, getTouchXY(event), event.target, shouldCancelEvent(event, props.lockRef.current));
1667
- }, []);
1668
- React.useEffect(function() {
1669
- lockStack.push(Style2);
1670
- props.setCallbacks({
1671
- onScrollCapture: scrollWheel,
1672
- onWheelCapture: scrollWheel,
1673
- onTouchMoveCapture: scrollTouchMove
1674
- });
1675
- document.addEventListener("wheel", shouldPrevent, nonPassive);
1676
- document.addEventListener("touchmove", shouldPrevent, nonPassive);
1677
- document.addEventListener("touchstart", scrollTouchStart, nonPassive);
1678
- return function() {
1679
- lockStack = lockStack.filter(function(inst) {
1680
- return inst !== Style2;
1681
- });
1682
- document.removeEventListener("wheel", shouldPrevent, nonPassive);
1683
- document.removeEventListener("touchmove", shouldPrevent, nonPassive);
1684
- document.removeEventListener("touchstart", scrollTouchStart, nonPassive);
1685
- };
1686
- }, []);
1687
- var removeScrollBar = props.removeScrollBar, inert = props.inert;
1688
- return React.createElement(
1689
- React.Fragment,
1690
- null,
1691
- inert ? React.createElement(Style2, { styles: generateStyle(id) }) : null,
1692
- removeScrollBar ? React.createElement(RemoveScrollBar, { gapMode: props.gapMode }) : null
1693
- );
1694
- }
1695
- function getOutermostShadowParent(node) {
1696
- var shadowParent = null;
1697
- while (node !== null) {
1698
- if (node instanceof ShadowRoot) {
1699
- shadowParent = node.host;
1700
- node = node.host;
1701
- }
1702
- node = node.parentNode;
1703
- }
1704
- return shadowParent;
1705
- }
1706
- const SideCar = exportSidecar(effectCar, RemoveScrollSideCar);
1707
- var ReactRemoveScroll = React.forwardRef(function(props, ref) {
1708
- return React.createElement(RemoveScroll, __assign({}, props, { ref, sideCar: SideCar }));
1709
- });
1710
- ReactRemoveScroll.classNames = RemoveScroll.classNames;
1711
- var getDefaultParent = function(originalTarget) {
1712
- if (typeof document === "undefined") {
1713
- return null;
1714
- }
1715
- var sampleTarget = Array.isArray(originalTarget) ? originalTarget[0] : originalTarget;
1716
- return sampleTarget.ownerDocument.body;
1717
- };
1718
- var counterMap = /* @__PURE__ */ new WeakMap();
1719
- var uncontrolledNodes = /* @__PURE__ */ new WeakMap();
1720
- var markerMap = {};
1721
- var lockCount = 0;
1722
- var unwrapHost = function(node) {
1723
- return node && (node.host || unwrapHost(node.parentNode));
1724
- };
1725
- var correctTargets = function(parent, targets) {
1726
- return targets.map(function(target) {
1727
- if (parent.contains(target)) {
1728
- return target;
1729
- }
1730
- var correctedTarget = unwrapHost(target);
1731
- if (correctedTarget && parent.contains(correctedTarget)) {
1732
- return correctedTarget;
1733
- }
1734
- console.error("aria-hidden", target, "in not contained inside", parent, ". Doing nothing");
1735
- return null;
1736
- }).filter(function(x) {
1737
- return Boolean(x);
1738
- });
1739
- };
1740
- var applyAttributeToOthers = function(originalTarget, parentNode, markerName, controlAttribute) {
1741
- var targets = correctTargets(parentNode, Array.isArray(originalTarget) ? originalTarget : [originalTarget]);
1742
- if (!markerMap[markerName]) {
1743
- markerMap[markerName] = /* @__PURE__ */ new WeakMap();
1744
- }
1745
- var markerCounter = markerMap[markerName];
1746
- var hiddenNodes = [];
1747
- var elementsToKeep = /* @__PURE__ */ new Set();
1748
- var elementsToStop = new Set(targets);
1749
- var keep = function(el) {
1750
- if (!el || elementsToKeep.has(el)) {
1751
- return;
1752
- }
1753
- elementsToKeep.add(el);
1754
- keep(el.parentNode);
1755
- };
1756
- targets.forEach(keep);
1757
- var deep = function(parent) {
1758
- if (!parent || elementsToStop.has(parent)) {
1759
- return;
1760
- }
1761
- Array.prototype.forEach.call(parent.children, function(node) {
1762
- if (elementsToKeep.has(node)) {
1763
- deep(node);
1764
- } else {
1765
- try {
1766
- var attr = node.getAttribute(controlAttribute);
1767
- var alreadyHidden = attr !== null && attr !== "false";
1768
- var counterValue = (counterMap.get(node) || 0) + 1;
1769
- var markerValue = (markerCounter.get(node) || 0) + 1;
1770
- counterMap.set(node, counterValue);
1771
- markerCounter.set(node, markerValue);
1772
- hiddenNodes.push(node);
1773
- if (counterValue === 1 && alreadyHidden) {
1774
- uncontrolledNodes.set(node, true);
1775
- }
1776
- if (markerValue === 1) {
1777
- node.setAttribute(markerName, "true");
1778
- }
1779
- if (!alreadyHidden) {
1780
- node.setAttribute(controlAttribute, "true");
1781
- }
1782
- } catch (e) {
1783
- console.error("aria-hidden: cannot operate on ", node, e);
1784
- }
1785
- }
1786
- });
1787
- };
1788
- deep(parentNode);
1789
- elementsToKeep.clear();
1790
- lockCount++;
1791
- return function() {
1792
- hiddenNodes.forEach(function(node) {
1793
- var counterValue = counterMap.get(node) - 1;
1794
- var markerValue = markerCounter.get(node) - 1;
1795
- counterMap.set(node, counterValue);
1796
- markerCounter.set(node, markerValue);
1797
- if (!counterValue) {
1798
- if (!uncontrolledNodes.has(node)) {
1799
- node.removeAttribute(controlAttribute);
1800
- }
1801
- uncontrolledNodes.delete(node);
1802
- }
1803
- if (!markerValue) {
1804
- node.removeAttribute(markerName);
1805
- }
1806
- });
1807
- lockCount--;
1808
- if (!lockCount) {
1809
- counterMap = /* @__PURE__ */ new WeakMap();
1810
- counterMap = /* @__PURE__ */ new WeakMap();
1811
- uncontrolledNodes = /* @__PURE__ */ new WeakMap();
1812
- markerMap = {};
1813
- }
1814
- };
1815
- };
1816
- var hideOthers = function(originalTarget, parentNode, markerName) {
1817
- if (markerName === void 0) {
1818
- markerName = "data-aria-hidden";
1819
- }
1820
- var targets = Array.from(Array.isArray(originalTarget) ? originalTarget : [originalTarget]);
1821
- var activeParentNode = getDefaultParent(originalTarget);
1822
- if (!activeParentNode) {
1823
- return function() {
1824
- return null;
1825
- };
1826
- }
1827
- targets.push.apply(targets, Array.from(activeParentNode.querySelectorAll("[aria-live]")));
1828
- return applyAttributeToOthers(targets, activeParentNode, markerName, "aria-hidden");
1829
- };
1830
- var DIALOG_NAME = "Dialog";
1831
- var [createDialogContext, createDialogScope] = createContextScope(DIALOG_NAME);
1832
- var [DialogProvider, useDialogContext] = createDialogContext(DIALOG_NAME);
1833
- var Dialog = (props) => {
1834
- const {
1835
- __scopeDialog,
1836
- children,
1837
- open: openProp,
1838
- defaultOpen,
1839
- onOpenChange,
1840
- modal = true
1841
- } = props;
1842
- const triggerRef = React.useRef(null);
1843
- const contentRef = React.useRef(null);
1844
- const [open, setOpen] = useControllableState({
1845
- prop: openProp,
1846
- defaultProp: defaultOpen ?? false,
1847
- onChange: onOpenChange,
1848
- caller: DIALOG_NAME
1849
- });
1850
- return /* @__PURE__ */ jsx(
1851
- DialogProvider,
1852
- {
1853
- scope: __scopeDialog,
1854
- triggerRef,
1855
- contentRef,
1856
- contentId: useId(),
1857
- titleId: useId(),
1858
- descriptionId: useId(),
1859
- open,
1860
- onOpenChange: setOpen,
1861
- onOpenToggle: React.useCallback(() => setOpen((prevOpen) => !prevOpen), [setOpen]),
1862
- modal,
1863
- children
1864
- }
1865
- );
1866
- };
1867
- Dialog.displayName = DIALOG_NAME;
1868
- var TRIGGER_NAME = "DialogTrigger";
1869
- var DialogTrigger = React.forwardRef(
1870
- (props, forwardedRef) => {
1871
- const { __scopeDialog, ...triggerProps } = props;
1872
- const context = useDialogContext(TRIGGER_NAME, __scopeDialog);
1873
- const composedTriggerRef = useComposedRefs(forwardedRef, context.triggerRef);
1874
- return /* @__PURE__ */ jsx(
1875
- Primitive.button,
1876
- {
1877
- type: "button",
1878
- "aria-haspopup": "dialog",
1879
- "aria-expanded": context.open,
1880
- "aria-controls": context.contentId,
1881
- "data-state": getState(context.open),
1882
- ...triggerProps,
1883
- ref: composedTriggerRef,
1884
- onClick: composeEventHandlers(props.onClick, context.onOpenToggle)
1885
- }
1886
- );
1887
- }
1888
- );
1889
- DialogTrigger.displayName = TRIGGER_NAME;
1890
- var PORTAL_NAME = "DialogPortal";
1891
- var [PortalProvider, usePortalContext] = createDialogContext(PORTAL_NAME, {
1892
- forceMount: void 0
1893
- });
1894
- var DialogPortal = (props) => {
1895
- const { __scopeDialog, forceMount, children, container } = props;
1896
- const context = useDialogContext(PORTAL_NAME, __scopeDialog);
1897
- return /* @__PURE__ */ jsx(PortalProvider, { scope: __scopeDialog, forceMount, children: React.Children.map(children, (child) => /* @__PURE__ */ jsx(Presence, { present: forceMount || context.open, children: /* @__PURE__ */ jsx(Portal$1, { asChild: true, container, children: child }) })) });
1898
- };
1899
- DialogPortal.displayName = PORTAL_NAME;
1900
- var OVERLAY_NAME = "DialogOverlay";
1901
- var DialogOverlay = React.forwardRef(
1902
- (props, forwardedRef) => {
1903
- const portalContext = usePortalContext(OVERLAY_NAME, props.__scopeDialog);
1904
- const { forceMount = portalContext.forceMount, ...overlayProps } = props;
1905
- const context = useDialogContext(OVERLAY_NAME, props.__scopeDialog);
1906
- return context.modal ? /* @__PURE__ */ jsx(Presence, { present: forceMount || context.open, children: /* @__PURE__ */ jsx(DialogOverlayImpl, { ...overlayProps, ref: forwardedRef }) }) : null;
1907
- }
1908
- );
1909
- DialogOverlay.displayName = OVERLAY_NAME;
1910
- var Slot = /* @__PURE__ */ createSlot("DialogOverlay.RemoveScroll");
1911
- var DialogOverlayImpl = React.forwardRef(
1912
- (props, forwardedRef) => {
1913
- const { __scopeDialog, ...overlayProps } = props;
1914
- const context = useDialogContext(OVERLAY_NAME, __scopeDialog);
1915
- return (
1916
- // Make sure `Content` is scrollable even when it doesn't live inside `RemoveScroll`
1917
- // ie. when `Overlay` and `Content` are siblings
1918
- /* @__PURE__ */ jsx(ReactRemoveScroll, { as: Slot, allowPinchZoom: true, shards: [context.contentRef], children: /* @__PURE__ */ jsx(
1919
- Primitive.div,
1920
- {
1921
- "data-state": getState(context.open),
1922
- ...overlayProps,
1923
- ref: forwardedRef,
1924
- style: { pointerEvents: "auto", ...overlayProps.style }
1925
- }
1926
- ) })
1927
- );
1928
- }
1929
- );
1930
- var CONTENT_NAME = "DialogContent";
1931
- var DialogContent = React.forwardRef(
1932
- (props, forwardedRef) => {
1933
- const portalContext = usePortalContext(CONTENT_NAME, props.__scopeDialog);
1934
- const { forceMount = portalContext.forceMount, ...contentProps } = props;
1935
- const context = useDialogContext(CONTENT_NAME, props.__scopeDialog);
1936
- return /* @__PURE__ */ jsx(Presence, { present: forceMount || context.open, children: context.modal ? /* @__PURE__ */ jsx(DialogContentModal, { ...contentProps, ref: forwardedRef }) : /* @__PURE__ */ jsx(DialogContentNonModal, { ...contentProps, ref: forwardedRef }) });
1937
- }
1938
- );
1939
- DialogContent.displayName = CONTENT_NAME;
1940
- var DialogContentModal = React.forwardRef(
1941
- (props, forwardedRef) => {
1942
- const context = useDialogContext(CONTENT_NAME, props.__scopeDialog);
1943
- const contentRef = React.useRef(null);
1944
- const composedRefs = useComposedRefs(forwardedRef, context.contentRef, contentRef);
1945
- React.useEffect(() => {
1946
- const content = contentRef.current;
1947
- if (content) return hideOthers(content);
1948
- }, []);
1949
- return /* @__PURE__ */ jsx(
1950
- DialogContentImpl,
1951
- {
1952
- ...props,
1953
- ref: composedRefs,
1954
- trapFocus: context.open,
1955
- disableOutsidePointerEvents: true,
1956
- onCloseAutoFocus: composeEventHandlers(props.onCloseAutoFocus, (event) => {
1957
- var _a2;
1958
- event.preventDefault();
1959
- (_a2 = context.triggerRef.current) == null ? void 0 : _a2.focus();
1960
- }),
1961
- onPointerDownOutside: composeEventHandlers(props.onPointerDownOutside, (event) => {
1962
- const originalEvent = event.detail.originalEvent;
1963
- const ctrlLeftClick = originalEvent.button === 0 && originalEvent.ctrlKey === true;
1964
- const isRightClick = originalEvent.button === 2 || ctrlLeftClick;
1965
- if (isRightClick) event.preventDefault();
1966
- }),
1967
- onFocusOutside: composeEventHandlers(
1968
- props.onFocusOutside,
1969
- (event) => event.preventDefault()
1970
- )
1971
- }
1972
- );
1973
- }
1974
- );
1975
- var DialogContentNonModal = React.forwardRef(
1976
- (props, forwardedRef) => {
1977
- const context = useDialogContext(CONTENT_NAME, props.__scopeDialog);
1978
- const hasInteractedOutsideRef = React.useRef(false);
1979
- const hasPointerDownOutsideRef = React.useRef(false);
1980
- return /* @__PURE__ */ jsx(
1981
- DialogContentImpl,
1982
- {
1983
- ...props,
1984
- ref: forwardedRef,
1985
- trapFocus: false,
1986
- disableOutsidePointerEvents: false,
1987
- onCloseAutoFocus: (event) => {
1988
- var _a2, _b;
1989
- (_a2 = props.onCloseAutoFocus) == null ? void 0 : _a2.call(props, event);
1990
- if (!event.defaultPrevented) {
1991
- if (!hasInteractedOutsideRef.current) (_b = context.triggerRef.current) == null ? void 0 : _b.focus();
1992
- event.preventDefault();
1993
- }
1994
- hasInteractedOutsideRef.current = false;
1995
- hasPointerDownOutsideRef.current = false;
1996
- },
1997
- onInteractOutside: (event) => {
1998
- var _a2, _b;
1999
- (_a2 = props.onInteractOutside) == null ? void 0 : _a2.call(props, event);
2000
- if (!event.defaultPrevented) {
2001
- hasInteractedOutsideRef.current = true;
2002
- if (event.detail.originalEvent.type === "pointerdown") {
2003
- hasPointerDownOutsideRef.current = true;
2004
- }
2005
- }
2006
- const target = event.target;
2007
- const targetIsTrigger = (_b = context.triggerRef.current) == null ? void 0 : _b.contains(target);
2008
- if (targetIsTrigger) event.preventDefault();
2009
- if (event.detail.originalEvent.type === "focusin" && hasPointerDownOutsideRef.current) {
2010
- event.preventDefault();
2011
- }
2012
- }
2013
- }
2014
- );
2015
- }
2016
- );
2017
- var DialogContentImpl = React.forwardRef(
2018
- (props, forwardedRef) => {
2019
- const { __scopeDialog, trapFocus, onOpenAutoFocus, onCloseAutoFocus, ...contentProps } = props;
2020
- const context = useDialogContext(CONTENT_NAME, __scopeDialog);
2021
- const contentRef = React.useRef(null);
2022
- const composedRefs = useComposedRefs(forwardedRef, contentRef);
2023
- useFocusGuards();
2024
- return /* @__PURE__ */ jsxs(Fragment, { children: [
2025
- /* @__PURE__ */ jsx(
2026
- FocusScope,
2027
- {
2028
- asChild: true,
2029
- loop: true,
2030
- trapped: trapFocus,
2031
- onMountAutoFocus: onOpenAutoFocus,
2032
- onUnmountAutoFocus: onCloseAutoFocus,
2033
- children: /* @__PURE__ */ jsx(
2034
- DismissableLayer,
2035
- {
2036
- role: "dialog",
2037
- id: context.contentId,
2038
- "aria-describedby": context.descriptionId,
2039
- "aria-labelledby": context.titleId,
2040
- "data-state": getState(context.open),
2041
- ...contentProps,
2042
- ref: composedRefs,
2043
- onDismiss: () => context.onOpenChange(false)
2044
- }
2045
- )
2046
- }
2047
- ),
2048
- /* @__PURE__ */ jsxs(Fragment, { children: [
2049
- /* @__PURE__ */ jsx(TitleWarning, { titleId: context.titleId }),
2050
- /* @__PURE__ */ jsx(DescriptionWarning, { contentRef, descriptionId: context.descriptionId })
2051
- ] })
2052
- ] });
2053
- }
2054
- );
2055
- var TITLE_NAME = "DialogTitle";
2056
- var DialogTitle = React.forwardRef(
2057
- (props, forwardedRef) => {
2058
- const { __scopeDialog, ...titleProps } = props;
2059
- const context = useDialogContext(TITLE_NAME, __scopeDialog);
2060
- return /* @__PURE__ */ jsx(Primitive.h2, { id: context.titleId, ...titleProps, ref: forwardedRef });
2061
- }
2062
- );
2063
- DialogTitle.displayName = TITLE_NAME;
2064
- var DESCRIPTION_NAME = "DialogDescription";
2065
- var DialogDescription = React.forwardRef(
2066
- (props, forwardedRef) => {
2067
- const { __scopeDialog, ...descriptionProps } = props;
2068
- const context = useDialogContext(DESCRIPTION_NAME, __scopeDialog);
2069
- return /* @__PURE__ */ jsx(Primitive.p, { id: context.descriptionId, ...descriptionProps, ref: forwardedRef });
2070
- }
2071
- );
2072
- DialogDescription.displayName = DESCRIPTION_NAME;
2073
- var CLOSE_NAME = "DialogClose";
2074
- var DialogClose = React.forwardRef(
2075
- (props, forwardedRef) => {
2076
- const { __scopeDialog, ...closeProps } = props;
2077
- const context = useDialogContext(CLOSE_NAME, __scopeDialog);
2078
- return /* @__PURE__ */ jsx(
2079
- Primitive.button,
2080
- {
2081
- type: "button",
2082
- ...closeProps,
2083
- ref: forwardedRef,
2084
- onClick: composeEventHandlers(props.onClick, () => context.onOpenChange(false))
2085
- }
2086
- );
2087
- }
2088
- );
2089
- DialogClose.displayName = CLOSE_NAME;
2090
- function getState(open) {
2091
- return open ? "open" : "closed";
2092
- }
2093
- var TITLE_WARNING_NAME = "DialogTitleWarning";
2094
- var [WarningProvider, useWarningContext] = createContext2(TITLE_WARNING_NAME, {
2095
- contentName: CONTENT_NAME,
2096
- titleName: TITLE_NAME,
2097
- docsSlug: "dialog"
2098
- });
2099
- var TitleWarning = ({ titleId }) => {
2100
- const titleWarningContext = useWarningContext(TITLE_WARNING_NAME);
2101
- const MESSAGE = `\`${titleWarningContext.contentName}\` requires a \`${titleWarningContext.titleName}\` for the component to be accessible for screen reader users.
2102
-
2103
- If you want to hide the \`${titleWarningContext.titleName}\`, you can wrap it with our VisuallyHidden component.
2104
-
2105
- For more information, see https://radix-ui.com/primitives/docs/components/${titleWarningContext.docsSlug}`;
2106
- React.useEffect(() => {
2107
- if (titleId) {
2108
- const hasTitle = document.getElementById(titleId);
2109
- if (!hasTitle) console.error(MESSAGE);
2110
- }
2111
- }, [MESSAGE, titleId]);
2112
- return null;
2113
- };
2114
- var DESCRIPTION_WARNING_NAME = "DialogDescriptionWarning";
2115
- var DescriptionWarning = ({ contentRef, descriptionId }) => {
2116
- const descriptionWarningContext = useWarningContext(DESCRIPTION_WARNING_NAME);
2117
- const MESSAGE = `Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${descriptionWarningContext.contentName}}.`;
2118
- React.useEffect(() => {
2119
- var _a2;
2120
- const describedById = (_a2 = contentRef.current) == null ? void 0 : _a2.getAttribute("aria-describedby");
2121
- if (descriptionId && describedById) {
2122
- const hasDescription = document.getElementById(descriptionId);
2123
- if (!hasDescription) console.warn(MESSAGE);
2124
- }
2125
- }, [MESSAGE, contentRef, descriptionId]);
2126
- return null;
2127
- };
2128
- var Root = Dialog;
2129
- var Trigger = DialogTrigger;
2130
- var Portal = DialogPortal;
2131
- var Overlay = DialogOverlay;
2132
- var Content = DialogContent;
2133
- var Close = DialogClose;
2134
160
  const ImageViewer = memo((props) => {
2135
161
  const { file, onClose } = props;
2136
162
  const imageRef = useRef(null);
@@ -2149,52 +175,37 @@ const ImageViewer = memo((props) => {
2149
175
  const handleDownload = useCallback(() => {
2150
176
  saveAs(file, file.name);
2151
177
  }, [file]);
2152
- return /* @__PURE__ */ jsx(Root, { open: true, onOpenChange: onClose, children: /* @__PURE__ */ jsx(Portal, { children: /* @__PURE__ */ jsx(
2153
- Overlay,
2154
- {
2155
- 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",
2156
- "data-floating-content": "",
2157
- children: /* @__PURE__ */ jsxs(
2158
- Content,
2159
- {
2160
- className: "absolute inset-0 py-12",
2161
- "data-floating-content": "",
2162
- onOpenAutoFocus: (e) => e.preventDefault(),
2163
- children: [
2164
- /* @__PURE__ */ jsxs(
2165
- ButtonGroup,
2166
- {
2167
- className: "flex gap-2 items-center top-0 absolute right-0 p-2",
2168
- accentColor: "base",
2169
- variant: "ghost",
2170
- children: [
2171
- /* @__PURE__ */ jsxs(Tooltip.Root, { children: [
2172
- /* @__PURE__ */ jsx(Tooltip.Trigger, { asChild: true, children: /* @__PURE__ */ jsx(IconButton, { onClick: handleCopy, "aria-label": "copy to clipboard", children: /* @__PURE__ */ jsx(Copy, { className: "h-4 w-4" }) }) }),
2173
- /* @__PURE__ */ jsx(Tooltip.Content, { size: "sm", children: "Copy" })
2174
- ] }),
2175
- /* @__PURE__ */ jsxs(Tooltip.Root, { children: [
2176
- /* @__PURE__ */ jsx(Tooltip.Trigger, { asChild: true, children: /* @__PURE__ */ jsx(IconButton, { onClick: handleDownload, "aria-label": "download", children: /* @__PURE__ */ jsx(Download, { className: "h-4 w-4" }) }) }),
2177
- /* @__PURE__ */ jsx(Tooltip.Content, { size: "sm", children: "Download" })
2178
- ] }),
2179
- /* @__PURE__ */ jsx(Separator, { orientation: "vertical", size: "sm" }),
2180
- /* @__PURE__ */ jsx(Close, { asChild: true, children: /* @__PURE__ */ jsx(IconButton, { onClick: onClose, "aria-label": "close", children: /* @__PURE__ */ jsx(X, { className: "h-4 w-4" }) }) })
2181
- ]
2182
- }
2183
- ),
2184
- /* @__PURE__ */ jsx("figure", { className: "size-full overflow-hidden p-4 flex justify-center items-center", children: /* @__PURE__ */ jsx(
2185
- "img",
2186
- {
2187
- ref: imageRef,
2188
- className: "max-w-full max-h-full",
2189
- src: URL.createObjectURL(file),
2190
- alt: file.name
2191
- }
2192
- ) })
2193
- ]
2194
- }
2195
- )
2196
- }
2197
- ) }) });
178
+ return /* @__PURE__ */ jsx(Overlay.Root, { open: true, onOpenChange: onClose, children: /* @__PURE__ */ jsxs(Overlay.Content, { onOpenAutoFocus: (e) => e.preventDefault(), children: [
179
+ /* @__PURE__ */ jsxs(
180
+ ButtonGroup,
181
+ {
182
+ className: "flex gap-2 items-center top-0 absolute right-0 p-2",
183
+ accentColor: "base",
184
+ variant: "ghost",
185
+ children: [
186
+ /* @__PURE__ */ jsxs(Tooltip.Root, { children: [
187
+ /* @__PURE__ */ jsx(Tooltip.Trigger, { asChild: true, children: /* @__PURE__ */ jsx(IconButton, { onClick: handleCopy, "aria-label": "copy to clipboard", children: /* @__PURE__ */ jsx(LuIcon, { icon: "copy" }) }) }),
188
+ /* @__PURE__ */ jsx(Tooltip.Content, { size: "sm", children: "Copy" })
189
+ ] }),
190
+ /* @__PURE__ */ jsxs(Tooltip.Root, { children: [
191
+ /* @__PURE__ */ jsx(Tooltip.Trigger, { asChild: true, children: /* @__PURE__ */ jsx(IconButton, { onClick: handleDownload, "aria-label": "download", children: /* @__PURE__ */ jsx(LuIcon, { icon: "download" }) }) }),
192
+ /* @__PURE__ */ jsx(Tooltip.Content, { size: "sm", children: "Download" })
193
+ ] }),
194
+ /* @__PURE__ */ jsx(Separator, { orientation: "vertical", size: "sm" }),
195
+ /* @__PURE__ */ jsx(Overlay.Close, { asChild: true, children: /* @__PURE__ */ jsx(IconButton, { onClick: onClose, "aria-label": "close", children: /* @__PURE__ */ jsx(LuIcon, { icon: "x" }) }) })
196
+ ]
197
+ }
198
+ ),
199
+ /* @__PURE__ */ jsx("figure", { className: "size-full overflow-hidden p-4 flex justify-center items-center", children: /* @__PURE__ */ jsx(
200
+ "img",
201
+ {
202
+ ref: imageRef,
203
+ className: "max-w-full max-h-full",
204
+ src: URL.createObjectURL(file),
205
+ alt: file.name
206
+ }
207
+ ) })
208
+ ] }) });
2198
209
  });
2199
210
  ImageViewer.displayName = "ImageViewer";
2200
211
  const ImageViewerProvider = memo((props) => {
@@ -2214,8 +225,7 @@ const ImageViewerProvider = memo((props) => {
2214
225
  if (config.onClose) config.onClose();
2215
226
  closeFileViewer();
2216
227
  }, [closeFileViewer, config]);
2217
- const value = useMemo(() => openFileViewer, [openFileViewer]);
2218
- return /* @__PURE__ */ jsxs(ImageViewerContext.Provider, { value, children: [
228
+ return /* @__PURE__ */ jsxs(ImageViewerContext.Provider, { value: openFileViewer, children: [
2219
229
  children,
2220
230
  config && /* @__PURE__ */ jsx(ImageViewer, { file: config.file, onClose: handleClose })
2221
231
  ] });
@@ -2266,7 +276,7 @@ const useFieldInput = (field, props) => {
2266
276
  };
2267
277
  const useFieldInputs = (fields, props) => {
2268
278
  return /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-4", children: fields.map((field) => {
2269
- return /* @__PURE__ */ jsx(Fragment$1, { children: field.render(props) }, field.identifier);
279
+ return /* @__PURE__ */ jsx(Fragment, { children: field.render(props) }, field.identifier);
2270
280
  }) });
2271
281
  };
2272
282
  const useFormikInput = (props) => {
@@ -2421,7 +431,7 @@ const MultiStringInput = memo((props) => {
2421
431
  "aria-label": "Add option",
2422
432
  disabled: !!internalError || disabled,
2423
433
  onClick: addOption,
2424
- children: /* @__PURE__ */ jsx(Plus, {})
434
+ children: /* @__PURE__ */ jsx(LuIcon, { icon: "plus" })
2425
435
  }
2426
436
  )
2427
437
  ] })
@@ -2468,7 +478,7 @@ const MultiStringInput = memo((props) => {
2468
478
  onClick: () => {
2469
479
  handleDeleteOption(index);
2470
480
  },
2471
- children: /* @__PURE__ */ jsx(X, { className: "h-3 w-3" })
481
+ children: /* @__PURE__ */ jsx(LuIcon, { icon: "x" })
2472
482
  }
2473
483
  )
2474
484
  ]
@@ -2656,7 +666,7 @@ const BooleanInput = memo((props) => {
2656
666
  accentColor: "primary",
2657
667
  variant: "surface",
2658
668
  ...rest,
2659
- children: /* @__PURE__ */ jsx(Checkbox.Indicator, { children: /* @__PURE__ */ jsx(Check, { className: "h-4 w-4" }) })
669
+ children: /* @__PURE__ */ jsx(Checkbox.Indicator, { children: /* @__PURE__ */ jsx(LuIcon, { icon: "check" }) })
2660
670
  }
2661
671
  )
2662
672
  }
@@ -3052,7 +1062,7 @@ const CheckboxListInput = memo((props) => {
3052
1062
  onValuesChange: handleChange,
3053
1063
  ...rest,
3054
1064
  children: field.options.map((option, index) => /* @__PURE__ */ jsxs("label", { className: "flex gap-2 items-center min-w-0", children: [
3055
- /* @__PURE__ */ jsx(CheckboxGroup.Item, { value: option.value, children: /* @__PURE__ */ jsx(CheckboxGroup.ItemIndicator, { children: /* @__PURE__ */ jsx(Check, { className: "h-4 w-4" }) }) }),
1065
+ /* @__PURE__ */ jsx(CheckboxGroup.Item, { value: option.value, children: /* @__PURE__ */ jsx(CheckboxGroup.ItemIndicator, { children: /* @__PURE__ */ jsx(LuIcon, { icon: "check" }) }) }),
3056
1066
  /* @__PURE__ */ jsx(Text, { size: "sm", accentColor: "base", className: "truncate", children: option.label })
3057
1067
  ] }, `${inputId}-${option.value}-${index}`))
3058
1068
  }
@@ -3154,7 +1164,7 @@ const DateInput = memo((props) => {
3154
1164
  month: "2-digit",
3155
1165
  day: "2-digit"
3156
1166
  }) : "yyyy-mm-dd",
3157
- /* @__PURE__ */ jsx(ChevronDown, { className: "h-4 w-4" })
1167
+ /* @__PURE__ */ jsx(LuIcon, { icon: "chevron-down" })
3158
1168
  ]
3159
1169
  }
3160
1170
  ) }),
@@ -3265,13 +1275,13 @@ const MultiSelectInput = memo((props) => {
3265
1275
  ...rest,
3266
1276
  children: [
3267
1277
  /* @__PURE__ */ jsx("span", { className: "truncate", children: value && value.length > 0 ? value.join(", ") : field.placeholder ?? "Select one or more..." }),
3268
- /* @__PURE__ */ jsx(ChevronDown, { className: "h-4 w-4" })
1278
+ /* @__PURE__ */ jsx(LuIcon, { icon: "chevron-down" })
3269
1279
  ]
3270
1280
  }
3271
1281
  ) }),
3272
1282
  /* @__PURE__ */ jsx(Menu.Content, { children: /* @__PURE__ */ jsx(Menu.Scroll, { children: /* @__PURE__ */ jsxs(Menu.MultiSelectGroup, { values: value, onValuesChange: handleChange, children: [
3273
1283
  /* @__PURE__ */ jsxs(Menu.SelectAllItem, { children: [
3274
- /* @__PURE__ */ jsx(Menu.CheckboxItemIndicator, { children: (indeterminate) => indeterminate ? /* @__PURE__ */ jsx(Minus, { className: "h-4 w-4" }) : /* @__PURE__ */ jsx(Check, { className: "h-4 w-4" }) }),
1284
+ /* @__PURE__ */ jsx(Menu.CheckboxItemIndicator, { children: (indeterminate) => indeterminate ? /* @__PURE__ */ jsx(LuIcon, { icon: "minus" }) : /* @__PURE__ */ jsx(LuIcon, { icon: "check" }) }),
3275
1285
  "Select all"
3276
1286
  ] }),
3277
1287
  field.options.map((option, index) => /* @__PURE__ */ jsxs(
@@ -3279,7 +1289,7 @@ const MultiSelectInput = memo((props) => {
3279
1289
  {
3280
1290
  value: option.value,
3281
1291
  children: [
3282
- /* @__PURE__ */ jsx(Menu.SelectedIndicator, { children: /* @__PURE__ */ jsx(Check, { className: "h-4 w-4" }) }),
1292
+ /* @__PURE__ */ jsx(Menu.SelectedIndicator, { children: /* @__PURE__ */ jsx(LuIcon, { icon: "check" }) }),
3283
1293
  option.label
3284
1294
  ]
3285
1295
  },
@@ -3683,7 +1693,7 @@ const RadioInput = memo((props) => {
3683
1693
  ...rest,
3684
1694
  children: [
3685
1695
  field.options.map((option, index) => /* @__PURE__ */ jsxs("label", { className: "flex gap-2 items-center min-w-0", children: [
3686
- /* @__PURE__ */ jsx(RadioGroup.Item, { value: option.value, children: /* @__PURE__ */ jsx(RadioGroup.Indicator, { children: /* @__PURE__ */ jsx(Circle, { className: "h-3 w-3 fill-current" }) }) }),
1696
+ /* @__PURE__ */ jsx(RadioGroup.Item, { value: option.value, children: /* @__PURE__ */ jsx(RadioGroup.Indicator, { children: /* @__PURE__ */ jsx(LuIcon, { icon: "chevron-down", className: "fill-current" }) }) }),
3687
1697
  /* @__PURE__ */ jsx(Text, { size: "sm", accentColor: "base", className: "truncate", children: option.label })
3688
1698
  ] }, `${inputId}-${option.value}-${index}`)),
3689
1699
  !!value && /* @__PURE__ */ jsxs(
@@ -3696,8 +1706,8 @@ const RadioInput = memo((props) => {
3696
1706
  accentColor: "base",
3697
1707
  size: "sm",
3698
1708
  children: [
3699
- /* @__PURE__ */ jsx(X, { className: "h-4 w-4" }),
3700
- " Clear"
1709
+ /* @__PURE__ */ jsx(LuIcon, { icon: "x" }),
1710
+ "Clear"
3701
1711
  ]
3702
1712
  }
3703
1713
  )
@@ -4854,9 +2864,9 @@ var StringUtils = (
4854
2864
  var e = encoding ? encoding.getName() : this.ISO88591;
4855
2865
  return StringEncoding.decode(new Uint8Array([code]), e);
4856
2866
  };
4857
- StringUtils2.guessEncoding = function(bytes, hints2) {
4858
- if (hints2 !== null && hints2 !== void 0 && void 0 !== hints2.get(DecodeHintType$1.CHARACTER_SET)) {
4859
- return hints2.get(DecodeHintType$1.CHARACTER_SET).toString();
2867
+ StringUtils2.guessEncoding = function(bytes, hints) {
2868
+ if (hints !== null && hints !== void 0 && void 0 !== hints.get(DecodeHintType$1.CHARACTER_SET)) {
2869
+ return hints.get(DecodeHintType$1.CHARACTER_SET).toString();
4860
2870
  }
4861
2871
  var length = bytes.length;
4862
2872
  var canBeISO88591 = true;
@@ -6202,8 +4212,8 @@ var BrowserCodeReader = (
6202
4212
  /**
6203
4213
  * Sets the hints.
6204
4214
  */
6205
- set: function(hints2) {
6206
- this._hints = hints2 || null;
4215
+ set: function(hints) {
4216
+ this._hints = hints || null;
6207
4217
  },
6208
4218
  enumerable: false,
6209
4219
  configurable: true
@@ -8029,12 +6039,12 @@ var MathUtils = (
8029
6039
  );
8030
6040
  };
8031
6041
  MathUtils2.sum = function(array) {
8032
- var count2 = 0;
6042
+ var count = 0;
8033
6043
  for (var i = 0, length_1 = array.length; i !== length_1; i++) {
8034
6044
  var a = array[i];
8035
- count2 += a;
6045
+ count += a;
8036
6046
  }
8037
- return count2;
6047
+ return count;
8038
6048
  };
8039
6049
  return MathUtils2;
8040
6050
  }()
@@ -8942,9 +6952,9 @@ var AztecReader = (
8942
6952
  function() {
8943
6953
  function AztecReader2() {
8944
6954
  }
8945
- AztecReader2.prototype.decode = function(image, hints2) {
8946
- if (hints2 === void 0) {
8947
- hints2 = null;
6955
+ AztecReader2.prototype.decode = function(image, hints) {
6956
+ if (hints === void 0) {
6957
+ hints = null;
8948
6958
  }
8949
6959
  var exception = null;
8950
6960
  var detector = new Detector$3(image.getBlackMatrix());
@@ -8953,7 +6963,7 @@ var AztecReader = (
8953
6963
  try {
8954
6964
  var detectorResult = detector.detectMirror(false);
8955
6965
  points = detectorResult.getPoints();
8956
- this.reportFoundResultPoints(hints2, points);
6966
+ this.reportFoundResultPoints(hints, points);
8957
6967
  decoderResult = new Decoder$2().decode(detectorResult);
8958
6968
  } catch (e) {
8959
6969
  exception = e;
@@ -8962,7 +6972,7 @@ var AztecReader = (
8962
6972
  try {
8963
6973
  var detectorResult = detector.detectMirror(true);
8964
6974
  points = detectorResult.getPoints();
8965
- this.reportFoundResultPoints(hints2, points);
6975
+ this.reportFoundResultPoints(hints, points);
8966
6976
  decoderResult = new Decoder$2().decode(detectorResult);
8967
6977
  } catch (e) {
8968
6978
  if (exception != null) {
@@ -8982,9 +6992,9 @@ var AztecReader = (
8982
6992
  }
8983
6993
  return result;
8984
6994
  };
8985
- AztecReader2.prototype.reportFoundResultPoints = function(hints2, points) {
8986
- if (hints2 != null) {
8987
- var rpcb_1 = hints2.get(DecodeHintType$1.NEED_RESULT_POINT_CALLBACK);
6995
+ AztecReader2.prototype.reportFoundResultPoints = function(hints, points) {
6996
+ if (hints != null) {
6997
+ var rpcb_1 = hints.get(DecodeHintType$1.NEED_RESULT_POINT_CALLBACK);
8988
6998
  if (rpcb_1 != null) {
8989
6999
  points.forEach(function(point, idx, arr) {
8990
7000
  rpcb_1.foundPossibleResultPoint(point);
@@ -9029,14 +7039,14 @@ var OneDReader = (
9029
7039
  function() {
9030
7040
  function OneDReader2() {
9031
7041
  }
9032
- OneDReader2.prototype.decode = function(image, hints2) {
7042
+ OneDReader2.prototype.decode = function(image, hints) {
9033
7043
  try {
9034
- return this.doDecode(image, hints2);
7044
+ return this.doDecode(image, hints);
9035
7045
  } catch (nfe) {
9036
- var tryHarder = hints2 && hints2.get(DecodeHintType$1.TRY_HARDER) === true;
7046
+ var tryHarder = hints && hints.get(DecodeHintType$1.TRY_HARDER) === true;
9037
7047
  if (tryHarder && image.isRotateSupported()) {
9038
7048
  var rotatedImage = image.rotateCounterClockwise();
9039
- var result = this.doDecode(rotatedImage, hints2);
7049
+ var result = this.doDecode(rotatedImage, hints);
9040
7050
  var metadata = result.getResultMetadata();
9041
7051
  var orientation_1 = 270;
9042
7052
  if (metadata !== null && metadata.get(ResultMetadataType$1.ORIENTATION) === true) {
@@ -9058,11 +7068,11 @@ var OneDReader = (
9058
7068
  };
9059
7069
  OneDReader2.prototype.reset = function() {
9060
7070
  };
9061
- OneDReader2.prototype.doDecode = function(image, hints2) {
7071
+ OneDReader2.prototype.doDecode = function(image, hints) {
9062
7072
  var width = image.getWidth();
9063
7073
  var height = image.getHeight();
9064
7074
  var row = new BitArray(width);
9065
- var tryHarder = hints2 && hints2.get(DecodeHintType$1.TRY_HARDER) === true;
7075
+ var tryHarder = hints && hints.get(DecodeHintType$1.TRY_HARDER) === true;
9066
7076
  var rowStep = Math.max(1, height >> (tryHarder ? 8 : 5));
9067
7077
  var maxLines;
9068
7078
  if (tryHarder) {
@@ -9086,17 +7096,17 @@ var OneDReader = (
9086
7096
  var _loop_1 = function(attempt2) {
9087
7097
  if (attempt2 === 1) {
9088
7098
  row.reverse();
9089
- if (hints2 && hints2.get(DecodeHintType$1.NEED_RESULT_POINT_CALLBACK) === true) {
7099
+ if (hints && hints.get(DecodeHintType$1.NEED_RESULT_POINT_CALLBACK) === true) {
9090
7100
  var newHints_1 = /* @__PURE__ */ new Map();
9091
- hints2.forEach(function(hint, key) {
7101
+ hints.forEach(function(hint, key) {
9092
7102
  return newHints_1.set(key, hint);
9093
7103
  });
9094
7104
  newHints_1.delete(DecodeHintType$1.NEED_RESULT_POINT_CALLBACK);
9095
- hints2 = newHints_1;
7105
+ hints = newHints_1;
9096
7106
  }
9097
7107
  }
9098
7108
  try {
9099
- var result = this_1.decodeRow(rowNumber, row, hints2);
7109
+ var result = this_1.decodeRow(rowNumber, row, hints);
9100
7110
  if (attempt2 === 1) {
9101
7111
  result.putMetadata(ResultMetadataType$1.ORIENTATION, 180);
9102
7112
  var points = result.getResultPoints();
@@ -9269,8 +7279,8 @@ var Code128Reader = (
9269
7279
  throw new NotFoundException();
9270
7280
  }
9271
7281
  };
9272
- Code128Reader2.prototype.decodeRow = function(rowNumber, row, hints2) {
9273
- var convertFNC1 = hints2 && hints2.get(DecodeHintType$1.ASSUME_GS1) === true;
7282
+ Code128Reader2.prototype.decodeRow = function(rowNumber, row, hints) {
7283
+ var convertFNC1 = hints && hints.get(DecodeHintType$1.ASSUME_GS1) === true;
9274
7284
  var startPatternInfo = Code128Reader2.findStartPattern(row);
9275
7285
  var startCode = startPatternInfo[2];
9276
7286
  var currentRawCodesIndex = 0;
@@ -9678,7 +7688,7 @@ var Code39Reader = (
9678
7688
  _this.counters = new Int32Array(9);
9679
7689
  return _this;
9680
7690
  }
9681
- Code39Reader2.prototype.decodeRow = function(rowNumber, row, hints2) {
7691
+ Code39Reader2.prototype.decodeRow = function(rowNumber, row, hints) {
9682
7692
  var e_1, _a2, e_2, _b;
9683
7693
  var theCounters = this.counters;
9684
7694
  theCounters.fill(0);
@@ -9998,7 +8008,7 @@ var Code93Reader = (
9998
8008
  _this.counters = new Int32Array(6);
9999
8009
  return _this;
10000
8010
  }
10001
- Code93Reader2.prototype.decodeRow = function(rowNumber, row, hints2) {
8011
+ Code93Reader2.prototype.decodeRow = function(rowNumber, row, hints) {
10002
8012
  var e_1, _a2, e_2, _b;
10003
8013
  var start = this.findAsteriskPattern(row);
10004
8014
  var nextStart = row.getNextSet(start[1]);
@@ -10310,7 +8320,7 @@ var ITFReader = (
10310
8320
  _this.narrowLineWidth = -1;
10311
8321
  return _this;
10312
8322
  }
10313
- ITFReader2.prototype.decodeRow = function(rowNumber, row, hints2) {
8323
+ ITFReader2.prototype.decodeRow = function(rowNumber, row, hints) {
10314
8324
  var e_1, _a2;
10315
8325
  var startRange = this.decodeStart(row);
10316
8326
  var endRange = this.decodeEnd(row);
@@ -10318,8 +8328,8 @@ var ITFReader = (
10318
8328
  ITFReader2.decodeMiddle(row, startRange[1], endRange[0], result);
10319
8329
  var resultString = result.toString();
10320
8330
  var allowedLengths = null;
10321
- if (hints2 != null) {
10322
- allowedLengths = hints2.get(DecodeHintType$1.ALLOWED_LENGTHS);
8331
+ if (hints != null) {
8332
+ allowedLengths = hints.get(DecodeHintType$1.ALLOWED_LENGTHS);
10323
8333
  }
10324
8334
  if (allowedLengths == null) {
10325
8335
  allowedLengths = ITFReader2.DEFAULT_ALLOWED_LENGTHS;
@@ -10955,9 +8965,9 @@ var UPCEANReader = (
10955
8965
  }
10956
8966
  return _this;
10957
8967
  }
10958
- UPCEANReader2.prototype.decodeRow = function(rowNumber, row, hints2) {
8968
+ UPCEANReader2.prototype.decodeRow = function(rowNumber, row, hints) {
10959
8969
  var startGuardRange = UPCEANReader2.findStartGuardPattern(row);
10960
- var resultPointCallback = hints2 == null ? null : hints2.get(DecodeHintType$1.NEED_RESULT_POINT_CALLBACK);
8970
+ var resultPointCallback = hints == null ? null : hints.get(DecodeHintType$1.NEED_RESULT_POINT_CALLBACK);
10961
8971
  if (resultPointCallback != null) {
10962
8972
  var resultPoint_1 = new ResultPoint((startGuardRange[0] + startGuardRange[1]) / 2, rowNumber);
10963
8973
  resultPointCallback.foundPossibleResultPoint(resultPoint_1);
@@ -11000,7 +9010,7 @@ var UPCEANReader = (
11000
9010
  extensionLength = extensionResult.getText().length;
11001
9011
  } catch (err) {
11002
9012
  }
11003
- var allowedExtensions = hints2 == null ? null : hints2.get(DecodeHintType$1.ALLOWED_EAN_EXTENSIONS);
9013
+ var allowedExtensions = hints == null ? null : hints.get(DecodeHintType$1.ALLOWED_EAN_EXTENSIONS);
11004
9014
  if (allowedExtensions != null) {
11005
9015
  var valid = false;
11006
9016
  for (var length_1 in allowedExtensions) {
@@ -11280,11 +9290,11 @@ var UPCAReader = (
11280
9290
  UPCAReader2.prototype.getBarcodeFormat = function() {
11281
9291
  return BarcodeFormat$1.UPC_A;
11282
9292
  };
11283
- UPCAReader2.prototype.decode = function(image, hints2) {
9293
+ UPCAReader2.prototype.decode = function(image, hints) {
11284
9294
  return this.maybeReturnResult(this.ean13Reader.decode(image));
11285
9295
  };
11286
- UPCAReader2.prototype.decodeRow = function(rowNumber, row, hints2) {
11287
- return this.maybeReturnResult(this.ean13Reader.decodeRow(rowNumber, row, hints2));
9296
+ UPCAReader2.prototype.decodeRow = function(rowNumber, row, hints) {
9297
+ return this.maybeReturnResult(this.ean13Reader.decodeRow(rowNumber, row, hints));
11288
9298
  };
11289
9299
  UPCAReader2.prototype.decodeMiddle = function(row, startRange, resultString) {
11290
9300
  return this.ean13Reader.decodeMiddle(row, startRange, resultString);
@@ -11487,9 +9497,9 @@ var MultiFormatUPCEANReader = (
11487
9497
  /** @class */
11488
9498
  function(_super) {
11489
9499
  __extends$G(MultiFormatUPCEANReader2, _super);
11490
- function MultiFormatUPCEANReader2(hints2) {
9500
+ function MultiFormatUPCEANReader2(hints) {
11491
9501
  var _this = _super.call(this) || this;
11492
- var possibleFormats = hints2 == null ? null : hints2.get(DecodeHintType$1.POSSIBLE_FORMATS);
9502
+ var possibleFormats = hints == null ? null : hints.get(DecodeHintType$1.POSSIBLE_FORMATS);
11493
9503
  var readers = [];
11494
9504
  if (possibleFormats != null) {
11495
9505
  if (possibleFormats.indexOf(BarcodeFormat$1.EAN_13) > -1) {
@@ -11514,15 +9524,15 @@ var MultiFormatUPCEANReader = (
11514
9524
  _this.readers = readers;
11515
9525
  return _this;
11516
9526
  }
11517
- MultiFormatUPCEANReader2.prototype.decodeRow = function(rowNumber, row, hints2) {
9527
+ MultiFormatUPCEANReader2.prototype.decodeRow = function(rowNumber, row, hints) {
11518
9528
  var e_1, _a2;
11519
9529
  try {
11520
9530
  for (var _b = __values$y(this.readers), _c = _b.next(); !_c.done; _c = _b.next()) {
11521
9531
  var reader = _c.value;
11522
9532
  try {
11523
- var result = reader.decodeRow(rowNumber, row, hints2);
9533
+ var result = reader.decodeRow(rowNumber, row, hints);
11524
9534
  var ean13MayBeUPCA = result.getBarcodeFormat() === BarcodeFormat$1.EAN_13 && result.getText().charAt(0) === "0";
11525
- var possibleFormats = hints2 == null ? null : hints2.get(DecodeHintType$1.POSSIBLE_FORMATS);
9535
+ var possibleFormats = hints == null ? null : hints.get(DecodeHintType$1.POSSIBLE_FORMATS);
11526
9536
  var canReturnUPCA = possibleFormats == null || possibleFormats.includes(BarcodeFormat$1.UPC_A);
11527
9537
  if (ean13MayBeUPCA && canReturnUPCA) {
11528
9538
  var rawBytes = result.getRawBytes();
@@ -11612,7 +9622,7 @@ var CodaBarReader = (
11612
9622
  };
11613
9623
  return _this;
11614
9624
  }
11615
- CodaBarReader2.prototype.decodeRow = function(rowNumber, row, hints2) {
9625
+ CodaBarReader2.prototype.decodeRow = function(rowNumber, row, hints) {
11616
9626
  var validRowData = this.getValidRowData(row);
11617
9627
  if (!validRowData)
11618
9628
  throw new NotFoundException();
@@ -13446,7 +11456,7 @@ var RSSExpandedReader = (
13446
11456
  _this.startEnd = [2];
13447
11457
  return _this;
13448
11458
  }
13449
- RSSExpandedReader2.prototype.decodeRow = function(rowNumber, row, hints2) {
11459
+ RSSExpandedReader2.prototype.decodeRow = function(rowNumber, row, hints) {
13450
11460
  this.pairs.length = 0;
13451
11461
  this.startFromEven = false;
13452
11462
  try {
@@ -13922,25 +11932,25 @@ var RSSExpandedReader = (
13922
11932
  var evenRoundingErrors = this.getEvenRoundingErrors();
13923
11933
  for (var i = 0; i < counters.length; i++) {
13924
11934
  var value_1 = 1 * counters[i] / elementWidth;
13925
- var count2 = value_1 + 0.5;
13926
- if (count2 < 1) {
11935
+ var count = value_1 + 0.5;
11936
+ if (count < 1) {
13927
11937
  if (value_1 < 0.3) {
13928
11938
  throw new NotFoundException();
13929
11939
  }
13930
- count2 = 1;
13931
- } else if (count2 > 8) {
11940
+ count = 1;
11941
+ } else if (count > 8) {
13932
11942
  if (value_1 > 8.7) {
13933
11943
  throw new NotFoundException();
13934
11944
  }
13935
- count2 = 8;
11945
+ count = 8;
13936
11946
  }
13937
11947
  var offset = i / 2;
13938
11948
  if ((i & 1) === 0) {
13939
- oddCounts[offset] = count2;
13940
- oddRoundingErrors[offset] = value_1 - count2;
11949
+ oddCounts[offset] = count;
11950
+ oddRoundingErrors[offset] = value_1 - count;
13941
11951
  } else {
13942
- evenCounts[offset] = count2;
13943
- evenRoundingErrors[offset] = value_1 - count2;
11952
+ evenCounts[offset] = count;
11953
+ evenRoundingErrors[offset] = value_1 - count;
13944
11954
  }
13945
11955
  }
13946
11956
  this.adjustOddEvenCounts(numModules);
@@ -14268,12 +12278,12 @@ var RSS14Reader = (
14268
12278
  _this.possibleRightPairs = [];
14269
12279
  return _this;
14270
12280
  }
14271
- RSS14Reader2.prototype.decodeRow = function(rowNumber, row, hints2) {
12281
+ RSS14Reader2.prototype.decodeRow = function(rowNumber, row, hints) {
14272
12282
  var e_1, _a2, e_2, _b;
14273
- var leftPair = this.decodePair(row, false, rowNumber, hints2);
12283
+ var leftPair = this.decodePair(row, false, rowNumber, hints);
14274
12284
  RSS14Reader2.addOrTally(this.possibleLeftPairs, leftPair);
14275
12285
  row.reverse();
14276
- var rightPair = this.decodePair(row, true, rowNumber, hints2);
12286
+ var rightPair = this.decodePair(row, true, rowNumber, hints);
14277
12287
  RSS14Reader2.addOrTally(this.possibleRightPairs, rightPair);
14278
12288
  row.reverse();
14279
12289
  try {
@@ -14374,11 +12384,11 @@ var RSS14Reader = (
14374
12384
  }
14375
12385
  return checkValue === targetCheckValue;
14376
12386
  };
14377
- RSS14Reader2.prototype.decodePair = function(row, right, rowNumber, hints2) {
12387
+ RSS14Reader2.prototype.decodePair = function(row, right, rowNumber, hints) {
14378
12388
  try {
14379
12389
  var startEnd = this.findFinderPattern(row, right);
14380
12390
  var pattern = this.parseFoundFinderPattern(row, rowNumber, right, startEnd);
14381
- var resultPointCallback = hints2 == null ? null : hints2.get(DecodeHintType$1.NEED_RESULT_POINT_CALLBACK);
12391
+ var resultPointCallback = hints == null ? null : hints.get(DecodeHintType$1.NEED_RESULT_POINT_CALLBACK);
14382
12392
  if (resultPointCallback != null) {
14383
12393
  var center = (startEnd[0] + startEnd[1]) / 2;
14384
12394
  if (right) {
@@ -14416,19 +12426,19 @@ var RSS14Reader = (
14416
12426
  var evenRoundingErrors = this.getEvenRoundingErrors();
14417
12427
  for (var i = 0; i < counters.length; i++) {
14418
12428
  var value = counters[i] / elementWidth;
14419
- var count2 = Math.floor(value + 0.5);
14420
- if (count2 < 1) {
14421
- count2 = 1;
14422
- } else if (count2 > 8) {
14423
- count2 = 8;
12429
+ var count = Math.floor(value + 0.5);
12430
+ if (count < 1) {
12431
+ count = 1;
12432
+ } else if (count > 8) {
12433
+ count = 8;
14424
12434
  }
14425
12435
  var offset = Math.floor(i / 2);
14426
12436
  if ((i & 1) === 0) {
14427
- oddCounts[offset] = count2;
14428
- oddRoundingErrors[offset] = value - count2;
12437
+ oddCounts[offset] = count;
12438
+ oddRoundingErrors[offset] = value - count;
14429
12439
  } else {
14430
- evenCounts[offset] = count2;
14431
- evenRoundingErrors[offset] = value - count2;
12440
+ evenCounts[offset] = count;
12441
+ evenRoundingErrors[offset] = value - count;
14432
12442
  }
14433
12443
  }
14434
12444
  this.adjustOddEvenCounts(outsideChar, numModules);
@@ -14672,14 +12682,14 @@ var MultiFormatOneDReader = (
14672
12682
  /** @class */
14673
12683
  function(_super) {
14674
12684
  __extends$n(MultiFormatOneDReader2, _super);
14675
- function MultiFormatOneDReader2(hints2) {
12685
+ function MultiFormatOneDReader2(hints) {
14676
12686
  var _this = _super.call(this) || this;
14677
12687
  _this.readers = [];
14678
- var possibleFormats = !hints2 ? null : hints2.get(DecodeHintType$1.POSSIBLE_FORMATS);
14679
- var useCode39CheckDigit = hints2 && hints2.get(DecodeHintType$1.ASSUME_CODE_39_CHECK_DIGIT) !== void 0;
12688
+ var possibleFormats = !hints ? null : hints.get(DecodeHintType$1.POSSIBLE_FORMATS);
12689
+ var useCode39CheckDigit = hints && hints.get(DecodeHintType$1.ASSUME_CODE_39_CHECK_DIGIT) !== void 0;
14680
12690
  if (possibleFormats) {
14681
12691
  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)) {
14682
- _this.readers.push(new MultiFormatUPCEANReader(hints2));
12692
+ _this.readers.push(new MultiFormatUPCEANReader(hints));
14683
12693
  }
14684
12694
  if (possibleFormats.includes(BarcodeFormat$1.CODE_39)) {
14685
12695
  _this.readers.push(new Code39Reader(useCode39CheckDigit));
@@ -14705,20 +12715,20 @@ var MultiFormatOneDReader = (
14705
12715
  }
14706
12716
  }
14707
12717
  if (_this.readers.length === 0) {
14708
- _this.readers.push(new MultiFormatUPCEANReader(hints2));
12718
+ _this.readers.push(new MultiFormatUPCEANReader(hints));
14709
12719
  _this.readers.push(new Code39Reader());
14710
12720
  _this.readers.push(new Code93Reader());
14711
- _this.readers.push(new MultiFormatUPCEANReader(hints2));
12721
+ _this.readers.push(new MultiFormatUPCEANReader(hints));
14712
12722
  _this.readers.push(new Code128Reader());
14713
12723
  _this.readers.push(new ITFReader());
14714
12724
  _this.readers.push(new RSS14Reader());
14715
12725
  }
14716
12726
  return _this;
14717
12727
  }
14718
- MultiFormatOneDReader2.prototype.decodeRow = function(rowNumber, row, hints2) {
12728
+ MultiFormatOneDReader2.prototype.decodeRow = function(rowNumber, row, hints) {
14719
12729
  for (var i = 0; i < this.readers.length; i++) {
14720
12730
  try {
14721
- return this.readers[i].decodeRow(rowNumber, row, hints2);
12731
+ return this.readers[i].decodeRow(rowNumber, row, hints);
14722
12732
  } catch (re) {
14723
12733
  }
14724
12734
  }
@@ -14751,11 +12761,11 @@ var __extends$m = /* @__PURE__ */ function() {
14751
12761
  }();
14752
12762
  (function(_super) {
14753
12763
  __extends$m(BrowserBarcodeReader, _super);
14754
- function BrowserBarcodeReader(timeBetweenScansMillis, hints2) {
12764
+ function BrowserBarcodeReader(timeBetweenScansMillis, hints) {
14755
12765
  if (timeBetweenScansMillis === void 0) {
14756
12766
  timeBetweenScansMillis = 500;
14757
12767
  }
14758
- return _super.call(this, new MultiFormatOneDReader(hints2), timeBetweenScansMillis, hints2) || this;
12768
+ return _super.call(this, new MultiFormatOneDReader(hints), timeBetweenScansMillis, hints) || this;
14759
12769
  }
14760
12770
  return BrowserBarcodeReader;
14761
12771
  })(BrowserCodeReader);
@@ -14790,8 +12800,8 @@ var ECBlocks$1 = (
14790
12800
  var ECB$1 = (
14791
12801
  /** @class */
14792
12802
  function() {
14793
- function ECB2(count2, dataCodewords) {
14794
- this.count = count2;
12803
+ function ECB2(count, dataCodewords) {
12804
+ this.count = count;
14795
12805
  this.dataCodewords = dataCodewords;
14796
12806
  }
14797
12807
  ECB2.prototype.getCount = function() {
@@ -15716,19 +13726,19 @@ var DecodedBitStreamParser$2 = (
15716
13726
  DecodedBitStreamParser2.decodeBase256Segment = function(bits, result, byteSegments) {
15717
13727
  var codewordPosition = 1 + bits.getByteOffset();
15718
13728
  var d1 = this.unrandomize255State(bits.readBits(8), codewordPosition++);
15719
- var count2;
13729
+ var count;
15720
13730
  if (d1 === 0) {
15721
- count2 = bits.available() / 8 | 0;
13731
+ count = bits.available() / 8 | 0;
15722
13732
  } else if (d1 < 250) {
15723
- count2 = d1;
13733
+ count = d1;
15724
13734
  } else {
15725
- count2 = 250 * (d1 - 249) + this.unrandomize255State(bits.readBits(8), codewordPosition++);
13735
+ count = 250 * (d1 - 249) + this.unrandomize255State(bits.readBits(8), codewordPosition++);
15726
13736
  }
15727
- if (count2 < 0) {
13737
+ if (count < 0) {
15728
13738
  throw new FormatException();
15729
13739
  }
15730
- var bytes = new Uint8Array(count2);
15731
- for (var i = 0; i < count2; i++) {
13740
+ var bytes = new Uint8Array(count);
13741
+ for (var i = 0; i < count; i++) {
15732
13742
  if (bits.available() < 8) {
15733
13743
  throw new FormatException();
15734
13744
  }
@@ -16191,13 +14201,13 @@ var DataMatrixReader = (
16191
14201
  function DataMatrixReader2() {
16192
14202
  this.decoder = new Decoder$1();
16193
14203
  }
16194
- DataMatrixReader2.prototype.decode = function(image, hints2) {
16195
- if (hints2 === void 0) {
16196
- hints2 = null;
14204
+ DataMatrixReader2.prototype.decode = function(image, hints) {
14205
+ if (hints === void 0) {
14206
+ hints = null;
16197
14207
  }
16198
14208
  var decoderResult;
16199
14209
  var points;
16200
- if (hints2 != null && hints2.has(DecodeHintType$1.PURE_BARCODE)) {
14210
+ if (hints != null && hints.has(DecodeHintType$1.PURE_BARCODE)) {
16201
14211
  var bits = DataMatrixReader2.extractPureBits(image.getBlackMatrix());
16202
14212
  decoderResult = this.decoder.decode(bits);
16203
14213
  points = DataMatrixReader2.NO_POINTS;
@@ -16537,8 +14547,8 @@ var ECBlocks = (
16537
14547
  var ECB = (
16538
14548
  /** @class */
16539
14549
  function() {
16540
- function ECB2(count2, dataCodewords) {
16541
- this.count = count2;
14550
+ function ECB2(count, dataCodewords) {
14551
+ this.count = count;
16542
14552
  this.dataCodewords = dataCodewords;
16543
14553
  }
16544
14554
  ECB2.prototype.getCount = function() {
@@ -16926,8 +14936,8 @@ var BitMatrixParser = (
16926
14936
  if (j === 6) {
16927
14937
  j--;
16928
14938
  }
16929
- for (var count2 = 0; count2 < dimension; count2++) {
16930
- var i = readingUp ? dimension - 1 - count2 : count2;
14939
+ for (var count = 0; count < dimension; count++) {
14940
+ var i = readingUp ? dimension - 1 - count : count;
16931
14941
  for (var col = 0; col < 2; col++) {
16932
14942
  if (!functionPattern.get(j - col, i)) {
16933
14943
  bitsRead++;
@@ -17155,7 +15165,7 @@ var DecodedBitStreamParser$1 = (
17155
15165
  function() {
17156
15166
  function DecodedBitStreamParser2() {
17157
15167
  }
17158
- DecodedBitStreamParser2.decode = function(bytes, version, ecLevel, hints2) {
15168
+ DecodedBitStreamParser2.decode = function(bytes, version, ecLevel, hints) {
17159
15169
  var bits = new BitSource(bytes);
17160
15170
  var result = new StringBuilder();
17161
15171
  var byteSegments = new Array();
@@ -17201,19 +15211,19 @@ var DecodedBitStreamParser$1 = (
17201
15211
  }
17202
15212
  break;
17203
15213
  default:
17204
- var count2 = bits.readBits(mode.getCharacterCountBits(version));
15214
+ var count = bits.readBits(mode.getCharacterCountBits(version));
17205
15215
  switch (mode) {
17206
15216
  case Mode$2.NUMERIC:
17207
- DecodedBitStreamParser2.decodeNumericSegment(bits, result, count2);
15217
+ DecodedBitStreamParser2.decodeNumericSegment(bits, result, count);
17208
15218
  break;
17209
15219
  case Mode$2.ALPHANUMERIC:
17210
- DecodedBitStreamParser2.decodeAlphanumericSegment(bits, result, count2, fc1InEffect);
15220
+ DecodedBitStreamParser2.decodeAlphanumericSegment(bits, result, count, fc1InEffect);
17211
15221
  break;
17212
15222
  case Mode$2.BYTE:
17213
- DecodedBitStreamParser2.decodeByteSegment(bits, result, count2, currentCharacterSetECI, byteSegments, hints2);
15223
+ DecodedBitStreamParser2.decodeByteSegment(bits, result, count, currentCharacterSetECI, byteSegments, hints);
17214
15224
  break;
17215
15225
  case Mode$2.KANJI:
17216
- DecodedBitStreamParser2.decodeKanjiSegment(bits, result, count2);
15226
+ DecodedBitStreamParser2.decodeKanjiSegment(bits, result, count);
17217
15227
  break;
17218
15228
  default:
17219
15229
  throw new FormatException();
@@ -17226,13 +15236,13 @@ var DecodedBitStreamParser$1 = (
17226
15236
  }
17227
15237
  return new DecoderResult(bytes, result.toString(), byteSegments.length === 0 ? null : byteSegments, ecLevel === null ? null : ecLevel.toString(), symbolSequence, parityData);
17228
15238
  };
17229
- DecodedBitStreamParser2.decodeHanziSegment = function(bits, result, count2) {
17230
- if (count2 * 13 > bits.available()) {
15239
+ DecodedBitStreamParser2.decodeHanziSegment = function(bits, result, count) {
15240
+ if (count * 13 > bits.available()) {
17231
15241
  throw new FormatException();
17232
15242
  }
17233
- var buffer = new Uint8Array(2 * count2);
15243
+ var buffer = new Uint8Array(2 * count);
17234
15244
  var offset = 0;
17235
- while (count2 > 0) {
15245
+ while (count > 0) {
17236
15246
  var twoBytes = bits.readBits(13);
17237
15247
  var assembledTwoBytes = twoBytes / 96 << 8 & 4294967295 | twoBytes % 96;
17238
15248
  if (assembledTwoBytes < 959) {
@@ -17245,7 +15255,7 @@ var DecodedBitStreamParser$1 = (
17245
15255
  buffer[offset + 1] = /*(byte) */
17246
15256
  assembledTwoBytes & 255;
17247
15257
  offset += 2;
17248
- count2--;
15258
+ count--;
17249
15259
  }
17250
15260
  try {
17251
15261
  result.append(StringEncoding.decode(buffer, StringUtils.GB2312));
@@ -17253,13 +15263,13 @@ var DecodedBitStreamParser$1 = (
17253
15263
  throw new FormatException(ignored);
17254
15264
  }
17255
15265
  };
17256
- DecodedBitStreamParser2.decodeKanjiSegment = function(bits, result, count2) {
17257
- if (count2 * 13 > bits.available()) {
15266
+ DecodedBitStreamParser2.decodeKanjiSegment = function(bits, result, count) {
15267
+ if (count * 13 > bits.available()) {
17258
15268
  throw new FormatException();
17259
15269
  }
17260
- var buffer = new Uint8Array(2 * count2);
15270
+ var buffer = new Uint8Array(2 * count);
17261
15271
  var offset = 0;
17262
- while (count2 > 0) {
15272
+ while (count > 0) {
17263
15273
  var twoBytes = bits.readBits(13);
17264
15274
  var assembledTwoBytes = twoBytes / 192 << 8 & 4294967295 | twoBytes % 192;
17265
15275
  if (assembledTwoBytes < 7936) {
@@ -17272,7 +15282,7 @@ var DecodedBitStreamParser$1 = (
17272
15282
  buffer[offset + 1] = /*(byte) */
17273
15283
  assembledTwoBytes;
17274
15284
  offset += 2;
17275
- count2--;
15285
+ count--;
17276
15286
  }
17277
15287
  try {
17278
15288
  result.append(StringEncoding.decode(buffer, StringUtils.SHIFT_JIS));
@@ -17280,18 +15290,18 @@ var DecodedBitStreamParser$1 = (
17280
15290
  throw new FormatException(ignored);
17281
15291
  }
17282
15292
  };
17283
- DecodedBitStreamParser2.decodeByteSegment = function(bits, result, count2, currentCharacterSetECI, byteSegments, hints2) {
17284
- if (8 * count2 > bits.available()) {
15293
+ DecodedBitStreamParser2.decodeByteSegment = function(bits, result, count, currentCharacterSetECI, byteSegments, hints) {
15294
+ if (8 * count > bits.available()) {
17285
15295
  throw new FormatException();
17286
15296
  }
17287
- var readBytes = new Uint8Array(count2);
17288
- for (var i = 0; i < count2; i++) {
15297
+ var readBytes = new Uint8Array(count);
15298
+ for (var i = 0; i < count; i++) {
17289
15299
  readBytes[i] = /*(byte) */
17290
15300
  bits.readBits(8);
17291
15301
  }
17292
15302
  var encoding;
17293
15303
  if (currentCharacterSetECI === null) {
17294
- encoding = StringUtils.guessEncoding(readBytes, hints2);
15304
+ encoding = StringUtils.guessEncoding(readBytes, hints);
17295
15305
  } else {
17296
15306
  encoding = currentCharacterSetECI.getName();
17297
15307
  }
@@ -17308,18 +15318,18 @@ var DecodedBitStreamParser$1 = (
17308
15318
  }
17309
15319
  return DecodedBitStreamParser2.ALPHANUMERIC_CHARS[value];
17310
15320
  };
17311
- DecodedBitStreamParser2.decodeAlphanumericSegment = function(bits, result, count2, fc1InEffect) {
15321
+ DecodedBitStreamParser2.decodeAlphanumericSegment = function(bits, result, count, fc1InEffect) {
17312
15322
  var start = result.length();
17313
- while (count2 > 1) {
15323
+ while (count > 1) {
17314
15324
  if (bits.available() < 11) {
17315
15325
  throw new FormatException();
17316
15326
  }
17317
15327
  var nextTwoCharsBits = bits.readBits(11);
17318
15328
  result.append(DecodedBitStreamParser2.toAlphaNumericChar(Math.floor(nextTwoCharsBits / 45)));
17319
15329
  result.append(DecodedBitStreamParser2.toAlphaNumericChar(nextTwoCharsBits % 45));
17320
- count2 -= 2;
15330
+ count -= 2;
17321
15331
  }
17322
- if (count2 === 1) {
15332
+ if (count === 1) {
17323
15333
  if (bits.available() < 6) {
17324
15334
  throw new FormatException();
17325
15335
  }
@@ -17337,8 +15347,8 @@ var DecodedBitStreamParser$1 = (
17337
15347
  }
17338
15348
  }
17339
15349
  };
17340
- DecodedBitStreamParser2.decodeNumericSegment = function(bits, result, count2) {
17341
- while (count2 >= 3) {
15350
+ DecodedBitStreamParser2.decodeNumericSegment = function(bits, result, count) {
15351
+ while (count >= 3) {
17342
15352
  if (bits.available() < 10) {
17343
15353
  throw new FormatException();
17344
15354
  }
@@ -17349,9 +15359,9 @@ var DecodedBitStreamParser$1 = (
17349
15359
  result.append(DecodedBitStreamParser2.toAlphaNumericChar(Math.floor(threeDigitsBits / 100)));
17350
15360
  result.append(DecodedBitStreamParser2.toAlphaNumericChar(Math.floor(threeDigitsBits / 10) % 10));
17351
15361
  result.append(DecodedBitStreamParser2.toAlphaNumericChar(threeDigitsBits % 10));
17352
- count2 -= 3;
15362
+ count -= 3;
17353
15363
  }
17354
- if (count2 === 2) {
15364
+ if (count === 2) {
17355
15365
  if (bits.available() < 7) {
17356
15366
  throw new FormatException();
17357
15367
  }
@@ -17361,7 +15371,7 @@ var DecodedBitStreamParser$1 = (
17361
15371
  }
17362
15372
  result.append(DecodedBitStreamParser2.toAlphaNumericChar(Math.floor(twoDigitsBits / 10)));
17363
15373
  result.append(DecodedBitStreamParser2.toAlphaNumericChar(twoDigitsBits % 10));
17364
- } else if (count2 === 1) {
15374
+ } else if (count === 1) {
17365
15375
  if (bits.available() < 4) {
17366
15376
  throw new FormatException();
17367
15377
  }
@@ -17429,14 +15439,14 @@ var Decoder = (
17429
15439
  function Decoder2() {
17430
15440
  this.rsDecoder = new ReedSolomonDecoder(GenericGF.QR_CODE_FIELD_256);
17431
15441
  }
17432
- Decoder2.prototype.decodeBooleanArray = function(image, hints2) {
17433
- return this.decodeBitMatrix(BitMatrix.parseFromBooleanArray(image), hints2);
15442
+ Decoder2.prototype.decodeBooleanArray = function(image, hints) {
15443
+ return this.decodeBitMatrix(BitMatrix.parseFromBooleanArray(image), hints);
17434
15444
  };
17435
- Decoder2.prototype.decodeBitMatrix = function(bits, hints2) {
15445
+ Decoder2.prototype.decodeBitMatrix = function(bits, hints) {
17436
15446
  var parser = new BitMatrixParser(bits);
17437
15447
  var ex = null;
17438
15448
  try {
17439
- return this.decodeBitMatrixParser(parser, hints2);
15449
+ return this.decodeBitMatrixParser(parser, hints);
17440
15450
  } catch (e) {
17441
15451
  ex = e;
17442
15452
  }
@@ -17446,7 +15456,7 @@ var Decoder = (
17446
15456
  parser.readVersion();
17447
15457
  parser.readFormatInformation();
17448
15458
  parser.mirror();
17449
- var result = this.decodeBitMatrixParser(parser, hints2);
15459
+ var result = this.decodeBitMatrixParser(parser, hints);
17450
15460
  result.setOther(new QRCodeDecoderMetaData(true));
17451
15461
  return result;
17452
15462
  } catch (e) {
@@ -17456,7 +15466,7 @@ var Decoder = (
17456
15466
  throw e;
17457
15467
  }
17458
15468
  };
17459
- Decoder2.prototype.decodeBitMatrixParser = function(parser, hints2) {
15469
+ Decoder2.prototype.decodeBitMatrixParser = function(parser, hints) {
17460
15470
  var e_1, _a2, e_2, _b;
17461
15471
  var version = parser.readVersion();
17462
15472
  var ecLevel = parser.readFormatInformation().getErrorCorrectionLevel();
@@ -17498,7 +15508,7 @@ var Decoder = (
17498
15508
  if (e_2) throw e_2.error;
17499
15509
  }
17500
15510
  }
17501
- return DecodedBitStreamParser$1.decode(resultBytes, version, ecLevel, hints2);
15511
+ return DecodedBitStreamParser$1.decode(resultBytes, version, ecLevel, hints);
17502
15512
  };
17503
15513
  Decoder2.prototype.correctErrors = function(codewordBytes, numDataCodewords) {
17504
15514
  var codewordsInts = new Int32Array(codewordBytes);
@@ -17757,11 +15767,11 @@ var FinderPattern = (
17757
15767
  /** @class */
17758
15768
  function(_super) {
17759
15769
  __extends$j(FinderPattern2, _super);
17760
- function FinderPattern2(posX, posY, estimatedModuleSize, count2) {
15770
+ function FinderPattern2(posX, posY, estimatedModuleSize, count) {
17761
15771
  var _this = _super.call(this, posX, posY) || this;
17762
15772
  _this.estimatedModuleSize = estimatedModuleSize;
17763
- _this.count = count2;
17764
- if (void 0 === count2) {
15773
+ _this.count = count;
15774
+ if (void 0 === count) {
17765
15775
  _this.count = 1;
17766
15776
  }
17767
15777
  return _this;
@@ -17836,9 +15846,9 @@ var FinderPatternFinder = (
17836
15846
  FinderPatternFinder2.prototype.getPossibleCenters = function() {
17837
15847
  return this.possibleCenters;
17838
15848
  };
17839
- FinderPatternFinder2.prototype.find = function(hints2) {
17840
- var tryHarder = hints2 !== null && hints2 !== void 0 && void 0 !== hints2.get(DecodeHintType$1.TRY_HARDER);
17841
- var pureBarcode = hints2 !== null && hints2 !== void 0 && void 0 !== hints2.get(DecodeHintType$1.PURE_BARCODE);
15849
+ FinderPatternFinder2.prototype.find = function(hints) {
15850
+ var tryHarder = hints !== null && hints !== void 0 && void 0 !== hints.get(DecodeHintType$1.TRY_HARDER);
15851
+ var pureBarcode = hints !== null && hints !== void 0 && void 0 !== hints.get(DecodeHintType$1.PURE_BARCODE);
17842
15852
  var image = this.image;
17843
15853
  var maxI = image.getHeight();
17844
15854
  var maxJ = image.getWidth();
@@ -17928,11 +15938,11 @@ var FinderPatternFinder = (
17928
15938
  FinderPatternFinder2.foundPatternCross = function(stateCount) {
17929
15939
  var totalModuleSize = 0;
17930
15940
  for (var i = 0; i < 5; i++) {
17931
- var count2 = stateCount[i];
17932
- if (count2 === 0) {
15941
+ var count = stateCount[i];
15942
+ if (count === 0) {
17933
15943
  return false;
17934
15944
  }
17935
- totalModuleSize += count2;
15945
+ totalModuleSize += count;
17936
15946
  }
17937
15947
  if (totalModuleSize < 7) {
17938
15948
  return false;
@@ -18343,13 +16353,13 @@ var Detector$1 = (
18343
16353
  Detector2.prototype.getResultPointCallback = function() {
18344
16354
  return this.resultPointCallback;
18345
16355
  };
18346
- Detector2.prototype.detect = function(hints2) {
18347
- this.resultPointCallback = hints2 === null || hints2 === void 0 ? null : (
16356
+ Detector2.prototype.detect = function(hints) {
16357
+ this.resultPointCallback = hints === null || hints === void 0 ? null : (
18348
16358
  /*(ResultPointCallback) */
18349
- hints2.get(DecodeHintType$1.NEED_RESULT_POINT_CALLBACK)
16359
+ hints.get(DecodeHintType$1.NEED_RESULT_POINT_CALLBACK)
18350
16360
  );
18351
16361
  var finder = new FinderPatternFinder(this.image, this.resultPointCallback);
18352
- var info = finder.find(hints2);
16362
+ var info = finder.find(hints);
18353
16363
  return this.processFinderPatternInfo(info);
18354
16364
  };
18355
16365
  Detector2.prototype.processFinderPatternInfo = function(info) {
@@ -18572,16 +16582,16 @@ var QRCodeReader = (
18572
16582
  QRCodeReader2.prototype.getDecoder = function() {
18573
16583
  return this.decoder;
18574
16584
  };
18575
- QRCodeReader2.prototype.decode = function(image, hints2) {
16585
+ QRCodeReader2.prototype.decode = function(image, hints) {
18576
16586
  var decoderResult;
18577
16587
  var points;
18578
- if (hints2 !== void 0 && hints2 !== null && void 0 !== hints2.get(DecodeHintType$1.PURE_BARCODE)) {
16588
+ if (hints !== void 0 && hints !== null && void 0 !== hints.get(DecodeHintType$1.PURE_BARCODE)) {
18579
16589
  var bits = QRCodeReader2.extractPureBits(image.getBlackMatrix());
18580
- decoderResult = this.decoder.decodeBitMatrix(bits, hints2);
16590
+ decoderResult = this.decoder.decodeBitMatrix(bits, hints);
18581
16591
  points = QRCodeReader2.NO_POINTS;
18582
16592
  } else {
18583
- var detectorResult = new Detector$1(image.getBlackMatrix()).detect(hints2);
18584
- decoderResult = this.decoder.decodeBitMatrix(detectorResult.getBits(), hints2);
16593
+ var detectorResult = new Detector$1(image.getBlackMatrix()).detect(hints);
16594
+ decoderResult = this.decoder.decodeBitMatrix(detectorResult.getBits(), hints);
18585
16595
  points = detectorResult.getPoints();
18586
16596
  }
18587
16597
  if (decoderResult.getOther() instanceof QRCodeDecoderMetaData) {
@@ -24365,7 +22375,7 @@ var Detector = (
24365
22375
  function() {
24366
22376
  function Detector2() {
24367
22377
  }
24368
- Detector2.detectMultiple = function(image, hints2, multiple) {
22378
+ Detector2.detectMultiple = function(image, hints, multiple) {
24369
22379
  var bitMatrix = image.getBlackMatrix();
24370
22380
  var barcodeCoordinates = Detector2.detect(multiple, bitMatrix);
24371
22381
  if (!barcodeCoordinates.length) {
@@ -26752,7 +24762,7 @@ var DecodedBitStreamParser = (
26752
24762
  };
26753
24763
  DecodedBitStreamParser2.byteCompaction = function(mode, codewords, encoding, codeIndex, result) {
26754
24764
  var decodedBytes = new ByteArrayOutputStream();
26755
- var count2 = 0;
24765
+ var count = 0;
26756
24766
  var value = (
26757
24767
  /*long*/
26758
24768
  0
@@ -26763,7 +24773,7 @@ var DecodedBitStreamParser = (
26763
24773
  var byteCompactedCodewords = new Int32Array(6);
26764
24774
  var nextCode = codewords[codeIndex++];
26765
24775
  while (codeIndex < codewords[0] && !end) {
26766
- byteCompactedCodewords[count2++] = nextCode;
24776
+ byteCompactedCodewords[count++] = nextCode;
26767
24777
  value = 900 * value + nextCode;
26768
24778
  nextCode = codewords[codeIndex++];
26769
24779
  switch (nextCode) {
@@ -26778,7 +24788,7 @@ var DecodedBitStreamParser = (
26778
24788
  end = true;
26779
24789
  break;
26780
24790
  default:
26781
- if (count2 % 5 === 0 && count2 > 0) {
24791
+ if (count % 5 === 0 && count > 0) {
26782
24792
  for (var j = 0; j < 6; ++j) {
26783
24793
  decodedBytes.write(
26784
24794
  /*(byte)*/
@@ -26786,15 +24796,15 @@ var DecodedBitStreamParser = (
26786
24796
  );
26787
24797
  }
26788
24798
  value = 0;
26789
- count2 = 0;
24799
+ count = 0;
26790
24800
  }
26791
24801
  break;
26792
24802
  }
26793
24803
  }
26794
24804
  if (codeIndex === codewords[0] && nextCode < DecodedBitStreamParser2.TEXT_COMPACTION_MODE_LATCH) {
26795
- byteCompactedCodewords[count2++] = nextCode;
24805
+ byteCompactedCodewords[count++] = nextCode;
26796
24806
  }
26797
- for (var i = 0; i < count2; i++) {
24807
+ for (var i = 0; i < count; i++) {
26798
24808
  decodedBytes.write(
26799
24809
  /*(byte)*/
26800
24810
  byteCompactedCodewords[i]
@@ -26805,7 +24815,7 @@ var DecodedBitStreamParser = (
26805
24815
  while (codeIndex < codewords[0] && !end) {
26806
24816
  var code = codewords[codeIndex++];
26807
24817
  if (code < DecodedBitStreamParser2.TEXT_COMPACTION_MODE_LATCH) {
26808
- count2++;
24818
+ count++;
26809
24819
  value = 900 * value + code;
26810
24820
  } else {
26811
24821
  switch (code) {
@@ -26821,7 +24831,7 @@ var DecodedBitStreamParser = (
26821
24831
  break;
26822
24832
  }
26823
24833
  }
26824
- if (count2 % 5 === 0 && count2 > 0) {
24834
+ if (count % 5 === 0 && count > 0) {
26825
24835
  for (var j = 0; j < 6; ++j) {
26826
24836
  decodedBytes.write(
26827
24837
  /*(byte)*/
@@ -26829,7 +24839,7 @@ var DecodedBitStreamParser = (
26829
24839
  );
26830
24840
  }
26831
24841
  value = 0;
26832
- count2 = 0;
24842
+ count = 0;
26833
24843
  }
26834
24844
  }
26835
24845
  break;
@@ -26838,7 +24848,7 @@ var DecodedBitStreamParser = (
26838
24848
  return codeIndex;
26839
24849
  };
26840
24850
  DecodedBitStreamParser2.numericCompaction = function(codewords, codeIndex, result) {
26841
- var count2 = 0;
24851
+ var count = 0;
26842
24852
  var end = false;
26843
24853
  var numericCodewords = new Int32Array(DecodedBitStreamParser2.MAX_NUMERIC_CODEWORDS);
26844
24854
  while (codeIndex < codewords[0] && !end) {
@@ -26847,8 +24857,8 @@ var DecodedBitStreamParser = (
26847
24857
  end = true;
26848
24858
  }
26849
24859
  if (code < DecodedBitStreamParser2.TEXT_COMPACTION_MODE_LATCH) {
26850
- numericCodewords[count2] = code;
26851
- count2++;
24860
+ numericCodewords[count] = code;
24861
+ count++;
26852
24862
  } else {
26853
24863
  switch (code) {
26854
24864
  case DecodedBitStreamParser2.TEXT_COMPACTION_MODE_LATCH:
@@ -26862,17 +24872,17 @@ var DecodedBitStreamParser = (
26862
24872
  break;
26863
24873
  }
26864
24874
  }
26865
- if ((count2 % DecodedBitStreamParser2.MAX_NUMERIC_CODEWORDS === 0 || code === DecodedBitStreamParser2.NUMERIC_COMPACTION_MODE_LATCH || end) && count2 > 0) {
26866
- result.append(DecodedBitStreamParser2.decodeBase900toBase10(numericCodewords, count2));
26867
- count2 = 0;
24875
+ if ((count % DecodedBitStreamParser2.MAX_NUMERIC_CODEWORDS === 0 || code === DecodedBitStreamParser2.NUMERIC_COMPACTION_MODE_LATCH || end) && count > 0) {
24876
+ result.append(DecodedBitStreamParser2.decodeBase900toBase10(numericCodewords, count));
24877
+ count = 0;
26868
24878
  }
26869
24879
  }
26870
24880
  return codeIndex;
26871
24881
  };
26872
- DecodedBitStreamParser2.decodeBase900toBase10 = function(codewords, count2) {
24882
+ DecodedBitStreamParser2.decodeBase900toBase10 = function(codewords, count) {
26873
24883
  var result = createBigInt(0);
26874
- for (var i = 0; i < count2; i++) {
26875
- result += DecodedBitStreamParser2.EXP900[count2 - i - 1] * createBigInt(codewords[i]);
24884
+ for (var i = 0; i < count; i++) {
24885
+ result += DecodedBitStreamParser2.EXP900[count - i - 1] * createBigInt(codewords[i]);
26876
24886
  }
26877
24887
  var resultString = result.toString();
26878
24888
  if (resultString.charAt(0) !== "1") {
@@ -27445,22 +25455,22 @@ var PDF417Reader = (
27445
25455
  function() {
27446
25456
  function PDF417Reader2() {
27447
25457
  }
27448
- PDF417Reader2.prototype.decode = function(image, hints2) {
27449
- if (hints2 === void 0) {
27450
- hints2 = null;
25458
+ PDF417Reader2.prototype.decode = function(image, hints) {
25459
+ if (hints === void 0) {
25460
+ hints = null;
27451
25461
  }
27452
- var result = PDF417Reader2.decode(image, hints2, false);
25462
+ var result = PDF417Reader2.decode(image, hints, false);
27453
25463
  if (result == null || result.length === 0 || result[0] == null) {
27454
25464
  throw NotFoundException.getNotFoundInstance();
27455
25465
  }
27456
25466
  return result[0];
27457
25467
  };
27458
- PDF417Reader2.prototype.decodeMultiple = function(image, hints2) {
27459
- if (hints2 === void 0) {
27460
- hints2 = null;
25468
+ PDF417Reader2.prototype.decodeMultiple = function(image, hints) {
25469
+ if (hints === void 0) {
25470
+ hints = null;
27461
25471
  }
27462
25472
  try {
27463
- return PDF417Reader2.decode(image, hints2, true);
25473
+ return PDF417Reader2.decode(image, hints, true);
27464
25474
  } catch (ignored) {
27465
25475
  if (ignored instanceof FormatException || ignored instanceof ChecksumException) {
27466
25476
  throw NotFoundException.getNotFoundInstance();
@@ -27468,10 +25478,10 @@ var PDF417Reader = (
27468
25478
  throw ignored;
27469
25479
  }
27470
25480
  };
27471
- PDF417Reader2.decode = function(image, hints2, multiple) {
25481
+ PDF417Reader2.decode = function(image, hints, multiple) {
27472
25482
  var e_1, _a2;
27473
25483
  var results = new Array();
27474
- var detectorResult = Detector.detectMultiple(image, hints2, multiple);
25484
+ var detectorResult = Detector.detectMultiple(image, hints, multiple);
27475
25485
  try {
27476
25486
  for (var _b = __values$9(detectorResult.getPoints()), _c = _b.next(); !_c.done; _c = _b.next()) {
27477
25487
  var points = _c.value;
@@ -27564,8 +25574,8 @@ var MultiFormatReader = (
27564
25574
  function() {
27565
25575
  function MultiFormatReader2() {
27566
25576
  }
27567
- MultiFormatReader2.prototype.decode = function(image, hints2) {
27568
- this.setHints(hints2);
25577
+ MultiFormatReader2.prototype.decode = function(image, hints) {
25578
+ this.setHints(hints);
27569
25579
  return this.decodeInternal(image);
27570
25580
  };
27571
25581
  MultiFormatReader2.prototype.decodeWithState = function(image) {
@@ -27574,17 +25584,17 @@ var MultiFormatReader = (
27574
25584
  }
27575
25585
  return this.decodeInternal(image);
27576
25586
  };
27577
- MultiFormatReader2.prototype.setHints = function(hints2) {
27578
- this.hints = hints2;
27579
- var tryHarder = hints2 !== null && hints2 !== void 0 && void 0 !== hints2.get(DecodeHintType$1.TRY_HARDER);
27580
- var formats = hints2 === null || hints2 === void 0 ? null : hints2.get(DecodeHintType$1.POSSIBLE_FORMATS);
25587
+ MultiFormatReader2.prototype.setHints = function(hints) {
25588
+ this.hints = hints;
25589
+ var tryHarder = hints !== null && hints !== void 0 && void 0 !== hints.get(DecodeHintType$1.TRY_HARDER);
25590
+ var formats = hints === null || hints === void 0 ? null : hints.get(DecodeHintType$1.POSSIBLE_FORMATS);
27581
25591
  var readers = new Array();
27582
25592
  if (formats !== null && formats !== void 0) {
27583
25593
  var addOneDReader = formats.some(function(f) {
27584
25594
  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;
27585
25595
  });
27586
25596
  if (addOneDReader && !tryHarder) {
27587
- readers.push(new MultiFormatOneDReader(hints2));
25597
+ readers.push(new MultiFormatOneDReader(hints));
27588
25598
  }
27589
25599
  if (formats.includes(BarcodeFormat$1.QR_CODE)) {
27590
25600
  readers.push(new QRCodeReader());
@@ -27599,19 +25609,19 @@ var MultiFormatReader = (
27599
25609
  readers.push(new PDF417Reader());
27600
25610
  }
27601
25611
  if (addOneDReader && tryHarder) {
27602
- readers.push(new MultiFormatOneDReader(hints2));
25612
+ readers.push(new MultiFormatOneDReader(hints));
27603
25613
  }
27604
25614
  }
27605
25615
  if (readers.length === 0) {
27606
25616
  if (!tryHarder) {
27607
- readers.push(new MultiFormatOneDReader(hints2));
25617
+ readers.push(new MultiFormatOneDReader(hints));
27608
25618
  }
27609
25619
  readers.push(new QRCodeReader());
27610
25620
  readers.push(new DataMatrixReader());
27611
25621
  readers.push(new AztecReader());
27612
25622
  readers.push(new PDF417Reader());
27613
25623
  if (tryHarder) {
27614
- readers.push(new MultiFormatOneDReader(hints2));
25624
+ readers.push(new MultiFormatOneDReader(hints));
27615
25625
  }
27616
25626
  }
27617
25627
  this.readers = readers;
@@ -27684,16 +25694,16 @@ var __extends$c = /* @__PURE__ */ function() {
27684
25694
  }();
27685
25695
  (function(_super) {
27686
25696
  __extends$c(BrowserMultiFormatReader, _super);
27687
- function BrowserMultiFormatReader(hints2, timeBetweenScansMillis) {
27688
- if (hints2 === void 0) {
27689
- hints2 = null;
25697
+ function BrowserMultiFormatReader(hints, timeBetweenScansMillis) {
25698
+ if (hints === void 0) {
25699
+ hints = null;
27690
25700
  }
27691
25701
  if (timeBetweenScansMillis === void 0) {
27692
25702
  timeBetweenScansMillis = 500;
27693
25703
  }
27694
25704
  var _this = this;
27695
25705
  var reader = new MultiFormatReader();
27696
- reader.setHints(hints2);
25706
+ reader.setHints(hints);
27697
25707
  _this = _super.call(this, reader, timeBetweenScansMillis) || this;
27698
25708
  return _this;
27699
25709
  }
@@ -28496,14 +26506,14 @@ var __values$6 = function(o) {
28496
26506
  Encoder.calculateMaskPenalty = function(matrix) {
28497
26507
  return MaskUtil.applyMaskPenaltyRule1(matrix) + MaskUtil.applyMaskPenaltyRule2(matrix) + MaskUtil.applyMaskPenaltyRule3(matrix) + MaskUtil.applyMaskPenaltyRule4(matrix);
28498
26508
  };
28499
- Encoder.encode = function(content, ecLevel, hints2) {
28500
- if (hints2 === void 0) {
28501
- hints2 = null;
26509
+ Encoder.encode = function(content, ecLevel, hints) {
26510
+ if (hints === void 0) {
26511
+ hints = null;
28502
26512
  }
28503
26513
  var encoding = Encoder.DEFAULT_BYTE_MODE_ENCODING;
28504
- var hasEncodingHint = hints2 !== null && void 0 !== hints2.get(EncodeHintType$1.CHARACTER_SET);
26514
+ var hasEncodingHint = hints !== null && void 0 !== hints.get(EncodeHintType$1.CHARACTER_SET);
28505
26515
  if (hasEncodingHint) {
28506
- encoding = hints2.get(EncodeHintType$1.CHARACTER_SET).toString();
26516
+ encoding = hints.get(EncodeHintType$1.CHARACTER_SET).toString();
28507
26517
  }
28508
26518
  var mode = this.chooseMode(content, encoding);
28509
26519
  var headerBits = new BitArray();
@@ -28517,8 +26527,8 @@ var __values$6 = function(o) {
28517
26527
  var dataBits = new BitArray();
28518
26528
  this.appendBytes(content, mode, dataBits, encoding);
28519
26529
  var version;
28520
- if (hints2 !== null && void 0 !== hints2.get(EncodeHintType$1.QR_VERSION)) {
28521
- var versionNumber = Number.parseInt(hints2.get(EncodeHintType$1.QR_VERSION).toString(), 10);
26530
+ if (hints !== null && void 0 !== hints.get(EncodeHintType$1.QR_VERSION)) {
26531
+ var versionNumber = Number.parseInt(hints.get(EncodeHintType$1.QR_VERSION).toString(), 10);
28522
26532
  version = Version.getVersionForNumber(versionNumber);
28523
26533
  var bitsNeeded = this.calculateBitsNeeded(mode, headerBits, dataBits, version);
28524
26534
  if (!this.willFit(bitsNeeded, version, ecLevel)) {
@@ -29456,8 +27466,8 @@ var C40Encoder = (
29456
27466
  }
29457
27467
  break;
29458
27468
  }
29459
- var count2 = buffer.length();
29460
- if (count2 % 3 === 0) {
27469
+ var count = buffer.length();
27470
+ if (count % 3 === 0) {
29461
27471
  var newMode = HighLevelEncoder$1.lookAheadTest(context.getMessage(), context.pos, this.getEncodingMode());
29462
27472
  if (newMode !== this.getEncodingMode()) {
29463
27473
  context.signalEncoderChange(ASCII_ENCODATION);
@@ -29468,8 +27478,8 @@ var C40Encoder = (
29468
27478
  this.handleEOD(context, buffer);
29469
27479
  };
29470
27480
  C40Encoder2.prototype.backtrackOneCharacter = function(context, buffer, removed, lastCharSize) {
29471
- var count2 = buffer.length();
29472
- var test = buffer.toString().substring(0, count2 - lastCharSize);
27481
+ var count = buffer.length();
27482
+ var test = buffer.toString().substring(0, count - lastCharSize);
29473
27483
  buffer.setLengthToZero();
29474
27484
  buffer.append(test);
29475
27485
  context.pos--;
@@ -29587,8 +27597,8 @@ var EdifactEncoder = (
29587
27597
  var c = context.getCurrentChar();
29588
27598
  this.encodeChar(c, buffer);
29589
27599
  context.pos++;
29590
- var count2 = buffer.length();
29591
- if (count2 >= 4) {
27600
+ var count = buffer.length();
27601
+ if (count >= 4) {
29592
27602
  context.writeCodewords(this.encodeToCodewords(buffer.toString()));
29593
27603
  var test_1 = buffer.toString().substring(4);
29594
27604
  buffer.setLengthToZero();
@@ -29605,11 +27615,11 @@ var EdifactEncoder = (
29605
27615
  };
29606
27616
  EdifactEncoder2.prototype.handleEOD = function(context, buffer) {
29607
27617
  try {
29608
- var count2 = buffer.length();
29609
- if (count2 === 0) {
27618
+ var count = buffer.length();
27619
+ if (count === 0) {
29610
27620
  return;
29611
27621
  }
29612
- if (count2 === 1) {
27622
+ if (count === 1) {
29613
27623
  context.updateSymbolInfo();
29614
27624
  var available = context.getSymbolInfo().getDataCapacity() - context.getCodewordCount();
29615
27625
  var remaining = context.getRemainingCharacters();
@@ -29621,10 +27631,10 @@ var EdifactEncoder = (
29621
27631
  return;
29622
27632
  }
29623
27633
  }
29624
- if (count2 > 4) {
27634
+ if (count > 4) {
29625
27635
  throw new Error("Count must not exceed 4");
29626
27636
  }
29627
- var restChars = count2 - 1;
27637
+ var restChars = count - 1;
29628
27638
  var encoded = this.encodeToCodewords(buffer.toString());
29629
27639
  var endOfSymbolReached = !context.hasMoreCharacters();
29630
27640
  var restInAscii = endOfSymbolReached && restChars <= 2;
@@ -29927,8 +27937,8 @@ var EncoderContext = (
29927
27937
  EncoderContext2.prototype.getMessage = function() {
29928
27938
  return this.msg;
29929
27939
  };
29930
- EncoderContext2.prototype.setSkipAtEnd = function(count2) {
29931
- this.skipAtEnd = count2;
27940
+ EncoderContext2.prototype.setSkipAtEnd = function(count) {
27941
+ this.skipAtEnd = count;
29932
27942
  };
29933
27943
  EncoderContext2.prototype.getCurrentChar = function() {
29934
27944
  return this.msg.charCodeAt(this.pos);
@@ -30016,8 +28026,8 @@ var X12Encoder = (
30016
28026
  var c = context.getCurrentChar();
30017
28027
  context.pos++;
30018
28028
  this.encodeChar(c, buffer);
30019
- var count2 = buffer.length();
30020
- if (count2 % 3 === 0) {
28029
+ var count = buffer.length();
28030
+ if (count % 3 === 0) {
30021
28031
  this.writeNextTriplet(context, buffer);
30022
28032
  var newMode = HighLevelEncoder$1.lookAheadTest(context.getMessage(), context.pos, this.getEncodingMode());
30023
28033
  if (newMode !== this.getEncodingMode()) {
@@ -30057,8 +28067,8 @@ var X12Encoder = (
30057
28067
  X12Encoder2.prototype.handleEOD = function(context, buffer) {
30058
28068
  context.updateSymbolInfo();
30059
28069
  var available = context.getSymbolInfo().getDataCapacity() - context.getCodewordCount();
30060
- var count2 = buffer.length();
30061
- context.pos -= count2;
28070
+ var count = buffer.length();
28071
+ context.pos -= count;
30062
28072
  if (context.getRemainingCharacters() > 1 || available > 1 || context.getRemainingCharacters() !== available) {
30063
28073
  context.writeCodeword(X12_UNLATCH);
30064
28074
  }
@@ -31844,6 +29854,58 @@ var __values = function(o) {
31844
29854
  ]);
31845
29855
  return Encoder;
31846
29856
  })();
29857
+ const SCANNER_HINTS = /* @__PURE__ */ new Map([
29858
+ [
29859
+ DecodeHintType$2.POSSIBLE_FORMATS,
29860
+ [
29861
+ BarcodeFormat$1.AZTEC,
29862
+ BarcodeFormat$1.CODABAR,
29863
+ BarcodeFormat$1.CODE_39,
29864
+ BarcodeFormat$1.CODE_93,
29865
+ BarcodeFormat$1.CODE_128,
29866
+ BarcodeFormat$1.DATA_MATRIX,
29867
+ BarcodeFormat$1.EAN_8,
29868
+ BarcodeFormat$1.EAN_13,
29869
+ BarcodeFormat$1.ITF,
29870
+ BarcodeFormat$1.MAXICODE,
29871
+ BarcodeFormat$1.PDF_417,
29872
+ BarcodeFormat$1.QR_CODE,
29873
+ BarcodeFormat$1.RSS_14,
29874
+ BarcodeFormat$1.RSS_EXPANDED,
29875
+ BarcodeFormat$1.UPC_A,
29876
+ BarcodeFormat$1.UPC_E,
29877
+ BarcodeFormat$1.UPC_EAN_EXTENSION
29878
+ ]
29879
+ ]
29880
+ ]);
29881
+ const Scanner = memo((props) => {
29882
+ const { children, open, onOpenChange, defaultOpen, modal, ...rest } = props;
29883
+ return /* @__PURE__ */ jsxs(Overlay.Root, { open, onOpenChange, defaultOpen, modal, children: [
29884
+ !!children && /* @__PURE__ */ jsx(Overlay.Trigger, { asChild: true, children }),
29885
+ /* @__PURE__ */ jsxs(Overlay.Content, { children: [
29886
+ /* @__PURE__ */ jsx(Overlay.Title, { className: "sr-only", children: "Scanner" }),
29887
+ /* @__PURE__ */ jsx(Overlay.Description, { className: "sr-only", children: "Scan a barcode or a qr code." }),
29888
+ /* @__PURE__ */ jsx(ScannerInternal, { ...rest })
29889
+ ] })
29890
+ ] });
29891
+ });
29892
+ Scanner.displayName = "Scanner";
29893
+ const ScannerInternal = memo((props) => {
29894
+ const { paused, timeBetweenDecodingAttempts, onDecodeResult, onDecodeError, onError } = props;
29895
+ const { ref } = useZxing({
29896
+ paused,
29897
+ timeBetweenDecodingAttempts,
29898
+ onDecodeResult,
29899
+ onDecodeError,
29900
+ onError,
29901
+ hints: SCANNER_HINTS
29902
+ });
29903
+ return /* @__PURE__ */ jsxs("div", { className: "flex size-full flex-col justify-center overflow-hidden bg-(--color-background)", children: [
29904
+ /* @__PURE__ */ jsx("div", { className: "flex w-full justify-end p-4", children: /* @__PURE__ */ jsx(Overlay.Close, { asChild: true, children: /* @__PURE__ */ jsx(IconButton, { "aria-label": "close", variant: "soft", accentColor: "base", children: /* @__PURE__ */ jsx(LuIcon, { icon: "x" }) }) }) }),
29905
+ /* @__PURE__ */ jsx("div", { className: "grow w-full max-h-full overflow-hidden p-4", children: /* @__PURE__ */ jsx("video", { className: "size-full", ref }) })
29906
+ ] });
29907
+ });
29908
+ ScannerInternal.displayName = "ScannerInternal";
31847
29909
  const ScanInput = memo((props) => {
31848
29910
  const [
31849
29911
  { inputId, labelId, label, helpText, size, severity, showInputOnly, field, fieldProps, helpers, touched },
@@ -31873,20 +29935,18 @@ const ScanInput = memo((props) => {
31873
29935
  }, [internalValue, onBlur, onChange]);
31874
29936
  const handleScan = useCallback(
31875
29937
  (data) => {
31876
- onChange(data);
29938
+ onChange(data.getText());
31877
29939
  setShowScanner(false);
31878
29940
  },
31879
29941
  [onChange]
31880
29942
  );
31881
- const handleScannerOpenChange = useCallback(
31882
- (open) => {
31883
- setShowScanner(open);
31884
- if (!open) {
31885
- onBlur(value);
31886
- }
31887
- },
31888
- [onBlur, value]
31889
- );
29943
+ const handleOpenScanner = useCallback(() => {
29944
+ setShowScanner(true);
29945
+ }, []);
29946
+ const handleScannerOpenChange = useCallback(() => {
29947
+ setShowScanner(false);
29948
+ onBlur(value);
29949
+ }, [onBlur, value]);
31890
29950
  return /* @__PURE__ */ jsx(InputWithLabelAndHelpText, { helpText: computedHelpText, severity, children: /* @__PURE__ */ jsxs(
31891
29951
  InputWithLabel,
31892
29952
  {
@@ -31914,71 +29974,27 @@ const ScanInput = memo((props) => {
31914
29974
  ...rest
31915
29975
  }
31916
29976
  ),
31917
- /* @__PURE__ */ jsxs(Root, { open: showScanner, onOpenChange: handleScannerOpenChange, children: [
31918
- /* @__PURE__ */ jsx(Trigger, { asChild: true, children: /* @__PURE__ */ jsxs(Button, { className: "w-max", type: "button", variant: "soft", size: "sm", accentColor: "base", children: [
31919
- /* @__PURE__ */ jsx(Maximize, { className: "h-4 w-4" }),
31920
- "Scan"
31921
- ] }) }),
31922
- /* @__PURE__ */ jsxs(Portal, { children: [
31923
- /* @__PURE__ */ jsx(Overlay, { className: "light:bg-(--black-a6) fixed inset-0 dark:bg-(--black-a8)" }),
31924
- /* @__PURE__ */ jsx(Content, { className: "fixed inset-0", children: /* @__PURE__ */ jsx(Scanner, { onScan: handleScan }) })
31925
- ] })
31926
- ] })
29977
+ /* @__PURE__ */ jsxs(
29978
+ Button,
29979
+ {
29980
+ onClick: handleOpenScanner,
29981
+ className: "w-max",
29982
+ type: "button",
29983
+ variant: "soft",
29984
+ size: "sm",
29985
+ accentColor: "base",
29986
+ children: [
29987
+ /* @__PURE__ */ jsx(LuIcon, { icon: "maximize" }),
29988
+ "Scan"
29989
+ ]
29990
+ }
29991
+ ),
29992
+ /* @__PURE__ */ jsx(Scanner, { open: showScanner, onDecodeResult: handleScan, onOpenChange: handleScannerOpenChange })
31927
29993
  ]
31928
29994
  }
31929
29995
  ) });
31930
29996
  });
31931
29997
  ScanInput.displayName = "QrInput";
31932
- const hints = /* @__PURE__ */ new Map([
31933
- [
31934
- DecodeHintType$2.POSSIBLE_FORMATS,
31935
- [
31936
- BarcodeFormat$1.AZTEC,
31937
- BarcodeFormat$1.CODABAR,
31938
- BarcodeFormat$1.CODE_39,
31939
- BarcodeFormat$1.CODE_93,
31940
- BarcodeFormat$1.CODE_128,
31941
- BarcodeFormat$1.DATA_MATRIX,
31942
- BarcodeFormat$1.EAN_8,
31943
- BarcodeFormat$1.EAN_13,
31944
- BarcodeFormat$1.ITF,
31945
- BarcodeFormat$1.MAXICODE,
31946
- BarcodeFormat$1.PDF_417,
31947
- BarcodeFormat$1.QR_CODE,
31948
- BarcodeFormat$1.RSS_14,
31949
- BarcodeFormat$1.RSS_EXPANDED,
31950
- BarcodeFormat$1.UPC_A,
31951
- BarcodeFormat$1.UPC_E,
31952
- BarcodeFormat$1.UPC_EAN_EXTENSION
31953
- ]
31954
- ]
31955
- ]);
31956
- const Scanner = memo((props) => {
31957
- const { onScan } = props;
31958
- const { showError } = useToast();
31959
- const handleDecodeResult = useCallback(
31960
- (result) => {
31961
- onScan(result.getText());
31962
- },
31963
- [onScan]
31964
- );
31965
- const handleError = useCallback(() => {
31966
- showError({
31967
- title: "Scan Error",
31968
- description: "An unknown error occurred while scanning."
31969
- });
31970
- }, [showError]);
31971
- const { ref } = useZxing({
31972
- onDecodeResult: handleDecodeResult,
31973
- onError: handleError,
31974
- hints
31975
- });
31976
- return /* @__PURE__ */ jsxs("div", { className: "relative flex size-full flex-col justify-center overflow-hidden p-4 gap-4 bg-(--color-background)", children: [
31977
- /* @__PURE__ */ jsx("div", { className: "flex w-full", children: /* @__PURE__ */ jsx(Close, { asChild: true, children: /* @__PURE__ */ jsx(IconButton, { "aria-label": "close", variant: "soft", accentColor: "base", children: /* @__PURE__ */ jsx(X, { className: "h-4 w-4" }) }) }) }),
31978
- /* @__PURE__ */ jsx("div", { className: "relative grow w-full max-h-full overflow-hidden", children: /* @__PURE__ */ jsx("video", { className: "size-full", ref }) })
31979
- ] });
31980
- });
31981
- Scanner.displayName = "QrScanner";
31982
29998
  const _ScanField = class _ScanField extends BaseField {
31983
29999
  constructor(options) {
31984
30000
  super(options);
@@ -32242,7 +30258,7 @@ const ImageCard = memo(
32242
30258
  "bg-transparent": !file
32243
30259
  }),
32244
30260
  children: [
32245
- error ? /* @__PURE__ */ jsx(FileWarning, { className: "h-4 w-4" }) : file && /* @__PURE__ */ jsx(File$1, { className: "h-4 w-4", style: { color: "var(--base-a11)" } }),
30261
+ error ? /* @__PURE__ */ jsx(LuIcon, { icon: "file-warning" }) : file && /* @__PURE__ */ jsx(LuIcon, { icon: "file" }),
32246
30262
  /* @__PURE__ */ jsx(Text, { className: "truncate", size: "sm", children: error ?? (file == null ? void 0 : file.name) }),
32247
30263
  rightSlot
32248
30264
  ]
@@ -32397,8 +30413,7 @@ const UploadInput = memo((props) => {
32397
30413
  type: "button",
32398
30414
  ...rest,
32399
30415
  children: [
32400
- /* @__PURE__ */ jsx(Upload, { className: "h-4 w-4" }),
32401
- " ",
30416
+ /* @__PURE__ */ jsx(LuIcon, { icon: "upload" }),
32402
30417
  buttonText
32403
30418
  ]
32404
30419
  }
@@ -32503,10 +30518,10 @@ const DisplayFile = memo((props) => {
32503
30518
  type: "button",
32504
30519
  onClick: handleDownload,
32505
30520
  disabled: !resolvedFile,
32506
- children: /* @__PURE__ */ jsx(Download, { className: "h-4 w-4" })
30521
+ children: /* @__PURE__ */ jsx(LuIcon, { icon: "download" })
32507
30522
  }
32508
30523
  ),
32509
- !disabled && /* @__PURE__ */ jsx(IconButton, { type: "button", "aria-label": `Remove ${name}`, disabled, onClick: handleDelete, children: /* @__PURE__ */ jsx(Trash2, { className: "h-4 w-4" }) })
30524
+ !disabled && /* @__PURE__ */ jsx(IconButton, { type: "button", "aria-label": `Remove ${name}`, disabled, onClick: handleDelete, children: /* @__PURE__ */ jsx(LuIcon, { icon: "trash" }) })
32510
30525
  ] }),
32511
30526
  [disabled, handleDelete, handleDownload, name, resolvedFile]
32512
30527
  );
@@ -33079,12 +31094,12 @@ const SelectItemTemplate = genericMemo(function(props) {
33079
31094
  const computedChildren = useCallback(
33080
31095
  (meta) => {
33081
31096
  if (typeof children === "function") {
33082
- return /* @__PURE__ */ jsxs(Fragment, { children: [
31097
+ return /* @__PURE__ */ jsxs(Fragment$1, { children: [
33083
31098
  children(meta),
33084
31099
  /* @__PURE__ */ jsx(Menu.SelectedIndicator, { className: "ml-[auto]", children: /* @__PURE__ */ jsx(LuIcon, { icon: "check" }) })
33085
31100
  ] });
33086
31101
  } else {
33087
- return /* @__PURE__ */ jsxs(Fragment, { children: [
31102
+ return /* @__PURE__ */ jsxs(Fragment$1, { children: [
33088
31103
  children,
33089
31104
  /* @__PURE__ */ jsx(Menu.SelectedIndicator, { className: "ml-[auto]", children: /* @__PURE__ */ jsx(LuIcon, { icon: "check" }) })
33090
31105
  ] });
@@ -33099,12 +31114,12 @@ const MultiSelectItemTemplate = genericMemo(function(props) {
33099
31114
  const computedChildren = useCallback(
33100
31115
  (meta) => {
33101
31116
  if (typeof children === "function") {
33102
- return /* @__PURE__ */ jsxs(Fragment, { children: [
31117
+ return /* @__PURE__ */ jsxs(Fragment$1, { children: [
33103
31118
  children(meta),
33104
31119
  /* @__PURE__ */ jsx(Menu.SelectedIndicator, { className: "ml-auto", children: /* @__PURE__ */ jsx(LuIcon, { icon: "check" }) })
33105
31120
  ] });
33106
31121
  } else {
33107
- return /* @__PURE__ */ jsxs(Fragment, { children: [
31122
+ return /* @__PURE__ */ jsxs(Fragment$1, { children: [
33108
31123
  children,
33109
31124
  /* @__PURE__ */ jsx(Menu.SelectedIndicator, { className: "ml-auto", children: /* @__PURE__ */ jsx(LuIcon, { icon: "check" }) })
33110
31125
  ] });
@@ -33119,12 +31134,12 @@ const SelectAllItemTemplate = memo((props) => {
33119
31134
  const computedChildren = useCallback(
33120
31135
  (meta) => {
33121
31136
  if (typeof children === "function") {
33122
- return /* @__PURE__ */ jsxs(Fragment, { children: [
31137
+ return /* @__PURE__ */ jsxs(Fragment$1, { children: [
33123
31138
  children(meta),
33124
31139
  /* @__PURE__ */ jsx(Menu.CheckboxItemIndicator, { className: "ml-[auto]", children: (indeterminate) => indeterminate ? /* @__PURE__ */ jsx(LuIcon, { icon: "minus" }) : /* @__PURE__ */ jsx(LuIcon, { icon: "check" }) })
33125
31140
  ] });
33126
31141
  } else {
33127
- return /* @__PURE__ */ jsxs(Fragment, { children: [
31142
+ return /* @__PURE__ */ jsxs(Fragment$1, { children: [
33128
31143
  children,
33129
31144
  /* @__PURE__ */ jsx(Menu.CheckboxItemIndicator, { className: "ml-[auto]", children: (indeterminate) => indeterminate ? /* @__PURE__ */ jsx(LuIcon, { icon: "minus" }) : /* @__PURE__ */ jsx(LuIcon, { icon: "check" }) })
33130
31145
  ] });
@@ -33878,7 +31893,7 @@ const NumberFieldConditionCell = (props) => {
33878
31893
  case "notInRange": {
33879
31894
  const inRangeModifier = condition.modifiers.inRange;
33880
31895
  const rangeFilterValue = conditionValue !== void 0 && inRangeModifier.isConditionValueValid(conditionValue) ? conditionValue : void 0;
33881
- return /* @__PURE__ */ jsxs(Fragment, { children: [
31896
+ return /* @__PURE__ */ jsxs(Fragment$1, { children: [
33882
31897
  /* @__PURE__ */ jsx(
33883
31898
  NumberInputPopover,
33884
31899
  {
@@ -34781,7 +32796,7 @@ const FieldSectionLayout = memo((props) => {
34781
32796
  const inputs = useFieldInputs(section.fields, rest);
34782
32797
  if (!conditionMet) return null;
34783
32798
  return /* @__PURE__ */ jsxs(Card, { variant: "soft", className: "flex flex-col gap-4", children: [
34784
- (label || description) && /* @__PURE__ */ jsxs(Fragment, { children: [
32799
+ (label || description) && /* @__PURE__ */ jsxs(Fragment$1, { children: [
34785
32800
  /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1", children: [
34786
32801
  /* @__PURE__ */ jsx(Heading, { size: "md", children: label }),
34787
32802
  description && /* @__PURE__ */ jsx(Text, { accentColor: "base", children: description })
@@ -35254,7 +33269,7 @@ const FieldSettingsPopover = memo((props) => {
35254
33269
  accentColor: "base",
35255
33270
  ...hasError && { color: SEVERITY_COLOR_MAPPING.danger },
35256
33271
  children: [
35257
- /* @__PURE__ */ jsx(Settings, { className: "h-4 w-4" }),
33272
+ /* @__PURE__ */ jsx(LuIcon, { icon: "settings" }),
35258
33273
  "Settings"
35259
33274
  ]
35260
33275
  },
@@ -35500,7 +33515,7 @@ const FieldSectionConditionEdgeComponent = memo((props) => {
35500
33515
  targetY,
35501
33516
  targetPosition: layoutDirection === "LR" ? Position.Left : Position.Top
35502
33517
  });
35503
- return /* @__PURE__ */ jsxs(Fragment, { children: [
33518
+ return /* @__PURE__ */ jsxs(Fragment$1, { children: [
35504
33519
  /* @__PURE__ */ jsx(BaseEdge, { id, path: edgePath, style, markerEnd, labelX, labelY }),
35505
33520
  /* @__PURE__ */ jsx(EdgeLabelRenderer, { children: /* @__PURE__ */ jsxs(
35506
33521
  Card,
@@ -35545,7 +33560,7 @@ const FieldSectionConditionEdgeComponent = memo((props) => {
35545
33560
  ] })
35546
33561
  ] })
35547
33562
  ] }),
35548
- conditions.length > 0 && /* @__PURE__ */ jsx("div", { className: "flex flex-col h-max w-full flex-wrap gap-1", children: conditions.map((condition) => /* @__PURE__ */ jsx(Fragment$1, { children: condition.render({
33563
+ conditions.length > 0 && /* @__PURE__ */ jsx("div", { className: "flex flex-col h-max w-full flex-wrap gap-1", children: conditions.map((condition) => /* @__PURE__ */ jsx(Fragment, { children: condition.render({
35549
33564
  onRemove: handleRemoveCondition
35550
33565
  }) }, condition.id)) })
35551
33566
  ]
@@ -36307,7 +34322,7 @@ const FormRenderer = memo(
36307
34322
  excludeUnchangedFields = false
36308
34323
  } = props;
36309
34324
  const { readonly } = schema.meta;
36310
- const formId2 = useId$1();
34325
+ const formId2 = useId();
36311
34326
  const initialValues = useMemo(() => {
36312
34327
  return initializeFieldValues(flattenFields(schema.fields), values);
36313
34328
  }, [schema.fields, values]);
@@ -36506,6 +34521,33 @@ const FormBuilder = {
36506
34521
  ListBuilder: FormBuilderListBuilder,
36507
34522
  Preview: FormBuilderPreview
36508
34523
  };
34524
+ const ScannerContext = createContext(() => {
34525
+ throw new Error("No ScannerProvider found");
34526
+ });
34527
+ const useScanner = () => use(ScannerContext);
34528
+ const ScannerProvider = memo((props) => {
34529
+ const { children } = props;
34530
+ const [config, setConfig] = useState(null);
34531
+ const closeFileViewer = useCallback(() => {
34532
+ setConfig(null);
34533
+ }, []);
34534
+ const openFileViewer = useCallback(
34535
+ (func) => {
34536
+ setConfig(func(closeFileViewer));
34537
+ },
34538
+ [closeFileViewer]
34539
+ );
34540
+ const handleClose = useCallback(() => {
34541
+ if (!config) return;
34542
+ if (config.onClose) config.onClose();
34543
+ closeFileViewer();
34544
+ }, [closeFileViewer, config]);
34545
+ return /* @__PURE__ */ jsxs(ScannerContext.Provider, { value: openFileViewer, children: [
34546
+ children,
34547
+ config && /* @__PURE__ */ jsx(Scanner, { open: true, onOpenChange: handleClose, ...config })
34548
+ ] });
34549
+ });
34550
+ ScannerProvider.displayName = "FileViewerProvider";
36509
34551
  export {
36510
34552
  BaseCondition,
36511
34553
  BaseField,
@@ -36583,6 +34625,7 @@ export {
36583
34625
  ScanFieldConditionCell,
36584
34626
  ScanInput,
36585
34627
  Scanner,
34628
+ ScannerProvider,
36586
34629
  SelectField,
36587
34630
  SelectFieldCondition,
36588
34631
  SelectFieldConditionCell,
@@ -36642,5 +34685,6 @@ export {
36642
34685
  useFieldInputs,
36643
34686
  useFormikInput,
36644
34687
  useImageViewer,
34688
+ useScanner,
36645
34689
  validateFields
36646
34690
  };