import{f as _i,g as mg,b as ln,j as _,u as wg,h as Ag,a as Cg,r as Go,c as Or,H as Fc}from"./app-CyJEXGyv.js";import{P as Uc}from"./pagination-7aOfsluw.js";import{B as ft}from"./button-COEJSQkW.js";import{D as Dr,a as Rr,b as Wr,c as li,e as Ua}from"./dialog-C64V63Fe.js";import{I as Gt}from"./input-De4RhZu7.js";import{L as Ot}from"./label-CPJPVYbz.js";import{S as Hs,a as zs,b as Ws,c as Gs,d as Lr,C as Eg}from"./select-787Dhddj.js";import{T as Vo}from"./textarea-DvQSk7nC.js";import jc from"./PosLayout-ClIP-uS3.js";import{t as kt}from"./index-BtT9Eyya.js";import{C as yg,d as Ig}from"./card-BjOMVxEn.js";import{u as bg,B as _g}from"./bluetooth-context-DlC5mQaA.js";import{S as Sg}from"./save-5G4mHmGr.js";import{U as Tg}from"./user-Dxck7nX0.js";import{S as Yo,a as Ng,T as vg}from"./truck-DSNzHzca.js";import{c as Xs}from"./createLucideIcon-DqnlFWer.js";import{C as Mg}from"./circle-check-CCTdTOzE.js";import{P as Og}from"./printer-CuwumXsm.js";import{E as Dg}from"./eraser-BsAKWmwM.js";import"./chevron-left-O9iIxqlL.js";import"./index-D448AvbX.js";import"./utils-D3rN0LeJ.js";import"./index-JbHgsFAK.js";import"./index-BiS8IM9B.js";import"./x-CEXz2EER.js";import"./index-l-_2VD5G.js";import"./index-CeYyXWc4.js";import"./chevron-down-CelnyKCC.js";import"./Navbar-Dv5VT9ra.js";import"./boxes-Vdy2runQ.js";import"./shopping-bag-kX2qM3ec.js";import"./utensils-DVq7Up9p.js";import"./sonner-DMUJNVEP.js";function Rg(x,g){for(var f=0;f<g.length;f++){const y=g[f];if(typeof y!="string"&&!Array.isArray(y)){for(const S in y)if(S!=="default"&&!(S in x)){const m=Object.getOwnPropertyDescriptor(y,S);m&&Object.defineProperty(x,S,m.get?m:{enumerable:!0,get:()=>y[S]})}}}return Object.freeze(Object.defineProperty(x,Symbol.toStringTag,{value:"Module"}))}/**
 * @license lucide-react v0.475.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Lg=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}],["path",{d:"M7 20.662V19a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v1.662",key:"154egf"}]],Bg=Xs("CircleUser",Lg);/**
 * @license lucide-react v0.475.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Pg=[["path",{d:"M10 13V7",key:"1u13u9"}],["path",{d:"M14 13V7",key:"1vj9om"}],["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["path",{d:"M12 17v4",key:"1riwvh"}],["path",{d:"M8 21h8",key:"1ev6f3"}]],kg=Xs("MonitorPause",Pg);/**
 * @license lucide-react v0.475.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Fg=[["path",{d:"M3 7V5a2 2 0 0 1 2-2h2",key:"aa7l1z"}],["path",{d:"M17 3h2a2 2 0 0 1 2 2v2",key:"4qcy5o"}],["path",{d:"M21 17v2a2 2 0 0 1-2 2h-2",key:"6vwrx8"}],["path",{d:"M7 21H5a2 2 0 0 1-2-2v-2",key:"ioqczr"}],["path",{d:"M8 7v10",key:"23sfjj"}],["path",{d:"M12 7v10",key:"jspqdw"}],["path",{d:"M17 7v10",key:"578dap"}]],Hc=Xs("ScanBarcode",Fg);/**
 * @license lucide-react v0.475.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Ug=[["path",{d:"M16 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V8Z",key:"qazsjp"}],["path",{d:"M15 3v4a2 2 0 0 0 2 2h4",key:"40519r"}]],jg=Xs("StickyNote",Ug);/**
 * @license lucide-react v0.475.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Hg=[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]],zg=Xs("Trash2",Hg);var Vs={exports:{}};/**
 * @license
 * Lodash <https://lodash.com/>
 * Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
 * Released under MIT license <https://lodash.com/license>
 * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
 * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
 */var Wg=Vs.exports,zc;function Gg(){return zc||(zc=1,(function(x,g){(function(){var f,y="4.17.21",S=200,m="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",F="Expected a function",W="Invalid `variable` option passed into `_.template`",Z="__lodash_hash_undefined__",T=500,z="__lodash_placeholder__",H=1,Le=2,Ee=4,ct=1,ge=2,Ue=1,yt=2,Ye=4,fe=8,_e=16,It=32,Be=64,re=128,Ge=256,ie=512,Pr=30,en="...",ye=800,rt=16,Mt=1,v=2,te=3,Te=1/0,bn=9007199254740991,Qn=17976931348623157e292,xn=NaN,pn=4294967295,qt=pn-1,Wn=pn>>>1,Ft=[["ary",re],["bind",Ue],["bindKey",yt],["curry",fe],["curryRight",_e],["flip",ie],["partial",It],["partialRight",Be],["rearg",Ge]],Rn="[object Arguments]",me="[object Array]",Ti="[object AsyncFunction]",gt="[object Boolean]",cn="[object Date]",Ln="[object DOMException]",Yt="[object Error]",Ar="[object Function]",$e="[object GeneratorFunction]",Qt="[object Map]",un="[object Number]",Vr="[object Null]",ht="[object Object]",ut="[object Promise]",Ke="[object Proxy]",lr="[object RegExp]",le="[object Set]",cr="[object String]",Yr="[object Symbol]",Gn="[object Undefined]",Cr="[object WeakMap]",Bn="[object WeakSet]",mn="[object ArrayBuffer]",wn="[object DataView]",Tt="[object Float32Array]",Rt="[object Float64Array]",Er="[object Int8Array]",Ni="[object Int16Array]",Nt="[object Int32Array]",ae="[object Uint8Array]",bt="[object Uint8ClampedArray]",it="[object Uint16Array]",xt="[object Uint32Array]",Xr=/\b__p \+= '';/g,vi=/\b(__p \+=) '' \+/g,Qi=/(__e\(.*?\)|\b__t\)) \+\n'';/g,qe=/&(?:amp|lt|gt|quot|#39);/g,Jn=/[&<>"']/g,Mi=RegExp(qe.source),Oi=RegExp(Jn.source),_n=/<%-([\s\S]+?)%>/g,ui=/<%([\s\S]+?)%>/g,jt=/<%=([\s\S]+?)%>/g,yr=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Zr=/^\w*$/,Pn=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,fi=/[\\^$.*+?()[\]{}|]/g,ur=RegExp(fi.source),kr=/^\s+/,tn=/\s/,fr=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,An=/\{\n\/\* \[wrapped with (.+)\] \*/,ue=/,? & /,Ir=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,hi=/[()=,{}\[\]\/\s]/,nn=/\\(\\)?/g,br=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,Fr=/\w*$/,I=/^[-+]0x[0-9a-f]+$/i,Y=/^0b[01]+$/i,ne=/^\[object .+?Constructor\]$/,X=/^0o[0-7]+$/i,oe=/^(?:0|[1-9]\d*)$/,de=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,se=/($^)/,Ze=/['\n\r\u2028\u2029\\]/g,De="\\ud800-\\udfff",ze="\\u0300-\\u036f",V="\\ufe20-\\ufe2f",st="\\u20d0-\\u20ff",pe=ze+V+st,at="\\u2700-\\u27bf",Cn="a-z\\xdf-\\xf6\\xf8-\\xff",Se="\\xac\\xb1\\xd7\\xf7",je="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Ce="\\u2000-\\u206f",En=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Vn="A-Z\\xc0-\\xd6\\xd8-\\xde",Sn="\\ufe0e\\ufe0f",Ct=Se+je+Ce+En,kn="['’]",xs="["+De+"]",Et="["+Ct+"]",Tn="["+pe+"]",Ji="\\d+",di="["+at+"]",pt="["+Cn+"]",rn="[^"+De+Ct+Ji+at+Cn+Vn+"]",j="\\ud83c[\\udffb-\\udfff]",R="(?:"+Tn+"|"+j+")",Ae="[^"+De+"]",Ht="(?:\\ud83c[\\udde6-\\uddff]){2}",Nn="[\\ud800-\\udbff][\\udc00-\\udfff]",gi="["+Vn+"]",$i="\\u200d",Fn="(?:"+pt+"|"+rn+")",Ie="(?:"+gi+"|"+rn+")",vt="(?:"+kn+"(?:d|ll|m|re|s|t|ve))?",ps="(?:"+kn+"(?:D|LL|M|RE|S|T|VE))?",Zs=R+"?",es="["+Sn+"]?",ts="(?:"+$i+"(?:"+[Ae,Ht,Nn].join("|")+")"+es+Zs+")*",ms="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",za="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",Xt=es+Zs+ts,Di="(?:"+[di,Ht,Nn].join("|")+")"+Xt,Ur="(?:"+[Ae+Tn+"?",Tn,Ht,Nn,xs].join("|")+")",Ne=RegExp(kn,"g"),Wa=RegExp(Tn,"g"),ke=RegExp(j+"(?="+j+")|"+Ur+Xt,"g"),sn=RegExp([gi+"?"+pt+"+"+vt+"(?="+[Et,gi,"$"].join("|")+")",Ie+"+"+ps+"(?="+[Et,gi+Fn,"$"].join("|")+")",gi+"?"+Fn+"+"+vt,gi+"+"+ps,za,ms,Ji,Di].join("|"),"g"),Ga=RegExp("["+$i+De+pe+Sn+"]"),ws=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,Ks=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],Kr=-1,_t={};_t[Tt]=_t[Rt]=_t[Er]=_t[Ni]=_t[Nt]=_t[ae]=_t[bt]=_t[it]=_t[xt]=!0,_t[Rn]=_t[me]=_t[mn]=_t[gt]=_t[wn]=_t[cn]=_t[Yt]=_t[Ar]=_t[Qt]=_t[un]=_t[ht]=_t[lr]=_t[le]=_t[cr]=_t[Cr]=!1;var ot={};ot[Rn]=ot[me]=ot[mn]=ot[wn]=ot[gt]=ot[cn]=ot[Tt]=ot[Rt]=ot[Er]=ot[Ni]=ot[Nt]=ot[Qt]=ot[un]=ot[ht]=ot[lr]=ot[le]=ot[cr]=ot[Yr]=ot[ae]=ot[bt]=ot[it]=ot[xt]=!0,ot[Yt]=ot[Ar]=ot[Cr]=!1;var Ri={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",Ĳ:"IJ",ĳ:"ij",Œ:"Oe",œ:"oe",ŉ:"'n",ſ:"s"},Li={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},qs={"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"},Bi={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Pi=parseFloat,vn=parseInt,As=typeof _i=="object"&&_i&&_i.Object===Object&&_i,Qs=typeof self=="object"&&self&&self.Object===Object&&self,Jt=As||Qs||Function("return this")(),Cs=g&&!g.nodeType&&g,qr=Cs&&!0&&x&&!x.nodeType&&x,Js=qr&&qr.exports===Cs,lt=Js&&As.process,Un=(function(){try{var E=qr&&qr.require&&qr.require("util").types;return E||lt&&lt.binding&&lt.binding("util")}catch{}})(),ki=Un&&Un.isArrayBuffer,_r=Un&&Un.isDate,$s=Un&&Un.isMap,G=Un&&Un.isRegExp,He=Un&&Un.isSet,$t=Un&&Un.isTypedArray;function fn(E,M,D){switch(D.length){case 0:return E.call(M);case 1:return E.call(M,D[0]);case 2:return E.call(M,D[0],D[1]);case 3:return E.call(M,D[0],D[1],D[2])}return E.apply(M,D)}function ea(E,M,D,P){for(var K=-1,q=E==null?0:E.length;++K<q;){var Q=E[K];M(P,Q,D(Q),E)}return P}function Yn(E,M){for(var D=-1,P=E==null?0:E.length;++D<P&&M(E[D],D,E)!==!1;);return E}function Va(E,M){for(var D=E==null?0:E.length;D--&&M(E[D],D,E)!==!1;);return E}function ta(E,M){for(var D=-1,P=E==null?0:E.length;++D<P;)if(!M(E[D],D,E))return!1;return!0}function hr(E,M){for(var D=-1,P=E==null?0:E.length,K=0,q=[];++D<P;){var Q=E[D];M(Q,D,E)&&(q[K++]=Q)}return q}function Lt(E,M){var D=E==null?0:E.length;return!!D&&yn(E,M,0)>-1}function Fi(E,M,D){for(var P=-1,K=E==null?0:E.length;++P<K;)if(D(M,E[P]))return!0;return!1}function Re(E,M){for(var D=-1,P=E==null?0:E.length,K=Array(P);++D<P;)K[D]=M(E[D],D,E);return K}function $n(E,M){for(var D=-1,P=M.length,K=E.length;++D<P;)E[K+D]=M[D];return E}function Sr(E,M,D,P){var K=-1,q=E==null?0:E.length;for(P&&q&&(D=E[++K]);++K<q;)D=M(D,E[K],K,E);return D}function mt(E,M,D,P){var K=E==null?0:E.length;for(P&&K&&(D=E[--K]);K--;)D=M(D,E[K],K,E);return D}function be(E,M){for(var D=-1,P=E==null?0:E.length;++D<P;)if(M(E[D],D,E))return!0;return!1}var Ya=is("length");function St(E){return E.split("")}function Qr(E){return E.match(Ir)||[]}function Jr(E,M,D){var P;return D(E,function(K,q,Q){if(M(K,q,Q))return P=q,!1}),P}function ns(E,M,D,P){for(var K=E.length,q=D+(P?1:-1);P?q--:++q<K;)if(M(E[q],q,E))return q;return-1}function yn(E,M,D){return M===M?n(E,M,D):ns(E,ys,D)}function Es(E,M,D,P){for(var K=D-1,q=E.length;++K<q;)if(P(E[K],M))return K;return-1}function ys(E){return E!==E}function rs(E,M){var D=E==null?0:E.length;return D?Ui(E,M)/D:xn}function is(E){return function(M){return M==null?f:M[E]}}function ss(E){return function(M){return E==null?f:E[M]}}function na(E,M,D,P,K){return K(E,function(q,Q,xe){D=P?(P=!1,q):M(D,q,Q,xe)}),D}function xi(E,M){var D=E.length;for(E.sort(M);D--;)E[D]=E[D].value;return E}function Ui(E,M){for(var D,P=-1,K=E.length;++P<K;){var q=M(E[P]);q!==f&&(D=D===f?q:D+q)}return D}function Is(E,M){for(var D=-1,P=Array(E);++D<E;)P[D]=M(D);return P}function ji(E,M){return Re(M,function(D){return[D,E[D]]})}function ra(E){return E&&E.slice(0,l(E)+1).replace(kr,"")}function zt(E){return function(M){return E(M)}}function pi(E,M){return Re(M,function(D){return E[D]})}function hn(E,M){return E.has(M)}function bs(E,M){for(var D=-1,P=E.length;++D<P&&yn(M,E[D],0)>-1;);return D}function er(E,M){for(var D=E.length;D--&&yn(M,E[D],0)>-1;);return D}function Xa(E,M){for(var D=E.length,P=0;D--;)E[D]===M&&++P;return P}var _s=ss(Ri),Za=ss(Li);function ia(E){return"\\"+Bi[E]}function dr(E,M){return E==null?f:E[M]}function mi(E){return Ga.test(E)}function Ss(E){return ws.test(E)}function Hi(E){for(var M,D=[];!(M=E.next()).done;)D.push(M.value);return D}function Qe(E){var M=-1,D=Array(E.size);return E.forEach(function(P,K){D[++M]=[K,P]}),D}function zi(E,M){return function(D){return E(M(D))}}function w(E,M){for(var D=-1,P=E.length,K=0,q=[];++D<P;){var Q=E[D];(Q===M||Q===z)&&(E[D]=z,q[K++]=D)}return q}function e(E){var M=-1,D=Array(E.size);return E.forEach(function(P){D[++M]=P}),D}function t(E){var M=-1,D=Array(E.size);return E.forEach(function(P){D[++M]=[P,P]}),D}function n(E,M,D){for(var P=D-1,K=E.length;++P<K;)if(E[P]===M)return P;return-1}function i(E,M,D){for(var P=D+1;P--;)if(E[P]===M)return P;return P}function s(E){return mi(E)?h(E):Ya(E)}function o(E){return mi(E)?p(E):St(E)}function l(E){for(var M=E.length;M--&&tn.test(E.charAt(M)););return M}var u=ss(qs);function h(E){for(var M=ke.lastIndex=0;ke.test(E);)++M;return M}function p(E){return E.match(ke)||[]}function A(E){return E.match(sn)||[]}var b=(function E(M){M=M==null?Jt:L.defaults(Jt.Object(),M,L.pick(Jt,Ks));var D=M.Array,P=M.Date,K=M.Error,q=M.Function,Q=M.Math,xe=M.Object,Pe=M.RegExp,Mn=M.String,Bt=M.TypeError,an=D.prototype,wt=q.prototype,Pt=xe.prototype,dn=M["__core-js_shared__"],Tr=wt.toString,et=Pt.hasOwnProperty,Ka=0,sa=(function(){var r=/[^.]+$/.exec(dn&&dn.keys&&dn.keys.IE_PROTO||"");return r?"Symbol(src)_1."+r:""})(),aa=Pt.toString,hu=Tr.call(xe),du=Jt._,gu=Pe("^"+Tr.call(et).replace(fi,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),oa=Js?M.Buffer:f,wi=M.Symbol,la=M.Uint8Array,qo=oa?oa.allocUnsafe:f,ca=zi(xe.getPrototypeOf,xe),Qo=xe.create,Jo=Pt.propertyIsEnumerable,ua=an.splice,$o=wi?wi.isConcatSpreadable:f,Ts=wi?wi.iterator:f,Wi=wi?wi.toStringTag:f,fa=(function(){try{var r=Zi(xe,"defineProperty");return r({},"",{}),r}catch{}})(),xu=M.clearTimeout!==Jt.clearTimeout&&M.clearTimeout,pu=P&&P.now!==Jt.Date.now&&P.now,mu=M.setTimeout!==Jt.setTimeout&&M.setTimeout,ha=Q.ceil,da=Q.floor,qa=xe.getOwnPropertySymbols,wu=oa?oa.isBuffer:f,el=M.isFinite,Au=an.join,Cu=zi(xe.keys,xe),on=Q.max,On=Q.min,Eu=P.now,yu=M.parseInt,tl=Q.random,Iu=an.reverse,Qa=Zi(M,"DataView"),Ns=Zi(M,"Map"),Ja=Zi(M,"Promise"),as=Zi(M,"Set"),vs=Zi(M,"WeakMap"),Ms=Zi(xe,"create"),ga=vs&&new vs,os={},bu=Ki(Qa),_u=Ki(Ns),Su=Ki(Ja),Tu=Ki(as),Nu=Ki(vs),xa=wi?wi.prototype:f,Os=xa?xa.valueOf:f,nl=xa?xa.toString:f;function N(r){if(Wt(r)&&!Fe(r)&&!(r instanceof tt)){if(r instanceof gr)return r;if(et.call(r,"__wrapped__"))return rc(r)}return new gr(r)}var ls=(function(){function r(){}return function(a){if(!Ut(a))return{};if(Qo)return Qo(a);r.prototype=a;var c=new r;return r.prototype=f,c}})();function pa(){}function gr(r,a){this.__wrapped__=r,this.__actions__=[],this.__chain__=!!a,this.__index__=0,this.__values__=f}N.templateSettings={escape:_n,evaluate:ui,interpolate:jt,variable:"",imports:{_:N}},N.prototype=pa.prototype,N.prototype.constructor=N,gr.prototype=ls(pa.prototype),gr.prototype.constructor=gr;function tt(r){this.__wrapped__=r,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=pn,this.__views__=[]}function vu(){var r=new tt(this.__wrapped__);return r.__actions__=Xn(this.__actions__),r.__dir__=this.__dir__,r.__filtered__=this.__filtered__,r.__iteratees__=Xn(this.__iteratees__),r.__takeCount__=this.__takeCount__,r.__views__=Xn(this.__views__),r}function Mu(){if(this.__filtered__){var r=new tt(this);r.__dir__=-1,r.__filtered__=!0}else r=this.clone(),r.__dir__*=-1;return r}function Ou(){var r=this.__wrapped__.value(),a=this.__dir__,c=Fe(r),d=a<0,C=c?r.length:0,O=W1(0,C,this.__views__),B=O.start,k=O.end,U=k-B,J=d?k:B-1,$=this.__iteratees__,ee=$.length,ce=0,we=On(U,this.__takeCount__);if(!c||!d&&C==U&&we==U)return Sl(r,this.__actions__);var Me=[];e:for(;U--&&ce<we;){J+=a;for(var Ve=-1,Oe=r[J];++Ve<ee;){var Je=$[Ve],nt=Je.iteratee,rr=Je.type,zn=nt(Oe);if(rr==v)Oe=zn;else if(!zn){if(rr==Mt)continue e;break e}}Me[ce++]=Oe}return Me}tt.prototype=ls(pa.prototype),tt.prototype.constructor=tt;function Gi(r){var a=-1,c=r==null?0:r.length;for(this.clear();++a<c;){var d=r[a];this.set(d[0],d[1])}}function Du(){this.__data__=Ms?Ms(null):{},this.size=0}function Ru(r){var a=this.has(r)&&delete this.__data__[r];return this.size-=a?1:0,a}function Lu(r){var a=this.__data__;if(Ms){var c=a[r];return c===Z?f:c}return et.call(a,r)?a[r]:f}function Bu(r){var a=this.__data__;return Ms?a[r]!==f:et.call(a,r)}function Pu(r,a){var c=this.__data__;return this.size+=this.has(r)?0:1,c[r]=Ms&&a===f?Z:a,this}Gi.prototype.clear=Du,Gi.prototype.delete=Ru,Gi.prototype.get=Lu,Gi.prototype.has=Bu,Gi.prototype.set=Pu;function $r(r){var a=-1,c=r==null?0:r.length;for(this.clear();++a<c;){var d=r[a];this.set(d[0],d[1])}}function ku(){this.__data__=[],this.size=0}function Fu(r){var a=this.__data__,c=ma(a,r);if(c<0)return!1;var d=a.length-1;return c==d?a.pop():ua.call(a,c,1),--this.size,!0}function Uu(r){var a=this.__data__,c=ma(a,r);return c<0?f:a[c][1]}function ju(r){return ma(this.__data__,r)>-1}function Hu(r,a){var c=this.__data__,d=ma(c,r);return d<0?(++this.size,c.push([r,a])):c[d][1]=a,this}$r.prototype.clear=ku,$r.prototype.delete=Fu,$r.prototype.get=Uu,$r.prototype.has=ju,$r.prototype.set=Hu;function ei(r){var a=-1,c=r==null?0:r.length;for(this.clear();++a<c;){var d=r[a];this.set(d[0],d[1])}}function zu(){this.size=0,this.__data__={hash:new Gi,map:new(Ns||$r),string:new Gi}}function Wu(r){var a=va(this,r).delete(r);return this.size-=a?1:0,a}function Gu(r){return va(this,r).get(r)}function Vu(r){return va(this,r).has(r)}function Yu(r,a){var c=va(this,r),d=c.size;return c.set(r,a),this.size+=c.size==d?0:1,this}ei.prototype.clear=zu,ei.prototype.delete=Wu,ei.prototype.get=Gu,ei.prototype.has=Vu,ei.prototype.set=Yu;function Vi(r){var a=-1,c=r==null?0:r.length;for(this.__data__=new ei;++a<c;)this.add(r[a])}function Xu(r){return this.__data__.set(r,Z),this}function Zu(r){return this.__data__.has(r)}Vi.prototype.add=Vi.prototype.push=Xu,Vi.prototype.has=Zu;function Nr(r){var a=this.__data__=new $r(r);this.size=a.size}function Ku(){this.__data__=new $r,this.size=0}function qu(r){var a=this.__data__,c=a.delete(r);return this.size=a.size,c}function Qu(r){return this.__data__.get(r)}function Ju(r){return this.__data__.has(r)}function $u(r,a){var c=this.__data__;if(c instanceof $r){var d=c.__data__;if(!Ns||d.length<S-1)return d.push([r,a]),this.size=++c.size,this;c=this.__data__=new ei(d)}return c.set(r,a),this.size=c.size,this}Nr.prototype.clear=Ku,Nr.prototype.delete=qu,Nr.prototype.get=Qu,Nr.prototype.has=Ju,Nr.prototype.set=$u;function rl(r,a){var c=Fe(r),d=!c&&qi(r),C=!c&&!d&&Ii(r),O=!c&&!d&&!C&&hs(r),B=c||d||C||O,k=B?Is(r.length,Mn):[],U=k.length;for(var J in r)(a||et.call(r,J))&&!(B&&(J=="length"||C&&(J=="offset"||J=="parent")||O&&(J=="buffer"||J=="byteLength"||J=="byteOffset")||ii(J,U)))&&k.push(J);return k}function il(r){var a=r.length;return a?r[co(0,a-1)]:f}function e1(r,a){return Ma(Xn(r),Yi(a,0,r.length))}function t1(r){return Ma(Xn(r))}function $a(r,a,c){(c!==f&&!vr(r[a],c)||c===f&&!(a in r))&&ti(r,a,c)}function Ds(r,a,c){var d=r[a];(!(et.call(r,a)&&vr(d,c))||c===f&&!(a in r))&&ti(r,a,c)}function ma(r,a){for(var c=r.length;c--;)if(vr(r[c][0],a))return c;return-1}function n1(r,a,c,d){return Ai(r,function(C,O,B){a(d,C,c(C),B)}),d}function sl(r,a){return r&&Hr(a,gn(a),r)}function r1(r,a){return r&&Hr(a,Kn(a),r)}function ti(r,a,c){a=="__proto__"&&fa?fa(r,a,{configurable:!0,enumerable:!0,value:c,writable:!0}):r[a]=c}function eo(r,a){for(var c=-1,d=a.length,C=D(d),O=r==null;++c<d;)C[c]=O?f:Bo(r,a[c]);return C}function Yi(r,a,c){return r===r&&(c!==f&&(r=r<=c?r:c),a!==f&&(r=r>=a?r:a)),r}function xr(r,a,c,d,C,O){var B,k=a&H,U=a&Le,J=a&Ee;if(c&&(B=C?c(r,d,C,O):c(r)),B!==f)return B;if(!Ut(r))return r;var $=Fe(r);if($){if(B=V1(r),!k)return Xn(r,B)}else{var ee=Dn(r),ce=ee==Ar||ee==$e;if(Ii(r))return vl(r,k);if(ee==ht||ee==Rn||ce&&!C){if(B=U||ce?{}:Zl(r),!k)return U?L1(r,r1(B,r)):R1(r,sl(B,r))}else{if(!ot[ee])return C?r:{};B=Y1(r,ee,k)}}O||(O=new Nr);var we=O.get(r);if(we)return we;O.set(r,B),Ic(r)?r.forEach(function(Oe){B.add(xr(Oe,a,c,Oe,r,O))}):Ec(r)&&r.forEach(function(Oe,Je){B.set(Je,xr(Oe,a,c,Je,r,O))});var Me=J?U?Eo:Co:U?Kn:gn,Ve=$?f:Me(r);return Yn(Ve||r,function(Oe,Je){Ve&&(Je=Oe,Oe=r[Je]),Ds(B,Je,xr(Oe,a,c,Je,r,O))}),B}function i1(r){var a=gn(r);return function(c){return al(c,r,a)}}function al(r,a,c){var d=c.length;if(r==null)return!d;for(r=xe(r);d--;){var C=c[d],O=a[C],B=r[C];if(B===f&&!(C in r)||!O(B))return!1}return!0}function ol(r,a,c){if(typeof r!="function")throw new Bt(F);return Us(function(){r.apply(f,c)},a)}function Rs(r,a,c,d){var C=-1,O=Lt,B=!0,k=r.length,U=[],J=a.length;if(!k)return U;c&&(a=Re(a,zt(c))),d?(O=Fi,B=!1):a.length>=S&&(O=hn,B=!1,a=new Vi(a));e:for(;++C<k;){var $=r[C],ee=c==null?$:c($);if($=d||$!==0?$:0,B&&ee===ee){for(var ce=J;ce--;)if(a[ce]===ee)continue e;U.push($)}else O(a,ee,d)||U.push($)}return U}var Ai=Ll(jr),ll=Ll(no,!0);function s1(r,a){var c=!0;return Ai(r,function(d,C,O){return c=!!a(d,C,O),c}),c}function wa(r,a,c){for(var d=-1,C=r.length;++d<C;){var O=r[d],B=a(O);if(B!=null&&(k===f?B===B&&!nr(B):c(B,k)))var k=B,U=O}return U}function a1(r,a,c,d){var C=r.length;for(c=We(c),c<0&&(c=-c>C?0:C+c),d=d===f||d>C?C:We(d),d<0&&(d+=C),d=c>d?0:_c(d);c<d;)r[c++]=a;return r}function cl(r,a){var c=[];return Ai(r,function(d,C,O){a(d,C,O)&&c.push(d)}),c}function In(r,a,c,d,C){var O=-1,B=r.length;for(c||(c=Z1),C||(C=[]);++O<B;){var k=r[O];a>0&&c(k)?a>1?In(k,a-1,c,d,C):$n(C,k):d||(C[C.length]=k)}return C}var to=Bl(),ul=Bl(!0);function jr(r,a){return r&&to(r,a,gn)}function no(r,a){return r&&ul(r,a,gn)}function Aa(r,a){return hr(a,function(c){return si(r[c])})}function Xi(r,a){a=Ei(a,r);for(var c=0,d=a.length;r!=null&&c<d;)r=r[zr(a[c++])];return c&&c==d?r:f}function fl(r,a,c){var d=a(r);return Fe(r)?d:$n(d,c(r))}function jn(r){return r==null?r===f?Gn:Vr:Wi&&Wi in xe(r)?z1(r):t0(r)}function ro(r,a){return r>a}function o1(r,a){return r!=null&&et.call(r,a)}function l1(r,a){return r!=null&&a in xe(r)}function c1(r,a,c){return r>=On(a,c)&&r<on(a,c)}function io(r,a,c){for(var d=c?Fi:Lt,C=r[0].length,O=r.length,B=O,k=D(O),U=1/0,J=[];B--;){var $=r[B];B&&a&&($=Re($,zt(a))),U=On($.length,U),k[B]=!c&&(a||C>=120&&$.length>=120)?new Vi(B&&$):f}$=r[0];var ee=-1,ce=k[0];e:for(;++ee<C&&J.length<U;){var we=$[ee],Me=a?a(we):we;if(we=c||we!==0?we:0,!(ce?hn(ce,Me):d(J,Me,c))){for(B=O;--B;){var Ve=k[B];if(!(Ve?hn(Ve,Me):d(r[B],Me,c)))continue e}ce&&ce.push(Me),J.push(we)}}return J}function u1(r,a,c,d){return jr(r,function(C,O,B){a(d,c(C),O,B)}),d}function Ls(r,a,c){a=Ei(a,r),r=Jl(r,a);var d=r==null?r:r[zr(mr(a))];return d==null?f:fn(d,r,c)}function hl(r){return Wt(r)&&jn(r)==Rn}function f1(r){return Wt(r)&&jn(r)==mn}function h1(r){return Wt(r)&&jn(r)==cn}function Bs(r,a,c,d,C){return r===a?!0:r==null||a==null||!Wt(r)&&!Wt(a)?r!==r&&a!==a:d1(r,a,c,d,Bs,C)}function d1(r,a,c,d,C,O){var B=Fe(r),k=Fe(a),U=B?me:Dn(r),J=k?me:Dn(a);U=U==Rn?ht:U,J=J==Rn?ht:J;var $=U==ht,ee=J==ht,ce=U==J;if(ce&&Ii(r)){if(!Ii(a))return!1;B=!0,$=!1}if(ce&&!$)return O||(O=new Nr),B||hs(r)?Vl(r,a,c,d,C,O):j1(r,a,U,c,d,C,O);if(!(c&ct)){var we=$&&et.call(r,"__wrapped__"),Me=ee&&et.call(a,"__wrapped__");if(we||Me){var Ve=we?r.value():r,Oe=Me?a.value():a;return O||(O=new Nr),C(Ve,Oe,c,d,O)}}return ce?(O||(O=new Nr),H1(r,a,c,d,C,O)):!1}function g1(r){return Wt(r)&&Dn(r)==Qt}function so(r,a,c,d){var C=c.length,O=C,B=!d;if(r==null)return!O;for(r=xe(r);C--;){var k=c[C];if(B&&k[2]?k[1]!==r[k[0]]:!(k[0]in r))return!1}for(;++C<O;){k=c[C];var U=k[0],J=r[U],$=k[1];if(B&&k[2]){if(J===f&&!(U in r))return!1}else{var ee=new Nr;if(d)var ce=d(J,$,U,r,a,ee);if(!(ce===f?Bs($,J,ct|ge,d,ee):ce))return!1}}return!0}function dl(r){if(!Ut(r)||q1(r))return!1;var a=si(r)?gu:ne;return a.test(Ki(r))}function x1(r){return Wt(r)&&jn(r)==lr}function p1(r){return Wt(r)&&Dn(r)==le}function m1(r){return Wt(r)&&Pa(r.length)&&!!_t[jn(r)]}function gl(r){return typeof r=="function"?r:r==null?qn:typeof r=="object"?Fe(r)?ml(r[0],r[1]):pl(r):Pc(r)}function ao(r){if(!Fs(r))return Cu(r);var a=[];for(var c in xe(r))et.call(r,c)&&c!="constructor"&&a.push(c);return a}function w1(r){if(!Ut(r))return e0(r);var a=Fs(r),c=[];for(var d in r)d=="constructor"&&(a||!et.call(r,d))||c.push(d);return c}function oo(r,a){return r<a}function xl(r,a){var c=-1,d=Zn(r)?D(r.length):[];return Ai(r,function(C,O,B){d[++c]=a(C,O,B)}),d}function pl(r){var a=Io(r);return a.length==1&&a[0][2]?ql(a[0][0],a[0][1]):function(c){return c===r||so(c,r,a)}}function ml(r,a){return _o(r)&&Kl(a)?ql(zr(r),a):function(c){var d=Bo(c,r);return d===f&&d===a?Po(c,r):Bs(a,d,ct|ge)}}function Ca(r,a,c,d,C){r!==a&&to(a,function(O,B){if(C||(C=new Nr),Ut(O))A1(r,a,B,c,Ca,d,C);else{var k=d?d(To(r,B),O,B+"",r,a,C):f;k===f&&(k=O),$a(r,B,k)}},Kn)}function A1(r,a,c,d,C,O,B){var k=To(r,c),U=To(a,c),J=B.get(U);if(J){$a(r,c,J);return}var $=O?O(k,U,c+"",r,a,B):f,ee=$===f;if(ee){var ce=Fe(U),we=!ce&&Ii(U),Me=!ce&&!we&&hs(U);$=U,ce||we||Me?Fe(k)?$=k:Zt(k)?$=Xn(k):we?(ee=!1,$=vl(U,!0)):Me?(ee=!1,$=Ml(U,!0)):$=[]:js(U)||qi(U)?($=k,qi(k)?$=Sc(k):(!Ut(k)||si(k))&&($=Zl(U))):ee=!1}ee&&(B.set(U,$),C($,U,d,O,B),B.delete(U)),$a(r,c,$)}function wl(r,a){var c=r.length;if(c)return a+=a<0?c:0,ii(a,c)?r[a]:f}function Al(r,a,c){a.length?a=Re(a,function(O){return Fe(O)?function(B){return Xi(B,O.length===1?O[0]:O)}:O}):a=[qn];var d=-1;a=Re(a,zt(ve()));var C=xl(r,function(O,B,k){var U=Re(a,function(J){return J(O)});return{criteria:U,index:++d,value:O}});return xi(C,function(O,B){return D1(O,B,c)})}function C1(r,a){return Cl(r,a,function(c,d){return Po(r,d)})}function Cl(r,a,c){for(var d=-1,C=a.length,O={};++d<C;){var B=a[d],k=Xi(r,B);c(k,B)&&Ps(O,Ei(B,r),k)}return O}function E1(r){return function(a){return Xi(a,r)}}function lo(r,a,c,d){var C=d?Es:yn,O=-1,B=a.length,k=r;for(r===a&&(a=Xn(a)),c&&(k=Re(r,zt(c)));++O<B;)for(var U=0,J=a[O],$=c?c(J):J;(U=C(k,$,U,d))>-1;)k!==r&&ua.call(k,U,1),ua.call(r,U,1);return r}function El(r,a){for(var c=r?a.length:0,d=c-1;c--;){var C=a[c];if(c==d||C!==O){var O=C;ii(C)?ua.call(r,C,1):ho(r,C)}}return r}function co(r,a){return r+da(tl()*(a-r+1))}function y1(r,a,c,d){for(var C=-1,O=on(ha((a-r)/(c||1)),0),B=D(O);O--;)B[d?O:++C]=r,r+=c;return B}function uo(r,a){var c="";if(!r||a<1||a>bn)return c;do a%2&&(c+=r),a=da(a/2),a&&(r+=r);while(a);return c}function Xe(r,a){return No(Ql(r,a,qn),r+"")}function I1(r){return il(ds(r))}function b1(r,a){var c=ds(r);return Ma(c,Yi(a,0,c.length))}function Ps(r,a,c,d){if(!Ut(r))return r;a=Ei(a,r);for(var C=-1,O=a.length,B=O-1,k=r;k!=null&&++C<O;){var U=zr(a[C]),J=c;if(U==="__proto__"||U==="constructor"||U==="prototype")return r;if(C!=B){var $=k[U];J=d?d($,U,k):f,J===f&&(J=Ut($)?$:ii(a[C+1])?[]:{})}Ds(k,U,J),k=k[U]}return r}var yl=ga?function(r,a){return ga.set(r,a),r}:qn,_1=fa?function(r,a){return fa(r,"toString",{configurable:!0,enumerable:!1,value:Fo(a),writable:!0})}:qn;function S1(r){return Ma(ds(r))}function pr(r,a,c){var d=-1,C=r.length;a<0&&(a=-a>C?0:C+a),c=c>C?C:c,c<0&&(c+=C),C=a>c?0:c-a>>>0,a>>>=0;for(var O=D(C);++d<C;)O[d]=r[d+a];return O}function T1(r,a){var c;return Ai(r,function(d,C,O){return c=a(d,C,O),!c}),!!c}function Ea(r,a,c){var d=0,C=r==null?d:r.length;if(typeof a=="number"&&a===a&&C<=Wn){for(;d<C;){var O=d+C>>>1,B=r[O];B!==null&&!nr(B)&&(c?B<=a:B<a)?d=O+1:C=O}return C}return fo(r,a,qn,c)}function fo(r,a,c,d){var C=0,O=r==null?0:r.length;if(O===0)return 0;a=c(a);for(var B=a!==a,k=a===null,U=nr(a),J=a===f;C<O;){var $=da((C+O)/2),ee=c(r[$]),ce=ee!==f,we=ee===null,Me=ee===ee,Ve=nr(ee);if(B)var Oe=d||Me;else J?Oe=Me&&(d||ce):k?Oe=Me&&ce&&(d||!we):U?Oe=Me&&ce&&!we&&(d||!Ve):we||Ve?Oe=!1:Oe=d?ee<=a:ee<a;Oe?C=$+1:O=$}return On(O,qt)}function Il(r,a){for(var c=-1,d=r.length,C=0,O=[];++c<d;){var B=r[c],k=a?a(B):B;if(!c||!vr(k,U)){var U=k;O[C++]=B===0?0:B}}return O}function bl(r){return typeof r=="number"?r:nr(r)?xn:+r}function tr(r){if(typeof r=="string")return r;if(Fe(r))return Re(r,tr)+"";if(nr(r))return nl?nl.call(r):"";var a=r+"";return a=="0"&&1/r==-Te?"-0":a}function Ci(r,a,c){var d=-1,C=Lt,O=r.length,B=!0,k=[],U=k;if(c)B=!1,C=Fi;else if(O>=S){var J=a?null:F1(r);if(J)return e(J);B=!1,C=hn,U=new Vi}else U=a?[]:k;e:for(;++d<O;){var $=r[d],ee=a?a($):$;if($=c||$!==0?$:0,B&&ee===ee){for(var ce=U.length;ce--;)if(U[ce]===ee)continue e;a&&U.push(ee),k.push($)}else C(U,ee,c)||(U!==k&&U.push(ee),k.push($))}return k}function ho(r,a){return a=Ei(a,r),r=Jl(r,a),r==null||delete r[zr(mr(a))]}function _l(r,a,c,d){return Ps(r,a,c(Xi(r,a)),d)}function ya(r,a,c,d){for(var C=r.length,O=d?C:-1;(d?O--:++O<C)&&a(r[O],O,r););return c?pr(r,d?0:O,d?O+1:C):pr(r,d?O+1:0,d?C:O)}function Sl(r,a){var c=r;return c instanceof tt&&(c=c.value()),Sr(a,function(d,C){return C.func.apply(C.thisArg,$n([d],C.args))},c)}function go(r,a,c){var d=r.length;if(d<2)return d?Ci(r[0]):[];for(var C=-1,O=D(d);++C<d;)for(var B=r[C],k=-1;++k<d;)k!=C&&(O[C]=Rs(O[C]||B,r[k],a,c));return Ci(In(O,1),a,c)}function Tl(r,a,c){for(var d=-1,C=r.length,O=a.length,B={};++d<C;){var k=d<O?a[d]:f;c(B,r[d],k)}return B}function xo(r){return Zt(r)?r:[]}function po(r){return typeof r=="function"?r:qn}function Ei(r,a){return Fe(r)?r:_o(r,a)?[r]:nc(dt(r))}var N1=Xe;function yi(r,a,c){var d=r.length;return c=c===f?d:c,!a&&c>=d?r:pr(r,a,c)}var Nl=xu||function(r){return Jt.clearTimeout(r)};function vl(r,a){if(a)return r.slice();var c=r.length,d=qo?qo(c):new r.constructor(c);return r.copy(d),d}function mo(r){var a=new r.constructor(r.byteLength);return new la(a).set(new la(r)),a}function v1(r,a){var c=a?mo(r.buffer):r.buffer;return new r.constructor(c,r.byteOffset,r.byteLength)}function M1(r){var a=new r.constructor(r.source,Fr.exec(r));return a.lastIndex=r.lastIndex,a}function O1(r){return Os?xe(Os.call(r)):{}}function Ml(r,a){var c=a?mo(r.buffer):r.buffer;return new r.constructor(c,r.byteOffset,r.length)}function Ol(r,a){if(r!==a){var c=r!==f,d=r===null,C=r===r,O=nr(r),B=a!==f,k=a===null,U=a===a,J=nr(a);if(!k&&!J&&!O&&r>a||O&&B&&U&&!k&&!J||d&&B&&U||!c&&U||!C)return 1;if(!d&&!O&&!J&&r<a||J&&c&&C&&!d&&!O||k&&c&&C||!B&&C||!U)return-1}return 0}function D1(r,a,c){for(var d=-1,C=r.criteria,O=a.criteria,B=C.length,k=c.length;++d<B;){var U=Ol(C[d],O[d]);if(U){if(d>=k)return U;var J=c[d];return U*(J=="desc"?-1:1)}}return r.index-a.index}function Dl(r,a,c,d){for(var C=-1,O=r.length,B=c.length,k=-1,U=a.length,J=on(O-B,0),$=D(U+J),ee=!d;++k<U;)$[k]=a[k];for(;++C<B;)(ee||C<O)&&($[c[C]]=r[C]);for(;J--;)$[k++]=r[C++];return $}function Rl(r,a,c,d){for(var C=-1,O=r.length,B=-1,k=c.length,U=-1,J=a.length,$=on(O-k,0),ee=D($+J),ce=!d;++C<$;)ee[C]=r[C];for(var we=C;++U<J;)ee[we+U]=a[U];for(;++B<k;)(ce||C<O)&&(ee[we+c[B]]=r[C++]);return ee}function Xn(r,a){var c=-1,d=r.length;for(a||(a=D(d));++c<d;)a[c]=r[c];return a}function Hr(r,a,c,d){var C=!c;c||(c={});for(var O=-1,B=a.length;++O<B;){var k=a[O],U=d?d(c[k],r[k],k,c,r):f;U===f&&(U=r[k]),C?ti(c,k,U):Ds(c,k,U)}return c}function R1(r,a){return Hr(r,bo(r),a)}function L1(r,a){return Hr(r,Yl(r),a)}function Ia(r,a){return function(c,d){var C=Fe(c)?ea:n1,O=a?a():{};return C(c,r,ve(d,2),O)}}function cs(r){return Xe(function(a,c){var d=-1,C=c.length,O=C>1?c[C-1]:f,B=C>2?c[2]:f;for(O=r.length>3&&typeof O=="function"?(C--,O):f,B&&Hn(c[0],c[1],B)&&(O=C<3?f:O,C=1),a=xe(a);++d<C;){var k=c[d];k&&r(a,k,d,O)}return a})}function Ll(r,a){return function(c,d){if(c==null)return c;if(!Zn(c))return r(c,d);for(var C=c.length,O=a?C:-1,B=xe(c);(a?O--:++O<C)&&d(B[O],O,B)!==!1;);return c}}function Bl(r){return function(a,c,d){for(var C=-1,O=xe(a),B=d(a),k=B.length;k--;){var U=B[r?k:++C];if(c(O[U],U,O)===!1)break}return a}}function B1(r,a,c){var d=a&Ue,C=ks(r);function O(){var B=this&&this!==Jt&&this instanceof O?C:r;return B.apply(d?c:this,arguments)}return O}function Pl(r){return function(a){a=dt(a);var c=mi(a)?o(a):f,d=c?c[0]:a.charAt(0),C=c?yi(c,1).join(""):a.slice(1);return d[r]()+C}}function us(r){return function(a){return Sr(Lc(Rc(a).replace(Ne,"")),r,"")}}function ks(r){return function(){var a=arguments;switch(a.length){case 0:return new r;case 1:return new r(a[0]);case 2:return new r(a[0],a[1]);case 3:return new r(a[0],a[1],a[2]);case 4:return new r(a[0],a[1],a[2],a[3]);case 5:return new r(a[0],a[1],a[2],a[3],a[4]);case 6:return new r(a[0],a[1],a[2],a[3],a[4],a[5]);case 7:return new r(a[0],a[1],a[2],a[3],a[4],a[5],a[6])}var c=ls(r.prototype),d=r.apply(c,a);return Ut(d)?d:c}}function P1(r,a,c){var d=ks(r);function C(){for(var O=arguments.length,B=D(O),k=O,U=fs(C);k--;)B[k]=arguments[k];var J=O<3&&B[0]!==U&&B[O-1]!==U?[]:w(B,U);if(O-=J.length,O<c)return Hl(r,a,ba,C.placeholder,f,B,J,f,f,c-O);var $=this&&this!==Jt&&this instanceof C?d:r;return fn($,this,B)}return C}function kl(r){return function(a,c,d){var C=xe(a);if(!Zn(a)){var O=ve(c,3);a=gn(a),c=function(k){return O(C[k],k,C)}}var B=r(a,c,d);return B>-1?C[O?a[B]:B]:f}}function Fl(r){return ri(function(a){var c=a.length,d=c,C=gr.prototype.thru;for(r&&a.reverse();d--;){var O=a[d];if(typeof O!="function")throw new Bt(F);if(C&&!B&&Na(O)=="wrapper")var B=new gr([],!0)}for(d=B?d:c;++d<c;){O=a[d];var k=Na(O),U=k=="wrapper"?yo(O):f;U&&So(U[0])&&U[1]==(re|fe|It|Ge)&&!U[4].length&&U[9]==1?B=B[Na(U[0])].apply(B,U[3]):B=O.length==1&&So(O)?B[k]():B.thru(O)}return function(){var J=arguments,$=J[0];if(B&&J.length==1&&Fe($))return B.plant($).value();for(var ee=0,ce=c?a[ee].apply(this,J):$;++ee<c;)ce=a[ee].call(this,ce);return ce}})}function ba(r,a,c,d,C,O,B,k,U,J){var $=a&re,ee=a&Ue,ce=a&yt,we=a&(fe|_e),Me=a&ie,Ve=ce?f:ks(r);function Oe(){for(var Je=arguments.length,nt=D(Je),rr=Je;rr--;)nt[rr]=arguments[rr];if(we)var zn=fs(Oe),ir=Xa(nt,zn);if(d&&(nt=Dl(nt,d,C,we)),O&&(nt=Rl(nt,O,B,we)),Je-=ir,we&&Je<J){var Kt=w(nt,zn);return Hl(r,a,ba,Oe.placeholder,c,nt,Kt,k,U,J-Je)}var Mr=ee?c:this,oi=ce?Mr[r]:r;return Je=nt.length,k?nt=n0(nt,k):Me&&Je>1&&nt.reverse(),$&&U<Je&&(nt.length=U),this&&this!==Jt&&this instanceof Oe&&(oi=Ve||ks(oi)),oi.apply(Mr,nt)}return Oe}function Ul(r,a){return function(c,d){return u1(c,r,a(d),{})}}function _a(r,a){return function(c,d){var C;if(c===f&&d===f)return a;if(c!==f&&(C=c),d!==f){if(C===f)return d;typeof c=="string"||typeof d=="string"?(c=tr(c),d=tr(d)):(c=bl(c),d=bl(d)),C=r(c,d)}return C}}function wo(r){return ri(function(a){return a=Re(a,zt(ve())),Xe(function(c){var d=this;return r(a,function(C){return fn(C,d,c)})})})}function Sa(r,a){a=a===f?" ":tr(a);var c=a.length;if(c<2)return c?uo(a,r):a;var d=uo(a,ha(r/s(a)));return mi(a)?yi(o(d),0,r).join(""):d.slice(0,r)}function k1(r,a,c,d){var C=a&Ue,O=ks(r);function B(){for(var k=-1,U=arguments.length,J=-1,$=d.length,ee=D($+U),ce=this&&this!==Jt&&this instanceof B?O:r;++J<$;)ee[J]=d[J];for(;U--;)ee[J++]=arguments[++k];return fn(ce,C?c:this,ee)}return B}function jl(r){return function(a,c,d){return d&&typeof d!="number"&&Hn(a,c,d)&&(c=d=f),a=ai(a),c===f?(c=a,a=0):c=ai(c),d=d===f?a<c?1:-1:ai(d),y1(a,c,d,r)}}function Ta(r){return function(a,c){return typeof a=="string"&&typeof c=="string"||(a=wr(a),c=wr(c)),r(a,c)}}function Hl(r,a,c,d,C,O,B,k,U,J){var $=a&fe,ee=$?B:f,ce=$?f:B,we=$?O:f,Me=$?f:O;a|=$?It:Be,a&=~($?Be:It),a&Ye||(a&=-4);var Ve=[r,a,C,we,ee,Me,ce,k,U,J],Oe=c.apply(f,Ve);return So(r)&&$l(Oe,Ve),Oe.placeholder=d,ec(Oe,r,a)}function Ao(r){var a=Q[r];return function(c,d){if(c=wr(c),d=d==null?0:On(We(d),292),d&&el(c)){var C=(dt(c)+"e").split("e"),O=a(C[0]+"e"+(+C[1]+d));return C=(dt(O)+"e").split("e"),+(C[0]+"e"+(+C[1]-d))}return a(c)}}var F1=as&&1/e(new as([,-0]))[1]==Te?function(r){return new as(r)}:Ho;function zl(r){return function(a){var c=Dn(a);return c==Qt?Qe(a):c==le?t(a):ji(a,r(a))}}function ni(r,a,c,d,C,O,B,k){var U=a&yt;if(!U&&typeof r!="function")throw new Bt(F);var J=d?d.length:0;if(J||(a&=-97,d=C=f),B=B===f?B:on(We(B),0),k=k===f?k:We(k),J-=C?C.length:0,a&Be){var $=d,ee=C;d=C=f}var ce=U?f:yo(r),we=[r,a,c,d,C,$,ee,O,B,k];if(ce&&$1(we,ce),r=we[0],a=we[1],c=we[2],d=we[3],C=we[4],k=we[9]=we[9]===f?U?0:r.length:on(we[9]-J,0),!k&&a&(fe|_e)&&(a&=-25),!a||a==Ue)var Me=B1(r,a,c);else a==fe||a==_e?Me=P1(r,a,k):(a==It||a==(Ue|It))&&!C.length?Me=k1(r,a,c,d):Me=ba.apply(f,we);var Ve=ce?yl:$l;return ec(Ve(Me,we),r,a)}function Wl(r,a,c,d){return r===f||vr(r,Pt[c])&&!et.call(d,c)?a:r}function Gl(r,a,c,d,C,O){return Ut(r)&&Ut(a)&&(O.set(a,r),Ca(r,a,f,Gl,O),O.delete(a)),r}function U1(r){return js(r)?f:r}function Vl(r,a,c,d,C,O){var B=c&ct,k=r.length,U=a.length;if(k!=U&&!(B&&U>k))return!1;var J=O.get(r),$=O.get(a);if(J&&$)return J==a&&$==r;var ee=-1,ce=!0,we=c&ge?new Vi:f;for(O.set(r,a),O.set(a,r);++ee<k;){var Me=r[ee],Ve=a[ee];if(d)var Oe=B?d(Ve,Me,ee,a,r,O):d(Me,Ve,ee,r,a,O);if(Oe!==f){if(Oe)continue;ce=!1;break}if(we){if(!be(a,function(Je,nt){if(!hn(we,nt)&&(Me===Je||C(Me,Je,c,d,O)))return we.push(nt)})){ce=!1;break}}else if(!(Me===Ve||C(Me,Ve,c,d,O))){ce=!1;break}}return O.delete(r),O.delete(a),ce}function j1(r,a,c,d,C,O,B){switch(c){case wn:if(r.byteLength!=a.byteLength||r.byteOffset!=a.byteOffset)return!1;r=r.buffer,a=a.buffer;case mn:return!(r.byteLength!=a.byteLength||!O(new la(r),new la(a)));case gt:case cn:case un:return vr(+r,+a);case Yt:return r.name==a.name&&r.message==a.message;case lr:case cr:return r==a+"";case Qt:var k=Qe;case le:var U=d&ct;if(k||(k=e),r.size!=a.size&&!U)return!1;var J=B.get(r);if(J)return J==a;d|=ge,B.set(r,a);var $=Vl(k(r),k(a),d,C,O,B);return B.delete(r),$;case Yr:if(Os)return Os.call(r)==Os.call(a)}return!1}function H1(r,a,c,d,C,O){var B=c&ct,k=Co(r),U=k.length,J=Co(a),$=J.length;if(U!=$&&!B)return!1;for(var ee=U;ee--;){var ce=k[ee];if(!(B?ce in a:et.call(a,ce)))return!1}var we=O.get(r),Me=O.get(a);if(we&&Me)return we==a&&Me==r;var Ve=!0;O.set(r,a),O.set(a,r);for(var Oe=B;++ee<U;){ce=k[ee];var Je=r[ce],nt=a[ce];if(d)var rr=B?d(nt,Je,ce,a,r,O):d(Je,nt,ce,r,a,O);if(!(rr===f?Je===nt||C(Je,nt,c,d,O):rr)){Ve=!1;break}Oe||(Oe=ce=="constructor")}if(Ve&&!Oe){var zn=r.constructor,ir=a.constructor;zn!=ir&&"constructor"in r&&"constructor"in a&&!(typeof zn=="function"&&zn instanceof zn&&typeof ir=="function"&&ir instanceof ir)&&(Ve=!1)}return O.delete(r),O.delete(a),Ve}function ri(r){return No(Ql(r,f,ac),r+"")}function Co(r){return fl(r,gn,bo)}function Eo(r){return fl(r,Kn,Yl)}var yo=ga?function(r){return ga.get(r)}:Ho;function Na(r){for(var a=r.name+"",c=os[a],d=et.call(os,a)?c.length:0;d--;){var C=c[d],O=C.func;if(O==null||O==r)return C.name}return a}function fs(r){var a=et.call(N,"placeholder")?N:r;return a.placeholder}function ve(){var r=N.iteratee||Uo;return r=r===Uo?gl:r,arguments.length?r(arguments[0],arguments[1]):r}function va(r,a){var c=r.__data__;return K1(a)?c[typeof a=="string"?"string":"hash"]:c.map}function Io(r){for(var a=gn(r),c=a.length;c--;){var d=a[c],C=r[d];a[c]=[d,C,Kl(C)]}return a}function Zi(r,a){var c=dr(r,a);return dl(c)?c:f}function z1(r){var a=et.call(r,Wi),c=r[Wi];try{r[Wi]=f;var d=!0}catch{}var C=aa.call(r);return d&&(a?r[Wi]=c:delete r[Wi]),C}var bo=qa?function(r){return r==null?[]:(r=xe(r),hr(qa(r),function(a){return Jo.call(r,a)}))}:zo,Yl=qa?function(r){for(var a=[];r;)$n(a,bo(r)),r=ca(r);return a}:zo,Dn=jn;(Qa&&Dn(new Qa(new ArrayBuffer(1)))!=wn||Ns&&Dn(new Ns)!=Qt||Ja&&Dn(Ja.resolve())!=ut||as&&Dn(new as)!=le||vs&&Dn(new vs)!=Cr)&&(Dn=function(r){var a=jn(r),c=a==ht?r.constructor:f,d=c?Ki(c):"";if(d)switch(d){case bu:return wn;case _u:return Qt;case Su:return ut;case Tu:return le;case Nu:return Cr}return a});function W1(r,a,c){for(var d=-1,C=c.length;++d<C;){var O=c[d],B=O.size;switch(O.type){case"drop":r+=B;break;case"dropRight":a-=B;break;case"take":a=On(a,r+B);break;case"takeRight":r=on(r,a-B);break}}return{start:r,end:a}}function G1(r){var a=r.match(An);return a?a[1].split(ue):[]}function Xl(r,a,c){a=Ei(a,r);for(var d=-1,C=a.length,O=!1;++d<C;){var B=zr(a[d]);if(!(O=r!=null&&c(r,B)))break;r=r[B]}return O||++d!=C?O:(C=r==null?0:r.length,!!C&&Pa(C)&&ii(B,C)&&(Fe(r)||qi(r)))}function V1(r){var a=r.length,c=new r.constructor(a);return a&&typeof r[0]=="string"&&et.call(r,"index")&&(c.index=r.index,c.input=r.input),c}function Zl(r){return typeof r.constructor=="function"&&!Fs(r)?ls(ca(r)):{}}function Y1(r,a,c){var d=r.constructor;switch(a){case mn:return mo(r);case gt:case cn:return new d(+r);case wn:return v1(r,c);case Tt:case Rt:case Er:case Ni:case Nt:case ae:case bt:case it:case xt:return Ml(r,c);case Qt:return new d;case un:case cr:return new d(r);case lr:return M1(r);case le:return new d;case Yr:return O1(r)}}function X1(r,a){var c=a.length;if(!c)return r;var d=c-1;return a[d]=(c>1?"& ":"")+a[d],a=a.join(c>2?", ":" "),r.replace(fr,`{
/* [wrapped with `+a+`] */
`)}function Z1(r){return Fe(r)||qi(r)||!!($o&&r&&r[$o])}function ii(r,a){var c=typeof r;return a=a??bn,!!a&&(c=="number"||c!="symbol"&&oe.test(r))&&r>-1&&r%1==0&&r<a}function Hn(r,a,c){if(!Ut(c))return!1;var d=typeof a;return(d=="number"?Zn(c)&&ii(a,c.length):d=="string"&&a in c)?vr(c[a],r):!1}function _o(r,a){if(Fe(r))return!1;var c=typeof r;return c=="number"||c=="symbol"||c=="boolean"||r==null||nr(r)?!0:Zr.test(r)||!yr.test(r)||a!=null&&r in xe(a)}function K1(r){var a=typeof r;return a=="string"||a=="number"||a=="symbol"||a=="boolean"?r!=="__proto__":r===null}function So(r){var a=Na(r),c=N[a];if(typeof c!="function"||!(a in tt.prototype))return!1;if(r===c)return!0;var d=yo(c);return!!d&&r===d[0]}function q1(r){return!!sa&&sa in r}var Q1=dn?si:Wo;function Fs(r){var a=r&&r.constructor,c=typeof a=="function"&&a.prototype||Pt;return r===c}function Kl(r){return r===r&&!Ut(r)}function ql(r,a){return function(c){return c==null?!1:c[r]===a&&(a!==f||r in xe(c))}}function J1(r){var a=La(r,function(d){return c.size===T&&c.clear(),d}),c=a.cache;return a}function $1(r,a){var c=r[1],d=a[1],C=c|d,O=C<(Ue|yt|re),B=d==re&&c==fe||d==re&&c==Ge&&r[7].length<=a[8]||d==(re|Ge)&&a[7].length<=a[8]&&c==fe;if(!(O||B))return r;d&Ue&&(r[2]=a[2],C|=c&Ue?0:Ye);var k=a[3];if(k){var U=r[3];r[3]=U?Dl(U,k,a[4]):k,r[4]=U?w(r[3],z):a[4]}return k=a[5],k&&(U=r[5],r[5]=U?Rl(U,k,a[6]):k,r[6]=U?w(r[5],z):a[6]),k=a[7],k&&(r[7]=k),d&re&&(r[8]=r[8]==null?a[8]:On(r[8],a[8])),r[9]==null&&(r[9]=a[9]),r[0]=a[0],r[1]=C,r}function e0(r){var a=[];if(r!=null)for(var c in xe(r))a.push(c);return a}function t0(r){return aa.call(r)}function Ql(r,a,c){return a=on(a===f?r.length-1:a,0),function(){for(var d=arguments,C=-1,O=on(d.length-a,0),B=D(O);++C<O;)B[C]=d[a+C];C=-1;for(var k=D(a+1);++C<a;)k[C]=d[C];return k[a]=c(B),fn(r,this,k)}}function Jl(r,a){return a.length<2?r:Xi(r,pr(a,0,-1))}function n0(r,a){for(var c=r.length,d=On(a.length,c),C=Xn(r);d--;){var O=a[d];r[d]=ii(O,c)?C[O]:f}return r}function To(r,a){if(!(a==="constructor"&&typeof r[a]=="function")&&a!="__proto__")return r[a]}var $l=tc(yl),Us=mu||function(r,a){return Jt.setTimeout(r,a)},No=tc(_1);function ec(r,a,c){var d=a+"";return No(r,X1(d,r0(G1(d),c)))}function tc(r){var a=0,c=0;return function(){var d=Eu(),C=rt-(d-c);if(c=d,C>0){if(++a>=ye)return arguments[0]}else a=0;return r.apply(f,arguments)}}function Ma(r,a){var c=-1,d=r.length,C=d-1;for(a=a===f?d:a;++c<a;){var O=co(c,C),B=r[O];r[O]=r[c],r[c]=B}return r.length=a,r}var nc=J1(function(r){var a=[];return r.charCodeAt(0)===46&&a.push(""),r.replace(Pn,function(c,d,C,O){a.push(C?O.replace(nn,"$1"):d||c)}),a});function zr(r){if(typeof r=="string"||nr(r))return r;var a=r+"";return a=="0"&&1/r==-Te?"-0":a}function Ki(r){if(r!=null){try{return Tr.call(r)}catch{}try{return r+""}catch{}}return""}function r0(r,a){return Yn(Ft,function(c){var d="_."+c[0];a&c[1]&&!Lt(r,d)&&r.push(d)}),r.sort()}function rc(r){if(r instanceof tt)return r.clone();var a=new gr(r.__wrapped__,r.__chain__);return a.__actions__=Xn(r.__actions__),a.__index__=r.__index__,a.__values__=r.__values__,a}function i0(r,a,c){(c?Hn(r,a,c):a===f)?a=1:a=on(We(a),0);var d=r==null?0:r.length;if(!d||a<1)return[];for(var C=0,O=0,B=D(ha(d/a));C<d;)B[O++]=pr(r,C,C+=a);return B}function s0(r){for(var a=-1,c=r==null?0:r.length,d=0,C=[];++a<c;){var O=r[a];O&&(C[d++]=O)}return C}function a0(){var r=arguments.length;if(!r)return[];for(var a=D(r-1),c=arguments[0],d=r;d--;)a[d-1]=arguments[d];return $n(Fe(c)?Xn(c):[c],In(a,1))}var o0=Xe(function(r,a){return Zt(r)?Rs(r,In(a,1,Zt,!0)):[]}),l0=Xe(function(r,a){var c=mr(a);return Zt(c)&&(c=f),Zt(r)?Rs(r,In(a,1,Zt,!0),ve(c,2)):[]}),c0=Xe(function(r,a){var c=mr(a);return Zt(c)&&(c=f),Zt(r)?Rs(r,In(a,1,Zt,!0),f,c):[]});function u0(r,a,c){var d=r==null?0:r.length;return d?(a=c||a===f?1:We(a),pr(r,a<0?0:a,d)):[]}function f0(r,a,c){var d=r==null?0:r.length;return d?(a=c||a===f?1:We(a),a=d-a,pr(r,0,a<0?0:a)):[]}function h0(r,a){return r&&r.length?ya(r,ve(a,3),!0,!0):[]}function d0(r,a){return r&&r.length?ya(r,ve(a,3),!0):[]}function g0(r,a,c,d){var C=r==null?0:r.length;return C?(c&&typeof c!="number"&&Hn(r,a,c)&&(c=0,d=C),a1(r,a,c,d)):[]}function ic(r,a,c){var d=r==null?0:r.length;if(!d)return-1;var C=c==null?0:We(c);return C<0&&(C=on(d+C,0)),ns(r,ve(a,3),C)}function sc(r,a,c){var d=r==null?0:r.length;if(!d)return-1;var C=d-1;return c!==f&&(C=We(c),C=c<0?on(d+C,0):On(C,d-1)),ns(r,ve(a,3),C,!0)}function ac(r){var a=r==null?0:r.length;return a?In(r,1):[]}function x0(r){var a=r==null?0:r.length;return a?In(r,Te):[]}function p0(r,a){var c=r==null?0:r.length;return c?(a=a===f?1:We(a),In(r,a)):[]}function m0(r){for(var a=-1,c=r==null?0:r.length,d={};++a<c;){var C=r[a];d[C[0]]=C[1]}return d}function oc(r){return r&&r.length?r[0]:f}function w0(r,a,c){var d=r==null?0:r.length;if(!d)return-1;var C=c==null?0:We(c);return C<0&&(C=on(d+C,0)),yn(r,a,C)}function A0(r){var a=r==null?0:r.length;return a?pr(r,0,-1):[]}var C0=Xe(function(r){var a=Re(r,xo);return a.length&&a[0]===r[0]?io(a):[]}),E0=Xe(function(r){var a=mr(r),c=Re(r,xo);return a===mr(c)?a=f:c.pop(),c.length&&c[0]===r[0]?io(c,ve(a,2)):[]}),y0=Xe(function(r){var a=mr(r),c=Re(r,xo);return a=typeof a=="function"?a:f,a&&c.pop(),c.length&&c[0]===r[0]?io(c,f,a):[]});function I0(r,a){return r==null?"":Au.call(r,a)}function mr(r){var a=r==null?0:r.length;return a?r[a-1]:f}function b0(r,a,c){var d=r==null?0:r.length;if(!d)return-1;var C=d;return c!==f&&(C=We(c),C=C<0?on(d+C,0):On(C,d-1)),a===a?i(r,a,C):ns(r,ys,C,!0)}function _0(r,a){return r&&r.length?wl(r,We(a)):f}var S0=Xe(lc);function lc(r,a){return r&&r.length&&a&&a.length?lo(r,a):r}function T0(r,a,c){return r&&r.length&&a&&a.length?lo(r,a,ve(c,2)):r}function N0(r,a,c){return r&&r.length&&a&&a.length?lo(r,a,f,c):r}var v0=ri(function(r,a){var c=r==null?0:r.length,d=eo(r,a);return El(r,Re(a,function(C){return ii(C,c)?+C:C}).sort(Ol)),d});function M0(r,a){var c=[];if(!(r&&r.length))return c;var d=-1,C=[],O=r.length;for(a=ve(a,3);++d<O;){var B=r[d];a(B,d,r)&&(c.push(B),C.push(d))}return El(r,C),c}function vo(r){return r==null?r:Iu.call(r)}function O0(r,a,c){var d=r==null?0:r.length;return d?(c&&typeof c!="number"&&Hn(r,a,c)?(a=0,c=d):(a=a==null?0:We(a),c=c===f?d:We(c)),pr(r,a,c)):[]}function D0(r,a){return Ea(r,a)}function R0(r,a,c){return fo(r,a,ve(c,2))}function L0(r,a){var c=r==null?0:r.length;if(c){var d=Ea(r,a);if(d<c&&vr(r[d],a))return d}return-1}function B0(r,a){return Ea(r,a,!0)}function P0(r,a,c){return fo(r,a,ve(c,2),!0)}function k0(r,a){var c=r==null?0:r.length;if(c){var d=Ea(r,a,!0)-1;if(vr(r[d],a))return d}return-1}function F0(r){return r&&r.length?Il(r):[]}function U0(r,a){return r&&r.length?Il(r,ve(a,2)):[]}function j0(r){var a=r==null?0:r.length;return a?pr(r,1,a):[]}function H0(r,a,c){return r&&r.length?(a=c||a===f?1:We(a),pr(r,0,a<0?0:a)):[]}function z0(r,a,c){var d=r==null?0:r.length;return d?(a=c||a===f?1:We(a),a=d-a,pr(r,a<0?0:a,d)):[]}function W0(r,a){return r&&r.length?ya(r,ve(a,3),!1,!0):[]}function G0(r,a){return r&&r.length?ya(r,ve(a,3)):[]}var V0=Xe(function(r){return Ci(In(r,1,Zt,!0))}),Y0=Xe(function(r){var a=mr(r);return Zt(a)&&(a=f),Ci(In(r,1,Zt,!0),ve(a,2))}),X0=Xe(function(r){var a=mr(r);return a=typeof a=="function"?a:f,Ci(In(r,1,Zt,!0),f,a)});function Z0(r){return r&&r.length?Ci(r):[]}function K0(r,a){return r&&r.length?Ci(r,ve(a,2)):[]}function q0(r,a){return a=typeof a=="function"?a:f,r&&r.length?Ci(r,f,a):[]}function Mo(r){if(!(r&&r.length))return[];var a=0;return r=hr(r,function(c){if(Zt(c))return a=on(c.length,a),!0}),Is(a,function(c){return Re(r,is(c))})}function cc(r,a){if(!(r&&r.length))return[];var c=Mo(r);return a==null?c:Re(c,function(d){return fn(a,f,d)})}var Q0=Xe(function(r,a){return Zt(r)?Rs(r,a):[]}),J0=Xe(function(r){return go(hr(r,Zt))}),$0=Xe(function(r){var a=mr(r);return Zt(a)&&(a=f),go(hr(r,Zt),ve(a,2))}),ef=Xe(function(r){var a=mr(r);return a=typeof a=="function"?a:f,go(hr(r,Zt),f,a)}),tf=Xe(Mo);function nf(r,a){return Tl(r||[],a||[],Ds)}function rf(r,a){return Tl(r||[],a||[],Ps)}var sf=Xe(function(r){var a=r.length,c=a>1?r[a-1]:f;return c=typeof c=="function"?(r.pop(),c):f,cc(r,c)});function uc(r){var a=N(r);return a.__chain__=!0,a}function af(r,a){return a(r),r}function Oa(r,a){return a(r)}var of=ri(function(r){var a=r.length,c=a?r[0]:0,d=this.__wrapped__,C=function(O){return eo(O,r)};return a>1||this.__actions__.length||!(d instanceof tt)||!ii(c)?this.thru(C):(d=d.slice(c,+c+(a?1:0)),d.__actions__.push({func:Oa,args:[C],thisArg:f}),new gr(d,this.__chain__).thru(function(O){return a&&!O.length&&O.push(f),O}))});function lf(){return uc(this)}function cf(){return new gr(this.value(),this.__chain__)}function uf(){this.__values__===f&&(this.__values__=bc(this.value()));var r=this.__index__>=this.__values__.length,a=r?f:this.__values__[this.__index__++];return{done:r,value:a}}function ff(){return this}function hf(r){for(var a,c=this;c instanceof pa;){var d=rc(c);d.__index__=0,d.__values__=f,a?C.__wrapped__=d:a=d;var C=d;c=c.__wrapped__}return C.__wrapped__=r,a}function df(){var r=this.__wrapped__;if(r instanceof tt){var a=r;return this.__actions__.length&&(a=new tt(this)),a=a.reverse(),a.__actions__.push({func:Oa,args:[vo],thisArg:f}),new gr(a,this.__chain__)}return this.thru(vo)}function gf(){return Sl(this.__wrapped__,this.__actions__)}var xf=Ia(function(r,a,c){et.call(r,c)?++r[c]:ti(r,c,1)});function pf(r,a,c){var d=Fe(r)?ta:s1;return c&&Hn(r,a,c)&&(a=f),d(r,ve(a,3))}function mf(r,a){var c=Fe(r)?hr:cl;return c(r,ve(a,3))}var wf=kl(ic),Af=kl(sc);function Cf(r,a){return In(Da(r,a),1)}function Ef(r,a){return In(Da(r,a),Te)}function yf(r,a,c){return c=c===f?1:We(c),In(Da(r,a),c)}function fc(r,a){var c=Fe(r)?Yn:Ai;return c(r,ve(a,3))}function hc(r,a){var c=Fe(r)?Va:ll;return c(r,ve(a,3))}var If=Ia(function(r,a,c){et.call(r,c)?r[c].push(a):ti(r,c,[a])});function bf(r,a,c,d){r=Zn(r)?r:ds(r),c=c&&!d?We(c):0;var C=r.length;return c<0&&(c=on(C+c,0)),ka(r)?c<=C&&r.indexOf(a,c)>-1:!!C&&yn(r,a,c)>-1}var _f=Xe(function(r,a,c){var d=-1,C=typeof a=="function",O=Zn(r)?D(r.length):[];return Ai(r,function(B){O[++d]=C?fn(a,B,c):Ls(B,a,c)}),O}),Sf=Ia(function(r,a,c){ti(r,c,a)});function Da(r,a){var c=Fe(r)?Re:xl;return c(r,ve(a,3))}function Tf(r,a,c,d){return r==null?[]:(Fe(a)||(a=a==null?[]:[a]),c=d?f:c,Fe(c)||(c=c==null?[]:[c]),Al(r,a,c))}var Nf=Ia(function(r,a,c){r[c?0:1].push(a)},function(){return[[],[]]});function vf(r,a,c){var d=Fe(r)?Sr:na,C=arguments.length<3;return d(r,ve(a,4),c,C,Ai)}function Mf(r,a,c){var d=Fe(r)?mt:na,C=arguments.length<3;return d(r,ve(a,4),c,C,ll)}function Of(r,a){var c=Fe(r)?hr:cl;return c(r,Ba(ve(a,3)))}function Df(r){var a=Fe(r)?il:I1;return a(r)}function Rf(r,a,c){(c?Hn(r,a,c):a===f)?a=1:a=We(a);var d=Fe(r)?e1:b1;return d(r,a)}function Lf(r){var a=Fe(r)?t1:S1;return a(r)}function Bf(r){if(r==null)return 0;if(Zn(r))return ka(r)?s(r):r.length;var a=Dn(r);return a==Qt||a==le?r.size:ao(r).length}function Pf(r,a,c){var d=Fe(r)?be:T1;return c&&Hn(r,a,c)&&(a=f),d(r,ve(a,3))}var kf=Xe(function(r,a){if(r==null)return[];var c=a.length;return c>1&&Hn(r,a[0],a[1])?a=[]:c>2&&Hn(a[0],a[1],a[2])&&(a=[a[0]]),Al(r,In(a,1),[])}),Ra=pu||function(){return Jt.Date.now()};function Ff(r,a){if(typeof a!="function")throw new Bt(F);return r=We(r),function(){if(--r<1)return a.apply(this,arguments)}}function dc(r,a,c){return a=c?f:a,a=r&&a==null?r.length:a,ni(r,re,f,f,f,f,a)}function gc(r,a){var c;if(typeof a!="function")throw new Bt(F);return r=We(r),function(){return--r>0&&(c=a.apply(this,arguments)),r<=1&&(a=f),c}}var Oo=Xe(function(r,a,c){var d=Ue;if(c.length){var C=w(c,fs(Oo));d|=It}return ni(r,d,a,c,C)}),xc=Xe(function(r,a,c){var d=Ue|yt;if(c.length){var C=w(c,fs(xc));d|=It}return ni(a,d,r,c,C)});function pc(r,a,c){a=c?f:a;var d=ni(r,fe,f,f,f,f,f,a);return d.placeholder=pc.placeholder,d}function mc(r,a,c){a=c?f:a;var d=ni(r,_e,f,f,f,f,f,a);return d.placeholder=mc.placeholder,d}function wc(r,a,c){var d,C,O,B,k,U,J=0,$=!1,ee=!1,ce=!0;if(typeof r!="function")throw new Bt(F);a=wr(a)||0,Ut(c)&&($=!!c.leading,ee="maxWait"in c,O=ee?on(wr(c.maxWait)||0,a):O,ce="trailing"in c?!!c.trailing:ce);function we(Kt){var Mr=d,oi=C;return d=C=f,J=Kt,B=r.apply(oi,Mr),B}function Me(Kt){return J=Kt,k=Us(Je,a),$?we(Kt):B}function Ve(Kt){var Mr=Kt-U,oi=Kt-J,kc=a-Mr;return ee?On(kc,O-oi):kc}function Oe(Kt){var Mr=Kt-U,oi=Kt-J;return U===f||Mr>=a||Mr<0||ee&&oi>=O}function Je(){var Kt=Ra();if(Oe(Kt))return nt(Kt);k=Us(Je,Ve(Kt))}function nt(Kt){return k=f,ce&&d?we(Kt):(d=C=f,B)}function rr(){k!==f&&Nl(k),J=0,d=U=C=k=f}function zn(){return k===f?B:nt(Ra())}function ir(){var Kt=Ra(),Mr=Oe(Kt);if(d=arguments,C=this,U=Kt,Mr){if(k===f)return Me(U);if(ee)return Nl(k),k=Us(Je,a),we(U)}return k===f&&(k=Us(Je,a)),B}return ir.cancel=rr,ir.flush=zn,ir}var Uf=Xe(function(r,a){return ol(r,1,a)}),jf=Xe(function(r,a,c){return ol(r,wr(a)||0,c)});function Hf(r){return ni(r,ie)}function La(r,a){if(typeof r!="function"||a!=null&&typeof a!="function")throw new Bt(F);var c=function(){var d=arguments,C=a?a.apply(this,d):d[0],O=c.cache;if(O.has(C))return O.get(C);var B=r.apply(this,d);return c.cache=O.set(C,B)||O,B};return c.cache=new(La.Cache||ei),c}La.Cache=ei;function Ba(r){if(typeof r!="function")throw new Bt(F);return function(){var a=arguments;switch(a.length){case 0:return!r.call(this);case 1:return!r.call(this,a[0]);case 2:return!r.call(this,a[0],a[1]);case 3:return!r.call(this,a[0],a[1],a[2])}return!r.apply(this,a)}}function zf(r){return gc(2,r)}var Wf=N1(function(r,a){a=a.length==1&&Fe(a[0])?Re(a[0],zt(ve())):Re(In(a,1),zt(ve()));var c=a.length;return Xe(function(d){for(var C=-1,O=On(d.length,c);++C<O;)d[C]=a[C].call(this,d[C]);return fn(r,this,d)})}),Do=Xe(function(r,a){var c=w(a,fs(Do));return ni(r,It,f,a,c)}),Ac=Xe(function(r,a){var c=w(a,fs(Ac));return ni(r,Be,f,a,c)}),Gf=ri(function(r,a){return ni(r,Ge,f,f,f,a)});function Vf(r,a){if(typeof r!="function")throw new Bt(F);return a=a===f?a:We(a),Xe(r,a)}function Yf(r,a){if(typeof r!="function")throw new Bt(F);return a=a==null?0:on(We(a),0),Xe(function(c){var d=c[a],C=yi(c,0,a);return d&&$n(C,d),fn(r,this,C)})}function Xf(r,a,c){var d=!0,C=!0;if(typeof r!="function")throw new Bt(F);return Ut(c)&&(d="leading"in c?!!c.leading:d,C="trailing"in c?!!c.trailing:C),wc(r,a,{leading:d,maxWait:a,trailing:C})}function Zf(r){return dc(r,1)}function Kf(r,a){return Do(po(a),r)}function qf(){if(!arguments.length)return[];var r=arguments[0];return Fe(r)?r:[r]}function Qf(r){return xr(r,Ee)}function Jf(r,a){return a=typeof a=="function"?a:f,xr(r,Ee,a)}function $f(r){return xr(r,H|Ee)}function eh(r,a){return a=typeof a=="function"?a:f,xr(r,H|Ee,a)}function th(r,a){return a==null||al(r,a,gn(a))}function vr(r,a){return r===a||r!==r&&a!==a}var nh=Ta(ro),rh=Ta(function(r,a){return r>=a}),qi=hl((function(){return arguments})())?hl:function(r){return Wt(r)&&et.call(r,"callee")&&!Jo.call(r,"callee")},Fe=D.isArray,ih=ki?zt(ki):f1;function Zn(r){return r!=null&&Pa(r.length)&&!si(r)}function Zt(r){return Wt(r)&&Zn(r)}function sh(r){return r===!0||r===!1||Wt(r)&&jn(r)==gt}var Ii=wu||Wo,ah=_r?zt(_r):h1;function oh(r){return Wt(r)&&r.nodeType===1&&!js(r)}function lh(r){if(r==null)return!0;if(Zn(r)&&(Fe(r)||typeof r=="string"||typeof r.splice=="function"||Ii(r)||hs(r)||qi(r)))return!r.length;var a=Dn(r);if(a==Qt||a==le)return!r.size;if(Fs(r))return!ao(r).length;for(var c in r)if(et.call(r,c))return!1;return!0}function ch(r,a){return Bs(r,a)}function uh(r,a,c){c=typeof c=="function"?c:f;var d=c?c(r,a):f;return d===f?Bs(r,a,f,c):!!d}function Ro(r){if(!Wt(r))return!1;var a=jn(r);return a==Yt||a==Ln||typeof r.message=="string"&&typeof r.name=="string"&&!js(r)}function fh(r){return typeof r=="number"&&el(r)}function si(r){if(!Ut(r))return!1;var a=jn(r);return a==Ar||a==$e||a==Ti||a==Ke}function Cc(r){return typeof r=="number"&&r==We(r)}function Pa(r){return typeof r=="number"&&r>-1&&r%1==0&&r<=bn}function Ut(r){var a=typeof r;return r!=null&&(a=="object"||a=="function")}function Wt(r){return r!=null&&typeof r=="object"}var Ec=$s?zt($s):g1;function hh(r,a){return r===a||so(r,a,Io(a))}function dh(r,a,c){return c=typeof c=="function"?c:f,so(r,a,Io(a),c)}function gh(r){return yc(r)&&r!=+r}function xh(r){if(Q1(r))throw new K(m);return dl(r)}function ph(r){return r===null}function mh(r){return r==null}function yc(r){return typeof r=="number"||Wt(r)&&jn(r)==un}function js(r){if(!Wt(r)||jn(r)!=ht)return!1;var a=ca(r);if(a===null)return!0;var c=et.call(a,"constructor")&&a.constructor;return typeof c=="function"&&c instanceof c&&Tr.call(c)==hu}var Lo=G?zt(G):x1;function wh(r){return Cc(r)&&r>=-bn&&r<=bn}var Ic=He?zt(He):p1;function ka(r){return typeof r=="string"||!Fe(r)&&Wt(r)&&jn(r)==cr}function nr(r){return typeof r=="symbol"||Wt(r)&&jn(r)==Yr}var hs=$t?zt($t):m1;function Ah(r){return r===f}function Ch(r){return Wt(r)&&Dn(r)==Cr}function Eh(r){return Wt(r)&&jn(r)==Bn}var yh=Ta(oo),Ih=Ta(function(r,a){return r<=a});function bc(r){if(!r)return[];if(Zn(r))return ka(r)?o(r):Xn(r);if(Ts&&r[Ts])return Hi(r[Ts]());var a=Dn(r),c=a==Qt?Qe:a==le?e:ds;return c(r)}function ai(r){if(!r)return r===0?r:0;if(r=wr(r),r===Te||r===-Te){var a=r<0?-1:1;return a*Qn}return r===r?r:0}function We(r){var a=ai(r),c=a%1;return a===a?c?a-c:a:0}function _c(r){return r?Yi(We(r),0,pn):0}function wr(r){if(typeof r=="number")return r;if(nr(r))return xn;if(Ut(r)){var a=typeof r.valueOf=="function"?r.valueOf():r;r=Ut(a)?a+"":a}if(typeof r!="string")return r===0?r:+r;r=ra(r);var c=Y.test(r);return c||X.test(r)?vn(r.slice(2),c?2:8):I.test(r)?xn:+r}function Sc(r){return Hr(r,Kn(r))}function bh(r){return r?Yi(We(r),-bn,bn):r===0?r:0}function dt(r){return r==null?"":tr(r)}var _h=cs(function(r,a){if(Fs(a)||Zn(a)){Hr(a,gn(a),r);return}for(var c in a)et.call(a,c)&&Ds(r,c,a[c])}),Tc=cs(function(r,a){Hr(a,Kn(a),r)}),Fa=cs(function(r,a,c,d){Hr(a,Kn(a),r,d)}),Sh=cs(function(r,a,c,d){Hr(a,gn(a),r,d)}),Th=ri(eo);function Nh(r,a){var c=ls(r);return a==null?c:sl(c,a)}var vh=Xe(function(r,a){r=xe(r);var c=-1,d=a.length,C=d>2?a[2]:f;for(C&&Hn(a[0],a[1],C)&&(d=1);++c<d;)for(var O=a[c],B=Kn(O),k=-1,U=B.length;++k<U;){var J=B[k],$=r[J];($===f||vr($,Pt[J])&&!et.call(r,J))&&(r[J]=O[J])}return r}),Mh=Xe(function(r){return r.push(f,Gl),fn(Nc,f,r)});function Oh(r,a){return Jr(r,ve(a,3),jr)}function Dh(r,a){return Jr(r,ve(a,3),no)}function Rh(r,a){return r==null?r:to(r,ve(a,3),Kn)}function Lh(r,a){return r==null?r:ul(r,ve(a,3),Kn)}function Bh(r,a){return r&&jr(r,ve(a,3))}function Ph(r,a){return r&&no(r,ve(a,3))}function kh(r){return r==null?[]:Aa(r,gn(r))}function Fh(r){return r==null?[]:Aa(r,Kn(r))}function Bo(r,a,c){var d=r==null?f:Xi(r,a);return d===f?c:d}function Uh(r,a){return r!=null&&Xl(r,a,o1)}function Po(r,a){return r!=null&&Xl(r,a,l1)}var jh=Ul(function(r,a,c){a!=null&&typeof a.toString!="function"&&(a=aa.call(a)),r[a]=c},Fo(qn)),Hh=Ul(function(r,a,c){a!=null&&typeof a.toString!="function"&&(a=aa.call(a)),et.call(r,a)?r[a].push(c):r[a]=[c]},ve),zh=Xe(Ls);function gn(r){return Zn(r)?rl(r):ao(r)}function Kn(r){return Zn(r)?rl(r,!0):w1(r)}function Wh(r,a){var c={};return a=ve(a,3),jr(r,function(d,C,O){ti(c,a(d,C,O),d)}),c}function Gh(r,a){var c={};return a=ve(a,3),jr(r,function(d,C,O){ti(c,C,a(d,C,O))}),c}var Vh=cs(function(r,a,c){Ca(r,a,c)}),Nc=cs(function(r,a,c,d){Ca(r,a,c,d)}),Yh=ri(function(r,a){var c={};if(r==null)return c;var d=!1;a=Re(a,function(O){return O=Ei(O,r),d||(d=O.length>1),O}),Hr(r,Eo(r),c),d&&(c=xr(c,H|Le|Ee,U1));for(var C=a.length;C--;)ho(c,a[C]);return c});function Xh(r,a){return vc(r,Ba(ve(a)))}var Zh=ri(function(r,a){return r==null?{}:C1(r,a)});function vc(r,a){if(r==null)return{};var c=Re(Eo(r),function(d){return[d]});return a=ve(a),Cl(r,c,function(d,C){return a(d,C[0])})}function Kh(r,a,c){a=Ei(a,r);var d=-1,C=a.length;for(C||(C=1,r=f);++d<C;){var O=r==null?f:r[zr(a[d])];O===f&&(d=C,O=c),r=si(O)?O.call(r):O}return r}function qh(r,a,c){return r==null?r:Ps(r,a,c)}function Qh(r,a,c,d){return d=typeof d=="function"?d:f,r==null?r:Ps(r,a,c,d)}var Mc=zl(gn),Oc=zl(Kn);function Jh(r,a,c){var d=Fe(r),C=d||Ii(r)||hs(r);if(a=ve(a,4),c==null){var O=r&&r.constructor;C?c=d?new O:[]:Ut(r)?c=si(O)?ls(ca(r)):{}:c={}}return(C?Yn:jr)(r,function(B,k,U){return a(c,B,k,U)}),c}function $h(r,a){return r==null?!0:ho(r,a)}function ed(r,a,c){return r==null?r:_l(r,a,po(c))}function td(r,a,c,d){return d=typeof d=="function"?d:f,r==null?r:_l(r,a,po(c),d)}function ds(r){return r==null?[]:pi(r,gn(r))}function nd(r){return r==null?[]:pi(r,Kn(r))}function rd(r,a,c){return c===f&&(c=a,a=f),c!==f&&(c=wr(c),c=c===c?c:0),a!==f&&(a=wr(a),a=a===a?a:0),Yi(wr(r),a,c)}function id(r,a,c){return a=ai(a),c===f?(c=a,a=0):c=ai(c),r=wr(r),c1(r,a,c)}function sd(r,a,c){if(c&&typeof c!="boolean"&&Hn(r,a,c)&&(a=c=f),c===f&&(typeof a=="boolean"?(c=a,a=f):typeof r=="boolean"&&(c=r,r=f)),r===f&&a===f?(r=0,a=1):(r=ai(r),a===f?(a=r,r=0):a=ai(a)),r>a){var d=r;r=a,a=d}if(c||r%1||a%1){var C=tl();return On(r+C*(a-r+Pi("1e-"+((C+"").length-1))),a)}return co(r,a)}var ad=us(function(r,a,c){return a=a.toLowerCase(),r+(c?Dc(a):a)});function Dc(r){return ko(dt(r).toLowerCase())}function Rc(r){return r=dt(r),r&&r.replace(de,_s).replace(Wa,"")}function od(r,a,c){r=dt(r),a=tr(a);var d=r.length;c=c===f?d:Yi(We(c),0,d);var C=c;return c-=a.length,c>=0&&r.slice(c,C)==a}function ld(r){return r=dt(r),r&&Oi.test(r)?r.replace(Jn,Za):r}function cd(r){return r=dt(r),r&&ur.test(r)?r.replace(fi,"\\$&"):r}var ud=us(function(r,a,c){return r+(c?"-":"")+a.toLowerCase()}),fd=us(function(r,a,c){return r+(c?" ":"")+a.toLowerCase()}),hd=Pl("toLowerCase");function dd(r,a,c){r=dt(r),a=We(a);var d=a?s(r):0;if(!a||d>=a)return r;var C=(a-d)/2;return Sa(da(C),c)+r+Sa(ha(C),c)}function gd(r,a,c){r=dt(r),a=We(a);var d=a?s(r):0;return a&&d<a?r+Sa(a-d,c):r}function xd(r,a,c){r=dt(r),a=We(a);var d=a?s(r):0;return a&&d<a?Sa(a-d,c)+r:r}function pd(r,a,c){return c||a==null?a=0:a&&(a=+a),yu(dt(r).replace(kr,""),a||0)}function md(r,a,c){return(c?Hn(r,a,c):a===f)?a=1:a=We(a),uo(dt(r),a)}function wd(){var r=arguments,a=dt(r[0]);return r.length<3?a:a.replace(r[1],r[2])}var Ad=us(function(r,a,c){return r+(c?"_":"")+a.toLowerCase()});function Cd(r,a,c){return c&&typeof c!="number"&&Hn(r,a,c)&&(a=c=f),c=c===f?pn:c>>>0,c?(r=dt(r),r&&(typeof a=="string"||a!=null&&!Lo(a))&&(a=tr(a),!a&&mi(r))?yi(o(r),0,c):r.split(a,c)):[]}var Ed=us(function(r,a,c){return r+(c?" ":"")+ko(a)});function yd(r,a,c){return r=dt(r),c=c==null?0:Yi(We(c),0,r.length),a=tr(a),r.slice(c,c+a.length)==a}function Id(r,a,c){var d=N.templateSettings;c&&Hn(r,a,c)&&(a=f),r=dt(r),a=Fa({},a,d,Wl);var C=Fa({},a.imports,d.imports,Wl),O=gn(C),B=pi(C,O),k,U,J=0,$=a.interpolate||se,ee="__p += '",ce=Pe((a.escape||se).source+"|"+$.source+"|"+($===jt?br:se).source+"|"+(a.evaluate||se).source+"|$","g"),we="//# sourceURL="+(et.call(a,"sourceURL")?(a.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++Kr+"]")+`
`;r.replace(ce,function(Oe,Je,nt,rr,zn,ir){return nt||(nt=rr),ee+=r.slice(J,ir).replace(Ze,ia),Je&&(k=!0,ee+=`' +
__e(`+Je+`) +
'`),zn&&(U=!0,ee+=`';
`+zn+`;
__p += '`),nt&&(ee+=`' +
((__t = (`+nt+`)) == null ? '' : __t) +
'`),J=ir+Oe.length,Oe}),ee+=`';
`;var Me=et.call(a,"variable")&&a.variable;if(!Me)ee=`with (obj) {
`+ee+`
}
`;else if(hi.test(Me))throw new K(W);ee=(U?ee.replace(Xr,""):ee).replace(vi,"$1").replace(Qi,"$1;"),ee="function("+(Me||"obj")+`) {
`+(Me?"":`obj || (obj = {});
`)+"var __t, __p = ''"+(k?", __e = _.escape":"")+(U?`, __j = Array.prototype.join;
function print() { __p += __j.call(arguments, '') }
`:`;
`)+ee+`return __p
}`;var Ve=Bc(function(){return q(O,we+"return "+ee).apply(f,B)});if(Ve.source=ee,Ro(Ve))throw Ve;return Ve}function bd(r){return dt(r).toLowerCase()}function _d(r){return dt(r).toUpperCase()}function Sd(r,a,c){if(r=dt(r),r&&(c||a===f))return ra(r);if(!r||!(a=tr(a)))return r;var d=o(r),C=o(a),O=bs(d,C),B=er(d,C)+1;return yi(d,O,B).join("")}function Td(r,a,c){if(r=dt(r),r&&(c||a===f))return r.slice(0,l(r)+1);if(!r||!(a=tr(a)))return r;var d=o(r),C=er(d,o(a))+1;return yi(d,0,C).join("")}function Nd(r,a,c){if(r=dt(r),r&&(c||a===f))return r.replace(kr,"");if(!r||!(a=tr(a)))return r;var d=o(r),C=bs(d,o(a));return yi(d,C).join("")}function vd(r,a){var c=Pr,d=en;if(Ut(a)){var C="separator"in a?a.separator:C;c="length"in a?We(a.length):c,d="omission"in a?tr(a.omission):d}r=dt(r);var O=r.length;if(mi(r)){var B=o(r);O=B.length}if(c>=O)return r;var k=c-s(d);if(k<1)return d;var U=B?yi(B,0,k).join(""):r.slice(0,k);if(C===f)return U+d;if(B&&(k+=U.length-k),Lo(C)){if(r.slice(k).search(C)){var J,$=U;for(C.global||(C=Pe(C.source,dt(Fr.exec(C))+"g")),C.lastIndex=0;J=C.exec($);)var ee=J.index;U=U.slice(0,ee===f?k:ee)}}else if(r.indexOf(tr(C),k)!=k){var ce=U.lastIndexOf(C);ce>-1&&(U=U.slice(0,ce))}return U+d}function Md(r){return r=dt(r),r&&Mi.test(r)?r.replace(qe,u):r}var Od=us(function(r,a,c){return r+(c?" ":"")+a.toUpperCase()}),ko=Pl("toUpperCase");function Lc(r,a,c){return r=dt(r),a=c?f:a,a===f?Ss(r)?A(r):Qr(r):r.match(a)||[]}var Bc=Xe(function(r,a){try{return fn(r,f,a)}catch(c){return Ro(c)?c:new K(c)}}),Dd=ri(function(r,a){return Yn(a,function(c){c=zr(c),ti(r,c,Oo(r[c],r))}),r});function Rd(r){var a=r==null?0:r.length,c=ve();return r=a?Re(r,function(d){if(typeof d[1]!="function")throw new Bt(F);return[c(d[0]),d[1]]}):[],Xe(function(d){for(var C=-1;++C<a;){var O=r[C];if(fn(O[0],this,d))return fn(O[1],this,d)}})}function Ld(r){return i1(xr(r,H))}function Fo(r){return function(){return r}}function Bd(r,a){return r==null||r!==r?a:r}var Pd=Fl(),kd=Fl(!0);function qn(r){return r}function Uo(r){return gl(typeof r=="function"?r:xr(r,H))}function Fd(r){return pl(xr(r,H))}function Ud(r,a){return ml(r,xr(a,H))}var jd=Xe(function(r,a){return function(c){return Ls(c,r,a)}}),Hd=Xe(function(r,a){return function(c){return Ls(r,c,a)}});function jo(r,a,c){var d=gn(a),C=Aa(a,d);c==null&&!(Ut(a)&&(C.length||!d.length))&&(c=a,a=r,r=this,C=Aa(a,gn(a)));var O=!(Ut(c)&&"chain"in c)||!!c.chain,B=si(r);return Yn(C,function(k){var U=a[k];r[k]=U,B&&(r.prototype[k]=function(){var J=this.__chain__;if(O||J){var $=r(this.__wrapped__),ee=$.__actions__=Xn(this.__actions__);return ee.push({func:U,args:arguments,thisArg:r}),$.__chain__=J,$}return U.apply(r,$n([this.value()],arguments))})}),r}function zd(){return Jt._===this&&(Jt._=du),this}function Ho(){}function Wd(r){return r=We(r),Xe(function(a){return wl(a,r)})}var Gd=wo(Re),Vd=wo(ta),Yd=wo(be);function Pc(r){return _o(r)?is(zr(r)):E1(r)}function Xd(r){return function(a){return r==null?f:Xi(r,a)}}var Zd=jl(),Kd=jl(!0);function zo(){return[]}function Wo(){return!1}function qd(){return{}}function Qd(){return""}function Jd(){return!0}function $d(r,a){if(r=We(r),r<1||r>bn)return[];var c=pn,d=On(r,pn);a=ve(a),r-=pn;for(var C=Is(d,a);++c<r;)a(c);return C}function eg(r){return Fe(r)?Re(r,zr):nr(r)?[r]:Xn(nc(dt(r)))}function tg(r){var a=++Ka;return dt(r)+a}var ng=_a(function(r,a){return r+a},0),rg=Ao("ceil"),ig=_a(function(r,a){return r/a},1),sg=Ao("floor");function ag(r){return r&&r.length?wa(r,qn,ro):f}function og(r,a){return r&&r.length?wa(r,ve(a,2),ro):f}function lg(r){return rs(r,qn)}function cg(r,a){return rs(r,ve(a,2))}function ug(r){return r&&r.length?wa(r,qn,oo):f}function fg(r,a){return r&&r.length?wa(r,ve(a,2),oo):f}var hg=_a(function(r,a){return r*a},1),dg=Ao("round"),gg=_a(function(r,a){return r-a},0);function xg(r){return r&&r.length?Ui(r,qn):0}function pg(r,a){return r&&r.length?Ui(r,ve(a,2)):0}return N.after=Ff,N.ary=dc,N.assign=_h,N.assignIn=Tc,N.assignInWith=Fa,N.assignWith=Sh,N.at=Th,N.before=gc,N.bind=Oo,N.bindAll=Dd,N.bindKey=xc,N.castArray=qf,N.chain=uc,N.chunk=i0,N.compact=s0,N.concat=a0,N.cond=Rd,N.conforms=Ld,N.constant=Fo,N.countBy=xf,N.create=Nh,N.curry=pc,N.curryRight=mc,N.debounce=wc,N.defaults=vh,N.defaultsDeep=Mh,N.defer=Uf,N.delay=jf,N.difference=o0,N.differenceBy=l0,N.differenceWith=c0,N.drop=u0,N.dropRight=f0,N.dropRightWhile=h0,N.dropWhile=d0,N.fill=g0,N.filter=mf,N.flatMap=Cf,N.flatMapDeep=Ef,N.flatMapDepth=yf,N.flatten=ac,N.flattenDeep=x0,N.flattenDepth=p0,N.flip=Hf,N.flow=Pd,N.flowRight=kd,N.fromPairs=m0,N.functions=kh,N.functionsIn=Fh,N.groupBy=If,N.initial=A0,N.intersection=C0,N.intersectionBy=E0,N.intersectionWith=y0,N.invert=jh,N.invertBy=Hh,N.invokeMap=_f,N.iteratee=Uo,N.keyBy=Sf,N.keys=gn,N.keysIn=Kn,N.map=Da,N.mapKeys=Wh,N.mapValues=Gh,N.matches=Fd,N.matchesProperty=Ud,N.memoize=La,N.merge=Vh,N.mergeWith=Nc,N.method=jd,N.methodOf=Hd,N.mixin=jo,N.negate=Ba,N.nthArg=Wd,N.omit=Yh,N.omitBy=Xh,N.once=zf,N.orderBy=Tf,N.over=Gd,N.overArgs=Wf,N.overEvery=Vd,N.overSome=Yd,N.partial=Do,N.partialRight=Ac,N.partition=Nf,N.pick=Zh,N.pickBy=vc,N.property=Pc,N.propertyOf=Xd,N.pull=S0,N.pullAll=lc,N.pullAllBy=T0,N.pullAllWith=N0,N.pullAt=v0,N.range=Zd,N.rangeRight=Kd,N.rearg=Gf,N.reject=Of,N.remove=M0,N.rest=Vf,N.reverse=vo,N.sampleSize=Rf,N.set=qh,N.setWith=Qh,N.shuffle=Lf,N.slice=O0,N.sortBy=kf,N.sortedUniq=F0,N.sortedUniqBy=U0,N.split=Cd,N.spread=Yf,N.tail=j0,N.take=H0,N.takeRight=z0,N.takeRightWhile=W0,N.takeWhile=G0,N.tap=af,N.throttle=Xf,N.thru=Oa,N.toArray=bc,N.toPairs=Mc,N.toPairsIn=Oc,N.toPath=eg,N.toPlainObject=Sc,N.transform=Jh,N.unary=Zf,N.union=V0,N.unionBy=Y0,N.unionWith=X0,N.uniq=Z0,N.uniqBy=K0,N.uniqWith=q0,N.unset=$h,N.unzip=Mo,N.unzipWith=cc,N.update=ed,N.updateWith=td,N.values=ds,N.valuesIn=nd,N.without=Q0,N.words=Lc,N.wrap=Kf,N.xor=J0,N.xorBy=$0,N.xorWith=ef,N.zip=tf,N.zipObject=nf,N.zipObjectDeep=rf,N.zipWith=sf,N.entries=Mc,N.entriesIn=Oc,N.extend=Tc,N.extendWith=Fa,jo(N,N),N.add=ng,N.attempt=Bc,N.camelCase=ad,N.capitalize=Dc,N.ceil=rg,N.clamp=rd,N.clone=Qf,N.cloneDeep=$f,N.cloneDeepWith=eh,N.cloneWith=Jf,N.conformsTo=th,N.deburr=Rc,N.defaultTo=Bd,N.divide=ig,N.endsWith=od,N.eq=vr,N.escape=ld,N.escapeRegExp=cd,N.every=pf,N.find=wf,N.findIndex=ic,N.findKey=Oh,N.findLast=Af,N.findLastIndex=sc,N.findLastKey=Dh,N.floor=sg,N.forEach=fc,N.forEachRight=hc,N.forIn=Rh,N.forInRight=Lh,N.forOwn=Bh,N.forOwnRight=Ph,N.get=Bo,N.gt=nh,N.gte=rh,N.has=Uh,N.hasIn=Po,N.head=oc,N.identity=qn,N.includes=bf,N.indexOf=w0,N.inRange=id,N.invoke=zh,N.isArguments=qi,N.isArray=Fe,N.isArrayBuffer=ih,N.isArrayLike=Zn,N.isArrayLikeObject=Zt,N.isBoolean=sh,N.isBuffer=Ii,N.isDate=ah,N.isElement=oh,N.isEmpty=lh,N.isEqual=ch,N.isEqualWith=uh,N.isError=Ro,N.isFinite=fh,N.isFunction=si,N.isInteger=Cc,N.isLength=Pa,N.isMap=Ec,N.isMatch=hh,N.isMatchWith=dh,N.isNaN=gh,N.isNative=xh,N.isNil=mh,N.isNull=ph,N.isNumber=yc,N.isObject=Ut,N.isObjectLike=Wt,N.isPlainObject=js,N.isRegExp=Lo,N.isSafeInteger=wh,N.isSet=Ic,N.isString=ka,N.isSymbol=nr,N.isTypedArray=hs,N.isUndefined=Ah,N.isWeakMap=Ch,N.isWeakSet=Eh,N.join=I0,N.kebabCase=ud,N.last=mr,N.lastIndexOf=b0,N.lowerCase=fd,N.lowerFirst=hd,N.lt=yh,N.lte=Ih,N.max=ag,N.maxBy=og,N.mean=lg,N.meanBy=cg,N.min=ug,N.minBy=fg,N.stubArray=zo,N.stubFalse=Wo,N.stubObject=qd,N.stubString=Qd,N.stubTrue=Jd,N.multiply=hg,N.nth=_0,N.noConflict=zd,N.noop=Ho,N.now=Ra,N.pad=dd,N.padEnd=gd,N.padStart=xd,N.parseInt=pd,N.random=sd,N.reduce=vf,N.reduceRight=Mf,N.repeat=md,N.replace=wd,N.result=Kh,N.round=dg,N.runInContext=E,N.sample=Df,N.size=Bf,N.snakeCase=Ad,N.some=Pf,N.sortedIndex=D0,N.sortedIndexBy=R0,N.sortedIndexOf=L0,N.sortedLastIndex=B0,N.sortedLastIndexBy=P0,N.sortedLastIndexOf=k0,N.startCase=Ed,N.startsWith=yd,N.subtract=gg,N.sum=xg,N.sumBy=pg,N.template=Id,N.times=$d,N.toFinite=ai,N.toInteger=We,N.toLength=_c,N.toLower=bd,N.toNumber=wr,N.toSafeInteger=bh,N.toString=dt,N.toUpper=_d,N.trim=Sd,N.trimEnd=Td,N.trimStart=Nd,N.truncate=vd,N.unescape=Md,N.uniqueId=tg,N.upperCase=Od,N.upperFirst=ko,N.each=fc,N.eachRight=hc,N.first=oc,jo(N,(function(){var r={};return jr(N,function(a,c){et.call(N.prototype,c)||(r[c]=a)}),r})(),{chain:!1}),N.VERSION=y,Yn(["bind","bindKey","curry","curryRight","partial","partialRight"],function(r){N[r].placeholder=N}),Yn(["drop","take"],function(r,a){tt.prototype[r]=function(c){c=c===f?1:on(We(c),0);var d=this.__filtered__&&!a?new tt(this):this.clone();return d.__filtered__?d.__takeCount__=On(c,d.__takeCount__):d.__views__.push({size:On(c,pn),type:r+(d.__dir__<0?"Right":"")}),d},tt.prototype[r+"Right"]=function(c){return this.reverse()[r](c).reverse()}}),Yn(["filter","map","takeWhile"],function(r,a){var c=a+1,d=c==Mt||c==te;tt.prototype[r]=function(C){var O=this.clone();return O.__iteratees__.push({iteratee:ve(C,3),type:c}),O.__filtered__=O.__filtered__||d,O}}),Yn(["head","last"],function(r,a){var c="take"+(a?"Right":"");tt.prototype[r]=function(){return this[c](1).value()[0]}}),Yn(["initial","tail"],function(r,a){var c="drop"+(a?"":"Right");tt.prototype[r]=function(){return this.__filtered__?new tt(this):this[c](1)}}),tt.prototype.compact=function(){return this.filter(qn)},tt.prototype.find=function(r){return this.filter(r).head()},tt.prototype.findLast=function(r){return this.reverse().find(r)},tt.prototype.invokeMap=Xe(function(r,a){return typeof r=="function"?new tt(this):this.map(function(c){return Ls(c,r,a)})}),tt.prototype.reject=function(r){return this.filter(Ba(ve(r)))},tt.prototype.slice=function(r,a){r=We(r);var c=this;return c.__filtered__&&(r>0||a<0)?new tt(c):(r<0?c=c.takeRight(-r):r&&(c=c.drop(r)),a!==f&&(a=We(a),c=a<0?c.dropRight(-a):c.take(a-r)),c)},tt.prototype.takeRightWhile=function(r){return this.reverse().takeWhile(r).reverse()},tt.prototype.toArray=function(){return this.take(pn)},jr(tt.prototype,function(r,a){var c=/^(?:filter|find|map|reject)|While$/.test(a),d=/^(?:head|last)$/.test(a),C=N[d?"take"+(a=="last"?"Right":""):a],O=d||/^find/.test(a);C&&(N.prototype[a]=function(){var B=this.__wrapped__,k=d?[1]:arguments,U=B instanceof tt,J=k[0],$=U||Fe(B),ee=function(Je){var nt=C.apply(N,$n([Je],k));return d&&ce?nt[0]:nt};$&&c&&typeof J=="function"&&J.length!=1&&(U=$=!1);var ce=this.__chain__,we=!!this.__actions__.length,Me=O&&!ce,Ve=U&&!we;if(!O&&$){B=Ve?B:new tt(this);var Oe=r.apply(B,k);return Oe.__actions__.push({func:Oa,args:[ee],thisArg:f}),new gr(Oe,ce)}return Me&&Ve?r.apply(this,k):(Oe=this.thru(ee),Me?d?Oe.value()[0]:Oe.value():Oe)})}),Yn(["pop","push","shift","sort","splice","unshift"],function(r){var a=an[r],c=/^(?:push|sort|unshift)$/.test(r)?"tap":"thru",d=/^(?:pop|shift)$/.test(r);N.prototype[r]=function(){var C=arguments;if(d&&!this.__chain__){var O=this.value();return a.apply(Fe(O)?O:[],C)}return this[c](function(B){return a.apply(Fe(B)?B:[],C)})}}),jr(tt.prototype,function(r,a){var c=N[a];if(c){var d=c.name+"";et.call(os,d)||(os[d]=[]),os[d].push({name:a,func:c})}}),os[ba(f,yt).name]=[{name:"wrapper",func:f}],tt.prototype.clone=vu,tt.prototype.reverse=Mu,tt.prototype.value=Ou,N.prototype.at=of,N.prototype.chain=lf,N.prototype.commit=cf,N.prototype.next=uf,N.prototype.plant=hf,N.prototype.reverse=df,N.prototype.toJSON=N.prototype.valueOf=N.prototype.value=gf,N.prototype.first=N.prototype.head,Ts&&(N.prototype[Ts]=ff),N}),L=b();qr?((qr.exports=L)._=L,Cs._=L):Jt._=L}).call(Wg)})(Vs,Vs.exports)),Vs.exports}var Vg=Gg(),he;(function(x){x[x.QR_CODE=0]="QR_CODE",x[x.AZTEC=1]="AZTEC",x[x.CODABAR=2]="CODABAR",x[x.CODE_39=3]="CODE_39",x[x.CODE_93=4]="CODE_93",x[x.CODE_128=5]="CODE_128",x[x.DATA_MATRIX=6]="DATA_MATRIX",x[x.MAXICODE=7]="MAXICODE",x[x.ITF=8]="ITF",x[x.EAN_13=9]="EAN_13",x[x.EAN_8=10]="EAN_8",x[x.PDF_417=11]="PDF_417",x[x.RSS_14=12]="RSS_14",x[x.RSS_EXPANDED=13]="RSS_EXPANDED",x[x.UPC_A=14]="UPC_A",x[x.UPC_E=15]="UPC_E",x[x.UPC_EAN_EXTENSION=16]="UPC_EAN_EXTENSION"})(he||(he={}));var Wc=new Map([[he.QR_CODE,"QR_CODE"],[he.AZTEC,"AZTEC"],[he.CODABAR,"CODABAR"],[he.CODE_39,"CODE_39"],[he.CODE_93,"CODE_93"],[he.CODE_128,"CODE_128"],[he.DATA_MATRIX,"DATA_MATRIX"],[he.MAXICODE,"MAXICODE"],[he.ITF,"ITF"],[he.EAN_13,"EAN_13"],[he.EAN_8,"EAN_8"],[he.PDF_417,"PDF_417"],[he.RSS_14,"RSS_14"],[he.RSS_EXPANDED,"RSS_EXPANDED"],[he.UPC_A,"UPC_A"],[he.UPC_E,"UPC_E"],[he.UPC_EAN_EXTENSION,"UPC_EAN_EXTENSION"]]),Gc;(function(x){x[x.UNKNOWN=0]="UNKNOWN",x[x.URL=1]="URL"})(Gc||(Gc={}));function Yg(x){return Object.values(he).includes(x)}var Si;(function(x){x[x.SCAN_TYPE_CAMERA=0]="SCAN_TYPE_CAMERA",x[x.SCAN_TYPE_FILE=1]="SCAN_TYPE_FILE"})(Si||(Si={}));var Br=(function(){function x(){}return x.GITHUB_PROJECT_URL="https://github.com/mebjas/html5-qrcode",x.SCAN_DEFAULT_FPS=2,x.DEFAULT_DISABLE_FLIP=!1,x.DEFAULT_REMEMBER_LAST_CAMERA_USED=!0,x.DEFAULT_SUPPORTED_SCAN_TYPE=[Si.SCAN_TYPE_CAMERA,Si.SCAN_TYPE_FILE],x})(),su=(function(){function x(g,f){this.format=g,this.formatName=f}return x.prototype.toString=function(){return this.formatName},x.create=function(g){if(!Wc.has(g))throw"".concat(g," not in html5QrcodeSupportedFormatsTextMap");return new x(g,Wc.get(g))},x})(),Vc=(function(){function x(){}return x.createFromText=function(g){var f={text:g};return{decodedText:g,result:f}},x.createFromQrcodeResult=function(g){return{decodedText:g.text,result:g}},x})(),Xo;(function(x){x[x.UNKWOWN_ERROR=0]="UNKWOWN_ERROR",x[x.IMPLEMENTATION_ERROR=1]="IMPLEMENTATION_ERROR",x[x.NO_CODE_FOUND_ERROR=2]="NO_CODE_FOUND_ERROR"})(Xo||(Xo={}));var au=(function(){function x(){}return x.createFrom=function(g){return{errorMessage:g,type:Xo.UNKWOWN_ERROR}},x})(),ou=(function(){function x(g){this.verbose=g}return x.prototype.log=function(g){this.verbose&&console.log(g)},x.prototype.warn=function(g){this.verbose&&console.warn(g)},x.prototype.logError=function(g,f){(this.verbose||f===!0)&&console.error(g)},x.prototype.logErrors=function(g){if(g.length===0)throw"Logger#logError called without arguments";this.verbose&&console.error(g)},x})();function Gr(x){return typeof x>"u"||x===null}function Xg(x,g,f){return x>f?f:x<g?g:x}var gs=(function(){function x(){}return x.codeParseError=function(g){return"QR code parse error, error = ".concat(g)},x.errorGettingUserMedia=function(g){return"Error getting userMedia, error = ".concat(g)},x.onlyDeviceSupportedError=function(){return"The device doesn't support navigator.mediaDevices , only supported cameraIdOrConfig in this case is deviceId parameter (string)."},x.cameraStreamingNotSupported=function(){return"Camera streaming not supported by the browser."},x.unableToQuerySupportedDevices=function(){return"Unable to query supported devices, unknown error."},x.insecureContextCameraQueryError=function(){return"Camera access is only supported in secure context like https or localhost."},x.scannerPaused=function(){return"Scanner paused"},x})(),At=(function(){function x(){}return x.scanningStatus=function(){return"Scanning"},x.idleStatus=function(){return"Idle"},x.errorStatus=function(){return"Error"},x.permissionStatus=function(){return"Permission"},x.noCameraFoundErrorStatus=function(){return"No Cameras"},x.lastMatch=function(g){return"Last Match: ".concat(g)},x.codeScannerTitle=function(){return"Code Scanner"},x.cameraPermissionTitle=function(){return"Request Camera Permissions"},x.cameraPermissionRequesting=function(){return"Requesting camera permissions..."},x.noCameraFound=function(){return"No camera found"},x.scanButtonStopScanningText=function(){return"Stop Scanning"},x.scanButtonStartScanningText=function(){return"Start Scanning"},x.torchOnButton=function(){return"Switch On Torch"},x.torchOffButton=function(){return"Switch Off Torch"},x.torchOnFailedMessage=function(){return"Failed to turn on torch"},x.torchOffFailedMessage=function(){return"Failed to turn off torch"},x.scanButtonScanningStarting=function(){return"Launching Camera..."},x.textIfCameraScanSelected=function(){return"Scan an Image File"},x.textIfFileScanSelected=function(){return"Scan using camera directly"},x.selectCamera=function(){return"Select Camera"},x.fileSelectionChooseImage=function(){return"Choose Image"},x.fileSelectionChooseAnother=function(){return"Choose Another"},x.fileSelectionNoImageSelected=function(){return"No image choosen"},x.anonymousCameraPrefix=function(){return"Anonymous Camera"},x.dragAndDropMessage=function(){return"Or drop an image to scan"},x.dragAndDropMessageOnlyImages=function(){return"Or drop an image to scan (other files not supported)"},x.zoom=function(){return"zoom"},x.loadingImage=function(){return"Loading image..."},x.cameraScanAltText=function(){return"Camera based scan"},x.fileScanAltText=function(){return"Fule based scan"},x})(),Yc=(function(){function x(){}return x.poweredBy=function(){return"Powered by "},x.reportIssues=function(){return"Report issues"},x})(),lu=(function(){function x(){}return x.isMediaStreamConstraintsValid=function(g,f){if(typeof g!="object"){var y=typeof g;return f.logError("videoConstraints should be of type object, the "+"object passed is of type ".concat(y,"."),!0),!1}for(var S=["autoGainControl","channelCount","echoCancellation","latency","noiseSuppression","sampleRate","sampleSize","volume"],m=new Set(S),F=Object.keys(g),W=0,Z=F;W<Z.length;W++){var T=Z[W];if(m.has(T))return f.logError("".concat(T," is not supported videoConstaints."),!0),!1}return!0},x})(),Ys={exports:{}},Zg=Ys.exports,Xc;function Kg(){return Xc||(Xc=1,(function(x,g){(function(f,y){y(g)})(Zg,(function(f){function y(w){return w==null}var S=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(w,e){w.__proto__=e}||function(w,e){for(var t in e)e.hasOwnProperty(t)&&(w[t]=e[t])};function m(w,e){S(w,e);function t(){this.constructor=w}w.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}function F(w,e){var t=Object.setPrototypeOf;t?t(w,e):w.__proto__=e}function W(w,e){e===void 0&&(e=w.constructor);var t=Error.captureStackTrace;t&&t(w,e)}var Z=(function(w){m(e,w);function e(t){var n=this.constructor,i=w.call(this,t)||this;return Object.defineProperty(i,"name",{value:n.name,enumerable:!1}),F(i,n.prototype),W(i),i}return e})(Error);class T extends Z{constructor(e=void 0){super(e),this.message=e}getKind(){return this.constructor.kind}}T.kind="Exception";class z extends T{}z.kind="ArgumentException";class H extends T{}H.kind="IllegalArgumentException";class Le{constructor(e){if(this.binarizer=e,e===null)throw new H("Binarizer must be non-null.")}getWidth(){return this.binarizer.getWidth()}getHeight(){return this.binarizer.getHeight()}getBlackRow(e,t){return this.binarizer.getBlackRow(e,t)}getBlackMatrix(){return(this.matrix===null||this.matrix===void 0)&&(this.matrix=this.binarizer.getBlackMatrix()),this.matrix}isCropSupported(){return this.binarizer.getLuminanceSource().isCropSupported()}crop(e,t,n,i){const s=this.binarizer.getLuminanceSource().crop(e,t,n,i);return new Le(this.binarizer.createBinarizer(s))}isRotateSupported(){return this.binarizer.getLuminanceSource().isRotateSupported()}rotateCounterClockwise(){const e=this.binarizer.getLuminanceSource().rotateCounterClockwise();return new Le(this.binarizer.createBinarizer(e))}rotateCounterClockwise45(){const e=this.binarizer.getLuminanceSource().rotateCounterClockwise45();return new Le(this.binarizer.createBinarizer(e))}toString(){try{return this.getBlackMatrix().toString()}catch{return""}}}class Ee extends T{static getChecksumInstance(){return new Ee}}Ee.kind="ChecksumException";class ct{constructor(e){this.source=e}getLuminanceSource(){return this.source}getWidth(){return this.source.getWidth()}getHeight(){return this.source.getHeight()}}class ge{static arraycopy(e,t,n,i,s){for(;s--;)n[i++]=e[t++]}static currentTimeMillis(){return Date.now()}}class Ue extends T{}Ue.kind="IndexOutOfBoundsException";class yt extends Ue{constructor(e=void 0,t=void 0){super(t),this.index=e,this.message=t}}yt.kind="ArrayIndexOutOfBoundsException";class Ye{static fill(e,t){for(let n=0,i=e.length;n<i;n++)e[n]=t}static fillWithin(e,t,n,i){Ye.rangeCheck(e.length,t,n);for(let s=t;s<n;s++)e[s]=i}static rangeCheck(e,t,n){if(t>n)throw new H("fromIndex("+t+") > toIndex("+n+")");if(t<0)throw new yt(t);if(n>e)throw new yt(n)}static asList(...e){return e}static create(e,t,n){return Array.from({length:e}).map(s=>Array.from({length:t}).fill(n))}static createInt32Array(e,t,n){return Array.from({length:e}).map(s=>Int32Array.from({length:t}).fill(n))}static equals(e,t){if(!e||!t||!e.length||!t.length||e.length!==t.length)return!1;for(let n=0,i=e.length;n<i;n++)if(e[n]!==t[n])return!1;return!0}static hashCode(e){if(e===null)return 0;let t=1;for(const n of e)t=31*t+n;return t}static fillUint8Array(e,t){for(let n=0;n!==e.length;n++)e[n]=t}static copyOf(e,t){return e.slice(0,t)}static copyOfUint8Array(e,t){if(e.length<=t){const n=new Uint8Array(t);return n.set(e),n}return e.slice(0,t)}static copyOfRange(e,t,n){const i=n-t,s=new Int32Array(i);return ge.arraycopy(e,t,s,0,i),s}static binarySearch(e,t,n){n===void 0&&(n=Ye.numberComparator);let i=0,s=e.length-1;for(;i<=s;){const o=s+i>>1,l=n(t,e[o]);if(l>0)i=o+1;else if(l<0)s=o-1;else return o}return-i-1}static numberComparator(e,t){return e-t}}class fe{static numberOfTrailingZeros(e){let t;if(e===0)return 32;let n=31;return t=e<<16,t!==0&&(n-=16,e=t),t=e<<8,t!==0&&(n-=8,e=t),t=e<<4,t!==0&&(n-=4,e=t),t=e<<2,t!==0&&(n-=2,e=t),n-(e<<1>>>31)}static numberOfLeadingZeros(e){if(e===0)return 32;let t=1;return e>>>16||(t+=16,e<<=16),e>>>24||(t+=8,e<<=8),e>>>28||(t+=4,e<<=4),e>>>30||(t+=2,e<<=2),t-=e>>>31,t}static toHexString(e){return e.toString(16)}static toBinaryString(e){return String(parseInt(String(e),2))}static bitCount(e){return e=e-(e>>>1&1431655765),e=(e&858993459)+(e>>>2&858993459),e=e+(e>>>4)&252645135,e=e+(e>>>8),e=e+(e>>>16),e&63}static truncDivision(e,t){return Math.trunc(e/t)}static parseInt(e,t=void 0){return parseInt(e,t)}}fe.MIN_VALUE_32_BITS=-2147483648,fe.MAX_VALUE=Number.MAX_SAFE_INTEGER;class _e{constructor(e,t){e===void 0?(this.size=0,this.bits=new Int32Array(1)):(this.size=e,t==null?this.bits=_e.makeArray(e):this.bits=t)}getSize(){return this.size}getSizeInBytes(){return Math.floor((this.size+7)/8)}ensureCapacity(e){if(e>this.bits.length*32){const t=_e.makeArray(e);ge.arraycopy(this.bits,0,t,0,this.bits.length),this.bits=t}}get(e){return(this.bits[Math.floor(e/32)]&1<<(e&31))!==0}set(e){this.bits[Math.floor(e/32)]|=1<<(e&31)}flip(e){this.bits[Math.floor(e/32)]^=1<<(e&31)}getNextSet(e){const t=this.size;if(e>=t)return t;const n=this.bits;let i=Math.floor(e/32),s=n[i];s&=~((1<<(e&31))-1);const o=n.length;for(;s===0;){if(++i===o)return t;s=n[i]}const l=i*32+fe.numberOfTrailingZeros(s);return l>t?t:l}getNextUnset(e){const t=this.size;if(e>=t)return t;const n=this.bits;let i=Math.floor(e/32),s=~n[i];s&=~((1<<(e&31))-1);const o=n.length;for(;s===0;){if(++i===o)return t;s=~n[i]}const l=i*32+fe.numberOfTrailingZeros(s);return l>t?t:l}setBulk(e,t){this.bits[Math.floor(e/32)]=t}setRange(e,t){if(t<e||e<0||t>this.size)throw new H;if(t===e)return;t--;const n=Math.floor(e/32),i=Math.floor(t/32),s=this.bits;for(let o=n;o<=i;o++){const l=o>n?0:e&31,h=(2<<(o<i?31:t&31))-(1<<l);s[o]|=h}}clear(){const e=this.bits.length,t=this.bits;for(let n=0;n<e;n++)t[n]=0}isRange(e,t,n){if(t<e||e<0||t>this.size)throw new H;if(t===e)return!0;t--;const i=Math.floor(e/32),s=Math.floor(t/32),o=this.bits;for(let l=i;l<=s;l++){const u=l>i?0:e&31,p=(2<<(l<s?31:t&31))-(1<<u)&4294967295;if((o[l]&p)!==(n?p:0))return!1}return!0}appendBit(e){this.ensureCapacity(this.size+1),e&&(this.bits[Math.floor(this.size/32)]|=1<<(this.size&31)),this.size++}appendBits(e,t){if(t<0||t>32)throw new H("Num bits must be between 0 and 32");this.ensureCapacity(this.size+t);for(let n=t;n>0;n--)this.appendBit((e>>n-1&1)===1)}appendBitArray(e){const t=e.size;this.ensureCapacity(this.size+t);for(let n=0;n<t;n++)this.appendBit(e.get(n))}xor(e){if(this.size!==e.size)throw new H("Sizes don't match");const t=this.bits;for(let n=0,i=t.length;n<i;n++)t[n]^=e.bits[n]}toBytes(e,t,n,i){for(let s=0;s<i;s++){let o=0;for(let l=0;l<8;l++)this.get(e)&&(o|=1<<7-l),e++;t[n+s]=o}}getBitArray(){return this.bits}reverse(){const e=new Int32Array(this.bits.length),t=Math.floor((this.size-1)/32),n=t+1,i=this.bits;for(let s=0;s<n;s++){let o=i[s];o=o>>1&1431655765|(o&1431655765)<<1,o=o>>2&858993459|(o&858993459)<<2,o=o>>4&252645135|(o&252645135)<<4,o=o>>8&16711935|(o&16711935)<<8,o=o>>16&65535|(o&65535)<<16,e[t-s]=o}if(this.size!==n*32){const s=n*32-this.size;let o=e[0]>>>s;for(let l=1;l<n;l++){const u=e[l];o|=u<<32-s,e[l-1]=o,o=u>>>s}e[n-1]=o}this.bits=e}static makeArray(e){return new Int32Array(Math.floor((e+31)/32))}equals(e){if(!(e instanceof _e))return!1;const t=e;return this.size===t.size&&Ye.equals(this.bits,t.bits)}hashCode(){return 31*this.size+Ye.hashCode(this.bits)}toString(){let e="";for(let t=0,n=this.size;t<n;t++)(t&7)===0&&(e+=" "),e+=this.get(t)?"X":".";return e}clone(){return new _e(this.size,this.bits.slice())}}var It;(function(w){w[w.OTHER=0]="OTHER",w[w.PURE_BARCODE=1]="PURE_BARCODE",w[w.POSSIBLE_FORMATS=2]="POSSIBLE_FORMATS",w[w.TRY_HARDER=3]="TRY_HARDER",w[w.CHARACTER_SET=4]="CHARACTER_SET",w[w.ALLOWED_LENGTHS=5]="ALLOWED_LENGTHS",w[w.ASSUME_CODE_39_CHECK_DIGIT=6]="ASSUME_CODE_39_CHECK_DIGIT",w[w.ASSUME_GS1=7]="ASSUME_GS1",w[w.RETURN_CODABAR_START_END=8]="RETURN_CODABAR_START_END",w[w.NEED_RESULT_POINT_CALLBACK=9]="NEED_RESULT_POINT_CALLBACK",w[w.ALLOWED_EAN_EXTENSIONS=10]="ALLOWED_EAN_EXTENSIONS"})(It||(It={}));var Be=It;class re extends T{static getFormatInstance(){return new re}}re.kind="FormatException";var Ge;(function(w){w[w.Cp437=0]="Cp437",w[w.ISO8859_1=1]="ISO8859_1",w[w.ISO8859_2=2]="ISO8859_2",w[w.ISO8859_3=3]="ISO8859_3",w[w.ISO8859_4=4]="ISO8859_4",w[w.ISO8859_5=5]="ISO8859_5",w[w.ISO8859_6=6]="ISO8859_6",w[w.ISO8859_7=7]="ISO8859_7",w[w.ISO8859_8=8]="ISO8859_8",w[w.ISO8859_9=9]="ISO8859_9",w[w.ISO8859_10=10]="ISO8859_10",w[w.ISO8859_11=11]="ISO8859_11",w[w.ISO8859_13=12]="ISO8859_13",w[w.ISO8859_14=13]="ISO8859_14",w[w.ISO8859_15=14]="ISO8859_15",w[w.ISO8859_16=15]="ISO8859_16",w[w.SJIS=16]="SJIS",w[w.Cp1250=17]="Cp1250",w[w.Cp1251=18]="Cp1251",w[w.Cp1252=19]="Cp1252",w[w.Cp1256=20]="Cp1256",w[w.UnicodeBigUnmarked=21]="UnicodeBigUnmarked",w[w.UTF8=22]="UTF8",w[w.ASCII=23]="ASCII",w[w.Big5=24]="Big5",w[w.GB18030=25]="GB18030",w[w.EUC_KR=26]="EUC_KR"})(Ge||(Ge={}));class ie{constructor(e,t,n,...i){this.valueIdentifier=e,this.name=n,typeof t=="number"?this.values=Int32Array.from([t]):this.values=t,this.otherEncodingNames=i,ie.VALUE_IDENTIFIER_TO_ECI.set(e,this),ie.NAME_TO_ECI.set(n,this);const s=this.values;for(let o=0,l=s.length;o!==l;o++){const u=s[o];ie.VALUES_TO_ECI.set(u,this)}for(const o of i)ie.NAME_TO_ECI.set(o,this)}getValueIdentifier(){return this.valueIdentifier}getName(){return this.name}getValue(){return this.values[0]}static getCharacterSetECIByValue(e){if(e<0||e>=900)throw new re("incorect value");const t=ie.VALUES_TO_ECI.get(e);if(t===void 0)throw new re("incorect value");return t}static getCharacterSetECIByName(e){const t=ie.NAME_TO_ECI.get(e);if(t===void 0)throw new re("incorect value");return t}equals(e){if(!(e instanceof ie))return!1;const t=e;return this.getName()===t.getName()}}ie.VALUE_IDENTIFIER_TO_ECI=new Map,ie.VALUES_TO_ECI=new Map,ie.NAME_TO_ECI=new Map,ie.Cp437=new ie(Ge.Cp437,Int32Array.from([0,2]),"Cp437"),ie.ISO8859_1=new ie(Ge.ISO8859_1,Int32Array.from([1,3]),"ISO-8859-1","ISO88591","ISO8859_1"),ie.ISO8859_2=new ie(Ge.ISO8859_2,4,"ISO-8859-2","ISO88592","ISO8859_2"),ie.ISO8859_3=new ie(Ge.ISO8859_3,5,"ISO-8859-3","ISO88593","ISO8859_3"),ie.ISO8859_4=new ie(Ge.ISO8859_4,6,"ISO-8859-4","ISO88594","ISO8859_4"),ie.ISO8859_5=new ie(Ge.ISO8859_5,7,"ISO-8859-5","ISO88595","ISO8859_5"),ie.ISO8859_6=new ie(Ge.ISO8859_6,8,"ISO-8859-6","ISO88596","ISO8859_6"),ie.ISO8859_7=new ie(Ge.ISO8859_7,9,"ISO-8859-7","ISO88597","ISO8859_7"),ie.ISO8859_8=new ie(Ge.ISO8859_8,10,"ISO-8859-8","ISO88598","ISO8859_8"),ie.ISO8859_9=new ie(Ge.ISO8859_9,11,"ISO-8859-9","ISO88599","ISO8859_9"),ie.ISO8859_10=new ie(Ge.ISO8859_10,12,"ISO-8859-10","ISO885910","ISO8859_10"),ie.ISO8859_11=new ie(Ge.ISO8859_11,13,"ISO-8859-11","ISO885911","ISO8859_11"),ie.ISO8859_13=new ie(Ge.ISO8859_13,15,"ISO-8859-13","ISO885913","ISO8859_13"),ie.ISO8859_14=new ie(Ge.ISO8859_14,16,"ISO-8859-14","ISO885914","ISO8859_14"),ie.ISO8859_15=new ie(Ge.ISO8859_15,17,"ISO-8859-15","ISO885915","ISO8859_15"),ie.ISO8859_16=new ie(Ge.ISO8859_16,18,"ISO-8859-16","ISO885916","ISO8859_16"),ie.SJIS=new ie(Ge.SJIS,20,"SJIS","Shift_JIS"),ie.Cp1250=new ie(Ge.Cp1250,21,"Cp1250","windows-1250"),ie.Cp1251=new ie(Ge.Cp1251,22,"Cp1251","windows-1251"),ie.Cp1252=new ie(Ge.Cp1252,23,"Cp1252","windows-1252"),ie.Cp1256=new ie(Ge.Cp1256,24,"Cp1256","windows-1256"),ie.UnicodeBigUnmarked=new ie(Ge.UnicodeBigUnmarked,25,"UnicodeBigUnmarked","UTF-16BE","UnicodeBig"),ie.UTF8=new ie(Ge.UTF8,26,"UTF8","UTF-8"),ie.ASCII=new ie(Ge.ASCII,Int32Array.from([27,170]),"ASCII","US-ASCII"),ie.Big5=new ie(Ge.Big5,28,"Big5"),ie.GB18030=new ie(Ge.GB18030,29,"GB18030","GB2312","EUC_CN","GBK"),ie.EUC_KR=new ie(Ge.EUC_KR,30,"EUC_KR","EUC-KR");class Pr extends T{}Pr.kind="UnsupportedOperationException";class en{static decode(e,t){const n=this.encodingName(t);return this.customDecoder?this.customDecoder(e,n):typeof TextDecoder>"u"||this.shouldDecodeOnFallback(n)?this.decodeFallback(e,n):new TextDecoder(n).decode(e)}static shouldDecodeOnFallback(e){return!en.isBrowser()&&e==="ISO-8859-1"}static encode(e,t){const n=this.encodingName(t);return this.customEncoder?this.customEncoder(e,n):typeof TextEncoder>"u"?this.encodeFallback(e):new TextEncoder().encode(e)}static isBrowser(){return typeof window<"u"&&{}.toString.call(window)==="[object Window]"}static encodingName(e){return typeof e=="string"?e:e.getName()}static encodingCharacterSet(e){return e instanceof ie?e:ie.getCharacterSetECIByName(e)}static decodeFallback(e,t){const n=this.encodingCharacterSet(t);if(en.isDecodeFallbackSupported(n)){let i="";for(let s=0,o=e.length;s<o;s++){let l=e[s].toString(16);l.length<2&&(l="0"+l),i+="%"+l}return decodeURIComponent(i)}if(n.equals(ie.UnicodeBigUnmarked))return String.fromCharCode.apply(null,new Uint16Array(e.buffer));throw new Pr(`Encoding ${this.encodingName(t)} not supported by fallback.`)}static isDecodeFallbackSupported(e){return e.equals(ie.UTF8)||e.equals(ie.ISO8859_1)||e.equals(ie.ASCII)}static encodeFallback(e){const n=btoa(unescape(encodeURIComponent(e))).split(""),i=[];for(let s=0;s<n.length;s++)i.push(n[s].charCodeAt(0));return new Uint8Array(i)}}class ye{static castAsNonUtf8Char(e,t=null){const n=t?t.getName():this.ISO88591;return en.decode(new Uint8Array([e]),n)}static guessEncoding(e,t){if(t!=null&&t.get(Be.CHARACTER_SET)!==void 0)return t.get(Be.CHARACTER_SET).toString();const n=e.length;let i=!0,s=!0,o=!0,l=0,u=0,h=0,p=0,A=0,b=0,L=0,E=0,M=0,D=0,P=0;const K=e.length>3&&e[0]===239&&e[1]===187&&e[2]===191;for(let q=0;q<n&&(i||s||o);q++){const Q=e[q]&255;o&&(l>0?(Q&128)===0?o=!1:l--:(Q&128)!==0&&((Q&64)===0?o=!1:(l++,(Q&32)===0?u++:(l++,(Q&16)===0?h++:(l++,(Q&8)===0?p++:o=!1))))),i&&(Q>127&&Q<160?i=!1:Q>159&&(Q<192||Q===215||Q===247)&&P++),s&&(A>0?Q<64||Q===127||Q>252?s=!1:A--:Q===128||Q===160||Q>239?s=!1:Q>160&&Q<224?(b++,E=0,L++,L>M&&(M=L)):Q>127?(A++,L=0,E++,E>D&&(D=E)):(L=0,E=0))}return o&&l>0&&(o=!1),s&&A>0&&(s=!1),o&&(K||u+h+p>0)?ye.UTF8:s&&(ye.ASSUME_SHIFT_JIS||M>=3||D>=3)?ye.SHIFT_JIS:i&&s?M===2&&b===2||P*10>=n?ye.SHIFT_JIS:ye.ISO88591:i?ye.ISO88591:s?ye.SHIFT_JIS:o?ye.UTF8:ye.PLATFORM_DEFAULT_ENCODING}static format(e,...t){let n=-1;function i(o,l,u,h,p,A){if(o==="%%")return"%";if(t[++n]===void 0)return;o=h?parseInt(h.substr(1)):void 0;let b=p?parseInt(p.substr(1)):void 0,L;switch(A){case"s":L=t[n];break;case"c":L=t[n][0];break;case"f":L=parseFloat(t[n]).toFixed(o);break;case"p":L=parseFloat(t[n]).toPrecision(o);break;case"e":L=parseFloat(t[n]).toExponential(o);break;case"x":L=parseInt(t[n]).toString(b||16);break;case"d":L=parseFloat(parseInt(t[n],b||10).toPrecision(o)).toFixed(0);break}L=typeof L=="object"?JSON.stringify(L):(+L).toString(b);let E=parseInt(u),M=u&&u[0]+""=="0"?"0":" ";for(;L.length<E;)L=l!==void 0?L+M:M+L;return L}let s=/%(-)?(0?[0-9]+)?([.][0-9]+)?([#][0-9]+)?([scfpexd%])/g;return e.replace(s,i)}static getBytes(e,t){return en.encode(e,t)}static getCharCode(e,t=0){return e.charCodeAt(t)}static getCharAt(e){return String.fromCharCode(e)}}ye.SHIFT_JIS=ie.SJIS.getName(),ye.GB2312="GB2312",ye.ISO88591=ie.ISO8859_1.getName(),ye.EUC_JP="EUC_JP",ye.UTF8=ie.UTF8.getName(),ye.PLATFORM_DEFAULT_ENCODING=ye.UTF8,ye.ASSUME_SHIFT_JIS=!1;class rt{constructor(e=""){this.value=e}enableDecoding(e){return this.encoding=e,this}append(e){return typeof e=="string"?this.value+=e.toString():this.encoding?this.value+=ye.castAsNonUtf8Char(e,this.encoding):this.value+=String.fromCharCode(e),this}appendChars(e,t,n){for(let i=t;t<t+n;i++)this.append(e[i]);return this}length(){return this.value.length}charAt(e){return this.value.charAt(e)}deleteCharAt(e){this.value=this.value.substr(0,e)+this.value.substring(e+1)}setCharAt(e,t){this.value=this.value.substr(0,e)+t+this.value.substr(e+1)}substring(e,t){return this.value.substring(e,t)}setLengthToZero(){this.value=""}toString(){return this.value}insert(e,t){this.value=this.value.substr(0,e)+t+this.value.substr(e+t.length)}}class Mt{constructor(e,t,n,i){if(this.width=e,this.height=t,this.rowSize=n,this.bits=i,t==null&&(t=e),this.height=t,e<1||t<1)throw new H("Both dimensions must be greater than 0");n==null&&(n=Math.floor((e+31)/32)),this.rowSize=n,i==null&&(this.bits=new Int32Array(this.rowSize*this.height))}static parseFromBooleanArray(e){const t=e.length,n=e[0].length,i=new Mt(n,t);for(let s=0;s<t;s++){const o=e[s];for(let l=0;l<n;l++)o[l]&&i.set(l,s)}return i}static parseFromString(e,t,n){if(e===null)throw new H("stringRepresentation cannot be null");const i=new Array(e.length);let s=0,o=0,l=-1,u=0,h=0;for(;h<e.length;)if(e.charAt(h)===`
`||e.charAt(h)==="\r"){if(s>o){if(l===-1)l=s-o;else if(s-o!==l)throw new H("row lengths do not match");o=s,u++}h++}else if(e.substring(h,h+t.length)===t)h+=t.length,i[s]=!0,s++;else if(e.substring(h,h+n.length)===n)h+=n.length,i[s]=!1,s++;else throw new H("illegal character encountered: "+e.substring(h));if(s>o){if(l===-1)l=s-o;else if(s-o!==l)throw new H("row lengths do not match");u++}const p=new Mt(l,u);for(let A=0;A<s;A++)i[A]&&p.set(Math.floor(A%l),Math.floor(A/l));return p}get(e,t){const n=t*this.rowSize+Math.floor(e/32);return(this.bits[n]>>>(e&31)&1)!==0}set(e,t){const n=t*this.rowSize+Math.floor(e/32);this.bits[n]|=1<<(e&31)&4294967295}unset(e,t){const n=t*this.rowSize+Math.floor(e/32);this.bits[n]&=~(1<<(e&31)&4294967295)}flip(e,t){const n=t*this.rowSize+Math.floor(e/32);this.bits[n]^=1<<(e&31)&4294967295}xor(e){if(this.width!==e.getWidth()||this.height!==e.getHeight()||this.rowSize!==e.getRowSize())throw new H("input matrix dimensions do not match");const t=new _e(Math.floor(this.width/32)+1),n=this.rowSize,i=this.bits;for(let s=0,o=this.height;s<o;s++){const l=s*n,u=e.getRow(s,t).getBitArray();for(let h=0;h<n;h++)i[l+h]^=u[h]}}clear(){const e=this.bits,t=e.length;for(let n=0;n<t;n++)e[n]=0}setRegion(e,t,n,i){if(t<0||e<0)throw new H("Left and top must be nonnegative");if(i<1||n<1)throw new H("Height and width must be at least 1");const s=e+n,o=t+i;if(o>this.height||s>this.width)throw new H("The region must fit inside the matrix");const l=this.rowSize,u=this.bits;for(let h=t;h<o;h++){const p=h*l;for(let A=e;A<s;A++)u[p+Math.floor(A/32)]|=1<<(A&31)&4294967295}}getRow(e,t){t==null||t.getSize()<this.width?t=new _e(this.width):t.clear();const n=this.rowSize,i=this.bits,s=e*n;for(let o=0;o<n;o++)t.setBulk(o*32,i[s+o]);return t}setRow(e,t){ge.arraycopy(t.getBitArray(),0,this.bits,e*this.rowSize,this.rowSize)}rotate180(){const e=this.getWidth(),t=this.getHeight();let n=new _e(e),i=new _e(e);for(let s=0,o=Math.floor((t+1)/2);s<o;s++)n=this.getRow(s,n),i=this.getRow(t-1-s,i),n.reverse(),i.reverse(),this.setRow(s,i),this.setRow(t-1-s,n)}getEnclosingRectangle(){const e=this.width,t=this.height,n=this.rowSize,i=this.bits;let s=e,o=t,l=-1,u=-1;for(let h=0;h<t;h++)for(let p=0;p<n;p++){const A=i[h*n+p];if(A!==0){if(h<o&&(o=h),h>u&&(u=h),p*32<s){let b=0;for(;(A<<31-b&4294967295)===0;)b++;p*32+b<s&&(s=p*32+b)}if(p*32+31>l){let b=31;for(;!(A>>>b);)b--;p*32+b>l&&(l=p*32+b)}}}return l<s||u<o?null:Int32Array.from([s,o,l-s+1,u-o+1])}getTopLeftOnBit(){const e=this.rowSize,t=this.bits;let n=0;for(;n<t.length&&t[n]===0;)n++;if(n===t.length)return null;const i=n/e;let s=n%e*32;const o=t[n];let l=0;for(;(o<<31-l&4294967295)===0;)l++;return s+=l,Int32Array.from([s,i])}getBottomRightOnBit(){const e=this.rowSize,t=this.bits;let n=t.length-1;for(;n>=0&&t[n]===0;)n--;if(n<0)return null;const i=Math.floor(n/e);let s=Math.floor(n%e)*32;const o=t[n];let l=31;for(;!(o>>>l);)l--;return s+=l,Int32Array.from([s,i])}getWidth(){return this.width}getHeight(){return this.height}getRowSize(){return this.rowSize}equals(e){if(!(e instanceof Mt))return!1;const t=e;return this.width===t.width&&this.height===t.height&&this.rowSize===t.rowSize&&Ye.equals(this.bits,t.bits)}hashCode(){let e=this.width;return e=31*e+this.width,e=31*e+this.height,e=31*e+this.rowSize,e=31*e+Ye.hashCode(this.bits),e}toString(e="X ",t="  ",n=`
`){return this.buildToString(e,t,n)}buildToString(e,t,n){let i=new rt;for(let s=0,o=this.height;s<o;s++){for(let l=0,u=this.width;l<u;l++)i.append(this.get(l,s)?e:t);i.append(n)}return i.toString()}clone(){return new Mt(this.width,this.height,this.rowSize,this.bits.slice())}}class v extends T{static getNotFoundInstance(){return new v}}v.kind="NotFoundException";class te extends ct{constructor(e){super(e),this.luminances=te.EMPTY,this.buckets=new Int32Array(te.LUMINANCE_BUCKETS)}getBlackRow(e,t){const n=this.getLuminanceSource(),i=n.getWidth();t==null||t.getSize()<i?t=new _e(i):t.clear(),this.initArrays(i);const s=n.getRow(e,this.luminances),o=this.buckets;for(let u=0;u<i;u++)o[(s[u]&255)>>te.LUMINANCE_SHIFT]++;const l=te.estimateBlackPoint(o);if(i<3)for(let u=0;u<i;u++)(s[u]&255)<l&&t.set(u);else{let u=s[0]&255,h=s[1]&255;for(let p=1;p<i-1;p++){const A=s[p+1]&255;(h*4-u-A)/2<l&&t.set(p),u=h,h=A}}return t}getBlackMatrix(){const e=this.getLuminanceSource(),t=e.getWidth(),n=e.getHeight(),i=new Mt(t,n);this.initArrays(t);const s=this.buckets;for(let u=1;u<5;u++){const h=Math.floor(n*u/5),p=e.getRow(h,this.luminances),A=Math.floor(t*4/5);for(let b=Math.floor(t/5);b<A;b++){const L=p[b]&255;s[L>>te.LUMINANCE_SHIFT]++}}const o=te.estimateBlackPoint(s),l=e.getMatrix();for(let u=0;u<n;u++){const h=u*t;for(let p=0;p<t;p++)(l[h+p]&255)<o&&i.set(p,u)}return i}createBinarizer(e){return new te(e)}initArrays(e){this.luminances.length<e&&(this.luminances=new Uint8ClampedArray(e));const t=this.buckets;for(let n=0;n<te.LUMINANCE_BUCKETS;n++)t[n]=0}static estimateBlackPoint(e){const t=e.length;let n=0,i=0,s=0;for(let p=0;p<t;p++)e[p]>s&&(i=p,s=e[p]),e[p]>n&&(n=e[p]);let o=0,l=0;for(let p=0;p<t;p++){const A=p-i,b=e[p]*A*A;b>l&&(o=p,l=b)}if(i>o){const p=i;i=o,o=p}if(o-i<=t/16)throw new v;let u=o-1,h=-1;for(let p=o-1;p>i;p--){const A=p-i,b=A*A*(o-p)*(n-e[p]);b>h&&(u=p,h=b)}return u<<te.LUMINANCE_SHIFT}}te.LUMINANCE_BITS=5,te.LUMINANCE_SHIFT=8-te.LUMINANCE_BITS,te.LUMINANCE_BUCKETS=1<<te.LUMINANCE_BITS,te.EMPTY=Uint8ClampedArray.from([0]);class Te extends te{constructor(e){super(e),this.matrix=null}getBlackMatrix(){if(this.matrix!==null)return this.matrix;const e=this.getLuminanceSource(),t=e.getWidth(),n=e.getHeight();if(t>=Te.MINIMUM_DIMENSION&&n>=Te.MINIMUM_DIMENSION){const i=e.getMatrix();let s=t>>Te.BLOCK_SIZE_POWER;(t&Te.BLOCK_SIZE_MASK)!==0&&s++;let o=n>>Te.BLOCK_SIZE_POWER;(n&Te.BLOCK_SIZE_MASK)!==0&&o++;const l=Te.calculateBlackPoints(i,s,o,t,n),u=new Mt(t,n);Te.calculateThresholdForBlock(i,s,o,t,n,l,u),this.matrix=u}else this.matrix=super.getBlackMatrix();return this.matrix}createBinarizer(e){return new Te(e)}static calculateThresholdForBlock(e,t,n,i,s,o,l){const u=s-Te.BLOCK_SIZE,h=i-Te.BLOCK_SIZE;for(let p=0;p<n;p++){let A=p<<Te.BLOCK_SIZE_POWER;A>u&&(A=u);const b=Te.cap(p,2,n-3);for(let L=0;L<t;L++){let E=L<<Te.BLOCK_SIZE_POWER;E>h&&(E=h);const M=Te.cap(L,2,t-3);let D=0;for(let K=-2;K<=2;K++){const q=o[b+K];D+=q[M-2]+q[M-1]+q[M]+q[M+1]+q[M+2]}const P=D/25;Te.thresholdBlock(e,E,A,P,i,l)}}}static cap(e,t,n){return e<t?t:e>n?n:e}static thresholdBlock(e,t,n,i,s,o){for(let l=0,u=n*s+t;l<Te.BLOCK_SIZE;l++,u+=s)for(let h=0;h<Te.BLOCK_SIZE;h++)(e[u+h]&255)<=i&&o.set(t+h,n+l)}static calculateBlackPoints(e,t,n,i,s){const o=s-Te.BLOCK_SIZE,l=i-Te.BLOCK_SIZE,u=new Array(n);for(let h=0;h<n;h++){u[h]=new Int32Array(t);let p=h<<Te.BLOCK_SIZE_POWER;p>o&&(p=o);for(let A=0;A<t;A++){let b=A<<Te.BLOCK_SIZE_POWER;b>l&&(b=l);let L=0,E=255,M=0;for(let P=0,K=p*i+b;P<Te.BLOCK_SIZE;P++,K+=i){for(let q=0;q<Te.BLOCK_SIZE;q++){const Q=e[K+q]&255;L+=Q,Q<E&&(E=Q),Q>M&&(M=Q)}if(M-E>Te.MIN_DYNAMIC_RANGE)for(P++,K+=i;P<Te.BLOCK_SIZE;P++,K+=i)for(let q=0;q<Te.BLOCK_SIZE;q++)L+=e[K+q]&255}let D=L>>Te.BLOCK_SIZE_POWER*2;if(M-E<=Te.MIN_DYNAMIC_RANGE&&(D=E/2,h>0&&A>0)){const P=(u[h-1][A]+2*u[h][A-1]+u[h-1][A-1])/4;E<P&&(D=P)}u[h][A]=D}}return u}}Te.BLOCK_SIZE_POWER=3,Te.BLOCK_SIZE=1<<Te.BLOCK_SIZE_POWER,Te.BLOCK_SIZE_MASK=Te.BLOCK_SIZE-1,Te.MINIMUM_DIMENSION=Te.BLOCK_SIZE*5,Te.MIN_DYNAMIC_RANGE=24;class bn{constructor(e,t){this.width=e,this.height=t}getWidth(){return this.width}getHeight(){return this.height}isCropSupported(){return!1}crop(e,t,n,i){throw new Pr("This luminance source does not support cropping.")}isRotateSupported(){return!1}rotateCounterClockwise(){throw new Pr("This luminance source does not support rotation by 90 degrees.")}rotateCounterClockwise45(){throw new Pr("This luminance source does not support rotation by 45 degrees.")}toString(){const e=new Uint8ClampedArray(this.width);let t=new rt;for(let n=0;n<this.height;n++){const i=this.getRow(n,e);for(let s=0;s<this.width;s++){const o=i[s]&255;let l;o<64?l="#":o<128?l="+":o<192?l=".":l=" ",t.append(l)}t.append(`
`)}return t.toString()}}class Qn extends bn{constructor(e){super(e.getWidth(),e.getHeight()),this.delegate=e}getRow(e,t){const n=this.delegate.getRow(e,t),i=this.getWidth();for(let s=0;s<i;s++)n[s]=255-(n[s]&255);return n}getMatrix(){const e=this.delegate.getMatrix(),t=this.getWidth()*this.getHeight(),n=new Uint8ClampedArray(t);for(let i=0;i<t;i++)n[i]=255-(e[i]&255);return n}isCropSupported(){return this.delegate.isCropSupported()}crop(e,t,n,i){return new Qn(this.delegate.crop(e,t,n,i))}isRotateSupported(){return this.delegate.isRotateSupported()}invert(){return this.delegate}rotateCounterClockwise(){return new Qn(this.delegate.rotateCounterClockwise())}rotateCounterClockwise45(){return new Qn(this.delegate.rotateCounterClockwise45())}}class xn extends bn{constructor(e){super(e.width,e.height),this.canvas=e,this.tempCanvasElement=null,this.buffer=xn.makeBufferFromCanvasImageData(e)}static makeBufferFromCanvasImageData(e){const t=e.getContext("2d").getImageData(0,0,e.width,e.height);return xn.toGrayscaleBuffer(t.data,e.width,e.height)}static toGrayscaleBuffer(e,t,n){const i=new Uint8ClampedArray(t*n);for(let s=0,o=0,l=e.length;s<l;s+=4,o++){let u;if(e[s+3]===0)u=255;else{const p=e[s],A=e[s+1],b=e[s+2];u=306*p+601*A+117*b+512>>10}i[o]=u}return i}getRow(e,t){if(e<0||e>=this.getHeight())throw new H("Requested row is outside the image: "+e);const n=this.getWidth(),i=e*n;return t===null?t=this.buffer.slice(i,i+n):(t.length<n&&(t=new Uint8ClampedArray(n)),t.set(this.buffer.slice(i,i+n))),t}getMatrix(){return this.buffer}isCropSupported(){return!0}crop(e,t,n,i){return super.crop(e,t,n,i),this}isRotateSupported(){return!0}rotateCounterClockwise(){return this.rotate(-90),this}rotateCounterClockwise45(){return this.rotate(-45),this}getTempCanvasElement(){if(this.tempCanvasElement===null){const e=this.canvas.ownerDocument.createElement("canvas");e.width=this.canvas.width,e.height=this.canvas.height,this.tempCanvasElement=e}return this.tempCanvasElement}rotate(e){const t=this.getTempCanvasElement(),n=t.getContext("2d"),i=e*xn.DEGREE_TO_RADIANS,s=this.canvas.width,o=this.canvas.height,l=Math.ceil(Math.abs(Math.cos(i))*s+Math.abs(Math.sin(i))*o),u=Math.ceil(Math.abs(Math.sin(i))*s+Math.abs(Math.cos(i))*o);return t.width=l,t.height=u,n.translate(l/2,u/2),n.rotate(i),n.drawImage(this.canvas,s/-2,o/-2),this.buffer=xn.makeBufferFromCanvasImageData(t),this}invert(){return new Qn(this)}}xn.DEGREE_TO_RADIANS=Math.PI/180;class pn{constructor(e,t,n){this.deviceId=e,this.label=t,this.kind="videoinput",this.groupId=n||void 0}toJSON(){return{kind:this.kind,groupId:this.groupId,deviceId:this.deviceId,label:this.label}}}var qt=(globalThis||_i||self||window||void 0)&&(globalThis||_i||self||window||void 0).__awaiter||function(w,e,t,n){function i(s){return s instanceof t?s:new t(function(o){o(s)})}return new(t||(t=Promise))(function(s,o){function l(p){try{h(n.next(p))}catch(A){o(A)}}function u(p){try{h(n.throw(p))}catch(A){o(A)}}function h(p){p.done?s(p.value):i(p.value).then(l,u)}h((n=n.apply(w,e||[])).next())})};class Wn{constructor(e,t=500,n){this.reader=e,this.timeBetweenScansMillis=t,this._hints=n,this._stopContinuousDecode=!1,this._stopAsyncDecode=!1,this._timeBetweenDecodingAttempts=0}get hasNavigator(){return typeof navigator<"u"}get isMediaDevicesSuported(){return this.hasNavigator&&!!navigator.mediaDevices}get canEnumerateDevices(){return!!(this.isMediaDevicesSuported&&navigator.mediaDevices.enumerateDevices)}get timeBetweenDecodingAttempts(){return this._timeBetweenDecodingAttempts}set timeBetweenDecodingAttempts(e){this._timeBetweenDecodingAttempts=e<0?0:e}set hints(e){this._hints=e||null}get hints(){return this._hints}listVideoInputDevices(){return qt(this,void 0,void 0,function*(){if(!this.hasNavigator)throw new Error("Can't enumerate devices, navigator is not present.");if(!this.canEnumerateDevices)throw new Error("Can't enumerate devices, method not supported.");const e=yield navigator.mediaDevices.enumerateDevices(),t=[];for(const n of e){const i=n.kind==="video"?"videoinput":n.kind;if(i!=="videoinput")continue;const s=n.deviceId||n.id,o=n.label||`Video device ${t.length+1}`,l=n.groupId,u={deviceId:s,label:o,kind:i,groupId:l};t.push(u)}return t})}getVideoInputDevices(){return qt(this,void 0,void 0,function*(){return(yield this.listVideoInputDevices()).map(t=>new pn(t.deviceId,t.label))})}findDeviceById(e){return qt(this,void 0,void 0,function*(){const t=yield this.listVideoInputDevices();return t?t.find(n=>n.deviceId===e):null})}decodeFromInputVideoDevice(e,t){return qt(this,void 0,void 0,function*(){return yield this.decodeOnceFromVideoDevice(e,t)})}decodeOnceFromVideoDevice(e,t){return qt(this,void 0,void 0,function*(){this.reset();let n;e?n={deviceId:{exact:e}}:n={facingMode:"environment"};const i={video:n};return yield this.decodeOnceFromConstraints(i,t)})}decodeOnceFromConstraints(e,t){return qt(this,void 0,void 0,function*(){const n=yield navigator.mediaDevices.getUserMedia(e);return yield this.decodeOnceFromStream(n,t)})}decodeOnceFromStream(e,t){return qt(this,void 0,void 0,function*(){this.reset();const n=yield this.attachStreamToVideo(e,t);return yield this.decodeOnce(n)})}decodeFromInputVideoDeviceContinuously(e,t,n){return qt(this,void 0,void 0,function*(){return yield this.decodeFromVideoDevice(e,t,n)})}decodeFromVideoDevice(e,t,n){return qt(this,void 0,void 0,function*(){let i;e?i={deviceId:{exact:e}}:i={facingMode:"environment"};const s={video:i};return yield this.decodeFromConstraints(s,t,n)})}decodeFromConstraints(e,t,n){return qt(this,void 0,void 0,function*(){const i=yield navigator.mediaDevices.getUserMedia(e);return yield this.decodeFromStream(i,t,n)})}decodeFromStream(e,t,n){return qt(this,void 0,void 0,function*(){this.reset();const i=yield this.attachStreamToVideo(e,t);return yield this.decodeContinuously(i,n)})}stopAsyncDecode(){this._stopAsyncDecode=!0}stopContinuousDecode(){this._stopContinuousDecode=!0}attachStreamToVideo(e,t){return qt(this,void 0,void 0,function*(){const n=this.prepareVideoElement(t);return this.addVideoSource(n,e),this.videoElement=n,this.stream=e,yield this.playVideoOnLoadAsync(n),n})}playVideoOnLoadAsync(e){return new Promise((t,n)=>this.playVideoOnLoad(e,()=>t()))}playVideoOnLoad(e,t){this.videoEndedListener=()=>this.stopStreams(),this.videoCanPlayListener=()=>this.tryPlayVideo(e),e.addEventListener("ended",this.videoEndedListener),e.addEventListener("canplay",this.videoCanPlayListener),e.addEventListener("playing",t),this.tryPlayVideo(e)}isVideoPlaying(e){return e.currentTime>0&&!e.paused&&!e.ended&&e.readyState>2}tryPlayVideo(e){return qt(this,void 0,void 0,function*(){if(this.isVideoPlaying(e)){console.warn("Trying to play video that is already playing.");return}try{yield e.play()}catch{console.warn("It was not possible to play the video.")}})}getMediaElement(e,t){const n=document.getElementById(e);if(!n)throw new z(`element with id '${e}' not found`);if(n.nodeName.toLowerCase()!==t.toLowerCase())throw new z(`element with id '${e}' must be an ${t} element`);return n}decodeFromImage(e,t){if(!e&&!t)throw new z("either imageElement with a src set or an url must be provided");return t&&!e?this.decodeFromImageUrl(t):this.decodeFromImageElement(e)}decodeFromVideo(e,t){if(!e&&!t)throw new z("Either an element with a src set or an URL must be provided");return t&&!e?this.decodeFromVideoUrl(t):this.decodeFromVideoElement(e)}decodeFromVideoContinuously(e,t,n){if(e===void 0&&t===void 0)throw new z("Either an element with a src set or an URL must be provided");return t&&!e?this.decodeFromVideoUrlContinuously(t,n):this.decodeFromVideoElementContinuously(e,n)}decodeFromImageElement(e){if(!e)throw new z("An image element must be provided.");this.reset();const t=this.prepareImageElement(e);this.imageElement=t;let n;return this.isImageLoaded(t)?n=this.decodeOnce(t,!1,!0):n=this._decodeOnLoadImage(t),n}decodeFromVideoElement(e){const t=this._decodeFromVideoElementSetup(e);return this._decodeOnLoadVideo(t)}decodeFromVideoElementContinuously(e,t){const n=this._decodeFromVideoElementSetup(e);return this._decodeOnLoadVideoContinuously(n,t)}_decodeFromVideoElementSetup(e){if(!e)throw new z("A video element must be provided.");this.reset();const t=this.prepareVideoElement(e);return this.videoElement=t,t}decodeFromImageUrl(e){if(!e)throw new z("An URL must be provided.");this.reset();const t=this.prepareImageElement();this.imageElement=t;const n=this._decodeOnLoadImage(t);return t.src=e,n}decodeFromVideoUrl(e){if(!e)throw new z("An URL must be provided.");this.reset();const t=this.prepareVideoElement(),n=this.decodeFromVideoElement(t);return t.src=e,n}decodeFromVideoUrlContinuously(e,t){if(!e)throw new z("An URL must be provided.");this.reset();const n=this.prepareVideoElement(),i=this.decodeFromVideoElementContinuously(n,t);return n.src=e,i}_decodeOnLoadImage(e){return new Promise((t,n)=>{this.imageLoadedListener=()=>this.decodeOnce(e,!1,!0).then(t,n),e.addEventListener("load",this.imageLoadedListener)})}_decodeOnLoadVideo(e){return qt(this,void 0,void 0,function*(){return yield this.playVideoOnLoadAsync(e),yield this.decodeOnce(e)})}_decodeOnLoadVideoContinuously(e,t){return qt(this,void 0,void 0,function*(){yield this.playVideoOnLoadAsync(e),this.decodeContinuously(e,t)})}isImageLoaded(e){return!(!e.complete||e.naturalWidth===0)}prepareImageElement(e){let t;return typeof e>"u"&&(t=document.createElement("img"),t.width=200,t.height=200),typeof e=="string"&&(t=this.getMediaElement(e,"img")),e instanceof HTMLImageElement&&(t=e),t}prepareVideoElement(e){let t;return!e&&typeof document<"u"&&(t=document.createElement("video"),t.width=200,t.height=200),typeof e=="string"&&(t=this.getMediaElement(e,"video")),e instanceof HTMLVideoElement&&(t=e),t.setAttribute("autoplay","true"),t.setAttribute("muted","true"),t.setAttribute("playsinline","true"),t}decodeOnce(e,t=!0,n=!0){this._stopAsyncDecode=!1;const i=(s,o)=>{if(this._stopAsyncDecode){o(new v("Video stream has ended before any code could be detected.")),this._stopAsyncDecode=void 0;return}try{const l=this.decode(e);s(l)}catch(l){const u=t&&l instanceof v,p=(l instanceof Ee||l instanceof re)&&n;if(u||p)return setTimeout(i,this._timeBetweenDecodingAttempts,s,o);o(l)}};return new Promise((s,o)=>i(s,o))}decodeContinuously(e,t){this._stopContinuousDecode=!1;const n=()=>{if(this._stopContinuousDecode){this._stopContinuousDecode=void 0;return}try{const i=this.decode(e);t(i,null),setTimeout(n,this.timeBetweenScansMillis)}catch(i){t(null,i);const s=i instanceof Ee||i instanceof re,o=i instanceof v;(s||o)&&setTimeout(n,this._timeBetweenDecodingAttempts)}};n()}decode(e){const t=this.createBinaryBitmap(e);return this.decodeBitmap(t)}_isHTMLVideoElement(e){return e.videoWidth!==0}drawFrameOnCanvas(e,t,n){t||(t={sx:0,sy:0,sWidth:e.videoWidth,sHeight:e.videoHeight,dx:0,dy:0,dWidth:e.videoWidth,dHeight:e.videoHeight}),n||(n=this.captureCanvasContext),n.drawImage(e,t.sx,t.sy,t.sWidth,t.sHeight,t.dx,t.dy,t.dWidth,t.dHeight)}drawImageOnCanvas(e,t,n=this.captureCanvasContext){t||(t={sx:0,sy:0,sWidth:e.naturalWidth,sHeight:e.naturalHeight,dx:0,dy:0,dWidth:e.naturalWidth,dHeight:e.naturalHeight}),n||(n=this.captureCanvasContext),n.drawImage(e,t.sx,t.sy,t.sWidth,t.sHeight,t.dx,t.dy,t.dWidth,t.dHeight)}createBinaryBitmap(e){this.getCaptureCanvasContext(e),this._isHTMLVideoElement(e)?this.drawFrameOnCanvas(e):this.drawImageOnCanvas(e);const t=this.getCaptureCanvas(e),n=new xn(t),i=new Te(n);return new Le(i)}getCaptureCanvasContext(e){if(!this.captureCanvasContext){const n=this.getCaptureCanvas(e).getContext("2d");this.captureCanvasContext=n}return this.captureCanvasContext}getCaptureCanvas(e){if(!this.captureCanvas){const t=this.createCaptureCanvas(e);this.captureCanvas=t}return this.captureCanvas}decodeBitmap(e){return this.reader.decode(e,this._hints)}createCaptureCanvas(e){if(typeof document>"u")return this._destroyCaptureCanvas(),null;const t=document.createElement("canvas");let n,i;return typeof e<"u"&&(e instanceof HTMLVideoElement?(n=e.videoWidth,i=e.videoHeight):e instanceof HTMLImageElement&&(n=e.naturalWidth||e.width,i=e.naturalHeight||e.height)),t.style.width=n+"px",t.style.height=i+"px",t.width=n,t.height=i,t}stopStreams(){this.stream&&(this.stream.getVideoTracks().forEach(e=>e.stop()),this.stream=void 0),this._stopAsyncDecode===!1&&this.stopAsyncDecode(),this._stopContinuousDecode===!1&&this.stopContinuousDecode()}reset(){this.stopStreams(),this._destroyVideoElement(),this._destroyImageElement(),this._destroyCaptureCanvas()}_destroyVideoElement(){this.videoElement&&(typeof this.videoEndedListener<"u"&&this.videoElement.removeEventListener("ended",this.videoEndedListener),typeof this.videoPlayingEventListener<"u"&&this.videoElement.removeEventListener("playing",this.videoPlayingEventListener),typeof this.videoCanPlayListener<"u"&&this.videoElement.removeEventListener("loadedmetadata",this.videoCanPlayListener),this.cleanVideoSource(this.videoElement),this.videoElement=void 0)}_destroyImageElement(){this.imageElement&&(this.imageLoadedListener!==void 0&&this.imageElement.removeEventListener("load",this.imageLoadedListener),this.imageElement.src=void 0,this.imageElement.removeAttribute("src"),this.imageElement=void 0)}_destroyCaptureCanvas(){this.captureCanvasContext=void 0,this.captureCanvas=void 0}addVideoSource(e,t){try{e.srcObject=t}catch{e.src=URL.createObjectURL(t)}}cleanVideoSource(e){try{e.srcObject=null}catch{e.src=""}this.videoElement.removeAttribute("src")}}class Ft{constructor(e,t,n=t==null?0:8*t.length,i,s,o=ge.currentTimeMillis()){this.text=e,this.rawBytes=t,this.numBits=n,this.resultPoints=i,this.format=s,this.timestamp=o,this.text=e,this.rawBytes=t,n==null?this.numBits=t==null?0:8*t.length:this.numBits=n,this.resultPoints=i,this.format=s,this.resultMetadata=null,o==null?this.timestamp=ge.currentTimeMillis():this.timestamp=o}getText(){return this.text}getRawBytes(){return this.rawBytes}getNumBits(){return this.numBits}getResultPoints(){return this.resultPoints}getBarcodeFormat(){return this.format}getResultMetadata(){return this.resultMetadata}putMetadata(e,t){this.resultMetadata===null&&(this.resultMetadata=new Map),this.resultMetadata.set(e,t)}putAllMetadata(e){e!==null&&(this.resultMetadata===null?this.resultMetadata=e:this.resultMetadata=new Map(e))}addResultPoints(e){const t=this.resultPoints;if(t===null)this.resultPoints=e;else if(e!==null&&e.length>0){const n=new Array(t.length+e.length);ge.arraycopy(t,0,n,0,t.length),ge.arraycopy(e,0,n,t.length,e.length),this.resultPoints=n}}getTimestamp(){return this.timestamp}toString(){return this.text}}var Rn;(function(w){w[w.AZTEC=0]="AZTEC",w[w.CODABAR=1]="CODABAR",w[w.CODE_39=2]="CODE_39",w[w.CODE_93=3]="CODE_93",w[w.CODE_128=4]="CODE_128",w[w.DATA_MATRIX=5]="DATA_MATRIX",w[w.EAN_8=6]="EAN_8",w[w.EAN_13=7]="EAN_13",w[w.ITF=8]="ITF",w[w.MAXICODE=9]="MAXICODE",w[w.PDF_417=10]="PDF_417",w[w.QR_CODE=11]="QR_CODE",w[w.RSS_14=12]="RSS_14",w[w.RSS_EXPANDED=13]="RSS_EXPANDED",w[w.UPC_A=14]="UPC_A",w[w.UPC_E=15]="UPC_E",w[w.UPC_EAN_EXTENSION=16]="UPC_EAN_EXTENSION"})(Rn||(Rn={}));var me=Rn,Ti;(function(w){w[w.OTHER=0]="OTHER",w[w.ORIENTATION=1]="ORIENTATION",w[w.BYTE_SEGMENTS=2]="BYTE_SEGMENTS",w[w.ERROR_CORRECTION_LEVEL=3]="ERROR_CORRECTION_LEVEL",w[w.ISSUE_NUMBER=4]="ISSUE_NUMBER",w[w.SUGGESTED_PRICE=5]="SUGGESTED_PRICE",w[w.POSSIBLE_COUNTRY=6]="POSSIBLE_COUNTRY",w[w.UPC_EAN_EXTENSION=7]="UPC_EAN_EXTENSION",w[w.PDF417_EXTRA_METADATA=8]="PDF417_EXTRA_METADATA",w[w.STRUCTURED_APPEND_SEQUENCE=9]="STRUCTURED_APPEND_SEQUENCE",w[w.STRUCTURED_APPEND_PARITY=10]="STRUCTURED_APPEND_PARITY"})(Ti||(Ti={}));var gt=Ti;class cn{constructor(e,t,n,i,s=-1,o=-1){this.rawBytes=e,this.text=t,this.byteSegments=n,this.ecLevel=i,this.structuredAppendSequenceNumber=s,this.structuredAppendParity=o,this.numBits=e==null?0:8*e.length}getRawBytes(){return this.rawBytes}getNumBits(){return this.numBits}setNumBits(e){this.numBits=e}getText(){return this.text}getByteSegments(){return this.byteSegments}getECLevel(){return this.ecLevel}getErrorsCorrected(){return this.errorsCorrected}setErrorsCorrected(e){this.errorsCorrected=e}getErasures(){return this.erasures}setErasures(e){this.erasures=e}getOther(){return this.other}setOther(e){this.other=e}hasStructuredAppend(){return this.structuredAppendParity>=0&&this.structuredAppendSequenceNumber>=0}getStructuredAppendParity(){return this.structuredAppendParity}getStructuredAppendSequenceNumber(){return this.structuredAppendSequenceNumber}}class Ln{exp(e){return this.expTable[e]}log(e){if(e===0)throw new H;return this.logTable[e]}static addOrSubtract(e,t){return e^t}}class Yt{constructor(e,t){if(t.length===0)throw new H;this.field=e;const n=t.length;if(n>1&&t[0]===0){let i=1;for(;i<n&&t[i]===0;)i++;i===n?this.coefficients=Int32Array.from([0]):(this.coefficients=new Int32Array(n-i),ge.arraycopy(t,i,this.coefficients,0,this.coefficients.length))}else this.coefficients=t}getCoefficients(){return this.coefficients}getDegree(){return this.coefficients.length-1}isZero(){return this.coefficients[0]===0}getCoefficient(e){return this.coefficients[this.coefficients.length-1-e]}evaluateAt(e){if(e===0)return this.getCoefficient(0);const t=this.coefficients;let n;if(e===1){n=0;for(let o=0,l=t.length;o!==l;o++){const u=t[o];n=Ln.addOrSubtract(n,u)}return n}n=t[0];const i=t.length,s=this.field;for(let o=1;o<i;o++)n=Ln.addOrSubtract(s.multiply(e,n),t[o]);return n}addOrSubtract(e){if(!this.field.equals(e.field))throw new H("GenericGFPolys do not have same GenericGF field");if(this.isZero())return e;if(e.isZero())return this;let t=this.coefficients,n=e.coefficients;if(t.length>n.length){const o=t;t=n,n=o}let i=new Int32Array(n.length);const s=n.length-t.length;ge.arraycopy(n,0,i,0,s);for(let o=s;o<n.length;o++)i[o]=Ln.addOrSubtract(t[o-s],n[o]);return new Yt(this.field,i)}multiply(e){if(!this.field.equals(e.field))throw new H("GenericGFPolys do not have same GenericGF field");if(this.isZero()||e.isZero())return this.field.getZero();const t=this.coefficients,n=t.length,i=e.coefficients,s=i.length,o=new Int32Array(n+s-1),l=this.field;for(let u=0;u<n;u++){const h=t[u];for(let p=0;p<s;p++)o[u+p]=Ln.addOrSubtract(o[u+p],l.multiply(h,i[p]))}return new Yt(l,o)}multiplyScalar(e){if(e===0)return this.field.getZero();if(e===1)return this;const t=this.coefficients.length,n=this.field,i=new Int32Array(t),s=this.coefficients;for(let o=0;o<t;o++)i[o]=n.multiply(s[o],e);return new Yt(n,i)}multiplyByMonomial(e,t){if(e<0)throw new H;if(t===0)return this.field.getZero();const n=this.coefficients,i=n.length,s=new Int32Array(i+e),o=this.field;for(let l=0;l<i;l++)s[l]=o.multiply(n[l],t);return new Yt(o,s)}divide(e){if(!this.field.equals(e.field))throw new H("GenericGFPolys do not have same GenericGF field");if(e.isZero())throw new H("Divide by 0");const t=this.field;let n=t.getZero(),i=this;const s=e.getCoefficient(e.getDegree()),o=t.inverse(s);for(;i.getDegree()>=e.getDegree()&&!i.isZero();){const l=i.getDegree()-e.getDegree(),u=t.multiply(i.getCoefficient(i.getDegree()),o),h=e.multiplyByMonomial(l,u),p=t.buildMonomial(l,u);n=n.addOrSubtract(p),i=i.addOrSubtract(h)}return[n,i]}toString(){let e="";for(let t=this.getDegree();t>=0;t--){let n=this.getCoefficient(t);if(n!==0){if(n<0?(e+=" - ",n=-n):e.length>0&&(e+=" + "),t===0||n!==1){const i=this.field.log(n);i===0?e+="1":i===1?e+="a":(e+="a^",e+=i)}t!==0&&(t===1?e+="x":(e+="x^",e+=t))}}return e}}class Ar extends T{}Ar.kind="ArithmeticException";class $e extends Ln{constructor(e,t,n){super(),this.primitive=e,this.size=t,this.generatorBase=n;const i=new Int32Array(t);let s=1;for(let l=0;l<t;l++)i[l]=s,s*=2,s>=t&&(s^=e,s&=t-1);this.expTable=i;const o=new Int32Array(t);for(let l=0;l<t-1;l++)o[i[l]]=l;this.logTable=o,this.zero=new Yt(this,Int32Array.from([0])),this.one=new Yt(this,Int32Array.from([1]))}getZero(){return this.zero}getOne(){return this.one}buildMonomial(e,t){if(e<0)throw new H;if(t===0)return this.zero;const n=new Int32Array(e+1);return n[0]=t,new Yt(this,n)}inverse(e){if(e===0)throw new Ar;return this.expTable[this.size-this.logTable[e]-1]}multiply(e,t){return e===0||t===0?0:this.expTable[(this.logTable[e]+this.logTable[t])%(this.size-1)]}getSize(){return this.size}getGeneratorBase(){return this.generatorBase}toString(){return"GF(0x"+fe.toHexString(this.primitive)+","+this.size+")"}equals(e){return e===this}}$e.AZTEC_DATA_12=new $e(4201,4096,1),$e.AZTEC_DATA_10=new $e(1033,1024,1),$e.AZTEC_DATA_6=new $e(67,64,1),$e.AZTEC_PARAM=new $e(19,16,1),$e.QR_CODE_FIELD_256=new $e(285,256,0),$e.DATA_MATRIX_FIELD_256=new $e(301,256,1),$e.AZTEC_DATA_8=$e.DATA_MATRIX_FIELD_256,$e.MAXICODE_FIELD_64=$e.AZTEC_DATA_6;class Qt extends T{}Qt.kind="ReedSolomonException";class un extends T{}un.kind="IllegalStateException";class Vr{constructor(e){this.field=e}decode(e,t){const n=this.field,i=new Yt(n,e),s=new Int32Array(t);let o=!0;for(let L=0;L<t;L++){const E=i.evaluateAt(n.exp(L+n.getGeneratorBase()));s[s.length-1-L]=E,E!==0&&(o=!1)}if(o)return;const l=new Yt(n,s),u=this.runEuclideanAlgorithm(n.buildMonomial(t,1),l,t),h=u[0],p=u[1],A=this.findErrorLocations(h),b=this.findErrorMagnitudes(p,A);for(let L=0;L<A.length;L++){const E=e.length-1-n.log(A[L]);if(E<0)throw new Qt("Bad error location");e[E]=$e.addOrSubtract(e[E],b[L])}}runEuclideanAlgorithm(e,t,n){if(e.getDegree()<t.getDegree()){const L=e;e=t,t=L}const i=this.field;let s=e,o=t,l=i.getZero(),u=i.getOne();for(;o.getDegree()>=(n/2|0);){let L=s,E=l;if(s=o,l=u,s.isZero())throw new Qt("r_{i-1} was zero");o=L;let M=i.getZero();const D=s.getCoefficient(s.getDegree()),P=i.inverse(D);for(;o.getDegree()>=s.getDegree()&&!o.isZero();){const K=o.getDegree()-s.getDegree(),q=i.multiply(o.getCoefficient(o.getDegree()),P);M=M.addOrSubtract(i.buildMonomial(K,q)),o=o.addOrSubtract(s.multiplyByMonomial(K,q))}if(u=M.multiply(l).addOrSubtract(E),o.getDegree()>=s.getDegree())throw new un("Division algorithm failed to reduce polynomial?")}const h=u.getCoefficient(0);if(h===0)throw new Qt("sigmaTilde(0) was zero");const p=i.inverse(h),A=u.multiplyScalar(p),b=o.multiplyScalar(p);return[A,b]}findErrorLocations(e){const t=e.getDegree();if(t===1)return Int32Array.from([e.getCoefficient(1)]);const n=new Int32Array(t);let i=0;const s=this.field;for(let o=1;o<s.getSize()&&i<t;o++)e.evaluateAt(o)===0&&(n[i]=s.inverse(o),i++);if(i!==t)throw new Qt("Error locator degree does not match number of roots");return n}findErrorMagnitudes(e,t){const n=t.length,i=new Int32Array(n),s=this.field;for(let o=0;o<n;o++){const l=s.inverse(t[o]);let u=1;for(let h=0;h<n;h++)if(o!==h){const p=s.multiply(t[h],l),A=(p&1)===0?p|1:p&-2;u=s.multiply(u,A)}i[o]=s.multiply(e.evaluateAt(l),s.inverse(u)),s.getGeneratorBase()!==0&&(i[o]=s.multiply(i[o],l))}return i}}var ht;(function(w){w[w.UPPER=0]="UPPER",w[w.LOWER=1]="LOWER",w[w.MIXED=2]="MIXED",w[w.DIGIT=3]="DIGIT",w[w.PUNCT=4]="PUNCT",w[w.BINARY=5]="BINARY"})(ht||(ht={}));class ut{decode(e){this.ddata=e;let t=e.getBits(),n=this.extractBits(t),i=this.correctBits(n),s=ut.convertBoolArrayToByteArray(i),o=ut.getEncodedData(i),l=new cn(s,o,null,null);return l.setNumBits(i.length),l}static highLevelDecode(e){return this.getEncodedData(e)}static getEncodedData(e){let t=e.length,n=ht.UPPER,i=ht.UPPER,s="",o=0;for(;o<t;)if(i===ht.BINARY){if(t-o<5)break;let l=ut.readCode(e,o,5);if(o+=5,l===0){if(t-o<11)break;l=ut.readCode(e,o,11)+31,o+=11}for(let u=0;u<l;u++){if(t-o<8){o=t;break}const h=ut.readCode(e,o,8);s+=ye.castAsNonUtf8Char(h),o+=8}i=n}else{let l=i===ht.DIGIT?4:5;if(t-o<l)break;let u=ut.readCode(e,o,l);o+=l;let h=ut.getCharacter(i,u);h.startsWith("CTRL_")?(n=i,i=ut.getTable(h.charAt(5)),h.charAt(6)==="L"&&(n=i)):(s+=h,i=n)}return s}static getTable(e){switch(e){case"L":return ht.LOWER;case"P":return ht.PUNCT;case"M":return ht.MIXED;case"D":return ht.DIGIT;case"B":return ht.BINARY;case"U":default:return ht.UPPER}}static getCharacter(e,t){switch(e){case ht.UPPER:return ut.UPPER_TABLE[t];case ht.LOWER:return ut.LOWER_TABLE[t];case ht.MIXED:return ut.MIXED_TABLE[t];case ht.PUNCT:return ut.PUNCT_TABLE[t];case ht.DIGIT:return ut.DIGIT_TABLE[t];default:throw new un("Bad table")}}correctBits(e){let t,n;this.ddata.getNbLayers()<=2?(n=6,t=$e.AZTEC_DATA_6):this.ddata.getNbLayers()<=8?(n=8,t=$e.AZTEC_DATA_8):this.ddata.getNbLayers()<=22?(n=10,t=$e.AZTEC_DATA_10):(n=12,t=$e.AZTEC_DATA_12);let i=this.ddata.getNbDatablocks(),s=e.length/n;if(s<i)throw new re;let o=e.length%n,l=new Int32Array(s);for(let b=0;b<s;b++,o+=n)l[b]=ut.readCode(e,o,n);try{new Vr(t).decode(l,s-i)}catch(b){throw new re(b)}let u=(1<<n)-1,h=0;for(let b=0;b<i;b++){let L=l[b];if(L===0||L===u)throw new re;(L===1||L===u-1)&&h++}let p=new Array(i*n-h),A=0;for(let b=0;b<i;b++){let L=l[b];if(L===1||L===u-1)p.fill(L>1,A,A+n-1),A+=n-1;else for(let E=n-1;E>=0;--E)p[A++]=(L&1<<E)!==0}return p}extractBits(e){let t=this.ddata.isCompact(),n=this.ddata.getNbLayers(),i=(t?11:14)+n*4,s=new Int32Array(i),o=new Array(this.totalBitsInLayer(n,t));if(t)for(let l=0;l<s.length;l++)s[l]=l;else{let l=i+1+2*fe.truncDivision(fe.truncDivision(i,2)-1,15),u=i/2,h=fe.truncDivision(l,2);for(let p=0;p<u;p++){let A=p+fe.truncDivision(p,15);s[u-p-1]=h-A-1,s[u+p]=h+A+1}}for(let l=0,u=0;l<n;l++){let h=(n-l)*4+(t?9:12),p=l*2,A=i-1-p;for(let b=0;b<h;b++){let L=b*2;for(let E=0;E<2;E++)o[u+L+E]=e.get(s[p+E],s[p+b]),o[u+2*h+L+E]=e.get(s[p+b],s[A-E]),o[u+4*h+L+E]=e.get(s[A-E],s[A-b]),o[u+6*h+L+E]=e.get(s[A-b],s[p+E])}u+=h*8}return o}static readCode(e,t,n){let i=0;for(let s=t;s<t+n;s++)i<<=1,e[s]&&(i|=1);return i}static readByte(e,t){let n=e.length-t;return n>=8?ut.readCode(e,t,8):ut.readCode(e,t,n)<<8-n}static convertBoolArrayToByteArray(e){let t=new Uint8Array((e.length+7)/8);for(let n=0;n<t.length;n++)t[n]=ut.readByte(e,8*n);return t}totalBitsInLayer(e,t){return((t?88:112)+16*e)*e}}ut.UPPER_TABLE=["CTRL_PS"," ","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","CTRL_LL","CTRL_ML","CTRL_DL","CTRL_BS"],ut.LOWER_TABLE=["CTRL_PS"," ","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","CTRL_US","CTRL_ML","CTRL_DL","CTRL_BS"],ut.MIXED_TABLE=["CTRL_PS"," ","\\1","\\2","\\3","\\4","\\5","\\6","\\7","\b","	",`
`,"\\13","\f","\r","\\33","\\34","\\35","\\36","\\37","@","\\","^","_","`","|","~","\\177","CTRL_LL","CTRL_UL","CTRL_PL","CTRL_BS"],ut.PUNCT_TABLE=["","\r",`\r
`,". ",", ",": ","!",'"',"#","$","%","&","'","(",")","*","+",",","-",".","/",":",";","<","=",">","?","[","]","{","}","CTRL_UL"],ut.DIGIT_TABLE=["CTRL_PS"," ","0","1","2","3","4","5","6","7","8","9",",",".","CTRL_UL","CTRL_US"];class Ke{constructor(){}static round(e){return e===NaN?0:e<=Number.MIN_SAFE_INTEGER?Number.MIN_SAFE_INTEGER:e>=Number.MAX_SAFE_INTEGER?Number.MAX_SAFE_INTEGER:e+(e<0?-.5:.5)|0}static distance(e,t,n,i){const s=e-n,o=t-i;return Math.sqrt(s*s+o*o)}static sum(e){let t=0;for(let n=0,i=e.length;n!==i;n++){const s=e[n];t+=s}return t}}class lr{static floatToIntBits(e){return e}}lr.MAX_VALUE=Number.MAX_SAFE_INTEGER;class le{constructor(e,t){this.x=e,this.y=t}getX(){return this.x}getY(){return this.y}equals(e){if(e instanceof le){const t=e;return this.x===t.x&&this.y===t.y}return!1}hashCode(){return 31*lr.floatToIntBits(this.x)+lr.floatToIntBits(this.y)}toString(){return"("+this.x+","+this.y+")"}static orderBestPatterns(e){const t=this.distance(e[0],e[1]),n=this.distance(e[1],e[2]),i=this.distance(e[0],e[2]);let s,o,l;if(n>=t&&n>=i?(o=e[0],s=e[1],l=e[2]):i>=n&&i>=t?(o=e[1],s=e[0],l=e[2]):(o=e[2],s=e[0],l=e[1]),this.crossProductZ(s,o,l)<0){const u=s;s=l,l=u}e[0]=s,e[1]=o,e[2]=l}static distance(e,t){return Ke.distance(e.x,e.y,t.x,t.y)}static crossProductZ(e,t,n){const i=t.x,s=t.y;return(n.x-i)*(e.y-s)-(n.y-s)*(e.x-i)}}class cr{constructor(e,t){this.bits=e,this.points=t}getBits(){return this.bits}getPoints(){return this.points}}class Yr extends cr{constructor(e,t,n,i,s){super(e,t),this.compact=n,this.nbDatablocks=i,this.nbLayers=s}getNbLayers(){return this.nbLayers}getNbDatablocks(){return this.nbDatablocks}isCompact(){return this.compact}}class Gn{constructor(e,t,n,i){this.image=e,this.height=e.getHeight(),this.width=e.getWidth(),t==null&&(t=Gn.INIT_SIZE),n==null&&(n=e.getWidth()/2|0),i==null&&(i=e.getHeight()/2|0);const s=t/2|0;if(this.leftInit=n-s,this.rightInit=n+s,this.upInit=i-s,this.downInit=i+s,this.upInit<0||this.leftInit<0||this.downInit>=this.height||this.rightInit>=this.width)throw new v}detect(){let e=this.leftInit,t=this.rightInit,n=this.upInit,i=this.downInit,s=!1,o=!0,l=!1,u=!1,h=!1,p=!1,A=!1;const b=this.width,L=this.height;for(;o;){o=!1;let E=!0;for(;(E||!u)&&t<b;)E=this.containsBlackPoint(n,i,t,!1),E?(t++,o=!0,u=!0):u||t++;if(t>=b){s=!0;break}let M=!0;for(;(M||!h)&&i<L;)M=this.containsBlackPoint(e,t,i,!0),M?(i++,o=!0,h=!0):h||i++;if(i>=L){s=!0;break}let D=!0;for(;(D||!p)&&e>=0;)D=this.containsBlackPoint(n,i,e,!1),D?(e--,o=!0,p=!0):p||e--;if(e<0){s=!0;break}let P=!0;for(;(P||!A)&&n>=0;)P=this.containsBlackPoint(e,t,n,!0),P?(n--,o=!0,A=!0):A||n--;if(n<0){s=!0;break}o&&(l=!0)}if(!s&&l){const E=t-e;let M=null;for(let q=1;M===null&&q<E;q++)M=this.getBlackPointOnSegment(e,i-q,e+q,i);if(M==null)throw new v;let D=null;for(let q=1;D===null&&q<E;q++)D=this.getBlackPointOnSegment(e,n+q,e+q,n);if(D==null)throw new v;let P=null;for(let q=1;P===null&&q<E;q++)P=this.getBlackPointOnSegment(t,n+q,t-q,n);if(P==null)throw new v;let K=null;for(let q=1;K===null&&q<E;q++)K=this.getBlackPointOnSegment(t,i-q,t-q,i);if(K==null)throw new v;return this.centerEdges(K,M,P,D)}else throw new v}getBlackPointOnSegment(e,t,n,i){const s=Ke.round(Ke.distance(e,t,n,i)),o=(n-e)/s,l=(i-t)/s,u=this.image;for(let h=0;h<s;h++){const p=Ke.round(e+h*o),A=Ke.round(t+h*l);if(u.get(p,A))return new le(p,A)}return null}centerEdges(e,t,n,i){const s=e.getX(),o=e.getY(),l=t.getX(),u=t.getY(),h=n.getX(),p=n.getY(),A=i.getX(),b=i.getY(),L=Gn.CORR;return s<this.width/2?[new le(A-L,b+L),new le(l+L,u+L),new le(h-L,p-L),new le(s+L,o-L)]:[new le(A+L,b+L),new le(l+L,u-L),new le(h-L,p+L),new le(s-L,o-L)]}containsBlackPoint(e,t,n,i){const s=this.image;if(i){for(let o=e;o<=t;o++)if(s.get(o,n))return!0}else for(let o=e;o<=t;o++)if(s.get(n,o))return!0;return!1}}Gn.INIT_SIZE=10,Gn.CORR=1;class Cr{static checkAndNudgePoints(e,t){const n=e.getWidth(),i=e.getHeight();let s=!0;for(let o=0;o<t.length&&s;o+=2){const l=Math.floor(t[o]),u=Math.floor(t[o+1]);if(l<-1||l>n||u<-1||u>i)throw new v;s=!1,l===-1?(t[o]=0,s=!0):l===n&&(t[o]=n-1,s=!0),u===-1?(t[o+1]=0,s=!0):u===i&&(t[o+1]=i-1,s=!0)}s=!0;for(let o=t.length-2;o>=0&&s;o-=2){const l=Math.floor(t[o]),u=Math.floor(t[o+1]);if(l<-1||l>n||u<-1||u>i)throw new v;s=!1,l===-1?(t[o]=0,s=!0):l===n&&(t[o]=n-1,s=!0),u===-1?(t[o+1]=0,s=!0):u===i&&(t[o+1]=i-1,s=!0)}}}class Bn{constructor(e,t,n,i,s,o,l,u,h){this.a11=e,this.a21=t,this.a31=n,this.a12=i,this.a22=s,this.a32=o,this.a13=l,this.a23=u,this.a33=h}static quadrilateralToQuadrilateral(e,t,n,i,s,o,l,u,h,p,A,b,L,E,M,D){const P=Bn.quadrilateralToSquare(e,t,n,i,s,o,l,u);return Bn.squareToQuadrilateral(h,p,A,b,L,E,M,D).times(P)}transformPoints(e){const t=e.length,n=this.a11,i=this.a12,s=this.a13,o=this.a21,l=this.a22,u=this.a23,h=this.a31,p=this.a32,A=this.a33;for(let b=0;b<t;b+=2){const L=e[b],E=e[b+1],M=s*L+u*E+A;e[b]=(n*L+o*E+h)/M,e[b+1]=(i*L+l*E+p)/M}}transformPointsWithValues(e,t){const n=this.a11,i=this.a12,s=this.a13,o=this.a21,l=this.a22,u=this.a23,h=this.a31,p=this.a32,A=this.a33,b=e.length;for(let L=0;L<b;L++){const E=e[L],M=t[L],D=s*E+u*M+A;e[L]=(n*E+o*M+h)/D,t[L]=(i*E+l*M+p)/D}}static squareToQuadrilateral(e,t,n,i,s,o,l,u){const h=e-n+s-l,p=t-i+o-u;if(h===0&&p===0)return new Bn(n-e,s-n,e,i-t,o-i,t,0,0,1);{const A=n-s,b=l-s,L=i-o,E=u-o,M=A*E-b*L,D=(h*E-b*p)/M,P=(A*p-h*L)/M;return new Bn(n-e+D*n,l-e+P*l,e,i-t+D*i,u-t+P*u,t,D,P,1)}}static quadrilateralToSquare(e,t,n,i,s,o,l,u){return Bn.squareToQuadrilateral(e,t,n,i,s,o,l,u).buildAdjoint()}buildAdjoint(){return new Bn(this.a22*this.a33-this.a23*this.a32,this.a23*this.a31-this.a21*this.a33,this.a21*this.a32-this.a22*this.a31,this.a13*this.a32-this.a12*this.a33,this.a11*this.a33-this.a13*this.a31,this.a12*this.a31-this.a11*this.a32,this.a12*this.a23-this.a13*this.a22,this.a13*this.a21-this.a11*this.a23,this.a11*this.a22-this.a12*this.a21)}times(e){return new Bn(this.a11*e.a11+this.a21*e.a12+this.a31*e.a13,this.a11*e.a21+this.a21*e.a22+this.a31*e.a23,this.a11*e.a31+this.a21*e.a32+this.a31*e.a33,this.a12*e.a11+this.a22*e.a12+this.a32*e.a13,this.a12*e.a21+this.a22*e.a22+this.a32*e.a23,this.a12*e.a31+this.a22*e.a32+this.a32*e.a33,this.a13*e.a11+this.a23*e.a12+this.a33*e.a13,this.a13*e.a21+this.a23*e.a22+this.a33*e.a23,this.a13*e.a31+this.a23*e.a32+this.a33*e.a33)}}class mn extends Cr{sampleGrid(e,t,n,i,s,o,l,u,h,p,A,b,L,E,M,D,P,K,q){const Q=Bn.quadrilateralToQuadrilateral(i,s,o,l,u,h,p,A,b,L,E,M,D,P,K,q);return this.sampleGridWithTransform(e,t,n,Q)}sampleGridWithTransform(e,t,n,i){if(t<=0||n<=0)throw new v;const s=new Mt(t,n),o=new Float32Array(2*t);for(let l=0;l<n;l++){const u=o.length,h=l+.5;for(let p=0;p<u;p+=2)o[p]=p/2+.5,o[p+1]=h;i.transformPoints(o),Cr.checkAndNudgePoints(e,o);try{for(let p=0;p<u;p+=2)e.get(Math.floor(o[p]),Math.floor(o[p+1]))&&s.set(p/2,l)}catch{throw new v}}return s}}class wn{static setGridSampler(e){wn.gridSampler=e}static getInstance(){return wn.gridSampler}}wn.gridSampler=new mn;class Tt{constructor(e,t){this.x=e,this.y=t}toResultPoint(){return new le(this.getX(),this.getY())}getX(){return this.x}getY(){return this.y}}class Rt{constructor(e){this.EXPECTED_CORNER_BITS=new Int32Array([3808,476,2107,1799]),this.image=e}detect(){return this.detectMirror(!1)}detectMirror(e){let t=this.getMatrixCenter(),n=this.getBullsEyeCorners(t);if(e){let o=n[0];n[0]=n[2],n[2]=o}this.extractParameters(n);let i=this.sampleGrid(this.image,n[this.shift%4],n[(this.shift+1)%4],n[(this.shift+2)%4],n[(this.shift+3)%4]),s=this.getMatrixCornerPoints(n);return new Yr(i,s,this.compact,this.nbDataBlocks,this.nbLayers)}extractParameters(e){if(!this.isValidPoint(e[0])||!this.isValidPoint(e[1])||!this.isValidPoint(e[2])||!this.isValidPoint(e[3]))throw new v;let t=2*this.nbCenterLayers,n=new Int32Array([this.sampleLine(e[0],e[1],t),this.sampleLine(e[1],e[2],t),this.sampleLine(e[2],e[3],t),this.sampleLine(e[3],e[0],t)]);this.shift=this.getRotation(n,t);let i=0;for(let o=0;o<4;o++){let l=n[(this.shift+o)%4];this.compact?(i<<=7,i+=l>>1&127):(i<<=10,i+=(l>>2&992)+(l>>1&31))}let s=this.getCorrectedParameterData(i,this.compact);this.compact?(this.nbLayers=(s>>6)+1,this.nbDataBlocks=(s&63)+1):(this.nbLayers=(s>>11)+1,this.nbDataBlocks=(s&2047)+1)}getRotation(e,t){let n=0;e.forEach((i,s,o)=>{let l=(i>>t-2<<1)+(i&1);n=(n<<3)+l}),n=((n&1)<<11)+(n>>1);for(let i=0;i<4;i++)if(fe.bitCount(n^this.EXPECTED_CORNER_BITS[i])<=2)return i;throw new v}getCorrectedParameterData(e,t){let n,i;t?(n=7,i=2):(n=10,i=4);let s=n-i,o=new Int32Array(n);for(let u=n-1;u>=0;--u)o[u]=e&15,e>>=4;try{new Vr($e.AZTEC_PARAM).decode(o,s)}catch{throw new v}let l=0;for(let u=0;u<i;u++)l=(l<<4)+o[u];return l}getBullsEyeCorners(e){let t=e,n=e,i=e,s=e,o=!0;for(this.nbCenterLayers=1;this.nbCenterLayers<9;this.nbCenterLayers++){let A=this.getFirstDifferent(t,o,1,-1),b=this.getFirstDifferent(n,o,1,1),L=this.getFirstDifferent(i,o,-1,1),E=this.getFirstDifferent(s,o,-1,-1);if(this.nbCenterLayers>2){let M=this.distancePoint(E,A)*this.nbCenterLayers/(this.distancePoint(s,t)*(this.nbCenterLayers+2));if(M<.75||M>1.25||!this.isWhiteOrBlackRectangle(A,b,L,E))break}t=A,n=b,i=L,s=E,o=!o}if(this.nbCenterLayers!==5&&this.nbCenterLayers!==7)throw new v;this.compact=this.nbCenterLayers===5;let l=new le(t.getX()+.5,t.getY()-.5),u=new le(n.getX()+.5,n.getY()+.5),h=new le(i.getX()-.5,i.getY()+.5),p=new le(s.getX()-.5,s.getY()-.5);return this.expandSquare([l,u,h,p],2*this.nbCenterLayers-3,2*this.nbCenterLayers)}getMatrixCenter(){let e,t,n,i;try{let l=new Gn(this.image).detect();e=l[0],t=l[1],n=l[2],i=l[3]}catch{let u=this.image.getWidth()/2,h=this.image.getHeight()/2;e=this.getFirstDifferent(new Tt(u+7,h-7),!1,1,-1).toResultPoint(),t=this.getFirstDifferent(new Tt(u+7,h+7),!1,1,1).toResultPoint(),n=this.getFirstDifferent(new Tt(u-7,h+7),!1,-1,1).toResultPoint(),i=this.getFirstDifferent(new Tt(u-7,h-7),!1,-1,-1).toResultPoint()}let s=Ke.round((e.getX()+i.getX()+t.getX()+n.getX())/4),o=Ke.round((e.getY()+i.getY()+t.getY()+n.getY())/4);try{let l=new Gn(this.image,15,s,o).detect();e=l[0],t=l[1],n=l[2],i=l[3]}catch{e=this.getFirstDifferent(new Tt(s+7,o-7),!1,1,-1).toResultPoint(),t=this.getFirstDifferent(new Tt(s+7,o+7),!1,1,1).toResultPoint(),n=this.getFirstDifferent(new Tt(s-7,o+7),!1,-1,1).toResultPoint(),i=this.getFirstDifferent(new Tt(s-7,o-7),!1,-1,-1).toResultPoint()}return s=Ke.round((e.getX()+i.getX()+t.getX()+n.getX())/4),o=Ke.round((e.getY()+i.getY()+t.getY()+n.getY())/4),new Tt(s,o)}getMatrixCornerPoints(e){return this.expandSquare(e,2*this.nbCenterLayers,this.getDimension())}sampleGrid(e,t,n,i,s){let o=wn.getInstance(),l=this.getDimension(),u=l/2-this.nbCenterLayers,h=l/2+this.nbCenterLayers;return o.sampleGrid(e,l,l,u,u,h,u,h,h,u,h,t.getX(),t.getY(),n.getX(),n.getY(),i.getX(),i.getY(),s.getX(),s.getY())}sampleLine(e,t,n){let i=0,s=this.distanceResultPoint(e,t),o=s/n,l=e.getX(),u=e.getY(),h=o*(t.getX()-e.getX())/s,p=o*(t.getY()-e.getY())/s;for(let A=0;A<n;A++)this.image.get(Ke.round(l+A*h),Ke.round(u+A*p))&&(i|=1<<n-A-1);return i}isWhiteOrBlackRectangle(e,t,n,i){let s=3;e=new Tt(e.getX()-s,e.getY()+s),t=new Tt(t.getX()-s,t.getY()-s),n=new Tt(n.getX()+s,n.getY()-s),i=new Tt(i.getX()+s,i.getY()+s);let o=this.getColor(i,e);if(o===0)return!1;let l=this.getColor(e,t);return l!==o||(l=this.getColor(t,n),l!==o)?!1:(l=this.getColor(n,i),l===o)}getColor(e,t){let n=this.distancePoint(e,t),i=(t.getX()-e.getX())/n,s=(t.getY()-e.getY())/n,o=0,l=e.getX(),u=e.getY(),h=this.image.get(e.getX(),e.getY()),p=Math.ceil(n);for(let b=0;b<p;b++)l+=i,u+=s,this.image.get(Ke.round(l),Ke.round(u))!==h&&o++;let A=o/n;return A>.1&&A<.9?0:A<=.1===h?1:-1}getFirstDifferent(e,t,n,i){let s=e.getX()+n,o=e.getY()+i;for(;this.isValid(s,o)&&this.image.get(s,o)===t;)s+=n,o+=i;for(s-=n,o-=i;this.isValid(s,o)&&this.image.get(s,o)===t;)s+=n;for(s-=n;this.isValid(s,o)&&this.image.get(s,o)===t;)o+=i;return o-=i,new Tt(s,o)}expandSquare(e,t,n){let i=n/(2*t),s=e[0].getX()-e[2].getX(),o=e[0].getY()-e[2].getY(),l=(e[0].getX()+e[2].getX())/2,u=(e[0].getY()+e[2].getY())/2,h=new le(l+i*s,u+i*o),p=new le(l-i*s,u-i*o);s=e[1].getX()-e[3].getX(),o=e[1].getY()-e[3].getY(),l=(e[1].getX()+e[3].getX())/2,u=(e[1].getY()+e[3].getY())/2;let A=new le(l+i*s,u+i*o),b=new le(l-i*s,u-i*o);return[h,A,p,b]}isValid(e,t){return e>=0&&e<this.image.getWidth()&&t>0&&t<this.image.getHeight()}isValidPoint(e){let t=Ke.round(e.getX()),n=Ke.round(e.getY());return this.isValid(t,n)}distancePoint(e,t){return Ke.distance(e.getX(),e.getY(),t.getX(),t.getY())}distanceResultPoint(e,t){return Ke.distance(e.getX(),e.getY(),t.getX(),t.getY())}getDimension(){return this.compact?4*this.nbLayers+11:this.nbLayers<=4?4*this.nbLayers+15:4*this.nbLayers+2*(fe.truncDivision(this.nbLayers-4,8)+1)+15}}class Er{decode(e,t=null){let n=null,i=new Rt(e.getBlackMatrix()),s=null,o=null;try{let p=i.detectMirror(!1);s=p.getPoints(),this.reportFoundResultPoints(t,s),o=new ut().decode(p)}catch(p){n=p}if(o==null)try{let p=i.detectMirror(!0);s=p.getPoints(),this.reportFoundResultPoints(t,s),o=new ut().decode(p)}catch(p){throw n??p}let l=new Ft(o.getText(),o.getRawBytes(),o.getNumBits(),s,me.AZTEC,ge.currentTimeMillis()),u=o.getByteSegments();u!=null&&l.putMetadata(gt.BYTE_SEGMENTS,u);let h=o.getECLevel();return h!=null&&l.putMetadata(gt.ERROR_CORRECTION_LEVEL,h),l}reportFoundResultPoints(e,t){if(e!=null){let n=e.get(Be.NEED_RESULT_POINT_CALLBACK);n!=null&&t.forEach((i,s,o)=>{n.foundPossibleResultPoint(i)})}}reset(){}}class Ni extends Wn{constructor(e=500){super(new Er,e)}}class Nt{decode(e,t){try{return this.doDecode(e,t)}catch{if(t&&t.get(Be.TRY_HARDER)===!0&&e.isRotateSupported()){const s=e.rotateCounterClockwise(),o=this.doDecode(s,t),l=o.getResultMetadata();let u=270;l!==null&&l.get(gt.ORIENTATION)===!0&&(u=u+l.get(gt.ORIENTATION)%360),o.putMetadata(gt.ORIENTATION,u);const h=o.getResultPoints();if(h!==null){const p=s.getHeight();for(let A=0;A<h.length;A++)h[A]=new le(p-h[A].getY()-1,h[A].getX())}return o}else throw new v}}reset(){}doDecode(e,t){const n=e.getWidth(),i=e.getHeight();let s=new _e(n);const o=t&&t.get(Be.TRY_HARDER)===!0,l=Math.max(1,i>>(o?8:5));let u;o?u=i:u=15;const h=Math.trunc(i/2);for(let p=0;p<u;p++){const A=Math.trunc((p+1)/2),b=(p&1)===0,L=h+l*(b?A:-A);if(L<0||L>=i)break;try{s=e.getBlackRow(L,s)}catch{continue}for(let E=0;E<2;E++){if(E===1&&(s.reverse(),t&&t.get(Be.NEED_RESULT_POINT_CALLBACK)===!0)){const M=new Map;t.forEach((D,P)=>M.set(P,D)),M.delete(Be.NEED_RESULT_POINT_CALLBACK),t=M}try{const M=this.decodeRow(L,s,t);if(E===1){M.putMetadata(gt.ORIENTATION,180);const D=M.getResultPoints();D!==null&&(D[0]=new le(n-D[0].getX()-1,D[0].getY()),D[1]=new le(n-D[1].getX()-1,D[1].getY()))}return M}catch{}}}throw new v}static recordPattern(e,t,n){const i=n.length;for(let h=0;h<i;h++)n[h]=0;const s=e.getSize();if(t>=s)throw new v;let o=!e.get(t),l=0,u=t;for(;u<s;){if(e.get(u)!==o)n[l]++;else{if(++l===i)break;n[l]=1,o=!o}u++}if(!(l===i||l===i-1&&u===s))throw new v}static recordPatternInReverse(e,t,n){let i=n.length,s=e.get(t);for(;t>0&&i>=0;)e.get(--t)!==s&&(i--,s=!s);if(i>=0)throw new v;Nt.recordPattern(e,t+1,n)}static patternMatchVariance(e,t,n){const i=e.length;let s=0,o=0;for(let h=0;h<i;h++)s+=e[h],o+=t[h];if(s<o)return Number.POSITIVE_INFINITY;const l=s/o;n*=l;let u=0;for(let h=0;h<i;h++){const p=e[h],A=t[h]*l,b=p>A?p-A:A-p;if(b>n)return Number.POSITIVE_INFINITY;u+=b}return u/s}}class ae extends Nt{static findStartPattern(e){const t=e.getSize(),n=e.getNextSet(0);let i=0,s=Int32Array.from([0,0,0,0,0,0]),o=n,l=!1;const u=6;for(let h=n;h<t;h++)if(e.get(h)!==l)s[i]++;else{if(i===u-1){let p=ae.MAX_AVG_VARIANCE,A=-1;for(let b=ae.CODE_START_A;b<=ae.CODE_START_C;b++){const L=Nt.patternMatchVariance(s,ae.CODE_PATTERNS[b],ae.MAX_INDIVIDUAL_VARIANCE);L<p&&(p=L,A=b)}if(A>=0&&e.isRange(Math.max(0,o-(h-o)/2),o,!1))return Int32Array.from([o,h,A]);o+=s[0]+s[1],s=s.slice(2,s.length-1),s[i-1]=0,s[i]=0,i--}else i++;s[i]=1,l=!l}throw new v}static decodeCode(e,t,n){Nt.recordPattern(e,n,t);let i=ae.MAX_AVG_VARIANCE,s=-1;for(let o=0;o<ae.CODE_PATTERNS.length;o++){const l=ae.CODE_PATTERNS[o],u=this.patternMatchVariance(t,l,ae.MAX_INDIVIDUAL_VARIANCE);u<i&&(i=u,s=o)}if(s>=0)return s;throw new v}decodeRow(e,t,n){const i=n&&n.get(Be.ASSUME_GS1)===!0,s=ae.findStartPattern(t),o=s[2];let l=0;const u=new Uint8Array(20);u[l++]=o;let h;switch(o){case ae.CODE_START_A:h=ae.CODE_CODE_A;break;case ae.CODE_START_B:h=ae.CODE_CODE_B;break;case ae.CODE_START_C:h=ae.CODE_CODE_C;break;default:throw new re}let p=!1,A=!1,b="",L=s[0],E=s[1];const M=Int32Array.from([0,0,0,0,0,0]);let D=0,P=0,K=o,q=0,Q=!0,xe=!1,Pe=!1;for(;!p;){const et=A;switch(A=!1,D=P,P=ae.decodeCode(t,M,E),u[l++]=P,P!==ae.CODE_STOP&&(Q=!0),P!==ae.CODE_STOP&&(q++,K+=q*P),L=E,E+=M.reduce((Ka,sa)=>Ka+sa,0),P){case ae.CODE_START_A:case ae.CODE_START_B:case ae.CODE_START_C:throw new re}switch(h){case ae.CODE_CODE_A:if(P<64)Pe===xe?b+=String.fromCharCode(32+P):b+=String.fromCharCode(32+P+128),Pe=!1;else if(P<96)Pe===xe?b+=String.fromCharCode(P-64):b+=String.fromCharCode(P+64),Pe=!1;else switch(P!==ae.CODE_STOP&&(Q=!1),P){case ae.CODE_FNC_1:i&&(b.length===0?b+="]C1":b+="");break;case ae.CODE_FNC_2:case ae.CODE_FNC_3:break;case ae.CODE_FNC_4_A:!xe&&Pe?(xe=!0,Pe=!1):xe&&Pe?(xe=!1,Pe=!1):Pe=!0;break;case ae.CODE_SHIFT:A=!0,h=ae.CODE_CODE_B;break;case ae.CODE_CODE_B:h=ae.CODE_CODE_B;break;case ae.CODE_CODE_C:h=ae.CODE_CODE_C;break;case ae.CODE_STOP:p=!0;break}break;case ae.CODE_CODE_B:if(P<96)Pe===xe?b+=String.fromCharCode(32+P):b+=String.fromCharCode(32+P+128),Pe=!1;else switch(P!==ae.CODE_STOP&&(Q=!1),P){case ae.CODE_FNC_1:i&&(b.length===0?b+="]C1":b+="");break;case ae.CODE_FNC_2:case ae.CODE_FNC_3:break;case ae.CODE_FNC_4_B:!xe&&Pe?(xe=!0,Pe=!1):xe&&Pe?(xe=!1,Pe=!1):Pe=!0;break;case ae.CODE_SHIFT:A=!0,h=ae.CODE_CODE_A;break;case ae.CODE_CODE_A:h=ae.CODE_CODE_A;break;case ae.CODE_CODE_C:h=ae.CODE_CODE_C;break;case ae.CODE_STOP:p=!0;break}break;case ae.CODE_CODE_C:if(P<100)P<10&&(b+="0"),b+=P;else switch(P!==ae.CODE_STOP&&(Q=!1),P){case ae.CODE_FNC_1:i&&(b.length===0?b+="]C1":b+="");break;case ae.CODE_CODE_A:h=ae.CODE_CODE_A;break;case ae.CODE_CODE_B:h=ae.CODE_CODE_B;break;case ae.CODE_STOP:p=!0;break}break}et&&(h=h===ae.CODE_CODE_A?ae.CODE_CODE_B:ae.CODE_CODE_A)}const Mn=E-L;if(E=t.getNextUnset(E),!t.isRange(E,Math.min(t.getSize(),E+(E-L)/2),!1))throw new v;if(K-=q*D,K%103!==D)throw new Ee;const Bt=b.length;if(Bt===0)throw new v;Bt>0&&Q&&(h===ae.CODE_CODE_C?b=b.substring(0,Bt-2):b=b.substring(0,Bt-1));const an=(s[1]+s[0])/2,wt=L+Mn/2,Pt=u.length,dn=new Uint8Array(Pt);for(let et=0;et<Pt;et++)dn[et]=u[et];const Tr=[new le(an,e),new le(wt,e)];return new Ft(b,dn,0,Tr,me.CODE_128,new Date().getTime())}}ae.CODE_PATTERNS=[Int32Array.from([2,1,2,2,2,2]),Int32Array.from([2,2,2,1,2,2]),Int32Array.from([2,2,2,2,2,1]),Int32Array.from([1,2,1,2,2,3]),Int32Array.from([1,2,1,3,2,2]),Int32Array.from([1,3,1,2,2,2]),Int32Array.from([1,2,2,2,1,3]),Int32Array.from([1,2,2,3,1,2]),Int32Array.from([1,3,2,2,1,2]),Int32Array.from([2,2,1,2,1,3]),Int32Array.from([2,2,1,3,1,2]),Int32Array.from([2,3,1,2,1,2]),Int32Array.from([1,1,2,2,3,2]),Int32Array.from([1,2,2,1,3,2]),Int32Array.from([1,2,2,2,3,1]),Int32Array.from([1,1,3,2,2,2]),Int32Array.from([1,2,3,1,2,2]),Int32Array.from([1,2,3,2,2,1]),Int32Array.from([2,2,3,2,1,1]),Int32Array.from([2,2,1,1,3,2]),Int32Array.from([2,2,1,2,3,1]),Int32Array.from([2,1,3,2,1,2]),Int32Array.from([2,2,3,1,1,2]),Int32Array.from([3,1,2,1,3,1]),Int32Array.from([3,1,1,2,2,2]),Int32Array.from([3,2,1,1,2,2]),Int32Array.from([3,2,1,2,2,1]),Int32Array.from([3,1,2,2,1,2]),Int32Array.from([3,2,2,1,1,2]),Int32Array.from([3,2,2,2,1,1]),Int32Array.from([2,1,2,1,2,3]),Int32Array.from([2,1,2,3,2,1]),Int32Array.from([2,3,2,1,2,1]),Int32Array.from([1,1,1,3,2,3]),Int32Array.from([1,3,1,1,2,3]),Int32Array.from([1,3,1,3,2,1]),Int32Array.from([1,1,2,3,1,3]),Int32Array.from([1,3,2,1,1,3]),Int32Array.from([1,3,2,3,1,1]),Int32Array.from([2,1,1,3,1,3]),Int32Array.from([2,3,1,1,1,3]),Int32Array.from([2,3,1,3,1,1]),Int32Array.from([1,1,2,1,3,3]),Int32Array.from([1,1,2,3,3,1]),Int32Array.from([1,3,2,1,3,1]),Int32Array.from([1,1,3,1,2,3]),Int32Array.from([1,1,3,3,2,1]),Int32Array.from([1,3,3,1,2,1]),Int32Array.from([3,1,3,1,2,1]),Int32Array.from([2,1,1,3,3,1]),Int32Array.from([2,3,1,1,3,1]),Int32Array.from([2,1,3,1,1,3]),Int32Array.from([2,1,3,3,1,1]),Int32Array.from([2,1,3,1,3,1]),Int32Array.from([3,1,1,1,2,3]),Int32Array.from([3,1,1,3,2,1]),Int32Array.from([3,3,1,1,2,1]),Int32Array.from([3,1,2,1,1,3]),Int32Array.from([3,1,2,3,1,1]),Int32Array.from([3,3,2,1,1,1]),Int32Array.from([3,1,4,1,1,1]),Int32Array.from([2,2,1,4,1,1]),Int32Array.from([4,3,1,1,1,1]),Int32Array.from([1,1,1,2,2,4]),Int32Array.from([1,1,1,4,2,2]),Int32Array.from([1,2,1,1,2,4]),Int32Array.from([1,2,1,4,2,1]),Int32Array.from([1,4,1,1,2,2]),Int32Array.from([1,4,1,2,2,1]),Int32Array.from([1,1,2,2,1,4]),Int32Array.from([1,1,2,4,1,2]),Int32Array.from([1,2,2,1,1,4]),Int32Array.from([1,2,2,4,1,1]),Int32Array.from([1,4,2,1,1,2]),Int32Array.from([1,4,2,2,1,1]),Int32Array.from([2,4,1,2,1,1]),Int32Array.from([2,2,1,1,1,4]),Int32Array.from([4,1,3,1,1,1]),Int32Array.from([2,4,1,1,1,2]),Int32Array.from([1,3,4,1,1,1]),Int32Array.from([1,1,1,2,4,2]),Int32Array.from([1,2,1,1,4,2]),Int32Array.from([1,2,1,2,4,1]),Int32Array.from([1,1,4,2,1,2]),Int32Array.from([1,2,4,1,1,2]),Int32Array.from([1,2,4,2,1,1]),Int32Array.from([4,1,1,2,1,2]),Int32Array.from([4,2,1,1,1,2]),Int32Array.from([4,2,1,2,1,1]),Int32Array.from([2,1,2,1,4,1]),Int32Array.from([2,1,4,1,2,1]),Int32Array.from([4,1,2,1,2,1]),Int32Array.from([1,1,1,1,4,3]),Int32Array.from([1,1,1,3,4,1]),Int32Array.from([1,3,1,1,4,1]),Int32Array.from([1,1,4,1,1,3]),Int32Array.from([1,1,4,3,1,1]),Int32Array.from([4,1,1,1,1,3]),Int32Array.from([4,1,1,3,1,1]),Int32Array.from([1,1,3,1,4,1]),Int32Array.from([1,1,4,1,3,1]),Int32Array.from([3,1,1,1,4,1]),Int32Array.from([4,1,1,1,3,1]),Int32Array.from([2,1,1,4,1,2]),Int32Array.from([2,1,1,2,1,4]),Int32Array.from([2,1,1,2,3,2]),Int32Array.from([2,3,3,1,1,1,2])],ae.MAX_AVG_VARIANCE=.25,ae.MAX_INDIVIDUAL_VARIANCE=.7,ae.CODE_SHIFT=98,ae.CODE_CODE_C=99,ae.CODE_CODE_B=100,ae.CODE_CODE_A=101,ae.CODE_FNC_1=102,ae.CODE_FNC_2=97,ae.CODE_FNC_3=96,ae.CODE_FNC_4_A=101,ae.CODE_FNC_4_B=100,ae.CODE_START_A=103,ae.CODE_START_B=104,ae.CODE_START_C=105,ae.CODE_STOP=106;class bt extends Nt{constructor(e=!1,t=!1){super(),this.usingCheckDigit=e,this.extendedMode=t,this.decodeRowResult="",this.counters=new Int32Array(9)}decodeRow(e,t,n){let i=this.counters;i.fill(0),this.decodeRowResult="";let s=bt.findAsteriskPattern(t,i),o=t.getNextSet(s[1]),l=t.getSize(),u,h;do{bt.recordPattern(t,o,i);let M=bt.toNarrowWidePattern(i);if(M<0)throw new v;u=bt.patternToChar(M),this.decodeRowResult+=u,h=o;for(let D of i)o+=D;o=t.getNextSet(o)}while(u!=="*");this.decodeRowResult=this.decodeRowResult.substring(0,this.decodeRowResult.length-1);let p=0;for(let M of i)p+=M;let A=o-h-p;if(o!==l&&A*2<p)throw new v;if(this.usingCheckDigit){let M=this.decodeRowResult.length-1,D=0;for(let P=0;P<M;P++)D+=bt.ALPHABET_STRING.indexOf(this.decodeRowResult.charAt(P));if(this.decodeRowResult.charAt(M)!==bt.ALPHABET_STRING.charAt(D%43))throw new Ee;this.decodeRowResult=this.decodeRowResult.substring(0,M)}if(this.decodeRowResult.length===0)throw new v;let b;this.extendedMode?b=bt.decodeExtended(this.decodeRowResult):b=this.decodeRowResult;let L=(s[1]+s[0])/2,E=h+p/2;return new Ft(b,null,0,[new le(L,e),new le(E,e)],me.CODE_39,new Date().getTime())}static findAsteriskPattern(e,t){let n=e.getSize(),i=e.getNextSet(0),s=0,o=i,l=!1,u=t.length;for(let h=i;h<n;h++)if(e.get(h)!==l)t[s]++;else{if(s===u-1){if(this.toNarrowWidePattern(t)===bt.ASTERISK_ENCODING&&e.isRange(Math.max(0,o-Math.floor((h-o)/2)),o,!1))return[o,h];o+=t[0]+t[1],t.copyWithin(0,2,2+s-1),t[s-1]=0,t[s]=0,s--}else s++;t[s]=1,l=!l}throw new v}static toNarrowWidePattern(e){let t=e.length,n=0,i;do{let s=2147483647;for(let u of e)u<s&&u>n&&(s=u);n=s,i=0;let o=0,l=0;for(let u=0;u<t;u++){let h=e[u];h>n&&(l|=1<<t-1-u,i++,o+=h)}if(i===3){for(let u=0;u<t&&i>0;u++){let h=e[u];if(h>n&&(i--,h*2>=o))return-1}return l}}while(i>3);return-1}static patternToChar(e){for(let t=0;t<bt.CHARACTER_ENCODINGS.length;t++)if(bt.CHARACTER_ENCODINGS[t]===e)return bt.ALPHABET_STRING.charAt(t);if(e===bt.ASTERISK_ENCODING)return"*";throw new v}static decodeExtended(e){let t=e.length,n="";for(let i=0;i<t;i++){let s=e.charAt(i);if(s==="+"||s==="$"||s==="%"||s==="/"){let o=e.charAt(i+1),l="\0";switch(s){case"+":if(o>="A"&&o<="Z")l=String.fromCharCode(o.charCodeAt(0)+32);else throw new re;break;case"$":if(o>="A"&&o<="Z")l=String.fromCharCode(o.charCodeAt(0)-64);else throw new re;break;case"%":if(o>="A"&&o<="E")l=String.fromCharCode(o.charCodeAt(0)-38);else if(o>="F"&&o<="J")l=String.fromCharCode(o.charCodeAt(0)-11);else if(o>="K"&&o<="O")l=String.fromCharCode(o.charCodeAt(0)+16);else if(o>="P"&&o<="T")l=String.fromCharCode(o.charCodeAt(0)+43);else if(o==="U")l="\0";else if(o==="V")l="@";else if(o==="W")l="`";else if(o==="X"||o==="Y"||o==="Z")l="";else throw new re;break;case"/":if(o>="A"&&o<="O")l=String.fromCharCode(o.charCodeAt(0)-32);else if(o==="Z")l=":";else throw new re;break}n+=l,i++}else n+=s}return n}}bt.ALPHABET_STRING="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%",bt.CHARACTER_ENCODINGS=[52,289,97,352,49,304,112,37,292,100,265,73,328,25,280,88,13,268,76,28,259,67,322,19,274,82,7,262,70,22,385,193,448,145,400,208,133,388,196,168,162,138,42],bt.ASTERISK_ENCODING=148;class it extends Nt{constructor(){super(...arguments),this.narrowLineWidth=-1}decodeRow(e,t,n){let i=this.decodeStart(t),s=this.decodeEnd(t),o=new rt;it.decodeMiddle(t,i[1],s[0],o);let l=o.toString(),u=null;n!=null&&(u=n.get(Be.ALLOWED_LENGTHS)),u==null&&(u=it.DEFAULT_ALLOWED_LENGTHS);let h=l.length,p=!1,A=0;for(let E of u){if(h===E){p=!0;break}E>A&&(A=E)}if(!p&&h>A&&(p=!0),!p)throw new re;const b=[new le(i[1],e),new le(s[0],e)];return new Ft(l,null,0,b,me.ITF,new Date().getTime())}static decodeMiddle(e,t,n,i){let s=new Int32Array(10),o=new Int32Array(5),l=new Int32Array(5);for(s.fill(0),o.fill(0),l.fill(0);t<n;){Nt.recordPattern(e,t,s);for(let h=0;h<5;h++){let p=2*h;o[h]=s[p],l[h]=s[p+1]}let u=it.decodeDigit(o);i.append(u.toString()),u=this.decodeDigit(l),i.append(u.toString()),s.forEach(function(h){t+=h})}}decodeStart(e){let t=it.skipWhiteSpace(e),n=it.findGuardPattern(e,t,it.START_PATTERN);return this.narrowLineWidth=(n[1]-n[0])/4,this.validateQuietZone(e,n[0]),n}validateQuietZone(e,t){let n=this.narrowLineWidth*10;n=n<t?n:t;for(let i=t-1;n>0&&i>=0&&!e.get(i);i--)n--;if(n!==0)throw new v}static skipWhiteSpace(e){const t=e.getSize(),n=e.getNextSet(0);if(n===t)throw new v;return n}decodeEnd(e){e.reverse();try{let t=it.skipWhiteSpace(e),n;try{n=it.findGuardPattern(e,t,it.END_PATTERN_REVERSED[0])}catch(s){s instanceof v&&(n=it.findGuardPattern(e,t,it.END_PATTERN_REVERSED[1]))}this.validateQuietZone(e,n[0]);let i=n[0];return n[0]=e.getSize()-n[1],n[1]=e.getSize()-i,n}finally{e.reverse()}}static findGuardPattern(e,t,n){let i=n.length,s=new Int32Array(i),o=e.getSize(),l=!1,u=0,h=t;s.fill(0);for(let p=t;p<o;p++)if(e.get(p)!==l)s[u]++;else{if(u===i-1){if(Nt.patternMatchVariance(s,n,it.MAX_INDIVIDUAL_VARIANCE)<it.MAX_AVG_VARIANCE)return[h,p];h+=s[0]+s[1],ge.arraycopy(s,2,s,0,u-1),s[u-1]=0,s[u]=0,u--}else u++;s[u]=1,l=!l}throw new v}static decodeDigit(e){let t=it.MAX_AVG_VARIANCE,n=-1,i=it.PATTERNS.length;for(let s=0;s<i;s++){let o=it.PATTERNS[s],l=Nt.patternMatchVariance(e,o,it.MAX_INDIVIDUAL_VARIANCE);l<t?(t=l,n=s):l===t&&(n=-1)}if(n>=0)return n%10;throw new v}}it.PATTERNS=[Int32Array.from([1,1,2,2,1]),Int32Array.from([2,1,1,1,2]),Int32Array.from([1,2,1,1,2]),Int32Array.from([2,2,1,1,1]),Int32Array.from([1,1,2,1,2]),Int32Array.from([2,1,2,1,1]),Int32Array.from([1,2,2,1,1]),Int32Array.from([1,1,1,2,2]),Int32Array.from([2,1,1,2,1]),Int32Array.from([1,2,1,2,1]),Int32Array.from([1,1,3,3,1]),Int32Array.from([3,1,1,1,3]),Int32Array.from([1,3,1,1,3]),Int32Array.from([3,3,1,1,1]),Int32Array.from([1,1,3,1,3]),Int32Array.from([3,1,3,1,1]),Int32Array.from([1,3,3,1,1]),Int32Array.from([1,1,1,3,3]),Int32Array.from([3,1,1,3,1]),Int32Array.from([1,3,1,3,1])],it.MAX_AVG_VARIANCE=.38,it.MAX_INDIVIDUAL_VARIANCE=.5,it.DEFAULT_ALLOWED_LENGTHS=[6,8,10,12,14],it.START_PATTERN=Int32Array.from([1,1,1,1]),it.END_PATTERN_REVERSED=[Int32Array.from([1,1,2]),Int32Array.from([1,1,3])];class xt extends Nt{constructor(){super(...arguments),this.decodeRowStringBuffer=""}static findStartGuardPattern(e){let t=!1,n,i=0,s=Int32Array.from([0,0,0]);for(;!t;){s=Int32Array.from([0,0,0]),n=xt.findGuardPattern(e,i,!1,this.START_END_PATTERN,s);let o=n[0];i=n[1];let l=o-(i-o);l>=0&&(t=e.isRange(l,o,!1))}return n}static checkChecksum(e){return xt.checkStandardUPCEANChecksum(e)}static checkStandardUPCEANChecksum(e){let t=e.length;if(t===0)return!1;let n=parseInt(e.charAt(t-1),10);return xt.getStandardUPCEANChecksum(e.substring(0,t-1))===n}static getStandardUPCEANChecksum(e){let t=e.length,n=0;for(let i=t-1;i>=0;i-=2){let s=e.charAt(i).charCodeAt(0)-48;if(s<0||s>9)throw new re;n+=s}n*=3;for(let i=t-2;i>=0;i-=2){let s=e.charAt(i).charCodeAt(0)-48;if(s<0||s>9)throw new re;n+=s}return(1e3-n)%10}static decodeEnd(e,t){return xt.findGuardPattern(e,t,!1,xt.START_END_PATTERN,new Int32Array(xt.START_END_PATTERN.length).fill(0))}static findGuardPatternWithoutCounters(e,t,n,i){return this.findGuardPattern(e,t,n,i,new Int32Array(i.length))}static findGuardPattern(e,t,n,i,s){let o=e.getSize();t=n?e.getNextUnset(t):e.getNextSet(t);let l=0,u=t,h=i.length,p=n;for(let A=t;A<o;A++)if(e.get(A)!==p)s[l]++;else{if(l===h-1){if(Nt.patternMatchVariance(s,i,xt.MAX_INDIVIDUAL_VARIANCE)<xt.MAX_AVG_VARIANCE)return Int32Array.from([u,A]);u+=s[0]+s[1];let b=s.slice(2,s.length-1);for(let L=0;L<l-1;L++)s[L]=b[L];s[l-1]=0,s[l]=0,l--}else l++;s[l]=1,p=!p}throw new v}static decodeDigit(e,t,n,i){this.recordPattern(e,n,t);let s=this.MAX_AVG_VARIANCE,o=-1,l=i.length;for(let u=0;u<l;u++){let h=i[u],p=Nt.patternMatchVariance(t,h,xt.MAX_INDIVIDUAL_VARIANCE);p<s&&(s=p,o=u)}if(o>=0)return o;throw new v}}xt.MAX_AVG_VARIANCE=.48,xt.MAX_INDIVIDUAL_VARIANCE=.7,xt.START_END_PATTERN=Int32Array.from([1,1,1]),xt.MIDDLE_PATTERN=Int32Array.from([1,1,1,1,1]),xt.END_PATTERN=Int32Array.from([1,1,1,1,1,1]),xt.L_PATTERNS=[Int32Array.from([3,2,1,1]),Int32Array.from([2,2,2,1]),Int32Array.from([2,1,2,2]),Int32Array.from([1,4,1,1]),Int32Array.from([1,1,3,2]),Int32Array.from([1,2,3,1]),Int32Array.from([1,1,1,4]),Int32Array.from([1,3,1,2]),Int32Array.from([1,2,1,3]),Int32Array.from([3,1,1,2])];class Xr{constructor(){this.CHECK_DIGIT_ENCODINGS=[24,20,18,17,12,6,3,10,9,5],this.decodeMiddleCounters=Int32Array.from([0,0,0,0]),this.decodeRowStringBuffer=""}decodeRow(e,t,n){let i=this.decodeRowStringBuffer,s=this.decodeMiddle(t,n,i),o=i.toString(),l=Xr.parseExtensionString(o),u=[new le((n[0]+n[1])/2,e),new le(s,e)],h=new Ft(o,null,0,u,me.UPC_EAN_EXTENSION,new Date().getTime());return l!=null&&h.putAllMetadata(l),h}decodeMiddle(e,t,n){let i=this.decodeMiddleCounters;i[0]=0,i[1]=0,i[2]=0,i[3]=0;let s=e.getSize(),o=t[1],l=0;for(let h=0;h<5&&o<s;h++){let p=xt.decodeDigit(e,i,o,xt.L_AND_G_PATTERNS);n+=String.fromCharCode(48+p%10);for(let A of i)o+=A;p>=10&&(l|=1<<4-h),h!==4&&(o=e.getNextSet(o),o=e.getNextUnset(o))}if(n.length!==5)throw new v;let u=this.determineCheckDigit(l);if(Xr.extensionChecksum(n.toString())!==u)throw new v;return o}static extensionChecksum(e){let t=e.length,n=0;for(let i=t-2;i>=0;i-=2)n+=e.charAt(i).charCodeAt(0)-48;n*=3;for(let i=t-1;i>=0;i-=2)n+=e.charAt(i).charCodeAt(0)-48;return n*=3,n%10}determineCheckDigit(e){for(let t=0;t<10;t++)if(e===this.CHECK_DIGIT_ENCODINGS[t])return t;throw new v}static parseExtensionString(e){if(e.length!==5)return null;let t=Xr.parseExtension5String(e);return t==null?null:new Map([[gt.SUGGESTED_PRICE,t]])}static parseExtension5String(e){let t;switch(e.charAt(0)){case"0":t="£";break;case"5":t="$";break;case"9":switch(e){case"90000":return null;case"99991":return"0.00";case"99990":return"Used"}t="";break;default:t="";break}let n=parseInt(e.substring(1)),i=(n/100).toString(),s=n%100,o=s<10?"0"+s:s.toString();return t+i+"."+o}}class vi{constructor(){this.decodeMiddleCounters=Int32Array.from([0,0,0,0]),this.decodeRowStringBuffer=""}decodeRow(e,t,n){let i=this.decodeRowStringBuffer,s=this.decodeMiddle(t,n,i),o=i.toString(),l=vi.parseExtensionString(o),u=[new le((n[0]+n[1])/2,e),new le(s,e)],h=new Ft(o,null,0,u,me.UPC_EAN_EXTENSION,new Date().getTime());return l!=null&&h.putAllMetadata(l),h}decodeMiddle(e,t,n){let i=this.decodeMiddleCounters;i[0]=0,i[1]=0,i[2]=0,i[3]=0;let s=e.getSize(),o=t[1],l=0;for(let u=0;u<2&&o<s;u++){let h=xt.decodeDigit(e,i,o,xt.L_AND_G_PATTERNS);n+=String.fromCharCode(48+h%10);for(let p of i)o+=p;h>=10&&(l|=1<<1-u),u!==1&&(o=e.getNextSet(o),o=e.getNextUnset(o))}if(n.length!==2)throw new v;if(parseInt(n.toString())%4!==l)throw new v;return o}static parseExtensionString(e){return e.length!==2?null:new Map([[gt.ISSUE_NUMBER,parseInt(e)]])}}class Qi{static decodeRow(e,t,n){let i=xt.findGuardPattern(t,n,!1,this.EXTENSION_START_PATTERN,new Int32Array(this.EXTENSION_START_PATTERN.length).fill(0));try{return new Xr().decodeRow(e,t,i)}catch{return new vi().decodeRow(e,t,i)}}}Qi.EXTENSION_START_PATTERN=Int32Array.from([1,1,2]);class qe extends xt{constructor(){super(),this.decodeRowStringBuffer="",qe.L_AND_G_PATTERNS=qe.L_PATTERNS.map(e=>Int32Array.from(e));for(let e=10;e<20;e++){let t=qe.L_PATTERNS[e-10],n=new Int32Array(t.length);for(let i=0;i<t.length;i++)n[i]=t[t.length-i-1];qe.L_AND_G_PATTERNS[e]=n}}decodeRow(e,t,n){let i=qe.findStartGuardPattern(t),s=n==null?null:n.get(Be.NEED_RESULT_POINT_CALLBACK);if(s!=null){const Q=new le((i[0]+i[1])/2,e);s.foundPossibleResultPoint(Q)}let o=this.decodeMiddle(t,i,this.decodeRowStringBuffer),l=o.rowOffset,u=o.resultString;if(s!=null){const Q=new le(l,e);s.foundPossibleResultPoint(Q)}let h=this.decodeEnd(t,l);if(s!=null){const Q=new le((h[0]+h[1])/2,e);s.foundPossibleResultPoint(Q)}let p=h[1],A=p+(p-h[0]);if(A>=t.getSize()||!t.isRange(p,A,!1))throw new v;let b=u.toString();if(b.length<8)throw new re;if(!qe.checkChecksum(b))throw new Ee;let L=(i[1]+i[0])/2,E=(h[1]+h[0])/2,M=this.getBarcodeFormat(),D=[new le(L,e),new le(E,e)],P=new Ft(b,null,0,D,M,new Date().getTime()),K=0;try{let Q=Qi.decodeRow(e,t,h[1]);P.putMetadata(gt.UPC_EAN_EXTENSION,Q.getText()),P.putAllMetadata(Q.getResultMetadata()),P.addResultPoints(Q.getResultPoints()),K=Q.getText().length}catch{}let q=n==null?null:n.get(Be.ALLOWED_EAN_EXTENSIONS);if(q!=null){let Q=!1;for(let xe in q)if(K.toString()===xe){Q=!0;break}if(!Q)throw new v}return P}decodeEnd(e,t){return qe.findGuardPattern(e,t,!1,qe.START_END_PATTERN,new Int32Array(qe.START_END_PATTERN.length).fill(0))}static checkChecksum(e){return qe.checkStandardUPCEANChecksum(e)}static checkStandardUPCEANChecksum(e){let t=e.length;if(t===0)return!1;let n=parseInt(e.charAt(t-1),10);return qe.getStandardUPCEANChecksum(e.substring(0,t-1))===n}static getStandardUPCEANChecksum(e){let t=e.length,n=0;for(let i=t-1;i>=0;i-=2){let s=e.charAt(i).charCodeAt(0)-48;if(s<0||s>9)throw new re;n+=s}n*=3;for(let i=t-2;i>=0;i-=2){let s=e.charAt(i).charCodeAt(0)-48;if(s<0||s>9)throw new re;n+=s}return(1e3-n)%10}}class Jn extends qe{constructor(){super(),this.decodeMiddleCounters=Int32Array.from([0,0,0,0])}decodeMiddle(e,t,n){let i=this.decodeMiddleCounters;i[0]=0,i[1]=0,i[2]=0,i[3]=0;let s=e.getSize(),o=t[1],l=0;for(let h=0;h<6&&o<s;h++){let p=qe.decodeDigit(e,i,o,qe.L_AND_G_PATTERNS);n+=String.fromCharCode(48+p%10);for(let A of i)o+=A;p>=10&&(l|=1<<5-h)}n=Jn.determineFirstDigit(n,l),o=qe.findGuardPattern(e,o,!0,qe.MIDDLE_PATTERN,new Int32Array(qe.MIDDLE_PATTERN.length).fill(0))[1];for(let h=0;h<6&&o<s;h++){let p=qe.decodeDigit(e,i,o,qe.L_PATTERNS);n+=String.fromCharCode(48+p);for(let A of i)o+=A}return{rowOffset:o,resultString:n}}getBarcodeFormat(){return me.EAN_13}static determineFirstDigit(e,t){for(let n=0;n<10;n++)if(t===this.FIRST_DIGIT_ENCODINGS[n])return e=String.fromCharCode(48+n)+e,e;throw new v}}Jn.FIRST_DIGIT_ENCODINGS=[0,11,13,14,19,25,28,21,22,26];class Mi extends qe{constructor(){super(),this.decodeMiddleCounters=Int32Array.from([0,0,0,0])}decodeMiddle(e,t,n){const i=this.decodeMiddleCounters;i[0]=0,i[1]=0,i[2]=0,i[3]=0;let s=e.getSize(),o=t[1];for(let u=0;u<4&&o<s;u++){let h=qe.decodeDigit(e,i,o,qe.L_PATTERNS);n+=String.fromCharCode(48+h);for(let p of i)o+=p}o=qe.findGuardPattern(e,o,!0,qe.MIDDLE_PATTERN,new Int32Array(qe.MIDDLE_PATTERN.length).fill(0))[1];for(let u=0;u<4&&o<s;u++){let h=qe.decodeDigit(e,i,o,qe.L_PATTERNS);n+=String.fromCharCode(48+h);for(let p of i)o+=p}return{rowOffset:o,resultString:n}}getBarcodeFormat(){return me.EAN_8}}class Oi extends qe{constructor(){super(...arguments),this.ean13Reader=new Jn}getBarcodeFormat(){return me.UPC_A}decode(e,t){return this.maybeReturnResult(this.ean13Reader.decode(e))}decodeRow(e,t,n){return this.maybeReturnResult(this.ean13Reader.decodeRow(e,t,n))}decodeMiddle(e,t,n){return this.ean13Reader.decodeMiddle(e,t,n)}maybeReturnResult(e){let t=e.getText();if(t.charAt(0)==="0"){let n=new Ft(t.substring(1),null,null,e.getResultPoints(),me.UPC_A);return e.getResultMetadata()!=null&&n.putAllMetadata(e.getResultMetadata()),n}else throw new v}reset(){this.ean13Reader.reset()}}class _n extends qe{constructor(){super(),this.decodeMiddleCounters=new Int32Array(4)}decodeMiddle(e,t,n){const i=this.decodeMiddleCounters.map(h=>h);i[0]=0,i[1]=0,i[2]=0,i[3]=0;const s=e.getSize();let o=t[1],l=0;for(let h=0;h<6&&o<s;h++){const p=_n.decodeDigit(e,i,o,_n.L_AND_G_PATTERNS);n+=String.fromCharCode(48+p%10);for(let A of i)o+=A;p>=10&&(l|=1<<5-h)}let u=_n.determineNumSysAndCheckDigit(n,l);return{rowOffset:o,resultString:u}}decodeEnd(e,t){return _n.findGuardPatternWithoutCounters(e,t,!0,_n.MIDDLE_END_PATTERN)}checkChecksum(e){return qe.checkChecksum(_n.convertUPCEtoUPCA(e))}static determineNumSysAndCheckDigit(e,t){for(let n=0;n<=1;n++)for(let i=0;i<10;i++)if(t===this.NUMSYS_AND_CHECK_DIGIT_PATTERNS[n][i]){let s=String.fromCharCode(48+n),o=String.fromCharCode(48+i);return s+e+o}throw v.getNotFoundInstance()}getBarcodeFormat(){return me.UPC_E}static convertUPCEtoUPCA(e){const t=e.slice(1,7).split("").map(s=>s.charCodeAt(0)),n=new rt;n.append(e.charAt(0));let i=t[5];switch(i){case 0:case 1:case 2:n.appendChars(t,0,2),n.append(i),n.append("0000"),n.appendChars(t,2,3);break;case 3:n.appendChars(t,0,3),n.append("00000"),n.appendChars(t,3,2);break;case 4:n.appendChars(t,0,4),n.append("00000"),n.append(t[4]);break;default:n.appendChars(t,0,5),n.append("0000"),n.append(i);break}return e.length>=8&&n.append(e.charAt(7)),n.toString()}}_n.MIDDLE_END_PATTERN=Int32Array.from([1,1,1,1,1,1]),_n.NUMSYS_AND_CHECK_DIGIT_PATTERNS=[Int32Array.from([56,52,50,49,44,38,35,42,41,37]),Int32Array.from([7,11,13,14,19,25,28,21,22,26])];class ui extends Nt{constructor(e){super();let t=e==null?null:e.get(Be.POSSIBLE_FORMATS),n=[];y(t)?(n.push(new Jn),n.push(new Oi),n.push(new Mi),n.push(new _n)):(t.indexOf(me.EAN_13)>-1&&n.push(new Jn),t.indexOf(me.UPC_A)>-1&&n.push(new Oi),t.indexOf(me.EAN_8)>-1&&n.push(new Mi),t.indexOf(me.UPC_E)>-1&&n.push(new _n)),this.readers=n}decodeRow(e,t,n){for(let i of this.readers)try{const s=i.decodeRow(e,t,n),o=s.getBarcodeFormat()===me.EAN_13&&s.getText().charAt(0)==="0",l=n==null?null:n.get(Be.POSSIBLE_FORMATS),u=l==null||l.includes(me.UPC_A);if(o&&u){const h=s.getRawBytes(),p=new Ft(s.getText().substring(1),h,h?h.length:null,s.getResultPoints(),me.UPC_A);return p.putAllMetadata(s.getResultMetadata()),p}return s}catch{}throw new v}reset(){for(let e of this.readers)e.reset()}}class jt extends Nt{constructor(){super(),this.decodeFinderCounters=new Int32Array(4),this.dataCharacterCounters=new Int32Array(8),this.oddRoundingErrors=new Array(4),this.evenRoundingErrors=new Array(4),this.oddCounts=new Array(this.dataCharacterCounters.length/2),this.evenCounts=new Array(this.dataCharacterCounters.length/2)}getDecodeFinderCounters(){return this.decodeFinderCounters}getDataCharacterCounters(){return this.dataCharacterCounters}getOddRoundingErrors(){return this.oddRoundingErrors}getEvenRoundingErrors(){return this.evenRoundingErrors}getOddCounts(){return this.oddCounts}getEvenCounts(){return this.evenCounts}parseFinderValue(e,t){for(let n=0;n<t.length;n++)if(Nt.patternMatchVariance(e,t[n],jt.MAX_INDIVIDUAL_VARIANCE)<jt.MAX_AVG_VARIANCE)return n;throw new v}static count(e){return Ke.sum(new Int32Array(e))}static increment(e,t){let n=0,i=t[0];for(let s=1;s<e.length;s++)t[s]>i&&(i=t[s],n=s);e[n]++}static decrement(e,t){let n=0,i=t[0];for(let s=1;s<e.length;s++)t[s]<i&&(i=t[s],n=s);e[n]--}static isFinderPattern(e){let t=e[0]+e[1],n=t+e[2]+e[3],i=t/n;if(i>=jt.MIN_FINDER_PATTERN_RATIO&&i<=jt.MAX_FINDER_PATTERN_RATIO){let s=Number.MAX_SAFE_INTEGER,o=Number.MIN_SAFE_INTEGER;for(let l of e)l>o&&(o=l),l<s&&(s=l);return o<10*s}return!1}}jt.MAX_AVG_VARIANCE=.2,jt.MAX_INDIVIDUAL_VARIANCE=.45,jt.MIN_FINDER_PATTERN_RATIO=9.5/12,jt.MAX_FINDER_PATTERN_RATIO=12.5/14;class yr{constructor(e,t){this.value=e,this.checksumPortion=t}getValue(){return this.value}getChecksumPortion(){return this.checksumPortion}toString(){return this.value+"("+this.checksumPortion+")"}equals(e){if(!(e instanceof yr))return!1;const t=e;return this.value===t.value&&this.checksumPortion===t.checksumPortion}hashCode(){return this.value^this.checksumPortion}}class Zr{constructor(e,t,n,i,s){this.value=e,this.startEnd=t,this.value=e,this.startEnd=t,this.resultPoints=new Array,this.resultPoints.push(new le(n,s)),this.resultPoints.push(new le(i,s))}getValue(){return this.value}getStartEnd(){return this.startEnd}getResultPoints(){return this.resultPoints}equals(e){if(!(e instanceof Zr))return!1;const t=e;return this.value===t.value}hashCode(){return this.value}}class Pn{constructor(){}static getRSSvalue(e,t,n){let i=0;for(let u of e)i+=u;let s=0,o=0,l=e.length;for(let u=0;u<l-1;u++){let h;for(h=1,o|=1<<u;h<e[u];h++,o&=~(1<<u)){let p=Pn.combins(i-h-1,l-u-2);if(n&&o===0&&i-h-(l-u-1)>=l-u-1&&(p-=Pn.combins(i-h-(l-u),l-u-2)),l-u-1>1){let A=0;for(let b=i-h-(l-u-2);b>t;b--)A+=Pn.combins(i-h-b-1,l-u-3);p-=A*(l-1-u)}else i-h>t&&p--;s+=p}i-=h}return s}static combins(e,t){let n,i;e-t>t?(i=t,n=e-t):(i=e-t,n=t);let s=1,o=1;for(let l=e;l>n;l--)s*=l,o<=i&&(s/=o,o++);for(;o<=i;)s/=o,o++;return s}}class fi{static buildBitArray(e){let t=e.length*2-1;e[e.length-1].getRightChar()==null&&(t-=1);let n=12*t,i=new _e(n),s=0,l=e[0].getRightChar().getValue();for(let u=11;u>=0;--u)(l&1<<u)!=0&&i.set(s),s++;for(let u=1;u<e.length;++u){let h=e[u],p=h.getLeftChar().getValue();for(let A=11;A>=0;--A)(p&1<<A)!=0&&i.set(s),s++;if(h.getRightChar()!=null){let A=h.getRightChar().getValue();for(let b=11;b>=0;--b)(A&1<<b)!=0&&i.set(s),s++}}return i}}class ur{constructor(e,t){t?this.decodedInformation=null:(this.finished=e,this.decodedInformation=t)}getDecodedInformation(){return this.decodedInformation}isFinished(){return this.finished}}class kr{constructor(e){this.newPosition=e}getNewPosition(){return this.newPosition}}class tn extends kr{constructor(e,t){super(e),this.value=t}getValue(){return this.value}isFNC1(){return this.value===tn.FNC1}}tn.FNC1="$";class fr extends kr{constructor(e,t,n){super(e),n?(this.remaining=!0,this.remainingValue=this.remainingValue):(this.remaining=!1,this.remainingValue=0),this.newString=t}getNewString(){return this.newString}isRemaining(){return this.remaining}getRemainingValue(){return this.remainingValue}}class An extends kr{constructor(e,t,n){if(super(e),t<0||t>10||n<0||n>10)throw new re;this.firstDigit=t,this.secondDigit=n}getFirstDigit(){return this.firstDigit}getSecondDigit(){return this.secondDigit}getValue(){return this.firstDigit*10+this.secondDigit}isFirstDigitFNC1(){return this.firstDigit===An.FNC1}isSecondDigitFNC1(){return this.secondDigit===An.FNC1}isAnyFNC1(){return this.firstDigit===An.FNC1||this.secondDigit===An.FNC1}}An.FNC1=10;class ue{constructor(){}static parseFieldsInGeneralPurpose(e){if(!e)return null;if(e.length<2)throw new v;let t=e.substring(0,2);for(let s of ue.TWO_DIGIT_DATA_LENGTH)if(s[0]===t)return s[1]===ue.VARIABLE_LENGTH?ue.processVariableAI(2,s[2],e):ue.processFixedAI(2,s[1],e);if(e.length<3)throw new v;let n=e.substring(0,3);for(let s of ue.THREE_DIGIT_DATA_LENGTH)if(s[0]===n)return s[1]===ue.VARIABLE_LENGTH?ue.processVariableAI(3,s[2],e):ue.processFixedAI(3,s[1],e);for(let s of ue.THREE_DIGIT_PLUS_DIGIT_DATA_LENGTH)if(s[0]===n)return s[1]===ue.VARIABLE_LENGTH?ue.processVariableAI(4,s[2],e):ue.processFixedAI(4,s[1],e);if(e.length<4)throw new v;let i=e.substring(0,4);for(let s of ue.FOUR_DIGIT_DATA_LENGTH)if(s[0]===i)return s[1]===ue.VARIABLE_LENGTH?ue.processVariableAI(4,s[2],e):ue.processFixedAI(4,s[1],e);throw new v}static processFixedAI(e,t,n){if(n.length<e)throw new v;let i=n.substring(0,e);if(n.length<e+t)throw new v;let s=n.substring(e,e+t),o=n.substring(e+t),l="("+i+")"+s,u=ue.parseFieldsInGeneralPurpose(o);return u==null?l:l+u}static processVariableAI(e,t,n){let i=n.substring(0,e),s;n.length<e+t?s=n.length:s=e+t;let o=n.substring(e,s),l=n.substring(s),u="("+i+")"+o,h=ue.parseFieldsInGeneralPurpose(l);return h==null?u:u+h}}ue.VARIABLE_LENGTH=[],ue.TWO_DIGIT_DATA_LENGTH=[["00",18],["01",14],["02",14],["10",ue.VARIABLE_LENGTH,20],["11",6],["12",6],["13",6],["15",6],["17",6],["20",2],["21",ue.VARIABLE_LENGTH,20],["22",ue.VARIABLE_LENGTH,29],["30",ue.VARIABLE_LENGTH,8],["37",ue.VARIABLE_LENGTH,8],["90",ue.VARIABLE_LENGTH,30],["91",ue.VARIABLE_LENGTH,30],["92",ue.VARIABLE_LENGTH,30],["93",ue.VARIABLE_LENGTH,30],["94",ue.VARIABLE_LENGTH,30],["95",ue.VARIABLE_LENGTH,30],["96",ue.VARIABLE_LENGTH,30],["97",ue.VARIABLE_LENGTH,3],["98",ue.VARIABLE_LENGTH,30],["99",ue.VARIABLE_LENGTH,30]],ue.THREE_DIGIT_DATA_LENGTH=[["240",ue.VARIABLE_LENGTH,30],["241",ue.VARIABLE_LENGTH,30],["242",ue.VARIABLE_LENGTH,6],["250",ue.VARIABLE_LENGTH,30],["251",ue.VARIABLE_LENGTH,30],["253",ue.VARIABLE_LENGTH,17],["254",ue.VARIABLE_LENGTH,20],["400",ue.VARIABLE_LENGTH,30],["401",ue.VARIABLE_LENGTH,30],["402",17],["403",ue.VARIABLE_LENGTH,30],["410",13],["411",13],["412",13],["413",13],["414",13],["420",ue.VARIABLE_LENGTH,20],["421",ue.VARIABLE_LENGTH,15],["422",3],["423",ue.VARIABLE_LENGTH,15],["424",3],["425",3],["426",3]],ue.THREE_DIGIT_PLUS_DIGIT_DATA_LENGTH=[["310",6],["311",6],["312",6],["313",6],["314",6],["315",6],["316",6],["320",6],["321",6],["322",6],["323",6],["324",6],["325",6],["326",6],["327",6],["328",6],["329",6],["330",6],["331",6],["332",6],["333",6],["334",6],["335",6],["336",6],["340",6],["341",6],["342",6],["343",6],["344",6],["345",6],["346",6],["347",6],["348",6],["349",6],["350",6],["351",6],["352",6],["353",6],["354",6],["355",6],["356",6],["357",6],["360",6],["361",6],["362",6],["363",6],["364",6],["365",6],["366",6],["367",6],["368",6],["369",6],["390",ue.VARIABLE_LENGTH,15],["391",ue.VARIABLE_LENGTH,18],["392",ue.VARIABLE_LENGTH,15],["393",ue.VARIABLE_LENGTH,18],["703",ue.VARIABLE_LENGTH,30]],ue.FOUR_DIGIT_DATA_LENGTH=[["7001",13],["7002",ue.VARIABLE_LENGTH,30],["7003",10],["8001",14],["8002",ue.VARIABLE_LENGTH,20],["8003",ue.VARIABLE_LENGTH,30],["8004",ue.VARIABLE_LENGTH,30],["8005",6],["8006",18],["8007",ue.VARIABLE_LENGTH,30],["8008",ue.VARIABLE_LENGTH,12],["8018",18],["8020",ue.VARIABLE_LENGTH,25],["8100",6],["8101",10],["8102",2],["8110",ue.VARIABLE_LENGTH,70],["8200",ue.VARIABLE_LENGTH,70]];class Ir{constructor(e){this.buffer=new rt,this.information=e}decodeAllCodes(e,t){let n=t,i=null;do{let s=this.decodeGeneralPurposeField(n,i),o=ue.parseFieldsInGeneralPurpose(s.getNewString());if(o!=null&&e.append(o),s.isRemaining()?i=""+s.getRemainingValue():i=null,n===s.getNewPosition())break;n=s.getNewPosition()}while(!0);return e.toString()}isStillNumeric(e){if(e+7>this.information.getSize())return e+4<=this.information.getSize();for(let t=e;t<e+3;++t)if(this.information.get(t))return!0;return this.information.get(e+3)}decodeNumeric(e){if(e+7>this.information.getSize()){let s=this.extractNumericValueFromBitArray(e,4);return s===0?new An(this.information.getSize(),An.FNC1,An.FNC1):new An(this.information.getSize(),s-1,An.FNC1)}let t=this.extractNumericValueFromBitArray(e,7),n=(t-8)/11,i=(t-8)%11;return new An(e+7,n,i)}extractNumericValueFromBitArray(e,t){return Ir.extractNumericValueFromBitArray(this.information,e,t)}static extractNumericValueFromBitArray(e,t,n){let i=0;for(let s=0;s<n;++s)e.get(t+s)&&(i|=1<<n-s-1);return i}decodeGeneralPurposeField(e,t){this.buffer.setLengthToZero(),t!=null&&this.buffer.append(t),this.current.setPosition(e);let n=this.parseBlocks();return n!=null&&n.isRemaining()?new fr(this.current.getPosition(),this.buffer.toString(),n.getRemainingValue()):new fr(this.current.getPosition(),this.buffer.toString())}parseBlocks(){let e,t;do{let n=this.current.getPosition();if(this.current.isAlpha()?(t=this.parseAlphaBlock(),e=t.isFinished()):this.current.isIsoIec646()?(t=this.parseIsoIec646Block(),e=t.isFinished()):(t=this.parseNumericBlock(),e=t.isFinished()),!(n!==this.current.getPosition())&&!e)break}while(!e);return t.getDecodedInformation()}parseNumericBlock(){for(;this.isStillNumeric(this.current.getPosition());){let e=this.decodeNumeric(this.current.getPosition());if(this.current.setPosition(e.getNewPosition()),e.isFirstDigitFNC1()){let t;return e.isSecondDigitFNC1()?t=new fr(this.current.getPosition(),this.buffer.toString()):t=new fr(this.current.getPosition(),this.buffer.toString(),e.getSecondDigit()),new ur(!0,t)}if(this.buffer.append(e.getFirstDigit()),e.isSecondDigitFNC1()){let t=new fr(this.current.getPosition(),this.buffer.toString());return new ur(!0,t)}this.buffer.append(e.getSecondDigit())}return this.isNumericToAlphaNumericLatch(this.current.getPosition())&&(this.current.setAlpha(),this.current.incrementPosition(4)),new ur(!1)}parseIsoIec646Block(){for(;this.isStillIsoIec646(this.current.getPosition());){let e=this.decodeIsoIec646(this.current.getPosition());if(this.current.setPosition(e.getNewPosition()),e.isFNC1()){let t=new fr(this.current.getPosition(),this.buffer.toString());return new ur(!0,t)}this.buffer.append(e.getValue())}return this.isAlphaOr646ToNumericLatch(this.current.getPosition())?(this.current.incrementPosition(3),this.current.setNumeric()):this.isAlphaTo646ToAlphaLatch(this.current.getPosition())&&(this.current.getPosition()+5<this.information.getSize()?this.current.incrementPosition(5):this.current.setPosition(this.information.getSize()),this.current.setAlpha()),new ur(!1)}parseAlphaBlock(){for(;this.isStillAlpha(this.current.getPosition());){let e=this.decodeAlphanumeric(this.current.getPosition());if(this.current.setPosition(e.getNewPosition()),e.isFNC1()){let t=new fr(this.current.getPosition(),this.buffer.toString());return new ur(!0,t)}this.buffer.append(e.getValue())}return this.isAlphaOr646ToNumericLatch(this.current.getPosition())?(this.current.incrementPosition(3),this.current.setNumeric()):this.isAlphaTo646ToAlphaLatch(this.current.getPosition())&&(this.current.getPosition()+5<this.information.getSize()?this.current.incrementPosition(5):this.current.setPosition(this.information.getSize()),this.current.setIsoIec646()),new ur(!1)}isStillIsoIec646(e){if(e+5>this.information.getSize())return!1;let t=this.extractNumericValueFromBitArray(e,5);if(t>=5&&t<16)return!0;if(e+7>this.information.getSize())return!1;let n=this.extractNumericValueFromBitArray(e,7);if(n>=64&&n<116)return!0;if(e+8>this.information.getSize())return!1;let i=this.extractNumericValueFromBitArray(e,8);return i>=232&&i<253}decodeIsoIec646(e){let t=this.extractNumericValueFromBitArray(e,5);if(t===15)return new tn(e+5,tn.FNC1);if(t>=5&&t<15)return new tn(e+5,"0"+(t-5));let n=this.extractNumericValueFromBitArray(e,7);if(n>=64&&n<90)return new tn(e+7,""+(n+1));if(n>=90&&n<116)return new tn(e+7,""+(n+7));let i=this.extractNumericValueFromBitArray(e,8),s;switch(i){case 232:s="!";break;case 233:s='"';break;case 234:s="%";break;case 235:s="&";break;case 236:s="'";break;case 237:s="(";break;case 238:s=")";break;case 239:s="*";break;case 240:s="+";break;case 241:s=",";break;case 242:s="-";break;case 243:s=".";break;case 244:s="/";break;case 245:s=":";break;case 246:s=";";break;case 247:s="<";break;case 248:s="=";break;case 249:s=">";break;case 250:s="?";break;case 251:s="_";break;case 252:s=" ";break;default:throw new re}return new tn(e+8,s)}isStillAlpha(e){if(e+5>this.information.getSize())return!1;let t=this.extractNumericValueFromBitArray(e,5);if(t>=5&&t<16)return!0;if(e+6>this.information.getSize())return!1;let n=this.extractNumericValueFromBitArray(e,6);return n>=16&&n<63}decodeAlphanumeric(e){let t=this.extractNumericValueFromBitArray(e,5);if(t===15)return new tn(e+5,tn.FNC1);if(t>=5&&t<15)return new tn(e+5,"0"+(t-5));let n=this.extractNumericValueFromBitArray(e,6);if(n>=32&&n<58)return new tn(e+6,""+(n+33));let i;switch(n){case 58:i="*";break;case 59:i=",";break;case 60:i="-";break;case 61:i=".";break;case 62:i="/";break;default:throw new un("Decoding invalid alphanumeric value: "+n)}return new tn(e+6,i)}isAlphaTo646ToAlphaLatch(e){if(e+1>this.information.getSize())return!1;for(let t=0;t<5&&t+e<this.information.getSize();++t)if(t===2){if(!this.information.get(e+2))return!1}else if(this.information.get(e+t))return!1;return!0}isAlphaOr646ToNumericLatch(e){if(e+3>this.information.getSize())return!1;for(let t=e;t<e+3;++t)if(this.information.get(t))return!1;return!0}isNumericToAlphaNumericLatch(e){if(e+1>this.information.getSize())return!1;for(let t=0;t<4&&t+e<this.information.getSize();++t)if(this.information.get(e+t))return!1;return!0}}class hi{constructor(e){this.information=e,this.generalDecoder=new Ir(e)}getInformation(){return this.information}getGeneralDecoder(){return this.generalDecoder}}class nn extends hi{constructor(e){super(e)}encodeCompressedGtin(e,t){e.append("(01)");let n=e.length();e.append("9"),this.encodeCompressedGtinWithoutAI(e,t,n)}encodeCompressedGtinWithoutAI(e,t,n){for(let i=0;i<4;++i){let s=this.getGeneralDecoder().extractNumericValueFromBitArray(t+10*i,10);s/100===0&&e.append("0"),s/10===0&&e.append("0"),e.append(s)}nn.appendCheckDigit(e,n)}static appendCheckDigit(e,t){let n=0;for(let i=0;i<13;i++){let s=e.charAt(i+t).charCodeAt(0)-48;n+=(i&1)===0?3*s:s}n=10-n%10,n===10&&(n=0),e.append(n)}}nn.GTIN_SIZE=40;class br extends nn{constructor(e){super(e)}parseInformation(){let e=new rt;e.append("(01)");let t=e.length(),n=this.getGeneralDecoder().extractNumericValueFromBitArray(br.HEADER_SIZE,4);return e.append(n),this.encodeCompressedGtinWithoutAI(e,br.HEADER_SIZE+4,t),this.getGeneralDecoder().decodeAllCodes(e,br.HEADER_SIZE+44)}}br.HEADER_SIZE=4;class Fr extends hi{constructor(e){super(e)}parseInformation(){let e=new rt;return this.getGeneralDecoder().decodeAllCodes(e,Fr.HEADER_SIZE)}}Fr.HEADER_SIZE=5;class I extends nn{constructor(e){super(e)}encodeCompressedWeight(e,t,n){let i=this.getGeneralDecoder().extractNumericValueFromBitArray(t,n);this.addWeightCode(e,i);let s=this.checkWeight(i),o=1e5;for(let l=0;l<5;++l)s/o===0&&e.append("0"),o/=10;e.append(s)}}class Y extends I{constructor(e){super(e)}parseInformation(){if(this.getInformation().getSize()!=Y.HEADER_SIZE+I.GTIN_SIZE+Y.WEIGHT_SIZE)throw new v;let e=new rt;return this.encodeCompressedGtin(e,Y.HEADER_SIZE),this.encodeCompressedWeight(e,Y.HEADER_SIZE+I.GTIN_SIZE,Y.WEIGHT_SIZE),e.toString()}}Y.HEADER_SIZE=5,Y.WEIGHT_SIZE=15;class ne extends Y{constructor(e){super(e)}addWeightCode(e,t){e.append("(3103)")}checkWeight(e){return e}}class X extends Y{constructor(e){super(e)}addWeightCode(e,t){t<1e4?e.append("(3202)"):e.append("(3203)")}checkWeight(e){return e<1e4?e:e-1e4}}class oe extends nn{constructor(e){super(e)}parseInformation(){if(this.getInformation().getSize()<oe.HEADER_SIZE+nn.GTIN_SIZE)throw new v;let e=new rt;this.encodeCompressedGtin(e,oe.HEADER_SIZE);let t=this.getGeneralDecoder().extractNumericValueFromBitArray(oe.HEADER_SIZE+nn.GTIN_SIZE,oe.LAST_DIGIT_SIZE);e.append("(392"),e.append(t),e.append(")");let n=this.getGeneralDecoder().decodeGeneralPurposeField(oe.HEADER_SIZE+nn.GTIN_SIZE+oe.LAST_DIGIT_SIZE,null);return e.append(n.getNewString()),e.toString()}}oe.HEADER_SIZE=8,oe.LAST_DIGIT_SIZE=2;class de extends nn{constructor(e){super(e)}parseInformation(){if(this.getInformation().getSize()<de.HEADER_SIZE+nn.GTIN_SIZE)throw new v;let e=new rt;this.encodeCompressedGtin(e,de.HEADER_SIZE);let t=this.getGeneralDecoder().extractNumericValueFromBitArray(de.HEADER_SIZE+nn.GTIN_SIZE,de.LAST_DIGIT_SIZE);e.append("(393"),e.append(t),e.append(")");let n=this.getGeneralDecoder().extractNumericValueFromBitArray(de.HEADER_SIZE+nn.GTIN_SIZE+de.LAST_DIGIT_SIZE,de.FIRST_THREE_DIGITS_SIZE);n/100==0&&e.append("0"),n/10==0&&e.append("0"),e.append(n);let i=this.getGeneralDecoder().decodeGeneralPurposeField(de.HEADER_SIZE+nn.GTIN_SIZE+de.LAST_DIGIT_SIZE+de.FIRST_THREE_DIGITS_SIZE,null);return e.append(i.getNewString()),e.toString()}}de.HEADER_SIZE=8,de.LAST_DIGIT_SIZE=2,de.FIRST_THREE_DIGITS_SIZE=10;class se extends I{constructor(e,t,n){super(e),this.dateCode=n,this.firstAIdigits=t}parseInformation(){if(this.getInformation().getSize()!=se.HEADER_SIZE+se.GTIN_SIZE+se.WEIGHT_SIZE+se.DATE_SIZE)throw new v;let e=new rt;return this.encodeCompressedGtin(e,se.HEADER_SIZE),this.encodeCompressedWeight(e,se.HEADER_SIZE+se.GTIN_SIZE,se.WEIGHT_SIZE),this.encodeCompressedDate(e,se.HEADER_SIZE+se.GTIN_SIZE+se.WEIGHT_SIZE),e.toString()}encodeCompressedDate(e,t){let n=this.getGeneralDecoder().extractNumericValueFromBitArray(t,se.DATE_SIZE);if(n==38400)return;e.append("("),e.append(this.dateCode),e.append(")");let i=n%32;n/=32;let s=n%12+1;n/=12;let o=n;o/10==0&&e.append("0"),e.append(o),s/10==0&&e.append("0"),e.append(s),i/10==0&&e.append("0"),e.append(i)}addWeightCode(e,t){e.append("("),e.append(this.firstAIdigits),e.append(t/1e5),e.append(")")}checkWeight(e){return e%1e5}}se.HEADER_SIZE=8,se.WEIGHT_SIZE=20,se.DATE_SIZE=16;function Ze(w){try{if(w.get(1))return new br(w);if(!w.get(2))return new Fr(w);switch(Ir.extractNumericValueFromBitArray(w,1,4)){case 4:return new ne(w);case 5:return new X(w)}switch(Ir.extractNumericValueFromBitArray(w,1,5)){case 12:return new oe(w);case 13:return new de(w)}switch(Ir.extractNumericValueFromBitArray(w,1,7)){case 56:return new se(w,"310","11");case 57:return new se(w,"320","11");case 58:return new se(w,"310","13");case 59:return new se(w,"320","13");case 60:return new se(w,"310","15");case 61:return new se(w,"320","15");case 62:return new se(w,"310","17");case 63:return new se(w,"320","17")}}catch(e){throw console.log(e),new un("unknown decoder: "+w)}}class De{constructor(e,t,n,i){this.leftchar=e,this.rightchar=t,this.finderpattern=n,this.maybeLast=i}mayBeLast(){return this.maybeLast}getLeftChar(){return this.leftchar}getRightChar(){return this.rightchar}getFinderPattern(){return this.finderpattern}mustBeLast(){return this.rightchar==null}toString(){return"[ "+this.leftchar+", "+this.rightchar+" : "+(this.finderpattern==null?"null":this.finderpattern.getValue())+" ]"}static equals(e,t){return e instanceof De?De.equalsOrNull(e.leftchar,t.leftchar)&&De.equalsOrNull(e.rightchar,t.rightchar)&&De.equalsOrNull(e.finderpattern,t.finderpattern):!1}static equalsOrNull(e,t){return e===null?t===null:De.equals(e,t)}hashCode(){return this.leftchar.getValue()^this.rightchar.getValue()^this.finderpattern.getValue()}}class ze{constructor(e,t,n){this.pairs=e,this.rowNumber=t,this.wasReversed=n}getPairs(){return this.pairs}getRowNumber(){return this.rowNumber}isReversed(){return this.wasReversed}isEquivalent(e){return this.checkEqualitity(this,e)}toString(){return"{ "+this.pairs+" }"}equals(e,t){return e instanceof ze?this.checkEqualitity(e,t)&&e.wasReversed===t.wasReversed:!1}checkEqualitity(e,t){if(!e||!t)return;let n;return e.forEach((i,s)=>{t.forEach(o=>{i.getLeftChar().getValue()===o.getLeftChar().getValue()&&i.getRightChar().getValue()===o.getRightChar().getValue()&&i.getFinderPatter().getValue()===o.getFinderPatter().getValue()&&(n=!0)})}),n}}class V extends jt{constructor(e){super(...arguments),this.pairs=new Array(V.MAX_PAIRS),this.rows=new Array,this.startEnd=[2],this.verbose=e===!0}decodeRow(e,t,n){this.pairs.length=0,this.startFromEven=!1;try{return V.constructResult(this.decodeRow2pairs(e,t))}catch(i){this.verbose&&console.log(i)}return this.pairs.length=0,this.startFromEven=!0,V.constructResult(this.decodeRow2pairs(e,t))}reset(){this.pairs.length=0,this.rows.length=0}decodeRow2pairs(e,t){let n=!1;for(;!n;)try{this.pairs.push(this.retrieveNextPair(t,this.pairs,e))}catch(s){if(s instanceof v){if(!this.pairs.length)throw new v;n=!0}}if(this.checkChecksum())return this.pairs;let i;if(this.rows.length?i=!0:i=!1,this.storeRow(e,!1),i){let s=this.checkRowsBoolean(!1);if(s!=null||(s=this.checkRowsBoolean(!0),s!=null))return s}throw new v}checkRowsBoolean(e){if(this.rows.length>25)return this.rows.length=0,null;this.pairs.length=0,e&&(this.rows=this.rows.reverse());let t=null;try{t=this.checkRows(new Array,0)}catch(n){this.verbose&&console.log(n)}return e&&(this.rows=this.rows.reverse()),t}checkRows(e,t){for(let n=t;n<this.rows.length;n++){let i=this.rows[n];this.pairs.length=0;for(let o of e)this.pairs.push(o.getPairs());if(this.pairs.push(i.getPairs()),!V.isValidSequence(this.pairs))continue;if(this.checkChecksum())return this.pairs;let s=new Array(e);s.push(i);try{return this.checkRows(s,n+1)}catch(o){this.verbose&&console.log(o)}}throw new v}static isValidSequence(e){for(let t of V.FINDER_PATTERN_SEQUENCES){if(e.length>t.length)continue;let n=!0;for(let i=0;i<e.length;i++)if(e[i].getFinderPattern().getValue()!=t[i]){n=!1;break}if(n)return!0}return!1}storeRow(e,t){let n=0,i=!1,s=!1;for(;n<this.rows.length;){let o=this.rows[n];if(o.getRowNumber()>e){s=o.isEquivalent(this.pairs);break}i=o.isEquivalent(this.pairs),n++}s||i||V.isPartialRow(this.pairs,this.rows)||(this.rows.push(n,new ze(this.pairs,e,t)),this.removePartialRows(this.pairs,this.rows))}removePartialRows(e,t){for(let n of t)if(n.getPairs().length!==e.length){for(let i of n.getPairs())for(let s of e)if(De.equals(i,s))break}}static isPartialRow(e,t){for(let n of t){let i=!0;for(let s of e){let o=!1;for(let l of n.getPairs())if(s.equals(l)){o=!0;break}if(!o){i=!1;break}}if(i)return!0}return!1}getRows(){return this.rows}static constructResult(e){let t=fi.buildBitArray(e),i=Ze(t).parseInformation(),s=e[0].getFinderPattern().getResultPoints(),o=e[e.length-1].getFinderPattern().getResultPoints(),l=[s[0],s[1],o[0],o[1]];return new Ft(i,null,null,l,me.RSS_EXPANDED,null)}checkChecksum(){let e=this.pairs.get(0),t=e.getLeftChar(),n=e.getRightChar();if(n==null)return!1;let i=n.getChecksumPortion(),s=2;for(let l=1;l<this.pairs.size();++l){let u=this.pairs.get(l);i+=u.getLeftChar().getChecksumPortion(),s++;let h=u.getRightChar();h!=null&&(i+=h.getChecksumPortion(),s++)}return i%=211,211*(s-4)+i==t.getValue()}static getNextSecondBar(e,t){let n;return e.get(t)?(n=e.getNextUnset(t),n=e.getNextSet(n)):(n=e.getNextSet(t),n=e.getNextUnset(n)),n}retrieveNextPair(e,t,n){let i=t.length%2==0;this.startFromEven&&(i=!i);let s,o=!0,l=-1;do this.findNextPair(e,t,l),s=this.parseFoundFinderPattern(e,n,i),s==null?l=V.getNextSecondBar(e,this.startEnd[0]):o=!1;while(o);let u=this.decodeDataCharacter(e,s,i,!0);if(!this.isEmptyPair(t)&&t[t.length-1].mustBeLast())throw new v;let h;try{h=this.decodeDataCharacter(e,s,i,!1)}catch(p){h=null,this.verbose&&console.log(p)}return new De(u,h,s,!0)}isEmptyPair(e){return e.length===0}findNextPair(e,t,n){let i=this.getDecodeFinderCounters();i[0]=0,i[1]=0,i[2]=0,i[3]=0;let s=e.getSize(),o;n>=0?o=n:this.isEmptyPair(t)?o=0:o=t[t.length-1].getFinderPattern().getStartEnd()[1];let l=t.length%2!=0;this.startFromEven&&(l=!l);let u=!1;for(;o<s&&(u=!e.get(o),!!u);)o++;let h=0,p=o;for(let A=o;A<s;A++)if(e.get(A)!=u)i[h]++;else{if(h==3){if(l&&V.reverseCounters(i),V.isFinderPattern(i)){this.startEnd[0]=p,this.startEnd[1]=A;return}l&&V.reverseCounters(i),p+=i[0]+i[1],i[0]=i[2],i[1]=i[3],i[2]=0,i[3]=0,h--}else h++;i[h]=1,u=!u}throw new v}static reverseCounters(e){let t=e.length;for(let n=0;n<t/2;++n){let i=e[n];e[n]=e[t-n-1],e[t-n-1]=i}}parseFoundFinderPattern(e,t,n){let i,s,o;if(n){let h=this.startEnd[0]-1;for(;h>=0&&!e.get(h);)h--;h++,i=this.startEnd[0]-h,s=h,o=this.startEnd[1]}else s=this.startEnd[0],o=e.getNextUnset(this.startEnd[1]+1),i=o-this.startEnd[1];let l=this.getDecodeFinderCounters();ge.arraycopy(l,0,l,1,l.length-1),l[0]=i;let u;try{u=this.parseFinderValue(l,V.FINDER_PATTERNS)}catch{return null}return new Zr(u,[s,o],s,o,t)}decodeDataCharacter(e,t,n,i){let s=this.getDataCharacterCounters();for(let wt=0;wt<s.length;wt++)s[wt]=0;if(i)V.recordPatternInReverse(e,t.getStartEnd()[0],s);else{V.recordPattern(e,t.getStartEnd()[1],s);for(let wt=0,Pt=s.length-1;wt<Pt;wt++,Pt--){let dn=s[wt];s[wt]=s[Pt],s[Pt]=dn}}let o=17,l=Ke.sum(new Int32Array(s))/o,u=(t.getStartEnd()[1]-t.getStartEnd()[0])/15;if(Math.abs(l-u)/u>.3)throw new v;let h=this.getOddCounts(),p=this.getEvenCounts(),A=this.getOddRoundingErrors(),b=this.getEvenRoundingErrors();for(let wt=0;wt<s.length;wt++){let Pt=1*s[wt]/l,dn=Pt+.5;if(dn<1){if(Pt<.3)throw new v;dn=1}else if(dn>8){if(Pt>8.7)throw new v;dn=8}let Tr=wt/2;(wt&1)==0?(h[Tr]=dn,A[Tr]=Pt-dn):(p[Tr]=dn,b[Tr]=Pt-dn)}this.adjustOddEvenCounts(o);let L=4*t.getValue()+(n?0:2)+(i?0:1)-1,E=0,M=0;for(let wt=h.length-1;wt>=0;wt--){if(V.isNotA1left(t,n,i)){let Pt=V.WEIGHTS[L][2*wt];M+=h[wt]*Pt}E+=h[wt]}let D=0;for(let wt=p.length-1;wt>=0;wt--)if(V.isNotA1left(t,n,i)){let Pt=V.WEIGHTS[L][2*wt+1];D+=p[wt]*Pt}let P=M+D;if((E&1)!=0||E>13||E<4)throw new v;let K=(13-E)/2,q=V.SYMBOL_WIDEST[K],Q=9-q,xe=Pn.getRSSvalue(h,q,!0),Pe=Pn.getRSSvalue(p,Q,!1),Mn=V.EVEN_TOTAL_SUBSET[K],Bt=V.GSUM[K],an=xe*Mn+Pe+Bt;return new yr(an,P)}static isNotA1left(e,t,n){return!(e.getValue()==0&&t&&n)}adjustOddEvenCounts(e){let t=Ke.sum(new Int32Array(this.getOddCounts())),n=Ke.sum(new Int32Array(this.getEvenCounts())),i=!1,s=!1;t>13?s=!0:t<4&&(i=!0);let o=!1,l=!1;n>13?l=!0:n<4&&(o=!0);let u=t+n-e,h=(t&1)==1,p=(n&1)==0;if(u==1)if(h){if(p)throw new v;s=!0}else{if(!p)throw new v;l=!0}else if(u==-1)if(h){if(p)throw new v;i=!0}else{if(!p)throw new v;o=!0}else if(u==0){if(h){if(!p)throw new v;t<n?(i=!0,l=!0):(s=!0,o=!0)}else if(p)throw new v}else throw new v;if(i){if(s)throw new v;V.increment(this.getOddCounts(),this.getOddRoundingErrors())}if(s&&V.decrement(this.getOddCounts(),this.getOddRoundingErrors()),o){if(l)throw new v;V.increment(this.getEvenCounts(),this.getOddRoundingErrors())}l&&V.decrement(this.getEvenCounts(),this.getEvenRoundingErrors())}}V.SYMBOL_WIDEST=[7,5,4,3,1],V.EVEN_TOTAL_SUBSET=[4,20,52,104,204],V.GSUM=[0,348,1388,2948,3988],V.FINDER_PATTERNS=[Int32Array.from([1,8,4,1]),Int32Array.from([3,6,4,1]),Int32Array.from([3,4,6,1]),Int32Array.from([3,2,8,1]),Int32Array.from([2,6,5,1]),Int32Array.from([2,2,9,1])],V.WEIGHTS=[[1,3,9,27,81,32,96,77],[20,60,180,118,143,7,21,63],[189,145,13,39,117,140,209,205],[193,157,49,147,19,57,171,91],[62,186,136,197,169,85,44,132],[185,133,188,142,4,12,36,108],[113,128,173,97,80,29,87,50],[150,28,84,41,123,158,52,156],[46,138,203,187,139,206,196,166],[76,17,51,153,37,111,122,155],[43,129,176,106,107,110,119,146],[16,48,144,10,30,90,59,177],[109,116,137,200,178,112,125,164],[70,210,208,202,184,130,179,115],[134,191,151,31,93,68,204,190],[148,22,66,198,172,94,71,2],[6,18,54,162,64,192,154,40],[120,149,25,75,14,42,126,167],[79,26,78,23,69,207,199,175],[103,98,83,38,114,131,182,124],[161,61,183,127,170,88,53,159],[55,165,73,8,24,72,5,15],[45,135,194,160,58,174,100,89]],V.FINDER_PAT_A=0,V.FINDER_PAT_B=1,V.FINDER_PAT_C=2,V.FINDER_PAT_D=3,V.FINDER_PAT_E=4,V.FINDER_PAT_F=5,V.FINDER_PATTERN_SEQUENCES=[[V.FINDER_PAT_A,V.FINDER_PAT_A],[V.FINDER_PAT_A,V.FINDER_PAT_B,V.FINDER_PAT_B],[V.FINDER_PAT_A,V.FINDER_PAT_C,V.FINDER_PAT_B,V.FINDER_PAT_D],[V.FINDER_PAT_A,V.FINDER_PAT_E,V.FINDER_PAT_B,V.FINDER_PAT_D,V.FINDER_PAT_C],[V.FINDER_PAT_A,V.FINDER_PAT_E,V.FINDER_PAT_B,V.FINDER_PAT_D,V.FINDER_PAT_D,V.FINDER_PAT_F],[V.FINDER_PAT_A,V.FINDER_PAT_E,V.FINDER_PAT_B,V.FINDER_PAT_D,V.FINDER_PAT_E,V.FINDER_PAT_F,V.FINDER_PAT_F],[V.FINDER_PAT_A,V.FINDER_PAT_A,V.FINDER_PAT_B,V.FINDER_PAT_B,V.FINDER_PAT_C,V.FINDER_PAT_C,V.FINDER_PAT_D,V.FINDER_PAT_D],[V.FINDER_PAT_A,V.FINDER_PAT_A,V.FINDER_PAT_B,V.FINDER_PAT_B,V.FINDER_PAT_C,V.FINDER_PAT_C,V.FINDER_PAT_D,V.FINDER_PAT_E,V.FINDER_PAT_E],[V.FINDER_PAT_A,V.FINDER_PAT_A,V.FINDER_PAT_B,V.FINDER_PAT_B,V.FINDER_PAT_C,V.FINDER_PAT_C,V.FINDER_PAT_D,V.FINDER_PAT_E,V.FINDER_PAT_F,V.FINDER_PAT_F],[V.FINDER_PAT_A,V.FINDER_PAT_A,V.FINDER_PAT_B,V.FINDER_PAT_B,V.FINDER_PAT_C,V.FINDER_PAT_D,V.FINDER_PAT_D,V.FINDER_PAT_E,V.FINDER_PAT_E,V.FINDER_PAT_F,V.FINDER_PAT_F]],V.MAX_PAIRS=11;class st extends yr{constructor(e,t,n){super(e,t),this.count=0,this.finderPattern=n}getFinderPattern(){return this.finderPattern}getCount(){return this.count}incrementCount(){this.count++}}class pe extends jt{constructor(){super(...arguments),this.possibleLeftPairs=[],this.possibleRightPairs=[]}decodeRow(e,t,n){const i=this.decodePair(t,!1,e,n);pe.addOrTally(this.possibleLeftPairs,i),t.reverse();let s=this.decodePair(t,!0,e,n);pe.addOrTally(this.possibleRightPairs,s),t.reverse();for(let o of this.possibleLeftPairs)if(o.getCount()>1){for(let l of this.possibleRightPairs)if(l.getCount()>1&&pe.checkChecksum(o,l))return pe.constructResult(o,l)}throw new v}static addOrTally(e,t){if(t==null)return;let n=!1;for(let i of e)if(i.getValue()===t.getValue()){i.incrementCount(),n=!0;break}n||e.push(t)}reset(){this.possibleLeftPairs.length=0,this.possibleRightPairs.length=0}static constructResult(e,t){let n=4537077*e.getValue()+t.getValue(),i=new String(n).toString(),s=new rt;for(let h=13-i.length;h>0;h--)s.append("0");s.append(i);let o=0;for(let h=0;h<13;h++){let p=s.charAt(h).charCodeAt(0)-48;o+=(h&1)===0?3*p:p}o=10-o%10,o===10&&(o=0),s.append(o.toString());let l=e.getFinderPattern().getResultPoints(),u=t.getFinderPattern().getResultPoints();return new Ft(s.toString(),null,0,[l[0],l[1],u[0],u[1]],me.RSS_14,new Date().getTime())}static checkChecksum(e,t){let n=(e.getChecksumPortion()+16*t.getChecksumPortion())%79,i=9*e.getFinderPattern().getValue()+t.getFinderPattern().getValue();return i>72&&i--,i>8&&i--,n===i}decodePair(e,t,n,i){try{let s=this.findFinderPattern(e,t),o=this.parseFoundFinderPattern(e,n,t,s),l=i==null?null:i.get(Be.NEED_RESULT_POINT_CALLBACK);if(l!=null){let p=(s[0]+s[1])/2;t&&(p=e.getSize()-1-p),l.foundPossibleResultPoint(new le(p,n))}let u=this.decodeDataCharacter(e,o,!0),h=this.decodeDataCharacter(e,o,!1);return new st(1597*u.getValue()+h.getValue(),u.getChecksumPortion()+4*h.getChecksumPortion(),o)}catch{return null}}decodeDataCharacter(e,t,n){let i=this.getDataCharacterCounters();for(let D=0;D<i.length;D++)i[D]=0;if(n)Nt.recordPatternInReverse(e,t.getStartEnd()[0],i);else{Nt.recordPattern(e,t.getStartEnd()[1]+1,i);for(let D=0,P=i.length-1;D<P;D++,P--){let K=i[D];i[D]=i[P],i[P]=K}}let s=n?16:15,o=Ke.sum(new Int32Array(i))/s,l=this.getOddCounts(),u=this.getEvenCounts(),h=this.getOddRoundingErrors(),p=this.getEvenRoundingErrors();for(let D=0;D<i.length;D++){let P=i[D]/o,K=Math.floor(P+.5);K<1?K=1:K>8&&(K=8);let q=Math.floor(D/2);(D&1)===0?(l[q]=K,h[q]=P-K):(u[q]=K,p[q]=P-K)}this.adjustOddEvenCounts(n,s);let A=0,b=0;for(let D=l.length-1;D>=0;D--)b*=9,b+=l[D],A+=l[D];let L=0,E=0;for(let D=u.length-1;D>=0;D--)L*=9,L+=u[D],E+=u[D];let M=b+3*L;if(n){if((A&1)!==0||A>12||A<4)throw new v;let D=(12-A)/2,P=pe.OUTSIDE_ODD_WIDEST[D],K=9-P,q=Pn.getRSSvalue(l,P,!1),Q=Pn.getRSSvalue(u,K,!0),xe=pe.OUTSIDE_EVEN_TOTAL_SUBSET[D],Pe=pe.OUTSIDE_GSUM[D];return new yr(q*xe+Q+Pe,M)}else{if((E&1)!==0||E>10||E<4)throw new v;let D=(10-E)/2,P=pe.INSIDE_ODD_WIDEST[D],K=9-P,q=Pn.getRSSvalue(l,P,!0),Q=Pn.getRSSvalue(u,K,!1),xe=pe.INSIDE_ODD_TOTAL_SUBSET[D],Pe=pe.INSIDE_GSUM[D];return new yr(Q*xe+q+Pe,M)}}findFinderPattern(e,t){let n=this.getDecodeFinderCounters();n[0]=0,n[1]=0,n[2]=0,n[3]=0;let i=e.getSize(),s=!1,o=0;for(;o<i&&(s=!e.get(o),t!==s);)o++;let l=0,u=o;for(let h=o;h<i;h++)if(e.get(h)!==s)n[l]++;else{if(l===3){if(jt.isFinderPattern(n))return[u,h];u+=n[0]+n[1],n[0]=n[2],n[1]=n[3],n[2]=0,n[3]=0,l--}else l++;n[l]=1,s=!s}throw new v}parseFoundFinderPattern(e,t,n,i){let s=e.get(i[0]),o=i[0]-1;for(;o>=0&&s!==e.get(o);)o--;o++;const l=i[0]-o,u=this.getDecodeFinderCounters(),h=new Int32Array(u.length);ge.arraycopy(u,0,h,1,u.length-1),h[0]=l;const p=this.parseFinderValue(h,pe.FINDER_PATTERNS);let A=o,b=i[1];return n&&(A=e.getSize()-1-A,b=e.getSize()-1-b),new Zr(p,[o,i[1]],A,b,t)}adjustOddEvenCounts(e,t){let n=Ke.sum(new Int32Array(this.getOddCounts())),i=Ke.sum(new Int32Array(this.getEvenCounts())),s=!1,o=!1,l=!1,u=!1;e?(n>12?o=!0:n<4&&(s=!0),i>12?u=!0:i<4&&(l=!0)):(n>11?o=!0:n<5&&(s=!0),i>10?u=!0:i<4&&(l=!0));let h=n+i-t,p=(n&1)===(e?1:0),A=(i&1)===1;if(h===1)if(p){if(A)throw new v;o=!0}else{if(!A)throw new v;u=!0}else if(h===-1)if(p){if(A)throw new v;s=!0}else{if(!A)throw new v;l=!0}else if(h===0){if(p){if(!A)throw new v;n<i?(s=!0,u=!0):(o=!0,l=!0)}else if(A)throw new v}else throw new v;if(s){if(o)throw new v;jt.increment(this.getOddCounts(),this.getOddRoundingErrors())}if(o&&jt.decrement(this.getOddCounts(),this.getOddRoundingErrors()),l){if(u)throw new v;jt.increment(this.getEvenCounts(),this.getOddRoundingErrors())}u&&jt.decrement(this.getEvenCounts(),this.getEvenRoundingErrors())}}pe.OUTSIDE_EVEN_TOTAL_SUBSET=[1,10,34,70,126],pe.INSIDE_ODD_TOTAL_SUBSET=[4,20,48,81],pe.OUTSIDE_GSUM=[0,161,961,2015,2715],pe.INSIDE_GSUM=[0,336,1036,1516],pe.OUTSIDE_ODD_WIDEST=[8,6,4,3,1],pe.INSIDE_ODD_WIDEST=[2,4,6,8],pe.FINDER_PATTERNS=[Int32Array.from([3,8,2,1]),Int32Array.from([3,5,5,1]),Int32Array.from([3,3,7,1]),Int32Array.from([3,1,9,1]),Int32Array.from([2,7,4,1]),Int32Array.from([2,5,6,1]),Int32Array.from([2,3,8,1]),Int32Array.from([1,5,7,1]),Int32Array.from([1,3,9,1])];class at extends Nt{constructor(e,t){super(),this.readers=[],this.verbose=t===!0;const n=e?e.get(Be.POSSIBLE_FORMATS):null,i=e&&e.get(Be.ASSUME_CODE_39_CHECK_DIGIT)!==void 0;n?((n.includes(me.EAN_13)||n.includes(me.UPC_A)||n.includes(me.EAN_8)||n.includes(me.UPC_E))&&this.readers.push(new ui(e)),n.includes(me.CODE_39)&&this.readers.push(new bt(i)),n.includes(me.CODE_128)&&this.readers.push(new ae),n.includes(me.ITF)&&this.readers.push(new it),n.includes(me.RSS_14)&&this.readers.push(new pe),n.includes(me.RSS_EXPANDED)&&this.readers.push(new V(this.verbose))):(this.readers.push(new ui(e)),this.readers.push(new bt),this.readers.push(new ui(e)),this.readers.push(new ae),this.readers.push(new it),this.readers.push(new pe),this.readers.push(new V(this.verbose)))}decodeRow(e,t,n){for(let i=0;i<this.readers.length;i++)try{return this.readers[i].decodeRow(e,t,n)}catch{}throw new v}reset(){this.readers.forEach(e=>e.reset())}}class Cn extends Wn{constructor(e=500,t){super(new at(t),e,t)}}class Se{constructor(e,t,n){this.ecCodewords=e,this.ecBlocks=[t],n&&this.ecBlocks.push(n)}getECCodewords(){return this.ecCodewords}getECBlocks(){return this.ecBlocks}}class je{constructor(e,t){this.count=e,this.dataCodewords=t}getCount(){return this.count}getDataCodewords(){return this.dataCodewords}}class Ce{constructor(e,t,n,i,s,o){this.versionNumber=e,this.symbolSizeRows=t,this.symbolSizeColumns=n,this.dataRegionSizeRows=i,this.dataRegionSizeColumns=s,this.ecBlocks=o;let l=0;const u=o.getECCodewords(),h=o.getECBlocks();for(let p of h)l+=p.getCount()*(p.getDataCodewords()+u);this.totalCodewords=l}getVersionNumber(){return this.versionNumber}getSymbolSizeRows(){return this.symbolSizeRows}getSymbolSizeColumns(){return this.symbolSizeColumns}getDataRegionSizeRows(){return this.dataRegionSizeRows}getDataRegionSizeColumns(){return this.dataRegionSizeColumns}getTotalCodewords(){return this.totalCodewords}getECBlocks(){return this.ecBlocks}static getVersionForDimensions(e,t){if((e&1)!==0||(t&1)!==0)throw new re;for(let n of Ce.VERSIONS)if(n.symbolSizeRows===e&&n.symbolSizeColumns===t)return n;throw new re}toString(){return""+this.versionNumber}static buildVersions(){return[new Ce(1,10,10,8,8,new Se(5,new je(1,3))),new Ce(2,12,12,10,10,new Se(7,new je(1,5))),new Ce(3,14,14,12,12,new Se(10,new je(1,8))),new Ce(4,16,16,14,14,new Se(12,new je(1,12))),new Ce(5,18,18,16,16,new Se(14,new je(1,18))),new Ce(6,20,20,18,18,new Se(18,new je(1,22))),new Ce(7,22,22,20,20,new Se(20,new je(1,30))),new Ce(8,24,24,22,22,new Se(24,new je(1,36))),new Ce(9,26,26,24,24,new Se(28,new je(1,44))),new Ce(10,32,32,14,14,new Se(36,new je(1,62))),new Ce(11,36,36,16,16,new Se(42,new je(1,86))),new Ce(12,40,40,18,18,new Se(48,new je(1,114))),new Ce(13,44,44,20,20,new Se(56,new je(1,144))),new Ce(14,48,48,22,22,new Se(68,new je(1,174))),new Ce(15,52,52,24,24,new Se(42,new je(2,102))),new Ce(16,64,64,14,14,new Se(56,new je(2,140))),new Ce(17,72,72,16,16,new Se(36,new je(4,92))),new Ce(18,80,80,18,18,new Se(48,new je(4,114))),new Ce(19,88,88,20,20,new Se(56,new je(4,144))),new Ce(20,96,96,22,22,new Se(68,new je(4,174))),new Ce(21,104,104,24,24,new Se(56,new je(6,136))),new Ce(22,120,120,18,18,new Se(68,new je(6,175))),new Ce(23,132,132,20,20,new Se(62,new je(8,163))),new Ce(24,144,144,22,22,new Se(62,new je(8,156),new je(2,155))),new Ce(25,8,18,6,16,new Se(7,new je(1,5))),new Ce(26,8,32,6,14,new Se(11,new je(1,10))),new Ce(27,12,26,10,24,new Se(14,new je(1,16))),new Ce(28,12,36,10,16,new Se(18,new je(1,22))),new Ce(29,16,36,14,16,new Se(24,new je(1,32))),new Ce(30,16,48,14,22,new Se(28,new je(1,49)))]}}Ce.VERSIONS=Ce.buildVersions();class En{constructor(e){const t=e.getHeight();if(t<8||t>144||(t&1)!==0)throw new re;this.version=En.readVersion(e),this.mappingBitMatrix=this.extractDataRegion(e),this.readMappingMatrix=new Mt(this.mappingBitMatrix.getWidth(),this.mappingBitMatrix.getHeight())}getVersion(){return this.version}static readVersion(e){const t=e.getHeight(),n=e.getWidth();return Ce.getVersionForDimensions(t,n)}readCodewords(){const e=new Int8Array(this.version.getTotalCodewords());let t=0,n=4,i=0;const s=this.mappingBitMatrix.getHeight(),o=this.mappingBitMatrix.getWidth();let l=!1,u=!1,h=!1,p=!1;do if(n===s&&i===0&&!l)e[t++]=this.readCorner1(s,o)&255,n-=2,i+=2,l=!0;else if(n===s-2&&i===0&&(o&3)!==0&&!u)e[t++]=this.readCorner2(s,o)&255,n-=2,i+=2,u=!0;else if(n===s+4&&i===2&&(o&7)===0&&!h)e[t++]=this.readCorner3(s,o)&255,n-=2,i+=2,h=!0;else if(n===s-2&&i===0&&(o&7)===4&&!p)e[t++]=this.readCorner4(s,o)&255,n-=2,i+=2,p=!0;else{do n<s&&i>=0&&!this.readMappingMatrix.get(i,n)&&(e[t++]=this.readUtah(n,i,s,o)&255),n-=2,i+=2;while(n>=0&&i<o);n+=1,i+=3;do n>=0&&i<o&&!this.readMappingMatrix.get(i,n)&&(e[t++]=this.readUtah(n,i,s,o)&255),n+=2,i-=2;while(n<s&&i>=0);n+=3,i+=1}while(n<s||i<o);if(t!==this.version.getTotalCodewords())throw new re;return e}readModule(e,t,n,i){return e<0&&(e+=n,t+=4-(n+4&7)),t<0&&(t+=i,e+=4-(i+4&7)),this.readMappingMatrix.set(t,e),this.mappingBitMatrix.get(t,e)}readUtah(e,t,n,i){let s=0;return this.readModule(e-2,t-2,n,i)&&(s|=1),s<<=1,this.readModule(e-2,t-1,n,i)&&(s|=1),s<<=1,this.readModule(e-1,t-2,n,i)&&(s|=1),s<<=1,this.readModule(e-1,t-1,n,i)&&(s|=1),s<<=1,this.readModule(e-1,t,n,i)&&(s|=1),s<<=1,this.readModule(e,t-2,n,i)&&(s|=1),s<<=1,this.readModule(e,t-1,n,i)&&(s|=1),s<<=1,this.readModule(e,t,n,i)&&(s|=1),s}readCorner1(e,t){let n=0;return this.readModule(e-1,0,e,t)&&(n|=1),n<<=1,this.readModule(e-1,1,e,t)&&(n|=1),n<<=1,this.readModule(e-1,2,e,t)&&(n|=1),n<<=1,this.readModule(0,t-2,e,t)&&(n|=1),n<<=1,this.readModule(0,t-1,e,t)&&(n|=1),n<<=1,this.readModule(1,t-1,e,t)&&(n|=1),n<<=1,this.readModule(2,t-1,e,t)&&(n|=1),n<<=1,this.readModule(3,t-1,e,t)&&(n|=1),n}readCorner2(e,t){let n=0;return this.readModule(e-3,0,e,t)&&(n|=1),n<<=1,this.readModule(e-2,0,e,t)&&(n|=1),n<<=1,this.readModule(e-1,0,e,t)&&(n|=1),n<<=1,this.readModule(0,t-4,e,t)&&(n|=1),n<<=1,this.readModule(0,t-3,e,t)&&(n|=1),n<<=1,this.readModule(0,t-2,e,t)&&(n|=1),n<<=1,this.readModule(0,t-1,e,t)&&(n|=1),n<<=1,this.readModule(1,t-1,e,t)&&(n|=1),n}readCorner3(e,t){let n=0;return this.readModule(e-1,0,e,t)&&(n|=1),n<<=1,this.readModule(e-1,t-1,e,t)&&(n|=1),n<<=1,this.readModule(0,t-3,e,t)&&(n|=1),n<<=1,this.readModule(0,t-2,e,t)&&(n|=1),n<<=1,this.readModule(0,t-1,e,t)&&(n|=1),n<<=1,this.readModule(1,t-3,e,t)&&(n|=1),n<<=1,this.readModule(1,t-2,e,t)&&(n|=1),n<<=1,this.readModule(1,t-1,e,t)&&(n|=1),n}readCorner4(e,t){let n=0;return this.readModule(e-3,0,e,t)&&(n|=1),n<<=1,this.readModule(e-2,0,e,t)&&(n|=1),n<<=1,this.readModule(e-1,0,e,t)&&(n|=1),n<<=1,this.readModule(0,t-2,e,t)&&(n|=1),n<<=1,this.readModule(0,t-1,e,t)&&(n|=1),n<<=1,this.readModule(1,t-1,e,t)&&(n|=1),n<<=1,this.readModule(2,t-1,e,t)&&(n|=1),n<<=1,this.readModule(3,t-1,e,t)&&(n|=1),n}extractDataRegion(e){const t=this.version.getSymbolSizeRows(),n=this.version.getSymbolSizeColumns();if(e.getHeight()!==t)throw new H("Dimension of bitMatrix must match the version size");const i=this.version.getDataRegionSizeRows(),s=this.version.getDataRegionSizeColumns(),o=t/i|0,l=n/s|0,u=o*i,h=l*s,p=new Mt(h,u);for(let A=0;A<o;++A){const b=A*i;for(let L=0;L<l;++L){const E=L*s;for(let M=0;M<i;++M){const D=A*(i+2)+1+M,P=b+M;for(let K=0;K<s;++K){const q=L*(s+2)+1+K;if(e.get(q,D)){const Q=E+K;p.set(Q,P)}}}}}return p}}class Vn{constructor(e,t){this.numDataCodewords=e,this.codewords=t}static getDataBlocks(e,t){const n=t.getECBlocks();let i=0;const s=n.getECBlocks();for(let M of s)i+=M.getCount();const o=new Array(i);let l=0;for(let M of s)for(let D=0;D<M.getCount();D++){const P=M.getDataCodewords(),K=n.getECCodewords()+P;o[l++]=new Vn(P,new Uint8Array(K))}const h=o[0].codewords.length-n.getECCodewords(),p=h-1;let A=0;for(let M=0;M<p;M++)for(let D=0;D<l;D++)o[D].codewords[M]=e[A++];const b=t.getVersionNumber()===24,L=b?8:l;for(let M=0;M<L;M++)o[M].codewords[h-1]=e[A++];const E=o[0].codewords.length;for(let M=h;M<E;M++)for(let D=0;D<l;D++){const P=b?(D+8)%l:D,K=b&&P>7?M-1:M;o[P].codewords[K]=e[A++]}if(A!==e.length)throw new H;return o}getNumDataCodewords(){return this.numDataCodewords}getCodewords(){return this.codewords}}class Sn{constructor(e){this.bytes=e,this.byteOffset=0,this.bitOffset=0}getBitOffset(){return this.bitOffset}getByteOffset(){return this.byteOffset}readBits(e){if(e<1||e>32||e>this.available())throw new H(""+e);let t=0,n=this.bitOffset,i=this.byteOffset;const s=this.bytes;if(n>0){const o=8-n,l=e<o?e:o,u=o-l,h=255>>8-l<<u;t=(s[i]&h)>>u,e-=l,n+=l,n===8&&(n=0,i++)}if(e>0){for(;e>=8;)t=t<<8|s[i]&255,i++,e-=8;if(e>0){const o=8-e,l=255>>o<<o;t=t<<e|(s[i]&l)>>o,n+=e}}return this.bitOffset=n,this.byteOffset=i,t}available(){return 8*(this.bytes.length-this.byteOffset)-this.bitOffset}}var Ct;(function(w){w[w.PAD_ENCODE=0]="PAD_ENCODE",w[w.ASCII_ENCODE=1]="ASCII_ENCODE",w[w.C40_ENCODE=2]="C40_ENCODE",w[w.TEXT_ENCODE=3]="TEXT_ENCODE",w[w.ANSIX12_ENCODE=4]="ANSIX12_ENCODE",w[w.EDIFACT_ENCODE=5]="EDIFACT_ENCODE",w[w.BASE256_ENCODE=6]="BASE256_ENCODE"})(Ct||(Ct={}));class kn{static decode(e){const t=new Sn(e),n=new rt,i=new rt,s=new Array;let o=Ct.ASCII_ENCODE;do if(o===Ct.ASCII_ENCODE)o=this.decodeAsciiSegment(t,n,i);else{switch(o){case Ct.C40_ENCODE:this.decodeC40Segment(t,n);break;case Ct.TEXT_ENCODE:this.decodeTextSegment(t,n);break;case Ct.ANSIX12_ENCODE:this.decodeAnsiX12Segment(t,n);break;case Ct.EDIFACT_ENCODE:this.decodeEdifactSegment(t,n);break;case Ct.BASE256_ENCODE:this.decodeBase256Segment(t,n,s);break;default:throw new re}o=Ct.ASCII_ENCODE}while(o!==Ct.PAD_ENCODE&&t.available()>0);return i.length()>0&&n.append(i.toString()),new cn(e,n.toString(),s.length===0?null:s,null)}static decodeAsciiSegment(e,t,n){let i=!1;do{let s=e.readBits(8);if(s===0)throw new re;if(s<=128)return i&&(s+=128),t.append(String.fromCharCode(s-1)),Ct.ASCII_ENCODE;if(s===129)return Ct.PAD_ENCODE;if(s<=229){const o=s-130;o<10&&t.append("0"),t.append(""+o)}else switch(s){case 230:return Ct.C40_ENCODE;case 231:return Ct.BASE256_ENCODE;case 232:t.append("");break;case 233:case 234:break;case 235:i=!0;break;case 236:t.append("[)>05"),n.insert(0,"");break;case 237:t.append("[)>06"),n.insert(0,"");break;case 238:return Ct.ANSIX12_ENCODE;case 239:return Ct.TEXT_ENCODE;case 240:return Ct.EDIFACT_ENCODE;case 241:break;default:if(s!==254||e.available()!==0)throw new re;break}}while(e.available()>0);return Ct.ASCII_ENCODE}static decodeC40Segment(e,t){let n=!1;const i=[];let s=0;do{if(e.available()===8)return;const o=e.readBits(8);if(o===254)return;this.parseTwoBytes(o,e.readBits(8),i);for(let l=0;l<3;l++){const u=i[l];switch(s){case 0:if(u<3)s=u+1;else if(u<this.C40_BASIC_SET_CHARS.length){const h=this.C40_BASIC_SET_CHARS[u];n?(t.append(String.fromCharCode(h.charCodeAt(0)+128)),n=!1):t.append(h)}else throw new re;break;case 1:n?(t.append(String.fromCharCode(u+128)),n=!1):t.append(String.fromCharCode(u)),s=0;break;case 2:if(u<this.C40_SHIFT2_SET_CHARS.length){const h=this.C40_SHIFT2_SET_CHARS[u];n?(t.append(String.fromCharCode(h.charCodeAt(0)+128)),n=!1):t.append(h)}else switch(u){case 27:t.append("");break;case 30:n=!0;break;default:throw new re}s=0;break;case 3:n?(t.append(String.fromCharCode(u+224)),n=!1):t.append(String.fromCharCode(u+96)),s=0;break;default:throw new re}}}while(e.available()>0)}static decodeTextSegment(e,t){let n=!1,i=[],s=0;do{if(e.available()===8)return;const o=e.readBits(8);if(o===254)return;this.parseTwoBytes(o,e.readBits(8),i);for(let l=0;l<3;l++){const u=i[l];switch(s){case 0:if(u<3)s=u+1;else if(u<this.TEXT_BASIC_SET_CHARS.length){const h=this.TEXT_BASIC_SET_CHARS[u];n?(t.append(String.fromCharCode(h.charCodeAt(0)+128)),n=!1):t.append(h)}else throw new re;break;case 1:n?(t.append(String.fromCharCode(u+128)),n=!1):t.append(String.fromCharCode(u)),s=0;break;case 2:if(u<this.TEXT_SHIFT2_SET_CHARS.length){const h=this.TEXT_SHIFT2_SET_CHARS[u];n?(t.append(String.fromCharCode(h.charCodeAt(0)+128)),n=!1):t.append(h)}else switch(u){case 27:t.append("");break;case 30:n=!0;break;default:throw new re}s=0;break;case 3:if(u<this.TEXT_SHIFT3_SET_CHARS.length){const h=this.TEXT_SHIFT3_SET_CHARS[u];n?(t.append(String.fromCharCode(h.charCodeAt(0)+128)),n=!1):t.append(h),s=0}else throw new re;break;default:throw new re}}}while(e.available()>0)}static decodeAnsiX12Segment(e,t){const n=[];do{if(e.available()===8)return;const i=e.readBits(8);if(i===254)return;this.parseTwoBytes(i,e.readBits(8),n);for(let s=0;s<3;s++){const o=n[s];switch(o){case 0:t.append("\r");break;case 1:t.append("*");break;case 2:t.append(">");break;case 3:t.append(" ");break;default:if(o<14)t.append(String.fromCharCode(o+44));else if(o<40)t.append(String.fromCharCode(o+51));else throw new re;break}}}while(e.available()>0)}static parseTwoBytes(e,t,n){let i=(e<<8)+t-1,s=Math.floor(i/1600);n[0]=s,i-=s*1600,s=Math.floor(i/40),n[1]=s,n[2]=i-s*40}static decodeEdifactSegment(e,t){do{if(e.available()<=16)return;for(let n=0;n<4;n++){let i=e.readBits(6);if(i===31){const s=8-e.getBitOffset();s!==8&&e.readBits(s);return}(i&32)===0&&(i|=64),t.append(String.fromCharCode(i))}}while(e.available()>0)}static decodeBase256Segment(e,t,n){let i=1+e.getByteOffset();const s=this.unrandomize255State(e.readBits(8),i++);let o;if(s===0?o=e.available()/8|0:s<250?o=s:o=250*(s-249)+this.unrandomize255State(e.readBits(8),i++),o<0)throw new re;const l=new Uint8Array(o);for(let u=0;u<o;u++){if(e.available()<8)throw new re;l[u]=this.unrandomize255State(e.readBits(8),i++)}n.push(l);try{t.append(en.decode(l,ye.ISO88591))}catch(u){throw new un("Platform does not support required encoding: "+u.message)}}static unrandomize255State(e,t){const n=149*t%255+1,i=e-n;return i>=0?i:i+256}}kn.C40_BASIC_SET_CHARS=["*","*","*"," ","0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],kn.C40_SHIFT2_SET_CHARS=["!",'"',"#","$","%","&","'","(",")","*","+",",","-",".","/",":",";","<","=",">","?","@","[","\\","]","^","_"],kn.TEXT_BASIC_SET_CHARS=["*","*","*"," ","0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"],kn.TEXT_SHIFT2_SET_CHARS=kn.C40_SHIFT2_SET_CHARS,kn.TEXT_SHIFT3_SET_CHARS=["`","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","{","|","}","~",""];class xs{constructor(){this.rsDecoder=new Vr($e.DATA_MATRIX_FIELD_256)}decode(e){const t=new En(e),n=t.getVersion(),i=t.readCodewords(),s=Vn.getDataBlocks(i,n);let o=0;for(let h of s)o+=h.getNumDataCodewords();const l=new Uint8Array(o),u=s.length;for(let h=0;h<u;h++){const p=s[h],A=p.getCodewords(),b=p.getNumDataCodewords();this.correctErrors(A,b);for(let L=0;L<b;L++)l[L*u+h]=A[L]}return kn.decode(l)}correctErrors(e,t){const n=new Int32Array(e);try{this.rsDecoder.decode(n,e.length-t)}catch{throw new Ee}for(let i=0;i<t;i++)e[i]=n[i]}}class Et{constructor(e){this.image=e,this.rectangleDetector=new Gn(this.image)}detect(){const e=this.rectangleDetector.detect();let t=this.detectSolid1(e);if(t=this.detectSolid2(t),t[3]=this.correctTopRight(t),!t[3])throw new v;t=this.shiftToModuleCenter(t);const n=t[0],i=t[1],s=t[2],o=t[3];let l=this.transitionsBetween(n,o)+1,u=this.transitionsBetween(s,o)+1;(l&1)===1&&(l+=1),(u&1)===1&&(u+=1),4*l<7*u&&4*u<7*l&&(l=u=Math.max(l,u));let h=Et.sampleGrid(this.image,n,i,s,o,l,u);return new cr(h,[n,i,s,o])}static shiftPoint(e,t,n){let i=(t.getX()-e.getX())/(n+1),s=(t.getY()-e.getY())/(n+1);return new le(e.getX()+i,e.getY()+s)}static moveAway(e,t,n){let i=e.getX(),s=e.getY();return i<t?i-=1:i+=1,s<n?s-=1:s+=1,new le(i,s)}detectSolid1(e){let t=e[0],n=e[1],i=e[3],s=e[2],o=this.transitionsBetween(t,n),l=this.transitionsBetween(n,i),u=this.transitionsBetween(i,s),h=this.transitionsBetween(s,t),p=o,A=[s,t,n,i];return p>l&&(p=l,A[0]=t,A[1]=n,A[2]=i,A[3]=s),p>u&&(p=u,A[0]=n,A[1]=i,A[2]=s,A[3]=t),p>h&&(A[0]=i,A[1]=s,A[2]=t,A[3]=n),A}detectSolid2(e){let t=e[0],n=e[1],i=e[2],s=e[3],o=this.transitionsBetween(t,s),l=Et.shiftPoint(n,i,(o+1)*4),u=Et.shiftPoint(i,n,(o+1)*4),h=this.transitionsBetween(l,t),p=this.transitionsBetween(u,s);return h<p?(e[0]=t,e[1]=n,e[2]=i,e[3]=s):(e[0]=n,e[1]=i,e[2]=s,e[3]=t),e}correctTopRight(e){let t=e[0],n=e[1],i=e[2],s=e[3],o=this.transitionsBetween(t,s),l=this.transitionsBetween(n,s),u=Et.shiftPoint(t,n,(l+1)*4),h=Et.shiftPoint(i,n,(o+1)*4);o=this.transitionsBetween(u,s),l=this.transitionsBetween(h,s);let p=new le(s.getX()+(i.getX()-n.getX())/(o+1),s.getY()+(i.getY()-n.getY())/(o+1)),A=new le(s.getX()+(t.getX()-n.getX())/(l+1),s.getY()+(t.getY()-n.getY())/(l+1));if(!this.isValid(p))return this.isValid(A)?A:null;if(!this.isValid(A))return p;let b=this.transitionsBetween(u,p)+this.transitionsBetween(h,p),L=this.transitionsBetween(u,A)+this.transitionsBetween(h,A);return b>L?p:A}shiftToModuleCenter(e){let t=e[0],n=e[1],i=e[2],s=e[3],o=this.transitionsBetween(t,s)+1,l=this.transitionsBetween(i,s)+1,u=Et.shiftPoint(t,n,l*4),h=Et.shiftPoint(i,n,o*4);o=this.transitionsBetween(u,s)+1,l=this.transitionsBetween(h,s)+1,(o&1)===1&&(o+=1),(l&1)===1&&(l+=1);let p=(t.getX()+n.getX()+i.getX()+s.getX())/4,A=(t.getY()+n.getY()+i.getY()+s.getY())/4;t=Et.moveAway(t,p,A),n=Et.moveAway(n,p,A),i=Et.moveAway(i,p,A),s=Et.moveAway(s,p,A);let b,L;return u=Et.shiftPoint(t,n,l*4),u=Et.shiftPoint(u,s,o*4),b=Et.shiftPoint(n,t,l*4),b=Et.shiftPoint(b,i,o*4),h=Et.shiftPoint(i,s,l*4),h=Et.shiftPoint(h,n,o*4),L=Et.shiftPoint(s,i,l*4),L=Et.shiftPoint(L,t,o*4),[u,b,h,L]}isValid(e){return e.getX()>=0&&e.getX()<this.image.getWidth()&&e.getY()>0&&e.getY()<this.image.getHeight()}static sampleGrid(e,t,n,i,s,o,l){return wn.getInstance().sampleGrid(e,o,l,.5,.5,o-.5,.5,o-.5,l-.5,.5,l-.5,t.getX(),t.getY(),s.getX(),s.getY(),i.getX(),i.getY(),n.getX(),n.getY())}transitionsBetween(e,t){let n=Math.trunc(e.getX()),i=Math.trunc(e.getY()),s=Math.trunc(t.getX()),o=Math.trunc(t.getY()),l=Math.abs(o-i)>Math.abs(s-n);if(l){let M=n;n=i,i=M,M=s,s=o,o=M}let u=Math.abs(s-n),h=Math.abs(o-i),p=-u/2,A=i<o?1:-1,b=n<s?1:-1,L=0,E=this.image.get(l?i:n,l?n:i);for(let M=n,D=i;M!==s;M+=b){let P=this.image.get(l?D:M,l?M:D);if(P!==E&&(L++,E=P),p+=h,p>0){if(D===o)break;D+=A,p-=u}}return L}}class Tn{constructor(){this.decoder=new xs}decode(e,t=null){let n,i;if(t!=null&&t.has(Be.PURE_BARCODE)){const h=Tn.extractPureBits(e.getBlackMatrix());n=this.decoder.decode(h),i=Tn.NO_POINTS}else{const h=new Et(e.getBlackMatrix()).detect();n=this.decoder.decode(h.getBits()),i=h.getPoints()}const s=n.getRawBytes(),o=new Ft(n.getText(),s,8*s.length,i,me.DATA_MATRIX,ge.currentTimeMillis()),l=n.getByteSegments();l!=null&&o.putMetadata(gt.BYTE_SEGMENTS,l);const u=n.getECLevel();return u!=null&&o.putMetadata(gt.ERROR_CORRECTION_LEVEL,u),o}reset(){}static extractPureBits(e){const t=e.getTopLeftOnBit(),n=e.getBottomRightOnBit();if(t==null||n==null)throw new v;const i=this.moduleSize(t,e);let s=t[1];const o=n[1];let l=t[0];const h=(n[0]-l+1)/i,p=(o-s+1)/i;if(h<=0||p<=0)throw new v;const A=i/2;s+=A,l+=A;const b=new Mt(h,p);for(let L=0;L<p;L++){const E=s+L*i;for(let M=0;M<h;M++)e.get(l+M*i,E)&&b.set(M,L)}return b}static moduleSize(e,t){const n=t.getWidth();let i=e[0];const s=e[1];for(;i<n&&t.get(i,s);)i++;if(i===n)throw new v;const o=i-e[0];if(o===0)throw new v;return o}}Tn.NO_POINTS=[];class Ji extends Wn{constructor(e=500){super(new Tn,e)}}var di;(function(w){w[w.L=0]="L",w[w.M=1]="M",w[w.Q=2]="Q",w[w.H=3]="H"})(di||(di={}));class pt{constructor(e,t,n){this.value=e,this.stringValue=t,this.bits=n,pt.FOR_BITS.set(n,this),pt.FOR_VALUE.set(e,this)}getValue(){return this.value}getBits(){return this.bits}static fromString(e){switch(e){case"L":return pt.L;case"M":return pt.M;case"Q":return pt.Q;case"H":return pt.H;default:throw new z(e+"not available")}}toString(){return this.stringValue}equals(e){if(!(e instanceof pt))return!1;const t=e;return this.value===t.value}static forBits(e){if(e<0||e>=pt.FOR_BITS.size)throw new H;return pt.FOR_BITS.get(e)}}pt.FOR_BITS=new Map,pt.FOR_VALUE=new Map,pt.L=new pt(di.L,"L",1),pt.M=new pt(di.M,"M",0),pt.Q=new pt(di.Q,"Q",3),pt.H=new pt(di.H,"H",2);class rn{constructor(e){this.errorCorrectionLevel=pt.forBits(e>>3&3),this.dataMask=e&7}static numBitsDiffering(e,t){return fe.bitCount(e^t)}static decodeFormatInformation(e,t){const n=rn.doDecodeFormatInformation(e,t);return n!==null?n:rn.doDecodeFormatInformation(e^rn.FORMAT_INFO_MASK_QR,t^rn.FORMAT_INFO_MASK_QR)}static doDecodeFormatInformation(e,t){let n=Number.MAX_SAFE_INTEGER,i=0;for(const s of rn.FORMAT_INFO_DECODE_LOOKUP){const o=s[0];if(o===e||o===t)return new rn(s[1]);let l=rn.numBitsDiffering(e,o);l<n&&(i=s[1],n=l),e!==t&&(l=rn.numBitsDiffering(t,o),l<n&&(i=s[1],n=l))}return n<=3?new rn(i):null}getErrorCorrectionLevel(){return this.errorCorrectionLevel}getDataMask(){return this.dataMask}hashCode(){return this.errorCorrectionLevel.getBits()<<3|this.dataMask}equals(e){if(!(e instanceof rn))return!1;const t=e;return this.errorCorrectionLevel===t.errorCorrectionLevel&&this.dataMask===t.dataMask}}rn.FORMAT_INFO_MASK_QR=21522,rn.FORMAT_INFO_DECODE_LOOKUP=[Int32Array.from([21522,0]),Int32Array.from([20773,1]),Int32Array.from([24188,2]),Int32Array.from([23371,3]),Int32Array.from([17913,4]),Int32Array.from([16590,5]),Int32Array.from([20375,6]),Int32Array.from([19104,7]),Int32Array.from([30660,8]),Int32Array.from([29427,9]),Int32Array.from([32170,10]),Int32Array.from([30877,11]),Int32Array.from([26159,12]),Int32Array.from([25368,13]),Int32Array.from([27713,14]),Int32Array.from([26998,15]),Int32Array.from([5769,16]),Int32Array.from([5054,17]),Int32Array.from([7399,18]),Int32Array.from([6608,19]),Int32Array.from([1890,20]),Int32Array.from([597,21]),Int32Array.from([3340,22]),Int32Array.from([2107,23]),Int32Array.from([13663,24]),Int32Array.from([12392,25]),Int32Array.from([16177,26]),Int32Array.from([14854,27]),Int32Array.from([9396,28]),Int32Array.from([8579,29]),Int32Array.from([11994,30]),Int32Array.from([11245,31])];class j{constructor(e,...t){this.ecCodewordsPerBlock=e,this.ecBlocks=t}getECCodewordsPerBlock(){return this.ecCodewordsPerBlock}getNumBlocks(){let e=0;const t=this.ecBlocks;for(const n of t)e+=n.getCount();return e}getTotalECCodewords(){return this.ecCodewordsPerBlock*this.getNumBlocks()}getECBlocks(){return this.ecBlocks}}class R{constructor(e,t){this.count=e,this.dataCodewords=t}getCount(){return this.count}getDataCodewords(){return this.dataCodewords}}class Ae{constructor(e,t,...n){this.versionNumber=e,this.alignmentPatternCenters=t,this.ecBlocks=n;let i=0;const s=n[0].getECCodewordsPerBlock(),o=n[0].getECBlocks();for(const l of o)i+=l.getCount()*(l.getDataCodewords()+s);this.totalCodewords=i}getVersionNumber(){return this.versionNumber}getAlignmentPatternCenters(){return this.alignmentPatternCenters}getTotalCodewords(){return this.totalCodewords}getDimensionForVersion(){return 17+4*this.versionNumber}getECBlocksForLevel(e){return this.ecBlocks[e.getValue()]}static getProvisionalVersionForDimension(e){if(e%4!==1)throw new re;try{return this.getVersionForNumber((e-17)/4)}catch{throw new re}}static getVersionForNumber(e){if(e<1||e>40)throw new H;return Ae.VERSIONS[e-1]}static decodeVersionInformation(e){let t=Number.MAX_SAFE_INTEGER,n=0;for(let i=0;i<Ae.VERSION_DECODE_INFO.length;i++){const s=Ae.VERSION_DECODE_INFO[i];if(s===e)return Ae.getVersionForNumber(i+7);const o=rn.numBitsDiffering(e,s);o<t&&(n=i+7,t=o)}return t<=3?Ae.getVersionForNumber(n):null}buildFunctionPattern(){const e=this.getDimensionForVersion(),t=new Mt(e);t.setRegion(0,0,9,9),t.setRegion(e-8,0,8,9),t.setRegion(0,e-8,9,8);const n=this.alignmentPatternCenters.length;for(let i=0;i<n;i++){const s=this.alignmentPatternCenters[i]-2;for(let o=0;o<n;o++)i===0&&(o===0||o===n-1)||i===n-1&&o===0||t.setRegion(this.alignmentPatternCenters[o]-2,s,5,5)}return t.setRegion(6,9,1,e-17),t.setRegion(9,6,e-17,1),this.versionNumber>6&&(t.setRegion(e-11,0,3,6),t.setRegion(0,e-11,6,3)),t}toString(){return""+this.versionNumber}}Ae.VERSION_DECODE_INFO=Int32Array.from([31892,34236,39577,42195,48118,51042,55367,58893,63784,68472,70749,76311,79154,84390,87683,92361,96236,102084,102881,110507,110734,117786,119615,126325,127568,133589,136944,141498,145311,150283,152622,158308,161089,167017]),Ae.VERSIONS=[new Ae(1,new Int32Array(0),new j(7,new R(1,19)),new j(10,new R(1,16)),new j(13,new R(1,13)),new j(17,new R(1,9))),new Ae(2,Int32Array.from([6,18]),new j(10,new R(1,34)),new j(16,new R(1,28)),new j(22,new R(1,22)),new j(28,new R(1,16))),new Ae(3,Int32Array.from([6,22]),new j(15,new R(1,55)),new j(26,new R(1,44)),new j(18,new R(2,17)),new j(22,new R(2,13))),new Ae(4,Int32Array.from([6,26]),new j(20,new R(1,80)),new j(18,new R(2,32)),new j(26,new R(2,24)),new j(16,new R(4,9))),new Ae(5,Int32Array.from([6,30]),new j(26,new R(1,108)),new j(24,new R(2,43)),new j(18,new R(2,15),new R(2,16)),new j(22,new R(2,11),new R(2,12))),new Ae(6,Int32Array.from([6,34]),new j(18,new R(2,68)),new j(16,new R(4,27)),new j(24,new R(4,19)),new j(28,new R(4,15))),new Ae(7,Int32Array.from([6,22,38]),new j(20,new R(2,78)),new j(18,new R(4,31)),new j(18,new R(2,14),new R(4,15)),new j(26,new R(4,13),new R(1,14))),new Ae(8,Int32Array.from([6,24,42]),new j(24,new R(2,97)),new j(22,new R(2,38),new R(2,39)),new j(22,new R(4,18),new R(2,19)),new j(26,new R(4,14),new R(2,15))),new Ae(9,Int32Array.from([6,26,46]),new j(30,new R(2,116)),new j(22,new R(3,36),new R(2,37)),new j(20,new R(4,16),new R(4,17)),new j(24,new R(4,12),new R(4,13))),new Ae(10,Int32Array.from([6,28,50]),new j(18,new R(2,68),new R(2,69)),new j(26,new R(4,43),new R(1,44)),new j(24,new R(6,19),new R(2,20)),new j(28,new R(6,15),new R(2,16))),new Ae(11,Int32Array.from([6,30,54]),new j(20,new R(4,81)),new j(30,new R(1,50),new R(4,51)),new j(28,new R(4,22),new R(4,23)),new j(24,new R(3,12),new R(8,13))),new Ae(12,Int32Array.from([6,32,58]),new j(24,new R(2,92),new R(2,93)),new j(22,new R(6,36),new R(2,37)),new j(26,new R(4,20),new R(6,21)),new j(28,new R(7,14),new R(4,15))),new Ae(13,Int32Array.from([6,34,62]),new j(26,new R(4,107)),new j(22,new R(8,37),new R(1,38)),new j(24,new R(8,20),new R(4,21)),new j(22,new R(12,11),new R(4,12))),new Ae(14,Int32Array.from([6,26,46,66]),new j(30,new R(3,115),new R(1,116)),new j(24,new R(4,40),new R(5,41)),new j(20,new R(11,16),new R(5,17)),new j(24,new R(11,12),new R(5,13))),new Ae(15,Int32Array.from([6,26,48,70]),new j(22,new R(5,87),new R(1,88)),new j(24,new R(5,41),new R(5,42)),new j(30,new R(5,24),new R(7,25)),new j(24,new R(11,12),new R(7,13))),new Ae(16,Int32Array.from([6,26,50,74]),new j(24,new R(5,98),new R(1,99)),new j(28,new R(7,45),new R(3,46)),new j(24,new R(15,19),new R(2,20)),new j(30,new R(3,15),new R(13,16))),new Ae(17,Int32Array.from([6,30,54,78]),new j(28,new R(1,107),new R(5,108)),new j(28,new R(10,46),new R(1,47)),new j(28,new R(1,22),new R(15,23)),new j(28,new R(2,14),new R(17,15))),new Ae(18,Int32Array.from([6,30,56,82]),new j(30,new R(5,120),new R(1,121)),new j(26,new R(9,43),new R(4,44)),new j(28,new R(17,22),new R(1,23)),new j(28,new R(2,14),new R(19,15))),new Ae(19,Int32Array.from([6,30,58,86]),new j(28,new R(3,113),new R(4,114)),new j(26,new R(3,44),new R(11,45)),new j(26,new R(17,21),new R(4,22)),new j(26,new R(9,13),new R(16,14))),new Ae(20,Int32Array.from([6,34,62,90]),new j(28,new R(3,107),new R(5,108)),new j(26,new R(3,41),new R(13,42)),new j(30,new R(15,24),new R(5,25)),new j(28,new R(15,15),new R(10,16))),new Ae(21,Int32Array.from([6,28,50,72,94]),new j(28,new R(4,116),new R(4,117)),new j(26,new R(17,42)),new j(28,new R(17,22),new R(6,23)),new j(30,new R(19,16),new R(6,17))),new Ae(22,Int32Array.from([6,26,50,74,98]),new j(28,new R(2,111),new R(7,112)),new j(28,new R(17,46)),new j(30,new R(7,24),new R(16,25)),new j(24,new R(34,13))),new Ae(23,Int32Array.from([6,30,54,78,102]),new j(30,new R(4,121),new R(5,122)),new j(28,new R(4,47),new R(14,48)),new j(30,new R(11,24),new R(14,25)),new j(30,new R(16,15),new R(14,16))),new Ae(24,Int32Array.from([6,28,54,80,106]),new j(30,new R(6,117),new R(4,118)),new j(28,new R(6,45),new R(14,46)),new j(30,new R(11,24),new R(16,25)),new j(30,new R(30,16),new R(2,17))),new Ae(25,Int32Array.from([6,32,58,84,110]),new j(26,new R(8,106),new R(4,107)),new j(28,new R(8,47),new R(13,48)),new j(30,new R(7,24),new R(22,25)),new j(30,new R(22,15),new R(13,16))),new Ae(26,Int32Array.from([6,30,58,86,114]),new j(28,new R(10,114),new R(2,115)),new j(28,new R(19,46),new R(4,47)),new j(28,new R(28,22),new R(6,23)),new j(30,new R(33,16),new R(4,17))),new Ae(27,Int32Array.from([6,34,62,90,118]),new j(30,new R(8,122),new R(4,123)),new j(28,new R(22,45),new R(3,46)),new j(30,new R(8,23),new R(26,24)),new j(30,new R(12,15),new R(28,16))),new Ae(28,Int32Array.from([6,26,50,74,98,122]),new j(30,new R(3,117),new R(10,118)),new j(28,new R(3,45),new R(23,46)),new j(30,new R(4,24),new R(31,25)),new j(30,new R(11,15),new R(31,16))),new Ae(29,Int32Array.from([6,30,54,78,102,126]),new j(30,new R(7,116),new R(7,117)),new j(28,new R(21,45),new R(7,46)),new j(30,new R(1,23),new R(37,24)),new j(30,new R(19,15),new R(26,16))),new Ae(30,Int32Array.from([6,26,52,78,104,130]),new j(30,new R(5,115),new R(10,116)),new j(28,new R(19,47),new R(10,48)),new j(30,new R(15,24),new R(25,25)),new j(30,new R(23,15),new R(25,16))),new Ae(31,Int32Array.from([6,30,56,82,108,134]),new j(30,new R(13,115),new R(3,116)),new j(28,new R(2,46),new R(29,47)),new j(30,new R(42,24),new R(1,25)),new j(30,new R(23,15),new R(28,16))),new Ae(32,Int32Array.from([6,34,60,86,112,138]),new j(30,new R(17,115)),new j(28,new R(10,46),new R(23,47)),new j(30,new R(10,24),new R(35,25)),new j(30,new R(19,15),new R(35,16))),new Ae(33,Int32Array.from([6,30,58,86,114,142]),new j(30,new R(17,115),new R(1,116)),new j(28,new R(14,46),new R(21,47)),new j(30,new R(29,24),new R(19,25)),new j(30,new R(11,15),new R(46,16))),new Ae(34,Int32Array.from([6,34,62,90,118,146]),new j(30,new R(13,115),new R(6,116)),new j(28,new R(14,46),new R(23,47)),new j(30,new R(44,24),new R(7,25)),new j(30,new R(59,16),new R(1,17))),new Ae(35,Int32Array.from([6,30,54,78,102,126,150]),new j(30,new R(12,121),new R(7,122)),new j(28,new R(12,47),new R(26,48)),new j(30,new R(39,24),new R(14,25)),new j(30,new R(22,15),new R(41,16))),new Ae(36,Int32Array.from([6,24,50,76,102,128,154]),new j(30,new R(6,121),new R(14,122)),new j(28,new R(6,47),new R(34,48)),new j(30,new R(46,24),new R(10,25)),new j(30,new R(2,15),new R(64,16))),new Ae(37,Int32Array.from([6,28,54,80,106,132,158]),new j(30,new R(17,122),new R(4,123)),new j(28,new R(29,46),new R(14,47)),new j(30,new R(49,24),new R(10,25)),new j(30,new R(24,15),new R(46,16))),new Ae(38,Int32Array.from([6,32,58,84,110,136,162]),new j(30,new R(4,122),new R(18,123)),new j(28,new R(13,46),new R(32,47)),new j(30,new R(48,24),new R(14,25)),new j(30,new R(42,15),new R(32,16))),new Ae(39,Int32Array.from([6,26,54,82,110,138,166]),new j(30,new R(20,117),new R(4,118)),new j(28,new R(40,47),new R(7,48)),new j(30,new R(43,24),new R(22,25)),new j(30,new R(10,15),new R(67,16))),new Ae(40,Int32Array.from([6,30,58,86,114,142,170]),new j(30,new R(19,118),new R(6,119)),new j(28,new R(18,47),new R(31,48)),new j(30,new R(34,24),new R(34,25)),new j(30,new R(20,15),new R(61,16)))];var Ht;(function(w){w[w.DATA_MASK_000=0]="DATA_MASK_000",w[w.DATA_MASK_001=1]="DATA_MASK_001",w[w.DATA_MASK_010=2]="DATA_MASK_010",w[w.DATA_MASK_011=3]="DATA_MASK_011",w[w.DATA_MASK_100=4]="DATA_MASK_100",w[w.DATA_MASK_101=5]="DATA_MASK_101",w[w.DATA_MASK_110=6]="DATA_MASK_110",w[w.DATA_MASK_111=7]="DATA_MASK_111"})(Ht||(Ht={}));class Nn{constructor(e,t){this.value=e,this.isMasked=t}unmaskBitMatrix(e,t){for(let n=0;n<t;n++)for(let i=0;i<t;i++)this.isMasked(n,i)&&e.flip(i,n)}}Nn.values=new Map([[Ht.DATA_MASK_000,new Nn(Ht.DATA_MASK_000,(w,e)=>(w+e&1)===0)],[Ht.DATA_MASK_001,new Nn(Ht.DATA_MASK_001,(w,e)=>(w&1)===0)],[Ht.DATA_MASK_010,new Nn(Ht.DATA_MASK_010,(w,e)=>e%3===0)],[Ht.DATA_MASK_011,new Nn(Ht.DATA_MASK_011,(w,e)=>(w+e)%3===0)],[Ht.DATA_MASK_100,new Nn(Ht.DATA_MASK_100,(w,e)=>(Math.floor(w/2)+Math.floor(e/3)&1)===0)],[Ht.DATA_MASK_101,new Nn(Ht.DATA_MASK_101,(w,e)=>w*e%6===0)],[Ht.DATA_MASK_110,new Nn(Ht.DATA_MASK_110,(w,e)=>w*e%6<3)],[Ht.DATA_MASK_111,new Nn(Ht.DATA_MASK_111,(w,e)=>(w+e+w*e%3&1)===0)]]);class gi{constructor(e){const t=e.getHeight();if(t<21||(t&3)!==1)throw new re;this.bitMatrix=e}readFormatInformation(){if(this.parsedFormatInfo!==null&&this.parsedFormatInfo!==void 0)return this.parsedFormatInfo;let e=0;for(let s=0;s<6;s++)e=this.copyBit(s,8,e);e=this.copyBit(7,8,e),e=this.copyBit(8,8,e),e=this.copyBit(8,7,e);for(let s=5;s>=0;s--)e=this.copyBit(8,s,e);const t=this.bitMatrix.getHeight();let n=0;const i=t-7;for(let s=t-1;s>=i;s--)n=this.copyBit(8,s,n);for(let s=t-8;s<t;s++)n=this.copyBit(s,8,n);if(this.parsedFormatInfo=rn.decodeFormatInformation(e,n),this.parsedFormatInfo!==null)return this.parsedFormatInfo;throw new re}readVersion(){if(this.parsedVersion!==null&&this.parsedVersion!==void 0)return this.parsedVersion;const e=this.bitMatrix.getHeight(),t=Math.floor((e-17)/4);if(t<=6)return Ae.getVersionForNumber(t);let n=0;const i=e-11;for(let o=5;o>=0;o--)for(let l=e-9;l>=i;l--)n=this.copyBit(l,o,n);let s=Ae.decodeVersionInformation(n);if(s!==null&&s.getDimensionForVersion()===e)return this.parsedVersion=s,s;n=0;for(let o=5;o>=0;o--)for(let l=e-9;l>=i;l--)n=this.copyBit(o,l,n);if(s=Ae.decodeVersionInformation(n),s!==null&&s.getDimensionForVersion()===e)return this.parsedVersion=s,s;throw new re}copyBit(e,t,n){return(this.isMirror?this.bitMatrix.get(t,e):this.bitMatrix.get(e,t))?n<<1|1:n<<1}readCodewords(){const e=this.readFormatInformation(),t=this.readVersion(),n=Nn.values.get(e.getDataMask()),i=this.bitMatrix.getHeight();n.unmaskBitMatrix(this.bitMatrix,i);const s=t.buildFunctionPattern();let o=!0;const l=new Uint8Array(t.getTotalCodewords());let u=0,h=0,p=0;for(let A=i-1;A>0;A-=2){A===6&&A--;for(let b=0;b<i;b++){const L=o?i-1-b:b;for(let E=0;E<2;E++)s.get(A-E,L)||(p++,h<<=1,this.bitMatrix.get(A-E,L)&&(h|=1),p===8&&(l[u++]=h,p=0,h=0))}o=!o}if(u!==t.getTotalCodewords())throw new re;return l}remask(){if(this.parsedFormatInfo===null)return;const e=Nn.values[this.parsedFormatInfo.getDataMask()],t=this.bitMatrix.getHeight();e.unmaskBitMatrix(this.bitMatrix,t)}setMirror(e){this.parsedVersion=null,this.parsedFormatInfo=null,this.isMirror=e}mirror(){const e=this.bitMatrix;for(let t=0,n=e.getWidth();t<n;t++)for(let i=t+1,s=e.getHeight();i<s;i++)e.get(t,i)!==e.get(i,t)&&(e.flip(i,t),e.flip(t,i))}}class $i{constructor(e,t){this.numDataCodewords=e,this.codewords=t}static getDataBlocks(e,t,n){if(e.length!==t.getTotalCodewords())throw new H;const i=t.getECBlocksForLevel(n);let s=0;const o=i.getECBlocks();for(const E of o)s+=E.getCount();const l=new Array(s);let u=0;for(const E of o)for(let M=0;M<E.getCount();M++){const D=E.getDataCodewords(),P=i.getECCodewordsPerBlock()+D;l[u++]=new $i(D,new Uint8Array(P))}const h=l[0].codewords.length;let p=l.length-1;for(;p>=0&&l[p].codewords.length!==h;)p--;p++;const A=h-i.getECCodewordsPerBlock();let b=0;for(let E=0;E<A;E++)for(let M=0;M<u;M++)l[M].codewords[E]=e[b++];for(let E=p;E<u;E++)l[E].codewords[A]=e[b++];const L=l[0].codewords.length;for(let E=A;E<L;E++)for(let M=0;M<u;M++){const D=M<p?E:E+1;l[M].codewords[D]=e[b++]}return l}getNumDataCodewords(){return this.numDataCodewords}getCodewords(){return this.codewords}}var Fn;(function(w){w[w.TERMINATOR=0]="TERMINATOR",w[w.NUMERIC=1]="NUMERIC",w[w.ALPHANUMERIC=2]="ALPHANUMERIC",w[w.STRUCTURED_APPEND=3]="STRUCTURED_APPEND",w[w.BYTE=4]="BYTE",w[w.ECI=5]="ECI",w[w.KANJI=6]="KANJI",w[w.FNC1_FIRST_POSITION=7]="FNC1_FIRST_POSITION",w[w.FNC1_SECOND_POSITION=8]="FNC1_SECOND_POSITION",w[w.HANZI=9]="HANZI"})(Fn||(Fn={}));class Ie{constructor(e,t,n,i){this.value=e,this.stringValue=t,this.characterCountBitsForVersions=n,this.bits=i,Ie.FOR_BITS.set(i,this),Ie.FOR_VALUE.set(e,this)}static forBits(e){const t=Ie.FOR_BITS.get(e);if(t===void 0)throw new H;return t}getCharacterCountBits(e){const t=e.getVersionNumber();let n;return t<=9?n=0:t<=26?n=1:n=2,this.characterCountBitsForVersions[n]}getValue(){return this.value}getBits(){return this.bits}equals(e){if(!(e instanceof Ie))return!1;const t=e;return this.value===t.value}toString(){return this.stringValue}}Ie.FOR_BITS=new Map,Ie.FOR_VALUE=new Map,Ie.TERMINATOR=new Ie(Fn.TERMINATOR,"TERMINATOR",Int32Array.from([0,0,0]),0),Ie.NUMERIC=new Ie(Fn.NUMERIC,"NUMERIC",Int32Array.from([10,12,14]),1),Ie.ALPHANUMERIC=new Ie(Fn.ALPHANUMERIC,"ALPHANUMERIC",Int32Array.from([9,11,13]),2),Ie.STRUCTURED_APPEND=new Ie(Fn.STRUCTURED_APPEND,"STRUCTURED_APPEND",Int32Array.from([0,0,0]),3),Ie.BYTE=new Ie(Fn.BYTE,"BYTE",Int32Array.from([8,16,16]),4),Ie.ECI=new Ie(Fn.ECI,"ECI",Int32Array.from([0,0,0]),7),Ie.KANJI=new Ie(Fn.KANJI,"KANJI",Int32Array.from([8,10,12]),8),Ie.FNC1_FIRST_POSITION=new Ie(Fn.FNC1_FIRST_POSITION,"FNC1_FIRST_POSITION",Int32Array.from([0,0,0]),5),Ie.FNC1_SECOND_POSITION=new Ie(Fn.FNC1_SECOND_POSITION,"FNC1_SECOND_POSITION",Int32Array.from([0,0,0]),9),Ie.HANZI=new Ie(Fn.HANZI,"HANZI",Int32Array.from([8,10,12]),13);class vt{static decode(e,t,n,i){const s=new Sn(e);let o=new rt;const l=new Array;let u=-1,h=-1;try{let p=null,A=!1,b;do{if(s.available()<4)b=Ie.TERMINATOR;else{const L=s.readBits(4);b=Ie.forBits(L)}switch(b){case Ie.TERMINATOR:break;case Ie.FNC1_FIRST_POSITION:case Ie.FNC1_SECOND_POSITION:A=!0;break;case Ie.STRUCTURED_APPEND:if(s.available()<16)throw new re;u=s.readBits(8),h=s.readBits(8);break;case Ie.ECI:const L=vt.parseECIValue(s);if(p=ie.getCharacterSetECIByValue(L),p===null)throw new re;break;case Ie.HANZI:const E=s.readBits(4),M=s.readBits(b.getCharacterCountBits(t));E===vt.GB2312_SUBSET&&vt.decodeHanziSegment(s,o,M);break;default:const D=s.readBits(b.getCharacterCountBits(t));switch(b){case Ie.NUMERIC:vt.decodeNumericSegment(s,o,D);break;case Ie.ALPHANUMERIC:vt.decodeAlphanumericSegment(s,o,D,A);break;case Ie.BYTE:vt.decodeByteSegment(s,o,D,p,l,i);break;case Ie.KANJI:vt.decodeKanjiSegment(s,o,D);break;default:throw new re}break}}while(b!==Ie.TERMINATOR)}catch{throw new re}return new cn(e,o.toString(),l.length===0?null:l,n===null?null:n.toString(),u,h)}static decodeHanziSegment(e,t,n){if(n*13>e.available())throw new re;const i=new Uint8Array(2*n);let s=0;for(;n>0;){const o=e.readBits(13);let l=o/96<<8&4294967295|o%96;l<959?l+=41377:l+=42657,i[s]=l>>8&255,i[s+1]=l&255,s+=2,n--}try{t.append(en.decode(i,ye.GB2312))}catch(o){throw new re(o)}}static decodeKanjiSegment(e,t,n){if(n*13>e.available())throw new re;const i=new Uint8Array(2*n);let s=0;for(;n>0;){const o=e.readBits(13);let l=o/192<<8&4294967295|o%192;l<7936?l+=33088:l+=49472,i[s]=l>>8,i[s+1]=l,s+=2,n--}try{t.append(en.decode(i,ye.SHIFT_JIS))}catch(o){throw new re(o)}}static decodeByteSegment(e,t,n,i,s,o){if(8*n>e.available())throw new re;const l=new Uint8Array(n);for(let h=0;h<n;h++)l[h]=e.readBits(8);let u;i===null?u=ye.guessEncoding(l,o):u=i.getName();try{t.append(en.decode(l,u))}catch(h){throw new re(h)}s.push(l)}static toAlphaNumericChar(e){if(e>=vt.ALPHANUMERIC_CHARS.length)throw new re;return vt.ALPHANUMERIC_CHARS[e]}static decodeAlphanumericSegment(e,t,n,i){const s=t.length();for(;n>1;){if(e.available()<11)throw new re;const o=e.readBits(11);t.append(vt.toAlphaNumericChar(Math.floor(o/45))),t.append(vt.toAlphaNumericChar(o%45)),n-=2}if(n===1){if(e.available()<6)throw new re;t.append(vt.toAlphaNumericChar(e.readBits(6)))}if(i)for(let o=s;o<t.length();o++)t.charAt(o)==="%"&&(o<t.length()-1&&t.charAt(o+1)==="%"?t.deleteCharAt(o+1):t.setCharAt(o,""))}static decodeNumericSegment(e,t,n){for(;n>=3;){if(e.available()<10)throw new re;const i=e.readBits(10);if(i>=1e3)throw new re;t.append(vt.toAlphaNumericChar(Math.floor(i/100))),t.append(vt.toAlphaNumericChar(Math.floor(i/10)%10)),t.append(vt.toAlphaNumericChar(i%10)),n-=3}if(n===2){if(e.available()<7)throw new re;const i=e.readBits(7);if(i>=100)throw new re;t.append(vt.toAlphaNumericChar(Math.floor(i/10))),t.append(vt.toAlphaNumericChar(i%10))}else if(n===1){if(e.available()<4)throw new re;const i=e.readBits(4);if(i>=10)throw new re;t.append(vt.toAlphaNumericChar(i))}}static parseECIValue(e){const t=e.readBits(8);if((t&128)===0)return t&127;if((t&192)===128){const n=e.readBits(8);return(t&63)<<8&4294967295|n}if((t&224)===192){const n=e.readBits(16);return(t&31)<<16&4294967295|n}throw new re}}vt.ALPHANUMERIC_CHARS="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:",vt.GB2312_SUBSET=1;class ps{constructor(e){this.mirrored=e}isMirrored(){return this.mirrored}applyMirroredCorrection(e){if(!this.mirrored||e===null||e.length<3)return;const t=e[0];e[0]=e[2],e[2]=t}}class Zs{constructor(){this.rsDecoder=new Vr($e.QR_CODE_FIELD_256)}decodeBooleanArray(e,t){return this.decodeBitMatrix(Mt.parseFromBooleanArray(e),t)}decodeBitMatrix(e,t){const n=new gi(e);let i=null;try{return this.decodeBitMatrixParser(n,t)}catch(s){i=s}try{n.remask(),n.setMirror(!0),n.readVersion(),n.readFormatInformation(),n.mirror();const s=this.decodeBitMatrixParser(n,t);return s.setOther(new ps(!0)),s}catch(s){throw i!==null?i:s}}decodeBitMatrixParser(e,t){const n=e.readVersion(),i=e.readFormatInformation().getErrorCorrectionLevel(),s=e.readCodewords(),o=$i.getDataBlocks(s,n,i);let l=0;for(const p of o)l+=p.getNumDataCodewords();const u=new Uint8Array(l);let h=0;for(const p of o){const A=p.getCodewords(),b=p.getNumDataCodewords();this.correctErrors(A,b);for(let L=0;L<b;L++)u[h++]=A[L]}return vt.decode(u,n,i,t)}correctErrors(e,t){const n=new Int32Array(e);try{this.rsDecoder.decode(n,e.length-t)}catch{throw new Ee}for(let i=0;i<t;i++)e[i]=n[i]}}class es extends le{constructor(e,t,n){super(e,t),this.estimatedModuleSize=n}aboutEquals(e,t,n){if(Math.abs(t-this.getY())<=e&&Math.abs(n-this.getX())<=e){const i=Math.abs(e-this.estimatedModuleSize);return i<=1||i<=this.estimatedModuleSize}return!1}combineEstimate(e,t,n){const i=(this.getX()+t)/2,s=(this.getY()+e)/2,o=(this.estimatedModuleSize+n)/2;return new es(i,s,o)}}class ts{constructor(e,t,n,i,s,o,l){this.image=e,this.startX=t,this.startY=n,this.width=i,this.height=s,this.moduleSize=o,this.resultPointCallback=l,this.possibleCenters=[],this.crossCheckStateCount=new Int32Array(3)}find(){const e=this.startX,t=this.height,n=this.width,i=e+n,s=this.startY+t/2,o=new Int32Array(3),l=this.image;for(let u=0;u<t;u++){const h=s+((u&1)===0?Math.floor((u+1)/2):-Math.floor((u+1)/2));o[0]=0,o[1]=0,o[2]=0;let p=e;for(;p<i&&!l.get(p,h);)p++;let A=0;for(;p<i;){if(l.get(p,h))if(A===1)o[1]++;else if(A===2){if(this.foundPatternCross(o)){const b=this.handlePossibleCenter(o,h,p);if(b!==null)return b}o[0]=o[2],o[1]=1,o[2]=0,A=1}else o[++A]++;else A===1&&A++,o[A]++;p++}if(this.foundPatternCross(o)){const b=this.handlePossibleCenter(o,h,i);if(b!==null)return b}}if(this.possibleCenters.length!==0)return this.possibleCenters[0];throw new v}static centerFromEnd(e,t){return t-e[2]-e[1]/2}foundPatternCross(e){const t=this.moduleSize,n=t/2;for(let i=0;i<3;i++)if(Math.abs(t-e[i])>=n)return!1;return!0}crossCheckVertical(e,t,n,i){const s=this.image,o=s.getHeight(),l=this.crossCheckStateCount;l[0]=0,l[1]=0,l[2]=0;let u=e;for(;u>=0&&s.get(t,u)&&l[1]<=n;)l[1]++,u--;if(u<0||l[1]>n)return NaN;for(;u>=0&&!s.get(t,u)&&l[0]<=n;)l[0]++,u--;if(l[0]>n)return NaN;for(u=e+1;u<o&&s.get(t,u)&&l[1]<=n;)l[1]++,u++;if(u===o||l[1]>n)return NaN;for(;u<o&&!s.get(t,u)&&l[2]<=n;)l[2]++,u++;if(l[2]>n)return NaN;const h=l[0]+l[1]+l[2];return 5*Math.abs(h-i)>=2*i?NaN:this.foundPatternCross(l)?ts.centerFromEnd(l,u):NaN}handlePossibleCenter(e,t,n){const i=e[0]+e[1]+e[2],s=ts.centerFromEnd(e,n),o=this.crossCheckVertical(t,s,2*e[1],i);if(!isNaN(o)){const l=(e[0]+e[1]+e[2])/3;for(const h of this.possibleCenters)if(h.aboutEquals(l,o,s))return h.combineEstimate(o,s,l);const u=new es(s,o,l);this.possibleCenters.push(u),this.resultPointCallback!==null&&this.resultPointCallback!==void 0&&this.resultPointCallback.foundPossibleResultPoint(u)}return null}}class ms extends le{constructor(e,t,n,i){super(e,t),this.estimatedModuleSize=n,this.count=i,i===void 0&&(this.count=1)}getEstimatedModuleSize(){return this.estimatedModuleSize}getCount(){return this.count}aboutEquals(e,t,n){if(Math.abs(t-this.getY())<=e&&Math.abs(n-this.getX())<=e){const i=Math.abs(e-this.estimatedModuleSize);return i<=1||i<=this.estimatedModuleSize}return!1}combineEstimate(e,t,n){const i=this.count+1,s=(this.count*this.getX()+t)/i,o=(this.count*this.getY()+e)/i,l=(this.count*this.estimatedModuleSize+n)/i;return new ms(s,o,l,i)}}class za{constructor(e){this.bottomLeft=e[0],this.topLeft=e[1],this.topRight=e[2]}getBottomLeft(){return this.bottomLeft}getTopLeft(){return this.topLeft}getTopRight(){return this.topRight}}class Xt{constructor(e,t){this.image=e,this.resultPointCallback=t,this.possibleCenters=[],this.crossCheckStateCount=new Int32Array(5),this.resultPointCallback=t}getImage(){return this.image}getPossibleCenters(){return this.possibleCenters}find(e){const t=e!=null&&e.get(Be.TRY_HARDER)!==void 0,n=e!=null&&e.get(Be.PURE_BARCODE)!==void 0,i=this.image,s=i.getHeight(),o=i.getWidth();let l=Math.floor(3*s/(4*Xt.MAX_MODULES));(l<Xt.MIN_SKIP||t)&&(l=Xt.MIN_SKIP);let u=!1;const h=new Int32Array(5);for(let A=l-1;A<s&&!u;A+=l){h[0]=0,h[1]=0,h[2]=0,h[3]=0,h[4]=0;let b=0;for(let L=0;L<o;L++)if(i.get(L,A))(b&1)===1&&b++,h[b]++;else if((b&1)===0)if(b===4)if(Xt.foundPatternCross(h)){if(this.handlePossibleCenter(h,A,L,n)===!0)if(l=2,this.hasSkipped===!0)u=this.haveMultiplyConfirmedCenters();else{const M=this.findRowSkip();M>h[2]&&(A+=M-h[2]-l,L=o-1)}else{h[0]=h[2],h[1]=h[3],h[2]=h[4],h[3]=1,h[4]=0,b=3;continue}b=0,h[0]=0,h[1]=0,h[2]=0,h[3]=0,h[4]=0}else h[0]=h[2],h[1]=h[3],h[2]=h[4],h[3]=1,h[4]=0,b=3;else h[++b]++;else h[b]++;Xt.foundPatternCross(h)&&this.handlePossibleCenter(h,A,o,n)===!0&&(l=h[0],this.hasSkipped&&(u=this.haveMultiplyConfirmedCenters()))}const p=this.selectBestPatterns();return le.orderBestPatterns(p),new za(p)}static centerFromEnd(e,t){return t-e[4]-e[3]-e[2]/2}static foundPatternCross(e){let t=0;for(let s=0;s<5;s++){const o=e[s];if(o===0)return!1;t+=o}if(t<7)return!1;const n=t/7,i=n/2;return Math.abs(n-e[0])<i&&Math.abs(n-e[1])<i&&Math.abs(3*n-e[2])<3*i&&Math.abs(n-e[3])<i&&Math.abs(n-e[4])<i}getCrossCheckStateCount(){const e=this.crossCheckStateCount;return e[0]=0,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e}crossCheckDiagonal(e,t,n,i){const s=this.getCrossCheckStateCount();let o=0;const l=this.image;for(;e>=o&&t>=o&&l.get(t-o,e-o);)s[2]++,o++;if(e<o||t<o)return!1;for(;e>=o&&t>=o&&!l.get(t-o,e-o)&&s[1]<=n;)s[1]++,o++;if(e<o||t<o||s[1]>n)return!1;for(;e>=o&&t>=o&&l.get(t-o,e-o)&&s[0]<=n;)s[0]++,o++;if(s[0]>n)return!1;const u=l.getHeight(),h=l.getWidth();for(o=1;e+o<u&&t+o<h&&l.get(t+o,e+o);)s[2]++,o++;if(e+o>=u||t+o>=h)return!1;for(;e+o<u&&t+o<h&&!l.get(t+o,e+o)&&s[3]<n;)s[3]++,o++;if(e+o>=u||t+o>=h||s[3]>=n)return!1;for(;e+o<u&&t+o<h&&l.get(t+o,e+o)&&s[4]<n;)s[4]++,o++;if(s[4]>=n)return!1;const p=s[0]+s[1]+s[2]+s[3]+s[4];return Math.abs(p-i)<2*i&&Xt.foundPatternCross(s)}crossCheckVertical(e,t,n,i){const s=this.image,o=s.getHeight(),l=this.getCrossCheckStateCount();let u=e;for(;u>=0&&s.get(t,u);)l[2]++,u--;if(u<0)return NaN;for(;u>=0&&!s.get(t,u)&&l[1]<=n;)l[1]++,u--;if(u<0||l[1]>n)return NaN;for(;u>=0&&s.get(t,u)&&l[0]<=n;)l[0]++,u--;if(l[0]>n)return NaN;for(u=e+1;u<o&&s.get(t,u);)l[2]++,u++;if(u===o)return NaN;for(;u<o&&!s.get(t,u)&&l[3]<n;)l[3]++,u++;if(u===o||l[3]>=n)return NaN;for(;u<o&&s.get(t,u)&&l[4]<n;)l[4]++,u++;if(l[4]>=n)return NaN;const h=l[0]+l[1]+l[2]+l[3]+l[4];return 5*Math.abs(h-i)>=2*i?NaN:Xt.foundPatternCross(l)?Xt.centerFromEnd(l,u):NaN}crossCheckHorizontal(e,t,n,i){const s=this.image,o=s.getWidth(),l=this.getCrossCheckStateCount();let u=e;for(;u>=0&&s.get(u,t);)l[2]++,u--;if(u<0)return NaN;for(;u>=0&&!s.get(u,t)&&l[1]<=n;)l[1]++,u--;if(u<0||l[1]>n)return NaN;for(;u>=0&&s.get(u,t)&&l[0]<=n;)l[0]++,u--;if(l[0]>n)return NaN;for(u=e+1;u<o&&s.get(u,t);)l[2]++,u++;if(u===o)return NaN;for(;u<o&&!s.get(u,t)&&l[3]<n;)l[3]++,u++;if(u===o||l[3]>=n)return NaN;for(;u<o&&s.get(u,t)&&l[4]<n;)l[4]++,u++;if(l[4]>=n)return NaN;const h=l[0]+l[1]+l[2]+l[3]+l[4];return 5*Math.abs(h-i)>=i?NaN:Xt.foundPatternCross(l)?Xt.centerFromEnd(l,u):NaN}handlePossibleCenter(e,t,n,i){const s=e[0]+e[1]+e[2]+e[3]+e[4];let o=Xt.centerFromEnd(e,n),l=this.crossCheckVertical(t,Math.floor(o),e[2],s);if(!isNaN(l)&&(o=this.crossCheckHorizontal(Math.floor(o),Math.floor(l),e[2],s),!isNaN(o)&&(!i||this.crossCheckDiagonal(Math.floor(l),Math.floor(o),e[2],s)))){const u=s/7;let h=!1;const p=this.possibleCenters;for(let A=0,b=p.length;A<b;A++){const L=p[A];if(L.aboutEquals(u,l,o)){p[A]=L.combineEstimate(l,o,u),h=!0;break}}if(!h){const A=new ms(o,l,u);p.push(A),this.resultPointCallback!==null&&this.resultPointCallback!==void 0&&this.resultPointCallback.foundPossibleResultPoint(A)}return!0}return!1}findRowSkip(){if(this.possibleCenters.length<=1)return 0;let t=null;for(const n of this.possibleCenters)if(n.getCount()>=Xt.CENTER_QUORUM)if(t==null)t=n;else return this.hasSkipped=!0,Math.floor((Math.abs(t.getX()-n.getX())-Math.abs(t.getY()-n.getY()))/2);return 0}haveMultiplyConfirmedCenters(){let e=0,t=0;const n=this.possibleCenters.length;for(const o of this.possibleCenters)o.getCount()>=Xt.CENTER_QUORUM&&(e++,t+=o.getEstimatedModuleSize());if(e<3)return!1;const i=t/n;let s=0;for(const o of this.possibleCenters)s+=Math.abs(o.getEstimatedModuleSize()-i);return s<=.05*t}selectBestPatterns(){const e=this.possibleCenters.length;if(e<3)throw new v;const t=this.possibleCenters;let n;if(e>3){let i=0,s=0;for(const u of this.possibleCenters){const h=u.getEstimatedModuleSize();i+=h,s+=h*h}n=i/e;let o=Math.sqrt(s/e-n*n);t.sort((u,h)=>{const p=Math.abs(h.getEstimatedModuleSize()-n),A=Math.abs(u.getEstimatedModuleSize()-n);return p<A?-1:p>A?1:0});const l=Math.max(.2*n,o);for(let u=0;u<t.length&&t.length>3;u++){const h=t[u];Math.abs(h.getEstimatedModuleSize()-n)>l&&(t.splice(u,1),u--)}}if(t.length>3){let i=0;for(const s of t)i+=s.getEstimatedModuleSize();n=i/t.length,t.sort((s,o)=>{if(o.getCount()===s.getCount()){const l=Math.abs(o.getEstimatedModuleSize()-n),u=Math.abs(s.getEstimatedModuleSize()-n);return l<u?1:l>u?-1:0}else return o.getCount()-s.getCount()}),t.splice(3)}return[t[0],t[1],t[2]]}}Xt.CENTER_QUORUM=2,Xt.MIN_SKIP=3,Xt.MAX_MODULES=57;class Di{constructor(e){this.image=e}getImage(){return this.image}getResultPointCallback(){return this.resultPointCallback}detect(e){this.resultPointCallback=e==null?null:e.get(Be.NEED_RESULT_POINT_CALLBACK);const n=new Xt(this.image,this.resultPointCallback).find(e);return this.processFinderPatternInfo(n)}processFinderPatternInfo(e){const t=e.getTopLeft(),n=e.getTopRight(),i=e.getBottomLeft(),s=this.calculateModuleSize(t,n,i);if(s<1)throw new v("No pattern found in proccess finder.");const o=Di.computeDimension(t,n,i,s),l=Ae.getProvisionalVersionForDimension(o),u=l.getDimensionForVersion()-7;let h=null;if(l.getAlignmentPatternCenters().length>0){const L=n.getX()-t.getX()+i.getX(),E=n.getY()-t.getY()+i.getY(),M=1-3/u,D=Math.floor(t.getX()+M*(L-t.getX())),P=Math.floor(t.getY()+M*(E-t.getY()));for(let K=4;K<=16;K<<=1)try{h=this.findAlignmentInRegion(s,D,P,K);break}catch(q){if(!(q instanceof v))throw q}}const p=Di.createTransform(t,n,i,h,o),A=Di.sampleGrid(this.image,p,o);let b;return h===null?b=[i,t,n]:b=[i,t,n,h],new cr(A,b)}static createTransform(e,t,n,i,s){const o=s-3.5;let l,u,h,p;return i!==null?(l=i.getX(),u=i.getY(),h=o-3,p=h):(l=t.getX()-e.getX()+n.getX(),u=t.getY()-e.getY()+n.getY(),h=o,p=o),Bn.quadrilateralToQuadrilateral(3.5,3.5,o,3.5,h,p,3.5,o,e.getX(),e.getY(),t.getX(),t.getY(),l,u,n.getX(),n.getY())}static sampleGrid(e,t,n){return wn.getInstance().sampleGridWithTransform(e,n,n,t)}static computeDimension(e,t,n,i){const s=Ke.round(le.distance(e,t)/i),o=Ke.round(le.distance(e,n)/i);let l=Math.floor((s+o)/2)+7;switch(l&3){case 0:l++;break;case 2:l--;break;case 3:throw new v("Dimensions could be not found.")}return l}calculateModuleSize(e,t,n){return(this.calculateModuleSizeOneWay(e,t)+this.calculateModuleSizeOneWay(e,n))/2}calculateModuleSizeOneWay(e,t){const n=this.sizeOfBlackWhiteBlackRunBothWays(Math.floor(e.getX()),Math.floor(e.getY()),Math.floor(t.getX()),Math.floor(t.getY())),i=this.sizeOfBlackWhiteBlackRunBothWays(Math.floor(t.getX()),Math.floor(t.getY()),Math.floor(e.getX()),Math.floor(e.getY()));return isNaN(n)?i/7:isNaN(i)?n/7:(n+i)/14}sizeOfBlackWhiteBlackRunBothWays(e,t,n,i){let s=this.sizeOfBlackWhiteBlackRun(e,t,n,i),o=1,l=e-(n-e);l<0?(o=e/(e-l),l=0):l>=this.image.getWidth()&&(o=(this.image.getWidth()-1-e)/(l-e),l=this.image.getWidth()-1);let u=Math.floor(t-(i-t)*o);return o=1,u<0?(o=t/(t-u),u=0):u>=this.image.getHeight()&&(o=(this.image.getHeight()-1-t)/(u-t),u=this.image.getHeight()-1),l=Math.floor(e+(l-e)*o),s+=this.sizeOfBlackWhiteBlackRun(e,t,l,u),s-1}sizeOfBlackWhiteBlackRun(e,t,n,i){const s=Math.abs(i-t)>Math.abs(n-e);if(s){let L=e;e=t,t=L,L=n,n=i,i=L}const o=Math.abs(n-e),l=Math.abs(i-t);let u=-o/2;const h=e<n?1:-1,p=t<i?1:-1;let A=0;const b=n+h;for(let L=e,E=t;L!==b;L+=h){const M=s?E:L,D=s?L:E;if(A===1===this.image.get(M,D)){if(A===2)return Ke.distance(L,E,e,t);A++}if(u+=l,u>0){if(E===i)break;E+=p,u-=o}}return A===2?Ke.distance(n+h,i,e,t):NaN}findAlignmentInRegion(e,t,n,i){const s=Math.floor(i*e),o=Math.max(0,t-s),l=Math.min(this.image.getWidth()-1,t+s);if(l-o<e*3)throw new v("Alignment top exceeds estimated module size.");const u=Math.max(0,n-s),h=Math.min(this.image.getHeight()-1,n+s);if(h-u<e*3)throw new v("Alignment bottom exceeds estimated module size.");return new ts(this.image,o,u,l-o,h-u,e,this.resultPointCallback).find()}}class Ur{constructor(){this.decoder=new Zs}getDecoder(){return this.decoder}decode(e,t){let n,i;if(t!=null&&t.get(Be.PURE_BARCODE)!==void 0){const u=Ur.extractPureBits(e.getBlackMatrix());n=this.decoder.decodeBitMatrix(u,t),i=Ur.NO_POINTS}else{const u=new Di(e.getBlackMatrix()).detect(t);n=this.decoder.decodeBitMatrix(u.getBits(),t),i=u.getPoints()}n.getOther()instanceof ps&&n.getOther().applyMirroredCorrection(i);const s=new Ft(n.getText(),n.getRawBytes(),void 0,i,me.QR_CODE,void 0),o=n.getByteSegments();o!==null&&s.putMetadata(gt.BYTE_SEGMENTS,o);const l=n.getECLevel();return l!==null&&s.putMetadata(gt.ERROR_CORRECTION_LEVEL,l),n.hasStructuredAppend()&&(s.putMetadata(gt.STRUCTURED_APPEND_SEQUENCE,n.getStructuredAppendSequenceNumber()),s.putMetadata(gt.STRUCTURED_APPEND_PARITY,n.getStructuredAppendParity())),s}reset(){}static extractPureBits(e){const t=e.getTopLeftOnBit(),n=e.getBottomRightOnBit();if(t===null||n===null)throw new v;const i=this.moduleSize(t,e);let s=t[1],o=n[1],l=t[0],u=n[0];if(l>=u||s>=o)throw new v;if(o-s!==u-l&&(u=l+(o-s),u>=e.getWidth()))throw new v;const h=Math.round((u-l+1)/i),p=Math.round((o-s+1)/i);if(h<=0||p<=0)throw new v;if(p!==h)throw new v;const A=Math.floor(i/2);s+=A,l+=A;const b=l+Math.floor((h-1)*i)-u;if(b>0){if(b>A)throw new v;l-=b}const L=s+Math.floor((p-1)*i)-o;if(L>0){if(L>A)throw new v;s-=L}const E=new Mt(h,p);for(let M=0;M<p;M++){const D=s+Math.floor(M*i);for(let P=0;P<h;P++)e.get(l+Math.floor(P*i),D)&&E.set(P,M)}return E}static moduleSize(e,t){const n=t.getHeight(),i=t.getWidth();let s=e[0],o=e[1],l=!0,u=0;for(;s<i&&o<n;){if(l!==t.get(s,o)){if(++u===5)break;l=!l}s++,o++}if(s===i||o===n)throw new v;return(s-e[0])/7}}Ur.NO_POINTS=new Array;class Ne{PDF417Common(){}static getBitCountSum(e){return Ke.sum(e)}static toIntArray(e){if(e==null||!e.length)return Ne.EMPTY_INT_ARRAY;const t=new Int32Array(e.length);let n=0;for(const i of e)t[n++]=i;return t}static getCodeword(e){const t=Ye.binarySearch(Ne.SYMBOL_TABLE,e&262143);return t<0?-1:(Ne.CODEWORD_TABLE[t]-1)%Ne.NUMBER_OF_CODEWORDS}}Ne.NUMBER_OF_CODEWORDS=929,Ne.MAX_CODEWORDS_IN_BARCODE=Ne.NUMBER_OF_CODEWORDS-1,Ne.MIN_ROWS_IN_BARCODE=3,Ne.MAX_ROWS_IN_BARCODE=90,Ne.MODULES_IN_CODEWORD=17,Ne.MODULES_IN_STOP_PATTERN=18,Ne.BARS_IN_MODULE=8,Ne.EMPTY_INT_ARRAY=new Int32Array([]),Ne.SYMBOL_TABLE=Int32Array.from([66142,66170,66206,66236,66290,66292,66350,66382,66396,66454,66470,66476,66594,66600,66614,66626,66628,66632,66640,66654,66662,66668,66682,66690,66718,66720,66748,66758,66776,66798,66802,66804,66820,66824,66832,66846,66848,66876,66880,66936,66950,66956,66968,66992,67006,67022,67036,67042,67044,67048,67062,67118,67150,67164,67214,67228,67256,67294,67322,67350,67366,67372,67398,67404,67416,67438,67474,67476,67490,67492,67496,67510,67618,67624,67650,67656,67664,67678,67686,67692,67706,67714,67716,67728,67742,67744,67772,67782,67788,67800,67822,67826,67828,67842,67848,67870,67872,67900,67904,67960,67974,67992,68016,68030,68046,68060,68066,68068,68072,68086,68104,68112,68126,68128,68156,68160,68216,68336,68358,68364,68376,68400,68414,68448,68476,68494,68508,68536,68546,68548,68552,68560,68574,68582,68588,68654,68686,68700,68706,68708,68712,68726,68750,68764,68792,68802,68804,68808,68816,68830,68838,68844,68858,68878,68892,68920,68976,68990,68994,68996,69e3,69008,69022,69024,69052,69062,69068,69080,69102,69106,69108,69142,69158,69164,69190,69208,69230,69254,69260,69272,69296,69310,69326,69340,69386,69394,69396,69410,69416,69430,69442,69444,69448,69456,69470,69478,69484,69554,69556,69666,69672,69698,69704,69712,69726,69754,69762,69764,69776,69790,69792,69820,69830,69836,69848,69870,69874,69876,69890,69918,69920,69948,69952,70008,70022,70040,70064,70078,70094,70108,70114,70116,70120,70134,70152,70174,70176,70264,70384,70412,70448,70462,70496,70524,70542,70556,70584,70594,70600,70608,70622,70630,70636,70664,70672,70686,70688,70716,70720,70776,70896,71136,71180,71192,71216,71230,71264,71292,71360,71416,71452,71480,71536,71550,71554,71556,71560,71568,71582,71584,71612,71622,71628,71640,71662,71726,71732,71758,71772,71778,71780,71784,71798,71822,71836,71864,71874,71880,71888,71902,71910,71916,71930,71950,71964,71992,72048,72062,72066,72068,72080,72094,72096,72124,72134,72140,72152,72174,72178,72180,72206,72220,72248,72304,72318,72416,72444,72456,72464,72478,72480,72508,72512,72568,72588,72600,72624,72638,72654,72668,72674,72676,72680,72694,72726,72742,72748,72774,72780,72792,72814,72838,72856,72880,72894,72910,72924,72930,72932,72936,72950,72966,72972,72984,73008,73022,73056,73084,73102,73116,73144,73156,73160,73168,73182,73190,73196,73210,73226,73234,73236,73250,73252,73256,73270,73282,73284,73296,73310,73318,73324,73346,73348,73352,73360,73374,73376,73404,73414,73420,73432,73454,73498,73518,73522,73524,73550,73564,73570,73572,73576,73590,73800,73822,73858,73860,73872,73886,73888,73916,73944,73970,73972,73992,74014,74016,74044,74048,74104,74118,74136,74160,74174,74210,74212,74216,74230,74244,74256,74270,74272,74360,74480,74502,74508,74544,74558,74592,74620,74638,74652,74680,74690,74696,74704,74726,74732,74782,74784,74812,74992,75232,75288,75326,75360,75388,75456,75512,75576,75632,75646,75650,75652,75664,75678,75680,75708,75718,75724,75736,75758,75808,75836,75840,75896,76016,76256,76736,76824,76848,76862,76896,76924,76992,77048,77296,77340,77368,77424,77438,77536,77564,77572,77576,77584,77600,77628,77632,77688,77702,77708,77720,77744,77758,77774,77788,77870,77902,77916,77922,77928,77966,77980,78008,78018,78024,78032,78046,78060,78074,78094,78136,78192,78206,78210,78212,78224,78238,78240,78268,78278,78284,78296,78322,78324,78350,78364,78448,78462,78560,78588,78600,78622,78624,78652,78656,78712,78726,78744,78768,78782,78798,78812,78818,78820,78824,78838,78862,78876,78904,78960,78974,79072,79100,79296,79352,79368,79376,79390,79392,79420,79424,79480,79600,79628,79640,79664,79678,79712,79740,79772,79800,79810,79812,79816,79824,79838,79846,79852,79894,79910,79916,79942,79948,79960,79982,79988,80006,80024,80048,80062,80078,80092,80098,80100,80104,80134,80140,80176,80190,80224,80252,80270,80284,80312,80328,80336,80350,80358,80364,80378,80390,80396,80408,80432,80446,80480,80508,80576,80632,80654,80668,80696,80752,80766,80776,80784,80798,80800,80828,80844,80856,80878,80882,80884,80914,80916,80930,80932,80936,80950,80962,80968,80976,80990,80998,81004,81026,81028,81040,81054,81056,81084,81094,81100,81112,81134,81154,81156,81160,81168,81182,81184,81212,81216,81272,81286,81292,81304,81328,81342,81358,81372,81380,81384,81398,81434,81454,81458,81460,81486,81500,81506,81508,81512,81526,81550,81564,81592,81602,81604,81608,81616,81630,81638,81644,81702,81708,81722,81734,81740,81752,81774,81778,81780,82050,82078,82080,82108,82180,82184,82192,82206,82208,82236,82240,82296,82316,82328,82352,82366,82402,82404,82408,82440,82448,82462,82464,82492,82496,82552,82672,82694,82700,82712,82736,82750,82784,82812,82830,82882,82884,82888,82896,82918,82924,82952,82960,82974,82976,83004,83008,83064,83184,83424,83468,83480,83504,83518,83552,83580,83648,83704,83740,83768,83824,83838,83842,83844,83848,83856,83872,83900,83910,83916,83928,83950,83984,84e3,84028,84032,84088,84208,84448,84928,85040,85054,85088,85116,85184,85240,85488,85560,85616,85630,85728,85756,85764,85768,85776,85790,85792,85820,85824,85880,85894,85900,85912,85936,85966,85980,86048,86080,86136,86256,86496,86976,88160,88188,88256,88312,88560,89056,89200,89214,89312,89340,89536,89592,89608,89616,89632,89664,89720,89840,89868,89880,89904,89952,89980,89998,90012,90040,90190,90204,90254,90268,90296,90306,90308,90312,90334,90382,90396,90424,90480,90494,90500,90504,90512,90526,90528,90556,90566,90572,90584,90610,90612,90638,90652,90680,90736,90750,90848,90876,90884,90888,90896,90910,90912,90940,90944,91e3,91014,91020,91032,91056,91070,91086,91100,91106,91108,91112,91126,91150,91164,91192,91248,91262,91360,91388,91584,91640,91664,91678,91680,91708,91712,91768,91888,91928,91952,91966,92e3,92028,92046,92060,92088,92098,92100,92104,92112,92126,92134,92140,92188,92216,92272,92384,92412,92608,92664,93168,93200,93214,93216,93244,93248,93304,93424,93664,93720,93744,93758,93792,93820,93888,93944,93980,94008,94064,94078,94084,94088,94096,94110,94112,94140,94150,94156,94168,94246,94252,94278,94284,94296,94318,94342,94348,94360,94384,94398,94414,94428,94440,94470,94476,94488,94512,94526,94560,94588,94606,94620,94648,94658,94660,94664,94672,94686,94694,94700,94714,94726,94732,94744,94768,94782,94816,94844,94912,94968,94990,95004,95032,95088,95102,95112,95120,95134,95136,95164,95180,95192,95214,95218,95220,95244,95256,95280,95294,95328,95356,95424,95480,95728,95758,95772,95800,95856,95870,95968,95996,96008,96016,96030,96032,96060,96064,96120,96152,96176,96190,96220,96226,96228,96232,96290,96292,96296,96310,96322,96324,96328,96336,96350,96358,96364,96386,96388,96392,96400,96414,96416,96444,96454,96460,96472,96494,96498,96500,96514,96516,96520,96528,96542,96544,96572,96576,96632,96646,96652,96664,96688,96702,96718,96732,96738,96740,96744,96758,96772,96776,96784,96798,96800,96828,96832,96888,97008,97030,97036,97048,97072,97086,97120,97148,97166,97180,97208,97220,97224,97232,97246,97254,97260,97326,97330,97332,97358,97372,97378,97380,97384,97398,97422,97436,97464,97474,97476,97480,97488,97502,97510,97516,97550,97564,97592,97648,97666,97668,97672,97680,97694,97696,97724,97734,97740,97752,97774,97830,97836,97850,97862,97868,97880,97902,97906,97908,97926,97932,97944,97968,97998,98012,98018,98020,98024,98038,98618,98674,98676,98838,98854,98874,98892,98904,98926,98930,98932,98968,99006,99042,99044,99048,99062,99166,99194,99246,99286,99350,99366,99372,99386,99398,99416,99438,99442,99444,99462,99504,99518,99534,99548,99554,99556,99560,99574,99590,99596,99608,99632,99646,99680,99708,99726,99740,99768,99778,99780,99784,99792,99806,99814,99820,99834,99858,99860,99874,99880,99894,99906,99920,99934,99962,99970,99972,99976,99984,99998,1e5,100028,100038,100044,100056,100078,100082,100084,100142,100174,100188,100246,100262,100268,100306,100308,100390,100396,100410,100422,100428,100440,100462,100466,100468,100486,100504,100528,100542,100558,100572,100578,100580,100584,100598,100620,100656,100670,100704,100732,100750,100792,100802,100808,100816,100830,100838,100844,100858,100888,100912,100926,100960,100988,101056,101112,101148,101176,101232,101246,101250,101252,101256,101264,101278,101280,101308,101318,101324,101336,101358,101362,101364,101410,101412,101416,101430,101442,101448,101456,101470,101478,101498,101506,101508,101520,101534,101536,101564,101580,101618,101620,101636,101640,101648,101662,101664,101692,101696,101752,101766,101784,101838,101858,101860,101864,101934,101938,101940,101966,101980,101986,101988,101992,102030,102044,102072,102082,102084,102088,102096,102138,102166,102182,102188,102214,102220,102232,102254,102282,102290,102292,102306,102308,102312,102326,102444,102458,102470,102476,102488,102514,102516,102534,102552,102576,102590,102606,102620,102626,102632,102646,102662,102668,102704,102718,102752,102780,102798,102812,102840,102850,102856,102864,102878,102886,102892,102906,102936,102974,103008,103036,103104,103160,103224,103280,103294,103298,103300,103312,103326,103328,103356,103366,103372,103384,103406,103410,103412,103472,103486,103520,103548,103616,103672,103920,103992,104048,104062,104160,104188,104194,104196,104200,104208,104224,104252,104256,104312,104326,104332,104344,104368,104382,104398,104412,104418,104420,104424,104482,104484,104514,104520,104528,104542,104550,104570,104578,104580,104592,104606,104608,104636,104652,104690,104692,104706,104712,104734,104736,104764,104768,104824,104838,104856,104910,104930,104932,104936,104968,104976,104990,104992,105020,105024,105080,105200,105240,105278,105312,105372,105410,105412,105416,105424,105446,105518,105524,105550,105564,105570,105572,105576,105614,105628,105656,105666,105672,105680,105702,105722,105742,105756,105784,105840,105854,105858,105860,105864,105872,105888,105932,105970,105972,106006,106022,106028,106054,106060,106072,106100,106118,106124,106136,106160,106174,106190,106210,106212,106216,106250,106258,106260,106274,106276,106280,106306,106308,106312,106320,106334,106348,106394,106414,106418,106420,106566,106572,106610,106612,106630,106636,106648,106672,106686,106722,106724,106728,106742,106758,106764,106776,106800,106814,106848,106876,106894,106908,106936,106946,106948,106952,106960,106974,106982,106988,107032,107056,107070,107104,107132,107200,107256,107292,107320,107376,107390,107394,107396,107400,107408,107422,107424,107452,107462,107468,107480,107502,107506,107508,107544,107568,107582,107616,107644,107712,107768,108016,108060,108088,108144,108158,108256,108284,108290,108292,108296,108304,108318,108320,108348,108352,108408,108422,108428,108440,108464,108478,108494,108508,108514,108516,108520,108592,108640,108668,108736,108792,109040,109536,109680,109694,109792,109820,110016,110072,110084,110088,110096,110112,110140,110144,110200,110320,110342,110348,110360,110384,110398,110432,110460,110478,110492,110520,110532,110536,110544,110558,110658,110686,110714,110722,110724,110728,110736,110750,110752,110780,110796,110834,110836,110850,110852,110856,110864,110878,110880,110908,110912,110968,110982,111e3,111054,111074,111076,111080,111108,111112,111120,111134,111136,111164,111168,111224,111344,111372,111422,111456,111516,111554,111556,111560,111568,111590,111632,111646,111648,111676,111680,111736,111856,112096,112152,112224,112252,112320,112440,112514,112516,112520,112528,112542,112544,112588,112686,112718,112732,112782,112796,112824,112834,112836,112840,112848,112870,112890,112910,112924,112952,113008,113022,113026,113028,113032,113040,113054,113056,113100,113138,113140,113166,113180,113208,113264,113278,113376,113404,113416,113424,113440,113468,113472,113560,113614,113634,113636,113640,113686,113702,113708,113734,113740,113752,113778,113780,113798,113804,113816,113840,113854,113870,113890,113892,113896,113926,113932,113944,113968,113982,114016,114044,114076,114114,114116,114120,114128,114150,114170,114194,114196,114210,114212,114216,114242,114244,114248,114256,114270,114278,114306,114308,114312,114320,114334,114336,114364,114380,114420,114458,114478,114482,114484,114510,114524,114530,114532,114536,114842,114866,114868,114970,114994,114996,115042,115044,115048,115062,115130,115226,115250,115252,115278,115292,115298,115300,115304,115318,115342,115394,115396,115400,115408,115422,115430,115436,115450,115478,115494,115514,115526,115532,115570,115572,115738,115758,115762,115764,115790,115804,115810,115812,115816,115830,115854,115868,115896,115906,115912,115920,115934,115942,115948,115962,115996,116024,116080,116094,116098,116100,116104,116112,116126,116128,116156,116166,116172,116184,116206,116210,116212,116246,116262,116268,116282,116294,116300,116312,116334,116338,116340,116358,116364,116376,116400,116414,116430,116444,116450,116452,116456,116498,116500,116514,116520,116534,116546,116548,116552,116560,116574,116582,116588,116602,116654,116694,116714,116762,116782,116786,116788,116814,116828,116834,116836,116840,116854,116878,116892,116920,116930,116936,116944,116958,116966,116972,116986,117006,117048,117104,117118,117122,117124,117136,117150,117152,117180,117190,117196,117208,117230,117234,117236,117304,117360,117374,117472,117500,117506,117508,117512,117520,117536,117564,117568,117624,117638,117644,117656,117680,117694,117710,117724,117730,117732,117736,117750,117782,117798,117804,117818,117830,117848,117874,117876,117894,117936,117950,117966,117986,117988,117992,118022,118028,118040,118064,118078,118112,118140,118172,118210,118212,118216,118224,118238,118246,118266,118306,118312,118338,118352,118366,118374,118394,118402,118404,118408,118416,118430,118432,118460,118476,118514,118516,118574,118578,118580,118606,118620,118626,118628,118632,118678,118694,118700,118730,118738,118740,118830,118834,118836,118862,118876,118882,118884,118888,118902,118926,118940,118968,118978,118980,118984,118992,119006,119014,119020,119034,119068,119096,119152,119166,119170,119172,119176,119184,119198,119200,119228,119238,119244,119256,119278,119282,119284,119324,119352,119408,119422,119520,119548,119554,119556,119560,119568,119582,119584,119612,119616,119672,119686,119692,119704,119728,119742,119758,119772,119778,119780,119784,119798,119920,119934,120032,120060,120256,120312,120324,120328,120336,120352,120384,120440,120560,120582,120588,120600,120624,120638,120672,120700,120718,120732,120760,120770,120772,120776,120784,120798,120806,120812,120870,120876,120890,120902,120908,120920,120946,120948,120966,120972,120984,121008,121022,121038,121058,121060,121064,121078,121100,121112,121136,121150,121184,121212,121244,121282,121284,121288,121296,121318,121338,121356,121368,121392,121406,121440,121468,121536,121592,121656,121730,121732,121736,121744,121758,121760,121804,121842,121844,121890,121922,121924,121928,121936,121950,121958,121978,121986,121988,121992,122e3,122014,122016,122044,122060,122098,122100,122116,122120,122128,122142,122144,122172,122176,122232,122246,122264,122318,122338,122340,122344,122414,122418,122420,122446,122460,122466,122468,122472,122510,122524,122552,122562,122564,122568,122576,122598,122618,122646,122662,122668,122694,122700,122712,122738,122740,122762,122770,122772,122786,122788,122792,123018,123026,123028,123042,123044,123048,123062,123098,123146,123154,123156,123170,123172,123176,123190,123202,123204,123208,123216,123238,123244,123258,123290,123314,123316,123402,123410,123412,123426,123428,123432,123446,123458,123464,123472,123486,123494,123500,123514,123522,123524,123528,123536,123552,123580,123590,123596,123608,123630,123634,123636,123674,123698,123700,123740,123746,123748,123752,123834,123914,123922,123924,123938,123944,123958,123970,123976,123984,123998,124006,124012,124026,124034,124036,124048,124062,124064,124092,124102,124108,124120,124142,124146,124148,124162,124164,124168,124176,124190,124192,124220,124224,124280,124294,124300,124312,124336,124350,124366,124380,124386,124388,124392,124406,124442,124462,124466,124468,124494,124508,124514,124520,124558,124572,124600,124610,124612,124616,124624,124646,124666,124694,124710,124716,124730,124742,124748,124760,124786,124788,124818,124820,124834,124836,124840,124854,124946,124948,124962,124964,124968,124982,124994,124996,125e3,125008,125022,125030,125036,125050,125058,125060,125064,125072,125086,125088,125116,125126,125132,125144,125166,125170,125172,125186,125188,125192,125200,125216,125244,125248,125304,125318,125324,125336,125360,125374,125390,125404,125410,125412,125416,125430,125444,125448,125456,125472,125504,125560,125680,125702,125708,125720,125744,125758,125792,125820,125838,125852,125880,125890,125892,125896,125904,125918,125926,125932,125978,125998,126002,126004,126030,126044,126050,126052,126056,126094,126108,126136,126146,126148,126152,126160,126182,126202,126222,126236,126264,126320,126334,126338,126340,126344,126352,126366,126368,126412,126450,126452,126486,126502,126508,126522,126534,126540,126552,126574,126578,126580,126598,126604,126616,126640,126654,126670,126684,126690,126692,126696,126738,126754,126756,126760,126774,126786,126788,126792,126800,126814,126822,126828,126842,126894,126898,126900,126934,127126,127142,127148,127162,127178,127186,127188,127254,127270,127276,127290,127302,127308,127320,127342,127346,127348,127370,127378,127380,127394,127396,127400,127450,127510,127526,127532,127546,127558,127576,127598,127602,127604,127622,127628,127640,127664,127678,127694,127708,127714,127716,127720,127734,127754,127762,127764,127778,127784,127810,127812,127816,127824,127838,127846,127866,127898,127918,127922,127924,128022,128038,128044,128058,128070,128076,128088,128110,128114,128116,128134,128140,128152,128176,128190,128206,128220,128226,128228,128232,128246,128262,128268,128280,128304,128318,128352,128380,128398,128412,128440,128450,128452,128456,128464,128478,128486,128492,128506,128522,128530,128532,128546,128548,128552,128566,128578,128580,128584,128592,128606,128614,128634,128642,128644,128648,128656,128670,128672,128700,128716,128754,128756,128794,128814,128818,128820,128846,128860,128866,128868,128872,128886,128918,128934,128940,128954,128978,128980,129178,129198,129202,129204,129238,129258,129306,129326,129330,129332,129358,129372,129378,129380,129384,129398,129430,129446,129452,129466,129482,129490,129492,129562,129582,129586,129588,129614,129628,129634,129636,129640,129654,129678,129692,129720,129730,129732,129736,129744,129758,129766,129772,129814,129830,129836,129850,129862,129868,129880,129902,129906,129908,129930,129938,129940,129954,129956,129960,129974,130010]),Ne.CODEWORD_TABLE=Int32Array.from([2627,1819,2622,2621,1813,1812,2729,2724,2723,2779,2774,2773,902,896,908,868,865,861,859,2511,873,871,1780,835,2493,825,2491,842,837,844,1764,1762,811,810,809,2483,807,2482,806,2480,815,814,813,812,2484,817,816,1745,1744,1742,1746,2655,2637,2635,2626,2625,2623,2628,1820,2752,2739,2737,2728,2727,2725,2730,2785,2783,2778,2777,2775,2780,787,781,747,739,736,2413,754,752,1719,692,689,681,2371,678,2369,700,697,694,703,1688,1686,642,638,2343,631,2341,627,2338,651,646,643,2345,654,652,1652,1650,1647,1654,601,599,2322,596,2321,594,2319,2317,611,610,608,606,2324,603,2323,615,614,612,1617,1616,1614,1612,616,1619,1618,2575,2538,2536,905,901,898,909,2509,2507,2504,870,867,864,860,2512,875,872,1781,2490,2489,2487,2485,1748,836,834,832,830,2494,827,2492,843,841,839,845,1765,1763,2701,2676,2674,2653,2648,2656,2634,2633,2631,2629,1821,2638,2636,2770,2763,2761,2750,2745,2753,2736,2735,2733,2731,1848,2740,2738,2786,2784,591,588,576,569,566,2296,1590,537,534,526,2276,522,2274,545,542,539,548,1572,1570,481,2245,466,2242,462,2239,492,485,482,2249,496,494,1534,1531,1528,1538,413,2196,406,2191,2188,425,419,2202,415,2199,432,430,427,1472,1467,1464,433,1476,1474,368,367,2160,365,2159,362,2157,2155,2152,378,377,375,2166,372,2165,369,2162,383,381,379,2168,1419,1418,1416,1414,385,1411,384,1423,1422,1420,1424,2461,802,2441,2439,790,786,783,794,2409,2406,2403,750,742,738,2414,756,753,1720,2367,2365,2362,2359,1663,693,691,684,2373,680,2370,702,699,696,704,1690,1687,2337,2336,2334,2332,1624,2329,1622,640,637,2344,634,2342,630,2340,650,648,645,2346,655,653,1653,1651,1649,1655,2612,2597,2595,2571,2568,2565,2576,2534,2529,2526,1787,2540,2537,907,904,900,910,2503,2502,2500,2498,1768,2495,1767,2510,2508,2506,869,866,863,2513,876,874,1782,2720,2713,2711,2697,2694,2691,2702,2672,2670,2664,1828,2678,2675,2647,2646,2644,2642,1823,2639,1822,2654,2652,2650,2657,2771,1855,2765,2762,1850,1849,2751,2749,2747,2754,353,2148,344,342,336,2142,332,2140,345,1375,1373,306,2130,299,2128,295,2125,319,314,311,2132,1354,1352,1349,1356,262,257,2101,253,2096,2093,274,273,267,2107,263,2104,280,278,275,1316,1311,1308,1320,1318,2052,202,2050,2044,2040,219,2063,212,2060,208,2055,224,221,2066,1260,1258,1252,231,1248,229,1266,1264,1261,1268,155,1998,153,1996,1994,1991,1988,165,164,2007,162,2006,159,2003,2e3,172,171,169,2012,166,2010,1186,1184,1182,1179,175,1176,173,1192,1191,1189,1187,176,1194,1193,2313,2307,2305,592,589,2294,2292,2289,578,572,568,2297,580,1591,2272,2267,2264,1547,538,536,529,2278,525,2275,547,544,541,1574,1571,2237,2235,2229,1493,2225,1489,478,2247,470,2244,465,2241,493,488,484,2250,498,495,1536,1533,1530,1539,2187,2186,2184,2182,1432,2179,1430,2176,1427,414,412,2197,409,2195,405,2193,2190,426,424,421,2203,418,2201,431,429,1473,1471,1469,1466,434,1477,1475,2478,2472,2470,2459,2457,2454,2462,803,2437,2432,2429,1726,2443,2440,792,789,785,2401,2399,2393,1702,2389,1699,2411,2408,2405,745,741,2415,758,755,1721,2358,2357,2355,2353,1661,2350,1660,2347,1657,2368,2366,2364,2361,1666,690,687,2374,683,2372,701,698,705,1691,1689,2619,2617,2610,2608,2605,2613,2593,2588,2585,1803,2599,2596,2563,2561,2555,1797,2551,1795,2573,2570,2567,2577,2525,2524,2522,2520,1786,2517,1785,2514,1783,2535,2533,2531,2528,1788,2541,2539,906,903,911,2721,1844,2715,2712,1838,1836,2699,2696,2693,2703,1827,1826,1824,2673,2671,2669,2666,1829,2679,2677,1858,1857,2772,1854,1853,1851,1856,2766,2764,143,1987,139,1986,135,133,131,1984,128,1983,125,1981,138,137,136,1985,1133,1132,1130,112,110,1974,107,1973,104,1971,1969,122,121,119,117,1977,114,1976,124,1115,1114,1112,1110,1117,1116,84,83,1953,81,1952,78,1950,1948,1945,94,93,91,1959,88,1958,85,1955,99,97,95,1961,1086,1085,1083,1081,1078,100,1090,1089,1087,1091,49,47,1917,44,1915,1913,1910,1907,59,1926,56,1925,53,1922,1919,66,64,1931,61,1929,1042,1040,1038,71,1035,70,1032,68,1048,1047,1045,1043,1050,1049,12,10,1869,1867,1864,1861,21,1880,19,1877,1874,1871,28,1888,25,1886,22,1883,982,980,977,974,32,30,991,989,987,984,34,995,994,992,2151,2150,2147,2146,2144,356,355,354,2149,2139,2138,2136,2134,1359,343,341,338,2143,335,2141,348,347,346,1376,1374,2124,2123,2121,2119,1326,2116,1324,310,308,305,2131,302,2129,298,2127,320,318,316,313,2133,322,321,1355,1353,1351,1357,2092,2091,2089,2087,1276,2084,1274,2081,1271,259,2102,256,2100,252,2098,2095,272,269,2108,266,2106,281,279,277,1317,1315,1313,1310,282,1321,1319,2039,2037,2035,2032,1203,2029,1200,1197,207,2053,205,2051,201,2049,2046,2043,220,218,2064,215,2062,211,2059,228,226,223,2069,1259,1257,1254,232,1251,230,1267,1265,1263,2316,2315,2312,2311,2309,2314,2304,2303,2301,2299,1593,2308,2306,590,2288,2287,2285,2283,1578,2280,1577,2295,2293,2291,579,577,574,571,2298,582,581,1592,2263,2262,2260,2258,1545,2255,1544,2252,1541,2273,2271,2269,2266,1550,535,532,2279,528,2277,546,543,549,1575,1573,2224,2222,2220,1486,2217,1485,2214,1482,1479,2238,2236,2234,2231,1496,2228,1492,480,477,2248,473,2246,469,2243,490,487,2251,497,1537,1535,1532,2477,2476,2474,2479,2469,2468,2466,2464,1730,2473,2471,2453,2452,2450,2448,1729,2445,1728,2460,2458,2456,2463,805,804,2428,2427,2425,2423,1725,2420,1724,2417,1722,2438,2436,2434,2431,1727,2444,2442,793,791,788,795,2388,2386,2384,1697,2381,1696,2378,1694,1692,2402,2400,2398,2395,1703,2392,1701,2412,2410,2407,751,748,744,2416,759,757,1807,2620,2618,1806,1805,2611,2609,2607,2614,1802,1801,1799,2594,2592,2590,2587,1804,2600,2598,1794,1793,1791,1789,2564,2562,2560,2557,1798,2554,1796,2574,2572,2569,2578,1847,1846,2722,1843,1842,1840,1845,2716,2714,1835,1834,1832,1830,1839,1837,2700,2698,2695,2704,1817,1811,1810,897,862,1777,829,826,838,1760,1758,808,2481,1741,1740,1738,1743,2624,1818,2726,2776,782,740,737,1715,686,679,695,1682,1680,639,628,2339,647,644,1645,1643,1640,1648,602,600,597,595,2320,593,2318,609,607,604,1611,1610,1608,1606,613,1615,1613,2328,926,924,892,886,899,857,850,2505,1778,824,823,821,819,2488,818,2486,833,831,828,840,1761,1759,2649,2632,2630,2746,2734,2732,2782,2781,570,567,1587,531,527,523,540,1566,1564,476,467,463,2240,486,483,1524,1521,1518,1529,411,403,2192,399,2189,423,416,1462,1457,1454,428,1468,1465,2210,366,363,2158,360,2156,357,2153,376,373,370,2163,1410,1409,1407,1405,382,1402,380,1417,1415,1412,1421,2175,2174,777,774,771,784,732,725,722,2404,743,1716,676,674,668,2363,665,2360,685,1684,1681,626,624,622,2335,620,2333,617,2330,641,635,649,1646,1644,1642,2566,928,925,2530,2527,894,891,888,2501,2499,2496,858,856,854,851,1779,2692,2668,2665,2645,2643,2640,2651,2768,2759,2757,2744,2743,2741,2748,352,1382,340,337,333,1371,1369,307,300,296,2126,315,312,1347,1342,1350,261,258,250,2097,246,2094,271,268,264,1306,1301,1298,276,1312,1309,2115,203,2048,195,2045,191,2041,213,209,2056,1246,1244,1238,225,1234,222,1256,1253,1249,1262,2080,2079,154,1997,150,1995,147,1992,1989,163,160,2004,156,2001,1175,1174,1172,1170,1167,170,1164,167,1185,1183,1180,1177,174,1190,1188,2025,2024,2022,587,586,564,559,556,2290,573,1588,520,518,512,2268,508,2265,530,1568,1565,461,457,2233,450,2230,446,2226,479,471,489,1526,1523,1520,397,395,2185,392,2183,389,2180,2177,410,2194,402,422,1463,1461,1459,1456,1470,2455,799,2433,2430,779,776,773,2397,2394,2390,734,728,724,746,1717,2356,2354,2351,2348,1658,677,675,673,670,667,688,1685,1683,2606,2589,2586,2559,2556,2552,927,2523,2521,2518,2515,1784,2532,895,893,890,2718,2709,2707,2689,2687,2684,2663,2662,2660,2658,1825,2667,2769,1852,2760,2758,142,141,1139,1138,134,132,129,126,1982,1129,1128,1126,1131,113,111,108,105,1972,101,1970,120,118,115,1109,1108,1106,1104,123,1113,1111,82,79,1951,75,1949,72,1946,92,89,86,1956,1077,1076,1074,1072,98,1069,96,1084,1082,1079,1088,1968,1967,48,45,1916,42,1914,39,1911,1908,60,57,54,1923,50,1920,1031,1030,1028,1026,67,1023,65,1020,62,1041,1039,1036,1033,69,1046,1044,1944,1943,1941,11,9,1868,7,1865,1862,1859,20,1878,16,1875,13,1872,970,968,966,963,29,960,26,23,983,981,978,975,33,971,31,990,988,985,1906,1904,1902,993,351,2145,1383,331,330,328,326,2137,323,2135,339,1372,1370,294,293,291,289,2122,286,2120,283,2117,309,303,317,1348,1346,1344,245,244,242,2090,239,2088,236,2085,2082,260,2099,249,270,1307,1305,1303,1300,1314,189,2038,186,2036,183,2033,2030,2026,206,198,2047,194,216,1247,1245,1243,1240,227,1237,1255,2310,2302,2300,2286,2284,2281,565,563,561,558,575,1589,2261,2259,2256,2253,1542,521,519,517,514,2270,511,533,1569,1567,2223,2221,2218,2215,1483,2211,1480,459,456,453,2232,449,474,491,1527,1525,1522,2475,2467,2465,2451,2449,2446,801,800,2426,2424,2421,2418,1723,2435,780,778,775,2387,2385,2382,2379,1695,2375,1693,2396,735,733,730,727,749,1718,2616,2615,2604,2603,2601,2584,2583,2581,2579,1800,2591,2550,2549,2547,2545,1792,2542,1790,2558,929,2719,1841,2710,2708,1833,1831,2690,2688,2686,1815,1809,1808,1774,1756,1754,1737,1736,1734,1739,1816,1711,1676,1674,633,629,1638,1636,1633,1641,598,1605,1604,1602,1600,605,1609,1607,2327,887,853,1775,822,820,1757,1755,1584,524,1560,1558,468,464,1514,1511,1508,1519,408,404,400,1452,1447,1444,417,1458,1455,2208,364,361,358,2154,1401,1400,1398,1396,374,1393,371,1408,1406,1403,1413,2173,2172,772,726,723,1712,672,669,666,682,1678,1675,625,623,621,618,2331,636,632,1639,1637,1635,920,918,884,880,889,849,848,847,846,2497,855,852,1776,2641,2742,2787,1380,334,1367,1365,301,297,1340,1338,1335,1343,255,251,247,1296,1291,1288,265,1302,1299,2113,204,196,192,2042,1232,1230,1224,214,1220,210,1242,1239,1235,1250,2077,2075,151,148,1993,144,1990,1163,1162,1160,1158,1155,161,1152,157,1173,1171,1168,1165,168,1181,1178,2021,2020,2018,2023,585,560,557,1585,516,509,1562,1559,458,447,2227,472,1516,1513,1510,398,396,393,390,2181,386,2178,407,1453,1451,1449,1446,420,1460,2209,769,764,720,712,2391,729,1713,664,663,661,659,2352,656,2349,671,1679,1677,2553,922,919,2519,2516,885,883,881,2685,2661,2659,2767,2756,2755,140,1137,1136,130,127,1125,1124,1122,1127,109,106,102,1103,1102,1100,1098,116,1107,1105,1980,80,76,73,1947,1068,1067,1065,1063,90,1060,87,1075,1073,1070,1080,1966,1965,46,43,40,1912,36,1909,1019,1018,1016,1014,58,1011,55,1008,51,1029,1027,1024,1021,63,1037,1034,1940,1939,1937,1942,8,1866,4,1863,1,1860,956,954,952,949,946,17,14,969,967,964,961,27,957,24,979,976,972,1901,1900,1898,1896,986,1905,1903,350,349,1381,329,327,324,1368,1366,292,290,287,284,2118,304,1341,1339,1337,1345,243,240,237,2086,233,2083,254,1297,1295,1293,1290,1304,2114,190,187,184,2034,180,2031,177,2027,199,1233,1231,1229,1226,217,1223,1241,2078,2076,584,555,554,552,550,2282,562,1586,507,506,504,502,2257,499,2254,515,1563,1561,445,443,441,2219,438,2216,435,2212,460,454,475,1517,1515,1512,2447,798,797,2422,2419,770,768,766,2383,2380,2376,721,719,717,714,731,1714,2602,2582,2580,2548,2546,2543,923,921,2717,2706,2705,2683,2682,2680,1771,1752,1750,1733,1732,1731,1735,1814,1707,1670,1668,1631,1629,1626,1634,1599,1598,1596,1594,1603,1601,2326,1772,1753,1751,1581,1554,1552,1504,1501,1498,1509,1442,1437,1434,401,1448,1445,2206,1392,1391,1389,1387,1384,359,1399,1397,1394,1404,2171,2170,1708,1672,1669,619,1632,1630,1628,1773,1378,1363,1361,1333,1328,1336,1286,1281,1278,248,1292,1289,2111,1218,1216,1210,197,1206,193,1228,1225,1221,1236,2073,2071,1151,1150,1148,1146,152,1143,149,1140,145,1161,1159,1156,1153,158,1169,1166,2017,2016,2014,2019,1582,510,1556,1553,452,448,1506,1500,394,391,387,1443,1441,1439,1436,1450,2207,765,716,713,1709,662,660,657,1673,1671,916,914,879,878,877,882,1135,1134,1121,1120,1118,1123,1097,1096,1094,1092,103,1101,1099,1979,1059,1058,1056,1054,77,1051,74,1066,1064,1061,1071,1964,1963,1007,1006,1004,1002,999,41,996,37,1017,1015,1012,1009,52,1025,1022,1936,1935,1933,1938,942,940,938,935,932,5,2,955,953,950,947,18,943,15,965,962,958,1895,1894,1892,1890,973,1899,1897,1379,325,1364,1362,288,285,1334,1332,1330,241,238,234,1287,1285,1283,1280,1294,2112,188,185,181,178,2028,1219,1217,1215,1212,200,1209,1227,2074,2072,583,553,551,1583,505,503,500,513,1557,1555,444,442,439,436,2213,455,451,1507,1505,1502,796,763,762,760,767,711,710,708,706,2377,718,715,1710,2544,917,915,2681,1627,1597,1595,2325,1769,1749,1747,1499,1438,1435,2204,1390,1388,1385,1395,2169,2167,1704,1665,1662,1625,1623,1620,1770,1329,1282,1279,2109,1214,1207,1222,2068,2065,1149,1147,1144,1141,146,1157,1154,2013,2011,2008,2015,1579,1549,1546,1495,1487,1433,1431,1428,1425,388,1440,2205,1705,658,1667,1664,1119,1095,1093,1978,1057,1055,1052,1062,1962,1960,1005,1003,1e3,997,38,1013,1010,1932,1930,1927,1934,941,939,936,933,6,930,3,951,948,944,1889,1887,1884,1881,959,1893,1891,35,1377,1360,1358,1327,1325,1322,1331,1277,1275,1272,1269,235,1284,2110,1205,1204,1201,1198,182,1195,179,1213,2070,2067,1580,501,1551,1548,440,437,1497,1494,1490,1503,761,709,707,1706,913,912,2198,1386,2164,2161,1621,1766,2103,1208,2058,2054,1145,1142,2005,2002,1999,2009,1488,1429,1426,2200,1698,1659,1656,1975,1053,1957,1954,1001,998,1924,1921,1918,1928,937,934,931,1879,1876,1873,1870,945,1885,1882,1323,1273,1270,2105,1202,1199,1196,1211,2061,2057,1576,1543,1540,1484,1481,1478,1491,1700]);class Wa{constructor(e,t){this.bits=e,this.points=t}getBits(){return this.bits}getPoints(){return this.points}}class ke{static detectMultiple(e,t,n){let i=e.getBlackMatrix(),s=ke.detect(n,i);return s.length||(i=i.clone(),i.rotate180(),s=ke.detect(n,i)),new Wa(i,s)}static detect(e,t){const n=new Array;let i=0,s=0,o=!1;for(;i<t.getHeight();){const l=ke.findVertices(t,i,s);if(l[0]==null&&l[3]==null){if(!o)break;o=!1,s=0;for(const u of n)u[1]!=null&&(i=Math.trunc(Math.max(i,u[1].getY()))),u[3]!=null&&(i=Math.max(i,Math.trunc(u[3].getY())));i+=ke.ROW_STEP;continue}if(o=!0,n.push(l),!e)break;l[2]!=null?(s=Math.trunc(l[2].getX()),i=Math.trunc(l[2].getY())):(s=Math.trunc(l[4].getX()),i=Math.trunc(l[4].getY()))}return n}static findVertices(e,t,n){const i=e.getHeight(),s=e.getWidth(),o=new Array(8);return ke.copyToResult(o,ke.findRowsWithPattern(e,i,s,t,n,ke.START_PATTERN),ke.INDEXES_START_PATTERN),o[4]!=null&&(n=Math.trunc(o[4].getX()),t=Math.trunc(o[4].getY())),ke.copyToResult(o,ke.findRowsWithPattern(e,i,s,t,n,ke.STOP_PATTERN),ke.INDEXES_STOP_PATTERN),o}static copyToResult(e,t,n){for(let i=0;i<n.length;i++)e[n[i]]=t[i]}static findRowsWithPattern(e,t,n,i,s,o){const l=new Array(4);let u=!1;const h=new Int32Array(o.length);for(;i<t;i+=ke.ROW_STEP){let A=ke.findGuardPattern(e,s,i,n,!1,o,h);if(A!=null){for(;i>0;){const b=ke.findGuardPattern(e,s,--i,n,!1,o,h);if(b!=null)A=b;else{i++;break}}l[0]=new le(A[0],i),l[1]=new le(A[1],i),u=!0;break}}let p=i+1;if(u){let A=0,b=Int32Array.from([Math.trunc(l[0].getX()),Math.trunc(l[1].getX())]);for(;p<t;p++){const L=ke.findGuardPattern(e,b[0],p,n,!1,o,h);if(L!=null&&Math.abs(b[0]-L[0])<ke.MAX_PATTERN_DRIFT&&Math.abs(b[1]-L[1])<ke.MAX_PATTERN_DRIFT)b=L,A=0;else{if(A>ke.SKIPPED_ROW_COUNT_MAX)break;A++}}p-=A+1,l[2]=new le(b[0],p),l[3]=new le(b[1],p)}return p-i<ke.BARCODE_MIN_HEIGHT&&Ye.fill(l,null),l}static findGuardPattern(e,t,n,i,s,o,l){Ye.fillWithin(l,0,l.length,0);let u=t,h=0;for(;e.get(u,n)&&u>0&&h++<ke.MAX_PIXEL_DRIFT;)u--;let p=u,A=0,b=o.length;for(let L=s;p<i;p++)if(e.get(p,n)!==L)l[A]++;else{if(A===b-1){if(ke.patternMatchVariance(l,o,ke.MAX_INDIVIDUAL_VARIANCE)<ke.MAX_AVG_VARIANCE)return new Int32Array([u,p]);u+=l[0]+l[1],ge.arraycopy(l,2,l,0,A-1),l[A-1]=0,l[A]=0,A--}else A++;l[A]=1,L=!L}return A===b-1&&ke.patternMatchVariance(l,o,ke.MAX_INDIVIDUAL_VARIANCE)<ke.MAX_AVG_VARIANCE?new Int32Array([u,p-1]):null}static patternMatchVariance(e,t,n){let i=e.length,s=0,o=0;for(let h=0;h<i;h++)s+=e[h],o+=t[h];if(s<o)return 1/0;let l=s/o;n*=l;let u=0;for(let h=0;h<i;h++){let p=e[h],A=t[h]*l,b=p>A?p-A:A-p;if(b>n)return 1/0;u+=b}return u/s}}ke.INDEXES_START_PATTERN=Int32Array.from([0,4,1,5]),ke.INDEXES_STOP_PATTERN=Int32Array.from([6,2,7,3]),ke.MAX_AVG_VARIANCE=.42,ke.MAX_INDIVIDUAL_VARIANCE=.8,ke.START_PATTERN=Int32Array.from([8,1,1,1,1,1,1,3]),ke.STOP_PATTERN=Int32Array.from([7,1,1,3,1,1,1,2,1]),ke.MAX_PIXEL_DRIFT=3,ke.MAX_PATTERN_DRIFT=5,ke.SKIPPED_ROW_COUNT_MAX=25,ke.ROW_STEP=5,ke.BARCODE_MIN_HEIGHT=10;class sn{constructor(e,t){if(t.length===0)throw new H;this.field=e;let n=t.length;if(n>1&&t[0]===0){let i=1;for(;i<n&&t[i]===0;)i++;i===n?this.coefficients=new Int32Array([0]):(this.coefficients=new Int32Array(n-i),ge.arraycopy(t,i,this.coefficients,0,this.coefficients.length))}else this.coefficients=t}getCoefficients(){return this.coefficients}getDegree(){return this.coefficients.length-1}isZero(){return this.coefficients[0]===0}getCoefficient(e){return this.coefficients[this.coefficients.length-1-e]}evaluateAt(e){if(e===0)return this.getCoefficient(0);if(e===1){let i=0;for(let s of this.coefficients)i=this.field.add(i,s);return i}let t=this.coefficients[0],n=this.coefficients.length;for(let i=1;i<n;i++)t=this.field.add(this.field.multiply(e,t),this.coefficients[i]);return t}add(e){if(!this.field.equals(e.field))throw new H("ModulusPolys do not have same ModulusGF field");if(this.isZero())return e;if(e.isZero())return this;let t=this.coefficients,n=e.coefficients;if(t.length>n.length){let o=t;t=n,n=o}let i=new Int32Array(n.length),s=n.length-t.length;ge.arraycopy(n,0,i,0,s);for(let o=s;o<n.length;o++)i[o]=this.field.add(t[o-s],n[o]);return new sn(this.field,i)}subtract(e){if(!this.field.equals(e.field))throw new H("ModulusPolys do not have same ModulusGF field");return e.isZero()?this:this.add(e.negative())}multiply(e){return e instanceof sn?this.multiplyOther(e):this.multiplyScalar(e)}multiplyOther(e){if(!this.field.equals(e.field))throw new H("ModulusPolys do not have same ModulusGF field");if(this.isZero()||e.isZero())return new sn(this.field,new Int32Array([0]));let t=this.coefficients,n=t.length,i=e.coefficients,s=i.length,o=new Int32Array(n+s-1);for(let l=0;l<n;l++){let u=t[l];for(let h=0;h<s;h++)o[l+h]=this.field.add(o[l+h],this.field.multiply(u,i[h]))}return new sn(this.field,o)}negative(){let e=this.coefficients.length,t=new Int32Array(e);for(let n=0;n<e;n++)t[n]=this.field.subtract(0,this.coefficients[n]);return new sn(this.field,t)}multiplyScalar(e){if(e===0)return new sn(this.field,new Int32Array([0]));if(e===1)return this;let t=this.coefficients.length,n=new Int32Array(t);for(let i=0;i<t;i++)n[i]=this.field.multiply(this.coefficients[i],e);return new sn(this.field,n)}multiplyByMonomial(e,t){if(e<0)throw new H;if(t===0)return new sn(this.field,new Int32Array([0]));let n=this.coefficients.length,i=new Int32Array(n+e);for(let s=0;s<n;s++)i[s]=this.field.multiply(this.coefficients[s],t);return new sn(this.field,i)}toString(){let e=new rt;for(let t=this.getDegree();t>=0;t--){let n=this.getCoefficient(t);n!==0&&(n<0?(e.append(" - "),n=-n):e.length()>0&&e.append(" + "),(t===0||n!==1)&&e.append(n),t!==0&&(t===1?e.append("x"):(e.append("x^"),e.append(t))))}return e.toString()}}class Ga{add(e,t){return(e+t)%this.modulus}subtract(e,t){return(this.modulus+e-t)%this.modulus}exp(e){return this.expTable[e]}log(e){if(e===0)throw new H;return this.logTable[e]}inverse(e){if(e===0)throw new Ar;return this.expTable[this.modulus-this.logTable[e]-1]}multiply(e,t){return e===0||t===0?0:this.expTable[(this.logTable[e]+this.logTable[t])%(this.modulus-1)]}getSize(){return this.modulus}equals(e){return e===this}}class ws extends Ga{constructor(e,t){super(),this.modulus=e,this.expTable=new Int32Array(e),this.logTable=new Int32Array(e);let n=1;for(let i=0;i<e;i++)this.expTable[i]=n,n=n*t%e;for(let i=0;i<e-1;i++)this.logTable[this.expTable[i]]=i;this.zero=new sn(this,new Int32Array([0])),this.one=new sn(this,new Int32Array([1]))}getZero(){return this.zero}getOne(){return this.one}buildMonomial(e,t){if(e<0)throw new H;if(t===0)return this.zero;let n=new Int32Array(e+1);return n[0]=t,new sn(this,n)}}ws.PDF417_GF=new ws(Ne.NUMBER_OF_CODEWORDS,3);class Ks{constructor(){this.field=ws.PDF417_GF}decode(e,t,n){let i=new sn(this.field,e),s=new Int32Array(t),o=!1;for(let E=t;E>0;E--){let M=i.evaluateAt(this.field.exp(E));s[t-E]=M,M!==0&&(o=!0)}if(!o)return 0;let l=this.field.getOne();if(n!=null)for(const E of n){let M=this.field.exp(e.length-1-E),D=new sn(this.field,new Int32Array([this.field.subtract(0,M),1]));l=l.multiply(D)}let u=new sn(this.field,s),h=this.runEuclideanAlgorithm(this.field.buildMonomial(t,1),u,t),p=h[0],A=h[1],b=this.findErrorLocations(p),L=this.findErrorMagnitudes(A,p,b);for(let E=0;E<b.length;E++){let M=e.length-1-this.field.log(b[E]);if(M<0)throw Ee.getChecksumInstance();e[M]=this.field.subtract(e[M],L[E])}return b.length}runEuclideanAlgorithm(e,t,n){if(e.getDegree()<t.getDegree()){let b=e;e=t,t=b}let i=e,s=t,o=this.field.getZero(),l=this.field.getOne();for(;s.getDegree()>=Math.round(n/2);){let b=i,L=o;if(i=s,o=l,i.isZero())throw Ee.getChecksumInstance();s=b;let E=this.field.getZero(),M=i.getCoefficient(i.getDegree()),D=this.field.inverse(M);for(;s.getDegree()>=i.getDegree()&&!s.isZero();){let P=s.getDegree()-i.getDegree(),K=this.field.multiply(s.getCoefficient(s.getDegree()),D);E=E.add(this.field.buildMonomial(P,K)),s=s.subtract(i.multiplyByMonomial(P,K))}l=E.multiply(o).subtract(L).negative()}let u=l.getCoefficient(0);if(u===0)throw Ee.getChecksumInstance();let h=this.field.inverse(u),p=l.multiply(h),A=s.multiply(h);return[p,A]}findErrorLocations(e){let t=e.getDegree(),n=new Int32Array(t),i=0;for(let s=1;s<this.field.getSize()&&i<t;s++)e.evaluateAt(s)===0&&(n[i]=this.field.inverse(s),i++);if(i!==t)throw Ee.getChecksumInstance();return n}findErrorMagnitudes(e,t,n){let i=t.getDegree(),s=new Int32Array(i);for(let h=1;h<=i;h++)s[i-h]=this.field.multiply(h,t.getCoefficient(h));let o=new sn(this.field,s),l=n.length,u=new Int32Array(l);for(let h=0;h<l;h++){let p=this.field.inverse(n[h]),A=this.field.subtract(0,e.evaluateAt(p)),b=this.field.inverse(o.evaluateAt(p));u[h]=this.field.multiply(A,b)}return u}}class Kr{constructor(e,t,n,i,s){e instanceof Kr?this.constructor_2(e):this.constructor_1(e,t,n,i,s)}constructor_1(e,t,n,i,s){const o=t==null||n==null,l=i==null||s==null;if(o&&l)throw new v;o?(t=new le(0,i.getY()),n=new le(0,s.getY())):l&&(i=new le(e.getWidth()-1,t.getY()),s=new le(e.getWidth()-1,n.getY())),this.image=e,this.topLeft=t,this.bottomLeft=n,this.topRight=i,this.bottomRight=s,this.minX=Math.trunc(Math.min(t.getX(),n.getX())),this.maxX=Math.trunc(Math.max(i.getX(),s.getX())),this.minY=Math.trunc(Math.min(t.getY(),i.getY())),this.maxY=Math.trunc(Math.max(n.getY(),s.getY()))}constructor_2(e){this.image=e.image,this.topLeft=e.getTopLeft(),this.bottomLeft=e.getBottomLeft(),this.topRight=e.getTopRight(),this.bottomRight=e.getBottomRight(),this.minX=e.getMinX(),this.maxX=e.getMaxX(),this.minY=e.getMinY(),this.maxY=e.getMaxY()}static merge(e,t){return e==null?t:t==null?e:new Kr(e.image,e.topLeft,e.bottomLeft,t.topRight,t.bottomRight)}addMissingRows(e,t,n){let i=this.topLeft,s=this.bottomLeft,o=this.topRight,l=this.bottomRight;if(e>0){let u=n?this.topLeft:this.topRight,h=Math.trunc(u.getY()-e);h<0&&(h=0);let p=new le(u.getX(),h);n?i=p:o=p}if(t>0){let u=n?this.bottomLeft:this.bottomRight,h=Math.trunc(u.getY()+t);h>=this.image.getHeight()&&(h=this.image.getHeight()-1);let p=new le(u.getX(),h);n?s=p:l=p}return new Kr(this.image,i,s,o,l)}getMinX(){return this.minX}getMaxX(){return this.maxX}getMinY(){return this.minY}getMaxY(){return this.maxY}getTopLeft(){return this.topLeft}getTopRight(){return this.topRight}getBottomLeft(){return this.bottomLeft}getBottomRight(){return this.bottomRight}}class _t{constructor(e,t,n,i){this.columnCount=e,this.errorCorrectionLevel=i,this.rowCountUpperPart=t,this.rowCountLowerPart=n,this.rowCount=t+n}getColumnCount(){return this.columnCount}getErrorCorrectionLevel(){return this.errorCorrectionLevel}getRowCount(){return this.rowCount}getRowCountUpperPart(){return this.rowCountUpperPart}getRowCountLowerPart(){return this.rowCountLowerPart}}class ot{constructor(){this.buffer=""}static form(e,t){let n=-1;function i(o,l,u,h,p,A){if(o==="%%")return"%";if(t[++n]===void 0)return;o=h?parseInt(h.substr(1)):void 0;let b=p?parseInt(p.substr(1)):void 0,L;switch(A){case"s":L=t[n];break;case"c":L=t[n][0];break;case"f":L=parseFloat(t[n]).toFixed(o);break;case"p":L=parseFloat(t[n]).toPrecision(o);break;case"e":L=parseFloat(t[n]).toExponential(o);break;case"x":L=parseInt(t[n]).toString(b||16);break;case"d":L=parseFloat(parseInt(t[n],b||10).toPrecision(o)).toFixed(0);break}L=typeof L=="object"?JSON.stringify(L):(+L).toString(b);let E=parseInt(u),M=u&&u[0]+""=="0"?"0":" ";for(;L.length<E;)L=l!==void 0?L+M:M+L;return L}let s=/%(-)?(0?[0-9]+)?([.][0-9]+)?([#][0-9]+)?([scfpexd%])/g;return e.replace(s,i)}format(e,...t){this.buffer+=ot.form(e,t)}toString(){return this.buffer}}class Ri{constructor(e){this.boundingBox=new Kr(e),this.codewords=new Array(e.getMaxY()-e.getMinY()+1)}getCodewordNearby(e){let t=this.getCodeword(e);if(t!=null)return t;for(let n=1;n<Ri.MAX_NEARBY_DISTANCE;n++){let i=this.imageRowToCodewordIndex(e)-n;if(i>=0&&(t=this.codewords[i],t!=null)||(i=this.imageRowToCodewordIndex(e)+n,i<this.codewords.length&&(t=this.codewords[i],t!=null)))return t}return null}imageRowToCodewordIndex(e){return e-this.boundingBox.getMinY()}setCodeword(e,t){this.codewords[this.imageRowToCodewordIndex(e)]=t}getCodeword(e){return this.codewords[this.imageRowToCodewordIndex(e)]}getBoundingBox(){return this.boundingBox}getCodewords(){return this.codewords}toString(){const e=new ot;let t=0;for(const n of this.codewords){if(n==null){e.format("%3d:    |   %n",t++);continue}e.format("%3d: %3d|%3d%n",t++,n.getRowNumber(),n.getValue())}return e.toString()}}Ri.MAX_NEARBY_DISTANCE=5;class Li{constructor(){this.values=new Map}setValue(e){e=Math.trunc(e);let t=this.values.get(e);t==null&&(t=0),t++,this.values.set(e,t)}getValue(){let e=-1,t=new Array;for(const[n,i]of this.values.entries()){const s={getKey:()=>n,getValue:()=>i};s.getValue()>e?(e=s.getValue(),t=[],t.push(s.getKey())):s.getValue()===e&&t.push(s.getKey())}return Ne.toIntArray(t)}getConfidence(e){return this.values.get(e)}}class qs extends Ri{constructor(e,t){super(e),this._isLeft=t}setRowNumbers(){for(let e of this.getCodewords())e!=null&&e.setRowNumberAsRowIndicatorColumn()}adjustCompleteIndicatorColumnRowNumbers(e){let t=this.getCodewords();this.setRowNumbers(),this.removeIncorrectCodewords(t,e);let n=this.getBoundingBox(),i=this._isLeft?n.getTopLeft():n.getTopRight(),s=this._isLeft?n.getBottomLeft():n.getBottomRight(),o=this.imageRowToCodewordIndex(Math.trunc(i.getY())),l=this.imageRowToCodewordIndex(Math.trunc(s.getY())),u=-1,h=1,p=0;for(let A=o;A<l;A++){if(t[A]==null)continue;let b=t[A],L=b.getRowNumber()-u;if(L===0)p++;else if(L===1)h=Math.max(h,p),p=1,u=b.getRowNumber();else if(L<0||b.getRowNumber()>=e.getRowCount()||L>A)t[A]=null;else{let E;h>2?E=(h-2)*L:E=L;let M=E>=A;for(let D=1;D<=E&&!M;D++)M=t[A-D]!=null;M?t[A]=null:(u=b.getRowNumber(),p=1)}}}getRowHeights(){let e=this.getBarcodeMetadata();if(e==null)return null;this.adjustIncompleteIndicatorColumnRowNumbers(e);let t=new Int32Array(e.getRowCount());for(let n of this.getCodewords())if(n!=null){let i=n.getRowNumber();if(i>=t.length)continue;t[i]++}return t}adjustIncompleteIndicatorColumnRowNumbers(e){let t=this.getBoundingBox(),n=this._isLeft?t.getTopLeft():t.getTopRight(),i=this._isLeft?t.getBottomLeft():t.getBottomRight(),s=this.imageRowToCodewordIndex(Math.trunc(n.getY())),o=this.imageRowToCodewordIndex(Math.trunc(i.getY())),l=this.getCodewords(),u=-1;for(let h=s;h<o;h++){if(l[h]==null)continue;let p=l[h];p.setRowNumberAsRowIndicatorColumn();let A=p.getRowNumber()-u;A===0||(A===1?u=p.getRowNumber():p.getRowNumber()>=e.getRowCount()?l[h]=null:u=p.getRowNumber())}}getBarcodeMetadata(){let e=this.getCodewords(),t=new Li,n=new Li,i=new Li,s=new Li;for(let l of e){if(l==null)continue;l.setRowNumberAsRowIndicatorColumn();let u=l.getValue()%30,h=l.getRowNumber();switch(this._isLeft||(h+=2),h%3){case 0:n.setValue(u*3+1);break;case 1:s.setValue(u/3),i.setValue(u%3);break;case 2:t.setValue(u+1);break}}if(t.getValue().length===0||n.getValue().length===0||i.getValue().length===0||s.getValue().length===0||t.getValue()[0]<1||n.getValue()[0]+i.getValue()[0]<Ne.MIN_ROWS_IN_BARCODE||n.getValue()[0]+i.getValue()[0]>Ne.MAX_ROWS_IN_BARCODE)return null;let o=new _t(t.getValue()[0],n.getValue()[0],i.getValue()[0],s.getValue()[0]);return this.removeIncorrectCodewords(e,o),o}removeIncorrectCodewords(e,t){for(let n=0;n<e.length;n++){let i=e[n];if(e[n]==null)continue;let s=i.getValue()%30,o=i.getRowNumber();if(o>t.getRowCount()){e[n]=null;continue}switch(this._isLeft||(o+=2),o%3){case 0:s*3+1!==t.getRowCountUpperPart()&&(e[n]=null);break;case 1:(Math.trunc(s/3)!==t.getErrorCorrectionLevel()||s%3!==t.getRowCountLowerPart())&&(e[n]=null);break;case 2:s+1!==t.getColumnCount()&&(e[n]=null);break}}}isLeft(){return this._isLeft}toString(){return"IsLeft: "+this._isLeft+`
`+super.toString()}}class Bi{constructor(e,t){this.ADJUST_ROW_NUMBER_SKIP=2,this.barcodeMetadata=e,this.barcodeColumnCount=e.getColumnCount(),this.boundingBox=t,this.detectionResultColumns=new Array(this.barcodeColumnCount+2)}getDetectionResultColumns(){this.adjustIndicatorColumnRowNumbers(this.detectionResultColumns[0]),this.adjustIndicatorColumnRowNumbers(this.detectionResultColumns[this.barcodeColumnCount+1]);let e=Ne.MAX_CODEWORDS_IN_BARCODE,t;do t=e,e=this.adjustRowNumbersAndGetCount();while(e>0&&e<t);return this.detectionResultColumns}adjustIndicatorColumnRowNumbers(e){e!=null&&e.adjustCompleteIndicatorColumnRowNumbers(this.barcodeMetadata)}adjustRowNumbersAndGetCount(){let e=this.adjustRowNumbersByRow();if(e===0)return 0;for(let t=1;t<this.barcodeColumnCount+1;t++){let n=this.detectionResultColumns[t].getCodewords();for(let i=0;i<n.length;i++)n[i]!=null&&(n[i].hasValidRowNumber()||this.adjustRowNumbers(t,i,n))}return e}adjustRowNumbersByRow(){return this.adjustRowNumbersFromBothRI(),this.adjustRowNumbersFromLRI()+this.adjustRowNumbersFromRRI()}adjustRowNumbersFromBothRI(){if(this.detectionResultColumns[0]==null||this.detectionResultColumns[this.barcodeColumnCount+1]==null)return;let e=this.detectionResultColumns[0].getCodewords(),t=this.detectionResultColumns[this.barcodeColumnCount+1].getCodewords();for(let n=0;n<e.length;n++)if(e[n]!=null&&t[n]!=null&&e[n].getRowNumber()===t[n].getRowNumber())for(let i=1;i<=this.barcodeColumnCount;i++){let s=this.detectionResultColumns[i].getCodewords()[n];s!=null&&(s.setRowNumber(e[n].getRowNumber()),s.hasValidRowNumber()||(this.detectionResultColumns[i].getCodewords()[n]=null))}}adjustRowNumbersFromRRI(){if(this.detectionResultColumns[this.barcodeColumnCount+1]==null)return 0;let e=0,t=this.detectionResultColumns[this.barcodeColumnCount+1].getCodewords();for(let n=0;n<t.length;n++){if(t[n]==null)continue;let i=t[n].getRowNumber(),s=0;for(let o=this.barcodeColumnCount+1;o>0&&s<this.ADJUST_ROW_NUMBER_SKIP;o--){let l=this.detectionResultColumns[o].getCodewords()[n];l!=null&&(s=Bi.adjustRowNumberIfValid(i,s,l),l.hasValidRowNumber()||e++)}}return e}adjustRowNumbersFromLRI(){if(this.detectionResultColumns[0]==null)return 0;let e=0,t=this.detectionResultColumns[0].getCodewords();for(let n=0;n<t.length;n++){if(t[n]==null)continue;let i=t[n].getRowNumber(),s=0;for(let o=1;o<this.barcodeColumnCount+1&&s<this.ADJUST_ROW_NUMBER_SKIP;o++){let l=this.detectionResultColumns[o].getCodewords()[n];l!=null&&(s=Bi.adjustRowNumberIfValid(i,s,l),l.hasValidRowNumber()||e++)}}return e}static adjustRowNumberIfValid(e,t,n){return n==null||n.hasValidRowNumber()||(n.isValidRowNumber(e)?(n.setRowNumber(e),t=0):++t),t}adjustRowNumbers(e,t,n){if(!this.detectionResultColumns[e-1])return;let i=n[t],s=this.detectionResultColumns[e-1].getCodewords(),o=s;this.detectionResultColumns[e+1]!=null&&(o=this.detectionResultColumns[e+1].getCodewords());let l=new Array(14);l[2]=s[t],l[3]=o[t],t>0&&(l[0]=n[t-1],l[4]=s[t-1],l[5]=o[t-1]),t>1&&(l[8]=n[t-2],l[10]=s[t-2],l[11]=o[t-2]),t<n.length-1&&(l[1]=n[t+1],l[6]=s[t+1],l[7]=o[t+1]),t<n.length-2&&(l[9]=n[t+2],l[12]=s[t+2],l[13]=o[t+2]);for(let u of l)if(Bi.adjustRowNumber(i,u))return}static adjustRowNumber(e,t){return t==null?!1:t.hasValidRowNumber()&&t.getBucket()===e.getBucket()?(e.setRowNumber(t.getRowNumber()),!0):!1}getBarcodeColumnCount(){return this.barcodeColumnCount}getBarcodeRowCount(){return this.barcodeMetadata.getRowCount()}getBarcodeECLevel(){return this.barcodeMetadata.getErrorCorrectionLevel()}setBoundingBox(e){this.boundingBox=e}getBoundingBox(){return this.boundingBox}setDetectionResultColumn(e,t){this.detectionResultColumns[e]=t}getDetectionResultColumn(e){return this.detectionResultColumns[e]}toString(){let e=this.detectionResultColumns[0];e==null&&(e=this.detectionResultColumns[this.barcodeColumnCount+1]);let t=new ot;for(let n=0;n<e.getCodewords().length;n++){t.format("CW %3d:",n);for(let i=0;i<this.barcodeColumnCount+2;i++){if(this.detectionResultColumns[i]==null){t.format("    |   ");continue}let s=this.detectionResultColumns[i].getCodewords()[n];if(s==null){t.format("    |   ");continue}t.format(" %3d|%3d",s.getRowNumber(),s.getValue())}t.format("%n")}return t.toString()}}class Pi{constructor(e,t,n,i){this.rowNumber=Pi.BARCODE_ROW_UNKNOWN,this.startX=Math.trunc(e),this.endX=Math.trunc(t),this.bucket=Math.trunc(n),this.value=Math.trunc(i)}hasValidRowNumber(){return this.isValidRowNumber(this.rowNumber)}isValidRowNumber(e){return e!==Pi.BARCODE_ROW_UNKNOWN&&this.bucket===e%3*3}setRowNumberAsRowIndicatorColumn(){this.rowNumber=Math.trunc(Math.trunc(this.value/30)*3+Math.trunc(this.bucket/3))}getWidth(){return this.endX-this.startX}getStartX(){return this.startX}getEndX(){return this.endX}getBucket(){return this.bucket}getValue(){return this.value}getRowNumber(){return this.rowNumber}setRowNumber(e){this.rowNumber=e}toString(){return this.rowNumber+"|"+this.value}}Pi.BARCODE_ROW_UNKNOWN=-1;class vn{static initialize(){for(let e=0;e<Ne.SYMBOL_TABLE.length;e++){let t=Ne.SYMBOL_TABLE[e],n=t&1;for(let i=0;i<Ne.BARS_IN_MODULE;i++){let s=0;for(;(t&1)===n;)s+=1,t>>=1;n=t&1,vn.RATIOS_TABLE[e]||(vn.RATIOS_TABLE[e]=new Array(Ne.BARS_IN_MODULE)),vn.RATIOS_TABLE[e][Ne.BARS_IN_MODULE-i-1]=Math.fround(s/Ne.MODULES_IN_CODEWORD)}}this.bSymbolTableReady=!0}static getDecodedValue(e){let t=vn.getDecodedCodewordValue(vn.sampleBitCounts(e));return t!==-1?t:vn.getClosestDecodedValue(e)}static sampleBitCounts(e){let t=Ke.sum(e),n=new Int32Array(Ne.BARS_IN_MODULE),i=0,s=0;for(let o=0;o<Ne.MODULES_IN_CODEWORD;o++){let l=t/(2*Ne.MODULES_IN_CODEWORD)+o*t/Ne.MODULES_IN_CODEWORD;s+e[i]<=l&&(s+=e[i],i++),n[i]++}return n}static getDecodedCodewordValue(e){let t=vn.getBitValue(e);return Ne.getCodeword(t)===-1?-1:t}static getBitValue(e){let t=0;for(let n=0;n<e.length;n++)for(let i=0;i<e[n];i++)t=t<<1|(n%2===0?1:0);return Math.trunc(t)}static getClosestDecodedValue(e){let t=Ke.sum(e),n=new Array(Ne.BARS_IN_MODULE);if(t>1)for(let o=0;o<n.length;o++)n[o]=Math.fround(e[o]/t);let i=lr.MAX_VALUE,s=-1;this.bSymbolTableReady||vn.initialize();for(let o=0;o<vn.RATIOS_TABLE.length;o++){let l=0,u=vn.RATIOS_TABLE[o];for(let h=0;h<Ne.BARS_IN_MODULE;h++){let p=Math.fround(u[h]-n[h]);if(l+=Math.fround(p*p),l>=i)break}l<i&&(i=l,s=Ne.SYMBOL_TABLE[o])}return s}}vn.bSymbolTableReady=!1,vn.RATIOS_TABLE=new Array(Ne.SYMBOL_TABLE.length).map(w=>new Array(Ne.BARS_IN_MODULE));class As{constructor(){this.segmentCount=-1,this.fileSize=-1,this.timestamp=-1,this.checksum=-1}getSegmentIndex(){return this.segmentIndex}setSegmentIndex(e){this.segmentIndex=e}getFileId(){return this.fileId}setFileId(e){this.fileId=e}getOptionalData(){return this.optionalData}setOptionalData(e){this.optionalData=e}isLastSegment(){return this.lastSegment}setLastSegment(e){this.lastSegment=e}getSegmentCount(){return this.segmentCount}setSegmentCount(e){this.segmentCount=e}getSender(){return this.sender||null}setSender(e){this.sender=e}getAddressee(){return this.addressee||null}setAddressee(e){this.addressee=e}getFileName(){return this.fileName}setFileName(e){this.fileName=e}getFileSize(){return this.fileSize}setFileSize(e){this.fileSize=e}getChecksum(){return this.checksum}setChecksum(e){this.checksum=e}getTimestamp(){return this.timestamp}setTimestamp(e){this.timestamp=e}}class Qs{static parseLong(e,t=void 0){return parseInt(e,t)}}class Jt extends T{}Jt.kind="NullPointerException";class Cs{writeBytes(e){this.writeBytesOffset(e,0,e.length)}writeBytesOffset(e,t,n){if(e==null)throw new Jt;if(t<0||t>e.length||n<0||t+n>e.length||t+n<0)throw new Ue;if(n===0)return;for(let i=0;i<n;i++)this.write(e[t+i])}flush(){}close(){}}class qr extends T{}class Js extends Cs{constructor(e=32){if(super(),this.count=0,e<0)throw new H("Negative initial size: "+e);this.buf=new Uint8Array(e)}ensureCapacity(e){e-this.buf.length>0&&this.grow(e)}grow(e){let n=this.buf.length<<1;if(n-e<0&&(n=e),n<0){if(e<0)throw new qr;n=fe.MAX_VALUE}this.buf=Ye.copyOfUint8Array(this.buf,n)}write(e){this.ensureCapacity(this.count+1),this.buf[this.count]=e,this.count+=1}writeBytesOffset(e,t,n){if(t<0||t>e.length||n<0||t+n-e.length>0)throw new Ue;this.ensureCapacity(this.count+n),ge.arraycopy(e,t,this.buf,this.count,n),this.count+=n}writeTo(e){e.writeBytesOffset(this.buf,0,this.count)}reset(){this.count=0}toByteArray(){return Ye.copyOfUint8Array(this.buf,this.count)}size(){return this.count}toString(e){return e?typeof e=="string"?this.toString_string(e):this.toString_number(e):this.toString_void()}toString_void(){return new String(this.buf).toString()}toString_string(e){return new String(this.buf).toString()}toString_number(e){return new String(this.buf).toString()}close(){}}var lt;(function(w){w[w.ALPHA=0]="ALPHA",w[w.LOWER=1]="LOWER",w[w.MIXED=2]="MIXED",w[w.PUNCT=3]="PUNCT",w[w.ALPHA_SHIFT=4]="ALPHA_SHIFT",w[w.PUNCT_SHIFT=5]="PUNCT_SHIFT"})(lt||(lt={}));function Un(){if(typeof window<"u")return window.BigInt||null;if(typeof _i<"u")return _i.BigInt||null;if(typeof self<"u")return self.BigInt||null;throw new Error("Can't search globals for BigInt!")}let ki;function _r(w){if(typeof ki>"u"&&(ki=Un()),ki===null)throw new Error("BigInt is not supported!");return ki(w)}function $s(){let w=[];w[0]=_r(1);let e=_r(900);w[1]=e;for(let t=2;t<16;t++)w[t]=w[t-1]*e;return w}class G{static decode(e,t){let n=new rt(""),i=ie.ISO8859_1;n.enableDecoding(i);let s=1,o=e[s++],l=new As;for(;s<e[0];){switch(o){case G.TEXT_COMPACTION_MODE_LATCH:s=G.textCompaction(e,s,n);break;case G.BYTE_COMPACTION_MODE_LATCH:case G.BYTE_COMPACTION_MODE_LATCH_6:s=G.byteCompaction(o,e,i,s,n);break;case G.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:n.append(e[s++]);break;case G.NUMERIC_COMPACTION_MODE_LATCH:s=G.numericCompaction(e,s,n);break;case G.ECI_CHARSET:ie.getCharacterSetECIByValue(e[s++]);break;case G.ECI_GENERAL_PURPOSE:s+=2;break;case G.ECI_USER_DEFINED:s++;break;case G.BEGIN_MACRO_PDF417_CONTROL_BLOCK:s=G.decodeMacroBlock(e,s,l);break;case G.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case G.MACRO_PDF417_TERMINATOR:throw new re;default:s--,s=G.textCompaction(e,s,n);break}if(s<e.length)o=e[s++];else throw re.getFormatInstance()}if(n.length()===0)throw re.getFormatInstance();let u=new cn(null,n.toString(),null,t);return u.setOther(l),u}static decodeMacroBlock(e,t,n){if(t+G.NUMBER_OF_SEQUENCE_CODEWORDS>e[0])throw re.getFormatInstance();let i=new Int32Array(G.NUMBER_OF_SEQUENCE_CODEWORDS);for(let l=0;l<G.NUMBER_OF_SEQUENCE_CODEWORDS;l++,t++)i[l]=e[t];n.setSegmentIndex(fe.parseInt(G.decodeBase900toBase10(i,G.NUMBER_OF_SEQUENCE_CODEWORDS)));let s=new rt;t=G.textCompaction(e,t,s),n.setFileId(s.toString());let o=-1;for(e[t]===G.BEGIN_MACRO_PDF417_OPTIONAL_FIELD&&(o=t+1);t<e[0];)switch(e[t]){case G.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:switch(t++,e[t]){case G.MACRO_PDF417_OPTIONAL_FIELD_FILE_NAME:let l=new rt;t=G.textCompaction(e,t+1,l),n.setFileName(l.toString());break;case G.MACRO_PDF417_OPTIONAL_FIELD_SENDER:let u=new rt;t=G.textCompaction(e,t+1,u),n.setSender(u.toString());break;case G.MACRO_PDF417_OPTIONAL_FIELD_ADDRESSEE:let h=new rt;t=G.textCompaction(e,t+1,h),n.setAddressee(h.toString());break;case G.MACRO_PDF417_OPTIONAL_FIELD_SEGMENT_COUNT:let p=new rt;t=G.numericCompaction(e,t+1,p),n.setSegmentCount(fe.parseInt(p.toString()));break;case G.MACRO_PDF417_OPTIONAL_FIELD_TIME_STAMP:let A=new rt;t=G.numericCompaction(e,t+1,A),n.setTimestamp(Qs.parseLong(A.toString()));break;case G.MACRO_PDF417_OPTIONAL_FIELD_CHECKSUM:let b=new rt;t=G.numericCompaction(e,t+1,b),n.setChecksum(fe.parseInt(b.toString()));break;case G.MACRO_PDF417_OPTIONAL_FIELD_FILE_SIZE:let L=new rt;t=G.numericCompaction(e,t+1,L),n.setFileSize(Qs.parseLong(L.toString()));break;default:throw re.getFormatInstance()}break;case G.MACRO_PDF417_TERMINATOR:t++,n.setLastSegment(!0);break;default:throw re.getFormatInstance()}if(o!==-1){let l=t-o;n.isLastSegment()&&l--,n.setOptionalData(Ye.copyOfRange(e,o,o+l))}return t}static textCompaction(e,t,n){let i=new Int32Array((e[0]-t)*2),s=new Int32Array((e[0]-t)*2),o=0,l=!1;for(;t<e[0]&&!l;){let u=e[t++];if(u<G.TEXT_COMPACTION_MODE_LATCH)i[o]=u/30,i[o+1]=u%30,o+=2;else switch(u){case G.TEXT_COMPACTION_MODE_LATCH:i[o++]=G.TEXT_COMPACTION_MODE_LATCH;break;case G.BYTE_COMPACTION_MODE_LATCH:case G.BYTE_COMPACTION_MODE_LATCH_6:case G.NUMERIC_COMPACTION_MODE_LATCH:case G.BEGIN_MACRO_PDF417_CONTROL_BLOCK:case G.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case G.MACRO_PDF417_TERMINATOR:t--,l=!0;break;case G.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:i[o]=G.MODE_SHIFT_TO_BYTE_COMPACTION_MODE,u=e[t++],s[o]=u,o++;break}}return G.decodeTextCompaction(i,s,o,n),t}static decodeTextCompaction(e,t,n,i){let s=lt.ALPHA,o=lt.ALPHA,l=0;for(;l<n;){let u=e[l],h="";switch(s){case lt.ALPHA:if(u<26)h=String.fromCharCode(65+u);else switch(u){case 26:h=" ";break;case G.LL:s=lt.LOWER;break;case G.ML:s=lt.MIXED;break;case G.PS:o=s,s=lt.PUNCT_SHIFT;break;case G.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:i.append(t[l]);break;case G.TEXT_COMPACTION_MODE_LATCH:s=lt.ALPHA;break}break;case lt.LOWER:if(u<26)h=String.fromCharCode(97+u);else switch(u){case 26:h=" ";break;case G.AS:o=s,s=lt.ALPHA_SHIFT;break;case G.ML:s=lt.MIXED;break;case G.PS:o=s,s=lt.PUNCT_SHIFT;break;case G.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:i.append(t[l]);break;case G.TEXT_COMPACTION_MODE_LATCH:s=lt.ALPHA;break}break;case lt.MIXED:if(u<G.PL)h=G.MIXED_CHARS[u];else switch(u){case G.PL:s=lt.PUNCT;break;case 26:h=" ";break;case G.LL:s=lt.LOWER;break;case G.AL:s=lt.ALPHA;break;case G.PS:o=s,s=lt.PUNCT_SHIFT;break;case G.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:i.append(t[l]);break;case G.TEXT_COMPACTION_MODE_LATCH:s=lt.ALPHA;break}break;case lt.PUNCT:if(u<G.PAL)h=G.PUNCT_CHARS[u];else switch(u){case G.PAL:s=lt.ALPHA;break;case G.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:i.append(t[l]);break;case G.TEXT_COMPACTION_MODE_LATCH:s=lt.ALPHA;break}break;case lt.ALPHA_SHIFT:if(s=o,u<26)h=String.fromCharCode(65+u);else switch(u){case 26:h=" ";break;case G.TEXT_COMPACTION_MODE_LATCH:s=lt.ALPHA;break}break;case lt.PUNCT_SHIFT:if(s=o,u<G.PAL)h=G.PUNCT_CHARS[u];else switch(u){case G.PAL:s=lt.ALPHA;break;case G.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:i.append(t[l]);break;case G.TEXT_COMPACTION_MODE_LATCH:s=lt.ALPHA;break}break}h!==""&&i.append(h),l++}}static byteCompaction(e,t,n,i,s){let o=new Js,l=0,u=0,h=!1;switch(e){case G.BYTE_COMPACTION_MODE_LATCH:let p=new Int32Array(6),A=t[i++];for(;i<t[0]&&!h;)switch(p[l++]=A,u=900*u+A,A=t[i++],A){case G.TEXT_COMPACTION_MODE_LATCH:case G.BYTE_COMPACTION_MODE_LATCH:case G.NUMERIC_COMPACTION_MODE_LATCH:case G.BYTE_COMPACTION_MODE_LATCH_6:case G.BEGIN_MACRO_PDF417_CONTROL_BLOCK:case G.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case G.MACRO_PDF417_TERMINATOR:i--,h=!0;break;default:if(l%5===0&&l>0){for(let b=0;b<6;++b)o.write(Number(_r(u)>>_r(8*(5-b))));u=0,l=0}break}i===t[0]&&A<G.TEXT_COMPACTION_MODE_LATCH&&(p[l++]=A);for(let b=0;b<l;b++)o.write(p[b]);break;case G.BYTE_COMPACTION_MODE_LATCH_6:for(;i<t[0]&&!h;){let b=t[i++];if(b<G.TEXT_COMPACTION_MODE_LATCH)l++,u=900*u+b;else switch(b){case G.TEXT_COMPACTION_MODE_LATCH:case G.BYTE_COMPACTION_MODE_LATCH:case G.NUMERIC_COMPACTION_MODE_LATCH:case G.BYTE_COMPACTION_MODE_LATCH_6:case G.BEGIN_MACRO_PDF417_CONTROL_BLOCK:case G.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case G.MACRO_PDF417_TERMINATOR:i--,h=!0;break}if(l%5===0&&l>0){for(let L=0;L<6;++L)o.write(Number(_r(u)>>_r(8*(5-L))));u=0,l=0}}break}return s.append(en.decode(o.toByteArray(),n)),i}static numericCompaction(e,t,n){let i=0,s=!1,o=new Int32Array(G.MAX_NUMERIC_CODEWORDS);for(;t<e[0]&&!s;){let l=e[t++];if(t===e[0]&&(s=!0),l<G.TEXT_COMPACTION_MODE_LATCH)o[i]=l,i++;else switch(l){case G.TEXT_COMPACTION_MODE_LATCH:case G.BYTE_COMPACTION_MODE_LATCH:case G.BYTE_COMPACTION_MODE_LATCH_6:case G.BEGIN_MACRO_PDF417_CONTROL_BLOCK:case G.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case G.MACRO_PDF417_TERMINATOR:t--,s=!0;break}(i%G.MAX_NUMERIC_CODEWORDS===0||l===G.NUMERIC_COMPACTION_MODE_LATCH||s)&&i>0&&(n.append(G.decodeBase900toBase10(o,i)),i=0)}return t}static decodeBase900toBase10(e,t){let n=_r(0);for(let s=0;s<t;s++)n+=G.EXP900[t-s-1]*_r(e[s]);let i=n.toString();if(i.charAt(0)!=="1")throw new re;return i.substring(1)}}G.TEXT_COMPACTION_MODE_LATCH=900,G.BYTE_COMPACTION_MODE_LATCH=901,G.NUMERIC_COMPACTION_MODE_LATCH=902,G.BYTE_COMPACTION_MODE_LATCH_6=924,G.ECI_USER_DEFINED=925,G.ECI_GENERAL_PURPOSE=926,G.ECI_CHARSET=927,G.BEGIN_MACRO_PDF417_CONTROL_BLOCK=928,G.BEGIN_MACRO_PDF417_OPTIONAL_FIELD=923,G.MACRO_PDF417_TERMINATOR=922,G.MODE_SHIFT_TO_BYTE_COMPACTION_MODE=913,G.MAX_NUMERIC_CODEWORDS=15,G.MACRO_PDF417_OPTIONAL_FIELD_FILE_NAME=0,G.MACRO_PDF417_OPTIONAL_FIELD_SEGMENT_COUNT=1,G.MACRO_PDF417_OPTIONAL_FIELD_TIME_STAMP=2,G.MACRO_PDF417_OPTIONAL_FIELD_SENDER=3,G.MACRO_PDF417_OPTIONAL_FIELD_ADDRESSEE=4,G.MACRO_PDF417_OPTIONAL_FIELD_FILE_SIZE=5,G.MACRO_PDF417_OPTIONAL_FIELD_CHECKSUM=6,G.PL=25,G.LL=27,G.AS=27,G.ML=28,G.AL=28,G.PS=29,G.PAL=29,G.PUNCT_CHARS=`;<>@[\\]_\`~!\r	,:
-.$/"|*()?{}'`,G.MIXED_CHARS="0123456789&\r	,:#-.$/+%*=^",G.EXP900=Un()?$s():[],G.NUMBER_OF_SEQUENCE_CODEWORDS=2;class He{constructor(){}static decode(e,t,n,i,s,o,l){let u=new Kr(e,t,n,i,s),h=null,p=null,A;for(let E=!0;;E=!1){if(t!=null&&(h=He.getRowIndicatorColumn(e,u,t,!0,o,l)),i!=null&&(p=He.getRowIndicatorColumn(e,u,i,!1,o,l)),A=He.merge(h,p),A==null)throw v.getNotFoundInstance();let M=A.getBoundingBox();if(E&&M!=null&&(M.getMinY()<u.getMinY()||M.getMaxY()>u.getMaxY()))u=M;else break}A.setBoundingBox(u);let b=A.getBarcodeColumnCount()+1;A.setDetectionResultColumn(0,h),A.setDetectionResultColumn(b,p);let L=h!=null;for(let E=1;E<=b;E++){let M=L?E:b-E;if(A.getDetectionResultColumn(M)!==void 0)continue;let D;M===0||M===b?D=new qs(u,M===0):D=new Ri(u),A.setDetectionResultColumn(M,D);let P=-1,K=P;for(let q=u.getMinY();q<=u.getMaxY();q++){if(P=He.getStartColumn(A,M,q,L),P<0||P>u.getMaxX()){if(K===-1)continue;P=K}let Q=He.detectCodeword(e,u.getMinX(),u.getMaxX(),L,P,q,o,l);Q!=null&&(D.setCodeword(q,Q),K=P,o=Math.min(o,Q.getWidth()),l=Math.max(l,Q.getWidth()))}}return He.createDecoderResult(A)}static merge(e,t){if(e==null&&t==null)return null;let n=He.getBarcodeMetadata(e,t);if(n==null)return null;let i=Kr.merge(He.adjustBoundingBox(e),He.adjustBoundingBox(t));return new Bi(n,i)}static adjustBoundingBox(e){if(e==null)return null;let t=e.getRowHeights();if(t==null)return null;let n=He.getMax(t),i=0;for(let l of t)if(i+=n-l,l>0)break;let s=e.getCodewords();for(let l=0;i>0&&s[l]==null;l++)i--;let o=0;for(let l=t.length-1;l>=0&&(o+=n-t[l],!(t[l]>0));l--);for(let l=s.length-1;o>0&&s[l]==null;l--)o--;return e.getBoundingBox().addMissingRows(i,o,e.isLeft())}static getMax(e){let t=-1;for(let n of e)t=Math.max(t,n);return t}static getBarcodeMetadata(e,t){let n;if(e==null||(n=e.getBarcodeMetadata())==null)return t==null?null:t.getBarcodeMetadata();let i;return t==null||(i=t.getBarcodeMetadata())==null?n:n.getColumnCount()!==i.getColumnCount()&&n.getErrorCorrectionLevel()!==i.getErrorCorrectionLevel()&&n.getRowCount()!==i.getRowCount()?null:n}static getRowIndicatorColumn(e,t,n,i,s,o){let l=new qs(t,i);for(let u=0;u<2;u++){let h=u===0?1:-1,p=Math.trunc(Math.trunc(n.getX()));for(let A=Math.trunc(Math.trunc(n.getY()));A<=t.getMaxY()&&A>=t.getMinY();A+=h){let b=He.detectCodeword(e,0,e.getWidth(),i,p,A,s,o);b!=null&&(l.setCodeword(A,b),i?p=b.getStartX():p=b.getEndX())}}return l}static adjustCodewordCount(e,t){let n=t[0][1],i=n.getValue(),s=e.getBarcodeColumnCount()*e.getBarcodeRowCount()-He.getNumberOfECCodeWords(e.getBarcodeECLevel());if(i.length===0){if(s<1||s>Ne.MAX_CODEWORDS_IN_BARCODE)throw v.getNotFoundInstance();n.setValue(s)}else i[0]!==s&&n.setValue(s)}static createDecoderResult(e){let t=He.createBarcodeMatrix(e);He.adjustCodewordCount(e,t);let n=new Array,i=new Int32Array(e.getBarcodeRowCount()*e.getBarcodeColumnCount()),s=[],o=new Array;for(let u=0;u<e.getBarcodeRowCount();u++)for(let h=0;h<e.getBarcodeColumnCount();h++){let p=t[u][h+1].getValue(),A=u*e.getBarcodeColumnCount()+h;p.length===0?n.push(A):p.length===1?i[A]=p[0]:(o.push(A),s.push(p))}let l=new Array(s.length);for(let u=0;u<l.length;u++)l[u]=s[u];return He.createDecoderResultFromAmbiguousValues(e.getBarcodeECLevel(),i,Ne.toIntArray(n),Ne.toIntArray(o),l)}static createDecoderResultFromAmbiguousValues(e,t,n,i,s){let o=new Int32Array(i.length),l=100;for(;l-- >0;){for(let u=0;u<o.length;u++)t[i[u]]=s[u][o[u]];try{return He.decodeCodewords(t,e,n)}catch(u){if(!(u instanceof Ee))throw u}if(o.length===0)throw Ee.getChecksumInstance();for(let u=0;u<o.length;u++)if(o[u]<s[u].length-1){o[u]++;break}else if(o[u]=0,u===o.length-1)throw Ee.getChecksumInstance()}throw Ee.getChecksumInstance()}static createBarcodeMatrix(e){let t=Array.from({length:e.getBarcodeRowCount()},()=>new Array(e.getBarcodeColumnCount()+2));for(let i=0;i<t.length;i++)for(let s=0;s<t[i].length;s++)t[i][s]=new Li;let n=0;for(let i of e.getDetectionResultColumns()){if(i!=null){for(let s of i.getCodewords())if(s!=null){let o=s.getRowNumber();if(o>=0){if(o>=t.length)continue;t[o][n].setValue(s.getValue())}}}n++}return t}static isValidBarcodeColumn(e,t){return t>=0&&t<=e.getBarcodeColumnCount()+1}static getStartColumn(e,t,n,i){let s=i?1:-1,o=null;if(He.isValidBarcodeColumn(e,t-s)&&(o=e.getDetectionResultColumn(t-s).getCodeword(n)),o!=null)return i?o.getEndX():o.getStartX();if(o=e.getDetectionResultColumn(t).getCodewordNearby(n),o!=null)return i?o.getStartX():o.getEndX();if(He.isValidBarcodeColumn(e,t-s)&&(o=e.getDetectionResultColumn(t-s).getCodewordNearby(n)),o!=null)return i?o.getEndX():o.getStartX();let l=0;for(;He.isValidBarcodeColumn(e,t-s);){t-=s;for(let u of e.getDetectionResultColumn(t).getCodewords())if(u!=null)return(i?u.getEndX():u.getStartX())+s*l*(u.getEndX()-u.getStartX());l++}return i?e.getBoundingBox().getMinX():e.getBoundingBox().getMaxX()}static detectCodeword(e,t,n,i,s,o,l,u){s=He.adjustCodewordStartColumn(e,t,n,i,s,o);let h=He.getModuleBitCount(e,t,n,i,s,o);if(h==null)return null;let p,A=Ke.sum(h);if(i)p=s+A;else{for(let E=0;E<h.length/2;E++){let M=h[E];h[E]=h[h.length-1-E],h[h.length-1-E]=M}p=s,s=p-A}if(!He.checkCodewordSkew(A,l,u))return null;let b=vn.getDecodedValue(h),L=Ne.getCodeword(b);return L===-1?null:new Pi(s,p,He.getCodewordBucketNumber(b),L)}static getModuleBitCount(e,t,n,i,s,o){let l=s,u=new Int32Array(8),h=0,p=i?1:-1,A=i;for(;(i?l<n:l>=t)&&h<u.length;)e.get(l,o)===A?(u[h]++,l+=p):(h++,A=!A);return h===u.length||l===(i?n:t)&&h===u.length-1?u:null}static getNumberOfECCodeWords(e){return 2<<e}static adjustCodewordStartColumn(e,t,n,i,s,o){let l=s,u=i?-1:1;for(let h=0;h<2;h++){for(;(i?l>=t:l<n)&&i===e.get(l,o);){if(Math.abs(s-l)>He.CODEWORD_SKEW_SIZE)return s;l+=u}u=-u,i=!i}return l}static checkCodewordSkew(e,t,n){return t-He.CODEWORD_SKEW_SIZE<=e&&e<=n+He.CODEWORD_SKEW_SIZE}static decodeCodewords(e,t,n){if(e.length===0)throw re.getFormatInstance();let i=1<<t+1,s=He.correctErrors(e,n,i);He.verifyCodewordCount(e,i);let o=G.decode(e,""+t);return o.setErrorsCorrected(s),o.setErasures(n.length),o}static correctErrors(e,t,n){if(t!=null&&t.length>n/2+He.MAX_ERRORS||n<0||n>He.MAX_EC_CODEWORDS)throw Ee.getChecksumInstance();return He.errorCorrection.decode(e,n,t)}static verifyCodewordCount(e,t){if(e.length<4)throw re.getFormatInstance();let n=e[0];if(n>e.length)throw re.getFormatInstance();if(n===0)if(t<e.length)e[0]=e.length-t;else throw re.getFormatInstance()}static getBitCountForCodeword(e){let t=new Int32Array(8),n=0,i=t.length-1;for(;!((e&1)!==n&&(n=e&1,i--,i<0));)t[i]++,e>>=1;return t}static getCodewordBucketNumber(e){return e instanceof Int32Array?this.getCodewordBucketNumber_Int32Array(e):this.getCodewordBucketNumber_number(e)}static getCodewordBucketNumber_number(e){return He.getCodewordBucketNumber(He.getBitCountForCodeword(e))}static getCodewordBucketNumber_Int32Array(e){return(e[0]-e[2]+e[4]-e[6]+9)%9}static toString(e){let t=new ot;for(let n=0;n<e.length;n++){t.format("Row %2d: ",n);for(let i=0;i<e[n].length;i++){let s=e[n][i];s.getValue().length===0?t.format("        ",null):t.format("%4d(%2d)",s.getValue()[0],s.getConfidence(s.getValue()[0]))}t.format("%n")}return t.toString()}}He.CODEWORD_SKEW_SIZE=2,He.MAX_ERRORS=3,He.MAX_EC_CODEWORDS=512,He.errorCorrection=new Ks;class $t{decode(e,t=null){let n=$t.decode(e,t,!1);if(n==null||n.length===0||n[0]==null)throw v.getNotFoundInstance();return n[0]}decodeMultiple(e,t=null){try{return $t.decode(e,t,!0)}catch(n){throw n instanceof re||n instanceof Ee?v.getNotFoundInstance():n}}static decode(e,t,n){const i=new Array,s=ke.detectMultiple(e,t,n);for(const o of s.getPoints()){const l=He.decode(s.getBits(),o[4],o[5],o[6],o[7],$t.getMinCodewordWidth(o),$t.getMaxCodewordWidth(o)),u=new Ft(l.getText(),l.getRawBytes(),void 0,o,me.PDF_417);u.putMetadata(gt.ERROR_CORRECTION_LEVEL,l.getECLevel());const h=l.getOther();h!=null&&u.putMetadata(gt.PDF417_EXTRA_METADATA,h),i.push(u)}return i.map(o=>o)}static getMaxWidth(e,t){return e==null||t==null?0:Math.trunc(Math.abs(e.getX()-t.getX()))}static getMinWidth(e,t){return e==null||t==null?fe.MAX_VALUE:Math.trunc(Math.abs(e.getX()-t.getX()))}static getMaxCodewordWidth(e){return Math.floor(Math.max(Math.max($t.getMaxWidth(e[0],e[4]),$t.getMaxWidth(e[6],e[2])*Ne.MODULES_IN_CODEWORD/Ne.MODULES_IN_STOP_PATTERN),Math.max($t.getMaxWidth(e[1],e[5]),$t.getMaxWidth(e[7],e[3])*Ne.MODULES_IN_CODEWORD/Ne.MODULES_IN_STOP_PATTERN)))}static getMinCodewordWidth(e){return Math.floor(Math.min(Math.min($t.getMinWidth(e[0],e[4]),$t.getMinWidth(e[6],e[2])*Ne.MODULES_IN_CODEWORD/Ne.MODULES_IN_STOP_PATTERN),Math.min($t.getMinWidth(e[1],e[5]),$t.getMinWidth(e[7],e[3])*Ne.MODULES_IN_CODEWORD/Ne.MODULES_IN_STOP_PATTERN)))}reset(){}}class fn extends T{}fn.kind="ReaderException";class ea{constructor(e,t){this.verbose=e===!0,t&&this.setHints(t)}decode(e,t){return t&&this.setHints(t),this.decodeInternal(e)}decodeWithState(e){return(this.readers===null||this.readers===void 0)&&this.setHints(null),this.decodeInternal(e)}setHints(e){this.hints=e;const t=!y(e)&&e.get(Be.TRY_HARDER)===!0,n=y(e)?null:e.get(Be.POSSIBLE_FORMATS),i=new Array;if(!y(n)){const s=n.some(o=>o===me.UPC_A||o===me.UPC_E||o===me.EAN_13||o===me.EAN_8||o===me.CODABAR||o===me.CODE_39||o===me.CODE_93||o===me.CODE_128||o===me.ITF||o===me.RSS_14||o===me.RSS_EXPANDED);s&&!t&&i.push(new at(e,this.verbose)),n.includes(me.QR_CODE)&&i.push(new Ur),n.includes(me.DATA_MATRIX)&&i.push(new Tn),n.includes(me.AZTEC)&&i.push(new Er),n.includes(me.PDF_417)&&i.push(new $t),s&&t&&i.push(new at(e,this.verbose))}i.length===0&&(t||i.push(new at(e,this.verbose)),i.push(new Ur),i.push(new Tn),i.push(new Er),i.push(new $t),t&&i.push(new at(e,this.verbose))),this.readers=i}reset(){if(this.readers!==null)for(const e of this.readers)e.reset()}decodeInternal(e){if(this.readers===null)throw new fn("No readers where selected, nothing can be read.");for(const t of this.readers)try{return t.decode(e,this.hints)}catch(n){if(n instanceof fn)continue}throw new v("No MultiFormat Readers were able to detect the code.")}}class Yn extends Wn{constructor(e=null,t=500){const n=new ea;n.setHints(e),super(n,t)}decodeBitmap(e){return this.reader.decodeWithState(e)}}class Va extends Wn{constructor(e=500){super(new $t,e)}}class ta extends Wn{constructor(e=500){super(new Ur,e)}}var hr;(function(w){w[w.ERROR_CORRECTION=0]="ERROR_CORRECTION",w[w.CHARACTER_SET=1]="CHARACTER_SET",w[w.DATA_MATRIX_SHAPE=2]="DATA_MATRIX_SHAPE",w[w.MIN_SIZE=3]="MIN_SIZE",w[w.MAX_SIZE=4]="MAX_SIZE",w[w.MARGIN=5]="MARGIN",w[w.PDF417_COMPACT=6]="PDF417_COMPACT",w[w.PDF417_COMPACTION=7]="PDF417_COMPACTION",w[w.PDF417_DIMENSIONS=8]="PDF417_DIMENSIONS",w[w.AZTEC_LAYERS=9]="AZTEC_LAYERS",w[w.QR_VERSION=10]="QR_VERSION"})(hr||(hr={}));var Lt=hr;class Fi{constructor(e){this.field=e,this.cachedGenerators=[],this.cachedGenerators.push(new Yt(e,Int32Array.from([1])))}buildGenerator(e){const t=this.cachedGenerators;if(e>=t.length){let n=t[t.length-1];const i=this.field;for(let s=t.length;s<=e;s++){const o=n.multiply(new Yt(i,Int32Array.from([1,i.exp(s-1+i.getGeneratorBase())])));t.push(o),n=o}}return t[e]}encode(e,t){if(t===0)throw new H("No error correction bytes");const n=e.length-t;if(n<=0)throw new H("No data bytes provided");const i=this.buildGenerator(t),s=new Int32Array(n);ge.arraycopy(e,0,s,0,n);let o=new Yt(this.field,s);o=o.multiplyByMonomial(t,1);const u=o.divide(i)[1].getCoefficients(),h=t-u.length;for(let p=0;p<h;p++)e[n+p]=0;ge.arraycopy(u,0,e,n+h,u.length)}}class Re{constructor(){}static applyMaskPenaltyRule1(e){return Re.applyMaskPenaltyRule1Internal(e,!0)+Re.applyMaskPenaltyRule1Internal(e,!1)}static applyMaskPenaltyRule2(e){let t=0;const n=e.getArray(),i=e.getWidth(),s=e.getHeight();for(let o=0;o<s-1;o++){const l=n[o];for(let u=0;u<i-1;u++){const h=l[u];h===l[u+1]&&h===n[o+1][u]&&h===n[o+1][u+1]&&t++}}return Re.N2*t}static applyMaskPenaltyRule3(e){let t=0;const n=e.getArray(),i=e.getWidth(),s=e.getHeight();for(let o=0;o<s;o++)for(let l=0;l<i;l++){const u=n[o];l+6<i&&u[l]===1&&u[l+1]===0&&u[l+2]===1&&u[l+3]===1&&u[l+4]===1&&u[l+5]===0&&u[l+6]===1&&(Re.isWhiteHorizontal(u,l-4,l)||Re.isWhiteHorizontal(u,l+7,l+11))&&t++,o+6<s&&n[o][l]===1&&n[o+1][l]===0&&n[o+2][l]===1&&n[o+3][l]===1&&n[o+4][l]===1&&n[o+5][l]===0&&n[o+6][l]===1&&(Re.isWhiteVertical(n,l,o-4,o)||Re.isWhiteVertical(n,l,o+7,o+11))&&t++}return t*Re.N3}static isWhiteHorizontal(e,t,n){t=Math.max(t,0),n=Math.min(n,e.length);for(let i=t;i<n;i++)if(e[i]===1)return!1;return!0}static isWhiteVertical(e,t,n,i){n=Math.max(n,0),i=Math.min(i,e.length);for(let s=n;s<i;s++)if(e[s][t]===1)return!1;return!0}static applyMaskPenaltyRule4(e){let t=0;const n=e.getArray(),i=e.getWidth(),s=e.getHeight();for(let u=0;u<s;u++){const h=n[u];for(let p=0;p<i;p++)h[p]===1&&t++}const o=e.getHeight()*e.getWidth();return Math.floor(Math.abs(t*2-o)*10/o)*Re.N4}static getDataMaskBit(e,t,n){let i,s;switch(e){case 0:i=n+t&1;break;case 1:i=n&1;break;case 2:i=t%3;break;case 3:i=(n+t)%3;break;case 4:i=Math.floor(n/2)+Math.floor(t/3)&1;break;case 5:s=n*t,i=(s&1)+s%3;break;case 6:s=n*t,i=(s&1)+s%3&1;break;case 7:s=n*t,i=s%3+(n+t&1)&1;break;default:throw new H("Invalid mask pattern: "+e)}return i===0}static applyMaskPenaltyRule1Internal(e,t){let n=0;const i=t?e.getHeight():e.getWidth(),s=t?e.getWidth():e.getHeight(),o=e.getArray();for(let l=0;l<i;l++){let u=0,h=-1;for(let p=0;p<s;p++){const A=t?o[l][p]:o[p][l];A===h?u++:(u>=5&&(n+=Re.N1+(u-5)),u=1,h=A)}u>=5&&(n+=Re.N1+(u-5))}return n}}Re.N1=3,Re.N2=3,Re.N3=40,Re.N4=10;class $n{constructor(e,t){this.width=e,this.height=t;const n=new Array(t);for(let i=0;i!==t;i++)n[i]=new Uint8Array(e);this.bytes=n}getHeight(){return this.height}getWidth(){return this.width}get(e,t){return this.bytes[t][e]}getArray(){return this.bytes}setNumber(e,t,n){this.bytes[t][e]=n}setBoolean(e,t,n){this.bytes[t][e]=n?1:0}clear(e){for(const t of this.bytes)Ye.fill(t,e)}equals(e){if(!(e instanceof $n))return!1;const t=e;if(this.width!==t.width||this.height!==t.height)return!1;for(let n=0,i=this.height;n<i;++n){const s=this.bytes[n],o=t.bytes[n];for(let l=0,u=this.width;l<u;++l)if(s[l]!==o[l])return!1}return!0}toString(){const e=new rt;for(let t=0,n=this.height;t<n;++t){const i=this.bytes[t];for(let s=0,o=this.width;s<o;++s)switch(i[s]){case 0:e.append(" 0");break;case 1:e.append(" 1");break;default:e.append("  ");break}e.append(`
`)}return e.toString()}}class Sr{constructor(){this.maskPattern=-1}getMode(){return this.mode}getECLevel(){return this.ecLevel}getVersion(){return this.version}getMaskPattern(){return this.maskPattern}getMatrix(){return this.matrix}toString(){const e=new rt;return e.append(`<<
`),e.append(" mode: "),e.append(this.mode?this.mode.toString():"null"),e.append(`
 ecLevel: `),e.append(this.ecLevel?this.ecLevel.toString():"null"),e.append(`
 version: `),e.append(this.version?this.version.toString():"null"),e.append(`
 maskPattern: `),e.append(this.maskPattern.toString()),this.matrix?(e.append(`
 matrix:
`),e.append(this.matrix.toString())):e.append(`
 matrix: null
`),e.append(`>>
`),e.toString()}setMode(e){this.mode=e}setECLevel(e){this.ecLevel=e}setVersion(e){this.version=e}setMaskPattern(e){this.maskPattern=e}setMatrix(e){this.matrix=e}static isValidMaskPattern(e){return e>=0&&e<Sr.NUM_MASK_PATTERNS}}Sr.NUM_MASK_PATTERNS=8;class mt extends T{}mt.kind="WriterException";class be{constructor(){}static clearMatrix(e){e.clear(255)}static buildMatrix(e,t,n,i,s){be.clearMatrix(s),be.embedBasicPatterns(n,s),be.embedTypeInfo(t,i,s),be.maybeEmbedVersionInfo(n,s),be.embedDataBits(e,i,s)}static embedBasicPatterns(e,t){be.embedPositionDetectionPatternsAndSeparators(t),be.embedDarkDotAtLeftBottomCorner(t),be.maybeEmbedPositionAdjustmentPatterns(e,t),be.embedTimingPatterns(t)}static embedTypeInfo(e,t,n){const i=new _e;be.makeTypeInfoBits(e,t,i);for(let s=0,o=i.getSize();s<o;++s){const l=i.get(i.getSize()-1-s),u=be.TYPE_INFO_COORDINATES[s],h=u[0],p=u[1];if(n.setBoolean(h,p,l),s<8){const A=n.getWidth()-s-1;n.setBoolean(A,8,l)}else{const b=n.getHeight()-7+(s-8);n.setBoolean(8,b,l)}}}static maybeEmbedVersionInfo(e,t){if(e.getVersionNumber()<7)return;const n=new _e;be.makeVersionInfoBits(e,n);let i=17;for(let s=0;s<6;++s)for(let o=0;o<3;++o){const l=n.get(i);i--,t.setBoolean(s,t.getHeight()-11+o,l),t.setBoolean(t.getHeight()-11+o,s,l)}}static embedDataBits(e,t,n){let i=0,s=-1,o=n.getWidth()-1,l=n.getHeight()-1;for(;o>0;){for(o===6&&(o-=1);l>=0&&l<n.getHeight();){for(let u=0;u<2;++u){const h=o-u;if(!be.isEmpty(n.get(h,l)))continue;let p;i<e.getSize()?(p=e.get(i),++i):p=!1,t!==255&&Re.getDataMaskBit(t,h,l)&&(p=!p),n.setBoolean(h,l,p)}l+=s}s=-s,l+=s,o-=2}if(i!==e.getSize())throw new mt("Not all bits consumed: "+i+"/"+e.getSize())}static findMSBSet(e){return 32-fe.numberOfLeadingZeros(e)}static calculateBCHCode(e,t){if(t===0)throw new H("0 polynomial");const n=be.findMSBSet(t);for(e<<=n-1;be.findMSBSet(e)>=n;)e^=t<<be.findMSBSet(e)-n;return e}static makeTypeInfoBits(e,t,n){if(!Sr.isValidMaskPattern(t))throw new mt("Invalid mask pattern");const i=e.getBits()<<3|t;n.appendBits(i,5);const s=be.calculateBCHCode(i,be.TYPE_INFO_POLY);n.appendBits(s,10);const o=new _e;if(o.appendBits(be.TYPE_INFO_MASK_PATTERN,15),n.xor(o),n.getSize()!==15)throw new mt("should not happen but we got: "+n.getSize())}static makeVersionInfoBits(e,t){t.appendBits(e.getVersionNumber(),6);const n=be.calculateBCHCode(e.getVersionNumber(),be.VERSION_INFO_POLY);if(t.appendBits(n,12),t.getSize()!==18)throw new mt("should not happen but we got: "+t.getSize())}static isEmpty(e){return e===255}static embedTimingPatterns(e){for(let t=8;t<e.getWidth()-8;++t){const n=(t+1)%2;be.isEmpty(e.get(t,6))&&e.setNumber(t,6,n),be.isEmpty(e.get(6,t))&&e.setNumber(6,t,n)}}static embedDarkDotAtLeftBottomCorner(e){if(e.get(8,e.getHeight()-8)===0)throw new mt;e.setNumber(8,e.getHeight()-8,1)}static embedHorizontalSeparationPattern(e,t,n){for(let i=0;i<8;++i){if(!be.isEmpty(n.get(e+i,t)))throw new mt;n.setNumber(e+i,t,0)}}static embedVerticalSeparationPattern(e,t,n){for(let i=0;i<7;++i){if(!be.isEmpty(n.get(e,t+i)))throw new mt;n.setNumber(e,t+i,0)}}static embedPositionAdjustmentPattern(e,t,n){for(let i=0;i<5;++i){const s=be.POSITION_ADJUSTMENT_PATTERN[i];for(let o=0;o<5;++o)n.setNumber(e+o,t+i,s[o])}}static embedPositionDetectionPattern(e,t,n){for(let i=0;i<7;++i){const s=be.POSITION_DETECTION_PATTERN[i];for(let o=0;o<7;++o)n.setNumber(e+o,t+i,s[o])}}static embedPositionDetectionPatternsAndSeparators(e){const t=be.POSITION_DETECTION_PATTERN[0].length;be.embedPositionDetectionPattern(0,0,e),be.embedPositionDetectionPattern(e.getWidth()-t,0,e),be.embedPositionDetectionPattern(0,e.getWidth()-t,e);const n=8;be.embedHorizontalSeparationPattern(0,n-1,e),be.embedHorizontalSeparationPattern(e.getWidth()-n,n-1,e),be.embedHorizontalSeparationPattern(0,e.getWidth()-n,e);const i=7;be.embedVerticalSeparationPattern(i,0,e),be.embedVerticalSeparationPattern(e.getHeight()-i-1,0,e),be.embedVerticalSeparationPattern(i,e.getHeight()-i,e)}static maybeEmbedPositionAdjustmentPatterns(e,t){if(e.getVersionNumber()<2)return;const n=e.getVersionNumber()-1,i=be.POSITION_ADJUSTMENT_PATTERN_COORDINATE_TABLE[n];for(let s=0,o=i.length;s!==o;s++){const l=i[s];if(l>=0)for(let u=0;u!==o;u++){const h=i[u];h>=0&&be.isEmpty(t.get(h,l))&&be.embedPositionAdjustmentPattern(h-2,l-2,t)}}}}be.POSITION_DETECTION_PATTERN=Array.from([Int32Array.from([1,1,1,1,1,1,1]),Int32Array.from([1,0,0,0,0,0,1]),Int32Array.from([1,0,1,1,1,0,1]),Int32Array.from([1,0,1,1,1,0,1]),Int32Array.from([1,0,1,1,1,0,1]),Int32Array.from([1,0,0,0,0,0,1]),Int32Array.from([1,1,1,1,1,1,1])]),be.POSITION_ADJUSTMENT_PATTERN=Array.from([Int32Array.from([1,1,1,1,1]),Int32Array.from([1,0,0,0,1]),Int32Array.from([1,0,1,0,1]),Int32Array.from([1,0,0,0,1]),Int32Array.from([1,1,1,1,1])]),be.POSITION_ADJUSTMENT_PATTERN_COORDINATE_TABLE=Array.from([Int32Array.from([-1,-1,-1,-1,-1,-1,-1]),Int32Array.from([6,18,-1,-1,-1,-1,-1]),Int32Array.from([6,22,-1,-1,-1,-1,-1]),Int32Array.from([6,26,-1,-1,-1,-1,-1]),Int32Array.from([6,30,-1,-1,-1,-1,-1]),Int32Array.from([6,34,-1,-1,-1,-1,-1]),Int32Array.from([6,22,38,-1,-1,-1,-1]),Int32Array.from([6,24,42,-1,-1,-1,-1]),Int32Array.from([6,26,46,-1,-1,-1,-1]),Int32Array.from([6,28,50,-1,-1,-1,-1]),Int32Array.from([6,30,54,-1,-1,-1,-1]),Int32Array.from([6,32,58,-1,-1,-1,-1]),Int32Array.from([6,34,62,-1,-1,-1,-1]),Int32Array.from([6,26,46,66,-1,-1,-1]),Int32Array.from([6,26,48,70,-1,-1,-1]),Int32Array.from([6,26,50,74,-1,-1,-1]),Int32Array.from([6,30,54,78,-1,-1,-1]),Int32Array.from([6,30,56,82,-1,-1,-1]),Int32Array.from([6,30,58,86,-1,-1,-1]),Int32Array.from([6,34,62,90,-1,-1,-1]),Int32Array.from([6,28,50,72,94,-1,-1]),Int32Array.from([6,26,50,74,98,-1,-1]),Int32Array.from([6,30,54,78,102,-1,-1]),Int32Array.from([6,28,54,80,106,-1,-1]),Int32Array.from([6,32,58,84,110,-1,-1]),Int32Array.from([6,30,58,86,114,-1,-1]),Int32Array.from([6,34,62,90,118,-1,-1]),Int32Array.from([6,26,50,74,98,122,-1]),Int32Array.from([6,30,54,78,102,126,-1]),Int32Array.from([6,26,52,78,104,130,-1]),Int32Array.from([6,30,56,82,108,134,-1]),Int32Array.from([6,34,60,86,112,138,-1]),Int32Array.from([6,30,58,86,114,142,-1]),Int32Array.from([6,34,62,90,118,146,-1]),Int32Array.from([6,30,54,78,102,126,150]),Int32Array.from([6,24,50,76,102,128,154]),Int32Array.from([6,28,54,80,106,132,158]),Int32Array.from([6,32,58,84,110,136,162]),Int32Array.from([6,26,54,82,110,138,166]),Int32Array.from([6,30,58,86,114,142,170])]),be.TYPE_INFO_COORDINATES=Array.from([Int32Array.from([8,0]),Int32Array.from([8,1]),Int32Array.from([8,2]),Int32Array.from([8,3]),Int32Array.from([8,4]),Int32Array.from([8,5]),Int32Array.from([8,7]),Int32Array.from([8,8]),Int32Array.from([7,8]),Int32Array.from([5,8]),Int32Array.from([4,8]),Int32Array.from([3,8]),Int32Array.from([2,8]),Int32Array.from([1,8]),Int32Array.from([0,8])]),be.VERSION_INFO_POLY=7973,be.TYPE_INFO_POLY=1335,be.TYPE_INFO_MASK_PATTERN=21522;class Ya{constructor(e,t){this.dataBytes=e,this.errorCorrectionBytes=t}getDataBytes(){return this.dataBytes}getErrorCorrectionBytes(){return this.errorCorrectionBytes}}class St{constructor(){}static calculateMaskPenalty(e){return Re.applyMaskPenaltyRule1(e)+Re.applyMaskPenaltyRule2(e)+Re.applyMaskPenaltyRule3(e)+Re.applyMaskPenaltyRule4(e)}static encode(e,t,n=null){let i=St.DEFAULT_BYTE_MODE_ENCODING;const s=n!==null&&n.get(Lt.CHARACTER_SET)!==void 0;s&&(i=n.get(Lt.CHARACTER_SET).toString());const o=this.chooseMode(e,i),l=new _e;if(o===Ie.BYTE&&(s||St.DEFAULT_BYTE_MODE_ENCODING!==i)){const q=ie.getCharacterSetECIByName(i);q!==void 0&&this.appendECI(q,l)}this.appendModeInfo(o,l);const u=new _e;this.appendBytes(e,o,u,i);let h;if(n!==null&&n.get(Lt.QR_VERSION)!==void 0){const q=Number.parseInt(n.get(Lt.QR_VERSION).toString(),10);h=Ae.getVersionForNumber(q);const Q=this.calculateBitsNeeded(o,l,u,h);if(!this.willFit(Q,h,t))throw new mt("Data too big for requested version")}else h=this.recommendVersion(t,o,l,u);const p=new _e;p.appendBitArray(l);const A=o===Ie.BYTE?u.getSizeInBytes():e.length;this.appendLengthInfo(A,h,o,p),p.appendBitArray(u);const b=h.getECBlocksForLevel(t),L=h.getTotalCodewords()-b.getTotalECCodewords();this.terminateBits(L,p);const E=this.interleaveWithECBytes(p,h.getTotalCodewords(),L,b.getNumBlocks()),M=new Sr;M.setECLevel(t),M.setMode(o),M.setVersion(h);const D=h.getDimensionForVersion(),P=new $n(D,D),K=this.chooseMaskPattern(E,t,h,P);return M.setMaskPattern(K),be.buildMatrix(E,t,h,K,P),M.setMatrix(P),M}static recommendVersion(e,t,n,i){const s=this.calculateBitsNeeded(t,n,i,Ae.getVersionForNumber(1)),o=this.chooseVersion(s,e),l=this.calculateBitsNeeded(t,n,i,o);return this.chooseVersion(l,e)}static calculateBitsNeeded(e,t,n,i){return t.getSize()+e.getCharacterCountBits(i)+n.getSize()}static getAlphanumericCode(e){return e<St.ALPHANUMERIC_TABLE.length?St.ALPHANUMERIC_TABLE[e]:-1}static chooseMode(e,t=null){if(ie.SJIS.getName()===t&&this.isOnlyDoubleByteKanji(e))return Ie.KANJI;let n=!1,i=!1;for(let s=0,o=e.length;s<o;++s){const l=e.charAt(s);if(St.isDigit(l))n=!0;else if(this.getAlphanumericCode(l.charCodeAt(0))!==-1)i=!0;else return Ie.BYTE}return i?Ie.ALPHANUMERIC:n?Ie.NUMERIC:Ie.BYTE}static isOnlyDoubleByteKanji(e){let t;try{t=en.encode(e,ie.SJIS)}catch{return!1}const n=t.length;if(n%2!==0)return!1;for(let i=0;i<n;i+=2){const s=t[i]&255;if((s<129||s>159)&&(s<224||s>235))return!1}return!0}static chooseMaskPattern(e,t,n,i){let s=Number.MAX_SAFE_INTEGER,o=-1;for(let l=0;l<Sr.NUM_MASK_PATTERNS;l++){be.buildMatrix(e,t,n,l,i);let u=this.calculateMaskPenalty(i);u<s&&(s=u,o=l)}return o}static chooseVersion(e,t){for(let n=1;n<=40;n++){const i=Ae.getVersionForNumber(n);if(St.willFit(e,i,t))return i}throw new mt("Data too big")}static willFit(e,t,n){const i=t.getTotalCodewords(),o=t.getECBlocksForLevel(n).getTotalECCodewords(),l=i-o,u=(e+7)/8;return l>=u}static terminateBits(e,t){const n=e*8;if(t.getSize()>n)throw new mt("data bits cannot fit in the QR Code"+t.getSize()+" > "+n);for(let o=0;o<4&&t.getSize()<n;++o)t.appendBit(!1);const i=t.getSize()&7;if(i>0)for(let o=i;o<8;o++)t.appendBit(!1);const s=e-t.getSizeInBytes();for(let o=0;o<s;++o)t.appendBits((o&1)===0?236:17,8);if(t.getSize()!==n)throw new mt("Bits size does not equal capacity")}static getNumDataBytesAndNumECBytesForBlockID(e,t,n,i,s,o){if(i>=n)throw new mt("Block ID too large");const l=e%n,u=n-l,h=Math.floor(e/n),p=h+1,A=Math.floor(t/n),b=A+1,L=h-A,E=p-b;if(L!==E)throw new mt("EC bytes mismatch");if(n!==u+l)throw new mt("RS blocks mismatch");if(e!==(A+L)*u+(b+E)*l)throw new mt("Total bytes mismatch");i<u?(s[0]=A,o[0]=L):(s[0]=b,o[0]=E)}static interleaveWithECBytes(e,t,n,i){if(e.getSizeInBytes()!==n)throw new mt("Number of bits and data bytes does not match");let s=0,o=0,l=0;const u=new Array;for(let p=0;p<i;++p){const A=new Int32Array(1),b=new Int32Array(1);St.getNumDataBytesAndNumECBytesForBlockID(t,n,i,p,A,b);const L=A[0],E=new Uint8Array(L);e.toBytes(8*s,E,0,L);const M=St.generateECBytes(E,b[0]);u.push(new Ya(E,M)),o=Math.max(o,L),l=Math.max(l,M.length),s+=A[0]}if(n!==s)throw new mt("Data bytes does not match offset");const h=new _e;for(let p=0;p<o;++p)for(const A of u){const b=A.getDataBytes();p<b.length&&h.appendBits(b[p],8)}for(let p=0;p<l;++p)for(const A of u){const b=A.getErrorCorrectionBytes();p<b.length&&h.appendBits(b[p],8)}if(t!==h.getSizeInBytes())throw new mt("Interleaving error: "+t+" and "+h.getSizeInBytes()+" differ.");return h}static generateECBytes(e,t){const n=e.length,i=new Int32Array(n+t);for(let o=0;o<n;o++)i[o]=e[o]&255;new Fi($e.QR_CODE_FIELD_256).encode(i,t);const s=new Uint8Array(t);for(let o=0;o<t;o++)s[o]=i[n+o];return s}static appendModeInfo(e,t){t.appendBits(e.getBits(),4)}static appendLengthInfo(e,t,n,i){const s=n.getCharacterCountBits(t);if(e>=1<<s)throw new mt(e+" is bigger than "+((1<<s)-1));i.appendBits(e,s)}static appendBytes(e,t,n,i){switch(t){case Ie.NUMERIC:St.appendNumericBytes(e,n);break;case Ie.ALPHANUMERIC:St.appendAlphanumericBytes(e,n);break;case Ie.BYTE:St.append8BitBytes(e,n,i);break;case Ie.KANJI:St.appendKanjiBytes(e,n);break;default:throw new mt("Invalid mode: "+t)}}static getDigit(e){return e.charCodeAt(0)-48}static isDigit(e){const t=St.getDigit(e);return t>=0&&t<=9}static appendNumericBytes(e,t){const n=e.length;let i=0;for(;i<n;){const s=St.getDigit(e.charAt(i));if(i+2<n){const o=St.getDigit(e.charAt(i+1)),l=St.getDigit(e.charAt(i+2));t.appendBits(s*100+o*10+l,10),i+=3}else if(i+1<n){const o=St.getDigit(e.charAt(i+1));t.appendBits(s*10+o,7),i+=2}else t.appendBits(s,4),i++}}static appendAlphanumericBytes(e,t){const n=e.length;let i=0;for(;i<n;){const s=St.getAlphanumericCode(e.charCodeAt(i));if(s===-1)throw new mt;if(i+1<n){const o=St.getAlphanumericCode(e.charCodeAt(i+1));if(o===-1)throw new mt;t.appendBits(s*45+o,11),i+=2}else t.appendBits(s,6),i++}}static append8BitBytes(e,t,n){let i;try{i=en.encode(e,n)}catch(s){throw new mt(s)}for(let s=0,o=i.length;s!==o;s++){const l=i[s];t.appendBits(l,8)}}static appendKanjiBytes(e,t){let n;try{n=en.encode(e,ie.SJIS)}catch(s){throw new mt(s)}const i=n.length;for(let s=0;s<i;s+=2){const o=n[s]&255,l=n[s+1]&255,u=o<<8&4294967295|l;let h=-1;if(u>=33088&&u<=40956?h=u-33088:u>=57408&&u<=60351&&(h=u-49472),h===-1)throw new mt("Invalid byte sequence");const p=(h>>8)*192+(h&255);t.appendBits(p,13)}}static appendECI(e,t){t.appendBits(Ie.ECI.getBits(),4),t.appendBits(e.getValue(),8)}}St.ALPHANUMERIC_TABLE=Int32Array.from([-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,36,-1,-1,-1,37,38,-1,-1,-1,-1,39,40,-1,41,42,43,0,1,2,3,4,5,6,7,8,9,44,-1,-1,-1,-1,-1,-1,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,-1,-1,-1,-1,-1]),St.DEFAULT_BYTE_MODE_ENCODING=ie.UTF8.getName();class Qr{write(e,t,n,i=null){if(e.length===0)throw new H("Found empty contents");if(t<0||n<0)throw new H("Requested dimensions are too small: "+t+"x"+n);let s=pt.L,o=Qr.QUIET_ZONE_SIZE;i!==null&&(i.get(Lt.ERROR_CORRECTION)!==void 0&&(s=pt.fromString(i.get(Lt.ERROR_CORRECTION).toString())),i.get(Lt.MARGIN)!==void 0&&(o=Number.parseInt(i.get(Lt.MARGIN).toString(),10)));const l=St.encode(e,s,i);return this.renderResult(l,t,n,o)}writeToDom(e,t,n,i,s=null){typeof e=="string"&&(e=document.querySelector(e));const o=this.write(t,n,i,s);e&&e.appendChild(o)}renderResult(e,t,n,i){const s=e.getMatrix();if(s===null)throw new un;const o=s.getWidth(),l=s.getHeight(),u=o+i*2,h=l+i*2,p=Math.max(t,u),A=Math.max(n,h),b=Math.min(Math.floor(p/u),Math.floor(A/h)),L=Math.floor((p-o*b)/2),E=Math.floor((A-l*b)/2),M=this.createSVGElement(p,A);for(let D=0,P=E;D<l;D++,P+=b)for(let K=0,q=L;K<o;K++,q+=b)if(s.get(K,D)===1){const Q=this.createSvgRectElement(q,P,b,b);M.appendChild(Q)}return M}createSVGElement(e,t){const n=document.createElementNS(Qr.SVG_NS,"svg");return n.setAttributeNS(null,"height",e.toString()),n.setAttributeNS(null,"width",t.toString()),n}createSvgRectElement(e,t,n,i){const s=document.createElementNS(Qr.SVG_NS,"rect");return s.setAttributeNS(null,"x",e.toString()),s.setAttributeNS(null,"y",t.toString()),s.setAttributeNS(null,"height",n.toString()),s.setAttributeNS(null,"width",i.toString()),s.setAttributeNS(null,"fill","#000000"),s}}Qr.QUIET_ZONE_SIZE=4,Qr.SVG_NS="http://www.w3.org/2000/svg";class Jr{encode(e,t,n,i,s){if(e.length===0)throw new H("Found empty contents");if(t!==me.QR_CODE)throw new H("Can only encode QR_CODE, but got "+t);if(n<0||i<0)throw new H(`Requested dimensions are too small: ${n}x${i}`);let o=pt.L,l=Jr.QUIET_ZONE_SIZE;s!==null&&(s.get(Lt.ERROR_CORRECTION)!==void 0&&(o=pt.fromString(s.get(Lt.ERROR_CORRECTION).toString())),s.get(Lt.MARGIN)!==void 0&&(l=Number.parseInt(s.get(Lt.MARGIN).toString(),10)));const u=St.encode(e,o,s);return Jr.renderResult(u,n,i,l)}static renderResult(e,t,n,i){const s=e.getMatrix();if(s===null)throw new un;const o=s.getWidth(),l=s.getHeight(),u=o+i*2,h=l+i*2,p=Math.max(t,u),A=Math.max(n,h),b=Math.min(Math.floor(p/u),Math.floor(A/h)),L=Math.floor((p-o*b)/2),E=Math.floor((A-l*b)/2),M=new Mt(p,A);for(let D=0,P=E;D<l;D++,P+=b)for(let K=0,q=L;K<o;K++,q+=b)s.get(K,D)===1&&M.setRegion(q,P,b,b);return M}}Jr.QUIET_ZONE_SIZE=4;class ns{encode(e,t,n,i,s){let o;switch(t){case me.QR_CODE:o=new Jr;break;default:throw new H("No encoder available for format "+t)}return o.encode(e,t,n,i,s)}}class yn extends bn{constructor(e,t,n,i,s,o,l,u){if(super(o,l),this.yuvData=e,this.dataWidth=t,this.dataHeight=n,this.left=i,this.top=s,i+o>t||s+l>n)throw new H("Crop rectangle does not fit within image data.");u&&this.reverseHorizontal(o,l)}getRow(e,t){if(e<0||e>=this.getHeight())throw new H("Requested row is outside the image: "+e);const n=this.getWidth();(t==null||t.length<n)&&(t=new Uint8ClampedArray(n));const i=(e+this.top)*this.dataWidth+this.left;return ge.arraycopy(this.yuvData,i,t,0,n),t}getMatrix(){const e=this.getWidth(),t=this.getHeight();if(e===this.dataWidth&&t===this.dataHeight)return this.yuvData;const n=e*t,i=new Uint8ClampedArray(n);let s=this.top*this.dataWidth+this.left;if(e===this.dataWidth)return ge.arraycopy(this.yuvData,s,i,0,n),i;for(let o=0;o<t;o++){const l=o*e;ge.arraycopy(this.yuvData,s,i,l,e),s+=this.dataWidth}return i}isCropSupported(){return!0}crop(e,t,n,i){return new yn(this.yuvData,this.dataWidth,this.dataHeight,this.left+e,this.top+t,n,i,!1)}renderThumbnail(){const e=this.getWidth()/yn.THUMBNAIL_SCALE_FACTOR,t=this.getHeight()/yn.THUMBNAIL_SCALE_FACTOR,n=new Int32Array(e*t),i=this.yuvData;let s=this.top*this.dataWidth+this.left;for(let o=0;o<t;o++){const l=o*e;for(let u=0;u<e;u++){const h=i[s+u*yn.THUMBNAIL_SCALE_FACTOR]&255;n[l+u]=4278190080|h*65793}s+=this.dataWidth*yn.THUMBNAIL_SCALE_FACTOR}return n}getThumbnailWidth(){return this.getWidth()/yn.THUMBNAIL_SCALE_FACTOR}getThumbnailHeight(){return this.getHeight()/yn.THUMBNAIL_SCALE_FACTOR}reverseHorizontal(e,t){const n=this.yuvData;for(let i=0,s=this.top*this.dataWidth+this.left;i<t;i++,s+=this.dataWidth){const o=s+e/2;for(let l=s,u=s+e-1;l<o;l++,u--){const h=n[l];n[l]=n[u],n[u]=h}}}invert(){return new Qn(this)}}yn.THUMBNAIL_SCALE_FACTOR=2;class Es extends bn{constructor(e,t,n,i,s,o,l){if(super(t,n),this.dataWidth=i,this.dataHeight=s,this.left=o,this.top=l,e.BYTES_PER_ELEMENT===4){const u=t*n,h=new Uint8ClampedArray(u);for(let p=0;p<u;p++){const A=e[p],b=A>>16&255,L=A>>7&510,E=A&255;h[p]=(b+L+E)/4&255}this.luminances=h}else this.luminances=e;if(i===void 0&&(this.dataWidth=t),s===void 0&&(this.dataHeight=n),o===void 0&&(this.left=0),l===void 0&&(this.top=0),this.left+t>this.dataWidth||this.top+n>this.dataHeight)throw new H("Crop rectangle does not fit within image data.")}getRow(e,t){if(e<0||e>=this.getHeight())throw new H("Requested row is outside the image: "+e);const n=this.getWidth();(t==null||t.length<n)&&(t=new Uint8ClampedArray(n));const i=(e+this.top)*this.dataWidth+this.left;return ge.arraycopy(this.luminances,i,t,0,n),t}getMatrix(){const e=this.getWidth(),t=this.getHeight();if(e===this.dataWidth&&t===this.dataHeight)return this.luminances;const n=e*t,i=new Uint8ClampedArray(n);let s=this.top*this.dataWidth+this.left;if(e===this.dataWidth)return ge.arraycopy(this.luminances,s,i,0,n),i;for(let o=0;o<t;o++){const l=o*e;ge.arraycopy(this.luminances,s,i,l,e),s+=this.dataWidth}return i}isCropSupported(){return!0}crop(e,t,n,i){return new Es(this.luminances,n,i,this.dataWidth,this.dataHeight,this.left+e,this.top+t)}invert(){return new Qn(this)}}class ys extends ie{static forName(e){return this.getCharacterSetECIByName(e)}}class rs{}rs.ISO_8859_1=ie.ISO8859_1;class is{isCompact(){return this.compact}setCompact(e){this.compact=e}getSize(){return this.size}setSize(e){this.size=e}getLayers(){return this.layers}setLayers(e){this.layers=e}getCodeWords(){return this.codeWords}setCodeWords(e){this.codeWords=e}getMatrix(){return this.matrix}setMatrix(e){this.matrix=e}}class ss{static singletonList(e){return[e]}static min(e,t){return e.sort(t)[0]}}class na{constructor(e){this.previous=e}getPrevious(){return this.previous}}class xi extends na{constructor(e,t,n){super(e),this.value=t,this.bitCount=n}appendTo(e,t){e.appendBits(this.value,this.bitCount)}add(e,t){return new xi(this,e,t)}addBinaryShift(e,t){return console.warn("addBinaryShift on SimpleToken, this simply returns a copy of this token"),new xi(this,e,t)}toString(){let e=this.value&(1<<this.bitCount)-1;return e|=1<<this.bitCount,"<"+fe.toBinaryString(e|1<<this.bitCount).substring(1)+">"}}class Ui extends xi{constructor(e,t,n){super(e,0,0),this.binaryShiftStart=t,this.binaryShiftByteCount=n}appendTo(e,t){for(let n=0;n<this.binaryShiftByteCount;n++)(n===0||n===31&&this.binaryShiftByteCount<=62)&&(e.appendBits(31,5),this.binaryShiftByteCount>62?e.appendBits(this.binaryShiftByteCount-31,16):n===0?e.appendBits(Math.min(this.binaryShiftByteCount,31),5):e.appendBits(this.binaryShiftByteCount-31,5)),e.appendBits(t[this.binaryShiftStart+n],8)}addBinaryShift(e,t){return new Ui(this,e,t)}toString(){return"<"+this.binaryShiftStart+"::"+(this.binaryShiftStart+this.binaryShiftByteCount-1)+">"}}function Is(w,e,t){return new Ui(w,e,t)}function ji(w,e,t){return new xi(w,e,t)}const ra=["UPPER","LOWER","DIGIT","MIXED","PUNCT"],zt=0,pi=1,hn=2,bs=3,er=4,Xa=new xi(null,0,0),_s=[Int32Array.from([0,(5<<16)+28,(5<<16)+30,(5<<16)+29,656318]),Int32Array.from([(9<<16)+480+14,0,(5<<16)+30,(5<<16)+29,656318]),Int32Array.from([(4<<16)+14,(9<<16)+448+28,0,(9<<16)+448+29,932798]),Int32Array.from([(5<<16)+29,(5<<16)+28,656318,0,(5<<16)+30]),Int32Array.from([(5<<16)+31,656380,656382,656381,0])];function Za(w){for(let e of w)Ye.fill(e,-1);return w[zt][er]=0,w[pi][er]=0,w[pi][zt]=28,w[bs][er]=0,w[hn][er]=0,w[hn][zt]=15,w}const ia=Za(Ye.createInt32Array(6,6));class dr{constructor(e,t,n,i){this.token=e,this.mode=t,this.binaryShiftByteCount=n,this.bitCount=i}getMode(){return this.mode}getToken(){return this.token}getBinaryShiftByteCount(){return this.binaryShiftByteCount}getBitCount(){return this.bitCount}latchAndAppend(e,t){let n=this.bitCount,i=this.token;if(e!==this.mode){let o=_s[this.mode][e];i=ji(i,o&65535,o>>16),n+=o>>16}let s=e===hn?4:5;return i=ji(i,t,s),new dr(i,e,0,n+s)}shiftAndAppend(e,t){let n=this.token,i=this.mode===hn?4:5;return n=ji(n,ia[this.mode][e],i),n=ji(n,t,5),new dr(n,this.mode,0,this.bitCount+i+5)}addBinaryShiftChar(e){let t=this.token,n=this.mode,i=this.bitCount;if(this.mode===er||this.mode===hn){let l=_s[n][zt];t=ji(t,l&65535,l>>16),i+=l>>16,n=zt}let s=this.binaryShiftByteCount===0||this.binaryShiftByteCount===31?18:this.binaryShiftByteCount===62?9:8,o=new dr(t,n,this.binaryShiftByteCount+1,i+s);return o.binaryShiftByteCount===2078&&(o=o.endBinaryShift(e+1)),o}endBinaryShift(e){if(this.binaryShiftByteCount===0)return this;let t=this.token;return t=Is(t,e-this.binaryShiftByteCount,this.binaryShiftByteCount),new dr(t,this.mode,0,this.bitCount)}isBetterThanOrEqualTo(e){let t=this.bitCount+(_s[this.mode][e.mode]>>16);return this.binaryShiftByteCount<e.binaryShiftByteCount?t+=dr.calculateBinaryShiftCost(e)-dr.calculateBinaryShiftCost(this):this.binaryShiftByteCount>e.binaryShiftByteCount&&e.binaryShiftByteCount>0&&(t+=10),t<=e.bitCount}toBitArray(e){let t=[];for(let i=this.endBinaryShift(e.length).token;i!==null;i=i.getPrevious())t.unshift(i);let n=new _e;for(const i of t)i.appendTo(n,e);return n}toString(){return ye.format("%s bits=%d bytes=%d",ra[this.mode],this.bitCount,this.binaryShiftByteCount)}static calculateBinaryShiftCost(e){return e.binaryShiftByteCount>62?21:e.binaryShiftByteCount>31?20:e.binaryShiftByteCount>0?10:0}}dr.INITIAL_STATE=new dr(Xa,zt,0,0);function mi(w){const e=ye.getCharCode(" "),t=ye.getCharCode("."),n=ye.getCharCode(",");w[zt][e]=1;const i=ye.getCharCode("Z"),s=ye.getCharCode("A");for(let b=s;b<=i;b++)w[zt][b]=b-s+2;w[pi][e]=1;const o=ye.getCharCode("z"),l=ye.getCharCode("a");for(let b=l;b<=o;b++)w[pi][b]=b-l+2;w[hn][e]=1;const u=ye.getCharCode("9"),h=ye.getCharCode("0");for(let b=h;b<=u;b++)w[hn][b]=b-h+2;w[hn][n]=12,w[hn][t]=13;const p=["\0"," ","","","","","","","\x07","\b","	",`
`,"\v","\f","\r","\x1B","","","","","@","\\","^","_","`","|","~",""];for(let b=0;b<p.length;b++)w[bs][ye.getCharCode(p[b])]=b;const A=["\0","\r","\0","\0","\0","\0","!","'","#","$","%","&","'","(",")","*","+",",","-",".","/",":",";","<","=",">","?","[","]","{","}"];for(let b=0;b<A.length;b++)ye.getCharCode(A[b])>0&&(w[er][ye.getCharCode(A[b])]=b);return w}const Ss=mi(Ye.createInt32Array(5,256));class Hi{constructor(e){this.text=e}encode(){const e=ye.getCharCode(" "),t=ye.getCharCode(`
`);let n=ss.singletonList(dr.INITIAL_STATE);for(let s=0;s<this.text.length;s++){let o,l=s+1<this.text.length?this.text[s+1]:0;switch(this.text[s]){case ye.getCharCode("\r"):o=l===t?2:0;break;case ye.getCharCode("."):o=l===e?3:0;break;case ye.getCharCode(","):o=l===e?4:0;break;case ye.getCharCode(":"):o=l===e?5:0;break;default:o=0}o>0?(n=Hi.updateStateListForPair(n,s,o),s++):n=this.updateStateListForChar(n,s)}return ss.min(n,(s,o)=>s.getBitCount()-o.getBitCount()).toBitArray(this.text)}updateStateListForChar(e,t){const n=[];for(let i of e)this.updateStateForChar(i,t,n);return Hi.simplifyStates(n)}updateStateForChar(e,t,n){let i=this.text[t]&255,s=Ss[e.getMode()][i]>0,o=null;for(let l=0;l<=er;l++){let u=Ss[l][i];if(u>0){if(o==null&&(o=e.endBinaryShift(t)),!s||l===e.getMode()||l===hn){const h=o.latchAndAppend(l,u);n.push(h)}if(!s&&ia[e.getMode()][l]>=0){const h=o.shiftAndAppend(l,u);n.push(h)}}}if(e.getBinaryShiftByteCount()>0||Ss[e.getMode()][i]===0){let l=e.addBinaryShiftChar(t);n.push(l)}}static updateStateListForPair(e,t,n){const i=[];for(let s of e)this.updateStateForPair(s,t,n,i);return this.simplifyStates(i)}static updateStateForPair(e,t,n,i){let s=e.endBinaryShift(t);if(i.push(s.latchAndAppend(er,n)),e.getMode()!==er&&i.push(s.shiftAndAppend(er,n)),n===3||n===4){let o=s.latchAndAppend(hn,16-n).latchAndAppend(hn,1);i.push(o)}if(e.getBinaryShiftByteCount()>0){let o=e.addBinaryShiftChar(t).addBinaryShiftChar(t+1);i.push(o)}}static simplifyStates(e){let t=[];for(const n of e){let i=!0;for(const s of t){if(s.isBetterThanOrEqualTo(n)){i=!1;break}n.isBetterThanOrEqualTo(s)&&(t=t.filter(o=>o!==s))}i&&t.push(n)}return t}}class Qe{constructor(){}static encodeBytes(e){return Qe.encode(e,Qe.DEFAULT_EC_PERCENT,Qe.DEFAULT_AZTEC_LAYERS)}static encode(e,t,n){let i=new Hi(e).encode(),s=fe.truncDivision(i.getSize()*t,100)+11,o=i.getSize()+s,l,u,h,p,A;if(n!==Qe.DEFAULT_AZTEC_LAYERS){if(l=n<0,u=Math.abs(n),u>(l?Qe.MAX_NB_BITS_COMPACT:Qe.MAX_NB_BITS))throw new H(ye.format("Illegal value %s for layers",n));h=Qe.totalBitsInLayer(u,l),p=Qe.WORD_SIZE[u];let Q=h-h%p;if(A=Qe.stuffBits(i,p),A.getSize()+s>Q)throw new H("Data to large for user specified layer");if(l&&A.getSize()>p*64)throw new H("Data to large for user specified layer")}else{p=0,A=null;for(let Q=0;;Q++){if(Q>Qe.MAX_NB_BITS)throw new H("Data too large for an Aztec code");if(l=Q<=3,u=l?Q+1:Q,h=Qe.totalBitsInLayer(u,l),o>h)continue;(A==null||p!==Qe.WORD_SIZE[u])&&(p=Qe.WORD_SIZE[u],A=Qe.stuffBits(i,p));let xe=h-h%p;if(!(l&&A.getSize()>p*64)&&A.getSize()+s<=xe)break}}let b=Qe.generateCheckWords(A,h,p),L=A.getSize()/p,E=Qe.generateModeMessage(l,u,L),M=(l?11:14)+u*4,D=new Int32Array(M),P;if(l){P=M;for(let Q=0;Q<D.length;Q++)D[Q]=Q}else{P=M+1+2*fe.truncDivision(fe.truncDivision(M,2)-1,15);let Q=fe.truncDivision(M,2),xe=fe.truncDivision(P,2);for(let Pe=0;Pe<Q;Pe++){let Mn=Pe+fe.truncDivision(Pe,15);D[Q-Pe-1]=xe-Mn-1,D[Q+Pe]=xe+Mn+1}}let K=new Mt(P);for(let Q=0,xe=0;Q<u;Q++){let Pe=(u-Q)*4+(l?9:12);for(let Mn=0;Mn<Pe;Mn++){let Bt=Mn*2;for(let an=0;an<2;an++)b.get(xe+Bt+an)&&K.set(D[Q*2+an],D[Q*2+Mn]),b.get(xe+Pe*2+Bt+an)&&K.set(D[Q*2+Mn],D[M-1-Q*2-an]),b.get(xe+Pe*4+Bt+an)&&K.set(D[M-1-Q*2-an],D[M-1-Q*2-Mn]),b.get(xe+Pe*6+Bt+an)&&K.set(D[M-1-Q*2-Mn],D[Q*2+an])}xe+=Pe*8}if(Qe.drawModeMessage(K,l,P,E),l)Qe.drawBullsEye(K,fe.truncDivision(P,2),5);else{Qe.drawBullsEye(K,fe.truncDivision(P,2),7);for(let Q=0,xe=0;Q<fe.truncDivision(M,2)-1;Q+=15,xe+=16)for(let Pe=fe.truncDivision(P,2)&1;Pe<P;Pe+=2)K.set(fe.truncDivision(P,2)-xe,Pe),K.set(fe.truncDivision(P,2)+xe,Pe),K.set(Pe,fe.truncDivision(P,2)-xe),K.set(Pe,fe.truncDivision(P,2)+xe)}let q=new is;return q.setCompact(l),q.setSize(P),q.setLayers(u),q.setCodeWords(L),q.setMatrix(K),q}static drawBullsEye(e,t,n){for(let i=0;i<n;i+=2)for(let s=t-i;s<=t+i;s++)e.set(s,t-i),e.set(s,t+i),e.set(t-i,s),e.set(t+i,s);e.set(t-n,t-n),e.set(t-n+1,t-n),e.set(t-n,t-n+1),e.set(t+n,t-n),e.set(t+n,t-n+1),e.set(t+n,t+n-1)}static generateModeMessage(e,t,n){let i=new _e;return e?(i.appendBits(t-1,2),i.appendBits(n-1,6),i=Qe.generateCheckWords(i,28,4)):(i.appendBits(t-1,5),i.appendBits(n-1,11),i=Qe.generateCheckWords(i,40,4)),i}static drawModeMessage(e,t,n,i){let s=fe.truncDivision(n,2);if(t)for(let o=0;o<7;o++){let l=s-3+o;i.get(o)&&e.set(l,s-5),i.get(o+7)&&e.set(s+5,l),i.get(20-o)&&e.set(l,s+5),i.get(27-o)&&e.set(s-5,l)}else for(let o=0;o<10;o++){let l=s-5+o+fe.truncDivision(o,5);i.get(o)&&e.set(l,s-7),i.get(o+10)&&e.set(s+7,l),i.get(29-o)&&e.set(l,s+7),i.get(39-o)&&e.set(s-7,l)}}static generateCheckWords(e,t,n){let i=e.getSize()/n,s=new Fi(Qe.getGF(n)),o=fe.truncDivision(t,n),l=Qe.bitsToWords(e,n,o);s.encode(l,o-i);let u=t%n,h=new _e;h.appendBits(0,u);for(const p of Array.from(l))h.appendBits(p,n);return h}static bitsToWords(e,t,n){let i=new Int32Array(n),s,o;for(s=0,o=e.getSize()/t;s<o;s++){let l=0;for(let u=0;u<t;u++)l|=e.get(s*t+u)?1<<t-u-1:0;i[s]=l}return i}static getGF(e){switch(e){case 4:return $e.AZTEC_PARAM;case 6:return $e.AZTEC_DATA_6;case 8:return $e.AZTEC_DATA_8;case 10:return $e.AZTEC_DATA_10;case 12:return $e.AZTEC_DATA_12;default:throw new H("Unsupported word size "+e)}}static stuffBits(e,t){let n=new _e,i=e.getSize(),s=(1<<t)-2;for(let o=0;o<i;o+=t){let l=0;for(let u=0;u<t;u++)(o+u>=i||e.get(o+u))&&(l|=1<<t-1-u);(l&s)===s?(n.appendBits(l&s,t),o--):(l&s)===0?(n.appendBits(l|1,t),o--):n.appendBits(l,t)}return n}static totalBitsInLayer(e,t){return((t?88:112)+16*e)*e}}Qe.DEFAULT_EC_PERCENT=33,Qe.DEFAULT_AZTEC_LAYERS=0,Qe.MAX_NB_BITS=32,Qe.MAX_NB_BITS_COMPACT=4,Qe.WORD_SIZE=Int32Array.from([4,6,6,8,8,8,8,8,8,10,10,10,10,10,10,10,10,10,10,10,10,10,10,12,12,12,12,12,12,12,12,12,12]);class zi{encode(e,t,n,i){return this.encodeWithHints(e,t,n,i,null)}encodeWithHints(e,t,n,i,s){let o=rs.ISO_8859_1,l=Qe.DEFAULT_EC_PERCENT,u=Qe.DEFAULT_AZTEC_LAYERS;return s!=null&&(s.has(Lt.CHARACTER_SET)&&(o=ys.forName(s.get(Lt.CHARACTER_SET).toString())),s.has(Lt.ERROR_CORRECTION)&&(l=fe.parseInt(s.get(Lt.ERROR_CORRECTION).toString())),s.has(Lt.AZTEC_LAYERS)&&(u=fe.parseInt(s.get(Lt.AZTEC_LAYERS).toString()))),zi.encodeLayers(e,t,n,i,o,l,u)}static encodeLayers(e,t,n,i,s,o,l){if(t!==me.AZTEC)throw new H("Can only encode AZTEC, but got "+t);let u=Qe.encode(ye.getBytes(e,s),o,l);return zi.renderResult(u,n,i)}static renderResult(e,t,n){let i=e.getMatrix();if(i==null)throw new un;let s=i.getWidth(),o=i.getHeight(),l=Math.max(t,s),u=Math.max(n,o),h=Math.min(l/s,u/o),p=(l-s*h)/2,A=(u-o*h)/2,b=new Mt(l,u);for(let L=0,E=A;L<o;L++,E+=h)for(let M=0,D=p;M<s;M++,D+=h)i.get(M,L)&&b.setRegion(D,E,h,h);return b}}f.AbstractExpandedDecoder=hi,f.ArgumentException=z,f.ArithmeticException=Ar,f.AztecCode=is,f.AztecCodeReader=Er,f.AztecCodeWriter=zi,f.AztecDecoder=ut,f.AztecDetector=Rt,f.AztecDetectorResult=Yr,f.AztecEncoder=Qe,f.AztecHighLevelEncoder=Hi,f.AztecPoint=Tt,f.BarcodeFormat=me,f.Binarizer=ct,f.BinaryBitmap=Le,f.BitArray=_e,f.BitMatrix=Mt,f.BitSource=Sn,f.BrowserAztecCodeReader=Ni,f.BrowserBarcodeReader=Cn,f.BrowserCodeReader=Wn,f.BrowserDatamatrixCodeReader=Ji,f.BrowserMultiFormatReader=Yn,f.BrowserPDF417Reader=Va,f.BrowserQRCodeReader=ta,f.BrowserQRCodeSvgWriter=Qr,f.CharacterSetECI=ie,f.ChecksumException=Ee,f.Code128Reader=ae,f.Code39Reader=bt,f.DataMatrixDecodedBitStreamParser=kn,f.DataMatrixReader=Tn,f.DecodeHintType=Be,f.DecoderResult=cn,f.DefaultGridSampler=mn,f.DetectorResult=cr,f.EAN13Reader=Jn,f.EncodeHintType=Lt,f.Exception=T,f.FormatException=re,f.GenericGF=$e,f.GenericGFPoly=Yt,f.GlobalHistogramBinarizer=te,f.GridSampler=Cr,f.GridSamplerInstance=wn,f.HTMLCanvasElementLuminanceSource=xn,f.HybridBinarizer=Te,f.ITFReader=it,f.IllegalArgumentException=H,f.IllegalStateException=un,f.InvertedLuminanceSource=Qn,f.LuminanceSource=bn,f.MathUtils=Ke,f.MultiFormatOneDReader=at,f.MultiFormatReader=ea,f.MultiFormatWriter=ns,f.NotFoundException=v,f.OneDReader=Nt,f.PDF417DecodedBitStreamParser=G,f.PDF417DecoderErrorCorrection=Ks,f.PDF417Reader=$t,f.PDF417ResultMetadata=As,f.PerspectiveTransform=Bn,f.PlanarYUVLuminanceSource=yn,f.QRCodeByteMatrix=$n,f.QRCodeDataMask=Nn,f.QRCodeDecodedBitStreamParser=vt,f.QRCodeDecoderErrorCorrectionLevel=pt,f.QRCodeDecoderFormatInformation=rn,f.QRCodeEncoder=St,f.QRCodeEncoderQRCode=Sr,f.QRCodeMaskUtil=Re,f.QRCodeMatrixUtil=be,f.QRCodeMode=Ie,f.QRCodeReader=Ur,f.QRCodeVersion=Ae,f.QRCodeWriter=Jr,f.RGBLuminanceSource=Es,f.RSS14Reader=pe,f.RSSExpandedReader=V,f.ReaderException=fn,f.ReedSolomonDecoder=Vr,f.ReedSolomonEncoder=Fi,f.ReedSolomonException=Qt,f.Result=Ft,f.ResultMetadataType=gt,f.ResultPoint=le,f.StringUtils=ye,f.UnsupportedOperationException=Pr,f.VideoInputDevice=pn,f.WhiteRectangleDetector=Gn,f.WriterException=mt,f.ZXingArrays=Ye,f.ZXingCharset=ys,f.ZXingInteger=fe,f.ZXingStandardCharsets=rs,f.ZXingStringBuilder=rt,f.ZXingStringEncoding=en,f.ZXingSystem=ge,f.createAbstractExpandedDecoder=Ze,Object.defineProperty(f,"__esModule",{value:!0})}))})(Ys,Ys.exports)),Ys.exports}var Dt=Kg();const qg=mg(Dt),Qg=Rg({__proto__:null,default:qg},[Dt]);var Zc=(function(){function x(g,f,y){if(this.formatMap=new Map([[he.QR_CODE,Dt.BarcodeFormat.QR_CODE],[he.AZTEC,Dt.BarcodeFormat.AZTEC],[he.CODABAR,Dt.BarcodeFormat.CODABAR],[he.CODE_39,Dt.BarcodeFormat.CODE_39],[he.CODE_93,Dt.BarcodeFormat.CODE_93],[he.CODE_128,Dt.BarcodeFormat.CODE_128],[he.DATA_MATRIX,Dt.BarcodeFormat.DATA_MATRIX],[he.MAXICODE,Dt.BarcodeFormat.MAXICODE],[he.ITF,Dt.BarcodeFormat.ITF],[he.EAN_13,Dt.BarcodeFormat.EAN_13],[he.EAN_8,Dt.BarcodeFormat.EAN_8],[he.PDF_417,Dt.BarcodeFormat.PDF_417],[he.RSS_14,Dt.BarcodeFormat.RSS_14],[he.RSS_EXPANDED,Dt.BarcodeFormat.RSS_EXPANDED],[he.UPC_A,Dt.BarcodeFormat.UPC_A],[he.UPC_E,Dt.BarcodeFormat.UPC_E],[he.UPC_EAN_EXTENSION,Dt.BarcodeFormat.UPC_EAN_EXTENSION]]),this.reverseFormatMap=this.createReverseFormatMap(),!Qg)throw"Use html5qrcode.min.js without edit, ZXing not found.";this.verbose=f,this.logger=y;var S=this.createZXingFormats(g),m=new Map;m.set(Dt.DecodeHintType.POSSIBLE_FORMATS,S),m.set(Dt.DecodeHintType.TRY_HARDER,!1),this.hints=m}return x.prototype.decodeAsync=function(g){var f=this;return new Promise(function(y,S){try{y(f.decode(g))}catch(m){S(m)}})},x.prototype.decode=function(g){var f=new Dt.MultiFormatReader(this.verbose,this.hints),y=new Dt.HTMLCanvasElementLuminanceSource(g),S=new Dt.BinaryBitmap(new Dt.HybridBinarizer(y)),m=f.decode(S);return{text:m.text,format:su.create(this.toHtml5QrcodeSupportedFormats(m.format)),debugData:this.createDebugData()}},x.prototype.createReverseFormatMap=function(){var g=new Map;return this.formatMap.forEach(function(f,y,S){g.set(f,y)}),g},x.prototype.toHtml5QrcodeSupportedFormats=function(g){if(!this.reverseFormatMap.has(g))throw"reverseFormatMap doesn't have ".concat(g);return this.reverseFormatMap.get(g)},x.prototype.createZXingFormats=function(g){for(var f=[],y=0,S=g;y<S.length;y++){var m=S[y];this.formatMap.has(m)?f.push(this.formatMap.get(m)):this.logger.logError("".concat(m," is not supported by")+"ZXingHtml5QrcodeShim")}return f},x.prototype.createDebugData=function(){return{decoderName:"zxing-js"}},x})(),Jg=function(x,g,f,y){function S(m){return m instanceof f?m:new f(function(F){F(m)})}return new(f||(f=Promise))(function(m,F){function W(z){try{T(y.next(z))}catch(H){F(H)}}function Z(z){try{T(y.throw(z))}catch(H){F(H)}}function T(z){z.done?m(z.value):S(z.value).then(W,Z)}T((y=y.apply(x,g||[])).next())})},$g=function(x,g){var f={label:0,sent:function(){if(m[0]&1)throw m[1];return m[1]},trys:[],ops:[]},y,S,m,F;return F={next:W(0),throw:W(1),return:W(2)},typeof Symbol=="function"&&(F[Symbol.iterator]=function(){return this}),F;function W(T){return function(z){return Z([T,z])}}function Z(T){if(y)throw new TypeError("Generator is already executing.");for(;F&&(F=0,T[0]&&(f=0)),f;)try{if(y=1,S&&(m=T[0]&2?S.return:T[0]?S.throw||((m=S.return)&&m.call(S),0):S.next)&&!(m=m.call(S,T[1])).done)return m;switch(S=0,m&&(T=[T[0]&2,m.value]),T[0]){case 0:case 1:m=T;break;case 4:return f.label++,{value:T[1],done:!1};case 5:f.label++,S=T[1],T=[0];continue;case 7:T=f.ops.pop(),f.trys.pop();continue;default:if(m=f.trys,!(m=m.length>0&&m[m.length-1])&&(T[0]===6||T[0]===2)){f=0;continue}if(T[0]===3&&(!m||T[1]>m[0]&&T[1]<m[3])){f.label=T[1];break}if(T[0]===6&&f.label<m[1]){f.label=m[1],m=T;break}if(m&&f.label<m[2]){f.label=m[2],f.ops.push(T);break}m[2]&&f.ops.pop(),f.trys.pop();continue}T=g.call(x,f)}catch(z){T=[6,z],S=0}finally{y=m=0}if(T[0]&5)throw T[1];return{value:T[0]?T[1]:void 0,done:!0}}},Kc=(function(){function x(g,f,y){if(this.formatMap=new Map([[he.QR_CODE,"qr_code"],[he.AZTEC,"aztec"],[he.CODABAR,"codabar"],[he.CODE_39,"code_39"],[he.CODE_93,"code_93"],[he.CODE_128,"code_128"],[he.DATA_MATRIX,"data_matrix"],[he.ITF,"itf"],[he.EAN_13,"ean_13"],[he.EAN_8,"ean_8"],[he.PDF_417,"pdf417"],[he.UPC_A,"upc_a"],[he.UPC_E,"upc_e"]]),this.reverseFormatMap=this.createReverseFormatMap(),!x.isSupported())throw"Use html5qrcode.min.js without edit, Use BarcodeDetectorDelegate only if it isSupported();";this.verbose=f,this.logger=y;var S=this.createBarcodeDetectorFormats(g);if(this.detector=new BarcodeDetector(S),!this.detector)throw"BarcodeDetector detector not supported"}return x.isSupported=function(){if(!("BarcodeDetector"in window))return!1;var g=new BarcodeDetector({formats:["qr_code"]});return typeof g<"u"},x.prototype.decodeAsync=function(g){return Jg(this,void 0,void 0,function(){var f,y;return $g(this,function(S){switch(S.label){case 0:return[4,this.detector.detect(g)];case 1:if(f=S.sent(),!f||f.length===0)throw"No barcode or QR code detected.";return y=this.selectLargestBarcode(f),[2,{text:y.rawValue,format:su.create(this.toHtml5QrcodeSupportedFormats(y.format)),debugData:this.createDebugData()}]}})})},x.prototype.selectLargestBarcode=function(g){for(var f=null,y=0,S=0,m=g;S<m.length;S++){var F=m[S],W=F.boundingBox.width*F.boundingBox.height;W>y&&(y=W,f=F)}if(!f)throw"No largest barcode found";return f},x.prototype.createBarcodeDetectorFormats=function(g){for(var f=[],y=0,S=g;y<S.length;y++){var m=S[y];this.formatMap.has(m)?f.push(this.formatMap.get(m)):this.logger.warn("".concat(m," is not supported by")+"BarcodeDetectorDelegate")}return{formats:f}},x.prototype.toHtml5QrcodeSupportedFormats=function(g){if(!this.reverseFormatMap.has(g))throw"reverseFormatMap doesn't have ".concat(g);return this.reverseFormatMap.get(g)},x.prototype.createReverseFormatMap=function(){var g=new Map;return this.formatMap.forEach(function(f,y,S){g.set(f,y)}),g},x.prototype.createDebugData=function(){return{decoderName:"BarcodeDetector"}},x})(),qc=function(x,g,f,y){function S(m){return m instanceof f?m:new f(function(F){F(m)})}return new(f||(f=Promise))(function(m,F){function W(z){try{T(y.next(z))}catch(H){F(H)}}function Z(z){try{T(y.throw(z))}catch(H){F(H)}}function T(z){z.done?m(z.value):S(z.value).then(W,Z)}T((y=y.apply(x,g||[])).next())})},Qc=function(x,g){var f={label:0,sent:function(){if(m[0]&1)throw m[1];return m[1]},trys:[],ops:[]},y,S,m,F;return F={next:W(0),throw:W(1),return:W(2)},typeof Symbol=="function"&&(F[Symbol.iterator]=function(){return this}),F;function W(T){return function(z){return Z([T,z])}}function Z(T){if(y)throw new TypeError("Generator is already executing.");for(;F&&(F=0,T[0]&&(f=0)),f;)try{if(y=1,S&&(m=T[0]&2?S.return:T[0]?S.throw||((m=S.return)&&m.call(S),0):S.next)&&!(m=m.call(S,T[1])).done)return m;switch(S=0,m&&(T=[T[0]&2,m.value]),T[0]){case 0:case 1:m=T;break;case 4:return f.label++,{value:T[1],done:!1};case 5:f.label++,S=T[1],T=[0];continue;case 7:T=f.ops.pop(),f.trys.pop();continue;default:if(m=f.trys,!(m=m.length>0&&m[m.length-1])&&(T[0]===6||T[0]===2)){f=0;continue}if(T[0]===3&&(!m||T[1]>m[0]&&T[1]<m[3])){f.label=T[1];break}if(T[0]===6&&f.label<m[1]){f.label=m[1],m=T;break}if(m&&f.label<m[2]){f.label=m[2],f.ops.push(T);break}m[2]&&f.ops.pop(),f.trys.pop();continue}T=g.call(x,f)}catch(z){T=[6,z],S=0}finally{y=m=0}if(T[0]&5)throw T[1];return{value:T[0]?T[1]:void 0,done:!0}}},e2=(function(){function x(g,f,y,S){this.EXECUTIONS_TO_REPORT_PERFORMANCE=100,this.executions=0,this.executionResults=[],this.wasPrimaryDecoderUsedInLastDecode=!1,this.verbose=y,f&&Kc.isSupported()?(this.primaryDecoder=new Kc(g,y,S),this.secondaryDecoder=new Zc(g,y,S)):this.primaryDecoder=new Zc(g,y,S)}return x.prototype.decodeAsync=function(g){return qc(this,void 0,void 0,function(){var f;return Qc(this,function(y){switch(y.label){case 0:f=performance.now(),y.label=1;case 1:return y.trys.push([1,,3,4]),[4,this.getDecoder().decodeAsync(g)];case 2:return[2,y.sent()];case 3:return this.possiblyLogPerformance(f),[7];case 4:return[2]}})})},x.prototype.decodeRobustlyAsync=function(g){return qc(this,void 0,void 0,function(){var f,y;return Qc(this,function(S){switch(S.label){case 0:f=performance.now(),S.label=1;case 1:return S.trys.push([1,3,4,5]),[4,this.primaryDecoder.decodeAsync(g)];case 2:return[2,S.sent()];case 3:if(y=S.sent(),this.secondaryDecoder)return[2,this.secondaryDecoder.decodeAsync(g)];throw y;case 4:return this.possiblyLogPerformance(f),[7];case 5:return[2]}})})},x.prototype.getDecoder=function(){return this.secondaryDecoder?this.wasPrimaryDecoderUsedInLastDecode===!1?(this.wasPrimaryDecoderUsedInLastDecode=!0,this.primaryDecoder):(this.wasPrimaryDecoderUsedInLastDecode=!1,this.secondaryDecoder):this.primaryDecoder},x.prototype.possiblyLogPerformance=function(g){if(this.verbose){var f=performance.now()-g;this.executionResults.push(f),this.executions++,this.possiblyFlushPerformanceReport()}},x.prototype.possiblyFlushPerformanceReport=function(){if(!(this.executions<this.EXECUTIONS_TO_REPORT_PERFORMANCE)){for(var g=0,f=0,y=this.executionResults;f<y.length;f++){var S=y[f];g+=S}var m=g/this.executionResults.length;console.log("".concat(m," ms for ").concat(this.executionResults.length," last runs.")),this.executions=0,this.executionResults=[]}},x})(),Zo=(function(){var x=function(g,f){return x=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(y,S){y.__proto__=S}||function(y,S){for(var m in S)Object.prototype.hasOwnProperty.call(S,m)&&(y[m]=S[m])},x(g,f)};return function(g,f){if(typeof f!="function"&&f!==null)throw new TypeError("Class extends value "+String(f)+" is not a constructor or null");x(g,f);function y(){this.constructor=g}g.prototype=f===null?Object.create(f):(y.prototype=f.prototype,new y)}})(),ja=function(x,g,f,y){function S(m){return m instanceof f?m:new f(function(F){F(m)})}return new(f||(f=Promise))(function(m,F){function W(z){try{T(y.next(z))}catch(H){F(H)}}function Z(z){try{T(y.throw(z))}catch(H){F(H)}}function T(z){z.done?m(z.value):S(z.value).then(W,Z)}T((y=y.apply(x,g||[])).next())})},Ha=function(x,g){var f={label:0,sent:function(){if(m[0]&1)throw m[1];return m[1]},trys:[],ops:[]},y,S,m,F;return F={next:W(0),throw:W(1),return:W(2)},typeof Symbol=="function"&&(F[Symbol.iterator]=function(){return this}),F;function W(T){return function(z){return Z([T,z])}}function Z(T){if(y)throw new TypeError("Generator is already executing.");for(;F&&(F=0,T[0]&&(f=0)),f;)try{if(y=1,S&&(m=T[0]&2?S.return:T[0]?S.throw||((m=S.return)&&m.call(S),0):S.next)&&!(m=m.call(S,T[1])).done)return m;switch(S=0,m&&(T=[T[0]&2,m.value]),T[0]){case 0:case 1:m=T;break;case 4:return f.label++,{value:T[1],done:!1};case 5:f.label++,S=T[1],T=[0];continue;case 7:T=f.ops.pop(),f.trys.pop();continue;default:if(m=f.trys,!(m=m.length>0&&m[m.length-1])&&(T[0]===6||T[0]===2)){f=0;continue}if(T[0]===3&&(!m||T[1]>m[0]&&T[1]<m[3])){f.label=T[1];break}if(T[0]===6&&f.label<m[1]){f.label=m[1],m=T;break}if(m&&f.label<m[2]){f.label=m[2],f.ops.push(T);break}m[2]&&f.ops.pop(),f.trys.pop();continue}T=g.call(x,f)}catch(z){T=[6,z],S=0}finally{y=m=0}if(T[0]&5)throw T[1];return{value:T[0]?T[1]:void 0,done:!0}}},cu=(function(){function x(g,f){this.name=g,this.track=f}return x.prototype.isSupported=function(){return this.track.getCapabilities?this.name in this.track.getCapabilities():!1},x.prototype.apply=function(g){var f={};f[this.name]=g;var y={advanced:[f]};return this.track.applyConstraints(y)},x.prototype.value=function(){var g=this.track.getSettings();if(this.name in g){var f=g[this.name];return f}return null},x})(),t2=(function(x){Zo(g,x);function g(f,y){return x.call(this,f,y)||this}return g.prototype.min=function(){return this.getCapabilities().min},g.prototype.max=function(){return this.getCapabilities().max},g.prototype.step=function(){return this.getCapabilities().step},g.prototype.apply=function(f){var y={};y[this.name]=f;var S={advanced:[y]};return this.track.applyConstraints(S)},g.prototype.getCapabilities=function(){this.failIfNotSupported();var f=this.track.getCapabilities(),y=f[this.name];return{min:y.min,max:y.max,step:y.step}},g.prototype.failIfNotSupported=function(){if(!this.isSupported())throw new Error("".concat(this.name," capability not supported"))},g})(cu),n2=(function(x){Zo(g,x);function g(f){return x.call(this,"zoom",f)||this}return g})(t2),r2=(function(x){Zo(g,x);function g(f){return x.call(this,"torch",f)||this}return g})(cu),i2=(function(){function x(g){this.track=g}return x.prototype.zoomFeature=function(){return new n2(this.track)},x.prototype.torchFeature=function(){return new r2(this.track)},x})(),s2=(function(){function x(g,f,y){this.isClosed=!1,this.parentElement=g,this.mediaStream=f,this.callbacks=y,this.surface=this.createVideoElement(this.parentElement.clientWidth),g.append(this.surface)}return x.prototype.createVideoElement=function(g){var f=document.createElement("video");return f.style.width="".concat(g,"px"),f.style.display="block",f.muted=!0,f.setAttribute("muted","true"),f.playsInline=!0,f},x.prototype.setupSurface=function(){var g=this;this.surface.onabort=function(){throw"RenderedCameraImpl video surface onabort() called"},this.surface.onerror=function(){throw"RenderedCameraImpl video surface onerror() called"};var f=function(){var y=g.surface.clientWidth,S=g.surface.clientHeight;g.callbacks.onRenderSurfaceReady(y,S),g.surface.removeEventListener("playing",f)};this.surface.addEventListener("playing",f),this.surface.srcObject=this.mediaStream,this.surface.play()},x.create=function(g,f,y,S){return ja(this,void 0,void 0,function(){var m,F;return Ha(this,function(W){switch(W.label){case 0:return m=new x(g,f,S),y.aspectRatio?(F={aspectRatio:y.aspectRatio},[4,m.getFirstTrackOrFail().applyConstraints(F)]):[3,2];case 1:W.sent(),W.label=2;case 2:return m.setupSurface(),[2,m]}})})},x.prototype.failIfClosed=function(){if(this.isClosed)throw"The RenderedCamera has already been closed."},x.prototype.getFirstTrackOrFail=function(){if(this.failIfClosed(),this.mediaStream.getVideoTracks().length===0)throw"No video tracks found";return this.mediaStream.getVideoTracks()[0]},x.prototype.pause=function(){this.failIfClosed(),this.surface.pause()},x.prototype.resume=function(g){this.failIfClosed();var f=this,y=function(){setTimeout(g,200),f.surface.removeEventListener("playing",y)};this.surface.addEventListener("playing",y),this.surface.play()},x.prototype.isPaused=function(){return this.failIfClosed(),this.surface.paused},x.prototype.getSurface=function(){return this.failIfClosed(),this.surface},x.prototype.getRunningTrackCapabilities=function(){return this.getFirstTrackOrFail().getCapabilities()},x.prototype.getRunningTrackSettings=function(){return this.getFirstTrackOrFail().getSettings()},x.prototype.applyVideoConstraints=function(g){return ja(this,void 0,void 0,function(){return Ha(this,function(f){if("aspectRatio"in g)throw"Changing 'aspectRatio' in run-time is not yet supported.";return[2,this.getFirstTrackOrFail().applyConstraints(g)]})})},x.prototype.close=function(){if(this.isClosed)return Promise.resolve();var g=this;return new Promise(function(f,y){var S=g.mediaStream.getVideoTracks(),m=S.length,F=0;g.mediaStream.getVideoTracks().forEach(function(W){g.mediaStream.removeTrack(W),W.stop(),++F,F>=m&&(g.isClosed=!0,g.parentElement.removeChild(g.surface),f())})})},x.prototype.getCapabilities=function(){return new i2(this.getFirstTrackOrFail())},x})(),a2=(function(){function x(g){this.mediaStream=g}return x.prototype.render=function(g,f,y){return ja(this,void 0,void 0,function(){return Ha(this,function(S){return[2,s2.create(g,this.mediaStream,f,y)]})})},x.create=function(g){return ja(this,void 0,void 0,function(){var f,y;return Ha(this,function(S){switch(S.label){case 0:if(!navigator.mediaDevices)throw"navigator.mediaDevices not supported";return f={audio:!1,video:g},[4,navigator.mediaDevices.getUserMedia(f)];case 1:return y=S.sent(),[2,new x(y)]}})})},x})(),Jc=function(x,g,f,y){function S(m){return m instanceof f?m:new f(function(F){F(m)})}return new(f||(f=Promise))(function(m,F){function W(z){try{T(y.next(z))}catch(H){F(H)}}function Z(z){try{T(y.throw(z))}catch(H){F(H)}}function T(z){z.done?m(z.value):S(z.value).then(W,Z)}T((y=y.apply(x,g||[])).next())})},$c=function(x,g){var f={label:0,sent:function(){if(m[0]&1)throw m[1];return m[1]},trys:[],ops:[]},y,S,m,F;return F={next:W(0),throw:W(1),return:W(2)},typeof Symbol=="function"&&(F[Symbol.iterator]=function(){return this}),F;function W(T){return function(z){return Z([T,z])}}function Z(T){if(y)throw new TypeError("Generator is already executing.");for(;F&&(F=0,T[0]&&(f=0)),f;)try{if(y=1,S&&(m=T[0]&2?S.return:T[0]?S.throw||((m=S.return)&&m.call(S),0):S.next)&&!(m=m.call(S,T[1])).done)return m;switch(S=0,m&&(T=[T[0]&2,m.value]),T[0]){case 0:case 1:m=T;break;case 4:return f.label++,{value:T[1],done:!1};case 5:f.label++,S=T[1],T=[0];continue;case 7:T=f.ops.pop(),f.trys.pop();continue;default:if(m=f.trys,!(m=m.length>0&&m[m.length-1])&&(T[0]===6||T[0]===2)){f=0;continue}if(T[0]===3&&(!m||T[1]>m[0]&&T[1]<m[3])){f.label=T[1];break}if(T[0]===6&&f.label<m[1]){f.label=m[1],m=T;break}if(m&&f.label<m[2]){f.label=m[2],f.ops.push(T);break}m[2]&&f.ops.pop(),f.trys.pop();continue}T=g.call(x,f)}catch(z){T=[6,z],S=0}finally{y=m=0}if(T[0]&5)throw T[1];return{value:T[0]?T[1]:void 0,done:!0}}},o2=(function(){function x(){}return x.failIfNotSupported=function(){return Jc(this,void 0,void 0,function(){return $c(this,function(g){if(!navigator.mediaDevices)throw"navigator.mediaDevices not supported";return[2,new x]})})},x.prototype.create=function(g){return Jc(this,void 0,void 0,function(){return $c(this,function(f){return[2,a2.create(g)]})})},x})(),l2=function(x,g,f,y){function S(m){return m instanceof f?m:new f(function(F){F(m)})}return new(f||(f=Promise))(function(m,F){function W(z){try{T(y.next(z))}catch(H){F(H)}}function Z(z){try{T(y.throw(z))}catch(H){F(H)}}function T(z){z.done?m(z.value):S(z.value).then(W,Z)}T((y=y.apply(x,g||[])).next())})},c2=function(x,g){var f={label:0,sent:function(){if(m[0]&1)throw m[1];return m[1]},trys:[],ops:[]},y,S,m,F;return F={next:W(0),throw:W(1),return:W(2)},typeof Symbol=="function"&&(F[Symbol.iterator]=function(){return this}),F;function W(T){return function(z){return Z([T,z])}}function Z(T){if(y)throw new TypeError("Generator is already executing.");for(;F&&(F=0,T[0]&&(f=0)),f;)try{if(y=1,S&&(m=T[0]&2?S.return:T[0]?S.throw||((m=S.return)&&m.call(S),0):S.next)&&!(m=m.call(S,T[1])).done)return m;switch(S=0,m&&(T=[T[0]&2,m.value]),T[0]){case 0:case 1:m=T;break;case 4:return f.label++,{value:T[1],done:!1};case 5:f.label++,S=T[1],T=[0];continue;case 7:T=f.ops.pop(),f.trys.pop();continue;default:if(m=f.trys,!(m=m.length>0&&m[m.length-1])&&(T[0]===6||T[0]===2)){f=0;continue}if(T[0]===3&&(!m||T[1]>m[0]&&T[1]<m[3])){f.label=T[1];break}if(T[0]===6&&f.label<m[1]){f.label=m[1],m=T;break}if(m&&f.label<m[2]){f.label=m[2],f.ops.push(T);break}m[2]&&f.ops.pop(),f.trys.pop();continue}T=g.call(x,f)}catch(z){T=[6,z],S=0}finally{y=m=0}if(T[0]&5)throw T[1];return{value:T[0]?T[1]:void 0,done:!0}}},u2=(function(){function x(){}return x.retrieve=function(){if(navigator.mediaDevices)return x.getCamerasFromMediaDevices();var g=MediaStreamTrack;return MediaStreamTrack&&g.getSources?x.getCamerasFromMediaStreamTrack():x.rejectWithError()},x.rejectWithError=function(){var g=gs.unableToQuerySupportedDevices();return x.isHttpsOrLocalhost()||(g=gs.insecureContextCameraQueryError()),Promise.reject(g)},x.isHttpsOrLocalhost=function(){if(location.protocol==="https:")return!0;var g=location.host.split(":")[0];return g==="127.0.0.1"||g==="localhost"},x.getCamerasFromMediaDevices=function(){return l2(this,void 0,void 0,function(){var g,f,y,S,m,F,W;return c2(this,function(Z){switch(Z.label){case 0:return g=function(T){for(var z=T.getVideoTracks(),H=0,Le=z;H<Le.length;H++){var Ee=Le[H];Ee.enabled=!1,Ee.stop(),T.removeTrack(Ee)}},[4,navigator.mediaDevices.getUserMedia({audio:!1,video:!0})];case 1:return f=Z.sent(),[4,navigator.mediaDevices.enumerateDevices()];case 2:for(y=Z.sent(),S=[],m=0,F=y;m<F.length;m++)W=F[m],W.kind==="videoinput"&&S.push({id:W.deviceId,label:W.label});return g(f),[2,S]}})})},x.getCamerasFromMediaStreamTrack=function(){return new Promise(function(g,f){var y=function(m){for(var F=[],W=0,Z=m;W<Z.length;W++){var T=Z[W];T.kind==="video"&&F.push({id:T.id,label:T.label})}g(F)},S=MediaStreamTrack;S.getSources(y)})},x})(),Vt;(function(x){x[x.UNKNOWN=0]="UNKNOWN",x[x.NOT_STARTED=1]="NOT_STARTED",x[x.SCANNING=2]="SCANNING",x[x.PAUSED=3]="PAUSED"})(Vt||(Vt={}));var f2=(function(){function x(){this.state=Vt.NOT_STARTED,this.onGoingTransactionNewState=Vt.UNKNOWN}return x.prototype.directTransition=function(g){this.failIfTransitionOngoing(),this.validateTransition(g),this.state=g},x.prototype.startTransition=function(g){return this.failIfTransitionOngoing(),this.validateTransition(g),this.onGoingTransactionNewState=g,this},x.prototype.execute=function(){if(this.onGoingTransactionNewState===Vt.UNKNOWN)throw"Transaction is already cancelled, cannot execute().";var g=this.onGoingTransactionNewState;this.onGoingTransactionNewState=Vt.UNKNOWN,this.directTransition(g)},x.prototype.cancel=function(){if(this.onGoingTransactionNewState===Vt.UNKNOWN)throw"Transaction is already cancelled, cannot cancel().";this.onGoingTransactionNewState=Vt.UNKNOWN},x.prototype.getState=function(){return this.state},x.prototype.failIfTransitionOngoing=function(){if(this.onGoingTransactionNewState!==Vt.UNKNOWN)throw"Cannot transition to a new state, already under transition"},x.prototype.validateTransition=function(g){switch(this.state){case Vt.UNKNOWN:throw"Transition from unknown is not allowed";case Vt.NOT_STARTED:this.failIfNewStateIs(g,[Vt.PAUSED]);break;case Vt.SCANNING:break;case Vt.PAUSED:break}},x.prototype.failIfNewStateIs=function(g,f){for(var y=0,S=f;y<S.length;y++){var m=S[y];if(g===m)throw"Cannot transition from ".concat(this.state," to ").concat(g)}},x})(),h2=(function(){function x(g){this.stateManager=g}return x.prototype.startTransition=function(g){return this.stateManager.startTransition(g)},x.prototype.directTransition=function(g){this.stateManager.directTransition(g)},x.prototype.getState=function(){return this.stateManager.getState()},x.prototype.canScanFile=function(){return this.stateManager.getState()===Vt.NOT_STARTED},x.prototype.isScanning=function(){return this.stateManager.getState()!==Vt.NOT_STARTED},x.prototype.isStrictlyScanning=function(){return this.stateManager.getState()===Vt.SCANNING},x.prototype.isPaused=function(){return this.stateManager.getState()===Vt.PAUSED},x})(),d2=(function(){function x(){}return x.create=function(){return new h2(new f2)},x})(),g2=(function(){var x=function(g,f){return x=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(y,S){y.__proto__=S}||function(y,S){for(var m in S)Object.prototype.hasOwnProperty.call(S,m)&&(y[m]=S[m])},x(g,f)};return function(g,f){if(typeof f!="function"&&f!==null)throw new TypeError("Class extends value "+String(f)+" is not a constructor or null");x(g,f);function y(){this.constructor=g}g.prototype=f===null?Object.create(f):(y.prototype=f.prototype,new y)}})(),sr=(function(x){g2(g,x);function g(){return x!==null&&x.apply(this,arguments)||this}return g.DEFAULT_WIDTH=300,g.DEFAULT_WIDTH_OFFSET=2,g.FILE_SCAN_MIN_HEIGHT=300,g.FILE_SCAN_HIDDEN_CANVAS_PADDING=100,g.MIN_QR_BOX_SIZE=50,g.SHADED_LEFT=1,g.SHADED_RIGHT=2,g.SHADED_TOP=3,g.SHADED_BOTTOM=4,g.SHADED_REGION_ELEMENT_ID="qr-shaded-region",g.VERBOSE=!1,g.BORDER_SHADER_DEFAULT_COLOR="#ffffff",g.BORDER_SHADER_MATCH_COLOR="rgb(90, 193, 56)",g})(Br),x2=(function(){function x(g,f){this.logger=f,this.fps=sr.SCAN_DEFAULT_FPS,g?(g.fps&&(this.fps=g.fps),this.disableFlip=g.disableFlip===!0,this.qrbox=g.qrbox,this.aspectRatio=g.aspectRatio,this.videoConstraints=g.videoConstraints):this.disableFlip=sr.DEFAULT_DISABLE_FLIP}return x.prototype.isMediaStreamConstraintsValid=function(){return this.videoConstraints?lu.isMediaStreamConstraintsValid(this.videoConstraints,this.logger):(this.logger.logError("Empty videoConstraints",!0),!1)},x.prototype.isShadedBoxEnabled=function(){return!Gr(this.qrbox)},x.create=function(g,f){return new x(g,f)},x})(),eu=(function(){function x(g,f){if(this.element=null,this.canvasElement=null,this.scannerPausedUiElement=null,this.hasBorderShaders=null,this.borderShaders=null,this.qrMatch=null,this.renderedCamera=null,this.qrRegion=null,this.context=null,this.lastScanImageFile=null,this.isScanning=!1,!document.getElementById(g))throw"HTML Element with id=".concat(g," not found");this.elementId=g,this.verbose=!1;var y;typeof f=="boolean"?this.verbose=f===!0:f&&(y=f,this.verbose=y.verbose===!0,y.experimentalFeatures),this.logger=new ou(this.verbose),this.qrcode=new e2(this.getSupportedFormats(f),this.getUseBarCodeDetectorIfSupported(y),this.verbose,this.logger),this.foreverScanTimeout,this.shouldScan=!0,this.stateManagerProxy=d2.create()}return x.prototype.start=function(g,f,y,S){var m=this;if(!g)throw"cameraIdOrConfig is required";if(!y||typeof y!="function")throw"qrCodeSuccessCallback is required and should be a function.";var F;S?F=S:F=this.verbose?this.logger.log:function(){};var W=x2.create(f,this.logger);this.clearElement();var Z=!1;W.videoConstraints&&(W.isMediaStreamConstraintsValid()?Z=!0:this.logger.logError("'videoConstraints' is not valid 'MediaStreamConstraints, it will be ignored.'",!0));var T=Z,z=document.getElementById(this.elementId);z.clientWidth?z.clientWidth:sr.DEFAULT_WIDTH,z.style.position="relative",this.shouldScan=!0,this.element=z;var H=this,Le=this.stateManagerProxy.startTransition(Vt.SCANNING);return new Promise(function(Ee,ct){var ge=T?W.videoConstraints:H.createVideoConstraints(g);if(!ge){Le.cancel(),ct("videoConstraints should be defined");return}var Ue={};(!T||W.aspectRatio)&&(Ue.aspectRatio=W.aspectRatio);var yt={onRenderSurfaceReady:function(Ye,fe){H.setupUi(Ye,fe,W),H.isScanning=!0,H.foreverScan(W,y,F)}};o2.failIfNotSupported().then(function(Ye){Ye.create(ge).then(function(fe){return fe.render(m.element,Ue,yt).then(function(_e){H.renderedCamera=_e,Le.execute(),Ee(null)}).catch(function(_e){Le.cancel(),ct(_e)})}).catch(function(fe){Le.cancel(),ct(gs.errorGettingUserMedia(fe))})}).catch(function(Ye){Le.cancel(),ct(gs.cameraStreamingNotSupported())})})},x.prototype.pause=function(g){if(!this.stateManagerProxy.isStrictlyScanning())throw"Cannot pause, scanner is not scanning.";this.stateManagerProxy.directTransition(Vt.PAUSED),this.showPausedState(),(Gr(g)||g!==!0)&&(g=!1),g&&this.renderedCamera&&this.renderedCamera.pause()},x.prototype.resume=function(){if(!this.stateManagerProxy.isPaused())throw"Cannot result, scanner is not paused.";if(!this.renderedCamera)throw"renderedCamera doesn't exist while trying resume()";var g=this,f=function(){g.stateManagerProxy.directTransition(Vt.SCANNING),g.hidePausedState()};if(!this.renderedCamera.isPaused()){f();return}this.renderedCamera.resume(function(){f()})},x.prototype.getState=function(){return this.stateManagerProxy.getState()},x.prototype.stop=function(){var g=this;if(!this.stateManagerProxy.isScanning())throw"Cannot stop, scanner is not running or paused.";var f=this.stateManagerProxy.startTransition(Vt.NOT_STARTED);this.shouldScan=!1,this.foreverScanTimeout&&clearTimeout(this.foreverScanTimeout);var y=function(){if(g.element){var m=document.getElementById(sr.SHADED_REGION_ELEMENT_ID);m&&g.element.removeChild(m)}},S=this;return this.renderedCamera.close().then(function(){return S.renderedCamera=null,S.element&&(S.element.removeChild(S.canvasElement),S.canvasElement=null),y(),S.qrRegion&&(S.qrRegion=null),S.context&&(S.context=null),f.execute(),S.hidePausedState(),S.isScanning=!1,Promise.resolve()})},x.prototype.scanFile=function(g,f){return this.scanFileV2(g,f).then(function(y){return y.decodedText})},x.prototype.scanFileV2=function(g,f){var y=this;if(!g||!(g instanceof File))throw"imageFile argument is mandatory and should be instance of File. Use 'event.target.files[0]'.";if(Gr(f)&&(f=!0),!this.stateManagerProxy.canScanFile())throw"Cannot start file scan - ongoing camera scan";return new Promise(function(S,m){y.possiblyCloseLastScanImageFile(),y.clearElement(),y.lastScanImageFile=URL.createObjectURL(g);var F=new Image;F.onload=function(){var W=F.width,Z=F.height,T=document.getElementById(y.elementId),z=T.clientWidth?T.clientWidth:sr.DEFAULT_WIDTH,H=Math.max(T.clientHeight?T.clientHeight:Z,sr.FILE_SCAN_MIN_HEIGHT),Le=y.computeCanvasDrawConfig(W,Z,z,H);if(f){var Ee=y.createCanvasElement(z,H,"qr-canvas-visible");Ee.style.display="inline-block",T.appendChild(Ee);var ct=Ee.getContext("2d");if(!ct)throw"Unable to get 2d context from canvas";ct.canvas.width=z,ct.canvas.height=H,ct.drawImage(F,0,0,W,Z,Le.x,Le.y,Le.width,Le.height)}var ge=sr.FILE_SCAN_HIDDEN_CANVAS_PADDING,Ue=Math.max(F.width,Le.width),yt=Math.max(F.height,Le.height),Ye=Ue+2*ge,fe=yt+2*ge,_e=y.createCanvasElement(Ye,fe);T.appendChild(_e);var It=_e.getContext("2d");if(!It)throw"Unable to get 2d context from canvas";It.canvas.width=Ye,It.canvas.height=fe,It.drawImage(F,0,0,W,Z,ge,ge,Ue,yt);try{y.qrcode.decodeRobustlyAsync(_e).then(function(Be){S(Vc.createFromQrcodeResult(Be))}).catch(m)}catch(Be){m("QR code parse error, error = ".concat(Be))}},F.onerror=m,F.onabort=m,F.onstalled=m,F.onsuspend=m,F.src=URL.createObjectURL(g)})},x.prototype.clear=function(){this.clearElement()},x.getCameras=function(){return u2.retrieve()},x.prototype.getRunningTrackCapabilities=function(){return this.getRenderedCameraOrFail().getRunningTrackCapabilities()},x.prototype.getRunningTrackSettings=function(){return this.getRenderedCameraOrFail().getRunningTrackSettings()},x.prototype.getRunningTrackCameraCapabilities=function(){return this.getRenderedCameraOrFail().getCapabilities()},x.prototype.applyVideoConstraints=function(g){if(g){if(!lu.isMediaStreamConstraintsValid(g,this.logger))throw"invalid videoConstaints passed, check logs for more details"}else throw"videoConstaints is required argument.";return this.getRenderedCameraOrFail().applyVideoConstraints(g)},x.prototype.getRenderedCameraOrFail=function(){if(this.renderedCamera==null)throw"Scanning is not in running state, call this API only when QR code scanning using camera is in running state.";return this.renderedCamera},x.prototype.getSupportedFormats=function(g){var f=[he.QR_CODE,he.AZTEC,he.CODABAR,he.CODE_39,he.CODE_93,he.CODE_128,he.DATA_MATRIX,he.MAXICODE,he.ITF,he.EAN_13,he.EAN_8,he.PDF_417,he.RSS_14,he.RSS_EXPANDED,he.UPC_A,he.UPC_E,he.UPC_EAN_EXTENSION];if(!g||typeof g=="boolean"||!g.formatsToSupport)return f;if(!Array.isArray(g.formatsToSupport))throw"configOrVerbosityFlag.formatsToSupport should be undefined or an array.";if(g.formatsToSupport.length===0)throw"Atleast 1 formatsToSupport is needed.";for(var y=[],S=0,m=g.formatsToSupport;S<m.length;S++){var F=m[S];Yg(F)?y.push(F):this.logger.warn("Invalid format: ".concat(F," passed in config, ignoring."))}if(y.length===0)throw"None of formatsToSupport match supported values.";return y},x.prototype.getUseBarCodeDetectorIfSupported=function(g){if(Gr(g))return!0;if(!Gr(g.useBarCodeDetectorIfSupported))return g.useBarCodeDetectorIfSupported!==!1;if(Gr(g.experimentalFeatures))return!0;var f=g.experimentalFeatures;return Gr(f.useBarCodeDetectorIfSupported)?!0:f.useBarCodeDetectorIfSupported!==!1},x.prototype.validateQrboxSize=function(g,f,y){var S=this,m=y.qrbox;this.validateQrboxConfig(m);var F=this.toQrdimensions(g,f,m),W=function(T){if(T<sr.MIN_QR_BOX_SIZE)throw"minimum size of 'config.qrbox' dimension value is"+" ".concat(sr.MIN_QR_BOX_SIZE,"px.")},Z=function(T){return T>g&&(S.logger.warn("`qrbox.width` or `qrbox` is larger than the width of the root element. The width will be truncated to the width of root element."),T=g),T};W(F.width),W(F.height),F.width=Z(F.width)},x.prototype.validateQrboxConfig=function(g){if(typeof g!="number"&&typeof g!="function"&&(g.width===void 0||g.height===void 0))throw"Invalid instance of QrDimensions passed for 'config.qrbox'. Both 'width' and 'height' should be set."},x.prototype.toQrdimensions=function(g,f,y){if(typeof y=="number")return{width:y,height:y};if(typeof y=="function")try{return y(g,f)}catch(S){throw new Error("qrbox config was passed as a function but it failed with unknown error"+S)}return y},x.prototype.setupUi=function(g,f,y){y.isShadedBoxEnabled()&&this.validateQrboxSize(g,f,y);var S=Gr(y.qrbox)?{width:g,height:f}:y.qrbox;this.validateQrboxConfig(S);var m=this.toQrdimensions(g,f,S);m.height>f&&this.logger.warn("[Html5Qrcode] config.qrbox has height that isgreater than the height of the video stream. Shading will be ignored");var F=y.isShadedBoxEnabled()&&m.height<=f,W={x:0,y:0,width:g,height:f},Z=F?this.getShadedRegionBounds(g,f,m):W,T=this.createCanvasElement(Z.width,Z.height),z={willReadFrequently:!0},H=T.getContext("2d",z);H.canvas.width=Z.width,H.canvas.height=Z.height,this.element.append(T),F&&this.possiblyInsertShadingElement(this.element,g,f,m),this.createScannerPausedUiElement(this.element),this.qrRegion=Z,this.context=H,this.canvasElement=T},x.prototype.createScannerPausedUiElement=function(g){var f=document.createElement("div");f.innerText=gs.scannerPaused(),f.style.display="none",f.style.position="absolute",f.style.top="0px",f.style.zIndex="1",f.style.background="rgba(9, 9, 9, 0.46)",f.style.color="#FFECEC",f.style.textAlign="center",f.style.width="100%",g.appendChild(f),this.scannerPausedUiElement=f},x.prototype.scanContext=function(g,f){var y=this;return this.stateManagerProxy.isPaused()?Promise.resolve(!1):this.qrcode.decodeAsync(this.canvasElement).then(function(S){return g(S.text,Vc.createFromQrcodeResult(S)),y.possiblyUpdateShaders(!0),!0}).catch(function(S){y.possiblyUpdateShaders(!1);var m=gs.codeParseError(S);return f(m,au.createFrom(m)),!1})},x.prototype.foreverScan=function(g,f,y){var S=this;if(this.shouldScan&&this.renderedCamera){var m=this.renderedCamera.getSurface(),F=m.videoWidth/m.clientWidth,W=m.videoHeight/m.clientHeight;if(!this.qrRegion)throw"qrRegion undefined when localMediaStream is ready.";var Z=this.qrRegion.width*F,T=this.qrRegion.height*W,z=this.qrRegion.x*F,H=this.qrRegion.y*W;this.context.drawImage(m,z,H,Z,T,0,0,this.qrRegion.width,this.qrRegion.height);var Le=function(){S.foreverScanTimeout=setTimeout(function(){S.foreverScan(g,f,y)},S.getTimeoutFps(g.fps))};this.scanContext(f,y).then(function(Ee){!Ee&&g.disableFlip!==!0?(S.context.translate(S.context.canvas.width,0),S.context.scale(-1,1),S.scanContext(f,y).finally(function(){Le()})):Le()}).catch(function(Ee){S.logger.logError("Error happend while scanning context",Ee),Le()})}},x.prototype.createVideoConstraints=function(g){if(typeof g=="string")return{deviceId:{exact:g}};if(typeof g=="object"){var f="facingMode",y="deviceId",S={user:!0,environment:!0},m="exact",F=function(ct){if(ct in S)return!0;throw"config has invalid 'facingMode' value = "+"'".concat(ct,"'")},W=Object.keys(g);if(W.length!==1)throw"'cameraIdOrConfig' object should have exactly 1 key,"+" if passed as an object, found ".concat(W.length," keys");var Z=Object.keys(g)[0];if(Z!==f&&Z!==y)throw"Only '".concat(f,"' and '").concat(y,"' ")+" are supported for 'cameraIdOrConfig'";if(Z===f){var T=g.facingMode;if(typeof T=="string"){if(F(T))return{facingMode:T}}else if(typeof T=="object")if(m in T){if(F(T["".concat(m)]))return{facingMode:{exact:T["".concat(m)]}}}else throw"'facingMode' should be string or object with"+" ".concat(m," as key.");else{var z=typeof T;throw"Invalid type of 'facingMode' = ".concat(z)}}else{var H=g.deviceId;if(typeof H=="string")return{deviceId:H};if(typeof H=="object"){if(m in H)return{deviceId:{exact:H["".concat(m)]}};throw"'deviceId' should be string or object with"+" ".concat(m," as key.")}else{var Le=typeof H;throw"Invalid type of 'deviceId' = ".concat(Le)}}}var Ee=typeof g;throw"Invalid type of 'cameraIdOrConfig' = ".concat(Ee)},x.prototype.computeCanvasDrawConfig=function(g,f,y,S){if(g<=y&&f<=S){var m=(y-g)/2,F=(S-f)/2;return{x:m,y:F,width:g,height:f}}else{var W=g,Z=f;return g>y&&(f=y/g*f,g=y),f>S&&(g=S/f*g,f=S),this.logger.log("Image downsampled from "+"".concat(W,"X").concat(Z)+" to ".concat(g,"X").concat(f,".")),this.computeCanvasDrawConfig(g,f,y,S)}},x.prototype.clearElement=function(){if(this.stateManagerProxy.isScanning())throw"Cannot clear while scan is ongoing, close it first.";var g=document.getElementById(this.elementId);g&&(g.innerHTML="")},x.prototype.possiblyUpdateShaders=function(g){this.qrMatch!==g&&(this.hasBorderShaders&&this.borderShaders&&this.borderShaders.length&&this.borderShaders.forEach(function(f){f.style.backgroundColor=g?sr.BORDER_SHADER_MATCH_COLOR:sr.BORDER_SHADER_DEFAULT_COLOR}),this.qrMatch=g)},x.prototype.possiblyCloseLastScanImageFile=function(){this.lastScanImageFile&&(URL.revokeObjectURL(this.lastScanImageFile),this.lastScanImageFile=null)},x.prototype.createCanvasElement=function(g,f,y){var S=g,m=f,F=document.createElement("canvas");return F.style.width="".concat(S,"px"),F.style.height="".concat(m,"px"),F.style.display="none",F.id=Gr(y)?"qr-canvas":y,F},x.prototype.getShadedRegionBounds=function(g,f,y){if(y.width>g||y.height>f)throw"'config.qrbox' dimensions should not be greater than the dimensions of the root HTML element.";return{x:(g-y.width)/2,y:(f-y.height)/2,width:y.width,height:y.height}},x.prototype.possiblyInsertShadingElement=function(g,f,y,S){if(!(f-S.width<1||y-S.height<1)){var m=document.createElement("div");m.style.position="absolute";var F=(f-S.width)/2,W=(y-S.height)/2;if(m.style.borderLeft="".concat(F,"px solid rgba(0, 0, 0, 0.48)"),m.style.borderRight="".concat(F,"px solid rgba(0, 0, 0, 0.48)"),m.style.borderTop="".concat(W,"px solid rgba(0, 0, 0, 0.48)"),m.style.borderBottom="".concat(W,"px solid rgba(0, 0, 0, 0.48)"),m.style.boxSizing="border-box",m.style.top="0px",m.style.bottom="0px",m.style.left="0px",m.style.right="0px",m.id="".concat(sr.SHADED_REGION_ELEMENT_ID),f-S.width<11||y-S.height<11)this.hasBorderShaders=!1;else{var Z=5,T=40;this.insertShaderBorders(m,T,Z,-Z,null,0,!0),this.insertShaderBorders(m,T,Z,-Z,null,0,!1),this.insertShaderBorders(m,T,Z,null,-Z,0,!0),this.insertShaderBorders(m,T,Z,null,-Z,0,!1),this.insertShaderBorders(m,Z,T+Z,-Z,null,-Z,!0),this.insertShaderBorders(m,Z,T+Z,null,-Z,-Z,!0),this.insertShaderBorders(m,Z,T+Z,-Z,null,-Z,!1),this.insertShaderBorders(m,Z,T+Z,null,-Z,-Z,!1),this.hasBorderShaders=!0}g.append(m)}},x.prototype.insertShaderBorders=function(g,f,y,S,m,F,W){var Z=document.createElement("div");Z.style.position="absolute",Z.style.backgroundColor=sr.BORDER_SHADER_DEFAULT_COLOR,Z.style.width="".concat(f,"px"),Z.style.height="".concat(y,"px"),S!==null&&(Z.style.top="".concat(S,"px")),m!==null&&(Z.style.bottom="".concat(m,"px")),W?Z.style.left="".concat(F,"px"):Z.style.right="".concat(F,"px"),this.borderShaders||(this.borderShaders=[]),this.borderShaders.push(Z),g.appendChild(Z)},x.prototype.showPausedState=function(){if(!this.scannerPausedUiElement)throw"[internal error] scanner paused UI element not found";this.scannerPausedUiElement.style.display="block"},x.prototype.hidePausedState=function(){if(!this.scannerPausedUiElement)throw"[internal error] scanner paused UI element not found";this.scannerPausedUiElement.style.display="none"},x.prototype.getTimeoutFps=function(g){return 1e3/g},x})(),Ko="data:image/svg+xml;base64,",p2=Ko+"PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAzNzEuNjQzIDM3MS42NDMiIHN0eWxlPSJlbmFibGUtYmFja2dyb3VuZDpuZXcgMCAwIDM3MS42NDMgMzcxLjY0MyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+PHBhdGggZD0iTTEwNS4wODQgMzguMjcxaDE2My43Njh2MjBIMTA1LjA4NHoiLz48cGF0aCBkPSJNMzExLjU5NiAxOTAuMTg5Yy03LjQ0MS05LjM0Ny0xOC40MDMtMTYuMjA2LTMyLjc0My0yMC41MjJWMzBjMC0xNi41NDItMTMuNDU4LTMwLTMwLTMwSDEyNS4wODRjLTE2LjU0MiAwLTMwIDEzLjQ1OC0zMCAzMHYxMjAuMTQzaC04LjI5NmMtMTYuNTQyIDAtMzAgMTMuNDU4LTMwIDMwdjEuMzMzYTI5LjgwNCAyOS44MDQgMCAwIDAgNC42MDMgMTUuOTM5Yy03LjM0IDUuNDc0LTEyLjEwMyAxNC4yMjEtMTIuMTAzIDI0LjA2MXYxLjMzM2MwIDkuODQgNC43NjMgMTguNTg3IDEyLjEwMyAyNC4wNjJhMjkuODEgMjkuODEgMCAwIDAtNC42MDMgMTUuOTM4djEuMzMzYzAgMTYuNTQyIDEzLjQ1OCAzMCAzMCAzMGg4LjMyNGMuNDI3IDExLjYzMSA3LjUwMyAyMS41ODcgMTcuNTM0IDI2LjE3Ny45MzEgMTAuNTAzIDQuMDg0IDMwLjE4NyAxNC43NjggNDUuNTM3YTkuOTg4IDkuOTg4IDAgMCAwIDguMjE2IDQuMjg4IDkuOTU4IDkuOTU4IDAgMCAwIDUuNzA0LTEuNzkzYzQuNTMzLTMuMTU1IDUuNjUtOS4zODggMi40OTUtMTMuOTIxLTYuNzk4LTkuNzY3LTkuNjAyLTIyLjYwOC0xMC43Ni0zMS40aDgyLjY4NWMuMjcyLjQxNC41NDUuODE4LjgxNSAxLjIxIDMuMTQyIDQuNTQxIDkuMzcyIDUuNjc5IDEzLjkxMyAyLjUzNCA0LjU0Mi0zLjE0MiA1LjY3Ny05LjM3MSAyLjUzNS0xMy45MTMtMTEuOTE5LTE3LjIyOS04Ljc4Ny0zNS44ODQgOS41ODEtNTcuMDEyIDMuMDY3LTIuNjUyIDEyLjMwNy0xMS43MzIgMTEuMjE3LTI0LjAzMy0uODI4LTkuMzQzLTcuMTA5LTE3LjE5NC0xOC42NjktMjMuMzM3YTkuODU3IDkuODU3IDAgMCAwLTEuMDYxLS40ODZjLS40NjYtLjE4Mi0xMS40MDMtNC41NzktOS43NDEtMTUuNzA2IDEuMDA3LTYuNzM3IDE0Ljc2OC04LjI3MyAyMy43NjYtNy42NjYgMjMuMTU2IDEuNTY5IDM5LjY5OCA3LjgwMyA0Ny44MzYgMTguMDI2IDUuNzUyIDcuMjI1IDcuNjA3IDE2LjYyMyA1LjY3MyAyOC43MzMtLjQxMyAyLjU4NS0uODI0IDUuMjQxLTEuMjQ1IDcuOTU5LTUuNzU2IDM3LjE5NC0xMi45MTkgODMuNDgzLTQ5Ljg3IDExNC42NjEtNC4yMjEgMy41NjEtNC43NTYgOS44Ny0xLjE5NCAxNC4wOTJhOS45OCA5Ljk4IDAgMCAwIDcuNjQ4IDMuNTUxIDkuOTU1IDkuOTU1IDAgMCAwIDYuNDQ0LTIuMzU4YzQyLjY3Mi0zNi4wMDUgNTAuODAyLTg4LjUzMyA1Ni43MzctMTI2Ljg4OC40MTUtMi42ODQuODIxLTUuMzA5IDEuMjI5LTcuODYzIDIuODM0LTE3LjcyMS0uNDU1LTMyLjY0MS05Ljc3Mi00NC4zNDV6bS0yMzIuMzA4IDQyLjYyYy01LjUxNCAwLTEwLTQuNDg2LTEwLTEwdi0xLjMzM2MwLTUuNTE0IDQuNDg2LTEwIDEwLTEwaDE1djIxLjMzM2gtMTV6bS0yLjUtNTIuNjY2YzAtNS41MTQgNC40ODYtMTAgMTAtMTBoNy41djIxLjMzM2gtNy41Yy01LjUxNCAwLTEwLTQuNDg2LTEwLTEwdi0xLjMzM3ptMTcuNSA5My45OTloLTcuNWMtNS41MTQgMC0xMC00LjQ4Ni0xMC0xMHYtMS4zMzNjMC01LjUxNCA0LjQ4Ni0xMCAxMC0xMGg3LjV2MjEuMzMzem0zMC43OTYgMjguODg3Yy01LjUxNCAwLTEwLTQuNDg2LTEwLTEwdi04LjI3MWg5MS40NTdjLS44NTEgNi42NjgtLjQzNyAxMi43ODcuNzMxIDE4LjI3MWgtODIuMTg4em03OS40ODItMTEzLjY5OGMtMy4xMjQgMjAuOTA2IDEyLjQyNyAzMy4xODQgMjEuNjI1IDM3LjA0IDUuNDQxIDIuOTY4IDcuNTUxIDUuNjQ3IDcuNzAxIDcuMTg4LjIxIDIuMTUtMi41NTMgNS42ODQtNC40NzcgNy4yNTEtLjQ4Mi4zNzgtLjkyOS44LTEuMzM1IDEuMjYxLTYuOTg3IDcuOTM2LTExLjk4MiAxNS41Mi0xNS40MzIgMjIuNjg4aC05Ny41NjRWMzBjMC01LjUxNCA0LjQ4Ni0xMCAxMC0xMGgxMjMuNzY5YzUuNTE0IDAgMTAgNC40ODYgMTAgMTB2MTM1LjU3OWMtMy4wMzItLjM4MS02LjE1LS42OTQtOS4zODktLjkxNC0yNS4xNTktMS42OTQtNDIuMzcgNy43NDgtNDQuODk4IDI0LjY2NnoiLz48cGF0aCBkPSJNMTc5LjEyOSA4My4xNjdoLTI0LjA2YTUgNSAwIDAgMC01IDV2MjQuMDYxYTUgNSAwIDAgMCA1IDVoMjQuMDZhNSA1IDAgMCAwIDUtNVY4OC4xNjdhNSA1IDAgMCAwLTUtNXpNMTcyLjYyOSAxNDIuODZoLTEyLjU2VjEzMC44YTUgNSAwIDEgMC0xMCAwdjE3LjA2MWE1IDUgMCAwIDAgNSA1aDE3LjU2YTUgNSAwIDEgMCAwLTEwLjAwMXpNMjE2LjU2OCA4My4xNjdoLTI0LjA2YTUgNSAwIDAgMC01IDV2MjQuMDYxYTUgNSAwIDAgMCA1IDVoMjQuMDZhNSA1IDAgMCAwIDUtNVY4OC4xNjdhNSA1IDAgMCAwLTUtNXptLTUgMjQuMDYxaC0xNC4wNlY5My4xNjdoMTQuMDZ2MTQuMDYxek0yMTEuNjY5IDEyNS45MzZIMTk3LjQxYTUgNSAwIDAgMC01IDV2MTQuMjU3YTUgNSAwIDAgMCA1IDVoMTQuMjU5YTUgNSAwIDAgMCA1LTV2LTE0LjI1N2E1IDUgMCAwIDAtNS01eiIvPjwvc3ZnPg==",m2=Ko+"PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA1OS4wMTggNTkuMDE4IiBzdHlsZT0iZW5hYmxlLWJhY2tncm91bmQ6bmV3IDAgMCA1OS4wMTggNTkuMDE4IiB4bWw6c3BhY2U9InByZXNlcnZlIj48cGF0aCBkPSJtNTguNzQxIDU0LjgwOS01Ljk2OS02LjI0NGExMC43NCAxMC43NCAwIDAgMCAyLjgyLTcuMjVjMC01Ljk1My00Ljg0My0xMC43OTYtMTAuNzk2LTEwLjc5NlMzNCAzNS4zNjEgMzQgNDEuMzE0IDM4Ljg0MyA1Mi4xMSA0NC43OTYgNTIuMTFjMi40NDEgMCA0LjY4OC0uODI0IDYuNDk5LTIuMTk2bDYuMDAxIDYuMjc3YS45OTguOTk4IDAgMCAwIDEuNDE0LjAzMiAxIDEgMCAwIDAgLjAzMS0xLjQxNHpNMzYgNDEuMzE0YzAtNC44NSAzLjk0Ni04Ljc5NiA4Ljc5Ni04Ljc5NnM4Ljc5NiAzLjk0NiA4Ljc5NiA4Ljc5Ni0zLjk0NiA4Ljc5Ni04Ljc5NiA4Ljc5NlMzNiA0Ni4xNjQgMzYgNDEuMzE0ek0xMC40MzEgMTYuMDg4YzAgMy4wNyAyLjQ5OCA1LjU2OCA1LjU2OSA1LjU2OHM1LjU2OS0yLjQ5OCA1LjU2OS01LjU2OGMwLTMuMDcxLTIuNDk4LTUuNTY5LTUuNTY5LTUuNTY5cy01LjU2OSAyLjQ5OC01LjU2OSA1LjU2OXptOS4xMzggMGMwIDEuOTY4LTEuNjAyIDMuNTY4LTMuNTY5IDMuNTY4cy0zLjU2OS0xLjYwMS0zLjU2OS0zLjU2OCAxLjYwMi0zLjU2OSAzLjU2OS0zLjU2OSAzLjU2OSAxLjYwMSAzLjU2OSAzLjU2OXoiLz48cGF0aCBkPSJtMzAuODgyIDI4Ljk4NyA5LjE4LTEwLjA1NCAxMS4yNjIgMTAuMzIzYTEgMSAwIDAgMCAxLjM1MS0xLjQ3NWwtMTItMTFhMSAxIDAgMCAwLTEuNDE0LjA2M2wtOS43OTQgMTAuNzI3LTQuNzQzLTQuNzQzYTEuMDAzIDEuMDAzIDAgMCAwLTEuMzY4LS4wNDRMNi4zMzkgMzcuNzY4YTEgMSAwIDEgMCAxLjMyMiAxLjUwMWwxNi4zMTMtMTQuMzYyIDcuMzE5IDcuMzE4YS45OTkuOTk5IDAgMSAwIDEuNDE0LTEuNDE0bC0xLjgyNS0xLjgyNHoiLz48cGF0aCBkPSJNMzAgNDYuNTE4SDJ2LTQyaDU0djI4YTEgMSAwIDEgMCAyIDB2LTI5YTEgMSAwIDAgMC0xLTFIMWExIDEgMCAwIDAtMSAxdjQ0YTEgMSAwIDAgMCAxIDFoMjlhMSAxIDAgMSAwIDAtMnoiLz48L3N2Zz4=",tu=Ko+"PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA0NjAgNDYwIiBzdHlsZT0iZW5hYmxlLWJhY2tncm91bmQ6bmV3IDAgMCA0NjAgNDYwIiB4bWw6c3BhY2U9InByZXNlcnZlIj48cGF0aCBkPSJNMjMwIDBDMTAyLjk3NSAwIDAgMTAyLjk3NSAwIDIzMHMxMDIuOTc1IDIzMCAyMzAgMjMwIDIzMC0xMDIuOTc0IDIzMC0yMzBTMzU3LjAyNSAwIDIzMCAwem0zOC4zMzMgMzc3LjM2YzAgOC42NzYtNy4wMzQgMTUuNzEtMTUuNzEgMTUuNzFoLTQzLjEwMWMtOC42NzYgMC0xNS43MS03LjAzNC0xNS43MS0xNS43MVYyMDIuNDc3YzAtOC42NzYgNy4wMzMtMTUuNzEgMTUuNzEtMTUuNzFoNDMuMTAxYzguNjc2IDAgMTUuNzEgNy4wMzMgMTUuNzEgMTUuNzFWMzc3LjM2ek0yMzAgMTU3Yy0yMS41MzkgMC0zOS0xNy40NjEtMzktMzlzMTcuNDYxLTM5IDM5LTM5IDM5IDE3LjQ2MSAzOSAzOS0xNy40NjEgMzktMzkgMzl6Ii8+PC9zdmc+",w2="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAAQgAAAEIBarqQRAAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAAE1SURBVDiNfdI7S0NBEAXgLya1otFgpbYSbISAgpXYi6CmiH9KCAiChaVga6OiWPgfRDQ+0itaGVNosXtluWwcuMzePfM4M3sq8lbHBubwg1dc4m1E/J/N4ghDPOIsfk/4xiEao5KX0McFljN4C9d4QTPXuY99jP3DsIoDPGM6BY5i5yI5R7O4q+ImFkJY2DCh3cAH2klyB+9J1xUMMAG7eCh1a+Mr+k48b5diXrFVwwLuS+BJ9MfR7+G0FHOHhTHhnXNWS87VDF4pcnfQK4Ep7XScNLmPTZgURNKKYENYWDpzW1BhscS1WHS8CDgURFJQrWcoF3c13KKbgg1BYQfy8xZWEzTTw1QZbAoKu8FqJnktdu5hcVSHmchiILzzuaDQvjBzV2m8yohCE1jHfPx/xhU+y4G/D75ELlRJsSYAAAAASUVORK5CYII=",nu=(function(){function x(){}return x.createDefault=function(){return{hasPermission:!1,lastUsedCameraId:null}},x})(),A2=(function(){function x(){this.data=nu.createDefault();var g=localStorage.getItem(x.LOCAL_STORAGE_KEY);g?this.data=JSON.parse(g):this.reset()}return x.prototype.hasCameraPermissions=function(){return this.data.hasPermission},x.prototype.getLastUsedCameraId=function(){return this.data.lastUsedCameraId},x.prototype.setHasPermission=function(g){this.data.hasPermission=g,this.flush()},x.prototype.setLastUsedCameraId=function(g){this.data.lastUsedCameraId=g,this.flush()},x.prototype.resetLastUsedCameraId=function(){this.data.lastUsedCameraId=null,this.flush()},x.prototype.reset=function(){this.data=nu.createDefault(),this.flush()},x.prototype.flush=function(){localStorage.setItem(x.LOCAL_STORAGE_KEY,JSON.stringify(this.data))},x.LOCAL_STORAGE_KEY="HTML5_QRCODE_DATA",x})(),C2=(function(){function x(){this.infoDiv=document.createElement("div")}return x.prototype.renderInto=function(g){this.infoDiv.style.position="absolute",this.infoDiv.style.top="10px",this.infoDiv.style.right="10px",this.infoDiv.style.zIndex="2",this.infoDiv.style.display="none",this.infoDiv.style.padding="5pt",this.infoDiv.style.border="1px solid #171717",this.infoDiv.style.fontSize="10pt",this.infoDiv.style.background="rgb(0 0 0 / 69%)",this.infoDiv.style.borderRadius="5px",this.infoDiv.style.textAlign="center",this.infoDiv.style.fontWeight="400",this.infoDiv.style.color="white",this.infoDiv.innerText=Yc.poweredBy();var f=document.createElement("a");f.innerText="ScanApp",f.href="https://scanapp.org",f.target="new",f.style.color="white",this.infoDiv.appendChild(f);var y=document.createElement("br"),S=document.createElement("br");this.infoDiv.appendChild(y),this.infoDiv.appendChild(S);var m=document.createElement("a");m.innerText=Yc.reportIssues(),m.href="https://github.com/mebjas/html5-qrcode/issues",m.target="new",m.style.color="white",this.infoDiv.appendChild(m),g.appendChild(this.infoDiv)},x.prototype.show=function(){this.infoDiv.style.display="block"},x.prototype.hide=function(){this.infoDiv.style.display="none"},x})(),E2=(function(){function x(g,f){this.isShowingInfoIcon=!0,this.onTapIn=g,this.onTapOut=f,this.infoIcon=document.createElement("img")}return x.prototype.renderInto=function(g){var f=this;this.infoIcon.alt="Info icon",this.infoIcon.src=tu,this.infoIcon.style.position="absolute",this.infoIcon.style.top="4px",this.infoIcon.style.right="4px",this.infoIcon.style.opacity="0.6",this.infoIcon.style.cursor="pointer",this.infoIcon.style.zIndex="2",this.infoIcon.style.width="16px",this.infoIcon.style.height="16px",this.infoIcon.onmouseover=function(y){return f.onHoverIn()},this.infoIcon.onmouseout=function(y){return f.onHoverOut()},this.infoIcon.onclick=function(y){return f.onClick()},g.appendChild(this.infoIcon)},x.prototype.onHoverIn=function(){this.isShowingInfoIcon&&(this.infoIcon.style.opacity="1")},x.prototype.onHoverOut=function(){this.isShowingInfoIcon&&(this.infoIcon.style.opacity="0.6")},x.prototype.onClick=function(){this.isShowingInfoIcon?(this.isShowingInfoIcon=!1,this.onTapIn(),this.infoIcon.src=w2,this.infoIcon.style.opacity="1"):(this.isShowingInfoIcon=!0,this.onTapOut(),this.infoIcon.src=tu,this.infoIcon.style.opacity="0.6")},x})(),y2=(function(){function x(){var g=this;this.infoDiv=new C2,this.infoIcon=new E2(function(){g.infoDiv.show()},function(){g.infoDiv.hide()})}return x.prototype.renderInto=function(g){this.infoDiv.renderInto(g),this.infoIcon.renderInto(g)},x})(),I2=function(x,g,f,y){function S(m){return m instanceof f?m:new f(function(F){F(m)})}return new(f||(f=Promise))(function(m,F){function W(z){try{T(y.next(z))}catch(H){F(H)}}function Z(z){try{T(y.throw(z))}catch(H){F(H)}}function T(z){z.done?m(z.value):S(z.value).then(W,Z)}T((y=y.apply(x,g||[])).next())})},b2=function(x,g){var f={label:0,sent:function(){if(m[0]&1)throw m[1];return m[1]},trys:[],ops:[]},y,S,m,F;return F={next:W(0),throw:W(1),return:W(2)},typeof Symbol=="function"&&(F[Symbol.iterator]=function(){return this}),F;function W(T){return function(z){return Z([T,z])}}function Z(T){if(y)throw new TypeError("Generator is already executing.");for(;F&&(F=0,T[0]&&(f=0)),f;)try{if(y=1,S&&(m=T[0]&2?S.return:T[0]?S.throw||((m=S.return)&&m.call(S),0):S.next)&&!(m=m.call(S,T[1])).done)return m;switch(S=0,m&&(T=[T[0]&2,m.value]),T[0]){case 0:case 1:m=T;break;case 4:return f.label++,{value:T[1],done:!1};case 5:f.label++,S=T[1],T=[0];continue;case 7:T=f.ops.pop(),f.trys.pop();continue;default:if(m=f.trys,!(m=m.length>0&&m[m.length-1])&&(T[0]===6||T[0]===2)){f=0;continue}if(T[0]===3&&(!m||T[1]>m[0]&&T[1]<m[3])){f.label=T[1];break}if(T[0]===6&&f.label<m[1]){f.label=m[1],m=T;break}if(m&&f.label<m[2]){f.label=m[2],f.ops.push(T);break}m[2]&&f.ops.pop(),f.trys.pop();continue}T=g.call(x,f)}catch(z){T=[6,z],S=0}finally{y=m=0}if(T[0]&5)throw T[1];return{value:T[0]?T[1]:void 0,done:!0}}},ru=(function(){function x(){}return x.hasPermissions=function(){return I2(this,void 0,void 0,function(){var g,f,y,S;return b2(this,function(m){switch(m.label){case 0:return[4,navigator.mediaDevices.enumerateDevices()];case 1:for(g=m.sent(),f=0,y=g;f<y.length;f++)if(S=y[f],S.kind==="videoinput"&&S.label)return[2,!0];return[2,!1]}})})},x})(),bi=(function(){function x(g){this.supportedScanTypes=this.validateAndReturnScanTypes(g)}return x.prototype.getDefaultScanType=function(){return this.supportedScanTypes[0]},x.prototype.hasMoreThanOneScanType=function(){return this.supportedScanTypes.length>1},x.prototype.isCameraScanRequired=function(){for(var g=0,f=this.supportedScanTypes;g<f.length;g++){var y=f[g];if(x.isCameraScanType(y))return!0}return!1},x.isCameraScanType=function(g){return g===Si.SCAN_TYPE_CAMERA},x.isFileScanType=function(g){return g===Si.SCAN_TYPE_FILE},x.prototype.validateAndReturnScanTypes=function(g){if(!g||g.length===0)return Br.DEFAULT_SUPPORTED_SCAN_TYPE;var f=Br.DEFAULT_SUPPORTED_SCAN_TYPE.length;if(g.length>f)throw"Max ".concat(f," values expected for ")+"supportedScanTypes";for(var y=0,S=g;y<S.length;y++){var m=S[y];if(!Br.DEFAULT_SUPPORTED_SCAN_TYPE.includes(m))throw"Unsupported scan type ".concat(m)}return g},x})(),or=(function(){function x(){}return x.ALL_ELEMENT_CLASS="html5-qrcode-element",x.CAMERA_PERMISSION_BUTTON_ID="html5-qrcode-button-camera-permission",x.CAMERA_START_BUTTON_ID="html5-qrcode-button-camera-start",x.CAMERA_STOP_BUTTON_ID="html5-qrcode-button-camera-stop",x.TORCH_BUTTON_ID="html5-qrcode-button-torch",x.CAMERA_SELECTION_SELECT_ID="html5-qrcode-select-camera",x.FILE_SELECTION_BUTTON_ID="html5-qrcode-button-file-selection",x.ZOOM_SLIDER_ID="html5-qrcode-input-range-zoom",x.SCAN_TYPE_CHANGE_ANCHOR_ID="html5-qrcode-anchor-scan-type-change",x.TORCH_BUTTON_CLASS_TORCH_ON="html5-qrcode-button-torch-on",x.TORCH_BUTTON_CLASS_TORCH_OFF="html5-qrcode-button-torch-off",x})(),ci=(function(){function x(){}return x.createElement=function(g,f){var y=document.createElement(g);return y.id=f,y.classList.add(or.ALL_ELEMENT_CLASS),g==="button"&&y.setAttribute("type","button"),y},x})(),uu=function(x,g,f,y){function S(m){return m instanceof f?m:new f(function(F){F(m)})}return new(f||(f=Promise))(function(m,F){function W(z){try{T(y.next(z))}catch(H){F(H)}}function Z(z){try{T(y.throw(z))}catch(H){F(H)}}function T(z){z.done?m(z.value):S(z.value).then(W,Z)}T((y=y.apply(x,g||[])).next())})},fu=function(x,g){var f={label:0,sent:function(){if(m[0]&1)throw m[1];return m[1]},trys:[],ops:[]},y,S,m,F;return F={next:W(0),throw:W(1),return:W(2)},typeof Symbol=="function"&&(F[Symbol.iterator]=function(){return this}),F;function W(T){return function(z){return Z([T,z])}}function Z(T){if(y)throw new TypeError("Generator is already executing.");for(;F&&(F=0,T[0]&&(f=0)),f;)try{if(y=1,S&&(m=T[0]&2?S.return:T[0]?S.throw||((m=S.return)&&m.call(S),0):S.next)&&!(m=m.call(S,T[1])).done)return m;switch(S=0,m&&(T=[T[0]&2,m.value]),T[0]){case 0:case 1:m=T;break;case 4:return f.label++,{value:T[1],done:!1};case 5:f.label++,S=T[1],T=[0];continue;case 7:T=f.ops.pop(),f.trys.pop();continue;default:if(m=f.trys,!(m=m.length>0&&m[m.length-1])&&(T[0]===6||T[0]===2)){f=0;continue}if(T[0]===3&&(!m||T[1]>m[0]&&T[1]<m[3])){f.label=T[1];break}if(T[0]===6&&f.label<m[1]){f.label=m[1],m=T;break}if(m&&f.label<m[2]){f.label=m[2],f.ops.push(T);break}m[2]&&f.ops.pop(),f.trys.pop();continue}T=g.call(x,f)}catch(z){T=[6,z],S=0}finally{y=m=0}if(T[0]&5)throw T[1];return{value:T[0]?T[1]:void 0,done:!0}}},iu=(function(){function x(g,f,y){this.isTorchOn=!1,this.torchCapability=g,this.buttonController=f,this.onTorchActionFailureCallback=y}return x.prototype.isTorchEnabled=function(){return this.isTorchOn},x.prototype.flipState=function(){return uu(this,void 0,void 0,function(){var g,f;return fu(this,function(y){switch(y.label){case 0:this.buttonController.disable(),g=!this.isTorchOn,y.label=1;case 1:return y.trys.push([1,3,,4]),[4,this.torchCapability.apply(g)];case 2:return y.sent(),this.updateUiBasedOnLatestSettings(this.torchCapability.value(),g),[3,4];case 3:return f=y.sent(),this.propagateFailure(g,f),this.buttonController.enable(),[3,4];case 4:return[2]}})})},x.prototype.updateUiBasedOnLatestSettings=function(g,f){g===f?(this.buttonController.setText(f?At.torchOffButton():At.torchOnButton()),this.isTorchOn=f):this.propagateFailure(f),this.buttonController.enable()},x.prototype.propagateFailure=function(g,f){var y=g?At.torchOnFailedMessage():At.torchOffFailedMessage();f&&(y+="; Error = "+f),this.onTorchActionFailureCallback(y)},x.prototype.reset=function(){this.isTorchOn=!1},x})(),_2=(function(){function x(g,f){this.onTorchActionFailureCallback=f,this.torchButton=ci.createElement("button",or.TORCH_BUTTON_ID),this.torchController=new iu(g,this,f)}return x.prototype.render=function(g,f){var y=this;this.torchButton.innerText=At.torchOnButton(),this.torchButton.style.display=f.display,this.torchButton.style.marginLeft=f.marginLeft;var S=this;this.torchButton.addEventListener("click",function(m){return uu(y,void 0,void 0,function(){return fu(this,function(F){switch(F.label){case 0:return[4,S.torchController.flipState()];case 1:return F.sent(),S.torchController.isTorchEnabled()?(S.torchButton.classList.remove(or.TORCH_BUTTON_CLASS_TORCH_OFF),S.torchButton.classList.add(or.TORCH_BUTTON_CLASS_TORCH_ON)):(S.torchButton.classList.remove(or.TORCH_BUTTON_CLASS_TORCH_ON),S.torchButton.classList.add(or.TORCH_BUTTON_CLASS_TORCH_OFF)),[2]}})})}),g.appendChild(this.torchButton)},x.prototype.updateTorchCapability=function(g){this.torchController=new iu(g,this,this.onTorchActionFailureCallback)},x.prototype.getTorchButton=function(){return this.torchButton},x.prototype.hide=function(){this.torchButton.style.display="none"},x.prototype.show=function(){this.torchButton.style.display="inline-block"},x.prototype.disable=function(){this.torchButton.disabled=!0},x.prototype.enable=function(){this.torchButton.disabled=!1},x.prototype.setText=function(g){this.torchButton.innerText=g},x.prototype.reset=function(){this.torchButton.innerText=At.torchOnButton(),this.torchController.reset()},x.create=function(g,f,y,S){var m=new x(f,S);return m.render(g,y),m},x})(),S2=(function(){function x(g,f,y){this.fileBasedScanRegion=this.createFileBasedScanRegion(),this.fileBasedScanRegion.style.display=f?"block":"none",g.appendChild(this.fileBasedScanRegion);var S=document.createElement("label");S.setAttribute("for",this.getFileScanInputId()),S.style.display="inline-block",this.fileBasedScanRegion.appendChild(S),this.fileSelectionButton=ci.createElement("button",or.FILE_SELECTION_BUTTON_ID),this.setInitialValueToButton(),this.fileSelectionButton.addEventListener("click",function(W){S.click()}),S.append(this.fileSelectionButton),this.fileScanInput=ci.createElement("input",this.getFileScanInputId()),this.fileScanInput.type="file",this.fileScanInput.accept="image/*",this.fileScanInput.style.display="none",S.appendChild(this.fileScanInput);var m=this;this.fileScanInput.addEventListener("change",function(W){if(!(W==null||W.target==null)){var Z=W.target;if(!(Z.files&&Z.files.length===0)){var T=Z.files,z=T[0],H=z.name;m.setImageNameToButton(H),y(z)}}});var F=this.createDragAndDropMessage();this.fileBasedScanRegion.appendChild(F),this.fileBasedScanRegion.addEventListener("dragenter",function(W){m.fileBasedScanRegion.style.border=m.fileBasedScanRegionActiveBorder(),W.stopPropagation(),W.preventDefault()}),this.fileBasedScanRegion.addEventListener("dragleave",function(W){m.fileBasedScanRegion.style.border=m.fileBasedScanRegionDefaultBorder(),W.stopPropagation(),W.preventDefault()}),this.fileBasedScanRegion.addEventListener("dragover",function(W){m.fileBasedScanRegion.style.border=m.fileBasedScanRegionActiveBorder(),W.stopPropagation(),W.preventDefault()}),this.fileBasedScanRegion.addEventListener("drop",function(W){W.stopPropagation(),W.preventDefault(),m.fileBasedScanRegion.style.border=m.fileBasedScanRegionDefaultBorder();var Z=W.dataTransfer;if(Z){var T=Z.files;if(!T||T.length===0)return;for(var z=!1,H=0;H<T.length;++H){var Le=T.item(H);if(Le){var Ee=/image.*/;if(Le.type.match(Ee)){z=!0;var ct=Le.name;m.setImageNameToButton(ct),y(Le),F.innerText=At.dragAndDropMessage();break}}}z||(F.innerText=At.dragAndDropMessageOnlyImages())}})}return x.prototype.hide=function(){this.fileBasedScanRegion.style.display="none",this.fileScanInput.disabled=!0},x.prototype.show=function(){this.fileBasedScanRegion.style.display="block",this.fileScanInput.disabled=!1},x.prototype.isShowing=function(){return this.fileBasedScanRegion.style.display==="block"},x.prototype.resetValue=function(){this.fileScanInput.value="",this.setInitialValueToButton()},x.prototype.createFileBasedScanRegion=function(){var g=document.createElement("div");return g.style.textAlign="center",g.style.margin="auto",g.style.width="80%",g.style.maxWidth="600px",g.style.border=this.fileBasedScanRegionDefaultBorder(),g.style.padding="10px",g.style.marginBottom="10px",g},x.prototype.fileBasedScanRegionDefaultBorder=function(){return"6px dashed #ebebeb"},x.prototype.fileBasedScanRegionActiveBorder=function(){return"6px dashed rgb(153 151 151)"},x.prototype.createDragAndDropMessage=function(){var g=document.createElement("div");return g.innerText=At.dragAndDropMessage(),g.style.fontWeight="400",g},x.prototype.setImageNameToButton=function(g){var f=20;if(g.length>f){var y=g.substring(0,8),S=g.length,m=g.substring(S-8,S);g="".concat(y,"....").concat(m)}var F=At.fileSelectionChooseAnother()+" - "+g;this.fileSelectionButton.innerText=F},x.prototype.setInitialValueToButton=function(){var g=At.fileSelectionChooseImage()+" - "+At.fileSelectionNoImageSelected();this.fileSelectionButton.innerText=g},x.prototype.getFileScanInputId=function(){return"html5-qrcode-private-filescan-input"},x.create=function(g,f,y){var S=new x(g,f,y);return S},x})(),T2=(function(){function x(g){this.selectElement=ci.createElement("select",or.CAMERA_SELECTION_SELECT_ID),this.cameras=g,this.options=[]}return x.prototype.render=function(g){var f=document.createElement("span");f.style.marginRight="10px";var y=this.cameras.length;if(y===0)throw new Error("No cameras found");if(y===1)f.style.display="none";else{var S=At.selectCamera();f.innerText="".concat(S," (").concat(this.cameras.length,")  ")}for(var m=1,F=0,W=this.cameras;F<W.length;F++){var Z=W[F],T=Z.id,z=Z.label==null?T:Z.label;(!z||z==="")&&(z=[At.anonymousCameraPrefix(),m++].join(" "));var H=document.createElement("option");H.value=T,H.innerText=z,this.options.push(H),this.selectElement.appendChild(H)}f.appendChild(this.selectElement),g.appendChild(f)},x.prototype.disable=function(){this.selectElement.disabled=!0},x.prototype.isDisabled=function(){return this.selectElement.disabled===!0},x.prototype.enable=function(){this.selectElement.disabled=!1},x.prototype.getValue=function(){return this.selectElement.value},x.prototype.hasValue=function(g){for(var f=0,y=this.options;f<y.length;f++){var S=y[f];if(S.value===g)return!0}return!1},x.prototype.setValue=function(g){if(!this.hasValue(g))throw new Error("".concat(g," is not present in the camera list."));this.selectElement.value=g},x.prototype.hasSingleItem=function(){return this.cameras.length===1},x.prototype.numCameras=function(){return this.cameras.length},x.create=function(g,f){var y=new x(f);return y.render(g),y},x})(),N2=(function(){function x(){this.onChangeCallback=null,this.zoomElementContainer=document.createElement("div"),this.rangeInput=ci.createElement("input",or.ZOOM_SLIDER_ID),this.rangeInput.type="range",this.rangeText=document.createElement("span"),this.rangeInput.min="1",this.rangeInput.max="5",this.rangeInput.value="1",this.rangeInput.step="0.1"}return x.prototype.render=function(g,f){this.zoomElementContainer.style.display=f?"block":"none",this.zoomElementContainer.style.padding="5px 10px",this.zoomElementContainer.style.textAlign="center",g.appendChild(this.zoomElementContainer),this.rangeInput.style.display="inline-block",this.rangeInput.style.width="50%",this.rangeInput.style.height="5px",this.rangeInput.style.background="#d3d3d3",this.rangeInput.style.outline="none",this.rangeInput.style.opacity="0.7";var y=At.zoom();this.rangeText.innerText="".concat(this.rangeInput.value,"x ").concat(y),this.rangeText.style.marginRight="10px";var S=this;this.rangeInput.addEventListener("input",function(){return S.onValueChange()}),this.rangeInput.addEventListener("change",function(){return S.onValueChange()}),this.zoomElementContainer.appendChild(this.rangeInput),this.zoomElementContainer.appendChild(this.rangeText)},x.prototype.onValueChange=function(){var g=At.zoom();this.rangeText.innerText="".concat(this.rangeInput.value,"x ").concat(g),this.onChangeCallback&&this.onChangeCallback(parseFloat(this.rangeInput.value))},x.prototype.setValues=function(g,f,y,S){this.rangeInput.min=g.toString(),this.rangeInput.max=f.toString(),this.rangeInput.step=S.toString(),this.rangeInput.value=y.toString(),this.onValueChange()},x.prototype.show=function(){this.zoomElementContainer.style.display="block"},x.prototype.hide=function(){this.zoomElementContainer.style.display="none"},x.prototype.setOnCameraZoomValueChangeCallback=function(g){this.onChangeCallback=g},x.prototype.removeOnCameraZoomValueChangeCallback=function(){this.onChangeCallback=null},x.create=function(g,f){var y=new x;return y.render(g,f),y},x})(),ar;(function(x){x[x.STATUS_DEFAULT=0]="STATUS_DEFAULT",x[x.STATUS_SUCCESS=1]="STATUS_SUCCESS",x[x.STATUS_WARNING=2]="STATUS_WARNING",x[x.STATUS_REQUESTING_PERMISSION=3]="STATUS_REQUESTING_PERMISSION"})(ar||(ar={}));function v2(x){return{fps:x.fps,qrbox:x.qrbox,aspectRatio:x.aspectRatio,disableFlip:x.disableFlip,videoConstraints:x.videoConstraints}}function M2(x,g){return{formatsToSupport:x.formatsToSupport,useBarCodeDetectorIfSupported:x.useBarCodeDetectorIfSupported,experimentalFeatures:x.experimentalFeatures,verbose:g}}var O2=(function(){function x(g,f,y){if(this.lastMatchFound=null,this.cameraScanImage=null,this.fileScanImage=null,this.fileSelectionUi=null,this.elementId=g,this.config=this.createConfig(f),this.verbose=y===!0,!document.getElementById(g))throw"HTML Element with id=".concat(g," not found");this.scanTypeSelector=new bi(this.config.supportedScanTypes),this.currentScanType=this.scanTypeSelector.getDefaultScanType(),this.sectionSwapAllowed=!0,this.logger=new ou(this.verbose),this.persistedDataManager=new A2,f.rememberLastUsedCamera!==!0&&this.persistedDataManager.reset()}return x.prototype.render=function(g,f){var y=this;this.lastMatchFound=null,this.qrCodeSuccessCallback=function(m,F){if(g)g(m,F);else{if(y.lastMatchFound===m)return;y.lastMatchFound=m,y.setHeaderMessage(At.lastMatch(m),ar.STATUS_SUCCESS)}},this.qrCodeErrorCallback=function(m,F){f&&f(m,F)};var S=document.getElementById(this.elementId);if(!S)throw"HTML Element with id=".concat(this.elementId," not found");S.innerHTML="",this.createBasicLayout(S),this.html5Qrcode=new eu(this.getScanRegionId(),M2(this.config,this.verbose))},x.prototype.pause=function(g){(Gr(g)||g!==!0)&&(g=!1),this.getHtml5QrcodeOrFail().pause(g)},x.prototype.resume=function(){this.getHtml5QrcodeOrFail().resume()},x.prototype.getState=function(){return this.getHtml5QrcodeOrFail().getState()},x.prototype.clear=function(){var g=this,f=function(){var y=document.getElementById(g.elementId);y&&(y.innerHTML="",g.resetBasicLayout(y))};return this.html5Qrcode?new Promise(function(y,S){if(!g.html5Qrcode){y();return}g.html5Qrcode.isScanning?g.html5Qrcode.stop().then(function(m){if(!g.html5Qrcode){y();return}g.html5Qrcode.clear(),f(),y()}).catch(function(m){g.verbose&&g.logger.logError("Unable to stop qrcode scanner",m),S(m)}):(g.html5Qrcode.clear(),f(),y())}):Promise.resolve()},x.prototype.getRunningTrackCapabilities=function(){return this.getHtml5QrcodeOrFail().getRunningTrackCapabilities()},x.prototype.getRunningTrackSettings=function(){return this.getHtml5QrcodeOrFail().getRunningTrackSettings()},x.prototype.applyVideoConstraints=function(g){return this.getHtml5QrcodeOrFail().applyVideoConstraints(g)},x.prototype.getHtml5QrcodeOrFail=function(){if(!this.html5Qrcode)throw"Code scanner not initialized.";return this.html5Qrcode},x.prototype.createConfig=function(g){return g?(g.fps||(g.fps=Br.SCAN_DEFAULT_FPS),g.rememberLastUsedCamera!==!Br.DEFAULT_REMEMBER_LAST_CAMERA_USED&&(g.rememberLastUsedCamera=Br.DEFAULT_REMEMBER_LAST_CAMERA_USED),g.supportedScanTypes||(g.supportedScanTypes=Br.DEFAULT_SUPPORTED_SCAN_TYPE),g):{fps:Br.SCAN_DEFAULT_FPS,rememberLastUsedCamera:Br.DEFAULT_REMEMBER_LAST_CAMERA_USED,supportedScanTypes:Br.DEFAULT_SUPPORTED_SCAN_TYPE}},x.prototype.createBasicLayout=function(g){g.style.position="relative",g.style.padding="0px",g.style.border="1px solid silver",this.createHeader(g);var f=document.createElement("div"),y=this.getScanRegionId();f.id=y,f.style.width="100%",f.style.minHeight="100px",f.style.textAlign="center",g.appendChild(f),bi.isCameraScanType(this.currentScanType)?this.insertCameraScanImageToScanRegion():this.insertFileScanImageToScanRegion();var S=document.createElement("div"),m=this.getDashboardId();S.id=m,S.style.width="100%",g.appendChild(S),this.setupInitialDashboard(S)},x.prototype.resetBasicLayout=function(g){g.style.border="none"},x.prototype.setupInitialDashboard=function(g){this.createSection(g),this.createSectionControlPanel(),this.scanTypeSelector.hasMoreThanOneScanType()&&this.createSectionSwap()},x.prototype.createHeader=function(g){var f=document.createElement("div");f.style.textAlign="left",f.style.margin="0px",g.appendChild(f);var y=new y2;y.renderInto(f);var S=document.createElement("div");S.id=this.getHeaderMessageContainerId(),S.style.display="none",S.style.textAlign="center",S.style.fontSize="14px",S.style.padding="2px 10px",S.style.margin="4px",S.style.borderTop="1px solid #f6f6f6",f.appendChild(S)},x.prototype.createSection=function(g){var f=document.createElement("div");f.id=this.getDashboardSectionId(),f.style.width="100%",f.style.padding="10px 0px 10px 0px",f.style.textAlign="left",g.appendChild(f)},x.prototype.createCameraListUi=function(g,f,y){var S=this;S.showHideScanTypeSwapLink(!1),S.setHeaderMessage(At.cameraPermissionRequesting());var m=function(){y||S.createPermissionButton(g,f)};eu.getCameras().then(function(F){S.persistedDataManager.setHasPermission(!0),S.showHideScanTypeSwapLink(!0),S.resetHeaderMessage(),F&&F.length>0?(g.removeChild(f),S.renderCameraSelection(F)):(S.setHeaderMessage(At.noCameraFound(),ar.STATUS_WARNING),m())}).catch(function(F){S.persistedDataManager.setHasPermission(!1),y?y.disabled=!1:m(),S.setHeaderMessage(F,ar.STATUS_WARNING),S.showHideScanTypeSwapLink(!0)})},x.prototype.createPermissionButton=function(g,f){var y=this,S=ci.createElement("button",this.getCameraPermissionButtonId());S.innerText=At.cameraPermissionTitle(),S.addEventListener("click",function(){S.disabled=!0,y.createCameraListUi(g,f,S)}),f.appendChild(S)},x.prototype.createPermissionsUi=function(g,f){var y=this;if(bi.isCameraScanType(this.currentScanType)&&this.persistedDataManager.hasCameraPermissions()){ru.hasPermissions().then(function(S){S?y.createCameraListUi(g,f):(y.persistedDataManager.setHasPermission(!1),y.createPermissionButton(g,f))}).catch(function(S){y.persistedDataManager.setHasPermission(!1),y.createPermissionButton(g,f)});return}this.createPermissionButton(g,f)},x.prototype.createSectionControlPanel=function(){var g=document.getElementById(this.getDashboardSectionId()),f=document.createElement("div");g.appendChild(f);var y=document.createElement("div");y.id=this.getDashboardSectionCameraScanRegionId(),y.style.display=bi.isCameraScanType(this.currentScanType)?"block":"none",f.appendChild(y);var S=document.createElement("div");S.style.textAlign="center",y.appendChild(S),this.scanTypeSelector.isCameraScanRequired()&&this.createPermissionsUi(y,S),this.renderFileScanUi(f)},x.prototype.renderFileScanUi=function(g){var f=bi.isFileScanType(this.currentScanType),y=this,S=function(m){if(!y.html5Qrcode)throw"html5Qrcode not defined";bi.isFileScanType(y.currentScanType)&&(y.setHeaderMessage(At.loadingImage()),y.html5Qrcode.scanFileV2(m,!0).then(function(F){y.resetHeaderMessage(),y.qrCodeSuccessCallback(F.decodedText,F)}).catch(function(F){y.setHeaderMessage(F,ar.STATUS_WARNING),y.qrCodeErrorCallback(F,au.createFrom(F))}))};this.fileSelectionUi=S2.create(g,f,S)},x.prototype.renderCameraSelection=function(g){var f=this,y=this,S=document.getElementById(this.getDashboardSectionCameraScanRegionId());S.style.textAlign="center";var m=N2.create(S,!1),F=function(ge){var Ue=ge.zoomFeature();if(Ue.isSupported()){m.setOnCameraZoomValueChangeCallback(function(Ye){Ue.apply(Ye)});var yt=1;f.config.defaultZoomValueIfSupported&&(yt=f.config.defaultZoomValueIfSupported),yt=Xg(yt,Ue.min(),Ue.max()),m.setValues(Ue.min(),Ue.max(),yt,Ue.step()),m.show()}},W=T2.create(S,g),Z=document.createElement("span"),T=ci.createElement("button",or.CAMERA_START_BUTTON_ID);T.innerText=At.scanButtonStartScanningText(),Z.appendChild(T);var z=ci.createElement("button",or.CAMERA_STOP_BUTTON_ID);z.innerText=At.scanButtonStopScanningText(),z.style.display="none",z.disabled=!0,Z.appendChild(z);var H,Le=function(ge){if(!ge.torchFeature().isSupported()){H&&H.hide();return}H?H.updateTorchCapability(ge.torchFeature()):H=_2.create(Z,ge.torchFeature(),{display:"none",marginLeft:"5px"},function(Ue){y.setHeaderMessage(Ue,ar.STATUS_WARNING)}),H.show()};S.appendChild(Z);var Ee=function(ge){ge||(T.style.display="none"),T.innerText=At.scanButtonStartScanningText(),T.style.opacity="1",T.disabled=!1,ge&&(T.style.display="inline-block")};if(T.addEventListener("click",function(ge){T.innerText=At.scanButtonScanningStarting(),W.disable(),T.disabled=!0,T.style.opacity="0.5",f.scanTypeSelector.hasMoreThanOneScanType()&&y.showHideScanTypeSwapLink(!1),y.resetHeaderMessage();var Ue=W.getValue();y.persistedDataManager.setLastUsedCameraId(Ue),y.html5Qrcode.start(Ue,v2(y.config),y.qrCodeSuccessCallback,y.qrCodeErrorCallback).then(function(yt){z.disabled=!1,z.style.display="inline-block",Ee(!1);var Ye=y.html5Qrcode.getRunningTrackCameraCapabilities();f.config.showTorchButtonIfSupported===!0&&Le(Ye),f.config.showZoomSliderIfSupported===!0&&F(Ye)}).catch(function(yt){y.showHideScanTypeSwapLink(!0),W.enable(),Ee(!0),y.setHeaderMessage(yt,ar.STATUS_WARNING)})}),W.hasSingleItem()&&T.click(),z.addEventListener("click",function(ge){if(!y.html5Qrcode)throw"html5Qrcode not defined";z.disabled=!0,y.html5Qrcode.stop().then(function(Ue){f.scanTypeSelector.hasMoreThanOneScanType()&&y.showHideScanTypeSwapLink(!0),W.enable(),T.disabled=!1,z.style.display="none",T.style.display="inline-block",H&&(H.reset(),H.hide()),m.removeOnCameraZoomValueChangeCallback(),m.hide(),y.insertCameraScanImageToScanRegion()}).catch(function(Ue){z.disabled=!1,y.setHeaderMessage(Ue,ar.STATUS_WARNING)})}),y.persistedDataManager.getLastUsedCameraId()){var ct=y.persistedDataManager.getLastUsedCameraId();W.hasValue(ct)?(W.setValue(ct),T.click()):y.persistedDataManager.resetLastUsedCameraId()}},x.prototype.createSectionSwap=function(){var g=this,f=At.textIfCameraScanSelected(),y=At.textIfFileScanSelected(),S=document.getElementById(this.getDashboardSectionId()),m=document.createElement("div");m.style.textAlign="center";var F=ci.createElement("span",this.getDashboardSectionSwapLinkId());F.style.textDecoration="underline",F.style.cursor="pointer",F.innerText=bi.isCameraScanType(this.currentScanType)?f:y,F.addEventListener("click",function(){if(!g.sectionSwapAllowed){g.verbose&&g.logger.logError("Section swap called when not allowed");return}g.resetHeaderMessage(),g.fileSelectionUi.resetValue(),g.sectionSwapAllowed=!1,bi.isCameraScanType(g.currentScanType)?(g.clearScanRegion(),g.getCameraScanRegion().style.display="none",g.fileSelectionUi.show(),F.innerText=y,g.currentScanType=Si.SCAN_TYPE_FILE,g.insertFileScanImageToScanRegion()):(g.clearScanRegion(),g.getCameraScanRegion().style.display="block",g.fileSelectionUi.hide(),F.innerText=f,g.currentScanType=Si.SCAN_TYPE_CAMERA,g.insertCameraScanImageToScanRegion(),g.startCameraScanIfPermissionExistsOnSwap()),g.sectionSwapAllowed=!0}),m.appendChild(F),S.appendChild(m)},x.prototype.startCameraScanIfPermissionExistsOnSwap=function(){var g=this,f=this;if(this.persistedDataManager.hasCameraPermissions()){ru.hasPermissions().then(function(y){if(y){var S=document.getElementById(f.getCameraPermissionButtonId());if(!S)throw g.logger.logError("Permission button not found, fail;"),"Permission button not found";S.click()}else f.persistedDataManager.setHasPermission(!1)}).catch(function(y){f.persistedDataManager.setHasPermission(!1)});return}},x.prototype.resetHeaderMessage=function(){var g=document.getElementById(this.getHeaderMessageContainerId());g.style.display="none"},x.prototype.setHeaderMessage=function(g,f){f||(f=ar.STATUS_DEFAULT);var y=this.getHeaderMessageDiv();switch(y.innerText=g,y.style.display="block",f){case ar.STATUS_SUCCESS:y.style.background="rgba(106, 175, 80, 0.26)",y.style.color="#477735";break;case ar.STATUS_WARNING:y.style.background="rgba(203, 36, 49, 0.14)",y.style.color="#cb2431";break;case ar.STATUS_DEFAULT:default:y.style.background="rgba(0, 0, 0, 0)",y.style.color="rgb(17, 17, 17)";break}},x.prototype.showHideScanTypeSwapLink=function(g){this.scanTypeSelector.hasMoreThanOneScanType()&&(g!==!0&&(g=!1),this.sectionSwapAllowed=g,this.getDashboardSectionSwapLink().style.display=g?"inline-block":"none")},x.prototype.insertCameraScanImageToScanRegion=function(){var g=this,f=document.getElementById(this.getScanRegionId());if(this.cameraScanImage){f.innerHTML="<br>",f.appendChild(this.cameraScanImage);return}this.cameraScanImage=new Image,this.cameraScanImage.onload=function(y){f.innerHTML="<br>",f.appendChild(g.cameraScanImage)},this.cameraScanImage.width=64,this.cameraScanImage.style.opacity="0.8",this.cameraScanImage.src=p2,this.cameraScanImage.alt=At.cameraScanAltText()},x.prototype.insertFileScanImageToScanRegion=function(){var g=this,f=document.getElementById(this.getScanRegionId());if(this.fileScanImage){f.innerHTML="<br>",f.appendChild(this.fileScanImage);return}this.fileScanImage=new Image,this.fileScanImage.onload=function(y){f.innerHTML="<br>",f.appendChild(g.fileScanImage)},this.fileScanImage.width=64,this.fileScanImage.style.opacity="0.8",this.fileScanImage.src=m2,this.fileScanImage.alt=At.fileScanAltText()},x.prototype.clearScanRegion=function(){var g=document.getElementById(this.getScanRegionId());g.innerHTML=""},x.prototype.getDashboardSectionId=function(){return"".concat(this.elementId,"__dashboard_section")},x.prototype.getDashboardSectionCameraScanRegionId=function(){return"".concat(this.elementId,"__dashboard_section_csr")},x.prototype.getDashboardSectionSwapLinkId=function(){return or.SCAN_TYPE_CHANGE_ANCHOR_ID},x.prototype.getScanRegionId=function(){return"".concat(this.elementId,"__scan_region")},x.prototype.getDashboardId=function(){return"".concat(this.elementId,"__dashboard")},x.prototype.getHeaderMessageContainerId=function(){return"".concat(this.elementId,"__header_message")},x.prototype.getCameraPermissionButtonId=function(){return or.CAMERA_PERMISSION_BUTTON_ID},x.prototype.getCameraScanRegion=function(){return document.getElementById(this.getDashboardSectionCameraScanRegionId())},x.prototype.getDashboardSectionSwapLink=function(){return document.getElementById(this.getDashboardSectionSwapLinkId())},x.prototype.getHeaderMessageDiv=function(){return document.getElementById(this.getHeaderMessageContainerId())},x})();function D2({onScanSuccess:x}){return ln.useEffect(()=>{const g="html5-qrcode-scanner",f={fps:10,qrbox:{width:260,height:360}},y=new O2(g,f,!1);return setTimeout(()=>{y.render(S=>{x(S),y.clear()},S=>{})},100),()=>{y.clear().catch(()=>{})}},[x]),_.jsx("div",{id:"html5-qrcode-scanner",className:"w-full h-full"})}function R2({tx:x,paperWidth:g=32}){const{printerServer:f,isBluetoothConnected:y}=bg(),S=(Z,T=g)=>{if(Z.length>=T)return Z;const z=Math.floor((T-Z.length)/2);return" ".repeat(z)+Z},m=(Z,T,z=g)=>{const H=Z.length+T.length;if(H>=z)return`${Z}
${T}`;const Le=" ".repeat(z-H);return`${Z}${Le}${T}`},F=async(Z,T,z=200)=>{for(let H=0;H<T.length;H+=z){const Le=T.slice(H,H+z);await Z.writeValue(Le),await new Promise(Ee=>setTimeout(Ee,50))}},W=async()=>{var Z,T,z;if(!f||!y){kt.error("Printer Bluetooth belum terhubung");return}try{const H=new TextEncoder,Le=new Date().toLocaleString("id-ID",{day:"2-digit",month:"2-digit",year:"numeric",hour:"2-digit",minute:"2-digit"}),Ee=[m("Invoice",x.invoice??"-"),m("Tanggal",Le),m("Jenis",x.order_type_label??"-"),x.table_number?m("Meja",String(x.table_number)):null,x.customer_name?m("Pelanggan",x.customer_name):null,m("Kasir",x.cashier_name??"-")].filter(Boolean).join(`
`),ct=((Z=x.items)==null?void 0:Z.map(_e=>{const It=_e.name.match(new RegExp(`.{1,${g}}`,"g"))||[""],Be=m(`${_e.qty} x ${_e.price.toLocaleString("id-ID")}`,_e.total.toLocaleString("id-ID"),g);return[...It,Be].join(`
`)}).join(`
`))??"",ge=[m("Subtotal",x.subtotal.toLocaleString("id-ID"),g),x.discount?m("Diskon",`-${x.discount.toLocaleString("id-ID")}`,g):null,...((T=x.taxes)==null?void 0:T.filter(_e=>_e.value&&_e.value!==0).map(_e=>m(_e.label,_e.value.toLocaleString("id-ID"),g)))||[],m("Total",x.grand_total.toLocaleString("id-ID"),g)].filter(Boolean).join(`
`),Ue=[m(`Bayar (${x.pay_label??"-"})`,x.pay.toLocaleString("id-ID"),g),m("Kembali",x.change.toLocaleString("id-ID"),g)].join(`
`),yt=`
${S(((z=x.company_name)==null?void 0:z.toUpperCase())||"")}
${S(x.company_address||"")}
${S("Telp: "+(x.company_phone||""))}
${"-".repeat(g)}
${Ee}
${"-".repeat(g)}
${ct}
${"-".repeat(g)}
${ge}
${"-".repeat(g)}
${Ue}
${"-".repeat(g)}
${S("Terima kasih - Simpan struk ini")}
${S("sebagai bukti transaksi.")}
\r
\r

`,Ye=H.encode(yt),fe=await f.getPrimaryServices();for(const _e of fe){const It=await _e.getCharacteristics();for(const Be of It)if(Be.properties.write||Be.properties.writeWithoutResponse){await F(Be,Ye),kt.success("Struk berhasil dikirim ke printer!");return}}kt.error("Tidak menemukan karakteristik write di printer")}catch(H){console.error(H),kt.error("Gagal mencetak: "+H.message)}};return y?_.jsxs(ft,{type:"button",className:"w-full bg-blue-600 hover:bg-blue-700 text-white",onClick:W,children:[_.jsx(_g,{className:"w-5 h-5 mr-2 text-white"})," Cetak Bluetooth"]}):null}function dx(){var qe,Jn,Mi,Oi,_n,ui,jt,yr,Zr,Pn,fi,ur,kr,tn,fr,An,ue,Ir,hi,nn,br,Fr;const{cashierShift:x,shifts:g,cashiers:f,categories:y,items:S,filters:m,banks:F,settings:W,app_settings:Z}=wg().props,{selectedOrderType:T,setSelectedOrderType:z,selectedPlatform:H,setSelectedPlatform:Le,selectedTable:Ee,setSelectedTable:ct,transaction:ge,setTransaction:Ue}=Ag(),yt=(qe=W.find(I=>I.code==="PPR"))==null?void 0:qe.value,Ye=ln.useRef(0),fe=ln.useRef(""),[_e,It]=ln.useState(""),Be=ln.useRef(null),re=ln.useRef(null),[Ge,ie]=ln.useState("search"),[Pr,en]=ln.useState(!1),ye=Z.find(I=>I.key==="restaurant"),rt=Z.find(I=>I.key==="waiter_service"),Mt=Z.find(I=>I.key==="partial_payments"),{data:v,setData:te,post:Te,processing:bn,errors:Qn}=Cg({items:[],cashierId:"",note:"",selectedOrderType:"",selectedTable:"",selectedPlatform:"",filters:{search:m.search,category:m.category},carts:[],modalProduct:!1,modalCashier:!1,modalItem:!1,modalDiscount:!1,modalCustomer:!1,newModalCustomer:!1,modalShiftCashier:!1,modalPayment:!1,modalNote:!1,modalDelivery:!1,cashierShift:{shift_id:"",cash:0},newCust:{name:"",email:"",phone:"",address:""},customers:[],searchCustomer:"",selectedCustomer:{id:"",name:""},selectedItem:{name:"",quantity:0,price:0,discount_type:"",discount:"",note:"",type:"",stock:0,total_price:0},selectedPaymentMethod:"",selectedBank:"",discounts:{code:"",discount_type:"",discount_amount:0},delivery:{name:"",no_resi:"",address:"",note:"",status:""},notes:{no_ref:"",transaction_source:"",note:""},pay:0,remains:0,return:0,discount:0,subTotal:0,other:0,ppn:0,grandTotal:0,isPendingOrder:!1,invoice:"",modalTransaction:!1,transactionPrint:{invoice:"",cashier_shift:{user:{name:""}},cashier:{name:""},user:{name:""},transaction_type:"",platform:"",order_type_label:"",table:{number:0},customer:{name:""},items:"",subtotal:0,discount:0,transaction_taxs:[],grandTotal:0,grand_total:0,paid:0,return:0,pay:0,change:0,pay_label:0,company_name:"",company_address:"",company_phone:""},lastTransaction:{invoice:"",transaction_type:"",pay:"",return:""},transaction_taxs:[]});function xn(I){const ne={product:"App\\Models\\ProductVariant",menu:"App\\Models\\Menu",package:"App\\Models\\DiscountPackage"}[I.type];return ne?`${ne}:${I.id}`:""}async function pn(I,Y){var ne;try{return((ne=(await Or.post(route("apps.pos.dicount-per-items"),{customer_id:(Y==null?void 0:Y.id)??null,carts:I.map(oe=>({id:oe.id,type:oe.type,price:Number(oe.price),quantity:Number(oe.quantity)}))})).data)==null?void 0:ne.lines)??{}}catch(X){return console.error(X),{}}}function qt(I,Y,ne){return Y==="percentage"?Math.max(0,Math.min(100,ne||0)):Y==="nominal"?Math.max(0,Math.min(I,ne||0)):0}function Wn(I,Y,ne,X){const oe=Number(I),de=Number(X)||0;let se=0;return ne==="nominal"&&(se=Math.min(de,oe)),ne==="percentage"&&(se=oe*de/100),(oe-se)*Number(Y)}function Ft(I,Y,ne){const X=Math.max(Number(Y)-Number(ne),0),oe=I.filter(ze=>ze.code==="PJK"||ze.code==="OPR"),de=oe.map(ze=>{const V=String(ze.value??"").trim(),st=V.endsWith("%")?X*(parseFloat(V.replace("%",""))||0)/100:parseFloat(V)||0;return{code:ze.code,name:ze.name,value:Number((st||0).toFixed(2))}}),se=ze=>oe.reduce((V,st)=>{const pe=String(st.value??"").trim(),at=pe.endsWith("%")?X*(parseFloat(pe.replace("%",""))||0)/100:parseFloat(pe)||0;return V+(at||0)},0),Ze=Number(se().toFixed(2)),De=Number(se().toFixed(2));return{rows:de,ppnAmount:Ze,oprAmount:De}}const Rn=(I,Y,ne)=>{const X=I.reduce((V,st)=>V+st.total_price,0),oe=Math.max(X-Y,0),se=ne.filter(V=>V.code==="PJK"&&V.is_active).reduce((V,st)=>{if(st.value.endsWith("%")){const pe=parseFloat(st.value)||0;return V+oe*pe/100}else return V+(parseInt(st.value)||0)},0),De=ne.filter(V=>V.code==="OPR"&&V.is_active).reduce((V,st)=>{if(st.value.endsWith("%")){const pe=parseFloat(st.value)||0;return V+oe*pe/100}else return V+(parseInt(st.value)||0)},0),ze=X>0?X+se+De-Y:0;return{subTotal:X,ppnAmount:se,oprAmount:De,grandTotal:ze}};ln.useEffect(()=>{if(!ge||!Array.isArray(ge.transaction_details))return;const I=ge.transaction_details.map(se=>{const Ze=Number(se.price),De=se.discount_type=="rupiah"?"nominal":se.discount_type;let ze=0;se.discount&&De&&(De==="nominal"?ze=se.discount*se.quantity:ze=Ze*se.discount/100*se.quantity);const V=Ze*se.quantity-ze;return{id:String(se.items_id),name:se.name,price:Ze,quantity:Number(se.quantity),type:se.type,discount_type:se.discount_type=="rupiah"?"nominal":"percentage",discount:se.discount,note:se.note,total_price:V<0?0:V,stock:se.stock,...se.type==="package"&&{details:se.discount_package_items??[]}}}),{subTotal:Y,ppnAmount:ne,oprAmount:X,grandTotal:oe}=Rn(I,0,W),{rows:de}=Ft(W,Y,0);te(se=>{var Ze,De;return{...se,selectedOrderType:ge.transaction_type,selectedTable:ge.transaction_type==="dine_in"?ge.table_id:"",selectedPlatform:"",selectedCustomer:{id:((Ze=ge.customer)==null?void 0:Ze.id)??"",name:((De=ge.customer)==null?void 0:De.name)??""},carts:I,subTotal:Y,ppn:ne,other:X,grandTotal:oe,transaction_taxs:de,isPendingOrder:!0,invoice:ge.invoice}})},[ge,W]);const me=I=>{switch(I.type){case"menu":return I.selling_price;case"package":return I.total_price;default:return I.price}},Ti=async()=>{try{const I=await Or(route("apps.options.get-coupons"),{params:{code:v.discounts.code}});I.data.code===200&&te(Y=>({...Y,discounts:{code:I.data.data.code,discount_type:I.data.data.type=="percentage"?"persen":"nominal",discount_amount:I.data.data.value}}))}catch(I){console.log(I)}};ln.useEffect(()=>{v.discounts.code!=""&&Ti()},[v.discounts.code]),ln.useEffect(()=>{te("items",S.data)},[S.data]),ln.useEffect(()=>{te(X=>({...X,selectedTable:Ee,selectedOrderType:T,selectedPlatform:H}));const I=W.find(X=>X.name===H);if(!I||!I.value){te("items",S.data);return}const Y=I.value.trim(),ne=S.data.map(X=>{const oe=me(X);if(Y.endsWith("%")){const se=1+(parseFloat(Y.replace("%",""))||0)/100;return X.type==="menu"?{...X,selling_price:Math.round(oe*se)}:X.type==="product"?{...X,price:Math.round(oe*se)}:{...X,total_price:Math.round(oe*se)}}else{const de=parseInt(Y)||0;return X.type==="menu"?{...X,selling_price:oe+de}:X.type==="product"?{...X,price:oe+de}:{...X,total_price:oe+de}}});te("items",ne)},[H,S.data,T,Ee]),ln.useEffect(()=>{const I=Number(v.pay)||0,Y=Number(v.grandTotal)||0;I>=Y?te(ne=>({...ne,return:I-Y,remains:0})):te(ne=>({...ne,return:0,remains:Y-I}))},[v.pay]),ln.useEffect(()=>{const I=Math.max(v.subTotal-v.discount,0),ne=W.filter(X=>X.code==="PJK"&&X.is_active).reduce((X,oe)=>{if(oe.value.endsWith("%")){const de=parseFloat(oe.value.replace("%",""))||0;return X+I*de/100}else return X+(parseInt(oe.value)||0)},0);te(X=>({...X,ppn:ne,grandTotal:X.subTotal>0?X.subTotal+ne+X.other-X.discount:0}))},[v.subTotal,v.discount,W]),ln.useEffect(()=>{const I=Math.max(v.subTotal-v.discount,0),ne=W.filter(X=>X.code==="OPR"&&X.is_active).reduce((X,oe)=>{if(oe.value.endsWith("%")){const de=parseFloat(oe.value.replace("%",""))||0;return X+I*de/100}else return X+(parseInt(oe.value)||0)},0);te(X=>({...X,other:ne,grandTotal:X.subTotal>0?X.subTotal+X.ppn+ne-X.discount:0}))},[v.subTotal,v.discount,v.ppn,W]);const gt=m.category,cn=ln.useCallback(I=>{const Y=m.category===I,ne={search:m.search,category:Y?void 0:I};Go.get(route("apps.pos.index"),ne,{preserveState:!0,replace:!0})},[m]),Ln=async I=>{const Y=Array.isArray(v.carts)?v.carts:[],ne=Number(me(I));let X;const oe=Y.find(pe=>String(pe.id)===String(I.id)&&String(pe.type)===String(I.type));if(oe){const pe=Number(oe.quantity)+1;if(pe>I.stock)return kt("Stok tidak mencukupi, sisa stok "+I.stock);X=Y.map(at=>String(at.id)===String(I.id)&&String(at.type)===String(I.type)?{...at,quantity:pe,price:ne}:at)}else X=[...Y,{id:String(I.id),name:I.name,price:ne,quantity:1,type:I.type,discount_type:"",discount:"",manual_discount_enabled:!1,manual_discount_type:"",manual_discount_value:"",note:"",total_price:ne,stock:I.stock,...I.type==="package"&&{details:I.discount_package_items??[]}}];const de=await pn(X,v.selectedCustomer),se=X.map(pe=>{const at=Number(pe.price),Cn=Number(pe.quantity);if(pe.manual_discount_enabled){const Vn=pe.manual_discount_type||"",Sn=pe.manual_discount_value??"",Ct=Wn(at,Cn,Vn,Sn);return{...pe,discount_type:Vn,discount:String(Sn||""),total_price:Ct}}const Se=de[xn(pe)],je=(Se==null?void 0:Se.discount_type)||"",Ce=(Se==null?void 0:Se.discount)??"",En=Wn(at,Cn,je,Ce);return{...pe,discount_type:je,discount:je?String(Ce):"",total_price:En}}),Ze=se.reduce((pe,at)=>pe+at.total_price,0),{ppnAmount:De,oprAmount:ze}=Rn(se,0,W),{rows:V}=Ft(W,Ze,0),st=Ze+De+ze;te({...v,carts:se,subTotal:Ze,ppn:De,other:ze,grandTotal:st,transaction_taxs:V}),ut()},Yt=I=>{const ne=(Array.isArray(v.carts)?v.carts:[]).filter(X=>!(X.id===I.id&&X.type===I.type&&I.name===X.name));te({...v,carts:ne,modalItem:!1})},Ar=I=>{te({...v,modalItem:!0,selectedItem:{...I,discount_type:I.discount_type??""}})},$e=async(I,Y,ne,X,oe,de)=>{const se=Array.isArray(v.carts)?v.carts:[];if(Y>I.stock)return kt("Stok tidak mencukupi, sisa stok "+I.stock);const Ze=Number(ne),De=Number(Y),ze=se.map(Ce=>{if(Ce.id===I.id&&Ce.type===I.type){const En=!!X,Vn=qt(Ze,X,Number(oe));return{...Ce,price:Ze,quantity:De,note:de,manual_discount_enabled:En,manual_discount_type:En?X:"",manual_discount_value:En?String(Vn):"",stock:Number(I.stock)}}return Ce}),V=await pn(ze,v.selectedCustomer),st=ze.map(Ce=>{const En=Number(Ce.price),Vn=Number(Ce.quantity);if(Ce.manual_discount_enabled){const Et=Ce.manual_discount_type||"",Tn=qt(En,Et,Number(Ce.manual_discount_value)),Ji=Wn(En,Vn,Et,Tn);return{...Ce,discount_type:Et,discount:String(Tn),total_price:Ji}}const Sn=V[xn(Ce)],Ct=(Sn==null?void 0:Sn.discount_type)||"",kn=Number((Sn==null?void 0:Sn.discount)??0),xs=Wn(En,Vn,Ct,kn);return{...Ce,discount_type:Ct,discount:Ct?String(kn):"",total_price:xs}}),pe=st.reduce((Ce,En)=>Ce+En.total_price,0),{ppnAmount:at,oprAmount:Cn}=Rn(st,0,W),{rows:Se}=Ft(W,pe,0),je=pe+at+Cn;te({...v,carts:st,modalItem:!1,selectedItem:{name:"",quantity:0,price:0,discount_type:"",discount:"",note:"",type:"",total_price:0,stock:0},subTotal:pe,ppn:at,other:Cn,grandTotal:je,transaction_taxs:Se})},Qt=()=>{te(I=>({...I,carts:[],selectedItem:{name:"",quantity:0,price:0,discount_type:"",discount:"",note:"",type:"",stock:0,total_price:0},discounts:{code:"",discount_type:"",discount_amount:0},pay:0,remains:0,return:0,discount:0,subTotal:0,other:0,ppn:0,grandTotal:0,transaction_taxs:[]}))},un=()=>{let I=v.discounts.discount_amount;const Y=Number(v.subTotal);let ne=Y;v.discounts.discount_type==="nominal"?ne=Y-Number(I||0):(ne=Y-Number(I||0)/100*Y,I=Number(I||0)/100*Y);const{rows:X,ppnAmount:oe,oprAmount:de}=Ft(W,Y,I);te({...v,discount:I,grandTotal:ne,ppn:oe,other:de,transaction_taxs:X,modalDiscount:!v.modalDiscount})},Vr=async()=>{try{const I=await Or.get(route("apps.options.get-last-transactions"));te(Y=>({...Y,grandTotal:0,lastTransaction:{invoice:I.data.data.invoice,transaction_type:I.data.data.transaction_type,pay:I.data.data.pay,return:I.data.data.change},transactionPrint:I.data.data,modalTransaction:!0}))}catch(I){console.log(I)}},ht=async I=>{if(I.preventDefault(),!(Mt!=null&&Mt.is_active)&&v.pay<v.grandTotal)return kt("Jumlah bayar harus sama dengan atau lebih besar dari grand total");Te(route("apps.pos.store"),{onSuccess:()=>{te(Y=>({...Y,cashierId:"",note:"",selectedOrderType:"",selectedTable:"",selectedPlatform:"",filters:{search:m.search,category:m.category},carts:[],modalProduct:!1,modalCashier:!1,modalItem:!1,modalDiscount:!1,modalCustomer:!1,newModalCustomer:!1,modalShiftCashier:!1,modalPayment:!1,modalNote:!1,modalDelivery:!1,cashierShift:{shift_id:"",cash:0},newCust:{name:"",email:"",phone:"",address:""},customers:[],searchCustomer:"",selectedCustomer:{id:"",name:""},selectedItem:{name:"",quantity:0,price:0,discount_type:"",discount:"",note:"",type:"",stock:0,total_price:0},selectedPaymentMethod:"",selectedBank:"",discounts:{code:"",discount_type:"",discount_amount:0},delivery:{name:"",no_resi:"",address:"",note:"",status:""},notes:{no_ref:"",transaction_source:"",note:""},pay:0,remains:0,return:0,discount:0,subTotal:0,other:0,ppn:0,grandTotal:0,isPendingOrder:!1,invoice:""})),Ue(null),z(""),Le(""),ct(""),window.dispatchEvent(new CustomEvent("pos:tx.changed")),Vr()}})},ut=()=>{new Audio("/sounds/add-to-cart.mp3").play()},Ke=async()=>{try{const I=await Or.get(route("apps.customers.list-customer-by-request"),{params:{selectedCustomer:v.searchCustomer}});te("customers",I.data)}catch(I){console.log(I)}},lr=ln.useCallback(Vg.debounce(()=>{Ke()},500),[v.searchCustomer]),le=async I=>{const Y=Array.isArray(v.carts)?[...v.carts]:[],ne=await pn(Y,{id:I.id}),X=Y.map(ze=>{const V=xn(ze),st=ne[V];let pe="",at="";st&&st.discount_type&&st.discount!=null&&(pe=st.discount_type,at=String(st.discount));const Cn=Number(ze.price),Se=Number(ze.quantity);let je=0;at&&pe&&(je=pe==="nominal"?Number(at)||0:Cn*(Number(at)||0)/100);const Ce=(Cn-Math.min(je,Cn))*Se;return{...ze,discount_type:pe,discount:at,total_price:Ce}}),oe=X.reduce((ze,V)=>ze+V.total_price,0),{ppnAmount:de,oprAmount:se}=Rn(X,0,W),{rows:Ze}=Ft(W,oe,0),De=oe+de+se;te(ze=>({...ze,selectedCustomer:{id:I.id,name:I.name},searchCustomer:"",customers:[],modalCustomer:!v.modalCustomer,carts:X,subTotal:oe,ppn:de,other:se,grandTotal:De,transaction_taxs:Ze}))},cr=async I=>{I.preventDefault();try{const ne=(await Or.post(route("apps.customers.store"),{name:v.newCust.name,email:v.newCust.email,phone:v.newCust.phone,address:v.newCust.address})).data.customer;te(X=>({...X,newCust:{name:"",email:"",phone:"",address:""},newModalCustomer:!X.newModalCustomer,modalCustomer:!X.modalCustomer,selectedCustomer:{id:ne.id,name:ne.name}}))}catch(Y){console.log(Y)}},Yr=I=>{I.preventDefault(),Te(route("apps.pos.open-cashier-shift"),{onSuccess:()=>{kt("Shift kasir berhasil dibuka"),te(Y=>({...Y,modalShiftCashier:!v.modalShiftCashier,cashierShift:{shift_id:"",cash:0}}))},onError:Y=>{console.error(Y),kt.error("Gagal membuka shift kasir, silakan coba lagi.")}})};ln.useEffect(()=>{v.selectedPaymentMethod==="transfer"?te(I=>({...I,pay:v.grandTotal})):v.selectedPaymentMethod==="tunai"&&te(I=>({...I,pay:0}))},[v.selectedPaymentMethod,v.grandTotal]);const Gn=ln.useCallback(async I=>{const Y=I.target.value,ne=Date.now(),X=ne-Ye.current;Ye.current=ne;const oe=X<100;if(fe.current+=Y.slice(-1),oe&&fe.current.length>=8){try{const Ze=(await Or.get(route("apps.pos.search-by-barcode",{barcode:fe.current}))).data.product;Ze&&(Ln(Ze),kt("Produk berhasil ditambahkan ke keranjang")),fe.current="",Go.get(route("apps.pos.index"),{search:"",category:m.category||void 0},{preserveState:!0,replace:!0})}catch(se){console.log(se),fe.current=""}return}X>150&&(fe.current="");const de={search:Y};m.category&&(de.category=m.category),Go.get(route("apps.pos.index"),de,{preserveState:!0,replace:!0})},[m.category,Ln]),Cr=async()=>{try{await Or.post(route("apps.pos.update-table"),{invoice:v.lastTransaction.invoice}),kt("Data berhasil disimpan")}catch(I){console.log(I),kt("Data gagal disimpan")}},Bn=async()=>{try{ye!=null&&ye.is_active&&(await Or.post(route("apps.pos.send-kitchen"),{invoice:v.lastTransaction.invoice}),kt("Pesanan berhasil dikirim ke dapur")),kt("Data berhasil disimpan"),te("modalTransaction",!v.modalTransaction)}catch(I){console.log(I),kt("Data gagal disimpan")}},mn=I=>`Rp ${Number(I??0).toLocaleString("id-ID")}`,wn=()=>new Date().toLocaleString("id-ID"),Tt=(I,Y,ne="-")=>{var X;return((X=I.find(oe=>oe.code===Y))==null?void 0:X.value)??ne},Rt=I=>{const Y=Number(I??0);return Number.isFinite(Y)?Y:0};function Er(I){var ne;const Y=String((I==null?void 0:I.payment_method)??"").toLowerCase().trim();if(Y==="transfer"){const X=((ne=I==null?void 0:I.bank_account)==null?void 0:ne.bank_name)??(I==null?void 0:I.bank_name)??"";return X?`Transfer ${String(X).toUpperCase()}`:"Transfer"}return Y==="cash"?"Cash":Y?Y.charAt(0).toUpperCase()+Y.slice(1):"-"}function Ni(I,Y,ne,X){const oe=Rt(I),de=Math.max(1,Rt(Y)),se=Rt(X);let Ze=0;ne==="percentage"&&se>0?Ze=oe*(se/100):(ne==="rupiah"&&se>0||!ne&&se>0)&&(Ze=se>oe?se/de:se);const De=Math.max(0,oe-Ze),ze=De*de;return{unitAfter:De,totalAfter:ze}}const Nt=I=>{try{const ne=((I==null?void 0:I.product_variant_values)??[]).map(X=>{var oe,de,se;return{opt:(de=(oe=X==null?void 0:X.variant_value)==null?void 0:oe.variant_option)==null?void 0:de.name,val:(se=X==null?void 0:X.variant_value)==null?void 0:se.name}}).filter(X=>X.opt&&X.val).map(X=>`${X.opt}: ${X.val}`);return ne.length?` [${ne.join(", ")}]`:""}catch{return""}},ae=I=>{var Y;return I?"discount_package_items"in I?(I==null?void 0:I.name)??"Paket":"product"in I||"product_variant_values"in I?`${((Y=I==null?void 0:I.product)==null?void 0:Y.name)??(I==null?void 0:I.name)??"Produk"}${Nt(I)}`:"category"in I?(I==null?void 0:I.name)??"Menu":(I==null?void 0:I.name)??"Item":"Item"};function bt(I){const Y=(I==null?void 0:I.transaction_details)??[],ne=[];for(const X of Y){const oe=X==null?void 0:X.items,de=Rt(X==null?void 0:X.quantity),se=Rt(X==null?void 0:X.price),Ze=(X==null?void 0:X.discount_type)??null,De=(X==null?void 0:X.discount)!=null?Rt(X.discount):0,{unitAfter:ze,totalAfter:V}=Ni(se,de,Ze,De),st=ae(oe);ne.push({name:st,qty:de,price:ze,total:V})}return ne}const it=I=>I.reduce((Y,ne)=>Y+Rt(ne.total),0);function xt(I,Y){switch(I){case"dine_in":return"Makan ditempat";case"platform":return(Y?String(Y):"").replace(/^\w/,ne=>ne.toUpperCase());case"takeaway":return"Takeaway";default:return I??"-"}}function Xr({tx:I,companyName:Y,companyAddress:ne,companyPhone:X}){var se,Ze;const oe=(((se=I.taxes)==null?void 0:se.length)??0)>0?I.taxes.map(De=>`
                <div class="row muted">
                <span>${De.label}</span>
                <span>${mn(De.value)}</span>
                </div>
            `).join(""):"",de=((Ze=I.items)==null?void 0:Ze.map(De=>`
        <div class="item">
            <div class="item-name">${De.name}</div>
            <div class="item-sub">
            <span>${De.qty} x ${mn(De.price)}</span>
            <span>${mn(De.total)}</span>
            </div>
        </div>
        `).join(""))??"";return`
        <!doctype html>
        <html>
        <head>
        <meta charset="utf-8" />
        <title>Struk ${I.invoice??""}</title>
        <style>
        :root { --muted:#000; --line:#000; }
        * { box-sizing: border-box; }
        body { font-family: DejaVu Sans, Arial, "Helvetica", "Liberation Sans", sans-serif; font-size: 12px; margin:0; padding:0; }
        .paper { width: 95%; margin: 0; padding: 2px 4px 8px; }
        .center { text-align: center; }
        h1 { font-size: 14px; margin: 0; font-weight: bold; }
        .small { font-size: 12px; }
        .muted { color: #000; }
        hr { border:0; border-top:1px dashed var(--line); margin: 8px 0; }
        .section { font-size: 12px; }
        .row { display: flex; justify-content: space-between; margin: 2px 0; }
        .item { margin: 6px 0; }
        .item-name { font-size: 12px; }
        .item-sub { display:flex; justify-content: space-between; font-size: 12px; }
        .total-row { font-weight: 700; font-size: 13px; border-top: 1px dashed var(--line); margin-top:6px; padding-top:4px; }
        @media print {
        @page { margin: 0; }
        body { margin: 0; }
        .paper { width: 95%; margin: 0; padding: 2px 4px 8px; }
        }
        </style>
        </head>
        <body>
        <div class="paper">
            <div class="center">
            <h1>${Y}</h1>
            <div class="small">${ne}</div>
            <div class="small">${X}</div>
            </div>

            <hr />

            <div class="section">
            <div class="row"><span>Invoice</span><span>${I.invoice??"-"}</span></div>
            <div class="row"><span>Tanggal</span><span>${wn()}</span></div>
            <div class="row"><span>Jenis</span><span>${I.order_type_label??"-"}</span></div>
            ${I.table_number?`<div class="row"><span>Meja</span><span>${I.table_number}</span></div>`:""}
            ${I.customer_name?`<div class="row"><span>Pelanggan</span><span>${I.customer_name}</span></div>`:""}
            <div class="row"><span>Kasir</span><span>${I.cashier_name??"-"}</span></div>
            </div>

            <hr />

            <div class="section">
            ${de}
            </div>

            <hr />

            <div class="section">
            <div class="row muted"><span>Subtotal</span><span>${mn(I.subtotal)}</span></div>
            ${I.discount?`<div class="row muted"><span>Diskon</span><span>- ${mn(I.discount)}</span></div>`:""}
            ${oe}
            <div class="row total-row"><span>Total</span><span>${mn(I.grand_total)}</span></div>
            <div class="row muted">
                <span>Bayar (${I.pay_label??"-"})</span>
                <span>${mn(I.pay)}</span>
            </div>
            <div class="row muted"><span>Kembali</span><span>${mn(I.change)}</span></div>
            </div>

            <hr />
            <div class="center small">Terima kasih — Simpan struk ini sebagai bukti transaksi.</div>
        </div>

        <script>
            window.addEventListener('load', function() {
            setTimeout(function(){ window.print(); window.close(); }, 150);
            });
        <\/script>
        </body>
        </html>
    `.trim()}function vi(I,Y){var ze,V,st,pe,at,Cn;if(!I){alert("Tidak ada transaksi untuk dicetak.");return}const ne=bt(I),X={invoice:I.invoice,cashier_name:((V=(ze=I.cashier_shift)==null?void 0:ze.user)==null?void 0:V.name)??((st=I.cashier)==null?void 0:st.name)??((pe=I.user)==null?void 0:pe.name)??"-",order_type_label:xt(I.transaction_type,I.platform),table_number:(at=I.table)==null?void 0:at.number,customer_name:(((Cn=I.customer)==null?void 0:Cn.name)??"Umum")||"Umum",items:ne,subtotal:it(ne),discount:Rt(I.discount),taxes:Array.isArray(I.transaction_taxs)?I.transaction_taxs.map(Se=>({label:(Se==null?void 0:Se.name)??(Se==null?void 0:Se.code)??"Pajak",value:Rt(Se==null?void 0:Se.value)})):[],grand_total:Rt(I.grand_total??I.grandTotal),pay:Rt(I.paid),change:Rt(I.return),pay_label:Er(I)},oe=Tt(Y,"NAME","Perusahaan"),de=Tt(Y,"ADDRESS","Alamat"),se=Tt(Y,"PHONE","-"),Ze=Xr({tx:X,companyName:oe,companyAddress:de,companyPhone:se}),De=window.open("","_blank","width=800,height=900");if(!De){alert("Popup diblokir. Izinkan popup untuk mencetak.");return}De.document.open(),De.document.write(Ze),De.document.close()}const Qi={invoice:(Jn=v==null?void 0:v.transactionPrint)==null?void 0:Jn.invoice,cashier_name:((_n=(Oi=(Mi=v==null?void 0:v.transactionPrint)==null?void 0:Mi.cashier_shift)==null?void 0:Oi.user)==null?void 0:_n.name)??((jt=(ui=v==null?void 0:v.transactionPrint)==null?void 0:ui.cashier)==null?void 0:jt.name)??((Zr=(yr=v==null?void 0:v.transactionPrint)==null?void 0:yr.user)==null?void 0:Zr.name)??"-",order_type_label:xt((Pn=v==null?void 0:v.transactionPrint)==null?void 0:Pn.transaction_type,(fi=v==null?void 0:v.transactionPrint)==null?void 0:fi.platform),table_number:(kr=(ur=v==null?void 0:v.transactionPrint)==null?void 0:ur.table)==null?void 0:kr.number,customer_name:(((fr=(tn=v==null?void 0:v.transactionPrint)==null?void 0:tn.customer)==null?void 0:fr.name)??"Umum")||"Umum",items:bt(v==null?void 0:v.transactionPrint),subtotal:it(bt(v==null?void 0:v.transactionPrint)),discount:Rt((An=v==null?void 0:v.transactionPrint)==null?void 0:An.discount),taxes:Array.isArray((ue=v==null?void 0:v.transactionPrint)==null?void 0:ue.transaction_taxs)?(Ir=v==null?void 0:v.transactionPrint)==null?void 0:Ir.transaction_taxs.map(I=>({label:(I==null?void 0:I.name)??(I==null?void 0:I.code)??"Pajak",value:Rt(I==null?void 0:I.value)})):[],grand_total:Rt(((hi=v==null?void 0:v.transactionPrint)==null?void 0:hi.grand_total)??((nn=v==null?void 0:v.transactionPrint)==null?void 0:nn.grandTotal)),pay:Rt((br=v==null?void 0:v.transactionPrint)==null?void 0:br.paid),change:Rt((Fr=v==null?void 0:v.transactionPrint)==null?void 0:Fr.return),pay_label:Er(v==null?void 0:v.transactionPrint),company_name:Tt(W,"NAME","Perusahaan"),company_address:Tt(W,"ADDRESS","Alamat"),company_phone:Tt(W,"PHONE","-")};return _.jsx(_.Fragment,{children:x?_.jsxs(jc,{children:[_.jsx(Fc,{title:"Kasir"}),_.jsxs("div",{className:"grid h-full grid-cols-1 gap-2 md:grid-cols-3",children:[_.jsxs("div",{className:"border-border bg-card flex h-full min-h-0 flex-col justify-between rounded-xl border shadow-sm md:col-span-1",children:[_.jsxs("div",{className:"flex min-h-0 flex-grow flex-col p-4",children:[_.jsx("div",{className:"relative mb-0",children:_.jsxs("div",{className:"flex items-center justify-between",children:[_.jsxs("label",{className:"flex cursor-pointer items-center gap-2 select-none",children:[_.jsx("button",{type:"button",onClick:()=>te("modalCustomer",!v.modalCustomer),className:"p-2 transition hover:bg-primary/20 rounded-md","aria-label":"Pilih Pelanggan",children:_.jsx(Tg,{className:"h-4 w-4 text-gray-600"})}),_.jsx("span",{className:"text-sm text-foreground font-medium select-text",children:v.selectedCustomer.name!=""?v.selectedCustomer.name:"Umum"})]}),_.jsx("button",{type:"button",onClick:()=>te("modalProduct",!v.modalProduct),className:"block rounded-md p-2 transition hover:bg-gray-100 md:hidden","aria-label":"Cari Produk",children:_.jsx(Yo,{className:"h-4 w-4 text-gray-600"})})]})}),_.jsx("div",{className:"border-border my-2 border-t"}),_.jsx("div",{className:"mb-4 min-h-0 flex-grow overflow-y-auto pr-2",children:_.jsx("div",{className:"space-y-2",children:v.carts.map((I,Y)=>_.jsxs("div",{className:"hover:bg-accent flex cursor-pointer items-start justify-between rounded p-2",onClick:()=>Ar(I),children:[_.jsxs("div",{children:[_.jsx("span",{className:"text-sm font-medium text-foreground",children:I.name}),_.jsxs("div",{className:"text-muted-foreground mt-1 flex items-center gap-x-4 text-sm",children:[_.jsxs("span",{children:["Rp ",I.price]}),_.jsxs("span",{children:["x",I.quantity]})]}),I.details&&I.details.length>0&&_.jsx("div",{className:"flex flex-col gap-1",children:I.details.map((ne,X)=>_.jsxs("span",{className:"text-xs text-muted-foreground",children:[" - ",ne.name]},X))}),_.jsx("p",{className:"text-muted-foreground mt-0.5 text-xs italic",children:I.note})]}),_.jsxs("p",{className:"text-sm font-medium text-foreground",children:["Rp ",I.total_price]})]},Y))})})]}),_.jsxs("div",{className:"bg-card rounded-b-xl border-t p-4",children:[_.jsxs("div",{className:"text-muted-foreground mb-4 space-y-2 text-sm",children:[_.jsxs("div",{className:"flex justify-between",children:[_.jsx("span",{children:"Total Item"}),_.jsx("span",{className:"text-foreground font-medium",children:v.carts.length})]}),_.jsxs("div",{className:"flex justify-between",children:[_.jsx("span",{children:"Total Belanja"}),_.jsxs("span",{className:"text-foreground font-medium",children:["Rp ",v.subTotal]})]}),v.discount>0&&_.jsxs(_.Fragment,{children:[_.jsxs("div",{className:"flex justify-between",children:[_.jsx("span",{children:"Diskon"}),_.jsxs("span",{className:"text-foreground font-medium",children:["-Rp ",v.discount]})]}),_.jsx("hr",{className:"border-border my-2"}),_.jsxs("div",{className:"flex justify-between",children:[_.jsx("span",{children:"Total Setelah Diskon"}),_.jsxs("span",{className:"text-foreground font-medium",children:["Rp ",v.subTotal-v.discount]})]})]}),v.carts.length>0&&v.ppn>0&&W.filter(I=>I.code==="PJK"&&I.is_active==!0).map(I=>{const Y=Math.max(v.subTotal-v.discount,0);let ne=0;if(I.value.endsWith("%")){const X=parseFloat(I.value.replace("%",""))||0;ne=Y*X/100}else ne=parseInt(I.value)||0;return _.jsxs("div",{className:"flex justify-between",children:[_.jsxs("span",{children:[I.name," (",I.value,")"]}),_.jsxs("span",{className:"text-foreground font-medium",children:["Rp ",ne]})]},I.id)}),v.carts.length>0&&v.other>0&&W.filter(I=>I.code==="OPR"&&I.is_active==!0).map(I=>{const Y=Math.max(v.subTotal-v.discount,0);let ne=0;if(I.value.endsWith("%")){const X=parseFloat(I.value.replace("%",""))||0;ne=Y*X/100}else ne=parseInt(I.value)||0;return _.jsxs("div",{className:"flex justify-between",children:[_.jsxs("span",{children:[I.name," (",I.value,")"]}),_.jsxs("span",{className:"text-foreground font-medium",children:["Rp ",ne]})]},I.id)})]}),_.jsxs("div",{className:"mb-4 flex items-center justify-between gap-2",children:[_.jsx("div",{className:"flex gap-1",children:_.jsx(ft,{variant:"ghost",size:"icon",title:"Batal",onClick:()=>Qt(),className:"bg-destructive/15 text-destructive hover:bg-destructive/25 rounded-md",children:_.jsx(zg,{className:"h-5 w-5"})})}),_.jsxs("div",{className:"flex gap-1",children:[_.jsx(ft,{variant:"ghost",size:"icon",title:"Diskon",onClick:()=>te("modalDiscount",!v.modalDiscount),className:"bg-primary/15 text-primary hover:bg-primary/25 rounded-md",children:_.jsx(Ng,{className:"h-5 w-5"})}),_.jsx(ft,{variant:"ghost",size:"icon",title:"Catatan",onClick:()=>te("modalNote",!v.modalNote),className:"bg-primary/15 text-primary hover:bg-primary/25 rounded-md",children:_.jsx(jg,{className:"h-5 w-5"})}),_.jsx(ft,{variant:"ghost",size:"icon",title:"Pengiriman",onClick:()=>te("modalDelivery",!v.modalDelivery),className:"bg-primary/15 text-primary hover:bg-primary/25 rounded-md",children:_.jsx(vg,{className:"h-5 w-5"})}),(rt==null?void 0:rt.is_active)&&_.jsx(ft,{variant:"ghost",size:"icon",title:"Pelayan",onClick:()=>te("modalCashier",!v.modalCashier),className:"bg-primary/15 text-primary hover:bg-primary/25 rounded-md",children:_.jsx(Bg,{className:"h-5 w-5"})})]})]}),_.jsxs("div",{className:"flex gap-2",children:[_.jsxs(ft,{className:"flex-1 h-12 text-base rounded-lg",onClick:()=>te("modalPayment",!v.modalPayment),children:["Bayar • Rp ",v.grandTotal]}),_.jsx("form",{onSubmit:ht,children:_.jsx(ft,{variant:"ghost",size:"icon",title:"Pending order",className:"h-12 w-12 bg-primary/10 text-primary hover:bg-primary/20 rounded-lg",type:"submit",onClick:()=>te("isPendingOrder",!0),children:_.jsx(kg,{className:"h-5 w-5"})})})]})]})]}),_.jsxs("div",{className:"border-border bg-card hidden h-full min-h-0 flex-col rounded-xl border p-4 shadow-sm md:col-span-2 md:flex",children:[_.jsxs("div",{className:"mb-4 flex items-center gap-1 transition-all",children:[Ge==="barcode"?_.jsx("button",{type:"button",onClick:()=>{ie("search"),setTimeout(()=>{var I;return(I=document.getElementById("searchInput"))==null?void 0:I.focus()},50)},className:"p-2 rounded-md border hover:bg-accent",title:"Cari produk",children:_.jsx(Yo,{className:"w-5 h-5 text-muted-foreground"})}):_.jsx(Gt,{id:"searchInput",type:"text",placeholder:"Cari produk berdasarkan nama/barcode/sku",className:"flex-1 transition-all",value:v.filters.search,onFocus:()=>ie("search"),onChange:I=>Gn(I)}),Ge==="search"?_.jsx("button",{type:"button",onClick:()=>{ie("barcode"),setTimeout(()=>{var I;return(I=Be.current)==null?void 0:I.focus()},50)},className:"p-2 bg-primary/10 text-primary hover:bg-primary/20 rounded-md",title:"Scan barcode",children:_.jsx(Hc,{className:"w-5 h-5"})}):_.jsx(Gt,{type:"text",placeholder:"Scan barcode",className:"flex-1 transition-all",value:_e,ref:Be,onFocus:()=>ie("barcode"),onChange:I=>{const Y=I.target.value;It(Y),re.current&&clearTimeout(re.current),re.current=setTimeout(async()=>{var X;const ne=Y.trim();if(ne.length>=8){try{const de=(await Or.get(route("apps.pos.search-by-barcode",{barcode:ne}))).data.product;de?(Ln(de),kt("Produk berhasil ditambahkan ke keranjang")):kt("Produk tidak ditemukan")}catch(oe){console.error("Barcode scan error:",oe),kt("Gagal mencari produk")}It(""),(X=Be.current)==null||X.focus()}},100)}})]}),_.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[_.jsxs("div",{className:"flex flex-wrap gap-2",children:[_.jsx(ft,{variant:m.category?"outline":"default",size:"sm",onClick:()=>cn(null),children:"Semua"}),y.map((I,Y)=>_.jsx(ft,{variant:String(gt)===String(I.id)?"default":"outline",size:"sm",onClick:()=>cn(I.id),children:I.name},Y))]}),_.jsx("div",{children:_.jsx(ft,{size:"sm",variant:String(gt)==="package"?"default":"outline",onClick:()=>cn("package"),children:"Paket"})})]}),_.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto",children:_.jsx("div",{className:"grid grid-cols-2 gap-2 md:grid-cols-3 lg:grid-cols-5 xl:grid-cols-6",children:v.items.map((I,Y)=>_.jsxs("button",{disabled:I.stock<=0,onClick:()=>Ln(I),className:`relative overflow-hidden rounded-lg border border-border bg-muted shadow-sm transition hover:shadow-md ${I.stock<=0?"opacity-50 cursor-not-allowed":"cursor-pointer"}`,children:[_.jsx("img",{src:I.image,alt:"No Image",className:"h-32 w-full object-cover"}),_.jsxs("div",{className:"absolute right-2 top-2 rounded-md bg-primary/15 px-2 py-0.5 text-xs font-semibold text-primary backdrop-blur",children:[_.jsx("sup",{children:"Rp"})," ",String(me(I))]}),_.jsx("div",{className:"absolute bottom-0 left-0 w-full bg-gradient-to-t from-background/90 to-background/40 px-2 py-1.5",children:_.jsx("p",{className:"line-clamp-2 text-sm font-medium text-foreground",children:I.name})})]},Y))})}),_.jsx("div",{className:"mt-4 flex items-center justify-start lg:justify-center border-t pt-4 overflow-x-auto",children:_.jsx(Uc,{links:S.links})})]})]}),_.jsx(Dr,{open:v.modalProduct,onOpenChange:I=>te("modalProduct",I),children:_.jsxs(Rr,{className:"max-w-full max-h-[90vh] p-4 overflow-y-auto",children:[_.jsx(Wr,{children:_.jsx(li,{children:"Pilih Produk"})}),_.jsxs("div",{className:"mb-4 flex items-center gap-1 transition-all",children:[Ge==="barcode"?_.jsx("button",{type:"button",onClick:()=>{ie("search"),setTimeout(()=>{var I;return(I=document.getElementById("searchInput"))==null?void 0:I.focus()},50)},className:"p-2 rounded-md border hover:bg-accent",title:"Cari produk",children:_.jsx(Yo,{className:"w-5 h-5 text-muted-foreground"})}):_.jsx(Gt,{id:"searchInput",type:"text",placeholder:"Cari produk berdasarkan nama/barcode/sku",className:"flex-1 transition-all",value:v.filters.search,onFocus:()=>ie("search"),onChange:I=>Gn(I)}),Ge==="search"?_.jsx("div",{className:"flex items-center gap-1",children:_.jsx("button",{type:"button",onClick:()=>{ie("barcode"),setTimeout(()=>{en(!0)},100)},className:"p-2 bg-primary/10 text-primary hover:bg-primary/20 rounded-md",title:"Scan barcode dengan kamera",children:_.jsx(Hc,{className:"w-5 h-5"})})}):_.jsxs("div",{className:"flex-1",children:[_.jsx(Gt,{type:"text",placeholder:"Scan barcode",className:"w-full transition-all",value:_e,ref:Be,onFocus:()=>ie("barcode"),onChange:I=>{const Y=I.target.value;It(Y),re.current&&clearTimeout(re.current),re.current=setTimeout(async()=>{var X;const ne=Y.trim();if(ne.length>=8){try{const de=(await Or.get(route("apps.pos.search-by-barcode",{barcode:ne}))).data.product;de?(Ln(de),kt("Produk berhasil ditambahkan ke keranjang")):kt("Produk tidak ditemukan")}catch(oe){console.error("Barcode scan error:",oe),kt("Gagal mencari produk")}It(""),(X=Be.current)==null||X.focus()}},100)}}),Pr&&_.jsxs("div",{className:"relative mt-2 border p-2 rounded-md bg-background z-50",children:[_.jsx("div",{className:"w-full h-[200px] overflow-hidden rounded-md",children:_.jsx(D2,{onScanSuccess:async I=>{try{const ne=(await Or.get(route("apps.pos.search-by-barcode",{barcode:I}))).data.product;ne?(Ln(ne),kt("Produk berhasil ditambahkan ke keranjang")):kt("Produk tidak ditemukan")}catch(Y){console.error("Barcode scan error:",Y),kt("Gagal mencari produk")}}})}),_.jsx("button",{className:"absolute top-1 right-1 text-sm px-2 py-1 bg-red-500 text-white rounded",onClick:()=>en(!1),children:"Tutup"}),_.jsx("div",{className:"text-sm text-muted-foreground text-center mt-2",children:"Arahkan kamera ke barcode produk"})]})]})]}),_.jsxs("div",{className:"mb-4 flex items-center justify-between gap-4 flex-col-reverse",children:[_.jsxs("div",{className:"flex flex-wrap gap-2",children:[_.jsx(ft,{variant:m.category?"outline":"default",size:"sm",onClick:()=>cn(null),children:"Semua"}),y.map((I,Y)=>_.jsx(ft,{variant:String(gt)===String(I.id)?"default":"outline",size:"sm",onClick:()=>cn(I.id),children:I.name},Y))]}),_.jsx("div",{children:_.jsx(ft,{size:"sm",variant:String(gt)==="package"?"default":"outline",onClick:()=>cn("package"),children:"Paket"})})]}),_.jsx("div",{className:"grid grid-cols-2 gap-2 overflow-y-auto max-h-[60vh]",children:v.items.map((I,Y)=>_.jsxs("button",{disabled:I.stock<=0,onClick:()=>Ln(I),className:`relative h-36 cursor-pointer overflow-hidden rounded-lg border border-border bg-muted shadow-sm transition hover:shadow-md ${I.stock<=0?"opacity-50 cursor-not-allowed":"cursor-pointer"}`,children:[_.jsx("img",{src:I.image,alt:"No Image",className:"h-full w-full object-cover"}),_.jsxs("div",{className:"absolute right-2 top-2 rounded-md bg-primary/15 px-2 py-0.5 text-xs font-semibold text-primary backdrop-blur",children:[_.jsx("sup",{children:"Rp"})," ",String(me(I))]}),_.jsx("div",{className:"absolute bottom-0 left-0 w-full bg-gradient-to-t from-background/90 to-background/40 px-2 py-1.5",children:_.jsx("p",{className:"line-clamp-2 text-sm font-medium text-foreground",children:I.name})})]},Y))}),_.jsx("div",{className:"mt-4 flex items-center justify-start lg:justify-center border-t pt-4 overflow-x-auto",children:_.jsx(Uc,{links:S.links})})]})}),_.jsx(Dr,{open:v.modalPayment,onOpenChange:()=>te("modalPayment",!v.modalPayment),children:_.jsxs(Rr,{className:"w-full max-w-2xl",children:[_.jsx(Wr,{children:_.jsxs("div",{className:"border-border flex flex-wrap items-center justify-between gap-4 rounded-lg border p-4",children:[_.jsxs("div",{children:[_.jsx("p",{className:"text-muted-foreground text-sm",children:"Total"}),_.jsxs("p",{className:"text-foreground text-lg font-semibold",children:["Rp ",v.grandTotal]})]}),_.jsxs("div",{children:[_.jsx("p",{className:"text-muted-foreground text-sm",children:"Uang Kembalian"}),_.jsxs("p",{className:"text-foreground text-lg font-semibold",children:["Rp ",v.return]})]}),_.jsxs("div",{children:[_.jsx("p",{className:"text-sm text-yellow-600",children:"Sisa Bayar"}),_.jsxs("p",{className:"text-lg font-semibold text-yellow-700",children:["Rp ",v.remains]})]})]})}),_.jsxs("div",{className:"space-y-4",children:[_.jsxs("div",{children:[_.jsx(Ot,{children:"Metode Pembayaran"}),_.jsxs("div",{className:"mt-1 flex gap-2",children:[_.jsx(ft,{variant:v.selectedPaymentMethod==="tunai"?"default":"outline",onClick:()=>te("selectedPaymentMethod","tunai"),children:"Tunai"}),_.jsx(ft,{variant:v.selectedPaymentMethod==="transfer"?"default":"outline",onClick:()=>te("selectedPaymentMethod","transfer"),children:"Transfer"})]})]}),v.selectedPaymentMethod==="transfer"&&_.jsxs("div",{className:"space-y-3",children:[_.jsx(Ot,{className:"text-foreground block text-sm font-medium",children:"Pilih Bank"}),_.jsx("div",{className:"grid grid-cols-2 gap-2 sm:grid-cols-3",children:F.map((I,Y)=>_.jsxs("button",{onClick:()=>te("selectedBank",I.bank_name),className:`w-full rounded-lg border px-4 py-3 text-left transition ${v.selectedBank===I.bank_name?"border-primary bg-primary/10 ring-primary ring-1":"border-border bg-muted hover:bg-muted/70"} `,children:[_.jsx("p",{className:"text-foreground font-semibold uppercase",children:I.bank_name}),_.jsxs("p",{className:"text-muted-foreground mt-1 text-sm",children:[I.account_number," a/n ",I.account_name]})]},Y))}),_.jsxs("div",{children:[_.jsx(Ot,{htmlFor:"jumlahBayar",children:"Jumlah Bayar"}),_.jsx(Gt,{id:"jumlahBayar",type:"text",placeholder:"Masukkan nominal",className:"mt-1",value:v.pay,onChange:I=>te("pay",Number(I.target.value))})]})]}),v.selectedPaymentMethod==="tunai"&&_.jsxs(_.Fragment,{children:[_.jsxs("div",{children:[_.jsx(Ot,{htmlFor:"jumlahBayar",children:"Jumlah Bayar"}),_.jsx(Gt,{id:"jumlahBayar",type:"text",placeholder:"Masukkan nominal",className:"mt-1",value:v.pay,onChange:I=>te("pay",Number(I.target.value))})]}),_.jsx("div",{className:"mt-2 flex flex-wrap gap-2",children:[1e4,2e4,5e4,1e5].map(I=>_.jsxs(ft,{type:"button",variant:"outline",onClick:()=>te(Y=>({...Y,pay:Number(Y.pay||0)+I})),children:["+Rp ",I.toLocaleString()]},I))})]}),_.jsx("form",{onSubmit:ht,children:_.jsx(ft,{className:"w-full",type:"submit",disabled:bn||v.selectedPaymentMethod=="",children:"Selesaikan Transaksi"})})]})]})}),_.jsx(Dr,{open:v.modalCustomer,onOpenChange:()=>te("modalCustomer",!v.modalCustomer),children:_.jsxs(Rr,{className:"max-w-sm",children:[_.jsxs(Wr,{children:[_.jsx(li,{children:"Pilih Pelanggan"}),_.jsx(Ua,{children:"Silakan pilih pelanggan dari daftar berikut atau tambahkan baru."})]}),_.jsxs("div",{className:"space-y-2",children:[_.jsx(ft,{variant:"outline",size:"sm",className:"w-full",onClick:()=>te("newModalCustomer",!v.newModalCustomer),children:"+ Tambah Pelanggan Baru"}),_.jsx(Gt,{type:"text",placeholder:"Cari nama pelanggan...",className:"border-border focus:ring-primary mb-2 rounded-md border px-3 py-2 focus:ring-2 focus:outline-none",value:v.searchCustomer,onChange:I=>{te("searchCustomer",I.target.value),lr()}}),v.customers.length>0&&_.jsx("ul",{className:"max-h-40 overflow-y-auto rounded-md border p-2",children:v.customers.map((I,Y)=>_.jsxs("li",{className:"hover:bg-muted cursor-pointer rounded p-2",onClick:()=>le(I),children:[I.name," - ",I.phone]},Y))})]})]})}),_.jsx(Dr,{open:v.newModalCustomer,onOpenChange:()=>te("newModalCustomer",!v.newModalCustomer),children:_.jsxs(Rr,{className:"max-w-sm",children:[_.jsxs(Wr,{children:[_.jsx(li,{children:"Tambah Pelanggan"}),_.jsx(Ua,{children:"Form ini digunakan untuk menambahkan data pelanggan"})]}),_.jsxs("form",{onSubmit:cr,children:[_.jsxs("div",{className:"mb-4 flex flex-col gap-2",children:[_.jsxs(Ot,{htmlFor:"harga",children:["Nama",_.jsx("span",{className:"text-rose-500",children:"*"})]}),_.jsx(Gt,{type:"text",value:v.newCust.name,onChange:I=>te("newCust.name",I.target.value),placeholder:"Masukan nama pelanggan"})]}),_.jsxs("div",{className:"mb-4 flex flex-col gap-2",children:[_.jsxs(Ot,{htmlFor:"harga",children:["Nomor Hp",_.jsx("span",{className:"text-rose-500",children:"*"})]}),_.jsx(Gt,{type:"number",value:v.newCust.phone,onChange:I=>te("newCust.phone",I.target.value),placeholder:"Masukan nomor hp pelanggan"})]}),_.jsxs("div",{className:"mb-4 flex flex-col gap-2",children:[_.jsx(Ot,{htmlFor:"harga",children:"Email"}),_.jsx(Gt,{type:"email",value:v.newCust.email,onChange:I=>te("newCust.email",I.target.value),placeholder:"Masukan email pelanggan"})]}),_.jsxs("div",{className:"mb-4 flex flex-col gap-2",children:[_.jsx(Ot,{htmlFor:"harga",children:"Alamat"}),_.jsx(Vo,{rows:5,value:v.newCust.address,onChange:I=>te("newCust.address",I.target.value),placeholder:"Masukan alamat pelanggan"})]}),_.jsx("div",{className:"flex",children:_.jsx(ft,{children:"Simpan"})})]})]})}),_.jsx(Dr,{open:v.modalItem,onOpenChange:I=>{I?te("modalItem",!0):te(Y=>({...Y,modalItem:!1,selectedItem:{name:"",quantity:0,price:0,discount_type:"",discount:"",note:"",type:"",total_price:0,stock:0}}))},children:_.jsxs(Rr,{children:[_.jsxs(Wr,{children:[_.jsx(li,{children:v.selectedItem.name}),_.jsx(Ua,{children:"Ubah harga, jumlah, diskon (auto/manual), atau tambahkan catatan."})]}),_.jsxs("div",{className:"mt-2 space-y-4",children:[_.jsxs("div",{children:[_.jsx(Ot,{htmlFor:"harga",children:"Harga Normal (Rp)"}),_.jsx(Gt,{id:"harga",type:"number",value:v.selectedItem.price,onChange:I=>te("selectedItem.price",Number(I.target.value)),placeholder:"Contoh: 15000"})]}),_.jsxs("div",{children:[_.jsx(Ot,{htmlFor:"qty",children:"Jumlah"}),_.jsx(Gt,{id:"qty",type:"number",value:v.selectedItem.quantity,onChange:I=>te("selectedItem.quantity",Number(I.target.value)),placeholder:"Contoh: 2"})]}),_.jsxs("div",{className:"space-y-2",children:[_.jsx(Ot,{children:"Diskon"}),_.jsxs("div",{className:"flex gap-2",children:[_.jsxs(Hs,{value:v.selectedItem.discount_type??"",onValueChange:I=>{I==="auto"?(te("selectedItem.discount_type",""),te("selectedItem.discount","")):te("selectedItem.discount_type",I)},children:[_.jsx(zs,{className:"w-36",children:_.jsx(Ws,{placeholder:"Auto (Promo)"})}),_.jsxs(Gs,{children:[_.jsx(Lr,{value:"auto",children:"Auto (Promo)"}),_.jsx(Lr,{value:"nominal",children:"Rp"}),_.jsx(Lr,{value:"percentage",children:"%"})]})]}),_.jsx(Gt,{type:"number",value:v.selectedItem.discount??"",onChange:I=>te("selectedItem.discount",I.target.value),placeholder:v.selectedItem.discount_type==="percentage"?"Contoh: 10":"Contoh: 2000",className:"flex-1",disabled:!v.selectedItem.discount_type})]}),_.jsxs("p",{className:"text-xs text-muted-foreground",children:["Pilih ",_.jsx("b",{children:"Auto (Promo)"})," untuk memakai diskon secara otomatis. Pilih ",_.jsx("b",{children:"Rp"})," atau ",_.jsx("b",{children:"%"})," untuk input manual."]})]}),_.jsxs("div",{children:[_.jsx(Ot,{htmlFor:"catatan",children:"Catatan Produk"}),_.jsx(Gt,{id:"catatan",type:"text",value:v.selectedItem.note??"",onChange:I=>te("selectedItem.note",I.target.value),placeholder:"Contoh: Tidak pedas"})]})]}),_.jsxs("div",{className:"mt-4 flex justify-end gap-2",children:[_.jsx(ft,{variant:"destructive",onClick:()=>Yt(v.selectedItem),children:"Hapus Item"}),_.jsx(ft,{onClick:()=>{const I=v.selectedItem.discount_type??"",Y=I==="percentage"?"percentage":I;$e(v.selectedItem,Number(v.selectedItem.quantity),String(v.selectedItem.price),Y,String(v.selectedItem.discount??""),String(v.selectedItem.note??""))},children:"Simpan"})]})]})}),_.jsx(Dr,{open:v.modalDiscount,onOpenChange:()=>te("modalDiscount",!v.modalDiscount),children:_.jsxs(Rr,{children:[_.jsx(Wr,{children:_.jsx(li,{children:"Tambah Diskon"})}),_.jsxs("div",{className:"space-y-4",children:[_.jsxs("div",{className:"space-y-1",children:[_.jsx(Ot,{children:"Kode Diskon"}),_.jsx(Gt,{placeholder:"Contoh: HEMAT10",value:v.discounts.code,onChange:I=>te("discounts.code",I.target.value)})]}),_.jsxs("div",{className:"space-y-1",children:[_.jsx(Ot,{children:"Diskon"}),_.jsxs("div",{className:"flex gap-2",children:[_.jsxs(Hs,{value:v.discounts.discount_type,onValueChange:I=>te("discounts.discount_type",I),children:[_.jsx(zs,{className:"w-28",children:_.jsx(Ws,{placeholder:"Tipe"})}),_.jsxs(Gs,{children:[_.jsx(Lr,{value:"nominal",children:"Rp"}),_.jsx(Lr,{value:"persen",children:"%"})]})]}),_.jsx(Gt,{type:"text",placeholder:"Contoh: 2000 atau 10",className:"flex-1",value:v.discounts.discount_amount,onChange:I=>te("discounts.discount_amount",Number(I.target.value))})]})]}),_.jsx("div",{className:"mt-4 flex justify-end gap-2",children:_.jsx(ft,{onClick:()=>un(),children:"Simpan"})})]})]})}),_.jsx(Dr,{open:v.modalNote,onOpenChange:()=>te("modalNote",!v.modalNote),children:_.jsxs(Rr,{children:[_.jsx(Wr,{children:_.jsx(li,{children:"Catatan untuk Pesanan"})}),_.jsxs("div",{className:"space-y-4",children:[_.jsxs("div",{children:[_.jsx(Ot,{htmlFor:"noReferensi",children:"No Referensi"}),_.jsx(Gt,{id:"noReferensi",placeholder:"Contoh: INV-00123",value:v.notes.no_ref,onChange:I=>te("notes.no_ref",I.target.value)})]}),_.jsxs("div",{children:[_.jsx(Ot,{htmlFor:"sumberTransaksi",children:"Sumber Transaksi"}),_.jsx(Gt,{id:"sumberTransaksi",placeholder:"Contoh: Tokopedia, Shopee, dll.",value:v.notes.transaction_source,onChange:I=>te("notes.transaction_source",I.target.value)})]}),_.jsxs("div",{children:[_.jsx(Ot,{htmlFor:"catatan",children:"Catatan"}),_.jsx(Vo,{id:"catatan",placeholder:"Contoh: Tidak pedas, tambahkan sambal, dll.",rows:4,value:v.notes.note,onChange:I=>te("notes.note",I.target.value)})]}),_.jsx("div",{className:"mt-4 flex justify-end gap-2",children:_.jsx(ft,{onClick:()=>te("modalNote",!v.modalNote),children:"Simpan"})})]})]})}),_.jsx(Dr,{open:v.modalDelivery,onOpenChange:()=>te("modalDelivery",!v.modalDelivery),children:_.jsxs(Rr,{children:[_.jsx(Wr,{children:_.jsx(li,{children:"Informasi Pengiriman"})}),_.jsxs("div",{className:"space-y-2",children:[_.jsx(Ot,{htmlFor:"ekspedisi",children:"Nama Ekspedisi"}),_.jsx(Gt,{id:"ekspedisi",placeholder:"Contoh: JNE, J&T, Sicepat",value:v.delivery.name,onChange:I=>te("delivery.name",I.target.value)}),_.jsx(Ot,{htmlFor:"resi",children:"No Resi"}),_.jsx(Gt,{id:"resi",placeholder:"Contoh: JP1234567890",value:v.delivery.no_resi,onChange:I=>te("delivery.no_resi",I.target.value)}),_.jsx(Ot,{htmlFor:"alamat",children:"Alamat Pengiriman"}),_.jsx(Vo,{id:"alamat",placeholder:"Alamat lengkap pengiriman",rows:3,value:v.delivery.address,onChange:I=>te("delivery.address",I.target.value)}),_.jsx(Ot,{htmlFor:"catatan",children:"Catatan untuk Kurir"}),_.jsx(Gt,{id:"catatan",placeholder:"Contoh: Lewat pintu belakang",value:v.delivery.note,onChange:I=>te("delivery.note",I.target.value)}),_.jsxs("div",{children:[_.jsx(Ot,{htmlFor:"status-pengiriman",children:"Status Pengiriman"}),_.jsxs(Hs,{value:v.delivery.status,onValueChange:I=>te("delivery.status",I),children:[_.jsx(zs,{id:"status-pengiriman",children:_.jsx(Ws,{placeholder:"Pilih Status"})}),_.jsxs(Gs,{children:[_.jsx(Lr,{value:"pending",children:"Belum Dikirim"}),_.jsx(Lr,{value:"shipped",children:"Sedang Dikirim"}),_.jsx(Lr,{value:"delivered",children:"Sampai Tujuan"}),_.jsx(Lr,{value:"cancelled",children:"Dibatalkan"})]})]})]}),_.jsx("div",{className:"mt-4 flex justify-end gap-2",children:_.jsx(ft,{onClick:()=>te("modalDelivery",!v.modalDelivery),children:"Simpan"})})]})]})}),_.jsx(Dr,{open:v.modalCashier,onOpenChange:()=>te("modalCashier",!v.modalCashier),children:_.jsxs(Rr,{children:[_.jsx(Wr,{children:_.jsx(li,{children:"Pilih Pelayan"})}),_.jsxs("div",{className:"mt-2 flex flex-col gap-2",children:[_.jsx(Ot,{htmlFor:"pelayan",children:"Nama Pelayan"}),_.jsxs(Hs,{value:v.cashierId,onValueChange:I=>te("cashierId",I),children:[_.jsx(zs,{id:"pelayan",children:_.jsx(Ws,{placeholder:"Pilih pelayan"})}),_.jsx(Gs,{children:f.map(I=>_.jsx(Lr,{value:I.id,children:I.name},I.id))})]})]}),_.jsx("div",{className:"mt-4 flex justify-end gap-2",children:_.jsx(ft,{onClick:()=>te("modalCashier",!v.modalCashier),children:"Simpan"})})]})}),_.jsx(Dr,{open:v.modalTransaction,children:_.jsxs(Rr,{children:[_.jsxs("div",{className:"flex flex-col items-center justify-center",children:[_.jsx(Mg,{className:"w-20 h-20 text-teal-500"}),_.jsx("div",{className:"font-bold mt-4 text-2xl",children:"Transaksi Berhasil !"}),_.jsx("div",{className:"text-gray-500 mt-2",children:"Transaki telah berhasil proses"})]}),_.jsx(yg,{className:"rounded-xl bg-secondary w-full mt-4",children:_.jsx(Ig,{children:_.jsxs("div",{className:"flex flex-col gap-4",children:[_.jsxs("div",{className:"flex items-center justify-between gap-4",children:[_.jsx("div",{className:"font-semibold text-sm text-gray-400",children:"Np Transaksi"}),_.jsx("div",{children:v.lastTransaction.invoice})]}),_.jsxs("div",{className:"flex items-center justify-between gap-4",children:[_.jsx("div",{className:"font-semibold text-sm text-gray-400",children:"Total Bayar"}),_.jsxs("div",{children:[_.jsx("sup",{children:"Rp"})," ",v.lastTransaction.pay]})]}),_.jsxs("div",{className:"flex items-center justify-between gap-4",children:[_.jsx("div",{className:"font-semibold text-sm text-gray-400",children:"Kembalian"}),_.jsxs("div",{children:[_.jsx("sup",{children:"Rp"})," ",v.lastTransaction.return]})]})]})})}),_.jsxs("div",{className:"flex flex-row gap-2 items-center mt-4",children:[_.jsx(R2,{tx:Qi,paperWidth:Number(yt)}),_.jsxs(ft,{type:"button",variant:"outline",className:"w-full",onClick:()=>vi(v.transactionPrint,W),children:[_.jsx(Og,{className:"size-4"})," Windows Print"]})]}),_.jsxs("div",{className:"flex flex-row gap-2 items-center mt-4",children:[(ye==null?void 0:ye.is_active)&&_.jsxs(ft,{type:"button",onClick:()=>Cr(),variant:"default",className:"w-full",disabled:v.lastTransaction.transaction_type!="dine_in",children:[_.jsx(Dg,{className:"size-4"})," Kosongkan Meja"]}),_.jsxs(ft,{variant:"secondary",className:"w-full",onClick:()=>Bn(),children:[_.jsx(Eg,{className:"size-4"})," Selesai"]})]})]})})]}):_.jsxs(jc,{children:[_.jsx(Fc,{title:"Kasir"}),_.jsxs("div",{className:"flex h-full items-center justify-center",children:[_.jsxs("div",{className:"text-center",children:[_.jsx("h1",{className:"text-2xl font-bold mb-4",children:"Shift Kasir Belum Dibuka"}),_.jsx("p",{className:"text-muted-foreground mb-4",children:"Silakan buka shift kasir terlebih dahulu untuk melanjutkan."}),_.jsx(ft,{type:"button",onClick:()=>te("modalShiftCashier",!v.modalShiftCashier),children:"Buka Shift Kasir"})]}),_.jsx(Dr,{open:v.modalShiftCashier,onOpenChange:()=>te("modalShiftCashier",!v.modalShiftCashier),children:_.jsxs(Rr,{className:"max-w-sm",children:[_.jsxs(Wr,{children:[_.jsx(li,{children:"Buka Shift Kasir"}),_.jsx(Ua,{children:"Silahkan buka shift kasir terlebih dahulu."})]}),_.jsxs("form",{className:"space-y-4",onSubmit:Yr,children:[_.jsxs("div",{children:[_.jsx(Ot,{children:"Shift"}),_.jsxs(Hs,{value:String(v.cashierShift.shift_id),onValueChange:I=>te("cashierShift.shift_id",I),children:[_.jsx(zs,{className:"w-full",children:_.jsx(Ws,{placeholder:"Pilih Shift"})}),_.jsx(Gs,{children:g.map(I=>_.jsxs(Lr,{value:String(I.id),children:[I.name," (",I.start_time," s.d ",I.end_time,")"]},I.id))})]}),_.jsx("p",{className:"text-red-500 text-xs",children:Qn["cashierShift.shift_id"]})]}),_.jsxs("div",{children:[_.jsx(Ot,{children:"Uang Kembalian"}),_.jsx(Gt,{value:v.cashierShift.cash,onChange:I=>te("cashierShift.cash",Number(I.target.value))}),_.jsx("p",{className:"text-red-500 text-xs",children:Qn["cashierShift.cash"]})]}),_.jsxs(ft,{type:"submit",variant:"secondary",children:[_.jsx(Sg,{})," Buka Kasir"]})]})]})})]})]})})}export{dx as default};
