@overmap-ai/forms 1.0.36-add-utils.9 → 1.0.36-add-utils.10

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.
@@ -25,7 +25,7 @@ export declare class RatingField extends BaseField<"rating", number | null, numb
25
25
  serializeValue(value: number | null): number | null;
26
26
  deserializeValue(value: number | null): number | null;
27
27
  render(props: FieldRenderProps): ReactNode;
28
- isSerializedValueValid(value: unknown): value is number;
28
+ isSerializedValueValid(value: unknown): value is number | null;
29
29
  isValueValid(value: unknown): value is number | null;
30
30
  areValuesEqual(value1: number | null, value2: number | null): boolean;
31
31
  blankValue(): number | null;
package/dist/forms.js CHANGED
@@ -1354,10 +1354,10 @@ const _t = class _t extends Je {
1354
1354
  return /* @__PURE__ */ p(fo, { field: this, ...t });
1355
1355
  }
1356
1356
  isSerializedValueValid(t) {
1357
- return typeof t == "number" || t === null;
1357
+ return this.isValueValid(t);
1358
1358
  }
1359
1359
  isValueValid(t) {
1360
- return typeof t == "number" || t === null;
1360
+ return typeof t == "number" && !isNaN(t) || t === null;
1361
1361
  }
1362
1362
  areValuesEqual(t, n) {
1363
1363
  return t === n;
@@ -2763,10 +2763,10 @@ const Jt = class Jt extends Je {
2763
2763
  return /* @__PURE__ */ p(Ao, { field: this, ...t });
2764
2764
  }
2765
2765
  isSerializedValueValid(t) {
2766
- return typeof t == "number" || t === null;
2766
+ return this.isValueValid(t);
2767
2767
  }
2768
2768
  isValueValid(t) {
2769
- return typeof t == "number" || t === null;
2769
+ return typeof t == "number" && !isNaN(t) || t === null;
2770
2770
  }
2771
2771
  areValuesEqual(t, n) {
2772
2772
  return t === n;
@@ -233,7 +233,7 @@
233
233
  *
234
234
  * This source code is licensed under the ISC license.
235
235
  * See the LICENSE file in the root directory of this source tree.
236
- */const nt=G("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),On=A.memo(A.forwardRef((r,e)=>{const{file:t,className:n,error:i,rightSlot:a,...o}=r;return f.jsxs(v.Card,{className:sr.cx(n,"flex w-full items-center gap-2 text-sm"),ref:e,...o,children:[i?f.jsx(v.LuIcon,{icon:rl}):f.jsx(v.LuIcon,{icon:ia,color:"var(--base-a11)"}),i?f.jsx(v.Text,{accentColor:"danger",className:"truncate",children:i}):t?f.jsx(v.Text,{className:"truncate",children:t.name}):f.jsx("div",{className:"flex w-full justify-center",children:f.jsx(v.Spinner,{})}),a]})}));On.displayName="FileCard";const Ot={danger:"danger",warning:"warning",info:"base",success:"success"};function lr(r){return Array.isArray(r)?r.every(e=>typeof e=="string"):!1}class ur{constructor(){N(this,"observers",new Set)}notify(e){for(const t of this.observers)t(e)}observe(e){return this.observers.add(e),()=>{this.observers.delete(e)}}}class bn extends ur{constructor(t){const{identifier:n}=t;super();N(this,"identifier");this.identifier=n}getOptions(){return{identifier:this.identifier}}setOptions(t){this.identifier=t.identifier??this.identifier,this.notify(this)}serialize(){return{type:this.type,identifier:this.identifier}}}class Pe extends bn{constructor(t){const{label:n,description:i=null,required:a,image:o,...s}=t;super(s);N(this,"label");N(this,"description");N(this,"required");N(this,"image");N(this,"onlyValidateAfterTouched",!0);this.label=n,this.description=i,this.required=a,this.image=o}getError(t){if(this.required&&this.isValueBlank(t))return"This field is required.";for(const n of this.getFieldValidators()){const i=n(t);if(i)return i}}serialize(){return{...super.serialize(),label:this.label,description:this.description,required:this.required,image:this.image}}getOptions(){return{...super.getOptions(),label:this.label,description:this.description,required:this.required,image:this.image}}setOptions(t){const{label:n,description:i=null,required:a,image:o,...s}=t;this.label=n??this.label,this.description=i??this.description,this.required=a??this.required,this.image=o??this.image,super.setOptions(s)}isValueBlank(t){return this.areValuesEqual(t,this.blankValue())}cleanValue(t){return t}isValueClean(t){return this.areValuesEqual(t,this.cleanValue(t))}cleanSerializedValue(t){return t}isSerializedValueClean(t){return this.areSerializedValuesEqual(t,this.cleanSerializedValue(t))}isSerializedValueBlank(t){return this.areSerializedValuesEqual(t,this.blankSerializedValue())}getFieldValidators(){return[]}}N(Pe,"fieldTypeName"),N(Pe,"fieldTypeDescription");const qr=r=>{const{helpText:e,children:t,severity:n}=r,i=n?Ot[n]:"base";return f.jsxs("div",{className:"flex flex-col gap-1",children:[t,!!e&&f.jsx(v.Text,{accentColor:i,size:"xs",children:e})]})},la=A.createContext(()=>{throw new Error("No ImageViewerProvider found")}),Xr=()=>A.useContext(la),Nn=A.memo(r=>{const{file:e,onClose:t}=r,n=A.useRef(null),i=A.useCallback(()=>{var s;if(!n.current)return;const o=document.createElement("canvas");o.width=n.current.width,o.height=n.current.height,(s=o.getContext("2d"))==null||s.drawImage(n.current,0,0,n.current.width,n.current.height),o.toBlob(l=>{l&&navigator.clipboard.write([new ClipboardItem({"image/png":l})])},"image/png")},[]),a=A.useCallback(()=>{Yi.saveAs(e,e.name)},[e]);return f.jsx(v.Overlay.Root,{open:!0,onOpenChange:t,children:f.jsxs(v.Overlay.Content,{onOpenAutoFocus:o=>o.preventDefault(),children:[f.jsxs(v.ButtonGroup,{className:"flex gap-2 items-center top-0 absolute right-0 p-2",accentColor:"base",variant:"ghost",children:[f.jsxs(v.Tooltip.Root,{children:[f.jsx(v.Tooltip.Trigger,{asChild:!0,children:f.jsx(v.IconButton,{onClick:i,"aria-label":"copy to clipboard",children:f.jsx(v.LuIcon,{icon:Hr})})}),f.jsx(v.Tooltip.Content,{size:"sm",children:"Copy"})]}),f.jsxs(v.Tooltip.Root,{children:[f.jsx(v.Tooltip.Trigger,{asChild:!0,children:f.jsx(v.IconButton,{onClick:a,"aria-label":"download",children:f.jsx(v.LuIcon,{icon:na})})}),f.jsx(v.Tooltip.Content,{size:"sm",children:"Download"})]}),f.jsx(v.Separator,{orientation:"vertical",size:"sm"}),f.jsx(v.Overlay.Close,{asChild:!0,children:f.jsx(v.IconButton,{onClick:t,"aria-label":"close",children:f.jsx(v.LuIcon,{icon:nt})})})]}),f.jsx("figure",{className:"size-full overflow-hidden p-4 flex justify-center items-center",children:f.jsx("img",{ref:n,className:"max-w-full max-h-full",src:URL.createObjectURL(e),alt:e.name})})]})})});Nn.displayName="ImageViewer";const ua=A.memo(r=>{const{children:e}=r,[t,n]=A.useState(null),i=A.useCallback(()=>{n(null)},[]),a=A.useCallback(s=>{n(s(i))},[i]),o=A.useCallback(()=>{t&&(t.onClose&&t.onClose(),i())},[i,t]);return f.jsxs(la.Provider,{value:a,children:[e,t&&f.jsx(Nn,{file:t.file,onClose:o})]})});ua.displayName="FileViewerProvider";const Oe=A.memo(r=>{const{className:e,label:t,children:n,severity:i,inputId:a,labelId:o,image:s}=r,[l,u]=A.useState(void 0),c=Xr(),d=i?Ot[i]:"base";A.useEffect(()=>{s instanceof Promise?s.then(u).catch(console.error):u(s)},[s]);const p=l?URL.createObjectURL(l):void 0,h=A.useCallback(()=>{l&&c(()=>({file:l}))},[c,l]);return f.jsxs("div",{className:"flex flex-col gap-1",children:[l&&f.jsx("img",{className:"h-[100px] w-full min-w-[300px] cursor-pointer rounded-md object-cover",src:p,alt:l.name,onClick:h}),!!t&&f.jsx("label",{className:sr.cx(e,"w-max max-w-full"),htmlFor:a,children:f.jsx(v.Text,{accentColor:d,size:"sm",id:o,className:"text-wrap",children:t})}),n]})}),be=r=>{const{children:e,...t}=r;return f.jsx(qr,{...t,children:e})},yl=(r,e)=>A.useMemo(()=>!e||!r?null:r.render(e),[r,e]),cr=(r,e)=>f.jsx("div",{className:"flex flex-col gap-4",children:r.map(t=>f.jsx(A.Fragment,{children:t.render(e)},t.identifier))}),Ne=r=>{const{field:e,size:t,showInputOnly:n,onValuesChange:i,...a}=r,[o,s,l]=Re.useField(e.identifier),{touched:u}=s,c=s.error??e.description,d=s.error?"danger":void 0,p=e.identifier,h=`${p}-label`,g=e.required?`${e.label} *`:e.label,x=A.useMemo(()=>({...o,onChange:m=>{l.setValue(m,!1),i==null||i(e.identifier,m),(u||!e.onlyValidateAfterTouched)&&l.setError(e.getError(m))},onBlur:m=>{l.setTouched(!0,!1),l.setError(e.getError(m))}}),[e,o,l,i,u]);return[{helpText:c,size:t,severity:d,inputId:p,labelId:h,label:g,showInputOnly:n,fieldProps:x,helpers:l,field:e,touched:u},{...a,"aria-labelledby":h}]},Tn=A.memo(r=>{const[{inputId:e,labelId:t,size:n,severity:i,showInputOnly:a,field:o,helpText:s,label:l,fieldProps:u},{disabled:c}]=Ne(r),d=a?null:s,p=a?"":l,{value:h,name:g,onChange:x,onBlur:y}=u,w=`${e}-droppable`,[m,_]=A.useState(""),[E,I]=A.useState(""),b=E||d,D=A.useCallback(U=>{x(U),y(U)},[x,y]),M=A.useCallback(U=>{h&&h.findIndex(Q=>Q===U.target.value.trim())>=0?I("All options must be unique"):U.target.value?I(""):I("Option cannot be empty"),_(U.target.value)},[_,h]),V=A.useCallback(()=>{if(E)return;if(!m.trim()){I("Option cannot be empty");return}const U=m.trim();D([...h,U]),_("")},[m,E,D,h]),L=A.useCallback(U=>{U.key==="Enter"&&(U.preventDefault(),V())},[V]),W=A.useCallback(U=>{const Q=Array.from(h);Q.splice(U,1),D(Q)},[h,D]),k=A.useCallback(U=>{if(!U.destination)return;const Q=U.source.index,q=U.destination.index,ae=Array.from(h),[Fe]=ae.splice(Q,1);ae.splice(q,0,Fe),D(ae)},[D,h]),j=A.useCallback(()=>{y(h)},[y,h]);return f.jsx(An.DragDropContext,{onDragEnd:k,children:f.jsxs("div",{className:"flex flex-col gap-2",children:[f.jsx(be,{helpText:b,severity:i,children:f.jsx(Oe,{size:n,severity:i,inputId:e,labelId:t,label:p,image:a?void 0:o.image,children:(!c||h.length===0)&&f.jsxs("div",{className:"flex gap-2",children:[f.jsx(v.Input.Root,{className:"grow",accentColor:"base",variant:"surface",size:"sm",children:f.jsx(v.Input.Field,{value:m,onChange:M,onKeyDown:L,id:e,placeholder:o.placeholder,onBlur:j,name:g,disabled:c})}),f.jsx(v.IconButton,{size:"sm",accentColor:"base",variant:"soft",type:"button","aria-label":"Add option",disabled:!!E||c,onClick:V,children:f.jsx(v.LuIcon,{icon:Ze})})]})})}),h.length!==0&&f.jsx(An.Droppable,{droppableId:w,children:U=>f.jsxs("div",{className:"flex flex-col gap-1",...U.droppableProps,ref:U.innerRef,children:[h.map((Q,q)=>f.jsx(An.Draggable,{draggableId:`${Q}-draggable`,index:q,isDragDisabled:c,children:({draggableProps:ae,dragHandleProps:Fe,innerRef:Ur})=>f.jsxs(v.Badge,{...Fe,...ae,ref:Ur,className:"flex items-center justify-between gap-2",accentColor:"base",size:"sm",variant:"soft",children:[f.jsx("span",{className:"truncate",children:typeof Q=="object"&&"label"in Q?Q.label:Q}),f.jsx(v.IconButton,{size:"xs",variant:"ghost",type:"button","aria-label":"Delete option",accentColor:"base",disabled:c,onClick:()=>{W(q)},children:f.jsx(v.LuIcon,{icon:nt})})]})},`${e}-${Q}-${q}`)),U.placeholder]})})]})})});Tn.displayName="MultiStringInput";const Wt=class Wt extends Pe{constructor(t){const{minimum_length:n,maximum_length:i,placeholder:a,...o}=t;super(o);N(this,"type","multi-string");N(this,"minLength");N(this,"maxLength");N(this,"placeholder");N(this,"onlyValidateAfterTouched",!1);this.minLength=n??0,this.maxLength=i??1/0,this.placeholder=a??"Press enter to add a new option"}render(t){return f.jsx(Tn,{field:this,...t})}serialize(){return{...super.serialize(),minimum_length:this.minLength,maximum_length:this.maxLength,placeholder:this.placeholder}}getOptions(){return{...super.getOptions(),minimum_length:this.minLength,maximum_length:this.maxLength,placeholder:this.placeholder}}duplicate(t){return new Wt({...this.getOptions(),identifier:t})}setOptions(t){const{minimum_length:n,maximum_length:i,placeholder:a,...o}=t;this.minLength=n??this.minLength,this.maxLength=i??this.maxLength,this.placeholder=a??this.placeholder,super.setOptions(o)}serializeValue(t){return t}deserializeValue(t){return t}getFieldValidators(){const t=super.getFieldValidators();return t.push(n=>{if(Array.isArray(n)&&n.length<this.minLength)return`Must have at least ${this.minLength} options.`}),t.push(n=>{if(Array.isArray(n)&&n.length>this.maxLength)return`Must have at most ${this.maxLength} options.`}),t}static deserialize(t){return new Wt(t)}isSerializedValueValid(t){return lr(t)}isValueValid(t){return lr(t)}blankValue(){return[]}areValuesEqual(t,n){const i=new Set(t),a=new Set(n);return i.size===a.size&&i.isSubsetOf(a)}blankSerializedValue(){return[]}areSerializedValuesEqual(t,n){const i=new Set(t),a=new Set(n);return i.size===a.size&&i.isSubsetOf(a)}};N(Wt,"fieldTypeName","Multi-string"),N(Wt,"fieldTypeDescription","Allows the user to provide multiple unique strings.");let bt=Wt;class dr extends Pe{constructor(t){const{options:n,...i}=t;super(i);N(this,"options");N(this,"onlyValidateAfterTouched",!1);this.options=n.map(a=>(typeof a=="string"&&(a={label:a,value:a}),a))}serialize(){return{...super.serialize(),options:this.options}}getOptions(){return{...super.getOptions(),options:this.options}}setOptions(t){const{options:n,...i}=t;this.options=(n==null?void 0:n.map(a=>(typeof a=="string"&&(a={label:a,value:a}),a)))??this.options,super.setOptions(i)}static getFieldCreationSchema(t=""){const n=t&&`${t}.`;return[{field:new bt({label:"Options",description:"List possible options for the user to select from.",required:!0,identifier:`${n}options`,minimum_length:2}),showDirectly:!0}]}}const Dn=A.memo(r=>{const[{inputId:e,labelId:t,size:n,severity:i,showInputOnly:a,field:o,helpText:s,label:l,fieldProps:u},{disabled:c}]=Ne(r),{name:d,onBlur:p,onChange:h,value:g}=u,x=a?null:s,y=a?"":l,w=A.useCallback(_=>{h(!!_),p(!!_)},[p,h]),m=A.useCallback(()=>{p(g)},[p,g]);return f.jsx(be,{helpText:x,severity:i,children:f.jsx(Oe,{size:n,severity:i,inputId:e,labelId:t,label:y,image:a?void 0:o.image,className:"items-center flex-row-reverse justify-end gap-2",children:f.jsx(v.Checkbox.Root,{id:e,name:d,checked:g??!1,onCheckedChange:w,onBlur:m,size:"sm",accentColor:"primary",variant:"surface",disabled:c,children:f.jsx(v.Checkbox.Indicator,{children:f.jsx(v.LuIcon,{icon:qe})})})})})});Dn.displayName="BooleanInput";const jt=class jt extends Pe{constructor(t){super(t);N(this,"type","boolean");N(this,"onlyValidateAfterTouched",!1)}serialize(){return super.serialize()}getOptions(){return super.getOptions()}setOptions(t){super.setOptions(t)}duplicate(t){return new jt({...this.getOptions(),identifier:t})}static deserialize(t){return new jt(t)}serializeValue(t){return t}deserializeValue(t){return t}render(t){return f.jsx(Dn,{...t,field:this})}isSerializedValueValid(t){return typeof t=="boolean"}isValueValid(t){return typeof t=="boolean"}blankValue(){return!1}blankSerializedValue(){return!1}areSerializedValuesEqual(t,n){return t===n}areValuesEqual(t,n){return t===n}};N(jt,"fieldTypeName","Checkbox"),N(jt,"fieldTypeDescription","Perfect for both optional and required yes/no questions.");let Nt=jt;const Mn=A.memo(r=>{const[{inputId:e,labelId:t,size:n,severity:i,showInputOnly:a,field:o,helpText:s,label:l,fieldProps:u,touched:c,helpers:d},{disabled:p}]=Ne(r),{name:h,onBlur:g,onChange:x,value:y}=u,w=a?null:s,m=a?"":l,[_,E]=A.useState(null);A.useEffect(()=>{E(y)},[y]);const I=A.useCallback(D=>{const M=D.target.valueAsNumber,V=isNaN(M)?null:M;E(V),(c||!o.onlyValidateAfterTouched)&&d.setError(o.getError(V))},[o,d,c]),b=A.useCallback(()=>{x(_),g(_)},[_,g,x]);return f.jsx(be,{helpText:w,severity:i,children:f.jsx(Oe,{size:n,severity:i,inputId:e,labelId:t,label:m,image:a?void 0:o.image,children:f.jsx(v.Input.Root,{accentColor:"base",variant:"surface",size:"sm",children:f.jsx(v.Input.Field,{id:e,name:h,onChange:I,onBlur:b,value:_??"",type:"number",min:o.minimum,max:o.maximum,step:o.integers?1:.1,placeholder:o.placeholder??"Enter a number",disabled:p})})})})});Mn.displayName="NumberInput";const ft=class ft extends Pe{constructor(t){const{minimum:n=Number.MIN_SAFE_INTEGER,maximum:i=Number.MAX_SAFE_INTEGER,integers:a=!1,placeholder:o,...s}=t;super(s);N(this,"type","number");N(this,"minimum");N(this,"maximum");N(this,"integers");N(this,"placeholder");this.minimum=n,this.maximum=i,this.integers=a,this.placeholder=o}static getFieldCreationSchema(t=""){const n=t&&`${t}.`;return[{field:new ft({label:"Minimum",description:"Minimum value",integers:!0,required:!1,identifier:`${n}minimum`}),showDirectly:!1},{field:new ft({label:"Maximum",description:"Maximum value",integers:!0,required:!1,identifier:`${n}maximum`}),showDirectly:!1},{field:new Nt({label:"Integers",description:"Whole numbers only",required:!1,identifier:`${n}integers`}),showDirectly:!1}]}getFieldValidators(){const t=super.getFieldValidators(),n=this.minimum,i=this.maximum;return typeof n=="number"&&t.push(a=>{if(typeof a=="number"&&a<n)return`Must be at least ${this.minimum}.`}),typeof i=="number"&&t.push(a=>{if(typeof a=="number"&&a>i)return`Must be at most ${this.maximum}.`}),this.integers&&t.push(a=>{if(typeof a=="number"&&!Number.isInteger(a))return"Must be a whole number."}),t}serialize(){return{...super.serialize(),minimum:this.minimum,maximum:this.maximum,integers:this.integers,placeholder:this.placeholder}}getOptions(){return{...super.getOptions(),minimum:this.minimum,maximum:this.maximum,integers:this.integers,placeholder:this.placeholder}}duplicate(t){return new ft({...this.getOptions(),identifier:t})}setOptions(t){const{minimum:n,maximum:i,integers:a,placeholder:o,...s}=t;this.minimum=n??this.minimum,this.maximum=i??this.maximum,this.integers=a??this.integers,this.placeholder=o??this.placeholder,super.setOptions(s)}static deserialize(t){return new ft(t)}serializeValue(t){return t}deserializeValue(t){return t}render(t){return f.jsx(Mn,{field:this,...t})}isSerializedValueValid(t){return typeof t=="number"||t===null}isValueValid(t){return typeof t=="number"||t===null}areValuesEqual(t,n){return t===n}blankValue(){return null}blankSerializedValue(){return null}areSerializedValuesEqual(t,n){return t===n}};N(ft,"fieldTypeName","Number"),N(ft,"fieldTypeDescription","Allows specifying a number within a given range.");let $e=ft;const Tt=1e4;class Vn extends Pe{constructor(t){const{minLength:n,maxLength:i,placeholder:a="",...o}=t;super(o);N(this,"minLength");N(this,"maxLength");N(this,"placeholder");this.minLength=n?Math.max(n,0):void 0,this.maxLength=i?Math.max(i,0):Tt,this.placeholder=a}static getFieldCreationSchema(t=""){const n=t&&`${t}.`;return[{field:new $e({label:"Minimum length",description:"Minimum number of characters",required:!1,identifier:`${n}minimum_length`,minimum:0,maximum:100,integers:!0}),showDirectly:!1},{field:new $e({label:"Maximum length",description:"Maximum number of characters",required:!1,identifier:`${n}maximum_length`,minimum:1,maximum:Tt,integers:!0}),showDirectly:!1}]}getFieldValidators(){const t=super.getFieldValidators();return this.minLength&&t.push(n=>{if(this.minLength&&(!n||n.length<this.minLength))return!this.required&&!n?null:`Minimum ${this.minLength} character(s).`}),this.maxLength&&t.push(n=>{if(typeof n=="string"&&this.maxLength&&n.length>this.maxLength)return`Maximum ${this.maxLength} character(s).`}),t}serialize(){return{...super.serialize(),minimum_length:this.minLength,maximum_length:this.maxLength,placeholder:this.placeholder}}getOptions(){return{...super.getOptions(),minLength:this.minLength,maxLength:this.maxLength,placeholder:this.placeholder}}setOptions(t){const{minLength:n,maxLength:i,placeholder:a,...o}=t;this.minLength=n,this.maxLength=i??this.maxLength,this.placeholder=a,super.setOptions(o)}serializeValue(t){return t}deserializeValue(t){return t}isSerializedValueValid(t){return typeof t=="string"}isValueValid(t){return typeof t=="string"}blankValue(){return""}blankSerializedValue(){return""}areSerializedValuesEqual(t,n){return t===n}areValuesEqual(t,n){return t===n}}const Fn=A.memo(r=>{const[{inputId:e,labelId:t,size:n,severity:i,field:a,showInputOnly:o,helpText:s,label:l,fieldProps:u},{disabled:c}]=Ne(r),{value:d,name:p,onChange:h,onBlur:g}=u,x=o?null:s,y=o?"":l,w=A.useCallback(m=>{h(m),g(m)},[g,h]);return f.jsx(be,{helpText:x,severity:i,children:f.jsx(Oe,{size:n,severity:i,inputId:e,labelId:t,label:y,image:o?void 0:a.image,children:f.jsx(v.CheckboxGroup.Root,{id:e,name:p,className:"flex flex-col gap-1",accentColor:"base",variant:"surface",size:"sm",values:d,onValuesChange:w,disabled:c,children:a.options.map((m,_)=>f.jsxs("label",{className:"flex gap-2 items-center min-w-0",children:[f.jsx(v.CheckboxGroup.Item,{value:m.value,children:f.jsx(v.CheckboxGroup.ItemIndicator,{children:f.jsx(v.LuIcon,{icon:qe})})}),f.jsx(v.Text,{size:"sm",accentColor:"base",className:"truncate",children:m.label})]},`${e}-${m.value}-${_}`))})})})});Fn.displayName="CheckboxListInput";const Yt=class Yt extends dr{constructor(t){super(t);N(this,"type","checkbox-list");N(this,"onlyValidateAfterTouched",!1)}serialize(){return super.serialize()}getOptions(){return super.getOptions()}duplicate(t){return new Yt({...this.getOptions(),identifier:t})}static deserialize(t){return new Yt(t)}serializeValue(t){return t}deserializeValue(t){return t}render(t){return f.jsx(Fn,{field:this,...t})}isSerializedValueValid(t){if(!lr(t))return!1;const n=new Set(this.options.map(({value:i})=>i));return t.every(i=>n.has(i))}isValueValid(t){return this.isSerializedValueValid(t)}blankValue(){return[]}blankSerializedValue(){return[]}areSerializedValuesEqual(t,n){const i=new Set(t),a=new Set(n);return i.size===a.size&&i.isSubsetOf(a)}areValuesEqual(t,n){const i=new Set(t),a=new Set(n);return i.size===a.size&&i.isSubsetOf(a)}};N(Yt,"fieldTypeName","Checkbox list"),N(Yt,"fieldTypeDescription","Allows the user to select a multiple options from a list.");let Dt=Yt;const Pn=A.memo(r=>{const[{inputId:e,labelId:t,size:n,severity:i,showInputOnly:a,field:o,helpText:s,label:l,fieldProps:u},{disabled:c}]=Ne(r),{value:d,name:p,onChange:h,onBlur:g}=u,[x,y]=A.useState(!1),w=a?null:s,m=a?"":l,_=A.useCallback(I=>{h(I??null),y(!1)},[h]),E=A.useCallback(I=>{y(I),I||g(d)},[g,d]);return f.jsx(be,{helpText:w,severity:i,children:f.jsx(Oe,{size:n,severity:i,inputId:e,labelId:t,label:m,image:a?void 0:o.image,children:f.jsxs(v.Popover.Root,{open:x,onOpenChange:E,children:[f.jsx(v.Popover.Trigger,{asChild:!0,children:f.jsxs(v.Button,{id:e,name:p,type:"button",className:"!justify-between",accentColor:"base",variant:"surface",size:"sm",disabled:c,children:[d?d.toLocaleString(void 0,{year:"numeric",month:"2-digit",day:"2-digit"}):"yyyy-mm-dd",f.jsx(v.LuIcon,{icon:Sn})]})}),f.jsx(v.Popover.Content,{align:"start",children:f.jsx(v.DayPicker,{required:!1,mode:"single",variant:"solid",selected:d??void 0,onSelect:_})})]})})})});Pn.displayName="DateInput";const Zt=class Zt extends Pe{constructor(t){super(t);N(this,"type","date");N(this,"onlyValidateAfterTouched",!1)}serialize(){return super.serialize()}getOptions(){return super.getOptions()}duplicate(t){return new Zt({...this.getOptions(),identifier:t})}static deserialize(t){return new Zt(t)}setOptions(t){super.setOptions(t)}serializeValue(t){return t?t.toISOString():null}deserializeValue(t){return t?new Date(t):null}render(t){return f.jsx(Pn,{field:this,...t})}isSerializedValueValid(t){return typeof t!="string"&&t!==null?!1:this.isValueValid(this.deserializeValue(t))}isValueValid(t){return!(!(t instanceof Date)&&t!==null||t instanceof Date&&isNaN(t.getTime()))}blankValue(){return null}blankSerializedValue(){return null}areSerializedValuesEqual(t,n){return t===n}areValuesEqual(t,n){return!t&&!n?!0:!t||!n?!1:t.getTime()===n.getTime()}};N(Zt,"fieldTypeName","Date"),N(Zt,"fieldTypeDescription","Allows specifying a date.");let fr=Zt;const Bn=A.memo(r=>{const[{inputId:e,labelId:t,size:n,severity:i,showInputOnly:a,field:o,helpText:s,label:l,fieldProps:u},{disabled:c}]=Ne(r),{value:d,name:p,onChange:h,onBlur:g}=u,x=a?null:s,y=a?"":l,w=A.useCallback(_=>{h(_),g(_)},[g,h]),m=A.useCallback(_=>{_||g(d)},[d,g]);return f.jsx(be,{helpText:x,severity:i,children:f.jsx(Oe,{size:n,severity:i,inputId:e,labelId:t,label:y,image:a?void 0:o.image,children:f.jsxs(v.Menu.Root,{onOpenChange:m,align:"start",children:[f.jsx(v.Menu.ClickTrigger,{children:f.jsxs(v.Button,{id:e,name:p,className:"!justify-between",variant:"surface",type:"button",size:"sm",accentColor:"base",disabled:c,children:[f.jsx("span",{className:"truncate",children:d&&d.length>0?d.join(", "):o.placeholder??"Select one or more..."}),f.jsx(v.LuIcon,{icon:Sn})]})}),f.jsx(v.Menu.Content,{children:f.jsx(v.Menu.Scroll,{children:f.jsxs(v.Menu.MultiSelectGroup,{values:d,onValuesChange:w,children:[f.jsxs(v.Menu.SelectAllItem,{children:[f.jsx(v.Menu.CheckboxItemIndicator,{children:_=>_?f.jsx(v.LuIcon,{icon:Gr}):f.jsx(v.LuIcon,{icon:qe})}),"Select all"]}),o.options.map((_,E)=>f.jsxs(v.Menu.MultiSelectItem,{value:_.value,children:[f.jsx(v.Menu.SelectedIndicator,{children:f.jsx(v.LuIcon,{icon:qe})}),_.label]},`${e}-${_.value}-${E}`))]})})})]})})})});Bn.displayName="MultiSelectInput";const Kt=class Kt extends dr{constructor(t){const{placeholder:n,...i}=t;super(i);N(this,"type","multi-select");N(this,"placeholder");this.placeholder=n}serialize(){return super.serialize()}getOptions(){return{...super.getOptions(),placeholder:this.placeholder}}duplicate(t){return new Kt({...this.getOptions(),identifier:t})}setOptions(t){const{placeholder:n}=t;this.placeholder=n,super.setOptions(t)}static deserialize(t){return new Kt(t)}serializeValue(t){return t}deserializeValue(t){return t}render(t){return f.jsx(Bn,{field:this,...t})}isSerializedValueValid(t){if(!lr(t))return!1;const n=new Set(this.options.map(({value:i})=>i));return t.every(i=>n.has(i))}isValueValid(t){return this.isSerializedValueValid(t)}blankValue(){return[]}areValuesEqual(t,n){const i=new Set(t),a=new Set(n);return i.size===a.size&&i.isSubsetOf(a)}blankSerializedValue(){return[]}areSerializedValuesEqual(t,n){const i=new Set(t),a=new Set(n);return i.size===a.size&&i.isSubsetOf(a)}};N(Kt,"fieldTypeName","Multi-select"),N(Kt,"fieldTypeDescription","Allows the user to select a multiple options from a list of options.");let it=Kt;const Ln=A.memo(r=>{const[{inputId:e,labelId:t,size:n,severity:i,showInputOnly:a,field:o,helpText:s,label:l,fieldProps:u},{disabled:c}]=Ne(r),{name:d,onChange:p,onBlur:h,value:g}=u,x=a?null:s,y=a?"":l,w=A.useCallback(_=>{p(_??null),h(_??null)},[h,p]),m=A.useMemo(()=>o.options.find(_=>_.value===g),[o.options,g]);return f.jsx(be,{helpText:x,severity:i,children:f.jsx(Oe,{size:n,severity:i,inputId:e,labelId:t,label:y,image:a?void 0:o.image,children:f.jsxs(v.Menu.Root,{align:"start",children:[f.jsx(v.Menu.ClickTrigger,{children:f.jsxs(v.Button,{id:e,name:d,className:"!justify-between",accentColor:"base",variant:"surface",type:"button",size:"sm",disabled:c,children:[f.jsx("span",{className:"truncate",children:m?m.label:o.placeholder??"Select one..."}),f.jsx(v.LuIcon,{icon:Sn})]})}),f.jsx(v.Menu.Content,{children:f.jsx(v.Menu.Scroll,{children:f.jsx(v.Menu.SelectGroup,{required:!1,value:g??void 0,onValueChange:w,children:o.options.map((_,E)=>f.jsxs(v.Menu.SelectItem,{value:_.value,children:[f.jsx(v.Menu.SelectedIndicator,{children:f.jsx(v.LuIcon,{icon:qe})}),_.label]},`${e}-${_.value}-${E}`))})})})]})})})});Ln.displayName="SelectInput";const Qt=class Qt extends dr{constructor(t){const{placeholder:n,...i}=t;super(i);N(this,"type","select");N(this,"placeholder");this.placeholder=n}serialize(){return super.serialize()}getOptions(){return{...super.getOptions(),placeholder:this.placeholder}}duplicate(t){return new Qt({...this.getOptions(),identifier:t})}setOptions(t){const{placeholder:n}=t;this.placeholder=n,super.setOptions(t)}static deserialize(t){return new Qt(t)}serializeValue(t){return t}deserializeValue(t){return t}render(t){return f.jsx(Ln,{field:this,...t})}isSerializedValueValid(t){return typeof t!="string"&&t!==null?!1:new Set([null,...this.options.map(({value:i})=>i)]).has(t)}isValueValid(t){return this.isSerializedValueValid(t)}blankValue(){return null}areValuesEqual(t,n){return t===n}blankSerializedValue(){return null}areSerializedValuesEqual(t,n){return t===n}};N(Qt,"fieldTypeName","Dropdown"),N(Qt,"fieldTypeDescription","Allows the user to select a single option from a list of options.");let pt=Qt;const zn=A.memo(r=>{const[{inputId:e,labelId:t,size:n,severity:i,showInputOnly:a,field:o,helpText:s,label:l,fieldProps:u,touched:c,helpers:d},{formId:p,disabled:h}]=Ne(r),{name:g,onBlur:x,onChange:y,value:w}=u,m=a?null:s,_=a?"":l,[E,I]=A.useState(""),b=A.useMemo(()=>Array.from({length:o.length},()=>H.v4()),[o.length]);A.useEffect(()=>{I(w)},[w]);const D=A.useCallback(V=>{I(V),(c||!o.onlyValidateAfterTouched)&&d.setError(o.getError(V))},[o,d,c]),M=A.useCallback(()=>{y(E),x(E)},[E,x,y]);return f.jsx(be,{helpText:m,severity:i,children:f.jsx(Oe,{size:n,severity:i,inputId:e,labelId:t,label:_,image:a?void 0:o.image,children:f.jsxs(v.OneTimePasswordField.Root,{id:e,name:g,value:E,onValueChange:D,validationType:o.validationType,form:p,disabled:h,orientation:"horizontal",dir:"ltr",type:"text",autoComplete:"off",autoFocus:!1,autoSubmit:!1,className:"flex gap-1 h-max w-full overflow-x-auto p-0.25",accentColor:"base",variant:"surface",size:"sm",onBlur:M,children:[b.map(V=>f.jsx(v.OneTimePasswordField.Input,{id:V},V)),f.jsx(v.OneTimePasswordField.HiddenInput,{})]})})})});zn.displayName="NumberInput";const Jt=class Jt extends Pe{constructor(t){const{length:n,validationType:i,...a}=t;super(a);N(this,"type","otp");N(this,"length");N(this,"validationType");this.length=n,this.validationType=i}static getFieldCreationSchema(t=""){const n=t&&`${t}.`;return[{field:new $e({label:"Length",integers:!0,required:!1,minimum:1,maximum:16,identifier:`${n}length`}),showDirectly:!1},{field:new pt({label:"Type",required:!1,identifier:`${n}validationType`,options:[{value:"none",label:"Any"},{value:"numeric",label:"Numeric"},{value:"alpha",label:"Alpha"},{value:"alphanumeric",label:"Alphanumeric"}]}),showDirectly:!1}]}getFieldValidators(){const t=super.getFieldValidators(),n=this.length;return t.push(i=>{if(!this.isValueBlank(i)&&i.length!=n)return`Must be ${n} characters.`}),t}serialize(){return{...super.serialize(),length:this.length,validationType:this.validationType}}getOptions(){return{...super.getOptions(),length:this.length,validationType:this.validationType}}duplicate(t){return new Jt({...this.getOptions(),identifier:t})}setOptions(t){const{length:n,validationType:i,...a}=t;this.length=n??this.length,this.validationType=i??this.validationType,super.setOptions(a)}static deserialize(t){return new Jt(t)}serializeValue(t){return t}deserializeValue(t){return t}render(t){return f.jsx(zn,{field:this,...t})}isSerializedValueValid(t){return typeof t=="string"}isValueValid(t){return typeof t=="string"}blankValue(){return""}areValuesEqual(t,n){return t===n}blankSerializedValue(){return""}areSerializedValuesEqual(t,n){return t===n}};N(Jt,"fieldTypeName","OTP"),N(Jt,"fieldTypeDescription","Allows specifying a number within a given range.");let Mt=Jt;const vt={pass:{label:"Pass",icon:Ys},fail:{label:"Fail",icon:Qs},na:{label:"N/A",icon:Ks}},Vt=Object.keys(vt);class at extends File{constructor(t,...n){super(...n);N(this,"uuid");this.uuid=t}static from(t,n){return new at(t,[n],n.name,{lastModified:n.lastModified,type:n.type})}}class Ft extends Promise{constructor(t,n){super(t);N(this,"_uuid");this._uuid=n}get uuid(){return this._uuid}set uuid(t){this._uuid=t}static from(t,n){return new Ft((i,a)=>{Promise.resolve(t).then(i).catch(a)},n)}then(t,n){const i=super.then(t,n);return i.uuid=this.uuid,i}catch(t){const n=super.catch(t);return n.uuid=this.uuid,n}finally(t){const n=super.finally(t);return n.uuid=this.uuid,n}}function ca(r){return Array.isArray(r)?r.every(e=>e instanceof Ft||e instanceof at):!1}function $r(r,e){const t=new Set(r.map(({uuid:i})=>i)),n=new Set(e.map(({uuid:i})=>i));return t.size===n.size&&t.isSubsetOf(n)}const da=A.memo(A.forwardRef((r,e)=>{const{file:t,alt:n,error:i,rightSlot:a,className:o,...s}=r;return f.jsxs(v.Card,{className:sr.cx(o,"relative flex h-[200px] w-full flex-col gap-2 overflow-hidden items-center"),ref:e,...s,children:[!t&&!i&&f.jsx("div",{className:"absolute inset-0 grow flex items-center justify-center",children:f.jsx(v.Spinner,{})}),!!t&&!i&&f.jsx(v.Card,{className:"flex max-w-full grow items-center !p-0 justify-center overflow-hidden bg-clip-padding",children:f.jsx("img",{className:"max-w-full object-cover",src:URL.createObjectURL(t),alt:n??t.name})}),(!!t||!!i)&&f.jsxs("div",{className:sr.cx("flex w-full items-center gap-2 self-end",{"bg-transparent":!t}),children:[i?f.jsx(v.LuIcon,{icon:nl}):t&&f.jsx(v.LuIcon,{icon:ia}),f.jsx(v.Text,{className:"truncate",size:"sm",children:i??(t==null?void 0:t.name)}),a]})]})})),Cl=r=>{const e=["byte","kilobyte","megabyte"];let t=r,n=0;for(;t>1e3&&n<e.length-1;)t/=1e3,n++;return new Intl.NumberFormat([],{maximumFractionDigits:Math.max(0,n-1),style:"unit",unit:e[n]}).format(t)},kn=A.memo(r=>{const{file:e,onRemove:t,disabled:n}=r,[i,a]=A.useState(null),[o,s]=A.useState(null),l=Xr(),{url:u,name:c}=A.useMemo(()=>{let x=null,y,w;return i!=null&&i.type.startsWith("image/")&&(x=URL.createObjectURL(i)),i?(y=i.name,w=Cl(i.size)):(y="Downloading...",w="..."),{url:x,name:y,size:w}},[i]);A.useEffect(()=>{e instanceof Ft?e.then(x=>{a(x)}).catch(x=>{s(x instanceof Error?x.message:"Unknown error")}):a(e)},[e]);const d=A.useCallback(x=>{if(x.stopPropagation(),!i)throw new Error("Cannot download a file that is not resolved.");const y=new Blob([i]);Yi.saveAs(y,c)},[c,i]),p=A.useCallback(x=>{x.stopPropagation(),t()},[t]),h=A.useCallback(()=>{i&&l(x=>({file:i,onDelete:n?void 0:()=>{t(),x()}}))},[n,t,l,i]),g=A.useMemo(()=>f.jsxs(v.ButtonGroup,{className:"flex grow justify-end",variant:"ghost",accentColor:"base",size:"sm",children:[f.jsx(v.IconButton,{"aria-label":`Download ${c}`,type:"button",onClick:d,disabled:!i,children:f.jsx(v.LuIcon,{icon:na})}),!n&&f.jsx(v.IconButton,{type:"button","aria-label":`Remove ${c}`,disabled:n,onClick:p,children:f.jsx(v.LuIcon,{icon:ht})})]}),[n,p,d,c,i]);return u?f.jsx(da,{className:"cursor-pointer",onClick:h,file:i,error:o??void 0,rightSlot:g}):f.jsx(On,{file:i,error:o??void 0,rightSlot:g})});kn.displayName="DisplayFile";const Rn=A.memo(r=>{const[{inputId:e,labelId:t,size:n,severity:i,showInputOnly:a,field:o,helpText:s,label:l,fieldProps:u,touched:c,helpers:d},{disabled:p}]=Ne(r),{value:h,onChange:g,onBlur:x,name:y}=u,[w,m]=A.useState(""),_=A.useRef(null),E=a?null:s,I=a?"":l,b=h.status&&o.showNotesAndFilesOn.includes(h.status),D=A.useCallback(q=>{const ae=o.cleanValue({...h,status:q});g(ae),x(ae)},[o,x,g,h]);A.useEffect(()=>{m(h.notes)},[h]);const M=A.useCallback(q=>{const ae=q.target.value;m(ae),(c||!o.onlyValidateAfterTouched)&&d.setError(o.getError({...h,notes:w}))},[o,d,w,c,h]),V=A.useCallback(()=>{const q={...h,notes:w};g(q),x(q)},[w,x,g,h]),L=A.useCallback(q=>{const ae=[...h.files];ae.splice(q,1),g({...h,files:ae})},[g,h]),W=A.useCallback(()=>{var q;(q=_.current)==null||q.click()},[]),k=A.useCallback(q=>{const ae=Array.from(q.target.files??[]).map(Ur=>at.from(H.v4(),Ur)),Fe={...h,files:[...h.files,...ae]};g(Fe),x(Fe)},[x,g,h]);A.useEffect(()=>{if(!_.current)return;const q=new AbortController;return _.current.addEventListener("cancel",()=>{x(h)},{signal:q.signal}),()=>{q.abort()}},[x,h]);const j=`${e}-status`,U=`${e}-notes`,Q=`${e}-files`;return f.jsx(be,{helpText:E,severity:i,children:f.jsx(Oe,{size:n,severity:i,inputId:e,labelId:t,label:I,image:a?void 0:o.image,children:f.jsxs("div",{className:"flex flex-col gap-2",children:[f.jsx(v.RadioGroup.Root,{id:j,className:"flex gap-2",name:y,value:h.status,disabled:p,accentColor:"base",variant:"surface",size:"sm",onValueChange:D,children:Vt.map(q=>{const{label:ae}=vt[q];return f.jsxs("label",{className:"flex gap-2 items-center min-w-0",children:[f.jsx(v.RadioGroup.Item,{value:q,children:f.jsx(v.RadioGroup.Indicator,{children:f.jsx(v.LuIcon,{icon:ea,className:"fill-current"})})}),f.jsx(v.Text,{size:"sm",accentColor:"base",className:"truncate",children:ae})]},`${e}-${q}`)})}),b&&f.jsxs(f.Fragment,{children:[f.jsx("div",{children:f.jsx(v.TextArea,{id:U,value:w,name:y,onChange:M,onBlur:V,className:"field-sizing-content w-full min-h-12",placeholder:"Notes",resize:"vertical",accentColor:"base",variant:"surface",size:"sm",disabled:p})}),f.jsxs("div",{className:"flex flex-col gap-2",children:[f.jsxs(v.Button,{className:"w-max",size:"sm",variant:"soft",accentColor:"base",onClick:W,type:"button",disabled:p,children:[f.jsx(v.LuIcon,{icon:In}),"Select files"]}),f.jsx("input",{id:Q,name:y,type:"file",ref:_,multiple:!0,className:"hidden",onChange:k,value:""}),h.files.length>0&&f.jsx("div",{className:"flex h-max flex-col gap-2",children:h.files.map((q,ae)=>f.jsx(kn,{file:q,onRemove:()=>{L(ae)},disabled:p},ae))})]})]})]})})})});Rn.displayName="PassFailInput";const Un=r=>typeof r=="string"&&Vt.includes(r),fa=r=>!(r===null||typeof r!="object"||!("status"in r)||!Un(r.status)||!("notes"in r)||typeof r.notes!="string"||!("files"in r)||!(Array.isArray(r.files)&&r.files.length===0)),ha=r=>!(r===null||typeof r!="object"||!("status"in r)||!Un(r.status)||!("notes"in r)||typeof r.notes!="string"||!("files"in r)||!ca(r.files)),pa=r=>({status:r.status,notes:r.notes,files:[]}),va=r=>({status:r.status,notes:r.notes,files:[]}),ga=(r,e)=>!(r.status!==e.status||r.notes!==e.notes||!$r(r.files,e.files)),xa=(r,e)=>!(r.status!==e.status||r.notes!==e.notes||r.files.length!==e.files.length),er=class er extends Pe{constructor(t){const{showNotesAndFilesOn:n,...i}=t;super(i);N(this,"type","pass-fail");N(this,"onlyValidateAfterTouched",!1);N(this,"showNotesAndFilesOn");this.showNotesAndFilesOn=n}static getFieldCreationSchema(t=""){const n=t&&`${t}.`;return[{field:new it({identifier:`${n}showNotesAndFilesOn`,label:"Show notes and files on",description:"Show the notes and files on desired statuses.",options:Vt.map(i=>{const{label:a}=vt[i];return{value:i,label:a}}),required:!1}),showDirectly:!1}]}serialize(){return{...super.serialize(),showNotesAndFilesOn:this.showNotesAndFilesOn}}getOptions(){return{...super.getOptions(),showNotesAndFilesOn:this.showNotesAndFilesOn}}duplicate(t){return new er({...this.getOptions(),identifier:t})}setOptions(t){const{showNotesAndFilesOn:n,...i}=t;this.showNotesAndFilesOn=n??this.showNotesAndFilesOn,super.setOptions(i)}getFieldValidators(){const t=super.getFieldValidators(),n=this.showNotesAndFilesOn,i=this.blankValue();return n.length>0&&(t.push(a=>{if(!(!a.status||!n.includes(a.status))&&i.notes===a.notes)return"Notes is required."}),t.push(a=>{if(!(!a.status||!n.includes(a.status))&&$r(i.files,a.files))return"Files is required."})),t}static deserialize(t){return new er({...t,showNotesAndFilesOn:t.showNotesAndFilesOn??!1})}serializeValue(t){return pa(t)}deserializeValue(t){return va(t)}render(t){return f.jsx(Rn,{field:this,...t})}isSerializedValueValid(t){return fa(t)}isValueValid(t){return ha(t)}areValuesEqual(t,n){return ga(t,n)}blankValue(){return{status:null,notes:"",files:[]}}cleanValue(t){return t.status&&this.showNotesAndFilesOn.includes(t.status)?t:{status:t.status,notes:"",files:[]}}cleanSerializedValue(t){return super.cleanSerializedValue(t)}blankSerializedValue(){return{status:null,notes:"",files:[]}}areSerializedValuesEqual(t,n){return xa(t,n)}};N(er,"fieldTypeName","Pass - Fail"),N(er,"fieldTypeDescription","Track pass, fail, or N/A outcome.");let Pt=er;const Hn=A.memo(r=>{const[{inputId:e,labelId:t,size:n,severity:i,showInputOnly:a,field:o,helpText:s,label:l,fieldProps:u},{disabled:c}]=Ne(r),{name:d,onChange:p,onBlur:h,value:g}=u,x=a?null:s,y=a?"":l,w=A.useCallback(_=>{p(_),h(_)},[h,p]),m=A.useCallback(()=>{p(null),h(null)},[h,p]);return f.jsx(be,{helpText:x,severity:i,children:f.jsx(Oe,{size:n,severity:i,inputId:e,labelId:t,label:y,image:a?void 0:o.image,children:f.jsxs(v.RadioGroup.Root,{id:e,name:d,className:"flex flex-col gap-1",accentColor:"base",variant:"surface",size:"sm",value:g??"",onValueChange:w,disabled:c,children:[o.options.map((_,E)=>f.jsxs("label",{className:"flex gap-2 items-center min-w-0",children:[f.jsx(v.RadioGroup.Item,{value:_.value,children:f.jsx(v.RadioGroup.Indicator,{children:f.jsx(v.LuIcon,{icon:ea,className:"fill-current"})})}),f.jsx(v.Text,{size:"sm",accentColor:"base",className:"truncate",children:_.label})]},`${e}-${_.value}-${E}`)),!!g&&f.jsxs(v.Button,{onClick:m,className:"w-max -mx-2",type:"button",variant:"ghost",accentColor:"base",size:"sm",children:[f.jsx(v.LuIcon,{icon:nt}),"Clear"]})]})})})});Hn.displayName="SelectInput";const tr=class tr extends dr{constructor(t){super(t);N(this,"type","radio");N(this,"onlyValidateAfterTouched",!1)}serialize(){return super.serialize()}getOptions(){return super.getOptions()}duplicate(t){return new tr({...this.getOptions(),identifier:t})}setOptions(t){super.setOptions(t)}static deserialize(t){return new tr(t)}serializeValue(t){return t}deserializeValue(t){return t}render(t){return f.jsx(Hn,{field:this,...t})}isSerializedValueValid(t){return typeof t!="string"&&t!==null?!1:new Set([null,...this.options.map(({value:i})=>i)]).has(t)}isValueValid(t){return this.isSerializedValueValid(t)}blankValue(){return null}areValuesEqual(t,n){return t===n}blankSerializedValue(){return null}areSerializedValuesEqual(t,n){return t===n}};N(tr,"fieldTypeName","Option list"),N(tr,"fieldTypeDescription","Allows the user to select a single option from a list of options.");let Bt=tr;const Gn=A.memo(r=>{const[{inputId:e,labelId:t,size:n,severity:i,showInputOnly:a,field:o,helpText:s,label:l,fieldProps:u},{disabled:c}]=Ne(r),{name:d,onChange:p,onBlur:h,value:g}=u,x=a?null:s,y=a?"":l,w=A.useCallback(E=>{p(E),h(E)},[h,p]),m=A.useCallback(()=>{p(null),h(null)},[h,p]),_=Array.from({length:o.maxRating},(E,I)=>I+1);return f.jsx(be,{helpText:x,severity:i,children:f.jsx(Oe,{size:n,severity:i,inputId:e,labelId:t,label:y,image:a?void 0:o.image,children:f.jsxs("div",{className:"flex flex-row gap-1 items-center",children:[f.jsx(v.Rating.Root,{id:e,name:d,className:"flex items-center gap-0.5",value:g,onValueChange:w,disabled:c,children:_.map(E=>f.jsx(v.Rating.Item,{value:E,className:"group size-7 flex cursor-pointer disabled:opacity-50 disabled:pointer-events-none items-center justify-center text-yellow-500 transition-colors",children:f.jsx(v.LuIcon,{icon:sa,className:"group-data-[active=true]:fill-current size-full"})},`${e}-${E}`))}),!c&&g!==null&&f.jsx(v.IconButton,{onClick:m,type:"button",variant:"ghost",accentColor:"base",size:"sm",children:f.jsx(v.LuIcon,{icon:nt})})]})})})});Gn.displayName="RatingInput";const rr=class rr extends Pe{constructor(t){const{maxRating:n,...i}=t;super(i);N(this,"type","rating");N(this,"maxRating");this.maxRating=n}static getFieldCreationSchema(t=""){const n=t&&`${t}.`;return[{field:new $e({label:"Max Rating",description:"Maximum rating value",integers:!0,required:!1,minimum:1,maximum:10,identifier:`${n}maxRating`}),showDirectly:!1}]}getFieldValidators(){const t=super.getFieldValidators(),n=this.maxRating;return t.push(i=>{if(typeof i=="number"&&(i<1||i>n))return`Rating must be between 1 and ${n}.`}),t}serialize(){return{...super.serialize(),maxRating:this.maxRating}}getOptions(){return{...super.getOptions(),maxRating:this.maxRating}}duplicate(t){return new rr({...this.getOptions(),identifier:t})}setOptions(t){const{maxRating:n,...i}=t;this.maxRating=n??this.maxRating,super.setOptions(i)}static deserialize(t){return new rr(t)}serializeValue(t){return t}deserializeValue(t){return t}render(t){return f.jsx(Gn,{field:this,...t})}isSerializedValueValid(t){return typeof t=="number"||t===null}isValueValid(t){return typeof t=="number"||t===null}areValuesEqual(t,n){return t===n}blankValue(){return null}blankSerializedValue(){return null}areSerializedValuesEqual(t,n){return t===n}};N(rr,"fieldTypeName","Rating"),N(rr,"fieldTypeDescription","Allows users to select a rating value.");let Lt=rr;const ya=A.createContext(()=>{throw new Error("No ScannerProvider found")}),wl=()=>A.use(ya);function ml(r,e){var t=Object.setPrototypeOf;t?t(r,e):r.__proto__=e}function _l(r,e){e===void 0&&(e=r.constructor);var t=Error.captureStackTrace;t&&t(r,e)}var Al=function(){var r=function(t,n){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,a){i.__proto__=a}||function(i,a){for(var o in a)Object.prototype.hasOwnProperty.call(a,o)&&(i[o]=a[o])},r(t,n)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),El=function(r){Al(e,r);function e(t,n){var i=this.constructor,a=r.call(this,t,n)||this;return Object.defineProperty(a,"name",{value:i.name,enumerable:!1,configurable:!0}),ml(a,i.prototype),_l(a),a}return e}(Error),Sl=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),Ue=function(r){Sl(e,r);function e(t){t===void 0&&(t=void 0);var n=r.call(this,t)||this;return n.message=t,n}return e.prototype.getKind=function(){var t=this.constructor;return t.kind},e.kind="Exception",e}(El),Il=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),Ke=function(r){Il(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.kind="ArgumentException",e}(Ue),Ol=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),R=function(r){Ol(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.kind="IllegalArgumentException",e}(Ue),bl=function(){function r(e){if(this.binarizer=e,e===null)throw new R("Binarizer must be non-null.")}return r.prototype.getWidth=function(){return this.binarizer.getWidth()},r.prototype.getHeight=function(){return this.binarizer.getHeight()},r.prototype.getBlackRow=function(e,t){return this.binarizer.getBlackRow(e,t)},r.prototype.getBlackMatrix=function(){return(this.matrix===null||this.matrix===void 0)&&(this.matrix=this.binarizer.getBlackMatrix()),this.matrix},r.prototype.isCropSupported=function(){return this.binarizer.getLuminanceSource().isCropSupported()},r.prototype.crop=function(e,t,n,i){var a=this.binarizer.getLuminanceSource().crop(e,t,n,i);return new r(this.binarizer.createBinarizer(a))},r.prototype.isRotateSupported=function(){return this.binarizer.getLuminanceSource().isRotateSupported()},r.prototype.rotateCounterClockwise=function(){var e=this.binarizer.getLuminanceSource().rotateCounterClockwise();return new r(this.binarizer.createBinarizer(e))},r.prototype.rotateCounterClockwise45=function(){var e=this.binarizer.getLuminanceSource().rotateCounterClockwise45();return new r(this.binarizer.createBinarizer(e))},r.prototype.toString=function(){try{return this.getBlackMatrix().toString()}catch{return""}},r}(),Nl=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),Ce=function(r){Nl(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.getChecksumInstance=function(){return new e},e.kind="ChecksumException",e}(Ue),Tl=function(){function r(e){this.source=e}return r.prototype.getLuminanceSource=function(){return this.source},r.prototype.getWidth=function(){return this.source.getWidth()},r.prototype.getHeight=function(){return this.source.getHeight()},r}(),se=function(){function r(){}return r.arraycopy=function(e,t,n,i,a){for(;a--;)n[i++]=e[t++]},r.currentTimeMillis=function(){return Date.now()},r}(),Dl=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),qn=function(r){Dl(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.kind="IndexOutOfBoundsException",e}(Ue),Ml=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),Ca=function(r){Ml(e,r);function e(t,n){t===void 0&&(t=void 0),n===void 0&&(n=void 0);var i=r.call(this,n)||this;return i.index=t,i.message=n,i}return e.kind="ArrayIndexOutOfBoundsException",e}(qn),Vl=function(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},he=function(){function r(){}return r.fill=function(e,t){for(var n=0,i=e.length;n<i;n++)e[n]=t},r.fillWithin=function(e,t,n,i){r.rangeCheck(e.length,t,n);for(var a=t;a<n;a++)e[a]=i},r.rangeCheck=function(e,t,n){if(t>n)throw new R("fromIndex("+t+") > toIndex("+n+")");if(t<0)throw new Ca(t);if(n>e)throw new Ca(n)},r.asList=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return e},r.create=function(e,t,n){var i=Array.from({length:e});return i.map(function(a){return Array.from({length:t}).fill(n)})},r.createInt32Array=function(e,t,n){var i=Array.from({length:e});return i.map(function(a){return Int32Array.from({length:t}).fill(n)})},r.equals=function(e,t){if(!e||!t||!e.length||!t.length||e.length!==t.length)return!1;for(var n=0,i=e.length;n<i;n++)if(e[n]!==t[n])return!1;return!0},r.hashCode=function(e){var t,n;if(e===null)return 0;var i=1;try{for(var a=Vl(e),o=a.next();!o.done;o=a.next()){var s=o.value;i=31*i+s}}catch(l){t={error:l}}finally{try{o&&!o.done&&(n=a.return)&&n.call(a)}finally{if(t)throw t.error}}return i},r.fillUint8Array=function(e,t){for(var n=0;n!==e.length;n++)e[n]=t},r.copyOf=function(e,t){return e.slice(0,t)},r.copyOfUint8Array=function(e,t){if(e.length<=t){var n=new Uint8Array(t);return n.set(e),n}return e.slice(0,t)},r.copyOfRange=function(e,t,n){var i=n-t,a=new Int32Array(i);return se.arraycopy(e,t,a,0,i),a},r.binarySearch=function(e,t,n){n===void 0&&(n=r.numberComparator);for(var i=0,a=e.length-1;i<=a;){var o=a+i>>1,s=n(t,e[o]);if(s>0)i=o+1;else if(s<0)a=o-1;else return o}return-i-1},r.numberComparator=function(e,t){return e-t},r}(),$=function(){function r(){}return r.numberOfTrailingZeros=function(e){var t;if(e===0)return 32;var n=31;return t=e<<16,t!==0&&(n-=16,e=t),t=e<<8,t!==0&&(n-=8,e=t),t=e<<4,t!==0&&(n-=4,e=t),t=e<<2,t!==0&&(n-=2,e=t),n-(e<<1>>>31)},r.numberOfLeadingZeros=function(e){if(e===0)return 32;var t=1;return e>>>16||(t+=16,e<<=16),e>>>24||(t+=8,e<<=8),e>>>28||(t+=4,e<<=4),e>>>30||(t+=2,e<<=2),t-=e>>>31,t},r.toHexString=function(e){return e.toString(16)},r.toBinaryString=function(e){return String(parseInt(String(e),2))},r.bitCount=function(e){return e=e-(e>>>1&1431655765),e=(e&858993459)+(e>>>2&858993459),e=e+(e>>>4)&252645135,e=e+(e>>>8),e=e+(e>>>16),e&63},r.truncDivision=function(e,t){return Math.trunc(e/t)},r.parseInt=function(e,t){return t===void 0&&(t=void 0),parseInt(e,t)},r.MIN_VALUE_32_BITS=-2147483648,r.MAX_VALUE=Number.MAX_SAFE_INTEGER,r}(),we=function(){function r(e,t){e===void 0?(this.size=0,this.bits=new Int32Array(1)):(this.size=e,t==null?this.bits=r.makeArray(e):this.bits=t)}return r.prototype.getSize=function(){return this.size},r.prototype.getSizeInBytes=function(){return Math.floor((this.size+7)/8)},r.prototype.ensureCapacity=function(e){if(e>this.bits.length*32){var t=r.makeArray(e);se.arraycopy(this.bits,0,t,0,this.bits.length),this.bits=t}},r.prototype.get=function(e){return(this.bits[Math.floor(e/32)]&1<<(e&31))!==0},r.prototype.set=function(e){this.bits[Math.floor(e/32)]|=1<<(e&31)},r.prototype.flip=function(e){this.bits[Math.floor(e/32)]^=1<<(e&31)},r.prototype.getNextSet=function(e){var t=this.size;if(e>=t)return t;var n=this.bits,i=Math.floor(e/32),a=n[i];a&=~((1<<(e&31))-1);for(var o=n.length;a===0;){if(++i===o)return t;a=n[i]}var s=i*32+$.numberOfTrailingZeros(a);return s>t?t:s},r.prototype.getNextUnset=function(e){var t=this.size;if(e>=t)return t;var n=this.bits,i=Math.floor(e/32),a=~n[i];a&=~((1<<(e&31))-1);for(var o=n.length;a===0;){if(++i===o)return t;a=~n[i]}var s=i*32+$.numberOfTrailingZeros(a);return s>t?t:s},r.prototype.setBulk=function(e,t){this.bits[Math.floor(e/32)]=t},r.prototype.setRange=function(e,t){if(t<e||e<0||t>this.size)throw new R;if(t!==e){t--;for(var n=Math.floor(e/32),i=Math.floor(t/32),a=this.bits,o=n;o<=i;o++){var s=o>n?0:e&31,l=o<i?31:t&31,u=(2<<l)-(1<<s);a[o]|=u}}},r.prototype.clear=function(){for(var e=this.bits.length,t=this.bits,n=0;n<e;n++)t[n]=0},r.prototype.isRange=function(e,t,n){if(t<e||e<0||t>this.size)throw new R;if(t===e)return!0;t--;for(var i=Math.floor(e/32),a=Math.floor(t/32),o=this.bits,s=i;s<=a;s++){var l=s>i?0:e&31,u=s<a?31:t&31,c=(2<<u)-(1<<l)&4294967295;if((o[s]&c)!==(n?c:0))return!1}return!0},r.prototype.appendBit=function(e){this.ensureCapacity(this.size+1),e&&(this.bits[Math.floor(this.size/32)]|=1<<(this.size&31)),this.size++},r.prototype.appendBits=function(e,t){if(t<0||t>32)throw new R("Num bits must be between 0 and 32");this.ensureCapacity(this.size+t);for(var n=t;n>0;n--)this.appendBit((e>>n-1&1)===1)},r.prototype.appendBitArray=function(e){var t=e.size;this.ensureCapacity(this.size+t);for(var n=0;n<t;n++)this.appendBit(e.get(n))},r.prototype.xor=function(e){if(this.size!==e.size)throw new R("Sizes don't match");for(var t=this.bits,n=0,i=t.length;n<i;n++)t[n]^=e.bits[n]},r.prototype.toBytes=function(e,t,n,i){for(var a=0;a<i;a++){for(var o=0,s=0;s<8;s++)this.get(e)&&(o|=1<<7-s),e++;t[n+a]=o}},r.prototype.getBitArray=function(){return this.bits},r.prototype.reverse=function(){for(var e=new Int32Array(this.bits.length),t=Math.floor((this.size-1)/32),n=t+1,i=this.bits,a=0;a<n;a++){var o=i[a];o=o>>1&1431655765|(o&1431655765)<<1,o=o>>2&858993459|(o&858993459)<<2,o=o>>4&252645135|(o&252645135)<<4,o=o>>8&16711935|(o&16711935)<<8,o=o>>16&65535|(o&65535)<<16,e[t-a]=o}if(this.size!==n*32){for(var s=n*32-this.size,l=e[0]>>>s,a=1;a<n;a++){var u=e[a];l|=u<<32-s,e[a-1]=l,l=u>>>s}e[n-1]=l}this.bits=e},r.makeArray=function(e){return new Int32Array(Math.floor((e+31)/32))},r.prototype.equals=function(e){if(!(e instanceof r))return!1;var t=e;return this.size===t.size&&he.equals(this.bits,t.bits)},r.prototype.hashCode=function(){return 31*this.size+he.hashCode(this.bits)},r.prototype.toString=function(){for(var e="",t=0,n=this.size;t<n;t++)(t&7)===0&&(e+=" "),e+=this.get(t)?"X":".";return e},r.prototype.clone=function(){return new r(this.size,this.bits.slice())},r.prototype.toArray=function(){for(var e=[],t=0,n=this.size;t<n;t++)e.push(this.get(t));return e},r}(),Xn;(function(r){r[r.OTHER=0]="OTHER",r[r.PURE_BARCODE=1]="PURE_BARCODE",r[r.POSSIBLE_FORMATS=2]="POSSIBLE_FORMATS",r[r.TRY_HARDER=3]="TRY_HARDER",r[r.CHARACTER_SET=4]="CHARACTER_SET",r[r.ALLOWED_LENGTHS=5]="ALLOWED_LENGTHS",r[r.ASSUME_CODE_39_CHECK_DIGIT=6]="ASSUME_CODE_39_CHECK_DIGIT",r[r.ASSUME_GS1=7]="ASSUME_GS1",r[r.RETURN_CODABAR_START_END=8]="RETURN_CODABAR_START_END",r[r.NEED_RESULT_POINT_CALLBACK=9]="NEED_RESULT_POINT_CALLBACK",r[r.ALLOWED_EAN_EXTENSIONS=10]="ALLOWED_EAN_EXTENSIONS"})(Xn||(Xn={}));const ce=Xn;var Fl=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),F=function(r){Fl(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.getFormatInstance=function(){return new e},e.kind="FormatException",e}(Ue),Pl=function(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},ne;(function(r){r[r.Cp437=0]="Cp437",r[r.ISO8859_1=1]="ISO8859_1",r[r.ISO8859_2=2]="ISO8859_2",r[r.ISO8859_3=3]="ISO8859_3",r[r.ISO8859_4=4]="ISO8859_4",r[r.ISO8859_5=5]="ISO8859_5",r[r.ISO8859_6=6]="ISO8859_6",r[r.ISO8859_7=7]="ISO8859_7",r[r.ISO8859_8=8]="ISO8859_8",r[r.ISO8859_9=9]="ISO8859_9",r[r.ISO8859_10=10]="ISO8859_10",r[r.ISO8859_11=11]="ISO8859_11",r[r.ISO8859_13=12]="ISO8859_13",r[r.ISO8859_14=13]="ISO8859_14",r[r.ISO8859_15=14]="ISO8859_15",r[r.ISO8859_16=15]="ISO8859_16",r[r.SJIS=16]="SJIS",r[r.Cp1250=17]="Cp1250",r[r.Cp1251=18]="Cp1251",r[r.Cp1252=19]="Cp1252",r[r.Cp1256=20]="Cp1256",r[r.UnicodeBigUnmarked=21]="UnicodeBigUnmarked",r[r.UTF8=22]="UTF8",r[r.ASCII=23]="ASCII",r[r.Big5=24]="Big5",r[r.GB18030=25]="GB18030",r[r.EUC_KR=26]="EUC_KR"})(ne||(ne={}));var pe=function(){function r(e,t,n){for(var i,a,o=[],s=3;s<arguments.length;s++)o[s-3]=arguments[s];this.valueIdentifier=e,this.name=n,typeof t=="number"?this.values=Int32Array.from([t]):this.values=t,this.otherEncodingNames=o,r.VALUE_IDENTIFIER_TO_ECI.set(e,this),r.NAME_TO_ECI.set(n,this);for(var l=this.values,u=0,c=l.length;u!==c;u++){var d=l[u];r.VALUES_TO_ECI.set(d,this)}try{for(var p=Pl(o),h=p.next();!h.done;h=p.next()){var g=h.value;r.NAME_TO_ECI.set(g,this)}}catch(x){i={error:x}}finally{try{h&&!h.done&&(a=p.return)&&a.call(p)}finally{if(i)throw i.error}}}return r.prototype.getValueIdentifier=function(){return this.valueIdentifier},r.prototype.getName=function(){return this.name},r.prototype.getValue=function(){return this.values[0]},r.getCharacterSetECIByValue=function(e){if(e<0||e>=900)throw new F("incorect value");var t=r.VALUES_TO_ECI.get(e);if(t===void 0)throw new F("incorect value");return t},r.getCharacterSetECIByName=function(e){var t=r.NAME_TO_ECI.get(e);if(t===void 0)throw new F("incorect value");return t},r.prototype.equals=function(e){if(!(e instanceof r))return!1;var t=e;return this.getName()===t.getName()},r.VALUE_IDENTIFIER_TO_ECI=new Map,r.VALUES_TO_ECI=new Map,r.NAME_TO_ECI=new Map,r.Cp437=new r(ne.Cp437,Int32Array.from([0,2]),"Cp437"),r.ISO8859_1=new r(ne.ISO8859_1,Int32Array.from([1,3]),"ISO-8859-1","ISO88591","ISO8859_1"),r.ISO8859_2=new r(ne.ISO8859_2,4,"ISO-8859-2","ISO88592","ISO8859_2"),r.ISO8859_3=new r(ne.ISO8859_3,5,"ISO-8859-3","ISO88593","ISO8859_3"),r.ISO8859_4=new r(ne.ISO8859_4,6,"ISO-8859-4","ISO88594","ISO8859_4"),r.ISO8859_5=new r(ne.ISO8859_5,7,"ISO-8859-5","ISO88595","ISO8859_5"),r.ISO8859_6=new r(ne.ISO8859_6,8,"ISO-8859-6","ISO88596","ISO8859_6"),r.ISO8859_7=new r(ne.ISO8859_7,9,"ISO-8859-7","ISO88597","ISO8859_7"),r.ISO8859_8=new r(ne.ISO8859_8,10,"ISO-8859-8","ISO88598","ISO8859_8"),r.ISO8859_9=new r(ne.ISO8859_9,11,"ISO-8859-9","ISO88599","ISO8859_9"),r.ISO8859_10=new r(ne.ISO8859_10,12,"ISO-8859-10","ISO885910","ISO8859_10"),r.ISO8859_11=new r(ne.ISO8859_11,13,"ISO-8859-11","ISO885911","ISO8859_11"),r.ISO8859_13=new r(ne.ISO8859_13,15,"ISO-8859-13","ISO885913","ISO8859_13"),r.ISO8859_14=new r(ne.ISO8859_14,16,"ISO-8859-14","ISO885914","ISO8859_14"),r.ISO8859_15=new r(ne.ISO8859_15,17,"ISO-8859-15","ISO885915","ISO8859_15"),r.ISO8859_16=new r(ne.ISO8859_16,18,"ISO-8859-16","ISO885916","ISO8859_16"),r.SJIS=new r(ne.SJIS,20,"SJIS","Shift_JIS"),r.Cp1250=new r(ne.Cp1250,21,"Cp1250","windows-1250"),r.Cp1251=new r(ne.Cp1251,22,"Cp1251","windows-1251"),r.Cp1252=new r(ne.Cp1252,23,"Cp1252","windows-1252"),r.Cp1256=new r(ne.Cp1256,24,"Cp1256","windows-1256"),r.UnicodeBigUnmarked=new r(ne.UnicodeBigUnmarked,25,"UnicodeBigUnmarked","UTF-16BE","UnicodeBig"),r.UTF8=new r(ne.UTF8,26,"UTF8","UTF-8"),r.ASCII=new r(ne.ASCII,Int32Array.from([27,170]),"ASCII","US-ASCII"),r.Big5=new r(ne.Big5,28,"Big5"),r.GB18030=new r(ne.GB18030,29,"GB18030","GB2312","EUC_CN","GBK"),r.EUC_KR=new r(ne.EUC_KR,30,"EUC_KR","EUC-KR"),r}(),Bl=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),Wr=function(r){Bl(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.kind="UnsupportedOperationException",e}(Ue),We=function(){function r(){}return r.decode=function(e,t){var n=this.encodingName(t);return this.customDecoder?this.customDecoder(e,n):typeof TextDecoder>"u"||this.shouldDecodeOnFallback(n)?this.decodeFallback(e,n):new TextDecoder(n).decode(e)},r.shouldDecodeOnFallback=function(e){return!r.isBrowser()&&e==="ISO-8859-1"},r.encode=function(e,t){var n=this.encodingName(t);return this.customEncoder?this.customEncoder(e,n):typeof TextEncoder>"u"?this.encodeFallback(e):new TextEncoder().encode(e)},r.isBrowser=function(){return typeof window<"u"&&{}.toString.call(window)==="[object Window]"},r.encodingName=function(e){return typeof e=="string"?e:e.getName()},r.encodingCharacterSet=function(e){return e instanceof pe?e:pe.getCharacterSetECIByName(e)},r.decodeFallback=function(e,t){var n=this.encodingCharacterSet(t);if(r.isDecodeFallbackSupported(n)){for(var i="",a=0,o=e.length;a<o;a++){var s=e[a].toString(16);s.length<2&&(s="0"+s),i+="%"+s}return decodeURIComponent(i)}if(n.equals(pe.UnicodeBigUnmarked))return String.fromCharCode.apply(null,new Uint16Array(e.buffer));throw new Wr("Encoding "+this.encodingName(t)+" not supported by fallback.")},r.isDecodeFallbackSupported=function(e){return e.equals(pe.UTF8)||e.equals(pe.ISO8859_1)||e.equals(pe.ASCII)},r.encodeFallback=function(e){for(var t=btoa(unescape(encodeURIComponent(e))),n=t.split(""),i=[],a=0;a<n.length;a++)i.push(n[a].charCodeAt(0));return new Uint8Array(i)},r}(),Z=function(){function r(){}return r.castAsNonUtf8Char=function(e,t){t===void 0&&(t=null);var n=t?t.getName():this.ISO88591;return We.decode(new Uint8Array([e]),n)},r.guessEncoding=function(e,t){if(t!=null&&t.get(ce.CHARACTER_SET)!==void 0)return t.get(ce.CHARACTER_SET).toString();for(var n=e.length,i=!0,a=!0,o=!0,s=0,l=0,u=0,c=0,d=0,p=0,h=0,g=0,x=0,y=0,w=0,m=e.length>3&&e[0]===239&&e[1]===187&&e[2]===191,_=0;_<n&&(i||a||o);_++){var E=e[_]&255;o&&(s>0?(E&128)===0?o=!1:s--:(E&128)!==0&&((E&64)===0?o=!1:(s++,(E&32)===0?l++:(s++,(E&16)===0?u++:(s++,(E&8)===0?c++:o=!1))))),i&&(E>127&&E<160?i=!1:E>159&&(E<192||E===215||E===247)&&w++),a&&(d>0?E<64||E===127||E>252?a=!1:d--:E===128||E===160||E>239?a=!1:E>160&&E<224?(p++,g=0,h++,h>x&&(x=h)):E>127?(d++,h=0,g++,g>y&&(y=g)):(h=0,g=0))}return o&&s>0&&(o=!1),a&&d>0&&(a=!1),o&&(m||l+u+c>0)?r.UTF8:a&&(r.ASSUME_SHIFT_JIS||x>=3||y>=3)?r.SHIFT_JIS:i&&a?x===2&&p===2||w*10>=n?r.SHIFT_JIS:r.ISO88591:i?r.ISO88591:a?r.SHIFT_JIS:o?r.UTF8:r.PLATFORM_DEFAULT_ENCODING},r.format=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];var i=-1;function a(s,l,u,c,d,p){if(s==="%%")return"%";if(t[++i]!==void 0){s=c?parseInt(c.substr(1)):void 0;var h=d?parseInt(d.substr(1)):void 0,g;switch(p){case"s":g=t[i];break;case"c":g=t[i][0];break;case"f":g=parseFloat(t[i]).toFixed(s);break;case"p":g=parseFloat(t[i]).toPrecision(s);break;case"e":g=parseFloat(t[i]).toExponential(s);break;case"x":g=parseInt(t[i]).toString(h||16);break;case"d":g=parseFloat(parseInt(t[i],h||10).toPrecision(s)).toFixed(0);break}g=typeof g=="object"?JSON.stringify(g):(+g).toString(h);for(var x=parseInt(u),y=u&&u[0]+""=="0"?"0":" ";g.length<x;)g=l!==void 0?g+y:y+g;return g}}var o=/%(-)?(0?[0-9]+)?([.][0-9]+)?([#][0-9]+)?([scfpexd%])/g;return e.replace(o,a)},r.getBytes=function(e,t){return We.encode(e,t)},r.getCharCode=function(e,t){return t===void 0&&(t=0),e.charCodeAt(t)},r.getCharAt=function(e){return String.fromCharCode(e)},r.SHIFT_JIS=pe.SJIS.getName(),r.GB2312="GB2312",r.ISO88591=pe.ISO8859_1.getName(),r.EUC_JP="EUC_JP",r.UTF8=pe.UTF8.getName(),r.PLATFORM_DEFAULT_ENCODING=r.UTF8,r.ASSUME_SHIFT_JIS=!1,r}(),X=function(){function r(e){e===void 0&&(e=""),this.value=e}return r.prototype.enableDecoding=function(e){return this.encoding=e,this},r.prototype.append=function(e){return typeof e=="string"?this.value+=e.toString():this.encoding?this.value+=Z.castAsNonUtf8Char(e,this.encoding):this.value+=String.fromCharCode(e),this},r.prototype.appendChars=function(e,t,n){for(var i=t;t<t+n;i++)this.append(e[i]);return this},r.prototype.length=function(){return this.value.length},r.prototype.charAt=function(e){return this.value.charAt(e)},r.prototype.deleteCharAt=function(e){this.value=this.value.substr(0,e)+this.value.substring(e+1)},r.prototype.setCharAt=function(e,t){this.value=this.value.substr(0,e)+t+this.value.substr(e+1)},r.prototype.substring=function(e,t){return this.value.substring(e,t)},r.prototype.setLengthToZero=function(){this.value=""},r.prototype.toString=function(){return this.value},r.prototype.insert=function(e,t){this.value=this.value.substring(0,e)+t+this.value.substring(e)},r}(),tt=function(){function r(e,t,n,i){if(this.width=e,this.height=t,this.rowSize=n,this.bits=i,t==null&&(t=e),this.height=t,e<1||t<1)throw new R("Both dimensions must be greater than 0");n==null&&(n=Math.floor((e+31)/32)),this.rowSize=n,i==null&&(this.bits=new Int32Array(this.rowSize*this.height))}return r.parseFromBooleanArray=function(e){for(var t=e.length,n=e[0].length,i=new r(n,t),a=0;a<t;a++)for(var o=e[a],s=0;s<n;s++)o[s]&&i.set(s,a);return i},r.parseFromString=function(e,t,n){if(e===null)throw new R("stringRepresentation cannot be null");for(var i=new Array(e.length),a=0,o=0,s=-1,l=0,u=0;u<e.length;)if(e.charAt(u)===`
236
+ */const nt=G("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),On=A.memo(A.forwardRef((r,e)=>{const{file:t,className:n,error:i,rightSlot:a,...o}=r;return f.jsxs(v.Card,{className:sr.cx(n,"flex w-full items-center gap-2 text-sm"),ref:e,...o,children:[i?f.jsx(v.LuIcon,{icon:rl}):f.jsx(v.LuIcon,{icon:ia,color:"var(--base-a11)"}),i?f.jsx(v.Text,{accentColor:"danger",className:"truncate",children:i}):t?f.jsx(v.Text,{className:"truncate",children:t.name}):f.jsx("div",{className:"flex w-full justify-center",children:f.jsx(v.Spinner,{})}),a]})}));On.displayName="FileCard";const Ot={danger:"danger",warning:"warning",info:"base",success:"success"};function lr(r){return Array.isArray(r)?r.every(e=>typeof e=="string"):!1}class ur{constructor(){N(this,"observers",new Set)}notify(e){for(const t of this.observers)t(e)}observe(e){return this.observers.add(e),()=>{this.observers.delete(e)}}}class bn extends ur{constructor(t){const{identifier:n}=t;super();N(this,"identifier");this.identifier=n}getOptions(){return{identifier:this.identifier}}setOptions(t){this.identifier=t.identifier??this.identifier,this.notify(this)}serialize(){return{type:this.type,identifier:this.identifier}}}class Pe extends bn{constructor(t){const{label:n,description:i=null,required:a,image:o,...s}=t;super(s);N(this,"label");N(this,"description");N(this,"required");N(this,"image");N(this,"onlyValidateAfterTouched",!0);this.label=n,this.description=i,this.required=a,this.image=o}getError(t){if(this.required&&this.isValueBlank(t))return"This field is required.";for(const n of this.getFieldValidators()){const i=n(t);if(i)return i}}serialize(){return{...super.serialize(),label:this.label,description:this.description,required:this.required,image:this.image}}getOptions(){return{...super.getOptions(),label:this.label,description:this.description,required:this.required,image:this.image}}setOptions(t){const{label:n,description:i=null,required:a,image:o,...s}=t;this.label=n??this.label,this.description=i??this.description,this.required=a??this.required,this.image=o??this.image,super.setOptions(s)}isValueBlank(t){return this.areValuesEqual(t,this.blankValue())}cleanValue(t){return t}isValueClean(t){return this.areValuesEqual(t,this.cleanValue(t))}cleanSerializedValue(t){return t}isSerializedValueClean(t){return this.areSerializedValuesEqual(t,this.cleanSerializedValue(t))}isSerializedValueBlank(t){return this.areSerializedValuesEqual(t,this.blankSerializedValue())}getFieldValidators(){return[]}}N(Pe,"fieldTypeName"),N(Pe,"fieldTypeDescription");const qr=r=>{const{helpText:e,children:t,severity:n}=r,i=n?Ot[n]:"base";return f.jsxs("div",{className:"flex flex-col gap-1",children:[t,!!e&&f.jsx(v.Text,{accentColor:i,size:"xs",children:e})]})},la=A.createContext(()=>{throw new Error("No ImageViewerProvider found")}),Xr=()=>A.useContext(la),Nn=A.memo(r=>{const{file:e,onClose:t}=r,n=A.useRef(null),i=A.useCallback(()=>{var s;if(!n.current)return;const o=document.createElement("canvas");o.width=n.current.width,o.height=n.current.height,(s=o.getContext("2d"))==null||s.drawImage(n.current,0,0,n.current.width,n.current.height),o.toBlob(l=>{l&&navigator.clipboard.write([new ClipboardItem({"image/png":l})])},"image/png")},[]),a=A.useCallback(()=>{Yi.saveAs(e,e.name)},[e]);return f.jsx(v.Overlay.Root,{open:!0,onOpenChange:t,children:f.jsxs(v.Overlay.Content,{onOpenAutoFocus:o=>o.preventDefault(),children:[f.jsxs(v.ButtonGroup,{className:"flex gap-2 items-center top-0 absolute right-0 p-2",accentColor:"base",variant:"ghost",children:[f.jsxs(v.Tooltip.Root,{children:[f.jsx(v.Tooltip.Trigger,{asChild:!0,children:f.jsx(v.IconButton,{onClick:i,"aria-label":"copy to clipboard",children:f.jsx(v.LuIcon,{icon:Hr})})}),f.jsx(v.Tooltip.Content,{size:"sm",children:"Copy"})]}),f.jsxs(v.Tooltip.Root,{children:[f.jsx(v.Tooltip.Trigger,{asChild:!0,children:f.jsx(v.IconButton,{onClick:a,"aria-label":"download",children:f.jsx(v.LuIcon,{icon:na})})}),f.jsx(v.Tooltip.Content,{size:"sm",children:"Download"})]}),f.jsx(v.Separator,{orientation:"vertical",size:"sm"}),f.jsx(v.Overlay.Close,{asChild:!0,children:f.jsx(v.IconButton,{onClick:t,"aria-label":"close",children:f.jsx(v.LuIcon,{icon:nt})})})]}),f.jsx("figure",{className:"size-full overflow-hidden p-4 flex justify-center items-center",children:f.jsx("img",{ref:n,className:"max-w-full max-h-full",src:URL.createObjectURL(e),alt:e.name})})]})})});Nn.displayName="ImageViewer";const ua=A.memo(r=>{const{children:e}=r,[t,n]=A.useState(null),i=A.useCallback(()=>{n(null)},[]),a=A.useCallback(s=>{n(s(i))},[i]),o=A.useCallback(()=>{t&&(t.onClose&&t.onClose(),i())},[i,t]);return f.jsxs(la.Provider,{value:a,children:[e,t&&f.jsx(Nn,{file:t.file,onClose:o})]})});ua.displayName="FileViewerProvider";const Oe=A.memo(r=>{const{className:e,label:t,children:n,severity:i,inputId:a,labelId:o,image:s}=r,[l,u]=A.useState(void 0),c=Xr(),d=i?Ot[i]:"base";A.useEffect(()=>{s instanceof Promise?s.then(u).catch(console.error):u(s)},[s]);const p=l?URL.createObjectURL(l):void 0,h=A.useCallback(()=>{l&&c(()=>({file:l}))},[c,l]);return f.jsxs("div",{className:"flex flex-col gap-1",children:[l&&f.jsx("img",{className:"h-[100px] w-full min-w-[300px] cursor-pointer rounded-md object-cover",src:p,alt:l.name,onClick:h}),!!t&&f.jsx("label",{className:sr.cx(e,"w-max max-w-full"),htmlFor:a,children:f.jsx(v.Text,{accentColor:d,size:"sm",id:o,className:"text-wrap",children:t})}),n]})}),be=r=>{const{children:e,...t}=r;return f.jsx(qr,{...t,children:e})},yl=(r,e)=>A.useMemo(()=>!e||!r?null:r.render(e),[r,e]),cr=(r,e)=>f.jsx("div",{className:"flex flex-col gap-4",children:r.map(t=>f.jsx(A.Fragment,{children:t.render(e)},t.identifier))}),Ne=r=>{const{field:e,size:t,showInputOnly:n,onValuesChange:i,...a}=r,[o,s,l]=Re.useField(e.identifier),{touched:u}=s,c=s.error??e.description,d=s.error?"danger":void 0,p=e.identifier,h=`${p}-label`,g=e.required?`${e.label} *`:e.label,x=A.useMemo(()=>({...o,onChange:m=>{l.setValue(m,!1),i==null||i(e.identifier,m),(u||!e.onlyValidateAfterTouched)&&l.setError(e.getError(m))},onBlur:m=>{l.setTouched(!0,!1),l.setError(e.getError(m))}}),[e,o,l,i,u]);return[{helpText:c,size:t,severity:d,inputId:p,labelId:h,label:g,showInputOnly:n,fieldProps:x,helpers:l,field:e,touched:u},{...a,"aria-labelledby":h}]},Tn=A.memo(r=>{const[{inputId:e,labelId:t,size:n,severity:i,showInputOnly:a,field:o,helpText:s,label:l,fieldProps:u},{disabled:c}]=Ne(r),d=a?null:s,p=a?"":l,{value:h,name:g,onChange:x,onBlur:y}=u,w=`${e}-droppable`,[m,_]=A.useState(""),[E,I]=A.useState(""),b=E||d,D=A.useCallback(U=>{x(U),y(U)},[x,y]),M=A.useCallback(U=>{h&&h.findIndex(Q=>Q===U.target.value.trim())>=0?I("All options must be unique"):U.target.value?I(""):I("Option cannot be empty"),_(U.target.value)},[_,h]),V=A.useCallback(()=>{if(E)return;if(!m.trim()){I("Option cannot be empty");return}const U=m.trim();D([...h,U]),_("")},[m,E,D,h]),L=A.useCallback(U=>{U.key==="Enter"&&(U.preventDefault(),V())},[V]),W=A.useCallback(U=>{const Q=Array.from(h);Q.splice(U,1),D(Q)},[h,D]),k=A.useCallback(U=>{if(!U.destination)return;const Q=U.source.index,q=U.destination.index,ae=Array.from(h),[Fe]=ae.splice(Q,1);ae.splice(q,0,Fe),D(ae)},[D,h]),j=A.useCallback(()=>{y(h)},[y,h]);return f.jsx(An.DragDropContext,{onDragEnd:k,children:f.jsxs("div",{className:"flex flex-col gap-2",children:[f.jsx(be,{helpText:b,severity:i,children:f.jsx(Oe,{size:n,severity:i,inputId:e,labelId:t,label:p,image:a?void 0:o.image,children:(!c||h.length===0)&&f.jsxs("div",{className:"flex gap-2",children:[f.jsx(v.Input.Root,{className:"grow",accentColor:"base",variant:"surface",size:"sm",children:f.jsx(v.Input.Field,{value:m,onChange:M,onKeyDown:L,id:e,placeholder:o.placeholder,onBlur:j,name:g,disabled:c})}),f.jsx(v.IconButton,{size:"sm",accentColor:"base",variant:"soft",type:"button","aria-label":"Add option",disabled:!!E||c,onClick:V,children:f.jsx(v.LuIcon,{icon:Ze})})]})})}),h.length!==0&&f.jsx(An.Droppable,{droppableId:w,children:U=>f.jsxs("div",{className:"flex flex-col gap-1",...U.droppableProps,ref:U.innerRef,children:[h.map((Q,q)=>f.jsx(An.Draggable,{draggableId:`${Q}-draggable`,index:q,isDragDisabled:c,children:({draggableProps:ae,dragHandleProps:Fe,innerRef:Ur})=>f.jsxs(v.Badge,{...Fe,...ae,ref:Ur,className:"flex items-center justify-between gap-2",accentColor:"base",size:"sm",variant:"soft",children:[f.jsx("span",{className:"truncate",children:typeof Q=="object"&&"label"in Q?Q.label:Q}),f.jsx(v.IconButton,{size:"xs",variant:"ghost",type:"button","aria-label":"Delete option",accentColor:"base",disabled:c,onClick:()=>{W(q)},children:f.jsx(v.LuIcon,{icon:nt})})]})},`${e}-${Q}-${q}`)),U.placeholder]})})]})})});Tn.displayName="MultiStringInput";const Wt=class Wt extends Pe{constructor(t){const{minimum_length:n,maximum_length:i,placeholder:a,...o}=t;super(o);N(this,"type","multi-string");N(this,"minLength");N(this,"maxLength");N(this,"placeholder");N(this,"onlyValidateAfterTouched",!1);this.minLength=n??0,this.maxLength=i??1/0,this.placeholder=a??"Press enter to add a new option"}render(t){return f.jsx(Tn,{field:this,...t})}serialize(){return{...super.serialize(),minimum_length:this.minLength,maximum_length:this.maxLength,placeholder:this.placeholder}}getOptions(){return{...super.getOptions(),minimum_length:this.minLength,maximum_length:this.maxLength,placeholder:this.placeholder}}duplicate(t){return new Wt({...this.getOptions(),identifier:t})}setOptions(t){const{minimum_length:n,maximum_length:i,placeholder:a,...o}=t;this.minLength=n??this.minLength,this.maxLength=i??this.maxLength,this.placeholder=a??this.placeholder,super.setOptions(o)}serializeValue(t){return t}deserializeValue(t){return t}getFieldValidators(){const t=super.getFieldValidators();return t.push(n=>{if(Array.isArray(n)&&n.length<this.minLength)return`Must have at least ${this.minLength} options.`}),t.push(n=>{if(Array.isArray(n)&&n.length>this.maxLength)return`Must have at most ${this.maxLength} options.`}),t}static deserialize(t){return new Wt(t)}isSerializedValueValid(t){return lr(t)}isValueValid(t){return lr(t)}blankValue(){return[]}areValuesEqual(t,n){const i=new Set(t),a=new Set(n);return i.size===a.size&&i.isSubsetOf(a)}blankSerializedValue(){return[]}areSerializedValuesEqual(t,n){const i=new Set(t),a=new Set(n);return i.size===a.size&&i.isSubsetOf(a)}};N(Wt,"fieldTypeName","Multi-string"),N(Wt,"fieldTypeDescription","Allows the user to provide multiple unique strings.");let bt=Wt;class dr extends Pe{constructor(t){const{options:n,...i}=t;super(i);N(this,"options");N(this,"onlyValidateAfterTouched",!1);this.options=n.map(a=>(typeof a=="string"&&(a={label:a,value:a}),a))}serialize(){return{...super.serialize(),options:this.options}}getOptions(){return{...super.getOptions(),options:this.options}}setOptions(t){const{options:n,...i}=t;this.options=(n==null?void 0:n.map(a=>(typeof a=="string"&&(a={label:a,value:a}),a)))??this.options,super.setOptions(i)}static getFieldCreationSchema(t=""){const n=t&&`${t}.`;return[{field:new bt({label:"Options",description:"List possible options for the user to select from.",required:!0,identifier:`${n}options`,minimum_length:2}),showDirectly:!0}]}}const Dn=A.memo(r=>{const[{inputId:e,labelId:t,size:n,severity:i,showInputOnly:a,field:o,helpText:s,label:l,fieldProps:u},{disabled:c}]=Ne(r),{name:d,onBlur:p,onChange:h,value:g}=u,x=a?null:s,y=a?"":l,w=A.useCallback(_=>{h(!!_),p(!!_)},[p,h]),m=A.useCallback(()=>{p(g)},[p,g]);return f.jsx(be,{helpText:x,severity:i,children:f.jsx(Oe,{size:n,severity:i,inputId:e,labelId:t,label:y,image:a?void 0:o.image,className:"items-center flex-row-reverse justify-end gap-2",children:f.jsx(v.Checkbox.Root,{id:e,name:d,checked:g??!1,onCheckedChange:w,onBlur:m,size:"sm",accentColor:"primary",variant:"surface",disabled:c,children:f.jsx(v.Checkbox.Indicator,{children:f.jsx(v.LuIcon,{icon:qe})})})})})});Dn.displayName="BooleanInput";const jt=class jt extends Pe{constructor(t){super(t);N(this,"type","boolean");N(this,"onlyValidateAfterTouched",!1)}serialize(){return super.serialize()}getOptions(){return super.getOptions()}setOptions(t){super.setOptions(t)}duplicate(t){return new jt({...this.getOptions(),identifier:t})}static deserialize(t){return new jt(t)}serializeValue(t){return t}deserializeValue(t){return t}render(t){return f.jsx(Dn,{...t,field:this})}isSerializedValueValid(t){return typeof t=="boolean"}isValueValid(t){return typeof t=="boolean"}blankValue(){return!1}blankSerializedValue(){return!1}areSerializedValuesEqual(t,n){return t===n}areValuesEqual(t,n){return t===n}};N(jt,"fieldTypeName","Checkbox"),N(jt,"fieldTypeDescription","Perfect for both optional and required yes/no questions.");let Nt=jt;const Mn=A.memo(r=>{const[{inputId:e,labelId:t,size:n,severity:i,showInputOnly:a,field:o,helpText:s,label:l,fieldProps:u,touched:c,helpers:d},{disabled:p}]=Ne(r),{name:h,onBlur:g,onChange:x,value:y}=u,w=a?null:s,m=a?"":l,[_,E]=A.useState(null);A.useEffect(()=>{E(y)},[y]);const I=A.useCallback(D=>{const M=D.target.valueAsNumber,V=isNaN(M)?null:M;E(V),(c||!o.onlyValidateAfterTouched)&&d.setError(o.getError(V))},[o,d,c]),b=A.useCallback(()=>{x(_),g(_)},[_,g,x]);return f.jsx(be,{helpText:w,severity:i,children:f.jsx(Oe,{size:n,severity:i,inputId:e,labelId:t,label:m,image:a?void 0:o.image,children:f.jsx(v.Input.Root,{accentColor:"base",variant:"surface",size:"sm",children:f.jsx(v.Input.Field,{id:e,name:h,onChange:I,onBlur:b,value:_??"",type:"number",min:o.minimum,max:o.maximum,step:o.integers?1:.1,placeholder:o.placeholder??"Enter a number",disabled:p})})})})});Mn.displayName="NumberInput";const ft=class ft extends Pe{constructor(t){const{minimum:n=Number.MIN_SAFE_INTEGER,maximum:i=Number.MAX_SAFE_INTEGER,integers:a=!1,placeholder:o,...s}=t;super(s);N(this,"type","number");N(this,"minimum");N(this,"maximum");N(this,"integers");N(this,"placeholder");this.minimum=n,this.maximum=i,this.integers=a,this.placeholder=o}static getFieldCreationSchema(t=""){const n=t&&`${t}.`;return[{field:new ft({label:"Minimum",description:"Minimum value",integers:!0,required:!1,identifier:`${n}minimum`}),showDirectly:!1},{field:new ft({label:"Maximum",description:"Maximum value",integers:!0,required:!1,identifier:`${n}maximum`}),showDirectly:!1},{field:new Nt({label:"Integers",description:"Whole numbers only",required:!1,identifier:`${n}integers`}),showDirectly:!1}]}getFieldValidators(){const t=super.getFieldValidators(),n=this.minimum,i=this.maximum;return typeof n=="number"&&t.push(a=>{if(typeof a=="number"&&a<n)return`Must be at least ${this.minimum}.`}),typeof i=="number"&&t.push(a=>{if(typeof a=="number"&&a>i)return`Must be at most ${this.maximum}.`}),this.integers&&t.push(a=>{if(typeof a=="number"&&!Number.isInteger(a))return"Must be a whole number."}),t}serialize(){return{...super.serialize(),minimum:this.minimum,maximum:this.maximum,integers:this.integers,placeholder:this.placeholder}}getOptions(){return{...super.getOptions(),minimum:this.minimum,maximum:this.maximum,integers:this.integers,placeholder:this.placeholder}}duplicate(t){return new ft({...this.getOptions(),identifier:t})}setOptions(t){const{minimum:n,maximum:i,integers:a,placeholder:o,...s}=t;this.minimum=n??this.minimum,this.maximum=i??this.maximum,this.integers=a??this.integers,this.placeholder=o??this.placeholder,super.setOptions(s)}static deserialize(t){return new ft(t)}serializeValue(t){return t}deserializeValue(t){return t}render(t){return f.jsx(Mn,{field:this,...t})}isSerializedValueValid(t){return this.isValueValid(t)}isValueValid(t){return typeof t=="number"&&!isNaN(t)||t===null}areValuesEqual(t,n){return t===n}blankValue(){return null}blankSerializedValue(){return null}areSerializedValuesEqual(t,n){return t===n}};N(ft,"fieldTypeName","Number"),N(ft,"fieldTypeDescription","Allows specifying a number within a given range.");let $e=ft;const Tt=1e4;class Vn extends Pe{constructor(t){const{minLength:n,maxLength:i,placeholder:a="",...o}=t;super(o);N(this,"minLength");N(this,"maxLength");N(this,"placeholder");this.minLength=n?Math.max(n,0):void 0,this.maxLength=i?Math.max(i,0):Tt,this.placeholder=a}static getFieldCreationSchema(t=""){const n=t&&`${t}.`;return[{field:new $e({label:"Minimum length",description:"Minimum number of characters",required:!1,identifier:`${n}minimum_length`,minimum:0,maximum:100,integers:!0}),showDirectly:!1},{field:new $e({label:"Maximum length",description:"Maximum number of characters",required:!1,identifier:`${n}maximum_length`,minimum:1,maximum:Tt,integers:!0}),showDirectly:!1}]}getFieldValidators(){const t=super.getFieldValidators();return this.minLength&&t.push(n=>{if(this.minLength&&(!n||n.length<this.minLength))return!this.required&&!n?null:`Minimum ${this.minLength} character(s).`}),this.maxLength&&t.push(n=>{if(typeof n=="string"&&this.maxLength&&n.length>this.maxLength)return`Maximum ${this.maxLength} character(s).`}),t}serialize(){return{...super.serialize(),minimum_length:this.minLength,maximum_length:this.maxLength,placeholder:this.placeholder}}getOptions(){return{...super.getOptions(),minLength:this.minLength,maxLength:this.maxLength,placeholder:this.placeholder}}setOptions(t){const{minLength:n,maxLength:i,placeholder:a,...o}=t;this.minLength=n,this.maxLength=i??this.maxLength,this.placeholder=a,super.setOptions(o)}serializeValue(t){return t}deserializeValue(t){return t}isSerializedValueValid(t){return typeof t=="string"}isValueValid(t){return typeof t=="string"}blankValue(){return""}blankSerializedValue(){return""}areSerializedValuesEqual(t,n){return t===n}areValuesEqual(t,n){return t===n}}const Fn=A.memo(r=>{const[{inputId:e,labelId:t,size:n,severity:i,field:a,showInputOnly:o,helpText:s,label:l,fieldProps:u},{disabled:c}]=Ne(r),{value:d,name:p,onChange:h,onBlur:g}=u,x=o?null:s,y=o?"":l,w=A.useCallback(m=>{h(m),g(m)},[g,h]);return f.jsx(be,{helpText:x,severity:i,children:f.jsx(Oe,{size:n,severity:i,inputId:e,labelId:t,label:y,image:o?void 0:a.image,children:f.jsx(v.CheckboxGroup.Root,{id:e,name:p,className:"flex flex-col gap-1",accentColor:"base",variant:"surface",size:"sm",values:d,onValuesChange:w,disabled:c,children:a.options.map((m,_)=>f.jsxs("label",{className:"flex gap-2 items-center min-w-0",children:[f.jsx(v.CheckboxGroup.Item,{value:m.value,children:f.jsx(v.CheckboxGroup.ItemIndicator,{children:f.jsx(v.LuIcon,{icon:qe})})}),f.jsx(v.Text,{size:"sm",accentColor:"base",className:"truncate",children:m.label})]},`${e}-${m.value}-${_}`))})})})});Fn.displayName="CheckboxListInput";const Yt=class Yt extends dr{constructor(t){super(t);N(this,"type","checkbox-list");N(this,"onlyValidateAfterTouched",!1)}serialize(){return super.serialize()}getOptions(){return super.getOptions()}duplicate(t){return new Yt({...this.getOptions(),identifier:t})}static deserialize(t){return new Yt(t)}serializeValue(t){return t}deserializeValue(t){return t}render(t){return f.jsx(Fn,{field:this,...t})}isSerializedValueValid(t){if(!lr(t))return!1;const n=new Set(this.options.map(({value:i})=>i));return t.every(i=>n.has(i))}isValueValid(t){return this.isSerializedValueValid(t)}blankValue(){return[]}blankSerializedValue(){return[]}areSerializedValuesEqual(t,n){const i=new Set(t),a=new Set(n);return i.size===a.size&&i.isSubsetOf(a)}areValuesEqual(t,n){const i=new Set(t),a=new Set(n);return i.size===a.size&&i.isSubsetOf(a)}};N(Yt,"fieldTypeName","Checkbox list"),N(Yt,"fieldTypeDescription","Allows the user to select a multiple options from a list.");let Dt=Yt;const Pn=A.memo(r=>{const[{inputId:e,labelId:t,size:n,severity:i,showInputOnly:a,field:o,helpText:s,label:l,fieldProps:u},{disabled:c}]=Ne(r),{value:d,name:p,onChange:h,onBlur:g}=u,[x,y]=A.useState(!1),w=a?null:s,m=a?"":l,_=A.useCallback(I=>{h(I??null),y(!1)},[h]),E=A.useCallback(I=>{y(I),I||g(d)},[g,d]);return f.jsx(be,{helpText:w,severity:i,children:f.jsx(Oe,{size:n,severity:i,inputId:e,labelId:t,label:m,image:a?void 0:o.image,children:f.jsxs(v.Popover.Root,{open:x,onOpenChange:E,children:[f.jsx(v.Popover.Trigger,{asChild:!0,children:f.jsxs(v.Button,{id:e,name:p,type:"button",className:"!justify-between",accentColor:"base",variant:"surface",size:"sm",disabled:c,children:[d?d.toLocaleString(void 0,{year:"numeric",month:"2-digit",day:"2-digit"}):"yyyy-mm-dd",f.jsx(v.LuIcon,{icon:Sn})]})}),f.jsx(v.Popover.Content,{align:"start",children:f.jsx(v.DayPicker,{required:!1,mode:"single",variant:"solid",selected:d??void 0,onSelect:_})})]})})})});Pn.displayName="DateInput";const Zt=class Zt extends Pe{constructor(t){super(t);N(this,"type","date");N(this,"onlyValidateAfterTouched",!1)}serialize(){return super.serialize()}getOptions(){return super.getOptions()}duplicate(t){return new Zt({...this.getOptions(),identifier:t})}static deserialize(t){return new Zt(t)}setOptions(t){super.setOptions(t)}serializeValue(t){return t?t.toISOString():null}deserializeValue(t){return t?new Date(t):null}render(t){return f.jsx(Pn,{field:this,...t})}isSerializedValueValid(t){return typeof t!="string"&&t!==null?!1:this.isValueValid(this.deserializeValue(t))}isValueValid(t){return!(!(t instanceof Date)&&t!==null||t instanceof Date&&isNaN(t.getTime()))}blankValue(){return null}blankSerializedValue(){return null}areSerializedValuesEqual(t,n){return t===n}areValuesEqual(t,n){return!t&&!n?!0:!t||!n?!1:t.getTime()===n.getTime()}};N(Zt,"fieldTypeName","Date"),N(Zt,"fieldTypeDescription","Allows specifying a date.");let fr=Zt;const Bn=A.memo(r=>{const[{inputId:e,labelId:t,size:n,severity:i,showInputOnly:a,field:o,helpText:s,label:l,fieldProps:u},{disabled:c}]=Ne(r),{value:d,name:p,onChange:h,onBlur:g}=u,x=a?null:s,y=a?"":l,w=A.useCallback(_=>{h(_),g(_)},[g,h]),m=A.useCallback(_=>{_||g(d)},[d,g]);return f.jsx(be,{helpText:x,severity:i,children:f.jsx(Oe,{size:n,severity:i,inputId:e,labelId:t,label:y,image:a?void 0:o.image,children:f.jsxs(v.Menu.Root,{onOpenChange:m,align:"start",children:[f.jsx(v.Menu.ClickTrigger,{children:f.jsxs(v.Button,{id:e,name:p,className:"!justify-between",variant:"surface",type:"button",size:"sm",accentColor:"base",disabled:c,children:[f.jsx("span",{className:"truncate",children:d&&d.length>0?d.join(", "):o.placeholder??"Select one or more..."}),f.jsx(v.LuIcon,{icon:Sn})]})}),f.jsx(v.Menu.Content,{children:f.jsx(v.Menu.Scroll,{children:f.jsxs(v.Menu.MultiSelectGroup,{values:d,onValuesChange:w,children:[f.jsxs(v.Menu.SelectAllItem,{children:[f.jsx(v.Menu.CheckboxItemIndicator,{children:_=>_?f.jsx(v.LuIcon,{icon:Gr}):f.jsx(v.LuIcon,{icon:qe})}),"Select all"]}),o.options.map((_,E)=>f.jsxs(v.Menu.MultiSelectItem,{value:_.value,children:[f.jsx(v.Menu.SelectedIndicator,{children:f.jsx(v.LuIcon,{icon:qe})}),_.label]},`${e}-${_.value}-${E}`))]})})})]})})})});Bn.displayName="MultiSelectInput";const Kt=class Kt extends dr{constructor(t){const{placeholder:n,...i}=t;super(i);N(this,"type","multi-select");N(this,"placeholder");this.placeholder=n}serialize(){return super.serialize()}getOptions(){return{...super.getOptions(),placeholder:this.placeholder}}duplicate(t){return new Kt({...this.getOptions(),identifier:t})}setOptions(t){const{placeholder:n}=t;this.placeholder=n,super.setOptions(t)}static deserialize(t){return new Kt(t)}serializeValue(t){return t}deserializeValue(t){return t}render(t){return f.jsx(Bn,{field:this,...t})}isSerializedValueValid(t){if(!lr(t))return!1;const n=new Set(this.options.map(({value:i})=>i));return t.every(i=>n.has(i))}isValueValid(t){return this.isSerializedValueValid(t)}blankValue(){return[]}areValuesEqual(t,n){const i=new Set(t),a=new Set(n);return i.size===a.size&&i.isSubsetOf(a)}blankSerializedValue(){return[]}areSerializedValuesEqual(t,n){const i=new Set(t),a=new Set(n);return i.size===a.size&&i.isSubsetOf(a)}};N(Kt,"fieldTypeName","Multi-select"),N(Kt,"fieldTypeDescription","Allows the user to select a multiple options from a list of options.");let it=Kt;const Ln=A.memo(r=>{const[{inputId:e,labelId:t,size:n,severity:i,showInputOnly:a,field:o,helpText:s,label:l,fieldProps:u},{disabled:c}]=Ne(r),{name:d,onChange:p,onBlur:h,value:g}=u,x=a?null:s,y=a?"":l,w=A.useCallback(_=>{p(_??null),h(_??null)},[h,p]),m=A.useMemo(()=>o.options.find(_=>_.value===g),[o.options,g]);return f.jsx(be,{helpText:x,severity:i,children:f.jsx(Oe,{size:n,severity:i,inputId:e,labelId:t,label:y,image:a?void 0:o.image,children:f.jsxs(v.Menu.Root,{align:"start",children:[f.jsx(v.Menu.ClickTrigger,{children:f.jsxs(v.Button,{id:e,name:d,className:"!justify-between",accentColor:"base",variant:"surface",type:"button",size:"sm",disabled:c,children:[f.jsx("span",{className:"truncate",children:m?m.label:o.placeholder??"Select one..."}),f.jsx(v.LuIcon,{icon:Sn})]})}),f.jsx(v.Menu.Content,{children:f.jsx(v.Menu.Scroll,{children:f.jsx(v.Menu.SelectGroup,{required:!1,value:g??void 0,onValueChange:w,children:o.options.map((_,E)=>f.jsxs(v.Menu.SelectItem,{value:_.value,children:[f.jsx(v.Menu.SelectedIndicator,{children:f.jsx(v.LuIcon,{icon:qe})}),_.label]},`${e}-${_.value}-${E}`))})})})]})})})});Ln.displayName="SelectInput";const Qt=class Qt extends dr{constructor(t){const{placeholder:n,...i}=t;super(i);N(this,"type","select");N(this,"placeholder");this.placeholder=n}serialize(){return super.serialize()}getOptions(){return{...super.getOptions(),placeholder:this.placeholder}}duplicate(t){return new Qt({...this.getOptions(),identifier:t})}setOptions(t){const{placeholder:n}=t;this.placeholder=n,super.setOptions(t)}static deserialize(t){return new Qt(t)}serializeValue(t){return t}deserializeValue(t){return t}render(t){return f.jsx(Ln,{field:this,...t})}isSerializedValueValid(t){return typeof t!="string"&&t!==null?!1:new Set([null,...this.options.map(({value:i})=>i)]).has(t)}isValueValid(t){return this.isSerializedValueValid(t)}blankValue(){return null}areValuesEqual(t,n){return t===n}blankSerializedValue(){return null}areSerializedValuesEqual(t,n){return t===n}};N(Qt,"fieldTypeName","Dropdown"),N(Qt,"fieldTypeDescription","Allows the user to select a single option from a list of options.");let pt=Qt;const zn=A.memo(r=>{const[{inputId:e,labelId:t,size:n,severity:i,showInputOnly:a,field:o,helpText:s,label:l,fieldProps:u,touched:c,helpers:d},{formId:p,disabled:h}]=Ne(r),{name:g,onBlur:x,onChange:y,value:w}=u,m=a?null:s,_=a?"":l,[E,I]=A.useState(""),b=A.useMemo(()=>Array.from({length:o.length},()=>H.v4()),[o.length]);A.useEffect(()=>{I(w)},[w]);const D=A.useCallback(V=>{I(V),(c||!o.onlyValidateAfterTouched)&&d.setError(o.getError(V))},[o,d,c]),M=A.useCallback(()=>{y(E),x(E)},[E,x,y]);return f.jsx(be,{helpText:m,severity:i,children:f.jsx(Oe,{size:n,severity:i,inputId:e,labelId:t,label:_,image:a?void 0:o.image,children:f.jsxs(v.OneTimePasswordField.Root,{id:e,name:g,value:E,onValueChange:D,validationType:o.validationType,form:p,disabled:h,orientation:"horizontal",dir:"ltr",type:"text",autoComplete:"off",autoFocus:!1,autoSubmit:!1,className:"flex gap-1 h-max w-full overflow-x-auto p-0.25",accentColor:"base",variant:"surface",size:"sm",onBlur:M,children:[b.map(V=>f.jsx(v.OneTimePasswordField.Input,{id:V},V)),f.jsx(v.OneTimePasswordField.HiddenInput,{})]})})})});zn.displayName="NumberInput";const Jt=class Jt extends Pe{constructor(t){const{length:n,validationType:i,...a}=t;super(a);N(this,"type","otp");N(this,"length");N(this,"validationType");this.length=n,this.validationType=i}static getFieldCreationSchema(t=""){const n=t&&`${t}.`;return[{field:new $e({label:"Length",integers:!0,required:!1,minimum:1,maximum:16,identifier:`${n}length`}),showDirectly:!1},{field:new pt({label:"Type",required:!1,identifier:`${n}validationType`,options:[{value:"none",label:"Any"},{value:"numeric",label:"Numeric"},{value:"alpha",label:"Alpha"},{value:"alphanumeric",label:"Alphanumeric"}]}),showDirectly:!1}]}getFieldValidators(){const t=super.getFieldValidators(),n=this.length;return t.push(i=>{if(!this.isValueBlank(i)&&i.length!=n)return`Must be ${n} characters.`}),t}serialize(){return{...super.serialize(),length:this.length,validationType:this.validationType}}getOptions(){return{...super.getOptions(),length:this.length,validationType:this.validationType}}duplicate(t){return new Jt({...this.getOptions(),identifier:t})}setOptions(t){const{length:n,validationType:i,...a}=t;this.length=n??this.length,this.validationType=i??this.validationType,super.setOptions(a)}static deserialize(t){return new Jt(t)}serializeValue(t){return t}deserializeValue(t){return t}render(t){return f.jsx(zn,{field:this,...t})}isSerializedValueValid(t){return typeof t=="string"}isValueValid(t){return typeof t=="string"}blankValue(){return""}areValuesEqual(t,n){return t===n}blankSerializedValue(){return""}areSerializedValuesEqual(t,n){return t===n}};N(Jt,"fieldTypeName","OTP"),N(Jt,"fieldTypeDescription","Allows specifying a number within a given range.");let Mt=Jt;const vt={pass:{label:"Pass",icon:Ys},fail:{label:"Fail",icon:Qs},na:{label:"N/A",icon:Ks}},Vt=Object.keys(vt);class at extends File{constructor(t,...n){super(...n);N(this,"uuid");this.uuid=t}static from(t,n){return new at(t,[n],n.name,{lastModified:n.lastModified,type:n.type})}}class Ft extends Promise{constructor(t,n){super(t);N(this,"_uuid");this._uuid=n}get uuid(){return this._uuid}set uuid(t){this._uuid=t}static from(t,n){return new Ft((i,a)=>{Promise.resolve(t).then(i).catch(a)},n)}then(t,n){const i=super.then(t,n);return i.uuid=this.uuid,i}catch(t){const n=super.catch(t);return n.uuid=this.uuid,n}finally(t){const n=super.finally(t);return n.uuid=this.uuid,n}}function ca(r){return Array.isArray(r)?r.every(e=>e instanceof Ft||e instanceof at):!1}function $r(r,e){const t=new Set(r.map(({uuid:i})=>i)),n=new Set(e.map(({uuid:i})=>i));return t.size===n.size&&t.isSubsetOf(n)}const da=A.memo(A.forwardRef((r,e)=>{const{file:t,alt:n,error:i,rightSlot:a,className:o,...s}=r;return f.jsxs(v.Card,{className:sr.cx(o,"relative flex h-[200px] w-full flex-col gap-2 overflow-hidden items-center"),ref:e,...s,children:[!t&&!i&&f.jsx("div",{className:"absolute inset-0 grow flex items-center justify-center",children:f.jsx(v.Spinner,{})}),!!t&&!i&&f.jsx(v.Card,{className:"flex max-w-full grow items-center !p-0 justify-center overflow-hidden bg-clip-padding",children:f.jsx("img",{className:"max-w-full object-cover",src:URL.createObjectURL(t),alt:n??t.name})}),(!!t||!!i)&&f.jsxs("div",{className:sr.cx("flex w-full items-center gap-2 self-end",{"bg-transparent":!t}),children:[i?f.jsx(v.LuIcon,{icon:nl}):t&&f.jsx(v.LuIcon,{icon:ia}),f.jsx(v.Text,{className:"truncate",size:"sm",children:i??(t==null?void 0:t.name)}),a]})]})})),Cl=r=>{const e=["byte","kilobyte","megabyte"];let t=r,n=0;for(;t>1e3&&n<e.length-1;)t/=1e3,n++;return new Intl.NumberFormat([],{maximumFractionDigits:Math.max(0,n-1),style:"unit",unit:e[n]}).format(t)},kn=A.memo(r=>{const{file:e,onRemove:t,disabled:n}=r,[i,a]=A.useState(null),[o,s]=A.useState(null),l=Xr(),{url:u,name:c}=A.useMemo(()=>{let x=null,y,w;return i!=null&&i.type.startsWith("image/")&&(x=URL.createObjectURL(i)),i?(y=i.name,w=Cl(i.size)):(y="Downloading...",w="..."),{url:x,name:y,size:w}},[i]);A.useEffect(()=>{e instanceof Ft?e.then(x=>{a(x)}).catch(x=>{s(x instanceof Error?x.message:"Unknown error")}):a(e)},[e]);const d=A.useCallback(x=>{if(x.stopPropagation(),!i)throw new Error("Cannot download a file that is not resolved.");const y=new Blob([i]);Yi.saveAs(y,c)},[c,i]),p=A.useCallback(x=>{x.stopPropagation(),t()},[t]),h=A.useCallback(()=>{i&&l(x=>({file:i,onDelete:n?void 0:()=>{t(),x()}}))},[n,t,l,i]),g=A.useMemo(()=>f.jsxs(v.ButtonGroup,{className:"flex grow justify-end",variant:"ghost",accentColor:"base",size:"sm",children:[f.jsx(v.IconButton,{"aria-label":`Download ${c}`,type:"button",onClick:d,disabled:!i,children:f.jsx(v.LuIcon,{icon:na})}),!n&&f.jsx(v.IconButton,{type:"button","aria-label":`Remove ${c}`,disabled:n,onClick:p,children:f.jsx(v.LuIcon,{icon:ht})})]}),[n,p,d,c,i]);return u?f.jsx(da,{className:"cursor-pointer",onClick:h,file:i,error:o??void 0,rightSlot:g}):f.jsx(On,{file:i,error:o??void 0,rightSlot:g})});kn.displayName="DisplayFile";const Rn=A.memo(r=>{const[{inputId:e,labelId:t,size:n,severity:i,showInputOnly:a,field:o,helpText:s,label:l,fieldProps:u,touched:c,helpers:d},{disabled:p}]=Ne(r),{value:h,onChange:g,onBlur:x,name:y}=u,[w,m]=A.useState(""),_=A.useRef(null),E=a?null:s,I=a?"":l,b=h.status&&o.showNotesAndFilesOn.includes(h.status),D=A.useCallback(q=>{const ae=o.cleanValue({...h,status:q});g(ae),x(ae)},[o,x,g,h]);A.useEffect(()=>{m(h.notes)},[h]);const M=A.useCallback(q=>{const ae=q.target.value;m(ae),(c||!o.onlyValidateAfterTouched)&&d.setError(o.getError({...h,notes:w}))},[o,d,w,c,h]),V=A.useCallback(()=>{const q={...h,notes:w};g(q),x(q)},[w,x,g,h]),L=A.useCallback(q=>{const ae=[...h.files];ae.splice(q,1),g({...h,files:ae})},[g,h]),W=A.useCallback(()=>{var q;(q=_.current)==null||q.click()},[]),k=A.useCallback(q=>{const ae=Array.from(q.target.files??[]).map(Ur=>at.from(H.v4(),Ur)),Fe={...h,files:[...h.files,...ae]};g(Fe),x(Fe)},[x,g,h]);A.useEffect(()=>{if(!_.current)return;const q=new AbortController;return _.current.addEventListener("cancel",()=>{x(h)},{signal:q.signal}),()=>{q.abort()}},[x,h]);const j=`${e}-status`,U=`${e}-notes`,Q=`${e}-files`;return f.jsx(be,{helpText:E,severity:i,children:f.jsx(Oe,{size:n,severity:i,inputId:e,labelId:t,label:I,image:a?void 0:o.image,children:f.jsxs("div",{className:"flex flex-col gap-2",children:[f.jsx(v.RadioGroup.Root,{id:j,className:"flex gap-2",name:y,value:h.status,disabled:p,accentColor:"base",variant:"surface",size:"sm",onValueChange:D,children:Vt.map(q=>{const{label:ae}=vt[q];return f.jsxs("label",{className:"flex gap-2 items-center min-w-0",children:[f.jsx(v.RadioGroup.Item,{value:q,children:f.jsx(v.RadioGroup.Indicator,{children:f.jsx(v.LuIcon,{icon:ea,className:"fill-current"})})}),f.jsx(v.Text,{size:"sm",accentColor:"base",className:"truncate",children:ae})]},`${e}-${q}`)})}),b&&f.jsxs(f.Fragment,{children:[f.jsx("div",{children:f.jsx(v.TextArea,{id:U,value:w,name:y,onChange:M,onBlur:V,className:"field-sizing-content w-full min-h-12",placeholder:"Notes",resize:"vertical",accentColor:"base",variant:"surface",size:"sm",disabled:p})}),f.jsxs("div",{className:"flex flex-col gap-2",children:[f.jsxs(v.Button,{className:"w-max",size:"sm",variant:"soft",accentColor:"base",onClick:W,type:"button",disabled:p,children:[f.jsx(v.LuIcon,{icon:In}),"Select files"]}),f.jsx("input",{id:Q,name:y,type:"file",ref:_,multiple:!0,className:"hidden",onChange:k,value:""}),h.files.length>0&&f.jsx("div",{className:"flex h-max flex-col gap-2",children:h.files.map((q,ae)=>f.jsx(kn,{file:q,onRemove:()=>{L(ae)},disabled:p},ae))})]})]})]})})})});Rn.displayName="PassFailInput";const Un=r=>typeof r=="string"&&Vt.includes(r),fa=r=>!(r===null||typeof r!="object"||!("status"in r)||!Un(r.status)||!("notes"in r)||typeof r.notes!="string"||!("files"in r)||!(Array.isArray(r.files)&&r.files.length===0)),ha=r=>!(r===null||typeof r!="object"||!("status"in r)||!Un(r.status)||!("notes"in r)||typeof r.notes!="string"||!("files"in r)||!ca(r.files)),pa=r=>({status:r.status,notes:r.notes,files:[]}),va=r=>({status:r.status,notes:r.notes,files:[]}),ga=(r,e)=>!(r.status!==e.status||r.notes!==e.notes||!$r(r.files,e.files)),xa=(r,e)=>!(r.status!==e.status||r.notes!==e.notes||r.files.length!==e.files.length),er=class er extends Pe{constructor(t){const{showNotesAndFilesOn:n,...i}=t;super(i);N(this,"type","pass-fail");N(this,"onlyValidateAfterTouched",!1);N(this,"showNotesAndFilesOn");this.showNotesAndFilesOn=n}static getFieldCreationSchema(t=""){const n=t&&`${t}.`;return[{field:new it({identifier:`${n}showNotesAndFilesOn`,label:"Show notes and files on",description:"Show the notes and files on desired statuses.",options:Vt.map(i=>{const{label:a}=vt[i];return{value:i,label:a}}),required:!1}),showDirectly:!1}]}serialize(){return{...super.serialize(),showNotesAndFilesOn:this.showNotesAndFilesOn}}getOptions(){return{...super.getOptions(),showNotesAndFilesOn:this.showNotesAndFilesOn}}duplicate(t){return new er({...this.getOptions(),identifier:t})}setOptions(t){const{showNotesAndFilesOn:n,...i}=t;this.showNotesAndFilesOn=n??this.showNotesAndFilesOn,super.setOptions(i)}getFieldValidators(){const t=super.getFieldValidators(),n=this.showNotesAndFilesOn,i=this.blankValue();return n.length>0&&(t.push(a=>{if(!(!a.status||!n.includes(a.status))&&i.notes===a.notes)return"Notes is required."}),t.push(a=>{if(!(!a.status||!n.includes(a.status))&&$r(i.files,a.files))return"Files is required."})),t}static deserialize(t){return new er({...t,showNotesAndFilesOn:t.showNotesAndFilesOn??!1})}serializeValue(t){return pa(t)}deserializeValue(t){return va(t)}render(t){return f.jsx(Rn,{field:this,...t})}isSerializedValueValid(t){return fa(t)}isValueValid(t){return ha(t)}areValuesEqual(t,n){return ga(t,n)}blankValue(){return{status:null,notes:"",files:[]}}cleanValue(t){return t.status&&this.showNotesAndFilesOn.includes(t.status)?t:{status:t.status,notes:"",files:[]}}cleanSerializedValue(t){return super.cleanSerializedValue(t)}blankSerializedValue(){return{status:null,notes:"",files:[]}}areSerializedValuesEqual(t,n){return xa(t,n)}};N(er,"fieldTypeName","Pass - Fail"),N(er,"fieldTypeDescription","Track pass, fail, or N/A outcome.");let Pt=er;const Hn=A.memo(r=>{const[{inputId:e,labelId:t,size:n,severity:i,showInputOnly:a,field:o,helpText:s,label:l,fieldProps:u},{disabled:c}]=Ne(r),{name:d,onChange:p,onBlur:h,value:g}=u,x=a?null:s,y=a?"":l,w=A.useCallback(_=>{p(_),h(_)},[h,p]),m=A.useCallback(()=>{p(null),h(null)},[h,p]);return f.jsx(be,{helpText:x,severity:i,children:f.jsx(Oe,{size:n,severity:i,inputId:e,labelId:t,label:y,image:a?void 0:o.image,children:f.jsxs(v.RadioGroup.Root,{id:e,name:d,className:"flex flex-col gap-1",accentColor:"base",variant:"surface",size:"sm",value:g??"",onValueChange:w,disabled:c,children:[o.options.map((_,E)=>f.jsxs("label",{className:"flex gap-2 items-center min-w-0",children:[f.jsx(v.RadioGroup.Item,{value:_.value,children:f.jsx(v.RadioGroup.Indicator,{children:f.jsx(v.LuIcon,{icon:ea,className:"fill-current"})})}),f.jsx(v.Text,{size:"sm",accentColor:"base",className:"truncate",children:_.label})]},`${e}-${_.value}-${E}`)),!!g&&f.jsxs(v.Button,{onClick:m,className:"w-max -mx-2",type:"button",variant:"ghost",accentColor:"base",size:"sm",children:[f.jsx(v.LuIcon,{icon:nt}),"Clear"]})]})})})});Hn.displayName="SelectInput";const tr=class tr extends dr{constructor(t){super(t);N(this,"type","radio");N(this,"onlyValidateAfterTouched",!1)}serialize(){return super.serialize()}getOptions(){return super.getOptions()}duplicate(t){return new tr({...this.getOptions(),identifier:t})}setOptions(t){super.setOptions(t)}static deserialize(t){return new tr(t)}serializeValue(t){return t}deserializeValue(t){return t}render(t){return f.jsx(Hn,{field:this,...t})}isSerializedValueValid(t){return typeof t!="string"&&t!==null?!1:new Set([null,...this.options.map(({value:i})=>i)]).has(t)}isValueValid(t){return this.isSerializedValueValid(t)}blankValue(){return null}areValuesEqual(t,n){return t===n}blankSerializedValue(){return null}areSerializedValuesEqual(t,n){return t===n}};N(tr,"fieldTypeName","Option list"),N(tr,"fieldTypeDescription","Allows the user to select a single option from a list of options.");let Bt=tr;const Gn=A.memo(r=>{const[{inputId:e,labelId:t,size:n,severity:i,showInputOnly:a,field:o,helpText:s,label:l,fieldProps:u},{disabled:c}]=Ne(r),{name:d,onChange:p,onBlur:h,value:g}=u,x=a?null:s,y=a?"":l,w=A.useCallback(E=>{p(E),h(E)},[h,p]),m=A.useCallback(()=>{p(null),h(null)},[h,p]),_=Array.from({length:o.maxRating},(E,I)=>I+1);return f.jsx(be,{helpText:x,severity:i,children:f.jsx(Oe,{size:n,severity:i,inputId:e,labelId:t,label:y,image:a?void 0:o.image,children:f.jsxs("div",{className:"flex flex-row gap-1 items-center",children:[f.jsx(v.Rating.Root,{id:e,name:d,className:"flex items-center gap-0.5",value:g,onValueChange:w,disabled:c,children:_.map(E=>f.jsx(v.Rating.Item,{value:E,className:"group size-7 flex cursor-pointer disabled:opacity-50 disabled:pointer-events-none items-center justify-center text-yellow-500 transition-colors",children:f.jsx(v.LuIcon,{icon:sa,className:"group-data-[active=true]:fill-current size-full"})},`${e}-${E}`))}),!c&&g!==null&&f.jsx(v.IconButton,{onClick:m,type:"button",variant:"ghost",accentColor:"base",size:"sm",children:f.jsx(v.LuIcon,{icon:nt})})]})})})});Gn.displayName="RatingInput";const rr=class rr extends Pe{constructor(t){const{maxRating:n,...i}=t;super(i);N(this,"type","rating");N(this,"maxRating");this.maxRating=n}static getFieldCreationSchema(t=""){const n=t&&`${t}.`;return[{field:new $e({label:"Max Rating",description:"Maximum rating value",integers:!0,required:!1,minimum:1,maximum:10,identifier:`${n}maxRating`}),showDirectly:!1}]}getFieldValidators(){const t=super.getFieldValidators(),n=this.maxRating;return t.push(i=>{if(typeof i=="number"&&(i<1||i>n))return`Rating must be between 1 and ${n}.`}),t}serialize(){return{...super.serialize(),maxRating:this.maxRating}}getOptions(){return{...super.getOptions(),maxRating:this.maxRating}}duplicate(t){return new rr({...this.getOptions(),identifier:t})}setOptions(t){const{maxRating:n,...i}=t;this.maxRating=n??this.maxRating,super.setOptions(i)}static deserialize(t){return new rr(t)}serializeValue(t){return t}deserializeValue(t){return t}render(t){return f.jsx(Gn,{field:this,...t})}isSerializedValueValid(t){return this.isValueValid(t)}isValueValid(t){return typeof t=="number"&&!isNaN(t)||t===null}areValuesEqual(t,n){return t===n}blankValue(){return null}blankSerializedValue(){return null}areSerializedValuesEqual(t,n){return t===n}};N(rr,"fieldTypeName","Rating"),N(rr,"fieldTypeDescription","Allows users to select a rating value.");let Lt=rr;const ya=A.createContext(()=>{throw new Error("No ScannerProvider found")}),wl=()=>A.use(ya);function ml(r,e){var t=Object.setPrototypeOf;t?t(r,e):r.__proto__=e}function _l(r,e){e===void 0&&(e=r.constructor);var t=Error.captureStackTrace;t&&t(r,e)}var Al=function(){var r=function(t,n){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,a){i.__proto__=a}||function(i,a){for(var o in a)Object.prototype.hasOwnProperty.call(a,o)&&(i[o]=a[o])},r(t,n)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),El=function(r){Al(e,r);function e(t,n){var i=this.constructor,a=r.call(this,t,n)||this;return Object.defineProperty(a,"name",{value:i.name,enumerable:!1,configurable:!0}),ml(a,i.prototype),_l(a),a}return e}(Error),Sl=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),Ue=function(r){Sl(e,r);function e(t){t===void 0&&(t=void 0);var n=r.call(this,t)||this;return n.message=t,n}return e.prototype.getKind=function(){var t=this.constructor;return t.kind},e.kind="Exception",e}(El),Il=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),Ke=function(r){Il(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.kind="ArgumentException",e}(Ue),Ol=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),R=function(r){Ol(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.kind="IllegalArgumentException",e}(Ue),bl=function(){function r(e){if(this.binarizer=e,e===null)throw new R("Binarizer must be non-null.")}return r.prototype.getWidth=function(){return this.binarizer.getWidth()},r.prototype.getHeight=function(){return this.binarizer.getHeight()},r.prototype.getBlackRow=function(e,t){return this.binarizer.getBlackRow(e,t)},r.prototype.getBlackMatrix=function(){return(this.matrix===null||this.matrix===void 0)&&(this.matrix=this.binarizer.getBlackMatrix()),this.matrix},r.prototype.isCropSupported=function(){return this.binarizer.getLuminanceSource().isCropSupported()},r.prototype.crop=function(e,t,n,i){var a=this.binarizer.getLuminanceSource().crop(e,t,n,i);return new r(this.binarizer.createBinarizer(a))},r.prototype.isRotateSupported=function(){return this.binarizer.getLuminanceSource().isRotateSupported()},r.prototype.rotateCounterClockwise=function(){var e=this.binarizer.getLuminanceSource().rotateCounterClockwise();return new r(this.binarizer.createBinarizer(e))},r.prototype.rotateCounterClockwise45=function(){var e=this.binarizer.getLuminanceSource().rotateCounterClockwise45();return new r(this.binarizer.createBinarizer(e))},r.prototype.toString=function(){try{return this.getBlackMatrix().toString()}catch{return""}},r}(),Nl=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),Ce=function(r){Nl(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.getChecksumInstance=function(){return new e},e.kind="ChecksumException",e}(Ue),Tl=function(){function r(e){this.source=e}return r.prototype.getLuminanceSource=function(){return this.source},r.prototype.getWidth=function(){return this.source.getWidth()},r.prototype.getHeight=function(){return this.source.getHeight()},r}(),se=function(){function r(){}return r.arraycopy=function(e,t,n,i,a){for(;a--;)n[i++]=e[t++]},r.currentTimeMillis=function(){return Date.now()},r}(),Dl=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),qn=function(r){Dl(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.kind="IndexOutOfBoundsException",e}(Ue),Ml=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),Ca=function(r){Ml(e,r);function e(t,n){t===void 0&&(t=void 0),n===void 0&&(n=void 0);var i=r.call(this,n)||this;return i.index=t,i.message=n,i}return e.kind="ArrayIndexOutOfBoundsException",e}(qn),Vl=function(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},he=function(){function r(){}return r.fill=function(e,t){for(var n=0,i=e.length;n<i;n++)e[n]=t},r.fillWithin=function(e,t,n,i){r.rangeCheck(e.length,t,n);for(var a=t;a<n;a++)e[a]=i},r.rangeCheck=function(e,t,n){if(t>n)throw new R("fromIndex("+t+") > toIndex("+n+")");if(t<0)throw new Ca(t);if(n>e)throw new Ca(n)},r.asList=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return e},r.create=function(e,t,n){var i=Array.from({length:e});return i.map(function(a){return Array.from({length:t}).fill(n)})},r.createInt32Array=function(e,t,n){var i=Array.from({length:e});return i.map(function(a){return Int32Array.from({length:t}).fill(n)})},r.equals=function(e,t){if(!e||!t||!e.length||!t.length||e.length!==t.length)return!1;for(var n=0,i=e.length;n<i;n++)if(e[n]!==t[n])return!1;return!0},r.hashCode=function(e){var t,n;if(e===null)return 0;var i=1;try{for(var a=Vl(e),o=a.next();!o.done;o=a.next()){var s=o.value;i=31*i+s}}catch(l){t={error:l}}finally{try{o&&!o.done&&(n=a.return)&&n.call(a)}finally{if(t)throw t.error}}return i},r.fillUint8Array=function(e,t){for(var n=0;n!==e.length;n++)e[n]=t},r.copyOf=function(e,t){return e.slice(0,t)},r.copyOfUint8Array=function(e,t){if(e.length<=t){var n=new Uint8Array(t);return n.set(e),n}return e.slice(0,t)},r.copyOfRange=function(e,t,n){var i=n-t,a=new Int32Array(i);return se.arraycopy(e,t,a,0,i),a},r.binarySearch=function(e,t,n){n===void 0&&(n=r.numberComparator);for(var i=0,a=e.length-1;i<=a;){var o=a+i>>1,s=n(t,e[o]);if(s>0)i=o+1;else if(s<0)a=o-1;else return o}return-i-1},r.numberComparator=function(e,t){return e-t},r}(),$=function(){function r(){}return r.numberOfTrailingZeros=function(e){var t;if(e===0)return 32;var n=31;return t=e<<16,t!==0&&(n-=16,e=t),t=e<<8,t!==0&&(n-=8,e=t),t=e<<4,t!==0&&(n-=4,e=t),t=e<<2,t!==0&&(n-=2,e=t),n-(e<<1>>>31)},r.numberOfLeadingZeros=function(e){if(e===0)return 32;var t=1;return e>>>16||(t+=16,e<<=16),e>>>24||(t+=8,e<<=8),e>>>28||(t+=4,e<<=4),e>>>30||(t+=2,e<<=2),t-=e>>>31,t},r.toHexString=function(e){return e.toString(16)},r.toBinaryString=function(e){return String(parseInt(String(e),2))},r.bitCount=function(e){return e=e-(e>>>1&1431655765),e=(e&858993459)+(e>>>2&858993459),e=e+(e>>>4)&252645135,e=e+(e>>>8),e=e+(e>>>16),e&63},r.truncDivision=function(e,t){return Math.trunc(e/t)},r.parseInt=function(e,t){return t===void 0&&(t=void 0),parseInt(e,t)},r.MIN_VALUE_32_BITS=-2147483648,r.MAX_VALUE=Number.MAX_SAFE_INTEGER,r}(),we=function(){function r(e,t){e===void 0?(this.size=0,this.bits=new Int32Array(1)):(this.size=e,t==null?this.bits=r.makeArray(e):this.bits=t)}return r.prototype.getSize=function(){return this.size},r.prototype.getSizeInBytes=function(){return Math.floor((this.size+7)/8)},r.prototype.ensureCapacity=function(e){if(e>this.bits.length*32){var t=r.makeArray(e);se.arraycopy(this.bits,0,t,0,this.bits.length),this.bits=t}},r.prototype.get=function(e){return(this.bits[Math.floor(e/32)]&1<<(e&31))!==0},r.prototype.set=function(e){this.bits[Math.floor(e/32)]|=1<<(e&31)},r.prototype.flip=function(e){this.bits[Math.floor(e/32)]^=1<<(e&31)},r.prototype.getNextSet=function(e){var t=this.size;if(e>=t)return t;var n=this.bits,i=Math.floor(e/32),a=n[i];a&=~((1<<(e&31))-1);for(var o=n.length;a===0;){if(++i===o)return t;a=n[i]}var s=i*32+$.numberOfTrailingZeros(a);return s>t?t:s},r.prototype.getNextUnset=function(e){var t=this.size;if(e>=t)return t;var n=this.bits,i=Math.floor(e/32),a=~n[i];a&=~((1<<(e&31))-1);for(var o=n.length;a===0;){if(++i===o)return t;a=~n[i]}var s=i*32+$.numberOfTrailingZeros(a);return s>t?t:s},r.prototype.setBulk=function(e,t){this.bits[Math.floor(e/32)]=t},r.prototype.setRange=function(e,t){if(t<e||e<0||t>this.size)throw new R;if(t!==e){t--;for(var n=Math.floor(e/32),i=Math.floor(t/32),a=this.bits,o=n;o<=i;o++){var s=o>n?0:e&31,l=o<i?31:t&31,u=(2<<l)-(1<<s);a[o]|=u}}},r.prototype.clear=function(){for(var e=this.bits.length,t=this.bits,n=0;n<e;n++)t[n]=0},r.prototype.isRange=function(e,t,n){if(t<e||e<0||t>this.size)throw new R;if(t===e)return!0;t--;for(var i=Math.floor(e/32),a=Math.floor(t/32),o=this.bits,s=i;s<=a;s++){var l=s>i?0:e&31,u=s<a?31:t&31,c=(2<<u)-(1<<l)&4294967295;if((o[s]&c)!==(n?c:0))return!1}return!0},r.prototype.appendBit=function(e){this.ensureCapacity(this.size+1),e&&(this.bits[Math.floor(this.size/32)]|=1<<(this.size&31)),this.size++},r.prototype.appendBits=function(e,t){if(t<0||t>32)throw new R("Num bits must be between 0 and 32");this.ensureCapacity(this.size+t);for(var n=t;n>0;n--)this.appendBit((e>>n-1&1)===1)},r.prototype.appendBitArray=function(e){var t=e.size;this.ensureCapacity(this.size+t);for(var n=0;n<t;n++)this.appendBit(e.get(n))},r.prototype.xor=function(e){if(this.size!==e.size)throw new R("Sizes don't match");for(var t=this.bits,n=0,i=t.length;n<i;n++)t[n]^=e.bits[n]},r.prototype.toBytes=function(e,t,n,i){for(var a=0;a<i;a++){for(var o=0,s=0;s<8;s++)this.get(e)&&(o|=1<<7-s),e++;t[n+a]=o}},r.prototype.getBitArray=function(){return this.bits},r.prototype.reverse=function(){for(var e=new Int32Array(this.bits.length),t=Math.floor((this.size-1)/32),n=t+1,i=this.bits,a=0;a<n;a++){var o=i[a];o=o>>1&1431655765|(o&1431655765)<<1,o=o>>2&858993459|(o&858993459)<<2,o=o>>4&252645135|(o&252645135)<<4,o=o>>8&16711935|(o&16711935)<<8,o=o>>16&65535|(o&65535)<<16,e[t-a]=o}if(this.size!==n*32){for(var s=n*32-this.size,l=e[0]>>>s,a=1;a<n;a++){var u=e[a];l|=u<<32-s,e[a-1]=l,l=u>>>s}e[n-1]=l}this.bits=e},r.makeArray=function(e){return new Int32Array(Math.floor((e+31)/32))},r.prototype.equals=function(e){if(!(e instanceof r))return!1;var t=e;return this.size===t.size&&he.equals(this.bits,t.bits)},r.prototype.hashCode=function(){return 31*this.size+he.hashCode(this.bits)},r.prototype.toString=function(){for(var e="",t=0,n=this.size;t<n;t++)(t&7)===0&&(e+=" "),e+=this.get(t)?"X":".";return e},r.prototype.clone=function(){return new r(this.size,this.bits.slice())},r.prototype.toArray=function(){for(var e=[],t=0,n=this.size;t<n;t++)e.push(this.get(t));return e},r}(),Xn;(function(r){r[r.OTHER=0]="OTHER",r[r.PURE_BARCODE=1]="PURE_BARCODE",r[r.POSSIBLE_FORMATS=2]="POSSIBLE_FORMATS",r[r.TRY_HARDER=3]="TRY_HARDER",r[r.CHARACTER_SET=4]="CHARACTER_SET",r[r.ALLOWED_LENGTHS=5]="ALLOWED_LENGTHS",r[r.ASSUME_CODE_39_CHECK_DIGIT=6]="ASSUME_CODE_39_CHECK_DIGIT",r[r.ASSUME_GS1=7]="ASSUME_GS1",r[r.RETURN_CODABAR_START_END=8]="RETURN_CODABAR_START_END",r[r.NEED_RESULT_POINT_CALLBACK=9]="NEED_RESULT_POINT_CALLBACK",r[r.ALLOWED_EAN_EXTENSIONS=10]="ALLOWED_EAN_EXTENSIONS"})(Xn||(Xn={}));const ce=Xn;var Fl=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),F=function(r){Fl(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.getFormatInstance=function(){return new e},e.kind="FormatException",e}(Ue),Pl=function(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},ne;(function(r){r[r.Cp437=0]="Cp437",r[r.ISO8859_1=1]="ISO8859_1",r[r.ISO8859_2=2]="ISO8859_2",r[r.ISO8859_3=3]="ISO8859_3",r[r.ISO8859_4=4]="ISO8859_4",r[r.ISO8859_5=5]="ISO8859_5",r[r.ISO8859_6=6]="ISO8859_6",r[r.ISO8859_7=7]="ISO8859_7",r[r.ISO8859_8=8]="ISO8859_8",r[r.ISO8859_9=9]="ISO8859_9",r[r.ISO8859_10=10]="ISO8859_10",r[r.ISO8859_11=11]="ISO8859_11",r[r.ISO8859_13=12]="ISO8859_13",r[r.ISO8859_14=13]="ISO8859_14",r[r.ISO8859_15=14]="ISO8859_15",r[r.ISO8859_16=15]="ISO8859_16",r[r.SJIS=16]="SJIS",r[r.Cp1250=17]="Cp1250",r[r.Cp1251=18]="Cp1251",r[r.Cp1252=19]="Cp1252",r[r.Cp1256=20]="Cp1256",r[r.UnicodeBigUnmarked=21]="UnicodeBigUnmarked",r[r.UTF8=22]="UTF8",r[r.ASCII=23]="ASCII",r[r.Big5=24]="Big5",r[r.GB18030=25]="GB18030",r[r.EUC_KR=26]="EUC_KR"})(ne||(ne={}));var pe=function(){function r(e,t,n){for(var i,a,o=[],s=3;s<arguments.length;s++)o[s-3]=arguments[s];this.valueIdentifier=e,this.name=n,typeof t=="number"?this.values=Int32Array.from([t]):this.values=t,this.otherEncodingNames=o,r.VALUE_IDENTIFIER_TO_ECI.set(e,this),r.NAME_TO_ECI.set(n,this);for(var l=this.values,u=0,c=l.length;u!==c;u++){var d=l[u];r.VALUES_TO_ECI.set(d,this)}try{for(var p=Pl(o),h=p.next();!h.done;h=p.next()){var g=h.value;r.NAME_TO_ECI.set(g,this)}}catch(x){i={error:x}}finally{try{h&&!h.done&&(a=p.return)&&a.call(p)}finally{if(i)throw i.error}}}return r.prototype.getValueIdentifier=function(){return this.valueIdentifier},r.prototype.getName=function(){return this.name},r.prototype.getValue=function(){return this.values[0]},r.getCharacterSetECIByValue=function(e){if(e<0||e>=900)throw new F("incorect value");var t=r.VALUES_TO_ECI.get(e);if(t===void 0)throw new F("incorect value");return t},r.getCharacterSetECIByName=function(e){var t=r.NAME_TO_ECI.get(e);if(t===void 0)throw new F("incorect value");return t},r.prototype.equals=function(e){if(!(e instanceof r))return!1;var t=e;return this.getName()===t.getName()},r.VALUE_IDENTIFIER_TO_ECI=new Map,r.VALUES_TO_ECI=new Map,r.NAME_TO_ECI=new Map,r.Cp437=new r(ne.Cp437,Int32Array.from([0,2]),"Cp437"),r.ISO8859_1=new r(ne.ISO8859_1,Int32Array.from([1,3]),"ISO-8859-1","ISO88591","ISO8859_1"),r.ISO8859_2=new r(ne.ISO8859_2,4,"ISO-8859-2","ISO88592","ISO8859_2"),r.ISO8859_3=new r(ne.ISO8859_3,5,"ISO-8859-3","ISO88593","ISO8859_3"),r.ISO8859_4=new r(ne.ISO8859_4,6,"ISO-8859-4","ISO88594","ISO8859_4"),r.ISO8859_5=new r(ne.ISO8859_5,7,"ISO-8859-5","ISO88595","ISO8859_5"),r.ISO8859_6=new r(ne.ISO8859_6,8,"ISO-8859-6","ISO88596","ISO8859_6"),r.ISO8859_7=new r(ne.ISO8859_7,9,"ISO-8859-7","ISO88597","ISO8859_7"),r.ISO8859_8=new r(ne.ISO8859_8,10,"ISO-8859-8","ISO88598","ISO8859_8"),r.ISO8859_9=new r(ne.ISO8859_9,11,"ISO-8859-9","ISO88599","ISO8859_9"),r.ISO8859_10=new r(ne.ISO8859_10,12,"ISO-8859-10","ISO885910","ISO8859_10"),r.ISO8859_11=new r(ne.ISO8859_11,13,"ISO-8859-11","ISO885911","ISO8859_11"),r.ISO8859_13=new r(ne.ISO8859_13,15,"ISO-8859-13","ISO885913","ISO8859_13"),r.ISO8859_14=new r(ne.ISO8859_14,16,"ISO-8859-14","ISO885914","ISO8859_14"),r.ISO8859_15=new r(ne.ISO8859_15,17,"ISO-8859-15","ISO885915","ISO8859_15"),r.ISO8859_16=new r(ne.ISO8859_16,18,"ISO-8859-16","ISO885916","ISO8859_16"),r.SJIS=new r(ne.SJIS,20,"SJIS","Shift_JIS"),r.Cp1250=new r(ne.Cp1250,21,"Cp1250","windows-1250"),r.Cp1251=new r(ne.Cp1251,22,"Cp1251","windows-1251"),r.Cp1252=new r(ne.Cp1252,23,"Cp1252","windows-1252"),r.Cp1256=new r(ne.Cp1256,24,"Cp1256","windows-1256"),r.UnicodeBigUnmarked=new r(ne.UnicodeBigUnmarked,25,"UnicodeBigUnmarked","UTF-16BE","UnicodeBig"),r.UTF8=new r(ne.UTF8,26,"UTF8","UTF-8"),r.ASCII=new r(ne.ASCII,Int32Array.from([27,170]),"ASCII","US-ASCII"),r.Big5=new r(ne.Big5,28,"Big5"),r.GB18030=new r(ne.GB18030,29,"GB18030","GB2312","EUC_CN","GBK"),r.EUC_KR=new r(ne.EUC_KR,30,"EUC_KR","EUC-KR"),r}(),Bl=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),Wr=function(r){Bl(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.kind="UnsupportedOperationException",e}(Ue),We=function(){function r(){}return r.decode=function(e,t){var n=this.encodingName(t);return this.customDecoder?this.customDecoder(e,n):typeof TextDecoder>"u"||this.shouldDecodeOnFallback(n)?this.decodeFallback(e,n):new TextDecoder(n).decode(e)},r.shouldDecodeOnFallback=function(e){return!r.isBrowser()&&e==="ISO-8859-1"},r.encode=function(e,t){var n=this.encodingName(t);return this.customEncoder?this.customEncoder(e,n):typeof TextEncoder>"u"?this.encodeFallback(e):new TextEncoder().encode(e)},r.isBrowser=function(){return typeof window<"u"&&{}.toString.call(window)==="[object Window]"},r.encodingName=function(e){return typeof e=="string"?e:e.getName()},r.encodingCharacterSet=function(e){return e instanceof pe?e:pe.getCharacterSetECIByName(e)},r.decodeFallback=function(e,t){var n=this.encodingCharacterSet(t);if(r.isDecodeFallbackSupported(n)){for(var i="",a=0,o=e.length;a<o;a++){var s=e[a].toString(16);s.length<2&&(s="0"+s),i+="%"+s}return decodeURIComponent(i)}if(n.equals(pe.UnicodeBigUnmarked))return String.fromCharCode.apply(null,new Uint16Array(e.buffer));throw new Wr("Encoding "+this.encodingName(t)+" not supported by fallback.")},r.isDecodeFallbackSupported=function(e){return e.equals(pe.UTF8)||e.equals(pe.ISO8859_1)||e.equals(pe.ASCII)},r.encodeFallback=function(e){for(var t=btoa(unescape(encodeURIComponent(e))),n=t.split(""),i=[],a=0;a<n.length;a++)i.push(n[a].charCodeAt(0));return new Uint8Array(i)},r}(),Z=function(){function r(){}return r.castAsNonUtf8Char=function(e,t){t===void 0&&(t=null);var n=t?t.getName():this.ISO88591;return We.decode(new Uint8Array([e]),n)},r.guessEncoding=function(e,t){if(t!=null&&t.get(ce.CHARACTER_SET)!==void 0)return t.get(ce.CHARACTER_SET).toString();for(var n=e.length,i=!0,a=!0,o=!0,s=0,l=0,u=0,c=0,d=0,p=0,h=0,g=0,x=0,y=0,w=0,m=e.length>3&&e[0]===239&&e[1]===187&&e[2]===191,_=0;_<n&&(i||a||o);_++){var E=e[_]&255;o&&(s>0?(E&128)===0?o=!1:s--:(E&128)!==0&&((E&64)===0?o=!1:(s++,(E&32)===0?l++:(s++,(E&16)===0?u++:(s++,(E&8)===0?c++:o=!1))))),i&&(E>127&&E<160?i=!1:E>159&&(E<192||E===215||E===247)&&w++),a&&(d>0?E<64||E===127||E>252?a=!1:d--:E===128||E===160||E>239?a=!1:E>160&&E<224?(p++,g=0,h++,h>x&&(x=h)):E>127?(d++,h=0,g++,g>y&&(y=g)):(h=0,g=0))}return o&&s>0&&(o=!1),a&&d>0&&(a=!1),o&&(m||l+u+c>0)?r.UTF8:a&&(r.ASSUME_SHIFT_JIS||x>=3||y>=3)?r.SHIFT_JIS:i&&a?x===2&&p===2||w*10>=n?r.SHIFT_JIS:r.ISO88591:i?r.ISO88591:a?r.SHIFT_JIS:o?r.UTF8:r.PLATFORM_DEFAULT_ENCODING},r.format=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];var i=-1;function a(s,l,u,c,d,p){if(s==="%%")return"%";if(t[++i]!==void 0){s=c?parseInt(c.substr(1)):void 0;var h=d?parseInt(d.substr(1)):void 0,g;switch(p){case"s":g=t[i];break;case"c":g=t[i][0];break;case"f":g=parseFloat(t[i]).toFixed(s);break;case"p":g=parseFloat(t[i]).toPrecision(s);break;case"e":g=parseFloat(t[i]).toExponential(s);break;case"x":g=parseInt(t[i]).toString(h||16);break;case"d":g=parseFloat(parseInt(t[i],h||10).toPrecision(s)).toFixed(0);break}g=typeof g=="object"?JSON.stringify(g):(+g).toString(h);for(var x=parseInt(u),y=u&&u[0]+""=="0"?"0":" ";g.length<x;)g=l!==void 0?g+y:y+g;return g}}var o=/%(-)?(0?[0-9]+)?([.][0-9]+)?([#][0-9]+)?([scfpexd%])/g;return e.replace(o,a)},r.getBytes=function(e,t){return We.encode(e,t)},r.getCharCode=function(e,t){return t===void 0&&(t=0),e.charCodeAt(t)},r.getCharAt=function(e){return String.fromCharCode(e)},r.SHIFT_JIS=pe.SJIS.getName(),r.GB2312="GB2312",r.ISO88591=pe.ISO8859_1.getName(),r.EUC_JP="EUC_JP",r.UTF8=pe.UTF8.getName(),r.PLATFORM_DEFAULT_ENCODING=r.UTF8,r.ASSUME_SHIFT_JIS=!1,r}(),X=function(){function r(e){e===void 0&&(e=""),this.value=e}return r.prototype.enableDecoding=function(e){return this.encoding=e,this},r.prototype.append=function(e){return typeof e=="string"?this.value+=e.toString():this.encoding?this.value+=Z.castAsNonUtf8Char(e,this.encoding):this.value+=String.fromCharCode(e),this},r.prototype.appendChars=function(e,t,n){for(var i=t;t<t+n;i++)this.append(e[i]);return this},r.prototype.length=function(){return this.value.length},r.prototype.charAt=function(e){return this.value.charAt(e)},r.prototype.deleteCharAt=function(e){this.value=this.value.substr(0,e)+this.value.substring(e+1)},r.prototype.setCharAt=function(e,t){this.value=this.value.substr(0,e)+t+this.value.substr(e+1)},r.prototype.substring=function(e,t){return this.value.substring(e,t)},r.prototype.setLengthToZero=function(){this.value=""},r.prototype.toString=function(){return this.value},r.prototype.insert=function(e,t){this.value=this.value.substring(0,e)+t+this.value.substring(e)},r}(),tt=function(){function r(e,t,n,i){if(this.width=e,this.height=t,this.rowSize=n,this.bits=i,t==null&&(t=e),this.height=t,e<1||t<1)throw new R("Both dimensions must be greater than 0");n==null&&(n=Math.floor((e+31)/32)),this.rowSize=n,i==null&&(this.bits=new Int32Array(this.rowSize*this.height))}return r.parseFromBooleanArray=function(e){for(var t=e.length,n=e[0].length,i=new r(n,t),a=0;a<t;a++)for(var o=e[a],s=0;s<n;s++)o[s]&&i.set(s,a);return i},r.parseFromString=function(e,t,n){if(e===null)throw new R("stringRepresentation cannot be null");for(var i=new Array(e.length),a=0,o=0,s=-1,l=0,u=0;u<e.length;)if(e.charAt(u)===`
237
237
  `||e.charAt(u)==="\r"){if(a>o){if(s===-1)s=a-o;else if(a-o!==s)throw new R("row lengths do not match");o=a,l++}u++}else if(e.substring(u,u+t.length)===t)u+=t.length,i[a]=!0,a++;else if(e.substring(u,u+n.length)===n)u+=n.length,i[a]=!1,a++;else throw new R("illegal character encountered: "+e.substring(u));if(a>o){if(s===-1)s=a-o;else if(a-o!==s)throw new R("row lengths do not match");l++}for(var c=new r(s,l),d=0;d<a;d++)i[d]&&c.set(Math.floor(d%s),Math.floor(d/s));return c},r.prototype.get=function(e,t){var n=t*this.rowSize+Math.floor(e/32);return(this.bits[n]>>>(e&31)&1)!==0},r.prototype.set=function(e,t){var n=t*this.rowSize+Math.floor(e/32);this.bits[n]|=1<<(e&31)&4294967295},r.prototype.unset=function(e,t){var n=t*this.rowSize+Math.floor(e/32);this.bits[n]&=~(1<<(e&31)&4294967295)},r.prototype.flip=function(e,t){var n=t*this.rowSize+Math.floor(e/32);this.bits[n]^=1<<(e&31)&4294967295},r.prototype.xor=function(e){if(this.width!==e.getWidth()||this.height!==e.getHeight()||this.rowSize!==e.getRowSize())throw new R("input matrix dimensions do not match");for(var t=new we(Math.floor(this.width/32)+1),n=this.rowSize,i=this.bits,a=0,o=this.height;a<o;a++)for(var s=a*n,l=e.getRow(a,t).getBitArray(),u=0;u<n;u++)i[s+u]^=l[u]},r.prototype.clear=function(){for(var e=this.bits,t=e.length,n=0;n<t;n++)e[n]=0},r.prototype.setRegion=function(e,t,n,i){if(t<0||e<0)throw new R("Left and top must be nonnegative");if(i<1||n<1)throw new R("Height and width must be at least 1");var a=e+n,o=t+i;if(o>this.height||a>this.width)throw new R("The region must fit inside the matrix");for(var s=this.rowSize,l=this.bits,u=t;u<o;u++)for(var c=u*s,d=e;d<a;d++)l[c+Math.floor(d/32)]|=1<<(d&31)&4294967295},r.prototype.getRow=function(e,t){t==null||t.getSize()<this.width?t=new we(this.width):t.clear();for(var n=this.rowSize,i=this.bits,a=e*n,o=0;o<n;o++)t.setBulk(o*32,i[a+o]);return t},r.prototype.setRow=function(e,t){se.arraycopy(t.getBitArray(),0,this.bits,e*this.rowSize,this.rowSize)},r.prototype.rotate180=function(){for(var e=this.getWidth(),t=this.getHeight(),n=new we(e),i=new we(e),a=0,o=Math.floor((t+1)/2);a<o;a++)n=this.getRow(a,n),i=this.getRow(t-1-a,i),n.reverse(),i.reverse(),this.setRow(a,i),this.setRow(t-1-a,n)},r.prototype.getEnclosingRectangle=function(){for(var e=this.width,t=this.height,n=this.rowSize,i=this.bits,a=e,o=t,s=-1,l=-1,u=0;u<t;u++)for(var c=0;c<n;c++){var d=i[u*n+c];if(d!==0){if(u<o&&(o=u),u>l&&(l=u),c*32<a){for(var p=0;(d<<31-p&4294967295)===0;)p++;c*32+p<a&&(a=c*32+p)}if(c*32+31>s){for(var p=31;!(d>>>p);)p--;c*32+p>s&&(s=c*32+p)}}}return s<a||l<o?null:Int32Array.from([a,o,s-a+1,l-o+1])},r.prototype.getTopLeftOnBit=function(){for(var e=this.rowSize,t=this.bits,n=0;n<t.length&&t[n]===0;)n++;if(n===t.length)return null;for(var i=n/e,a=n%e*32,o=t[n],s=0;(o<<31-s&4294967295)===0;)s++;return a+=s,Int32Array.from([a,i])},r.prototype.getBottomRightOnBit=function(){for(var e=this.rowSize,t=this.bits,n=t.length-1;n>=0&&t[n]===0;)n--;if(n<0)return null;for(var i=Math.floor(n/e),a=Math.floor(n%e)*32,o=t[n],s=31;!(o>>>s);)s--;return a+=s,Int32Array.from([a,i])},r.prototype.getWidth=function(){return this.width},r.prototype.getHeight=function(){return this.height},r.prototype.getRowSize=function(){return this.rowSize},r.prototype.equals=function(e){if(!(e instanceof r))return!1;var t=e;return this.width===t.width&&this.height===t.height&&this.rowSize===t.rowSize&&he.equals(this.bits,t.bits)},r.prototype.hashCode=function(){var e=this.width;return e=31*e+this.width,e=31*e+this.height,e=31*e+this.rowSize,e=31*e+he.hashCode(this.bits),e},r.prototype.toString=function(e,t,n){return e===void 0&&(e="X "),t===void 0&&(t=" "),n===void 0&&(n=`
238
238
  `),this.buildToString(e,t,n)},r.prototype.buildToString=function(e,t,n){for(var i=new X,a=0,o=this.height;a<o;a++){for(var s=0,l=this.width;s<l;s++)i.append(this.get(s,a)?e:t);i.append(n)}return i.toString()},r.prototype.clone=function(){return new r(this.width,this.height,this.rowSize,this.bits.slice())},r}(),Ll=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),T=function(r){Ll(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.getNotFoundInstance=function(){return new e},e.kind="NotFoundException",e}(Ue),zl=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),kl=function(r){zl(e,r);function e(t){var n=r.call(this,t)||this;return n.luminances=e.EMPTY,n.buckets=new Int32Array(e.LUMINANCE_BUCKETS),n}return e.prototype.getBlackRow=function(t,n){var i=this.getLuminanceSource(),a=i.getWidth();n==null||n.getSize()<a?n=new we(a):n.clear(),this.initArrays(a);for(var o=i.getRow(t,this.luminances),s=this.buckets,l=0;l<a;l++)s[(o[l]&255)>>e.LUMINANCE_SHIFT]++;var u=e.estimateBlackPoint(s);if(a<3)for(var l=0;l<a;l++)(o[l]&255)<u&&n.set(l);else for(var c=o[0]&255,d=o[1]&255,l=1;l<a-1;l++){var p=o[l+1]&255;(d*4-c-p)/2<u&&n.set(l),c=d,d=p}return n},e.prototype.getBlackMatrix=function(){var t=this.getLuminanceSource(),n=t.getWidth(),i=t.getHeight(),a=new tt(n,i);this.initArrays(n);for(var o=this.buckets,s=1;s<5;s++)for(var l=Math.floor(i*s/5),u=t.getRow(l,this.luminances),c=Math.floor(n*4/5),d=Math.floor(n/5);d<c;d++){var p=u[d]&255;o[p>>e.LUMINANCE_SHIFT]++}for(var h=e.estimateBlackPoint(o),g=t.getMatrix(),s=0;s<i;s++)for(var x=s*n,d=0;d<n;d++){var p=g[x+d]&255;p<h&&a.set(d,s)}return a},e.prototype.createBinarizer=function(t){return new e(t)},e.prototype.initArrays=function(t){this.luminances.length<t&&(this.luminances=new Uint8ClampedArray(t));for(var n=this.buckets,i=0;i<e.LUMINANCE_BUCKETS;i++)n[i]=0},e.estimateBlackPoint=function(t){for(var n=t.length,i=0,a=0,o=0,s=0;s<n;s++)t[s]>o&&(a=s,o=t[s]),t[s]>i&&(i=t[s]);for(var l=0,u=0,s=0;s<n;s++){var c=s-a,d=t[s]*c*c;d>u&&(l=s,u=d)}if(a>l){var p=a;a=l,l=p}if(l-a<=n/16)throw new T;for(var h=l-1,g=-1,s=l-1;s>a;s--){var x=s-a,d=x*x*(l-s)*(i-t[s]);d>g&&(h=s,g=d)}return h<<e.LUMINANCE_SHIFT},e.LUMINANCE_BITS=5,e.LUMINANCE_SHIFT=8-e.LUMINANCE_BITS,e.LUMINANCE_BUCKETS=1<<e.LUMINANCE_BITS,e.EMPTY=Uint8ClampedArray.from([0]),e}(Tl),Rl=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),Ul=function(r){Rl(e,r);function e(t){var n=r.call(this,t)||this;return n.matrix=null,n}return e.prototype.getBlackMatrix=function(){if(this.matrix!==null)return this.matrix;var t=this.getLuminanceSource(),n=t.getWidth(),i=t.getHeight();if(n>=e.MINIMUM_DIMENSION&&i>=e.MINIMUM_DIMENSION){var a=t.getMatrix(),o=n>>e.BLOCK_SIZE_POWER;(n&e.BLOCK_SIZE_MASK)!==0&&o++;var s=i>>e.BLOCK_SIZE_POWER;(i&e.BLOCK_SIZE_MASK)!==0&&s++;var l=e.calculateBlackPoints(a,o,s,n,i),u=new tt(n,i);e.calculateThresholdForBlock(a,o,s,n,i,l,u),this.matrix=u}else this.matrix=r.prototype.getBlackMatrix.call(this);return this.matrix},e.prototype.createBinarizer=function(t){return new e(t)},e.calculateThresholdForBlock=function(t,n,i,a,o,s,l){for(var u=o-e.BLOCK_SIZE,c=a-e.BLOCK_SIZE,d=0;d<i;d++){var p=d<<e.BLOCK_SIZE_POWER;p>u&&(p=u);for(var h=e.cap(d,2,i-3),g=0;g<n;g++){var x=g<<e.BLOCK_SIZE_POWER;x>c&&(x=c);for(var y=e.cap(g,2,n-3),w=0,m=-2;m<=2;m++){var _=s[h+m];w+=_[y-2]+_[y-1]+_[y]+_[y+1]+_[y+2]}var E=w/25;e.thresholdBlock(t,x,p,E,a,l)}}},e.cap=function(t,n,i){return t<n?n:t>i?i:t},e.thresholdBlock=function(t,n,i,a,o,s){for(var l=0,u=i*o+n;l<e.BLOCK_SIZE;l++,u+=o)for(var c=0;c<e.BLOCK_SIZE;c++)(t[u+c]&255)<=a&&s.set(n+c,i+l)},e.calculateBlackPoints=function(t,n,i,a,o){for(var s=o-e.BLOCK_SIZE,l=a-e.BLOCK_SIZE,u=new Array(i),c=0;c<i;c++){u[c]=new Int32Array(n);var d=c<<e.BLOCK_SIZE_POWER;d>s&&(d=s);for(var p=0;p<n;p++){var h=p<<e.BLOCK_SIZE_POWER;h>l&&(h=l);for(var g=0,x=255,y=0,w=0,m=d*a+h;w<e.BLOCK_SIZE;w++,m+=a){for(var _=0;_<e.BLOCK_SIZE;_++){var E=t[m+_]&255;g+=E,E<x&&(x=E),E>y&&(y=E)}if(y-x>e.MIN_DYNAMIC_RANGE)for(w++,m+=a;w<e.BLOCK_SIZE;w++,m+=a)for(var _=0;_<e.BLOCK_SIZE;_++)g+=t[m+_]&255}var I=g>>e.BLOCK_SIZE_POWER*2;if(y-x<=e.MIN_DYNAMIC_RANGE&&(I=x/2,c>0&&p>0)){var b=(u[c-1][p]+2*u[c][p-1]+u[c-1][p-1])/4;x<b&&(I=b)}u[c][p]=I}}return u},e.BLOCK_SIZE_POWER=3,e.BLOCK_SIZE=1<<e.BLOCK_SIZE_POWER,e.BLOCK_SIZE_MASK=e.BLOCK_SIZE-1,e.MINIMUM_DIMENSION=e.BLOCK_SIZE*5,e.MIN_DYNAMIC_RANGE=24,e}(kl),jr=function(){function r(e,t){this.width=e,this.height=t}return r.prototype.getWidth=function(){return this.width},r.prototype.getHeight=function(){return this.height},r.prototype.isCropSupported=function(){return!1},r.prototype.crop=function(e,t,n,i){throw new Wr("This luminance source does not support cropping.")},r.prototype.isRotateSupported=function(){return!1},r.prototype.rotateCounterClockwise=function(){throw new Wr("This luminance source does not support rotation by 90 degrees.")},r.prototype.rotateCounterClockwise45=function(){throw new Wr("This luminance source does not support rotation by 45 degrees.")},r.prototype.toString=function(){for(var e=new Uint8ClampedArray(this.width),t=new X,n=0;n<this.height;n++){for(var i=this.getRow(n,e),a=0;a<this.width;a++){var o=i[a]&255,s=void 0;o<64?s="#":o<128?s="+":o<192?s=".":s=" ",t.append(s)}t.append(`
239
239
  `)}return t.toString()},r}(),Hl=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),$n=function(r){Hl(e,r);function e(t){var n=r.call(this,t.getWidth(),t.getHeight())||this;return n.delegate=t,n}return e.prototype.getRow=function(t,n){for(var i=this.delegate.getRow(t,n),a=this.getWidth(),o=0;o<a;o++)i[o]=255-(i[o]&255);return i},e.prototype.getMatrix=function(){for(var t=this.delegate.getMatrix(),n=this.getWidth()*this.getHeight(),i=new Uint8ClampedArray(n),a=0;a<n;a++)i[a]=255-(t[a]&255);return i},e.prototype.isCropSupported=function(){return this.delegate.isCropSupported()},e.prototype.crop=function(t,n,i,a){return new e(this.delegate.crop(t,n,i,a))},e.prototype.isRotateSupported=function(){return this.delegate.isRotateSupported()},e.prototype.invert=function(){return this.delegate},e.prototype.rotateCounterClockwise=function(){return new e(this.delegate.rotateCounterClockwise())},e.prototype.rotateCounterClockwise45=function(){return new e(this.delegate.rotateCounterClockwise45())},e}(jr),Gl=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),ql=function(r){Gl(e,r);function e(t){var n=r.call(this,t.width,t.height)||this;return n.canvas=t,n.tempCanvasElement=null,n.buffer=e.makeBufferFromCanvasImageData(t),n}return e.makeBufferFromCanvasImageData=function(t){var n=t.getContext("2d").getImageData(0,0,t.width,t.height);return e.toGrayscaleBuffer(n.data,t.width,t.height)},e.toGrayscaleBuffer=function(t,n,i){var a=new Uint8ClampedArray(n*i);if(e.FRAME_INDEX=!e.FRAME_INDEX,e.FRAME_INDEX)for(var o=0,s=0,l=t.length;o<l;o+=4,s++){var u=void 0,c=t[o+3];if(c===0)u=255;else{var d=t[o],p=t[o+1],h=t[o+2];u=306*d+601*p+117*h+512>>10}a[s]=u}else for(var o=0,s=0,g=t.length;o<g;o+=4,s++){var u=void 0,c=t[o+3];if(c===0)u=255;else{var d=t[o],p=t[o+1],h=t[o+2];u=306*d+601*p+117*h+512>>10}a[s]=255-u}return a},e.prototype.getRow=function(t,n){if(t<0||t>=this.getHeight())throw new R("Requested row is outside the image: "+t);var i=this.getWidth(),a=t*i;return n===null?n=this.buffer.slice(a,a+i):(n.length<i&&(n=new Uint8ClampedArray(i)),n.set(this.buffer.slice(a,a+i))),n},e.prototype.getMatrix=function(){return this.buffer},e.prototype.isCropSupported=function(){return!0},e.prototype.crop=function(t,n,i,a){return r.prototype.crop.call(this,t,n,i,a),this},e.prototype.isRotateSupported=function(){return!0},e.prototype.rotateCounterClockwise=function(){return this.rotate(-90),this},e.prototype.rotateCounterClockwise45=function(){return this.rotate(-45),this},e.prototype.getTempCanvasElement=function(){if(this.tempCanvasElement===null){var t=this.canvas.ownerDocument.createElement("canvas");t.width=this.canvas.width,t.height=this.canvas.height,this.tempCanvasElement=t}return this.tempCanvasElement},e.prototype.rotate=function(t){var n=this.getTempCanvasElement(),i=n.getContext("2d"),a=t*e.DEGREE_TO_RADIANS,o=this.canvas.width,s=this.canvas.height,l=Math.ceil(Math.abs(Math.cos(a))*o+Math.abs(Math.sin(a))*s),u=Math.ceil(Math.abs(Math.sin(a))*o+Math.abs(Math.cos(a))*s);return n.width=l,n.height=u,i.translate(l/2,u/2),i.rotate(a),i.drawImage(this.canvas,o/-2,s/-2),this.buffer=e.makeBufferFromCanvasImageData(n),this},e.prototype.invert=function(){return new $n(this)},e.DEGREE_TO_RADIANS=Math.PI/180,e.FRAME_INDEX=!0,e}(jr),Xl=function(){function r(e,t,n){this.deviceId=e,this.label=t,this.kind="videoinput",this.groupId=n||void 0}return r.prototype.toJSON=function(){return{kind:this.kind,groupId:this.groupId,deviceId:this.deviceId,label:this.label}},r}(),Be=function(r,e,t,n){function i(a){return a instanceof t?a:new t(function(o){o(a)})}return new(t||(t=Promise))(function(a,o){function s(c){try{u(n.next(c))}catch(d){o(d)}}function l(c){try{u(n.throw(c))}catch(d){o(d)}}function u(c){c.done?a(c.value):i(c.value).then(s,l)}u((n=n.apply(r,e||[])).next())})},Le=function(r,e){var t={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},n,i,a,o;return o={next:s(0),throw:s(1),return:s(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function s(u){return function(c){return l([u,c])}}function l(u){if(n)throw new TypeError("Generator is already executing.");for(;t;)try{if(n=1,i&&(a=u[0]&2?i.return:u[0]?i.throw||((a=i.return)&&a.call(i),0):i.next)&&!(a=a.call(i,u[1])).done)return a;switch(i=0,a&&(u=[u[0]&2,a.value]),u[0]){case 0:case 1:a=u;break;case 4:return t.label++,{value:u[1],done:!1};case 5:t.label++,i=u[1],u=[0];continue;case 7:u=t.ops.pop(),t.trys.pop();continue;default:if(a=t.trys,!(a=a.length>0&&a[a.length-1])&&(u[0]===6||u[0]===2)){t=0;continue}if(u[0]===3&&(!a||u[1]>a[0]&&u[1]<a[3])){t.label=u[1];break}if(u[0]===6&&t.label<a[1]){t.label=a[1],a=u;break}if(a&&t.label<a[2]){t.label=a[2],t.ops.push(u);break}a[2]&&t.ops.pop(),t.trys.pop();continue}u=e.call(r,t)}catch(c){u=[6,c],i=0}finally{n=a=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}},$l=function(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},zt=function(){function r(e,t,n){t===void 0&&(t=500),this.reader=e,this.timeBetweenScansMillis=t,this._hints=n,this._stopContinuousDecode=!1,this._stopAsyncDecode=!1,this._timeBetweenDecodingAttempts=0}return Object.defineProperty(r.prototype,"hasNavigator",{get:function(){return typeof navigator<"u"},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"isMediaDevicesSuported",{get:function(){return this.hasNavigator&&!!navigator.mediaDevices},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"canEnumerateDevices",{get:function(){return!!(this.isMediaDevicesSuported&&navigator.mediaDevices.enumerateDevices)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"timeBetweenDecodingAttempts",{get:function(){return this._timeBetweenDecodingAttempts},set:function(e){this._timeBetweenDecodingAttempts=e<0?0:e},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"hints",{get:function(){return this._hints},set:function(e){this._hints=e||null},enumerable:!1,configurable:!0}),r.prototype.listVideoInputDevices=function(){return Be(this,void 0,void 0,function(){var e,t,n,i,a,o,s,l,u,c,d,p;return Le(this,function(h){switch(h.label){case 0:if(!this.hasNavigator)throw new Error("Can't enumerate devices, navigator is not present.");if(!this.canEnumerateDevices)throw new Error("Can't enumerate devices, method not supported.");return[4,navigator.mediaDevices.enumerateDevices()];case 1:e=h.sent(),t=[];try{for(n=$l(e),i=n.next();!i.done;i=n.next())a=i.value,o=a.kind==="video"?"videoinput":a.kind,o==="videoinput"&&(s=a.deviceId||a.id,l=a.label||"Video device "+(t.length+1),u=a.groupId,c={deviceId:s,label:l,kind:o,groupId:u},t.push(c))}catch(g){d={error:g}}finally{try{i&&!i.done&&(p=n.return)&&p.call(n)}finally{if(d)throw d.error}}return[2,t]}})})},r.prototype.getVideoInputDevices=function(){return Be(this,void 0,void 0,function(){var e;return Le(this,function(t){switch(t.label){case 0:return[4,this.listVideoInputDevices()];case 1:return e=t.sent(),[2,e.map(function(n){return new Xl(n.deviceId,n.label)})]}})})},r.prototype.findDeviceById=function(e){return Be(this,void 0,void 0,function(){var t;return Le(this,function(n){switch(n.label){case 0:return[4,this.listVideoInputDevices()];case 1:return t=n.sent(),t?[2,t.find(function(i){return i.deviceId===e})]:[2,null]}})})},r.prototype.decodeFromInputVideoDevice=function(e,t){return Be(this,void 0,void 0,function(){return Le(this,function(n){switch(n.label){case 0:return[4,this.decodeOnceFromVideoDevice(e,t)];case 1:return[2,n.sent()]}})})},r.prototype.decodeOnceFromVideoDevice=function(e,t){return Be(this,void 0,void 0,function(){var n,i;return Le(this,function(a){switch(a.label){case 0:return this.reset(),e?n={deviceId:{exact:e}}:n={facingMode:"environment"},i={video:n},[4,this.decodeOnceFromConstraints(i,t)];case 1:return[2,a.sent()]}})})},r.prototype.decodeOnceFromConstraints=function(e,t){return Be(this,void 0,void 0,function(){var n;return Le(this,function(i){switch(i.label){case 0:return[4,navigator.mediaDevices.getUserMedia(e)];case 1:return n=i.sent(),[4,this.decodeOnceFromStream(n,t)];case 2:return[2,i.sent()]}})})},r.prototype.decodeOnceFromStream=function(e,t){return Be(this,void 0,void 0,function(){var n,i;return Le(this,function(a){switch(a.label){case 0:return this.reset(),[4,this.attachStreamToVideo(e,t)];case 1:return n=a.sent(),[4,this.decodeOnce(n)];case 2:return i=a.sent(),[2,i]}})})},r.prototype.decodeFromInputVideoDeviceContinuously=function(e,t,n){return Be(this,void 0,void 0,function(){return Le(this,function(i){switch(i.label){case 0:return[4,this.decodeFromVideoDevice(e,t,n)];case 1:return[2,i.sent()]}})})},r.prototype.decodeFromVideoDevice=function(e,t,n){return Be(this,void 0,void 0,function(){var i,a;return Le(this,function(o){switch(o.label){case 0:return e?i={deviceId:{exact:e}}:i={facingMode:"environment"},a={video:i},[4,this.decodeFromConstraints(a,t,n)];case 1:return[2,o.sent()]}})})},r.prototype.decodeFromConstraints=function(e,t,n){return Be(this,void 0,void 0,function(){var i;return Le(this,function(a){switch(a.label){case 0:return[4,navigator.mediaDevices.getUserMedia(e)];case 1:return i=a.sent(),[4,this.decodeFromStream(i,t,n)];case 2:return[2,a.sent()]}})})},r.prototype.decodeFromStream=function(e,t,n){return Be(this,void 0,void 0,function(){var i;return Le(this,function(a){switch(a.label){case 0:return this.reset(),[4,this.attachStreamToVideo(e,t)];case 1:return i=a.sent(),[4,this.decodeContinuously(i,n)];case 2:return[2,a.sent()]}})})},r.prototype.stopAsyncDecode=function(){this._stopAsyncDecode=!0},r.prototype.stopContinuousDecode=function(){this._stopContinuousDecode=!0},r.prototype.attachStreamToVideo=function(e,t){return Be(this,void 0,void 0,function(){var n;return Le(this,function(i){switch(i.label){case 0:return n=this.prepareVideoElement(t),this.addVideoSource(n,e),this.videoElement=n,this.stream=e,[4,this.playVideoOnLoadAsync(n)];case 1:return i.sent(),[2,n]}})})},r.prototype.playVideoOnLoadAsync=function(e){var t=this;return new Promise(function(n,i){return t.playVideoOnLoad(e,function(){return n()})})},r.prototype.playVideoOnLoad=function(e,t){var n=this;this.videoEndedListener=function(){return n.stopStreams()},this.videoCanPlayListener=function(){return n.tryPlayVideo(e)},e.addEventListener("ended",this.videoEndedListener),e.addEventListener("canplay",this.videoCanPlayListener),e.addEventListener("playing",t),this.tryPlayVideo(e)},r.prototype.isVideoPlaying=function(e){return e.currentTime>0&&!e.paused&&!e.ended&&e.readyState>2},r.prototype.tryPlayVideo=function(e){return Be(this,void 0,void 0,function(){return Le(this,function(t){switch(t.label){case 0:if(this.isVideoPlaying(e))return console.warn("Trying to play video that is already playing."),[2];t.label=1;case 1:return t.trys.push([1,3,,4]),[4,e.play()];case 2:return t.sent(),[3,4];case 3:return t.sent(),console.warn("It was not possible to play the video."),[3,4];case 4:return[2]}})})},r.prototype.getMediaElement=function(e,t){var n=document.getElementById(e);if(!n)throw new Ke("element with id '"+e+"' not found");if(n.nodeName.toLowerCase()!==t.toLowerCase())throw new Ke("element with id '"+e+"' must be an "+t+" element");return n},r.prototype.decodeFromImage=function(e,t){if(!e&&!t)throw new Ke("either imageElement with a src set or an url must be provided");return t&&!e?this.decodeFromImageUrl(t):this.decodeFromImageElement(e)},r.prototype.decodeFromVideo=function(e,t){if(!e&&!t)throw new Ke("Either an element with a src set or an URL must be provided");return t&&!e?this.decodeFromVideoUrl(t):this.decodeFromVideoElement(e)},r.prototype.decodeFromVideoContinuously=function(e,t,n){if(e===void 0&&t===void 0)throw new Ke("Either an element with a src set or an URL must be provided");return t&&!e?this.decodeFromVideoUrlContinuously(t,n):this.decodeFromVideoElementContinuously(e,n)},r.prototype.decodeFromImageElement=function(e){if(!e)throw new Ke("An image element must be provided.");this.reset();var t=this.prepareImageElement(e);this.imageElement=t;var n;return this.isImageLoaded(t)?n=this.decodeOnce(t,!1,!0):n=this._decodeOnLoadImage(t),n},r.prototype.decodeFromVideoElement=function(e){var t=this._decodeFromVideoElementSetup(e);return this._decodeOnLoadVideo(t)},r.prototype.decodeFromVideoElementContinuously=function(e,t){var n=this._decodeFromVideoElementSetup(e);return this._decodeOnLoadVideoContinuously(n,t)},r.prototype._decodeFromVideoElementSetup=function(e){if(!e)throw new Ke("A video element must be provided.");this.reset();var t=this.prepareVideoElement(e);return this.videoElement=t,t},r.prototype.decodeFromImageUrl=function(e){if(!e)throw new Ke("An URL must be provided.");this.reset();var t=this.prepareImageElement();this.imageElement=t;var n=this._decodeOnLoadImage(t);return t.src=e,n},r.prototype.decodeFromVideoUrl=function(e){if(!e)throw new Ke("An URL must be provided.");this.reset();var t=this.prepareVideoElement(),n=this.decodeFromVideoElement(t);return t.src=e,n},r.prototype.decodeFromVideoUrlContinuously=function(e,t){if(!e)throw new Ke("An URL must be provided.");this.reset();var n=this.prepareVideoElement(),i=this.decodeFromVideoElementContinuously(n,t);return n.src=e,i},r.prototype._decodeOnLoadImage=function(e){var t=this;return new Promise(function(n,i){t.imageLoadedListener=function(){return t.decodeOnce(e,!1,!0).then(n,i)},e.addEventListener("load",t.imageLoadedListener)})},r.prototype._decodeOnLoadVideo=function(e){return Be(this,void 0,void 0,function(){return Le(this,function(t){switch(t.label){case 0:return[4,this.playVideoOnLoadAsync(e)];case 1:return t.sent(),[4,this.decodeOnce(e)];case 2:return[2,t.sent()]}})})},r.prototype._decodeOnLoadVideoContinuously=function(e,t){return Be(this,void 0,void 0,function(){return Le(this,function(n){switch(n.label){case 0:return[4,this.playVideoOnLoadAsync(e)];case 1:return n.sent(),this.decodeContinuously(e,t),[2]}})})},r.prototype.isImageLoaded=function(e){return!(!e.complete||e.naturalWidth===0)},r.prototype.prepareImageElement=function(e){var t;return typeof e>"u"&&(t=document.createElement("img"),t.width=200,t.height=200),typeof e=="string"&&(t=this.getMediaElement(e,"img")),e instanceof HTMLImageElement&&(t=e),t},r.prototype.prepareVideoElement=function(e){var t;return!e&&typeof document<"u"&&(t=document.createElement("video"),t.width=200,t.height=200),typeof e=="string"&&(t=this.getMediaElement(e,"video")),e instanceof HTMLVideoElement&&(t=e),t.setAttribute("autoplay","true"),t.setAttribute("muted","true"),t.setAttribute("playsinline","true"),t},r.prototype.decodeOnce=function(e,t,n){var i=this;t===void 0&&(t=!0),n===void 0&&(n=!0),this._stopAsyncDecode=!1;var a=function(o,s){if(i._stopAsyncDecode){s(new T("Video stream has ended before any code could be detected.")),i._stopAsyncDecode=void 0;return}try{var l=i.decode(e);o(l)}catch(p){var u=t&&p instanceof T,c=p instanceof Ce||p instanceof F,d=c&&n;if(u||d)return setTimeout(a,i._timeBetweenDecodingAttempts,o,s);s(p)}};return new Promise(function(o,s){return a(o,s)})},r.prototype.decodeContinuously=function(e,t){var n=this;this._stopContinuousDecode=!1;var i=function(){if(n._stopContinuousDecode){n._stopContinuousDecode=void 0;return}try{var a=n.decode(e);t(a,null),setTimeout(i,n.timeBetweenScansMillis)}catch(l){t(null,l);var o=l instanceof Ce||l instanceof F,s=l instanceof T;(o||s)&&setTimeout(i,n._timeBetweenDecodingAttempts)}};i()},r.prototype.decode=function(e){var t=this.createBinaryBitmap(e);return this.decodeBitmap(t)},r.prototype.createBinaryBitmap=function(e){this.getCaptureCanvasContext(e),e instanceof HTMLVideoElement?this.drawFrameOnCanvas(e):this.drawImageOnCanvas(e);var t=this.getCaptureCanvas(e),n=new ql(t),i=new Ul(n);return new bl(i)},r.prototype.getCaptureCanvasContext=function(e){if(!this.captureCanvasContext){var t=this.getCaptureCanvas(e),n=void 0;try{n=t.getContext("2d",{willReadFrequently:!0})}catch{n=t.getContext("2d")}this.captureCanvasContext=n}return this.captureCanvasContext},r.prototype.getCaptureCanvas=function(e){if(!this.captureCanvas){var t=this.createCaptureCanvas(e);this.captureCanvas=t}return this.captureCanvas},r.prototype.drawFrameOnCanvas=function(e,t,n){t===void 0&&(t={sx:0,sy:0,sWidth:e.videoWidth,sHeight:e.videoHeight,dx:0,dy:0,dWidth:e.videoWidth,dHeight:e.videoHeight}),n===void 0&&(n=this.captureCanvasContext),n.drawImage(e,t.sx,t.sy,t.sWidth,t.sHeight,t.dx,t.dy,t.dWidth,t.dHeight)},r.prototype.drawImageOnCanvas=function(e,t,n){t===void 0&&(t={sx:0,sy:0,sWidth:e.naturalWidth,sHeight:e.naturalHeight,dx:0,dy:0,dWidth:e.naturalWidth,dHeight:e.naturalHeight}),n===void 0&&(n=this.captureCanvasContext),n.drawImage(e,t.sx,t.sy,t.sWidth,t.sHeight,t.dx,t.dy,t.dWidth,t.dHeight)},r.prototype.decodeBitmap=function(e){return this.reader.decode(e,this._hints)},r.prototype.createCaptureCanvas=function(e){if(typeof document>"u")return this._destroyCaptureCanvas(),null;var t=document.createElement("canvas"),n,i;return typeof e<"u"&&(e instanceof HTMLVideoElement?(n=e.videoWidth,i=e.videoHeight):e instanceof HTMLImageElement&&(n=e.naturalWidth||e.width,i=e.naturalHeight||e.height)),t.style.width=n+"px",t.style.height=i+"px",t.width=n,t.height=i,t},r.prototype.stopStreams=function(){this.stream&&(this.stream.getVideoTracks().forEach(function(e){return e.stop()}),this.stream=void 0),this._stopAsyncDecode===!1&&this.stopAsyncDecode(),this._stopContinuousDecode===!1&&this.stopContinuousDecode()},r.prototype.reset=function(){this.stopStreams(),this._destroyVideoElement(),this._destroyImageElement(),this._destroyCaptureCanvas()},r.prototype._destroyVideoElement=function(){this.videoElement&&(typeof this.videoEndedListener<"u"&&this.videoElement.removeEventListener("ended",this.videoEndedListener),typeof this.videoPlayingEventListener<"u"&&this.videoElement.removeEventListener("playing",this.videoPlayingEventListener),typeof this.videoCanPlayListener<"u"&&this.videoElement.removeEventListener("loadedmetadata",this.videoCanPlayListener),this.cleanVideoSource(this.videoElement),this.videoElement=void 0)},r.prototype._destroyImageElement=function(){this.imageElement&&(this.imageLoadedListener!==void 0&&this.imageElement.removeEventListener("load",this.imageLoadedListener),this.imageElement.src=void 0,this.imageElement.removeAttribute("src"),this.imageElement=void 0)},r.prototype._destroyCaptureCanvas=function(){this.captureCanvasContext=void 0,this.captureCanvas=void 0},r.prototype.addVideoSource=function(e,t){try{e.srcObject=t}catch{e.src=URL.createObjectURL(t)}},r.prototype.cleanVideoSource=function(e){try{e.srcObject=null}catch{e.src=""}this.videoElement.removeAttribute("src")},r}(),Te=function(){function r(e,t,n,i,a,o){n===void 0&&(n=t==null?0:8*t.length),o===void 0&&(o=se.currentTimeMillis()),this.text=e,this.rawBytes=t,this.numBits=n,this.resultPoints=i,this.format=a,this.timestamp=o,this.text=e,this.rawBytes=t,n==null?this.numBits=t==null?0:8*t.length:this.numBits=n,this.resultPoints=i,this.format=a,this.resultMetadata=null,o==null?this.timestamp=se.currentTimeMillis():this.timestamp=o}return r.prototype.getText=function(){return this.text},r.prototype.getRawBytes=function(){return this.rawBytes},r.prototype.getNumBits=function(){return this.numBits},r.prototype.getResultPoints=function(){return this.resultPoints},r.prototype.getBarcodeFormat=function(){return this.format},r.prototype.getResultMetadata=function(){return this.resultMetadata},r.prototype.putMetadata=function(e,t){this.resultMetadata===null&&(this.resultMetadata=new Map),this.resultMetadata.set(e,t)},r.prototype.putAllMetadata=function(e){e!==null&&(this.resultMetadata===null?this.resultMetadata=e:this.resultMetadata=new Map(e))},r.prototype.addResultPoints=function(e){var t=this.resultPoints;if(t===null)this.resultPoints=e;else if(e!==null&&e.length>0){var n=new Array(t.length+e.length);se.arraycopy(t,0,n,0,t.length),se.arraycopy(e,0,n,t.length,e.length),this.resultPoints=n}},r.prototype.getTimestamp=function(){return this.timestamp},r.prototype.toString=function(){return this.text},r}(),Wn;(function(r){r[r.AZTEC=0]="AZTEC",r[r.CODABAR=1]="CODABAR",r[r.CODE_39=2]="CODE_39",r[r.CODE_93=3]="CODE_93",r[r.CODE_128=4]="CODE_128",r[r.DATA_MATRIX=5]="DATA_MATRIX",r[r.EAN_8=6]="EAN_8",r[r.EAN_13=7]="EAN_13",r[r.ITF=8]="ITF",r[r.MAXICODE=9]="MAXICODE",r[r.PDF_417=10]="PDF_417",r[r.QR_CODE=11]="QR_CODE",r[r.RSS_14=12]="RSS_14",r[r.RSS_EXPANDED=13]="RSS_EXPANDED",r[r.UPC_A=14]="UPC_A",r[r.UPC_E=15]="UPC_E",r[r.UPC_EAN_EXTENSION=16]="UPC_EAN_EXTENSION"})(Wn||(Wn={}));const P=Wn;var jn;(function(r){r[r.OTHER=0]="OTHER",r[r.ORIENTATION=1]="ORIENTATION",r[r.BYTE_SEGMENTS=2]="BYTE_SEGMENTS",r[r.ERROR_CORRECTION_LEVEL=3]="ERROR_CORRECTION_LEVEL",r[r.ISSUE_NUMBER=4]="ISSUE_NUMBER",r[r.SUGGESTED_PRICE=5]="SUGGESTED_PRICE",r[r.POSSIBLE_COUNTRY=6]="POSSIBLE_COUNTRY",r[r.UPC_EAN_EXTENSION=7]="UPC_EAN_EXTENSION",r[r.PDF417_EXTRA_METADATA=8]="PDF417_EXTRA_METADATA",r[r.STRUCTURED_APPEND_SEQUENCE=9]="STRUCTURED_APPEND_SEQUENCE",r[r.STRUCTURED_APPEND_PARITY=10]="STRUCTURED_APPEND_PARITY"})(jn||(jn={}));const Ae=jn;var Yr=function(){function r(e,t,n,i,a,o){a===void 0&&(a=-1),o===void 0&&(o=-1),this.rawBytes=e,this.text=t,this.byteSegments=n,this.ecLevel=i,this.structuredAppendSequenceNumber=a,this.structuredAppendParity=o,this.numBits=e==null?0:8*e.length}return r.prototype.getRawBytes=function(){return this.rawBytes},r.prototype.getNumBits=function(){return this.numBits},r.prototype.setNumBits=function(e){this.numBits=e},r.prototype.getText=function(){return this.text},r.prototype.getByteSegments=function(){return this.byteSegments},r.prototype.getECLevel=function(){return this.ecLevel},r.prototype.getErrorsCorrected=function(){return this.errorsCorrected},r.prototype.setErrorsCorrected=function(e){this.errorsCorrected=e},r.prototype.getErasures=function(){return this.erasures},r.prototype.setErasures=function(e){this.erasures=e},r.prototype.getOther=function(){return this.other},r.prototype.setOther=function(e){this.other=e},r.prototype.hasStructuredAppend=function(){return this.structuredAppendParity>=0&&this.structuredAppendSequenceNumber>=0},r.prototype.getStructuredAppendParity=function(){return this.structuredAppendParity},r.prototype.getStructuredAppendSequenceNumber=function(){return this.structuredAppendSequenceNumber},r}(),hr=function(){function r(){}return r.prototype.exp=function(e){return this.expTable[e]},r.prototype.log=function(e){if(e===0)throw new R;return this.logTable[e]},r.addOrSubtract=function(e,t){return e^t},r}(),ot=function(){function r(e,t){if(t.length===0)throw new R;this.field=e;var n=t.length;if(n>1&&t[0]===0){for(var i=1;i<n&&t[i]===0;)i++;i===n?this.coefficients=Int32Array.from([0]):(this.coefficients=new Int32Array(n-i),se.arraycopy(t,i,this.coefficients,0,this.coefficients.length))}else this.coefficients=t}return r.prototype.getCoefficients=function(){return this.coefficients},r.prototype.getDegree=function(){return this.coefficients.length-1},r.prototype.isZero=function(){return this.coefficients[0]===0},r.prototype.getCoefficient=function(e){return this.coefficients[this.coefficients.length-1-e]},r.prototype.evaluateAt=function(e){if(e===0)return this.getCoefficient(0);var t=this.coefficients,n;if(e===1){n=0;for(var i=0,a=t.length;i!==a;i++){var o=t[i];n=hr.addOrSubtract(n,o)}return n}n=t[0];for(var s=t.length,l=this.field,i=1;i<s;i++)n=hr.addOrSubtract(l.multiply(e,n),t[i]);return n},r.prototype.addOrSubtract=function(e){if(!this.field.equals(e.field))throw new R("GenericGFPolys do not have same GenericGF field");if(this.isZero())return e;if(e.isZero())return this;var t=this.coefficients,n=e.coefficients;if(t.length>n.length){var i=t;t=n,n=i}var a=new Int32Array(n.length),o=n.length-t.length;se.arraycopy(n,0,a,0,o);for(var s=o;s<n.length;s++)a[s]=hr.addOrSubtract(t[s-o],n[s]);return new r(this.field,a)},r.prototype.multiply=function(e){if(!this.field.equals(e.field))throw new R("GenericGFPolys do not have same GenericGF field");if(this.isZero()||e.isZero())return this.field.getZero();for(var t=this.coefficients,n=t.length,i=e.coefficients,a=i.length,o=new Int32Array(n+a-1),s=this.field,l=0;l<n;l++)for(var u=t[l],c=0;c<a;c++)o[l+c]=hr.addOrSubtract(o[l+c],s.multiply(u,i[c]));return new r(s,o)},r.prototype.multiplyScalar=function(e){if(e===0)return this.field.getZero();if(e===1)return this;for(var t=this.coefficients.length,n=this.field,i=new Int32Array(t),a=this.coefficients,o=0;o<t;o++)i[o]=n.multiply(a[o],e);return new r(n,i)},r.prototype.multiplyByMonomial=function(e,t){if(e<0)throw new R;if(t===0)return this.field.getZero();for(var n=this.coefficients,i=n.length,a=new Int32Array(i+e),o=this.field,s=0;s<i;s++)a[s]=o.multiply(n[s],t);return new r(o,a)},r.prototype.divide=function(e){if(!this.field.equals(e.field))throw new R("GenericGFPolys do not have same GenericGF field");if(e.isZero())throw new R("Divide by 0");for(var t=this.field,n=t.getZero(),i=this,a=e.getCoefficient(e.getDegree()),o=t.inverse(a);i.getDegree()>=e.getDegree()&&!i.isZero();){var s=i.getDegree()-e.getDegree(),l=t.multiply(i.getCoefficient(i.getDegree()),o),u=e.multiplyByMonomial(s,l),c=t.buildMonomial(s,l);n=n.addOrSubtract(c),i=i.addOrSubtract(u)}return[n,i]},r.prototype.toString=function(){for(var e="",t=this.getDegree();t>=0;t--){var n=this.getCoefficient(t);if(n!==0){if(n<0?(e+=" - ",n=-n):e.length>0&&(e+=" + "),t===0||n!==1){var i=this.field.log(n);i===0?e+="1":i===1?e+="a":(e+="a^",e+=i)}t!==0&&(t===1?e+="x":(e+="x^",e+=t))}}return e},r}(),Wl=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),wa=function(r){Wl(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.kind="ArithmeticException",e}(Ue),jl=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),He=function(r){jl(e,r);function e(t,n,i){var a=r.call(this)||this;a.primitive=t,a.size=n,a.generatorBase=i;for(var o=new Int32Array(n),s=1,l=0;l<n;l++)o[l]=s,s*=2,s>=n&&(s^=t,s&=n-1);a.expTable=o;for(var u=new Int32Array(n),l=0;l<n-1;l++)u[o[l]]=l;return a.logTable=u,a.zero=new ot(a,Int32Array.from([0])),a.one=new ot(a,Int32Array.from([1])),a}return e.prototype.getZero=function(){return this.zero},e.prototype.getOne=function(){return this.one},e.prototype.buildMonomial=function(t,n){if(t<0)throw new R;if(n===0)return this.zero;var i=new Int32Array(t+1);return i[0]=n,new ot(this,i)},e.prototype.inverse=function(t){if(t===0)throw new wa;return this.expTable[this.size-this.logTable[t]-1]},e.prototype.multiply=function(t,n){return t===0||n===0?0:this.expTable[(this.logTable[t]+this.logTable[n])%(this.size-1)]},e.prototype.getSize=function(){return this.size},e.prototype.getGeneratorBase=function(){return this.generatorBase},e.prototype.toString=function(){return"GF(0x"+$.toHexString(this.primitive)+","+this.size+")"},e.prototype.equals=function(t){return t===this},e.AZTEC_DATA_12=new e(4201,4096,1),e.AZTEC_DATA_10=new e(1033,1024,1),e.AZTEC_DATA_6=new e(67,64,1),e.AZTEC_PARAM=new e(19,16,1),e.QR_CODE_FIELD_256=new e(285,256,0),e.DATA_MATRIX_FIELD_256=new e(301,256,1),e.AZTEC_DATA_8=e.DATA_MATRIX_FIELD_256,e.MAXICODE_FIELD_64=e.AZTEC_DATA_6,e}(hr),Yl=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),Zr=function(r){Yl(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.kind="ReedSolomonException",e}(Ue),Zl=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)i.hasOwnProperty(a)&&(n[a]=i[a])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),pr=function(r){Zl(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.kind="IllegalStateException",e}(Ue),Kr=function(){function r(e){this.field=e}return r.prototype.decode=function(e,t){for(var n=this.field,i=new ot(n,e),a=new Int32Array(t),o=!0,s=0;s<t;s++){var l=i.evaluateAt(n.exp(s+n.getGeneratorBase()));a[a.length-1-s]=l,l!==0&&(o=!1)}if(!o)for(var u=new ot(n,a),c=this.runEuclideanAlgorithm(n.buildMonomial(t,1),u,t),d=c[0],p=c[1],h=this.findErrorLocations(d),g=this.findErrorMagnitudes(p,h),s=0;s<h.length;s++){var x=e.length-1-n.log(h[s]);if(x<0)throw new Zr("Bad error location");e[x]=He.addOrSubtract(e[x],g[s])}},r.prototype.runEuclideanAlgorithm=function(e,t,n){if(e.getDegree()<t.getDegree()){var i=e;e=t,t=i}for(var a=this.field,o=e,s=t,l=a.getZero(),u=a.getOne();s.getDegree()>=(n/2|0);){var c=o,d=l;if(o=s,l=u,o.isZero())throw new Zr("r_{i-1} was zero");s=c;for(var p=a.getZero(),h=o.getCoefficient(o.getDegree()),g=a.inverse(h);s.getDegree()>=o.getDegree()&&!s.isZero();){var x=s.getDegree()-o.getDegree(),y=a.multiply(s.getCoefficient(s.getDegree()),g);p=p.addOrSubtract(a.buildMonomial(x,y)),s=s.addOrSubtract(o.multiplyByMonomial(x,y))}if(u=p.multiply(l).addOrSubtract(d),s.getDegree()>=o.getDegree())throw new pr("Division algorithm failed to reduce polynomial?")}var w=u.getCoefficient(0);if(w===0)throw new Zr("sigmaTilde(0) was zero");var m=a.inverse(w),_=u.multiplyScalar(m),E=s.multiplyScalar(m);return[_,E]},r.prototype.findErrorLocations=function(e){var t=e.getDegree();if(t===1)return Int32Array.from([e.getCoefficient(1)]);for(var n=new Int32Array(t),i=0,a=this.field,o=1;o<a.getSize()&&i<t;o++)e.evaluateAt(o)===0&&(n[i]=a.inverse(o),i++);if(i!==t)throw new Zr("Error locator degree does not match number of roots");return n},r.prototype.findErrorMagnitudes=function(e,t){for(var n=t.length,i=new Int32Array(n),a=this.field,o=0;o<n;o++){for(var s=a.inverse(t[o]),l=1,u=0;u<n;u++)if(o!==u){var c=a.multiply(t[u],s),d=(c&1)===0?c|1:c&-2;l=a.multiply(l,d)}i[o]=a.multiply(e.evaluateAt(s),a.inverse(l)),a.getGeneratorBase()!==0&&(i[o]=a.multiply(i[o],s))}return i},r}(),Ee;(function(r){r[r.UPPER=0]="UPPER",r[r.LOWER=1]="LOWER",r[r.MIXED=2]="MIXED",r[r.DIGIT=3]="DIGIT",r[r.PUNCT=4]="PUNCT",r[r.BINARY=5]="BINARY"})(Ee||(Ee={}));var ma=function(){function r(){}return r.prototype.decode=function(e){this.ddata=e;var t=e.getBits(),n=this.extractBits(t),i=this.correctBits(n),a=r.convertBoolArrayToByteArray(i),o=r.getEncodedData(i),s=new Yr(a,o,null,null);return s.setNumBits(i.length),s},r.highLevelDecode=function(e){return this.getEncodedData(e)},r.getEncodedData=function(e){for(var t=e.length,n=Ee.UPPER,i=Ee.UPPER,a="",o=0;o<t;)if(i===Ee.BINARY){if(t-o<5)break;var s=r.readCode(e,o,5);if(o+=5,s===0){if(t-o<11)break;s=r.readCode(e,o,11)+31,o+=11}for(var l=0;l<s;l++){if(t-o<8){o=t;break}var u=r.readCode(e,o,8);a+=Z.castAsNonUtf8Char(u),o+=8}i=n}else{var c=i===Ee.DIGIT?4:5;if(t-o<c)break;var u=r.readCode(e,o,c);o+=c;var d=r.getCharacter(i,u);d.startsWith("CTRL_")?(n=i,i=r.getTable(d.charAt(5)),d.charAt(6)==="L"&&(n=i)):(a+=d,i=n)}return a},r.getTable=function(e){switch(e){case"L":return Ee.LOWER;case"P":return Ee.PUNCT;case"M":return Ee.MIXED;case"D":return Ee.DIGIT;case"B":return Ee.BINARY;case"U":default:return Ee.UPPER}},r.getCharacter=function(e,t){switch(e){case Ee.UPPER:return r.UPPER_TABLE[t];case Ee.LOWER:return r.LOWER_TABLE[t];case Ee.MIXED:return r.MIXED_TABLE[t];case Ee.PUNCT:return r.PUNCT_TABLE[t];case Ee.DIGIT:return r.DIGIT_TABLE[t];default:throw new pr("Bad table")}},r.prototype.correctBits=function(e){var t,n;this.ddata.getNbLayers()<=2?(n=6,t=He.AZTEC_DATA_6):this.ddata.getNbLayers()<=8?(n=8,t=He.AZTEC_DATA_8):this.ddata.getNbLayers()<=22?(n=10,t=He.AZTEC_DATA_10):(n=12,t=He.AZTEC_DATA_12);var i=this.ddata.getNbDatablocks(),a=e.length/n;if(a<i)throw new F;for(var o=e.length%n,s=new Int32Array(a),l=0;l<a;l++,o+=n)s[l]=r.readCode(e,o,n);try{var u=new Kr(t);u.decode(s,a-i)}catch(y){throw new F(y)}for(var c=(1<<n)-1,d=0,l=0;l<i;l++){var p=s[l];if(p===0||p===c)throw new F;(p===1||p===c-1)&&d++}for(var h=new Array(i*n-d),g=0,l=0;l<i;l++){var p=s[l];if(p===1||p===c-1)h.fill(p>1,g,g+n-1),g+=n-1;else for(var x=n-1;x>=0;--x)h[g++]=(p&1<<x)!==0}return h},r.prototype.extractBits=function(e){var t=this.ddata.isCompact(),n=this.ddata.getNbLayers(),i=(t?11:14)+n*4,a=new Int32Array(i),o=new Array(this.totalBitsInLayer(n,t));if(t)for(var s=0;s<a.length;s++)a[s]=s;else for(var l=i+1+2*$.truncDivision($.truncDivision(i,2)-1,15),u=i/2,c=$.truncDivision(l,2),s=0;s<u;s++){var d=s+$.truncDivision(s,15);a[u-s-1]=c-d-1,a[u+s]=c+d+1}for(var s=0,p=0;s<n;s++){for(var h=(n-s)*4+(t?9:12),g=s*2,x=i-1-g,y=0;y<h;y++)for(var w=y*2,m=0;m<2;m++)o[p+w+m]=e.get(a[g+m],a[g+y]),o[p+2*h+w+m]=e.get(a[g+y],a[x-m]),o[p+4*h+w+m]=e.get(a[x-m],a[x-y]),o[p+6*h+w+m]=e.get(a[x-y],a[g+m]);p+=h*8}return o},r.readCode=function(e,t,n){for(var i=0,a=t;a<t+n;a++)i<<=1,e[a]&&(i|=1);return i},r.readByte=function(e,t){var n=e.length-t;return n>=8?r.readCode(e,t,8):r.readCode(e,t,n)<<8-n},r.convertBoolArrayToByteArray=function(e){for(var t=new Uint8Array((e.length+7)/8),n=0;n<t.length;n++)t[n]=r.readByte(e,8*n);return t},r.prototype.totalBitsInLayer=function(e,t){return((t?88:112)+16*e)*e},r.UPPER_TABLE=["CTRL_PS"," ","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","CTRL_LL","CTRL_ML","CTRL_DL","CTRL_BS"],r.LOWER_TABLE=["CTRL_PS"," ","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","CTRL_US","CTRL_ML","CTRL_DL","CTRL_BS"],r.MIXED_TABLE=["CTRL_PS"," ","\\1","\\2","\\3","\\4","\\5","\\6","\\7","\b"," ",`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@overmap-ai/forms",
3
- "version": "1.0.36-add-utils.9",
3
+ "version": "1.0.36-add-utils.10",
4
4
  "license": "UNLICENSED",
5
5
  "files": [
6
6
  "dist"