Index3-986cd5fa.js 69 KB

123
  1. import{d as _r,r as he,w as Ue,o as fo,J as ho,a as Rt,j as Sr,b as Pr,e as be,$ as po,h as vo,v as mo,W as yo,x as go,c as wo,y as bo}from"./index-84dbbcf9.js";var Er=(r,i,a)=>{if(!i.has(r))throw TypeError("Cannot "+a)},pr=(r,i,a)=>(Er(r,i,"read from private field"),a?a.call(r):i.get(r)),Co=(r,i,a)=>{if(i.has(r))throw TypeError("Cannot add the same private member more than once");i instanceof WeakSet?i.add(r):i.set(r,a)},To=(r,i,a,c)=>(Er(r,i,"write to private field"),i.set(r,a),a);const Or=[["aztec","Aztec"],["code_128","Code128"],["code_39","Code39"],["code_93","Code93"],["codabar","Codabar"],["databar","DataBar"],["databar_expanded","DataBarExpanded"],["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"]],$o=[...Or,["unknown"]].map(r=>r[0]),ot=new Map(Or);function _o(r){for(const[i,a]of ot)if(r===a)return i;return"unknown"}function So(r){if(Mr(r))return{width:r.naturalWidth,height:r.naturalHeight};if(Ar(r))return{width:r.width.baseVal.value,height:r.height.baseVal.value};if(xr(r))return{width:r.videoWidth,height:r.videoHeight};if(Dr(r))return{width:r.width,height:r.height};if(kr(r))return{width:r.displayWidth,height:r.displayHeight};if(jr(r))return{width:r.width,height:r.height};if(Rr(r))return{width:r.width,height:r.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 Mr(r){try{return r instanceof HTMLImageElement}catch{return!1}}function Ar(r){try{return r instanceof SVGImageElement}catch{return!1}}function xr(r){try{return r instanceof HTMLVideoElement}catch{return!1}}function jr(r){try{return r instanceof HTMLCanvasElement}catch{return!1}}function Dr(r){try{return r instanceof ImageBitmap}catch{return!1}}function Rr(r){try{return r instanceof OffscreenCanvas}catch{return!1}}function kr(r){try{return r instanceof VideoFrame}catch{return!1}}function Fr(r){try{return r instanceof Blob}catch{return!1}}function Po(r){try{return r instanceof ImageData}catch{return!1}}function Eo(r,i){try{const a=new OffscreenCanvas(r,i);if(a.getContext("2d")instanceof OffscreenCanvasRenderingContext2D)return a;throw void 0}catch{const c=document.createElement("canvas");return c.width=r,c.height=i,c}}async function Ir(r){if(Mr(r)&&!await xo(r))throw new DOMException("Failed to load or decode HTMLImageElement.","InvalidStateError");if(Ar(r)&&!await jo(r))throw new DOMException("Failed to load or decode SVGImageElement.","InvalidStateError");if(kr(r)&&Do(r))throw new DOMException("VideoFrame is closed.","InvalidStateError");if(xr(r)&&(r.readyState===0||r.readyState===1))throw new DOMException("Invalid element or state.","InvalidStateError");if(Dr(r)&&ko(r))throw new DOMException("The image source is detached.","InvalidStateError");const{width:i,height:a}=So(r);if(i===0||a===0)return null;const c=Eo(i,a).getContext("2d");c.drawImage(r,0,0);try{return c.getImageData(0,0,i,a)}catch{throw new DOMException("Source would taint origin.","SecurityError")}}async function Oo(r){let i;try{if(globalThis.createImageBitmap)i=await createImageBitmap(r);else if(globalThis.Image){i=new Image;let a="";try{a=URL.createObjectURL(r),i.src=a,await i.decode()}finally{URL.revokeObjectURL(a)}}else return r}catch{throw new DOMException("Failed to load or decode Blob.","InvalidStateError")}return await Ir(i)}function Mo(r){const{width:i,height:a}=r;if(i===0||a===0)return null;const c=r.getContext("2d");try{return c.getImageData(0,0,i,a)}catch{throw new DOMException("Source would taint origin.","SecurityError")}}async function Ao(r){if(Fr(r))return await Oo(r);if(Po(r)){if(Ro(r))throw new DOMException("The image data has been detached.","InvalidStateError");return r}return jr(r)||Rr(r)?Mo(r):await Ir(r)}async function xo(r){try{return await r.decode(),!0}catch{return!1}}async function jo(r){var i;try{return await((i=r.decode)==null?void 0:i.call(r)),!0}catch{return!1}}function Do(r){return r.format===null}function Ro(r){return r.data.buffer.byteLength===0}function ko(r){return r.width===0&&r.height===0}function vr(r,i){return r instanceof DOMException?new DOMException(`${i}: ${r.message}`,r.name):r instanceof Error?new r.constructor(`${i}: ${r.message}`):new Error(`${i}: ${r}`)}const mr=["Aztec","Codabar","Code128","Code39","Code93","DataBar","DataBarExpanded","DataMatrix","DXFilmEdge","EAN-13","EAN-8","ITF","Linear-Codes","Matrix-Codes","MaxiCode","MicroQRCode","None","PDF417","QRCode","rMQRCode","UPC-A","UPC-E"];function Fo(r){return r.join("|")}function Io(r){const i=yr(r);let a=0,c=mr.length-1;for(;a<=c;){const f=Math.floor((a+c)/2),p=mr[f],y=yr(p);if(y===i)return p;y<i?a=f+1:c=f-1}return"None"}function yr(r){return r.toLowerCase().replace(/_-\[\]/g,"")}function Wo(r,i){return r.Binarizer[i]}function Uo(r,i){return r.CharacterSet[i]}const Lo=["Text","Binary","Mixed","GS1","ISO15434","UnknownECI"];function Ho(r){return Lo[r.value]}function No(r,i){return r.EanAddOnSymbol[i]}function Vo(r,i){return r.TextMode[i]}const Oe={formats:[],tryHarder:!0,tryRotate:!0,tryInvert:!0,tryDownscale:!0,binarizer:"LocalAverage",isPure:!1,downscaleFactor:3,downscaleThreshold:500,minLineCount:2,maxNumberOfSymbols:255,tryCode39ExtendedMode:!1,validateCode39CheckSum:!1,validateITFCheckSum:!1,returnCodabarStartEnd:!1,returnErrors:!1,eanAddOnSymbol:"Read",textMode:"Plain",characterSet:"Unknown"};function Wr(r,i){return{...i,formats:Fo(i.formats),binarizer:Wo(r,i.binarizer),eanAddOnSymbol:No(r,i.eanAddOnSymbol),textMode:Vo(r,i.textMode),characterSet:Uo(r,i.characterSet)}}function Ur(r){return{...r,format:Io(r.format),eccLevel:r.eccLevel,contentType:Ho(r.contentType)}}const Bo={locateFile:(r,i)=>{const a=r.match(/_(.+?)\.wasm$/);return a?`https://fastly.jsdelivr.net/npm/zxing-wasm@1.1.3/dist/${a[1]}/${r}`:i+r}};let gr=new WeakMap;function Ft(r,i){var a;const c=gr.get(r);if(c!=null&&c.modulePromise&&i===void 0)return c.modulePromise;const f=(a=c==null?void 0:c.moduleOverrides)!=null?a:Bo,p=r({...f});return gr.set(r,{moduleOverrides:f,modulePromise:p}),p}async function zo(r,i,a=Oe){const c={...Oe,...a},f=await Ft(r),{size:p}=i,y=new Uint8Array(await i.arrayBuffer()),_=f._malloc(p);f.HEAPU8.set(y,_);const h=f.readBarcodesFromImage(_,p,Wr(f,c));f._free(_);const w=[];for(let T=0;T<h.size();++T)w.push(Ur(h.get(T)));return w}async function qo(r,i,a=Oe){const c={...Oe,...a},f=await Ft(r),{data:p,width:y,height:_,data:{byteLength:h}}=i,w=f._malloc(h);f.HEAPU8.set(p,w);const T=f.readBarcodesFromPixmap(w,y,_,Wr(f,c));f._free(w);const b=[];for(let j=0;j<T.size();++j)b.push(Ur(T.get(j)));return b}({...Oe,formats:[...Oe.formats]});var It=(()=>{var r=typeof document<"u"&&document.currentScript?document.currentScript.src:void 0;return function(i={}){var a=i,c,f;a.ready=new Promise((e,t)=>{c=e,f=t});var p=Object.assign({},a),y="./this.program",_=typeof window=="object",h=typeof importScripts=="function";typeof process=="object"&&typeof process.versions=="object"&&process.versions.node;var w="";function T(e){return a.locateFile?a.locateFile(e,w):w+e}var b;(_||h)&&(h?w=self.location.href:typeof document<"u"&&document.currentScript&&(w=document.currentScript.src),r&&(w=r),w.indexOf("blob:")!==0?w=w.substr(0,w.replace(/[?#].*/,"").lastIndexOf("/")+1):w="",h&&(b=e=>{var t=new XMLHttpRequest;return t.open("GET",e,!1),t.responseType="arraybuffer",t.send(null),new Uint8Array(t.response)})),a.print||console.log.bind(console);var j=a.printErr||console.error.bind(console);Object.assign(a,p),p=null,a.arguments&&a.arguments,a.thisProgram&&(y=a.thisProgram),a.quit&&a.quit;var D;a.wasmBinary&&(D=a.wasmBinary),typeof WebAssembly!="object"&&X("no native wasm support detected");var x,F=!1,I,z,ue,R,O,M,le,ae;function Ce(){var e=x.buffer;a.HEAP8=I=new Int8Array(e),a.HEAP16=ue=new Int16Array(e),a.HEAPU8=z=new Uint8Array(e),a.HEAPU16=R=new Uint16Array(e),a.HEAP32=O=new Int32Array(e),a.HEAPU32=M=new Uint32Array(e),a.HEAPF32=le=new Float32Array(e),a.HEAPF64=ae=new Float64Array(e)}var Te=[],Me=[],Ae=[];function He(){if(a.preRun)for(typeof a.preRun=="function"&&(a.preRun=[a.preRun]);a.preRun.length;)lt(a.preRun.shift());vt(Te)}function ct(){vt(Me)}function ut(){if(a.postRun)for(typeof a.postRun=="function"&&(a.postRun=[a.postRun]);a.postRun.length;)xe(a.postRun.shift());vt(Ae)}function lt(e){Te.unshift(e)}function dt(e){Me.unshift(e)}function xe(e){Ae.unshift(e)}var ee=0,ye=null;function ft(e){var t;ee++,(t=a.monitorRunDependencies)===null||t===void 0||t.call(a,ee)}function de(e){var t;if(ee--,(t=a.monitorRunDependencies)===null||t===void 0||t.call(a,ee),ee==0&&ye){var n=ye;ye=null,n()}}function X(e){var t;(t=a.onAbort)===null||t===void 0||t.call(a,e),e="Aborted("+e+")",j(e),F=!0,e+=". Build with -sASSERTIONS for more info.";var n=new WebAssembly.RuntimeError(e);throw f(n),n}var ht="data:application/octet-stream;base64,",Ne=e=>e.startsWith(ht),fe;fe="zxing_reader.wasm",Ne(fe)||(fe=T(fe));function Ve(e){if(e==fe&&D)return new Uint8Array(D);if(b)return b(e);throw"both async and sync fetching of the wasm failed"}function pt(e){return!D&&(_||h)&&typeof fetch=="function"?fetch(e,{credentials:"same-origin"}).then(t=>{if(!t.ok)throw"failed to load wasm binary file at '"+e+"'";return t.arrayBuffer()}).catch(()=>Ve(e)):Promise.resolve().then(()=>Ve(e))}function Be(e,t,n){return pt(e).then(o=>WebAssembly.instantiate(o,t)).then(o=>o).then(n,o=>{j(`failed to asynchronously prepare wasm: ${o}`),X(o)})}function en(e,t,n,o){return!e&&typeof WebAssembly.instantiateStreaming=="function"&&!Ne(t)&&typeof fetch=="function"?fetch(t,{credentials:"same-origin"}).then(s=>{var u=WebAssembly.instantiateStreaming(s,n);return u.then(o,function(l){return j(`wasm streaming compile failed: ${l}`),j("falling back to ArrayBuffer instantiation"),Be(t,n,o)})}):Be(t,n,o)}function tn(){var e={a:Va};function t(o,s){return q=o.exports,x=q.ia,Ce(),Jt=q.ma,dt(q.ja),de(),q}ft();function n(o){t(o.instance)}if(a.instantiateWasm)try{return a.instantiateWasm(e,t)}catch(o){j(`Module.instantiateWasm callback failed with error: ${o}`),f(o)}return en(D,fe,e,n).catch(f),{}}var vt=e=>{for(;e.length>0;)e.shift()(a)};a.noExitRuntime;var ze=[],qe=0,rn=e=>{var t=new mt(e);return t.get_caught()||(t.set_caught(!0),qe--),t.set_rethrown(!1),ze.push(t),sr(t.excPtr),t.get_exception_ptr()},oe=0,nn=()=>{W(0,0);var e=ze.pop();ir(e.excPtr),oe=0};function mt(e){this.excPtr=e,this.ptr=e-24,this.set_type=function(t){M[this.ptr+4>>2]=t},this.get_type=function(){return M[this.ptr+4>>2]},this.set_destructor=function(t){M[this.ptr+8>>2]=t},this.get_destructor=function(){return M[this.ptr+8>>2]},this.set_caught=function(t){t=t?1:0,I[this.ptr+12>>0]=t},this.get_caught=function(){return I[this.ptr+12>>0]!=0},this.set_rethrown=function(t){t=t?1:0,I[this.ptr+13>>0]=t},this.get_rethrown=function(){return I[this.ptr+13>>0]!=0},this.init=function(t,n){this.set_adjusted_ptr(0),this.set_type(t),this.set_destructor(n)},this.set_adjusted_ptr=function(t){M[this.ptr+16>>2]=t},this.get_adjusted_ptr=function(){return M[this.ptr+16>>2]},this.get_exception_ptr=function(){var t=ur(this.get_type());if(t)return M[this.excPtr>>2];var n=this.get_adjusted_ptr();return n!==0?n:this.excPtr}}var an=e=>{throw oe||(oe=e),oe},yt=e=>{var t=oe;if(!t)return We(0),0;var n=new mt(t);n.set_adjusted_ptr(t);var o=n.get_type();if(!o)return We(0),t;for(var s in e){var u=e[s];if(u===0||u===o)break;var l=n.ptr+16;if(cr(u,o,l))return We(u),t}return We(o),t},on=()=>yt([]),sn=e=>yt([e]),cn=(e,t)=>yt([e,t]),un=()=>{var e=ze.pop();e||X("no exception to throw");var t=e.excPtr;throw e.get_rethrown()||(ze.push(e),e.set_rethrown(!0),e.set_caught(!1),qe++),oe=t,oe},ln=(e,t,n)=>{var o=new mt(e);throw o.init(t,n),oe=e,qe++,oe},dn=()=>qe,Je={},gt=e=>{for(;e.length;){var t=e.pop(),n=e.pop();n(t)}};function wt(e){return this.fromWireType(O[e>>2])}var $e={},ge={},Ge={},Wt,Ye=e=>{throw new Wt(e)},we=(e,t,n)=>{e.forEach(function(d){Ge[d]=t});function o(d){var v=n(d);v.length!==e.length&&Ye("Mismatched type converter count");for(var g=0;g<e.length;++g)te(e[g],v[g])}var s=new Array(t.length),u=[],l=0;t.forEach((d,v)=>{ge.hasOwnProperty(d)?s[v]=ge[d]:(u.push(d),$e.hasOwnProperty(d)||($e[d]=[]),$e[d].push(()=>{s[v]=ge[d],++l,l===u.length&&o(s)}))}),u.length===0&&o(s)},fn=e=>{var t=Je[e];delete Je[e];var n=t.rawConstructor,o=t.rawDestructor,s=t.fields,u=s.map(l=>l.getterReturnType).concat(s.map(l=>l.setterArgumentType));we([e],u,l=>{var d={};return s.forEach((v,g)=>{var C=v.fieldName,S=l[g],P=v.getter,E=v.getterContext,U=l[g+s.length],V=v.setter,k=v.setterContext;d[C]={read:Y=>S.fromWireType(P(E,Y)),write:(Y,m)=>{var $=[];V(k,Y,U.toWireType($,m)),gt($)}}}),[{name:t.name,fromWireType:v=>{var g={};for(var C in d)g[C]=d[C].read(v);return o(v),g},toWireType:(v,g)=>{for(var C in d)if(!(C in g))throw new TypeError(`Missing field: "${C}"`);var S=n();for(C in d)d[C].write(S,g[C]);return v!==null&&v.push(o,S),S},argPackAdvance:re,readValueFromPointer:wt,destructorFunction:o}]})},hn=(e,t,n,o,s)=>{},pn=()=>{for(var e=new Array(256),t=0;t<256;++t)e[t]=String.fromCharCode(t);Ut=e},Ut,G=e=>{for(var t="",n=e;z[n];)t+=Ut[z[n++]];return t},_e,A=e=>{throw new _e(e)};function vn(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};var o=t.name;if(e||A(`type "${o}" must have a positive integer typeid pointer`),ge.hasOwnProperty(e)){if(n.ignoreDuplicateRegistrations)return;A(`Cannot register type '${o}' twice`)}if(ge[e]=t,delete Ge[e],$e.hasOwnProperty(e)){var s=$e[e];delete $e[e],s.forEach(u=>u())}}function te(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};if(!("argPackAdvance"in t))throw new TypeError("registerType registeredInstance requires argPackAdvance");return vn(e,t,n)}var re=8,mn=(e,t,n,o)=>{t=G(t),te(e,{name:t,fromWireType:function(s){return!!s},toWireType:function(s,u){return u?n:o},argPackAdvance:re,readValueFromPointer:function(s){return this.fromWireType(z[s])},destructorFunction:null})},yn=e=>({count:e.count,deleteScheduled:e.deleteScheduled,preservePointerOnDelete:e.preservePointerOnDelete,ptr:e.ptr,ptrType:e.ptrType,smartPtr:e.smartPtr,smartPtrType:e.smartPtrType}),bt=e=>{function t(n){return n.$$.ptrType.registeredClass.name}A(t(e)+" instance already deleted")},Ct=!1,Lt=e=>{},gn=e=>{e.smartPtr?e.smartPtrType.rawDestructor(e.smartPtr):e.ptrType.registeredClass.rawDestructor(e.ptr)},Ht=e=>{e.count.value-=1;var t=e.count.value===0;t&&gn(e)},Nt=(e,t,n)=>{if(t===n)return e;if(n.baseClass===void 0)return null;var o=Nt(e,t,n.baseClass);return o===null?null:n.downcast(o)},Vt={},wn=()=>Object.keys(Re).length,bn=()=>{var e=[];for(var t in Re)Re.hasOwnProperty(t)&&e.push(Re[t]);return e},je=[],Tt=()=>{for(;je.length;){var e=je.pop();e.$$.deleteScheduled=!1,e.delete()}},De,Cn=e=>{De=e,je.length&&De&&De(Tt)},Tn=()=>{a.getInheritedInstanceCount=wn,a.getLiveInheritedInstances=bn,a.flushPendingDeletes=Tt,a.setDelayFunction=Cn},Re={},$n=(e,t)=>{for(t===void 0&&A("ptr should not be undefined");e.baseClass;)t=e.upcast(t),e=e.baseClass;return t},_n=(e,t)=>(t=$n(e,t),Re[t]),Qe=(e,t)=>{(!t.ptrType||!t.ptr)&&Ye("makeClassHandle requires ptr and ptrType");var n=!!t.smartPtrType,o=!!t.smartPtr;return n!==o&&Ye("Both smartPtrType and smartPtr must be specified"),t.count={value:1},ke(Object.create(e,{$$:{value:t,writable:!0}}))};function Sn(e){var t=this.getPointee(e);if(!t)return this.destructor(e),null;var n=_n(this.registeredClass,t);if(n!==void 0){if(n.$$.count.value===0)return n.$$.ptr=t,n.$$.smartPtr=e,n.clone();var o=n.clone();return this.destructor(e),o}function s(){return this.isSmartPointer?Qe(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:t,smartPtrType:this,smartPtr:e}):Qe(this.registeredClass.instancePrototype,{ptrType:this,ptr:e})}var u=this.registeredClass.getActualType(t),l=Vt[u];if(!l)return s.call(this);var d;this.isConst?d=l.constPointerType:d=l.pointerType;var v=Nt(t,this.registeredClass,d.registeredClass);return v===null?s.call(this):this.isSmartPointer?Qe(d.registeredClass.instancePrototype,{ptrType:d,ptr:v,smartPtrType:this,smartPtr:e}):Qe(d.registeredClass.instancePrototype,{ptrType:d,ptr:v})}var ke=e=>typeof FinalizationRegistry>"u"?(ke=t=>t,e):(Ct=new FinalizationRegistry(t=>{Ht(t.$$)}),ke=t=>{var n=t.$$,o=!!n.smartPtr;if(o){var s={$$:n};Ct.register(t,s,t)}return t},Lt=t=>Ct.unregister(t),ke(e)),Pn=()=>{Object.assign(Xe.prototype,{isAliasOf(e){if(!(this instanceof Xe)||!(e instanceof Xe))return!1;var t=this.$$.ptrType.registeredClass,n=this.$$.ptr;e.$$=e.$$;for(var o=e.$$.ptrType.registeredClass,s=e.$$.ptr;t.baseClass;)n=t.upcast(n),t=t.baseClass;for(;o.baseClass;)s=o.upcast(s),o=o.baseClass;return t===o&&n===s},clone(){if(this.$$.ptr||bt(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var e=ke(Object.create(Object.getPrototypeOf(this),{$$:{value:yn(this.$$)}}));return e.$$.count.value+=1,e.$$.deleteScheduled=!1,e},delete(){this.$$.ptr||bt(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&A("Object already scheduled for deletion"),Lt(this),Ht(this.$$),this.$$.preservePointerOnDelete||(this.$$.smartPtr=void 0,this.$$.ptr=void 0)},isDeleted(){return!this.$$.ptr},deleteLater(){return this.$$.ptr||bt(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&A("Object already scheduled for deletion"),je.push(this),je.length===1&&De&&De(Tt),this.$$.deleteScheduled=!0,this}})};function Xe(){}var Fe=(e,t)=>Object.defineProperty(t,"name",{value:e}),Bt=(e,t,n)=>{if(e[t].overloadTable===void 0){var o=e[t];e[t]=function(){return e[t].overloadTable.hasOwnProperty(arguments.length)||A(`Function '${n}' called with an invalid number of arguments (${arguments.length}) - expects one of (${e[t].overloadTable})!`),e[t].overloadTable[arguments.length].apply(this,arguments)},e[t].overloadTable=[],e[t].overloadTable[o.argCount]=o}},$t=(e,t,n)=>{a.hasOwnProperty(e)?((n===void 0||a[e].overloadTable!==void 0&&a[e].overloadTable[n]!==void 0)&&A(`Cannot register public name '${e}' twice`),Bt(a,e,e),a.hasOwnProperty(n)&&A(`Cannot register multiple overloads of a function with the same number of arguments (${n})!`),a[e].overloadTable[n]=t):(a[e]=t,n!==void 0&&(a[e].numArguments=n))},En=48,On=57,Mn=e=>{if(e===void 0)return"_unknown";e=e.replace(/[^a-zA-Z0-9_]/g,"$");var t=e.charCodeAt(0);return t>=En&&t<=On?`_${e}`:e};function An(e,t,n,o,s,u,l,d){this.name=e,this.constructor=t,this.instancePrototype=n,this.rawDestructor=o,this.baseClass=s,this.getActualType=u,this.upcast=l,this.downcast=d,this.pureVirtualFunctions=[]}var _t=(e,t,n)=>{for(;t!==n;)t.upcast||A(`Expected null or instance of ${n.name}, got an instance of ${t.name}`),e=t.upcast(e),t=t.baseClass;return e};function xn(e,t){if(t===null)return this.isReference&&A(`null is not a valid ${this.name}`),0;t.$$||A(`Cannot pass "${Mt(t)}" as a ${this.name}`),t.$$.ptr||A(`Cannot pass deleted object as a pointer of type ${this.name}`);var n=t.$$.ptrType.registeredClass,o=_t(t.$$.ptr,n,this.registeredClass);return o}function jn(e,t){var n;if(t===null)return this.isReference&&A(`null is not a valid ${this.name}`),this.isSmartPointer?(n=this.rawConstructor(),e!==null&&e.push(this.rawDestructor,n),n):0;(!t||!t.$$)&&A(`Cannot pass "${Mt(t)}" as a ${this.name}`),t.$$.ptr||A(`Cannot pass deleted object as a pointer of type ${this.name}`),!this.isConst&&t.$$.ptrType.isConst&&A(`Cannot convert argument of type ${t.$$.smartPtrType?t.$$.smartPtrType.name:t.$$.ptrType.name} to parameter type ${this.name}`);var o=t.$$.ptrType.registeredClass;if(n=_t(t.$$.ptr,o,this.registeredClass),this.isSmartPointer)switch(t.$$.smartPtr===void 0&&A("Passing raw pointer to smart pointer is illegal"),this.sharingPolicy){case 0:t.$$.smartPtrType===this?n=t.$$.smartPtr:A(`Cannot convert argument of type ${t.$$.smartPtrType?t.$$.smartPtrType.name:t.$$.ptrType.name} to parameter type ${this.name}`);break;case 1:n=t.$$.smartPtr;break;case 2:if(t.$$.smartPtrType===this)n=t.$$.smartPtr;else{var s=t.clone();n=this.rawShare(n,ie.toHandle(()=>s.delete())),e!==null&&e.push(this.rawDestructor,n)}break;default:A("Unsupporting sharing policy")}return n}function Dn(e,t){if(t===null)return this.isReference&&A(`null is not a valid ${this.name}`),0;t.$$||A(`Cannot pass "${Mt(t)}" as a ${this.name}`),t.$$.ptr||A(`Cannot pass deleted object as a pointer of type ${this.name}`),t.$$.ptrType.isConst&&A(`Cannot convert argument of type ${t.$$.ptrType.name} to parameter type ${this.name}`);var n=t.$$.ptrType.registeredClass,o=_t(t.$$.ptr,n,this.registeredClass);return o}function zt(e){return this.fromWireType(M[e>>2])}var Rn=()=>{Object.assign(Ke.prototype,{getPointee(e){return this.rawGetPointee&&(e=this.rawGetPointee(e)),e},destructor(e){var t;(t=this.rawDestructor)===null||t===void 0||t.call(this,e)},argPackAdvance:re,readValueFromPointer:zt,deleteObject(e){e!==null&&e.delete()},fromWireType:Sn})};function Ke(e,t,n,o,s,u,l,d,v,g,C){this.name=e,this.registeredClass=t,this.isReference=n,this.isConst=o,this.isSmartPointer=s,this.pointeeType=u,this.sharingPolicy=l,this.rawGetPointee=d,this.rawConstructor=v,this.rawShare=g,this.rawDestructor=C,!s&&t.baseClass===void 0?o?(this.toWireType=xn,this.destructorFunction=null):(this.toWireType=Dn,this.destructorFunction=null):this.toWireType=jn}var qt=(e,t,n)=>{a.hasOwnProperty(e)||Ye("Replacing nonexistant public symbol"),a[e].overloadTable!==void 0&&n!==void 0?a[e].overloadTable[n]=t:(a[e]=t,a[e].argCount=n)},kn=(e,t,n)=>{var o=a["dynCall_"+e];return n&&n.length?o.apply(null,[t].concat(n)):o.call(null,t)},Ze=[],Jt,L=e=>{var t=Ze[e];return t||(e>=Ze.length&&(Ze.length=e+1),Ze[e]=t=Jt.get(e)),t},Fn=(e,t,n)=>{if(e.includes("j"))return kn(e,t,n);var o=L(t).apply(null,n);return o},In=(e,t)=>{var n=[];return function(){return n.length=0,Object.assign(n,arguments),Fn(e,t,n)}},Z=(e,t)=>{e=G(e);function n(){return e.includes("j")?In(e,t):L(t)}var o=n();return typeof o!="function"&&A(`unknown function pointer with signature ${e}: ${t}`),o},Wn=(e,t)=>{var n=Fe(t,function(o){this.name=t,this.message=o;var s=new Error(o).stack;s!==void 0&&(this.stack=this.toString()+`
  2. `+s.replace(/^Error(:[^\n]*)?\n/,""))});return n.prototype=Object.create(e.prototype),n.prototype.constructor=n,n.prototype.toString=function(){return this.message===void 0?this.name:`${this.name}: ${this.message}`},n},Gt,Yt=e=>{var t=or(e),n=G(t);return se(t),n},et=(e,t)=>{var n=[],o={};function s(u){if(!o[u]&&!ge[u]){if(Ge[u]){Ge[u].forEach(s);return}n.push(u),o[u]=!0}}throw t.forEach(s),new Gt(`${e}: `+n.map(Yt).join([", "]))},Un=(e,t,n,o,s,u,l,d,v,g,C,S,P)=>{C=G(C),u=Z(s,u),d&&(d=Z(l,d)),g&&(g=Z(v,g)),P=Z(S,P);var E=Mn(C);$t(E,function(){et(`Cannot construct ${C} due to unbound types`,[o])}),we([e,t,n],o?[o]:[],function(U){U=U[0];var V,k;o?(V=U.registeredClass,k=V.instancePrototype):k=Xe.prototype;var Y=Fe(C,function(){if(Object.getPrototypeOf(this)!==m)throw new _e("Use 'new' to construct "+C);if($.constructor_body===void 0)throw new _e(C+" has no accessible constructor");var hr=$.constructor_body[arguments.length];if(hr===void 0)throw new _e(`Tried to invoke ctor of ${C} with invalid number of parameters (${arguments.length}) - expected (${Object.keys($.constructor_body).toString()}) parameters instead!`);return hr.apply(this,arguments)}),m=Object.create(k,{constructor:{value:Y}});Y.prototype=m;var $=new An(C,Y,m,P,V,u,d,g);if($.baseClass){var B,J;(J=(B=$.baseClass).__derivedClasses)!==null&&J!==void 0||(B.__derivedClasses=[]),$.baseClass.__derivedClasses.push($)}var Se=new Ke(C,$,!0,!1,!1),nt=new Ke(C+"*",$,!1,!1,!1),fr=new Ke(C+" const*",$,!1,!0,!1);return Vt[e]={pointerType:nt,constPointerType:fr},qt(E,Y),[Se,nt,fr]})},St=(e,t)=>{for(var n=[],o=0;o<e;o++)n.push(M[t+o*4>>2]);return n};function Ln(e){for(var t=1;t<e.length;++t)if(e[t]!==null&&e[t].destructorFunction===void 0)return!0;return!1}function Pt(e,t,n,o,s,u){var l=t.length;l<2&&A("argTypes array size mismatch! Must at least get return value and 'this' types!");var d=t[1]!==null&&n!==null,v=Ln(t),g=t[0].name!=="void",C=l-2,S=new Array(C),P=[],E=[],U=function(){arguments.length!==C&&A(`function ${e} called with ${arguments.length} arguments, expected ${C}`),E.length=0;var V;P.length=d?2:1,P[0]=s,d&&(V=t[1].toWireType(E,this),P[1]=V);for(var k=0;k<C;++k)S[k]=t[k+2].toWireType(E,arguments[k]),P.push(S[k]);var Y=o.apply(null,P);function m($){if(v)gt(E);else for(var B=d?1:2;B<t.length;B++){var J=B===1?V:S[B-2];t[B].destructorFunction!==null&&t[B].destructorFunction(J)}if(g)return t[0].fromWireType($)}return m(Y)};return Fe(e,U)}var Hn=(e,t,n,o,s,u)=>{var l=St(t,n);s=Z(o,s),we([],[e],function(d){d=d[0];var v=`constructor ${d.name}`;if(d.registeredClass.constructor_body===void 0&&(d.registeredClass.constructor_body=[]),d.registeredClass.constructor_body[t-1]!==void 0)throw new _e(`Cannot register multiple constructors with identical number of parameters (${t-1}) for class '${d.name}'! Overload resolution is currently only performed using the parameter count, not actual type info!`);return d.registeredClass.constructor_body[t-1]=()=>{et(`Cannot construct ${d.name} due to unbound types`,l)},we([],l,g=>(g.splice(1,0,null),d.registeredClass.constructor_body[t-1]=Pt(v,g,null,s,u),[])),[]})},Qt=e=>{e=e.trim();const t=e.indexOf("(");return t!==-1?e.substr(0,t):e},Nn=(e,t,n,o,s,u,l,d,v)=>{var g=St(n,o);t=G(t),t=Qt(t),u=Z(s,u),we([],[e],function(C){C=C[0];var S=`${C.name}.${t}`;t.startsWith("@@")&&(t=Symbol[t.substring(2)]),d&&C.registeredClass.pureVirtualFunctions.push(t);function P(){et(`Cannot call ${S} due to unbound types`,g)}var E=C.registeredClass.instancePrototype,U=E[t];return U===void 0||U.overloadTable===void 0&&U.className!==C.name&&U.argCount===n-2?(P.argCount=n-2,P.className=C.name,E[t]=P):(Bt(E,t,S),E[t].overloadTable[n-2]=P),we([],g,function(V){var k=Pt(S,V,C,u,l);return E[t].overloadTable===void 0?(k.argCount=n-2,E[t]=k):E[t].overloadTable[n-2]=k,[]}),[]})};function Vn(){Object.assign(Xt.prototype,{get(e){return this.allocated[e]},has(e){return this.allocated[e]!==void 0},allocate(e){var t=this.freelist.pop()||this.allocated.length;return this.allocated[t]=e,t},free(e){this.allocated[e]=void 0,this.freelist.push(e)}})}function Xt(){this.allocated=[void 0],this.freelist=[]}var K=new Xt,Et=e=>{e>=K.reserved&&--K.get(e).refcount===0&&K.free(e)},Bn=()=>{for(var e=0,t=K.reserved;t<K.allocated.length;++t)K.allocated[t]!==void 0&&++e;return e},zn=()=>{K.allocated.push({value:void 0},{value:null},{value:!0},{value:!1}),K.reserved=K.allocated.length,a.count_emval_handles=Bn},ie={toValue:e=>(e||A("Cannot use deleted val. handle = "+e),K.get(e).value),toHandle:e=>{switch(e){case void 0:return 1;case null:return 2;case!0:return 3;case!1:return 4;default:return K.allocate({refcount:1,value:e})}}},qn=(e,t)=>{t=G(t),te(e,{name:t,fromWireType:n=>{var o=ie.toValue(n);return Et(n),o},toWireType:(n,o)=>ie.toHandle(o),argPackAdvance:re,readValueFromPointer:wt,destructorFunction:null})},Jn=(e,t,n)=>{switch(t){case 1:return n?function(o){return this.fromWireType(I[o>>0])}:function(o){return this.fromWireType(z[o>>0])};case 2:return n?function(o){return this.fromWireType(ue[o>>1])}:function(o){return this.fromWireType(R[o>>1])};case 4:return n?function(o){return this.fromWireType(O[o>>2])}:function(o){return this.fromWireType(M[o>>2])};default:throw new TypeError(`invalid integer width (${t}): ${e}`)}},Gn=(e,t,n,o)=>{t=G(t);function s(){}s.values={},te(e,{name:t,constructor:s,fromWireType:function(u){return this.constructor.values[u]},toWireType:(u,l)=>l.value,argPackAdvance:re,readValueFromPointer:Jn(t,n,o),destructorFunction:null}),$t(t,s)},Ot=(e,t)=>{var n=ge[e];return n===void 0&&A(t+" has unknown type "+Yt(e)),n},Yn=(e,t,n)=>{var o=Ot(e,"enum");t=G(t);var s=o.constructor,u=Object.create(o.constructor.prototype,{value:{value:n},constructor:{value:Fe(`${o.name}_${t}`,function(){})}});s.values[n]=u,s[t]=u},Mt=e=>{if(e===null)return"null";var t=typeof e;return t==="object"||t==="array"||t==="function"?e.toString():""+e},Qn=(e,t)=>{switch(t){case 4:return function(n){return this.fromWireType(le[n>>2])};case 8:return function(n){return this.fromWireType(ae[n>>3])};default:throw new TypeError(`invalid float width (${t}): ${e}`)}},Xn=(e,t,n)=>{t=G(t),te(e,{name:t,fromWireType:o=>o,toWireType:(o,s)=>s,argPackAdvance:re,readValueFromPointer:Qn(t,n),destructorFunction:null})},Kn=(e,t,n,o,s,u,l)=>{var d=St(t,n);e=G(e),e=Qt(e),s=Z(o,s),$t(e,function(){et(`Cannot call ${e} due to unbound types`,d)},t-1),we([],d,function(v){var g=[v[0],null].concat(v.slice(1));return qt(e,Pt(e,g,null,s,u),t-1),[]})},Zn=(e,t,n)=>{switch(t){case 1:return n?o=>I[o>>0]:o=>z[o>>0];case 2:return n?o=>ue[o>>1]:o=>R[o>>1];case 4:return n?o=>O[o>>2]:o=>M[o>>2];default:throw new TypeError(`invalid integer width (${t}): ${e}`)}},ea=(e,t,n,o,s)=>{t=G(t);var u=C=>C;if(o===0){var l=32-8*n;u=C=>C<<l>>>l}var d=t.includes("unsigned"),v=(C,S)=>{},g;d?g=function(C,S){return v(S,this.name),S>>>0}:g=function(C,S){return v(S,this.name),S},te(e,{name:t,fromWireType:u,toWireType:g,argPackAdvance:re,readValueFromPointer:Zn(t,n,o!==0),destructorFunction:null})},ta=(e,t,n)=>{var o=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],s=o[t];function u(l){var d=M[l>>2],v=M[l+4>>2];return new s(I.buffer,v,d)}n=G(n),te(e,{name:n,fromWireType:u,argPackAdvance:re,readValueFromPointer:u},{ignoreDuplicateRegistrations:!0})},Kt=(e,t,n,o)=>{if(!(o>0))return 0;for(var s=n,u=n+o-1,l=0;l<e.length;++l){var d=e.charCodeAt(l);if(d>=55296&&d<=57343){var v=e.charCodeAt(++l);d=65536+((d&1023)<<10)|v&1023}if(d<=127){if(n>=u)break;t[n++]=d}else if(d<=2047){if(n+1>=u)break;t[n++]=192|d>>6,t[n++]=128|d&63}else if(d<=65535){if(n+2>=u)break;t[n++]=224|d>>12,t[n++]=128|d>>6&63,t[n++]=128|d&63}else{if(n+3>=u)break;t[n++]=240|d>>18,t[n++]=128|d>>12&63,t[n++]=128|d>>6&63,t[n++]=128|d&63}}return t[n]=0,n-s},ra=(e,t,n)=>Kt(e,z,t,n),Zt=e=>{for(var t=0,n=0;n<e.length;++n){var o=e.charCodeAt(n);o<=127?t++:o<=2047?t+=2:o>=55296&&o<=57343?(t+=4,++n):t+=3}return t},er=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0,na=(e,t,n)=>{for(var o=t+n,s=t;e[s]&&!(s>=o);)++s;if(s-t>16&&e.buffer&&er)return er.decode(e.subarray(t,s));for(var u="";t<s;){var l=e[t++];if(!(l&128)){u+=String.fromCharCode(l);continue}var d=e[t++]&63;if((l&224)==192){u+=String.fromCharCode((l&31)<<6|d);continue}var v=e[t++]&63;if((l&240)==224?l=(l&15)<<12|d<<6|v:l=(l&7)<<18|d<<12|v<<6|e[t++]&63,l<65536)u+=String.fromCharCode(l);else{var g=l-65536;u+=String.fromCharCode(55296|g>>10,56320|g&1023)}}return u},At=(e,t)=>e?na(z,e,t):"",aa=(e,t)=>{t=G(t);var n=t==="std::string";te(e,{name:t,fromWireType(o){var s=M[o>>2],u=o+4,l;if(n)for(var d=u,v=0;v<=s;++v){var g=u+v;if(v==s||z[g]==0){var C=g-d,S=At(d,C);l===void 0?l=S:(l+="\0",l+=S),d=g+1}}else{for(var P=new Array(s),v=0;v<s;++v)P[v]=String.fromCharCode(z[u+v]);l=P.join("")}return se(o),l},toWireType(o,s){s instanceof ArrayBuffer&&(s=new Uint8Array(s));var u,l=typeof s=="string";l||s instanceof Uint8Array||s instanceof Uint8ClampedArray||s instanceof Int8Array||A("Cannot pass non-string to std::string"),n&&l?u=Zt(s):u=s.length;var d=Dt(4+u+1),v=d+4;if(M[d>>2]=u,n&&l)ra(s,v,u+1);else if(l)for(var g=0;g<u;++g){var C=s.charCodeAt(g);C>255&&(se(v),A("String has UTF-16 code units that do not fit in 8 bits")),z[v+g]=C}else for(var g=0;g<u;++g)z[v+g]=s[g];return o!==null&&o.push(se,d),d},argPackAdvance:re,readValueFromPointer:zt,destructorFunction(o){se(o)}})},tr=typeof TextDecoder<"u"?new TextDecoder("utf-16le"):void 0,oa=(e,t)=>{for(var n=e,o=n>>1,s=o+t/2;!(o>=s)&&R[o];)++o;if(n=o<<1,n-e>32&&tr)return tr.decode(z.subarray(e,n));for(var u="",l=0;!(l>=t/2);++l){var d=ue[e+l*2>>1];if(d==0)break;u+=String.fromCharCode(d)}return u},ia=(e,t,n)=>{var o;if((o=n)!==null&&o!==void 0||(n=2147483647),n<2)return 0;n-=2;for(var s=t,u=n<e.length*2?n/2:e.length,l=0;l<u;++l){var d=e.charCodeAt(l);ue[t>>1]=d,t+=2}return ue[t>>1]=0,t-s},sa=e=>e.length*2,ca=(e,t)=>{for(var n=0,o="";!(n>=t/4);){var s=O[e+n*4>>2];if(s==0)break;if(++n,s>=65536){var u=s-65536;o+=String.fromCharCode(55296|u>>10,56320|u&1023)}else o+=String.fromCharCode(s)}return o},ua=(e,t,n)=>{var o;if((o=n)!==null&&o!==void 0||(n=2147483647),n<4)return 0;for(var s=t,u=s+n-4,l=0;l<e.length;++l){var d=e.charCodeAt(l);if(d>=55296&&d<=57343){var v=e.charCodeAt(++l);d=65536+((d&1023)<<10)|v&1023}if(O[t>>2]=d,t+=4,t+4>u)break}return O[t>>2]=0,t-s},la=e=>{for(var t=0,n=0;n<e.length;++n){var o=e.charCodeAt(n);o>=55296&&o<=57343&&++n,t+=4}return t},da=(e,t,n)=>{n=G(n);var o,s,u,l,d;t===2?(o=oa,s=ia,l=sa,u=()=>R,d=1):t===4&&(o=ca,s=ua,l=la,u=()=>M,d=2),te(e,{name:n,fromWireType:v=>{for(var g=M[v>>2],C=u(),S,P=v+4,E=0;E<=g;++E){var U=v+4+E*t;if(E==g||C[U>>d]==0){var V=U-P,k=o(P,V);S===void 0?S=k:(S+="\0",S+=k),P=U+t}}return se(v),S},toWireType:(v,g)=>{typeof g!="string"&&A(`Cannot pass non-string to C++ string type ${n}`);var C=l(g),S=Dt(4+C+t);return M[S>>2]=C>>d,s(g,S+4,C+t),v!==null&&v.push(se,S),S},argPackAdvance:re,readValueFromPointer:wt,destructorFunction(v){se(v)}})},fa=(e,t,n,o,s,u)=>{Je[e]={name:G(t),rawConstructor:Z(n,o),rawDestructor:Z(s,u),fields:[]}},ha=(e,t,n,o,s,u,l,d,v,g)=>{Je[e].fields.push({fieldName:G(t),getterReturnType:n,getter:Z(o,s),getterContext:u,setterArgumentType:l,setter:Z(d,v),setterContext:g})},pa=(e,t)=>{t=G(t),te(e,{isVoid:!0,name:t,argPackAdvance:0,fromWireType:()=>{},toWireType:(n,o)=>{}})},xt=[],va=(e,t,n,o)=>(e=xt[e],t=ie.toValue(t),e(null,t,n,o)),ma={},ya=e=>{var t=ma[e];return t===void 0?G(e):t},rr=()=>{if(typeof globalThis=="object")return globalThis;function e(t){t.$$$embind_global$$$=t;var n=typeof $$$embind_global$$$=="object"&&t.$$$embind_global$$$==t;return n||delete t.$$$embind_global$$$,n}if(typeof $$$embind_global$$$=="object"||(typeof global=="object"&&e(global)?$$$embind_global$$$=global:typeof self=="object"&&e(self)&&($$$embind_global$$$=self),typeof $$$embind_global$$$=="object"))return $$$embind_global$$$;throw Error("unable to get global object.")},ga=e=>e===0?ie.toHandle(rr()):(e=ya(e),ie.toHandle(rr()[e])),wa=e=>{var t=xt.length;return xt.push(e),t},ba=(e,t)=>{for(var n=new Array(e),o=0;o<e;++o)n[o]=Ot(M[t+o*4>>2],"parameter "+o);return n},Ca=Reflect.construct,Ta=(e,t,n)=>{var o=[],s=e.toWireType(o,n);return o.length&&(M[t>>2]=ie.toHandle(o)),s},$a=(e,t,n)=>{var o=ba(e,t),s=o.shift();e--;var u=new Array(e),l=(v,g,C,S)=>{for(var P=0,E=0;E<e;++E)u[E]=o[E].readValueFromPointer(S+P),P+=o[E].argPackAdvance;for(var U=n===1?Ca(g,u):g.apply(v,u),E=0;E<e;++E){var V,k;(V=(k=o[E]).deleteObject)===null||V===void 0||V.call(k,u[E])}return Ta(s,C,U)},d=`methodCaller<(${o.map(v=>v.name).join(", ")}) => ${s.name}>`;return wa(Fe(d,l))},_a=e=>{e>4&&(K.get(e).refcount+=1)},Sa=e=>{var t=ie.toValue(e);gt(t),Et(e)},Pa=(e,t)=>{e=Ot(e,"_emval_take_value");var n=e.readValueFromPointer(t);return ie.toHandle(n)},Ea=()=>{X("")},Oa=(e,t,n)=>z.copyWithin(e,t,t+n),Ma=()=>2147483648,Aa=e=>{var t=x.buffer,n=(e-t.byteLength+65535)/65536;try{return x.grow(n),Ce(),1}catch{}},xa=e=>{var t=z.length;e>>>=0;var n=Ma();if(e>n)return!1;for(var o=(v,g)=>v+(g-v%g)%g,s=1;s<=4;s*=2){var u=t*(1+.2/s);u=Math.min(u,e+100663296);var l=Math.min(n,o(Math.max(e,u),65536)),d=Aa(l);if(d)return!0}return!1},jt={},ja=()=>y||"./this.program",Ie=()=>{if(!Ie.strings){var e=(typeof navigator=="object"&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",t={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:e,_:ja()};for(var n in jt)jt[n]===void 0?delete t[n]:t[n]=jt[n];var o=[];for(var n in t)o.push(`${n}=${t[n]}`);Ie.strings=o}return Ie.strings},Da=(e,t)=>{for(var n=0;n<e.length;++n)I[t++>>0]=e.charCodeAt(n);I[t>>0]=0},Ra=(e,t)=>{var n=0;return Ie().forEach((o,s)=>{var u=t+n;M[e+s*4>>2]=u,Da(o,u),n+=o.length+1}),0},ka=(e,t)=>{var n=Ie();M[e>>2]=n.length;var o=0;return n.forEach(s=>o+=s.length+1),M[t>>2]=o,0},Fa=e=>e,tt=e=>e%4===0&&(e%100!==0||e%400===0),Ia=(e,t)=>{for(var n=0,o=0;o<=t;n+=e[o++]);return n},nr=[31,29,31,30,31,30,31,31,30,31,30,31],ar=[31,28,31,30,31,30,31,31,30,31,30,31],Wa=(e,t)=>{for(var n=new Date(e.getTime());t>0;){var o=tt(n.getFullYear()),s=n.getMonth(),u=(o?nr:ar)[s];if(t>u-n.getDate())t-=u-n.getDate()+1,n.setDate(1),s<11?n.setMonth(s+1):(n.setMonth(0),n.setFullYear(n.getFullYear()+1));else return n.setDate(n.getDate()+t),n}return n};function Ua(e,t,n){var o=Zt(e)+1,s=new Array(o);return Kt(e,s,0,s.length),s}var La=(e,t)=>{I.set(e,t)},Ha=(e,t,n,o)=>{var s=M[o+40>>2],u={tm_sec:O[o>>2],tm_min:O[o+4>>2],tm_hour:O[o+8>>2],tm_mday:O[o+12>>2],tm_mon:O[o+16>>2],tm_year:O[o+20>>2],tm_wday:O[o+24>>2],tm_yday:O[o+28>>2],tm_isdst:O[o+32>>2],tm_gmtoff:O[o+36>>2],tm_zone:s?At(s):""},l=At(n),d={"%c":"%a %b %d %H:%M:%S %Y","%D":"%m/%d/%y","%F":"%Y-%m-%d","%h":"%b","%r":"%I:%M:%S %p","%R":"%H:%M","%T":"%H:%M:%S","%x":"%m/%d/%y","%X":"%H:%M:%S","%Ec":"%c","%EC":"%C","%Ex":"%m/%d/%y","%EX":"%H:%M:%S","%Ey":"%y","%EY":"%Y","%Od":"%d","%Oe":"%e","%OH":"%H","%OI":"%I","%Om":"%m","%OM":"%M","%OS":"%S","%Ou":"%u","%OU":"%U","%OV":"%V","%Ow":"%w","%OW":"%W","%Oy":"%y"};for(var v in d)l=l.replace(new RegExp(v,"g"),d[v]);var g=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],C=["January","February","March","April","May","June","July","August","September","October","November","December"];function S(m,$,B){for(var J=typeof m=="number"?m.toString():m||"";J.length<$;)J=B[0]+J;return J}function P(m,$){return S(m,$,"0")}function E(m,$){function B(Se){return Se<0?-1:Se>0?1:0}var J;return(J=B(m.getFullYear()-$.getFullYear()))===0&&(J=B(m.getMonth()-$.getMonth()))===0&&(J=B(m.getDate()-$.getDate())),J}function U(m){switch(m.getDay()){case 0:return new Date(m.getFullYear()-1,11,29);case 1:return m;case 2:return new Date(m.getFullYear(),0,3);case 3:return new Date(m.getFullYear(),0,2);case 4:return new Date(m.getFullYear(),0,1);case 5:return new Date(m.getFullYear()-1,11,31);case 6:return new Date(m.getFullYear()-1,11,30)}}function V(m){var $=Wa(new Date(m.tm_year+1900,0,1),m.tm_yday),B=new Date($.getFullYear(),0,4),J=new Date($.getFullYear()+1,0,4),Se=U(B),nt=U(J);return E(Se,$)<=0?E(nt,$)<=0?$.getFullYear()+1:$.getFullYear():$.getFullYear()-1}var k={"%a":m=>g[m.tm_wday].substring(0,3),"%A":m=>g[m.tm_wday],"%b":m=>C[m.tm_mon].substring(0,3),"%B":m=>C[m.tm_mon],"%C":m=>{var $=m.tm_year+1900;return P($/100|0,2)},"%d":m=>P(m.tm_mday,2),"%e":m=>S(m.tm_mday,2," "),"%g":m=>V(m).toString().substring(2),"%G":m=>V(m),"%H":m=>P(m.tm_hour,2),"%I":m=>{var $=m.tm_hour;return $==0?$=12:$>12&&($-=12),P($,2)},"%j":m=>P(m.tm_mday+Ia(tt(m.tm_year+1900)?nr:ar,m.tm_mon-1),3),"%m":m=>P(m.tm_mon+1,2),"%M":m=>P(m.tm_min,2),"%n":()=>`
  3. `,"%p":m=>m.tm_hour>=0&&m.tm_hour<12?"AM":"PM","%S":m=>P(m.tm_sec,2),"%t":()=>" ","%u":m=>m.tm_wday||7,"%U":m=>{var $=m.tm_yday+7-m.tm_wday;return P(Math.floor($/7),2)},"%V":m=>{var $=Math.floor((m.tm_yday+7-(m.tm_wday+6)%7)/7);if((m.tm_wday+371-m.tm_yday-2)%7<=2&&$++,$){if($==53){var B=(m.tm_wday+371-m.tm_yday)%7;B!=4&&(B!=3||!tt(m.tm_year))&&($=1)}}else{$=52;var J=(m.tm_wday+7-m.tm_yday-1)%7;(J==4||J==5&&tt(m.tm_year%400-1))&&$++}return P($,2)},"%w":m=>m.tm_wday,"%W":m=>{var $=m.tm_yday+7-(m.tm_wday+6)%7;return P(Math.floor($/7),2)},"%y":m=>(m.tm_year+1900).toString().substring(2),"%Y":m=>m.tm_year+1900,"%z":m=>{var $=m.tm_gmtoff,B=$>=0;return $=Math.abs($)/60,$=$/60*100+$%60,(B?"+":"-")+("0000"+$).slice(-4)},"%Z":m=>m.tm_zone,"%%":()=>"%"};l=l.replace(/%%/g,"\0\0");for(var v in k)l.includes(v)&&(l=l.replace(new RegExp(v,"g"),k[v](u)));l=l.replace(/\0\0/g,"%");var Y=Ua(l);return Y.length>t?0:(La(Y,e),Y.length-1)},Na=(e,t,n,o,s)=>Ha(e,t,n,o);Wt=a.InternalError=class extends Error{constructor(e){super(e),this.name="InternalError"}},pn(),_e=a.BindingError=class extends Error{constructor(e){super(e),this.name="BindingError"}},Pn(),Tn(),Rn(),Gt=a.UnboundTypeError=Wn(Error,"UnboundTypeError"),Vn(),zn();var Va={s:rn,u:nn,b:on,g:sn,q:cn,J:un,f:ln,V:dn,d:an,da:fn,Q:hn,_:mn,ca:Un,ba:Hn,w:Nn,Y:qn,x:Gn,h:Yn,L:Xn,M:Kn,t:ea,o:ta,K:aa,C:da,A:fa,ea:ha,$:pa,R:va,ha:Et,fa:ga,Z:$a,N:_a,O:Sa,aa:Pa,B:Ea,X:Oa,W:xa,T:Ra,U:ka,E:oo,D:Ga,F:ao,n:io,a:Ba,e:Qa,m:Ja,k:Ka,H:ro,v:eo,G:no,z:co,P:lo,l:Xa,j:Ya,c:qa,p:za,I:to,r:so,i:Za,y:uo,ga:Fa,S:Na},q=tn(),se=a._free=e=>(se=a._free=q.ka)(e),Dt=a._malloc=e=>(Dt=a._malloc=q.la)(e),or=e=>(or=q.na)(e),W=(e,t)=>(W=q.oa)(e,t),We=e=>(We=q.pa)(e),H=()=>(H=q.qa)(),N=e=>(N=q.ra)(e),ir=e=>(ir=q.sa)(e),sr=e=>(sr=q.ta)(e),cr=(e,t,n)=>(cr=q.ua)(e,t,n),ur=e=>(ur=q.va)(e);a.dynCall_viijii=(e,t,n,o,s,u,l)=>(a.dynCall_viijii=q.wa)(e,t,n,o,s,u,l);var lr=a.dynCall_jiiii=(e,t,n,o,s)=>(lr=a.dynCall_jiiii=q.xa)(e,t,n,o,s);a.dynCall_iiiiij=(e,t,n,o,s,u,l)=>(a.dynCall_iiiiij=q.ya)(e,t,n,o,s,u,l),a.dynCall_iiiiijj=(e,t,n,o,s,u,l,d,v)=>(a.dynCall_iiiiijj=q.za)(e,t,n,o,s,u,l,d,v),a.dynCall_iiiiiijj=(e,t,n,o,s,u,l,d,v,g)=>(a.dynCall_iiiiiijj=q.Aa)(e,t,n,o,s,u,l,d,v,g);function Ba(e,t){var n=H();try{return L(e)(t)}catch(o){if(N(n),o!==o+0)throw o;W(1,0)}}function za(e,t,n,o){var s=H();try{L(e)(t,n,o)}catch(u){if(N(s),u!==u+0)throw u;W(1,0)}}function qa(e,t,n){var o=H();try{L(e)(t,n)}catch(s){if(N(o),s!==s+0)throw s;W(1,0)}}function Ja(e,t,n,o){var s=H();try{return L(e)(t,n,o)}catch(u){if(N(s),u!==u+0)throw u;W(1,0)}}function Ga(e,t,n,o,s){var u=H();try{return L(e)(t,n,o,s)}catch(l){if(N(u),l!==l+0)throw l;W(1,0)}}function Ya(e,t){var n=H();try{L(e)(t)}catch(o){if(N(n),o!==o+0)throw o;W(1,0)}}function Qa(e,t,n){var o=H();try{return L(e)(t,n)}catch(s){if(N(o),s!==s+0)throw s;W(1,0)}}function Xa(e){var t=H();try{L(e)()}catch(n){if(N(t),n!==n+0)throw n;W(1,0)}}function Ka(e,t,n,o,s){var u=H();try{return L(e)(t,n,o,s)}catch(l){if(N(u),l!==l+0)throw l;W(1,0)}}function Za(e,t,n,o,s,u,l,d,v,g,C){var S=H();try{L(e)(t,n,o,s,u,l,d,v,g,C)}catch(P){if(N(S),P!==P+0)throw P;W(1,0)}}function eo(e,t,n,o,s,u,l){var d=H();try{return L(e)(t,n,o,s,u,l)}catch(v){if(N(d),v!==v+0)throw v;W(1,0)}}function to(e,t,n,o,s){var u=H();try{L(e)(t,n,o,s)}catch(l){if(N(u),l!==l+0)throw l;W(1,0)}}function ro(e,t,n,o,s,u){var l=H();try{return L(e)(t,n,o,s,u)}catch(d){if(N(l),d!==d+0)throw d;W(1,0)}}function no(e,t,n,o,s,u,l,d){var v=H();try{return L(e)(t,n,o,s,u,l,d)}catch(g){if(N(v),g!==g+0)throw g;W(1,0)}}function ao(e,t,n,o){var s=H();try{return L(e)(t,n,o)}catch(u){if(N(s),u!==u+0)throw u;W(1,0)}}function oo(e,t,n,o){var s=H();try{return L(e)(t,n,o)}catch(u){if(N(s),u!==u+0)throw u;W(1,0)}}function io(e){var t=H();try{return L(e)()}catch(n){if(N(t),n!==n+0)throw n;W(1,0)}}function so(e,t,n,o,s,u,l,d){var v=H();try{L(e)(t,n,o,s,u,l,d)}catch(g){if(N(v),g!==g+0)throw g;W(1,0)}}function co(e,t,n,o,s,u,l,d,v,g,C,S){var P=H();try{return L(e)(t,n,o,s,u,l,d,v,g,C,S)}catch(E){if(N(P),E!==E+0)throw E;W(1,0)}}function uo(e,t,n,o,s,u,l,d,v,g,C,S,P,E,U,V){var k=H();try{L(e)(t,n,o,s,u,l,d,v,g,C,S,P,E,U,V)}catch(Y){if(N(k),Y!==Y+0)throw Y;W(1,0)}}function lo(e,t,n,o,s){var u=H();try{return lr(e,t,n,o,s)}catch(l){if(N(u),l!==l+0)throw l;W(1,0)}}var rt;ye=function e(){rt||dr(),rt||(ye=e)};function dr(){if(ee>0||(He(),ee>0))return;function e(){rt||(rt=!0,a.calledRun=!0,!F&&(ct(),c(a),a.onRuntimeInitialized&&a.onRuntimeInitialized(),ut()))}a.setStatus?(a.setStatus("Running..."),setTimeout(function(){setTimeout(function(){a.setStatus("")},1),e()},1)):e()}if(a.preInit)for(typeof a.preInit=="function"&&(a.preInit=[a.preInit]);a.preInit.length>0;)a.preInit.pop()();return dr(),i.ready}})();function Jo(r){return Ft(It,r)}async function Go(r,i){return zo(It,r,i)}async function Yo(r,i){return qo(It,r,i)}var Le;class Lr extends EventTarget{constructor(i={}){var a;super(),Co(this,Le,void 0);try{const c=(a=i==null?void 0:i.formats)==null?void 0:a.filter(f=>f!=="unknown");if((c==null?void 0:c.length)===0)throw new TypeError("Hint option provided, but is empty.");c==null||c.forEach(f=>{if(!ot.has(f))throw new TypeError(`Failed to read the 'formats' property from 'BarcodeDetectorOptions': The provided value '${f}' is not a valid enum value of type BarcodeFormat.`)}),To(this,Le,c??[]),Jo().then(f=>{this.dispatchEvent(new CustomEvent("load",{detail:f}))}).catch(f=>{this.dispatchEvent(new CustomEvent("error",{detail:f}))})}catch(c){throw vr(c,"Failed to construct 'BarcodeDetector'")}}static async getSupportedFormats(){return $o.filter(i=>i!=="unknown")}async detect(i){try{const a=await Ao(i);if(a===null)return[];let c;try{Fr(a)?c=await Go(a,{tryHarder:!0,formats:pr(this,Le).map(f=>ot.get(f))}):c=await Yo(a,{tryHarder:!0,formats:pr(this,Le).map(f=>ot.get(f))})}catch(f){throw console.error(f),new DOMException("Barcode detection service unavailable.","NotSupportedError")}return c.map(f=>{const{topLeft:{x:p,y},topRight:{x:_,y:h},bottomLeft:{x:w,y:T},bottomRight:{x:b,y:j}}=f.position,D=Math.min(p,_,w,b),x=Math.min(y,h,T,j),F=Math.max(p,_,w,b),I=Math.max(y,h,T,j);return{boundingBox:new DOMRectReadOnly(D,x,F-D,I-x),rawValue:f.text,format:_o(f.format),cornerPoints:[{x:p,y},{x:_,y:h},{x:b,y:j},{x:w,y:T}]}})}catch(a){throw vr(a,"Failed to execute 'detect' on 'BarcodeDetector'")}}}Le=new WeakMap;const Hr=(r,i,a="error")=>{let c,f;const p=new Promise((y,_)=>{c=y,f=_,r.addEventListener(i,c),r.addEventListener(a,f)});return p.finally(()=>{r.removeEventListener(i,c),r.removeEventListener(a,f)}),p},wr=r=>new Promise(i=>setTimeout(i,r));class Nr extends Error{constructor(){super("this browser has no Stream API support"),this.name="StreamApiNotSupportedError"}}class Qo extends Error{constructor(){super("camera access is only permitted in secure context. Use HTTPS or localhost rather than HTTP."),this.name="InsecureContextError"}}class Xo extends Error{constructor(){super("Loading camera stream timed out after 6 seconds. If you are on iOS in PWA mode, this is a known issue (see https://github.com/gruhn/vue-qrcode-reader/issues/298)"),this.name="StreamLoadTimeoutError"}}let kt;const Ko=r=>{kt=new Lr({formats:r})},Zo=async(r,{detectHandler:i,locateHandler:a,minDelay:c,formats:f})=>{console.debug("[vue-qrcode-reader] start scanning"),kt=new Lr({formats:f});const p=y=>async _=>{if(r.readyState===0)console.debug("[vue-qrcode-reader] stop scanning: video element readyState is 0");else{const{lastScanned:h,contentBefore:w,lastScanHadContent:T}=y;if(_-h<c)window.requestAnimationFrame(p(y));else{const b=await kt.detect(r),j=b.some(F=>!w.includes(F.rawValue));j&&i(b);const D=b.length>0;D&&a(b),!D&&T&&a(b);const x={lastScanned:_,lastScanHadContent:D,contentBefore:j?b.map(F=>F.rawValue):w};window.requestAnimationFrame(p(x))}}};p({lastScanned:performance.now(),contentBefore:[],lastScanHadContent:!1})(performance.now())};var Vr={},Q={};Object.defineProperty(Q,"__esModule",{value:!0});Q.compactObject=qr;Q.deprecated=ci;var ei=Q.detectBrowser=ui;Q.disableLog=oi;Q.disableWarnings=ii;Q.extractVersion=it;Q.filterStats=li;Q.log=si;Q.walkStats=st;Q.wrapPeerConnectionEvent=ai;function ti(r,i,a){return i=ri(i),i in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a,r}function ri(r){var i=ni(r,"string");return ve(i)==="symbol"?i:String(i)}function ni(r,i){if(ve(r)!=="object"||r===null)return r;var a=r[Symbol.toPrimitive];if(a!==void 0){var c=a.call(r,i||"default");if(ve(c)!=="object")return c;throw new TypeError("@@toPrimitive must return a primitive value.")}return(i==="string"?String:Number)(r)}function ve(r){"@babel/helpers - typeof";return ve=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(i){return typeof i}:function(i){return i&&typeof Symbol=="function"&&i.constructor===Symbol&&i!==Symbol.prototype?"symbol":typeof i},ve(r)}var Br=!0,zr=!0;function it(r,i,a){var c=r.match(i);return c&&c.length>=a&&parseInt(c[a],10)}function ai(r,i,a){if(r.RTCPeerConnection){var c=r.RTCPeerConnection.prototype,f=c.addEventListener;c.addEventListener=function(y,_){if(y!==i)return f.apply(this,arguments);var h=function(w){var T=a(w);T&&(_.handleEvent?_.handleEvent(T):_(T))};return this._eventMap=this._eventMap||{},this._eventMap[i]||(this._eventMap[i]=new Map),this._eventMap[i].set(_,h),f.apply(this,[y,h])};var p=c.removeEventListener;c.removeEventListener=function(y,_){if(y!==i||!this._eventMap||!this._eventMap[i])return p.apply(this,arguments);if(!this._eventMap[i].has(_))return p.apply(this,arguments);var h=this._eventMap[i].get(_);return this._eventMap[i].delete(_),this._eventMap[i].size===0&&delete this._eventMap[i],Object.keys(this._eventMap).length===0&&delete this._eventMap,p.apply(this,[y,h])},Object.defineProperty(c,"on"+i,{get:function(){return this["_on"+i]},set:function(y){this["_on"+i]&&(this.removeEventListener(i,this["_on"+i]),delete this["_on"+i]),y&&this.addEventListener(i,this["_on"+i]=y)},enumerable:!0,configurable:!0})}}function oi(r){return typeof r!="boolean"?new Error("Argument type: "+ve(r)+". Please use a boolean."):(Br=r,r?"adapter.js logging disabled":"adapter.js logging enabled")}function ii(r){return typeof r!="boolean"?new Error("Argument type: "+ve(r)+". Please use a boolean."):(zr=!r,"adapter.js deprecation warnings "+(r?"disabled":"enabled"))}function si(){if((typeof window>"u"?"undefined":ve(window))==="object"){if(Br)return;typeof console<"u"&&typeof console.log=="function"&&console.log.apply(console,arguments)}}function ci(r,i){zr&&console.warn(r+" is deprecated, please use "+i+" instead.")}function ui(r){var i={browser:null,version:null};if(typeof r>"u"||!r.navigator||!r.navigator.userAgent)return i.browser="Not a browser.",i;var a=r.navigator;if(a.mozGetUserMedia)i.browser="firefox",i.version=it(a.userAgent,/Firefox\/(\d+)\./,1);else if(a.webkitGetUserMedia||r.isSecureContext===!1&&r.webkitRTCPeerConnection)i.browser="chrome",i.version=it(a.userAgent,/Chrom(e|ium)\/(\d+)\./,2);else if(r.RTCPeerConnection&&a.userAgent.match(/AppleWebKit\/(\d+)\./))i.browser="safari",i.version=it(a.userAgent,/AppleWebKit\/(\d+)\./,1),i.supportsUnifiedPlan=r.RTCRtpTransceiver&&"currentDirection"in r.RTCRtpTransceiver.prototype;else return i.browser="Not a supported browser.",i;return i}function br(r){return Object.prototype.toString.call(r)==="[object Object]"}function qr(r){return br(r)?Object.keys(r).reduce(function(i,a){var c=br(r[a]),f=c?qr(r[a]):r[a],p=c&&!Object.keys(f).length;return f===void 0||p?i:Object.assign(i,ti({},a,f))},{}):r}function st(r,i,a){!i||a.has(i.id)||(a.set(i.id,i),Object.keys(i).forEach(function(c){c.endsWith("Id")?st(r,r.get(i[c]),a):c.endsWith("Ids")&&i[c].forEach(function(f){st(r,r.get(f),a)})}))}function li(r,i,a){var c=a?"outbound-rtp":"inbound-rtp",f=new Map;if(i===null)return f;var p=[];return r.forEach(function(y){y.type==="track"&&y.trackIdentifier===i.id&&p.push(y)}),p.forEach(function(y){r.forEach(function(_){_.type===c&&_.trackId===y.id&&st(r,_,f)})}),f}Object.defineProperty(Vr,"__esModule",{value:!0});var di=Vr.shimGetUserMedia=pi,fi=hi(Q);function Jr(r){if(typeof WeakMap!="function")return null;var i=new WeakMap,a=new WeakMap;return(Jr=function(c){return c?a:i})(r)}function hi(r,i){if(r&&r.__esModule)return r;if(r===null||pe(r)!=="object"&&typeof r!="function")return{default:r};var a=Jr(i);if(a&&a.has(r))return a.get(r);var c={},f=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var p in r)if(p!=="default"&&Object.prototype.hasOwnProperty.call(r,p)){var y=f?Object.getOwnPropertyDescriptor(r,p):null;y&&(y.get||y.set)?Object.defineProperty(c,p,y):c[p]=r[p]}return c.default=r,a&&a.set(r,c),c}function pe(r){"@babel/helpers - typeof";return pe=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(i){return typeof i}:function(i){return i&&typeof Symbol=="function"&&i.constructor===Symbol&&i!==Symbol.prototype?"symbol":typeof i},pe(r)}var Cr=fi.log;function pi(r,i){var a=r&&r.navigator;if(a.mediaDevices){var c=function(h){if(pe(h)!=="object"||h.mandatory||h.optional)return h;var w={};return Object.keys(h).forEach(function(T){if(!(T==="require"||T==="advanced"||T==="mediaSource")){var b=pe(h[T])==="object"?h[T]:{ideal:h[T]};b.exact!==void 0&&typeof b.exact=="number"&&(b.min=b.max=b.exact);var j=function(x,F){return x?x+F.charAt(0).toUpperCase()+F.slice(1):F==="deviceId"?"sourceId":F};if(b.ideal!==void 0){w.optional=w.optional||[];var D={};typeof b.ideal=="number"?(D[j("min",T)]=b.ideal,w.optional.push(D),D={},D[j("max",T)]=b.ideal,w.optional.push(D)):(D[j("",T)]=b.ideal,w.optional.push(D))}b.exact!==void 0&&typeof b.exact!="number"?(w.mandatory=w.mandatory||{},w.mandatory[j("",T)]=b.exact):["min","max"].forEach(function(x){b[x]!==void 0&&(w.mandatory=w.mandatory||{},w.mandatory[j(x,T)]=b[x])})}}),h.advanced&&(w.optional=(w.optional||[]).concat(h.advanced)),w},f=function(h,w){if(i.version>=61)return w(h);if(h=JSON.parse(JSON.stringify(h)),h&&pe(h.audio)==="object"){var T=function(x,F,I){F in x&&!(I in x)&&(x[I]=x[F],delete x[F])};h=JSON.parse(JSON.stringify(h)),T(h.audio,"autoGainControl","googAutoGainControl"),T(h.audio,"noiseSuppression","googNoiseSuppression"),h.audio=c(h.audio)}if(h&&pe(h.video)==="object"){var b=h.video.facingMode;b=b&&(pe(b)==="object"?b:{ideal:b});var j=i.version<66;if(b&&(b.exact==="user"||b.exact==="environment"||b.ideal==="user"||b.ideal==="environment")&&!(a.mediaDevices.getSupportedConstraints&&a.mediaDevices.getSupportedConstraints().facingMode&&!j)){delete h.video.facingMode;var D;if(b.exact==="environment"||b.ideal==="environment"?D=["back","rear"]:(b.exact==="user"||b.ideal==="user")&&(D=["front"]),D)return a.mediaDevices.enumerateDevices().then(function(x){x=x.filter(function(I){return I.kind==="videoinput"});var F=x.find(function(I){return D.some(function(z){return I.label.toLowerCase().includes(z)})});return!F&&x.length&&D.includes("back")&&(F=x[x.length-1]),F&&(h.video.deviceId=b.exact?{exact:F.deviceId}:{ideal:F.deviceId}),h.video=c(h.video),Cr("chrome: "+JSON.stringify(h)),w(h)})}h.video=c(h.video)}return Cr("chrome: "+JSON.stringify(h)),w(h)},p=function(h){return i.version>=64?h:{name:{PermissionDeniedError:"NotAllowedError",PermissionDismissedError:"NotAllowedError",InvalidStateError:"NotAllowedError",DevicesNotFoundError:"NotFoundError",ConstraintNotSatisfiedError:"OverconstrainedError",TrackStartError:"NotReadableError",MediaDeviceFailedDueToShutdown:"NotAllowedError",MediaDeviceKillSwitchOn:"NotAllowedError",TabCaptureError:"AbortError",ScreenCaptureError:"AbortError",DeviceCaptureError:"AbortError"}[h.name]||h.name,message:h.message,constraint:h.constraint||h.constraintName,toString:function(){return this.name+(this.message&&": ")+this.message}}},y=function(h,w,T){f(h,function(b){a.webkitGetUserMedia(b,w,function(j){T&&T(p(j))})})};if(a.getUserMedia=y.bind(a),a.mediaDevices.getUserMedia){var _=a.mediaDevices.getUserMedia.bind(a.mediaDevices);a.mediaDevices.getUserMedia=function(h){return f(h,function(w){return _(w).then(function(T){if(w.audio&&!T.getAudioTracks().length||w.video&&!T.getVideoTracks().length)throw T.getTracks().forEach(function(b){b.stop()}),new DOMException("","NotFoundError");return T},function(T){return Promise.reject(p(T))})})}}}}var Gr={};Object.defineProperty(Gr,"__esModule",{value:!0});var vi=Gr.shimGetUserMedia=gi,mi=yi(Q);function Yr(r){if(typeof WeakMap!="function")return null;var i=new WeakMap,a=new WeakMap;return(Yr=function(c){return c?a:i})(r)}function yi(r,i){if(r&&r.__esModule)return r;if(r===null||Pe(r)!=="object"&&typeof r!="function")return{default:r};var a=Yr(i);if(a&&a.has(r))return a.get(r);var c={},f=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var p in r)if(p!=="default"&&Object.prototype.hasOwnProperty.call(r,p)){var y=f?Object.getOwnPropertyDescriptor(r,p):null;y&&(y.get||y.set)?Object.defineProperty(c,p,y):c[p]=r[p]}return c.default=r,a&&a.set(r,c),c}function Pe(r){"@babel/helpers - typeof";return Pe=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(i){return typeof i}:function(i){return i&&typeof Symbol=="function"&&i.constructor===Symbol&&i!==Symbol.prototype?"symbol":typeof i},Pe(r)}function gi(r,i){var a=r&&r.navigator,c=r&&r.MediaStreamTrack;if(a.getUserMedia=function(h,w,T){mi.deprecated("navigator.getUserMedia","navigator.mediaDevices.getUserMedia"),a.mediaDevices.getUserMedia(h).then(w,T)},!(i.version>55&&"autoGainControl"in a.mediaDevices.getSupportedConstraints())){var f=function(h,w,T){w in h&&!(T in h)&&(h[T]=h[w],delete h[w])},p=a.mediaDevices.getUserMedia.bind(a.mediaDevices);if(a.mediaDevices.getUserMedia=function(h){return Pe(h)==="object"&&Pe(h.audio)==="object"&&(h=JSON.parse(JSON.stringify(h)),f(h.audio,"autoGainControl","mozAutoGainControl"),f(h.audio,"noiseSuppression","mozNoiseSuppression")),p(h)},c&&c.prototype.getSettings){var y=c.prototype.getSettings;c.prototype.getSettings=function(){var h=y.apply(this,arguments);return f(h,"mozAutoGainControl","autoGainControl"),f(h,"mozNoiseSuppression","noiseSuppression"),h}}if(c&&c.prototype.applyConstraints){var _=c.prototype.applyConstraints;c.prototype.applyConstraints=function(h){return this.kind==="audio"&&Pe(h)==="object"&&(h=JSON.parse(JSON.stringify(h)),f(h,"autoGainControl","mozAutoGainControl"),f(h,"noiseSuppression","mozNoiseSuppression")),_.apply(this,[h])}}}}var ne={};Object.defineProperty(ne,"__esModule",{value:!0});ne.shimAudioContext=Oi;ne.shimCallbacksAPI=$i;ne.shimConstraints=Kr;ne.shimCreateOfferLegacy=Ei;var wi=ne.shimGetUserMedia=_i;ne.shimLocalStreamsAPI=Ci;ne.shimRTCIceServerUrls=Si;ne.shimRemoteStreamsAPI=Ti;ne.shimTrackEventTransceiver=Pi;var Qr=bi(Q);function Xr(r){if(typeof WeakMap!="function")return null;var i=new WeakMap,a=new WeakMap;return(Xr=function(c){return c?a:i})(r)}function bi(r,i){if(r&&r.__esModule)return r;if(r===null||me(r)!=="object"&&typeof r!="function")return{default:r};var a=Xr(i);if(a&&a.has(r))return a.get(r);var c={},f=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var p in r)if(p!=="default"&&Object.prototype.hasOwnProperty.call(r,p)){var y=f?Object.getOwnPropertyDescriptor(r,p):null;y&&(y.get||y.set)?Object.defineProperty(c,p,y):c[p]=r[p]}return c.default=r,a&&a.set(r,c),c}function me(r){"@babel/helpers - typeof";return me=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(i){return typeof i}:function(i){return i&&typeof Symbol=="function"&&i.constructor===Symbol&&i!==Symbol.prototype?"symbol":typeof i},me(r)}function Ci(r){if(!(me(r)!=="object"||!r.RTCPeerConnection)){if("getLocalStreams"in r.RTCPeerConnection.prototype||(r.RTCPeerConnection.prototype.getLocalStreams=function(){return this._localStreams||(this._localStreams=[]),this._localStreams}),!("addStream"in r.RTCPeerConnection.prototype)){var i=r.RTCPeerConnection.prototype.addTrack;r.RTCPeerConnection.prototype.addStream=function(a){var c=this;this._localStreams||(this._localStreams=[]),this._localStreams.includes(a)||this._localStreams.push(a),a.getAudioTracks().forEach(function(f){return i.call(c,f,a)}),a.getVideoTracks().forEach(function(f){return i.call(c,f,a)})},r.RTCPeerConnection.prototype.addTrack=function(a){for(var c=this,f=arguments.length,p=new Array(f>1?f-1:0),y=1;y<f;y++)p[y-1]=arguments[y];return p&&p.forEach(function(_){c._localStreams?c._localStreams.includes(_)||c._localStreams.push(_):c._localStreams=[_]}),i.apply(this,arguments)}}"removeStream"in r.RTCPeerConnection.prototype||(r.RTCPeerConnection.prototype.removeStream=function(a){var c=this;this._localStreams||(this._localStreams=[]);var f=this._localStreams.indexOf(a);if(f!==-1){this._localStreams.splice(f,1);var p=a.getTracks();this.getSenders().forEach(function(y){p.includes(y.track)&&c.removeTrack(y)})}})}}function Ti(r){if(!(me(r)!=="object"||!r.RTCPeerConnection)&&("getRemoteStreams"in r.RTCPeerConnection.prototype||(r.RTCPeerConnection.prototype.getRemoteStreams=function(){return this._remoteStreams?this._remoteStreams:[]}),!("onaddstream"in r.RTCPeerConnection.prototype))){Object.defineProperty(r.RTCPeerConnection.prototype,"onaddstream",{get:function(){return this._onaddstream},set:function(a){var c=this;this._onaddstream&&(this.removeEventListener("addstream",this._onaddstream),this.removeEventListener("track",this._onaddstreampoly)),this.addEventListener("addstream",this._onaddstream=a),this.addEventListener("track",this._onaddstreampoly=function(f){f.streams.forEach(function(p){if(c._remoteStreams||(c._remoteStreams=[]),!c._remoteStreams.includes(p)){c._remoteStreams.push(p);var y=new Event("addstream");y.stream=p,c.dispatchEvent(y)}})})}});var i=r.RTCPeerConnection.prototype.setRemoteDescription;r.RTCPeerConnection.prototype.setRemoteDescription=function(){var a=this;return this._onaddstreampoly||this.addEventListener("track",this._onaddstreampoly=function(c){c.streams.forEach(function(f){if(a._remoteStreams||(a._remoteStreams=[]),!(a._remoteStreams.indexOf(f)>=0)){a._remoteStreams.push(f);var p=new Event("addstream");p.stream=f,a.dispatchEvent(p)}})}),i.apply(a,arguments)}}}function $i(r){if(!(me(r)!=="object"||!r.RTCPeerConnection)){var i=r.RTCPeerConnection.prototype,a=i.createOffer,c=i.createAnswer,f=i.setLocalDescription,p=i.setRemoteDescription,y=i.addIceCandidate;i.createOffer=function(h,w){var T=arguments.length>=2?arguments[2]:arguments[0],b=a.apply(this,[T]);return w?(b.then(h,w),Promise.resolve()):b},i.createAnswer=function(h,w){var T=arguments.length>=2?arguments[2]:arguments[0],b=c.apply(this,[T]);return w?(b.then(h,w),Promise.resolve()):b};var _=function(h,w,T){var b=f.apply(this,[h]);return T?(b.then(w,T),Promise.resolve()):b};i.setLocalDescription=_,_=function(h,w,T){var b=p.apply(this,[h]);return T?(b.then(w,T),Promise.resolve()):b},i.setRemoteDescription=_,_=function(h,w,T){var b=y.apply(this,[h]);return T?(b.then(w,T),Promise.resolve()):b},i.addIceCandidate=_}}function _i(r){var i=r&&r.navigator;if(i.mediaDevices&&i.mediaDevices.getUserMedia){var a=i.mediaDevices,c=a.getUserMedia.bind(a);i.mediaDevices.getUserMedia=function(f){return c(Kr(f))}}!i.getUserMedia&&i.mediaDevices&&i.mediaDevices.getUserMedia&&(i.getUserMedia=(function(f,p,y){i.mediaDevices.getUserMedia(f).then(p,y)}).bind(i))}function Kr(r){return r&&r.video!==void 0?Object.assign({},r,{video:Qr.compactObject(r.video)}):r}function Si(r){if(r.RTCPeerConnection){var i=r.RTCPeerConnection;r.RTCPeerConnection=function(a,c){if(a&&a.iceServers){for(var f=[],p=0;p<a.iceServers.length;p++){var y=a.iceServers[p];y.urls===void 0&&y.url?(Qr.deprecated("RTCIceServer.url","RTCIceServer.urls"),y=JSON.parse(JSON.stringify(y)),y.urls=y.url,delete y.url,f.push(y)):f.push(a.iceServers[p])}a.iceServers=f}return new i(a,c)},r.RTCPeerConnection.prototype=i.prototype,"generateCertificate"in i&&Object.defineProperty(r.RTCPeerConnection,"generateCertificate",{get:function(){return i.generateCertificate}})}}function Pi(r){me(r)==="object"&&r.RTCTrackEvent&&"receiver"in r.RTCTrackEvent.prototype&&!("transceiver"in r.RTCTrackEvent.prototype)&&Object.defineProperty(r.RTCTrackEvent.prototype,"transceiver",{get:function(){return{receiver:this.receiver}}})}function Ei(r){var i=r.RTCPeerConnection.prototype.createOffer;r.RTCPeerConnection.prototype.createOffer=function(a){if(a){typeof a.offerToReceiveAudio<"u"&&(a.offerToReceiveAudio=!!a.offerToReceiveAudio);var c=this.getTransceivers().find(function(p){return p.receiver.track.kind==="audio"});a.offerToReceiveAudio===!1&&c?c.direction==="sendrecv"?c.setDirection?c.setDirection("sendonly"):c.direction="sendonly":c.direction==="recvonly"&&(c.setDirection?c.setDirection("inactive"):c.direction="inactive"):a.offerToReceiveAudio===!0&&!c&&this.addTransceiver("audio",{direction:"recvonly"}),typeof a.offerToReceiveVideo<"u"&&(a.offerToReceiveVideo=!!a.offerToReceiveVideo);var f=this.getTransceivers().find(function(p){return p.receiver.track.kind==="video"});a.offerToReceiveVideo===!1&&f?f.direction==="sendrecv"?f.setDirection?f.setDirection("sendonly"):f.direction="sendonly":f.direction==="recvonly"&&(f.setDirection?f.setDirection("inactive"):f.direction="inactive"):a.offerToReceiveVideo===!0&&!f&&this.addTransceiver("video",{direction:"recvonly"})}return i.apply(this,arguments)}}function Oi(r){me(r)!=="object"||r.AudioContext||(r.AudioContext=r.webkitAudioContext)}const Mi=r=>{let i=!1,a;return(...c)=>(i||(a=r(c),i=!0),a)};function ce(r,i){if(r===!1)throw new Error(i??"assertion failure")}function Tr(r){throw new Error("this code should be unreachable")}const Ai=Mi(()=>{const r=ei(window);switch(r.browser){case"chrome":di(window,r);break;case"firefox":vi(window,r);break;case"safari":wi(window,r);break;default:throw new Nr}});let Ee=Promise.resolve({type:"stop",data:{}});async function $r(r,i,a){var c,f,p;if(console.debug("[vue-qrcode-reader] starting camera with constraints: ",JSON.stringify(i)),window.isSecureContext!==!0)throw new Qo;if(((c=navigator==null?void 0:navigator.mediaDevices)==null?void 0:c.getUserMedia)===void 0)throw new Nr;Ai(),console.debug("[vue-qrcode-reader] calling getUserMedia");const y=await navigator.mediaDevices.getUserMedia({audio:!1,video:i});r.srcObject!==void 0?r.srcObject=y:r.mozSrcObject!==void 0?r.mozSrcObject=y:window.URL.createObjectURL?r.src=window.URL.createObjectURL(y):window.webkitURL?r.src=window.webkitURL.createObjectURL(y):r.src=y.id,r.play(),console.debug("[vue-qrcode-reader] waiting for video element to load"),await Promise.race([Hr(r,"loadeddata"),wr(6e3).then(()=>{throw new Xo})]),console.debug("[vue-qrcode-reader] video element loaded"),await wr(500);const[_]=y.getVideoTracks(),h=(p=(f=_==null?void 0:_.getCapabilities)==null?void 0:f.call(_))!=null?p:{};let w=!1;return a&&h.torch&&(await _.applyConstraints({advanced:[{torch:!0}]}),w=!0),console.debug("[vue-qrcode-reader] camera ready"),{type:"start",data:{videoEl:r,stream:y,capabilities:h,constraints:i,isTorchOn:w}}}async function xi(r,{constraints:i,torch:a,restart:c=!1}){Ee=Ee.then(p=>{if(p.type==="start"){const{data:{videoEl:y,stream:_,constraints:h,isTorchOn:w}}=p;return!c&&r===y&&i===h&&a===w?p:Zr(y,_,w).then(()=>$r(r,i,a))}else if(p.type==="stop"||p.type==="failed")return $r(r,i,a);Tr()}).catch(p=>(console.debug(`[vue-qrcode-reader] starting camera failed with "${p}"`),{type:"failed",error:p}));const f=await Ee;if(f.type==="stop")throw new Error("Something went wrong with the camera task queue (start task).");if(f.type==="failed")throw f.error;if(f.type==="start")return f.data.capabilities;Tr()}async function Zr(r,i,a){console.debug("[vue-qrcode-reader] stopping camera"),r.src="",r.srcObject=null,r.load(),await Hr(r,"error");for(const c of i.getTracks())a!=null||await c.applyConstraints({advanced:[{torch:!1}]}),i.removeTrack(c),c.stop();return{type:"stop",data:{}}}async function at(){if(Ee=Ee.then(r=>{if(r.type==="stop"||r.type==="failed")return r;const{data:{videoEl:i,stream:a,isTorchOn:c}}=r;return Zr(i,a,c)}),(await Ee).type==="start")throw new Error("Something went wrong with the camera task queue (stop task).")}const ji=_r({__name:"QrcodeStream",props:{constraints:{type:Object,default(){return{facingMode:"environment"}}},formats:{type:Array,default:()=>["qr_code"]},paused:{type:Boolean,default:!1},torch:{type:Boolean,default:!1},track:{type:Function}},emits:["detect","camera-on","camera-off","error"],setup(r,{emit:i}){const a=r,c=i,f=he(a.constraints),p=he(a.formats);Ue(()=>a.constraints,(R,O)=>{JSON.stringify(R)!==JSON.stringify(O)&&(f.value=R)},{deep:!0}),Ue(()=>a.formats,(R,O)=>{JSON.stringify(R)!==JSON.stringify(O)&&(p.value=R)},{deep:!0});const y=he(),_=he(),h=he(),w=he(!1),T=he(!1);fo(()=>{T.value=!0}),ho(()=>{at()});const b=Rt(()=>({torch:a.torch,constraints:f.value,shouldStream:T.value&&!a.paused}));Ue(b,async R=>{const O=h.value;ce(O!==void 0,"cameraSettings watcher should never be triggered when component is not mounted. Thus video element should always be defined.");const M=y.value;ce(M!==void 0,"cameraSettings watcher should never be triggered when component is not mounted. Thus canvas should always be defined.");const le=M.getContext("2d");if(ce(le!==null,"if cavnas is defined, canvas 2d context should also be non-null"),R.shouldStream){at(),w.value=!1;try{const ae=await xi(O,R);T.value?(w.value=!0,c("camera-on",ae)):await at()}catch(ae){c("error",ae)}}else M.width=O.videoWidth,M.height=O.videoHeight,le.drawImage(O,0,0,O.videoWidth,O.videoHeight),at(),w.value=!1,c("camera-off")},{deep:!0}),Ue(p,R=>{T.value&&Ko(R)});const j=Rt(()=>b.value.shouldStream&&w.value);Ue(j,R=>{if(R){ce(y.value!==void 0,"shouldScan watcher should only be triggered when component is mounted. Thus pause frame canvas is defined"),D(y.value),ce(_.value!==void 0,"shouldScan watcher should only be triggered when component is mounted. Thus tracking canvas is defined"),D(_.value);const O=()=>a.track===void 0?500:40;ce(h.value!==void 0,"shouldScan watcher should only be triggered when component is mounted. Thus video element is defined"),Zo(h.value,{detectHandler:M=>c("detect",M),formats:p.value,locateHandler:x,minDelay:O()})}});const D=R=>{const O=R.getContext("2d");ce(O!==null,"canvas 2d context should always be non-null"),O.clearRect(0,0,R.width,R.height)},x=R=>{const O=_.value;ce(O!==void 0,"onLocate handler should only be called when component is mounted. Thus tracking canvas is always defined.");const M=h.value;if(ce(M!==void 0,"onLocate handler should only be called when component is mounted. Thus video element is always defined."),R.length===0||a.track===void 0)D(O);else{const le=M.offsetWidth,ae=M.offsetHeight,Ce=M.videoWidth,Te=M.videoHeight,Me=Math.max(le/Ce,ae/Te),Ae=Ce*Me,He=Te*Me,ct=Ae/Ce,ut=He/Te,lt=(le-Ae)/2,dt=(ae-He)/2,xe=({x:de,y:X})=>({x:Math.floor(de*ct),y:Math.floor(X*ut)}),ee=({x:de,y:X})=>({x:Math.floor(de+lt),y:Math.floor(X+dt)}),ye=R.map(de=>{const{boundingBox:X,cornerPoints:ht}=de,{x:Ne,y:fe}=ee(xe({x:X.x,y:X.y})),{x:Ve,y:pt}=xe({x:X.width,y:X.height});return{...de,cornerPoints:ht.map(Be=>ee(xe(Be))),boundingBox:DOMRectReadOnly.fromRect({x:Ne,y:fe,width:Ve,height:pt})}});O.width=M.offsetWidth,O.height=M.offsetHeight;const ft=O.getContext("2d");a.track(ye,ft)}},F={width:"100%",height:"100%",position:"relative","z-index":"0"},I={width:"100%",height:"100%",position:"absolute",top:"0",left:"0"},z={width:"100%",height:"100%","object-fit":"cover"},ue=Rt(()=>j.value?z:{...z,visibility:"hidden",position:"absolute"});return(R,O)=>(Sr(),Pr("div",{style:F},[be("video",{ref_key:"videoRef",ref:h,style:po(ue.value),autoplay:"",muted:"",playsinline:""},null,4),vo(be("canvas",{id:"qrcode-stream-pause-frame",ref_key:"pauseFrameRef",ref:y,style:z},null,512),[[mo,!j.value]]),be("canvas",{id:"qrcode-stream-tracking-layer",ref_key:"trackingLayerRef",ref:_,style:I},null,512),be("div",{style:I},[yo(R.$slots,"default")])]))}}),Di={style:{height:"100vh",width:"100vw"}},Ri={style:{padding:"20px 16px"}},ki=be("span",null,"扫码结果:",-1),Ii=_r({__name:"Index3",setup(r){const i=he(""),a=async f=>{try{await f}catch(p){console.log(p)}},c=f=>{i.value=f};return(f,p)=>(Sr(),Pr("div",Di,[be("div",Ri,[ki,be("span",null,go(i.value),1)]),wo(bo(ji),{onDecode:c,onInit:a})]))}});export{Ii as default};