From 54f6bf86a0e77c1e1d974d3d74121e89fb40b4f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?dni=20=E2=9A=A1?= Date: Fri, 11 Oct 2024 13:10:55 +0200 Subject: [PATCH] fix qrscanner --- lnbits/core/templates/core/wallet.html | 8 ++++---- lnbits/static/bundle.min.js | 2 +- lnbits/static/js/wallet.js | 2 +- lnbits/static/vendor/vue-qrcode-reader.umd.js | 2 +- package-lock.json | 7 ++++--- 5 files changed, 11 insertions(+), 10 deletions(-) diff --git a/lnbits/core/templates/core/wallet.html b/lnbits/core/templates/core/wallet.html index 0f9db18cc..5a0dfad20 100644 --- a/lnbits/core/templates/core/wallet.html +++ b/lnbits/core/templates/core/wallet.html @@ -621,8 +621,8 @@
@@ -645,8 +645,8 @@
diff --git a/lnbits/static/bundle.min.js b/lnbits/static/bundle.min.js index 85020263b..9a573e367 100644 --- a/lnbits/static/bundle.min.js +++ b/lnbits/static/bundle.min.js @@ -27,7 +27,7 @@ var Vuex=function(e){"use strict";var t="store";function n(){return"undefined"!= * vue-i18n v10.0.3 * (c) 2024 kazuya kawaguchi * Released under the MIT License. - */!function(e,t){"object"==typeof exports&&typeof module<"u"?t(exports,require("vue")):"function"==typeof define&&define.amd?define(["exports","vue"],t):t((e=typeof globalThis<"u"?globalThis:e||self).VueQrcodeReader={},e.Vue)}(this,(function(e,t){"use strict";var n=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},a=(e,t,a)=>(n(e,t,"read from private field"),a?a.call(e):t.get(e));const i=[["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"]],r=[...i,["unknown"]].map((e=>e[0])),o=new Map(i);function s(e){for(const[t,n]of o)if(e===n)return t;return"unknown"}function l(e){try{return e instanceof HTMLImageElement}catch(e){return!1}}function u(e){try{return e instanceof SVGImageElement}catch(e){return!1}}function c(e){try{return e instanceof HTMLVideoElement}catch(e){return!1}}function d(e){try{return e instanceof HTMLCanvasElement}catch(e){return!1}}function h(e){try{return e instanceof ImageBitmap}catch(e){return!1}}function p(e){try{return e instanceof OffscreenCanvas}catch(e){return!1}}function f(e){try{return e instanceof VideoFrame}catch(e){return!1}}function m(e){try{return e instanceof Blob}catch(e){return!1}}async function g(e){if(l(e)&&!await async function(e){try{return await e.decode(),!0}catch(e){return!1}}(e))throw new DOMException("Failed to load or decode HTMLImageElement.","InvalidStateError");if(u(e)&&!await async function(e){var t;try{return await(null==(t=e.decode)?void 0:t.call(e)),!0}catch(e){return!1}}(e))throw new DOMException("Failed to load or decode SVGImageElement.","InvalidStateError");if(f(e)&&function(e){return null===e.format}(e))throw new DOMException("VideoFrame is closed.","InvalidStateError");if(c(e)&&(0===e.readyState||1===e.readyState))throw new DOMException("Invalid element or state.","InvalidStateError");if(h(e)&&function(e){return 0===e.width&&0===e.height}(e))throw new DOMException("The image source is detached.","InvalidStateError");const{width:t,height:n}=function(e){if(l(e))return{width:e.naturalWidth,height:e.naturalHeight};if(u(e))return{width:e.width.baseVal.value,height:e.height.baseVal.value};if(c(e))return{width:e.videoWidth,height:e.videoHeight};if(h(e))return{width:e.width,height:e.height};if(f(e))return{width:e.displayWidth,height:e.displayHeight};if(d(e))return{width:e.width,height:e.height};if(p(e))return{width:e.width,height:e.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)'.")}(e);if(0===t||0===n)return null;const a=function(e,t){try{const n=new OffscreenCanvas(e,t);if(n.getContext("2d")instanceof OffscreenCanvasRenderingContext2D)return n;throw void 0}catch(n){const a=document.createElement("canvas");return a.width=e,a.height=t,a}}(t,n).getContext("2d");a.drawImage(e,0,0);try{return a.getImageData(0,0,t,n)}catch(e){throw new DOMException("Source would taint origin.","SecurityError")}}async function v(e){if(m(e))return await async function(e){let t;try{if(globalThis.createImageBitmap)t=await createImageBitmap(e);else{if(!globalThis.Image)return e;{t=new Image;let n="";try{n=URL.createObjectURL(e),t.src=n,await t.decode()}finally{URL.revokeObjectURL(n)}}}}catch(e){throw new DOMException("Failed to load or decode Blob.","InvalidStateError")}return await g(t)}(e);if(function(e){try{return e instanceof ImageData}catch(e){return!1}}(e)){if(function(e){return 0===e.data.buffer.byteLength}(e))throw new DOMException("The image data has been detached.","InvalidStateError");return e}return d(e)||p(e)?function(e){const{width:t,height:n}=e;if(0===t||0===n)return null;const a=e.getContext("2d");try{return a.getImageData(0,0,t,n)}catch(e){throw new DOMException("Source would taint origin.","SecurityError")}}(e):await g(e)}function b(e,t){return e instanceof DOMException?new DOMException(`${t}: ${e.message}`,e.name):e instanceof Error?new e.constructor(`${t}: ${e.message}`):new Error(`${t}: ${e}`)}const _=["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 y(e){return e.join("|")}function w(e){const t=k(e);let n=0,a=_.length-1;for(;n<=a;){const e=Math.floor((n+a)/2),i=_[e],r=k(i);if(r===t)return i;r{const n=e.match(/_(.+?)\.wasm$/);return n?`https://fastly.jsdelivr.net/npm/zxing-wasm@1.1.3/dist/${n[1]}/${e}`:t+e}};let N=new WeakMap;function R(e,t){var n;const a=N.get(e);if(null!=a&&a.modulePromise&&void 0===t)return a.modulePromise;const i=null!=(n=null==a?void 0:a.moduleOverrides)?n:O,r=e({...i});return N.set(e,{moduleOverrides:i,modulePromise:r}),r}M.formats;var I,z,q=(I=typeof document<"u"&&document.currentScript?document.currentScript.src:void 0,function(e={}){var t,n,a=e;a.ready=new Promise(((e,a)=>{t=e,n=a}));var i=Object.assign({},a),r="./this.program",o="object"==typeof window,s="function"==typeof importScripts;"object"==typeof process&&"object"==typeof process.versions&&process.versions.node;var l,u="";(o||s)&&(s?u=self.location.href:typeof document<"u"&&document.currentScript&&(u=document.currentScript.src),I&&(u=I),u=0!==u.indexOf("blob:")?u.substr(0,u.replace(/[?#].*/,"").lastIndexOf("/")+1):"",s&&(l=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 c,d=a.printErr||console.error.bind(console);Object.assign(a,i),i=null,a.arguments&&a.arguments,a.thisProgram&&(r=a.thisProgram),a.quit&&a.quit,a.wasmBinary&&(c=a.wasmBinary),"object"!=typeof WebAssembly&&A("no native wasm support detected");var h,p,f,m,g,v,b,_,y,w=!1;function k(){var e=h.buffer;a.HEAP8=p=new Int8Array(e),a.HEAP16=m=new Int16Array(e),a.HEAPU8=f=new Uint8Array(e),a.HEAPU16=g=new Uint16Array(e),a.HEAP32=v=new Int32Array(e),a.HEAPU32=b=new Uint32Array(e),a.HEAPF32=_=new Float32Array(e),a.HEAPF64=y=new Float64Array(e)}var x=[],S=[],C=[],E=0,T=null;function A(e){var t;null===(t=a.onAbort)||void 0===t||t.call(a,e),d(e="Aborted("+e+")"),w=!0,e+=". Build with -sASSERTIONS for more info.";var i=new WebAssembly.RuntimeError(e);throw n(i),i}var M,P,L=e=>e.startsWith("data:application/octet-stream;base64,");function O(e){if(e==M&&c)return new Uint8Array(c);if(l)return l(e);throw"both async and sync fetching of the wasm failed"}function N(e,t,n){return function(e){return c||!o&&!s||"function"!=typeof fetch?Promise.resolve().then((()=>O(e))):fetch(e,{credentials:"same-origin"}).then((t=>{if(!t.ok)throw"failed to load wasm binary file at '"+e+"'";return t.arrayBuffer()})).catch((()=>O(e)))}(e).then((e=>WebAssembly.instantiate(e,t))).then((e=>e)).then(n,(e=>{d(`failed to asynchronously prepare wasm: ${e}`),A(e)}))}L(M="zxing_reader.wasm")||(P=M,M=a.locateFile?a.locateFile(P,u):u+P);var R=e=>{for(;e.length>0;)e.shift()(a)};a.noExitRuntime;var z=[],q=0,D=0;function j(e){this.excPtr=e,this.ptr=e-24,this.set_type=function(e){b[this.ptr+4>>2]=e},this.get_type=function(){return b[this.ptr+4>>2]},this.set_destructor=function(e){b[this.ptr+8>>2]=e},this.get_destructor=function(){return b[this.ptr+8>>2]},this.set_caught=function(e){e=e?1:0,p[this.ptr+12|0]=e},this.get_caught=function(){return 0!=p[this.ptr+12|0]},this.set_rethrown=function(e){e=e?1:0,p[this.ptr+13|0]=e},this.get_rethrown=function(){return 0!=p[this.ptr+13|0]},this.init=function(e,t){this.set_adjusted_ptr(0),this.set_type(e),this.set_destructor(t)},this.set_adjusted_ptr=function(e){b[this.ptr+16>>2]=e},this.get_adjusted_ptr=function(){return b[this.ptr+16>>2]},this.get_exception_ptr=function(){if(Nt(this.get_type()))return b[this.excPtr>>2];var e=this.get_adjusted_ptr();return 0!==e?e:this.excPtr}}var $=e=>{var t=D;if(!t)return Tt(0),0;var n=new j(t);n.set_adjusted_ptr(t);var a=n.get_type();if(!a)return Tt(0),t;for(var i in e){var r=e[i];if(0===r||r===a)break;var o=n.ptr+16;if(Ot(r,a,o))return Tt(r),t}return Tt(a),t},B={},F=e=>{for(;e.length;){var t=e.pop();e.pop()(t)}};function V(e){return this.fromWireType(v[e>>2])}var U,H,W,Y={},Q={},K={},G=e=>{throw new U(e)},Z=(e,t,n)=>{function a(t){var a=n(t);a.length!==e.length&&G("Mismatched type converter count");for(var i=0;i{Q.hasOwnProperty(e)?i[t]=Q[e]:(r.push(e),Y.hasOwnProperty(e)||(Y[e]=[]),Y[e].push((()=>{i[t]=Q[e],++o===r.length&&a(i)})))})),0===r.length&&a(i)},J=e=>{for(var t="",n=e;f[n];)t+=H[f[n++]];return t},X=e=>{throw new W(e)};function ee(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!("argPackAdvance"in t))throw new TypeError("registerType registeredInstance requires argPackAdvance");return function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};var a=t.name;if(e||X(`type "${a}" must have a positive integer typeid pointer`),Q.hasOwnProperty(e)){if(n.ignoreDuplicateRegistrations)return;X(`Cannot register type '${a}' twice`)}if(Q[e]=t,delete K[e],Y.hasOwnProperty(e)){var i=Y[e];delete Y[e],i.forEach((e=>e()))}}(e,t,n)}var te,ne=8,ae=e=>({count:e.count,deleteScheduled:e.deleteScheduled,preservePointerOnDelete:e.preservePointerOnDelete,ptr:e.ptr,ptrType:e.ptrType,smartPtr:e.smartPtr,smartPtrType:e.smartPtrType}),ie=e=>{X(e.$$.ptrType.registeredClass.name+" instance already deleted")},re=!1,oe=e=>{},se=e=>{e.count.value-=1,0===e.count.value&&(e=>{e.smartPtr?e.smartPtrType.rawDestructor(e.smartPtr):e.ptrType.registeredClass.rawDestructor(e.ptr)})(e)},le=(e,t,n)=>{if(t===n)return e;if(void 0===n.baseClass)return null;var a=le(e,t,n.baseClass);return null===a?null:n.downcast(a)},ue={},ce=()=>Object.keys(me).length,de=()=>{var e=[];for(var t in me)me.hasOwnProperty(t)&&e.push(me[t]);return e},he=[],pe=()=>{for(;he.length;){var e=he.pop();e.$$.deleteScheduled=!1,e.delete()}},fe=e=>{te=e,he.length&&te&&te(pe)},me={},ge=(e,t)=>(t=((e,t)=>{for(void 0===t&&X("ptr should not be undefined");e.baseClass;)t=e.upcast(t),e=e.baseClass;return t})(e,t),me[t]),ve=(e,t)=>((!t.ptrType||!t.ptr)&&G("makeClassHandle requires ptr and ptrType"),!!t.smartPtrType!=!!t.smartPtr&&G("Both smartPtrType and smartPtr must be specified"),t.count={value:1},_e(Object.create(e,{$$:{value:t,writable:!0}})));function be(e){var t=this.getPointee(e);if(!t)return this.destructor(e),null;var n=ge(this.registeredClass,t);if(void 0!==n){if(0===n.$$.count.value)return n.$$.ptr=t,n.$$.smartPtr=e,n.clone();var a=n.clone();return this.destructor(e),a}function i(){return this.isSmartPointer?ve(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:t,smartPtrType:this,smartPtr:e}):ve(this.registeredClass.instancePrototype,{ptrType:this,ptr:e})}var r,o=this.registeredClass.getActualType(t),s=ue[o];if(!s)return i.call(this);r=this.isConst?s.constPointerType:s.pointerType;var l=le(t,this.registeredClass,r.registeredClass);return null===l?i.call(this):this.isSmartPointer?ve(r.registeredClass.instancePrototype,{ptrType:r,ptr:l,smartPtrType:this,smartPtr:e}):ve(r.registeredClass.instancePrototype,{ptrType:r,ptr:l})}var _e=e=>typeof FinalizationRegistry>"u"?(_e=e=>e,e):(re=new FinalizationRegistry((e=>{se(e.$$)})),oe=e=>re.unregister(e),(_e=e=>{var t=e.$$;if(t.smartPtr){var n={$$:t};re.register(e,n,e)}return e})(e));function ye(){}var we=(e,t)=>Object.defineProperty(t,"name",{value:e}),ke=(e,t,n)=>{if(void 0===e[t].overloadTable){var a=e[t];e[t]=function(){return e[t].overloadTable.hasOwnProperty(arguments.length)||X(`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[a.argCount]=a}},xe=(e,t,n)=>{a.hasOwnProperty(e)?((void 0===n||void 0!==a[e].overloadTable&&void 0!==a[e].overloadTable[n])&&X(`Cannot register public name '${e}' twice`),ke(a,e,e),a.hasOwnProperty(n)&&X(`Cannot register multiple overloads of a function with the same number of arguments (${n})!`),a[e].overloadTable[n]=t):(a[e]=t,void 0!==n&&(a[e].numArguments=n))};function Se(e,t,n,a,i,r,o,s){this.name=e,this.constructor=t,this.instancePrototype=n,this.rawDestructor=a,this.baseClass=i,this.getActualType=r,this.upcast=o,this.downcast=s,this.pureVirtualFunctions=[]}var Ce=(e,t,n)=>{for(;t!==n;)t.upcast||X(`Expected null or instance of ${n.name}, got an instance of ${t.name}`),e=t.upcast(e),t=t.baseClass;return e};function Ee(e,t){if(null===t)return this.isReference&&X(`null is not a valid ${this.name}`),0;t.$$||X(`Cannot pass "${Ge(t)}" as a ${this.name}`),t.$$.ptr||X(`Cannot pass deleted object as a pointer of type ${this.name}`);var n=t.$$.ptrType.registeredClass;return Ce(t.$$.ptr,n,this.registeredClass)}function Te(e,t){var n;if(null===t)return this.isReference&&X(`null is not a valid ${this.name}`),this.isSmartPointer?(n=this.rawConstructor(),null!==e&&e.push(this.rawDestructor,n),n):0;(!t||!t.$$)&&X(`Cannot pass "${Ge(t)}" as a ${this.name}`),t.$$.ptr||X(`Cannot pass deleted object as a pointer of type ${this.name}`),!this.isConst&&t.$$.ptrType.isConst&&X(`Cannot convert argument of type ${t.$$.smartPtrType?t.$$.smartPtrType.name:t.$$.ptrType.name} to parameter type ${this.name}`);var a=t.$$.ptrType.registeredClass;if(n=Ce(t.$$.ptr,a,this.registeredClass),this.isSmartPointer)switch(void 0===t.$$.smartPtr&&X("Passing raw pointer to smart pointer is illegal"),this.sharingPolicy){case 0:t.$$.smartPtrType===this?n=t.$$.smartPtr:X(`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 i=t.clone();n=this.rawShare(n,Ye.toHandle((()=>i.delete()))),null!==e&&e.push(this.rawDestructor,n)}break;default:X("Unsupporting sharing policy")}return n}function Ae(e,t){if(null===t)return this.isReference&&X(`null is not a valid ${this.name}`),0;t.$$||X(`Cannot pass "${Ge(t)}" as a ${this.name}`),t.$$.ptr||X(`Cannot pass deleted object as a pointer of type ${this.name}`),t.$$.ptrType.isConst&&X(`Cannot convert argument of type ${t.$$.ptrType.name} to parameter type ${this.name}`);var n=t.$$.ptrType.registeredClass;return Ce(t.$$.ptr,n,this.registeredClass)}function Me(e){return this.fromWireType(b[e>>2])}function Pe(e,t,n,a,i,r,o,s,l,u,c){this.name=e,this.registeredClass=t,this.isReference=n,this.isConst=a,this.isSmartPointer=i,this.pointeeType=r,this.sharingPolicy=o,this.rawGetPointee=s,this.rawConstructor=l,this.rawShare=u,this.rawDestructor=c,i||void 0!==t.baseClass?this.toWireType=Te:a?(this.toWireType=Ee,this.destructorFunction=null):(this.toWireType=Ae,this.destructorFunction=null)}var Le,Oe,Ne=(e,t,n)=>{a.hasOwnProperty(e)||G("Replacing nonexistant public symbol"),void 0!==a[e].overloadTable&&void 0!==n?a[e].overloadTable[n]=t:(a[e]=t,a[e].argCount=n)},Re=[],Ie=e=>{var t=Re[e];return t||(e>=Re.length&&(Re.length=e+1),Re[e]=t=Le.get(e)),t},ze=(e,t,n)=>e.includes("j")?((e,t,n)=>{var i=a["dynCall_"+e];return n&&n.length?i.apply(null,[t].concat(n)):i.call(null,t)})(e,t,n):Ie(t).apply(null,n),qe=(e,t)=>{var n=(e=J(e)).includes("j")?((e,t)=>{var n=[];return function(){return n.length=0,Object.assign(n,arguments),ze(e,t,n)}})(e,t):Ie(t);return"function"!=typeof n&&X(`unknown function pointer with signature ${e}: ${t}`),n},De=e=>{var t=Ct(e),n=J(t);return xt(t),n},je=(e,t)=>{var n=[],a={};throw t.forEach((function e(t){if(!a[t]&&!Q[t]){if(K[t])return void K[t].forEach(e);n.push(t),a[t]=!0}})),new Oe(`${e}: `+n.map(De).join([", "]))},$e=(e,t)=>{for(var n=[],a=0;a>2]);return n};function Be(e,t,n,a,i,r){var o=t.length;o<2&&X("argTypes array size mismatch! Must at least get return value and 'this' types!");var s=null!==t[1]&&null!==n,l=function(e){for(var t=1;t{const t=(e=e.trim()).indexOf("(");return-1!==t?e.substr(0,t):e};function Ve(){this.allocated=[void 0],this.freelist=[]}var Ue=new Ve,He=e=>{e>=Ue.reserved&&0==--Ue.get(e).refcount&&Ue.free(e)},We=()=>{for(var e=0,t=Ue.reserved;t(e||X("Cannot use deleted val. handle = "+e),Ue.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 Ue.allocate({refcount:1,value:e})}}},Qe=(e,t,n)=>{switch(t){case 1:return n?function(e){return this.fromWireType(p[0|e])}:function(e){return this.fromWireType(f[0|e])};case 2:return n?function(e){return this.fromWireType(m[e>>1])}:function(e){return this.fromWireType(g[e>>1])};case 4:return n?function(e){return this.fromWireType(v[e>>2])}:function(e){return this.fromWireType(b[e>>2])};default:throw new TypeError(`invalid integer width (${t}): ${e}`)}},Ke=(e,t)=>{var n=Q[e];return void 0===n&&X(t+" has unknown type "+De(e)),n},Ge=e=>{if(null===e)return"null";var t=typeof e;return"object"===t||"array"===t||"function"===t?e.toString():""+e},Ze=(e,t)=>{switch(t){case 4:return function(e){return this.fromWireType(_[e>>2])};case 8:return function(e){return this.fromWireType(y[e>>3])};default:throw new TypeError(`invalid float width (${t}): ${e}`)}},Je=(e,t,n)=>{switch(t){case 1:return n?e=>p[0|e]:e=>f[0|e];case 2:return n?e=>m[e>>1]:e=>g[e>>1];case 4:return n?e=>v[e>>2]:e=>b[e>>2];default:throw new TypeError(`invalid integer width (${t}): ${e}`)}},Xe=(e,t,n,a)=>{if(!(a>0))return 0;for(var i=n,r=n+a-1,o=0;o=55296&&s<=57343&&(s=65536+((1023&s)<<10)|1023&e.charCodeAt(++o)),s<=127){if(n>=r)break;t[n++]=s}else if(s<=2047){if(n+1>=r)break;t[n++]=192|s>>6,t[n++]=128|63&s}else if(s<=65535){if(n+2>=r)break;t[n++]=224|s>>12,t[n++]=128|s>>6&63,t[n++]=128|63&s}else{if(n+3>=r)break;t[n++]=240|s>>18,t[n++]=128|s>>12&63,t[n++]=128|s>>6&63,t[n++]=128|63&s}}return t[n]=0,n-i},et=e=>{for(var t=0,n=0;n=55296&&a<=57343?(t+=4,++n):t+=3}return t},tt=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0,nt=(e,t)=>e?((e,t,n)=>{for(var a=t+n,i=t;e[i]&&!(i>=a);)++i;if(i-t>16&&e.buffer&&tt)return tt.decode(e.subarray(t,i));for(var r="";t>10,56320|1023&u)}}else r+=String.fromCharCode((31&o)<<6|s)}else r+=String.fromCharCode(o)}return r})(f,e,t):"",at=typeof TextDecoder<"u"?new TextDecoder("utf-16le"):void 0,it=(e,t)=>{for(var n=e,a=n>>1,i=a+t/2;!(a>=i)&&g[a];)++a;if((n=a<<1)-e>32&&at)return at.decode(f.subarray(e,n));for(var r="",o=0;!(o>=t/2);++o){var s=m[e+2*o>>1];if(0==s)break;r+=String.fromCharCode(s)}return r},rt=(e,t,n)=>{var a;if(null!==(a=n)&&void 0!==a||(n=2147483647),n<2)return 0;for(var i=t,r=(n-=2)<2*e.length?n/2:e.length,o=0;o>1]=s,t+=2}return m[t>>1]=0,t-i},ot=e=>2*e.length,st=(e,t)=>{for(var n=0,a="";!(n>=t/4);){var i=v[e+4*n>>2];if(0==i)break;if(++n,i>=65536){var r=i-65536;a+=String.fromCharCode(55296|r>>10,56320|1023&r)}else a+=String.fromCharCode(i)}return a},lt=(e,t,n)=>{var a;if(null!==(a=n)&&void 0!==a||(n=2147483647),n<4)return 0;for(var i=t,r=i+n-4,o=0;o=55296&&s<=57343&&(s=65536+((1023&s)<<10)|1023&e.charCodeAt(++o)),v[t>>2]=s,(t+=4)+4>r)break}return v[t>>2]=0,t-i},ut=e=>{for(var t=0,n=0;n=55296&&a<=57343&&++n,t+=4}return t},ct=[],dt={},ht=()=>{if("object"==typeof globalThis)return globalThis;function e(e){e.$$$embind_global$$$=e;var t="object"==typeof $$$embind_global$$$&&e.$$$embind_global$$$==e;return t||delete e.$$$embind_global$$$,t}if("object"==typeof $$$embind_global$$$||("object"==typeof global&&e(global)?$$$embind_global$$$=global:"object"==typeof self&&e(self)&&($$$embind_global$$$=self),"object"==typeof $$$embind_global$$$))return $$$embind_global$$$;throw Error("unable to get global object.")},pt=Reflect.construct,ft=e=>{var t=(e-h.buffer.byteLength+65535)/65536;try{return h.grow(t),k(),1}catch(e){}},mt={},gt=()=>{if(!gt.strings){var e={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:("object"==typeof navigator&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:r||"./this.program"};for(var t in mt)void 0===mt[t]?delete e[t]:e[t]=mt[t];var n=[];for(var t in e)n.push(`${t}=${e[t]}`);gt.strings=n}return gt.strings},vt=e=>e%4==0&&(e%100!=0||e%400==0),bt=[31,29,31,30,31,30,31,31,30,31,30,31],_t=[31,28,31,30,31,30,31,31,30,31,30,31],yt=(e,t,n,a)=>{var i=b[a+40>>2],r={tm_sec:v[a>>2],tm_min:v[a+4>>2],tm_hour:v[a+8>>2],tm_mday:v[a+12>>2],tm_mon:v[a+16>>2],tm_year:v[a+20>>2],tm_wday:v[a+24>>2],tm_yday:v[a+28>>2],tm_isdst:v[a+32>>2],tm_gmtoff:v[a+36>>2],tm_zone:i?nt(i):""},o=nt(n),s={"%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 l in s)o=o.replace(new RegExp(l,"g"),s[l]);var u=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],c=["January","February","March","April","May","June","July","August","September","October","November","December"];function d(e,t,n){for(var a="number"==typeof e?e.toString():e||"";a.length0?1:0}var a;return 0===(a=n(e.getFullYear()-t.getFullYear()))&&0===(a=n(e.getMonth()-t.getMonth()))&&(a=n(e.getDate()-t.getDate())),a}function m(e){switch(e.getDay()){case 0:return new Date(e.getFullYear()-1,11,29);case 1:return e;case 2:return new Date(e.getFullYear(),0,3);case 3:return new Date(e.getFullYear(),0,2);case 4:return new Date(e.getFullYear(),0,1);case 5:return new Date(e.getFullYear()-1,11,31);case 6:return new Date(e.getFullYear()-1,11,30)}}function g(e){var t=((e,t)=>{for(var n=new Date(e.getTime());t>0;){var a=vt(n.getFullYear()),i=n.getMonth(),r=(a?bt:_t)[i];if(!(t>r-n.getDate()))return n.setDate(n.getDate()+t),n;t-=r-n.getDate()+1,n.setDate(1),i<11?n.setMonth(i+1):(n.setMonth(0),n.setFullYear(n.getFullYear()+1))}return n})(new Date(e.tm_year+1900,0,1),e.tm_yday),n=new Date(t.getFullYear(),0,4),a=new Date(t.getFullYear()+1,0,4),i=m(n),r=m(a);return f(i,t)<=0?f(r,t)<=0?t.getFullYear()+1:t.getFullYear():t.getFullYear()-1}var _={"%a":e=>u[e.tm_wday].substring(0,3),"%A":e=>u[e.tm_wday],"%b":e=>c[e.tm_mon].substring(0,3),"%B":e=>c[e.tm_mon],"%C":e=>h((e.tm_year+1900)/100|0,2),"%d":e=>h(e.tm_mday,2),"%e":e=>d(e.tm_mday,2," "),"%g":e=>g(e).toString().substring(2),"%G":e=>g(e),"%H":e=>h(e.tm_hour,2),"%I":e=>{var t=e.tm_hour;return 0==t?t=12:t>12&&(t-=12),h(t,2)},"%j":e=>h(e.tm_mday+((e,t)=>{for(var n=0,a=0;a<=t;n+=e[a++]);return n})(vt(e.tm_year+1900)?bt:_t,e.tm_mon-1),3),"%m":e=>h(e.tm_mon+1,2),"%M":e=>h(e.tm_min,2),"%n":()=>"\n","%p":e=>e.tm_hour>=0&&e.tm_hour<12?"AM":"PM","%S":e=>h(e.tm_sec,2),"%t":()=>"\t","%u":e=>e.tm_wday||7,"%U":e=>{var t=e.tm_yday+7-e.tm_wday;return h(Math.floor(t/7),2)},"%V":e=>{var t=Math.floor((e.tm_yday+7-(e.tm_wday+6)%7)/7);if((e.tm_wday+371-e.tm_yday-2)%7<=2&&t++,t){if(53==t){var n=(e.tm_wday+371-e.tm_yday)%7;4!=n&&(3!=n||!vt(e.tm_year))&&(t=1)}}else{t=52;var a=(e.tm_wday+7-e.tm_yday-1)%7;(4==a||5==a&&vt(e.tm_year%400-1))&&t++}return h(t,2)},"%w":e=>e.tm_wday,"%W":e=>{var t=e.tm_yday+7-(e.tm_wday+6)%7;return h(Math.floor(t/7),2)},"%y":e=>(e.tm_year+1900).toString().substring(2),"%Y":e=>e.tm_year+1900,"%z":e=>{var t=e.tm_gmtoff;return(t>=0?"+":"-")+("0000"+(t=(t=Math.abs(t)/60)/60*100+t%60)).slice(-4)},"%Z":e=>e.tm_zone,"%%":()=>"%"};for(var l in o=o.replace(/%%/g,"\0\0"),_)o.includes(l)&&(o=o.replace(new RegExp(l,"g"),_[l](r)));var y=function(e){var t=et(e)+1,n=new Array(t);return Xe(e,n,0,n.length),n}(o=o.replace(/\0\0/g,"%"));return y.length>t?0:(((e,t)=>{p.set(e,t)})(y,e),y.length-1)};U=a.InternalError=class extends Error{constructor(e){super(e),this.name="InternalError"}},(()=>{for(var e=new Array(256),t=0;t<256;++t)e[t]=String.fromCharCode(t);H=e})(),W=a.BindingError=class extends Error{constructor(e){super(e),this.name="BindingError"}},Object.assign(ye.prototype,{isAliasOf(e){if(!(this instanceof ye&&e instanceof ye))return!1;var t=this.$$.ptrType.registeredClass,n=this.$$.ptr;e.$$=e.$$;for(var a=e.$$.ptrType.registeredClass,i=e.$$.ptr;t.baseClass;)n=t.upcast(n),t=t.baseClass;for(;a.baseClass;)i=a.upcast(i),a=a.baseClass;return t===a&&n===i},clone(){if(this.$$.ptr||ie(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var e=_e(Object.create(Object.getPrototypeOf(this),{$$:{value:ae(this.$$)}}));return e.$$.count.value+=1,e.$$.deleteScheduled=!1,e},delete(){this.$$.ptr||ie(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&X("Object already scheduled for deletion"),oe(this),se(this.$$),this.$$.preservePointerOnDelete||(this.$$.smartPtr=void 0,this.$$.ptr=void 0)},isDeleted(){return!this.$$.ptr},deleteLater(){return this.$$.ptr||ie(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&X("Object already scheduled for deletion"),he.push(this),1===he.length&&te&&te(pe),this.$$.deleteScheduled=!0,this}}),a.getInheritedInstanceCount=ce,a.getLiveInheritedInstances=de,a.flushPendingDeletes=pe,a.setDelayFunction=fe,Object.assign(Pe.prototype,{getPointee(e){return this.rawGetPointee&&(e=this.rawGetPointee(e)),e},destructor(e){var t;null===(t=this.rawDestructor)||void 0===t||t.call(this,e)},argPackAdvance:ne,readValueFromPointer:Me,deleteObject(e){null!==e&&e.delete()},fromWireType:be}),Oe=a.UnboundTypeError=((e,t)=>{var n=we(t,(function(e){this.name=t,this.message=e;var n=new Error(e).stack;void 0!==n&&(this.stack=this.toString()+"\n"+n.replace(/^Error(:[^\n]*)?\n/,""))}));return n.prototype=Object.create(e.prototype),n.prototype.constructor=n,n.prototype.toString=function(){return void 0===this.message?this.name:`${this.name}: ${this.message}`},n})(Error,"UnboundTypeError"),Object.assign(Ve.prototype,{get(e){return this.allocated[e]},has(e){return void 0!==this.allocated[e]},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)}}),Ue.allocated.push({value:void 0},{value:null},{value:!0},{value:!1}),Ue.reserved=Ue.allocated.length,a.count_emval_handles=We;var wt={s:e=>{var t=new j(e);return t.get_caught()||(t.set_caught(!0),q--),t.set_rethrown(!1),z.push(t),Lt(t.excPtr),t.get_exception_ptr()},u:()=>{Et(0,0);var e=z.pop();Pt(e.excPtr),D=0},b:()=>$([]),g:e=>$([e]),q:(e,t)=>$([e,t]),J:()=>{var e=z.pop();e||A("no exception to throw");var t=e.excPtr;throw e.get_rethrown()||(z.push(e),e.set_rethrown(!0),e.set_caught(!1),q++),D=t},f:(e,t,n)=>{throw new j(e).init(t,n),q++,D=e},V:()=>q,d:e=>{throw D||(D=e),D},da:e=>{var t=B[e];delete B[e];var n=t.rawConstructor,a=t.rawDestructor,i=t.fields,r=i.map((e=>e.getterReturnType)).concat(i.map((e=>e.setterArgumentType)));Z([e],r,(e=>{var r={};return i.forEach(((t,n)=>{var a=t.fieldName,o=e[n],s=t.getter,l=t.getterContext,u=e[n+i.length],c=t.setter,d=t.setterContext;r[a]={read:e=>o.fromWireType(s(l,e)),write:(e,t)=>{var n=[];c(d,e,u.toWireType(n,t)),F(n)}}})),[{name:t.name,fromWireType:e=>{var t={};for(var n in r)t[n]=r[n].read(e);return a(e),t},toWireType:(e,t)=>{for(var i in r)if(!(i in t))throw new TypeError(`Missing field: "${i}"`);var o=n();for(i in r)r[i].write(o,t[i]);return null!==e&&e.push(a,o),o},argPackAdvance:ne,readValueFromPointer:V,destructorFunction:a}]}))},Q:(e,t,n,a,i)=>{},_:(e,t,n,a)=>{ee(e,{name:t=J(t),fromWireType:function(e){return!!e},toWireType:function(e,t){return t?n:a},argPackAdvance:ne,readValueFromPointer:function(e){return this.fromWireType(f[e])},destructorFunction:null})},ca:(e,t,n,a,i,r,o,s,l,u,c,d,h)=>{c=J(c),r=qe(i,r),s&&(s=qe(o,s)),u&&(u=qe(l,u)),h=qe(d,h);var p=(e=>{if(void 0===e)return"_unknown";var t=(e=e.replace(/[^a-zA-Z0-9_]/g,"$")).charCodeAt(0);return t>=48&&t<=57?`_${e}`:e})(c);xe(p,(function(){je(`Cannot construct ${c} due to unbound types`,[a])})),Z([e,t,n],a?[a]:[],(function(t){var n,i;t=t[0],i=a?(n=t.registeredClass).instancePrototype:ye.prototype;var o=we(c,(function(){if(Object.getPrototypeOf(this)!==l)throw new W("Use 'new' to construct "+c);if(void 0===m.constructor_body)throw new W(c+" has no accessible constructor");var e=m.constructor_body[arguments.length];if(void 0===e)throw new W(`Tried to invoke ctor of ${c} with invalid number of parameters (${arguments.length}) - expected (${Object.keys(m.constructor_body).toString()}) parameters instead!`);return e.apply(this,arguments)})),l=Object.create(i,{constructor:{value:o}});o.prototype=l;var d,f,m=new Se(c,o,l,h,n,r,s,u);m.baseClass&&(null!==(f=(d=m.baseClass).__derivedClasses)&&void 0!==f||(d.__derivedClasses=[]),m.baseClass.__derivedClasses.push(m));var g=new Pe(c,m,!0,!1,!1),v=new Pe(c+"*",m,!1,!1,!1),b=new Pe(c+" const*",m,!1,!0,!1);return ue[e]={pointerType:v,constPointerType:b},Ne(p,o),[g,v,b]}))},ba:(e,t,n,a,i,r)=>{var o=$e(t,n);i=qe(a,i),Z([],[e],(function(e){var n=`constructor ${(e=e[0]).name}`;if(void 0===e.registeredClass.constructor_body&&(e.registeredClass.constructor_body=[]),void 0!==e.registeredClass.constructor_body[t-1])throw new W(`Cannot register multiple constructors with identical number of parameters (${t-1}) for class '${e.name}'! Overload resolution is currently only performed using the parameter count, not actual type info!`);return e.registeredClass.constructor_body[t-1]=()=>{je(`Cannot construct ${e.name} due to unbound types`,o)},Z([],o,(a=>(a.splice(1,0,null),e.registeredClass.constructor_body[t-1]=Be(n,a,null,i,r),[]))),[]}))},w:(e,t,n,a,i,r,o,s,l)=>{var u=$e(n,a);t=J(t),t=Fe(t),r=qe(i,r),Z([],[e],(function(e){var a=`${(e=e[0]).name}.${t}`;function i(){je(`Cannot call ${a} due to unbound types`,u)}t.startsWith("@@")&&(t=Symbol[t.substring(2)]),s&&e.registeredClass.pureVirtualFunctions.push(t);var l=e.registeredClass.instancePrototype,c=l[t];return void 0===c||void 0===c.overloadTable&&c.className!==e.name&&c.argCount===n-2?(i.argCount=n-2,i.className=e.name,l[t]=i):(ke(l,t,a),l[t].overloadTable[n-2]=i),Z([],u,(function(i){var s=Be(a,i,e,r,o);return void 0===l[t].overloadTable?(s.argCount=n-2,l[t]=s):l[t].overloadTable[n-2]=s,[]})),[]}))},Y:(e,t)=>{ee(e,{name:t=J(t),fromWireType:e=>{var t=Ye.toValue(e);return He(e),t},toWireType:(e,t)=>Ye.toHandle(t),argPackAdvance:ne,readValueFromPointer:V,destructorFunction:null})},x:(e,t,n,a)=>{function i(){}t=J(t),i.values={},ee(e,{name:t,constructor:i,fromWireType:function(e){return this.constructor.values[e]},toWireType:(e,t)=>t.value,argPackAdvance:ne,readValueFromPointer:Qe(t,n,a),destructorFunction:null}),xe(t,i)},h:(e,t,n)=>{var a=Ke(e,"enum");t=J(t);var i=a.constructor,r=Object.create(a.constructor.prototype,{value:{value:n},constructor:{value:we(`${a.name}_${t}`,(function(){}))}});i.values[n]=r,i[t]=r},L:(e,t,n)=>{ee(e,{name:t=J(t),fromWireType:e=>e,toWireType:(e,t)=>t,argPackAdvance:ne,readValueFromPointer:Ze(t,n),destructorFunction:null})},M:(e,t,n,a,i,r,o)=>{var s=$e(t,n);e=J(e),e=Fe(e),i=qe(a,i),xe(e,(function(){je(`Cannot call ${e} due to unbound types`,s)}),t-1),Z([],s,(function(n){var a=[n[0],null].concat(n.slice(1));return Ne(e,Be(e,a,null,i,r),t-1),[]}))},t:(e,t,n,a,i)=>{t=J(t);var r=e=>e;if(0===a){var o=32-8*n;r=e=>e<>>o}var s=t.includes("unsigned");ee(e,{name:t,fromWireType:r,toWireType:s?function(e,t){return this.name,t>>>0}:function(e,t){return this.name,t},argPackAdvance:ne,readValueFromPointer:Je(t,n,0!==a),destructorFunction:null})},o:(e,t,n)=>{var a=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array][t];function i(e){var t=b[e>>2],n=b[e+4>>2];return new a(p.buffer,n,t)}ee(e,{name:n=J(n),fromWireType:i,argPackAdvance:ne,readValueFromPointer:i},{ignoreDuplicateRegistrations:!0})},K:(e,t)=>{var n="std::string"===(t=J(t));ee(e,{name:t,fromWireType(e){var t,a=b[e>>2],i=e+4;if(n)for(var r=i,o=0;o<=a;++o){var s=i+o;if(o==a||0==f[s]){var l=nt(r,s-r);void 0===t?t=l:(t+="\0",t+=l),r=s+1}}else{var u=new Array(a);for(o=0;o>2]=a,n&&i)((e,t,n)=>{Xe(e,f,t,n)})(t,o,a+1);else if(i)for(var s=0;s255&&(xt(o),X("String has UTF-16 code units that do not fit in 8 bits")),f[o+s]=l}else for(s=0;s{var a,i,r,o,s;n=J(n),2===t?(a=it,i=rt,o=ot,r=()=>g,s=1):4===t&&(a=st,i=lt,o=ut,r=()=>b,s=2),ee(e,{name:n,fromWireType:e=>{for(var n,i=b[e>>2],o=r(),l=e+4,u=0;u<=i;++u){var c=e+4+u*t;if(u==i||0==o[c>>s]){var d=a(l,c-l);void 0===n?n=d:(n+="\0",n+=d),l=c+t}}return xt(e),n},toWireType:(e,a)=>{"string"!=typeof a&&X(`Cannot pass non-string to C++ string type ${n}`);var r=o(a),l=St(4+r+t);return b[l>>2]=r>>s,i(a,l+4,r+t),null!==e&&e.push(xt,l),l},argPackAdvance:ne,readValueFromPointer:V,destructorFunction(e){xt(e)}})},A:(e,t,n,a,i,r)=>{B[e]={name:J(t),rawConstructor:qe(n,a),rawDestructor:qe(i,r),fields:[]}},ea:(e,t,n,a,i,r,o,s,l,u)=>{B[e].fields.push({fieldName:J(t),getterReturnType:n,getter:qe(a,i),getterContext:r,setterArgumentType:o,setter:qe(s,l),setterContext:u})},$:(e,t)=>{ee(e,{isVoid:!0,name:t=J(t),argPackAdvance:0,fromWireType:()=>{},toWireType:(e,t)=>{}})},R:(e,t,n,a)=>(e=ct[e])(null,t=Ye.toValue(t),n,a),ha:He,fa:e=>0===e?Ye.toHandle(ht()):(e=(e=>{var t=dt[e];return void 0===t?J(e):t})(e),Ye.toHandle(ht()[e])),Z:(e,t,n)=>{var a=((e,t)=>{for(var n=new Array(e),a=0;a>2],"parameter "+a);return n})(e,t),i=a.shift();e--;var r=new Array(e),o=`methodCaller<(${a.map((e=>e.name)).join(", ")}) => ${i.name}>`;return(e=>{var t=ct.length;return ct.push(e),t})(we(o,((t,o,s,l)=>{for(var u=0,c=0;c{var a=[],i=e.toWireType(a,n);return a.length&&(b[t>>2]=Ye.toHandle(a)),i})(i,s,d)})))},N:e=>{e>4&&(Ue.get(e).refcount+=1)},O:e=>{var t=Ye.toValue(e);F(t),He(e)},aa:(e,t)=>{var n=(e=Ke(e,"_emval_take_value")).readValueFromPointer(t);return Ye.toHandle(n)},B:()=>{A("")},X:(e,t,n)=>f.copyWithin(e,t,t+n),W:e=>{var t,n,a=f.length,i=2147483648;if((e>>>=0)>i)return!1;for(var r=1;r<=4;r*=2){var o=a*(1+.2/r);o=Math.min(o,e+100663296);var s=Math.min(i,(t=Math.max(e,o))+((n=65536)-t%n)%n);if(ft(s))return!0}return!1},T:(e,t)=>{var n=0;return gt().forEach(((a,i)=>{var r=t+n;b[e+4*i>>2]=r,((e,t)=>{for(var n=0;n{var n=gt();b[e>>2]=n.length;var a=0;return n.forEach((e=>a+=e.length+1)),b[t>>2]=a,0},E:function(e,t,n,a){var i=At();try{return Ie(e)(t,n,a)}catch(e){if(Mt(i),e!==e+0)throw e;Et(1,0)}},D:function(e,t,n,a,i){var r=At();try{return Ie(e)(t,n,a,i)}catch(e){if(Mt(r),e!==e+0)throw e;Et(1,0)}},F:function(e,t,n,a){var i=At();try{return Ie(e)(t,n,a)}catch(e){if(Mt(i),e!==e+0)throw e;Et(1,0)}},n:function(e){var t=At();try{return Ie(e)()}catch(e){if(Mt(t),e!==e+0)throw e;Et(1,0)}},a:function(e,t){var n=At();try{return Ie(e)(t)}catch(e){if(Mt(n),e!==e+0)throw e;Et(1,0)}},e:function(e,t,n){var a=At();try{return Ie(e)(t,n)}catch(e){if(Mt(a),e!==e+0)throw e;Et(1,0)}},m:function(e,t,n,a){var i=At();try{return Ie(e)(t,n,a)}catch(e){if(Mt(i),e!==e+0)throw e;Et(1,0)}},k:function(e,t,n,a,i){var r=At();try{return Ie(e)(t,n,a,i)}catch(e){if(Mt(r),e!==e+0)throw e;Et(1,0)}},H:function(e,t,n,a,i,r){var o=At();try{return Ie(e)(t,n,a,i,r)}catch(e){if(Mt(o),e!==e+0)throw e;Et(1,0)}},v:function(e,t,n,a,i,r,o){var s=At();try{return Ie(e)(t,n,a,i,r,o)}catch(e){if(Mt(s),e!==e+0)throw e;Et(1,0)}},G:function(e,t,n,a,i,r,o,s){var l=At();try{return Ie(e)(t,n,a,i,r,o,s)}catch(e){if(Mt(l),e!==e+0)throw e;Et(1,0)}},z:function(e,t,n,a,i,r,o,s,l,u,c,d){var h=At();try{return Ie(e)(t,n,a,i,r,o,s,l,u,c,d)}catch(e){if(Mt(h),e!==e+0)throw e;Et(1,0)}},P:function(e,t,n,a,i){var r=At();try{return It(e,t,n,a,i)}catch(e){if(Mt(r),e!==e+0)throw e;Et(1,0)}},l:function(e){var t=At();try{Ie(e)()}catch(e){if(Mt(t),e!==e+0)throw e;Et(1,0)}},j:function(e,t){var n=At();try{Ie(e)(t)}catch(e){if(Mt(n),e!==e+0)throw e;Et(1,0)}},c:function(e,t,n){var a=At();try{Ie(e)(t,n)}catch(e){if(Mt(a),e!==e+0)throw e;Et(1,0)}},p:function(e,t,n,a){var i=At();try{Ie(e)(t,n,a)}catch(e){if(Mt(i),e!==e+0)throw e;Et(1,0)}},I:function(e,t,n,a,i){var r=At();try{Ie(e)(t,n,a,i)}catch(e){if(Mt(r),e!==e+0)throw e;Et(1,0)}},r:function(e,t,n,a,i,r,o,s){var l=At();try{Ie(e)(t,n,a,i,r,o,s)}catch(e){if(Mt(l),e!==e+0)throw e;Et(1,0)}},i:function(e,t,n,a,i,r,o,s,l,u,c){var d=At();try{Ie(e)(t,n,a,i,r,o,s,l,u,c)}catch(e){if(Mt(d),e!==e+0)throw e;Et(1,0)}},y:function(e,t,n,a,i,r,o,s,l,u,c,d,h,p,f,m){var g=At();try{Ie(e)(t,n,a,i,r,o,s,l,u,c,d,h,p,f,m)}catch(e){if(Mt(g),e!==e+0)throw e;Et(1,0)}},ga:e=>e,S:(e,t,n,a,i)=>yt(e,t,n,a)},kt=function(){var e={a:wt};function t(e,t){return kt=e.exports,h=kt.ia,k(),Le=kt.ma,function(e){S.unshift(e)}(kt.ja),function(){var e;if(E--,null===(e=a.monitorRunDependencies)||void 0===e||e.call(a,E),0==E&&T){var t=T;T=null,t()}}(),kt}if(function(){var e;E++,null===(e=a.monitorRunDependencies)||void 0===e||e.call(a,E)}(),a.instantiateWasm)try{return a.instantiateWasm(e,t)}catch(e){d(`Module.instantiateWasm callback failed with error: ${e}`),n(e)}return function(e,t,n,a){return e||"function"!=typeof WebAssembly.instantiateStreaming||L(t)||"function"!=typeof fetch?N(t,n,a):fetch(t,{credentials:"same-origin"}).then((e=>WebAssembly.instantiateStreaming(e,n).then(a,(function(e){return d(`wasm streaming compile failed: ${e}`),d("falling back to ArrayBuffer instantiation"),N(t,n,a)}))))}(c,M,e,(function(e){t(e.instance)})).catch(n),{}}(),xt=a._free=e=>(xt=a._free=kt.ka)(e),St=a._malloc=e=>(St=a._malloc=kt.la)(e),Ct=e=>(Ct=kt.na)(e),Et=(e,t)=>(Et=kt.oa)(e,t),Tt=e=>(Tt=kt.pa)(e),At=()=>(At=kt.qa)(),Mt=e=>(Mt=kt.ra)(e),Pt=e=>(Pt=kt.sa)(e),Lt=e=>(Lt=kt.ta)(e),Ot=(e,t,n)=>(Ot=kt.ua)(e,t,n),Nt=e=>(Nt=kt.va)(e);a.dynCall_viijii=(e,t,n,i,r,o,s)=>(a.dynCall_viijii=kt.wa)(e,t,n,i,r,o,s);var Rt,It=a.dynCall_jiiii=(e,t,n,i,r)=>(It=a.dynCall_jiiii=kt.xa)(e,t,n,i,r);function zt(){function e(){Rt||(Rt=!0,a.calledRun=!0,!w&&(R(S),t(a),a.onRuntimeInitialized&&a.onRuntimeInitialized(),function(){if(a.postRun)for("function"==typeof a.postRun&&(a.postRun=[a.postRun]);a.postRun.length;)e=a.postRun.shift(),C.unshift(e);var e;R(C)}()))}E>0||(function(){if(a.preRun)for("function"==typeof a.preRun&&(a.preRun=[a.preRun]);a.preRun.length;)e=a.preRun.shift(),x.unshift(e);var e;R(x)}(),E>0)||(a.setStatus?(a.setStatus("Running..."),setTimeout((function(){setTimeout((function(){a.setStatus("")}),1),e()}),1)):e())}if(a.dynCall_iiiiij=(e,t,n,i,r,o,s)=>(a.dynCall_iiiiij=kt.ya)(e,t,n,i,r,o,s),a.dynCall_iiiiijj=(e,t,n,i,r,o,s,l,u)=>(a.dynCall_iiiiijj=kt.za)(e,t,n,i,r,o,s,l,u),a.dynCall_iiiiiijj=(e,t,n,i,r,o,s,l,u,c)=>(a.dynCall_iiiiiijj=kt.Aa)(e,t,n,i,r,o,s,l,u,c),T=function e(){Rt||zt(),Rt||(T=e)},a.preInit)for("function"==typeof a.preInit&&(a.preInit=[a.preInit]);a.preInit.length>0;)a.preInit.pop()();return zt(),e.ready});async function D(e,t){return async function(e,t,n=M){const a={...M,...n},i=await R(e),{size:r}=t,o=new Uint8Array(await t.arrayBuffer()),s=i._malloc(r);i.HEAPU8.set(o,s);const l=i.readBarcodesFromImage(s,r,P(i,a));i._free(s);const u=[];for(let e=0;e{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)})(this,z,void 0);try{const a=null==(t=null==e?void 0:e.formats)?void 0:t.filter((e=>"unknown"!==e));if(0===(null==a?void 0:a.length))throw new TypeError("Hint option provided, but is empty.");null==a||a.forEach((e=>{if(!o.has(e))throw new TypeError(`Failed to read the 'formats' property from 'BarcodeDetectorOptions': The provided value '${e}' is not a valid enum value of type BarcodeFormat.`)})),((e,t,a)=>{n(e,t,"write to private field"),t.set(e,a)})(this,z,null!=a?a:[]),function(e){return R(q,e)}().then((e=>{this.dispatchEvent(new CustomEvent("load",{detail:e}))})).catch((e=>{this.dispatchEvent(new CustomEvent("error",{detail:e}))}))}catch(e){throw b(e,"Failed to construct 'BarcodeDetector'")}}static async getSupportedFormats(){return r.filter((e=>"unknown"!==e))}async detect(e){try{const t=await v(e);if(null===t)return[];let n;try{n=m(t)?await D(t,{tryHarder:!0,formats:a(this,z).map((e=>o.get(e)))}):await j(t,{tryHarder:!0,formats:a(this,z).map((e=>o.get(e)))})}catch(e){throw console.error(e),new DOMException("Barcode detection service unavailable.","NotSupportedError")}return n.map((e=>{const{topLeft:{x:t,y:n},topRight:{x:a,y:i},bottomLeft:{x:r,y:o},bottomRight:{x:l,y:u}}=e.position,c=Math.min(t,a,r,l),d=Math.min(n,i,o,u),h=Math.max(t,a,r,l),p=Math.max(n,i,o,u);return{boundingBox:new DOMRectReadOnly(c,d,h-c,p-d),rawValue:e.text,format:s(e.format),cornerPoints:[{x:t,y:n},{x:a,y:i},{x:l,y:u},{x:r,y:o}]}}))}catch(e){throw b(e,"Failed to execute 'detect' on 'BarcodeDetector'")}}}z=new WeakMap;const B=(e,t,n="error")=>{let a,i;const r=new Promise(((r,o)=>{a=r,i=o,e.addEventListener(t,a),e.addEventListener(n,i)}));return r.finally((()=>{e.removeEventListener(t,a),e.removeEventListener(n,i)})),r},F=e=>new Promise((t=>setTimeout(t,e)));class V extends Error{constructor(){super("can't process cross-origin image"),this.name="DropImageFetchError"}}class U extends Error{constructor(){super("this browser has no Stream API support"),this.name="StreamApiNotSupportedError"}}class H extends Error{constructor(){super("camera access is only permitted in secure context. Use HTTPS or localhost rather than HTTP."),this.name="InsecureContextError"}}class W 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 Y;async function Q(e){Y=await async function(e){if(void 0===window.BarcodeDetector)return console.debug("[vue-qrcode-reader] Native BarcodeDetector not supported. Will use polyfill."),new $({formats:e});const t=await window.BarcodeDetector.getSupportedFormats(),n=e.filter((e=>!t.includes(e)));return n.length>0?(console.debug(`[vue-qrcode-reader] Native BarcodeDetector does not support formats ${JSON.stringify(n)}. Will use polyfill.`),new $({formats:e})):(console.debug("[vue-qrcode-reader] Will use native BarcodeDetector."),new window.BarcodeDetector({formats:e}))}(e)}const K=async(e,t=["qr_code"])=>await new $({formats:t}).detect(e),G=async(e,t=["qr_code"])=>{const n=new $({formats:t}),a=await(async e=>{if(e.startsWith("http")&&!1===e.includes(location.host))throw new V;const t=document.createElement("img");return t.src=e,await B(t,"load"),t})(e);return await n.detect(a)};var Z={},J={};Object.defineProperty(J,"__esModule",{value:!0}),J.compactObject=function e(t){return ie(t)?Object.keys(t).reduce((function(n,a){var i=ie(t[a]),r=i?e(t[a]):t[a],o=i&&!Object.keys(r).length;return void 0===r||o?n:Object.assign(n,function(e,t,n){return t=function(e){var t=function(e,t){if("object"!==ee(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var a=n.call(e,t||"default");if("object"!==ee(a))return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===ee(t)?t:String(t)}(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}({},a,r))}),{}):t},J.deprecated=function(e,t){ne&&console.warn(e+" is deprecated, please use "+t+" instead.")};var X=J.detectBrowser=function(e){var t={browser:null,version:null};if(typeof e>"u"||!e.navigator||!e.navigator.userAgent)return t.browser="Not a browser.",t;var n=e.navigator;if(n.mozGetUserMedia)t.browser="firefox",t.version=ae(n.userAgent,/Firefox\/(\d+)\./,1);else if(n.webkitGetUserMedia||!1===e.isSecureContext&&e.webkitRTCPeerConnection)t.browser="chrome",t.version=ae(n.userAgent,/Chrom(e|ium)\/(\d+)\./,2);else{if(!e.RTCPeerConnection||!n.userAgent.match(/AppleWebKit\/(\d+)\./))return t.browser="Not a supported browser.",t;t.browser="safari",t.version=ae(n.userAgent,/AppleWebKit\/(\d+)\./,1),t.supportsUnifiedPlan=e.RTCRtpTransceiver&&"currentDirection"in e.RTCRtpTransceiver.prototype}return t};function ee(e){return(ee="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}J.disableLog=function(e){return"boolean"!=typeof e?new Error("Argument type: "+ee(e)+". Please use a boolean."):(te=e,e?"adapter.js logging disabled":"adapter.js logging enabled")},J.disableWarnings=function(e){return"boolean"!=typeof e?new Error("Argument type: "+ee(e)+". Please use a boolean."):(ne=!e,"adapter.js deprecation warnings "+(e?"disabled":"enabled"))},J.extractVersion=ae,J.filterStats=function(e,t,n){var a=n?"outbound-rtp":"inbound-rtp",i=new Map;if(null===t)return i;var r=[];return e.forEach((function(e){"track"===e.type&&e.trackIdentifier===t.id&&r.push(e)})),r.forEach((function(t){e.forEach((function(n){n.type===a&&n.trackId===t.id&&re(e,n,i)}))})),i},J.log=function(){if("object"===(typeof window>"u"?"undefined":ee(window))){if(te)return;typeof console<"u"&&"function"==typeof console.log&&console.log.apply(console,arguments)}},J.walkStats=re,J.wrapPeerConnectionEvent=function(e,t,n){if(e.RTCPeerConnection){var a=e.RTCPeerConnection.prototype,i=a.addEventListener;a.addEventListener=function(e,a){if(e!==t)return i.apply(this,arguments);var r=function(e){var t=n(e);t&&(a.handleEvent?a.handleEvent(t):a(t))};return this._eventMap=this._eventMap||{},this._eventMap[t]||(this._eventMap[t]=new Map),this._eventMap[t].set(a,r),i.apply(this,[e,r])};var r=a.removeEventListener;a.removeEventListener=function(e,n){if(e!==t||!this._eventMap||!this._eventMap[t])return r.apply(this,arguments);if(!this._eventMap[t].has(n))return r.apply(this,arguments);var a=this._eventMap[t].get(n);return this._eventMap[t].delete(n),0===this._eventMap[t].size&&delete this._eventMap[t],0===Object.keys(this._eventMap).length&&delete this._eventMap,r.apply(this,[e,a])},Object.defineProperty(a,"on"+t,{get:function(){return this["_on"+t]},set:function(e){this["_on"+t]&&(this.removeEventListener(t,this["_on"+t]),delete this["_on"+t]),e&&this.addEventListener(t,this["_on"+t]=e)},enumerable:!0,configurable:!0})}};var te=!0,ne=!0;function ae(e,t,n){var a=e.match(t);return a&&a.length>=n&&parseInt(a[n],10)}function ie(e){return"[object Object]"===Object.prototype.toString.call(e)}function re(e,t,n){!t||n.has(t.id)||(n.set(t.id,t),Object.keys(t).forEach((function(a){a.endsWith("Id")?re(e,e.get(t[a]),n):a.endsWith("Ids")&&t[a].forEach((function(t){re(e,e.get(t),n)}))})))}Object.defineProperty(Z,"__esModule",{value:!0});var oe=Z.shimGetUserMedia=function(e,t){var n=e&&e.navigator;if(n.mediaDevices){var a=function(e){if("object"!==ue(e)||e.mandatory||e.optional)return e;var t={};return Object.keys(e).forEach((function(n){if("require"!==n&&"advanced"!==n&&"mediaSource"!==n){var a="object"===ue(e[n])?e[n]:{ideal:e[n]};void 0!==a.exact&&"number"==typeof a.exact&&(a.min=a.max=a.exact);var i=function(e,t){return e?e+t.charAt(0).toUpperCase()+t.slice(1):"deviceId"===t?"sourceId":t};if(void 0!==a.ideal){t.optional=t.optional||[];var r={};"number"==typeof a.ideal?(r[i("min",n)]=a.ideal,t.optional.push(r),(r={})[i("max",n)]=a.ideal,t.optional.push(r)):(r[i("",n)]=a.ideal,t.optional.push(r))}void 0!==a.exact&&"number"!=typeof a.exact?(t.mandatory=t.mandatory||{},t.mandatory[i("",n)]=a.exact):["min","max"].forEach((function(e){void 0!==a[e]&&(t.mandatory=t.mandatory||{},t.mandatory[i(e,n)]=a[e])}))}})),e.advanced&&(t.optional=(t.optional||[]).concat(e.advanced)),t},i=function(e,i){if(t.version>=61)return i(e);if((e=JSON.parse(JSON.stringify(e)))&&"object"===ue(e.audio)){var r=function(e,t,n){t in e&&!(n in e)&&(e[n]=e[t],delete e[t])};r((e=JSON.parse(JSON.stringify(e))).audio,"autoGainControl","googAutoGainControl"),r(e.audio,"noiseSuppression","googNoiseSuppression"),e.audio=a(e.audio)}if(e&&"object"===ue(e.video)){var o=e.video.facingMode;o=o&&("object"===ue(o)?o:{ideal:o});var s,l=t.version<66;if(o&&("user"===o.exact||"environment"===o.exact||"user"===o.ideal||"environment"===o.ideal)&&(!n.mediaDevices.getSupportedConstraints||!n.mediaDevices.getSupportedConstraints().facingMode||l))if(delete e.video.facingMode,"environment"===o.exact||"environment"===o.ideal?s=["back","rear"]:("user"===o.exact||"user"===o.ideal)&&(s=["front"]),s)return n.mediaDevices.enumerateDevices().then((function(t){var n=(t=t.filter((function(e){return"videoinput"===e.kind}))).find((function(e){return s.some((function(t){return e.label.toLowerCase().includes(t)}))}));return!n&&t.length&&s.includes("back")&&(n=t[t.length-1]),n&&(e.video.deviceId=o.exact?{exact:n.deviceId}:{ideal:n.deviceId}),e.video=a(e.video),ce("chrome: "+JSON.stringify(e)),i(e)}));e.video=a(e.video)}return ce("chrome: "+JSON.stringify(e)),i(e)},r=function(e){return t.version>=64?e:{name:{PermissionDeniedError:"NotAllowedError",PermissionDismissedError:"NotAllowedError",InvalidStateError:"NotAllowedError",DevicesNotFoundError:"NotFoundError",ConstraintNotSatisfiedError:"OverconstrainedError",TrackStartError:"NotReadableError",MediaDeviceFailedDueToShutdown:"NotAllowedError",MediaDeviceKillSwitchOn:"NotAllowedError",TabCaptureError:"AbortError",ScreenCaptureError:"AbortError",DeviceCaptureError:"AbortError"}[e.name]||e.name,message:e.message,constraint:e.constraint||e.constraintName,toString:function(){return this.name+(this.message&&": ")+this.message}}};if(n.getUserMedia=function(e,t,a){i(e,(function(e){n.webkitGetUserMedia(e,t,(function(e){a&&a(r(e))}))}))}.bind(n),n.mediaDevices.getUserMedia){var o=n.mediaDevices.getUserMedia.bind(n.mediaDevices);n.mediaDevices.getUserMedia=function(e){return i(e,(function(e){return o(e).then((function(t){if(e.audio&&!t.getAudioTracks().length||e.video&&!t.getVideoTracks().length)throw t.getTracks().forEach((function(e){e.stop()})),new DOMException("","NotFoundError");return t}),(function(e){return Promise.reject(r(e))}))}))}}}},se=function(e,t){if(e&&e.__esModule)return e;if(null===e||"object"!==ue(e)&&"function"!=typeof e)return{default:e};var n=le(t);if(n&&n.has(e))return n.get(e);var a={},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var r in e)if("default"!==r&&Object.prototype.hasOwnProperty.call(e,r)){var o=i?Object.getOwnPropertyDescriptor(e,r):null;o&&(o.get||o.set)?Object.defineProperty(a,r,o):a[r]=e[r]}return a.default=e,n&&n.set(e,a),a}(J);function le(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(le=function(e){return e?n:t})(e)}function ue(e){return(ue="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var ce=se.log;var de={};Object.defineProperty(de,"__esModule",{value:!0});var he=de.shimGetUserMedia=function(e,t){var n=e&&e.navigator,a=e&&e.MediaStreamTrack;if(n.getUserMedia=function(e,t,a){pe.deprecated("navigator.getUserMedia","navigator.mediaDevices.getUserMedia"),n.mediaDevices.getUserMedia(e).then(t,a)},!(t.version>55&&"autoGainControl"in n.mediaDevices.getSupportedConstraints())){var i=function(e,t,n){t in e&&!(n in e)&&(e[n]=e[t],delete e[t])},r=n.mediaDevices.getUserMedia.bind(n.mediaDevices);if(n.mediaDevices.getUserMedia=function(e){return"object"===me(e)&&"object"===me(e.audio)&&(e=JSON.parse(JSON.stringify(e)),i(e.audio,"autoGainControl","mozAutoGainControl"),i(e.audio,"noiseSuppression","mozNoiseSuppression")),r(e)},a&&a.prototype.getSettings){var o=a.prototype.getSettings;a.prototype.getSettings=function(){var e=o.apply(this,arguments);return i(e,"mozAutoGainControl","autoGainControl"),i(e,"mozNoiseSuppression","noiseSuppression"),e}}if(a&&a.prototype.applyConstraints){var s=a.prototype.applyConstraints;a.prototype.applyConstraints=function(e){return"audio"===this.kind&&"object"===me(e)&&(e=JSON.parse(JSON.stringify(e)),i(e,"autoGainControl","mozAutoGainControl"),i(e,"noiseSuppression","mozNoiseSuppression")),s.apply(this,[e])}}}},pe=function(e,t){if(e&&e.__esModule)return e;if(null===e||"object"!==me(e)&&"function"!=typeof e)return{default:e};var n=fe(t);if(n&&n.has(e))return n.get(e);var a={},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var r in e)if("default"!==r&&Object.prototype.hasOwnProperty.call(e,r)){var o=i?Object.getOwnPropertyDescriptor(e,r):null;o&&(o.get||o.set)?Object.defineProperty(a,r,o):a[r]=e[r]}return a.default=e,n&&n.set(e,a),a}(J);function fe(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(fe=function(e){return e?n:t})(e)}function me(e){return(me="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var ge={};Object.defineProperty(ge,"__esModule",{value:!0}),ge.shimAudioContext=function(e){"object"!==ye(e)||e.AudioContext||(e.AudioContext=e.webkitAudioContext)},ge.shimCallbacksAPI=function(e){if("object"===ye(e)&&e.RTCPeerConnection){var t=e.RTCPeerConnection.prototype,n=t.createOffer,a=t.createAnswer,i=t.setLocalDescription,r=t.setRemoteDescription,o=t.addIceCandidate;t.createOffer=function(e,t){var a=arguments.length>=2?arguments[2]:arguments[0],i=n.apply(this,[a]);return t?(i.then(e,t),Promise.resolve()):i},t.createAnswer=function(e,t){var n=arguments.length>=2?arguments[2]:arguments[0],i=a.apply(this,[n]);return t?(i.then(e,t),Promise.resolve()):i};var s=function(e,t,n){var a=i.apply(this,[e]);return n?(a.then(t,n),Promise.resolve()):a};t.setLocalDescription=s,s=function(e,t,n){var a=r.apply(this,[e]);return n?(a.then(t,n),Promise.resolve()):a},t.setRemoteDescription=s,s=function(e,t,n){var a=o.apply(this,[e]);return n?(a.then(t,n),Promise.resolve()):a},t.addIceCandidate=s}},ge.shimConstraints=we,ge.shimCreateOfferLegacy=function(e){var t=e.RTCPeerConnection.prototype.createOffer;e.RTCPeerConnection.prototype.createOffer=function(e){if(e){typeof e.offerToReceiveAudio<"u"&&(e.offerToReceiveAudio=!!e.offerToReceiveAudio);var n=this.getTransceivers().find((function(e){return"audio"===e.receiver.track.kind}));!1===e.offerToReceiveAudio&&n?"sendrecv"===n.direction?n.setDirection?n.setDirection("sendonly"):n.direction="sendonly":"recvonly"===n.direction&&(n.setDirection?n.setDirection("inactive"):n.direction="inactive"):!0===e.offerToReceiveAudio&&!n&&this.addTransceiver("audio",{direction:"recvonly"}),typeof e.offerToReceiveVideo<"u"&&(e.offerToReceiveVideo=!!e.offerToReceiveVideo);var a=this.getTransceivers().find((function(e){return"video"===e.receiver.track.kind}));!1===e.offerToReceiveVideo&&a?"sendrecv"===a.direction?a.setDirection?a.setDirection("sendonly"):a.direction="sendonly":"recvonly"===a.direction&&(a.setDirection?a.setDirection("inactive"):a.direction="inactive"):!0===e.offerToReceiveVideo&&!a&&this.addTransceiver("video",{direction:"recvonly"})}return t.apply(this,arguments)}};var ve=ge.shimGetUserMedia=function(e){var t=e&&e.navigator;if(t.mediaDevices&&t.mediaDevices.getUserMedia){var n=t.mediaDevices,a=n.getUserMedia.bind(n);t.mediaDevices.getUserMedia=function(e){return a(we(e))}}!t.getUserMedia&&t.mediaDevices&&t.mediaDevices.getUserMedia&&(t.getUserMedia=function(e,n,a){t.mediaDevices.getUserMedia(e).then(n,a)}.bind(t))};ge.shimLocalStreamsAPI=function(e){if("object"===ye(e)&&e.RTCPeerConnection){if("getLocalStreams"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.getLocalStreams=function(){return this._localStreams||(this._localStreams=[]),this._localStreams}),!("addStream"in e.RTCPeerConnection.prototype)){var t=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addStream=function(e){var n=this;this._localStreams||(this._localStreams=[]),this._localStreams.includes(e)||this._localStreams.push(e),e.getAudioTracks().forEach((function(a){return t.call(n,a,e)})),e.getVideoTracks().forEach((function(a){return t.call(n,a,e)}))},e.RTCPeerConnection.prototype.addTrack=function(e){for(var n=this,a=arguments.length,i=new Array(a>1?a-1:0),r=1;r=0)){e._remoteStreams.push(t);var n=new Event("addstream");n.stream=t,e.dispatchEvent(n)}}))}),t.apply(e,arguments)}}},ge.shimTrackEventTransceiver=function(e){"object"===ye(e)&&e.RTCTrackEvent&&"receiver"in e.RTCTrackEvent.prototype&&!("transceiver"in e.RTCTrackEvent.prototype)&&Object.defineProperty(e.RTCTrackEvent.prototype,"transceiver",{get:function(){return{receiver:this.receiver}}})};var be=function(e,t){if(e&&e.__esModule)return e;if(null===e||"object"!==ye(e)&&"function"!=typeof e)return{default:e};var n=_e(t);if(n&&n.has(e))return n.get(e);var a={},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var r in e)if("default"!==r&&Object.prototype.hasOwnProperty.call(e,r)){var o=i?Object.getOwnPropertyDescriptor(e,r):null;o&&(o.get||o.set)?Object.defineProperty(a,r,o):a[r]=e[r]}return a.default=e,n&&n.set(e,a),a}(J);function _e(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(_e=function(e){return e?n:t})(e)}function ye(e){return(ye="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function we(e){return e&&void 0!==e.video?Object.assign({},e,{video:be.compactObject(e.video)}):e}function ke(e,t){if(!1===e)throw new Error(null!=t?t:"assertion failure")}function xe(e){throw new Error("this code should be unreachable")}const Se=(e=>{let t,n=!1;return(...a)=>(n||(t=e(a),n=!0),t)})((()=>{const e=X(window);switch(e.browser){case"chrome":oe(window,e);break;case"firefox":he(window,e);break;case"safari":ve(window,e);break;default:throw new U}}));let Ce=Promise.resolve({type:"stop",data:{}});async function Ee(e,t,n){var a,i,r;if(console.debug("[vue-qrcode-reader] starting camera with constraints: ",JSON.stringify(t)),!0!==window.isSecureContext)throw new H;if(void 0===(null==(a=null==navigator?void 0:navigator.mediaDevices)?void 0:a.getUserMedia))throw new U;Se(),console.debug("[vue-qrcode-reader] calling getUserMedia");const o=await navigator.mediaDevices.getUserMedia({audio:!1,video:t});void 0!==e.srcObject?e.srcObject=o:void 0!==e.mozSrcObject?e.mozSrcObject=o:window.URL.createObjectURL?e.src=window.URL.createObjectURL(o):window.webkitURL?e.src=window.webkitURL.createObjectURL(o):e.src=o.id,e.play(),console.debug("[vue-qrcode-reader] waiting for video element to load"),await Promise.race([B(e,"loadeddata"),F(6e3).then((()=>{throw new W}))]),console.debug("[vue-qrcode-reader] video element loaded"),await F(500);const[s]=o.getVideoTracks(),l=null!=(r=null==(i=null==s?void 0:s.getCapabilities)?void 0:i.call(s))?r:{};let u=!1;return n&&l.torch&&(await s.applyConstraints({advanced:[{torch:!0}]}),u=!0),console.debug("[vue-qrcode-reader] camera ready"),{type:"start",data:{videoEl:e,stream:o,capabilities:l,constraints:t,isTorchOn:u}}}async function Te(e,t,n){console.debug("[vue-qrcode-reader] stopping camera"),e.src="",e.srcObject=null,e.load(),await B(e,"error");for(const e of t.getTracks())null!=n||await e.applyConstraints({advanced:[{torch:!1}]}),t.removeTrack(e),e.stop();return{type:"stop",data:{}}}async function Ae(){if(Ce=Ce.then((e=>{if("stop"===e.type||"failed"===e.type)return e;const{data:{videoEl:t,stream:n,isTorchOn:a}}=e;return Te(t,n,a)})),"start"===(await Ce).type)throw new Error("Something went wrong with the camera task queue (stop task).")}const Me=t.defineComponent({__name:"QrcodeStream",props:{constraints:{type:Object,default:()=>({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(e,{emit:n}){const a=e,i=n,r=t.ref(a.constraints),o=t.ref(a.formats);t.watch((()=>a.constraints),((e,t)=>{JSON.stringify(e)!==JSON.stringify(t)&&(r.value=e)}),{deep:!0}),t.watch((()=>a.formats),((e,t)=>{JSON.stringify(e)!==JSON.stringify(t)&&(o.value=e)}),{deep:!0});const s=t.ref(),l=t.ref(),u=t.ref(),c=t.ref(!1),d=t.ref(!1);t.onMounted((()=>{d.value=!0})),t.onUnmounted((()=>{Ae()}));const h=t.computed((()=>({torch:a.torch,constraints:r.value,shouldStream:d.value&&!a.paused})));t.watch(h,(async e=>{const t=u.value;ke(void 0!==t,"cameraSettings watcher should never be triggered when component is not mounted. Thus video element should always be defined.");const n=s.value;ke(void 0!==n,"cameraSettings watcher should never be triggered when component is not mounted. Thus canvas should always be defined.");const a=n.getContext("2d");if(ke(null!==a,"if cavnas is defined, canvas 2d context should also be non-null"),e.shouldStream){Ae(),c.value=!1;try{const n=await async function(e,{constraints:t,torch:n,restart:a=!1}){Ce=Ce.then((i=>{if("start"===i.type){const{data:{videoEl:r,stream:o,constraints:s,isTorchOn:l}}=i;return a||e!==r||t!==s||n!==l?Te(r,o,l).then((()=>Ee(e,t,n))):i}if("stop"===i.type||"failed"===i.type)return Ee(e,t,n);xe()})).catch((e=>(console.debug(`[vue-qrcode-reader] starting camera failed with "${e}"`),{type:"failed",error:e})));const i=await Ce;if("stop"===i.type)throw new Error("Something went wrong with the camera task queue (start task).");if("failed"===i.type)throw i.error;if("start"===i.type)return i.data.capabilities;xe()}(t,e);d.value?(c.value=!0,i("camera-on",n)):await Ae()}catch(e){i("error",e)}}else n.width=t.videoWidth,n.height=t.videoHeight,a.drawImage(t,0,0,t.videoWidth,t.videoHeight),Ae(),c.value=!1,i("camera-off")}),{deep:!0}),t.watch(o,(async e=>{d.value&&await Q(e)}));const p=t.computed((()=>h.value.shouldStream&&c.value));t.watch(p,(e=>{if(e){ke(void 0!==s.value,"shouldScan watcher should only be triggered when component is mounted. Thus pause frame canvas is defined"),f(s.value),ke(void 0!==l.value,"shouldScan watcher should only be triggered when component is mounted. Thus tracking canvas is defined"),f(l.value);const e=()=>void 0===a.track?500:40;ke(void 0!==u.value,"shouldScan watcher should only be triggered when component is mounted. Thus video element is defined"),(async(e,{detectHandler:t,locateHandler:n,minDelay:a,formats:i})=>{console.debug("[vue-qrcode-reader] start scanning"),await Q(i);const r=i=>async o=>{if(0===e.readyState)console.debug("[vue-qrcode-reader] stop scanning: video element readyState is 0");else{const{lastScanned:s,contentBefore:l,lastScanHadContent:u}=i;if(o-s!l.includes(e.rawValue)));i&&t(a);const s=a.length>0;s&&n(a),!s&&u&&n(a);const c={lastScanned:o,lastScanHadContent:s,contentBefore:i?a.map((e=>e.rawValue)):l};window.requestAnimationFrame(r(c))}}};r({lastScanned:performance.now(),contentBefore:[],lastScanHadContent:!1})(performance.now())})(u.value,{detectHandler:e=>i("detect",e),formats:o.value,locateHandler:m,minDelay:e()})}}));const f=e=>{const t=e.getContext("2d");ke(null!==t,"canvas 2d context should always be non-null"),t.clearRect(0,0,e.width,e.height)},m=e=>{const t=l.value;ke(void 0!==t,"onLocate handler should only be called when component is mounted. Thus tracking canvas is always defined.");const n=u.value;if(ke(void 0!==n,"onLocate handler should only be called when component is mounted. Thus video element is always defined."),0===e.length||void 0===a.track)f(t);else{const i=n.offsetWidth,r=n.offsetHeight,o=n.videoWidth,s=n.videoHeight,l=Math.max(i/o,r/s),u=o*l,c=s*l,d=u/o,h=c/s,p=(i-u)/2,f=(r-c)/2,m=({x:e,y:t})=>({x:Math.floor(e*d),y:Math.floor(t*h)}),g=({x:e,y:t})=>({x:Math.floor(e+p),y:Math.floor(t+f)}),v=e.map((e=>{const{boundingBox:t,cornerPoints:n}=e,{x:a,y:i}=g(m({x:t.x,y:t.y})),{x:r,y:o}=m({x:t.width,y:t.height});return{...e,cornerPoints:n.map((e=>g(m(e)))),boundingBox:DOMRectReadOnly.fromRect({x:a,y:i,width:r,height:o})}}));t.width=n.offsetWidth,t.height=n.offsetHeight;const b=t.getContext("2d");a.track(v,b)}},g={width:"100%",height:"100%",position:"relative","z-index":"0"},v={width:"100%",height:"100%",position:"absolute",top:"0",left:"0"},b={width:"100%",height:"100%","object-fit":"cover"},_=t.computed((()=>p.value?b:{...b,visibility:"hidden",position:"absolute"}));return(e,n)=>(t.openBlock(),t.createElementBlock("div",{style:g},[t.createElementVNode("video",{ref_key:"videoRef",ref:u,style:t.normalizeStyle(_.value),autoplay:"",muted:"",playsinline:""},null,4),t.withDirectives(t.createElementVNode("canvas",{id:"qrcode-stream-pause-frame",ref_key:"pauseFrameRef",ref:s,style:b},null,512),[[t.vShow,!p.value]]),t.createElementVNode("canvas",{id:"qrcode-stream-tracking-layer",ref_key:"trackingLayerRef",ref:l,style:v},null,512),t.createElementVNode("div",{style:v},[t.renderSlot(e.$slots,"default")])]))}}),Pe=t.defineComponent({__name:"QrcodeCapture",props:{formats:{type:Array,default:()=>["qr_code"]}},emits:["detect"],setup(e,{emit:n}){const a=e,i=n,r=e=>{if(e.target instanceof HTMLInputElement&&e.target.files)for(const t of Array.from(e.target.files))K(t,a.formats).then((e=>{i("detect",e)}))};return(e,n)=>(t.openBlock(),t.createElementBlock("input",{onChange:r,type:"file",name:"image",accept:"image/*",capture:"environment",multiple:""},null,32))}}),Le=t.defineComponent({__name:"QrcodeDropZone",props:{formats:{type:Array,default:()=>["qr_code"]}},emits:["detect","dragover","error"],setup(e,{emit:n}){const a=e,i=n,r=async e=>{try{const t=await e;i("detect",t)}catch(e){i("error",e)}},o=e=>{i("dragover",e)},s=({dataTransfer:e})=>{if(!e)return;o(!1);const t=[...Array.from(e.files)],n=e.getData("text/uri-list");t.forEach((e=>{r(K(e))})),""!==n&&r(G(n,a.formats))};return(e,n)=>(t.openBlock(),t.createElementBlock("div",{onDrop:t.withModifiers(s,["prevent","stop"]),onDragenter:n[0]||(n[0]=t.withModifiers((e=>o(!0)),["prevent","stop"])),onDragleave:n[1]||(n[1]=t.withModifiers((e=>o(!1)),["prevent","stop"])),onDragover:n[2]||(n[2]=t.withModifiers((()=>{}),["prevent","stop"]))},[t.renderSlot(e.$slots,"default")],32))}});function Oe(e){e.component("qrcode-stream",Me),e.component("qrcode-capture",Pe),e.component("qrcode-drop-zone",Le)}const Ne={install:Oe};e.QrcodeCapture=Pe,e.QrcodeDropZone=Le,e.QrcodeStream=Me,e.VueQrcodeReader=Ne,e.install=Oe,e.setZXingModuleOverrides=function(e){return function(e,t){N.set(e,{moduleOverrides:t})}(q,e)},Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})})), + */!function(e,t){"object"==typeof exports&&typeof module<"u"?t(exports,require("vue")):"function"==typeof define&&define.amd?define(["exports","vue"],t):t((e=typeof globalThis<"u"?globalThis:e||self).VueQrcodeReader={},e.Vue)}(this,(function(e,t){"use strict";var n=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},a=(e,t,a)=>(n(e,t,"read from private field"),a?a.call(e):t.get(e));const i=[["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"]],r=[...i,["unknown"]].map((e=>e[0])),o=new Map(i);function s(e){for(const[t,n]of o)if(e===n)return t;return"unknown"}function l(e){try{return e instanceof HTMLImageElement}catch(e){return!1}}function u(e){try{return e instanceof SVGImageElement}catch(e){return!1}}function c(e){try{return e instanceof HTMLVideoElement}catch(e){return!1}}function d(e){try{return e instanceof HTMLCanvasElement}catch(e){return!1}}function h(e){try{return e instanceof ImageBitmap}catch(e){return!1}}function p(e){try{return e instanceof OffscreenCanvas}catch(e){return!1}}function f(e){try{return e instanceof VideoFrame}catch(e){return!1}}function m(e){try{return e instanceof Blob}catch(e){return!1}}async function g(e){if(l(e)&&!await async function(e){try{return await e.decode(),!0}catch(e){return!1}}(e))throw new DOMException("Failed to load or decode HTMLImageElement.","InvalidStateError");if(u(e)&&!await async function(e){var t;try{return await(null==(t=e.decode)?void 0:t.call(e)),!0}catch(e){return!1}}(e))throw new DOMException("Failed to load or decode SVGImageElement.","InvalidStateError");if(f(e)&&function(e){return null===e.format}(e))throw new DOMException("VideoFrame is closed.","InvalidStateError");if(c(e)&&(0===e.readyState||1===e.readyState))throw new DOMException("Invalid element or state.","InvalidStateError");if(h(e)&&function(e){return 0===e.width&&0===e.height}(e))throw new DOMException("The image source is detached.","InvalidStateError");const{width:t,height:n}=function(e){if(l(e))return{width:e.naturalWidth,height:e.naturalHeight};if(u(e))return{width:e.width.baseVal.value,height:e.height.baseVal.value};if(c(e))return{width:e.videoWidth,height:e.videoHeight};if(h(e))return{width:e.width,height:e.height};if(f(e))return{width:e.displayWidth,height:e.displayHeight};if(d(e))return{width:e.width,height:e.height};if(p(e))return{width:e.width,height:e.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)'.")}(e);if(0===t||0===n)return null;const a=function(e,t){try{const n=new OffscreenCanvas(e,t);if(n.getContext("2d")instanceof OffscreenCanvasRenderingContext2D)return n;throw void 0}catch(n){const a=document.createElement("canvas");return a.width=e,a.height=t,a}}(t,n).getContext("2d");a.drawImage(e,0,0);try{return a.getImageData(0,0,t,n)}catch(e){throw new DOMException("Source would taint origin.","SecurityError")}}async function v(e){if(m(e))return await async function(e){let t;try{if(globalThis.createImageBitmap)t=await createImageBitmap(e);else{if(!globalThis.Image)return e;{t=new Image;let n="";try{n=URL.createObjectURL(e),t.src=n,await t.decode()}finally{URL.revokeObjectURL(n)}}}}catch(e){throw new DOMException("Failed to load or decode Blob.","InvalidStateError")}return await g(t)}(e);if(function(e){try{return e instanceof ImageData}catch(e){return!1}}(e)){if(function(e){return 0===e.data.buffer.byteLength}(e))throw new DOMException("The image data has been detached.","InvalidStateError");return e}return d(e)||p(e)?function(e){const{width:t,height:n}=e;if(0===t||0===n)return null;const a=e.getContext("2d");try{return a.getImageData(0,0,t,n)}catch(e){throw new DOMException("Source would taint origin.","SecurityError")}}(e):await g(e)}function b(e,t){return e instanceof DOMException?new DOMException(`${t}: ${e.message}`,e.name):e instanceof Error?new e.constructor(`${t}: ${e.message}`):new Error(`${t}: ${e}`)}const _=["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 y(e){return e.join("|")}function w(e){const t=k(e);let n=0,a=_.length-1;for(;n<=a;){const e=Math.floor((n+a)/2),i=_[e],r=k(i);if(r===t)return i;r{const n=e.match(/_(.+?)\.wasm$/);return n?`https://fastly.jsdelivr.net/npm/zxing-wasm@1.1.3/dist/${n[1]}/${e}`:t+e}};let N=new WeakMap;function R(e,t){var n;const a=N.get(e);if(null!=a&&a.modulePromise&&void 0===t)return a.modulePromise;const i=null!=(n=null==a?void 0:a.moduleOverrides)?n:O,r=e({...i});return N.set(e,{moduleOverrides:i,modulePromise:r}),r}M.formats;var I,z,q=(I=typeof document<"u"&&document.currentScript?document.currentScript.src:void 0,function(e={}){var t,n,a=e;a.ready=new Promise(((e,a)=>{t=e,n=a}));var i=Object.assign({},a),r="./this.program",o="object"==typeof window,s="function"==typeof importScripts;"object"==typeof process&&"object"==typeof process.versions&&process.versions.node;var l,u="";(o||s)&&(s?u=self.location.href:typeof document<"u"&&document.currentScript&&(u=document.currentScript.src),I&&(u=I),u=0!==u.indexOf("blob:")?u.substr(0,u.replace(/[?#].*/,"").lastIndexOf("/")+1):"",s&&(l=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 c,d=a.printErr||console.error.bind(console);Object.assign(a,i),i=null,a.arguments&&a.arguments,a.thisProgram&&(r=a.thisProgram),a.quit&&a.quit,a.wasmBinary&&(c=a.wasmBinary),"object"!=typeof WebAssembly&&A("no native wasm support detected");var h,p,f,m,g,v,b,_,y,w=!1;function k(){var e=h.buffer;a.HEAP8=p=new Int8Array(e),a.HEAP16=m=new Int16Array(e),a.HEAPU8=f=new Uint8Array(e),a.HEAPU16=g=new Uint16Array(e),a.HEAP32=v=new Int32Array(e),a.HEAPU32=b=new Uint32Array(e),a.HEAPF32=_=new Float32Array(e),a.HEAPF64=y=new Float64Array(e)}var x=[],S=[],C=[],E=0,T=null;function A(e){var t;null===(t=a.onAbort)||void 0===t||t.call(a,e),d(e="Aborted("+e+")"),w=!0,e+=". Build with -sASSERTIONS for more info.";var i=new WebAssembly.RuntimeError(e);throw n(i),i}var M,P,L=e=>e.startsWith("data:application/octet-stream;base64,");function O(e){if(e==M&&c)return new Uint8Array(c);if(l)return l(e);throw"both async and sync fetching of the wasm failed"}function N(e,t,n){return function(e){return c||!o&&!s||"function"!=typeof fetch?Promise.resolve().then((()=>O(e))):fetch(e,{credentials:"same-origin"}).then((t=>{if(!t.ok)throw"failed to load wasm binary file at '"+e+"'";return t.arrayBuffer()})).catch((()=>O(e)))}(e).then((e=>WebAssembly.instantiate(e,t))).then((e=>e)).then(n,(e=>{d(`failed to asynchronously prepare wasm: ${e}`),A(e)}))}L(M="zxing_reader.wasm")||(P=M,M=a.locateFile?a.locateFile(P,u):u+P);var R=e=>{for(;e.length>0;)e.shift()(a)};a.noExitRuntime;var z=[],q=0,D=0;function j(e){this.excPtr=e,this.ptr=e-24,this.set_type=function(e){b[this.ptr+4>>2]=e},this.get_type=function(){return b[this.ptr+4>>2]},this.set_destructor=function(e){b[this.ptr+8>>2]=e},this.get_destructor=function(){return b[this.ptr+8>>2]},this.set_caught=function(e){e=e?1:0,p[this.ptr+12|0]=e},this.get_caught=function(){return 0!=p[this.ptr+12|0]},this.set_rethrown=function(e){e=e?1:0,p[this.ptr+13|0]=e},this.get_rethrown=function(){return 0!=p[this.ptr+13|0]},this.init=function(e,t){this.set_adjusted_ptr(0),this.set_type(e),this.set_destructor(t)},this.set_adjusted_ptr=function(e){b[this.ptr+16>>2]=e},this.get_adjusted_ptr=function(){return b[this.ptr+16>>2]},this.get_exception_ptr=function(){if(Nt(this.get_type()))return b[this.excPtr>>2];var e=this.get_adjusted_ptr();return 0!==e?e:this.excPtr}}var $=e=>{var t=D;if(!t)return Tt(0),0;var n=new j(t);n.set_adjusted_ptr(t);var a=n.get_type();if(!a)return Tt(0),t;for(var i in e){var r=e[i];if(0===r||r===a)break;var o=n.ptr+16;if(Ot(r,a,o))return Tt(r),t}return Tt(a),t},B={},F=e=>{for(;e.length;){var t=e.pop();e.pop()(t)}};function V(e){return this.fromWireType(v[e>>2])}var U,H,W,Y={},Q={},K={},G=e=>{throw new U(e)},Z=(e,t,n)=>{function a(t){var a=n(t);a.length!==e.length&&G("Mismatched type converter count");for(var i=0;i{Q.hasOwnProperty(e)?i[t]=Q[e]:(r.push(e),Y.hasOwnProperty(e)||(Y[e]=[]),Y[e].push((()=>{i[t]=Q[e],++o===r.length&&a(i)})))})),0===r.length&&a(i)},J=e=>{for(var t="",n=e;f[n];)t+=H[f[n++]];return t},X=e=>{throw new W(e)};function ee(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!("argPackAdvance"in t))throw new TypeError("registerType registeredInstance requires argPackAdvance");return function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};var a=t.name;if(e||X(`type "${a}" must have a positive integer typeid pointer`),Q.hasOwnProperty(e)){if(n.ignoreDuplicateRegistrations)return;X(`Cannot register type '${a}' twice`)}if(Q[e]=t,delete K[e],Y.hasOwnProperty(e)){var i=Y[e];delete Y[e],i.forEach((e=>e()))}}(e,t,n)}var te,ne=8,ae=e=>({count:e.count,deleteScheduled:e.deleteScheduled,preservePointerOnDelete:e.preservePointerOnDelete,ptr:e.ptr,ptrType:e.ptrType,smartPtr:e.smartPtr,smartPtrType:e.smartPtrType}),ie=e=>{X(e.$$.ptrType.registeredClass.name+" instance already deleted")},re=!1,oe=e=>{},se=e=>{e.count.value-=1,0===e.count.value&&(e=>{e.smartPtr?e.smartPtrType.rawDestructor(e.smartPtr):e.ptrType.registeredClass.rawDestructor(e.ptr)})(e)},le=(e,t,n)=>{if(t===n)return e;if(void 0===n.baseClass)return null;var a=le(e,t,n.baseClass);return null===a?null:n.downcast(a)},ue={},ce=()=>Object.keys(me).length,de=()=>{var e=[];for(var t in me)me.hasOwnProperty(t)&&e.push(me[t]);return e},he=[],pe=()=>{for(;he.length;){var e=he.pop();e.$$.deleteScheduled=!1,e.delete()}},fe=e=>{te=e,he.length&&te&&te(pe)},me={},ge=(e,t)=>(t=((e,t)=>{for(void 0===t&&X("ptr should not be undefined");e.baseClass;)t=e.upcast(t),e=e.baseClass;return t})(e,t),me[t]),ve=(e,t)=>((!t.ptrType||!t.ptr)&&G("makeClassHandle requires ptr and ptrType"),!!t.smartPtrType!=!!t.smartPtr&&G("Both smartPtrType and smartPtr must be specified"),t.count={value:1},_e(Object.create(e,{$$:{value:t,writable:!0}})));function be(e){var t=this.getPointee(e);if(!t)return this.destructor(e),null;var n=ge(this.registeredClass,t);if(void 0!==n){if(0===n.$$.count.value)return n.$$.ptr=t,n.$$.smartPtr=e,n.clone();var a=n.clone();return this.destructor(e),a}function i(){return this.isSmartPointer?ve(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:t,smartPtrType:this,smartPtr:e}):ve(this.registeredClass.instancePrototype,{ptrType:this,ptr:e})}var r,o=this.registeredClass.getActualType(t),s=ue[o];if(!s)return i.call(this);r=this.isConst?s.constPointerType:s.pointerType;var l=le(t,this.registeredClass,r.registeredClass);return null===l?i.call(this):this.isSmartPointer?ve(r.registeredClass.instancePrototype,{ptrType:r,ptr:l,smartPtrType:this,smartPtr:e}):ve(r.registeredClass.instancePrototype,{ptrType:r,ptr:l})}var _e=e=>typeof FinalizationRegistry>"u"?(_e=e=>e,e):(re=new FinalizationRegistry((e=>{se(e.$$)})),oe=e=>re.unregister(e),(_e=e=>{var t=e.$$;if(t.smartPtr){var n={$$:t};re.register(e,n,e)}return e})(e));function ye(){}var we=(e,t)=>Object.defineProperty(t,"name",{value:e}),ke=(e,t,n)=>{if(void 0===e[t].overloadTable){var a=e[t];e[t]=function(){return e[t].overloadTable.hasOwnProperty(arguments.length)||X(`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[a.argCount]=a}},xe=(e,t,n)=>{a.hasOwnProperty(e)?((void 0===n||void 0!==a[e].overloadTable&&void 0!==a[e].overloadTable[n])&&X(`Cannot register public name '${e}' twice`),ke(a,e,e),a.hasOwnProperty(n)&&X(`Cannot register multiple overloads of a function with the same number of arguments (${n})!`),a[e].overloadTable[n]=t):(a[e]=t,void 0!==n&&(a[e].numArguments=n))};function Se(e,t,n,a,i,r,o,s){this.name=e,this.constructor=t,this.instancePrototype=n,this.rawDestructor=a,this.baseClass=i,this.getActualType=r,this.upcast=o,this.downcast=s,this.pureVirtualFunctions=[]}var Ce=(e,t,n)=>{for(;t!==n;)t.upcast||X(`Expected null or instance of ${n.name}, got an instance of ${t.name}`),e=t.upcast(e),t=t.baseClass;return e};function Ee(e,t){if(null===t)return this.isReference&&X(`null is not a valid ${this.name}`),0;t.$$||X(`Cannot pass "${Ge(t)}" as a ${this.name}`),t.$$.ptr||X(`Cannot pass deleted object as a pointer of type ${this.name}`);var n=t.$$.ptrType.registeredClass;return Ce(t.$$.ptr,n,this.registeredClass)}function Te(e,t){var n;if(null===t)return this.isReference&&X(`null is not a valid ${this.name}`),this.isSmartPointer?(n=this.rawConstructor(),null!==e&&e.push(this.rawDestructor,n),n):0;(!t||!t.$$)&&X(`Cannot pass "${Ge(t)}" as a ${this.name}`),t.$$.ptr||X(`Cannot pass deleted object as a pointer of type ${this.name}`),!this.isConst&&t.$$.ptrType.isConst&&X(`Cannot convert argument of type ${t.$$.smartPtrType?t.$$.smartPtrType.name:t.$$.ptrType.name} to parameter type ${this.name}`);var a=t.$$.ptrType.registeredClass;if(n=Ce(t.$$.ptr,a,this.registeredClass),this.isSmartPointer)switch(void 0===t.$$.smartPtr&&X("Passing raw pointer to smart pointer is illegal"),this.sharingPolicy){case 0:t.$$.smartPtrType===this?n=t.$$.smartPtr:X(`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 i=t.clone();n=this.rawShare(n,Ye.toHandle((()=>i.delete()))),null!==e&&e.push(this.rawDestructor,n)}break;default:X("Unsupporting sharing policy")}return n}function Ae(e,t){if(null===t)return this.isReference&&X(`null is not a valid ${this.name}`),0;t.$$||X(`Cannot pass "${Ge(t)}" as a ${this.name}`),t.$$.ptr||X(`Cannot pass deleted object as a pointer of type ${this.name}`),t.$$.ptrType.isConst&&X(`Cannot convert argument of type ${t.$$.ptrType.name} to parameter type ${this.name}`);var n=t.$$.ptrType.registeredClass;return Ce(t.$$.ptr,n,this.registeredClass)}function Me(e){return this.fromWireType(b[e>>2])}function Pe(e,t,n,a,i,r,o,s,l,u,c){this.name=e,this.registeredClass=t,this.isReference=n,this.isConst=a,this.isSmartPointer=i,this.pointeeType=r,this.sharingPolicy=o,this.rawGetPointee=s,this.rawConstructor=l,this.rawShare=u,this.rawDestructor=c,i||void 0!==t.baseClass?this.toWireType=Te:a?(this.toWireType=Ee,this.destructorFunction=null):(this.toWireType=Ae,this.destructorFunction=null)}var Le,Oe,Ne=(e,t,n)=>{a.hasOwnProperty(e)||G("Replacing nonexistant public symbol"),void 0!==a[e].overloadTable&&void 0!==n?a[e].overloadTable[n]=t:(a[e]=t,a[e].argCount=n)},Re=[],Ie=e=>{var t=Re[e];return t||(e>=Re.length&&(Re.length=e+1),Re[e]=t=Le.get(e)),t},ze=(e,t,n)=>e.includes("j")?((e,t,n)=>{var i=a["dynCall_"+e];return n&&n.length?i.apply(null,[t].concat(n)):i.call(null,t)})(e,t,n):Ie(t).apply(null,n),qe=(e,t)=>{var n=(e=J(e)).includes("j")?((e,t)=>{var n=[];return function(){return n.length=0,Object.assign(n,arguments),ze(e,t,n)}})(e,t):Ie(t);return"function"!=typeof n&&X(`unknown function pointer with signature ${e}: ${t}`),n},De=e=>{var t=Ct(e),n=J(t);return xt(t),n},je=(e,t)=>{var n=[],a={};throw t.forEach((function e(t){if(!a[t]&&!Q[t]){if(K[t])return void K[t].forEach(e);n.push(t),a[t]=!0}})),new Oe(`${e}: `+n.map(De).join([", "]))},$e=(e,t)=>{for(var n=[],a=0;a>2]);return n};function Be(e,t,n,a,i,r){var o=t.length;o<2&&X("argTypes array size mismatch! Must at least get return value and 'this' types!");var s=null!==t[1]&&null!==n,l=function(e){for(var t=1;t{const t=(e=e.trim()).indexOf("(");return-1!==t?e.substr(0,t):e};function Ve(){this.allocated=[void 0],this.freelist=[]}var Ue=new Ve,He=e=>{e>=Ue.reserved&&0==--Ue.get(e).refcount&&Ue.free(e)},We=()=>{for(var e=0,t=Ue.reserved;t(e||X("Cannot use deleted val. handle = "+e),Ue.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 Ue.allocate({refcount:1,value:e})}}},Qe=(e,t,n)=>{switch(t){case 1:return n?function(e){return this.fromWireType(p[0|e])}:function(e){return this.fromWireType(f[0|e])};case 2:return n?function(e){return this.fromWireType(m[e>>1])}:function(e){return this.fromWireType(g[e>>1])};case 4:return n?function(e){return this.fromWireType(v[e>>2])}:function(e){return this.fromWireType(b[e>>2])};default:throw new TypeError(`invalid integer width (${t}): ${e}`)}},Ke=(e,t)=>{var n=Q[e];return void 0===n&&X(t+" has unknown type "+De(e)),n},Ge=e=>{if(null===e)return"null";var t=typeof e;return"object"===t||"array"===t||"function"===t?e.toString():""+e},Ze=(e,t)=>{switch(t){case 4:return function(e){return this.fromWireType(_[e>>2])};case 8:return function(e){return this.fromWireType(y[e>>3])};default:throw new TypeError(`invalid float width (${t}): ${e}`)}},Je=(e,t,n)=>{switch(t){case 1:return n?e=>p[0|e]:e=>f[0|e];case 2:return n?e=>m[e>>1]:e=>g[e>>1];case 4:return n?e=>v[e>>2]:e=>b[e>>2];default:throw new TypeError(`invalid integer width (${t}): ${e}`)}},Xe=(e,t,n,a)=>{if(!(a>0))return 0;for(var i=n,r=n+a-1,o=0;o=55296&&s<=57343&&(s=65536+((1023&s)<<10)|1023&e.charCodeAt(++o)),s<=127){if(n>=r)break;t[n++]=s}else if(s<=2047){if(n+1>=r)break;t[n++]=192|s>>6,t[n++]=128|63&s}else if(s<=65535){if(n+2>=r)break;t[n++]=224|s>>12,t[n++]=128|s>>6&63,t[n++]=128|63&s}else{if(n+3>=r)break;t[n++]=240|s>>18,t[n++]=128|s>>12&63,t[n++]=128|s>>6&63,t[n++]=128|63&s}}return t[n]=0,n-i},et=e=>{for(var t=0,n=0;n=55296&&a<=57343?(t+=4,++n):t+=3}return t},tt=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0,nt=(e,t)=>e?((e,t,n)=>{for(var a=t+n,i=t;e[i]&&!(i>=a);)++i;if(i-t>16&&e.buffer&&tt)return tt.decode(e.subarray(t,i));for(var r="";t>10,56320|1023&u)}}else r+=String.fromCharCode((31&o)<<6|s)}else r+=String.fromCharCode(o)}return r})(f,e,t):"",at=typeof TextDecoder<"u"?new TextDecoder("utf-16le"):void 0,it=(e,t)=>{for(var n=e,a=n>>1,i=a+t/2;!(a>=i)&&g[a];)++a;if((n=a<<1)-e>32&&at)return at.decode(f.subarray(e,n));for(var r="",o=0;!(o>=t/2);++o){var s=m[e+2*o>>1];if(0==s)break;r+=String.fromCharCode(s)}return r},rt=(e,t,n)=>{var a;if(null!==(a=n)&&void 0!==a||(n=2147483647),n<2)return 0;for(var i=t,r=(n-=2)<2*e.length?n/2:e.length,o=0;o>1]=s,t+=2}return m[t>>1]=0,t-i},ot=e=>2*e.length,st=(e,t)=>{for(var n=0,a="";!(n>=t/4);){var i=v[e+4*n>>2];if(0==i)break;if(++n,i>=65536){var r=i-65536;a+=String.fromCharCode(55296|r>>10,56320|1023&r)}else a+=String.fromCharCode(i)}return a},lt=(e,t,n)=>{var a;if(null!==(a=n)&&void 0!==a||(n=2147483647),n<4)return 0;for(var i=t,r=i+n-4,o=0;o=55296&&s<=57343&&(s=65536+((1023&s)<<10)|1023&e.charCodeAt(++o)),v[t>>2]=s,(t+=4)+4>r)break}return v[t>>2]=0,t-i},ut=e=>{for(var t=0,n=0;n=55296&&a<=57343&&++n,t+=4}return t},ct=[],dt={},ht=()=>{if("object"==typeof globalThis)return globalThis;function e(e){e.$$$embind_global$$$=e;var t="object"==typeof $$$embind_global$$$&&e.$$$embind_global$$$==e;return t||delete e.$$$embind_global$$$,t}if("object"==typeof $$$embind_global$$$||("object"==typeof global&&e(global)?$$$embind_global$$$=global:"object"==typeof self&&e(self)&&($$$embind_global$$$=self),"object"==typeof $$$embind_global$$$))return $$$embind_global$$$;throw Error("unable to get global object.")},pt=Reflect.construct,ft=e=>{var t=(e-h.buffer.byteLength+65535)/65536;try{return h.grow(t),k(),1}catch(e){}},mt={},gt=()=>{if(!gt.strings){var e={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:("object"==typeof navigator&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:r||"./this.program"};for(var t in mt)void 0===mt[t]?delete e[t]:e[t]=mt[t];var n=[];for(var t in e)n.push(`${t}=${e[t]}`);gt.strings=n}return gt.strings},vt=e=>e%4==0&&(e%100!=0||e%400==0),bt=[31,29,31,30,31,30,31,31,30,31,30,31],_t=[31,28,31,30,31,30,31,31,30,31,30,31],yt=(e,t,n,a)=>{var i=b[a+40>>2],r={tm_sec:v[a>>2],tm_min:v[a+4>>2],tm_hour:v[a+8>>2],tm_mday:v[a+12>>2],tm_mon:v[a+16>>2],tm_year:v[a+20>>2],tm_wday:v[a+24>>2],tm_yday:v[a+28>>2],tm_isdst:v[a+32>>2],tm_gmtoff:v[a+36>>2],tm_zone:i?nt(i):""},o=nt(n),s={"%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 l in s)o=o.replace(new RegExp(l,"g"),s[l]);var u=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],c=["January","February","March","April","May","June","July","August","September","October","November","December"];function d(e,t,n){for(var a="number"==typeof e?e.toString():e||"";a.length0?1:0}var a;return 0===(a=n(e.getFullYear()-t.getFullYear()))&&0===(a=n(e.getMonth()-t.getMonth()))&&(a=n(e.getDate()-t.getDate())),a}function m(e){switch(e.getDay()){case 0:return new Date(e.getFullYear()-1,11,29);case 1:return e;case 2:return new Date(e.getFullYear(),0,3);case 3:return new Date(e.getFullYear(),0,2);case 4:return new Date(e.getFullYear(),0,1);case 5:return new Date(e.getFullYear()-1,11,31);case 6:return new Date(e.getFullYear()-1,11,30)}}function g(e){var t=((e,t)=>{for(var n=new Date(e.getTime());t>0;){var a=vt(n.getFullYear()),i=n.getMonth(),r=(a?bt:_t)[i];if(!(t>r-n.getDate()))return n.setDate(n.getDate()+t),n;t-=r-n.getDate()+1,n.setDate(1),i<11?n.setMonth(i+1):(n.setMonth(0),n.setFullYear(n.getFullYear()+1))}return n})(new Date(e.tm_year+1900,0,1),e.tm_yday),n=new Date(t.getFullYear(),0,4),a=new Date(t.getFullYear()+1,0,4),i=m(n),r=m(a);return f(i,t)<=0?f(r,t)<=0?t.getFullYear()+1:t.getFullYear():t.getFullYear()-1}var _={"%a":e=>u[e.tm_wday].substring(0,3),"%A":e=>u[e.tm_wday],"%b":e=>c[e.tm_mon].substring(0,3),"%B":e=>c[e.tm_mon],"%C":e=>h((e.tm_year+1900)/100|0,2),"%d":e=>h(e.tm_mday,2),"%e":e=>d(e.tm_mday,2," "),"%g":e=>g(e).toString().substring(2),"%G":e=>g(e),"%H":e=>h(e.tm_hour,2),"%I":e=>{var t=e.tm_hour;return 0==t?t=12:t>12&&(t-=12),h(t,2)},"%j":e=>h(e.tm_mday+((e,t)=>{for(var n=0,a=0;a<=t;n+=e[a++]);return n})(vt(e.tm_year+1900)?bt:_t,e.tm_mon-1),3),"%m":e=>h(e.tm_mon+1,2),"%M":e=>h(e.tm_min,2),"%n":()=>"\n","%p":e=>e.tm_hour>=0&&e.tm_hour<12?"AM":"PM","%S":e=>h(e.tm_sec,2),"%t":()=>"\t","%u":e=>e.tm_wday||7,"%U":e=>{var t=e.tm_yday+7-e.tm_wday;return h(Math.floor(t/7),2)},"%V":e=>{var t=Math.floor((e.tm_yday+7-(e.tm_wday+6)%7)/7);if((e.tm_wday+371-e.tm_yday-2)%7<=2&&t++,t){if(53==t){var n=(e.tm_wday+371-e.tm_yday)%7;4!=n&&(3!=n||!vt(e.tm_year))&&(t=1)}}else{t=52;var a=(e.tm_wday+7-e.tm_yday-1)%7;(4==a||5==a&&vt(e.tm_year%400-1))&&t++}return h(t,2)},"%w":e=>e.tm_wday,"%W":e=>{var t=e.tm_yday+7-(e.tm_wday+6)%7;return h(Math.floor(t/7),2)},"%y":e=>(e.tm_year+1900).toString().substring(2),"%Y":e=>e.tm_year+1900,"%z":e=>{var t=e.tm_gmtoff;return(t>=0?"+":"-")+("0000"+(t=(t=Math.abs(t)/60)/60*100+t%60)).slice(-4)},"%Z":e=>e.tm_zone,"%%":()=>"%"};for(var l in o=o.replace(/%%/g,"\0\0"),_)o.includes(l)&&(o=o.replace(new RegExp(l,"g"),_[l](r)));var y=function(e){var t=et(e)+1,n=new Array(t);return Xe(e,n,0,n.length),n}(o=o.replace(/\0\0/g,"%"));return y.length>t?0:(((e,t)=>{p.set(e,t)})(y,e),y.length-1)};U=a.InternalError=class extends Error{constructor(e){super(e),this.name="InternalError"}},(()=>{for(var e=new Array(256),t=0;t<256;++t)e[t]=String.fromCharCode(t);H=e})(),W=a.BindingError=class extends Error{constructor(e){super(e),this.name="BindingError"}},Object.assign(ye.prototype,{isAliasOf(e){if(!(this instanceof ye&&e instanceof ye))return!1;var t=this.$$.ptrType.registeredClass,n=this.$$.ptr;e.$$=e.$$;for(var a=e.$$.ptrType.registeredClass,i=e.$$.ptr;t.baseClass;)n=t.upcast(n),t=t.baseClass;for(;a.baseClass;)i=a.upcast(i),a=a.baseClass;return t===a&&n===i},clone(){if(this.$$.ptr||ie(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var e=_e(Object.create(Object.getPrototypeOf(this),{$$:{value:ae(this.$$)}}));return e.$$.count.value+=1,e.$$.deleteScheduled=!1,e},delete(){this.$$.ptr||ie(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&X("Object already scheduled for deletion"),oe(this),se(this.$$),this.$$.preservePointerOnDelete||(this.$$.smartPtr=void 0,this.$$.ptr=void 0)},isDeleted(){return!this.$$.ptr},deleteLater(){return this.$$.ptr||ie(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&X("Object already scheduled for deletion"),he.push(this),1===he.length&&te&&te(pe),this.$$.deleteScheduled=!0,this}}),a.getInheritedInstanceCount=ce,a.getLiveInheritedInstances=de,a.flushPendingDeletes=pe,a.setDelayFunction=fe,Object.assign(Pe.prototype,{getPointee(e){return this.rawGetPointee&&(e=this.rawGetPointee(e)),e},destructor(e){var t;null===(t=this.rawDestructor)||void 0===t||t.call(this,e)},argPackAdvance:ne,readValueFromPointer:Me,deleteObject(e){null!==e&&e.delete()},fromWireType:be}),Oe=a.UnboundTypeError=((e,t)=>{var n=we(t,(function(e){this.name=t,this.message=e;var n=new Error(e).stack;void 0!==n&&(this.stack=this.toString()+"\n"+n.replace(/^Error(:[^\n]*)?\n/,""))}));return n.prototype=Object.create(e.prototype),n.prototype.constructor=n,n.prototype.toString=function(){return void 0===this.message?this.name:`${this.name}: ${this.message}`},n})(Error,"UnboundTypeError"),Object.assign(Ve.prototype,{get(e){return this.allocated[e]},has(e){return void 0!==this.allocated[e]},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)}}),Ue.allocated.push({value:void 0},{value:null},{value:!0},{value:!1}),Ue.reserved=Ue.allocated.length,a.count_emval_handles=We;var wt={s:e=>{var t=new j(e);return t.get_caught()||(t.set_caught(!0),q--),t.set_rethrown(!1),z.push(t),Lt(t.excPtr),t.get_exception_ptr()},u:()=>{Et(0,0);var e=z.pop();Pt(e.excPtr),D=0},b:()=>$([]),g:e=>$([e]),q:(e,t)=>$([e,t]),J:()=>{var e=z.pop();e||A("no exception to throw");var t=e.excPtr;throw e.get_rethrown()||(z.push(e),e.set_rethrown(!0),e.set_caught(!1),q++),D=t},f:(e,t,n)=>{throw new j(e).init(t,n),q++,D=e},V:()=>q,d:e=>{throw D||(D=e),D},da:e=>{var t=B[e];delete B[e];var n=t.rawConstructor,a=t.rawDestructor,i=t.fields,r=i.map((e=>e.getterReturnType)).concat(i.map((e=>e.setterArgumentType)));Z([e],r,(e=>{var r={};return i.forEach(((t,n)=>{var a=t.fieldName,o=e[n],s=t.getter,l=t.getterContext,u=e[n+i.length],c=t.setter,d=t.setterContext;r[a]={read:e=>o.fromWireType(s(l,e)),write:(e,t)=>{var n=[];c(d,e,u.toWireType(n,t)),F(n)}}})),[{name:t.name,fromWireType:e=>{var t={};for(var n in r)t[n]=r[n].read(e);return a(e),t},toWireType:(e,t)=>{for(var i in r)if(!(i in t))throw new TypeError(`Missing field: "${i}"`);var o=n();for(i in r)r[i].write(o,t[i]);return null!==e&&e.push(a,o),o},argPackAdvance:ne,readValueFromPointer:V,destructorFunction:a}]}))},Q:(e,t,n,a,i)=>{},_:(e,t,n,a)=>{ee(e,{name:t=J(t),fromWireType:function(e){return!!e},toWireType:function(e,t){return t?n:a},argPackAdvance:ne,readValueFromPointer:function(e){return this.fromWireType(f[e])},destructorFunction:null})},ca:(e,t,n,a,i,r,o,s,l,u,c,d,h)=>{c=J(c),r=qe(i,r),s&&(s=qe(o,s)),u&&(u=qe(l,u)),h=qe(d,h);var p=(e=>{if(void 0===e)return"_unknown";var t=(e=e.replace(/[^a-zA-Z0-9_]/g,"$")).charCodeAt(0);return t>=48&&t<=57?`_${e}`:e})(c);xe(p,(function(){je(`Cannot construct ${c} due to unbound types`,[a])})),Z([e,t,n],a?[a]:[],(function(t){var n,i;t=t[0],i=a?(n=t.registeredClass).instancePrototype:ye.prototype;var o=we(c,(function(){if(Object.getPrototypeOf(this)!==l)throw new W("Use 'new' to construct "+c);if(void 0===m.constructor_body)throw new W(c+" has no accessible constructor");var e=m.constructor_body[arguments.length];if(void 0===e)throw new W(`Tried to invoke ctor of ${c} with invalid number of parameters (${arguments.length}) - expected (${Object.keys(m.constructor_body).toString()}) parameters instead!`);return e.apply(this,arguments)})),l=Object.create(i,{constructor:{value:o}});o.prototype=l;var d,f,m=new Se(c,o,l,h,n,r,s,u);m.baseClass&&(null!==(f=(d=m.baseClass).__derivedClasses)&&void 0!==f||(d.__derivedClasses=[]),m.baseClass.__derivedClasses.push(m));var g=new Pe(c,m,!0,!1,!1),v=new Pe(c+"*",m,!1,!1,!1),b=new Pe(c+" const*",m,!1,!0,!1);return ue[e]={pointerType:v,constPointerType:b},Ne(p,o),[g,v,b]}))},ba:(e,t,n,a,i,r)=>{var o=$e(t,n);i=qe(a,i),Z([],[e],(function(e){var n=`constructor ${(e=e[0]).name}`;if(void 0===e.registeredClass.constructor_body&&(e.registeredClass.constructor_body=[]),void 0!==e.registeredClass.constructor_body[t-1])throw new W(`Cannot register multiple constructors with identical number of parameters (${t-1}) for class '${e.name}'! Overload resolution is currently only performed using the parameter count, not actual type info!`);return e.registeredClass.constructor_body[t-1]=()=>{je(`Cannot construct ${e.name} due to unbound types`,o)},Z([],o,(a=>(a.splice(1,0,null),e.registeredClass.constructor_body[t-1]=Be(n,a,null,i,r),[]))),[]}))},w:(e,t,n,a,i,r,o,s,l)=>{var u=$e(n,a);t=J(t),t=Fe(t),r=qe(i,r),Z([],[e],(function(e){var a=`${(e=e[0]).name}.${t}`;function i(){je(`Cannot call ${a} due to unbound types`,u)}t.startsWith("@@")&&(t=Symbol[t.substring(2)]),s&&e.registeredClass.pureVirtualFunctions.push(t);var l=e.registeredClass.instancePrototype,c=l[t];return void 0===c||void 0===c.overloadTable&&c.className!==e.name&&c.argCount===n-2?(i.argCount=n-2,i.className=e.name,l[t]=i):(ke(l,t,a),l[t].overloadTable[n-2]=i),Z([],u,(function(i){var s=Be(a,i,e,r,o);return void 0===l[t].overloadTable?(s.argCount=n-2,l[t]=s):l[t].overloadTable[n-2]=s,[]})),[]}))},Y:(e,t)=>{ee(e,{name:t=J(t),fromWireType:e=>{var t=Ye.toValue(e);return He(e),t},toWireType:(e,t)=>Ye.toHandle(t),argPackAdvance:ne,readValueFromPointer:V,destructorFunction:null})},x:(e,t,n,a)=>{function i(){}t=J(t),i.values={},ee(e,{name:t,constructor:i,fromWireType:function(e){return this.constructor.values[e]},toWireType:(e,t)=>t.value,argPackAdvance:ne,readValueFromPointer:Qe(t,n,a),destructorFunction:null}),xe(t,i)},h:(e,t,n)=>{var a=Ke(e,"enum");t=J(t);var i=a.constructor,r=Object.create(a.constructor.prototype,{value:{value:n},constructor:{value:we(`${a.name}_${t}`,(function(){}))}});i.values[n]=r,i[t]=r},L:(e,t,n)=>{ee(e,{name:t=J(t),fromWireType:e=>e,toWireType:(e,t)=>t,argPackAdvance:ne,readValueFromPointer:Ze(t,n),destructorFunction:null})},M:(e,t,n,a,i,r,o)=>{var s=$e(t,n);e=J(e),e=Fe(e),i=qe(a,i),xe(e,(function(){je(`Cannot call ${e} due to unbound types`,s)}),t-1),Z([],s,(function(n){var a=[n[0],null].concat(n.slice(1));return Ne(e,Be(e,a,null,i,r),t-1),[]}))},t:(e,t,n,a,i)=>{t=J(t);var r=e=>e;if(0===a){var o=32-8*n;r=e=>e<>>o}var s=t.includes("unsigned");ee(e,{name:t,fromWireType:r,toWireType:s?function(e,t){return this.name,t>>>0}:function(e,t){return this.name,t},argPackAdvance:ne,readValueFromPointer:Je(t,n,0!==a),destructorFunction:null})},o:(e,t,n)=>{var a=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array][t];function i(e){var t=b[e>>2],n=b[e+4>>2];return new a(p.buffer,n,t)}ee(e,{name:n=J(n),fromWireType:i,argPackAdvance:ne,readValueFromPointer:i},{ignoreDuplicateRegistrations:!0})},K:(e,t)=>{var n="std::string"===(t=J(t));ee(e,{name:t,fromWireType(e){var t,a=b[e>>2],i=e+4;if(n)for(var r=i,o=0;o<=a;++o){var s=i+o;if(o==a||0==f[s]){var l=nt(r,s-r);void 0===t?t=l:(t+="\0",t+=l),r=s+1}}else{var u=new Array(a);for(o=0;o>2]=a,n&&i)((e,t,n)=>{Xe(e,f,t,n)})(t,o,a+1);else if(i)for(var s=0;s255&&(xt(o),X("String has UTF-16 code units that do not fit in 8 bits")),f[o+s]=l}else for(s=0;s{var a,i,r,o,s;n=J(n),2===t?(a=it,i=rt,o=ot,r=()=>g,s=1):4===t&&(a=st,i=lt,o=ut,r=()=>b,s=2),ee(e,{name:n,fromWireType:e=>{for(var n,i=b[e>>2],o=r(),l=e+4,u=0;u<=i;++u){var c=e+4+u*t;if(u==i||0==o[c>>s]){var d=a(l,c-l);void 0===n?n=d:(n+="\0",n+=d),l=c+t}}return xt(e),n},toWireType:(e,a)=>{"string"!=typeof a&&X(`Cannot pass non-string to C++ string type ${n}`);var r=o(a),l=St(4+r+t);return b[l>>2]=r>>s,i(a,l+4,r+t),null!==e&&e.push(xt,l),l},argPackAdvance:ne,readValueFromPointer:V,destructorFunction(e){xt(e)}})},A:(e,t,n,a,i,r)=>{B[e]={name:J(t),rawConstructor:qe(n,a),rawDestructor:qe(i,r),fields:[]}},ea:(e,t,n,a,i,r,o,s,l,u)=>{B[e].fields.push({fieldName:J(t),getterReturnType:n,getter:qe(a,i),getterContext:r,setterArgumentType:o,setter:qe(s,l),setterContext:u})},$:(e,t)=>{ee(e,{isVoid:!0,name:t=J(t),argPackAdvance:0,fromWireType:()=>{},toWireType:(e,t)=>{}})},R:(e,t,n,a)=>(e=ct[e])(null,t=Ye.toValue(t),n,a),ha:He,fa:e=>0===e?Ye.toHandle(ht()):(e=(e=>{var t=dt[e];return void 0===t?J(e):t})(e),Ye.toHandle(ht()[e])),Z:(e,t,n)=>{var a=((e,t)=>{for(var n=new Array(e),a=0;a>2],"parameter "+a);return n})(e,t),i=a.shift();e--;var r=new Array(e),o=`methodCaller<(${a.map((e=>e.name)).join(", ")}) => ${i.name}>`;return(e=>{var t=ct.length;return ct.push(e),t})(we(o,((t,o,s,l)=>{for(var u=0,c=0;c{var a=[],i=e.toWireType(a,n);return a.length&&(b[t>>2]=Ye.toHandle(a)),i})(i,s,d)})))},N:e=>{e>4&&(Ue.get(e).refcount+=1)},O:e=>{var t=Ye.toValue(e);F(t),He(e)},aa:(e,t)=>{var n=(e=Ke(e,"_emval_take_value")).readValueFromPointer(t);return Ye.toHandle(n)},B:()=>{A("")},X:(e,t,n)=>f.copyWithin(e,t,t+n),W:e=>{var t,n,a=f.length,i=2147483648;if((e>>>=0)>i)return!1;for(var r=1;r<=4;r*=2){var o=a*(1+.2/r);o=Math.min(o,e+100663296);var s=Math.min(i,(t=Math.max(e,o))+((n=65536)-t%n)%n);if(ft(s))return!0}return!1},T:(e,t)=>{var n=0;return gt().forEach(((a,i)=>{var r=t+n;b[e+4*i>>2]=r,((e,t)=>{for(var n=0;n{var n=gt();b[e>>2]=n.length;var a=0;return n.forEach((e=>a+=e.length+1)),b[t>>2]=a,0},E:function(e,t,n,a){var i=At();try{return Ie(e)(t,n,a)}catch(e){if(Mt(i),e!==e+0)throw e;Et(1,0)}},D:function(e,t,n,a,i){var r=At();try{return Ie(e)(t,n,a,i)}catch(e){if(Mt(r),e!==e+0)throw e;Et(1,0)}},F:function(e,t,n,a){var i=At();try{return Ie(e)(t,n,a)}catch(e){if(Mt(i),e!==e+0)throw e;Et(1,0)}},n:function(e){var t=At();try{return Ie(e)()}catch(e){if(Mt(t),e!==e+0)throw e;Et(1,0)}},a:function(e,t){var n=At();try{return Ie(e)(t)}catch(e){if(Mt(n),e!==e+0)throw e;Et(1,0)}},e:function(e,t,n){var a=At();try{return Ie(e)(t,n)}catch(e){if(Mt(a),e!==e+0)throw e;Et(1,0)}},m:function(e,t,n,a){var i=At();try{return Ie(e)(t,n,a)}catch(e){if(Mt(i),e!==e+0)throw e;Et(1,0)}},k:function(e,t,n,a,i){var r=At();try{return Ie(e)(t,n,a,i)}catch(e){if(Mt(r),e!==e+0)throw e;Et(1,0)}},H:function(e,t,n,a,i,r){var o=At();try{return Ie(e)(t,n,a,i,r)}catch(e){if(Mt(o),e!==e+0)throw e;Et(1,0)}},v:function(e,t,n,a,i,r,o){var s=At();try{return Ie(e)(t,n,a,i,r,o)}catch(e){if(Mt(s),e!==e+0)throw e;Et(1,0)}},G:function(e,t,n,a,i,r,o,s){var l=At();try{return Ie(e)(t,n,a,i,r,o,s)}catch(e){if(Mt(l),e!==e+0)throw e;Et(1,0)}},z:function(e,t,n,a,i,r,o,s,l,u,c,d){var h=At();try{return Ie(e)(t,n,a,i,r,o,s,l,u,c,d)}catch(e){if(Mt(h),e!==e+0)throw e;Et(1,0)}},P:function(e,t,n,a,i){var r=At();try{return It(e,t,n,a,i)}catch(e){if(Mt(r),e!==e+0)throw e;Et(1,0)}},l:function(e){var t=At();try{Ie(e)()}catch(e){if(Mt(t),e!==e+0)throw e;Et(1,0)}},j:function(e,t){var n=At();try{Ie(e)(t)}catch(e){if(Mt(n),e!==e+0)throw e;Et(1,0)}},c:function(e,t,n){var a=At();try{Ie(e)(t,n)}catch(e){if(Mt(a),e!==e+0)throw e;Et(1,0)}},p:function(e,t,n,a){var i=At();try{Ie(e)(t,n,a)}catch(e){if(Mt(i),e!==e+0)throw e;Et(1,0)}},I:function(e,t,n,a,i){var r=At();try{Ie(e)(t,n,a,i)}catch(e){if(Mt(r),e!==e+0)throw e;Et(1,0)}},r:function(e,t,n,a,i,r,o,s){var l=At();try{Ie(e)(t,n,a,i,r,o,s)}catch(e){if(Mt(l),e!==e+0)throw e;Et(1,0)}},i:function(e,t,n,a,i,r,o,s,l,u,c){var d=At();try{Ie(e)(t,n,a,i,r,o,s,l,u,c)}catch(e){if(Mt(d),e!==e+0)throw e;Et(1,0)}},y:function(e,t,n,a,i,r,o,s,l,u,c,d,h,p,f,m){var g=At();try{Ie(e)(t,n,a,i,r,o,s,l,u,c,d,h,p,f,m)}catch(e){if(Mt(g),e!==e+0)throw e;Et(1,0)}},ga:e=>e,S:(e,t,n,a,i)=>yt(e,t,n,a)},kt=function(){var e={a:wt};function t(e,t){return kt=e.exports,h=kt.ia,k(),Le=kt.ma,function(e){S.unshift(e)}(kt.ja),function(){var e;if(E--,null===(e=a.monitorRunDependencies)||void 0===e||e.call(a,E),0==E&&T){var t=T;T=null,t()}}(),kt}if(function(){var e;E++,null===(e=a.monitorRunDependencies)||void 0===e||e.call(a,E)}(),a.instantiateWasm)try{return a.instantiateWasm(e,t)}catch(e){d(`Module.instantiateWasm callback failed with error: ${e}`),n(e)}return function(e,t,n,a){return e||"function"!=typeof WebAssembly.instantiateStreaming||L(t)||"function"!=typeof fetch?N(t,n,a):fetch(t,{credentials:"same-origin"}).then((e=>WebAssembly.instantiateStreaming(e,n).then(a,(function(e){return d(`wasm streaming compile failed: ${e}`),d("falling back to ArrayBuffer instantiation"),N(t,n,a)}))))}(c,M,e,(function(e){t(e.instance)})).catch(n),{}}(),xt=a._free=e=>(xt=a._free=kt.ka)(e),St=a._malloc=e=>(St=a._malloc=kt.la)(e),Ct=e=>(Ct=kt.na)(e),Et=(e,t)=>(Et=kt.oa)(e,t),Tt=e=>(Tt=kt.pa)(e),At=()=>(At=kt.qa)(),Mt=e=>(Mt=kt.ra)(e),Pt=e=>(Pt=kt.sa)(e),Lt=e=>(Lt=kt.ta)(e),Ot=(e,t,n)=>(Ot=kt.ua)(e,t,n),Nt=e=>(Nt=kt.va)(e);a.dynCall_viijii=(e,t,n,i,r,o,s)=>(a.dynCall_viijii=kt.wa)(e,t,n,i,r,o,s);var Rt,It=a.dynCall_jiiii=(e,t,n,i,r)=>(It=a.dynCall_jiiii=kt.xa)(e,t,n,i,r);function zt(){function e(){Rt||(Rt=!0,a.calledRun=!0,!w&&(R(S),t(a),a.onRuntimeInitialized&&a.onRuntimeInitialized(),function(){if(a.postRun)for("function"==typeof a.postRun&&(a.postRun=[a.postRun]);a.postRun.length;)e=a.postRun.shift(),C.unshift(e);var e;R(C)}()))}E>0||(function(){if(a.preRun)for("function"==typeof a.preRun&&(a.preRun=[a.preRun]);a.preRun.length;)e=a.preRun.shift(),x.unshift(e);var e;R(x)}(),E>0)||(a.setStatus?(a.setStatus("Running..."),setTimeout((function(){setTimeout((function(){a.setStatus("")}),1),e()}),1)):e())}if(a.dynCall_iiiiij=(e,t,n,i,r,o,s)=>(a.dynCall_iiiiij=kt.ya)(e,t,n,i,r,o,s),a.dynCall_iiiiijj=(e,t,n,i,r,o,s,l,u)=>(a.dynCall_iiiiijj=kt.za)(e,t,n,i,r,o,s,l,u),a.dynCall_iiiiiijj=(e,t,n,i,r,o,s,l,u,c)=>(a.dynCall_iiiiiijj=kt.Aa)(e,t,n,i,r,o,s,l,u,c),T=function e(){Rt||zt(),Rt||(T=e)},a.preInit)for("function"==typeof a.preInit&&(a.preInit=[a.preInit]);a.preInit.length>0;)a.preInit.pop()();return zt(),e.ready});async function D(e,t){return async function(e,t,n=M){const a={...M,...n},i=await R(e),{size:r}=t,o=new Uint8Array(await t.arrayBuffer()),s=i._malloc(r);i.HEAPU8.set(o,s);const l=i.readBarcodesFromImage(s,r,P(i,a));i._free(s);const u=[];for(let e=0;e{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)})(this,z,void 0);try{const a=null==(t=null==e?void 0:e.formats)?void 0:t.filter((e=>"unknown"!==e));if(0===(null==a?void 0:a.length))throw new TypeError("Hint option provided, but is empty.");null==a||a.forEach((e=>{if(!o.has(e))throw new TypeError(`Failed to read the 'formats' property from 'BarcodeDetectorOptions': The provided value '${e}' is not a valid enum value of type BarcodeFormat.`)})),((e,t,a)=>{n(e,t,"write to private field"),t.set(e,a)})(this,z,null!=a?a:[]),function(e){return R(q,e)}().then((e=>{this.dispatchEvent(new CustomEvent("load",{detail:e}))})).catch((e=>{this.dispatchEvent(new CustomEvent("error",{detail:e}))}))}catch(e){throw b(e,"Failed to construct 'BarcodeDetector'")}}static async getSupportedFormats(){return r.filter((e=>"unknown"!==e))}async detect(e){try{const t=await v(e);if(null===t)return[];let n;try{n=m(t)?await D(t,{tryHarder:!0,formats:a(this,z).map((e=>o.get(e)))}):await j(t,{tryHarder:!0,formats:a(this,z).map((e=>o.get(e)))})}catch(e){throw console.error(e),new DOMException("Barcode detection service unavailable.","NotSupportedError")}return n.map((e=>{const{topLeft:{x:t,y:n},topRight:{x:a,y:i},bottomLeft:{x:r,y:o},bottomRight:{x:l,y:u}}=e.position,c=Math.min(t,a,r,l),d=Math.min(n,i,o,u),h=Math.max(t,a,r,l),p=Math.max(n,i,o,u);return{boundingBox:new DOMRectReadOnly(c,d,h-c,p-d),rawValue:e.text,format:s(e.format),cornerPoints:[{x:t,y:n},{x:a,y:i},{x:l,y:u},{x:r,y:o}]}}))}catch(e){throw b(e,"Failed to execute 'detect' on 'BarcodeDetector'")}}}z=new WeakMap;const B=(e,t,n="error")=>{let a,i;const r=new Promise(((r,o)=>{a=r,i=o,e.addEventListener(t,a),e.addEventListener(n,i)}));return r.finally((()=>{e.removeEventListener(t,a),e.removeEventListener(n,i)})),r},F=e=>new Promise((t=>setTimeout(t,e)));class V extends Error{constructor(){super("can't process cross-origin image"),this.name="DropImageFetchError"}}class U extends Error{constructor(){super("this browser has no Stream API support"),this.name="StreamApiNotSupportedError"}}class H extends Error{constructor(){super("camera access is only permitted in secure context. Use HTTPS or localhost rather than HTTP."),this.name="InsecureContextError"}}class W 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 Y;async function Q(e){Y=await async function(e){if(void 0===window.BarcodeDetector)return console.debug("[vue-qrcode-reader] Native BarcodeDetector not supported. Will use polyfill."),new $({formats:e});const t=await window.BarcodeDetector.getSupportedFormats(),n=e.filter((e=>!t.includes(e)));return n.length>0?(console.debug(`[vue-qrcode-reader] Native BarcodeDetector does not support formats ${JSON.stringify(n)}. Will use polyfill.`),new $({formats:e})):(console.debug("[vue-qrcode-reader] Will use native BarcodeDetector."),new window.BarcodeDetector({formats:e}))}(e)}const K=async(e,t=["qr_code"])=>await new $({formats:t}).detect(e),G=async(e,t=["qr_code"])=>{const n=new $({formats:t}),a=await(async e=>{if(e.startsWith("http")&&!1===e.includes(location.host))throw new V;const t=document.createElement("img");return t.src=e,await B(t,"load"),t})(e);return await n.detect(a)};var Z={},J={};Object.defineProperty(J,"__esModule",{value:!0}),J.compactObject=function e(t){return ie(t)?Object.keys(t).reduce((function(n,a){var i=ie(t[a]),r=i?e(t[a]):t[a],o=i&&!Object.keys(r).length;return void 0===r||o?n:Object.assign(n,function(e,t,n){return t=function(e){var t=function(e,t){if("object"!==ee(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var a=n.call(e,t||"default");if("object"!==ee(a))return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===ee(t)?t:String(t)}(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}({},a,r))}),{}):t},J.deprecated=function(e,t){ne&&console.warn(e+" is deprecated, please use "+t+" instead.")};var X=J.detectBrowser=function(e){var t={browser:null,version:null};if(typeof e>"u"||!e.navigator||!e.navigator.userAgent)return t.browser="Not a browser.",t;var n=e.navigator;if(n.mozGetUserMedia)t.browser="firefox",t.version=ae(n.userAgent,/Firefox\/(\d+)\./,1);else if(n.webkitGetUserMedia||!1===e.isSecureContext&&e.webkitRTCPeerConnection)t.browser="chrome",t.version=ae(n.userAgent,/Chrom(e|ium)\/(\d+)\./,2);else{if(!e.RTCPeerConnection||!n.userAgent.match(/AppleWebKit\/(\d+)\./))return t.browser="Not a supported browser.",t;t.browser="safari",t.version=ae(n.userAgent,/AppleWebKit\/(\d+)\./,1),t.supportsUnifiedPlan=e.RTCRtpTransceiver&&"currentDirection"in e.RTCRtpTransceiver.prototype}return t};function ee(e){return(ee="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}J.disableLog=function(e){return"boolean"!=typeof e?new Error("Argument type: "+ee(e)+". Please use a boolean."):(te=e,e?"adapter.js logging disabled":"adapter.js logging enabled")},J.disableWarnings=function(e){return"boolean"!=typeof e?new Error("Argument type: "+ee(e)+". Please use a boolean."):(ne=!e,"adapter.js deprecation warnings "+(e?"disabled":"enabled"))},J.extractVersion=ae,J.filterStats=function(e,t,n){var a=n?"outbound-rtp":"inbound-rtp",i=new Map;if(null===t)return i;var r=[];return e.forEach((function(e){"track"===e.type&&e.trackIdentifier===t.id&&r.push(e)})),r.forEach((function(t){e.forEach((function(n){n.type===a&&n.trackId===t.id&&re(e,n,i)}))})),i},J.log=function(){if("object"===(typeof window>"u"?"undefined":ee(window))){if(te)return;typeof console<"u"&&"function"==typeof console.log&&console.log.apply(console,arguments)}},J.walkStats=re,J.wrapPeerConnectionEvent=function(e,t,n){if(e.RTCPeerConnection){var a=e.RTCPeerConnection.prototype,i=a.addEventListener;a.addEventListener=function(e,a){if(e!==t)return i.apply(this,arguments);var r=function(e){var t=n(e);t&&(a.handleEvent?a.handleEvent(t):a(t))};return this._eventMap=this._eventMap||{},this._eventMap[t]||(this._eventMap[t]=new Map),this._eventMap[t].set(a,r),i.apply(this,[e,r])};var r=a.removeEventListener;a.removeEventListener=function(e,n){if(e!==t||!this._eventMap||!this._eventMap[t])return r.apply(this,arguments);if(!this._eventMap[t].has(n))return r.apply(this,arguments);var a=this._eventMap[t].get(n);return this._eventMap[t].delete(n),0===this._eventMap[t].size&&delete this._eventMap[t],0===Object.keys(this._eventMap).length&&delete this._eventMap,r.apply(this,[e,a])},Object.defineProperty(a,"on"+t,{get:function(){return this["_on"+t]},set:function(e){this["_on"+t]&&(this.removeEventListener(t,this["_on"+t]),delete this["_on"+t]),e&&this.addEventListener(t,this["_on"+t]=e)},enumerable:!0,configurable:!0})}};var te=!0,ne=!0;function ae(e,t,n){var a=e.match(t);return a&&a.length>=n&&parseInt(a[n],10)}function ie(e){return"[object Object]"===Object.prototype.toString.call(e)}function re(e,t,n){!t||n.has(t.id)||(n.set(t.id,t),Object.keys(t).forEach((function(a){a.endsWith("Id")?re(e,e.get(t[a]),n):a.endsWith("Ids")&&t[a].forEach((function(t){re(e,e.get(t),n)}))})))}Object.defineProperty(Z,"__esModule",{value:!0});var oe=Z.shimGetUserMedia=function(e,t){var n=e&&e.navigator;if(n.mediaDevices){var a=function(e){if("object"!==ue(e)||e.mandatory||e.optional)return e;var t={};return Object.keys(e).forEach((function(n){if("require"!==n&&"advanced"!==n&&"mediaSource"!==n){var a="object"===ue(e[n])?e[n]:{ideal:e[n]};void 0!==a.exact&&"number"==typeof a.exact&&(a.min=a.max=a.exact);var i=function(e,t){return e?e+t.charAt(0).toUpperCase()+t.slice(1):"deviceId"===t?"sourceId":t};if(void 0!==a.ideal){t.optional=t.optional||[];var r={};"number"==typeof a.ideal?(r[i("min",n)]=a.ideal,t.optional.push(r),(r={})[i("max",n)]=a.ideal,t.optional.push(r)):(r[i("",n)]=a.ideal,t.optional.push(r))}void 0!==a.exact&&"number"!=typeof a.exact?(t.mandatory=t.mandatory||{},t.mandatory[i("",n)]=a.exact):["min","max"].forEach((function(e){void 0!==a[e]&&(t.mandatory=t.mandatory||{},t.mandatory[i(e,n)]=a[e])}))}})),e.advanced&&(t.optional=(t.optional||[]).concat(e.advanced)),t},i=function(e,i){if(t.version>=61)return i(e);if((e=JSON.parse(JSON.stringify(e)))&&"object"===ue(e.audio)){var r=function(e,t,n){t in e&&!(n in e)&&(e[n]=e[t],delete e[t])};r((e=JSON.parse(JSON.stringify(e))).audio,"autoGainControl","googAutoGainControl"),r(e.audio,"noiseSuppression","googNoiseSuppression"),e.audio=a(e.audio)}if(e&&"object"===ue(e.video)){var o=e.video.facingMode;o=o&&("object"===ue(o)?o:{ideal:o});var s,l=t.version<66;if(o&&("user"===o.exact||"environment"===o.exact||"user"===o.ideal||"environment"===o.ideal)&&(!n.mediaDevices.getSupportedConstraints||!n.mediaDevices.getSupportedConstraints().facingMode||l))if(delete e.video.facingMode,"environment"===o.exact||"environment"===o.ideal?s=["back","rear"]:("user"===o.exact||"user"===o.ideal)&&(s=["front"]),s)return n.mediaDevices.enumerateDevices().then((function(t){var n=(t=t.filter((function(e){return"videoinput"===e.kind}))).find((function(e){return s.some((function(t){return e.label.toLowerCase().includes(t)}))}));return!n&&t.length&&s.includes("back")&&(n=t[t.length-1]),n&&(e.video.deviceId=o.exact?{exact:n.deviceId}:{ideal:n.deviceId}),e.video=a(e.video),ce("chrome: "+JSON.stringify(e)),i(e)}));e.video=a(e.video)}return ce("chrome: "+JSON.stringify(e)),i(e)},r=function(e){return t.version>=64?e:{name:{PermissionDeniedError:"NotAllowedError",PermissionDismissedError:"NotAllowedError",InvalidStateError:"NotAllowedError",DevicesNotFoundError:"NotFoundError",ConstraintNotSatisfiedError:"OverconstrainedError",TrackStartError:"NotReadableError",MediaDeviceFailedDueToShutdown:"NotAllowedError",MediaDeviceKillSwitchOn:"NotAllowedError",TabCaptureError:"AbortError",ScreenCaptureError:"AbortError",DeviceCaptureError:"AbortError"}[e.name]||e.name,message:e.message,constraint:e.constraint||e.constraintName,toString:function(){return this.name+(this.message&&": ")+this.message}}};if(n.getUserMedia=function(e,t,a){i(e,(function(e){n.webkitGetUserMedia(e,t,(function(e){a&&a(r(e))}))}))}.bind(n),n.mediaDevices.getUserMedia){var o=n.mediaDevices.getUserMedia.bind(n.mediaDevices);n.mediaDevices.getUserMedia=function(e){return i(e,(function(e){return o(e).then((function(t){if(e.audio&&!t.getAudioTracks().length||e.video&&!t.getVideoTracks().length)throw t.getTracks().forEach((function(e){e.stop()})),new DOMException("","NotFoundError");return t}),(function(e){return Promise.reject(r(e))}))}))}}}},se=function(e,t){if(e&&e.__esModule)return e;if(null===e||"object"!==ue(e)&&"function"!=typeof e)return{default:e};var n=le(t);if(n&&n.has(e))return n.get(e);var a={},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var r in e)if("default"!==r&&Object.prototype.hasOwnProperty.call(e,r)){var o=i?Object.getOwnPropertyDescriptor(e,r):null;o&&(o.get||o.set)?Object.defineProperty(a,r,o):a[r]=e[r]}return a.default=e,n&&n.set(e,a),a}(J);function le(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(le=function(e){return e?n:t})(e)}function ue(e){return(ue="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var ce=se.log;var de={};Object.defineProperty(de,"__esModule",{value:!0});var he=de.shimGetUserMedia=function(e,t){var n=e&&e.navigator,a=e&&e.MediaStreamTrack;if(n.getUserMedia=function(e,t,a){pe.deprecated("navigator.getUserMedia","navigator.mediaDevices.getUserMedia"),n.mediaDevices.getUserMedia(e).then(t,a)},!(t.version>55&&"autoGainControl"in n.mediaDevices.getSupportedConstraints())){var i=function(e,t,n){t in e&&!(n in e)&&(e[n]=e[t],delete e[t])},r=n.mediaDevices.getUserMedia.bind(n.mediaDevices);if(n.mediaDevices.getUserMedia=function(e){return"object"===me(e)&&"object"===me(e.audio)&&(e=JSON.parse(JSON.stringify(e)),i(e.audio,"autoGainControl","mozAutoGainControl"),i(e.audio,"noiseSuppression","mozNoiseSuppression")),r(e)},a&&a.prototype.getSettings){var o=a.prototype.getSettings;a.prototype.getSettings=function(){var e=o.apply(this,arguments);return i(e,"mozAutoGainControl","autoGainControl"),i(e,"mozNoiseSuppression","noiseSuppression"),e}}if(a&&a.prototype.applyConstraints){var s=a.prototype.applyConstraints;a.prototype.applyConstraints=function(e){return"audio"===this.kind&&"object"===me(e)&&(e=JSON.parse(JSON.stringify(e)),i(e,"autoGainControl","mozAutoGainControl"),i(e,"noiseSuppression","mozNoiseSuppression")),s.apply(this,[e])}}}},pe=function(e,t){if(e&&e.__esModule)return e;if(null===e||"object"!==me(e)&&"function"!=typeof e)return{default:e};var n=fe(t);if(n&&n.has(e))return n.get(e);var a={},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var r in e)if("default"!==r&&Object.prototype.hasOwnProperty.call(e,r)){var o=i?Object.getOwnPropertyDescriptor(e,r):null;o&&(o.get||o.set)?Object.defineProperty(a,r,o):a[r]=e[r]}return a.default=e,n&&n.set(e,a),a}(J);function fe(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(fe=function(e){return e?n:t})(e)}function me(e){return(me="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var ge={};Object.defineProperty(ge,"__esModule",{value:!0}),ge.shimAudioContext=function(e){"object"!==ye(e)||e.AudioContext||(e.AudioContext=e.webkitAudioContext)},ge.shimCallbacksAPI=function(e){if("object"===ye(e)&&e.RTCPeerConnection){var t=e.RTCPeerConnection.prototype,n=t.createOffer,a=t.createAnswer,i=t.setLocalDescription,r=t.setRemoteDescription,o=t.addIceCandidate;t.createOffer=function(e,t){var a=arguments.length>=2?arguments[2]:arguments[0],i=n.apply(this,[a]);return t?(i.then(e,t),Promise.resolve()):i},t.createAnswer=function(e,t){var n=arguments.length>=2?arguments[2]:arguments[0],i=a.apply(this,[n]);return t?(i.then(e,t),Promise.resolve()):i};var s=function(e,t,n){var a=i.apply(this,[e]);return n?(a.then(t,n),Promise.resolve()):a};t.setLocalDescription=s,s=function(e,t,n){var a=r.apply(this,[e]);return n?(a.then(t,n),Promise.resolve()):a},t.setRemoteDescription=s,s=function(e,t,n){var a=o.apply(this,[e]);return n?(a.then(t,n),Promise.resolve()):a},t.addIceCandidate=s}},ge.shimConstraints=we,ge.shimCreateOfferLegacy=function(e){var t=e.RTCPeerConnection.prototype.createOffer;e.RTCPeerConnection.prototype.createOffer=function(e){if(e){typeof e.offerToReceiveAudio<"u"&&(e.offerToReceiveAudio=!!e.offerToReceiveAudio);var n=this.getTransceivers().find((function(e){return"audio"===e.receiver.track.kind}));!1===e.offerToReceiveAudio&&n?"sendrecv"===n.direction?n.setDirection?n.setDirection("sendonly"):n.direction="sendonly":"recvonly"===n.direction&&(n.setDirection?n.setDirection("inactive"):n.direction="inactive"):!0===e.offerToReceiveAudio&&!n&&this.addTransceiver("audio",{direction:"recvonly"}),typeof e.offerToReceiveVideo<"u"&&(e.offerToReceiveVideo=!!e.offerToReceiveVideo);var a=this.getTransceivers().find((function(e){return"video"===e.receiver.track.kind}));!1===e.offerToReceiveVideo&&a?"sendrecv"===a.direction?a.setDirection?a.setDirection("sendonly"):a.direction="sendonly":"recvonly"===a.direction&&(a.setDirection?a.setDirection("inactive"):a.direction="inactive"):!0===e.offerToReceiveVideo&&!a&&this.addTransceiver("video",{direction:"recvonly"})}return t.apply(this,arguments)}};var ve=ge.shimGetUserMedia=function(e){var t=e&&e.navigator;if(t.mediaDevices&&t.mediaDevices.getUserMedia){var n=t.mediaDevices,a=n.getUserMedia.bind(n);t.mediaDevices.getUserMedia=function(e){return a(we(e))}}!t.getUserMedia&&t.mediaDevices&&t.mediaDevices.getUserMedia&&(t.getUserMedia=function(e,n,a){t.mediaDevices.getUserMedia(e).then(n,a)}.bind(t))};ge.shimLocalStreamsAPI=function(e){if("object"===ye(e)&&e.RTCPeerConnection){if("getLocalStreams"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.getLocalStreams=function(){return this._localStreams||(this._localStreams=[]),this._localStreams}),!("addStream"in e.RTCPeerConnection.prototype)){var t=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addStream=function(e){var n=this;this._localStreams||(this._localStreams=[]),this._localStreams.includes(e)||this._localStreams.push(e),e.getAudioTracks().forEach((function(a){return t.call(n,a,e)})),e.getVideoTracks().forEach((function(a){return t.call(n,a,e)}))},e.RTCPeerConnection.prototype.addTrack=function(e){for(var n=this,a=arguments.length,i=new Array(a>1?a-1:0),r=1;r=0)){e._remoteStreams.push(t);var n=new Event("addstream");n.stream=t,e.dispatchEvent(n)}}))}),t.apply(e,arguments)}}},ge.shimTrackEventTransceiver=function(e){"object"===ye(e)&&e.RTCTrackEvent&&"receiver"in e.RTCTrackEvent.prototype&&!("transceiver"in e.RTCTrackEvent.prototype)&&Object.defineProperty(e.RTCTrackEvent.prototype,"transceiver",{get:function(){return{receiver:this.receiver}}})};var be=function(e,t){if(e&&e.__esModule)return e;if(null===e||"object"!==ye(e)&&"function"!=typeof e)return{default:e};var n=_e(t);if(n&&n.has(e))return n.get(e);var a={},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var r in e)if("default"!==r&&Object.prototype.hasOwnProperty.call(e,r)){var o=i?Object.getOwnPropertyDescriptor(e,r):null;o&&(o.get||o.set)?Object.defineProperty(a,r,o):a[r]=e[r]}return a.default=e,n&&n.set(e,a),a}(J);function _e(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(_e=function(e){return e?n:t})(e)}function ye(e){return(ye="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function we(e){return e&&void 0!==e.video?Object.assign({},e,{video:be.compactObject(e.video)}):e}function ke(e,t){if(!1===e)throw new Error(null!=t?t:"assertion failure")}function xe(e){throw new Error("this code should be unreachable")}const Se=(e=>{let t,n=!1;return(...a)=>(n||(t=e(a),n=!0),t)})((()=>{const e=X(window);switch(e.browser){case"chrome":oe(window,e);break;case"firefox":he(window,e);break;case"safari":ve(window,e);break;default:throw new U}}));let Ce=Promise.resolve({type:"stop",data:{}});async function Ee(e,t,n){var a,i,r;if(console.debug("[vue-qrcode-reader] starting camera with constraints: ",JSON.stringify(t)),!0!==window.isSecureContext)throw new H;if(void 0===(null==(a=null==navigator?void 0:navigator.mediaDevices)?void 0:a.getUserMedia))throw new U;Se(),console.debug("[vue-qrcode-reader] calling getUserMedia");const o=await navigator.mediaDevices.getUserMedia({audio:!1,video:t});void 0!==e.srcObject?e.srcObject=o:void 0!==e.mozSrcObject?e.mozSrcObject=o:window.URL.createObjectURL?e.src=window.URL.createObjectURL(o):window.webkitURL?e.src=window.webkitURL.createObjectURL(o):e.src=o.id,e.play(),console.debug("[vue-qrcode-reader] waiting for video element to load"),await Promise.race([B(e,"loadeddata"),F(6e3).then((()=>{throw new W}))]),console.debug("[vue-qrcode-reader] video element loaded"),await F(500);const[s]=o.getVideoTracks(),l=null!=(r=null==(i=null==s?void 0:s.getCapabilities)?void 0:i.call(s))?r:{};let u=!1;return n&&l.torch&&(await s.applyConstraints({advanced:[{torch:!0}]}),u=!0),console.debug("[vue-qrcode-reader] camera ready"),{type:"start",data:{videoEl:e,stream:o,capabilities:l,constraints:t,isTorchOn:u}}}async function Te(e,t,n){console.debug("[vue-qrcode-reader] stopping camera"),e.src="",e.srcObject=null,e.load(),await B(e,"error");for(const e of t.getTracks())null!=n||await e.applyConstraints({advanced:[{torch:!1}]}),t.removeTrack(e),e.stop();return{type:"stop",data:{}}}async function Ae(){if(Ce=Ce.then((e=>{if("stop"===e.type||"failed"===e.type)return e;const{data:{videoEl:t,stream:n,isTorchOn:a}}=e;return Te(t,n,a)})),"start"===(await Ce).type)throw new Error("Something went wrong with the camera task queue (stop task).")}const Me=t.defineComponent({__name:"QrcodeStream",props:{constraints:{type:Object,default:()=>({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(e,{emit:n}){const a=e,i=n,r=t.ref(a.constraints),o=t.ref(a.formats);t.watch((()=>a.constraints),((e,t)=>{JSON.stringify(e)!==JSON.stringify(t)&&(r.value=e)}),{deep:!0}),t.watch((()=>a.formats),((e,t)=>{JSON.stringify(e)!==JSON.stringify(t)&&(o.value=e)}),{deep:!0});const s=t.ref(),l=t.ref(),u=t.ref(),c=t.ref(!1),d=t.ref(!1);t.onMounted((()=>{d.value=!0})),t.onUnmounted((()=>{Ae()}));const h=t.computed((()=>({torch:a.torch,constraints:r.value,shouldStream:d.value&&!a.paused})));t.watch(h,(async e=>{const t=u.value;ke(void 0!==t,"cameraSettings watcher should never be triggered when component is not mounted. Thus video element should always be defined.");const n=s.value;ke(void 0!==n,"cameraSettings watcher should never be triggered when component is not mounted. Thus canvas should always be defined.");const a=n.getContext("2d");if(ke(null!==a,"if cavnas is defined, canvas 2d context should also be non-null"),e.shouldStream){Ae(),c.value=!1;try{const n=await async function(e,{constraints:t,torch:n,restart:a=!1}){Ce=Ce.then((i=>{if("start"===i.type){const{data:{videoEl:r,stream:o,constraints:s,isTorchOn:l}}=i;return a||e!==r||t!==s||n!==l?Te(r,o,l).then((()=>Ee(e,t,n))):i}if("stop"===i.type||"failed"===i.type)return Ee(e,t,n);xe()})).catch((e=>(console.debug(`[vue-qrcode-reader] starting camera failed with "${e}"`),{type:"failed",error:e})));const i=await Ce;if("stop"===i.type)throw new Error("Something went wrong with the camera task queue (start task).");if("failed"===i.type)throw i.error;if("start"===i.type)return i.data.capabilities;xe()}(t,e);d.value?(c.value=!0,i("camera-on",n)):await Ae()}catch(e){i("error",e)}}else n.width=t.videoWidth,n.height=t.videoHeight,a.drawImage(t,0,0,t.videoWidth,t.videoHeight),Ae(),c.value=!1,i("camera-off")}),{deep:!0}),t.watch(o,(async e=>{d.value&&await Q(e)}));const p=t.computed((()=>h.value.shouldStream&&c.value));t.watch(p,(e=>{if(e){ke(void 0!==s.value,"shouldScan watcher should only be triggered when component is mounted. Thus pause frame canvas is defined"),f(s.value),ke(void 0!==l.value,"shouldScan watcher should only be triggered when component is mounted. Thus tracking canvas is defined"),f(l.value);const e=()=>void 0===a.track?500:40;ke(void 0!==u.value,"shouldScan watcher should only be triggered when component is mounted. Thus video element is defined"),(async(e,{detectHandler:t,locateHandler:n,minDelay:a,formats:i})=>{console.debug("[vue-qrcode-reader] start scanning"),await Q(i);const r=i=>async o=>{if(0===e.readyState)console.debug("[vue-qrcode-reader] stop scanning: video element readyState is 0");else{const{lastScanned:s,contentBefore:l,lastScanHadContent:u}=i;if(o-s!l.includes(e.rawValue)));i&&t(a);const s=a.length>0;s&&n(a),!s&&u&&n(a);const c={lastScanned:o,lastScanHadContent:s,contentBefore:i?a.map((e=>e.rawValue)):l};window.requestAnimationFrame(r(c))}}};r({lastScanned:performance.now(),contentBefore:[],lastScanHadContent:!1})(performance.now())})(u.value,{detectHandler:e=>i("detect",e),formats:o.value,locateHandler:m,minDelay:e()})}}));const f=e=>{const t=e.getContext("2d");ke(null!==t,"canvas 2d context should always be non-null"),t.clearRect(0,0,e.width,e.height)},m=e=>{const t=l.value;ke(void 0!==t,"onLocate handler should only be called when component is mounted. Thus tracking canvas is always defined.");const n=u.value;if(ke(void 0!==n,"onLocate handler should only be called when component is mounted. Thus video element is always defined."),0===e.length||void 0===a.track)f(t);else{const i=n.offsetWidth,r=n.offsetHeight,o=n.videoWidth,s=n.videoHeight,l=Math.max(i/o,r/s),u=o*l,c=s*l,d=u/o,h=c/s,p=(i-u)/2,f=(r-c)/2,m=({x:e,y:t})=>({x:Math.floor(e*d),y:Math.floor(t*h)}),g=({x:e,y:t})=>({x:Math.floor(e+p),y:Math.floor(t+f)}),v=e.map((e=>{const{boundingBox:t,cornerPoints:n}=e,{x:a,y:i}=g(m({x:t.x,y:t.y})),{x:r,y:o}=m({x:t.width,y:t.height});return{...e,cornerPoints:n.map((e=>g(m(e)))),boundingBox:DOMRectReadOnly.fromRect({x:a,y:i,width:r,height:o})}}));t.width=n.offsetWidth,t.height=n.offsetHeight;const b=t.getContext("2d");a.track(v,b)}},g={width:"100%",height:"100%",position:"relative","z-index":"0"},v={width:"100%",height:"100%",position:"absolute",top:"0",left:"0"},b={width:"100%",height:"100%","object-fit":"cover"},_=t.computed((()=>p.value?b:{...b,visibility:"hidden",position:"absolute"}));return(e,n)=>(t.openBlock(),t.createElementBlock("div",{style:g},[t.createElementVNode("video",{ref_key:"videoRef",ref:u,style:t.normalizeStyle(_.value),autoplay:"",muted:"",playsinline:""},null,4),t.withDirectives(t.createElementVNode("canvas",{id:"qrcode-stream-pause-frame",ref_key:"pauseFrameRef",ref:s,style:b},null,512),[[t.vShow,!p.value]]),t.createElementVNode("canvas",{id:"qrcode-stream-tracking-layer",ref_key:"trackingLayerRef",ref:l,style:v},null,512),t.createElementVNode("div",{style:v},[t.renderSlot(e.$slots,"default")])]))}}),Pe=t.defineComponent({__name:"QrcodeCapture",props:{formats:{type:Array,default:()=>["qr_code"]}},emits:["detect"],setup(e,{emit:n}){const a=e,i=n,r=e=>{if(e.target instanceof HTMLInputElement&&e.target.files)for(const t of Array.from(e.target.files))K(t,a.formats).then((e=>{i("detect",e)}))};return(e,n)=>(t.openBlock(),t.createElementBlock("input",{onChange:r,type:"file",name:"image",accept:"image/*",capture:"environment",multiple:""},null,32))}}),Le=t.defineComponent({__name:"QrcodeDropZone",props:{formats:{type:Array,default:()=>["qr_code"]}},emits:["detect","dragover","error"],setup(e,{emit:n}){const a=e,i=n,r=async e=>{try{const t=await e;i("detect",t)}catch(e){i("error",e)}},o=e=>{i("dragover",e)},s=({dataTransfer:e})=>{if(!e)return;o(!1);const t=[...Array.from(e.files)],n=e.getData("text/uri-list");t.forEach((e=>{r(K(e,a.formats))})),""!==n&&r(G(n,a.formats))};return(e,n)=>(t.openBlock(),t.createElementBlock("div",{onDrop:t.withModifiers(s,["prevent","stop"]),onDragenter:n[0]||(n[0]=t.withModifiers((e=>o(!0)),["prevent","stop"])),onDragleave:n[1]||(n[1]=t.withModifiers((e=>o(!1)),["prevent","stop"])),onDragover:n[2]||(n[2]=t.withModifiers((()=>{}),["prevent","stop"]))},[t.renderSlot(e.$slots,"default")],32))}});function Oe(e){e.component("qrcode-stream",Me),e.component("qrcode-capture",Pe),e.component("qrcode-drop-zone",Le)}const Ne={install:Oe};e.QrcodeCapture=Pe,e.QrcodeDropZone=Le,e.QrcodeStream=Me,e.VueQrcodeReader=Ne,e.install=Oe,e.setZXingModuleOverrides=function(e){return function(e,t){N.set(e,{moduleOverrides:t})}(q,e)},Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})})), /*! * qrcode.vue v3.4.1 * A Vue.js component to generate QRCode. diff --git a/lnbits/static/js/wallet.js b/lnbits/static/js/wallet.js index 5f794c21c..f235d0d5f 100644 --- a/lnbits/static/js/wallet.js +++ b/lnbits/static/js/wallet.js @@ -257,7 +257,7 @@ window.app = Vue.createApp({ }) }, decodeQR: function (res) { - this.parse.data.request = res + this.parse.data.request = res[0].rawValue this.decodeRequest() this.parse.camera.show = false }, diff --git a/lnbits/static/vendor/vue-qrcode-reader.umd.js b/lnbits/static/vendor/vue-qrcode-reader.umd.js index 033634978..17e8ed565 100644 --- a/lnbits/static/vendor/vue-qrcode-reader.umd.js +++ b/lnbits/static/vendor/vue-qrcode-reader.umd.js @@ -1,3 +1,3 @@ (function(ee,O){typeof exports=="object"&&typeof module<"u"?O(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],O):(ee=typeof globalThis<"u"?globalThis:ee||self,O(ee.VueQrcodeReader={},ee.Vue))})(this,function(ee,O){"use strict";var Wt=(r,o,i)=>{if(!o.has(r))throw TypeError("Cannot "+i)},jt=(r,o,i)=>(Wt(r,o,"read from private field"),i?i.call(r):o.get(r)),tn=(r,o,i)=>{if(o.has(r))throw TypeError("Cannot add the same private member more than once");o instanceof WeakSet?o.add(r):o.set(r,i)},rn=(r,o,i,c)=>(Wt(r,o,"write to private field"),o.set(r,i),i);const Lt=[["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"]],nn=[...Lt,["unknown"]].map(r=>r[0]),Le=new Map(Lt);function an(r){for(const[o,i]of Le)if(r===i)return o;return"unknown"}function on(r){if(Ht(r))return{width:r.naturalWidth,height:r.naturalHeight};if(Bt(r))return{width:r.width.baseVal.value,height:r.height.baseVal.value};if(Vt(r))return{width:r.videoWidth,height:r.videoHeight};if(Nt(r))return{width:r.width,height:r.height};if(Gt(r))return{width:r.displayWidth,height:r.displayHeight};if(qt(r))return{width:r.width,height:r.height};if(zt(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 Ht(r){try{return r instanceof HTMLImageElement}catch(o){return!1}}function Bt(r){try{return r instanceof SVGImageElement}catch(o){return!1}}function Vt(r){try{return r instanceof HTMLVideoElement}catch(o){return!1}}function qt(r){try{return r instanceof HTMLCanvasElement}catch(o){return!1}}function Nt(r){try{return r instanceof ImageBitmap}catch(o){return!1}}function zt(r){try{return r instanceof OffscreenCanvas}catch(o){return!1}}function Gt(r){try{return r instanceof VideoFrame}catch(o){return!1}}function Yt(r){try{return r instanceof Blob}catch(o){return!1}}function sn(r){try{return r instanceof ImageData}catch(o){return!1}}function cn(r,o){try{const i=new OffscreenCanvas(r,o);if(i.getContext("2d")instanceof OffscreenCanvasRenderingContext2D)return i;throw void 0}catch(i){const c=document.createElement("canvas");return c.width=r,c.height=o,c}}async function Jt(r){if(Ht(r)&&!await fn(r))throw new DOMException("Failed to load or decode HTMLImageElement.","InvalidStateError");if(Bt(r)&&!await hn(r))throw new DOMException("Failed to load or decode SVGImageElement.","InvalidStateError");if(Gt(r)&&pn(r))throw new DOMException("VideoFrame is closed.","InvalidStateError");if(Vt(r)&&(r.readyState===0||r.readyState===1))throw new DOMException("Invalid element or state.","InvalidStateError");if(Nt(r)&&vn(r))throw new DOMException("The image source is detached.","InvalidStateError");const{width:o,height:i}=on(r);if(o===0||i===0)return null;const c=cn(o,i).getContext("2d");c.drawImage(r,0,0);try{return c.getImageData(0,0,o,i)}catch(l){throw new DOMException("Source would taint origin.","SecurityError")}}async function un(r){let o;try{if(globalThis.createImageBitmap)o=await createImageBitmap(r);else if(globalThis.Image){o=new Image;let i="";try{i=URL.createObjectURL(r),o.src=i,await o.decode()}finally{URL.revokeObjectURL(i)}}else return r}catch(i){throw new DOMException("Failed to load or decode Blob.","InvalidStateError")}return await Jt(o)}function ln(r){const{width:o,height:i}=r;if(o===0||i===0)return null;const c=r.getContext("2d");try{return c.getImageData(0,0,o,i)}catch(l){throw new DOMException("Source would taint origin.","SecurityError")}}async function dn(r){if(Yt(r))return await un(r);if(sn(r)){if(mn(r))throw new DOMException("The image data has been detached.","InvalidStateError");return r}return qt(r)||zt(r)?ln(r):await Jt(r)}async function fn(r){try{return await r.decode(),!0}catch(o){return!1}}async function hn(r){var o;try{return await((o=r.decode)==null?void 0:o.call(r)),!0}catch(i){return!1}}function pn(r){return r.format===null}function mn(r){return r.data.buffer.byteLength===0}function vn(r){return r.width===0&&r.height===0}function Qt(r,o){return r instanceof DOMException?new DOMException(`${o}: ${r.message}`,r.name):r instanceof Error?new r.constructor(`${o}: ${r.message}`):new Error(`${o}: ${r}`)}const Xt=["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 yn(r){return r.join("|")}function gn(r){const o=Zt(r);let i=0,c=Xt.length-1;for(;i<=c;){const l=Math.floor((i+c)/2),h=Xt[l],v=Zt(h);if(v===o)return h;v{const i=r.match(/_(.+?)\.wasm$/);return i?`https://fastly.jsdelivr.net/npm/zxing-wasm@1.1.3/dist/${i[1]}/${r}`:o+r}};let ut=new WeakMap;function lt(r,o){var i;const c=ut.get(r);if(c!=null&&c.modulePromise&&o===void 0)return c.modulePromise;const l=(i=c==null?void 0:c.moduleOverrides)!=null?i:Pn,h=r({...l});return ut.set(r,{moduleOverrides:l,modulePromise:h}),h}function Tn(r,o){ut.set(r,{moduleOverrides:o})}async function En(r,o,i=Ce){const c={...Ce,...i},l=await lt(r),{size:h}=o,v=new Uint8Array(await o.arrayBuffer()),g=l._malloc(h);l.HEAPU8.set(v,g);const b=l.readBarcodesFromImage(g,h,Kt(l,c));l._free(g);const p=[];for(let C=0;C{var r=typeof document<"u"&&document.currentScript?document.currentScript.src:void 0;return function(o={}){var i=o,c,l;i.ready=new Promise((e,t)=>{c=e,l=t});var h=Object.assign({},i),v="./this.program",g=typeof window=="object",b=typeof importScripts=="function";typeof process=="object"&&typeof process.versions=="object"&&process.versions.node;var p="";function C(e){return i.locateFile?i.locateFile(e,p):p+e}var S;(g||b)&&(b?p=self.location.href:typeof document<"u"&&document.currentScript&&(p=document.currentScript.src),r&&(p=r),p.indexOf("blob:")!==0?p=p.substr(0,p.replace(/[?#].*/,"").lastIndexOf("/")+1):p="",b&&(S=e=>{var t=new XMLHttpRequest;return t.open("GET",e,!1),t.responseType="arraybuffer",t.send(null),new Uint8Array(t.response)})),i.print||console.log.bind(console);var $=i.printErr||console.error.bind(console);Object.assign(i,h),h=null,i.arguments&&i.arguments,i.thisProgram&&(v=i.thisProgram),i.quit&&i.quit;var U;i.wasmBinary&&(U=i.wasmBinary),typeof WebAssembly!="object"&&K("no native wasm support detected");var W,j=!1,k,R,Z,I,D,A,me,ce;function Se(){var e=W.buffer;i.HEAP8=k=new Int8Array(e),i.HEAP16=Z=new Int16Array(e),i.HEAPU8=R=new Uint8Array(e),i.HEAPU16=I=new Uint16Array(e),i.HEAP32=D=new Int32Array(e),i.HEAPU32=A=new Uint32Array(e),i.HEAPF32=me=new Float32Array(e),i.HEAPF64=ce=new Float64Array(e)}var Pe=[],De=[],Ae=[];function ze(){if(i.preRun)for(typeof i.preRun=="function"&&(i.preRun=[i.preRun]);i.preRun.length;)pt(i.preRun.shift());wt(Pe)}function ft(){wt(De)}function ht(){if(i.postRun)for(typeof i.postRun=="function"&&(i.postRun=[i.postRun]);i.postRun.length;)Re(i.postRun.shift());wt(Ae)}function pt(e){Pe.unshift(e)}function mt(e){De.unshift(e)}function Re(e){Ae.unshift(e)}var ae=0,ge=null;function vt(e){var t;ae++,(t=i.monitorRunDependencies)===null||t===void 0||t.call(i,ae)}function ve(e){var t;if(ae--,(t=i.monitorRunDependencies)===null||t===void 0||t.call(i,ae),ae==0&&ge){var n=ge;ge=null,n()}}function K(e){var t;(t=i.onAbort)===null||t===void 0||t.call(i,e),e="Aborted("+e+")",$(e),j=!0,e+=". Build with -sASSERTIONS for more info.";var n=new WebAssembly.RuntimeError(e);throw l(n),n}var yt="data:application/octet-stream;base64,",Ge=e=>e.startsWith(yt),ye;ye="zxing_reader.wasm",Ge(ye)||(ye=C(ye));function Ye(e){if(e==ye&&U)return new Uint8Array(U);if(S)return S(e);throw"both async and sync fetching of the wasm failed"}function gt(e){return!U&&(g||b)&&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(()=>Ye(e)):Promise.resolve().then(()=>Ye(e))}function Je(e,t,n){return gt(e).then(a=>WebAssembly.instantiate(a,t)).then(a=>a).then(n,a=>{$(`failed to asynchronously prepare wasm: ${a}`),K(a)})}function wa(e,t,n,a){return!e&&typeof WebAssembly.instantiateStreaming=="function"&&!Ge(t)&&typeof fetch=="function"?fetch(t,{credentials:"same-origin"}).then(s=>{var u=WebAssembly.instantiateStreaming(s,n);return u.then(a,function(d){return $(`wasm streaming compile failed: ${d}`),$("falling back to ArrayBuffer instantiation"),Je(t,n,a)})}):Je(t,n,a)}function ba(){var e={a:ci};function t(a,s){return G=a.exports,W=G.ia,Se(),kr=G.ma,mt(G.ja),ve(),G}vt();function n(a){t(a.instance)}if(i.instantiateWasm)try{return i.instantiateWasm(e,t)}catch(a){$(`Module.instantiateWasm callback failed with error: ${a}`),l(a)}return wa(U,ye,e,n).catch(l),{}}var wt=e=>{for(;e.length>0;)e.shift()(i)};i.noExitRuntime;var Qe=[],Xe=0,Ca=e=>{var t=new bt(e);return t.get_caught()||(t.set_caught(!0),Xe--),t.set_rethrown(!1),Qe.push(t),Yr(t.excPtr),t.get_exception_ptr()},ue=0,$a=()=>{L(0,0);var e=Qe.pop();Gr(e.excPtr),ue=0};function bt(e){this.excPtr=e,this.ptr=e-24,this.set_type=function(t){A[this.ptr+4>>2]=t},this.get_type=function(){return A[this.ptr+4>>2]},this.set_destructor=function(t){A[this.ptr+8>>2]=t},this.get_destructor=function(){return A[this.ptr+8>>2]},this.set_caught=function(t){t=t?1:0,k[this.ptr+12>>0]=t},this.get_caught=function(){return k[this.ptr+12>>0]!=0},this.set_rethrown=function(t){t=t?1:0,k[this.ptr+13>>0]=t},this.get_rethrown=function(){return k[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){A[this.ptr+16>>2]=t},this.get_adjusted_ptr=function(){return A[this.ptr+16>>2]},this.get_exception_ptr=function(){var t=Qr(this.get_type());if(t)return A[this.excPtr>>2];var n=this.get_adjusted_ptr();return n!==0?n:this.excPtr}}var _a=e=>{throw ue||(ue=e),ue},Ct=e=>{var t=ue;if(!t)return je(0),0;var n=new bt(t);n.set_adjusted_ptr(t);var a=n.get_type();if(!a)return je(0),t;for(var s in e){var u=e[s];if(u===0||u===a)break;var d=n.ptr+16;if(Jr(u,a,d))return je(u),t}return je(a),t},Sa=()=>Ct([]),Pa=e=>Ct([e]),Ta=(e,t)=>Ct([e,t]),Ea=()=>{var e=Qe.pop();e||K("no exception to throw");var t=e.excPtr;throw e.get_rethrown()||(Qe.push(e),e.set_rethrown(!0),e.set_caught(!1),Xe++),ue=t,ue},Oa=(e,t,n)=>{var a=new bt(e);throw a.init(t,n),ue=e,Xe++,ue},Ma=()=>Xe,Ze={},$t=e=>{for(;e.length;){var t=e.pop(),n=e.pop();n(t)}};function _t(e){return this.fromWireType(D[e>>2])}var Te={},we={},Ke={},Pr,et=e=>{throw new Pr(e)},be=(e,t,n)=>{e.forEach(function(f){Ke[f]=t});function a(f){var m=n(f);m.length!==e.length&&et("Mismatched type converter count");for(var w=0;w{we.hasOwnProperty(f)?s[m]=we[f]:(u.push(f),Te.hasOwnProperty(f)||(Te[f]=[]),Te[f].push(()=>{s[m]=we[f],++d,d===u.length&&a(s)}))}),u.length===0&&a(s)},Da=e=>{var t=Ze[e];delete Ze[e];var n=t.rawConstructor,a=t.rawDestructor,s=t.fields,u=s.map(d=>d.getterReturnType).concat(s.map(d=>d.setterArgumentType));be([e],u,d=>{var f={};return s.forEach((m,w)=>{var _=m.fieldName,T=d[w],E=m.getter,M=m.getterContext,H=d[w+s.length],N=m.setter,F=m.setterContext;f[_]={read:Q=>T.fromWireType(E(M,Q)),write:(Q,y)=>{var P=[];N(F,Q,H.toWireType(P,y)),$t(P)}}}),[{name:t.name,fromWireType:m=>{var w={};for(var _ in f)w[_]=f[_].read(m);return a(m),w},toWireType:(m,w)=>{for(var _ in f)if(!(_ in w))throw new TypeError(`Missing field: "${_}"`);var T=n();for(_ in f)f[_].write(T,w[_]);return m!==null&&m.push(a,T),T},argPackAdvance:ie,readValueFromPointer:_t,destructorFunction:a}]})},Aa=(e,t,n,a,s)=>{},Ra=()=>{for(var e=new Array(256),t=0;t<256;++t)e[t]=String.fromCharCode(t);Tr=e},Tr,J=e=>{for(var t="",n=e;R[n];)t+=Tr[R[n++]];return t},Ee,x=e=>{throw new Ee(e)};function xa(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};var a=t.name;if(e||x(`type "${a}" must have a positive integer typeid pointer`),we.hasOwnProperty(e)){if(n.ignoreDuplicateRegistrations)return;x(`Cannot register type '${a}' twice`)}if(we[e]=t,delete Ke[e],Te.hasOwnProperty(e)){var s=Te[e];delete Te[e],s.forEach(u=>u())}}function oe(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 xa(e,t,n)}var ie=8,ka=(e,t,n,a)=>{t=J(t),oe(e,{name:t,fromWireType:function(s){return!!s},toWireType:function(s,u){return u?n:a},argPackAdvance:ie,readValueFromPointer:function(s){return this.fromWireType(R[s])},destructorFunction:null})},Ia=e=>({count:e.count,deleteScheduled:e.deleteScheduled,preservePointerOnDelete:e.preservePointerOnDelete,ptr:e.ptr,ptrType:e.ptrType,smartPtr:e.smartPtr,smartPtrType:e.smartPtrType}),St=e=>{function t(n){return n.$$.ptrType.registeredClass.name}x(t(e)+" instance already deleted")},Pt=!1,Er=e=>{},Fa=e=>{e.smartPtr?e.smartPtrType.rawDestructor(e.smartPtr):e.ptrType.registeredClass.rawDestructor(e.ptr)},Or=e=>{e.count.value-=1;var t=e.count.value===0;t&&Fa(e)},Mr=(e,t,n)=>{if(t===n)return e;if(n.baseClass===void 0)return null;var a=Mr(e,t,n.baseClass);return a===null?null:n.downcast(a)},Dr={},Ua=()=>Object.keys(Ie).length,Wa=()=>{var e=[];for(var t in Ie)Ie.hasOwnProperty(t)&&e.push(Ie[t]);return e},xe=[],Tt=()=>{for(;xe.length;){var e=xe.pop();e.$$.deleteScheduled=!1,e.delete()}},ke,ja=e=>{ke=e,xe.length&&ke&&ke(Tt)},La=()=>{i.getInheritedInstanceCount=Ua,i.getLiveInheritedInstances=Wa,i.flushPendingDeletes=Tt,i.setDelayFunction=ja},Ie={},Ha=(e,t)=>{for(t===void 0&&x("ptr should not be undefined");e.baseClass;)t=e.upcast(t),e=e.baseClass;return t},Ba=(e,t)=>(t=Ha(e,t),Ie[t]),tt=(e,t)=>{(!t.ptrType||!t.ptr)&&et("makeClassHandle requires ptr and ptrType");var n=!!t.smartPtrType,a=!!t.smartPtr;return n!==a&&et("Both smartPtrType and smartPtr must be specified"),t.count={value:1},Fe(Object.create(e,{$$:{value:t,writable:!0}}))};function Va(e){var t=this.getPointee(e);if(!t)return this.destructor(e),null;var n=Ba(this.registeredClass,t);if(n!==void 0){if(n.$$.count.value===0)return n.$$.ptr=t,n.$$.smartPtr=e,n.clone();var a=n.clone();return this.destructor(e),a}function s(){return this.isSmartPointer?tt(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:t,smartPtrType:this,smartPtr:e}):tt(this.registeredClass.instancePrototype,{ptrType:this,ptr:e})}var u=this.registeredClass.getActualType(t),d=Dr[u];if(!d)return s.call(this);var f;this.isConst?f=d.constPointerType:f=d.pointerType;var m=Mr(t,this.registeredClass,f.registeredClass);return m===null?s.call(this):this.isSmartPointer?tt(f.registeredClass.instancePrototype,{ptrType:f,ptr:m,smartPtrType:this,smartPtr:e}):tt(f.registeredClass.instancePrototype,{ptrType:f,ptr:m})}var Fe=e=>typeof FinalizationRegistry>"u"?(Fe=t=>t,e):(Pt=new FinalizationRegistry(t=>{Or(t.$$)}),Fe=t=>{var n=t.$$,a=!!n.smartPtr;if(a){var s={$$:n};Pt.register(t,s,t)}return t},Er=t=>Pt.unregister(t),Fe(e)),qa=()=>{Object.assign(rt.prototype,{isAliasOf(e){if(!(this instanceof rt)||!(e instanceof rt))return!1;var t=this.$$.ptrType.registeredClass,n=this.$$.ptr;e.$$=e.$$;for(var a=e.$$.ptrType.registeredClass,s=e.$$.ptr;t.baseClass;)n=t.upcast(n),t=t.baseClass;for(;a.baseClass;)s=a.upcast(s),a=a.baseClass;return t===a&&n===s},clone(){if(this.$$.ptr||St(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var e=Fe(Object.create(Object.getPrototypeOf(this),{$$:{value:Ia(this.$$)}}));return e.$$.count.value+=1,e.$$.deleteScheduled=!1,e},delete(){this.$$.ptr||St(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&x("Object already scheduled for deletion"),Er(this),Or(this.$$),this.$$.preservePointerOnDelete||(this.$$.smartPtr=void 0,this.$$.ptr=void 0)},isDeleted(){return!this.$$.ptr},deleteLater(){return this.$$.ptr||St(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&x("Object already scheduled for deletion"),xe.push(this),xe.length===1&&ke&&ke(Tt),this.$$.deleteScheduled=!0,this}})};function rt(){}var Ue=(e,t)=>Object.defineProperty(t,"name",{value:e}),Ar=(e,t,n)=>{if(e[t].overloadTable===void 0){var a=e[t];e[t]=function(){return e[t].overloadTable.hasOwnProperty(arguments.length)||x(`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[a.argCount]=a}},Et=(e,t,n)=>{i.hasOwnProperty(e)?((n===void 0||i[e].overloadTable!==void 0&&i[e].overloadTable[n]!==void 0)&&x(`Cannot register public name '${e}' twice`),Ar(i,e,e),i.hasOwnProperty(n)&&x(`Cannot register multiple overloads of a function with the same number of arguments (${n})!`),i[e].overloadTable[n]=t):(i[e]=t,n!==void 0&&(i[e].numArguments=n))},Na=48,za=57,Ga=e=>{if(e===void 0)return"_unknown";e=e.replace(/[^a-zA-Z0-9_]/g,"$");var t=e.charCodeAt(0);return t>=Na&&t<=za?`_${e}`:e};function Ya(e,t,n,a,s,u,d,f){this.name=e,this.constructor=t,this.instancePrototype=n,this.rawDestructor=a,this.baseClass=s,this.getActualType=u,this.upcast=d,this.downcast=f,this.pureVirtualFunctions=[]}var Ot=(e,t,n)=>{for(;t!==n;)t.upcast||x(`Expected null or instance of ${n.name}, got an instance of ${t.name}`),e=t.upcast(e),t=t.baseClass;return e};function Ja(e,t){if(t===null)return this.isReference&&x(`null is not a valid ${this.name}`),0;t.$$||x(`Cannot pass "${xt(t)}" as a ${this.name}`),t.$$.ptr||x(`Cannot pass deleted object as a pointer of type ${this.name}`);var n=t.$$.ptrType.registeredClass,a=Ot(t.$$.ptr,n,this.registeredClass);return a}function Qa(e,t){var n;if(t===null)return this.isReference&&x(`null is not a valid ${this.name}`),this.isSmartPointer?(n=this.rawConstructor(),e!==null&&e.push(this.rawDestructor,n),n):0;(!t||!t.$$)&&x(`Cannot pass "${xt(t)}" as a ${this.name}`),t.$$.ptr||x(`Cannot pass deleted object as a pointer of type ${this.name}`),!this.isConst&&t.$$.ptrType.isConst&&x(`Cannot convert argument of type ${t.$$.smartPtrType?t.$$.smartPtrType.name:t.$$.ptrType.name} to parameter type ${this.name}`);var a=t.$$.ptrType.registeredClass;if(n=Ot(t.$$.ptr,a,this.registeredClass),this.isSmartPointer)switch(t.$$.smartPtr===void 0&&x("Passing raw pointer to smart pointer is illegal"),this.sharingPolicy){case 0:t.$$.smartPtrType===this?n=t.$$.smartPtr:x(`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,le.toHandle(()=>s.delete())),e!==null&&e.push(this.rawDestructor,n)}break;default:x("Unsupporting sharing policy")}return n}function Xa(e,t){if(t===null)return this.isReference&&x(`null is not a valid ${this.name}`),0;t.$$||x(`Cannot pass "${xt(t)}" as a ${this.name}`),t.$$.ptr||x(`Cannot pass deleted object as a pointer of type ${this.name}`),t.$$.ptrType.isConst&&x(`Cannot convert argument of type ${t.$$.ptrType.name} to parameter type ${this.name}`);var n=t.$$.ptrType.registeredClass,a=Ot(t.$$.ptr,n,this.registeredClass);return a}function Rr(e){return this.fromWireType(A[e>>2])}var Za=()=>{Object.assign(nt.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:ie,readValueFromPointer:Rr,deleteObject(e){e!==null&&e.delete()},fromWireType:Va})};function nt(e,t,n,a,s,u,d,f,m,w,_){this.name=e,this.registeredClass=t,this.isReference=n,this.isConst=a,this.isSmartPointer=s,this.pointeeType=u,this.sharingPolicy=d,this.rawGetPointee=f,this.rawConstructor=m,this.rawShare=w,this.rawDestructor=_,!s&&t.baseClass===void 0?a?(this.toWireType=Ja,this.destructorFunction=null):(this.toWireType=Xa,this.destructorFunction=null):this.toWireType=Qa}var xr=(e,t,n)=>{i.hasOwnProperty(e)||et("Replacing nonexistant public symbol"),i[e].overloadTable!==void 0&&n!==void 0?i[e].overloadTable[n]=t:(i[e]=t,i[e].argCount=n)},Ka=(e,t,n)=>{var a=i["dynCall_"+e];return n&&n.length?a.apply(null,[t].concat(n)):a.call(null,t)},at=[],kr,B=e=>{var t=at[e];return t||(e>=at.length&&(at.length=e+1),at[e]=t=kr.get(e)),t},eo=(e,t,n)=>{if(e.includes("j"))return Ka(e,t,n);var a=B(t).apply(null,n);return a},to=(e,t)=>{var n=[];return function(){return n.length=0,Object.assign(n,arguments),eo(e,t,n)}},re=(e,t)=>{e=J(e);function n(){return e.includes("j")?to(e,t):B(t)}var a=n();return typeof a!="function"&&x(`unknown function pointer with signature ${e}: ${t}`),a},ro=(e,t)=>{var n=Ue(t,function(a){this.name=t,this.message=a;var s=new Error(a).stack;s!==void 0&&(this.stack=this.toString()+` `+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},Ir,Fr=e=>{var t=zr(e),n=J(t);return de(t),n},ot=(e,t)=>{var n=[],a={};function s(u){if(!a[u]&&!we[u]){if(Ke[u]){Ke[u].forEach(s);return}n.push(u),a[u]=!0}}throw t.forEach(s),new Ir(`${e}: `+n.map(Fr).join([", "]))},no=(e,t,n,a,s,u,d,f,m,w,_,T,E)=>{_=J(_),u=re(s,u),f&&(f=re(d,f)),w&&(w=re(m,w)),E=re(T,E);var M=Ga(_);Et(M,function(){ot(`Cannot construct ${_} due to unbound types`,[a])}),be([e,t,n],a?[a]:[],function(H){H=H[0];var N,F;a?(N=H.registeredClass,F=N.instancePrototype):F=rt.prototype;var Q=Ue(_,function(){if(Object.getPrototypeOf(this)!==y)throw new Ee("Use 'new' to construct "+_);if(P.constructor_body===void 0)throw new Ee(_+" has no accessible constructor");var en=P.constructor_body[arguments.length];if(en===void 0)throw new Ee(`Tried to invoke ctor of ${_} with invalid number of parameters (${arguments.length}) - expected (${Object.keys(P.constructor_body).toString()}) parameters instead!`);return en.apply(this,arguments)}),y=Object.create(F,{constructor:{value:Q}});Q.prototype=y;var P=new Ya(_,Q,y,E,N,u,f,w);if(P.baseClass){var z,Y;(Y=(z=P.baseClass).__derivedClasses)!==null&&Y!==void 0||(z.__derivedClasses=[]),P.baseClass.__derivedClasses.push(P)}var Oe=new nt(_,P,!0,!1,!1),ct=new nt(_+"*",P,!1,!1,!1),Kr=new nt(_+" const*",P,!1,!0,!1);return Dr[e]={pointerType:ct,constPointerType:Kr},xr(M,Q),[Oe,ct,Kr]})},Mt=(e,t)=>{for(var n=[],a=0;a>2]);return n};function ao(e){for(var t=1;t{var d=Mt(t,n);s=re(a,s),be([],[e],function(f){f=f[0];var m=`constructor ${f.name}`;if(f.registeredClass.constructor_body===void 0&&(f.registeredClass.constructor_body=[]),f.registeredClass.constructor_body[t-1]!==void 0)throw new Ee(`Cannot register multiple constructors with identical number of parameters (${t-1}) for class '${f.name}'! Overload resolution is currently only performed using the parameter count, not actual type info!`);return f.registeredClass.constructor_body[t-1]=()=>{ot(`Cannot construct ${f.name} due to unbound types`,d)},be([],d,w=>(w.splice(1,0,null),f.registeredClass.constructor_body[t-1]=Dt(m,w,null,s,u),[])),[]})},Ur=e=>{e=e.trim();const t=e.indexOf("(");return t!==-1?e.substr(0,t):e},io=(e,t,n,a,s,u,d,f,m)=>{var w=Mt(n,a);t=J(t),t=Ur(t),u=re(s,u),be([],[e],function(_){_=_[0];var T=`${_.name}.${t}`;t.startsWith("@@")&&(t=Symbol[t.substring(2)]),f&&_.registeredClass.pureVirtualFunctions.push(t);function E(){ot(`Cannot call ${T} due to unbound types`,w)}var M=_.registeredClass.instancePrototype,H=M[t];return H===void 0||H.overloadTable===void 0&&H.className!==_.name&&H.argCount===n-2?(E.argCount=n-2,E.className=_.name,M[t]=E):(Ar(M,t,T),M[t].overloadTable[n-2]=E),be([],w,function(N){var F=Dt(T,N,_,u,d);return M[t].overloadTable===void 0?(F.argCount=n-2,M[t]=F):M[t].overloadTable[n-2]=F,[]}),[]})};function so(){Object.assign(Wr.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 Wr(){this.allocated=[void 0],this.freelist=[]}var te=new Wr,At=e=>{e>=te.reserved&&--te.get(e).refcount===0&&te.free(e)},co=()=>{for(var e=0,t=te.reserved;t{te.allocated.push({value:void 0},{value:null},{value:!0},{value:!1}),te.reserved=te.allocated.length,i.count_emval_handles=co},le={toValue:e=>(e||x("Cannot use deleted val. handle = "+e),te.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 te.allocate({refcount:1,value:e})}}},lo=(e,t)=>{t=J(t),oe(e,{name:t,fromWireType:n=>{var a=le.toValue(n);return At(n),a},toWireType:(n,a)=>le.toHandle(a),argPackAdvance:ie,readValueFromPointer:_t,destructorFunction:null})},fo=(e,t,n)=>{switch(t){case 1:return n?function(a){return this.fromWireType(k[a>>0])}:function(a){return this.fromWireType(R[a>>0])};case 2:return n?function(a){return this.fromWireType(Z[a>>1])}:function(a){return this.fromWireType(I[a>>1])};case 4:return n?function(a){return this.fromWireType(D[a>>2])}:function(a){return this.fromWireType(A[a>>2])};default:throw new TypeError(`invalid integer width (${t}): ${e}`)}},ho=(e,t,n,a)=>{t=J(t);function s(){}s.values={},oe(e,{name:t,constructor:s,fromWireType:function(u){return this.constructor.values[u]},toWireType:(u,d)=>d.value,argPackAdvance:ie,readValueFromPointer:fo(t,n,a),destructorFunction:null}),Et(t,s)},Rt=(e,t)=>{var n=we[e];return n===void 0&&x(t+" has unknown type "+Fr(e)),n},po=(e,t,n)=>{var a=Rt(e,"enum");t=J(t);var s=a.constructor,u=Object.create(a.constructor.prototype,{value:{value:n},constructor:{value:Ue(`${a.name}_${t}`,function(){})}});s.values[n]=u,s[t]=u},xt=e=>{if(e===null)return"null";var t=typeof e;return t==="object"||t==="array"||t==="function"?e.toString():""+e},mo=(e,t)=>{switch(t){case 4:return function(n){return this.fromWireType(me[n>>2])};case 8:return function(n){return this.fromWireType(ce[n>>3])};default:throw new TypeError(`invalid float width (${t}): ${e}`)}},vo=(e,t,n)=>{t=J(t),oe(e,{name:t,fromWireType:a=>a,toWireType:(a,s)=>s,argPackAdvance:ie,readValueFromPointer:mo(t,n),destructorFunction:null})},yo=(e,t,n,a,s,u,d)=>{var f=Mt(t,n);e=J(e),e=Ur(e),s=re(a,s),Et(e,function(){ot(`Cannot call ${e} due to unbound types`,f)},t-1),be([],f,function(m){var w=[m[0],null].concat(m.slice(1));return xr(e,Dt(e,w,null,s,u),t-1),[]})},go=(e,t,n)=>{switch(t){case 1:return n?a=>k[a>>0]:a=>R[a>>0];case 2:return n?a=>Z[a>>1]:a=>I[a>>1];case 4:return n?a=>D[a>>2]:a=>A[a>>2];default:throw new TypeError(`invalid integer width (${t}): ${e}`)}},wo=(e,t,n,a,s)=>{t=J(t);var u=_=>_;if(a===0){var d=32-8*n;u=_=>_<>>d}var f=t.includes("unsigned"),m=(_,T)=>{},w;f?w=function(_,T){return m(T,this.name),T>>>0}:w=function(_,T){return m(T,this.name),T},oe(e,{name:t,fromWireType:u,toWireType:w,argPackAdvance:ie,readValueFromPointer:go(t,n,a!==0),destructorFunction:null})},bo=(e,t,n)=>{var a=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],s=a[t];function u(d){var f=A[d>>2],m=A[d+4>>2];return new s(k.buffer,m,f)}n=J(n),oe(e,{name:n,fromWireType:u,argPackAdvance:ie,readValueFromPointer:u},{ignoreDuplicateRegistrations:!0})},jr=(e,t,n,a)=>{if(!(a>0))return 0;for(var s=n,u=n+a-1,d=0;d=55296&&f<=57343){var m=e.charCodeAt(++d);f=65536+((f&1023)<<10)|m&1023}if(f<=127){if(n>=u)break;t[n++]=f}else if(f<=2047){if(n+1>=u)break;t[n++]=192|f>>6,t[n++]=128|f&63}else if(f<=65535){if(n+2>=u)break;t[n++]=224|f>>12,t[n++]=128|f>>6&63,t[n++]=128|f&63}else{if(n+3>=u)break;t[n++]=240|f>>18,t[n++]=128|f>>12&63,t[n++]=128|f>>6&63,t[n++]=128|f&63}}return t[n]=0,n-s},Co=(e,t,n)=>jr(e,R,t,n),Lr=e=>{for(var t=0,n=0;n=55296&&a<=57343?(t+=4,++n):t+=3}return t},Hr=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0,$o=(e,t,n)=>{for(var a=t+n,s=t;e[s]&&!(s>=a);)++s;if(s-t>16&&e.buffer&&Hr)return Hr.decode(e.subarray(t,s));for(var u="";t>10,56320|w&1023)}}return u},kt=(e,t)=>e?$o(R,e,t):"",_o=(e,t)=>{t=J(t);var n=t==="std::string";oe(e,{name:t,fromWireType(a){var s=A[a>>2],u=a+4,d;if(n)for(var f=u,m=0;m<=s;++m){var w=u+m;if(m==s||R[w]==0){var _=w-f,T=kt(f,_);d===void 0?d=T:(d+="\0",d+=T),f=w+1}}else{for(var E=new Array(s),m=0;m>2]=u,n&&d)Co(s,m,u+1);else if(d)for(var w=0;w255&&(de(m),x("String has UTF-16 code units that do not fit in 8 bits")),R[m+w]=_}else for(var w=0;w{for(var n=e,a=n>>1,s=a+t/2;!(a>=s)&&I[a];)++a;if(n=a<<1,n-e>32&&Br)return Br.decode(R.subarray(e,n));for(var u="",d=0;!(d>=t/2);++d){var f=Z[e+d*2>>1];if(f==0)break;u+=String.fromCharCode(f)}return u},Po=(e,t,n)=>{var a;if((a=n)!==null&&a!==void 0||(n=2147483647),n<2)return 0;n-=2;for(var s=t,u=n>1]=f,t+=2}return Z[t>>1]=0,t-s},To=e=>e.length*2,Eo=(e,t)=>{for(var n=0,a="";!(n>=t/4);){var s=D[e+n*4>>2];if(s==0)break;if(++n,s>=65536){var u=s-65536;a+=String.fromCharCode(55296|u>>10,56320|u&1023)}else a+=String.fromCharCode(s)}return a},Oo=(e,t,n)=>{var a;if((a=n)!==null&&a!==void 0||(n=2147483647),n<4)return 0;for(var s=t,u=s+n-4,d=0;d=55296&&f<=57343){var m=e.charCodeAt(++d);f=65536+((f&1023)<<10)|m&1023}if(D[t>>2]=f,t+=4,t+4>u)break}return D[t>>2]=0,t-s},Mo=e=>{for(var t=0,n=0;n=55296&&a<=57343&&++n,t+=4}return t},Do=(e,t,n)=>{n=J(n);var a,s,u,d,f;t===2?(a=So,s=Po,d=To,u=()=>I,f=1):t===4&&(a=Eo,s=Oo,d=Mo,u=()=>A,f=2),oe(e,{name:n,fromWireType:m=>{for(var w=A[m>>2],_=u(),T,E=m+4,M=0;M<=w;++M){var H=m+4+M*t;if(M==w||_[H>>f]==0){var N=H-E,F=a(E,N);T===void 0?T=F:(T+="\0",T+=F),E=H+t}}return de(m),T},toWireType:(m,w)=>{typeof w!="string"&&x(`Cannot pass non-string to C++ string type ${n}`);var _=d(w),T=Ut(4+_+t);return A[T>>2]=_>>f,s(w,T+4,_+t),m!==null&&m.push(de,T),T},argPackAdvance:ie,readValueFromPointer:_t,destructorFunction(m){de(m)}})},Ao=(e,t,n,a,s,u)=>{Ze[e]={name:J(t),rawConstructor:re(n,a),rawDestructor:re(s,u),fields:[]}},Ro=(e,t,n,a,s,u,d,f,m,w)=>{Ze[e].fields.push({fieldName:J(t),getterReturnType:n,getter:re(a,s),getterContext:u,setterArgumentType:d,setter:re(f,m),setterContext:w})},xo=(e,t)=>{t=J(t),oe(e,{isVoid:!0,name:t,argPackAdvance:0,fromWireType:()=>{},toWireType:(n,a)=>{}})},It=[],ko=(e,t,n,a)=>(e=It[e],t=le.toValue(t),e(null,t,n,a)),Io={},Fo=e=>{var t=Io[e];return t===void 0?J(e):t},Vr=()=>{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.")},Uo=e=>e===0?le.toHandle(Vr()):(e=Fo(e),le.toHandle(Vr()[e])),Wo=e=>{var t=It.length;return It.push(e),t},jo=(e,t)=>{for(var n=new Array(e),a=0;a>2],"parameter "+a);return n},Lo=Reflect.construct,Ho=(e,t,n)=>{var a=[],s=e.toWireType(a,n);return a.length&&(A[t>>2]=le.toHandle(a)),s},Bo=(e,t,n)=>{var a=jo(e,t),s=a.shift();e--;var u=new Array(e),d=(m,w,_,T)=>{for(var E=0,M=0;Mm.name).join(", ")}) => ${s.name}>`;return Wo(Ue(f,d))},Vo=e=>{e>4&&(te.get(e).refcount+=1)},qo=e=>{var t=le.toValue(e);$t(t),At(e)},No=(e,t)=>{e=Rt(e,"_emval_take_value");var n=e.readValueFromPointer(t);return le.toHandle(n)},zo=()=>{K("")},Go=(e,t,n)=>R.copyWithin(e,t,t+n),Yo=()=>2147483648,Jo=e=>{var t=W.buffer,n=(e-t.byteLength+65535)/65536;try{return W.grow(n),Se(),1}catch(a){}},Qo=e=>{var t=R.length;e>>>=0;var n=Yo();if(e>n)return!1;for(var a=(m,w)=>m+(w-m%w)%w,s=1;s<=4;s*=2){var u=t*(1+.2/s);u=Math.min(u,e+100663296);var d=Math.min(n,a(Math.max(e,u),65536)),f=Jo(d);if(f)return!0}return!1},Ft={},Xo=()=>v||"./this.program",We=()=>{if(!We.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,_:Xo()};for(var n in Ft)Ft[n]===void 0?delete t[n]:t[n]=Ft[n];var a=[];for(var n in t)a.push(`${n}=${t[n]}`);We.strings=a}return We.strings},Zo=(e,t)=>{for(var n=0;n>0]=e.charCodeAt(n);k[t>>0]=0},Ko=(e,t)=>{var n=0;return We().forEach((a,s)=>{var u=t+n;A[e+s*4>>2]=u,Zo(a,u),n+=a.length+1}),0},ei=(e,t)=>{var n=We();A[e>>2]=n.length;var a=0;return n.forEach(s=>a+=s.length+1),A[t>>2]=a,0},ti=e=>e,it=e=>e%4===0&&(e%100!==0||e%400===0),ri=(e,t)=>{for(var n=0,a=0;a<=t;n+=e[a++]);return n},qr=[31,29,31,30,31,30,31,31,30,31,30,31],Nr=[31,28,31,30,31,30,31,31,30,31,30,31],ni=(e,t)=>{for(var n=new Date(e.getTime());t>0;){var a=it(n.getFullYear()),s=n.getMonth(),u=(a?qr:Nr)[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 ai(e,t,n){var a=Lr(e)+1,s=new Array(a);return jr(e,s,0,s.length),s}var oi=(e,t)=>{k.set(e,t)},ii=(e,t,n,a)=>{var s=A[a+40>>2],u={tm_sec:D[a>>2],tm_min:D[a+4>>2],tm_hour:D[a+8>>2],tm_mday:D[a+12>>2],tm_mon:D[a+16>>2],tm_year:D[a+20>>2],tm_wday:D[a+24>>2],tm_yday:D[a+28>>2],tm_isdst:D[a+32>>2],tm_gmtoff:D[a+36>>2],tm_zone:s?kt(s):""},d=kt(n),f={"%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 m in f)d=d.replace(new RegExp(m,"g"),f[m]);var w=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],_=["January","February","March","April","May","June","July","August","September","October","November","December"];function T(y,P,z){for(var Y=typeof y=="number"?y.toString():y||"";Y.length0?1:0}var Y;return(Y=z(y.getFullYear()-P.getFullYear()))===0&&(Y=z(y.getMonth()-P.getMonth()))===0&&(Y=z(y.getDate()-P.getDate())),Y}function H(y){switch(y.getDay()){case 0:return new Date(y.getFullYear()-1,11,29);case 1:return y;case 2:return new Date(y.getFullYear(),0,3);case 3:return new Date(y.getFullYear(),0,2);case 4:return new Date(y.getFullYear(),0,1);case 5:return new Date(y.getFullYear()-1,11,31);case 6:return new Date(y.getFullYear()-1,11,30)}}function N(y){var P=ni(new Date(y.tm_year+1900,0,1),y.tm_yday),z=new Date(P.getFullYear(),0,4),Y=new Date(P.getFullYear()+1,0,4),Oe=H(z),ct=H(Y);return M(Oe,P)<=0?M(ct,P)<=0?P.getFullYear()+1:P.getFullYear():P.getFullYear()-1}var F={"%a":y=>w[y.tm_wday].substring(0,3),"%A":y=>w[y.tm_wday],"%b":y=>_[y.tm_mon].substring(0,3),"%B":y=>_[y.tm_mon],"%C":y=>{var P=y.tm_year+1900;return E(P/100|0,2)},"%d":y=>E(y.tm_mday,2),"%e":y=>T(y.tm_mday,2," "),"%g":y=>N(y).toString().substring(2),"%G":y=>N(y),"%H":y=>E(y.tm_hour,2),"%I":y=>{var P=y.tm_hour;return P==0?P=12:P>12&&(P-=12),E(P,2)},"%j":y=>E(y.tm_mday+ri(it(y.tm_year+1900)?qr:Nr,y.tm_mon-1),3),"%m":y=>E(y.tm_mon+1,2),"%M":y=>E(y.tm_min,2),"%n":()=>` -`,"%p":y=>y.tm_hour>=0&&y.tm_hour<12?"AM":"PM","%S":y=>E(y.tm_sec,2),"%t":()=>" ","%u":y=>y.tm_wday||7,"%U":y=>{var P=y.tm_yday+7-y.tm_wday;return E(Math.floor(P/7),2)},"%V":y=>{var P=Math.floor((y.tm_yday+7-(y.tm_wday+6)%7)/7);if((y.tm_wday+371-y.tm_yday-2)%7<=2&&P++,P){if(P==53){var z=(y.tm_wday+371-y.tm_yday)%7;z!=4&&(z!=3||!it(y.tm_year))&&(P=1)}}else{P=52;var Y=(y.tm_wday+7-y.tm_yday-1)%7;(Y==4||Y==5&&it(y.tm_year%400-1))&&P++}return E(P,2)},"%w":y=>y.tm_wday,"%W":y=>{var P=y.tm_yday+7-(y.tm_wday+6)%7;return E(Math.floor(P/7),2)},"%y":y=>(y.tm_year+1900).toString().substring(2),"%Y":y=>y.tm_year+1900,"%z":y=>{var P=y.tm_gmtoff,z=P>=0;return P=Math.abs(P)/60,P=P/60*100+P%60,(z?"+":"-")+("0000"+P).slice(-4)},"%Z":y=>y.tm_zone,"%%":()=>"%"};d=d.replace(/%%/g,"\0\0");for(var m in F)d.includes(m)&&(d=d.replace(new RegExp(m,"g"),F[m](u)));d=d.replace(/\0\0/g,"%");var Q=ai(d);return Q.length>t?0:(oi(Q,e),Q.length-1)},si=(e,t,n,a,s)=>ii(e,t,n,a);Pr=i.InternalError=class extends Error{constructor(e){super(e),this.name="InternalError"}},Ra(),Ee=i.BindingError=class extends Error{constructor(e){super(e),this.name="BindingError"}},qa(),La(),Za(),Ir=i.UnboundTypeError=ro(Error,"UnboundTypeError"),so(),uo();var ci={s:Ca,u:$a,b:Sa,g:Pa,q:Ta,J:Ea,f:Oa,V:Ma,d:_a,da:Da,Q:Aa,_:ka,ca:no,ba:oo,w:io,Y:lo,x:ho,h:po,L:vo,M:yo,t:wo,o:bo,K:_o,C:Do,A:Ao,ea:Ro,$:xo,R:ko,ha:At,fa:Uo,Z:Bo,N:Vo,O:qo,aa:No,B:zo,X:Go,W:Qo,T:Ko,U:ei,E:Si,D:hi,F:_i,n:Pi,a:ui,e:mi,m:fi,k:yi,H:Ci,v:wi,G:$i,z:Ei,P:Mi,l:vi,j:pi,c:di,p:li,I:bi,r:Ti,i:gi,y:Oi,ga:ti,S:si},G=ba(),de=i._free=e=>(de=i._free=G.ka)(e),Ut=i._malloc=e=>(Ut=i._malloc=G.la)(e),zr=e=>(zr=G.na)(e),L=(e,t)=>(L=G.oa)(e,t),je=e=>(je=G.pa)(e),V=()=>(V=G.qa)(),q=e=>(q=G.ra)(e),Gr=e=>(Gr=G.sa)(e),Yr=e=>(Yr=G.ta)(e),Jr=(e,t,n)=>(Jr=G.ua)(e,t,n),Qr=e=>(Qr=G.va)(e);i.dynCall_viijii=(e,t,n,a,s,u,d)=>(i.dynCall_viijii=G.wa)(e,t,n,a,s,u,d);var Xr=i.dynCall_jiiii=(e,t,n,a,s)=>(Xr=i.dynCall_jiiii=G.xa)(e,t,n,a,s);i.dynCall_iiiiij=(e,t,n,a,s,u,d)=>(i.dynCall_iiiiij=G.ya)(e,t,n,a,s,u,d),i.dynCall_iiiiijj=(e,t,n,a,s,u,d,f,m)=>(i.dynCall_iiiiijj=G.za)(e,t,n,a,s,u,d,f,m),i.dynCall_iiiiiijj=(e,t,n,a,s,u,d,f,m,w)=>(i.dynCall_iiiiiijj=G.Aa)(e,t,n,a,s,u,d,f,m,w);function ui(e,t){var n=V();try{return B(e)(t)}catch(a){if(q(n),a!==a+0)throw a;L(1,0)}}function li(e,t,n,a){var s=V();try{B(e)(t,n,a)}catch(u){if(q(s),u!==u+0)throw u;L(1,0)}}function di(e,t,n){var a=V();try{B(e)(t,n)}catch(s){if(q(a),s!==s+0)throw s;L(1,0)}}function fi(e,t,n,a){var s=V();try{return B(e)(t,n,a)}catch(u){if(q(s),u!==u+0)throw u;L(1,0)}}function hi(e,t,n,a,s){var u=V();try{return B(e)(t,n,a,s)}catch(d){if(q(u),d!==d+0)throw d;L(1,0)}}function pi(e,t){var n=V();try{B(e)(t)}catch(a){if(q(n),a!==a+0)throw a;L(1,0)}}function mi(e,t,n){var a=V();try{return B(e)(t,n)}catch(s){if(q(a),s!==s+0)throw s;L(1,0)}}function vi(e){var t=V();try{B(e)()}catch(n){if(q(t),n!==n+0)throw n;L(1,0)}}function yi(e,t,n,a,s){var u=V();try{return B(e)(t,n,a,s)}catch(d){if(q(u),d!==d+0)throw d;L(1,0)}}function gi(e,t,n,a,s,u,d,f,m,w,_){var T=V();try{B(e)(t,n,a,s,u,d,f,m,w,_)}catch(E){if(q(T),E!==E+0)throw E;L(1,0)}}function wi(e,t,n,a,s,u,d){var f=V();try{return B(e)(t,n,a,s,u,d)}catch(m){if(q(f),m!==m+0)throw m;L(1,0)}}function bi(e,t,n,a,s){var u=V();try{B(e)(t,n,a,s)}catch(d){if(q(u),d!==d+0)throw d;L(1,0)}}function Ci(e,t,n,a,s,u){var d=V();try{return B(e)(t,n,a,s,u)}catch(f){if(q(d),f!==f+0)throw f;L(1,0)}}function $i(e,t,n,a,s,u,d,f){var m=V();try{return B(e)(t,n,a,s,u,d,f)}catch(w){if(q(m),w!==w+0)throw w;L(1,0)}}function _i(e,t,n,a){var s=V();try{return B(e)(t,n,a)}catch(u){if(q(s),u!==u+0)throw u;L(1,0)}}function Si(e,t,n,a){var s=V();try{return B(e)(t,n,a)}catch(u){if(q(s),u!==u+0)throw u;L(1,0)}}function Pi(e){var t=V();try{return B(e)()}catch(n){if(q(t),n!==n+0)throw n;L(1,0)}}function Ti(e,t,n,a,s,u,d,f){var m=V();try{B(e)(t,n,a,s,u,d,f)}catch(w){if(q(m),w!==w+0)throw w;L(1,0)}}function Ei(e,t,n,a,s,u,d,f,m,w,_,T){var E=V();try{return B(e)(t,n,a,s,u,d,f,m,w,_,T)}catch(M){if(q(E),M!==M+0)throw M;L(1,0)}}function Oi(e,t,n,a,s,u,d,f,m,w,_,T,E,M,H,N){var F=V();try{B(e)(t,n,a,s,u,d,f,m,w,_,T,E,M,H,N)}catch(Q){if(q(F),Q!==Q+0)throw Q;L(1,0)}}function Mi(e,t,n,a,s){var u=V();try{return Xr(e,t,n,a,s)}catch(d){if(q(u),d!==d+0)throw d;L(1,0)}}var st;ge=function e(){st||Zr(),st||(ge=e)};function Zr(){if(ae>0||(ze(),ae>0))return;function e(){st||(st=!0,i.calledRun=!0,!j&&(ft(),c(i),i.onRuntimeInitialized&&i.onRuntimeInitialized(),ht()))}i.setStatus?(i.setStatus("Running..."),setTimeout(function(){setTimeout(function(){i.setStatus("")},1),e()},1)):e()}if(i.preInit)for(typeof i.preInit=="function"&&(i.preInit=[i.preInit]);i.preInit.length>0;)i.preInit.pop()();return Zr(),o.ready}})();function Mn(r){return lt(He,r)}function Dn(r){return Tn(He,r)}async function An(r,o){return En(He,r,o)}async function Rn(r,o){return On(He,r,o)}var Me;class Be extends EventTarget{constructor(o={}){var i;super(),tn(this,Me,void 0);try{const c=(i=o==null?void 0:o.formats)==null?void 0:i.filter(l=>l!=="unknown");if((c==null?void 0:c.length)===0)throw new TypeError("Hint option provided, but is empty.");c==null||c.forEach(l=>{if(!Le.has(l))throw new TypeError(`Failed to read the 'formats' property from 'BarcodeDetectorOptions': The provided value '${l}' is not a valid enum value of type BarcodeFormat.`)}),rn(this,Me,c!=null?c:[]),Mn().then(l=>{this.dispatchEvent(new CustomEvent("load",{detail:l}))}).catch(l=>{this.dispatchEvent(new CustomEvent("error",{detail:l}))})}catch(c){throw Qt(c,"Failed to construct 'BarcodeDetector'")}}static async getSupportedFormats(){return nn.filter(o=>o!=="unknown")}async detect(o){try{const i=await dn(o);if(i===null)return[];let c;try{Yt(i)?c=await An(i,{tryHarder:!0,formats:jt(this,Me).map(l=>Le.get(l))}):c=await Rn(i,{tryHarder:!0,formats:jt(this,Me).map(l=>Le.get(l))})}catch(l){throw console.error(l),new DOMException("Barcode detection service unavailable.","NotSupportedError")}return c.map(l=>{const{topLeft:{x:h,y:v},topRight:{x:g,y:b},bottomLeft:{x:p,y:C},bottomRight:{x:S,y:$}}=l.position,U=Math.min(h,g,p,S),W=Math.min(v,b,C,$),j=Math.max(h,g,p,S),k=Math.max(v,b,C,$);return{boundingBox:new DOMRectReadOnly(U,W,j-U,k-W),rawValue:l.text,format:an(l.format),cornerPoints:[{x:h,y:v},{x:g,y:b},{x:S,y:$},{x:p,y:C}]}})}catch(i){throw Qt(i,"Failed to execute 'detect' on 'BarcodeDetector'")}}}Me=new WeakMap;const dt=(r,o,i="error")=>{let c,l;const h=new Promise((v,g)=>{c=v,l=g,r.addEventListener(o,c),r.addEventListener(i,l)});return h.finally(()=>{r.removeEventListener(o,c),r.removeEventListener(i,l)}),h},tr=r=>new Promise(o=>setTimeout(o,r));class xn extends Error{constructor(){super("can't process cross-origin image"),this.name="DropImageFetchError"}}class rr extends Error{constructor(){super("this browser has no Stream API support"),this.name="StreamApiNotSupportedError"}}class kn extends Error{constructor(){super("camera access is only permitted in secure context. Use HTTPS or localhost rather than HTTP."),this.name="InsecureContextError"}}class In 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 nr;async function Fn(r){if(window.BarcodeDetector===void 0)return console.debug("[vue-qrcode-reader] Native BarcodeDetector not supported. Will use polyfill."),new Be({formats:r});const o=await window.BarcodeDetector.getSupportedFormats(),i=r.filter(c=>!o.includes(c));return i.length>0?(console.debug(`[vue-qrcode-reader] Native BarcodeDetector does not support formats ${JSON.stringify(i)}. Will use polyfill.`),new Be({formats:r})):(console.debug("[vue-qrcode-reader] Will use native BarcodeDetector."),new window.BarcodeDetector({formats:r}))}async function ar(r){nr=await Fn(r)}const Un=async(r,{detectHandler:o,locateHandler:i,minDelay:c,formats:l})=>{console.debug("[vue-qrcode-reader] start scanning"),await ar(l);const h=v=>async g=>{if(r.readyState===0)console.debug("[vue-qrcode-reader] stop scanning: video element readyState is 0");else{const{lastScanned:b,contentBefore:p,lastScanHadContent:C}=v;if(g-b!p.includes(j.rawValue));$&&o(S);const U=S.length>0;U&&i(S),!U&&C&&i(S);const W={lastScanned:g,lastScanHadContent:U,contentBefore:$?S.map(j=>j.rawValue):p};window.requestAnimationFrame(h(W))}}};h({lastScanned:performance.now(),contentBefore:[],lastScanHadContent:!1})(performance.now())},Wn=async r=>{if(r.startsWith("http")&&r.includes(location.host)===!1)throw new xn;const o=document.createElement("img");return o.src=r,await dt(o,"load"),o},or=async(r,o=["qr_code"])=>await new Be({formats:o}).detect(r),jn=async(r,o=["qr_code"])=>{const i=new Be({formats:o}),c=await Wn(r);return await i.detect(c)};var ir={},X={};Object.defineProperty(X,"__esModule",{value:!0}),X.compactObject=lr,X.deprecated=Yn;var Ln=X.detectBrowser=Jn;X.disableLog=Nn,X.disableWarnings=zn,X.extractVersion=Ve,X.filterStats=Qn,X.log=Gn,X.walkStats=qe,X.wrapPeerConnectionEvent=qn;function Hn(r,o,i){return o=Bn(o),o in r?Object.defineProperty(r,o,{value:i,enumerable:!0,configurable:!0,writable:!0}):r[o]=i,r}function Bn(r){var o=Vn(r,"string");return fe(o)==="symbol"?o:String(o)}function Vn(r,o){if(fe(r)!=="object"||r===null)return r;var i=r[Symbol.toPrimitive];if(i!==void 0){var c=i.call(r,o||"default");if(fe(c)!=="object")return c;throw new TypeError("@@toPrimitive must return a primitive value.")}return(o==="string"?String:Number)(r)}function fe(r){"@babel/helpers - typeof";return fe=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(o){return typeof o}:function(o){return o&&typeof Symbol=="function"&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o},fe(r)}var sr=!0,cr=!0;function Ve(r,o,i){var c=r.match(o);return c&&c.length>=i&&parseInt(c[i],10)}function qn(r,o,i){if(r.RTCPeerConnection){var c=r.RTCPeerConnection.prototype,l=c.addEventListener;c.addEventListener=function(v,g){if(v!==o)return l.apply(this,arguments);var b=function(C){var S=i(C);S&&(g.handleEvent?g.handleEvent(S):g(S))};return this._eventMap=this._eventMap||{},this._eventMap[o]||(this._eventMap[o]=new Map),this._eventMap[o].set(g,b),l.apply(this,[v,b])};var h=c.removeEventListener;c.removeEventListener=function(v,g){if(v!==o||!this._eventMap||!this._eventMap[o])return h.apply(this,arguments);if(!this._eventMap[o].has(g))return h.apply(this,arguments);var b=this._eventMap[o].get(g);return this._eventMap[o].delete(g),this._eventMap[o].size===0&&delete this._eventMap[o],Object.keys(this._eventMap).length===0&&delete this._eventMap,h.apply(this,[v,b])},Object.defineProperty(c,"on"+o,{get:function(){return this["_on"+o]},set:function(g){this["_on"+o]&&(this.removeEventListener(o,this["_on"+o]),delete this["_on"+o]),g&&this.addEventListener(o,this["_on"+o]=g)},enumerable:!0,configurable:!0})}}function Nn(r){return typeof r!="boolean"?new Error("Argument type: "+fe(r)+". Please use a boolean."):(sr=r,r?"adapter.js logging disabled":"adapter.js logging enabled")}function zn(r){return typeof r!="boolean"?new Error("Argument type: "+fe(r)+". Please use a boolean."):(cr=!r,"adapter.js deprecation warnings "+(r?"disabled":"enabled"))}function Gn(){if((typeof window>"u"?"undefined":fe(window))==="object"){if(sr)return;typeof console<"u"&&typeof console.log=="function"&&console.log.apply(console,arguments)}}function Yn(r,o){cr&&console.warn(r+" is deprecated, please use "+o+" instead.")}function Jn(r){var o={browser:null,version:null};if(typeof r>"u"||!r.navigator||!r.navigator.userAgent)return o.browser="Not a browser.",o;var i=r.navigator;if(i.mozGetUserMedia)o.browser="firefox",o.version=Ve(i.userAgent,/Firefox\/(\d+)\./,1);else if(i.webkitGetUserMedia||r.isSecureContext===!1&&r.webkitRTCPeerConnection)o.browser="chrome",o.version=Ve(i.userAgent,/Chrom(e|ium)\/(\d+)\./,2);else if(r.RTCPeerConnection&&i.userAgent.match(/AppleWebKit\/(\d+)\./))o.browser="safari",o.version=Ve(i.userAgent,/AppleWebKit\/(\d+)\./,1),o.supportsUnifiedPlan=r.RTCRtpTransceiver&&"currentDirection"in r.RTCRtpTransceiver.prototype;else return o.browser="Not a supported browser.",o;return o}function ur(r){return Object.prototype.toString.call(r)==="[object Object]"}function lr(r){return ur(r)?Object.keys(r).reduce(function(o,i){var c=ur(r[i]),l=c?lr(r[i]):r[i],h=c&&!Object.keys(l).length;return l===void 0||h?o:Object.assign(o,Hn({},i,l))},{}):r}function qe(r,o,i){!o||i.has(o.id)||(i.set(o.id,o),Object.keys(o).forEach(function(c){c.endsWith("Id")?qe(r,r.get(o[c]),i):c.endsWith("Ids")&&o[c].forEach(function(l){qe(r,r.get(l),i)})}))}function Qn(r,o,i){var c=i?"outbound-rtp":"inbound-rtp",l=new Map;if(o===null)return l;var h=[];return r.forEach(function(v){v.type==="track"&&v.trackIdentifier===o.id&&h.push(v)}),h.forEach(function(v){r.forEach(function(g){g.type===c&&g.trackId===v.id&&qe(r,g,l)})}),l}Object.defineProperty(ir,"__esModule",{value:!0});var Xn=ir.shimGetUserMedia=ea,Zn=Kn(X);function dr(r){if(typeof WeakMap!="function")return null;var o=new WeakMap,i=new WeakMap;return(dr=function(l){return l?i:o})(r)}function Kn(r,o){if(r&&r.__esModule)return r;if(r===null||he(r)!=="object"&&typeof r!="function")return{default:r};var i=dr(o);if(i&&i.has(r))return i.get(r);var c={},l=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var h in r)if(h!=="default"&&Object.prototype.hasOwnProperty.call(r,h)){var v=l?Object.getOwnPropertyDescriptor(r,h):null;v&&(v.get||v.set)?Object.defineProperty(c,h,v):c[h]=r[h]}return c.default=r,i&&i.set(r,c),c}function he(r){"@babel/helpers - typeof";return he=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(o){return typeof o}:function(o){return o&&typeof Symbol=="function"&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o},he(r)}var fr=Zn.log;function ea(r,o){var i=r&&r.navigator;if(i.mediaDevices){var c=function(p){if(he(p)!=="object"||p.mandatory||p.optional)return p;var C={};return Object.keys(p).forEach(function(S){if(!(S==="require"||S==="advanced"||S==="mediaSource")){var $=he(p[S])==="object"?p[S]:{ideal:p[S]};$.exact!==void 0&&typeof $.exact=="number"&&($.min=$.max=$.exact);var U=function(k,R){return k?k+R.charAt(0).toUpperCase()+R.slice(1):R==="deviceId"?"sourceId":R};if($.ideal!==void 0){C.optional=C.optional||[];var W={};typeof $.ideal=="number"?(W[U("min",S)]=$.ideal,C.optional.push(W),W={},W[U("max",S)]=$.ideal,C.optional.push(W)):(W[U("",S)]=$.ideal,C.optional.push(W))}$.exact!==void 0&&typeof $.exact!="number"?(C.mandatory=C.mandatory||{},C.mandatory[U("",S)]=$.exact):["min","max"].forEach(function(j){$[j]!==void 0&&(C.mandatory=C.mandatory||{},C.mandatory[U(j,S)]=$[j])})}}),p.advanced&&(C.optional=(C.optional||[]).concat(p.advanced)),C},l=function(p,C){if(o.version>=61)return C(p);if(p=JSON.parse(JSON.stringify(p)),p&&he(p.audio)==="object"){var S=function(k,R,Z){R in k&&!(Z in k)&&(k[Z]=k[R],delete k[R])};p=JSON.parse(JSON.stringify(p)),S(p.audio,"autoGainControl","googAutoGainControl"),S(p.audio,"noiseSuppression","googNoiseSuppression"),p.audio=c(p.audio)}if(p&&he(p.video)==="object"){var $=p.video.facingMode;$=$&&(he($)==="object"?$:{ideal:$});var U=o.version<66;if($&&($.exact==="user"||$.exact==="environment"||$.ideal==="user"||$.ideal==="environment")&&!(i.mediaDevices.getSupportedConstraints&&i.mediaDevices.getSupportedConstraints().facingMode&&!U)){delete p.video.facingMode;var W;if($.exact==="environment"||$.ideal==="environment"?W=["back","rear"]:($.exact==="user"||$.ideal==="user")&&(W=["front"]),W)return i.mediaDevices.enumerateDevices().then(function(j){j=j.filter(function(R){return R.kind==="videoinput"});var k=j.find(function(R){return W.some(function(Z){return R.label.toLowerCase().includes(Z)})});return!k&&j.length&&W.includes("back")&&(k=j[j.length-1]),k&&(p.video.deviceId=$.exact?{exact:k.deviceId}:{ideal:k.deviceId}),p.video=c(p.video),fr("chrome: "+JSON.stringify(p)),C(p)})}p.video=c(p.video)}return fr("chrome: "+JSON.stringify(p)),C(p)},h=function(p){return o.version>=64?p:{name:{PermissionDeniedError:"NotAllowedError",PermissionDismissedError:"NotAllowedError",InvalidStateError:"NotAllowedError",DevicesNotFoundError:"NotFoundError",ConstraintNotSatisfiedError:"OverconstrainedError",TrackStartError:"NotReadableError",MediaDeviceFailedDueToShutdown:"NotAllowedError",MediaDeviceKillSwitchOn:"NotAllowedError",TabCaptureError:"AbortError",ScreenCaptureError:"AbortError",DeviceCaptureError:"AbortError"}[p.name]||p.name,message:p.message,constraint:p.constraint||p.constraintName,toString:function(){return this.name+(this.message&&": ")+this.message}}},v=function(p,C,S){l(p,function($){i.webkitGetUserMedia($,C,function(U){S&&S(h(U))})})};if(i.getUserMedia=v.bind(i),i.mediaDevices.getUserMedia){var g=i.mediaDevices.getUserMedia.bind(i.mediaDevices);i.mediaDevices.getUserMedia=function(b){return l(b,function(p){return g(p).then(function(C){if(p.audio&&!C.getAudioTracks().length||p.video&&!C.getVideoTracks().length)throw C.getTracks().forEach(function(S){S.stop()}),new DOMException("","NotFoundError");return C},function(C){return Promise.reject(h(C))})})}}}}var hr={};Object.defineProperty(hr,"__esModule",{value:!0});var ta=hr.shimGetUserMedia=aa,ra=na(X);function pr(r){if(typeof WeakMap!="function")return null;var o=new WeakMap,i=new WeakMap;return(pr=function(l){return l?i:o})(r)}function na(r,o){if(r&&r.__esModule)return r;if(r===null||$e(r)!=="object"&&typeof r!="function")return{default:r};var i=pr(o);if(i&&i.has(r))return i.get(r);var c={},l=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var h in r)if(h!=="default"&&Object.prototype.hasOwnProperty.call(r,h)){var v=l?Object.getOwnPropertyDescriptor(r,h):null;v&&(v.get||v.set)?Object.defineProperty(c,h,v):c[h]=r[h]}return c.default=r,i&&i.set(r,c),c}function $e(r){"@babel/helpers - typeof";return $e=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(o){return typeof o}:function(o){return o&&typeof Symbol=="function"&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o},$e(r)}function aa(r,o){var i=r&&r.navigator,c=r&&r.MediaStreamTrack;if(i.getUserMedia=function(b,p,C){ra.deprecated("navigator.getUserMedia","navigator.mediaDevices.getUserMedia"),i.mediaDevices.getUserMedia(b).then(p,C)},!(o.version>55&&"autoGainControl"in i.mediaDevices.getSupportedConstraints())){var l=function(p,C,S){C in p&&!(S in p)&&(p[S]=p[C],delete p[C])},h=i.mediaDevices.getUserMedia.bind(i.mediaDevices);if(i.mediaDevices.getUserMedia=function(b){return $e(b)==="object"&&$e(b.audio)==="object"&&(b=JSON.parse(JSON.stringify(b)),l(b.audio,"autoGainControl","mozAutoGainControl"),l(b.audio,"noiseSuppression","mozNoiseSuppression")),h(b)},c&&c.prototype.getSettings){var v=c.prototype.getSettings;c.prototype.getSettings=function(){var b=v.apply(this,arguments);return l(b,"mozAutoGainControl","autoGainControl"),l(b,"mozNoiseSuppression","noiseSuppression"),b}}if(c&&c.prototype.applyConstraints){var g=c.prototype.applyConstraints;c.prototype.applyConstraints=function(b){return this.kind==="audio"&&$e(b)==="object"&&(b=JSON.parse(JSON.stringify(b)),l(b,"autoGainControl","mozAutoGainControl"),l(b,"noiseSuppression","mozNoiseSuppression")),g.apply(this,[b])}}}}var ne={};Object.defineProperty(ne,"__esModule",{value:!0}),ne.shimAudioContext=pa,ne.shimCallbacksAPI=ua,ne.shimConstraints=yr,ne.shimCreateOfferLegacy=ha;var oa=ne.shimGetUserMedia=la;ne.shimLocalStreamsAPI=sa,ne.shimRTCIceServerUrls=da,ne.shimRemoteStreamsAPI=ca,ne.shimTrackEventTransceiver=fa;var mr=ia(X);function vr(r){if(typeof WeakMap!="function")return null;var o=new WeakMap,i=new WeakMap;return(vr=function(l){return l?i:o})(r)}function ia(r,o){if(r&&r.__esModule)return r;if(r===null||pe(r)!=="object"&&typeof r!="function")return{default:r};var i=vr(o);if(i&&i.has(r))return i.get(r);var c={},l=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var h in r)if(h!=="default"&&Object.prototype.hasOwnProperty.call(r,h)){var v=l?Object.getOwnPropertyDescriptor(r,h):null;v&&(v.get||v.set)?Object.defineProperty(c,h,v):c[h]=r[h]}return c.default=r,i&&i.set(r,c),c}function pe(r){"@babel/helpers - typeof";return pe=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(o){return typeof o}:function(o){return o&&typeof Symbol=="function"&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o},pe(r)}function sa(r){if(!(pe(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 o=r.RTCPeerConnection.prototype.addTrack;r.RTCPeerConnection.prototype.addStream=function(c){var l=this;this._localStreams||(this._localStreams=[]),this._localStreams.includes(c)||this._localStreams.push(c),c.getAudioTracks().forEach(function(h){return o.call(l,h,c)}),c.getVideoTracks().forEach(function(h){return o.call(l,h,c)})},r.RTCPeerConnection.prototype.addTrack=function(c){for(var l=this,h=arguments.length,v=new Array(h>1?h-1:0),g=1;g=0)){c._remoteStreams.push(h);var v=new Event("addstream");v.stream=h,c.dispatchEvent(v)}})}),o.apply(c,arguments)}}}function ua(r){if(!(pe(r)!=="object"||!r.RTCPeerConnection)){var o=r.RTCPeerConnection.prototype,i=o.createOffer,c=o.createAnswer,l=o.setLocalDescription,h=o.setRemoteDescription,v=o.addIceCandidate;o.createOffer=function(p,C){var S=arguments.length>=2?arguments[2]:arguments[0],$=i.apply(this,[S]);return C?($.then(p,C),Promise.resolve()):$},o.createAnswer=function(p,C){var S=arguments.length>=2?arguments[2]:arguments[0],$=c.apply(this,[S]);return C?($.then(p,C),Promise.resolve()):$};var g=function(p,C,S){var $=l.apply(this,[p]);return S?($.then(C,S),Promise.resolve()):$};o.setLocalDescription=g,g=function(p,C,S){var $=h.apply(this,[p]);return S?($.then(C,S),Promise.resolve()):$},o.setRemoteDescription=g,g=function(p,C,S){var $=v.apply(this,[p]);return S?($.then(C,S),Promise.resolve()):$},o.addIceCandidate=g}}function la(r){var o=r&&r.navigator;if(o.mediaDevices&&o.mediaDevices.getUserMedia){var i=o.mediaDevices,c=i.getUserMedia.bind(i);o.mediaDevices.getUserMedia=function(l){return c(yr(l))}}!o.getUserMedia&&o.mediaDevices&&o.mediaDevices.getUserMedia&&(o.getUserMedia=(function(h,v,g){o.mediaDevices.getUserMedia(h).then(v,g)}).bind(o))}function yr(r){return r&&r.video!==void 0?Object.assign({},r,{video:mr.compactObject(r.video)}):r}function da(r){if(r.RTCPeerConnection){var o=r.RTCPeerConnection;r.RTCPeerConnection=function(c,l){if(c&&c.iceServers){for(var h=[],v=0;v{let o=!1,i;return(...c)=>(o||(i=r(c),o=!0),i)};function se(r,o){if(r===!1)throw new Error(o!=null?o:"assertion failure")}function gr(r){throw new Error("this code should be unreachable")}const va=ma(()=>{const r=Ln(window);switch(r.browser){case"chrome":Xn(window,r);break;case"firefox":ta(window,r);break;case"safari":oa(window,r);break;default:throw new rr}});let _e=Promise.resolve({type:"stop",data:{}});async function wr(r,o,i){var g,b,p;if(console.debug("[vue-qrcode-reader] starting camera with constraints: ",JSON.stringify(o)),window.isSecureContext!==!0)throw new kn;if(((g=navigator==null?void 0:navigator.mediaDevices)==null?void 0:g.getUserMedia)===void 0)throw new rr;va(),console.debug("[vue-qrcode-reader] calling getUserMedia");const c=await navigator.mediaDevices.getUserMedia({audio:!1,video:o});r.srcObject!==void 0?r.srcObject=c:r.mozSrcObject!==void 0?r.mozSrcObject=c:window.URL.createObjectURL?r.src=window.URL.createObjectURL(c):window.webkitURL?r.src=window.webkitURL.createObjectURL(c):r.src=c.id,r.play(),console.debug("[vue-qrcode-reader] waiting for video element to load"),await Promise.race([dt(r,"loadeddata"),tr(6e3).then(()=>{throw new In})]),console.debug("[vue-qrcode-reader] video element loaded"),await tr(500);const[l]=c.getVideoTracks(),h=(p=(b=l==null?void 0:l.getCapabilities)==null?void 0:b.call(l))!=null?p:{};let v=!1;return i&&h.torch&&(await l.applyConstraints({advanced:[{torch:!0}]}),v=!0),console.debug("[vue-qrcode-reader] camera ready"),{type:"start",data:{videoEl:r,stream:c,capabilities:h,constraints:o,isTorchOn:v}}}async function ya(r,{constraints:o,torch:i,restart:c=!1}){_e=_e.then(h=>{if(h.type==="start"){const{data:{videoEl:v,stream:g,constraints:b,isTorchOn:p}}=h;return!c&&r===v&&o===b&&i===p?h:br(v,g,p).then(()=>wr(r,o,i))}else if(h.type==="stop"||h.type==="failed")return wr(r,o,i);gr()}).catch(h=>(console.debug(`[vue-qrcode-reader] starting camera failed with "${h}"`),{type:"failed",error:h}));const l=await _e;if(l.type==="stop")throw new Error("Something went wrong with the camera task queue (start task).");if(l.type==="failed")throw l.error;if(l.type==="start")return l.data.capabilities;gr()}async function br(r,o,i){console.debug("[vue-qrcode-reader] stopping camera"),r.src="",r.srcObject=null,r.load(),await dt(r,"error");for(const c of o.getTracks())i!=null||await c.applyConstraints({advanced:[{torch:!1}]}),o.removeTrack(c),c.stop();return{type:"stop",data:{}}}async function Ne(){if(_e=_e.then(o=>{if(o.type==="stop"||o.type==="failed")return o;const{data:{videoEl:i,stream:c,isTorchOn:l}}=o;return br(i,c,l)}),(await _e).type==="start")throw new Error("Something went wrong with the camera task queue (stop task).")}const Cr=O.defineComponent({__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:o}){const i=r,c=o,l=O.ref(i.constraints),h=O.ref(i.formats);O.watch(()=>i.constraints,(I,D)=>{JSON.stringify(I)!==JSON.stringify(D)&&(l.value=I)},{deep:!0}),O.watch(()=>i.formats,(I,D)=>{JSON.stringify(I)!==JSON.stringify(D)&&(h.value=I)},{deep:!0});const v=O.ref(),g=O.ref(),b=O.ref(),p=O.ref(!1),C=O.ref(!1);O.onMounted(()=>{C.value=!0}),O.onUnmounted(()=>{Ne()});const S=O.computed(()=>({torch:i.torch,constraints:l.value,shouldStream:C.value&&!i.paused}));O.watch(S,async I=>{const D=b.value;se(D!==void 0,"cameraSettings watcher should never be triggered when component is not mounted. Thus video element should always be defined.");const A=v.value;se(A!==void 0,"cameraSettings watcher should never be triggered when component is not mounted. Thus canvas should always be defined.");const me=A.getContext("2d");if(se(me!==null,"if cavnas is defined, canvas 2d context should also be non-null"),I.shouldStream){Ne(),p.value=!1;try{const ce=await ya(D,I);C.value?(p.value=!0,c("camera-on",ce)):await Ne()}catch(ce){c("error",ce)}}else A.width=D.videoWidth,A.height=D.videoHeight,me.drawImage(D,0,0,D.videoWidth,D.videoHeight),Ne(),p.value=!1,c("camera-off")},{deep:!0}),O.watch(h,async I=>{C.value&&await ar(I)});const $=O.computed(()=>S.value.shouldStream&&p.value);O.watch($,I=>{if(I){se(v.value!==void 0,"shouldScan watcher should only be triggered when component is mounted. Thus pause frame canvas is defined"),U(v.value),se(g.value!==void 0,"shouldScan watcher should only be triggered when component is mounted. Thus tracking canvas is defined"),U(g.value);const D=()=>i.track===void 0?500:40;se(b.value!==void 0,"shouldScan watcher should only be triggered when component is mounted. Thus video element is defined"),Un(b.value,{detectHandler:A=>c("detect",A),formats:h.value,locateHandler:W,minDelay:D()})}});const U=I=>{const D=I.getContext("2d");se(D!==null,"canvas 2d context should always be non-null"),D.clearRect(0,0,I.width,I.height)},W=I=>{const D=g.value;se(D!==void 0,"onLocate handler should only be called when component is mounted. Thus tracking canvas is always defined.");const A=b.value;if(se(A!==void 0,"onLocate handler should only be called when component is mounted. Thus video element is always defined."),I.length===0||i.track===void 0)U(D);else{const me=A.offsetWidth,ce=A.offsetHeight,Se=A.videoWidth,Pe=A.videoHeight,De=Math.max(me/Se,ce/Pe),Ae=Se*De,ze=Pe*De,ft=Ae/Se,ht=ze/Pe,pt=(me-Ae)/2,mt=(ce-ze)/2,Re=({x:ve,y:K})=>({x:Math.floor(ve*ft),y:Math.floor(K*ht)}),ae=({x:ve,y:K})=>({x:Math.floor(ve+pt),y:Math.floor(K+mt)}),ge=I.map(ve=>{const{boundingBox:K,cornerPoints:yt}=ve,{x:Ge,y:ye}=ae(Re({x:K.x,y:K.y})),{x:Ye,y:gt}=Re({x:K.width,y:K.height});return{...ve,cornerPoints:yt.map(Je=>ae(Re(Je))),boundingBox:DOMRectReadOnly.fromRect({x:Ge,y:ye,width:Ye,height:gt})}});D.width=A.offsetWidth,D.height=A.offsetHeight;const vt=D.getContext("2d");i.track(ge,vt)}},j={width:"100%",height:"100%",position:"relative","z-index":"0"},k={width:"100%",height:"100%",position:"absolute",top:"0",left:"0"},R={width:"100%",height:"100%","object-fit":"cover"},Z=O.computed(()=>$.value?R:{...R,visibility:"hidden",position:"absolute"});return(I,D)=>(O.openBlock(),O.createElementBlock("div",{style:j},[O.createElementVNode("video",{ref_key:"videoRef",ref:b,style:O.normalizeStyle(Z.value),autoplay:"",muted:"",playsinline:""},null,4),O.withDirectives(O.createElementVNode("canvas",{id:"qrcode-stream-pause-frame",ref_key:"pauseFrameRef",ref:v,style:R},null,512),[[O.vShow,!$.value]]),O.createElementVNode("canvas",{id:"qrcode-stream-tracking-layer",ref_key:"trackingLayerRef",ref:g,style:k},null,512),O.createElementVNode("div",{style:k},[O.renderSlot(I.$slots,"default")])]))}}),$r=O.defineComponent({__name:"QrcodeCapture",props:{formats:{type:Array,default:()=>["qr_code"]}},emits:["detect"],setup(r,{emit:o}){const i=r,c=o,l=h=>{if(!(!(h.target instanceof HTMLInputElement)||!h.target.files))for(const v of Array.from(h.target.files))or(v,i.formats).then(g=>{c("detect",g)})};return(h,v)=>(O.openBlock(),O.createElementBlock("input",{onChange:l,type:"file",name:"image",accept:"image/*",capture:"environment",multiple:""},null,32))}}),_r=O.defineComponent({__name:"QrcodeDropZone",props:{formats:{type:Array,default:()=>["qr_code"]}},emits:["detect","dragover","error"],setup(r,{emit:o}){const i=r,c=o,l=async g=>{try{const b=await g;c("detect",b)}catch(b){c("error",b)}},h=g=>{c("dragover",g)},v=({dataTransfer:g})=>{if(!g)return;h(!1);const b=[...Array.from(g.files)],p=g.getData("text/uri-list");b.forEach(C=>{l(or(C))}),p!==""&&l(jn(p,i.formats))};return(g,b)=>(O.openBlock(),O.createElementBlock("div",{onDrop:O.withModifiers(v,["prevent","stop"]),onDragenter:b[0]||(b[0]=O.withModifiers(p=>h(!0),["prevent","stop"])),onDragleave:b[1]||(b[1]=O.withModifiers(p=>h(!1),["prevent","stop"])),onDragover:b[2]||(b[2]=O.withModifiers(()=>{},["prevent","stop"]))},[O.renderSlot(g.$slots,"default")],32))}});function Sr(r){r.component("qrcode-stream",Cr),r.component("qrcode-capture",$r),r.component("qrcode-drop-zone",_r)}const ga={install:Sr};ee.QrcodeCapture=$r,ee.QrcodeDropZone=_r,ee.QrcodeStream=Cr,ee.VueQrcodeReader=ga,ee.install=Sr,ee.setZXingModuleOverrides=Dn,Object.defineProperty(ee,Symbol.toStringTag,{value:"Module"})}); +`,"%p":y=>y.tm_hour>=0&&y.tm_hour<12?"AM":"PM","%S":y=>E(y.tm_sec,2),"%t":()=>" ","%u":y=>y.tm_wday||7,"%U":y=>{var P=y.tm_yday+7-y.tm_wday;return E(Math.floor(P/7),2)},"%V":y=>{var P=Math.floor((y.tm_yday+7-(y.tm_wday+6)%7)/7);if((y.tm_wday+371-y.tm_yday-2)%7<=2&&P++,P){if(P==53){var z=(y.tm_wday+371-y.tm_yday)%7;z!=4&&(z!=3||!it(y.tm_year))&&(P=1)}}else{P=52;var Y=(y.tm_wday+7-y.tm_yday-1)%7;(Y==4||Y==5&&it(y.tm_year%400-1))&&P++}return E(P,2)},"%w":y=>y.tm_wday,"%W":y=>{var P=y.tm_yday+7-(y.tm_wday+6)%7;return E(Math.floor(P/7),2)},"%y":y=>(y.tm_year+1900).toString().substring(2),"%Y":y=>y.tm_year+1900,"%z":y=>{var P=y.tm_gmtoff,z=P>=0;return P=Math.abs(P)/60,P=P/60*100+P%60,(z?"+":"-")+("0000"+P).slice(-4)},"%Z":y=>y.tm_zone,"%%":()=>"%"};d=d.replace(/%%/g,"\0\0");for(var m in F)d.includes(m)&&(d=d.replace(new RegExp(m,"g"),F[m](u)));d=d.replace(/\0\0/g,"%");var Q=ai(d);return Q.length>t?0:(oi(Q,e),Q.length-1)},si=(e,t,n,a,s)=>ii(e,t,n,a);Pr=i.InternalError=class extends Error{constructor(e){super(e),this.name="InternalError"}},Ra(),Ee=i.BindingError=class extends Error{constructor(e){super(e),this.name="BindingError"}},qa(),La(),Za(),Ir=i.UnboundTypeError=ro(Error,"UnboundTypeError"),so(),uo();var ci={s:Ca,u:$a,b:Sa,g:Pa,q:Ta,J:Ea,f:Oa,V:Ma,d:_a,da:Da,Q:Aa,_:ka,ca:no,ba:oo,w:io,Y:lo,x:ho,h:po,L:vo,M:yo,t:wo,o:bo,K:_o,C:Do,A:Ao,ea:Ro,$:xo,R:ko,ha:At,fa:Uo,Z:Bo,N:Vo,O:qo,aa:No,B:zo,X:Go,W:Qo,T:Ko,U:ei,E:Si,D:hi,F:_i,n:Pi,a:ui,e:mi,m:fi,k:yi,H:Ci,v:wi,G:$i,z:Ei,P:Mi,l:vi,j:pi,c:di,p:li,I:bi,r:Ti,i:gi,y:Oi,ga:ti,S:si},G=ba(),de=i._free=e=>(de=i._free=G.ka)(e),Ut=i._malloc=e=>(Ut=i._malloc=G.la)(e),zr=e=>(zr=G.na)(e),L=(e,t)=>(L=G.oa)(e,t),je=e=>(je=G.pa)(e),V=()=>(V=G.qa)(),q=e=>(q=G.ra)(e),Gr=e=>(Gr=G.sa)(e),Yr=e=>(Yr=G.ta)(e),Jr=(e,t,n)=>(Jr=G.ua)(e,t,n),Qr=e=>(Qr=G.va)(e);i.dynCall_viijii=(e,t,n,a,s,u,d)=>(i.dynCall_viijii=G.wa)(e,t,n,a,s,u,d);var Xr=i.dynCall_jiiii=(e,t,n,a,s)=>(Xr=i.dynCall_jiiii=G.xa)(e,t,n,a,s);i.dynCall_iiiiij=(e,t,n,a,s,u,d)=>(i.dynCall_iiiiij=G.ya)(e,t,n,a,s,u,d),i.dynCall_iiiiijj=(e,t,n,a,s,u,d,f,m)=>(i.dynCall_iiiiijj=G.za)(e,t,n,a,s,u,d,f,m),i.dynCall_iiiiiijj=(e,t,n,a,s,u,d,f,m,w)=>(i.dynCall_iiiiiijj=G.Aa)(e,t,n,a,s,u,d,f,m,w);function ui(e,t){var n=V();try{return B(e)(t)}catch(a){if(q(n),a!==a+0)throw a;L(1,0)}}function li(e,t,n,a){var s=V();try{B(e)(t,n,a)}catch(u){if(q(s),u!==u+0)throw u;L(1,0)}}function di(e,t,n){var a=V();try{B(e)(t,n)}catch(s){if(q(a),s!==s+0)throw s;L(1,0)}}function fi(e,t,n,a){var s=V();try{return B(e)(t,n,a)}catch(u){if(q(s),u!==u+0)throw u;L(1,0)}}function hi(e,t,n,a,s){var u=V();try{return B(e)(t,n,a,s)}catch(d){if(q(u),d!==d+0)throw d;L(1,0)}}function pi(e,t){var n=V();try{B(e)(t)}catch(a){if(q(n),a!==a+0)throw a;L(1,0)}}function mi(e,t,n){var a=V();try{return B(e)(t,n)}catch(s){if(q(a),s!==s+0)throw s;L(1,0)}}function vi(e){var t=V();try{B(e)()}catch(n){if(q(t),n!==n+0)throw n;L(1,0)}}function yi(e,t,n,a,s){var u=V();try{return B(e)(t,n,a,s)}catch(d){if(q(u),d!==d+0)throw d;L(1,0)}}function gi(e,t,n,a,s,u,d,f,m,w,_){var T=V();try{B(e)(t,n,a,s,u,d,f,m,w,_)}catch(E){if(q(T),E!==E+0)throw E;L(1,0)}}function wi(e,t,n,a,s,u,d){var f=V();try{return B(e)(t,n,a,s,u,d)}catch(m){if(q(f),m!==m+0)throw m;L(1,0)}}function bi(e,t,n,a,s){var u=V();try{B(e)(t,n,a,s)}catch(d){if(q(u),d!==d+0)throw d;L(1,0)}}function Ci(e,t,n,a,s,u){var d=V();try{return B(e)(t,n,a,s,u)}catch(f){if(q(d),f!==f+0)throw f;L(1,0)}}function $i(e,t,n,a,s,u,d,f){var m=V();try{return B(e)(t,n,a,s,u,d,f)}catch(w){if(q(m),w!==w+0)throw w;L(1,0)}}function _i(e,t,n,a){var s=V();try{return B(e)(t,n,a)}catch(u){if(q(s),u!==u+0)throw u;L(1,0)}}function Si(e,t,n,a){var s=V();try{return B(e)(t,n,a)}catch(u){if(q(s),u!==u+0)throw u;L(1,0)}}function Pi(e){var t=V();try{return B(e)()}catch(n){if(q(t),n!==n+0)throw n;L(1,0)}}function Ti(e,t,n,a,s,u,d,f){var m=V();try{B(e)(t,n,a,s,u,d,f)}catch(w){if(q(m),w!==w+0)throw w;L(1,0)}}function Ei(e,t,n,a,s,u,d,f,m,w,_,T){var E=V();try{return B(e)(t,n,a,s,u,d,f,m,w,_,T)}catch(M){if(q(E),M!==M+0)throw M;L(1,0)}}function Oi(e,t,n,a,s,u,d,f,m,w,_,T,E,M,H,N){var F=V();try{B(e)(t,n,a,s,u,d,f,m,w,_,T,E,M,H,N)}catch(Q){if(q(F),Q!==Q+0)throw Q;L(1,0)}}function Mi(e,t,n,a,s){var u=V();try{return Xr(e,t,n,a,s)}catch(d){if(q(u),d!==d+0)throw d;L(1,0)}}var st;ge=function e(){st||Zr(),st||(ge=e)};function Zr(){if(ae>0||(ze(),ae>0))return;function e(){st||(st=!0,i.calledRun=!0,!j&&(ft(),c(i),i.onRuntimeInitialized&&i.onRuntimeInitialized(),ht()))}i.setStatus?(i.setStatus("Running..."),setTimeout(function(){setTimeout(function(){i.setStatus("")},1),e()},1)):e()}if(i.preInit)for(typeof i.preInit=="function"&&(i.preInit=[i.preInit]);i.preInit.length>0;)i.preInit.pop()();return Zr(),o.ready}})();function Mn(r){return lt(He,r)}function Dn(r){return Tn(He,r)}async function An(r,o){return En(He,r,o)}async function Rn(r,o){return On(He,r,o)}var Me;class Be extends EventTarget{constructor(o={}){var i;super(),tn(this,Me,void 0);try{const c=(i=o==null?void 0:o.formats)==null?void 0:i.filter(l=>l!=="unknown");if((c==null?void 0:c.length)===0)throw new TypeError("Hint option provided, but is empty.");c==null||c.forEach(l=>{if(!Le.has(l))throw new TypeError(`Failed to read the 'formats' property from 'BarcodeDetectorOptions': The provided value '${l}' is not a valid enum value of type BarcodeFormat.`)}),rn(this,Me,c!=null?c:[]),Mn().then(l=>{this.dispatchEvent(new CustomEvent("load",{detail:l}))}).catch(l=>{this.dispatchEvent(new CustomEvent("error",{detail:l}))})}catch(c){throw Qt(c,"Failed to construct 'BarcodeDetector'")}}static async getSupportedFormats(){return nn.filter(o=>o!=="unknown")}async detect(o){try{const i=await dn(o);if(i===null)return[];let c;try{Yt(i)?c=await An(i,{tryHarder:!0,formats:jt(this,Me).map(l=>Le.get(l))}):c=await Rn(i,{tryHarder:!0,formats:jt(this,Me).map(l=>Le.get(l))})}catch(l){throw console.error(l),new DOMException("Barcode detection service unavailable.","NotSupportedError")}return c.map(l=>{const{topLeft:{x:h,y:v},topRight:{x:g,y:b},bottomLeft:{x:p,y:C},bottomRight:{x:S,y:$}}=l.position,U=Math.min(h,g,p,S),W=Math.min(v,b,C,$),j=Math.max(h,g,p,S),k=Math.max(v,b,C,$);return{boundingBox:new DOMRectReadOnly(U,W,j-U,k-W),rawValue:l.text,format:an(l.format),cornerPoints:[{x:h,y:v},{x:g,y:b},{x:S,y:$},{x:p,y:C}]}})}catch(i){throw Qt(i,"Failed to execute 'detect' on 'BarcodeDetector'")}}}Me=new WeakMap;const dt=(r,o,i="error")=>{let c,l;const h=new Promise((v,g)=>{c=v,l=g,r.addEventListener(o,c),r.addEventListener(i,l)});return h.finally(()=>{r.removeEventListener(o,c),r.removeEventListener(i,l)}),h},tr=r=>new Promise(o=>setTimeout(o,r));class xn extends Error{constructor(){super("can't process cross-origin image"),this.name="DropImageFetchError"}}class rr extends Error{constructor(){super("this browser has no Stream API support"),this.name="StreamApiNotSupportedError"}}class kn extends Error{constructor(){super("camera access is only permitted in secure context. Use HTTPS or localhost rather than HTTP."),this.name="InsecureContextError"}}class In 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 nr;async function Fn(r){if(window.BarcodeDetector===void 0)return console.debug("[vue-qrcode-reader] Native BarcodeDetector not supported. Will use polyfill."),new Be({formats:r});const o=await window.BarcodeDetector.getSupportedFormats(),i=r.filter(c=>!o.includes(c));return i.length>0?(console.debug(`[vue-qrcode-reader] Native BarcodeDetector does not support formats ${JSON.stringify(i)}. Will use polyfill.`),new Be({formats:r})):(console.debug("[vue-qrcode-reader] Will use native BarcodeDetector."),new window.BarcodeDetector({formats:r}))}async function ar(r){nr=await Fn(r)}const Un=async(r,{detectHandler:o,locateHandler:i,minDelay:c,formats:l})=>{console.debug("[vue-qrcode-reader] start scanning"),await ar(l);const h=v=>async g=>{if(r.readyState===0)console.debug("[vue-qrcode-reader] stop scanning: video element readyState is 0");else{const{lastScanned:b,contentBefore:p,lastScanHadContent:C}=v;if(g-b!p.includes(j.rawValue));$&&o(S);const U=S.length>0;U&&i(S),!U&&C&&i(S);const W={lastScanned:g,lastScanHadContent:U,contentBefore:$?S.map(j=>j.rawValue):p};window.requestAnimationFrame(h(W))}}};h({lastScanned:performance.now(),contentBefore:[],lastScanHadContent:!1})(performance.now())},Wn=async r=>{if(r.startsWith("http")&&r.includes(location.host)===!1)throw new xn;const o=document.createElement("img");return o.src=r,await dt(o,"load"),o},or=async(r,o=["qr_code"])=>await new Be({formats:o}).detect(r),jn=async(r,o=["qr_code"])=>{const i=new Be({formats:o}),c=await Wn(r);return await i.detect(c)};var ir={},X={};Object.defineProperty(X,"__esModule",{value:!0}),X.compactObject=lr,X.deprecated=Yn;var Ln=X.detectBrowser=Jn;X.disableLog=Nn,X.disableWarnings=zn,X.extractVersion=Ve,X.filterStats=Qn,X.log=Gn,X.walkStats=qe,X.wrapPeerConnectionEvent=qn;function Hn(r,o,i){return o=Bn(o),o in r?Object.defineProperty(r,o,{value:i,enumerable:!0,configurable:!0,writable:!0}):r[o]=i,r}function Bn(r){var o=Vn(r,"string");return fe(o)==="symbol"?o:String(o)}function Vn(r,o){if(fe(r)!=="object"||r===null)return r;var i=r[Symbol.toPrimitive];if(i!==void 0){var c=i.call(r,o||"default");if(fe(c)!=="object")return c;throw new TypeError("@@toPrimitive must return a primitive value.")}return(o==="string"?String:Number)(r)}function fe(r){"@babel/helpers - typeof";return fe=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(o){return typeof o}:function(o){return o&&typeof Symbol=="function"&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o},fe(r)}var sr=!0,cr=!0;function Ve(r,o,i){var c=r.match(o);return c&&c.length>=i&&parseInt(c[i],10)}function qn(r,o,i){if(r.RTCPeerConnection){var c=r.RTCPeerConnection.prototype,l=c.addEventListener;c.addEventListener=function(v,g){if(v!==o)return l.apply(this,arguments);var b=function(C){var S=i(C);S&&(g.handleEvent?g.handleEvent(S):g(S))};return this._eventMap=this._eventMap||{},this._eventMap[o]||(this._eventMap[o]=new Map),this._eventMap[o].set(g,b),l.apply(this,[v,b])};var h=c.removeEventListener;c.removeEventListener=function(v,g){if(v!==o||!this._eventMap||!this._eventMap[o])return h.apply(this,arguments);if(!this._eventMap[o].has(g))return h.apply(this,arguments);var b=this._eventMap[o].get(g);return this._eventMap[o].delete(g),this._eventMap[o].size===0&&delete this._eventMap[o],Object.keys(this._eventMap).length===0&&delete this._eventMap,h.apply(this,[v,b])},Object.defineProperty(c,"on"+o,{get:function(){return this["_on"+o]},set:function(g){this["_on"+o]&&(this.removeEventListener(o,this["_on"+o]),delete this["_on"+o]),g&&this.addEventListener(o,this["_on"+o]=g)},enumerable:!0,configurable:!0})}}function Nn(r){return typeof r!="boolean"?new Error("Argument type: "+fe(r)+". Please use a boolean."):(sr=r,r?"adapter.js logging disabled":"adapter.js logging enabled")}function zn(r){return typeof r!="boolean"?new Error("Argument type: "+fe(r)+". Please use a boolean."):(cr=!r,"adapter.js deprecation warnings "+(r?"disabled":"enabled"))}function Gn(){if((typeof window>"u"?"undefined":fe(window))==="object"){if(sr)return;typeof console<"u"&&typeof console.log=="function"&&console.log.apply(console,arguments)}}function Yn(r,o){cr&&console.warn(r+" is deprecated, please use "+o+" instead.")}function Jn(r){var o={browser:null,version:null};if(typeof r>"u"||!r.navigator||!r.navigator.userAgent)return o.browser="Not a browser.",o;var i=r.navigator;if(i.mozGetUserMedia)o.browser="firefox",o.version=Ve(i.userAgent,/Firefox\/(\d+)\./,1);else if(i.webkitGetUserMedia||r.isSecureContext===!1&&r.webkitRTCPeerConnection)o.browser="chrome",o.version=Ve(i.userAgent,/Chrom(e|ium)\/(\d+)\./,2);else if(r.RTCPeerConnection&&i.userAgent.match(/AppleWebKit\/(\d+)\./))o.browser="safari",o.version=Ve(i.userAgent,/AppleWebKit\/(\d+)\./,1),o.supportsUnifiedPlan=r.RTCRtpTransceiver&&"currentDirection"in r.RTCRtpTransceiver.prototype;else return o.browser="Not a supported browser.",o;return o}function ur(r){return Object.prototype.toString.call(r)==="[object Object]"}function lr(r){return ur(r)?Object.keys(r).reduce(function(o,i){var c=ur(r[i]),l=c?lr(r[i]):r[i],h=c&&!Object.keys(l).length;return l===void 0||h?o:Object.assign(o,Hn({},i,l))},{}):r}function qe(r,o,i){!o||i.has(o.id)||(i.set(o.id,o),Object.keys(o).forEach(function(c){c.endsWith("Id")?qe(r,r.get(o[c]),i):c.endsWith("Ids")&&o[c].forEach(function(l){qe(r,r.get(l),i)})}))}function Qn(r,o,i){var c=i?"outbound-rtp":"inbound-rtp",l=new Map;if(o===null)return l;var h=[];return r.forEach(function(v){v.type==="track"&&v.trackIdentifier===o.id&&h.push(v)}),h.forEach(function(v){r.forEach(function(g){g.type===c&&g.trackId===v.id&&qe(r,g,l)})}),l}Object.defineProperty(ir,"__esModule",{value:!0});var Xn=ir.shimGetUserMedia=ea,Zn=Kn(X);function dr(r){if(typeof WeakMap!="function")return null;var o=new WeakMap,i=new WeakMap;return(dr=function(l){return l?i:o})(r)}function Kn(r,o){if(r&&r.__esModule)return r;if(r===null||he(r)!=="object"&&typeof r!="function")return{default:r};var i=dr(o);if(i&&i.has(r))return i.get(r);var c={},l=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var h in r)if(h!=="default"&&Object.prototype.hasOwnProperty.call(r,h)){var v=l?Object.getOwnPropertyDescriptor(r,h):null;v&&(v.get||v.set)?Object.defineProperty(c,h,v):c[h]=r[h]}return c.default=r,i&&i.set(r,c),c}function he(r){"@babel/helpers - typeof";return he=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(o){return typeof o}:function(o){return o&&typeof Symbol=="function"&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o},he(r)}var fr=Zn.log;function ea(r,o){var i=r&&r.navigator;if(i.mediaDevices){var c=function(p){if(he(p)!=="object"||p.mandatory||p.optional)return p;var C={};return Object.keys(p).forEach(function(S){if(!(S==="require"||S==="advanced"||S==="mediaSource")){var $=he(p[S])==="object"?p[S]:{ideal:p[S]};$.exact!==void 0&&typeof $.exact=="number"&&($.min=$.max=$.exact);var U=function(k,R){return k?k+R.charAt(0).toUpperCase()+R.slice(1):R==="deviceId"?"sourceId":R};if($.ideal!==void 0){C.optional=C.optional||[];var W={};typeof $.ideal=="number"?(W[U("min",S)]=$.ideal,C.optional.push(W),W={},W[U("max",S)]=$.ideal,C.optional.push(W)):(W[U("",S)]=$.ideal,C.optional.push(W))}$.exact!==void 0&&typeof $.exact!="number"?(C.mandatory=C.mandatory||{},C.mandatory[U("",S)]=$.exact):["min","max"].forEach(function(j){$[j]!==void 0&&(C.mandatory=C.mandatory||{},C.mandatory[U(j,S)]=$[j])})}}),p.advanced&&(C.optional=(C.optional||[]).concat(p.advanced)),C},l=function(p,C){if(o.version>=61)return C(p);if(p=JSON.parse(JSON.stringify(p)),p&&he(p.audio)==="object"){var S=function(k,R,Z){R in k&&!(Z in k)&&(k[Z]=k[R],delete k[R])};p=JSON.parse(JSON.stringify(p)),S(p.audio,"autoGainControl","googAutoGainControl"),S(p.audio,"noiseSuppression","googNoiseSuppression"),p.audio=c(p.audio)}if(p&&he(p.video)==="object"){var $=p.video.facingMode;$=$&&(he($)==="object"?$:{ideal:$});var U=o.version<66;if($&&($.exact==="user"||$.exact==="environment"||$.ideal==="user"||$.ideal==="environment")&&!(i.mediaDevices.getSupportedConstraints&&i.mediaDevices.getSupportedConstraints().facingMode&&!U)){delete p.video.facingMode;var W;if($.exact==="environment"||$.ideal==="environment"?W=["back","rear"]:($.exact==="user"||$.ideal==="user")&&(W=["front"]),W)return i.mediaDevices.enumerateDevices().then(function(j){j=j.filter(function(R){return R.kind==="videoinput"});var k=j.find(function(R){return W.some(function(Z){return R.label.toLowerCase().includes(Z)})});return!k&&j.length&&W.includes("back")&&(k=j[j.length-1]),k&&(p.video.deviceId=$.exact?{exact:k.deviceId}:{ideal:k.deviceId}),p.video=c(p.video),fr("chrome: "+JSON.stringify(p)),C(p)})}p.video=c(p.video)}return fr("chrome: "+JSON.stringify(p)),C(p)},h=function(p){return o.version>=64?p:{name:{PermissionDeniedError:"NotAllowedError",PermissionDismissedError:"NotAllowedError",InvalidStateError:"NotAllowedError",DevicesNotFoundError:"NotFoundError",ConstraintNotSatisfiedError:"OverconstrainedError",TrackStartError:"NotReadableError",MediaDeviceFailedDueToShutdown:"NotAllowedError",MediaDeviceKillSwitchOn:"NotAllowedError",TabCaptureError:"AbortError",ScreenCaptureError:"AbortError",DeviceCaptureError:"AbortError"}[p.name]||p.name,message:p.message,constraint:p.constraint||p.constraintName,toString:function(){return this.name+(this.message&&": ")+this.message}}},v=function(p,C,S){l(p,function($){i.webkitGetUserMedia($,C,function(U){S&&S(h(U))})})};if(i.getUserMedia=v.bind(i),i.mediaDevices.getUserMedia){var g=i.mediaDevices.getUserMedia.bind(i.mediaDevices);i.mediaDevices.getUserMedia=function(b){return l(b,function(p){return g(p).then(function(C){if(p.audio&&!C.getAudioTracks().length||p.video&&!C.getVideoTracks().length)throw C.getTracks().forEach(function(S){S.stop()}),new DOMException("","NotFoundError");return C},function(C){return Promise.reject(h(C))})})}}}}var hr={};Object.defineProperty(hr,"__esModule",{value:!0});var ta=hr.shimGetUserMedia=aa,ra=na(X);function pr(r){if(typeof WeakMap!="function")return null;var o=new WeakMap,i=new WeakMap;return(pr=function(l){return l?i:o})(r)}function na(r,o){if(r&&r.__esModule)return r;if(r===null||$e(r)!=="object"&&typeof r!="function")return{default:r};var i=pr(o);if(i&&i.has(r))return i.get(r);var c={},l=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var h in r)if(h!=="default"&&Object.prototype.hasOwnProperty.call(r,h)){var v=l?Object.getOwnPropertyDescriptor(r,h):null;v&&(v.get||v.set)?Object.defineProperty(c,h,v):c[h]=r[h]}return c.default=r,i&&i.set(r,c),c}function $e(r){"@babel/helpers - typeof";return $e=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(o){return typeof o}:function(o){return o&&typeof Symbol=="function"&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o},$e(r)}function aa(r,o){var i=r&&r.navigator,c=r&&r.MediaStreamTrack;if(i.getUserMedia=function(b,p,C){ra.deprecated("navigator.getUserMedia","navigator.mediaDevices.getUserMedia"),i.mediaDevices.getUserMedia(b).then(p,C)},!(o.version>55&&"autoGainControl"in i.mediaDevices.getSupportedConstraints())){var l=function(p,C,S){C in p&&!(S in p)&&(p[S]=p[C],delete p[C])},h=i.mediaDevices.getUserMedia.bind(i.mediaDevices);if(i.mediaDevices.getUserMedia=function(b){return $e(b)==="object"&&$e(b.audio)==="object"&&(b=JSON.parse(JSON.stringify(b)),l(b.audio,"autoGainControl","mozAutoGainControl"),l(b.audio,"noiseSuppression","mozNoiseSuppression")),h(b)},c&&c.prototype.getSettings){var v=c.prototype.getSettings;c.prototype.getSettings=function(){var b=v.apply(this,arguments);return l(b,"mozAutoGainControl","autoGainControl"),l(b,"mozNoiseSuppression","noiseSuppression"),b}}if(c&&c.prototype.applyConstraints){var g=c.prototype.applyConstraints;c.prototype.applyConstraints=function(b){return this.kind==="audio"&&$e(b)==="object"&&(b=JSON.parse(JSON.stringify(b)),l(b,"autoGainControl","mozAutoGainControl"),l(b,"noiseSuppression","mozNoiseSuppression")),g.apply(this,[b])}}}}var ne={};Object.defineProperty(ne,"__esModule",{value:!0}),ne.shimAudioContext=pa,ne.shimCallbacksAPI=ua,ne.shimConstraints=yr,ne.shimCreateOfferLegacy=ha;var oa=ne.shimGetUserMedia=la;ne.shimLocalStreamsAPI=sa,ne.shimRTCIceServerUrls=da,ne.shimRemoteStreamsAPI=ca,ne.shimTrackEventTransceiver=fa;var mr=ia(X);function vr(r){if(typeof WeakMap!="function")return null;var o=new WeakMap,i=new WeakMap;return(vr=function(l){return l?i:o})(r)}function ia(r,o){if(r&&r.__esModule)return r;if(r===null||pe(r)!=="object"&&typeof r!="function")return{default:r};var i=vr(o);if(i&&i.has(r))return i.get(r);var c={},l=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var h in r)if(h!=="default"&&Object.prototype.hasOwnProperty.call(r,h)){var v=l?Object.getOwnPropertyDescriptor(r,h):null;v&&(v.get||v.set)?Object.defineProperty(c,h,v):c[h]=r[h]}return c.default=r,i&&i.set(r,c),c}function pe(r){"@babel/helpers - typeof";return pe=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(o){return typeof o}:function(o){return o&&typeof Symbol=="function"&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o},pe(r)}function sa(r){if(!(pe(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 o=r.RTCPeerConnection.prototype.addTrack;r.RTCPeerConnection.prototype.addStream=function(c){var l=this;this._localStreams||(this._localStreams=[]),this._localStreams.includes(c)||this._localStreams.push(c),c.getAudioTracks().forEach(function(h){return o.call(l,h,c)}),c.getVideoTracks().forEach(function(h){return o.call(l,h,c)})},r.RTCPeerConnection.prototype.addTrack=function(c){for(var l=this,h=arguments.length,v=new Array(h>1?h-1:0),g=1;g=0)){c._remoteStreams.push(h);var v=new Event("addstream");v.stream=h,c.dispatchEvent(v)}})}),o.apply(c,arguments)}}}function ua(r){if(!(pe(r)!=="object"||!r.RTCPeerConnection)){var o=r.RTCPeerConnection.prototype,i=o.createOffer,c=o.createAnswer,l=o.setLocalDescription,h=o.setRemoteDescription,v=o.addIceCandidate;o.createOffer=function(p,C){var S=arguments.length>=2?arguments[2]:arguments[0],$=i.apply(this,[S]);return C?($.then(p,C),Promise.resolve()):$},o.createAnswer=function(p,C){var S=arguments.length>=2?arguments[2]:arguments[0],$=c.apply(this,[S]);return C?($.then(p,C),Promise.resolve()):$};var g=function(p,C,S){var $=l.apply(this,[p]);return S?($.then(C,S),Promise.resolve()):$};o.setLocalDescription=g,g=function(p,C,S){var $=h.apply(this,[p]);return S?($.then(C,S),Promise.resolve()):$},o.setRemoteDescription=g,g=function(p,C,S){var $=v.apply(this,[p]);return S?($.then(C,S),Promise.resolve()):$},o.addIceCandidate=g}}function la(r){var o=r&&r.navigator;if(o.mediaDevices&&o.mediaDevices.getUserMedia){var i=o.mediaDevices,c=i.getUserMedia.bind(i);o.mediaDevices.getUserMedia=function(l){return c(yr(l))}}!o.getUserMedia&&o.mediaDevices&&o.mediaDevices.getUserMedia&&(o.getUserMedia=(function(h,v,g){o.mediaDevices.getUserMedia(h).then(v,g)}).bind(o))}function yr(r){return r&&r.video!==void 0?Object.assign({},r,{video:mr.compactObject(r.video)}):r}function da(r){if(r.RTCPeerConnection){var o=r.RTCPeerConnection;r.RTCPeerConnection=function(c,l){if(c&&c.iceServers){for(var h=[],v=0;v{let o=!1,i;return(...c)=>(o||(i=r(c),o=!0),i)};function se(r,o){if(r===!1)throw new Error(o!=null?o:"assertion failure")}function gr(r){throw new Error("this code should be unreachable")}const va=ma(()=>{const r=Ln(window);switch(r.browser){case"chrome":Xn(window,r);break;case"firefox":ta(window,r);break;case"safari":oa(window,r);break;default:throw new rr}});let _e=Promise.resolve({type:"stop",data:{}});async function wr(r,o,i){var g,b,p;if(console.debug("[vue-qrcode-reader] starting camera with constraints: ",JSON.stringify(o)),window.isSecureContext!==!0)throw new kn;if(((g=navigator==null?void 0:navigator.mediaDevices)==null?void 0:g.getUserMedia)===void 0)throw new rr;va(),console.debug("[vue-qrcode-reader] calling getUserMedia");const c=await navigator.mediaDevices.getUserMedia({audio:!1,video:o});r.srcObject!==void 0?r.srcObject=c:r.mozSrcObject!==void 0?r.mozSrcObject=c:window.URL.createObjectURL?r.src=window.URL.createObjectURL(c):window.webkitURL?r.src=window.webkitURL.createObjectURL(c):r.src=c.id,r.play(),console.debug("[vue-qrcode-reader] waiting for video element to load"),await Promise.race([dt(r,"loadeddata"),tr(6e3).then(()=>{throw new In})]),console.debug("[vue-qrcode-reader] video element loaded"),await tr(500);const[l]=c.getVideoTracks(),h=(p=(b=l==null?void 0:l.getCapabilities)==null?void 0:b.call(l))!=null?p:{};let v=!1;return i&&h.torch&&(await l.applyConstraints({advanced:[{torch:!0}]}),v=!0),console.debug("[vue-qrcode-reader] camera ready"),{type:"start",data:{videoEl:r,stream:c,capabilities:h,constraints:o,isTorchOn:v}}}async function ya(r,{constraints:o,torch:i,restart:c=!1}){_e=_e.then(h=>{if(h.type==="start"){const{data:{videoEl:v,stream:g,constraints:b,isTorchOn:p}}=h;return!c&&r===v&&o===b&&i===p?h:br(v,g,p).then(()=>wr(r,o,i))}else if(h.type==="stop"||h.type==="failed")return wr(r,o,i);gr()}).catch(h=>(console.debug(`[vue-qrcode-reader] starting camera failed with "${h}"`),{type:"failed",error:h}));const l=await _e;if(l.type==="stop")throw new Error("Something went wrong with the camera task queue (start task).");if(l.type==="failed")throw l.error;if(l.type==="start")return l.data.capabilities;gr()}async function br(r,o,i){console.debug("[vue-qrcode-reader] stopping camera"),r.src="",r.srcObject=null,r.load(),await dt(r,"error");for(const c of o.getTracks())i!=null||await c.applyConstraints({advanced:[{torch:!1}]}),o.removeTrack(c),c.stop();return{type:"stop",data:{}}}async function Ne(){if(_e=_e.then(o=>{if(o.type==="stop"||o.type==="failed")return o;const{data:{videoEl:i,stream:c,isTorchOn:l}}=o;return br(i,c,l)}),(await _e).type==="start")throw new Error("Something went wrong with the camera task queue (stop task).")}const Cr=O.defineComponent({__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:o}){const i=r,c=o,l=O.ref(i.constraints),h=O.ref(i.formats);O.watch(()=>i.constraints,(I,D)=>{JSON.stringify(I)!==JSON.stringify(D)&&(l.value=I)},{deep:!0}),O.watch(()=>i.formats,(I,D)=>{JSON.stringify(I)!==JSON.stringify(D)&&(h.value=I)},{deep:!0});const v=O.ref(),g=O.ref(),b=O.ref(),p=O.ref(!1),C=O.ref(!1);O.onMounted(()=>{C.value=!0}),O.onUnmounted(()=>{Ne()});const S=O.computed(()=>({torch:i.torch,constraints:l.value,shouldStream:C.value&&!i.paused}));O.watch(S,async I=>{const D=b.value;se(D!==void 0,"cameraSettings watcher should never be triggered when component is not mounted. Thus video element should always be defined.");const A=v.value;se(A!==void 0,"cameraSettings watcher should never be triggered when component is not mounted. Thus canvas should always be defined.");const me=A.getContext("2d");if(se(me!==null,"if cavnas is defined, canvas 2d context should also be non-null"),I.shouldStream){Ne(),p.value=!1;try{const ce=await ya(D,I);C.value?(p.value=!0,c("camera-on",ce)):await Ne()}catch(ce){c("error",ce)}}else A.width=D.videoWidth,A.height=D.videoHeight,me.drawImage(D,0,0,D.videoWidth,D.videoHeight),Ne(),p.value=!1,c("camera-off")},{deep:!0}),O.watch(h,async I=>{C.value&&await ar(I)});const $=O.computed(()=>S.value.shouldStream&&p.value);O.watch($,I=>{if(I){se(v.value!==void 0,"shouldScan watcher should only be triggered when component is mounted. Thus pause frame canvas is defined"),U(v.value),se(g.value!==void 0,"shouldScan watcher should only be triggered when component is mounted. Thus tracking canvas is defined"),U(g.value);const D=()=>i.track===void 0?500:40;se(b.value!==void 0,"shouldScan watcher should only be triggered when component is mounted. Thus video element is defined"),Un(b.value,{detectHandler:A=>c("detect",A),formats:h.value,locateHandler:W,minDelay:D()})}});const U=I=>{const D=I.getContext("2d");se(D!==null,"canvas 2d context should always be non-null"),D.clearRect(0,0,I.width,I.height)},W=I=>{const D=g.value;se(D!==void 0,"onLocate handler should only be called when component is mounted. Thus tracking canvas is always defined.");const A=b.value;if(se(A!==void 0,"onLocate handler should only be called when component is mounted. Thus video element is always defined."),I.length===0||i.track===void 0)U(D);else{const me=A.offsetWidth,ce=A.offsetHeight,Se=A.videoWidth,Pe=A.videoHeight,De=Math.max(me/Se,ce/Pe),Ae=Se*De,ze=Pe*De,ft=Ae/Se,ht=ze/Pe,pt=(me-Ae)/2,mt=(ce-ze)/2,Re=({x:ve,y:K})=>({x:Math.floor(ve*ft),y:Math.floor(K*ht)}),ae=({x:ve,y:K})=>({x:Math.floor(ve+pt),y:Math.floor(K+mt)}),ge=I.map(ve=>{const{boundingBox:K,cornerPoints:yt}=ve,{x:Ge,y:ye}=ae(Re({x:K.x,y:K.y})),{x:Ye,y:gt}=Re({x:K.width,y:K.height});return{...ve,cornerPoints:yt.map(Je=>ae(Re(Je))),boundingBox:DOMRectReadOnly.fromRect({x:Ge,y:ye,width:Ye,height:gt})}});D.width=A.offsetWidth,D.height=A.offsetHeight;const vt=D.getContext("2d");i.track(ge,vt)}},j={width:"100%",height:"100%",position:"relative","z-index":"0"},k={width:"100%",height:"100%",position:"absolute",top:"0",left:"0"},R={width:"100%",height:"100%","object-fit":"cover"},Z=O.computed(()=>$.value?R:{...R,visibility:"hidden",position:"absolute"});return(I,D)=>(O.openBlock(),O.createElementBlock("div",{style:j},[O.createElementVNode("video",{ref_key:"videoRef",ref:b,style:O.normalizeStyle(Z.value),autoplay:"",muted:"",playsinline:""},null,4),O.withDirectives(O.createElementVNode("canvas",{id:"qrcode-stream-pause-frame",ref_key:"pauseFrameRef",ref:v,style:R},null,512),[[O.vShow,!$.value]]),O.createElementVNode("canvas",{id:"qrcode-stream-tracking-layer",ref_key:"trackingLayerRef",ref:g,style:k},null,512),O.createElementVNode("div",{style:k},[O.renderSlot(I.$slots,"default")])]))}}),$r=O.defineComponent({__name:"QrcodeCapture",props:{formats:{type:Array,default:()=>["qr_code"]}},emits:["detect"],setup(r,{emit:o}){const i=r,c=o,l=h=>{if(!(!(h.target instanceof HTMLInputElement)||!h.target.files))for(const v of Array.from(h.target.files))or(v,i.formats).then(g=>{c("detect",g)})};return(h,v)=>(O.openBlock(),O.createElementBlock("input",{onChange:l,type:"file",name:"image",accept:"image/*",capture:"environment",multiple:""},null,32))}}),_r=O.defineComponent({__name:"QrcodeDropZone",props:{formats:{type:Array,default:()=>["qr_code"]}},emits:["detect","dragover","error"],setup(r,{emit:o}){const i=r,c=o,l=async g=>{try{const b=await g;c("detect",b)}catch(b){c("error",b)}},h=g=>{c("dragover",g)},v=({dataTransfer:g})=>{if(!g)return;h(!1);const b=[...Array.from(g.files)],p=g.getData("text/uri-list");b.forEach(C=>{l(or(C,i.formats))}),p!==""&&l(jn(p,i.formats))};return(g,b)=>(O.openBlock(),O.createElementBlock("div",{onDrop:O.withModifiers(v,["prevent","stop"]),onDragenter:b[0]||(b[0]=O.withModifiers(p=>h(!0),["prevent","stop"])),onDragleave:b[1]||(b[1]=O.withModifiers(p=>h(!1),["prevent","stop"])),onDragover:b[2]||(b[2]=O.withModifiers(()=>{},["prevent","stop"]))},[O.renderSlot(g.$slots,"default")],32))}});function Sr(r){r.component("qrcode-stream",Cr),r.component("qrcode-capture",$r),r.component("qrcode-drop-zone",_r)}const ga={install:Sr};ee.QrcodeCapture=$r,ee.QrcodeDropZone=_r,ee.QrcodeStream=Cr,ee.VueQrcodeReader=ga,ee.install=Sr,ee.setZXingModuleOverrides=Dn,Object.defineProperty(ee,Symbol.toStringTag,{value:"Module"})}); diff --git a/package-lock.json b/package-lock.json index 4c3804473..b5689241f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1320,9 +1320,10 @@ } }, "node_modules/vue-qrcode-reader": { - "version": "5.5.10", - "resolved": "https://registry.npmjs.org/vue-qrcode-reader/-/vue-qrcode-reader-5.5.10.tgz", - "integrity": "sha512-lj83FKqRyvo0VLMu49wrLsaHueonfXcwyX9r/GDw0y+myOY5xTfsl75hjBgmmByAxzFSlCPI+CGA9FxYVtRAFQ==", + "version": "5.5.11", + "resolved": "https://registry.npmjs.org/vue-qrcode-reader/-/vue-qrcode-reader-5.5.11.tgz", + "integrity": "sha512-Ec/bVML1jgxSX+usbgdcXGhOFEFo4EzApCO2CNT1YK0Dcb0Mp7ASygz78RJJs22SU2oI7vz9iJDyr4ucSDTvjQ==", + "license": "MIT", "dependencies": { "barcode-detector": "2.2.2", "webrtc-adapter": "8.2.3"