@overmap-ai/forms 1.0.30 → 1.0.32-react-flow-david.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/form/builder/FieldBuilder.d.ts +2 -3
- package/dist/form/builder/FieldSectionBuilder.d.ts +9 -0
- package/dist/form/builder/FieldSectionConditionEdge.d.ts +4 -0
- package/dist/form/builder/FieldSectionConditionMenu.d.ts +10 -0
- package/dist/form/builder/FieldSectionConditionalItem.d.ts +11 -0
- package/dist/form/builder/FieldSectionNode.d.ts +16 -0
- package/dist/form/builder/FieldSectionWithActions.d.ts +2 -3
- package/dist/form/builder/FieldWithActions.d.ts +2 -2
- package/dist/form/builder/constants.d.ts +0 -1
- package/dist/form/builder/flow/CustomNode.d.ts +1 -0
- package/dist/form/builder/flow/FlowEditor.d.ts +1 -0
- package/dist/form/builder/flow/NodeSectionEditor.d.ts +5 -0
- package/dist/form/builder/flow/SectionSidePanel.d.ts +5 -0
- package/dist/form/builder/utils.d.ts +1 -0
- package/dist/form/conditions/components/BooleanFieldConditionCell.d.ts +5 -0
- package/dist/form/conditions/components/CheckboxListFieldConditionCell.d.ts +5 -0
- package/dist/form/conditions/components/ConditionModifierDropdown.d.ts +13 -0
- package/dist/form/conditions/components/DateFieldConditionCell.d.ts +5 -0
- package/dist/form/conditions/components/DayPickerPopover.d.ts +4 -0
- package/dist/form/conditions/components/MultiSelectFieldConditionCell.d.ts +5 -0
- package/dist/form/conditions/components/MultiStringFieldConditionCell.d.ts +5 -0
- package/dist/form/conditions/components/NumberFieldConditionCell.d.ts +5 -0
- package/dist/form/conditions/components/RadioFieldConditionCell.d.ts +5 -0
- package/dist/form/conditions/components/RemoveConditionButton.d.ts +9 -0
- package/dist/form/conditions/components/ScanFieldConditionCell.d.ts +5 -0
- package/dist/form/conditions/components/SelectFieldConditionCell.d.ts +5 -0
- package/dist/form/conditions/components/SelectFieldOptionMultiSelectGroup.d.ts +6 -0
- package/dist/form/conditions/components/SelectFieldOptionSelectGroup.d.ts +6 -0
- package/dist/form/conditions/components/StringFieldConditionCell.d.ts +5 -0
- package/dist/form/conditions/components/TextFieldConditionCell.d.ts +5 -0
- package/dist/form/conditions/components/TextInputPopover.d.ts +9 -0
- package/dist/form/conditions/components/UploadFieldConditionCell.d.ts +5 -0
- package/dist/form/conditions/components/constants.d.ts +4 -0
- package/dist/form/conditions/condition/condition.d.ts +26 -0
- package/dist/form/conditions/condition/index.d.ts +1 -0
- package/dist/form/conditions/condition/typings.d.ts +16 -0
- package/dist/form/conditions/hooks.d.ts +10 -0
- package/dist/form/conditions/index.d.ts +1 -0
- package/dist/form/conditions/manager/conditionManager.d.ts +24 -0
- package/dist/form/conditions/manager/index.d.ts +2 -0
- package/dist/form/conditions/manager/typings.d.ts +1 -0
- package/dist/form/conditions/modifier/conditionModifier.d.ts +17 -0
- package/dist/form/conditions/modifiers/boolean.d.ts +3 -0
- package/dist/form/conditions/modifiers/date.d.ts +5 -0
- package/dist/form/conditions/modifiers/file.d.ts +3 -0
- package/dist/form/conditions/modifiers/index.d.ts +4 -0
- package/dist/form/conditions/modifiers/number.d.ts +7 -0
- package/dist/form/conditions/modifiers/string.d.ts +12 -0
- package/dist/form/conditions/typings.d.ts +14 -0
- package/dist/form/conditions/utils.d.ts +2 -0
- package/dist/form/fields/BaseField/BaseField.d.ts +14 -2
- package/dist/form/fields/BaseField/hooks.d.ts +13 -13
- package/dist/form/fields/BaseField/typings.d.ts +8 -1
- package/dist/form/fields/BaseSelectField/BaseSelectField.d.ts +1 -1
- package/dist/form/fields/BaseSelectField/typings.d.ts +1 -2
- package/dist/form/fields/BooleanField/BooleanField.d.ts +9 -2
- package/dist/form/fields/CheckboxListField/CheckboxListField.d.ts +12 -2
- package/dist/form/fields/DateField/DateField.d.ts +13 -4
- package/dist/form/fields/FieldSection/FieldSection.d.ts +8 -13
- package/dist/form/fields/FieldSection/typings.d.ts +3 -7
- package/dist/form/fields/MultiSelectField/MultiSelectField.d.ts +16 -5
- package/dist/form/fields/MultiStringField/MultiStringField.d.ts +12 -2
- package/dist/form/fields/NumberField/NumberField.d.ts +13 -2
- package/dist/form/fields/RadioField/RadioField.d.ts +13 -3
- package/dist/form/fields/ScanField/ScanField.d.ts +11 -2
- package/dist/form/fields/SelectField/SelectField.d.ts +13 -3
- package/dist/form/fields/StringField/StringField.d.ts +2 -0
- package/dist/form/fields/StringOrTextField/StringOrTextField.d.ts +9 -1
- package/dist/form/fields/TextField/TextField.d.ts +2 -0
- package/dist/form/fields/UploadField/UploadField.d.ts +9 -2
- package/dist/form/fields/constants.d.ts +0 -8
- package/dist/form/fields/hooks.d.ts +3 -3
- package/dist/form/fields/typings.d.ts +5 -3
- package/dist/form/fields/utils.d.ts +2 -2
- package/dist/form/renderer/context.d.ts +7 -0
- package/dist/forms.css +1 -0
- package/dist/forms.js +8857 -7060
- package/dist/forms.umd.cjs +24 -24
- package/package.json +5 -3
- package/dist/form/fields/CustomField/CustomField.d.ts +0 -23
- package/dist/form/fields/CustomField/FieldInputClonerField/FieldInputCloner.d.ts +0 -7
- package/dist/form/fields/CustomField/FieldInputClonerField/FieldInputClonerField.d.ts +0 -18
- package/dist/form/fields/CustomField/FieldInputClonerField/index.d.ts +0 -3
- package/dist/form/fields/CustomField/FieldInputClonerField/typings.d.ts +0 -4
- package/dist/form/fields/CustomField/index.d.ts +0 -1
package/dist/forms.umd.cjs
CHANGED
|
@@ -1,56 +1,56 @@
|
|
|
1
|
-
(function(P,g){typeof exports=="object"&&typeof module<"u"?g(exports,require("react/jsx-runtime"),require("@overmap-ai/blocks"),require("class-variance-authority"),require("react"),require("formik"),require("react-icons/ri"),require("@hello-pangea/dnd"),require("lodash.get"),require("uuid"),require("react-dom"),require("file-saver"),require("react-zxing"),require("lodash.set"),require("lodash.clonedeep")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","@overmap-ai/blocks","class-variance-authority","react","formik","react-icons/ri","@hello-pangea/dnd","lodash.get","uuid","react-dom","file-saver","react-zxing","lodash.set","lodash.clonedeep"],g):(P=typeof globalThis<"u"?globalThis:P||self,g(P.forms={},P.jsxRuntime,P.blocks,P.classVarianceAuthority,P.React,P.formik,P.ri,P.dnd,P.get,P.uuid,P.ReactDOM,P.fileSaver,P.reactZxing,P.set,P.cloneDeep))})(this,function(P,g,E,Et,I,Ie,me,rt,Ze,os,_i,Ei,Ii,It,ss){"use strict";var G1=Object.defineProperty;var W1=(P,g,E)=>g in P?G1(P,g,{enumerable:!0,configurable:!0,writable:!0,value:E}):P[g]=E;var F=(P,g,E)=>W1(P,typeof g!="symbol"?g+"":g,E);function Si(r){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const t in r)if(t!=="default"){const n=Object.getOwnPropertyDescriptor(r,t);Object.defineProperty(e,t,n.get?n:{enumerable:!0,get:()=>r[t]})}}return e.default=r,Object.freeze(e)}const O=Si(I),fs=Si(_i),rn=I.memo(I.forwardRef((r,e)=>{const{file:t,className:n,error:i,rightSlot:a,...o}=r;return g.jsxs(E.Card,{className:Et.cx(n,"flex w-full items-center gap-2 text-sm",{"text-(--gray-11)":i}),ref:e,...o,children:[i?g.jsx(E.RiIcon,{icon:"RiFileWarningLine"}):g.jsx(E.RiIcon,{icon:"RiFileLine",color:"var(--base-a11)"}),i||(t?g.jsx(E.Text,{className:"truncate",children:t.name}):g.jsx("div",{className:"flex w-full justify-center",children:g.jsx(E.Spinner,{})})),a]})}));rn.displayName="FileCard";const lt={danger:"danger",warning:"warning",info:"base",success:"success"};class nn{constructor(e){F(this,"type");F(this,"identifier");F(this,"description");const{description:t=null,identifier:n,type:i}=e;this.identifier=n,this.description=t,this.type=i}getId(){return this.identifier}static deserialize(e){throw new Error(`${this.name} must implement deserialize.`)}_serialize(){if(!this.identifier)throw new Error("Field identifier must be set before serializing.");return{type:this.type,identifier:this.identifier,description:this.description}}}const Me={label:"",description:"",required:!1};class ve extends nn{constructor(t){const{label:n,required:i,image:a,fieldValidators:o=[],formValidators:s=[],...f}=t;super(f);F(this,"required");F(this,"formValidators");F(this,"fieldValidators");F(this,"label");F(this,"image");F(this,"onlyValidateAfterTouched",!0);this.label=n,this.required=i,this.image=a,this.fieldValidators=o,this.formValidators=s}static getFieldCreationSchema(){return[]}isBlank(t){return t===void 0}isEqual(t,n){return t===n}getError(t,n){if(this.required&&this.isBlank(t))return"This field is required.";for(const i of this.getFieldValidators()){const a=i(t);if(a)return a}if(n)for(const i of this.getFormValidators()){const a=i(t,n);if(a)return a}}_serialize(){return{...super._serialize(),label:this.label,required:this.required,image:this.image}}getFieldValidators(){return[...this.fieldValidators]}getFormValidators(){return[...this.formValidators]}encodeValueToJson(t){return JSON.stringify(t)}decodeJsonToValue(t){return JSON.parse(t)}}F(ve,"fieldTypeName"),F(ve,"fieldTypeDescription");const Le=r=>{const{id:e,field:t,formId:n,size:i,showInputOnly:a,onValuesChange:o,...s}=r,[f,u,c]=Ie.useField(t.getId()),{touched:l}=u,d=u.error??t.description,h=u.error?"danger":void 0,v=e??`${n}-${t.getId()}-input`,p=`${v}-label`,x=t.required?`${t.label} *`:t.label,m=I.useMemo(()=>({...f,onChange:A=>{c.setValue(A,!1).then(),o==null||o(t.getId(),A),(l||!t.onlyValidateAfterTouched)&&c.setError(t.getError(A))},onBlur:A=>{c.setTouched(!0,!1).then(),c.setError(t.getError(A))}}),[t,f,c,o,l]);return[{helpText:d,size:i,severity:h,inputId:v,labelId:p,label:x,showInputOnly:a,fieldProps:m,helpers:c,field:t,touched:l},{...s,"aria-labelledby":p}]},cr=[],dt=r=>r.type==="section",lr=(r="",e=[])=>({type:"section",fields:e,identifier:r,label:null,condition:null,conditional:!1}),us=r=>{let e=[];const t=[];for(const n of r)n.type==="section"?(e.length>0&&(t.push(lr(`AUTO_section-${r.indexOf(n)}`,e)),e=[]),t.push(n)):e.push(n);return e.length>0&&t.push(lr("AUTO_section-last",e)),t};function an(r,e,t){const n=Array.from(r),[i]=n.splice(e,1);if(!i)throw new Error("Could not find field to reorder.");return n.splice(t,0,i),n}function bi(r,e,t){const n=Array.from(r??[]);return n.splice(e,0,t),n}function dr(r,e){const t=Array.from(r);return t.splice(e,1),t}const on=()=>os.v4(),Ti=(r,e)=>{if(!e)return null;for(const t of r)if(t.type==="section"){const n=Ti(t.fields,e);if(n)return n}else if(t.identifier===e)return t;return null},Oi=(r,e)=>r.filter((t,n)=>n<e).flatMap(t=>t.fields),hr=(r,e,t,n,i)=>{const a={...t,identifier:on()},o=Ze(n,r);if(o===void 0)throw new Error("Parent path must point to an existing field.");if(!Array.isArray(o))throw new Error("Parent path must point to an array.");const s=bi(o,e,a);i(r,s).then()},cs=(r,e,t)=>{const n={...lr(),label:""};hr("fields",r,n,e,t)},sn=()=>{const{showError:r}=E.useToast(),e=I.useCallback((n,i,a,o,s,f)=>{const u=n[i];if(!u)throw new Error("Could not find section context.");let c=typeof u.conditionIndex<"u"?Math.max(u.conditionIndex+1,o):o;for(const l of Object.values(n))l.conditionIndex===a&&(c=Math.min(c,l.index-1));if(c!==o){r({title:"Could not reorder sections",description:"Sections with conditions must be below the fields they reference."});return}f("fields",an(s.fields,a,c))},[r]),t=I.useCallback((n,i,a,o,s,f,u)=>{var c;if(!(n!=null&&n.fields)||!o)throw new Error("Could not find section with fields.");if(n.identifier===o.identifier)u(`fields.${i}.fields`,an(n.fields,a,f)).then();else{const l=n.fields[a];if(!l)throw new Error("Could not find field to reorder.");if(((c=o.condition)==null?void 0:c.identifier)===l.identifier){r({title:"Could not reorder field",description:"Field must be above the section whose condition references it."});return}u(`fields.${i}.fields`,dr(n.fields,a)).then(),u(`fields.${s}.fields`,bi(o.fields,f,l)).then()}},[r]);return{reorderSection:e,reorderField:t}},fn=r=>{const{helpText:e,children:t,severity:n}=r,i=n?lt[n]:"base";return g.jsxs("div",{className:"flex flex-col gap-1",children:[t,!!e&&g.jsx(E.Text,{accentColor:i,size:"xs",children:e})]})},Ni=I.createContext(()=>{throw new Error("No ImageViewerProvider found")}),vr=()=>I.useContext(Ni);function nt(r,e,{checkForDefaultPrevented:t=!0}={}){return function(i){if(r==null||r(i),t===!1||!i.defaultPrevented)return e==null?void 0:e(i)}}function Di(r,e){if(typeof r=="function")return r(e);r!=null&&(r.current=e)}function Pi(...r){return e=>{let t=!1;const n=r.map(i=>{const a=Di(i,e);return!t&&typeof a=="function"&&(t=!0),a});if(t)return()=>{for(let i=0;i<n.length;i++){const a=n[i];typeof a=="function"?a():Di(r[i],null)}}}}function ht(...r){return O.useCallback(Pi(...r),r)}function ls(r,e){const t=O.createContext(e),n=a=>{const{children:o,...s}=a,f=O.useMemo(()=>s,Object.values(s));return g.jsx(t.Provider,{value:f,children:o})};n.displayName=r+"Provider";function i(a){const o=O.useContext(t);if(o)return o;if(e!==void 0)return e;throw new Error(`\`${a}\` must be used within \`${r}\``)}return[n,i]}function ds(r,e=[]){let t=[];function n(a,o){const s=O.createContext(o),f=t.length;t=[...t,o];const u=l=>{var m;const{scope:d,children:h,...v}=l,p=((m=d==null?void 0:d[r])==null?void 0:m[f])||s,x=O.useMemo(()=>v,Object.values(v));return g.jsx(p.Provider,{value:x,children:h})};u.displayName=a+"Provider";function c(l,d){var p;const h=((p=d==null?void 0:d[r])==null?void 0:p[f])||s,v=O.useContext(h);if(v)return v;if(o!==void 0)return o;throw new Error(`\`${l}\` must be used within \`${a}\``)}return[u,c]}const i=()=>{const a=t.map(o=>O.createContext(o));return function(s){const f=(s==null?void 0:s[r])||a;return O.useMemo(()=>({[`__scope${r}`]:{...s,[r]:f}}),[s,f])}};return i.scopeName=r,[n,hs(i,...e)]}function hs(...r){const e=r[0];if(r.length===1)return e;const t=()=>{const n=r.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(a){const o=n.reduce((s,{useScope:f,scopeName:u})=>{const l=f(a)[`__scope${u}`];return{...s,...l}},{});return O.useMemo(()=>({[`__scope${e.scopeName}`]:o}),[o])}};return t.scopeName=e.scopeName,t}var Yt=globalThis!=null&&globalThis.document?O.useLayoutEffect:()=>{},vs=O[" useId ".trim().toString()]||(()=>{}),ps=0;function un(r){const[e,t]=O.useState(vs());return Yt(()=>{t(n=>n??String(ps++))},[r]),r||(e?`radix-${e}`:"")}var gs=O[" useInsertionEffect ".trim().toString()]||Yt;function xs({prop:r,defaultProp:e,onChange:t=()=>{},caller:n}){const[i,a,o]=ys({defaultProp:e,onChange:t}),s=r!==void 0,f=s?r:i;{const c=O.useRef(r!==void 0);O.useEffect(()=>{const l=c.current;l!==s&&console.warn(`${n} is changing from ${l?"controlled":"uncontrolled"} to ${s?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),c.current=s},[s,n])}const u=O.useCallback(c=>{var l;if(s){const d=ws(c)?c(r):c;d!==r&&((l=o.current)==null||l.call(o,d))}else a(c)},[s,r,a,o]);return[f,u]}function ys({defaultProp:r,onChange:e}){const[t,n]=O.useState(r),i=O.useRef(t),a=O.useRef(e);return gs(()=>{a.current=e},[e]),O.useEffect(()=>{var o;i.current!==t&&((o=a.current)==null||o.call(a,t),i.current=t)},[t,i]),[t,n,a]}function ws(r){return typeof r=="function"}function Mi(r){const e=ms(r),t=O.forwardRef((n,i)=>{const{children:a,...o}=n,s=O.Children.toArray(a),f=s.find(As);if(f){const u=f.props.children,c=s.map(l=>l===f?O.Children.count(u)>1?O.Children.only(null):O.isValidElement(u)?u.props.children:null:l);return g.jsx(e,{...o,ref:i,children:O.isValidElement(u)?O.cloneElement(u,void 0,c):null})}return g.jsx(e,{...o,ref:i,children:a})});return t.displayName=`${r}.Slot`,t}function ms(r){const e=O.forwardRef((t,n)=>{const{children:i,...a}=t;if(O.isValidElement(i)){const o=Es(i),s=_s(a,i.props);return i.type!==O.Fragment&&(s.ref=n?Pi(n,o):o),O.cloneElement(i,s)}return O.Children.count(i)>1?O.Children.only(null):null});return e.displayName=`${r}.SlotClone`,e}var Cs=Symbol("radix.slottable");function As(r){return O.isValidElement(r)&&typeof r.type=="function"&&"__radixId"in r.type&&r.type.__radixId===Cs}function _s(r,e){const t={...e};for(const n in e){const i=r[n],a=e[n];/^on[A-Z]/.test(n)?i&&a?t[n]=(...s)=>{const f=a(...s);return i(...s),f}:i&&(t[n]=i):n==="style"?t[n]={...i,...a}:n==="className"&&(t[n]=[i,a].filter(Boolean).join(" "))}return{...r,...t}}function Es(r){var n,i;let e=(n=Object.getOwnPropertyDescriptor(r.props,"ref"))==null?void 0:n.get,t=e&&"isReactWarning"in e&&e.isReactWarning;return t?r.ref:(e=(i=Object.getOwnPropertyDescriptor(r,"ref"))==null?void 0:i.get,t=e&&"isReactWarning"in e&&e.isReactWarning,t?r.props.ref:r.props.ref||r.ref)}var Is=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],tt=Is.reduce((r,e)=>{const t=Mi(`Primitive.${e}`),n=O.forwardRef((i,a)=>{const{asChild:o,...s}=i,f=o?t:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),g.jsx(f,{...s,ref:a})});return n.displayName=`Primitive.${e}`,{...r,[e]:n}},{});function Ss(r,e){r&&fs.flushSync(()=>r.dispatchEvent(e))}function Zt(r){const e=O.useRef(r);return O.useEffect(()=>{e.current=r}),O.useMemo(()=>(...t)=>{var n;return(n=e.current)==null?void 0:n.call(e,...t)},[])}function bs(r,e=globalThis==null?void 0:globalThis.document){const t=Zt(r);O.useEffect(()=>{const n=i=>{i.key==="Escape"&&t(i)};return e.addEventListener("keydown",n,{capture:!0}),()=>e.removeEventListener("keydown",n,{capture:!0})},[t,e])}var Ts="DismissableLayer",cn="dismissableLayer.update",Os="dismissableLayer.pointerDownOutside",Ns="dismissableLayer.focusOutside",Fi,Ri=O.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Bi=O.forwardRef((r,e)=>{const{disableOutsidePointerEvents:t=!1,onEscapeKeyDown:n,onPointerDownOutside:i,onFocusOutside:a,onInteractOutside:o,onDismiss:s,...f}=r,u=O.useContext(Ri),[c,l]=O.useState(null),d=(c==null?void 0:c.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,h]=O.useState({}),v=ht(e,T=>l(T)),p=Array.from(u.layers),[x]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),m=p.indexOf(x),w=c?p.indexOf(c):-1,C=u.layersWithOutsidePointerEventsDisabled.size>0,A=w>=m,_=Ms(T=>{const D=T.target,M=[...u.branches].some(B=>B.contains(D));!A||M||(i==null||i(T),o==null||o(T),T.defaultPrevented||s==null||s())},d),b=Fs(T=>{const D=T.target;[...u.branches].some(B=>B.contains(D))||(a==null||a(T),o==null||o(T),T.defaultPrevented||s==null||s())},d);return bs(T=>{w===u.layers.size-1&&(n==null||n(T),!T.defaultPrevented&&s&&(T.preventDefault(),s()))},d),O.useEffect(()=>{if(c)return t&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(Fi=d.body.style.pointerEvents,d.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(c)),u.layers.add(c),Li(),()=>{t&&u.layersWithOutsidePointerEventsDisabled.size===1&&(d.body.style.pointerEvents=Fi)}},[c,d,t,u]),O.useEffect(()=>()=>{c&&(u.layers.delete(c),u.layersWithOutsidePointerEventsDisabled.delete(c),Li())},[c,u]),O.useEffect(()=>{const T=()=>h({});return document.addEventListener(cn,T),()=>document.removeEventListener(cn,T)},[]),g.jsx(tt.div,{...f,ref:v,style:{pointerEvents:C?A?"auto":"none":void 0,...r.style},onFocusCapture:nt(r.onFocusCapture,b.onFocusCapture),onBlurCapture:nt(r.onBlurCapture,b.onBlurCapture),onPointerDownCapture:nt(r.onPointerDownCapture,_.onPointerDownCapture)})});Bi.displayName=Ts;var Ds="DismissableLayerBranch",Ps=O.forwardRef((r,e)=>{const t=O.useContext(Ri),n=O.useRef(null),i=ht(e,n);return O.useEffect(()=>{const a=n.current;if(a)return t.branches.add(a),()=>{t.branches.delete(a)}},[t.branches]),g.jsx(tt.div,{...r,ref:i})});Ps.displayName=Ds;function Ms(r,e=globalThis==null?void 0:globalThis.document){const t=Zt(r),n=O.useRef(!1),i=O.useRef(()=>{});return O.useEffect(()=>{const a=s=>{if(s.target&&!n.current){let f=function(){ki(Os,t,u,{discrete:!0})};const u={originalEvent:s};s.pointerType==="touch"?(e.removeEventListener("click",i.current),i.current=f,e.addEventListener("click",i.current,{once:!0})):f()}else e.removeEventListener("click",i.current);n.current=!1},o=window.setTimeout(()=>{e.addEventListener("pointerdown",a)},0);return()=>{window.clearTimeout(o),e.removeEventListener("pointerdown",a),e.removeEventListener("click",i.current)}},[e,t]),{onPointerDownCapture:()=>n.current=!0}}function Fs(r,e=globalThis==null?void 0:globalThis.document){const t=Zt(r),n=O.useRef(!1);return O.useEffect(()=>{const i=a=>{a.target&&!n.current&&ki(Ns,t,{originalEvent:a},{discrete:!1})};return e.addEventListener("focusin",i),()=>e.removeEventListener("focusin",i)},[e,t]),{onFocusCapture:()=>n.current=!0,onBlurCapture:()=>n.current=!1}}function Li(){const r=new CustomEvent(cn);document.dispatchEvent(r)}function ki(r,e,t,{discrete:n}){const i=t.originalEvent.target,a=new CustomEvent(r,{bubbles:!1,cancelable:!0,detail:t});e&&i.addEventListener(r,e,{once:!0}),n?Ss(i,a):i.dispatchEvent(a)}var ln="focusScope.autoFocusOnMount",dn="focusScope.autoFocusOnUnmount",Ui={bubbles:!1,cancelable:!0},Rs="FocusScope",Vi=O.forwardRef((r,e)=>{const{loop:t=!1,trapped:n=!1,onMountAutoFocus:i,onUnmountAutoFocus:a,...o}=r,[s,f]=O.useState(null),u=Zt(i),c=Zt(a),l=O.useRef(null),d=ht(e,p=>f(p)),h=O.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;O.useEffect(()=>{if(n){let p=function(C){if(h.paused||!s)return;const A=C.target;s.contains(A)?l.current=A:it(l.current,{select:!0})},x=function(C){if(h.paused||!s)return;const A=C.relatedTarget;A!==null&&(s.contains(A)||it(l.current,{select:!0}))},m=function(C){if(document.activeElement===document.body)for(const _ of C)_.removedNodes.length>0&&it(s)};document.addEventListener("focusin",p),document.addEventListener("focusout",x);const w=new MutationObserver(m);return s&&w.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",p),document.removeEventListener("focusout",x),w.disconnect()}}},[n,s,h.paused]),O.useEffect(()=>{if(s){Gi.add(h);const p=document.activeElement;if(!s.contains(p)){const m=new CustomEvent(ln,Ui);s.addEventListener(ln,u),s.dispatchEvent(m),m.defaultPrevented||(Bs(Hs(Hi(s)),{select:!0}),document.activeElement===p&&it(s))}return()=>{s.removeEventListener(ln,u),setTimeout(()=>{const m=new CustomEvent(dn,Ui);s.addEventListener(dn,c),s.dispatchEvent(m),m.defaultPrevented||it(p??document.body,{select:!0}),s.removeEventListener(dn,c),Gi.remove(h)},0)}}},[s,u,c,h]);const v=O.useCallback(p=>{if(!t&&!n||h.paused)return;const x=p.key==="Tab"&&!p.altKey&&!p.ctrlKey&&!p.metaKey,m=document.activeElement;if(x&&m){const w=p.currentTarget,[C,A]=Ls(w);C&&A?!p.shiftKey&&m===A?(p.preventDefault(),t&&it(C,{select:!0})):p.shiftKey&&m===C&&(p.preventDefault(),t&&it(A,{select:!0})):m===w&&p.preventDefault()}},[t,n,h.paused]);return g.jsx(tt.div,{tabIndex:-1,...o,ref:d,onKeyDown:v})});Vi.displayName=Rs;function Bs(r,{select:e=!1}={}){const t=document.activeElement;for(const n of r)if(it(n,{select:e}),document.activeElement!==t)return}function Ls(r){const e=Hi(r),t=zi(e,r),n=zi(e.reverse(),r);return[t,n]}function Hi(r){const e=[],t=document.createTreeWalker(r,NodeFilter.SHOW_ELEMENT,{acceptNode:n=>{const i=n.tagName==="INPUT"&&n.type==="hidden";return n.disabled||n.hidden||i?NodeFilter.FILTER_SKIP:n.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;t.nextNode();)e.push(t.currentNode);return e}function zi(r,e){for(const t of r)if(!ks(t,{upTo:e}))return t}function ks(r,{upTo:e}){if(getComputedStyle(r).visibility==="hidden")return!0;for(;r;){if(e!==void 0&&r===e)return!1;if(getComputedStyle(r).display==="none")return!0;r=r.parentElement}return!1}function Us(r){return r instanceof HTMLInputElement&&"select"in r}function it(r,{select:e=!1}={}){if(r&&r.focus){const t=document.activeElement;r.focus({preventScroll:!0}),r!==t&&Us(r)&&e&&r.select()}}var Gi=Vs();function Vs(){let r=[];return{add(e){const t=r[0];e!==t&&(t==null||t.pause()),r=Wi(r,e),r.unshift(e)},remove(e){var t;r=Wi(r,e),(t=r[0])==null||t.resume()}}}function Wi(r,e){const t=[...r],n=t.indexOf(e);return n!==-1&&t.splice(n,1),t}function Hs(r){return r.filter(e=>e.tagName!=="A")}var zs="Portal",Xi=O.forwardRef((r,e)=>{var s;const{container:t,...n}=r,[i,a]=O.useState(!1);Yt(()=>a(!0),[]);const o=t||i&&((s=globalThis==null?void 0:globalThis.document)==null?void 0:s.body);return o?_i.createPortal(g.jsx(tt.div,{...n,ref:e}),o):null});Xi.displayName=zs;function Gs(r,e){return O.useReducer((t,n)=>e[t][n]??t,r)}var pr=r=>{const{present:e,children:t}=r,n=Ws(e),i=typeof t=="function"?t({present:n.isPresent}):O.Children.only(t),a=ht(n.ref,Xs(i));return typeof t=="function"||n.isPresent?O.cloneElement(i,{ref:a}):null};pr.displayName="Presence";function Ws(r){const[e,t]=O.useState(),n=O.useRef(null),i=O.useRef(r),a=O.useRef("none"),o=r?"mounted":"unmounted",[s,f]=Gs(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return O.useEffect(()=>{const u=gr(n.current);a.current=s==="mounted"?u:"none"},[s]),Yt(()=>{const u=n.current,c=i.current;if(c!==r){const d=a.current,h=gr(u);r?f("MOUNT"):h==="none"||(u==null?void 0:u.display)==="none"?f("UNMOUNT"):f(c&&d!==h?"ANIMATION_OUT":"UNMOUNT"),i.current=r}},[r,f]),Yt(()=>{if(e){let u;const c=e.ownerDocument.defaultView??window,l=h=>{const p=gr(n.current).includes(h.animationName);if(h.target===e&&p&&(f("ANIMATION_END"),!i.current)){const x=e.style.animationFillMode;e.style.animationFillMode="forwards",u=c.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=x)})}},d=h=>{h.target===e&&(a.current=gr(n.current))};return e.addEventListener("animationstart",d),e.addEventListener("animationcancel",l),e.addEventListener("animationend",l),()=>{c.clearTimeout(u),e.removeEventListener("animationstart",d),e.removeEventListener("animationcancel",l),e.removeEventListener("animationend",l)}}else f("ANIMATION_END")},[e,f]),{isPresent:["mounted","unmountSuspended"].includes(s),ref:O.useCallback(u=>{n.current=u?getComputedStyle(u):null,t(u)},[])}}function gr(r){return(r==null?void 0:r.animationName)||"none"}function Xs(r){var n,i;let e=(n=Object.getOwnPropertyDescriptor(r.props,"ref"))==null?void 0:n.get,t=e&&"isReactWarning"in e&&e.isReactWarning;return t?r.ref:(e=(i=Object.getOwnPropertyDescriptor(r,"ref"))==null?void 0:i.get,t=e&&"isReactWarning"in e&&e.isReactWarning,t?r.props.ref:r.props.ref||r.ref)}var hn=0;function $s(){O.useEffect(()=>{const r=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",r[0]??$i()),document.body.insertAdjacentElement("beforeend",r[1]??$i()),hn++,()=>{hn===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),hn--}},[])}function $i(){const r=document.createElement("span");return r.setAttribute("data-radix-focus-guard",""),r.tabIndex=0,r.style.outline="none",r.style.opacity="0",r.style.position="fixed",r.style.pointerEvents="none",r}var Ke=function(){return Ke=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++){t=arguments[n];for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a])}return e},Ke.apply(this,arguments)};function ji(r,e){var t={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&e.indexOf(n)<0&&(t[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(r);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(r,n[i])&&(t[n[i]]=r[n[i]]);return t}function js(r,e,t){if(t||arguments.length===2)for(var n=0,i=e.length,a;n<i;n++)(a||!(n in e))&&(a||(a=Array.prototype.slice.call(e,0,n)),a[n]=e[n]);return r.concat(a||Array.prototype.slice.call(e))}typeof SuppressedError=="function"&&SuppressedError;var xr="right-scroll-bar-position",yr="width-before-scroll-bar",Ys="with-scroll-bars-hidden",Zs="--removed-body-scroll-bar-size";function vn(r,e){return typeof r=="function"?r(e):r&&(r.current=e),r}function Ks(r,e){var t=I.useState(function(){return{value:r,callback:e,facade:{get current(){return t.value},set current(n){var i=t.value;i!==n&&(t.value=n,t.callback(n,i))}}}})[0];return t.callback=e,t.facade}var qs=typeof window<"u"?O.useLayoutEffect:O.useEffect,Yi=new WeakMap;function Qs(r,e){var t=Ks(null,function(n){return r.forEach(function(i){return vn(i,n)})});return qs(function(){var n=Yi.get(t);if(n){var i=new Set(n),a=new Set(r),o=t.current;i.forEach(function(s){a.has(s)||vn(s,null)}),a.forEach(function(s){i.has(s)||vn(s,o)})}Yi.set(t,r)},[r]),t}function Js(r){return r}function ef(r,e){e===void 0&&(e=Js);var t=[],n=!1,i={read:function(){if(n)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return t.length?t[t.length-1]:r},useMedium:function(a){var o=e(a,n);return t.push(o),function(){t=t.filter(function(s){return s!==o})}},assignSyncMedium:function(a){for(n=!0;t.length;){var o=t;t=[],o.forEach(a)}t={push:function(s){return a(s)},filter:function(){return t}}},assignMedium:function(a){n=!0;var o=[];if(t.length){var s=t;t=[],s.forEach(a),o=t}var f=function(){var c=o;o=[],c.forEach(a)},u=function(){return Promise.resolve().then(f)};u(),t={push:function(c){o.push(c),u()},filter:function(c){return o=o.filter(c),t}}}};return i}function tf(r){r===void 0&&(r={});var e=ef(null);return e.options=Ke({async:!0,ssr:!1},r),e}var Zi=function(r){var e=r.sideCar,t=ji(r,["sideCar"]);if(!e)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var n=e.read();if(!n)throw new Error("Sidecar medium not found");return O.createElement(n,Ke({},t))};Zi.isSideCarExport=!0;function rf(r,e){return r.useMedium(e),Zi}var Ki=tf(),pn=function(){},wr=O.forwardRef(function(r,e){var t=O.useRef(null),n=O.useState({onScrollCapture:pn,onWheelCapture:pn,onTouchMoveCapture:pn}),i=n[0],a=n[1],o=r.forwardProps,s=r.children,f=r.className,u=r.removeScrollBar,c=r.enabled,l=r.shards,d=r.sideCar,h=r.noIsolation,v=r.inert,p=r.allowPinchZoom,x=r.as,m=x===void 0?"div":x,w=r.gapMode,C=ji(r,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as","gapMode"]),A=d,_=Qs([t,e]),b=Ke(Ke({},C),i);return O.createElement(O.Fragment,null,c&&O.createElement(A,{sideCar:Ki,removeScrollBar:u,shards:l,noIsolation:h,inert:v,setCallbacks:a,allowPinchZoom:!!p,lockRef:t,gapMode:w}),o?O.cloneElement(O.Children.only(s),Ke(Ke({},b),{ref:_})):O.createElement(m,Ke({},b,{className:f,ref:_}),s))});wr.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},wr.classNames={fullWidth:yr,zeroRight:xr};var nf=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function af(){if(!document)return null;var r=document.createElement("style");r.type="text/css";var e=nf();return e&&r.setAttribute("nonce",e),r}function of(r,e){r.styleSheet?r.styleSheet.cssText=e:r.appendChild(document.createTextNode(e))}function sf(r){var e=document.head||document.getElementsByTagName("head")[0];e.appendChild(r)}var ff=function(){var r=0,e=null;return{add:function(t){r==0&&(e=af())&&(of(e,t),sf(e)),r++},remove:function(){r--,!r&&e&&(e.parentNode&&e.parentNode.removeChild(e),e=null)}}},uf=function(){var r=ff();return function(e,t){O.useEffect(function(){return r.add(e),function(){r.remove()}},[e&&t])}},qi=function(){var r=uf(),e=function(t){var n=t.styles,i=t.dynamic;return r(n,i),null};return e},cf={left:0,top:0,right:0,gap:0},gn=function(r){return parseInt(r||"",10)||0},lf=function(r){var e=window.getComputedStyle(document.body),t=e[r==="padding"?"paddingLeft":"marginLeft"],n=e[r==="padding"?"paddingTop":"marginTop"],i=e[r==="padding"?"paddingRight":"marginRight"];return[gn(t),gn(n),gn(i)]},df=function(r){if(r===void 0&&(r="margin"),typeof window>"u")return cf;var e=lf(r),t=document.documentElement.clientWidth,n=window.innerWidth;return{left:e[0],top:e[1],right:e[2],gap:Math.max(0,n-t+e[2]-e[0])}},hf=qi(),St="data-scroll-locked",vf=function(r,e,t,n){var i=r.left,a=r.top,o=r.right,s=r.gap;return t===void 0&&(t="margin"),`
|
|
2
|
-
.`.concat(
|
|
1
|
+
(function(B,d){typeof exports=="object"&&typeof module<"u"?d(exports,require("react/jsx-runtime"),require("@overmap-ai/blocks"),require("class-variance-authority"),require("react"),require("@xyflow/react/dist/style.css"),require("formik"),require("uuid"),require("react-icons/ri"),require("@hello-pangea/dnd"),require("lodash.get"),require("react-dom"),require("file-saver"),require("lodash.set"),require("react-zxing"),require("lodash.clonedeep"),require("@dagrejs/dagre"),require("@xyflow/react")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","@overmap-ai/blocks","class-variance-authority","react","@xyflow/react/dist/style.css","formik","uuid","react-icons/ri","@hello-pangea/dnd","lodash.get","react-dom","file-saver","lodash.set","react-zxing","lodash.clonedeep","@dagrejs/dagre","@xyflow/react"],d):(B=typeof globalThis<"u"?globalThis:B||self,d(B.forms={},B.jsxRuntime,B.blocks,B.classVarianceAuthority,B.React,null,B.formik,B.uuid,B.ri,B.dnd,B.get,B.ReactDOM,B.fileSaver,B.set,B.reactZxing,B.cloneDeep,B.dagre,B.react))})(this,function(B,d,x,yt,A,J1,ye,Hi,Ae,Ct,st,Gi,Wi,Nt,Xi,Vs,$i,Te){"use strict";var K1=Object.defineProperty;var Q1=(B,d,x)=>d in B?K1(B,d,{enumerable:!0,configurable:!0,writable:!0,value:x}):B[d]=x;var O=(B,d,x)=>Q1(B,typeof d!="symbol"?d+"":d,x);function ji(r){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const t in r)if(t!=="default"){const n=Object.getOwnPropertyDescriptor(r,t);Object.defineProperty(e,t,n.get?n:{enumerable:!0,get:()=>r[t]})}}return e.default=r,Object.freeze(e)}const N=ji(A),ks=ji(Gi),Cn=A.memo(A.forwardRef((r,e)=>{const{file:t,className:n,error:i,rightSlot:o,...a}=r;return d.jsxs(x.Card,{className:yt.cx(n,"flex w-full items-center gap-2 text-sm"),ref:e,...a,children:[i?d.jsx(x.RiIcon,{icon:"RiFileWarningLine"}):d.jsx(x.RiIcon,{icon:"RiFileLine",color:"var(--base-a11)"}),i?d.jsx(x.Text,{accentColor:"danger",className:"truncate",children:i}):t?d.jsx(x.Text,{className:"truncate",children:t.name}):d.jsx("div",{className:"flex w-full justify-center",children:d.jsx(x.Spinner,{})}),o]})}));Cn.displayName="FileCard";const er={danger:"danger",warning:"warning",info:"base",success:"success"};class qi{constructor(e){O(this,"id");O(this,"conditionValue");O(this,"conditionModifier");O(this,"field");O(this,"subscribers",new Set);O(this,"subscribe",e=>(this.subscribers.add(e),()=>{this.subscribers.delete(e)}));O(this,"notifySubscribers",()=>{for(const e of this.subscribers)e(this)});O(this,"getConditionValue",()=>this.conditionValue);O(this,"setConditionValue",e=>{const t=this.field.modifiers[this.conditionModifier];if(e!==void 0&&!t.isConditionValueValid(e)){console.warn(`Setting filterValue: Filter value ${e} is not valid for modifier ${this.getConditionModifier()}`);return}this.conditionValue=e,this.notifySubscribers()});O(this,"getConditionModifier",()=>this.conditionModifier);O(this,"setConditionModifier",e=>{const t=this.field.modifiers[e],n=this.getConditionValue();n&&!t.isConditionValueValid(n)&&(this.conditionValue=void 0),this.conditionModifier=e,this.notifySubscribers()});O(this,"render",e=>this.field.renderCondition({field:this.field,condition:this,conditionManager:e}));O(this,"apply",e=>{const t=this.field.modifiers[this.getConditionModifier()],n=this.getConditionValue();return n===void 0||!t.isConditionValueValid(n)?!0:t.isValueValid(e)?t.modifier.modifierFn(e,n):!1});const{id:t,conditionValue:n,conditionModifier:i,field:o}=e;this.id=t,this.conditionValue=n,this.conditionModifier=i,this.field=o}}class mn{constructor(e){O(this,"type");O(this,"identifier");O(this,"description");const{description:t=null,identifier:n,type:i}=e;this.identifier=n,this.description=t,this.type=i}getId(){return this.identifier}static deserialize(e){throw new Error(`${this.name} must implement deserialize.`)}_serialize(){if(!this.identifier)throw new Error("Field identifier must be set before serializing.");return{type:this.type,identifier:this.identifier,description:this.description}}}const Ue={label:"",description:"",required:!1};class Ee extends mn{constructor(t){const{label:n,required:i,image:o,fieldValidators:a=[],formValidators:s=[],...l}=t;super(l);O(this,"required");O(this,"formValidators");O(this,"fieldValidators");O(this,"label");O(this,"image");O(this,"onlyValidateAfterTouched",!0);O(this,"getConditionModifier",t=>this.modifiers[t]);O(this,"getConditionModifiers",()=>Object.entries(this.modifiers));this.label=n,this.required=i,this.image=o,this.fieldValidators=a,this.formValidators=s}static getFieldCreationSchema(){return[]}isBlank(t){return t===void 0}isEqual(t,n){return t===n}getError(t,n){if(this.required&&this.isBlank(t))return"This field is required.";for(const i of this.getFieldValidators()){const o=i(t);if(o)return o}if(n)for(const i of this.getFormValidators()){const o=i(t,n);if(o)return o}}_serialize(){return{...super._serialize(),label:this.label,required:this.required,image:this.image}}getFieldValidators(){return[...this.fieldValidators]}getFormValidators(){return[...this.formValidators]}encodeValueToJson(t){return JSON.stringify(t)}decodeJsonToValue(t){return JSON.parse(t)}createCondition(t){return new qi({id:(t==null?void 0:t.id)??Hi.v4(),field:this,conditionValue:(t==null?void 0:t.conditionValue)??this.defaultConditionValue??void 0,conditionModifier:(t==null?void 0:t.conditionModifier)??this.defaultConditionModifier})}serializeCondition(t){const n=t.getConditionValue(),i=t.getConditionModifier(),o=this.modifiers[i];let a;return n!==void 0&&o.isConditionValueValid(n)?a=o.modifier.serialize(n):a=void 0,{id:t.id,fieldId:this.identifier,conditionValue:a,conditionModifier:i}}deserializeCondition(t){const n=t.conditionModifier,i=this.modifiers[n],o=t.conditionValue;let a;return o!==void 0&&(a=i.modifier.deserialize(t.conditionValue)),new qi({id:t.id,field:this,conditionValue:a,conditionModifier:t.conditionModifier})}}O(Ee,"fieldTypeName"),O(Ee,"fieldTypeDescription");const He=r=>{const{id:e,field:t,formId:n,size:i,showInputOnly:o,onValuesChange:a,...s}=r,[l,u,c]=ye.useField(t.getId()),{touched:f}=u,h=u.error??t.description,v=u.error?"danger":void 0,p=e??`${n}-${t.getId()}-input`,g=`${p}-label`,m=t.required?`${t.label} *`:t.label,y=A.useMemo(()=>({...l,onChange:E=>{c.setValue(E,!1).then(),a==null||a(t.getId(),E),(f||!t.onlyValidateAfterTouched)&&c.setError(t.getError(E))},onBlur:E=>{c.setTouched(!0,!1).then(),c.setError(t.getError(E))}}),[t,l,c,a,f]);return[{helpText:h,size:i,severity:v,inputId:p,labelId:g,label:m,showInputOnly:o,fieldProps:y,helpers:c,field:t,touched:f},{...s,"aria-labelledby":g}]},Yi=A.memo,Dt=Yi(function(r){const{ref:e,children:t,...n}=r,i=A.useCallback(o=>typeof t=="function"?d.jsxs(d.Fragment,{children:[t(o),d.jsx(x.Menu.SelectedIndicator,{className:"ml-[auto]",children:d.jsx(x.RiIcon,{icon:"RiCheck"})})]}):d.jsxs(d.Fragment,{children:[t,d.jsx(x.Menu.SelectedIndicator,{className:"ml-[auto]",children:d.jsx(x.RiIcon,{icon:"RiCheck"})})]}),[t]);return d.jsx(x.Menu.SelectItem,{ref:e,...n,children:i})}),zs=Yi(function(r){const{ref:e,children:t,...n}=r,i=A.useCallback(o=>typeof t=="function"?d.jsxs(d.Fragment,{children:[t(o),d.jsx(x.Menu.SelectedIndicator,{className:"ml-auto",children:d.jsx(x.RiIcon,{icon:"RiCheck"})})]}):d.jsxs(d.Fragment,{children:[t,d.jsx(x.Menu.SelectedIndicator,{className:"ml-auto",children:d.jsx(x.RiIcon,{icon:"RiCheck"})})]}),[t]);return d.jsx(x.Menu.MultiSelectItem,{ref:e,...n,children:i})}),Zi=A.memo(r=>{const{ref:e,children:t,...n}=r,i=A.useCallback(o=>typeof t=="function"?d.jsxs(d.Fragment,{children:[t(o),d.jsx(x.Menu.CheckboxItemIndicator,{className:"ml-[auto]",children:a=>a?d.jsx(x.RiIcon,{icon:"RiSubtractLine"}):d.jsx(x.RiIcon,{icon:"RiCheck"})})]}):d.jsxs(d.Fragment,{children:[t,d.jsx(x.Menu.CheckboxItemIndicator,{className:"ml-[auto]",children:a=>a?d.jsx(x.RiIcon,{icon:"RiSubtractLine"}):d.jsx(x.RiIcon,{icon:"RiCheck"})})]}),[t]);return d.jsx(x.Menu.SelectAllItem,{ref:e,...n,children:i})});Zi.displayName="SelectAllItemTemplate";const $e=r=>{const{children:e,condition:t,field:n,size:i="sm",variant:o,accentColor:a,radius:s,onModifierChange:l}=r,u=A.useCallback(c=>{t.setConditionModifier(c),l==null||l(c)},[t,l]);return d.jsxs(x.Menu.Root,{align:"start",children:[d.jsx(x.Menu.ClickTrigger,{children:e}),d.jsx(x.Menu.Content,{size:i,variant:o,radius:s,accentColor:a,children:d.jsx(x.Menu.SelectGroup,{required:!0,value:t.getConditionModifier(),onValueChange:u,children:n.getConditionModifiers().map(([c,f])=>d.jsx(Dt,{value:c,children:f.modifier.render(t.getConditionValue())},c))})})]})},Ge=A.memo(r=>{const{condition:e,conditionManager:t,...n}=r,i=A.useCallback(()=>{t.removeCondition(e.id)},[e.id,t]);return d.jsx(x.IconButton,{onClick:i,...n,children:d.jsx(x.RiIcon,{icon:"RiCloseLine"})})});Ge.displayName="RemoveFilterButton";const Us=r=>{const{field:e,condition:t,conditionManager:n}=r,i=t.getConditionValue(),o=t.getConditionModifier(),a=()=>{if(i===void 0)return"...";if(i===null)return"empty";switch(i.length){case 0:return"...";case 1:return i[0].toString();default:return`${i.length} values`}};return d.jsx(d.Fragment,{children:d.jsxs(x.ButtonGroup,{className:"flex w-max max-w-full min-w-0 gap-0.5",size:"sm",variant:"fill",accentColor:"base",children:[d.jsxs(x.Badge,{className:"min-w-0 shrink-1",size:"sm",variant:"fill",accentColor:"base",children:[d.jsx(x.RiIcon,{icon:ze[e.type]}),d.jsx("span",{className:"truncate",children:e.label})]}),d.jsx($e,{field:e,condition:t,children:d.jsx(x.Button,{type:"button",children:e.getConditionModifier(o).modifier.render(i)})}),d.jsx(x.Button,{type:"button",className:"truncate",children:a()}),d.jsx(Ge,{condition:t,conditionManager:n})]})})};class ae{constructor(e){O(this,"id");O(this,"modifierFn");O(this,"render");O(this,"serialize");O(this,"deserialize");const{id:t,modifierFn:n,render:i,serialize:o,deserialize:a}=e;this.id=t,this.modifierFn=n,this.render=i,this.serialize=o,this.deserialize=a}static create(e){return new ae(e)}}const Hs=ae.create({id:"nullable-boolean-equals",modifierFn:(r,e)=>r===e,render:r=>"is",serialize:r=>r,deserialize:r=>r}),Gs=ae.create({id:"nullable-boolean-not-equals",modifierFn:(r,e)=>r!==e,render:r=>"is not",serialize:r=>r,deserialize:r=>r}),Ws=ae.create({id:"date-equals",modifierFn:(r,e)=>r.getTime()===e.getTime(),render:()=>"is",serialize:r=>r.toISOString(),deserialize:r=>new Date(r)}),Xs=ae.create({id:"date-not-equals",modifierFn:(r,e)=>r.getTime()!==e.getTime(),render:()=>"is not",serialize:r=>r.toISOString(),deserialize:r=>new Date(r)}),$s=ae.create({id:"date-before",modifierFn:(r,e)=>r.getTime()<e.getTime(),render:r=>"before",serialize:r=>r.toISOString(),deserialize:r=>new Date(r)}),js=ae.create({id:"date-after",modifierFn:(r,e)=>r.getTime()>e.getTime(),render:r=>"after",serialize:r=>r.toISOString(),deserialize:r=>new Date(r)}),qs=ae.create({id:"number-equals",modifierFn:(r,e)=>r===e,render:()=>"is",serialize:r=>r,deserialize:r=>r}),Ys=ae.create({id:"number-not-equals",modifierFn:(r,e)=>r!==e,render:()=>"is not",serialize:r=>r,deserialize:r=>r}),Zs=ae.create({id:"number-less-than",modifierFn:(r,e)=>r<e,render:()=>"is less than",serialize:r=>r,deserialize:r=>r}),Ks=ae.create({id:"number-less-than-or-equals",modifierFn:(r,e)=>r<=e,render:()=>"is less than or equal to",serialize:r=>r,deserialize:r=>r}),Qs=ae.create({id:"number-greater-than",modifierFn:(r,e)=>r>e,render:()=>"is greater than",serialize:r=>r,deserialize:r=>r}),Js=ae.create({id:"number-greater-than-or-equals",modifierFn:(r,e)=>r>=e,render:()=>"is greater than or equal to",serialize:r=>r,deserialize:r=>r}),Er=ae.create({id:"nullable-string-equals",modifierFn:(r,e)=>r===e,render:()=>"is",serialize:r=>r,deserialize:r=>r}),Ir=ae.create({id:"nullable-string-not-equals",modifierFn:(r,e)=>r!==e,render:()=>"is not",serialize:r=>r,deserialize:r=>r}),Ki=ae.create({id:"string-includes",modifierFn:(r,e)=>r.includes(e),render:()=>"includes",serialize:r=>r,deserialize:r=>r}),Qi=ae.create({id:"string-excludes",modifierFn:(r,e)=>!r.includes(e),render:()=>"does not include",serialize:r=>r,deserialize:r=>r}),Ji=ae.create({id:"string-array-includes",modifierFn:(r,e)=>e.includes(r),render:()=>"is any of",serialize:r=>r,deserialize:r=>r}),eo=ae.create({id:"string-array-excludes",modifierFn:(r,e)=>!e.includes(r),render:()=>"is none of",serialize:r=>r,deserialize:r=>r}),wn=ae.create({id:"string-array-every",modifierFn:(r,e)=>e.every(t=>r.includes(t)),render:()=>"has all of",serialize:r=>r,deserialize:r=>r}),_n=ae.create({id:"string-array-some",modifierFn:(r,e)=>e.some(t=>r.includes(t)),render:()=>"has any of",serialize:r=>r,deserialize:r=>r}),An=ae.create({id:"string-array-none",modifierFn:(r,e)=>e.every(t=>!r.includes(t)),render:r=>"has none of",serialize:r=>r,deserialize:r=>r}),En=ae.create({id:"string-array-equals",modifierFn:(r,e)=>e===null&&r===null?!0:e===null||r===null?!1:r.every(t=>e.includes(t))&&e.every(t=>r.includes(t)),render:r=>"is",serialize:r=>r,deserialize:r=>r}),In=ae.create({id:"string-array-not-equals",modifierFn:(r,e)=>e===null&&r===null?!1:e===null||r===null?!0:!(r.every(t=>e.includes(t))&&e.every(t=>r.includes(t))),render:r=>"is not",serialize:r=>r,deserialize:r=>r}),j=r=>r,Sr=[],tr=(r="",e=[])=>({type:"section",fields:e,identifier:r,label:null,conditions:{}}),el=r=>{let e=[];const t=[];for(const n of r)n.type==="section"?(e.length>0&&(t.push(tr(`AUTO_section-${r.indexOf(n)}`,e)),e=[]),t.push(n)):e.push(n);return e.length>0&&t.push(tr("AUTO_section-last",e)),t};function br(r,e,t){const n=Array.from(r),[i]=n.splice(e,1);if(!i)throw new Error("Could not find field to reorder.");return n.splice(t,0,i),n}function Sn(r,e,t){const n=Array.from(r??[]);return n.splice(e,0,t),n}function Mt(r,e){const t=Array.from(r);return t.splice(e,1),t}const Tr=()=>Hi.v4(),tl=(r,e)=>r.filter((t,n)=>n<e).flatMap(t=>t.fields),Pt=(r,e,t,n,i)=>{const o={...t,identifier:Tr()},a=st(n,r);if(a===void 0)throw new Error("Parent path must point to an existing field.");if(!Array.isArray(a))throw new Error("Parent path must point to an array.");const s=Sn(a,e,o);i(r,s).then()},to=(r,e,t)=>{const n={...tr(),label:""};Pt("fields",r,n,e,t)},rl=(r,e,t,n)=>{const i=Tr(),o={...tr(i),label:"",...n},a=Sn(e.fields,r,o);return t("fields",a).then(),i},Or=()=>{const{showError:r}=x.useToast(),e=A.useCallback((n,i,o,a,s,l)=>{const u=n[i];if(!u)throw new Error("Could not find section context.");let c=typeof u.conditionIndex<"u"?Math.max(u.conditionIndex+1,a):a;for(const f of Object.values(n))f.conditionIndex===o&&(c=Math.min(c,f.index-1));if(c!==a){r({title:"Could not reorder sections",description:"Sections with conditions must be below the fields they reference."});return}l("fields",br(s.fields,o,c))},[r]),t=A.useCallback((n,i,o,a,s,l,u)=>{if(!(n!=null&&n.fields)||!a)throw new Error("Could not find section with fields.");if(n.identifier===a.identifier)u(`fields.${i}.fields`,br(n.fields,o,l)).then();else{const c=n.fields[o];if(!c)throw new Error("Could not find field to reorder.");const f=a.conditions??{};let h=!1;for(const v of Object.keys(f))if((f[v]??[]).some(g=>(g==null?void 0:g.fieldId)===c.identifier)){h=!0;break}if(h){r({title:"Could not reorder field",description:"Field must be above the section whose condition references it."});return}u(`fields.${i}.fields`,Mt(n.fields,o)).then(),u(`fields.${s}.fields`,Sn(a.fields,l,c)).then()}},[r]);return{reorderSection:e,reorderField:t}},bn=r=>{const{helpText:e,children:t,severity:n}=r,i=n?er[n]:"base";return d.jsxs("div",{className:"flex flex-col gap-1",children:[t,!!e&&d.jsx(x.Text,{accentColor:i,size:"xs",children:e})]})},ro=A.createContext(()=>{throw new Error("No ImageViewerProvider found")}),Nr=()=>A.useContext(ro);function ct(r,e,{checkForDefaultPrevented:t=!0}={}){return function(i){if(r==null||r(i),t===!1||!i.defaultPrevented)return e==null?void 0:e(i)}}function no(r,e){if(typeof r=="function")return r(e);r!=null&&(r.current=e)}function io(...r){return e=>{let t=!1;const n=r.map(i=>{const o=no(i,e);return!t&&typeof o=="function"&&(t=!0),o});if(t)return()=>{for(let i=0;i<n.length;i++){const o=n[i];typeof o=="function"?o():no(r[i],null)}}}}function mt(...r){return N.useCallback(io(...r),r)}function nl(r,e){const t=N.createContext(e),n=o=>{const{children:a,...s}=o,l=N.useMemo(()=>s,Object.values(s));return d.jsx(t.Provider,{value:l,children:a})};n.displayName=r+"Provider";function i(o){const a=N.useContext(t);if(a)return a;if(e!==void 0)return e;throw new Error(`\`${o}\` must be used within \`${r}\``)}return[n,i]}function il(r,e=[]){let t=[];function n(o,a){const s=N.createContext(a),l=t.length;t=[...t,a];const u=f=>{var y;const{scope:h,children:v,...p}=f,g=((y=h==null?void 0:h[r])==null?void 0:y[l])||s,m=N.useMemo(()=>p,Object.values(p));return d.jsx(g.Provider,{value:m,children:v})};u.displayName=o+"Provider";function c(f,h){var g;const v=((g=h==null?void 0:h[r])==null?void 0:g[l])||s,p=N.useContext(v);if(p)return p;if(a!==void 0)return a;throw new Error(`\`${f}\` must be used within \`${o}\``)}return[u,c]}const i=()=>{const o=t.map(a=>N.createContext(a));return function(s){const l=(s==null?void 0:s[r])||o;return N.useMemo(()=>({[`__scope${r}`]:{...s,[r]:l}}),[s,l])}};return i.scopeName=r,[n,ol(i,...e)]}function ol(...r){const e=r[0];if(r.length===1)return e;const t=()=>{const n=r.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(o){const a=n.reduce((s,{useScope:l,scopeName:u})=>{const f=l(o)[`__scope${u}`];return{...s,...f}},{});return N.useMemo(()=>({[`__scope${e.scopeName}`]:a}),[a])}};return t.scopeName=e.scopeName,t}var rr=globalThis!=null&&globalThis.document?N.useLayoutEffect:()=>{},al=N[" useId ".trim().toString()]||(()=>{}),sl=0;function Tn(r){const[e,t]=N.useState(al());return rr(()=>{t(n=>n??String(sl++))},[r]),r||(e?`radix-${e}`:"")}var ll=N[" useInsertionEffect ".trim().toString()]||rr;function ul({prop:r,defaultProp:e,onChange:t=()=>{},caller:n}){const[i,o,a]=cl({defaultProp:e,onChange:t}),s=r!==void 0,l=s?r:i;{const c=N.useRef(r!==void 0);N.useEffect(()=>{const f=c.current;f!==s&&console.warn(`${n} is changing from ${f?"controlled":"uncontrolled"} to ${s?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),c.current=s},[s,n])}const u=N.useCallback(c=>{var f;if(s){const h=fl(c)?c(r):c;h!==r&&((f=a.current)==null||f.call(a,h))}else o(c)},[s,r,o,a]);return[l,u]}function cl({defaultProp:r,onChange:e}){const[t,n]=N.useState(r),i=N.useRef(t),o=N.useRef(e);return ll(()=>{o.current=e},[e]),N.useEffect(()=>{var a;i.current!==t&&((a=o.current)==null||a.call(o,t),i.current=t)},[t,i]),[t,n,o]}function fl(r){return typeof r=="function"}function oo(r){const e=dl(r),t=N.forwardRef((n,i)=>{const{children:o,...a}=n,s=N.Children.toArray(o),l=s.find(vl);if(l){const u=l.props.children,c=s.map(f=>f===l?N.Children.count(u)>1?N.Children.only(null):N.isValidElement(u)?u.props.children:null:f);return d.jsx(e,{...a,ref:i,children:N.isValidElement(u)?N.cloneElement(u,void 0,c):null})}return d.jsx(e,{...a,ref:i,children:o})});return t.displayName=`${r}.Slot`,t}function dl(r){const e=N.forwardRef((t,n)=>{const{children:i,...o}=t;if(N.isValidElement(i)){const a=gl(i),s=pl(o,i.props);return i.type!==N.Fragment&&(s.ref=n?io(n,a):a),N.cloneElement(i,s)}return N.Children.count(i)>1?N.Children.only(null):null});return e.displayName=`${r}.SlotClone`,e}var hl=Symbol("radix.slottable");function vl(r){return N.isValidElement(r)&&typeof r.type=="function"&&"__radixId"in r.type&&r.type.__radixId===hl}function pl(r,e){const t={...e};for(const n in e){const i=r[n],o=e[n];/^on[A-Z]/.test(n)?i&&o?t[n]=(...s)=>{const l=o(...s);return i(...s),l}:i&&(t[n]=i):n==="style"?t[n]={...i,...o}:n==="className"&&(t[n]=[i,o].filter(Boolean).join(" "))}return{...r,...t}}function gl(r){var n,i;let e=(n=Object.getOwnPropertyDescriptor(r.props,"ref"))==null?void 0:n.get,t=e&&"isReactWarning"in e&&e.isReactWarning;return t?r.ref:(e=(i=Object.getOwnPropertyDescriptor(r,"ref"))==null?void 0:i.get,t=e&&"isReactWarning"in e&&e.isReactWarning,t?r.props.ref:r.props.ref||r.ref)}var xl=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],lt=xl.reduce((r,e)=>{const t=oo(`Primitive.${e}`),n=N.forwardRef((i,o)=>{const{asChild:a,...s}=i,l=a?t:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),d.jsx(l,{...s,ref:o})});return n.displayName=`Primitive.${e}`,{...r,[e]:n}},{});function yl(r,e){r&&ks.flushSync(()=>r.dispatchEvent(e))}function nr(r){const e=N.useRef(r);return N.useEffect(()=>{e.current=r}),N.useMemo(()=>(...t)=>{var n;return(n=e.current)==null?void 0:n.call(e,...t)},[])}function Cl(r,e=globalThis==null?void 0:globalThis.document){const t=nr(r);N.useEffect(()=>{const n=i=>{i.key==="Escape"&&t(i)};return e.addEventListener("keydown",n,{capture:!0}),()=>e.removeEventListener("keydown",n,{capture:!0})},[t,e])}var ml="DismissableLayer",On="dismissableLayer.update",wl="dismissableLayer.pointerDownOutside",_l="dismissableLayer.focusOutside",ao,so=N.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),lo=N.forwardRef((r,e)=>{const{disableOutsidePointerEvents:t=!1,onEscapeKeyDown:n,onPointerDownOutside:i,onFocusOutside:o,onInteractOutside:a,onDismiss:s,...l}=r,u=N.useContext(so),[c,f]=N.useState(null),h=(c==null?void 0:c.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,v]=N.useState({}),p=mt(e,b=>f(b)),g=Array.from(u.layers),[m]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),y=g.indexOf(m),C=c?g.indexOf(c):-1,w=u.layersWithOutsidePointerEventsDisabled.size>0,E=C>=y,I=Il(b=>{const P=b.target,L=[...u.branches].some(M=>M.contains(P));!E||L||(i==null||i(b),a==null||a(b),b.defaultPrevented||s==null||s())},h),S=Sl(b=>{const P=b.target;[...u.branches].some(M=>M.contains(P))||(o==null||o(b),a==null||a(b),b.defaultPrevented||s==null||s())},h);return Cl(b=>{C===u.layers.size-1&&(n==null||n(b),!b.defaultPrevented&&s&&(b.preventDefault(),s()))},h),N.useEffect(()=>{if(c)return t&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(ao=h.body.style.pointerEvents,h.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(c)),u.layers.add(c),uo(),()=>{t&&u.layersWithOutsidePointerEventsDisabled.size===1&&(h.body.style.pointerEvents=ao)}},[c,h,t,u]),N.useEffect(()=>()=>{c&&(u.layers.delete(c),u.layersWithOutsidePointerEventsDisabled.delete(c),uo())},[c,u]),N.useEffect(()=>{const b=()=>v({});return document.addEventListener(On,b),()=>document.removeEventListener(On,b)},[]),d.jsx(lt.div,{...l,ref:p,style:{pointerEvents:w?E?"auto":"none":void 0,...r.style},onFocusCapture:ct(r.onFocusCapture,S.onFocusCapture),onBlurCapture:ct(r.onBlurCapture,S.onBlurCapture),onPointerDownCapture:ct(r.onPointerDownCapture,I.onPointerDownCapture)})});lo.displayName=ml;var Al="DismissableLayerBranch",El=N.forwardRef((r,e)=>{const t=N.useContext(so),n=N.useRef(null),i=mt(e,n);return N.useEffect(()=>{const o=n.current;if(o)return t.branches.add(o),()=>{t.branches.delete(o)}},[t.branches]),d.jsx(lt.div,{...r,ref:i})});El.displayName=Al;function Il(r,e=globalThis==null?void 0:globalThis.document){const t=nr(r),n=N.useRef(!1),i=N.useRef(()=>{});return N.useEffect(()=>{const o=s=>{if(s.target&&!n.current){let l=function(){co(wl,t,u,{discrete:!0})};const u={originalEvent:s};s.pointerType==="touch"?(e.removeEventListener("click",i.current),i.current=l,e.addEventListener("click",i.current,{once:!0})):l()}else e.removeEventListener("click",i.current);n.current=!1},a=window.setTimeout(()=>{e.addEventListener("pointerdown",o)},0);return()=>{window.clearTimeout(a),e.removeEventListener("pointerdown",o),e.removeEventListener("click",i.current)}},[e,t]),{onPointerDownCapture:()=>n.current=!0}}function Sl(r,e=globalThis==null?void 0:globalThis.document){const t=nr(r),n=N.useRef(!1);return N.useEffect(()=>{const i=o=>{o.target&&!n.current&&co(_l,t,{originalEvent:o},{discrete:!1})};return e.addEventListener("focusin",i),()=>e.removeEventListener("focusin",i)},[e,t]),{onFocusCapture:()=>n.current=!0,onBlurCapture:()=>n.current=!1}}function uo(){const r=new CustomEvent(On);document.dispatchEvent(r)}function co(r,e,t,{discrete:n}){const i=t.originalEvent.target,o=new CustomEvent(r,{bubbles:!1,cancelable:!0,detail:t});e&&i.addEventListener(r,e,{once:!0}),n?yl(i,o):i.dispatchEvent(o)}var Nn="focusScope.autoFocusOnMount",Dn="focusScope.autoFocusOnUnmount",fo={bubbles:!1,cancelable:!0},bl="FocusScope",ho=N.forwardRef((r,e)=>{const{loop:t=!1,trapped:n=!1,onMountAutoFocus:i,onUnmountAutoFocus:o,...a}=r,[s,l]=N.useState(null),u=nr(i),c=nr(o),f=N.useRef(null),h=mt(e,g=>l(g)),v=N.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;N.useEffect(()=>{if(n){let g=function(w){if(v.paused||!s)return;const E=w.target;s.contains(E)?f.current=E:ft(f.current,{select:!0})},m=function(w){if(v.paused||!s)return;const E=w.relatedTarget;E!==null&&(s.contains(E)||ft(f.current,{select:!0}))},y=function(w){if(document.activeElement===document.body)for(const I of w)I.removedNodes.length>0&&ft(s)};document.addEventListener("focusin",g),document.addEventListener("focusout",m);const C=new MutationObserver(y);return s&&C.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",g),document.removeEventListener("focusout",m),C.disconnect()}}},[n,s,v.paused]),N.useEffect(()=>{if(s){go.add(v);const g=document.activeElement;if(!s.contains(g)){const y=new CustomEvent(Nn,fo);s.addEventListener(Nn,u),s.dispatchEvent(y),y.defaultPrevented||(Tl(Pl(vo(s)),{select:!0}),document.activeElement===g&&ft(s))}return()=>{s.removeEventListener(Nn,u),setTimeout(()=>{const y=new CustomEvent(Dn,fo);s.addEventListener(Dn,c),s.dispatchEvent(y),y.defaultPrevented||ft(g??document.body,{select:!0}),s.removeEventListener(Dn,c),go.remove(v)},0)}}},[s,u,c,v]);const p=N.useCallback(g=>{if(!t&&!n||v.paused)return;const m=g.key==="Tab"&&!g.altKey&&!g.ctrlKey&&!g.metaKey,y=document.activeElement;if(m&&y){const C=g.currentTarget,[w,E]=Ol(C);w&&E?!g.shiftKey&&y===E?(g.preventDefault(),t&&ft(w,{select:!0})):g.shiftKey&&y===w&&(g.preventDefault(),t&&ft(E,{select:!0})):y===C&&g.preventDefault()}},[t,n,v.paused]);return d.jsx(lt.div,{tabIndex:-1,...a,ref:h,onKeyDown:p})});ho.displayName=bl;function Tl(r,{select:e=!1}={}){const t=document.activeElement;for(const n of r)if(ft(n,{select:e}),document.activeElement!==t)return}function Ol(r){const e=vo(r),t=po(e,r),n=po(e.reverse(),r);return[t,n]}function vo(r){const e=[],t=document.createTreeWalker(r,NodeFilter.SHOW_ELEMENT,{acceptNode:n=>{const i=n.tagName==="INPUT"&&n.type==="hidden";return n.disabled||n.hidden||i?NodeFilter.FILTER_SKIP:n.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;t.nextNode();)e.push(t.currentNode);return e}function po(r,e){for(const t of r)if(!Nl(t,{upTo:e}))return t}function Nl(r,{upTo:e}){if(getComputedStyle(r).visibility==="hidden")return!0;for(;r;){if(e!==void 0&&r===e)return!1;if(getComputedStyle(r).display==="none")return!0;r=r.parentElement}return!1}function Dl(r){return r instanceof HTMLInputElement&&"select"in r}function ft(r,{select:e=!1}={}){if(r&&r.focus){const t=document.activeElement;r.focus({preventScroll:!0}),r!==t&&Dl(r)&&e&&r.select()}}var go=Ml();function Ml(){let r=[];return{add(e){const t=r[0];e!==t&&(t==null||t.pause()),r=xo(r,e),r.unshift(e)},remove(e){var t;r=xo(r,e),(t=r[0])==null||t.resume()}}}function xo(r,e){const t=[...r],n=t.indexOf(e);return n!==-1&&t.splice(n,1),t}function Pl(r){return r.filter(e=>e.tagName!=="A")}var Fl="Portal",yo=N.forwardRef((r,e)=>{var s;const{container:t,...n}=r,[i,o]=N.useState(!1);rr(()=>o(!0),[]);const a=t||i&&((s=globalThis==null?void 0:globalThis.document)==null?void 0:s.body);return a?Gi.createPortal(d.jsx(lt.div,{...n,ref:e}),a):null});yo.displayName=Fl;function Bl(r,e){return N.useReducer((t,n)=>e[t][n]??t,r)}var Dr=r=>{const{present:e,children:t}=r,n=Ll(e),i=typeof t=="function"?t({present:n.isPresent}):N.Children.only(t),o=mt(n.ref,Rl(i));return typeof t=="function"||n.isPresent?N.cloneElement(i,{ref:o}):null};Dr.displayName="Presence";function Ll(r){const[e,t]=N.useState(),n=N.useRef(null),i=N.useRef(r),o=N.useRef("none"),a=r?"mounted":"unmounted",[s,l]=Bl(a,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return N.useEffect(()=>{const u=Mr(n.current);o.current=s==="mounted"?u:"none"},[s]),rr(()=>{const u=n.current,c=i.current;if(c!==r){const h=o.current,v=Mr(u);r?l("MOUNT"):v==="none"||(u==null?void 0:u.display)==="none"?l("UNMOUNT"):l(c&&h!==v?"ANIMATION_OUT":"UNMOUNT"),i.current=r}},[r,l]),rr(()=>{if(e){let u;const c=e.ownerDocument.defaultView??window,f=v=>{const g=Mr(n.current).includes(v.animationName);if(v.target===e&&g&&(l("ANIMATION_END"),!i.current)){const m=e.style.animationFillMode;e.style.animationFillMode="forwards",u=c.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=m)})}},h=v=>{v.target===e&&(o.current=Mr(n.current))};return e.addEventListener("animationstart",h),e.addEventListener("animationcancel",f),e.addEventListener("animationend",f),()=>{c.clearTimeout(u),e.removeEventListener("animationstart",h),e.removeEventListener("animationcancel",f),e.removeEventListener("animationend",f)}}else l("ANIMATION_END")},[e,l]),{isPresent:["mounted","unmountSuspended"].includes(s),ref:N.useCallback(u=>{n.current=u?getComputedStyle(u):null,t(u)},[])}}function Mr(r){return(r==null?void 0:r.animationName)||"none"}function Rl(r){var n,i;let e=(n=Object.getOwnPropertyDescriptor(r.props,"ref"))==null?void 0:n.get,t=e&&"isReactWarning"in e&&e.isReactWarning;return t?r.ref:(e=(i=Object.getOwnPropertyDescriptor(r,"ref"))==null?void 0:i.get,t=e&&"isReactWarning"in e&&e.isReactWarning,t?r.props.ref:r.props.ref||r.ref)}var Mn=0;function Vl(){N.useEffect(()=>{const r=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",r[0]??Co()),document.body.insertAdjacentElement("beforeend",r[1]??Co()),Mn++,()=>{Mn===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),Mn--}},[])}function Co(){const r=document.createElement("span");return r.setAttribute("data-radix-focus-guard",""),r.tabIndex=0,r.style.outline="none",r.style.opacity="0",r.style.position="fixed",r.style.pointerEvents="none",r}var tt=function(){return tt=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++){t=arguments[n];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}return e},tt.apply(this,arguments)};function mo(r,e){var t={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&e.indexOf(n)<0&&(t[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(r);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(r,n[i])&&(t[n[i]]=r[n[i]]);return t}function kl(r,e,t){if(t||arguments.length===2)for(var n=0,i=e.length,o;n<i;n++)(o||!(n in e))&&(o||(o=Array.prototype.slice.call(e,0,n)),o[n]=e[n]);return r.concat(o||Array.prototype.slice.call(e))}typeof SuppressedError=="function"&&SuppressedError;var Pr="right-scroll-bar-position",Fr="width-before-scroll-bar",zl="with-scroll-bars-hidden",Ul="--removed-body-scroll-bar-size";function Pn(r,e){return typeof r=="function"?r(e):r&&(r.current=e),r}function Hl(r,e){var t=A.useState(function(){return{value:r,callback:e,facade:{get current(){return t.value},set current(n){var i=t.value;i!==n&&(t.value=n,t.callback(n,i))}}}})[0];return t.callback=e,t.facade}var Gl=typeof window<"u"?N.useLayoutEffect:N.useEffect,wo=new WeakMap;function Wl(r,e){var t=Hl(null,function(n){return r.forEach(function(i){return Pn(i,n)})});return Gl(function(){var n=wo.get(t);if(n){var i=new Set(n),o=new Set(r),a=t.current;i.forEach(function(s){o.has(s)||Pn(s,null)}),o.forEach(function(s){i.has(s)||Pn(s,a)})}wo.set(t,r)},[r]),t}function Xl(r){return r}function $l(r,e){e===void 0&&(e=Xl);var t=[],n=!1,i={read:function(){if(n)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return t.length?t[t.length-1]:r},useMedium:function(o){var a=e(o,n);return t.push(a),function(){t=t.filter(function(s){return s!==a})}},assignSyncMedium:function(o){for(n=!0;t.length;){var a=t;t=[],a.forEach(o)}t={push:function(s){return o(s)},filter:function(){return t}}},assignMedium:function(o){n=!0;var a=[];if(t.length){var s=t;t=[],s.forEach(o),a=t}var l=function(){var c=a;a=[],c.forEach(o)},u=function(){return Promise.resolve().then(l)};u(),t={push:function(c){a.push(c),u()},filter:function(c){return a=a.filter(c),t}}}};return i}function jl(r){r===void 0&&(r={});var e=$l(null);return e.options=tt({async:!0,ssr:!1},r),e}var _o=function(r){var e=r.sideCar,t=mo(r,["sideCar"]);if(!e)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var n=e.read();if(!n)throw new Error("Sidecar medium not found");return N.createElement(n,tt({},t))};_o.isSideCarExport=!0;function ql(r,e){return r.useMedium(e),_o}var Ao=jl(),Fn=function(){},Br=N.forwardRef(function(r,e){var t=N.useRef(null),n=N.useState({onScrollCapture:Fn,onWheelCapture:Fn,onTouchMoveCapture:Fn}),i=n[0],o=n[1],a=r.forwardProps,s=r.children,l=r.className,u=r.removeScrollBar,c=r.enabled,f=r.shards,h=r.sideCar,v=r.noIsolation,p=r.inert,g=r.allowPinchZoom,m=r.as,y=m===void 0?"div":m,C=r.gapMode,w=mo(r,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as","gapMode"]),E=h,I=Wl([t,e]),S=tt(tt({},w),i);return N.createElement(N.Fragment,null,c&&N.createElement(E,{sideCar:Ao,removeScrollBar:u,shards:f,noIsolation:v,inert:p,setCallbacks:o,allowPinchZoom:!!g,lockRef:t,gapMode:C}),a?N.cloneElement(N.Children.only(s),tt(tt({},S),{ref:I})):N.createElement(y,tt({},S,{className:l,ref:I}),s))});Br.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},Br.classNames={fullWidth:Fr,zeroRight:Pr};var Yl=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function Zl(){if(!document)return null;var r=document.createElement("style");r.type="text/css";var e=Yl();return e&&r.setAttribute("nonce",e),r}function Kl(r,e){r.styleSheet?r.styleSheet.cssText=e:r.appendChild(document.createTextNode(e))}function Ql(r){var e=document.head||document.getElementsByTagName("head")[0];e.appendChild(r)}var Jl=function(){var r=0,e=null;return{add:function(t){r==0&&(e=Zl())&&(Kl(e,t),Ql(e)),r++},remove:function(){r--,!r&&e&&(e.parentNode&&e.parentNode.removeChild(e),e=null)}}},eu=function(){var r=Jl();return function(e,t){N.useEffect(function(){return r.add(e),function(){r.remove()}},[e&&t])}},Eo=function(){var r=eu(),e=function(t){var n=t.styles,i=t.dynamic;return r(n,i),null};return e},tu={left:0,top:0,right:0,gap:0},Bn=function(r){return parseInt(r||"",10)||0},ru=function(r){var e=window.getComputedStyle(document.body),t=e[r==="padding"?"paddingLeft":"marginLeft"],n=e[r==="padding"?"paddingTop":"marginTop"],i=e[r==="padding"?"paddingRight":"marginRight"];return[Bn(t),Bn(n),Bn(i)]},nu=function(r){if(r===void 0&&(r="margin"),typeof window>"u")return tu;var e=ru(r),t=document.documentElement.clientWidth,n=window.innerWidth;return{left:e[0],top:e[1],right:e[2],gap:Math.max(0,n-t+e[2]-e[0])}},iu=Eo(),Ft="data-scroll-locked",ou=function(r,e,t,n){var i=r.left,o=r.top,a=r.right,s=r.gap;return t===void 0&&(t="margin"),`
|
|
2
|
+
.`.concat(zl,` {
|
|
3
3
|
overflow: hidden `).concat(n,`;
|
|
4
4
|
padding-right: `).concat(s,"px ").concat(n,`;
|
|
5
5
|
}
|
|
6
|
-
body[`).concat(
|
|
6
|
+
body[`).concat(Ft,`] {
|
|
7
7
|
overflow: hidden `).concat(n,`;
|
|
8
8
|
overscroll-behavior: contain;
|
|
9
9
|
`).concat([e&&"position: relative ".concat(n,";"),t==="margin"&&`
|
|
10
10
|
padding-left: `.concat(i,`px;
|
|
11
|
-
padding-top: `).concat(
|
|
12
|
-
padding-right: `).concat(
|
|
11
|
+
padding-top: `).concat(o,`px;
|
|
12
|
+
padding-right: `).concat(a,`px;
|
|
13
13
|
margin-left:0;
|
|
14
14
|
margin-top:0;
|
|
15
15
|
margin-right: `).concat(s,"px ").concat(n,`;
|
|
16
16
|
`),t==="padding"&&"padding-right: ".concat(s,"px ").concat(n,";")].filter(Boolean).join(""),`
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
.`).concat(
|
|
19
|
+
.`).concat(Pr,` {
|
|
20
20
|
right: `).concat(s,"px ").concat(n,`;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
.`).concat(
|
|
23
|
+
.`).concat(Fr,` {
|
|
24
24
|
margin-right: `).concat(s,"px ").concat(n,`;
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
.`).concat(
|
|
27
|
+
.`).concat(Pr," .").concat(Pr,` {
|
|
28
28
|
right: 0 `).concat(n,`;
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
.`).concat(
|
|
31
|
+
.`).concat(Fr," .").concat(Fr,` {
|
|
32
32
|
margin-right: 0 `).concat(n,`;
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
body[`).concat(
|
|
36
|
-
`).concat(
|
|
35
|
+
body[`).concat(Ft,`] {
|
|
36
|
+
`).concat(Ul,": ").concat(s,`px;
|
|
37
37
|
}
|
|
38
|
-
`)},
|
|
38
|
+
`)},Io=function(){var r=parseInt(document.body.getAttribute(Ft)||"0",10);return isFinite(r)?r:0},au=function(){N.useEffect(function(){return document.body.setAttribute(Ft,(Io()+1).toString()),function(){var r=Io()-1;r<=0?document.body.removeAttribute(Ft):document.body.setAttribute(Ft,r.toString())}},[])},su=function(r){var e=r.noRelative,t=r.noImportant,n=r.gapMode,i=n===void 0?"margin":n;au();var o=N.useMemo(function(){return nu(i)},[i]);return N.createElement(iu,{styles:ou(o,!e,i,t?"":"!important")})},Ln=!1;if(typeof window<"u")try{var Lr=Object.defineProperty({},"passive",{get:function(){return Ln=!0,!0}});window.addEventListener("test",Lr,Lr),window.removeEventListener("test",Lr,Lr)}catch{Ln=!1}var Bt=Ln?{passive:!1}:!1,lu=function(r){return r.tagName==="TEXTAREA"},So=function(r,e){if(!(r instanceof Element))return!1;var t=window.getComputedStyle(r);return t[e]!=="hidden"&&!(t.overflowY===t.overflowX&&!lu(r)&&t[e]==="visible")},uu=function(r){return So(r,"overflowY")},cu=function(r){return So(r,"overflowX")},bo=function(r,e){var t=e.ownerDocument,n=e;do{typeof ShadowRoot<"u"&&n instanceof ShadowRoot&&(n=n.host);var i=To(r,n);if(i){var o=Oo(r,n),a=o[1],s=o[2];if(a>s)return!0}n=n.parentNode}while(n&&n!==t.body);return!1},fu=function(r){var e=r.scrollTop,t=r.scrollHeight,n=r.clientHeight;return[e,t,n]},du=function(r){var e=r.scrollLeft,t=r.scrollWidth,n=r.clientWidth;return[e,t,n]},To=function(r,e){return r==="v"?uu(e):cu(e)},Oo=function(r,e){return r==="v"?fu(e):du(e)},hu=function(r,e){return r==="h"&&e==="rtl"?-1:1},vu=function(r,e,t,n,i){var o=hu(r,window.getComputedStyle(e).direction),a=o*n,s=t.target,l=e.contains(s),u=!1,c=a>0,f=0,h=0;do{var v=Oo(r,s),p=v[0],g=v[1],m=v[2],y=g-m-o*p;(p||y)&&To(r,s)&&(f+=y,h+=p),s instanceof ShadowRoot?s=s.host:s=s.parentNode}while(!l&&s!==document.body||l&&(e.contains(s)||e===s));return(c&&Math.abs(f)<1||!c&&Math.abs(h)<1)&&(u=!0),u},Rr=function(r){return"changedTouches"in r?[r.changedTouches[0].clientX,r.changedTouches[0].clientY]:[0,0]},No=function(r){return[r.deltaX,r.deltaY]},Do=function(r){return r&&"current"in r?r.current:r},pu=function(r,e){return r[0]===e[0]&&r[1]===e[1]},gu=function(r){return`
|
|
39
39
|
.block-interactivity-`.concat(r,` {pointer-events: none;}
|
|
40
40
|
.allow-interactivity-`).concat(r,` {pointer-events: all;}
|
|
41
|
-
`)},
|
|
41
|
+
`)},xu=0,Lt=[];function yu(r){var e=N.useRef([]),t=N.useRef([0,0]),n=N.useRef(),i=N.useState(xu++)[0],o=N.useState(Eo)[0],a=N.useRef(r);N.useEffect(function(){a.current=r},[r]),N.useEffect(function(){if(r.inert){document.body.classList.add("block-interactivity-".concat(i));var g=kl([r.lockRef.current],(r.shards||[]).map(Do),!0).filter(Boolean);return g.forEach(function(m){return m.classList.add("allow-interactivity-".concat(i))}),function(){document.body.classList.remove("block-interactivity-".concat(i)),g.forEach(function(m){return m.classList.remove("allow-interactivity-".concat(i))})}}},[r.inert,r.lockRef.current,r.shards]);var s=N.useCallback(function(g,m){if("touches"in g&&g.touches.length===2||g.type==="wheel"&&g.ctrlKey)return!a.current.allowPinchZoom;var y=Rr(g),C=t.current,w="deltaX"in g?g.deltaX:C[0]-y[0],E="deltaY"in g?g.deltaY:C[1]-y[1],I,S=g.target,b=Math.abs(w)>Math.abs(E)?"h":"v";if("touches"in g&&b==="h"&&S.type==="range")return!1;var P=bo(b,S);if(!P)return!0;if(P?I=b:(I=b==="v"?"h":"v",P=bo(b,S)),!P)return!1;if(!n.current&&"changedTouches"in g&&(w||E)&&(n.current=I),!I)return!0;var L=n.current||I;return vu(L,m,g,L==="h"?w:E)},[]),l=N.useCallback(function(g){var m=g;if(!(!Lt.length||Lt[Lt.length-1]!==o)){var y="deltaY"in m?No(m):Rr(m),C=e.current.filter(function(I){return I.name===m.type&&(I.target===m.target||m.target===I.shadowParent)&&pu(I.delta,y)})[0];if(C&&C.should){m.cancelable&&m.preventDefault();return}if(!C){var w=(a.current.shards||[]).map(Do).filter(Boolean).filter(function(I){return I.contains(m.target)}),E=w.length>0?s(m,w[0]):!a.current.noIsolation;E&&m.cancelable&&m.preventDefault()}}},[]),u=N.useCallback(function(g,m,y,C){var w={name:g,delta:m,target:y,should:C,shadowParent:Cu(y)};e.current.push(w),setTimeout(function(){e.current=e.current.filter(function(E){return E!==w})},1)},[]),c=N.useCallback(function(g){t.current=Rr(g),n.current=void 0},[]),f=N.useCallback(function(g){u(g.type,No(g),g.target,s(g,r.lockRef.current))},[]),h=N.useCallback(function(g){u(g.type,Rr(g),g.target,s(g,r.lockRef.current))},[]);N.useEffect(function(){return Lt.push(o),r.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:h}),document.addEventListener("wheel",l,Bt),document.addEventListener("touchmove",l,Bt),document.addEventListener("touchstart",c,Bt),function(){Lt=Lt.filter(function(g){return g!==o}),document.removeEventListener("wheel",l,Bt),document.removeEventListener("touchmove",l,Bt),document.removeEventListener("touchstart",c,Bt)}},[]);var v=r.removeScrollBar,p=r.inert;return N.createElement(N.Fragment,null,p?N.createElement(o,{styles:gu(i)}):null,v?N.createElement(su,{gapMode:r.gapMode}):null)}function Cu(r){for(var e=null;r!==null;)r instanceof ShadowRoot&&(e=r.host,r=r.host),r=r.parentNode;return e}const mu=ql(Ao,yu);var Mo=N.forwardRef(function(r,e){return N.createElement(Br,tt({},r,{ref:e,sideCar:mu}))});Mo.classNames=Br.classNames;var wu=function(r){if(typeof document>"u")return null;var e=Array.isArray(r)?r[0]:r;return e.ownerDocument.body},Rt=new WeakMap,Vr=new WeakMap,kr={},Rn=0,Po=function(r){return r&&(r.host||Po(r.parentNode))},_u=function(r,e){return e.map(function(t){if(r.contains(t))return t;var n=Po(t);return n&&r.contains(n)?n:(console.error("aria-hidden",t,"in not contained inside",r,". Doing nothing"),null)}).filter(function(t){return!!t})},Au=function(r,e,t,n){var i=_u(e,Array.isArray(r)?r:[r]);kr[t]||(kr[t]=new WeakMap);var o=kr[t],a=[],s=new Set,l=new Set(i),u=function(f){!f||s.has(f)||(s.add(f),u(f.parentNode))};i.forEach(u);var c=function(f){!f||l.has(f)||Array.prototype.forEach.call(f.children,function(h){if(s.has(h))c(h);else try{var v=h.getAttribute(n),p=v!==null&&v!=="false",g=(Rt.get(h)||0)+1,m=(o.get(h)||0)+1;Rt.set(h,g),o.set(h,m),a.push(h),g===1&&p&&Vr.set(h,!0),m===1&&h.setAttribute(t,"true"),p||h.setAttribute(n,"true")}catch(y){console.error("aria-hidden: cannot operate on ",h,y)}})};return c(e),s.clear(),Rn++,function(){a.forEach(function(f){var h=Rt.get(f)-1,v=o.get(f)-1;Rt.set(f,h),o.set(f,v),h||(Vr.has(f)||f.removeAttribute(n),Vr.delete(f)),v||f.removeAttribute(t)}),Rn--,Rn||(Rt=new WeakMap,Rt=new WeakMap,Vr=new WeakMap,kr={})}},Eu=function(r,e,t){t===void 0&&(t="data-aria-hidden");var n=Array.from(Array.isArray(r)?r:[r]),i=wu(r);return i?(n.push.apply(n,Array.from(i.querySelectorAll("[aria-live]"))),Au(n,i,t,"aria-hidden")):function(){return null}},zr="Dialog",[Fo,e0]=il(zr),[Iu,Ze]=Fo(zr),Bo=r=>{const{__scopeDialog:e,children:t,open:n,defaultOpen:i,onOpenChange:o,modal:a=!0}=r,s=N.useRef(null),l=N.useRef(null),[u,c]=ul({prop:n,defaultProp:i??!1,onChange:o,caller:zr});return d.jsx(Iu,{scope:e,triggerRef:s,contentRef:l,contentId:Tn(),titleId:Tn(),descriptionId:Tn(),open:u,onOpenChange:c,onOpenToggle:N.useCallback(()=>c(f=>!f),[c]),modal:a,children:t})};Bo.displayName=zr;var Lo="DialogTrigger",Ro=N.forwardRef((r,e)=>{const{__scopeDialog:t,...n}=r,i=Ze(Lo,t),o=mt(e,i.triggerRef);return d.jsx(lt.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.contentId,"data-state":zn(i.open),...n,ref:o,onClick:ct(r.onClick,i.onOpenToggle)})});Ro.displayName=Lo;var Vn="DialogPortal",[Su,Vo]=Fo(Vn,{forceMount:void 0}),ko=r=>{const{__scopeDialog:e,forceMount:t,children:n,container:i}=r,o=Ze(Vn,e);return d.jsx(Su,{scope:e,forceMount:t,children:N.Children.map(n,a=>d.jsx(Dr,{present:t||o.open,children:d.jsx(yo,{asChild:!0,container:i,children:a})}))})};ko.displayName=Vn;var Ur="DialogOverlay",zo=N.forwardRef((r,e)=>{const t=Vo(Ur,r.__scopeDialog),{forceMount:n=t.forceMount,...i}=r,o=Ze(Ur,r.__scopeDialog);return o.modal?d.jsx(Dr,{present:n||o.open,children:d.jsx(Tu,{...i,ref:e})}):null});zo.displayName=Ur;var bu=oo("DialogOverlay.RemoveScroll"),Tu=N.forwardRef((r,e)=>{const{__scopeDialog:t,...n}=r,i=Ze(Ur,t);return d.jsx(Mo,{as:bu,allowPinchZoom:!0,shards:[i.contentRef],children:d.jsx(lt.div,{"data-state":zn(i.open),...n,ref:e,style:{pointerEvents:"auto",...n.style}})})}),wt="DialogContent",Uo=N.forwardRef((r,e)=>{const t=Vo(wt,r.__scopeDialog),{forceMount:n=t.forceMount,...i}=r,o=Ze(wt,r.__scopeDialog);return d.jsx(Dr,{present:n||o.open,children:o.modal?d.jsx(Ou,{...i,ref:e}):d.jsx(Nu,{...i,ref:e})})});Uo.displayName=wt;var Ou=N.forwardRef((r,e)=>{const t=Ze(wt,r.__scopeDialog),n=N.useRef(null),i=mt(e,t.contentRef,n);return N.useEffect(()=>{const o=n.current;if(o)return Eu(o)},[]),d.jsx(Ho,{...r,ref:i,trapFocus:t.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:ct(r.onCloseAutoFocus,o=>{var a;o.preventDefault(),(a=t.triggerRef.current)==null||a.focus()}),onPointerDownOutside:ct(r.onPointerDownOutside,o=>{const a=o.detail.originalEvent,s=a.button===0&&a.ctrlKey===!0;(a.button===2||s)&&o.preventDefault()}),onFocusOutside:ct(r.onFocusOutside,o=>o.preventDefault())})}),Nu=N.forwardRef((r,e)=>{const t=Ze(wt,r.__scopeDialog),n=N.useRef(!1),i=N.useRef(!1);return d.jsx(Ho,{...r,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:o=>{var a,s;(a=r.onCloseAutoFocus)==null||a.call(r,o),o.defaultPrevented||(n.current||(s=t.triggerRef.current)==null||s.focus(),o.preventDefault()),n.current=!1,i.current=!1},onInteractOutside:o=>{var l,u;(l=r.onInteractOutside)==null||l.call(r,o),o.defaultPrevented||(n.current=!0,o.detail.originalEvent.type==="pointerdown"&&(i.current=!0));const a=o.target;((u=t.triggerRef.current)==null?void 0:u.contains(a))&&o.preventDefault(),o.detail.originalEvent.type==="focusin"&&i.current&&o.preventDefault()}})}),Ho=N.forwardRef((r,e)=>{const{__scopeDialog:t,trapFocus:n,onOpenAutoFocus:i,onCloseAutoFocus:o,...a}=r,s=Ze(wt,t),l=N.useRef(null),u=mt(e,l);return Vl(),d.jsxs(d.Fragment,{children:[d.jsx(ho,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:i,onUnmountAutoFocus:o,children:d.jsx(lo,{role:"dialog",id:s.contentId,"aria-describedby":s.descriptionId,"aria-labelledby":s.titleId,"data-state":zn(s.open),...a,ref:u,onDismiss:()=>s.onOpenChange(!1)})}),d.jsxs(d.Fragment,{children:[d.jsx(Pu,{titleId:s.titleId}),d.jsx(Bu,{contentRef:l,descriptionId:s.descriptionId})]})]})}),kn="DialogTitle",Du=N.forwardRef((r,e)=>{const{__scopeDialog:t,...n}=r,i=Ze(kn,t);return d.jsx(lt.h2,{id:i.titleId,...n,ref:e})});Du.displayName=kn;var Go="DialogDescription",Mu=N.forwardRef((r,e)=>{const{__scopeDialog:t,...n}=r,i=Ze(Go,t);return d.jsx(lt.p,{id:i.descriptionId,...n,ref:e})});Mu.displayName=Go;var Wo="DialogClose",Xo=N.forwardRef((r,e)=>{const{__scopeDialog:t,...n}=r,i=Ze(Wo,t);return d.jsx(lt.button,{type:"button",...n,ref:e,onClick:ct(r.onClick,()=>i.onOpenChange(!1))})});Xo.displayName=Wo;function zn(r){return r?"open":"closed"}var $o="DialogTitleWarning",[t0,jo]=nl($o,{contentName:wt,titleName:kn,docsSlug:"dialog"}),Pu=({titleId:r})=>{const e=jo($o),t=`\`${e.contentName}\` requires a \`${e.titleName}\` for the component to be accessible for screen reader users.
|
|
42
42
|
|
|
43
43
|
If you want to hide the \`${e.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
44
44
|
|
|
45
|
-
For more information, see https://radix-ui.com/primitives/docs/components/${e.docsSlug}`;return O.useEffect(()=>{r&&(document.getElementById(r)||console.error(t))},[t,r]),null},Gf="DialogDescriptionWarning",Wf=({contentRef:r,descriptionId:e})=>{const n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${ma(Gf).contentName}}.`;return O.useEffect(()=>{var a;const i=(a=r.current)==null?void 0:a.getAttribute("aria-describedby");e&&i&&(document.getElementById(e)||console.warn(n))},[n,r,e]),null},Ca=fa,Xf=ca,Aa=da,_a=ha,Ea=va,Ia=ya;const An=I.memo(r=>{const{file:e,onClose:t}=r,n=I.useRef(null),i=I.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(f=>{f&&navigator.clipboard.write([new ClipboardItem({"image/png":f})])},"image/png")},[]),a=I.useCallback(()=>{Ei.saveAs(e,e.name)},[e]);return g.jsx(Ca,{open:!0,onOpenChange:t,children:g.jsx(Aa,{children:g.jsx(_a,{className:"bg-(--color-background) fixed inset-0 data-[state='open']:fade-in-0 data-[state='open']:zoom-in-95 data-[state='closed']:animate-out data-[state='closed']:fade-out-0 data-[state='closed']:zoom-out-95 data-[state='open']:animate-in","data-floating-content":"",children:g.jsxs(Ea,{className:"absolute inset-0 py-12","data-floating-content":"",onOpenAutoFocus:o=>o.preventDefault(),children:[g.jsxs(E.ButtonGroup,{className:"flex gap-2 items-center top-0 absolute right-0 p-2",accentColor:"base",variant:"ghost",children:[g.jsxs(E.Tooltip.Root,{children:[g.jsx(E.Tooltip.Trigger,{asChild:!0,children:g.jsx(E.IconButton,{onClick:i,"aria-label":"copy to clipboard",children:g.jsx(E.RiIcon,{icon:"RiFileCopyLine"})})}),g.jsx(E.Tooltip.Content,{size:"sm",children:"Copy"})]}),g.jsxs(E.Tooltip.Root,{children:[g.jsx(E.Tooltip.Trigger,{asChild:!0,children:g.jsx(E.IconButton,{onClick:a,"aria-label":"download",children:g.jsx(E.RiIcon,{icon:"RiDownload2Line"})})}),g.jsx(E.Tooltip.Content,{size:"sm",children:"Download"})]}),g.jsx(E.Separator,{orientation:"vertical",size:"sm"}),g.jsx(Ia,{asChild:!0,children:g.jsx(E.IconButton,{onClick:t,"aria-label":"close",children:g.jsx(E.RiIcon,{icon:"RiCloseLine"})})})]}),g.jsx("figure",{className:"size-full overflow-hidden p-4 flex justify-center items-center",children:g.jsx("img",{ref:n,className:"max-w-full max-h-full",src:URL.createObjectURL(e),alt:e.name})})]})})})})});An.displayName="ImageViewer";const Sa=I.memo(r=>{const{children:e}=r,[t,n]=I.useState(null),i=I.useCallback(()=>{n(null)},[]),a=I.useCallback(f=>{n(f(i))},[i]),o=I.useCallback(()=>{t&&(t.onClose&&t.onClose(),i())},[i,t]),s=I.useMemo(()=>a,[a]);return g.jsxs(Ni.Provider,{value:s,children:[e,t&&g.jsx(An,{file:t.file,onClose:o})]})});Sa.displayName="FileViewerProvider";const ke=r=>{const{className:e,label:t,children:n,severity:i,inputId:a,labelId:o,image:s}=r,[f,u]=I.useState(void 0),c=vr(),l=i?lt[i]:"base";I.useEffect(()=>{s instanceof Promise?s.then(u).catch(console.error):u(s)},[s]);const d=f?URL.createObjectURL(f):void 0,h=I.useCallback(()=>{f&&c(()=>({file:f}))},[c,f]);return g.jsxs("div",{className:"flex flex-col gap-1",children:[f&&g.jsx("img",{className:"h-[100px] w-full min-w-[300px] cursor-pointer rounded-md object-cover",src:d,alt:f.name,onClick:h}),!!t&&g.jsx("label",{className:Et.cx(e,"w-max max-w-full"),htmlFor:a,children:g.jsx(E.Text,{accentColor:l,size:"sm",id:o,className:"text-wrap",children:t})}),n]})},Ue=r=>{const{children:e,...t}=r;return g.jsx(fn,{...t,children:e})},_n=I.memo(r=>{const[{inputId:e,labelId:t,size:n,severity:i,showInputOnly:a,field:o,helpText:s,label:f,fieldProps:u},c]=Le(r),l=a?null:s,d=a?"":f,{name:h,onChange:v,onBlur:p}=u,x=`${e}-droppable`,{disabled:m}=c,w=u.value??cr,[C,A]=I.useState(""),[_,b]=I.useState(""),T=_||l,D=I.useCallback(j=>{v(j),p(j)},[v,p]),M=I.useCallback(j=>{w&&w.findIndex(we=>we===j.target.value.trim())>=0?b("All options must be unique"):j.target.value?b(""):b("Option cannot be empty"),A(j.target.value)},[A,w]),B=I.useCallback(()=>{if(_)return;if(!C.trim()){b("Option cannot be empty");return}const j=C.trim();D([...w,j]),A("")},[C,_,D,w]),U=I.useCallback(j=>{j.key==="Enter"&&(j.preventDefault(),B())},[B]),H=I.useCallback(j=>{D(dr(w,j))},[w,D]),W=I.useCallback(j=>{if(!j.destination)return;const we=j.source.index,et=j.destination.index;D(an(w,we,et))},[D,w]),se=I.useCallback(()=>{p(w)},[p,w]);return g.jsx(rt.DragDropContext,{onDragEnd:W,children:g.jsxs("div",{className:"flex flex-col gap-2",children:[g.jsx(Ue,{helpText:T,severity:i,children:g.jsx(ke,{size:n,severity:i,inputId:e,labelId:t,label:d,image:a?void 0:o.image,children:(!m||w.length===0)&&g.jsxs("div",{className:"flex gap-2",children:[g.jsx(E.Input.Root,{className:"grow",accentColor:"base",variant:"surface",size:"sm",children:g.jsx(E.Input.Field,{value:C,onChange:M,onKeyDown:U,id:e,placeholder:o.placeholder,onBlur:se,name:h,...c})}),g.jsx(E.IconButton,{size:"sm",accentColor:"base",variant:"soft",type:"button","aria-label":"Add option",disabled:!!_||m,onClick:B,children:g.jsx(E.RiIcon,{icon:"RiAddLine"})})]})})}),w.length!==0&&g.jsx(rt.Droppable,{droppableId:x,children:j=>g.jsxs("div",{className:"flex flex-col gap-1",...j.droppableProps,ref:j.innerRef,children:[w.map((we,et)=>g.jsx(rt.Draggable,{draggableId:`${we}-draggable`,index:et,isDragDisabled:m,children:({draggableProps:Ge,dragHandleProps:Ai,innerRef:tn})=>g.jsxs(E.Badge,{...Ai,...Ge,ref:tn,className:"flex items-center justify-between gap-2",accentColor:"base",size:"sm",variant:"soft",children:[g.jsx("span",{className:"truncate",children:typeof we=="object"&&"label"in we?we.label:we}),g.jsx(E.IconButton,{size:"xs",variant:"ghost",type:"button","aria-label":"Delete option",accentColor:"base",disabled:m,onClick:()=>{H(et)},children:g.jsx(E.RiIcon,{icon:"RiCloseLargeLine"})})]})},we)),j.placeholder]})})]})})});_n.displayName="MultiStringInput";const ba={...Me,type:"multi-string",minimum_length:0,maximum_length:null},Bt=class Bt extends ve{constructor(t){const{minimum_length:n,maximum_length:i,placeholder:a,...o}=t;super({...o,type:"multi-string"});F(this,"minLength");F(this,"maxLength");F(this,"onlyValidateAfterTouched",!1);F(this,"placeholder");this.minLength=n??0,this.maxLength=i??1/0,this.placeholder=a??"Press enter to add a new option"}getInput(t){return g.jsx(_n,{field:this,...t})}serialize(){return{...super._serialize(),minimum_length:this.minLength,maximum_length:this.maxLength,placeholder:this.placeholder}}isBlank(t){return super.isBlank(t)||(t==null?void 0:t.length)===0}isEqual(t,n){return t===void 0&&n===void 0?!0:t===void 0||n===void 0?!1:t.every(i=>n.includes(i))&&n.every(i=>t.includes(i))}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){if(t.type!=="multi-string")throw new Error("Type mismatch.");return new Bt(t)}};F(Bt,"fieldTypeName","Multi-string"),F(Bt,"fieldTypeDescription","Allows the user to provide multiple unique strings."),F(Bt,"Icon",me.RiListCheck);let pt=Bt;class En extends ve{constructor(t){const{placeholder:n="",...i}=t;super(i);F(this,"options");F(this,"onlyValidateAfterTouched",!1);F(this,"placeholder");this.placeholder=n;const a=new Set;this.options=t.options.map(o=>(typeof o=="string"&&(o={label:o,value:o}),a.add(o.label),o)),a.size!==t.options.length&&console.error(`${t.options.length-a.size} duplicate identifiers found in options. This may cause unexpected behavior. Options:`,t.options)}_serialize(){return{...super._serialize(),options:this.options,placeholder:this.placeholder}}static getFieldCreationSchema(t=""){const n=t&&`${t}.`;return[{field:new pt({label:"Options",description:"List possible options for the user to select from.",required:!0,identifier:`${n}options`,minimum_length:2}),showDirectly:!0}]}}const In=I.memo(r=>{const[{inputId:e,labelId:t,size:n,severity:i,showInputOnly:a,field:o,helpText:s,label:f,fieldProps:u},c]=Le(r),{name:l,onBlur:d,onChange:h,value:v}=u,p=a?null:s,x=a?"":f,m=I.useCallback(C=>{h(!!C),d(!!C)},[d,h]),w=I.useCallback(()=>{d(v)},[d,v]);return g.jsx(Ue,{helpText:p,severity:i,children:g.jsx(ke,{size:n,severity:i,inputId:e,labelId:t,label:x,image:a?void 0:o.image,className:"items-center flex-row-reverse justify-end gap-2",children:g.jsx(E.Checkbox.Root,{id:e,name:l,checked:v??!1,onCheckedChange:m,onBlur:w,size:"sm",accentColor:"primary",variant:"surface",...c,children:g.jsx(E.Checkbox.Indicator,{children:g.jsx(E.RiIcon,{icon:"RiCheckLine"})})})})})});In.displayName="BooleanInput";const Ta={...Me,type:"boolean"},Lt=class Lt extends ve{constructor(t){super({...t,type:"boolean"});F(this,"onlyValidateAfterTouched",!1)}isBlank(t){return this.required&&!t}serialize(){return super._serialize()}static deserialize(t){if(t.type!=="boolean")throw new Error("Type mismatch.");return new Lt(t)}getInput(t){return g.jsx(In,{...t,field:this})}};F(Lt,"fieldTypeName","Checkbox"),F(Lt,"fieldTypeDescription","Perfect for both optional and required yes/no questions."),F(Lt,"Icon",me.RiCheckboxCircleLine);let Nt=Lt;const Sn=I.memo(r=>{const[{inputId:e,labelId:t,size:n,severity:i,showInputOnly:a,field:o,helpText:s,label:f,fieldProps:u},c]=Le(r),{name:l,onChange:d,onBlur:h}=u,v=a?null:s,p=a?"":f,x=u.value??cr,m=I.useCallback(w=>{const C=w.length>0?w:void 0;d(C),h(C)},[h,d]);return g.jsx(Ue,{helpText:v,severity:i,children:g.jsx(ke,{size:n,severity:i,inputId:e,labelId:t,label:p,image:a?void 0:o.image,children:g.jsx(E.CheckboxGroup.Root,{id:e,name:l,className:"flex flex-col gap-1",accentColor:"base",variant:"surface",size:"sm",values:x,onValuesChange:m,...c,children:o.options.map(w=>g.jsxs("label",{className:"flex gap-2 items-center min-w-0",children:[g.jsx(E.CheckboxGroup.Item,{value:w.value,children:g.jsx(E.CheckboxGroup.ItemIndicator,{children:g.jsx(E.RiIcon,{icon:"RiCheckLine"})})}),g.jsx(E.Text,{size:"sm",accentColor:"base",className:"truncate",children:w.label})]},w.value))})})})});Sn.displayName="CheckboxListInput";const Oa={...Me,type:"checkbox-list",options:[]},kt=class kt extends ve{constructor(t){const{options:n,...i}=t;super({...i,type:"checkbox-list"});F(this,"options");F(this,"onlyValidateAfterTouched",!1);const a=new Set;this.options=n.map(o=>(typeof o=="string"&&(o={label:o,value:o}),a.add(o.label),o)),a.size!==n.length&&console.error(`${n.length-a.size} duplicate identifiers found in options. This may cause unexpected behavior. Options:`,n)}serialize(){return{...super._serialize(),options:this.options}}static deserialize(t){if(t.type!=="checkbox-list")throw new Error("Type mismatch.");return new kt(t)}static getFieldCreationSchema(t=""){const n=t&&`${t}.`;return[{field:new pt({label:"Options",description:"List possible options for the user to select from.",required:!0,identifier:`${n}options`,minimum_length:2}),showDirectly:!0}]}getInput(t){return g.jsx(Sn,{field:this,...t})}};F(kt,"fieldTypeName","Checkbox list"),F(kt,"fieldTypeDescription","Allows the user to select a multiple options from a list."),F(kt,"Icon",me.RiCheckboxMultipleLine);let Sr=kt;const $f={...Me,type:"custom"};class br extends ve{constructor(t,n){super({...t,type:"custom"});F(this,"Component");F(this,"options");this.options=t,this.Component=n}serialize(){throw new Error("Serializing only supported for public input types.")}getInput(t){const n=this.Component;return g.jsx(n,{field:this,...t})}}F(br,"fieldTypeName","Custom"),F(br,"fieldTypeDescription","Allows re-rendering of field already in the form");const bn=I.memo(r=>{const[{inputId:e,labelId:t,size:n,severity:i,showInputOnly:a,field:o,helpText:s,label:f,fieldProps:u},c]=Le(r),{name:l,onChange:d,onBlur:h}=u,[v,p]=I.useState(!1),x=a?null:s,m=a?"":f,w=u.value?new Date(u.value):void 0,C=I.useCallback(_=>{d(_==null?void 0:_.toISOString()),p(!1)},[d]),A=I.useCallback(_=>{p(_),_||h(u.value)},[u.value,h]);return g.jsx(Ue,{helpText:x,severity:i,children:g.jsx(ke,{size:n,severity:i,inputId:e,labelId:t,label:m,image:a?void 0:o.image,children:g.jsxs(E.Popover.Root,{open:v,onOpenChange:A,children:[g.jsx(E.Popover.Trigger,{asChild:!0,children:g.jsxs(E.Button,{id:e,name:l,type:"button",className:"!justify-between",accentColor:"base",variant:"surface",size:"sm",...c,children:[w?w.toLocaleString(void 0,{year:"numeric",month:"2-digit",day:"2-digit"}):"yyyy-mm-dd",g.jsx(E.RiIcon,{icon:"RiArrowDownSLine"})]})}),g.jsx(E.Popover.Content,{align:"start",children:g.jsx(E.DayPicker,{required:!1,mode:"single",variant:"solid",selected:w,onSelect:C})})]})})})});bn.displayName="DateInput";const Na={...Me,type:"date"},Ut=class Ut extends ve{constructor(t){super({...t,type:"date"});F(this,"onlyValidateAfterTouched",!1)}serialize(){return super._serialize()}static deserialize(t){if(t.type!=="date")throw new Error("Type mismatch.");return new Ut(t)}getInput(t){return g.jsx(bn,{field:this,...t})}};F(Ut,"fieldTypeName","Date"),F(Ut,"fieldTypeDescription","Allows specifying a date."),F(Ut,"Icon",me.RiCalendarLine);let Tr=Ut;const Tn=I.memo(r=>{const[{inputId:e,labelId:t,size:n,severity:i,showInputOnly:a,field:o,helpText:s,label:f,fieldProps:u},c]=Le(r),{name:l,onChange:d,onBlur:h}=u,v=a?null:s,p=a?"":f,x=u.value??cr,m=I.useCallback(C=>{const A=C.length>0?C:void 0;d(A),h(A)},[h,d]),w=I.useCallback(C=>{C||h(x)},[x,h]);return g.jsx(Ue,{helpText:v,severity:i,children:g.jsx(ke,{size:n,severity:i,inputId:e,labelId:t,label:p,image:a?void 0:o.image,children:g.jsxs(E.Menu.Root,{onOpenChange:w,align:"start",children:[g.jsx(E.Menu.ClickTrigger,{children:g.jsxs(E.Button,{id:e,name:l,className:"!justify-between",variant:"surface",type:"button",size:"sm",accentColor:"base",...c,children:[g.jsx("span",{className:"truncate",children:x&&x.length>0?x.join(", "):o.placeholder}),g.jsx(E.RiIcon,{icon:"RiArrowDownSLine"})]})}),g.jsx(E.Menu.Content,{children:g.jsx(E.Menu.Scroll,{children:g.jsxs(E.Menu.MultiSelectGroup,{values:x,onValuesChange:m,children:[g.jsxs(E.Menu.SelectAllItem,{children:[g.jsx(E.Menu.CheckboxItemIndicator,{children:C=>C?g.jsx(E.RiIcon,{icon:"RiSubtractLine"}):g.jsx(E.RiIcon,{icon:"RiCheckLine"})}),"Select all"]}),o.options.map(C=>g.jsxs(E.Menu.MultiSelectItem,{value:C.value,children:[g.jsx(E.Menu.SelectedIndicator,{children:g.jsx(E.RiIcon,{icon:"RiCheckLine"})}),C.label]},C.value))]})})})]})})})});Tn.displayName="MultiSelectInput";const Da={...Me,type:"multi-select",options:[]},Vt=class Vt extends En{constructor(e){const{placeholder:t="Select one or more...",...n}=e;super({...n,placeholder:t,type:"multi-select"})}isBlank(e){return super.isBlank(e)||(e==null?void 0:e.length)===0}isEqual(e,t){return e===void 0&&t===void 0?!0:e===void 0||t===void 0?!1:e.every(n=>t.includes(n))&&t.every(n=>e.includes(n))}serialize(){return super._serialize()}static deserialize(e){if(e.type!=="multi-select")throw new Error("Type mismatch.");return new Vt(e)}getInput(e){return g.jsx(Tn,{field:this,...e})}};F(Vt,"fieldTypeName","Multi-select"),F(Vt,"fieldTypeDescription","Allows the user to select a multiple options from a list of options."),F(Vt,"Icon",me.RiCheckboxLine);let Kt=Vt;const On=I.memo(r=>{const[{inputId:e,labelId:t,size:n,severity:i,showInputOnly:a,field:o,helpText:s,label:f,fieldProps:u,touched:c,helpers:l},d]=Le(r),{name:h,onBlur:v,onChange:p,value:x}=u,m=a?null:s,w=a?"":f,[C,A]=I.useState(void 0);I.useEffect(()=>{A(x)},[x]);const _=I.useCallback(T=>{const D=T.target.valueAsNumber,M=Number.isNaN(D)?void 0:D;A(M),(c||!o.onlyValidateAfterTouched)&&l.setError(o.getError(M))},[o,l,c]),b=I.useCallback(()=>{p(C),v(C)},[C,v,p]);return g.jsx(Ue,{helpText:m,severity:i,children:g.jsx(ke,{size:n,severity:i,inputId:e,labelId:t,label:w,image:a?void 0:o.image,children:g.jsx(E.Input.Root,{accentColor:"base",variant:"surface",size:"sm",children:g.jsx(E.Input.Field,{id:e,name:h,onChange:_,onBlur:b,value:C??"",type:"number",min:o.minimum,max:o.maximum,step:o.integers?1:.1,placeholder:o.placeholder,...d})})})})});On.displayName="NumberInput";const Pa={...Me,type:"number",minimum:Number.MIN_SAFE_INTEGER,maximum:Number.MAX_SAFE_INTEGER,integers:!1},Ma=r=>"fields"in r,Je=class Je extends ve{constructor(t){const{minimum:n=Number.MIN_SAFE_INTEGER,maximum:i=Number.MAX_SAFE_INTEGER,integers:a=!1,placeholder:o="Enter a number",...s}=t;super({...s,type:"number"});F(this,"minimum");F(this,"maximum");F(this,"integers");F(this,"placeholder");this.minimum=n,this.maximum=i,this.integers=a,this.placeholder=o}static getFieldCreationSchema(t=""){const n=t&&`${t}.`;return[{field:new Je({label:"Minimum",description:"Minimum value",integers:!0,required:!1,identifier:`${n}minimum`,formValidators:[this._validateMin(t)]}),showDirectly:!1},{field:new Je({label:"Maximum",description:"Maximum value",integers:!0,required:!1,identifier:`${n}maximum`,formValidators:[this._validateMax(t)]}),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}}static deserialize(t){if(t.type!=="number")throw new Error("Type mismatch.");return new Je(t)}getInput(t){return g.jsx(On,{field:this,...t})}};F(Je,"fieldTypeName","Number"),F(Je,"fieldTypeDescription","Allows specifying a number within a given range."),F(Je,"Icon",me.RiHashtag),F(Je,"_validateMin",t=>(n,i)=>{const a=Ma(i)?Ze(i,t):i;return typeof a.maximum=="number"&&typeof n=="number"&&a.maximum<n?"Minimum cannot be greater than minimum.":null}),F(Je,"_validateMax",t=>(n,i)=>{const a=Ma(i)?Ze(i,t):i;return typeof a.minimum=="number"&&typeof n=="number"&&a.minimum>n?"Maximum cannot be less than minimum.":null});let at=Je;const Nn=I.memo(r=>{const[{inputId:e,labelId:t,size:n,severity:i,showInputOnly:a,field:o,helpText:s,label:f,fieldProps:u},c]=Le(r),{name:l,onChange:d,onBlur:h,value:v}=u,p=a?null:s,x=a?"":f,m=I.useCallback(C=>{d(C??void 0),h(C??void 0)},[h,d]),w=I.useCallback(()=>{d(void 0),h(void 0)},[h,d]);return g.jsx(Ue,{helpText:p,severity:i,children:g.jsx(ke,{size:n,severity:i,inputId:e,labelId:t,label:x,image:a?void 0:o.image,children:g.jsxs(E.RadioGroup.Root,{id:e,name:l,className:"flex flex-col gap-1",accentColor:"base",variant:"surface",size:"sm",value:v??"",onValueChange:m,...c,children:[o.options.map(C=>g.jsxs("label",{className:"flex gap-2 items-center min-w-0",children:[g.jsx(E.RadioGroup.Item,{value:C.value,children:g.jsx(E.RadioGroup.Indicator,{children:g.jsx(E.RiIcon,{icon:"RiCircleFill"})})}),g.jsx(E.Text,{size:"sm",accentColor:"base",className:"truncate",children:C.label})]},C.value)),!!v&&g.jsxs(E.Button,{onClick:w,className:"w-max -mx-2",type:"button",variant:"ghost",accentColor:"base",size:"sm",children:[g.jsx(E.RiIcon,{icon:"RiCloseLine"})," Clear"]})]})})})});Nn.displayName="SelectInput";const Fa={...Me,type:"radio",options:[]},Ht=class Ht extends ve{constructor(t){const{options:n,...i}=t;super({...i,type:"radio"});F(this,"options");F(this,"onlyValidateAfterTouched",!1);const a=new Set;this.options=n.map(o=>(typeof o=="string"&&(o={label:o,value:o}),a.add(o.label),o)),a.size!==n.length&&console.error(`${n.length-a.size} duplicate identifiers found in options. This may cause unexpected behavior. Options:`,n)}serialize(){return{...super._serialize(),options:this.options}}static deserialize(t){if(t.type!=="radio")throw new Error("Type mismatch.");return new Ht(t)}static getFieldCreationSchema(t=""){const n=t&&`${t}.`;return[{field:new pt({label:"Options",description:"List possible options for the user to select from.",required:!0,identifier:`${n}options`,minimum_length:2}),showDirectly:!0}]}getInput(t){return g.jsx(Nn,{field:this,...t})}};F(Ht,"fieldTypeName","Option list"),F(Ht,"fieldTypeDescription","Allows the user to select a single option from a list of options."),F(Ht,"Icon",me.RiRadioButtonFill);let Or=Ht;function jf(r,e){var t=Object.setPrototypeOf;t?t(r,e):r.__proto__=e}function Yf(r,e){e===void 0&&(e=r.constructor);var t=Error.captureStackTrace;t&&t(r,e)}var Zf=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)}}(),Kf=function(r){Zf(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}),jf(a,i.prototype),Yf(a),a}return e}(Error),qf=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)}}(),Fe=function(r){qf(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}(Kf),Qf=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)}}(),Xe=function(r){Qf(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.kind="ArgumentException",e}(Fe),Jf=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)}}(),V=function(r){Jf(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.kind="IllegalArgumentException",e}(Fe),eu=function(){function r(e){if(this.binarizer=e,e===null)throw new V("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}(),tu=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)}}(),pe=function(r){tu(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.getChecksumInstance=function(){return new e},e.kind="ChecksumException",e}(Fe),ru=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}(),re=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}(),nu=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)}}(),Dn=function(r){nu(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.kind="IndexOutOfBoundsException",e}(Fe),iu=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)}}(),Ra=function(r){iu(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}(Dn),au=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.")},fe=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 V("fromIndex("+t+") > toIndex("+n+")");if(t<0)throw new Ra(t);if(n>e)throw new Ra(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=au(e),o=a.next();!o.done;o=a.next()){var s=o.value;i=31*i+s}}catch(f){t={error:f}}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 re.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}(),G=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}(),ge=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);re.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+G.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+G.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 V;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,f=o<i?31:t&31,u=(2<<f)-(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 V;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 f=s>i?0:e&31,u=s<a?31:t&31,c=(2<<u)-(1<<f)&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 V("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 V("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,f=e[0]>>>s,a=1;a<n;a++){var u=e[a];f|=u<<32-s,e[a-1]=f,f=u>>>s}e[n-1]=f}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&&fe.equals(this.bits,t.bits)},r.prototype.hashCode=function(){return 31*this.size+fe.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}(),Pn;(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"})(Pn||(Pn={}));const oe=Pn;var ou=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){ou(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.getFormatInstance=function(){return new e},e.kind="FormatException",e}(Fe),su=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.")},J;(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"})(J||(J={}));var ue=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 f=this.values,u=0,c=f.length;u!==c;u++){var l=f[u];r.VALUES_TO_ECI.set(l,this)}try{for(var d=su(o),h=d.next();!h.done;h=d.next()){var v=h.value;r.NAME_TO_ECI.set(v,this)}}catch(p){i={error:p}}finally{try{h&&!h.done&&(a=d.return)&&a.call(d)}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 R("incorect value");var t=r.VALUES_TO_ECI.get(e);if(t===void 0)throw new R("incorect value");return t},r.getCharacterSetECIByName=function(e){var t=r.NAME_TO_ECI.get(e);if(t===void 0)throw new R("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(J.Cp437,Int32Array.from([0,2]),"Cp437"),r.ISO8859_1=new r(J.ISO8859_1,Int32Array.from([1,3]),"ISO-8859-1","ISO88591","ISO8859_1"),r.ISO8859_2=new r(J.ISO8859_2,4,"ISO-8859-2","ISO88592","ISO8859_2"),r.ISO8859_3=new r(J.ISO8859_3,5,"ISO-8859-3","ISO88593","ISO8859_3"),r.ISO8859_4=new r(J.ISO8859_4,6,"ISO-8859-4","ISO88594","ISO8859_4"),r.ISO8859_5=new r(J.ISO8859_5,7,"ISO-8859-5","ISO88595","ISO8859_5"),r.ISO8859_6=new r(J.ISO8859_6,8,"ISO-8859-6","ISO88596","ISO8859_6"),r.ISO8859_7=new r(J.ISO8859_7,9,"ISO-8859-7","ISO88597","ISO8859_7"),r.ISO8859_8=new r(J.ISO8859_8,10,"ISO-8859-8","ISO88598","ISO8859_8"),r.ISO8859_9=new r(J.ISO8859_9,11,"ISO-8859-9","ISO88599","ISO8859_9"),r.ISO8859_10=new r(J.ISO8859_10,12,"ISO-8859-10","ISO885910","ISO8859_10"),r.ISO8859_11=new r(J.ISO8859_11,13,"ISO-8859-11","ISO885911","ISO8859_11"),r.ISO8859_13=new r(J.ISO8859_13,15,"ISO-8859-13","ISO885913","ISO8859_13"),r.ISO8859_14=new r(J.ISO8859_14,16,"ISO-8859-14","ISO885914","ISO8859_14"),r.ISO8859_15=new r(J.ISO8859_15,17,"ISO-8859-15","ISO885915","ISO8859_15"),r.ISO8859_16=new r(J.ISO8859_16,18,"ISO-8859-16","ISO885916","ISO8859_16"),r.SJIS=new r(J.SJIS,20,"SJIS","Shift_JIS"),r.Cp1250=new r(J.Cp1250,21,"Cp1250","windows-1250"),r.Cp1251=new r(J.Cp1251,22,"Cp1251","windows-1251"),r.Cp1252=new r(J.Cp1252,23,"Cp1252","windows-1252"),r.Cp1256=new r(J.Cp1256,24,"Cp1256","windows-1256"),r.UnicodeBigUnmarked=new r(J.UnicodeBigUnmarked,25,"UnicodeBigUnmarked","UTF-16BE","UnicodeBig"),r.UTF8=new r(J.UTF8,26,"UTF8","UTF-8"),r.ASCII=new r(J.ASCII,Int32Array.from([27,170]),"ASCII","US-ASCII"),r.Big5=new r(J.Big5,28,"Big5"),r.GB18030=new r(J.GB18030,29,"GB18030","GB2312","EUC_CN","GBK"),r.EUC_KR=new r(J.EUC_KR,30,"EUC_KR","EUC-KR"),r}(),fu=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)}}(),Nr=function(r){fu(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.kind="UnsupportedOperationException",e}(Fe),Ve=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 ue?e:ue.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(ue.UnicodeBigUnmarked))return String.fromCharCode.apply(null,new Uint16Array(e.buffer));throw new Nr("Encoding "+this.encodingName(t)+" not supported by fallback.")},r.isDecodeFallbackSupported=function(e){return e.equals(ue.UTF8)||e.equals(ue.ISO8859_1)||e.equals(ue.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}(),$=function(){function r(){}return r.castAsNonUtf8Char=function(e,t){t===void 0&&(t=null);var n=t?t.getName():this.ISO88591;return Ve.decode(new Uint8Array([e]),n)},r.guessEncoding=function(e,t){if(t!=null&&t.get(oe.CHARACTER_SET)!==void 0)return t.get(oe.CHARACTER_SET).toString();for(var n=e.length,i=!0,a=!0,o=!0,s=0,f=0,u=0,c=0,l=0,d=0,h=0,v=0,p=0,x=0,m=0,w=e.length>3&&e[0]===239&&e[1]===187&&e[2]===191,C=0;C<n&&(i||a||o);C++){var A=e[C]&255;o&&(s>0?(A&128)===0?o=!1:s--:(A&128)!==0&&((A&64)===0?o=!1:(s++,(A&32)===0?f++:(s++,(A&16)===0?u++:(s++,(A&8)===0?c++:o=!1))))),i&&(A>127&&A<160?i=!1:A>159&&(A<192||A===215||A===247)&&m++),a&&(l>0?A<64||A===127||A>252?a=!1:l--:A===128||A===160||A>239?a=!1:A>160&&A<224?(d++,v=0,h++,h>p&&(p=h)):A>127?(l++,h=0,v++,v>x&&(x=v)):(h=0,v=0))}return o&&s>0&&(o=!1),a&&l>0&&(a=!1),o&&(w||f+u+c>0)?r.UTF8:a&&(r.ASSUME_SHIFT_JIS||p>=3||x>=3)?r.SHIFT_JIS:i&&a?p===2&&d===2||m*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,f,u,c,l,d){if(s==="%%")return"%";if(t[++i]!==void 0){s=c?parseInt(c.substr(1)):void 0;var h=l?parseInt(l.substr(1)):void 0,v;switch(d){case"s":v=t[i];break;case"c":v=t[i][0];break;case"f":v=parseFloat(t[i]).toFixed(s);break;case"p":v=parseFloat(t[i]).toPrecision(s);break;case"e":v=parseFloat(t[i]).toExponential(s);break;case"x":v=parseInt(t[i]).toString(h||16);break;case"d":v=parseFloat(parseInt(t[i],h||10).toPrecision(s)).toFixed(0);break}v=typeof v=="object"?JSON.stringify(v):(+v).toString(h);for(var p=parseInt(u),x=u&&u[0]+""=="0"?"0":" ";v.length<p;)v=f!==void 0?v+x:x+v;return v}}var o=/%(-)?(0?[0-9]+)?([.][0-9]+)?([#][0-9]+)?([scfpexd%])/g;return e.replace(o,a)},r.getBytes=function(e,t){return Ve.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=ue.SJIS.getName(),r.GB2312="GB2312",r.ISO88591=ue.ISO8859_1.getName(),r.EUC_JP="EUC_JP",r.UTF8=ue.UTF8.getName(),r.PLATFORM_DEFAULT_ENCODING=r.UTF8,r.ASSUME_SHIFT_JIS=!1,r}(),z=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+=$.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}(),qe=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 V("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 V("stringRepresentation cannot be null");for(var i=new Array(e.length),a=0,o=0,s=-1,f=0,u=0;u<e.length;)if(e.charAt(u)===`
|
|
46
|
-
`||e.charAt(u)==="\r"){if(a
|
|
47
|
-
`),this.buildToString(e,t,n)},r.prototype.buildToString=function(e,t,n){for(var i=new
|
|
48
|
-
`)}return t.toString()},r}(),vu=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)}}(),Mn=function(r){vu(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}(Dr),pu=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)}}(),gu=function(r){pu(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,f=t.length;o<f;o+=4,s++){var u=void 0,c=t[o+3];if(c===0)u=255;else{var l=t[o],d=t[o+1],h=t[o+2];u=306*l+601*d+117*h+512>>10}a[s]=u}else for(var o=0,s=0,v=t.length;o<v;o+=4,s++){var u=void 0,c=t[o+3];if(c===0)u=255;else{var l=t[o],d=t[o+1],h=t[o+2];u=306*l+601*d+117*h+512>>10}a[s]=255-u}return a},e.prototype.getRow=function(t,n){if(t<0||t>=this.getHeight())throw new V("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,f=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=f,n.height=u,i.translate(f/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 Mn(this)},e.DEGREE_TO_RADIANS=Math.PI/180,e.FRAME_INDEX=!0,e}(Dr),xu=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}(),Oe=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(l){o(l)}}function f(c){try{u(n.throw(c))}catch(l){o(l)}}function u(c){c.done?a(c.value):i(c.value).then(s,f)}u((n=n.apply(r,e||[])).next())})},Ne=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 f([u,c])}}function f(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}}},yu=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.")},Dt=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 Oe(this,void 0,void 0,function(){var e,t,n,i,a,o,s,f,u,c,l,d;return Ne(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=yu(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,f=a.label||"Video device "+(t.length+1),u=a.groupId,c={deviceId:s,label:f,kind:o,groupId:u},t.push(c))}catch(v){l={error:v}}finally{try{i&&!i.done&&(d=n.return)&&d.call(n)}finally{if(l)throw l.error}}return[2,t]}})})},r.prototype.getVideoInputDevices=function(){return Oe(this,void 0,void 0,function(){var e;return Ne(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 xu(n.deviceId,n.label)})]}})})},r.prototype.findDeviceById=function(e){return Oe(this,void 0,void 0,function(){var t;return Ne(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 Oe(this,void 0,void 0,function(){return Ne(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 Oe(this,void 0,void 0,function(){var n,i;return Ne(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 Oe(this,void 0,void 0,function(){var n;return Ne(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 Oe(this,void 0,void 0,function(){var n,i;return Ne(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 Oe(this,void 0,void 0,function(){return Ne(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 Oe(this,void 0,void 0,function(){var i,a;return Ne(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 Oe(this,void 0,void 0,function(){var i;return Ne(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 Oe(this,void 0,void 0,function(){var i;return Ne(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 Oe(this,void 0,void 0,function(){var n;return Ne(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 Oe(this,void 0,void 0,function(){return Ne(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 Xe("element with id '"+e+"' not found");if(n.nodeName.toLowerCase()!==t.toLowerCase())throw new Xe("element with id '"+e+"' must be an "+t+" element");return n},r.prototype.decodeFromImage=function(e,t){if(!e&&!t)throw new Xe("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 Xe("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 Xe("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 Xe("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 Xe("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 Xe("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 Xe("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 Xe("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 Oe(this,void 0,void 0,function(){return Ne(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 Oe(this,void 0,void 0,function(){return Ne(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 N("Video stream has ended before any code could be detected.")),i._stopAsyncDecode=void 0;return}try{var f=i.decode(e);o(f)}catch(d){var u=t&&d instanceof N,c=d instanceof pe||d instanceof R,l=c&&n;if(u||l)return setTimeout(a,i._timeBetweenDecodingAttempts,o,s);s(d)}};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(f){t(null,f);var o=f instanceof pe||f instanceof R,s=f instanceof N;(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 gu(t),i=new hu(n);return new eu(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}(),Se=function(){function r(e,t,n,i,a,o){n===void 0&&(n=t==null?0:8*t.length),o===void 0&&(o=re.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=re.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);re.arraycopy(t,0,n,0,t.length),re.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}(),Fn;(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"})(Fn||(Fn={}));const L=Fn;var Rn;(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"})(Rn||(Rn={}));const Ce=Rn;var Pr=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}(),qt=function(){function r(){}return r.prototype.exp=function(e){return this.expTable[e]},r.prototype.log=function(e){if(e===0)throw new V;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 V;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),re.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=qt.addOrSubtract(n,o)}return n}n=t[0];for(var s=t.length,f=this.field,i=1;i<s;i++)n=qt.addOrSubtract(f.multiply(e,n),t[i]);return n},r.prototype.addOrSubtract=function(e){if(!this.field.equals(e.field))throw new V("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;re.arraycopy(n,0,a,0,o);for(var s=o;s<n.length;s++)a[s]=qt.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 V("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,f=0;f<n;f++)for(var u=t[f],c=0;c<a;c++)o[f+c]=qt.addOrSubtract(o[f+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 V;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 V("GenericGFPolys do not have same GenericGF field");if(e.isZero())throw new V("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(),f=t.multiply(i.getCoefficient(i.getDegree()),o),u=e.multiplyByMonomial(s,f),c=t.buildMonomial(s,f);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}(),wu=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)}}(),Ba=function(r){wu(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.kind="ArithmeticException",e}(Fe),mu=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)}}(),Re=function(r){mu(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,f=0;f<n;f++)o[f]=s,s*=2,s>=n&&(s^=t,s&=n-1);a.expTable=o;for(var u=new Int32Array(n),f=0;f<n-1;f++)u[o[f]]=f;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 V;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 Ba;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"+G.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}(qt),Cu=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)}}(),Mr=function(r){Cu(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.kind="ReedSolomonException",e}(Fe),Au=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)}}(),Qt=function(r){Au(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.kind="IllegalStateException",e}(Fe),Fr=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 f=i.evaluateAt(n.exp(s+n.getGeneratorBase()));a[a.length-1-s]=f,f!==0&&(o=!1)}if(!o)for(var u=new ot(n,a),c=this.runEuclideanAlgorithm(n.buildMonomial(t,1),u,t),l=c[0],d=c[1],h=this.findErrorLocations(l),v=this.findErrorMagnitudes(d,h),s=0;s<h.length;s++){var p=e.length-1-n.log(h[s]);if(p<0)throw new Mr("Bad error location");e[p]=Re.addOrSubtract(e[p],v[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,f=a.getZero(),u=a.getOne();s.getDegree()>=(n/2|0);){var c=o,l=f;if(o=s,f=u,o.isZero())throw new Mr("r_{i-1} was zero");s=c;for(var d=a.getZero(),h=o.getCoefficient(o.getDegree()),v=a.inverse(h);s.getDegree()>=o.getDegree()&&!s.isZero();){var p=s.getDegree()-o.getDegree(),x=a.multiply(s.getCoefficient(s.getDegree()),v);d=d.addOrSubtract(a.buildMonomial(p,x)),s=s.addOrSubtract(o.multiplyByMonomial(p,x))}if(u=d.multiply(f).addOrSubtract(l),s.getDegree()>=o.getDegree())throw new Qt("Division algorithm failed to reduce polynomial?")}var m=u.getCoefficient(0);if(m===0)throw new Mr("sigmaTilde(0) was zero");var w=a.inverse(m),C=u.multiplyScalar(w),A=s.multiplyScalar(w);return[C,A]},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 Mr("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]),f=1,u=0;u<n;u++)if(o!==u){var c=a.multiply(t[u],s),l=(c&1)===0?c|1:c&-2;f=a.multiply(f,l)}i[o]=a.multiply(e.evaluateAt(s),a.inverse(f)),a.getGeneratorBase()!==0&&(i[o]=a.multiply(i[o],s))}return i},r}(),Ae;(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"})(Ae||(Ae={}));var La=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 Pr(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=Ae.UPPER,i=Ae.UPPER,a="",o=0;o<t;)if(i===Ae.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 f=0;f<s;f++){if(t-o<8){o=t;break}var u=r.readCode(e,o,8);a+=$.castAsNonUtf8Char(u),o+=8}i=n}else{var c=i===Ae.DIGIT?4:5;if(t-o<c)break;var u=r.readCode(e,o,c);o+=c;var l=r.getCharacter(i,u);l.startsWith("CTRL_")?(n=i,i=r.getTable(l.charAt(5)),l.charAt(6)==="L"&&(n=i)):(a+=l,i=n)}return a},r.getTable=function(e){switch(e){case"L":return Ae.LOWER;case"P":return Ae.PUNCT;case"M":return Ae.MIXED;case"D":return Ae.DIGIT;case"B":return Ae.BINARY;case"U":default:return Ae.UPPER}},r.getCharacter=function(e,t){switch(e){case Ae.UPPER:return r.UPPER_TABLE[t];case Ae.LOWER:return r.LOWER_TABLE[t];case Ae.MIXED:return r.MIXED_TABLE[t];case Ae.PUNCT:return r.PUNCT_TABLE[t];case Ae.DIGIT:return r.DIGIT_TABLE[t];default:throw new Qt("Bad table")}},r.prototype.correctBits=function(e){var t,n;this.ddata.getNbLayers()<=2?(n=6,t=Re.AZTEC_DATA_6):this.ddata.getNbLayers()<=8?(n=8,t=Re.AZTEC_DATA_8):this.ddata.getNbLayers()<=22?(n=10,t=Re.AZTEC_DATA_10):(n=12,t=Re.AZTEC_DATA_12);var i=this.ddata.getNbDatablocks(),a=e.length/n;if(a<i)throw new R;for(var o=e.length%n,s=new Int32Array(a),f=0;f<a;f++,o+=n)s[f]=r.readCode(e,o,n);try{var u=new Fr(t);u.decode(s,a-i)}catch(x){throw new R(x)}for(var c=(1<<n)-1,l=0,f=0;f<i;f++){var d=s[f];if(d===0||d===c)throw new R;(d===1||d===c-1)&&l++}for(var h=new Array(i*n-l),v=0,f=0;f<i;f++){var d=s[f];if(d===1||d===c-1)h.fill(d>1,v,v+n-1),v+=n-1;else for(var p=n-1;p>=0;--p)h[v++]=(d&1<<p)!==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 f=i+1+2*G.truncDivision(G.truncDivision(i,2)-1,15),u=i/2,c=G.truncDivision(f,2),s=0;s<u;s++){var l=s+G.truncDivision(s,15);a[u-s-1]=c-l-1,a[u+s]=c+l+1}for(var s=0,d=0;s<n;s++){for(var h=(n-s)*4+(t?9:12),v=s*2,p=i-1-v,x=0;x<h;x++)for(var m=x*2,w=0;w<2;w++)o[d+m+w]=e.get(a[v+w],a[v+x]),o[d+2*h+m+w]=e.get(a[v+x],a[p-w]),o[d+4*h+m+w]=e.get(a[p-w],a[p-x]),o[d+6*h+m+w]=e.get(a[p-x],a[v+w]);d+=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"," ",`
|
|
45
|
+
For more information, see https://radix-ui.com/primitives/docs/components/${e.docsSlug}`;return N.useEffect(()=>{r&&(document.getElementById(r)||console.error(t))},[t,r]),null},Fu="DialogDescriptionWarning",Bu=({contentRef:r,descriptionId:e})=>{const n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${jo(Fu).contentName}}.`;return N.useEffect(()=>{var o;const i=(o=r.current)==null?void 0:o.getAttribute("aria-describedby");e&&i&&(document.getElementById(e)||console.warn(n))},[n,r,e]),null},qo=Bo,Lu=Ro,Yo=ko,Zo=zo,Ko=Uo,Qo=Xo;const Un=A.memo(r=>{const{file:e,onClose:t}=r,n=A.useRef(null),i=A.useCallback(()=>{var s;if(!n.current)return;const a=document.createElement("canvas");a.width=n.current.width,a.height=n.current.height,(s=a.getContext("2d"))==null||s.drawImage(n.current,0,0,n.current.width,n.current.height),a.toBlob(l=>{l&&navigator.clipboard.write([new ClipboardItem({"image/png":l})])},"image/png")},[]),o=A.useCallback(()=>{Wi.saveAs(e,e.name)},[e]);return d.jsx(qo,{open:!0,onOpenChange:t,children:d.jsx(Yo,{children:d.jsx(Zo,{className:"bg-(--color-background) fixed inset-0 data-[state='open']:fade-in-0 data-[state='open']:zoom-in-95 data-[state='closed']:animate-out data-[state='closed']:fade-out-0 data-[state='closed']:zoom-out-95 data-[state='open']:animate-in","data-floating-content":"",children:d.jsxs(Ko,{className:"absolute inset-0 py-12","data-floating-content":"",onOpenAutoFocus:a=>a.preventDefault(),children:[d.jsxs(x.ButtonGroup,{className:"flex gap-2 items-center top-0 absolute right-0 p-2",accentColor:"base",variant:"ghost",children:[d.jsxs(x.Tooltip.Root,{children:[d.jsx(x.Tooltip.Trigger,{asChild:!0,children:d.jsx(x.IconButton,{onClick:i,"aria-label":"copy to clipboard",children:d.jsx(x.RiIcon,{icon:"RiFileCopyLine"})})}),d.jsx(x.Tooltip.Content,{size:"sm",children:"Copy"})]}),d.jsxs(x.Tooltip.Root,{children:[d.jsx(x.Tooltip.Trigger,{asChild:!0,children:d.jsx(x.IconButton,{onClick:o,"aria-label":"download",children:d.jsx(x.RiIcon,{icon:"RiDownload2Line"})})}),d.jsx(x.Tooltip.Content,{size:"sm",children:"Download"})]}),d.jsx(x.Separator,{orientation:"vertical",size:"sm"}),d.jsx(Qo,{asChild:!0,children:d.jsx(x.IconButton,{onClick:t,"aria-label":"close",children:d.jsx(x.RiIcon,{icon:"RiCloseLine"})})})]}),d.jsx("figure",{className:"size-full overflow-hidden p-4 flex justify-center items-center",children:d.jsx("img",{ref:n,className:"max-w-full max-h-full",src:URL.createObjectURL(e),alt:e.name})})]})})})})});Un.displayName="ImageViewer";const Jo=A.memo(r=>{const{children:e}=r,[t,n]=A.useState(null),i=A.useCallback(()=>{n(null)},[]),o=A.useCallback(l=>{n(l(i))},[i]),a=A.useCallback(()=>{t&&(t.onClose&&t.onClose(),i())},[i,t]),s=A.useMemo(()=>o,[o]);return d.jsxs(ro.Provider,{value:s,children:[e,t&&d.jsx(Un,{file:t.file,onClose:a})]})});Jo.displayName="FileViewerProvider";const We=r=>{const{className:e,label:t,children:n,severity:i,inputId:o,labelId:a,image:s}=r,[l,u]=A.useState(void 0),c=Nr(),f=i?er[i]:"base";A.useEffect(()=>{s instanceof Promise?s.then(u).catch(console.error):u(s)},[s]);const h=l?URL.createObjectURL(l):void 0,v=A.useCallback(()=>{l&&c(()=>({file:l}))},[c,l]);return d.jsxs("div",{className:"flex flex-col gap-1",children:[l&&d.jsx("img",{className:"h-[100px] w-full min-w-[300px] cursor-pointer rounded-md object-cover",src:h,alt:l.name,onClick:v}),!!t&&d.jsx("label",{className:yt.cx(e,"w-max max-w-full"),htmlFor:o,children:d.jsx(x.Text,{accentColor:f,size:"sm",id:a,className:"text-wrap",children:t})}),n]})},Xe=r=>{const{children:e,...t}=r;return d.jsx(bn,{...t,children:e})},Hn=A.memo(r=>{const[{inputId:e,labelId:t,size:n,severity:i,showInputOnly:o,field:a,helpText:s,label:l,fieldProps:u},c]=He(r),f=o?null:s,h=o?"":l,{name:v,onChange:p,onBlur:g}=u,m=`${e}-droppable`,{disabled:y}=c,C=u.value??Sr,[w,E]=A.useState(""),[I,S]=A.useState(""),b=I||f,P=A.useCallback(R=>{p(R),g(R)},[p,g]),L=A.useCallback(R=>{C&&C.findIndex(G=>G===R.target.value.trim())>=0?S("All options must be unique"):R.target.value?S(""):S("Option cannot be empty"),E(R.target.value)},[E,C]),M=A.useCallback(()=>{if(I)return;if(!w.trim()){S("Option cannot be empty");return}const R=w.trim();P([...C,R]),E("")},[w,I,P,C]),F=A.useCallback(R=>{R.key==="Enter"&&(R.preventDefault(),M())},[M]),V=A.useCallback(R=>{P(Mt(C,R))},[C,P]),z=A.useCallback(R=>{if(!R.destination)return;const G=R.source.index,W=R.destination.index;P(br(C,G,W))},[P,C]),U=A.useCallback(()=>{g(C)},[g,C]);return d.jsx(Ct.DragDropContext,{onDragEnd:z,children:d.jsxs("div",{className:"flex flex-col gap-2",children:[d.jsx(Xe,{helpText:b,severity:i,children:d.jsx(We,{size:n,severity:i,inputId:e,labelId:t,label:h,image:o?void 0:a.image,children:(!y||C.length===0)&&d.jsxs("div",{className:"flex gap-2",children:[d.jsx(x.Input.Root,{className:"grow",accentColor:"base",variant:"surface",size:"sm",children:d.jsx(x.Input.Field,{value:w,onChange:L,onKeyDown:F,id:e,placeholder:a.placeholder,onBlur:U,name:v,...c})}),d.jsx(x.IconButton,{size:"sm",accentColor:"base",variant:"soft",type:"button","aria-label":"Add option",disabled:!!I||y,onClick:M,children:d.jsx(x.RiIcon,{icon:"RiAddLine"})})]})})}),C.length!==0&&d.jsx(Ct.Droppable,{droppableId:m,children:R=>d.jsxs("div",{className:"flex flex-col gap-1",...R.droppableProps,ref:R.innerRef,children:[C.map((G,W)=>d.jsx(Ct.Draggable,{draggableId:`${G}-draggable`,index:W,isDragDisabled:y,children:({draggableProps:oe,dragHandleProps:Le,innerRef:ot})=>d.jsxs(x.Badge,{...Le,...oe,ref:ot,className:"flex items-center justify-between gap-2",accentColor:"base",size:"sm",variant:"soft",children:[d.jsx("span",{className:"truncate",children:typeof G=="object"&&"label"in G?G.label:G}),d.jsx(x.IconButton,{size:"xs",variant:"ghost",type:"button","aria-label":"Delete option",accentColor:"base",disabled:y,onClick:()=>{V(W)},children:d.jsx(x.RiIcon,{icon:"RiCloseLargeLine"})})]})},G)),R.placeholder]})})]})})});Hn.displayName="MultiStringInput";const ea={...Ue,type:"multi-string",minimum_length:0,maximum_length:null},Gt=class Gt extends Ee{constructor(t){const{minimum_length:n,maximum_length:i,placeholder:o,...a}=t;super({...a,type:"multi-string"});O(this,"minLength");O(this,"maxLength");O(this,"onlyValidateAfterTouched",!1);O(this,"placeholder");O(this,"defaultConditionValue");O(this,"defaultConditionModifier","equals");O(this,"modifiers",{equals:j({modifier:En,isValueValid:t=>!0,isConditionValueValid:t=>!0}),notEquals:j({modifier:In,isValueValid:t=>!0,isConditionValueValid:t=>!0}),every:j({modifier:wn,isValueValid:t=>!0,isConditionValueValid:t=>!0}),some:j({modifier:_n,isValueValid:t=>!0,isConditionValueValid:t=>!0}),none:j({modifier:An,isValueValid:t=>!0,isConditionValueValid:t=>!0})});this.minLength=n??0,this.maxLength=i??1/0,this.placeholder=o??"Press enter to add a new option"}getInput(t){return d.jsx(Hn,{field:this,...t})}serialize(){return{...super._serialize(),minimum_length:this.minLength,maximum_length:this.maxLength,placeholder:this.placeholder}}isBlank(t){return super.isBlank(t)||(t==null?void 0:t.length)===0}isEqual(t,n){return t===void 0&&n===void 0?!0:t===void 0||n===void 0?!1:t.every(i=>n.includes(i))&&n.every(i=>t.includes(i))}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){if(t.type!=="multi-string")throw new Error("Type mismatch.");return new Gt(t)}renderCondition(t){return d.jsx(Us,{...t})}};O(Gt,"fieldTypeName","Multi-string"),O(Gt,"fieldTypeDescription","Allows the user to provide multiple unique strings."),O(Gt,"Icon",Ae.RiListCheck);let _t=Gt;class Gn extends Ee{constructor(t){const{placeholder:n="",...i}=t;super(i);O(this,"options");O(this,"onlyValidateAfterTouched",!1);O(this,"placeholder");this.placeholder=n;const o=new Set;this.options=t.options.map(a=>(typeof a=="string"&&(a={label:a,value:a}),o.add(a.label),a)),o.size!==t.options.length&&console.error(`${t.options.length-o.size} duplicate identifiers found in options. This may cause unexpected behavior. Options:`,t.options)}_serialize(){return{...super._serialize(),options:this.options,placeholder:this.placeholder}}static getFieldCreationSchema(t=""){const n=t&&`${t}.`;return[{field:new _t({label:"Options",description:"List possible options for the user to select from.",required:!0,identifier:`${n}options`,minimum_length:2}),showDirectly:!0}]}}const Ru=r=>{const{field:e,condition:t,conditionManager:n}=r,i=t.getConditionValue(),o=t.getConditionModifier(),a=()=>{switch(i){case void 0:return"...";case!0:return"true";case!1:return"false";case null:return"empty"}};return d.jsxs(x.ButtonGroup,{className:"flex w-max max-w-full min-w-0 gap-0.5",size:"sm",variant:"fill",accentColor:"base",children:[d.jsxs(x.Badge,{className:"min-w-0 shrink-1",size:"sm",variant:"fill",accentColor:"base",children:[d.jsx(x.RiIcon,{icon:ze[e.type]}),d.jsx("span",{className:"truncate",children:e.label})]}),d.jsx($e,{field:e,condition:t,children:d.jsx(x.Button,{type:"button",children:e.getConditionModifier(o).modifier.render(i)})}),d.jsxs(x.Menu.Root,{children:[d.jsx(x.Menu.ClickTrigger,{children:d.jsx(x.Button,{type:"button",className:"min-w-0 shrink-1 grow",children:a()})}),d.jsx(x.Menu.Content,{size:"sm",children:d.jsxs(x.Menu.SelectGroup,{required:!0,value:i,onValueChange:t.setConditionValue,children:[d.jsx(Dt,{value:!0,children:"true"}),d.jsx(Dt,{value:!1,children:"false"})]})})]}),d.jsx(Ge,{condition:t,conditionManager:n})]})},Wn=A.memo(r=>{const[{inputId:e,labelId:t,size:n,severity:i,showInputOnly:o,field:a,helpText:s,label:l,fieldProps:u},c]=He(r),{name:f,onBlur:h,onChange:v,value:p}=u,g=o?null:s,m=o?"":l,y=A.useCallback(w=>{v(!!w),h(!!w)},[h,v]),C=A.useCallback(()=>{h(p)},[h,p]);return d.jsx(Xe,{helpText:g,severity:i,children:d.jsx(We,{size:n,severity:i,inputId:e,labelId:t,label:m,image:o?void 0:a.image,className:"items-center flex-row-reverse justify-end gap-2",children:d.jsx(x.Checkbox.Root,{id:e,name:f,checked:p??!1,onCheckedChange:y,onBlur:C,size:"sm",accentColor:"primary",variant:"surface",...c,children:d.jsx(x.Checkbox.Indicator,{children:d.jsx(x.RiIcon,{icon:"RiCheckLine"})})})})})});Wn.displayName="BooleanInput";const ta={...Ue,type:"boolean"},Wt=class Wt extends Ee{constructor(t){super({...t,type:"boolean"});O(this,"onlyValidateAfterTouched",!1);O(this,"defaultConditionValue");O(this,"defaultConditionModifier","equals");O(this,"modifiers",{equals:j({modifier:Hs,isValueValid:t=>!0,isConditionValueValid:t=>!0}),notEquals:j({modifier:Gs,isValueValid:t=>!0,isConditionValueValid:t=>!0})})}isBlank(t){return this.required&&!t}serialize(){return super._serialize()}static deserialize(t){if(t.type!=="boolean")throw new Error("Type mismatch.");return new Wt(t)}getInput(t){return d.jsx(Wn,{...t,field:this})}renderCondition(t){return d.jsx(Ru,{...t})}};O(Wt,"fieldTypeName","Checkbox"),O(Wt,"fieldTypeDescription","Perfect for both optional and required yes/no questions."),O(Wt,"Icon",Ae.RiCheckboxCircleLine);let ir=Wt;const or=A.memo(r=>{const{ref:e,selectFieldOptions:t,...n}=r,i=A.useMemo(()=>t.map(o=>typeof o=="string"?{value:o,label:o}:o),[t]);return d.jsxs(x.Menu.MultiSelectGroup,{ref:e,...n,children:[d.jsx(Zi,{children:"Select all"}),i.map(o=>d.jsx(zs,{value:o.value,children:d.jsx("span",{className:"truncate",children:o.label})},o.value))]})});or.displayName="SelectFieldOptionMultiSelectGroup";const Vu=r=>{const{field:e,condition:t,conditionManager:n}=r,i=t.getConditionValue(),o=t.getConditionModifier(),a=A.useCallback(l=>{l.length>0?t.setConditionValue(l):t.setConditionValue(void 0)},[t]),s=()=>{if(i===void 0)return"...";if(i===null)return"empty";switch(i.length){case 0:return"...";default:return`${i.length} options`}};return d.jsxs(x.ButtonGroup,{className:"flex w-max max-w-full min-w-0 gap-0.5",size:"sm",variant:"soft",accentColor:"base",children:[d.jsxs(x.Badge,{className:"min-w-0 shrink-1",size:"sm",variant:"soft",accentColor:"base",children:[d.jsx(x.RiIcon,{icon:ze[e.type]}),d.jsx("span",{className:"truncate",children:e.label})]}),d.jsx($e,{field:e,condition:t,children:d.jsx(x.Button,{type:"button",children:e.getConditionModifier(o).modifier.render(i)})}),d.jsxs(x.Menu.Root,{children:[d.jsx(x.Menu.ClickTrigger,{children:d.jsx(x.Button,{type:"button",className:"truncate",children:s()})}),d.jsx(x.Menu.Content,{size:"sm",children:d.jsx(or,{values:i??[],selectFieldOptions:e.options,onValuesChange:a})})]}),d.jsx(Ge,{condition:t,conditionManager:n})]})},Xn=A.memo(r=>{const[{inputId:e,labelId:t,size:n,severity:i,showInputOnly:o,field:a,helpText:s,label:l,fieldProps:u},c]=He(r),{name:f,onChange:h,onBlur:v}=u,p=o?null:s,g=o?"":l,m=u.value??Sr,y=A.useCallback(C=>{const w=C.length>0?C:void 0;h(w),v(w)},[v,h]);return d.jsx(Xe,{helpText:p,severity:i,children:d.jsx(We,{size:n,severity:i,inputId:e,labelId:t,label:g,image:o?void 0:a.image,children:d.jsx(x.CheckboxGroup.Root,{id:e,name:f,className:"flex flex-col gap-1",accentColor:"base",variant:"surface",size:"sm",values:m,onValuesChange:y,...c,children:a.options.map(C=>d.jsxs("label",{className:"flex gap-2 items-center min-w-0",children:[d.jsx(x.CheckboxGroup.Item,{value:C.value,children:d.jsx(x.CheckboxGroup.ItemIndicator,{children:d.jsx(x.RiIcon,{icon:"RiCheckLine"})})}),d.jsx(x.Text,{size:"sm",accentColor:"base",className:"truncate",children:C.label})]},C.value))})})})});Xn.displayName="CheckboxListInput";const ra={...Ue,type:"checkbox-list",options:[]},Xt=class Xt extends Ee{constructor(t){const{options:n,...i}=t;super({...i,type:"checkbox-list"});O(this,"options");O(this,"onlyValidateAfterTouched",!1);O(this,"defaultConditionValue");O(this,"defaultConditionModifier","equals");O(this,"modifiers",{equals:j({modifier:En,isValueValid:t=>!0,isConditionValueValid:t=>!0}),notEquals:j({modifier:In,isValueValid:t=>!0,isConditionValueValid:t=>!0}),every:j({modifier:wn,isValueValid:t=>!0,isConditionValueValid:t=>!0}),some:j({modifier:_n,isValueValid:t=>!0,isConditionValueValid:t=>!0}),none:j({modifier:An,isValueValid:t=>!0,isConditionValueValid:t=>!0})});const o=new Set;this.options=n.map(a=>(typeof a=="string"&&(a={label:a,value:a}),o.add(a.label),a)),o.size!==n.length&&console.error(`${n.length-o.size} duplicate identifiers found in options. This may cause unexpected behavior. Options:`,n)}serialize(){return{...super._serialize(),options:this.options}}static deserialize(t){if(t.type!=="checkbox-list")throw new Error("Type mismatch.");return new Xt(t)}static getFieldCreationSchema(t=""){const n=t&&`${t}.`;return[{field:new _t({label:"Options",description:"List possible options for the user to select from.",required:!0,identifier:`${n}options`,minimum_length:2}),showDirectly:!0}]}getInput(t){return d.jsx(Xn,{field:this,...t})}renderCondition(t){return d.jsx(Vu,{...t})}};O(Xt,"fieldTypeName","Checkbox list"),O(Xt,"fieldTypeDescription","Allows the user to select a multiple options from a list."),O(Xt,"Icon",Ae.RiCheckboxMultipleLine);let Hr=Xt;const $n=A.memo(r=>{const{children:e,open:t,onOpenChange:n,defaultOpen:i,modal:o,size:a,align:s,accentColor:l="base",...u}=r;return d.jsxs(x.Popover.Root,{open:t,onOpenChange:n,defaultOpen:i,modal:o,children:[d.jsx(x.Popover.Trigger,{asChild:!0,children:e}),d.jsx(x.Popover.Content,{size:a,align:s,children:d.jsx(x.DayPicker,{size:a,autoFocus:!0,accentColor:l,...u})})]})});$n.displayName="DayPickerPopover";const ku=r=>{const{field:e,condition:t,conditionManager:n}=r,i=t.getConditionValue(),o=t.getConditionModifier(),a=()=>{switch(o){case"equals":case"notEquals":{const s=e.modifiers.equals,l=i!==void 0&&s.isConditionValueValid(i)?i:void 0;return d.jsx($n,{required:!1,size:"sm",mode:"single",selected:l??void 0,onSelect:u=>t.setConditionValue(u),children:d.jsx(x.Button,{type:"button",className:"truncate",children:l!==void 0?(l==null?void 0:l.toLocaleDateString())??"empty":"..."})})}case"before":case"after":{const s=e.modifiers.after,l=i!==void 0&&s.isConditionValueValid(i)?i:void 0;return d.jsx($n,{required:!0,size:"sm",mode:"single",selected:l,onSelect:t.setConditionValue,children:d.jsx(x.Button,{type:"button",className:"truncate",children:l?l.toLocaleDateString():"..."})})}}};return d.jsxs(x.ButtonGroup,{className:"flex w-max max-w-full min-w-0 gap-0.5",size:"sm",variant:"fill",accentColor:"base",children:[d.jsxs(x.Badge,{className:"min-w-0 shrink-1",size:"sm",variant:"fill",accentColor:"base",children:[d.jsx(x.RiIcon,{icon:ze[e.type]}),d.jsx("span",{className:"truncate",children:e.label})]}),d.jsx($e,{field:e,condition:t,children:d.jsx(x.Button,{type:"button",children:e.getConditionModifier(o).modifier.render(i)})}),a(),d.jsx(Ge,{condition:t,conditionManager:n})]})},jn=A.memo(r=>{const[{inputId:e,labelId:t,size:n,severity:i,showInputOnly:o,field:a,helpText:s,label:l,fieldProps:u},c]=He(r),{name:f,onChange:h,onBlur:v}=u,[p,g]=A.useState(!1),m=o?null:s,y=o?"":l,C=u.value?new Date(u.value):void 0,w=A.useCallback(I=>{h(I),g(!1)},[h]),E=A.useCallback(I=>{g(I),I||v(u.value)},[u.value,v]);return d.jsx(Xe,{helpText:m,severity:i,children:d.jsx(We,{size:n,severity:i,inputId:e,labelId:t,label:y,image:o?void 0:a.image,children:d.jsxs(x.Popover.Root,{open:p,onOpenChange:E,children:[d.jsx(x.Popover.Trigger,{asChild:!0,children:d.jsxs(x.Button,{id:e,name:f,type:"button",className:"!justify-between",accentColor:"base",variant:"surface",size:"sm",...c,children:[C?C.toLocaleString(void 0,{year:"numeric",month:"2-digit",day:"2-digit"}):"yyyy-mm-dd",d.jsx(x.RiIcon,{icon:"RiArrowDownSLine"})]})}),d.jsx(x.Popover.Content,{align:"start",children:d.jsx(x.DayPicker,{required:!1,mode:"single",variant:"solid",selected:C,onSelect:w})})]})})})});jn.displayName="DateInput";const na={...Ue,type:"date"},$t=class $t extends Ee{constructor(t){super({...t,type:"date"});O(this,"onlyValidateAfterTouched",!1);O(this,"defaultConditionValue");O(this,"defaultConditionModifier","equals");O(this,"modifiers",{equals:j({modifier:Ws,isValueValid:t=>!0,isConditionValueValid:t=>t instanceof Date}),notEquals:j({modifier:Xs,isValueValid:t=>!0,isConditionValueValid:t=>t instanceof Date}),before:j({modifier:$s,isValueValid:t=>!0,isConditionValueValid:t=>t instanceof Date}),after:j({modifier:js,isValueValid:t=>!0,isConditionValueValid:t=>t instanceof Date})})}serialize(){return super._serialize()}static deserialize(t){if(t.type!=="date")throw new Error("Type mismatch.");return new $t(t)}getInput(t){return d.jsx(jn,{field:this,...t})}renderCondition(t){return d.jsx(ku,{...t})}};O($t,"fieldTypeName","Date"),O($t,"fieldTypeDescription","Allows specifying a date."),O($t,"Icon",Ae.RiCalendarLine);let Gr=$t;const zu=r=>{const{field:e,condition:t,conditionManager:n}=r,i=t.getConditionValue(),o=t.getConditionModifier(),a=A.useCallback(l=>{l.length>0?t.setConditionValue(l):t.setConditionValue(void 0)},[t]),s=()=>{if(i===void 0)return"...";if(i===null)return"empty";switch(i.length){case 0:return"...";default:return`${i.length} options`}};return d.jsxs(x.ButtonGroup,{className:"flex w-max max-w-full min-w-0 gap-0.5",size:"sm",variant:"fill",accentColor:"base",children:[d.jsxs(x.Badge,{className:"min-w-0 shrink-1",size:"sm",variant:"fill",accentColor:"base",children:[d.jsx(x.RiIcon,{icon:ze[e.type]}),d.jsx("span",{className:"truncate",children:e.label})]}),d.jsx($e,{field:e,condition:t,children:d.jsx(x.Button,{type:"button",children:e.getConditionModifier(o).modifier.render(i)})}),d.jsxs(x.Menu.Root,{children:[d.jsx(x.Menu.ClickTrigger,{children:d.jsx(x.Button,{type:"button",className:"truncate",children:s()})}),d.jsx(x.Menu.Content,{size:"sm",children:d.jsx(or,{values:i??[],selectFieldOptions:e.options,onValuesChange:a})})]}),d.jsx(Ge,{condition:t,conditionManager:n})]})},qn=A.memo(r=>{const[{inputId:e,labelId:t,size:n,severity:i,showInputOnly:o,field:a,helpText:s,label:l,fieldProps:u},c]=He(r),{name:f,onChange:h,onBlur:v}=u,p=o?null:s,g=o?"":l,m=u.value??Sr,y=A.useCallback(w=>{const E=w.length>0?w:void 0;h(E),v(E)},[v,h]),C=A.useCallback(w=>{w||v(m)},[m,v]);return d.jsx(Xe,{helpText:p,severity:i,children:d.jsx(We,{size:n,severity:i,inputId:e,labelId:t,label:g,image:o?void 0:a.image,children:d.jsxs(x.Menu.Root,{onOpenChange:C,align:"start",children:[d.jsx(x.Menu.ClickTrigger,{children:d.jsxs(x.Button,{id:e,name:f,className:"!justify-between",variant:"surface",type:"button",size:"sm",accentColor:"base",...c,children:[d.jsx("span",{className:"truncate",children:m&&m.length>0?m.join(", "):a.placeholder}),d.jsx(x.RiIcon,{icon:"RiArrowDownSLine"})]})}),d.jsx(x.Menu.Content,{children:d.jsx(x.Menu.Scroll,{children:d.jsxs(x.Menu.MultiSelectGroup,{values:m,onValuesChange:y,children:[d.jsxs(x.Menu.SelectAllItem,{children:[d.jsx(x.Menu.CheckboxItemIndicator,{children:w=>w?d.jsx(x.RiIcon,{icon:"RiSubtractLine"}):d.jsx(x.RiIcon,{icon:"RiCheckLine"})}),"Select all"]}),a.options.map(w=>d.jsxs(x.Menu.MultiSelectItem,{value:w.value,children:[d.jsx(x.Menu.SelectedIndicator,{children:d.jsx(x.RiIcon,{icon:"RiCheckLine"})}),w.label]},w.value))]})})})]})})})});qn.displayName="MultiSelectInput";const ia={...Ue,type:"multi-select",options:[]},jt=class jt extends Gn{constructor(t){const{placeholder:n="Select one or more...",...i}=t;super({...i,placeholder:n,type:"multi-select"});O(this,"defaultConditionValue");O(this,"defaultConditionModifier","equals");O(this,"modifiers",{equals:j({modifier:En,isValueValid:t=>!0,isConditionValueValid:t=>!0}),notEquals:j({modifier:In,isValueValid:t=>!0,isConditionValueValid:t=>!0}),every:j({modifier:wn,isValueValid:t=>!0,isConditionValueValid:t=>!0}),some:j({modifier:_n,isValueValid:t=>!0,isConditionValueValid:t=>!0}),none:j({modifier:An,isValueValid:t=>!0,isConditionValueValid:t=>!0})})}isBlank(t){return super.isBlank(t)||(t==null?void 0:t.length)===0}isEqual(t,n){return t===void 0&&n===void 0?!0:t===void 0||n===void 0?!1:t.every(i=>n.includes(i))&&n.every(i=>t.includes(i))}serialize(){return super._serialize()}static deserialize(t){if(t.type!=="multi-select")throw new Error("Type mismatch.");return new jt(t)}getInput(t){return d.jsx(qn,{field:this,...t})}renderCondition(t){return d.jsx(zu,{...t})}};O(jt,"fieldTypeName","Multi-select"),O(jt,"fieldTypeDescription","Allows the user to select a multiple options from a list of options."),O(jt,"Icon",Ae.RiCheckboxLine);let ar=jt;const Uu=r=>{const{field:e,condition:t,conditionManager:n}=r,i=t.getConditionValue(),o=t.getConditionModifier(),a=()=>{switch(o){case"equals":case"notEquals":{const s=e.modifiers.equals,l=i!==void 0&&s.isConditionValueValid(i)?i:void 0;return d.jsxs(x.Menu.Root,{children:[d.jsx(x.Menu.ClickTrigger,{children:d.jsx(x.Button,{type:"button",className:"truncate",children:l!==void 0?l??"empty":"..."})}),d.jsx(x.Menu.Content,{size:"sm",children:d.jsx(x.Input.Root,{accentColor:"base",size:"sm",children:d.jsx(x.Input.Field,{placeholder:"Enter a number",type:"number",value:l??"",onChange:u=>{const c=u.target.valueAsNumber;t.setConditionValue(isNaN(c)?void 0:c)}})})})]})}case"greaterThanOrEquals":case"lessThanOrEquals":case"greaterThan":case"lessThan":{const s=e.modifiers.greaterThan,l=i!==void 0&&s.isConditionValueValid(i)?i:void 0;return d.jsxs(x.Popover.Root,{children:[d.jsx(x.Popover.Trigger,{asChild:!0,children:d.jsx(x.Button,{type:"button",className:"truncate",children:l??"..."})}),d.jsx(x.Popover.Content,{size:"sm",children:d.jsx(x.Input.Root,{accentColor:"base",size:"sm",children:d.jsx(x.Input.Field,{placeholder:"Enter a number",type:"number",value:l??"",onChange:u=>{const c=u.target.valueAsNumber;t.setConditionValue(isNaN(c)?void 0:c)}})})})]})}}};return d.jsxs(x.ButtonGroup,{className:"flex w-max max-w-full min-w-0 gap-0.5",size:"sm",variant:"fill",accentColor:"base",children:[d.jsxs(x.Badge,{className:"min-w-0 shrink-1",size:"sm",variant:"fill",accentColor:"base",children:[d.jsx(x.RiIcon,{icon:ze[e.type]}),d.jsx("span",{className:"truncate",children:e.label})]}),d.jsx($e,{field:e,condition:t,children:d.jsx(x.Button,{type:"button",children:e.getConditionModifier(o).modifier.render(i)})}),a(),d.jsx(Ge,{condition:t,conditionManager:n})]})},Yn=A.memo(r=>{const[{inputId:e,labelId:t,size:n,severity:i,showInputOnly:o,field:a,helpText:s,label:l,fieldProps:u,touched:c,helpers:f},h]=He(r),{name:v,onBlur:p,onChange:g,value:m}=u,y=o?null:s,C=o?"":l,[w,E]=A.useState(void 0);A.useEffect(()=>{E(m)},[m]);const I=A.useCallback(b=>{const P=b.target.valueAsNumber,L=Number.isNaN(P)?void 0:P;E(L),(c||!a.onlyValidateAfterTouched)&&f.setError(a.getError(L))},[a,f,c]),S=A.useCallback(()=>{g(w),p(w)},[w,p,g]);return d.jsx(Xe,{helpText:y,severity:i,children:d.jsx(We,{size:n,severity:i,inputId:e,labelId:t,label:C,image:o?void 0:a.image,children:d.jsx(x.Input.Root,{accentColor:"base",variant:"surface",size:"sm",children:d.jsx(x.Input.Field,{id:e,name:v,onChange:I,onBlur:S,value:w??"",type:"number",min:a.minimum,max:a.maximum,step:a.integers?1:.1,placeholder:a.placeholder,...h})})})})});Yn.displayName="NumberInput";const oa={...Ue,type:"number",minimum:Number.MIN_SAFE_INTEGER,maximum:Number.MAX_SAFE_INTEGER,integers:!1},aa=r=>"fields"in r,it=class it extends Ee{constructor(t){const{minimum:n=Number.MIN_SAFE_INTEGER,maximum:i=Number.MAX_SAFE_INTEGER,integers:o=!1,placeholder:a="Enter a number",...s}=t;super({...s,type:"number"});O(this,"minimum");O(this,"maximum");O(this,"integers");O(this,"placeholder");O(this,"defaultConditionValue");O(this,"defaultConditionModifier","equals");O(this,"modifiers",{equals:j({modifier:qs,isValueValid:t=>!0,isConditionValueValid:t=>!0}),notEquals:j({modifier:Ys,isValueValid:t=>!0,isConditionValueValid:t=>!0}),lessThan:j({modifier:Zs,isValueValid:t=>!0,isConditionValueValid:t=>!0}),lessThanOrEquals:j({modifier:Ks,isValueValid:t=>!0,isConditionValueValid:t=>!0}),greaterThan:j({modifier:Qs,isValueValid:t=>!0,isConditionValueValid:t=>!0}),greaterThanOrEquals:j({modifier:Js,isValueValid:t=>!0,isConditionValueValid:t=>!0})});this.minimum=n,this.maximum=i,this.integers=o,this.placeholder=a}static getFieldCreationSchema(t=""){const n=t&&`${t}.`;return[{field:new it({label:"Minimum",description:"Minimum value",integers:!0,required:!1,identifier:`${n}minimum`,formValidators:[this._validateMin(t)]}),showDirectly:!1},{field:new it({label:"Maximum",description:"Maximum value",integers:!0,required:!1,identifier:`${n}maximum`,formValidators:[this._validateMax(t)]}),showDirectly:!1},{field:new ir({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(o=>{if(typeof o=="number"&&o<n)return`Must be at least ${this.minimum}.`}),typeof i=="number"&&t.push(o=>{if(typeof o=="number"&&o>i)return`Must be at most ${this.maximum}.`}),this.integers&&t.push(o=>{if(typeof o=="number"&&!Number.isInteger(o))return"Must be a whole number."}),t}serialize(){return{...super._serialize(),minimum:this.minimum,maximum:this.maximum,integers:this.integers,placeholder:this.placeholder}}static deserialize(t){if(t.type!=="number")throw new Error("Type mismatch.");return new it(t)}getInput(t){return d.jsx(Yn,{field:this,...t})}renderCondition(t){return d.jsx(Uu,{...t})}};O(it,"fieldTypeName","Number"),O(it,"fieldTypeDescription","Allows specifying a number within a given range."),O(it,"Icon",Ae.RiHashtag),O(it,"_validateMin",t=>(n,i)=>{const o=aa(i)?st(i,t):i;return typeof o.maximum=="number"&&typeof n=="number"&&o.maximum<n?"Minimum cannot be greater than minimum.":null}),O(it,"_validateMax",t=>(n,i)=>{const o=aa(i)?st(i,t):i;return typeof o.minimum=="number"&&typeof n=="number"&&o.minimum>n?"Maximum cannot be less than minimum.":null});let dt=it;const Zn=A.memo(r=>{const{ref:e,selectFieldOptions:t,...n}=r,i=A.useMemo(()=>t.map(o=>typeof o=="string"?{value:o,label:o}:o),[t]);return d.jsx(x.Menu.SelectGroup,{ref:e,...n,children:i.map(o=>d.jsx(Dt,{value:o.value,children:d.jsx("span",{className:"truncate",children:o.label})},o.value))})});Zn.displayName="SelectFieldOptionSelectGroup";const Hu=r=>{const{field:e,condition:t,conditionManager:n}=r,i=t.getConditionValue(),o=t.getConditionModifier(),a=A.useMemo(()=>e.options.map(c=>typeof c=="string"?{value:c,label:c}:c),[e.options]),s=A.useMemo(()=>{const c={};for(const f of a)c[f.value]=f.label;return c},[a]),l=A.useCallback(c=>{c.length>0?t.setConditionValue(c):t.setConditionValue([])},[t]),u=()=>{switch(o){case"equals":case"notEquals":{const c=e.modifiers.equals,f=i!==void 0&&c.isConditionValueValid(i)?i:void 0;return d.jsxs(x.Menu.Root,{children:[d.jsx(x.Menu.ClickTrigger,{children:d.jsx(x.Button,{type:"button",className:"min-w-0 shrink-1 grow",children:d.jsx("span",{className:"truncate",children:f!==void 0?f?s[f]:"empty":"..."})})}),d.jsx(x.Menu.Content,{size:"sm",children:d.jsx(Zn,{required:!0,selectFieldOptions:e.options,value:f??void 0,onValueChange:h=>t.setConditionValue(h)})})]})}case"includes":case"excludes":{const c=e.modifiers.includes,f=i!==void 0&&c.isConditionValueValid(i)?i:void 0;return d.jsxs(x.Menu.Root,{children:[d.jsx(x.Menu.ClickTrigger,{children:d.jsx(x.Button,{type:"button",children:f?`${f.length} options`:"..."})}),d.jsx(x.Menu.Content,{size:"sm",children:d.jsx(or,{selectFieldOptions:e.options,values:f??[],onValuesChange:l})})]})}}};return d.jsxs(x.ButtonGroup,{className:"flex w-max max-w-full min-w-0 gap-0.5",size:"sm",variant:"fill",accentColor:"base",children:[d.jsxs(x.Badge,{className:"min-w-0 shrink-1",size:"sm",variant:"fill",accentColor:"base",children:[d.jsx(x.RiIcon,{icon:ze[e.type]}),d.jsx("span",{className:"truncate",children:e.label})]}),d.jsx($e,{field:e,condition:t,children:d.jsx(x.Button,{type:"button",children:e.getConditionModifier(o).modifier.render(i)})}),u(),d.jsx(Ge,{condition:t,conditionManager:n})]})},Kn=A.memo(r=>{const[{inputId:e,labelId:t,size:n,severity:i,showInputOnly:o,field:a,helpText:s,label:l,fieldProps:u},c]=He(r),{name:f,onChange:h,onBlur:v,value:p}=u,g=o?null:s,m=o?"":l,y=A.useCallback(w=>{h(w??void 0),v(w??void 0)},[v,h]),C=A.useCallback(()=>{h(void 0),v(void 0)},[v,h]);return d.jsx(Xe,{helpText:g,severity:i,children:d.jsx(We,{size:n,severity:i,inputId:e,labelId:t,label:m,image:o?void 0:a.image,children:d.jsxs(x.RadioGroup.Root,{id:e,name:f,className:"flex flex-col gap-1",accentColor:"base",variant:"surface",size:"sm",value:p??"",onValueChange:y,...c,children:[a.options.map(w=>d.jsxs("label",{className:"flex gap-2 items-center min-w-0",children:[d.jsx(x.RadioGroup.Item,{value:w.value,children:d.jsx(x.RadioGroup.Indicator,{children:d.jsx(x.RiIcon,{icon:"RiCircleFill"})})}),d.jsx(x.Text,{size:"sm",accentColor:"base",className:"truncate",children:w.label})]},w.value)),!!p&&d.jsxs(x.Button,{onClick:C,className:"w-max -mx-2",type:"button",variant:"ghost",accentColor:"base",size:"sm",children:[d.jsx(x.RiIcon,{icon:"RiCloseLine"})," Clear"]})]})})})});Kn.displayName="SelectInput";const sa={...Ue,type:"radio",options:[]},qt=class qt extends Ee{constructor(t){const{options:n,...i}=t;super({...i,type:"radio"});O(this,"options");O(this,"onlyValidateAfterTouched",!1);O(this,"defaultConditionValue");O(this,"defaultConditionModifier","equals");O(this,"modifiers",{equals:j({modifier:Er,isValueValid:t=>!0,isConditionValueValid:t=>!Array.isArray(t)}),notEquals:j({modifier:Ir,isValueValid:t=>!0,isConditionValueValid:t=>!Array.isArray(t)}),includes:j({modifier:Ji,isValueValid:t=>!0,isConditionValueValid:t=>Array.isArray(t)}),excludes:j({modifier:eo,isValueValid:t=>!0,isConditionValueValid:t=>Array.isArray(t)})});const o=new Set;this.options=n.map(a=>(typeof a=="string"&&(a={label:a,value:a}),o.add(a.label),a)),o.size!==n.length&&console.error(`${n.length-o.size} duplicate identifiers found in options. This may cause unexpected behavior. Options:`,n)}serialize(){return{...super._serialize(),options:this.options}}static deserialize(t){if(t.type!=="radio")throw new Error("Type mismatch.");return new qt(t)}static getFieldCreationSchema(t=""){const n=t&&`${t}.`;return[{field:new _t({label:"Options",description:"List possible options for the user to select from.",required:!0,identifier:`${n}options`,minimum_length:2}),showDirectly:!0}]}getInput(t){return d.jsx(Kn,{field:this,...t})}renderCondition(t){return d.jsx(Hu,{...t})}};O(qt,"fieldTypeName","Option list"),O(qt,"fieldTypeDescription","Allows the user to select a single option from a list of options."),O(qt,"Icon",Ae.RiRadioButtonFill);let Wr=qt;const Xr=A.memo(r=>{const{children:e,open:t,onOpenChange:n,defaultOpen:i,modal:o,size:a,accentColor:s="base",value:l,onValueChange:u,placeholder:c="Enter text",...f}=r,[h,v]=A.useState(""),p=A.useCallback(m=>{v(m.target.value)},[]),g=A.useCallback(m=>{const y=m.target.value;u==null||u(y)},[u]);return A.useEffect(()=>{l&&v(l)},[l]),d.jsxs(x.Popover.Root,{open:t,onOpenChange:n,defaultOpen:i,modal:o,children:[d.jsx(x.Popover.Trigger,{asChild:!0,children:e}),d.jsx(x.Popover.Content,{size:a,onClick:x.stopPropagation,...f,children:d.jsx(x.Input.Root,{size:a,accentColor:s,children:d.jsx(x.Input.Field,{placeholder:c,type:"text",value:h,onChange:p,onBlur:g})})})]})});Xr.displayName="TextInputPopover";const Gu=r=>{const{field:e,condition:t,conditionManager:n}=r,i=t.getConditionValue(),o=t.getConditionModifier(),a=()=>{switch(o){case"equals":case"notEquals":{const s=e.modifiers.equals,l=i!==void 0&&s.isConditionValueValid(i)?i:void 0;return d.jsxs(x.Menu.Root,{children:[d.jsx(x.Menu.ClickTrigger,{children:d.jsx(x.Button,{type:"button",className:"truncate",children:l!==void 0?l??"empty":"..."})}),d.jsx(x.Menu.Content,{size:"sm",children:d.jsx(x.Input.Root,{accentColor:"base",size:"sm",children:d.jsx(x.Input.Field,{placeholder:"Enter some text",type:"text",value:l??"",onChange:u=>{const c=u.target.value;t.setConditionValue(c)}})})})]})}case"includes":case"excludes":return d.jsx(Xr,{value:i??"",onValueChange:t.setConditionValue,size:"sm",children:d.jsx(x.Button,{type:"button",className:"min-w-0 shrink-1 grow",children:d.jsx("span",{className:"truncate",children:i||"..."})})})}};return d.jsxs(x.ButtonGroup,{className:"flex w-max max-w-full min-w-0 gap-0.5",size:"sm",variant:"fill",accentColor:"base",children:[d.jsxs(x.Badge,{className:"min-w-0 shrink-1",size:"sm",variant:"fill",accentColor:"base",children:[d.jsx(x.RiIcon,{icon:ze[e.type]}),d.jsx("span",{className:"truncate",children:e.label})]}),d.jsx($e,{field:e,condition:t,children:d.jsx(x.Button,{type:"button",className:"truncate",children:e.getConditionModifier(o).modifier.render(i)})}),a(),d.jsx(Ge,{condition:t,conditionManager:n})]})};function Wu(r,e){var t=Object.setPrototypeOf;t?t(r,e):r.__proto__=e}function Xu(r,e){e===void 0&&(e=r.constructor);var t=Error.captureStackTrace;t&&t(r,e)}var $u=function(){var r=function(t,n){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,o){i.__proto__=o}||function(i,o){for(var a in o)Object.prototype.hasOwnProperty.call(o,a)&&(i[a]=o[a])},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)}}(),ju=function(r){$u(e,r);function e(t,n){var i=this.constructor,o=r.call(this,t,n)||this;return Object.defineProperty(o,"name",{value:i.name,enumerable:!1,configurable:!0}),Wu(o,i.prototype),Xu(o),o}return e}(Error),qu=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)i.hasOwnProperty(o)&&(n[o]=i[o])},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)}}(),Re=function(r){qu(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}(ju),Yu=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)i.hasOwnProperty(o)&&(n[o]=i[o])},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){Yu(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.kind="ArgumentException",e}(Re),Zu=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)i.hasOwnProperty(o)&&(n[o]=i[o])},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)}}(),$=function(r){Zu(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.kind="IllegalArgumentException",e}(Re),Ku=function(){function r(e){if(this.binarizer=e,e===null)throw new $("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 o=this.binarizer.getLuminanceSource().crop(e,t,n,i);return new r(this.binarizer.createBinarizer(o))},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}(),Qu=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)i.hasOwnProperty(o)&&(n[o]=i[o])},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){Qu(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.getChecksumInstance=function(){return new e},e.kind="ChecksumException",e}(Re),Ju=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,o){for(;o--;)n[i++]=e[t++]},r.currentTimeMillis=function(){return Date.now()},r}(),ec=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)i.hasOwnProperty(o)&&(n[o]=i[o])},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){ec(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.kind="IndexOutOfBoundsException",e}(Re),tc=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)i.hasOwnProperty(o)&&(n[o]=i[o])},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)}}(),la=function(r){tc(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),rc=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.")},de=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 o=t;o<n;o++)e[o]=i},r.rangeCheck=function(e,t,n){if(t>n)throw new $("fromIndex("+t+") > toIndex("+n+")");if(t<0)throw new la(t);if(n>e)throw new la(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(o){return Array.from({length:t}).fill(n)})},r.createInt32Array=function(e,t,n){var i=Array.from({length:e});return i.map(function(o){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 o=rc(e),a=o.next();!a.done;a=o.next()){var s=a.value;i=31*i+s}}catch(l){t={error:l}}finally{try{a&&!a.done&&(n=o.return)&&n.call(o)}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,o=new Int32Array(i);return se.arraycopy(e,t,o,0,i),o},r.binarySearch=function(e,t,n){n===void 0&&(n=r.numberComparator);for(var i=0,o=e.length-1;i<=o;){var a=o+i>>1,s=n(t,e[a]);if(s>0)i=a+1;else if(s<0)o=a-1;else return a}return-i-1},r.numberComparator=function(e,t){return e-t},r}(),Y=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}(),me=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),o=n[i];o&=~((1<<(e&31))-1);for(var a=n.length;o===0;){if(++i===a)return t;o=n[i]}var s=i*32+Y.numberOfTrailingZeros(o);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),o=~n[i];o&=~((1<<(e&31))-1);for(var a=n.length;o===0;){if(++i===a)return t;o=~n[i]}var s=i*32+Y.numberOfTrailingZeros(o);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 $;if(t!==e){t--;for(var n=Math.floor(e/32),i=Math.floor(t/32),o=this.bits,a=n;a<=i;a++){var s=a>n?0:e&31,l=a<i?31:t&31,u=(2<<l)-(1<<s);o[a]|=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 $;if(t===e)return!0;t--;for(var i=Math.floor(e/32),o=Math.floor(t/32),a=this.bits,s=i;s<=o;s++){var l=s>i?0:e&31,u=s<o?31:t&31,c=(2<<u)-(1<<l)&4294967295;if((a[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 $("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 $("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 o=0;o<i;o++){for(var a=0,s=0;s<8;s++)this.get(e)&&(a|=1<<7-s),e++;t[n+o]=a}},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,o=0;o<n;o++){var a=i[o];a=a>>1&1431655765|(a&1431655765)<<1,a=a>>2&858993459|(a&858993459)<<2,a=a>>4&252645135|(a&252645135)<<4,a=a>>8&16711935|(a&16711935)<<8,a=a>>16&65535|(a&65535)<<16,e[t-o]=a}if(this.size!==n*32){for(var s=n*32-this.size,l=e[0]>>>s,o=1;o<n;o++){var u=e[o];l|=u<<32-s,e[o-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&&de.equals(this.bits,t.bits)},r.prototype.hashCode=function(){return 31*this.size+de.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}(),Jn;(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"})(Jn||(Jn={}));const fe=Jn;var nc=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)i.hasOwnProperty(o)&&(n[o]=i[o])},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)}}(),k=function(r){nc(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.getFormatInstance=function(){return new e},e.kind="FormatException",e}(Re),ic=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.")},re;(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"})(re||(re={}));var he=function(){function r(e,t,n){for(var i,o,a=[],s=3;s<arguments.length;s++)a[s-3]=arguments[s];this.valueIdentifier=e,this.name=n,typeof t=="number"?this.values=Int32Array.from([t]):this.values=t,this.otherEncodingNames=a,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 f=l[u];r.VALUES_TO_ECI.set(f,this)}try{for(var h=ic(a),v=h.next();!v.done;v=h.next()){var p=v.value;r.NAME_TO_ECI.set(p,this)}}catch(g){i={error:g}}finally{try{v&&!v.done&&(o=h.return)&&o.call(h)}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 k("incorect value");var t=r.VALUES_TO_ECI.get(e);if(t===void 0)throw new k("incorect value");return t},r.getCharacterSetECIByName=function(e){var t=r.NAME_TO_ECI.get(e);if(t===void 0)throw new k("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(re.Cp437,Int32Array.from([0,2]),"Cp437"),r.ISO8859_1=new r(re.ISO8859_1,Int32Array.from([1,3]),"ISO-8859-1","ISO88591","ISO8859_1"),r.ISO8859_2=new r(re.ISO8859_2,4,"ISO-8859-2","ISO88592","ISO8859_2"),r.ISO8859_3=new r(re.ISO8859_3,5,"ISO-8859-3","ISO88593","ISO8859_3"),r.ISO8859_4=new r(re.ISO8859_4,6,"ISO-8859-4","ISO88594","ISO8859_4"),r.ISO8859_5=new r(re.ISO8859_5,7,"ISO-8859-5","ISO88595","ISO8859_5"),r.ISO8859_6=new r(re.ISO8859_6,8,"ISO-8859-6","ISO88596","ISO8859_6"),r.ISO8859_7=new r(re.ISO8859_7,9,"ISO-8859-7","ISO88597","ISO8859_7"),r.ISO8859_8=new r(re.ISO8859_8,10,"ISO-8859-8","ISO88598","ISO8859_8"),r.ISO8859_9=new r(re.ISO8859_9,11,"ISO-8859-9","ISO88599","ISO8859_9"),r.ISO8859_10=new r(re.ISO8859_10,12,"ISO-8859-10","ISO885910","ISO8859_10"),r.ISO8859_11=new r(re.ISO8859_11,13,"ISO-8859-11","ISO885911","ISO8859_11"),r.ISO8859_13=new r(re.ISO8859_13,15,"ISO-8859-13","ISO885913","ISO8859_13"),r.ISO8859_14=new r(re.ISO8859_14,16,"ISO-8859-14","ISO885914","ISO8859_14"),r.ISO8859_15=new r(re.ISO8859_15,17,"ISO-8859-15","ISO885915","ISO8859_15"),r.ISO8859_16=new r(re.ISO8859_16,18,"ISO-8859-16","ISO885916","ISO8859_16"),r.SJIS=new r(re.SJIS,20,"SJIS","Shift_JIS"),r.Cp1250=new r(re.Cp1250,21,"Cp1250","windows-1250"),r.Cp1251=new r(re.Cp1251,22,"Cp1251","windows-1251"),r.Cp1252=new r(re.Cp1252,23,"Cp1252","windows-1252"),r.Cp1256=new r(re.Cp1256,24,"Cp1256","windows-1256"),r.UnicodeBigUnmarked=new r(re.UnicodeBigUnmarked,25,"UnicodeBigUnmarked","UTF-16BE","UnicodeBig"),r.UTF8=new r(re.UTF8,26,"UTF8","UTF-8"),r.ASCII=new r(re.ASCII,Int32Array.from([27,170]),"ASCII","US-ASCII"),r.Big5=new r(re.Big5,28,"Big5"),r.GB18030=new r(re.GB18030,29,"GB18030","GB2312","EUC_CN","GBK"),r.EUC_KR=new r(re.EUC_KR,30,"EUC_KR","EUC-KR"),r}(),oc=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)i.hasOwnProperty(o)&&(n[o]=i[o])},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){oc(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.kind="UnsupportedOperationException",e}(Re),je=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 he?e:he.getCharacterSetECIByName(e)},r.decodeFallback=function(e,t){var n=this.encodingCharacterSet(t);if(r.isDecodeFallbackSupported(n)){for(var i="",o=0,a=e.length;o<a;o++){var s=e[o].toString(16);s.length<2&&(s="0"+s),i+="%"+s}return decodeURIComponent(i)}if(n.equals(he.UnicodeBigUnmarked))return String.fromCharCode.apply(null,new Uint16Array(e.buffer));throw new $r("Encoding "+this.encodingName(t)+" not supported by fallback.")},r.isDecodeFallbackSupported=function(e){return e.equals(he.UTF8)||e.equals(he.ISO8859_1)||e.equals(he.ASCII)},r.encodeFallback=function(e){for(var t=btoa(unescape(encodeURIComponent(e))),n=t.split(""),i=[],o=0;o<n.length;o++)i.push(n[o].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 je.decode(new Uint8Array([e]),n)},r.guessEncoding=function(e,t){if(t!=null&&t.get(fe.CHARACTER_SET)!==void 0)return t.get(fe.CHARACTER_SET).toString();for(var n=e.length,i=!0,o=!0,a=!0,s=0,l=0,u=0,c=0,f=0,h=0,v=0,p=0,g=0,m=0,y=0,C=e.length>3&&e[0]===239&&e[1]===187&&e[2]===191,w=0;w<n&&(i||o||a);w++){var E=e[w]&255;a&&(s>0?(E&128)===0?a=!1:s--:(E&128)!==0&&((E&64)===0?a=!1:(s++,(E&32)===0?l++:(s++,(E&16)===0?u++:(s++,(E&8)===0?c++:a=!1))))),i&&(E>127&&E<160?i=!1:E>159&&(E<192||E===215||E===247)&&y++),o&&(f>0?E<64||E===127||E>252?o=!1:f--:E===128||E===160||E>239?o=!1:E>160&&E<224?(h++,p=0,v++,v>g&&(g=v)):E>127?(f++,v=0,p++,p>m&&(m=p)):(v=0,p=0))}return a&&s>0&&(a=!1),o&&f>0&&(o=!1),a&&(C||l+u+c>0)?r.UTF8:o&&(r.ASSUME_SHIFT_JIS||g>=3||m>=3)?r.SHIFT_JIS:i&&o?g===2&&h===2||y*10>=n?r.SHIFT_JIS:r.ISO88591:i?r.ISO88591:o?r.SHIFT_JIS:a?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 o(s,l,u,c,f,h){if(s==="%%")return"%";if(t[++i]!==void 0){s=c?parseInt(c.substr(1)):void 0;var v=f?parseInt(f.substr(1)):void 0,p;switch(h){case"s":p=t[i];break;case"c":p=t[i][0];break;case"f":p=parseFloat(t[i]).toFixed(s);break;case"p":p=parseFloat(t[i]).toPrecision(s);break;case"e":p=parseFloat(t[i]).toExponential(s);break;case"x":p=parseInt(t[i]).toString(v||16);break;case"d":p=parseFloat(parseInt(t[i],v||10).toPrecision(s)).toFixed(0);break}p=typeof p=="object"?JSON.stringify(p):(+p).toString(v);for(var g=parseInt(u),m=u&&u[0]+""=="0"?"0":" ";p.length<g;)p=l!==void 0?p+m:m+p;return p}}var a=/%(-)?(0?[0-9]+)?([.][0-9]+)?([#][0-9]+)?([scfpexd%])/g;return e.replace(a,o)},r.getBytes=function(e,t){return je.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=he.SJIS.getName(),r.GB2312="GB2312",r.ISO88591=he.ISO8859_1.getName(),r.EUC_JP="EUC_JP",r.UTF8=he.UTF8.getName(),r.PLATFORM_DEFAULT_ENCODING=r.UTF8,r.ASSUME_SHIFT_JIS=!1,r}(),q=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}(),rt=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 $("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),o=0;o<t;o++)for(var a=e[o],s=0;s<n;s++)a[s]&&i.set(s,o);return i},r.parseFromString=function(e,t,n){if(e===null)throw new $("stringRepresentation cannot be null");for(var i=new Array(e.length),o=0,a=0,s=-1,l=0,u=0;u<e.length;)if(e.charAt(u)===`
|
|
46
|
+
`||e.charAt(u)==="\r"){if(o>a){if(s===-1)s=o-a;else if(o-a!==s)throw new $("row lengths do not match");a=o,l++}u++}else if(e.substring(u,u+t.length)===t)u+=t.length,i[o]=!0,o++;else if(e.substring(u,u+n.length)===n)u+=n.length,i[o]=!1,o++;else throw new $("illegal character encountered: "+e.substring(u));if(o>a){if(s===-1)s=o-a;else if(o-a!==s)throw new $("row lengths do not match");l++}for(var c=new r(s,l),f=0;f<o;f++)i[f]&&c.set(Math.floor(f%s),Math.floor(f/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 $("input matrix dimensions do not match");for(var t=new me(Math.floor(this.width/32)+1),n=this.rowSize,i=this.bits,o=0,a=this.height;o<a;o++)for(var s=o*n,l=e.getRow(o,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 $("Left and top must be nonnegative");if(i<1||n<1)throw new $("Height and width must be at least 1");var o=e+n,a=t+i;if(a>this.height||o>this.width)throw new $("The region must fit inside the matrix");for(var s=this.rowSize,l=this.bits,u=t;u<a;u++)for(var c=u*s,f=e;f<o;f++)l[c+Math.floor(f/32)]|=1<<(f&31)&4294967295},r.prototype.getRow=function(e,t){t==null||t.getSize()<this.width?t=new me(this.width):t.clear();for(var n=this.rowSize,i=this.bits,o=e*n,a=0;a<n;a++)t.setBulk(a*32,i[o+a]);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 me(e),i=new me(e),o=0,a=Math.floor((t+1)/2);o<a;o++)n=this.getRow(o,n),i=this.getRow(t-1-o,i),n.reverse(),i.reverse(),this.setRow(o,i),this.setRow(t-1-o,n)},r.prototype.getEnclosingRectangle=function(){for(var e=this.width,t=this.height,n=this.rowSize,i=this.bits,o=e,a=t,s=-1,l=-1,u=0;u<t;u++)for(var c=0;c<n;c++){var f=i[u*n+c];if(f!==0){if(u<a&&(a=u),u>l&&(l=u),c*32<o){for(var h=0;(f<<31-h&4294967295)===0;)h++;c*32+h<o&&(o=c*32+h)}if(c*32+31>s){for(var h=31;!(f>>>h);)h--;c*32+h>s&&(s=c*32+h)}}}return s<o||l<a?null:Int32Array.from([o,a,s-o+1,l-a+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,o=n%e*32,a=t[n],s=0;(a<<31-s&4294967295)===0;)s++;return o+=s,Int32Array.from([o,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),o=Math.floor(n%e)*32,a=t[n],s=31;!(a>>>s);)s--;return o+=s,Int32Array.from([o,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&&de.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+de.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=`
|
|
47
|
+
`),this.buildToString(e,t,n)},r.prototype.buildToString=function(e,t,n){for(var i=new q,o=0,a=this.height;o<a;o++){for(var s=0,l=this.width;s<l;s++)i.append(this.get(s,o)?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}(),ac=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)i.hasOwnProperty(o)&&(n[o]=i[o])},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)}}(),D=function(r){ac(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.getNotFoundInstance=function(){return new e},e.kind="NotFoundException",e}(Re),sc=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)i.hasOwnProperty(o)&&(n[o]=i[o])},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)}}(),lc=function(r){sc(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(),o=i.getWidth();n==null||n.getSize()<o?n=new me(o):n.clear(),this.initArrays(o);for(var a=i.getRow(t,this.luminances),s=this.buckets,l=0;l<o;l++)s[(a[l]&255)>>e.LUMINANCE_SHIFT]++;var u=e.estimateBlackPoint(s);if(o<3)for(var l=0;l<o;l++)(a[l]&255)<u&&n.set(l);else for(var c=a[0]&255,f=a[1]&255,l=1;l<o-1;l++){var h=a[l+1]&255;(f*4-c-h)/2<u&&n.set(l),c=f,f=h}return n},e.prototype.getBlackMatrix=function(){var t=this.getLuminanceSource(),n=t.getWidth(),i=t.getHeight(),o=new rt(n,i);this.initArrays(n);for(var a=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),f=Math.floor(n/5);f<c;f++){var h=u[f]&255;a[h>>e.LUMINANCE_SHIFT]++}for(var v=e.estimateBlackPoint(a),p=t.getMatrix(),s=0;s<i;s++)for(var g=s*n,f=0;f<n;f++){var h=p[g+f]&255;h<v&&o.set(f,s)}return o},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,o=0,a=0,s=0;s<n;s++)t[s]>a&&(o=s,a=t[s]),t[s]>i&&(i=t[s]);for(var l=0,u=0,s=0;s<n;s++){var c=s-o,f=t[s]*c*c;f>u&&(l=s,u=f)}if(o>l){var h=o;o=l,l=h}if(l-o<=n/16)throw new D;for(var v=l-1,p=-1,s=l-1;s>o;s--){var g=s-o,f=g*g*(l-s)*(i-t[s]);f>p&&(v=s,p=f)}return v<<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}(Ju),uc=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)i.hasOwnProperty(o)&&(n[o]=i[o])},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)}}(),cc=function(r){uc(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 o=t.getMatrix(),a=n>>e.BLOCK_SIZE_POWER;(n&e.BLOCK_SIZE_MASK)!==0&&a++;var s=i>>e.BLOCK_SIZE_POWER;(i&e.BLOCK_SIZE_MASK)!==0&&s++;var l=e.calculateBlackPoints(o,a,s,n,i),u=new rt(n,i);e.calculateThresholdForBlock(o,a,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,o,a,s,l){for(var u=a-e.BLOCK_SIZE,c=o-e.BLOCK_SIZE,f=0;f<i;f++){var h=f<<e.BLOCK_SIZE_POWER;h>u&&(h=u);for(var v=e.cap(f,2,i-3),p=0;p<n;p++){var g=p<<e.BLOCK_SIZE_POWER;g>c&&(g=c);for(var m=e.cap(p,2,n-3),y=0,C=-2;C<=2;C++){var w=s[v+C];y+=w[m-2]+w[m-1]+w[m]+w[m+1]+w[m+2]}var E=y/25;e.thresholdBlock(t,g,h,E,o,l)}}},e.cap=function(t,n,i){return t<n?n:t>i?i:t},e.thresholdBlock=function(t,n,i,o,a,s){for(var l=0,u=i*a+n;l<e.BLOCK_SIZE;l++,u+=a)for(var c=0;c<e.BLOCK_SIZE;c++)(t[u+c]&255)<=o&&s.set(n+c,i+l)},e.calculateBlackPoints=function(t,n,i,o,a){for(var s=a-e.BLOCK_SIZE,l=o-e.BLOCK_SIZE,u=new Array(i),c=0;c<i;c++){u[c]=new Int32Array(n);var f=c<<e.BLOCK_SIZE_POWER;f>s&&(f=s);for(var h=0;h<n;h++){var v=h<<e.BLOCK_SIZE_POWER;v>l&&(v=l);for(var p=0,g=255,m=0,y=0,C=f*o+v;y<e.BLOCK_SIZE;y++,C+=o){for(var w=0;w<e.BLOCK_SIZE;w++){var E=t[C+w]&255;p+=E,E<g&&(g=E),E>m&&(m=E)}if(m-g>e.MIN_DYNAMIC_RANGE)for(y++,C+=o;y<e.BLOCK_SIZE;y++,C+=o)for(var w=0;w<e.BLOCK_SIZE;w++)p+=t[C+w]&255}var I=p>>e.BLOCK_SIZE_POWER*2;if(m-g<=e.MIN_DYNAMIC_RANGE&&(I=g/2,c>0&&h>0)){var S=(u[c-1][h]+2*u[c][h-1]+u[c-1][h-1])/4;g<S&&(I=S)}u[c][h]=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}(lc),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 $r("This luminance source does not support cropping.")},r.prototype.isRotateSupported=function(){return!1},r.prototype.rotateCounterClockwise=function(){throw new $r("This luminance source does not support rotation by 90 degrees.")},r.prototype.rotateCounterClockwise45=function(){throw new $r("This luminance source does not support rotation by 45 degrees.")},r.prototype.toString=function(){for(var e=new Uint8ClampedArray(this.width),t=new q,n=0;n<this.height;n++){for(var i=this.getRow(n,e),o=0;o<this.width;o++){var a=i[o]&255,s=void 0;a<64?s="#":a<128?s="+":a<192?s=".":s=" ",t.append(s)}t.append(`
|
|
48
|
+
`)}return t.toString()},r}(),fc=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)i.hasOwnProperty(o)&&(n[o]=i[o])},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)}}(),ei=function(r){fc(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),o=this.getWidth(),a=0;a<o;a++)i[a]=255-(i[a]&255);return i},e.prototype.getMatrix=function(){for(var t=this.delegate.getMatrix(),n=this.getWidth()*this.getHeight(),i=new Uint8ClampedArray(n),o=0;o<n;o++)i[o]=255-(t[o]&255);return i},e.prototype.isCropSupported=function(){return this.delegate.isCropSupported()},e.prototype.crop=function(t,n,i,o){return new e(this.delegate.crop(t,n,i,o))},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),dc=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)i.hasOwnProperty(o)&&(n[o]=i[o])},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)}}(),hc=function(r){dc(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 o=new Uint8ClampedArray(n*i);if(e.FRAME_INDEX=!e.FRAME_INDEX,e.FRAME_INDEX)for(var a=0,s=0,l=t.length;a<l;a+=4,s++){var u=void 0,c=t[a+3];if(c===0)u=255;else{var f=t[a],h=t[a+1],v=t[a+2];u=306*f+601*h+117*v+512>>10}o[s]=u}else for(var a=0,s=0,p=t.length;a<p;a+=4,s++){var u=void 0,c=t[a+3];if(c===0)u=255;else{var f=t[a],h=t[a+1],v=t[a+2];u=306*f+601*h+117*v+512>>10}o[s]=255-u}return o},e.prototype.getRow=function(t,n){if(t<0||t>=this.getHeight())throw new $("Requested row is outside the image: "+t);var i=this.getWidth(),o=t*i;return n===null?n=this.buffer.slice(o,o+i):(n.length<i&&(n=new Uint8ClampedArray(i)),n.set(this.buffer.slice(o,o+i))),n},e.prototype.getMatrix=function(){return this.buffer},e.prototype.isCropSupported=function(){return!0},e.prototype.crop=function(t,n,i,o){return r.prototype.crop.call(this,t,n,i,o),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"),o=t*e.DEGREE_TO_RADIANS,a=this.canvas.width,s=this.canvas.height,l=Math.ceil(Math.abs(Math.cos(o))*a+Math.abs(Math.sin(o))*s),u=Math.ceil(Math.abs(Math.sin(o))*a+Math.abs(Math.cos(o))*s);return n.width=l,n.height=u,i.translate(l/2,u/2),i.rotate(o),i.drawImage(this.canvas,a/-2,s/-2),this.buffer=e.makeBufferFromCanvasImageData(n),this},e.prototype.invert=function(){return new ei(this)},e.DEGREE_TO_RADIANS=Math.PI/180,e.FRAME_INDEX=!0,e}(jr),vc=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}(),Pe=function(r,e,t,n){function i(o){return o instanceof t?o:new t(function(a){a(o)})}return new(t||(t=Promise))(function(o,a){function s(c){try{u(n.next(c))}catch(f){a(f)}}function l(c){try{u(n.throw(c))}catch(f){a(f)}}function u(c){c.done?o(c.value):i(c.value).then(s,l)}u((n=n.apply(r,e||[])).next())})},Fe=function(r,e){var t={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},n,i,o,a;return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;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&&(o=u[0]&2?i.return:u[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,u[1])).done)return o;switch(i=0,o&&(u=[u[0]&2,o.value]),u[0]){case 0:case 1:o=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(o=t.trys,!(o=o.length>0&&o[o.length-1])&&(u[0]===6||u[0]===2)){t=0;continue}if(u[0]===3&&(!o||u[1]>o[0]&&u[1]<o[3])){t.label=u[1];break}if(u[0]===6&&t.label<o[1]){t.label=o[1],o=u;break}if(o&&t.label<o[2]){t.label=o[2],t.ops.push(u);break}o[2]&&t.ops.pop(),t.trys.pop();continue}u=e.call(r,t)}catch(c){u=[6,c],i=0}finally{n=o=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}},pc=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.")},Vt=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 Pe(this,void 0,void 0,function(){var e,t,n,i,o,a,s,l,u,c,f,h;return Fe(this,function(v){switch(v.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=v.sent(),t=[];try{for(n=pc(e),i=n.next();!i.done;i=n.next())o=i.value,a=o.kind==="video"?"videoinput":o.kind,a==="videoinput"&&(s=o.deviceId||o.id,l=o.label||"Video device "+(t.length+1),u=o.groupId,c={deviceId:s,label:l,kind:a,groupId:u},t.push(c))}catch(p){f={error:p}}finally{try{i&&!i.done&&(h=n.return)&&h.call(n)}finally{if(f)throw f.error}}return[2,t]}})})},r.prototype.getVideoInputDevices=function(){return Pe(this,void 0,void 0,function(){var e;return Fe(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 vc(n.deviceId,n.label)})]}})})},r.prototype.findDeviceById=function(e){return Pe(this,void 0,void 0,function(){var t;return Fe(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 Pe(this,void 0,void 0,function(){return Fe(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 Pe(this,void 0,void 0,function(){var n,i;return Fe(this,function(o){switch(o.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,o.sent()]}})})},r.prototype.decodeOnceFromConstraints=function(e,t){return Pe(this,void 0,void 0,function(){var n;return Fe(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 Pe(this,void 0,void 0,function(){var n,i;return Fe(this,function(o){switch(o.label){case 0:return this.reset(),[4,this.attachStreamToVideo(e,t)];case 1:return n=o.sent(),[4,this.decodeOnce(n)];case 2:return i=o.sent(),[2,i]}})})},r.prototype.decodeFromInputVideoDeviceContinuously=function(e,t,n){return Pe(this,void 0,void 0,function(){return Fe(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 Pe(this,void 0,void 0,function(){var i,o;return Fe(this,function(a){switch(a.label){case 0:return e?i={deviceId:{exact:e}}:i={facingMode:"environment"},o={video:i},[4,this.decodeFromConstraints(o,t,n)];case 1:return[2,a.sent()]}})})},r.prototype.decodeFromConstraints=function(e,t,n){return Pe(this,void 0,void 0,function(){var i;return Fe(this,function(o){switch(o.label){case 0:return[4,navigator.mediaDevices.getUserMedia(e)];case 1:return i=o.sent(),[4,this.decodeFromStream(i,t,n)];case 2:return[2,o.sent()]}})})},r.prototype.decodeFromStream=function(e,t,n){return Pe(this,void 0,void 0,function(){var i;return Fe(this,function(o){switch(o.label){case 0:return this.reset(),[4,this.attachStreamToVideo(e,t)];case 1:return i=o.sent(),[4,this.decodeContinuously(i,n)];case 2:return[2,o.sent()]}})})},r.prototype.stopAsyncDecode=function(){this._stopAsyncDecode=!0},r.prototype.stopContinuousDecode=function(){this._stopContinuousDecode=!0},r.prototype.attachStreamToVideo=function(e,t){return Pe(this,void 0,void 0,function(){var n;return Fe(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 Pe(this,void 0,void 0,function(){return Fe(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 Pe(this,void 0,void 0,function(){return Fe(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 Pe(this,void 0,void 0,function(){return Fe(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 o=function(a,s){if(i._stopAsyncDecode){s(new D("Video stream has ended before any code could be detected.")),i._stopAsyncDecode=void 0;return}try{var l=i.decode(e);a(l)}catch(h){var u=t&&h instanceof D,c=h instanceof Ce||h instanceof k,f=c&&n;if(u||f)return setTimeout(o,i._timeBetweenDecodingAttempts,a,s);s(h)}};return new Promise(function(a,s){return o(a,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 o=n.decode(e);t(o,null),setTimeout(i,n.timeBetweenScansMillis)}catch(l){t(null,l);var a=l instanceof Ce||l instanceof k,s=l instanceof D;(a||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 hc(t),i=new cc(n);return new Ku(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}(),Oe=function(){function r(e,t,n,i,o,a){n===void 0&&(n=t==null?0:8*t.length),a===void 0&&(a=se.currentTimeMillis()),this.text=e,this.rawBytes=t,this.numBits=n,this.resultPoints=i,this.format=o,this.timestamp=a,this.text=e,this.rawBytes=t,n==null?this.numBits=t==null?0:8*t.length:this.numBits=n,this.resultPoints=i,this.format=o,this.resultMetadata=null,a==null?this.timestamp=se.currentTimeMillis():this.timestamp=a}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}(),ti;(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"})(ti||(ti={}));const H=ti;var ri;(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"})(ri||(ri={}));const Ie=ri;var qr=function(){function r(e,t,n,i,o,a){o===void 0&&(o=-1),a===void 0&&(a=-1),this.rawBytes=e,this.text=t,this.byteSegments=n,this.ecLevel=i,this.structuredAppendSequenceNumber=o,this.structuredAppendParity=a,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}(),sr=function(){function r(){}return r.prototype.exp=function(e){return this.expTable[e]},r.prototype.log=function(e){if(e===0)throw new $;return this.logTable[e]},r.addOrSubtract=function(e,t){return e^t},r}(),ht=function(){function r(e,t){if(t.length===0)throw new $;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,o=t.length;i!==o;i++){var a=t[i];n=sr.addOrSubtract(n,a)}return n}n=t[0];for(var s=t.length,l=this.field,i=1;i<s;i++)n=sr.addOrSubtract(l.multiply(e,n),t[i]);return n},r.prototype.addOrSubtract=function(e){if(!this.field.equals(e.field))throw new $("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 o=new Int32Array(n.length),a=n.length-t.length;se.arraycopy(n,0,o,0,a);for(var s=a;s<n.length;s++)o[s]=sr.addOrSubtract(t[s-a],n[s]);return new r(this.field,o)},r.prototype.multiply=function(e){if(!this.field.equals(e.field))throw new $("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,o=i.length,a=new Int32Array(n+o-1),s=this.field,l=0;l<n;l++)for(var u=t[l],c=0;c<o;c++)a[l+c]=sr.addOrSubtract(a[l+c],s.multiply(u,i[c]));return new r(s,a)},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),o=this.coefficients,a=0;a<t;a++)i[a]=n.multiply(o[a],e);return new r(n,i)},r.prototype.multiplyByMonomial=function(e,t){if(e<0)throw new $;if(t===0)return this.field.getZero();for(var n=this.coefficients,i=n.length,o=new Int32Array(i+e),a=this.field,s=0;s<i;s++)o[s]=a.multiply(n[s],t);return new r(a,o)},r.prototype.divide=function(e){if(!this.field.equals(e.field))throw new $("GenericGFPolys do not have same GenericGF field");if(e.isZero())throw new $("Divide by 0");for(var t=this.field,n=t.getZero(),i=this,o=e.getCoefficient(e.getDegree()),a=t.inverse(o);i.getDegree()>=e.getDegree()&&!i.isZero();){var s=i.getDegree()-e.getDegree(),l=t.multiply(i.getCoefficient(i.getDegree()),a),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}(),gc=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)i.hasOwnProperty(o)&&(n[o]=i[o])},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)}}(),ua=function(r){gc(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.kind="ArithmeticException",e}(Re),xc=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)i.hasOwnProperty(o)&&(n[o]=i[o])},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)}}(),Ve=function(r){xc(e,r);function e(t,n,i){var o=r.call(this)||this;o.primitive=t,o.size=n,o.generatorBase=i;for(var a=new Int32Array(n),s=1,l=0;l<n;l++)a[l]=s,s*=2,s>=n&&(s^=t,s&=n-1);o.expTable=a;for(var u=new Int32Array(n),l=0;l<n-1;l++)u[a[l]]=l;return o.logTable=u,o.zero=new ht(o,Int32Array.from([0])),o.one=new ht(o,Int32Array.from([1])),o}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 $;if(n===0)return this.zero;var i=new Int32Array(t+1);return i[0]=n,new ht(this,i)},e.prototype.inverse=function(t){if(t===0)throw new ua;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"+Y.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}(sr),yc=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)i.hasOwnProperty(o)&&(n[o]=i[o])},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)}}(),Yr=function(r){yc(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.kind="ReedSolomonException",e}(Re),Cc=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)i.hasOwnProperty(o)&&(n[o]=i[o])},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)}}(),lr=function(r){Cc(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.kind="IllegalStateException",e}(Re),Zr=function(){function r(e){this.field=e}return r.prototype.decode=function(e,t){for(var n=this.field,i=new ht(n,e),o=new Int32Array(t),a=!0,s=0;s<t;s++){var l=i.evaluateAt(n.exp(s+n.getGeneratorBase()));o[o.length-1-s]=l,l!==0&&(a=!1)}if(!a)for(var u=new ht(n,o),c=this.runEuclideanAlgorithm(n.buildMonomial(t,1),u,t),f=c[0],h=c[1],v=this.findErrorLocations(f),p=this.findErrorMagnitudes(h,v),s=0;s<v.length;s++){var g=e.length-1-n.log(v[s]);if(g<0)throw new Yr("Bad error location");e[g]=Ve.addOrSubtract(e[g],p[s])}},r.prototype.runEuclideanAlgorithm=function(e,t,n){if(e.getDegree()<t.getDegree()){var i=e;e=t,t=i}for(var o=this.field,a=e,s=t,l=o.getZero(),u=o.getOne();s.getDegree()>=(n/2|0);){var c=a,f=l;if(a=s,l=u,a.isZero())throw new Yr("r_{i-1} was zero");s=c;for(var h=o.getZero(),v=a.getCoefficient(a.getDegree()),p=o.inverse(v);s.getDegree()>=a.getDegree()&&!s.isZero();){var g=s.getDegree()-a.getDegree(),m=o.multiply(s.getCoefficient(s.getDegree()),p);h=h.addOrSubtract(o.buildMonomial(g,m)),s=s.addOrSubtract(a.multiplyByMonomial(g,m))}if(u=h.multiply(l).addOrSubtract(f),s.getDegree()>=a.getDegree())throw new lr("Division algorithm failed to reduce polynomial?")}var y=u.getCoefficient(0);if(y===0)throw new Yr("sigmaTilde(0) was zero");var C=o.inverse(y),w=u.multiplyScalar(C),E=s.multiplyScalar(C);return[w,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,o=this.field,a=1;a<o.getSize()&&i<t;a++)e.evaluateAt(a)===0&&(n[i]=o.inverse(a),i++);if(i!==t)throw new Yr("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),o=this.field,a=0;a<n;a++){for(var s=o.inverse(t[a]),l=1,u=0;u<n;u++)if(a!==u){var c=o.multiply(t[u],s),f=(c&1)===0?c|1:c&-2;l=o.multiply(l,f)}i[a]=o.multiply(e.evaluateAt(s),o.inverse(l)),o.getGeneratorBase()!==0&&(i[a]=o.multiply(i[a],s))}return i},r}(),Se;(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"})(Se||(Se={}));var ca=function(){function r(){}return r.prototype.decode=function(e){this.ddata=e;var t=e.getBits(),n=this.extractBits(t),i=this.correctBits(n),o=r.convertBoolArrayToByteArray(i),a=r.getEncodedData(i),s=new qr(o,a,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=Se.UPPER,i=Se.UPPER,o="",a=0;a<t;)if(i===Se.BINARY){if(t-a<5)break;var s=r.readCode(e,a,5);if(a+=5,s===0){if(t-a<11)break;s=r.readCode(e,a,11)+31,a+=11}for(var l=0;l<s;l++){if(t-a<8){a=t;break}var u=r.readCode(e,a,8);o+=Z.castAsNonUtf8Char(u),a+=8}i=n}else{var c=i===Se.DIGIT?4:5;if(t-a<c)break;var u=r.readCode(e,a,c);a+=c;var f=r.getCharacter(i,u);f.startsWith("CTRL_")?(n=i,i=r.getTable(f.charAt(5)),f.charAt(6)==="L"&&(n=i)):(o+=f,i=n)}return o},r.getTable=function(e){switch(e){case"L":return Se.LOWER;case"P":return Se.PUNCT;case"M":return Se.MIXED;case"D":return Se.DIGIT;case"B":return Se.BINARY;case"U":default:return Se.UPPER}},r.getCharacter=function(e,t){switch(e){case Se.UPPER:return r.UPPER_TABLE[t];case Se.LOWER:return r.LOWER_TABLE[t];case Se.MIXED:return r.MIXED_TABLE[t];case Se.PUNCT:return r.PUNCT_TABLE[t];case Se.DIGIT:return r.DIGIT_TABLE[t];default:throw new lr("Bad table")}},r.prototype.correctBits=function(e){var t,n;this.ddata.getNbLayers()<=2?(n=6,t=Ve.AZTEC_DATA_6):this.ddata.getNbLayers()<=8?(n=8,t=Ve.AZTEC_DATA_8):this.ddata.getNbLayers()<=22?(n=10,t=Ve.AZTEC_DATA_10):(n=12,t=Ve.AZTEC_DATA_12);var i=this.ddata.getNbDatablocks(),o=e.length/n;if(o<i)throw new k;for(var a=e.length%n,s=new Int32Array(o),l=0;l<o;l++,a+=n)s[l]=r.readCode(e,a,n);try{var u=new Zr(t);u.decode(s,o-i)}catch(m){throw new k(m)}for(var c=(1<<n)-1,f=0,l=0;l<i;l++){var h=s[l];if(h===0||h===c)throw new k;(h===1||h===c-1)&&f++}for(var v=new Array(i*n-f),p=0,l=0;l<i;l++){var h=s[l];if(h===1||h===c-1)v.fill(h>1,p,p+n-1),p+=n-1;else for(var g=n-1;g>=0;--g)v[p++]=(h&1<<g)!==0}return v},r.prototype.extractBits=function(e){var t=this.ddata.isCompact(),n=this.ddata.getNbLayers(),i=(t?11:14)+n*4,o=new Int32Array(i),a=new Array(this.totalBitsInLayer(n,t));if(t)for(var s=0;s<o.length;s++)o[s]=s;else for(var l=i+1+2*Y.truncDivision(Y.truncDivision(i,2)-1,15),u=i/2,c=Y.truncDivision(l,2),s=0;s<u;s++){var f=s+Y.truncDivision(s,15);o[u-s-1]=c-f-1,o[u+s]=c+f+1}for(var s=0,h=0;s<n;s++){for(var v=(n-s)*4+(t?9:12),p=s*2,g=i-1-p,m=0;m<v;m++)for(var y=m*2,C=0;C<2;C++)a[h+y+C]=e.get(o[p+C],o[p+m]),a[h+2*v+y+C]=e.get(o[p+m],o[g-C]),a[h+4*v+y+C]=e.get(o[g-C],o[g-m]),a[h+6*v+y+C]=e.get(o[g-m],o[p+C]);h+=v*8}return a},r.readCode=function(e,t,n){for(var i=0,o=t;o<t+n;o++)i<<=1,e[o]&&(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"," ",`
|
|
49
49
|
`,"\\13","\f","\r","\\33","\\34","\\35","\\36","\\37","@","\\","^","_","`","|","~","\\177","CTRL_LL","CTRL_UL","CTRL_PL","CTRL_BS"],r.PUNCT_TABLE=["","\r",`\r
|
|
50
|
-
`,". ",", ",": ","!",'"',"#","$","%","&","'","(",")","*","+",",","-",".","/",":",";","<","=",">","?","[","]","{","}","CTRL_UL"],r.DIGIT_TABLE=["CTRL_PS"," ","0","1","2","3","4","5","6","7","8","9",",",".","CTRL_UL","CTRL_US"],r}(),Z=function(){function r(){}return r.round=function(e){return isNaN(e)?0:e<=Number.MIN_SAFE_INTEGER?Number.MIN_SAFE_INTEGER:e>=Number.MAX_SAFE_INTEGER?Number.MAX_SAFE_INTEGER:e+(e<0?-.5:.5)|0},r.distance=function(e,t,n,i){var a=e-n,o=t-i;return Math.sqrt(a*a+o*o)},r.sum=function(e){for(var t=0,n=0,i=e.length;n!==i;n++){var a=e[n];t+=a}return t},r}(),Bn=function(){function r(){}return r.floatToIntBits=function(e){return e},r.MAX_VALUE=Number.MAX_SAFE_INTEGER,r}(),k=function(){function r(e,t){this.x=e,this.y=t}return r.prototype.getX=function(){return this.x},r.prototype.getY=function(){return this.y},r.prototype.equals=function(e){if(e instanceof r){var t=e;return this.x===t.x&&this.y===t.y}return!1},r.prototype.hashCode=function(){return 31*Bn.floatToIntBits(this.x)+Bn.floatToIntBits(this.y)},r.prototype.toString=function(){return"("+this.x+","+this.y+")"},r.orderBestPatterns=function(e){var t=this.distance(e[0],e[1]),n=this.distance(e[1],e[2]),i=this.distance(e[0],e[2]),a,o,s;if(n>=t&&n>=i?(o=e[0],a=e[1],s=e[2]):i>=n&&i>=t?(o=e[1],a=e[0],s=e[2]):(o=e[2],a=e[0],s=e[1]),this.crossProductZ(a,o,s)<0){var f=a;a=s,s=f}e[0]=a,e[1]=o,e[2]=s},r.distance=function(e,t){return Z.distance(e.x,e.y,t.x,t.y)},r.crossProductZ=function(e,t,n){var i=t.x,a=t.y;return(n.x-i)*(e.y-a)-(n.y-a)*(e.x-i)},r}(),Ln=function(){function r(e,t){this.bits=e,this.points=t}return r.prototype.getBits=function(){return this.bits},r.prototype.getPoints=function(){return this.points},r}(),_u=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)}}(),Eu=function(r){_u(e,r);function e(t,n,i,a,o){var s=r.call(this,t,n)||this;return s.compact=i,s.nbDatablocks=a,s.nbLayers=o,s}return e.prototype.getNbLayers=function(){return this.nbLayers},e.prototype.getNbDatablocks=function(){return this.nbDatablocks},e.prototype.isCompact=function(){return this.compact},e}(Ln),kn=function(){function r(e,t,n,i){this.image=e,this.height=e.getHeight(),this.width=e.getWidth(),t==null&&(t=r.INIT_SIZE),n==null&&(n=e.getWidth()/2|0),i==null&&(i=e.getHeight()/2|0);var a=t/2|0;if(this.leftInit=n-a,this.rightInit=n+a,this.upInit=i-a,this.downInit=i+a,this.upInit<0||this.leftInit<0||this.downInit>=this.height||this.rightInit>=this.width)throw new N}return r.prototype.detect=function(){for(var e=this.leftInit,t=this.rightInit,n=this.upInit,i=this.downInit,a=!1,o=!0,s=!1,f=!1,u=!1,c=!1,l=!1,d=this.width,h=this.height;o;){o=!1;for(var v=!0;(v||!f)&&t<d;)v=this.containsBlackPoint(n,i,t,!1),v?(t++,o=!0,f=!0):f||t++;if(t>=d){a=!0;break}for(var p=!0;(p||!u)&&i<h;)p=this.containsBlackPoint(e,t,i,!0),p?(i++,o=!0,u=!0):u||i++;if(i>=h){a=!0;break}for(var x=!0;(x||!c)&&e>=0;)x=this.containsBlackPoint(n,i,e,!1),x?(e--,o=!0,c=!0):c||e--;if(e<0){a=!0;break}for(var m=!0;(m||!l)&&n>=0;)m=this.containsBlackPoint(e,t,n,!0),m?(n--,o=!0,l=!0):l||n--;if(n<0){a=!0;break}o&&(s=!0)}if(!a&&s){for(var w=t-e,C=null,A=1;C===null&&A<w;A++)C=this.getBlackPointOnSegment(e,i-A,e+A,i);if(C==null)throw new N;for(var _=null,A=1;_===null&&A<w;A++)_=this.getBlackPointOnSegment(e,n+A,e+A,n);if(_==null)throw new N;for(var b=null,A=1;b===null&&A<w;A++)b=this.getBlackPointOnSegment(t,n+A,t-A,n);if(b==null)throw new N;for(var T=null,A=1;T===null&&A<w;A++)T=this.getBlackPointOnSegment(t,i-A,t-A,i);if(T==null)throw new N;return this.centerEdges(T,C,b,_)}else throw new N},r.prototype.getBlackPointOnSegment=function(e,t,n,i){for(var a=Z.round(Z.distance(e,t,n,i)),o=(n-e)/a,s=(i-t)/a,f=this.image,u=0;u<a;u++){var c=Z.round(e+u*o),l=Z.round(t+u*s);if(f.get(c,l))return new k(c,l)}return null},r.prototype.centerEdges=function(e,t,n,i){var a=e.getX(),o=e.getY(),s=t.getX(),f=t.getY(),u=n.getX(),c=n.getY(),l=i.getX(),d=i.getY(),h=r.CORR;return a<this.width/2?[new k(l-h,d+h),new k(s+h,f+h),new k(u-h,c-h),new k(a+h,o-h)]:[new k(l+h,d+h),new k(s+h,f-h),new k(u-h,c+h),new k(a-h,o-h)]},r.prototype.containsBlackPoint=function(e,t,n,i){var a=this.image;if(i){for(var o=e;o<=t;o++)if(a.get(o,n))return!0}else for(var s=e;s<=t;s++)if(a.get(n,s))return!0;return!1},r.INIT_SIZE=10,r.CORR=1,r}(),ka=function(){function r(){}return r.checkAndNudgePoints=function(e,t){for(var n=e.getWidth(),i=e.getHeight(),a=!0,o=0;o<t.length&&a;o+=2){var s=Math.floor(t[o]),f=Math.floor(t[o+1]);if(s<-1||s>n||f<-1||f>i)throw new N;a=!1,s===-1?(t[o]=0,a=!0):s===n&&(t[o]=n-1,a=!0),f===-1?(t[o+1]=0,a=!0):f===i&&(t[o+1]=i-1,a=!0)}a=!0;for(var o=t.length-2;o>=0&&a;o-=2){var s=Math.floor(t[o]),f=Math.floor(t[o+1]);if(s<-1||s>n||f<-1||f>i)throw new N;a=!1,s===-1?(t[o]=0,a=!0):s===n&&(t[o]=n-1,a=!0),f===-1?(t[o+1]=0,a=!0):f===i&&(t[o+1]=i-1,a=!0)}},r}(),Ua=function(){function r(e,t,n,i,a,o,s,f,u){this.a11=e,this.a21=t,this.a31=n,this.a12=i,this.a22=a,this.a32=o,this.a13=s,this.a23=f,this.a33=u}return r.quadrilateralToQuadrilateral=function(e,t,n,i,a,o,s,f,u,c,l,d,h,v,p,x){var m=r.quadrilateralToSquare(e,t,n,i,a,o,s,f),w=r.squareToQuadrilateral(u,c,l,d,h,v,p,x);return w.times(m)},r.prototype.transformPoints=function(e){for(var t=e.length,n=this.a11,i=this.a12,a=this.a13,o=this.a21,s=this.a22,f=this.a23,u=this.a31,c=this.a32,l=this.a33,d=0;d<t;d+=2){var h=e[d],v=e[d+1],p=a*h+f*v+l;e[d]=(n*h+o*v+u)/p,e[d+1]=(i*h+s*v+c)/p}},r.prototype.transformPointsWithValues=function(e,t){for(var n=this.a11,i=this.a12,a=this.a13,o=this.a21,s=this.a22,f=this.a23,u=this.a31,c=this.a32,l=this.a33,d=e.length,h=0;h<d;h++){var v=e[h],p=t[h],x=a*v+f*p+l;e[h]=(n*v+o*p+u)/x,t[h]=(i*v+s*p+c)/x}},r.squareToQuadrilateral=function(e,t,n,i,a,o,s,f){var u=e-n+a-s,c=t-i+o-f;if(u===0&&c===0)return new r(n-e,a-n,e,i-t,o-i,t,0,0,1);var l=n-a,d=s-a,h=i-o,v=f-o,p=l*v-d*h,x=(u*v-d*c)/p,m=(l*c-u*h)/p;return new r(n-e+x*n,s-e+m*s,e,i-t+x*i,f-t+m*f,t,x,m,1)},r.quadrilateralToSquare=function(e,t,n,i,a,o,s,f){return r.squareToQuadrilateral(e,t,n,i,a,o,s,f).buildAdjoint()},r.prototype.buildAdjoint=function(){return new r(this.a22*this.a33-this.a23*this.a32,this.a23*this.a31-this.a21*this.a33,this.a21*this.a32-this.a22*this.a31,this.a13*this.a32-this.a12*this.a33,this.a11*this.a33-this.a13*this.a31,this.a12*this.a31-this.a11*this.a32,this.a12*this.a23-this.a13*this.a22,this.a13*this.a21-this.a11*this.a23,this.a11*this.a22-this.a12*this.a21)},r.prototype.times=function(e){return new r(this.a11*e.a11+this.a21*e.a12+this.a31*e.a13,this.a11*e.a21+this.a21*e.a22+this.a31*e.a23,this.a11*e.a31+this.a21*e.a32+this.a31*e.a33,this.a12*e.a11+this.a22*e.a12+this.a32*e.a13,this.a12*e.a21+this.a22*e.a22+this.a32*e.a23,this.a12*e.a31+this.a22*e.a32+this.a32*e.a33,this.a13*e.a11+this.a23*e.a12+this.a33*e.a13,this.a13*e.a21+this.a23*e.a22+this.a33*e.a23,this.a13*e.a31+this.a23*e.a32+this.a33*e.a33)},r}(),Iu=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)}}(),Su=function(r){Iu(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.sampleGrid=function(t,n,i,a,o,s,f,u,c,l,d,h,v,p,x,m,w,C,A){var _=Ua.quadrilateralToQuadrilateral(a,o,s,f,u,c,l,d,h,v,p,x,m,w,C,A);return this.sampleGridWithTransform(t,n,i,_)},e.prototype.sampleGridWithTransform=function(t,n,i,a){if(n<=0||i<=0)throw new N;for(var o=new qe(n,i),s=new Float32Array(2*n),f=0;f<i;f++){for(var u=s.length,c=f+.5,l=0;l<u;l+=2)s[l]=l/2+.5,s[l+1]=c;a.transformPoints(s),ka.checkAndNudgePoints(t,s);try{for(var l=0;l<u;l+=2)t.get(Math.floor(s[l]),Math.floor(s[l+1]))&&o.set(l/2,f)}catch{throw new N}}return o},e}(ka),Un=function(){function r(){}return r.setGridSampler=function(e){r.gridSampler=e},r.getInstance=function(){return r.gridSampler},r.gridSampler=new Su,r}(),Be=function(){function r(e,t){this.x=e,this.y=t}return r.prototype.toResultPoint=function(){return new k(this.getX(),this.getY())},r.prototype.getX=function(){return this.x},r.prototype.getY=function(){return this.y},r}(),bu=function(){function r(e){this.EXPECTED_CORNER_BITS=new Int32Array([3808,476,2107,1799]),this.image=e}return r.prototype.detect=function(){return this.detectMirror(!1)},r.prototype.detectMirror=function(e){var t=this.getMatrixCenter(),n=this.getBullsEyeCorners(t);if(e){var i=n[0];n[0]=n[2],n[2]=i}this.extractParameters(n);var a=this.sampleGrid(this.image,n[this.shift%4],n[(this.shift+1)%4],n[(this.shift+2)%4],n[(this.shift+3)%4]),o=this.getMatrixCornerPoints(n);return new Eu(a,o,this.compact,this.nbDataBlocks,this.nbLayers)},r.prototype.extractParameters=function(e){if(!this.isValidPoint(e[0])||!this.isValidPoint(e[1])||!this.isValidPoint(e[2])||!this.isValidPoint(e[3]))throw new N;var t=2*this.nbCenterLayers,n=new Int32Array([this.sampleLine(e[0],e[1],t),this.sampleLine(e[1],e[2],t),this.sampleLine(e[2],e[3],t),this.sampleLine(e[3],e[0],t)]);this.shift=this.getRotation(n,t);for(var i=0,a=0;a<4;a++){var o=n[(this.shift+a)%4];this.compact?(i<<=7,i+=o>>1&127):(i<<=10,i+=(o>>2&992)+(o>>1&31))}var s=this.getCorrectedParameterData(i,this.compact);this.compact?(this.nbLayers=(s>>6)+1,this.nbDataBlocks=(s&63)+1):(this.nbLayers=(s>>11)+1,this.nbDataBlocks=(s&2047)+1)},r.prototype.getRotation=function(e,t){var n=0;e.forEach(function(a,o,s){var f=(a>>t-2<<1)+(a&1);n=(n<<3)+f}),n=((n&1)<<11)+(n>>1);for(var i=0;i<4;i++)if(G.bitCount(n^this.EXPECTED_CORNER_BITS[i])<=2)return i;throw new N},r.prototype.getCorrectedParameterData=function(e,t){var n,i;t?(n=7,i=2):(n=10,i=4);for(var a=n-i,o=new Int32Array(n),s=n-1;s>=0;--s)o[s]=e&15,e>>=4;try{var f=new Fr(Re.AZTEC_PARAM);f.decode(o,a)}catch{throw new N}for(var u=0,s=0;s<i;s++)u=(u<<4)+o[s];return u},r.prototype.getBullsEyeCorners=function(e){var t=e,n=e,i=e,a=e,o=!0;for(this.nbCenterLayers=1;this.nbCenterLayers<9;this.nbCenterLayers++){var s=this.getFirstDifferent(t,o,1,-1),f=this.getFirstDifferent(n,o,1,1),u=this.getFirstDifferent(i,o,-1,1),c=this.getFirstDifferent(a,o,-1,-1);if(this.nbCenterLayers>2){var l=this.distancePoint(c,s)*this.nbCenterLayers/(this.distancePoint(a,t)*(this.nbCenterLayers+2));if(l<.75||l>1.25||!this.isWhiteOrBlackRectangle(s,f,u,c))break}t=s,n=f,i=u,a=c,o=!o}if(this.nbCenterLayers!==5&&this.nbCenterLayers!==7)throw new N;this.compact=this.nbCenterLayers===5;var d=new k(t.getX()+.5,t.getY()-.5),h=new k(n.getX()+.5,n.getY()+.5),v=new k(i.getX()-.5,i.getY()+.5),p=new k(a.getX()-.5,a.getY()-.5);return this.expandSquare([d,h,v,p],2*this.nbCenterLayers-3,2*this.nbCenterLayers)},r.prototype.getMatrixCenter=function(){var e,t,n,i;try{var a=new kn(this.image).detect();e=a[0],t=a[1],n=a[2],i=a[3]}catch{var o=this.image.getWidth()/2,s=this.image.getHeight()/2;e=this.getFirstDifferent(new Be(o+7,s-7),!1,1,-1).toResultPoint(),t=this.getFirstDifferent(new Be(o+7,s+7),!1,1,1).toResultPoint(),n=this.getFirstDifferent(new Be(o-7,s+7),!1,-1,1).toResultPoint(),i=this.getFirstDifferent(new Be(o-7,s-7),!1,-1,-1).toResultPoint()}var f=Z.round((e.getX()+i.getX()+t.getX()+n.getX())/4),u=Z.round((e.getY()+i.getY()+t.getY()+n.getY())/4);try{var a=new kn(this.image,15,f,u).detect();e=a[0],t=a[1],n=a[2],i=a[3]}catch{e=this.getFirstDifferent(new Be(f+7,u-7),!1,1,-1).toResultPoint(),t=this.getFirstDifferent(new Be(f+7,u+7),!1,1,1).toResultPoint(),n=this.getFirstDifferent(new Be(f-7,u+7),!1,-1,1).toResultPoint(),i=this.getFirstDifferent(new Be(f-7,u-7),!1,-1,-1).toResultPoint()}return f=Z.round((e.getX()+i.getX()+t.getX()+n.getX())/4),u=Z.round((e.getY()+i.getY()+t.getY()+n.getY())/4),new Be(f,u)},r.prototype.getMatrixCornerPoints=function(e){return this.expandSquare(e,2*this.nbCenterLayers,this.getDimension())},r.prototype.sampleGrid=function(e,t,n,i,a){var o=Un.getInstance(),s=this.getDimension(),f=s/2-this.nbCenterLayers,u=s/2+this.nbCenterLayers;return o.sampleGrid(e,s,s,f,f,u,f,u,u,f,u,t.getX(),t.getY(),n.getX(),n.getY(),i.getX(),i.getY(),a.getX(),a.getY())},r.prototype.sampleLine=function(e,t,n){for(var i=0,a=this.distanceResultPoint(e,t),o=a/n,s=e.getX(),f=e.getY(),u=o*(t.getX()-e.getX())/a,c=o*(t.getY()-e.getY())/a,l=0;l<n;l++)this.image.get(Z.round(s+l*u),Z.round(f+l*c))&&(i|=1<<n-l-1);return i},r.prototype.isWhiteOrBlackRectangle=function(e,t,n,i){var a=3;e=new Be(e.getX()-a,e.getY()+a),t=new Be(t.getX()-a,t.getY()-a),n=new Be(n.getX()+a,n.getY()-a),i=new Be(i.getX()+a,i.getY()+a);var o=this.getColor(i,e);if(o===0)return!1;var s=this.getColor(e,t);return s!==o||(s=this.getColor(t,n),s!==o)?!1:(s=this.getColor(n,i),s===o)},r.prototype.getColor=function(e,t){for(var n=this.distancePoint(e,t),i=(t.getX()-e.getX())/n,a=(t.getY()-e.getY())/n,o=0,s=e.getX(),f=e.getY(),u=this.image.get(e.getX(),e.getY()),c=Math.ceil(n),l=0;l<c;l++)s+=i,f+=a,this.image.get(Z.round(s),Z.round(f))!==u&&o++;var d=o/n;return d>.1&&d<.9?0:d<=.1===u?1:-1},r.prototype.getFirstDifferent=function(e,t,n,i){for(var a=e.getX()+n,o=e.getY()+i;this.isValid(a,o)&&this.image.get(a,o)===t;)a+=n,o+=i;for(a-=n,o-=i;this.isValid(a,o)&&this.image.get(a,o)===t;)a+=n;for(a-=n;this.isValid(a,o)&&this.image.get(a,o)===t;)o+=i;return o-=i,new Be(a,o)},r.prototype.expandSquare=function(e,t,n){var i=n/(2*t),a=e[0].getX()-e[2].getX(),o=e[0].getY()-e[2].getY(),s=(e[0].getX()+e[2].getX())/2,f=(e[0].getY()+e[2].getY())/2,u=new k(s+i*a,f+i*o),c=new k(s-i*a,f-i*o);a=e[1].getX()-e[3].getX(),o=e[1].getY()-e[3].getY(),s=(e[1].getX()+e[3].getX())/2,f=(e[1].getY()+e[3].getY())/2;var l=new k(s+i*a,f+i*o),d=new k(s-i*a,f-i*o),h=[u,l,c,d];return h},r.prototype.isValid=function(e,t){return e>=0&&e<this.image.getWidth()&&t>0&&t<this.image.getHeight()},r.prototype.isValidPoint=function(e){var t=Z.round(e.getX()),n=Z.round(e.getY());return this.isValid(t,n)},r.prototype.distancePoint=function(e,t){return Z.distance(e.getX(),e.getY(),t.getX(),t.getY())},r.prototype.distanceResultPoint=function(e,t){return Z.distance(e.getX(),e.getY(),t.getX(),t.getY())},r.prototype.getDimension=function(){return this.compact?4*this.nbLayers+11:this.nbLayers<=4?4*this.nbLayers+15:4*this.nbLayers+2*(G.truncDivision(this.nbLayers-4,8)+1)+15},r}(),Vn=function(){function r(){}return r.prototype.decode=function(e,t){t===void 0&&(t=null);var n=null,i=new bu(e.getBlackMatrix()),a=null,o=null;try{var s=i.detectMirror(!1);a=s.getPoints(),this.reportFoundResultPoints(t,a),o=new La().decode(s)}catch(l){n=l}if(o==null)try{var s=i.detectMirror(!0);a=s.getPoints(),this.reportFoundResultPoints(t,a),o=new La().decode(s)}catch(l){throw n??l}var f=new Se(o.getText(),o.getRawBytes(),o.getNumBits(),a,L.AZTEC,re.currentTimeMillis()),u=o.getByteSegments();u!=null&&f.putMetadata(Ce.BYTE_SEGMENTS,u);var c=o.getECLevel();return c!=null&&f.putMetadata(Ce.ERROR_CORRECTION_LEVEL,c),f},r.prototype.reportFoundResultPoints=function(e,t){if(e!=null){var n=e.get(oe.NEED_RESULT_POINT_CALLBACK);n!=null&&t.forEach(function(i,a,o){n.foundPossibleResultPoint(i)})}},r.prototype.reset=function(){},r}(),Tu=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)}}();(function(r){Tu(e,r);function e(t){return t===void 0&&(t=500),r.call(this,new Vn,t)||this}return e})(Dt);var ce=function(){function r(){}return r.prototype.decode=function(e,t){try{return this.doDecode(e,t)}catch{var n=t&&t.get(oe.TRY_HARDER)===!0;if(n&&e.isRotateSupported()){var i=e.rotateCounterClockwise(),a=this.doDecode(i,t),o=a.getResultMetadata(),s=270;o!==null&&o.get(Ce.ORIENTATION)===!0&&(s=s+o.get(Ce.ORIENTATION)%360),a.putMetadata(Ce.ORIENTATION,s);var f=a.getResultPoints();if(f!==null)for(var u=i.getHeight(),c=0;c<f.length;c++)f[c]=new k(u-f[c].getY()-1,f[c].getX());return a}else throw new N}},r.prototype.reset=function(){},r.prototype.doDecode=function(e,t){var n=e.getWidth(),i=e.getHeight(),a=new ge(n),o=t&&t.get(oe.TRY_HARDER)===!0,s=Math.max(1,i>>(o?8:5)),f;o?f=i:f=15;for(var u=Math.trunc(i/2),c=0;c<f;c++){var l=Math.trunc((c+1)/2),d=(c&1)===0,h=u+s*(d?l:-l);if(h<0||h>=i)break;try{a=e.getBlackRow(h,a)}catch{continue}for(var v=function(w){if(w===1&&(a.reverse(),t&&t.get(oe.NEED_RESULT_POINT_CALLBACK)===!0)){var C=new Map;t.forEach(function(b,T){return C.set(T,b)}),C.delete(oe.NEED_RESULT_POINT_CALLBACK),t=C}try{var A=p.decodeRow(h,a,t);if(w===1){A.putMetadata(Ce.ORIENTATION,180);var _=A.getResultPoints();_!==null&&(_[0]=new k(n-_[0].getX()-1,_[0].getY()),_[1]=new k(n-_[1].getX()-1,_[1].getY()))}return{value:A}}catch{}},p=this,x=0;x<2;x++){var m=v(x);if(typeof m=="object")return m.value}}throw new N},r.recordPattern=function(e,t,n){for(var i=n.length,a=0;a<i;a++)n[a]=0;var o=e.getSize();if(t>=o)throw new N;for(var s=!e.get(t),f=0,u=t;u<o;){if(e.get(u)!==s)n[f]++;else{if(++f===i)break;n[f]=1,s=!s}u++}if(!(f===i||f===i-1&&u===o))throw new N},r.recordPatternInReverse=function(e,t,n){for(var i=n.length,a=e.get(t);t>0&&i>=0;)e.get(--t)!==a&&(i--,a=!a);if(i>=0)throw new N;r.recordPattern(e,t+1,n)},r.patternMatchVariance=function(e,t,n){for(var i=e.length,a=0,o=0,s=0;s<i;s++)a+=e[s],o+=t[s];if(a<o)return Number.POSITIVE_INFINITY;var f=a/o;n*=f;for(var u=0,c=0;c<i;c++){var l=e[c],d=t[c]*f,h=l>d?l-d:d-l;if(h>n)return Number.POSITIVE_INFINITY;u+=h}return u/a},r}(),Ou=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)}}(),Va=function(r){Ou(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.findStartPattern=function(t){for(var n=t.getSize(),i=t.getNextSet(0),a=0,o=Int32Array.from([0,0,0,0,0,0]),s=i,f=!1,u=6,c=i;c<n;c++)if(t.get(c)!==f)o[a]++;else{if(a===u-1){for(var l=e.MAX_AVG_VARIANCE,d=-1,h=e.CODE_START_A;h<=e.CODE_START_C;h++){var v=ce.patternMatchVariance(o,e.CODE_PATTERNS[h],e.MAX_INDIVIDUAL_VARIANCE);v<l&&(l=v,d=h)}if(d>=0&&t.isRange(Math.max(0,s-(c-s)/2),s,!1))return Int32Array.from([s,c,d]);s+=o[0]+o[1],o=o.slice(2,o.length-1),o[a-1]=0,o[a]=0,a--}else a++;o[a]=1,f=!f}throw new N},e.decodeCode=function(t,n,i){ce.recordPattern(t,i,n);for(var a=e.MAX_AVG_VARIANCE,o=-1,s=0;s<e.CODE_PATTERNS.length;s++){var f=e.CODE_PATTERNS[s],u=this.patternMatchVariance(n,f,e.MAX_INDIVIDUAL_VARIANCE);u<a&&(a=u,o=s)}if(o>=0)return o;throw new N},e.prototype.decodeRow=function(t,n,i){var a=i&&i.get(oe.ASSUME_GS1)===!0,o=e.findStartPattern(n),s=o[2],f=0,u=new Uint8Array(20);u[f++]=s;var c;switch(s){case e.CODE_START_A:c=e.CODE_CODE_A;break;case e.CODE_START_B:c=e.CODE_CODE_B;break;case e.CODE_START_C:c=e.CODE_CODE_C;break;default:throw new R}for(var l=!1,d=!1,h="",v=o[0],p=o[1],x=Int32Array.from([0,0,0,0,0,0]),m=0,w=0,C=s,A=0,_=!0,b=!1,T=!1;!l;){var D=d;switch(d=!1,m=w,w=e.decodeCode(n,x,p),u[f++]=w,w!==e.CODE_STOP&&(_=!0),w!==e.CODE_STOP&&(A++,C+=A*w),v=p,p+=x.reduce(function(et,Ge){return et+Ge},0),w){case e.CODE_START_A:case e.CODE_START_B:case e.CODE_START_C:throw new R}switch(c){case e.CODE_CODE_A:if(w<64)T===b?h+=String.fromCharCode(32+w):h+=String.fromCharCode(32+w+128),T=!1;else if(w<96)T===b?h+=String.fromCharCode(w-64):h+=String.fromCharCode(w+64),T=!1;else switch(w!==e.CODE_STOP&&(_=!1),w){case e.CODE_FNC_1:a&&(h.length===0?h+="]C1":h+="");break;case e.CODE_FNC_2:case e.CODE_FNC_3:break;case e.CODE_FNC_4_A:!b&&T?(b=!0,T=!1):b&&T?(b=!1,T=!1):T=!0;break;case e.CODE_SHIFT:d=!0,c=e.CODE_CODE_B;break;case e.CODE_CODE_B:c=e.CODE_CODE_B;break;case e.CODE_CODE_C:c=e.CODE_CODE_C;break;case e.CODE_STOP:l=!0;break}break;case e.CODE_CODE_B:if(w<96)T===b?h+=String.fromCharCode(32+w):h+=String.fromCharCode(32+w+128),T=!1;else switch(w!==e.CODE_STOP&&(_=!1),w){case e.CODE_FNC_1:a&&(h.length===0?h+="]C1":h+="");break;case e.CODE_FNC_2:case e.CODE_FNC_3:break;case e.CODE_FNC_4_B:!b&&T?(b=!0,T=!1):b&&T?(b=!1,T=!1):T=!0;break;case e.CODE_SHIFT:d=!0,c=e.CODE_CODE_A;break;case e.CODE_CODE_A:c=e.CODE_CODE_A;break;case e.CODE_CODE_C:c=e.CODE_CODE_C;break;case e.CODE_STOP:l=!0;break}break;case e.CODE_CODE_C:if(w<100)w<10&&(h+="0"),h+=w;else switch(w!==e.CODE_STOP&&(_=!1),w){case e.CODE_FNC_1:a&&(h.length===0?h+="]C1":h+="");break;case e.CODE_CODE_A:c=e.CODE_CODE_A;break;case e.CODE_CODE_B:c=e.CODE_CODE_B;break;case e.CODE_STOP:l=!0;break}break}D&&(c=c===e.CODE_CODE_A?e.CODE_CODE_B:e.CODE_CODE_A)}var M=p-v;if(p=n.getNextUnset(p),!n.isRange(p,Math.min(n.getSize(),p+(p-v)/2),!1))throw new N;if(C-=A*m,C%103!==m)throw new pe;var B=h.length;if(B===0)throw new N;B>0&&_&&(c===e.CODE_CODE_C?h=h.substring(0,B-2):h=h.substring(0,B-1));for(var U=(o[1]+o[0])/2,H=v+M/2,W=u.length,se=new Uint8Array(W),j=0;j<W;j++)se[j]=u[j];var we=[new k(U,t),new k(H,t)];return new Se(h,se,0,we,L.CODE_128,new Date().getTime())},e.CODE_PATTERNS=[Int32Array.from([2,1,2,2,2,2]),Int32Array.from([2,2,2,1,2,2]),Int32Array.from([2,2,2,2,2,1]),Int32Array.from([1,2,1,2,2,3]),Int32Array.from([1,2,1,3,2,2]),Int32Array.from([1,3,1,2,2,2]),Int32Array.from([1,2,2,2,1,3]),Int32Array.from([1,2,2,3,1,2]),Int32Array.from([1,3,2,2,1,2]),Int32Array.from([2,2,1,2,1,3]),Int32Array.from([2,2,1,3,1,2]),Int32Array.from([2,3,1,2,1,2]),Int32Array.from([1,1,2,2,3,2]),Int32Array.from([1,2,2,1,3,2]),Int32Array.from([1,2,2,2,3,1]),Int32Array.from([1,1,3,2,2,2]),Int32Array.from([1,2,3,1,2,2]),Int32Array.from([1,2,3,2,2,1]),Int32Array.from([2,2,3,2,1,1]),Int32Array.from([2,2,1,1,3,2]),Int32Array.from([2,2,1,2,3,1]),Int32Array.from([2,1,3,2,1,2]),Int32Array.from([2,2,3,1,1,2]),Int32Array.from([3,1,2,1,3,1]),Int32Array.from([3,1,1,2,2,2]),Int32Array.from([3,2,1,1,2,2]),Int32Array.from([3,2,1,2,2,1]),Int32Array.from([3,1,2,2,1,2]),Int32Array.from([3,2,2,1,1,2]),Int32Array.from([3,2,2,2,1,1]),Int32Array.from([2,1,2,1,2,3]),Int32Array.from([2,1,2,3,2,1]),Int32Array.from([2,3,2,1,2,1]),Int32Array.from([1,1,1,3,2,3]),Int32Array.from([1,3,1,1,2,3]),Int32Array.from([1,3,1,3,2,1]),Int32Array.from([1,1,2,3,1,3]),Int32Array.from([1,3,2,1,1,3]),Int32Array.from([1,3,2,3,1,1]),Int32Array.from([2,1,1,3,1,3]),Int32Array.from([2,3,1,1,1,3]),Int32Array.from([2,3,1,3,1,1]),Int32Array.from([1,1,2,1,3,3]),Int32Array.from([1,1,2,3,3,1]),Int32Array.from([1,3,2,1,3,1]),Int32Array.from([1,1,3,1,2,3]),Int32Array.from([1,1,3,3,2,1]),Int32Array.from([1,3,3,1,2,1]),Int32Array.from([3,1,3,1,2,1]),Int32Array.from([2,1,1,3,3,1]),Int32Array.from([2,3,1,1,3,1]),Int32Array.from([2,1,3,1,1,3]),Int32Array.from([2,1,3,3,1,1]),Int32Array.from([2,1,3,1,3,1]),Int32Array.from([3,1,1,1,2,3]),Int32Array.from([3,1,1,3,2,1]),Int32Array.from([3,3,1,1,2,1]),Int32Array.from([3,1,2,1,1,3]),Int32Array.from([3,1,2,3,1,1]),Int32Array.from([3,3,2,1,1,1]),Int32Array.from([3,1,4,1,1,1]),Int32Array.from([2,2,1,4,1,1]),Int32Array.from([4,3,1,1,1,1]),Int32Array.from([1,1,1,2,2,4]),Int32Array.from([1,1,1,4,2,2]),Int32Array.from([1,2,1,1,2,4]),Int32Array.from([1,2,1,4,2,1]),Int32Array.from([1,4,1,1,2,2]),Int32Array.from([1,4,1,2,2,1]),Int32Array.from([1,1,2,2,1,4]),Int32Array.from([1,1,2,4,1,2]),Int32Array.from([1,2,2,1,1,4]),Int32Array.from([1,2,2,4,1,1]),Int32Array.from([1,4,2,1,1,2]),Int32Array.from([1,4,2,2,1,1]),Int32Array.from([2,4,1,2,1,1]),Int32Array.from([2,2,1,1,1,4]),Int32Array.from([4,1,3,1,1,1]),Int32Array.from([2,4,1,1,1,2]),Int32Array.from([1,3,4,1,1,1]),Int32Array.from([1,1,1,2,4,2]),Int32Array.from([1,2,1,1,4,2]),Int32Array.from([1,2,1,2,4,1]),Int32Array.from([1,1,4,2,1,2]),Int32Array.from([1,2,4,1,1,2]),Int32Array.from([1,2,4,2,1,1]),Int32Array.from([4,1,1,2,1,2]),Int32Array.from([4,2,1,1,1,2]),Int32Array.from([4,2,1,2,1,1]),Int32Array.from([2,1,2,1,4,1]),Int32Array.from([2,1,4,1,2,1]),Int32Array.from([4,1,2,1,2,1]),Int32Array.from([1,1,1,1,4,3]),Int32Array.from([1,1,1,3,4,1]),Int32Array.from([1,3,1,1,4,1]),Int32Array.from([1,1,4,1,1,3]),Int32Array.from([1,1,4,3,1,1]),Int32Array.from([4,1,1,1,1,3]),Int32Array.from([4,1,1,3,1,1]),Int32Array.from([1,1,3,1,4,1]),Int32Array.from([1,1,4,1,3,1]),Int32Array.from([3,1,1,1,4,1]),Int32Array.from([4,1,1,1,3,1]),Int32Array.from([2,1,1,4,1,2]),Int32Array.from([2,1,1,2,1,4]),Int32Array.from([2,1,1,2,3,2]),Int32Array.from([2,3,3,1,1,1,2])],e.MAX_AVG_VARIANCE=.25,e.MAX_INDIVIDUAL_VARIANCE=.7,e.CODE_SHIFT=98,e.CODE_CODE_C=99,e.CODE_CODE_B=100,e.CODE_CODE_A=101,e.CODE_FNC_1=102,e.CODE_FNC_2=97,e.CODE_FNC_3=96,e.CODE_FNC_4_A=101,e.CODE_FNC_4_B=100,e.CODE_START_A=103,e.CODE_START_B=104,e.CODE_START_C=105,e.CODE_STOP=106,e}(ce),Nu=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)}}(),Hn=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.")},Ha=function(r){Nu(e,r);function e(t,n){t===void 0&&(t=!1),n===void 0&&(n=!1);var i=r.call(this)||this;return i.usingCheckDigit=t,i.extendedMode=n,i.decodeRowResult="",i.counters=new Int32Array(9),i}return e.prototype.decodeRow=function(t,n,i){var a,o,s,f,u=this.counters;u.fill(0),this.decodeRowResult="";var c=e.findAsteriskPattern(n,u),l=n.getNextSet(c[1]),d=n.getSize(),h,v;do{e.recordPattern(n,l,u);var p=e.toNarrowWidePattern(u);if(p<0)throw new N;h=e.patternToChar(p),this.decodeRowResult+=h,v=l;try{for(var x=(a=void 0,Hn(u)),m=x.next();!m.done;m=x.next()){var w=m.value;l+=w}}catch(W){a={error:W}}finally{try{m&&!m.done&&(o=x.return)&&o.call(x)}finally{if(a)throw a.error}}l=n.getNextSet(l)}while(h!=="*");this.decodeRowResult=this.decodeRowResult.substring(0,this.decodeRowResult.length-1);var C=0;try{for(var A=Hn(u),_=A.next();!_.done;_=A.next()){var w=_.value;C+=w}}catch(W){s={error:W}}finally{try{_&&!_.done&&(f=A.return)&&f.call(A)}finally{if(s)throw s.error}}var b=l-v-C;if(l!==d&&b*2<C)throw new N;if(this.usingCheckDigit){for(var T=this.decodeRowResult.length-1,D=0,M=0;M<T;M++)D+=e.ALPHABET_STRING.indexOf(this.decodeRowResult.charAt(M));if(this.decodeRowResult.charAt(T)!==e.ALPHABET_STRING.charAt(D%43))throw new pe;this.decodeRowResult=this.decodeRowResult.substring(0,T)}if(this.decodeRowResult.length===0)throw new N;var B;this.extendedMode?B=e.decodeExtended(this.decodeRowResult):B=this.decodeRowResult;var U=(c[1]+c[0])/2,H=v+C/2;return new Se(B,null,0,[new k(U,t),new k(H,t)],L.CODE_39,new Date().getTime())},e.findAsteriskPattern=function(t,n){for(var i=t.getSize(),a=t.getNextSet(0),o=0,s=a,f=!1,u=n.length,c=a;c<i;c++)if(t.get(c)!==f)n[o]++;else{if(o===u-1){if(this.toNarrowWidePattern(n)===e.ASTERISK_ENCODING&&t.isRange(Math.max(0,s-Math.floor((c-s)/2)),s,!1))return[s,c];s+=n[0]+n[1],n.copyWithin(0,2,2+o-1),n[o-1]=0,n[o]=0,o--}else o++;n[o]=1,f=!f}throw new N},e.toNarrowWidePattern=function(t){var n,i,a=t.length,o=0,s;do{var f=2147483647;try{for(var u=(n=void 0,Hn(t)),c=u.next();!c.done;c=u.next()){var l=c.value;l<f&&l>o&&(f=l)}}catch(p){n={error:p}}finally{try{c&&!c.done&&(i=u.return)&&i.call(u)}finally{if(n)throw n.error}}o=f,s=0;for(var d=0,h=0,v=0;v<a;v++){var l=t[v];l>o&&(h|=1<<a-1-v,s++,d+=l)}if(s===3){for(var v=0;v<a&&s>0;v++){var l=t[v];if(l>o&&(s--,l*2>=d))return-1}return h}}while(s>3);return-1},e.patternToChar=function(t){for(var n=0;n<e.CHARACTER_ENCODINGS.length;n++)if(e.CHARACTER_ENCODINGS[n]===t)return e.ALPHABET_STRING.charAt(n);if(t===e.ASTERISK_ENCODING)return"*";throw new N},e.decodeExtended=function(t){for(var n=t.length,i="",a=0;a<n;a++){var o=t.charAt(a);if(o==="+"||o==="$"||o==="%"||o==="/"){var s=t.charAt(a+1),f="\0";switch(o){case"+":if(s>="A"&&s<="Z")f=String.fromCharCode(s.charCodeAt(0)+32);else throw new R;break;case"$":if(s>="A"&&s<="Z")f=String.fromCharCode(s.charCodeAt(0)-64);else throw new R;break;case"%":if(s>="A"&&s<="E")f=String.fromCharCode(s.charCodeAt(0)-38);else if(s>="F"&&s<="J")f=String.fromCharCode(s.charCodeAt(0)-11);else if(s>="K"&&s<="O")f=String.fromCharCode(s.charCodeAt(0)+16);else if(s>="P"&&s<="T")f=String.fromCharCode(s.charCodeAt(0)+43);else if(s==="U")f="\0";else if(s==="V")f="@";else if(s==="W")f="`";else if(s==="X"||s==="Y"||s==="Z")f="";else throw new R;break;case"/":if(s>="A"&&s<="O")f=String.fromCharCode(s.charCodeAt(0)-32);else if(s==="Z")f=":";else throw new R;break}i+=f,a++}else i+=o}return i},e.ALPHABET_STRING="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%",e.CHARACTER_ENCODINGS=[52,289,97,352,49,304,112,37,292,100,265,73,328,25,280,88,13,268,76,28,259,67,322,19,274,82,7,262,70,22,385,193,448,145,400,208,133,388,196,168,162,138,42],e.ASTERISK_ENCODING=148,e}(ce),Du=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)}}(),zn=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.")},za=function(r){Du(e,r);function e(){var t=r.call(this)||this;return t.decodeRowResult="",t.counters=new Int32Array(6),t}return e.prototype.decodeRow=function(t,n,i){var a,o,s,f,u=this.findAsteriskPattern(n),c=n.getNextSet(u[1]),l=n.getSize(),d=this.counters;d.fill(0),this.decodeRowResult="";var h,v;do{e.recordPattern(n,c,d);var p=this.toPattern(d);if(p<0)throw new N;h=this.patternToChar(p),this.decodeRowResult+=h,v=c;try{for(var x=(a=void 0,zn(d)),m=x.next();!m.done;m=x.next()){var w=m.value;c+=w}}catch(M){a={error:M}}finally{try{m&&!m.done&&(o=x.return)&&o.call(x)}finally{if(a)throw a.error}}c=n.getNextSet(c)}while(h!=="*");this.decodeRowResult=this.decodeRowResult.substring(0,this.decodeRowResult.length-1);var C=0;try{for(var A=zn(d),_=A.next();!_.done;_=A.next()){var w=_.value;C+=w}}catch(M){s={error:M}}finally{try{_&&!_.done&&(f=A.return)&&f.call(A)}finally{if(s)throw s.error}}if(c===l||!n.get(c))throw new N;if(this.decodeRowResult.length<2)throw new N;this.checkChecksums(this.decodeRowResult),this.decodeRowResult=this.decodeRowResult.substring(0,this.decodeRowResult.length-2);var b=this.decodeExtended(this.decodeRowResult),T=(u[1]+u[0])/2,D=v+C/2;return new Se(b,null,0,[new k(T,t),new k(D,t)],L.CODE_93,new Date().getTime())},e.prototype.findAsteriskPattern=function(t){var n=t.getSize(),i=t.getNextSet(0);this.counters.fill(0);for(var a=this.counters,o=i,s=!1,f=a.length,u=0,c=i;c<n;c++)if(t.get(c)!==s)a[u]++;else{if(u===f-1){if(this.toPattern(a)===e.ASTERISK_ENCODING)return new Int32Array([o,c]);o+=a[0]+a[1],a.copyWithin(0,2,2+u-1),a[u-1]=0,a[u]=0,u--}else u++;a[u]=1,s=!s}throw new N},e.prototype.toPattern=function(t){var n,i,a=0;try{for(var o=zn(t),s=o.next();!s.done;s=o.next()){var f=s.value;a+=f}}catch(v){n={error:v}}finally{try{s&&!s.done&&(i=o.return)&&i.call(o)}finally{if(n)throw n.error}}for(var u=0,c=t.length,l=0;l<c;l++){var d=Math.round(t[l]*9/a);if(d<1||d>4)return-1;if((l&1)===0)for(var h=0;h<d;h++)u=u<<1|1;else u<<=d}return u},e.prototype.patternToChar=function(t){for(var n=0;n<e.CHARACTER_ENCODINGS.length;n++)if(e.CHARACTER_ENCODINGS[n]===t)return e.ALPHABET_STRING.charAt(n);throw new N},e.prototype.decodeExtended=function(t){for(var n=t.length,i="",a=0;a<n;a++){var o=t.charAt(a);if(o>="a"&&o<="d"){if(a>=n-1)throw new R;var s=t.charAt(a+1),f="\0";switch(o){case"d":if(s>="A"&&s<="Z")f=String.fromCharCode(s.charCodeAt(0)+32);else throw new R;break;case"a":if(s>="A"&&s<="Z")f=String.fromCharCode(s.charCodeAt(0)-64);else throw new R;break;case"b":if(s>="A"&&s<="E")f=String.fromCharCode(s.charCodeAt(0)-38);else if(s>="F"&&s<="J")f=String.fromCharCode(s.charCodeAt(0)-11);else if(s>="K"&&s<="O")f=String.fromCharCode(s.charCodeAt(0)+16);else if(s>="P"&&s<="T")f=String.fromCharCode(s.charCodeAt(0)+43);else if(s==="U")f="\0";else if(s==="V")f="@";else if(s==="W")f="`";else if(s>="X"&&s<="Z")f="";else throw new R;break;case"c":if(s>="A"&&s<="O")f=String.fromCharCode(s.charCodeAt(0)-32);else if(s==="Z")f=":";else throw new R;break}i+=f,a++}else i+=o}return i},e.prototype.checkChecksums=function(t){var n=t.length;this.checkOneChecksum(t,n-2,20),this.checkOneChecksum(t,n-1,15)},e.prototype.checkOneChecksum=function(t,n,i){for(var a=1,o=0,s=n-1;s>=0;s--)o+=a*e.ALPHABET_STRING.indexOf(t.charAt(s)),++a>i&&(a=1);if(t.charAt(n)!==e.ALPHABET_STRING[o%47])throw new pe},e.ALPHABET_STRING="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%abcd*",e.CHARACTER_ENCODINGS=[276,328,324,322,296,292,290,336,274,266,424,420,418,404,402,394,360,356,354,308,282,344,332,326,300,278,436,434,428,422,406,410,364,358,310,314,302,468,466,458,366,374,430,294,474,470,306,350],e.ASTERISK_ENCODING=e.CHARACTER_ENCODINGS[47],e}(ce),Pu=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)}}(),Mu=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.")},Ga=function(r){Pu(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.narrowLineWidth=-1,t}return e.prototype.decodeRow=function(t,n,i){var a,o,s=this.decodeStart(n),f=this.decodeEnd(n),u=new z;e.decodeMiddle(n,s[1],f[0],u);var c=u.toString(),l=null;i!=null&&(l=i.get(oe.ALLOWED_LENGTHS)),l==null&&(l=e.DEFAULT_ALLOWED_LENGTHS);var d=c.length,h=!1,v=0;try{for(var p=Mu(l),x=p.next();!x.done;x=p.next()){var m=x.value;if(d===m){h=!0;break}m>v&&(v=m)}}catch(A){a={error:A}}finally{try{x&&!x.done&&(o=p.return)&&o.call(p)}finally{if(a)throw a.error}}if(!h&&d>v&&(h=!0),!h)throw new R;var w=[new k(s[1],t),new k(f[0],t)],C=new Se(c,null,0,w,L.ITF,new Date().getTime());return C},e.decodeMiddle=function(t,n,i,a){var o=new Int32Array(10),s=new Int32Array(5),f=new Int32Array(5);for(o.fill(0),s.fill(0),f.fill(0);n<i;){ce.recordPattern(t,n,o);for(var u=0;u<5;u++){var c=2*u;s[u]=o[c],f[u]=o[c+1]}var l=e.decodeDigit(s);a.append(l.toString()),l=this.decodeDigit(f),a.append(l.toString()),o.forEach(function(d){n+=d})}},e.prototype.decodeStart=function(t){var n=e.skipWhiteSpace(t),i=e.findGuardPattern(t,n,e.START_PATTERN);return this.narrowLineWidth=(i[1]-i[0])/4,this.validateQuietZone(t,i[0]),i},e.prototype.validateQuietZone=function(t,n){var i=this.narrowLineWidth*10;i=i<n?i:n;for(var a=n-1;i>0&&a>=0&&!t.get(a);a--)i--;if(i!==0)throw new N},e.skipWhiteSpace=function(t){var n=t.getSize(),i=t.getNextSet(0);if(i===n)throw new N;return i},e.prototype.decodeEnd=function(t){t.reverse();try{var n=e.skipWhiteSpace(t),i=void 0;try{i=e.findGuardPattern(t,n,e.END_PATTERN_REVERSED[0])}catch(o){o instanceof N&&(i=e.findGuardPattern(t,n,e.END_PATTERN_REVERSED[1]))}this.validateQuietZone(t,i[0]);var a=i[0];return i[0]=t.getSize()-i[1],i[1]=t.getSize()-a,i}finally{t.reverse()}},e.findGuardPattern=function(t,n,i){var a=i.length,o=new Int32Array(a),s=t.getSize(),f=!1,u=0,c=n;o.fill(0);for(var l=n;l<s;l++)if(t.get(l)!==f)o[u]++;else{if(u===a-1){if(ce.patternMatchVariance(o,i,e.MAX_INDIVIDUAL_VARIANCE)<e.MAX_AVG_VARIANCE)return[c,l];c+=o[0]+o[1],re.arraycopy(o,2,o,0,u-1),o[u-1]=0,o[u]=0,u--}else u++;o[u]=1,f=!f}throw new N},e.decodeDigit=function(t){for(var n=e.MAX_AVG_VARIANCE,i=-1,a=e.PATTERNS.length,o=0;o<a;o++){var s=e.PATTERNS[o],f=ce.patternMatchVariance(t,s,e.MAX_INDIVIDUAL_VARIANCE);f<n?(n=f,i=o):f===n&&(i=-1)}if(i>=0)return i%10;throw new N},e.PATTERNS=[Int32Array.from([1,1,2,2,1]),Int32Array.from([2,1,1,1,2]),Int32Array.from([1,2,1,1,2]),Int32Array.from([2,2,1,1,1]),Int32Array.from([1,1,2,1,2]),Int32Array.from([2,1,2,1,1]),Int32Array.from([1,2,2,1,1]),Int32Array.from([1,1,1,2,2]),Int32Array.from([2,1,1,2,1]),Int32Array.from([1,2,1,2,1]),Int32Array.from([1,1,3,3,1]),Int32Array.from([3,1,1,1,3]),Int32Array.from([1,3,1,1,3]),Int32Array.from([3,3,1,1,1]),Int32Array.from([1,1,3,1,3]),Int32Array.from([3,1,3,1,1]),Int32Array.from([1,3,3,1,1]),Int32Array.from([1,1,1,3,3]),Int32Array.from([3,1,1,3,1]),Int32Array.from([1,3,1,3,1])],e.MAX_AVG_VARIANCE=.38,e.MAX_INDIVIDUAL_VARIANCE=.5,e.DEFAULT_ALLOWED_LENGTHS=[6,8,10,12,14],e.START_PATTERN=Int32Array.from([1,1,1,1]),e.END_PATTERN_REVERSED=[Int32Array.from([1,1,2]),Int32Array.from([1,1,3])],e}(ce),Fu=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)}}(),Pt=function(r){Fu(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.decodeRowStringBuffer="",t}return e.findStartGuardPattern=function(t){for(var n=!1,i,a=0,o=Int32Array.from([0,0,0]);!n;){o=Int32Array.from([0,0,0]),i=e.findGuardPattern(t,a,!1,this.START_END_PATTERN,o);var s=i[0];a=i[1];var f=s-(a-s);f>=0&&(n=t.isRange(f,s,!1))}return i},e.checkChecksum=function(t){return e.checkStandardUPCEANChecksum(t)},e.checkStandardUPCEANChecksum=function(t){var n=t.length;if(n===0)return!1;var i=parseInt(t.charAt(n-1),10);return e.getStandardUPCEANChecksum(t.substring(0,n-1))===i},e.getStandardUPCEANChecksum=function(t){for(var n=t.length,i=0,a=n-1;a>=0;a-=2){var o=t.charAt(a).charCodeAt(0)-48;if(o<0||o>9)throw new R;i+=o}i*=3;for(var a=n-2;a>=0;a-=2){var o=t.charAt(a).charCodeAt(0)-48;if(o<0||o>9)throw new R;i+=o}return(1e3-i)%10},e.decodeEnd=function(t,n){return e.findGuardPattern(t,n,!1,e.START_END_PATTERN,new Int32Array(e.START_END_PATTERN.length).fill(0))},e.findGuardPatternWithoutCounters=function(t,n,i,a){return this.findGuardPattern(t,n,i,a,new Int32Array(a.length))},e.findGuardPattern=function(t,n,i,a,o){var s=t.getSize();n=i?t.getNextUnset(n):t.getNextSet(n);for(var f=0,u=n,c=a.length,l=i,d=n;d<s;d++)if(t.get(d)!==l)o[f]++;else{if(f===c-1){if(ce.patternMatchVariance(o,a,e.MAX_INDIVIDUAL_VARIANCE)<e.MAX_AVG_VARIANCE)return Int32Array.from([u,d]);u+=o[0]+o[1];for(var h=o.slice(2,o.length),v=0;v<f-1;v++)o[v]=h[v];o[f-1]=0,o[f]=0,f--}else f++;o[f]=1,l=!l}throw new N},e.decodeDigit=function(t,n,i,a){this.recordPattern(t,i,n);for(var o=this.MAX_AVG_VARIANCE,s=-1,f=a.length,u=0;u<f;u++){var c=a[u],l=ce.patternMatchVariance(n,c,e.MAX_INDIVIDUAL_VARIANCE);l<o&&(o=l,s=u)}if(s>=0)return s;throw new N},e.MAX_AVG_VARIANCE=.48,e.MAX_INDIVIDUAL_VARIANCE=.7,e.START_END_PATTERN=Int32Array.from([1,1,1]),e.MIDDLE_PATTERN=Int32Array.from([1,1,1,1,1]),e.END_PATTERN=Int32Array.from([1,1,1,1,1,1]),e.L_PATTERNS=[Int32Array.from([3,2,1,1]),Int32Array.from([2,2,2,1]),Int32Array.from([2,1,2,2]),Int32Array.from([1,4,1,1]),Int32Array.from([1,1,3,2]),Int32Array.from([1,2,3,1]),Int32Array.from([1,1,1,4]),Int32Array.from([1,3,1,2]),Int32Array.from([1,2,1,3]),Int32Array.from([3,1,1,2])],e}(ce),Ru=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.")},Bu=function(){function r(){this.CHECK_DIGIT_ENCODINGS=[24,20,18,17,12,6,3,10,9,5],this.decodeMiddleCounters=Int32Array.from([0,0,0,0]),this.decodeRowStringBuffer=""}return r.prototype.decodeRow=function(e,t,n){var i=this.decodeRowStringBuffer,a=this.decodeMiddle(t,n,i),o=i.toString(),s=r.parseExtensionString(o),f=[new k((n[0]+n[1])/2,e),new k(a,e)],u=new Se(o,null,0,f,L.UPC_EAN_EXTENSION,new Date().getTime());return s!=null&&u.putAllMetadata(s),u},r.prototype.decodeMiddle=function(e,t,n){var i,a,o=this.decodeMiddleCounters;o[0]=0,o[1]=0,o[2]=0,o[3]=0;for(var s=e.getSize(),f=t[1],u=0,c=0;c<5&&f<s;c++){var l=Pt.decodeDigit(e,o,f,Pt.L_AND_G_PATTERNS);n+=String.fromCharCode(48+l%10);try{for(var d=(i=void 0,Ru(o)),h=d.next();!h.done;h=d.next()){var v=h.value;f+=v}}catch(x){i={error:x}}finally{try{h&&!h.done&&(a=d.return)&&a.call(d)}finally{if(i)throw i.error}}l>=10&&(u|=1<<4-c),c!==4&&(f=e.getNextSet(f),f=e.getNextUnset(f))}if(n.length!==5)throw new N;var p=this.determineCheckDigit(u);if(r.extensionChecksum(n.toString())!==p)throw new N;return f},r.extensionChecksum=function(e){for(var t=e.length,n=0,i=t-2;i>=0;i-=2)n+=e.charAt(i).charCodeAt(0)-48;n*=3;for(var i=t-1;i>=0;i-=2)n+=e.charAt(i).charCodeAt(0)-48;return n*=3,n%10},r.prototype.determineCheckDigit=function(e){for(var t=0;t<10;t++)if(e===this.CHECK_DIGIT_ENCODINGS[t])return t;throw new N},r.parseExtensionString=function(e){if(e.length!==5)return null;var t=r.parseExtension5String(e);return t==null?null:new Map([[Ce.SUGGESTED_PRICE,t]])},r.parseExtension5String=function(e){var t;switch(e.charAt(0)){case"0":t="£";break;case"5":t="$";break;case"9":switch(e){case"90000":return null;case"99991":return"0.00";case"99990":return"Used"}t="";break;default:t="";break}var n=parseInt(e.substring(1)),i=(n/100).toString(),a=n%100,o=a<10?"0"+a:a.toString();return t+i+"."+o},r}(),Lu=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.")},ku=function(){function r(){this.decodeMiddleCounters=Int32Array.from([0,0,0,0]),this.decodeRowStringBuffer=""}return r.prototype.decodeRow=function(e,t,n){var i=this.decodeRowStringBuffer,a=this.decodeMiddle(t,n,i),o=i.toString(),s=r.parseExtensionString(o),f=[new k((n[0]+n[1])/2,e),new k(a,e)],u=new Se(o,null,0,f,L.UPC_EAN_EXTENSION,new Date().getTime());return s!=null&&u.putAllMetadata(s),u},r.prototype.decodeMiddle=function(e,t,n){var i,a,o=this.decodeMiddleCounters;o[0]=0,o[1]=0,o[2]=0,o[3]=0;for(var s=e.getSize(),f=t[1],u=0,c=0;c<2&&f<s;c++){var l=Pt.decodeDigit(e,o,f,Pt.L_AND_G_PATTERNS);n+=String.fromCharCode(48+l%10);try{for(var d=(i=void 0,Lu(o)),h=d.next();!h.done;h=d.next()){var v=h.value;f+=v}}catch(p){i={error:p}}finally{try{h&&!h.done&&(a=d.return)&&a.call(d)}finally{if(i)throw i.error}}l>=10&&(u|=1<<1-c),c!==1&&(f=e.getNextSet(f),f=e.getNextUnset(f))}if(n.length!==2)throw new N;if(parseInt(n.toString())%4!==u)throw new N;return f},r.parseExtensionString=function(e){return e.length!==2?null:new Map([[Ce.ISSUE_NUMBER,parseInt(e)]])},r}(),Uu=function(){function r(){}return r.decodeRow=function(e,t,n){var i=Pt.findGuardPattern(t,n,!1,this.EXTENSION_START_PATTERN,new Int32Array(this.EXTENSION_START_PATTERN.length).fill(0));try{var a=new Bu;return a.decodeRow(e,t,i)}catch{var o=new ku;return o.decodeRow(e,t,i)}},r.EXTENSION_START_PATTERN=Int32Array.from([1,1,2]),r}(),Vu=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)}}(),le=function(r){Vu(e,r);function e(){var t=r.call(this)||this;t.decodeRowStringBuffer="",e.L_AND_G_PATTERNS=e.L_PATTERNS.map(function(s){return Int32Array.from(s)});for(var n=10;n<20;n++){for(var i=e.L_PATTERNS[n-10],a=new Int32Array(i.length),o=0;o<i.length;o++)a[o]=i[i.length-o-1];e.L_AND_G_PATTERNS[n]=a}return t}return e.prototype.decodeRow=function(t,n,i){var a=e.findStartGuardPattern(n),o=i==null?null:i.get(oe.NEED_RESULT_POINT_CALLBACK);if(o!=null){var s=new k((a[0]+a[1])/2,t);o.foundPossibleResultPoint(s)}var f=this.decodeMiddle(n,a,this.decodeRowStringBuffer),u=f.rowOffset,c=f.resultString;if(o!=null){var l=new k(u,t);o.foundPossibleResultPoint(l)}var d=e.decodeEnd(n,u);if(o!=null){var h=new k((d[0]+d[1])/2,t);o.foundPossibleResultPoint(h)}var v=d[1],p=v+(v-d[0]);if(p>=n.getSize()||!n.isRange(v,p,!1))throw new N;var x=c.toString();if(x.length<8)throw new R;if(!e.checkChecksum(x))throw new pe;var m=(a[1]+a[0])/2,w=(d[1]+d[0])/2,C=this.getBarcodeFormat(),A=[new k(m,t),new k(w,t)],_=new Se(x,null,0,A,C,new Date().getTime()),b=0;try{var T=Uu.decodeRow(t,n,d[1]);_.putMetadata(Ce.UPC_EAN_EXTENSION,T.getText()),_.putAllMetadata(T.getResultMetadata()),_.addResultPoints(T.getResultPoints()),b=T.getText().length}catch{}var D=i==null?null:i.get(oe.ALLOWED_EAN_EXTENSIONS);if(D!=null){var M=!1;for(var B in D)if(b.toString()===B){M=!0;break}if(!M)throw new N}return C===L.EAN_13||L.UPC_A,_},e.checkChecksum=function(t){return e.checkStandardUPCEANChecksum(t)},e.checkStandardUPCEANChecksum=function(t){var n=t.length;if(n===0)return!1;var i=parseInt(t.charAt(n-1),10);return e.getStandardUPCEANChecksum(t.substring(0,n-1))===i},e.getStandardUPCEANChecksum=function(t){for(var n=t.length,i=0,a=n-1;a>=0;a-=2){var o=t.charAt(a).charCodeAt(0)-48;if(o<0||o>9)throw new R;i+=o}i*=3;for(var a=n-2;a>=0;a-=2){var o=t.charAt(a).charCodeAt(0)-48;if(o<0||o>9)throw new R;i+=o}return(1e3-i)%10},e.decodeEnd=function(t,n){return e.findGuardPattern(t,n,!1,e.START_END_PATTERN,new Int32Array(e.START_END_PATTERN.length).fill(0))},e}(Pt),Hu=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){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.")},Gn=function(r){Hu(e,r);function e(){var t=r.call(this)||this;return t.decodeMiddleCounters=Int32Array.from([0,0,0,0]),t}return e.prototype.decodeMiddle=function(t,n,i){var a,o,s,f,u=this.decodeMiddleCounters;u[0]=0,u[1]=0,u[2]=0,u[3]=0;for(var c=t.getSize(),l=n[1],d=0,h=0;h<6&&l<c;h++){var v=le.decodeDigit(t,u,l,le.L_AND_G_PATTERNS);i+=String.fromCharCode(48+v%10);try{for(var p=(a=void 0,Wa(u)),x=p.next();!x.done;x=p.next()){var m=x.value;l+=m}}catch(_){a={error:_}}finally{try{x&&!x.done&&(o=p.return)&&o.call(p)}finally{if(a)throw a.error}}v>=10&&(d|=1<<5-h)}i=e.determineFirstDigit(i,d);var w=le.findGuardPattern(t,l,!0,le.MIDDLE_PATTERN,new Int32Array(le.MIDDLE_PATTERN.length).fill(0));l=w[1];for(var h=0;h<6&&l<c;h++){var v=le.decodeDigit(t,u,l,le.L_PATTERNS);i+=String.fromCharCode(48+v);try{for(var C=(s=void 0,Wa(u)),A=C.next();!A.done;A=C.next()){var m=A.value;l+=m}}catch(T){s={error:T}}finally{try{A&&!A.done&&(f=C.return)&&f.call(C)}finally{if(s)throw s.error}}}return{rowOffset:l,resultString:i}},e.prototype.getBarcodeFormat=function(){return L.EAN_13},e.determineFirstDigit=function(t,n){for(var i=0;i<10;i++)if(n===this.FIRST_DIGIT_ENCODINGS[i])return t=String.fromCharCode(48+i)+t,t;throw new N},e.FIRST_DIGIT_ENCODINGS=[0,11,13,14,19,25,28,21,22,26],e}(le),zu=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)}}(),Xa=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.")},$a=function(r){zu(e,r);function e(){var t=r.call(this)||this;return t.decodeMiddleCounters=Int32Array.from([0,0,0,0]),t}return e.prototype.decodeMiddle=function(t,n,i){var a,o,s,f,u=this.decodeMiddleCounters;u[0]=0,u[1]=0,u[2]=0,u[3]=0;for(var c=t.getSize(),l=n[1],d=0;d<4&&l<c;d++){var h=le.decodeDigit(t,u,l,le.L_PATTERNS);i+=String.fromCharCode(48+h);try{for(var v=(a=void 0,Xa(u)),p=v.next();!p.done;p=v.next()){var x=p.value;l+=x}}catch(A){a={error:A}}finally{try{p&&!p.done&&(o=v.return)&&o.call(v)}finally{if(a)throw a.error}}}var m=le.findGuardPattern(t,l,!0,le.MIDDLE_PATTERN,new Int32Array(le.MIDDLE_PATTERN.length).fill(0));l=m[1];for(var d=0;d<4&&l<c;d++){var h=le.decodeDigit(t,u,l,le.L_PATTERNS);i+=String.fromCharCode(48+h);try{for(var w=(s=void 0,Xa(u)),C=w.next();!C.done;C=w.next()){var x=C.value;l+=x}}catch(b){s={error:b}}finally{try{C&&!C.done&&(f=w.return)&&f.call(w)}finally{if(s)throw s.error}}}return{rowOffset:l,resultString:i}},e.prototype.getBarcodeFormat=function(){return L.EAN_8},e}(le),Gu=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)}}(),ja=function(r){Gu(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.ean13Reader=new Gn,t}return e.prototype.getBarcodeFormat=function(){return L.UPC_A},e.prototype.decode=function(t,n){return this.maybeReturnResult(this.ean13Reader.decode(t))},e.prototype.decodeRow=function(t,n,i){return this.maybeReturnResult(this.ean13Reader.decodeRow(t,n,i))},e.prototype.decodeMiddle=function(t,n,i){return this.ean13Reader.decodeMiddle(t,n,i)},e.prototype.maybeReturnResult=function(t){var n=t.getText();if(n.charAt(0)==="0"){var i=new Se(n.substring(1),null,null,t.getResultPoints(),L.UPC_A);return t.getResultMetadata()!=null&&i.putAllMetadata(t.getResultMetadata()),i}else throw new N},e.prototype.reset=function(){this.ean13Reader.reset()},e}(le),Wu=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)}}(),Xu=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.")},Ya=function(r){Wu(e,r);function e(){var t=r.call(this)||this;return t.decodeMiddleCounters=new Int32Array(4),t}return e.prototype.decodeMiddle=function(t,n,i){var a,o,s=this.decodeMiddleCounters.map(function(x){return x});s[0]=0,s[1]=0,s[2]=0,s[3]=0;for(var f=t.getSize(),u=n[1],c=0,l=0;l<6&&u<f;l++){var d=e.decodeDigit(t,s,u,e.L_AND_G_PATTERNS);i+=String.fromCharCode(48+d%10);try{for(var h=(a=void 0,Xu(s)),v=h.next();!v.done;v=h.next()){var p=v.value;u+=p}}catch(x){a={error:x}}finally{try{v&&!v.done&&(o=h.return)&&o.call(h)}finally{if(a)throw a.error}}d>=10&&(c|=1<<5-l)}return e.determineNumSysAndCheckDigit(new z(i),c),u},e.prototype.decodeEnd=function(t,n){return e.findGuardPatternWithoutCounters(t,n,!0,e.MIDDLE_END_PATTERN)},e.prototype.checkChecksum=function(t){return le.checkChecksum(e.convertUPCEtoUPCA(t))},e.determineNumSysAndCheckDigit=function(t,n){for(var i=0;i<=1;i++)for(var a=0;a<10;a++)if(n===this.NUMSYS_AND_CHECK_DIGIT_PATTERNS[i][a]){t.insert(0,"0"+i),t.append("0"+a);return}throw N.getNotFoundInstance()},e.prototype.getBarcodeFormat=function(){return L.UPC_E},e.convertUPCEtoUPCA=function(t){var n=t.slice(1,7).split("").map(function(o){return o.charCodeAt(0)}),i=new z;i.append(t.charAt(0));var a=n[5];switch(a){case 0:case 1:case 2:i.appendChars(n,0,2),i.append(a),i.append("0000"),i.appendChars(n,2,3);break;case 3:i.appendChars(n,0,3),i.append("00000"),i.appendChars(n,3,2);break;case 4:i.appendChars(n,0,4),i.append("00000"),i.append(n[4]);break;default:i.appendChars(n,0,5),i.append("0000"),i.append(a);break}return t.length>=8&&i.append(t.charAt(7)),i.toString()},e.MIDDLE_END_PATTERN=Int32Array.from([1,1,1,1,1,1]),e.NUMSYS_AND_CHECK_DIGIT_PATTERNS=[Int32Array.from([56,52,50,49,44,38,35,42,41,37]),Int32Array.from([7,11,13,14,19,25,28,21,22,1])],e}(le),$u=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)}}(),Za=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.")},Wn=function(r){$u(e,r);function e(t){var n=r.call(this)||this,i=t==null?null:t.get(oe.POSSIBLE_FORMATS),a=[];return i!=null&&(i.indexOf(L.EAN_13)>-1&&a.push(new Gn),i.indexOf(L.UPC_A)>-1&&a.push(new ja),i.indexOf(L.EAN_8)>-1&&a.push(new $a),i.indexOf(L.UPC_E)>-1&&a.push(new Ya)),a.length===0&&(a.push(new Gn),a.push(new ja),a.push(new $a),a.push(new Ya)),n.readers=a,n}return e.prototype.decodeRow=function(t,n,i){var a,o;try{for(var s=Za(this.readers),f=s.next();!f.done;f=s.next()){var u=f.value;try{var c=u.decodeRow(t,n,i),l=c.getBarcodeFormat()===L.EAN_13&&c.getText().charAt(0)==="0",d=i==null?null:i.get(oe.POSSIBLE_FORMATS),h=d==null||d.includes(L.UPC_A);if(l&&h){var v=c.getRawBytes(),p=new Se(c.getText().substring(1),v,v?v.length:null,c.getResultPoints(),L.UPC_A);return p.putAllMetadata(c.getResultMetadata()),p}return c}catch{}}}catch(x){a={error:x}}finally{try{f&&!f.done&&(o=s.return)&&o.call(s)}finally{if(a)throw a.error}}throw new N},e.prototype.reset=function(){var t,n;try{for(var i=Za(this.readers),a=i.next();!a.done;a=i.next()){var o=a.value;o.reset()}}catch(s){t={error:s}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}},e}(ce),ju=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)}}(),Yu=function(r){ju(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.CODA_BAR_CHAR_SET={nnnnnww:"0",nnnnwwn:"1",nnnwnnw:"2",wwnnnnn:"3",nnwnnwn:"4",wnnnnwn:"5",nwnnnnw:"6",nwnnwnn:"7",nwwnnnn:"8",wnnwnnn:"9",nnnwwnn:"-",nnwwnnn:"$",wnnnwnw:":",wnwnnnw:"/",wnwnwnn:".",nnwwwww:"+",nnwwnwn:"A",nwnwnnw:"B",nnnwnww:"C",nnnwwwn:"D"},t}return e.prototype.decodeRow=function(t,n,i){var a=this.getValidRowData(n);if(!a)throw new N;var o=this.codaBarDecodeRow(a.row);if(!o)throw new N;return new Se(o,null,0,[new k(a.left,t),new k(a.right,t)],L.CODABAR,new Date().getTime())},e.prototype.getValidRowData=function(t){var n=t.toArray(),i=n.indexOf(!0);if(i===-1)return null;var a=n.lastIndexOf(!0);if(a<=i)return null;n=n.slice(i,a+1);for(var o=[],s=n[0],f=1,u=1;u<n.length;u++)n[u]===s?f++:(s=n[u],o.push(f),f=1);return o.push(f),o.length<23&&(o.length+1)%8!==0?null:{row:o,left:i,right:a}},e.prototype.codaBarDecodeRow=function(t){for(var n=[],i=Math.ceil(t.reduce(function(f,u){return(f+u)/2},0));t.length>0;){var a=t.splice(0,8).splice(0,7),o=a.map(function(f){return f<i?"n":"w"}).join("");if(this.CODA_BAR_CHAR_SET[o]===void 0)return null;n.push(this.CODA_BAR_CHAR_SET[o])}var s=n.join("");return this.validCodaBarString(s)?s:null},e.prototype.validCodaBarString=function(t){var n=/^[A-D].{1,}[A-D]$/;return n.test(t)},e}(ce),Zu=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)}}(),Ku=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.")},gt=function(r){Zu(e,r);function e(){var t=r.call(this)||this;return t.decodeFinderCounters=new Int32Array(4),t.dataCharacterCounters=new Int32Array(8),t.oddRoundingErrors=new Array(4),t.evenRoundingErrors=new Array(4),t.oddCounts=new Array(t.dataCharacterCounters.length/2),t.evenCounts=new Array(t.dataCharacterCounters.length/2),t}return e.prototype.getDecodeFinderCounters=function(){return this.decodeFinderCounters},e.prototype.getDataCharacterCounters=function(){return this.dataCharacterCounters},e.prototype.getOddRoundingErrors=function(){return this.oddRoundingErrors},e.prototype.getEvenRoundingErrors=function(){return this.evenRoundingErrors},e.prototype.getOddCounts=function(){return this.oddCounts},e.prototype.getEvenCounts=function(){return this.evenCounts},e.prototype.parseFinderValue=function(t,n){for(var i=0;i<n.length;i++)if(ce.patternMatchVariance(t,n[i],e.MAX_INDIVIDUAL_VARIANCE)<e.MAX_AVG_VARIANCE)return i;throw new N},e.count=function(t){return Z.sum(new Int32Array(t))},e.increment=function(t,n){for(var i=0,a=n[0],o=1;o<t.length;o++)n[o]>a&&(a=n[o],i=o);t[i]++},e.decrement=function(t,n){for(var i=0,a=n[0],o=1;o<t.length;o++)n[o]<a&&(a=n[o],i=o);t[i]--},e.isFinderPattern=function(t){var n,i,a=t[0]+t[1],o=a+t[2]+t[3],s=a/o;if(s>=e.MIN_FINDER_PATTERN_RATIO&&s<=e.MAX_FINDER_PATTERN_RATIO){var f=Number.MAX_SAFE_INTEGER,u=Number.MIN_SAFE_INTEGER;try{for(var c=Ku(t),l=c.next();!l.done;l=c.next()){var d=l.value;d>u&&(u=d),d<f&&(f=d)}}catch(h){n={error:h}}finally{try{l&&!l.done&&(i=c.return)&&i.call(c)}finally{if(n)throw n.error}}return u<10*f}return!1},e.MAX_AVG_VARIANCE=.2,e.MAX_INDIVIDUAL_VARIANCE=.45,e.MIN_FINDER_PATTERN_RATIO=9.5/12,e.MAX_FINDER_PATTERN_RATIO=12.5/14,e}(ce),Rr=function(){function r(e,t){this.value=e,this.checksumPortion=t}return r.prototype.getValue=function(){return this.value},r.prototype.getChecksumPortion=function(){return this.checksumPortion},r.prototype.toString=function(){return this.value+"("+this.checksumPortion+")"},r.prototype.equals=function(e){if(!(e instanceof r))return!1;var t=e;return this.value===t.value&&this.checksumPortion===t.checksumPortion},r.prototype.hashCode=function(){return this.value^this.checksumPortion},r}(),Ka=function(){function r(e,t,n,i,a){this.value=e,this.startEnd=t,this.value=e,this.startEnd=t,this.resultPoints=new Array,this.resultPoints.push(new k(n,a)),this.resultPoints.push(new k(i,a))}return r.prototype.getValue=function(){return this.value},r.prototype.getStartEnd=function(){return this.startEnd},r.prototype.getResultPoints=function(){return this.resultPoints},r.prototype.equals=function(e){if(!(e instanceof r))return!1;var t=e;return this.value===t.value},r.prototype.hashCode=function(){return this.value},r}(),qu=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.")},Mt=function(){function r(){}return r.getRSSvalue=function(e,t,n){var i,a,o=0;try{for(var s=qu(e),f=s.next();!f.done;f=s.next()){var u=f.value;o+=u}}catch(w){i={error:w}}finally{try{f&&!f.done&&(a=s.return)&&a.call(s)}finally{if(i)throw i.error}}for(var c=0,l=0,d=e.length,h=0;h<d-1;h++){var v=void 0;for(v=1,l|=1<<h;v<e[h];v++,l&=~(1<<h)){var p=r.combins(o-v-1,d-h-2);if(n&&l===0&&o-v-(d-h-1)>=d-h-1&&(p-=r.combins(o-v-(d-h),d-h-2)),d-h-1>1){for(var x=0,m=o-v-(d-h-2);m>t;m--)x+=r.combins(o-v-m-1,d-h-3);p-=x*(d-1-h)}else o-v>t&&p--;c+=p}o-=v}return c},r.combins=function(e,t){var n,i;e-t>t?(i=t,n=e-t):(i=e-t,n=t);for(var a=1,o=1,s=e;s>n;s--)a*=s,o<=i&&(a/=o,o++);for(;o<=i;)a/=o,o++;return a},r}(),Qu=function(){function r(){}return r.buildBitArray=function(e){var t=e.length*2-1;e[e.length-1].getRightChar()==null&&(t-=1);for(var n=12*t,i=new ge(n),a=0,o=e[0],s=o.getRightChar().getValue(),f=11;f>=0;--f)(s&1<<f)!==0&&i.set(a),a++;for(var f=1;f<e.length;++f){for(var u=e[f],c=u.getLeftChar().getValue(),l=11;l>=0;--l)(c&1<<l)!==0&&i.set(a),a++;if(u.getRightChar()!==null)for(var d=u.getRightChar().getValue(),l=11;l>=0;--l)(d&1<<l)!==0&&i.set(a),a++}return i},r}(),xt=function(){function r(e,t){t?this.decodedInformation=null:(this.finished=e,this.decodedInformation=t)}return r.prototype.getDecodedInformation=function(){return this.decodedInformation},r.prototype.isFinished=function(){return this.finished},r}(),Xn=function(){function r(e){this.newPosition=e}return r.prototype.getNewPosition=function(){return this.newPosition},r}(),Ju=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)}}(),$e=function(r){Ju(e,r);function e(t,n){var i=r.call(this,t)||this;return i.value=n,i}return e.prototype.getValue=function(){return this.value},e.prototype.isFNC1=function(){return this.value===e.FNC1},e.FNC1="$",e}(Xn),ec=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)}}(),yt=function(r){ec(e,r);function e(t,n,i){var a=r.call(this,t)||this;return i?(a.remaining=!0,a.remainingValue=a.remainingValue):(a.remaining=!1,a.remainingValue=0),a.newString=n,a}return e.prototype.getNewString=function(){return this.newString},e.prototype.isRemaining=function(){return this.remaining},e.prototype.getRemainingValue=function(){return this.remainingValue},e}(Xn),tc=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)}}(),Ft=function(r){tc(e,r);function e(t,n,i){var a=r.call(this,t)||this;if(n<0||n>10||i<0||i>10)throw new R;return a.firstDigit=n,a.secondDigit=i,a}return e.prototype.getFirstDigit=function(){return this.firstDigit},e.prototype.getSecondDigit=function(){return this.secondDigit},e.prototype.getValue=function(){return this.firstDigit*10+this.secondDigit},e.prototype.isFirstDigitFNC1=function(){return this.firstDigit===e.FNC1},e.prototype.isSecondDigitFNC1=function(){return this.secondDigit===e.FNC1},e.prototype.isAnyFNC1=function(){return this.firstDigit===e.FNC1||this.secondDigit===e.FNC1},e.FNC1=10,e}(Xn),Br=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.")},rc=function(){function r(){}return r.parseFieldsInGeneralPurpose=function(e){var t,n,i,a,o,s,f,u;if(!e)return null;if(e.length<2)throw new N;var c=e.substring(0,2);try{for(var l=Br(r.TWO_DIGIT_DATA_LENGTH),d=l.next();!d.done;d=l.next()){var h=d.value;if(h[0]===c)return h[1]===r.VARIABLE_LENGTH?r.processVariableAI(2,h[2],e):r.processFixedAI(2,h[1],e)}}catch(b){t={error:b}}finally{try{d&&!d.done&&(n=l.return)&&n.call(l)}finally{if(t)throw t.error}}if(e.length<3)throw new N;var v=e.substring(0,3);try{for(var p=Br(r.THREE_DIGIT_DATA_LENGTH),x=p.next();!x.done;x=p.next()){var h=x.value;if(h[0]===v)return h[1]===r.VARIABLE_LENGTH?r.processVariableAI(3,h[2],e):r.processFixedAI(3,h[1],e)}}catch(b){i={error:b}}finally{try{x&&!x.done&&(a=p.return)&&a.call(p)}finally{if(i)throw i.error}}try{for(var m=Br(r.THREE_DIGIT_PLUS_DIGIT_DATA_LENGTH),w=m.next();!w.done;w=m.next()){var h=w.value;if(h[0]===v)return h[1]===r.VARIABLE_LENGTH?r.processVariableAI(4,h[2],e):r.processFixedAI(4,h[1],e)}}catch(b){o={error:b}}finally{try{w&&!w.done&&(s=m.return)&&s.call(m)}finally{if(o)throw o.error}}if(e.length<4)throw new N;var C=e.substring(0,4);try{for(var A=Br(r.FOUR_DIGIT_DATA_LENGTH),_=A.next();!_.done;_=A.next()){var h=_.value;if(h[0]===C)return h[1]===r.VARIABLE_LENGTH?r.processVariableAI(4,h[2],e):r.processFixedAI(4,h[1],e)}}catch(b){f={error:b}}finally{try{_&&!_.done&&(u=A.return)&&u.call(A)}finally{if(f)throw f.error}}throw new N},r.processFixedAI=function(e,t,n){if(n.length<e)throw new N;var i=n.substring(0,e);if(n.length<e+t)throw new N;var a=n.substring(e,e+t),o=n.substring(e+t),s="("+i+")"+a,f=r.parseFieldsInGeneralPurpose(o);return f==null?s:s+f},r.processVariableAI=function(e,t,n){var i=n.substring(0,e),a;n.length<e+t?a=n.length:a=e+t;var o=n.substring(e,a),s=n.substring(a),f="("+i+")"+o,u=r.parseFieldsInGeneralPurpose(s);return u==null?f:f+u},r.VARIABLE_LENGTH=[],r.TWO_DIGIT_DATA_LENGTH=[["00",18],["01",14],["02",14],["10",r.VARIABLE_LENGTH,20],["11",6],["12",6],["13",6],["15",6],["17",6],["20",2],["21",r.VARIABLE_LENGTH,20],["22",r.VARIABLE_LENGTH,29],["30",r.VARIABLE_LENGTH,8],["37",r.VARIABLE_LENGTH,8],["90",r.VARIABLE_LENGTH,30],["91",r.VARIABLE_LENGTH,30],["92",r.VARIABLE_LENGTH,30],["93",r.VARIABLE_LENGTH,30],["94",r.VARIABLE_LENGTH,30],["95",r.VARIABLE_LENGTH,30],["96",r.VARIABLE_LENGTH,30],["97",r.VARIABLE_LENGTH,3],["98",r.VARIABLE_LENGTH,30],["99",r.VARIABLE_LENGTH,30]],r.THREE_DIGIT_DATA_LENGTH=[["240",r.VARIABLE_LENGTH,30],["241",r.VARIABLE_LENGTH,30],["242",r.VARIABLE_LENGTH,6],["250",r.VARIABLE_LENGTH,30],["251",r.VARIABLE_LENGTH,30],["253",r.VARIABLE_LENGTH,17],["254",r.VARIABLE_LENGTH,20],["400",r.VARIABLE_LENGTH,30],["401",r.VARIABLE_LENGTH,30],["402",17],["403",r.VARIABLE_LENGTH,30],["410",13],["411",13],["412",13],["413",13],["414",13],["420",r.VARIABLE_LENGTH,20],["421",r.VARIABLE_LENGTH,15],["422",3],["423",r.VARIABLE_LENGTH,15],["424",3],["425",3],["426",3]],r.THREE_DIGIT_PLUS_DIGIT_DATA_LENGTH=[["310",6],["311",6],["312",6],["313",6],["314",6],["315",6],["316",6],["320",6],["321",6],["322",6],["323",6],["324",6],["325",6],["326",6],["327",6],["328",6],["329",6],["330",6],["331",6],["332",6],["333",6],["334",6],["335",6],["336",6],["340",6],["341",6],["342",6],["343",6],["344",6],["345",6],["346",6],["347",6],["348",6],["349",6],["350",6],["351",6],["352",6],["353",6],["354",6],["355",6],["356",6],["357",6],["360",6],["361",6],["362",6],["363",6],["364",6],["365",6],["366",6],["367",6],["368",6],["369",6],["390",r.VARIABLE_LENGTH,15],["391",r.VARIABLE_LENGTH,18],["392",r.VARIABLE_LENGTH,15],["393",r.VARIABLE_LENGTH,18],["703",r.VARIABLE_LENGTH,30]],r.FOUR_DIGIT_DATA_LENGTH=[["7001",13],["7002",r.VARIABLE_LENGTH,30],["7003",10],["8001",14],["8002",r.VARIABLE_LENGTH,20],["8003",r.VARIABLE_LENGTH,30],["8004",r.VARIABLE_LENGTH,30],["8005",6],["8006",18],["8007",r.VARIABLE_LENGTH,30],["8008",r.VARIABLE_LENGTH,12],["8018",18],["8020",r.VARIABLE_LENGTH,25],["8100",6],["8101",10],["8102",2],["8110",r.VARIABLE_LENGTH,70],["8200",r.VARIABLE_LENGTH,70]],r}(),Lr=function(){function r(e){this.buffer=new z,this.information=e}return r.prototype.decodeAllCodes=function(e,t){var n=t,i=null;do{var a=this.decodeGeneralPurposeField(n,i),o=rc.parseFieldsInGeneralPurpose(a.getNewString());if(o!=null&&e.append(o),a.isRemaining()?i=""+a.getRemainingValue():i=null,n===a.getNewPosition())break;n=a.getNewPosition()}while(!0);return e.toString()},r.prototype.isStillNumeric=function(e){if(e+7>this.information.getSize())return e+4<=this.information.getSize();for(var t=e;t<e+3;++t)if(this.information.get(t))return!0;return this.information.get(e+3)},r.prototype.decodeNumeric=function(e){if(e+7>this.information.getSize()){var t=this.extractNumericValueFromBitArray(e,4);return t===0?new Ft(this.information.getSize(),Ft.FNC1,Ft.FNC1):new Ft(this.information.getSize(),t-1,Ft.FNC1)}var n=this.extractNumericValueFromBitArray(e,7),i=(n-8)/11,a=(n-8)%11;return new Ft(e+7,i,a)},r.prototype.extractNumericValueFromBitArray=function(e,t){return r.extractNumericValueFromBitArray(this.information,e,t)},r.extractNumericValueFromBitArray=function(e,t,n){for(var i=0,a=0;a<n;++a)e.get(t+a)&&(i|=1<<n-a-1);return i},r.prototype.decodeGeneralPurposeField=function(e,t){this.buffer.setLengthToZero(),t!=null&&this.buffer.append(t),this.current.setPosition(e);var n=this.parseBlocks();return n!=null&&n.isRemaining()?new yt(this.current.getPosition(),this.buffer.toString(),n.getRemainingValue()):new yt(this.current.getPosition(),this.buffer.toString())},r.prototype.parseBlocks=function(){var e,t;do{var n=this.current.getPosition();this.current.isAlpha()?(t=this.parseAlphaBlock(),e=t.isFinished()):this.current.isIsoIec646()?(t=this.parseIsoIec646Block(),e=t.isFinished()):(t=this.parseNumericBlock(),e=t.isFinished());var i=n!==this.current.getPosition();if(!i&&!e)break}while(!e);return t.getDecodedInformation()},r.prototype.parseNumericBlock=function(){for(;this.isStillNumeric(this.current.getPosition());){var e=this.decodeNumeric(this.current.getPosition());if(this.current.setPosition(e.getNewPosition()),e.isFirstDigitFNC1()){var t=void 0;return e.isSecondDigitFNC1()?t=new yt(this.current.getPosition(),this.buffer.toString()):t=new yt(this.current.getPosition(),this.buffer.toString(),e.getSecondDigit()),new xt(!0,t)}if(this.buffer.append(e.getFirstDigit()),e.isSecondDigitFNC1()){var t=new yt(this.current.getPosition(),this.buffer.toString());return new xt(!0,t)}this.buffer.append(e.getSecondDigit())}return this.isNumericToAlphaNumericLatch(this.current.getPosition())&&(this.current.setAlpha(),this.current.incrementPosition(4)),new xt(!1)},r.prototype.parseIsoIec646Block=function(){for(;this.isStillIsoIec646(this.current.getPosition());){var e=this.decodeIsoIec646(this.current.getPosition());if(this.current.setPosition(e.getNewPosition()),e.isFNC1()){var t=new yt(this.current.getPosition(),this.buffer.toString());return new xt(!0,t)}this.buffer.append(e.getValue())}return this.isAlphaOr646ToNumericLatch(this.current.getPosition())?(this.current.incrementPosition(3),this.current.setNumeric()):this.isAlphaTo646ToAlphaLatch(this.current.getPosition())&&(this.current.getPosition()+5<this.information.getSize()?this.current.incrementPosition(5):this.current.setPosition(this.information.getSize()),this.current.setAlpha()),new xt(!1)},r.prototype.parseAlphaBlock=function(){for(;this.isStillAlpha(this.current.getPosition());){var e=this.decodeAlphanumeric(this.current.getPosition());if(this.current.setPosition(e.getNewPosition()),e.isFNC1()){var t=new yt(this.current.getPosition(),this.buffer.toString());return new xt(!0,t)}this.buffer.append(e.getValue())}return this.isAlphaOr646ToNumericLatch(this.current.getPosition())?(this.current.incrementPosition(3),this.current.setNumeric()):this.isAlphaTo646ToAlphaLatch(this.current.getPosition())&&(this.current.getPosition()+5<this.information.getSize()?this.current.incrementPosition(5):this.current.setPosition(this.information.getSize()),this.current.setIsoIec646()),new xt(!1)},r.prototype.isStillIsoIec646=function(e){if(e+5>this.information.getSize())return!1;var t=this.extractNumericValueFromBitArray(e,5);if(t>=5&&t<16)return!0;if(e+7>this.information.getSize())return!1;var n=this.extractNumericValueFromBitArray(e,7);if(n>=64&&n<116)return!0;if(e+8>this.information.getSize())return!1;var i=this.extractNumericValueFromBitArray(e,8);return i>=232&&i<253},r.prototype.decodeIsoIec646=function(e){var t=this.extractNumericValueFromBitArray(e,5);if(t===15)return new $e(e+5,$e.FNC1);if(t>=5&&t<15)return new $e(e+5,"0"+(t-5));var n=this.extractNumericValueFromBitArray(e,7);if(n>=64&&n<90)return new $e(e+7,""+(n+1));if(n>=90&&n<116)return new $e(e+7,""+(n+7));var i=this.extractNumericValueFromBitArray(e,8),a;switch(i){case 232:a="!";break;case 233:a='"';break;case 234:a="%";break;case 235:a="&";break;case 236:a="'";break;case 237:a="(";break;case 238:a=")";break;case 239:a="*";break;case 240:a="+";break;case 241:a=",";break;case 242:a="-";break;case 243:a=".";break;case 244:a="/";break;case 245:a=":";break;case 246:a=";";break;case 247:a="<";break;case 248:a="=";break;case 249:a=">";break;case 250:a="?";break;case 251:a="_";break;case 252:a=" ";break;default:throw new R}return new $e(e+8,a)},r.prototype.isStillAlpha=function(e){if(e+5>this.information.getSize())return!1;var t=this.extractNumericValueFromBitArray(e,5);if(t>=5&&t<16)return!0;if(e+6>this.information.getSize())return!1;var n=this.extractNumericValueFromBitArray(e,6);return n>=16&&n<63},r.prototype.decodeAlphanumeric=function(e){var t=this.extractNumericValueFromBitArray(e,5);if(t===15)return new $e(e+5,$e.FNC1);if(t>=5&&t<15)return new $e(e+5,"0"+(t-5));var n=this.extractNumericValueFromBitArray(e,6);if(n>=32&&n<58)return new $e(e+6,""+(n+33));var i;switch(n){case 58:i="*";break;case 59:i=",";break;case 60:i="-";break;case 61:i=".";break;case 62:i="/";break;default:throw new Qt("Decoding invalid alphanumeric value: "+n)}return new $e(e+6,i)},r.prototype.isAlphaTo646ToAlphaLatch=function(e){if(e+1>this.information.getSize())return!1;for(var t=0;t<5&&t+e<this.information.getSize();++t)if(t===2){if(!this.information.get(e+2))return!1}else if(this.information.get(e+t))return!1;return!0},r.prototype.isAlphaOr646ToNumericLatch=function(e){if(e+3>this.information.getSize())return!1;for(var t=e;t<e+3;++t)if(this.information.get(t))return!1;return!0},r.prototype.isNumericToAlphaNumericLatch=function(e){if(e+1>this.information.getSize())return!1;for(var t=0;t<4&&t+e<this.information.getSize();++t)if(this.information.get(e+t))return!1;return!0},r}(),qa=function(){function r(e){this.information=e,this.generalDecoder=new Lr(e)}return r.prototype.getInformation=function(){return this.information},r.prototype.getGeneralDecoder=function(){return this.generalDecoder},r}(),nc=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)}}(),je=function(r){nc(e,r);function e(t){return r.call(this,t)||this}return e.prototype.encodeCompressedGtin=function(t,n){t.append("(01)");var i=t.length();t.append("9"),this.encodeCompressedGtinWithoutAI(t,n,i)},e.prototype.encodeCompressedGtinWithoutAI=function(t,n,i){for(var a=0;a<4;++a){var o=this.getGeneralDecoder().extractNumericValueFromBitArray(n+10*a,10);o/100===0&&t.append("0"),o/10===0&&t.append("0"),t.append(o)}e.appendCheckDigit(t,i)},e.appendCheckDigit=function(t,n){for(var i=0,a=0;a<13;a++){var o=t.charAt(a+n).charCodeAt(0)-48;i+=(a&1)===0?3*o:o}i=10-i%10,i===10&&(i=0),t.append(i)},e.GTIN_SIZE=40,e}(qa),ic=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)}}(),ac=function(r){ic(e,r);function e(t){return r.call(this,t)||this}return e.prototype.parseInformation=function(){var t=new z;t.append("(01)");var n=t.length(),i=this.getGeneralDecoder().extractNumericValueFromBitArray(e.HEADER_SIZE,4);return t.append(i),this.encodeCompressedGtinWithoutAI(t,e.HEADER_SIZE+4,n),this.getGeneralDecoder().decodeAllCodes(t,e.HEADER_SIZE+44)},e.HEADER_SIZE=4,e}(je),oc=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)}}(),sc=function(r){oc(e,r);function e(t){return r.call(this,t)||this}return e.prototype.parseInformation=function(){var t=new z;return this.getGeneralDecoder().decodeAllCodes(t,e.HEADER_SIZE)},e.HEADER_SIZE=5,e}(qa),fc=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)}}(),kr=function(r){fc(e,r);function e(t){return r.call(this,t)||this}return e.prototype.encodeCompressedWeight=function(t,n,i){var a=this.getGeneralDecoder().extractNumericValueFromBitArray(n,i);this.addWeightCode(t,a);for(var o=this.checkWeight(a),s=1e5,f=0;f<5;++f)o/s===0&&t.append("0"),s/=10;t.append(o)},e}(je),uc=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)}}(),Qa=function(r){uc(e,r);function e(t){return r.call(this,t)||this}return e.prototype.parseInformation=function(){if(this.getInformation().getSize()!==e.HEADER_SIZE+kr.GTIN_SIZE+e.WEIGHT_SIZE)throw new N;var t=new z;return this.encodeCompressedGtin(t,e.HEADER_SIZE),this.encodeCompressedWeight(t,e.HEADER_SIZE+kr.GTIN_SIZE,e.WEIGHT_SIZE),t.toString()},e.HEADER_SIZE=5,e.WEIGHT_SIZE=15,e}(kr),cc=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)}}(),lc=function(r){cc(e,r);function e(t){return r.call(this,t)||this}return e.prototype.addWeightCode=function(t,n){t.append("(3103)")},e.prototype.checkWeight=function(t){return t},e}(Qa),dc=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)}}(),hc=function(r){dc(e,r);function e(t){return r.call(this,t)||this}return e.prototype.addWeightCode=function(t,n){n<1e4?t.append("(3202)"):t.append("(3203)")},e.prototype.checkWeight=function(t){return t<1e4?t:t-1e4},e}(Qa),vc=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)}}(),pc=function(r){vc(e,r);function e(t){return r.call(this,t)||this}return e.prototype.parseInformation=function(){if(this.getInformation().getSize()<e.HEADER_SIZE+je.GTIN_SIZE)throw new N;var t=new z;this.encodeCompressedGtin(t,e.HEADER_SIZE);var n=this.getGeneralDecoder().extractNumericValueFromBitArray(e.HEADER_SIZE+je.GTIN_SIZE,e.LAST_DIGIT_SIZE);t.append("(392"),t.append(n),t.append(")");var i=this.getGeneralDecoder().decodeGeneralPurposeField(e.HEADER_SIZE+je.GTIN_SIZE+e.LAST_DIGIT_SIZE,null);return t.append(i.getNewString()),t.toString()},e.HEADER_SIZE=8,e.LAST_DIGIT_SIZE=2,e}(je),gc=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)}}(),xc=function(r){gc(e,r);function e(t){return r.call(this,t)||this}return e.prototype.parseInformation=function(){if(this.getInformation().getSize()<e.HEADER_SIZE+je.GTIN_SIZE)throw new N;var t=new z;this.encodeCompressedGtin(t,e.HEADER_SIZE);var n=this.getGeneralDecoder().extractNumericValueFromBitArray(e.HEADER_SIZE+je.GTIN_SIZE,e.LAST_DIGIT_SIZE);t.append("(393"),t.append(n),t.append(")");var i=this.getGeneralDecoder().extractNumericValueFromBitArray(e.HEADER_SIZE+je.GTIN_SIZE+e.LAST_DIGIT_SIZE,e.FIRST_THREE_DIGITS_SIZE);i/100===0&&t.append("0"),i/10===0&&t.append("0"),t.append(i);var a=this.getGeneralDecoder().decodeGeneralPurposeField(e.HEADER_SIZE+je.GTIN_SIZE+e.LAST_DIGIT_SIZE+e.FIRST_THREE_DIGITS_SIZE,null);return t.append(a.getNewString()),t.toString()},e.HEADER_SIZE=8,e.LAST_DIGIT_SIZE=2,e.FIRST_THREE_DIGITS_SIZE=10,e}(je),yc=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)}}(),st=function(r){yc(e,r);function e(t,n,i){var a=r.call(this,t)||this;return a.dateCode=i,a.firstAIdigits=n,a}return e.prototype.parseInformation=function(){if(this.getInformation().getSize()!==e.HEADER_SIZE+e.GTIN_SIZE+e.WEIGHT_SIZE+e.DATE_SIZE)throw new N;var t=new z;return this.encodeCompressedGtin(t,e.HEADER_SIZE),this.encodeCompressedWeight(t,e.HEADER_SIZE+e.GTIN_SIZE,e.WEIGHT_SIZE),this.encodeCompressedDate(t,e.HEADER_SIZE+e.GTIN_SIZE+e.WEIGHT_SIZE),t.toString()},e.prototype.encodeCompressedDate=function(t,n){var i=this.getGeneralDecoder().extractNumericValueFromBitArray(n,e.DATE_SIZE);if(i!==38400){t.append("("),t.append(this.dateCode),t.append(")");var a=i%32;i/=32;var o=i%12+1;i/=12;var s=i;s/10===0&&t.append("0"),t.append(s),o/10===0&&t.append("0"),t.append(o),a/10===0&&t.append("0"),t.append(a)}},e.prototype.addWeightCode=function(t,n){t.append("("),t.append(this.firstAIdigits),t.append(n/1e5),t.append(")")},e.prototype.checkWeight=function(t){return t%1e5},e.HEADER_SIZE=8,e.WEIGHT_SIZE=20,e.DATE_SIZE=16,e}(kr);function wc(r){try{if(r.get(1))return new ac(r);if(!r.get(2))return new sc(r);var e=Lr.extractNumericValueFromBitArray(r,1,4);switch(e){case 4:return new lc(r);case 5:return new hc(r)}var t=Lr.extractNumericValueFromBitArray(r,1,5);switch(t){case 12:return new pc(r);case 13:return new xc(r)}var n=Lr.extractNumericValueFromBitArray(r,1,7);switch(n){case 56:return new st(r,"310","11");case 57:return new st(r,"320","11");case 58:return new st(r,"310","13");case 59:return new st(r,"320","13");case 60:return new st(r,"310","15");case 61:return new st(r,"320","15");case 62:return new st(r,"310","17");case 63:return new st(r,"320","17")}}catch(i){throw console.log(i),new Qt("unknown decoder: "+r)}}var Ja=function(){function r(e,t,n,i){this.leftchar=e,this.rightchar=t,this.finderpattern=n,this.maybeLast=i}return r.prototype.mayBeLast=function(){return this.maybeLast},r.prototype.getLeftChar=function(){return this.leftchar},r.prototype.getRightChar=function(){return this.rightchar},r.prototype.getFinderPattern=function(){return this.finderpattern},r.prototype.mustBeLast=function(){return this.rightchar==null},r.prototype.toString=function(){return"[ "+this.leftchar+", "+this.rightchar+" : "+(this.finderpattern==null?"null":this.finderpattern.getValue())+" ]"},r.equals=function(e,t){return e instanceof r?r.equalsOrNull(e.leftchar,t.leftchar)&&r.equalsOrNull(e.rightchar,t.rightchar)&&r.equalsOrNull(e.finderpattern,t.finderpattern):!1},r.equalsOrNull=function(e,t){return e===null?t===null:r.equals(e,t)},r.prototype.hashCode=function(){var e=this.leftchar.getValue()^this.rightchar.getValue()^this.finderpattern.getValue();return e},r}(),mc=function(){function r(e,t,n){this.pairs=e,this.rowNumber=t,this.wasReversed=n}return r.prototype.getPairs=function(){return this.pairs},r.prototype.getRowNumber=function(){return this.rowNumber},r.prototype.isReversed=function(){return this.wasReversed},r.prototype.isEquivalent=function(e){return this.checkEqualitity(this,e)},r.prototype.toString=function(){return"{ "+this.pairs+" }"},r.prototype.equals=function(e,t){return e instanceof r?this.checkEqualitity(e,t)&&e.wasReversed===t.wasReversed:!1},r.prototype.checkEqualitity=function(e,t){if(!(!e||!t)){var n;return e.forEach(function(i,a){t.forEach(function(o){i.getLeftChar().getValue()===o.getLeftChar().getValue()&&i.getRightChar().getValue()===o.getRightChar().getValue()&&i.getFinderPatter().getValue()===o.getFinderPatter().getValue()&&(n=!0)})}),n}},r}(),Cc=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)}}(),ft=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.")},Ac=function(r){Cc(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.pairs=new Array(e.MAX_PAIRS),t.rows=new Array,t.startEnd=[2],t}return e.prototype.decodeRow=function(t,n,i){this.pairs.length=0,this.startFromEven=!1;try{return e.constructResult(this.decodeRow2pairs(t,n))}catch{}return this.pairs.length=0,this.startFromEven=!0,e.constructResult(this.decodeRow2pairs(t,n))},e.prototype.reset=function(){this.pairs.length=0,this.rows.length=0},e.prototype.decodeRow2pairs=function(t,n){for(var i=!1;!i;)try{this.pairs.push(this.retrieveNextPair(n,this.pairs,t))}catch(s){if(s instanceof N){if(!this.pairs.length)throw new N;i=!0}}if(this.checkChecksum())return this.pairs;var a;if(this.rows.length?a=!0:a=!1,this.storeRow(t,!1),a){var o=this.checkRowsBoolean(!1);if(o!=null||(o=this.checkRowsBoolean(!0),o!=null))return o}throw new N},e.prototype.checkRowsBoolean=function(t){if(this.rows.length>25)return this.rows.length=0,null;this.pairs.length=0,t&&(this.rows=this.rows.reverse());var n=null;try{n=this.checkRows(new Array,0)}catch(i){console.log(i)}return t&&(this.rows=this.rows.reverse()),n},e.prototype.checkRows=function(t,n){for(var i,a,o=n;o<this.rows.length;o++){var s=this.rows[o];this.pairs.length=0;try{for(var f=(i=void 0,ft(t)),u=f.next();!u.done;u=f.next()){var c=u.value;this.pairs.push(c.getPairs())}}catch(d){i={error:d}}finally{try{u&&!u.done&&(a=f.return)&&a.call(f)}finally{if(i)throw i.error}}if(this.pairs.push(s.getPairs()),!!e.isValidSequence(this.pairs)){if(this.checkChecksum())return this.pairs;var l=new Array(t);l.push(s);try{return this.checkRows(l,o+1)}catch(d){console.log(d)}}}throw new N},e.isValidSequence=function(t){var n,i;try{for(var a=ft(e.FINDER_PATTERN_SEQUENCES),o=a.next();!o.done;o=a.next()){var s=o.value;if(!(t.length>s.length)){for(var f=!0,u=0;u<t.length;u++)if(t[u].getFinderPattern().getValue()!==s[u]){f=!1;break}if(f)return!0}}}catch(c){n={error:c}}finally{try{o&&!o.done&&(i=a.return)&&i.call(a)}finally{if(n)throw n.error}}return!1},e.prototype.storeRow=function(t,n){for(var i=0,a=!1,o=!1;i<this.rows.length;){var s=this.rows[i];if(s.getRowNumber()>t){o=s.isEquivalent(this.pairs);break}a=s.isEquivalent(this.pairs),i++}o||a||e.isPartialRow(this.pairs,this.rows)||(this.rows.push(i,new mc(this.pairs,t,n)),this.removePartialRows(this.pairs,this.rows))},e.prototype.removePartialRows=function(t,n){var i,a,o,s,f,u;try{for(var c=ft(n),l=c.next();!l.done;l=c.next()){var d=l.value;if(d.getPairs().length!==t.length){var h=!0;try{for(var v=(o=void 0,ft(d.getPairs())),p=v.next();!p.done;p=v.next()){var x=p.value,m=!1;try{for(var w=(f=void 0,ft(t)),C=w.next();!C.done;C=w.next()){var A=C.value;if(Ja.equals(x,A)){m=!0;break}}}catch(_){f={error:_}}finally{try{C&&!C.done&&(u=w.return)&&u.call(w)}finally{if(f)throw f.error}}m||(h=!1)}}catch(_){o={error:_}}finally{try{p&&!p.done&&(s=v.return)&&s.call(v)}finally{if(o)throw o.error}}}}}catch(_){i={error:_}}finally{try{l&&!l.done&&(a=c.return)&&a.call(c)}finally{if(i)throw i.error}}},e.isPartialRow=function(t,n){var i,a,o,s,f,u;try{for(var c=ft(n),l=c.next();!l.done;l=c.next()){var d=l.value,h=!0;try{for(var v=(o=void 0,ft(t)),p=v.next();!p.done;p=v.next()){var x=p.value,m=!1;try{for(var w=(f=void 0,ft(d.getPairs())),C=w.next();!C.done;C=w.next()){var A=C.value;if(x.equals(A)){m=!0;break}}}catch(_){f={error:_}}finally{try{C&&!C.done&&(u=w.return)&&u.call(w)}finally{if(f)throw f.error}}if(!m){h=!1;break}}}catch(_){o={error:_}}finally{try{p&&!p.done&&(s=v.return)&&s.call(v)}finally{if(o)throw o.error}}if(h)return!0}}catch(_){i={error:_}}finally{try{l&&!l.done&&(a=c.return)&&a.call(c)}finally{if(i)throw i.error}}return!1},e.prototype.getRows=function(){return this.rows},e.constructResult=function(t){var n=Qu.buildBitArray(t),i=wc(n),a=i.parseInformation(),o=t[0].getFinderPattern().getResultPoints(),s=t[t.length-1].getFinderPattern().getResultPoints(),f=[o[0],o[1],s[0],s[1]];return new Se(a,null,null,f,L.RSS_EXPANDED,null)},e.prototype.checkChecksum=function(){var t=this.pairs.get(0),n=t.getLeftChar(),i=t.getRightChar();if(i===null)return!1;for(var a=i.getChecksumPortion(),o=2,s=1;s<this.pairs.size();++s){var f=this.pairs.get(s);a+=f.getLeftChar().getChecksumPortion(),o++;var u=f.getRightChar();u!=null&&(a+=u.getChecksumPortion(),o++)}a%=211;var c=211*(o-4)+a;return c===n.getValue()},e.getNextSecondBar=function(t,n){var i;return t.get(n)?(i=t.getNextUnset(n),i=t.getNextSet(i)):(i=t.getNextSet(n),i=t.getNextUnset(i)),i},e.prototype.retrieveNextPair=function(t,n,i){var a=n.length%2===0;this.startFromEven&&(a=!a);var o,s=!0,f=-1;do this.findNextPair(t,n,f),o=this.parseFoundFinderPattern(t,i,a),o===null?f=e.getNextSecondBar(t,this.startEnd[0]):s=!1;while(s);var u=this.decodeDataCharacter(t,o,a,!0);if(!this.isEmptyPair(n)&&n[n.length-1].mustBeLast())throw new N;var c;try{c=this.decodeDataCharacter(t,o,a,!1)}catch(l){c=null,console.log(l)}return new Ja(u,c,o,!0)},e.prototype.isEmptyPair=function(t){return t.length===0},e.prototype.findNextPair=function(t,n,i){var a=this.getDecodeFinderCounters();a[0]=0,a[1]=0,a[2]=0,a[3]=0;var o=t.getSize(),s;if(i>=0)s=i;else if(this.isEmptyPair(n))s=0;else{var f=n[n.length-1];s=f.getFinderPattern().getStartEnd()[1]}var u=n.length%2!==0;this.startFromEven&&(u=!u);for(var c=!1;s<o&&(c=!t.get(s),!!c);)s++;for(var l=0,d=s,h=s;h<o;h++)if(t.get(h)!==c)a[l]++;else{if(l===3){if(u&&e.reverseCounters(a),e.isFinderPattern(a)){this.startEnd[0]=d,this.startEnd[1]=h;return}u&&e.reverseCounters(a),d+=a[0]+a[1],a[0]=a[2],a[1]=a[3],a[2]=0,a[3]=0,l--}else l++;a[l]=1,c=!c}throw new N},e.reverseCounters=function(t){for(var n=t.length,i=0;i<n/2;++i){var a=t[i];t[i]=t[n-i-1],t[n-i-1]=a}},e.prototype.parseFoundFinderPattern=function(t,n,i){var a,o,s;if(i){for(var f=this.startEnd[0]-1;f>=0&&!t.get(f);)f--;f++,a=this.startEnd[0]-f,o=f,s=this.startEnd[1]}else o=this.startEnd[0],s=t.getNextUnset(this.startEnd[1]+1),a=s-this.startEnd[1];var u=this.getDecodeFinderCounters();re.arraycopy(u,0,u,1,u.length-1),u[0]=a;var c;try{c=this.parseFinderValue(u,e.FINDER_PATTERNS)}catch{return null}return new Ka(c,[o,s],o,s,n)},e.prototype.decodeDataCharacter=function(t,n,i,a){for(var o=this.getDataCharacterCounters(),s=0;s<o.length;s++)o[s]=0;if(a)e.recordPatternInReverse(t,n.getStartEnd()[0],o);else{e.recordPattern(t,n.getStartEnd()[1],o);for(var f=0,u=o.length-1;f<u;f++,u--){var c=o[f];o[f]=o[u],o[u]=c}}var l=17,d=Z.sum(new Int32Array(o))/l,h=(n.getStartEnd()[1]-n.getStartEnd()[0])/15;if(Math.abs(d-h)/h>.3)throw new N;for(var v=this.getOddCounts(),p=this.getEvenCounts(),x=this.getOddRoundingErrors(),m=this.getEvenRoundingErrors(),f=0;f<o.length;f++){var w=1*o[f]/d,C=w+.5;if(C<1){if(w<.3)throw new N;C=1}else if(C>8){if(w>8.7)throw new N;C=8}var A=f/2;(f&1)===0?(v[A]=C,x[A]=w-C):(p[A]=C,m[A]=w-C)}this.adjustOddEvenCounts(l);for(var _=4*n.getValue()+(i?0:2)+(a?0:1)-1,b=0,T=0,f=v.length-1;f>=0;f--){if(e.isNotA1left(n,i,a)){var D=e.WEIGHTS[_][2*f];T+=v[f]*D}b+=v[f]}for(var M=0,f=p.length-1;f>=0;f--)if(e.isNotA1left(n,i,a)){var D=e.WEIGHTS[_][2*f+1];M+=p[f]*D}var B=T+M;if((b&1)!==0||b>13||b<4)throw new N;var U=(13-b)/2,H=e.SYMBOL_WIDEST[U],W=9-H,se=Mt.getRSSvalue(v,H,!0),j=Mt.getRSSvalue(p,W,!1),we=e.EVEN_TOTAL_SUBSET[U],et=e.GSUM[U],Ge=se*we+j+et;return new Rr(Ge,B)},e.isNotA1left=function(t,n,i){return!(t.getValue()===0&&n&&i)},e.prototype.adjustOddEvenCounts=function(t){var n=Z.sum(new Int32Array(this.getOddCounts())),i=Z.sum(new Int32Array(this.getEvenCounts())),a=!1,o=!1;n>13?o=!0:n<4&&(a=!0);var s=!1,f=!1;i>13?f=!0:i<4&&(s=!0);var u=n+i-t,c=(n&1)===1,l=(i&1)===0;if(u===1)if(c){if(l)throw new N;o=!0}else{if(!l)throw new N;f=!0}else if(u===-1)if(c){if(l)throw new N;a=!0}else{if(!l)throw new N;s=!0}else if(u===0){if(c){if(!l)throw new N;n<i?(a=!0,f=!0):(o=!0,s=!0)}else if(l)throw new N}else throw new N;if(a){if(o)throw new N;e.increment(this.getOddCounts(),this.getOddRoundingErrors())}if(o&&e.decrement(this.getOddCounts(),this.getOddRoundingErrors()),s){if(f)throw new N;e.increment(this.getEvenCounts(),this.getOddRoundingErrors())}f&&e.decrement(this.getEvenCounts(),this.getEvenRoundingErrors())},e.SYMBOL_WIDEST=[7,5,4,3,1],e.EVEN_TOTAL_SUBSET=[4,20,52,104,204],e.GSUM=[0,348,1388,2948,3988],e.FINDER_PATTERNS=[Int32Array.from([1,8,4,1]),Int32Array.from([3,6,4,1]),Int32Array.from([3,4,6,1]),Int32Array.from([3,2,8,1]),Int32Array.from([2,6,5,1]),Int32Array.from([2,2,9,1])],e.WEIGHTS=[[1,3,9,27,81,32,96,77],[20,60,180,118,143,7,21,63],[189,145,13,39,117,140,209,205],[193,157,49,147,19,57,171,91],[62,186,136,197,169,85,44,132],[185,133,188,142,4,12,36,108],[113,128,173,97,80,29,87,50],[150,28,84,41,123,158,52,156],[46,138,203,187,139,206,196,166],[76,17,51,153,37,111,122,155],[43,129,176,106,107,110,119,146],[16,48,144,10,30,90,59,177],[109,116,137,200,178,112,125,164],[70,210,208,202,184,130,179,115],[134,191,151,31,93,68,204,190],[148,22,66,198,172,94,71,2],[6,18,54,162,64,192,154,40],[120,149,25,75,14,42,126,167],[79,26,78,23,69,207,199,175],[103,98,83,38,114,131,182,124],[161,61,183,127,170,88,53,159],[55,165,73,8,24,72,5,15],[45,135,194,160,58,174,100,89]],e.FINDER_PAT_A=0,e.FINDER_PAT_B=1,e.FINDER_PAT_C=2,e.FINDER_PAT_D=3,e.FINDER_PAT_E=4,e.FINDER_PAT_F=5,e.FINDER_PATTERN_SEQUENCES=[[e.FINDER_PAT_A,e.FINDER_PAT_A],[e.FINDER_PAT_A,e.FINDER_PAT_B,e.FINDER_PAT_B],[e.FINDER_PAT_A,e.FINDER_PAT_C,e.FINDER_PAT_B,e.FINDER_PAT_D],[e.FINDER_PAT_A,e.FINDER_PAT_E,e.FINDER_PAT_B,e.FINDER_PAT_D,e.FINDER_PAT_C],[e.FINDER_PAT_A,e.FINDER_PAT_E,e.FINDER_PAT_B,e.FINDER_PAT_D,e.FINDER_PAT_D,e.FINDER_PAT_F],[e.FINDER_PAT_A,e.FINDER_PAT_E,e.FINDER_PAT_B,e.FINDER_PAT_D,e.FINDER_PAT_E,e.FINDER_PAT_F,e.FINDER_PAT_F],[e.FINDER_PAT_A,e.FINDER_PAT_A,e.FINDER_PAT_B,e.FINDER_PAT_B,e.FINDER_PAT_C,e.FINDER_PAT_C,e.FINDER_PAT_D,e.FINDER_PAT_D],[e.FINDER_PAT_A,e.FINDER_PAT_A,e.FINDER_PAT_B,e.FINDER_PAT_B,e.FINDER_PAT_C,e.FINDER_PAT_C,e.FINDER_PAT_D,e.FINDER_PAT_E,e.FINDER_PAT_E],[e.FINDER_PAT_A,e.FINDER_PAT_A,e.FINDER_PAT_B,e.FINDER_PAT_B,e.FINDER_PAT_C,e.FINDER_PAT_C,e.FINDER_PAT_D,e.FINDER_PAT_E,e.FINDER_PAT_F,e.FINDER_PAT_F],[e.FINDER_PAT_A,e.FINDER_PAT_A,e.FINDER_PAT_B,e.FINDER_PAT_B,e.FINDER_PAT_C,e.FINDER_PAT_D,e.FINDER_PAT_D,e.FINDER_PAT_E,e.FINDER_PAT_E,e.FINDER_PAT_F,e.FINDER_PAT_F]],e.MAX_PAIRS=11,e}(gt),_c=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)}}(),Ec=function(r){_c(e,r);function e(t,n,i){var a=r.call(this,t,n)||this;return a.count=0,a.finderPattern=i,a}return e.prototype.getFinderPattern=function(){return this.finderPattern},e.prototype.getCount=function(){return this.count},e.prototype.incrementCount=function(){this.count++},e}(Rr),Ic=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){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.")},eo=function(r){Ic(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.possibleLeftPairs=[],t.possibleRightPairs=[],t}return e.prototype.decodeRow=function(t,n,i){var a,o,s,f,u=this.decodePair(n,!1,t,i);e.addOrTally(this.possibleLeftPairs,u),n.reverse();var c=this.decodePair(n,!0,t,i);e.addOrTally(this.possibleRightPairs,c),n.reverse();try{for(var l=$n(this.possibleLeftPairs),d=l.next();!d.done;d=l.next()){var h=d.value;if(h.getCount()>1)try{for(var v=(s=void 0,$n(this.possibleRightPairs)),p=v.next();!p.done;p=v.next()){var x=p.value;if(x.getCount()>1&&e.checkChecksum(h,x))return e.constructResult(h,x)}}catch(m){s={error:m}}finally{try{p&&!p.done&&(f=v.return)&&f.call(v)}finally{if(s)throw s.error}}}}catch(m){a={error:m}}finally{try{d&&!d.done&&(o=l.return)&&o.call(l)}finally{if(a)throw a.error}}throw new N},e.addOrTally=function(t,n){var i,a;if(n!=null){var o=!1;try{for(var s=$n(t),f=s.next();!f.done;f=s.next()){var u=f.value;if(u.getValue()===n.getValue()){u.incrementCount(),o=!0;break}}}catch(c){i={error:c}}finally{try{f&&!f.done&&(a=s.return)&&a.call(s)}finally{if(i)throw i.error}}o||t.push(n)}},e.prototype.reset=function(){this.possibleLeftPairs.length=0,this.possibleRightPairs.length=0},e.constructResult=function(t,n){for(var i=4537077*t.getValue()+n.getValue(),a=new String(i).toString(),o=new z,s=13-a.length;s>0;s--)o.append("0");o.append(a);for(var f=0,s=0;s<13;s++){var u=o.charAt(s).charCodeAt(0)-48;f+=(s&1)===0?3*u:u}f=10-f%10,f===10&&(f=0),o.append(f.toString());var c=t.getFinderPattern().getResultPoints(),l=n.getFinderPattern().getResultPoints();return new Se(o.toString(),null,0,[c[0],c[1],l[0],l[1]],L.RSS_14,new Date().getTime())},e.checkChecksum=function(t,n){var i=(t.getChecksumPortion()+16*n.getChecksumPortion())%79,a=9*t.getFinderPattern().getValue()+n.getFinderPattern().getValue();return a>72&&a--,a>8&&a--,i===a},e.prototype.decodePair=function(t,n,i,a){try{var o=this.findFinderPattern(t,n),s=this.parseFoundFinderPattern(t,i,n,o),f=a==null?null:a.get(oe.NEED_RESULT_POINT_CALLBACK);if(f!=null){var u=(o[0]+o[1])/2;n&&(u=t.getSize()-1-u),f.foundPossibleResultPoint(new k(u,i))}var c=this.decodeDataCharacter(t,s,!0),l=this.decodeDataCharacter(t,s,!1);return new Ec(1597*c.getValue()+l.getValue(),c.getChecksumPortion()+4*l.getChecksumPortion(),s)}catch{return null}},e.prototype.decodeDataCharacter=function(t,n,i){for(var a=this.getDataCharacterCounters(),o=0;o<a.length;o++)a[o]=0;if(i)ce.recordPatternInReverse(t,n.getStartEnd()[0],a);else{ce.recordPattern(t,n.getStartEnd()[1]+1,a);for(var s=0,f=a.length-1;s<f;s++,f--){var u=a[s];a[s]=a[f],a[f]=u}}for(var c=i?16:15,l=Z.sum(new Int32Array(a))/c,d=this.getOddCounts(),h=this.getEvenCounts(),v=this.getOddRoundingErrors(),p=this.getEvenRoundingErrors(),s=0;s<a.length;s++){var x=a[s]/l,m=Math.floor(x+.5);m<1?m=1:m>8&&(m=8);var w=Math.floor(s/2);(s&1)===0?(d[w]=m,v[w]=x-m):(h[w]=m,p[w]=x-m)}this.adjustOddEvenCounts(i,c);for(var C=0,A=0,s=d.length-1;s>=0;s--)A*=9,A+=d[s],C+=d[s];for(var _=0,b=0,s=h.length-1;s>=0;s--)_*=9,_+=h[s],b+=h[s];var T=A+3*_;if(i){if((C&1)!==0||C>12||C<4)throw new N;var D=(12-C)/2,M=e.OUTSIDE_ODD_WIDEST[D],B=9-M,U=Mt.getRSSvalue(d,M,!1),H=Mt.getRSSvalue(h,B,!0),W=e.OUTSIDE_EVEN_TOTAL_SUBSET[D],se=e.OUTSIDE_GSUM[D];return new Rr(U*W+H+se,T)}else{if((b&1)!==0||b>10||b<4)throw new N;var D=(10-b)/2,M=e.INSIDE_ODD_WIDEST[D],B=9-M,U=Mt.getRSSvalue(d,M,!0),H=Mt.getRSSvalue(h,B,!1),j=e.INSIDE_ODD_TOTAL_SUBSET[D],se=e.INSIDE_GSUM[D];return new Rr(H*j+U+se,T)}},e.prototype.findFinderPattern=function(t,n){var i=this.getDecodeFinderCounters();i[0]=0,i[1]=0,i[2]=0,i[3]=0;for(var a=t.getSize(),o=!1,s=0;s<a&&(o=!t.get(s),n!==o);)s++;for(var f=0,u=s,c=s;c<a;c++)if(t.get(c)!==o)i[f]++;else{if(f===3){if(gt.isFinderPattern(i))return[u,c];u+=i[0]+i[1],i[0]=i[2],i[1]=i[3],i[2]=0,i[3]=0,f--}else f++;i[f]=1,o=!o}throw new N},e.prototype.parseFoundFinderPattern=function(t,n,i,a){for(var o=t.get(a[0]),s=a[0]-1;s>=0&&o!==t.get(s);)s--;s++;var f=a[0]-s,u=this.getDecodeFinderCounters(),c=new Int32Array(u.length);re.arraycopy(u,0,c,1,u.length-1),c[0]=f;var l=this.parseFinderValue(c,e.FINDER_PATTERNS),d=s,h=a[1];return i&&(d=t.getSize()-1-d,h=t.getSize()-1-h),new Ka(l,[s,a[1]],d,h,n)},e.prototype.adjustOddEvenCounts=function(t,n){var i=Z.sum(new Int32Array(this.getOddCounts())),a=Z.sum(new Int32Array(this.getEvenCounts())),o=!1,s=!1,f=!1,u=!1;t?(i>12?s=!0:i<4&&(o=!0),a>12?u=!0:a<4&&(f=!0)):(i>11?s=!0:i<5&&(o=!0),a>10?u=!0:a<4&&(f=!0));var c=i+a-n,l=(i&1)===(t?1:0),d=(a&1)===1;if(c===1)if(l){if(d)throw new N;s=!0}else{if(!d)throw new N;u=!0}else if(c===-1)if(l){if(d)throw new N;o=!0}else{if(!d)throw new N;f=!0}else if(c===0){if(l){if(!d)throw new N;i<a?(o=!0,u=!0):(s=!0,f=!0)}else if(d)throw new N}else throw new N;if(o){if(s)throw new N;gt.increment(this.getOddCounts(),this.getOddRoundingErrors())}if(s&>.decrement(this.getOddCounts(),this.getOddRoundingErrors()),f){if(u)throw new N;gt.increment(this.getEvenCounts(),this.getOddRoundingErrors())}u&>.decrement(this.getEvenCounts(),this.getEvenRoundingErrors())},e.OUTSIDE_EVEN_TOTAL_SUBSET=[1,10,34,70,126],e.INSIDE_ODD_TOTAL_SUBSET=[4,20,48,81],e.OUTSIDE_GSUM=[0,161,961,2015,2715],e.INSIDE_GSUM=[0,336,1036,1516],e.OUTSIDE_ODD_WIDEST=[8,6,4,3,1],e.INSIDE_ODD_WIDEST=[2,4,6,8],e.FINDER_PATTERNS=[Int32Array.from([3,8,2,1]),Int32Array.from([3,5,5,1]),Int32Array.from([3,3,7,1]),Int32Array.from([3,1,9,1]),Int32Array.from([2,7,4,1]),Int32Array.from([2,5,6,1]),Int32Array.from([2,3,8,1]),Int32Array.from([1,5,7,1]),Int32Array.from([1,3,9,1])],e}(gt),Sc=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)}}(),Jt=function(r){Sc(e,r);function e(t){var n=r.call(this)||this;n.readers=[];var i=t?t.get(oe.POSSIBLE_FORMATS):null,a=t&&t.get(oe.ASSUME_CODE_39_CHECK_DIGIT)!==void 0;return i&&((i.includes(L.EAN_13)||i.includes(L.UPC_A)||i.includes(L.EAN_8)||i.includes(L.UPC_E))&&n.readers.push(new Wn(t)),i.includes(L.CODE_39)&&n.readers.push(new Ha(a)),i.includes(L.CODE_93)&&n.readers.push(new za),i.includes(L.CODE_128)&&n.readers.push(new Va),i.includes(L.ITF)&&n.readers.push(new Ga),i.includes(L.CODABAR)&&n.readers.push(new Yu),i.includes(L.RSS_14)&&n.readers.push(new eo),i.includes(L.RSS_EXPANDED)&&(console.warn("RSS Expanded reader IS NOT ready for production yet! use at your own risk."),n.readers.push(new Ac))),n.readers.length===0&&(n.readers.push(new Wn(t)),n.readers.push(new Ha),n.readers.push(new za),n.readers.push(new Wn(t)),n.readers.push(new Va),n.readers.push(new Ga),n.readers.push(new eo)),n}return e.prototype.decodeRow=function(t,n,i){for(var a=0;a<this.readers.length;a++)try{return this.readers[a].decodeRow(t,n,i)}catch{}throw new N},e.prototype.reset=function(){this.readers.forEach(function(t){return t.reset()})},e}(ce),bc=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)}}();(function(r){bc(e,r);function e(t,n){return t===void 0&&(t=500),r.call(this,new Jt(n),t,n)||this}return e})(Dt);var to=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.")},Q=function(){function r(e,t,n){this.ecCodewords=e,this.ecBlocks=[t],n&&this.ecBlocks.push(n)}return r.prototype.getECCodewords=function(){return this.ecCodewords},r.prototype.getECBlocks=function(){return this.ecBlocks},r}(),K=function(){function r(e,t){this.count=e,this.dataCodewords=t}return r.prototype.getCount=function(){return this.count},r.prototype.getDataCodewords=function(){return this.dataCodewords},r}(),Tc=function(){function r(e,t,n,i,a,o){var s,f;this.versionNumber=e,this.symbolSizeRows=t,this.symbolSizeColumns=n,this.dataRegionSizeRows=i,this.dataRegionSizeColumns=a,this.ecBlocks=o;var u=0,c=o.getECCodewords(),l=o.getECBlocks();try{for(var d=to(l),h=d.next();!h.done;h=d.next()){var v=h.value;u+=v.getCount()*(v.getDataCodewords()+c)}}catch(p){s={error:p}}finally{try{h&&!h.done&&(f=d.return)&&f.call(d)}finally{if(s)throw s.error}}this.totalCodewords=u}return r.prototype.getVersionNumber=function(){return this.versionNumber},r.prototype.getSymbolSizeRows=function(){return this.symbolSizeRows},r.prototype.getSymbolSizeColumns=function(){return this.symbolSizeColumns},r.prototype.getDataRegionSizeRows=function(){return this.dataRegionSizeRows},r.prototype.getDataRegionSizeColumns=function(){return this.dataRegionSizeColumns},r.prototype.getTotalCodewords=function(){return this.totalCodewords},r.prototype.getECBlocks=function(){return this.ecBlocks},r.getVersionForDimensions=function(e,t){var n,i;if((e&1)!==0||(t&1)!==0)throw new R;try{for(var a=to(r.VERSIONS),o=a.next();!o.done;o=a.next()){var s=o.value;if(s.symbolSizeRows===e&&s.symbolSizeColumns===t)return s}}catch(f){n={error:f}}finally{try{o&&!o.done&&(i=a.return)&&i.call(a)}finally{if(n)throw n.error}}throw new R},r.prototype.toString=function(){return""+this.versionNumber},r.buildVersions=function(){return[new r(1,10,10,8,8,new Q(5,new K(1,3))),new r(2,12,12,10,10,new Q(7,new K(1,5))),new r(3,14,14,12,12,new Q(10,new K(1,8))),new r(4,16,16,14,14,new Q(12,new K(1,12))),new r(5,18,18,16,16,new Q(14,new K(1,18))),new r(6,20,20,18,18,new Q(18,new K(1,22))),new r(7,22,22,20,20,new Q(20,new K(1,30))),new r(8,24,24,22,22,new Q(24,new K(1,36))),new r(9,26,26,24,24,new Q(28,new K(1,44))),new r(10,32,32,14,14,new Q(36,new K(1,62))),new r(11,36,36,16,16,new Q(42,new K(1,86))),new r(12,40,40,18,18,new Q(48,new K(1,114))),new r(13,44,44,20,20,new Q(56,new K(1,144))),new r(14,48,48,22,22,new Q(68,new K(1,174))),new r(15,52,52,24,24,new Q(42,new K(2,102))),new r(16,64,64,14,14,new Q(56,new K(2,140))),new r(17,72,72,16,16,new Q(36,new K(4,92))),new r(18,80,80,18,18,new Q(48,new K(4,114))),new r(19,88,88,20,20,new Q(56,new K(4,144))),new r(20,96,96,22,22,new Q(68,new K(4,174))),new r(21,104,104,24,24,new Q(56,new K(6,136))),new r(22,120,120,18,18,new Q(68,new K(6,175))),new r(23,132,132,20,20,new Q(62,new K(8,163))),new r(24,144,144,22,22,new Q(62,new K(8,156),new K(2,155))),new r(25,8,18,6,16,new Q(7,new K(1,5))),new r(26,8,32,6,14,new Q(11,new K(1,10))),new r(27,12,26,10,24,new Q(14,new K(1,16))),new r(28,12,36,10,16,new Q(18,new K(1,22))),new r(29,16,36,14,16,new Q(24,new K(1,32))),new r(30,16,48,14,22,new Q(28,new K(1,49)))]},r.VERSIONS=r.buildVersions(),r}(),Oc=function(){function r(e){var t=e.getHeight();if(t<8||t>144||(t&1)!==0)throw new R;this.version=r.readVersion(e),this.mappingBitMatrix=this.extractDataRegion(e),this.readMappingMatrix=new qe(this.mappingBitMatrix.getWidth(),this.mappingBitMatrix.getHeight())}return r.prototype.getVersion=function(){return this.version},r.readVersion=function(e){var t=e.getHeight(),n=e.getWidth();return Tc.getVersionForDimensions(t,n)},r.prototype.readCodewords=function(){var e=new Int8Array(this.version.getTotalCodewords()),t=0,n=4,i=0,a=this.mappingBitMatrix.getHeight(),o=this.mappingBitMatrix.getWidth(),s=!1,f=!1,u=!1,c=!1;do if(n===a&&i===0&&!s)e[t++]=this.readCorner1(a,o)&255,n-=2,i+=2,s=!0;else if(n===a-2&&i===0&&(o&3)!==0&&!f)e[t++]=this.readCorner2(a,o)&255,n-=2,i+=2,f=!0;else if(n===a+4&&i===2&&(o&7)===0&&!u)e[t++]=this.readCorner3(a,o)&255,n-=2,i+=2,u=!0;else if(n===a-2&&i===0&&(o&7)===4&&!c)e[t++]=this.readCorner4(a,o)&255,n-=2,i+=2,c=!0;else{do n<a&&i>=0&&!this.readMappingMatrix.get(i,n)&&(e[t++]=this.readUtah(n,i,a,o)&255),n-=2,i+=2;while(n>=0&&i<o);n+=1,i+=3;do n>=0&&i<o&&!this.readMappingMatrix.get(i,n)&&(e[t++]=this.readUtah(n,i,a,o)&255),n+=2,i-=2;while(n<a&&i>=0);n+=3,i+=1}while(n<a||i<o);if(t!==this.version.getTotalCodewords())throw new R;return e},r.prototype.readModule=function(e,t,n,i){return e<0&&(e+=n,t+=4-(n+4&7)),t<0&&(t+=i,e+=4-(i+4&7)),this.readMappingMatrix.set(t,e),this.mappingBitMatrix.get(t,e)},r.prototype.readUtah=function(e,t,n,i){var a=0;return this.readModule(e-2,t-2,n,i)&&(a|=1),a<<=1,this.readModule(e-2,t-1,n,i)&&(a|=1),a<<=1,this.readModule(e-1,t-2,n,i)&&(a|=1),a<<=1,this.readModule(e-1,t-1,n,i)&&(a|=1),a<<=1,this.readModule(e-1,t,n,i)&&(a|=1),a<<=1,this.readModule(e,t-2,n,i)&&(a|=1),a<<=1,this.readModule(e,t-1,n,i)&&(a|=1),a<<=1,this.readModule(e,t,n,i)&&(a|=1),a},r.prototype.readCorner1=function(e,t){var n=0;return this.readModule(e-1,0,e,t)&&(n|=1),n<<=1,this.readModule(e-1,1,e,t)&&(n|=1),n<<=1,this.readModule(e-1,2,e,t)&&(n|=1),n<<=1,this.readModule(0,t-2,e,t)&&(n|=1),n<<=1,this.readModule(0,t-1,e,t)&&(n|=1),n<<=1,this.readModule(1,t-1,e,t)&&(n|=1),n<<=1,this.readModule(2,t-1,e,t)&&(n|=1),n<<=1,this.readModule(3,t-1,e,t)&&(n|=1),n},r.prototype.readCorner2=function(e,t){var n=0;return this.readModule(e-3,0,e,t)&&(n|=1),n<<=1,this.readModule(e-2,0,e,t)&&(n|=1),n<<=1,this.readModule(e-1,0,e,t)&&(n|=1),n<<=1,this.readModule(0,t-4,e,t)&&(n|=1),n<<=1,this.readModule(0,t-3,e,t)&&(n|=1),n<<=1,this.readModule(0,t-2,e,t)&&(n|=1),n<<=1,this.readModule(0,t-1,e,t)&&(n|=1),n<<=1,this.readModule(1,t-1,e,t)&&(n|=1),n},r.prototype.readCorner3=function(e,t){var n=0;return this.readModule(e-1,0,e,t)&&(n|=1),n<<=1,this.readModule(e-1,t-1,e,t)&&(n|=1),n<<=1,this.readModule(0,t-3,e,t)&&(n|=1),n<<=1,this.readModule(0,t-2,e,t)&&(n|=1),n<<=1,this.readModule(0,t-1,e,t)&&(n|=1),n<<=1,this.readModule(1,t-3,e,t)&&(n|=1),n<<=1,this.readModule(1,t-2,e,t)&&(n|=1),n<<=1,this.readModule(1,t-1,e,t)&&(n|=1),n},r.prototype.readCorner4=function(e,t){var n=0;return this.readModule(e-3,0,e,t)&&(n|=1),n<<=1,this.readModule(e-2,0,e,t)&&(n|=1),n<<=1,this.readModule(e-1,0,e,t)&&(n|=1),n<<=1,this.readModule(0,t-2,e,t)&&(n|=1),n<<=1,this.readModule(0,t-1,e,t)&&(n|=1),n<<=1,this.readModule(1,t-1,e,t)&&(n|=1),n<<=1,this.readModule(2,t-1,e,t)&&(n|=1),n<<=1,this.readModule(3,t-1,e,t)&&(n|=1),n},r.prototype.extractDataRegion=function(e){var t=this.version.getSymbolSizeRows(),n=this.version.getSymbolSizeColumns();if(e.getHeight()!==t)throw new V("Dimension of bitMatrix must match the version size");for(var i=this.version.getDataRegionSizeRows(),a=this.version.getDataRegionSizeColumns(),o=t/i|0,s=n/a|0,f=o*i,u=s*a,c=new qe(u,f),l=0;l<o;++l)for(var d=l*i,h=0;h<s;++h)for(var v=h*a,p=0;p<i;++p)for(var x=l*(i+2)+1+p,m=d+p,w=0;w<a;++w){var C=h*(a+2)+1+w;if(e.get(C,x)){var A=v+w;c.set(A,m)}}return c},r}(),ro=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.")},Nc=function(){function r(e,t){this.numDataCodewords=e,this.codewords=t}return r.getDataBlocks=function(e,t){var n,i,a,o,s=t.getECBlocks(),f=0,u=s.getECBlocks();try{for(var c=ro(u),l=c.next();!l.done;l=c.next()){var d=l.value;f+=d.getCount()}}catch(se){n={error:se}}finally{try{l&&!l.done&&(i=c.return)&&i.call(c)}finally{if(n)throw n.error}}var h=new Array(f),v=0;try{for(var p=ro(u),x=p.next();!x.done;x=p.next())for(var d=x.value,m=0;m<d.getCount();m++){var w=d.getDataCodewords(),C=s.getECCodewords()+w;h[v++]=new r(w,new Uint8Array(C))}}catch(se){a={error:se}}finally{try{x&&!x.done&&(o=p.return)&&o.call(p)}finally{if(a)throw a.error}}for(var A=h[0].codewords.length,_=A-s.getECCodewords(),b=_-1,T=0,m=0;m<b;m++)for(var D=0;D<v;D++)h[D].codewords[m]=e[T++];for(var M=t.getVersionNumber()===24,B=M?8:v,D=0;D<B;D++)h[D].codewords[_-1]=e[T++];for(var U=h[0].codewords.length,m=_;m<U;m++)for(var D=0;D<v;D++){var H=M?(D+8)%v:D,W=M&&H>7?m-1:m;h[H].codewords[W]=e[T++]}if(T!==e.length)throw new V;return h},r.prototype.getNumDataCodewords=function(){return this.numDataCodewords},r.prototype.getCodewords=function(){return this.codewords},r}(),no=function(){function r(e){this.bytes=e,this.byteOffset=0,this.bitOffset=0}return r.prototype.getBitOffset=function(){return this.bitOffset},r.prototype.getByteOffset=function(){return this.byteOffset},r.prototype.readBits=function(e){if(e<1||e>32||e>this.available())throw new V(""+e);var t=0,n=this.bitOffset,i=this.byteOffset,a=this.bytes;if(n>0){var o=8-n,s=e<o?e:o,f=o-s,u=255>>8-s<<f;t=(a[i]&u)>>f,e-=s,n+=s,n===8&&(n=0,i++)}if(e>0){for(;e>=8;)t=t<<8|a[i]&255,i++,e-=8;if(e>0){var f=8-e,u=255>>f<<f;t=t<<e|(a[i]&u)>>f,n+=e}}return this.bitOffset=n,this.byteOffset=i,t},r.prototype.available=function(){return 8*(this.bytes.length-this.byteOffset)-this.bitOffset},r}(),de;(function(r){r[r.PAD_ENCODE=0]="PAD_ENCODE",r[r.ASCII_ENCODE=1]="ASCII_ENCODE",r[r.C40_ENCODE=2]="C40_ENCODE",r[r.TEXT_ENCODE=3]="TEXT_ENCODE",r[r.ANSIX12_ENCODE=4]="ANSIX12_ENCODE",r[r.EDIFACT_ENCODE=5]="EDIFACT_ENCODE",r[r.BASE256_ENCODE=6]="BASE256_ENCODE"})(de||(de={}));var Dc=function(){function r(){}return r.decode=function(e){var t=new no(e),n=new z,i=new z,a=new Array,o=de.ASCII_ENCODE;do if(o===de.ASCII_ENCODE)o=this.decodeAsciiSegment(t,n,i);else{switch(o){case de.C40_ENCODE:this.decodeC40Segment(t,n);break;case de.TEXT_ENCODE:this.decodeTextSegment(t,n);break;case de.ANSIX12_ENCODE:this.decodeAnsiX12Segment(t,n);break;case de.EDIFACT_ENCODE:this.decodeEdifactSegment(t,n);break;case de.BASE256_ENCODE:this.decodeBase256Segment(t,n,a);break;default:throw new R}o=de.ASCII_ENCODE}while(o!==de.PAD_ENCODE&&t.available()>0);return i.length()>0&&n.append(i.toString()),new Pr(e,n.toString(),a.length===0?null:a,null)},r.decodeAsciiSegment=function(e,t,n){var i=!1;do{var a=e.readBits(8);if(a===0)throw new R;if(a<=128)return i&&(a+=128),t.append(String.fromCharCode(a-1)),de.ASCII_ENCODE;if(a===129)return de.PAD_ENCODE;if(a<=229){var o=a-130;o<10&&t.append("0"),t.append(""+o)}else switch(a){case 230:return de.C40_ENCODE;case 231:return de.BASE256_ENCODE;case 232:t.append("");break;case 233:case 234:break;case 235:i=!0;break;case 236:t.append("[)>05"),n.insert(0,"");break;case 237:t.append("[)>06"),n.insert(0,"");break;case 238:return de.ANSIX12_ENCODE;case 239:return de.TEXT_ENCODE;case 240:return de.EDIFACT_ENCODE;case 241:break;default:if(a!==254||e.available()!==0)throw new R;break}}while(e.available()>0);return de.ASCII_ENCODE},r.decodeC40Segment=function(e,t){var n=!1,i=[],a=0;do{if(e.available()===8)return;var o=e.readBits(8);if(o===254)return;this.parseTwoBytes(o,e.readBits(8),i);for(var s=0;s<3;s++){var f=i[s];switch(a){case 0:if(f<3)a=f+1;else if(f<this.C40_BASIC_SET_CHARS.length){var u=this.C40_BASIC_SET_CHARS[f];n?(t.append(String.fromCharCode(u.charCodeAt(0)+128)),n=!1):t.append(u)}else throw new R;break;case 1:n?(t.append(String.fromCharCode(f+128)),n=!1):t.append(String.fromCharCode(f)),a=0;break;case 2:if(f<this.C40_SHIFT2_SET_CHARS.length){var u=this.C40_SHIFT2_SET_CHARS[f];n?(t.append(String.fromCharCode(u.charCodeAt(0)+128)),n=!1):t.append(u)}else switch(f){case 27:t.append("");break;case 30:n=!0;break;default:throw new R}a=0;break;case 3:n?(t.append(String.fromCharCode(f+224)),n=!1):t.append(String.fromCharCode(f+96)),a=0;break;default:throw new R}}}while(e.available()>0)},r.decodeTextSegment=function(e,t){var n=!1,i=[],a=0;do{if(e.available()===8)return;var o=e.readBits(8);if(o===254)return;this.parseTwoBytes(o,e.readBits(8),i);for(var s=0;s<3;s++){var f=i[s];switch(a){case 0:if(f<3)a=f+1;else if(f<this.TEXT_BASIC_SET_CHARS.length){var u=this.TEXT_BASIC_SET_CHARS[f];n?(t.append(String.fromCharCode(u.charCodeAt(0)+128)),n=!1):t.append(u)}else throw new R;break;case 1:n?(t.append(String.fromCharCode(f+128)),n=!1):t.append(String.fromCharCode(f)),a=0;break;case 2:if(f<this.TEXT_SHIFT2_SET_CHARS.length){var u=this.TEXT_SHIFT2_SET_CHARS[f];n?(t.append(String.fromCharCode(u.charCodeAt(0)+128)),n=!1):t.append(u)}else switch(f){case 27:t.append("");break;case 30:n=!0;break;default:throw new R}a=0;break;case 3:if(f<this.TEXT_SHIFT3_SET_CHARS.length){var u=this.TEXT_SHIFT3_SET_CHARS[f];n?(t.append(String.fromCharCode(u.charCodeAt(0)+128)),n=!1):t.append(u),a=0}else throw new R;break;default:throw new R}}}while(e.available()>0)},r.decodeAnsiX12Segment=function(e,t){var n=[];do{if(e.available()===8)return;var i=e.readBits(8);if(i===254)return;this.parseTwoBytes(i,e.readBits(8),n);for(var a=0;a<3;a++){var o=n[a];switch(o){case 0:t.append("\r");break;case 1:t.append("*");break;case 2:t.append(">");break;case 3:t.append(" ");break;default:if(o<14)t.append(String.fromCharCode(o+44));else if(o<40)t.append(String.fromCharCode(o+51));else throw new R;break}}}while(e.available()>0)},r.parseTwoBytes=function(e,t,n){var i=(e<<8)+t-1,a=Math.floor(i/1600);n[0]=a,i-=a*1600,a=Math.floor(i/40),n[1]=a,n[2]=i-a*40},r.decodeEdifactSegment=function(e,t){do{if(e.available()<=16)return;for(var n=0;n<4;n++){var i=e.readBits(6);if(i===31){var a=8-e.getBitOffset();a!==8&&e.readBits(a);return}(i&32)===0&&(i|=64),t.append(String.fromCharCode(i))}}while(e.available()>0)},r.decodeBase256Segment=function(e,t,n){var i=1+e.getByteOffset(),a=this.unrandomize255State(e.readBits(8),i++),o;if(a===0?o=e.available()/8|0:a<250?o=a:o=250*(a-249)+this.unrandomize255State(e.readBits(8),i++),o<0)throw new R;for(var s=new Uint8Array(o),f=0;f<o;f++){if(e.available()<8)throw new R;s[f]=this.unrandomize255State(e.readBits(8),i++)}n.push(s);try{t.append(Ve.decode(s,$.ISO88591))}catch(u){throw new Qt("Platform does not support required encoding: "+u.message)}},r.unrandomize255State=function(e,t){var n=149*t%255+1,i=e-n;return i>=0?i:i+256},r.C40_BASIC_SET_CHARS=["*","*","*"," ","0","1","2","3","4","5","6","7","8","9","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"],r.C40_SHIFT2_SET_CHARS=["!",'"',"#","$","%","&","'","(",")","*","+",",","-",".","/",":",";","<","=",">","?","@","[","\\","]","^","_"],r.TEXT_BASIC_SET_CHARS=["*","*","*"," ","0","1","2","3","4","5","6","7","8","9","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"],r.TEXT_SHIFT2_SET_CHARS=r.C40_SHIFT2_SET_CHARS,r.TEXT_SHIFT3_SET_CHARS=["`","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","{","|","}","~",""],r}(),Pc=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.")},Mc=function(){function r(){this.rsDecoder=new Fr(Re.DATA_MATRIX_FIELD_256)}return r.prototype.decode=function(e){var t,n,i=new Oc(e),a=i.getVersion(),o=i.readCodewords(),s=Nc.getDataBlocks(o,a),f=0;try{for(var u=Pc(s),c=u.next();!c.done;c=u.next()){var l=c.value;f+=l.getNumDataCodewords()}}catch(C){t={error:C}}finally{try{c&&!c.done&&(n=u.return)&&n.call(u)}finally{if(t)throw t.error}}for(var d=new Uint8Array(f),h=s.length,v=0;v<h;v++){var p=s[v],x=p.getCodewords(),m=p.getNumDataCodewords();this.correctErrors(x,m);for(var w=0;w<m;w++)d[w*h+v]=x[w]}return Dc.decode(d)},r.prototype.correctErrors=function(e,t){var n=new Int32Array(e);try{this.rsDecoder.decode(n,e.length-t)}catch{throw new pe}for(var i=0;i<t;i++)e[i]=n[i]},r}(),Fc=function(){function r(e){this.image=e,this.rectangleDetector=new kn(this.image)}return r.prototype.detect=function(){var e=this.rectangleDetector.detect(),t=this.detectSolid1(e);if(t=this.detectSolid2(t),t[3]=this.correctTopRight(t),!t[3])throw new N;t=this.shiftToModuleCenter(t);var n=t[0],i=t[1],a=t[2],o=t[3],s=this.transitionsBetween(n,o)+1,f=this.transitionsBetween(a,o)+1;(s&1)===1&&(s+=1),(f&1)===1&&(f+=1),4*s<7*f&&4*f<7*s&&(s=f=Math.max(s,f));var u=r.sampleGrid(this.image,n,i,a,o,s,f);return new Ln(u,[n,i,a,o])},r.shiftPoint=function(e,t,n){var i=(t.getX()-e.getX())/(n+1),a=(t.getY()-e.getY())/(n+1);return new k(e.getX()+i,e.getY()+a)},r.moveAway=function(e,t,n){var i=e.getX(),a=e.getY();return i<t?i-=1:i+=1,a<n?a-=1:a+=1,new k(i,a)},r.prototype.detectSolid1=function(e){var t=e[0],n=e[1],i=e[3],a=e[2],o=this.transitionsBetween(t,n),s=this.transitionsBetween(n,i),f=this.transitionsBetween(i,a),u=this.transitionsBetween(a,t),c=o,l=[a,t,n,i];return c>s&&(c=s,l[0]=t,l[1]=n,l[2]=i,l[3]=a),c>f&&(c=f,l[0]=n,l[1]=i,l[2]=a,l[3]=t),c>u&&(l[0]=i,l[1]=a,l[2]=t,l[3]=n),l},r.prototype.detectSolid2=function(e){var t=e[0],n=e[1],i=e[2],a=e[3],o=this.transitionsBetween(t,a),s=r.shiftPoint(n,i,(o+1)*4),f=r.shiftPoint(i,n,(o+1)*4),u=this.transitionsBetween(s,t),c=this.transitionsBetween(f,a);return u<c?(e[0]=t,e[1]=n,e[2]=i,e[3]=a):(e[0]=n,e[1]=i,e[2]=a,e[3]=t),e},r.prototype.correctTopRight=function(e){var t=e[0],n=e[1],i=e[2],a=e[3],o=this.transitionsBetween(t,a),s=this.transitionsBetween(n,a),f=r.shiftPoint(t,n,(s+1)*4),u=r.shiftPoint(i,n,(o+1)*4);o=this.transitionsBetween(f,a),s=this.transitionsBetween(u,a);var c=new k(a.getX()+(i.getX()-n.getX())/(o+1),a.getY()+(i.getY()-n.getY())/(o+1)),l=new k(a.getX()+(t.getX()-n.getX())/(s+1),a.getY()+(t.getY()-n.getY())/(s+1));if(!this.isValid(c))return this.isValid(l)?l:null;if(!this.isValid(l))return c;var d=this.transitionsBetween(f,c)+this.transitionsBetween(u,c),h=this.transitionsBetween(f,l)+this.transitionsBetween(u,l);return d>h?c:l},r.prototype.shiftToModuleCenter=function(e){var t=e[0],n=e[1],i=e[2],a=e[3],o=this.transitionsBetween(t,a)+1,s=this.transitionsBetween(i,a)+1,f=r.shiftPoint(t,n,s*4),u=r.shiftPoint(i,n,o*4);o=this.transitionsBetween(f,a)+1,s=this.transitionsBetween(u,a)+1,(o&1)===1&&(o+=1),(s&1)===1&&(s+=1);var c=(t.getX()+n.getX()+i.getX()+a.getX())/4,l=(t.getY()+n.getY()+i.getY()+a.getY())/4;t=r.moveAway(t,c,l),n=r.moveAway(n,c,l),i=r.moveAway(i,c,l),a=r.moveAway(a,c,l);var d,h;return f=r.shiftPoint(t,n,s*4),f=r.shiftPoint(f,a,o*4),d=r.shiftPoint(n,t,s*4),d=r.shiftPoint(d,i,o*4),u=r.shiftPoint(i,a,s*4),u=r.shiftPoint(u,n,o*4),h=r.shiftPoint(a,i,s*4),h=r.shiftPoint(h,t,o*4),[f,d,u,h]},r.prototype.isValid=function(e){return e.getX()>=0&&e.getX()<this.image.getWidth()&&e.getY()>0&&e.getY()<this.image.getHeight()},r.sampleGrid=function(e,t,n,i,a,o,s){var f=Un.getInstance();return f.sampleGrid(e,o,s,.5,.5,o-.5,.5,o-.5,s-.5,.5,s-.5,t.getX(),t.getY(),a.getX(),a.getY(),i.getX(),i.getY(),n.getX(),n.getY())},r.prototype.transitionsBetween=function(e,t){var n=Math.trunc(e.getX()),i=Math.trunc(e.getY()),a=Math.trunc(t.getX()),o=Math.trunc(t.getY()),s=Math.abs(o-i)>Math.abs(a-n);if(s){var f=n;n=i,i=f,f=a,a=o,o=f}for(var u=Math.abs(a-n),c=Math.abs(o-i),l=-u/2,d=i<o?1:-1,h=n<a?1:-1,v=0,p=this.image.get(s?i:n,s?n:i),x=n,m=i;x!==a;x+=h){var w=this.image.get(s?m:x,s?x:m);if(w!==p&&(v++,p=w),l+=c,l>0){if(m===o)break;m+=d,l-=u}}return v},r}(),jn=function(){function r(){this.decoder=new Mc}return r.prototype.decode=function(e,t){t===void 0&&(t=null);var n,i;if(t!=null&&t.has(oe.PURE_BARCODE)){var a=r.extractPureBits(e.getBlackMatrix());n=this.decoder.decode(a),i=r.NO_POINTS}else{var o=new Fc(e.getBlackMatrix()).detect();n=this.decoder.decode(o.getBits()),i=o.getPoints()}var s=n.getRawBytes(),f=new Se(n.getText(),s,8*s.length,i,L.DATA_MATRIX,re.currentTimeMillis()),u=n.getByteSegments();u!=null&&f.putMetadata(Ce.BYTE_SEGMENTS,u);var c=n.getECLevel();return c!=null&&f.putMetadata(Ce.ERROR_CORRECTION_LEVEL,c),f},r.prototype.reset=function(){},r.extractPureBits=function(e){var t=e.getTopLeftOnBit(),n=e.getBottomRightOnBit();if(t==null||n==null)throw new N;var i=this.moduleSize(t,e),a=t[1],o=n[1],s=t[0],f=n[0],u=(f-s+1)/i,c=(o-a+1)/i;if(u<=0||c<=0)throw new N;var l=i/2;a+=l,s+=l;for(var d=new qe(u,c),h=0;h<c;h++)for(var v=a+h*i,p=0;p<u;p++)e.get(s+p*i,v)&&d.set(p,h);return d},r.moduleSize=function(e,t){for(var n=t.getWidth(),i=e[0],a=e[1];i<n&&t.get(i,a);)i++;if(i===n)throw new N;var o=i-e[0];if(o===0)throw new N;return o},r.NO_POINTS=[],r}(),Rc=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)}}();(function(r){Rc(e,r);function e(t){return t===void 0&&(t=500),r.call(this,new jn,t)||this}return e})(Dt);var Rt;(function(r){r[r.L=0]="L",r[r.M=1]="M",r[r.Q=2]="Q",r[r.H=3]="H"})(Rt||(Rt={}));var Bc=function(){function r(e,t,n){this.value=e,this.stringValue=t,this.bits=n,r.FOR_BITS.set(n,this),r.FOR_VALUE.set(e,this)}return r.prototype.getValue=function(){return this.value},r.prototype.getBits=function(){return this.bits},r.fromString=function(e){switch(e){case"L":return r.L;case"M":return r.M;case"Q":return r.Q;case"H":return r.H;default:throw new Xe(e+"not available")}},r.prototype.toString=function(){return this.stringValue},r.prototype.equals=function(e){if(!(e instanceof r))return!1;var t=e;return this.value===t.value},r.forBits=function(e){if(e<0||e>=r.FOR_BITS.size)throw new V;return r.FOR_BITS.get(e)},r.FOR_BITS=new Map,r.FOR_VALUE=new Map,r.L=new r(Rt.L,"L",1),r.M=new r(Rt.M,"M",0),r.Q=new r(Rt.Q,"Q",3),r.H=new r(Rt.H,"H",2),r}(),Lc=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.")},io=function(){function r(e){this.errorCorrectionLevel=Bc.forBits(e>>3&3),this.dataMask=e&7}return r.numBitsDiffering=function(e,t){return G.bitCount(e^t)},r.decodeFormatInformation=function(e,t){var n=r.doDecodeFormatInformation(e,t);return n!==null?n:r.doDecodeFormatInformation(e^r.FORMAT_INFO_MASK_QR,t^r.FORMAT_INFO_MASK_QR)},r.doDecodeFormatInformation=function(e,t){var n,i,a=Number.MAX_SAFE_INTEGER,o=0;try{for(var s=Lc(r.FORMAT_INFO_DECODE_LOOKUP),f=s.next();!f.done;f=s.next()){var u=f.value,c=u[0];if(c===e||c===t)return new r(u[1]);var l=r.numBitsDiffering(e,c);l<a&&(o=u[1],a=l),e!==t&&(l=r.numBitsDiffering(t,c),l<a&&(o=u[1],a=l))}}catch(d){n={error:d}}finally{try{f&&!f.done&&(i=s.return)&&i.call(s)}finally{if(n)throw n.error}}return a<=3?new r(o):null},r.prototype.getErrorCorrectionLevel=function(){return this.errorCorrectionLevel},r.prototype.getDataMask=function(){return this.dataMask},r.prototype.hashCode=function(){return this.errorCorrectionLevel.getBits()<<3|this.dataMask},r.prototype.equals=function(e){if(!(e instanceof r))return!1;var t=e;return this.errorCorrectionLevel===t.errorCorrectionLevel&&this.dataMask===t.dataMask},r.FORMAT_INFO_MASK_QR=21522,r.FORMAT_INFO_DECODE_LOOKUP=[Int32Array.from([21522,0]),Int32Array.from([20773,1]),Int32Array.from([24188,2]),Int32Array.from([23371,3]),Int32Array.from([17913,4]),Int32Array.from([16590,5]),Int32Array.from([20375,6]),Int32Array.from([19104,7]),Int32Array.from([30660,8]),Int32Array.from([29427,9]),Int32Array.from([32170,10]),Int32Array.from([30877,11]),Int32Array.from([26159,12]),Int32Array.from([25368,13]),Int32Array.from([27713,14]),Int32Array.from([26998,15]),Int32Array.from([5769,16]),Int32Array.from([5054,17]),Int32Array.from([7399,18]),Int32Array.from([6608,19]),Int32Array.from([1890,20]),Int32Array.from([597,21]),Int32Array.from([3340,22]),Int32Array.from([2107,23]),Int32Array.from([13663,24]),Int32Array.from([12392,25]),Int32Array.from([16177,26]),Int32Array.from([14854,27]),Int32Array.from([9396,28]),Int32Array.from([8579,29]),Int32Array.from([11994,30]),Int32Array.from([11245,31])],r}(),kc=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.")},S=function(){function r(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];this.ecCodewordsPerBlock=e,this.ecBlocks=t}return r.prototype.getECCodewordsPerBlock=function(){return this.ecCodewordsPerBlock},r.prototype.getNumBlocks=function(){var e,t,n=0,i=this.ecBlocks;try{for(var a=kc(i),o=a.next();!o.done;o=a.next()){var s=o.value;n+=s.getCount()}}catch(f){e={error:f}}finally{try{o&&!o.done&&(t=a.return)&&t.call(a)}finally{if(e)throw e.error}}return n},r.prototype.getTotalECCodewords=function(){return this.ecCodewordsPerBlock*this.getNumBlocks()},r.prototype.getECBlocks=function(){return this.ecBlocks},r}(),y=function(){function r(e,t){this.count=e,this.dataCodewords=t}return r.prototype.getCount=function(){return this.count},r.prototype.getDataCodewords=function(){return this.dataCodewords},r}(),Uc=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.")},wt=function(){function r(e,t){for(var n,i,a=[],o=2;o<arguments.length;o++)a[o-2]=arguments[o];this.versionNumber=e,this.alignmentPatternCenters=t,this.ecBlocks=a;var s=0,f=a[0].getECCodewordsPerBlock(),u=a[0].getECBlocks();try{for(var c=Uc(u),l=c.next();!l.done;l=c.next()){var d=l.value;s+=d.getCount()*(d.getDataCodewords()+f)}}catch(h){n={error:h}}finally{try{l&&!l.done&&(i=c.return)&&i.call(c)}finally{if(n)throw n.error}}this.totalCodewords=s}return r.prototype.getVersionNumber=function(){return this.versionNumber},r.prototype.getAlignmentPatternCenters=function(){return this.alignmentPatternCenters},r.prototype.getTotalCodewords=function(){return this.totalCodewords},r.prototype.getDimensionForVersion=function(){return 17+4*this.versionNumber},r.prototype.getECBlocksForLevel=function(e){return this.ecBlocks[e.getValue()]},r.getProvisionalVersionForDimension=function(e){if(e%4!==1)throw new R;try{return this.getVersionForNumber((e-17)/4)}catch{throw new R}},r.getVersionForNumber=function(e){if(e<1||e>40)throw new V;return r.VERSIONS[e-1]},r.decodeVersionInformation=function(e){for(var t=Number.MAX_SAFE_INTEGER,n=0,i=0;i<r.VERSION_DECODE_INFO.length;i++){var a=r.VERSION_DECODE_INFO[i];if(a===e)return r.getVersionForNumber(i+7);var o=io.numBitsDiffering(e,a);o<t&&(n=i+7,t=o)}return t<=3?r.getVersionForNumber(n):null},r.prototype.buildFunctionPattern=function(){var e=this.getDimensionForVersion(),t=new qe(e);t.setRegion(0,0,9,9),t.setRegion(e-8,0,8,9),t.setRegion(0,e-8,9,8);for(var n=this.alignmentPatternCenters.length,i=0;i<n;i++)for(var a=this.alignmentPatternCenters[i]-2,o=0;o<n;o++)i===0&&(o===0||o===n-1)||i===n-1&&o===0||t.setRegion(this.alignmentPatternCenters[o]-2,a,5,5);return t.setRegion(6,9,1,e-17),t.setRegion(9,6,e-17,1),this.versionNumber>6&&(t.setRegion(e-11,0,3,6),t.setRegion(0,e-11,6,3)),t},r.prototype.toString=function(){return""+this.versionNumber},r.VERSION_DECODE_INFO=Int32Array.from([31892,34236,39577,42195,48118,51042,55367,58893,63784,68472,70749,76311,79154,84390,87683,92361,96236,102084,102881,110507,110734,117786,119615,126325,127568,133589,136944,141498,145311,150283,152622,158308,161089,167017]),r.VERSIONS=[new r(1,new Int32Array(0),new S(7,new y(1,19)),new S(10,new y(1,16)),new S(13,new y(1,13)),new S(17,new y(1,9))),new r(2,Int32Array.from([6,18]),new S(10,new y(1,34)),new S(16,new y(1,28)),new S(22,new y(1,22)),new S(28,new y(1,16))),new r(3,Int32Array.from([6,22]),new S(15,new y(1,55)),new S(26,new y(1,44)),new S(18,new y(2,17)),new S(22,new y(2,13))),new r(4,Int32Array.from([6,26]),new S(20,new y(1,80)),new S(18,new y(2,32)),new S(26,new y(2,24)),new S(16,new y(4,9))),new r(5,Int32Array.from([6,30]),new S(26,new y(1,108)),new S(24,new y(2,43)),new S(18,new y(2,15),new y(2,16)),new S(22,new y(2,11),new y(2,12))),new r(6,Int32Array.from([6,34]),new S(18,new y(2,68)),new S(16,new y(4,27)),new S(24,new y(4,19)),new S(28,new y(4,15))),new r(7,Int32Array.from([6,22,38]),new S(20,new y(2,78)),new S(18,new y(4,31)),new S(18,new y(2,14),new y(4,15)),new S(26,new y(4,13),new y(1,14))),new r(8,Int32Array.from([6,24,42]),new S(24,new y(2,97)),new S(22,new y(2,38),new y(2,39)),new S(22,new y(4,18),new y(2,19)),new S(26,new y(4,14),new y(2,15))),new r(9,Int32Array.from([6,26,46]),new S(30,new y(2,116)),new S(22,new y(3,36),new y(2,37)),new S(20,new y(4,16),new y(4,17)),new S(24,new y(4,12),new y(4,13))),new r(10,Int32Array.from([6,28,50]),new S(18,new y(2,68),new y(2,69)),new S(26,new y(4,43),new y(1,44)),new S(24,new y(6,19),new y(2,20)),new S(28,new y(6,15),new y(2,16))),new r(11,Int32Array.from([6,30,54]),new S(20,new y(4,81)),new S(30,new y(1,50),new y(4,51)),new S(28,new y(4,22),new y(4,23)),new S(24,new y(3,12),new y(8,13))),new r(12,Int32Array.from([6,32,58]),new S(24,new y(2,92),new y(2,93)),new S(22,new y(6,36),new y(2,37)),new S(26,new y(4,20),new y(6,21)),new S(28,new y(7,14),new y(4,15))),new r(13,Int32Array.from([6,34,62]),new S(26,new y(4,107)),new S(22,new y(8,37),new y(1,38)),new S(24,new y(8,20),new y(4,21)),new S(22,new y(12,11),new y(4,12))),new r(14,Int32Array.from([6,26,46,66]),new S(30,new y(3,115),new y(1,116)),new S(24,new y(4,40),new y(5,41)),new S(20,new y(11,16),new y(5,17)),new S(24,new y(11,12),new y(5,13))),new r(15,Int32Array.from([6,26,48,70]),new S(22,new y(5,87),new y(1,88)),new S(24,new y(5,41),new y(5,42)),new S(30,new y(5,24),new y(7,25)),new S(24,new y(11,12),new y(7,13))),new r(16,Int32Array.from([6,26,50,74]),new S(24,new y(5,98),new y(1,99)),new S(28,new y(7,45),new y(3,46)),new S(24,new y(15,19),new y(2,20)),new S(30,new y(3,15),new y(13,16))),new r(17,Int32Array.from([6,30,54,78]),new S(28,new y(1,107),new y(5,108)),new S(28,new y(10,46),new y(1,47)),new S(28,new y(1,22),new y(15,23)),new S(28,new y(2,14),new y(17,15))),new r(18,Int32Array.from([6,30,56,82]),new S(30,new y(5,120),new y(1,121)),new S(26,new y(9,43),new y(4,44)),new S(28,new y(17,22),new y(1,23)),new S(28,new y(2,14),new y(19,15))),new r(19,Int32Array.from([6,30,58,86]),new S(28,new y(3,113),new y(4,114)),new S(26,new y(3,44),new y(11,45)),new S(26,new y(17,21),new y(4,22)),new S(26,new y(9,13),new y(16,14))),new r(20,Int32Array.from([6,34,62,90]),new S(28,new y(3,107),new y(5,108)),new S(26,new y(3,41),new y(13,42)),new S(30,new y(15,24),new y(5,25)),new S(28,new y(15,15),new y(10,16))),new r(21,Int32Array.from([6,28,50,72,94]),new S(28,new y(4,116),new y(4,117)),new S(26,new y(17,42)),new S(28,new y(17,22),new y(6,23)),new S(30,new y(19,16),new y(6,17))),new r(22,Int32Array.from([6,26,50,74,98]),new S(28,new y(2,111),new y(7,112)),new S(28,new y(17,46)),new S(30,new y(7,24),new y(16,25)),new S(24,new y(34,13))),new r(23,Int32Array.from([6,30,54,78,102]),new S(30,new y(4,121),new y(5,122)),new S(28,new y(4,47),new y(14,48)),new S(30,new y(11,24),new y(14,25)),new S(30,new y(16,15),new y(14,16))),new r(24,Int32Array.from([6,28,54,80,106]),new S(30,new y(6,117),new y(4,118)),new S(28,new y(6,45),new y(14,46)),new S(30,new y(11,24),new y(16,25)),new S(30,new y(30,16),new y(2,17))),new r(25,Int32Array.from([6,32,58,84,110]),new S(26,new y(8,106),new y(4,107)),new S(28,new y(8,47),new y(13,48)),new S(30,new y(7,24),new y(22,25)),new S(30,new y(22,15),new y(13,16))),new r(26,Int32Array.from([6,30,58,86,114]),new S(28,new y(10,114),new y(2,115)),new S(28,new y(19,46),new y(4,47)),new S(28,new y(28,22),new y(6,23)),new S(30,new y(33,16),new y(4,17))),new r(27,Int32Array.from([6,34,62,90,118]),new S(30,new y(8,122),new y(4,123)),new S(28,new y(22,45),new y(3,46)),new S(30,new y(8,23),new y(26,24)),new S(30,new y(12,15),new y(28,16))),new r(28,Int32Array.from([6,26,50,74,98,122]),new S(30,new y(3,117),new y(10,118)),new S(28,new y(3,45),new y(23,46)),new S(30,new y(4,24),new y(31,25)),new S(30,new y(11,15),new y(31,16))),new r(29,Int32Array.from([6,30,54,78,102,126]),new S(30,new y(7,116),new y(7,117)),new S(28,new y(21,45),new y(7,46)),new S(30,new y(1,23),new y(37,24)),new S(30,new y(19,15),new y(26,16))),new r(30,Int32Array.from([6,26,52,78,104,130]),new S(30,new y(5,115),new y(10,116)),new S(28,new y(19,47),new y(10,48)),new S(30,new y(15,24),new y(25,25)),new S(30,new y(23,15),new y(25,16))),new r(31,Int32Array.from([6,30,56,82,108,134]),new S(30,new y(13,115),new y(3,116)),new S(28,new y(2,46),new y(29,47)),new S(30,new y(42,24),new y(1,25)),new S(30,new y(23,15),new y(28,16))),new r(32,Int32Array.from([6,34,60,86,112,138]),new S(30,new y(17,115)),new S(28,new y(10,46),new y(23,47)),new S(30,new y(10,24),new y(35,25)),new S(30,new y(19,15),new y(35,16))),new r(33,Int32Array.from([6,30,58,86,114,142]),new S(30,new y(17,115),new y(1,116)),new S(28,new y(14,46),new y(21,47)),new S(30,new y(29,24),new y(19,25)),new S(30,new y(11,15),new y(46,16))),new r(34,Int32Array.from([6,34,62,90,118,146]),new S(30,new y(13,115),new y(6,116)),new S(28,new y(14,46),new y(23,47)),new S(30,new y(44,24),new y(7,25)),new S(30,new y(59,16),new y(1,17))),new r(35,Int32Array.from([6,30,54,78,102,126,150]),new S(30,new y(12,121),new y(7,122)),new S(28,new y(12,47),new y(26,48)),new S(30,new y(39,24),new y(14,25)),new S(30,new y(22,15),new y(41,16))),new r(36,Int32Array.from([6,24,50,76,102,128,154]),new S(30,new y(6,121),new y(14,122)),new S(28,new y(6,47),new y(34,48)),new S(30,new y(46,24),new y(10,25)),new S(30,new y(2,15),new y(64,16))),new r(37,Int32Array.from([6,28,54,80,106,132,158]),new S(30,new y(17,122),new y(4,123)),new S(28,new y(29,46),new y(14,47)),new S(30,new y(49,24),new y(10,25)),new S(30,new y(24,15),new y(46,16))),new r(38,Int32Array.from([6,32,58,84,110,136,162]),new S(30,new y(4,122),new y(18,123)),new S(28,new y(13,46),new y(32,47)),new S(30,new y(48,24),new y(14,25)),new S(30,new y(42,15),new y(32,16))),new r(39,Int32Array.from([6,26,54,82,110,138,166]),new S(30,new y(20,117),new y(4,118)),new S(28,new y(40,47),new y(7,48)),new S(30,new y(43,24),new y(22,25)),new S(30,new y(10,15),new y(67,16))),new r(40,Int32Array.from([6,30,58,86,114,142,170]),new S(30,new y(19,118),new y(6,119)),new S(28,new y(18,47),new y(31,48)),new S(30,new y(34,24),new y(34,25)),new S(30,new y(20,15),new y(61,16)))],r}(),xe;(function(r){r[r.DATA_MASK_000=0]="DATA_MASK_000",r[r.DATA_MASK_001=1]="DATA_MASK_001",r[r.DATA_MASK_010=2]="DATA_MASK_010",r[r.DATA_MASK_011=3]="DATA_MASK_011",r[r.DATA_MASK_100=4]="DATA_MASK_100",r[r.DATA_MASK_101=5]="DATA_MASK_101",r[r.DATA_MASK_110=6]="DATA_MASK_110",r[r.DATA_MASK_111=7]="DATA_MASK_111"})(xe||(xe={}));var ao=function(){function r(e,t){this.value=e,this.isMasked=t}return r.prototype.unmaskBitMatrix=function(e,t){for(var n=0;n<t;n++)for(var i=0;i<t;i++)this.isMasked(n,i)&&e.flip(i,n)},r.values=new Map([[xe.DATA_MASK_000,new r(xe.DATA_MASK_000,function(e,t){return(e+t&1)===0})],[xe.DATA_MASK_001,new r(xe.DATA_MASK_001,function(e,t){return(e&1)===0})],[xe.DATA_MASK_010,new r(xe.DATA_MASK_010,function(e,t){return t%3===0})],[xe.DATA_MASK_011,new r(xe.DATA_MASK_011,function(e,t){return(e+t)%3===0})],[xe.DATA_MASK_100,new r(xe.DATA_MASK_100,function(e,t){return(Math.floor(e/2)+Math.floor(t/3)&1)===0})],[xe.DATA_MASK_101,new r(xe.DATA_MASK_101,function(e,t){return e*t%6===0})],[xe.DATA_MASK_110,new r(xe.DATA_MASK_110,function(e,t){return e*t%6<3})],[xe.DATA_MASK_111,new r(xe.DATA_MASK_111,function(e,t){return(e+t+e*t%3&1)===0})]]),r}(),Vc=function(){function r(e){var t=e.getHeight();if(t<21||(t&3)!==1)throw new R;this.bitMatrix=e}return r.prototype.readFormatInformation=function(){if(this.parsedFormatInfo!==null&&this.parsedFormatInfo!==void 0)return this.parsedFormatInfo;for(var e=0,t=0;t<6;t++)e=this.copyBit(t,8,e);e=this.copyBit(7,8,e),e=this.copyBit(8,8,e),e=this.copyBit(8,7,e);for(var n=5;n>=0;n--)e=this.copyBit(8,n,e);for(var i=this.bitMatrix.getHeight(),a=0,o=i-7,n=i-1;n>=o;n--)a=this.copyBit(8,n,a);for(var t=i-8;t<i;t++)a=this.copyBit(t,8,a);if(this.parsedFormatInfo=io.decodeFormatInformation(e,a),this.parsedFormatInfo!==null)return this.parsedFormatInfo;throw new R},r.prototype.readVersion=function(){if(this.parsedVersion!==null&&this.parsedVersion!==void 0)return this.parsedVersion;var e=this.bitMatrix.getHeight(),t=Math.floor((e-17)/4);if(t<=6)return wt.getVersionForNumber(t);for(var n=0,i=e-11,a=5;a>=0;a--)for(var o=e-9;o>=i;o--)n=this.copyBit(o,a,n);var s=wt.decodeVersionInformation(n);if(s!==null&&s.getDimensionForVersion()===e)return this.parsedVersion=s,s;n=0;for(var o=5;o>=0;o--)for(var a=e-9;a>=i;a--)n=this.copyBit(o,a,n);if(s=wt.decodeVersionInformation(n),s!==null&&s.getDimensionForVersion()===e)return this.parsedVersion=s,s;throw new R},r.prototype.copyBit=function(e,t,n){var i=this.isMirror?this.bitMatrix.get(t,e):this.bitMatrix.get(e,t);return i?n<<1|1:n<<1},r.prototype.readCodewords=function(){var e=this.readFormatInformation(),t=this.readVersion(),n=ao.values.get(e.getDataMask()),i=this.bitMatrix.getHeight();n.unmaskBitMatrix(this.bitMatrix,i);for(var a=t.buildFunctionPattern(),o=!0,s=new Uint8Array(t.getTotalCodewords()),f=0,u=0,c=0,l=i-1;l>0;l-=2){l===6&&l--;for(var d=0;d<i;d++)for(var h=o?i-1-d:d,v=0;v<2;v++)a.get(l-v,h)||(c++,u<<=1,this.bitMatrix.get(l-v,h)&&(u|=1),c===8&&(s[f++]=u,c=0,u=0));o=!o}if(f!==t.getTotalCodewords())throw new R;return s},r.prototype.remask=function(){if(this.parsedFormatInfo!==null){var e=ao.values[this.parsedFormatInfo.getDataMask()],t=this.bitMatrix.getHeight();e.unmaskBitMatrix(this.bitMatrix,t)}},r.prototype.setMirror=function(e){this.parsedVersion=null,this.parsedFormatInfo=null,this.isMirror=e},r.prototype.mirror=function(){for(var e=this.bitMatrix,t=0,n=e.getWidth();t<n;t++)for(var i=t+1,a=e.getHeight();i<a;i++)e.get(t,i)!==e.get(i,t)&&(e.flip(i,t),e.flip(t,i))},r}(),oo=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.")},Hc=function(){function r(e,t){this.numDataCodewords=e,this.codewords=t}return r.getDataBlocks=function(e,t,n){var i,a,o,s;if(e.length!==t.getTotalCodewords())throw new V;var f=t.getECBlocksForLevel(n),u=0,c=f.getECBlocks();try{for(var l=oo(c),d=l.next();!d.done;d=l.next()){var h=d.value;u+=h.getCount()}}catch(W){i={error:W}}finally{try{d&&!d.done&&(a=l.return)&&a.call(l)}finally{if(i)throw i.error}}var v=new Array(u),p=0;try{for(var x=oo(c),m=x.next();!m.done;m=x.next())for(var h=m.value,w=0;w<h.getCount();w++){var C=h.getDataCodewords(),A=f.getECCodewordsPerBlock()+C;v[p++]=new r(C,new Uint8Array(A))}}catch(W){o={error:W}}finally{try{m&&!m.done&&(s=x.return)&&s.call(x)}finally{if(o)throw o.error}}for(var _=v[0].codewords.length,b=v.length-1;b>=0;){var T=v[b].codewords.length;if(T===_)break;b--}b++;for(var D=_-f.getECCodewordsPerBlock(),M=0,w=0;w<D;w++)for(var B=0;B<p;B++)v[B].codewords[w]=e[M++];for(var B=b;B<p;B++)v[B].codewords[D]=e[M++];for(var U=v[0].codewords.length,w=D;w<U;w++)for(var B=0;B<p;B++){var H=B<b?w:w+1;v[B].codewords[H]=e[M++]}return v},r.prototype.getNumDataCodewords=function(){return this.numDataCodewords},r.prototype.getCodewords=function(){return this.codewords},r}(),He;(function(r){r[r.TERMINATOR=0]="TERMINATOR",r[r.NUMERIC=1]="NUMERIC",r[r.ALPHANUMERIC=2]="ALPHANUMERIC",r[r.STRUCTURED_APPEND=3]="STRUCTURED_APPEND",r[r.BYTE=4]="BYTE",r[r.ECI=5]="ECI",r[r.KANJI=6]="KANJI",r[r.FNC1_FIRST_POSITION=7]="FNC1_FIRST_POSITION",r[r.FNC1_SECOND_POSITION=8]="FNC1_SECOND_POSITION",r[r.HANZI=9]="HANZI"})(He||(He={}));var ne=function(){function r(e,t,n,i){this.value=e,this.stringValue=t,this.characterCountBitsForVersions=n,this.bits=i,r.FOR_BITS.set(i,this),r.FOR_VALUE.set(e,this)}return r.forBits=function(e){var t=r.FOR_BITS.get(e);if(t===void 0)throw new V;return t},r.prototype.getCharacterCountBits=function(e){var t=e.getVersionNumber(),n;return t<=9?n=0:t<=26?n=1:n=2,this.characterCountBitsForVersions[n]},r.prototype.getValue=function(){return this.value},r.prototype.getBits=function(){return this.bits},r.prototype.equals=function(e){if(!(e instanceof r))return!1;var t=e;return this.value===t.value},r.prototype.toString=function(){return this.stringValue},r.FOR_BITS=new Map,r.FOR_VALUE=new Map,r.TERMINATOR=new r(He.TERMINATOR,"TERMINATOR",Int32Array.from([0,0,0]),0),r.NUMERIC=new r(He.NUMERIC,"NUMERIC",Int32Array.from([10,12,14]),1),r.ALPHANUMERIC=new r(He.ALPHANUMERIC,"ALPHANUMERIC",Int32Array.from([9,11,13]),2),r.STRUCTURED_APPEND=new r(He.STRUCTURED_APPEND,"STRUCTURED_APPEND",Int32Array.from([0,0,0]),3),r.BYTE=new r(He.BYTE,"BYTE",Int32Array.from([8,16,16]),4),r.ECI=new r(He.ECI,"ECI",Int32Array.from([0,0,0]),7),r.KANJI=new r(He.KANJI,"KANJI",Int32Array.from([8,10,12]),8),r.FNC1_FIRST_POSITION=new r(He.FNC1_FIRST_POSITION,"FNC1_FIRST_POSITION",Int32Array.from([0,0,0]),5),r.FNC1_SECOND_POSITION=new r(He.FNC1_SECOND_POSITION,"FNC1_SECOND_POSITION",Int32Array.from([0,0,0]),9),r.HANZI=new r(He.HANZI,"HANZI",Int32Array.from([8,10,12]),13),r}(),zc=function(){function r(){}return r.decode=function(e,t,n,i){var a=new no(e),o=new z,s=new Array,f=-1,u=-1;try{var c=null,l=!1,d=void 0;do{if(a.available()<4)d=ne.TERMINATOR;else{var h=a.readBits(4);d=ne.forBits(h)}switch(d){case ne.TERMINATOR:break;case ne.FNC1_FIRST_POSITION:case ne.FNC1_SECOND_POSITION:l=!0;break;case ne.STRUCTURED_APPEND:if(a.available()<16)throw new R;f=a.readBits(8),u=a.readBits(8);break;case ne.ECI:var v=r.parseECIValue(a);if(c=ue.getCharacterSetECIByValue(v),c===null)throw new R;break;case ne.HANZI:var p=a.readBits(4),x=a.readBits(d.getCharacterCountBits(t));p===r.GB2312_SUBSET&&r.decodeHanziSegment(a,o,x);break;default:var m=a.readBits(d.getCharacterCountBits(t));switch(d){case ne.NUMERIC:r.decodeNumericSegment(a,o,m);break;case ne.ALPHANUMERIC:r.decodeAlphanumericSegment(a,o,m,l);break;case ne.BYTE:r.decodeByteSegment(a,o,m,c,s,i);break;case ne.KANJI:r.decodeKanjiSegment(a,o,m);break;default:throw new R}break}}while(d!==ne.TERMINATOR)}catch{throw new R}return new Pr(e,o.toString(),s.length===0?null:s,n===null?null:n.toString(),f,u)},r.decodeHanziSegment=function(e,t,n){if(n*13>e.available())throw new R;for(var i=new Uint8Array(2*n),a=0;n>0;){var o=e.readBits(13),s=o/96<<8&4294967295|o%96;s<959?s+=41377:s+=42657,i[a]=s>>8&255,i[a+1]=s&255,a+=2,n--}try{t.append(Ve.decode(i,$.GB2312))}catch(f){throw new R(f)}},r.decodeKanjiSegment=function(e,t,n){if(n*13>e.available())throw new R;for(var i=new Uint8Array(2*n),a=0;n>0;){var o=e.readBits(13),s=o/192<<8&4294967295|o%192;s<7936?s+=33088:s+=49472,i[a]=s>>8,i[a+1]=s,a+=2,n--}try{t.append(Ve.decode(i,$.SHIFT_JIS))}catch(f){throw new R(f)}},r.decodeByteSegment=function(e,t,n,i,a,o){if(8*n>e.available())throw new R;for(var s=new Uint8Array(n),f=0;f<n;f++)s[f]=e.readBits(8);var u;i===null?u=$.guessEncoding(s,o):u=i.getName();try{t.append(Ve.decode(s,u))}catch(c){throw new R(c)}a.push(s)},r.toAlphaNumericChar=function(e){if(e>=r.ALPHANUMERIC_CHARS.length)throw new R;return r.ALPHANUMERIC_CHARS[e]},r.decodeAlphanumericSegment=function(e,t,n,i){for(var a=t.length();n>1;){if(e.available()<11)throw new R;var o=e.readBits(11);t.append(r.toAlphaNumericChar(Math.floor(o/45))),t.append(r.toAlphaNumericChar(o%45)),n-=2}if(n===1){if(e.available()<6)throw new R;t.append(r.toAlphaNumericChar(e.readBits(6)))}if(i)for(var s=a;s<t.length();s++)t.charAt(s)==="%"&&(s<t.length()-1&&t.charAt(s+1)==="%"?t.deleteCharAt(s+1):t.setCharAt(s,""))},r.decodeNumericSegment=function(e,t,n){for(;n>=3;){if(e.available()<10)throw new R;var i=e.readBits(10);if(i>=1e3)throw new R;t.append(r.toAlphaNumericChar(Math.floor(i/100))),t.append(r.toAlphaNumericChar(Math.floor(i/10)%10)),t.append(r.toAlphaNumericChar(i%10)),n-=3}if(n===2){if(e.available()<7)throw new R;var a=e.readBits(7);if(a>=100)throw new R;t.append(r.toAlphaNumericChar(Math.floor(a/10))),t.append(r.toAlphaNumericChar(a%10))}else if(n===1){if(e.available()<4)throw new R;var o=e.readBits(4);if(o>=10)throw new R;t.append(r.toAlphaNumericChar(o))}},r.parseECIValue=function(e){var t=e.readBits(8);if((t&128)===0)return t&127;if((t&192)===128){var n=e.readBits(8);return(t&63)<<8&4294967295|n}if((t&224)===192){var i=e.readBits(16);return(t&31)<<16&4294967295|i}throw new R},r.ALPHANUMERIC_CHARS="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:",r.GB2312_SUBSET=1,r}(),so=function(){function r(e){this.mirrored=e}return r.prototype.isMirrored=function(){return this.mirrored},r.prototype.applyMirroredCorrection=function(e){if(!(!this.mirrored||e===null||e.length<3)){var t=e[0];e[0]=e[2],e[2]=t}},r}(),fo=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.")},Gc=function(){function r(){this.rsDecoder=new Fr(Re.QR_CODE_FIELD_256)}return r.prototype.decodeBooleanArray=function(e,t){return this.decodeBitMatrix(qe.parseFromBooleanArray(e),t)},r.prototype.decodeBitMatrix=function(e,t){var n=new Vc(e),i=null;try{return this.decodeBitMatrixParser(n,t)}catch(o){i=o}try{n.remask(),n.setMirror(!0),n.readVersion(),n.readFormatInformation(),n.mirror();var a=this.decodeBitMatrixParser(n,t);return a.setOther(new so(!0)),a}catch(o){throw i!==null?i:o}},r.prototype.decodeBitMatrixParser=function(e,t){var n,i,a,o,s=e.readVersion(),f=e.readFormatInformation().getErrorCorrectionLevel(),u=e.readCodewords(),c=Hc.getDataBlocks(u,s,f),l=0;try{for(var d=fo(c),h=d.next();!h.done;h=d.next()){var v=h.value;l+=v.getNumDataCodewords()}}catch(b){n={error:b}}finally{try{h&&!h.done&&(i=d.return)&&i.call(d)}finally{if(n)throw n.error}}var p=new Uint8Array(l),x=0;try{for(var m=fo(c),w=m.next();!w.done;w=m.next()){var v=w.value,C=v.getCodewords(),A=v.getNumDataCodewords();this.correctErrors(C,A);for(var _=0;_<A;_++)p[x++]=C[_]}}catch(b){a={error:b}}finally{try{w&&!w.done&&(o=m.return)&&o.call(m)}finally{if(a)throw a.error}}return zc.decode(p,s,f,t)},r.prototype.correctErrors=function(e,t){var n=new Int32Array(e);try{this.rsDecoder.decode(n,e.length-t)}catch{throw new pe}for(var i=0;i<t;i++)e[i]=n[i]},r}(),Wc=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)}}(),Xc=function(r){Wc(e,r);function e(t,n,i){var a=r.call(this,t,n)||this;return a.estimatedModuleSize=i,a}return e.prototype.aboutEquals=function(t,n,i){if(Math.abs(n-this.getY())<=t&&Math.abs(i-this.getX())<=t){var a=Math.abs(t-this.estimatedModuleSize);return a<=1||a<=this.estimatedModuleSize}return!1},e.prototype.combineEstimate=function(t,n,i){var a=(this.getX()+n)/2,o=(this.getY()+t)/2,s=(this.estimatedModuleSize+i)/2;return new e(a,o,s)},e}(k),$c=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.")},jc=function(){function r(e,t,n,i,a,o,s){this.image=e,this.startX=t,this.startY=n,this.width=i,this.height=a,this.moduleSize=o,this.resultPointCallback=s,this.possibleCenters=[],this.crossCheckStateCount=new Int32Array(3)}return r.prototype.find=function(){for(var e=this.startX,t=this.height,n=this.width,i=e+n,a=this.startY+t/2,o=new Int32Array(3),s=this.image,f=0;f<t;f++){var u=a+((f&1)===0?Math.floor((f+1)/2):-Math.floor((f+1)/2));o[0]=0,o[1]=0,o[2]=0;for(var c=e;c<i&&!s.get(c,u);)c++;for(var l=0;c<i;){if(s.get(c,u))if(l===1)o[1]++;else if(l===2){if(this.foundPatternCross(o)){var d=this.handlePossibleCenter(o,u,c);if(d!==null)return d}o[0]=o[2],o[1]=1,o[2]=0,l=1}else o[++l]++;else l===1&&l++,o[l]++;c++}if(this.foundPatternCross(o)){var d=this.handlePossibleCenter(o,u,i);if(d!==null)return d}}if(this.possibleCenters.length!==0)return this.possibleCenters[0];throw new N},r.centerFromEnd=function(e,t){return t-e[2]-e[1]/2},r.prototype.foundPatternCross=function(e){for(var t=this.moduleSize,n=t/2,i=0;i<3;i++)if(Math.abs(t-e[i])>=n)return!1;return!0},r.prototype.crossCheckVertical=function(e,t,n,i){var a=this.image,o=a.getHeight(),s=this.crossCheckStateCount;s[0]=0,s[1]=0,s[2]=0;for(var f=e;f>=0&&a.get(t,f)&&s[1]<=n;)s[1]++,f--;if(f<0||s[1]>n)return NaN;for(;f>=0&&!a.get(t,f)&&s[0]<=n;)s[0]++,f--;if(s[0]>n)return NaN;for(f=e+1;f<o&&a.get(t,f)&&s[1]<=n;)s[1]++,f++;if(f===o||s[1]>n)return NaN;for(;f<o&&!a.get(t,f)&&s[2]<=n;)s[2]++,f++;if(s[2]>n)return NaN;var u=s[0]+s[1]+s[2];return 5*Math.abs(u-i)>=2*i?NaN:this.foundPatternCross(s)?r.centerFromEnd(s,f):NaN},r.prototype.handlePossibleCenter=function(e,t,n){var i,a,o=e[0]+e[1]+e[2],s=r.centerFromEnd(e,n),f=this.crossCheckVertical(t,s,2*e[1],o);if(!isNaN(f)){var u=(e[0]+e[1]+e[2])/3;try{for(var c=$c(this.possibleCenters),l=c.next();!l.done;l=c.next()){var d=l.value;if(d.aboutEquals(u,f,s))return d.combineEstimate(f,s,u)}}catch(v){i={error:v}}finally{try{l&&!l.done&&(a=c.return)&&a.call(c)}finally{if(i)throw i.error}}var h=new Xc(s,f,u);this.possibleCenters.push(h),this.resultPointCallback!==null&&this.resultPointCallback!==void 0&&this.resultPointCallback.foundPossibleResultPoint(h)}return null},r}(),Yc=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)}}(),Zc=function(r){Yc(e,r);function e(t,n,i,a){var o=r.call(this,t,n)||this;return o.estimatedModuleSize=i,o.count=a,a===void 0&&(o.count=1),o}return e.prototype.getEstimatedModuleSize=function(){return this.estimatedModuleSize},e.prototype.getCount=function(){return this.count},e.prototype.aboutEquals=function(t,n,i){if(Math.abs(n-this.getY())<=t&&Math.abs(i-this.getX())<=t){var a=Math.abs(t-this.estimatedModuleSize);return a<=1||a<=this.estimatedModuleSize}return!1},e.prototype.combineEstimate=function(t,n,i){var a=this.count+1,o=(this.count*this.getX()+n)/a,s=(this.count*this.getY()+t)/a,f=(this.count*this.estimatedModuleSize+i)/a;return new e(o,s,f,a)},e}(k),Kc=function(){function r(e){this.bottomLeft=e[0],this.topLeft=e[1],this.topRight=e[2]}return r.prototype.getBottomLeft=function(){return this.bottomLeft},r.prototype.getTopLeft=function(){return this.topLeft},r.prototype.getTopRight=function(){return this.topRight},r}(),er=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.")},qc=function(){function r(e,t){this.image=e,this.resultPointCallback=t,this.possibleCenters=[],this.crossCheckStateCount=new Int32Array(5),this.resultPointCallback=t}return r.prototype.getImage=function(){return this.image},r.prototype.getPossibleCenters=function(){return this.possibleCenters},r.prototype.find=function(e){var t=e!=null&&e.get(oe.TRY_HARDER)!==void 0,n=e!=null&&e.get(oe.PURE_BARCODE)!==void 0,i=this.image,a=i.getHeight(),o=i.getWidth(),s=Math.floor(3*a/(4*r.MAX_MODULES));(s<r.MIN_SKIP||t)&&(s=r.MIN_SKIP);for(var f=!1,u=new Int32Array(5),c=s-1;c<a&&!f;c+=s){u[0]=0,u[1]=0,u[2]=0,u[3]=0,u[4]=0;for(var l=0,d=0;d<o;d++)if(i.get(d,c))(l&1)===1&&l++,u[l]++;else if((l&1)===0)if(l===4)if(r.foundPatternCross(u)){var h=this.handlePossibleCenter(u,c,d,n);if(h===!0)if(s=2,this.hasSkipped===!0)f=this.haveMultiplyConfirmedCenters();else{var v=this.findRowSkip();v>u[2]&&(c+=v-u[2]-s,d=o-1)}else{u[0]=u[2],u[1]=u[3],u[2]=u[4],u[3]=1,u[4]=0,l=3;continue}l=0,u[0]=0,u[1]=0,u[2]=0,u[3]=0,u[4]=0}else u[0]=u[2],u[1]=u[3],u[2]=u[4],u[3]=1,u[4]=0,l=3;else u[++l]++;else u[l]++;if(r.foundPatternCross(u)){var h=this.handlePossibleCenter(u,c,o,n);h===!0&&(s=u[0],this.hasSkipped&&(f=this.haveMultiplyConfirmedCenters()))}}var p=this.selectBestPatterns();return k.orderBestPatterns(p),new Kc(p)},r.centerFromEnd=function(e,t){return t-e[4]-e[3]-e[2]/2},r.foundPatternCross=function(e){for(var t=0,n=0;n<5;n++){var i=e[n];if(i===0)return!1;t+=i}if(t<7)return!1;var a=t/7,o=a/2;return Math.abs(a-e[0])<o&&Math.abs(a-e[1])<o&&Math.abs(3*a-e[2])<3*o&&Math.abs(a-e[3])<o&&Math.abs(a-e[4])<o},r.prototype.getCrossCheckStateCount=function(){var e=this.crossCheckStateCount;return e[0]=0,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e},r.prototype.crossCheckDiagonal=function(e,t,n,i){for(var a=this.getCrossCheckStateCount(),o=0,s=this.image;e>=o&&t>=o&&s.get(t-o,e-o);)a[2]++,o++;if(e<o||t<o)return!1;for(;e>=o&&t>=o&&!s.get(t-o,e-o)&&a[1]<=n;)a[1]++,o++;if(e<o||t<o||a[1]>n)return!1;for(;e>=o&&t>=o&&s.get(t-o,e-o)&&a[0]<=n;)a[0]++,o++;if(a[0]>n)return!1;var f=s.getHeight(),u=s.getWidth();for(o=1;e+o<f&&t+o<u&&s.get(t+o,e+o);)a[2]++,o++;if(e+o>=f||t+o>=u)return!1;for(;e+o<f&&t+o<u&&!s.get(t+o,e+o)&&a[3]<n;)a[3]++,o++;if(e+o>=f||t+o>=u||a[3]>=n)return!1;for(;e+o<f&&t+o<u&&s.get(t+o,e+o)&&a[4]<n;)a[4]++,o++;if(a[4]>=n)return!1;var c=a[0]+a[1]+a[2]+a[3]+a[4];return Math.abs(c-i)<2*i&&r.foundPatternCross(a)},r.prototype.crossCheckVertical=function(e,t,n,i){for(var a=this.image,o=a.getHeight(),s=this.getCrossCheckStateCount(),f=e;f>=0&&a.get(t,f);)s[2]++,f--;if(f<0)return NaN;for(;f>=0&&!a.get(t,f)&&s[1]<=n;)s[1]++,f--;if(f<0||s[1]>n)return NaN;for(;f>=0&&a.get(t,f)&&s[0]<=n;)s[0]++,f--;if(s[0]>n)return NaN;for(f=e+1;f<o&&a.get(t,f);)s[2]++,f++;if(f===o)return NaN;for(;f<o&&!a.get(t,f)&&s[3]<n;)s[3]++,f++;if(f===o||s[3]>=n)return NaN;for(;f<o&&a.get(t,f)&&s[4]<n;)s[4]++,f++;if(s[4]>=n)return NaN;var u=s[0]+s[1]+s[2]+s[3]+s[4];return 5*Math.abs(u-i)>=2*i?NaN:r.foundPatternCross(s)?r.centerFromEnd(s,f):NaN},r.prototype.crossCheckHorizontal=function(e,t,n,i){for(var a=this.image,o=a.getWidth(),s=this.getCrossCheckStateCount(),f=e;f>=0&&a.get(f,t);)s[2]++,f--;if(f<0)return NaN;for(;f>=0&&!a.get(f,t)&&s[1]<=n;)s[1]++,f--;if(f<0||s[1]>n)return NaN;for(;f>=0&&a.get(f,t)&&s[0]<=n;)s[0]++,f--;if(s[0]>n)return NaN;for(f=e+1;f<o&&a.get(f,t);)s[2]++,f++;if(f===o)return NaN;for(;f<o&&!a.get(f,t)&&s[3]<n;)s[3]++,f++;if(f===o||s[3]>=n)return NaN;for(;f<o&&a.get(f,t)&&s[4]<n;)s[4]++,f++;if(s[4]>=n)return NaN;var u=s[0]+s[1]+s[2]+s[3]+s[4];return 5*Math.abs(u-i)>=i?NaN:r.foundPatternCross(s)?r.centerFromEnd(s,f):NaN},r.prototype.handlePossibleCenter=function(e,t,n,i){var a=e[0]+e[1]+e[2]+e[3]+e[4],o=r.centerFromEnd(e,n),s=this.crossCheckVertical(t,Math.floor(o),e[2],a);if(!isNaN(s)&&(o=this.crossCheckHorizontal(Math.floor(o),Math.floor(s),e[2],a),!isNaN(o)&&(!i||this.crossCheckDiagonal(Math.floor(s),Math.floor(o),e[2],a)))){for(var f=a/7,u=!1,c=this.possibleCenters,l=0,d=c.length;l<d;l++){var h=c[l];if(h.aboutEquals(f,s,o)){c[l]=h.combineEstimate(s,o,f),u=!0;break}}if(!u){var v=new Zc(o,s,f);c.push(v),this.resultPointCallback!==null&&this.resultPointCallback!==void 0&&this.resultPointCallback.foundPossibleResultPoint(v)}return!0}return!1},r.prototype.findRowSkip=function(){var e,t,n=this.possibleCenters.length;if(n<=1)return 0;var i=null;try{for(var a=er(this.possibleCenters),o=a.next();!o.done;o=a.next()){var s=o.value;if(s.getCount()>=r.CENTER_QUORUM)if(i==null)i=s;else return this.hasSkipped=!0,Math.floor((Math.abs(i.getX()-s.getX())-Math.abs(i.getY()-s.getY()))/2)}}catch(f){e={error:f}}finally{try{o&&!o.done&&(t=a.return)&&t.call(a)}finally{if(e)throw e.error}}return 0},r.prototype.haveMultiplyConfirmedCenters=function(){var e,t,n,i,a=0,o=0,s=this.possibleCenters.length;try{for(var f=er(this.possibleCenters),u=f.next();!u.done;u=f.next()){var c=u.value;c.getCount()>=r.CENTER_QUORUM&&(a++,o+=c.getEstimatedModuleSize())}}catch(p){e={error:p}}finally{try{u&&!u.done&&(t=f.return)&&t.call(f)}finally{if(e)throw e.error}}if(a<3)return!1;var l=o/s,d=0;try{for(var h=er(this.possibleCenters),v=h.next();!v.done;v=h.next()){var c=v.value;d+=Math.abs(c.getEstimatedModuleSize()-l)}}catch(p){n={error:p}}finally{try{v&&!v.done&&(i=h.return)&&i.call(h)}finally{if(n)throw n.error}}return d<=.05*o},r.prototype.selectBestPatterns=function(){var e,t,n,i,a=this.possibleCenters.length;if(a<3)throw new N;var o=this.possibleCenters,s;if(a>3){var f=0,u=0;try{for(var c=er(this.possibleCenters),l=c.next();!l.done;l=c.next()){var d=l.value,h=d.getEstimatedModuleSize();f+=h,u+=h*h}}catch(_){e={error:_}}finally{try{l&&!l.done&&(t=c.return)&&t.call(c)}finally{if(e)throw e.error}}s=f/a;var v=Math.sqrt(u/a-s*s);o.sort(function(_,b){var T=Math.abs(b.getEstimatedModuleSize()-s),D=Math.abs(_.getEstimatedModuleSize()-s);return T<D?-1:T>D?1:0});for(var p=Math.max(.2*s,v),x=0;x<o.length&&o.length>3;x++){var m=o[x];Math.abs(m.getEstimatedModuleSize()-s)>p&&(o.splice(x,1),x--)}}if(o.length>3){var f=0;try{for(var w=er(o),C=w.next();!C.done;C=w.next()){var A=C.value;f+=A.getEstimatedModuleSize()}}catch(b){n={error:b}}finally{try{C&&!C.done&&(i=w.return)&&i.call(w)}finally{if(n)throw n.error}}s=f/o.length,o.sort(function(b,T){if(T.getCount()===b.getCount()){var D=Math.abs(T.getEstimatedModuleSize()-s),M=Math.abs(b.getEstimatedModuleSize()-s);return D<M?1:D>M?-1:0}else return T.getCount()-b.getCount()}),o.splice(3)}return[o[0],o[1],o[2]]},r.CENTER_QUORUM=2,r.MIN_SKIP=3,r.MAX_MODULES=57,r}(),Qc=function(){function r(e){this.image=e}return r.prototype.getImage=function(){return this.image},r.prototype.getResultPointCallback=function(){return this.resultPointCallback},r.prototype.detect=function(e){this.resultPointCallback=e==null?null:e.get(oe.NEED_RESULT_POINT_CALLBACK);var t=new qc(this.image,this.resultPointCallback),n=t.find(e);return this.processFinderPatternInfo(n)},r.prototype.processFinderPatternInfo=function(e){var t=e.getTopLeft(),n=e.getTopRight(),i=e.getBottomLeft(),a=this.calculateModuleSize(t,n,i);if(a<1)throw new N("No pattern found in proccess finder.");var o=r.computeDimension(t,n,i,a),s=wt.getProvisionalVersionForDimension(o),f=s.getDimensionForVersion()-7,u=null;if(s.getAlignmentPatternCenters().length>0)for(var c=n.getX()-t.getX()+i.getX(),l=n.getY()-t.getY()+i.getY(),d=1-3/f,h=Math.floor(t.getX()+d*(c-t.getX())),v=Math.floor(t.getY()+d*(l-t.getY())),p=4;p<=16;p<<=1)try{u=this.findAlignmentInRegion(a,h,v,p);break}catch(C){if(!(C instanceof N))throw C}var x=r.createTransform(t,n,i,u,o),m=r.sampleGrid(this.image,x,o),w;return u===null?w=[i,t,n]:w=[i,t,n,u],new Ln(m,w)},r.createTransform=function(e,t,n,i,a){var o=a-3.5,s,f,u,c;return i!==null?(s=i.getX(),f=i.getY(),u=o-3,c=u):(s=t.getX()-e.getX()+n.getX(),f=t.getY()-e.getY()+n.getY(),u=o,c=o),Ua.quadrilateralToQuadrilateral(3.5,3.5,o,3.5,u,c,3.5,o,e.getX(),e.getY(),t.getX(),t.getY(),s,f,n.getX(),n.getY())},r.sampleGrid=function(e,t,n){var i=Un.getInstance();return i.sampleGridWithTransform(e,n,n,t)},r.computeDimension=function(e,t,n,i){var a=Z.round(k.distance(e,t)/i),o=Z.round(k.distance(e,n)/i),s=Math.floor((a+o)/2)+7;switch(s&3){case 0:s++;break;case 2:s--;break;case 3:throw new N("Dimensions could be not found.")}return s},r.prototype.calculateModuleSize=function(e,t,n){return(this.calculateModuleSizeOneWay(e,t)+this.calculateModuleSizeOneWay(e,n))/2},r.prototype.calculateModuleSizeOneWay=function(e,t){var n=this.sizeOfBlackWhiteBlackRunBothWays(Math.floor(e.getX()),Math.floor(e.getY()),Math.floor(t.getX()),Math.floor(t.getY())),i=this.sizeOfBlackWhiteBlackRunBothWays(Math.floor(t.getX()),Math.floor(t.getY()),Math.floor(e.getX()),Math.floor(e.getY()));return isNaN(n)?i/7:isNaN(i)?n/7:(n+i)/14},r.prototype.sizeOfBlackWhiteBlackRunBothWays=function(e,t,n,i){var a=this.sizeOfBlackWhiteBlackRun(e,t,n,i),o=1,s=e-(n-e);s<0?(o=e/(e-s),s=0):s>=this.image.getWidth()&&(o=(this.image.getWidth()-1-e)/(s-e),s=this.image.getWidth()-1);var f=Math.floor(t-(i-t)*o);return o=1,f<0?(o=t/(t-f),f=0):f>=this.image.getHeight()&&(o=(this.image.getHeight()-1-t)/(f-t),f=this.image.getHeight()-1),s=Math.floor(e+(s-e)*o),a+=this.sizeOfBlackWhiteBlackRun(e,t,s,f),a-1},r.prototype.sizeOfBlackWhiteBlackRun=function(e,t,n,i){var a=Math.abs(i-t)>Math.abs(n-e);if(a){var o=e;e=t,t=o,o=n,n=i,i=o}for(var s=Math.abs(n-e),f=Math.abs(i-t),u=-s/2,c=e<n?1:-1,l=t<i?1:-1,d=0,h=n+c,v=e,p=t;v!==h;v+=c){var x=a?p:v,m=a?v:p;if(d===1===this.image.get(x,m)){if(d===2)return Z.distance(v,p,e,t);d++}if(u+=f,u>0){if(p===i)break;p+=l,u-=s}}return d===2?Z.distance(n+c,i,e,t):NaN},r.prototype.findAlignmentInRegion=function(e,t,n,i){var a=Math.floor(i*e),o=Math.max(0,t-a),s=Math.min(this.image.getWidth()-1,t+a);if(s-o<e*3)throw new N("Alignment top exceeds estimated module size.");var f=Math.max(0,n-a),u=Math.min(this.image.getHeight()-1,n+a);if(u-f<e*3)throw new N("Alignment bottom exceeds estimated module size.");var c=new jc(this.image,o,f,s-o,u-f,e,this.resultPointCallback);return c.find()},r}(),Yn=function(){function r(){this.decoder=new Gc}return r.prototype.getDecoder=function(){return this.decoder},r.prototype.decode=function(e,t){var n,i;if(t!=null&&t.get(oe.PURE_BARCODE)!==void 0){var a=r.extractPureBits(e.getBlackMatrix());n=this.decoder.decodeBitMatrix(a,t),i=r.NO_POINTS}else{var o=new Qc(e.getBlackMatrix()).detect(t);n=this.decoder.decodeBitMatrix(o.getBits(),t),i=o.getPoints()}n.getOther()instanceof so&&n.getOther().applyMirroredCorrection(i);var s=new Se(n.getText(),n.getRawBytes(),void 0,i,L.QR_CODE,void 0),f=n.getByteSegments();f!==null&&s.putMetadata(Ce.BYTE_SEGMENTS,f);var u=n.getECLevel();return u!==null&&s.putMetadata(Ce.ERROR_CORRECTION_LEVEL,u),n.hasStructuredAppend()&&(s.putMetadata(Ce.STRUCTURED_APPEND_SEQUENCE,n.getStructuredAppendSequenceNumber()),s.putMetadata(Ce.STRUCTURED_APPEND_PARITY,n.getStructuredAppendParity())),s},r.prototype.reset=function(){},r.extractPureBits=function(e){var t=e.getTopLeftOnBit(),n=e.getBottomRightOnBit();if(t===null||n===null)throw new N;var i=this.moduleSize(t,e),a=t[1],o=n[1],s=t[0],f=n[0];if(s>=f||a>=o)throw new N;if(o-a!==f-s&&(f=s+(o-a),f>=e.getWidth()))throw new N;var u=Math.round((f-s+1)/i),c=Math.round((o-a+1)/i);if(u<=0||c<=0)throw new N;if(c!==u)throw new N;var l=Math.floor(i/2);a+=l,s+=l;var d=s+Math.floor((u-1)*i)-f;if(d>0){if(d>l)throw new N;s-=d}var h=a+Math.floor((c-1)*i)-o;if(h>0){if(h>l)throw new N;a-=h}for(var v=new qe(u,c),p=0;p<c;p++)for(var x=a+Math.floor(p*i),m=0;m<u;m++)e.get(s+Math.floor(m*i),x)&&v.set(m,p);return v},r.moduleSize=function(e,t){for(var n=t.getHeight(),i=t.getWidth(),a=e[0],o=e[1],s=!0,f=0;a<i&&o<n;){if(s!==t.get(a,o)){if(++f===5)break;s=!s}a++,o++}if(a===i||o===n)throw new N;return(a-e[0])/7},r.NO_POINTS=new Array,r}(),Jc=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.")},Y=function(){function r(){}return r.prototype.PDF417Common=function(){},r.getBitCountSum=function(e){return Z.sum(e)},r.toIntArray=function(e){var t,n;if(e==null||!e.length)return r.EMPTY_INT_ARRAY;var i=new Int32Array(e.length),a=0;try{for(var o=Jc(e),s=o.next();!s.done;s=o.next()){var f=s.value;i[a++]=f}}catch(u){t={error:u}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(t)throw t.error}}return i},r.getCodeword=function(e){var t=fe.binarySearch(r.SYMBOL_TABLE,e&262143);return t<0?-1:(r.CODEWORD_TABLE[t]-1)%r.NUMBER_OF_CODEWORDS},r.NUMBER_OF_CODEWORDS=929,r.MAX_CODEWORDS_IN_BARCODE=r.NUMBER_OF_CODEWORDS-1,r.MIN_ROWS_IN_BARCODE=3,r.MAX_ROWS_IN_BARCODE=90,r.MODULES_IN_CODEWORD=17,r.MODULES_IN_STOP_PATTERN=18,r.BARS_IN_MODULE=8,r.EMPTY_INT_ARRAY=new Int32Array([]),r.SYMBOL_TABLE=Int32Array.from([66142,66170,66206,66236,66290,66292,66350,66382,66396,66454,66470,66476,66594,66600,66614,66626,66628,66632,66640,66654,66662,66668,66682,66690,66718,66720,66748,66758,66776,66798,66802,66804,66820,66824,66832,66846,66848,66876,66880,66936,66950,66956,66968,66992,67006,67022,67036,67042,67044,67048,67062,67118,67150,67164,67214,67228,67256,67294,67322,67350,67366,67372,67398,67404,67416,67438,67474,67476,67490,67492,67496,67510,67618,67624,67650,67656,67664,67678,67686,67692,67706,67714,67716,67728,67742,67744,67772,67782,67788,67800,67822,67826,67828,67842,67848,67870,67872,67900,67904,67960,67974,67992,68016,68030,68046,68060,68066,68068,68072,68086,68104,68112,68126,68128,68156,68160,68216,68336,68358,68364,68376,68400,68414,68448,68476,68494,68508,68536,68546,68548,68552,68560,68574,68582,68588,68654,68686,68700,68706,68708,68712,68726,68750,68764,68792,68802,68804,68808,68816,68830,68838,68844,68858,68878,68892,68920,68976,68990,68994,68996,69e3,69008,69022,69024,69052,69062,69068,69080,69102,69106,69108,69142,69158,69164,69190,69208,69230,69254,69260,69272,69296,69310,69326,69340,69386,69394,69396,69410,69416,69430,69442,69444,69448,69456,69470,69478,69484,69554,69556,69666,69672,69698,69704,69712,69726,69754,69762,69764,69776,69790,69792,69820,69830,69836,69848,69870,69874,69876,69890,69918,69920,69948,69952,70008,70022,70040,70064,70078,70094,70108,70114,70116,70120,70134,70152,70174,70176,70264,70384,70412,70448,70462,70496,70524,70542,70556,70584,70594,70600,70608,70622,70630,70636,70664,70672,70686,70688,70716,70720,70776,70896,71136,71180,71192,71216,71230,71264,71292,71360,71416,71452,71480,71536,71550,71554,71556,71560,71568,71582,71584,71612,71622,71628,71640,71662,71726,71732,71758,71772,71778,71780,71784,71798,71822,71836,71864,71874,71880,71888,71902,71910,71916,71930,71950,71964,71992,72048,72062,72066,72068,72080,72094,72096,72124,72134,72140,72152,72174,72178,72180,72206,72220,72248,72304,72318,72416,72444,72456,72464,72478,72480,72508,72512,72568,72588,72600,72624,72638,72654,72668,72674,72676,72680,72694,72726,72742,72748,72774,72780,72792,72814,72838,72856,72880,72894,72910,72924,72930,72932,72936,72950,72966,72972,72984,73008,73022,73056,73084,73102,73116,73144,73156,73160,73168,73182,73190,73196,73210,73226,73234,73236,73250,73252,73256,73270,73282,73284,73296,73310,73318,73324,73346,73348,73352,73360,73374,73376,73404,73414,73420,73432,73454,73498,73518,73522,73524,73550,73564,73570,73572,73576,73590,73800,73822,73858,73860,73872,73886,73888,73916,73944,73970,73972,73992,74014,74016,74044,74048,74104,74118,74136,74160,74174,74210,74212,74216,74230,74244,74256,74270,74272,74360,74480,74502,74508,74544,74558,74592,74620,74638,74652,74680,74690,74696,74704,74726,74732,74782,74784,74812,74992,75232,75288,75326,75360,75388,75456,75512,75576,75632,75646,75650,75652,75664,75678,75680,75708,75718,75724,75736,75758,75808,75836,75840,75896,76016,76256,76736,76824,76848,76862,76896,76924,76992,77048,77296,77340,77368,77424,77438,77536,77564,77572,77576,77584,77600,77628,77632,77688,77702,77708,77720,77744,77758,77774,77788,77870,77902,77916,77922,77928,77966,77980,78008,78018,78024,78032,78046,78060,78074,78094,78136,78192,78206,78210,78212,78224,78238,78240,78268,78278,78284,78296,78322,78324,78350,78364,78448,78462,78560,78588,78600,78622,78624,78652,78656,78712,78726,78744,78768,78782,78798,78812,78818,78820,78824,78838,78862,78876,78904,78960,78974,79072,79100,79296,79352,79368,79376,79390,79392,79420,79424,79480,79600,79628,79640,79664,79678,79712,79740,79772,79800,79810,79812,79816,79824,79838,79846,79852,79894,79910,79916,79942,79948,79960,79982,79988,80006,80024,80048,80062,80078,80092,80098,80100,80104,80134,80140,80176,80190,80224,80252,80270,80284,80312,80328,80336,80350,80358,80364,80378,80390,80396,80408,80432,80446,80480,80508,80576,80632,80654,80668,80696,80752,80766,80776,80784,80798,80800,80828,80844,80856,80878,80882,80884,80914,80916,80930,80932,80936,80950,80962,80968,80976,80990,80998,81004,81026,81028,81040,81054,81056,81084,81094,81100,81112,81134,81154,81156,81160,81168,81182,81184,81212,81216,81272,81286,81292,81304,81328,81342,81358,81372,81380,81384,81398,81434,81454,81458,81460,81486,81500,81506,81508,81512,81526,81550,81564,81592,81602,81604,81608,81616,81630,81638,81644,81702,81708,81722,81734,81740,81752,81774,81778,81780,82050,82078,82080,82108,82180,82184,82192,82206,82208,82236,82240,82296,82316,82328,82352,82366,82402,82404,82408,82440,82448,82462,82464,82492,82496,82552,82672,82694,82700,82712,82736,82750,82784,82812,82830,82882,82884,82888,82896,82918,82924,82952,82960,82974,82976,83004,83008,83064,83184,83424,83468,83480,83504,83518,83552,83580,83648,83704,83740,83768,83824,83838,83842,83844,83848,83856,83872,83900,83910,83916,83928,83950,83984,84e3,84028,84032,84088,84208,84448,84928,85040,85054,85088,85116,85184,85240,85488,85560,85616,85630,85728,85756,85764,85768,85776,85790,85792,85820,85824,85880,85894,85900,85912,85936,85966,85980,86048,86080,86136,86256,86496,86976,88160,88188,88256,88312,88560,89056,89200,89214,89312,89340,89536,89592,89608,89616,89632,89664,89720,89840,89868,89880,89904,89952,89980,89998,90012,90040,90190,90204,90254,90268,90296,90306,90308,90312,90334,90382,90396,90424,90480,90494,90500,90504,90512,90526,90528,90556,90566,90572,90584,90610,90612,90638,90652,90680,90736,90750,90848,90876,90884,90888,90896,90910,90912,90940,90944,91e3,91014,91020,91032,91056,91070,91086,91100,91106,91108,91112,91126,91150,91164,91192,91248,91262,91360,91388,91584,91640,91664,91678,91680,91708,91712,91768,91888,91928,91952,91966,92e3,92028,92046,92060,92088,92098,92100,92104,92112,92126,92134,92140,92188,92216,92272,92384,92412,92608,92664,93168,93200,93214,93216,93244,93248,93304,93424,93664,93720,93744,93758,93792,93820,93888,93944,93980,94008,94064,94078,94084,94088,94096,94110,94112,94140,94150,94156,94168,94246,94252,94278,94284,94296,94318,94342,94348,94360,94384,94398,94414,94428,94440,94470,94476,94488,94512,94526,94560,94588,94606,94620,94648,94658,94660,94664,94672,94686,94694,94700,94714,94726,94732,94744,94768,94782,94816,94844,94912,94968,94990,95004,95032,95088,95102,95112,95120,95134,95136,95164,95180,95192,95214,95218,95220,95244,95256,95280,95294,95328,95356,95424,95480,95728,95758,95772,95800,95856,95870,95968,95996,96008,96016,96030,96032,96060,96064,96120,96152,96176,96190,96220,96226,96228,96232,96290,96292,96296,96310,96322,96324,96328,96336,96350,96358,96364,96386,96388,96392,96400,96414,96416,96444,96454,96460,96472,96494,96498,96500,96514,96516,96520,96528,96542,96544,96572,96576,96632,96646,96652,96664,96688,96702,96718,96732,96738,96740,96744,96758,96772,96776,96784,96798,96800,96828,96832,96888,97008,97030,97036,97048,97072,97086,97120,97148,97166,97180,97208,97220,97224,97232,97246,97254,97260,97326,97330,97332,97358,97372,97378,97380,97384,97398,97422,97436,97464,97474,97476,97480,97488,97502,97510,97516,97550,97564,97592,97648,97666,97668,97672,97680,97694,97696,97724,97734,97740,97752,97774,97830,97836,97850,97862,97868,97880,97902,97906,97908,97926,97932,97944,97968,97998,98012,98018,98020,98024,98038,98618,98674,98676,98838,98854,98874,98892,98904,98926,98930,98932,98968,99006,99042,99044,99048,99062,99166,99194,99246,99286,99350,99366,99372,99386,99398,99416,99438,99442,99444,99462,99504,99518,99534,99548,99554,99556,99560,99574,99590,99596,99608,99632,99646,99680,99708,99726,99740,99768,99778,99780,99784,99792,99806,99814,99820,99834,99858,99860,99874,99880,99894,99906,99920,99934,99962,99970,99972,99976,99984,99998,1e5,100028,100038,100044,100056,100078,100082,100084,100142,100174,100188,100246,100262,100268,100306,100308,100390,100396,100410,100422,100428,100440,100462,100466,100468,100486,100504,100528,100542,100558,100572,100578,100580,100584,100598,100620,100656,100670,100704,100732,100750,100792,100802,100808,100816,100830,100838,100844,100858,100888,100912,100926,100960,100988,101056,101112,101148,101176,101232,101246,101250,101252,101256,101264,101278,101280,101308,101318,101324,101336,101358,101362,101364,101410,101412,101416,101430,101442,101448,101456,101470,101478,101498,101506,101508,101520,101534,101536,101564,101580,101618,101620,101636,101640,101648,101662,101664,101692,101696,101752,101766,101784,101838,101858,101860,101864,101934,101938,101940,101966,101980,101986,101988,101992,102030,102044,102072,102082,102084,102088,102096,102138,102166,102182,102188,102214,102220,102232,102254,102282,102290,102292,102306,102308,102312,102326,102444,102458,102470,102476,102488,102514,102516,102534,102552,102576,102590,102606,102620,102626,102632,102646,102662,102668,102704,102718,102752,102780,102798,102812,102840,102850,102856,102864,102878,102886,102892,102906,102936,102974,103008,103036,103104,103160,103224,103280,103294,103298,103300,103312,103326,103328,103356,103366,103372,103384,103406,103410,103412,103472,103486,103520,103548,103616,103672,103920,103992,104048,104062,104160,104188,104194,104196,104200,104208,104224,104252,104256,104312,104326,104332,104344,104368,104382,104398,104412,104418,104420,104424,104482,104484,104514,104520,104528,104542,104550,104570,104578,104580,104592,104606,104608,104636,104652,104690,104692,104706,104712,104734,104736,104764,104768,104824,104838,104856,104910,104930,104932,104936,104968,104976,104990,104992,105020,105024,105080,105200,105240,105278,105312,105372,105410,105412,105416,105424,105446,105518,105524,105550,105564,105570,105572,105576,105614,105628,105656,105666,105672,105680,105702,105722,105742,105756,105784,105840,105854,105858,105860,105864,105872,105888,105932,105970,105972,106006,106022,106028,106054,106060,106072,106100,106118,106124,106136,106160,106174,106190,106210,106212,106216,106250,106258,106260,106274,106276,106280,106306,106308,106312,106320,106334,106348,106394,106414,106418,106420,106566,106572,106610,106612,106630,106636,106648,106672,106686,106722,106724,106728,106742,106758,106764,106776,106800,106814,106848,106876,106894,106908,106936,106946,106948,106952,106960,106974,106982,106988,107032,107056,107070,107104,107132,107200,107256,107292,107320,107376,107390,107394,107396,107400,107408,107422,107424,107452,107462,107468,107480,107502,107506,107508,107544,107568,107582,107616,107644,107712,107768,108016,108060,108088,108144,108158,108256,108284,108290,108292,108296,108304,108318,108320,108348,108352,108408,108422,108428,108440,108464,108478,108494,108508,108514,108516,108520,108592,108640,108668,108736,108792,109040,109536,109680,109694,109792,109820,110016,110072,110084,110088,110096,110112,110140,110144,110200,110320,110342,110348,110360,110384,110398,110432,110460,110478,110492,110520,110532,110536,110544,110558,110658,110686,110714,110722,110724,110728,110736,110750,110752,110780,110796,110834,110836,110850,110852,110856,110864,110878,110880,110908,110912,110968,110982,111e3,111054,111074,111076,111080,111108,111112,111120,111134,111136,111164,111168,111224,111344,111372,111422,111456,111516,111554,111556,111560,111568,111590,111632,111646,111648,111676,111680,111736,111856,112096,112152,112224,112252,112320,112440,112514,112516,112520,112528,112542,112544,112588,112686,112718,112732,112782,112796,112824,112834,112836,112840,112848,112870,112890,112910,112924,112952,113008,113022,113026,113028,113032,113040,113054,113056,113100,113138,113140,113166,113180,113208,113264,113278,113376,113404,113416,113424,113440,113468,113472,113560,113614,113634,113636,113640,113686,113702,113708,113734,113740,113752,113778,113780,113798,113804,113816,113840,113854,113870,113890,113892,113896,113926,113932,113944,113968,113982,114016,114044,114076,114114,114116,114120,114128,114150,114170,114194,114196,114210,114212,114216,114242,114244,114248,114256,114270,114278,114306,114308,114312,114320,114334,114336,114364,114380,114420,114458,114478,114482,114484,114510,114524,114530,114532,114536,114842,114866,114868,114970,114994,114996,115042,115044,115048,115062,115130,115226,115250,115252,115278,115292,115298,115300,115304,115318,115342,115394,115396,115400,115408,115422,115430,115436,115450,115478,115494,115514,115526,115532,115570,115572,115738,115758,115762,115764,115790,115804,115810,115812,115816,115830,115854,115868,115896,115906,115912,115920,115934,115942,115948,115962,115996,116024,116080,116094,116098,116100,116104,116112,116126,116128,116156,116166,116172,116184,116206,116210,116212,116246,116262,116268,116282,116294,116300,116312,116334,116338,116340,116358,116364,116376,116400,116414,116430,116444,116450,116452,116456,116498,116500,116514,116520,116534,116546,116548,116552,116560,116574,116582,116588,116602,116654,116694,116714,116762,116782,116786,116788,116814,116828,116834,116836,116840,116854,116878,116892,116920,116930,116936,116944,116958,116966,116972,116986,117006,117048,117104,117118,117122,117124,117136,117150,117152,117180,117190,117196,117208,117230,117234,117236,117304,117360,117374,117472,117500,117506,117508,117512,117520,117536,117564,117568,117624,117638,117644,117656,117680,117694,117710,117724,117730,117732,117736,117750,117782,117798,117804,117818,117830,117848,117874,117876,117894,117936,117950,117966,117986,117988,117992,118022,118028,118040,118064,118078,118112,118140,118172,118210,118212,118216,118224,118238,118246,118266,118306,118312,118338,118352,118366,118374,118394,118402,118404,118408,118416,118430,118432,118460,118476,118514,118516,118574,118578,118580,118606,118620,118626,118628,118632,118678,118694,118700,118730,118738,118740,118830,118834,118836,118862,118876,118882,118884,118888,118902,118926,118940,118968,118978,118980,118984,118992,119006,119014,119020,119034,119068,119096,119152,119166,119170,119172,119176,119184,119198,119200,119228,119238,119244,119256,119278,119282,119284,119324,119352,119408,119422,119520,119548,119554,119556,119560,119568,119582,119584,119612,119616,119672,119686,119692,119704,119728,119742,119758,119772,119778,119780,119784,119798,119920,119934,120032,120060,120256,120312,120324,120328,120336,120352,120384,120440,120560,120582,120588,120600,120624,120638,120672,120700,120718,120732,120760,120770,120772,120776,120784,120798,120806,120812,120870,120876,120890,120902,120908,120920,120946,120948,120966,120972,120984,121008,121022,121038,121058,121060,121064,121078,121100,121112,121136,121150,121184,121212,121244,121282,121284,121288,121296,121318,121338,121356,121368,121392,121406,121440,121468,121536,121592,121656,121730,121732,121736,121744,121758,121760,121804,121842,121844,121890,121922,121924,121928,121936,121950,121958,121978,121986,121988,121992,122e3,122014,122016,122044,122060,122098,122100,122116,122120,122128,122142,122144,122172,122176,122232,122246,122264,122318,122338,122340,122344,122414,122418,122420,122446,122460,122466,122468,122472,122510,122524,122552,122562,122564,122568,122576,122598,122618,122646,122662,122668,122694,122700,122712,122738,122740,122762,122770,122772,122786,122788,122792,123018,123026,123028,123042,123044,123048,123062,123098,123146,123154,123156,123170,123172,123176,123190,123202,123204,123208,123216,123238,123244,123258,123290,123314,123316,123402,123410,123412,123426,123428,123432,123446,123458,123464,123472,123486,123494,123500,123514,123522,123524,123528,123536,123552,123580,123590,123596,123608,123630,123634,123636,123674,123698,123700,123740,123746,123748,123752,123834,123914,123922,123924,123938,123944,123958,123970,123976,123984,123998,124006,124012,124026,124034,124036,124048,124062,124064,124092,124102,124108,124120,124142,124146,124148,124162,124164,124168,124176,124190,124192,124220,124224,124280,124294,124300,124312,124336,124350,124366,124380,124386,124388,124392,124406,124442,124462,124466,124468,124494,124508,124514,124520,124558,124572,124600,124610,124612,124616,124624,124646,124666,124694,124710,124716,124730,124742,124748,124760,124786,124788,124818,124820,124834,124836,124840,124854,124946,124948,124962,124964,124968,124982,124994,124996,125e3,125008,125022,125030,125036,125050,125058,125060,125064,125072,125086,125088,125116,125126,125132,125144,125166,125170,125172,125186,125188,125192,125200,125216,125244,125248,125304,125318,125324,125336,125360,125374,125390,125404,125410,125412,125416,125430,125444,125448,125456,125472,125504,125560,125680,125702,125708,125720,125744,125758,125792,125820,125838,125852,125880,125890,125892,125896,125904,125918,125926,125932,125978,125998,126002,126004,126030,126044,126050,126052,126056,126094,126108,126136,126146,126148,126152,126160,126182,126202,126222,126236,126264,126320,126334,126338,126340,126344,126352,126366,126368,126412,126450,126452,126486,126502,126508,126522,126534,126540,126552,126574,126578,126580,126598,126604,126616,126640,126654,126670,126684,126690,126692,126696,126738,126754,126756,126760,126774,126786,126788,126792,126800,126814,126822,126828,126842,126894,126898,126900,126934,127126,127142,127148,127162,127178,127186,127188,127254,127270,127276,127290,127302,127308,127320,127342,127346,127348,127370,127378,127380,127394,127396,127400,127450,127510,127526,127532,127546,127558,127576,127598,127602,127604,127622,127628,127640,127664,127678,127694,127708,127714,127716,127720,127734,127754,127762,127764,127778,127784,127810,127812,127816,127824,127838,127846,127866,127898,127918,127922,127924,128022,128038,128044,128058,128070,128076,128088,128110,128114,128116,128134,128140,128152,128176,128190,128206,128220,128226,128228,128232,128246,128262,128268,128280,128304,128318,128352,128380,128398,128412,128440,128450,128452,128456,128464,128478,128486,128492,128506,128522,128530,128532,128546,128548,128552,128566,128578,128580,128584,128592,128606,128614,128634,128642,128644,128648,128656,128670,128672,128700,128716,128754,128756,128794,128814,128818,128820,128846,128860,128866,128868,128872,128886,128918,128934,128940,128954,128978,128980,129178,129198,129202,129204,129238,129258,129306,129326,129330,129332,129358,129372,129378,129380,129384,129398,129430,129446,129452,129466,129482,129490,129492,129562,129582,129586,129588,129614,129628,129634,129636,129640,129654,129678,129692,129720,129730,129732,129736,129744,129758,129766,129772,129814,129830,129836,129850,129862,129868,129880,129902,129906,129908,129930,129938,129940,129954,129956,129960,129974,130010]),r.CODEWORD_TABLE=Int32Array.from([2627,1819,2622,2621,1813,1812,2729,2724,2723,2779,2774,2773,902,896,908,868,865,861,859,2511,873,871,1780,835,2493,825,2491,842,837,844,1764,1762,811,810,809,2483,807,2482,806,2480,815,814,813,812,2484,817,816,1745,1744,1742,1746,2655,2637,2635,2626,2625,2623,2628,1820,2752,2739,2737,2728,2727,2725,2730,2785,2783,2778,2777,2775,2780,787,781,747,739,736,2413,754,752,1719,692,689,681,2371,678,2369,700,697,694,703,1688,1686,642,638,2343,631,2341,627,2338,651,646,643,2345,654,652,1652,1650,1647,1654,601,599,2322,596,2321,594,2319,2317,611,610,608,606,2324,603,2323,615,614,612,1617,1616,1614,1612,616,1619,1618,2575,2538,2536,905,901,898,909,2509,2507,2504,870,867,864,860,2512,875,872,1781,2490,2489,2487,2485,1748,836,834,832,830,2494,827,2492,843,841,839,845,1765,1763,2701,2676,2674,2653,2648,2656,2634,2633,2631,2629,1821,2638,2636,2770,2763,2761,2750,2745,2753,2736,2735,2733,2731,1848,2740,2738,2786,2784,591,588,576,569,566,2296,1590,537,534,526,2276,522,2274,545,542,539,548,1572,1570,481,2245,466,2242,462,2239,492,485,482,2249,496,494,1534,1531,1528,1538,413,2196,406,2191,2188,425,419,2202,415,2199,432,430,427,1472,1467,1464,433,1476,1474,368,367,2160,365,2159,362,2157,2155,2152,378,377,375,2166,372,2165,369,2162,383,381,379,2168,1419,1418,1416,1414,385,1411,384,1423,1422,1420,1424,2461,802,2441,2439,790,786,783,794,2409,2406,2403,750,742,738,2414,756,753,1720,2367,2365,2362,2359,1663,693,691,684,2373,680,2370,702,699,696,704,1690,1687,2337,2336,2334,2332,1624,2329,1622,640,637,2344,634,2342,630,2340,650,648,645,2346,655,653,1653,1651,1649,1655,2612,2597,2595,2571,2568,2565,2576,2534,2529,2526,1787,2540,2537,907,904,900,910,2503,2502,2500,2498,1768,2495,1767,2510,2508,2506,869,866,863,2513,876,874,1782,2720,2713,2711,2697,2694,2691,2702,2672,2670,2664,1828,2678,2675,2647,2646,2644,2642,1823,2639,1822,2654,2652,2650,2657,2771,1855,2765,2762,1850,1849,2751,2749,2747,2754,353,2148,344,342,336,2142,332,2140,345,1375,1373,306,2130,299,2128,295,2125,319,314,311,2132,1354,1352,1349,1356,262,257,2101,253,2096,2093,274,273,267,2107,263,2104,280,278,275,1316,1311,1308,1320,1318,2052,202,2050,2044,2040,219,2063,212,2060,208,2055,224,221,2066,1260,1258,1252,231,1248,229,1266,1264,1261,1268,155,1998,153,1996,1994,1991,1988,165,164,2007,162,2006,159,2003,2e3,172,171,169,2012,166,2010,1186,1184,1182,1179,175,1176,173,1192,1191,1189,1187,176,1194,1193,2313,2307,2305,592,589,2294,2292,2289,578,572,568,2297,580,1591,2272,2267,2264,1547,538,536,529,2278,525,2275,547,544,541,1574,1571,2237,2235,2229,1493,2225,1489,478,2247,470,2244,465,2241,493,488,484,2250,498,495,1536,1533,1530,1539,2187,2186,2184,2182,1432,2179,1430,2176,1427,414,412,2197,409,2195,405,2193,2190,426,424,421,2203,418,2201,431,429,1473,1471,1469,1466,434,1477,1475,2478,2472,2470,2459,2457,2454,2462,803,2437,2432,2429,1726,2443,2440,792,789,785,2401,2399,2393,1702,2389,1699,2411,2408,2405,745,741,2415,758,755,1721,2358,2357,2355,2353,1661,2350,1660,2347,1657,2368,2366,2364,2361,1666,690,687,2374,683,2372,701,698,705,1691,1689,2619,2617,2610,2608,2605,2613,2593,2588,2585,1803,2599,2596,2563,2561,2555,1797,2551,1795,2573,2570,2567,2577,2525,2524,2522,2520,1786,2517,1785,2514,1783,2535,2533,2531,2528,1788,2541,2539,906,903,911,2721,1844,2715,2712,1838,1836,2699,2696,2693,2703,1827,1826,1824,2673,2671,2669,2666,1829,2679,2677,1858,1857,2772,1854,1853,1851,1856,2766,2764,143,1987,139,1986,135,133,131,1984,128,1983,125,1981,138,137,136,1985,1133,1132,1130,112,110,1974,107,1973,104,1971,1969,122,121,119,117,1977,114,1976,124,1115,1114,1112,1110,1117,1116,84,83,1953,81,1952,78,1950,1948,1945,94,93,91,1959,88,1958,85,1955,99,97,95,1961,1086,1085,1083,1081,1078,100,1090,1089,1087,1091,49,47,1917,44,1915,1913,1910,1907,59,1926,56,1925,53,1922,1919,66,64,1931,61,1929,1042,1040,1038,71,1035,70,1032,68,1048,1047,1045,1043,1050,1049,12,10,1869,1867,1864,1861,21,1880,19,1877,1874,1871,28,1888,25,1886,22,1883,982,980,977,974,32,30,991,989,987,984,34,995,994,992,2151,2150,2147,2146,2144,356,355,354,2149,2139,2138,2136,2134,1359,343,341,338,2143,335,2141,348,347,346,1376,1374,2124,2123,2121,2119,1326,2116,1324,310,308,305,2131,302,2129,298,2127,320,318,316,313,2133,322,321,1355,1353,1351,1357,2092,2091,2089,2087,1276,2084,1274,2081,1271,259,2102,256,2100,252,2098,2095,272,269,2108,266,2106,281,279,277,1317,1315,1313,1310,282,1321,1319,2039,2037,2035,2032,1203,2029,1200,1197,207,2053,205,2051,201,2049,2046,2043,220,218,2064,215,2062,211,2059,228,226,223,2069,1259,1257,1254,232,1251,230,1267,1265,1263,2316,2315,2312,2311,2309,2314,2304,2303,2301,2299,1593,2308,2306,590,2288,2287,2285,2283,1578,2280,1577,2295,2293,2291,579,577,574,571,2298,582,581,1592,2263,2262,2260,2258,1545,2255,1544,2252,1541,2273,2271,2269,2266,1550,535,532,2279,528,2277,546,543,549,1575,1573,2224,2222,2220,1486,2217,1485,2214,1482,1479,2238,2236,2234,2231,1496,2228,1492,480,477,2248,473,2246,469,2243,490,487,2251,497,1537,1535,1532,2477,2476,2474,2479,2469,2468,2466,2464,1730,2473,2471,2453,2452,2450,2448,1729,2445,1728,2460,2458,2456,2463,805,804,2428,2427,2425,2423,1725,2420,1724,2417,1722,2438,2436,2434,2431,1727,2444,2442,793,791,788,795,2388,2386,2384,1697,2381,1696,2378,1694,1692,2402,2400,2398,2395,1703,2392,1701,2412,2410,2407,751,748,744,2416,759,757,1807,2620,2618,1806,1805,2611,2609,2607,2614,1802,1801,1799,2594,2592,2590,2587,1804,2600,2598,1794,1793,1791,1789,2564,2562,2560,2557,1798,2554,1796,2574,2572,2569,2578,1847,1846,2722,1843,1842,1840,1845,2716,2714,1835,1834,1832,1830,1839,1837,2700,2698,2695,2704,1817,1811,1810,897,862,1777,829,826,838,1760,1758,808,2481,1741,1740,1738,1743,2624,1818,2726,2776,782,740,737,1715,686,679,695,1682,1680,639,628,2339,647,644,1645,1643,1640,1648,602,600,597,595,2320,593,2318,609,607,604,1611,1610,1608,1606,613,1615,1613,2328,926,924,892,886,899,857,850,2505,1778,824,823,821,819,2488,818,2486,833,831,828,840,1761,1759,2649,2632,2630,2746,2734,2732,2782,2781,570,567,1587,531,527,523,540,1566,1564,476,467,463,2240,486,483,1524,1521,1518,1529,411,403,2192,399,2189,423,416,1462,1457,1454,428,1468,1465,2210,366,363,2158,360,2156,357,2153,376,373,370,2163,1410,1409,1407,1405,382,1402,380,1417,1415,1412,1421,2175,2174,777,774,771,784,732,725,722,2404,743,1716,676,674,668,2363,665,2360,685,1684,1681,626,624,622,2335,620,2333,617,2330,641,635,649,1646,1644,1642,2566,928,925,2530,2527,894,891,888,2501,2499,2496,858,856,854,851,1779,2692,2668,2665,2645,2643,2640,2651,2768,2759,2757,2744,2743,2741,2748,352,1382,340,337,333,1371,1369,307,300,296,2126,315,312,1347,1342,1350,261,258,250,2097,246,2094,271,268,264,1306,1301,1298,276,1312,1309,2115,203,2048,195,2045,191,2041,213,209,2056,1246,1244,1238,225,1234,222,1256,1253,1249,1262,2080,2079,154,1997,150,1995,147,1992,1989,163,160,2004,156,2001,1175,1174,1172,1170,1167,170,1164,167,1185,1183,1180,1177,174,1190,1188,2025,2024,2022,587,586,564,559,556,2290,573,1588,520,518,512,2268,508,2265,530,1568,1565,461,457,2233,450,2230,446,2226,479,471,489,1526,1523,1520,397,395,2185,392,2183,389,2180,2177,410,2194,402,422,1463,1461,1459,1456,1470,2455,799,2433,2430,779,776,773,2397,2394,2390,734,728,724,746,1717,2356,2354,2351,2348,1658,677,675,673,670,667,688,1685,1683,2606,2589,2586,2559,2556,2552,927,2523,2521,2518,2515,1784,2532,895,893,890,2718,2709,2707,2689,2687,2684,2663,2662,2660,2658,1825,2667,2769,1852,2760,2758,142,141,1139,1138,134,132,129,126,1982,1129,1128,1126,1131,113,111,108,105,1972,101,1970,120,118,115,1109,1108,1106,1104,123,1113,1111,82,79,1951,75,1949,72,1946,92,89,86,1956,1077,1076,1074,1072,98,1069,96,1084,1082,1079,1088,1968,1967,48,45,1916,42,1914,39,1911,1908,60,57,54,1923,50,1920,1031,1030,1028,1026,67,1023,65,1020,62,1041,1039,1036,1033,69,1046,1044,1944,1943,1941,11,9,1868,7,1865,1862,1859,20,1878,16,1875,13,1872,970,968,966,963,29,960,26,23,983,981,978,975,33,971,31,990,988,985,1906,1904,1902,993,351,2145,1383,331,330,328,326,2137,323,2135,339,1372,1370,294,293,291,289,2122,286,2120,283,2117,309,303,317,1348,1346,1344,245,244,242,2090,239,2088,236,2085,2082,260,2099,249,270,1307,1305,1303,1300,1314,189,2038,186,2036,183,2033,2030,2026,206,198,2047,194,216,1247,1245,1243,1240,227,1237,1255,2310,2302,2300,2286,2284,2281,565,563,561,558,575,1589,2261,2259,2256,2253,1542,521,519,517,514,2270,511,533,1569,1567,2223,2221,2218,2215,1483,2211,1480,459,456,453,2232,449,474,491,1527,1525,1522,2475,2467,2465,2451,2449,2446,801,800,2426,2424,2421,2418,1723,2435,780,778,775,2387,2385,2382,2379,1695,2375,1693,2396,735,733,730,727,749,1718,2616,2615,2604,2603,2601,2584,2583,2581,2579,1800,2591,2550,2549,2547,2545,1792,2542,1790,2558,929,2719,1841,2710,2708,1833,1831,2690,2688,2686,1815,1809,1808,1774,1756,1754,1737,1736,1734,1739,1816,1711,1676,1674,633,629,1638,1636,1633,1641,598,1605,1604,1602,1600,605,1609,1607,2327,887,853,1775,822,820,1757,1755,1584,524,1560,1558,468,464,1514,1511,1508,1519,408,404,400,1452,1447,1444,417,1458,1455,2208,364,361,358,2154,1401,1400,1398,1396,374,1393,371,1408,1406,1403,1413,2173,2172,772,726,723,1712,672,669,666,682,1678,1675,625,623,621,618,2331,636,632,1639,1637,1635,920,918,884,880,889,849,848,847,846,2497,855,852,1776,2641,2742,2787,1380,334,1367,1365,301,297,1340,1338,1335,1343,255,251,247,1296,1291,1288,265,1302,1299,2113,204,196,192,2042,1232,1230,1224,214,1220,210,1242,1239,1235,1250,2077,2075,151,148,1993,144,1990,1163,1162,1160,1158,1155,161,1152,157,1173,1171,1168,1165,168,1181,1178,2021,2020,2018,2023,585,560,557,1585,516,509,1562,1559,458,447,2227,472,1516,1513,1510,398,396,393,390,2181,386,2178,407,1453,1451,1449,1446,420,1460,2209,769,764,720,712,2391,729,1713,664,663,661,659,2352,656,2349,671,1679,1677,2553,922,919,2519,2516,885,883,881,2685,2661,2659,2767,2756,2755,140,1137,1136,130,127,1125,1124,1122,1127,109,106,102,1103,1102,1100,1098,116,1107,1105,1980,80,76,73,1947,1068,1067,1065,1063,90,1060,87,1075,1073,1070,1080,1966,1965,46,43,40,1912,36,1909,1019,1018,1016,1014,58,1011,55,1008,51,1029,1027,1024,1021,63,1037,1034,1940,1939,1937,1942,8,1866,4,1863,1,1860,956,954,952,949,946,17,14,969,967,964,961,27,957,24,979,976,972,1901,1900,1898,1896,986,1905,1903,350,349,1381,329,327,324,1368,1366,292,290,287,284,2118,304,1341,1339,1337,1345,243,240,237,2086,233,2083,254,1297,1295,1293,1290,1304,2114,190,187,184,2034,180,2031,177,2027,199,1233,1231,1229,1226,217,1223,1241,2078,2076,584,555,554,552,550,2282,562,1586,507,506,504,502,2257,499,2254,515,1563,1561,445,443,441,2219,438,2216,435,2212,460,454,475,1517,1515,1512,2447,798,797,2422,2419,770,768,766,2383,2380,2376,721,719,717,714,731,1714,2602,2582,2580,2548,2546,2543,923,921,2717,2706,2705,2683,2682,2680,1771,1752,1750,1733,1732,1731,1735,1814,1707,1670,1668,1631,1629,1626,1634,1599,1598,1596,1594,1603,1601,2326,1772,1753,1751,1581,1554,1552,1504,1501,1498,1509,1442,1437,1434,401,1448,1445,2206,1392,1391,1389,1387,1384,359,1399,1397,1394,1404,2171,2170,1708,1672,1669,619,1632,1630,1628,1773,1378,1363,1361,1333,1328,1336,1286,1281,1278,248,1292,1289,2111,1218,1216,1210,197,1206,193,1228,1225,1221,1236,2073,2071,1151,1150,1148,1146,152,1143,149,1140,145,1161,1159,1156,1153,158,1169,1166,2017,2016,2014,2019,1582,510,1556,1553,452,448,1506,1500,394,391,387,1443,1441,1439,1436,1450,2207,765,716,713,1709,662,660,657,1673,1671,916,914,879,878,877,882,1135,1134,1121,1120,1118,1123,1097,1096,1094,1092,103,1101,1099,1979,1059,1058,1056,1054,77,1051,74,1066,1064,1061,1071,1964,1963,1007,1006,1004,1002,999,41,996,37,1017,1015,1012,1009,52,1025,1022,1936,1935,1933,1938,942,940,938,935,932,5,2,955,953,950,947,18,943,15,965,962,958,1895,1894,1892,1890,973,1899,1897,1379,325,1364,1362,288,285,1334,1332,1330,241,238,234,1287,1285,1283,1280,1294,2112,188,185,181,178,2028,1219,1217,1215,1212,200,1209,1227,2074,2072,583,553,551,1583,505,503,500,513,1557,1555,444,442,439,436,2213,455,451,1507,1505,1502,796,763,762,760,767,711,710,708,706,2377,718,715,1710,2544,917,915,2681,1627,1597,1595,2325,1769,1749,1747,1499,1438,1435,2204,1390,1388,1385,1395,2169,2167,1704,1665,1662,1625,1623,1620,1770,1329,1282,1279,2109,1214,1207,1222,2068,2065,1149,1147,1144,1141,146,1157,1154,2013,2011,2008,2015,1579,1549,1546,1495,1487,1433,1431,1428,1425,388,1440,2205,1705,658,1667,1664,1119,1095,1093,1978,1057,1055,1052,1062,1962,1960,1005,1003,1e3,997,38,1013,1010,1932,1930,1927,1934,941,939,936,933,6,930,3,951,948,944,1889,1887,1884,1881,959,1893,1891,35,1377,1360,1358,1327,1325,1322,1331,1277,1275,1272,1269,235,1284,2110,1205,1204,1201,1198,182,1195,179,1213,2070,2067,1580,501,1551,1548,440,437,1497,1494,1490,1503,761,709,707,1706,913,912,2198,1386,2164,2161,1621,1766,2103,1208,2058,2054,1145,1142,2005,2002,1999,2009,1488,1429,1426,2200,1698,1659,1656,1975,1053,1957,1954,1001,998,1924,1921,1918,1928,937,934,931,1879,1876,1873,1870,945,1885,1882,1323,1273,1270,2105,1202,1199,1196,1211,2061,2057,1576,1543,1540,1484,1481,1478,1491,1700]),r}(),el=function(){function r(e,t){this.bits=e,this.points=t}return r.prototype.getBits=function(){return this.bits},r.prototype.getPoints=function(){return this.points},r}(),tl=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.")},rl=function(){function r(){}return r.detectMultiple=function(e,t,n){var i=e.getBlackMatrix(),a=r.detect(n,i);return a.length||(i=i.clone(),i.rotate180(),a=r.detect(n,i)),new el(i,a)},r.detect=function(e,t){for(var n,i,a=new Array,o=0,s=0,f=!1;o<t.getHeight();){var u=r.findVertices(t,o,s);if(u[0]==null&&u[3]==null){if(!f)break;f=!1,s=0;try{for(var c=(n=void 0,tl(a)),l=c.next();!l.done;l=c.next()){var d=l.value;d[1]!=null&&(o=Math.trunc(Math.max(o,d[1].getY()))),d[3]!=null&&(o=Math.max(o,Math.trunc(d[3].getY())))}}catch(h){n={error:h}}finally{try{l&&!l.done&&(i=c.return)&&i.call(c)}finally{if(n)throw n.error}}o+=r.ROW_STEP;continue}if(f=!0,a.push(u),!e)break;u[2]!=null?(s=Math.trunc(u[2].getX()),o=Math.trunc(u[2].getY())):(s=Math.trunc(u[4].getX()),o=Math.trunc(u[4].getY()))}return a},r.findVertices=function(e,t,n){var i=e.getHeight(),a=e.getWidth(),o=new Array(8);return r.copyToResult(o,r.findRowsWithPattern(e,i,a,t,n,r.START_PATTERN),r.INDEXES_START_PATTERN),o[4]!=null&&(n=Math.trunc(o[4].getX()),t=Math.trunc(o[4].getY())),r.copyToResult(o,r.findRowsWithPattern(e,i,a,t,n,r.STOP_PATTERN),r.INDEXES_STOP_PATTERN),o},r.copyToResult=function(e,t,n){for(var i=0;i<n.length;i++)e[n[i]]=t[i]},r.findRowsWithPattern=function(e,t,n,i,a,o){for(var s=new Array(4),f=!1,u=new Int32Array(o.length);i<t;i+=r.ROW_STEP){var c=r.findGuardPattern(e,a,i,n,!1,o,u);if(c!=null){for(;i>0;){var l=r.findGuardPattern(e,a,--i,n,!1,o,u);if(l!=null)c=l;else{i++;break}}s[0]=new k(c[0],i),s[1]=new k(c[1],i),f=!0;break}}var d=i+1;if(f){for(var h=0,l=Int32Array.from([Math.trunc(s[0].getX()),Math.trunc(s[1].getX())]);d<t;d++){var c=r.findGuardPattern(e,l[0],d,n,!1,o,u);if(c!=null&&Math.abs(l[0]-c[0])<r.MAX_PATTERN_DRIFT&&Math.abs(l[1]-c[1])<r.MAX_PATTERN_DRIFT)l=c,h=0;else{if(h>r.SKIPPED_ROW_COUNT_MAX)break;h++}}d-=h+1,s[2]=new k(l[0],d),s[3]=new k(l[1],d)}return d-i<r.BARCODE_MIN_HEIGHT&&fe.fill(s,null),s},r.findGuardPattern=function(e,t,n,i,a,o,s){fe.fillWithin(s,0,s.length,0);for(var f=t,u=0;e.get(f,n)&&f>0&&u++<r.MAX_PIXEL_DRIFT;)f--;for(var c=f,l=0,d=o.length,h=a;c<i;c++){var v=e.get(c,n);if(v!==h)s[l]++;else{if(l===d-1){if(r.patternMatchVariance(s,o,r.MAX_INDIVIDUAL_VARIANCE)<r.MAX_AVG_VARIANCE)return new Int32Array([f,c]);f+=s[0]+s[1],re.arraycopy(s,2,s,0,l-1),s[l-1]=0,s[l]=0,l--}else l++;s[l]=1,h=!h}}return l===d-1&&r.patternMatchVariance(s,o,r.MAX_INDIVIDUAL_VARIANCE)<r.MAX_AVG_VARIANCE?new Int32Array([f,c-1]):null},r.patternMatchVariance=function(e,t,n){for(var i=e.length,a=0,o=0,s=0;s<i;s++)a+=e[s],o+=t[s];if(a<o)return 1/0;var f=a/o;n*=f;for(var u=0,c=0;c<i;c++){var l=e[c],d=t[c]*f,h=l>d?l-d:d-l;if(h>n)return 1/0;u+=h}return u/a},r.INDEXES_START_PATTERN=Int32Array.from([0,4,1,5]),r.INDEXES_STOP_PATTERN=Int32Array.from([6,2,7,3]),r.MAX_AVG_VARIANCE=.42,r.MAX_INDIVIDUAL_VARIANCE=.8,r.START_PATTERN=Int32Array.from([8,1,1,1,1,1,1,3]),r.STOP_PATTERN=Int32Array.from([7,1,1,3,1,1,1,2,1]),r.MAX_PIXEL_DRIFT=3,r.MAX_PATTERN_DRIFT=5,r.SKIPPED_ROW_COUNT_MAX=25,r.ROW_STEP=5,r.BARCODE_MIN_HEIGHT=10,r}(),nl=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.")},mt=function(){function r(e,t){if(t.length===0)throw new V;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=new Int32Array([0]):(this.coefficients=new Int32Array(n-i),re.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){var t,n;if(e===0)return this.getCoefficient(0);if(e===1){var i=0;try{for(var a=nl(this.coefficients),o=a.next();!o.done;o=a.next()){var s=o.value;i=this.field.add(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}for(var f=this.coefficients[0],u=this.coefficients.length,c=1;c<u;c++)f=this.field.add(this.field.multiply(e,f),this.coefficients[c]);return f},r.prototype.add=function(e){if(!this.field.equals(e.field))throw new V("ModulusPolys do not have same ModulusGF 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;re.arraycopy(n,0,a,0,o);for(var s=o;s<n.length;s++)a[s]=this.field.add(t[s-o],n[s]);return new r(this.field,a)},r.prototype.subtract=function(e){if(!this.field.equals(e.field))throw new V("ModulusPolys do not have same ModulusGF field");return e.isZero()?this:this.add(e.negative())},r.prototype.multiply=function(e){return e instanceof r?this.multiplyOther(e):this.multiplyScalar(e)},r.prototype.multiplyOther=function(e){if(!this.field.equals(e.field))throw new V("ModulusPolys do not have same ModulusGF field");if(this.isZero()||e.isZero())return new r(this.field,new Int32Array([0]));for(var t=this.coefficients,n=t.length,i=e.coefficients,a=i.length,o=new Int32Array(n+a-1),s=0;s<n;s++)for(var f=t[s],u=0;u<a;u++)o[s+u]=this.field.add(o[s+u],this.field.multiply(f,i[u]));return new r(this.field,o)},r.prototype.negative=function(){for(var e=this.coefficients.length,t=new Int32Array(e),n=0;n<e;n++)t[n]=this.field.subtract(0,this.coefficients[n]);return new r(this.field,t)},r.prototype.multiplyScalar=function(e){if(e===0)return new r(this.field,new Int32Array([0]));if(e===1)return this;for(var t=this.coefficients.length,n=new Int32Array(t),i=0;i<t;i++)n[i]=this.field.multiply(this.coefficients[i],e);return new r(this.field,n)},r.prototype.multiplyByMonomial=function(e,t){if(e<0)throw new V;if(t===0)return new r(this.field,new Int32Array([0]));for(var n=this.coefficients.length,i=new Int32Array(n+e),a=0;a<n;a++)i[a]=this.field.multiply(this.coefficients[a],t);return new r(this.field,i)},r.prototype.toString=function(){for(var e=new z,t=this.getDegree();t>=0;t--){var n=this.getCoefficient(t);n!==0&&(n<0?(e.append(" - "),n=-n):e.length()>0&&e.append(" + "),(t===0||n!==1)&&e.append(n),t!==0&&(t===1?e.append("x"):(e.append("x^"),e.append(t))))}return e.toString()},r}(),il=function(){function r(){}return r.prototype.add=function(e,t){return(e+t)%this.modulus},r.prototype.subtract=function(e,t){return(this.modulus+e-t)%this.modulus},r.prototype.exp=function(e){return this.expTable[e]},r.prototype.log=function(e){if(e===0)throw new V;return this.logTable[e]},r.prototype.inverse=function(e){if(e===0)throw new Ba;return this.expTable[this.modulus-this.logTable[e]-1]},r.prototype.multiply=function(e,t){return e===0||t===0?0:this.expTable[(this.logTable[e]+this.logTable[t])%(this.modulus-1)]},r.prototype.getSize=function(){return this.modulus},r.prototype.equals=function(e){return e===this},r}(),al=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)}}(),ol=function(r){al(e,r);function e(t,n){var i=r.call(this)||this;i.modulus=t,i.expTable=new Int32Array(t),i.logTable=new Int32Array(t);for(var a=1,o=0;o<t;o++)i.expTable[o]=a,a=a*n%t;for(var o=0;o<t-1;o++)i.logTable[i.expTable[o]]=o;return i.zero=new mt(i,new Int32Array([0])),i.one=new mt(i,new Int32Array([1])),i}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 V;if(n===0)return this.zero;var i=new Int32Array(t+1);return i[0]=n,new mt(this,i)},e.PDF417_GF=new e(Y.NUMBER_OF_CODEWORDS,3),e}(il),sl=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.")},fl=function(){function r(){this.field=ol.PDF417_GF}return r.prototype.decode=function(e,t,n){for(var i,a,o=new mt(this.field,e),s=new Int32Array(t),f=!1,u=t;u>0;u--){var c=o.evaluateAt(this.field.exp(u));s[t-u]=c,c!==0&&(f=!0)}if(!f)return 0;var l=this.field.getOne();if(n!=null)try{for(var d=sl(n),h=d.next();!h.done;h=d.next()){var v=h.value,p=this.field.exp(e.length-1-v),x=new mt(this.field,new Int32Array([this.field.subtract(0,p),1]));l=l.multiply(x)}}catch(D){i={error:D}}finally{try{h&&!h.done&&(a=d.return)&&a.call(d)}finally{if(i)throw i.error}}for(var m=new mt(this.field,s),w=this.runEuclideanAlgorithm(this.field.buildMonomial(t,1),m,t),C=w[0],A=w[1],_=this.findErrorLocations(C),b=this.findErrorMagnitudes(A,C,_),u=0;u<_.length;u++){var T=e.length-1-this.field.log(_[u]);if(T<0)throw pe.getChecksumInstance();e[T]=this.field.subtract(e[T],b[u])}return _.length},r.prototype.runEuclideanAlgorithm=function(e,t,n){if(e.getDegree()<t.getDegree()){var i=e;e=t,t=i}for(var a=e,o=t,s=this.field.getZero(),f=this.field.getOne();o.getDegree()>=Math.round(n/2);){var u=a,c=s;if(a=o,s=f,a.isZero())throw pe.getChecksumInstance();o=u;for(var l=this.field.getZero(),d=a.getCoefficient(a.getDegree()),h=this.field.inverse(d);o.getDegree()>=a.getDegree()&&!o.isZero();){var v=o.getDegree()-a.getDegree(),p=this.field.multiply(o.getCoefficient(o.getDegree()),h);l=l.add(this.field.buildMonomial(v,p)),o=o.subtract(a.multiplyByMonomial(v,p))}f=l.multiply(s).subtract(c).negative()}var x=f.getCoefficient(0);if(x===0)throw pe.getChecksumInstance();var m=this.field.inverse(x),w=f.multiply(m),C=o.multiply(m);return[w,C]},r.prototype.findErrorLocations=function(e){for(var t=e.getDegree(),n=new Int32Array(t),i=0,a=1;a<this.field.getSize()&&i<t;a++)e.evaluateAt(a)===0&&(n[i]=this.field.inverse(a),i++);if(i!==t)throw pe.getChecksumInstance();return n},r.prototype.findErrorMagnitudes=function(e,t,n){for(var i=t.getDegree(),a=new Int32Array(i),o=1;o<=i;o++)a[i-o]=this.field.multiply(o,t.getCoefficient(o));for(var s=new mt(this.field,a),f=n.length,u=new Int32Array(f),o=0;o<f;o++){var c=this.field.inverse(n[o]),l=this.field.subtract(0,e.evaluateAt(c)),d=this.field.inverse(s.evaluateAt(c));u[o]=this.field.multiply(l,d)}return u},r}(),Zn=function(){function r(e,t,n,i,a){e instanceof r?this.constructor_2(e):this.constructor_1(e,t,n,i,a)}return r.prototype.constructor_1=function(e,t,n,i,a){var o=t==null||n==null,s=i==null||a==null;if(o&&s)throw new N;o?(t=new k(0,i.getY()),n=new k(0,a.getY())):s&&(i=new k(e.getWidth()-1,t.getY()),a=new k(e.getWidth()-1,n.getY())),this.image=e,this.topLeft=t,this.bottomLeft=n,this.topRight=i,this.bottomRight=a,this.minX=Math.trunc(Math.min(t.getX(),n.getX())),this.maxX=Math.trunc(Math.max(i.getX(),a.getX())),this.minY=Math.trunc(Math.min(t.getY(),i.getY())),this.maxY=Math.trunc(Math.max(n.getY(),a.getY()))},r.prototype.constructor_2=function(e){this.image=e.image,this.topLeft=e.getTopLeft(),this.bottomLeft=e.getBottomLeft(),this.topRight=e.getTopRight(),this.bottomRight=e.getBottomRight(),this.minX=e.getMinX(),this.maxX=e.getMaxX(),this.minY=e.getMinY(),this.maxY=e.getMaxY()},r.merge=function(e,t){return e==null?t:t==null?e:new r(e.image,e.topLeft,e.bottomLeft,t.topRight,t.bottomRight)},r.prototype.addMissingRows=function(e,t,n){var i=this.topLeft,a=this.bottomLeft,o=this.topRight,s=this.bottomRight;if(e>0){var f=n?this.topLeft:this.topRight,u=Math.trunc(f.getY()-e);u<0&&(u=0);var c=new k(f.getX(),u);n?i=c:o=c}if(t>0){var l=n?this.bottomLeft:this.bottomRight,d=Math.trunc(l.getY()+t);d>=this.image.getHeight()&&(d=this.image.getHeight()-1);var h=new k(l.getX(),d);n?a=h:s=h}return new r(this.image,i,a,o,s)},r.prototype.getMinX=function(){return this.minX},r.prototype.getMaxX=function(){return this.maxX},r.prototype.getMinY=function(){return this.minY},r.prototype.getMaxY=function(){return this.maxY},r.prototype.getTopLeft=function(){return this.topLeft},r.prototype.getTopRight=function(){return this.topRight},r.prototype.getBottomLeft=function(){return this.bottomLeft},r.prototype.getBottomRight=function(){return this.bottomRight},r}(),ul=function(){function r(e,t,n,i){this.columnCount=e,this.errorCorrectionLevel=i,this.rowCountUpperPart=t,this.rowCountLowerPart=n,this.rowCount=t+n}return r.prototype.getColumnCount=function(){return this.columnCount},r.prototype.getErrorCorrectionLevel=function(){return this.errorCorrectionLevel},r.prototype.getRowCount=function(){return this.rowCount},r.prototype.getRowCountUpperPart=function(){return this.rowCountUpperPart},r.prototype.getRowCountLowerPart=function(){return this.rowCountLowerPart},r}(),Kn=function(){function r(){this.buffer=""}return r.form=function(e,t){var n=-1;function i(o,s,f,u,c,l){if(o==="%%")return"%";if(t[++n]!==void 0){o=u?parseInt(u.substr(1)):void 0;var d=c?parseInt(c.substr(1)):void 0,h;switch(l){case"s":h=t[n];break;case"c":h=t[n][0];break;case"f":h=parseFloat(t[n]).toFixed(o);break;case"p":h=parseFloat(t[n]).toPrecision(o);break;case"e":h=parseFloat(t[n]).toExponential(o);break;case"x":h=parseInt(t[n]).toString(d||16);break;case"d":h=parseFloat(parseInt(t[n],d||10).toPrecision(o)).toFixed(0);break}h=typeof h=="object"?JSON.stringify(h):(+h).toString(d);for(var v=parseInt(f),p=f&&f[0]+""=="0"?"0":" ";h.length<v;)h=s!==void 0?h+p:p+h;return h}}var a=/%(-)?(0?[0-9]+)?([.][0-9]+)?([#][0-9]+)?([scfpexd%])/g;return e.replace(a,i)},r.prototype.format=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];this.buffer+=r.form(e,t)},r.prototype.toString=function(){return this.buffer},r}(),cl=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.")},uo=function(){function r(e){this.boundingBox=new Zn(e),this.codewords=new Array(e.getMaxY()-e.getMinY()+1)}return r.prototype.getCodewordNearby=function(e){var t=this.getCodeword(e);if(t!=null)return t;for(var n=1;n<r.MAX_NEARBY_DISTANCE;n++){var i=this.imageRowToCodewordIndex(e)-n;if(i>=0&&(t=this.codewords[i],t!=null)||(i=this.imageRowToCodewordIndex(e)+n,i<this.codewords.length&&(t=this.codewords[i],t!=null)))return t}return null},r.prototype.imageRowToCodewordIndex=function(e){return e-this.boundingBox.getMinY()},r.prototype.setCodeword=function(e,t){this.codewords[this.imageRowToCodewordIndex(e)]=t},r.prototype.getCodeword=function(e){return this.codewords[this.imageRowToCodewordIndex(e)]},r.prototype.getBoundingBox=function(){return this.boundingBox},r.prototype.getCodewords=function(){return this.codewords},r.prototype.toString=function(){var e,t,n=new Kn,i=0;try{for(var a=cl(this.codewords),o=a.next();!o.done;o=a.next()){var s=o.value;if(s==null){n.format("%3d: | %n",i++);continue}n.format("%3d: %3d|%3d%n",i++,s.getRowNumber(),s.getValue())}}catch(f){e={error:f}}finally{try{o&&!o.done&&(t=a.return)&&t.call(a)}finally{if(e)throw e.error}}return n.toString()},r.MAX_NEARBY_DISTANCE=5,r}(),ll=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.")},dl=function(r,e){var t=typeof Symbol=="function"&&r[Symbol.iterator];if(!t)return r;var n=t.call(r),i,a=[],o;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)a.push(i.value)}catch(s){o={error:s}}finally{try{i&&!i.done&&(t=n.return)&&t.call(n)}finally{if(o)throw o.error}}return a},tr=function(){function r(){this.values=new Map}return r.prototype.setValue=function(e){e=Math.trunc(e);var t=this.values.get(e);t==null&&(t=0),t++,this.values.set(e,t)},r.prototype.getValue=function(){var e,t,n=-1,i=new Array,a=function(l,d){var h={getKey:function(){return l},getValue:function(){return d}};h.getValue()>n?(n=h.getValue(),i=[],i.push(h.getKey())):h.getValue()===n&&i.push(h.getKey())};try{for(var o=ll(this.values.entries()),s=o.next();!s.done;s=o.next()){var f=dl(s.value,2),u=f[0],c=f[1];a(u,c)}}catch(l){e={error:l}}finally{try{s&&!s.done&&(t=o.return)&&t.call(o)}finally{if(e)throw e.error}}return Y.toIntArray(i)},r.prototype.getConfidence=function(e){return this.values.get(e)},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)}}(),qn=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.")},co=function(r){hl(e,r);function e(t,n){var i=r.call(this,t)||this;return i._isLeft=n,i}return e.prototype.setRowNumbers=function(){var t,n;try{for(var i=qn(this.getCodewords()),a=i.next();!a.done;a=i.next()){var o=a.value;o!=null&&o.setRowNumberAsRowIndicatorColumn()}}catch(s){t={error:s}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}},e.prototype.adjustCompleteIndicatorColumnRowNumbers=function(t){var n=this.getCodewords();this.setRowNumbers(),this.removeIncorrectCodewords(n,t);for(var i=this.getBoundingBox(),a=this._isLeft?i.getTopLeft():i.getTopRight(),o=this._isLeft?i.getBottomLeft():i.getBottomRight(),s=this.imageRowToCodewordIndex(Math.trunc(a.getY())),f=this.imageRowToCodewordIndex(Math.trunc(o.getY())),u=-1,c=1,l=0,d=s;d<f;d++)if(n[d]!=null){var h=n[d],v=h.getRowNumber()-u;if(v===0)l++;else if(v===1)c=Math.max(c,l),l=1,u=h.getRowNumber();else if(v<0||h.getRowNumber()>=t.getRowCount()||v>d)n[d]=null;else{var p=void 0;c>2?p=(c-2)*v:p=v;for(var x=p>=d,m=1;m<=p&&!x;m++)x=n[d-m]!=null;x?n[d]=null:(u=h.getRowNumber(),l=1)}}},e.prototype.getRowHeights=function(){var t,n,i=this.getBarcodeMetadata();if(i==null)return null;this.adjustIncompleteIndicatorColumnRowNumbers(i);var a=new Int32Array(i.getRowCount());try{for(var o=qn(this.getCodewords()),s=o.next();!s.done;s=o.next()){var f=s.value;if(f!=null){var u=f.getRowNumber();if(u>=a.length)continue;a[u]++}}}catch(c){t={error:c}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(t)throw t.error}}return a},e.prototype.adjustIncompleteIndicatorColumnRowNumbers=function(t){for(var n=this.getBoundingBox(),i=this._isLeft?n.getTopLeft():n.getTopRight(),a=this._isLeft?n.getBottomLeft():n.getBottomRight(),o=this.imageRowToCodewordIndex(Math.trunc(i.getY())),s=this.imageRowToCodewordIndex(Math.trunc(a.getY())),f=this.getCodewords(),u=-1,c=o;c<s;c++)if(f[c]!=null){var l=f[c];l.setRowNumberAsRowIndicatorColumn();var d=l.getRowNumber()-u;d===0||(d===1?u=l.getRowNumber():l.getRowNumber()>=t.getRowCount()?f[c]=null:u=l.getRowNumber())}},e.prototype.getBarcodeMetadata=function(){var t,n,i=this.getCodewords(),a=new tr,o=new tr,s=new tr,f=new tr;try{for(var u=qn(i),c=u.next();!c.done;c=u.next()){var l=c.value;if(l!=null){l.setRowNumberAsRowIndicatorColumn();var d=l.getValue()%30,h=l.getRowNumber();switch(this._isLeft||(h+=2),h%3){case 0:o.setValue(d*3+1);break;case 1:f.setValue(d/3),s.setValue(d%3);break;case 2:a.setValue(d+1);break}}}}catch(p){t={error:p}}finally{try{c&&!c.done&&(n=u.return)&&n.call(u)}finally{if(t)throw t.error}}if(a.getValue().length===0||o.getValue().length===0||s.getValue().length===0||f.getValue().length===0||a.getValue()[0]<1||o.getValue()[0]+s.getValue()[0]<Y.MIN_ROWS_IN_BARCODE||o.getValue()[0]+s.getValue()[0]>Y.MAX_ROWS_IN_BARCODE)return null;var v=new ul(a.getValue()[0],o.getValue()[0],s.getValue()[0],f.getValue()[0]);return this.removeIncorrectCodewords(i,v),v},e.prototype.removeIncorrectCodewords=function(t,n){for(var i=0;i<t.length;i++){var a=t[i];if(t[i]!=null){var o=a.getValue()%30,s=a.getRowNumber();if(s>n.getRowCount()){t[i]=null;continue}switch(this._isLeft||(s+=2),s%3){case 0:o*3+1!==n.getRowCountUpperPart()&&(t[i]=null);break;case 1:(Math.trunc(o/3)!==n.getErrorCorrectionLevel()||o%3!==n.getRowCountLowerPart())&&(t[i]=null);break;case 2:o+1!==n.getColumnCount()&&(t[i]=null);break}}}},e.prototype.isLeft=function(){return this._isLeft},e.prototype.toString=function(){return"IsLeft: "+this._isLeft+`
|
|
51
|
-
`+r.prototype.toString.call(this)},e}(uo),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.")},pl=function(){function r(e,t){this.ADJUST_ROW_NUMBER_SKIP=2,this.barcodeMetadata=e,this.barcodeColumnCount=e.getColumnCount(),this.boundingBox=t,this.detectionResultColumns=new Array(this.barcodeColumnCount+2)}return r.prototype.getDetectionResultColumns=function(){this.adjustIndicatorColumnRowNumbers(this.detectionResultColumns[0]),this.adjustIndicatorColumnRowNumbers(this.detectionResultColumns[this.barcodeColumnCount+1]);var e=Y.MAX_CODEWORDS_IN_BARCODE,t;do t=e,e=this.adjustRowNumbersAndGetCount();while(e>0&&e<t);return this.detectionResultColumns},r.prototype.adjustIndicatorColumnRowNumbers=function(e){e!=null&&e.adjustCompleteIndicatorColumnRowNumbers(this.barcodeMetadata)},r.prototype.adjustRowNumbersAndGetCount=function(){var e=this.adjustRowNumbersByRow();if(e===0)return 0;for(var t=1;t<this.barcodeColumnCount+1;t++)for(var n=this.detectionResultColumns[t].getCodewords(),i=0;i<n.length;i++)n[i]!=null&&(n[i].hasValidRowNumber()||this.adjustRowNumbers(t,i,n));return e},r.prototype.adjustRowNumbersByRow=function(){this.adjustRowNumbersFromBothRI();var e=this.adjustRowNumbersFromLRI();return e+this.adjustRowNumbersFromRRI()},r.prototype.adjustRowNumbersFromBothRI=function(){if(!(this.detectionResultColumns[0]==null||this.detectionResultColumns[this.barcodeColumnCount+1]==null)){for(var e=this.detectionResultColumns[0].getCodewords(),t=this.detectionResultColumns[this.barcodeColumnCount+1].getCodewords(),n=0;n<e.length;n++)if(e[n]!=null&&t[n]!=null&&e[n].getRowNumber()===t[n].getRowNumber())for(var i=1;i<=this.barcodeColumnCount;i++){var a=this.detectionResultColumns[i].getCodewords()[n];a!=null&&(a.setRowNumber(e[n].getRowNumber()),a.hasValidRowNumber()||(this.detectionResultColumns[i].getCodewords()[n]=null))}}},r.prototype.adjustRowNumbersFromRRI=function(){if(this.detectionResultColumns[this.barcodeColumnCount+1]==null)return 0;for(var e=0,t=this.detectionResultColumns[this.barcodeColumnCount+1].getCodewords(),n=0;n<t.length;n++)if(t[n]!=null)for(var i=t[n].getRowNumber(),a=0,o=this.barcodeColumnCount+1;o>0&&a<this.ADJUST_ROW_NUMBER_SKIP;o--){var s=this.detectionResultColumns[o].getCodewords()[n];s!=null&&(a=r.adjustRowNumberIfValid(i,a,s),s.hasValidRowNumber()||e++)}return e},r.prototype.adjustRowNumbersFromLRI=function(){if(this.detectionResultColumns[0]==null)return 0;for(var e=0,t=this.detectionResultColumns[0].getCodewords(),n=0;n<t.length;n++)if(t[n]!=null)for(var i=t[n].getRowNumber(),a=0,o=1;o<this.barcodeColumnCount+1&&a<this.ADJUST_ROW_NUMBER_SKIP;o++){var s=this.detectionResultColumns[o].getCodewords()[n];s!=null&&(a=r.adjustRowNumberIfValid(i,a,s),s.hasValidRowNumber()||e++)}return e},r.adjustRowNumberIfValid=function(e,t,n){return n==null||n.hasValidRowNumber()||(n.isValidRowNumber(e)?(n.setRowNumber(e),t=0):++t),t},r.prototype.adjustRowNumbers=function(e,t,n){var i,a;if(this.detectionResultColumns[e-1]!=null){var o=n[t],s=this.detectionResultColumns[e-1].getCodewords(),f=s;this.detectionResultColumns[e+1]!=null&&(f=this.detectionResultColumns[e+1].getCodewords());var u=new Array(14);u[2]=s[t],u[3]=f[t],t>0&&(u[0]=n[t-1],u[4]=s[t-1],u[5]=f[t-1]),t>1&&(u[8]=n[t-2],u[10]=s[t-2],u[11]=f[t-2]),t<n.length-1&&(u[1]=n[t+1],u[6]=s[t+1],u[7]=f[t+1]),t<n.length-2&&(u[9]=n[t+2],u[12]=s[t+2],u[13]=f[t+2]);try{for(var c=vl(u),l=c.next();!l.done;l=c.next()){var d=l.value;if(r.adjustRowNumber(o,d))return}}catch(h){i={error:h}}finally{try{l&&!l.done&&(a=c.return)&&a.call(c)}finally{if(i)throw i.error}}}},r.adjustRowNumber=function(e,t){return t==null?!1:t.hasValidRowNumber()&&t.getBucket()===e.getBucket()?(e.setRowNumber(t.getRowNumber()),!0):!1},r.prototype.getBarcodeColumnCount=function(){return this.barcodeColumnCount},r.prototype.getBarcodeRowCount=function(){return this.barcodeMetadata.getRowCount()},r.prototype.getBarcodeECLevel=function(){return this.barcodeMetadata.getErrorCorrectionLevel()},r.prototype.setBoundingBox=function(e){this.boundingBox=e},r.prototype.getBoundingBox=function(){return this.boundingBox},r.prototype.setDetectionResultColumn=function(e,t){this.detectionResultColumns[e]=t},r.prototype.getDetectionResultColumn=function(e){return this.detectionResultColumns[e]},r.prototype.toString=function(){var e=this.detectionResultColumns[0];e==null&&(e=this.detectionResultColumns[this.barcodeColumnCount+1]);for(var t=new Kn,n=0;n<e.getCodewords().length;n++){t.format("CW %3d:",n);for(var i=0;i<this.barcodeColumnCount+2;i++){if(this.detectionResultColumns[i]==null){t.format(" | ");continue}var a=this.detectionResultColumns[i].getCodewords()[n];if(a==null){t.format(" | ");continue}t.format(" %3d|%3d",a.getRowNumber(),a.getValue())}t.format("%n")}return t.toString()},r}(),gl=function(){function r(e,t,n,i){this.rowNumber=r.BARCODE_ROW_UNKNOWN,this.startX=Math.trunc(e),this.endX=Math.trunc(t),this.bucket=Math.trunc(n),this.value=Math.trunc(i)}return r.prototype.hasValidRowNumber=function(){return this.isValidRowNumber(this.rowNumber)},r.prototype.isValidRowNumber=function(e){return e!==r.BARCODE_ROW_UNKNOWN&&this.bucket===e%3*3},r.prototype.setRowNumberAsRowIndicatorColumn=function(){this.rowNumber=Math.trunc(Math.trunc(this.value/30)*3+Math.trunc(this.bucket/3))},r.prototype.getWidth=function(){return this.endX-this.startX},r.prototype.getStartX=function(){return this.startX},r.prototype.getEndX=function(){return this.endX},r.prototype.getBucket=function(){return this.bucket},r.prototype.getValue=function(){return this.value},r.prototype.getRowNumber=function(){return this.rowNumber},r.prototype.setRowNumber=function(e){this.rowNumber=e},r.prototype.toString=function(){return this.rowNumber+"|"+this.value},r.BARCODE_ROW_UNKNOWN=-1,r}(),xl=function(){function r(){}return r.initialize=function(){for(var e=0;e<Y.SYMBOL_TABLE.length;e++)for(var t=Y.SYMBOL_TABLE[e],n=t&1,i=0;i<Y.BARS_IN_MODULE;i++){for(var a=0;(t&1)===n;)a+=1,t>>=1;n=t&1,r.RATIOS_TABLE[e]||(r.RATIOS_TABLE[e]=new Array(Y.BARS_IN_MODULE)),r.RATIOS_TABLE[e][Y.BARS_IN_MODULE-i-1]=Math.fround(a/Y.MODULES_IN_CODEWORD)}this.bSymbolTableReady=!0},r.getDecodedValue=function(e){var t=r.getDecodedCodewordValue(r.sampleBitCounts(e));return t!==-1?t:r.getClosestDecodedValue(e)},r.sampleBitCounts=function(e){for(var t=Z.sum(e),n=new Int32Array(Y.BARS_IN_MODULE),i=0,a=0,o=0;o<Y.MODULES_IN_CODEWORD;o++){var s=t/(2*Y.MODULES_IN_CODEWORD)+o*t/Y.MODULES_IN_CODEWORD;a+e[i]<=s&&(a+=e[i],i++),n[i]++}return n},r.getDecodedCodewordValue=function(e){var t=r.getBitValue(e);return Y.getCodeword(t)===-1?-1:t},r.getBitValue=function(e){for(var t=0,n=0;n<e.length;n++)for(var i=0;i<e[n];i++)t=t<<1|(n%2===0?1:0);return Math.trunc(t)},r.getClosestDecodedValue=function(e){var t=Z.sum(e),n=new Array(Y.BARS_IN_MODULE);if(t>1)for(var i=0;i<n.length;i++)n[i]=Math.fround(e[i]/t);var a=Bn.MAX_VALUE,o=-1;this.bSymbolTableReady||r.initialize();for(var s=0;s<r.RATIOS_TABLE.length;s++){for(var f=0,u=r.RATIOS_TABLE[s],c=0;c<Y.BARS_IN_MODULE;c++){var l=Math.fround(u[c]-n[c]);if(f+=Math.fround(l*l),f>=a)break}f<a&&(a=f,o=Y.SYMBOL_TABLE[s])}return o},r.bSymbolTableReady=!1,r.RATIOS_TABLE=new Array(Y.SYMBOL_TABLE.length).map(function(e){return new Array(Y.BARS_IN_MODULE)}),r}();const lo=typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{};var yl=function(){function r(){this.segmentCount=-1,this.fileSize=-1,this.timestamp=-1,this.checksum=-1}return r.prototype.getSegmentIndex=function(){return this.segmentIndex},r.prototype.setSegmentIndex=function(e){this.segmentIndex=e},r.prototype.getFileId=function(){return this.fileId},r.prototype.setFileId=function(e){this.fileId=e},r.prototype.getOptionalData=function(){return this.optionalData},r.prototype.setOptionalData=function(e){this.optionalData=e},r.prototype.isLastSegment=function(){return this.lastSegment},r.prototype.setLastSegment=function(e){this.lastSegment=e},r.prototype.getSegmentCount=function(){return this.segmentCount},r.prototype.setSegmentCount=function(e){this.segmentCount=e},r.prototype.getSender=function(){return this.sender||null},r.prototype.setSender=function(e){this.sender=e},r.prototype.getAddressee=function(){return this.addressee||null},r.prototype.setAddressee=function(e){this.addressee=e},r.prototype.getFileName=function(){return this.fileName},r.prototype.setFileName=function(e){this.fileName=e},r.prototype.getFileSize=function(){return this.fileSize},r.prototype.setFileSize=function(e){this.fileSize=e},r.prototype.getChecksum=function(){return this.checksum},r.prototype.setChecksum=function(e){this.checksum=e},r.prototype.getTimestamp=function(){return this.timestamp},r.prototype.setTimestamp=function(e){this.timestamp=e},r}(),ho=function(){function r(){}return r.parseLong=function(e,t){return t===void 0&&(t=void 0),parseInt(e,t)},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)}}(),ml=function(r){wl(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.kind="NullPointerException",e}(Fe),Cl=function(){function r(){}return r.prototype.writeBytes=function(e){this.writeBytesOffset(e,0,e.length)},r.prototype.writeBytesOffset=function(e,t,n){if(e==null)throw new ml;if(t<0||t>e.length||n<0||t+n>e.length||t+n<0)throw new Dn;if(n===0)return;for(var i=0;i<n;i++)this.write(e[t+i])},r.prototype.flush=function(){},r.prototype.close=function(){},r}(),Al=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)}}(),_l=function(r){Al(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e}(Fe),El=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)}}(),Il=function(r){El(e,r);function e(t){t===void 0&&(t=32);var n=r.call(this)||this;if(n.count=0,t<0)throw new V("Negative initial size: "+t);return n.buf=new Uint8Array(t),n}return e.prototype.ensureCapacity=function(t){t-this.buf.length>0&&this.grow(t)},e.prototype.grow=function(t){var n=this.buf.length,i=n<<1;if(i-t<0&&(i=t),i<0){if(t<0)throw new _l;i=G.MAX_VALUE}this.buf=fe.copyOfUint8Array(this.buf,i)},e.prototype.write=function(t){this.ensureCapacity(this.count+1),this.buf[this.count]=t,this.count+=1},e.prototype.writeBytesOffset=function(t,n,i){if(n<0||n>t.length||i<0||n+i-t.length>0)throw new Dn;this.ensureCapacity(this.count+i),re.arraycopy(t,n,this.buf,this.count,i),this.count+=i},e.prototype.writeTo=function(t){t.writeBytesOffset(this.buf,0,this.count)},e.prototype.reset=function(){this.count=0},e.prototype.toByteArray=function(){return fe.copyOfUint8Array(this.buf,this.count)},e.prototype.size=function(){return this.count},e.prototype.toString=function(t){return t?typeof t=="string"?this.toString_string(t):this.toString_number(t):this.toString_void()},e.prototype.toString_void=function(){return new String(this.buf).toString()},e.prototype.toString_string=function(t){return new String(this.buf).toString()},e.prototype.toString_number=function(t){return new String(this.buf).toString()},e.prototype.close=function(){},e}(Cl),te;(function(r){r[r.ALPHA=0]="ALPHA",r[r.LOWER=1]="LOWER",r[r.MIXED=2]="MIXED",r[r.PUNCT=3]="PUNCT",r[r.ALPHA_SHIFT=4]="ALPHA_SHIFT",r[r.PUNCT_SHIFT=5]="PUNCT_SHIFT"})(te||(te={}));function vo(){if(typeof window<"u")return window.BigInt||null;if(typeof lo<"u")return lo.BigInt||null;if(typeof self<"u")return self.BigInt||null;throw new Error("Can't search globals for BigInt!")}var Ur;function ut(r){if(typeof Ur>"u"&&(Ur=vo()),Ur===null)throw new Error("BigInt is not supported!");return Ur(r)}function Sl(){var r=[];r[0]=ut(1);var e=ut(900);r[1]=e;for(var t=2;t<16;t++)r[t]=r[t-1]*e;return r}var bl=function(){function r(){}return r.decode=function(e,t){var n=new z(""),i=ue.ISO8859_1;n.enableDecoding(i);for(var a=1,o=e[a++],s=new yl;a<e[0];){switch(o){case r.TEXT_COMPACTION_MODE_LATCH:a=r.textCompaction(e,a,n);break;case r.BYTE_COMPACTION_MODE_LATCH:case r.BYTE_COMPACTION_MODE_LATCH_6:a=r.byteCompaction(o,e,i,a,n);break;case r.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:n.append(e[a++]);break;case r.NUMERIC_COMPACTION_MODE_LATCH:a=r.numericCompaction(e,a,n);break;case r.ECI_CHARSET:ue.getCharacterSetECIByValue(e[a++]);break;case r.ECI_GENERAL_PURPOSE:a+=2;break;case r.ECI_USER_DEFINED:a++;break;case r.BEGIN_MACRO_PDF417_CONTROL_BLOCK:a=r.decodeMacroBlock(e,a,s);break;case r.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case r.MACRO_PDF417_TERMINATOR:throw new R;default:a--,a=r.textCompaction(e,a,n);break}if(a<e.length)o=e[a++];else throw R.getFormatInstance()}if(n.length()===0)throw R.getFormatInstance();var f=new Pr(null,n.toString(),null,t);return f.setOther(s),f},r.decodeMacroBlock=function(e,t,n){if(t+r.NUMBER_OF_SEQUENCE_CODEWORDS>e[0])throw R.getFormatInstance();for(var i=new Int32Array(r.NUMBER_OF_SEQUENCE_CODEWORDS),a=0;a<r.NUMBER_OF_SEQUENCE_CODEWORDS;a++,t++)i[a]=e[t];n.setSegmentIndex(G.parseInt(r.decodeBase900toBase10(i,r.NUMBER_OF_SEQUENCE_CODEWORDS)));var o=new z;t=r.textCompaction(e,t,o),n.setFileId(o.toString());var s=-1;for(e[t]===r.BEGIN_MACRO_PDF417_OPTIONAL_FIELD&&(s=t+1);t<e[0];)switch(e[t]){case r.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:switch(t++,e[t]){case r.MACRO_PDF417_OPTIONAL_FIELD_FILE_NAME:var f=new z;t=r.textCompaction(e,t+1,f),n.setFileName(f.toString());break;case r.MACRO_PDF417_OPTIONAL_FIELD_SENDER:var u=new z;t=r.textCompaction(e,t+1,u),n.setSender(u.toString());break;case r.MACRO_PDF417_OPTIONAL_FIELD_ADDRESSEE:var c=new z;t=r.textCompaction(e,t+1,c),n.setAddressee(c.toString());break;case r.MACRO_PDF417_OPTIONAL_FIELD_SEGMENT_COUNT:var l=new z;t=r.numericCompaction(e,t+1,l),n.setSegmentCount(G.parseInt(l.toString()));break;case r.MACRO_PDF417_OPTIONAL_FIELD_TIME_STAMP:var d=new z;t=r.numericCompaction(e,t+1,d),n.setTimestamp(ho.parseLong(d.toString()));break;case r.MACRO_PDF417_OPTIONAL_FIELD_CHECKSUM:var h=new z;t=r.numericCompaction(e,t+1,h),n.setChecksum(G.parseInt(h.toString()));break;case r.MACRO_PDF417_OPTIONAL_FIELD_FILE_SIZE:var v=new z;t=r.numericCompaction(e,t+1,v),n.setFileSize(ho.parseLong(v.toString()));break;default:throw R.getFormatInstance()}break;case r.MACRO_PDF417_TERMINATOR:t++,n.setLastSegment(!0);break;default:throw R.getFormatInstance()}if(s!==-1){var p=t-s;n.isLastSegment()&&p--,n.setOptionalData(fe.copyOfRange(e,s,s+p))}return t},r.textCompaction=function(e,t,n){for(var i=new Int32Array((e[0]-t)*2),a=new Int32Array((e[0]-t)*2),o=0,s=!1;t<e[0]&&!s;){var f=e[t++];if(f<r.TEXT_COMPACTION_MODE_LATCH)i[o]=f/30,i[o+1]=f%30,o+=2;else switch(f){case r.TEXT_COMPACTION_MODE_LATCH:i[o++]=r.TEXT_COMPACTION_MODE_LATCH;break;case r.BYTE_COMPACTION_MODE_LATCH:case r.BYTE_COMPACTION_MODE_LATCH_6:case r.NUMERIC_COMPACTION_MODE_LATCH:case r.BEGIN_MACRO_PDF417_CONTROL_BLOCK:case r.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case r.MACRO_PDF417_TERMINATOR:t--,s=!0;break;case r.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:i[o]=r.MODE_SHIFT_TO_BYTE_COMPACTION_MODE,f=e[t++],a[o]=f,o++;break}}return r.decodeTextCompaction(i,a,o,n),t},r.decodeTextCompaction=function(e,t,n,i){for(var a=te.ALPHA,o=te.ALPHA,s=0;s<n;){var f=e[s],u="";switch(a){case te.ALPHA:if(f<26)u=String.fromCharCode(65+f);else switch(f){case 26:u=" ";break;case r.LL:a=te.LOWER;break;case r.ML:a=te.MIXED;break;case r.PS:o=a,a=te.PUNCT_SHIFT;break;case r.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:i.append(t[s]);break;case r.TEXT_COMPACTION_MODE_LATCH:a=te.ALPHA;break}break;case te.LOWER:if(f<26)u=String.fromCharCode(97+f);else switch(f){case 26:u=" ";break;case r.AS:o=a,a=te.ALPHA_SHIFT;break;case r.ML:a=te.MIXED;break;case r.PS:o=a,a=te.PUNCT_SHIFT;break;case r.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:i.append(t[s]);break;case r.TEXT_COMPACTION_MODE_LATCH:a=te.ALPHA;break}break;case te.MIXED:if(f<r.PL)u=r.MIXED_CHARS[f];else switch(f){case r.PL:a=te.PUNCT;break;case 26:u=" ";break;case r.LL:a=te.LOWER;break;case r.AL:a=te.ALPHA;break;case r.PS:o=a,a=te.PUNCT_SHIFT;break;case r.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:i.append(t[s]);break;case r.TEXT_COMPACTION_MODE_LATCH:a=te.ALPHA;break}break;case te.PUNCT:if(f<r.PAL)u=r.PUNCT_CHARS[f];else switch(f){case r.PAL:a=te.ALPHA;break;case r.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:i.append(t[s]);break;case r.TEXT_COMPACTION_MODE_LATCH:a=te.ALPHA;break}break;case te.ALPHA_SHIFT:if(a=o,f<26)u=String.fromCharCode(65+f);else switch(f){case 26:u=" ";break;case r.TEXT_COMPACTION_MODE_LATCH:a=te.ALPHA;break}break;case te.PUNCT_SHIFT:if(a=o,f<r.PAL)u=r.PUNCT_CHARS[f];else switch(f){case r.PAL:a=te.ALPHA;break;case r.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:i.append(t[s]);break;case r.TEXT_COMPACTION_MODE_LATCH:a=te.ALPHA;break}break}u!==""&&i.append(u),s++}},r.byteCompaction=function(e,t,n,i,a){var o=new Il,s=0,f=0,u=!1;switch(e){case r.BYTE_COMPACTION_MODE_LATCH:for(var c=new Int32Array(6),l=t[i++];i<t[0]&&!u;)switch(c[s++]=l,f=900*f+l,l=t[i++],l){case r.TEXT_COMPACTION_MODE_LATCH:case r.BYTE_COMPACTION_MODE_LATCH:case r.NUMERIC_COMPACTION_MODE_LATCH:case r.BYTE_COMPACTION_MODE_LATCH_6:case r.BEGIN_MACRO_PDF417_CONTROL_BLOCK:case r.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case r.MACRO_PDF417_TERMINATOR:i--,u=!0;break;default:if(s%5===0&&s>0){for(var d=0;d<6;++d)o.write(Number(ut(f)>>ut(8*(5-d))));f=0,s=0}break}i===t[0]&&l<r.TEXT_COMPACTION_MODE_LATCH&&(c[s++]=l);for(var h=0;h<s;h++)o.write(c[h]);break;case r.BYTE_COMPACTION_MODE_LATCH_6:for(;i<t[0]&&!u;){var v=t[i++];if(v<r.TEXT_COMPACTION_MODE_LATCH)s++,f=900*f+v;else switch(v){case r.TEXT_COMPACTION_MODE_LATCH:case r.BYTE_COMPACTION_MODE_LATCH:case r.NUMERIC_COMPACTION_MODE_LATCH:case r.BYTE_COMPACTION_MODE_LATCH_6:case r.BEGIN_MACRO_PDF417_CONTROL_BLOCK:case r.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case r.MACRO_PDF417_TERMINATOR:i--,u=!0;break}if(s%5===0&&s>0){for(var d=0;d<6;++d)o.write(Number(ut(f)>>ut(8*(5-d))));f=0,s=0}}break}return a.append(Ve.decode(o.toByteArray(),n)),i},r.numericCompaction=function(e,t,n){for(var i=0,a=!1,o=new Int32Array(r.MAX_NUMERIC_CODEWORDS);t<e[0]&&!a;){var s=e[t++];if(t===e[0]&&(a=!0),s<r.TEXT_COMPACTION_MODE_LATCH)o[i]=s,i++;else switch(s){case r.TEXT_COMPACTION_MODE_LATCH:case r.BYTE_COMPACTION_MODE_LATCH:case r.BYTE_COMPACTION_MODE_LATCH_6:case r.BEGIN_MACRO_PDF417_CONTROL_BLOCK:case r.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case r.MACRO_PDF417_TERMINATOR:t--,a=!0;break}(i%r.MAX_NUMERIC_CODEWORDS===0||s===r.NUMERIC_COMPACTION_MODE_LATCH||a)&&i>0&&(n.append(r.decodeBase900toBase10(o,i)),i=0)}return t},r.decodeBase900toBase10=function(e,t){for(var n=ut(0),i=0;i<t;i++)n+=r.EXP900[t-i-1]*ut(e[i]);var a=n.toString();if(a.charAt(0)!=="1")throw new R;return a.substring(1)},r.TEXT_COMPACTION_MODE_LATCH=900,r.BYTE_COMPACTION_MODE_LATCH=901,r.NUMERIC_COMPACTION_MODE_LATCH=902,r.BYTE_COMPACTION_MODE_LATCH_6=924,r.ECI_USER_DEFINED=925,r.ECI_GENERAL_PURPOSE=926,r.ECI_CHARSET=927,r.BEGIN_MACRO_PDF417_CONTROL_BLOCK=928,r.BEGIN_MACRO_PDF417_OPTIONAL_FIELD=923,r.MACRO_PDF417_TERMINATOR=922,r.MODE_SHIFT_TO_BYTE_COMPACTION_MODE=913,r.MAX_NUMERIC_CODEWORDS=15,r.MACRO_PDF417_OPTIONAL_FIELD_FILE_NAME=0,r.MACRO_PDF417_OPTIONAL_FIELD_SEGMENT_COUNT=1,r.MACRO_PDF417_OPTIONAL_FIELD_TIME_STAMP=2,r.MACRO_PDF417_OPTIONAL_FIELD_SENDER=3,r.MACRO_PDF417_OPTIONAL_FIELD_ADDRESSEE=4,r.MACRO_PDF417_OPTIONAL_FIELD_FILE_SIZE=5,r.MACRO_PDF417_OPTIONAL_FIELD_CHECKSUM=6,r.PL=25,r.LL=27,r.AS=27,r.ML=28,r.AL=28,r.PS=29,r.PAL=29,r.PUNCT_CHARS=`;<>@[\\]_\`~!\r ,:
|
|
52
|
-
-.$/"|*()?{}'`,r.MIXED_CHARS="0123456789&\r ,:#-.$/+%*=^",r.EXP900=vo()?Sl():[],r.NUMBER_OF_SEQUENCE_CODEWORDS=2,r}(),rr=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.")},Tl=function(){function r(){}return r.decode=function(e,t,n,i,a,o,s){for(var f=new Zn(e,t,n,i,a),u=null,c=null,l,d=!0;;d=!1){if(t!=null&&(u=r.getRowIndicatorColumn(e,f,t,!0,o,s)),i!=null&&(c=r.getRowIndicatorColumn(e,f,i,!1,o,s)),l=r.merge(u,c),l==null)throw N.getNotFoundInstance();var h=l.getBoundingBox();if(d&&h!=null&&(h.getMinY()<f.getMinY()||h.getMaxY()>f.getMaxY()))f=h;else break}l.setBoundingBox(f);var v=l.getBarcodeColumnCount()+1;l.setDetectionResultColumn(0,u),l.setDetectionResultColumn(v,c);for(var p=u!=null,x=1;x<=v;x++){var m=p?x:v-x;if(l.getDetectionResultColumn(m)===void 0){var w=void 0;m===0||m===v?w=new co(f,m===0):w=new uo(f),l.setDetectionResultColumn(m,w);for(var C=-1,A=C,_=f.getMinY();_<=f.getMaxY();_++){if(C=r.getStartColumn(l,m,_,p),C<0||C>f.getMaxX()){if(A===-1)continue;C=A}var b=r.detectCodeword(e,f.getMinX(),f.getMaxX(),p,C,_,o,s);b!=null&&(w.setCodeword(_,b),A=C,o=Math.min(o,b.getWidth()),s=Math.max(s,b.getWidth()))}}}return r.createDecoderResult(l)},r.merge=function(e,t){if(e==null&&t==null)return null;var n=r.getBarcodeMetadata(e,t);if(n==null)return null;var i=Zn.merge(r.adjustBoundingBox(e),r.adjustBoundingBox(t));return new pl(n,i)},r.adjustBoundingBox=function(e){var t,n;if(e==null)return null;var i=e.getRowHeights();if(i==null)return null;var a=r.getMax(i),o=0;try{for(var s=rr(i),f=s.next();!f.done;f=s.next()){var u=f.value;if(o+=a-u,u>0)break}}catch(h){t={error:h}}finally{try{f&&!f.done&&(n=s.return)&&n.call(s)}finally{if(t)throw t.error}}for(var c=e.getCodewords(),l=0;o>0&&c[l]==null;l++)o--;for(var d=0,l=i.length-1;l>=0&&(d+=a-i[l],!(i[l]>0));l--);for(var l=c.length-1;d>0&&c[l]==null;l--)d--;return e.getBoundingBox().addMissingRows(o,d,e.isLeft())},r.getMax=function(e){var t,n,i=-1;try{for(var a=rr(e),o=a.next();!o.done;o=a.next()){var s=o.value;i=Math.max(i,s)}}catch(f){t={error:f}}finally{try{o&&!o.done&&(n=a.return)&&n.call(a)}finally{if(t)throw t.error}}return i},r.getBarcodeMetadata=function(e,t){var n;if(e==null||(n=e.getBarcodeMetadata())==null)return t==null?null:t.getBarcodeMetadata();var i;return t==null||(i=t.getBarcodeMetadata())==null?n:n.getColumnCount()!==i.getColumnCount()&&n.getErrorCorrectionLevel()!==i.getErrorCorrectionLevel()&&n.getRowCount()!==i.getRowCount()?null:n},r.getRowIndicatorColumn=function(e,t,n,i,a,o){for(var s=new co(t,i),f=0;f<2;f++)for(var u=f===0?1:-1,c=Math.trunc(Math.trunc(n.getX())),l=Math.trunc(Math.trunc(n.getY()));l<=t.getMaxY()&&l>=t.getMinY();l+=u){var d=r.detectCodeword(e,0,e.getWidth(),i,c,l,a,o);d!=null&&(s.setCodeword(l,d),i?c=d.getStartX():c=d.getEndX())}return s},r.adjustCodewordCount=function(e,t){var n=t[0][1],i=n.getValue(),a=e.getBarcodeColumnCount()*e.getBarcodeRowCount()-r.getNumberOfECCodeWords(e.getBarcodeECLevel());if(i.length===0){if(a<1||a>Y.MAX_CODEWORDS_IN_BARCODE)throw N.getNotFoundInstance();n.setValue(a)}else i[0]!==a&&n.setValue(a)},r.createDecoderResult=function(e){var t=r.createBarcodeMatrix(e);r.adjustCodewordCount(e,t);for(var n=new Array,i=new Int32Array(e.getBarcodeRowCount()*e.getBarcodeColumnCount()),a=[],o=new Array,s=0;s<e.getBarcodeRowCount();s++)for(var f=0;f<e.getBarcodeColumnCount();f++){var u=t[s][f+1].getValue(),c=s*e.getBarcodeColumnCount()+f;u.length===0?n.push(c):u.length===1?i[c]=u[0]:(o.push(c),a.push(u))}for(var l=new Array(a.length),d=0;d<l.length;d++)l[d]=a[d];return r.createDecoderResultFromAmbiguousValues(e.getBarcodeECLevel(),i,Y.toIntArray(n),Y.toIntArray(o),l)},r.createDecoderResultFromAmbiguousValues=function(e,t,n,i,a){for(var o=new Int32Array(i.length),s=100;s-- >0;){for(var f=0;f<o.length;f++)t[i[f]]=a[f][o[f]];try{return r.decodeCodewords(t,e,n)}catch(c){var u=c instanceof pe;if(!u)throw c}if(o.length===0)throw pe.getChecksumInstance();for(var f=0;f<o.length;f++)if(o[f]<a[f].length-1){o[f]++;break}else if(o[f]=0,f===o.length-1)throw pe.getChecksumInstance()}throw pe.getChecksumInstance()},r.createBarcodeMatrix=function(e){for(var t,n,i,a,o=Array.from({length:e.getBarcodeRowCount()},function(){return new Array(e.getBarcodeColumnCount()+2)}),s=0;s<o.length;s++)for(var f=0;f<o[s].length;f++)o[s][f]=new tr;var u=0;try{for(var c=rr(e.getDetectionResultColumns()),l=c.next();!l.done;l=c.next()){var d=l.value;if(d!=null)try{for(var h=(i=void 0,rr(d.getCodewords())),v=h.next();!v.done;v=h.next()){var p=v.value;if(p!=null){var x=p.getRowNumber();if(x>=0){if(x>=o.length)continue;o[x][u].setValue(p.getValue())}}}}catch(m){i={error:m}}finally{try{v&&!v.done&&(a=h.return)&&a.call(h)}finally{if(i)throw i.error}}u++}}catch(m){t={error:m}}finally{try{l&&!l.done&&(n=c.return)&&n.call(c)}finally{if(t)throw t.error}}return o},r.isValidBarcodeColumn=function(e,t){return t>=0&&t<=e.getBarcodeColumnCount()+1},r.getStartColumn=function(e,t,n,i){var a,o,s=i?1:-1,f=null;if(r.isValidBarcodeColumn(e,t-s)&&(f=e.getDetectionResultColumn(t-s).getCodeword(n)),f!=null)return i?f.getEndX():f.getStartX();if(f=e.getDetectionResultColumn(t).getCodewordNearby(n),f!=null)return i?f.getStartX():f.getEndX();if(r.isValidBarcodeColumn(e,t-s)&&(f=e.getDetectionResultColumn(t-s).getCodewordNearby(n)),f!=null)return i?f.getEndX():f.getStartX();for(var u=0;r.isValidBarcodeColumn(e,t-s);){t-=s;try{for(var c=(a=void 0,rr(e.getDetectionResultColumn(t).getCodewords())),l=c.next();!l.done;l=c.next()){var d=l.value;if(d!=null)return(i?d.getEndX():d.getStartX())+s*u*(d.getEndX()-d.getStartX())}}catch(h){a={error:h}}finally{try{l&&!l.done&&(o=c.return)&&o.call(c)}finally{if(a)throw a.error}}u++}return i?e.getBoundingBox().getMinX():e.getBoundingBox().getMaxX()},r.detectCodeword=function(e,t,n,i,a,o,s,f){a=r.adjustCodewordStartColumn(e,t,n,i,a,o);var u=r.getModuleBitCount(e,t,n,i,a,o);if(u==null)return null;var c,l=Z.sum(u);if(i)c=a+l;else{for(var d=0;d<u.length/2;d++){var h=u[d];u[d]=u[u.length-1-d],u[u.length-1-d]=h}c=a,a=c-l}if(!r.checkCodewordSkew(l,s,f))return null;var v=xl.getDecodedValue(u),p=Y.getCodeword(v);return p===-1?null:new gl(a,c,r.getCodewordBucketNumber(v),p)},r.getModuleBitCount=function(e,t,n,i,a,o){for(var s=a,f=new Int32Array(8),u=0,c=i?1:-1,l=i;(i?s<n:s>=t)&&u<f.length;)e.get(s,o)===l?(f[u]++,s+=c):(u++,l=!l);return u===f.length||s===(i?n:t)&&u===f.length-1?f:null},r.getNumberOfECCodeWords=function(e){return 2<<e},r.adjustCodewordStartColumn=function(e,t,n,i,a,o){for(var s=a,f=i?-1:1,u=0;u<2;u++){for(;(i?s>=t:s<n)&&i===e.get(s,o);){if(Math.abs(a-s)>r.CODEWORD_SKEW_SIZE)return a;s+=f}f=-f,i=!i}return s},r.checkCodewordSkew=function(e,t,n){return t-r.CODEWORD_SKEW_SIZE<=e&&e<=n+r.CODEWORD_SKEW_SIZE},r.decodeCodewords=function(e,t,n){if(e.length===0)throw R.getFormatInstance();var i=1<<t+1,a=r.correctErrors(e,n,i);r.verifyCodewordCount(e,i);var o=bl.decode(e,""+t);return o.setErrorsCorrected(a),o.setErasures(n.length),o},r.correctErrors=function(e,t,n){if(t!=null&&t.length>n/2+r.MAX_ERRORS||n<0||n>r.MAX_EC_CODEWORDS)throw pe.getChecksumInstance();return r.errorCorrection.decode(e,n,t)},r.verifyCodewordCount=function(e,t){if(e.length<4)throw R.getFormatInstance();var n=e[0];if(n>e.length)throw R.getFormatInstance();if(n===0)if(t<e.length)e[0]=e.length-t;else throw R.getFormatInstance()},r.getBitCountForCodeword=function(e){for(var t=new Int32Array(8),n=0,i=t.length-1;!((e&1)!==n&&(n=e&1,i--,i<0));)t[i]++,e>>=1;return t},r.getCodewordBucketNumber=function(e){return e instanceof Int32Array?this.getCodewordBucketNumber_Int32Array(e):this.getCodewordBucketNumber_number(e)},r.getCodewordBucketNumber_number=function(e){return r.getCodewordBucketNumber(r.getBitCountForCodeword(e))},r.getCodewordBucketNumber_Int32Array=function(e){return(e[0]-e[2]+e[4]-e[6]+9)%9},r.toString=function(e){for(var t=new Kn,n=0;n<e.length;n++){t.format("Row %2d: ",n);for(var i=0;i<e[n].length;i++){var a=e[n][i];a.getValue().length===0?t.format(" ",null):t.format("%4d(%2d)",a.getValue()[0],a.getConfidence(a.getValue()[0]))}t.format("%n")}return t.toString()},r.CODEWORD_SKEW_SIZE=2,r.MAX_ERRORS=3,r.MAX_EC_CODEWORDS=512,r.errorCorrection=new fl,r}(),Ol=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.")},Qn=function(){function r(){}return r.prototype.decode=function(e,t){t===void 0&&(t=null);var n=r.decode(e,t,!1);if(n==null||n.length===0||n[0]==null)throw N.getNotFoundInstance();return n[0]},r.prototype.decodeMultiple=function(e,t){t===void 0&&(t=null);try{return r.decode(e,t,!0)}catch(n){throw n instanceof R||n instanceof pe?N.getNotFoundInstance():n}},r.decode=function(e,t,n){var i,a,o=new Array,s=rl.detectMultiple(e,t,n);try{for(var f=Ol(s.getPoints()),u=f.next();!u.done;u=f.next()){var c=u.value,l=Tl.decode(s.getBits(),c[4],c[5],c[6],c[7],r.getMinCodewordWidth(c),r.getMaxCodewordWidth(c)),d=new Se(l.getText(),l.getRawBytes(),void 0,c,L.PDF_417);d.putMetadata(Ce.ERROR_CORRECTION_LEVEL,l.getECLevel());var h=l.getOther();h!=null&&d.putMetadata(Ce.PDF417_EXTRA_METADATA,h),o.push(d)}}catch(v){i={error:v}}finally{try{u&&!u.done&&(a=f.return)&&a.call(f)}finally{if(i)throw i.error}}return o.map(function(v){return v})},r.getMaxWidth=function(e,t){return e==null||t==null?0:Math.trunc(Math.abs(e.getX()-t.getX()))},r.getMinWidth=function(e,t){return e==null||t==null?G.MAX_VALUE:Math.trunc(Math.abs(e.getX()-t.getX()))},r.getMaxCodewordWidth=function(e){return Math.floor(Math.max(Math.max(r.getMaxWidth(e[0],e[4]),r.getMaxWidth(e[6],e[2])*Y.MODULES_IN_CODEWORD/Y.MODULES_IN_STOP_PATTERN),Math.max(r.getMaxWidth(e[1],e[5]),r.getMaxWidth(e[7],e[3])*Y.MODULES_IN_CODEWORD/Y.MODULES_IN_STOP_PATTERN)))},r.getMinCodewordWidth=function(e){return Math.floor(Math.min(Math.min(r.getMinWidth(e[0],e[4]),r.getMinWidth(e[6],e[2])*Y.MODULES_IN_CODEWORD/Y.MODULES_IN_STOP_PATTERN),Math.min(r.getMinWidth(e[1],e[5]),r.getMinWidth(e[7],e[3])*Y.MODULES_IN_CODEWORD/Y.MODULES_IN_STOP_PATTERN)))},r.prototype.reset=function(){},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)}}(),po=function(r){Nl(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.kind="ReaderException",e}(Fe),go=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.")},Dl=function(){function r(){}return r.prototype.decode=function(e,t){return this.setHints(t),this.decodeInternal(e)},r.prototype.decodeWithState=function(e){return(this.readers===null||this.readers===void 0)&&this.setHints(null),this.decodeInternal(e)},r.prototype.setHints=function(e){this.hints=e;var t=e!=null&&e.get(oe.TRY_HARDER)!==void 0,n=e==null?null:e.get(oe.POSSIBLE_FORMATS),i=new Array;if(n!=null){var a=n.some(function(o){return o===L.UPC_A||o===L.UPC_E||o===L.EAN_13||o===L.EAN_8||o===L.CODABAR||o===L.CODE_39||o===L.CODE_93||o===L.CODE_128||o===L.ITF||o===L.RSS_14||o===L.RSS_EXPANDED});a&&!t&&i.push(new Jt(e)),n.includes(L.QR_CODE)&&i.push(new Yn),n.includes(L.DATA_MATRIX)&&i.push(new jn),n.includes(L.AZTEC)&&i.push(new Vn),n.includes(L.PDF_417)&&i.push(new Qn),a&&t&&i.push(new Jt(e))}i.length===0&&(t||i.push(new Jt(e)),i.push(new Yn),i.push(new jn),i.push(new Vn),i.push(new Qn),t&&i.push(new Jt(e))),this.readers=i},r.prototype.reset=function(){var e,t;if(this.readers!==null)try{for(var n=go(this.readers),i=n.next();!i.done;i=n.next()){var a=i.value;a.reset()}}catch(o){e={error:o}}finally{try{i&&!i.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}},r.prototype.decodeInternal=function(e){var t,n;if(this.readers===null)throw new po("No readers where selected, nothing can be read.");try{for(var i=go(this.readers),a=i.next();!a.done;a=i.next()){var o=a.value;try{return o.decode(e,this.hints)}catch(s){if(s instanceof po)continue}}}catch(s){t={error:s}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}throw new N("No MultiFormat Readers were able to detect the code.")},r}(),Pl=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)}}();(function(r){Pl(e,r);function e(t,n){t===void 0&&(t=null),n===void 0&&(n=500);var i=this,a=new Dl;return a.setHints(t),i=r.call(this,a,n)||this,i}return e.prototype.decodeBitmap=function(t){return this.reader.decodeWithState(t)},e})(Dt);var 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)}}();(function(r){Ml(e,r);function e(t){return t===void 0&&(t=500),r.call(this,new Qn,t)||this}return e})(Dt);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)}}();(function(r){Fl(e,r);function e(t){return t===void 0&&(t=500),r.call(this,new Yn,t)||this}return e})(Dt);var Jn;(function(r){r[r.ERROR_CORRECTION=0]="ERROR_CORRECTION",r[r.CHARACTER_SET=1]="CHARACTER_SET",r[r.DATA_MATRIX_SHAPE=2]="DATA_MATRIX_SHAPE",r[r.DATA_MATRIX_COMPACT=3]="DATA_MATRIX_COMPACT",r[r.MIN_SIZE=4]="MIN_SIZE",r[r.MAX_SIZE=5]="MAX_SIZE",r[r.MARGIN=6]="MARGIN",r[r.PDF417_COMPACT=7]="PDF417_COMPACT",r[r.PDF417_COMPACTION=8]="PDF417_COMPACTION",r[r.PDF417_DIMENSIONS=9]="PDF417_DIMENSIONS",r[r.AZTEC_LAYERS=10]="AZTEC_LAYERS",r[r.QR_VERSION=11]="QR_VERSION",r[r.GS1_FORMAT=12]="GS1_FORMAT",r[r.FORCE_C40=13]="FORCE_C40"})(Jn||(Jn={}));const Vr=Jn;var xo=function(){function r(e){this.field=e,this.cachedGenerators=[],this.cachedGenerators.push(new ot(e,Int32Array.from([1])))}return r.prototype.buildGenerator=function(e){var t=this.cachedGenerators;if(e>=t.length)for(var n=t[t.length-1],i=this.field,a=t.length;a<=e;a++){var o=n.multiply(new ot(i,Int32Array.from([1,i.exp(a-1+i.getGeneratorBase())])));t.push(o),n=o}return t[e]},r.prototype.encode=function(e,t){if(t===0)throw new V("No error correction bytes");var n=e.length-t;if(n<=0)throw new V("No data bytes provided");var i=this.buildGenerator(t),a=new Int32Array(n);re.arraycopy(e,0,a,0,n);var o=new ot(this.field,a);o=o.multiplyByMonomial(t,1);for(var s=o.divide(i)[1],f=s.getCoefficients(),u=t-f.length,c=0;c<u;c++)e[n+c]=0;re.arraycopy(f,0,e,n+u,f.length)},r}(),nr=function(){function r(){}return r.applyMaskPenaltyRule1=function(e){return r.applyMaskPenaltyRule1Internal(e,!0)+r.applyMaskPenaltyRule1Internal(e,!1)},r.applyMaskPenaltyRule2=function(e){for(var t=0,n=e.getArray(),i=e.getWidth(),a=e.getHeight(),o=0;o<a-1;o++)for(var s=n[o],f=0;f<i-1;f++){var u=s[f];u===s[f+1]&&u===n[o+1][f]&&u===n[o+1][f+1]&&t++}return r.N2*t},r.applyMaskPenaltyRule3=function(e){for(var t=0,n=e.getArray(),i=e.getWidth(),a=e.getHeight(),o=0;o<a;o++)for(var s=0;s<i;s++){var f=n[o];s+6<i&&f[s]===1&&f[s+1]===0&&f[s+2]===1&&f[s+3]===1&&f[s+4]===1&&f[s+5]===0&&f[s+6]===1&&(r.isWhiteHorizontal(f,s-4,s)||r.isWhiteHorizontal(f,s+7,s+11))&&t++,o+6<a&&n[o][s]===1&&n[o+1][s]===0&&n[o+2][s]===1&&n[o+3][s]===1&&n[o+4][s]===1&&n[o+5][s]===0&&n[o+6][s]===1&&(r.isWhiteVertical(n,s,o-4,o)||r.isWhiteVertical(n,s,o+7,o+11))&&t++}return t*r.N3},r.isWhiteHorizontal=function(e,t,n){t=Math.max(t,0),n=Math.min(n,e.length);for(var i=t;i<n;i++)if(e[i]===1)return!1;return!0},r.isWhiteVertical=function(e,t,n,i){n=Math.max(n,0),i=Math.min(i,e.length);for(var a=n;a<i;a++)if(e[a][t]===1)return!1;return!0},r.applyMaskPenaltyRule4=function(e){for(var t=0,n=e.getArray(),i=e.getWidth(),a=e.getHeight(),o=0;o<a;o++)for(var s=n[o],f=0;f<i;f++)s[f]===1&&t++;var u=e.getHeight()*e.getWidth(),c=Math.floor(Math.abs(t*2-u)*10/u);return c*r.N4},r.getDataMaskBit=function(e,t,n){var i,a;switch(e){case 0:i=n+t&1;break;case 1:i=n&1;break;case 2:i=t%3;break;case 3:i=(n+t)%3;break;case 4:i=Math.floor(n/2)+Math.floor(t/3)&1;break;case 5:a=n*t,i=(a&1)+a%3;break;case 6:a=n*t,i=(a&1)+a%3&1;break;case 7:a=n*t,i=a%3+(n+t&1)&1;break;default:throw new V("Invalid mask pattern: "+e)}return i===0},r.applyMaskPenaltyRule1Internal=function(e,t){for(var n=0,i=t?e.getHeight():e.getWidth(),a=t?e.getWidth():e.getHeight(),o=e.getArray(),s=0;s<i;s++){for(var f=0,u=-1,c=0;c<a;c++){var l=t?o[s][c]:o[c][s];l===u?f++:(f>=5&&(n+=r.N1+(f-5)),f=1,u=l)}f>=5&&(n+=r.N1+(f-5))}return n},r.N1=3,r.N2=3,r.N3=40,r.N4=10,r}(),Rl=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.")},Bl=function(){function r(e,t){this.width=e,this.height=t;for(var n=new Array(t),i=0;i!==t;i++)n[i]=new Uint8Array(e);this.bytes=n}return r.prototype.getHeight=function(){return this.height},r.prototype.getWidth=function(){return this.width},r.prototype.get=function(e,t){return this.bytes[t][e]},r.prototype.getArray=function(){return this.bytes},r.prototype.setNumber=function(e,t,n){this.bytes[t][e]=n},r.prototype.setBoolean=function(e,t,n){this.bytes[t][e]=n?1:0},r.prototype.clear=function(e){var t,n;try{for(var i=Rl(this.bytes),a=i.next();!a.done;a=i.next()){var o=a.value;fe.fill(o,e)}}catch(s){t={error:s}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}},r.prototype.equals=function(e){if(!(e instanceof r))return!1;var t=e;if(this.width!==t.width||this.height!==t.height)return!1;for(var n=0,i=this.height;n<i;++n)for(var a=this.bytes[n],o=t.bytes[n],s=0,f=this.width;s<f;++s)if(a[s]!==o[s])return!1;return!0},r.prototype.toString=function(){for(var e=new z,t=0,n=this.height;t<n;++t){for(var i=this.bytes[t],a=0,o=this.width;a<o;++a)switch(i[a]){case 0:e.append(" 0");break;case 1:e.append(" 1");break;default:e.append(" ");break}e.append(`
|
|
53
|
-
`)}return e.toString()},r}(),
|
|
50
|
+
`,". ",", ",": ","!",'"',"#","$","%","&","'","(",")","*","+",",","-",".","/",":",";","<","=",">","?","[","]","{","}","CTRL_UL"],r.DIGIT_TABLE=["CTRL_PS"," ","0","1","2","3","4","5","6","7","8","9",",",".","CTRL_UL","CTRL_US"],r}(),Q=function(){function r(){}return r.round=function(e){return isNaN(e)?0:e<=Number.MIN_SAFE_INTEGER?Number.MIN_SAFE_INTEGER:e>=Number.MAX_SAFE_INTEGER?Number.MAX_SAFE_INTEGER:e+(e<0?-.5:.5)|0},r.distance=function(e,t,n,i){var o=e-n,a=t-i;return Math.sqrt(o*o+a*a)},r.sum=function(e){for(var t=0,n=0,i=e.length;n!==i;n++){var o=e[n];t+=o}return t},r}(),ni=function(){function r(){}return r.floatToIntBits=function(e){return e},r.MAX_VALUE=Number.MAX_SAFE_INTEGER,r}(),X=function(){function r(e,t){this.x=e,this.y=t}return r.prototype.getX=function(){return this.x},r.prototype.getY=function(){return this.y},r.prototype.equals=function(e){if(e instanceof r){var t=e;return this.x===t.x&&this.y===t.y}return!1},r.prototype.hashCode=function(){return 31*ni.floatToIntBits(this.x)+ni.floatToIntBits(this.y)},r.prototype.toString=function(){return"("+this.x+","+this.y+")"},r.orderBestPatterns=function(e){var t=this.distance(e[0],e[1]),n=this.distance(e[1],e[2]),i=this.distance(e[0],e[2]),o,a,s;if(n>=t&&n>=i?(a=e[0],o=e[1],s=e[2]):i>=n&&i>=t?(a=e[1],o=e[0],s=e[2]):(a=e[2],o=e[0],s=e[1]),this.crossProductZ(o,a,s)<0){var l=o;o=s,s=l}e[0]=o,e[1]=a,e[2]=s},r.distance=function(e,t){return Q.distance(e.x,e.y,t.x,t.y)},r.crossProductZ=function(e,t,n){var i=t.x,o=t.y;return(n.x-i)*(e.y-o)-(n.y-o)*(e.x-i)},r}(),ii=function(){function r(e,t){this.bits=e,this.points=t}return r.prototype.getBits=function(){return this.bits},r.prototype.getPoints=function(){return this.points},r}(),mc=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)i.hasOwnProperty(o)&&(n[o]=i[o])},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)}}(),wc=function(r){mc(e,r);function e(t,n,i,o,a){var s=r.call(this,t,n)||this;return s.compact=i,s.nbDatablocks=o,s.nbLayers=a,s}return e.prototype.getNbLayers=function(){return this.nbLayers},e.prototype.getNbDatablocks=function(){return this.nbDatablocks},e.prototype.isCompact=function(){return this.compact},e}(ii),oi=function(){function r(e,t,n,i){this.image=e,this.height=e.getHeight(),this.width=e.getWidth(),t==null&&(t=r.INIT_SIZE),n==null&&(n=e.getWidth()/2|0),i==null&&(i=e.getHeight()/2|0);var o=t/2|0;if(this.leftInit=n-o,this.rightInit=n+o,this.upInit=i-o,this.downInit=i+o,this.upInit<0||this.leftInit<0||this.downInit>=this.height||this.rightInit>=this.width)throw new D}return r.prototype.detect=function(){for(var e=this.leftInit,t=this.rightInit,n=this.upInit,i=this.downInit,o=!1,a=!0,s=!1,l=!1,u=!1,c=!1,f=!1,h=this.width,v=this.height;a;){a=!1;for(var p=!0;(p||!l)&&t<h;)p=this.containsBlackPoint(n,i,t,!1),p?(t++,a=!0,l=!0):l||t++;if(t>=h){o=!0;break}for(var g=!0;(g||!u)&&i<v;)g=this.containsBlackPoint(e,t,i,!0),g?(i++,a=!0,u=!0):u||i++;if(i>=v){o=!0;break}for(var m=!0;(m||!c)&&e>=0;)m=this.containsBlackPoint(n,i,e,!1),m?(e--,a=!0,c=!0):c||e--;if(e<0){o=!0;break}for(var y=!0;(y||!f)&&n>=0;)y=this.containsBlackPoint(e,t,n,!0),y?(n--,a=!0,f=!0):f||n--;if(n<0){o=!0;break}a&&(s=!0)}if(!o&&s){for(var C=t-e,w=null,E=1;w===null&&E<C;E++)w=this.getBlackPointOnSegment(e,i-E,e+E,i);if(w==null)throw new D;for(var I=null,E=1;I===null&&E<C;E++)I=this.getBlackPointOnSegment(e,n+E,e+E,n);if(I==null)throw new D;for(var S=null,E=1;S===null&&E<C;E++)S=this.getBlackPointOnSegment(t,n+E,t-E,n);if(S==null)throw new D;for(var b=null,E=1;b===null&&E<C;E++)b=this.getBlackPointOnSegment(t,i-E,t-E,i);if(b==null)throw new D;return this.centerEdges(b,w,S,I)}else throw new D},r.prototype.getBlackPointOnSegment=function(e,t,n,i){for(var o=Q.round(Q.distance(e,t,n,i)),a=(n-e)/o,s=(i-t)/o,l=this.image,u=0;u<o;u++){var c=Q.round(e+u*a),f=Q.round(t+u*s);if(l.get(c,f))return new X(c,f)}return null},r.prototype.centerEdges=function(e,t,n,i){var o=e.getX(),a=e.getY(),s=t.getX(),l=t.getY(),u=n.getX(),c=n.getY(),f=i.getX(),h=i.getY(),v=r.CORR;return o<this.width/2?[new X(f-v,h+v),new X(s+v,l+v),new X(u-v,c-v),new X(o+v,a-v)]:[new X(f+v,h+v),new X(s+v,l-v),new X(u-v,c+v),new X(o-v,a-v)]},r.prototype.containsBlackPoint=function(e,t,n,i){var o=this.image;if(i){for(var a=e;a<=t;a++)if(o.get(a,n))return!0}else for(var s=e;s<=t;s++)if(o.get(n,s))return!0;return!1},r.INIT_SIZE=10,r.CORR=1,r}(),fa=function(){function r(){}return r.checkAndNudgePoints=function(e,t){for(var n=e.getWidth(),i=e.getHeight(),o=!0,a=0;a<t.length&&o;a+=2){var s=Math.floor(t[a]),l=Math.floor(t[a+1]);if(s<-1||s>n||l<-1||l>i)throw new D;o=!1,s===-1?(t[a]=0,o=!0):s===n&&(t[a]=n-1,o=!0),l===-1?(t[a+1]=0,o=!0):l===i&&(t[a+1]=i-1,o=!0)}o=!0;for(var a=t.length-2;a>=0&&o;a-=2){var s=Math.floor(t[a]),l=Math.floor(t[a+1]);if(s<-1||s>n||l<-1||l>i)throw new D;o=!1,s===-1?(t[a]=0,o=!0):s===n&&(t[a]=n-1,o=!0),l===-1?(t[a+1]=0,o=!0):l===i&&(t[a+1]=i-1,o=!0)}},r}(),da=function(){function r(e,t,n,i,o,a,s,l,u){this.a11=e,this.a21=t,this.a31=n,this.a12=i,this.a22=o,this.a32=a,this.a13=s,this.a23=l,this.a33=u}return r.quadrilateralToQuadrilateral=function(e,t,n,i,o,a,s,l,u,c,f,h,v,p,g,m){var y=r.quadrilateralToSquare(e,t,n,i,o,a,s,l),C=r.squareToQuadrilateral(u,c,f,h,v,p,g,m);return C.times(y)},r.prototype.transformPoints=function(e){for(var t=e.length,n=this.a11,i=this.a12,o=this.a13,a=this.a21,s=this.a22,l=this.a23,u=this.a31,c=this.a32,f=this.a33,h=0;h<t;h+=2){var v=e[h],p=e[h+1],g=o*v+l*p+f;e[h]=(n*v+a*p+u)/g,e[h+1]=(i*v+s*p+c)/g}},r.prototype.transformPointsWithValues=function(e,t){for(var n=this.a11,i=this.a12,o=this.a13,a=this.a21,s=this.a22,l=this.a23,u=this.a31,c=this.a32,f=this.a33,h=e.length,v=0;v<h;v++){var p=e[v],g=t[v],m=o*p+l*g+f;e[v]=(n*p+a*g+u)/m,t[v]=(i*p+s*g+c)/m}},r.squareToQuadrilateral=function(e,t,n,i,o,a,s,l){var u=e-n+o-s,c=t-i+a-l;if(u===0&&c===0)return new r(n-e,o-n,e,i-t,a-i,t,0,0,1);var f=n-o,h=s-o,v=i-a,p=l-a,g=f*p-h*v,m=(u*p-h*c)/g,y=(f*c-u*v)/g;return new r(n-e+m*n,s-e+y*s,e,i-t+m*i,l-t+y*l,t,m,y,1)},r.quadrilateralToSquare=function(e,t,n,i,o,a,s,l){return r.squareToQuadrilateral(e,t,n,i,o,a,s,l).buildAdjoint()},r.prototype.buildAdjoint=function(){return new r(this.a22*this.a33-this.a23*this.a32,this.a23*this.a31-this.a21*this.a33,this.a21*this.a32-this.a22*this.a31,this.a13*this.a32-this.a12*this.a33,this.a11*this.a33-this.a13*this.a31,this.a12*this.a31-this.a11*this.a32,this.a12*this.a23-this.a13*this.a22,this.a13*this.a21-this.a11*this.a23,this.a11*this.a22-this.a12*this.a21)},r.prototype.times=function(e){return new r(this.a11*e.a11+this.a21*e.a12+this.a31*e.a13,this.a11*e.a21+this.a21*e.a22+this.a31*e.a23,this.a11*e.a31+this.a21*e.a32+this.a31*e.a33,this.a12*e.a11+this.a22*e.a12+this.a32*e.a13,this.a12*e.a21+this.a22*e.a22+this.a32*e.a23,this.a12*e.a31+this.a22*e.a32+this.a32*e.a33,this.a13*e.a11+this.a23*e.a12+this.a33*e.a13,this.a13*e.a21+this.a23*e.a22+this.a33*e.a23,this.a13*e.a31+this.a23*e.a32+this.a33*e.a33)},r}(),_c=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)i.hasOwnProperty(o)&&(n[o]=i[o])},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)}}(),Ac=function(r){_c(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.sampleGrid=function(t,n,i,o,a,s,l,u,c,f,h,v,p,g,m,y,C,w,E){var I=da.quadrilateralToQuadrilateral(o,a,s,l,u,c,f,h,v,p,g,m,y,C,w,E);return this.sampleGridWithTransform(t,n,i,I)},e.prototype.sampleGridWithTransform=function(t,n,i,o){if(n<=0||i<=0)throw new D;for(var a=new rt(n,i),s=new Float32Array(2*n),l=0;l<i;l++){for(var u=s.length,c=l+.5,f=0;f<u;f+=2)s[f]=f/2+.5,s[f+1]=c;o.transformPoints(s),fa.checkAndNudgePoints(t,s);try{for(var f=0;f<u;f+=2)t.get(Math.floor(s[f]),Math.floor(s[f+1]))&&a.set(f/2,l)}catch{throw new D}}return a},e}(fa),ai=function(){function r(){}return r.setGridSampler=function(e){r.gridSampler=e},r.getInstance=function(){return r.gridSampler},r.gridSampler=new Ac,r}(),ke=function(){function r(e,t){this.x=e,this.y=t}return r.prototype.toResultPoint=function(){return new X(this.getX(),this.getY())},r.prototype.getX=function(){return this.x},r.prototype.getY=function(){return this.y},r}(),Ec=function(){function r(e){this.EXPECTED_CORNER_BITS=new Int32Array([3808,476,2107,1799]),this.image=e}return r.prototype.detect=function(){return this.detectMirror(!1)},r.prototype.detectMirror=function(e){var t=this.getMatrixCenter(),n=this.getBullsEyeCorners(t);if(e){var i=n[0];n[0]=n[2],n[2]=i}this.extractParameters(n);var o=this.sampleGrid(this.image,n[this.shift%4],n[(this.shift+1)%4],n[(this.shift+2)%4],n[(this.shift+3)%4]),a=this.getMatrixCornerPoints(n);return new wc(o,a,this.compact,this.nbDataBlocks,this.nbLayers)},r.prototype.extractParameters=function(e){if(!this.isValidPoint(e[0])||!this.isValidPoint(e[1])||!this.isValidPoint(e[2])||!this.isValidPoint(e[3]))throw new D;var t=2*this.nbCenterLayers,n=new Int32Array([this.sampleLine(e[0],e[1],t),this.sampleLine(e[1],e[2],t),this.sampleLine(e[2],e[3],t),this.sampleLine(e[3],e[0],t)]);this.shift=this.getRotation(n,t);for(var i=0,o=0;o<4;o++){var a=n[(this.shift+o)%4];this.compact?(i<<=7,i+=a>>1&127):(i<<=10,i+=(a>>2&992)+(a>>1&31))}var s=this.getCorrectedParameterData(i,this.compact);this.compact?(this.nbLayers=(s>>6)+1,this.nbDataBlocks=(s&63)+1):(this.nbLayers=(s>>11)+1,this.nbDataBlocks=(s&2047)+1)},r.prototype.getRotation=function(e,t){var n=0;e.forEach(function(o,a,s){var l=(o>>t-2<<1)+(o&1);n=(n<<3)+l}),n=((n&1)<<11)+(n>>1);for(var i=0;i<4;i++)if(Y.bitCount(n^this.EXPECTED_CORNER_BITS[i])<=2)return i;throw new D},r.prototype.getCorrectedParameterData=function(e,t){var n,i;t?(n=7,i=2):(n=10,i=4);for(var o=n-i,a=new Int32Array(n),s=n-1;s>=0;--s)a[s]=e&15,e>>=4;try{var l=new Zr(Ve.AZTEC_PARAM);l.decode(a,o)}catch{throw new D}for(var u=0,s=0;s<i;s++)u=(u<<4)+a[s];return u},r.prototype.getBullsEyeCorners=function(e){var t=e,n=e,i=e,o=e,a=!0;for(this.nbCenterLayers=1;this.nbCenterLayers<9;this.nbCenterLayers++){var s=this.getFirstDifferent(t,a,1,-1),l=this.getFirstDifferent(n,a,1,1),u=this.getFirstDifferent(i,a,-1,1),c=this.getFirstDifferent(o,a,-1,-1);if(this.nbCenterLayers>2){var f=this.distancePoint(c,s)*this.nbCenterLayers/(this.distancePoint(o,t)*(this.nbCenterLayers+2));if(f<.75||f>1.25||!this.isWhiteOrBlackRectangle(s,l,u,c))break}t=s,n=l,i=u,o=c,a=!a}if(this.nbCenterLayers!==5&&this.nbCenterLayers!==7)throw new D;this.compact=this.nbCenterLayers===5;var h=new X(t.getX()+.5,t.getY()-.5),v=new X(n.getX()+.5,n.getY()+.5),p=new X(i.getX()-.5,i.getY()+.5),g=new X(o.getX()-.5,o.getY()-.5);return this.expandSquare([h,v,p,g],2*this.nbCenterLayers-3,2*this.nbCenterLayers)},r.prototype.getMatrixCenter=function(){var e,t,n,i;try{var o=new oi(this.image).detect();e=o[0],t=o[1],n=o[2],i=o[3]}catch{var a=this.image.getWidth()/2,s=this.image.getHeight()/2;e=this.getFirstDifferent(new ke(a+7,s-7),!1,1,-1).toResultPoint(),t=this.getFirstDifferent(new ke(a+7,s+7),!1,1,1).toResultPoint(),n=this.getFirstDifferent(new ke(a-7,s+7),!1,-1,1).toResultPoint(),i=this.getFirstDifferent(new ke(a-7,s-7),!1,-1,-1).toResultPoint()}var l=Q.round((e.getX()+i.getX()+t.getX()+n.getX())/4),u=Q.round((e.getY()+i.getY()+t.getY()+n.getY())/4);try{var o=new oi(this.image,15,l,u).detect();e=o[0],t=o[1],n=o[2],i=o[3]}catch{e=this.getFirstDifferent(new ke(l+7,u-7),!1,1,-1).toResultPoint(),t=this.getFirstDifferent(new ke(l+7,u+7),!1,1,1).toResultPoint(),n=this.getFirstDifferent(new ke(l-7,u+7),!1,-1,1).toResultPoint(),i=this.getFirstDifferent(new ke(l-7,u-7),!1,-1,-1).toResultPoint()}return l=Q.round((e.getX()+i.getX()+t.getX()+n.getX())/4),u=Q.round((e.getY()+i.getY()+t.getY()+n.getY())/4),new ke(l,u)},r.prototype.getMatrixCornerPoints=function(e){return this.expandSquare(e,2*this.nbCenterLayers,this.getDimension())},r.prototype.sampleGrid=function(e,t,n,i,o){var a=ai.getInstance(),s=this.getDimension(),l=s/2-this.nbCenterLayers,u=s/2+this.nbCenterLayers;return a.sampleGrid(e,s,s,l,l,u,l,u,u,l,u,t.getX(),t.getY(),n.getX(),n.getY(),i.getX(),i.getY(),o.getX(),o.getY())},r.prototype.sampleLine=function(e,t,n){for(var i=0,o=this.distanceResultPoint(e,t),a=o/n,s=e.getX(),l=e.getY(),u=a*(t.getX()-e.getX())/o,c=a*(t.getY()-e.getY())/o,f=0;f<n;f++)this.image.get(Q.round(s+f*u),Q.round(l+f*c))&&(i|=1<<n-f-1);return i},r.prototype.isWhiteOrBlackRectangle=function(e,t,n,i){var o=3;e=new ke(e.getX()-o,e.getY()+o),t=new ke(t.getX()-o,t.getY()-o),n=new ke(n.getX()+o,n.getY()-o),i=new ke(i.getX()+o,i.getY()+o);var a=this.getColor(i,e);if(a===0)return!1;var s=this.getColor(e,t);return s!==a||(s=this.getColor(t,n),s!==a)?!1:(s=this.getColor(n,i),s===a)},r.prototype.getColor=function(e,t){for(var n=this.distancePoint(e,t),i=(t.getX()-e.getX())/n,o=(t.getY()-e.getY())/n,a=0,s=e.getX(),l=e.getY(),u=this.image.get(e.getX(),e.getY()),c=Math.ceil(n),f=0;f<c;f++)s+=i,l+=o,this.image.get(Q.round(s),Q.round(l))!==u&&a++;var h=a/n;return h>.1&&h<.9?0:h<=.1===u?1:-1},r.prototype.getFirstDifferent=function(e,t,n,i){for(var o=e.getX()+n,a=e.getY()+i;this.isValid(o,a)&&this.image.get(o,a)===t;)o+=n,a+=i;for(o-=n,a-=i;this.isValid(o,a)&&this.image.get(o,a)===t;)o+=n;for(o-=n;this.isValid(o,a)&&this.image.get(o,a)===t;)a+=i;return a-=i,new ke(o,a)},r.prototype.expandSquare=function(e,t,n){var i=n/(2*t),o=e[0].getX()-e[2].getX(),a=e[0].getY()-e[2].getY(),s=(e[0].getX()+e[2].getX())/2,l=(e[0].getY()+e[2].getY())/2,u=new X(s+i*o,l+i*a),c=new X(s-i*o,l-i*a);o=e[1].getX()-e[3].getX(),a=e[1].getY()-e[3].getY(),s=(e[1].getX()+e[3].getX())/2,l=(e[1].getY()+e[3].getY())/2;var f=new X(s+i*o,l+i*a),h=new X(s-i*o,l-i*a),v=[u,f,c,h];return v},r.prototype.isValid=function(e,t){return e>=0&&e<this.image.getWidth()&&t>0&&t<this.image.getHeight()},r.prototype.isValidPoint=function(e){var t=Q.round(e.getX()),n=Q.round(e.getY());return this.isValid(t,n)},r.prototype.distancePoint=function(e,t){return Q.distance(e.getX(),e.getY(),t.getX(),t.getY())},r.prototype.distanceResultPoint=function(e,t){return Q.distance(e.getX(),e.getY(),t.getX(),t.getY())},r.prototype.getDimension=function(){return this.compact?4*this.nbLayers+11:this.nbLayers<=4?4*this.nbLayers+15:4*this.nbLayers+2*(Y.truncDivision(this.nbLayers-4,8)+1)+15},r}(),si=function(){function r(){}return r.prototype.decode=function(e,t){t===void 0&&(t=null);var n=null,i=new Ec(e.getBlackMatrix()),o=null,a=null;try{var s=i.detectMirror(!1);o=s.getPoints(),this.reportFoundResultPoints(t,o),a=new ca().decode(s)}catch(f){n=f}if(a==null)try{var s=i.detectMirror(!0);o=s.getPoints(),this.reportFoundResultPoints(t,o),a=new ca().decode(s)}catch(f){throw n??f}var l=new Oe(a.getText(),a.getRawBytes(),a.getNumBits(),o,H.AZTEC,se.currentTimeMillis()),u=a.getByteSegments();u!=null&&l.putMetadata(Ie.BYTE_SEGMENTS,u);var c=a.getECLevel();return c!=null&&l.putMetadata(Ie.ERROR_CORRECTION_LEVEL,c),l},r.prototype.reportFoundResultPoints=function(e,t){if(e!=null){var n=e.get(fe.NEED_RESULT_POINT_CALLBACK);n!=null&&t.forEach(function(i,o,a){n.foundPossibleResultPoint(i)})}},r.prototype.reset=function(){},r}(),Ic=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)i.hasOwnProperty(o)&&(n[o]=i[o])},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)}}();(function(r){Ic(e,r);function e(t){return t===void 0&&(t=500),r.call(this,new si,t)||this}return e})(Vt);var ve=function(){function r(){}return r.prototype.decode=function(e,t){try{return this.doDecode(e,t)}catch{var n=t&&t.get(fe.TRY_HARDER)===!0;if(n&&e.isRotateSupported()){var i=e.rotateCounterClockwise(),o=this.doDecode(i,t),a=o.getResultMetadata(),s=270;a!==null&&a.get(Ie.ORIENTATION)===!0&&(s=s+a.get(Ie.ORIENTATION)%360),o.putMetadata(Ie.ORIENTATION,s);var l=o.getResultPoints();if(l!==null)for(var u=i.getHeight(),c=0;c<l.length;c++)l[c]=new X(u-l[c].getY()-1,l[c].getX());return o}else throw new D}},r.prototype.reset=function(){},r.prototype.doDecode=function(e,t){var n=e.getWidth(),i=e.getHeight(),o=new me(n),a=t&&t.get(fe.TRY_HARDER)===!0,s=Math.max(1,i>>(a?8:5)),l;a?l=i:l=15;for(var u=Math.trunc(i/2),c=0;c<l;c++){var f=Math.trunc((c+1)/2),h=(c&1)===0,v=u+s*(h?f:-f);if(v<0||v>=i)break;try{o=e.getBlackRow(v,o)}catch{continue}for(var p=function(C){if(C===1&&(o.reverse(),t&&t.get(fe.NEED_RESULT_POINT_CALLBACK)===!0)){var w=new Map;t.forEach(function(S,b){return w.set(b,S)}),w.delete(fe.NEED_RESULT_POINT_CALLBACK),t=w}try{var E=g.decodeRow(v,o,t);if(C===1){E.putMetadata(Ie.ORIENTATION,180);var I=E.getResultPoints();I!==null&&(I[0]=new X(n-I[0].getX()-1,I[0].getY()),I[1]=new X(n-I[1].getX()-1,I[1].getY()))}return{value:E}}catch{}},g=this,m=0;m<2;m++){var y=p(m);if(typeof y=="object")return y.value}}throw new D},r.recordPattern=function(e,t,n){for(var i=n.length,o=0;o<i;o++)n[o]=0;var a=e.getSize();if(t>=a)throw new D;for(var s=!e.get(t),l=0,u=t;u<a;){if(e.get(u)!==s)n[l]++;else{if(++l===i)break;n[l]=1,s=!s}u++}if(!(l===i||l===i-1&&u===a))throw new D},r.recordPatternInReverse=function(e,t,n){for(var i=n.length,o=e.get(t);t>0&&i>=0;)e.get(--t)!==o&&(i--,o=!o);if(i>=0)throw new D;r.recordPattern(e,t+1,n)},r.patternMatchVariance=function(e,t,n){for(var i=e.length,o=0,a=0,s=0;s<i;s++)o+=e[s],a+=t[s];if(o<a)return Number.POSITIVE_INFINITY;var l=o/a;n*=l;for(var u=0,c=0;c<i;c++){var f=e[c],h=t[c]*l,v=f>h?f-h:h-f;if(v>n)return Number.POSITIVE_INFINITY;u+=v}return u/o},r}(),Sc=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)i.hasOwnProperty(o)&&(n[o]=i[o])},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)}}(),ha=function(r){Sc(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.findStartPattern=function(t){for(var n=t.getSize(),i=t.getNextSet(0),o=0,a=Int32Array.from([0,0,0,0,0,0]),s=i,l=!1,u=6,c=i;c<n;c++)if(t.get(c)!==l)a[o]++;else{if(o===u-1){for(var f=e.MAX_AVG_VARIANCE,h=-1,v=e.CODE_START_A;v<=e.CODE_START_C;v++){var p=ve.patternMatchVariance(a,e.CODE_PATTERNS[v],e.MAX_INDIVIDUAL_VARIANCE);p<f&&(f=p,h=v)}if(h>=0&&t.isRange(Math.max(0,s-(c-s)/2),s,!1))return Int32Array.from([s,c,h]);s+=a[0]+a[1],a=a.slice(2,a.length-1),a[o-1]=0,a[o]=0,o--}else o++;a[o]=1,l=!l}throw new D},e.decodeCode=function(t,n,i){ve.recordPattern(t,i,n);for(var o=e.MAX_AVG_VARIANCE,a=-1,s=0;s<e.CODE_PATTERNS.length;s++){var l=e.CODE_PATTERNS[s],u=this.patternMatchVariance(n,l,e.MAX_INDIVIDUAL_VARIANCE);u<o&&(o=u,a=s)}if(a>=0)return a;throw new D},e.prototype.decodeRow=function(t,n,i){var o=i&&i.get(fe.ASSUME_GS1)===!0,a=e.findStartPattern(n),s=a[2],l=0,u=new Uint8Array(20);u[l++]=s;var c;switch(s){case e.CODE_START_A:c=e.CODE_CODE_A;break;case e.CODE_START_B:c=e.CODE_CODE_B;break;case e.CODE_START_C:c=e.CODE_CODE_C;break;default:throw new k}for(var f=!1,h=!1,v="",p=a[0],g=a[1],m=Int32Array.from([0,0,0,0,0,0]),y=0,C=0,w=s,E=0,I=!0,S=!1,b=!1;!f;){var P=h;switch(h=!1,y=C,C=e.decodeCode(n,m,g),u[l++]=C,C!==e.CODE_STOP&&(I=!0),C!==e.CODE_STOP&&(E++,w+=E*C),p=g,g+=m.reduce(function(W,oe){return W+oe},0),C){case e.CODE_START_A:case e.CODE_START_B:case e.CODE_START_C:throw new k}switch(c){case e.CODE_CODE_A:if(C<64)b===S?v+=String.fromCharCode(32+C):v+=String.fromCharCode(32+C+128),b=!1;else if(C<96)b===S?v+=String.fromCharCode(C-64):v+=String.fromCharCode(C+64),b=!1;else switch(C!==e.CODE_STOP&&(I=!1),C){case e.CODE_FNC_1:o&&(v.length===0?v+="]C1":v+="");break;case e.CODE_FNC_2:case e.CODE_FNC_3:break;case e.CODE_FNC_4_A:!S&&b?(S=!0,b=!1):S&&b?(S=!1,b=!1):b=!0;break;case e.CODE_SHIFT:h=!0,c=e.CODE_CODE_B;break;case e.CODE_CODE_B:c=e.CODE_CODE_B;break;case e.CODE_CODE_C:c=e.CODE_CODE_C;break;case e.CODE_STOP:f=!0;break}break;case e.CODE_CODE_B:if(C<96)b===S?v+=String.fromCharCode(32+C):v+=String.fromCharCode(32+C+128),b=!1;else switch(C!==e.CODE_STOP&&(I=!1),C){case e.CODE_FNC_1:o&&(v.length===0?v+="]C1":v+="");break;case e.CODE_FNC_2:case e.CODE_FNC_3:break;case e.CODE_FNC_4_B:!S&&b?(S=!0,b=!1):S&&b?(S=!1,b=!1):b=!0;break;case e.CODE_SHIFT:h=!0,c=e.CODE_CODE_A;break;case e.CODE_CODE_A:c=e.CODE_CODE_A;break;case e.CODE_CODE_C:c=e.CODE_CODE_C;break;case e.CODE_STOP:f=!0;break}break;case e.CODE_CODE_C:if(C<100)C<10&&(v+="0"),v+=C;else switch(C!==e.CODE_STOP&&(I=!1),C){case e.CODE_FNC_1:o&&(v.length===0?v+="]C1":v+="");break;case e.CODE_CODE_A:c=e.CODE_CODE_A;break;case e.CODE_CODE_B:c=e.CODE_CODE_B;break;case e.CODE_STOP:f=!0;break}break}P&&(c=c===e.CODE_CODE_A?e.CODE_CODE_B:e.CODE_CODE_A)}var L=g-p;if(g=n.getNextUnset(g),!n.isRange(g,Math.min(n.getSize(),g+(g-p)/2),!1))throw new D;if(w-=E*y,w%103!==y)throw new Ce;var M=v.length;if(M===0)throw new D;M>0&&I&&(c===e.CODE_CODE_C?v=v.substring(0,M-2):v=v.substring(0,M-1));for(var F=(a[1]+a[0])/2,V=p+L/2,z=u.length,U=new Uint8Array(z),R=0;R<z;R++)U[R]=u[R];var G=[new X(F,t),new X(V,t)];return new Oe(v,U,0,G,H.CODE_128,new Date().getTime())},e.CODE_PATTERNS=[Int32Array.from([2,1,2,2,2,2]),Int32Array.from([2,2,2,1,2,2]),Int32Array.from([2,2,2,2,2,1]),Int32Array.from([1,2,1,2,2,3]),Int32Array.from([1,2,1,3,2,2]),Int32Array.from([1,3,1,2,2,2]),Int32Array.from([1,2,2,2,1,3]),Int32Array.from([1,2,2,3,1,2]),Int32Array.from([1,3,2,2,1,2]),Int32Array.from([2,2,1,2,1,3]),Int32Array.from([2,2,1,3,1,2]),Int32Array.from([2,3,1,2,1,2]),Int32Array.from([1,1,2,2,3,2]),Int32Array.from([1,2,2,1,3,2]),Int32Array.from([1,2,2,2,3,1]),Int32Array.from([1,1,3,2,2,2]),Int32Array.from([1,2,3,1,2,2]),Int32Array.from([1,2,3,2,2,1]),Int32Array.from([2,2,3,2,1,1]),Int32Array.from([2,2,1,1,3,2]),Int32Array.from([2,2,1,2,3,1]),Int32Array.from([2,1,3,2,1,2]),Int32Array.from([2,2,3,1,1,2]),Int32Array.from([3,1,2,1,3,1]),Int32Array.from([3,1,1,2,2,2]),Int32Array.from([3,2,1,1,2,2]),Int32Array.from([3,2,1,2,2,1]),Int32Array.from([3,1,2,2,1,2]),Int32Array.from([3,2,2,1,1,2]),Int32Array.from([3,2,2,2,1,1]),Int32Array.from([2,1,2,1,2,3]),Int32Array.from([2,1,2,3,2,1]),Int32Array.from([2,3,2,1,2,1]),Int32Array.from([1,1,1,3,2,3]),Int32Array.from([1,3,1,1,2,3]),Int32Array.from([1,3,1,3,2,1]),Int32Array.from([1,1,2,3,1,3]),Int32Array.from([1,3,2,1,1,3]),Int32Array.from([1,3,2,3,1,1]),Int32Array.from([2,1,1,3,1,3]),Int32Array.from([2,3,1,1,1,3]),Int32Array.from([2,3,1,3,1,1]),Int32Array.from([1,1,2,1,3,3]),Int32Array.from([1,1,2,3,3,1]),Int32Array.from([1,3,2,1,3,1]),Int32Array.from([1,1,3,1,2,3]),Int32Array.from([1,1,3,3,2,1]),Int32Array.from([1,3,3,1,2,1]),Int32Array.from([3,1,3,1,2,1]),Int32Array.from([2,1,1,3,3,1]),Int32Array.from([2,3,1,1,3,1]),Int32Array.from([2,1,3,1,1,3]),Int32Array.from([2,1,3,3,1,1]),Int32Array.from([2,1,3,1,3,1]),Int32Array.from([3,1,1,1,2,3]),Int32Array.from([3,1,1,3,2,1]),Int32Array.from([3,3,1,1,2,1]),Int32Array.from([3,1,2,1,1,3]),Int32Array.from([3,1,2,3,1,1]),Int32Array.from([3,3,2,1,1,1]),Int32Array.from([3,1,4,1,1,1]),Int32Array.from([2,2,1,4,1,1]),Int32Array.from([4,3,1,1,1,1]),Int32Array.from([1,1,1,2,2,4]),Int32Array.from([1,1,1,4,2,2]),Int32Array.from([1,2,1,1,2,4]),Int32Array.from([1,2,1,4,2,1]),Int32Array.from([1,4,1,1,2,2]),Int32Array.from([1,4,1,2,2,1]),Int32Array.from([1,1,2,2,1,4]),Int32Array.from([1,1,2,4,1,2]),Int32Array.from([1,2,2,1,1,4]),Int32Array.from([1,2,2,4,1,1]),Int32Array.from([1,4,2,1,1,2]),Int32Array.from([1,4,2,2,1,1]),Int32Array.from([2,4,1,2,1,1]),Int32Array.from([2,2,1,1,1,4]),Int32Array.from([4,1,3,1,1,1]),Int32Array.from([2,4,1,1,1,2]),Int32Array.from([1,3,4,1,1,1]),Int32Array.from([1,1,1,2,4,2]),Int32Array.from([1,2,1,1,4,2]),Int32Array.from([1,2,1,2,4,1]),Int32Array.from([1,1,4,2,1,2]),Int32Array.from([1,2,4,1,1,2]),Int32Array.from([1,2,4,2,1,1]),Int32Array.from([4,1,1,2,1,2]),Int32Array.from([4,2,1,1,1,2]),Int32Array.from([4,2,1,2,1,1]),Int32Array.from([2,1,2,1,4,1]),Int32Array.from([2,1,4,1,2,1]),Int32Array.from([4,1,2,1,2,1]),Int32Array.from([1,1,1,1,4,3]),Int32Array.from([1,1,1,3,4,1]),Int32Array.from([1,3,1,1,4,1]),Int32Array.from([1,1,4,1,1,3]),Int32Array.from([1,1,4,3,1,1]),Int32Array.from([4,1,1,1,1,3]),Int32Array.from([4,1,1,3,1,1]),Int32Array.from([1,1,3,1,4,1]),Int32Array.from([1,1,4,1,3,1]),Int32Array.from([3,1,1,1,4,1]),Int32Array.from([4,1,1,1,3,1]),Int32Array.from([2,1,1,4,1,2]),Int32Array.from([2,1,1,2,1,4]),Int32Array.from([2,1,1,2,3,2]),Int32Array.from([2,3,3,1,1,1,2])],e.MAX_AVG_VARIANCE=.25,e.MAX_INDIVIDUAL_VARIANCE=.7,e.CODE_SHIFT=98,e.CODE_CODE_C=99,e.CODE_CODE_B=100,e.CODE_CODE_A=101,e.CODE_FNC_1=102,e.CODE_FNC_2=97,e.CODE_FNC_3=96,e.CODE_FNC_4_A=101,e.CODE_FNC_4_B=100,e.CODE_START_A=103,e.CODE_START_B=104,e.CODE_START_C=105,e.CODE_STOP=106,e}(ve),bc=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)i.hasOwnProperty(o)&&(n[o]=i[o])},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)}}(),li=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.")},va=function(r){bc(e,r);function e(t,n){t===void 0&&(t=!1),n===void 0&&(n=!1);var i=r.call(this)||this;return i.usingCheckDigit=t,i.extendedMode=n,i.decodeRowResult="",i.counters=new Int32Array(9),i}return e.prototype.decodeRow=function(t,n,i){var o,a,s,l,u=this.counters;u.fill(0),this.decodeRowResult="";var c=e.findAsteriskPattern(n,u),f=n.getNextSet(c[1]),h=n.getSize(),v,p;do{e.recordPattern(n,f,u);var g=e.toNarrowWidePattern(u);if(g<0)throw new D;v=e.patternToChar(g),this.decodeRowResult+=v,p=f;try{for(var m=(o=void 0,li(u)),y=m.next();!y.done;y=m.next()){var C=y.value;f+=C}}catch(z){o={error:z}}finally{try{y&&!y.done&&(a=m.return)&&a.call(m)}finally{if(o)throw o.error}}f=n.getNextSet(f)}while(v!=="*");this.decodeRowResult=this.decodeRowResult.substring(0,this.decodeRowResult.length-1);var w=0;try{for(var E=li(u),I=E.next();!I.done;I=E.next()){var C=I.value;w+=C}}catch(z){s={error:z}}finally{try{I&&!I.done&&(l=E.return)&&l.call(E)}finally{if(s)throw s.error}}var S=f-p-w;if(f!==h&&S*2<w)throw new D;if(this.usingCheckDigit){for(var b=this.decodeRowResult.length-1,P=0,L=0;L<b;L++)P+=e.ALPHABET_STRING.indexOf(this.decodeRowResult.charAt(L));if(this.decodeRowResult.charAt(b)!==e.ALPHABET_STRING.charAt(P%43))throw new Ce;this.decodeRowResult=this.decodeRowResult.substring(0,b)}if(this.decodeRowResult.length===0)throw new D;var M;this.extendedMode?M=e.decodeExtended(this.decodeRowResult):M=this.decodeRowResult;var F=(c[1]+c[0])/2,V=p+w/2;return new Oe(M,null,0,[new X(F,t),new X(V,t)],H.CODE_39,new Date().getTime())},e.findAsteriskPattern=function(t,n){for(var i=t.getSize(),o=t.getNextSet(0),a=0,s=o,l=!1,u=n.length,c=o;c<i;c++)if(t.get(c)!==l)n[a]++;else{if(a===u-1){if(this.toNarrowWidePattern(n)===e.ASTERISK_ENCODING&&t.isRange(Math.max(0,s-Math.floor((c-s)/2)),s,!1))return[s,c];s+=n[0]+n[1],n.copyWithin(0,2,2+a-1),n[a-1]=0,n[a]=0,a--}else a++;n[a]=1,l=!l}throw new D},e.toNarrowWidePattern=function(t){var n,i,o=t.length,a=0,s;do{var l=2147483647;try{for(var u=(n=void 0,li(t)),c=u.next();!c.done;c=u.next()){var f=c.value;f<l&&f>a&&(l=f)}}catch(g){n={error:g}}finally{try{c&&!c.done&&(i=u.return)&&i.call(u)}finally{if(n)throw n.error}}a=l,s=0;for(var h=0,v=0,p=0;p<o;p++){var f=t[p];f>a&&(v|=1<<o-1-p,s++,h+=f)}if(s===3){for(var p=0;p<o&&s>0;p++){var f=t[p];if(f>a&&(s--,f*2>=h))return-1}return v}}while(s>3);return-1},e.patternToChar=function(t){for(var n=0;n<e.CHARACTER_ENCODINGS.length;n++)if(e.CHARACTER_ENCODINGS[n]===t)return e.ALPHABET_STRING.charAt(n);if(t===e.ASTERISK_ENCODING)return"*";throw new D},e.decodeExtended=function(t){for(var n=t.length,i="",o=0;o<n;o++){var a=t.charAt(o);if(a==="+"||a==="$"||a==="%"||a==="/"){var s=t.charAt(o+1),l="\0";switch(a){case"+":if(s>="A"&&s<="Z")l=String.fromCharCode(s.charCodeAt(0)+32);else throw new k;break;case"$":if(s>="A"&&s<="Z")l=String.fromCharCode(s.charCodeAt(0)-64);else throw new k;break;case"%":if(s>="A"&&s<="E")l=String.fromCharCode(s.charCodeAt(0)-38);else if(s>="F"&&s<="J")l=String.fromCharCode(s.charCodeAt(0)-11);else if(s>="K"&&s<="O")l=String.fromCharCode(s.charCodeAt(0)+16);else if(s>="P"&&s<="T")l=String.fromCharCode(s.charCodeAt(0)+43);else if(s==="U")l="\0";else if(s==="V")l="@";else if(s==="W")l="`";else if(s==="X"||s==="Y"||s==="Z")l="";else throw new k;break;case"/":if(s>="A"&&s<="O")l=String.fromCharCode(s.charCodeAt(0)-32);else if(s==="Z")l=":";else throw new k;break}i+=l,o++}else i+=a}return i},e.ALPHABET_STRING="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%",e.CHARACTER_ENCODINGS=[52,289,97,352,49,304,112,37,292,100,265,73,328,25,280,88,13,268,76,28,259,67,322,19,274,82,7,262,70,22,385,193,448,145,400,208,133,388,196,168,162,138,42],e.ASTERISK_ENCODING=148,e}(ve),Tc=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)i.hasOwnProperty(o)&&(n[o]=i[o])},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)}}(),ui=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.")},pa=function(r){Tc(e,r);function e(){var t=r.call(this)||this;return t.decodeRowResult="",t.counters=new Int32Array(6),t}return e.prototype.decodeRow=function(t,n,i){var o,a,s,l,u=this.findAsteriskPattern(n),c=n.getNextSet(u[1]),f=n.getSize(),h=this.counters;h.fill(0),this.decodeRowResult="";var v,p;do{e.recordPattern(n,c,h);var g=this.toPattern(h);if(g<0)throw new D;v=this.patternToChar(g),this.decodeRowResult+=v,p=c;try{for(var m=(o=void 0,ui(h)),y=m.next();!y.done;y=m.next()){var C=y.value;c+=C}}catch(L){o={error:L}}finally{try{y&&!y.done&&(a=m.return)&&a.call(m)}finally{if(o)throw o.error}}c=n.getNextSet(c)}while(v!=="*");this.decodeRowResult=this.decodeRowResult.substring(0,this.decodeRowResult.length-1);var w=0;try{for(var E=ui(h),I=E.next();!I.done;I=E.next()){var C=I.value;w+=C}}catch(L){s={error:L}}finally{try{I&&!I.done&&(l=E.return)&&l.call(E)}finally{if(s)throw s.error}}if(c===f||!n.get(c))throw new D;if(this.decodeRowResult.length<2)throw new D;this.checkChecksums(this.decodeRowResult),this.decodeRowResult=this.decodeRowResult.substring(0,this.decodeRowResult.length-2);var S=this.decodeExtended(this.decodeRowResult),b=(u[1]+u[0])/2,P=p+w/2;return new Oe(S,null,0,[new X(b,t),new X(P,t)],H.CODE_93,new Date().getTime())},e.prototype.findAsteriskPattern=function(t){var n=t.getSize(),i=t.getNextSet(0);this.counters.fill(0);for(var o=this.counters,a=i,s=!1,l=o.length,u=0,c=i;c<n;c++)if(t.get(c)!==s)o[u]++;else{if(u===l-1){if(this.toPattern(o)===e.ASTERISK_ENCODING)return new Int32Array([a,c]);a+=o[0]+o[1],o.copyWithin(0,2,2+u-1),o[u-1]=0,o[u]=0,u--}else u++;o[u]=1,s=!s}throw new D},e.prototype.toPattern=function(t){var n,i,o=0;try{for(var a=ui(t),s=a.next();!s.done;s=a.next()){var l=s.value;o+=l}}catch(p){n={error:p}}finally{try{s&&!s.done&&(i=a.return)&&i.call(a)}finally{if(n)throw n.error}}for(var u=0,c=t.length,f=0;f<c;f++){var h=Math.round(t[f]*9/o);if(h<1||h>4)return-1;if((f&1)===0)for(var v=0;v<h;v++)u=u<<1|1;else u<<=h}return u},e.prototype.patternToChar=function(t){for(var n=0;n<e.CHARACTER_ENCODINGS.length;n++)if(e.CHARACTER_ENCODINGS[n]===t)return e.ALPHABET_STRING.charAt(n);throw new D},e.prototype.decodeExtended=function(t){for(var n=t.length,i="",o=0;o<n;o++){var a=t.charAt(o);if(a>="a"&&a<="d"){if(o>=n-1)throw new k;var s=t.charAt(o+1),l="\0";switch(a){case"d":if(s>="A"&&s<="Z")l=String.fromCharCode(s.charCodeAt(0)+32);else throw new k;break;case"a":if(s>="A"&&s<="Z")l=String.fromCharCode(s.charCodeAt(0)-64);else throw new k;break;case"b":if(s>="A"&&s<="E")l=String.fromCharCode(s.charCodeAt(0)-38);else if(s>="F"&&s<="J")l=String.fromCharCode(s.charCodeAt(0)-11);else if(s>="K"&&s<="O")l=String.fromCharCode(s.charCodeAt(0)+16);else if(s>="P"&&s<="T")l=String.fromCharCode(s.charCodeAt(0)+43);else if(s==="U")l="\0";else if(s==="V")l="@";else if(s==="W")l="`";else if(s>="X"&&s<="Z")l="";else throw new k;break;case"c":if(s>="A"&&s<="O")l=String.fromCharCode(s.charCodeAt(0)-32);else if(s==="Z")l=":";else throw new k;break}i+=l,o++}else i+=a}return i},e.prototype.checkChecksums=function(t){var n=t.length;this.checkOneChecksum(t,n-2,20),this.checkOneChecksum(t,n-1,15)},e.prototype.checkOneChecksum=function(t,n,i){for(var o=1,a=0,s=n-1;s>=0;s--)a+=o*e.ALPHABET_STRING.indexOf(t.charAt(s)),++o>i&&(o=1);if(t.charAt(n)!==e.ALPHABET_STRING[a%47])throw new Ce},e.ALPHABET_STRING="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%abcd*",e.CHARACTER_ENCODINGS=[276,328,324,322,296,292,290,336,274,266,424,420,418,404,402,394,360,356,354,308,282,344,332,326,300,278,436,434,428,422,406,410,364,358,310,314,302,468,466,458,366,374,430,294,474,470,306,350],e.ASTERISK_ENCODING=e.CHARACTER_ENCODINGS[47],e}(ve),Oc=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)i.hasOwnProperty(o)&&(n[o]=i[o])},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)}}(),Nc=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.")},ga=function(r){Oc(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.narrowLineWidth=-1,t}return e.prototype.decodeRow=function(t,n,i){var o,a,s=this.decodeStart(n),l=this.decodeEnd(n),u=new q;e.decodeMiddle(n,s[1],l[0],u);var c=u.toString(),f=null;i!=null&&(f=i.get(fe.ALLOWED_LENGTHS)),f==null&&(f=e.DEFAULT_ALLOWED_LENGTHS);var h=c.length,v=!1,p=0;try{for(var g=Nc(f),m=g.next();!m.done;m=g.next()){var y=m.value;if(h===y){v=!0;break}y>p&&(p=y)}}catch(E){o={error:E}}finally{try{m&&!m.done&&(a=g.return)&&a.call(g)}finally{if(o)throw o.error}}if(!v&&h>p&&(v=!0),!v)throw new k;var C=[new X(s[1],t),new X(l[0],t)],w=new Oe(c,null,0,C,H.ITF,new Date().getTime());return w},e.decodeMiddle=function(t,n,i,o){var a=new Int32Array(10),s=new Int32Array(5),l=new Int32Array(5);for(a.fill(0),s.fill(0),l.fill(0);n<i;){ve.recordPattern(t,n,a);for(var u=0;u<5;u++){var c=2*u;s[u]=a[c],l[u]=a[c+1]}var f=e.decodeDigit(s);o.append(f.toString()),f=this.decodeDigit(l),o.append(f.toString()),a.forEach(function(h){n+=h})}},e.prototype.decodeStart=function(t){var n=e.skipWhiteSpace(t),i=e.findGuardPattern(t,n,e.START_PATTERN);return this.narrowLineWidth=(i[1]-i[0])/4,this.validateQuietZone(t,i[0]),i},e.prototype.validateQuietZone=function(t,n){var i=this.narrowLineWidth*10;i=i<n?i:n;for(var o=n-1;i>0&&o>=0&&!t.get(o);o--)i--;if(i!==0)throw new D},e.skipWhiteSpace=function(t){var n=t.getSize(),i=t.getNextSet(0);if(i===n)throw new D;return i},e.prototype.decodeEnd=function(t){t.reverse();try{var n=e.skipWhiteSpace(t),i=void 0;try{i=e.findGuardPattern(t,n,e.END_PATTERN_REVERSED[0])}catch(a){a instanceof D&&(i=e.findGuardPattern(t,n,e.END_PATTERN_REVERSED[1]))}this.validateQuietZone(t,i[0]);var o=i[0];return i[0]=t.getSize()-i[1],i[1]=t.getSize()-o,i}finally{t.reverse()}},e.findGuardPattern=function(t,n,i){var o=i.length,a=new Int32Array(o),s=t.getSize(),l=!1,u=0,c=n;a.fill(0);for(var f=n;f<s;f++)if(t.get(f)!==l)a[u]++;else{if(u===o-1){if(ve.patternMatchVariance(a,i,e.MAX_INDIVIDUAL_VARIANCE)<e.MAX_AVG_VARIANCE)return[c,f];c+=a[0]+a[1],se.arraycopy(a,2,a,0,u-1),a[u-1]=0,a[u]=0,u--}else u++;a[u]=1,l=!l}throw new D},e.decodeDigit=function(t){for(var n=e.MAX_AVG_VARIANCE,i=-1,o=e.PATTERNS.length,a=0;a<o;a++){var s=e.PATTERNS[a],l=ve.patternMatchVariance(t,s,e.MAX_INDIVIDUAL_VARIANCE);l<n?(n=l,i=a):l===n&&(i=-1)}if(i>=0)return i%10;throw new D},e.PATTERNS=[Int32Array.from([1,1,2,2,1]),Int32Array.from([2,1,1,1,2]),Int32Array.from([1,2,1,1,2]),Int32Array.from([2,2,1,1,1]),Int32Array.from([1,1,2,1,2]),Int32Array.from([2,1,2,1,1]),Int32Array.from([1,2,2,1,1]),Int32Array.from([1,1,1,2,2]),Int32Array.from([2,1,1,2,1]),Int32Array.from([1,2,1,2,1]),Int32Array.from([1,1,3,3,1]),Int32Array.from([3,1,1,1,3]),Int32Array.from([1,3,1,1,3]),Int32Array.from([3,3,1,1,1]),Int32Array.from([1,1,3,1,3]),Int32Array.from([3,1,3,1,1]),Int32Array.from([1,3,3,1,1]),Int32Array.from([1,1,1,3,3]),Int32Array.from([3,1,1,3,1]),Int32Array.from([1,3,1,3,1])],e.MAX_AVG_VARIANCE=.38,e.MAX_INDIVIDUAL_VARIANCE=.5,e.DEFAULT_ALLOWED_LENGTHS=[6,8,10,12,14],e.START_PATTERN=Int32Array.from([1,1,1,1]),e.END_PATTERN_REVERSED=[Int32Array.from([1,1,2]),Int32Array.from([1,1,3])],e}(ve),Dc=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)i.hasOwnProperty(o)&&(n[o]=i[o])},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)}}(),kt=function(r){Dc(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.decodeRowStringBuffer="",t}return e.findStartGuardPattern=function(t){for(var n=!1,i,o=0,a=Int32Array.from([0,0,0]);!n;){a=Int32Array.from([0,0,0]),i=e.findGuardPattern(t,o,!1,this.START_END_PATTERN,a);var s=i[0];o=i[1];var l=s-(o-s);l>=0&&(n=t.isRange(l,s,!1))}return i},e.checkChecksum=function(t){return e.checkStandardUPCEANChecksum(t)},e.checkStandardUPCEANChecksum=function(t){var n=t.length;if(n===0)return!1;var i=parseInt(t.charAt(n-1),10);return e.getStandardUPCEANChecksum(t.substring(0,n-1))===i},e.getStandardUPCEANChecksum=function(t){for(var n=t.length,i=0,o=n-1;o>=0;o-=2){var a=t.charAt(o).charCodeAt(0)-48;if(a<0||a>9)throw new k;i+=a}i*=3;for(var o=n-2;o>=0;o-=2){var a=t.charAt(o).charCodeAt(0)-48;if(a<0||a>9)throw new k;i+=a}return(1e3-i)%10},e.decodeEnd=function(t,n){return e.findGuardPattern(t,n,!1,e.START_END_PATTERN,new Int32Array(e.START_END_PATTERN.length).fill(0))},e.findGuardPatternWithoutCounters=function(t,n,i,o){return this.findGuardPattern(t,n,i,o,new Int32Array(o.length))},e.findGuardPattern=function(t,n,i,o,a){var s=t.getSize();n=i?t.getNextUnset(n):t.getNextSet(n);for(var l=0,u=n,c=o.length,f=i,h=n;h<s;h++)if(t.get(h)!==f)a[l]++;else{if(l===c-1){if(ve.patternMatchVariance(a,o,e.MAX_INDIVIDUAL_VARIANCE)<e.MAX_AVG_VARIANCE)return Int32Array.from([u,h]);u+=a[0]+a[1];for(var v=a.slice(2,a.length),p=0;p<l-1;p++)a[p]=v[p];a[l-1]=0,a[l]=0,l--}else l++;a[l]=1,f=!f}throw new D},e.decodeDigit=function(t,n,i,o){this.recordPattern(t,i,n);for(var a=this.MAX_AVG_VARIANCE,s=-1,l=o.length,u=0;u<l;u++){var c=o[u],f=ve.patternMatchVariance(n,c,e.MAX_INDIVIDUAL_VARIANCE);f<a&&(a=f,s=u)}if(s>=0)return s;throw new D},e.MAX_AVG_VARIANCE=.48,e.MAX_INDIVIDUAL_VARIANCE=.7,e.START_END_PATTERN=Int32Array.from([1,1,1]),e.MIDDLE_PATTERN=Int32Array.from([1,1,1,1,1]),e.END_PATTERN=Int32Array.from([1,1,1,1,1,1]),e.L_PATTERNS=[Int32Array.from([3,2,1,1]),Int32Array.from([2,2,2,1]),Int32Array.from([2,1,2,2]),Int32Array.from([1,4,1,1]),Int32Array.from([1,1,3,2]),Int32Array.from([1,2,3,1]),Int32Array.from([1,1,1,4]),Int32Array.from([1,3,1,2]),Int32Array.from([1,2,1,3]),Int32Array.from([3,1,1,2])],e}(ve),Mc=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.")},Pc=function(){function r(){this.CHECK_DIGIT_ENCODINGS=[24,20,18,17,12,6,3,10,9,5],this.decodeMiddleCounters=Int32Array.from([0,0,0,0]),this.decodeRowStringBuffer=""}return r.prototype.decodeRow=function(e,t,n){var i=this.decodeRowStringBuffer,o=this.decodeMiddle(t,n,i),a=i.toString(),s=r.parseExtensionString(a),l=[new X((n[0]+n[1])/2,e),new X(o,e)],u=new Oe(a,null,0,l,H.UPC_EAN_EXTENSION,new Date().getTime());return s!=null&&u.putAllMetadata(s),u},r.prototype.decodeMiddle=function(e,t,n){var i,o,a=this.decodeMiddleCounters;a[0]=0,a[1]=0,a[2]=0,a[3]=0;for(var s=e.getSize(),l=t[1],u=0,c=0;c<5&&l<s;c++){var f=kt.decodeDigit(e,a,l,kt.L_AND_G_PATTERNS);n+=String.fromCharCode(48+f%10);try{for(var h=(i=void 0,Mc(a)),v=h.next();!v.done;v=h.next()){var p=v.value;l+=p}}catch(m){i={error:m}}finally{try{v&&!v.done&&(o=h.return)&&o.call(h)}finally{if(i)throw i.error}}f>=10&&(u|=1<<4-c),c!==4&&(l=e.getNextSet(l),l=e.getNextUnset(l))}if(n.length!==5)throw new D;var g=this.determineCheckDigit(u);if(r.extensionChecksum(n.toString())!==g)throw new D;return l},r.extensionChecksum=function(e){for(var t=e.length,n=0,i=t-2;i>=0;i-=2)n+=e.charAt(i).charCodeAt(0)-48;n*=3;for(var i=t-1;i>=0;i-=2)n+=e.charAt(i).charCodeAt(0)-48;return n*=3,n%10},r.prototype.determineCheckDigit=function(e){for(var t=0;t<10;t++)if(e===this.CHECK_DIGIT_ENCODINGS[t])return t;throw new D},r.parseExtensionString=function(e){if(e.length!==5)return null;var t=r.parseExtension5String(e);return t==null?null:new Map([[Ie.SUGGESTED_PRICE,t]])},r.parseExtension5String=function(e){var t;switch(e.charAt(0)){case"0":t="£";break;case"5":t="$";break;case"9":switch(e){case"90000":return null;case"99991":return"0.00";case"99990":return"Used"}t="";break;default:t="";break}var n=parseInt(e.substring(1)),i=(n/100).toString(),o=n%100,a=o<10?"0"+o:o.toString();return t+i+"."+a},r}(),Fc=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.")},Bc=function(){function r(){this.decodeMiddleCounters=Int32Array.from([0,0,0,0]),this.decodeRowStringBuffer=""}return r.prototype.decodeRow=function(e,t,n){var i=this.decodeRowStringBuffer,o=this.decodeMiddle(t,n,i),a=i.toString(),s=r.parseExtensionString(a),l=[new X((n[0]+n[1])/2,e),new X(o,e)],u=new Oe(a,null,0,l,H.UPC_EAN_EXTENSION,new Date().getTime());return s!=null&&u.putAllMetadata(s),u},r.prototype.decodeMiddle=function(e,t,n){var i,o,a=this.decodeMiddleCounters;a[0]=0,a[1]=0,a[2]=0,a[3]=0;for(var s=e.getSize(),l=t[1],u=0,c=0;c<2&&l<s;c++){var f=kt.decodeDigit(e,a,l,kt.L_AND_G_PATTERNS);n+=String.fromCharCode(48+f%10);try{for(var h=(i=void 0,Fc(a)),v=h.next();!v.done;v=h.next()){var p=v.value;l+=p}}catch(g){i={error:g}}finally{try{v&&!v.done&&(o=h.return)&&o.call(h)}finally{if(i)throw i.error}}f>=10&&(u|=1<<1-c),c!==1&&(l=e.getNextSet(l),l=e.getNextUnset(l))}if(n.length!==2)throw new D;if(parseInt(n.toString())%4!==u)throw new D;return l},r.parseExtensionString=function(e){return e.length!==2?null:new Map([[Ie.ISSUE_NUMBER,parseInt(e)]])},r}(),Lc=function(){function r(){}return r.decodeRow=function(e,t,n){var i=kt.findGuardPattern(t,n,!1,this.EXTENSION_START_PATTERN,new Int32Array(this.EXTENSION_START_PATTERN.length).fill(0));try{var o=new Pc;return o.decodeRow(e,t,i)}catch{var a=new Bc;return a.decodeRow(e,t,i)}},r.EXTENSION_START_PATTERN=Int32Array.from([1,1,2]),r}(),Rc=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)i.hasOwnProperty(o)&&(n[o]=i[o])},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)}}(),pe=function(r){Rc(e,r);function e(){var t=r.call(this)||this;t.decodeRowStringBuffer="",e.L_AND_G_PATTERNS=e.L_PATTERNS.map(function(s){return Int32Array.from(s)});for(var n=10;n<20;n++){for(var i=e.L_PATTERNS[n-10],o=new Int32Array(i.length),a=0;a<i.length;a++)o[a]=i[i.length-a-1];e.L_AND_G_PATTERNS[n]=o}return t}return e.prototype.decodeRow=function(t,n,i){var o=e.findStartGuardPattern(n),a=i==null?null:i.get(fe.NEED_RESULT_POINT_CALLBACK);if(a!=null){var s=new X((o[0]+o[1])/2,t);a.foundPossibleResultPoint(s)}var l=this.decodeMiddle(n,o,this.decodeRowStringBuffer),u=l.rowOffset,c=l.resultString;if(a!=null){var f=new X(u,t);a.foundPossibleResultPoint(f)}var h=e.decodeEnd(n,u);if(a!=null){var v=new X((h[0]+h[1])/2,t);a.foundPossibleResultPoint(v)}var p=h[1],g=p+(p-h[0]);if(g>=n.getSize()||!n.isRange(p,g,!1))throw new D;var m=c.toString();if(m.length<8)throw new k;if(!e.checkChecksum(m))throw new Ce;var y=(o[1]+o[0])/2,C=(h[1]+h[0])/2,w=this.getBarcodeFormat(),E=[new X(y,t),new X(C,t)],I=new Oe(m,null,0,E,w,new Date().getTime()),S=0;try{var b=Lc.decodeRow(t,n,h[1]);I.putMetadata(Ie.UPC_EAN_EXTENSION,b.getText()),I.putAllMetadata(b.getResultMetadata()),I.addResultPoints(b.getResultPoints()),S=b.getText().length}catch{}var P=i==null?null:i.get(fe.ALLOWED_EAN_EXTENSIONS);if(P!=null){var L=!1;for(var M in P)if(S.toString()===M){L=!0;break}if(!L)throw new D}return w===H.EAN_13||H.UPC_A,I},e.checkChecksum=function(t){return e.checkStandardUPCEANChecksum(t)},e.checkStandardUPCEANChecksum=function(t){var n=t.length;if(n===0)return!1;var i=parseInt(t.charAt(n-1),10);return e.getStandardUPCEANChecksum(t.substring(0,n-1))===i},e.getStandardUPCEANChecksum=function(t){for(var n=t.length,i=0,o=n-1;o>=0;o-=2){var a=t.charAt(o).charCodeAt(0)-48;if(a<0||a>9)throw new k;i+=a}i*=3;for(var o=n-2;o>=0;o-=2){var a=t.charAt(o).charCodeAt(0)-48;if(a<0||a>9)throw new k;i+=a}return(1e3-i)%10},e.decodeEnd=function(t,n){return e.findGuardPattern(t,n,!1,e.START_END_PATTERN,new Int32Array(e.START_END_PATTERN.length).fill(0))},e}(kt),Vc=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)i.hasOwnProperty(o)&&(n[o]=i[o])},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)}}(),xa=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.")},ci=function(r){Vc(e,r);function e(){var t=r.call(this)||this;return t.decodeMiddleCounters=Int32Array.from([0,0,0,0]),t}return e.prototype.decodeMiddle=function(t,n,i){var o,a,s,l,u=this.decodeMiddleCounters;u[0]=0,u[1]=0,u[2]=0,u[3]=0;for(var c=t.getSize(),f=n[1],h=0,v=0;v<6&&f<c;v++){var p=pe.decodeDigit(t,u,f,pe.L_AND_G_PATTERNS);i+=String.fromCharCode(48+p%10);try{for(var g=(o=void 0,xa(u)),m=g.next();!m.done;m=g.next()){var y=m.value;f+=y}}catch(I){o={error:I}}finally{try{m&&!m.done&&(a=g.return)&&a.call(g)}finally{if(o)throw o.error}}p>=10&&(h|=1<<5-v)}i=e.determineFirstDigit(i,h);var C=pe.findGuardPattern(t,f,!0,pe.MIDDLE_PATTERN,new Int32Array(pe.MIDDLE_PATTERN.length).fill(0));f=C[1];for(var v=0;v<6&&f<c;v++){var p=pe.decodeDigit(t,u,f,pe.L_PATTERNS);i+=String.fromCharCode(48+p);try{for(var w=(s=void 0,xa(u)),E=w.next();!E.done;E=w.next()){var y=E.value;f+=y}}catch(b){s={error:b}}finally{try{E&&!E.done&&(l=w.return)&&l.call(w)}finally{if(s)throw s.error}}}return{rowOffset:f,resultString:i}},e.prototype.getBarcodeFormat=function(){return H.EAN_13},e.determineFirstDigit=function(t,n){for(var i=0;i<10;i++)if(n===this.FIRST_DIGIT_ENCODINGS[i])return t=String.fromCharCode(48+i)+t,t;throw new D},e.FIRST_DIGIT_ENCODINGS=[0,11,13,14,19,25,28,21,22,26],e}(pe),kc=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)i.hasOwnProperty(o)&&(n[o]=i[o])},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)}}(),ya=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.")},Ca=function(r){kc(e,r);function e(){var t=r.call(this)||this;return t.decodeMiddleCounters=Int32Array.from([0,0,0,0]),t}return e.prototype.decodeMiddle=function(t,n,i){var o,a,s,l,u=this.decodeMiddleCounters;u[0]=0,u[1]=0,u[2]=0,u[3]=0;for(var c=t.getSize(),f=n[1],h=0;h<4&&f<c;h++){var v=pe.decodeDigit(t,u,f,pe.L_PATTERNS);i+=String.fromCharCode(48+v);try{for(var p=(o=void 0,ya(u)),g=p.next();!g.done;g=p.next()){var m=g.value;f+=m}}catch(E){o={error:E}}finally{try{g&&!g.done&&(a=p.return)&&a.call(p)}finally{if(o)throw o.error}}}var y=pe.findGuardPattern(t,f,!0,pe.MIDDLE_PATTERN,new Int32Array(pe.MIDDLE_PATTERN.length).fill(0));f=y[1];for(var h=0;h<4&&f<c;h++){var v=pe.decodeDigit(t,u,f,pe.L_PATTERNS);i+=String.fromCharCode(48+v);try{for(var C=(s=void 0,ya(u)),w=C.next();!w.done;w=C.next()){var m=w.value;f+=m}}catch(S){s={error:S}}finally{try{w&&!w.done&&(l=C.return)&&l.call(C)}finally{if(s)throw s.error}}}return{rowOffset:f,resultString:i}},e.prototype.getBarcodeFormat=function(){return H.EAN_8},e}(pe),zc=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)i.hasOwnProperty(o)&&(n[o]=i[o])},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)}}(),ma=function(r){zc(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.ean13Reader=new ci,t}return e.prototype.getBarcodeFormat=function(){return H.UPC_A},e.prototype.decode=function(t,n){return this.maybeReturnResult(this.ean13Reader.decode(t))},e.prototype.decodeRow=function(t,n,i){return this.maybeReturnResult(this.ean13Reader.decodeRow(t,n,i))},e.prototype.decodeMiddle=function(t,n,i){return this.ean13Reader.decodeMiddle(t,n,i)},e.prototype.maybeReturnResult=function(t){var n=t.getText();if(n.charAt(0)==="0"){var i=new Oe(n.substring(1),null,null,t.getResultPoints(),H.UPC_A);return t.getResultMetadata()!=null&&i.putAllMetadata(t.getResultMetadata()),i}else throw new D},e.prototype.reset=function(){this.ean13Reader.reset()},e}(pe),Uc=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)i.hasOwnProperty(o)&&(n[o]=i[o])},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)}}(),Hc=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.")},wa=function(r){Uc(e,r);function e(){var t=r.call(this)||this;return t.decodeMiddleCounters=new Int32Array(4),t}return e.prototype.decodeMiddle=function(t,n,i){var o,a,s=this.decodeMiddleCounters.map(function(m){return m});s[0]=0,s[1]=0,s[2]=0,s[3]=0;for(var l=t.getSize(),u=n[1],c=0,f=0;f<6&&u<l;f++){var h=e.decodeDigit(t,s,u,e.L_AND_G_PATTERNS);i+=String.fromCharCode(48+h%10);try{for(var v=(o=void 0,Hc(s)),p=v.next();!p.done;p=v.next()){var g=p.value;u+=g}}catch(m){o={error:m}}finally{try{p&&!p.done&&(a=v.return)&&a.call(v)}finally{if(o)throw o.error}}h>=10&&(c|=1<<5-f)}return e.determineNumSysAndCheckDigit(new q(i),c),u},e.prototype.decodeEnd=function(t,n){return e.findGuardPatternWithoutCounters(t,n,!0,e.MIDDLE_END_PATTERN)},e.prototype.checkChecksum=function(t){return pe.checkChecksum(e.convertUPCEtoUPCA(t))},e.determineNumSysAndCheckDigit=function(t,n){for(var i=0;i<=1;i++)for(var o=0;o<10;o++)if(n===this.NUMSYS_AND_CHECK_DIGIT_PATTERNS[i][o]){t.insert(0,"0"+i),t.append("0"+o);return}throw D.getNotFoundInstance()},e.prototype.getBarcodeFormat=function(){return H.UPC_E},e.convertUPCEtoUPCA=function(t){var n=t.slice(1,7).split("").map(function(a){return a.charCodeAt(0)}),i=new q;i.append(t.charAt(0));var o=n[5];switch(o){case 0:case 1:case 2:i.appendChars(n,0,2),i.append(o),i.append("0000"),i.appendChars(n,2,3);break;case 3:i.appendChars(n,0,3),i.append("00000"),i.appendChars(n,3,2);break;case 4:i.appendChars(n,0,4),i.append("00000"),i.append(n[4]);break;default:i.appendChars(n,0,5),i.append("0000"),i.append(o);break}return t.length>=8&&i.append(t.charAt(7)),i.toString()},e.MIDDLE_END_PATTERN=Int32Array.from([1,1,1,1,1,1]),e.NUMSYS_AND_CHECK_DIGIT_PATTERNS=[Int32Array.from([56,52,50,49,44,38,35,42,41,37]),Int32Array.from([7,11,13,14,19,25,28,21,22,1])],e}(pe),Gc=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)i.hasOwnProperty(o)&&(n[o]=i[o])},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)}}(),_a=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.")},fi=function(r){Gc(e,r);function e(t){var n=r.call(this)||this,i=t==null?null:t.get(fe.POSSIBLE_FORMATS),o=[];return i!=null&&(i.indexOf(H.EAN_13)>-1&&o.push(new ci),i.indexOf(H.UPC_A)>-1&&o.push(new ma),i.indexOf(H.EAN_8)>-1&&o.push(new Ca),i.indexOf(H.UPC_E)>-1&&o.push(new wa)),o.length===0&&(o.push(new ci),o.push(new ma),o.push(new Ca),o.push(new wa)),n.readers=o,n}return e.prototype.decodeRow=function(t,n,i){var o,a;try{for(var s=_a(this.readers),l=s.next();!l.done;l=s.next()){var u=l.value;try{var c=u.decodeRow(t,n,i),f=c.getBarcodeFormat()===H.EAN_13&&c.getText().charAt(0)==="0",h=i==null?null:i.get(fe.POSSIBLE_FORMATS),v=h==null||h.includes(H.UPC_A);if(f&&v){var p=c.getRawBytes(),g=new Oe(c.getText().substring(1),p,p?p.length:null,c.getResultPoints(),H.UPC_A);return g.putAllMetadata(c.getResultMetadata()),g}return c}catch{}}}catch(m){o={error:m}}finally{try{l&&!l.done&&(a=s.return)&&a.call(s)}finally{if(o)throw o.error}}throw new D},e.prototype.reset=function(){var t,n;try{for(var i=_a(this.readers),o=i.next();!o.done;o=i.next()){var a=o.value;a.reset()}}catch(s){t={error:s}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}},e}(ve),Wc=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)i.hasOwnProperty(o)&&(n[o]=i[o])},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)}}(),Xc=function(r){Wc(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.CODA_BAR_CHAR_SET={nnnnnww:"0",nnnnwwn:"1",nnnwnnw:"2",wwnnnnn:"3",nnwnnwn:"4",wnnnnwn:"5",nwnnnnw:"6",nwnnwnn:"7",nwwnnnn:"8",wnnwnnn:"9",nnnwwnn:"-",nnwwnnn:"$",wnnnwnw:":",wnwnnnw:"/",wnwnwnn:".",nnwwwww:"+",nnwwnwn:"A",nwnwnnw:"B",nnnwnww:"C",nnnwwwn:"D"},t}return e.prototype.decodeRow=function(t,n,i){var o=this.getValidRowData(n);if(!o)throw new D;var a=this.codaBarDecodeRow(o.row);if(!a)throw new D;return new Oe(a,null,0,[new X(o.left,t),new X(o.right,t)],H.CODABAR,new Date().getTime())},e.prototype.getValidRowData=function(t){var n=t.toArray(),i=n.indexOf(!0);if(i===-1)return null;var o=n.lastIndexOf(!0);if(o<=i)return null;n=n.slice(i,o+1);for(var a=[],s=n[0],l=1,u=1;u<n.length;u++)n[u]===s?l++:(s=n[u],a.push(l),l=1);return a.push(l),a.length<23&&(a.length+1)%8!==0?null:{row:a,left:i,right:o}},e.prototype.codaBarDecodeRow=function(t){for(var n=[],i=Math.ceil(t.reduce(function(l,u){return(l+u)/2},0));t.length>0;){var o=t.splice(0,8).splice(0,7),a=o.map(function(l){return l<i?"n":"w"}).join("");if(this.CODA_BAR_CHAR_SET[a]===void 0)return null;n.push(this.CODA_BAR_CHAR_SET[a])}var s=n.join("");return this.validCodaBarString(s)?s:null},e.prototype.validCodaBarString=function(t){var n=/^[A-D].{1,}[A-D]$/;return n.test(t)},e}(ve),$c=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)i.hasOwnProperty(o)&&(n[o]=i[o])},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)}}(),jc=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.")},At=function(r){$c(e,r);function e(){var t=r.call(this)||this;return t.decodeFinderCounters=new Int32Array(4),t.dataCharacterCounters=new Int32Array(8),t.oddRoundingErrors=new Array(4),t.evenRoundingErrors=new Array(4),t.oddCounts=new Array(t.dataCharacterCounters.length/2),t.evenCounts=new Array(t.dataCharacterCounters.length/2),t}return e.prototype.getDecodeFinderCounters=function(){return this.decodeFinderCounters},e.prototype.getDataCharacterCounters=function(){return this.dataCharacterCounters},e.prototype.getOddRoundingErrors=function(){return this.oddRoundingErrors},e.prototype.getEvenRoundingErrors=function(){return this.evenRoundingErrors},e.prototype.getOddCounts=function(){return this.oddCounts},e.prototype.getEvenCounts=function(){return this.evenCounts},e.prototype.parseFinderValue=function(t,n){for(var i=0;i<n.length;i++)if(ve.patternMatchVariance(t,n[i],e.MAX_INDIVIDUAL_VARIANCE)<e.MAX_AVG_VARIANCE)return i;throw new D},e.count=function(t){return Q.sum(new Int32Array(t))},e.increment=function(t,n){for(var i=0,o=n[0],a=1;a<t.length;a++)n[a]>o&&(o=n[a],i=a);t[i]++},e.decrement=function(t,n){for(var i=0,o=n[0],a=1;a<t.length;a++)n[a]<o&&(o=n[a],i=a);t[i]--},e.isFinderPattern=function(t){var n,i,o=t[0]+t[1],a=o+t[2]+t[3],s=o/a;if(s>=e.MIN_FINDER_PATTERN_RATIO&&s<=e.MAX_FINDER_PATTERN_RATIO){var l=Number.MAX_SAFE_INTEGER,u=Number.MIN_SAFE_INTEGER;try{for(var c=jc(t),f=c.next();!f.done;f=c.next()){var h=f.value;h>u&&(u=h),h<l&&(l=h)}}catch(v){n={error:v}}finally{try{f&&!f.done&&(i=c.return)&&i.call(c)}finally{if(n)throw n.error}}return u<10*l}return!1},e.MAX_AVG_VARIANCE=.2,e.MAX_INDIVIDUAL_VARIANCE=.45,e.MIN_FINDER_PATTERN_RATIO=9.5/12,e.MAX_FINDER_PATTERN_RATIO=12.5/14,e}(ve),Kr=function(){function r(e,t){this.value=e,this.checksumPortion=t}return r.prototype.getValue=function(){return this.value},r.prototype.getChecksumPortion=function(){return this.checksumPortion},r.prototype.toString=function(){return this.value+"("+this.checksumPortion+")"},r.prototype.equals=function(e){if(!(e instanceof r))return!1;var t=e;return this.value===t.value&&this.checksumPortion===t.checksumPortion},r.prototype.hashCode=function(){return this.value^this.checksumPortion},r}(),Aa=function(){function r(e,t,n,i,o){this.value=e,this.startEnd=t,this.value=e,this.startEnd=t,this.resultPoints=new Array,this.resultPoints.push(new X(n,o)),this.resultPoints.push(new X(i,o))}return r.prototype.getValue=function(){return this.value},r.prototype.getStartEnd=function(){return this.startEnd},r.prototype.getResultPoints=function(){return this.resultPoints},r.prototype.equals=function(e){if(!(e instanceof r))return!1;var t=e;return this.value===t.value},r.prototype.hashCode=function(){return this.value},r}(),qc=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(){}return r.getRSSvalue=function(e,t,n){var i,o,a=0;try{for(var s=qc(e),l=s.next();!l.done;l=s.next()){var u=l.value;a+=u}}catch(C){i={error:C}}finally{try{l&&!l.done&&(o=s.return)&&o.call(s)}finally{if(i)throw i.error}}for(var c=0,f=0,h=e.length,v=0;v<h-1;v++){var p=void 0;for(p=1,f|=1<<v;p<e[v];p++,f&=~(1<<v)){var g=r.combins(a-p-1,h-v-2);if(n&&f===0&&a-p-(h-v-1)>=h-v-1&&(g-=r.combins(a-p-(h-v),h-v-2)),h-v-1>1){for(var m=0,y=a-p-(h-v-2);y>t;y--)m+=r.combins(a-p-y-1,h-v-3);g-=m*(h-1-v)}else a-p>t&&g--;c+=g}a-=p}return c},r.combins=function(e,t){var n,i;e-t>t?(i=t,n=e-t):(i=e-t,n=t);for(var o=1,a=1,s=e;s>n;s--)o*=s,a<=i&&(o/=a,a++);for(;a<=i;)o/=a,a++;return o},r}(),Yc=function(){function r(){}return r.buildBitArray=function(e){var t=e.length*2-1;e[e.length-1].getRightChar()==null&&(t-=1);for(var n=12*t,i=new me(n),o=0,a=e[0],s=a.getRightChar().getValue(),l=11;l>=0;--l)(s&1<<l)!==0&&i.set(o),o++;for(var l=1;l<e.length;++l){for(var u=e[l],c=u.getLeftChar().getValue(),f=11;f>=0;--f)(c&1<<f)!==0&&i.set(o),o++;if(u.getRightChar()!==null)for(var h=u.getRightChar().getValue(),f=11;f>=0;--f)(h&1<<f)!==0&&i.set(o),o++}return i},r}(),Et=function(){function r(e,t){t?this.decodedInformation=null:(this.finished=e,this.decodedInformation=t)}return r.prototype.getDecodedInformation=function(){return this.decodedInformation},r.prototype.isFinished=function(){return this.finished},r}(),di=function(){function r(e){this.newPosition=e}return r.prototype.getNewPosition=function(){return this.newPosition},r}(),Zc=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)i.hasOwnProperty(o)&&(n[o]=i[o])},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)}}(),Qe=function(r){Zc(e,r);function e(t,n){var i=r.call(this,t)||this;return i.value=n,i}return e.prototype.getValue=function(){return this.value},e.prototype.isFNC1=function(){return this.value===e.FNC1},e.FNC1="$",e}(di),Kc=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)i.hasOwnProperty(o)&&(n[o]=i[o])},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)}}(),It=function(r){Kc(e,r);function e(t,n,i){var o=r.call(this,t)||this;return i?(o.remaining=!0,o.remainingValue=o.remainingValue):(o.remaining=!1,o.remainingValue=0),o.newString=n,o}return e.prototype.getNewString=function(){return this.newString},e.prototype.isRemaining=function(){return this.remaining},e.prototype.getRemainingValue=function(){return this.remainingValue},e}(di),Qc=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)i.hasOwnProperty(o)&&(n[o]=i[o])},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)}}(),Ut=function(r){Qc(e,r);function e(t,n,i){var o=r.call(this,t)||this;if(n<0||n>10||i<0||i>10)throw new k;return o.firstDigit=n,o.secondDigit=i,o}return e.prototype.getFirstDigit=function(){return this.firstDigit},e.prototype.getSecondDigit=function(){return this.secondDigit},e.prototype.getValue=function(){return this.firstDigit*10+this.secondDigit},e.prototype.isFirstDigitFNC1=function(){return this.firstDigit===e.FNC1},e.prototype.isSecondDigitFNC1=function(){return this.secondDigit===e.FNC1},e.prototype.isAnyFNC1=function(){return this.firstDigit===e.FNC1||this.secondDigit===e.FNC1},e.FNC1=10,e}(di),Qr=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.")},Jc=function(){function r(){}return r.parseFieldsInGeneralPurpose=function(e){var t,n,i,o,a,s,l,u;if(!e)return null;if(e.length<2)throw new D;var c=e.substring(0,2);try{for(var f=Qr(r.TWO_DIGIT_DATA_LENGTH),h=f.next();!h.done;h=f.next()){var v=h.value;if(v[0]===c)return v[1]===r.VARIABLE_LENGTH?r.processVariableAI(2,v[2],e):r.processFixedAI(2,v[1],e)}}catch(S){t={error:S}}finally{try{h&&!h.done&&(n=f.return)&&n.call(f)}finally{if(t)throw t.error}}if(e.length<3)throw new D;var p=e.substring(0,3);try{for(var g=Qr(r.THREE_DIGIT_DATA_LENGTH),m=g.next();!m.done;m=g.next()){var v=m.value;if(v[0]===p)return v[1]===r.VARIABLE_LENGTH?r.processVariableAI(3,v[2],e):r.processFixedAI(3,v[1],e)}}catch(S){i={error:S}}finally{try{m&&!m.done&&(o=g.return)&&o.call(g)}finally{if(i)throw i.error}}try{for(var y=Qr(r.THREE_DIGIT_PLUS_DIGIT_DATA_LENGTH),C=y.next();!C.done;C=y.next()){var v=C.value;if(v[0]===p)return v[1]===r.VARIABLE_LENGTH?r.processVariableAI(4,v[2],e):r.processFixedAI(4,v[1],e)}}catch(S){a={error:S}}finally{try{C&&!C.done&&(s=y.return)&&s.call(y)}finally{if(a)throw a.error}}if(e.length<4)throw new D;var w=e.substring(0,4);try{for(var E=Qr(r.FOUR_DIGIT_DATA_LENGTH),I=E.next();!I.done;I=E.next()){var v=I.value;if(v[0]===w)return v[1]===r.VARIABLE_LENGTH?r.processVariableAI(4,v[2],e):r.processFixedAI(4,v[1],e)}}catch(S){l={error:S}}finally{try{I&&!I.done&&(u=E.return)&&u.call(E)}finally{if(l)throw l.error}}throw new D},r.processFixedAI=function(e,t,n){if(n.length<e)throw new D;var i=n.substring(0,e);if(n.length<e+t)throw new D;var o=n.substring(e,e+t),a=n.substring(e+t),s="("+i+")"+o,l=r.parseFieldsInGeneralPurpose(a);return l==null?s:s+l},r.processVariableAI=function(e,t,n){var i=n.substring(0,e),o;n.length<e+t?o=n.length:o=e+t;var a=n.substring(e,o),s=n.substring(o),l="("+i+")"+a,u=r.parseFieldsInGeneralPurpose(s);return u==null?l:l+u},r.VARIABLE_LENGTH=[],r.TWO_DIGIT_DATA_LENGTH=[["00",18],["01",14],["02",14],["10",r.VARIABLE_LENGTH,20],["11",6],["12",6],["13",6],["15",6],["17",6],["20",2],["21",r.VARIABLE_LENGTH,20],["22",r.VARIABLE_LENGTH,29],["30",r.VARIABLE_LENGTH,8],["37",r.VARIABLE_LENGTH,8],["90",r.VARIABLE_LENGTH,30],["91",r.VARIABLE_LENGTH,30],["92",r.VARIABLE_LENGTH,30],["93",r.VARIABLE_LENGTH,30],["94",r.VARIABLE_LENGTH,30],["95",r.VARIABLE_LENGTH,30],["96",r.VARIABLE_LENGTH,30],["97",r.VARIABLE_LENGTH,3],["98",r.VARIABLE_LENGTH,30],["99",r.VARIABLE_LENGTH,30]],r.THREE_DIGIT_DATA_LENGTH=[["240",r.VARIABLE_LENGTH,30],["241",r.VARIABLE_LENGTH,30],["242",r.VARIABLE_LENGTH,6],["250",r.VARIABLE_LENGTH,30],["251",r.VARIABLE_LENGTH,30],["253",r.VARIABLE_LENGTH,17],["254",r.VARIABLE_LENGTH,20],["400",r.VARIABLE_LENGTH,30],["401",r.VARIABLE_LENGTH,30],["402",17],["403",r.VARIABLE_LENGTH,30],["410",13],["411",13],["412",13],["413",13],["414",13],["420",r.VARIABLE_LENGTH,20],["421",r.VARIABLE_LENGTH,15],["422",3],["423",r.VARIABLE_LENGTH,15],["424",3],["425",3],["426",3]],r.THREE_DIGIT_PLUS_DIGIT_DATA_LENGTH=[["310",6],["311",6],["312",6],["313",6],["314",6],["315",6],["316",6],["320",6],["321",6],["322",6],["323",6],["324",6],["325",6],["326",6],["327",6],["328",6],["329",6],["330",6],["331",6],["332",6],["333",6],["334",6],["335",6],["336",6],["340",6],["341",6],["342",6],["343",6],["344",6],["345",6],["346",6],["347",6],["348",6],["349",6],["350",6],["351",6],["352",6],["353",6],["354",6],["355",6],["356",6],["357",6],["360",6],["361",6],["362",6],["363",6],["364",6],["365",6],["366",6],["367",6],["368",6],["369",6],["390",r.VARIABLE_LENGTH,15],["391",r.VARIABLE_LENGTH,18],["392",r.VARIABLE_LENGTH,15],["393",r.VARIABLE_LENGTH,18],["703",r.VARIABLE_LENGTH,30]],r.FOUR_DIGIT_DATA_LENGTH=[["7001",13],["7002",r.VARIABLE_LENGTH,30],["7003",10],["8001",14],["8002",r.VARIABLE_LENGTH,20],["8003",r.VARIABLE_LENGTH,30],["8004",r.VARIABLE_LENGTH,30],["8005",6],["8006",18],["8007",r.VARIABLE_LENGTH,30],["8008",r.VARIABLE_LENGTH,12],["8018",18],["8020",r.VARIABLE_LENGTH,25],["8100",6],["8101",10],["8102",2],["8110",r.VARIABLE_LENGTH,70],["8200",r.VARIABLE_LENGTH,70]],r}(),Jr=function(){function r(e){this.buffer=new q,this.information=e}return r.prototype.decodeAllCodes=function(e,t){var n=t,i=null;do{var o=this.decodeGeneralPurposeField(n,i),a=Jc.parseFieldsInGeneralPurpose(o.getNewString());if(a!=null&&e.append(a),o.isRemaining()?i=""+o.getRemainingValue():i=null,n===o.getNewPosition())break;n=o.getNewPosition()}while(!0);return e.toString()},r.prototype.isStillNumeric=function(e){if(e+7>this.information.getSize())return e+4<=this.information.getSize();for(var t=e;t<e+3;++t)if(this.information.get(t))return!0;return this.information.get(e+3)},r.prototype.decodeNumeric=function(e){if(e+7>this.information.getSize()){var t=this.extractNumericValueFromBitArray(e,4);return t===0?new Ut(this.information.getSize(),Ut.FNC1,Ut.FNC1):new Ut(this.information.getSize(),t-1,Ut.FNC1)}var n=this.extractNumericValueFromBitArray(e,7),i=(n-8)/11,o=(n-8)%11;return new Ut(e+7,i,o)},r.prototype.extractNumericValueFromBitArray=function(e,t){return r.extractNumericValueFromBitArray(this.information,e,t)},r.extractNumericValueFromBitArray=function(e,t,n){for(var i=0,o=0;o<n;++o)e.get(t+o)&&(i|=1<<n-o-1);return i},r.prototype.decodeGeneralPurposeField=function(e,t){this.buffer.setLengthToZero(),t!=null&&this.buffer.append(t),this.current.setPosition(e);var n=this.parseBlocks();return n!=null&&n.isRemaining()?new It(this.current.getPosition(),this.buffer.toString(),n.getRemainingValue()):new It(this.current.getPosition(),this.buffer.toString())},r.prototype.parseBlocks=function(){var e,t;do{var n=this.current.getPosition();this.current.isAlpha()?(t=this.parseAlphaBlock(),e=t.isFinished()):this.current.isIsoIec646()?(t=this.parseIsoIec646Block(),e=t.isFinished()):(t=this.parseNumericBlock(),e=t.isFinished());var i=n!==this.current.getPosition();if(!i&&!e)break}while(!e);return t.getDecodedInformation()},r.prototype.parseNumericBlock=function(){for(;this.isStillNumeric(this.current.getPosition());){var e=this.decodeNumeric(this.current.getPosition());if(this.current.setPosition(e.getNewPosition()),e.isFirstDigitFNC1()){var t=void 0;return e.isSecondDigitFNC1()?t=new It(this.current.getPosition(),this.buffer.toString()):t=new It(this.current.getPosition(),this.buffer.toString(),e.getSecondDigit()),new Et(!0,t)}if(this.buffer.append(e.getFirstDigit()),e.isSecondDigitFNC1()){var t=new It(this.current.getPosition(),this.buffer.toString());return new Et(!0,t)}this.buffer.append(e.getSecondDigit())}return this.isNumericToAlphaNumericLatch(this.current.getPosition())&&(this.current.setAlpha(),this.current.incrementPosition(4)),new Et(!1)},r.prototype.parseIsoIec646Block=function(){for(;this.isStillIsoIec646(this.current.getPosition());){var e=this.decodeIsoIec646(this.current.getPosition());if(this.current.setPosition(e.getNewPosition()),e.isFNC1()){var t=new It(this.current.getPosition(),this.buffer.toString());return new Et(!0,t)}this.buffer.append(e.getValue())}return this.isAlphaOr646ToNumericLatch(this.current.getPosition())?(this.current.incrementPosition(3),this.current.setNumeric()):this.isAlphaTo646ToAlphaLatch(this.current.getPosition())&&(this.current.getPosition()+5<this.information.getSize()?this.current.incrementPosition(5):this.current.setPosition(this.information.getSize()),this.current.setAlpha()),new Et(!1)},r.prototype.parseAlphaBlock=function(){for(;this.isStillAlpha(this.current.getPosition());){var e=this.decodeAlphanumeric(this.current.getPosition());if(this.current.setPosition(e.getNewPosition()),e.isFNC1()){var t=new It(this.current.getPosition(),this.buffer.toString());return new Et(!0,t)}this.buffer.append(e.getValue())}return this.isAlphaOr646ToNumericLatch(this.current.getPosition())?(this.current.incrementPosition(3),this.current.setNumeric()):this.isAlphaTo646ToAlphaLatch(this.current.getPosition())&&(this.current.getPosition()+5<this.information.getSize()?this.current.incrementPosition(5):this.current.setPosition(this.information.getSize()),this.current.setIsoIec646()),new Et(!1)},r.prototype.isStillIsoIec646=function(e){if(e+5>this.information.getSize())return!1;var t=this.extractNumericValueFromBitArray(e,5);if(t>=5&&t<16)return!0;if(e+7>this.information.getSize())return!1;var n=this.extractNumericValueFromBitArray(e,7);if(n>=64&&n<116)return!0;if(e+8>this.information.getSize())return!1;var i=this.extractNumericValueFromBitArray(e,8);return i>=232&&i<253},r.prototype.decodeIsoIec646=function(e){var t=this.extractNumericValueFromBitArray(e,5);if(t===15)return new Qe(e+5,Qe.FNC1);if(t>=5&&t<15)return new Qe(e+5,"0"+(t-5));var n=this.extractNumericValueFromBitArray(e,7);if(n>=64&&n<90)return new Qe(e+7,""+(n+1));if(n>=90&&n<116)return new Qe(e+7,""+(n+7));var i=this.extractNumericValueFromBitArray(e,8),o;switch(i){case 232:o="!";break;case 233:o='"';break;case 234:o="%";break;case 235:o="&";break;case 236:o="'";break;case 237:o="(";break;case 238:o=")";break;case 239:o="*";break;case 240:o="+";break;case 241:o=",";break;case 242:o="-";break;case 243:o=".";break;case 244:o="/";break;case 245:o=":";break;case 246:o=";";break;case 247:o="<";break;case 248:o="=";break;case 249:o=">";break;case 250:o="?";break;case 251:o="_";break;case 252:o=" ";break;default:throw new k}return new Qe(e+8,o)},r.prototype.isStillAlpha=function(e){if(e+5>this.information.getSize())return!1;var t=this.extractNumericValueFromBitArray(e,5);if(t>=5&&t<16)return!0;if(e+6>this.information.getSize())return!1;var n=this.extractNumericValueFromBitArray(e,6);return n>=16&&n<63},r.prototype.decodeAlphanumeric=function(e){var t=this.extractNumericValueFromBitArray(e,5);if(t===15)return new Qe(e+5,Qe.FNC1);if(t>=5&&t<15)return new Qe(e+5,"0"+(t-5));var n=this.extractNumericValueFromBitArray(e,6);if(n>=32&&n<58)return new Qe(e+6,""+(n+33));var i;switch(n){case 58:i="*";break;case 59:i=",";break;case 60:i="-";break;case 61:i=".";break;case 62:i="/";break;default:throw new lr("Decoding invalid alphanumeric value: "+n)}return new Qe(e+6,i)},r.prototype.isAlphaTo646ToAlphaLatch=function(e){if(e+1>this.information.getSize())return!1;for(var t=0;t<5&&t+e<this.information.getSize();++t)if(t===2){if(!this.information.get(e+2))return!1}else if(this.information.get(e+t))return!1;return!0},r.prototype.isAlphaOr646ToNumericLatch=function(e){if(e+3>this.information.getSize())return!1;for(var t=e;t<e+3;++t)if(this.information.get(t))return!1;return!0},r.prototype.isNumericToAlphaNumericLatch=function(e){if(e+1>this.information.getSize())return!1;for(var t=0;t<4&&t+e<this.information.getSize();++t)if(this.information.get(e+t))return!1;return!0},r}(),Ea=function(){function r(e){this.information=e,this.generalDecoder=new Jr(e)}return r.prototype.getInformation=function(){return this.information},r.prototype.getGeneralDecoder=function(){return this.generalDecoder},r}(),ef=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)i.hasOwnProperty(o)&&(n[o]=i[o])},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)}}(),Je=function(r){ef(e,r);function e(t){return r.call(this,t)||this}return e.prototype.encodeCompressedGtin=function(t,n){t.append("(01)");var i=t.length();t.append("9"),this.encodeCompressedGtinWithoutAI(t,n,i)},e.prototype.encodeCompressedGtinWithoutAI=function(t,n,i){for(var o=0;o<4;++o){var a=this.getGeneralDecoder().extractNumericValueFromBitArray(n+10*o,10);a/100===0&&t.append("0"),a/10===0&&t.append("0"),t.append(a)}e.appendCheckDigit(t,i)},e.appendCheckDigit=function(t,n){for(var i=0,o=0;o<13;o++){var a=t.charAt(o+n).charCodeAt(0)-48;i+=(o&1)===0?3*a:a}i=10-i%10,i===10&&(i=0),t.append(i)},e.GTIN_SIZE=40,e}(Ea),tf=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)i.hasOwnProperty(o)&&(n[o]=i[o])},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)}}(),rf=function(r){tf(e,r);function e(t){return r.call(this,t)||this}return e.prototype.parseInformation=function(){var t=new q;t.append("(01)");var n=t.length(),i=this.getGeneralDecoder().extractNumericValueFromBitArray(e.HEADER_SIZE,4);return t.append(i),this.encodeCompressedGtinWithoutAI(t,e.HEADER_SIZE+4,n),this.getGeneralDecoder().decodeAllCodes(t,e.HEADER_SIZE+44)},e.HEADER_SIZE=4,e}(Je),nf=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)i.hasOwnProperty(o)&&(n[o]=i[o])},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)}}(),of=function(r){nf(e,r);function e(t){return r.call(this,t)||this}return e.prototype.parseInformation=function(){var t=new q;return this.getGeneralDecoder().decodeAllCodes(t,e.HEADER_SIZE)},e.HEADER_SIZE=5,e}(Ea),af=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)i.hasOwnProperty(o)&&(n[o]=i[o])},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)}}(),en=function(r){af(e,r);function e(t){return r.call(this,t)||this}return e.prototype.encodeCompressedWeight=function(t,n,i){var o=this.getGeneralDecoder().extractNumericValueFromBitArray(n,i);this.addWeightCode(t,o);for(var a=this.checkWeight(o),s=1e5,l=0;l<5;++l)a/s===0&&t.append("0"),s/=10;t.append(a)},e}(Je),sf=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)i.hasOwnProperty(o)&&(n[o]=i[o])},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)}}(),Ia=function(r){sf(e,r);function e(t){return r.call(this,t)||this}return e.prototype.parseInformation=function(){if(this.getInformation().getSize()!==e.HEADER_SIZE+en.GTIN_SIZE+e.WEIGHT_SIZE)throw new D;var t=new q;return this.encodeCompressedGtin(t,e.HEADER_SIZE),this.encodeCompressedWeight(t,e.HEADER_SIZE+en.GTIN_SIZE,e.WEIGHT_SIZE),t.toString()},e.HEADER_SIZE=5,e.WEIGHT_SIZE=15,e}(en),lf=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)i.hasOwnProperty(o)&&(n[o]=i[o])},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)}}(),uf=function(r){lf(e,r);function e(t){return r.call(this,t)||this}return e.prototype.addWeightCode=function(t,n){t.append("(3103)")},e.prototype.checkWeight=function(t){return t},e}(Ia),cf=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)i.hasOwnProperty(o)&&(n[o]=i[o])},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)}}(),ff=function(r){cf(e,r);function e(t){return r.call(this,t)||this}return e.prototype.addWeightCode=function(t,n){n<1e4?t.append("(3202)"):t.append("(3203)")},e.prototype.checkWeight=function(t){return t<1e4?t:t-1e4},e}(Ia),df=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)i.hasOwnProperty(o)&&(n[o]=i[o])},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)}}(),hf=function(r){df(e,r);function e(t){return r.call(this,t)||this}return e.prototype.parseInformation=function(){if(this.getInformation().getSize()<e.HEADER_SIZE+Je.GTIN_SIZE)throw new D;var t=new q;this.encodeCompressedGtin(t,e.HEADER_SIZE);var n=this.getGeneralDecoder().extractNumericValueFromBitArray(e.HEADER_SIZE+Je.GTIN_SIZE,e.LAST_DIGIT_SIZE);t.append("(392"),t.append(n),t.append(")");var i=this.getGeneralDecoder().decodeGeneralPurposeField(e.HEADER_SIZE+Je.GTIN_SIZE+e.LAST_DIGIT_SIZE,null);return t.append(i.getNewString()),t.toString()},e.HEADER_SIZE=8,e.LAST_DIGIT_SIZE=2,e}(Je),vf=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)i.hasOwnProperty(o)&&(n[o]=i[o])},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)}}(),pf=function(r){vf(e,r);function e(t){return r.call(this,t)||this}return e.prototype.parseInformation=function(){if(this.getInformation().getSize()<e.HEADER_SIZE+Je.GTIN_SIZE)throw new D;var t=new q;this.encodeCompressedGtin(t,e.HEADER_SIZE);var n=this.getGeneralDecoder().extractNumericValueFromBitArray(e.HEADER_SIZE+Je.GTIN_SIZE,e.LAST_DIGIT_SIZE);t.append("(393"),t.append(n),t.append(")");var i=this.getGeneralDecoder().extractNumericValueFromBitArray(e.HEADER_SIZE+Je.GTIN_SIZE+e.LAST_DIGIT_SIZE,e.FIRST_THREE_DIGITS_SIZE);i/100===0&&t.append("0"),i/10===0&&t.append("0"),t.append(i);var o=this.getGeneralDecoder().decodeGeneralPurposeField(e.HEADER_SIZE+Je.GTIN_SIZE+e.LAST_DIGIT_SIZE+e.FIRST_THREE_DIGITS_SIZE,null);return t.append(o.getNewString()),t.toString()},e.HEADER_SIZE=8,e.LAST_DIGIT_SIZE=2,e.FIRST_THREE_DIGITS_SIZE=10,e}(Je),gf=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)i.hasOwnProperty(o)&&(n[o]=i[o])},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)}}(),vt=function(r){gf(e,r);function e(t,n,i){var o=r.call(this,t)||this;return o.dateCode=i,o.firstAIdigits=n,o}return e.prototype.parseInformation=function(){if(this.getInformation().getSize()!==e.HEADER_SIZE+e.GTIN_SIZE+e.WEIGHT_SIZE+e.DATE_SIZE)throw new D;var t=new q;return this.encodeCompressedGtin(t,e.HEADER_SIZE),this.encodeCompressedWeight(t,e.HEADER_SIZE+e.GTIN_SIZE,e.WEIGHT_SIZE),this.encodeCompressedDate(t,e.HEADER_SIZE+e.GTIN_SIZE+e.WEIGHT_SIZE),t.toString()},e.prototype.encodeCompressedDate=function(t,n){var i=this.getGeneralDecoder().extractNumericValueFromBitArray(n,e.DATE_SIZE);if(i!==38400){t.append("("),t.append(this.dateCode),t.append(")");var o=i%32;i/=32;var a=i%12+1;i/=12;var s=i;s/10===0&&t.append("0"),t.append(s),a/10===0&&t.append("0"),t.append(a),o/10===0&&t.append("0"),t.append(o)}},e.prototype.addWeightCode=function(t,n){t.append("("),t.append(this.firstAIdigits),t.append(n/1e5),t.append(")")},e.prototype.checkWeight=function(t){return t%1e5},e.HEADER_SIZE=8,e.WEIGHT_SIZE=20,e.DATE_SIZE=16,e}(en);function xf(r){try{if(r.get(1))return new rf(r);if(!r.get(2))return new of(r);var e=Jr.extractNumericValueFromBitArray(r,1,4);switch(e){case 4:return new uf(r);case 5:return new ff(r)}var t=Jr.extractNumericValueFromBitArray(r,1,5);switch(t){case 12:return new hf(r);case 13:return new pf(r)}var n=Jr.extractNumericValueFromBitArray(r,1,7);switch(n){case 56:return new vt(r,"310","11");case 57:return new vt(r,"320","11");case 58:return new vt(r,"310","13");case 59:return new vt(r,"320","13");case 60:return new vt(r,"310","15");case 61:return new vt(r,"320","15");case 62:return new vt(r,"310","17");case 63:return new vt(r,"320","17")}}catch(i){throw console.log(i),new lr("unknown decoder: "+r)}}var Sa=function(){function r(e,t,n,i){this.leftchar=e,this.rightchar=t,this.finderpattern=n,this.maybeLast=i}return r.prototype.mayBeLast=function(){return this.maybeLast},r.prototype.getLeftChar=function(){return this.leftchar},r.prototype.getRightChar=function(){return this.rightchar},r.prototype.getFinderPattern=function(){return this.finderpattern},r.prototype.mustBeLast=function(){return this.rightchar==null},r.prototype.toString=function(){return"[ "+this.leftchar+", "+this.rightchar+" : "+(this.finderpattern==null?"null":this.finderpattern.getValue())+" ]"},r.equals=function(e,t){return e instanceof r?r.equalsOrNull(e.leftchar,t.leftchar)&&r.equalsOrNull(e.rightchar,t.rightchar)&&r.equalsOrNull(e.finderpattern,t.finderpattern):!1},r.equalsOrNull=function(e,t){return e===null?t===null:r.equals(e,t)},r.prototype.hashCode=function(){var e=this.leftchar.getValue()^this.rightchar.getValue()^this.finderpattern.getValue();return e},r}(),yf=function(){function r(e,t,n){this.pairs=e,this.rowNumber=t,this.wasReversed=n}return r.prototype.getPairs=function(){return this.pairs},r.prototype.getRowNumber=function(){return this.rowNumber},r.prototype.isReversed=function(){return this.wasReversed},r.prototype.isEquivalent=function(e){return this.checkEqualitity(this,e)},r.prototype.toString=function(){return"{ "+this.pairs+" }"},r.prototype.equals=function(e,t){return e instanceof r?this.checkEqualitity(e,t)&&e.wasReversed===t.wasReversed:!1},r.prototype.checkEqualitity=function(e,t){if(!(!e||!t)){var n;return e.forEach(function(i,o){t.forEach(function(a){i.getLeftChar().getValue()===a.getLeftChar().getValue()&&i.getRightChar().getValue()===a.getRightChar().getValue()&&i.getFinderPatter().getValue()===a.getFinderPatter().getValue()&&(n=!0)})}),n}},r}(),Cf=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)i.hasOwnProperty(o)&&(n[o]=i[o])},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)}}(),pt=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.")},mf=function(r){Cf(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.pairs=new Array(e.MAX_PAIRS),t.rows=new Array,t.startEnd=[2],t}return e.prototype.decodeRow=function(t,n,i){this.pairs.length=0,this.startFromEven=!1;try{return e.constructResult(this.decodeRow2pairs(t,n))}catch{}return this.pairs.length=0,this.startFromEven=!0,e.constructResult(this.decodeRow2pairs(t,n))},e.prototype.reset=function(){this.pairs.length=0,this.rows.length=0},e.prototype.decodeRow2pairs=function(t,n){for(var i=!1;!i;)try{this.pairs.push(this.retrieveNextPair(n,this.pairs,t))}catch(s){if(s instanceof D){if(!this.pairs.length)throw new D;i=!0}}if(this.checkChecksum())return this.pairs;var o;if(this.rows.length?o=!0:o=!1,this.storeRow(t,!1),o){var a=this.checkRowsBoolean(!1);if(a!=null||(a=this.checkRowsBoolean(!0),a!=null))return a}throw new D},e.prototype.checkRowsBoolean=function(t){if(this.rows.length>25)return this.rows.length=0,null;this.pairs.length=0,t&&(this.rows=this.rows.reverse());var n=null;try{n=this.checkRows(new Array,0)}catch(i){console.log(i)}return t&&(this.rows=this.rows.reverse()),n},e.prototype.checkRows=function(t,n){for(var i,o,a=n;a<this.rows.length;a++){var s=this.rows[a];this.pairs.length=0;try{for(var l=(i=void 0,pt(t)),u=l.next();!u.done;u=l.next()){var c=u.value;this.pairs.push(c.getPairs())}}catch(h){i={error:h}}finally{try{u&&!u.done&&(o=l.return)&&o.call(l)}finally{if(i)throw i.error}}if(this.pairs.push(s.getPairs()),!!e.isValidSequence(this.pairs)){if(this.checkChecksum())return this.pairs;var f=new Array(t);f.push(s);try{return this.checkRows(f,a+1)}catch(h){console.log(h)}}}throw new D},e.isValidSequence=function(t){var n,i;try{for(var o=pt(e.FINDER_PATTERN_SEQUENCES),a=o.next();!a.done;a=o.next()){var s=a.value;if(!(t.length>s.length)){for(var l=!0,u=0;u<t.length;u++)if(t[u].getFinderPattern().getValue()!==s[u]){l=!1;break}if(l)return!0}}}catch(c){n={error:c}}finally{try{a&&!a.done&&(i=o.return)&&i.call(o)}finally{if(n)throw n.error}}return!1},e.prototype.storeRow=function(t,n){for(var i=0,o=!1,a=!1;i<this.rows.length;){var s=this.rows[i];if(s.getRowNumber()>t){a=s.isEquivalent(this.pairs);break}o=s.isEquivalent(this.pairs),i++}a||o||e.isPartialRow(this.pairs,this.rows)||(this.rows.push(i,new yf(this.pairs,t,n)),this.removePartialRows(this.pairs,this.rows))},e.prototype.removePartialRows=function(t,n){var i,o,a,s,l,u;try{for(var c=pt(n),f=c.next();!f.done;f=c.next()){var h=f.value;if(h.getPairs().length!==t.length){var v=!0;try{for(var p=(a=void 0,pt(h.getPairs())),g=p.next();!g.done;g=p.next()){var m=g.value,y=!1;try{for(var C=(l=void 0,pt(t)),w=C.next();!w.done;w=C.next()){var E=w.value;if(Sa.equals(m,E)){y=!0;break}}}catch(I){l={error:I}}finally{try{w&&!w.done&&(u=C.return)&&u.call(C)}finally{if(l)throw l.error}}y||(v=!1)}}catch(I){a={error:I}}finally{try{g&&!g.done&&(s=p.return)&&s.call(p)}finally{if(a)throw a.error}}}}}catch(I){i={error:I}}finally{try{f&&!f.done&&(o=c.return)&&o.call(c)}finally{if(i)throw i.error}}},e.isPartialRow=function(t,n){var i,o,a,s,l,u;try{for(var c=pt(n),f=c.next();!f.done;f=c.next()){var h=f.value,v=!0;try{for(var p=(a=void 0,pt(t)),g=p.next();!g.done;g=p.next()){var m=g.value,y=!1;try{for(var C=(l=void 0,pt(h.getPairs())),w=C.next();!w.done;w=C.next()){var E=w.value;if(m.equals(E)){y=!0;break}}}catch(I){l={error:I}}finally{try{w&&!w.done&&(u=C.return)&&u.call(C)}finally{if(l)throw l.error}}if(!y){v=!1;break}}}catch(I){a={error:I}}finally{try{g&&!g.done&&(s=p.return)&&s.call(p)}finally{if(a)throw a.error}}if(v)return!0}}catch(I){i={error:I}}finally{try{f&&!f.done&&(o=c.return)&&o.call(c)}finally{if(i)throw i.error}}return!1},e.prototype.getRows=function(){return this.rows},e.constructResult=function(t){var n=Yc.buildBitArray(t),i=xf(n),o=i.parseInformation(),a=t[0].getFinderPattern().getResultPoints(),s=t[t.length-1].getFinderPattern().getResultPoints(),l=[a[0],a[1],s[0],s[1]];return new Oe(o,null,null,l,H.RSS_EXPANDED,null)},e.prototype.checkChecksum=function(){var t=this.pairs.get(0),n=t.getLeftChar(),i=t.getRightChar();if(i===null)return!1;for(var o=i.getChecksumPortion(),a=2,s=1;s<this.pairs.size();++s){var l=this.pairs.get(s);o+=l.getLeftChar().getChecksumPortion(),a++;var u=l.getRightChar();u!=null&&(o+=u.getChecksumPortion(),a++)}o%=211;var c=211*(a-4)+o;return c===n.getValue()},e.getNextSecondBar=function(t,n){var i;return t.get(n)?(i=t.getNextUnset(n),i=t.getNextSet(i)):(i=t.getNextSet(n),i=t.getNextUnset(i)),i},e.prototype.retrieveNextPair=function(t,n,i){var o=n.length%2===0;this.startFromEven&&(o=!o);var a,s=!0,l=-1;do this.findNextPair(t,n,l),a=this.parseFoundFinderPattern(t,i,o),a===null?l=e.getNextSecondBar(t,this.startEnd[0]):s=!1;while(s);var u=this.decodeDataCharacter(t,a,o,!0);if(!this.isEmptyPair(n)&&n[n.length-1].mustBeLast())throw new D;var c;try{c=this.decodeDataCharacter(t,a,o,!1)}catch(f){c=null,console.log(f)}return new Sa(u,c,a,!0)},e.prototype.isEmptyPair=function(t){return t.length===0},e.prototype.findNextPair=function(t,n,i){var o=this.getDecodeFinderCounters();o[0]=0,o[1]=0,o[2]=0,o[3]=0;var a=t.getSize(),s;if(i>=0)s=i;else if(this.isEmptyPair(n))s=0;else{var l=n[n.length-1];s=l.getFinderPattern().getStartEnd()[1]}var u=n.length%2!==0;this.startFromEven&&(u=!u);for(var c=!1;s<a&&(c=!t.get(s),!!c);)s++;for(var f=0,h=s,v=s;v<a;v++)if(t.get(v)!==c)o[f]++;else{if(f===3){if(u&&e.reverseCounters(o),e.isFinderPattern(o)){this.startEnd[0]=h,this.startEnd[1]=v;return}u&&e.reverseCounters(o),h+=o[0]+o[1],o[0]=o[2],o[1]=o[3],o[2]=0,o[3]=0,f--}else f++;o[f]=1,c=!c}throw new D},e.reverseCounters=function(t){for(var n=t.length,i=0;i<n/2;++i){var o=t[i];t[i]=t[n-i-1],t[n-i-1]=o}},e.prototype.parseFoundFinderPattern=function(t,n,i){var o,a,s;if(i){for(var l=this.startEnd[0]-1;l>=0&&!t.get(l);)l--;l++,o=this.startEnd[0]-l,a=l,s=this.startEnd[1]}else a=this.startEnd[0],s=t.getNextUnset(this.startEnd[1]+1),o=s-this.startEnd[1];var u=this.getDecodeFinderCounters();se.arraycopy(u,0,u,1,u.length-1),u[0]=o;var c;try{c=this.parseFinderValue(u,e.FINDER_PATTERNS)}catch{return null}return new Aa(c,[a,s],a,s,n)},e.prototype.decodeDataCharacter=function(t,n,i,o){for(var a=this.getDataCharacterCounters(),s=0;s<a.length;s++)a[s]=0;if(o)e.recordPatternInReverse(t,n.getStartEnd()[0],a);else{e.recordPattern(t,n.getStartEnd()[1],a);for(var l=0,u=a.length-1;l<u;l++,u--){var c=a[l];a[l]=a[u],a[u]=c}}var f=17,h=Q.sum(new Int32Array(a))/f,v=(n.getStartEnd()[1]-n.getStartEnd()[0])/15;if(Math.abs(h-v)/v>.3)throw new D;for(var p=this.getOddCounts(),g=this.getEvenCounts(),m=this.getOddRoundingErrors(),y=this.getEvenRoundingErrors(),l=0;l<a.length;l++){var C=1*a[l]/h,w=C+.5;if(w<1){if(C<.3)throw new D;w=1}else if(w>8){if(C>8.7)throw new D;w=8}var E=l/2;(l&1)===0?(p[E]=w,m[E]=C-w):(g[E]=w,y[E]=C-w)}this.adjustOddEvenCounts(f);for(var I=4*n.getValue()+(i?0:2)+(o?0:1)-1,S=0,b=0,l=p.length-1;l>=0;l--){if(e.isNotA1left(n,i,o)){var P=e.WEIGHTS[I][2*l];b+=p[l]*P}S+=p[l]}for(var L=0,l=g.length-1;l>=0;l--)if(e.isNotA1left(n,i,o)){var P=e.WEIGHTS[I][2*l+1];L+=g[l]*P}var M=b+L;if((S&1)!==0||S>13||S<4)throw new D;var F=(13-S)/2,V=e.SYMBOL_WIDEST[F],z=9-V,U=zt.getRSSvalue(p,V,!0),R=zt.getRSSvalue(g,z,!1),G=e.EVEN_TOTAL_SUBSET[F],W=e.GSUM[F],oe=U*G+R+W;return new Kr(oe,M)},e.isNotA1left=function(t,n,i){return!(t.getValue()===0&&n&&i)},e.prototype.adjustOddEvenCounts=function(t){var n=Q.sum(new Int32Array(this.getOddCounts())),i=Q.sum(new Int32Array(this.getEvenCounts())),o=!1,a=!1;n>13?a=!0:n<4&&(o=!0);var s=!1,l=!1;i>13?l=!0:i<4&&(s=!0);var u=n+i-t,c=(n&1)===1,f=(i&1)===0;if(u===1)if(c){if(f)throw new D;a=!0}else{if(!f)throw new D;l=!0}else if(u===-1)if(c){if(f)throw new D;o=!0}else{if(!f)throw new D;s=!0}else if(u===0){if(c){if(!f)throw new D;n<i?(o=!0,l=!0):(a=!0,s=!0)}else if(f)throw new D}else throw new D;if(o){if(a)throw new D;e.increment(this.getOddCounts(),this.getOddRoundingErrors())}if(a&&e.decrement(this.getOddCounts(),this.getOddRoundingErrors()),s){if(l)throw new D;e.increment(this.getEvenCounts(),this.getOddRoundingErrors())}l&&e.decrement(this.getEvenCounts(),this.getEvenRoundingErrors())},e.SYMBOL_WIDEST=[7,5,4,3,1],e.EVEN_TOTAL_SUBSET=[4,20,52,104,204],e.GSUM=[0,348,1388,2948,3988],e.FINDER_PATTERNS=[Int32Array.from([1,8,4,1]),Int32Array.from([3,6,4,1]),Int32Array.from([3,4,6,1]),Int32Array.from([3,2,8,1]),Int32Array.from([2,6,5,1]),Int32Array.from([2,2,9,1])],e.WEIGHTS=[[1,3,9,27,81,32,96,77],[20,60,180,118,143,7,21,63],[189,145,13,39,117,140,209,205],[193,157,49,147,19,57,171,91],[62,186,136,197,169,85,44,132],[185,133,188,142,4,12,36,108],[113,128,173,97,80,29,87,50],[150,28,84,41,123,158,52,156],[46,138,203,187,139,206,196,166],[76,17,51,153,37,111,122,155],[43,129,176,106,107,110,119,146],[16,48,144,10,30,90,59,177],[109,116,137,200,178,112,125,164],[70,210,208,202,184,130,179,115],[134,191,151,31,93,68,204,190],[148,22,66,198,172,94,71,2],[6,18,54,162,64,192,154,40],[120,149,25,75,14,42,126,167],[79,26,78,23,69,207,199,175],[103,98,83,38,114,131,182,124],[161,61,183,127,170,88,53,159],[55,165,73,8,24,72,5,15],[45,135,194,160,58,174,100,89]],e.FINDER_PAT_A=0,e.FINDER_PAT_B=1,e.FINDER_PAT_C=2,e.FINDER_PAT_D=3,e.FINDER_PAT_E=4,e.FINDER_PAT_F=5,e.FINDER_PATTERN_SEQUENCES=[[e.FINDER_PAT_A,e.FINDER_PAT_A],[e.FINDER_PAT_A,e.FINDER_PAT_B,e.FINDER_PAT_B],[e.FINDER_PAT_A,e.FINDER_PAT_C,e.FINDER_PAT_B,e.FINDER_PAT_D],[e.FINDER_PAT_A,e.FINDER_PAT_E,e.FINDER_PAT_B,e.FINDER_PAT_D,e.FINDER_PAT_C],[e.FINDER_PAT_A,e.FINDER_PAT_E,e.FINDER_PAT_B,e.FINDER_PAT_D,e.FINDER_PAT_D,e.FINDER_PAT_F],[e.FINDER_PAT_A,e.FINDER_PAT_E,e.FINDER_PAT_B,e.FINDER_PAT_D,e.FINDER_PAT_E,e.FINDER_PAT_F,e.FINDER_PAT_F],[e.FINDER_PAT_A,e.FINDER_PAT_A,e.FINDER_PAT_B,e.FINDER_PAT_B,e.FINDER_PAT_C,e.FINDER_PAT_C,e.FINDER_PAT_D,e.FINDER_PAT_D],[e.FINDER_PAT_A,e.FINDER_PAT_A,e.FINDER_PAT_B,e.FINDER_PAT_B,e.FINDER_PAT_C,e.FINDER_PAT_C,e.FINDER_PAT_D,e.FINDER_PAT_E,e.FINDER_PAT_E],[e.FINDER_PAT_A,e.FINDER_PAT_A,e.FINDER_PAT_B,e.FINDER_PAT_B,e.FINDER_PAT_C,e.FINDER_PAT_C,e.FINDER_PAT_D,e.FINDER_PAT_E,e.FINDER_PAT_F,e.FINDER_PAT_F],[e.FINDER_PAT_A,e.FINDER_PAT_A,e.FINDER_PAT_B,e.FINDER_PAT_B,e.FINDER_PAT_C,e.FINDER_PAT_D,e.FINDER_PAT_D,e.FINDER_PAT_E,e.FINDER_PAT_E,e.FINDER_PAT_F,e.FINDER_PAT_F]],e.MAX_PAIRS=11,e}(At),wf=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)i.hasOwnProperty(o)&&(n[o]=i[o])},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){wf(e,r);function e(t,n,i){var o=r.call(this,t,n)||this;return o.count=0,o.finderPattern=i,o}return e.prototype.getFinderPattern=function(){return this.finderPattern},e.prototype.getCount=function(){return this.count},e.prototype.incrementCount=function(){this.count++},e}(Kr),Af=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)i.hasOwnProperty(o)&&(n[o]=i[o])},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)}}(),hi=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.")},ba=function(r){Af(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.possibleLeftPairs=[],t.possibleRightPairs=[],t}return e.prototype.decodeRow=function(t,n,i){var o,a,s,l,u=this.decodePair(n,!1,t,i);e.addOrTally(this.possibleLeftPairs,u),n.reverse();var c=this.decodePair(n,!0,t,i);e.addOrTally(this.possibleRightPairs,c),n.reverse();try{for(var f=hi(this.possibleLeftPairs),h=f.next();!h.done;h=f.next()){var v=h.value;if(v.getCount()>1)try{for(var p=(s=void 0,hi(this.possibleRightPairs)),g=p.next();!g.done;g=p.next()){var m=g.value;if(m.getCount()>1&&e.checkChecksum(v,m))return e.constructResult(v,m)}}catch(y){s={error:y}}finally{try{g&&!g.done&&(l=p.return)&&l.call(p)}finally{if(s)throw s.error}}}}catch(y){o={error:y}}finally{try{h&&!h.done&&(a=f.return)&&a.call(f)}finally{if(o)throw o.error}}throw new D},e.addOrTally=function(t,n){var i,o;if(n!=null){var a=!1;try{for(var s=hi(t),l=s.next();!l.done;l=s.next()){var u=l.value;if(u.getValue()===n.getValue()){u.incrementCount(),a=!0;break}}}catch(c){i={error:c}}finally{try{l&&!l.done&&(o=s.return)&&o.call(s)}finally{if(i)throw i.error}}a||t.push(n)}},e.prototype.reset=function(){this.possibleLeftPairs.length=0,this.possibleRightPairs.length=0},e.constructResult=function(t,n){for(var i=4537077*t.getValue()+n.getValue(),o=new String(i).toString(),a=new q,s=13-o.length;s>0;s--)a.append("0");a.append(o);for(var l=0,s=0;s<13;s++){var u=a.charAt(s).charCodeAt(0)-48;l+=(s&1)===0?3*u:u}l=10-l%10,l===10&&(l=0),a.append(l.toString());var c=t.getFinderPattern().getResultPoints(),f=n.getFinderPattern().getResultPoints();return new Oe(a.toString(),null,0,[c[0],c[1],f[0],f[1]],H.RSS_14,new Date().getTime())},e.checkChecksum=function(t,n){var i=(t.getChecksumPortion()+16*n.getChecksumPortion())%79,o=9*t.getFinderPattern().getValue()+n.getFinderPattern().getValue();return o>72&&o--,o>8&&o--,i===o},e.prototype.decodePair=function(t,n,i,o){try{var a=this.findFinderPattern(t,n),s=this.parseFoundFinderPattern(t,i,n,a),l=o==null?null:o.get(fe.NEED_RESULT_POINT_CALLBACK);if(l!=null){var u=(a[0]+a[1])/2;n&&(u=t.getSize()-1-u),l.foundPossibleResultPoint(new X(u,i))}var c=this.decodeDataCharacter(t,s,!0),f=this.decodeDataCharacter(t,s,!1);return new _f(1597*c.getValue()+f.getValue(),c.getChecksumPortion()+4*f.getChecksumPortion(),s)}catch{return null}},e.prototype.decodeDataCharacter=function(t,n,i){for(var o=this.getDataCharacterCounters(),a=0;a<o.length;a++)o[a]=0;if(i)ve.recordPatternInReverse(t,n.getStartEnd()[0],o);else{ve.recordPattern(t,n.getStartEnd()[1]+1,o);for(var s=0,l=o.length-1;s<l;s++,l--){var u=o[s];o[s]=o[l],o[l]=u}}for(var c=i?16:15,f=Q.sum(new Int32Array(o))/c,h=this.getOddCounts(),v=this.getEvenCounts(),p=this.getOddRoundingErrors(),g=this.getEvenRoundingErrors(),s=0;s<o.length;s++){var m=o[s]/f,y=Math.floor(m+.5);y<1?y=1:y>8&&(y=8);var C=Math.floor(s/2);(s&1)===0?(h[C]=y,p[C]=m-y):(v[C]=y,g[C]=m-y)}this.adjustOddEvenCounts(i,c);for(var w=0,E=0,s=h.length-1;s>=0;s--)E*=9,E+=h[s],w+=h[s];for(var I=0,S=0,s=v.length-1;s>=0;s--)I*=9,I+=v[s],S+=v[s];var b=E+3*I;if(i){if((w&1)!==0||w>12||w<4)throw new D;var P=(12-w)/2,L=e.OUTSIDE_ODD_WIDEST[P],M=9-L,F=zt.getRSSvalue(h,L,!1),V=zt.getRSSvalue(v,M,!0),z=e.OUTSIDE_EVEN_TOTAL_SUBSET[P],U=e.OUTSIDE_GSUM[P];return new Kr(F*z+V+U,b)}else{if((S&1)!==0||S>10||S<4)throw new D;var P=(10-S)/2,L=e.INSIDE_ODD_WIDEST[P],M=9-L,F=zt.getRSSvalue(h,L,!0),V=zt.getRSSvalue(v,M,!1),R=e.INSIDE_ODD_TOTAL_SUBSET[P],U=e.INSIDE_GSUM[P];return new Kr(V*R+F+U,b)}},e.prototype.findFinderPattern=function(t,n){var i=this.getDecodeFinderCounters();i[0]=0,i[1]=0,i[2]=0,i[3]=0;for(var o=t.getSize(),a=!1,s=0;s<o&&(a=!t.get(s),n!==a);)s++;for(var l=0,u=s,c=s;c<o;c++)if(t.get(c)!==a)i[l]++;else{if(l===3){if(At.isFinderPattern(i))return[u,c];u+=i[0]+i[1],i[0]=i[2],i[1]=i[3],i[2]=0,i[3]=0,l--}else l++;i[l]=1,a=!a}throw new D},e.prototype.parseFoundFinderPattern=function(t,n,i,o){for(var a=t.get(o[0]),s=o[0]-1;s>=0&&a!==t.get(s);)s--;s++;var l=o[0]-s,u=this.getDecodeFinderCounters(),c=new Int32Array(u.length);se.arraycopy(u,0,c,1,u.length-1),c[0]=l;var f=this.parseFinderValue(c,e.FINDER_PATTERNS),h=s,v=o[1];return i&&(h=t.getSize()-1-h,v=t.getSize()-1-v),new Aa(f,[s,o[1]],h,v,n)},e.prototype.adjustOddEvenCounts=function(t,n){var i=Q.sum(new Int32Array(this.getOddCounts())),o=Q.sum(new Int32Array(this.getEvenCounts())),a=!1,s=!1,l=!1,u=!1;t?(i>12?s=!0:i<4&&(a=!0),o>12?u=!0:o<4&&(l=!0)):(i>11?s=!0:i<5&&(a=!0),o>10?u=!0:o<4&&(l=!0));var c=i+o-n,f=(i&1)===(t?1:0),h=(o&1)===1;if(c===1)if(f){if(h)throw new D;s=!0}else{if(!h)throw new D;u=!0}else if(c===-1)if(f){if(h)throw new D;a=!0}else{if(!h)throw new D;l=!0}else if(c===0){if(f){if(!h)throw new D;i<o?(a=!0,u=!0):(s=!0,l=!0)}else if(h)throw new D}else throw new D;if(a){if(s)throw new D;At.increment(this.getOddCounts(),this.getOddRoundingErrors())}if(s&&At.decrement(this.getOddCounts(),this.getOddRoundingErrors()),l){if(u)throw new D;At.increment(this.getEvenCounts(),this.getOddRoundingErrors())}u&&At.decrement(this.getEvenCounts(),this.getEvenRoundingErrors())},e.OUTSIDE_EVEN_TOTAL_SUBSET=[1,10,34,70,126],e.INSIDE_ODD_TOTAL_SUBSET=[4,20,48,81],e.OUTSIDE_GSUM=[0,161,961,2015,2715],e.INSIDE_GSUM=[0,336,1036,1516],e.OUTSIDE_ODD_WIDEST=[8,6,4,3,1],e.INSIDE_ODD_WIDEST=[2,4,6,8],e.FINDER_PATTERNS=[Int32Array.from([3,8,2,1]),Int32Array.from([3,5,5,1]),Int32Array.from([3,3,7,1]),Int32Array.from([3,1,9,1]),Int32Array.from([2,7,4,1]),Int32Array.from([2,5,6,1]),Int32Array.from([2,3,8,1]),Int32Array.from([1,5,7,1]),Int32Array.from([1,3,9,1])],e}(At),Ef=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)i.hasOwnProperty(o)&&(n[o]=i[o])},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)}}(),ur=function(r){Ef(e,r);function e(t){var n=r.call(this)||this;n.readers=[];var i=t?t.get(fe.POSSIBLE_FORMATS):null,o=t&&t.get(fe.ASSUME_CODE_39_CHECK_DIGIT)!==void 0;return i&&((i.includes(H.EAN_13)||i.includes(H.UPC_A)||i.includes(H.EAN_8)||i.includes(H.UPC_E))&&n.readers.push(new fi(t)),i.includes(H.CODE_39)&&n.readers.push(new va(o)),i.includes(H.CODE_93)&&n.readers.push(new pa),i.includes(H.CODE_128)&&n.readers.push(new ha),i.includes(H.ITF)&&n.readers.push(new ga),i.includes(H.CODABAR)&&n.readers.push(new Xc),i.includes(H.RSS_14)&&n.readers.push(new ba),i.includes(H.RSS_EXPANDED)&&(console.warn("RSS Expanded reader IS NOT ready for production yet! use at your own risk."),n.readers.push(new mf))),n.readers.length===0&&(n.readers.push(new fi(t)),n.readers.push(new va),n.readers.push(new pa),n.readers.push(new fi(t)),n.readers.push(new ha),n.readers.push(new ga),n.readers.push(new ba)),n}return e.prototype.decodeRow=function(t,n,i){for(var o=0;o<this.readers.length;o++)try{return this.readers[o].decodeRow(t,n,i)}catch{}throw new D},e.prototype.reset=function(){this.readers.forEach(function(t){return t.reset()})},e}(ve),If=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)i.hasOwnProperty(o)&&(n[o]=i[o])},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)}}();(function(r){If(e,r);function e(t,n){return t===void 0&&(t=500),r.call(this,new ur(n),t,n)||this}return e})(Vt);var Ta=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.")},te=function(){function r(e,t,n){this.ecCodewords=e,this.ecBlocks=[t],n&&this.ecBlocks.push(n)}return r.prototype.getECCodewords=function(){return this.ecCodewords},r.prototype.getECBlocks=function(){return this.ecBlocks},r}(),J=function(){function r(e,t){this.count=e,this.dataCodewords=t}return r.prototype.getCount=function(){return this.count},r.prototype.getDataCodewords=function(){return this.dataCodewords},r}(),Sf=function(){function r(e,t,n,i,o,a){var s,l;this.versionNumber=e,this.symbolSizeRows=t,this.symbolSizeColumns=n,this.dataRegionSizeRows=i,this.dataRegionSizeColumns=o,this.ecBlocks=a;var u=0,c=a.getECCodewords(),f=a.getECBlocks();try{for(var h=Ta(f),v=h.next();!v.done;v=h.next()){var p=v.value;u+=p.getCount()*(p.getDataCodewords()+c)}}catch(g){s={error:g}}finally{try{v&&!v.done&&(l=h.return)&&l.call(h)}finally{if(s)throw s.error}}this.totalCodewords=u}return r.prototype.getVersionNumber=function(){return this.versionNumber},r.prototype.getSymbolSizeRows=function(){return this.symbolSizeRows},r.prototype.getSymbolSizeColumns=function(){return this.symbolSizeColumns},r.prototype.getDataRegionSizeRows=function(){return this.dataRegionSizeRows},r.prototype.getDataRegionSizeColumns=function(){return this.dataRegionSizeColumns},r.prototype.getTotalCodewords=function(){return this.totalCodewords},r.prototype.getECBlocks=function(){return this.ecBlocks},r.getVersionForDimensions=function(e,t){var n,i;if((e&1)!==0||(t&1)!==0)throw new k;try{for(var o=Ta(r.VERSIONS),a=o.next();!a.done;a=o.next()){var s=a.value;if(s.symbolSizeRows===e&&s.symbolSizeColumns===t)return s}}catch(l){n={error:l}}finally{try{a&&!a.done&&(i=o.return)&&i.call(o)}finally{if(n)throw n.error}}throw new k},r.prototype.toString=function(){return""+this.versionNumber},r.buildVersions=function(){return[new r(1,10,10,8,8,new te(5,new J(1,3))),new r(2,12,12,10,10,new te(7,new J(1,5))),new r(3,14,14,12,12,new te(10,new J(1,8))),new r(4,16,16,14,14,new te(12,new J(1,12))),new r(5,18,18,16,16,new te(14,new J(1,18))),new r(6,20,20,18,18,new te(18,new J(1,22))),new r(7,22,22,20,20,new te(20,new J(1,30))),new r(8,24,24,22,22,new te(24,new J(1,36))),new r(9,26,26,24,24,new te(28,new J(1,44))),new r(10,32,32,14,14,new te(36,new J(1,62))),new r(11,36,36,16,16,new te(42,new J(1,86))),new r(12,40,40,18,18,new te(48,new J(1,114))),new r(13,44,44,20,20,new te(56,new J(1,144))),new r(14,48,48,22,22,new te(68,new J(1,174))),new r(15,52,52,24,24,new te(42,new J(2,102))),new r(16,64,64,14,14,new te(56,new J(2,140))),new r(17,72,72,16,16,new te(36,new J(4,92))),new r(18,80,80,18,18,new te(48,new J(4,114))),new r(19,88,88,20,20,new te(56,new J(4,144))),new r(20,96,96,22,22,new te(68,new J(4,174))),new r(21,104,104,24,24,new te(56,new J(6,136))),new r(22,120,120,18,18,new te(68,new J(6,175))),new r(23,132,132,20,20,new te(62,new J(8,163))),new r(24,144,144,22,22,new te(62,new J(8,156),new J(2,155))),new r(25,8,18,6,16,new te(7,new J(1,5))),new r(26,8,32,6,14,new te(11,new J(1,10))),new r(27,12,26,10,24,new te(14,new J(1,16))),new r(28,12,36,10,16,new te(18,new J(1,22))),new r(29,16,36,14,16,new te(24,new J(1,32))),new r(30,16,48,14,22,new te(28,new J(1,49)))]},r.VERSIONS=r.buildVersions(),r}(),bf=function(){function r(e){var t=e.getHeight();if(t<8||t>144||(t&1)!==0)throw new k;this.version=r.readVersion(e),this.mappingBitMatrix=this.extractDataRegion(e),this.readMappingMatrix=new rt(this.mappingBitMatrix.getWidth(),this.mappingBitMatrix.getHeight())}return r.prototype.getVersion=function(){return this.version},r.readVersion=function(e){var t=e.getHeight(),n=e.getWidth();return Sf.getVersionForDimensions(t,n)},r.prototype.readCodewords=function(){var e=new Int8Array(this.version.getTotalCodewords()),t=0,n=4,i=0,o=this.mappingBitMatrix.getHeight(),a=this.mappingBitMatrix.getWidth(),s=!1,l=!1,u=!1,c=!1;do if(n===o&&i===0&&!s)e[t++]=this.readCorner1(o,a)&255,n-=2,i+=2,s=!0;else if(n===o-2&&i===0&&(a&3)!==0&&!l)e[t++]=this.readCorner2(o,a)&255,n-=2,i+=2,l=!0;else if(n===o+4&&i===2&&(a&7)===0&&!u)e[t++]=this.readCorner3(o,a)&255,n-=2,i+=2,u=!0;else if(n===o-2&&i===0&&(a&7)===4&&!c)e[t++]=this.readCorner4(o,a)&255,n-=2,i+=2,c=!0;else{do n<o&&i>=0&&!this.readMappingMatrix.get(i,n)&&(e[t++]=this.readUtah(n,i,o,a)&255),n-=2,i+=2;while(n>=0&&i<a);n+=1,i+=3;do n>=0&&i<a&&!this.readMappingMatrix.get(i,n)&&(e[t++]=this.readUtah(n,i,o,a)&255),n+=2,i-=2;while(n<o&&i>=0);n+=3,i+=1}while(n<o||i<a);if(t!==this.version.getTotalCodewords())throw new k;return e},r.prototype.readModule=function(e,t,n,i){return e<0&&(e+=n,t+=4-(n+4&7)),t<0&&(t+=i,e+=4-(i+4&7)),this.readMappingMatrix.set(t,e),this.mappingBitMatrix.get(t,e)},r.prototype.readUtah=function(e,t,n,i){var o=0;return this.readModule(e-2,t-2,n,i)&&(o|=1),o<<=1,this.readModule(e-2,t-1,n,i)&&(o|=1),o<<=1,this.readModule(e-1,t-2,n,i)&&(o|=1),o<<=1,this.readModule(e-1,t-1,n,i)&&(o|=1),o<<=1,this.readModule(e-1,t,n,i)&&(o|=1),o<<=1,this.readModule(e,t-2,n,i)&&(o|=1),o<<=1,this.readModule(e,t-1,n,i)&&(o|=1),o<<=1,this.readModule(e,t,n,i)&&(o|=1),o},r.prototype.readCorner1=function(e,t){var n=0;return this.readModule(e-1,0,e,t)&&(n|=1),n<<=1,this.readModule(e-1,1,e,t)&&(n|=1),n<<=1,this.readModule(e-1,2,e,t)&&(n|=1),n<<=1,this.readModule(0,t-2,e,t)&&(n|=1),n<<=1,this.readModule(0,t-1,e,t)&&(n|=1),n<<=1,this.readModule(1,t-1,e,t)&&(n|=1),n<<=1,this.readModule(2,t-1,e,t)&&(n|=1),n<<=1,this.readModule(3,t-1,e,t)&&(n|=1),n},r.prototype.readCorner2=function(e,t){var n=0;return this.readModule(e-3,0,e,t)&&(n|=1),n<<=1,this.readModule(e-2,0,e,t)&&(n|=1),n<<=1,this.readModule(e-1,0,e,t)&&(n|=1),n<<=1,this.readModule(0,t-4,e,t)&&(n|=1),n<<=1,this.readModule(0,t-3,e,t)&&(n|=1),n<<=1,this.readModule(0,t-2,e,t)&&(n|=1),n<<=1,this.readModule(0,t-1,e,t)&&(n|=1),n<<=1,this.readModule(1,t-1,e,t)&&(n|=1),n},r.prototype.readCorner3=function(e,t){var n=0;return this.readModule(e-1,0,e,t)&&(n|=1),n<<=1,this.readModule(e-1,t-1,e,t)&&(n|=1),n<<=1,this.readModule(0,t-3,e,t)&&(n|=1),n<<=1,this.readModule(0,t-2,e,t)&&(n|=1),n<<=1,this.readModule(0,t-1,e,t)&&(n|=1),n<<=1,this.readModule(1,t-3,e,t)&&(n|=1),n<<=1,this.readModule(1,t-2,e,t)&&(n|=1),n<<=1,this.readModule(1,t-1,e,t)&&(n|=1),n},r.prototype.readCorner4=function(e,t){var n=0;return this.readModule(e-3,0,e,t)&&(n|=1),n<<=1,this.readModule(e-2,0,e,t)&&(n|=1),n<<=1,this.readModule(e-1,0,e,t)&&(n|=1),n<<=1,this.readModule(0,t-2,e,t)&&(n|=1),n<<=1,this.readModule(0,t-1,e,t)&&(n|=1),n<<=1,this.readModule(1,t-1,e,t)&&(n|=1),n<<=1,this.readModule(2,t-1,e,t)&&(n|=1),n<<=1,this.readModule(3,t-1,e,t)&&(n|=1),n},r.prototype.extractDataRegion=function(e){var t=this.version.getSymbolSizeRows(),n=this.version.getSymbolSizeColumns();if(e.getHeight()!==t)throw new $("Dimension of bitMatrix must match the version size");for(var i=this.version.getDataRegionSizeRows(),o=this.version.getDataRegionSizeColumns(),a=t/i|0,s=n/o|0,l=a*i,u=s*o,c=new rt(u,l),f=0;f<a;++f)for(var h=f*i,v=0;v<s;++v)for(var p=v*o,g=0;g<i;++g)for(var m=f*(i+2)+1+g,y=h+g,C=0;C<o;++C){var w=v*(o+2)+1+C;if(e.get(w,m)){var E=p+C;c.set(E,y)}}return c},r}(),Oa=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.")},Tf=function(){function r(e,t){this.numDataCodewords=e,this.codewords=t}return r.getDataBlocks=function(e,t){var n,i,o,a,s=t.getECBlocks(),l=0,u=s.getECBlocks();try{for(var c=Oa(u),f=c.next();!f.done;f=c.next()){var h=f.value;l+=h.getCount()}}catch(U){n={error:U}}finally{try{f&&!f.done&&(i=c.return)&&i.call(c)}finally{if(n)throw n.error}}var v=new Array(l),p=0;try{for(var g=Oa(u),m=g.next();!m.done;m=g.next())for(var h=m.value,y=0;y<h.getCount();y++){var C=h.getDataCodewords(),w=s.getECCodewords()+C;v[p++]=new r(C,new Uint8Array(w))}}catch(U){o={error:U}}finally{try{m&&!m.done&&(a=g.return)&&a.call(g)}finally{if(o)throw o.error}}for(var E=v[0].codewords.length,I=E-s.getECCodewords(),S=I-1,b=0,y=0;y<S;y++)for(var P=0;P<p;P++)v[P].codewords[y]=e[b++];for(var L=t.getVersionNumber()===24,M=L?8:p,P=0;P<M;P++)v[P].codewords[I-1]=e[b++];for(var F=v[0].codewords.length,y=I;y<F;y++)for(var P=0;P<p;P++){var V=L?(P+8)%p:P,z=L&&V>7?y-1:y;v[V].codewords[z]=e[b++]}if(b!==e.length)throw new $;return v},r.prototype.getNumDataCodewords=function(){return this.numDataCodewords},r.prototype.getCodewords=function(){return this.codewords},r}(),Na=function(){function r(e){this.bytes=e,this.byteOffset=0,this.bitOffset=0}return r.prototype.getBitOffset=function(){return this.bitOffset},r.prototype.getByteOffset=function(){return this.byteOffset},r.prototype.readBits=function(e){if(e<1||e>32||e>this.available())throw new $(""+e);var t=0,n=this.bitOffset,i=this.byteOffset,o=this.bytes;if(n>0){var a=8-n,s=e<a?e:a,l=a-s,u=255>>8-s<<l;t=(o[i]&u)>>l,e-=s,n+=s,n===8&&(n=0,i++)}if(e>0){for(;e>=8;)t=t<<8|o[i]&255,i++,e-=8;if(e>0){var l=8-e,u=255>>l<<l;t=t<<e|(o[i]&u)>>l,n+=e}}return this.bitOffset=n,this.byteOffset=i,t},r.prototype.available=function(){return 8*(this.bytes.length-this.byteOffset)-this.bitOffset},r}(),ge;(function(r){r[r.PAD_ENCODE=0]="PAD_ENCODE",r[r.ASCII_ENCODE=1]="ASCII_ENCODE",r[r.C40_ENCODE=2]="C40_ENCODE",r[r.TEXT_ENCODE=3]="TEXT_ENCODE",r[r.ANSIX12_ENCODE=4]="ANSIX12_ENCODE",r[r.EDIFACT_ENCODE=5]="EDIFACT_ENCODE",r[r.BASE256_ENCODE=6]="BASE256_ENCODE"})(ge||(ge={}));var Of=function(){function r(){}return r.decode=function(e){var t=new Na(e),n=new q,i=new q,o=new Array,a=ge.ASCII_ENCODE;do if(a===ge.ASCII_ENCODE)a=this.decodeAsciiSegment(t,n,i);else{switch(a){case ge.C40_ENCODE:this.decodeC40Segment(t,n);break;case ge.TEXT_ENCODE:this.decodeTextSegment(t,n);break;case ge.ANSIX12_ENCODE:this.decodeAnsiX12Segment(t,n);break;case ge.EDIFACT_ENCODE:this.decodeEdifactSegment(t,n);break;case ge.BASE256_ENCODE:this.decodeBase256Segment(t,n,o);break;default:throw new k}a=ge.ASCII_ENCODE}while(a!==ge.PAD_ENCODE&&t.available()>0);return i.length()>0&&n.append(i.toString()),new qr(e,n.toString(),o.length===0?null:o,null)},r.decodeAsciiSegment=function(e,t,n){var i=!1;do{var o=e.readBits(8);if(o===0)throw new k;if(o<=128)return i&&(o+=128),t.append(String.fromCharCode(o-1)),ge.ASCII_ENCODE;if(o===129)return ge.PAD_ENCODE;if(o<=229){var a=o-130;a<10&&t.append("0"),t.append(""+a)}else switch(o){case 230:return ge.C40_ENCODE;case 231:return ge.BASE256_ENCODE;case 232:t.append("");break;case 233:case 234:break;case 235:i=!0;break;case 236:t.append("[)>05"),n.insert(0,"");break;case 237:t.append("[)>06"),n.insert(0,"");break;case 238:return ge.ANSIX12_ENCODE;case 239:return ge.TEXT_ENCODE;case 240:return ge.EDIFACT_ENCODE;case 241:break;default:if(o!==254||e.available()!==0)throw new k;break}}while(e.available()>0);return ge.ASCII_ENCODE},r.decodeC40Segment=function(e,t){var n=!1,i=[],o=0;do{if(e.available()===8)return;var a=e.readBits(8);if(a===254)return;this.parseTwoBytes(a,e.readBits(8),i);for(var s=0;s<3;s++){var l=i[s];switch(o){case 0:if(l<3)o=l+1;else if(l<this.C40_BASIC_SET_CHARS.length){var u=this.C40_BASIC_SET_CHARS[l];n?(t.append(String.fromCharCode(u.charCodeAt(0)+128)),n=!1):t.append(u)}else throw new k;break;case 1:n?(t.append(String.fromCharCode(l+128)),n=!1):t.append(String.fromCharCode(l)),o=0;break;case 2:if(l<this.C40_SHIFT2_SET_CHARS.length){var u=this.C40_SHIFT2_SET_CHARS[l];n?(t.append(String.fromCharCode(u.charCodeAt(0)+128)),n=!1):t.append(u)}else switch(l){case 27:t.append("");break;case 30:n=!0;break;default:throw new k}o=0;break;case 3:n?(t.append(String.fromCharCode(l+224)),n=!1):t.append(String.fromCharCode(l+96)),o=0;break;default:throw new k}}}while(e.available()>0)},r.decodeTextSegment=function(e,t){var n=!1,i=[],o=0;do{if(e.available()===8)return;var a=e.readBits(8);if(a===254)return;this.parseTwoBytes(a,e.readBits(8),i);for(var s=0;s<3;s++){var l=i[s];switch(o){case 0:if(l<3)o=l+1;else if(l<this.TEXT_BASIC_SET_CHARS.length){var u=this.TEXT_BASIC_SET_CHARS[l];n?(t.append(String.fromCharCode(u.charCodeAt(0)+128)),n=!1):t.append(u)}else throw new k;break;case 1:n?(t.append(String.fromCharCode(l+128)),n=!1):t.append(String.fromCharCode(l)),o=0;break;case 2:if(l<this.TEXT_SHIFT2_SET_CHARS.length){var u=this.TEXT_SHIFT2_SET_CHARS[l];n?(t.append(String.fromCharCode(u.charCodeAt(0)+128)),n=!1):t.append(u)}else switch(l){case 27:t.append("");break;case 30:n=!0;break;default:throw new k}o=0;break;case 3:if(l<this.TEXT_SHIFT3_SET_CHARS.length){var u=this.TEXT_SHIFT3_SET_CHARS[l];n?(t.append(String.fromCharCode(u.charCodeAt(0)+128)),n=!1):t.append(u),o=0}else throw new k;break;default:throw new k}}}while(e.available()>0)},r.decodeAnsiX12Segment=function(e,t){var n=[];do{if(e.available()===8)return;var i=e.readBits(8);if(i===254)return;this.parseTwoBytes(i,e.readBits(8),n);for(var o=0;o<3;o++){var a=n[o];switch(a){case 0:t.append("\r");break;case 1:t.append("*");break;case 2:t.append(">");break;case 3:t.append(" ");break;default:if(a<14)t.append(String.fromCharCode(a+44));else if(a<40)t.append(String.fromCharCode(a+51));else throw new k;break}}}while(e.available()>0)},r.parseTwoBytes=function(e,t,n){var i=(e<<8)+t-1,o=Math.floor(i/1600);n[0]=o,i-=o*1600,o=Math.floor(i/40),n[1]=o,n[2]=i-o*40},r.decodeEdifactSegment=function(e,t){do{if(e.available()<=16)return;for(var n=0;n<4;n++){var i=e.readBits(6);if(i===31){var o=8-e.getBitOffset();o!==8&&e.readBits(o);return}(i&32)===0&&(i|=64),t.append(String.fromCharCode(i))}}while(e.available()>0)},r.decodeBase256Segment=function(e,t,n){var i=1+e.getByteOffset(),o=this.unrandomize255State(e.readBits(8),i++),a;if(o===0?a=e.available()/8|0:o<250?a=o:a=250*(o-249)+this.unrandomize255State(e.readBits(8),i++),a<0)throw new k;for(var s=new Uint8Array(a),l=0;l<a;l++){if(e.available()<8)throw new k;s[l]=this.unrandomize255State(e.readBits(8),i++)}n.push(s);try{t.append(je.decode(s,Z.ISO88591))}catch(u){throw new lr("Platform does not support required encoding: "+u.message)}},r.unrandomize255State=function(e,t){var n=149*t%255+1,i=e-n;return i>=0?i:i+256},r.C40_BASIC_SET_CHARS=["*","*","*"," ","0","1","2","3","4","5","6","7","8","9","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"],r.C40_SHIFT2_SET_CHARS=["!",'"',"#","$","%","&","'","(",")","*","+",",","-",".","/",":",";","<","=",">","?","@","[","\\","]","^","_"],r.TEXT_BASIC_SET_CHARS=["*","*","*"," ","0","1","2","3","4","5","6","7","8","9","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"],r.TEXT_SHIFT2_SET_CHARS=r.C40_SHIFT2_SET_CHARS,r.TEXT_SHIFT3_SET_CHARS=["`","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","{","|","}","~",""],r}(),Nf=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.")},Df=function(){function r(){this.rsDecoder=new Zr(Ve.DATA_MATRIX_FIELD_256)}return r.prototype.decode=function(e){var t,n,i=new bf(e),o=i.getVersion(),a=i.readCodewords(),s=Tf.getDataBlocks(a,o),l=0;try{for(var u=Nf(s),c=u.next();!c.done;c=u.next()){var f=c.value;l+=f.getNumDataCodewords()}}catch(w){t={error:w}}finally{try{c&&!c.done&&(n=u.return)&&n.call(u)}finally{if(t)throw t.error}}for(var h=new Uint8Array(l),v=s.length,p=0;p<v;p++){var g=s[p],m=g.getCodewords(),y=g.getNumDataCodewords();this.correctErrors(m,y);for(var C=0;C<y;C++)h[C*v+p]=m[C]}return Of.decode(h)},r.prototype.correctErrors=function(e,t){var n=new Int32Array(e);try{this.rsDecoder.decode(n,e.length-t)}catch{throw new Ce}for(var i=0;i<t;i++)e[i]=n[i]},r}(),Mf=function(){function r(e){this.image=e,this.rectangleDetector=new oi(this.image)}return r.prototype.detect=function(){var e=this.rectangleDetector.detect(),t=this.detectSolid1(e);if(t=this.detectSolid2(t),t[3]=this.correctTopRight(t),!t[3])throw new D;t=this.shiftToModuleCenter(t);var n=t[0],i=t[1],o=t[2],a=t[3],s=this.transitionsBetween(n,a)+1,l=this.transitionsBetween(o,a)+1;(s&1)===1&&(s+=1),(l&1)===1&&(l+=1),4*s<7*l&&4*l<7*s&&(s=l=Math.max(s,l));var u=r.sampleGrid(this.image,n,i,o,a,s,l);return new ii(u,[n,i,o,a])},r.shiftPoint=function(e,t,n){var i=(t.getX()-e.getX())/(n+1),o=(t.getY()-e.getY())/(n+1);return new X(e.getX()+i,e.getY()+o)},r.moveAway=function(e,t,n){var i=e.getX(),o=e.getY();return i<t?i-=1:i+=1,o<n?o-=1:o+=1,new X(i,o)},r.prototype.detectSolid1=function(e){var t=e[0],n=e[1],i=e[3],o=e[2],a=this.transitionsBetween(t,n),s=this.transitionsBetween(n,i),l=this.transitionsBetween(i,o),u=this.transitionsBetween(o,t),c=a,f=[o,t,n,i];return c>s&&(c=s,f[0]=t,f[1]=n,f[2]=i,f[3]=o),c>l&&(c=l,f[0]=n,f[1]=i,f[2]=o,f[3]=t),c>u&&(f[0]=i,f[1]=o,f[2]=t,f[3]=n),f},r.prototype.detectSolid2=function(e){var t=e[0],n=e[1],i=e[2],o=e[3],a=this.transitionsBetween(t,o),s=r.shiftPoint(n,i,(a+1)*4),l=r.shiftPoint(i,n,(a+1)*4),u=this.transitionsBetween(s,t),c=this.transitionsBetween(l,o);return u<c?(e[0]=t,e[1]=n,e[2]=i,e[3]=o):(e[0]=n,e[1]=i,e[2]=o,e[3]=t),e},r.prototype.correctTopRight=function(e){var t=e[0],n=e[1],i=e[2],o=e[3],a=this.transitionsBetween(t,o),s=this.transitionsBetween(n,o),l=r.shiftPoint(t,n,(s+1)*4),u=r.shiftPoint(i,n,(a+1)*4);a=this.transitionsBetween(l,o),s=this.transitionsBetween(u,o);var c=new X(o.getX()+(i.getX()-n.getX())/(a+1),o.getY()+(i.getY()-n.getY())/(a+1)),f=new X(o.getX()+(t.getX()-n.getX())/(s+1),o.getY()+(t.getY()-n.getY())/(s+1));if(!this.isValid(c))return this.isValid(f)?f:null;if(!this.isValid(f))return c;var h=this.transitionsBetween(l,c)+this.transitionsBetween(u,c),v=this.transitionsBetween(l,f)+this.transitionsBetween(u,f);return h>v?c:f},r.prototype.shiftToModuleCenter=function(e){var t=e[0],n=e[1],i=e[2],o=e[3],a=this.transitionsBetween(t,o)+1,s=this.transitionsBetween(i,o)+1,l=r.shiftPoint(t,n,s*4),u=r.shiftPoint(i,n,a*4);a=this.transitionsBetween(l,o)+1,s=this.transitionsBetween(u,o)+1,(a&1)===1&&(a+=1),(s&1)===1&&(s+=1);var c=(t.getX()+n.getX()+i.getX()+o.getX())/4,f=(t.getY()+n.getY()+i.getY()+o.getY())/4;t=r.moveAway(t,c,f),n=r.moveAway(n,c,f),i=r.moveAway(i,c,f),o=r.moveAway(o,c,f);var h,v;return l=r.shiftPoint(t,n,s*4),l=r.shiftPoint(l,o,a*4),h=r.shiftPoint(n,t,s*4),h=r.shiftPoint(h,i,a*4),u=r.shiftPoint(i,o,s*4),u=r.shiftPoint(u,n,a*4),v=r.shiftPoint(o,i,s*4),v=r.shiftPoint(v,t,a*4),[l,h,u,v]},r.prototype.isValid=function(e){return e.getX()>=0&&e.getX()<this.image.getWidth()&&e.getY()>0&&e.getY()<this.image.getHeight()},r.sampleGrid=function(e,t,n,i,o,a,s){var l=ai.getInstance();return l.sampleGrid(e,a,s,.5,.5,a-.5,.5,a-.5,s-.5,.5,s-.5,t.getX(),t.getY(),o.getX(),o.getY(),i.getX(),i.getY(),n.getX(),n.getY())},r.prototype.transitionsBetween=function(e,t){var n=Math.trunc(e.getX()),i=Math.trunc(e.getY()),o=Math.trunc(t.getX()),a=Math.trunc(t.getY()),s=Math.abs(a-i)>Math.abs(o-n);if(s){var l=n;n=i,i=l,l=o,o=a,a=l}for(var u=Math.abs(o-n),c=Math.abs(a-i),f=-u/2,h=i<a?1:-1,v=n<o?1:-1,p=0,g=this.image.get(s?i:n,s?n:i),m=n,y=i;m!==o;m+=v){var C=this.image.get(s?y:m,s?m:y);if(C!==g&&(p++,g=C),f+=c,f>0){if(y===a)break;y+=h,f-=u}}return p},r}(),vi=function(){function r(){this.decoder=new Df}return r.prototype.decode=function(e,t){t===void 0&&(t=null);var n,i;if(t!=null&&t.has(fe.PURE_BARCODE)){var o=r.extractPureBits(e.getBlackMatrix());n=this.decoder.decode(o),i=r.NO_POINTS}else{var a=new Mf(e.getBlackMatrix()).detect();n=this.decoder.decode(a.getBits()),i=a.getPoints()}var s=n.getRawBytes(),l=new Oe(n.getText(),s,8*s.length,i,H.DATA_MATRIX,se.currentTimeMillis()),u=n.getByteSegments();u!=null&&l.putMetadata(Ie.BYTE_SEGMENTS,u);var c=n.getECLevel();return c!=null&&l.putMetadata(Ie.ERROR_CORRECTION_LEVEL,c),l},r.prototype.reset=function(){},r.extractPureBits=function(e){var t=e.getTopLeftOnBit(),n=e.getBottomRightOnBit();if(t==null||n==null)throw new D;var i=this.moduleSize(t,e),o=t[1],a=n[1],s=t[0],l=n[0],u=(l-s+1)/i,c=(a-o+1)/i;if(u<=0||c<=0)throw new D;var f=i/2;o+=f,s+=f;for(var h=new rt(u,c),v=0;v<c;v++)for(var p=o+v*i,g=0;g<u;g++)e.get(s+g*i,p)&&h.set(g,v);return h},r.moduleSize=function(e,t){for(var n=t.getWidth(),i=e[0],o=e[1];i<n&&t.get(i,o);)i++;if(i===n)throw new D;var a=i-e[0];if(a===0)throw new D;return a},r.NO_POINTS=[],r}(),Pf=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)i.hasOwnProperty(o)&&(n[o]=i[o])},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)}}();(function(r){Pf(e,r);function e(t){return t===void 0&&(t=500),r.call(this,new vi,t)||this}return e})(Vt);var Ht;(function(r){r[r.L=0]="L",r[r.M=1]="M",r[r.Q=2]="Q",r[r.H=3]="H"})(Ht||(Ht={}));var Ff=function(){function r(e,t,n){this.value=e,this.stringValue=t,this.bits=n,r.FOR_BITS.set(n,this),r.FOR_VALUE.set(e,this)}return r.prototype.getValue=function(){return this.value},r.prototype.getBits=function(){return this.bits},r.fromString=function(e){switch(e){case"L":return r.L;case"M":return r.M;case"Q":return r.Q;case"H":return r.H;default:throw new Ke(e+"not available")}},r.prototype.toString=function(){return this.stringValue},r.prototype.equals=function(e){if(!(e instanceof r))return!1;var t=e;return this.value===t.value},r.forBits=function(e){if(e<0||e>=r.FOR_BITS.size)throw new $;return r.FOR_BITS.get(e)},r.FOR_BITS=new Map,r.FOR_VALUE=new Map,r.L=new r(Ht.L,"L",1),r.M=new r(Ht.M,"M",0),r.Q=new r(Ht.Q,"Q",3),r.H=new r(Ht.H,"H",2),r}(),Bf=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.")},Da=function(){function r(e){this.errorCorrectionLevel=Ff.forBits(e>>3&3),this.dataMask=e&7}return r.numBitsDiffering=function(e,t){return Y.bitCount(e^t)},r.decodeFormatInformation=function(e,t){var n=r.doDecodeFormatInformation(e,t);return n!==null?n:r.doDecodeFormatInformation(e^r.FORMAT_INFO_MASK_QR,t^r.FORMAT_INFO_MASK_QR)},r.doDecodeFormatInformation=function(e,t){var n,i,o=Number.MAX_SAFE_INTEGER,a=0;try{for(var s=Bf(r.FORMAT_INFO_DECODE_LOOKUP),l=s.next();!l.done;l=s.next()){var u=l.value,c=u[0];if(c===e||c===t)return new r(u[1]);var f=r.numBitsDiffering(e,c);f<o&&(a=u[1],o=f),e!==t&&(f=r.numBitsDiffering(t,c),f<o&&(a=u[1],o=f))}}catch(h){n={error:h}}finally{try{l&&!l.done&&(i=s.return)&&i.call(s)}finally{if(n)throw n.error}}return o<=3?new r(a):null},r.prototype.getErrorCorrectionLevel=function(){return this.errorCorrectionLevel},r.prototype.getDataMask=function(){return this.dataMask},r.prototype.hashCode=function(){return this.errorCorrectionLevel.getBits()<<3|this.dataMask},r.prototype.equals=function(e){if(!(e instanceof r))return!1;var t=e;return this.errorCorrectionLevel===t.errorCorrectionLevel&&this.dataMask===t.dataMask},r.FORMAT_INFO_MASK_QR=21522,r.FORMAT_INFO_DECODE_LOOKUP=[Int32Array.from([21522,0]),Int32Array.from([20773,1]),Int32Array.from([24188,2]),Int32Array.from([23371,3]),Int32Array.from([17913,4]),Int32Array.from([16590,5]),Int32Array.from([20375,6]),Int32Array.from([19104,7]),Int32Array.from([30660,8]),Int32Array.from([29427,9]),Int32Array.from([32170,10]),Int32Array.from([30877,11]),Int32Array.from([26159,12]),Int32Array.from([25368,13]),Int32Array.from([27713,14]),Int32Array.from([26998,15]),Int32Array.from([5769,16]),Int32Array.from([5054,17]),Int32Array.from([7399,18]),Int32Array.from([6608,19]),Int32Array.from([1890,20]),Int32Array.from([597,21]),Int32Array.from([3340,22]),Int32Array.from([2107,23]),Int32Array.from([13663,24]),Int32Array.from([12392,25]),Int32Array.from([16177,26]),Int32Array.from([14854,27]),Int32Array.from([9396,28]),Int32Array.from([8579,29]),Int32Array.from([11994,30]),Int32Array.from([11245,31])],r}(),Lf=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.")},T=function(){function r(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];this.ecCodewordsPerBlock=e,this.ecBlocks=t}return r.prototype.getECCodewordsPerBlock=function(){return this.ecCodewordsPerBlock},r.prototype.getNumBlocks=function(){var e,t,n=0,i=this.ecBlocks;try{for(var o=Lf(i),a=o.next();!a.done;a=o.next()){var s=a.value;n+=s.getCount()}}catch(l){e={error:l}}finally{try{a&&!a.done&&(t=o.return)&&t.call(o)}finally{if(e)throw e.error}}return n},r.prototype.getTotalECCodewords=function(){return this.ecCodewordsPerBlock*this.getNumBlocks()},r.prototype.getECBlocks=function(){return this.ecBlocks},r}(),_=function(){function r(e,t){this.count=e,this.dataCodewords=t}return r.prototype.getCount=function(){return this.count},r.prototype.getDataCodewords=function(){return this.dataCodewords},r}(),Rf=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.")},St=function(){function r(e,t){for(var n,i,o=[],a=2;a<arguments.length;a++)o[a-2]=arguments[a];this.versionNumber=e,this.alignmentPatternCenters=t,this.ecBlocks=o;var s=0,l=o[0].getECCodewordsPerBlock(),u=o[0].getECBlocks();try{for(var c=Rf(u),f=c.next();!f.done;f=c.next()){var h=f.value;s+=h.getCount()*(h.getDataCodewords()+l)}}catch(v){n={error:v}}finally{try{f&&!f.done&&(i=c.return)&&i.call(c)}finally{if(n)throw n.error}}this.totalCodewords=s}return r.prototype.getVersionNumber=function(){return this.versionNumber},r.prototype.getAlignmentPatternCenters=function(){return this.alignmentPatternCenters},r.prototype.getTotalCodewords=function(){return this.totalCodewords},r.prototype.getDimensionForVersion=function(){return 17+4*this.versionNumber},r.prototype.getECBlocksForLevel=function(e){return this.ecBlocks[e.getValue()]},r.getProvisionalVersionForDimension=function(e){if(e%4!==1)throw new k;try{return this.getVersionForNumber((e-17)/4)}catch{throw new k}},r.getVersionForNumber=function(e){if(e<1||e>40)throw new $;return r.VERSIONS[e-1]},r.decodeVersionInformation=function(e){for(var t=Number.MAX_SAFE_INTEGER,n=0,i=0;i<r.VERSION_DECODE_INFO.length;i++){var o=r.VERSION_DECODE_INFO[i];if(o===e)return r.getVersionForNumber(i+7);var a=Da.numBitsDiffering(e,o);a<t&&(n=i+7,t=a)}return t<=3?r.getVersionForNumber(n):null},r.prototype.buildFunctionPattern=function(){var e=this.getDimensionForVersion(),t=new rt(e);t.setRegion(0,0,9,9),t.setRegion(e-8,0,8,9),t.setRegion(0,e-8,9,8);for(var n=this.alignmentPatternCenters.length,i=0;i<n;i++)for(var o=this.alignmentPatternCenters[i]-2,a=0;a<n;a++)i===0&&(a===0||a===n-1)||i===n-1&&a===0||t.setRegion(this.alignmentPatternCenters[a]-2,o,5,5);return t.setRegion(6,9,1,e-17),t.setRegion(9,6,e-17,1),this.versionNumber>6&&(t.setRegion(e-11,0,3,6),t.setRegion(0,e-11,6,3)),t},r.prototype.toString=function(){return""+this.versionNumber},r.VERSION_DECODE_INFO=Int32Array.from([31892,34236,39577,42195,48118,51042,55367,58893,63784,68472,70749,76311,79154,84390,87683,92361,96236,102084,102881,110507,110734,117786,119615,126325,127568,133589,136944,141498,145311,150283,152622,158308,161089,167017]),r.VERSIONS=[new r(1,new Int32Array(0),new T(7,new _(1,19)),new T(10,new _(1,16)),new T(13,new _(1,13)),new T(17,new _(1,9))),new r(2,Int32Array.from([6,18]),new T(10,new _(1,34)),new T(16,new _(1,28)),new T(22,new _(1,22)),new T(28,new _(1,16))),new r(3,Int32Array.from([6,22]),new T(15,new _(1,55)),new T(26,new _(1,44)),new T(18,new _(2,17)),new T(22,new _(2,13))),new r(4,Int32Array.from([6,26]),new T(20,new _(1,80)),new T(18,new _(2,32)),new T(26,new _(2,24)),new T(16,new _(4,9))),new r(5,Int32Array.from([6,30]),new T(26,new _(1,108)),new T(24,new _(2,43)),new T(18,new _(2,15),new _(2,16)),new T(22,new _(2,11),new _(2,12))),new r(6,Int32Array.from([6,34]),new T(18,new _(2,68)),new T(16,new _(4,27)),new T(24,new _(4,19)),new T(28,new _(4,15))),new r(7,Int32Array.from([6,22,38]),new T(20,new _(2,78)),new T(18,new _(4,31)),new T(18,new _(2,14),new _(4,15)),new T(26,new _(4,13),new _(1,14))),new r(8,Int32Array.from([6,24,42]),new T(24,new _(2,97)),new T(22,new _(2,38),new _(2,39)),new T(22,new _(4,18),new _(2,19)),new T(26,new _(4,14),new _(2,15))),new r(9,Int32Array.from([6,26,46]),new T(30,new _(2,116)),new T(22,new _(3,36),new _(2,37)),new T(20,new _(4,16),new _(4,17)),new T(24,new _(4,12),new _(4,13))),new r(10,Int32Array.from([6,28,50]),new T(18,new _(2,68),new _(2,69)),new T(26,new _(4,43),new _(1,44)),new T(24,new _(6,19),new _(2,20)),new T(28,new _(6,15),new _(2,16))),new r(11,Int32Array.from([6,30,54]),new T(20,new _(4,81)),new T(30,new _(1,50),new _(4,51)),new T(28,new _(4,22),new _(4,23)),new T(24,new _(3,12),new _(8,13))),new r(12,Int32Array.from([6,32,58]),new T(24,new _(2,92),new _(2,93)),new T(22,new _(6,36),new _(2,37)),new T(26,new _(4,20),new _(6,21)),new T(28,new _(7,14),new _(4,15))),new r(13,Int32Array.from([6,34,62]),new T(26,new _(4,107)),new T(22,new _(8,37),new _(1,38)),new T(24,new _(8,20),new _(4,21)),new T(22,new _(12,11),new _(4,12))),new r(14,Int32Array.from([6,26,46,66]),new T(30,new _(3,115),new _(1,116)),new T(24,new _(4,40),new _(5,41)),new T(20,new _(11,16),new _(5,17)),new T(24,new _(11,12),new _(5,13))),new r(15,Int32Array.from([6,26,48,70]),new T(22,new _(5,87),new _(1,88)),new T(24,new _(5,41),new _(5,42)),new T(30,new _(5,24),new _(7,25)),new T(24,new _(11,12),new _(7,13))),new r(16,Int32Array.from([6,26,50,74]),new T(24,new _(5,98),new _(1,99)),new T(28,new _(7,45),new _(3,46)),new T(24,new _(15,19),new _(2,20)),new T(30,new _(3,15),new _(13,16))),new r(17,Int32Array.from([6,30,54,78]),new T(28,new _(1,107),new _(5,108)),new T(28,new _(10,46),new _(1,47)),new T(28,new _(1,22),new _(15,23)),new T(28,new _(2,14),new _(17,15))),new r(18,Int32Array.from([6,30,56,82]),new T(30,new _(5,120),new _(1,121)),new T(26,new _(9,43),new _(4,44)),new T(28,new _(17,22),new _(1,23)),new T(28,new _(2,14),new _(19,15))),new r(19,Int32Array.from([6,30,58,86]),new T(28,new _(3,113),new _(4,114)),new T(26,new _(3,44),new _(11,45)),new T(26,new _(17,21),new _(4,22)),new T(26,new _(9,13),new _(16,14))),new r(20,Int32Array.from([6,34,62,90]),new T(28,new _(3,107),new _(5,108)),new T(26,new _(3,41),new _(13,42)),new T(30,new _(15,24),new _(5,25)),new T(28,new _(15,15),new _(10,16))),new r(21,Int32Array.from([6,28,50,72,94]),new T(28,new _(4,116),new _(4,117)),new T(26,new _(17,42)),new T(28,new _(17,22),new _(6,23)),new T(30,new _(19,16),new _(6,17))),new r(22,Int32Array.from([6,26,50,74,98]),new T(28,new _(2,111),new _(7,112)),new T(28,new _(17,46)),new T(30,new _(7,24),new _(16,25)),new T(24,new _(34,13))),new r(23,Int32Array.from([6,30,54,78,102]),new T(30,new _(4,121),new _(5,122)),new T(28,new _(4,47),new _(14,48)),new T(30,new _(11,24),new _(14,25)),new T(30,new _(16,15),new _(14,16))),new r(24,Int32Array.from([6,28,54,80,106]),new T(30,new _(6,117),new _(4,118)),new T(28,new _(6,45),new _(14,46)),new T(30,new _(11,24),new _(16,25)),new T(30,new _(30,16),new _(2,17))),new r(25,Int32Array.from([6,32,58,84,110]),new T(26,new _(8,106),new _(4,107)),new T(28,new _(8,47),new _(13,48)),new T(30,new _(7,24),new _(22,25)),new T(30,new _(22,15),new _(13,16))),new r(26,Int32Array.from([6,30,58,86,114]),new T(28,new _(10,114),new _(2,115)),new T(28,new _(19,46),new _(4,47)),new T(28,new _(28,22),new _(6,23)),new T(30,new _(33,16),new _(4,17))),new r(27,Int32Array.from([6,34,62,90,118]),new T(30,new _(8,122),new _(4,123)),new T(28,new _(22,45),new _(3,46)),new T(30,new _(8,23),new _(26,24)),new T(30,new _(12,15),new _(28,16))),new r(28,Int32Array.from([6,26,50,74,98,122]),new T(30,new _(3,117),new _(10,118)),new T(28,new _(3,45),new _(23,46)),new T(30,new _(4,24),new _(31,25)),new T(30,new _(11,15),new _(31,16))),new r(29,Int32Array.from([6,30,54,78,102,126]),new T(30,new _(7,116),new _(7,117)),new T(28,new _(21,45),new _(7,46)),new T(30,new _(1,23),new _(37,24)),new T(30,new _(19,15),new _(26,16))),new r(30,Int32Array.from([6,26,52,78,104,130]),new T(30,new _(5,115),new _(10,116)),new T(28,new _(19,47),new _(10,48)),new T(30,new _(15,24),new _(25,25)),new T(30,new _(23,15),new _(25,16))),new r(31,Int32Array.from([6,30,56,82,108,134]),new T(30,new _(13,115),new _(3,116)),new T(28,new _(2,46),new _(29,47)),new T(30,new _(42,24),new _(1,25)),new T(30,new _(23,15),new _(28,16))),new r(32,Int32Array.from([6,34,60,86,112,138]),new T(30,new _(17,115)),new T(28,new _(10,46),new _(23,47)),new T(30,new _(10,24),new _(35,25)),new T(30,new _(19,15),new _(35,16))),new r(33,Int32Array.from([6,30,58,86,114,142]),new T(30,new _(17,115),new _(1,116)),new T(28,new _(14,46),new _(21,47)),new T(30,new _(29,24),new _(19,25)),new T(30,new _(11,15),new _(46,16))),new r(34,Int32Array.from([6,34,62,90,118,146]),new T(30,new _(13,115),new _(6,116)),new T(28,new _(14,46),new _(23,47)),new T(30,new _(44,24),new _(7,25)),new T(30,new _(59,16),new _(1,17))),new r(35,Int32Array.from([6,30,54,78,102,126,150]),new T(30,new _(12,121),new _(7,122)),new T(28,new _(12,47),new _(26,48)),new T(30,new _(39,24),new _(14,25)),new T(30,new _(22,15),new _(41,16))),new r(36,Int32Array.from([6,24,50,76,102,128,154]),new T(30,new _(6,121),new _(14,122)),new T(28,new _(6,47),new _(34,48)),new T(30,new _(46,24),new _(10,25)),new T(30,new _(2,15),new _(64,16))),new r(37,Int32Array.from([6,28,54,80,106,132,158]),new T(30,new _(17,122),new _(4,123)),new T(28,new _(29,46),new _(14,47)),new T(30,new _(49,24),new _(10,25)),new T(30,new _(24,15),new _(46,16))),new r(38,Int32Array.from([6,32,58,84,110,136,162]),new T(30,new _(4,122),new _(18,123)),new T(28,new _(13,46),new _(32,47)),new T(30,new _(48,24),new _(14,25)),new T(30,new _(42,15),new _(32,16))),new r(39,Int32Array.from([6,26,54,82,110,138,166]),new T(30,new _(20,117),new _(4,118)),new T(28,new _(40,47),new _(7,48)),new T(30,new _(43,24),new _(22,25)),new T(30,new _(10,15),new _(67,16))),new r(40,Int32Array.from([6,30,58,86,114,142,170]),new T(30,new _(19,118),new _(6,119)),new T(28,new _(18,47),new _(31,48)),new T(30,new _(34,24),new _(34,25)),new T(30,new _(20,15),new _(61,16)))],r}(),we;(function(r){r[r.DATA_MASK_000=0]="DATA_MASK_000",r[r.DATA_MASK_001=1]="DATA_MASK_001",r[r.DATA_MASK_010=2]="DATA_MASK_010",r[r.DATA_MASK_011=3]="DATA_MASK_011",r[r.DATA_MASK_100=4]="DATA_MASK_100",r[r.DATA_MASK_101=5]="DATA_MASK_101",r[r.DATA_MASK_110=6]="DATA_MASK_110",r[r.DATA_MASK_111=7]="DATA_MASK_111"})(we||(we={}));var Ma=function(){function r(e,t){this.value=e,this.isMasked=t}return r.prototype.unmaskBitMatrix=function(e,t){for(var n=0;n<t;n++)for(var i=0;i<t;i++)this.isMasked(n,i)&&e.flip(i,n)},r.values=new Map([[we.DATA_MASK_000,new r(we.DATA_MASK_000,function(e,t){return(e+t&1)===0})],[we.DATA_MASK_001,new r(we.DATA_MASK_001,function(e,t){return(e&1)===0})],[we.DATA_MASK_010,new r(we.DATA_MASK_010,function(e,t){return t%3===0})],[we.DATA_MASK_011,new r(we.DATA_MASK_011,function(e,t){return(e+t)%3===0})],[we.DATA_MASK_100,new r(we.DATA_MASK_100,function(e,t){return(Math.floor(e/2)+Math.floor(t/3)&1)===0})],[we.DATA_MASK_101,new r(we.DATA_MASK_101,function(e,t){return e*t%6===0})],[we.DATA_MASK_110,new r(we.DATA_MASK_110,function(e,t){return e*t%6<3})],[we.DATA_MASK_111,new r(we.DATA_MASK_111,function(e,t){return(e+t+e*t%3&1)===0})]]),r}(),Vf=function(){function r(e){var t=e.getHeight();if(t<21||(t&3)!==1)throw new k;this.bitMatrix=e}return r.prototype.readFormatInformation=function(){if(this.parsedFormatInfo!==null&&this.parsedFormatInfo!==void 0)return this.parsedFormatInfo;for(var e=0,t=0;t<6;t++)e=this.copyBit(t,8,e);e=this.copyBit(7,8,e),e=this.copyBit(8,8,e),e=this.copyBit(8,7,e);for(var n=5;n>=0;n--)e=this.copyBit(8,n,e);for(var i=this.bitMatrix.getHeight(),o=0,a=i-7,n=i-1;n>=a;n--)o=this.copyBit(8,n,o);for(var t=i-8;t<i;t++)o=this.copyBit(t,8,o);if(this.parsedFormatInfo=Da.decodeFormatInformation(e,o),this.parsedFormatInfo!==null)return this.parsedFormatInfo;throw new k},r.prototype.readVersion=function(){if(this.parsedVersion!==null&&this.parsedVersion!==void 0)return this.parsedVersion;var e=this.bitMatrix.getHeight(),t=Math.floor((e-17)/4);if(t<=6)return St.getVersionForNumber(t);for(var n=0,i=e-11,o=5;o>=0;o--)for(var a=e-9;a>=i;a--)n=this.copyBit(a,o,n);var s=St.decodeVersionInformation(n);if(s!==null&&s.getDimensionForVersion()===e)return this.parsedVersion=s,s;n=0;for(var a=5;a>=0;a--)for(var o=e-9;o>=i;o--)n=this.copyBit(a,o,n);if(s=St.decodeVersionInformation(n),s!==null&&s.getDimensionForVersion()===e)return this.parsedVersion=s,s;throw new k},r.prototype.copyBit=function(e,t,n){var i=this.isMirror?this.bitMatrix.get(t,e):this.bitMatrix.get(e,t);return i?n<<1|1:n<<1},r.prototype.readCodewords=function(){var e=this.readFormatInformation(),t=this.readVersion(),n=Ma.values.get(e.getDataMask()),i=this.bitMatrix.getHeight();n.unmaskBitMatrix(this.bitMatrix,i);for(var o=t.buildFunctionPattern(),a=!0,s=new Uint8Array(t.getTotalCodewords()),l=0,u=0,c=0,f=i-1;f>0;f-=2){f===6&&f--;for(var h=0;h<i;h++)for(var v=a?i-1-h:h,p=0;p<2;p++)o.get(f-p,v)||(c++,u<<=1,this.bitMatrix.get(f-p,v)&&(u|=1),c===8&&(s[l++]=u,c=0,u=0));a=!a}if(l!==t.getTotalCodewords())throw new k;return s},r.prototype.remask=function(){if(this.parsedFormatInfo!==null){var e=Ma.values[this.parsedFormatInfo.getDataMask()],t=this.bitMatrix.getHeight();e.unmaskBitMatrix(this.bitMatrix,t)}},r.prototype.setMirror=function(e){this.parsedVersion=null,this.parsedFormatInfo=null,this.isMirror=e},r.prototype.mirror=function(){for(var e=this.bitMatrix,t=0,n=e.getWidth();t<n;t++)for(var i=t+1,o=e.getHeight();i<o;i++)e.get(t,i)!==e.get(i,t)&&(e.flip(i,t),e.flip(t,i))},r}(),Pa=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.")},kf=function(){function r(e,t){this.numDataCodewords=e,this.codewords=t}return r.getDataBlocks=function(e,t,n){var i,o,a,s;if(e.length!==t.getTotalCodewords())throw new $;var l=t.getECBlocksForLevel(n),u=0,c=l.getECBlocks();try{for(var f=Pa(c),h=f.next();!h.done;h=f.next()){var v=h.value;u+=v.getCount()}}catch(z){i={error:z}}finally{try{h&&!h.done&&(o=f.return)&&o.call(f)}finally{if(i)throw i.error}}var p=new Array(u),g=0;try{for(var m=Pa(c),y=m.next();!y.done;y=m.next())for(var v=y.value,C=0;C<v.getCount();C++){var w=v.getDataCodewords(),E=l.getECCodewordsPerBlock()+w;p[g++]=new r(w,new Uint8Array(E))}}catch(z){a={error:z}}finally{try{y&&!y.done&&(s=m.return)&&s.call(m)}finally{if(a)throw a.error}}for(var I=p[0].codewords.length,S=p.length-1;S>=0;){var b=p[S].codewords.length;if(b===I)break;S--}S++;for(var P=I-l.getECCodewordsPerBlock(),L=0,C=0;C<P;C++)for(var M=0;M<g;M++)p[M].codewords[C]=e[L++];for(var M=S;M<g;M++)p[M].codewords[P]=e[L++];for(var F=p[0].codewords.length,C=P;C<F;C++)for(var M=0;M<g;M++){var V=M<S?C:C+1;p[M].codewords[V]=e[L++]}return p},r.prototype.getNumDataCodewords=function(){return this.numDataCodewords},r.prototype.getCodewords=function(){return this.codewords},r}(),qe;(function(r){r[r.TERMINATOR=0]="TERMINATOR",r[r.NUMERIC=1]="NUMERIC",r[r.ALPHANUMERIC=2]="ALPHANUMERIC",r[r.STRUCTURED_APPEND=3]="STRUCTURED_APPEND",r[r.BYTE=4]="BYTE",r[r.ECI=5]="ECI",r[r.KANJI=6]="KANJI",r[r.FNC1_FIRST_POSITION=7]="FNC1_FIRST_POSITION",r[r.FNC1_SECOND_POSITION=8]="FNC1_SECOND_POSITION",r[r.HANZI=9]="HANZI"})(qe||(qe={}));var le=function(){function r(e,t,n,i){this.value=e,this.stringValue=t,this.characterCountBitsForVersions=n,this.bits=i,r.FOR_BITS.set(i,this),r.FOR_VALUE.set(e,this)}return r.forBits=function(e){var t=r.FOR_BITS.get(e);if(t===void 0)throw new $;return t},r.prototype.getCharacterCountBits=function(e){var t=e.getVersionNumber(),n;return t<=9?n=0:t<=26?n=1:n=2,this.characterCountBitsForVersions[n]},r.prototype.getValue=function(){return this.value},r.prototype.getBits=function(){return this.bits},r.prototype.equals=function(e){if(!(e instanceof r))return!1;var t=e;return this.value===t.value},r.prototype.toString=function(){return this.stringValue},r.FOR_BITS=new Map,r.FOR_VALUE=new Map,r.TERMINATOR=new r(qe.TERMINATOR,"TERMINATOR",Int32Array.from([0,0,0]),0),r.NUMERIC=new r(qe.NUMERIC,"NUMERIC",Int32Array.from([10,12,14]),1),r.ALPHANUMERIC=new r(qe.ALPHANUMERIC,"ALPHANUMERIC",Int32Array.from([9,11,13]),2),r.STRUCTURED_APPEND=new r(qe.STRUCTURED_APPEND,"STRUCTURED_APPEND",Int32Array.from([0,0,0]),3),r.BYTE=new r(qe.BYTE,"BYTE",Int32Array.from([8,16,16]),4),r.ECI=new r(qe.ECI,"ECI",Int32Array.from([0,0,0]),7),r.KANJI=new r(qe.KANJI,"KANJI",Int32Array.from([8,10,12]),8),r.FNC1_FIRST_POSITION=new r(qe.FNC1_FIRST_POSITION,"FNC1_FIRST_POSITION",Int32Array.from([0,0,0]),5),r.FNC1_SECOND_POSITION=new r(qe.FNC1_SECOND_POSITION,"FNC1_SECOND_POSITION",Int32Array.from([0,0,0]),9),r.HANZI=new r(qe.HANZI,"HANZI",Int32Array.from([8,10,12]),13),r}(),zf=function(){function r(){}return r.decode=function(e,t,n,i){var o=new Na(e),a=new q,s=new Array,l=-1,u=-1;try{var c=null,f=!1,h=void 0;do{if(o.available()<4)h=le.TERMINATOR;else{var v=o.readBits(4);h=le.forBits(v)}switch(h){case le.TERMINATOR:break;case le.FNC1_FIRST_POSITION:case le.FNC1_SECOND_POSITION:f=!0;break;case le.STRUCTURED_APPEND:if(o.available()<16)throw new k;l=o.readBits(8),u=o.readBits(8);break;case le.ECI:var p=r.parseECIValue(o);if(c=he.getCharacterSetECIByValue(p),c===null)throw new k;break;case le.HANZI:var g=o.readBits(4),m=o.readBits(h.getCharacterCountBits(t));g===r.GB2312_SUBSET&&r.decodeHanziSegment(o,a,m);break;default:var y=o.readBits(h.getCharacterCountBits(t));switch(h){case le.NUMERIC:r.decodeNumericSegment(o,a,y);break;case le.ALPHANUMERIC:r.decodeAlphanumericSegment(o,a,y,f);break;case le.BYTE:r.decodeByteSegment(o,a,y,c,s,i);break;case le.KANJI:r.decodeKanjiSegment(o,a,y);break;default:throw new k}break}}while(h!==le.TERMINATOR)}catch{throw new k}return new qr(e,a.toString(),s.length===0?null:s,n===null?null:n.toString(),l,u)},r.decodeHanziSegment=function(e,t,n){if(n*13>e.available())throw new k;for(var i=new Uint8Array(2*n),o=0;n>0;){var a=e.readBits(13),s=a/96<<8&4294967295|a%96;s<959?s+=41377:s+=42657,i[o]=s>>8&255,i[o+1]=s&255,o+=2,n--}try{t.append(je.decode(i,Z.GB2312))}catch(l){throw new k(l)}},r.decodeKanjiSegment=function(e,t,n){if(n*13>e.available())throw new k;for(var i=new Uint8Array(2*n),o=0;n>0;){var a=e.readBits(13),s=a/192<<8&4294967295|a%192;s<7936?s+=33088:s+=49472,i[o]=s>>8,i[o+1]=s,o+=2,n--}try{t.append(je.decode(i,Z.SHIFT_JIS))}catch(l){throw new k(l)}},r.decodeByteSegment=function(e,t,n,i,o,a){if(8*n>e.available())throw new k;for(var s=new Uint8Array(n),l=0;l<n;l++)s[l]=e.readBits(8);var u;i===null?u=Z.guessEncoding(s,a):u=i.getName();try{t.append(je.decode(s,u))}catch(c){throw new k(c)}o.push(s)},r.toAlphaNumericChar=function(e){if(e>=r.ALPHANUMERIC_CHARS.length)throw new k;return r.ALPHANUMERIC_CHARS[e]},r.decodeAlphanumericSegment=function(e,t,n,i){for(var o=t.length();n>1;){if(e.available()<11)throw new k;var a=e.readBits(11);t.append(r.toAlphaNumericChar(Math.floor(a/45))),t.append(r.toAlphaNumericChar(a%45)),n-=2}if(n===1){if(e.available()<6)throw new k;t.append(r.toAlphaNumericChar(e.readBits(6)))}if(i)for(var s=o;s<t.length();s++)t.charAt(s)==="%"&&(s<t.length()-1&&t.charAt(s+1)==="%"?t.deleteCharAt(s+1):t.setCharAt(s,""))},r.decodeNumericSegment=function(e,t,n){for(;n>=3;){if(e.available()<10)throw new k;var i=e.readBits(10);if(i>=1e3)throw new k;t.append(r.toAlphaNumericChar(Math.floor(i/100))),t.append(r.toAlphaNumericChar(Math.floor(i/10)%10)),t.append(r.toAlphaNumericChar(i%10)),n-=3}if(n===2){if(e.available()<7)throw new k;var o=e.readBits(7);if(o>=100)throw new k;t.append(r.toAlphaNumericChar(Math.floor(o/10))),t.append(r.toAlphaNumericChar(o%10))}else if(n===1){if(e.available()<4)throw new k;var a=e.readBits(4);if(a>=10)throw new k;t.append(r.toAlphaNumericChar(a))}},r.parseECIValue=function(e){var t=e.readBits(8);if((t&128)===0)return t&127;if((t&192)===128){var n=e.readBits(8);return(t&63)<<8&4294967295|n}if((t&224)===192){var i=e.readBits(16);return(t&31)<<16&4294967295|i}throw new k},r.ALPHANUMERIC_CHARS="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:",r.GB2312_SUBSET=1,r}(),Fa=function(){function r(e){this.mirrored=e}return r.prototype.isMirrored=function(){return this.mirrored},r.prototype.applyMirroredCorrection=function(e){if(!(!this.mirrored||e===null||e.length<3)){var t=e[0];e[0]=e[2],e[2]=t}},r}(),Ba=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.")},Uf=function(){function r(){this.rsDecoder=new Zr(Ve.QR_CODE_FIELD_256)}return r.prototype.decodeBooleanArray=function(e,t){return this.decodeBitMatrix(rt.parseFromBooleanArray(e),t)},r.prototype.decodeBitMatrix=function(e,t){var n=new Vf(e),i=null;try{return this.decodeBitMatrixParser(n,t)}catch(a){i=a}try{n.remask(),n.setMirror(!0),n.readVersion(),n.readFormatInformation(),n.mirror();var o=this.decodeBitMatrixParser(n,t);return o.setOther(new Fa(!0)),o}catch(a){throw i!==null?i:a}},r.prototype.decodeBitMatrixParser=function(e,t){var n,i,o,a,s=e.readVersion(),l=e.readFormatInformation().getErrorCorrectionLevel(),u=e.readCodewords(),c=kf.getDataBlocks(u,s,l),f=0;try{for(var h=Ba(c),v=h.next();!v.done;v=h.next()){var p=v.value;f+=p.getNumDataCodewords()}}catch(S){n={error:S}}finally{try{v&&!v.done&&(i=h.return)&&i.call(h)}finally{if(n)throw n.error}}var g=new Uint8Array(f),m=0;try{for(var y=Ba(c),C=y.next();!C.done;C=y.next()){var p=C.value,w=p.getCodewords(),E=p.getNumDataCodewords();this.correctErrors(w,E);for(var I=0;I<E;I++)g[m++]=w[I]}}catch(S){o={error:S}}finally{try{C&&!C.done&&(a=y.return)&&a.call(y)}finally{if(o)throw o.error}}return zf.decode(g,s,l,t)},r.prototype.correctErrors=function(e,t){var n=new Int32Array(e);try{this.rsDecoder.decode(n,e.length-t)}catch{throw new Ce}for(var i=0;i<t;i++)e[i]=n[i]},r}(),Hf=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)i.hasOwnProperty(o)&&(n[o]=i[o])},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)}}(),Gf=function(r){Hf(e,r);function e(t,n,i){var o=r.call(this,t,n)||this;return o.estimatedModuleSize=i,o}return e.prototype.aboutEquals=function(t,n,i){if(Math.abs(n-this.getY())<=t&&Math.abs(i-this.getX())<=t){var o=Math.abs(t-this.estimatedModuleSize);return o<=1||o<=this.estimatedModuleSize}return!1},e.prototype.combineEstimate=function(t,n,i){var o=(this.getX()+n)/2,a=(this.getY()+t)/2,s=(this.estimatedModuleSize+i)/2;return new e(o,a,s)},e}(X),Wf=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.")},Xf=function(){function r(e,t,n,i,o,a,s){this.image=e,this.startX=t,this.startY=n,this.width=i,this.height=o,this.moduleSize=a,this.resultPointCallback=s,this.possibleCenters=[],this.crossCheckStateCount=new Int32Array(3)}return r.prototype.find=function(){for(var e=this.startX,t=this.height,n=this.width,i=e+n,o=this.startY+t/2,a=new Int32Array(3),s=this.image,l=0;l<t;l++){var u=o+((l&1)===0?Math.floor((l+1)/2):-Math.floor((l+1)/2));a[0]=0,a[1]=0,a[2]=0;for(var c=e;c<i&&!s.get(c,u);)c++;for(var f=0;c<i;){if(s.get(c,u))if(f===1)a[1]++;else if(f===2){if(this.foundPatternCross(a)){var h=this.handlePossibleCenter(a,u,c);if(h!==null)return h}a[0]=a[2],a[1]=1,a[2]=0,f=1}else a[++f]++;else f===1&&f++,a[f]++;c++}if(this.foundPatternCross(a)){var h=this.handlePossibleCenter(a,u,i);if(h!==null)return h}}if(this.possibleCenters.length!==0)return this.possibleCenters[0];throw new D},r.centerFromEnd=function(e,t){return t-e[2]-e[1]/2},r.prototype.foundPatternCross=function(e){for(var t=this.moduleSize,n=t/2,i=0;i<3;i++)if(Math.abs(t-e[i])>=n)return!1;return!0},r.prototype.crossCheckVertical=function(e,t,n,i){var o=this.image,a=o.getHeight(),s=this.crossCheckStateCount;s[0]=0,s[1]=0,s[2]=0;for(var l=e;l>=0&&o.get(t,l)&&s[1]<=n;)s[1]++,l--;if(l<0||s[1]>n)return NaN;for(;l>=0&&!o.get(t,l)&&s[0]<=n;)s[0]++,l--;if(s[0]>n)return NaN;for(l=e+1;l<a&&o.get(t,l)&&s[1]<=n;)s[1]++,l++;if(l===a||s[1]>n)return NaN;for(;l<a&&!o.get(t,l)&&s[2]<=n;)s[2]++,l++;if(s[2]>n)return NaN;var u=s[0]+s[1]+s[2];return 5*Math.abs(u-i)>=2*i?NaN:this.foundPatternCross(s)?r.centerFromEnd(s,l):NaN},r.prototype.handlePossibleCenter=function(e,t,n){var i,o,a=e[0]+e[1]+e[2],s=r.centerFromEnd(e,n),l=this.crossCheckVertical(t,s,2*e[1],a);if(!isNaN(l)){var u=(e[0]+e[1]+e[2])/3;try{for(var c=Wf(this.possibleCenters),f=c.next();!f.done;f=c.next()){var h=f.value;if(h.aboutEquals(u,l,s))return h.combineEstimate(l,s,u)}}catch(p){i={error:p}}finally{try{f&&!f.done&&(o=c.return)&&o.call(c)}finally{if(i)throw i.error}}var v=new Gf(s,l,u);this.possibleCenters.push(v),this.resultPointCallback!==null&&this.resultPointCallback!==void 0&&this.resultPointCallback.foundPossibleResultPoint(v)}return null},r}(),$f=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)i.hasOwnProperty(o)&&(n[o]=i[o])},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)}}(),jf=function(r){$f(e,r);function e(t,n,i,o){var a=r.call(this,t,n)||this;return a.estimatedModuleSize=i,a.count=o,o===void 0&&(a.count=1),a}return e.prototype.getEstimatedModuleSize=function(){return this.estimatedModuleSize},e.prototype.getCount=function(){return this.count},e.prototype.aboutEquals=function(t,n,i){if(Math.abs(n-this.getY())<=t&&Math.abs(i-this.getX())<=t){var o=Math.abs(t-this.estimatedModuleSize);return o<=1||o<=this.estimatedModuleSize}return!1},e.prototype.combineEstimate=function(t,n,i){var o=this.count+1,a=(this.count*this.getX()+n)/o,s=(this.count*this.getY()+t)/o,l=(this.count*this.estimatedModuleSize+i)/o;return new e(a,s,l,o)},e}(X),qf=function(){function r(e){this.bottomLeft=e[0],this.topLeft=e[1],this.topRight=e[2]}return r.prototype.getBottomLeft=function(){return this.bottomLeft},r.prototype.getTopLeft=function(){return this.topLeft},r.prototype.getTopRight=function(){return this.topRight},r}(),cr=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.")},Yf=function(){function r(e,t){this.image=e,this.resultPointCallback=t,this.possibleCenters=[],this.crossCheckStateCount=new Int32Array(5),this.resultPointCallback=t}return r.prototype.getImage=function(){return this.image},r.prototype.getPossibleCenters=function(){return this.possibleCenters},r.prototype.find=function(e){var t=e!=null&&e.get(fe.TRY_HARDER)!==void 0,n=e!=null&&e.get(fe.PURE_BARCODE)!==void 0,i=this.image,o=i.getHeight(),a=i.getWidth(),s=Math.floor(3*o/(4*r.MAX_MODULES));(s<r.MIN_SKIP||t)&&(s=r.MIN_SKIP);for(var l=!1,u=new Int32Array(5),c=s-1;c<o&&!l;c+=s){u[0]=0,u[1]=0,u[2]=0,u[3]=0,u[4]=0;for(var f=0,h=0;h<a;h++)if(i.get(h,c))(f&1)===1&&f++,u[f]++;else if((f&1)===0)if(f===4)if(r.foundPatternCross(u)){var v=this.handlePossibleCenter(u,c,h,n);if(v===!0)if(s=2,this.hasSkipped===!0)l=this.haveMultiplyConfirmedCenters();else{var p=this.findRowSkip();p>u[2]&&(c+=p-u[2]-s,h=a-1)}else{u[0]=u[2],u[1]=u[3],u[2]=u[4],u[3]=1,u[4]=0,f=3;continue}f=0,u[0]=0,u[1]=0,u[2]=0,u[3]=0,u[4]=0}else u[0]=u[2],u[1]=u[3],u[2]=u[4],u[3]=1,u[4]=0,f=3;else u[++f]++;else u[f]++;if(r.foundPatternCross(u)){var v=this.handlePossibleCenter(u,c,a,n);v===!0&&(s=u[0],this.hasSkipped&&(l=this.haveMultiplyConfirmedCenters()))}}var g=this.selectBestPatterns();return X.orderBestPatterns(g),new qf(g)},r.centerFromEnd=function(e,t){return t-e[4]-e[3]-e[2]/2},r.foundPatternCross=function(e){for(var t=0,n=0;n<5;n++){var i=e[n];if(i===0)return!1;t+=i}if(t<7)return!1;var o=t/7,a=o/2;return Math.abs(o-e[0])<a&&Math.abs(o-e[1])<a&&Math.abs(3*o-e[2])<3*a&&Math.abs(o-e[3])<a&&Math.abs(o-e[4])<a},r.prototype.getCrossCheckStateCount=function(){var e=this.crossCheckStateCount;return e[0]=0,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e},r.prototype.crossCheckDiagonal=function(e,t,n,i){for(var o=this.getCrossCheckStateCount(),a=0,s=this.image;e>=a&&t>=a&&s.get(t-a,e-a);)o[2]++,a++;if(e<a||t<a)return!1;for(;e>=a&&t>=a&&!s.get(t-a,e-a)&&o[1]<=n;)o[1]++,a++;if(e<a||t<a||o[1]>n)return!1;for(;e>=a&&t>=a&&s.get(t-a,e-a)&&o[0]<=n;)o[0]++,a++;if(o[0]>n)return!1;var l=s.getHeight(),u=s.getWidth();for(a=1;e+a<l&&t+a<u&&s.get(t+a,e+a);)o[2]++,a++;if(e+a>=l||t+a>=u)return!1;for(;e+a<l&&t+a<u&&!s.get(t+a,e+a)&&o[3]<n;)o[3]++,a++;if(e+a>=l||t+a>=u||o[3]>=n)return!1;for(;e+a<l&&t+a<u&&s.get(t+a,e+a)&&o[4]<n;)o[4]++,a++;if(o[4]>=n)return!1;var c=o[0]+o[1]+o[2]+o[3]+o[4];return Math.abs(c-i)<2*i&&r.foundPatternCross(o)},r.prototype.crossCheckVertical=function(e,t,n,i){for(var o=this.image,a=o.getHeight(),s=this.getCrossCheckStateCount(),l=e;l>=0&&o.get(t,l);)s[2]++,l--;if(l<0)return NaN;for(;l>=0&&!o.get(t,l)&&s[1]<=n;)s[1]++,l--;if(l<0||s[1]>n)return NaN;for(;l>=0&&o.get(t,l)&&s[0]<=n;)s[0]++,l--;if(s[0]>n)return NaN;for(l=e+1;l<a&&o.get(t,l);)s[2]++,l++;if(l===a)return NaN;for(;l<a&&!o.get(t,l)&&s[3]<n;)s[3]++,l++;if(l===a||s[3]>=n)return NaN;for(;l<a&&o.get(t,l)&&s[4]<n;)s[4]++,l++;if(s[4]>=n)return NaN;var u=s[0]+s[1]+s[2]+s[3]+s[4];return 5*Math.abs(u-i)>=2*i?NaN:r.foundPatternCross(s)?r.centerFromEnd(s,l):NaN},r.prototype.crossCheckHorizontal=function(e,t,n,i){for(var o=this.image,a=o.getWidth(),s=this.getCrossCheckStateCount(),l=e;l>=0&&o.get(l,t);)s[2]++,l--;if(l<0)return NaN;for(;l>=0&&!o.get(l,t)&&s[1]<=n;)s[1]++,l--;if(l<0||s[1]>n)return NaN;for(;l>=0&&o.get(l,t)&&s[0]<=n;)s[0]++,l--;if(s[0]>n)return NaN;for(l=e+1;l<a&&o.get(l,t);)s[2]++,l++;if(l===a)return NaN;for(;l<a&&!o.get(l,t)&&s[3]<n;)s[3]++,l++;if(l===a||s[3]>=n)return NaN;for(;l<a&&o.get(l,t)&&s[4]<n;)s[4]++,l++;if(s[4]>=n)return NaN;var u=s[0]+s[1]+s[2]+s[3]+s[4];return 5*Math.abs(u-i)>=i?NaN:r.foundPatternCross(s)?r.centerFromEnd(s,l):NaN},r.prototype.handlePossibleCenter=function(e,t,n,i){var o=e[0]+e[1]+e[2]+e[3]+e[4],a=r.centerFromEnd(e,n),s=this.crossCheckVertical(t,Math.floor(a),e[2],o);if(!isNaN(s)&&(a=this.crossCheckHorizontal(Math.floor(a),Math.floor(s),e[2],o),!isNaN(a)&&(!i||this.crossCheckDiagonal(Math.floor(s),Math.floor(a),e[2],o)))){for(var l=o/7,u=!1,c=this.possibleCenters,f=0,h=c.length;f<h;f++){var v=c[f];if(v.aboutEquals(l,s,a)){c[f]=v.combineEstimate(s,a,l),u=!0;break}}if(!u){var p=new jf(a,s,l);c.push(p),this.resultPointCallback!==null&&this.resultPointCallback!==void 0&&this.resultPointCallback.foundPossibleResultPoint(p)}return!0}return!1},r.prototype.findRowSkip=function(){var e,t,n=this.possibleCenters.length;if(n<=1)return 0;var i=null;try{for(var o=cr(this.possibleCenters),a=o.next();!a.done;a=o.next()){var s=a.value;if(s.getCount()>=r.CENTER_QUORUM)if(i==null)i=s;else return this.hasSkipped=!0,Math.floor((Math.abs(i.getX()-s.getX())-Math.abs(i.getY()-s.getY()))/2)}}catch(l){e={error:l}}finally{try{a&&!a.done&&(t=o.return)&&t.call(o)}finally{if(e)throw e.error}}return 0},r.prototype.haveMultiplyConfirmedCenters=function(){var e,t,n,i,o=0,a=0,s=this.possibleCenters.length;try{for(var l=cr(this.possibleCenters),u=l.next();!u.done;u=l.next()){var c=u.value;c.getCount()>=r.CENTER_QUORUM&&(o++,a+=c.getEstimatedModuleSize())}}catch(g){e={error:g}}finally{try{u&&!u.done&&(t=l.return)&&t.call(l)}finally{if(e)throw e.error}}if(o<3)return!1;var f=a/s,h=0;try{for(var v=cr(this.possibleCenters),p=v.next();!p.done;p=v.next()){var c=p.value;h+=Math.abs(c.getEstimatedModuleSize()-f)}}catch(g){n={error:g}}finally{try{p&&!p.done&&(i=v.return)&&i.call(v)}finally{if(n)throw n.error}}return h<=.05*a},r.prototype.selectBestPatterns=function(){var e,t,n,i,o=this.possibleCenters.length;if(o<3)throw new D;var a=this.possibleCenters,s;if(o>3){var l=0,u=0;try{for(var c=cr(this.possibleCenters),f=c.next();!f.done;f=c.next()){var h=f.value,v=h.getEstimatedModuleSize();l+=v,u+=v*v}}catch(I){e={error:I}}finally{try{f&&!f.done&&(t=c.return)&&t.call(c)}finally{if(e)throw e.error}}s=l/o;var p=Math.sqrt(u/o-s*s);a.sort(function(I,S){var b=Math.abs(S.getEstimatedModuleSize()-s),P=Math.abs(I.getEstimatedModuleSize()-s);return b<P?-1:b>P?1:0});for(var g=Math.max(.2*s,p),m=0;m<a.length&&a.length>3;m++){var y=a[m];Math.abs(y.getEstimatedModuleSize()-s)>g&&(a.splice(m,1),m--)}}if(a.length>3){var l=0;try{for(var C=cr(a),w=C.next();!w.done;w=C.next()){var E=w.value;l+=E.getEstimatedModuleSize()}}catch(S){n={error:S}}finally{try{w&&!w.done&&(i=C.return)&&i.call(C)}finally{if(n)throw n.error}}s=l/a.length,a.sort(function(S,b){if(b.getCount()===S.getCount()){var P=Math.abs(b.getEstimatedModuleSize()-s),L=Math.abs(S.getEstimatedModuleSize()-s);return P<L?1:P>L?-1:0}else return b.getCount()-S.getCount()}),a.splice(3)}return[a[0],a[1],a[2]]},r.CENTER_QUORUM=2,r.MIN_SKIP=3,r.MAX_MODULES=57,r}(),Zf=function(){function r(e){this.image=e}return r.prototype.getImage=function(){return this.image},r.prototype.getResultPointCallback=function(){return this.resultPointCallback},r.prototype.detect=function(e){this.resultPointCallback=e==null?null:e.get(fe.NEED_RESULT_POINT_CALLBACK);var t=new Yf(this.image,this.resultPointCallback),n=t.find(e);return this.processFinderPatternInfo(n)},r.prototype.processFinderPatternInfo=function(e){var t=e.getTopLeft(),n=e.getTopRight(),i=e.getBottomLeft(),o=this.calculateModuleSize(t,n,i);if(o<1)throw new D("No pattern found in proccess finder.");var a=r.computeDimension(t,n,i,o),s=St.getProvisionalVersionForDimension(a),l=s.getDimensionForVersion()-7,u=null;if(s.getAlignmentPatternCenters().length>0)for(var c=n.getX()-t.getX()+i.getX(),f=n.getY()-t.getY()+i.getY(),h=1-3/l,v=Math.floor(t.getX()+h*(c-t.getX())),p=Math.floor(t.getY()+h*(f-t.getY())),g=4;g<=16;g<<=1)try{u=this.findAlignmentInRegion(o,v,p,g);break}catch(w){if(!(w instanceof D))throw w}var m=r.createTransform(t,n,i,u,a),y=r.sampleGrid(this.image,m,a),C;return u===null?C=[i,t,n]:C=[i,t,n,u],new ii(y,C)},r.createTransform=function(e,t,n,i,o){var a=o-3.5,s,l,u,c;return i!==null?(s=i.getX(),l=i.getY(),u=a-3,c=u):(s=t.getX()-e.getX()+n.getX(),l=t.getY()-e.getY()+n.getY(),u=a,c=a),da.quadrilateralToQuadrilateral(3.5,3.5,a,3.5,u,c,3.5,a,e.getX(),e.getY(),t.getX(),t.getY(),s,l,n.getX(),n.getY())},r.sampleGrid=function(e,t,n){var i=ai.getInstance();return i.sampleGridWithTransform(e,n,n,t)},r.computeDimension=function(e,t,n,i){var o=Q.round(X.distance(e,t)/i),a=Q.round(X.distance(e,n)/i),s=Math.floor((o+a)/2)+7;switch(s&3){case 0:s++;break;case 2:s--;break;case 3:throw new D("Dimensions could be not found.")}return s},r.prototype.calculateModuleSize=function(e,t,n){return(this.calculateModuleSizeOneWay(e,t)+this.calculateModuleSizeOneWay(e,n))/2},r.prototype.calculateModuleSizeOneWay=function(e,t){var n=this.sizeOfBlackWhiteBlackRunBothWays(Math.floor(e.getX()),Math.floor(e.getY()),Math.floor(t.getX()),Math.floor(t.getY())),i=this.sizeOfBlackWhiteBlackRunBothWays(Math.floor(t.getX()),Math.floor(t.getY()),Math.floor(e.getX()),Math.floor(e.getY()));return isNaN(n)?i/7:isNaN(i)?n/7:(n+i)/14},r.prototype.sizeOfBlackWhiteBlackRunBothWays=function(e,t,n,i){var o=this.sizeOfBlackWhiteBlackRun(e,t,n,i),a=1,s=e-(n-e);s<0?(a=e/(e-s),s=0):s>=this.image.getWidth()&&(a=(this.image.getWidth()-1-e)/(s-e),s=this.image.getWidth()-1);var l=Math.floor(t-(i-t)*a);return a=1,l<0?(a=t/(t-l),l=0):l>=this.image.getHeight()&&(a=(this.image.getHeight()-1-t)/(l-t),l=this.image.getHeight()-1),s=Math.floor(e+(s-e)*a),o+=this.sizeOfBlackWhiteBlackRun(e,t,s,l),o-1},r.prototype.sizeOfBlackWhiteBlackRun=function(e,t,n,i){var o=Math.abs(i-t)>Math.abs(n-e);if(o){var a=e;e=t,t=a,a=n,n=i,i=a}for(var s=Math.abs(n-e),l=Math.abs(i-t),u=-s/2,c=e<n?1:-1,f=t<i?1:-1,h=0,v=n+c,p=e,g=t;p!==v;p+=c){var m=o?g:p,y=o?p:g;if(h===1===this.image.get(m,y)){if(h===2)return Q.distance(p,g,e,t);h++}if(u+=l,u>0){if(g===i)break;g+=f,u-=s}}return h===2?Q.distance(n+c,i,e,t):NaN},r.prototype.findAlignmentInRegion=function(e,t,n,i){var o=Math.floor(i*e),a=Math.max(0,t-o),s=Math.min(this.image.getWidth()-1,t+o);if(s-a<e*3)throw new D("Alignment top exceeds estimated module size.");var l=Math.max(0,n-o),u=Math.min(this.image.getHeight()-1,n+o);if(u-l<e*3)throw new D("Alignment bottom exceeds estimated module size.");var c=new Xf(this.image,a,l,s-a,u-l,e,this.resultPointCallback);return c.find()},r}(),pi=function(){function r(){this.decoder=new Uf}return r.prototype.getDecoder=function(){return this.decoder},r.prototype.decode=function(e,t){var n,i;if(t!=null&&t.get(fe.PURE_BARCODE)!==void 0){var o=r.extractPureBits(e.getBlackMatrix());n=this.decoder.decodeBitMatrix(o,t),i=r.NO_POINTS}else{var a=new Zf(e.getBlackMatrix()).detect(t);n=this.decoder.decodeBitMatrix(a.getBits(),t),i=a.getPoints()}n.getOther()instanceof Fa&&n.getOther().applyMirroredCorrection(i);var s=new Oe(n.getText(),n.getRawBytes(),void 0,i,H.QR_CODE,void 0),l=n.getByteSegments();l!==null&&s.putMetadata(Ie.BYTE_SEGMENTS,l);var u=n.getECLevel();return u!==null&&s.putMetadata(Ie.ERROR_CORRECTION_LEVEL,u),n.hasStructuredAppend()&&(s.putMetadata(Ie.STRUCTURED_APPEND_SEQUENCE,n.getStructuredAppendSequenceNumber()),s.putMetadata(Ie.STRUCTURED_APPEND_PARITY,n.getStructuredAppendParity())),s},r.prototype.reset=function(){},r.extractPureBits=function(e){var t=e.getTopLeftOnBit(),n=e.getBottomRightOnBit();if(t===null||n===null)throw new D;var i=this.moduleSize(t,e),o=t[1],a=n[1],s=t[0],l=n[0];if(s>=l||o>=a)throw new D;if(a-o!==l-s&&(l=s+(a-o),l>=e.getWidth()))throw new D;var u=Math.round((l-s+1)/i),c=Math.round((a-o+1)/i);if(u<=0||c<=0)throw new D;if(c!==u)throw new D;var f=Math.floor(i/2);o+=f,s+=f;var h=s+Math.floor((u-1)*i)-l;if(h>0){if(h>f)throw new D;s-=h}var v=o+Math.floor((c-1)*i)-a;if(v>0){if(v>f)throw new D;o-=v}for(var p=new rt(u,c),g=0;g<c;g++)for(var m=o+Math.floor(g*i),y=0;y<u;y++)e.get(s+Math.floor(y*i),m)&&p.set(y,g);return p},r.moduleSize=function(e,t){for(var n=t.getHeight(),i=t.getWidth(),o=e[0],a=e[1],s=!0,l=0;o<i&&a<n;){if(s!==t.get(o,a)){if(++l===5)break;s=!s}o++,a++}if(o===i||a===n)throw new D;return(o-e[0])/7},r.NO_POINTS=new Array,r}(),Kf=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.")},K=function(){function r(){}return r.prototype.PDF417Common=function(){},r.getBitCountSum=function(e){return Q.sum(e)},r.toIntArray=function(e){var t,n;if(e==null||!e.length)return r.EMPTY_INT_ARRAY;var i=new Int32Array(e.length),o=0;try{for(var a=Kf(e),s=a.next();!s.done;s=a.next()){var l=s.value;i[o++]=l}}catch(u){t={error:u}}finally{try{s&&!s.done&&(n=a.return)&&n.call(a)}finally{if(t)throw t.error}}return i},r.getCodeword=function(e){var t=de.binarySearch(r.SYMBOL_TABLE,e&262143);return t<0?-1:(r.CODEWORD_TABLE[t]-1)%r.NUMBER_OF_CODEWORDS},r.NUMBER_OF_CODEWORDS=929,r.MAX_CODEWORDS_IN_BARCODE=r.NUMBER_OF_CODEWORDS-1,r.MIN_ROWS_IN_BARCODE=3,r.MAX_ROWS_IN_BARCODE=90,r.MODULES_IN_CODEWORD=17,r.MODULES_IN_STOP_PATTERN=18,r.BARS_IN_MODULE=8,r.EMPTY_INT_ARRAY=new Int32Array([]),r.SYMBOL_TABLE=Int32Array.from([66142,66170,66206,66236,66290,66292,66350,66382,66396,66454,66470,66476,66594,66600,66614,66626,66628,66632,66640,66654,66662,66668,66682,66690,66718,66720,66748,66758,66776,66798,66802,66804,66820,66824,66832,66846,66848,66876,66880,66936,66950,66956,66968,66992,67006,67022,67036,67042,67044,67048,67062,67118,67150,67164,67214,67228,67256,67294,67322,67350,67366,67372,67398,67404,67416,67438,67474,67476,67490,67492,67496,67510,67618,67624,67650,67656,67664,67678,67686,67692,67706,67714,67716,67728,67742,67744,67772,67782,67788,67800,67822,67826,67828,67842,67848,67870,67872,67900,67904,67960,67974,67992,68016,68030,68046,68060,68066,68068,68072,68086,68104,68112,68126,68128,68156,68160,68216,68336,68358,68364,68376,68400,68414,68448,68476,68494,68508,68536,68546,68548,68552,68560,68574,68582,68588,68654,68686,68700,68706,68708,68712,68726,68750,68764,68792,68802,68804,68808,68816,68830,68838,68844,68858,68878,68892,68920,68976,68990,68994,68996,69e3,69008,69022,69024,69052,69062,69068,69080,69102,69106,69108,69142,69158,69164,69190,69208,69230,69254,69260,69272,69296,69310,69326,69340,69386,69394,69396,69410,69416,69430,69442,69444,69448,69456,69470,69478,69484,69554,69556,69666,69672,69698,69704,69712,69726,69754,69762,69764,69776,69790,69792,69820,69830,69836,69848,69870,69874,69876,69890,69918,69920,69948,69952,70008,70022,70040,70064,70078,70094,70108,70114,70116,70120,70134,70152,70174,70176,70264,70384,70412,70448,70462,70496,70524,70542,70556,70584,70594,70600,70608,70622,70630,70636,70664,70672,70686,70688,70716,70720,70776,70896,71136,71180,71192,71216,71230,71264,71292,71360,71416,71452,71480,71536,71550,71554,71556,71560,71568,71582,71584,71612,71622,71628,71640,71662,71726,71732,71758,71772,71778,71780,71784,71798,71822,71836,71864,71874,71880,71888,71902,71910,71916,71930,71950,71964,71992,72048,72062,72066,72068,72080,72094,72096,72124,72134,72140,72152,72174,72178,72180,72206,72220,72248,72304,72318,72416,72444,72456,72464,72478,72480,72508,72512,72568,72588,72600,72624,72638,72654,72668,72674,72676,72680,72694,72726,72742,72748,72774,72780,72792,72814,72838,72856,72880,72894,72910,72924,72930,72932,72936,72950,72966,72972,72984,73008,73022,73056,73084,73102,73116,73144,73156,73160,73168,73182,73190,73196,73210,73226,73234,73236,73250,73252,73256,73270,73282,73284,73296,73310,73318,73324,73346,73348,73352,73360,73374,73376,73404,73414,73420,73432,73454,73498,73518,73522,73524,73550,73564,73570,73572,73576,73590,73800,73822,73858,73860,73872,73886,73888,73916,73944,73970,73972,73992,74014,74016,74044,74048,74104,74118,74136,74160,74174,74210,74212,74216,74230,74244,74256,74270,74272,74360,74480,74502,74508,74544,74558,74592,74620,74638,74652,74680,74690,74696,74704,74726,74732,74782,74784,74812,74992,75232,75288,75326,75360,75388,75456,75512,75576,75632,75646,75650,75652,75664,75678,75680,75708,75718,75724,75736,75758,75808,75836,75840,75896,76016,76256,76736,76824,76848,76862,76896,76924,76992,77048,77296,77340,77368,77424,77438,77536,77564,77572,77576,77584,77600,77628,77632,77688,77702,77708,77720,77744,77758,77774,77788,77870,77902,77916,77922,77928,77966,77980,78008,78018,78024,78032,78046,78060,78074,78094,78136,78192,78206,78210,78212,78224,78238,78240,78268,78278,78284,78296,78322,78324,78350,78364,78448,78462,78560,78588,78600,78622,78624,78652,78656,78712,78726,78744,78768,78782,78798,78812,78818,78820,78824,78838,78862,78876,78904,78960,78974,79072,79100,79296,79352,79368,79376,79390,79392,79420,79424,79480,79600,79628,79640,79664,79678,79712,79740,79772,79800,79810,79812,79816,79824,79838,79846,79852,79894,79910,79916,79942,79948,79960,79982,79988,80006,80024,80048,80062,80078,80092,80098,80100,80104,80134,80140,80176,80190,80224,80252,80270,80284,80312,80328,80336,80350,80358,80364,80378,80390,80396,80408,80432,80446,80480,80508,80576,80632,80654,80668,80696,80752,80766,80776,80784,80798,80800,80828,80844,80856,80878,80882,80884,80914,80916,80930,80932,80936,80950,80962,80968,80976,80990,80998,81004,81026,81028,81040,81054,81056,81084,81094,81100,81112,81134,81154,81156,81160,81168,81182,81184,81212,81216,81272,81286,81292,81304,81328,81342,81358,81372,81380,81384,81398,81434,81454,81458,81460,81486,81500,81506,81508,81512,81526,81550,81564,81592,81602,81604,81608,81616,81630,81638,81644,81702,81708,81722,81734,81740,81752,81774,81778,81780,82050,82078,82080,82108,82180,82184,82192,82206,82208,82236,82240,82296,82316,82328,82352,82366,82402,82404,82408,82440,82448,82462,82464,82492,82496,82552,82672,82694,82700,82712,82736,82750,82784,82812,82830,82882,82884,82888,82896,82918,82924,82952,82960,82974,82976,83004,83008,83064,83184,83424,83468,83480,83504,83518,83552,83580,83648,83704,83740,83768,83824,83838,83842,83844,83848,83856,83872,83900,83910,83916,83928,83950,83984,84e3,84028,84032,84088,84208,84448,84928,85040,85054,85088,85116,85184,85240,85488,85560,85616,85630,85728,85756,85764,85768,85776,85790,85792,85820,85824,85880,85894,85900,85912,85936,85966,85980,86048,86080,86136,86256,86496,86976,88160,88188,88256,88312,88560,89056,89200,89214,89312,89340,89536,89592,89608,89616,89632,89664,89720,89840,89868,89880,89904,89952,89980,89998,90012,90040,90190,90204,90254,90268,90296,90306,90308,90312,90334,90382,90396,90424,90480,90494,90500,90504,90512,90526,90528,90556,90566,90572,90584,90610,90612,90638,90652,90680,90736,90750,90848,90876,90884,90888,90896,90910,90912,90940,90944,91e3,91014,91020,91032,91056,91070,91086,91100,91106,91108,91112,91126,91150,91164,91192,91248,91262,91360,91388,91584,91640,91664,91678,91680,91708,91712,91768,91888,91928,91952,91966,92e3,92028,92046,92060,92088,92098,92100,92104,92112,92126,92134,92140,92188,92216,92272,92384,92412,92608,92664,93168,93200,93214,93216,93244,93248,93304,93424,93664,93720,93744,93758,93792,93820,93888,93944,93980,94008,94064,94078,94084,94088,94096,94110,94112,94140,94150,94156,94168,94246,94252,94278,94284,94296,94318,94342,94348,94360,94384,94398,94414,94428,94440,94470,94476,94488,94512,94526,94560,94588,94606,94620,94648,94658,94660,94664,94672,94686,94694,94700,94714,94726,94732,94744,94768,94782,94816,94844,94912,94968,94990,95004,95032,95088,95102,95112,95120,95134,95136,95164,95180,95192,95214,95218,95220,95244,95256,95280,95294,95328,95356,95424,95480,95728,95758,95772,95800,95856,95870,95968,95996,96008,96016,96030,96032,96060,96064,96120,96152,96176,96190,96220,96226,96228,96232,96290,96292,96296,96310,96322,96324,96328,96336,96350,96358,96364,96386,96388,96392,96400,96414,96416,96444,96454,96460,96472,96494,96498,96500,96514,96516,96520,96528,96542,96544,96572,96576,96632,96646,96652,96664,96688,96702,96718,96732,96738,96740,96744,96758,96772,96776,96784,96798,96800,96828,96832,96888,97008,97030,97036,97048,97072,97086,97120,97148,97166,97180,97208,97220,97224,97232,97246,97254,97260,97326,97330,97332,97358,97372,97378,97380,97384,97398,97422,97436,97464,97474,97476,97480,97488,97502,97510,97516,97550,97564,97592,97648,97666,97668,97672,97680,97694,97696,97724,97734,97740,97752,97774,97830,97836,97850,97862,97868,97880,97902,97906,97908,97926,97932,97944,97968,97998,98012,98018,98020,98024,98038,98618,98674,98676,98838,98854,98874,98892,98904,98926,98930,98932,98968,99006,99042,99044,99048,99062,99166,99194,99246,99286,99350,99366,99372,99386,99398,99416,99438,99442,99444,99462,99504,99518,99534,99548,99554,99556,99560,99574,99590,99596,99608,99632,99646,99680,99708,99726,99740,99768,99778,99780,99784,99792,99806,99814,99820,99834,99858,99860,99874,99880,99894,99906,99920,99934,99962,99970,99972,99976,99984,99998,1e5,100028,100038,100044,100056,100078,100082,100084,100142,100174,100188,100246,100262,100268,100306,100308,100390,100396,100410,100422,100428,100440,100462,100466,100468,100486,100504,100528,100542,100558,100572,100578,100580,100584,100598,100620,100656,100670,100704,100732,100750,100792,100802,100808,100816,100830,100838,100844,100858,100888,100912,100926,100960,100988,101056,101112,101148,101176,101232,101246,101250,101252,101256,101264,101278,101280,101308,101318,101324,101336,101358,101362,101364,101410,101412,101416,101430,101442,101448,101456,101470,101478,101498,101506,101508,101520,101534,101536,101564,101580,101618,101620,101636,101640,101648,101662,101664,101692,101696,101752,101766,101784,101838,101858,101860,101864,101934,101938,101940,101966,101980,101986,101988,101992,102030,102044,102072,102082,102084,102088,102096,102138,102166,102182,102188,102214,102220,102232,102254,102282,102290,102292,102306,102308,102312,102326,102444,102458,102470,102476,102488,102514,102516,102534,102552,102576,102590,102606,102620,102626,102632,102646,102662,102668,102704,102718,102752,102780,102798,102812,102840,102850,102856,102864,102878,102886,102892,102906,102936,102974,103008,103036,103104,103160,103224,103280,103294,103298,103300,103312,103326,103328,103356,103366,103372,103384,103406,103410,103412,103472,103486,103520,103548,103616,103672,103920,103992,104048,104062,104160,104188,104194,104196,104200,104208,104224,104252,104256,104312,104326,104332,104344,104368,104382,104398,104412,104418,104420,104424,104482,104484,104514,104520,104528,104542,104550,104570,104578,104580,104592,104606,104608,104636,104652,104690,104692,104706,104712,104734,104736,104764,104768,104824,104838,104856,104910,104930,104932,104936,104968,104976,104990,104992,105020,105024,105080,105200,105240,105278,105312,105372,105410,105412,105416,105424,105446,105518,105524,105550,105564,105570,105572,105576,105614,105628,105656,105666,105672,105680,105702,105722,105742,105756,105784,105840,105854,105858,105860,105864,105872,105888,105932,105970,105972,106006,106022,106028,106054,106060,106072,106100,106118,106124,106136,106160,106174,106190,106210,106212,106216,106250,106258,106260,106274,106276,106280,106306,106308,106312,106320,106334,106348,106394,106414,106418,106420,106566,106572,106610,106612,106630,106636,106648,106672,106686,106722,106724,106728,106742,106758,106764,106776,106800,106814,106848,106876,106894,106908,106936,106946,106948,106952,106960,106974,106982,106988,107032,107056,107070,107104,107132,107200,107256,107292,107320,107376,107390,107394,107396,107400,107408,107422,107424,107452,107462,107468,107480,107502,107506,107508,107544,107568,107582,107616,107644,107712,107768,108016,108060,108088,108144,108158,108256,108284,108290,108292,108296,108304,108318,108320,108348,108352,108408,108422,108428,108440,108464,108478,108494,108508,108514,108516,108520,108592,108640,108668,108736,108792,109040,109536,109680,109694,109792,109820,110016,110072,110084,110088,110096,110112,110140,110144,110200,110320,110342,110348,110360,110384,110398,110432,110460,110478,110492,110520,110532,110536,110544,110558,110658,110686,110714,110722,110724,110728,110736,110750,110752,110780,110796,110834,110836,110850,110852,110856,110864,110878,110880,110908,110912,110968,110982,111e3,111054,111074,111076,111080,111108,111112,111120,111134,111136,111164,111168,111224,111344,111372,111422,111456,111516,111554,111556,111560,111568,111590,111632,111646,111648,111676,111680,111736,111856,112096,112152,112224,112252,112320,112440,112514,112516,112520,112528,112542,112544,112588,112686,112718,112732,112782,112796,112824,112834,112836,112840,112848,112870,112890,112910,112924,112952,113008,113022,113026,113028,113032,113040,113054,113056,113100,113138,113140,113166,113180,113208,113264,113278,113376,113404,113416,113424,113440,113468,113472,113560,113614,113634,113636,113640,113686,113702,113708,113734,113740,113752,113778,113780,113798,113804,113816,113840,113854,113870,113890,113892,113896,113926,113932,113944,113968,113982,114016,114044,114076,114114,114116,114120,114128,114150,114170,114194,114196,114210,114212,114216,114242,114244,114248,114256,114270,114278,114306,114308,114312,114320,114334,114336,114364,114380,114420,114458,114478,114482,114484,114510,114524,114530,114532,114536,114842,114866,114868,114970,114994,114996,115042,115044,115048,115062,115130,115226,115250,115252,115278,115292,115298,115300,115304,115318,115342,115394,115396,115400,115408,115422,115430,115436,115450,115478,115494,115514,115526,115532,115570,115572,115738,115758,115762,115764,115790,115804,115810,115812,115816,115830,115854,115868,115896,115906,115912,115920,115934,115942,115948,115962,115996,116024,116080,116094,116098,116100,116104,116112,116126,116128,116156,116166,116172,116184,116206,116210,116212,116246,116262,116268,116282,116294,116300,116312,116334,116338,116340,116358,116364,116376,116400,116414,116430,116444,116450,116452,116456,116498,116500,116514,116520,116534,116546,116548,116552,116560,116574,116582,116588,116602,116654,116694,116714,116762,116782,116786,116788,116814,116828,116834,116836,116840,116854,116878,116892,116920,116930,116936,116944,116958,116966,116972,116986,117006,117048,117104,117118,117122,117124,117136,117150,117152,117180,117190,117196,117208,117230,117234,117236,117304,117360,117374,117472,117500,117506,117508,117512,117520,117536,117564,117568,117624,117638,117644,117656,117680,117694,117710,117724,117730,117732,117736,117750,117782,117798,117804,117818,117830,117848,117874,117876,117894,117936,117950,117966,117986,117988,117992,118022,118028,118040,118064,118078,118112,118140,118172,118210,118212,118216,118224,118238,118246,118266,118306,118312,118338,118352,118366,118374,118394,118402,118404,118408,118416,118430,118432,118460,118476,118514,118516,118574,118578,118580,118606,118620,118626,118628,118632,118678,118694,118700,118730,118738,118740,118830,118834,118836,118862,118876,118882,118884,118888,118902,118926,118940,118968,118978,118980,118984,118992,119006,119014,119020,119034,119068,119096,119152,119166,119170,119172,119176,119184,119198,119200,119228,119238,119244,119256,119278,119282,119284,119324,119352,119408,119422,119520,119548,119554,119556,119560,119568,119582,119584,119612,119616,119672,119686,119692,119704,119728,119742,119758,119772,119778,119780,119784,119798,119920,119934,120032,120060,120256,120312,120324,120328,120336,120352,120384,120440,120560,120582,120588,120600,120624,120638,120672,120700,120718,120732,120760,120770,120772,120776,120784,120798,120806,120812,120870,120876,120890,120902,120908,120920,120946,120948,120966,120972,120984,121008,121022,121038,121058,121060,121064,121078,121100,121112,121136,121150,121184,121212,121244,121282,121284,121288,121296,121318,121338,121356,121368,121392,121406,121440,121468,121536,121592,121656,121730,121732,121736,121744,121758,121760,121804,121842,121844,121890,121922,121924,121928,121936,121950,121958,121978,121986,121988,121992,122e3,122014,122016,122044,122060,122098,122100,122116,122120,122128,122142,122144,122172,122176,122232,122246,122264,122318,122338,122340,122344,122414,122418,122420,122446,122460,122466,122468,122472,122510,122524,122552,122562,122564,122568,122576,122598,122618,122646,122662,122668,122694,122700,122712,122738,122740,122762,122770,122772,122786,122788,122792,123018,123026,123028,123042,123044,123048,123062,123098,123146,123154,123156,123170,123172,123176,123190,123202,123204,123208,123216,123238,123244,123258,123290,123314,123316,123402,123410,123412,123426,123428,123432,123446,123458,123464,123472,123486,123494,123500,123514,123522,123524,123528,123536,123552,123580,123590,123596,123608,123630,123634,123636,123674,123698,123700,123740,123746,123748,123752,123834,123914,123922,123924,123938,123944,123958,123970,123976,123984,123998,124006,124012,124026,124034,124036,124048,124062,124064,124092,124102,124108,124120,124142,124146,124148,124162,124164,124168,124176,124190,124192,124220,124224,124280,124294,124300,124312,124336,124350,124366,124380,124386,124388,124392,124406,124442,124462,124466,124468,124494,124508,124514,124520,124558,124572,124600,124610,124612,124616,124624,124646,124666,124694,124710,124716,124730,124742,124748,124760,124786,124788,124818,124820,124834,124836,124840,124854,124946,124948,124962,124964,124968,124982,124994,124996,125e3,125008,125022,125030,125036,125050,125058,125060,125064,125072,125086,125088,125116,125126,125132,125144,125166,125170,125172,125186,125188,125192,125200,125216,125244,125248,125304,125318,125324,125336,125360,125374,125390,125404,125410,125412,125416,125430,125444,125448,125456,125472,125504,125560,125680,125702,125708,125720,125744,125758,125792,125820,125838,125852,125880,125890,125892,125896,125904,125918,125926,125932,125978,125998,126002,126004,126030,126044,126050,126052,126056,126094,126108,126136,126146,126148,126152,126160,126182,126202,126222,126236,126264,126320,126334,126338,126340,126344,126352,126366,126368,126412,126450,126452,126486,126502,126508,126522,126534,126540,126552,126574,126578,126580,126598,126604,126616,126640,126654,126670,126684,126690,126692,126696,126738,126754,126756,126760,126774,126786,126788,126792,126800,126814,126822,126828,126842,126894,126898,126900,126934,127126,127142,127148,127162,127178,127186,127188,127254,127270,127276,127290,127302,127308,127320,127342,127346,127348,127370,127378,127380,127394,127396,127400,127450,127510,127526,127532,127546,127558,127576,127598,127602,127604,127622,127628,127640,127664,127678,127694,127708,127714,127716,127720,127734,127754,127762,127764,127778,127784,127810,127812,127816,127824,127838,127846,127866,127898,127918,127922,127924,128022,128038,128044,128058,128070,128076,128088,128110,128114,128116,128134,128140,128152,128176,128190,128206,128220,128226,128228,128232,128246,128262,128268,128280,128304,128318,128352,128380,128398,128412,128440,128450,128452,128456,128464,128478,128486,128492,128506,128522,128530,128532,128546,128548,128552,128566,128578,128580,128584,128592,128606,128614,128634,128642,128644,128648,128656,128670,128672,128700,128716,128754,128756,128794,128814,128818,128820,128846,128860,128866,128868,128872,128886,128918,128934,128940,128954,128978,128980,129178,129198,129202,129204,129238,129258,129306,129326,129330,129332,129358,129372,129378,129380,129384,129398,129430,129446,129452,129466,129482,129490,129492,129562,129582,129586,129588,129614,129628,129634,129636,129640,129654,129678,129692,129720,129730,129732,129736,129744,129758,129766,129772,129814,129830,129836,129850,129862,129868,129880,129902,129906,129908,129930,129938,129940,129954,129956,129960,129974,130010]),r.CODEWORD_TABLE=Int32Array.from([2627,1819,2622,2621,1813,1812,2729,2724,2723,2779,2774,2773,902,896,908,868,865,861,859,2511,873,871,1780,835,2493,825,2491,842,837,844,1764,1762,811,810,809,2483,807,2482,806,2480,815,814,813,812,2484,817,816,1745,1744,1742,1746,2655,2637,2635,2626,2625,2623,2628,1820,2752,2739,2737,2728,2727,2725,2730,2785,2783,2778,2777,2775,2780,787,781,747,739,736,2413,754,752,1719,692,689,681,2371,678,2369,700,697,694,703,1688,1686,642,638,2343,631,2341,627,2338,651,646,643,2345,654,652,1652,1650,1647,1654,601,599,2322,596,2321,594,2319,2317,611,610,608,606,2324,603,2323,615,614,612,1617,1616,1614,1612,616,1619,1618,2575,2538,2536,905,901,898,909,2509,2507,2504,870,867,864,860,2512,875,872,1781,2490,2489,2487,2485,1748,836,834,832,830,2494,827,2492,843,841,839,845,1765,1763,2701,2676,2674,2653,2648,2656,2634,2633,2631,2629,1821,2638,2636,2770,2763,2761,2750,2745,2753,2736,2735,2733,2731,1848,2740,2738,2786,2784,591,588,576,569,566,2296,1590,537,534,526,2276,522,2274,545,542,539,548,1572,1570,481,2245,466,2242,462,2239,492,485,482,2249,496,494,1534,1531,1528,1538,413,2196,406,2191,2188,425,419,2202,415,2199,432,430,427,1472,1467,1464,433,1476,1474,368,367,2160,365,2159,362,2157,2155,2152,378,377,375,2166,372,2165,369,2162,383,381,379,2168,1419,1418,1416,1414,385,1411,384,1423,1422,1420,1424,2461,802,2441,2439,790,786,783,794,2409,2406,2403,750,742,738,2414,756,753,1720,2367,2365,2362,2359,1663,693,691,684,2373,680,2370,702,699,696,704,1690,1687,2337,2336,2334,2332,1624,2329,1622,640,637,2344,634,2342,630,2340,650,648,645,2346,655,653,1653,1651,1649,1655,2612,2597,2595,2571,2568,2565,2576,2534,2529,2526,1787,2540,2537,907,904,900,910,2503,2502,2500,2498,1768,2495,1767,2510,2508,2506,869,866,863,2513,876,874,1782,2720,2713,2711,2697,2694,2691,2702,2672,2670,2664,1828,2678,2675,2647,2646,2644,2642,1823,2639,1822,2654,2652,2650,2657,2771,1855,2765,2762,1850,1849,2751,2749,2747,2754,353,2148,344,342,336,2142,332,2140,345,1375,1373,306,2130,299,2128,295,2125,319,314,311,2132,1354,1352,1349,1356,262,257,2101,253,2096,2093,274,273,267,2107,263,2104,280,278,275,1316,1311,1308,1320,1318,2052,202,2050,2044,2040,219,2063,212,2060,208,2055,224,221,2066,1260,1258,1252,231,1248,229,1266,1264,1261,1268,155,1998,153,1996,1994,1991,1988,165,164,2007,162,2006,159,2003,2e3,172,171,169,2012,166,2010,1186,1184,1182,1179,175,1176,173,1192,1191,1189,1187,176,1194,1193,2313,2307,2305,592,589,2294,2292,2289,578,572,568,2297,580,1591,2272,2267,2264,1547,538,536,529,2278,525,2275,547,544,541,1574,1571,2237,2235,2229,1493,2225,1489,478,2247,470,2244,465,2241,493,488,484,2250,498,495,1536,1533,1530,1539,2187,2186,2184,2182,1432,2179,1430,2176,1427,414,412,2197,409,2195,405,2193,2190,426,424,421,2203,418,2201,431,429,1473,1471,1469,1466,434,1477,1475,2478,2472,2470,2459,2457,2454,2462,803,2437,2432,2429,1726,2443,2440,792,789,785,2401,2399,2393,1702,2389,1699,2411,2408,2405,745,741,2415,758,755,1721,2358,2357,2355,2353,1661,2350,1660,2347,1657,2368,2366,2364,2361,1666,690,687,2374,683,2372,701,698,705,1691,1689,2619,2617,2610,2608,2605,2613,2593,2588,2585,1803,2599,2596,2563,2561,2555,1797,2551,1795,2573,2570,2567,2577,2525,2524,2522,2520,1786,2517,1785,2514,1783,2535,2533,2531,2528,1788,2541,2539,906,903,911,2721,1844,2715,2712,1838,1836,2699,2696,2693,2703,1827,1826,1824,2673,2671,2669,2666,1829,2679,2677,1858,1857,2772,1854,1853,1851,1856,2766,2764,143,1987,139,1986,135,133,131,1984,128,1983,125,1981,138,137,136,1985,1133,1132,1130,112,110,1974,107,1973,104,1971,1969,122,121,119,117,1977,114,1976,124,1115,1114,1112,1110,1117,1116,84,83,1953,81,1952,78,1950,1948,1945,94,93,91,1959,88,1958,85,1955,99,97,95,1961,1086,1085,1083,1081,1078,100,1090,1089,1087,1091,49,47,1917,44,1915,1913,1910,1907,59,1926,56,1925,53,1922,1919,66,64,1931,61,1929,1042,1040,1038,71,1035,70,1032,68,1048,1047,1045,1043,1050,1049,12,10,1869,1867,1864,1861,21,1880,19,1877,1874,1871,28,1888,25,1886,22,1883,982,980,977,974,32,30,991,989,987,984,34,995,994,992,2151,2150,2147,2146,2144,356,355,354,2149,2139,2138,2136,2134,1359,343,341,338,2143,335,2141,348,347,346,1376,1374,2124,2123,2121,2119,1326,2116,1324,310,308,305,2131,302,2129,298,2127,320,318,316,313,2133,322,321,1355,1353,1351,1357,2092,2091,2089,2087,1276,2084,1274,2081,1271,259,2102,256,2100,252,2098,2095,272,269,2108,266,2106,281,279,277,1317,1315,1313,1310,282,1321,1319,2039,2037,2035,2032,1203,2029,1200,1197,207,2053,205,2051,201,2049,2046,2043,220,218,2064,215,2062,211,2059,228,226,223,2069,1259,1257,1254,232,1251,230,1267,1265,1263,2316,2315,2312,2311,2309,2314,2304,2303,2301,2299,1593,2308,2306,590,2288,2287,2285,2283,1578,2280,1577,2295,2293,2291,579,577,574,571,2298,582,581,1592,2263,2262,2260,2258,1545,2255,1544,2252,1541,2273,2271,2269,2266,1550,535,532,2279,528,2277,546,543,549,1575,1573,2224,2222,2220,1486,2217,1485,2214,1482,1479,2238,2236,2234,2231,1496,2228,1492,480,477,2248,473,2246,469,2243,490,487,2251,497,1537,1535,1532,2477,2476,2474,2479,2469,2468,2466,2464,1730,2473,2471,2453,2452,2450,2448,1729,2445,1728,2460,2458,2456,2463,805,804,2428,2427,2425,2423,1725,2420,1724,2417,1722,2438,2436,2434,2431,1727,2444,2442,793,791,788,795,2388,2386,2384,1697,2381,1696,2378,1694,1692,2402,2400,2398,2395,1703,2392,1701,2412,2410,2407,751,748,744,2416,759,757,1807,2620,2618,1806,1805,2611,2609,2607,2614,1802,1801,1799,2594,2592,2590,2587,1804,2600,2598,1794,1793,1791,1789,2564,2562,2560,2557,1798,2554,1796,2574,2572,2569,2578,1847,1846,2722,1843,1842,1840,1845,2716,2714,1835,1834,1832,1830,1839,1837,2700,2698,2695,2704,1817,1811,1810,897,862,1777,829,826,838,1760,1758,808,2481,1741,1740,1738,1743,2624,1818,2726,2776,782,740,737,1715,686,679,695,1682,1680,639,628,2339,647,644,1645,1643,1640,1648,602,600,597,595,2320,593,2318,609,607,604,1611,1610,1608,1606,613,1615,1613,2328,926,924,892,886,899,857,850,2505,1778,824,823,821,819,2488,818,2486,833,831,828,840,1761,1759,2649,2632,2630,2746,2734,2732,2782,2781,570,567,1587,531,527,523,540,1566,1564,476,467,463,2240,486,483,1524,1521,1518,1529,411,403,2192,399,2189,423,416,1462,1457,1454,428,1468,1465,2210,366,363,2158,360,2156,357,2153,376,373,370,2163,1410,1409,1407,1405,382,1402,380,1417,1415,1412,1421,2175,2174,777,774,771,784,732,725,722,2404,743,1716,676,674,668,2363,665,2360,685,1684,1681,626,624,622,2335,620,2333,617,2330,641,635,649,1646,1644,1642,2566,928,925,2530,2527,894,891,888,2501,2499,2496,858,856,854,851,1779,2692,2668,2665,2645,2643,2640,2651,2768,2759,2757,2744,2743,2741,2748,352,1382,340,337,333,1371,1369,307,300,296,2126,315,312,1347,1342,1350,261,258,250,2097,246,2094,271,268,264,1306,1301,1298,276,1312,1309,2115,203,2048,195,2045,191,2041,213,209,2056,1246,1244,1238,225,1234,222,1256,1253,1249,1262,2080,2079,154,1997,150,1995,147,1992,1989,163,160,2004,156,2001,1175,1174,1172,1170,1167,170,1164,167,1185,1183,1180,1177,174,1190,1188,2025,2024,2022,587,586,564,559,556,2290,573,1588,520,518,512,2268,508,2265,530,1568,1565,461,457,2233,450,2230,446,2226,479,471,489,1526,1523,1520,397,395,2185,392,2183,389,2180,2177,410,2194,402,422,1463,1461,1459,1456,1470,2455,799,2433,2430,779,776,773,2397,2394,2390,734,728,724,746,1717,2356,2354,2351,2348,1658,677,675,673,670,667,688,1685,1683,2606,2589,2586,2559,2556,2552,927,2523,2521,2518,2515,1784,2532,895,893,890,2718,2709,2707,2689,2687,2684,2663,2662,2660,2658,1825,2667,2769,1852,2760,2758,142,141,1139,1138,134,132,129,126,1982,1129,1128,1126,1131,113,111,108,105,1972,101,1970,120,118,115,1109,1108,1106,1104,123,1113,1111,82,79,1951,75,1949,72,1946,92,89,86,1956,1077,1076,1074,1072,98,1069,96,1084,1082,1079,1088,1968,1967,48,45,1916,42,1914,39,1911,1908,60,57,54,1923,50,1920,1031,1030,1028,1026,67,1023,65,1020,62,1041,1039,1036,1033,69,1046,1044,1944,1943,1941,11,9,1868,7,1865,1862,1859,20,1878,16,1875,13,1872,970,968,966,963,29,960,26,23,983,981,978,975,33,971,31,990,988,985,1906,1904,1902,993,351,2145,1383,331,330,328,326,2137,323,2135,339,1372,1370,294,293,291,289,2122,286,2120,283,2117,309,303,317,1348,1346,1344,245,244,242,2090,239,2088,236,2085,2082,260,2099,249,270,1307,1305,1303,1300,1314,189,2038,186,2036,183,2033,2030,2026,206,198,2047,194,216,1247,1245,1243,1240,227,1237,1255,2310,2302,2300,2286,2284,2281,565,563,561,558,575,1589,2261,2259,2256,2253,1542,521,519,517,514,2270,511,533,1569,1567,2223,2221,2218,2215,1483,2211,1480,459,456,453,2232,449,474,491,1527,1525,1522,2475,2467,2465,2451,2449,2446,801,800,2426,2424,2421,2418,1723,2435,780,778,775,2387,2385,2382,2379,1695,2375,1693,2396,735,733,730,727,749,1718,2616,2615,2604,2603,2601,2584,2583,2581,2579,1800,2591,2550,2549,2547,2545,1792,2542,1790,2558,929,2719,1841,2710,2708,1833,1831,2690,2688,2686,1815,1809,1808,1774,1756,1754,1737,1736,1734,1739,1816,1711,1676,1674,633,629,1638,1636,1633,1641,598,1605,1604,1602,1600,605,1609,1607,2327,887,853,1775,822,820,1757,1755,1584,524,1560,1558,468,464,1514,1511,1508,1519,408,404,400,1452,1447,1444,417,1458,1455,2208,364,361,358,2154,1401,1400,1398,1396,374,1393,371,1408,1406,1403,1413,2173,2172,772,726,723,1712,672,669,666,682,1678,1675,625,623,621,618,2331,636,632,1639,1637,1635,920,918,884,880,889,849,848,847,846,2497,855,852,1776,2641,2742,2787,1380,334,1367,1365,301,297,1340,1338,1335,1343,255,251,247,1296,1291,1288,265,1302,1299,2113,204,196,192,2042,1232,1230,1224,214,1220,210,1242,1239,1235,1250,2077,2075,151,148,1993,144,1990,1163,1162,1160,1158,1155,161,1152,157,1173,1171,1168,1165,168,1181,1178,2021,2020,2018,2023,585,560,557,1585,516,509,1562,1559,458,447,2227,472,1516,1513,1510,398,396,393,390,2181,386,2178,407,1453,1451,1449,1446,420,1460,2209,769,764,720,712,2391,729,1713,664,663,661,659,2352,656,2349,671,1679,1677,2553,922,919,2519,2516,885,883,881,2685,2661,2659,2767,2756,2755,140,1137,1136,130,127,1125,1124,1122,1127,109,106,102,1103,1102,1100,1098,116,1107,1105,1980,80,76,73,1947,1068,1067,1065,1063,90,1060,87,1075,1073,1070,1080,1966,1965,46,43,40,1912,36,1909,1019,1018,1016,1014,58,1011,55,1008,51,1029,1027,1024,1021,63,1037,1034,1940,1939,1937,1942,8,1866,4,1863,1,1860,956,954,952,949,946,17,14,969,967,964,961,27,957,24,979,976,972,1901,1900,1898,1896,986,1905,1903,350,349,1381,329,327,324,1368,1366,292,290,287,284,2118,304,1341,1339,1337,1345,243,240,237,2086,233,2083,254,1297,1295,1293,1290,1304,2114,190,187,184,2034,180,2031,177,2027,199,1233,1231,1229,1226,217,1223,1241,2078,2076,584,555,554,552,550,2282,562,1586,507,506,504,502,2257,499,2254,515,1563,1561,445,443,441,2219,438,2216,435,2212,460,454,475,1517,1515,1512,2447,798,797,2422,2419,770,768,766,2383,2380,2376,721,719,717,714,731,1714,2602,2582,2580,2548,2546,2543,923,921,2717,2706,2705,2683,2682,2680,1771,1752,1750,1733,1732,1731,1735,1814,1707,1670,1668,1631,1629,1626,1634,1599,1598,1596,1594,1603,1601,2326,1772,1753,1751,1581,1554,1552,1504,1501,1498,1509,1442,1437,1434,401,1448,1445,2206,1392,1391,1389,1387,1384,359,1399,1397,1394,1404,2171,2170,1708,1672,1669,619,1632,1630,1628,1773,1378,1363,1361,1333,1328,1336,1286,1281,1278,248,1292,1289,2111,1218,1216,1210,197,1206,193,1228,1225,1221,1236,2073,2071,1151,1150,1148,1146,152,1143,149,1140,145,1161,1159,1156,1153,158,1169,1166,2017,2016,2014,2019,1582,510,1556,1553,452,448,1506,1500,394,391,387,1443,1441,1439,1436,1450,2207,765,716,713,1709,662,660,657,1673,1671,916,914,879,878,877,882,1135,1134,1121,1120,1118,1123,1097,1096,1094,1092,103,1101,1099,1979,1059,1058,1056,1054,77,1051,74,1066,1064,1061,1071,1964,1963,1007,1006,1004,1002,999,41,996,37,1017,1015,1012,1009,52,1025,1022,1936,1935,1933,1938,942,940,938,935,932,5,2,955,953,950,947,18,943,15,965,962,958,1895,1894,1892,1890,973,1899,1897,1379,325,1364,1362,288,285,1334,1332,1330,241,238,234,1287,1285,1283,1280,1294,2112,188,185,181,178,2028,1219,1217,1215,1212,200,1209,1227,2074,2072,583,553,551,1583,505,503,500,513,1557,1555,444,442,439,436,2213,455,451,1507,1505,1502,796,763,762,760,767,711,710,708,706,2377,718,715,1710,2544,917,915,2681,1627,1597,1595,2325,1769,1749,1747,1499,1438,1435,2204,1390,1388,1385,1395,2169,2167,1704,1665,1662,1625,1623,1620,1770,1329,1282,1279,2109,1214,1207,1222,2068,2065,1149,1147,1144,1141,146,1157,1154,2013,2011,2008,2015,1579,1549,1546,1495,1487,1433,1431,1428,1425,388,1440,2205,1705,658,1667,1664,1119,1095,1093,1978,1057,1055,1052,1062,1962,1960,1005,1003,1e3,997,38,1013,1010,1932,1930,1927,1934,941,939,936,933,6,930,3,951,948,944,1889,1887,1884,1881,959,1893,1891,35,1377,1360,1358,1327,1325,1322,1331,1277,1275,1272,1269,235,1284,2110,1205,1204,1201,1198,182,1195,179,1213,2070,2067,1580,501,1551,1548,440,437,1497,1494,1490,1503,761,709,707,1706,913,912,2198,1386,2164,2161,1621,1766,2103,1208,2058,2054,1145,1142,2005,2002,1999,2009,1488,1429,1426,2200,1698,1659,1656,1975,1053,1957,1954,1001,998,1924,1921,1918,1928,937,934,931,1879,1876,1873,1870,945,1885,1882,1323,1273,1270,2105,1202,1199,1196,1211,2061,2057,1576,1543,1540,1484,1481,1478,1491,1700]),r}(),Qf=function(){function r(e,t){this.bits=e,this.points=t}return r.prototype.getBits=function(){return this.bits},r.prototype.getPoints=function(){return this.points},r}(),Jf=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.")},ed=function(){function r(){}return r.detectMultiple=function(e,t,n){var i=e.getBlackMatrix(),o=r.detect(n,i);return o.length||(i=i.clone(),i.rotate180(),o=r.detect(n,i)),new Qf(i,o)},r.detect=function(e,t){for(var n,i,o=new Array,a=0,s=0,l=!1;a<t.getHeight();){var u=r.findVertices(t,a,s);if(u[0]==null&&u[3]==null){if(!l)break;l=!1,s=0;try{for(var c=(n=void 0,Jf(o)),f=c.next();!f.done;f=c.next()){var h=f.value;h[1]!=null&&(a=Math.trunc(Math.max(a,h[1].getY()))),h[3]!=null&&(a=Math.max(a,Math.trunc(h[3].getY())))}}catch(v){n={error:v}}finally{try{f&&!f.done&&(i=c.return)&&i.call(c)}finally{if(n)throw n.error}}a+=r.ROW_STEP;continue}if(l=!0,o.push(u),!e)break;u[2]!=null?(s=Math.trunc(u[2].getX()),a=Math.trunc(u[2].getY())):(s=Math.trunc(u[4].getX()),a=Math.trunc(u[4].getY()))}return o},r.findVertices=function(e,t,n){var i=e.getHeight(),o=e.getWidth(),a=new Array(8);return r.copyToResult(a,r.findRowsWithPattern(e,i,o,t,n,r.START_PATTERN),r.INDEXES_START_PATTERN),a[4]!=null&&(n=Math.trunc(a[4].getX()),t=Math.trunc(a[4].getY())),r.copyToResult(a,r.findRowsWithPattern(e,i,o,t,n,r.STOP_PATTERN),r.INDEXES_STOP_PATTERN),a},r.copyToResult=function(e,t,n){for(var i=0;i<n.length;i++)e[n[i]]=t[i]},r.findRowsWithPattern=function(e,t,n,i,o,a){for(var s=new Array(4),l=!1,u=new Int32Array(a.length);i<t;i+=r.ROW_STEP){var c=r.findGuardPattern(e,o,i,n,!1,a,u);if(c!=null){for(;i>0;){var f=r.findGuardPattern(e,o,--i,n,!1,a,u);if(f!=null)c=f;else{i++;break}}s[0]=new X(c[0],i),s[1]=new X(c[1],i),l=!0;break}}var h=i+1;if(l){for(var v=0,f=Int32Array.from([Math.trunc(s[0].getX()),Math.trunc(s[1].getX())]);h<t;h++){var c=r.findGuardPattern(e,f[0],h,n,!1,a,u);if(c!=null&&Math.abs(f[0]-c[0])<r.MAX_PATTERN_DRIFT&&Math.abs(f[1]-c[1])<r.MAX_PATTERN_DRIFT)f=c,v=0;else{if(v>r.SKIPPED_ROW_COUNT_MAX)break;v++}}h-=v+1,s[2]=new X(f[0],h),s[3]=new X(f[1],h)}return h-i<r.BARCODE_MIN_HEIGHT&&de.fill(s,null),s},r.findGuardPattern=function(e,t,n,i,o,a,s){de.fillWithin(s,0,s.length,0);for(var l=t,u=0;e.get(l,n)&&l>0&&u++<r.MAX_PIXEL_DRIFT;)l--;for(var c=l,f=0,h=a.length,v=o;c<i;c++){var p=e.get(c,n);if(p!==v)s[f]++;else{if(f===h-1){if(r.patternMatchVariance(s,a,r.MAX_INDIVIDUAL_VARIANCE)<r.MAX_AVG_VARIANCE)return new Int32Array([l,c]);l+=s[0]+s[1],se.arraycopy(s,2,s,0,f-1),s[f-1]=0,s[f]=0,f--}else f++;s[f]=1,v=!v}}return f===h-1&&r.patternMatchVariance(s,a,r.MAX_INDIVIDUAL_VARIANCE)<r.MAX_AVG_VARIANCE?new Int32Array([l,c-1]):null},r.patternMatchVariance=function(e,t,n){for(var i=e.length,o=0,a=0,s=0;s<i;s++)o+=e[s],a+=t[s];if(o<a)return 1/0;var l=o/a;n*=l;for(var u=0,c=0;c<i;c++){var f=e[c],h=t[c]*l,v=f>h?f-h:h-f;if(v>n)return 1/0;u+=v}return u/o},r.INDEXES_START_PATTERN=Int32Array.from([0,4,1,5]),r.INDEXES_STOP_PATTERN=Int32Array.from([6,2,7,3]),r.MAX_AVG_VARIANCE=.42,r.MAX_INDIVIDUAL_VARIANCE=.8,r.START_PATTERN=Int32Array.from([8,1,1,1,1,1,1,3]),r.STOP_PATTERN=Int32Array.from([7,1,1,3,1,1,1,2,1]),r.MAX_PIXEL_DRIFT=3,r.MAX_PATTERN_DRIFT=5,r.SKIPPED_ROW_COUNT_MAX=25,r.ROW_STEP=5,r.BARCODE_MIN_HEIGHT=10,r}(),td=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.")},bt=function(){function r(e,t){if(t.length===0)throw new $;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=new Int32Array([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){var t,n;if(e===0)return this.getCoefficient(0);if(e===1){var i=0;try{for(var o=td(this.coefficients),a=o.next();!a.done;a=o.next()){var s=a.value;i=this.field.add(i,s)}}catch(f){t={error:f}}finally{try{a&&!a.done&&(n=o.return)&&n.call(o)}finally{if(t)throw t.error}}return i}for(var l=this.coefficients[0],u=this.coefficients.length,c=1;c<u;c++)l=this.field.add(this.field.multiply(e,l),this.coefficients[c]);return l},r.prototype.add=function(e){if(!this.field.equals(e.field))throw new $("ModulusPolys do not have same ModulusGF 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 o=new Int32Array(n.length),a=n.length-t.length;se.arraycopy(n,0,o,0,a);for(var s=a;s<n.length;s++)o[s]=this.field.add(t[s-a],n[s]);return new r(this.field,o)},r.prototype.subtract=function(e){if(!this.field.equals(e.field))throw new $("ModulusPolys do not have same ModulusGF field");return e.isZero()?this:this.add(e.negative())},r.prototype.multiply=function(e){return e instanceof r?this.multiplyOther(e):this.multiplyScalar(e)},r.prototype.multiplyOther=function(e){if(!this.field.equals(e.field))throw new $("ModulusPolys do not have same ModulusGF field");if(this.isZero()||e.isZero())return new r(this.field,new Int32Array([0]));for(var t=this.coefficients,n=t.length,i=e.coefficients,o=i.length,a=new Int32Array(n+o-1),s=0;s<n;s++)for(var l=t[s],u=0;u<o;u++)a[s+u]=this.field.add(a[s+u],this.field.multiply(l,i[u]));return new r(this.field,a)},r.prototype.negative=function(){for(var e=this.coefficients.length,t=new Int32Array(e),n=0;n<e;n++)t[n]=this.field.subtract(0,this.coefficients[n]);return new r(this.field,t)},r.prototype.multiplyScalar=function(e){if(e===0)return new r(this.field,new Int32Array([0]));if(e===1)return this;for(var t=this.coefficients.length,n=new Int32Array(t),i=0;i<t;i++)n[i]=this.field.multiply(this.coefficients[i],e);return new r(this.field,n)},r.prototype.multiplyByMonomial=function(e,t){if(e<0)throw new $;if(t===0)return new r(this.field,new Int32Array([0]));for(var n=this.coefficients.length,i=new Int32Array(n+e),o=0;o<n;o++)i[o]=this.field.multiply(this.coefficients[o],t);return new r(this.field,i)},r.prototype.toString=function(){for(var e=new q,t=this.getDegree();t>=0;t--){var n=this.getCoefficient(t);n!==0&&(n<0?(e.append(" - "),n=-n):e.length()>0&&e.append(" + "),(t===0||n!==1)&&e.append(n),t!==0&&(t===1?e.append("x"):(e.append("x^"),e.append(t))))}return e.toString()},r}(),rd=function(){function r(){}return r.prototype.add=function(e,t){return(e+t)%this.modulus},r.prototype.subtract=function(e,t){return(this.modulus+e-t)%this.modulus},r.prototype.exp=function(e){return this.expTable[e]},r.prototype.log=function(e){if(e===0)throw new $;return this.logTable[e]},r.prototype.inverse=function(e){if(e===0)throw new ua;return this.expTable[this.modulus-this.logTable[e]-1]},r.prototype.multiply=function(e,t){return e===0||t===0?0:this.expTable[(this.logTable[e]+this.logTable[t])%(this.modulus-1)]},r.prototype.getSize=function(){return this.modulus},r.prototype.equals=function(e){return e===this},r}(),nd=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)i.hasOwnProperty(o)&&(n[o]=i[o])},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)}}(),id=function(r){nd(e,r);function e(t,n){var i=r.call(this)||this;i.modulus=t,i.expTable=new Int32Array(t),i.logTable=new Int32Array(t);for(var o=1,a=0;a<t;a++)i.expTable[a]=o,o=o*n%t;for(var a=0;a<t-1;a++)i.logTable[i.expTable[a]]=a;return i.zero=new bt(i,new Int32Array([0])),i.one=new bt(i,new Int32Array([1])),i}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 $;if(n===0)return this.zero;var i=new Int32Array(t+1);return i[0]=n,new bt(this,i)},e.PDF417_GF=new e(K.NUMBER_OF_CODEWORDS,3),e}(rd),od=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.")},ad=function(){function r(){this.field=id.PDF417_GF}return r.prototype.decode=function(e,t,n){for(var i,o,a=new bt(this.field,e),s=new Int32Array(t),l=!1,u=t;u>0;u--){var c=a.evaluateAt(this.field.exp(u));s[t-u]=c,c!==0&&(l=!0)}if(!l)return 0;var f=this.field.getOne();if(n!=null)try{for(var h=od(n),v=h.next();!v.done;v=h.next()){var p=v.value,g=this.field.exp(e.length-1-p),m=new bt(this.field,new Int32Array([this.field.subtract(0,g),1]));f=f.multiply(m)}}catch(P){i={error:P}}finally{try{v&&!v.done&&(o=h.return)&&o.call(h)}finally{if(i)throw i.error}}for(var y=new bt(this.field,s),C=this.runEuclideanAlgorithm(this.field.buildMonomial(t,1),y,t),w=C[0],E=C[1],I=this.findErrorLocations(w),S=this.findErrorMagnitudes(E,w,I),u=0;u<I.length;u++){var b=e.length-1-this.field.log(I[u]);if(b<0)throw Ce.getChecksumInstance();e[b]=this.field.subtract(e[b],S[u])}return I.length},r.prototype.runEuclideanAlgorithm=function(e,t,n){if(e.getDegree()<t.getDegree()){var i=e;e=t,t=i}for(var o=e,a=t,s=this.field.getZero(),l=this.field.getOne();a.getDegree()>=Math.round(n/2);){var u=o,c=s;if(o=a,s=l,o.isZero())throw Ce.getChecksumInstance();a=u;for(var f=this.field.getZero(),h=o.getCoefficient(o.getDegree()),v=this.field.inverse(h);a.getDegree()>=o.getDegree()&&!a.isZero();){var p=a.getDegree()-o.getDegree(),g=this.field.multiply(a.getCoefficient(a.getDegree()),v);f=f.add(this.field.buildMonomial(p,g)),a=a.subtract(o.multiplyByMonomial(p,g))}l=f.multiply(s).subtract(c).negative()}var m=l.getCoefficient(0);if(m===0)throw Ce.getChecksumInstance();var y=this.field.inverse(m),C=l.multiply(y),w=a.multiply(y);return[C,w]},r.prototype.findErrorLocations=function(e){for(var t=e.getDegree(),n=new Int32Array(t),i=0,o=1;o<this.field.getSize()&&i<t;o++)e.evaluateAt(o)===0&&(n[i]=this.field.inverse(o),i++);if(i!==t)throw Ce.getChecksumInstance();return n},r.prototype.findErrorMagnitudes=function(e,t,n){for(var i=t.getDegree(),o=new Int32Array(i),a=1;a<=i;a++)o[i-a]=this.field.multiply(a,t.getCoefficient(a));for(var s=new bt(this.field,o),l=n.length,u=new Int32Array(l),a=0;a<l;a++){var c=this.field.inverse(n[a]),f=this.field.subtract(0,e.evaluateAt(c)),h=this.field.inverse(s.evaluateAt(c));u[a]=this.field.multiply(f,h)}return u},r}(),gi=function(){function r(e,t,n,i,o){e instanceof r?this.constructor_2(e):this.constructor_1(e,t,n,i,o)}return r.prototype.constructor_1=function(e,t,n,i,o){var a=t==null||n==null,s=i==null||o==null;if(a&&s)throw new D;a?(t=new X(0,i.getY()),n=new X(0,o.getY())):s&&(i=new X(e.getWidth()-1,t.getY()),o=new X(e.getWidth()-1,n.getY())),this.image=e,this.topLeft=t,this.bottomLeft=n,this.topRight=i,this.bottomRight=o,this.minX=Math.trunc(Math.min(t.getX(),n.getX())),this.maxX=Math.trunc(Math.max(i.getX(),o.getX())),this.minY=Math.trunc(Math.min(t.getY(),i.getY())),this.maxY=Math.trunc(Math.max(n.getY(),o.getY()))},r.prototype.constructor_2=function(e){this.image=e.image,this.topLeft=e.getTopLeft(),this.bottomLeft=e.getBottomLeft(),this.topRight=e.getTopRight(),this.bottomRight=e.getBottomRight(),this.minX=e.getMinX(),this.maxX=e.getMaxX(),this.minY=e.getMinY(),this.maxY=e.getMaxY()},r.merge=function(e,t){return e==null?t:t==null?e:new r(e.image,e.topLeft,e.bottomLeft,t.topRight,t.bottomRight)},r.prototype.addMissingRows=function(e,t,n){var i=this.topLeft,o=this.bottomLeft,a=this.topRight,s=this.bottomRight;if(e>0){var l=n?this.topLeft:this.topRight,u=Math.trunc(l.getY()-e);u<0&&(u=0);var c=new X(l.getX(),u);n?i=c:a=c}if(t>0){var f=n?this.bottomLeft:this.bottomRight,h=Math.trunc(f.getY()+t);h>=this.image.getHeight()&&(h=this.image.getHeight()-1);var v=new X(f.getX(),h);n?o=v:s=v}return new r(this.image,i,o,a,s)},r.prototype.getMinX=function(){return this.minX},r.prototype.getMaxX=function(){return this.maxX},r.prototype.getMinY=function(){return this.minY},r.prototype.getMaxY=function(){return this.maxY},r.prototype.getTopLeft=function(){return this.topLeft},r.prototype.getTopRight=function(){return this.topRight},r.prototype.getBottomLeft=function(){return this.bottomLeft},r.prototype.getBottomRight=function(){return this.bottomRight},r}(),sd=function(){function r(e,t,n,i){this.columnCount=e,this.errorCorrectionLevel=i,this.rowCountUpperPart=t,this.rowCountLowerPart=n,this.rowCount=t+n}return r.prototype.getColumnCount=function(){return this.columnCount},r.prototype.getErrorCorrectionLevel=function(){return this.errorCorrectionLevel},r.prototype.getRowCount=function(){return this.rowCount},r.prototype.getRowCountUpperPart=function(){return this.rowCountUpperPart},r.prototype.getRowCountLowerPart=function(){return this.rowCountLowerPart},r}(),xi=function(){function r(){this.buffer=""}return r.form=function(e,t){var n=-1;function i(a,s,l,u,c,f){if(a==="%%")return"%";if(t[++n]!==void 0){a=u?parseInt(u.substr(1)):void 0;var h=c?parseInt(c.substr(1)):void 0,v;switch(f){case"s":v=t[n];break;case"c":v=t[n][0];break;case"f":v=parseFloat(t[n]).toFixed(a);break;case"p":v=parseFloat(t[n]).toPrecision(a);break;case"e":v=parseFloat(t[n]).toExponential(a);break;case"x":v=parseInt(t[n]).toString(h||16);break;case"d":v=parseFloat(parseInt(t[n],h||10).toPrecision(a)).toFixed(0);break}v=typeof v=="object"?JSON.stringify(v):(+v).toString(h);for(var p=parseInt(l),g=l&&l[0]+""=="0"?"0":" ";v.length<p;)v=s!==void 0?v+g:g+v;return v}}var o=/%(-)?(0?[0-9]+)?([.][0-9]+)?([#][0-9]+)?([scfpexd%])/g;return e.replace(o,i)},r.prototype.format=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];this.buffer+=r.form(e,t)},r.prototype.toString=function(){return this.buffer},r}(),ld=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.")},La=function(){function r(e){this.boundingBox=new gi(e),this.codewords=new Array(e.getMaxY()-e.getMinY()+1)}return r.prototype.getCodewordNearby=function(e){var t=this.getCodeword(e);if(t!=null)return t;for(var n=1;n<r.MAX_NEARBY_DISTANCE;n++){var i=this.imageRowToCodewordIndex(e)-n;if(i>=0&&(t=this.codewords[i],t!=null)||(i=this.imageRowToCodewordIndex(e)+n,i<this.codewords.length&&(t=this.codewords[i],t!=null)))return t}return null},r.prototype.imageRowToCodewordIndex=function(e){return e-this.boundingBox.getMinY()},r.prototype.setCodeword=function(e,t){this.codewords[this.imageRowToCodewordIndex(e)]=t},r.prototype.getCodeword=function(e){return this.codewords[this.imageRowToCodewordIndex(e)]},r.prototype.getBoundingBox=function(){return this.boundingBox},r.prototype.getCodewords=function(){return this.codewords},r.prototype.toString=function(){var e,t,n=new xi,i=0;try{for(var o=ld(this.codewords),a=o.next();!a.done;a=o.next()){var s=a.value;if(s==null){n.format("%3d: | %n",i++);continue}n.format("%3d: %3d|%3d%n",i++,s.getRowNumber(),s.getValue())}}catch(l){e={error:l}}finally{try{a&&!a.done&&(t=o.return)&&t.call(o)}finally{if(e)throw e.error}}return n.toString()},r.MAX_NEARBY_DISTANCE=5,r}(),ud=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.")},cd=function(r,e){var t=typeof Symbol=="function"&&r[Symbol.iterator];if(!t)return r;var n=t.call(r),i,o=[],a;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(s){a={error:s}}finally{try{i&&!i.done&&(t=n.return)&&t.call(n)}finally{if(a)throw a.error}}return o},fr=function(){function r(){this.values=new Map}return r.prototype.setValue=function(e){e=Math.trunc(e);var t=this.values.get(e);t==null&&(t=0),t++,this.values.set(e,t)},r.prototype.getValue=function(){var e,t,n=-1,i=new Array,o=function(f,h){var v={getKey:function(){return f},getValue:function(){return h}};v.getValue()>n?(n=v.getValue(),i=[],i.push(v.getKey())):v.getValue()===n&&i.push(v.getKey())};try{for(var a=ud(this.values.entries()),s=a.next();!s.done;s=a.next()){var l=cd(s.value,2),u=l[0],c=l[1];o(u,c)}}catch(f){e={error:f}}finally{try{s&&!s.done&&(t=a.return)&&t.call(a)}finally{if(e)throw e.error}}return K.toIntArray(i)},r.prototype.getConfidence=function(e){return this.values.get(e)},r}(),fd=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)i.hasOwnProperty(o)&&(n[o]=i[o])},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)}}(),yi=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.")},Ra=function(r){fd(e,r);function e(t,n){var i=r.call(this,t)||this;return i._isLeft=n,i}return e.prototype.setRowNumbers=function(){var t,n;try{for(var i=yi(this.getCodewords()),o=i.next();!o.done;o=i.next()){var a=o.value;a!=null&&a.setRowNumberAsRowIndicatorColumn()}}catch(s){t={error:s}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}},e.prototype.adjustCompleteIndicatorColumnRowNumbers=function(t){var n=this.getCodewords();this.setRowNumbers(),this.removeIncorrectCodewords(n,t);for(var i=this.getBoundingBox(),o=this._isLeft?i.getTopLeft():i.getTopRight(),a=this._isLeft?i.getBottomLeft():i.getBottomRight(),s=this.imageRowToCodewordIndex(Math.trunc(o.getY())),l=this.imageRowToCodewordIndex(Math.trunc(a.getY())),u=-1,c=1,f=0,h=s;h<l;h++)if(n[h]!=null){var v=n[h],p=v.getRowNumber()-u;if(p===0)f++;else if(p===1)c=Math.max(c,f),f=1,u=v.getRowNumber();else if(p<0||v.getRowNumber()>=t.getRowCount()||p>h)n[h]=null;else{var g=void 0;c>2?g=(c-2)*p:g=p;for(var m=g>=h,y=1;y<=g&&!m;y++)m=n[h-y]!=null;m?n[h]=null:(u=v.getRowNumber(),f=1)}}},e.prototype.getRowHeights=function(){var t,n,i=this.getBarcodeMetadata();if(i==null)return null;this.adjustIncompleteIndicatorColumnRowNumbers(i);var o=new Int32Array(i.getRowCount());try{for(var a=yi(this.getCodewords()),s=a.next();!s.done;s=a.next()){var l=s.value;if(l!=null){var u=l.getRowNumber();if(u>=o.length)continue;o[u]++}}}catch(c){t={error:c}}finally{try{s&&!s.done&&(n=a.return)&&n.call(a)}finally{if(t)throw t.error}}return o},e.prototype.adjustIncompleteIndicatorColumnRowNumbers=function(t){for(var n=this.getBoundingBox(),i=this._isLeft?n.getTopLeft():n.getTopRight(),o=this._isLeft?n.getBottomLeft():n.getBottomRight(),a=this.imageRowToCodewordIndex(Math.trunc(i.getY())),s=this.imageRowToCodewordIndex(Math.trunc(o.getY())),l=this.getCodewords(),u=-1,c=a;c<s;c++)if(l[c]!=null){var f=l[c];f.setRowNumberAsRowIndicatorColumn();var h=f.getRowNumber()-u;h===0||(h===1?u=f.getRowNumber():f.getRowNumber()>=t.getRowCount()?l[c]=null:u=f.getRowNumber())}},e.prototype.getBarcodeMetadata=function(){var t,n,i=this.getCodewords(),o=new fr,a=new fr,s=new fr,l=new fr;try{for(var u=yi(i),c=u.next();!c.done;c=u.next()){var f=c.value;if(f!=null){f.setRowNumberAsRowIndicatorColumn();var h=f.getValue()%30,v=f.getRowNumber();switch(this._isLeft||(v+=2),v%3){case 0:a.setValue(h*3+1);break;case 1:l.setValue(h/3),s.setValue(h%3);break;case 2:o.setValue(h+1);break}}}}catch(g){t={error:g}}finally{try{c&&!c.done&&(n=u.return)&&n.call(u)}finally{if(t)throw t.error}}if(o.getValue().length===0||a.getValue().length===0||s.getValue().length===0||l.getValue().length===0||o.getValue()[0]<1||a.getValue()[0]+s.getValue()[0]<K.MIN_ROWS_IN_BARCODE||a.getValue()[0]+s.getValue()[0]>K.MAX_ROWS_IN_BARCODE)return null;var p=new sd(o.getValue()[0],a.getValue()[0],s.getValue()[0],l.getValue()[0]);return this.removeIncorrectCodewords(i,p),p},e.prototype.removeIncorrectCodewords=function(t,n){for(var i=0;i<t.length;i++){var o=t[i];if(t[i]!=null){var a=o.getValue()%30,s=o.getRowNumber();if(s>n.getRowCount()){t[i]=null;continue}switch(this._isLeft||(s+=2),s%3){case 0:a*3+1!==n.getRowCountUpperPart()&&(t[i]=null);break;case 1:(Math.trunc(a/3)!==n.getErrorCorrectionLevel()||a%3!==n.getRowCountLowerPart())&&(t[i]=null);break;case 2:a+1!==n.getColumnCount()&&(t[i]=null);break}}}},e.prototype.isLeft=function(){return this._isLeft},e.prototype.toString=function(){return"IsLeft: "+this._isLeft+`
|
|
51
|
+
`+r.prototype.toString.call(this)},e}(La),dd=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.")},hd=function(){function r(e,t){this.ADJUST_ROW_NUMBER_SKIP=2,this.barcodeMetadata=e,this.barcodeColumnCount=e.getColumnCount(),this.boundingBox=t,this.detectionResultColumns=new Array(this.barcodeColumnCount+2)}return r.prototype.getDetectionResultColumns=function(){this.adjustIndicatorColumnRowNumbers(this.detectionResultColumns[0]),this.adjustIndicatorColumnRowNumbers(this.detectionResultColumns[this.barcodeColumnCount+1]);var e=K.MAX_CODEWORDS_IN_BARCODE,t;do t=e,e=this.adjustRowNumbersAndGetCount();while(e>0&&e<t);return this.detectionResultColumns},r.prototype.adjustIndicatorColumnRowNumbers=function(e){e!=null&&e.adjustCompleteIndicatorColumnRowNumbers(this.barcodeMetadata)},r.prototype.adjustRowNumbersAndGetCount=function(){var e=this.adjustRowNumbersByRow();if(e===0)return 0;for(var t=1;t<this.barcodeColumnCount+1;t++)for(var n=this.detectionResultColumns[t].getCodewords(),i=0;i<n.length;i++)n[i]!=null&&(n[i].hasValidRowNumber()||this.adjustRowNumbers(t,i,n));return e},r.prototype.adjustRowNumbersByRow=function(){this.adjustRowNumbersFromBothRI();var e=this.adjustRowNumbersFromLRI();return e+this.adjustRowNumbersFromRRI()},r.prototype.adjustRowNumbersFromBothRI=function(){if(!(this.detectionResultColumns[0]==null||this.detectionResultColumns[this.barcodeColumnCount+1]==null)){for(var e=this.detectionResultColumns[0].getCodewords(),t=this.detectionResultColumns[this.barcodeColumnCount+1].getCodewords(),n=0;n<e.length;n++)if(e[n]!=null&&t[n]!=null&&e[n].getRowNumber()===t[n].getRowNumber())for(var i=1;i<=this.barcodeColumnCount;i++){var o=this.detectionResultColumns[i].getCodewords()[n];o!=null&&(o.setRowNumber(e[n].getRowNumber()),o.hasValidRowNumber()||(this.detectionResultColumns[i].getCodewords()[n]=null))}}},r.prototype.adjustRowNumbersFromRRI=function(){if(this.detectionResultColumns[this.barcodeColumnCount+1]==null)return 0;for(var e=0,t=this.detectionResultColumns[this.barcodeColumnCount+1].getCodewords(),n=0;n<t.length;n++)if(t[n]!=null)for(var i=t[n].getRowNumber(),o=0,a=this.barcodeColumnCount+1;a>0&&o<this.ADJUST_ROW_NUMBER_SKIP;a--){var s=this.detectionResultColumns[a].getCodewords()[n];s!=null&&(o=r.adjustRowNumberIfValid(i,o,s),s.hasValidRowNumber()||e++)}return e},r.prototype.adjustRowNumbersFromLRI=function(){if(this.detectionResultColumns[0]==null)return 0;for(var e=0,t=this.detectionResultColumns[0].getCodewords(),n=0;n<t.length;n++)if(t[n]!=null)for(var i=t[n].getRowNumber(),o=0,a=1;a<this.barcodeColumnCount+1&&o<this.ADJUST_ROW_NUMBER_SKIP;a++){var s=this.detectionResultColumns[a].getCodewords()[n];s!=null&&(o=r.adjustRowNumberIfValid(i,o,s),s.hasValidRowNumber()||e++)}return e},r.adjustRowNumberIfValid=function(e,t,n){return n==null||n.hasValidRowNumber()||(n.isValidRowNumber(e)?(n.setRowNumber(e),t=0):++t),t},r.prototype.adjustRowNumbers=function(e,t,n){var i,o;if(this.detectionResultColumns[e-1]!=null){var a=n[t],s=this.detectionResultColumns[e-1].getCodewords(),l=s;this.detectionResultColumns[e+1]!=null&&(l=this.detectionResultColumns[e+1].getCodewords());var u=new Array(14);u[2]=s[t],u[3]=l[t],t>0&&(u[0]=n[t-1],u[4]=s[t-1],u[5]=l[t-1]),t>1&&(u[8]=n[t-2],u[10]=s[t-2],u[11]=l[t-2]),t<n.length-1&&(u[1]=n[t+1],u[6]=s[t+1],u[7]=l[t+1]),t<n.length-2&&(u[9]=n[t+2],u[12]=s[t+2],u[13]=l[t+2]);try{for(var c=dd(u),f=c.next();!f.done;f=c.next()){var h=f.value;if(r.adjustRowNumber(a,h))return}}catch(v){i={error:v}}finally{try{f&&!f.done&&(o=c.return)&&o.call(c)}finally{if(i)throw i.error}}}},r.adjustRowNumber=function(e,t){return t==null?!1:t.hasValidRowNumber()&&t.getBucket()===e.getBucket()?(e.setRowNumber(t.getRowNumber()),!0):!1},r.prototype.getBarcodeColumnCount=function(){return this.barcodeColumnCount},r.prototype.getBarcodeRowCount=function(){return this.barcodeMetadata.getRowCount()},r.prototype.getBarcodeECLevel=function(){return this.barcodeMetadata.getErrorCorrectionLevel()},r.prototype.setBoundingBox=function(e){this.boundingBox=e},r.prototype.getBoundingBox=function(){return this.boundingBox},r.prototype.setDetectionResultColumn=function(e,t){this.detectionResultColumns[e]=t},r.prototype.getDetectionResultColumn=function(e){return this.detectionResultColumns[e]},r.prototype.toString=function(){var e=this.detectionResultColumns[0];e==null&&(e=this.detectionResultColumns[this.barcodeColumnCount+1]);for(var t=new xi,n=0;n<e.getCodewords().length;n++){t.format("CW %3d:",n);for(var i=0;i<this.barcodeColumnCount+2;i++){if(this.detectionResultColumns[i]==null){t.format(" | ");continue}var o=this.detectionResultColumns[i].getCodewords()[n];if(o==null){t.format(" | ");continue}t.format(" %3d|%3d",o.getRowNumber(),o.getValue())}t.format("%n")}return t.toString()},r}(),vd=function(){function r(e,t,n,i){this.rowNumber=r.BARCODE_ROW_UNKNOWN,this.startX=Math.trunc(e),this.endX=Math.trunc(t),this.bucket=Math.trunc(n),this.value=Math.trunc(i)}return r.prototype.hasValidRowNumber=function(){return this.isValidRowNumber(this.rowNumber)},r.prototype.isValidRowNumber=function(e){return e!==r.BARCODE_ROW_UNKNOWN&&this.bucket===e%3*3},r.prototype.setRowNumberAsRowIndicatorColumn=function(){this.rowNumber=Math.trunc(Math.trunc(this.value/30)*3+Math.trunc(this.bucket/3))},r.prototype.getWidth=function(){return this.endX-this.startX},r.prototype.getStartX=function(){return this.startX},r.prototype.getEndX=function(){return this.endX},r.prototype.getBucket=function(){return this.bucket},r.prototype.getValue=function(){return this.value},r.prototype.getRowNumber=function(){return this.rowNumber},r.prototype.setRowNumber=function(e){this.rowNumber=e},r.prototype.toString=function(){return this.rowNumber+"|"+this.value},r.BARCODE_ROW_UNKNOWN=-1,r}(),pd=function(){function r(){}return r.initialize=function(){for(var e=0;e<K.SYMBOL_TABLE.length;e++)for(var t=K.SYMBOL_TABLE[e],n=t&1,i=0;i<K.BARS_IN_MODULE;i++){for(var o=0;(t&1)===n;)o+=1,t>>=1;n=t&1,r.RATIOS_TABLE[e]||(r.RATIOS_TABLE[e]=new Array(K.BARS_IN_MODULE)),r.RATIOS_TABLE[e][K.BARS_IN_MODULE-i-1]=Math.fround(o/K.MODULES_IN_CODEWORD)}this.bSymbolTableReady=!0},r.getDecodedValue=function(e){var t=r.getDecodedCodewordValue(r.sampleBitCounts(e));return t!==-1?t:r.getClosestDecodedValue(e)},r.sampleBitCounts=function(e){for(var t=Q.sum(e),n=new Int32Array(K.BARS_IN_MODULE),i=0,o=0,a=0;a<K.MODULES_IN_CODEWORD;a++){var s=t/(2*K.MODULES_IN_CODEWORD)+a*t/K.MODULES_IN_CODEWORD;o+e[i]<=s&&(o+=e[i],i++),n[i]++}return n},r.getDecodedCodewordValue=function(e){var t=r.getBitValue(e);return K.getCodeword(t)===-1?-1:t},r.getBitValue=function(e){for(var t=0,n=0;n<e.length;n++)for(var i=0;i<e[n];i++)t=t<<1|(n%2===0?1:0);return Math.trunc(t)},r.getClosestDecodedValue=function(e){var t=Q.sum(e),n=new Array(K.BARS_IN_MODULE);if(t>1)for(var i=0;i<n.length;i++)n[i]=Math.fround(e[i]/t);var o=ni.MAX_VALUE,a=-1;this.bSymbolTableReady||r.initialize();for(var s=0;s<r.RATIOS_TABLE.length;s++){for(var l=0,u=r.RATIOS_TABLE[s],c=0;c<K.BARS_IN_MODULE;c++){var f=Math.fround(u[c]-n[c]);if(l+=Math.fround(f*f),l>=o)break}l<o&&(o=l,a=K.SYMBOL_TABLE[s])}return a},r.bSymbolTableReady=!1,r.RATIOS_TABLE=new Array(K.SYMBOL_TABLE.length).map(function(e){return new Array(K.BARS_IN_MODULE)}),r}();const Va=typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{};var gd=function(){function r(){this.segmentCount=-1,this.fileSize=-1,this.timestamp=-1,this.checksum=-1}return r.prototype.getSegmentIndex=function(){return this.segmentIndex},r.prototype.setSegmentIndex=function(e){this.segmentIndex=e},r.prototype.getFileId=function(){return this.fileId},r.prototype.setFileId=function(e){this.fileId=e},r.prototype.getOptionalData=function(){return this.optionalData},r.prototype.setOptionalData=function(e){this.optionalData=e},r.prototype.isLastSegment=function(){return this.lastSegment},r.prototype.setLastSegment=function(e){this.lastSegment=e},r.prototype.getSegmentCount=function(){return this.segmentCount},r.prototype.setSegmentCount=function(e){this.segmentCount=e},r.prototype.getSender=function(){return this.sender||null},r.prototype.setSender=function(e){this.sender=e},r.prototype.getAddressee=function(){return this.addressee||null},r.prototype.setAddressee=function(e){this.addressee=e},r.prototype.getFileName=function(){return this.fileName},r.prototype.setFileName=function(e){this.fileName=e},r.prototype.getFileSize=function(){return this.fileSize},r.prototype.setFileSize=function(e){this.fileSize=e},r.prototype.getChecksum=function(){return this.checksum},r.prototype.setChecksum=function(e){this.checksum=e},r.prototype.getTimestamp=function(){return this.timestamp},r.prototype.setTimestamp=function(e){this.timestamp=e},r}(),ka=function(){function r(){}return r.parseLong=function(e,t){return t===void 0&&(t=void 0),parseInt(e,t)},r}(),xd=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)i.hasOwnProperty(o)&&(n[o]=i[o])},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)}}(),yd=function(r){xd(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.kind="NullPointerException",e}(Re),Cd=function(){function r(){}return r.prototype.writeBytes=function(e){this.writeBytesOffset(e,0,e.length)},r.prototype.writeBytesOffset=function(e,t,n){if(e==null)throw new yd;if(t<0||t>e.length||n<0||t+n>e.length||t+n<0)throw new Qn;if(n===0)return;for(var i=0;i<n;i++)this.write(e[t+i])},r.prototype.flush=function(){},r.prototype.close=function(){},r}(),md=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)i.hasOwnProperty(o)&&(n[o]=i[o])},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)}}(),wd=function(r){md(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e}(Re),_d=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)i.hasOwnProperty(o)&&(n[o]=i[o])},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)}}(),Ad=function(r){_d(e,r);function e(t){t===void 0&&(t=32);var n=r.call(this)||this;if(n.count=0,t<0)throw new $("Negative initial size: "+t);return n.buf=new Uint8Array(t),n}return e.prototype.ensureCapacity=function(t){t-this.buf.length>0&&this.grow(t)},e.prototype.grow=function(t){var n=this.buf.length,i=n<<1;if(i-t<0&&(i=t),i<0){if(t<0)throw new wd;i=Y.MAX_VALUE}this.buf=de.copyOfUint8Array(this.buf,i)},e.prototype.write=function(t){this.ensureCapacity(this.count+1),this.buf[this.count]=t,this.count+=1},e.prototype.writeBytesOffset=function(t,n,i){if(n<0||n>t.length||i<0||n+i-t.length>0)throw new Qn;this.ensureCapacity(this.count+i),se.arraycopy(t,n,this.buf,this.count,i),this.count+=i},e.prototype.writeTo=function(t){t.writeBytesOffset(this.buf,0,this.count)},e.prototype.reset=function(){this.count=0},e.prototype.toByteArray=function(){return de.copyOfUint8Array(this.buf,this.count)},e.prototype.size=function(){return this.count},e.prototype.toString=function(t){return t?typeof t=="string"?this.toString_string(t):this.toString_number(t):this.toString_void()},e.prototype.toString_void=function(){return new String(this.buf).toString()},e.prototype.toString_string=function(t){return new String(this.buf).toString()},e.prototype.toString_number=function(t){return new String(this.buf).toString()},e.prototype.close=function(){},e}(Cd),ie;(function(r){r[r.ALPHA=0]="ALPHA",r[r.LOWER=1]="LOWER",r[r.MIXED=2]="MIXED",r[r.PUNCT=3]="PUNCT",r[r.ALPHA_SHIFT=4]="ALPHA_SHIFT",r[r.PUNCT_SHIFT=5]="PUNCT_SHIFT"})(ie||(ie={}));function za(){if(typeof window<"u")return window.BigInt||null;if(typeof Va<"u")return Va.BigInt||null;if(typeof self<"u")return self.BigInt||null;throw new Error("Can't search globals for BigInt!")}var tn;function gt(r){if(typeof tn>"u"&&(tn=za()),tn===null)throw new Error("BigInt is not supported!");return tn(r)}function Ed(){var r=[];r[0]=gt(1);var e=gt(900);r[1]=e;for(var t=2;t<16;t++)r[t]=r[t-1]*e;return r}var Id=function(){function r(){}return r.decode=function(e,t){var n=new q(""),i=he.ISO8859_1;n.enableDecoding(i);for(var o=1,a=e[o++],s=new gd;o<e[0];){switch(a){case r.TEXT_COMPACTION_MODE_LATCH:o=r.textCompaction(e,o,n);break;case r.BYTE_COMPACTION_MODE_LATCH:case r.BYTE_COMPACTION_MODE_LATCH_6:o=r.byteCompaction(a,e,i,o,n);break;case r.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:n.append(e[o++]);break;case r.NUMERIC_COMPACTION_MODE_LATCH:o=r.numericCompaction(e,o,n);break;case r.ECI_CHARSET:he.getCharacterSetECIByValue(e[o++]);break;case r.ECI_GENERAL_PURPOSE:o+=2;break;case r.ECI_USER_DEFINED:o++;break;case r.BEGIN_MACRO_PDF417_CONTROL_BLOCK:o=r.decodeMacroBlock(e,o,s);break;case r.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case r.MACRO_PDF417_TERMINATOR:throw new k;default:o--,o=r.textCompaction(e,o,n);break}if(o<e.length)a=e[o++];else throw k.getFormatInstance()}if(n.length()===0)throw k.getFormatInstance();var l=new qr(null,n.toString(),null,t);return l.setOther(s),l},r.decodeMacroBlock=function(e,t,n){if(t+r.NUMBER_OF_SEQUENCE_CODEWORDS>e[0])throw k.getFormatInstance();for(var i=new Int32Array(r.NUMBER_OF_SEQUENCE_CODEWORDS),o=0;o<r.NUMBER_OF_SEQUENCE_CODEWORDS;o++,t++)i[o]=e[t];n.setSegmentIndex(Y.parseInt(r.decodeBase900toBase10(i,r.NUMBER_OF_SEQUENCE_CODEWORDS)));var a=new q;t=r.textCompaction(e,t,a),n.setFileId(a.toString());var s=-1;for(e[t]===r.BEGIN_MACRO_PDF417_OPTIONAL_FIELD&&(s=t+1);t<e[0];)switch(e[t]){case r.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:switch(t++,e[t]){case r.MACRO_PDF417_OPTIONAL_FIELD_FILE_NAME:var l=new q;t=r.textCompaction(e,t+1,l),n.setFileName(l.toString());break;case r.MACRO_PDF417_OPTIONAL_FIELD_SENDER:var u=new q;t=r.textCompaction(e,t+1,u),n.setSender(u.toString());break;case r.MACRO_PDF417_OPTIONAL_FIELD_ADDRESSEE:var c=new q;t=r.textCompaction(e,t+1,c),n.setAddressee(c.toString());break;case r.MACRO_PDF417_OPTIONAL_FIELD_SEGMENT_COUNT:var f=new q;t=r.numericCompaction(e,t+1,f),n.setSegmentCount(Y.parseInt(f.toString()));break;case r.MACRO_PDF417_OPTIONAL_FIELD_TIME_STAMP:var h=new q;t=r.numericCompaction(e,t+1,h),n.setTimestamp(ka.parseLong(h.toString()));break;case r.MACRO_PDF417_OPTIONAL_FIELD_CHECKSUM:var v=new q;t=r.numericCompaction(e,t+1,v),n.setChecksum(Y.parseInt(v.toString()));break;case r.MACRO_PDF417_OPTIONAL_FIELD_FILE_SIZE:var p=new q;t=r.numericCompaction(e,t+1,p),n.setFileSize(ka.parseLong(p.toString()));break;default:throw k.getFormatInstance()}break;case r.MACRO_PDF417_TERMINATOR:t++,n.setLastSegment(!0);break;default:throw k.getFormatInstance()}if(s!==-1){var g=t-s;n.isLastSegment()&&g--,n.setOptionalData(de.copyOfRange(e,s,s+g))}return t},r.textCompaction=function(e,t,n){for(var i=new Int32Array((e[0]-t)*2),o=new Int32Array((e[0]-t)*2),a=0,s=!1;t<e[0]&&!s;){var l=e[t++];if(l<r.TEXT_COMPACTION_MODE_LATCH)i[a]=l/30,i[a+1]=l%30,a+=2;else switch(l){case r.TEXT_COMPACTION_MODE_LATCH:i[a++]=r.TEXT_COMPACTION_MODE_LATCH;break;case r.BYTE_COMPACTION_MODE_LATCH:case r.BYTE_COMPACTION_MODE_LATCH_6:case r.NUMERIC_COMPACTION_MODE_LATCH:case r.BEGIN_MACRO_PDF417_CONTROL_BLOCK:case r.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case r.MACRO_PDF417_TERMINATOR:t--,s=!0;break;case r.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:i[a]=r.MODE_SHIFT_TO_BYTE_COMPACTION_MODE,l=e[t++],o[a]=l,a++;break}}return r.decodeTextCompaction(i,o,a,n),t},r.decodeTextCompaction=function(e,t,n,i){for(var o=ie.ALPHA,a=ie.ALPHA,s=0;s<n;){var l=e[s],u="";switch(o){case ie.ALPHA:if(l<26)u=String.fromCharCode(65+l);else switch(l){case 26:u=" ";break;case r.LL:o=ie.LOWER;break;case r.ML:o=ie.MIXED;break;case r.PS:a=o,o=ie.PUNCT_SHIFT;break;case r.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:i.append(t[s]);break;case r.TEXT_COMPACTION_MODE_LATCH:o=ie.ALPHA;break}break;case ie.LOWER:if(l<26)u=String.fromCharCode(97+l);else switch(l){case 26:u=" ";break;case r.AS:a=o,o=ie.ALPHA_SHIFT;break;case r.ML:o=ie.MIXED;break;case r.PS:a=o,o=ie.PUNCT_SHIFT;break;case r.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:i.append(t[s]);break;case r.TEXT_COMPACTION_MODE_LATCH:o=ie.ALPHA;break}break;case ie.MIXED:if(l<r.PL)u=r.MIXED_CHARS[l];else switch(l){case r.PL:o=ie.PUNCT;break;case 26:u=" ";break;case r.LL:o=ie.LOWER;break;case r.AL:o=ie.ALPHA;break;case r.PS:a=o,o=ie.PUNCT_SHIFT;break;case r.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:i.append(t[s]);break;case r.TEXT_COMPACTION_MODE_LATCH:o=ie.ALPHA;break}break;case ie.PUNCT:if(l<r.PAL)u=r.PUNCT_CHARS[l];else switch(l){case r.PAL:o=ie.ALPHA;break;case r.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:i.append(t[s]);break;case r.TEXT_COMPACTION_MODE_LATCH:o=ie.ALPHA;break}break;case ie.ALPHA_SHIFT:if(o=a,l<26)u=String.fromCharCode(65+l);else switch(l){case 26:u=" ";break;case r.TEXT_COMPACTION_MODE_LATCH:o=ie.ALPHA;break}break;case ie.PUNCT_SHIFT:if(o=a,l<r.PAL)u=r.PUNCT_CHARS[l];else switch(l){case r.PAL:o=ie.ALPHA;break;case r.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:i.append(t[s]);break;case r.TEXT_COMPACTION_MODE_LATCH:o=ie.ALPHA;break}break}u!==""&&i.append(u),s++}},r.byteCompaction=function(e,t,n,i,o){var a=new Ad,s=0,l=0,u=!1;switch(e){case r.BYTE_COMPACTION_MODE_LATCH:for(var c=new Int32Array(6),f=t[i++];i<t[0]&&!u;)switch(c[s++]=f,l=900*l+f,f=t[i++],f){case r.TEXT_COMPACTION_MODE_LATCH:case r.BYTE_COMPACTION_MODE_LATCH:case r.NUMERIC_COMPACTION_MODE_LATCH:case r.BYTE_COMPACTION_MODE_LATCH_6:case r.BEGIN_MACRO_PDF417_CONTROL_BLOCK:case r.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case r.MACRO_PDF417_TERMINATOR:i--,u=!0;break;default:if(s%5===0&&s>0){for(var h=0;h<6;++h)a.write(Number(gt(l)>>gt(8*(5-h))));l=0,s=0}break}i===t[0]&&f<r.TEXT_COMPACTION_MODE_LATCH&&(c[s++]=f);for(var v=0;v<s;v++)a.write(c[v]);break;case r.BYTE_COMPACTION_MODE_LATCH_6:for(;i<t[0]&&!u;){var p=t[i++];if(p<r.TEXT_COMPACTION_MODE_LATCH)s++,l=900*l+p;else switch(p){case r.TEXT_COMPACTION_MODE_LATCH:case r.BYTE_COMPACTION_MODE_LATCH:case r.NUMERIC_COMPACTION_MODE_LATCH:case r.BYTE_COMPACTION_MODE_LATCH_6:case r.BEGIN_MACRO_PDF417_CONTROL_BLOCK:case r.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case r.MACRO_PDF417_TERMINATOR:i--,u=!0;break}if(s%5===0&&s>0){for(var h=0;h<6;++h)a.write(Number(gt(l)>>gt(8*(5-h))));l=0,s=0}}break}return o.append(je.decode(a.toByteArray(),n)),i},r.numericCompaction=function(e,t,n){for(var i=0,o=!1,a=new Int32Array(r.MAX_NUMERIC_CODEWORDS);t<e[0]&&!o;){var s=e[t++];if(t===e[0]&&(o=!0),s<r.TEXT_COMPACTION_MODE_LATCH)a[i]=s,i++;else switch(s){case r.TEXT_COMPACTION_MODE_LATCH:case r.BYTE_COMPACTION_MODE_LATCH:case r.BYTE_COMPACTION_MODE_LATCH_6:case r.BEGIN_MACRO_PDF417_CONTROL_BLOCK:case r.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case r.MACRO_PDF417_TERMINATOR:t--,o=!0;break}(i%r.MAX_NUMERIC_CODEWORDS===0||s===r.NUMERIC_COMPACTION_MODE_LATCH||o)&&i>0&&(n.append(r.decodeBase900toBase10(a,i)),i=0)}return t},r.decodeBase900toBase10=function(e,t){for(var n=gt(0),i=0;i<t;i++)n+=r.EXP900[t-i-1]*gt(e[i]);var o=n.toString();if(o.charAt(0)!=="1")throw new k;return o.substring(1)},r.TEXT_COMPACTION_MODE_LATCH=900,r.BYTE_COMPACTION_MODE_LATCH=901,r.NUMERIC_COMPACTION_MODE_LATCH=902,r.BYTE_COMPACTION_MODE_LATCH_6=924,r.ECI_USER_DEFINED=925,r.ECI_GENERAL_PURPOSE=926,r.ECI_CHARSET=927,r.BEGIN_MACRO_PDF417_CONTROL_BLOCK=928,r.BEGIN_MACRO_PDF417_OPTIONAL_FIELD=923,r.MACRO_PDF417_TERMINATOR=922,r.MODE_SHIFT_TO_BYTE_COMPACTION_MODE=913,r.MAX_NUMERIC_CODEWORDS=15,r.MACRO_PDF417_OPTIONAL_FIELD_FILE_NAME=0,r.MACRO_PDF417_OPTIONAL_FIELD_SEGMENT_COUNT=1,r.MACRO_PDF417_OPTIONAL_FIELD_TIME_STAMP=2,r.MACRO_PDF417_OPTIONAL_FIELD_SENDER=3,r.MACRO_PDF417_OPTIONAL_FIELD_ADDRESSEE=4,r.MACRO_PDF417_OPTIONAL_FIELD_FILE_SIZE=5,r.MACRO_PDF417_OPTIONAL_FIELD_CHECKSUM=6,r.PL=25,r.LL=27,r.AS=27,r.ML=28,r.AL=28,r.PS=29,r.PAL=29,r.PUNCT_CHARS=`;<>@[\\]_\`~!\r ,:
|
|
52
|
+
-.$/"|*()?{}'`,r.MIXED_CHARS="0123456789&\r ,:#-.$/+%*=^",r.EXP900=za()?Ed():[],r.NUMBER_OF_SEQUENCE_CODEWORDS=2,r}(),dr=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.")},Sd=function(){function r(){}return r.decode=function(e,t,n,i,o,a,s){for(var l=new gi(e,t,n,i,o),u=null,c=null,f,h=!0;;h=!1){if(t!=null&&(u=r.getRowIndicatorColumn(e,l,t,!0,a,s)),i!=null&&(c=r.getRowIndicatorColumn(e,l,i,!1,a,s)),f=r.merge(u,c),f==null)throw D.getNotFoundInstance();var v=f.getBoundingBox();if(h&&v!=null&&(v.getMinY()<l.getMinY()||v.getMaxY()>l.getMaxY()))l=v;else break}f.setBoundingBox(l);var p=f.getBarcodeColumnCount()+1;f.setDetectionResultColumn(0,u),f.setDetectionResultColumn(p,c);for(var g=u!=null,m=1;m<=p;m++){var y=g?m:p-m;if(f.getDetectionResultColumn(y)===void 0){var C=void 0;y===0||y===p?C=new Ra(l,y===0):C=new La(l),f.setDetectionResultColumn(y,C);for(var w=-1,E=w,I=l.getMinY();I<=l.getMaxY();I++){if(w=r.getStartColumn(f,y,I,g),w<0||w>l.getMaxX()){if(E===-1)continue;w=E}var S=r.detectCodeword(e,l.getMinX(),l.getMaxX(),g,w,I,a,s);S!=null&&(C.setCodeword(I,S),E=w,a=Math.min(a,S.getWidth()),s=Math.max(s,S.getWidth()))}}}return r.createDecoderResult(f)},r.merge=function(e,t){if(e==null&&t==null)return null;var n=r.getBarcodeMetadata(e,t);if(n==null)return null;var i=gi.merge(r.adjustBoundingBox(e),r.adjustBoundingBox(t));return new hd(n,i)},r.adjustBoundingBox=function(e){var t,n;if(e==null)return null;var i=e.getRowHeights();if(i==null)return null;var o=r.getMax(i),a=0;try{for(var s=dr(i),l=s.next();!l.done;l=s.next()){var u=l.value;if(a+=o-u,u>0)break}}catch(v){t={error:v}}finally{try{l&&!l.done&&(n=s.return)&&n.call(s)}finally{if(t)throw t.error}}for(var c=e.getCodewords(),f=0;a>0&&c[f]==null;f++)a--;for(var h=0,f=i.length-1;f>=0&&(h+=o-i[f],!(i[f]>0));f--);for(var f=c.length-1;h>0&&c[f]==null;f--)h--;return e.getBoundingBox().addMissingRows(a,h,e.isLeft())},r.getMax=function(e){var t,n,i=-1;try{for(var o=dr(e),a=o.next();!a.done;a=o.next()){var s=a.value;i=Math.max(i,s)}}catch(l){t={error:l}}finally{try{a&&!a.done&&(n=o.return)&&n.call(o)}finally{if(t)throw t.error}}return i},r.getBarcodeMetadata=function(e,t){var n;if(e==null||(n=e.getBarcodeMetadata())==null)return t==null?null:t.getBarcodeMetadata();var i;return t==null||(i=t.getBarcodeMetadata())==null?n:n.getColumnCount()!==i.getColumnCount()&&n.getErrorCorrectionLevel()!==i.getErrorCorrectionLevel()&&n.getRowCount()!==i.getRowCount()?null:n},r.getRowIndicatorColumn=function(e,t,n,i,o,a){for(var s=new Ra(t,i),l=0;l<2;l++)for(var u=l===0?1:-1,c=Math.trunc(Math.trunc(n.getX())),f=Math.trunc(Math.trunc(n.getY()));f<=t.getMaxY()&&f>=t.getMinY();f+=u){var h=r.detectCodeword(e,0,e.getWidth(),i,c,f,o,a);h!=null&&(s.setCodeword(f,h),i?c=h.getStartX():c=h.getEndX())}return s},r.adjustCodewordCount=function(e,t){var n=t[0][1],i=n.getValue(),o=e.getBarcodeColumnCount()*e.getBarcodeRowCount()-r.getNumberOfECCodeWords(e.getBarcodeECLevel());if(i.length===0){if(o<1||o>K.MAX_CODEWORDS_IN_BARCODE)throw D.getNotFoundInstance();n.setValue(o)}else i[0]!==o&&n.setValue(o)},r.createDecoderResult=function(e){var t=r.createBarcodeMatrix(e);r.adjustCodewordCount(e,t);for(var n=new Array,i=new Int32Array(e.getBarcodeRowCount()*e.getBarcodeColumnCount()),o=[],a=new Array,s=0;s<e.getBarcodeRowCount();s++)for(var l=0;l<e.getBarcodeColumnCount();l++){var u=t[s][l+1].getValue(),c=s*e.getBarcodeColumnCount()+l;u.length===0?n.push(c):u.length===1?i[c]=u[0]:(a.push(c),o.push(u))}for(var f=new Array(o.length),h=0;h<f.length;h++)f[h]=o[h];return r.createDecoderResultFromAmbiguousValues(e.getBarcodeECLevel(),i,K.toIntArray(n),K.toIntArray(a),f)},r.createDecoderResultFromAmbiguousValues=function(e,t,n,i,o){for(var a=new Int32Array(i.length),s=100;s-- >0;){for(var l=0;l<a.length;l++)t[i[l]]=o[l][a[l]];try{return r.decodeCodewords(t,e,n)}catch(c){var u=c instanceof Ce;if(!u)throw c}if(a.length===0)throw Ce.getChecksumInstance();for(var l=0;l<a.length;l++)if(a[l]<o[l].length-1){a[l]++;break}else if(a[l]=0,l===a.length-1)throw Ce.getChecksumInstance()}throw Ce.getChecksumInstance()},r.createBarcodeMatrix=function(e){for(var t,n,i,o,a=Array.from({length:e.getBarcodeRowCount()},function(){return new Array(e.getBarcodeColumnCount()+2)}),s=0;s<a.length;s++)for(var l=0;l<a[s].length;l++)a[s][l]=new fr;var u=0;try{for(var c=dr(e.getDetectionResultColumns()),f=c.next();!f.done;f=c.next()){var h=f.value;if(h!=null)try{for(var v=(i=void 0,dr(h.getCodewords())),p=v.next();!p.done;p=v.next()){var g=p.value;if(g!=null){var m=g.getRowNumber();if(m>=0){if(m>=a.length)continue;a[m][u].setValue(g.getValue())}}}}catch(y){i={error:y}}finally{try{p&&!p.done&&(o=v.return)&&o.call(v)}finally{if(i)throw i.error}}u++}}catch(y){t={error:y}}finally{try{f&&!f.done&&(n=c.return)&&n.call(c)}finally{if(t)throw t.error}}return a},r.isValidBarcodeColumn=function(e,t){return t>=0&&t<=e.getBarcodeColumnCount()+1},r.getStartColumn=function(e,t,n,i){var o,a,s=i?1:-1,l=null;if(r.isValidBarcodeColumn(e,t-s)&&(l=e.getDetectionResultColumn(t-s).getCodeword(n)),l!=null)return i?l.getEndX():l.getStartX();if(l=e.getDetectionResultColumn(t).getCodewordNearby(n),l!=null)return i?l.getStartX():l.getEndX();if(r.isValidBarcodeColumn(e,t-s)&&(l=e.getDetectionResultColumn(t-s).getCodewordNearby(n)),l!=null)return i?l.getEndX():l.getStartX();for(var u=0;r.isValidBarcodeColumn(e,t-s);){t-=s;try{for(var c=(o=void 0,dr(e.getDetectionResultColumn(t).getCodewords())),f=c.next();!f.done;f=c.next()){var h=f.value;if(h!=null)return(i?h.getEndX():h.getStartX())+s*u*(h.getEndX()-h.getStartX())}}catch(v){o={error:v}}finally{try{f&&!f.done&&(a=c.return)&&a.call(c)}finally{if(o)throw o.error}}u++}return i?e.getBoundingBox().getMinX():e.getBoundingBox().getMaxX()},r.detectCodeword=function(e,t,n,i,o,a,s,l){o=r.adjustCodewordStartColumn(e,t,n,i,o,a);var u=r.getModuleBitCount(e,t,n,i,o,a);if(u==null)return null;var c,f=Q.sum(u);if(i)c=o+f;else{for(var h=0;h<u.length/2;h++){var v=u[h];u[h]=u[u.length-1-h],u[u.length-1-h]=v}c=o,o=c-f}if(!r.checkCodewordSkew(f,s,l))return null;var p=pd.getDecodedValue(u),g=K.getCodeword(p);return g===-1?null:new vd(o,c,r.getCodewordBucketNumber(p),g)},r.getModuleBitCount=function(e,t,n,i,o,a){for(var s=o,l=new Int32Array(8),u=0,c=i?1:-1,f=i;(i?s<n:s>=t)&&u<l.length;)e.get(s,a)===f?(l[u]++,s+=c):(u++,f=!f);return u===l.length||s===(i?n:t)&&u===l.length-1?l:null},r.getNumberOfECCodeWords=function(e){return 2<<e},r.adjustCodewordStartColumn=function(e,t,n,i,o,a){for(var s=o,l=i?-1:1,u=0;u<2;u++){for(;(i?s>=t:s<n)&&i===e.get(s,a);){if(Math.abs(o-s)>r.CODEWORD_SKEW_SIZE)return o;s+=l}l=-l,i=!i}return s},r.checkCodewordSkew=function(e,t,n){return t-r.CODEWORD_SKEW_SIZE<=e&&e<=n+r.CODEWORD_SKEW_SIZE},r.decodeCodewords=function(e,t,n){if(e.length===0)throw k.getFormatInstance();var i=1<<t+1,o=r.correctErrors(e,n,i);r.verifyCodewordCount(e,i);var a=Id.decode(e,""+t);return a.setErrorsCorrected(o),a.setErasures(n.length),a},r.correctErrors=function(e,t,n){if(t!=null&&t.length>n/2+r.MAX_ERRORS||n<0||n>r.MAX_EC_CODEWORDS)throw Ce.getChecksumInstance();return r.errorCorrection.decode(e,n,t)},r.verifyCodewordCount=function(e,t){if(e.length<4)throw k.getFormatInstance();var n=e[0];if(n>e.length)throw k.getFormatInstance();if(n===0)if(t<e.length)e[0]=e.length-t;else throw k.getFormatInstance()},r.getBitCountForCodeword=function(e){for(var t=new Int32Array(8),n=0,i=t.length-1;!((e&1)!==n&&(n=e&1,i--,i<0));)t[i]++,e>>=1;return t},r.getCodewordBucketNumber=function(e){return e instanceof Int32Array?this.getCodewordBucketNumber_Int32Array(e):this.getCodewordBucketNumber_number(e)},r.getCodewordBucketNumber_number=function(e){return r.getCodewordBucketNumber(r.getBitCountForCodeword(e))},r.getCodewordBucketNumber_Int32Array=function(e){return(e[0]-e[2]+e[4]-e[6]+9)%9},r.toString=function(e){for(var t=new xi,n=0;n<e.length;n++){t.format("Row %2d: ",n);for(var i=0;i<e[n].length;i++){var o=e[n][i];o.getValue().length===0?t.format(" ",null):t.format("%4d(%2d)",o.getValue()[0],o.getConfidence(o.getValue()[0]))}t.format("%n")}return t.toString()},r.CODEWORD_SKEW_SIZE=2,r.MAX_ERRORS=3,r.MAX_EC_CODEWORDS=512,r.errorCorrection=new ad,r}(),bd=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.")},Ci=function(){function r(){}return r.prototype.decode=function(e,t){t===void 0&&(t=null);var n=r.decode(e,t,!1);if(n==null||n.length===0||n[0]==null)throw D.getNotFoundInstance();return n[0]},r.prototype.decodeMultiple=function(e,t){t===void 0&&(t=null);try{return r.decode(e,t,!0)}catch(n){throw n instanceof k||n instanceof Ce?D.getNotFoundInstance():n}},r.decode=function(e,t,n){var i,o,a=new Array,s=ed.detectMultiple(e,t,n);try{for(var l=bd(s.getPoints()),u=l.next();!u.done;u=l.next()){var c=u.value,f=Sd.decode(s.getBits(),c[4],c[5],c[6],c[7],r.getMinCodewordWidth(c),r.getMaxCodewordWidth(c)),h=new Oe(f.getText(),f.getRawBytes(),void 0,c,H.PDF_417);h.putMetadata(Ie.ERROR_CORRECTION_LEVEL,f.getECLevel());var v=f.getOther();v!=null&&h.putMetadata(Ie.PDF417_EXTRA_METADATA,v),a.push(h)}}catch(p){i={error:p}}finally{try{u&&!u.done&&(o=l.return)&&o.call(l)}finally{if(i)throw i.error}}return a.map(function(p){return p})},r.getMaxWidth=function(e,t){return e==null||t==null?0:Math.trunc(Math.abs(e.getX()-t.getX()))},r.getMinWidth=function(e,t){return e==null||t==null?Y.MAX_VALUE:Math.trunc(Math.abs(e.getX()-t.getX()))},r.getMaxCodewordWidth=function(e){return Math.floor(Math.max(Math.max(r.getMaxWidth(e[0],e[4]),r.getMaxWidth(e[6],e[2])*K.MODULES_IN_CODEWORD/K.MODULES_IN_STOP_PATTERN),Math.max(r.getMaxWidth(e[1],e[5]),r.getMaxWidth(e[7],e[3])*K.MODULES_IN_CODEWORD/K.MODULES_IN_STOP_PATTERN)))},r.getMinCodewordWidth=function(e){return Math.floor(Math.min(Math.min(r.getMinWidth(e[0],e[4]),r.getMinWidth(e[6],e[2])*K.MODULES_IN_CODEWORD/K.MODULES_IN_STOP_PATTERN),Math.min(r.getMinWidth(e[1],e[5]),r.getMinWidth(e[7],e[3])*K.MODULES_IN_CODEWORD/K.MODULES_IN_STOP_PATTERN)))},r.prototype.reset=function(){},r}(),Td=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)i.hasOwnProperty(o)&&(n[o]=i[o])},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)}}(),Ua=function(r){Td(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.kind="ReaderException",e}(Re),Ha=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.")},Od=function(){function r(){}return r.prototype.decode=function(e,t){return this.setHints(t),this.decodeInternal(e)},r.prototype.decodeWithState=function(e){return(this.readers===null||this.readers===void 0)&&this.setHints(null),this.decodeInternal(e)},r.prototype.setHints=function(e){this.hints=e;var t=e!=null&&e.get(fe.TRY_HARDER)!==void 0,n=e==null?null:e.get(fe.POSSIBLE_FORMATS),i=new Array;if(n!=null){var o=n.some(function(a){return a===H.UPC_A||a===H.UPC_E||a===H.EAN_13||a===H.EAN_8||a===H.CODABAR||a===H.CODE_39||a===H.CODE_93||a===H.CODE_128||a===H.ITF||a===H.RSS_14||a===H.RSS_EXPANDED});o&&!t&&i.push(new ur(e)),n.includes(H.QR_CODE)&&i.push(new pi),n.includes(H.DATA_MATRIX)&&i.push(new vi),n.includes(H.AZTEC)&&i.push(new si),n.includes(H.PDF_417)&&i.push(new Ci),o&&t&&i.push(new ur(e))}i.length===0&&(t||i.push(new ur(e)),i.push(new pi),i.push(new vi),i.push(new si),i.push(new Ci),t&&i.push(new ur(e))),this.readers=i},r.prototype.reset=function(){var e,t;if(this.readers!==null)try{for(var n=Ha(this.readers),i=n.next();!i.done;i=n.next()){var o=i.value;o.reset()}}catch(a){e={error:a}}finally{try{i&&!i.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}},r.prototype.decodeInternal=function(e){var t,n;if(this.readers===null)throw new Ua("No readers where selected, nothing can be read.");try{for(var i=Ha(this.readers),o=i.next();!o.done;o=i.next()){var a=o.value;try{return a.decode(e,this.hints)}catch(s){if(s instanceof Ua)continue}}}catch(s){t={error:s}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}throw new D("No MultiFormat Readers were able to detect the code.")},r}(),Nd=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)i.hasOwnProperty(o)&&(n[o]=i[o])},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)}}();(function(r){Nd(e,r);function e(t,n){t===void 0&&(t=null),n===void 0&&(n=500);var i=this,o=new Od;return o.setHints(t),i=r.call(this,o,n)||this,i}return e.prototype.decodeBitmap=function(t){return this.reader.decodeWithState(t)},e})(Vt);var Dd=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)i.hasOwnProperty(o)&&(n[o]=i[o])},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)}}();(function(r){Dd(e,r);function e(t){return t===void 0&&(t=500),r.call(this,new Ci,t)||this}return e})(Vt);var Md=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)i.hasOwnProperty(o)&&(n[o]=i[o])},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)}}();(function(r){Md(e,r);function e(t){return t===void 0&&(t=500),r.call(this,new pi,t)||this}return e})(Vt);var mi;(function(r){r[r.ERROR_CORRECTION=0]="ERROR_CORRECTION",r[r.CHARACTER_SET=1]="CHARACTER_SET",r[r.DATA_MATRIX_SHAPE=2]="DATA_MATRIX_SHAPE",r[r.DATA_MATRIX_COMPACT=3]="DATA_MATRIX_COMPACT",r[r.MIN_SIZE=4]="MIN_SIZE",r[r.MAX_SIZE=5]="MAX_SIZE",r[r.MARGIN=6]="MARGIN",r[r.PDF417_COMPACT=7]="PDF417_COMPACT",r[r.PDF417_COMPACTION=8]="PDF417_COMPACTION",r[r.PDF417_DIMENSIONS=9]="PDF417_DIMENSIONS",r[r.AZTEC_LAYERS=10]="AZTEC_LAYERS",r[r.QR_VERSION=11]="QR_VERSION",r[r.GS1_FORMAT=12]="GS1_FORMAT",r[r.FORCE_C40=13]="FORCE_C40"})(mi||(mi={}));const rn=mi;var Ga=function(){function r(e){this.field=e,this.cachedGenerators=[],this.cachedGenerators.push(new ht(e,Int32Array.from([1])))}return r.prototype.buildGenerator=function(e){var t=this.cachedGenerators;if(e>=t.length)for(var n=t[t.length-1],i=this.field,o=t.length;o<=e;o++){var a=n.multiply(new ht(i,Int32Array.from([1,i.exp(o-1+i.getGeneratorBase())])));t.push(a),n=a}return t[e]},r.prototype.encode=function(e,t){if(t===0)throw new $("No error correction bytes");var n=e.length-t;if(n<=0)throw new $("No data bytes provided");var i=this.buildGenerator(t),o=new Int32Array(n);se.arraycopy(e,0,o,0,n);var a=new ht(this.field,o);a=a.multiplyByMonomial(t,1);for(var s=a.divide(i)[1],l=s.getCoefficients(),u=t-l.length,c=0;c<u;c++)e[n+c]=0;se.arraycopy(l,0,e,n+u,l.length)},r}(),hr=function(){function r(){}return r.applyMaskPenaltyRule1=function(e){return r.applyMaskPenaltyRule1Internal(e,!0)+r.applyMaskPenaltyRule1Internal(e,!1)},r.applyMaskPenaltyRule2=function(e){for(var t=0,n=e.getArray(),i=e.getWidth(),o=e.getHeight(),a=0;a<o-1;a++)for(var s=n[a],l=0;l<i-1;l++){var u=s[l];u===s[l+1]&&u===n[a+1][l]&&u===n[a+1][l+1]&&t++}return r.N2*t},r.applyMaskPenaltyRule3=function(e){for(var t=0,n=e.getArray(),i=e.getWidth(),o=e.getHeight(),a=0;a<o;a++)for(var s=0;s<i;s++){var l=n[a];s+6<i&&l[s]===1&&l[s+1]===0&&l[s+2]===1&&l[s+3]===1&&l[s+4]===1&&l[s+5]===0&&l[s+6]===1&&(r.isWhiteHorizontal(l,s-4,s)||r.isWhiteHorizontal(l,s+7,s+11))&&t++,a+6<o&&n[a][s]===1&&n[a+1][s]===0&&n[a+2][s]===1&&n[a+3][s]===1&&n[a+4][s]===1&&n[a+5][s]===0&&n[a+6][s]===1&&(r.isWhiteVertical(n,s,a-4,a)||r.isWhiteVertical(n,s,a+7,a+11))&&t++}return t*r.N3},r.isWhiteHorizontal=function(e,t,n){t=Math.max(t,0),n=Math.min(n,e.length);for(var i=t;i<n;i++)if(e[i]===1)return!1;return!0},r.isWhiteVertical=function(e,t,n,i){n=Math.max(n,0),i=Math.min(i,e.length);for(var o=n;o<i;o++)if(e[o][t]===1)return!1;return!0},r.applyMaskPenaltyRule4=function(e){for(var t=0,n=e.getArray(),i=e.getWidth(),o=e.getHeight(),a=0;a<o;a++)for(var s=n[a],l=0;l<i;l++)s[l]===1&&t++;var u=e.getHeight()*e.getWidth(),c=Math.floor(Math.abs(t*2-u)*10/u);return c*r.N4},r.getDataMaskBit=function(e,t,n){var i,o;switch(e){case 0:i=n+t&1;break;case 1:i=n&1;break;case 2:i=t%3;break;case 3:i=(n+t)%3;break;case 4:i=Math.floor(n/2)+Math.floor(t/3)&1;break;case 5:o=n*t,i=(o&1)+o%3;break;case 6:o=n*t,i=(o&1)+o%3&1;break;case 7:o=n*t,i=o%3+(n+t&1)&1;break;default:throw new $("Invalid mask pattern: "+e)}return i===0},r.applyMaskPenaltyRule1Internal=function(e,t){for(var n=0,i=t?e.getHeight():e.getWidth(),o=t?e.getWidth():e.getHeight(),a=e.getArray(),s=0;s<i;s++){for(var l=0,u=-1,c=0;c<o;c++){var f=t?a[s][c]:a[c][s];f===u?l++:(l>=5&&(n+=r.N1+(l-5)),l=1,u=f)}l>=5&&(n+=r.N1+(l-5))}return n},r.N1=3,r.N2=3,r.N3=40,r.N4=10,r}(),Pd=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.")},Fd=function(){function r(e,t){this.width=e,this.height=t;for(var n=new Array(t),i=0;i!==t;i++)n[i]=new Uint8Array(e);this.bytes=n}return r.prototype.getHeight=function(){return this.height},r.prototype.getWidth=function(){return this.width},r.prototype.get=function(e,t){return this.bytes[t][e]},r.prototype.getArray=function(){return this.bytes},r.prototype.setNumber=function(e,t,n){this.bytes[t][e]=n},r.prototype.setBoolean=function(e,t,n){this.bytes[t][e]=n?1:0},r.prototype.clear=function(e){var t,n;try{for(var i=Pd(this.bytes),o=i.next();!o.done;o=i.next()){var a=o.value;de.fill(a,e)}}catch(s){t={error:s}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}},r.prototype.equals=function(e){if(!(e instanceof r))return!1;var t=e;if(this.width!==t.width||this.height!==t.height)return!1;for(var n=0,i=this.height;n<i;++n)for(var o=this.bytes[n],a=t.bytes[n],s=0,l=this.width;s<l;++s)if(o[s]!==a[s])return!1;return!0},r.prototype.toString=function(){for(var e=new q,t=0,n=this.height;t<n;++t){for(var i=this.bytes[t],o=0,a=this.width;o<a;++o)switch(i[o]){case 0:e.append(" 0");break;case 1:e.append(" 1");break;default:e.append(" ");break}e.append(`
|
|
53
|
+
`)}return e.toString()},r}(),wi=function(){function r(){this.maskPattern=-1}return r.prototype.getMode=function(){return this.mode},r.prototype.getECLevel=function(){return this.ecLevel},r.prototype.getVersion=function(){return this.version},r.prototype.getMaskPattern=function(){return this.maskPattern},r.prototype.getMatrix=function(){return this.matrix},r.prototype.toString=function(){var e=new q;return e.append(`<<
|
|
54
54
|
`),e.append(" mode: "),e.append(this.mode?this.mode.toString():"null"),e.append(`
|
|
55
55
|
ecLevel: `),e.append(this.ecLevel?this.ecLevel.toString():"null"),e.append(`
|
|
56
56
|
version: `),e.append(this.version?this.version.toString():"null"),e.append(`
|
|
@@ -59,6 +59,6 @@ For more information, see https://radix-ui.com/primitives/docs/components/${e.do
|
|
|
59
59
|
`),e.append(this.matrix.toString())):e.append(`
|
|
60
60
|
matrix: null
|
|
61
61
|
`),e.append(`>>
|
|
62
|
-
`),e.toString()},r.prototype.setMode=function(e){this.mode=e},r.prototype.setECLevel=function(e){this.ecLevel=e},r.prototype.setVersion=function(e){this.version=e},r.prototype.setMaskPattern=function(e){this.maskPattern=e},r.prototype.setMatrix=function(e){this.matrix=e},r.isValidMaskPattern=function(e){return e>=0&&e<r.NUM_MASK_PATTERNS},r.NUM_MASK_PATTERNS=8,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)}}(),ie=function(r){Ll(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.kind="WriterException",e}(Fe),yo=function(){function r(){}return r.clearMatrix=function(e){e.clear(255)},r.buildMatrix=function(e,t,n,i,a){r.clearMatrix(a),r.embedBasicPatterns(n,a),r.embedTypeInfo(t,i,a),r.maybeEmbedVersionInfo(n,a),r.embedDataBits(e,i,a)},r.embedBasicPatterns=function(e,t){r.embedPositionDetectionPatternsAndSeparators(t),r.embedDarkDotAtLeftBottomCorner(t),r.maybeEmbedPositionAdjustmentPatterns(e,t),r.embedTimingPatterns(t)},r.embedTypeInfo=function(e,t,n){var i=new ge;r.makeTypeInfoBits(e,t,i);for(var a=0,o=i.getSize();a<o;++a){var s=i.get(i.getSize()-1-a),f=r.TYPE_INFO_COORDINATES[a],u=f[0],c=f[1];if(n.setBoolean(u,c,s),a<8){var l=n.getWidth()-a-1,d=8;n.setBoolean(l,d,s)}else{var l=8,d=n.getHeight()-7+(a-8);n.setBoolean(l,d,s)}}},r.maybeEmbedVersionInfo=function(e,t){if(!(e.getVersionNumber()<7)){var n=new ge;r.makeVersionInfoBits(e,n);for(var i=17,a=0;a<6;++a)for(var o=0;o<3;++o){var s=n.get(i);i--,t.setBoolean(a,t.getHeight()-11+o,s),t.setBoolean(t.getHeight()-11+o,a,s)}}},r.embedDataBits=function(e,t,n){for(var i=0,a=-1,o=n.getWidth()-1,s=n.getHeight()-1;o>0;){for(o===6&&(o-=1);s>=0&&s<n.getHeight();){for(var f=0;f<2;++f){var u=o-f;if(r.isEmpty(n.get(u,s))){var c=void 0;i<e.getSize()?(c=e.get(i),++i):c=!1,t!==255&&nr.getDataMaskBit(t,u,s)&&(c=!c),n.setBoolean(u,s,c)}}s+=a}a=-a,s+=a,o-=2}if(i!==e.getSize())throw new ie("Not all bits consumed: "+i+"/"+e.getSize())},r.findMSBSet=function(e){return 32-G.numberOfLeadingZeros(e)},r.calculateBCHCode=function(e,t){if(t===0)throw new V("0 polynomial");var n=r.findMSBSet(t);for(e<<=n-1;r.findMSBSet(e)>=n;)e^=t<<r.findMSBSet(e)-n;return e},r.makeTypeInfoBits=function(e,t,n){if(!ei.isValidMaskPattern(t))throw new ie("Invalid mask pattern");var i=e.getBits()<<3|t;n.appendBits(i,5);var a=r.calculateBCHCode(i,r.TYPE_INFO_POLY);n.appendBits(a,10);var o=new ge;if(o.appendBits(r.TYPE_INFO_MASK_PATTERN,15),n.xor(o),n.getSize()!==15)throw new ie("should not happen but we got: "+n.getSize())},r.makeVersionInfoBits=function(e,t){t.appendBits(e.getVersionNumber(),6);var n=r.calculateBCHCode(e.getVersionNumber(),r.VERSION_INFO_POLY);if(t.appendBits(n,12),t.getSize()!==18)throw new ie("should not happen but we got: "+t.getSize())},r.isEmpty=function(e){return e===255},r.embedTimingPatterns=function(e){for(var t=8;t<e.getWidth()-8;++t){var n=(t+1)%2;r.isEmpty(e.get(t,6))&&e.setNumber(t,6,n),r.isEmpty(e.get(6,t))&&e.setNumber(6,t,n)}},r.embedDarkDotAtLeftBottomCorner=function(e){if(e.get(8,e.getHeight()-8)===0)throw new ie;e.setNumber(8,e.getHeight()-8,1)},r.embedHorizontalSeparationPattern=function(e,t,n){for(var i=0;i<8;++i){if(!r.isEmpty(n.get(e+i,t)))throw new ie;n.setNumber(e+i,t,0)}},r.embedVerticalSeparationPattern=function(e,t,n){for(var i=0;i<7;++i){if(!r.isEmpty(n.get(e,t+i)))throw new ie;n.setNumber(e,t+i,0)}},r.embedPositionAdjustmentPattern=function(e,t,n){for(var i=0;i<5;++i)for(var a=r.POSITION_ADJUSTMENT_PATTERN[i],o=0;o<5;++o)n.setNumber(e+o,t+i,a[o])},r.embedPositionDetectionPattern=function(e,t,n){for(var i=0;i<7;++i)for(var a=r.POSITION_DETECTION_PATTERN[i],o=0;o<7;++o)n.setNumber(e+o,t+i,a[o])},r.embedPositionDetectionPatternsAndSeparators=function(e){var t=r.POSITION_DETECTION_PATTERN[0].length;r.embedPositionDetectionPattern(0,0,e),r.embedPositionDetectionPattern(e.getWidth()-t,0,e),r.embedPositionDetectionPattern(0,e.getWidth()-t,e);var n=8;r.embedHorizontalSeparationPattern(0,n-1,e),r.embedHorizontalSeparationPattern(e.getWidth()-n,n-1,e),r.embedHorizontalSeparationPattern(0,e.getWidth()-n,e);var i=7;r.embedVerticalSeparationPattern(i,0,e),r.embedVerticalSeparationPattern(e.getHeight()-i-1,0,e),r.embedVerticalSeparationPattern(i,e.getHeight()-i,e)},r.maybeEmbedPositionAdjustmentPatterns=function(e,t){if(!(e.getVersionNumber()<2))for(var n=e.getVersionNumber()-1,i=r.POSITION_ADJUSTMENT_PATTERN_COORDINATE_TABLE[n],a=0,o=i.length;a!==o;a++){var s=i[a];if(s>=0)for(var f=0;f!==o;f++){var u=i[f];u>=0&&r.isEmpty(t.get(u,s))&&r.embedPositionAdjustmentPattern(u-2,s-2,t)}}},r.POSITION_DETECTION_PATTERN=Array.from([Int32Array.from([1,1,1,1,1,1,1]),Int32Array.from([1,0,0,0,0,0,1]),Int32Array.from([1,0,1,1,1,0,1]),Int32Array.from([1,0,1,1,1,0,1]),Int32Array.from([1,0,1,1,1,0,1]),Int32Array.from([1,0,0,0,0,0,1]),Int32Array.from([1,1,1,1,1,1,1])]),r.POSITION_ADJUSTMENT_PATTERN=Array.from([Int32Array.from([1,1,1,1,1]),Int32Array.from([1,0,0,0,1]),Int32Array.from([1,0,1,0,1]),Int32Array.from([1,0,0,0,1]),Int32Array.from([1,1,1,1,1])]),r.POSITION_ADJUSTMENT_PATTERN_COORDINATE_TABLE=Array.from([Int32Array.from([-1,-1,-1,-1,-1,-1,-1]),Int32Array.from([6,18,-1,-1,-1,-1,-1]),Int32Array.from([6,22,-1,-1,-1,-1,-1]),Int32Array.from([6,26,-1,-1,-1,-1,-1]),Int32Array.from([6,30,-1,-1,-1,-1,-1]),Int32Array.from([6,34,-1,-1,-1,-1,-1]),Int32Array.from([6,22,38,-1,-1,-1,-1]),Int32Array.from([6,24,42,-1,-1,-1,-1]),Int32Array.from([6,26,46,-1,-1,-1,-1]),Int32Array.from([6,28,50,-1,-1,-1,-1]),Int32Array.from([6,30,54,-1,-1,-1,-1]),Int32Array.from([6,32,58,-1,-1,-1,-1]),Int32Array.from([6,34,62,-1,-1,-1,-1]),Int32Array.from([6,26,46,66,-1,-1,-1]),Int32Array.from([6,26,48,70,-1,-1,-1]),Int32Array.from([6,26,50,74,-1,-1,-1]),Int32Array.from([6,30,54,78,-1,-1,-1]),Int32Array.from([6,30,56,82,-1,-1,-1]),Int32Array.from([6,30,58,86,-1,-1,-1]),Int32Array.from([6,34,62,90,-1,-1,-1]),Int32Array.from([6,28,50,72,94,-1,-1]),Int32Array.from([6,26,50,74,98,-1,-1]),Int32Array.from([6,30,54,78,102,-1,-1]),Int32Array.from([6,28,54,80,106,-1,-1]),Int32Array.from([6,32,58,84,110,-1,-1]),Int32Array.from([6,30,58,86,114,-1,-1]),Int32Array.from([6,34,62,90,118,-1,-1]),Int32Array.from([6,26,50,74,98,122,-1]),Int32Array.from([6,30,54,78,102,126,-1]),Int32Array.from([6,26,52,78,104,130,-1]),Int32Array.from([6,30,56,82,108,134,-1]),Int32Array.from([6,34,60,86,112,138,-1]),Int32Array.from([6,30,58,86,114,142,-1]),Int32Array.from([6,34,62,90,118,146,-1]),Int32Array.from([6,30,54,78,102,126,150]),Int32Array.from([6,24,50,76,102,128,154]),Int32Array.from([6,28,54,80,106,132,158]),Int32Array.from([6,32,58,84,110,136,162]),Int32Array.from([6,26,54,82,110,138,166]),Int32Array.from([6,30,58,86,114,142,170])]),r.TYPE_INFO_COORDINATES=Array.from([Int32Array.from([8,0]),Int32Array.from([8,1]),Int32Array.from([8,2]),Int32Array.from([8,3]),Int32Array.from([8,4]),Int32Array.from([8,5]),Int32Array.from([8,7]),Int32Array.from([8,8]),Int32Array.from([7,8]),Int32Array.from([5,8]),Int32Array.from([4,8]),Int32Array.from([3,8]),Int32Array.from([2,8]),Int32Array.from([1,8]),Int32Array.from([0,8])]),r.VERSION_INFO_POLY=7973,r.TYPE_INFO_POLY=1335,r.TYPE_INFO_MASK_PATTERN=21522,r}(),kl=function(){function r(e,t){this.dataBytes=e,this.errorCorrectionBytes=t}return r.prototype.getDataBytes=function(){return this.dataBytes},r.prototype.getErrorCorrectionBytes=function(){return this.errorCorrectionBytes},r}(),wo=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.")};(function(){function r(){}return r.calculateMaskPenalty=function(e){return nr.applyMaskPenaltyRule1(e)+nr.applyMaskPenaltyRule2(e)+nr.applyMaskPenaltyRule3(e)+nr.applyMaskPenaltyRule4(e)},r.encode=function(e,t,n){n===void 0&&(n=null);var i=r.DEFAULT_BYTE_MODE_ENCODING,a=n!==null&&n.get(Vr.CHARACTER_SET)!==void 0;a&&(i=n.get(Vr.CHARACTER_SET).toString());var o=this.chooseMode(e,i),s=new ge;if(o===ne.BYTE&&(a||r.DEFAULT_BYTE_MODE_ENCODING!==i)){var f=ue.getCharacterSetECIByName(i);f!==void 0&&this.appendECI(f,s)}this.appendModeInfo(o,s);var u=new ge;this.appendBytes(e,o,u,i);var c;if(n!==null&&n.get(Vr.QR_VERSION)!==void 0){var l=Number.parseInt(n.get(Vr.QR_VERSION).toString(),10);c=wt.getVersionForNumber(l);var d=this.calculateBitsNeeded(o,s,u,c);if(!this.willFit(d,c,t))throw new ie("Data too big for requested version")}else c=this.recommendVersion(t,o,s,u);var h=new ge;h.appendBitArray(s);var v=o===ne.BYTE?u.getSizeInBytes():e.length;this.appendLengthInfo(v,c,o,h),h.appendBitArray(u);var p=c.getECBlocksForLevel(t),x=c.getTotalCodewords()-p.getTotalECCodewords();this.terminateBits(x,h);var m=this.interleaveWithECBytes(h,c.getTotalCodewords(),x,p.getNumBlocks()),w=new ei;w.setECLevel(t),w.setMode(o),w.setVersion(c);var C=c.getDimensionForVersion(),A=new Bl(C,C),_=this.chooseMaskPattern(m,t,c,A);return w.setMaskPattern(_),yo.buildMatrix(m,t,c,_,A),w.setMatrix(A),w},r.recommendVersion=function(e,t,n,i){var a=this.calculateBitsNeeded(t,n,i,wt.getVersionForNumber(1)),o=this.chooseVersion(a,e),s=this.calculateBitsNeeded(t,n,i,o);return this.chooseVersion(s,e)},r.calculateBitsNeeded=function(e,t,n,i){return t.getSize()+e.getCharacterCountBits(i)+n.getSize()},r.getAlphanumericCode=function(e){return e<r.ALPHANUMERIC_TABLE.length?r.ALPHANUMERIC_TABLE[e]:-1},r.chooseMode=function(e,t){if(t===void 0&&(t=null),ue.SJIS.getName()===t&&this.isOnlyDoubleByteKanji(e))return ne.KANJI;for(var n=!1,i=!1,a=0,o=e.length;a<o;++a){var s=e.charAt(a);if(r.isDigit(s))n=!0;else if(this.getAlphanumericCode(s.charCodeAt(0))!==-1)i=!0;else return ne.BYTE}return i?ne.ALPHANUMERIC:n?ne.NUMERIC:ne.BYTE},r.isOnlyDoubleByteKanji=function(e){var t;try{t=Ve.encode(e,ue.SJIS)}catch{return!1}var n=t.length;if(n%2!==0)return!1;for(var i=0;i<n;i+=2){var a=t[i]&255;if((a<129||a>159)&&(a<224||a>235))return!1}return!0},r.chooseMaskPattern=function(e,t,n,i){for(var a=Number.MAX_SAFE_INTEGER,o=-1,s=0;s<ei.NUM_MASK_PATTERNS;s++){yo.buildMatrix(e,t,n,s,i);var f=this.calculateMaskPenalty(i);f<a&&(a=f,o=s)}return o},r.chooseVersion=function(e,t){for(var n=1;n<=40;n++){var i=wt.getVersionForNumber(n);if(r.willFit(e,i,t))return i}throw new ie("Data too big")},r.willFit=function(e,t,n){var i=t.getTotalCodewords(),a=t.getECBlocksForLevel(n),o=a.getTotalECCodewords(),s=i-o,f=(e+7)/8;return s>=f},r.terminateBits=function(e,t){var n=e*8;if(t.getSize()>n)throw new ie("data bits cannot fit in the QR Code"+t.getSize()+" > "+n);for(var i=0;i<4&&t.getSize()<n;++i)t.appendBit(!1);var a=t.getSize()&7;if(a>0)for(var i=a;i<8;i++)t.appendBit(!1);for(var o=e-t.getSizeInBytes(),i=0;i<o;++i)t.appendBits((i&1)===0?236:17,8);if(t.getSize()!==n)throw new ie("Bits size does not equal capacity")},r.getNumDataBytesAndNumECBytesForBlockID=function(e,t,n,i,a,o){if(i>=n)throw new ie("Block ID too large");var s=e%n,f=n-s,u=Math.floor(e/n),c=u+1,l=Math.floor(t/n),d=l+1,h=u-l,v=c-d;if(h!==v)throw new ie("EC bytes mismatch");if(n!==f+s)throw new ie("RS blocks mismatch");if(e!==(l+h)*f+(d+v)*s)throw new ie("Total bytes mismatch");i<f?(a[0]=l,o[0]=h):(a[0]=d,o[0]=v)},r.interleaveWithECBytes=function(e,t,n,i){var a,o,s,f;if(e.getSizeInBytes()!==n)throw new ie("Number of bits and data bytes does not match");for(var u=0,c=0,l=0,d=new Array,h=0;h<i;++h){var v=new Int32Array(1),p=new Int32Array(1);r.getNumDataBytesAndNumECBytesForBlockID(t,n,i,h,v,p);var x=v[0],m=new Uint8Array(x);e.toBytes(8*u,m,0,x);var w=r.generateECBytes(m,p[0]);d.push(new kl(m,w)),c=Math.max(c,x),l=Math.max(l,w.length),u+=v[0]}if(n!==u)throw new ie("Data bytes does not match offset");for(var C=new ge,h=0;h<c;++h)try{for(var A=(a=void 0,wo(d)),_=A.next();!_.done;_=A.next()){var b=_.value,m=b.getDataBytes();h<m.length&&C.appendBits(m[h],8)}}catch(B){a={error:B}}finally{try{_&&!_.done&&(o=A.return)&&o.call(A)}finally{if(a)throw a.error}}for(var h=0;h<l;++h)try{for(var T=(s=void 0,wo(d)),D=T.next();!D.done;D=T.next()){var b=D.value,w=b.getErrorCorrectionBytes();h<w.length&&C.appendBits(w[h],8)}}catch(B){s={error:B}}finally{try{D&&!D.done&&(f=T.return)&&f.call(T)}finally{if(s)throw s.error}}if(t!==C.getSizeInBytes())throw new ie("Interleaving error: "+t+" and "+C.getSizeInBytes()+" differ.");return C},r.generateECBytes=function(e,t){for(var n=e.length,i=new Int32Array(n+t),a=0;a<n;a++)i[a]=e[a]&255;new xo(Re.QR_CODE_FIELD_256).encode(i,t);for(var o=new Uint8Array(t),a=0;a<t;a++)o[a]=i[n+a];return o},r.appendModeInfo=function(e,t){t.appendBits(e.getBits(),4)},r.appendLengthInfo=function(e,t,n,i){var a=n.getCharacterCountBits(t);if(e>=1<<a)throw new ie(e+" is bigger than "+((1<<a)-1));i.appendBits(e,a)},r.appendBytes=function(e,t,n,i){switch(t){case ne.NUMERIC:r.appendNumericBytes(e,n);break;case ne.ALPHANUMERIC:r.appendAlphanumericBytes(e,n);break;case ne.BYTE:r.append8BitBytes(e,n,i);break;case ne.KANJI:r.appendKanjiBytes(e,n);break;default:throw new ie("Invalid mode: "+t)}},r.getDigit=function(e){return e.charCodeAt(0)-48},r.isDigit=function(e){var t=r.getDigit(e);return t>=0&&t<=9},r.appendNumericBytes=function(e,t){for(var n=e.length,i=0;i<n;){var a=r.getDigit(e.charAt(i));if(i+2<n){var o=r.getDigit(e.charAt(i+1)),s=r.getDigit(e.charAt(i+2));t.appendBits(a*100+o*10+s,10),i+=3}else if(i+1<n){var o=r.getDigit(e.charAt(i+1));t.appendBits(a*10+o,7),i+=2}else t.appendBits(a,4),i++}},r.appendAlphanumericBytes=function(e,t){for(var n=e.length,i=0;i<n;){var a=r.getAlphanumericCode(e.charCodeAt(i));if(a===-1)throw new ie;if(i+1<n){var o=r.getAlphanumericCode(e.charCodeAt(i+1));if(o===-1)throw new ie;t.appendBits(a*45+o,11),i+=2}else t.appendBits(a,6),i++}},r.append8BitBytes=function(e,t,n){var i;try{i=Ve.encode(e,n)}catch(f){throw new ie(f)}for(var a=0,o=i.length;a!==o;a++){var s=i[a];t.appendBits(s,8)}},r.appendKanjiBytes=function(e,t){var n;try{n=Ve.encode(e,ue.SJIS)}catch(l){throw new ie(l)}for(var i=n.length,a=0;a<i;a+=2){var o=n[a]&255,s=n[a+1]&255,f=o<<8&4294967295|s,u=-1;if(f>=33088&&f<=40956?u=f-33088:f>=57408&&f<=60351&&(u=f-49472),u===-1)throw new ie("Invalid byte sequence");var c=(u>>8)*192+(u&255);t.appendBits(c,13)}},r.appendECI=function(e,t){t.appendBits(ne.ECI.getBits(),4),t.appendBits(e.getValue(),8)},r.ALPHANUMERIC_TABLE=Int32Array.from([-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,36,-1,-1,-1,37,38,-1,-1,-1,-1,39,40,-1,41,42,43,0,1,2,3,4,5,6,7,8,9,44,-1,-1,-1,-1,-1,-1,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,-1,-1,-1,-1,-1]),r.DEFAULT_BYTE_MODE_ENCODING=ue.UTF8.getName(),r})();var Ul=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)}}();(function(r){Ul(e,r);function e(t,n,i,a,o,s,f,u){var c=r.call(this,s,f)||this;if(c.yuvData=t,c.dataWidth=n,c.dataHeight=i,c.left=a,c.top=o,a+s>n||o+f>i)throw new V("Crop rectangle does not fit within image data.");return u&&c.reverseHorizontal(s,f),c}return e.prototype.getRow=function(t,n){if(t<0||t>=this.getHeight())throw new V("Requested row is outside the image: "+t);var i=this.getWidth();(n==null||n.length<i)&&(n=new Uint8ClampedArray(i));var a=(t+this.top)*this.dataWidth+this.left;return re.arraycopy(this.yuvData,a,n,0,i),n},e.prototype.getMatrix=function(){var t=this.getWidth(),n=this.getHeight();if(t===this.dataWidth&&n===this.dataHeight)return this.yuvData;var i=t*n,a=new Uint8ClampedArray(i),o=this.top*this.dataWidth+this.left;if(t===this.dataWidth)return re.arraycopy(this.yuvData,o,a,0,i),a;for(var s=0;s<n;s++){var f=s*t;re.arraycopy(this.yuvData,o,a,f,t),o+=this.dataWidth}return a},e.prototype.isCropSupported=function(){return!0},e.prototype.crop=function(t,n,i,a){return new e(this.yuvData,this.dataWidth,this.dataHeight,this.left+t,this.top+n,i,a,!1)},e.prototype.renderThumbnail=function(){for(var t=this.getWidth()/e.THUMBNAIL_SCALE_FACTOR,n=this.getHeight()/e.THUMBNAIL_SCALE_FACTOR,i=new Int32Array(t*n),a=this.yuvData,o=this.top*this.dataWidth+this.left,s=0;s<n;s++){for(var f=s*t,u=0;u<t;u++){var c=a[o+u*e.THUMBNAIL_SCALE_FACTOR]&255;i[f+u]=4278190080|c*65793}o+=this.dataWidth*e.THUMBNAIL_SCALE_FACTOR}return i},e.prototype.getThumbnailWidth=function(){return this.getWidth()/e.THUMBNAIL_SCALE_FACTOR},e.prototype.getThumbnailHeight=function(){return this.getHeight()/e.THUMBNAIL_SCALE_FACTOR},e.prototype.reverseHorizontal=function(t,n){for(var i=this.yuvData,a=0,o=this.top*this.dataWidth+this.left;a<n;a++,o+=this.dataWidth)for(var s=o+t/2,f=o,u=o+t-1;f<s;f++,u--){var c=i[f];i[f]=i[u],i[u]=c}},e.prototype.invert=function(){return new Mn(this)},e.THUMBNAIL_SCALE_FACTOR=2,e})(Dr);var Vl=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)}}();(function(r){Vl(e,r);function e(t,n,i,a,o,s,f){var u=r.call(this,n,i)||this;if(u.dataWidth=a,u.dataHeight=o,u.left=s,u.top=f,t.BYTES_PER_ELEMENT===4){for(var c=n*i,l=new Uint8ClampedArray(c),d=0;d<c;d++){var h=t[d],v=h>>16&255,p=h>>7&510,x=h&255;l[d]=(v+p+x)/4&255}u.luminances=l}else u.luminances=t;if(a===void 0&&(u.dataWidth=n),o===void 0&&(u.dataHeight=i),s===void 0&&(u.left=0),f===void 0&&(u.top=0),u.left+n>u.dataWidth||u.top+i>u.dataHeight)throw new V("Crop rectangle does not fit within image data.");return u}return e.prototype.getRow=function(t,n){if(t<0||t>=this.getHeight())throw new V("Requested row is outside the image: "+t);var i=this.getWidth();(n==null||n.length<i)&&(n=new Uint8ClampedArray(i));var a=(t+this.top)*this.dataWidth+this.left;return re.arraycopy(this.luminances,a,n,0,i),n},e.prototype.getMatrix=function(){var t=this.getWidth(),n=this.getHeight();if(t===this.dataWidth&&n===this.dataHeight)return this.luminances;var i=t*n,a=new Uint8ClampedArray(i),o=this.top*this.dataWidth+this.left;if(t===this.dataWidth)return re.arraycopy(this.luminances,o,a,0,i),a;for(var s=0;s<n;s++){var f=s*t;re.arraycopy(this.luminances,o,a,f,t),o+=this.dataWidth}return a},e.prototype.isCropSupported=function(){return!0},e.prototype.crop=function(t,n,i,a){return new e(this.luminances,i,a,this.dataWidth,this.dataHeight,this.left+t,this.top+n)},e.prototype.invert=function(){return new Mn(this)},e})(Dr);var 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)}}(),zl=function(r){Hl(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.forName=function(t){return this.getCharacterSetECIByName(t)},e}(ue),Gl=function(){function r(){}return r.ISO_8859_1=ue.ISO8859_1,r}(),ti,Wl=301,Xl=function(r,e){for(var t=1,n=0;n<255;n++)e[n]=t,r[t]=n,t*=2,t>=256&&(t^=Wl);return{LOG:r,ALOG:e}};ti=Xl([],[]),ti.LOG,ti.ALOG;var mo;(function(r){r[r.FORCE_NONE=0]="FORCE_NONE",r[r.FORCE_SQUARE=1]="FORCE_SQUARE",r[r.FORCE_RECTANGLE=2]="FORCE_RECTANGLE"})(mo||(mo={}));var Co=129,Ao=230,$l=231,jl=235,Yl=236,Zl=237,Kl=238,ql=239,Ql=240,ri=254,Jl=254,_o="[)>05",Eo="[)>06",Io="",ee=0,_e=1,De=2,he=3,ye=4,be=5,e1=function(){function r(){}return r.prototype.getEncodingMode=function(){return ee},r.prototype.encode=function(e){var t=Ye.determineConsecutiveDigitCount(e.getMessage(),e.pos);if(t>=2)e.writeCodeword(this.encodeASCIIDigits(e.getMessage().charCodeAt(e.pos),e.getMessage().charCodeAt(e.pos+1))),e.pos+=2;else{var n=e.getCurrentChar(),i=Ye.lookAheadTest(e.getMessage(),e.pos,this.getEncodingMode());if(i!==this.getEncodingMode())switch(i){case be:e.writeCodeword($l),e.signalEncoderChange(be);return;case _e:e.writeCodeword(Ao),e.signalEncoderChange(_e);return;case he:e.writeCodeword(Kl),e.signalEncoderChange(he);break;case De:e.writeCodeword(ql),e.signalEncoderChange(De);break;case ye:e.writeCodeword(Ql),e.signalEncoderChange(ye);break;default:throw new Error("Illegal mode: "+i)}else Ye.isExtendedASCII(n)?(e.writeCodeword(jl),e.writeCodeword(n-128+1),e.pos++):(e.writeCodeword(n+1),e.pos++)}},r.prototype.encodeASCIIDigits=function(e,t){if(Ye.isDigit(e)&&Ye.isDigit(t)){var n=(e-48)*10+(t-48);return n+130}throw new Error("not digits: "+e+t)},r}(),t1=function(){function r(){}return r.prototype.getEncodingMode=function(){return be},r.prototype.encode=function(e){var t=new z;for(t.append(0);e.hasMoreCharacters();){var n=e.getCurrentChar();t.append(n),e.pos++;var i=Ye.lookAheadTest(e.getMessage(),e.pos,this.getEncodingMode());if(i!==this.getEncodingMode()){e.signalEncoderChange(ee);break}}var a=t.length()-1,o=1,s=e.getCodewordCount()+a+o;e.updateSymbolInfo(s);var f=e.getSymbolInfo().getDataCapacity()-s>0;if(e.hasMoreCharacters()||f)if(a<=249)t.setCharAt(0,$.getCharAt(a));else if(a<=1555)t.setCharAt(0,$.getCharAt(Math.floor(a/250)+249)),t.insert(1,$.getCharAt(a%250));else throw new Error("Message length not in valid ranges: "+a);for(var u=0,n=t.length();u<n;u++)e.writeCodeword(this.randomize255State(t.charAt(u).charCodeAt(0),e.getCodewordCount()+1))},r.prototype.randomize255State=function(e,t){var n=149*t%255+1,i=e+n;return i<=255?i:i-256},r}(),ni=function(){function r(){}return r.prototype.getEncodingMode=function(){return _e},r.prototype.encodeMaximal=function(e){for(var t=new z,n=0,i=e.pos,a=0;e.hasMoreCharacters();){var o=e.getCurrentChar();e.pos++,n=this.encodeChar(o,t),t.length()%3===0&&(i=e.pos,a=t.length())}if(a!==t.length()){var s=Math.floor(t.length()/3*2),f=Math.floor(e.getCodewordCount()+s+1);e.updateSymbolInfo(f);var u=e.getSymbolInfo().getDataCapacity()-f,c=Math.floor(t.length()%3);(c===2&&u!==2||c===1&&(n>3||u!==1))&&(e.pos=i)}t.length()>0&&e.writeCodeword(Ao),this.handleEOD(e,t)},r.prototype.encode=function(e){for(var t=new z;e.hasMoreCharacters();){var n=e.getCurrentChar();e.pos++;var i=this.encodeChar(n,t),a=Math.floor(t.length()/3)*2,o=e.getCodewordCount()+a;e.updateSymbolInfo(o);var s=e.getSymbolInfo().getDataCapacity()-o;if(!e.hasMoreCharacters()){var f=new z;for(t.length()%3===2&&s!==2&&(i=this.backtrackOneCharacter(e,t,f,i));t.length()%3===1&&(i>3||s!==1);)i=this.backtrackOneCharacter(e,t,f,i);break}var u=t.length();if(u%3===0){var c=Ye.lookAheadTest(e.getMessage(),e.pos,this.getEncodingMode());if(c!==this.getEncodingMode()){e.signalEncoderChange(ee);break}}}this.handleEOD(e,t)},r.prototype.backtrackOneCharacter=function(e,t,n,i){var a=t.length(),o=t.toString().substring(0,a-i);t.setLengthToZero(),t.append(o),e.pos--;var s=e.getCurrentChar();return i=this.encodeChar(s,n),e.resetSymbolInfo(),i},r.prototype.writeNextTriplet=function(e,t){e.writeCodewords(this.encodeToCodewords(t.toString()));var n=t.toString().substring(3);t.setLengthToZero(),t.append(n)},r.prototype.handleEOD=function(e,t){var n=Math.floor(t.length()/3*2),i=t.length()%3,a=e.getCodewordCount()+n;e.updateSymbolInfo(a);var o=e.getSymbolInfo().getDataCapacity()-a;if(i===2){for(t.append("\0");t.length()>=3;)this.writeNextTriplet(e,t);e.hasMoreCharacters()&&e.writeCodeword(ri)}else if(o===1&&i===1){for(;t.length()>=3;)this.writeNextTriplet(e,t);e.hasMoreCharacters()&&e.writeCodeword(ri),e.pos--}else if(i===0){for(;t.length()>=3;)this.writeNextTriplet(e,t);(o>0||e.hasMoreCharacters())&&e.writeCodeword(ri)}else throw new Error("Unexpected case. Please report!");e.signalEncoderChange(ee)},r.prototype.encodeChar=function(e,t){if(e===32)return t.append(3),1;if(e>=48&&e<=57)return t.append(e-48+4),1;if(e>=65&&e<=90)return t.append(e-65+14),1;if(e<32)return t.append(0),t.append(e),2;if(e<=47)return t.append(1),t.append(e-33),2;if(e<=64)return t.append(1),t.append(e-58+15),2;if(e<=95)return t.append(1),t.append(e-91+22),2;if(e<=127)return t.append(2),t.append(e-96),2;t.append("1");var n=2;return n+=this.encodeChar(e-128,t),n},r.prototype.encodeToCodewords=function(e){var t=1600*e.charCodeAt(0)+40*e.charCodeAt(1)+e.charCodeAt(2)+1,n=t/256,i=t%256,a=new z;return a.append(n),a.append(i),a.toString()},r}(),r1=function(){function r(){}return r.prototype.getEncodingMode=function(){return ye},r.prototype.encode=function(e){for(var t=new z;e.hasMoreCharacters();){var n=e.getCurrentChar();this.encodeChar(n,t),e.pos++;var i=t.length();if(i>=4){e.writeCodewords(this.encodeToCodewords(t.toString()));var a=t.toString().substring(4);t.setLengthToZero(),t.append(a);var o=Ye.lookAheadTest(e.getMessage(),e.pos,this.getEncodingMode());if(o!==this.getEncodingMode()){e.signalEncoderChange(ee);break}}}t.append($.getCharAt(31)),this.handleEOD(e,t)},r.prototype.handleEOD=function(e,t){try{var n=t.length();if(n===0)return;if(n===1){e.updateSymbolInfo();var i=e.getSymbolInfo().getDataCapacity()-e.getCodewordCount(),a=e.getRemainingCharacters();if(a>i&&(e.updateSymbolInfo(e.getCodewordCount()+1),i=e.getSymbolInfo().getDataCapacity()-e.getCodewordCount()),a<=i&&i<=2)return}if(n>4)throw new Error("Count must not exceed 4");var o=n-1,s=this.encodeToCodewords(t.toString()),f=!e.hasMoreCharacters(),u=f&&o<=2;if(o<=2){e.updateSymbolInfo(e.getCodewordCount()+o);var i=e.getSymbolInfo().getDataCapacity()-e.getCodewordCount();i>=3&&(u=!1,e.updateSymbolInfo(e.getCodewordCount()+s.length))}u?(e.resetSymbolInfo(),e.pos-=o):e.writeCodewords(s)}finally{e.signalEncoderChange(ee)}},r.prototype.encodeChar=function(e,t){e>=32&&e<=63?t.append(e):e>=64&&e<=94?t.append($.getCharAt(e-64)):Ye.illegalCharacter($.getCharAt(e))},r.prototype.encodeToCodewords=function(e){var t=e.length;if(t===0)throw new Error("StringBuilder must not be empty");var n=e.charAt(0).charCodeAt(0),i=t>=2?e.charAt(1).charCodeAt(0):0,a=t>=3?e.charAt(2).charCodeAt(0):0,o=t>=4?e.charAt(3).charCodeAt(0):0,s=(n<<18)+(i<<12)+(a<<6)+o,f=s>>16&255,u=s>>8&255,c=s&255,l=new z;return l.append(f),t>=2&&l.append(u),t>=3&&l.append(c),l.toString()},r}(),n1=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)}}(),i1=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.")},q=function(){function r(e,t,n,i,a,o,s,f){s===void 0&&(s=0),f===void 0&&(f=0),this.rectangular=e,this.dataCapacity=t,this.errorCodewords=n,this.matrixWidth=i,this.matrixHeight=a,this.dataRegions=o,this.rsBlockData=s,this.rsBlockError=f}return r.lookup=function(e,t,n,i,a){var o,s;t===void 0&&(t=0),n===void 0&&(n=null),i===void 0&&(i=null),a===void 0&&(a=!0);try{for(var f=i1(o1),u=f.next();!u.done;u=f.next()){var c=u.value;if(!(t===1&&c.rectangular)&&!(t===2&&!c.rectangular)&&!(n!=null&&(c.getSymbolWidth()<n.getWidth()||c.getSymbolHeight()<n.getHeight()))&&!(i!=null&&(c.getSymbolWidth()>i.getWidth()||c.getSymbolHeight()>i.getHeight()))&&e<=c.dataCapacity)return c}}catch(l){o={error:l}}finally{try{u&&!u.done&&(s=f.return)&&s.call(f)}finally{if(o)throw o.error}}if(a)throw new Error("Can't find a symbol arrangement that matches the message. Data codewords: "+e);return null},r.prototype.getHorizontalDataRegions=function(){switch(this.dataRegions){case 1:return 1;case 2:case 4:return 2;case 16:return 4;case 36:return 6;default:throw new Error("Cannot handle this number of data regions")}},r.prototype.getVerticalDataRegions=function(){switch(this.dataRegions){case 1:case 2:return 1;case 4:return 2;case 16:return 4;case 36:return 6;default:throw new Error("Cannot handle this number of data regions")}},r.prototype.getSymbolDataWidth=function(){return this.getHorizontalDataRegions()*this.matrixWidth},r.prototype.getSymbolDataHeight=function(){return this.getVerticalDataRegions()*this.matrixHeight},r.prototype.getSymbolWidth=function(){return this.getSymbolDataWidth()+this.getHorizontalDataRegions()*2},r.prototype.getSymbolHeight=function(){return this.getSymbolDataHeight()+this.getVerticalDataRegions()*2},r.prototype.getCodewordCount=function(){return this.dataCapacity+this.errorCodewords},r.prototype.getInterleavedBlockCount=function(){return this.rsBlockData?this.dataCapacity/this.rsBlockData:1},r.prototype.getDataCapacity=function(){return this.dataCapacity},r.prototype.getErrorCodewords=function(){return this.errorCodewords},r.prototype.getDataLengthForInterleavedBlock=function(e){return this.rsBlockData},r.prototype.getErrorLengthForInterleavedBlock=function(e){return this.rsBlockError},r}(),a1=function(r){n1(e,r);function e(){return r.call(this,!1,1558,620,22,22,36,-1,62)||this}return e.prototype.getInterleavedBlockCount=function(){return 10},e.prototype.getDataLengthForInterleavedBlock=function(t){return t<=8?156:155},e}(q),o1=[new q(!1,3,5,8,8,1),new q(!1,5,7,10,10,1),new q(!0,5,7,16,6,1),new q(!1,8,10,12,12,1),new q(!0,10,11,14,6,2),new q(!1,12,12,14,14,1),new q(!0,16,14,24,10,1),new q(!1,18,14,16,16,1),new q(!1,22,18,18,18,1),new q(!0,22,18,16,10,2),new q(!1,30,20,20,20,1),new q(!0,32,24,16,14,2),new q(!1,36,24,22,22,1),new q(!1,44,28,24,24,1),new q(!0,49,28,22,14,2),new q(!1,62,36,14,14,4),new q(!1,86,42,16,16,4),new q(!1,114,48,18,18,4),new q(!1,144,56,20,20,4),new q(!1,174,68,22,22,4),new q(!1,204,84,24,24,4,102,42),new q(!1,280,112,14,14,16,140,56),new q(!1,368,144,16,16,16,92,36),new q(!1,456,192,18,18,16,114,48),new q(!1,576,224,20,20,16,144,56),new q(!1,696,272,22,22,16,174,68),new q(!1,816,336,24,24,16,136,56),new q(!1,1050,408,18,18,36,175,68),new q(!1,1304,496,20,20,36,163,62),new a1],s1=function(){function r(e){this.msg=e,this.pos=0,this.skipAtEnd=0;for(var t=e.split("").map(function(s){return s.charCodeAt(0)}),n=new z,i=0,a=t.length;i<a;i++){var o=String.fromCharCode(t[i]&255);if(o==="?"&&e.charAt(i)!=="?")throw new Error("Message contains characters outside ISO-8859-1 encoding.");n.append(o)}this.msg=n.toString(),this.shape=0,this.codewords=new z,this.newEncoding=-1}return r.prototype.setSymbolShape=function(e){this.shape=e},r.prototype.setSizeConstraints=function(e,t){this.minSize=e,this.maxSize=t},r.prototype.getMessage=function(){return this.msg},r.prototype.setSkipAtEnd=function(e){this.skipAtEnd=e},r.prototype.getCurrentChar=function(){return this.msg.charCodeAt(this.pos)},r.prototype.getCurrent=function(){return this.msg.charCodeAt(this.pos)},r.prototype.getCodewords=function(){return this.codewords},r.prototype.writeCodewords=function(e){this.codewords.append(e)},r.prototype.writeCodeword=function(e){this.codewords.append(e)},r.prototype.getCodewordCount=function(){return this.codewords.length()},r.prototype.getNewEncoding=function(){return this.newEncoding},r.prototype.signalEncoderChange=function(e){this.newEncoding=e},r.prototype.resetEncoderSignal=function(){this.newEncoding=-1},r.prototype.hasMoreCharacters=function(){return this.pos<this.getTotalMessageCharCount()},r.prototype.getTotalMessageCharCount=function(){return this.msg.length-this.skipAtEnd},r.prototype.getRemainingCharacters=function(){return this.getTotalMessageCharCount()-this.pos},r.prototype.getSymbolInfo=function(){return this.symbolInfo},r.prototype.updateSymbolInfo=function(e){e===void 0&&(e=this.getCodewordCount()),(this.symbolInfo==null||e>this.symbolInfo.getDataCapacity())&&(this.symbolInfo=q.lookup(e,this.shape,this.minSize,this.maxSize,!0))},r.prototype.resetSymbolInfo=function(){this.symbolInfo=null},r}(),f1=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)}}(),u1=function(r){f1(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.getEncodingMode=function(){return he},e.prototype.encode=function(t){for(var n=new z;t.hasMoreCharacters();){var i=t.getCurrentChar();t.pos++,this.encodeChar(i,n);var a=n.length();if(a%3===0){this.writeNextTriplet(t,n);var o=Ye.lookAheadTest(t.getMessage(),t.pos,this.getEncodingMode());if(o!==this.getEncodingMode()){t.signalEncoderChange(ee);break}}}this.handleEOD(t,n)},e.prototype.encodeChar=function(t,n){switch(t){case 13:n.append(0);break;case 42:n.append(1);break;case 62:n.append(2);break;case 32:n.append(3);break;default:t>=48&&t<=57?n.append(t-48+4):t>=65&&t<=90?n.append(t-65+14):Ye.illegalCharacter($.getCharAt(t));break}return 1},e.prototype.handleEOD=function(t,n){t.updateSymbolInfo();var i=t.getSymbolInfo().getDataCapacity()-t.getCodewordCount(),a=n.length();t.pos-=a,(t.getRemainingCharacters()>1||i>1||t.getRemainingCharacters()!==i)&&t.writeCodeword(Jl),t.getNewEncoding()<0&&t.signalEncoderChange(ee)},e}(ni),c1=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)}}(),l1=function(r){c1(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.getEncodingMode=function(){return De},e.prototype.encodeChar=function(t,n){if(t===32)return n.append(3),1;if(t>=48&&t<=57)return n.append(t-48+4),1;if(t>=97&&t<=122)return n.append(t-97+14),1;if(t<32)return n.append(0),n.append(t),2;if(t<=47)return n.append(1),n.append(t-33),2;if(t<=64)return n.append(1),n.append(t-58+15),2;if(t>=91&&t<=95)return n.append(1),n.append(t-91+22),2;if(t===96)return n.append(2),n.append(0),2;if(t<=90)return n.append(2),n.append(t-65+1),2;if(t<=127)return n.append(2),n.append(t-123+27),2;n.append("1");var i=2;return i+=this.encodeChar(t-128,n),i},e}(ni),Ye=function(){function r(){}return r.randomize253State=function(e){var t=149*e%253+1,n=Co+t;return n<=254?n:n-254},r.encodeHighLevel=function(e,t,n,i,a){t===void 0&&(t=0),n===void 0&&(n=null),i===void 0&&(i=null),a===void 0&&(a=!1);var o=new ni,s=[new e1,o,new l1,new u1,new r1,new t1],f=new s1(e);f.setSymbolShape(t),f.setSizeConstraints(n,i),e.startsWith(_o)&&e.endsWith(Io)?(f.writeCodeword(Yl),f.setSkipAtEnd(2),f.pos+=_o.length):e.startsWith(Eo)&&e.endsWith(Io)&&(f.writeCodeword(Zl),f.setSkipAtEnd(2),f.pos+=Eo.length);var u=ee;for(a&&(o.encodeMaximal(f),u=f.getNewEncoding(),f.resetEncoderSignal());f.hasMoreCharacters();)s[u].encode(f),f.getNewEncoding()>=0&&(u=f.getNewEncoding(),f.resetEncoderSignal());var c=f.getCodewordCount();f.updateSymbolInfo();var l=f.getSymbolInfo().getDataCapacity();c<l&&u!==ee&&u!==be&&u!==ye&&f.writeCodeword("þ");var d=f.getCodewords();for(d.length()<l&&d.append(Co);d.length()<l;)d.append(this.randomize253State(d.length()+1));return f.getCodewords().toString()},r.lookAheadTest=function(e,t,n){var i=this.lookAheadTestIntern(e,t,n);if(n===he&&i===he){for(var a=Math.min(t+3,e.length),o=t;o<a;o++)if(!this.isNativeX12(e.charCodeAt(o)))return ee}else if(n===ye&&i===ye){for(var a=Math.min(t+4,e.length),o=t;o<a;o++)if(!this.isNativeEDIFACT(e.charCodeAt(o)))return ee}return i},r.lookAheadTestIntern=function(e,t,n){if(t>=e.length)return n;var i;n===ee?i=[0,1,1,1,1,1.25]:(i=[1,2,2,2,2,2.25],i[n]=0);for(var a=0,o=new Uint8Array(6),s=[];;){if(t+a===e.length){fe.fill(o,0),fe.fill(s,0);var f=this.findMinimums(i,s,G.MAX_VALUE,o),u=this.getMinimumCount(o);if(s[ee]===f)return ee;if(u===1){if(o[be]>0)return be;if(o[ye]>0)return ye;if(o[De]>0)return De;if(o[he]>0)return he}return _e}var c=e.charCodeAt(t+a);if(a++,this.isDigit(c)?i[ee]+=.5:this.isExtendedASCII(c)?(i[ee]=Math.ceil(i[ee]),i[ee]+=2):(i[ee]=Math.ceil(i[ee]),i[ee]++),this.isNativeC40(c)?i[_e]+=2/3:this.isExtendedASCII(c)?i[_e]+=8/3:i[_e]+=4/3,this.isNativeText(c)?i[De]+=2/3:this.isExtendedASCII(c)?i[De]+=8/3:i[De]+=4/3,this.isNativeX12(c)?i[he]+=2/3:this.isExtendedASCII(c)?i[he]+=13/3:i[he]+=10/3,this.isNativeEDIFACT(c)?i[ye]+=3/4:this.isExtendedASCII(c)?i[ye]+=17/4:i[ye]+=13/4,this.isSpecialB256(c)?i[be]+=4:i[be]++,a>=4){if(fe.fill(o,0),fe.fill(s,0),this.findMinimums(i,s,G.MAX_VALUE,o),s[ee]<this.min(s[be],s[_e],s[De],s[he],s[ye]))return ee;if(s[be]<s[ee]||s[be]+1<this.min(s[_e],s[De],s[he],s[ye]))return be;if(s[ye]+1<this.min(s[be],s[_e],s[De],s[he],s[ee]))return ye;if(s[De]+1<this.min(s[be],s[_e],s[ye],s[he],s[ee]))return De;if(s[he]+1<this.min(s[be],s[_e],s[ye],s[De],s[ee]))return he;if(s[_e]+1<this.min(s[ee],s[be],s[ye],s[De])){if(s[_e]<s[he])return _e;if(s[_e]===s[he]){for(var l=t+a+1;l<e.length;){var d=e.charCodeAt(l);if(this.isX12TermSep(d))return he;if(!this.isNativeX12(d))break;l++}return _e}}}}},r.min=function(e,t,n,i,a){var o=Math.min(e,Math.min(t,Math.min(n,i)));return a===void 0?o:Math.min(o,a)},r.findMinimums=function(e,t,n,i){for(var a=0;a<6;a++){var o=t[a]=Math.ceil(e[a]);n>o&&(n=o,fe.fill(i,0)),n===o&&(i[a]=i[a]+1)}return n},r.getMinimumCount=function(e){for(var t=0,n=0;n<6;n++)t+=e[n];return t||0},r.isDigit=function(e){return e>=48&&e<=57},r.isExtendedASCII=function(e){return e>=128&&e<=255},r.isNativeC40=function(e){return e===32||e>=48&&e<=57||e>=65&&e<=90},r.isNativeText=function(e){return e===32||e>=48&&e<=57||e>=97&&e<=122},r.isNativeX12=function(e){return this.isX12TermSep(e)||e===32||e>=48&&e<=57||e>=65&&e<=90},r.isX12TermSep=function(e){return e===13||e===42||e===62},r.isNativeEDIFACT=function(e){return e>=32&&e<=94},r.isSpecialB256=function(e){return!1},r.determineConsecutiveDigitCount=function(e,t){t===void 0&&(t=0);for(var n=e.length,i=t;i<n&&this.isDigit(e.charCodeAt(i));)i++;return i-t},r.illegalCharacter=function(e){var t=G.toHexString(e.charCodeAt(0));throw t="0000".substring(0,4-t.length)+t,new Error("Illegal character: "+e+" (0x"+t+")")},r}(),ii=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.")},So=function(){function r(e){this.charset=e,this.name=e.name}return r.prototype.canEncode=function(e){try{return Ve.encode(e,this.charset)!=null}catch{return!1}},r}(),d1=function(){function r(e,t,n){var i,a,o,s,f,u;this.ENCODERS=["IBM437","ISO-8859-2","ISO-8859-3","ISO-8859-4","ISO-8859-5","ISO-8859-6","ISO-8859-7","ISO-8859-8","ISO-8859-9","ISO-8859-10","ISO-8859-11","ISO-8859-13","ISO-8859-14","ISO-8859-15","ISO-8859-16","windows-1250","windows-1251","windows-1252","windows-1256","Shift_JIS"].map(function(M){return new So(zl.forName(M))}),this.encoders=[];var c=[];c.push(new So(Gl.ISO_8859_1));for(var l=t!=null&&t.name.startsWith("UTF"),d=0;d<e.length;d++){var h=!1;try{for(var v=(i=void 0,ii(c)),p=v.next();!p.done;p=v.next()){var x=p.value,m=e.charAt(d),w=m.charCodeAt(0);if(w===n||x.canEncode(m)){h=!0;break}}}catch(M){i={error:M}}finally{try{p&&!p.done&&(a=v.return)&&a.call(v)}finally{if(i)throw i.error}}if(!h)try{for(var C=(o=void 0,ii(this.ENCODERS)),A=C.next();!A.done;A=C.next()){var x=A.value;if(x.canEncode(e.charAt(d))){c.push(x),h=!0;break}}}catch(M){o={error:M}}finally{try{A&&!A.done&&(s=C.return)&&s.call(C)}finally{if(o)throw o.error}}h||(l=!0)}if(c.length===1&&!l)this.encoders=[c[0]];else{this.encoders=[];var _=0;try{for(var b=ii(c),T=b.next();!T.done;T=b.next()){var x=T.value;this.encoders[_++]=x}}catch(M){f={error:M}}finally{try{T&&!T.done&&(u=b.return)&&u.call(b)}finally{if(f)throw f.error}}}var D=-1;if(t!=null){for(var d=0;d<this.encoders.length;d++)if(this.encoders[d]!=null&&t.name===this.encoders[d].name){D=d;break}}this.priorityEncoderIndex=D}return r.prototype.length=function(){return this.encoders.length},r.prototype.getCharsetName=function(e){if(!(e<this.length()))throw new Error("index must be less than length");return this.encoders[e].name},r.prototype.getCharset=function(e){if(!(e<this.length()))throw new Error("index must be less than length");return this.encoders[e].charset},r.prototype.getECIValue=function(e){return this.encoders[e].charset.getValueIdentifier()},r.prototype.getPriorityEncoderIndex=function(){return this.priorityEncoderIndex},r.prototype.canEncode=function(e,t){if(!(t<this.length()))throw new Error("index must be less than length");return!0},r.prototype.encode=function(e,t){if(!(t<this.length()))throw new Error("index must be less than length");return Ve.encode($.getCharAt(e),this.encoders[t].name)},r}(),h1=3,v1=function(){function r(e,t,n){this.fnc1=n;var i=new d1(e,t,n);if(i.length()===1)for(var a=0;a<this.bytes.length;a++){var o=e.charAt(a).charCodeAt(0);this.bytes[a]=o===n?1e3:o}else this.bytes=this.encodeMinimally(e,i,n)}return r.prototype.getFNC1Character=function(){return this.fnc1},r.prototype.length=function(){return this.bytes.length},r.prototype.haveNCharacters=function(e,t){if(e+t-1>=this.bytes.length)return!1;for(var n=0;n<t;n++)if(this.isECI(e+n))return!1;return!0},r.prototype.charAt=function(e){if(e<0||e>=this.length())throw new Error(""+e);if(this.isECI(e))throw new Error("value at "+e+" is not a character but an ECI");return this.isFNC1(e)?this.fnc1:this.bytes[e]},r.prototype.subSequence=function(e,t){if(e<0||e>t||t>this.length())throw new Error(""+e);for(var n=new z,i=e;i<t;i++){if(this.isECI(i))throw new Error("value at "+i+" is not a character but an ECI");n.append(this.charAt(i))}return n.toString()},r.prototype.isECI=function(e){if(e<0||e>=this.length())throw new Error(""+e);return this.bytes[e]>255&&this.bytes[e]<=999},r.prototype.isFNC1=function(e){if(e<0||e>=this.length())throw new Error(""+e);return this.bytes[e]===1e3},r.prototype.getECIValue=function(e){if(e<0||e>=this.length())throw new Error(""+e);if(!this.isECI(e))throw new Error("value at "+e+" is not an ECI but a character");return this.bytes[e]-256},r.prototype.addEdge=function(e,t,n){(e[t][n.encoderIndex]==null||e[t][n.encoderIndex].cachedTotalSize>n.cachedTotalSize)&&(e[t][n.encoderIndex]=n)},r.prototype.addEdges=function(e,t,n,i,a,o){var s=e.charAt(i).charCodeAt(0),f=0,u=t.length();t.getPriorityEncoderIndex()>=0&&(s===o||t.canEncode(s,t.getPriorityEncoderIndex()))&&(f=t.getPriorityEncoderIndex(),u=f+1);for(var c=f;c<u;c++)(s===o||t.canEncode(s,c))&&this.addEdge(n,i+1,new bo(s,t,c,a,o))},r.prototype.encodeMinimally=function(e,t,n){var i=e.length,a=new bo[i+1][t.length()];this.addEdges(e,t,a,0,null,n);for(var o=1;o<=i;o++){for(var s=0;s<t.length();s++)a[o][s]!=null&&o<i&&this.addEdges(e,t,a,o,a[o][s],n);for(var s=0;s<t.length();s++)a[o-1][s]=null}for(var f=-1,u=G.MAX_VALUE,s=0;s<t.length();s++)if(a[i][s]!=null){var c=a[i][s];c.cachedTotalSize<u&&(u=c.cachedTotalSize,f=s)}if(f<0)throw new Error('Failed to encode "'+e+'"');for(var l=[],d=a[i][f];d!=null;){if(d.isFNC1())l.unshift(1e3);else for(var h=t.encode(d.c,d.encoderIndex),o=h.length-1;o>=0;o--)l.unshift(h[o]&255);var v=d.previous===null?0:d.previous.encoderIndex;v!==d.encoderIndex&&l.unshift(256+t.getECIValue(d.encoderIndex)),d=d.previous}for(var p=[],o=0;o<p.length;o++)p[o]=l[o];return p},r}(),bo=function(){function r(e,t,n,i,a){this.c=e,this.encoderSet=t,this.encoderIndex=n,this.previous=i,this.fnc1=a,this.c=e===a?1e3:e;var o=this.isFNC1()?1:t.encode(e,n).length,s=i===null?0:i.encoderIndex;s!==n&&(o+=h1),i!=null&&(o+=i.cachedTotalSize),this.cachedTotalSize=o}return r.prototype.isFNC1=function(){return this.c===1e3},r}(),p1=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)}}(),g1=function(r,e){var t=typeof Symbol=="function"&&r[Symbol.iterator];if(!t)return r;var n=t.call(r),i,a=[],o;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)a.push(i.value)}catch(s){o={error:s}}finally{try{i&&!i.done&&(t=n.return)&&t.call(n)}finally{if(o)throw o.error}}return a},To;(function(r){r[r.ASCII=0]="ASCII",r[r.C40=1]="C40",r[r.TEXT=2]="TEXT",r[r.X12=3]="X12",r[r.EDF=4]="EDF",r[r.B256=5]="B256"})(To||(To={})),function(r){p1(e,r);function e(t,n,i,a,o){var s=r.call(this,t,n,i)||this;return s.shape=a,s.macroId=o,s}return e.prototype.getMacroId=function(){return this.macroId},e.prototype.getShapeHint=function(){return this.shape},e}(v1);var x1=function(){function r(){}return r.prototype.isCompact=function(){return this.compact},r.prototype.setCompact=function(e){this.compact=e},r.prototype.getSize=function(){return this.size},r.prototype.setSize=function(e){this.size=e},r.prototype.getLayers=function(){return this.layers},r.prototype.setLayers=function(e){this.layers=e},r.prototype.getCodeWords=function(){return this.codeWords},r.prototype.setCodeWords=function(e){this.codeWords=e},r.prototype.getMatrix=function(){return this.matrix},r.prototype.setMatrix=function(e){this.matrix=e},r}(),Oo=function(){function r(){}return r.singletonList=function(e){return[e]},r.min=function(e,t){return e.sort(t)[0]},r}(),y1=function(){function r(e){this.previous=e}return r.prototype.getPrevious=function(){return this.previous},r}(),w1=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)}}(),ai=function(r){w1(e,r);function e(t,n,i){var a=r.call(this,t)||this;return a.value=n,a.bitCount=i,a}return e.prototype.appendTo=function(t,n){t.appendBits(this.value,this.bitCount)},e.prototype.add=function(t,n){return new e(this,t,n)},e.prototype.addBinaryShift=function(t,n){return console.warn("addBinaryShift on SimpleToken, this simply returns a copy of this token"),new e(this,t,n)},e.prototype.toString=function(){var t=this.value&(1<<this.bitCount)-1;return t|=1<<this.bitCount,"<"+G.toBinaryString(t|1<<this.bitCount).substring(1)+">"},e}(y1),m1=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)}}(),C1=function(r){m1(e,r);function e(t,n,i){var a=r.call(this,t,0,0)||this;return a.binaryShiftStart=n,a.binaryShiftByteCount=i,a}return e.prototype.appendTo=function(t,n){for(var i=0;i<this.binaryShiftByteCount;i++)(i===0||i===31&&this.binaryShiftByteCount<=62)&&(t.appendBits(31,5),this.binaryShiftByteCount>62?t.appendBits(this.binaryShiftByteCount-31,16):i===0?t.appendBits(Math.min(this.binaryShiftByteCount,31),5):t.appendBits(this.binaryShiftByteCount-31,5)),t.appendBits(n[this.binaryShiftStart+i],8)},e.prototype.addBinaryShift=function(t,n){return new e(this,t,n)},e.prototype.toString=function(){return"<"+this.binaryShiftStart+"::"+(this.binaryShiftStart+this.binaryShiftByteCount-1)+">"},e}(ai);function A1(r,e,t){return new C1(r,e,t)}function ir(r,e,t){return new ai(r,e,t)}var _1=["UPPER","LOWER","DIGIT","MIXED","PUNCT"],ct=0,Hr=1,ze=2,No=3,Qe=4,E1=new ai(null,0,0),oi=[Int32Array.from([0,(5<<16)+28,(5<<16)+30,(5<<16)+29,656318]),Int32Array.from([(9<<16)+480+14,0,(5<<16)+30,(5<<16)+29,656318]),Int32Array.from([(4<<16)+14,(9<<16)+448+28,0,(9<<16)+448+29,932798]),Int32Array.from([(5<<16)+29,(5<<16)+28,656318,0,(5<<16)+30]),Int32Array.from([(5<<16)+31,656380,656382,656381,0])],I1=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.")};function S1(r){var e,t;try{for(var n=I1(r),i=n.next();!i.done;i=n.next()){var a=i.value;fe.fill(a,-1)}}catch(o){e={error:o}}finally{try{i&&!i.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}return r[ct][Qe]=0,r[Hr][Qe]=0,r[Hr][ct]=28,r[No][Qe]=0,r[ze][Qe]=0,r[ze][ct]=15,r}var Do=S1(fe.createInt32Array(6,6)),b1=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.")},T1=function(){function r(e,t,n,i){this.token=e,this.mode=t,this.binaryShiftByteCount=n,this.bitCount=i}return r.prototype.getMode=function(){return this.mode},r.prototype.getToken=function(){return this.token},r.prototype.getBinaryShiftByteCount=function(){return this.binaryShiftByteCount},r.prototype.getBitCount=function(){return this.bitCount},r.prototype.latchAndAppend=function(e,t){var n=this.bitCount,i=this.token;if(e!==this.mode){var a=oi[this.mode][e];i=ir(i,a&65535,a>>16),n+=a>>16}var o=e===ze?4:5;return i=ir(i,t,o),new r(i,e,0,n+o)},r.prototype.shiftAndAppend=function(e,t){var n=this.token,i=this.mode===ze?4:5;return n=ir(n,Do[this.mode][e],i),n=ir(n,t,5),new r(n,this.mode,0,this.bitCount+i+5)},r.prototype.addBinaryShiftChar=function(e){var t=this.token,n=this.mode,i=this.bitCount;if(this.mode===Qe||this.mode===ze){var a=oi[n][ct];t=ir(t,a&65535,a>>16),i+=a>>16,n=ct}var o=this.binaryShiftByteCount===0||this.binaryShiftByteCount===31?18:this.binaryShiftByteCount===62?9:8,s=new r(t,n,this.binaryShiftByteCount+1,i+o);return s.binaryShiftByteCount===2078&&(s=s.endBinaryShift(e+1)),s},r.prototype.endBinaryShift=function(e){if(this.binaryShiftByteCount===0)return this;var t=this.token;return t=A1(t,e-this.binaryShiftByteCount,this.binaryShiftByteCount),new r(t,this.mode,0,this.bitCount)},r.prototype.isBetterThanOrEqualTo=function(e){var t=this.bitCount+(oi[this.mode][e.mode]>>16);return this.binaryShiftByteCount<e.binaryShiftByteCount?t+=r.calculateBinaryShiftCost(e)-r.calculateBinaryShiftCost(this):this.binaryShiftByteCount>e.binaryShiftByteCount&&e.binaryShiftByteCount>0&&(t+=10),t<=e.bitCount},r.prototype.toBitArray=function(e){for(var t,n,i=[],a=this.endBinaryShift(e.length).token;a!==null;a=a.getPrevious())i.unshift(a);var o=new ge;try{for(var s=b1(i),f=s.next();!f.done;f=s.next()){var u=f.value;u.appendTo(o,e)}}catch(c){t={error:c}}finally{try{f&&!f.done&&(n=s.return)&&n.call(s)}finally{if(t)throw t.error}}return o},r.prototype.toString=function(){return $.format("%s bits=%d bytes=%d",_1[this.mode],this.bitCount,this.binaryShiftByteCount)},r.calculateBinaryShiftCost=function(e){return e.binaryShiftByteCount>62?21:e.binaryShiftByteCount>31?20:e.binaryShiftByteCount>0?10:0},r.INITIAL_STATE=new r(E1,ct,0,0),r}();function O1(r){var e=$.getCharCode(" "),t=$.getCharCode("."),n=$.getCharCode(",");r[ct][e]=1;for(var i=$.getCharCode("Z"),a=$.getCharCode("A"),o=a;o<=i;o++)r[ct][o]=o-a+2;r[Hr][e]=1;for(var s=$.getCharCode("z"),f=$.getCharCode("a"),o=f;o<=s;o++)r[Hr][o]=o-f+2;r[ze][e]=1;for(var u=$.getCharCode("9"),c=$.getCharCode("0"),o=c;o<=u;o++)r[ze][o]=o-c+2;r[ze][n]=12,r[ze][t]=13;for(var l=["\0"," ","","","","","","","\x07","\b"," ",`
|
|
63
|
-
`,"\v","\f","\r","\x1B","","","","","@","\\","^","_","`","|","~",""],
|
|
64
|
-
`),n=Oo.singletonList(T1.INITIAL_STATE),i=0;i<this.text.length;i++){var a=void 0,o=i+1<this.text.length?this.text[i+1]:0;switch(this.text[i]){case $.getCharCode("\r"):a=o===t?2:0;break;case $.getCharCode("."):a=o===e?3:0;break;case $.getCharCode(","):a=o===e?4:0;break;case $.getCharCode(":"):a=o===e?5:0;break;default:a=0}a>0?(n=r.updateStateListForPair(n,i,a),i++):n=this.updateStateListForChar(n,i)}var s=Oo.min(n,function(f,u){return f.getBitCount()-u.getBitCount()});return s.toBitArray(this.text)},r.prototype.updateStateListForChar=function(e,t){var n,i,a=[];try{for(var o=zr(e),s=o.next();!s.done;s=o.next()){var f=s.value;this.updateStateForChar(f,t,a)}}catch(u){n={error:u}}finally{try{s&&!s.done&&(i=o.return)&&i.call(o)}finally{if(n)throw n.error}}return r.simplifyStates(a)},r.prototype.updateStateForChar=function(e,t,n){for(var i=this.text[t]&255,a=si[e.getMode()][i]>0,o=null,s=0;s<=Qe;s++){var f=si[s][i];if(f>0){if(o==null&&(o=e.endBinaryShift(t)),!a||s===e.getMode()||s===ze){var u=o.latchAndAppend(s,f);n.push(u)}if(!a&&Do[e.getMode()][s]>=0){var c=o.shiftAndAppend(s,f);n.push(c)}}}if(e.getBinaryShiftByteCount()>0||si[e.getMode()][i]===0){var l=e.addBinaryShiftChar(t);n.push(l)}},r.updateStateListForPair=function(e,t,n){var i,a,o=[];try{for(var s=zr(e),f=s.next();!f.done;f=s.next()){var u=f.value;this.updateStateForPair(u,t,n,o)}}catch(c){i={error:c}}finally{try{f&&!f.done&&(a=s.return)&&a.call(s)}finally{if(i)throw i.error}}return this.simplifyStates(o)},r.updateStateForPair=function(e,t,n,i){var a=e.endBinaryShift(t);if(i.push(a.latchAndAppend(Qe,n)),e.getMode()!==Qe&&i.push(a.shiftAndAppend(Qe,n)),n===3||n===4){var o=a.latchAndAppend(ze,16-n).latchAndAppend(ze,1);i.push(o)}if(e.getBinaryShiftByteCount()>0){var s=e.addBinaryShiftChar(t).addBinaryShiftChar(t+1);i.push(s)}},r.simplifyStates=function(e){var t,n,i,a,o=[];try{for(var s=zr(e),f=s.next();!f.done;f=s.next()){var u=f.value,c=!0,l=function(x){if(x.isBetterThanOrEqualTo(u))return c=!1,"break";u.isBetterThanOrEqualTo(x)&&(o=o.filter(function(m){return m!==x}))};try{for(var d=(i=void 0,zr(o)),h=d.next();!h.done;h=d.next()){var v=h.value,p=l(v);if(p==="break")break}}catch(x){i={error:x}}finally{try{h&&!h.done&&(a=d.return)&&a.call(d)}finally{if(i)throw i.error}}c&&o.push(u)}}catch(x){t={error:x}}finally{try{f&&!f.done&&(n=s.return)&&n.call(s)}finally{if(t)throw t.error}}return o},r}(),D1=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.")};(function(){function r(){}return r.encodeBytes=function(e){return r.encode(e,r.DEFAULT_EC_PERCENT,r.DEFAULT_AZTEC_LAYERS)},r.encode=function(e,t,n){var i=new N1(e).encode(),a=G.truncDivision(i.getSize()*t,100)+11,o=i.getSize()+a,s,f,u,c,l;if(n!==r.DEFAULT_AZTEC_LAYERS){if(s=n<0,f=Math.abs(n),f>(s?r.MAX_NB_BITS_COMPACT:r.MAX_NB_BITS))throw new V($.format("Illegal value %s for layers",n));u=r.totalBitsInLayer(f,s),c=r.WORD_SIZE[f];var d=u-u%c;if(l=r.stuffBits(i,c),l.getSize()+a>d)throw new V("Data to large for user specified layer");if(s&&l.getSize()>c*64)throw new V("Data to large for user specified layer")}else{c=0,l=null;for(var h=0;;h++){if(h>r.MAX_NB_BITS)throw new V("Data too large for an Aztec code");if(s=h<=3,f=s?h+1:h,u=r.totalBitsInLayer(f,s),!(o>u)){(l==null||c!==r.WORD_SIZE[f])&&(c=r.WORD_SIZE[f],l=r.stuffBits(i,c));var d=u-u%c;if(!(s&&l.getSize()>c*64)&&l.getSize()+a<=d)break}}}var v=r.generateCheckWords(l,u,c),p=l.getSize()/c,x=r.generateModeMessage(s,f,p),m=(s?11:14)+f*4,w=new Int32Array(m),C;if(s){C=m;for(var h=0;h<w.length;h++)w[h]=h}else{C=m+1+2*G.truncDivision(G.truncDivision(m,2)-1,15);for(var A=G.truncDivision(m,2),_=G.truncDivision(C,2),h=0;h<A;h++){var b=h+G.truncDivision(h,15);w[A-h-1]=_-b-1,w[A+h]=_+b+1}}for(var T=new qe(C),h=0,D=0;h<f;h++){for(var M=(f-h)*4+(s?9:12),B=0;B<M;B++)for(var U=B*2,H=0;H<2;H++)v.get(D+U+H)&&T.set(w[h*2+H],w[h*2+B]),v.get(D+M*2+U+H)&&T.set(w[h*2+B],w[m-1-h*2-H]),v.get(D+M*4+U+H)&&T.set(w[m-1-h*2-H],w[m-1-h*2-B]),v.get(D+M*6+U+H)&&T.set(w[m-1-h*2-B],w[h*2+H]);D+=M*8}if(r.drawModeMessage(T,s,C,x),s)r.drawBullsEye(T,G.truncDivision(C,2),5);else{r.drawBullsEye(T,G.truncDivision(C,2),7);for(var h=0,B=0;h<G.truncDivision(m,2)-1;h+=15,B+=16)for(var H=G.truncDivision(C,2)&1;H<C;H+=2)T.set(G.truncDivision(C,2)-B,H),T.set(G.truncDivision(C,2)+B,H),T.set(H,G.truncDivision(C,2)-B),T.set(H,G.truncDivision(C,2)+B)}var W=new x1;return W.setCompact(s),W.setSize(C),W.setLayers(f),W.setCodeWords(p),W.setMatrix(T),W},r.drawBullsEye=function(e,t,n){for(var i=0;i<n;i+=2)for(var a=t-i;a<=t+i;a++)e.set(a,t-i),e.set(a,t+i),e.set(t-i,a),e.set(t+i,a);e.set(t-n,t-n),e.set(t-n+1,t-n),e.set(t-n,t-n+1),e.set(t+n,t-n),e.set(t+n,t-n+1),e.set(t+n,t+n-1)},r.generateModeMessage=function(e,t,n){var i=new ge;return e?(i.appendBits(t-1,2),i.appendBits(n-1,6),i=r.generateCheckWords(i,28,4)):(i.appendBits(t-1,5),i.appendBits(n-1,11),i=r.generateCheckWords(i,40,4)),i},r.drawModeMessage=function(e,t,n,i){var a=G.truncDivision(n,2);if(t)for(var o=0;o<7;o++){var s=a-3+o;i.get(o)&&e.set(s,a-5),i.get(o+7)&&e.set(a+5,s),i.get(20-o)&&e.set(s,a+5),i.get(27-o)&&e.set(a-5,s)}else for(var o=0;o<10;o++){var s=a-5+o+G.truncDivision(o,5);i.get(o)&&e.set(s,a-7),i.get(o+10)&&e.set(a+7,s),i.get(29-o)&&e.set(s,a+7),i.get(39-o)&&e.set(a-7,s)}},r.generateCheckWords=function(e,t,n){var i,a,o=e.getSize()/n,s=new xo(r.getGF(n)),f=G.truncDivision(t,n),u=r.bitsToWords(e,n,f);s.encode(u,f-o);var c=t%n,l=new ge;l.appendBits(0,c);try{for(var d=D1(Array.from(u)),h=d.next();!h.done;h=d.next()){var v=h.value;l.appendBits(v,n)}}catch(p){i={error:p}}finally{try{h&&!h.done&&(a=d.return)&&a.call(d)}finally{if(i)throw i.error}}return l},r.bitsToWords=function(e,t,n){var i=new Int32Array(n),a,o;for(a=0,o=e.getSize()/t;a<o;a++){for(var s=0,f=0;f<t;f++)s|=e.get(a*t+f)?1<<t-f-1:0;i[a]=s}return i},r.getGF=function(e){switch(e){case 4:return Re.AZTEC_PARAM;case 6:return Re.AZTEC_DATA_6;case 8:return Re.AZTEC_DATA_8;case 10:return Re.AZTEC_DATA_10;case 12:return Re.AZTEC_DATA_12;default:throw new V("Unsupported word size "+e)}},r.stuffBits=function(e,t){for(var n=new ge,i=e.getSize(),a=(1<<t)-2,o=0;o<i;o+=t){for(var s=0,f=0;f<t;f++)(o+f>=i||e.get(o+f))&&(s|=1<<t-1-f);(s&a)===a?(n.appendBits(s&a,t),o--):(s&a)===0?(n.appendBits(s|1,t),o--):n.appendBits(s,t)}return n},r.totalBitsInLayer=function(e,t){return((t?88:112)+16*e)*e},r.DEFAULT_EC_PERCENT=33,r.DEFAULT_AZTEC_LAYERS=0,r.MAX_NB_BITS=32,r.MAX_NB_BITS_COMPACT=4,r.WORD_SIZE=Int32Array.from([4,6,6,8,8,8,8,8,8,10,10,10,10,10,10,10,10,10,10,10,10,10,10,12,12,12,12,12,12,12,12,12,12]),r})();const fi=I.memo(r=>{const[{inputId:e,labelId:t,label:n,helpText:i,size:a,severity:o,showInputOnly:s,field:f,fieldProps:u,helpers:c,touched:l},d]=Le(r),{name:h,onBlur:v,onChange:p,value:x}=u,[m,w]=I.useState(!1),C=s?null:i,A=s?"":n,[_,b]=I.useState(void 0);I.useEffect(()=>{b(x)},[x]);const T=I.useCallback(U=>{b(U.target.value||void 0),(l||!f.onlyValidateAfterTouched)&&c.setError(f.getError(U.target.value))},[f,c,l]),D=I.useCallback(()=>{p(_),v(_)},[_,v,p]),M=I.useCallback(U=>{p(U),w(!1)},[p]),B=I.useCallback(U=>{w(U),U||v(x)},[v,x]);return g.jsx(Ue,{helpText:C,severity:o,children:g.jsxs(ke,{size:a,severity:o,inputId:e,labelId:t,label:A,image:s?void 0:f.image,className:"flex-col items-start justify-start gap-2",children:[g.jsx(E.TextArea,{className:"w-full field-sizing-content",accentColor:"base",variant:"surface",size:"sm",id:e,name:h,value:_??"",placeholder:"Enter a qr or barcode",onChange:T,onBlur:D,...d}),g.jsxs(Ca,{open:m,onOpenChange:B,children:[g.jsx(Xf,{asChild:!0,children:g.jsxs(E.Button,{className:"w-max",type:"button",variant:"soft",size:"sm",accentColor:"base",children:[g.jsx(E.RiIcon,{icon:"RiFullscreenLine"}),"Scan"]})}),g.jsxs(Aa,{children:[g.jsx(_a,{className:"light:bg-(--black-a6) fixed inset-0 dark:bg-(--black-a8)"}),g.jsx(Ea,{className:"fixed inset-0",children:g.jsx(ui,{onScan:M})})]})]})]})})});fi.displayName="QrInput";const P1=new Map([[Ii.DecodeHintType.POSSIBLE_FORMATS,[L.AZTEC,L.CODABAR,L.CODE_39,L.CODE_93,L.CODE_128,L.DATA_MATRIX,L.EAN_8,L.EAN_13,L.ITF,L.MAXICODE,L.PDF_417,L.QR_CODE,L.RSS_14,L.RSS_EXPANDED,L.UPC_A,L.UPC_E,L.UPC_EAN_EXTENSION]]]),ui=I.memo(r=>{const{onScan:e}=r,{showError:t}=E.useToast(),n=I.useCallback(o=>{e(o.getText())},[e]),i=I.useCallback(()=>{t({title:"Scan Error",description:"An unknown error occurred while scanning."})},[t]),{ref:a}=Ii.useZxing({onDecodeResult:n,onError:i,hints:P1});return g.jsxs("div",{className:"relative flex size-full flex-col justify-center overflow-hidden p-4 gap-4 bg-(--color-background)",children:[g.jsx("div",{className:"flex w-full",children:g.jsx(Ia,{asChild:!0,children:g.jsx(E.IconButton,{"aria-label":"close",variant:"soft",accentColor:"base",children:g.jsx(E.RiIcon,{icon:"RiCloseLine"})})})}),g.jsx("div",{className:"relative grow w-full max-h-full overflow-hidden",children:g.jsx("video",{className:"size-full",ref:a})})]})});ui.displayName="QrScanner";const Po={...Me,type:"qr"},zt=class zt extends ve{constructor(t){super({...t,type:"qr"});F(this,"onlyValidateAfterTouched",!1)}serialize(){return super._serialize()}static deserialize(t){if(t.type!=="qr")throw new Error("Type mismatch.");return new zt(t)}getInput(t){return g.jsx(fi,{...t,field:this})}};F(zt,"fieldTypeName","Scan"),F(zt,"fieldTypeDescription","Used for scanning/reading QR and barcodes."),F(zt,"Icon",me.RiFullscreenLine);let Gr=zt;const ci=I.memo(r=>{const[{inputId:e,labelId:t,size:n,severity:i,showInputOnly:a,field:o,helpText:s,label:f,fieldProps:u},c]=Le(r),{name:l,onChange:d,onBlur:h,value:v}=u,p=a?null:s,x=a?"":f,m=I.useCallback(C=>{d(C),h(C)},[h,d]),w=I.useMemo(()=>o.options.find(C=>C.value===v),[o.options,v]);return g.jsx(Ue,{helpText:p,severity:i,children:g.jsx(ke,{size:n,severity:i,inputId:e,labelId:t,label:x,image:a?void 0:o.image,children:g.jsxs(E.Menu.Root,{align:"start",children:[g.jsx(E.Menu.ClickTrigger,{children:g.jsxs(E.Button,{id:e,name:l,className:"!justify-between",accentColor:"base",variant:"surface",type:"button",size:"sm",...c,children:[g.jsx("span",{className:"truncate",children:w?w.label:o.placeholder}),g.jsx(E.RiIcon,{icon:"RiArrowDownSLine"})]})}),g.jsx(E.Menu.Content,{children:g.jsx(E.Menu.Scroll,{children:g.jsx(E.Menu.SelectGroup,{required:!1,value:v??void 0,onValueChange:m,children:o.options.map(C=>g.jsxs(E.Menu.SelectItem,{value:C.value,children:[g.jsx(E.Menu.SelectedIndicator,{children:g.jsx(E.RiIcon,{icon:"RiCheckLine"})}),C.label]},C.value))})})})]})})})});ci.displayName="SelectInput";const Mo={...Me,type:"select",options:[]},Gt=class Gt extends En{constructor(e){const{placeholder:t="Select one...",...n}=e;super({...n,placeholder:t,type:"select"})}serialize(){return super._serialize()}static deserialize(e){if(e.type!=="select")throw new Error("Type mismatch.");return new Gt(e)}getInput(e){return g.jsx(ci,{field:this,...e})}};F(Gt,"fieldTypeName","Dropdown"),F(Gt,"fieldTypeDescription","Allows the user to select a single option from a list of options."),F(Gt,"Icon",me.RiMenuFoldLine);let ar=Gt;const or=500,Ct=1e4,Fo=r=>"fields"in r;class sr extends ve{constructor(t){const{minLength:n,maxLength:i,placeholder:a="",...o}=t;super(o);F(this,"minLength");F(this,"maxLength");F(this,"placeholder");this.minLength=n?Math.max(n,0):void 0,this.maxLength=i?Math.max(i,0):Ct,this.placeholder=a}static getFieldCreationSchema(t=""){const n=t&&`${t}.`;return[{field:new at({label:"Minimum length",description:"Minimum number of characters",required:!1,identifier:`${n}minimum_length`,minimum:0,maximum:100,formValidators:[this._validateMin(t)],integers:!0}),showDirectly:!1},{field:new at({label:"Maximum length",description:"Maximum number of characters",required:!1,identifier:`${n}maximum_length`,minimum:1,maximum:Ct,formValidators:[this._validateMax(t)],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(){if(!this.identifier)throw new Error("Field identifier must be set before serializing.");return{...super._serialize(),minimum_length:this.minLength,maximum_length:this.maxLength,placeholder:this.placeholder}}}F(sr,"_validateMin",t=>(n,i)=>{const a=Fo(i)?Ze(i,t):i;return typeof a.maximum_length=="number"&&typeof n=="number"&&a.maximum_length<n?"Minimum cannot be greater than maximum.":null}),F(sr,"_validateMax",t=>(n,i)=>{if(typeof n!="number")return null;const{minimum_length:a}=Fo(i)?Ze(i,t):i;return typeof a!="number"?null:a>n?"Maximum cannot be less than minimum.":null});const li=I.memo(r=>{const[{inputId:e,labelId:t,size:n,severity:i,showInputOnly:a,field:o,helpText:s,label:f,fieldProps:u,touched:c,helpers:l},d]=Le(r),{name:h,onBlur:v,onChange:p,value:x}=u,m=a?null:s,w=a?"":f,[C,A]=I.useState(void 0);I.useEffect(()=>{A(x)},[x]);const _=I.useCallback(T=>{A(T.target.value||void 0),(c||!o.onlyValidateAfterTouched)&&l.setError(o.getError(T.target.value))},[o,l,c]),b=I.useCallback(()=>{p(C),v(C)},[C,v,p]);return g.jsx(Ue,{helpText:m,severity:i,children:g.jsx(ke,{size:n,severity:i,inputId:e,labelId:t,label:w,image:a?void 0:o.image,children:g.jsx(E.Input.Root,{accentColor:"base",variant:"surface",size:"sm",children:g.jsx(E.Input.Field,{id:e,className:"truncate",name:h,value:C??"",type:o.inputType,placeholder:o.placeholder,onChange:_,onBlur:b,...d})})})})});li.displayName="StringInput";const Ro={...Me,type:"string",maximum_length:or,input_type:"text"},Wt=class Wt extends sr{constructor(t){const{inputType:n="text",...i}=t,a=t.maxLength?Math.min(or,t.maxLength):or,o=t.minLength?Math.min(t.minLength,a):void 0;super({...i,maxLength:a,minLength:o,type:"string"});F(this,"inputType");this.inputType=n}serialize(){return{...super._serialize(),input_type:this.inputType}}static deserialize(t){if(t.type!=="string")throw new Error("Type mismatch.");const{maximum_length:n,minimum_length:i,input_type:a,...o}=t;return new Wt({...o,maxLength:n,minLength:i,inputType:a,placeholder:"Enter a short description"})}getInput(t){return g.jsx(li,{field:this,...t})}};F(Wt,"fieldTypeName","Short Text"),F(Wt,"fieldTypeDescription",`Short text fields can hold up to ${or} characters on a single line.`),F(Wt,"Icon",me.RiInputField);let Wr=Wt;const di=I.memo(r=>{const[{inputId:e,labelId:t,size:n,severity:i,showInputOnly:a,field:o,helpText:s,label:f,fieldProps:u,touched:c,helpers:l},d]=Le(r),{name:h,onBlur:v,onChange:p,value:x}=u,m=a?null:s,w=a?"":f,[C,A]=I.useState(void 0);I.useEffect(()=>{A(x)},[x]);const _=I.useCallback(T=>{A(T.target.value||void 0),(c||!o.onlyValidateAfterTouched)&&l.setError(o.getError(T.target.value))},[o,l,c]),b=I.useCallback(()=>{p(C),v(C)},[C,v,p]);return g.jsx(Ue,{helpText:m,severity:i,children:g.jsx(ke,{size:n,severity:i,inputId:e,labelId:t,label:w,image:a?void 0:o.image,children:g.jsx(E.TextArea,{id:e,value:C??"",name:h,onChange:_,onBlur:b,className:"field-sizing-content min-h-12",placeholder:o.placeholder,resize:"vertical",accentColor:"base",variant:"surface",size:"sm",...d})})})});di.displayName="TextInput";const Bo={...Me,type:"text",maximum_length:Ct},Xt=class Xt extends sr{constructor(e){const t=e.maxLength?Math.min(Ct,e.maxLength):Ct,n=e.minLength?Math.min(e.minLength,t):void 0;super({...e,maxLength:t,minLength:n,type:"text"})}serialize(){return super._serialize()}static deserialize(e){if(e.type!=="text")throw new Error("Type mismatch.");const{maximum_length:t,minimum_length:n,...i}=e;return new Xt({...i,maxLength:t,minLength:n,placeholder:"Enter a description"})}getInput(e){return g.jsx(di,{field:this,...e})}};F(Xt,"fieldTypeName","Paragraph"),F(Xt,"fieldTypeDescription",`Paragraph fields can hold up to ${Ct} characters and can have multiple lines.`),F(Xt,"Icon",me.RiAlignJustify);let Xr=Xt;const Lo=I.memo(I.forwardRef((r,e)=>{const{file:t,alt:n,error:i,rightSlot:a,className:o,...s}=r;return g.jsxs(E.Card,{className:Et.cx(o,"relative flex h-[200px] w-full flex-col gap-2 overflow-hidden items-center"),ref:e,...s,children:[!t&&!i&&g.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:g.jsx(E.Spinner,{})}),!!t&&!i&&g.jsx(E.Card,{className:"flex max-w-full grow items-center !p-0 justify-center overflow-hidden bg-clip-padding",children:g.jsx("img",{className:"max-w-full object-cover",src:URL.createObjectURL(t),alt:n??t.name})}),(!!t||!!i)&&g.jsxs("div",{className:Et.cx("flex w-full items-center gap-2 self-end",{"bg-transparent":!t}),children:[i?g.jsx(E.RiIcon,{icon:"RiFileWarningLine"}):t&&g.jsx(E.RiIcon,{icon:"RiFileLine",color:"var(--base-a11)"}),g.jsx(E.Text,{className:"truncate",size:"sm",children:i??(t==null?void 0:t.name)}),a]})]})})),M1=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)},hi=I.memo(r=>{var D;const[{inputId:e,labelId:t,label:n,size:i,severity:a,helpText:o,showInputOnly:s,field:f,fieldProps:u},c]=Le(r),{name:l,onChange:d,onBlur:h}=u,v=u.value??cr,p=I.useRef(null),x=I.useMemo(()=>s?null:o||(f.maxFileSize?`Maximum file size: ${f.maxFileSize}MB`:null),[f.maxFileSize,o,s]),m=I.useCallback(()=>{var M;(M=p.current)==null||M.click()},[]),w=I.useCallback(()=>{if(!p.current)return;const M=p.current.files;if(!M){h([]);return}const B=Array.from(M),U=[...v,...B];d(U),h(U)},[h,d,v]),C=I.useCallback(M=>{const B=[...v];B.splice(M,1),d(B.length>0?B:void 0)},[v,d]);I.useEffect(()=>{if(!p.current)return;const M=new AbortController;return p.current.addEventListener("cancel",()=>{h(void 0)},{signal:M.signal}),()=>{M.abort()}},[h,v]);const A=s?"":n,T=f.maxFiles>1?"Select files":"Select a file";return g.jsxs("div",{className:"flex flex-col gap-2",children:[g.jsx(Ue,{helpText:x,severity:a,children:g.jsxs(ke,{size:i,severity:a,inputId:e,labelId:t,label:A,image:s?void 0:f.image,children:[g.jsxs(E.Button,{className:"w-max",size:"sm",variant:"soft",accentColor:"base",onClick:m,id:"upload-input-upload-button",type:"button",...c,children:[g.jsx(E.RiIcon,{icon:"RiUpload2Line"})," ",T]}),g.jsx("input",{id:e,name:l,type:"file",ref:p,accept:(D=f.extensions)==null?void 0:D.join(","),multiple:f.maxFiles>1,className:"hidden",onChange:w,value:""})]})}),Array.isArray(v)&&v.length>0&&g.jsx("div",{className:"flex h-max flex-col gap-2",children:v.map((M,B)=>g.jsx(ko,{field:f,file:M,onRemove:()=>{C(B)},disabled:c.disabled},B))})]})});hi.displayName="UploadInput";const ko=I.memo(r=>{const{file:e,field:t,onRemove:n,disabled:i}=r,[a,o]=I.useState(null),s=vr(),f=I.useMemo(()=>a&&t.getError([a]),[t,a]),{url:u,name:c}=I.useMemo(()=>{let p=null,x,m;return a!=null&&a.type.startsWith("image/")&&(p=URL.createObjectURL(a)),a?(x=a.name,m=M1(a.size)):(x="Downloading...",m="..."),{url:p,name:x,size:m}},[a]);I.useEffect(()=>{e instanceof Promise?e.then(o).catch(console.error):o(e)},[e]);const l=I.useCallback(p=>{if(p.stopPropagation(),!a)throw new Error("Cannot download a file that is not resolved.");const x=new Blob([a]);Ei.saveAs(x,c)},[c,a]),d=I.useCallback(p=>{p.stopPropagation(),n()},[n]),h=I.useCallback(()=>{a&&s(p=>({file:a,onDelete:i?void 0:()=>{n(),p()}}))},[i,n,s,a]),v=I.useMemo(()=>g.jsxs(E.ButtonGroup,{className:"flex grow justify-end",variant:"ghost",accentColor:"base",size:"sm",children:[g.jsx(E.IconButton,{"aria-label":`Download ${c}`,type:"button",onClick:l,disabled:!a,children:g.jsx(E.RiIcon,{icon:"RiDownload2Line"})}),!i&&g.jsx(E.IconButton,{type:"button","aria-label":`Remove ${c}`,disabled:i,onClick:d,children:g.jsx(E.RiIcon,{icon:"RiDeleteBin7Fill"})})]}),[i,d,l,c,a]);return u?g.jsx(Lo,{className:"cursor-pointer",onClick:h,file:a,error:f??void 0,rightSlot:v}):g.jsx(rn,{file:a,error:f??void 0,rightSlot:v})});ko.displayName="DisplayFile";const Uo={...Me,type:"upload",extensions:[],maximum_size:void 0,maximum_files:1};function Vo(r,e){return r.name===e.name&&r.size===e.size&&r.type===e.type}const $t=class $t extends ve{constructor(t){const{extensions:n,maximum_files:i,maximum_size:a,...o}=t;super({...o,type:"upload"});F(this,"extensions");F(this,"maxFileSize");F(this,"maxFiles");F(this,"onlyValidateAfterTouched",!1);this.maxFileSize=typeof a=="number"?a:void 0,this.maxFiles=Math.max(typeof i=="number"?i:1,1),this.extensions=n}isBlank(t){return super.isBlank(t)||(t==null?void 0:t.length)===0}isEqual(t,n){return t===void 0&&n===void 0?!0:!(t===void 0||n===void 0||!t.every(i=>n.some(a=>Vo(i,a)))||!n.every(i=>t.some(a=>Vo(a,i))))}static getFieldCreationSchema(t=""){const n=t&&`${t}.`;return[{field:new at({label:"How many files can be uploaded?",description:"By default, only one file can be uploaded.",required:!1,minimum:1,maximum:10,identifier:`${n}maximum_files`,integers:!0}),showDirectly:!1},{field:new at({label:"What is the maximum size of each file?",description:`Maximum file size in megabytes (between 1MB–${fr}MB).`,required:!1,identifier:`${n}maximum_size`,minimum:1,maximum:fr,integers:!0}),showDirectly:!1},{field:new Kt({label:"Accepted file types",description:"Types of allowed files to upload. If left blank, all files will be accepted.",required:!1,identifier:`${n}extensions`,options:[{value:"image/*",label:"Images"},{value:"audio/*",label:"Audio files"},{value:"video/*",label:"Videos"},{value:"text/*",label:"Text files"},{value:"application/*",label:"Application files (includes PDFs and Word documents)"}]}),showDirectly:!1}]}getFieldValidators(){const t=super.getFieldValidators(),n=this.maxFileSize??fr,i=n*1e3*1e3,a=this.maxFiles||1;return t.push(o=>{if(o&&o.some(s=>s.size>i))return`Files must be at most ${n}MB.`}),t.push(o=>{if(o&&o.length>a)return`You can only upload ${a} files.`}),t}serialize(){return{...super._serialize(),extensions:this.extensions,maximum_size:this.maxFileSize,maximum_files:this.maxFiles}}static deserialize(t){if(t.type!=="upload")throw new Error("Type mismatch.");return new $t(t)}getInput(t){return g.jsx(hi,{field:this,...t})}};F($t,"fieldTypeName","Upload"),F($t,"fieldTypeDescription","Allows a file to be uploaded."),F($t,"Icon",me.RiUpload2Line);let $r=$t;const jr={date:Tr,number:at,boolean:Nt,select:ar,string:Wr,text:Xr,custom:br,upload:$r,qr:Gr,"multi-string":pt,"multi-select":Kt,radio:Or,"checkbox-list":Sr},Ho={date:Na,number:Pa,boolean:Ta,select:Mo,string:Ro,text:Bo,custom:$f,upload:Uo,qr:Po,"multi-string":ba,"multi-select":Da,radio:Fa,"checkbox-list":Oa},F1={boolean:"RiCheckboxCircleLine",date:"RiCalendarLine","multi-string":"RiListCheck",number:"RiHashtag",qr:"RiFullscreenLine","multi-select":"RiCheckboxLine",select:"RiMenuFoldLine",string:"RiInputField",text:"RiAlignJustify",upload:"RiUpload2Line",custom:"RiCodeSSlashLine",section:"RiFolderLine",radio:"RiRadioButtonFill","checkbox-list":"RiCheckboxMultipleLine"},fr=50,zo=fr*1e3,Go=zo*1e3,Wo=I.memo(r=>{const{field:e,...t}=r,[{value:n}]=Ie.useField(e.options.clonedFieldIdentifier),i=I.useMemo(()=>{const a=e.options.getFieldToClone(n);return a?Yr(a):null},[e.options,n]);return gi(i,t)});Wo.displayName="FieldInputCloner";class R1 extends br{constructor(e){super(e,Wo)}}const vi=r=>{const e=r.type;return jr[e].deserialize(r)},Yr=r=>r.type==="section"?Te.deserialize(r):vi(r);function Xo(r){return r.map(e=>Yr(e))}function Zr(r){const e=[];for(const t of r)if(t instanceof Te)for(const n of t.fields)e.push(n);else{if(!(t instanceof ve))throw new Error(`Invalid field type: ${t.type}`);e.push(t)}return e}function $o(r){const e=Zr(r),t={};for(const n of e)t[n.identifier]=n;return t}function B1(r,e){const t=Zr(r),n={};for(const i of t){const a=e[i.identifier]??null;a!==null?n[i.identifier]=i.decodeJsonToValue(a):n[i.identifier]=a}return n}function L1(r,e){const t=Zr(r),n={};for(const i of t){const a=e[i.identifier];n[i.identifier]=i.encodeValueToJson(a)}return n}function Kr(r){return Array.isArray(r)&&r.some(e=>e instanceof File||e instanceof Promise)}function pi(r,e){if(!r)return!0;if(Kr(e)||Kr(r.value))throw new Error("Conditions do not support file uploads");const t=Array.isArray(e)?e.map(i=>typeof i=="string"?i:i.value):e,n=Array.isArray(r.value)?r.value.map(i=>typeof i=="string"?i:i.value):r.value;if(Array.isArray(n)&&Array.isArray(t)){for(const i of n)if(!t.includes(i))return!1;return!0}return n===e}const gi=(r,e)=>I.useMemo(()=>!e||!r?null:r.getInput(e),[r,e]),ur=(r,e)=>{const t=I.useMemo(()=>r.map(n=>g.jsx(I.Fragment,{children:n.getInput(e)},n.getId())),[r,e]);return g.jsx("div",{className:"flex flex-col gap-4",children:t})},xi=I.memo(r=>{const{field:e,...t}=r,{label:n,description:i,fields:a,condition:o}=e,{values:s,setFieldValue:f}=Ie.useFormikContext(),u=o!=null&&o.identifier?Ze(s,o.identifier):void 0,c=I.useMemo(()=>pi(o,u),[o,u]);I.useEffect(()=>{if(!c)for(const d of a)f(d.getId(),"").then()},[c,a,f]);const l=ur(a,t);return c?g.jsxs(E.Card,{variant:"soft",className:"flex flex-col gap-4",children:[(n||i)&&g.jsxs(g.Fragment,{children:[g.jsxs("div",{className:"flex flex-col gap-1",children:[g.jsx(E.Heading,{size:"md",children:n}),i&&g.jsx(E.Text,{accentColor:"base",children:i})]}),g.jsx(E.Separator,{size:"full"})]}),l]}):null});xi.displayName="FieldSectionLayout";const jt=class jt extends nn{constructor(t){const{label:n=null,fields:i,condition:a=null,conditional:o,...s}=t;super({...s,type:"section"});F(this,"label");F(this,"fields");F(this,"condition");this.fields=i,this.condition=a,this.label=n,o===!1&&(this.condition=null)}static getFieldCreationSchema(t,n=""){if(t.length===0)return[];const i=n&&`${n}.`;return[{field:new Nt({label:"Conditionally render section",identifier:`${i}conditional`,required:!1}),showDirectly:!0},{field:new jt({label:"Conditional settings",identifier:`${i}conditional-settings`,condition:{identifier:`${i}conditional`,value:!0},fields:[new ar({label:"Field",description:"The field to use for the condition.",options:t.map(a=>!a.label||a.type==="upload"?null:{label:a.label,value:a.identifier}).filter(a=>!!a),identifier:`${i}condition.identifier`,required:!0}),new R1({label:"Value",identifier:`${i}condition.value`,required:!0,clonedFieldIdentifier:`${i}condition.identifier`,getFieldToClone(a){if(!a)return null;const o=t.find(s=>s.identifier===a);return o?{...o,label:"Value",identifier:`${i}condition.value`,description:"The value to compare against.",required:o.type!=="boolean"}:(console.error("Could not find field with identifier",a),null)}})]}),showDirectly:!1}]}static deserialize(t){if(t.type!=="section")throw new Error("Invalid type");if(!Array.isArray(t.fields))throw new Error(`Invalid fields: ${t.fields} (not an array)`);const n=t.fields.map(vi);return new jt({...t,fields:n})}conditional(){return this.condition!==null}serialize(){return{...super._serialize(),label:this.label,condition:this.condition,conditional:this.conditional(),fields:this.fields.map(t=>t.serialize())}}getErrors(t){const n={};for(const i of this.fields){const a=i.getId(),o=i.getError(Ze(t,a),t);o&&It(n,i.getId(),o)}return n}getInput(t){return g.jsx(xi,{field:this,...t})}};F(jt,"fieldTypeName","Section"),F(jt,"fieldTypeDescription","Sections can be useful for grouping fields together. They can also be conditionally shown or hidden.");let Te=jt;const At=r=>Object.keys(r).length>0,qr=(r,e)=>{const t={};for(const n of r)if(n instanceof Te){if(n.condition){const{identifier:i}=n.condition;if(!pi(n.condition,Ze(e,i)))continue}Object.assign(t,n.getErrors(e))}else{if(!(n instanceof ve))throw new Error("Invalid field type");const i=n.getId(),a=n.getError(Ze(e,i),e);a&&It(t,i,a)}if(At(t))return t},Qr=(r,e)=>r.reduce((t,n)=>{if(n instanceof Te)return{...t,...Qr(n.fields,e)};const i=n.getId(),a=t[i];switch(a){case"":It(t,i,void 0);break;case[]:It(t,i,void 0);break;default:It(t,i,a??void 0)}return t},ss(e)),jo=(r,e,t)=>r.reduce((n,i)=>{if(i instanceof Te)return{...n,...jo(i.fields,e,t)};if(i instanceof ve){const a=i.getId(),o=e[a],s=t[a];i.isEqual(o,s)||It(n,a,s)}return n},{}),Yo=I.memo(I.forwardRef((r,e)=>{const{schema:t,values:n={},onValuesChange:i,onSubmit:a,submitText:o="Submit",cancelText:s,onCancel:f,onDirty:u,onDirtyChange:c,hideTitle:l=!t.title,hideDescription:d,className:h,buttonProps:v,enableReinitialize:p=!1,excludeUnchangedFields:x=!1}=r,{readonly:m}=t.meta,w=I.useId(),C=I.useMemo(()=>Qr(t.fields,n),[t.fields,n]),A=I.useCallback(U=>{a==null||a(x?jo(t.fields,C,U):U)},[x,C,a,t.fields]),_=Ie.useFormik({initialValues:C,onSubmit:A,validate:U=>qr(t.fields,U),validateOnBlur:!1,validateOnChange:!1,enableReinitialize:!1});I.useLayoutEffect(()=>{p&&_.resetForm({values:C})},[p,C]);const{dirty:b}=_,T=I.useMemo(()=>typeof t.title=="string"?g.jsx(E.Heading,{size:"md",children:t.title}):t.title,[t.title]),D=I.useMemo(()=>typeof t.description=="string"?g.jsx(E.Text,{accentColor:"base",children:t.description}):t.description,[t.description]),M=I.useCallback((U,H)=>{$o(t.fields)[U].isEqual(C[U],H)||i==null||i({..._.values,[U]:H},{[U]:H})},[_.values,C,i,t.fields]),B=ur(t.fields,{formId:w,disabled:m,onValuesChange:M});return I.useEffect(()=>{b&&u&&u(),c&&c(b)},[b,u,c]),g.jsx(Ie.FormikProvider,{value:_,children:g.jsxs("form",{id:w,ref:e,className:Et.cx(h,"flex flex-col gap-4"),onSubmit:_.handleSubmit,children:[!l&&g.jsxs(E.Card,{variant:"soft",className:"flex flex-col gap-1",children:[T,!d&&D]}),B,!m&&g.jsxs(E.ButtonGroup,{className:"flex items-center justify-end gap-2",size:"sm",children:[s&&g.jsxs(E.Button,{accentColor:"base",...v,type:"button",variant:"soft",onClick:f,children:[g.jsx(E.RiIcon,{icon:"RiCloseLine"}),s]}),g.jsxs(E.Button,{...v,type:"submit",disabled:!_.isValid,accentColor:"primary",variant:"surface",children:[g.jsx(E.RiIcon,{icon:"RiCheckLine"}),o]})]})]})})})),_t=I.memo(r=>{const{name:e,render:t}=r,{submitForm:n}=Ie.useFormikContext(),[i,a,o]=Ie.useField(e),s=I.useMemo(()=>{const f=u=>{o.setValue(u,!1)};return t({value:i.value,meta:a,setValue:f,patchValue:()=>{n()}})},[t,i.value,a,n,o]);return g.jsx(g.Fragment,{children:s})});_t.displayName="PatchField";const k1=I.memo(I.forwardRef((r,e)=>{const{children:t,schema:n,values:i,onPatch:a,onError:o,requiresDiff:s=!0,onDirtyChange:f,...u}=r,c=I.useMemo(()=>Qr(n.fields,i),[n.fields,i]),l=I.useCallback(w=>{const C={};for(const A in w){const _=w[A];_!==c[A]&&_!==void 0&&(C[A]=_)}return C},[c]),d=I.useCallback(w=>{const C=l(w);s&&!At(C)||a(C)},[l,a,s]),h=I.useCallback(w=>{const C=qr(n.fields,w);if(C&&o(C),f){const A=l(w);f(At(A))}return C},[n.fields,f,o,l]),v=Ie.useFormik({initialValues:c,onSubmit:d,validate:h,validateOnBlur:!1,validateOnChange:!1}),p=I.useCallback(()=>{if(f){const w=l(v.values);At(w)&&f(!0)}},[v.values,l,f]),{errors:x,resetForm:m}=v;return I.useEffect(()=>{At(x)&&m({values:c,errors:{}})},[x,c,m]),g.jsx(Ie.FormikProvider,{value:v,children:g.jsx("form",{...u,ref:e,onSubmit:v.handleSubmit,onChange:p,children:t})})})),Jr="form-builder",U1=[["string","text"],["select","multi-select","upload","qr","radio","checkbox-list"],["boolean","date","number","multi-string"]],yi={...jr,section:Te},en=I.createContext({}),V1=(r,e)=>{var n;const t={...r};switch(e.type){case"release":for(const i in t)t[i].disabled=!1;return t;case"hold":for(const i in t)(n=t[i])!=null&&n.conditionFields.has(e.fieldId)&&(t[i].disabled=!0);return t;case"update":return e.state}},H1=(r,e)=>{if(e)for(let t=0;t<r.length;t++){const n=r[t];if(n){for(const i of n.fields)if(i.identifier===e)return t}}},Zo=r=>{var t,n,i;const e={};for(let a=0;a<r.length;a++){const o=r[a];if(!o)throw new Error("Field is undefined.");const s=a>0?(t=e[r[a-1].identifier])==null?void 0:t.conditionFields:void 0,f=new Set(s);(n=o.condition)!=null&&n.identifier&&f.add(o.condition.identifier),e[o.identifier]={disabled:!1,conditionFields:f,conditionIndex:H1(r,(i=o.condition)==null?void 0:i.identifier),index:a,label:o.label}}return e},wi=I.memo(r=>{const{index:e,type:t,sectionIndex:n,remove:i,duplicate:a,move:o,upload:s}=r;if(t!=="section"&&!s)throw new Error("Upload function prop must be defined for non-section fields.");const{values:f}=Ie.useFormikContext(),u=I.useRef(null),c=I.useMemo(()=>{const l=[{Icon:me.RiFileCopyLine,key:"duplicate",text:"Duplicate",buttonProps:{onClick:a}}];return l.push({Icon:me.RiDeleteBin7Fill,key:"delete",text:"Delete",buttonProps:{onClick:i}}),t!=="section"&&l.unshift({Icon:me.RiImageLine,key:"upload",text:"Upload image",buttonProps:{onClick:()=>{var d;(d=u.current)==null||d.click()}}}),(n===void 0&&e!==f.fields.length-1||n!==void 0&&(n<f.fields.length-1||e!==f.fields[n].fields.length-1))&&l.unshift({Icon:me.RiArrowDownLine,key:"moveDown",text:"Move down",buttonProps:{onClick:()=>{o("down")}}}),(n===void 0&&e!==0||n!==void 0&&(n!==0||e!==0))&&l.unshift({Icon:me.RiArrowUpLine,key:"moveUp",text:"Move up",buttonProps:{onClick:()=>{o("up")}}}),l},[a,e,o,i,n,t,f.fields]);return g.jsxs(g.Fragment,{children:[g.jsx(E.ButtonGroup,{className:"hidden flex-col gap-0.5 sm:flex",variant:"ghost",accentColor:"base",size:"sm",children:c.map(l=>g.jsx(E.IconButton,{type:"button","aria-label":l.text,...l.buttonProps,children:g.jsx(l.Icon,{})},l.key))}),g.jsx("div",{className:"sm:hidden",children:g.jsxs(E.Menu.Root,{children:[g.jsx(E.Menu.ClickTrigger,{children:g.jsx(E.IconButton,{variant:"ghost",accentColor:"base","aria-label":"Actions menu",size:"sm",type:"button",children:g.jsx(E.RiIcon,{icon:"RiMore2Line"})})}),g.jsx(E.Menu.Content,{children:c.map(l=>{var d;return g.jsxs(E.Menu.Item,{onClick:(d=l.buttonProps)==null?void 0:d.onClick,children:[g.jsx(l.Icon,{}),l.text]},l.key)})})]})}),t!=="section"&&g.jsx("input",{className:"hidden",ref:u,type:"file",accept:"image/*",onChange:s})]})});wi.displayName="FieldActions";const mi=I.memo(r=>{const{popoverInputs:e,hasError:t,...n}=r;return g.jsxs(E.Popover.Root,{children:[g.jsx(E.Popover.Trigger,{asChild:!0,children:g.jsxs(E.Button,{variant:"soft",type:"button",size:"sm","aria-label":"settings",accentColor:"base",...t&&{color:lt.danger},children:[g.jsx(E.RiIcon,{icon:"RiSettings2Line"}),"Settings"]},"settings")}),g.jsx(E.Popover.Content,{size:"sm",...n,children:g.jsx("div",{className:"flex w-full max-w-[350px] flex-col",children:e})})]})});mi.displayName="FieldSettingsPopover";const Ko=(r=()=>null)=>I.useMemo(()=>U1.map(e=>e.map(t=>{const n=jr[t],i=n.Icon;return{children:n.fieldTypeName,icon:g.jsx(i,{}),value:t,onSelect:()=>{r(t)}}})),[r]),qo=576,Ci=I.memo(r=>{var tn,rs,ns,is,as;const{parentPath:e,index:t,initial:n,conditionalSourceFields:i}=r,{values:a,setFieldValue:o,errors:s}=Ie.useFormikContext(),f=Ko(),u=vr(),{disableRequiredFields:c}=I.use(en),l=I.useRef(null),[d,h]=I.useState(l.current&&l.current.getBoundingClientRect().width>=qo);I.useEffect(()=>{const X=l.current;if(X){const ae=new ResizeObserver(Pe=>{Pe[0]&&h(Pe[0].contentRect.width>=qo)});return ae.observe(X),()=>{ae.disconnect()}}},[]);const[v,p]=I.useState(void 0);I.useEffect(()=>{dt(n)?p(void 0):n.image instanceof Promise?n.image.then(p).catch(console.error):p(n.image)},[n]);const x=v?URL.createObjectURL(v):void 0,m=I.useCallback(X=>{X.stopPropagation();const{image:ae,...Pe}=n;o(`${e}.${t}`,Pe).then()},[t,n,e,o]);I.useEffect(()=>{dt(n)&&!n.conditional&&o(`${e}.${t}.condition`,null).then()},[t,n,e,o]);const w=I.useMemo(()=>{var X,ae;return dt(n)?(ae=Ti(a.fields,(X=n.condition)==null?void 0:X.identifier))==null?void 0:ae.label:void 0},[n,a.fields]),C=dt(n)?Array.isArray((tn=n.condition)==null?void 0:tn.value)?"contains all of":"equals":void 0;let A;if(dt(n)){if(Kr((rs=n.condition)==null?void 0:rs.value))throw new Error("File values are not supported for conditions.");A=Array.isArray((ns=n.condition)==null?void 0:ns.value)?n.condition.value.map(X=>typeof X=="string"?X:X.label).join(", "):(as=(is=n.condition)==null?void 0:is.value)==null?void 0:as.toString()}const _=I.useCallback(X=>{X.target.parentNode instanceof HTMLElement&&(X.target.parentNode.dataset.replicatedValue=X.target.value)},[]),b=I.useCallback(X=>{X.target.parentNode instanceof HTMLElement&&(X.target.parentNode.dataset.replicatedValue=X.target.value)},[]),T=n.type,D=yi[T],[M,B]=I.useMemo(()=>{let X=[],ae=[];if(D===Te){if(i===void 0)throw new Error("Conditional source fields must be provided when changing sections.");const Pe=D.getFieldCreationSchema(i,`${e}.${t}`);X=X.concat(Pe.filter(Ee=>Ee.showDirectly).map(Ee=>Ee.field)),ae=ae.concat(Pe.filter(Ee=>!Ee.showDirectly).map(Ee=>Ee.field))}else{if(!(D.prototype instanceof ve))throw new Error(`Field must be an instance of BaseField. Got ${D.toString()}.`);const Pe=D.getFieldCreationSchema(`${e}.${t}`);d?(X=[...X,...Pe.filter(Ee=>Ee.showDirectly).map(Ee=>Ee.field)],ae=[...ae,...Pe.filter(Ee=>!Ee.showDirectly).map(Ee=>Ee.field)]):ae=[...ae,...Pe.map(Ee=>Ee.field)]}return[X,ae]},[D,i,e,t,d]),U=ur(M,{formId:Jr,disabled:!1,...D===Te&&{size:"sm"}}),H=ur(B,{formId:Jr,disabled:!1});let W=B.length>0;dt(n)&&B.length>0&&(W=n.conditional);const se=B.some(X=>{const ae=Ze(s,D===Te?`${e}.${t}.condition`:X.getId());return ae&&(typeof ae!="object"||At(ae))}),j=se?lt.danger:void 0,we=I.useMemo(()=>Yr(n),[n]),et=gi(we,{formId:Jr,showInputOnly:!1}),Ge=I.useMemo(()=>f.flat().find(X=>X.value===T),[f,T]),Ai=I.useCallback(()=>{v&&u(()=>({file:v}))},[u,v]);return g.jsxs("div",{className:"flex grow w-full flex-col gap-4",ref:l,children:[D===Te&&(M.length>0||W)&&g.jsxs("div",{className:"flex flex-col gap-2",children:[U,W&&g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx(mi,{popoverInputs:H,hasError:se,align:"start"}),dt(n)&&n.conditional&&g.jsx("span",{className:"text-sm text-(--accent-a11)","data-accent-color":j,children:g.jsxs("em",{children:["Display only if ",g.jsx("strong",{children:w})," ",C," ",g.jsx("strong",{children:A})]})})]})]}),D!==Te&&g.jsxs("div",{className:"flex gap-2 w-full justify-between",children:[g.jsxs("div",{className:"flex gap-2 items-center",children:[g.jsxs(E.Badge,{accentColor:"base",variant:"soft",size:"sm",children:[Ge==null?void 0:Ge.icon,Ge==null?void 0:Ge.children]}),!c&&g.jsx(_t,{name:`${e}.${t}.required`,render:({setValue:X,value:ae})=>g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx(E.Checkbox.Root,{checked:ae,onCheckedChange:X,size:"sm",children:g.jsx(E.Checkbox.Indicator,{children:g.jsx(E.RiIcon,{icon:"RiCheckLine"})})}),g.jsx(E.Text,{size:"sm",accentColor:"base",children:"Required"})]})})]}),W&&g.jsx(mi,{popoverInputs:H,hasError:se,align:"end"})]}),v&&g.jsxs("div",{className:"group relative inline-block w-full min-w-[300px]",children:[g.jsx("img",{className:"h-[100px] w-full min-w-[300px] cursor-pointer rounded-md object-cover",src:x,alt:v.name,onClick:Ai}),g.jsx(E.IconButton,{className:"absolute top-2 right-2 hidden group-hover:not-disabled:flex",variant:"solid",accentColor:"base","aria-label":"delete",onClick:m,size:"sm",children:g.jsx(E.RiIcon,{icon:"RiDeleteBin7Fill"})})]}),g.jsxs("div",{className:"flex flex-col gap-2 w-full overflow-hidden",children:[g.jsx(_t,{name:`${e}.${t}.label`,render:({setValue:X,value:ae})=>g.jsx("input",{className:"bg-transparent outline-none text-md placeholder-(--base-a9)",placeholder:T==="section"?"Enter a section label (optional)":"Enter your question",value:ae,onChange:Pe=>{X(Pe.target.value)},onInput:_,maxLength:200})}),g.jsx(_t,{name:`${e}.${t}.description`,render:({setValue:X,value:ae})=>g.jsx("textarea",{className:"bg-transparent outline-none text-md field-sizing-content grow placeholder-(--base-a9)",placeholder:`Enter a ${T==="section"?"section":"field"} description (optional)`,value:ae,onChange:Pe=>{X(Pe.target.value)},onInput:b,maxLength:1e3})})]}),D!==Te&&M.length>0&&g.jsx("div",{className:"w-full",children:U}),D!==Te&&g.jsxs(g.Fragment,{children:[g.jsx(E.Separator,{size:"full"}),g.jsxs("div",{className:"flex gap-2 items-center",children:[g.jsxs(E.HoverCard.Root,{children:[g.jsx(E.HoverCard.Trigger,{asChild:!0,children:g.jsx(E.Badge,{icon:!0,size:"sm",variant:"soft",accentColor:"base",children:g.jsx(E.RiIcon,{icon:"RiEyeLine"})})}),g.jsx(E.HoverCard.Content,{className:"w-[225px]",size:"sm",align:"start",children:g.jsx(E.Text,{size:"sm",accentColor:"base",children:"This is a preview of the field as it will be rendered in the form."})})]}),g.jsx("div",{className:"grow h-max min-w-0",children:et})]})]})]})});Ci.displayName="FieldBuilder";const Qo=I.memo(r=>{const{field:e,index:t,sectionIndex:n,remove:i}=r,{setFieldValue:a,values:o}=Ie.useFormikContext(),{reorderField:s}=sn(),{showInfo:f,showError:u}=E.useToast(),c=`fields.${n}.fields`,l=I.useMemo(()=>({index:t,parentPath:c,initial:e}),[e,t,c]),d=I.useCallback(()=>{const p=e.label||"Unlabelled field",x={...e,label:p};hr(c,t+1,x,o,a),f({title:"Field duplicated",description:`The field "${p}" has been duplicated`})},[e,c,t,o,a,f]),h=I.useCallback(p=>{const x=n,m=o.fields[x];let w=n,C=p==="up"?t-1:t+1;p==="up"&&t===0?(w=n-1,C=o.fields[w].fields.length):p==="down"&&t===m.fields.length-1&&(w=n+1,C=0);const A=o.fields[w];s(m,x,t,A,w,C,a)},[n,o.fields,t,s,a]),v=I.useCallback(p=>{const{files:x}=p.target;if(!x||x.length!==1)return;const m=x.item(0);if(m){if(m.size>Go){u({title:"File upload error",description:`The file ${m.name} exceeded the maximum file size`});return}a(`${c}.${t}`,{...e,image:m}).then()}},[e,t,c,a,u]);return g.jsx(rt.Draggable,{draggableId:e.identifier,index:t,children:p=>g.jsxs(E.Card,{ref:p.innerRef,...p.draggableProps,...p.dragHandleProps,className:"flex items-center justify-between gap-4 w-full",children:[g.jsx(Ci,{...l}),g.jsx(wi,{index:t,type:e.type,sectionIndex:n,remove:i,duplicate:d,move:h,upload:v})]})})});Qo.displayName="FieldWithActions";const Jo=I.memo(r=>{var A;const{field:e,index:t,dropState:n}=r,i=(A=n[e.identifier])==null?void 0:A.disabled,{setFieldValue:a,values:o}=Ie.useFormikContext(),s=E.useAlertDialog(),{reorderSection:f}=sn(),{showInfo:u}=E.useToast(),{fieldsOnly:c}=I.use(en),l=I.useCallback((_,b)=>{for(const T of _){const D=b.indexOf(T);a(`fields.${D}.condition`,null).then(),a(`fields.${D}.conditional`,!1).then()}},[a]),d=I.useCallback(_=>{var D;const b=e.fields[_];if(!b)throw new Error("Could not find field to remove.");const T=[];for(const M of o.fields)((D=M.condition)==null?void 0:D.identifier)===b.identifier&&T.push(M);return{removing:b,affectedSections:T,action:()=>a(`fields.${t}.fields`,dr(e.fields,_))}},[e.fields,o.fields,a,t]),h=I.useCallback(_=>{const{affectedSections:b,action:T,removing:D}=d(_),M=()=>{T().then(),l(b,o.fields)};if(b.length>0){const B=b.map(U=>U.label).join(", ");s({title:"Remove condition?",description:`${D.label} is being used as a condition, deleting it will remove the condition from the ${B} section(s).`,action:"Remove",onAction:M});return}M()},[d,l,o.fields,s]),v=I.useCallback(()=>{const b=e.fields.map((W,se)=>d(se)).flatMap(W=>W.affectedSections),T=b.length?"Remove fields and conditions?":"Remove fields?",D=e.fields.length,M=b.map(W=>W.label).join(", "),B=b.length?`Deleting this section will remove the ${D} field(s) it contains and will remove the conditions from following sections: ${M}`:`Deleting this section will remove the ${D} field(s) it contains.`,U=dr(o.fields,t),H=()=>a("fields",U);if(b.length>0){s({title:T,description:B,action:"Remove",onAction:()=>{H().then(()=>{l(b,U)})}});return}H().then()},[e.fields,o.fields,t,d,a,s,l]),p=I.useCallback(_=>{const b=_==="up"?t-1:t+1;f(n,e.identifier,t,b,o,a)},[t,f,n,e.identifier,o,a]),x=I.useMemo(()=>({index:t,parentPath:"fields",initial:e,conditionalSourceFields:Oi(o.fields,t)}),[e,t,o.fields]),m=I.useCallback(()=>{const _=e.label||"Untitled section",b=e.fields.map(D=>({...D,identifier:on()})),T={...e,label:_,fields:b};hr("fields",t+1,T,o,a),u({title:"Section duplicated",description:`The section "${_}" has been duplicated.`})},[e,t,o,a,u]),w=I.useCallback(_=>{hr(`fields.${t}.fields`,e.fields.length,Ho[_],o,a)},[t,e.fields.length,o,a]),C=Ko(w);return g.jsx(rt.Draggable,{draggableId:e.identifier,index:t,children:_=>g.jsxs(E.Card,{ref:_.innerRef,..._.draggableProps,..._.dragHandleProps,variant:"outline",className:"flex items-center justify-between gap-4 w-full",children:[g.jsxs("div",{className:"flex grow flex-col gap-4 w-full",children:[!c&&g.jsx(Ci,{...x}),g.jsx(rt.Droppable,{droppableId:e.identifier,type:"SECTION",isDropDisabled:i,children:b=>g.jsxs("div",{className:"flex flex-col gap-4 w-full",ref:b.innerRef,...b.droppableProps,children:[e.fields.map((T,D)=>g.jsx(Qo,{field:T,index:D,sectionIndex:t,remove:()=>{h(D)}},T.identifier)),b.placeholder,g.jsxs(E.Menu.Root,{children:[g.jsx(E.Menu.ClickTrigger,{children:g.jsxs(E.Button,{type:"button",variant:"soft",size:"sm",children:[g.jsx(E.RiIcon,{icon:"RiAddLine"})," Add field"]})}),g.jsx(E.Menu.Content,{children:g.jsx(E.Menu.Scroll,{children:C.flat().map(T=>g.jsxs(E.Menu.Item,{onSelect:T.onSelect,children:[T.icon,T.children]},T.value))})})]})]})})]}),!c&&g.jsx(wi,{index:t,type:e.type,remove:v,duplicate:m,move:p})]})})});Jo.displayName="FieldSectionWithActions";const es=(r,e)=>{for(const[t,n]of Object.entries(r))if(n.identifier===e)return[n,t]},ts=I.memo(()=>{const{values:r,setFieldValue:e}=Ie.useFormikContext(),[t,n]=I.useReducer(V1,r.fields,Zo),{reorderSection:i,reorderField:a}=sn(),{fieldsOnly:o}=I.use(en);I.useEffect(()=>{n({type:"update",state:Zo(r.fields)})},[n,r.fields]);const s=I.useCallback(c=>{c.type==="SECTION"&&n({type:"hold",fieldId:c.draggableId})},[]),f=I.useCallback(c=>{const{source:l,destination:d,type:h,reason:v,draggableId:p}=c;if(n({type:"release"}),!d||v==="CANCEL")return;if(h==="ROOT"){i(t,p,l.index,d.index,r,e);return}if(h!=="SECTION")throw new Error("Unexpected droppable type.");const[x,m]=es(r.fields,l.droppableId)??[],[w,C]=es(r.fields,d.droppableId)??[];a(x,m,l.index,w,C,d.index,e)},[r,a,e,i,t]),u=I.useCallback(c=>{cs(c+1,r,e)},[r,e]);return g.jsx(rt.DragDropContext,{onDragStart:s,onDragEnd:f,children:g.jsx(rt.Droppable,{droppableId:"droppable",type:"ROOT",children:c=>g.jsxs("div",{className:"flex flex-col gap-4",ref:c.innerRef,...c.droppableProps,children:[r.fields.map((l,d)=>g.jsxs(I.Fragment,{children:[g.jsx(Jo,{field:l,index:d,dropState:t,fieldsOnly:o}),!o&&d!==r.fields.length-1&&g.jsxs(E.Button,{type:"button",variant:"soft",size:"sm",accentColor:"base",onClick:()=>{u(d)},children:[g.jsx(E.RiIcon,{icon:"RiAddLine"})," Add section"]})]},l.identifier)),g.jsxs(E.Button,{className:"mb-4",type:"button",variant:"soft",accentColor:"base",size:"sm",onClick:()=>{u(r.fields.length)},children:[g.jsx(E.RiIcon,{icon:"RiAddLine"})," Add section"]}),c.placeholder]})})})});ts.displayName="FieldsEditor";const z1=I.memo(I.forwardRef((r,e)=>{const{onCancel:t,onSave:n,initialTitle:i,initialDescription:a,initialFields:o,showExplainerText:s=!0,showFormTitle:f=!0,fieldsOnly:u=!1,showTabs:c=!0,disableRequiredFields:l=!1,enableReinitialize:d=!1,tabsListClassName:h}=r,{showError:v}=E.useToast(),p=I.useCallback(A=>{const _={};A.title||(_.title="Title is required."),(!A.fields||A.fields.length===0)&&(_.fields="At least one field is required.");let b=[];for(const[D,M]of A.fields.entries()){const U=yi.section.getFieldCreationSchema(Oi(A.fields,D),`fields.${D}`).map(H=>H.field);b=[...b,...U];for(const[H,W]of M.fields.entries()){const j=yi[W.type].getFieldCreationSchema(`fields.${D}.fields.${H}`).map(we=>we.field);b=[...b,...j]}}const T=qr(b,A);if(T&&(_.fields=T.fields),At(_))return v({title:"Some form settings are invalid",description:"Please check settings highlighted in red."}),_},[v]),x=I.useMemo(()=>({title:i??"",description:a??"",fields:o?us(o):[{...lr(on()),label:""}]}),[a,o,i]),m=Ie.useFormik({initialValues:x,validate:p,onSubmit:n,validateOnChange:!1,validateOnBlur:!1,enableReinitialize:d}),w=I.useMemo(()=>({title:m.values.title,description:m.values.description,fields:Xo(m.values.fields),meta:{readonly:!1}}),[m.values]),C=I.useMemo(()=>({disableRequiredFields:l,fieldsOnly:u}),[l,u]);return g.jsx(en,{value:C,children:g.jsx(E.SegmentedTabs.Root,{ref:e,defaultValue:"edit",children:g.jsxs("div",{className:"flex flex-col gap-4",children:[c&&g.jsxs(E.SegmentedTabs.List,{className:Et.cx("sticky top-0 z-[2000] flex bg-(--color-background)",h),accentColor:"base",size:"sm",children:[g.jsxs(E.SegmentedTabs.Trigger,{className:"grow",value:"edit",children:[g.jsx(E.RiIcon,{icon:"RiPencilLine"}),"Edit"]}),g.jsxs(E.SegmentedTabs.Trigger,{className:"grow",value:"preview",children:[g.jsx(E.RiIcon,{icon:"RiEyeLine"}),"Preview"]})]}),g.jsxs(E.SegmentedTabs.Content,{value:"edit",className:"flex flex-col gap-4",children:[s&&g.jsx(E.Text,{accentColor:"base",size:"sm",children:"Create your form using various field types. Sections can be conditionally rendered based on answers to fields in preceding sections."}),g.jsxs("form",{className:"flex flex-col gap-4",id:Jr,onSubmit:m.handleSubmit,children:[g.jsxs(Ie.FormikProvider,{value:m,children:[f&&g.jsxs(g.Fragment,{children:[g.jsx(_t,{name:"title",render:({setValue:A,value:_,meta:b})=>g.jsx(fn,{severity:"danger",helpText:b.error??null,children:g.jsx(E.Input.Root,{variant:"outline",size:"md",accentColor:b.error?lt.danger:"primary",children:g.jsx(E.Input.Field,{placeholder:"Enter a title",value:_,onChange:T=>{A(T.target.value)},maxLength:100})})})}),g.jsx(_t,{name:"description",render:({setValue:A,value:_})=>g.jsx(E.TextArea,{className:"field-sizing-content",placeholder:"Explain a description",value:_,onChange:b=>{A(b.target.value)},resize:"vertical",maxLength:1e3,size:"md"})})]}),g.jsx(ts,{}),!!m.errors.fields&&g.jsx("span",{"data-accent-color":lt.danger,className:"text-xs text-(--accent-a11)",children:typeof m.errors.fields=="string"&&m.errors.fields})]}),g.jsxs(E.ButtonGroup,{className:"flex items-center justify-end gap-2",size:"sm",children:[t&&g.jsx(E.Button,{type:"button",variant:"soft",accentColor:"base",onClick:t,children:"Cancel"}),g.jsx(E.Button,{type:"submit",variant:"surface",children:"Save form"})]})]})]}),g.jsx(E.SegmentedTabs.Content,{value:"preview",children:g.jsx(Yo,{schema:w,hideTitle:!f})})]})})})}));P.BaseField=ve,P.BaseFormElement=nn,P.BaseSelectField=En,P.BooleanField=Nt,P.BooleanInput=In,P.CheckboxListField=Sr,P.CheckboxListInput=Sn,P.DateField=Tr,P.DateInput=bn,P.FieldSection=Te,P.FieldSectionLayout=xi,P.FieldTypeToClsMapping=jr,P.FieldTypeToEmptyFieldMapping=Ho,P.FileCard=rn,P.FormBuilder=z1,P.FormRenderer=Yo,P.ImageCard=Lo,P.ImageViewer=An,P.ImageViewerProvider=Sa,P.InputWithHelpText=fn,P.InputWithLabel=ke,P.InputWithLabelAndHelpText=Ue,P.LONG_TEXT_FIELD_MAX_LENGTH=Ct,P.MultiSelectField=Kt,P.MultiSelectInput=Tn,P.MultiStringField=pt,P.MultiStringInput=_n,P.NumberField=at,P.NumberInput=On,P.PatchField=_t,P.PatchFormProvider=k1,P.RadioField=Or,P.RadioInput=Nn,P.SEVERITY_COLOR_MAPPING=lt,P.SHORT_TEXT_FIELD_MAX_LENGTH=or,P.ScanField=Gr,P.ScanInput=fi,P.Scanner=ui,P.SelectField=ar,P.SelectInput=ci,P.StringField=Wr,P.StringInput=li,P.StringOrTextField=sr,P.TextField=Xr,P.TextInput=di,P.UploadField=$r,P.UploadInput=hi,P.decodeFieldValues=B1,P.deserialize=Yr,P.deserializeField=vi,P.deserializeFields=Xo,P.emptyBaseField=Me,P.emptyBooleanField=Ta,P.emptyCheckboxListField=Oa,P.emptyDateField=Na,P.emptyMultiSelectField=Da,P.emptyMultiStringField=ba,P.emptyNumberField=Pa,P.emptyRadioField=Fa,P.emptyScanField=Po,P.emptySelectField=Mo,P.emptyStringField=Ro,P.emptyTextField=Bo,P.emptyUploadField=Uo,P.encodeFieldValues=L1,P.fieldIcons=F1,P.flattenFields=Zr,P.getFieldsMapping=$o,P.initializeFormValues=Qr,P.isConditionMet=pi,P.maxFileSizeB=Go,P.maxFileSizeKB=zo,P.maxFileSizeMB=fr,P.useFieldInput=gi,P.useFieldInputs=ur,P.useFormikInput=Le,P.useImageViewer=vr,P.validateFields=qr,P.valueIsFile=Kr,Object.defineProperty(P,Symbol.toStringTag,{value:"Module"})});
|
|
62
|
+
`),e.toString()},r.prototype.setMode=function(e){this.mode=e},r.prototype.setECLevel=function(e){this.ecLevel=e},r.prototype.setVersion=function(e){this.version=e},r.prototype.setMaskPattern=function(e){this.maskPattern=e},r.prototype.setMatrix=function(e){this.matrix=e},r.isValidMaskPattern=function(e){return e>=0&&e<r.NUM_MASK_PATTERNS},r.NUM_MASK_PATTERNS=8,r}(),Bd=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)i.hasOwnProperty(o)&&(n[o]=i[o])},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){Bd(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.kind="WriterException",e}(Re),Wa=function(){function r(){}return r.clearMatrix=function(e){e.clear(255)},r.buildMatrix=function(e,t,n,i,o){r.clearMatrix(o),r.embedBasicPatterns(n,o),r.embedTypeInfo(t,i,o),r.maybeEmbedVersionInfo(n,o),r.embedDataBits(e,i,o)},r.embedBasicPatterns=function(e,t){r.embedPositionDetectionPatternsAndSeparators(t),r.embedDarkDotAtLeftBottomCorner(t),r.maybeEmbedPositionAdjustmentPatterns(e,t),r.embedTimingPatterns(t)},r.embedTypeInfo=function(e,t,n){var i=new me;r.makeTypeInfoBits(e,t,i);for(var o=0,a=i.getSize();o<a;++o){var s=i.get(i.getSize()-1-o),l=r.TYPE_INFO_COORDINATES[o],u=l[0],c=l[1];if(n.setBoolean(u,c,s),o<8){var f=n.getWidth()-o-1,h=8;n.setBoolean(f,h,s)}else{var f=8,h=n.getHeight()-7+(o-8);n.setBoolean(f,h,s)}}},r.maybeEmbedVersionInfo=function(e,t){if(!(e.getVersionNumber()<7)){var n=new me;r.makeVersionInfoBits(e,n);for(var i=17,o=0;o<6;++o)for(var a=0;a<3;++a){var s=n.get(i);i--,t.setBoolean(o,t.getHeight()-11+a,s),t.setBoolean(t.getHeight()-11+a,o,s)}}},r.embedDataBits=function(e,t,n){for(var i=0,o=-1,a=n.getWidth()-1,s=n.getHeight()-1;a>0;){for(a===6&&(a-=1);s>=0&&s<n.getHeight();){for(var l=0;l<2;++l){var u=a-l;if(r.isEmpty(n.get(u,s))){var c=void 0;i<e.getSize()?(c=e.get(i),++i):c=!1,t!==255&&hr.getDataMaskBit(t,u,s)&&(c=!c),n.setBoolean(u,s,c)}}s+=o}o=-o,s+=o,a-=2}if(i!==e.getSize())throw new ue("Not all bits consumed: "+i+"/"+e.getSize())},r.findMSBSet=function(e){return 32-Y.numberOfLeadingZeros(e)},r.calculateBCHCode=function(e,t){if(t===0)throw new $("0 polynomial");var n=r.findMSBSet(t);for(e<<=n-1;r.findMSBSet(e)>=n;)e^=t<<r.findMSBSet(e)-n;return e},r.makeTypeInfoBits=function(e,t,n){if(!wi.isValidMaskPattern(t))throw new ue("Invalid mask pattern");var i=e.getBits()<<3|t;n.appendBits(i,5);var o=r.calculateBCHCode(i,r.TYPE_INFO_POLY);n.appendBits(o,10);var a=new me;if(a.appendBits(r.TYPE_INFO_MASK_PATTERN,15),n.xor(a),n.getSize()!==15)throw new ue("should not happen but we got: "+n.getSize())},r.makeVersionInfoBits=function(e,t){t.appendBits(e.getVersionNumber(),6);var n=r.calculateBCHCode(e.getVersionNumber(),r.VERSION_INFO_POLY);if(t.appendBits(n,12),t.getSize()!==18)throw new ue("should not happen but we got: "+t.getSize())},r.isEmpty=function(e){return e===255},r.embedTimingPatterns=function(e){for(var t=8;t<e.getWidth()-8;++t){var n=(t+1)%2;r.isEmpty(e.get(t,6))&&e.setNumber(t,6,n),r.isEmpty(e.get(6,t))&&e.setNumber(6,t,n)}},r.embedDarkDotAtLeftBottomCorner=function(e){if(e.get(8,e.getHeight()-8)===0)throw new ue;e.setNumber(8,e.getHeight()-8,1)},r.embedHorizontalSeparationPattern=function(e,t,n){for(var i=0;i<8;++i){if(!r.isEmpty(n.get(e+i,t)))throw new ue;n.setNumber(e+i,t,0)}},r.embedVerticalSeparationPattern=function(e,t,n){for(var i=0;i<7;++i){if(!r.isEmpty(n.get(e,t+i)))throw new ue;n.setNumber(e,t+i,0)}},r.embedPositionAdjustmentPattern=function(e,t,n){for(var i=0;i<5;++i)for(var o=r.POSITION_ADJUSTMENT_PATTERN[i],a=0;a<5;++a)n.setNumber(e+a,t+i,o[a])},r.embedPositionDetectionPattern=function(e,t,n){for(var i=0;i<7;++i)for(var o=r.POSITION_DETECTION_PATTERN[i],a=0;a<7;++a)n.setNumber(e+a,t+i,o[a])},r.embedPositionDetectionPatternsAndSeparators=function(e){var t=r.POSITION_DETECTION_PATTERN[0].length;r.embedPositionDetectionPattern(0,0,e),r.embedPositionDetectionPattern(e.getWidth()-t,0,e),r.embedPositionDetectionPattern(0,e.getWidth()-t,e);var n=8;r.embedHorizontalSeparationPattern(0,n-1,e),r.embedHorizontalSeparationPattern(e.getWidth()-n,n-1,e),r.embedHorizontalSeparationPattern(0,e.getWidth()-n,e);var i=7;r.embedVerticalSeparationPattern(i,0,e),r.embedVerticalSeparationPattern(e.getHeight()-i-1,0,e),r.embedVerticalSeparationPattern(i,e.getHeight()-i,e)},r.maybeEmbedPositionAdjustmentPatterns=function(e,t){if(!(e.getVersionNumber()<2))for(var n=e.getVersionNumber()-1,i=r.POSITION_ADJUSTMENT_PATTERN_COORDINATE_TABLE[n],o=0,a=i.length;o!==a;o++){var s=i[o];if(s>=0)for(var l=0;l!==a;l++){var u=i[l];u>=0&&r.isEmpty(t.get(u,s))&&r.embedPositionAdjustmentPattern(u-2,s-2,t)}}},r.POSITION_DETECTION_PATTERN=Array.from([Int32Array.from([1,1,1,1,1,1,1]),Int32Array.from([1,0,0,0,0,0,1]),Int32Array.from([1,0,1,1,1,0,1]),Int32Array.from([1,0,1,1,1,0,1]),Int32Array.from([1,0,1,1,1,0,1]),Int32Array.from([1,0,0,0,0,0,1]),Int32Array.from([1,1,1,1,1,1,1])]),r.POSITION_ADJUSTMENT_PATTERN=Array.from([Int32Array.from([1,1,1,1,1]),Int32Array.from([1,0,0,0,1]),Int32Array.from([1,0,1,0,1]),Int32Array.from([1,0,0,0,1]),Int32Array.from([1,1,1,1,1])]),r.POSITION_ADJUSTMENT_PATTERN_COORDINATE_TABLE=Array.from([Int32Array.from([-1,-1,-1,-1,-1,-1,-1]),Int32Array.from([6,18,-1,-1,-1,-1,-1]),Int32Array.from([6,22,-1,-1,-1,-1,-1]),Int32Array.from([6,26,-1,-1,-1,-1,-1]),Int32Array.from([6,30,-1,-1,-1,-1,-1]),Int32Array.from([6,34,-1,-1,-1,-1,-1]),Int32Array.from([6,22,38,-1,-1,-1,-1]),Int32Array.from([6,24,42,-1,-1,-1,-1]),Int32Array.from([6,26,46,-1,-1,-1,-1]),Int32Array.from([6,28,50,-1,-1,-1,-1]),Int32Array.from([6,30,54,-1,-1,-1,-1]),Int32Array.from([6,32,58,-1,-1,-1,-1]),Int32Array.from([6,34,62,-1,-1,-1,-1]),Int32Array.from([6,26,46,66,-1,-1,-1]),Int32Array.from([6,26,48,70,-1,-1,-1]),Int32Array.from([6,26,50,74,-1,-1,-1]),Int32Array.from([6,30,54,78,-1,-1,-1]),Int32Array.from([6,30,56,82,-1,-1,-1]),Int32Array.from([6,30,58,86,-1,-1,-1]),Int32Array.from([6,34,62,90,-1,-1,-1]),Int32Array.from([6,28,50,72,94,-1,-1]),Int32Array.from([6,26,50,74,98,-1,-1]),Int32Array.from([6,30,54,78,102,-1,-1]),Int32Array.from([6,28,54,80,106,-1,-1]),Int32Array.from([6,32,58,84,110,-1,-1]),Int32Array.from([6,30,58,86,114,-1,-1]),Int32Array.from([6,34,62,90,118,-1,-1]),Int32Array.from([6,26,50,74,98,122,-1]),Int32Array.from([6,30,54,78,102,126,-1]),Int32Array.from([6,26,52,78,104,130,-1]),Int32Array.from([6,30,56,82,108,134,-1]),Int32Array.from([6,34,60,86,112,138,-1]),Int32Array.from([6,30,58,86,114,142,-1]),Int32Array.from([6,34,62,90,118,146,-1]),Int32Array.from([6,30,54,78,102,126,150]),Int32Array.from([6,24,50,76,102,128,154]),Int32Array.from([6,28,54,80,106,132,158]),Int32Array.from([6,32,58,84,110,136,162]),Int32Array.from([6,26,54,82,110,138,166]),Int32Array.from([6,30,58,86,114,142,170])]),r.TYPE_INFO_COORDINATES=Array.from([Int32Array.from([8,0]),Int32Array.from([8,1]),Int32Array.from([8,2]),Int32Array.from([8,3]),Int32Array.from([8,4]),Int32Array.from([8,5]),Int32Array.from([8,7]),Int32Array.from([8,8]),Int32Array.from([7,8]),Int32Array.from([5,8]),Int32Array.from([4,8]),Int32Array.from([3,8]),Int32Array.from([2,8]),Int32Array.from([1,8]),Int32Array.from([0,8])]),r.VERSION_INFO_POLY=7973,r.TYPE_INFO_POLY=1335,r.TYPE_INFO_MASK_PATTERN=21522,r}(),Ld=function(){function r(e,t){this.dataBytes=e,this.errorCorrectionBytes=t}return r.prototype.getDataBytes=function(){return this.dataBytes},r.prototype.getErrorCorrectionBytes=function(){return this.errorCorrectionBytes},r}(),Xa=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.")};(function(){function r(){}return r.calculateMaskPenalty=function(e){return hr.applyMaskPenaltyRule1(e)+hr.applyMaskPenaltyRule2(e)+hr.applyMaskPenaltyRule3(e)+hr.applyMaskPenaltyRule4(e)},r.encode=function(e,t,n){n===void 0&&(n=null);var i=r.DEFAULT_BYTE_MODE_ENCODING,o=n!==null&&n.get(rn.CHARACTER_SET)!==void 0;o&&(i=n.get(rn.CHARACTER_SET).toString());var a=this.chooseMode(e,i),s=new me;if(a===le.BYTE&&(o||r.DEFAULT_BYTE_MODE_ENCODING!==i)){var l=he.getCharacterSetECIByName(i);l!==void 0&&this.appendECI(l,s)}this.appendModeInfo(a,s);var u=new me;this.appendBytes(e,a,u,i);var c;if(n!==null&&n.get(rn.QR_VERSION)!==void 0){var f=Number.parseInt(n.get(rn.QR_VERSION).toString(),10);c=St.getVersionForNumber(f);var h=this.calculateBitsNeeded(a,s,u,c);if(!this.willFit(h,c,t))throw new ue("Data too big for requested version")}else c=this.recommendVersion(t,a,s,u);var v=new me;v.appendBitArray(s);var p=a===le.BYTE?u.getSizeInBytes():e.length;this.appendLengthInfo(p,c,a,v),v.appendBitArray(u);var g=c.getECBlocksForLevel(t),m=c.getTotalCodewords()-g.getTotalECCodewords();this.terminateBits(m,v);var y=this.interleaveWithECBytes(v,c.getTotalCodewords(),m,g.getNumBlocks()),C=new wi;C.setECLevel(t),C.setMode(a),C.setVersion(c);var w=c.getDimensionForVersion(),E=new Fd(w,w),I=this.chooseMaskPattern(y,t,c,E);return C.setMaskPattern(I),Wa.buildMatrix(y,t,c,I,E),C.setMatrix(E),C},r.recommendVersion=function(e,t,n,i){var o=this.calculateBitsNeeded(t,n,i,St.getVersionForNumber(1)),a=this.chooseVersion(o,e),s=this.calculateBitsNeeded(t,n,i,a);return this.chooseVersion(s,e)},r.calculateBitsNeeded=function(e,t,n,i){return t.getSize()+e.getCharacterCountBits(i)+n.getSize()},r.getAlphanumericCode=function(e){return e<r.ALPHANUMERIC_TABLE.length?r.ALPHANUMERIC_TABLE[e]:-1},r.chooseMode=function(e,t){if(t===void 0&&(t=null),he.SJIS.getName()===t&&this.isOnlyDoubleByteKanji(e))return le.KANJI;for(var n=!1,i=!1,o=0,a=e.length;o<a;++o){var s=e.charAt(o);if(r.isDigit(s))n=!0;else if(this.getAlphanumericCode(s.charCodeAt(0))!==-1)i=!0;else return le.BYTE}return i?le.ALPHANUMERIC:n?le.NUMERIC:le.BYTE},r.isOnlyDoubleByteKanji=function(e){var t;try{t=je.encode(e,he.SJIS)}catch{return!1}var n=t.length;if(n%2!==0)return!1;for(var i=0;i<n;i+=2){var o=t[i]&255;if((o<129||o>159)&&(o<224||o>235))return!1}return!0},r.chooseMaskPattern=function(e,t,n,i){for(var o=Number.MAX_SAFE_INTEGER,a=-1,s=0;s<wi.NUM_MASK_PATTERNS;s++){Wa.buildMatrix(e,t,n,s,i);var l=this.calculateMaskPenalty(i);l<o&&(o=l,a=s)}return a},r.chooseVersion=function(e,t){for(var n=1;n<=40;n++){var i=St.getVersionForNumber(n);if(r.willFit(e,i,t))return i}throw new ue("Data too big")},r.willFit=function(e,t,n){var i=t.getTotalCodewords(),o=t.getECBlocksForLevel(n),a=o.getTotalECCodewords(),s=i-a,l=(e+7)/8;return s>=l},r.terminateBits=function(e,t){var n=e*8;if(t.getSize()>n)throw new ue("data bits cannot fit in the QR Code"+t.getSize()+" > "+n);for(var i=0;i<4&&t.getSize()<n;++i)t.appendBit(!1);var o=t.getSize()&7;if(o>0)for(var i=o;i<8;i++)t.appendBit(!1);for(var a=e-t.getSizeInBytes(),i=0;i<a;++i)t.appendBits((i&1)===0?236:17,8);if(t.getSize()!==n)throw new ue("Bits size does not equal capacity")},r.getNumDataBytesAndNumECBytesForBlockID=function(e,t,n,i,o,a){if(i>=n)throw new ue("Block ID too large");var s=e%n,l=n-s,u=Math.floor(e/n),c=u+1,f=Math.floor(t/n),h=f+1,v=u-f,p=c-h;if(v!==p)throw new ue("EC bytes mismatch");if(n!==l+s)throw new ue("RS blocks mismatch");if(e!==(f+v)*l+(h+p)*s)throw new ue("Total bytes mismatch");i<l?(o[0]=f,a[0]=v):(o[0]=h,a[0]=p)},r.interleaveWithECBytes=function(e,t,n,i){var o,a,s,l;if(e.getSizeInBytes()!==n)throw new ue("Number of bits and data bytes does not match");for(var u=0,c=0,f=0,h=new Array,v=0;v<i;++v){var p=new Int32Array(1),g=new Int32Array(1);r.getNumDataBytesAndNumECBytesForBlockID(t,n,i,v,p,g);var m=p[0],y=new Uint8Array(m);e.toBytes(8*u,y,0,m);var C=r.generateECBytes(y,g[0]);h.push(new Ld(y,C)),c=Math.max(c,m),f=Math.max(f,C.length),u+=p[0]}if(n!==u)throw new ue("Data bytes does not match offset");for(var w=new me,v=0;v<c;++v)try{for(var E=(o=void 0,Xa(h)),I=E.next();!I.done;I=E.next()){var S=I.value,y=S.getDataBytes();v<y.length&&w.appendBits(y[v],8)}}catch(M){o={error:M}}finally{try{I&&!I.done&&(a=E.return)&&a.call(E)}finally{if(o)throw o.error}}for(var v=0;v<f;++v)try{for(var b=(s=void 0,Xa(h)),P=b.next();!P.done;P=b.next()){var S=P.value,C=S.getErrorCorrectionBytes();v<C.length&&w.appendBits(C[v],8)}}catch(M){s={error:M}}finally{try{P&&!P.done&&(l=b.return)&&l.call(b)}finally{if(s)throw s.error}}if(t!==w.getSizeInBytes())throw new ue("Interleaving error: "+t+" and "+w.getSizeInBytes()+" differ.");return w},r.generateECBytes=function(e,t){for(var n=e.length,i=new Int32Array(n+t),o=0;o<n;o++)i[o]=e[o]&255;new Ga(Ve.QR_CODE_FIELD_256).encode(i,t);for(var a=new Uint8Array(t),o=0;o<t;o++)a[o]=i[n+o];return a},r.appendModeInfo=function(e,t){t.appendBits(e.getBits(),4)},r.appendLengthInfo=function(e,t,n,i){var o=n.getCharacterCountBits(t);if(e>=1<<o)throw new ue(e+" is bigger than "+((1<<o)-1));i.appendBits(e,o)},r.appendBytes=function(e,t,n,i){switch(t){case le.NUMERIC:r.appendNumericBytes(e,n);break;case le.ALPHANUMERIC:r.appendAlphanumericBytes(e,n);break;case le.BYTE:r.append8BitBytes(e,n,i);break;case le.KANJI:r.appendKanjiBytes(e,n);break;default:throw new ue("Invalid mode: "+t)}},r.getDigit=function(e){return e.charCodeAt(0)-48},r.isDigit=function(e){var t=r.getDigit(e);return t>=0&&t<=9},r.appendNumericBytes=function(e,t){for(var n=e.length,i=0;i<n;){var o=r.getDigit(e.charAt(i));if(i+2<n){var a=r.getDigit(e.charAt(i+1)),s=r.getDigit(e.charAt(i+2));t.appendBits(o*100+a*10+s,10),i+=3}else if(i+1<n){var a=r.getDigit(e.charAt(i+1));t.appendBits(o*10+a,7),i+=2}else t.appendBits(o,4),i++}},r.appendAlphanumericBytes=function(e,t){for(var n=e.length,i=0;i<n;){var o=r.getAlphanumericCode(e.charCodeAt(i));if(o===-1)throw new ue;if(i+1<n){var a=r.getAlphanumericCode(e.charCodeAt(i+1));if(a===-1)throw new ue;t.appendBits(o*45+a,11),i+=2}else t.appendBits(o,6),i++}},r.append8BitBytes=function(e,t,n){var i;try{i=je.encode(e,n)}catch(l){throw new ue(l)}for(var o=0,a=i.length;o!==a;o++){var s=i[o];t.appendBits(s,8)}},r.appendKanjiBytes=function(e,t){var n;try{n=je.encode(e,he.SJIS)}catch(f){throw new ue(f)}for(var i=n.length,o=0;o<i;o+=2){var a=n[o]&255,s=n[o+1]&255,l=a<<8&4294967295|s,u=-1;if(l>=33088&&l<=40956?u=l-33088:l>=57408&&l<=60351&&(u=l-49472),u===-1)throw new ue("Invalid byte sequence");var c=(u>>8)*192+(u&255);t.appendBits(c,13)}},r.appendECI=function(e,t){t.appendBits(le.ECI.getBits(),4),t.appendBits(e.getValue(),8)},r.ALPHANUMERIC_TABLE=Int32Array.from([-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,36,-1,-1,-1,37,38,-1,-1,-1,-1,39,40,-1,41,42,43,0,1,2,3,4,5,6,7,8,9,44,-1,-1,-1,-1,-1,-1,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,-1,-1,-1,-1,-1]),r.DEFAULT_BYTE_MODE_ENCODING=he.UTF8.getName(),r})();var Rd=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)i.hasOwnProperty(o)&&(n[o]=i[o])},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)}}();(function(r){Rd(e,r);function e(t,n,i,o,a,s,l,u){var c=r.call(this,s,l)||this;if(c.yuvData=t,c.dataWidth=n,c.dataHeight=i,c.left=o,c.top=a,o+s>n||a+l>i)throw new $("Crop rectangle does not fit within image data.");return u&&c.reverseHorizontal(s,l),c}return e.prototype.getRow=function(t,n){if(t<0||t>=this.getHeight())throw new $("Requested row is outside the image: "+t);var i=this.getWidth();(n==null||n.length<i)&&(n=new Uint8ClampedArray(i));var o=(t+this.top)*this.dataWidth+this.left;return se.arraycopy(this.yuvData,o,n,0,i),n},e.prototype.getMatrix=function(){var t=this.getWidth(),n=this.getHeight();if(t===this.dataWidth&&n===this.dataHeight)return this.yuvData;var i=t*n,o=new Uint8ClampedArray(i),a=this.top*this.dataWidth+this.left;if(t===this.dataWidth)return se.arraycopy(this.yuvData,a,o,0,i),o;for(var s=0;s<n;s++){var l=s*t;se.arraycopy(this.yuvData,a,o,l,t),a+=this.dataWidth}return o},e.prototype.isCropSupported=function(){return!0},e.prototype.crop=function(t,n,i,o){return new e(this.yuvData,this.dataWidth,this.dataHeight,this.left+t,this.top+n,i,o,!1)},e.prototype.renderThumbnail=function(){for(var t=this.getWidth()/e.THUMBNAIL_SCALE_FACTOR,n=this.getHeight()/e.THUMBNAIL_SCALE_FACTOR,i=new Int32Array(t*n),o=this.yuvData,a=this.top*this.dataWidth+this.left,s=0;s<n;s++){for(var l=s*t,u=0;u<t;u++){var c=o[a+u*e.THUMBNAIL_SCALE_FACTOR]&255;i[l+u]=4278190080|c*65793}a+=this.dataWidth*e.THUMBNAIL_SCALE_FACTOR}return i},e.prototype.getThumbnailWidth=function(){return this.getWidth()/e.THUMBNAIL_SCALE_FACTOR},e.prototype.getThumbnailHeight=function(){return this.getHeight()/e.THUMBNAIL_SCALE_FACTOR},e.prototype.reverseHorizontal=function(t,n){for(var i=this.yuvData,o=0,a=this.top*this.dataWidth+this.left;o<n;o++,a+=this.dataWidth)for(var s=a+t/2,l=a,u=a+t-1;l<s;l++,u--){var c=i[l];i[l]=i[u],i[u]=c}},e.prototype.invert=function(){return new ei(this)},e.THUMBNAIL_SCALE_FACTOR=2,e})(jr);var Vd=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)i.hasOwnProperty(o)&&(n[o]=i[o])},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)}}();(function(r){Vd(e,r);function e(t,n,i,o,a,s,l){var u=r.call(this,n,i)||this;if(u.dataWidth=o,u.dataHeight=a,u.left=s,u.top=l,t.BYTES_PER_ELEMENT===4){for(var c=n*i,f=new Uint8ClampedArray(c),h=0;h<c;h++){var v=t[h],p=v>>16&255,g=v>>7&510,m=v&255;f[h]=(p+g+m)/4&255}u.luminances=f}else u.luminances=t;if(o===void 0&&(u.dataWidth=n),a===void 0&&(u.dataHeight=i),s===void 0&&(u.left=0),l===void 0&&(u.top=0),u.left+n>u.dataWidth||u.top+i>u.dataHeight)throw new $("Crop rectangle does not fit within image data.");return u}return e.prototype.getRow=function(t,n){if(t<0||t>=this.getHeight())throw new $("Requested row is outside the image: "+t);var i=this.getWidth();(n==null||n.length<i)&&(n=new Uint8ClampedArray(i));var o=(t+this.top)*this.dataWidth+this.left;return se.arraycopy(this.luminances,o,n,0,i),n},e.prototype.getMatrix=function(){var t=this.getWidth(),n=this.getHeight();if(t===this.dataWidth&&n===this.dataHeight)return this.luminances;var i=t*n,o=new Uint8ClampedArray(i),a=this.top*this.dataWidth+this.left;if(t===this.dataWidth)return se.arraycopy(this.luminances,a,o,0,i),o;for(var s=0;s<n;s++){var l=s*t;se.arraycopy(this.luminances,a,o,l,t),a+=this.dataWidth}return o},e.prototype.isCropSupported=function(){return!0},e.prototype.crop=function(t,n,i,o){return new e(this.luminances,i,o,this.dataWidth,this.dataHeight,this.left+t,this.top+n)},e.prototype.invert=function(){return new ei(this)},e})(jr);var kd=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)i.hasOwnProperty(o)&&(n[o]=i[o])},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)}}(),zd=function(r){kd(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.forName=function(t){return this.getCharacterSetECIByName(t)},e}(he),Ud=function(){function r(){}return r.ISO_8859_1=he.ISO8859_1,r}(),_i,Hd=301,Gd=function(r,e){for(var t=1,n=0;n<255;n++)e[n]=t,r[t]=n,t*=2,t>=256&&(t^=Hd);return{LOG:r,ALOG:e}};_i=Gd([],[]),_i.LOG,_i.ALOG;var $a;(function(r){r[r.FORCE_NONE=0]="FORCE_NONE",r[r.FORCE_SQUARE=1]="FORCE_SQUARE",r[r.FORCE_RECTANGLE=2]="FORCE_RECTANGLE"})($a||($a={}));var ja=129,qa=230,Wd=231,Xd=235,$d=236,jd=237,qd=238,Yd=239,Zd=240,Ai=254,Kd=254,Ya="[)>05",Za="[)>06",Ka="",ne=0,be=1,Be=2,xe=3,_e=4,Ne=5,Qd=function(){function r(){}return r.prototype.getEncodingMode=function(){return ne},r.prototype.encode=function(e){var t=et.determineConsecutiveDigitCount(e.getMessage(),e.pos);if(t>=2)e.writeCodeword(this.encodeASCIIDigits(e.getMessage().charCodeAt(e.pos),e.getMessage().charCodeAt(e.pos+1))),e.pos+=2;else{var n=e.getCurrentChar(),i=et.lookAheadTest(e.getMessage(),e.pos,this.getEncodingMode());if(i!==this.getEncodingMode())switch(i){case Ne:e.writeCodeword(Wd),e.signalEncoderChange(Ne);return;case be:e.writeCodeword(qa),e.signalEncoderChange(be);return;case xe:e.writeCodeword(qd),e.signalEncoderChange(xe);break;case Be:e.writeCodeword(Yd),e.signalEncoderChange(Be);break;case _e:e.writeCodeword(Zd),e.signalEncoderChange(_e);break;default:throw new Error("Illegal mode: "+i)}else et.isExtendedASCII(n)?(e.writeCodeword(Xd),e.writeCodeword(n-128+1),e.pos++):(e.writeCodeword(n+1),e.pos++)}},r.prototype.encodeASCIIDigits=function(e,t){if(et.isDigit(e)&&et.isDigit(t)){var n=(e-48)*10+(t-48);return n+130}throw new Error("not digits: "+e+t)},r}(),Jd=function(){function r(){}return r.prototype.getEncodingMode=function(){return Ne},r.prototype.encode=function(e){var t=new q;for(t.append(0);e.hasMoreCharacters();){var n=e.getCurrentChar();t.append(n),e.pos++;var i=et.lookAheadTest(e.getMessage(),e.pos,this.getEncodingMode());if(i!==this.getEncodingMode()){e.signalEncoderChange(ne);break}}var o=t.length()-1,a=1,s=e.getCodewordCount()+o+a;e.updateSymbolInfo(s);var l=e.getSymbolInfo().getDataCapacity()-s>0;if(e.hasMoreCharacters()||l)if(o<=249)t.setCharAt(0,Z.getCharAt(o));else if(o<=1555)t.setCharAt(0,Z.getCharAt(Math.floor(o/250)+249)),t.insert(1,Z.getCharAt(o%250));else throw new Error("Message length not in valid ranges: "+o);for(var u=0,n=t.length();u<n;u++)e.writeCodeword(this.randomize255State(t.charAt(u).charCodeAt(0),e.getCodewordCount()+1))},r.prototype.randomize255State=function(e,t){var n=149*t%255+1,i=e+n;return i<=255?i:i-256},r}(),Ei=function(){function r(){}return r.prototype.getEncodingMode=function(){return be},r.prototype.encodeMaximal=function(e){for(var t=new q,n=0,i=e.pos,o=0;e.hasMoreCharacters();){var a=e.getCurrentChar();e.pos++,n=this.encodeChar(a,t),t.length()%3===0&&(i=e.pos,o=t.length())}if(o!==t.length()){var s=Math.floor(t.length()/3*2),l=Math.floor(e.getCodewordCount()+s+1);e.updateSymbolInfo(l);var u=e.getSymbolInfo().getDataCapacity()-l,c=Math.floor(t.length()%3);(c===2&&u!==2||c===1&&(n>3||u!==1))&&(e.pos=i)}t.length()>0&&e.writeCodeword(qa),this.handleEOD(e,t)},r.prototype.encode=function(e){for(var t=new q;e.hasMoreCharacters();){var n=e.getCurrentChar();e.pos++;var i=this.encodeChar(n,t),o=Math.floor(t.length()/3)*2,a=e.getCodewordCount()+o;e.updateSymbolInfo(a);var s=e.getSymbolInfo().getDataCapacity()-a;if(!e.hasMoreCharacters()){var l=new q;for(t.length()%3===2&&s!==2&&(i=this.backtrackOneCharacter(e,t,l,i));t.length()%3===1&&(i>3||s!==1);)i=this.backtrackOneCharacter(e,t,l,i);break}var u=t.length();if(u%3===0){var c=et.lookAheadTest(e.getMessage(),e.pos,this.getEncodingMode());if(c!==this.getEncodingMode()){e.signalEncoderChange(ne);break}}}this.handleEOD(e,t)},r.prototype.backtrackOneCharacter=function(e,t,n,i){var o=t.length(),a=t.toString().substring(0,o-i);t.setLengthToZero(),t.append(a),e.pos--;var s=e.getCurrentChar();return i=this.encodeChar(s,n),e.resetSymbolInfo(),i},r.prototype.writeNextTriplet=function(e,t){e.writeCodewords(this.encodeToCodewords(t.toString()));var n=t.toString().substring(3);t.setLengthToZero(),t.append(n)},r.prototype.handleEOD=function(e,t){var n=Math.floor(t.length()/3*2),i=t.length()%3,o=e.getCodewordCount()+n;e.updateSymbolInfo(o);var a=e.getSymbolInfo().getDataCapacity()-o;if(i===2){for(t.append("\0");t.length()>=3;)this.writeNextTriplet(e,t);e.hasMoreCharacters()&&e.writeCodeword(Ai)}else if(a===1&&i===1){for(;t.length()>=3;)this.writeNextTriplet(e,t);e.hasMoreCharacters()&&e.writeCodeword(Ai),e.pos--}else if(i===0){for(;t.length()>=3;)this.writeNextTriplet(e,t);(a>0||e.hasMoreCharacters())&&e.writeCodeword(Ai)}else throw new Error("Unexpected case. Please report!");e.signalEncoderChange(ne)},r.prototype.encodeChar=function(e,t){if(e===32)return t.append(3),1;if(e>=48&&e<=57)return t.append(e-48+4),1;if(e>=65&&e<=90)return t.append(e-65+14),1;if(e<32)return t.append(0),t.append(e),2;if(e<=47)return t.append(1),t.append(e-33),2;if(e<=64)return t.append(1),t.append(e-58+15),2;if(e<=95)return t.append(1),t.append(e-91+22),2;if(e<=127)return t.append(2),t.append(e-96),2;t.append("1");var n=2;return n+=this.encodeChar(e-128,t),n},r.prototype.encodeToCodewords=function(e){var t=1600*e.charCodeAt(0)+40*e.charCodeAt(1)+e.charCodeAt(2)+1,n=t/256,i=t%256,o=new q;return o.append(n),o.append(i),o.toString()},r}(),e1=function(){function r(){}return r.prototype.getEncodingMode=function(){return _e},r.prototype.encode=function(e){for(var t=new q;e.hasMoreCharacters();){var n=e.getCurrentChar();this.encodeChar(n,t),e.pos++;var i=t.length();if(i>=4){e.writeCodewords(this.encodeToCodewords(t.toString()));var o=t.toString().substring(4);t.setLengthToZero(),t.append(o);var a=et.lookAheadTest(e.getMessage(),e.pos,this.getEncodingMode());if(a!==this.getEncodingMode()){e.signalEncoderChange(ne);break}}}t.append(Z.getCharAt(31)),this.handleEOD(e,t)},r.prototype.handleEOD=function(e,t){try{var n=t.length();if(n===0)return;if(n===1){e.updateSymbolInfo();var i=e.getSymbolInfo().getDataCapacity()-e.getCodewordCount(),o=e.getRemainingCharacters();if(o>i&&(e.updateSymbolInfo(e.getCodewordCount()+1),i=e.getSymbolInfo().getDataCapacity()-e.getCodewordCount()),o<=i&&i<=2)return}if(n>4)throw new Error("Count must not exceed 4");var a=n-1,s=this.encodeToCodewords(t.toString()),l=!e.hasMoreCharacters(),u=l&&a<=2;if(a<=2){e.updateSymbolInfo(e.getCodewordCount()+a);var i=e.getSymbolInfo().getDataCapacity()-e.getCodewordCount();i>=3&&(u=!1,e.updateSymbolInfo(e.getCodewordCount()+s.length))}u?(e.resetSymbolInfo(),e.pos-=a):e.writeCodewords(s)}finally{e.signalEncoderChange(ne)}},r.prototype.encodeChar=function(e,t){e>=32&&e<=63?t.append(e):e>=64&&e<=94?t.append(Z.getCharAt(e-64)):et.illegalCharacter(Z.getCharAt(e))},r.prototype.encodeToCodewords=function(e){var t=e.length;if(t===0)throw new Error("StringBuilder must not be empty");var n=e.charAt(0).charCodeAt(0),i=t>=2?e.charAt(1).charCodeAt(0):0,o=t>=3?e.charAt(2).charCodeAt(0):0,a=t>=4?e.charAt(3).charCodeAt(0):0,s=(n<<18)+(i<<12)+(o<<6)+a,l=s>>16&255,u=s>>8&255,c=s&255,f=new q;return f.append(l),t>=2&&f.append(u),t>=3&&f.append(c),f.toString()},r}(),t1=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)i.hasOwnProperty(o)&&(n[o]=i[o])},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)}}(),r1=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.")},ee=function(){function r(e,t,n,i,o,a,s,l){s===void 0&&(s=0),l===void 0&&(l=0),this.rectangular=e,this.dataCapacity=t,this.errorCodewords=n,this.matrixWidth=i,this.matrixHeight=o,this.dataRegions=a,this.rsBlockData=s,this.rsBlockError=l}return r.lookup=function(e,t,n,i,o){var a,s;t===void 0&&(t=0),n===void 0&&(n=null),i===void 0&&(i=null),o===void 0&&(o=!0);try{for(var l=r1(i1),u=l.next();!u.done;u=l.next()){var c=u.value;if(!(t===1&&c.rectangular)&&!(t===2&&!c.rectangular)&&!(n!=null&&(c.getSymbolWidth()<n.getWidth()||c.getSymbolHeight()<n.getHeight()))&&!(i!=null&&(c.getSymbolWidth()>i.getWidth()||c.getSymbolHeight()>i.getHeight()))&&e<=c.dataCapacity)return c}}catch(f){a={error:f}}finally{try{u&&!u.done&&(s=l.return)&&s.call(l)}finally{if(a)throw a.error}}if(o)throw new Error("Can't find a symbol arrangement that matches the message. Data codewords: "+e);return null},r.prototype.getHorizontalDataRegions=function(){switch(this.dataRegions){case 1:return 1;case 2:case 4:return 2;case 16:return 4;case 36:return 6;default:throw new Error("Cannot handle this number of data regions")}},r.prototype.getVerticalDataRegions=function(){switch(this.dataRegions){case 1:case 2:return 1;case 4:return 2;case 16:return 4;case 36:return 6;default:throw new Error("Cannot handle this number of data regions")}},r.prototype.getSymbolDataWidth=function(){return this.getHorizontalDataRegions()*this.matrixWidth},r.prototype.getSymbolDataHeight=function(){return this.getVerticalDataRegions()*this.matrixHeight},r.prototype.getSymbolWidth=function(){return this.getSymbolDataWidth()+this.getHorizontalDataRegions()*2},r.prototype.getSymbolHeight=function(){return this.getSymbolDataHeight()+this.getVerticalDataRegions()*2},r.prototype.getCodewordCount=function(){return this.dataCapacity+this.errorCodewords},r.prototype.getInterleavedBlockCount=function(){return this.rsBlockData?this.dataCapacity/this.rsBlockData:1},r.prototype.getDataCapacity=function(){return this.dataCapacity},r.prototype.getErrorCodewords=function(){return this.errorCodewords},r.prototype.getDataLengthForInterleavedBlock=function(e){return this.rsBlockData},r.prototype.getErrorLengthForInterleavedBlock=function(e){return this.rsBlockError},r}(),n1=function(r){t1(e,r);function e(){return r.call(this,!1,1558,620,22,22,36,-1,62)||this}return e.prototype.getInterleavedBlockCount=function(){return 10},e.prototype.getDataLengthForInterleavedBlock=function(t){return t<=8?156:155},e}(ee),i1=[new ee(!1,3,5,8,8,1),new ee(!1,5,7,10,10,1),new ee(!0,5,7,16,6,1),new ee(!1,8,10,12,12,1),new ee(!0,10,11,14,6,2),new ee(!1,12,12,14,14,1),new ee(!0,16,14,24,10,1),new ee(!1,18,14,16,16,1),new ee(!1,22,18,18,18,1),new ee(!0,22,18,16,10,2),new ee(!1,30,20,20,20,1),new ee(!0,32,24,16,14,2),new ee(!1,36,24,22,22,1),new ee(!1,44,28,24,24,1),new ee(!0,49,28,22,14,2),new ee(!1,62,36,14,14,4),new ee(!1,86,42,16,16,4),new ee(!1,114,48,18,18,4),new ee(!1,144,56,20,20,4),new ee(!1,174,68,22,22,4),new ee(!1,204,84,24,24,4,102,42),new ee(!1,280,112,14,14,16,140,56),new ee(!1,368,144,16,16,16,92,36),new ee(!1,456,192,18,18,16,114,48),new ee(!1,576,224,20,20,16,144,56),new ee(!1,696,272,22,22,16,174,68),new ee(!1,816,336,24,24,16,136,56),new ee(!1,1050,408,18,18,36,175,68),new ee(!1,1304,496,20,20,36,163,62),new n1],o1=function(){function r(e){this.msg=e,this.pos=0,this.skipAtEnd=0;for(var t=e.split("").map(function(s){return s.charCodeAt(0)}),n=new q,i=0,o=t.length;i<o;i++){var a=String.fromCharCode(t[i]&255);if(a==="?"&&e.charAt(i)!=="?")throw new Error("Message contains characters outside ISO-8859-1 encoding.");n.append(a)}this.msg=n.toString(),this.shape=0,this.codewords=new q,this.newEncoding=-1}return r.prototype.setSymbolShape=function(e){this.shape=e},r.prototype.setSizeConstraints=function(e,t){this.minSize=e,this.maxSize=t},r.prototype.getMessage=function(){return this.msg},r.prototype.setSkipAtEnd=function(e){this.skipAtEnd=e},r.prototype.getCurrentChar=function(){return this.msg.charCodeAt(this.pos)},r.prototype.getCurrent=function(){return this.msg.charCodeAt(this.pos)},r.prototype.getCodewords=function(){return this.codewords},r.prototype.writeCodewords=function(e){this.codewords.append(e)},r.prototype.writeCodeword=function(e){this.codewords.append(e)},r.prototype.getCodewordCount=function(){return this.codewords.length()},r.prototype.getNewEncoding=function(){return this.newEncoding},r.prototype.signalEncoderChange=function(e){this.newEncoding=e},r.prototype.resetEncoderSignal=function(){this.newEncoding=-1},r.prototype.hasMoreCharacters=function(){return this.pos<this.getTotalMessageCharCount()},r.prototype.getTotalMessageCharCount=function(){return this.msg.length-this.skipAtEnd},r.prototype.getRemainingCharacters=function(){return this.getTotalMessageCharCount()-this.pos},r.prototype.getSymbolInfo=function(){return this.symbolInfo},r.prototype.updateSymbolInfo=function(e){e===void 0&&(e=this.getCodewordCount()),(this.symbolInfo==null||e>this.symbolInfo.getDataCapacity())&&(this.symbolInfo=ee.lookup(e,this.shape,this.minSize,this.maxSize,!0))},r.prototype.resetSymbolInfo=function(){this.symbolInfo=null},r}(),a1=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)i.hasOwnProperty(o)&&(n[o]=i[o])},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)}}(),s1=function(r){a1(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.getEncodingMode=function(){return xe},e.prototype.encode=function(t){for(var n=new q;t.hasMoreCharacters();){var i=t.getCurrentChar();t.pos++,this.encodeChar(i,n);var o=n.length();if(o%3===0){this.writeNextTriplet(t,n);var a=et.lookAheadTest(t.getMessage(),t.pos,this.getEncodingMode());if(a!==this.getEncodingMode()){t.signalEncoderChange(ne);break}}}this.handleEOD(t,n)},e.prototype.encodeChar=function(t,n){switch(t){case 13:n.append(0);break;case 42:n.append(1);break;case 62:n.append(2);break;case 32:n.append(3);break;default:t>=48&&t<=57?n.append(t-48+4):t>=65&&t<=90?n.append(t-65+14):et.illegalCharacter(Z.getCharAt(t));break}return 1},e.prototype.handleEOD=function(t,n){t.updateSymbolInfo();var i=t.getSymbolInfo().getDataCapacity()-t.getCodewordCount(),o=n.length();t.pos-=o,(t.getRemainingCharacters()>1||i>1||t.getRemainingCharacters()!==i)&&t.writeCodeword(Kd),t.getNewEncoding()<0&&t.signalEncoderChange(ne)},e}(Ei),l1=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)i.hasOwnProperty(o)&&(n[o]=i[o])},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)}}(),u1=function(r){l1(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.getEncodingMode=function(){return Be},e.prototype.encodeChar=function(t,n){if(t===32)return n.append(3),1;if(t>=48&&t<=57)return n.append(t-48+4),1;if(t>=97&&t<=122)return n.append(t-97+14),1;if(t<32)return n.append(0),n.append(t),2;if(t<=47)return n.append(1),n.append(t-33),2;if(t<=64)return n.append(1),n.append(t-58+15),2;if(t>=91&&t<=95)return n.append(1),n.append(t-91+22),2;if(t===96)return n.append(2),n.append(0),2;if(t<=90)return n.append(2),n.append(t-65+1),2;if(t<=127)return n.append(2),n.append(t-123+27),2;n.append("1");var i=2;return i+=this.encodeChar(t-128,n),i},e}(Ei),et=function(){function r(){}return r.randomize253State=function(e){var t=149*e%253+1,n=ja+t;return n<=254?n:n-254},r.encodeHighLevel=function(e,t,n,i,o){t===void 0&&(t=0),n===void 0&&(n=null),i===void 0&&(i=null),o===void 0&&(o=!1);var a=new Ei,s=[new Qd,a,new u1,new s1,new e1,new Jd],l=new o1(e);l.setSymbolShape(t),l.setSizeConstraints(n,i),e.startsWith(Ya)&&e.endsWith(Ka)?(l.writeCodeword($d),l.setSkipAtEnd(2),l.pos+=Ya.length):e.startsWith(Za)&&e.endsWith(Ka)&&(l.writeCodeword(jd),l.setSkipAtEnd(2),l.pos+=Za.length);var u=ne;for(o&&(a.encodeMaximal(l),u=l.getNewEncoding(),l.resetEncoderSignal());l.hasMoreCharacters();)s[u].encode(l),l.getNewEncoding()>=0&&(u=l.getNewEncoding(),l.resetEncoderSignal());var c=l.getCodewordCount();l.updateSymbolInfo();var f=l.getSymbolInfo().getDataCapacity();c<f&&u!==ne&&u!==Ne&&u!==_e&&l.writeCodeword("þ");var h=l.getCodewords();for(h.length()<f&&h.append(ja);h.length()<f;)h.append(this.randomize253State(h.length()+1));return l.getCodewords().toString()},r.lookAheadTest=function(e,t,n){var i=this.lookAheadTestIntern(e,t,n);if(n===xe&&i===xe){for(var o=Math.min(t+3,e.length),a=t;a<o;a++)if(!this.isNativeX12(e.charCodeAt(a)))return ne}else if(n===_e&&i===_e){for(var o=Math.min(t+4,e.length),a=t;a<o;a++)if(!this.isNativeEDIFACT(e.charCodeAt(a)))return ne}return i},r.lookAheadTestIntern=function(e,t,n){if(t>=e.length)return n;var i;n===ne?i=[0,1,1,1,1,1.25]:(i=[1,2,2,2,2,2.25],i[n]=0);for(var o=0,a=new Uint8Array(6),s=[];;){if(t+o===e.length){de.fill(a,0),de.fill(s,0);var l=this.findMinimums(i,s,Y.MAX_VALUE,a),u=this.getMinimumCount(a);if(s[ne]===l)return ne;if(u===1){if(a[Ne]>0)return Ne;if(a[_e]>0)return _e;if(a[Be]>0)return Be;if(a[xe]>0)return xe}return be}var c=e.charCodeAt(t+o);if(o++,this.isDigit(c)?i[ne]+=.5:this.isExtendedASCII(c)?(i[ne]=Math.ceil(i[ne]),i[ne]+=2):(i[ne]=Math.ceil(i[ne]),i[ne]++),this.isNativeC40(c)?i[be]+=2/3:this.isExtendedASCII(c)?i[be]+=8/3:i[be]+=4/3,this.isNativeText(c)?i[Be]+=2/3:this.isExtendedASCII(c)?i[Be]+=8/3:i[Be]+=4/3,this.isNativeX12(c)?i[xe]+=2/3:this.isExtendedASCII(c)?i[xe]+=13/3:i[xe]+=10/3,this.isNativeEDIFACT(c)?i[_e]+=3/4:this.isExtendedASCII(c)?i[_e]+=17/4:i[_e]+=13/4,this.isSpecialB256(c)?i[Ne]+=4:i[Ne]++,o>=4){if(de.fill(a,0),de.fill(s,0),this.findMinimums(i,s,Y.MAX_VALUE,a),s[ne]<this.min(s[Ne],s[be],s[Be],s[xe],s[_e]))return ne;if(s[Ne]<s[ne]||s[Ne]+1<this.min(s[be],s[Be],s[xe],s[_e]))return Ne;if(s[_e]+1<this.min(s[Ne],s[be],s[Be],s[xe],s[ne]))return _e;if(s[Be]+1<this.min(s[Ne],s[be],s[_e],s[xe],s[ne]))return Be;if(s[xe]+1<this.min(s[Ne],s[be],s[_e],s[Be],s[ne]))return xe;if(s[be]+1<this.min(s[ne],s[Ne],s[_e],s[Be])){if(s[be]<s[xe])return be;if(s[be]===s[xe]){for(var f=t+o+1;f<e.length;){var h=e.charCodeAt(f);if(this.isX12TermSep(h))return xe;if(!this.isNativeX12(h))break;f++}return be}}}}},r.min=function(e,t,n,i,o){var a=Math.min(e,Math.min(t,Math.min(n,i)));return o===void 0?a:Math.min(a,o)},r.findMinimums=function(e,t,n,i){for(var o=0;o<6;o++){var a=t[o]=Math.ceil(e[o]);n>a&&(n=a,de.fill(i,0)),n===a&&(i[o]=i[o]+1)}return n},r.getMinimumCount=function(e){for(var t=0,n=0;n<6;n++)t+=e[n];return t||0},r.isDigit=function(e){return e>=48&&e<=57},r.isExtendedASCII=function(e){return e>=128&&e<=255},r.isNativeC40=function(e){return e===32||e>=48&&e<=57||e>=65&&e<=90},r.isNativeText=function(e){return e===32||e>=48&&e<=57||e>=97&&e<=122},r.isNativeX12=function(e){return this.isX12TermSep(e)||e===32||e>=48&&e<=57||e>=65&&e<=90},r.isX12TermSep=function(e){return e===13||e===42||e===62},r.isNativeEDIFACT=function(e){return e>=32&&e<=94},r.isSpecialB256=function(e){return!1},r.determineConsecutiveDigitCount=function(e,t){t===void 0&&(t=0);for(var n=e.length,i=t;i<n&&this.isDigit(e.charCodeAt(i));)i++;return i-t},r.illegalCharacter=function(e){var t=Y.toHexString(e.charCodeAt(0));throw t="0000".substring(0,4-t.length)+t,new Error("Illegal character: "+e+" (0x"+t+")")},r}(),Ii=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.")},Qa=function(){function r(e){this.charset=e,this.name=e.name}return r.prototype.canEncode=function(e){try{return je.encode(e,this.charset)!=null}catch{return!1}},r}(),c1=function(){function r(e,t,n){var i,o,a,s,l,u;this.ENCODERS=["IBM437","ISO-8859-2","ISO-8859-3","ISO-8859-4","ISO-8859-5","ISO-8859-6","ISO-8859-7","ISO-8859-8","ISO-8859-9","ISO-8859-10","ISO-8859-11","ISO-8859-13","ISO-8859-14","ISO-8859-15","ISO-8859-16","windows-1250","windows-1251","windows-1252","windows-1256","Shift_JIS"].map(function(L){return new Qa(zd.forName(L))}),this.encoders=[];var c=[];c.push(new Qa(Ud.ISO_8859_1));for(var f=t!=null&&t.name.startsWith("UTF"),h=0;h<e.length;h++){var v=!1;try{for(var p=(i=void 0,Ii(c)),g=p.next();!g.done;g=p.next()){var m=g.value,y=e.charAt(h),C=y.charCodeAt(0);if(C===n||m.canEncode(y)){v=!0;break}}}catch(L){i={error:L}}finally{try{g&&!g.done&&(o=p.return)&&o.call(p)}finally{if(i)throw i.error}}if(!v)try{for(var w=(a=void 0,Ii(this.ENCODERS)),E=w.next();!E.done;E=w.next()){var m=E.value;if(m.canEncode(e.charAt(h))){c.push(m),v=!0;break}}}catch(L){a={error:L}}finally{try{E&&!E.done&&(s=w.return)&&s.call(w)}finally{if(a)throw a.error}}v||(f=!0)}if(c.length===1&&!f)this.encoders=[c[0]];else{this.encoders=[];var I=0;try{for(var S=Ii(c),b=S.next();!b.done;b=S.next()){var m=b.value;this.encoders[I++]=m}}catch(L){l={error:L}}finally{try{b&&!b.done&&(u=S.return)&&u.call(S)}finally{if(l)throw l.error}}}var P=-1;if(t!=null){for(var h=0;h<this.encoders.length;h++)if(this.encoders[h]!=null&&t.name===this.encoders[h].name){P=h;break}}this.priorityEncoderIndex=P}return r.prototype.length=function(){return this.encoders.length},r.prototype.getCharsetName=function(e){if(!(e<this.length()))throw new Error("index must be less than length");return this.encoders[e].name},r.prototype.getCharset=function(e){if(!(e<this.length()))throw new Error("index must be less than length");return this.encoders[e].charset},r.prototype.getECIValue=function(e){return this.encoders[e].charset.getValueIdentifier()},r.prototype.getPriorityEncoderIndex=function(){return this.priorityEncoderIndex},r.prototype.canEncode=function(e,t){if(!(t<this.length()))throw new Error("index must be less than length");return!0},r.prototype.encode=function(e,t){if(!(t<this.length()))throw new Error("index must be less than length");return je.encode(Z.getCharAt(e),this.encoders[t].name)},r}(),f1=3,d1=function(){function r(e,t,n){this.fnc1=n;var i=new c1(e,t,n);if(i.length()===1)for(var o=0;o<this.bytes.length;o++){var a=e.charAt(o).charCodeAt(0);this.bytes[o]=a===n?1e3:a}else this.bytes=this.encodeMinimally(e,i,n)}return r.prototype.getFNC1Character=function(){return this.fnc1},r.prototype.length=function(){return this.bytes.length},r.prototype.haveNCharacters=function(e,t){if(e+t-1>=this.bytes.length)return!1;for(var n=0;n<t;n++)if(this.isECI(e+n))return!1;return!0},r.prototype.charAt=function(e){if(e<0||e>=this.length())throw new Error(""+e);if(this.isECI(e))throw new Error("value at "+e+" is not a character but an ECI");return this.isFNC1(e)?this.fnc1:this.bytes[e]},r.prototype.subSequence=function(e,t){if(e<0||e>t||t>this.length())throw new Error(""+e);for(var n=new q,i=e;i<t;i++){if(this.isECI(i))throw new Error("value at "+i+" is not a character but an ECI");n.append(this.charAt(i))}return n.toString()},r.prototype.isECI=function(e){if(e<0||e>=this.length())throw new Error(""+e);return this.bytes[e]>255&&this.bytes[e]<=999},r.prototype.isFNC1=function(e){if(e<0||e>=this.length())throw new Error(""+e);return this.bytes[e]===1e3},r.prototype.getECIValue=function(e){if(e<0||e>=this.length())throw new Error(""+e);if(!this.isECI(e))throw new Error("value at "+e+" is not an ECI but a character");return this.bytes[e]-256},r.prototype.addEdge=function(e,t,n){(e[t][n.encoderIndex]==null||e[t][n.encoderIndex].cachedTotalSize>n.cachedTotalSize)&&(e[t][n.encoderIndex]=n)},r.prototype.addEdges=function(e,t,n,i,o,a){var s=e.charAt(i).charCodeAt(0),l=0,u=t.length();t.getPriorityEncoderIndex()>=0&&(s===a||t.canEncode(s,t.getPriorityEncoderIndex()))&&(l=t.getPriorityEncoderIndex(),u=l+1);for(var c=l;c<u;c++)(s===a||t.canEncode(s,c))&&this.addEdge(n,i+1,new Ja(s,t,c,o,a))},r.prototype.encodeMinimally=function(e,t,n){var i=e.length,o=new Ja[i+1][t.length()];this.addEdges(e,t,o,0,null,n);for(var a=1;a<=i;a++){for(var s=0;s<t.length();s++)o[a][s]!=null&&a<i&&this.addEdges(e,t,o,a,o[a][s],n);for(var s=0;s<t.length();s++)o[a-1][s]=null}for(var l=-1,u=Y.MAX_VALUE,s=0;s<t.length();s++)if(o[i][s]!=null){var c=o[i][s];c.cachedTotalSize<u&&(u=c.cachedTotalSize,l=s)}if(l<0)throw new Error('Failed to encode "'+e+'"');for(var f=[],h=o[i][l];h!=null;){if(h.isFNC1())f.unshift(1e3);else for(var v=t.encode(h.c,h.encoderIndex),a=v.length-1;a>=0;a--)f.unshift(v[a]&255);var p=h.previous===null?0:h.previous.encoderIndex;p!==h.encoderIndex&&f.unshift(256+t.getECIValue(h.encoderIndex)),h=h.previous}for(var g=[],a=0;a<g.length;a++)g[a]=f[a];return g},r}(),Ja=function(){function r(e,t,n,i,o){this.c=e,this.encoderSet=t,this.encoderIndex=n,this.previous=i,this.fnc1=o,this.c=e===o?1e3:e;var a=this.isFNC1()?1:t.encode(e,n).length,s=i===null?0:i.encoderIndex;s!==n&&(a+=f1),i!=null&&(a+=i.cachedTotalSize),this.cachedTotalSize=a}return r.prototype.isFNC1=function(){return this.c===1e3},r}(),h1=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)i.hasOwnProperty(o)&&(n[o]=i[o])},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)}}(),v1=function(r,e){var t=typeof Symbol=="function"&&r[Symbol.iterator];if(!t)return r;var n=t.call(r),i,o=[],a;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(s){a={error:s}}finally{try{i&&!i.done&&(t=n.return)&&t.call(n)}finally{if(a)throw a.error}}return o},es;(function(r){r[r.ASCII=0]="ASCII",r[r.C40=1]="C40",r[r.TEXT=2]="TEXT",r[r.X12=3]="X12",r[r.EDF=4]="EDF",r[r.B256=5]="B256"})(es||(es={})),function(r){h1(e,r);function e(t,n,i,o,a){var s=r.call(this,t,n,i)||this;return s.shape=o,s.macroId=a,s}return e.prototype.getMacroId=function(){return this.macroId},e.prototype.getShapeHint=function(){return this.shape},e}(d1);var p1=function(){function r(){}return r.prototype.isCompact=function(){return this.compact},r.prototype.setCompact=function(e){this.compact=e},r.prototype.getSize=function(){return this.size},r.prototype.setSize=function(e){this.size=e},r.prototype.getLayers=function(){return this.layers},r.prototype.setLayers=function(e){this.layers=e},r.prototype.getCodeWords=function(){return this.codeWords},r.prototype.setCodeWords=function(e){this.codeWords=e},r.prototype.getMatrix=function(){return this.matrix},r.prototype.setMatrix=function(e){this.matrix=e},r}(),ts=function(){function r(){}return r.singletonList=function(e){return[e]},r.min=function(e,t){return e.sort(t)[0]},r}(),g1=function(){function r(e){this.previous=e}return r.prototype.getPrevious=function(){return this.previous},r}(),x1=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)i.hasOwnProperty(o)&&(n[o]=i[o])},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)}}(),Si=function(r){x1(e,r);function e(t,n,i){var o=r.call(this,t)||this;return o.value=n,o.bitCount=i,o}return e.prototype.appendTo=function(t,n){t.appendBits(this.value,this.bitCount)},e.prototype.add=function(t,n){return new e(this,t,n)},e.prototype.addBinaryShift=function(t,n){return console.warn("addBinaryShift on SimpleToken, this simply returns a copy of this token"),new e(this,t,n)},e.prototype.toString=function(){var t=this.value&(1<<this.bitCount)-1;return t|=1<<this.bitCount,"<"+Y.toBinaryString(t|1<<this.bitCount).substring(1)+">"},e}(g1),y1=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)i.hasOwnProperty(o)&&(n[o]=i[o])},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)}}(),C1=function(r){y1(e,r);function e(t,n,i){var o=r.call(this,t,0,0)||this;return o.binaryShiftStart=n,o.binaryShiftByteCount=i,o}return e.prototype.appendTo=function(t,n){for(var i=0;i<this.binaryShiftByteCount;i++)(i===0||i===31&&this.binaryShiftByteCount<=62)&&(t.appendBits(31,5),this.binaryShiftByteCount>62?t.appendBits(this.binaryShiftByteCount-31,16):i===0?t.appendBits(Math.min(this.binaryShiftByteCount,31),5):t.appendBits(this.binaryShiftByteCount-31,5)),t.appendBits(n[this.binaryShiftStart+i],8)},e.prototype.addBinaryShift=function(t,n){return new e(this,t,n)},e.prototype.toString=function(){return"<"+this.binaryShiftStart+"::"+(this.binaryShiftStart+this.binaryShiftByteCount-1)+">"},e}(Si);function m1(r,e,t){return new C1(r,e,t)}function vr(r,e,t){return new Si(r,e,t)}var w1=["UPPER","LOWER","DIGIT","MIXED","PUNCT"],xt=0,nn=1,Ye=2,rs=3,nt=4,_1=new Si(null,0,0),bi=[Int32Array.from([0,(5<<16)+28,(5<<16)+30,(5<<16)+29,656318]),Int32Array.from([(9<<16)+480+14,0,(5<<16)+30,(5<<16)+29,656318]),Int32Array.from([(4<<16)+14,(9<<16)+448+28,0,(9<<16)+448+29,932798]),Int32Array.from([(5<<16)+29,(5<<16)+28,656318,0,(5<<16)+30]),Int32Array.from([(5<<16)+31,656380,656382,656381,0])],A1=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.")};function E1(r){var e,t;try{for(var n=A1(r),i=n.next();!i.done;i=n.next()){var o=i.value;de.fill(o,-1)}}catch(a){e={error:a}}finally{try{i&&!i.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}return r[xt][nt]=0,r[nn][nt]=0,r[nn][xt]=28,r[rs][nt]=0,r[Ye][nt]=0,r[Ye][xt]=15,r}var ns=E1(de.createInt32Array(6,6)),I1=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.")},S1=function(){function r(e,t,n,i){this.token=e,this.mode=t,this.binaryShiftByteCount=n,this.bitCount=i}return r.prototype.getMode=function(){return this.mode},r.prototype.getToken=function(){return this.token},r.prototype.getBinaryShiftByteCount=function(){return this.binaryShiftByteCount},r.prototype.getBitCount=function(){return this.bitCount},r.prototype.latchAndAppend=function(e,t){var n=this.bitCount,i=this.token;if(e!==this.mode){var o=bi[this.mode][e];i=vr(i,o&65535,o>>16),n+=o>>16}var a=e===Ye?4:5;return i=vr(i,t,a),new r(i,e,0,n+a)},r.prototype.shiftAndAppend=function(e,t){var n=this.token,i=this.mode===Ye?4:5;return n=vr(n,ns[this.mode][e],i),n=vr(n,t,5),new r(n,this.mode,0,this.bitCount+i+5)},r.prototype.addBinaryShiftChar=function(e){var t=this.token,n=this.mode,i=this.bitCount;if(this.mode===nt||this.mode===Ye){var o=bi[n][xt];t=vr(t,o&65535,o>>16),i+=o>>16,n=xt}var a=this.binaryShiftByteCount===0||this.binaryShiftByteCount===31?18:this.binaryShiftByteCount===62?9:8,s=new r(t,n,this.binaryShiftByteCount+1,i+a);return s.binaryShiftByteCount===2078&&(s=s.endBinaryShift(e+1)),s},r.prototype.endBinaryShift=function(e){if(this.binaryShiftByteCount===0)return this;var t=this.token;return t=m1(t,e-this.binaryShiftByteCount,this.binaryShiftByteCount),new r(t,this.mode,0,this.bitCount)},r.prototype.isBetterThanOrEqualTo=function(e){var t=this.bitCount+(bi[this.mode][e.mode]>>16);return this.binaryShiftByteCount<e.binaryShiftByteCount?t+=r.calculateBinaryShiftCost(e)-r.calculateBinaryShiftCost(this):this.binaryShiftByteCount>e.binaryShiftByteCount&&e.binaryShiftByteCount>0&&(t+=10),t<=e.bitCount},r.prototype.toBitArray=function(e){for(var t,n,i=[],o=this.endBinaryShift(e.length).token;o!==null;o=o.getPrevious())i.unshift(o);var a=new me;try{for(var s=I1(i),l=s.next();!l.done;l=s.next()){var u=l.value;u.appendTo(a,e)}}catch(c){t={error:c}}finally{try{l&&!l.done&&(n=s.return)&&n.call(s)}finally{if(t)throw t.error}}return a},r.prototype.toString=function(){return Z.format("%s bits=%d bytes=%d",w1[this.mode],this.bitCount,this.binaryShiftByteCount)},r.calculateBinaryShiftCost=function(e){return e.binaryShiftByteCount>62?21:e.binaryShiftByteCount>31?20:e.binaryShiftByteCount>0?10:0},r.INITIAL_STATE=new r(_1,xt,0,0),r}();function b1(r){var e=Z.getCharCode(" "),t=Z.getCharCode("."),n=Z.getCharCode(",");r[xt][e]=1;for(var i=Z.getCharCode("Z"),o=Z.getCharCode("A"),a=o;a<=i;a++)r[xt][a]=a-o+2;r[nn][e]=1;for(var s=Z.getCharCode("z"),l=Z.getCharCode("a"),a=l;a<=s;a++)r[nn][a]=a-l+2;r[Ye][e]=1;for(var u=Z.getCharCode("9"),c=Z.getCharCode("0"),a=c;a<=u;a++)r[Ye][a]=a-c+2;r[Ye][n]=12,r[Ye][t]=13;for(var f=["\0"," ","","","","","","","\x07","\b"," ",`
|
|
63
|
+
`,"\v","\f","\r","\x1B","","","","","@","\\","^","_","`","|","~",""],h=0;h<f.length;h++)r[rs][Z.getCharCode(f[h])]=h;for(var v=["\0","\r","\0","\0","\0","\0","!","'","#","$","%","&","'","(",")","*","+",",","-",".","/",":",";","<","=",">","?","[","]","{","}"],h=0;h<v.length;h++)Z.getCharCode(v[h])>0&&(r[nt][Z.getCharCode(v[h])]=h);return r}var Ti=b1(de.createInt32Array(5,256)),on=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.")},T1=function(){function r(e){this.text=e}return r.prototype.encode=function(){for(var e=Z.getCharCode(" "),t=Z.getCharCode(`
|
|
64
|
+
`),n=ts.singletonList(S1.INITIAL_STATE),i=0;i<this.text.length;i++){var o=void 0,a=i+1<this.text.length?this.text[i+1]:0;switch(this.text[i]){case Z.getCharCode("\r"):o=a===t?2:0;break;case Z.getCharCode("."):o=a===e?3:0;break;case Z.getCharCode(","):o=a===e?4:0;break;case Z.getCharCode(":"):o=a===e?5:0;break;default:o=0}o>0?(n=r.updateStateListForPair(n,i,o),i++):n=this.updateStateListForChar(n,i)}var s=ts.min(n,function(l,u){return l.getBitCount()-u.getBitCount()});return s.toBitArray(this.text)},r.prototype.updateStateListForChar=function(e,t){var n,i,o=[];try{for(var a=on(e),s=a.next();!s.done;s=a.next()){var l=s.value;this.updateStateForChar(l,t,o)}}catch(u){n={error:u}}finally{try{s&&!s.done&&(i=a.return)&&i.call(a)}finally{if(n)throw n.error}}return r.simplifyStates(o)},r.prototype.updateStateForChar=function(e,t,n){for(var i=this.text[t]&255,o=Ti[e.getMode()][i]>0,a=null,s=0;s<=nt;s++){var l=Ti[s][i];if(l>0){if(a==null&&(a=e.endBinaryShift(t)),!o||s===e.getMode()||s===Ye){var u=a.latchAndAppend(s,l);n.push(u)}if(!o&&ns[e.getMode()][s]>=0){var c=a.shiftAndAppend(s,l);n.push(c)}}}if(e.getBinaryShiftByteCount()>0||Ti[e.getMode()][i]===0){var f=e.addBinaryShiftChar(t);n.push(f)}},r.updateStateListForPair=function(e,t,n){var i,o,a=[];try{for(var s=on(e),l=s.next();!l.done;l=s.next()){var u=l.value;this.updateStateForPair(u,t,n,a)}}catch(c){i={error:c}}finally{try{l&&!l.done&&(o=s.return)&&o.call(s)}finally{if(i)throw i.error}}return this.simplifyStates(a)},r.updateStateForPair=function(e,t,n,i){var o=e.endBinaryShift(t);if(i.push(o.latchAndAppend(nt,n)),e.getMode()!==nt&&i.push(o.shiftAndAppend(nt,n)),n===3||n===4){var a=o.latchAndAppend(Ye,16-n).latchAndAppend(Ye,1);i.push(a)}if(e.getBinaryShiftByteCount()>0){var s=e.addBinaryShiftChar(t).addBinaryShiftChar(t+1);i.push(s)}},r.simplifyStates=function(e){var t,n,i,o,a=[];try{for(var s=on(e),l=s.next();!l.done;l=s.next()){var u=l.value,c=!0,f=function(m){if(m.isBetterThanOrEqualTo(u))return c=!1,"break";u.isBetterThanOrEqualTo(m)&&(a=a.filter(function(y){return y!==m}))};try{for(var h=(i=void 0,on(a)),v=h.next();!v.done;v=h.next()){var p=v.value,g=f(p);if(g==="break")break}}catch(m){i={error:m}}finally{try{v&&!v.done&&(o=h.return)&&o.call(h)}finally{if(i)throw i.error}}c&&a.push(u)}}catch(m){t={error:m}}finally{try{l&&!l.done&&(n=s.return)&&n.call(s)}finally{if(t)throw t.error}}return a},r}(),O1=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.")};(function(){function r(){}return r.encodeBytes=function(e){return r.encode(e,r.DEFAULT_EC_PERCENT,r.DEFAULT_AZTEC_LAYERS)},r.encode=function(e,t,n){var i=new T1(e).encode(),o=Y.truncDivision(i.getSize()*t,100)+11,a=i.getSize()+o,s,l,u,c,f;if(n!==r.DEFAULT_AZTEC_LAYERS){if(s=n<0,l=Math.abs(n),l>(s?r.MAX_NB_BITS_COMPACT:r.MAX_NB_BITS))throw new $(Z.format("Illegal value %s for layers",n));u=r.totalBitsInLayer(l,s),c=r.WORD_SIZE[l];var h=u-u%c;if(f=r.stuffBits(i,c),f.getSize()+o>h)throw new $("Data to large for user specified layer");if(s&&f.getSize()>c*64)throw new $("Data to large for user specified layer")}else{c=0,f=null;for(var v=0;;v++){if(v>r.MAX_NB_BITS)throw new $("Data too large for an Aztec code");if(s=v<=3,l=s?v+1:v,u=r.totalBitsInLayer(l,s),!(a>u)){(f==null||c!==r.WORD_SIZE[l])&&(c=r.WORD_SIZE[l],f=r.stuffBits(i,c));var h=u-u%c;if(!(s&&f.getSize()>c*64)&&f.getSize()+o<=h)break}}}var p=r.generateCheckWords(f,u,c),g=f.getSize()/c,m=r.generateModeMessage(s,l,g),y=(s?11:14)+l*4,C=new Int32Array(y),w;if(s){w=y;for(var v=0;v<C.length;v++)C[v]=v}else{w=y+1+2*Y.truncDivision(Y.truncDivision(y,2)-1,15);for(var E=Y.truncDivision(y,2),I=Y.truncDivision(w,2),v=0;v<E;v++){var S=v+Y.truncDivision(v,15);C[E-v-1]=I-S-1,C[E+v]=I+S+1}}for(var b=new rt(w),v=0,P=0;v<l;v++){for(var L=(l-v)*4+(s?9:12),M=0;M<L;M++)for(var F=M*2,V=0;V<2;V++)p.get(P+F+V)&&b.set(C[v*2+V],C[v*2+M]),p.get(P+L*2+F+V)&&b.set(C[v*2+M],C[y-1-v*2-V]),p.get(P+L*4+F+V)&&b.set(C[y-1-v*2-V],C[y-1-v*2-M]),p.get(P+L*6+F+V)&&b.set(C[y-1-v*2-M],C[v*2+V]);P+=L*8}if(r.drawModeMessage(b,s,w,m),s)r.drawBullsEye(b,Y.truncDivision(w,2),5);else{r.drawBullsEye(b,Y.truncDivision(w,2),7);for(var v=0,M=0;v<Y.truncDivision(y,2)-1;v+=15,M+=16)for(var V=Y.truncDivision(w,2)&1;V<w;V+=2)b.set(Y.truncDivision(w,2)-M,V),b.set(Y.truncDivision(w,2)+M,V),b.set(V,Y.truncDivision(w,2)-M),b.set(V,Y.truncDivision(w,2)+M)}var z=new p1;return z.setCompact(s),z.setSize(w),z.setLayers(l),z.setCodeWords(g),z.setMatrix(b),z},r.drawBullsEye=function(e,t,n){for(var i=0;i<n;i+=2)for(var o=t-i;o<=t+i;o++)e.set(o,t-i),e.set(o,t+i),e.set(t-i,o),e.set(t+i,o);e.set(t-n,t-n),e.set(t-n+1,t-n),e.set(t-n,t-n+1),e.set(t+n,t-n),e.set(t+n,t-n+1),e.set(t+n,t+n-1)},r.generateModeMessage=function(e,t,n){var i=new me;return e?(i.appendBits(t-1,2),i.appendBits(n-1,6),i=r.generateCheckWords(i,28,4)):(i.appendBits(t-1,5),i.appendBits(n-1,11),i=r.generateCheckWords(i,40,4)),i},r.drawModeMessage=function(e,t,n,i){var o=Y.truncDivision(n,2);if(t)for(var a=0;a<7;a++){var s=o-3+a;i.get(a)&&e.set(s,o-5),i.get(a+7)&&e.set(o+5,s),i.get(20-a)&&e.set(s,o+5),i.get(27-a)&&e.set(o-5,s)}else for(var a=0;a<10;a++){var s=o-5+a+Y.truncDivision(a,5);i.get(a)&&e.set(s,o-7),i.get(a+10)&&e.set(o+7,s),i.get(29-a)&&e.set(s,o+7),i.get(39-a)&&e.set(o-7,s)}},r.generateCheckWords=function(e,t,n){var i,o,a=e.getSize()/n,s=new Ga(r.getGF(n)),l=Y.truncDivision(t,n),u=r.bitsToWords(e,n,l);s.encode(u,l-a);var c=t%n,f=new me;f.appendBits(0,c);try{for(var h=O1(Array.from(u)),v=h.next();!v.done;v=h.next()){var p=v.value;f.appendBits(p,n)}}catch(g){i={error:g}}finally{try{v&&!v.done&&(o=h.return)&&o.call(h)}finally{if(i)throw i.error}}return f},r.bitsToWords=function(e,t,n){var i=new Int32Array(n),o,a;for(o=0,a=e.getSize()/t;o<a;o++){for(var s=0,l=0;l<t;l++)s|=e.get(o*t+l)?1<<t-l-1:0;i[o]=s}return i},r.getGF=function(e){switch(e){case 4:return Ve.AZTEC_PARAM;case 6:return Ve.AZTEC_DATA_6;case 8:return Ve.AZTEC_DATA_8;case 10:return Ve.AZTEC_DATA_10;case 12:return Ve.AZTEC_DATA_12;default:throw new $("Unsupported word size "+e)}},r.stuffBits=function(e,t){for(var n=new me,i=e.getSize(),o=(1<<t)-2,a=0;a<i;a+=t){for(var s=0,l=0;l<t;l++)(a+l>=i||e.get(a+l))&&(s|=1<<t-1-l);(s&o)===o?(n.appendBits(s&o,t),a--):(s&o)===0?(n.appendBits(s|1,t),a--):n.appendBits(s,t)}return n},r.totalBitsInLayer=function(e,t){return((t?88:112)+16*e)*e},r.DEFAULT_EC_PERCENT=33,r.DEFAULT_AZTEC_LAYERS=0,r.MAX_NB_BITS=32,r.MAX_NB_BITS_COMPACT=4,r.WORD_SIZE=Int32Array.from([4,6,6,8,8,8,8,8,8,10,10,10,10,10,10,10,10,10,10,10,10,10,10,12,12,12,12,12,12,12,12,12,12]),r})();const Oi=A.memo(r=>{const[{inputId:e,labelId:t,label:n,helpText:i,size:o,severity:a,showInputOnly:s,field:l,fieldProps:u,helpers:c,touched:f},h]=He(r),{name:v,onBlur:p,onChange:g,value:m}=u,[y,C]=A.useState(!1),w=s?null:i,E=s?"":n,[I,S]=A.useState(void 0);A.useEffect(()=>{S(m)},[m]);const b=A.useCallback(F=>{S(F.target.value||void 0),(f||!l.onlyValidateAfterTouched)&&c.setError(l.getError(F.target.value))},[l,c,f]),P=A.useCallback(()=>{g(I),p(I)},[I,p,g]),L=A.useCallback(F=>{g(F),C(!1)},[g]),M=A.useCallback(F=>{C(F),F||p(m)},[p,m]);return d.jsx(Xe,{helpText:w,severity:a,children:d.jsxs(We,{size:o,severity:a,inputId:e,labelId:t,label:E,image:s?void 0:l.image,className:"flex-col items-start justify-start gap-2",children:[d.jsx(x.TextArea,{className:"w-full field-sizing-content",accentColor:"base",variant:"surface",size:"sm",id:e,name:v,value:I??"",placeholder:"Enter a qr or barcode",onChange:b,onBlur:P,...h}),d.jsxs(qo,{open:y,onOpenChange:M,children:[d.jsx(Lu,{asChild:!0,children:d.jsxs(x.Button,{className:"w-max",type:"button",variant:"soft",size:"sm",accentColor:"base",children:[d.jsx(x.RiIcon,{icon:"RiFullscreenLine"}),"Scan"]})}),d.jsxs(Yo,{children:[d.jsx(Zo,{className:"light:bg-(--black-a6) fixed inset-0 dark:bg-(--black-a8)"}),d.jsx(Ko,{className:"fixed inset-0",children:d.jsx(Ni,{onScan:L})})]})]})]})})});Oi.displayName="QrInput";const N1=new Map([[Xi.DecodeHintType.POSSIBLE_FORMATS,[H.AZTEC,H.CODABAR,H.CODE_39,H.CODE_93,H.CODE_128,H.DATA_MATRIX,H.EAN_8,H.EAN_13,H.ITF,H.MAXICODE,H.PDF_417,H.QR_CODE,H.RSS_14,H.RSS_EXPANDED,H.UPC_A,H.UPC_E,H.UPC_EAN_EXTENSION]]]),Ni=A.memo(r=>{const{onScan:e}=r,{showError:t}=x.useToast(),n=A.useCallback(a=>{e(a.getText())},[e]),i=A.useCallback(()=>{t({title:"Scan Error",description:"An unknown error occurred while scanning."})},[t]),{ref:o}=Xi.useZxing({onDecodeResult:n,onError:i,hints:N1});return d.jsxs("div",{className:"relative flex size-full flex-col justify-center overflow-hidden p-4 gap-4 bg-(--color-background)",children:[d.jsx("div",{className:"flex w-full",children:d.jsx(Qo,{asChild:!0,children:d.jsx(x.IconButton,{"aria-label":"close",variant:"soft",accentColor:"base",children:d.jsx(x.RiIcon,{icon:"RiCloseLine"})})})}),d.jsx("div",{className:"relative grow w-full max-h-full overflow-hidden",children:d.jsx("video",{className:"size-full",ref:o})})]})});Ni.displayName="QrScanner";const is={...Ue,type:"qr"},Yt=class Yt extends Ee{constructor(t){super({...t,type:"qr"});O(this,"onlyValidateAfterTouched",!1);O(this,"defaultConditionValue");O(this,"defaultConditionModifier","equals");O(this,"modifiers",{equals:j({modifier:Er,isValueValid:t=>!0,isConditionValueValid:t=>!0}),notEquals:j({modifier:Ir,isValueValid:t=>!0,isConditionValueValid:t=>!0}),includes:j({modifier:Ki,isValueValid:t=>!0,isConditionValueValid:t=>!0}),excludes:j({modifier:Qi,isValueValid:t=>!0,isConditionValueValid:t=>!0})})}serialize(){return super._serialize()}static deserialize(t){if(t.type!=="qr")throw new Error("Type mismatch.");return new Yt(t)}getInput(t){return d.jsx(Oi,{...t,field:this})}renderCondition(t){return d.jsx(Gu,{...t})}};O(Yt,"fieldTypeName","Scan"),O(Yt,"fieldTypeDescription","Used for scanning/reading QR and barcodes."),O(Yt,"Icon",Ae.RiFullscreenLine);let an=Yt;const D1=r=>{const{field:e,condition:t,conditionManager:n}=r,i=t.getConditionValue(),o=t.getConditionModifier(),a=A.useMemo(()=>e.options.map(c=>typeof c=="string"?{value:c,label:c}:c),[e.options]),s=A.useMemo(()=>{const c={};for(const f of a)c[f.value]=f.label;return c},[a]),l=A.useCallback(c=>{c.length>0?t.setConditionValue(c):t.setConditionValue([])},[t]),u=()=>{switch(o){case"equals":case"notEquals":{const c=e.modifiers.equals,f=i!==void 0&&c.isConditionValueValid(i)?i:void 0;return d.jsxs(x.Menu.Root,{children:[d.jsx(x.Menu.ClickTrigger,{children:d.jsx(x.Button,{type:"button",className:"min-w-0 shrink-1 grow",children:d.jsx("span",{className:"truncate",children:f!==void 0?f?s[f]:"empty":"..."})})}),d.jsx(x.Menu.Content,{size:"sm",children:d.jsx(Zn,{required:!1,selectFieldOptions:e.options,value:f??void 0,onValueChange:h=>t.setConditionValue(h)})})]})}case"includes":case"excludes":{const c=e.modifiers.includes,f=i!==void 0&&c.isConditionValueValid(i)?i:void 0;return d.jsxs(x.Menu.Root,{children:[d.jsx(x.Menu.ClickTrigger,{children:d.jsx(x.Button,{type:"button",children:f?`${f.length} options`:"..."})}),d.jsx(x.Menu.Content,{size:"sm",children:d.jsx(or,{selectFieldOptions:e.options,values:f??[],onValuesChange:l})})]})}}};return d.jsxs(x.ButtonGroup,{className:"flex w-max max-w-full min-w-0 gap-0.5",size:"sm",variant:"fill",accentColor:"base",children:[d.jsxs(x.Badge,{className:"min-w-0 shrink-1",size:"sm",variant:"fill",accentColor:"base",children:[d.jsx(x.RiIcon,{icon:ze[e.type]}),d.jsx("span",{className:"truncate",children:e.label})]}),d.jsx($e,{field:e,condition:t,children:d.jsx(x.Button,{type:"button",children:e.getConditionModifier(o).modifier.render(i)})}),u(),d.jsx(Ge,{condition:t,conditionManager:n})]})},Di=A.memo(r=>{const[{inputId:e,labelId:t,size:n,severity:i,showInputOnly:o,field:a,helpText:s,label:l,fieldProps:u},c]=He(r),{name:f,onChange:h,onBlur:v,value:p}=u,g=o?null:s,m=o?"":l,y=A.useCallback(w=>{h(w),v(w)},[v,h]),C=A.useMemo(()=>a.options.find(w=>w.value===p),[a.options,p]);return d.jsx(Xe,{helpText:g,severity:i,children:d.jsx(We,{size:n,severity:i,inputId:e,labelId:t,label:m,image:o?void 0:a.image,children:d.jsxs(x.Menu.Root,{align:"start",children:[d.jsx(x.Menu.ClickTrigger,{children:d.jsxs(x.Button,{id:e,name:f,className:"!justify-between",accentColor:"base",variant:"surface",type:"button",size:"sm",...c,children:[d.jsx("span",{className:"truncate",children:C?C.label:a.placeholder}),d.jsx(x.RiIcon,{icon:"RiArrowDownSLine"})]})}),d.jsx(x.Menu.Content,{children:d.jsx(x.Menu.Scroll,{children:d.jsx(x.Menu.SelectGroup,{required:!1,value:p??void 0,onValueChange:y,children:a.options.map(w=>d.jsxs(x.Menu.SelectItem,{value:w.value,children:[d.jsx(x.Menu.SelectedIndicator,{children:d.jsx(x.RiIcon,{icon:"RiCheckLine"})}),w.label]},w.value))})})})]})})})});Di.displayName="SelectInput";const os={...Ue,type:"select",options:[]},Zt=class Zt extends Gn{constructor(t){const{placeholder:n="Select one...",...i}=t;super({...i,placeholder:n,type:"select"});O(this,"defaultConditionValue");O(this,"defaultConditionModifier","equals");O(this,"modifiers",{equals:j({modifier:Er,isValueValid:t=>!0,isConditionValueValid:t=>!Array.isArray(t)}),notEquals:j({modifier:Ir,isValueValid:t=>!0,isConditionValueValid:t=>!Array.isArray(t)}),includes:j({modifier:Ji,isValueValid:t=>!0,isConditionValueValid:t=>Array.isArray(t)}),excludes:j({modifier:eo,isValueValid:t=>!0,isConditionValueValid:t=>Array.isArray(t)})})}serialize(){return super._serialize()}static deserialize(t){if(t.type!=="select")throw new Error("Type mismatch.");return new Zt(t)}getInput(t){return d.jsx(Di,{field:this,...t})}renderCondition(t){return d.jsx(D1,{...t})}};O(Zt,"fieldTypeName","Dropdown"),O(Zt,"fieldTypeDescription","Allows the user to select a single option from a list of options."),O(Zt,"Icon",Ae.RiMenuFoldLine);let sn=Zt;const pr=500,M1=r=>{const{field:e,condition:t,conditionManager:n}=r,i=t.getConditionValue(),o=t.getConditionModifier(),a=()=>{switch(o){case"equals":case"notEquals":{const s=e.modifiers.equals,l=i!==void 0&&s.isConditionValueValid(i)?i:void 0;return d.jsxs(x.Menu.Root,{children:[d.jsx(x.Menu.ClickTrigger,{children:d.jsx(x.Button,{type:"button",className:"truncate",children:l!==void 0?l??"empty":"..."})}),d.jsx(x.Menu.Content,{size:"sm",children:d.jsx(x.Input.Root,{accentColor:"base",size:"sm",children:d.jsx(x.Input.Field,{placeholder:"Enter some text",type:"text",value:l??"",onChange:u=>{const c=u.target.value;t.setConditionValue(c)}})})})]})}case"includes":case"excludes":return d.jsx(Xr,{value:i??"",onValueChange:t.setConditionValue,size:"sm",children:d.jsx(x.Button,{type:"button",className:"min-w-0 shrink-1 grow",children:d.jsx("span",{className:"truncate",children:i||"..."})})})}};return d.jsxs(x.ButtonGroup,{className:"flex w-max max-w-full min-w-0 gap-0.5",size:"sm",variant:"fill",accentColor:"base",children:[d.jsxs(x.Badge,{className:"min-w-0 shrink-1",size:"sm",variant:"fill",accentColor:"base",children:[d.jsx(x.RiIcon,{icon:ze[e.type]}),d.jsx("span",{className:"truncate",children:e.label})]}),d.jsx($e,{field:e,condition:t,children:d.jsx(x.Button,{type:"button",children:e.getConditionModifier(o).modifier.render(i)})}),a(),d.jsx(Ge,{condition:t,conditionManager:n})]})},Tt=1e4,as=r=>"fields"in r;class gr extends Ee{constructor(t){const{minLength:n,maxLength:i,placeholder:o="",...a}=t;super(a);O(this,"minLength");O(this,"maxLength");O(this,"placeholder");O(this,"defaultConditionValue");O(this,"defaultConditionModifier","equals");O(this,"modifiers",{equals:j({modifier:Er,isValueValid:t=>!0,isConditionValueValid:t=>!0}),notEquals:j({modifier:Ir,isValueValid:t=>!0,isConditionValueValid:t=>!0}),includes:j({modifier:Ki,isValueValid:t=>!0,isConditionValueValid:t=>!0}),excludes:j({modifier:Qi,isValueValid:t=>!0,isConditionValueValid:t=>!0})});this.minLength=n?Math.max(n,0):void 0,this.maxLength=i?Math.max(i,0):Tt,this.placeholder=o}static getFieldCreationSchema(t=""){const n=t&&`${t}.`;return[{field:new dt({label:"Minimum length",description:"Minimum number of characters",required:!1,identifier:`${n}minimum_length`,minimum:0,maximum:100,formValidators:[this._validateMin(t)],integers:!0}),showDirectly:!1},{field:new dt({label:"Maximum length",description:"Maximum number of characters",required:!1,identifier:`${n}maximum_length`,minimum:1,maximum:Tt,formValidators:[this._validateMax(t)],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(){if(!this.identifier)throw new Error("Field identifier must be set before serializing.");return{...super._serialize(),minimum_length:this.minLength,maximum_length:this.maxLength,placeholder:this.placeholder}}}O(gr,"_validateMin",t=>(n,i)=>{const o=as(i)?st(i,t):i;return typeof o.maximum_length=="number"&&typeof n=="number"&&o.maximum_length<n?"Minimum cannot be greater than maximum.":null}),O(gr,"_validateMax",t=>(n,i)=>{if(typeof n!="number")return null;const{minimum_length:o}=as(i)?st(i,t):i;return typeof o!="number"?null:o>n?"Maximum cannot be less than minimum.":null});const Mi=A.memo(r=>{const[{inputId:e,labelId:t,size:n,severity:i,showInputOnly:o,field:a,helpText:s,label:l,fieldProps:u,touched:c,helpers:f},h]=He(r),{name:v,onBlur:p,onChange:g,value:m}=u,y=o?null:s,C=o?"":l,[w,E]=A.useState(void 0);A.useEffect(()=>{E(m)},[m]);const I=A.useCallback(b=>{E(b.target.value||void 0),(c||!a.onlyValidateAfterTouched)&&f.setError(a.getError(b.target.value))},[a,f,c]),S=A.useCallback(()=>{g(w),p(w)},[w,p,g]);return d.jsx(Xe,{helpText:y,severity:i,children:d.jsx(We,{size:n,severity:i,inputId:e,labelId:t,label:C,image:o?void 0:a.image,children:d.jsx(x.Input.Root,{accentColor:"base",variant:"surface",size:"sm",children:d.jsx(x.Input.Field,{id:e,className:"truncate",name:v,value:w??"",type:a.inputType,placeholder:a.placeholder,onChange:I,onBlur:S,...h})})})})});Mi.displayName="StringInput";const ss={...Ue,type:"string",maximum_length:pr,input_type:"text"},Kt=class Kt extends gr{constructor(t){const{inputType:n="text",...i}=t,o=t.maxLength?Math.min(pr,t.maxLength):pr,a=t.minLength?Math.min(t.minLength,o):void 0;super({...i,maxLength:o,minLength:a,type:"string"});O(this,"inputType");this.inputType=n}serialize(){return{...super._serialize(),input_type:this.inputType}}static deserialize(t){if(t.type!=="string")throw new Error("Type mismatch.");const{maximum_length:n,minimum_length:i,input_type:o,...a}=t;return new Kt({...a,maxLength:n,minLength:i,inputType:o,placeholder:"Enter a short description"})}getInput(t){return d.jsx(Mi,{field:this,...t})}renderCondition(t){return d.jsx(M1,{...t})}};O(Kt,"fieldTypeName","Short Text"),O(Kt,"fieldTypeDescription",`Short text fields can hold up to ${pr} characters on a single line.`),O(Kt,"Icon",Ae.RiInputField);let ln=Kt;const P1=r=>{const{field:e,condition:t,conditionManager:n}=r,i=t.getConditionValue(),o=t.getConditionModifier(),a=()=>{switch(o){case"equals":case"notEquals":{const s=e.modifiers.equals,l=i!==void 0&&s.isConditionValueValid(i)?i:void 0;return d.jsxs(x.Menu.Root,{children:[d.jsx(x.Menu.ClickTrigger,{children:d.jsx(x.Button,{type:"button",className:"truncate",children:l!==void 0?l??"empty":"..."})}),d.jsx(x.Menu.Content,{size:"sm",children:d.jsx(x.Input.Root,{accentColor:"base",size:"sm",children:d.jsx(x.Input.Field,{placeholder:"Enter some text",type:"text",value:l??"",onChange:u=>{const c=u.target.value;t.setConditionValue(c)}})})})]})}case"includes":case"excludes":return d.jsx(Xr,{value:i??"",onValueChange:t.setConditionValue,size:"sm",children:d.jsx(x.Button,{type:"button",className:"min-w-0 shrink-1 grow",children:d.jsx("span",{className:"truncate",children:i||"..."})})})}};return d.jsxs(x.ButtonGroup,{className:"flex w-max max-w-full min-w-0 gap-0.5",size:"sm",variant:"fill",accentColor:"base",children:[d.jsxs(x.Badge,{className:"min-w-0 shrink-1",size:"sm",variant:"fill",accentColor:"base",children:[d.jsx(x.RiIcon,{icon:ze[e.type]}),d.jsx("span",{className:"truncate",children:e.label})]}),d.jsx($e,{field:e,condition:t,children:d.jsx(x.Button,{type:"button",children:e.getConditionModifier(o).modifier.render(i)})}),a(),d.jsx(Ge,{condition:t,conditionManager:n})]})},Pi=A.memo(r=>{const[{inputId:e,labelId:t,size:n,severity:i,showInputOnly:o,field:a,helpText:s,label:l,fieldProps:u,touched:c,helpers:f},h]=He(r),{name:v,onBlur:p,onChange:g,value:m}=u,y=o?null:s,C=o?"":l,[w,E]=A.useState(void 0);A.useEffect(()=>{E(m)},[m]);const I=A.useCallback(b=>{E(b.target.value||void 0),(c||!a.onlyValidateAfterTouched)&&f.setError(a.getError(b.target.value))},[a,f,c]),S=A.useCallback(()=>{g(w),p(w)},[w,p,g]);return d.jsx(Xe,{helpText:y,severity:i,children:d.jsx(We,{size:n,severity:i,inputId:e,labelId:t,label:C,image:o?void 0:a.image,children:d.jsx(x.TextArea,{id:e,value:w??"",name:v,onChange:I,onBlur:S,className:"field-sizing-content min-h-12",placeholder:a.placeholder,resize:"vertical",accentColor:"base",variant:"surface",size:"sm",...h})})})});Pi.displayName="TextInput";const ls={...Ue,type:"text",maximum_length:Tt},Qt=class Qt extends gr{constructor(e){const t=e.maxLength?Math.min(Tt,e.maxLength):Tt,n=e.minLength?Math.min(e.minLength,t):void 0;super({...e,maxLength:t,minLength:n,type:"text"})}serialize(){return super._serialize()}static deserialize(e){if(e.type!=="text")throw new Error("Type mismatch.");const{maximum_length:t,minimum_length:n,...i}=e;return new Qt({...i,maxLength:t,minLength:n,placeholder:"Enter a description"})}getInput(e){return d.jsx(Pi,{field:this,...e})}renderCondition(e){return d.jsx(P1,{...e})}};O(Qt,"fieldTypeName","Paragraph"),O(Qt,"fieldTypeDescription",`Paragraph fields can hold up to ${Tt} characters and can have multiple lines.`),O(Qt,"Icon",Ae.RiAlignJustify);let un=Qt;const F1=r=>{const{field:e,condition:t,conditionManager:n}=r,i=t.getConditionValue(),o=t.getConditionModifier(),a=()=>{switch(i){case void 0:return"...";case!0:return"true";case!1:return"false";case null:return"empty"}};return d.jsxs(x.ButtonGroup,{className:"flex w-max max-w-full min-w-0 gap-0.5",size:"sm",variant:"fill",accentColor:"base",children:[d.jsxs(x.Badge,{className:"min-w-0 shrink-1",size:"sm",variant:"fill",accentColor:"base",children:[d.jsx(x.RiIcon,{icon:ze[e.type]}),d.jsx("span",{className:"truncate",children:e.label})]}),d.jsx($e,{field:e,condition:t,children:d.jsx(x.Button,{type:"button",children:e.getConditionModifier(o).modifier.render(i)})}),d.jsxs(x.Menu.Root,{children:[d.jsx(x.Menu.ClickTrigger,{children:d.jsx(x.Button,{type:"button",className:"min-w-0 shrink-1 grow",children:a()})}),d.jsx(x.Menu.Content,{size:"sm",children:d.jsxs(x.Menu.SelectGroup,{required:!0,value:i,onValueChange:t.setConditionValue,children:[d.jsx(Dt,{value:!0,children:"empty"}),d.jsx(Dt,{value:!1,children:"not empty"})]})})]}),d.jsx(Ge,{condition:t,conditionManager:n})]})},B1=ae.create({id:"has-files",modifierFn:(r,e)=>r.length>0,render:r=>"is",serialize:r=>r,deserialize:r=>r}),L1=ae.create({id:"does-not-have-files",modifierFn:(r,e)=>r.length===0,render:r=>"is not",serialize:r=>r,deserialize:r=>r}),us=A.memo(A.forwardRef((r,e)=>{const{file:t,alt:n,error:i,rightSlot:o,className:a,...s}=r;return d.jsxs(x.Card,{className:yt.cx(a,"relative flex h-[200px] w-full flex-col gap-2 overflow-hidden items-center"),ref:e,...s,children:[!t&&!i&&d.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:d.jsx(x.Spinner,{})}),!!t&&!i&&d.jsx(x.Card,{className:"flex max-w-full grow items-center !p-0 justify-center overflow-hidden bg-clip-padding",children:d.jsx("img",{className:"max-w-full object-cover",src:URL.createObjectURL(t),alt:n??t.name})}),(!!t||!!i)&&d.jsxs("div",{className:yt.cx("flex w-full items-center gap-2 self-end",{"bg-transparent":!t}),children:[i?d.jsx(x.RiIcon,{icon:"RiFileWarningLine"}):t&&d.jsx(x.RiIcon,{icon:"RiFileLine",color:"var(--base-a11)"}),d.jsx(x.Text,{className:"truncate",size:"sm",children:i??(t==null?void 0:t.name)}),o]})]})})),R1=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)},Fi=A.memo(r=>{var P;const[{inputId:e,labelId:t,label:n,size:i,severity:o,helpText:a,showInputOnly:s,field:l,fieldProps:u},c]=He(r),{name:f,onChange:h,onBlur:v}=u,p=u.value??Sr,g=A.useRef(null),m=A.useMemo(()=>s?null:a||(l.maxFileSize?`Maximum file size: ${l.maxFileSize}MB`:null),[l.maxFileSize,a,s]),y=A.useCallback(()=>{var L;(L=g.current)==null||L.click()},[]),C=A.useCallback(()=>{if(!g.current)return;const L=g.current.files;if(!L){v([]);return}const M=Array.from(L),F=[...p,...M];h(F),v(F)},[v,h,p]),w=A.useCallback(L=>{const M=[...p];M.splice(L,1),h(M.length>0?M:void 0)},[p,h]);A.useEffect(()=>{if(!g.current)return;const L=new AbortController;return g.current.addEventListener("cancel",()=>{v(void 0)},{signal:L.signal}),()=>{L.abort()}},[v,p]);const E=s?"":n,b=l.maxFiles>1?"Select files":"Select a file";return d.jsxs("div",{className:"flex flex-col gap-2",children:[d.jsx(Xe,{helpText:m,severity:o,children:d.jsxs(We,{size:i,severity:o,inputId:e,labelId:t,label:E,image:s?void 0:l.image,children:[d.jsxs(x.Button,{className:"w-max",size:"sm",variant:"soft",accentColor:"base",onClick:y,id:"upload-input-upload-button",type:"button",...c,children:[d.jsx(x.RiIcon,{icon:"RiUpload2Line"})," ",b]}),d.jsx("input",{id:e,name:f,type:"file",ref:g,accept:(P=l.extensions)==null?void 0:P.join(","),multiple:l.maxFiles>1,className:"hidden",onChange:C,value:""})]})}),Array.isArray(p)&&p.length>0&&d.jsx("div",{className:"flex h-max flex-col gap-2",children:p.map((L,M)=>d.jsx(cs,{field:l,file:L,onRemove:()=>{w(M)},disabled:c.disabled},M))})]})});Fi.displayName="UploadInput";const cs=A.memo(r=>{const{file:e,field:t,onRemove:n,disabled:i}=r,[o,a]=A.useState(null),s=Nr(),l=A.useMemo(()=>o&&t.getError([o]),[t,o]),{url:u,name:c}=A.useMemo(()=>{let g=null,m,y;return o!=null&&o.type.startsWith("image/")&&(g=URL.createObjectURL(o)),o?(m=o.name,y=R1(o.size)):(m="Downloading...",y="..."),{url:g,name:m,size:y}},[o]);A.useEffect(()=>{e instanceof Promise?e.then(a).catch(console.error):a(e)},[e]);const f=A.useCallback(g=>{if(g.stopPropagation(),!o)throw new Error("Cannot download a file that is not resolved.");const m=new Blob([o]);Wi.saveAs(m,c)},[c,o]),h=A.useCallback(g=>{g.stopPropagation(),n()},[n]),v=A.useCallback(()=>{o&&s(g=>({file:o,onDelete:i?void 0:()=>{n(),g()}}))},[i,n,s,o]),p=A.useMemo(()=>d.jsxs(x.ButtonGroup,{className:"flex grow justify-end",variant:"ghost",accentColor:"base",size:"sm",children:[d.jsx(x.IconButton,{"aria-label":`Download ${c}`,type:"button",onClick:f,disabled:!o,children:d.jsx(x.RiIcon,{icon:"RiDownload2Line"})}),!i&&d.jsx(x.IconButton,{type:"button","aria-label":`Remove ${c}`,disabled:i,onClick:h,children:d.jsx(x.RiIcon,{icon:"RiDeleteBin7Fill"})})]}),[i,h,f,c,o]);return u?d.jsx(us,{className:"cursor-pointer",onClick:v,file:o,error:l??void 0,rightSlot:p}):d.jsx(Cn,{file:o,error:l??void 0,rightSlot:p})});cs.displayName="DisplayFile";const fs={...Ue,type:"upload",extensions:[],maximum_size:void 0,maximum_files:1};function ds(r,e){return r.name===e.name&&r.size===e.size&&r.type===e.type}const Jt=class Jt extends Ee{constructor(t){const{extensions:n,maximum_files:i,maximum_size:o,...a}=t;super({...a,type:"upload"});O(this,"extensions");O(this,"maxFileSize");O(this,"maxFiles");O(this,"onlyValidateAfterTouched",!1);O(this,"defaultConditionValue");O(this,"defaultConditionModifier","equals");O(this,"modifiers",{equals:j({modifier:B1,isValueValid:t=>!0,isConditionValueValid:t=>!0}),notEquals:j({modifier:L1,isValueValid:t=>!0,isConditionValueValid:t=>!0})});this.maxFileSize=typeof o=="number"?o:void 0,this.maxFiles=Math.max(typeof i=="number"?i:1,1),this.extensions=n}isBlank(t){return super.isBlank(t)||(t==null?void 0:t.length)===0}isEqual(t,n){return t===void 0&&n===void 0?!0:!(t===void 0||n===void 0||!t.every(i=>n.some(o=>ds(i,o)))||!n.every(i=>t.some(o=>ds(o,i))))}static getFieldCreationSchema(t=""){const n=t&&`${t}.`;return[{field:new dt({label:"How many files can be uploaded?",description:"By default, only one file can be uploaded.",required:!1,minimum:1,maximum:10,identifier:`${n}maximum_files`,integers:!0}),showDirectly:!1},{field:new dt({label:"What is the maximum size of each file?",description:`Maximum file size in megabytes (between 1MB–${yr}MB).`,required:!1,identifier:`${n}maximum_size`,minimum:1,maximum:yr,integers:!0}),showDirectly:!1},{field:new ar({label:"Accepted file types",description:"Types of allowed files to upload. If left blank, all files will be accepted.",required:!1,identifier:`${n}extensions`,options:[{value:"image/*",label:"Images"},{value:"audio/*",label:"Audio files"},{value:"video/*",label:"Videos"},{value:"text/*",label:"Text files"},{value:"application/*",label:"Application files (includes PDFs and Word documents)"}]}),showDirectly:!1}]}getFieldValidators(){const t=super.getFieldValidators(),n=this.maxFileSize??yr,i=n*1e3*1e3,o=this.maxFiles||1;return t.push(a=>{if(a&&a.some(s=>s.size>i))return`Files must be at most ${n}MB.`}),t.push(a=>{if(a&&a.length>o)return`You can only upload ${o} files.`}),t}serialize(){return{...super._serialize(),extensions:this.extensions,maximum_size:this.maxFileSize,maximum_files:this.maxFiles}}static deserialize(t){if(t.type!=="upload")throw new Error("Type mismatch.");return new Jt(t)}getInput(t){return d.jsx(Fi,{field:this,...t})}renderCondition(t){return d.jsx(F1,{...t})}};O(Jt,"fieldTypeName","Upload"),O(Jt,"fieldTypeDescription","Allows a file to be uploaded."),O(Jt,"Icon",Ae.RiUpload2Line);let cn=Jt;const xr={date:Gr,number:dt,boolean:ir,select:sn,string:ln,text:un,upload:cn,qr:an,"multi-string":_t,"multi-select":ar,radio:Wr,"checkbox-list":Hr},Bi={date:na,number:oa,boolean:ta,select:os,string:ss,text:ls,upload:fs,qr:is,"multi-string":ea,"multi-select":ia,radio:sa,"checkbox-list":ra},ze={boolean:"RiCheckboxCircleLine",date:"RiCalendarLine","multi-string":"RiListCheck",number:"RiHashtag",qr:"RiFullscreenLine","multi-select":"RiCheckboxLine",select:"RiMenuFoldLine",string:"RiInputField",text:"RiAlignJustify",upload:"RiUpload2Line",section:"RiFolderLine",radio:"RiRadioButtonFill","checkbox-list":"RiCheckboxMultipleLine"},yr=50,hs=yr*1e3,vs=hs*1e3,Li=r=>{const e=r.type;return xr[e].deserialize(r)},fn=r=>r.type==="section"?De.deserialize(r):Li(r);function ps(r){return r.map(e=>fn(e))}function V1(r){return r.map(e=>fn(e))}function dn(r){const e=[];for(const t of r)if(t instanceof De)for(const n of t.fields)e.push(n);else{if(!(t instanceof Ee))throw new Error(`Invalid field type: ${t.type}`);e.push(t)}return e}function gs(r){const e=dn(r),t={};for(const n of e)t[n.identifier]=n;return t}function k1(r,e){const t=dn(r),n={};for(const i of t){const o=e[i.identifier]??null;o!==null?n[i.identifier]=i.decodeJsonToValue(o):n[i.identifier]=o}return n}function z1(r,e){const t=dn(r),n={};for(const i of t){const o=e[i.identifier];n[i.identifier]=i.encodeValueToJson(o)}return n}function U1(r){return Array.isArray(r)&&r.some(e=>e instanceof File||e instanceof Promise)}class Cr{constructor(e){O(this,"section");O(this,"conditions",[]);O(this,"onConditionsChange");O(this,"initConditions",e=>{for(const t of e)t.subscribe(this.subscribeToCondition);this.conditions=e});O(this,"subscribeToCondition",e=>{var n;const t=this.conditions.findIndex(i=>i.id===e.id);t!==-1&&(this.conditions[t]=e,this.conditions=[...this.conditions],(n=this.onConditionsChange)==null||n.call(this,this.conditions))});O(this,"getConditions",()=>this.conditions);O(this,"setConditions",e=>{this.initConditions(e)});O(this,"setOnConditionChange",e=>{this.onConditionsChange=e});O(this,"setSection",e=>{this.section=e});O(this,"apply",(e,t)=>e.every(n=>n.apply(t[n.field.identifier])));O(this,"addCondition",e=>{var t;e.subscribe(this.subscribeToCondition),this.initConditions([...this.conditions,e]),(t=this.onConditionsChange)==null||t.call(this,this.conditions)});O(this,"removeCondition",e=>{var t;this.conditions=this.conditions.filter(n=>n.id!==e),this.initConditions(this.conditions),(t=this.onConditionsChange)==null||t.call(this,this.conditions)});O(this,"removeAll",()=>{var e;this.conditions=[],(e=this.onConditionsChange)==null||e.call(this,this.conditions)});const{section:t,conditions:n}=e;this.section=t,this.section,this.initConditions(n)}static create(e){return new Cr(e)}}const xs=A.createContext(null),H1=xs.Provider,G1=()=>A.useContext(xs),ys=(r,e)=>A.useMemo(()=>!e||!r?null:r.getInput(e),[r,e]),mr=(r,e)=>{const t=A.useMemo(()=>r.map(n=>d.jsx(A.Fragment,{children:n.getInput(e)},n.getId())),[r,e]);return d.jsx("div",{className:"flex flex-col gap-4",children:t})},Ri=A.memo(r=>{const{field:e,...t}=r,{label:n,description:i,fields:o}=e,{values:a,setFieldValue:s}=ye.useFormikContext(),l=G1(),u=A.useMemo(()=>{var y,C;const h=e.conditions??{},v=Object.keys(h);if(v.length===0)return[];if(a&&typeof a=="object"&&Object.prototype.hasOwnProperty.call(a,"fields")){const w={},E=((C=(y=a.fields)==null?void 0:y.filter)==null?void 0:C.call(y,I=>v.includes(I.identifier)))??[];for(const I of E)w[I.identifier]=De.deserialize(I);return Object.values(w).map(I=>[I,I.deserializeConditions(h[I.identifier]??[])])}return((l==null?void 0:l.fields)??[]).filter(w=>w instanceof De&&v.includes(w.identifier)).map(w=>[w,w.deserializeConditions(h[w.identifier]??[])])},[e.conditions,a,l]),c=A.useMemo(()=>{const h=u.map(([v,p])=>Cr.create({section:v,conditions:p}));return h.length===0?!0:h.some(v=>v.apply(v.getConditions(),a))},[u,a]);A.useEffect(()=>{if(!(a&&typeof a=="object"&&Object.prototype.hasOwnProperty.call(a,"fields"))&&!c)for(const v of o){const p=v.getId();st(a,p)!==""&&s(p,"").then()}},[c,o,s,a]);const f=mr(o,t);return c?d.jsxs(x.Card,{variant:"soft",className:"flex flex-col gap-4",children:[(n||i)&&d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"flex flex-col gap-1",children:[d.jsx(x.Heading,{size:"md",children:n}),i&&d.jsx(x.Text,{accentColor:"base",children:i})]}),d.jsx(x.Separator,{size:"full"})]}),f]}):null});Ri.displayName="FieldSectionLayout";const wr=class wr extends mn{constructor(t){const{label:n=null,fields:i,conditions:o={},...a}=t;super({...a,type:"section"});O(this,"label");O(this,"fields");O(this,"conditions");O(this,"serializeConditions",t=>t.map(n=>n.field.serializeCondition(n)));O(this,"deserializeConditions",t=>{const n={};for(const i of this.fields)n[i.identifier]=i;return t.map(i=>{const o=n[i.fieldId];if(!o)throw new Error(`FieldSection.deserializeFilters: Field "${i.fieldId}" not found`);return o.deserializeCondition(i)})});this.fields=i,this.conditions=o,this.label=n}static deserialize(t){if(t.type!=="section")throw new Error("Invalid type");if(!Array.isArray(t.fields))throw new Error(`Invalid fields: ${t.fields} (not an array)`);const n=t.fields.map(Li);return new wr({...t,fields:n})}conditional(){return Object.keys(this.conditions).length>0}serialize(){return{...super._serialize(),label:this.label,conditions:this.conditions,fields:this.fields.map(t=>t.serialize())}}getErrors(t){const n={};for(const i of this.fields){const o=i.getId(),a=i.getError(st(t,o),t);a&&Nt(n,i.getId(),a)}return n}getInput(t){return d.jsx(Ri,{field:this,...t})}};O(wr,"fieldTypeName","Section"),O(wr,"fieldTypeDescription","Sections can be useful for grouping fields together. They can also be conditionally shown or hidden.");let De=wr;const Ot=r=>Object.keys(r).length>0,hn=(r,e)=>{const t={};for(const n of r)if(n instanceof De){const i=n.conditions??{},o=r.filter(s=>s instanceof De),a=Object.keys(i).map(s=>{const l=o.find(c=>c.identifier===s);if(!l)return null;const u=l.deserializeConditions(i[s]??[]);return Cr.create({section:l,conditions:u})}).filter(Boolean);if(a.length>0&&!a.some(l=>l.apply(l.getConditions(),e)))continue;Object.assign(t,n.getErrors(e))}else{if(!(n instanceof Ee))throw new Error("Invalid field type");const i=n.getId(),o=n.getError(st(e,i),e);o&&Nt(t,i,o)}if(Ot(t))return t},vn=(r,e)=>r.reduce((t,n)=>{if(n instanceof De)return{...t,...vn(n.fields,e)};const i=n.getId(),o=t[i];switch(o){case"":Nt(t,i,void 0);break;case[]:Nt(t,i,void 0);break;default:Nt(t,i,o??void 0)}return t},Vs(e)),Cs=(r,e,t)=>r.reduce((n,i)=>{if(i instanceof De)return{...n,...Cs(i.fields,e,t)};if(i instanceof Ee){const o=i.getId(),a=e[o],s=t[o];i.isEqual(a,s)||Nt(n,o,s)}return n},{}),ms=A.memo(A.forwardRef((r,e)=>{const{schema:t,values:n={},onValuesChange:i,onSubmit:o,submitText:a="Submit",cancelText:s,onCancel:l,onDirty:u,onDirtyChange:c,hideTitle:f=!t.title,hideDescription:h,className:v,buttonProps:p,enableReinitialize:g=!1,excludeUnchangedFields:m=!1}=r,{readonly:y}=t.meta,C=A.useId(),w=A.useMemo(()=>vn(t.fields,n),[t.fields,n]),E=A.useCallback(F=>{o==null||o(m?Cs(t.fields,w,F):F)},[m,w,o,t.fields]),I=ye.useFormik({initialValues:w,onSubmit:E,validate:F=>hn(t.fields,F),validateOnBlur:!1,validateOnChange:!1,enableReinitialize:!1});A.useLayoutEffect(()=>{g&&I.resetForm({values:w})},[g,w]);const{dirty:S}=I,b=A.useMemo(()=>typeof t.title=="string"?d.jsx(x.Heading,{size:"md",children:t.title}):t.title,[t.title]),P=A.useMemo(()=>typeof t.description=="string"?d.jsx(x.Text,{accentColor:"base",children:t.description}):t.description,[t.description]),L=A.useCallback((F,V)=>{gs(t.fields)[F].isEqual(w[F],V)||i==null||i({...I.values,[F]:V},{[F]:V})},[I.values,w,i,t.fields]),M=mr(t.fields,{formId:C,disabled:y,onValuesChange:L});return A.useEffect(()=>{S&&u&&u(),c&&c(S)},[S,u,c]),d.jsx(ye.FormikProvider,{value:I,children:d.jsx(H1,{value:{fields:t.fields},children:d.jsxs("form",{id:C,ref:e,className:yt.cx(v,"flex flex-col gap-4"),onSubmit:I.handleSubmit,children:[!f&&d.jsxs(x.Card,{variant:"soft",className:"flex flex-col gap-1",children:[b,!h&&P]}),M,!y&&d.jsxs(x.ButtonGroup,{className:"flex items-center justify-end gap-2",size:"sm",children:[s&&d.jsxs(x.Button,{accentColor:"base",...p,type:"button",variant:"soft",onClick:l,children:[d.jsx(x.RiIcon,{icon:"RiCloseLine"}),s]}),d.jsxs(x.Button,{...p,type:"submit",disabled:!I.isValid,accentColor:"primary",variant:"surface",children:[d.jsx(x.RiIcon,{icon:"RiCheckLine"}),a]})]})]})})})})),ut=A.memo(r=>{const{name:e,render:t}=r,{submitForm:n}=ye.useFormikContext(),[i,o,a]=ye.useField(e),s=A.useMemo(()=>{const l=u=>{a.setValue(u,!1)};return t({value:i.value,meta:o,setValue:l,patchValue:()=>{n()}})},[t,i.value,o,n,a]);return d.jsx(d.Fragment,{children:s})});ut.displayName="PatchField";const W1=A.memo(A.forwardRef((r,e)=>{const{children:t,schema:n,values:i,onPatch:o,onError:a,requiresDiff:s=!0,onDirtyChange:l,...u}=r,c=A.useMemo(()=>vn(n.fields,i),[n.fields,i]),f=A.useCallback(C=>{const w={};for(const E in C){const I=C[E];I!==c[E]&&I!==void 0&&(w[E]=I)}return w},[c]),h=A.useCallback(C=>{const w=f(C);s&&!Ot(w)||o(w)},[f,o,s]),v=A.useCallback(C=>{const w=hn(n.fields,C);if(w&&a(w),l){const E=f(C);l(Ot(E))}return w},[n.fields,l,a,f]),p=ye.useFormik({initialValues:c,onSubmit:h,validate:v,validateOnBlur:!1,validateOnChange:!1}),g=A.useCallback(()=>{if(l){const C=f(p.values);Ot(C)&&l(!0)}},[p.values,f,l]),{errors:m,resetForm:y}=p;return A.useEffect(()=>{Ot(m)&&y({values:c,errors:{}})},[m,c,y]),d.jsx(ye.FormikProvider,{value:p,children:d.jsx("form",{...u,ref:e,onSubmit:p.handleSubmit,onChange:g,children:t})})})),pn="form-builder",X1=[["string","text"],["select","multi-select","upload","qr","radio","checkbox-list"],["boolean","date","number","multi-string"]],ws={...xr,section:De},gn=A.createContext({}),$1=(r,e)=>{var n;const t={...r};switch(e.type){case"release":for(const i in t)t[i].disabled=!1;return t;case"hold":for(const i in t)(n=t[i])!=null&&n.conditionFields.has(e.fieldId)&&(t[i].disabled=!0);return t;case"update":return e.state}},j1=(r,e)=>{const t=As(e);if(t.length===0)return;let n;for(let i=0;i<r.length;i++){const o=r[i];if(o)for(const a of o.fields)t.includes(a.identifier)&&(n=typeof n=="number"?Math.max(n,i):i)}return n},_s=r=>{var t;const e={};for(let n=0;n<r.length;n++){const i=r[n];if(!i)throw new Error("Field is undefined.");const o=n>0?(t=e[r[n-1].identifier])==null?void 0:t.conditionFields:void 0,a=new Set(o);for(const s of As(i.conditions))a.add(s);e[i.identifier]={disabled:!1,conditionFields:a,conditionIndex:j1(r,i.conditions),index:n,label:i.label}}return e};function As(r){const e=new Set;if(!r)return[];for(const t of Object.keys(r)){const n=r[t]??[];for(const i of n){const o=i==null?void 0:i.fieldId;typeof o=="string"&&e.add(o)}}return Array.from(e)}const Vi=A.memo(r=>{const{index:e,type:t,sectionIndex:n,remove:i,duplicate:o,move:a,upload:s}=r;if(t!=="section"&&!s)throw new Error("Upload function prop must be defined for non-section fields.");const{values:l}=ye.useFormikContext(),u=A.useRef(null),c=A.useMemo(()=>{const f=[{Icon:Ae.RiFileCopyLine,key:"duplicate",text:"Duplicate",buttonProps:{onClick:o}}];return f.push({Icon:Ae.RiDeleteBin7Fill,key:"delete",text:"Delete",buttonProps:{onClick:i}}),t!=="section"&&f.unshift({Icon:Ae.RiImageLine,key:"upload",text:"Upload image",buttonProps:{onClick:()=>{var h;(h=u.current)==null||h.click()}}}),(n===void 0&&e!==l.fields.length-1||n!==void 0&&(n<l.fields.length-1||e!==l.fields[n].fields.length-1))&&f.unshift({Icon:Ae.RiArrowDownLine,key:"moveDown",text:"Move down",buttonProps:{onClick:()=>{a("down")}}}),(n===void 0&&e!==0||n!==void 0&&(n!==0||e!==0))&&f.unshift({Icon:Ae.RiArrowUpLine,key:"moveUp",text:"Move up",buttonProps:{onClick:()=>{a("up")}}}),f},[o,e,a,i,n,t,l.fields]);return d.jsxs(d.Fragment,{children:[d.jsx(x.ButtonGroup,{className:"hidden flex-col gap-0.5 sm:flex",variant:"ghost",accentColor:"base",size:"sm",children:c.map(f=>d.jsx(x.IconButton,{type:"button","aria-label":f.text,...f.buttonProps,children:d.jsx(f.Icon,{})},f.key))}),d.jsx("div",{className:"sm:hidden",children:d.jsxs(x.Menu.Root,{children:[d.jsx(x.Menu.ClickTrigger,{children:d.jsx(x.IconButton,{variant:"ghost",accentColor:"base","aria-label":"Actions menu",size:"sm",type:"button",children:d.jsx(x.RiIcon,{icon:"RiMore2Line"})})}),d.jsx(x.Menu.Content,{children:c.map(f=>{var h;return d.jsxs(x.Menu.Item,{onClick:(h=f.buttonProps)==null?void 0:h.onClick,children:[d.jsx(f.Icon,{}),f.text]},f.key)})})]})}),t!=="section"&&d.jsx("input",{className:"hidden",ref:u,type:"file",accept:"image/*",onChange:s})]})});Vi.displayName="FieldActions";const ki=A.memo(r=>{const{parentPath:e,index:t}=r,n=A.useCallback(o=>{o.target.parentNode instanceof HTMLElement&&(o.target.parentNode.dataset.replicatedValue=o.target.value)},[]),i=A.useCallback(o=>{o.target.parentNode instanceof HTMLElement&&(o.target.parentNode.dataset.replicatedValue=o.target.value)},[]);return d.jsx("div",{className:"flex grow w-full flex-col gap-4",children:d.jsxs("div",{className:"flex flex-col gap-2 w-full overflow-hidden",children:[d.jsx(ut,{name:`${e}.${t}.label`,render:({setValue:o,value:a})=>d.jsx(x.Input.Root,{variant:"outline",size:"md",accentColor:"base",children:d.jsx(x.Input.Field,{placeholder:"Enter a section label (optional)",value:a,onChange:s=>o(s.target.value),onInput:n,maxLength:200})})}),d.jsx(ut,{name:`${e}.${t}.description`,render:({setValue:o,value:a})=>d.jsx(x.TextArea,{className:"field-sizing-content",placeholder:"Enter a section description (optional)",value:a,onChange:s=>o(s.target.value),onInput:i,maxLength:1e3,resize:"vertical",size:"md"})})]})})});ki.displayName="FieldSectionBuilder";const Es=A.memo(r=>{const{popoverInputs:e,hasError:t,...n}=r;return d.jsxs(x.Popover.Root,{children:[d.jsx(x.Popover.Trigger,{asChild:!0,children:d.jsxs(x.Button,{variant:"soft",type:"button",size:"sm","aria-label":"settings",accentColor:"base",...t&&{color:er.danger},children:[d.jsx(x.RiIcon,{icon:"RiSettings2Line"}),"Settings"]},"settings")}),d.jsx(x.Popover.Content,{size:"sm",...n,children:d.jsx("div",{className:"flex w-full max-w-[350px] flex-col",children:e})})]})});Es.displayName="FieldSettingsPopover";const zi=A.memo(r=>{const{parentPath:e,index:t,field:n}=r,{setFieldValue:i,errors:o}=ye.useFormikContext(),a=Nr(),{disableRequiredFields:s}=A.use(gn),[l,u]=A.useState(void 0);A.useEffect(()=>{n.image instanceof Promise?n.image.then(u).catch(console.error):u(n.image)},[n]);const c=l?URL.createObjectURL(l):void 0,f=A.useRef(null),h=A.useCallback(()=>{var U;(U=f.current)==null||U.click()},[]),v=A.useCallback(U=>{var G;const R=(G=U.target.files)==null?void 0:G[0];R&&(i(`${e}.${t}.image`,R).then(),U.currentTarget.value="")},[i,e,t]),p=A.useCallback(U=>{U.stopPropagation();const{image:R,...G}=n;i(`${e}.${t}`,G).then()},[t,n,e,i]),g=A.useCallback(U=>{U.target.parentNode instanceof HTMLElement&&(U.target.parentNode.dataset.replicatedValue=U.target.value)},[]),m=A.useCallback(U=>{U.target.parentNode instanceof HTMLElement&&(U.target.parentNode.dataset.replicatedValue=U.target.value)},[]),y=n.type,C=ws[y],[w,E]=A.useMemo(()=>{const U=[],R=[];if(!(C.prototype instanceof Ee))throw new Error(`Field must be an instance of BaseField. Got ${C.toString()}.`);const G=C.getFieldCreationSchema(`${e}.${t}`);for(const W of G)W.showDirectly?U.push(W.field):R.push(W.field);return[U,R]},[C,e,t]),I=mr(w,{formId:pn,disabled:!1}),S=mr(E,{formId:pn,disabled:!1}),b=E.length>0,P=E.some(U=>{const R=st(o,C===De?`${e}.${t}.condition`:U.getId());return R&&(typeof R!="object"||Ot(R))}),L=A.useMemo(()=>fn(n),[n]),M=ys(L,{formId:pn,showInputOnly:!1}),F=A.useCallback(()=>{l&&a(()=>({file:l}))},[a,l]),{Icon:V,fieldTypeName:z}=xr[y];return d.jsxs("div",{className:"flex grow w-full flex-col gap-4",children:[C!==De&&d.jsxs("div",{className:"flex gap-2 w-full justify-between",children:[d.jsxs("div",{className:"flex gap-2 items-center",children:[d.jsxs(x.Badge,{accentColor:"base",variant:"soft",size:"sm",children:[d.jsx(V,{}),z]}),!s&&d.jsx(ut,{name:`${e}.${t}.required`,render:({setValue:U,value:R})=>d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx(x.Checkbox.Root,{checked:R,onCheckedChange:U,size:"sm",children:d.jsx(x.Checkbox.Indicator,{children:d.jsx(x.RiIcon,{icon:"RiCheckLine"})})}),d.jsx(x.Text,{size:"sm",accentColor:"base",children:"Required"})]})})]}),b&&d.jsx(Es,{popoverInputs:S,hasError:P,align:"end"})]}),l&&d.jsxs("div",{className:"group relative inline-block w-full min-w-[300px]",children:[d.jsx("img",{className:"h-[100px] w-full min-w-[300px] cursor-pointer rounded-md object-cover",src:c,alt:l.name,onClick:F}),d.jsx(x.IconButton,{className:"absolute top-2 right-2 hidden group-hover:not-disabled:flex",variant:"solid",accentColor:"base","aria-label":"delete",onClick:p,size:"sm",children:d.jsx(x.RiIcon,{icon:"RiDeleteBin7Fill"})})]}),!l&&d.jsxs("div",{children:[d.jsxs(x.Button,{type:"button",variant:"soft",size:"sm",accentColor:"base",onClick:h,children:[d.jsx(x.RiIcon,{icon:"RiImageAddLine"})," Add image"]}),d.jsx("input",{ref:f,type:"file",accept:"image/*",className:"hidden",onChange:v})]}),d.jsxs("div",{className:"flex flex-col gap-2 w-full overflow-hidden",children:[d.jsx(ut,{name:`${e}.${t}.label`,render:({setValue:U,value:R})=>d.jsx(x.Input.Root,{variant:"outline",size:"md",accentColor:"base",children:d.jsx(x.Input.Field,{placeholder:"Enter your question",value:R,onChange:G=>U(G.target.value),onInput:g,maxLength:200})})}),d.jsx(ut,{name:`${e}.${t}.description`,render:({setValue:U,value:R})=>d.jsx(x.TextArea,{className:"field-sizing-content",placeholder:"Enter a field description (optional)",value:R,onChange:G=>U(G.target.value),onInput:m,maxLength:1e3,resize:"vertical",size:"md"})})]}),w.length>0&&d.jsx("div",{className:"w-full",children:I}),d.jsx(x.Separator,{size:"full"}),d.jsxs("div",{className:"flex gap-2 items-center",children:[d.jsxs(x.HoverCard.Root,{children:[d.jsx(x.HoverCard.Trigger,{asChild:!0,children:d.jsx(x.Badge,{icon:!0,size:"sm",variant:"soft",accentColor:"base",children:d.jsx(x.RiIcon,{icon:"RiEyeLine"})})}),d.jsx(x.HoverCard.Content,{className:"w-[225px]",size:"sm",align:"start",children:d.jsx(x.Text,{size:"sm",accentColor:"base",children:"This is a preview of the field as it will be rendered in the form."})})]}),d.jsx("div",{className:"grow h-max min-w-0",children:M})]})]})});zi.displayName="FieldBuilder";const Is=A.memo(r=>{const{field:e,index:t,sectionIndex:n,remove:i}=r,{setFieldValue:o,values:a}=ye.useFormikContext(),{reorderField:s}=Or(),{showInfo:l,showError:u}=x.useToast(),c=`fields.${n}.fields`,f=A.useMemo(()=>({index:t,parentPath:c,field:e}),[e,t,c]),h=A.useCallback(()=>{const g=e.label||"Unlabelled field",m={...e,label:g};Pt(c,t+1,m,a,o),l({title:"Field duplicated",description:`The field "${g}" has been duplicated`})},[e,c,t,a,o,l]),v=A.useCallback(g=>{const m=n,y=a.fields[m];let C=n,w=g==="up"?t-1:t+1;g==="up"&&t===0?(C=n-1,w=a.fields[C].fields.length):g==="down"&&t===y.fields.length-1&&(C=n+1,w=0);const E=a.fields[C];s(y,m,t,E,C,w,o)},[n,a.fields,t,s,o]),p=A.useCallback(g=>{const{files:m}=g.target;if(!m||m.length!==1)return;const y=m.item(0);if(y){if(y.size>vs){u({title:"File upload error",description:`The file ${y.name} exceeded the maximum file size`});return}o(`${c}.${t}`,{...e,image:y})}},[e,t,c,o,u]);return d.jsxs(x.Card,{className:"flex items-center justify-between gap-4 w-full",children:[d.jsx(zi,{...f}),d.jsx(Vi,{index:t,type:e.type,sectionIndex:n,remove:i,duplicate:h,move:v,upload:p})]})});Is.displayName="FieldWithActions";const Ss=(r=()=>null)=>A.useMemo(()=>X1.map(e=>e.map(t=>{const n=xr[t],i=n.Icon;return{children:n.fieldTypeName,icon:d.jsx(i,{}),value:t,onSelect:()=>{r(t)}}})),[r]),bs=A.memo(r=>{var E;const{fieldSection:e,index:t,dropState:n}=r,i=(E=n[e.identifier])==null?void 0:E.disabled,{setFieldValue:o,values:a}=ye.useFormikContext(),s=x.useAlertDialog(),{reorderSection:l}=Or(),{showInfo:u}=x.useToast(),{fieldsOnly:c}=A.use(gn),f=A.useCallback((I,S,b)=>{for(const P of I){const L=S.indexOf(P),M={};for(const F of Object.keys(P.conditions??{})){const V=P.conditions[F]??[];M[F]=V.filter(z=>(z==null?void 0:z.fieldId)!==b)}o(`fields.${L}.conditions`,M).then()}},[o]),h=A.useCallback(I=>{const S=e.fields[I];if(!S)throw new Error("Could not find field to remove.");const b=[];for(const P of a.fields){const L=P.conditions??{};let M=!1;for(const F of Object.keys(L))if((L[F]??[]).some(z=>(z==null?void 0:z.fieldId)===S.identifier)){M=!0;break}M&&b.push(P)}return{removing:S,affectedSections:b,action:()=>o(`fields.${t}.fields`,Mt(e.fields,I))}},[e.fields,a.fields,o,t]),v=A.useCallback(I=>{const{affectedSections:S,action:b,removing:P}=h(I),L=()=>{b().then(),f(S,a.fields,P.identifier)};if(S.length>0){const M=S.map(F=>F.label).join(", ");s({title:"Remove condition?",description:`${P.label} is being used as a condition, deleting it will remove the condition from the ${M} section(s).`,action:"Remove",onAction:L});return}L()},[h,f,a.fields,s]),p=A.useCallback(()=>{const S=e.fields.map((z,U)=>h(U)).flatMap(z=>z.affectedSections),b=S.length?"Remove fields and conditions?":"Remove fields?",P=e.fields.length,L=S.map(z=>z.label).join(", "),M=S.length?`Deleting this section will remove the ${P} field(s) it contains and will remove the conditions from following sections: ${L}`:`Deleting this section will remove the ${P} field(s) it contains.`,F=Mt(a.fields,t),V=()=>o("fields",F);if(S.length>0){s({title:b,description:M,action:"Remove",onAction:()=>{V().then(()=>{f(S,F)})}});return}V().then()},[e.fields,a.fields,t,h,o,s,f]),g=A.useCallback(I=>{const S=I==="up"?t-1:t+1;l(n,e.identifier,t,S,a,o)},[t,l,n,e.identifier,a,o]),m=A.useMemo(()=>({index:t,parentPath:"fields",section:e,conditionalSourceFields:tl(a.fields,t)}),[e,t,a.fields]),y=A.useCallback(()=>{const I=e.label||"Untitled section",S=e.fields.map(P=>({...P,identifier:Tr()})),b={...e,label:I,fields:S};Pt("fields",t+1,b,a,o),u({title:"Section duplicated",description:`The section "${I}" has been duplicated.`})},[e,t,a,o,u]),C=A.useCallback(I=>{Pt(`fields.${t}.fields`,e.fields.length,Bi[I],a,o)},[t,e.fields.length,a,o]),w=Ss(C);return d.jsx(Ct.Draggable,{draggableId:e.identifier,index:t,children:I=>d.jsxs(x.Card,{ref:I.innerRef,...I.draggableProps,...I.dragHandleProps,variant:"outline",className:"flex items-center justify-between gap-4 w-full",children:[d.jsxs("div",{className:"flex grow flex-col gap-4 w-full",children:[!c&&d.jsx(ki,{...m}),d.jsx(Ct.Droppable,{droppableId:e.identifier,type:"SECTION",isDropDisabled:i,children:S=>d.jsxs("div",{className:"flex flex-col gap-4 w-full",ref:S.innerRef,...S.droppableProps,children:[e.fields.map((b,P)=>d.jsx(Is,{field:b,index:P,sectionIndex:t,remove:()=>{v(P)}},b.identifier)),S.placeholder,d.jsxs(x.Menu.Root,{children:[d.jsx(x.Menu.ClickTrigger,{children:d.jsxs(x.Button,{type:"button",variant:"soft",size:"sm",children:[d.jsx(x.RiIcon,{icon:"RiAddLine"})," Add field"]})}),d.jsx(x.Menu.Content,{children:d.jsx(x.Menu.Scroll,{children:w.flat().map(b=>d.jsxs(x.Menu.Item,{onSelect:b.onSelect,children:[b.icon,b.children]},b.value))})})]})]})})]}),!c&&d.jsx(Vi,{index:t,type:e.type,remove:p,duplicate:y,move:g})]})})});bs.displayName="FieldSectionWithActions";const Ts=(r,e)=>{for(const[t,n]of Object.entries(r))if(n.identifier===e)return[n,t]},Os=A.memo(()=>{const{values:r,setFieldValue:e}=ye.useFormikContext(),[t,n]=A.useReducer($1,r.fields,_s),{reorderSection:i,reorderField:o}=Or(),{fieldsOnly:a}=A.use(gn);A.useEffect(()=>{n({type:"update",state:_s(r.fields)})},[n,r.fields]);const s=A.useCallback(c=>{c.type==="SECTION"&&n({type:"hold",fieldId:c.draggableId})},[]),l=A.useCallback(c=>{const{source:f,destination:h,type:v,reason:p,draggableId:g}=c;if(n({type:"release"}),!h||p==="CANCEL")return;if(v==="ROOT"){i(t,g,f.index,h.index,r,e);return}if(v!=="SECTION")throw new Error("Unexpected droppable type.");const[m,y]=Ts(r.fields,f.droppableId)??[],[C,w]=Ts(r.fields,h.droppableId)??[];o(m,y,f.index,C,w,h.index,e)},[r,o,e,i,t]),u=A.useCallback(c=>{to(c+1,r,e)},[r,e]);return d.jsx(Ct.DragDropContext,{onDragStart:s,onDragEnd:l,children:d.jsx(Ct.Droppable,{droppableId:"droppable",type:"ROOT",children:c=>d.jsxs("div",{className:"flex flex-col gap-4",ref:c.innerRef,...c.droppableProps,children:[r.fields.map((f,h)=>d.jsxs(A.Fragment,{children:[d.jsx(bs,{fieldSection:f,index:h,dropState:t,fieldsOnly:a}),!a&&h!==r.fields.length-1&&d.jsxs(x.Button,{type:"button",variant:"soft",size:"sm",accentColor:"base",onClick:()=>{u(h)},children:[d.jsx(x.RiIcon,{icon:"RiAddLine"})," Add section"]})]},f.identifier)),d.jsxs(x.Button,{className:"mb-4",type:"button",variant:"soft",accentColor:"base",size:"sm",onClick:()=>{u(r.fields.length)},children:[d.jsx(x.RiIcon,{icon:"RiAddLine"})," Add section"]}),c.placeholder]})})})});Os.displayName="FieldsEditor";const q1=r=>{const{section:e,conditions:t,onConditionsChange:n}=r,[i]=A.useState(()=>Cr.create({section:e,conditions:t}));return i.setOnConditionChange(n),i.setConditions(t),i.setSection(e),i},Ns=A.memo(r=>{const{children:e,variant:t,size:n,accentColor:i,conditionManager:o,fieldSection:a,...s}=r,l=A.useCallback(u=>{o.addCondition(u.createCondition())},[o]);return d.jsxs(x.Menu.Root,{...s,children:[d.jsx(x.Menu.ClickTrigger,{children:e}),d.jsx(x.Menu.Content,{variant:t,size:n,accentColor:i,children:a.fields.map(u=>d.jsxs(x.Menu.Item,{onSelect:()=>l(u),children:[d.jsx(x.RiIcon,{icon:ze[u.type]}),u.label]},u.identifier))})]})});Ns.displayName="IssueDataFilterMenu";const Ds=A.memo(r=>{const{id:e,source:t,target:n,sourceX:i,sourceY:o,targetX:a,targetY:s,style:l,markerEnd:u}=r,{values:c,setFieldValue:f}=ye.useFormikContext(),h=A.useMemo(()=>c.fields.find(I=>I.identifier===t),[c.fields,t]),v=A.useMemo(()=>c.fields.findIndex(I=>I.identifier===n),[c.fields,n]),p=v>=0?c.fields[v]:void 0,g=A.useMemo(()=>h?De.deserialize(h):void 0,[h]),m=A.useMemo(()=>{var I;return!p||!t?[]:((I=p.conditions)==null?void 0:I[t])??[]},[p,t]),y=q1({section:g??new De({label:null,fields:[],conditions:{},identifier:"__missing__",description:null}),conditions:g?g.deserializeConditions(m):[],onConditionsChange:I=>{v<0||!g||f(`fields.${v}.conditions.${g.identifier}`,g.serializeConditions(I)).then()}}),[C,w,E]=Te.getBezierPath({sourceX:i,sourceY:o,targetX:a,targetY:s});return d.jsxs(d.Fragment,{children:[d.jsx(Te.BaseEdge,{id:e,path:C,style:l,markerEnd:u}),d.jsx(Te.EdgeLabelRenderer,{children:d.jsx("div",{className:yt.cx("absolute nodrag nopan pointer-events-auto"),style:{transform:`translate(-50%, -50%) translate(${w}px, ${E}px)`},"data-floating-content":!0,onMouseDown:I=>I.stopPropagation(),onClick:I=>I.stopPropagation(),children:g&&d.jsxs(x.Card,{variant:"surface",className:"inline-flex min-w-[280px] max-w-[520px] flex-col gap-2 p-2 shadow-sm",children:[d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx(x.Text,{size:"xs",className:"truncate max-w-[280px]",children:g.label||"Untitled section"}),d.jsxs("div",{className:"ml-auto flex items-center gap-1",children:[d.jsx(Ns,{fieldSection:g,conditionManager:y,children:d.jsx(x.IconButton,{"aria-label":"Add condition",type:"button",variant:"surface",size:"xs",accentColor:"base",children:d.jsx(x.RiIcon,{icon:"RiAddLine"})})}),v>=0&&d.jsxs(x.Tooltip.Root,{children:[d.jsx(x.Tooltip.Trigger,{asChild:!0,children:d.jsx(x.IconButton,{"aria-label":"Remove conditional logic",type:"button",variant:"surface",size:"xs",accentColor:"base",color:"danger",onClick:()=>{const I=c.fields[v];if(!I||!g)return;const S={...I.conditions??{}};delete S[g.identifier],f(`fields.${v}.conditions`,S).then()},children:d.jsx(x.RiIcon,{icon:"RiDeleteBin7Fill"})})}),d.jsx(x.Tooltip.Content,{size:"sm",children:"Remove conditional logic"})]})]})]}),y.getConditions().length>0&&d.jsx("div",{className:"flex h-max w-full flex-wrap gap-1",children:y.getConditions().map(I=>I.render(y))})]})})})]})});Ds.displayName="FieldSectionConditionEdgeComponent";const Ms=A.memo(r=>{const{sectionId:e}=r,{values:t,setFieldValue:n}=ye.useFormikContext(),i=x.useAlertDialog(),{reorderField:o}=Or(),{showInfo:a}=x.useToast(),s=Te.useUpdateNodeInternals(),l=A.useRef(null),u=A.useMemo(()=>t.fields.findIndex(y=>y.identifier===e),[t.fields,e]),c=t.fields[u];A.useEffect(()=>{const y=requestAnimationFrame(()=>s(e));return()=>cancelAnimationFrame(y)},[s,e,c]),A.useEffect(()=>{const y=l.current;if(!y)return;let C;const w=new ResizeObserver(()=>{C&&window.clearTimeout(C),C=window.setTimeout(()=>s(e),60)});return w.observe(y),()=>{C&&window.clearTimeout(C),w.disconnect()}},[s,e]);const f=A.useCallback(y=>{u<0||Pt(`fields.${u}.fields`,(c==null?void 0:c.fields.length)??0,Bi[y],t,n)},[u,c==null?void 0:c.fields.length,t,n]),h=Ss(f),v=A.useCallback(y=>{if(!c)throw new Error("Could not find section.");const C=c.fields[y];if(!C)throw new Error("Could not find field to remove.");const w=[];for(const E of t.fields){const I=E.conditions??{};let S=!1;for(const b of Object.keys(I))if((I[b]??[]).some(L=>(L==null?void 0:L.fieldId)===C.identifier)){S=!0;break}S&&w.push(E)}return{removing:C,affectedSections:w,action:()=>n(`fields.${u}.fields`,Mt(c.fields,y))}},[c,u,n,t.fields]),p=A.useCallback(y=>{const{affectedSections:C,action:w,removing:E}=v(y),I=()=>{w().then();for(const S of C){const b=t.fields.indexOf(S),P={};for(const L of Object.keys(S.conditions??{})){const M=S.conditions[L]??[];P[L]=M.filter(F=>(F==null?void 0:F.fieldId)!==E.identifier)}n(`fields.${b}.conditions`,P).then()}};if(C.length>0){const S=C.map(b=>b.label).join(", ");i({title:"Remove condition?",description:`${E.label} is being used as a condition, deleting it will remove the condition from the ${S} section(s).`,action:"Remove",onAction:I});return}I()},[i,v,n,t.fields]),g=A.useCallback(y=>{if(!c)return;const C=c.fields[y];if(!C)return;const w=C.label||"Unlabelled field",E={...C,label:w};Pt(`fields.${u}.fields`,y+1,E,t,n),a({title:"Field duplicated",description:`The field "${w}" has been duplicated`})},[c,u,t,n,a]),m=A.useCallback((y,C)=>{if(!c)return;const w=u,E=c;let I=u,S=C==="up"?y-1:y+1;C==="up"&&y===0?(I=u-1,S=t.fields[I].fields.length):C==="down"&&y===E.fields.length-1&&(I=u+1,S=0);const b=t.fields[I];o(E,w,y,b,I,S,n)},[o,c,u,n,t.fields]);return c?d.jsxs("div",{ref:l,className:"flex flex-col gap-3",children:[d.jsx(ki,{index:u,parentPath:"fields",section:c}),d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsx(x.Text,{weight:"bold",children:"Fields"}),d.jsxs(x.Menu.Root,{children:[d.jsx(x.Menu.ClickTrigger,{children:d.jsxs(x.Button,{type:"button",variant:"soft",size:"sm",accentColor:"base",children:[d.jsx(x.RiIcon,{icon:"RiAddLine"})," Add field"]})}),d.jsx(x.Menu.Content,{children:d.jsx(x.Menu.Scroll,{children:h.flat().map(y=>d.jsxs(x.Menu.Item,{onSelect:y.onSelect,children:[y.icon,y.children]},y.value))})})]})]}),d.jsx("div",{className:"flex flex-col gap-3",children:c.fields.map((y,C)=>d.jsx(A.Fragment,{children:d.jsxs("div",{className:"flex items-start justify-between gap-2",children:[d.jsx("div",{className:"grow min-w-0",children:d.jsx(zi,{index:C,parentPath:`fields.${u}.fields`,field:y})}),d.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[d.jsx(x.Button,{variant:"ghost",size:"xs",accentColor:"base","aria-label":"Move up",onClick:()=>m(C,"up"),children:d.jsx(x.RiIcon,{icon:"RiArrowUpLine"})}),d.jsx(x.Button,{variant:"ghost",size:"xs",accentColor:"base","aria-label":"Move down",onClick:()=>m(C,"down"),children:d.jsx(x.RiIcon,{icon:"RiArrowDownLine"})}),d.jsx(x.Button,{variant:"ghost",size:"xs",accentColor:"base","aria-label":"Duplicate",onClick:()=>g(C),children:d.jsx(x.RiIcon,{icon:"RiFileCopyLine"})}),d.jsx(x.Button,{variant:"ghost",size:"xs",accentColor:"base",color:"danger","aria-label":"Delete",onClick:()=>p(C),children:d.jsx(x.RiIcon,{icon:"RiDeleteBin7Fill"})})]})]})},y.identifier))})]}):d.jsx("div",{className:"h-full w-full flex items-center justify-center p-2",children:d.jsx(x.Text,{accentColor:"base",children:"Select a section"})})});Ms.displayName="NodeSectionEditor";const Ps=A.memo(r=>{const{id:e,data:t,selected:n}=r;return d.jsxs(x.Card,{variant:"surface",className:"min-w-[320px] cursor-pointer relative","data-selected":n?"true":void 0,children:[d.jsx(Te.Handle,{type:"target",position:Te.Position.Left}),d.jsx("div",{className:"pr-8",children:d.jsx(Ms,{sectionId:e})}),d.jsx(Te.NodeToolbar,{isVisible:!0,position:Te.Position.Right,align:"start",offset:8,onMouseDown:i=>i.stopPropagation(),children:d.jsx(Y1,{onAdd:t==null?void 0:t.onAddBranch,onDelete:t==null?void 0:t.onDeleteSection})}),d.jsx(Te.Handle,{type:"source",position:Te.Position.Right})]})});Ps.displayName="CustomNode";const Y1=r=>{const{onAdd:e,onDelete:t}=r;return d.jsxs(x.Card,{variant:"surface",className:"flex items-center gap-1 p-1",onClick:n=>n.stopPropagation(),children:[d.jsxs(x.Tooltip.Root,{children:[d.jsx(x.Tooltip.Trigger,{asChild:!0,children:d.jsx(x.IconButton,{"aria-label":"Add branch",type:"button",variant:"surface",size:"xs",accentColor:"base",onClick:e,children:d.jsx(x.RiIcon,{icon:"RiGitBranchLine"})})}),d.jsx(x.Tooltip.Content,{size:"sm",children:"Add branch"})]}),d.jsx(x.IconButton,{"aria-label":"Delete section",type:"button",variant:"surface",size:"xs",accentColor:"base",color:"danger",onClick:t,children:d.jsx(x.RiIcon,{icon:"RiDeleteBin7Fill"})})]})},Fs=A.memo(()=>{const{values:r,setFieldValue:e}=ye.useFormikContext(),{showError:t}=x.useToast(),n=x.useAlertDialog(),i=r.fields,o=A.useMemo(()=>i.map(M=>({id:M.identifier,position:{x:0,y:0},data:{},type:"sectionNode"})),[i]),[a,s,l]=Te.useNodesState(o),[u,c]=A.useState(0);A.useEffect(()=>{let M=!1;const F=a.map(V=>{if(!i.find(R=>R.identifier===V.id))return V;const U={...V.data};return JSON.stringify(V.data)!==JSON.stringify(U)?(M=!0,{...V,data:U}):V});M&&s(F)},[i]),A.useEffect(()=>{s(M=>{const F=new Set(i.map(R=>R.identifier)),V=M.filter(R=>F.has(R.id)),z=new Set(V.map(R=>R.id)),U=[];return i.forEach(R=>{z.has(R.identifier)||U.push({id:R.identifier,position:{x:0,y:0},data:{},type:"sectionNode"})}),V.concat(U)})},[i,s]);const f=A.useRef(null),h=A.useCallback(M=>{l(M),Array.isArray(M)&&M.some(F=>(F==null?void 0:F.type)==="dimensions")&&(f.current&&window.clearTimeout(f.current),f.current=window.setTimeout(()=>{c(F=>F+1)},80))},[l]);A.useEffect(()=>()=>{f.current&&window.clearTimeout(f.current)},[]);const v=A.useCallback(M=>{const F=i.findIndex(G=>G.identifier===M);if(F<0)return;const V=i[F],z=[];for(let G=F+1;G<i.length;G++){const W=i[G],Le=!!(W.conditions??{})[V.identifier];(Bs(W).some(ce=>V.fields.some(at=>at.identifier===ce))||Le)&&z.push(G)}const R=(z.length>0?Math.max(...z):F)+1;rl(R,r,e),e(`fields.${R}.conditions.${M}`,[]).then()},[i,e,t,r]),p=A.useCallback(M=>{const F=i.findIndex(z=>z.identifier===M);if(F<0)return;(async()=>{const z=F+1;await to(z,r,e)})()},[i,e,r]),g=A.useCallback(M=>{const F=i.findIndex(W=>W.identifier===M);if(F<0)return;const V=i[F],z=new Set(V.fields.map(W=>W.identifier)),U=[],R=[];i.forEach(W=>{Bs(W).some(Le=>z.has(Le))&&(U.push(W.identifier),R.push(W.label??""))});const G=()=>{const W=Mt(i,F).map(oe=>{const Le={};for(const ot of Object.keys(oe.conditions??{})){const _r=oe.conditions[ot]??[];Le[ot]=_r.filter(ce=>!z.has(ce==null?void 0:ce.fieldId))}return{...oe,conditions:Le}});e("fields",W).then()};if(U.length>0){const W=R.filter(Boolean).join(", ");n({title:"Remove section and conditions?",description:W.length>0?`Deleting this section will remove its fields and clear conditions from: ${W}`:"Deleting this section will remove its fields and clear conditions in following sections.",action:"Remove",onAction:G});return}G()},[i,n,e]),m=A.useRef(p),y=A.useRef(g),C=A.useRef(v);A.useEffect(()=>{m.current=p,y.current=g,C.current=v},[v,p,g]),A.useEffect(()=>{s(M=>{let F=!1;const V=M.map(z=>{const U=z.data||{};return!U.onAddBranch||!U.onDeleteSection?(F=!0,{...z,data:{...U,onAddBranch:()=>{var R;return(R=C.current)==null?void 0:R.call(C,z.id)},onDeleteSection:()=>{var R;return(R=y.current)==null?void 0:R.call(y,z.id)}}}):z});return F?V:M})},[a,s]),A.useEffect(()=>{s(F=>{const V=[];for(const G of F){let W=V.find(oe=>Math.abs(oe.y-G.position.y)<=60);W||(W={y:G.position.y,ids:[]},V.push(W)),W.ids.push(G.id),W.y=(W.y*(W.ids.length-1)+G.position.y)/W.ids.length}const z=new Set;for(const G of V){let W=-1/0,oe=null;for(const Le of F)G.ids.includes(Le.id)&&Le.position.x>W&&(W=Le.position.x,oe=Le.id);oe&&z.add(oe)}let U=!1;const R=F.map(G=>{const W=G.data||{},oe=z.has(G.id);return W.isPathEnd!==oe?(U=!0,{...G,data:{...W,isPathEnd:oe}}):G});return U?R:F})},[a]);const w=A.useCallback(M=>{const F=i[M],V=(F==null?void 0:F.conditions)??{},z=Object.values(V).reduce((U,R)=>U+((R==null?void 0:R.length)??0),0);return z>0?`${z} cond`:"No conditions"},[i]),E=A.useMemo(()=>{const M=[];for(let F=1;F<i.length;F++){const V=i[F],z=i[F-1];let U=[];const R=V.conditions??{},G=Object.keys(R);G.length>0&&(U=G.map(W=>({id:W,position:{x:0,y:0},data:{},type:"sectionNode"})).filter(Boolean)),U.length===0&&(U=[{id:z.identifier,position:{x:0,y:0},data:{},type:"sectionNode"}]);for(const W of U){const oe=`${W.id}-${V.identifier}`;M.push({id:oe,source:W.id,target:V.identifier,animated:Object.keys(V.conditions??{}).length>0,markerEnd:{type:Te.MarkerType.ArrowClosed},style:{strokeWidth:2,stroke:"var(--base-a8)"},type:"fieldSectionCondition"})}}return M},[i,w]),I=A.useCallback(M=>{const F=M.source,V=M.target;if(!F||!V)return;const z=i.findIndex(W=>W.identifier===F),U=i.findIndex(W=>W.identifier===V);if(z<0||U<0)return;const R=a.find(W=>W.id===F),G=a.find(W=>W.id===V);if(R&&G&&R.position.x>=G.position.x){t({title:"Invalid connection",description:"Connections must go left → right."});return}if(U<=z){const W=br(i,U,z);e("fields",W).then(()=>{e(`fields.${z}.conditions.${F}`,[]).then()});return}e(`fields.${U}.conditions.${F}`,[]).then()},[i,a,e,t,r.fields]),S=A.useMemo(()=>({sectionNode:Ps}),[]),b=A.useMemo(()=>({fieldSectionCondition:Ds}),[]),P=A.useRef(null),L=A.useRef(!1);return A.useEffect(()=>{const V=R=>R.length>0&&R.every(G=>{var W,oe;return typeof((W=G==null?void 0:G.measured)==null?void 0:W.width)=="number"&&G.measured.width>0&&typeof((oe=G==null?void 0:G.measured)==null?void 0:oe.height)=="number"&&G.measured.height>0}),z=(R=0)=>{var ot,_r;const G=((_r=(ot=P.current)==null?void 0:ot.getNodes)==null?void 0:_r.call(ot))??[];if(!V(G)&&R<10){requestAnimationFrame(()=>z(R+1));return}const W={},oe=8,Le=12;G.forEach(ce=>{var yn,Me;const at=typeof((yn=ce==null?void 0:ce.measured)==null?void 0:yn.width)=="number"&&ce.measured.width>0?ce.measured.width:320,xn=typeof((Me=ce==null?void 0:ce.measured)==null?void 0:Me.height)=="number"&&ce.measured.height>0?ce.measured.height:220;W[ce.id]={width:at+oe,height:xn+Le}}),s(ce=>{const at=new $i.graphlib.Graph;at.setGraph({rankdir:"LR",nodesep:300,ranksep:600,edgesep:40,marginx:40,marginy:40}),at.setDefaultEdgeLabel(()=>({})),ce.forEach(Me=>{const Ar=W[Me.id]??{width:320,height:220};at.setNode(Me.id,{width:Ar.width,height:Ar.height})}),E.forEach(Me=>at.setEdge(Me.source,Me.target)),$i.layout(at);let xn=!1;const yn=ce.map(Me=>{const Ar=W[Me.id]??{width:320,height:220},Ui=at.node(Me.id);if(!Ui)return Me;const Ls=Ui.x-Ar.width/2,Rs=Ui.y-Ar.height/2;return Me.position.x!==Ls||Me.position.y!==Rs?(xn=!0,{...Me,position:{x:Ls,y:Rs}}):Me});return xn?yn:ce}),requestAnimationFrame(()=>{var ce;L.current||((ce=P.current)==null||ce.fitView({padding:.2,includeHiddenNodes:!0,duration:200}),L.current=!0)})},U=requestAnimationFrame(()=>z(0));return()=>cancelAnimationFrame(U)},[i,E,u]),d.jsx("div",{className:"relative w-full min-h-[90dvh]",children:d.jsx(x.Card,{className:"absolute inset-0 p-0 overflow-hidden",variant:"surface",children:d.jsxs(Te.ReactFlow,{nodes:a,edges:E,nodeTypes:S,edgeTypes:b,onInit:M=>{P.current=M},onNodesChange:h,onConnect:I,onEdgeClick:()=>{},defaultViewport:{x:0,y:0,zoom:1.25},children:[d.jsx(Te.Background,{color:"var(--base-a6)"}),d.jsx(Te.MiniMap,{pannable:!0,zoomable:!0,nodeColor:"var(--base-a5)",nodeStrokeColor:"var(--base-a8)",maskColor:"var(--base-a3)"}),d.jsx(Te.Controls,{})]})})})});Fs.displayName="FlowEditor";function Bs(r){const e=new Set,t=r.conditions??{};for(const n of Object.keys(t)){const i=t[n]??[];for(const o of i){const a=o==null?void 0:o.fieldId;typeof a=="string"&&e.add(a)}}return Array.from(e)}const Z1=A.memo(A.forwardRef((r,e)=>{const{onCancel:t,onSave:n,initialTitle:i,initialDescription:o,initialFields:a,showExplainerText:s=!0,showFormTitle:l=!0,fieldsOnly:u=!1,showTabs:c=!0,disableRequiredFields:f=!1,enableReinitialize:h=!1,tabsListClassName:v}=r,{showError:p}=x.useToast(),g=A.useCallback(E=>{const I={};E.title||(I.title="Title is required."),(!E.fields||E.fields.length===0)&&(I.fields="At least one field is required.");let S=[];for(const[P,L]of E.fields.entries())for(const[M,F]of L.fields.entries()){const z=ws[F.type].getFieldCreationSchema(`fields.${P}.fields.${M}`).map(U=>U.field);S=[...S,...z]}const b=hn(S,E);if(b&&(I.fields=b.fields),Ot(I))return p({title:"Some form settings are invalid",description:"Please check settings highlighted in red."}),I},[p]),m=A.useMemo(()=>({title:i??"",description:o??"",fields:a?el(a):[{...tr(Tr()),label:""}]}),[o,a,i]),y=ye.useFormik({initialValues:m,validate:g,onSubmit:n,validateOnChange:!1,validateOnBlur:!1,enableReinitialize:h}),C=A.useMemo(()=>({title:y.values.title,description:y.values.description,fields:ps(y.values.fields),meta:{readonly:!1}}),[y.values]),w=A.useMemo(()=>({disableRequiredFields:f,fieldsOnly:u}),[f,u]);return d.jsx(gn,{value:w,children:d.jsx(x.SegmentedTabs.Root,{ref:e,defaultValue:"edit",children:d.jsxs("div",{className:"flex flex-col gap-4",children:[c&&d.jsxs(x.SegmentedTabs.List,{className:yt.cx("sticky top-0 z-[2000] flex bg-(--color-background)",v),accentColor:"base",size:"sm",children:[d.jsxs(x.SegmentedTabs.Trigger,{className:"grow",value:"edit",children:[d.jsx(x.RiIcon,{icon:"RiPencilLine"}),"Edit"]}),!u&&d.jsxs(x.SegmentedTabs.Trigger,{className:"grow",value:"flow",children:[d.jsx(x.RiIcon,{icon:"RiGitMergeLine"}),"Flow"]}),d.jsxs(x.SegmentedTabs.Trigger,{className:"grow",value:"preview",children:[d.jsx(x.RiIcon,{icon:"RiEyeLine"}),"Preview"]})]}),d.jsxs(ye.FormikProvider,{value:y,children:[d.jsxs(x.SegmentedTabs.Content,{value:"edit",className:"flex flex-col gap-4",children:[s&&d.jsx(x.Text,{accentColor:"base",size:"sm",children:"Create your form using various field types. Sections can be conditionally rendered based on answers to fields in preceding sections."}),d.jsxs("form",{className:"flex flex-col gap-4",id:pn,onSubmit:y.handleSubmit,children:[l&&d.jsxs(d.Fragment,{children:[d.jsx(ut,{name:"title",render:({setValue:E,value:I,meta:S})=>d.jsx(bn,{severity:"danger",helpText:S.error??null,children:d.jsx(x.Input.Root,{variant:"outline",size:"md",accentColor:S.error?er.danger:"primary",children:d.jsx(x.Input.Field,{placeholder:"Enter a title",value:I,onChange:b=>{E(b.target.value)},maxLength:100})})})}),d.jsx(ut,{name:"description",render:({setValue:E,value:I})=>d.jsx(x.TextArea,{className:"field-sizing-content",placeholder:"Explain a description",value:I,onChange:S=>{E(S.target.value)},resize:"vertical",maxLength:1e3,size:"md"})})]}),d.jsx(Os,{}),!!y.errors.fields&&d.jsx(x.Text,{size:"xs",accentColor:"danger",children:typeof y.errors.fields=="string"&&y.errors.fields}),d.jsxs(x.ButtonGroup,{className:"flex items-center justify-end gap-2",size:"sm",children:[t&&d.jsx(x.Button,{type:"button",variant:"soft",accentColor:"base",onClick:t,children:"Cancel"}),d.jsx(x.Button,{type:"submit",variant:"surface",children:"Save form"})]})]})]}),d.jsx(x.SegmentedTabs.Content,{value:"preview",children:d.jsx(ms,{schema:C,hideTitle:!l})}),!u&&d.jsx(x.SegmentedTabs.Content,{value:"flow",children:d.jsx(Fs,{})})]})]})})})}));B.BaseField=Ee,B.BaseFormElement=mn,B.BaseSelectField=Gn,B.BooleanField=ir,B.BooleanInput=Wn,B.CheckboxListField=Hr,B.CheckboxListInput=Xn,B.DateField=Gr,B.DateInput=jn,B.FieldSection=De,B.FieldSectionLayout=Ri,B.FieldTypeToClsMapping=xr,B.FieldTypeToEmptyFieldMapping=Bi,B.FileCard=Cn,B.FormBuilder=Z1,B.FormRenderer=ms,B.ImageCard=us,B.ImageViewer=Un,B.ImageViewerProvider=Jo,B.InputWithHelpText=bn,B.InputWithLabel=We,B.InputWithLabelAndHelpText=Xe,B.LONG_TEXT_FIELD_MAX_LENGTH=Tt,B.MultiSelectField=ar,B.MultiSelectInput=qn,B.MultiStringField=_t,B.MultiStringInput=Hn,B.NumberField=dt,B.NumberInput=Yn,B.PatchField=ut,B.PatchFormProvider=W1,B.RadioField=Wr,B.RadioInput=Kn,B.SEVERITY_COLOR_MAPPING=er,B.SHORT_TEXT_FIELD_MAX_LENGTH=pr,B.ScanField=an,B.ScanInput=Oi,B.Scanner=Ni,B.SelectField=sn,B.SelectInput=Di,B.StringField=ln,B.StringInput=Mi,B.StringOrTextField=gr,B.TextField=un,B.TextInput=Pi,B.UploadField=cn,B.UploadInput=Fi,B.decodeFieldValues=k1,B.deserialize=fn,B.deserializeField=Li,B.deserializeFields=ps,B.deserializeOnlyFields=V1,B.emptyBaseField=Ue,B.emptyBooleanField=ta,B.emptyCheckboxListField=ra,B.emptyDateField=na,B.emptyMultiSelectField=ia,B.emptyMultiStringField=ea,B.emptyNumberField=oa,B.emptyRadioField=sa,B.emptyScanField=is,B.emptySelectField=os,B.emptyStringField=ss,B.emptyTextField=ls,B.emptyUploadField=fs,B.encodeFieldValues=z1,B.fieldIcons=ze,B.flattenFields=dn,B.getFieldsMapping=gs,B.initializeFormValues=vn,B.maxFileSizeB=vs,B.maxFileSizeKB=hs,B.maxFileSizeMB=yr,B.useFieldInput=ys,B.useFieldInputs=mr,B.useFormikInput=He,B.useImageViewer=Nr,B.validateFields=hn,B.valueIsFile=U1,Object.defineProperty(B,Symbol.toStringTag,{value:"Module"})});
|