var BarcodeDetectionAPI=function(S){"use strict";var ye=S=>{throw TypeError(S)};var me=(S,I,k)=>I.has(S)||ye("Cannot "+k);var ge=(S,I,k)=>(me(S,I,"read from private field"),k?k.call(S):I.get(S)),we=(S,I,k)=>I.has(S)?ye("Cannot add the same private member more than once"):I instanceof WeakSet?I.add(S):I.set(S,k),$e=(S,I,k,Ct)=>(me(S,I,"write to private field"),Ct?Ct.call(S,k):I.set(S,k),k);var ft,Er;const I=["Aztec","Codabar","Code128","Code39","Code93","DataBar","DataBarExpanded","DataBarLimited","DataMatrix","DXFilmEdge","EAN-13","EAN-8","ITF","Linear-Codes","Matrix-Codes","MaxiCode","MicroQRCode","None","PDF417","QRCode","rMQRCode","UPC-A","UPC-E"];function k(i){return i.join("|")}function Ct(i){const h=fr(i);let v=0,b=I.length-1;for(;v<=b;){const c=Math.floor((v+b)/2),P=I[c],x=fr(P);if(x===h)return P;x{const v=i.match(/_(.+?)\.wasm$/);return v?`https://fastly.jsdelivr.net/npm/zxing-wasm@1.3.4/dist/${v[1]}/${i}`:h+i}};let Lt=new WeakMap;function zt(i,h){var v;const b=Lt.get(i);if(b!=null&&b.modulePromise&&h===void 0)return b.modulePromise;const c=(v=b==null?void 0:b.moduleOverrides)!=null?v:Ae,P=i({...c});return Lt.set(i,{moduleOverrides:c,modulePromise:P}),P}function Oe(i,h){Lt.set(i,{moduleOverrides:h})}async function De(i,h,v=ot){const b={...ot,...v},c=await zt(i),{size:P}=h,x=new Uint8Array(await h.arrayBuffer()),V=c._malloc(P);c.HEAPU8.set(x,V);const z=c.readBarcodesFromImage(V,P,dr(c,b));c._free(V);const U=[];for(let R=0;R{var i,h=typeof document<"u"&&((i=document.currentScript)==null?void 0:i.tagName.toUpperCase())==="SCRIPT"?document.currentScript.src:void 0;return function(v={}){var b,c=v,P,x,V=new Promise((t,r)=>{P=t,x=r}),z=typeof window=="object",U=typeof Bun<"u",R=typeof importScripts=="function";typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string"&&process.type!="renderer";var Q=Object.assign({},c),N="./this.program",B="";function dt(t){return c.locateFile?c.locateFile(t,B):B+t}var ht,it;if(z||R||U){var pt;R?B=self.location.href:typeof document<"u"&&((pt=document.currentScript)===null||pt===void 0?void 0:pt.tagName.toUpperCase())==="SCRIPT"&&(B=document.currentScript.src),h&&(B=h),B.startsWith("blob:")?B="":B=B.substr(0,B.replace(/[?#].*/,"").lastIndexOf("/")+1),R&&(it=t=>{var r=new XMLHttpRequest;return r.open("GET",t,!1),r.responseType="arraybuffer",r.send(null),new Uint8Array(r.response)}),ht=t=>fetch(t,{credentials:"same-origin"}).then(r=>r.ok?r.arrayBuffer():Promise.reject(new Error(r.status+" : "+r.url)))}var Gt=c.print||console.log.bind(console),st=c.printErr||console.error.bind(console);Object.assign(c,Q),Q=null,c.arguments&&c.arguments,c.thisProgram&&(N=c.thisProgram);var Pt=c.wasmBinary,Et,_r=!1,G,M,ut,vt,tt,E,Ar,Or;function Dr(){var t=Et.buffer;c.HEAP8=G=new Int8Array(t),c.HEAP16=ut=new Int16Array(t),c.HEAPU8=M=new Uint8Array(t),c.HEAPU16=vt=new Uint16Array(t),c.HEAP32=tt=new Int32Array(t),c.HEAPU32=E=new Uint32Array(t),c.HEAPF32=Ar=new Float32Array(t),c.HEAPF64=Or=new Float64Array(t)}var Sr=[],xr=[],jr=[];function Ze(){var t=c.preRun;t&&(typeof t=="function"&&(t=[t]),t.forEach(tn)),Qt(Sr)}function Je(){Qt(xr)}function Ke(){var t=c.postRun;t&&(typeof t=="function"&&(t=[t]),t.forEach(en)),Qt(jr)}function tn(t){Sr.unshift(t)}function rn(t){xr.unshift(t)}function en(t){jr.unshift(t)}var rt=0,yt=null;function nn(t){var r;rt++,(r=c.monitorRunDependencies)===null||r===void 0||r.call(c,rt)}function an(t){var r;if(rt--,(r=c.monitorRunDependencies)===null||r===void 0||r.call(c,rt),rt==0&&yt){var e=yt;yt=null,e()}}function Xt(t){var r;(r=c.onAbort)===null||r===void 0||r.call(c,t),t="Aborted("+t+")",st(t),_r=!0,t+=". Build with -sASSERTIONS for more info.";var e=new WebAssembly.RuntimeError(t);throw x(e),e}var on="data:application/octet-stream;base64,",Fr=t=>t.startsWith(on);function sn(){var t="zxing_reader.wasm";return Fr(t)?t:dt(t)}var _t;function Mr(t){if(t==_t&&Pt)return new Uint8Array(Pt);if(it)return it(t);throw"both async and sync fetching of the wasm failed"}function un(t){return Pt?Promise.resolve().then(()=>Mr(t)):ht(t).then(r=>new Uint8Array(r),()=>Mr(t))}function Ir(t,r,e){return un(t).then(n=>WebAssembly.instantiate(n,r)).then(e,n=>{st(`failed to asynchronously prepare wasm: ${n}`),Xt(n)})}function cn(t,r,e,n){return!t&&typeof WebAssembly.instantiateStreaming=="function"&&!Fr(r)&&typeof fetch=="function"?fetch(r,{credentials:"same-origin"}).then(a=>{var o=WebAssembly.instantiateStreaming(a,e);return o.then(n,function(u){return st(`wasm streaming compile failed: ${u}`),st("falling back to ArrayBuffer instantiation"),Ir(r,e,n)})}):Ir(r,e,n)}function ln(){return{a:Ka}}function fn(){var t,r=ln();function e(a,o){return A=a.exports,Et=A.za,Dr(),Nr=A.Da,rn(A.Aa),an(),A}nn();function n(a){e(a.instance)}if(c.instantiateWasm)try{return c.instantiateWasm(r,e)}catch(a){st(`Module.instantiateWasm callback failed with error: ${a}`),x(a)}return(t=_t)!==null&&t!==void 0||(_t=sn()),cn(Pt,_t,r,n).catch(x),{}}var Qt=t=>{t.forEach(r=>r(c))};c.noExitRuntime;var g=t=>ne(t),w=()=>ae(),At=[],Ot=0,dn=t=>{var r=new Yt(t);return r.get_caught()||(r.set_caught(!0),Ot--),r.set_rethrown(!1),At.push(r),ie(t),re(t)},Y=0,hn=()=>{y(0,0);var t=At.pop();oe(t.excPtr),Y=0};class Yt{constructor(r){this.excPtr=r,this.ptr=r-24}set_type(r){E[this.ptr+4>>2]=r}get_type(){return E[this.ptr+4>>2]}set_destructor(r){E[this.ptr+8>>2]=r}get_destructor(){return E[this.ptr+8>>2]}set_caught(r){r=r?1:0,G[this.ptr+12]=r}get_caught(){return G[this.ptr+12]!=0}set_rethrown(r){r=r?1:0,G[this.ptr+13]=r}get_rethrown(){return G[this.ptr+13]!=0}init(r,e){this.set_adjusted_ptr(0),this.set_type(r),this.set_destructor(e)}set_adjusted_ptr(r){E[this.ptr+16>>2]=r}get_adjusted_ptr(){return E[this.ptr+16>>2]}}var pn=t=>{throw Y||(Y=t),Y},Dt=t=>ee(t),qt=t=>{var r=Y;if(!r)return Dt(0),0;var e=new Yt(r);e.set_adjusted_ptr(r);var n=e.get_type();if(!n)return Dt(0),r;for(var a of t){if(a===0||a===n)break;var o=e.ptr+16;if(se(a,n,o))return Dt(a),r}return Dt(n),r},vn=()=>qt([]),yn=t=>qt([t]),mn=(t,r)=>qt([t,r]),gn=()=>{var t=At.pop();t||Xt("no exception to throw");var r=t.excPtr;throw t.get_rethrown()||(At.push(t),t.set_rethrown(!0),t.set_caught(!1),Ot++),Y=r,Y},wn=(t,r,e)=>{var n=new Yt(t);throw n.init(r,e),Y=t,Ot++,Y},$n=()=>Ot,bn=()=>{Xt("")},St={},Zt=t=>{for(;t.length;){var r=t.pop(),e=t.pop();e(r)}};function mt(t){return this.fromWireType(E[t>>2])}var ct={},et={},xt={},Wr,jt=t=>{throw new Wr(t)},nt=(t,r,e)=>{t.forEach(s=>xt[s]=r);function n(s){var l=e(s);l.length!==t.length&&jt("Mismatched type converter count");for(var f=0;f{et.hasOwnProperty(s)?a[l]=et[s]:(o.push(s),ct.hasOwnProperty(s)||(ct[s]=[]),ct[s].push(()=>{a[l]=et[s],++u,u===o.length&&n(a)}))}),o.length===0&&n(a)},Cn=t=>{var r=St[t];delete St[t];var e=r.rawConstructor,n=r.rawDestructor,a=r.fields,o=a.map(u=>u.getterReturnType).concat(a.map(u=>u.setterArgumentType));nt([t],o,u=>{var s={};return a.forEach((l,f)=>{var d=l.fieldName,p=u[f],m=l.getter,T=l.getterContext,_=u[f+a.length],j=l.setter,O=l.setterContext;s[d]={read:D=>p.fromWireType(m(T,D)),write:(D,at)=>{var W=[];j(O,D,_.toWireType(W,at)),Zt(W)}}}),[{name:r.name,fromWireType:l=>{var f={};for(var d in s)f[d]=s[d].read(l);return n(l),f},toWireType:(l,f)=>{for(var d in s)if(!(d in f))throw new TypeError(`Missing field: "${d}"`);var p=e();for(d in s)s[d].write(p,f[d]);return l!==null&&l.push(n,p),p},argPackAdvance:X,readValueFromPointer:mt,destructorFunction:n}]})},Tn=(t,r,e,n,a)=>{},Pn=()=>{for(var t=new Array(256),r=0;r<256;++r)t[r]=String.fromCharCode(r);Rr=t},Rr,F=t=>{for(var r="",e=t;M[e];)r+=Rr[M[e++]];return r},lt,C=t=>{throw new lt(t)};function En(t,r){let e=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};var n=r.name;if(t||C(`type "${n}" must have a positive integer typeid pointer`),et.hasOwnProperty(t)){if(e.ignoreDuplicateRegistrations)return;C(`Cannot register type '${n}' twice`)}if(et[t]=r,delete xt[t],ct.hasOwnProperty(t)){var a=ct[t];delete ct[t],a.forEach(o=>o())}}function H(t,r){let e=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return En(t,r,e)}var X=8,_n=(t,r,e,n)=>{r=F(r),H(t,{name:r,fromWireType:function(a){return!!a},toWireType:function(a,o){return o?e:n},argPackAdvance:X,readValueFromPointer:function(a){return this.fromWireType(M[a])},destructorFunction:null})},An=t=>({count:t.count,deleteScheduled:t.deleteScheduled,preservePointerOnDelete:t.preservePointerOnDelete,ptr:t.ptr,ptrType:t.ptrType,smartPtr:t.smartPtr,smartPtrType:t.smartPtrType}),Jt=t=>{function r(e){return e.$$.ptrType.registeredClass.name}C(r(t)+" instance already deleted")},Kt=!1,Br=t=>{},On=t=>{t.smartPtr?t.smartPtrType.rawDestructor(t.smartPtr):t.ptrType.registeredClass.rawDestructor(t.ptr)},kr=t=>{t.count.value-=1;var r=t.count.value===0;r&&On(t)},Ur=(t,r,e)=>{if(r===e)return t;if(e.baseClass===void 0)return null;var n=Ur(t,r,e.baseClass);return n===null?null:e.downcast(n)},Vr={},Dn={},Sn=(t,r)=>{for(r===void 0&&C("ptr should not be undefined");t.baseClass;)r=t.upcast(r),t=t.baseClass;return r},xn=(t,r)=>(r=Sn(t,r),Dn[r]),Ft=(t,r)=>{(!r.ptrType||!r.ptr)&&jt("makeClassHandle requires ptr and ptrType");var e=!!r.smartPtrType,n=!!r.smartPtr;return e!==n&&jt("Both smartPtrType and smartPtr must be specified"),r.count={value:1},gt(Object.create(t,{$$:{value:r,writable:!0}}))};function jn(t){var r=this.getPointee(t);if(!r)return this.destructor(t),null;var e=xn(this.registeredClass,r);if(e!==void 0){if(e.$$.count.value===0)return e.$$.ptr=r,e.$$.smartPtr=t,e.clone();var n=e.clone();return this.destructor(t),n}function a(){return this.isSmartPointer?Ft(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:r,smartPtrType:this,smartPtr:t}):Ft(this.registeredClass.instancePrototype,{ptrType:this,ptr:t})}var o=this.registeredClass.getActualType(r),u=Vr[o];if(!u)return a.call(this);var s;this.isConst?s=u.constPointerType:s=u.pointerType;var l=Ur(r,this.registeredClass,s.registeredClass);return l===null?a.call(this):this.isSmartPointer?Ft(s.registeredClass.instancePrototype,{ptrType:s,ptr:l,smartPtrType:this,smartPtr:t}):Ft(s.registeredClass.instancePrototype,{ptrType:s,ptr:l})}var gt=t=>typeof FinalizationRegistry>"u"?(gt=r=>r,t):(Kt=new FinalizationRegistry(r=>{kr(r.$$)}),gt=r=>{var e=r.$$,n=!!e.smartPtr;if(n){var a={$$:e};Kt.register(r,a,r)}return r},Br=r=>Kt.unregister(r),gt(t)),Mt=[],Fn=()=>{for(;Mt.length;){var t=Mt.pop();t.$$.deleteScheduled=!1,t.delete()}},Hr,Mn=()=>{Object.assign(It.prototype,{isAliasOf(t){if(!(this instanceof It)||!(t instanceof It))return!1;var r=this.$$.ptrType.registeredClass,e=this.$$.ptr;t.$$=t.$$;for(var n=t.$$.ptrType.registeredClass,a=t.$$.ptr;r.baseClass;)e=r.upcast(e),r=r.baseClass;for(;n.baseClass;)a=n.upcast(a),n=n.baseClass;return r===n&&e===a},clone(){if(this.$$.ptr||Jt(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var t=gt(Object.create(Object.getPrototypeOf(this),{$$:{value:An(this.$$)}}));return t.$$.count.value+=1,t.$$.deleteScheduled=!1,t},delete(){this.$$.ptr||Jt(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&C("Object already scheduled for deletion"),Br(this),kr(this.$$),this.$$.preservePointerOnDelete||(this.$$.smartPtr=void 0,this.$$.ptr=void 0)},isDeleted(){return!this.$$.ptr},deleteLater(){return this.$$.ptr||Jt(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&C("Object already scheduled for deletion"),Mt.push(this),Mt.length===1&&Hr&&Hr(Fn),this.$$.deleteScheduled=!0,this}})};function It(){}var wt=(t,r)=>Object.defineProperty(r,"name",{value:t}),Lr=(t,r,e)=>{if(t[r].overloadTable===void 0){var n=t[r];t[r]=function(){for(var a=arguments.length,o=new Array(a),u=0;u{c.hasOwnProperty(t)?((e===void 0||c[t].overloadTable!==void 0&&c[t].overloadTable[e]!==void 0)&&C(`Cannot register public name '${t}' twice`),Lr(c,t,t),c.hasOwnProperty(e)&&C(`Cannot register multiple overloads of a function with the same number of arguments (${e})!`),c[t].overloadTable[e]=r):(c[t]=r,e!==void 0&&(c[t].numArguments=e))},In=48,Wn=57,Rn=t=>{t=t.replace(/[^a-zA-Z0-9_]/g,"$");var r=t.charCodeAt(0);return r>=In&&r<=Wn?`_${t}`:t};function Bn(t,r,e,n,a,o,u,s){this.name=t,this.constructor=r,this.instancePrototype=e,this.rawDestructor=n,this.baseClass=a,this.getActualType=o,this.upcast=u,this.downcast=s,this.pureVirtualFunctions=[]}var rr=(t,r,e)=>{for(;r!==e;)r.upcast||C(`Expected null or instance of ${e.name}, got an instance of ${r.name}`),t=r.upcast(t),r=r.baseClass;return t};function kn(t,r){if(r===null)return this.isReference&&C(`null is not a valid ${this.name}`),0;r.$$||C(`Cannot pass "${sr(r)}" as a ${this.name}`),r.$$.ptr||C(`Cannot pass deleted object as a pointer of type ${this.name}`);var e=r.$$.ptrType.registeredClass,n=rr(r.$$.ptr,e,this.registeredClass);return n}function Un(t,r){var e;if(r===null)return this.isReference&&C(`null is not a valid ${this.name}`),this.isSmartPointer?(e=this.rawConstructor(),t!==null&&t.push(this.rawDestructor,e),e):0;(!r||!r.$$)&&C(`Cannot pass "${sr(r)}" as a ${this.name}`),r.$$.ptr||C(`Cannot pass deleted object as a pointer of type ${this.name}`),!this.isConst&&r.$$.ptrType.isConst&&C(`Cannot convert argument of type ${r.$$.smartPtrType?r.$$.smartPtrType.name:r.$$.ptrType.name} to parameter type ${this.name}`);var n=r.$$.ptrType.registeredClass;if(e=rr(r.$$.ptr,n,this.registeredClass),this.isSmartPointer)switch(r.$$.smartPtr===void 0&&C("Passing raw pointer to smart pointer is illegal"),this.sharingPolicy){case 0:r.$$.smartPtrType===this?e=r.$$.smartPtr:C(`Cannot convert argument of type ${r.$$.smartPtrType?r.$$.smartPtrType.name:r.$$.ptrType.name} to parameter type ${this.name}`);break;case 1:e=r.$$.smartPtr;break;case 2:if(r.$$.smartPtrType===this)e=r.$$.smartPtr;else{var a=r.clone();e=this.rawShare(e,Z.toHandle(()=>a.delete())),t!==null&&t.push(this.rawDestructor,e)}break;default:C("Unsupporting sharing policy")}return e}function Vn(t,r){if(r===null)return this.isReference&&C(`null is not a valid ${this.name}`),0;r.$$||C(`Cannot pass "${sr(r)}" as a ${this.name}`),r.$$.ptr||C(`Cannot pass deleted object as a pointer of type ${this.name}`),r.$$.ptrType.isConst&&C(`Cannot convert argument of type ${r.$$.ptrType.name} to parameter type ${this.name}`);var e=r.$$.ptrType.registeredClass,n=rr(r.$$.ptr,e,this.registeredClass);return n}var Hn=()=>{Object.assign(Wt.prototype,{getPointee(t){return this.rawGetPointee&&(t=this.rawGetPointee(t)),t},destructor(t){var r;(r=this.rawDestructor)===null||r===void 0||r.call(this,t)},argPackAdvance:X,readValueFromPointer:mt,fromWireType:jn})};function Wt(t,r,e,n,a,o,u,s,l,f,d){this.name=t,this.registeredClass=r,this.isReference=e,this.isConst=n,this.isSmartPointer=a,this.pointeeType=o,this.sharingPolicy=u,this.rawGetPointee=s,this.rawConstructor=l,this.rawShare=f,this.rawDestructor=d,!a&&r.baseClass===void 0?n?(this.toWireType=kn,this.destructorFunction=null):(this.toWireType=Vn,this.destructorFunction=null):this.toWireType=Un}var zr=(t,r,e)=>{c.hasOwnProperty(t)||jt("Replacing nonexistent public symbol"),c[t].overloadTable!==void 0&&e!==void 0?c[t].overloadTable[e]=r:(c[t]=r,c[t].argCount=e)},Ln=(t,r,e)=>{t=t.replace(/p/g,"i");var n=c["dynCall_"+t];return n(r,...e)},Rt=[],Nr,$=t=>{var r=Rt[t];return r||(t>=Rt.length&&(Rt.length=t+1),Rt[t]=r=Nr.get(t)),r},zn=function(t,r){let e=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[];if(t.includes("j"))return Ln(t,r,e);var n=$(r)(...e);return n},Nn=(t,r)=>function(){for(var e=arguments.length,n=new Array(e),a=0;a{t=F(t);function e(){return t.includes("j")?Nn(t,r):$(r)}var n=e();return typeof n!="function"&&C(`unknown function pointer with signature ${t}: ${r}`),n},Gn=(t,r)=>{var e=wt(r,function(n){this.name=r,this.message=n;var a=new Error(n).stack;a!==void 0&&(this.stack=this.toString()+` `+a.replace(/^Error(:[^\n]*)?\n/,""))});return e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.prototype.toString=function(){return this.message===void 0?this.name:`${this.name}: ${this.message}`},e},Gr,Xr=t=>{var r=te(t),e=F(r);return J(r),e},Bt=(t,r)=>{var e=[],n={};function a(o){if(!n[o]&&!et[o]){if(xt[o]){xt[o].forEach(a);return}e.push(o),n[o]=!0}}throw r.forEach(a),new Gr(`${t}: `+e.map(Xr).join([", "]))},Xn=(t,r,e,n,a,o,u,s,l,f,d,p,m)=>{d=F(d),o=L(a,o),s&&(s=L(u,s)),f&&(f=L(l,f)),m=L(p,m);var T=Rn(d);tr(T,function(){Bt(`Cannot construct ${d} due to unbound types`,[n])}),nt([t,r,e],n?[n]:[],_=>{_=_[0];var j,O;n?(j=_.registeredClass,O=j.instancePrototype):O=It.prototype;var D=wt(d,function(){if(Object.getPrototypeOf(this)!==at)throw new lt("Use 'new' to construct "+d);if(W.constructor_body===void 0)throw new lt(d+" has no accessible constructor");for(var pe=arguments.length,Vt=new Array(pe),Ht=0;Ht{for(var e=[],n=0;n>2]);return e};function Qn(t){for(var r=1;r{var u=er(r,e);a=L(n,a),nt([],[t],s=>{s=s[0];var l=`constructor ${s.name}`;if(s.registeredClass.constructor_body===void 0&&(s.registeredClass.constructor_body=[]),s.registeredClass.constructor_body[r-1]!==void 0)throw new lt(`Cannot register multiple constructors with identical number of parameters (${r-1}) for class '${s.name}'! Overload resolution is currently only performed using the parameter count, not actual type info!`);return s.registeredClass.constructor_body[r-1]=()=>{Bt(`Cannot construct ${s.name} due to unbound types`,u)},nt([],u,f=>(f.splice(1,0,null),s.registeredClass.constructor_body[r-1]=nr(l,f,null,a,o),[])),[]})},Qr=t=>{t=t.trim();const r=t.indexOf("(");return r!==-1?t.substr(0,r):t},qn=(t,r,e,n,a,o,u,s,l,f)=>{var d=er(e,n);r=F(r),r=Qr(r),o=L(a,o),nt([],[t],p=>{p=p[0];var m=`${p.name}.${r}`;r.startsWith("@@")&&(r=Symbol[r.substring(2)]),s&&p.registeredClass.pureVirtualFunctions.push(r);function T(){Bt(`Cannot call ${m} due to unbound types`,d)}var _=p.registeredClass.instancePrototype,j=_[r];return j===void 0||j.overloadTable===void 0&&j.className!==p.name&&j.argCount===e-2?(T.argCount=e-2,T.className=p.name,_[r]=T):(Lr(_,r,m),_[r].overloadTable[e-2]=T),nt([],d,O=>{var D=nr(m,O,p,o,u);return _[r].overloadTable===void 0?(D.argCount=e-2,_[r]=D):_[r].overloadTable[e-2]=D,[]}),[]})},ar=[],q=[],or=t=>{t>9&&--q[t+1]===0&&(q[t]=void 0,ar.push(t))},Zn=()=>q.length/2-5-ar.length,Jn=()=>{q.push(0,1,void 0,1,null,1,!0,1,!1,1),c.count_emval_handles=Zn},Z={toValue:t=>(t||C("Cannot use deleted val. handle = "+t),q[t]),toHandle:t=>{switch(t){case void 0:return 2;case null:return 4;case!0:return 6;case!1:return 8;default:{const r=ar.pop()||q.length;return q[r]=t,q[r+1]=1,r}}}},Yr={name:"emscripten::val",fromWireType:t=>{var r=Z.toValue(t);return or(t),r},toWireType:(t,r)=>Z.toHandle(r),argPackAdvance:X,readValueFromPointer:mt,destructorFunction:null},Kn=t=>H(t,Yr),ta=(t,r,e)=>{switch(r){case 1:return e?function(n){return this.fromWireType(G[n])}:function(n){return this.fromWireType(M[n])};case 2:return e?function(n){return this.fromWireType(ut[n>>1])}:function(n){return this.fromWireType(vt[n>>1])};case 4:return e?function(n){return this.fromWireType(tt[n>>2])}:function(n){return this.fromWireType(E[n>>2])};default:throw new TypeError(`invalid integer width (${r}): ${t}`)}},ra=(t,r,e,n)=>{r=F(r);function a(){}a.values={},H(t,{name:r,constructor:a,fromWireType:function(o){return this.constructor.values[o]},toWireType:(o,u)=>u.value,argPackAdvance:X,readValueFromPointer:ta(r,e,n),destructorFunction:null}),tr(r,a)},ir=(t,r)=>{var e=et[t];return e===void 0&&C(`${r} has unknown type ${Xr(t)}`),e},ea=(t,r,e)=>{var n=ir(t,"enum");r=F(r);var a=n.constructor,o=Object.create(n.constructor.prototype,{value:{value:e},constructor:{value:wt(`${n.name}_${r}`,function(){})}});a.values[e]=o,a[r]=o},sr=t=>{if(t===null)return"null";var r=typeof t;return r==="object"||r==="array"||r==="function"?t.toString():""+t},na=(t,r)=>{switch(r){case 4:return function(e){return this.fromWireType(Ar[e>>2])};case 8:return function(e){return this.fromWireType(Or[e>>3])};default:throw new TypeError(`invalid float width (${r}): ${t}`)}},aa=(t,r,e)=>{r=F(r),H(t,{name:r,fromWireType:n=>n,toWireType:(n,a)=>a,argPackAdvance:X,readValueFromPointer:na(r,e),destructorFunction:null})},oa=(t,r,e,n,a,o,u,s)=>{var l=er(r,e);t=F(t),t=Qr(t),a=L(n,a),tr(t,function(){Bt(`Cannot call ${t} due to unbound types`,l)},r-1),nt([],l,f=>{var d=[f[0],null].concat(f.slice(1));return zr(t,nr(t,d,null,a,o),r-1),[]})},ia=(t,r,e)=>{switch(r){case 1:return e?n=>G[n]:n=>M[n];case 2:return e?n=>ut[n>>1]:n=>vt[n>>1];case 4:return e?n=>tt[n>>2]:n=>E[n>>2];default:throw new TypeError(`invalid integer width (${r}): ${t}`)}},sa=(t,r,e,n,a)=>{r=F(r);var o=d=>d;if(n===0){var u=32-8*e;o=d=>d<>>u}var s=r.includes("unsigned"),l=(d,p)=>{},f;s?f=function(d,p){return l(p,this.name),p>>>0}:f=function(d,p){return l(p,this.name),p},H(t,{name:r,fromWireType:o,toWireType:f,argPackAdvance:X,readValueFromPointer:ia(r,e,n!==0),destructorFunction:null})},ua=(t,r,e)=>{var n=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],a=n[r];function o(u){var s=E[u>>2],l=E[u+4>>2];return new a(G.buffer,l,s)}e=F(e),H(t,{name:e,fromWireType:o,argPackAdvance:X,readValueFromPointer:o},{ignoreDuplicateRegistrations:!0})},ca=Object.assign({optional:!0},Yr),la=(t,r)=>{H(t,ca)},fa=(t,r,e,n)=>{if(!(n>0))return 0;for(var a=e,o=e+n-1,u=0;u=55296&&s<=57343){var l=t.charCodeAt(++u);s=65536+((s&1023)<<10)|l&1023}if(s<=127){if(e>=o)break;r[e++]=s}else if(s<=2047){if(e+1>=o)break;r[e++]=192|s>>6,r[e++]=128|s&63}else if(s<=65535){if(e+2>=o)break;r[e++]=224|s>>12,r[e++]=128|s>>6&63,r[e++]=128|s&63}else{if(e+3>=o)break;r[e++]=240|s>>18,r[e++]=128|s>>12&63,r[e++]=128|s>>6&63,r[e++]=128|s&63}}return r[e]=0,e-a},$t=(t,r,e)=>fa(t,M,r,e),da=t=>{for(var r=0,e=0;e=55296&&n<=57343?(r+=4,++e):r+=3}return r},qr=typeof TextDecoder<"u"?new TextDecoder:void 0,Zr=function(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,e=arguments.length>2&&arguments[2]!==void 0?arguments[2]:NaN;for(var n=r+e,a=r;t[a]&&!(a>=n);)++a;if(a-r>16&&t.buffer&&qr)return qr.decode(t.subarray(r,a));for(var o="";r>10,56320|f&1023)}}return o},ha=(t,r)=>t?Zr(M,t,r):"",pa=(t,r)=>{r=F(r);var e=r==="std::string";H(t,{name:r,fromWireType(n){var a=E[n>>2],o=n+4,u;if(e)for(var s=o,l=0;l<=a;++l){var f=o+l;if(l==a||M[f]==0){var d=f-s,p=ha(s,d);u===void 0?u=p:(u+="\0",u+=p),s=f+1}}else{for(var m=new Array(a),l=0;l>2]=o,e&&u)$t(a,l,o+1);else if(u)for(var f=0;f255&&(J(l),C("String has UTF-16 code units that do not fit in 8 bits")),M[l+f]=d}else for(var f=0;f{for(var e=t,n=e>>1,a=n+r/2;!(n>=a)&&vt[n];)++n;if(e=n<<1,e-t>32&&Jr)return Jr.decode(M.subarray(t,e));for(var o="",u=0;!(u>=r/2);++u){var s=ut[t+u*2>>1];if(s==0)break;o+=String.fromCharCode(s)}return o},ya=(t,r,e)=>{var n;if((n=e)!==null&&n!==void 0||(e=2147483647),e<2)return 0;e-=2;for(var a=r,o=e>1]=s,r+=2}return ut[r>>1]=0,r-a},ma=t=>t.length*2,ga=(t,r)=>{for(var e=0,n="";!(e>=r/4);){var a=tt[t+e*4>>2];if(a==0)break;if(++e,a>=65536){var o=a-65536;n+=String.fromCharCode(55296|o>>10,56320|o&1023)}else n+=String.fromCharCode(a)}return n},wa=(t,r,e)=>{var n;if((n=e)!==null&&n!==void 0||(e=2147483647),e<4)return 0;for(var a=r,o=a+e-4,u=0;u=55296&&s<=57343){var l=t.charCodeAt(++u);s=65536+((s&1023)<<10)|l&1023}if(tt[r>>2]=s,r+=4,r+4>o)break}return tt[r>>2]=0,r-a},$a=t=>{for(var r=0,e=0;e=55296&&n<=57343&&++e,r+=4}return r},ba=(t,r,e)=>{e=F(e);var n,a,o,u;r===2?(n=va,a=ya,u=ma,o=s=>vt[s>>1]):r===4&&(n=ga,a=wa,u=$a,o=s=>E[s>>2]),H(t,{name:e,fromWireType:s=>{for(var l=E[s>>2],f,d=s+4,p=0;p<=l;++p){var m=s+4+p*r;if(p==l||o(m)==0){var T=m-d,_=n(d,T);f===void 0?f=_:(f+="\0",f+=_),d=m+r}}return J(s),f},toWireType:(s,l)=>{typeof l!="string"&&C(`Cannot pass non-string to C++ string type ${e}`);var f=u(l),d=lr(4+f+r);return E[d>>2]=f/r,a(l,d+4,f+r),s!==null&&s.push(J,d),d},argPackAdvance:X,readValueFromPointer:mt,destructorFunction(s){J(s)}})},Ca=(t,r,e,n,a,o)=>{St[t]={name:F(r),rawConstructor:L(e,n),rawDestructor:L(a,o),fields:[]}},Ta=(t,r,e,n,a,o,u,s,l,f)=>{St[t].fields.push({fieldName:F(r),getterReturnType:e,getter:L(n,a),getterContext:o,setterArgumentType:u,setter:L(s,l),setterContext:f})},Pa=(t,r)=>{r=F(r),H(t,{isVoid:!0,name:r,argPackAdvance:0,fromWireType:()=>{},toWireType:(e,n)=>{}})},Ea=(t,r,e)=>M.copyWithin(t,r,r+e),ur=[],_a=(t,r,e,n)=>(t=ur[t],r=Z.toValue(r),t(null,r,e,n)),Aa={},Oa=t=>{var r=Aa[t];return r===void 0?F(t):r},Kr=()=>{if(typeof globalThis=="object")return globalThis;function t(r){r.$$$embind_global$$$=r;var e=typeof $$$embind_global$$$=="object"&&r.$$$embind_global$$$==r;return e||delete r.$$$embind_global$$$,e}if(typeof $$$embind_global$$$=="object"||(typeof global=="object"&&t(global)?$$$embind_global$$$=global:typeof self=="object"&&t(self)&&($$$embind_global$$$=self),typeof $$$embind_global$$$=="object"))return $$$embind_global$$$;throw Error("unable to get global object.")},Da=t=>t===0?Z.toHandle(Kr()):(t=Oa(t),Z.toHandle(Kr()[t])),Sa=t=>{var r=ur.length;return ur.push(t),r},xa=(t,r)=>{for(var e=new Array(t),n=0;n>2],"parameter "+n);return e},ja=Reflect.construct,Fa=(t,r,e)=>{var n=[],a=t.toWireType(n,e);return n.length&&(E[r>>2]=Z.toHandle(n)),a},Ma=(t,r,e)=>{var n=xa(t,r),a=n.shift();t--;var o=new Array(t),u=(l,f,d,p)=>{for(var m=0,T=0;Tl.name).join(", ")}) => ${a.name}>`;return Sa(wt(s,u))},Ia=t=>{t>9&&(q[t+1]+=1)},Wa=t=>{var r=Z.toValue(t);Zt(r),or(t)},Ra=(t,r)=>{t=ir(t,"_emval_take_value");var e=t.readValueFromPointer(r);return Z.toHandle(e)},Ba=(t,r,e,n)=>{var a=new Date().getFullYear(),o=new Date(a,0,1),u=new Date(a,6,1),s=o.getTimezoneOffset(),l=u.getTimezoneOffset(),f=Math.max(s,l);E[t>>2]=f*60,tt[r>>2]=+(s!=l);var d=T=>{var _=T>=0?"-":"+",j=Math.abs(T),O=String(Math.floor(j/60)).padStart(2,"0"),D=String(j%60).padStart(2,"0");return`UTC${_}${O}${D}`},p=d(s),m=d(l);l2147483648,Ua=(t,r)=>Math.ceil(t/r)*r,Va=t=>{var r=Et.buffer,e=(t-r.byteLength+65535)/65536|0;try{return Et.grow(e),Dr(),1}catch{}},Ha=t=>{var r=M.length;t>>>=0;var e=ka();if(t>e)return!1;for(var n=1;n<=4;n*=2){var a=r*(1+.2/n);a=Math.min(a,t+100663296);var o=Math.min(e,Ua(Math.max(t,a),65536)),u=Va(o);if(u)return!0}return!1},cr={},La=()=>N||"./this.program",bt=()=>{if(!bt.strings){var t=(typeof navigator=="object"&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",r={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:t,_:La()};for(var e in cr)cr[e]===void 0?delete r[e]:r[e]=cr[e];var n=[];for(var e in r)n.push(`${e}=${r[e]}`);bt.strings=n}return bt.strings},za=(t,r)=>{for(var e=0;e{var e=0;return bt().forEach((n,a)=>{var o=r+e;E[t+a*4>>2]=o,za(n,o),e+=n.length+1}),0},Ga=(t,r)=>{var e=bt();E[t>>2]=e.length;var n=0;return e.forEach(a=>n+=a.length+1),E[r>>2]=n,0},Xa=t=>52;function Qa(t,r,e,n,a){return 70}var Ya=[null,[],[]],qa=(t,r)=>{var e=Ya[t];r===0||r===10?((t===1?Gt:st)(Zr(e)),e.length=0):e.push(r)},Za=(t,r,e,n)=>{for(var a=0,o=0;o>2],s=E[r+4>>2];r+=8;for(var l=0;l>2]=a,0},Ja=t=>t;Wr=c.InternalError=class extends Error{constructor(t){super(t),this.name="InternalError"}},Pn(),lt=c.BindingError=class extends Error{constructor(t){super(t),this.name="BindingError"}},Mn(),Hn(),Gr=c.UnboundTypeError=Gn(Error,"UnboundTypeError"),Jn();var Ka={t:dn,x:hn,a:vn,j:yn,k:mn,O:gn,q:wn,ga:$n,d:pn,ca:bn,va:Cn,ba:Tn,pa:_n,ta:Xn,sa:Yn,E:qn,oa:Kn,F:ra,n:ea,W:aa,X:oa,y:sa,u:ua,ua:la,V:pa,P:ba,L:Ca,wa:Ta,qa:Pa,ja:Ea,T:_a,xa:or,ya:Da,U:Ma,Y:Ia,Z:Wa,ra:Ra,da:Ba,ha:Ha,ea:Na,fa:Ga,ia:Xa,$:Qa,S:Za,J:bo,C:To,Q:ao,R:So,r:mo,b:to,D:$o,la:Eo,c:io,ka:_o,h:no,i:lo,s:fo,N:wo,w:po,I:Oo,K:go,z:Po,H:xo,aa:Fo,_:Mo,l:so,f:oo,e:eo,g:ro,M:Do,m:co,ma:Co,p:ho,v:vo,na:yo,B:Ao,o:uo,G:jo,A:Ja},A=fn(),te=t=>(te=A.Ba)(t),J=c._free=t=>(J=c._free=A.Ca)(t),lr=c._malloc=t=>(lr=c._malloc=A.Ea)(t),re=t=>(re=A.Fa)(t),y=(t,r)=>(y=A.Ga)(t,r),ee=t=>(ee=A.Ha)(t),ne=t=>(ne=A.Ia)(t),ae=()=>(ae=A.Ja)(),oe=t=>(oe=A.Ka)(t),ie=t=>(ie=A.La)(t),se=(t,r,e)=>(se=A.Ma)(t,r,e);c.dynCall_viijii=(t,r,e,n,a,o,u)=>(c.dynCall_viijii=A.Na)(t,r,e,n,a,o,u);var ue=c.dynCall_jiii=(t,r,e,n)=>(ue=c.dynCall_jiii=A.Oa)(t,r,e,n);c.dynCall_jiji=(t,r,e,n,a)=>(c.dynCall_jiji=A.Pa)(t,r,e,n,a);var ce=c.dynCall_jiiii=(t,r,e,n,a)=>(ce=c.dynCall_jiiii=A.Qa)(t,r,e,n,a);c.dynCall_iiiiij=(t,r,e,n,a,o,u)=>(c.dynCall_iiiiij=A.Ra)(t,r,e,n,a,o,u),c.dynCall_iiiiijj=(t,r,e,n,a,o,u,s,l)=>(c.dynCall_iiiiijj=A.Sa)(t,r,e,n,a,o,u,s,l),c.dynCall_iiiiiijj=(t,r,e,n,a,o,u,s,l,f)=>(c.dynCall_iiiiiijj=A.Ta)(t,r,e,n,a,o,u,s,l,f);function to(t,r){var e=w();try{return $(t)(r)}catch(n){if(g(e),n!==n+0)throw n;y(1,0)}}function ro(t,r,e,n){var a=w();try{$(t)(r,e,n)}catch(o){if(g(a),o!==o+0)throw o;y(1,0)}}function eo(t,r,e){var n=w();try{$(t)(r,e)}catch(a){if(g(n),a!==a+0)throw a;y(1,0)}}function no(t,r,e,n){var a=w();try{return $(t)(r,e,n)}catch(o){if(g(a),o!==o+0)throw o;y(1,0)}}function ao(t,r,e,n,a){var o=w();try{return $(t)(r,e,n,a)}catch(u){if(g(o),u!==u+0)throw u;y(1,0)}}function oo(t,r){var e=w();try{$(t)(r)}catch(n){if(g(e),n!==n+0)throw n;y(1,0)}}function io(t,r,e){var n=w();try{return $(t)(r,e)}catch(a){if(g(n),a!==a+0)throw a;y(1,0)}}function so(t){var r=w();try{$(t)()}catch(e){if(g(r),e!==e+0)throw e;y(1,0)}}function uo(t,r,e,n,a,o,u,s,l,f,d){var p=w();try{$(t)(r,e,n,a,o,u,s,l,f,d)}catch(m){if(g(p),m!==m+0)throw m;y(1,0)}}function co(t,r,e,n,a){var o=w();try{$(t)(r,e,n,a)}catch(u){if(g(o),u!==u+0)throw u;y(1,0)}}function lo(t,r,e,n,a){var o=w();try{return $(t)(r,e,n,a)}catch(u){if(g(o),u!==u+0)throw u;y(1,0)}}function fo(t,r,e,n,a,o){var u=w();try{return $(t)(r,e,n,a,o)}catch(s){if(g(u),s!==s+0)throw s;y(1,0)}}function ho(t,r,e,n,a,o){var u=w();try{$(t)(r,e,n,a,o)}catch(s){if(g(u),s!==s+0)throw s;y(1,0)}}function po(t,r,e,n,a,o,u){var s=w();try{return $(t)(r,e,n,a,o,u)}catch(l){if(g(s),l!==l+0)throw l;y(1,0)}}function vo(t,r,e,n,a,o,u,s){var l=w();try{$(t)(r,e,n,a,o,u,s)}catch(f){if(g(l),f!==f+0)throw f;y(1,0)}}function yo(t,r,e,n,a,o,u,s,l){var f=w();try{$(t)(r,e,n,a,o,u,s,l)}catch(d){if(g(f),d!==d+0)throw d;y(1,0)}}function mo(t){var r=w();try{return $(t)()}catch(e){if(g(r),e!==e+0)throw e;y(1,0)}}function go(t,r,e,n,a,o,u,s,l){var f=w();try{return $(t)(r,e,n,a,o,u,s,l)}catch(d){if(g(f),d!==d+0)throw d;y(1,0)}}function wo(t,r,e,n,a,o,u){var s=w();try{return $(t)(r,e,n,a,o,u)}catch(l){if(g(s),l!==l+0)throw l;y(1,0)}}function $o(t,r,e,n){var a=w();try{return $(t)(r,e,n)}catch(o){if(g(a),o!==o+0)throw o;y(1,0)}}function bo(t,r,e,n){var a=w();try{return $(t)(r,e,n)}catch(o){if(g(a),o!==o+0)throw o;y(1,0)}}function Co(t,r,e,n,a,o,u,s){var l=w();try{$(t)(r,e,n,a,o,u,s)}catch(f){if(g(l),f!==f+0)throw f;y(1,0)}}function To(t,r,e,n,a,o){var u=w();try{return $(t)(r,e,n,a,o)}catch(s){if(g(u),s!==s+0)throw s;y(1,0)}}function Po(t,r,e,n,a,o,u,s,l,f){var d=w();try{return $(t)(r,e,n,a,o,u,s,l,f)}catch(p){if(g(d),p!==p+0)throw p;y(1,0)}}function Eo(t,r,e){var n=w();try{return $(t)(r,e)}catch(a){if(g(n),a!==a+0)throw a;y(1,0)}}function _o(t,r,e,n,a){var o=w();try{return $(t)(r,e,n,a)}catch(u){if(g(o),u!==u+0)throw u;y(1,0)}}function Ao(t,r,e,n,a,o,u,s,l,f){var d=w();try{$(t)(r,e,n,a,o,u,s,l,f)}catch(p){if(g(d),p!==p+0)throw p;y(1,0)}}function Oo(t,r,e,n,a,o,u,s){var l=w();try{return $(t)(r,e,n,a,o,u,s)}catch(f){if(g(l),f!==f+0)throw f;y(1,0)}}function Do(t,r,e,n,a,o,u){var s=w();try{$(t)(r,e,n,a,o,u)}catch(l){if(g(s),l!==l+0)throw l;y(1,0)}}function So(t,r,e,n){var a=w();try{return $(t)(r,e,n)}catch(o){if(g(a),o!==o+0)throw o;y(1,0)}}function xo(t,r,e,n,a,o,u,s,l,f,d,p){var m=w();try{return $(t)(r,e,n,a,o,u,s,l,f,d,p)}catch(T){if(g(m),T!==T+0)throw T;y(1,0)}}function jo(t,r,e,n,a,o,u,s,l,f,d,p,m,T,_,j){var O=w();try{$(t)(r,e,n,a,o,u,s,l,f,d,p,m,T,_,j)}catch(D){if(g(O),D!==D+0)throw D;y(1,0)}}function Fo(t,r,e,n){var a=w();try{return ue(t,r,e,n)}catch(o){if(g(a),o!==o+0)throw o;y(1,0)}}function Mo(t,r,e,n,a){var o=w();try{return ce(t,r,e,n,a)}catch(u){if(g(o),u!==u+0)throw u;y(1,0)}}var kt,le;yt=function t(){kt||fe(),kt||(yt=t)};function fe(){if(rt>0||!le&&(le=1,Ze(),rt>0))return;function t(){var r;kt||(kt=1,c.calledRun=1,!_r&&(Je(),P(c),(r=c.onRuntimeInitialized)===null||r===void 0||r.call(c),Ke()))}c.setStatus?(c.setStatus("Running..."),setTimeout(()=>{setTimeout(()=>c.setStatus(""),1),t()},1)):t()}if(c.preInit)for(typeof c.preInit=="function"&&(c.preInit=[c.preInit]);c.preInit.length>0;)c.preInit.pop()();return fe(),b=V,b}})();function xe(i){return zt(Tt,i)}function je(i){return Oe(Tt,i)}async function Fe(i,h){return De(Tt,i,h)}async function Me(i,h){return Se(Tt,i,h)}const pr=[["aztec","Aztec"],["code_128","Code128"],["code_39","Code39"],["code_93","Code93"],["codabar","Codabar"],["databar","DataBar"],["databar_expanded","DataBarExpanded"],["databar_limited","DataBarLimited"],["data_matrix","DataMatrix"],["dx_film_edge","DXFilmEdge"],["ean_13","EAN-13"],["ean_8","EAN-8"],["itf","ITF"],["maxi_code","MaxiCode"],["micro_qr_code","MicroQRCode"],["pdf417","PDF417"],["qr_code","QRCode"],["rm_qr_code","rMQRCode"],["upc_a","UPC-A"],["upc_e","UPC-E"],["linear_codes","Linear-Codes"],["matrix_codes","Matrix-Codes"]],Ie=[...pr,["unknown"]].map(i=>i[0]),Nt=new Map(pr);function We(i){for(const[h,v]of Nt)if(i===v)return h;return"unknown"}function Re(i){if(vr(i))return{width:i.naturalWidth,height:i.naturalHeight};if(yr(i))return{width:i.width.baseVal.value,height:i.height.baseVal.value};if(mr(i))return{width:i.videoWidth,height:i.videoHeight};if(wr(i))return{width:i.width,height:i.height};if(br(i))return{width:i.displayWidth,height:i.displayHeight};if(gr(i))return{width:i.width,height:i.height};if($r(i))return{width:i.width,height:i.height};throw new TypeError("The provided value is not of type '(Blob or HTMLCanvasElement or HTMLImageElement or HTMLVideoElement or ImageBitmap or ImageData or OffscreenCanvas or SVGImageElement or VideoFrame)'.")}function vr(i){var h,v;try{return i instanceof((v=(h=i==null?void 0:i.ownerDocument)==null?void 0:h.defaultView)==null?void 0:v.HTMLImageElement)}catch{return!1}}function yr(i){var h,v;try{return i instanceof((v=(h=i==null?void 0:i.ownerDocument)==null?void 0:h.defaultView)==null?void 0:v.SVGImageElement)}catch{return!1}}function mr(i){var h,v;try{return i instanceof((v=(h=i==null?void 0:i.ownerDocument)==null?void 0:h.defaultView)==null?void 0:v.HTMLVideoElement)}catch{return!1}}function gr(i){var h,v;try{return i instanceof((v=(h=i==null?void 0:i.ownerDocument)==null?void 0:h.defaultView)==null?void 0:v.HTMLCanvasElement)}catch{return!1}}function wr(i){try{return i instanceof ImageBitmap||Object.prototype.toString.call(i)==="[object ImageBitmap]"}catch{return!1}}function $r(i){try{return i instanceof OffscreenCanvas||Object.prototype.toString.call(i)==="[object OffscreenCanvas]"}catch{return!1}}function br(i){try{return i instanceof VideoFrame||Object.prototype.toString.call(i)==="[object VideoFrame]"}catch{return!1}}function Cr(i){try{return i instanceof Blob||Object.prototype.toString.call(i)==="[object Blob]"}catch{return!1}}function Be(i){try{return i instanceof ImageData||Object.prototype.toString.call(i)==="[object ImageData]"}catch{return!1}}function ke(i,h){try{const v=new OffscreenCanvas(i,h);if(v.getContext("2d")instanceof OffscreenCanvasRenderingContext2D)return v;throw void 0}catch{const v=document.createElement("canvas");return v.width=i,v.height=h,v}}async function Tr(i){if(vr(i)&&!await Le(i))throw new DOMException("Failed to load or decode HTMLImageElement.","InvalidStateError");if(yr(i)&&!await ze(i))throw new DOMException("Failed to load or decode SVGImageElement.","InvalidStateError");if(br(i)&&Ne(i))throw new DOMException("VideoFrame is closed.","InvalidStateError");if(mr(i)&&(i.readyState===0||i.readyState===1))throw new DOMException("Invalid element or state.","InvalidStateError");if(wr(i)&&Xe(i))throw new DOMException("The image source is detached.","InvalidStateError");const{width:h,height:v}=Re(i);if(h===0||v===0)return null;const c=ke(h,v).getContext("2d");c.drawImage(i,0,0);try{return c.getImageData(0,0,h,v)}catch{throw new DOMException("Source would taint origin.","SecurityError")}}async function Ue(i){let h;try{if(globalThis.createImageBitmap)h=await createImageBitmap(i);else if(globalThis.Image){h=new Image;let b="";try{b=URL.createObjectURL(i),h.src=b,await h.decode()}finally{URL.revokeObjectURL(b)}}else return i}catch{throw new DOMException("Failed to load or decode Blob.","InvalidStateError")}return await Tr(h)}function Ve(i){const{width:h,height:v}=i;if(h===0||v===0)return null;const b=i.getContext("2d");try{return b.getImageData(0,0,h,v)}catch{throw new DOMException("Source would taint origin.","SecurityError")}}async function He(i){if(Cr(i))return await Ue(i);if(Be(i)){if(Ge(i))throw new DOMException("The image data has been detached.","InvalidStateError");return i}return gr(i)||$r(i)?Ve(i):await Tr(i)}async function Le(i){try{return await i.decode(),!0}catch{return!1}}async function ze(i){var h;try{return await((h=i.decode)==null?void 0:h.call(i)),!0}catch{return!1}}function Ne(i){return i.format===null}function Ge(i){return i.data.buffer.byteLength===0}function Xe(i){return i.width===0&&i.height===0}function Pr(i,h){return Qe(i)?new DOMException(`${h}: ${i.message}`,i.name):Ye(i)?new i.constructor(`${h}: ${i.message}`):new Error(`${h}: ${i}`)}function Qe(i){return i instanceof DOMException||Object.prototype.toString.call(i)==="[object DOMException]"}function Ye(i){return i instanceof Error||Object.prototype.toString.call(i)==="[object Error]"}class qe extends EventTarget{constructor(v={}){var b;super();we(this,ft);try{const c=(b=v==null?void 0:v.formats)==null?void 0:b.filter(P=>P!=="unknown");if((c==null?void 0:c.length)===0)throw new TypeError("Hint option provided, but is empty.");for(const P of c!=null?c:[])if(!Nt.has(P))throw new TypeError(`Failed to read the 'formats' property from 'BarcodeDetectorOptions': The provided value '${P}' is not a valid enum value of type BarcodeFormat.`);$e(this,ft,c!=null?c:[]),xe().then(P=>{this.dispatchEvent(new CustomEvent("load",{detail:P}))}).catch(P=>{this.dispatchEvent(new CustomEvent("error",{detail:P}))})}catch(c){throw Pr(c,"Failed to construct 'BarcodeDetector'")}}static async getSupportedFormats(){return Ie.filter(v=>v!=="unknown")}async detect(v){try{const b=await He(v);if(b===null)return[];let c;const P={tryHarder:!0,returnCodabarStartEnd:!0,formats:ge(this,ft).map(x=>Nt.get(x))};try{Cr(b)?c=await Fe(b,P):c=await Me(b,P)}catch(x){throw console.error(x),new DOMException("Barcode detection service unavailable.","NotSupportedError")}return c.map(x=>{const{topLeft:{x:V,y:z},topRight:{x:U,y:R},bottomLeft:{x:Q,y:N},bottomRight:{x:B,y:dt}}=x.position,ht=Math.min(V,U,Q,B),it=Math.min(z,R,N,dt),pt=Math.max(V,U,Q,B),Gt=Math.max(z,R,N,dt);return{boundingBox:new DOMRectReadOnly(ht,it,pt-ht,Gt-it),rawValue:x.text,format:We(x.format),cornerPoints:[{x:V,y:z},{x:U,y:R},{x:B,y:dt},{x:Q,y:N}]}})}catch(b){throw Pr(b,"Failed to execute 'detect' on 'BarcodeDetector'")}}}return ft=new WeakMap,(Er=globalThis.BarcodeDetector)!=null||(globalThis.BarcodeDetector=qe),S.setZXingModuleOverrides=je,Object.defineProperty(S,Symbol.toStringTag,{value:"Module"}),S}({});