@inno_user/inno_clouds_lib 9.5.1 → 9.5.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,22 +1,22 @@
1
- (function(fe,ke){typeof exports=="object"&&typeof module<"u"?ke(exports,require("vue-router"),require("pinia"),require("vue"),require("@vueuse/core"),require("motion-v")):typeof define=="function"&&define.amd?define(["exports","vue-router","pinia","vue","@vueuse/core","motion-v"],ke):(fe=typeof globalThis<"u"?globalThis:fe||self,ke(fe.InnoCloudsLib={},fe.VueRouter,fe.Pinia,fe.Vue,fe.VueuseCore,fe.motionV))})(this,function(fe,ke,xe,r,wt,Ot){"use strict";var qg=Object.defineProperty;var al=fe=>{throw TypeError(fe)};var Zg=(fe,ke,xe)=>ke in fe?qg(fe,ke,{enumerable:!0,configurable:!0,writable:!0,value:xe}):fe[ke]=xe;var Be=(fe,ke,xe)=>Zg(fe,typeof ke!="symbol"?ke+"":ke,xe),ll=(fe,ke,xe)=>ke.has(fe)||al("Cannot "+xe);var _n=(fe,ke,xe)=>(ll(fe,ke,"read from private field"),xe?xe.call(fe):ke.get(fe)),Ui=(fe,ke,xe)=>ke.has(fe)?al("Cannot add the same private member more than once"):ke instanceof WeakSet?ke.add(fe):ke.set(fe,xe),Pn=(fe,ke,xe,r)=>(ll(fe,ke,"write to private field"),r?r.call(fe,xe):ke.set(fe,xe),xe);var Zo=(fe,ke,xe,r)=>({set _(wt){Pn(fe,ke,wt,xe)},get _(){return _n(fe,ke,r)}});var en,Gn,sr;function dl(a,l){for(var i=0;i<l.length;i++){const s=l[i];if(typeof s!="string"&&!Array.isArray(s)){for(const u in s)if(u!=="default"&&!(u in a)){const f=Object.getOwnPropertyDescriptor(s,u);f&&Object.defineProperty(a,u,f.get?f:{enumerable:!0,get:()=>s[u]})}}}return Object.freeze(Object.defineProperty(a,Symbol.toStringTag,{value:"Module"}))}function ul(a){return a}const fl=[];function hl(){return ke.createRouter({history:ke.createWebHistory(),routes:fl})}const zi=(a,l)=>l.some(i=>a instanceof i);let Yo,Ko;function ml(){return Yo||(Yo=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function gl(){return Ko||(Ko=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}const Hi=new WeakMap,Gi=new WeakMap,ri=new WeakMap;function pl(a){const l=new Promise((i,s)=>{const u=()=>{a.removeEventListener("success",f),a.removeEventListener("error",m)},f=()=>{i(zn(a.result)),u()},m=()=>{s(a.error),u()};a.addEventListener("success",f),a.addEventListener("error",m)});return ri.set(l,a),l}function xl(a){if(Hi.has(a))return;const l=new Promise((i,s)=>{const u=()=>{a.removeEventListener("complete",f),a.removeEventListener("error",m),a.removeEventListener("abort",m)},f=()=>{i(),u()},m=()=>{s(a.error||new DOMException("AbortError","AbortError")),u()};a.addEventListener("complete",f),a.addEventListener("error",m),a.addEventListener("abort",m)});Hi.set(a,l)}let Wi={get(a,l,i){if(a instanceof IDBTransaction){if(l==="done")return Hi.get(a);if(l==="store")return i.objectStoreNames[1]?void 0:i.objectStore(i.objectStoreNames[0])}return zn(a[l])},set(a,l,i){return a[l]=i,!0},has(a,l){return a instanceof IDBTransaction&&(l==="done"||l==="store")?!0:l in a}};function Qo(a){Wi=a(Wi)}function _l(a){return gl().includes(a)?function(...l){return a.apply(Xi(this),l),zn(this.request)}:function(...l){return zn(a.apply(Xi(this),l))}}function wl(a){return typeof a=="function"?_l(a):(a instanceof IDBTransaction&&xl(a),zi(a,ml())?new Proxy(a,Wi):a)}function zn(a){if(a instanceof IDBRequest)return pl(a);if(Gi.has(a))return Gi.get(a);const l=wl(a);return l!==a&&(Gi.set(a,l),ri.set(l,a)),l}const Xi=a=>ri.get(a);function Cl(a,l,{blocked:i,upgrade:s,blocking:u,terminated:f}={}){const m=indexedDB.open(a,l),p=zn(m);return s&&m.addEventListener("upgradeneeded",_=>{s(zn(m.result),_.oldVersion,_.newVersion,zn(m.transaction),_)}),i&&m.addEventListener("blocked",_=>i(_.oldVersion,_.newVersion,_)),p.then(_=>{f&&_.addEventListener("close",()=>f()),u&&_.addEventListener("versionchange",x=>u(x.oldVersion,x.newVersion,x))}).catch(()=>{}),p}function El(a,{blocked:l}={}){const i=indexedDB.deleteDatabase(a);return l&&i.addEventListener("blocked",s=>l(s.oldVersion,s)),zn(i).then(()=>{})}const yl=["get","getKey","getAll","getAllKeys","count"],bl=["put","add","delete","clear"],$i=new Map;function Jo(a,l){if(!(a instanceof IDBDatabase&&!(l in a)&&typeof l=="string"))return;if($i.get(l))return $i.get(l);const i=l.replace(/FromIndex$/,""),s=l!==i,u=bl.includes(i);if(!(i in(s?IDBIndex:IDBObjectStore).prototype)||!(u||yl.includes(i)))return;const f=async function(m,...p){const _=this.transaction(m,u?"readwrite":"readonly");let x=_.store;return s&&(x=x.index(p.shift())),(await Promise.all([x[i](...p),u&&_.done]))[0]};return $i.set(l,f),f}Qo(a=>({...a,get:(l,i,s)=>Jo(l,i)||a.get(l,i,s),has:(l,i)=>!!Jo(l,i)||a.has(l,i)}));const Al=["continue","continuePrimaryKey","advance"],es={},ji=new WeakMap,ts=new WeakMap,Sl={get(a,l){if(!Al.includes(l))return a[l];let i=es[l];return i||(i=es[l]=function(...s){ji.set(this,ts.get(this)[l](...s))}),i}};async function*Il(...a){let l=this;if(l instanceof IDBCursor||(l=await l.openCursor(...a)),!l)return;l=l;const i=new Proxy(l,Sl);for(ts.set(i,l),ri.set(i,Xi(l));l;)yield i,l=await(ji.get(i)||l.continue()),ji.delete(i)}function ns(a,l){return l===Symbol.asyncIterator&&zi(a,[IDBIndex,IDBObjectStore,IDBCursor])||l==="iterate"&&zi(a,[IDBIndex,IDBObjectStore])}Qo(a=>({...a,get(l,i,s){return ns(l,i)?Il:a.get(l,i,s)},has(l,i){return ns(l,i)||a.has(l,i)}}));let Kn;function Nl(){return Cl("data",1,{upgrade(a){a.objectStoreNames.contains("groups")||a.createObjectStore("groups",{keyPath:"id"}),a.objectStoreNames.contains("media")||a.createObjectStore("media",{keyPath:"id"}),a.objectStoreNames.contains("products")||a.createObjectStore("products",{keyPath:"id"})}})}async function Qn(){if(Kn)try{const a=await Kn;return a.transaction("groups","readonly").commit(),a}catch{Kn=void 0}return Kn=Nl(),Kn}async function qi(a){return(await Qn()).transaction("groups","readonly").objectStore("groups").get(a)}async function Dr(a,l){const s=(await Qn()).transaction("groups","readwrite");await s.objectStore("groups").put({id:a,data:l,timestamp:Date.now()}),await s.done}async function Tl(a,l){const i=JSON.parse(JSON.stringify(r.toRaw(l.value)));await Dr(a,i)}async function Zi(a,l){const s=(await Qn()).transaction("media","readwrite");await s.objectStore("media").put({id:a,blob:l,timestamp:Date.now()}),await s.done}async function fr(a){const u=await(await Qn()).transaction("media","readonly").objectStore("media").get(a);return u==null?void 0:u.blob}async function kl(a){const i=(await Qn()).transaction("products","readwrite"),s=i.objectStore("products"),u=a.id;await s.put({id:u,product:a,timestamp:Date.now()}),await i.done}async function rs(a){const u=await(await Qn()).transaction("products","readonly").objectStore("products").get(a);return u==null?void 0:u.product}async function Rl(){const a=Kn;if(Kn=void 0,a){const l=await a.catch(()=>null);l&&l.close()}try{await El("data",{blocked(){console.warn("Удаление заблокировано. открыты другие вкладки с сайтом.")}})}catch(l){console.error("Не удалось удалить базу: [lib, indexedDB]",l)}}function ii(a){"@babel/helpers - typeof";return ii=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(l){return typeof l}:function(l){return l&&typeof Symbol=="function"&&l.constructor===Symbol&&l!==Symbol.prototype?"symbol":typeof l},ii(a)}var Bl=/^\s+/,Ol=/\s+$/;function Ie(a,l){if(a=a||"",l=l||{},a instanceof Ie)return a;if(!(this instanceof Ie))return new Ie(a,l);var i=Ml(a);this._originalInput=a,this._r=i.r,this._g=i.g,this._b=i.b,this._a=i.a,this._roundA=Math.round(100*this._a)/100,this._format=l.format||i.format,this._gradientType=l.gradientType,this._r<1&&(this._r=Math.round(this._r)),this._g<1&&(this._g=Math.round(this._g)),this._b<1&&(this._b=Math.round(this._b)),this._ok=i.ok}Ie.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var l=this.toRgb();return(l.r*299+l.g*587+l.b*114)/1e3},getLuminance:function(){var l=this.toRgb(),i,s,u,f,m,p;return i=l.r/255,s=l.g/255,u=l.b/255,i<=.03928?f=i/12.92:f=Math.pow((i+.055)/1.055,2.4),s<=.03928?m=s/12.92:m=Math.pow((s+.055)/1.055,2.4),u<=.03928?p=u/12.92:p=Math.pow((u+.055)/1.055,2.4),.2126*f+.7152*m+.0722*p},setAlpha:function(l){return this._a=cs(l),this._roundA=Math.round(100*this._a)/100,this},toHsv:function(){var l=os(this._r,this._g,this._b);return{h:l.h*360,s:l.s,v:l.v,a:this._a}},toHsvString:function(){var l=os(this._r,this._g,this._b),i=Math.round(l.h*360),s=Math.round(l.s*100),u=Math.round(l.v*100);return this._a==1?"hsv("+i+", "+s+"%, "+u+"%)":"hsva("+i+", "+s+"%, "+u+"%, "+this._roundA+")"},toHsl:function(){var l=is(this._r,this._g,this._b);return{h:l.h*360,s:l.s,l:l.l,a:this._a}},toHslString:function(){var l=is(this._r,this._g,this._b),i=Math.round(l.h*360),s=Math.round(l.s*100),u=Math.round(l.l*100);return this._a==1?"hsl("+i+", "+s+"%, "+u+"%)":"hsla("+i+", "+s+"%, "+u+"%, "+this._roundA+")"},toHex:function(l){return ss(this._r,this._g,this._b,l)},toHexString:function(l){return"#"+this.toHex(l)},toHex8:function(l){return Ll(this._r,this._g,this._b,this._a,l)},toHex8String:function(l){return"#"+this.toHex8(l)},toRgb:function(){return{r:Math.round(this._r),g:Math.round(this._g),b:Math.round(this._b),a:this._a}},toRgbString:function(){return this._a==1?"rgb("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+")":"rgba("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:Math.round(Ct(this._r,255)*100)+"%",g:Math.round(Ct(this._g,255)*100)+"%",b:Math.round(Ct(this._b,255)*100)+"%",a:this._a}},toPercentageRgbString:function(){return this._a==1?"rgb("+Math.round(Ct(this._r,255)*100)+"%, "+Math.round(Ct(this._g,255)*100)+"%, "+Math.round(Ct(this._b,255)*100)+"%)":"rgba("+Math.round(Ct(this._r,255)*100)+"%, "+Math.round(Ct(this._g,255)*100)+"%, "+Math.round(Ct(this._b,255)*100)+"%, "+this._roundA+")"},toName:function(){return this._a===0?"transparent":this._a<1?!1:Zl[ss(this._r,this._g,this._b,!0)]||!1},toFilter:function(l){var i="#"+as(this._r,this._g,this._b,this._a),s=i,u=this._gradientType?"GradientType = 1, ":"";if(l){var f=Ie(l);s="#"+as(f._r,f._g,f._b,f._a)}return"progid:DXImageTransform.Microsoft.gradient("+u+"startColorstr="+i+",endColorstr="+s+")"},toString:function(l){var i=!!l;l=l||this._format;var s=!1,u=this._a<1&&this._a>=0,f=!i&&u&&(l==="hex"||l==="hex6"||l==="hex3"||l==="hex4"||l==="hex8"||l==="name");return f?l==="name"&&this._a===0?this.toName():this.toRgbString():(l==="rgb"&&(s=this.toRgbString()),l==="prgb"&&(s=this.toPercentageRgbString()),(l==="hex"||l==="hex6")&&(s=this.toHexString()),l==="hex3"&&(s=this.toHexString(!0)),l==="hex4"&&(s=this.toHex8String(!0)),l==="hex8"&&(s=this.toHex8String()),l==="name"&&(s=this.toName()),l==="hsl"&&(s=this.toHslString()),l==="hsv"&&(s=this.toHsvString()),s||this.toHexString())},clone:function(){return Ie(this.toString())},_applyModification:function(l,i){var s=l.apply(null,[this].concat([].slice.call(i)));return this._r=s._r,this._g=s._g,this._b=s._b,this.setAlpha(s._a),this},lighten:function(){return this._applyModification(zl,arguments)},brighten:function(){return this._applyModification(Hl,arguments)},darken:function(){return this._applyModification(Gl,arguments)},desaturate:function(){return this._applyModification(Fl,arguments)},saturate:function(){return this._applyModification(Vl,arguments)},greyscale:function(){return this._applyModification(Ul,arguments)},spin:function(){return this._applyModification(Wl,arguments)},_applyCombination:function(l,i){return l.apply(null,[this].concat([].slice.call(i)))},analogous:function(){return this._applyCombination(jl,arguments)},complement:function(){return this._applyCombination(Xl,arguments)},monochromatic:function(){return this._applyCombination(ql,arguments)},splitcomplement:function(){return this._applyCombination($l,arguments)},triad:function(){return this._applyCombination(ls,[3])},tetrad:function(){return this._applyCombination(ls,[4])}},Ie.fromRatio=function(a,l){if(ii(a)=="object"){var i={};for(var s in a)a.hasOwnProperty(s)&&(s==="a"?i[s]=a[s]:i[s]=vr(a[s]));a=i}return Ie(a,l)};function Ml(a){var l={r:0,g:0,b:0},i=1,s=null,u=null,f=null,m=!1,p=!1;return typeof a=="string"&&(a=Jl(a)),ii(a)=="object"&&(Ln(a.r)&&Ln(a.g)&&Ln(a.b)?(l=Dl(a.r,a.g,a.b),m=!0,p=String(a.r).substr(-1)==="%"?"prgb":"rgb"):Ln(a.h)&&Ln(a.s)&&Ln(a.v)?(s=vr(a.s),u=vr(a.v),l=Pl(a.h,s,u),m=!0,p="hsv"):Ln(a.h)&&Ln(a.s)&&Ln(a.l)&&(s=vr(a.s),f=vr(a.l),l=vl(a.h,s,f),m=!0,p="hsl"),a.hasOwnProperty("a")&&(i=a.a)),i=cs(i),{ok:m,format:a.format||p,r:Math.min(255,Math.max(l.r,0)),g:Math.min(255,Math.max(l.g,0)),b:Math.min(255,Math.max(l.b,0)),a:i}}function Dl(a,l,i){return{r:Ct(a,255)*255,g:Ct(l,255)*255,b:Ct(i,255)*255}}function is(a,l,i){a=Ct(a,255),l=Ct(l,255),i=Ct(i,255);var s=Math.max(a,l,i),u=Math.min(a,l,i),f,m,p=(s+u)/2;if(s==u)f=m=0;else{var _=s-u;switch(m=p>.5?_/(2-s-u):_/(s+u),s){case a:f=(l-i)/_+(l<i?6:0);break;case l:f=(i-a)/_+2;break;case i:f=(a-l)/_+4;break}f/=6}return{h:f,s:m,l:p}}function vl(a,l,i){var s,u,f;a=Ct(a,360),l=Ct(l,100),i=Ct(i,100);function m(x,C,y){return y<0&&(y+=1),y>1&&(y-=1),y<1/6?x+(C-x)*6*y:y<1/2?C:y<2/3?x+(C-x)*(2/3-y)*6:x}if(l===0)s=u=f=i;else{var p=i<.5?i*(1+l):i+l-i*l,_=2*i-p;s=m(_,p,a+1/3),u=m(_,p,a),f=m(_,p,a-1/3)}return{r:s*255,g:u*255,b:f*255}}function os(a,l,i){a=Ct(a,255),l=Ct(l,255),i=Ct(i,255);var s=Math.max(a,l,i),u=Math.min(a,l,i),f,m,p=s,_=s-u;if(m=s===0?0:_/s,s==u)f=0;else{switch(s){case a:f=(l-i)/_+(l<i?6:0);break;case l:f=(i-a)/_+2;break;case i:f=(a-l)/_+4;break}f/=6}return{h:f,s:m,v:p}}function Pl(a,l,i){a=Ct(a,360)*6,l=Ct(l,100),i=Ct(i,100);var s=Math.floor(a),u=a-s,f=i*(1-l),m=i*(1-u*l),p=i*(1-(1-u)*l),_=s%6,x=[i,m,f,f,p,i][_],C=[p,i,i,m,f,f][_],y=[f,f,p,i,i,m][_];return{r:x*255,g:C*255,b:y*255}}function ss(a,l,i,s){var u=[wn(Math.round(a).toString(16)),wn(Math.round(l).toString(16)),wn(Math.round(i).toString(16))];return s&&u[0].charAt(0)==u[0].charAt(1)&&u[1].charAt(0)==u[1].charAt(1)&&u[2].charAt(0)==u[2].charAt(1)?u[0].charAt(0)+u[1].charAt(0)+u[2].charAt(0):u.join("")}function Ll(a,l,i,s,u){var f=[wn(Math.round(a).toString(16)),wn(Math.round(l).toString(16)),wn(Math.round(i).toString(16)),wn(ds(s))];return u&&f[0].charAt(0)==f[0].charAt(1)&&f[1].charAt(0)==f[1].charAt(1)&&f[2].charAt(0)==f[2].charAt(1)&&f[3].charAt(0)==f[3].charAt(1)?f[0].charAt(0)+f[1].charAt(0)+f[2].charAt(0)+f[3].charAt(0):f.join("")}function as(a,l,i,s){var u=[wn(ds(s)),wn(Math.round(a).toString(16)),wn(Math.round(l).toString(16)),wn(Math.round(i).toString(16))];return u.join("")}Ie.equals=function(a,l){return!a||!l?!1:Ie(a).toRgbString()==Ie(l).toRgbString()},Ie.random=function(){return Ie.fromRatio({r:Math.random(),g:Math.random(),b:Math.random()})};function Fl(a,l){l=l===0?0:l||10;var i=Ie(a).toHsl();return i.s-=l/100,i.s=oi(i.s),Ie(i)}function Vl(a,l){l=l===0?0:l||10;var i=Ie(a).toHsl();return i.s+=l/100,i.s=oi(i.s),Ie(i)}function Ul(a){return Ie(a).desaturate(100)}function zl(a,l){l=l===0?0:l||10;var i=Ie(a).toHsl();return i.l+=l/100,i.l=oi(i.l),Ie(i)}function Hl(a,l){l=l===0?0:l||10;var i=Ie(a).toRgb();return i.r=Math.max(0,Math.min(255,i.r-Math.round(255*-(l/100)))),i.g=Math.max(0,Math.min(255,i.g-Math.round(255*-(l/100)))),i.b=Math.max(0,Math.min(255,i.b-Math.round(255*-(l/100)))),Ie(i)}function Gl(a,l){l=l===0?0:l||10;var i=Ie(a).toHsl();return i.l-=l/100,i.l=oi(i.l),Ie(i)}function Wl(a,l){var i=Ie(a).toHsl(),s=(i.h+l)%360;return i.h=s<0?360+s:s,Ie(i)}function Xl(a){var l=Ie(a).toHsl();return l.h=(l.h+180)%360,Ie(l)}function ls(a,l){if(isNaN(l)||l<=0)throw new Error("Argument to polyad must be a positive number");for(var i=Ie(a).toHsl(),s=[Ie(a)],u=360/l,f=1;f<l;f++)s.push(Ie({h:(i.h+f*u)%360,s:i.s,l:i.l}));return s}function $l(a){var l=Ie(a).toHsl(),i=l.h;return[Ie(a),Ie({h:(i+72)%360,s:l.s,l:l.l}),Ie({h:(i+216)%360,s:l.s,l:l.l})]}function jl(a,l,i){l=l||6,i=i||30;var s=Ie(a).toHsl(),u=360/i,f=[Ie(a)];for(s.h=(s.h-(u*l>>1)+720)%360;--l;)s.h=(s.h+u)%360,f.push(Ie(s));return f}function ql(a,l){l=l||6;for(var i=Ie(a).toHsv(),s=i.h,u=i.s,f=i.v,m=[],p=1/l;l--;)m.push(Ie({h:s,s:u,v:f})),f=(f+p)%1;return m}Ie.mix=function(a,l,i){i=i===0?0:i||50;var s=Ie(a).toRgb(),u=Ie(l).toRgb(),f=i/100,m={r:(u.r-s.r)*f+s.r,g:(u.g-s.g)*f+s.g,b:(u.b-s.b)*f+s.b,a:(u.a-s.a)*f+s.a};return Ie(m)},Ie.readability=function(a,l){var i=Ie(a),s=Ie(l);return(Math.max(i.getLuminance(),s.getLuminance())+.05)/(Math.min(i.getLuminance(),s.getLuminance())+.05)},Ie.isReadable=function(a,l,i){var s=Ie.readability(a,l),u,f;switch(f=!1,u=ec(i),u.level+u.size){case"AAsmall":case"AAAlarge":f=s>=4.5;break;case"AAlarge":f=s>=3;break;case"AAAsmall":f=s>=7;break}return f},Ie.mostReadable=function(a,l,i){var s=null,u=0,f,m,p,_;i=i||{},m=i.includeFallbackColors,p=i.level,_=i.size;for(var x=0;x<l.length;x++)f=Ie.readability(a,l[x]),f>u&&(u=f,s=Ie(l[x]));return Ie.isReadable(a,s,{level:p,size:_})||!m?s:(i.includeFallbackColors=!1,Ie.mostReadable(a,["#fff","#000"],i))};var Yi=Ie.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},Zl=Ie.hexNames=Yl(Yi);function Yl(a){var l={};for(var i in a)a.hasOwnProperty(i)&&(l[a[i]]=i);return l}function cs(a){return a=parseFloat(a),(isNaN(a)||a<0||a>1)&&(a=1),a}function Ct(a,l){Kl(a)&&(a="100%");var i=Ql(a);return a=Math.min(l,Math.max(0,parseFloat(a))),i&&(a=parseInt(a*l,10)/100),Math.abs(a-l)<1e-6?1:a%l/parseFloat(l)}function oi(a){return Math.min(1,Math.max(0,a))}function sn(a){return parseInt(a,16)}function Kl(a){return typeof a=="string"&&a.indexOf(".")!=-1&&parseFloat(a)===1}function Ql(a){return typeof a=="string"&&a.indexOf("%")!=-1}function wn(a){return a.length==1?"0"+a:""+a}function vr(a){return a<=1&&(a=a*100+"%"),a}function ds(a){return Math.round(parseFloat(a)*255).toString(16)}function us(a){return sn(a)/255}var Cn=function(){var a="[-\\+]?\\d+%?",l="[-\\+]?\\d*\\.\\d+%?",i="(?:"+l+")|(?:"+a+")",s="[\\s|\\(]+("+i+")[,|\\s]+("+i+")[,|\\s]+("+i+")\\s*\\)?",u="[\\s|\\(]+("+i+")[,|\\s]+("+i+")[,|\\s]+("+i+")[,|\\s]+("+i+")\\s*\\)?";return{CSS_UNIT:new RegExp(i),rgb:new RegExp("rgb"+s),rgba:new RegExp("rgba"+u),hsl:new RegExp("hsl"+s),hsla:new RegExp("hsla"+u),hsv:new RegExp("hsv"+s),hsva:new RegExp("hsva"+u),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}}();function Ln(a){return!!Cn.CSS_UNIT.exec(a)}function Jl(a){a=a.replace(Bl,"").replace(Ol,"").toLowerCase();var l=!1;if(Yi[a])a=Yi[a],l=!0;else if(a=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var i;return(i=Cn.rgb.exec(a))?{r:i[1],g:i[2],b:i[3]}:(i=Cn.rgba.exec(a))?{r:i[1],g:i[2],b:i[3],a:i[4]}:(i=Cn.hsl.exec(a))?{h:i[1],s:i[2],l:i[3]}:(i=Cn.hsla.exec(a))?{h:i[1],s:i[2],l:i[3],a:i[4]}:(i=Cn.hsv.exec(a))?{h:i[1],s:i[2],v:i[3]}:(i=Cn.hsva.exec(a))?{h:i[1],s:i[2],v:i[3],a:i[4]}:(i=Cn.hex8.exec(a))?{r:sn(i[1]),g:sn(i[2]),b:sn(i[3]),a:us(i[4]),format:l?"name":"hex8"}:(i=Cn.hex6.exec(a))?{r:sn(i[1]),g:sn(i[2]),b:sn(i[3]),format:l?"name":"hex"}:(i=Cn.hex4.exec(a))?{r:sn(i[1]+""+i[1]),g:sn(i[2]+""+i[2]),b:sn(i[3]+""+i[3]),a:us(i[4]+""+i[4]),format:l?"name":"hex8"}:(i=Cn.hex3.exec(a))?{r:sn(i[1]+""+i[1]),g:sn(i[2]+""+i[2]),b:sn(i[3]+""+i[3]),format:l?"name":"hex"}:!1}function ec(a){var l,i;return a=a||{level:"AA",size:"small"},l=(a.level||"AA").toUpperCase(),i=(a.size||"small").toLowerCase(),l!=="AA"&&l!=="AAA"&&(l="AA"),i!=="small"&&i!=="large"&&(i="small"),{level:l,size:i}}const si=xe.defineStore("imageCache",()=>{const a=r.ref({});let l=!1;function i(_,x){const C=String(_);a.value[C]&&URL.revokeObjectURL(a.value[C]);const y=URL.createObjectURL(x);a.value[C]=y}async function s(_){if(!_){console.warn("initCacheSingle called with null/undefined id");return}const x=String(_);if(a.value[x])return;const C=await fr(x);C&&(await scheduler.yield(),i(x,C),window.dispatchEvent(new CustomEvent("image-cached",{detail:{id:x,blob:C}})))}function u(_){const{id:x,blob:C}=_.detail;x&&C&&i(x,C)}function f(){typeof window>"u"||l||(window.addEventListener("image-cached",u),l=!0)}function m(){typeof window>"u"||!l||(window.removeEventListener("image-cached",u),l=!1)}function p(){Object.values(a.value).forEach(URL.revokeObjectURL),a.value={}}return typeof window<"u"&&f(),{cache:a,initCacheSingle:s,updateCacheFromBlob:i,cleanup:p,setupEventListener:f,removeEventListener:m}}),St=xe.defineStore("themeLib",()=>{const a=si(),{initCacheSingle:l}=a,i=r.ref({id:"",created_at:null,logo:null,primary_color:null,accent_color:null,accent_light_color:null,accent_dark_color:null,bg_button_color:null,bonuses_button_name:void 0,qr_auth_required:!0,qr_bypass_guest_auth:null,qr_show_pay_button_ts:null,kiosk_bypass_guest_auth:null,kiosk_disable_lock_screen:null,kiosk_hide_banner:null,inactive_button_color:null,cards_color:null,text_color:null,nonworking_bg_color:null,retail_mode:null,splash_image_url:null,splash_video:null,splash_duration:0,splash_type:null,fallback_image:null,adult_disclaimer_text:null,adult_disclaimer_image:null,kiosk_enable_wheel:null,kiosk_banner:null,kiosk_preloader:null,organization:"",kiosk_qr_payment_timeout:null,gradientStyle:null,kiosk_inactivity_timeout:null,kiosk_show_loyalty_card_button:null,kiosk_show_loyalty_phone_input_button:null,cart_loyalty_button:{cart_loyalty_button_sticker:null,cart_loyalty_button_text:null},comments:null,show_nutrition_in_cart:null,apply_custom_size_picker_fonts:null,size_picker_unselected_font_size:null,size_picker_selected_font_size:null,hide_discounts_calculate_button:!1,enable_sequential_modifiers:!1,pdf_return_url:null,kiosk_hide_manual_input_loyalty_card:null,kiosk_camera_scan_loyalty_card:null,kiosk_hide_menu_update_notification:null,kiosk_proceed_to_payment_text:null,dish_cart_mod_choice_text:null,qr_show_modifiers_in_cart:null,kiosk_show_modifiers_in_cart:null}),s=async f=>{if(!f)return;i.value={...f};const m=await fr("banner"),p=await fr("preloader"),_=await fr("defaultImage");m||u(f.kiosk_banner,"banner"),p||u(f.kiosk_preloader,"preloader"),_||u(f.fallback_image,"defaultImage"),document.documentElement.style.setProperty("--primaryColor",f.primary_color),document.documentElement.style.setProperty("--accentColor",f.accent_color),document.documentElement.style.setProperty("--accentLightColor",f.accent_light_color),document.documentElement.style.setProperty("--accentDarkColor",f.accent_dark_color),document.documentElement.style.setProperty("--bgButtonColor",f.bg_button_color),document.documentElement.style.setProperty("--inactiveButtonColor",f.inactive_button_color),document.documentElement.style.setProperty("--cardsColor",f.cards_color),document.documentElement.style.setProperty("--textColor",f.text_color),document.documentElement.style.setProperty("--nonworkingBgColor",f.nonworking_bg_color),f.apply_custom_size_picker_fonts&&f.size_picker_unselected_font_size&&f.size_picker_unselected_font_size>0&&document.documentElement.style.setProperty("--sizePickerUnselectedFontSize",`${f.size_picker_unselected_font_size}rem`),f.apply_custom_size_picker_fonts&&f.size_picker_selected_font_size&&f.size_picker_selected_font_size>0&&document.documentElement.style.setProperty("--sizePickerSelectedFontSize",`${f.size_picker_selected_font_size}rem`);const x=i.value.primary_color||"#F2F7FF",C=Ie(x).setAlpha(.7).toRgbString(),y=`linear-gradient(to bottom, transparent 10%, ${C} 50%, ${x} 85%)`,I=`-webkit-linear-gradient(to bottom, transparent 10%, ${C} 50%, ${x} 85%)`;return i.value.gradientStyle={background:y,backgroundColor:I},i.value},u=async(f,m)=>{if(f){const p=await fetch(f);if(!p.ok)throw new Error("Network error");const _=await p.blob();Zi(m,_),l(m)}};return{itemThemes:i,updateColor:s}}),hr=a=>{if(!a)return 0;if((a.price===0||a.price===null)&&a.sizes&&a.sizes.length>0){const l=a.sizes.find(i=>i.is_default===!0);return l?l.price:a.sizes.length>1?a.sizes[1].price??a.sizes[0].price:a.sizes[0].price}return a.price};class Pr extends Error{}Pr.prototype.name="InvalidTokenError";function tc(a){return decodeURIComponent(atob(a).replace(/(.)/g,(l,i)=>{let s=i.charCodeAt(0).toString(16).toUpperCase();return s.length<2&&(s="0"+s),"%"+s}))}function nc(a){let l=a.replace(/-/g,"+").replace(/_/g,"/");switch(l.length%4){case 0:break;case 2:l+="==";break;case 3:l+="=";break;default:throw new Error("base64 string is not of the correct length")}try{return tc(l)}catch{return atob(l)}}function fs(a,l){if(typeof a!="string")throw new Pr("Invalid token specified: must be a string");l||(l={});const i=l.header===!0?0:1,s=a.split(".")[i];if(typeof s!="string")throw new Pr(`Invalid token specified: missing part #${i+1}`);let u;try{u=nc(s)}catch(f){throw new Pr(`Invalid token specified: invalid base64 for part #${i+1} (${f.message})`)}try{return JSON.parse(u)}catch(f){throw new Pr(`Invalid token specified: invalid json for part #${i+1} (${f.message})`)}}const rc=(a,l)=>{if(typeof window<"u"){const i=localStorage.getItem(a);if(i)try{return JSON.parse(i)}catch{return l}return l}return l},ic=(a,l)=>{if(typeof window<"u"){const i=localStorage.getItem(a);if(i)try{return fs(JSON.parse(i))}catch(s){return console.error("Failed to decode JWT:",s),l}}return l},hs=(a,l,i="normal")=>{const s=r.ref(i==="jwt"?ic(a,l):rc(a,l));return r.watchEffect(()=>{s.value===null||s.value===void 0?localStorage.removeItem(a):i!=="jwt"&&localStorage.setItem(a,JSON.stringify(s.value))}),s},mr=a=>{a.forEach(l=>{try{localStorage.removeItem(l)}catch(i){console.error(`Ошибка при удалении ключа "${l}":`,i)}})};class oc{constructor(l,i={}){Be(this,"url");Be(this,"options");Be(this,"ws");Be(this,"reconnectInterval");Be(this,"listeners");Be(this,"isConnected");Be(this,"heartbeat");Be(this,"heartbeatTimeout");Be(this,"pingTimeout");Be(this,"pingResponseTimeout");Be(this,"signal");Be(this,"_shouldReconnect",!0);this.url=l,this.options=i,this.ws=null,this.reconnectInterval=5e3,this.pingResponseTimeout=5e3,this.listeners=new Map,this.isConnected=r.ref(!1),this.heartbeatTimeout=i.heartbeatTimeout||3e5}connect(){var i,s;if(this.ws&&this.ws.readyState===WebSocket.OPEN){console.warn("WebSocket already open");return}if(!this._shouldReconnect){console.warn("Reconnection disabled");return}const l=`${this.url}`;this.ws=new WebSocket(l),(i=this.options.signal)!=null&&i.aborted&&this.close(!0),(s=this.options.signal)==null||s.addEventListener("abort",()=>this.close(!0)),this.ws.onopen=()=>{console.warn("WebSocket connected"),this.isConnected.value=!0,this.emit("open"),this.heartbeat=setInterval(()=>this.sendPing(),this.heartbeatTimeout)},this.ws.onmessage=u=>{try{const f=JSON.parse(u.data);this.emit("message",f),f!=null&&f.type&&f.type!=="ping"&&clearTimeout(this.pingTimeout)}catch(f){console.error("Error parsing WebSocket message:",f)}},this.ws.onerror=u=>{console.error("WebSocket error:",u),this.emit("error",u),this.close(!0)},this.ws.onclose=()=>{this.isConnected.value=!1,console.warn("WebSocket closed"),this.emit("close"),clearInterval(this.heartbeat),clearTimeout(this.pingTimeout),this._shouldReconnect&&(console.log(`Reconnecting in ${this.reconnectInterval}ms...`),setTimeout(()=>this.connect(),this.reconnectInterval))}}sendPing(){var l;this.isConnected.value&&((l=this.ws)==null?void 0:l.readyState)===WebSocket.OPEN?(this.ws.send(JSON.stringify({type:"ping"})),this.pingTimeout=setTimeout(()=>{console.warn("No pong received, reconnecting..."),this.close(!0),this.connect()},this.pingResponseTimeout)):console.warn("WebSocket not connected, cannot send ping")}send(l){var i;this.isConnected.value&&((i=this.ws)==null?void 0:i.readyState)===WebSocket.OPEN?this.ws.send(JSON.stringify(l)):console.warn("WebSocket not connected")}close(l=!1){this.ws&&(this._shouldReconnect=!l,this.ws.close(),clearInterval(this.heartbeat),clearTimeout(this.pingTimeout),this.ws=null,this.listeners.clear())}on(l,i){this.listeners.has(l)||this.listeners.set(l,[]),this.listeners.get(l).push(i)}off(l,i){const s=this.listeners.get(l);s&&this.listeners.set(l,s.filter(u=>u!==i))}emit(l,i=null){const s=this.listeners.get(l);s&&s.forEach(u=>u(i))}getConnectionStatus(){return this.isConnected}}let ai=new Map;function Lr(a,l={}){var s;if(ai.has(a)){const u=ai.get(a);if(u.isConnected.value&&((s=u.ws)==null?void 0:s.readyState)===WebSocket.OPEN)return u.listeners.clear(),u;u.close(!0),ai.delete(a)}const i=new oc(a,l);return ai.set(a,i),i}const st=xe.defineStore("mainLib",()=>{const a=r.ref(),l=r.ref(!1),i=r.ref(localStorage.getItem("kiosk_timeout")),s=r.ref(0),u=r.ref(!1),f=r.ref(sessionStorage.getItem("is_adult")==="true"),m=r.ref([]),p=r.ref([]),_=r.ref(!1),x=r.ref(),C=r.ref(""),y=r.ref(0),I=r.ref(!1),O=r.ref(!1),T=r.ref(!0),D=r.ref(),k=r.ref(!localStorage.getItem("apiKey")),P=r.ref(!1),M=r.ref({textNotification:""}),v=r.ref([]);let W=null;const X=J=>{const se=`wss://${x.value.area}/ws/device/${J}/`;W=Lr(se);function ce(){console.log("WebSocket connection opened")}function we(Ae){if(Ae.error)P.value=!0,M.value.textNotification=Ae.error,W==null||W.close(!0);else{if(!(Ae!=null&&Ae.params))return;D.value=Ae.params,typeof Ae.params.components.shift.is_ok!==null?T.value=Ae.params.components.shift.is_ok:T.value=!0}}function Ce(Ae){console.error("WebSocket error:",Ae),W.close(!0)}W.on("open",ce),W.on("message",we),W.on("error",Ce),W.connect()},Z=J=>{s.value=J,localStorage.setItem("kiosk_timeout",J)},F=J=>{l.value=J},L=r.ref(null),V=r.computed(()=>m.value.reduce((J,se)=>{let ce=0,we=0;return se.group_modifiers&&(ce=se.group_modifiers.reduce((Ce,Ae)=>Ae.modifiers?Ce+Ae.modifiers.reduce((ge,ht)=>ge+ht.old_price*ht.amount,0):0,0)*se.amount),se.modifiers&&(we=se.modifiers.reduce((Ce,Ae)=>Ce+Ae.old_price*Ae.amount,0)*se.amount),J+se.old_price*se.amount+ce+we},0)),ie=r.computed({get:()=>m.value.length===0||L.value===0?0:L.value&&L.value!==0?L.value:m.value.reduce((J,se)=>{const ce=hr(se)*se.amount;let we=0,Ce=0;return se.group_modifiers&&(we=se.group_modifiers.reduce((Ae,ge)=>ge.modifiers?Ae+ge.modifiers.reduce((ht,be)=>ht+be.price*be.amount,0):0,0)*se.amount),se.modifiers&&(Ce=se.modifiers.reduce((Ae,ge)=>Ae+ge.price*ge.amount,0)*se.amount),J+ce+we+Ce},0),set(J){L.value=J}}),K=J=>{y.value=J,localStorage.removeItem("bonus"),hs("bonus",y.value)},ee=J=>{mr(J)},G=J=>{J={...J,idSystem:crypto.randomUUID()};const se=N(J);m.value.push(se),z()},z=()=>{try{if(!m.value||m.value.length===0){localStorage.removeItem("cart");return}localStorage.setItem("cart",JSON.stringify(r.toRaw(m.value)))}catch(J){console.error("Failed to update cart in localStorage:",J)}},N=J=>r.reactive({...J,amount:J.amount??1,price:J.old_price,new_price:null,total_new_price:null,discounts:[],modifiers:(J.modifiers||[]).map(se=>r.reactive({...se,price:se.old_price,new_price:null,total_new_price:null})),group_modifiers:(J.group_modifiers||[]).map(se=>r.reactive({...se,modifiers:(se.modifiers||[]).map(ce=>r.reactive({...ce,price:ce.old_price,new_price:null,total_new_price:null}))}))}),$=J=>{const se=m.value.find(ce=>ce.idSystem===J);se&&(se.amount+=1),z()},q=J=>{const se=m.value.find(ce=>ce.idSystem===J);se&&(se.amount>=1&&(se.amount-=1),z())},j=()=>{try{const J=localStorage.getItem("cart");if(J){const se=JSON.parse(J);m.value.splice(0,m.value.length,...se.map(N)),L.value=null}}catch(J){console.error("Failed to load cart from localStorage:",J)}};return j(),{cartProducts_lib:m,activeScrolling_lib:p,config_lib:x,totalPrice_lib:ie,initialCartPrice_lib:V,is_notification_lib:P,notificationData_lib:M,xApiKey_lib:C,countBonus:y,toggleDrum:l,is_showApiKey:k,openApiKey:I,kiosk_timeout:i,kiosk_FirstTimeout:s,is_OpenLoyal:O,profile:a,is_18_above_content:u,is18Allowed:f,healthState:T,healthData:D,displayCards:v,isOrderTypeSubmited:_,removeFromLocalStorage:ee,setKioskTimeout:Z,setBonus:K,setStateDrum:F,addToCart:G,plusAmount:$,minusAmount:q,loadCart:j,deleteItemFromCart:J=>{if(J){const se=m.value.findIndex(ce=>ce.idSystem===J);if(se===-1)return;m.value.splice(se,1),z(),L.value=null}else m.value=[],z()},updateCartInLocalStorage:z,makeProductFullyReactive:N,checkHeartbeatApp:X}});function ms(a,l){return function(){return a.apply(l,arguments)}}const{toString:sc}=Object.prototype,{getPrototypeOf:Ki}=Object,{iterator:li,toStringTag:gs}=Symbol,ci=(a=>l=>{const i=sc.call(l);return a[i]||(a[i]=i.slice(8,-1).toLowerCase())})(Object.create(null)),En=a=>(a=a.toLowerCase(),l=>ci(l)===a),di=a=>l=>typeof l===a,{isArray:gr}=Array,pr=di("undefined");function Fr(a){return a!==null&&!pr(a)&&a.constructor!==null&&!pr(a.constructor)&&Kt(a.constructor.isBuffer)&&a.constructor.isBuffer(a)}const ps=En("ArrayBuffer");function ac(a){let l;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?l=ArrayBuffer.isView(a):l=a&&a.buffer&&ps(a.buffer),l}const lc=di("string"),Kt=di("function"),xs=di("number"),Vr=a=>a!==null&&typeof a=="object",cc=a=>a===!0||a===!1,ui=a=>{if(ci(a)!=="object")return!1;const l=Ki(a);return(l===null||l===Object.prototype||Object.getPrototypeOf(l)===null)&&!(gs in a)&&!(li in a)},dc=a=>{if(!Vr(a)||Fr(a))return!1;try{return Object.keys(a).length===0&&Object.getPrototypeOf(a)===Object.prototype}catch{return!1}},uc=En("Date"),fc=En("File"),hc=En("Blob"),mc=En("FileList"),gc=a=>Vr(a)&&Kt(a.pipe),pc=a=>{let l;return a&&(typeof FormData=="function"&&a instanceof FormData||Kt(a.append)&&((l=ci(a))==="formdata"||l==="object"&&Kt(a.toString)&&a.toString()==="[object FormData]"))},xc=En("URLSearchParams"),[_c,wc,Cc,Ec]=["ReadableStream","Request","Response","Headers"].map(En),yc=a=>a.trim?a.trim():a.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Ur(a,l,{allOwnKeys:i=!1}={}){if(a===null||typeof a>"u")return;let s,u;if(typeof a!="object"&&(a=[a]),gr(a))for(s=0,u=a.length;s<u;s++)l.call(null,a[s],s,a);else{if(Fr(a))return;const f=i?Object.getOwnPropertyNames(a):Object.keys(a),m=f.length;let p;for(s=0;s<m;s++)p=f[s],l.call(null,a[p],p,a)}}function _s(a,l){if(Fr(a))return null;l=l.toLowerCase();const i=Object.keys(a);let s=i.length,u;for(;s-- >0;)if(u=i[s],l===u.toLowerCase())return u;return null}const Jn=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,ws=a=>!pr(a)&&a!==Jn;function Qi(){const{caseless:a,skipUndefined:l}=ws(this)&&this||{},i={},s=(u,f)=>{const m=a&&_s(i,f)||f;ui(i[m])&&ui(u)?i[m]=Qi(i[m],u):ui(u)?i[m]=Qi({},u):gr(u)?i[m]=u.slice():(!l||!pr(u))&&(i[m]=u)};for(let u=0,f=arguments.length;u<f;u++)arguments[u]&&Ur(arguments[u],s);return i}const bc=(a,l,i,{allOwnKeys:s}={})=>(Ur(l,(u,f)=>{i&&Kt(u)?a[f]=ms(u,i):a[f]=u},{allOwnKeys:s}),a),Ac=a=>(a.charCodeAt(0)===65279&&(a=a.slice(1)),a),Sc=(a,l,i,s)=>{a.prototype=Object.create(l.prototype,s),a.prototype.constructor=a,Object.defineProperty(a,"super",{value:l.prototype}),i&&Object.assign(a.prototype,i)},Ic=(a,l,i,s)=>{let u,f,m;const p={};if(l=l||{},a==null)return l;do{for(u=Object.getOwnPropertyNames(a),f=u.length;f-- >0;)m=u[f],(!s||s(m,a,l))&&!p[m]&&(l[m]=a[m],p[m]=!0);a=i!==!1&&Ki(a)}while(a&&(!i||i(a,l))&&a!==Object.prototype);return l},Nc=(a,l,i)=>{a=String(a),(i===void 0||i>a.length)&&(i=a.length),i-=l.length;const s=a.indexOf(l,i);return s!==-1&&s===i},Tc=a=>{if(!a)return null;if(gr(a))return a;let l=a.length;if(!xs(l))return null;const i=new Array(l);for(;l-- >0;)i[l]=a[l];return i},kc=(a=>l=>a&&l instanceof a)(typeof Uint8Array<"u"&&Ki(Uint8Array)),Rc=(a,l)=>{const s=(a&&a[li]).call(a);let u;for(;(u=s.next())&&!u.done;){const f=u.value;l.call(a,f[0],f[1])}},Bc=(a,l)=>{let i;const s=[];for(;(i=a.exec(l))!==null;)s.push(i);return s},Oc=En("HTMLFormElement"),Mc=a=>a.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(i,s,u){return s.toUpperCase()+u}),Cs=(({hasOwnProperty:a})=>(l,i)=>a.call(l,i))(Object.prototype),Dc=En("RegExp"),Es=(a,l)=>{const i=Object.getOwnPropertyDescriptors(a),s={};Ur(i,(u,f)=>{let m;(m=l(u,f,a))!==!1&&(s[f]=m||u)}),Object.defineProperties(a,s)},vc=a=>{Es(a,(l,i)=>{if(Kt(a)&&["arguments","caller","callee"].indexOf(i)!==-1)return!1;const s=a[i];if(Kt(s)){if(l.enumerable=!1,"writable"in l){l.writable=!1;return}l.set||(l.set=()=>{throw Error("Can not rewrite read-only method '"+i+"'")})}})},Pc=(a,l)=>{const i={},s=u=>{u.forEach(f=>{i[f]=!0})};return gr(a)?s(a):s(String(a).split(l)),i},Lc=()=>{},Fc=(a,l)=>a!=null&&Number.isFinite(a=+a)?a:l;function Vc(a){return!!(a&&Kt(a.append)&&a[gs]==="FormData"&&a[li])}const Uc=a=>{const l=new Array(10),i=(s,u)=>{if(Vr(s)){if(l.indexOf(s)>=0)return;if(Fr(s))return s;if(!("toJSON"in s)){l[u]=s;const f=gr(s)?[]:{};return Ur(s,(m,p)=>{const _=i(m,u+1);!pr(_)&&(f[p]=_)}),l[u]=void 0,f}}return s};return i(a,0)},zc=En("AsyncFunction"),Hc=a=>a&&(Vr(a)||Kt(a))&&Kt(a.then)&&Kt(a.catch),ys=((a,l)=>a?setImmediate:l?((i,s)=>(Jn.addEventListener("message",({source:u,data:f})=>{u===Jn&&f===i&&s.length&&s.shift()()},!1),u=>{s.push(u),Jn.postMessage(i,"*")}))(`axios@${Math.random()}`,[]):i=>setTimeout(i))(typeof setImmediate=="function",Kt(Jn.postMessage)),Gc=typeof queueMicrotask<"u"?queueMicrotask.bind(Jn):typeof process<"u"&&process.nextTick||ys,ne={isArray:gr,isArrayBuffer:ps,isBuffer:Fr,isFormData:pc,isArrayBufferView:ac,isString:lc,isNumber:xs,isBoolean:cc,isObject:Vr,isPlainObject:ui,isEmptyObject:dc,isReadableStream:_c,isRequest:wc,isResponse:Cc,isHeaders:Ec,isUndefined:pr,isDate:uc,isFile:fc,isBlob:hc,isRegExp:Dc,isFunction:Kt,isStream:gc,isURLSearchParams:xc,isTypedArray:kc,isFileList:mc,forEach:Ur,merge:Qi,extend:bc,trim:yc,stripBOM:Ac,inherits:Sc,toFlatObject:Ic,kindOf:ci,kindOfTest:En,endsWith:Nc,toArray:Tc,forEachEntry:Rc,matchAll:Bc,isHTMLForm:Oc,hasOwnProperty:Cs,hasOwnProp:Cs,reduceDescriptors:Es,freezeMethods:vc,toObjectSet:Pc,toCamelCase:Mc,noop:Lc,toFiniteNumber:Fc,findKey:_s,global:Jn,isContextDefined:ws,isSpecCompliantForm:Vc,toJSONObject:Uc,isAsyncFn:zc,isThenable:Hc,setImmediate:ys,asap:Gc,isIterable:a=>a!=null&&Kt(a[li])};function Le(a,l,i,s,u){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=a,this.name="AxiosError",l&&(this.code=l),i&&(this.config=i),s&&(this.request=s),u&&(this.response=u,this.status=u.status?u.status:null)}ne.inherits(Le,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:ne.toJSONObject(this.config),code:this.code,status:this.status}}});const bs=Le.prototype,As={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(a=>{As[a]={value:a}}),Object.defineProperties(Le,As),Object.defineProperty(bs,"isAxiosError",{value:!0}),Le.from=(a,l,i,s,u,f)=>{const m=Object.create(bs);ne.toFlatObject(a,m,function(C){return C!==Error.prototype},x=>x!=="isAxiosError");const p=a&&a.message?a.message:"Error",_=l==null&&a?a.code:l;return Le.call(m,p,_,i,s,u),a&&m.cause==null&&Object.defineProperty(m,"cause",{value:a,configurable:!0}),m.name=a&&a.name||"Error",f&&Object.assign(m,f),m};const Wc=null;function Ji(a){return ne.isPlainObject(a)||ne.isArray(a)}function Ss(a){return ne.endsWith(a,"[]")?a.slice(0,-2):a}function Is(a,l,i){return a?a.concat(l).map(function(u,f){return u=Ss(u),!i&&f?"["+u+"]":u}).join(i?".":""):l}function Xc(a){return ne.isArray(a)&&!a.some(Ji)}const $c=ne.toFlatObject(ne,{},null,function(l){return/^is[A-Z]/.test(l)});function fi(a,l,i){if(!ne.isObject(a))throw new TypeError("target must be an object");l=l||new FormData,i=ne.toFlatObject(i,{metaTokens:!0,dots:!1,indexes:!1},!1,function(D,k){return!ne.isUndefined(k[D])});const s=i.metaTokens,u=i.visitor||C,f=i.dots,m=i.indexes,_=(i.Blob||typeof Blob<"u"&&Blob)&&ne.isSpecCompliantForm(l);if(!ne.isFunction(u))throw new TypeError("visitor must be a function");function x(T){if(T===null)return"";if(ne.isDate(T))return T.toISOString();if(ne.isBoolean(T))return T.toString();if(!_&&ne.isBlob(T))throw new Le("Blob is not supported. Use a Buffer instead.");return ne.isArrayBuffer(T)||ne.isTypedArray(T)?_&&typeof Blob=="function"?new Blob([T]):Buffer.from(T):T}function C(T,D,k){let P=T;if(T&&!k&&typeof T=="object"){if(ne.endsWith(D,"{}"))D=s?D:D.slice(0,-2),T=JSON.stringify(T);else if(ne.isArray(T)&&Xc(T)||(ne.isFileList(T)||ne.endsWith(D,"[]"))&&(P=ne.toArray(T)))return D=Ss(D),P.forEach(function(v,W){!(ne.isUndefined(v)||v===null)&&l.append(m===!0?Is([D],W,f):m===null?D:D+"[]",x(v))}),!1}return Ji(T)?!0:(l.append(Is(k,D,f),x(T)),!1)}const y=[],I=Object.assign($c,{defaultVisitor:C,convertValue:x,isVisitable:Ji});function O(T,D){if(!ne.isUndefined(T)){if(y.indexOf(T)!==-1)throw Error("Circular reference detected in "+D.join("."));y.push(T),ne.forEach(T,function(P,M){(!(ne.isUndefined(P)||P===null)&&u.call(l,P,ne.isString(M)?M.trim():M,D,I))===!0&&O(P,D?D.concat(M):[M])}),y.pop()}}if(!ne.isObject(a))throw new TypeError("data must be an object");return O(a),l}function Ns(a){const l={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(a).replace(/[!'()~]|%20|%00/g,function(s){return l[s]})}function eo(a,l){this._pairs=[],a&&fi(a,this,l)}const Ts=eo.prototype;Ts.append=function(l,i){this._pairs.push([l,i])},Ts.toString=function(l){const i=l?function(s){return l.call(this,s,Ns)}:Ns;return this._pairs.map(function(u){return i(u[0])+"="+i(u[1])},"").join("&")};function jc(a){return encodeURIComponent(a).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function ks(a,l,i){if(!l)return a;const s=i&&i.encode||jc;ne.isFunction(i)&&(i={serialize:i});const u=i&&i.serialize;let f;if(u?f=u(l,i):f=ne.isURLSearchParams(l)?l.toString():new eo(l,i).toString(s),f){const m=a.indexOf("#");m!==-1&&(a=a.slice(0,m)),a+=(a.indexOf("?")===-1?"?":"&")+f}return a}class Rs{constructor(){this.handlers=[]}use(l,i,s){return this.handlers.push({fulfilled:l,rejected:i,synchronous:s?s.synchronous:!1,runWhen:s?s.runWhen:null}),this.handlers.length-1}eject(l){this.handlers[l]&&(this.handlers[l]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(l){ne.forEach(this.handlers,function(s){s!==null&&l(s)})}}const Bs={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},qc={isBrowser:!0,classes:{URLSearchParams:typeof URLSearchParams<"u"?URLSearchParams:eo,FormData:typeof FormData<"u"?FormData:null,Blob:typeof Blob<"u"?Blob:null},protocols:["http","https","file","blob","url","data"]},to=typeof window<"u"&&typeof document<"u",no=typeof navigator=="object"&&navigator||void 0,Zc=to&&(!no||["ReactNative","NativeScript","NS"].indexOf(no.product)<0),Yc=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Kc=to&&window.location.href||"http://localhost",Xt={...Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:to,hasStandardBrowserEnv:Zc,hasStandardBrowserWebWorkerEnv:Yc,navigator:no,origin:Kc},Symbol.toStringTag,{value:"Module"})),...qc};function Qc(a,l){return fi(a,new Xt.classes.URLSearchParams,{visitor:function(i,s,u,f){return Xt.isNode&&ne.isBuffer(i)?(this.append(s,i.toString("base64")),!1):f.defaultVisitor.apply(this,arguments)},...l})}function Jc(a){return ne.matchAll(/\w+|\[(\w*)]/g,a).map(l=>l[0]==="[]"?"":l[1]||l[0])}function ed(a){const l={},i=Object.keys(a);let s;const u=i.length;let f;for(s=0;s<u;s++)f=i[s],l[f]=a[f];return l}function Os(a){function l(i,s,u,f){let m=i[f++];if(m==="__proto__")return!0;const p=Number.isFinite(+m),_=f>=i.length;return m=!m&&ne.isArray(u)?u.length:m,_?(ne.hasOwnProp(u,m)?u[m]=[u[m],s]:u[m]=s,!p):((!u[m]||!ne.isObject(u[m]))&&(u[m]=[]),l(i,s,u[m],f)&&ne.isArray(u[m])&&(u[m]=ed(u[m])),!p)}if(ne.isFormData(a)&&ne.isFunction(a.entries)){const i={};return ne.forEachEntry(a,(s,u)=>{l(Jc(s),u,i,0)}),i}return null}function td(a,l,i){if(ne.isString(a))try{return(l||JSON.parse)(a),ne.trim(a)}catch(s){if(s.name!=="SyntaxError")throw s}return(i||JSON.stringify)(a)}const zr={transitional:Bs,adapter:["xhr","http","fetch"],transformRequest:[function(l,i){const s=i.getContentType()||"",u=s.indexOf("application/json")>-1,f=ne.isObject(l);if(f&&ne.isHTMLForm(l)&&(l=new FormData(l)),ne.isFormData(l))return u?JSON.stringify(Os(l)):l;if(ne.isArrayBuffer(l)||ne.isBuffer(l)||ne.isStream(l)||ne.isFile(l)||ne.isBlob(l)||ne.isReadableStream(l))return l;if(ne.isArrayBufferView(l))return l.buffer;if(ne.isURLSearchParams(l))return i.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),l.toString();let p;if(f){if(s.indexOf("application/x-www-form-urlencoded")>-1)return Qc(l,this.formSerializer).toString();if((p=ne.isFileList(l))||s.indexOf("multipart/form-data")>-1){const _=this.env&&this.env.FormData;return fi(p?{"files[]":l}:l,_&&new _,this.formSerializer)}}return f||u?(i.setContentType("application/json",!1),td(l)):l}],transformResponse:[function(l){const i=this.transitional||zr.transitional,s=i&&i.forcedJSONParsing,u=this.responseType==="json";if(ne.isResponse(l)||ne.isReadableStream(l))return l;if(l&&ne.isString(l)&&(s&&!this.responseType||u)){const m=!(i&&i.silentJSONParsing)&&u;try{return JSON.parse(l,this.parseReviver)}catch(p){if(m)throw p.name==="SyntaxError"?Le.from(p,Le.ERR_BAD_RESPONSE,this,null,this.response):p}}return l}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Xt.classes.FormData,Blob:Xt.classes.Blob},validateStatus:function(l){return l>=200&&l<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};ne.forEach(["delete","get","head","post","put","patch"],a=>{zr.headers[a]={}});const nd=ne.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),rd=a=>{const l={};let i,s,u;return a&&a.split(`
2
- `).forEach(function(m){u=m.indexOf(":"),i=m.substring(0,u).trim().toLowerCase(),s=m.substring(u+1).trim(),!(!i||l[i]&&nd[i])&&(i==="set-cookie"?l[i]?l[i].push(s):l[i]=[s]:l[i]=l[i]?l[i]+", "+s:s)}),l},Ms=Symbol("internals");function Hr(a){return a&&String(a).trim().toLowerCase()}function hi(a){return a===!1||a==null?a:ne.isArray(a)?a.map(hi):String(a)}function id(a){const l=Object.create(null),i=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let s;for(;s=i.exec(a);)l[s[1]]=s[2];return l}const od=a=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(a.trim());function ro(a,l,i,s,u){if(ne.isFunction(s))return s.call(this,l,i);if(u&&(l=i),!!ne.isString(l)){if(ne.isString(s))return l.indexOf(s)!==-1;if(ne.isRegExp(s))return s.test(l)}}function sd(a){return a.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(l,i,s)=>i.toUpperCase()+s)}function ad(a,l){const i=ne.toCamelCase(" "+l);["get","set","has"].forEach(s=>{Object.defineProperty(a,s+i,{value:function(u,f,m){return this[s].call(this,l,u,f,m)},configurable:!0})})}let Qt=class{constructor(l){l&&this.set(l)}set(l,i,s){const u=this;function f(p,_,x){const C=Hr(_);if(!C)throw new Error("header name must be a non-empty string");const y=ne.findKey(u,C);(!y||u[y]===void 0||x===!0||x===void 0&&u[y]!==!1)&&(u[y||_]=hi(p))}const m=(p,_)=>ne.forEach(p,(x,C)=>f(x,C,_));if(ne.isPlainObject(l)||l instanceof this.constructor)m(l,i);else if(ne.isString(l)&&(l=l.trim())&&!od(l))m(rd(l),i);else if(ne.isObject(l)&&ne.isIterable(l)){let p={},_,x;for(const C of l){if(!ne.isArray(C))throw TypeError("Object iterator must return a key-value pair");p[x=C[0]]=(_=p[x])?ne.isArray(_)?[..._,C[1]]:[_,C[1]]:C[1]}m(p,i)}else l!=null&&f(i,l,s);return this}get(l,i){if(l=Hr(l),l){const s=ne.findKey(this,l);if(s){const u=this[s];if(!i)return u;if(i===!0)return id(u);if(ne.isFunction(i))return i.call(this,u,s);if(ne.isRegExp(i))return i.exec(u);throw new TypeError("parser must be boolean|regexp|function")}}}has(l,i){if(l=Hr(l),l){const s=ne.findKey(this,l);return!!(s&&this[s]!==void 0&&(!i||ro(this,this[s],s,i)))}return!1}delete(l,i){const s=this;let u=!1;function f(m){if(m=Hr(m),m){const p=ne.findKey(s,m);p&&(!i||ro(s,s[p],p,i))&&(delete s[p],u=!0)}}return ne.isArray(l)?l.forEach(f):f(l),u}clear(l){const i=Object.keys(this);let s=i.length,u=!1;for(;s--;){const f=i[s];(!l||ro(this,this[f],f,l,!0))&&(delete this[f],u=!0)}return u}normalize(l){const i=this,s={};return ne.forEach(this,(u,f)=>{const m=ne.findKey(s,f);if(m){i[m]=hi(u),delete i[f];return}const p=l?sd(f):String(f).trim();p!==f&&delete i[f],i[p]=hi(u),s[p]=!0}),this}concat(...l){return this.constructor.concat(this,...l)}toJSON(l){const i=Object.create(null);return ne.forEach(this,(s,u)=>{s!=null&&s!==!1&&(i[u]=l&&ne.isArray(s)?s.join(", "):s)}),i}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([l,i])=>l+": "+i).join(`
3
- `)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(l){return l instanceof this?l:new this(l)}static concat(l,...i){const s=new this(l);return i.forEach(u=>s.set(u)),s}static accessor(l){const s=(this[Ms]=this[Ms]={accessors:{}}).accessors,u=this.prototype;function f(m){const p=Hr(m);s[p]||(ad(u,m),s[p]=!0)}return ne.isArray(l)?l.forEach(f):f(l),this}};Qt.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),ne.reduceDescriptors(Qt.prototype,({value:a},l)=>{let i=l[0].toUpperCase()+l.slice(1);return{get:()=>a,set(s){this[i]=s}}}),ne.freezeMethods(Qt);function io(a,l){const i=this||zr,s=l||i,u=Qt.from(s.headers);let f=s.data;return ne.forEach(a,function(p){f=p.call(i,f,u.normalize(),l?l.status:void 0)}),u.normalize(),f}function Ds(a){return!!(a&&a.__CANCEL__)}function xr(a,l,i){Le.call(this,a??"canceled",Le.ERR_CANCELED,l,i),this.name="CanceledError"}ne.inherits(xr,Le,{__CANCEL__:!0});function vs(a,l,i){const s=i.config.validateStatus;!i.status||!s||s(i.status)?a(i):l(new Le("Request failed with status code "+i.status,[Le.ERR_BAD_REQUEST,Le.ERR_BAD_RESPONSE][Math.floor(i.status/100)-4],i.config,i.request,i))}function ld(a){const l=/^([-+\w]{1,25})(:?\/\/|:)/.exec(a);return l&&l[1]||""}function cd(a,l){a=a||10;const i=new Array(a),s=new Array(a);let u=0,f=0,m;return l=l!==void 0?l:1e3,function(_){const x=Date.now(),C=s[f];m||(m=x),i[u]=_,s[u]=x;let y=f,I=0;for(;y!==u;)I+=i[y++],y=y%a;if(u=(u+1)%a,u===f&&(f=(f+1)%a),x-m<l)return;const O=C&&x-C;return O?Math.round(I*1e3/O):void 0}}function dd(a,l){let i=0,s=1e3/l,u,f;const m=(x,C=Date.now())=>{i=C,u=null,f&&(clearTimeout(f),f=null),a(...x)};return[(...x)=>{const C=Date.now(),y=C-i;y>=s?m(x,C):(u=x,f||(f=setTimeout(()=>{f=null,m(u)},s-y)))},()=>u&&m(u)]}const mi=(a,l,i=3)=>{let s=0;const u=cd(50,250);return dd(f=>{const m=f.loaded,p=f.lengthComputable?f.total:void 0,_=m-s,x=u(_),C=m<=p;s=m;const y={loaded:m,total:p,progress:p?m/p:void 0,bytes:_,rate:x||void 0,estimated:x&&p&&C?(p-m)/x:void 0,event:f,lengthComputable:p!=null,[l?"download":"upload"]:!0};a(y)},i)},Ps=(a,l)=>{const i=a!=null;return[s=>l[0]({lengthComputable:i,total:a,loaded:s}),l[1]]},Ls=a=>(...l)=>ne.asap(()=>a(...l)),ud=Xt.hasStandardBrowserEnv?((a,l)=>i=>(i=new URL(i,Xt.origin),a.protocol===i.protocol&&a.host===i.host&&(l||a.port===i.port)))(new URL(Xt.origin),Xt.navigator&&/(msie|trident)/i.test(Xt.navigator.userAgent)):()=>!0,fd=Xt.hasStandardBrowserEnv?{write(a,l,i,s,u,f,m){if(typeof document>"u")return;const p=[`${a}=${encodeURIComponent(l)}`];ne.isNumber(i)&&p.push(`expires=${new Date(i).toUTCString()}`),ne.isString(s)&&p.push(`path=${s}`),ne.isString(u)&&p.push(`domain=${u}`),f===!0&&p.push("secure"),ne.isString(m)&&p.push(`SameSite=${m}`),document.cookie=p.join("; ")},read(a){if(typeof document>"u")return null;const l=document.cookie.match(new RegExp("(?:^|; )"+a+"=([^;]*)"));return l?decodeURIComponent(l[1]):null},remove(a){this.write(a,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function hd(a){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(a)}function md(a,l){return l?a.replace(/\/?\/$/,"")+"/"+l.replace(/^\/+/,""):a}function Fs(a,l,i){let s=!hd(l);return a&&(s||i==!1)?md(a,l):l}const Vs=a=>a instanceof Qt?{...a}:a;function er(a,l){l=l||{};const i={};function s(x,C,y,I){return ne.isPlainObject(x)&&ne.isPlainObject(C)?ne.merge.call({caseless:I},x,C):ne.isPlainObject(C)?ne.merge({},C):ne.isArray(C)?C.slice():C}function u(x,C,y,I){if(ne.isUndefined(C)){if(!ne.isUndefined(x))return s(void 0,x,y,I)}else return s(x,C,y,I)}function f(x,C){if(!ne.isUndefined(C))return s(void 0,C)}function m(x,C){if(ne.isUndefined(C)){if(!ne.isUndefined(x))return s(void 0,x)}else return s(void 0,C)}function p(x,C,y){if(y in l)return s(x,C);if(y in a)return s(void 0,x)}const _={url:f,method:f,data:f,baseURL:m,transformRequest:m,transformResponse:m,paramsSerializer:m,timeout:m,timeoutMessage:m,withCredentials:m,withXSRFToken:m,adapter:m,responseType:m,xsrfCookieName:m,xsrfHeaderName:m,onUploadProgress:m,onDownloadProgress:m,decompress:m,maxContentLength:m,maxBodyLength:m,beforeRedirect:m,transport:m,httpAgent:m,httpsAgent:m,cancelToken:m,socketPath:m,responseEncoding:m,validateStatus:p,headers:(x,C,y)=>u(Vs(x),Vs(C),y,!0)};return ne.forEach(Object.keys({...a,...l}),function(C){const y=_[C]||u,I=y(a[C],l[C],C);ne.isUndefined(I)&&y!==p||(i[C]=I)}),i}const Us=a=>{const l=er({},a);let{data:i,withXSRFToken:s,xsrfHeaderName:u,xsrfCookieName:f,headers:m,auth:p}=l;if(l.headers=m=Qt.from(m),l.url=ks(Fs(l.baseURL,l.url,l.allowAbsoluteUrls),a.params,a.paramsSerializer),p&&m.set("Authorization","Basic "+btoa((p.username||"")+":"+(p.password?unescape(encodeURIComponent(p.password)):""))),ne.isFormData(i)){if(Xt.hasStandardBrowserEnv||Xt.hasStandardBrowserWebWorkerEnv)m.setContentType(void 0);else if(ne.isFunction(i.getHeaders)){const _=i.getHeaders(),x=["content-type","content-length"];Object.entries(_).forEach(([C,y])=>{x.includes(C.toLowerCase())&&m.set(C,y)})}}if(Xt.hasStandardBrowserEnv&&(s&&ne.isFunction(s)&&(s=s(l)),s||s!==!1&&ud(l.url))){const _=u&&f&&fd.read(f);_&&m.set(u,_)}return l},gd=typeof XMLHttpRequest<"u"&&function(a){return new Promise(function(i,s){const u=Us(a);let f=u.data;const m=Qt.from(u.headers).normalize();let{responseType:p,onUploadProgress:_,onDownloadProgress:x}=u,C,y,I,O,T;function D(){O&&O(),T&&T(),u.cancelToken&&u.cancelToken.unsubscribe(C),u.signal&&u.signal.removeEventListener("abort",C)}let k=new XMLHttpRequest;k.open(u.method.toUpperCase(),u.url,!0),k.timeout=u.timeout;function P(){if(!k)return;const v=Qt.from("getAllResponseHeaders"in k&&k.getAllResponseHeaders()),X={data:!p||p==="text"||p==="json"?k.responseText:k.response,status:k.status,statusText:k.statusText,headers:v,config:a,request:k};vs(function(F){i(F),D()},function(F){s(F),D()},X),k=null}"onloadend"in k?k.onloadend=P:k.onreadystatechange=function(){!k||k.readyState!==4||k.status===0&&!(k.responseURL&&k.responseURL.indexOf("file:")===0)||setTimeout(P)},k.onabort=function(){k&&(s(new Le("Request aborted",Le.ECONNABORTED,a,k)),k=null)},k.onerror=function(W){const X=W&&W.message?W.message:"Network Error",Z=new Le(X,Le.ERR_NETWORK,a,k);Z.event=W||null,s(Z),k=null},k.ontimeout=function(){let W=u.timeout?"timeout of "+u.timeout+"ms exceeded":"timeout exceeded";const X=u.transitional||Bs;u.timeoutErrorMessage&&(W=u.timeoutErrorMessage),s(new Le(W,X.clarifyTimeoutError?Le.ETIMEDOUT:Le.ECONNABORTED,a,k)),k=null},f===void 0&&m.setContentType(null),"setRequestHeader"in k&&ne.forEach(m.toJSON(),function(W,X){k.setRequestHeader(X,W)}),ne.isUndefined(u.withCredentials)||(k.withCredentials=!!u.withCredentials),p&&p!=="json"&&(k.responseType=u.responseType),x&&([I,T]=mi(x,!0),k.addEventListener("progress",I)),_&&k.upload&&([y,O]=mi(_),k.upload.addEventListener("progress",y),k.upload.addEventListener("loadend",O)),(u.cancelToken||u.signal)&&(C=v=>{k&&(s(!v||v.type?new xr(null,a,k):v),k.abort(),k=null)},u.cancelToken&&u.cancelToken.subscribe(C),u.signal&&(u.signal.aborted?C():u.signal.addEventListener("abort",C)));const M=ld(u.url);if(M&&Xt.protocols.indexOf(M)===-1){s(new Le("Unsupported protocol "+M+":",Le.ERR_BAD_REQUEST,a));return}k.send(f||null)})},pd=(a,l)=>{const{length:i}=a=a?a.filter(Boolean):[];if(l||i){let s=new AbortController,u;const f=function(x){if(!u){u=!0,p();const C=x instanceof Error?x:this.reason;s.abort(C instanceof Le?C:new xr(C instanceof Error?C.message:C))}};let m=l&&setTimeout(()=>{m=null,f(new Le(`timeout ${l} of ms exceeded`,Le.ETIMEDOUT))},l);const p=()=>{a&&(m&&clearTimeout(m),m=null,a.forEach(x=>{x.unsubscribe?x.unsubscribe(f):x.removeEventListener("abort",f)}),a=null)};a.forEach(x=>x.addEventListener("abort",f));const{signal:_}=s;return _.unsubscribe=()=>ne.asap(p),_}},xd=function*(a,l){let i=a.byteLength;if(i<l){yield a;return}let s=0,u;for(;s<i;)u=s+l,yield a.slice(s,u),s=u},_d=async function*(a,l){for await(const i of wd(a))yield*xd(i,l)},wd=async function*(a){if(a[Symbol.asyncIterator]){yield*a;return}const l=a.getReader();try{for(;;){const{done:i,value:s}=await l.read();if(i)break;yield s}}finally{await l.cancel()}},zs=(a,l,i,s)=>{const u=_d(a,l);let f=0,m,p=_=>{m||(m=!0,s&&s(_))};return new ReadableStream({async pull(_){try{const{done:x,value:C}=await u.next();if(x){p(),_.close();return}let y=C.byteLength;if(i){let I=f+=y;i(I)}_.enqueue(new Uint8Array(C))}catch(x){throw p(x),x}},cancel(_){return p(_),u.return()}},{highWaterMark:2})},Hs=64*1024,{isFunction:gi}=ne,Cd=(({Request:a,Response:l})=>({Request:a,Response:l}))(ne.global),{ReadableStream:Gs,TextEncoder:Ws}=ne.global,Xs=(a,...l)=>{try{return!!a(...l)}catch{return!1}},Ed=a=>{a=ne.merge.call({skipUndefined:!0},Cd,a);const{fetch:l,Request:i,Response:s}=a,u=l?gi(l):typeof fetch=="function",f=gi(i),m=gi(s);if(!u)return!1;const p=u&&gi(Gs),_=u&&(typeof Ws=="function"?(T=>D=>T.encode(D))(new Ws):async T=>new Uint8Array(await new i(T).arrayBuffer())),x=f&&p&&Xs(()=>{let T=!1;const D=new i(Xt.origin,{body:new Gs,method:"POST",get duplex(){return T=!0,"half"}}).headers.has("Content-Type");return T&&!D}),C=m&&p&&Xs(()=>ne.isReadableStream(new s("").body)),y={stream:C&&(T=>T.body)};u&&["text","arrayBuffer","blob","formData","stream"].forEach(T=>{!y[T]&&(y[T]=(D,k)=>{let P=D&&D[T];if(P)return P.call(D);throw new Le(`Response type '${T}' is not supported`,Le.ERR_NOT_SUPPORT,k)})});const I=async T=>{if(T==null)return 0;if(ne.isBlob(T))return T.size;if(ne.isSpecCompliantForm(T))return(await new i(Xt.origin,{method:"POST",body:T}).arrayBuffer()).byteLength;if(ne.isArrayBufferView(T)||ne.isArrayBuffer(T))return T.byteLength;if(ne.isURLSearchParams(T)&&(T=T+""),ne.isString(T))return(await _(T)).byteLength},O=async(T,D)=>{const k=ne.toFiniteNumber(T.getContentLength());return k??I(D)};return async T=>{let{url:D,method:k,data:P,signal:M,cancelToken:v,timeout:W,onDownloadProgress:X,onUploadProgress:Z,responseType:F,headers:L,withCredentials:V="same-origin",fetchOptions:ie}=Us(T),K=l||fetch;F=F?(F+"").toLowerCase():"text";let ee=pd([M,v&&v.toAbortSignal()],W),G=null;const z=ee&&ee.unsubscribe&&(()=>{ee.unsubscribe()});let N;try{if(Z&&x&&k!=="get"&&k!=="head"&&(N=await O(L,P))!==0){let se=new i(D,{method:"POST",body:P,duplex:"half"}),ce;if(ne.isFormData(P)&&(ce=se.headers.get("content-type"))&&L.setContentType(ce),se.body){const[we,Ce]=Ps(N,mi(Ls(Z)));P=zs(se.body,Hs,we,Ce)}}ne.isString(V)||(V=V?"include":"omit");const $=f&&"credentials"in i.prototype,q={...ie,signal:ee,method:k.toUpperCase(),headers:L.normalize().toJSON(),body:P,duplex:"half",credentials:$?V:void 0};G=f&&new i(D,q);let j=await(f?K(G,ie):K(D,q));const te=C&&(F==="stream"||F==="response");if(C&&(X||te&&z)){const se={};["status","statusText","headers"].forEach(Ae=>{se[Ae]=j[Ae]});const ce=ne.toFiniteNumber(j.headers.get("content-length")),[we,Ce]=X&&Ps(ce,mi(Ls(X),!0))||[];j=new s(zs(j.body,Hs,we,()=>{Ce&&Ce(),z&&z()}),se)}F=F||"text";let J=await y[ne.findKey(y,F)||"text"](j,T);return!te&&z&&z(),await new Promise((se,ce)=>{vs(se,ce,{data:J,headers:Qt.from(j.headers),status:j.status,statusText:j.statusText,config:T,request:G})})}catch($){throw z&&z(),$&&$.name==="TypeError"&&/Load failed|fetch/i.test($.message)?Object.assign(new Le("Network Error",Le.ERR_NETWORK,T,G),{cause:$.cause||$}):Le.from($,$&&$.code,T,G)}}},yd=new Map,$s=a=>{let l=a&&a.env||{};const{fetch:i,Request:s,Response:u}=l,f=[s,u,i];let m=f.length,p=m,_,x,C=yd;for(;p--;)_=f[p],x=C.get(_),x===void 0&&C.set(_,x=p?new Map:Ed(l)),C=x;return x};$s();const oo={http:Wc,xhr:gd,fetch:{get:$s}};ne.forEach(oo,(a,l)=>{if(a){try{Object.defineProperty(a,"name",{value:l})}catch{}Object.defineProperty(a,"adapterName",{value:l})}});const js=a=>`- ${a}`,bd=a=>ne.isFunction(a)||a===null||a===!1;function Ad(a,l){a=ne.isArray(a)?a:[a];const{length:i}=a;let s,u;const f={};for(let m=0;m<i;m++){s=a[m];let p;if(u=s,!bd(s)&&(u=oo[(p=String(s)).toLowerCase()],u===void 0))throw new Le(`Unknown adapter '${p}'`);if(u&&(ne.isFunction(u)||(u=u.get(l))))break;f[p||"#"+m]=u}if(!u){const m=Object.entries(f).map(([_,x])=>`adapter ${_} `+(x===!1?"is not supported by the environment":"is not available in the build"));let p=i?m.length>1?`since :
1
+ (function(he,ke){typeof exports=="object"&&typeof module<"u"?ke(exports,require("vue-router"),require("pinia"),require("vue"),require("@vueuse/core"),require("motion-v")):typeof define=="function"&&define.amd?define(["exports","vue-router","pinia","vue","@vueuse/core","motion-v"],ke):(he=typeof globalThis<"u"?globalThis:he||self,ke(he.InnoCloudsLib={},he.VueRouter,he.Pinia,he.Vue,he.VueuseCore,he.motionV))})(this,function(he,ke,_e,r,xt,Ot){"use strict";var Qg=Object.defineProperty;var al=he=>{throw TypeError(he)};var Jg=(he,ke,_e)=>ke in he?Qg(he,ke,{enumerable:!0,configurable:!0,writable:!0,value:_e}):he[ke]=_e;var Be=(he,ke,_e)=>Jg(he,typeof ke!="symbol"?ke+"":ke,_e),ll=(he,ke,_e)=>ke.has(he)||al("Cannot "+_e);var _n=(he,ke,_e)=>(ll(he,ke,"read from private field"),_e?_e.call(he):ke.get(he)),Ui=(he,ke,_e)=>ke.has(he)?al("Cannot add the same private member more than once"):ke instanceof WeakSet?ke.add(he):ke.set(he,_e),Ln=(he,ke,_e,r)=>(ll(he,ke,"write to private field"),r?r.call(he,_e):ke.set(he,_e),_e);var Zo=(he,ke,_e,r)=>({set _(xt){Ln(he,ke,xt,_e)},get _(){return _n(he,ke,r)}});var Qt,Xn,cr;function dl(a,l){for(var i=0;i<l.length;i++){const o=l[i];if(typeof o!="string"&&!Array.isArray(o)){for(const u in o)if(u!=="default"&&!(u in a)){const f=Object.getOwnPropertyDescriptor(o,u);f&&Object.defineProperty(a,u,f.get?f:{enumerable:!0,get:()=>o[u]})}}}return Object.freeze(Object.defineProperty(a,Symbol.toStringTag,{value:"Module"}))}function ul(a){return a}const fl=[];function hl(){return ke.createRouter({history:ke.createWebHistory(),routes:fl})}const zi=(a,l)=>l.some(i=>a instanceof i);let Yo,Ko;function ml(){return Yo||(Yo=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function gl(){return Ko||(Ko=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}const Hi=new WeakMap,Gi=new WeakMap,ni=new WeakMap;function pl(a){const l=new Promise((i,o)=>{const u=()=>{a.removeEventListener("success",f),a.removeEventListener("error",m)},f=()=>{i(Gn(a.result)),u()},m=()=>{o(a.error),u()};a.addEventListener("success",f),a.addEventListener("error",m)});return ni.set(l,a),l}function xl(a){if(Hi.has(a))return;const l=new Promise((i,o)=>{const u=()=>{a.removeEventListener("complete",f),a.removeEventListener("error",m),a.removeEventListener("abort",m)},f=()=>{i(),u()},m=()=>{o(a.error||new DOMException("AbortError","AbortError")),u()};a.addEventListener("complete",f),a.addEventListener("error",m),a.addEventListener("abort",m)});Hi.set(a,l)}let Wi={get(a,l,i){if(a instanceof IDBTransaction){if(l==="done")return Hi.get(a);if(l==="store")return i.objectStoreNames[1]?void 0:i.objectStore(i.objectStoreNames[0])}return Gn(a[l])},set(a,l,i){return a[l]=i,!0},has(a,l){return a instanceof IDBTransaction&&(l==="done"||l==="store")?!0:l in a}};function Qo(a){Wi=a(Wi)}function _l(a){return gl().includes(a)?function(...l){return a.apply(Xi(this),l),Gn(this.request)}:function(...l){return Gn(a.apply(Xi(this),l))}}function wl(a){return typeof a=="function"?_l(a):(a instanceof IDBTransaction&&xl(a),zi(a,ml())?new Proxy(a,Wi):a)}function Gn(a){if(a instanceof IDBRequest)return pl(a);if(Gi.has(a))return Gi.get(a);const l=wl(a);return l!==a&&(Gi.set(a,l),ni.set(l,a)),l}const Xi=a=>ni.get(a);function Cl(a,l,{blocked:i,upgrade:o,blocking:u,terminated:f}={}){const m=indexedDB.open(a,l),p=Gn(m);return o&&m.addEventListener("upgradeneeded",_=>{o(Gn(m.result),_.oldVersion,_.newVersion,Gn(m.transaction),_)}),i&&m.addEventListener("blocked",_=>i(_.oldVersion,_.newVersion,_)),p.then(_=>{f&&_.addEventListener("close",()=>f()),u&&_.addEventListener("versionchange",x=>u(x.oldVersion,x.newVersion,x))}).catch(()=>{}),p}function El(a,{blocked:l}={}){const i=indexedDB.deleteDatabase(a);return l&&i.addEventListener("blocked",o=>l(o.oldVersion,o)),Gn(i).then(()=>{})}const yl=["get","getKey","getAll","getAllKeys","count"],bl=["put","add","delete","clear"],$i=new Map;function Jo(a,l){if(!(a instanceof IDBDatabase&&!(l in a)&&typeof l=="string"))return;if($i.get(l))return $i.get(l);const i=l.replace(/FromIndex$/,""),o=l!==i,u=bl.includes(i);if(!(i in(o?IDBIndex:IDBObjectStore).prototype)||!(u||yl.includes(i)))return;const f=async function(m,...p){const _=this.transaction(m,u?"readwrite":"readonly");let x=_.store;return o&&(x=x.index(p.shift())),(await Promise.all([x[i](...p),u&&_.done]))[0]};return $i.set(l,f),f}Qo(a=>({...a,get:(l,i,o)=>Jo(l,i)||a.get(l,i,o),has:(l,i)=>!!Jo(l,i)||a.has(l,i)}));const Al=["continue","continuePrimaryKey","advance"],es={},ji=new WeakMap,ts=new WeakMap,Sl={get(a,l){if(!Al.includes(l))return a[l];let i=es[l];return i||(i=es[l]=function(...o){ji.set(this,ts.get(this)[l](...o))}),i}};async function*Il(...a){let l=this;if(l instanceof IDBCursor||(l=await l.openCursor(...a)),!l)return;l=l;const i=new Proxy(l,Sl);for(ts.set(i,l),ni.set(i,Xi(l));l;)yield i,l=await(ji.get(i)||l.continue()),ji.delete(i)}function ns(a,l){return l===Symbol.asyncIterator&&zi(a,[IDBIndex,IDBObjectStore,IDBCursor])||l==="iterate"&&zi(a,[IDBIndex,IDBObjectStore])}Qo(a=>({...a,get(l,i,o){return ns(l,i)?Il:a.get(l,i,o)},has(l,i){return ns(l,i)||a.has(l,i)}}));let er;function Nl(){return Cl("data",1,{upgrade(a){a.objectStoreNames.contains("groups")||a.createObjectStore("groups",{keyPath:"id"}),a.objectStoreNames.contains("media")||a.createObjectStore("media",{keyPath:"id"}),a.objectStoreNames.contains("products")||a.createObjectStore("products",{keyPath:"id"})}})}async function tr(){if(er)try{const a=await er;return a.transaction("groups","readonly").commit(),a}catch{er=void 0}return er=Nl(),er}async function qi(a){return(await tr()).transaction("groups","readonly").objectStore("groups").get(a)}async function vr(a,l){const o=(await tr()).transaction("groups","readwrite");await o.objectStore("groups").put({id:a,data:l,timestamp:Date.now()}),await o.done}async function Tl(a,l){const i=JSON.parse(JSON.stringify(r.toRaw(l.value)));await vr(a,i)}async function Zi(a,l){const o=(await tr()).transaction("media","readwrite");await o.objectStore("media").put({id:a,blob:l,timestamp:Date.now()}),await o.done}async function hr(a){const u=await(await tr()).transaction("media","readonly").objectStore("media").get(a);return u==null?void 0:u.blob}async function kl(a){const i=(await tr()).transaction("products","readwrite"),o=i.objectStore("products"),u=a.id;await o.put({id:u,product:a,timestamp:Date.now()}),await i.done}async function rs(a){const u=await(await tr()).transaction("products","readonly").objectStore("products").get(a);return u==null?void 0:u.product}async function Rl(){const a=er;if(er=void 0,a){const l=await a.catch(()=>null);l&&l.close()}try{await El("data",{blocked(){console.warn("Удаление заблокировано. открыты другие вкладки с сайтом.")}})}catch(l){console.error("Не удалось удалить базу: [lib, indexedDB]",l)}}function ri(a){"@babel/helpers - typeof";return ri=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(l){return typeof l}:function(l){return l&&typeof Symbol=="function"&&l.constructor===Symbol&&l!==Symbol.prototype?"symbol":typeof l},ri(a)}var Bl=/^\s+/,Ol=/\s+$/;function Ie(a,l){if(a=a||"",l=l||{},a instanceof Ie)return a;if(!(this instanceof Ie))return new Ie(a,l);var i=Ml(a);this._originalInput=a,this._r=i.r,this._g=i.g,this._b=i.b,this._a=i.a,this._roundA=Math.round(100*this._a)/100,this._format=l.format||i.format,this._gradientType=l.gradientType,this._r<1&&(this._r=Math.round(this._r)),this._g<1&&(this._g=Math.round(this._g)),this._b<1&&(this._b=Math.round(this._b)),this._ok=i.ok}Ie.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var l=this.toRgb();return(l.r*299+l.g*587+l.b*114)/1e3},getLuminance:function(){var l=this.toRgb(),i,o,u,f,m,p;return i=l.r/255,o=l.g/255,u=l.b/255,i<=.03928?f=i/12.92:f=Math.pow((i+.055)/1.055,2.4),o<=.03928?m=o/12.92:m=Math.pow((o+.055)/1.055,2.4),u<=.03928?p=u/12.92:p=Math.pow((u+.055)/1.055,2.4),.2126*f+.7152*m+.0722*p},setAlpha:function(l){return this._a=cs(l),this._roundA=Math.round(100*this._a)/100,this},toHsv:function(){var l=os(this._r,this._g,this._b);return{h:l.h*360,s:l.s,v:l.v,a:this._a}},toHsvString:function(){var l=os(this._r,this._g,this._b),i=Math.round(l.h*360),o=Math.round(l.s*100),u=Math.round(l.v*100);return this._a==1?"hsv("+i+", "+o+"%, "+u+"%)":"hsva("+i+", "+o+"%, "+u+"%, "+this._roundA+")"},toHsl:function(){var l=is(this._r,this._g,this._b);return{h:l.h*360,s:l.s,l:l.l,a:this._a}},toHslString:function(){var l=is(this._r,this._g,this._b),i=Math.round(l.h*360),o=Math.round(l.s*100),u=Math.round(l.l*100);return this._a==1?"hsl("+i+", "+o+"%, "+u+"%)":"hsla("+i+", "+o+"%, "+u+"%, "+this._roundA+")"},toHex:function(l){return ss(this._r,this._g,this._b,l)},toHexString:function(l){return"#"+this.toHex(l)},toHex8:function(l){return Ll(this._r,this._g,this._b,this._a,l)},toHex8String:function(l){return"#"+this.toHex8(l)},toRgb:function(){return{r:Math.round(this._r),g:Math.round(this._g),b:Math.round(this._b),a:this._a}},toRgbString:function(){return this._a==1?"rgb("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+")":"rgba("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:Math.round(_t(this._r,255)*100)+"%",g:Math.round(_t(this._g,255)*100)+"%",b:Math.round(_t(this._b,255)*100)+"%",a:this._a}},toPercentageRgbString:function(){return this._a==1?"rgb("+Math.round(_t(this._r,255)*100)+"%, "+Math.round(_t(this._g,255)*100)+"%, "+Math.round(_t(this._b,255)*100)+"%)":"rgba("+Math.round(_t(this._r,255)*100)+"%, "+Math.round(_t(this._g,255)*100)+"%, "+Math.round(_t(this._b,255)*100)+"%, "+this._roundA+")"},toName:function(){return this._a===0?"transparent":this._a<1?!1:Zl[ss(this._r,this._g,this._b,!0)]||!1},toFilter:function(l){var i="#"+as(this._r,this._g,this._b,this._a),o=i,u=this._gradientType?"GradientType = 1, ":"";if(l){var f=Ie(l);o="#"+as(f._r,f._g,f._b,f._a)}return"progid:DXImageTransform.Microsoft.gradient("+u+"startColorstr="+i+",endColorstr="+o+")"},toString:function(l){var i=!!l;l=l||this._format;var o=!1,u=this._a<1&&this._a>=0,f=!i&&u&&(l==="hex"||l==="hex6"||l==="hex3"||l==="hex4"||l==="hex8"||l==="name");return f?l==="name"&&this._a===0?this.toName():this.toRgbString():(l==="rgb"&&(o=this.toRgbString()),l==="prgb"&&(o=this.toPercentageRgbString()),(l==="hex"||l==="hex6")&&(o=this.toHexString()),l==="hex3"&&(o=this.toHexString(!0)),l==="hex4"&&(o=this.toHex8String(!0)),l==="hex8"&&(o=this.toHex8String()),l==="name"&&(o=this.toName()),l==="hsl"&&(o=this.toHslString()),l==="hsv"&&(o=this.toHsvString()),o||this.toHexString())},clone:function(){return Ie(this.toString())},_applyModification:function(l,i){var o=l.apply(null,[this].concat([].slice.call(i)));return this._r=o._r,this._g=o._g,this._b=o._b,this.setAlpha(o._a),this},lighten:function(){return this._applyModification(zl,arguments)},brighten:function(){return this._applyModification(Hl,arguments)},darken:function(){return this._applyModification(Gl,arguments)},desaturate:function(){return this._applyModification(Fl,arguments)},saturate:function(){return this._applyModification(Vl,arguments)},greyscale:function(){return this._applyModification(Ul,arguments)},spin:function(){return this._applyModification(Wl,arguments)},_applyCombination:function(l,i){return l.apply(null,[this].concat([].slice.call(i)))},analogous:function(){return this._applyCombination(jl,arguments)},complement:function(){return this._applyCombination(Xl,arguments)},monochromatic:function(){return this._applyCombination(ql,arguments)},splitcomplement:function(){return this._applyCombination($l,arguments)},triad:function(){return this._applyCombination(ls,[3])},tetrad:function(){return this._applyCombination(ls,[4])}},Ie.fromRatio=function(a,l){if(ri(a)=="object"){var i={};for(var o in a)a.hasOwnProperty(o)&&(o==="a"?i[o]=a[o]:i[o]=Pr(a[o]));a=i}return Ie(a,l)};function Ml(a){var l={r:0,g:0,b:0},i=1,o=null,u=null,f=null,m=!1,p=!1;return typeof a=="string"&&(a=Jl(a)),ri(a)=="object"&&(Fn(a.r)&&Fn(a.g)&&Fn(a.b)?(l=Dl(a.r,a.g,a.b),m=!0,p=String(a.r).substr(-1)==="%"?"prgb":"rgb"):Fn(a.h)&&Fn(a.s)&&Fn(a.v)?(o=Pr(a.s),u=Pr(a.v),l=Pl(a.h,o,u),m=!0,p="hsv"):Fn(a.h)&&Fn(a.s)&&Fn(a.l)&&(o=Pr(a.s),f=Pr(a.l),l=vl(a.h,o,f),m=!0,p="hsl"),a.hasOwnProperty("a")&&(i=a.a)),i=cs(i),{ok:m,format:a.format||p,r:Math.min(255,Math.max(l.r,0)),g:Math.min(255,Math.max(l.g,0)),b:Math.min(255,Math.max(l.b,0)),a:i}}function Dl(a,l,i){return{r:_t(a,255)*255,g:_t(l,255)*255,b:_t(i,255)*255}}function is(a,l,i){a=_t(a,255),l=_t(l,255),i=_t(i,255);var o=Math.max(a,l,i),u=Math.min(a,l,i),f,m,p=(o+u)/2;if(o==u)f=m=0;else{var _=o-u;switch(m=p>.5?_/(2-o-u):_/(o+u),o){case a:f=(l-i)/_+(l<i?6:0);break;case l:f=(i-a)/_+2;break;case i:f=(a-l)/_+4;break}f/=6}return{h:f,s:m,l:p}}function vl(a,l,i){var o,u,f;a=_t(a,360),l=_t(l,100),i=_t(i,100);function m(x,C,y){return y<0&&(y+=1),y>1&&(y-=1),y<1/6?x+(C-x)*6*y:y<1/2?C:y<2/3?x+(C-x)*(2/3-y)*6:x}if(l===0)o=u=f=i;else{var p=i<.5?i*(1+l):i+l-i*l,_=2*i-p;o=m(_,p,a+1/3),u=m(_,p,a),f=m(_,p,a-1/3)}return{r:o*255,g:u*255,b:f*255}}function os(a,l,i){a=_t(a,255),l=_t(l,255),i=_t(i,255);var o=Math.max(a,l,i),u=Math.min(a,l,i),f,m,p=o,_=o-u;if(m=o===0?0:_/o,o==u)f=0;else{switch(o){case a:f=(l-i)/_+(l<i?6:0);break;case l:f=(i-a)/_+2;break;case i:f=(a-l)/_+4;break}f/=6}return{h:f,s:m,v:p}}function Pl(a,l,i){a=_t(a,360)*6,l=_t(l,100),i=_t(i,100);var o=Math.floor(a),u=a-o,f=i*(1-l),m=i*(1-u*l),p=i*(1-(1-u)*l),_=o%6,x=[i,m,f,f,p,i][_],C=[p,i,i,m,f,f][_],y=[f,f,p,i,i,m][_];return{r:x*255,g:C*255,b:y*255}}function ss(a,l,i,o){var u=[wn(Math.round(a).toString(16)),wn(Math.round(l).toString(16)),wn(Math.round(i).toString(16))];return o&&u[0].charAt(0)==u[0].charAt(1)&&u[1].charAt(0)==u[1].charAt(1)&&u[2].charAt(0)==u[2].charAt(1)?u[0].charAt(0)+u[1].charAt(0)+u[2].charAt(0):u.join("")}function Ll(a,l,i,o,u){var f=[wn(Math.round(a).toString(16)),wn(Math.round(l).toString(16)),wn(Math.round(i).toString(16)),wn(ds(o))];return u&&f[0].charAt(0)==f[0].charAt(1)&&f[1].charAt(0)==f[1].charAt(1)&&f[2].charAt(0)==f[2].charAt(1)&&f[3].charAt(0)==f[3].charAt(1)?f[0].charAt(0)+f[1].charAt(0)+f[2].charAt(0)+f[3].charAt(0):f.join("")}function as(a,l,i,o){var u=[wn(ds(o)),wn(Math.round(a).toString(16)),wn(Math.round(l).toString(16)),wn(Math.round(i).toString(16))];return u.join("")}Ie.equals=function(a,l){return!a||!l?!1:Ie(a).toRgbString()==Ie(l).toRgbString()},Ie.random=function(){return Ie.fromRatio({r:Math.random(),g:Math.random(),b:Math.random()})};function Fl(a,l){l=l===0?0:l||10;var i=Ie(a).toHsl();return i.s-=l/100,i.s=ii(i.s),Ie(i)}function Vl(a,l){l=l===0?0:l||10;var i=Ie(a).toHsl();return i.s+=l/100,i.s=ii(i.s),Ie(i)}function Ul(a){return Ie(a).desaturate(100)}function zl(a,l){l=l===0?0:l||10;var i=Ie(a).toHsl();return i.l+=l/100,i.l=ii(i.l),Ie(i)}function Hl(a,l){l=l===0?0:l||10;var i=Ie(a).toRgb();return i.r=Math.max(0,Math.min(255,i.r-Math.round(255*-(l/100)))),i.g=Math.max(0,Math.min(255,i.g-Math.round(255*-(l/100)))),i.b=Math.max(0,Math.min(255,i.b-Math.round(255*-(l/100)))),Ie(i)}function Gl(a,l){l=l===0?0:l||10;var i=Ie(a).toHsl();return i.l-=l/100,i.l=ii(i.l),Ie(i)}function Wl(a,l){var i=Ie(a).toHsl(),o=(i.h+l)%360;return i.h=o<0?360+o:o,Ie(i)}function Xl(a){var l=Ie(a).toHsl();return l.h=(l.h+180)%360,Ie(l)}function ls(a,l){if(isNaN(l)||l<=0)throw new Error("Argument to polyad must be a positive number");for(var i=Ie(a).toHsl(),o=[Ie(a)],u=360/l,f=1;f<l;f++)o.push(Ie({h:(i.h+f*u)%360,s:i.s,l:i.l}));return o}function $l(a){var l=Ie(a).toHsl(),i=l.h;return[Ie(a),Ie({h:(i+72)%360,s:l.s,l:l.l}),Ie({h:(i+216)%360,s:l.s,l:l.l})]}function jl(a,l,i){l=l||6,i=i||30;var o=Ie(a).toHsl(),u=360/i,f=[Ie(a)];for(o.h=(o.h-(u*l>>1)+720)%360;--l;)o.h=(o.h+u)%360,f.push(Ie(o));return f}function ql(a,l){l=l||6;for(var i=Ie(a).toHsv(),o=i.h,u=i.s,f=i.v,m=[],p=1/l;l--;)m.push(Ie({h:o,s:u,v:f})),f=(f+p)%1;return m}Ie.mix=function(a,l,i){i=i===0?0:i||50;var o=Ie(a).toRgb(),u=Ie(l).toRgb(),f=i/100,m={r:(u.r-o.r)*f+o.r,g:(u.g-o.g)*f+o.g,b:(u.b-o.b)*f+o.b,a:(u.a-o.a)*f+o.a};return Ie(m)},Ie.readability=function(a,l){var i=Ie(a),o=Ie(l);return(Math.max(i.getLuminance(),o.getLuminance())+.05)/(Math.min(i.getLuminance(),o.getLuminance())+.05)},Ie.isReadable=function(a,l,i){var o=Ie.readability(a,l),u,f;switch(f=!1,u=ec(i),u.level+u.size){case"AAsmall":case"AAAlarge":f=o>=4.5;break;case"AAlarge":f=o>=3;break;case"AAAsmall":f=o>=7;break}return f},Ie.mostReadable=function(a,l,i){var o=null,u=0,f,m,p,_;i=i||{},m=i.includeFallbackColors,p=i.level,_=i.size;for(var x=0;x<l.length;x++)f=Ie.readability(a,l[x]),f>u&&(u=f,o=Ie(l[x]));return Ie.isReadable(a,o,{level:p,size:_})||!m?o:(i.includeFallbackColors=!1,Ie.mostReadable(a,["#fff","#000"],i))};var Yi=Ie.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},Zl=Ie.hexNames=Yl(Yi);function Yl(a){var l={};for(var i in a)a.hasOwnProperty(i)&&(l[a[i]]=i);return l}function cs(a){return a=parseFloat(a),(isNaN(a)||a<0||a>1)&&(a=1),a}function _t(a,l){Kl(a)&&(a="100%");var i=Ql(a);return a=Math.min(l,Math.max(0,parseFloat(a))),i&&(a=parseInt(a*l,10)/100),Math.abs(a-l)<1e-6?1:a%l/parseFloat(l)}function ii(a){return Math.min(1,Math.max(0,a))}function on(a){return parseInt(a,16)}function Kl(a){return typeof a=="string"&&a.indexOf(".")!=-1&&parseFloat(a)===1}function Ql(a){return typeof a=="string"&&a.indexOf("%")!=-1}function wn(a){return a.length==1?"0"+a:""+a}function Pr(a){return a<=1&&(a=a*100+"%"),a}function ds(a){return Math.round(parseFloat(a)*255).toString(16)}function us(a){return on(a)/255}var Cn=function(){var a="[-\\+]?\\d+%?",l="[-\\+]?\\d*\\.\\d+%?",i="(?:"+l+")|(?:"+a+")",o="[\\s|\\(]+("+i+")[,|\\s]+("+i+")[,|\\s]+("+i+")\\s*\\)?",u="[\\s|\\(]+("+i+")[,|\\s]+("+i+")[,|\\s]+("+i+")[,|\\s]+("+i+")\\s*\\)?";return{CSS_UNIT:new RegExp(i),rgb:new RegExp("rgb"+o),rgba:new RegExp("rgba"+u),hsl:new RegExp("hsl"+o),hsla:new RegExp("hsla"+u),hsv:new RegExp("hsv"+o),hsva:new RegExp("hsva"+u),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}}();function Fn(a){return!!Cn.CSS_UNIT.exec(a)}function Jl(a){a=a.replace(Bl,"").replace(Ol,"").toLowerCase();var l=!1;if(Yi[a])a=Yi[a],l=!0;else if(a=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var i;return(i=Cn.rgb.exec(a))?{r:i[1],g:i[2],b:i[3]}:(i=Cn.rgba.exec(a))?{r:i[1],g:i[2],b:i[3],a:i[4]}:(i=Cn.hsl.exec(a))?{h:i[1],s:i[2],l:i[3]}:(i=Cn.hsla.exec(a))?{h:i[1],s:i[2],l:i[3],a:i[4]}:(i=Cn.hsv.exec(a))?{h:i[1],s:i[2],v:i[3]}:(i=Cn.hsva.exec(a))?{h:i[1],s:i[2],v:i[3],a:i[4]}:(i=Cn.hex8.exec(a))?{r:on(i[1]),g:on(i[2]),b:on(i[3]),a:us(i[4]),format:l?"name":"hex8"}:(i=Cn.hex6.exec(a))?{r:on(i[1]),g:on(i[2]),b:on(i[3]),format:l?"name":"hex"}:(i=Cn.hex4.exec(a))?{r:on(i[1]+""+i[1]),g:on(i[2]+""+i[2]),b:on(i[3]+""+i[3]),a:us(i[4]+""+i[4]),format:l?"name":"hex8"}:(i=Cn.hex3.exec(a))?{r:on(i[1]+""+i[1]),g:on(i[2]+""+i[2]),b:on(i[3]+""+i[3]),format:l?"name":"hex"}:!1}function ec(a){var l,i;return a=a||{level:"AA",size:"small"},l=(a.level||"AA").toUpperCase(),i=(a.size||"small").toLowerCase(),l!=="AA"&&l!=="AAA"&&(l="AA"),i!=="small"&&i!=="large"&&(i="small"),{level:l,size:i}}const oi=_e.defineStore("imageCache",()=>{const a=r.ref({});let l=!1;function i(_,x){const C=String(_);a.value[C]&&URL.revokeObjectURL(a.value[C]);const y=URL.createObjectURL(x);a.value[C]=y}async function o(_){if(!_){console.warn("initCacheSingle called with null/undefined id");return}const x=String(_);if(a.value[x])return;const C=await hr(x);C&&(await scheduler.yield(),i(x,C),window.dispatchEvent(new CustomEvent("image-cached",{detail:{id:x,blob:C}})))}function u(_){const{id:x,blob:C}=_.detail;x&&C&&i(x,C)}function f(){typeof window>"u"||l||(window.addEventListener("image-cached",u),l=!0)}function m(){typeof window>"u"||!l||(window.removeEventListener("image-cached",u),l=!1)}function p(){Object.values(a.value).forEach(URL.revokeObjectURL),a.value={}}return typeof window<"u"&&f(),{cache:a,initCacheSingle:o,updateCacheFromBlob:i,cleanup:p,setupEventListener:f,removeEventListener:m}}),Ct=_e.defineStore("themeLib",()=>{const a=oi(),{initCacheSingle:l}=a,i=r.ref({id:"",created_at:null,logo:null,primary_color:null,accent_color:null,accent_light_color:null,accent_dark_color:null,bg_button_color:null,bonuses_button_name:void 0,qr_auth_required:!0,qr_bypass_guest_auth:null,qr_show_pay_button_ts:null,kiosk_bypass_guest_auth:null,kiosk_disable_lock_screen:null,kiosk_hide_banner:null,inactive_button_color:null,cards_color:null,text_color:null,nonworking_bg_color:null,retail_mode:null,splash_image_url:null,splash_video:null,splash_duration:0,splash_type:null,fallback_image:null,adult_disclaimer_text:null,adult_disclaimer_image:null,kiosk_enable_wheel:null,kiosk_banner:null,kiosk_preloader:null,organization:"",kiosk_qr_payment_timeout:null,gradientStyle:null,kiosk_inactivity_timeout:null,kiosk_show_loyalty_card_button:null,kiosk_show_loyalty_phone_input_button:null,cart_loyalty_button:{cart_loyalty_button_sticker:null,cart_loyalty_button_text:null},comments:null,show_nutrition_in_cart:null,apply_custom_size_picker_fonts:null,size_picker_unselected_font_size:null,size_picker_selected_font_size:null,hide_discounts_calculate_button:!1,enable_sequential_modifiers:!1,pdf_return_url:null,kiosk_hide_manual_input_loyalty_card:null,kiosk_camera_scan_loyalty_card:null,kiosk_hide_menu_update_notification:null,kiosk_proceed_to_payment_text:null,dish_cart_mod_choice_text:null,qr_show_modifiers_in_cart:null,kiosk_show_modifiers_in_cart:null,use_product_media_in_group_splash:null}),o=async f=>{if(!f)return;i.value={...f};const m=await hr("banner"),p=await hr("preloader"),_=await hr("defaultImage");m||u(f.kiosk_banner,"banner"),p||u(f.kiosk_preloader,"preloader"),_||u(f.fallback_image,"defaultImage"),document.documentElement.style.setProperty("--primaryColor",f.primary_color),document.documentElement.style.setProperty("--accentColor",f.accent_color),document.documentElement.style.setProperty("--accentLightColor",f.accent_light_color),document.documentElement.style.setProperty("--accentDarkColor",f.accent_dark_color),document.documentElement.style.setProperty("--bgButtonColor",f.bg_button_color),document.documentElement.style.setProperty("--inactiveButtonColor",f.inactive_button_color),document.documentElement.style.setProperty("--cardsColor",f.cards_color),document.documentElement.style.setProperty("--textColor",f.text_color),document.documentElement.style.setProperty("--nonworkingBgColor",f.nonworking_bg_color),f.apply_custom_size_picker_fonts&&f.size_picker_unselected_font_size&&f.size_picker_unselected_font_size>0&&document.documentElement.style.setProperty("--sizePickerUnselectedFontSize",`${f.size_picker_unselected_font_size}rem`),f.apply_custom_size_picker_fonts&&f.size_picker_selected_font_size&&f.size_picker_selected_font_size>0&&document.documentElement.style.setProperty("--sizePickerSelectedFontSize",`${f.size_picker_selected_font_size}rem`);const x=i.value.primary_color||"#F2F7FF",C=Ie(x).setAlpha(.7).toRgbString(),y=`linear-gradient(to bottom, transparent 10%, ${C} 50%, ${x} 85%)`,I=`-webkit-linear-gradient(to bottom, transparent 10%, ${C} 50%, ${x} 85%)`;return i.value.gradientStyle={background:y,backgroundColor:I},i.value},u=async(f,m)=>{if(f){const p=await fetch(f);if(!p.ok)throw new Error("Network error");const _=await p.blob();Zi(m,_),l(m)}};return{itemThemes:i,updateColor:o}}),mr=a=>{if(!a)return 0;if((a.price===0||a.price===null)&&a.sizes&&a.sizes.length>0){const l=a.sizes.find(i=>i.is_default===!0);return l?l.price:a.sizes.length>1?a.sizes[1].price??a.sizes[0].price:a.sizes[0].price}return a.price};class Lr extends Error{}Lr.prototype.name="InvalidTokenError";function tc(a){return decodeURIComponent(atob(a).replace(/(.)/g,(l,i)=>{let o=i.charCodeAt(0).toString(16).toUpperCase();return o.length<2&&(o="0"+o),"%"+o}))}function nc(a){let l=a.replace(/-/g,"+").replace(/_/g,"/");switch(l.length%4){case 0:break;case 2:l+="==";break;case 3:l+="=";break;default:throw new Error("base64 string is not of the correct length")}try{return tc(l)}catch{return atob(l)}}function fs(a,l){if(typeof a!="string")throw new Lr("Invalid token specified: must be a string");l||(l={});const i=l.header===!0?0:1,o=a.split(".")[i];if(typeof o!="string")throw new Lr(`Invalid token specified: missing part #${i+1}`);let u;try{u=nc(o)}catch(f){throw new Lr(`Invalid token specified: invalid base64 for part #${i+1} (${f.message})`)}try{return JSON.parse(u)}catch(f){throw new Lr(`Invalid token specified: invalid json for part #${i+1} (${f.message})`)}}const rc=(a,l)=>{if(typeof window<"u"){const i=localStorage.getItem(a);if(i)try{return JSON.parse(i)}catch{return l}return l}return l},ic=(a,l)=>{if(typeof window<"u"){const i=localStorage.getItem(a);if(i)try{return fs(JSON.parse(i))}catch(o){return console.error("Failed to decode JWT:",o),l}}return l},hs=(a,l,i="normal")=>{const o=r.ref(i==="jwt"?ic(a,l):rc(a,l));return r.watchEffect(()=>{o.value===null||o.value===void 0?localStorage.removeItem(a):i!=="jwt"&&localStorage.setItem(a,JSON.stringify(o.value))}),o},gr=a=>{a.forEach(l=>{try{localStorage.removeItem(l)}catch(i){console.error(`Ошибка при удалении ключа "${l}":`,i)}})};class oc{constructor(l,i={}){Be(this,"url");Be(this,"options");Be(this,"ws");Be(this,"reconnectInterval");Be(this,"listeners");Be(this,"isConnected");Be(this,"heartbeat");Be(this,"heartbeatTimeout");Be(this,"pingTimeout");Be(this,"pingResponseTimeout");Be(this,"signal");Be(this,"_shouldReconnect",!0);this.url=l,this.options=i,this.ws=null,this.reconnectInterval=5e3,this.pingResponseTimeout=5e3,this.listeners=new Map,this.isConnected=r.ref(!1),this.heartbeatTimeout=i.heartbeatTimeout||3e5}connect(){var i,o;if(this.ws&&this.ws.readyState===WebSocket.OPEN){console.warn("WebSocket already open");return}if(!this._shouldReconnect){console.warn("Reconnection disabled");return}const l=`${this.url}`;this.ws=new WebSocket(l),(i=this.options.signal)!=null&&i.aborted&&this.close(!0),(o=this.options.signal)==null||o.addEventListener("abort",()=>this.close(!0)),this.ws.onopen=()=>{console.warn("WebSocket connected"),this.isConnected.value=!0,this.emit("open"),this.heartbeat=setInterval(()=>this.sendPing(),this.heartbeatTimeout)},this.ws.onmessage=u=>{try{const f=JSON.parse(u.data);this.emit("message",f),f!=null&&f.type&&f.type!=="ping"&&clearTimeout(this.pingTimeout)}catch(f){console.error("Error parsing WebSocket message:",f)}},this.ws.onerror=u=>{console.error("WebSocket error:",u),this.emit("error",u),this.close(!0)},this.ws.onclose=()=>{this.isConnected.value=!1,console.warn("WebSocket closed"),this.emit("close"),clearInterval(this.heartbeat),clearTimeout(this.pingTimeout),this._shouldReconnect&&(console.log(`Reconnecting in ${this.reconnectInterval}ms...`),setTimeout(()=>this.connect(),this.reconnectInterval))}}sendPing(){var l;this.isConnected.value&&((l=this.ws)==null?void 0:l.readyState)===WebSocket.OPEN?(this.ws.send(JSON.stringify({type:"ping"})),this.pingTimeout=setTimeout(()=>{console.warn("No pong received, reconnecting..."),this.close(!0),this.connect()},this.pingResponseTimeout)):console.warn("WebSocket not connected, cannot send ping")}send(l){var i;this.isConnected.value&&((i=this.ws)==null?void 0:i.readyState)===WebSocket.OPEN?this.ws.send(JSON.stringify(l)):console.warn("WebSocket not connected")}close(l=!1){this.ws&&(this._shouldReconnect=!l,this.ws.close(),clearInterval(this.heartbeat),clearTimeout(this.pingTimeout),this.ws=null,this.listeners.clear())}on(l,i){this.listeners.has(l)||this.listeners.set(l,[]),this.listeners.get(l).push(i)}off(l,i){const o=this.listeners.get(l);o&&this.listeners.set(l,o.filter(u=>u!==i))}emit(l,i=null){const o=this.listeners.get(l);o&&o.forEach(u=>u(i))}getConnectionStatus(){return this.isConnected}}let si=new Map;function Fr(a,l={}){var o;if(si.has(a)){const u=si.get(a);if(u.isConnected.value&&((o=u.ws)==null?void 0:o.readyState)===WebSocket.OPEN)return u.listeners.clear(),u;u.close(!0),si.delete(a)}const i=new oc(a,l);return si.set(a,i),i}const ot=_e.defineStore("mainLib",()=>{const a=r.ref(),l=r.ref(!1),i=r.ref(localStorage.getItem("kiosk_timeout")),o=r.ref(0),u=r.ref(!1),f=r.ref(sessionStorage.getItem("is_adult")==="true"),m=r.ref([]),p=r.ref([]),_=r.ref(!1),x=r.ref(),C=r.ref(""),y=r.ref(0),I=r.ref(!1),B=r.ref(!1),T=r.ref(!0),D=r.ref(),k=r.ref(!localStorage.getItem("apiKey")),P=r.ref(!1),M=r.ref({textNotification:""}),v=r.ref([]),j=r.ref(0);let H=null;const Z=se=>{const oe=`wss://${x.value.area}/ws/device/${se}/`;H=Fr(oe);function ge(){console.log("WebSocket connection opened")}function Ee(ue){if(ue.error)P.value=!0,M.value.textNotification=ue.error,H==null||H.close(!0);else{if(!(ue!=null&&ue.params))return;D.value=ue.params,typeof ue.params.components.shift.is_ok!==null?T.value=ue.params.components.shift.is_ok:T.value=!0}}function Fe(ue){console.error("WebSocket error:",ue),H.close(!0)}H.on("open",ge),H.on("message",Ee),H.on("error",Fe),H.connect()},V=se=>{o.value=se,localStorage.setItem("kiosk_timeout",se)},L=se=>{l.value=se},F=r.ref(null),re=r.computed(()=>m.value.reduce((se,oe)=>{let ge=0,Ee=0;return oe.group_modifiers&&(ge=oe.group_modifiers.reduce((Fe,ue)=>ue.modifiers?Fe+ue.modifiers.reduce((nt,Ae)=>nt+Ae.old_price*Ae.amount,0):0,0)*oe.amount),oe.modifiers&&(Ee=oe.modifiers.reduce((Fe,ue)=>Fe+ue.old_price*ue.amount,0)*oe.amount),se+oe.old_price*oe.amount+ge+Ee},0)),K=r.computed({get:()=>m.value.length===0||F.value===0?0:F.value&&F.value!==0?F.value:m.value.reduce((se,oe)=>{const ge=mr(oe)*oe.amount;let Ee=0,Fe=0;return oe.group_modifiers&&(Ee=oe.group_modifiers.reduce((ue,nt)=>nt.modifiers?ue+nt.modifiers.reduce((Ae,Ke)=>Ae+Ke.price*Ke.amount,0):0,0)*oe.amount),oe.modifiers&&(Fe=oe.modifiers.reduce((ue,nt)=>ue+nt.price*nt.amount,0)*oe.amount),se+ge+Ee+Fe},0),set(se){F.value=se}}),ee=se=>{y.value=se,localStorage.removeItem("bonus"),hs("bonus",y.value)},G=se=>{gr(se)},W=se=>{se={...se,idSystem:crypto.randomUUID()};const oe=X(se);m.value.push(oe),N(),j.value+=1},N=()=>{try{if(!m.value||m.value.length===0){localStorage.removeItem("cart");return}localStorage.setItem("cart",JSON.stringify(r.toRaw(m.value)))}catch(se){console.error("Failed to update cart in localStorage:",se)}},X=se=>r.reactive({...se,amount:se.amount??1,price:se.old_price,new_price:null,total_new_price:null,discounts:[],modifiers:(se.modifiers||[]).map(oe=>r.reactive({...oe,price:oe.old_price,new_price:null,total_new_price:null})),group_modifiers:(se.group_modifiers||[]).map(oe=>r.reactive({...oe,modifiers:(oe.modifiers||[]).map(ge=>r.reactive({...ge,price:ge.old_price,new_price:null,total_new_price:null}))}))}),$=se=>{const oe=m.value.find(ge=>ge.idSystem===se);oe&&(oe.amount+=1),N()},q=se=>{const oe=m.value.find(ge=>ge.idSystem===se);oe&&(oe.amount>=1&&(oe.amount-=1),N())},J=()=>{try{const se=localStorage.getItem("cart");if(se){const oe=JSON.parse(se);m.value.splice(0,m.value.length,...oe.map(X)),F.value=null}}catch(se){console.error("Failed to load cart from localStorage:",se)}};return J(),{cartProducts_lib:m,activeScrolling_lib:p,config_lib:x,totalPrice_lib:K,initialCartPrice_lib:re,is_notification_lib:P,notificationData_lib:M,xApiKey_lib:C,countBonus:y,toggleDrum:l,is_showApiKey:k,openApiKey:I,kiosk_timeout:i,kiosk_FirstTimeout:o,is_OpenLoyal:B,profile:a,is_18_above_content:u,is18Allowed:f,healthState:T,healthData:D,displayCards:v,isOrderTypeSubmited:_,cartBasketBumpKey:j,removeFromLocalStorage:G,setKioskTimeout:V,setBonus:ee,setStateDrum:L,addToCart:W,plusAmount:$,minusAmount:q,loadCart:J,deleteItemFromCart:se=>{if(se){const oe=m.value.findIndex(ge=>ge.idSystem===se);if(oe===-1)return;m.value.splice(oe,1),N(),F.value=null}else m.value=[],N()},updateCartInLocalStorage:N,makeProductFullyReactive:X,checkHeartbeatApp:Z}});function ms(a,l){return function(){return a.apply(l,arguments)}}const{toString:sc}=Object.prototype,{getPrototypeOf:Ki}=Object,{iterator:ai,toStringTag:gs}=Symbol,li=(a=>l=>{const i=sc.call(l);return a[i]||(a[i]=i.slice(8,-1).toLowerCase())})(Object.create(null)),En=a=>(a=a.toLowerCase(),l=>li(l)===a),ci=a=>l=>typeof l===a,{isArray:pr}=Array,xr=ci("undefined");function Vr(a){return a!==null&&!xr(a)&&a.constructor!==null&&!xr(a.constructor)&&Zt(a.constructor.isBuffer)&&a.constructor.isBuffer(a)}const ps=En("ArrayBuffer");function ac(a){let l;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?l=ArrayBuffer.isView(a):l=a&&a.buffer&&ps(a.buffer),l}const lc=ci("string"),Zt=ci("function"),xs=ci("number"),Ur=a=>a!==null&&typeof a=="object",cc=a=>a===!0||a===!1,di=a=>{if(li(a)!=="object")return!1;const l=Ki(a);return(l===null||l===Object.prototype||Object.getPrototypeOf(l)===null)&&!(gs in a)&&!(ai in a)},dc=a=>{if(!Ur(a)||Vr(a))return!1;try{return Object.keys(a).length===0&&Object.getPrototypeOf(a)===Object.prototype}catch{return!1}},uc=En("Date"),fc=En("File"),hc=En("Blob"),mc=En("FileList"),gc=a=>Ur(a)&&Zt(a.pipe),pc=a=>{let l;return a&&(typeof FormData=="function"&&a instanceof FormData||Zt(a.append)&&((l=li(a))==="formdata"||l==="object"&&Zt(a.toString)&&a.toString()==="[object FormData]"))},xc=En("URLSearchParams"),[_c,wc,Cc,Ec]=["ReadableStream","Request","Response","Headers"].map(En),yc=a=>a.trim?a.trim():a.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function zr(a,l,{allOwnKeys:i=!1}={}){if(a===null||typeof a>"u")return;let o,u;if(typeof a!="object"&&(a=[a]),pr(a))for(o=0,u=a.length;o<u;o++)l.call(null,a[o],o,a);else{if(Vr(a))return;const f=i?Object.getOwnPropertyNames(a):Object.keys(a),m=f.length;let p;for(o=0;o<m;o++)p=f[o],l.call(null,a[p],p,a)}}function _s(a,l){if(Vr(a))return null;l=l.toLowerCase();const i=Object.keys(a);let o=i.length,u;for(;o-- >0;)if(u=i[o],l===u.toLowerCase())return u;return null}const nr=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,ws=a=>!xr(a)&&a!==nr;function Qi(){const{caseless:a,skipUndefined:l}=ws(this)&&this||{},i={},o=(u,f)=>{const m=a&&_s(i,f)||f;di(i[m])&&di(u)?i[m]=Qi(i[m],u):di(u)?i[m]=Qi({},u):pr(u)?i[m]=u.slice():(!l||!xr(u))&&(i[m]=u)};for(let u=0,f=arguments.length;u<f;u++)arguments[u]&&zr(arguments[u],o);return i}const bc=(a,l,i,{allOwnKeys:o}={})=>(zr(l,(u,f)=>{i&&Zt(u)?a[f]=ms(u,i):a[f]=u},{allOwnKeys:o}),a),Ac=a=>(a.charCodeAt(0)===65279&&(a=a.slice(1)),a),Sc=(a,l,i,o)=>{a.prototype=Object.create(l.prototype,o),a.prototype.constructor=a,Object.defineProperty(a,"super",{value:l.prototype}),i&&Object.assign(a.prototype,i)},Ic=(a,l,i,o)=>{let u,f,m;const p={};if(l=l||{},a==null)return l;do{for(u=Object.getOwnPropertyNames(a),f=u.length;f-- >0;)m=u[f],(!o||o(m,a,l))&&!p[m]&&(l[m]=a[m],p[m]=!0);a=i!==!1&&Ki(a)}while(a&&(!i||i(a,l))&&a!==Object.prototype);return l},Nc=(a,l,i)=>{a=String(a),(i===void 0||i>a.length)&&(i=a.length),i-=l.length;const o=a.indexOf(l,i);return o!==-1&&o===i},Tc=a=>{if(!a)return null;if(pr(a))return a;let l=a.length;if(!xs(l))return null;const i=new Array(l);for(;l-- >0;)i[l]=a[l];return i},kc=(a=>l=>a&&l instanceof a)(typeof Uint8Array<"u"&&Ki(Uint8Array)),Rc=(a,l)=>{const o=(a&&a[ai]).call(a);let u;for(;(u=o.next())&&!u.done;){const f=u.value;l.call(a,f[0],f[1])}},Bc=(a,l)=>{let i;const o=[];for(;(i=a.exec(l))!==null;)o.push(i);return o},Oc=En("HTMLFormElement"),Mc=a=>a.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(i,o,u){return o.toUpperCase()+u}),Cs=(({hasOwnProperty:a})=>(l,i)=>a.call(l,i))(Object.prototype),Dc=En("RegExp"),Es=(a,l)=>{const i=Object.getOwnPropertyDescriptors(a),o={};zr(i,(u,f)=>{let m;(m=l(u,f,a))!==!1&&(o[f]=m||u)}),Object.defineProperties(a,o)},vc=a=>{Es(a,(l,i)=>{if(Zt(a)&&["arguments","caller","callee"].indexOf(i)!==-1)return!1;const o=a[i];if(Zt(o)){if(l.enumerable=!1,"writable"in l){l.writable=!1;return}l.set||(l.set=()=>{throw Error("Can not rewrite read-only method '"+i+"'")})}})},Pc=(a,l)=>{const i={},o=u=>{u.forEach(f=>{i[f]=!0})};return pr(a)?o(a):o(String(a).split(l)),i},Lc=()=>{},Fc=(a,l)=>a!=null&&Number.isFinite(a=+a)?a:l;function Vc(a){return!!(a&&Zt(a.append)&&a[gs]==="FormData"&&a[ai])}const Uc=a=>{const l=new Array(10),i=(o,u)=>{if(Ur(o)){if(l.indexOf(o)>=0)return;if(Vr(o))return o;if(!("toJSON"in o)){l[u]=o;const f=pr(o)?[]:{};return zr(o,(m,p)=>{const _=i(m,u+1);!xr(_)&&(f[p]=_)}),l[u]=void 0,f}}return o};return i(a,0)},zc=En("AsyncFunction"),Hc=a=>a&&(Ur(a)||Zt(a))&&Zt(a.then)&&Zt(a.catch),ys=((a,l)=>a?setImmediate:l?((i,o)=>(nr.addEventListener("message",({source:u,data:f})=>{u===nr&&f===i&&o.length&&o.shift()()},!1),u=>{o.push(u),nr.postMessage(i,"*")}))(`axios@${Math.random()}`,[]):i=>setTimeout(i))(typeof setImmediate=="function",Zt(nr.postMessage)),Gc=typeof queueMicrotask<"u"?queueMicrotask.bind(nr):typeof process<"u"&&process.nextTick||ys,te={isArray:pr,isArrayBuffer:ps,isBuffer:Vr,isFormData:pc,isArrayBufferView:ac,isString:lc,isNumber:xs,isBoolean:cc,isObject:Ur,isPlainObject:di,isEmptyObject:dc,isReadableStream:_c,isRequest:wc,isResponse:Cc,isHeaders:Ec,isUndefined:xr,isDate:uc,isFile:fc,isBlob:hc,isRegExp:Dc,isFunction:Zt,isStream:gc,isURLSearchParams:xc,isTypedArray:kc,isFileList:mc,forEach:zr,merge:Qi,extend:bc,trim:yc,stripBOM:Ac,inherits:Sc,toFlatObject:Ic,kindOf:li,kindOfTest:En,endsWith:Nc,toArray:Tc,forEachEntry:Rc,matchAll:Bc,isHTMLForm:Oc,hasOwnProperty:Cs,hasOwnProp:Cs,reduceDescriptors:Es,freezeMethods:vc,toObjectSet:Pc,toCamelCase:Mc,noop:Lc,toFiniteNumber:Fc,findKey:_s,global:nr,isContextDefined:ws,isSpecCompliantForm:Vc,toJSONObject:Uc,isAsyncFn:zc,isThenable:Hc,setImmediate:ys,asap:Gc,isIterable:a=>a!=null&&Zt(a[ai])};function Pe(a,l,i,o,u){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=a,this.name="AxiosError",l&&(this.code=l),i&&(this.config=i),o&&(this.request=o),u&&(this.response=u,this.status=u.status?u.status:null)}te.inherits(Pe,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:te.toJSONObject(this.config),code:this.code,status:this.status}}});const bs=Pe.prototype,As={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(a=>{As[a]={value:a}}),Object.defineProperties(Pe,As),Object.defineProperty(bs,"isAxiosError",{value:!0}),Pe.from=(a,l,i,o,u,f)=>{const m=Object.create(bs);te.toFlatObject(a,m,function(C){return C!==Error.prototype},x=>x!=="isAxiosError");const p=a&&a.message?a.message:"Error",_=l==null&&a?a.code:l;return Pe.call(m,p,_,i,o,u),a&&m.cause==null&&Object.defineProperty(m,"cause",{value:a,configurable:!0}),m.name=a&&a.name||"Error",f&&Object.assign(m,f),m};const Wc=null;function Ji(a){return te.isPlainObject(a)||te.isArray(a)}function Ss(a){return te.endsWith(a,"[]")?a.slice(0,-2):a}function Is(a,l,i){return a?a.concat(l).map(function(u,f){return u=Ss(u),!i&&f?"["+u+"]":u}).join(i?".":""):l}function Xc(a){return te.isArray(a)&&!a.some(Ji)}const $c=te.toFlatObject(te,{},null,function(l){return/^is[A-Z]/.test(l)});function ui(a,l,i){if(!te.isObject(a))throw new TypeError("target must be an object");l=l||new FormData,i=te.toFlatObject(i,{metaTokens:!0,dots:!1,indexes:!1},!1,function(D,k){return!te.isUndefined(k[D])});const o=i.metaTokens,u=i.visitor||C,f=i.dots,m=i.indexes,_=(i.Blob||typeof Blob<"u"&&Blob)&&te.isSpecCompliantForm(l);if(!te.isFunction(u))throw new TypeError("visitor must be a function");function x(T){if(T===null)return"";if(te.isDate(T))return T.toISOString();if(te.isBoolean(T))return T.toString();if(!_&&te.isBlob(T))throw new Pe("Blob is not supported. Use a Buffer instead.");return te.isArrayBuffer(T)||te.isTypedArray(T)?_&&typeof Blob=="function"?new Blob([T]):Buffer.from(T):T}function C(T,D,k){let P=T;if(T&&!k&&typeof T=="object"){if(te.endsWith(D,"{}"))D=o?D:D.slice(0,-2),T=JSON.stringify(T);else if(te.isArray(T)&&Xc(T)||(te.isFileList(T)||te.endsWith(D,"[]"))&&(P=te.toArray(T)))return D=Ss(D),P.forEach(function(v,j){!(te.isUndefined(v)||v===null)&&l.append(m===!0?Is([D],j,f):m===null?D:D+"[]",x(v))}),!1}return Ji(T)?!0:(l.append(Is(k,D,f),x(T)),!1)}const y=[],I=Object.assign($c,{defaultVisitor:C,convertValue:x,isVisitable:Ji});function B(T,D){if(!te.isUndefined(T)){if(y.indexOf(T)!==-1)throw Error("Circular reference detected in "+D.join("."));y.push(T),te.forEach(T,function(P,M){(!(te.isUndefined(P)||P===null)&&u.call(l,P,te.isString(M)?M.trim():M,D,I))===!0&&B(P,D?D.concat(M):[M])}),y.pop()}}if(!te.isObject(a))throw new TypeError("data must be an object");return B(a),l}function Ns(a){const l={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(a).replace(/[!'()~]|%20|%00/g,function(o){return l[o]})}function eo(a,l){this._pairs=[],a&&ui(a,this,l)}const Ts=eo.prototype;Ts.append=function(l,i){this._pairs.push([l,i])},Ts.toString=function(l){const i=l?function(o){return l.call(this,o,Ns)}:Ns;return this._pairs.map(function(u){return i(u[0])+"="+i(u[1])},"").join("&")};function jc(a){return encodeURIComponent(a).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function ks(a,l,i){if(!l)return a;const o=i&&i.encode||jc;te.isFunction(i)&&(i={serialize:i});const u=i&&i.serialize;let f;if(u?f=u(l,i):f=te.isURLSearchParams(l)?l.toString():new eo(l,i).toString(o),f){const m=a.indexOf("#");m!==-1&&(a=a.slice(0,m)),a+=(a.indexOf("?")===-1?"?":"&")+f}return a}class Rs{constructor(){this.handlers=[]}use(l,i,o){return this.handlers.push({fulfilled:l,rejected:i,synchronous:o?o.synchronous:!1,runWhen:o?o.runWhen:null}),this.handlers.length-1}eject(l){this.handlers[l]&&(this.handlers[l]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(l){te.forEach(this.handlers,function(o){o!==null&&l(o)})}}const Bs={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},qc={isBrowser:!0,classes:{URLSearchParams:typeof URLSearchParams<"u"?URLSearchParams:eo,FormData:typeof FormData<"u"?FormData:null,Blob:typeof Blob<"u"?Blob:null},protocols:["http","https","file","blob","url","data"]},to=typeof window<"u"&&typeof document<"u",no=typeof navigator=="object"&&navigator||void 0,Zc=to&&(!no||["ReactNative","NativeScript","NS"].indexOf(no.product)<0),Yc=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Kc=to&&window.location.href||"http://localhost",Wt={...Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:to,hasStandardBrowserEnv:Zc,hasStandardBrowserWebWorkerEnv:Yc,navigator:no,origin:Kc},Symbol.toStringTag,{value:"Module"})),...qc};function Qc(a,l){return ui(a,new Wt.classes.URLSearchParams,{visitor:function(i,o,u,f){return Wt.isNode&&te.isBuffer(i)?(this.append(o,i.toString("base64")),!1):f.defaultVisitor.apply(this,arguments)},...l})}function Jc(a){return te.matchAll(/\w+|\[(\w*)]/g,a).map(l=>l[0]==="[]"?"":l[1]||l[0])}function ed(a){const l={},i=Object.keys(a);let o;const u=i.length;let f;for(o=0;o<u;o++)f=i[o],l[f]=a[f];return l}function Os(a){function l(i,o,u,f){let m=i[f++];if(m==="__proto__")return!0;const p=Number.isFinite(+m),_=f>=i.length;return m=!m&&te.isArray(u)?u.length:m,_?(te.hasOwnProp(u,m)?u[m]=[u[m],o]:u[m]=o,!p):((!u[m]||!te.isObject(u[m]))&&(u[m]=[]),l(i,o,u[m],f)&&te.isArray(u[m])&&(u[m]=ed(u[m])),!p)}if(te.isFormData(a)&&te.isFunction(a.entries)){const i={};return te.forEachEntry(a,(o,u)=>{l(Jc(o),u,i,0)}),i}return null}function td(a,l,i){if(te.isString(a))try{return(l||JSON.parse)(a),te.trim(a)}catch(o){if(o.name!=="SyntaxError")throw o}return(i||JSON.stringify)(a)}const Hr={transitional:Bs,adapter:["xhr","http","fetch"],transformRequest:[function(l,i){const o=i.getContentType()||"",u=o.indexOf("application/json")>-1,f=te.isObject(l);if(f&&te.isHTMLForm(l)&&(l=new FormData(l)),te.isFormData(l))return u?JSON.stringify(Os(l)):l;if(te.isArrayBuffer(l)||te.isBuffer(l)||te.isStream(l)||te.isFile(l)||te.isBlob(l)||te.isReadableStream(l))return l;if(te.isArrayBufferView(l))return l.buffer;if(te.isURLSearchParams(l))return i.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),l.toString();let p;if(f){if(o.indexOf("application/x-www-form-urlencoded")>-1)return Qc(l,this.formSerializer).toString();if((p=te.isFileList(l))||o.indexOf("multipart/form-data")>-1){const _=this.env&&this.env.FormData;return ui(p?{"files[]":l}:l,_&&new _,this.formSerializer)}}return f||u?(i.setContentType("application/json",!1),td(l)):l}],transformResponse:[function(l){const i=this.transitional||Hr.transitional,o=i&&i.forcedJSONParsing,u=this.responseType==="json";if(te.isResponse(l)||te.isReadableStream(l))return l;if(l&&te.isString(l)&&(o&&!this.responseType||u)){const m=!(i&&i.silentJSONParsing)&&u;try{return JSON.parse(l,this.parseReviver)}catch(p){if(m)throw p.name==="SyntaxError"?Pe.from(p,Pe.ERR_BAD_RESPONSE,this,null,this.response):p}}return l}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Wt.classes.FormData,Blob:Wt.classes.Blob},validateStatus:function(l){return l>=200&&l<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};te.forEach(["delete","get","head","post","put","patch"],a=>{Hr.headers[a]={}});const nd=te.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),rd=a=>{const l={};let i,o,u;return a&&a.split(`
2
+ `).forEach(function(m){u=m.indexOf(":"),i=m.substring(0,u).trim().toLowerCase(),o=m.substring(u+1).trim(),!(!i||l[i]&&nd[i])&&(i==="set-cookie"?l[i]?l[i].push(o):l[i]=[o]:l[i]=l[i]?l[i]+", "+o:o)}),l},Ms=Symbol("internals");function Gr(a){return a&&String(a).trim().toLowerCase()}function fi(a){return a===!1||a==null?a:te.isArray(a)?a.map(fi):String(a)}function id(a){const l=Object.create(null),i=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let o;for(;o=i.exec(a);)l[o[1]]=o[2];return l}const od=a=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(a.trim());function ro(a,l,i,o,u){if(te.isFunction(o))return o.call(this,l,i);if(u&&(l=i),!!te.isString(l)){if(te.isString(o))return l.indexOf(o)!==-1;if(te.isRegExp(o))return o.test(l)}}function sd(a){return a.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(l,i,o)=>i.toUpperCase()+o)}function ad(a,l){const i=te.toCamelCase(" "+l);["get","set","has"].forEach(o=>{Object.defineProperty(a,o+i,{value:function(u,f,m){return this[o].call(this,l,u,f,m)},configurable:!0})})}let Yt=class{constructor(l){l&&this.set(l)}set(l,i,o){const u=this;function f(p,_,x){const C=Gr(_);if(!C)throw new Error("header name must be a non-empty string");const y=te.findKey(u,C);(!y||u[y]===void 0||x===!0||x===void 0&&u[y]!==!1)&&(u[y||_]=fi(p))}const m=(p,_)=>te.forEach(p,(x,C)=>f(x,C,_));if(te.isPlainObject(l)||l instanceof this.constructor)m(l,i);else if(te.isString(l)&&(l=l.trim())&&!od(l))m(rd(l),i);else if(te.isObject(l)&&te.isIterable(l)){let p={},_,x;for(const C of l){if(!te.isArray(C))throw TypeError("Object iterator must return a key-value pair");p[x=C[0]]=(_=p[x])?te.isArray(_)?[..._,C[1]]:[_,C[1]]:C[1]}m(p,i)}else l!=null&&f(i,l,o);return this}get(l,i){if(l=Gr(l),l){const o=te.findKey(this,l);if(o){const u=this[o];if(!i)return u;if(i===!0)return id(u);if(te.isFunction(i))return i.call(this,u,o);if(te.isRegExp(i))return i.exec(u);throw new TypeError("parser must be boolean|regexp|function")}}}has(l,i){if(l=Gr(l),l){const o=te.findKey(this,l);return!!(o&&this[o]!==void 0&&(!i||ro(this,this[o],o,i)))}return!1}delete(l,i){const o=this;let u=!1;function f(m){if(m=Gr(m),m){const p=te.findKey(o,m);p&&(!i||ro(o,o[p],p,i))&&(delete o[p],u=!0)}}return te.isArray(l)?l.forEach(f):f(l),u}clear(l){const i=Object.keys(this);let o=i.length,u=!1;for(;o--;){const f=i[o];(!l||ro(this,this[f],f,l,!0))&&(delete this[f],u=!0)}return u}normalize(l){const i=this,o={};return te.forEach(this,(u,f)=>{const m=te.findKey(o,f);if(m){i[m]=fi(u),delete i[f];return}const p=l?sd(f):String(f).trim();p!==f&&delete i[f],i[p]=fi(u),o[p]=!0}),this}concat(...l){return this.constructor.concat(this,...l)}toJSON(l){const i=Object.create(null);return te.forEach(this,(o,u)=>{o!=null&&o!==!1&&(i[u]=l&&te.isArray(o)?o.join(", "):o)}),i}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([l,i])=>l+": "+i).join(`
3
+ `)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(l){return l instanceof this?l:new this(l)}static concat(l,...i){const o=new this(l);return i.forEach(u=>o.set(u)),o}static accessor(l){const o=(this[Ms]=this[Ms]={accessors:{}}).accessors,u=this.prototype;function f(m){const p=Gr(m);o[p]||(ad(u,m),o[p]=!0)}return te.isArray(l)?l.forEach(f):f(l),this}};Yt.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),te.reduceDescriptors(Yt.prototype,({value:a},l)=>{let i=l[0].toUpperCase()+l.slice(1);return{get:()=>a,set(o){this[i]=o}}}),te.freezeMethods(Yt);function io(a,l){const i=this||Hr,o=l||i,u=Yt.from(o.headers);let f=o.data;return te.forEach(a,function(p){f=p.call(i,f,u.normalize(),l?l.status:void 0)}),u.normalize(),f}function Ds(a){return!!(a&&a.__CANCEL__)}function _r(a,l,i){Pe.call(this,a??"canceled",Pe.ERR_CANCELED,l,i),this.name="CanceledError"}te.inherits(_r,Pe,{__CANCEL__:!0});function vs(a,l,i){const o=i.config.validateStatus;!i.status||!o||o(i.status)?a(i):l(new Pe("Request failed with status code "+i.status,[Pe.ERR_BAD_REQUEST,Pe.ERR_BAD_RESPONSE][Math.floor(i.status/100)-4],i.config,i.request,i))}function ld(a){const l=/^([-+\w]{1,25})(:?\/\/|:)/.exec(a);return l&&l[1]||""}function cd(a,l){a=a||10;const i=new Array(a),o=new Array(a);let u=0,f=0,m;return l=l!==void 0?l:1e3,function(_){const x=Date.now(),C=o[f];m||(m=x),i[u]=_,o[u]=x;let y=f,I=0;for(;y!==u;)I+=i[y++],y=y%a;if(u=(u+1)%a,u===f&&(f=(f+1)%a),x-m<l)return;const B=C&&x-C;return B?Math.round(I*1e3/B):void 0}}function dd(a,l){let i=0,o=1e3/l,u,f;const m=(x,C=Date.now())=>{i=C,u=null,f&&(clearTimeout(f),f=null),a(...x)};return[(...x)=>{const C=Date.now(),y=C-i;y>=o?m(x,C):(u=x,f||(f=setTimeout(()=>{f=null,m(u)},o-y)))},()=>u&&m(u)]}const hi=(a,l,i=3)=>{let o=0;const u=cd(50,250);return dd(f=>{const m=f.loaded,p=f.lengthComputable?f.total:void 0,_=m-o,x=u(_),C=m<=p;o=m;const y={loaded:m,total:p,progress:p?m/p:void 0,bytes:_,rate:x||void 0,estimated:x&&p&&C?(p-m)/x:void 0,event:f,lengthComputable:p!=null,[l?"download":"upload"]:!0};a(y)},i)},Ps=(a,l)=>{const i=a!=null;return[o=>l[0]({lengthComputable:i,total:a,loaded:o}),l[1]]},Ls=a=>(...l)=>te.asap(()=>a(...l)),ud=Wt.hasStandardBrowserEnv?((a,l)=>i=>(i=new URL(i,Wt.origin),a.protocol===i.protocol&&a.host===i.host&&(l||a.port===i.port)))(new URL(Wt.origin),Wt.navigator&&/(msie|trident)/i.test(Wt.navigator.userAgent)):()=>!0,fd=Wt.hasStandardBrowserEnv?{write(a,l,i,o,u,f,m){if(typeof document>"u")return;const p=[`${a}=${encodeURIComponent(l)}`];te.isNumber(i)&&p.push(`expires=${new Date(i).toUTCString()}`),te.isString(o)&&p.push(`path=${o}`),te.isString(u)&&p.push(`domain=${u}`),f===!0&&p.push("secure"),te.isString(m)&&p.push(`SameSite=${m}`),document.cookie=p.join("; ")},read(a){if(typeof document>"u")return null;const l=document.cookie.match(new RegExp("(?:^|; )"+a+"=([^;]*)"));return l?decodeURIComponent(l[1]):null},remove(a){this.write(a,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function hd(a){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(a)}function md(a,l){return l?a.replace(/\/?\/$/,"")+"/"+l.replace(/^\/+/,""):a}function Fs(a,l,i){let o=!hd(l);return a&&(o||i==!1)?md(a,l):l}const Vs=a=>a instanceof Yt?{...a}:a;function rr(a,l){l=l||{};const i={};function o(x,C,y,I){return te.isPlainObject(x)&&te.isPlainObject(C)?te.merge.call({caseless:I},x,C):te.isPlainObject(C)?te.merge({},C):te.isArray(C)?C.slice():C}function u(x,C,y,I){if(te.isUndefined(C)){if(!te.isUndefined(x))return o(void 0,x,y,I)}else return o(x,C,y,I)}function f(x,C){if(!te.isUndefined(C))return o(void 0,C)}function m(x,C){if(te.isUndefined(C)){if(!te.isUndefined(x))return o(void 0,x)}else return o(void 0,C)}function p(x,C,y){if(y in l)return o(x,C);if(y in a)return o(void 0,x)}const _={url:f,method:f,data:f,baseURL:m,transformRequest:m,transformResponse:m,paramsSerializer:m,timeout:m,timeoutMessage:m,withCredentials:m,withXSRFToken:m,adapter:m,responseType:m,xsrfCookieName:m,xsrfHeaderName:m,onUploadProgress:m,onDownloadProgress:m,decompress:m,maxContentLength:m,maxBodyLength:m,beforeRedirect:m,transport:m,httpAgent:m,httpsAgent:m,cancelToken:m,socketPath:m,responseEncoding:m,validateStatus:p,headers:(x,C,y)=>u(Vs(x),Vs(C),y,!0)};return te.forEach(Object.keys({...a,...l}),function(C){const y=_[C]||u,I=y(a[C],l[C],C);te.isUndefined(I)&&y!==p||(i[C]=I)}),i}const Us=a=>{const l=rr({},a);let{data:i,withXSRFToken:o,xsrfHeaderName:u,xsrfCookieName:f,headers:m,auth:p}=l;if(l.headers=m=Yt.from(m),l.url=ks(Fs(l.baseURL,l.url,l.allowAbsoluteUrls),a.params,a.paramsSerializer),p&&m.set("Authorization","Basic "+btoa((p.username||"")+":"+(p.password?unescape(encodeURIComponent(p.password)):""))),te.isFormData(i)){if(Wt.hasStandardBrowserEnv||Wt.hasStandardBrowserWebWorkerEnv)m.setContentType(void 0);else if(te.isFunction(i.getHeaders)){const _=i.getHeaders(),x=["content-type","content-length"];Object.entries(_).forEach(([C,y])=>{x.includes(C.toLowerCase())&&m.set(C,y)})}}if(Wt.hasStandardBrowserEnv&&(o&&te.isFunction(o)&&(o=o(l)),o||o!==!1&&ud(l.url))){const _=u&&f&&fd.read(f);_&&m.set(u,_)}return l},gd=typeof XMLHttpRequest<"u"&&function(a){return new Promise(function(i,o){const u=Us(a);let f=u.data;const m=Yt.from(u.headers).normalize();let{responseType:p,onUploadProgress:_,onDownloadProgress:x}=u,C,y,I,B,T;function D(){B&&B(),T&&T(),u.cancelToken&&u.cancelToken.unsubscribe(C),u.signal&&u.signal.removeEventListener("abort",C)}let k=new XMLHttpRequest;k.open(u.method.toUpperCase(),u.url,!0),k.timeout=u.timeout;function P(){if(!k)return;const v=Yt.from("getAllResponseHeaders"in k&&k.getAllResponseHeaders()),H={data:!p||p==="text"||p==="json"?k.responseText:k.response,status:k.status,statusText:k.statusText,headers:v,config:a,request:k};vs(function(V){i(V),D()},function(V){o(V),D()},H),k=null}"onloadend"in k?k.onloadend=P:k.onreadystatechange=function(){!k||k.readyState!==4||k.status===0&&!(k.responseURL&&k.responseURL.indexOf("file:")===0)||setTimeout(P)},k.onabort=function(){k&&(o(new Pe("Request aborted",Pe.ECONNABORTED,a,k)),k=null)},k.onerror=function(j){const H=j&&j.message?j.message:"Network Error",Z=new Pe(H,Pe.ERR_NETWORK,a,k);Z.event=j||null,o(Z),k=null},k.ontimeout=function(){let j=u.timeout?"timeout of "+u.timeout+"ms exceeded":"timeout exceeded";const H=u.transitional||Bs;u.timeoutErrorMessage&&(j=u.timeoutErrorMessage),o(new Pe(j,H.clarifyTimeoutError?Pe.ETIMEDOUT:Pe.ECONNABORTED,a,k)),k=null},f===void 0&&m.setContentType(null),"setRequestHeader"in k&&te.forEach(m.toJSON(),function(j,H){k.setRequestHeader(H,j)}),te.isUndefined(u.withCredentials)||(k.withCredentials=!!u.withCredentials),p&&p!=="json"&&(k.responseType=u.responseType),x&&([I,T]=hi(x,!0),k.addEventListener("progress",I)),_&&k.upload&&([y,B]=hi(_),k.upload.addEventListener("progress",y),k.upload.addEventListener("loadend",B)),(u.cancelToken||u.signal)&&(C=v=>{k&&(o(!v||v.type?new _r(null,a,k):v),k.abort(),k=null)},u.cancelToken&&u.cancelToken.subscribe(C),u.signal&&(u.signal.aborted?C():u.signal.addEventListener("abort",C)));const M=ld(u.url);if(M&&Wt.protocols.indexOf(M)===-1){o(new Pe("Unsupported protocol "+M+":",Pe.ERR_BAD_REQUEST,a));return}k.send(f||null)})},pd=(a,l)=>{const{length:i}=a=a?a.filter(Boolean):[];if(l||i){let o=new AbortController,u;const f=function(x){if(!u){u=!0,p();const C=x instanceof Error?x:this.reason;o.abort(C instanceof Pe?C:new _r(C instanceof Error?C.message:C))}};let m=l&&setTimeout(()=>{m=null,f(new Pe(`timeout ${l} of ms exceeded`,Pe.ETIMEDOUT))},l);const p=()=>{a&&(m&&clearTimeout(m),m=null,a.forEach(x=>{x.unsubscribe?x.unsubscribe(f):x.removeEventListener("abort",f)}),a=null)};a.forEach(x=>x.addEventListener("abort",f));const{signal:_}=o;return _.unsubscribe=()=>te.asap(p),_}},xd=function*(a,l){let i=a.byteLength;if(i<l){yield a;return}let o=0,u;for(;o<i;)u=o+l,yield a.slice(o,u),o=u},_d=async function*(a,l){for await(const i of wd(a))yield*xd(i,l)},wd=async function*(a){if(a[Symbol.asyncIterator]){yield*a;return}const l=a.getReader();try{for(;;){const{done:i,value:o}=await l.read();if(i)break;yield o}}finally{await l.cancel()}},zs=(a,l,i,o)=>{const u=_d(a,l);let f=0,m,p=_=>{m||(m=!0,o&&o(_))};return new ReadableStream({async pull(_){try{const{done:x,value:C}=await u.next();if(x){p(),_.close();return}let y=C.byteLength;if(i){let I=f+=y;i(I)}_.enqueue(new Uint8Array(C))}catch(x){throw p(x),x}},cancel(_){return p(_),u.return()}},{highWaterMark:2})},Hs=64*1024,{isFunction:mi}=te,Cd=(({Request:a,Response:l})=>({Request:a,Response:l}))(te.global),{ReadableStream:Gs,TextEncoder:Ws}=te.global,Xs=(a,...l)=>{try{return!!a(...l)}catch{return!1}},Ed=a=>{a=te.merge.call({skipUndefined:!0},Cd,a);const{fetch:l,Request:i,Response:o}=a,u=l?mi(l):typeof fetch=="function",f=mi(i),m=mi(o);if(!u)return!1;const p=u&&mi(Gs),_=u&&(typeof Ws=="function"?(T=>D=>T.encode(D))(new Ws):async T=>new Uint8Array(await new i(T).arrayBuffer())),x=f&&p&&Xs(()=>{let T=!1;const D=new i(Wt.origin,{body:new Gs,method:"POST",get duplex(){return T=!0,"half"}}).headers.has("Content-Type");return T&&!D}),C=m&&p&&Xs(()=>te.isReadableStream(new o("").body)),y={stream:C&&(T=>T.body)};u&&["text","arrayBuffer","blob","formData","stream"].forEach(T=>{!y[T]&&(y[T]=(D,k)=>{let P=D&&D[T];if(P)return P.call(D);throw new Pe(`Response type '${T}' is not supported`,Pe.ERR_NOT_SUPPORT,k)})});const I=async T=>{if(T==null)return 0;if(te.isBlob(T))return T.size;if(te.isSpecCompliantForm(T))return(await new i(Wt.origin,{method:"POST",body:T}).arrayBuffer()).byteLength;if(te.isArrayBufferView(T)||te.isArrayBuffer(T))return T.byteLength;if(te.isURLSearchParams(T)&&(T=T+""),te.isString(T))return(await _(T)).byteLength},B=async(T,D)=>{const k=te.toFiniteNumber(T.getContentLength());return k??I(D)};return async T=>{let{url:D,method:k,data:P,signal:M,cancelToken:v,timeout:j,onDownloadProgress:H,onUploadProgress:Z,responseType:V,headers:L,withCredentials:F="same-origin",fetchOptions:re}=Us(T),K=l||fetch;V=V?(V+"").toLowerCase():"text";let ee=pd([M,v&&v.toAbortSignal()],j),G=null;const W=ee&&ee.unsubscribe&&(()=>{ee.unsubscribe()});let N;try{if(Z&&x&&k!=="get"&&k!=="head"&&(N=await B(L,P))!==0){let se=new i(D,{method:"POST",body:P,duplex:"half"}),oe;if(te.isFormData(P)&&(oe=se.headers.get("content-type"))&&L.setContentType(oe),se.body){const[ge,Ee]=Ps(N,hi(Ls(Z)));P=zs(se.body,Hs,ge,Ee)}}te.isString(F)||(F=F?"include":"omit");const X=f&&"credentials"in i.prototype,$={...re,signal:ee,method:k.toUpperCase(),headers:L.normalize().toJSON(),body:P,duplex:"half",credentials:X?F:void 0};G=f&&new i(D,$);let q=await(f?K(G,re):K(D,$));const J=C&&(V==="stream"||V==="response");if(C&&(H||J&&W)){const se={};["status","statusText","headers"].forEach(Fe=>{se[Fe]=q[Fe]});const oe=te.toFiniteNumber(q.headers.get("content-length")),[ge,Ee]=H&&Ps(oe,hi(Ls(H),!0))||[];q=new o(zs(q.body,Hs,ge,()=>{Ee&&Ee(),W&&W()}),se)}V=V||"text";let le=await y[te.findKey(y,V)||"text"](q,T);return!J&&W&&W(),await new Promise((se,oe)=>{vs(se,oe,{data:le,headers:Yt.from(q.headers),status:q.status,statusText:q.statusText,config:T,request:G})})}catch(X){throw W&&W(),X&&X.name==="TypeError"&&/Load failed|fetch/i.test(X.message)?Object.assign(new Pe("Network Error",Pe.ERR_NETWORK,T,G),{cause:X.cause||X}):Pe.from(X,X&&X.code,T,G)}}},yd=new Map,$s=a=>{let l=a&&a.env||{};const{fetch:i,Request:o,Response:u}=l,f=[o,u,i];let m=f.length,p=m,_,x,C=yd;for(;p--;)_=f[p],x=C.get(_),x===void 0&&C.set(_,x=p?new Map:Ed(l)),C=x;return x};$s();const oo={http:Wc,xhr:gd,fetch:{get:$s}};te.forEach(oo,(a,l)=>{if(a){try{Object.defineProperty(a,"name",{value:l})}catch{}Object.defineProperty(a,"adapterName",{value:l})}});const js=a=>`- ${a}`,bd=a=>te.isFunction(a)||a===null||a===!1;function Ad(a,l){a=te.isArray(a)?a:[a];const{length:i}=a;let o,u;const f={};for(let m=0;m<i;m++){o=a[m];let p;if(u=o,!bd(o)&&(u=oo[(p=String(o)).toLowerCase()],u===void 0))throw new Pe(`Unknown adapter '${p}'`);if(u&&(te.isFunction(u)||(u=u.get(l))))break;f[p||"#"+m]=u}if(!u){const m=Object.entries(f).map(([_,x])=>`adapter ${_} `+(x===!1?"is not supported by the environment":"is not available in the build"));let p=i?m.length>1?`since :
4
4
  `+m.map(js).join(`
5
- `):" "+js(m[0]):"as no adapter specified";throw new Le("There is no suitable adapter to dispatch the request "+p,"ERR_NOT_SUPPORT")}return u}const qs={getAdapter:Ad,adapters:oo};function so(a){if(a.cancelToken&&a.cancelToken.throwIfRequested(),a.signal&&a.signal.aborted)throw new xr(null,a)}function Zs(a){return so(a),a.headers=Qt.from(a.headers),a.data=io.call(a,a.transformRequest),["post","put","patch"].indexOf(a.method)!==-1&&a.headers.setContentType("application/x-www-form-urlencoded",!1),qs.getAdapter(a.adapter||zr.adapter,a)(a).then(function(s){return so(a),s.data=io.call(a,a.transformResponse,s),s.headers=Qt.from(s.headers),s},function(s){return Ds(s)||(so(a),s&&s.response&&(s.response.data=io.call(a,a.transformResponse,s.response),s.response.headers=Qt.from(s.response.headers))),Promise.reject(s)})}const Ys="1.13.2",pi={};["object","boolean","number","function","string","symbol"].forEach((a,l)=>{pi[a]=function(s){return typeof s===a||"a"+(l<1?"n ":" ")+a}});const Ks={};pi.transitional=function(l,i,s){function u(f,m){return"[Axios v"+Ys+"] Transitional option '"+f+"'"+m+(s?". "+s:"")}return(f,m,p)=>{if(l===!1)throw new Le(u(m," has been removed"+(i?" in "+i:"")),Le.ERR_DEPRECATED);return i&&!Ks[m]&&(Ks[m]=!0,console.warn(u(m," has been deprecated since v"+i+" and will be removed in the near future"))),l?l(f,m,p):!0}},pi.spelling=function(l){return(i,s)=>(console.warn(`${s} is likely a misspelling of ${l}`),!0)};function Sd(a,l,i){if(typeof a!="object")throw new Le("options must be an object",Le.ERR_BAD_OPTION_VALUE);const s=Object.keys(a);let u=s.length;for(;u-- >0;){const f=s[u],m=l[f];if(m){const p=a[f],_=p===void 0||m(p,f,a);if(_!==!0)throw new Le("option "+f+" must be "+_,Le.ERR_BAD_OPTION_VALUE);continue}if(i!==!0)throw new Le("Unknown option "+f,Le.ERR_BAD_OPTION)}}const xi={assertOptions:Sd,validators:pi},In=xi.validators;let tr=class{constructor(l){this.defaults=l||{},this.interceptors={request:new Rs,response:new Rs}}async request(l,i){try{return await this._request(l,i)}catch(s){if(s instanceof Error){let u={};Error.captureStackTrace?Error.captureStackTrace(u):u=new Error;const f=u.stack?u.stack.replace(/^.+\n/,""):"";try{s.stack?f&&!String(s.stack).endsWith(f.replace(/^.+\n.+\n/,""))&&(s.stack+=`
6
- `+f):s.stack=f}catch{}}throw s}}_request(l,i){typeof l=="string"?(i=i||{},i.url=l):i=l||{},i=er(this.defaults,i);const{transitional:s,paramsSerializer:u,headers:f}=i;s!==void 0&&xi.assertOptions(s,{silentJSONParsing:In.transitional(In.boolean),forcedJSONParsing:In.transitional(In.boolean),clarifyTimeoutError:In.transitional(In.boolean)},!1),u!=null&&(ne.isFunction(u)?i.paramsSerializer={serialize:u}:xi.assertOptions(u,{encode:In.function,serialize:In.function},!0)),i.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?i.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:i.allowAbsoluteUrls=!0),xi.assertOptions(i,{baseUrl:In.spelling("baseURL"),withXsrfToken:In.spelling("withXSRFToken")},!0),i.method=(i.method||this.defaults.method||"get").toLowerCase();let m=f&&ne.merge(f.common,f[i.method]);f&&ne.forEach(["delete","get","head","post","put","patch","common"],T=>{delete f[T]}),i.headers=Qt.concat(m,f);const p=[];let _=!0;this.interceptors.request.forEach(function(D){typeof D.runWhen=="function"&&D.runWhen(i)===!1||(_=_&&D.synchronous,p.unshift(D.fulfilled,D.rejected))});const x=[];this.interceptors.response.forEach(function(D){x.push(D.fulfilled,D.rejected)});let C,y=0,I;if(!_){const T=[Zs.bind(this),void 0];for(T.unshift(...p),T.push(...x),I=T.length,C=Promise.resolve(i);y<I;)C=C.then(T[y++],T[y++]);return C}I=p.length;let O=i;for(;y<I;){const T=p[y++],D=p[y++];try{O=T(O)}catch(k){D.call(this,k);break}}try{C=Zs.call(this,O)}catch(T){return Promise.reject(T)}for(y=0,I=x.length;y<I;)C=C.then(x[y++],x[y++]);return C}getUri(l){l=er(this.defaults,l);const i=Fs(l.baseURL,l.url,l.allowAbsoluteUrls);return ks(i,l.params,l.paramsSerializer)}};ne.forEach(["delete","get","head","options"],function(l){tr.prototype[l]=function(i,s){return this.request(er(s||{},{method:l,url:i,data:(s||{}).data}))}}),ne.forEach(["post","put","patch"],function(l){function i(s){return function(f,m,p){return this.request(er(p||{},{method:l,headers:s?{"Content-Type":"multipart/form-data"}:{},url:f,data:m}))}}tr.prototype[l]=i(),tr.prototype[l+"Form"]=i(!0)});let Id=class cl{constructor(l){if(typeof l!="function")throw new TypeError("executor must be a function.");let i;this.promise=new Promise(function(f){i=f});const s=this;this.promise.then(u=>{if(!s._listeners)return;let f=s._listeners.length;for(;f-- >0;)s._listeners[f](u);s._listeners=null}),this.promise.then=u=>{let f;const m=new Promise(p=>{s.subscribe(p),f=p}).then(u);return m.cancel=function(){s.unsubscribe(f)},m},l(function(f,m,p){s.reason||(s.reason=new xr(f,m,p),i(s.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(l){if(this.reason){l(this.reason);return}this._listeners?this._listeners.push(l):this._listeners=[l]}unsubscribe(l){if(!this._listeners)return;const i=this._listeners.indexOf(l);i!==-1&&this._listeners.splice(i,1)}toAbortSignal(){const l=new AbortController,i=s=>{l.abort(s)};return this.subscribe(i),l.signal.unsubscribe=()=>this.unsubscribe(i),l.signal}static source(){let l;return{token:new cl(function(u){l=u}),cancel:l}}};function Nd(a){return function(i){return a.apply(null,i)}}function Td(a){return ne.isObject(a)&&a.isAxiosError===!0}const ao={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(ao).forEach(([a,l])=>{ao[l]=a});function Qs(a){const l=new tr(a),i=ms(tr.prototype.request,l);return ne.extend(i,tr.prototype,l,{allOwnKeys:!0}),ne.extend(i,l,null,{allOwnKeys:!0}),i.create=function(u){return Qs(er(a,u))},i}const Ze=Qs(zr);Ze.Axios=tr,Ze.CanceledError=xr,Ze.CancelToken=Id,Ze.isCancel=Ds,Ze.VERSION=Ys,Ze.toFormData=fi,Ze.AxiosError=Le,Ze.Cancel=Ze.CanceledError,Ze.all=function(l){return Promise.all(l)},Ze.spread=Nd,Ze.isAxiosError=Td,Ze.mergeConfig=er,Ze.AxiosHeaders=Qt,Ze.formToJSON=a=>Os(ne.isHTMLForm(a)?new FormData(a):a),Ze.getAdapter=qs.getAdapter,Ze.HttpStatusCode=ao,Ze.default=Ze;const{Axios:np,AxiosError:rp,CanceledError:ip,isCancel:op,CancelToken:sp,VERSION:ap,all:lp,Cancel:cp,isAxiosError:dp,spread:up,toFormData:fp,AxiosHeaders:hp,HttpStatusCode:mp,formToJSON:gp,getAdapter:pp,mergeConfig:xp}=Ze,Gr=xe.defineStore("modulesLib",()=>{const a=r.ref(!1),l=r.ref({textNotification:""});return{is_notification_lib:a,notificationData_lib:l,showNotification:s=>{a.value=!0,l.value.textNotification=s}}}),kd=["ping","pong"],Rd=["confirmed","waiting_payment","partial_paid"],Bd=["cancelled"],Fn=xe.defineStore("table-data",()=>{const a=ke.useRoute(),l=ke.useRouter(),i=st(),s=Gr(),u=r.ref(1),f=r.ref(1),m=wt.useLocalStorage("appMode",null,{shallow:!0}),p=wt.useLocalStorage("tableData",null,{shallow:!0,serializer:wt.StorageSerializers.object}),_=wt.useLocalStorage("tableId",null),x=wt.useLocalStorage("orgID",null),C=r.computed({get:()=>{var L;return(L=k.value)==null?void 0:L.id},set:L=>{_.value=L}}),y=r.computed(()=>{var L;return(L=a.query.table_id)==null?void 0:L.toString()}),I=r.computed(()=>{var L;return x.value||((L=a.params.orgId)==null?void 0:L.toString())}),O=r.computed(()=>{var L;return((L=k.value)==null?void 0:L.branch.work_mode)==="table-service"}),T=r.computed(()=>{var L;return O.value&&!!((L=k.value)!=null&&L.order)});let D=null;const k=wt.computedAsync(async L=>{var K,ee,G;u.value;const V=new AbortController;if(L(()=>V.abort()),!I.value||!((K=i.config_lib)!=null&&K.area))return null;const ie=y.value||_.value;if(!ie)return null;try{return{...(await Ze.get(`/org_unit/${I.value}/table/${ie}/`,{baseURL:`https://${i.config_lib.area}/api/`,signal:V.signal})).data,__v:u.value}}catch(z){return Ze.isCancel(z)?null:m.value==="table-tent"?p.value:ie===(D==null?void 0:D.id)?D:(D=null,s.showNotification(((G=(ee=z==null?void 0:z.response)==null?void 0:ee.data)==null?void 0:G.user_friendly_message)||"Ошибка при загрузке данных стола"),null)}},null),P=wt.computedAsync(async L=>{var ie;f.value;const V=new AbortController;if(L(()=>V.abort()),!O.value||!((ie=k.value)!=null&&ie.order))return null;try{const K=await Ze.get(`/order/${k.value.order}/`,{baseURL:`https://${i.config_lib.area}/api/`,signal:V.signal});return K.data.items=K.data.items.map(ee=>({...ee,idSystem:crypto.randomUUID()})),{...K.data,__v:f.value}}catch{return null}},null);let M=null;const v=L=>{M&&(M==null||M.close(),M=null),L&&(M=Lr(`wss://${i.config_lib.area}/ws/order/${L.id}/`),M.on("message",V=>{kd.includes(V==null?void 0:V.type)||((V==null?void 0:V.method)==="update_order_status"&&Bd.includes(V.params.status)&&s.showNotification("Ваш заказ был отменён"),X())}),M.connect())},W=()=>{u.value++},X=()=>{f.value++},Z=L=>{L&&(D=L,m.value==="table-tent"&&(p.value=L),_.value!==L.id&&(_.value=L.id))},F=(L,V)=>{var ie,K;if((L==null?void 0:L.id)!==(V==null?void 0:V.id)&&v(L),L&&!Rd.includes(L.status)&&W(),!L&&V&&((ie=V.table)==null?void 0:ie.id)===((K=k.value)==null?void 0:K.id))return l.replace({name:"order-ts-status",params:{id:V.id}})};return r.watch(P,F,{immediate:!0}),r.watch(k,Z,{immediate:!0}),{id:C,isTableService:O,hasOrder:T,data:k,order:P,refresh:W,refreshOrder:X}});let Nn=null,jt=null;function nr(a){a&&a.close(!0)}async function lo(a,l){const i=Mt(),s=st(),u=yn.create();try{const f=await u.initPaymentLink(a,l);return i.paymentCostQR=s.totalPrice_lib-s.countBonus,i.linkQR=f.url,jt==null||jt.deleteCart(null,jt==null?void 0:jt.is_requestKiosk),f}catch(f){throw i.isButtonDisabled=!1,i.showNotification(f==null?void 0:f.response.data.user_friendly_message),f}}function Od(a,l,i){const s=St();if(a!=null&&a.params){if(a.params.status==="sent"&&s.itemThemes.kiosk_proceed_to_payment_text&&l.showNotification(s.itemThemes.kiosk_proceed_to_payment_text),a.error){l.showNotification(a.error),hn(l,null),uo(l);return}i(a,l)}}function co(a,l){const i=Mt(),s=st();return a.params.new_discounts&&(i.extraDiscount=Number(a.params.new_total_cost)-l.initialCartPrice,s.totalPrice_lib=Number(a.params.new_total_cost),l.showNotification("К заказу были добавлены скидки")),!0}const hn=(a,l)=>{a.updateOrderStatus&&a.updateOrderStatus(l)},Md=a=>{a.loadCart&&a.loadCart()},_i=a=>{a.resetBonuses&&a.resetBonuses()},Dd=a=>{a.resetDiscounts&&a.resetDiscounts()},uo=a=>{a.closeWebSocket&&a.closeWebSocket()},Js=(a,l,i,s)=>{var m;if(((m=a.params)==null?void 0:m.need_pay)===!1)return;const u=l.ws||i;yn.create().orderPay(a.params.order_id||"").then(p=>{l.setOrderNumber&&l.setOrderNumber(p.data.order_number)}).catch(p=>{(l.errorHandler||s).handleOrderPayError(p,{...l,closeWebSocket:()=>nr(u)})})},fo=(a,l,i)=>{const s=a.ws||l;(a.errorHandler||i).handleOrderError({...a,closeWebSocket:()=>nr(s)})},vd=(a,l)=>{const i=Mt(),s=i.getCurrentPaymentMethodId();if(!s||!Vn.getConfig(s)||!Vn.isMethodAvailable(s,a))return null;const f=Vn.createHandler(s);if(!f)return null;const m=i.createPaymentHandler(a,l,s);return m?{handler:f,config:m.config}:null},Pd=a=>{if(!jt)return;const l=jt.context,i=jt.is_requestKiosk,s=vd(l,i);if(!s){console.warn("handleWebSocketMessageWithDynamicHandler: не удалось получить handler");return}const{handler:u,config:f}=s,m={...f,...jt};Od(a,m,u.handleWebSocketStatus)};async function Ld(a,l,i){var x,C;const s=Fn(),{is_requestKiosk:u}=l,{comment:f,is_authorized:m,signal:p}=i;l.setButtonDisabled(!0);const _=yn.create();try{const y=await _.createOrder(a,s.id,u,f,m,p);if((y==null?void 0:y.status)===201&&((x=y==null?void 0:y.data)!=null&&x.id)){const I=y.data.id,O={...l,signal:p};jt=O;const D=`wss://${O.area||""}/ws/order/${I}/`;Nn=Lr(D,{signal:p});const k=()=>{console.warn("WebSocket connection opened (centralized mode)")},P=v=>{var W;console.error("WebSocket error (centralized mode):",v),nr(Nn),Nn=null,jt=null,l.setButtonDisabled(!1),(W=l.errorHandler)==null||W.handlePaymentError(v,O)},M=v=>{Pd(v)};Nn.on("open",k),Nn.on("message",M),Nn.on("error",P),Nn.connect(),jt.ws=Nn,jt.closeWebSocket=()=>{nr(Nn),Nn=null,jt=null}}return y}catch(y){throw Ze.isCancel(y)||((C=l.errorHandler)==null||C.handleCreateOrderError(y,l),l.setButtonDisabled(!1)),y}}const ea=a=>{var l,i;return((i=(l=a==null?void 0:a.response)==null?void 0:l.data)==null?void 0:i.user_friendly_message)||null};function wi(){const a=Mt(),l=Fn();return{handlePaymentError(i,s){var f,m,p,_,x,C;const u=ea(i);hn(s,null),Md(s),u?(s.showNotification(u),uo(s),s.is_requestKiosk&&((m=s.orderErrors)!=null&&m.includes((f=i.response)==null?void 0:f.status))&&(s.cartCleanup?s.cartCleanup.cleanupAndNavigate("retryPage",s.is_requestKiosk):s.deleteCart("retryPage",s.is_requestKiosk),s.ws.close(!0)),l.isTableService?s.resetStores():(_i(s),s.context==="qr"&&s.navigation?s.navigation.redirectToError():s.context==="qr"&&s.redirect&&(a.isButtonDisabled=!1,s.redirect(`/${((_=(p=s.route)==null?void 0:p.params)==null?void 0:_.orgId)||""}/errorPayment`)))):s.context==="qr"&&(_i(s),s.navigation?s.navigation.redirectToError():s.redirect&&s.redirect(`/${((C=(x=s.route)==null?void 0:x.params)==null?void 0:C.orgId)||""}/errorPayment`)),a.isButtonDisabled=!1},handleOrderPayError(i,s){var f,m,p,_;const u=ea(i);u&&(s.showNotification(u),uo(s),s.is_requestKiosk?((m=s.orderErrors)!=null&&m.includes((f=i.response)==null?void 0:f.status)&&(s.cartCleanup.cleanupAndNavigate("retryPage",s.is_requestKiosk),s.deleteCart("retryPage",s.is_requestKiosk)),hn(s,null)):(_i(s),s.navigation?s.navigation.redirectToError():s.redirect&&s.redirect(`/${((_=(p=s.route)==null?void 0:p.params)==null?void 0:_.orgId)||""}/errorPayment`),hn(s,null)))},handleOrderError(i){var s,u;i.is_requestKiosk?(i.cartCleanup?i.cartCleanup.cleanupAndNavigate("retryPage",i.is_requestKiosk):i.deleteCart("retryPage",i.is_requestKiosk),i.ws.close(!0)):l.isTableService?(a.isCreateButtonVisible=!0,i.showNotification("Ошибка создания заказа. Пожалуйста, попробуйте еще раз"),Dd(i)):(_i(i),i.navigation?i.navigation.redirectToError():i.redirect&&(a.isButtonDisabled=!1,i.redirect(`/${((u=(s=i.route)==null?void 0:s.params)==null?void 0:u.orgId)||""}/errorPayment`)))},handleCreateOrderError(i,s){var m,p,_,x,C,y;const{is_requestKiosk:u}=s,f=s.route.params.orgId;u?(((m=i==null?void 0:i.response)==null?void 0:m.status)===403&&((p=s.on403Kiosk)==null||p.call(s),(_=s.redirect)==null||_.call(s,`/${f}/retryPage`)),s.deleteCart("retryPage",u)):l.isTableService?s.showNotification(((C=(x=i==null?void 0:i.response)==null?void 0:x.data)==null?void 0:C.user_friendly_message)||"Ошибка создания заказа"):(y=s.redirect)==null||y.call(s,`/${f}/errorPayment`)}}}const Fd=()=>{const a=Mt();let l=null;const i=wi(),s=(u,f)=>{var p,_,x,C;const m=(p=u.params)==null?void 0:p.status;if((_=u.params)!=null&&_.number&&(a.orderNumber=(x=u.params)==null?void 0:x.number),m==="sent")co(u,f),a.isButtonDisabled=!1;else if(m==="waiting_for_fiscalization")hn(f,1);else if(m==="payment_initiation_retry"||m==="fiscalized")Js(u,f,l,i);else if(m==="payment_initiation")hn(f,2);else if(m==="paid"){hn(f,3);const y=f.ws||l;nr(y),localStorage.removeItem("cart")}else(C=f.orderErrors)!=null&&C.includes(m)&&fo(f,l,i)};return{handleWebSocketStatus(u,f){s(u,f)}}};function Vd(){const a=Mt();let l=null;const i=wi(),s=(u,f)=>{var p,_,x,C;const m=(p=u.params)==null?void 0:p.status;if((_=u.params)!=null&&_.number&&(a.orderNumber=(x=u.params)==null?void 0:x.number),m==="sent")co(u,f),a.isButtonDisabled=!1;else if(m==="sent_fiscalization")hn(f,1);else if(m==="waiting_payment")hn(f,4);else if(m==="paid"){hn(f,3);const y=f.ws||l;nr(y),localStorage.removeItem("cart")}else(C=f.orderErrors)!=null&&C.includes(m)&&(a.isButtonDisabled=!1,fo(f,l,i))};return{handleWebSocketStatus(u,f){s(u,f)}}}const Ud=()=>{const a=Mt();let l=null;const i=wi(),s=(u,f)=>{var p,_;const m=(p=u.params)==null?void 0:p.status;if(m==="sent")co(u,f),a.isButtonDisabled=!1;else if(m==="payment_initiation_retry"||m==="fiscalized")Js(u,f,l,i);else if(m==="payment_initiation")hn(f,2);else if(m==="paid"){hn(f,3);const x=f.ws||l;nr(x),localStorage.removeItem("cart")}else(_=f.orderErrors)!=null&&_.includes(m)&&(a.isButtonDisabled=!1,fo(f,l,i))};return{handleWebSocketStatus(u,f){s(u,f)}}};class Vn{static initialize(){this.register({id:"TERMINAL_BASE",method:"TERMINAL",handlerFactory:Fd,availableContexts:["kiosk"]}),this.register({id:"YOOKASSA_BASE",method:"YOOKASSA",handlerFactory:Ud,availableContexts:["qr","tableservice"]}),this.register({id:"SBP",method:"YOOKASSA",handlerFactory:Vd,availableContexts:["kiosk"]})}static register(l){this.methods.set(l.id,l)}static getConfig(l){return this.methods.get(l)??null}static getAvailableMethods(l){return Array.from(this.methods.entries()).filter(([i,s])=>s.availableContexts.includes(l)).map(([i])=>i)}static isMethodAvailable(l,i){const s=this.getConfig(l);return s?s.availableContexts.includes(i):!1}static createHandler(l){const i=this.getConfig(l);return i?i.handlerFactory():(console.warn(`PaymentMethodRegistry: метод оплаты ${l} не зарегистрирован`),null)}}Be(Vn,"methods",new Map),Vn.initialize();function zd(a){return{cleanupAndNavigate(l,i){a.deleteCart(l,i)},cleanup(l){a.deleteCart(null,l)},clearTokens(){a.deleteCart(null,!0)},resetStores(){a.resetStores()}}}function Hd(a){var i,s;const l=((s=(i=a.route)==null?void 0:i.params)==null?void 0:s.orgId)||"";return{redirectToError(){const u=`/${l}/errorPayment`;a.redirect?a.redirect(u):a.router&&a.router.push(u)},redirectToSuccess(u){const f=u?`/${l}/${u}`:`/${l}/profile`;a.redirect?a.redirect(f):a.router&&a.router.push(f)},redirect(u){a.redirect?a.redirect(u):a.router&&a.router.push(u)},getErrorPath(){return`/${l}/errorPayment`},getSuccessPath(){return`/${l}/profile`}}}const Mt=xe.defineStore("cartLib",()=>{const a=ke.useRouter(),l=ke.useRoute(),i=St(),s=st(),{config_lib:u,countBonus:f,totalPrice_lib:m,initialCartPrice_lib:p,is18Allowed:_}=xe.storeToRefs(s),{itemThemes:x}=xe.storeToRefs(i),C=r.ref(!1),y=r.ref(""),I=r.ref(null),O=r.ref("wait"),T=r.ref(!0),D=r.ref(0),k=r.ref(""),P=r.ref([]),M=r.ref([]),v=r.ref(),W=r.ref(0),X=r.ref(!1),Z=r.ref(),F=r.ref(null),L=r.ref(["failed_payment","failed_after_paid","failed","failed_after_sent","failed_after_sent_fiscalization","payment_initiation_retry","cancelled","failed_after_payment_initiation"]),V=r.ref(),ie=r.computed({get:()=>P.value||[],set:be=>{(be==null?void 0:be.length)===1&&(V.value=be[0]),P.value=be}}),K=r.ref(!1),ee=r.ref(null),G=r.ref(0),z=r.ref(!1),N=r.ref({textNotification:""}),$=be=>{z.value=!0,N.value.textNotification=be},q=()=>{var be,et;return(be=v.value)!=null&&be.front_type?v.value.front_type:((et=M.value[0])==null?void 0:et.front_type)||null},j=(be,et,rt)=>{var Ne;const Ve=rt??((Ne=M.value[0])==null?void 0:Ne.front_type);if(!Ve)return console.warn("Не удалось определить метод оплаты"),null;const it=Vn.getConfig(Ve);if(!it||!Vn.isMethodAvailable(Ve,be))return console.warn(`Метод ${Ve} недоступен для контекста ${be}`),null;const De=Vn.createHandler(Ve);return De?(Z.value=te(it.method,be,et),{handler:De,config:Z.value}):(console.warn(`Не удалось создать обработчик для метода ${Ve}`),null)},te=(be,et,rt)=>{const Ve={method:be,context:et,is_requestKiosk:rt,router:a,route:l,orderErrors:L.value,area:u.value.area,totalPrice:m,initialCartPrice:p,showNotification:$,deleteCart:ht,resetStores:ge,redirect:Ue=>a.push(Ue),updateOrderStatus:Ue=>{ee.value=Ue},setOrderNumber:Ue=>{F.value=Ue},loadCart:()=>s.loadCart(),resetBonuses:()=>{f.value=0}},it=wi(),De=zd(Ve),Ne=Hd(Ve);return{...Ve,errorHandler:it,cartCleanup:De,navigation:Ne}},J=r.computed(()=>!!I.value),se=be=>{O.value=be},ce=be=>{I.value=be},we=()=>{x.value.kiosk_show_loyalty_card_button&&x.value.kiosk_show_loyalty_phone_input_button?C.value=!0:!x.value.kiosk_show_loyalty_card_button&&x.value.kiosk_show_loyalty_phone_input_button?s.is_OpenLoyal=!0:C.value=!0,O.value="wait",y.value=""},Ce=()=>{C.value=!1,O.value="wait",y.value=""},Ae=()=>{I.value=null,y.value="",O.value="wait",Ce()},ge=()=>{K.value=!1,ee.value=null},ht=(be=null,et=!1)=>{s.cartProducts_lib=[],s.is_OpenLoyal=!1,mr(["cart"]),et&&(mr(["authTokensAccess","authTokensRefresh","user"]),s.profile=null,sessionStorage.removeItem("is_adult"),_.value=!1),be&&a.push(`/${l.params.orgId}/${be}`)};return{isButtonDisabled:K,orderCompleted_lib:ee,extraDiscount:D,orderNumber:F,is_notification_lib:z,notificationData_lib:N,count:G,guestInfo:I,error:y,isDrawerOpen:C,currentState:O,isAuthorized:J,isCreateButtonVisible:T,linkQR:k,orderTypes:ie,providerTypes:M,is_paymentCart:X,selectedOrderType:V,selectedProvider:v,configPayment:Z,paymentCostQR:W,deleteCart:ht,setGuestInfo:ce,setState:se,openDrawer:we,closeDrawer:Ce,clearCard:Ae,showNotification:$,createPaymentHandler:j,getCurrentPaymentMethodId:q,getAvailablePaymentMethods:be=>Vn.getAvailableMethods(be)}}),Lt=xe.defineStore("cardLib",()=>{var ee;const a=()=>({openCard:null,currentModifier:null,groupModifiers:[],groupModifiersSelected:[],groupCurrentOpen:null,isModifiedAmount:!1,selectedSize:{},productSizes:[],addedProducts:[],plusButtonsRefs:[],modalCount:1,isSectionModifier:!1,isAnimationFly:!0,textErrorRequaired:"",prevLast:{}}),l=St(),i=r.ref(a()),s=()=>i.value=a(),u=r.ref(!1),f=r.ref(!1),m=r.ref(!1),p=r.ref(),_=r.ref([]),x=r.ref({id:null,visible:!1}),C=r.ref(!((ee=l.itemThemes)!=null&&ee.kiosk_disable_lock_screen)),y=r.computed(()=>{const G=i.value.groupModifiersSelected.findIndex(z=>z.group===i.value.groupCurrentOpen.id);return I(G)}),I=G=>G===-1?0:(i.value.groupModifiersSelected[G].modifiers||[]).reduce((N,$)=>N+($.amount||0),0),O=r.computed(()=>{var z;const G=(z=i.value.openCard)==null?void 0:z.group_modifiers.findIndex(N=>N.id===i.value.groupCurrentOpen.id);return G===-1||!i.value.openCard?0:i.value.openCard.modifiers.length>0&&G===0?i.value.openCard.modifiers.reduce((N,$)=>N+$.max_amount,0):i.value.groupModifiers[G].max_amount}),T=r.computed(()=>{var z;const G=(i.value.addedProducts??[]).reduce((N,$)=>N+$.price,0);if(i.value.openCard){const N=i.value.openCard,$=hr(N)||0,q=N.amount||1;return(i.value.groupModifiersSelected.reduce((te,J)=>(J.modifiers.forEach(se=>{var ce,we;se.sizes&&(se.price=((we=(ce=se.sizes)==null?void 0:ce.find(Ce=>Ce.id===i.value.selectedSize.id))==null?void 0:we.price)??se.price),te+=se.price*se.amount}),te),0)+$)*q+G}return(z=i.value.addedProducts)!=null&&z.length?G:0}),D=r.computed(()=>{const G=i.value.groupCurrentOpen;if(!G)return!1;const z=i.value.groupModifiers,N=z.findIndex($=>$.id===G.id);return N===-1?!1:N===z.length-1}),k=G=>{const z=i.value.groupModifiers[G],N=i.value.groupModifiersSelected[G];if(!z)return{valid:!1};if(z.min_amount>0&&I(G)<z.min_amount)return{valid:!1,errorText:`В группе "${z.name}" должно содержаться не меньше ${z.min_amount} модификатора(ов)`};if(N){for(const $ of z.group_modifiers)if($.min_amount>0){const q=N.modifiers.find(j=>j.id===$.id);if(!q||q.amount<$.min_amount)return{valid:!1,errorText:`В группе "${z.name}" выберите все обязательные модификаторы`}}}return{valid:!0}},P=r.computed(()=>{const G=i.value.groupModifiers;for(let z=0;z<G.length;z++){const N=k(z);if(!N.valid)return i.value.textErrorRequaired=N.errorText,{haveRequaire:!0,group:G[z]}}return{haveRequaire:!1,group:G[0]}}),M=()=>{i.value.groupModifiers.forEach((G,z)=>{i.value.groupCurrentOpen={...G,index:z},G.group_modifiers.forEach(N=>{N.default_amount>0&&(N.amount=N.default_amount,ie(N,!0))})})},v=G=>{i.value.addedProducts.push(G)},W=G=>{i.value.openCard=G},X=G=>{_.value=[...G]},Z=(G,z,N)=>{var q;const $=i.value.groupModifiers.findIndex(j=>j.id===G.id);if($!==-1)if(N){const j=i.value.groupModifiers,te=$+1;if(te<j.length){const J=j[te];i.value.groupCurrentOpen={...J,index:te},i.value.isSectionModifier=!0}}else{const j=G.id!==((q=i.value.groupCurrentOpen)==null?void 0:q.id);i.value.groupCurrentOpen={...G,index:$},i.value.isSectionModifier=j?!0:!i.value.isSectionModifier}},F=()=>{i.value.modalCount>i.value.currentModifier.min_amount&&i.value.modalCount>=2&&(i.value.modalCount-=1)},L=()=>{i.value.groupCurrentOpen&&i.value.modalCount+y.value<O.value&&(i.value.currentModifier.max_amount===0||i.value.currentModifier.max_amount>i.value.modalCount)&&(i.value.modalCount+=1)},V=(G,z)=>{var $;const N=($=i.value.groupCurrentOpen)==null?void 0:$.id.toUpperCase();if(!G&&!i.value.isModifiedAmount&&z.max_amount!==1){if(N==="Добавки2000"&&z.max_amount>1)return!0;if(Math.abs(O.value-y.value)>1&&N!=="Добавки2000")return!0}return!1},ie=(G,z=!1)=>{i.value.modalCount=1,i.value.currentModifier=G;const N=i.value.groupModifiersSelected.findIndex($=>$.group===i.value.groupCurrentOpen.id);K(N,G,z)},K=(G,z,N)=>{var q,j,te;let $=i.value.groupModifiersSelected;if(G===-1)V(N,z)?i.value.isModifiedAmount=!0:$[i.value.groupCurrentOpen.index]={group:i.value.groupCurrentOpen.id,is_fake:((q=i.value.groupCurrentOpen)==null?void 0:q.is_fake)||!1,is_product_determining:((j=i.value.groupCurrentOpen)==null?void 0:j.is_product_determining)||!1,modifier_count:((te=i.value.currentModifier)==null?void 0:te.amount)||0,modifiers:[{...z,amount:(z==null?void 0:z.amount)??1}]};else{const J=i.value.groupModifiers[G].group_modifiers.findIndex(ce=>ce.id===z.id);if($[G].modifiers.findIndex(ce=>ce.id===z.id)===-1){if(O.value===1)$[G].modifiers=[];else if(y.value>=O.value)return;V(N,z)?i.value.isModifiedAmount=!0:($[G].modifiers.push({...z,amount:(z==null?void 0:z.amount)??1}),$[G].modifier_count=$[G].modifiers.reduce((ce,we)=>ce+=we.amount,0),i.value.isAnimationFly=!0)}else $[G].modifiers=$[G].modifiers.filter(ce=>ce.id!==z.id),$[G].modifier_count=$[G].modifiers.reduce((ce,we)=>ce+=we.amount,0),i.value.groupModifiers[G].group_modifiers[J].amount=1,i.value.groupModifiers[G].group_modifiers[J].default_amount=0,i.value.isAnimationFly=!1}i.value.groupModifiersSelected=$};return{stateCard:i,totalPrice_libCard:T,recountGroupTotalAmount:y,groupTotalAmount:O,isOpenWindow:u,isUpSale:f,checkedRequiredBtn:P,dataUpSale:p,productCards:_,isAddToCard:m,openProduct:x,is_startPage:C,isLastGroup:D,setProduct:X,summModifierAmount:I,setAddedProducts:v,setCurrentCard:W,minusAmount:F,plusAmount:L,toggleNotRequire:Z,modifierSelect:ie,defaultAmountModifiers:M,validateGroup:k,reset:s}});var _r=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function ta(a){return a&&a.__esModule&&Object.prototype.hasOwnProperty.call(a,"default")?a.default:a}var na={exports:{}};(function(a,l){(function(i,s){a.exports=s()})(_r,function(){var i=1e3,s=6e4,u=36e5,f="millisecond",m="second",p="minute",_="hour",x="day",C="week",y="month",I="quarter",O="year",T="date",D="Invalid Date",k=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,P=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,M={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(z){var N=["th","st","nd","rd"],$=z%100;return"["+z+(N[($-20)%10]||N[$]||N[0])+"]"}},v=function(z,N,$){var q=String(z);return!q||q.length>=N?z:""+Array(N+1-q.length).join($)+z},W={s:v,z:function(z){var N=-z.utcOffset(),$=Math.abs(N),q=Math.floor($/60),j=$%60;return(N<=0?"+":"-")+v(q,2,"0")+":"+v(j,2,"0")},m:function z(N,$){if(N.date()<$.date())return-z($,N);var q=12*($.year()-N.year())+($.month()-N.month()),j=N.clone().add(q,y),te=$-j<0,J=N.clone().add(q+(te?-1:1),y);return+(-(q+($-j)/(te?j-J:J-j))||0)},a:function(z){return z<0?Math.ceil(z)||0:Math.floor(z)},p:function(z){return{M:y,y:O,w:C,d:x,D:T,h:_,m:p,s:m,ms:f,Q:I}[z]||String(z||"").toLowerCase().replace(/s$/,"")},u:function(z){return z===void 0}},X="en",Z={};Z[X]=M;var F="$isDayjsObject",L=function(z){return z instanceof ee||!(!z||!z[F])},V=function z(N,$,q){var j;if(!N)return X;if(typeof N=="string"){var te=N.toLowerCase();Z[te]&&(j=te),$&&(Z[te]=$,j=te);var J=N.split("-");if(!j&&J.length>1)return z(J[0])}else{var se=N.name;Z[se]=N,j=se}return!q&&j&&(X=j),j||!q&&X},ie=function(z,N){if(L(z))return z.clone();var $=typeof N=="object"?N:{};return $.date=z,$.args=arguments,new ee($)},K=W;K.l=V,K.i=L,K.w=function(z,N){return ie(z,{locale:N.$L,utc:N.$u,x:N.$x,$offset:N.$offset})};var ee=function(){function z($){this.$L=V($.locale,null,!0),this.parse($),this.$x=this.$x||$.x||{},this[F]=!0}var N=z.prototype;return N.parse=function($){this.$d=function(q){var j=q.date,te=q.utc;if(j===null)return new Date(NaN);if(K.u(j))return new Date;if(j instanceof Date)return new Date(j);if(typeof j=="string"&&!/Z$/i.test(j)){var J=j.match(k);if(J){var se=J[2]-1||0,ce=(J[7]||"0").substring(0,3);return te?new Date(Date.UTC(J[1],se,J[3]||1,J[4]||0,J[5]||0,J[6]||0,ce)):new Date(J[1],se,J[3]||1,J[4]||0,J[5]||0,J[6]||0,ce)}}return new Date(j)}($),this.init()},N.init=function(){var $=this.$d;this.$y=$.getFullYear(),this.$M=$.getMonth(),this.$D=$.getDate(),this.$W=$.getDay(),this.$H=$.getHours(),this.$m=$.getMinutes(),this.$s=$.getSeconds(),this.$ms=$.getMilliseconds()},N.$utils=function(){return K},N.isValid=function(){return this.$d.toString()!==D},N.isSame=function($,q){var j=ie($);return this.startOf(q)<=j&&j<=this.endOf(q)},N.isAfter=function($,q){return ie($)<this.startOf(q)},N.isBefore=function($,q){return this.endOf(q)<ie($)},N.$g=function($,q,j){return K.u($)?this[q]:this.set(j,$)},N.unix=function(){return Math.floor(this.valueOf()/1e3)},N.valueOf=function(){return this.$d.getTime()},N.startOf=function($,q){var j=this,te=!!K.u(q)||q,J=K.p($),se=function(et,rt){var Ve=K.w(j.$u?Date.UTC(j.$y,rt,et):new Date(j.$y,rt,et),j);return te?Ve:Ve.endOf(x)},ce=function(et,rt){return K.w(j.toDate()[et].apply(j.toDate("s"),(te?[0,0,0,0]:[23,59,59,999]).slice(rt)),j)},we=this.$W,Ce=this.$M,Ae=this.$D,ge="set"+(this.$u?"UTC":"");switch(J){case O:return te?se(1,0):se(31,11);case y:return te?se(1,Ce):se(0,Ce+1);case C:var ht=this.$locale().weekStart||0,be=(we<ht?we+7:we)-ht;return se(te?Ae-be:Ae+(6-be),Ce);case x:case T:return ce(ge+"Hours",0);case _:return ce(ge+"Minutes",1);case p:return ce(ge+"Seconds",2);case m:return ce(ge+"Milliseconds",3);default:return this.clone()}},N.endOf=function($){return this.startOf($,!1)},N.$set=function($,q){var j,te=K.p($),J="set"+(this.$u?"UTC":""),se=(j={},j[x]=J+"Date",j[T]=J+"Date",j[y]=J+"Month",j[O]=J+"FullYear",j[_]=J+"Hours",j[p]=J+"Minutes",j[m]=J+"Seconds",j[f]=J+"Milliseconds",j)[te],ce=te===x?this.$D+(q-this.$W):q;if(te===y||te===O){var we=this.clone().set(T,1);we.$d[se](ce),we.init(),this.$d=we.set(T,Math.min(this.$D,we.daysInMonth())).$d}else se&&this.$d[se](ce);return this.init(),this},N.set=function($,q){return this.clone().$set($,q)},N.get=function($){return this[K.p($)]()},N.add=function($,q){var j,te=this;$=Number($);var J=K.p(q),se=function(Ce){var Ae=ie(te);return K.w(Ae.date(Ae.date()+Math.round(Ce*$)),te)};if(J===y)return this.set(y,this.$M+$);if(J===O)return this.set(O,this.$y+$);if(J===x)return se(1);if(J===C)return se(7);var ce=(j={},j[p]=s,j[_]=u,j[m]=i,j)[J]||1,we=this.$d.getTime()+$*ce;return K.w(we,this)},N.subtract=function($,q){return this.add(-1*$,q)},N.format=function($){var q=this,j=this.$locale();if(!this.isValid())return j.invalidDate||D;var te=$||"YYYY-MM-DDTHH:mm:ssZ",J=K.z(this),se=this.$H,ce=this.$m,we=this.$M,Ce=j.weekdays,Ae=j.months,ge=j.meridiem,ht=function(rt,Ve,it,De){return rt&&(rt[Ve]||rt(q,te))||it[Ve].slice(0,De)},be=function(rt){return K.s(se%12||12,rt,"0")},et=ge||function(rt,Ve,it){var De=rt<12?"AM":"PM";return it?De.toLowerCase():De};return te.replace(P,function(rt,Ve){return Ve||function(it){switch(it){case"YY":return String(q.$y).slice(-2);case"YYYY":return K.s(q.$y,4,"0");case"M":return we+1;case"MM":return K.s(we+1,2,"0");case"MMM":return ht(j.monthsShort,we,Ae,3);case"MMMM":return ht(Ae,we);case"D":return q.$D;case"DD":return K.s(q.$D,2,"0");case"d":return String(q.$W);case"dd":return ht(j.weekdaysMin,q.$W,Ce,2);case"ddd":return ht(j.weekdaysShort,q.$W,Ce,3);case"dddd":return Ce[q.$W];case"H":return String(se);case"HH":return K.s(se,2,"0");case"h":return be(1);case"hh":return be(2);case"a":return et(se,ce,!0);case"A":return et(se,ce,!1);case"m":return String(ce);case"mm":return K.s(ce,2,"0");case"s":return String(q.$s);case"ss":return K.s(q.$s,2,"0");case"SSS":return K.s(q.$ms,3,"0");case"Z":return J}return null}(rt)||J.replace(":","")})},N.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},N.diff=function($,q,j){var te,J=this,se=K.p(q),ce=ie($),we=(ce.utcOffset()-this.utcOffset())*s,Ce=this-ce,Ae=function(){return K.m(J,ce)};switch(se){case O:te=Ae()/12;break;case y:te=Ae();break;case I:te=Ae()/3;break;case C:te=(Ce-we)/6048e5;break;case x:te=(Ce-we)/864e5;break;case _:te=Ce/u;break;case p:te=Ce/s;break;case m:te=Ce/i;break;default:te=Ce}return j?te:K.a(te)},N.daysInMonth=function(){return this.endOf(y).$D},N.$locale=function(){return Z[this.$L]},N.locale=function($,q){if(!$)return this.$L;var j=this.clone(),te=V($,q,!0);return te&&(j.$L=te),j},N.clone=function(){return K.w(this.$d,this)},N.toDate=function(){return new Date(this.valueOf())},N.toJSON=function(){return this.isValid()?this.toISOString():null},N.toISOString=function(){return this.$d.toISOString()},N.toString=function(){return this.$d.toUTCString()},z}(),G=ee.prototype;return ie.prototype=G,[["$ms",f],["$s",m],["$m",p],["$H",_],["$W",x],["$M",y],["$y",O],["$D",T]].forEach(function(z){G[z[1]]=function(N){return this.$g(N,z[0],z[1])}}),ie.extend=function(z,N){return z.$i||(z(N,ee,ie),z.$i=!0),ie},ie.locale=V,ie.isDayjs=L,ie.unix=function(z){return ie(1e3*z)},ie.en=Z[X],ie.Ls=Z,ie.p={},ie})})(na);var Gd=na.exports;const ra=ta(Gd),Wd=a=>{const l=ke.useRouter(),i=`${a.domain}/api/`,s=Ze.create({baseURL:i}),u=Ze.create({baseURL:i}),f=Ze.create({baseURL:i}),m=Ze.create({baseURL:i}),p=Ze.create({baseURL:i}),_=Ze.create({baseURL:i}),x=Ze.create({baseURL:i}),C=M=>{try{const v=JSON.parse(localStorage.getItem("authTokensAccess")||"");v.length>0&&(M.headers.Authorization=`Bearer ${v}`)}catch{console.warn("accessToken is undefined [useAxios]")}return M},y=M=>{const v=localStorage.getItem("apiKey");return M.headers={"Content-Type":"application/json","x-api-key":v},M},I=async M=>{if(!a.user)return M;const v=a.user.exp??0;if(!(ra.unix(v).diff(ra())<3e3))return M;const X=hs("authTokensRefresh",null,"string");try{const Z=await Ze.post(`${i}user/token/refresh/`,{refresh:X.value});if(!Z.data.access)return P(),M;localStorage.setItem("authTokensAccess",JSON.stringify(Z.data.access)),D(Z.data),k(fs(Z.data.access)),M.headers={...M.headers,Authorization:`Bearer ${Z.data.access}`}}catch(Z){console.error("Failed to refresh token:",Z),P()}return M},O=M=>{M.interceptors.request.use(v=>I(C(v)),v=>Promise.reject(v))};O(f),O(p),O(x);const T=M=>{M.interceptors.request.use(v=>y(v))};T(_),T(u),T(x);const D=(M,v=!1)=>{localStorage.setItem("authTokensAccess",JSON.stringify(M.access)),v&&localStorage.setItem("authTokensRefresh",JSON.stringify(M.refresh))},k=M=>{a.user=M,localStorage.setItem("user",JSON.stringify(M))},P=()=>{a.user=null,mr(["authTokensAccess","authTokensRefresh","user","cart","bonus"]),sessionStorage.removeItem("is_adult"),l.replace({name:"home"}).then(()=>window.location.reload())};return{axiosInstanceAuthenticationGet:f,axiosInstanceAuthenticationPost:p,axiosInstanceAuthenticationPostApiKey:x,axiosInstancePost:m,axiosInstanceGet:s,axiosInstanceGetApiKey:u,axiosInstancePostApiKey:_}},ia=(a="themeConfig")=>{try{const l=localStorage.getItem(a);return l?JSON.parse(l):null}catch{return null}},Ge=class Ge{constructor(){Be(this,"axiosInstanceGet");Be(this,"axiosInstancePost");Be(this,"axiosInstanceAuthenticationGet");Be(this,"axiosInstanceAuthenticationPost");Be(this,"axiosInstanceGetApiKey");Be(this,"axiosInstancePostApiKey");Be(this,"axiosInstanceAuthenticationPostApiKey");Be(this,"currentUpsaleController",null);Be(this,"controller",new AbortController);this.axiosInstanceGet=Ge._axiosGet,this.axiosInstancePost=Ge._axiosPost,this.axiosInstanceGetApiKey=Ge._axiosPostApiKey,this.axiosInstancePostApiKey=Ge._axiosPostApiKey,this.axiosInstanceAuthenticationPostApiKey=Ge._axiosAuthPostApiKey,this.axiosInstanceAuthenticationGet=Ge._axiosAuthGet,this.axiosInstanceAuthenticationPost=Ge._axiosAuthPost}static create(l){return l&&!Ge._config&&Ge._initialize(l),Ge._config||console.warn("InitConnection не инициализирован"),new Ge}static _initialize(l,i=null){const s=st(),u=Lt(),{config_lib:f}=xe.storeToRefs(s),{stateCard:m,recountGroupTotalAmount:p}=xe.storeToRefs(u);Ge._config=l,Ge._cardStore=u,Ge._stateCard=m,Ge._recountGroupTotalAmount=p,f.value=l;const _=Wd(l);Ge._axiosPostApiKey=_.axiosInstanceGetApiKey,Ge._axiosPostApiKey=_.axiosInstancePostApiKey,Ge._axiosAuthPostApiKey=_.axiosInstanceAuthenticationPostApiKey,Ge._axiosGet=_.axiosInstanceGet,Ge._axiosPost=_.axiosInstancePost,Ge._axiosAuthGet=_.axiosInstanceAuthenticationGet,Ge._axiosAuthPost=_.axiosInstanceAuthenticationPost}get config(){return Ge._config}get cardStore(){return Ge._cardStore}get stateCard(){return Ge._stateCard}get recountGroupTotalAmount(){return Ge._recountGroupTotalAmount}async updateTheme(){var f,m;const l=ia(),i=St();if(l!==null){i.updateColor(l);return}const s=st(),u=await((m=this.axiosInstanceGet)==null?void 0:m.get(`org/organizations/${(f=this.config)==null?void 0:f.orgId}/design/`));s.setStateDrum(u==null?void 0:u.data.hide_barban),s.setKioskTimeout(u==null?void 0:u.data.kiosk_timeout),localStorage.setItem("themeConfig",JSON.stringify(u.data)),i.updateColor(u.data)}async getGroupByID(l){var i,s;try{const u=await((s=this.axiosInstanceGet)==null?void 0:s.get(`${(i=this.config)==null?void 0:i.pointId}/group/${l}`));return u==null?void 0:u.data}catch(u){throw console.error("Ошибка в request.ts[getGroupByID]",u),u}}async loadGroupProducts(l){var i,s;try{const u=await((s=this.axiosInstanceGet)==null?void 0:s.get(`${(i=this.config)==null?void 0:i.pointId}/products/?group=${l}`)),f=(u==null?void 0:u.data)||[];for(const m of f)m&&await kl(m);return await this.cacheImagesInBackground(f),f}catch(u){return console.error("Ошибка загрузки группы:",u),[]}}async getGroup(){var l,i;try{const s=await((i=this.axiosInstanceGet)==null?void 0:i.get(`${(l=this.config)==null?void 0:l.pointId}/groups/`));return s==null?void 0:s.data}catch(s){return console.error("Error fetching products:",s),[]}}async fetchAndCacheAllPages(){var l,i;try{const s=((l=this.config)==null?void 0:l.pointId)||"",u=await qi(s);if(u)return u.data;const f=await((i=this.axiosInstanceGet)==null?void 0:i.get(`${s}/group/`)),m=(f==null?void 0:f.data)||[],p=[];for(const _ of m){_.products=_.products||[],await Dr(_.id,_),p.push(_);const x=await this.loadGroupProducts(_.id);_.products=x}return await this.cacheImagesInBackground(m),await Dr(s,m),p}catch(s){return console.error("fetchAndCacheAllPages error:",s),[]}}cacheImagesInBackground(l){l.forEach(i=>{var s;i.video_link&&this.loadAndCacheMedia(i.video_link,i.id+"_video"),i.image_link&&this.loadAndCacheMedia(i.image_link,i.id+"_image"),(s=i.products)==null||s.forEach(u=>{u.video_link&&this.loadAndCacheMedia(u.video_link,u.id+"_video"),u.image_link&&this.loadAndCacheMedia(u.image_link,u.id+"_image")})})}async loadAndCacheMedia(l,i){const s=await fr(i);if(s){this.dispatchImageCachedEvent(i,s);return}try{const u=await fetch(l);if(!u.ok)throw new Error("Network error");const f=await u.blob();if(f.size===0)throw new Error("Empty blob");await Zi(i,f),this.dispatchImageCachedEvent(i,f)}catch(u){console.warn(`[ImageCache] Failed for ${i}:`,u)}}dispatchImageCachedEvent(l,i){window.dispatchEvent(new CustomEvent("image-cached",{detail:{id:l,blob:i}}))}async getProduct(l=null){var i,s;if(!l)return[];try{const u=await((s=this.axiosInstanceGet)==null?void 0:s.get(`${(i=this.config)==null?void 0:i.pointId}/products/${l}`));return u==null?void 0:u.data}catch(u){return console.error("Error fetching cardProducts:",u),[]}}async getSingleProduct(l){var u;const i=st(),{config_lib:s}=xe.storeToRefs(i);try{let f=await rs(l);if(f)this._fullCardProduct(f);else{const m=await((u=this.axiosInstanceGet)==null?void 0:u.get(`${s.value.pointId}/products/${l}`));(m==null?void 0:m.status)===200&&this._fullCardProduct(m.data)}}catch(f){throw console.warn("store card[getFetchProducts]:",f),f}}_fullCardProduct(l){const i=Lt();i.stateCard.openCard={...l,amount:1},i.stateCard.groupModifiers=l.group_modifiers,l.modifiers.length>0&&i.stateCard.groupModifiers.unshift({default_amount:0,description:"",group_modifiers:l.modifiers,id:"Добавки2000",image_link:null,max_amount:1,min_amount:l.modifiers.reduce((s,u)=>s+=u.min_amount,0),name:"Добавки",required:!1}),i.stateCard.groupModifiersSelected=new Array(i.stateCard.groupModifiers.length).fill({group:"",modifiers:[],is_fake:!1,is_product_determining:!1,modifier_count:0}),i.stateCard.productSizes=l.sizes,i.defaultAmountModifiers(),l.show_recommendations&&this.productUpsale(l.id)}async getTheme(){try{this.updateTheme()}catch(l){return console.error("Error fetching products:",l),[]}}async authorizeByCard(l){var i,s;try{const u=await((s=this.axiosInstanceAuthenticationPostApiKey)==null?void 0:s.post(`${(i=this.config)==null?void 0:i.domain}/api/user/validate-card/`,{card_number:l}));return localStorage.setItem("authTokensAccess",JSON.stringify(u==null?void 0:u.data.access)),localStorage.setItem("authTokensRefresh",JSON.stringify(u==null?void 0:u.data.refresh)),u==null?void 0:u.data}catch(u){throw console.error("Ошибка авторизации:",u),u}}async getLoyalSmsCode(l){var i,s;try{const u=await((s=this.axiosInstancePostApiKey)==null?void 0:s.post(`${(i=this.config)==null?void 0:i.domain}/api/device/auth/request-otp/`,{phone:l}));return u==null?void 0:u.data}catch(u){throw console.error("Ошибка получения sms-code:",u),u}}async sendSmsCodeForAuth(l,i){var s,u;try{const f=await((u=this.axiosInstanceAuthenticationPostApiKey)==null?void 0:u.post(`${(s=this.config)==null?void 0:s.domain}/api/device/auth/`,{code:l,phone:i}));return f==null?void 0:f.data}catch(f){throw console.error("Ошибка отправки sms-code:",f),f}}async callStaff(l,i,s){var u,f,m,p;try{const _=await((m=this.axiosInstancePost)==null?void 0:m.post(`${(u=this.config)==null?void 0:u.domain}/api/org_unit/${(f=this.config)==null?void 0:f.pointId}/table/${l}/call-staff/`,{...i},s));return(p=_==null?void 0:_.data)==null?void 0:p.response_text}catch(_){throw console.error("Ошибка[callStaff]",_),_}}async confirmOrder(l){var s,u;const i=await((u=this.axiosInstancePost)==null?void 0:u.post(`/org_unit/${(s=this.config)==null?void 0:s.pointId}/confirm-order/`,{order:l}));return(i==null?void 0:i.status)===200}async createOrder(l,i,s=!0,u,f=!1,m){var T,D,k,P,M;const p=Mt(),_=f?this.axiosInstanceAuthenticationPostApiKey:this.axiosInstancePostApiKey,x=s?_:this.axiosInstanceAuthenticationPost,C=s?"/device/order/create":"/order/create",y=s?(T=this.config)==null?void 0:T.pointId:(D=this.config)==null?void 0:D.pointId,I={items:l,comment:u};return i&&(I.table=i),s&&((k=p.selectedOrderType)!=null&&k.id)&&(I.order_type_id=(P=p.selectedOrderType)==null?void 0:P.id),await(x==null?void 0:x.post(`${(M=this.config)==null?void 0:M.domain}/api/org_unit/${y}${C}`,I,{signal:m}))}async extendOrder(l){var m,p;const i=Fn();if(!i.id)throw Error("Неверный стол");if(!((m=i.data)!=null&&m.order))throw Error("Заказ не найден");const s=this.axiosInstanceAuthenticationPost,u={items:l,table:i.id},f=await(s==null?void 0:s.post(`/org_unit/${(p=this.config)==null?void 0:p.pointId}/order/${i.data.order}/extend`,u));return f==null?void 0:f.data}async initPaymentLink(l,i){var _,x,C;const s=this.axiosInstanceAuthenticationPost,u=st(),f=Fn(),m={order:l,provider_type:i};u.countBonus>0&&(m.by_bonuses=u.countBonus),f.isTableService&&((_=f.order)==null?void 0:_.remaining_amount)!==((x=f.order)==null?void 0:x.total_cost)&&(m.amount=(C=f.order)==null?void 0:C.remaining_amount),m.by_bonuses&&m.amount&&(m.amount=+(+m.amount-+m.by_bonuses).toFixed(2));const p=await(s==null?void 0:s.post("payment/init",m));return p==null?void 0:p.data}async orderPay(l){var i;return(i=this.axiosInstanceAuthenticationPostApiKey)==null?void 0:i.post(`order/${l}/pay/`,{order_id:l})}async getProfile(){var i,s;const l=await((s=this.axiosInstanceAuthenticationGet)==null?void 0:s.get(`user/current?organization=${(i=this.config)==null?void 0:i.orgId}`));if((l==null?void 0:l.status)===200){const u=st();return u.profile=l.data,u.is18Allowed=sessionStorage.getItem("is_adult")==="true",l.data}else return l}async joinLoyalty(){var i;const l=await((i=this.axiosInstanceAuthenticationGet)==null?void 0:i.post("user/join-loyalty/"));return{success:(l==null?void 0:l.status)===200}}async isPhoneExist(l,i={}){var s,u;try{const f=await((u=this.axiosInstanceGet)==null?void 0:u.get("user/check-phone",{...i,params:{organization:(s=this.config)==null?void 0:s.orgId,phone:l}}));return(f==null?void 0:f.status)===200}catch{return!1}}async sendOTP(l,i={}){var u,f;const s=await((f=this.axiosInstancePost)==null?void 0:f.post("user/check-phone",{organization:(u=this.config)==null?void 0:u.orgId,phone:l},i));return s==null?void 0:s.data}async auth(l,i={}){var u,f;return await((f=this.axiosInstancePost)==null?void 0:f.post("user/auth",{organization:(u=this.config)==null?void 0:u.orgId,...l},i))}async signup(l,i={}){var u,f;return await((f=this.axiosInstancePost)==null?void 0:f.post("user/register",{organization:(u=this.config)==null?void 0:u.orgId,...l},i))}async calculateDiscount(l,i=!0,s=!1,u){var C,y;const f=s?this.axiosInstanceAuthenticationPostApiKey:this.axiosInstancePostApiKey,m=s?this.axiosInstanceAuthenticationPost:this.axiosInstancePost,p=i?f:m,_=i?(C=this.config)==null?void 0:C.pointId:(y=this.config)==null?void 0:y.pointId,x=await(p==null?void 0:p.post(`/org_unit/${_}/cart/calculate-discount/`,l,{signal:u}));return(x==null?void 0:x.status)===200?x.data:x}async maxPayByBonuses(l,i=!0,s=!1,u){const f=st(),m=s?this.axiosInstanceAuthenticationPostApiKey:this.axiosInstancePostApiKey,p=s?this.axiosInstanceAuthenticationPost:this.axiosInstancePost,_=i?m:p,x=await(_==null?void 0:_.post("/cart/max-pay-by-bonuses/",{order_id:l},{signal:u})),C=x==null?void 0:x.data;return f.profile&&C&&"balance"in C&&(f.profile.balance=C.balance),C}async getDeviceInfo(){var s;const l=Mt(),i=await((s=this.axiosInstanceGetApiKey)==null?void 0:s.get("/device/current/"));return(i==null?void 0:i.status)===200?(l.orderTypes=i.data.order_types,l.providerTypes=i.data.payment_provider_type,i.data):i}async validateApiKey(l,i){var u,f;const s=await((f=this.axiosInstancePost)==null?void 0:f.post(`/device/org_unit/${(u=this.config)==null?void 0:u.pointId}/validate-api-key/`,{api_key:l},i));return(s==null?void 0:s.status)===200}async productUpsale(l){var f,m,p;const i=Lt(),{dataUpSale:s}=xe.storeToRefs(i);(f=this.currentUpsaleController)==null||f.abort();const u=new AbortController;this.currentUpsaleController=u;try{const _=await((p=this.axiosInstanceGet)==null?void 0:p.get(`/${(m=this.config)==null?void 0:m.pointId}/products/${l}/recommendation/`,{signal:u.signal}));u.signal.aborted||(s.value=_==null?void 0:_.data)}catch(_){if(_.name==="AbortError"||_.name==="CanceledError"){console.warn("Upsale отменён — пришёл новый запрос");return}throw console.error("Ошибка upsale:",_),_}finally{this.currentUpsaleController===u&&(this.currentUpsaleController=null)}}};Be(Ge,"_config",null),Be(Ge,"_axiosGet"),Be(Ge,"_axiosGetApiKey"),Be(Ge,"_axiosPostApiKey"),Be(Ge,"_axiosAuthPostApiKey"),Be(Ge,"_axiosPost"),Be(Ge,"_axiosAuthGet"),Be(Ge,"_axiosAuthPost"),Be(Ge,"_cardStore",null),Be(Ge,"_stateCard",null),Be(Ge,"_recountGroupTotalAmount",null);let yn=Ge;const oa=r.ref(!1),sa=r.ref(window.innerWidth),Hn=()=>{const a=r.computed({get:()=>oa.value,set:u=>{oa.value=u}}),l=r.computed(()=>a.value&&sa.value>1024),i=()=>sa.value=window.innerWidth;return r.onMounted(()=>{window.addEventListener("resize",i)}),r.onUnmounted(()=>{window.removeEventListener("resize",i)}),{isDesktop:a,shouldUseDragScroll:l,syncWithRoute:u=>{a.value=u.query.mode==="pdf"}}},Xd=r.defineComponent({__name:"UseScrollCenter",props:{axis:{},behavior:{},autoScroll:{type:Boolean},container:{},idActive:{},clearContainer:{type:Boolean}},setup(a,{expose:l}){const i=a,s=st(),u=r.ref(null),{isDesktop:f}=Hn(),m=async _=>{if(!u.value||!_)return;let x=window;i.container&&(x=typeof i.container=="string"?document.querySelector(i.container)||window:i.container);const C={behavior:i.behavior};if(i.axis==="x"){const y=x===window?window.innerWidth:x.clientWidth,I=_.offsetWidth;let O=_.offsetLeft;if(x!==window){const T=x.getBoundingClientRect();O=_.getBoundingClientRect().left-T.left+x.scrollLeft}O-=(y-I)/2,C.left=Math.max(0,O)}else{const y=x===window?window.innerHeight:x.clientHeight,I=_.offsetHeight;let O=_.offsetTop;if(x!==window){const T=x.getBoundingClientRect();O=_.getBoundingClientRect().top-T.top+x.scrollTop}O-=(y-I)/2,C.top=Math.max(0,O)}try{x===window?window.scrollTo(C):x.scrollTo(C)}catch(y){console.error("Scroll error:",y)}};r.onMounted(async()=>{if(i.autoScroll){let _=null;if(await r.nextTick(),s.activeScrolling_lib){const x=s.activeScrolling_lib.findIndex(C=>C.id===i.idActive);i.idActive?(_=document.getElementById(`scrolling${i.idActive}`),_&&x!==-1&&(s.activeScrolling_lib[x]=_)):s.activeScrolling_lib[x]&&(_=s.activeScrolling_lib[x]),m(_)}}});const p=async _=>{i.clearContainer&&(s.activeScrolling_lib=[]);const x=_.currentTarget;await r.nextTick(),s.activeScrolling_lib.includes(x)||s.activeScrolling_lib.push(x),m(x)};return l({scrollToElement:m}),(_,x)=>(r.openBlock(),r.createElementBlock("div",{ref_key:"wrapperRef",ref:u,class:r.normalizeClass(["scroll-to-wrapper",{scroll_pdf:r.unref(f)}])},[r.renderSlot(_.$slots,"default",{handleTargetClick:p},void 0,!0)],2))}}),Xe=(a,l)=>{const i=a.__vccOpts||a;for(const[s,u]of l)i[s]=u;return i},ho=Xe(Xd,[["__scopeId","data-v-e47a167d"]]),Wr={mounted(a){let l=!1,i,s,u,f,m,p=0,_=0,x=0,C=0,y=0,I=!1;const O=5;a.style.cursor="grab";const T=P=>{P.button===0&&(m&&(cancelAnimationFrame(m),m=0),l=!0,I=!1,i=P.pageX-a.offsetLeft,s=P.pageY-a.offsetTop,u=a.scrollLeft,f=a.scrollTop,x=P.pageX,C=P.pageY,y=Date.now(),p=0,_=0)},D=P=>{if(!l)return;const M=P.pageX,v=P.pageY,W=Math.abs(M-x),X=Math.abs(v-C);if(!I&&(W>O||X>O)&&(I=!0,a.style.pointerEvents="none"),I){P.stopPropagation(),P.preventDefault();const Z=Date.now(),F=Z-y;F>0&&(p=(M-x)/F*16,_=(v-C)/F*16),x=M,C=v,y=Z;const L=M-a.offsetLeft,V=v-a.offsetTop,ie=L-i,K=V-s;a.scrollLeft=u-ie,a.scrollTop=f-K}else x=M,C=v,y=Date.now()},k=P=>{if(l){if(I){if(P.stopPropagation(),P.preventDefault(),a.style.pointerEvents="",Math.abs(p)>.1||Math.abs(_)>.1){const M=()=>{a.scrollLeft-=p,a.scrollTop-=_,p*=.95,_*=.95,Math.abs(p)>.1||Math.abs(_)>.1?m=requestAnimationFrame(M):m=0};m=requestAnimationFrame(M)}}else a.style.pointerEvents="";l=!1,I=!1}};a.addEventListener("mousedown",T),window.addEventListener("mousemove",D),window.addEventListener("mouseup",k),a._dragScrollCleanup=()=>{m&&cancelAnimationFrame(m),a.removeEventListener("mousedown",T),window.removeEventListener("mousemove",D),window.removeEventListener("mouseup",k),a.style.pointerEvents=""}},unmounted(a){a._dragScrollCleanup&&a._dragScrollCleanup()}},$d={},jd={id:"custom_svg_lib",width:"26.000000",height:"26.000000",viewBox:"0 0 26 26",fill:"none",xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink"};function qd(a,l){return r.openBlock(),r.createElementBlock("svg",jd,[...l[0]||(l[0]=[r.createElementVNode("defs",null,null,-1),r.createElementVNode("path",{id:"custom_svg_color",d:"M11.83 26L11.83 14.15L0 14.15L0 11.84L11.83 11.84L11.83 0L14.15 0L14.15 11.84L26 11.84L26 14.15L14.15 14.15L14.15 26L11.83 26Z",fill:"#FF6D2E","fill-opacity":"1.000000","fill-rule":"nonzero"},null,-1)])])}const Ci=Xe($d,[["render",qd]]),Zd=["id","onClick"],Yd={class:"modified_plus_btn"},Kd=["src"],Qd={key:2,class:"wrapper_modifier_item"},Jd={key:0,class:"modifier_item_n_wrapper"},eu=["src"],tu={key:1,class:"modifier_plus_item"},nu=["src"],ru=["src"],aa=Xe(r.defineComponent({__name:"PlusModifier",props:{isSectionModifier:{type:Boolean},toggleNotRequire:{type:Function}},setup(a){const l=Lt(),i=St(),{stateCard:s}=xe.storeToRefs(l),{itemThemes:u}=xe.storeToRefs(i),{shouldUseDragScroll:f}=Hn(),m=r.ref([]),p=r.ref([]),_=r.ref(null),x=r.ref(null),C=r.ref(null),y=O=>{O instanceof HTMLElement&&!m.value.includes(O)&&m.value.push(O)},I=O=>{C.value=O};return r.onMounted(async()=>{await r.nextTick(),s.value.plusButtonsRefs=m.value}),r.watchEffect(()=>{p.value=s.value.groupModifiersSelected,document.body.style.overflow=""}),r.watch(()=>{var O;return(O=s.value.groupCurrentOpen)==null?void 0:O.id},async O=>{var D;if(!O)return;await r.nextTick();const T=m.value.find(k=>k.id==="scrolling"+O);T&&((D=x.value)==null||D.scrollToElement(T))}),r.onBeforeUnmount(()=>{m.value=[],s.value.plusButtonsRefs=[]}),(O,T)=>(r.openBlock(),r.createElementBlock("div",{class:r.normalizeClass({card_modified_wrapper_many:r.unref(s).groupModifiers.length>=5})},[r.unref(s).groupModifiersSelected?r.withDirectives((r.openBlock(),r.createElementBlock("div",{key:0,class:r.normalizeClass(["card_modified_wrapper",[r.unref(s).groupModifiers.length<=4?"card_modified_wrapper_center":""]]),ref_key:"scrollPlusContainer",ref:_},[r.createVNode(ho,{ref_key:"scrollCenterRef",ref:x,axis:"x",behavior:"smooth",container:_.value,autoScroll:!0,idActive:C.value,clearContainer:!0},{default:r.withCtx(({handleTargetClick:D})=>[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(r.unref(s).groupModifiers,(k,P)=>{var M,v;return r.openBlock(),r.createElementBlock("div",{class:"button_modified",key:k.id,ref_for:!0,ref:y,id:"scrolling"+k.id,"data-clickable":"true",onClick:W=>{a.toggleNotRequire&&a.toggleNotRequire(k,P),I(k.id),D(W)}},[r.createElementVNode("div",Yd,[p.value[P].modifiers.length===0?(r.openBlock(),r.createElementBlock("div",{key:0,class:r.normalizeClass([{modified_plus_btn_active:k.id===((M=r.unref(s).groupCurrentOpen)==null?void 0:M.id)&&a.isSectionModifier},"modified_plus_active"])},[r.createVNode(Ci,{"aria-label":`Открыть группу модификаторов ${k.name}`},null,8,["aria-label"])],2)):p.value[P].modifiers.length===1?(r.openBlock(),r.createElementBlock("div",{key:1,class:r.normalizeClass(["modified_plus_btn modified_plus_btn_solo",{modified_plus_btn_active:k.id===((v=r.unref(s).groupCurrentOpen)==null?void 0:v.id)&&a.isSectionModifier}])},[r.createElementVNode("img",{src:p.value[P].modifiers[0].image_link||r.unref(u).fallback_image||"",alt:"Модификатор"},null,8,Kd)],2)):(r.openBlock(),r.createElementBlock("div",Qd,[p.value[P].modifiers.length>2?(r.openBlock(),r.createElementBlock("div",Jd,[p.value[P].modifiers.length===3?(r.openBlock(),r.createElementBlock("img",{key:0,class:"modifier_plus_item modifier_item_three",src:p.value[P].modifiers[2].image_link||r.unref(u).fallback_image||""},null,8,eu)):(r.openBlock(),r.createElementBlock("p",tu," + "+r.toDisplayString(p.value[P].modifiers.length-2),1))])):r.createCommentVNode("",!0),r.createElementVNode("div",null,[p.value[P].modifiers.length>0?(r.openBlock(),r.createElementBlock("img",{key:0,src:p.value[P].modifiers[0].image_link||r.unref(u).fallback_image||"",class:"modifier_plus_item modifier_item_first"},null,8,nu)):r.createCommentVNode("",!0),p.value[P].modifiers.length>1?(r.openBlock(),r.createElementBlock("img",{key:1,src:p.value[P].modifiers[1].image_link||r.unref(u).fallback_image||"",class:"modifier_plus_item modifier_item_second"},null,8,ru)):r.createCommentVNode("",!0)])]))]),r.createElementVNode("p",null,r.toDisplayString(k.name),1)],8,Zd)}),128))]),_:1},8,["container","idActive"])],2)),[[r.unref(Wr),r.unref(f)?{}:!1]]):r.createCommentVNode("",!0)],2))}}),[["__scopeId","data-v-7f238435"]]),iu={width:"24",height:"24",viewBox:"0 0 24 24",id:"custom_svg_lib",fill:"none",xmlns:"http://www.w3.org/2000/svg"},ou=["stroke"],la=r.defineComponent({__name:"Close",props:{color:{type:String,required:!1,default:"currentColor"}},setup(a){const l=a;return(i,s)=>(r.openBlock(),r.createElementBlock("svg",iu,[r.createElementVNode("path",{d:"M18 18L12 12M12 12L6 6M12 12L18 6M12 12L6 18",stroke:l.color,"stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},null,8,ou)]))}}),su={},au={id:"custom_svg_lib",width:"21.847656",height:"21.846924",viewBox:"0 0 21.8477 21.8469",fill:"none",xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink"};function lu(a,l){return r.openBlock(),r.createElementBlock("svg",au,[...l[0]||(l[0]=[r.createElementVNode("desc",null," Created with Pixso. ",-1),r.createElementVNode("defs",null,null,-1),r.createElementVNode("circle",{id:"Ellipse 1",cx:"10.923828",cy:"10.923462",r:"10.923489",fill:"#FF6D2E","fill-opacity":"1.000000"},null,-1),r.createElementVNode("path",{id:"Vector",d:"M12.38 15.9L12.89 15.39C12.96 15.33 13 15.25 13 15.16C13 15.08 12.96 15 12.89 14.93L8.84 11L12.89 7.06C12.96 6.99 13 6.91 13 6.83C13 6.74 12.96 6.66 12.89 6.6L12.38 6.1C12.31 6.03 12.23 6 12.14 6C12.05 6 11.97 6.03 11.9 6.1L7.1 10.76C7.03 10.83 7 10.91 7 11C7 11.08 7.03 11.16 7.1 11.23L11.9 15.9C11.97 15.96 12.05 16 12.14 16C12.23 16 12.31 15.96 12.38 15.9Z",fill:"#F2F7FF","fill-opacity":"1.000000","fill-rule":"nonzero"},null,-1)])])}const wr=Xe(su,[["render",lu]]),Xr={mounted(a){a.muted=!0,a.setAttribute("muted","")}},cu=["disabled","id"],an=r.defineComponent({__name:"ButtonDefault",props:{textButtonDefault:{type:String,required:!0},disabled:{type:Boolean,default:!1},onClick:{type:Function,required:!0}},setup(a){const l=a,i=()=>{l.onClick()};return(s,u)=>(r.openBlock(),r.createElementBlock("button",{class:"buttonDefaultWrapper",disabled:a.disabled,onClick:i,id:a.disabled?"buttonDefaultDisabled":""},r.toDisplayString(a.textButtonDefault),9,cu))}}),du={class:"notification_info"},uu={key:0,class:"notification_18plus"},fu={class:"notification_18plus_image"},hu=["src"],mu={class:"notification_18plus_text"},gu={class:"notification_18plus_accept"},pu={key:1,class:"notification_text"},xu={key:0,class:"wrapper_button_accept"},Ei=r.defineComponent({__name:"NotificationWindow",props:r.mergeModels({textNotificationDefault:{},backgroundColor:{},buttonAccept:{},type:{type:Boolean},is_qr:{type:Boolean}},{visible:{default:!1},visibleModifiers:{}}),emits:["update:visible"],setup(a){const l=a,i=St(),s=st(),{is18Allowed:u,notificationData_lib:f}=xe.storeToRefs(s),{itemThemes:m}=xe.storeToRefs(i),p=r.computed(()=>l.backgroundColor||"rgba(50, 50, 50, 0.9)"),_=r.computed(()=>{var T;return!!((T=m.value)!=null&&T.kiosk_hide_menu_update_notification)});let x;const C=r.useModel(a,"visible"),y=()=>{f.value.fastAdd&&(s.addToCart(f.value.fastAdd),f.value.fastAdd=null),sessionStorage.setItem("is_adult","true"),u.value=!0,C.value=!1,f.value.callback&&(f.value.callback(),f.value.callback=null)},I=()=>{C.value=!1},O=()=>{C.value=!1,clearTimeout(x)};return r.watch([C,()=>l.textNotificationDefault,_],([T,D,k],[P,M])=>{x&&(!T||T!==P||D!==M)&&clearTimeout(x),k&&T&&(x=setTimeout(O,4e3))},{immediate:!0}),r.onUnmounted(()=>{x&&O()}),(T,D)=>(r.openBlock(),r.createElementBlock(r.Fragment,null,[!_.value&&C.value?(r.openBlock(),r.createBlock(r.Transition,{key:0,name:"notificationBlack",appear:""},{default:r.withCtx(()=>[r.createElementVNode("div",{class:"notification_background_black",onClick:I})]),_:1})):r.createCommentVNode("",!0),r.createVNode(r.Transition,{name:"notification"},{default:r.withCtx(()=>{var k;return[C.value?(r.openBlock(),r.createElementBlock("div",{key:0,class:"notification_overlay",onClick:I},[r.createElementVNode("div",{class:"notification_wrapper",style:r.normalizeStyle({"background-color":p.value,border:`2px solid ${p.value}`})},[r.createElementVNode("div",du,[a.type?(r.openBlock(),r.createElementBlock("div",uu,[r.createElementVNode("div",fu,[r.createElementVNode("img",{src:r.unref(m).adult_disclaimer_image||r.unref(m).fallback_image,alt:"Дисклеймер"},null,8,hu)]),r.createElementVNode("div",mu,r.toDisplayString(r.unref(m).adult_disclaimer_text),1),r.createElementVNode("div",gu,[D[0]||(D[0]=r.createElementVNode("label",{for:"plus18"},"Содержащиеся в настоящем разделе материалы предназначены для лиц старше 18 лет, носят информационный характер об ассортименте товаров и не являются рекламой. ",-1)),r.createVNode(an,{textButtonDefault:"Мне есть 18",onClick:y,style:{fontSize:"1rem",padding:"6px 24px",marginLeft:"10px"}})])])):(r.openBlock(),r.createElementBlock("div",pu,[r.createTextVNode(r.toDisplayString(a.textNotificationDefault)+" ",1),(k=a.buttonAccept)!=null&&k.state?(r.openBlock(),r.createElementBlock("div",xu,[r.createVNode(an,{class:"button_accept",textButtonDefault:a.buttonAccept.text,onClick:a.buttonAccept.acceptBtn,disabled:a.buttonAccept.disabled},null,8,["textButtonDefault","onClick","disabled"])])):r.createCommentVNode("",!0)]))])],4)])):r.createCommentVNode("",!0)]}),_:1})],64))}}),_u={class:"wrapper_modifiers"},wu={class:"wrapper_nutritional_value"},Cu={class:"nutritional_scheme"},Eu={key:0,class:"nutritional_parameters"},yu={key:1,class:"nutritional_parameters"},bu={key:2,class:"nutritional_parameters"},Au={key:3,class:"nutritional_parameters"},Su={ref:"modifierBody",class:"modifier_shadow"},Iu={class:"wrapper_modifiers_title"},Nu={class:"wrapper_text_count_modifiers"},Tu=["id","aria-label","onClick"],ku={key:0,class:"counter_modifier"},Ru={class:"hide_image_corners"},Bu=["src","alt"],Ou={key:1,loop:"",autoplay:"",muted:"",playsinline:"",class:"card__video"},Mu=["src"],Du={class:"modifier_title"},vu={key:0,class:"modifier_continue_or_add_wrapper"},Pu=Xe(r.defineComponent({__name:"SectionModifiers",emits:["close","add-to-cart"],setup(a,{emit:l}){const i=l,s=St(),u=Lt(),{itemThemes:f}=xe.storeToRefs(s),{stateCard:m,recountGroupTotalAmount:p,groupTotalAmount:_,isLastGroup:x}=xe.storeToRefs(u),{isDesktop:C,shouldUseDragScroll:y}=Hn(),I=r.ref(null),O=wt.useTemplateRefsList(),T=r.ref(!1),D=M=>{if(!M)return;const v=m.value.groupModifiers.findIndex(L=>L.id===m.value.groupCurrentOpen.id),W=m.value.plusButtonsRefs[v]||m.value.plusButtonsRefs[0];if(!W)return;const X=M.getBoundingClientRect(),Z=W.getBoundingClientRect(),F=M.cloneNode(!0);F.classList.add("flyer"),Object.assign(F.style,{width:`${X.width}px`,height:`${X.height}px`,left:`${X.left}px`,top:`${X.top}px`,position:"fixed",zIndex:"1000"}),document.body.appendChild(F),I.value=F,requestAnimationFrame(()=>{const L=Z.left+Z.width/3-(X.left+X.width/2),V=Z.top+Z.height/4-(X.top+X.height/2),ie=Z.width/X.width*.2;F.style.transform=`translate(${L}px, ${V}px) scale(${ie})`,F.style.opacity="0.4",F.style.transition="transform 0.5s ease, opacity 0.5s ease"}),F.addEventListener("transitionend",()=>{F.remove(),I.value=null,W.classList.add("bump"),setTimeout(()=>W.classList.remove("bump"),300)},{once:!0})},k=()=>{m.value.isSectionModifier=!0;const M=m.value.groupCurrentOpen;if(!M)return;const v=m.value.groupModifiers.findIndex(X=>X.id===M.id),W=u.validateGroup(v);if(!W.valid){m.value.textErrorRequaired=W.errorText,T.value=!0;return}x.value?i("add-to-cart"):u.toggleNotRequire(M,void 0,!0)};r.watch(()=>m.value.isAnimationFly,M=>{M===!0&&m.value.currentModifier&&(D(O.value.find(v=>v.id===m.value.currentModifier.id)),m.value.isAnimationFly=!1)});const P=r.computed(()=>f.value.enable_sequential_modifiers?f.value.enable_sequential_modifiers:!0);return(M,v)=>{var W,X,Z,F,L,V,ie,K,ee,G,z,N,$,q;return r.openBlock(),r.createElementBlock(r.Fragment,null,[(r.openBlock(),r.createBlock(r.Teleport,{to:"body"},[r.createVNode(Ei,{visible:T.value,textNotificationDefault:r.unref(m).textErrorRequaired,backgroundColor:r.unref(f).accent_color?r.unref(f).accent_color:"#FF6D2E","onUpdate:visible":v[0]||(v[0]=j=>T.value=j)},null,8,["visible","textNotificationDefault","backgroundColor"])])),r.createElementVNode("div",_u,[r.createElementVNode("div",wu,[r.createElementVNode("div",{class:r.normalizeClass(["card_header_inner_back",[(W=r.unref(m).openCard)!=null&&W.proteins_amount?"card_header_inner_back_nutrients":""]]),"aria-label":"Закрыть выбор модификаторов",onClick:v[1]||(v[1]=j=>i("close"))},[r.createVNode(wr,{class:"arrow_bottom"})],2),r.createElementVNode("div",Cu,[(X=r.unref(m).openCard)!=null&&X.energy_amount?(r.openBlock(),r.createElementBlock("div",Eu,[r.createElementVNode("b",null,r.toDisplayString((Z=r.unref(m).openCard)==null?void 0:Z.energy_amount),1),v[4]||(v[4]=r.createElementVNode("p",null,"Килокалории",-1))])):r.createCommentVNode("",!0),(F=r.unref(m).openCard)!=null&&F.proteins_amount?(r.openBlock(),r.createElementBlock("div",yu,[r.createElementVNode("b",null,r.toDisplayString((L=r.unref(m).openCard)==null?void 0:L.proteins_amount),1),v[5]||(v[5]=r.createElementVNode("p",null,"Белки",-1))])):r.createCommentVNode("",!0),(V=r.unref(m).openCard)!=null&&V.fat_amount?(r.openBlock(),r.createElementBlock("div",bu,[r.createElementVNode("b",null,r.toDisplayString((ie=r.unref(m).openCard)==null?void 0:ie.fat_amount),1),v[6]||(v[6]=r.createElementVNode("p",null,"Жиры",-1))])):r.createCommentVNode("",!0),(K=r.unref(m).openCard)!=null&&K.carbohydrates_amount?(r.openBlock(),r.createElementBlock("div",Au,[r.createElementVNode("b",null,r.toDisplayString((ee=r.unref(m).openCard)==null?void 0:ee.carbohydrates_amount),1),v[7]||(v[7]=r.createElementVNode("p",null,"Углеводы",-1))])):r.createCommentVNode("",!0)]),r.createElementVNode("div",{class:r.normalizeClass(["card_header_inner_back",[(G=r.unref(m).openCard)!=null&&G.proteins_amount?"card_header_inner_back_nutrients":""]]),style:{marginRight:"10px"},"aria-label":"Закрыть выбор модификаторов",onClick:v[2]||(v[2]=j=>i("close"))},[r.createVNode(la,{class:"cross_bottom"})],2)]),r.createElementVNode("div",Su,[r.createElementVNode("p",Iu,r.toDisplayString((z=r.unref(m).groupCurrentOpen)==null?void 0:z.name),1),r.createElementVNode("p",Nu,"Выбрано "+r.toDisplayString(r.unref(p))+" из "+r.toDisplayString(r.unref(_)),1),r.withDirectives((r.openBlock(),r.createElementBlock("div",{class:r.normalizeClass((N=r.unref(m).groupModifiers.find(j=>{var te;return j.id===((te=r.unref(m).groupCurrentOpen)==null?void 0:te.id)}))!=null&&N.group_modifiers.length?"wrapper_modifiers_card":"wrapper_modifiers_card_column")},[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList((($=r.unref(m).groupCurrentOpen)==null?void 0:$.group_modifiers)||[],j=>{var te,J,se;return r.openBlock(),r.createElementBlock("div",{key:j.id,ref_for:!0,ref:r.unref(O).set,id:j.id,style:r.normalizeStyle({pointerEvents:r.unref(C)?"none":"auto"}),class:r.normalizeClass(["modifier_card",{hidden_modifier_card:j.default_amount===0&&((te=r.unref(m).groupCurrentOpen)==null?void 0:te.id)==="Добавки2000"&&j.min_amount===0&&j.max_amount===0}]),tabindex:"0",role:"button","data-clickable":"true","aria-label":`Выбрать модификатор группы ${j.name}`,onClick:ce=>r.unref(u).modifierSelect(j)},[r.createElementVNode("div",{class:r.normalizeClass([{modifier_card_active:r.unref(m).groupModifiersSelected.some(ce=>{var we;return ce.group===((we=r.unref(m).groupCurrentOpen)==null?void 0:we.id)&&ce.modifiers.some(Ce=>Ce.id===j.id)})},"wrapper_image_corners"])},[j.amount>1?(r.openBlock(),r.createElementBlock("div",ku,r.toDisplayString(j.amount),1)):r.createCommentVNode("",!0),r.createElementVNode("div",Ru,[j.video_link?r.withDirectives((r.openBlock(),r.createElementBlock("video",Ou,[r.createElementVNode("source",{src:j.video_link||"",type:"video/webm"},null,8,Mu)])),[[r.unref(Xr)]]):(r.openBlock(),r.createElementBlock("img",{key:0,class:"modifier_image",src:j.image_link||r.unref(f).fallback_image||"",alt:j.name},null,8,Bu)),r.createElementVNode("div",{class:r.normalizeClass(["wrapper_modifier_title",{wrapper_modifier_title_required:j.min_amount>0||j.required}])},[r.createElementVNode("h3",Du,r.toDisplayString(j.name),1),r.createElementVNode("p",null,"+"+r.toDisplayString(((se=(J=j.sizes)==null?void 0:J.find(ce=>ce.id===r.unref(m).selectedSize.id))==null?void 0:se.price)||j.price||0)+"₽",1)],2)])],2)],14,Tu)}),128))],2)),[[r.unref(Wr),(q=r.unref(m).groupModifiers.find(j=>{var te;return j.id===((te=r.unref(m).groupCurrentOpen)==null?void 0:te.id)}))!=null&&q.group_modifiers.length?{}:!1]]),P.value?(r.openBlock(),r.createElementBlock("div",vu,[r.createElementVNode("button",{onClick:v[3]||(v[3]=j=>k()),class:"modifier_continue_or_add"},r.toDisplayString(r.unref(x)?"Добавить":"Продолжить"),1)])):r.createCommentVNode("",!0)],512)])],64)}}}),[["__scopeId","data-v-6cd4c87b"]]),Lu={key:0,class:"slider_container"},Fu={key:0,class:"card_size_place"},Vu=["onClick","aria-label"],Uu={key:1,class:"card_size static"},zu=["onClick"],mo=3,Hu=Xe(r.defineComponent({__name:"SizeModifier",setup(a){const l=Lt(),{stateCard:i}=xe.storeToRefs(l),{width:s}=wt.useWindowSize(),u=r.ref(50),f=r.ref(),m=r.ref(0),p=r.ref(null),_=r.computed(()=>{var k;return s.value,(((k=p.value)==null?void 0:k.offsetWidth)||0)/Math.min(i.value.productSizes.length,mo)}),x=r.computed(()=>i.value.productSizes.length<4?{left:`${u.value}%`,width:`${_.value-8}px`}:{left:"50%",transform:"translate(-50%, -50%)",width:`${_.value-8}px`}),C=r.computed(()=>{var M;if(i.value.productSizes.length<4)return i.value.productSizes[f.value.index]||i.value.productSizes[0];const k=m.value+1,P=((M=y.value[k])==null?void 0:M.originalIndex)??1;return i.value.productSizes[P]}),y=r.computed(()=>{if(i.value.productSizes.length<4)return i.value.productSizes;const k=i.value.productSizes;return[...k.map((P,M)=>({...P,originalIndex:M})),...k.map((P,M)=>({...P,originalIndex:M})),...k.map((P,M)=>({...P,originalIndex:M}))]}),I=(k,P)=>{if(f.value={id:k.id,title:k.name,index:P,is_default:k.is_default},k.price!==null&&i.value.openCard&&(i.value.openCard={...i.value.openCard,price:k.price}),i.value.selectedSize=k,i.value.productSizes.length>=4){const M=m.value+1;P<M?O():P>M&&T()}else{const M=i.value.productSizes.length,v=P*(100/M);u.value=v}},O=()=>{var k;if(!(i.value.productSizes.length<4)){if(m.value--,m.value<i.value.productSizes.length-mo+1){m.value+=i.value.productSizes.length;const P=(k=p.value)==null?void 0:k.querySelector(".card_size");P&&(P.style.transition="none",P.style.transform=`translateX(-${m.value*_.value}px)`,P.offsetHeight,P.style.transition="transform 0.2s ease-in-out")}D()}},T=()=>{var k;if(!(i.value.productSizes.length<4)){if(m.value++,m.value>=i.value.productSizes.length*2){m.value-=i.value.productSizes.length;const P=(k=p.value)==null?void 0:k.querySelector(".card_size");P&&(P.style.transition="none",P.style.transform=`translateX(-${m.value*_.value}px)`,P.offsetHeight,P.style.transition="transform 0.2s ease-in-out")}D()}},D=()=>{var v;if(i.value.productSizes.length<4)return;const k=m.value+1,P=((v=y.value[k])==null?void 0:v.originalIndex)??0,M=i.value.productSizes[P];f.value={id:M.id,title:M.name,index:P,is_default:M.is_default}};return r.watch([()=>i.value.productSizes,p],([k=[],P])=>{if(Array.isArray(k)&&k.length>0){let M=k.findIndex(v=>v.is_default===!0);console.log(M),M>-1?(m.value=M,I(k[M],M)):k.length>mo?I(k[1],1):I(k[0],0)}}),r.watch([()=>{var k;return(k=i.value.selectedSize)==null?void 0:k.id},()=>i.value.groupModifiersSelected],([k,P])=>{if(!k||!Array.isArray(P))return;const M=P.map(v=>({...v,modifiers:v.modifiers.map(W=>{if(!W.sizes||W.sizes.length===0)return W;const X=W.sizes.find(Z=>Z.id===k);return X?{...W,size:X,price:X.price??W.price}:W})}));JSON.stringify(M)!==JSON.stringify(i.value.groupModifiersSelected)&&(i.value.groupModifiersSelected=M)},{deep:!0}),(k,P)=>r.unref(i).productSizes.length>1&&f.value?(r.openBlock(),r.createElementBlock("div",Lu,[r.createElementVNode("div",{class:"card_size_place_wrapper",ref_key:"sliderWrapper",ref:p},[r.unref(i).productSizes.length>1&&f.value?(r.openBlock(),r.createElementBlock("div",Fu,[r.unref(i).productSizes.length>3?(r.openBlock(),r.createElementBlock("ul",{key:0,class:"card_size",style:r.normalizeStyle({transform:`translateX(-${m.value*_.value}px)`})},[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(y.value,(M,v)=>(r.openBlock(),r.createElementBlock("li",{key:`${M.id}-${v}`,onClick:W=>I(M,v),class:r.normalizeClass({active:f.value.id===M.id&&f.value.index===M.originalIndex}),tabindex:"0",role:"button","aria-label":`Выбрать размер ${M.name}`},[r.createElementVNode("p",null,r.toDisplayString(M.alt_name?M.alt_name:M.name),1)],10,Vu))),128))],4)):(r.openBlock(),r.createElementBlock("ul",Uu,[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(r.unref(i).productSizes,(M,v)=>(r.openBlock(),r.createElementBlock("li",{key:`${M.id}-${v}`,onClick:W=>I(M,v),class:r.normalizeClass({active:f.value.id===M.id&&f.value.index===v}),tabindex:"0",role:"button"},[r.createElementVNode("p",null,r.toDisplayString(M.alt_name?M.alt_name:M.name),1)],10,zu))),128))])),r.createElementVNode("div",{class:"size_active",style:r.normalizeStyle(x.value)},[r.createElementVNode("p",null,r.toDisplayString(C.value.alt_name?C.value.alt_name:C.value.name),1)],4)])):r.createCommentVNode("",!0)],512)])):r.createCommentVNode("",!0)}}),[["__scopeId","data-v-e2faab10"]]),Gu="data:image/svg+xml,%3csvg%20width='18'%20height='20'%20viewBox='0%200%2018%2020'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M7.3063%2019.7525C8.12104%2019.7525%208.78152%2019.1097%208.78152%2018.3167C8.78152%2017.5236%208.12104%2016.8808%207.3063%2016.8808C6.49156%2016.8808%205.83108%2017.5236%205.83108%2018.3167C5.83108%2019.1097%206.49156%2019.7525%207.3063%2019.7525Z'%20fill='%23808080'/%3e%3cpath%20d='M7.3063%2019.2525C7.83733%2019.2525%208.26782%2018.8335%208.26782%2018.3167C8.26782%2017.7998%207.83733%2017.3808%207.3063%2017.3808C6.77526%2017.3808%206.34478%2017.7998%206.34478%2018.3167C6.34478%2018.8335%206.77526%2019.2525%207.3063%2019.2525Z'%20stroke='%23F2F7FF'%20stroke-width='0.999998'/%3e%3cpath%20d='M14.4716%2019.7525C15.2864%2019.7525%2015.9469%2019.1097%2015.9469%2018.3167C15.9469%2017.5236%2015.2864%2016.8808%2014.4716%2016.8808C13.6569%2016.8808%2012.9964%2017.5236%2012.9964%2018.3167C12.9964%2019.1097%2013.6569%2019.7525%2014.4716%2019.7525Z'%20fill='%23808080'/%3e%3cpath%20d='M14.4716%2019.2525C15.0027%2019.2525%2015.4332%2018.8335%2015.4332%2018.3167C15.4332%2017.7998%2015.0027%2017.3808%2014.4716%2017.3808C13.9406%2017.3808%2013.5101%2017.7998%2013.5101%2018.3167C13.5101%2018.8335%2013.9406%2019.2525%2014.4716%2019.2525Z'%20stroke='%23F2F7FF'%20stroke-width='0.999998'/%3e%3cpath%20d='M0.770536%203.75L4.56158%206.21L6.66771%2015.23H15.1025L17.2086%208.26'%20stroke='%23F2F7FF'%20stroke-width='1.5'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3cpath%20d='M9.19507%2011.95H12.2669H15.945'%20stroke='%23F2F7FF'%20stroke-width='1.5'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3cpath%20d='M11.1908%200.830648V7.34648L8.26615%204.49981C8.03242%204.27231%207.64886%204.27231%207.41513%204.49981C7.35957%204.55378%207.3155%204.61788%207.28542%204.68845C7.25535%204.75902%207.23987%204.83467%207.23987%204.91106C7.23987%204.98746%207.25535%205.06311%207.28542%205.13368C7.3155%205.20425%207.35957%205.26835%207.41513%205.32231L11.3646%209.16648C11.5983%209.39398%2011.9759%209.39398%2012.2096%209.16648L16.159%205.32231C16.2145%205.26831%2016.2585%205.20419%2016.2885%205.13363C16.3186%205.06307%2016.334%204.98744%2016.334%204.91106C16.334%204.83469%2016.3186%204.75906%2016.2885%204.6885C16.2585%204.61794%2016.2145%204.55382%2016.159%204.49981C16.1035%204.44581%2016.0377%204.40297%2015.9652%204.37374C15.8927%204.34451%2015.815%204.32947%2015.7365%204.32947C15.658%204.32947%2015.5803%204.34451%2015.5078%204.37374C15.4353%204.40297%2015.3695%204.44581%2015.314%204.49981L12.3894%207.34648V0.830648C12.3894%200.509814%2012.1197%200.247314%2011.7901%200.247314C11.4604%200.247314%2011.1908%200.509814%2011.1908%200.830648Z'%20fill='%23F2F7FF'/%3e%3c/svg%3e",Wu={class:"counter_container"},Xu={class:"card_size_place_wrapper",ref:"sliderWrapper"},$u={class:"cart_amount_counter"},ju={class:"button_circle_number"},qu=Xe(r.defineComponent({__name:"NumberModifier",props:{qr_menu:{type:Boolean}},setup(a){const l=Lt(),{stateCard:i}=xe.storeToRefs(l),s=ke.useRouter(),u=a,f=()=>{var p,_,x,C;(_=(p=s.options.history.state)==null?void 0:p.back)!=null&&_.includes("mode=pdf")&&u.qr_menu||(x=i.value.openCard)!=null&&x.amount&&((C=i.value.openCard)==null?void 0:C.amount)>1&&(i.value.openCard.amount-=1)},m=()=>{var p,_,x;(_=(p=s.options.history.state)==null?void 0:p.back)!=null&&_.includes("mode=pdf")&&u.qr_menu||(x=i.value.openCard)!=null&&x.amount&&(i.value.openCard.amount+=1)};return(p,_)=>{var x,C;return r.openBlock(),r.createElementBlock("div",Wu,[r.createElementVNode("div",Xu,[r.createElementVNode("div",$u,[r.createElementVNode("p",{class:r.normalizeClass(["cart_circle_minus",[((x=r.unref(i).openCard)==null?void 0:x.amount)===1?"card_circle_minus_alone":""]]),"aria-label":"Уменьшить количество продукта","data-clickable":"true",onClick:r.withModifiers(f,["stop","prevent"])},[..._[0]||(_[0]=[r.createElementVNode("span",null,null,-1)])],2),r.createElementVNode("p",ju,r.toDisplayString((C=r.unref(i).openCard)==null?void 0:C.amount),1),r.createElementVNode("p",{class:"cart_circle_plus","aria-label":"Увеличить количество продукта","data-clickable":"true",onClick:r.withModifiers(m,["stop","prevent"])},"+")])],512)])}}}),[["__scopeId","data-v-50b09b8c"]]);function go(a,l=800){const i=r.ref(a),s=r.ref(a);let u=null,f=null,m=a;const p=_=>{f||(f=_);const x=_-f,C=Math.min(x/l,1),y=C<.5?4*C*C*C:1-Math.pow(-2*C+2,3)/2;i.value=Math.round(m+(s.value-m)*y),C<1?u=requestAnimationFrame(p):(i.value=s.value,u=null)};return r.watch(s,()=>{u&&cancelAnimationFrame(u),m=i.value,f=null,u=requestAnimationFrame(p)},{immediate:!0}),r.onUnmounted(()=>{u&&cancelAnimationFrame(u)}),{displayNumber:i,targetNumber:s,update:_=>{s.value=_}}}const ft=r.defineComponent({__name:"RecountNumber",props:{price:{type:Number,required:!0},duration:{type:Number},fixedFloat:{type:Number,require:!1}},setup(a){const l=a,{displayNumber:i,update:s}=go(l.price||0,l.duration||800);return r.watchEffect(()=>{s(l.price)}),(u,f)=>(r.openBlock(),r.createElementBlock("span",null,r.toDisplayString(r.unref(i).toFixed(a.fixedFloat)),1))}}),Zu={class:"button_price button_price_modifiers"},Yu=["src"],Ku={class:"button_text_container"},Qu={class:"button_text_price"},Ju=Xe(r.defineComponent({__name:"ButtonPriceCount",props:{qr_menu:{type:Boolean,default:!1},closeProduct:{}},setup(a,{expose:l}){const i=ke.useRouter(),s=ke.useRoute(),u=Lt(),f=st(),m=St(),p=a,{stateCard:_,totalPrice_libCard:x,isOpenWindow:C,isAddToCard:y}=xe.storeToRefs(u),{isDesktop:I}=Hn(),{itemThemes:O}=xe.storeToRefs(m),T=r.ref(!0),D=r.ref(!1),k=r.computed(()=>I.value?!1:T.value),P=r.ref([]),M=r.ref([]),v=()=>{var X,Z,F,L,V;if((Z=(X=i.options.history.state)==null?void 0:X.back)!=null&&Z.includes("mode=pdf")&&p.qr_menu)return;if(T.value){u.setCurrentCard(_.value.openCard),D.value=!0;const ie=_.value.groupModifiers.findIndex(K=>u.checkedRequiredBtn.group.id===K.id);u.checkedRequiredBtn.haveRequaire&&u.toggleNotRequire(u.checkedRequiredBtn.group,ie);return}const W=_.value.groupModifiersSelected||[];if(P.value=[],M.value=[],Array.isArray(W)&&W.length>0&&W.forEach(ie=>{const K=ie.group,ee=ie.modifiers||[];K==="Добавки2000"?P.value=ee.map(G=>{var z;return{...G,old_price:G.price,size:Array.isArray(G.size)?G.size.map(N=>N.id).filter(Boolean):(z=G.size)!=null&&z.id?G.size.id:void 0}}):ee.length>0&&M.value.push({group:K,is_fake:ie.is_fake||!1,is_product_determining:ie.is_product_determining||!1,modifiers:ee.map(G=>{var z;return{...G,old_price:G.price,size:Array.isArray(G.size)?G.size.map(N=>N.id).filter(Boolean):(z=G.size)!=null&&z.id?G.size.id:void 0}})})}),document.body.style.overflow="",_.value.openCard){const ie={id:_.value.openCard.id,is_fake:_.value.openCard.is_fake||!1,is_od_united_product:_.value.openCard.is_od_united_product||!1,amount:_.value.openCard.amount,name:_.value.openCard.name,image_link:_.value.openCard.image_link,price:_.value.openCard.price,old_price:_.value.openCard.price,size:((F=_.value.selectedSize)==null?void 0:F.id)??((V=(L=_.value.openCard.sizes)==null?void 0:L.find(K=>K.is_default))==null?void 0:V.id),sizes:_.value.openCard.sizes||[],modifiers:P.value,groups:_.value.openCard.groups,group_modifiers:M.value,energy_amount:_.value.openCard.energy_amount??0,proteins_amount:_.value.openCard.proteins_amount??0,fat_amount:_.value.openCard.fat_amount??0,carbohydrates_amount:_.value.openCard.carbohydrates_amount??0};p.closeProduct&&p.closeProduct(),f.addToCart(ie),y.value=!0}C.value=!1,p.qr_menu&&i.push(`/${s.params.orgId}/`)};return r.watch(()=>_.value.productSizes,W=>{!W||W.length===0||!_.value.selectedSize||(_.value.selectedSize={..._.value.selectedSize})},{immediate:!0}),r.watchEffect(()=>{u.checkedRequiredBtn.haveRequaire?T.value=!0:T.value=!1}),r.onMounted(()=>{y.value=!1}),l({addProductToCart:v}),(W,X)=>(r.openBlock(),r.createElementBlock(r.Fragment,null,[(r.openBlock(),r.createBlock(r.Teleport,{to:"body"},[r.createVNode(Ei,{visible:D.value,textNotificationDefault:r.unref(_).textErrorRequaired,backgroundColor:r.unref(O).accent_color?r.unref(O).accent_color:"#FF6D2E",buttonAccept:null,"onUpdate:visible":X[0]||(X[0]=Z=>D.value=Z)},null,8,["visible","textNotificationDefault","backgroundColor"])])),r.createElementVNode("div",{class:"button_price_bg_product",onTouchstart:X[3]||(X[3]=r.withModifiers(()=>{},["stop"])),onPointerdown:X[4]||(X[4]=r.withModifiers(()=>{},["stop"]))},[r.createElementVNode("div",Zu,[r.unref(I)?r.createCommentVNode("",!0):(r.openBlock(),r.createBlock(qu,{key:0,qr_menu:a.qr_menu},null,8,["qr_menu"])),r.createElementVNode("div",{class:r.normalizeClass(["card_product_button_buy",{buy_active:!k.value}]),"data-clickable":"true",onClick:v,onTouchstart:X[1]||(X[1]=r.withModifiers(()=>{},["stop"])),onPointerdown:X[2]||(X[2]=r.withModifiers(()=>{},["stop"]))},[r.unref(I)?r.createCommentVNode("",!0):(r.openBlock(),r.createElementBlock("img",{key:0,src:r.unref(Gu),class:"card_product_button_icon"},null,8,Yu)),r.createElementVNode("div",Ku,[r.createElementVNode("p",Qu,[r.createVNode(ft,{price:+r.unref(x),fixedFloat:2},null,8,["price"]),X[5]||(X[5]=r.createTextVNode(" ₽ ",-1))])])],34)])],32)],64))}}),[["__scopeId","data-v-15db613c"]]),e0={class:"modified_amount"},t0={class:"hide_image_corners"},n0=["src"],r0={class:"wrapper_modifier_title"},i0={class:"amount_title"},o0={class:"wrapper_amount_counter"},s0={class:"amount_count"},a0={class:"amount_wrapper"},l0={class:"add_counter_amount"},c0=Xe(r.defineComponent({__name:"ModalAmount",setup(a){const l=Lt(),i=St(),{itemThemes:s}=xe.storeToRefs(i),{stateCard:u}=xe.storeToRefs(l),f=r.computed(()=>{var _,x,C;return((C=(x=(_=u.value.currentModifier)==null?void 0:_.sizes)==null?void 0:x.find(y=>y.id===u.value.selectedSize.id))==null?void 0:C.price)??hr(u.value.currentModifier)}),m=()=>{u.value.currentModifier&&(u.value.currentModifier.amount=u.value.modalCount),l.modifierSelect(u.value.currentModifier),u.value.isModifiedAmount=!1},p=()=>{u.value.modalCount=1,u.value.currentModifier.amount=1};return(_,x)=>{var C,y;return r.openBlock(),r.createElementBlock(r.Fragment,null,[r.createElementVNode("div",e0,[r.createElementVNode("div",t0,[r.createElementVNode("img",{class:"modifier_image",src:((C=r.unref(u).currentModifier)==null?void 0:C.image_link)||r.unref(s).fallback_image||""},null,8,n0),r.createElementVNode("div",r0,[r.createElementVNode("p",i0,r.toDisplayString((y=r.unref(u).currentModifier)==null?void 0:y.name),1),r.createElementVNode("p",null,"+ "+r.toDisplayString(f.value)+"₽",1)])])]),r.createElementVNode("div",o0,[r.createElementVNode("div",{class:"amount_mines",onClick:x[0]||(x[0]=r.withModifiers((...I)=>r.unref(l).minusAmount&&r.unref(l).minusAmount(...I),["stop"]))},[...x[1]||(x[1]=[r.createElementVNode("div",null,null,-1)])]),r.createElementVNode("p",s0,r.toDisplayString(r.unref(u).modalCount),1),r.createElementVNode("div",a0,[r.createVNode(Ci,{onClick:r.withModifiers(r.unref(l).plusAmount,["stop"])},null,8,["onClick"])])]),r.createElementVNode("p",{class:"clear_count",onClick:r.withModifiers(p,["stop"])},"Убрать все"),r.createElementVNode("div",l0,[r.createVNode(an,{textButtonDefault:"Добавить",onClick:m,class:"button_add_group_modifiers"})])],64)}}}),[["__scopeId","data-v-84debd5d"]]),d0=(a,l,i)=>Math.max(l,Math.min(a,i)),u0=(a,l)=>Math.pow(a,l*5),ca=(a,l,i)=>l===0||Math.abs(l)===1/0?u0(a,i):a*l*i/(l+i*a),yi=(a,l)=>l*parseFloat(a)/100,po=(a,l,i,s=.15)=>s===0?d0(a,l,i):a<l?-ca(l-a,i-l,s)+l:a>i?+ca(a-i,i-l,s)+i:a,ln=(a,{min:l,max:i})=>l!==void 0&&a<l?l:i!==void 0&&a>i?i:a;function f0(a,l,i){const s=r.ref(0),u=r.computed(()=>a.value.map(_=>typeof _=="string"?yi(_,i.value):_)),f=r.computed(()=>Math.min(...u.value)),m=r.computed(()=>Math.max(...u.value)),p=r.computed(()=>{const _=u.value.reduce((x,C)=>Math.abs(C-l.value)<Math.abs(x-l.value)?C:x);return u.value.indexOf(_)});return{currentSnapPointIndex:s,flattenedSnapPoints:u,minSnapPoint:f,maxSnapPoint:m,closestSnapPointIndex:p}}const xo=Xe(r.defineComponent({__name:"BottomSheet",props:{duration:{default:250},snapPoints:{},initialSnapPoint:{},blocking:{type:Boolean,default:!0},canSwipeClose:{type:Boolean,default:!0},swipeCloseThreshold:{},canBackdropClose:{type:Boolean,default:!0},expandOnContentDrag:{type:Boolean,default:!0},modelValue:{type:Boolean},teleportTo:{default:"body"},teleportDefer:{type:Boolean,default:!1},headerClass:{},contentClass:{},footerClass:{}},emits:["opened","opening-started","closed","closing-started","ready","dragging-up","dragging-down","snapped","instinctHeight","update:modelValue"],setup(a,{expose:l,emit:i}){const s=a,u=i;let f=null;const m=r.ref(0),p=r.ref(!1),_=wt.useVModel(s,"modelValue",u,{passive:!0});r.watch(_,Ne=>{Ne?ce():we||Ce()}),r.onMounted(()=>{_.value&&ce()});const x=r.ref(),C=r.ref(null),y=r.ref(null),I=r.ref(null),O=r.ref(null),T=r.ref(s.expandOnContentDrag),{height:D}=wt.useWindowSize(),{height:k}=wt.useElementBounding(x),{height:P}=wt.useElementBounding(C),{height:M}=wt.useElementBounding(O),{height:v}=wt.useElementBounding(y),W=r.computed({get(){return ln(Math.ceil(M.value+P.value+v.value),{max:D.value})},set(Ne){[P.value,M.value,v.value]=Ne}}),X=r.ref(0),Z=r.ref(0),F=Ot.useMotionValue(0),L=Ot.useMotionValue(0),{snapPoints:V}=r.toRefs(s),ie=r.computed(()=>V.value??[W.value]),{flattenedSnapPoints:K,currentSnapPointIndex:ee,closestSnapPointIndex:G,minSnapPoint:z,maxSnapPoint:N}=f0(ie,X,D);let $;function q(Ne){T.value=!0,j(Ne)}function j(Ne){T.value&&Ne.preventDefault()}const te=Ne=>{Ne.key==="Escape"&&Ce()},J=()=>{s.canBackdropClose&&Ce()};let se=!1;const ce=async()=>{var Ne;if(!se){we&&(we=!1,f&&(clearTimeout(f),f=null)),m.value++,_.value=!0,se=!0,u("opening-started");try{await r.nextTick(),await r.nextTick();const Ue=(Ne=x.value)==null?void 0:Ne.$el;if(!Ue){console.warn("[BottomSheet] sheet not ready, aborting"),_.value=!1;return}k.value=Ue.getBoundingClientRect().height;const Nt=Ue.querySelector("[data-vsbs-content]"),ot=Ue.querySelector("[data-vsbs-header]"),Qe=Ue.querySelector("[data-vsbs-footer]");if(W.value=[ot.getBoundingClientRect().height,Nt.getBoundingClientRect().height,Qe.getBoundingClientRect().height],await r.nextTick(),ee.value=K.value.findIndex(ve=>ve===z.value),s.initialSnapPoint){const ve=s.initialSnapPoint;if(ve<0||ve>=ie.value.length)return console.warn("Index out of bounds");X.value=typeof ie.value[ve]=="number"?ln(ie.value[ve],{max:D.value}):yi(ie.value[ve],D.value)}else X.value=ln(z.value,{max:D.value});Z.value=X.value,F.jump(X.value),L.jump(X.value),requestAnimationFrame(()=>{$=Ot.animate(F,X.value,{duration:s.duration/1e3,ease:"easeInOut"}),$=Ot.animate(L,0,{duration:s.duration/1e3,ease:"easeInOut",onComplete:()=>{s.blocking&&u("opened")}})}),window.addEventListener("keydown",te)}finally{se=!1}}};let we=!1;const Ce=()=>{we||(se&&(se=!1),$&&$.stop(),L.stop(),F.stop(),Ot.animate(L,X.value||500,{duration:s.duration/1e3,ease:"easeInOut"}),p.value=!1,_.value=!1,we=!0,u("closing-started"),window.removeEventListener("keydown",te),f&&clearTimeout(f),f=setTimeout(()=>{u("closed"),we=!1,f=null},s.duration))},Ae=Ne=>{if(ie.value){if(Ne<0||Ne>=ie.value.length){console.warn("Index out of bounds");return}ee.value=Ne,X.value=typeof ie.value[Ne]=="number"?ln(ie.value[Ne],{max:D.value}):yi(ie.value[Ne],D.value),$=Ot.animate(F,X.value,{duration:s.duration/1e3,ease:"easeInOut",onComplete:()=>u("snapped",ie.value.indexOf(ie.value[Ne]))})}};function ge(Ne){Ne>0?u("dragging-down"):Ne<0&&u("dragging-up")}const ht=()=>{p.value=!0,X.value=k.value,Z.value=L.get(),F.jump(X.value),L.jump(Z.value)},be=async(Ne,Ue)=>{await r.nextTick(),x.value&&(Z.value<=0&&(X.value-=Ue.delta.y),X.value<=z.value&&(X.value=z.value,Z.value+=Ue.delta.y,p.value=!0,L.set(s.canSwipeClose?ln(Z.value,{min:0}):ln(po(Z.value,-k.value,0,.5),{min:0}))),F.set(ln(po(X.value,0,N.value,.25),{min:0,max:D.value})),ge(Ue.delta.y))},et=()=>{if(s.canSwipeClose){let Ne=X.value/2;s.swipeCloseThreshold&&typeof s.swipeCloseThreshold=="number"&&(Ne=s.swipeCloseThreshold),s.swipeCloseThreshold&&typeof s.swipeCloseThreshold=="string"&&s.swipeCloseThreshold.includes("%")&&(Ne=X.value*(Number(s.swipeCloseThreshold.replace("%",""))/100)),Math.abs(Z.value)>Ne&&(Z.value=X.value)}else Z.value=0;if($=Ot.animate(L,Z.value,{duration:s.duration/1e3,ease:"easeInOut"}),Z.value===X.value){Z.value=0,Ce();return}ee.value=G.value,X.value=typeof ie.value[G.value]=="number"?ln(ie.value[G.value],{max:D.value}):yi(ie.value[G.value],D.value),$=Ot.animate(F,X.value,{duration:s.duration/1e3,ease:"easeInOut",onComplete:()=>u("snapped",ie.value.indexOf(ie.value[G.value]))}),$=Ot.animate(L,0,{duration:s.duration/1e3,ease:"easeInOut"})},rt=(Ne,Ue)=>{if(X.value=k.value,Z.value=L.get(),$&&$.stop(),!I.value)return;const Nt=I.value.scrollTop===0,ot=Ue.delta.y>0,Qe=K.value.length===1,ve=.5>Math.abs(X.value-N.value);if(Qe){if(!s.expandOnContentDrag)return T.value=!1;L.get()===0&&Nt&&ot&&(T.value=!0),L.get()===0&&Nt&&!ot&&(T.value=!1)}else{if(!s.expandOnContentDrag)return T.value=!1;p.value=!0,T.value=!0,ve&&(ot&&Nt&&(T.value=!0),!ot&&Nt&&(T.value=!1),Nt||(T.value=!1))}},Ve=async(Ne,Ue)=>{if(await r.nextTick(),!s.expandOnContentDrag)return T.value=!1;if(!x.value)return;Z.value===0&&T.value&&s.expandOnContentDrag&&(X.value-=Ue.delta.y),X.value<=z.value&&(X.value=z.value,T.value&&s.expandOnContentDrag&&(Z.value+=Ue.delta.y),Z.value=ln(Z.value,{min:0,max:z.value}),L.set(s.canSwipeClose?ln(Z.value,{min:0}):ln(po(Z.value,-k.value,0,.5),{min:0}))),X.value>N.value&&(X.value=N.value),X.value=ln(X.value,{max:D.value}),!(K.value.length===1)&&X.value===N.value&&(T.value=!1),F.set(X.value),ge(Ue.delta.y)},it=()=>{if(!I.value)return;const Ne=I.value.scrollTop===0;T.value=Ne},De=wt.useDebounceFn(Ne=>Ae(Ne),s.duration);return r.watch(ie,(Ne,Ue)=>{if(_.value===!1||!Ne||!Ue)return;const Nt=Ne[ee.value],ot=Ue[ee.value];typeof Nt!="string"&&typeof ot!="string"&&(X.value=ln(Nt,{max:D.value}),Nt!==ot&&($=Ot.animate(F,X.value,{duration:s.duration/1e3,ease:"easeInOut"})))}),r.watch(D,()=>De(ee.value)),l({open:ce,close:Ce,snapToPoint:Ae}),r.onUnmounted(()=>{f&&clearTimeout(f)}),(Ne,Ue)=>(r.openBlock(),r.createBlock(r.Teleport,{to:a.teleportTo,defer:a.teleportDefer},[r.createElementVNode("div",r.mergeProps(Ne.$attrs,{"data-vsbs-container":""}),[r.createVNode(r.unref(Ot.AnimatePresence),null,{default:r.withCtx(()=>[r.unref(_)&&a.blocking?(r.openBlock(),r.createBlock(r.unref(Ot.Motion),{ref:"backdrop",key:"backdrop-"+m.value,"data-vsbs-backdrop":"",onClick:Ue[0]||(Ue[0]=Nt=>J()),transition:{ease:"easeInOut",duration:a.duration/1e3},initial:{opacity:0},animate:{opacity:1},exit:{opacity:0}},null,8,["transition"])):r.createCommentVNode("",!0)]),_:1}),r.createVNode(r.unref(Ot.AnimatePresence),null,{default:r.withCtx(()=>[r.unref(_)?(r.openBlock(),r.createBlock(r.unref(Ot.Motion),{ref_key:"sheet",ref:x,exit:{opacity:0},initial:!1,key:m.value,style:r.normalizeStyle({y:r.unref(L),z:1,height:r.unref(F)}),"data-vsbs-shadow":!a.blocking,"data-vsbs-sheet-show":r.unref(_),"data-vsbs-dragging":p.value,"aria-modal":"true","data-vsbs-sheet":"",tabindex:"-1"},{default:r.withCtx(()=>[r.createVNode(r.unref(Ot.Motion),{ref_key:"sheetHeader",ref:C,"data-vsbs-header":"",onPanStart:ht,onPan:be,onPanEnd:et,onTouchmove:q,class:r.normalizeClass(a.headerClass)},{default:r.withCtx(()=>[r.renderSlot(Ne.$slots,"header",{},void 0,!0)]),_:3},8,["class"]),r.createElementVNode("div",{ref_key:"sheetScroll",ref:I,"data-vsbs-scroll":"",onScrollend:it},[r.createVNode(r.unref(Ot.Motion),{ref:"sheetContentWrapper","data-vsbs-content-wrapper":"",onPanStart:rt,onPan:Ve,onPanEnd:et,onTouchmove:j},{default:r.withCtx(()=>[r.createElementVNode("div",{ref_key:"sheetContent",ref:O,"data-vsbs-content":"",class:r.normalizeClass(a.contentClass)},[r.renderSlot(Ne.$slots,"default",{},void 0,!0)],2)]),_:3},512)],544),r.createVNode(r.unref(Ot.Motion),{ref_key:"sheetFooter",ref:y,"data-vsbs-footer":"",onPanStart:ht,onPan:be,onPanEnd:et,onTouchmove:q,class:r.normalizeClass(a.footerClass)},{default:r.withCtx(()=>[r.renderSlot(Ne.$slots,"footer",{},void 0,!0)]),_:3},8,["class"])]),_:3},8,["style","data-vsbs-shadow","data-vsbs-sheet-show","data-vsbs-dragging"])):r.createCommentVNode("",!0)]),_:3})],16)],8,["to","defer"]))}}),[["__scopeId","data-v-a8913d51"]]);function Tn(a,l=null){const i=si();i.initCacheSingle("defaultImage");const s=r.computed(()=>i.cache.defaultImage||null),u=r.shallowRef(!1),f=r.computed(()=>{var x;return((x=r.toValue(a))==null?void 0:x.toString())||null}),m=wt.computedAsync(async()=>{const x=f.value;return x?(await i.initCacheSingle(x),i.cache[x]||null):null},null,{evaluating:u}),p=r.computed(()=>u.value&&f.value!==null);return{mediaUrl:r.computed(()=>m.value||r.toValue(l)||s.value||null),isLoading:p}}const h0={class:"card_product_modifiers_sheet_body"},m0={class:"card__pictures"},g0=["src"],p0=["src"],x0={class:"card_header_wrapper"},_0={key:0,class:"card_fire_kkal_wrapper"},w0={class:"card_content"},C0={class:"wrapper_size"},E0={key:0,class:"description"},y0={key:1},b0={class:"title_info_modifiers"},A0=Xe(r.defineComponent({__name:"CardProductPage",props:{configPage:{}},setup(a){const l=St(),i=Lt(),{stateCard:s,isOpenWindow:u,isAddToCard:f}=xe.storeToRefs(i),{itemThemes:m}=xe.storeToRefs(l),p=ke.useRouter(),_=ke.useRoute(),x=a,C=r.computed(()=>!!(_.query.mode==="pdf"&&x.configPage.qr_menu)),{mediaUrl:y}=Tn(()=>{var P,M;return(P=s.value.openCard)!=null&&P.video_link?`${s.value.openCard.id}_video`:(M=s.value.openCard)!=null&&M.image_link?`${s.value.openCard.id}_image`:null},()=>{var P,M;return((P=s.value.openCard)==null?void 0:P.video_link)||((M=s.value.openCard)==null?void 0:M.image_link)||null}),I=()=>{x.configPage.qr_menu?C.value?p.push(`/${_.params.orgId}?mode=pdf`):p.push(`/${_.params.orgId}`):x.configPage.closeProduct()},O=()=>{f.value=!1,s.value.isSectionModifier=!1},T=()=>{s.value.isModifiedAmount=!1},D=r.ref(null),k=()=>{var P;(P=D.value)==null||P.addProductToCart()};return r.watch(()=>x.configPage.data,i.setCurrentCard),r.watch(()=>s.value.isSectionModifier,P=>{C.value&&document.body.classList.toggle("pdf_hidden",P)},{immediate:!0}),r.watchEffect(()=>{u.value||(u.value=x.configPage.is_closeProduct)}),r.onBeforeUnmount(()=>i.reset()),(P,M)=>{var v,W,X,Z,F,L;return r.openBlock(),r.createElementBlock("div",{class:"card_product_wrapper",style:r.normalizeStyle(C.value?"user-select: none;":"")},[r.createVNode(r.unref(xo),{modelValue:r.unref(s).isSectionModifier,"onUpdate:modelValue":M[0]||(M[0]=V=>r.unref(s).isSectionModifier=V),class:"card_product_modifiers_sheet",teleportTo:C.value?"#app":"body"},{default:r.withCtx(()=>[r.createElementVNode("div",h0,[r.createVNode(Pu,{onClose:O,onAddToCart:k}),r.createVNode(aa,{isSectionModifier:r.unref(s).isSectionModifier,toggleNotRequire:r.unref(i).toggleNotRequire},null,8,["isSectionModifier","toggleNotRequire"])])]),_:1},8,["modelValue","teleportTo"]),(r.openBlock(),r.createBlock(r.Teleport,{to:"body"},[r.unref(s).isModifiedAmount?(r.openBlock(),r.createElementBlock("div",{key:0,class:"wrapper_modified_amount",onClick:r.withModifiers(T,["stop"])},[r.createVNode(c0)])):r.createCommentVNode("",!0)])),r.createElementVNode("div",m0,[(v=r.unref(s).openCard)!=null&&v.video_link&&r.unref(y)?r.withDirectives((r.openBlock(),r.createElementBlock("video",{key:r.unref(y),loop:"",autoplay:"",muted:"",playsinline:"",class:"card__video"},[r.createElementVNode("source",{src:r.unref(y)||"",type:"video/webm"},null,8,g0)])),[[r.unref(Xr)]]):(r.openBlock(),r.createElementBlock("img",{key:1,class:"card__pictures_images",src:r.unref(y)||"",alt:"Product image"},null,8,p0)),r.createElementVNode("div",x0,[r.createVNode(wr,{class:"card_header_back",onClick:I,"aria-label":"Вернуться назад"}),(W=r.unref(s).openCard)!=null&&W.energy_amount?(r.openBlock(),r.createElementBlock("div",_0,[M[2]||(M[2]=r.createElementVNode("div",{class:"card_fire_kkal"},null,-1)),r.createElementVNode("p",null,[r.createElementVNode("b",null,r.toDisplayString((X=r.unref(s).openCard)==null?void 0:X.energy_amount),1),M[1]||(M[1]=r.createTextVNode(" Ккал ",-1))])])):r.createCommentVNode("",!0)]),r.createElementVNode("h4",null,r.toDisplayString((Z=r.unref(s).openCard)==null?void 0:Z.name),1),r.createElementVNode("div",{class:"card__pictures__gradient",style:r.normalizeStyle(r.unref(m).gradientStyle)},null,4)]),r.createElementVNode("div",w0,[r.createElementVNode("div",C0,[r.createVNode(Hu)]),(F=r.unref(s).openCard)!=null&&F.description?(r.openBlock(),r.createElementBlock("p",E0,r.toDisplayString((L=r.unref(s).openCard)==null?void 0:L.description),1)):r.createCommentVNode("",!0),r.unref(s).groupModifiers.length?(r.openBlock(),r.createElementBlock("div",y0,[r.createElementVNode("p",b0,r.toDisplayString(r.unref(m).dish_cart_mod_choice_text||"Настрой, как ты любишь"),1),r.createVNode(aa,{isSectionModifier:r.unref(s).isSectionModifier,toggleNotRequire:r.unref(i).toggleNotRequire},null,8,["isSectionModifier","toggleNotRequire"])])):r.createCommentVNode("",!0),r.createVNode(Ju,{ref_key:"buttonPriceRef",ref:D,qr_menu:a.configPage.qr_menu,closeProduct:a.configPage.closeProduct},null,8,["qr_menu","closeProduct"])])],4)}}}),[["__scopeId","data-v-a84e5942"]]),bi=xe.defineStore("modals",()=>{const a=new Map,l=(u,f)=>{const m=s(u).value;m.visible=!0,m.context=f},i=u=>{const f=s(u).value;f.visible=!1},s=u=>(a.has(u)||a.set(u,r.ref({visible:!1})),a.get(u));return{state:s,open:l,close:i}}),S0={key:0,class:"popupWindowDefault_overlay"},da=Xe(r.defineComponent({__name:"PopupWindowDefault",props:{visible:{type:Boolean}},emits:["update:visible"],setup(a,{emit:l}){const i=a,s=l,u=()=>{s("update:visible",!1)};return r.watch(()=>i.visible,async f=>{f&&await r.nextTick(),i.isVisible=f}),(f,m)=>(r.openBlock(),r.createElementBlock(r.Fragment,null,[r.createVNode(r.Transition,{name:"popupWindowDefaultBlack",appear:"",onAfterLeave:m[0]||(m[0]=()=>{s("update:visible",!1)})},{default:r.withCtx(()=>[i.visible?(r.openBlock(),r.createElementBlock("div",{key:0,class:"background_black",onClick:u})):r.createCommentVNode("",!0)]),_:1}),r.createVNode(r.Transition,{name:"popupWindowDefault",appear:"",onAfterLeave:m[1]||(m[1]=()=>{s("update:visible",!1)})},{default:r.withCtx(()=>[i.visible?(r.openBlock(),r.createElementBlock("div",S0,[r.renderSlot(f.$slots,"default",{},void 0,!0)])):r.createCommentVNode("",!0)]),_:3})],64))}}),[["__scopeId","data-v-08e0e008"]]),I0=["src"],N0={class:"cart_box_content_wrapper"},T0={class:"cart_box_content_info"},k0={class:"cart_box_name"},R0={class:"cart_box_size"},B0={class:"cart_amount"},O0={class:"cart_amount_count"},M0={class:"cart_box_info_more"},D0={key:1,class:"cart_modifier_info"},v0={class:"cart_modifier_content"},P0={class:"wrapper_price_count_cart"},L0={class:"count_cart_box"},F0={class:"wrapper_modifiers_discount"},ua=Xe(r.defineComponent({__name:"CartBox",props:{index:Number,cardItem:Object,isShowModifiers:Boolean},emits:["delete"],setup(a,{emit:l}){const i=a,s=st(),u=St(),f=bi(),{itemThemes:m}=xe.storeToRefs(u),p=r.ref(0),_=r.ref(0),x=r.ref(!1),C=r.ref(!1),y=r.ref(i.isShowModifiers?u.itemThemes.qr_show_modifiers_in_cart??!1:u.itemThemes.kiosk_show_modifiers_in_cart??!1),{displayNumber:I,update:O}=go(0,800),T=r.computed(()=>{var K,ee;const V=((K=i.cardItem)==null?void 0:K.modifiers)??[],ie=(((ee=i.cardItem)==null?void 0:ee.group_modifiers)??[]).flatMap(G=>G.modifiers??[]);return[...V,...ie]}),{mediaUrl:D}=Tn(()=>{var V;return((V=i.cardItem)==null?void 0:V.id)+"_image"},()=>{var V;return(V=i.cardItem)==null?void 0:V.image_link}),k=r.computed(()=>{var V,ie;return((V=i.cardItem)==null?void 0:V.total_new_price)??hr(i.cardItem)*((ie=i.cardItem)==null?void 0:ie.amount)}),P=()=>f.open("cart-delete-confirm",i.cardItem),M=()=>{y.value=!y.value},v=()=>{s.plusAmount(i.cardItem.idSystem)},W=()=>{i.cardItem.amount>1?s.minusAmount(i.cardItem.idSystem):P()},X=V=>{p.value=V.touches[0].clientX,x.value=!0},Z=V=>{x.value&&(_.value=V.touches[0].clientX-p.value,_.value>0&&(_.value=0))},F=()=>{x.value=!1,_.value<-115&&P(),_.value=0};r.onMounted(()=>{i.index===0&&(C.value=!0,setTimeout(()=>{_.value=-90,setTimeout(()=>{_.value=0,C.value=!1},700)},0))});const L=r.computed(()=>{const V=i.index===0&&C.value?1:`${1-Math.abs(_.value)/200}`;return{transform:`translateX(${_.value}px)`,opacity:V,transition:x.value?"none":"transform 0.7s, opacity 0.7s"}});return r.watch(k,O,{immediate:!0}),(V,ie)=>{var K,ee,G,z,N,$,q,j;return r.openBlock(),r.createElementBlock("div",{class:"cart_box_wrapper",onTouchstart:X,onTouchmove:Z,onTouchend:F,style:r.normalizeStyle(L.value)},[ie[2]||(ie[2]=r.createElementVNode("div",{class:"wrapper_cart_delete"},[r.createElementVNode("div",{class:"cart_delete"})],-1)),r.createElementVNode("img",{src:r.unref(D)||"",class:"cart_box_image"},null,8,I0),r.createElementVNode("div",N0,[r.createElementVNode("div",T0,[r.createElementVNode("p",k0,r.toDisplayString((K=a.cardItem)==null?void 0:K.name),1),r.createElementVNode("p",R0,r.toDisplayString(((G=(ee=a.cardItem)==null?void 0:ee.sizes.find(te=>{var J;return te.id===((J=a.cardItem)==null?void 0:J.size)}))==null?void 0:G.alt_name)||((N=(z=a.cardItem)==null?void 0:z.sizes.find(te=>{var J;return te.id===((J=a.cardItem)==null?void 0:J.size)}))==null?void 0:N.name)),1),(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList((($=i.cardItem)==null?void 0:$.discounts)||[],(te,J)=>(r.openBlock(),r.createElementBlock("div",{key:J,class:"discount_banner"},[r.createElementVNode("p",null,r.toDisplayString(te.name),1),r.createElementVNode("p",null,r.toDisplayString(te.discount)+"₽",1)]))),128)),r.createElementVNode("div",B0,[r.createElementVNode("button",{onClick:W},"-"),r.createElementVNode("p",O0,r.toDisplayString(i.cardItem.amount),1),r.createElementVNode("button",{onClick:v},"+")])]),r.createElementVNode("div",M0,[r.createElementVNode("div",{class:"cart_box_remove_item",onClick:P},[r.createVNode(la)]),(q=i.cardItem)!=null&&q.new_price?(r.openBlock(),r.createElementBlock("p",{key:0,class:r.normalizeClass({discount_new_price:(j=i.cardItem)==null?void 0:j.new_price})},r.toDisplayString((i.cardItem.new_price*i.cardItem.amount).toFixed(2)+"₽"),3)):r.createCommentVNode("",!0),r.createElementVNode("p",null,r.toDisplayString(r.unref(I).toFixed(2)+"₽"),1)])]),!y.value&&T.value.length>0?(r.openBlock(),r.createElementBlock("div",{key:0,class:"cart_modifier_toggle",onTouchstart:r.withModifiers(M,["stop"])},[...ie[0]||(ie[0]=[r.createElementVNode("p",{class:"cart_info_more"},"Посмотреть модификаторы",-1),r.createElementVNode("p",{class:"cart_arrow"},null,-1)])],32)):r.createCommentVNode("",!0),y.value&&T.value.length>0?(r.openBlock(),r.createElementBlock("div",D0,[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(T.value,te=>{var J;return r.openBlock(),r.createElementBlock("div",{class:"cart_modifier_item",key:te.id},[r.createElementVNode("div",v0,[r.createVNode(Ci,{id:"plus_orange"}),r.createElementVNode("p",null,r.toDisplayString(te.name),1)]),r.createElementVNode("div",P0,[r.createElementVNode("p",L0,r.toDisplayString(`x${te.amount}`),1),r.createElementVNode("div",F0,[te!=null&&te.new_price?(r.openBlock(),r.createElementBlock("p",{key:0,class:r.normalizeClass({discount_new_price:(J=te==null?void 0:te.new_price)==null?void 0:J.toFixed(2)})},r.toDisplayString((te.new_price*te.amount).toFixed(2)+"₽"),3)):r.createCommentVNode("",!0),r.createElementVNode("p",null,r.toDisplayString((te.total_new_price??te.price*te.amount).toFixed(2)+"₽"),1)])])])}),128)),r.createElementVNode("div",{class:"cart_modifier_arrow",onTouchstart:r.withModifiers(M,["stop"])},[...ie[1]||(ie[1]=[r.createElementVNode("p",{class:"cart_info_more"},"Скрыть",-1),r.createElementVNode("p",{class:"cart_arrow_top"},null,-1)])],32)])):r.createCommentVNode("",!0)],36)}}}),[["__scopeId","data-v-9cc87c29"]]),V0={},U0={class:"nfc_x",viewBox:"0 0 48 48"};function z0(a,l){return r.openBlock(),r.createElementBlock("svg",U0,[...l[0]||(l[0]=[r.createElementVNode("rect",{x:"8",y:"12",width:"32",height:"24",rx:"4",ry:"4",stroke:"#B00020","stroke-width":"2.4",fill:"none"},null,-1),r.createElementVNode("path",{d:"M14 16L34 30M34 16L14 30",stroke:"#B00020","stroke-width":"3","stroke-linecap":"round"},null,-1)])])}const H0=Xe(V0,[["render",z0]]),G0={},W0={style:{},"aria-hidden":"true",viewBox:"0 0 48 48",class:"nfc_ok"};function X0(a,l){return r.openBlock(),r.createElementBlock("svg",W0,[...l[0]||(l[0]=[r.createElementVNode("rect",{x:"8",y:"12",width:"32",height:"24",rx:"4",ry:"4",stroke:"#5D534B","stroke-width":"none",fill:"none"},null,-1),r.createElementVNode("path",{d:"M16 22h16m-10 6h6",stroke:"#5D534B","stroke-width":"2.4","stroke-linecap":"round"},null,-1),r.createElementVNode("path",{d:"M14 28l6 6l14-14",fill:"none",stroke:"#2ECC71","stroke-width":"3","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)])])}const $0=Xe(G0,[["render",X0]]),j0={key:0,class:"nfc_ok",viewBox:"0 0 48 48","aria-hidden":"true"},q0=r.defineComponent({__name:"CardReaderRetry",props:{styleRetry:{type:Boolean}},setup(a){return(l,i)=>a.styleRetry?r.createCommentVNode("",!0):(r.openBlock(),r.createElementBlock("svg",j0,[...i[0]||(i[0]=[r.createElementVNode("rect",{x:"8",y:"12",width:"32",height:"24",rx:"4",ry:"4"},null,-1),r.createElementVNode("path",{d:"M16 22h16m-10 6h6"},null,-1)])]))}}),Z0={class:"sheet_header"},Y0={class:"sheet_title",id:"sheetTitle"},K0={class:"sheet_body"},Q0={class:"sheet_card"},J0={class:"nfc_title"},e1={class:"lead"},t1={class:"wrapper_input_accept"},n1={key:1},r1={key:0,class:"card_phone_auth_wrapper"},i1={class:"sr_only","aria-live":"polite"},fa=r.defineComponent({__name:"CardReader",setup(a){const l=st(),i=St(),{is_OpenLoyal:s}=xe.storeToRefs(l),{itemThemes:u}=xe.storeToRefs(i),f=Mt(),m=r.ref(),p=r.ref(null),_=r.ref(""),x={wait:{text:"Лояльность",title:""},success:{text:"Стикер распознан",title:"Стикер распознан"},not_found:{text:"Стикер не распознан",title:"Стикер не распознали"}},C=r.computed({get:()=>_.value,set:q=>{_.value=q.replace(/\s/g,"")}}),y=r.computed(()=>f.currentState),I=r.computed(()=>f.isDrawerOpen),O=r.computed(()=>{var q;return((q=x[y.value])==null?void 0:q.text)||""}),T=r.computed(()=>{var q;(q=x[y.value])!=null&&q.title}),D=r.computed(()=>y.value==="success"?"Добро пожаловать!":u.value.kiosk_show_loyalty_phone_input_button?"Поднесите стикер к считывателю или войдите по номеру телефона":"Поднесите стикер к считывателю или введите номер карты вручную"),k=r.computed(()=>({ok:y.value==="success",warn:y.value==="not_found"})),P=r.computed(()=>{const q=[];return y.value==="wait"&&q.push("pulse","show-x"),y.value==="not_found"&&q.push("pulse","show-x"),y.value==="success"&&q.push("pulse","show-ok"),q}),M=r.computed(()=>y.value==="not_found"),v=r.computed(()=>y.value==="success"),W=r.computed(()=>y.value==="not_found"),X=r.computed(()=>["not_found"].includes(y.value)),Z=r.computed(()=>({wait:"Стикер не распознан. Нажмите «Повторить».",success:"Стикер распознан. Нажмите «Продолжить».",not_found:"Стикер не распознан. Нажмите «Повторить»."})[y.value]||""),F=()=>{f.closeDrawer(),s.value=!0},L=async q=>{var j,te;f.error="",p.value=null;try{const J=new yn;await J.authorizeByCard(q.trim()),await J.getProfile(),l.loadCart(),f.setState("success"),f.isDrawerOpen=!1,f.showNotification("Вы успешно авторизовались в программе лояльности!")}catch(J){f.error=((te=(j=J.response)==null?void 0:j.data)==null?void 0:te.user_friendly_message)||"Ошибка",f.setState("not_found"),p.value=C.value,C.value=""}},V=r.computed(()=>{var j;const q=(j=u.value)==null?void 0:j.kiosk_hide_manual_input_loyalty_card;return q??!1}),ie=()=>{f.setState("wait"),f.error="",C.value="",p.value=null},K=()=>{f.closeDrawer(),p.value=null,C.value=""},ee=()=>{var q,j;f.setState("wait"),(j=(q=C.value)==null?void 0:q.trim())!=null&&j.length&&L(C.value.trim())},G=q=>{q.stopPropagation(),document.activeElement!==m.value&&z()},z=()=>{r.nextTick(()=>{m.value&&(m.value.focus(),_.value&&m.value.select())})},N=q=>{const j=document.activeElement===m.value;if(!I.value||j)return;const te=q.key.toLowerCase();if(te==="backspace")return C.value=C.value.slice(0,-1);if(te==="escape")return K();if(te==="r"&&W.value)return ie();if(te==="c"&&y.value==="success")return K();if(te==="enter")return ee();C.value+=te},$={mounted(q){q==null||q.focus()}};return r.onMounted(()=>{document==null||document.addEventListener("keydown",N)}),r.onBeforeUnmount(()=>{document==null||document.removeEventListener("keydown",N)}),r.watchEffect(()=>{I.value&&(f.error="")}),(q,j)=>(r.openBlock(),r.createElementBlock(r.Fragment,null,[I.value?(r.openBlock(),r.createElementBlock("div",{key:0,class:"backdrop show",onClick:K,"aria-hidden":"true"})):r.createCommentVNode("",!0),I.value?(r.openBlock(),r.createElementBlock("section",{key:1,class:r.normalizeClass(["sheet show",{sheet_retry:W.value}]),"aria-modal":"true","aria-labelledby":"sheetTitle",onClick:G},[r.createElementVNode("header",Z0,[r.createElementVNode("div",Y0,r.toDisplayString(O.value),1),W.value?(r.openBlock(),r.createElementBlock("div",{key:0,class:r.normalizeClass(["sheet_status",k.value])},r.toDisplayString(p.value),3)):r.createCommentVNode("",!0),r.createElementVNode("button",{class:"sheet_close",onClick:K,"aria-label":"Закрыть"}," Закрыть ")]),r.createElementVNode("div",K0,[r.createElementVNode("div",Q0,[r.createElementVNode("div",{class:r.normalizeClass(["nfc",P.value])},[r.createVNode(q0,{styleRetry:X.value},null,8,["styleRetry"]),M.value?(r.openBlock(),r.createBlock(H0,{key:0})):r.createCommentVNode("",!0),r.createElementVNode("div",{class:"overlay check",style:r.normalizeStyle({display:v.value?"grid":"none"}),"aria-hidden":"true"},[r.createVNode($0)],4)],2),r.createElementVNode("h2",J0,r.toDisplayString(T.value),1),r.createElementVNode("p",e1,r.toDisplayString(D.value),1),r.createElementVNode("div",t1,[r.withDirectives(r.createElementVNode("input",{style:r.normalizeStyle(V.value?{position:"absolute",left:"-9999px"}:{}),ref_key:"cardInputManualRef",ref:m,"onUpdate:modelValue":j[0]||(j[0]=te=>C.value=te),class:"nfc_title_read_input",type:"text",placeholder:"Введите трек карты","aria-live":"polite",onKeydown:r.withKeys(ee,["enter"])},null,36),[[r.vModelText,C.value],[$]]),W.value?(r.openBlock(),r.createElementBlock("button",{key:0,class:"btn btn_ghost",onClick:ie},"Повторить")):(r.openBlock(),r.createElementBlock("div",n1,[V.value?r.createCommentVNode("",!0):(r.openBlock(),r.createElementBlock("button",{key:0,class:"btn btn_ghost",onClick:j[1]||(j[1]=te=>W.value?K:ee())},"Отправить"))]))]),y.value==="wait"&&r.unref(u).kiosk_show_loyalty_phone_input_button?(r.openBlock(),r.createElementBlock("div",r1,[r.createElementVNode("button",{class:"card_phone_auth_button",onClick:F},"Войти по номеру телефона")])):r.createCommentVNode("",!0)])]),r.createElementVNode("div",i1,r.toDisplayString(Z.value),1)],2)):r.createCommentVNode("",!0)],64))}}),o1="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxMDAiIGhlaWdodD0iMTAwIiB2aWV3Qm94PSIwIDAgMTAwIDEwMCIgcm9sZT0iaW1nIiBhcmlhLWxhYmVsPSJJTk5PIGJhbmsgY2FyZCBpY29uIj4NCiAgPGRlZnM+DQogICAgPGxpbmVhckdyYWRpZW50IGlkPSJibGFja0dyYWQiIHgxPSIwIiB5MT0iMCIgeDI9IjEiIHkyPSIxIj4NCiAgICAgIDxzdG9wIG9mZnNldD0iMCUiIHN0b3AtY29sb3I9IiMxQTFBMUEiLz4NCiAgICAgIDxzdG9wIG9mZnNldD0iMTAwJSIgc3RvcC1jb2xvcj0iIzAwMDAwMCIvPg0KICAgIDwvbGluZWFyR3JhZGllbnQ+DQoNCiAgICA8bGluZWFyR3JhZGllbnQgaWQ9InNoaW5lIiB4MT0iMCIgeTE9IjAiIHgyPSIxIiB5Mj0iMCI+DQogICAgICA8c3RvcCBvZmZzZXQ9IjAlIiBzdG9wLWNvbG9yPSIjRkZGRkZGIiBzdG9wLW9wYWNpdHk9IjAiLz4NCiAgICAgIDxzdG9wIG9mZnNldD0iNTAlIiBzdG9wLWNvbG9yPSIjRkZGRkZGIiBzdG9wLW9wYWNpdHk9IjAuMTgiLz4NCiAgICAgIDxzdG9wIG9mZnNldD0iMTAwJSIgc3RvcC1jb2xvcj0iI0ZGRkZGRiIgc3RvcC1vcGFjaXR5PSIwIi8+DQogICAgPC9saW5lYXJHcmFkaWVudD4NCg0KICAgIDxmaWx0ZXIgaWQ9InNoYWRvdyIgeD0iLTMwJSIgeT0iLTMwJSIgd2lkdGg9IjE2MCUiIGhlaWdodD0iMTYwJSI+DQogICAgICA8ZmVEcm9wU2hhZG93IGR4PSIwIiBkeT0iNiIgc3RkRGV2aWF0aW9uPSI2IiBmbG9vZC1jb2xvcj0iIzAwMCIgZmxvb2Qtb3BhY2l0eT0iMC4yNSIvPg0KICAgIDwvZmlsdGVyPg0KICA8L2RlZnM+DQoNCiAgPCEtLSBDZW50ZXJlZCBjYXJkIC0tPg0KICA8ZyB0cmFuc2Zvcm09InRyYW5zbGF0ZSg3LjUgMjMpIHJvdGF0ZSgtMTIpIiBmaWx0ZXI9InVybCgjc2hhZG93KSI+DQogICAgPCEtLSBjYXJkIGJvZHkgLS0+DQogICAgPHJlY3QgeD0iMCIgeT0iMCIgd2lkdGg9Ijg1IiBoZWlnaHQ9IjU0IiByeD0iMTAiIGZpbGw9InVybCgjYmxhY2tHcmFkKSIvPg0KDQogICAgPCEtLSB0b3Agc3RyaXBlIC0tPg0KICAgIDxyZWN0IHg9IjAiIHk9IjgiIHdpZHRoPSI4NSIgaGVpZ2h0PSI4IiByeD0iNCIgZmlsbD0iI0ZGRkZGRiIgb3BhY2l0eT0iMC4wNSIvPg0KDQogICAgPCEtLSBjaGlwIC0tPg0KICAgIDxnIHRyYW5zZm9ybT0idHJhbnNsYXRlKDEwIDI3KSI+DQogICAgICA8cmVjdCB3aWR0aD0iMTgiIGhlaWdodD0iMTUiIHJ4PSIzIiBmaWxsPSIjQ0ZBRTcwIi8+DQogICAgICA8cmVjdCB4PSIyLjUiIHk9IjMuNSIgd2lkdGg9IjEzIiBoZWlnaHQ9IjEuMiIgZmlsbD0iIzlFODM0RSIvPg0KICAgICAgPHJlY3QgeD0iMi41IiB5PSI2LjUiIHdpZHRoPSIxMyIgaGVpZ2h0PSIxLjIiIGZpbGw9IiM5RTgzNEUiLz4NCiAgICAgIDxyZWN0IHg9IjIuNSIgeT0iOS41IiB3aWR0aD0iMTMiIGhlaWdodD0iMS4yIiBmaWxsPSIjOUU4MzRFIi8+DQogICAgICA8cmVjdCB4PSI4LjUiIHk9IjAiIHdpZHRoPSIxLjUiIGhlaWdodD0iMTUiIGZpbGw9IiM5RTgzNEUiIG9wYWNpdHk9IjAuNiIvPg0KICAgIDwvZz4NCg0KICAgIDwhLS0gSU5OTyBsb2dvIC0tPg0KICAgIDx0ZXh0IHg9IjYxIiB5PSIzOSINCiAgICAgICAgICBmb250LWZhbWlseT0ic3lzdGVtLXVpLCAtYXBwbGUtc3lzdGVtLCBTZWdvZSBVSSwgUm9ib3RvLCBBcmlhbCwgc2Fucy1zZXJpZiINCiAgICAgICAgICBmb250LXNpemU9IjEzIg0KICAgICAgICAgIGZvbnQtd2VpZ2h0PSI4MDAiDQogICAgICAgICAgbGV0dGVyLXNwYWNpbmc9IjEuMiINCiAgICAgICAgICBmaWxsPSIjRkZGRkZGIg0KICAgICAgICAgIG9wYWNpdHk9IjAuOTUiDQogICAgICAgICAgdGV4dC1hbmNob3I9Im1pZGRsZSI+DQogICAgICBpbm5vDQogICAgPC90ZXh0Pg0KDQogICAgPCEtLSBzaGluZSAtLT4NCiAgICA8cGF0aCBkPSJNLTggNiBMMjUgLTMgTDk0IDQ3IEw2MCA2MiBMLTggMjUgWiIgZmlsbD0idXJsKCNzaGluZSkiLz4NCiAgPC9nPg0KPC9zdmc+",ha="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20512%20512'%20width='100'%20height='100'%20fill='none'%3e%3c!--%20Big%20QR%20corners%20(outer%20shape%20with%20inner%20cutout)%20--%3e%3cpath%20fill='currentColor'%20fill-rule='evenodd'%20d='%20M72%200H163C202.765%200%20235%2032.235%20235%2072V163C235%20202.765%20202.765%20235%20163%20235H72C32.235%20235%200%20202.765%200%20163V72C0%2032.235%2032.235%200%2072%200Z%20M102%2086H133C141.837%2086%20149%2093.163%20149%20102V133C149%20141.837%20141.837%20149%20133%20149H102C93.163%20149%2086%20141.837%2086%20133V102C86%2093.163%2093.163%2086%20102%2086Z%20'/%3e%3cpath%20fill='currentColor'%20fill-rule='evenodd'%20d='%20M349%200H440C479.765%200%20512%2032.235%20512%2072V163C512%20202.765%20479.765%20235%20440%20235H349C309.235%20235%20277%20202.765%20277%20163V72C277%2032.235%20309.235%200%20349%200Z%20M379%2086H410C418.837%2086%20426%2093.163%20426%20102V133C426%20141.837%20418.837%20149%20410%20149H379C370.163%20149%20363%20141.837%20363%20133V102C363%2093.163%20370.163%2086%20379%2086Z%20'/%3e%3cpath%20fill='currentColor'%20fill-rule='evenodd'%20d='%20M72%20277H163C202.765%20277%20235%20309.235%20235%20349V440C235%20479.765%20202.765%20512%20163%20512H72C32.235%20512%200%20479.765%200%20440V349C0%20309.235%2032.235%20277%2072%20277Z%20M102%20363H133C141.837%20363%20149%20370.163%20149%20379V410C149%20418.837%20141.837%20426%20133%20426H102C93.163%20426%2086%20418.837%2086%20410V379C86%20370.163%2093.163%20363%20102%20363Z%20'/%3e%3c!--%20Small%20modules%20--%3e%3crect%20x='277'%20y='277'%20width='86'%20height='86'%20rx='26'%20fill='currentColor'/%3e%3crect%20x='426'%20y='277'%20width='86'%20height='86'%20rx='28'%20fill='currentColor'/%3e%3crect%20x='277'%20y='426'%20width='86'%20height='86'%20rx='26'%20fill='currentColor'/%3e%3c!--%20Center%20dot%20--%3e%3ccircle%20cx='394.17'%20cy='394.17'%20r='33'%20fill='currentColor'/%3e%3c/svg%3e",s1=["src"],a1={class:"header_description"},l1=Xe(r.defineComponent({__name:"PaymentBoxes",props:{configPage:{},comment:{},cartItems:{},isAuthorized:{type:Boolean},orderId:{default:null},signal:{},provider:{}},emits:["select"],setup(a,{emit:l}){const i=a,s=l,u=Mt(),f=Lt(),{selectedProvider:m,isButtonDisabled:p}=xe.storeToRefs(u),{isAddToCard:_}=xe.storeToRefs(f),x={default:o1,SBP:ha},C=async()=>{m.value=i.provider;const I=i.provider.front_type;I&&(_.value=!1,p.value=!0,s("select",I),lo(i.orderId,i.provider.type))},y=r.computed(()=>x[i.provider.front_type]||x.default);return(I,O)=>(r.openBlock(),r.createElementBlock("div",{class:"payment_boxes_wrapper",onClick:C},[r.createElementVNode("img",{class:"picture",src:y.value},null,8,s1),r.createElementVNode("div",a1,[r.createElementVNode("b",null,r.toDisplayString(a.provider.name),1),r.createElementVNode("p",null,r.toDisplayString(a.provider.description),1)]),r.createVNode(wr)]))}}),[["__scopeId","data-v-c4a0ed62"]]),c1={key:0,class:"wrapper_cart_payment"},d1={class:"wrapper_paid"},u1={class:"to_be_paid"},f1=Xe(r.defineComponent({__name:"CartPayment",props:{configPage:{},comment:{},cartItems:{},isAuthorized:{type:Boolean},orderId:{},signal:{}},emits:["selectPayment"],setup(a,{emit:l}){const i=Mt(),s=st(),u=a,{totalPrice_lib:f,countBonus:m}=xe.storeToRefs(s),p=l,_=C=>{p("selectPayment",C)},x=()=>{p("selectPayment","")};return(C,y)=>r.unref(i).providerTypes.length>1?(r.openBlock(),r.createElementBlock("div",c1,[y[2]||(y[2]=r.createElementVNode("h2",null,"Выберите способ оплаты",-1)),y[3]||(y[3]=r.createElementVNode("p",{class:"description_payment"},"Можно изменить позже до оплаты",-1)),(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(r.unref(i).providerTypes,(I,O)=>(r.openBlock(),r.createElementBlock("div",{key:O},[r.createVNode(l1,{provider:I,"config-page":u.configPage,comment:u.comment,"cart-items":u.cartItems,"is-authorized":u.isAuthorized,"order-id":u.orderId,signal:u.signal,onSelect:_},null,8,["provider","config-page","comment","cart-items","is-authorized","order-id","signal"])]))),128)),r.createElementVNode("div",d1,[r.createElementVNode("p",u1,[y[0]||(y[0]=r.createTextVNode("К оплате ",-1)),r.createVNode(ft,{price:r.unref(f)-r.unref(m),fixedFloat:2},null,8,["price"]),y[1]||(y[1]=r.createTextVNode(" ₽",-1))]),r.createVNode(an,{textButtonDefault:"Назад",onClick:x,class:"btn_payment"})])])):r.createCommentVNode("",!0)}}),[["__scopeId","data-v-f7657882"]]),h1={class:"start_page"},m1=["src"],g1={class:"wrap"},p1={class:"wrap_box"},x1={class:"title_fiscal_order"},_1={class:"wrapper_accept"},w1={ref:"barRef",class:"bar_complete","aria-hidden":"true"},C1=Xe(r.defineComponent({__name:"CartCompleteKioskSuccess",props:{mediaUrl:{},orderNumber:{}},setup(a){const l=st(),i=Mt(),s=Lt(),u=St(),{cartProducts_lib:f}=xe.storeToRefs(l),{orderNumber:m,orderCompleted_lib:p,selectedOrderType:_}=xe.storeToRefs(i),{is_startPage:x}=xe.storeToRefs(s),{mediaUrl:C}=Tn(()=>u.itemThemes.kiosk_preloader?"preloader":null),y=ke.useRouter(),I=ke.useRoute();let O=null;r.onMounted(()=>{O=setTimeout(()=>{x.value=!u.itemThemes.kiosk_disable_lock_screen,_.value=null,l.isOrderTypeSubmited=!1,y.replace(`/${I.params.orgId}`)},1e4)});const T=()=>{mr(["cart","authTokensAccess","authTokensRefresh"]),f.value=[],p.value=null,_.value=null,l.isOrderTypeSubmited=!1,i.clearCard(),l.profile=null,y.replace(`/${I.params.orgId}`)};return r.onUnmounted(()=>{O&&clearInterval(O)}),(D,k)=>(r.openBlock(),r.createElementBlock("div",h1,[r.withDirectives((r.openBlock(),r.createElementBlock("video",{loop:"",autoplay:"",muted:"",playsinline:"",key:r.unref(C)},[r.createElementVNode("source",{src:r.unref(C)||"",type:"video/webm"},null,8,m1)])),[[r.unref(Xr)]]),k[4]||(k[4]=r.createElementVNode("div",{class:"start_img_black"},null,-1)),r.createElementVNode("div",g1,[r.createElementVNode("div",p1,[k[1]||(k[1]=r.createElementVNode("div",{class:"icon","aria-hidden":"true"},[r.createElementVNode("svg",{viewBox:"0 0 24 24"},[r.createElementVNode("path",{d:"M20 6L9 17l-5-5"})])],-1)),k[2]||(k[2]=r.createElementVNode("h1",null," Заказ успешно оплачен ",-1)),r.createElementVNode("p",x1,"№ "+r.toDisplayString(r.unref(m)),1),k[3]||(k[3]=r.createElementVNode("p",{class:"title_fiscal_completed"},"Спасибо! Заказ передан в работу.",-1)),r.createElementVNode("div",_1,[r.createElementVNode("button",{class:"btn","aria-label":"Новый заказ",onClick:T},[k[0]||(k[0]=r.createElementVNode("span",{class:"label"},"Новый заказ",-1)),r.createElementVNode("span",w1,null,512)])])])])]))}}),[["__scopeId","data-v-79c00acf"]]),E1={};function y1(a,l){return l[0]||(l[0]=r.createStaticVNode('<div class="topProgress" aria-hidden="true" data-v-3e03a6dc><i data-v-3e03a6dc></i></div><h1 class="title_fiscal" data-v-3e03a6dc>Сейчас будет распечатан фискальный чек</h1><p class="reminder" data-v-3e03a6dc>Не забудьте <b data-v-3e03a6dc>оплатить заказ</b> после печати.</p><div class="stage" aria-hidden="true" data-v-3e03a6dc><div class="printer" data-v-3e03a6dc><div class="led" data-v-3e03a6dc></div><div class="slot" data-v-3e03a6dc></div><div class="receipt" data-v-3e03a6dc><div class="tear" data-v-3e03a6dc></div><div class="line accent" data-v-3e03a6dc></div><div class="line" data-v-3e03a6dc></div><div class="line sm" data-v-3e03a6dc></div><div class="line" data-v-3e03a6dc></div><div class="line sm" data-v-3e03a6dc></div><div class="line" data-v-3e03a6dc></div><div class="line sm" data-v-3e03a6dc></div></div></div></div>',4))}const b1=Xe(E1,[["render",y1],["__scopeId","data-v-3e03a6dc"]]),A1={},S1={class:"center"};function I1(a,l){return r.openBlock(),r.createElementBlock("div",S1,[...l[0]||(l[0]=[r.createStaticVNode('<div class="stack" data-v-f0859fd1><h1 class="title_fiscal" data-v-f0859fd1>Приложите карту для оплаты</h1><p class="reminder" data-v-f0859fd1>Держите карту у терминала, пока операция не завершится.</p><div class="stageCard" aria-hidden="true" data-v-f0859fd1><div class="waves" data-v-f0859fd1><span data-v-f0859fd1></span><span data-v-f0859fd1></span><span data-v-f0859fd1></span></div><div class="nfc" data-v-f0859fd1><svg viewBox="0 0 24 24" data-v-f0859fd1><path d="M6 8c2.5 2.5 2.5 5.5 0 8" data-v-f0859fd1></path><path d="M10 6c4 4 4 8 0 12" data-v-f0859fd1></path><path d="M14 4c5.5 5.5 5.5 11 0 16" data-v-f0859fd1></path></svg></div><div class="card" data-v-f0859fd1><div class="logo" data-v-f0859fd1>inno.</div><div class="chip" data-v-f0859fd1></div><div class="digits" data-v-f0859fd1>4815 1623 4200 0900</div><div class="holder" data-v-f0859fd1>Гость</div></div></div></div>',1)])])}const N1=Xe(A1,[["render",I1],["__scopeId","data-v-f0859fd1"]]);/*!
5
+ `):" "+js(m[0]):"as no adapter specified";throw new Pe("There is no suitable adapter to dispatch the request "+p,"ERR_NOT_SUPPORT")}return u}const qs={getAdapter:Ad,adapters:oo};function so(a){if(a.cancelToken&&a.cancelToken.throwIfRequested(),a.signal&&a.signal.aborted)throw new _r(null,a)}function Zs(a){return so(a),a.headers=Yt.from(a.headers),a.data=io.call(a,a.transformRequest),["post","put","patch"].indexOf(a.method)!==-1&&a.headers.setContentType("application/x-www-form-urlencoded",!1),qs.getAdapter(a.adapter||Hr.adapter,a)(a).then(function(o){return so(a),o.data=io.call(a,a.transformResponse,o),o.headers=Yt.from(o.headers),o},function(o){return Ds(o)||(so(a),o&&o.response&&(o.response.data=io.call(a,a.transformResponse,o.response),o.response.headers=Yt.from(o.response.headers))),Promise.reject(o)})}const Ys="1.13.2",gi={};["object","boolean","number","function","string","symbol"].forEach((a,l)=>{gi[a]=function(o){return typeof o===a||"a"+(l<1?"n ":" ")+a}});const Ks={};gi.transitional=function(l,i,o){function u(f,m){return"[Axios v"+Ys+"] Transitional option '"+f+"'"+m+(o?". "+o:"")}return(f,m,p)=>{if(l===!1)throw new Pe(u(m," has been removed"+(i?" in "+i:"")),Pe.ERR_DEPRECATED);return i&&!Ks[m]&&(Ks[m]=!0,console.warn(u(m," has been deprecated since v"+i+" and will be removed in the near future"))),l?l(f,m,p):!0}},gi.spelling=function(l){return(i,o)=>(console.warn(`${o} is likely a misspelling of ${l}`),!0)};function Sd(a,l,i){if(typeof a!="object")throw new Pe("options must be an object",Pe.ERR_BAD_OPTION_VALUE);const o=Object.keys(a);let u=o.length;for(;u-- >0;){const f=o[u],m=l[f];if(m){const p=a[f],_=p===void 0||m(p,f,a);if(_!==!0)throw new Pe("option "+f+" must be "+_,Pe.ERR_BAD_OPTION_VALUE);continue}if(i!==!0)throw new Pe("Unknown option "+f,Pe.ERR_BAD_OPTION)}}const pi={assertOptions:Sd,validators:gi},Tn=pi.validators;let ir=class{constructor(l){this.defaults=l||{},this.interceptors={request:new Rs,response:new Rs}}async request(l,i){try{return await this._request(l,i)}catch(o){if(o instanceof Error){let u={};Error.captureStackTrace?Error.captureStackTrace(u):u=new Error;const f=u.stack?u.stack.replace(/^.+\n/,""):"";try{o.stack?f&&!String(o.stack).endsWith(f.replace(/^.+\n.+\n/,""))&&(o.stack+=`
6
+ `+f):o.stack=f}catch{}}throw o}}_request(l,i){typeof l=="string"?(i=i||{},i.url=l):i=l||{},i=rr(this.defaults,i);const{transitional:o,paramsSerializer:u,headers:f}=i;o!==void 0&&pi.assertOptions(o,{silentJSONParsing:Tn.transitional(Tn.boolean),forcedJSONParsing:Tn.transitional(Tn.boolean),clarifyTimeoutError:Tn.transitional(Tn.boolean)},!1),u!=null&&(te.isFunction(u)?i.paramsSerializer={serialize:u}:pi.assertOptions(u,{encode:Tn.function,serialize:Tn.function},!0)),i.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?i.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:i.allowAbsoluteUrls=!0),pi.assertOptions(i,{baseUrl:Tn.spelling("baseURL"),withXsrfToken:Tn.spelling("withXSRFToken")},!0),i.method=(i.method||this.defaults.method||"get").toLowerCase();let m=f&&te.merge(f.common,f[i.method]);f&&te.forEach(["delete","get","head","post","put","patch","common"],T=>{delete f[T]}),i.headers=Yt.concat(m,f);const p=[];let _=!0;this.interceptors.request.forEach(function(D){typeof D.runWhen=="function"&&D.runWhen(i)===!1||(_=_&&D.synchronous,p.unshift(D.fulfilled,D.rejected))});const x=[];this.interceptors.response.forEach(function(D){x.push(D.fulfilled,D.rejected)});let C,y=0,I;if(!_){const T=[Zs.bind(this),void 0];for(T.unshift(...p),T.push(...x),I=T.length,C=Promise.resolve(i);y<I;)C=C.then(T[y++],T[y++]);return C}I=p.length;let B=i;for(;y<I;){const T=p[y++],D=p[y++];try{B=T(B)}catch(k){D.call(this,k);break}}try{C=Zs.call(this,B)}catch(T){return Promise.reject(T)}for(y=0,I=x.length;y<I;)C=C.then(x[y++],x[y++]);return C}getUri(l){l=rr(this.defaults,l);const i=Fs(l.baseURL,l.url,l.allowAbsoluteUrls);return ks(i,l.params,l.paramsSerializer)}};te.forEach(["delete","get","head","options"],function(l){ir.prototype[l]=function(i,o){return this.request(rr(o||{},{method:l,url:i,data:(o||{}).data}))}}),te.forEach(["post","put","patch"],function(l){function i(o){return function(f,m,p){return this.request(rr(p||{},{method:l,headers:o?{"Content-Type":"multipart/form-data"}:{},url:f,data:m}))}}ir.prototype[l]=i(),ir.prototype[l+"Form"]=i(!0)});let Id=class cl{constructor(l){if(typeof l!="function")throw new TypeError("executor must be a function.");let i;this.promise=new Promise(function(f){i=f});const o=this;this.promise.then(u=>{if(!o._listeners)return;let f=o._listeners.length;for(;f-- >0;)o._listeners[f](u);o._listeners=null}),this.promise.then=u=>{let f;const m=new Promise(p=>{o.subscribe(p),f=p}).then(u);return m.cancel=function(){o.unsubscribe(f)},m},l(function(f,m,p){o.reason||(o.reason=new _r(f,m,p),i(o.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(l){if(this.reason){l(this.reason);return}this._listeners?this._listeners.push(l):this._listeners=[l]}unsubscribe(l){if(!this._listeners)return;const i=this._listeners.indexOf(l);i!==-1&&this._listeners.splice(i,1)}toAbortSignal(){const l=new AbortController,i=o=>{l.abort(o)};return this.subscribe(i),l.signal.unsubscribe=()=>this.unsubscribe(i),l.signal}static source(){let l;return{token:new cl(function(u){l=u}),cancel:l}}};function Nd(a){return function(i){return a.apply(null,i)}}function Td(a){return te.isObject(a)&&a.isAxiosError===!0}const ao={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(ao).forEach(([a,l])=>{ao[l]=a});function Qs(a){const l=new ir(a),i=ms(ir.prototype.request,l);return te.extend(i,ir.prototype,l,{allOwnKeys:!0}),te.extend(i,l,null,{allOwnKeys:!0}),i.create=function(u){return Qs(rr(a,u))},i}const Ze=Qs(Hr);Ze.Axios=ir,Ze.CanceledError=_r,Ze.CancelToken=Id,Ze.isCancel=Ds,Ze.VERSION=Ys,Ze.toFormData=ui,Ze.AxiosError=Pe,Ze.Cancel=Ze.CanceledError,Ze.all=function(l){return Promise.all(l)},Ze.spread=Nd,Ze.isAxiosError=Td,Ze.mergeConfig=rr,Ze.AxiosHeaders=Yt,Ze.formToJSON=a=>Os(te.isHTMLForm(a)?new FormData(a):a),Ze.getAdapter=qs.getAdapter,Ze.HttpStatusCode=ao,Ze.default=Ze;const{Axios:sp,AxiosError:ap,CanceledError:lp,isCancel:cp,CancelToken:dp,VERSION:up,all:fp,Cancel:hp,isAxiosError:mp,spread:gp,toFormData:pp,AxiosHeaders:xp,HttpStatusCode:_p,formToJSON:wp,getAdapter:Cp,mergeConfig:Ep}=Ze,Wr=_e.defineStore("modulesLib",()=>{const a=r.ref(!1),l=r.ref({textNotification:""});return{is_notification_lib:a,notificationData_lib:l,showNotification:o=>{a.value=!0,l.value.textNotification=o}}}),kd=["ping","pong"],Rd=["confirmed","waiting_payment","partial_paid"],Bd=["cancelled"],Vn=_e.defineStore("table-data",()=>{const a=ke.useRoute(),l=ke.useRouter(),i=ot(),o=Wr(),u=r.ref(1),f=r.ref(1),m=xt.useLocalStorage("appMode",null,{shallow:!0}),p=xt.useLocalStorage("tableData",null,{shallow:!0,serializer:xt.StorageSerializers.object}),_=xt.useLocalStorage("tableId",null),x=xt.useLocalStorage("orgID",null),C=r.computed({get:()=>{var L;return(L=k.value)==null?void 0:L.id},set:L=>{_.value=L}}),y=r.computed(()=>{var L;return(L=a.query.table_id)==null?void 0:L.toString()}),I=r.computed(()=>{var L;return x.value||((L=a.params.orgId)==null?void 0:L.toString())}),B=r.computed(()=>{var L;return((L=k.value)==null?void 0:L.branch.work_mode)==="table-service"}),T=r.computed(()=>{var L;return B.value&&!!((L=k.value)!=null&&L.order)});let D=null;const k=xt.computedAsync(async L=>{var K,ee,G;u.value;const F=new AbortController;if(L(()=>F.abort()),!I.value||!((K=i.config_lib)!=null&&K.area))return null;const re=y.value||_.value;if(!re)return null;try{return{...(await Ze.get(`/org_unit/${I.value}/table/${re}/`,{baseURL:`https://${i.config_lib.area}/api/`,signal:F.signal})).data,__v:u.value}}catch(W){return Ze.isCancel(W)?null:m.value==="table-tent"?p.value:re===(D==null?void 0:D.id)?D:(D=null,o.showNotification(((G=(ee=W==null?void 0:W.response)==null?void 0:ee.data)==null?void 0:G.user_friendly_message)||"Ошибка при загрузке данных стола"),null)}},null),P=xt.computedAsync(async L=>{var re;f.value;const F=new AbortController;if(L(()=>F.abort()),!B.value||!((re=k.value)!=null&&re.order))return null;try{const K=await Ze.get(`/order/${k.value.order}/`,{baseURL:`https://${i.config_lib.area}/api/`,signal:F.signal});return K.data.items=K.data.items.map(ee=>({...ee,idSystem:crypto.randomUUID()})),{...K.data,__v:f.value}}catch{return null}},null);let M=null;const v=L=>{M&&(M==null||M.close(),M=null),L&&(M=Fr(`wss://${i.config_lib.area}/ws/order/${L.id}/`),M.on("message",F=>{kd.includes(F==null?void 0:F.type)||((F==null?void 0:F.method)==="update_order_status"&&Bd.includes(F.params.status)&&o.showNotification("Ваш заказ был отменён"),H())}),M.connect())},j=()=>{u.value++},H=()=>{f.value++},Z=L=>{L&&(D=L,m.value==="table-tent"&&(p.value=L),_.value!==L.id&&(_.value=L.id))},V=(L,F)=>{var re,K;if((L==null?void 0:L.id)!==(F==null?void 0:F.id)&&v(L),L&&!Rd.includes(L.status)&&j(),!L&&F&&((re=F.table)==null?void 0:re.id)===((K=k.value)==null?void 0:K.id))return l.replace({name:"order-ts-status",params:{id:F.id}})};return r.watch(P,V,{immediate:!0}),r.watch(k,Z,{immediate:!0}),{id:C,isTableService:B,hasOrder:T,data:k,order:P,refresh:j,refreshOrder:H}});let kn=null,jt=null;function or(a){a&&a.close(!0)}async function lo(a,l){const i=Mt(),o=ot(),u=yn.create();try{const f=await u.initPaymentLink(a,l);return i.paymentCostQR=o.totalPrice_lib-o.countBonus,i.linkQR=f.url,jt==null||jt.deleteCart(null,jt==null?void 0:jt.is_requestKiosk),f}catch(f){throw i.isButtonDisabled=!1,i.showNotification(f==null?void 0:f.response.data.user_friendly_message),f}}function Od(a,l,i){const o=Ct();if(a!=null&&a.params){if(a.params.status==="sent"&&o.itemThemes.kiosk_proceed_to_payment_text&&l.showNotification(o.itemThemes.kiosk_proceed_to_payment_text),a.error){l.showNotification(a.error),un(l,null),uo(l);return}i(a,l)}}function co(a,l){const i=Mt(),o=ot();return a.params.new_discounts&&(i.extraDiscount=Number(a.params.new_total_cost)-l.initialCartPrice,o.totalPrice_lib=Number(a.params.new_total_cost),l.showNotification("К заказу были добавлены скидки")),!0}const un=(a,l)=>{a.updateOrderStatus&&a.updateOrderStatus(l)},Md=a=>{a.loadCart&&a.loadCart()},xi=a=>{a.resetBonuses&&a.resetBonuses()},Dd=a=>{a.resetDiscounts&&a.resetDiscounts()},uo=a=>{a.closeWebSocket&&a.closeWebSocket()},Js=(a,l,i,o)=>{var m;if(((m=a.params)==null?void 0:m.need_pay)===!1)return;const u=l.ws||i;yn.create().orderPay(a.params.order_id||"").then(p=>{l.setOrderNumber&&l.setOrderNumber(p.data.order_number)}).catch(p=>{(l.errorHandler||o).handleOrderPayError(p,{...l,closeWebSocket:()=>or(u)})})},fo=(a,l,i)=>{const o=a.ws||l;(a.errorHandler||i).handleOrderError({...a,closeWebSocket:()=>or(o)})},vd=(a,l)=>{const i=Mt(),o=i.getCurrentPaymentMethodId();if(!o||!Un.getConfig(o)||!Un.isMethodAvailable(o,a))return null;const f=Un.createHandler(o);if(!f)return null;const m=i.createPaymentHandler(a,l,o);return m?{handler:f,config:m.config}:null},Pd=a=>{if(!jt)return;const l=jt.context,i=jt.is_requestKiosk,o=vd(l,i);if(!o){console.warn("handleWebSocketMessageWithDynamicHandler: не удалось получить handler");return}const{handler:u,config:f}=o,m={...f,...jt};Od(a,m,u.handleWebSocketStatus)};async function Ld(a,l,i){var x,C;const o=Vn(),{is_requestKiosk:u}=l,{comment:f,is_authorized:m,signal:p}=i;l.setButtonDisabled(!0);const _=yn.create();try{const y=await _.createOrder(a,o.id,u,f,m,p);if((y==null?void 0:y.status)===201&&((x=y==null?void 0:y.data)!=null&&x.id)){const I=y.data.id,B={...l,signal:p};jt=B;const D=`wss://${B.area||""}/ws/order/${I}/`;kn=Fr(D,{signal:p});const k=()=>{console.warn("WebSocket connection opened (centralized mode)")},P=v=>{var j;console.error("WebSocket error (centralized mode):",v),or(kn),kn=null,jt=null,l.setButtonDisabled(!1),(j=l.errorHandler)==null||j.handlePaymentError(v,B)},M=v=>{Pd(v)};kn.on("open",k),kn.on("message",M),kn.on("error",P),kn.connect(),jt.ws=kn,jt.closeWebSocket=()=>{or(kn),kn=null,jt=null}}return y}catch(y){throw Ze.isCancel(y)||((C=l.errorHandler)==null||C.handleCreateOrderError(y,l),l.setButtonDisabled(!1)),y}}const ea=a=>{var l,i;return((i=(l=a==null?void 0:a.response)==null?void 0:l.data)==null?void 0:i.user_friendly_message)||null};function _i(){const a=Mt(),l=Vn();return{handlePaymentError(i,o){var f,m,p,_,x,C;const u=ea(i);un(o,null),Md(o),u?(o.showNotification(u),uo(o),o.is_requestKiosk&&((m=o.orderErrors)!=null&&m.includes((f=i.response)==null?void 0:f.status))&&(o.cartCleanup?o.cartCleanup.cleanupAndNavigate("retryPage",o.is_requestKiosk):o.deleteCart("retryPage",o.is_requestKiosk),o.ws.close(!0)),l.isTableService?o.resetStores():(xi(o),o.context==="qr"&&o.navigation?o.navigation.redirectToError():o.context==="qr"&&o.redirect&&(a.isButtonDisabled=!1,o.redirect(`/${((_=(p=o.route)==null?void 0:p.params)==null?void 0:_.orgId)||""}/errorPayment`)))):o.context==="qr"&&(xi(o),o.navigation?o.navigation.redirectToError():o.redirect&&o.redirect(`/${((C=(x=o.route)==null?void 0:x.params)==null?void 0:C.orgId)||""}/errorPayment`)),a.isButtonDisabled=!1},handleOrderPayError(i,o){var f,m,p,_;const u=ea(i);u&&(o.showNotification(u),uo(o),o.is_requestKiosk?((m=o.orderErrors)!=null&&m.includes((f=i.response)==null?void 0:f.status)&&(o.cartCleanup.cleanupAndNavigate("retryPage",o.is_requestKiosk),o.deleteCart("retryPage",o.is_requestKiosk)),un(o,null)):(xi(o),o.navigation?o.navigation.redirectToError():o.redirect&&o.redirect(`/${((_=(p=o.route)==null?void 0:p.params)==null?void 0:_.orgId)||""}/errorPayment`),un(o,null)))},handleOrderError(i){var o,u;i.is_requestKiosk?(i.cartCleanup?i.cartCleanup.cleanupAndNavigate("retryPage",i.is_requestKiosk):i.deleteCart("retryPage",i.is_requestKiosk),i.ws.close(!0)):l.isTableService?(a.isCreateButtonVisible=!0,i.showNotification("Ошибка создания заказа. Пожалуйста, попробуйте еще раз"),Dd(i)):(xi(i),i.navigation?i.navigation.redirectToError():i.redirect&&(a.isButtonDisabled=!1,i.redirect(`/${((u=(o=i.route)==null?void 0:o.params)==null?void 0:u.orgId)||""}/errorPayment`)))},handleCreateOrderError(i,o){var m,p,_,x,C,y;const{is_requestKiosk:u}=o,f=o.route.params.orgId;u?(((m=i==null?void 0:i.response)==null?void 0:m.status)===403&&((p=o.on403Kiosk)==null||p.call(o),(_=o.redirect)==null||_.call(o,`/${f}/retryPage`)),o.deleteCart("retryPage",u)):l.isTableService?o.showNotification(((C=(x=i==null?void 0:i.response)==null?void 0:x.data)==null?void 0:C.user_friendly_message)||"Ошибка создания заказа"):(y=o.redirect)==null||y.call(o,`/${f}/errorPayment`)}}}const Fd=()=>{const a=Mt();let l=null;const i=_i(),o=(u,f)=>{var p,_,x,C;const m=(p=u.params)==null?void 0:p.status;if((_=u.params)!=null&&_.number&&(a.orderNumber=(x=u.params)==null?void 0:x.number),m==="sent")co(u,f),a.isButtonDisabled=!1;else if(m==="waiting_for_fiscalization")un(f,1);else if(m==="payment_initiation_retry"||m==="fiscalized")Js(u,f,l,i);else if(m==="payment_initiation")un(f,2);else if(m==="paid"){un(f,3);const y=f.ws||l;or(y),localStorage.removeItem("cart")}else(C=f.orderErrors)!=null&&C.includes(m)&&fo(f,l,i)};return{handleWebSocketStatus(u,f){o(u,f)}}};function Vd(){const a=Mt();let l=null;const i=_i(),o=(u,f)=>{var p,_,x,C;const m=(p=u.params)==null?void 0:p.status;if((_=u.params)!=null&&_.number&&(a.orderNumber=(x=u.params)==null?void 0:x.number),m==="sent")co(u,f),a.isButtonDisabled=!1;else if(m==="sent_fiscalization")un(f,1);else if(m==="waiting_payment")un(f,4);else if(m==="paid"){un(f,3);const y=f.ws||l;or(y),localStorage.removeItem("cart")}else(C=f.orderErrors)!=null&&C.includes(m)&&(a.isButtonDisabled=!1,fo(f,l,i))};return{handleWebSocketStatus(u,f){o(u,f)}}}const Ud=()=>{const a=Mt();let l=null;const i=_i(),o=(u,f)=>{var p,_;const m=(p=u.params)==null?void 0:p.status;if(m==="sent")co(u,f),a.isButtonDisabled=!1;else if(m==="payment_initiation_retry"||m==="fiscalized")Js(u,f,l,i);else if(m==="payment_initiation")un(f,2);else if(m==="paid"){un(f,3);const x=f.ws||l;or(x),localStorage.removeItem("cart")}else(_=f.orderErrors)!=null&&_.includes(m)&&(a.isButtonDisabled=!1,fo(f,l,i))};return{handleWebSocketStatus(u,f){o(u,f)}}};class Un{static initialize(){this.register({id:"TERMINAL_BASE",method:"TERMINAL",handlerFactory:Fd,availableContexts:["kiosk"]}),this.register({id:"YOOKASSA_BASE",method:"YOOKASSA",handlerFactory:Ud,availableContexts:["qr","tableservice"]}),this.register({id:"SBP",method:"YOOKASSA",handlerFactory:Vd,availableContexts:["kiosk"]})}static register(l){this.methods.set(l.id,l)}static getConfig(l){return this.methods.get(l)??null}static getAvailableMethods(l){return Array.from(this.methods.entries()).filter(([i,o])=>o.availableContexts.includes(l)).map(([i])=>i)}static isMethodAvailable(l,i){const o=this.getConfig(l);return o?o.availableContexts.includes(i):!1}static createHandler(l){const i=this.getConfig(l);return i?i.handlerFactory():(console.warn(`PaymentMethodRegistry: метод оплаты ${l} не зарегистрирован`),null)}}Be(Un,"methods",new Map),Un.initialize();function zd(a){return{cleanupAndNavigate(l,i){a.deleteCart(l,i)},cleanup(l){a.deleteCart(null,l)},clearTokens(){a.deleteCart(null,!0)},resetStores(){a.resetStores()}}}function Hd(a){var i,o;const l=((o=(i=a.route)==null?void 0:i.params)==null?void 0:o.orgId)||"";return{redirectToError(){const u=`/${l}/errorPayment`;a.redirect?a.redirect(u):a.router&&a.router.push(u)},redirectToSuccess(u){const f=u?`/${l}/${u}`:`/${l}/profile`;a.redirect?a.redirect(f):a.router&&a.router.push(f)},redirect(u){a.redirect?a.redirect(u):a.router&&a.router.push(u)},getErrorPath(){return`/${l}/errorPayment`},getSuccessPath(){return`/${l}/profile`}}}const Mt=_e.defineStore("cartLib",()=>{const a=ke.useRouter(),l=ke.useRoute(),i=Ct(),o=ot(),{config_lib:u,countBonus:f,totalPrice_lib:m,initialCartPrice_lib:p,is18Allowed:_}=_e.storeToRefs(o),{itemThemes:x}=_e.storeToRefs(i),C=r.ref(!1),y=r.ref(""),I=r.ref(null),B=r.ref("wait"),T=r.ref(!0),D=r.ref(0),k=r.ref(""),P=r.ref([]),M=r.ref([]),v=r.ref(),j=r.ref(0),H=r.ref(!1),Z=r.ref(),V=r.ref(null),L=r.ref(["failed_payment","failed_after_paid","failed","failed_after_sent","failed_after_sent_fiscalization","payment_initiation_retry","cancelled","failed_after_payment_initiation"]),F=r.ref(),re=r.computed({get:()=>P.value||[],set:Ae=>{(Ae==null?void 0:Ae.length)===1&&(F.value=Ae[0]),P.value=Ae}}),K=r.ref(!1),ee=r.ref(null),G=r.ref(0),W=r.ref(!1),N=r.ref({textNotification:""}),X=Ae=>{W.value=!0,N.value.textNotification=Ae},$=()=>{var Ae,Ke;return(Ae=v.value)!=null&&Ae.front_type?v.value.front_type:((Ke=M.value[0])==null?void 0:Ke.front_type)||null},q=(Ae,Ke,st)=>{var Se;const He=st??((Se=M.value[0])==null?void 0:Se.front_type);if(!He)return console.warn("Не удалось определить метод оплаты"),null;const At=Un.getConfig(He);if(!At||!Un.isMethodAvailable(He,Ae))return console.warn(`Метод ${He} недоступен для контекста ${Ae}`),null;const Te=Un.createHandler(He);return Te?(Z.value=J(At.method,Ae,Ke),{handler:Te,config:Z.value}):(console.warn(`Не удалось создать обработчик для метода ${He}`),null)},J=(Ae,Ke,st)=>{const He={method:Ae,context:Ke,is_requestKiosk:st,router:a,route:l,orderErrors:L.value,area:u.value.area,totalPrice:m,initialCartPrice:p,showNotification:X,deleteCart:nt,resetStores:ue,redirect:Ve=>a.push(Ve),updateOrderStatus:Ve=>{ee.value=Ve},setOrderNumber:Ve=>{V.value=Ve},loadCart:()=>o.loadCart(),resetBonuses:()=>{f.value=0}},At=_i(),Te=zd(He),Se=Hd(He);return{...He,errorHandler:At,cartCleanup:Te,navigation:Se}},le=r.computed(()=>!!I.value),se=Ae=>{B.value=Ae},oe=Ae=>{I.value=Ae},ge=()=>{x.value.kiosk_show_loyalty_card_button&&x.value.kiosk_show_loyalty_phone_input_button?C.value=!0:!x.value.kiosk_show_loyalty_card_button&&x.value.kiosk_show_loyalty_phone_input_button?o.is_OpenLoyal=!0:C.value=!0,B.value="wait",y.value=""},Ee=()=>{C.value=!1,B.value="wait",y.value=""},Fe=()=>{I.value=null,y.value="",B.value="wait",Ee()},ue=()=>{K.value=!1,ee.value=null},nt=(Ae=null,Ke=!1)=>{o.cartProducts_lib=[],o.is_OpenLoyal=!1,gr(["cart"]),Ke&&(gr(["authTokensAccess","authTokensRefresh","user"]),o.profile=null,sessionStorage.removeItem("is_adult"),_.value=!1),Ae&&a.push(`/${l.params.orgId}/${Ae}`)};return{isButtonDisabled:K,orderCompleted_lib:ee,extraDiscount:D,orderNumber:V,is_notification_lib:W,notificationData_lib:N,count:G,guestInfo:I,error:y,isDrawerOpen:C,currentState:B,isAuthorized:le,isCreateButtonVisible:T,linkQR:k,orderTypes:re,providerTypes:M,is_paymentCart:H,selectedOrderType:F,selectedProvider:v,configPayment:Z,paymentCostQR:j,deleteCart:nt,setGuestInfo:oe,setState:se,openDrawer:ge,closeDrawer:Ee,clearCard:Fe,showNotification:X,createPaymentHandler:q,getCurrentPaymentMethodId:$,getAvailablePaymentMethods:Ae=>Un.getAvailableMethods(Ae)}}),Lt=_e.defineStore("cardLib",()=>{var ee;const a=()=>({openCard:null,currentModifier:null,groupModifiers:[],groupModifiersSelected:[],groupCurrentOpen:null,isModifiedAmount:!1,selectedSize:{},productSizes:[],addedProducts:[],plusButtonsRefs:[],modalCount:1,isSectionModifier:!1,isAnimationFly:!0,textErrorRequaired:"",prevLast:{}}),l=Ct(),i=r.ref(a()),o=()=>i.value=a(),u=r.ref(!1),f=r.ref(!1),m=r.ref(!1),p=r.ref(),_=r.ref([]),x=r.ref({id:null,visible:!1}),C=r.ref(!((ee=l.itemThemes)!=null&&ee.kiosk_disable_lock_screen)),y=r.computed(()=>{const G=i.value.groupModifiersSelected.findIndex(W=>W.group===i.value.groupCurrentOpen.id);return I(G)}),I=G=>G===-1?0:(i.value.groupModifiersSelected[G].modifiers||[]).reduce((N,X)=>N+(X.amount||0),0),B=r.computed(()=>{var W;const G=(W=i.value.openCard)==null?void 0:W.group_modifiers.findIndex(N=>N.id===i.value.groupCurrentOpen.id);return G===-1||!i.value.openCard?0:i.value.openCard.modifiers.length>0&&G===0?i.value.openCard.modifiers.reduce((N,X)=>N+X.max_amount,0):i.value.groupModifiers[G].max_amount}),T=r.computed(()=>{var W;const G=(i.value.addedProducts??[]).reduce((N,X)=>N+X.price,0);if(i.value.openCard){const N=i.value.openCard,X=mr(N)||0,$=N.amount||1;return(i.value.groupModifiersSelected.reduce((J,le)=>(le.modifiers.forEach(se=>{var oe,ge;se.sizes&&(se.price=((ge=(oe=se.sizes)==null?void 0:oe.find(Ee=>Ee.id===i.value.selectedSize.id))==null?void 0:ge.price)??se.price),J+=se.price*se.amount}),J),0)+X)*$+G}return(W=i.value.addedProducts)!=null&&W.length?G:0}),D=r.computed(()=>{const G=i.value.groupCurrentOpen;if(!G)return!1;const W=i.value.groupModifiers,N=W.findIndex(X=>X.id===G.id);return N===-1?!1:N===W.length-1}),k=G=>{const W=i.value.groupModifiers[G],N=i.value.groupModifiersSelected[G];if(!W)return{valid:!1};if(W.min_amount>0&&I(G)<W.min_amount)return{valid:!1,errorText:`В группе "${W.name}" должно содержаться не меньше ${W.min_amount} модификатора(ов)`};if(N){for(const X of W.group_modifiers)if(X.min_amount>0){const $=N.modifiers.find(q=>q.id===X.id);if(!$||$.amount<X.min_amount)return{valid:!1,errorText:`В группе "${W.name}" выберите все обязательные модификаторы`}}}return{valid:!0}},P=r.computed(()=>{const G=i.value.groupModifiers;for(let W=0;W<G.length;W++){const N=k(W);if(!N.valid)return i.value.textErrorRequaired=N.errorText,{haveRequaire:!0,group:G[W]}}return{haveRequaire:!1,group:G[0]}}),M=()=>{i.value.groupModifiers.forEach((G,W)=>{i.value.groupCurrentOpen={...G,index:W},G.group_modifiers.forEach(N=>{N.default_amount>0&&(N.amount=N.default_amount,re(N,!0))})})},v=G=>{i.value.addedProducts.push(G)},j=G=>{i.value.openCard=G},H=G=>{_.value=[...G]},Z=(G,W,N)=>{var $;const X=i.value.groupModifiers.findIndex(q=>q.id===G.id);if(X!==-1)if(N){const q=i.value.groupModifiers,J=X+1;if(J<q.length){const le=q[J];i.value.groupCurrentOpen={...le,index:J},i.value.isSectionModifier=!0}}else{const q=G.id!==(($=i.value.groupCurrentOpen)==null?void 0:$.id);i.value.groupCurrentOpen={...G,index:X},i.value.isSectionModifier=q?!0:!i.value.isSectionModifier}},V=()=>{i.value.modalCount>i.value.currentModifier.min_amount&&i.value.modalCount>=2&&(i.value.modalCount-=1)},L=()=>{i.value.groupCurrentOpen&&i.value.modalCount+y.value<B.value&&(i.value.currentModifier.max_amount===0||i.value.currentModifier.max_amount>i.value.modalCount)&&(i.value.modalCount+=1)},F=(G,W)=>{var X;const N=(X=i.value.groupCurrentOpen)==null?void 0:X.id.toUpperCase();if(!G&&!i.value.isModifiedAmount&&W.max_amount!==1){if(N==="Добавки2000"&&W.max_amount>1)return!0;if(Math.abs(B.value-y.value)>1&&N!=="Добавки2000")return!0}return!1},re=(G,W=!1)=>{i.value.modalCount=1,i.value.currentModifier=G;const N=i.value.groupModifiersSelected.findIndex(X=>X.group===i.value.groupCurrentOpen.id);K(N,G,W)},K=(G,W,N)=>{var $,q,J;let X=i.value.groupModifiersSelected;if(G===-1)F(N,W)?i.value.isModifiedAmount=!0:X[i.value.groupCurrentOpen.index]={group:i.value.groupCurrentOpen.id,is_fake:(($=i.value.groupCurrentOpen)==null?void 0:$.is_fake)||!1,is_product_determining:((q=i.value.groupCurrentOpen)==null?void 0:q.is_product_determining)||!1,modifier_count:((J=i.value.currentModifier)==null?void 0:J.amount)||0,modifiers:[{...W,amount:(W==null?void 0:W.amount)??1}]};else{const le=i.value.groupModifiers[G].group_modifiers.findIndex(oe=>oe.id===W.id);if(X[G].modifiers.findIndex(oe=>oe.id===W.id)===-1){if(B.value===1)X[G].modifiers=[];else if(y.value>=B.value)return;F(N,W)?i.value.isModifiedAmount=!0:(X[G].modifiers.push({...W,amount:(W==null?void 0:W.amount)??1}),X[G].modifier_count=X[G].modifiers.reduce((oe,ge)=>oe+=ge.amount,0),i.value.isAnimationFly=!0)}else X[G].modifiers=X[G].modifiers.filter(oe=>oe.id!==W.id),X[G].modifier_count=X[G].modifiers.reduce((oe,ge)=>oe+=ge.amount,0),i.value.groupModifiers[G].group_modifiers[le].amount=1,i.value.groupModifiers[G].group_modifiers[le].default_amount=0,i.value.isAnimationFly=!1}i.value.groupModifiersSelected=X};return{stateCard:i,totalPrice_libCard:T,recountGroupTotalAmount:y,groupTotalAmount:B,isOpenWindow:u,isUpSale:f,checkedRequiredBtn:P,dataUpSale:p,productCards:_,isAddToCard:m,openProduct:x,is_startPage:C,isLastGroup:D,setProduct:H,summModifierAmount:I,setAddedProducts:v,setCurrentCard:j,minusAmount:V,plusAmount:L,toggleNotRequire:Z,modifierSelect:re,defaultAmountModifiers:M,validateGroup:k,reset:o}});var wr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function ta(a){return a&&a.__esModule&&Object.prototype.hasOwnProperty.call(a,"default")?a.default:a}var na={exports:{}};(function(a,l){(function(i,o){a.exports=o()})(wr,function(){var i=1e3,o=6e4,u=36e5,f="millisecond",m="second",p="minute",_="hour",x="day",C="week",y="month",I="quarter",B="year",T="date",D="Invalid Date",k=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,P=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,M={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(W){var N=["th","st","nd","rd"],X=W%100;return"["+W+(N[(X-20)%10]||N[X]||N[0])+"]"}},v=function(W,N,X){var $=String(W);return!$||$.length>=N?W:""+Array(N+1-$.length).join(X)+W},j={s:v,z:function(W){var N=-W.utcOffset(),X=Math.abs(N),$=Math.floor(X/60),q=X%60;return(N<=0?"+":"-")+v($,2,"0")+":"+v(q,2,"0")},m:function W(N,X){if(N.date()<X.date())return-W(X,N);var $=12*(X.year()-N.year())+(X.month()-N.month()),q=N.clone().add($,y),J=X-q<0,le=N.clone().add($+(J?-1:1),y);return+(-($+(X-q)/(J?q-le:le-q))||0)},a:function(W){return W<0?Math.ceil(W)||0:Math.floor(W)},p:function(W){return{M:y,y:B,w:C,d:x,D:T,h:_,m:p,s:m,ms:f,Q:I}[W]||String(W||"").toLowerCase().replace(/s$/,"")},u:function(W){return W===void 0}},H="en",Z={};Z[H]=M;var V="$isDayjsObject",L=function(W){return W instanceof ee||!(!W||!W[V])},F=function W(N,X,$){var q;if(!N)return H;if(typeof N=="string"){var J=N.toLowerCase();Z[J]&&(q=J),X&&(Z[J]=X,q=J);var le=N.split("-");if(!q&&le.length>1)return W(le[0])}else{var se=N.name;Z[se]=N,q=se}return!$&&q&&(H=q),q||!$&&H},re=function(W,N){if(L(W))return W.clone();var X=typeof N=="object"?N:{};return X.date=W,X.args=arguments,new ee(X)},K=j;K.l=F,K.i=L,K.w=function(W,N){return re(W,{locale:N.$L,utc:N.$u,x:N.$x,$offset:N.$offset})};var ee=function(){function W(X){this.$L=F(X.locale,null,!0),this.parse(X),this.$x=this.$x||X.x||{},this[V]=!0}var N=W.prototype;return N.parse=function(X){this.$d=function($){var q=$.date,J=$.utc;if(q===null)return new Date(NaN);if(K.u(q))return new Date;if(q instanceof Date)return new Date(q);if(typeof q=="string"&&!/Z$/i.test(q)){var le=q.match(k);if(le){var se=le[2]-1||0,oe=(le[7]||"0").substring(0,3);return J?new Date(Date.UTC(le[1],se,le[3]||1,le[4]||0,le[5]||0,le[6]||0,oe)):new Date(le[1],se,le[3]||1,le[4]||0,le[5]||0,le[6]||0,oe)}}return new Date(q)}(X),this.init()},N.init=function(){var X=this.$d;this.$y=X.getFullYear(),this.$M=X.getMonth(),this.$D=X.getDate(),this.$W=X.getDay(),this.$H=X.getHours(),this.$m=X.getMinutes(),this.$s=X.getSeconds(),this.$ms=X.getMilliseconds()},N.$utils=function(){return K},N.isValid=function(){return this.$d.toString()!==D},N.isSame=function(X,$){var q=re(X);return this.startOf($)<=q&&q<=this.endOf($)},N.isAfter=function(X,$){return re(X)<this.startOf($)},N.isBefore=function(X,$){return this.endOf($)<re(X)},N.$g=function(X,$,q){return K.u(X)?this[$]:this.set(q,X)},N.unix=function(){return Math.floor(this.valueOf()/1e3)},N.valueOf=function(){return this.$d.getTime()},N.startOf=function(X,$){var q=this,J=!!K.u($)||$,le=K.p(X),se=function(Ke,st){var He=K.w(q.$u?Date.UTC(q.$y,st,Ke):new Date(q.$y,st,Ke),q);return J?He:He.endOf(x)},oe=function(Ke,st){return K.w(q.toDate()[Ke].apply(q.toDate("s"),(J?[0,0,0,0]:[23,59,59,999]).slice(st)),q)},ge=this.$W,Ee=this.$M,Fe=this.$D,ue="set"+(this.$u?"UTC":"");switch(le){case B:return J?se(1,0):se(31,11);case y:return J?se(1,Ee):se(0,Ee+1);case C:var nt=this.$locale().weekStart||0,Ae=(ge<nt?ge+7:ge)-nt;return se(J?Fe-Ae:Fe+(6-Ae),Ee);case x:case T:return oe(ue+"Hours",0);case _:return oe(ue+"Minutes",1);case p:return oe(ue+"Seconds",2);case m:return oe(ue+"Milliseconds",3);default:return this.clone()}},N.endOf=function(X){return this.startOf(X,!1)},N.$set=function(X,$){var q,J=K.p(X),le="set"+(this.$u?"UTC":""),se=(q={},q[x]=le+"Date",q[T]=le+"Date",q[y]=le+"Month",q[B]=le+"FullYear",q[_]=le+"Hours",q[p]=le+"Minutes",q[m]=le+"Seconds",q[f]=le+"Milliseconds",q)[J],oe=J===x?this.$D+($-this.$W):$;if(J===y||J===B){var ge=this.clone().set(T,1);ge.$d[se](oe),ge.init(),this.$d=ge.set(T,Math.min(this.$D,ge.daysInMonth())).$d}else se&&this.$d[se](oe);return this.init(),this},N.set=function(X,$){return this.clone().$set(X,$)},N.get=function(X){return this[K.p(X)]()},N.add=function(X,$){var q,J=this;X=Number(X);var le=K.p($),se=function(Ee){var Fe=re(J);return K.w(Fe.date(Fe.date()+Math.round(Ee*X)),J)};if(le===y)return this.set(y,this.$M+X);if(le===B)return this.set(B,this.$y+X);if(le===x)return se(1);if(le===C)return se(7);var oe=(q={},q[p]=o,q[_]=u,q[m]=i,q)[le]||1,ge=this.$d.getTime()+X*oe;return K.w(ge,this)},N.subtract=function(X,$){return this.add(-1*X,$)},N.format=function(X){var $=this,q=this.$locale();if(!this.isValid())return q.invalidDate||D;var J=X||"YYYY-MM-DDTHH:mm:ssZ",le=K.z(this),se=this.$H,oe=this.$m,ge=this.$M,Ee=q.weekdays,Fe=q.months,ue=q.meridiem,nt=function(st,He,At,Te){return st&&(st[He]||st($,J))||At[He].slice(0,Te)},Ae=function(st){return K.s(se%12||12,st,"0")},Ke=ue||function(st,He,At){var Te=st<12?"AM":"PM";return At?Te.toLowerCase():Te};return J.replace(P,function(st,He){return He||function(At){switch(At){case"YY":return String($.$y).slice(-2);case"YYYY":return K.s($.$y,4,"0");case"M":return ge+1;case"MM":return K.s(ge+1,2,"0");case"MMM":return nt(q.monthsShort,ge,Fe,3);case"MMMM":return nt(Fe,ge);case"D":return $.$D;case"DD":return K.s($.$D,2,"0");case"d":return String($.$W);case"dd":return nt(q.weekdaysMin,$.$W,Ee,2);case"ddd":return nt(q.weekdaysShort,$.$W,Ee,3);case"dddd":return Ee[$.$W];case"H":return String(se);case"HH":return K.s(se,2,"0");case"h":return Ae(1);case"hh":return Ae(2);case"a":return Ke(se,oe,!0);case"A":return Ke(se,oe,!1);case"m":return String(oe);case"mm":return K.s(oe,2,"0");case"s":return String($.$s);case"ss":return K.s($.$s,2,"0");case"SSS":return K.s($.$ms,3,"0");case"Z":return le}return null}(st)||le.replace(":","")})},N.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},N.diff=function(X,$,q){var J,le=this,se=K.p($),oe=re(X),ge=(oe.utcOffset()-this.utcOffset())*o,Ee=this-oe,Fe=function(){return K.m(le,oe)};switch(se){case B:J=Fe()/12;break;case y:J=Fe();break;case I:J=Fe()/3;break;case C:J=(Ee-ge)/6048e5;break;case x:J=(Ee-ge)/864e5;break;case _:J=Ee/u;break;case p:J=Ee/o;break;case m:J=Ee/i;break;default:J=Ee}return q?J:K.a(J)},N.daysInMonth=function(){return this.endOf(y).$D},N.$locale=function(){return Z[this.$L]},N.locale=function(X,$){if(!X)return this.$L;var q=this.clone(),J=F(X,$,!0);return J&&(q.$L=J),q},N.clone=function(){return K.w(this.$d,this)},N.toDate=function(){return new Date(this.valueOf())},N.toJSON=function(){return this.isValid()?this.toISOString():null},N.toISOString=function(){return this.$d.toISOString()},N.toString=function(){return this.$d.toUTCString()},W}(),G=ee.prototype;return re.prototype=G,[["$ms",f],["$s",m],["$m",p],["$H",_],["$W",x],["$M",y],["$y",B],["$D",T]].forEach(function(W){G[W[1]]=function(N){return this.$g(N,W[0],W[1])}}),re.extend=function(W,N){return W.$i||(W(N,ee,re),W.$i=!0),re},re.locale=F,re.isDayjs=L,re.unix=function(W){return re(1e3*W)},re.en=Z[H],re.Ls=Z,re.p={},re})})(na);var Gd=na.exports;const ra=ta(Gd),Wd=a=>{const l=ke.useRouter(),i=`${a.domain}/api/`,o=Ze.create({baseURL:i}),u=Ze.create({baseURL:i}),f=Ze.create({baseURL:i}),m=Ze.create({baseURL:i}),p=Ze.create({baseURL:i}),_=Ze.create({baseURL:i}),x=Ze.create({baseURL:i}),C=M=>{try{const v=JSON.parse(localStorage.getItem("authTokensAccess")||"");v.length>0&&(M.headers.Authorization=`Bearer ${v}`)}catch{console.warn("accessToken is undefined [useAxios]")}return M},y=M=>{const v=localStorage.getItem("apiKey");return M.headers={"Content-Type":"application/json","x-api-key":v},M},I=async M=>{if(!a.user)return M;const v=a.user.exp??0;if(!(ra.unix(v).diff(ra())<3e3))return M;const H=hs("authTokensRefresh",null,"string");try{const Z=await Ze.post(`${i}user/token/refresh/`,{refresh:H.value});if(!Z.data.access)return P(),M;localStorage.setItem("authTokensAccess",JSON.stringify(Z.data.access)),D(Z.data),k(fs(Z.data.access)),M.headers={...M.headers,Authorization:`Bearer ${Z.data.access}`}}catch(Z){console.error("Failed to refresh token:",Z),P()}return M},B=M=>{M.interceptors.request.use(v=>I(C(v)),v=>Promise.reject(v))};B(f),B(p),B(x);const T=M=>{M.interceptors.request.use(v=>y(v))};T(_),T(u),T(x);const D=(M,v=!1)=>{localStorage.setItem("authTokensAccess",JSON.stringify(M.access)),v&&localStorage.setItem("authTokensRefresh",JSON.stringify(M.refresh))},k=M=>{a.user=M,localStorage.setItem("user",JSON.stringify(M))},P=()=>{a.user=null,gr(["authTokensAccess","authTokensRefresh","user","cart","bonus"]),sessionStorage.removeItem("is_adult"),l.replace({name:"home"}).then(()=>window.location.reload())};return{axiosInstanceAuthenticationGet:f,axiosInstanceAuthenticationPost:p,axiosInstanceAuthenticationPostApiKey:x,axiosInstancePost:m,axiosInstanceGet:o,axiosInstanceGetApiKey:u,axiosInstancePostApiKey:_}},ia=(a="themeConfig")=>{try{const l=localStorage.getItem(a);return l?JSON.parse(l):null}catch{return null}},ze=class ze{constructor(){Be(this,"axiosInstanceGet");Be(this,"axiosInstancePost");Be(this,"axiosInstanceAuthenticationGet");Be(this,"axiosInstanceAuthenticationPost");Be(this,"axiosInstanceGetApiKey");Be(this,"axiosInstancePostApiKey");Be(this,"axiosInstanceAuthenticationPostApiKey");Be(this,"currentUpsaleController",null);Be(this,"controller",new AbortController);this.axiosInstanceGet=ze._axiosGet,this.axiosInstancePost=ze._axiosPost,this.axiosInstanceGetApiKey=ze._axiosPostApiKey,this.axiosInstancePostApiKey=ze._axiosPostApiKey,this.axiosInstanceAuthenticationPostApiKey=ze._axiosAuthPostApiKey,this.axiosInstanceAuthenticationGet=ze._axiosAuthGet,this.axiosInstanceAuthenticationPost=ze._axiosAuthPost}static create(l){return l&&!ze._config&&ze._initialize(l),ze._config||console.warn("InitConnection не инициализирован"),new ze}static _initialize(l,i=null){const o=ot(),u=Lt(),{config_lib:f}=_e.storeToRefs(o),{stateCard:m,recountGroupTotalAmount:p}=_e.storeToRefs(u);ze._config=l,ze._cardStore=u,ze._stateCard=m,ze._recountGroupTotalAmount=p,f.value=l;const _=Wd(l);ze._axiosPostApiKey=_.axiosInstanceGetApiKey,ze._axiosPostApiKey=_.axiosInstancePostApiKey,ze._axiosAuthPostApiKey=_.axiosInstanceAuthenticationPostApiKey,ze._axiosGet=_.axiosInstanceGet,ze._axiosPost=_.axiosInstancePost,ze._axiosAuthGet=_.axiosInstanceAuthenticationGet,ze._axiosAuthPost=_.axiosInstanceAuthenticationPost}get config(){return ze._config}get cardStore(){return ze._cardStore}get stateCard(){return ze._stateCard}get recountGroupTotalAmount(){return ze._recountGroupTotalAmount}async updateTheme(){var f,m;const l=ia(),i=Ct();if(l!==null){i.updateColor(l);return}const o=ot(),u=await((m=this.axiosInstanceGet)==null?void 0:m.get(`org/organizations/${(f=this.config)==null?void 0:f.orgId}/design/`));o.setStateDrum(u==null?void 0:u.data.hide_barban),o.setKioskTimeout(u==null?void 0:u.data.kiosk_timeout),localStorage.setItem("themeConfig",JSON.stringify(u.data)),i.updateColor(u.data)}async getGroupByID(l){var i,o;try{const u=await((o=this.axiosInstanceGet)==null?void 0:o.get(`${(i=this.config)==null?void 0:i.pointId}/group/${l}`));return u==null?void 0:u.data}catch(u){throw console.error("Ошибка в request.ts[getGroupByID]",u),u}}async loadGroupProducts(l){var i,o;try{const u=await((o=this.axiosInstanceGet)==null?void 0:o.get(`${(i=this.config)==null?void 0:i.pointId}/products/?group=${l}`)),f=(u==null?void 0:u.data)||[];for(const m of f)m&&await kl(m);return await this.cacheImagesInBackground(f),f}catch(u){return console.error("Ошибка загрузки группы:",u),[]}}async getGroup(){var l,i;try{const o=await((i=this.axiosInstanceGet)==null?void 0:i.get(`${(l=this.config)==null?void 0:l.pointId}/groups/`));return o==null?void 0:o.data}catch(o){return console.error("Error fetching products:",o),[]}}async fetchAndCacheAllPages(){var l,i;try{const o=((l=this.config)==null?void 0:l.pointId)||"",u=await qi(o);if(u)return u.data;const f=await((i=this.axiosInstanceGet)==null?void 0:i.get(`${o}/group/`)),m=(f==null?void 0:f.data)||[],p=[];for(const _ of m){_.products=_.products||[],await vr(_.id,_),p.push(_);const x=await this.loadGroupProducts(_.id);_.products=x}return await this.cacheImagesInBackground(m),await vr(o,m),p}catch(o){return console.error("fetchAndCacheAllPages error:",o),[]}}cacheImagesInBackground(l){l.forEach(i=>{var o;i.video_link&&this.loadAndCacheMedia(i.video_link,i.id+"_video"),i.image_link&&this.loadAndCacheMedia(i.image_link,i.id+"_image"),(o=i.products)==null||o.forEach(u=>{u.video_link&&this.loadAndCacheMedia(u.video_link,u.id+"_video"),u.image_link&&this.loadAndCacheMedia(u.image_link,u.id+"_image")})})}async loadAndCacheMedia(l,i){const o=await hr(i);if(o){this.dispatchImageCachedEvent(i,o);return}try{const u=await fetch(l);if(!u.ok)throw new Error("Network error");const f=await u.blob();if(f.size===0)throw new Error("Empty blob");await Zi(i,f),this.dispatchImageCachedEvent(i,f)}catch(u){console.warn(`[ImageCache] Failed for ${i}:`,u)}}dispatchImageCachedEvent(l,i){window.dispatchEvent(new CustomEvent("image-cached",{detail:{id:l,blob:i}}))}async getProduct(l=null){var i,o;if(!l)return[];try{const u=await((o=this.axiosInstanceGet)==null?void 0:o.get(`${(i=this.config)==null?void 0:i.pointId}/products/${l}`));return u==null?void 0:u.data}catch(u){return console.error("Error fetching cardProducts:",u),[]}}async getSingleProduct(l){var u;const i=ot(),{config_lib:o}=_e.storeToRefs(i);try{let f=await rs(l);if(f)this._fullCardProduct(f);else{const m=await((u=this.axiosInstanceGet)==null?void 0:u.get(`${o.value.pointId}/products/${l}`));(m==null?void 0:m.status)===200&&this._fullCardProduct(m.data)}}catch(f){throw console.warn("store card[getFetchProducts]:",f),f}}_fullCardProduct(l){const i=Lt();i.stateCard.openCard={...l,amount:1},i.stateCard.groupModifiers=l.group_modifiers,l.modifiers.length>0&&i.stateCard.groupModifiers.unshift({default_amount:0,description:"",group_modifiers:l.modifiers,id:"Добавки2000",image_link:null,max_amount:1,min_amount:l.modifiers.reduce((o,u)=>o+=u.min_amount,0),name:"Добавки",required:!1}),i.stateCard.groupModifiersSelected=new Array(i.stateCard.groupModifiers.length).fill({group:"",modifiers:[],is_fake:!1,is_product_determining:!1,modifier_count:0}),i.stateCard.productSizes=l.sizes,i.defaultAmountModifiers(),l.show_recommendations&&this.productUpsale(l.id)}async getTheme(){try{this.updateTheme()}catch(l){return console.error("Error fetching products:",l),[]}}async authorizeByCard(l){var i,o;try{const u=await((o=this.axiosInstanceAuthenticationPostApiKey)==null?void 0:o.post(`${(i=this.config)==null?void 0:i.domain}/api/user/validate-card/`,{card_number:l}));return localStorage.setItem("authTokensAccess",JSON.stringify(u==null?void 0:u.data.access)),localStorage.setItem("authTokensRefresh",JSON.stringify(u==null?void 0:u.data.refresh)),u==null?void 0:u.data}catch(u){throw console.error("Ошибка авторизации:",u),u}}async getLoyalSmsCode(l){var i,o;try{const u=await((o=this.axiosInstancePostApiKey)==null?void 0:o.post(`${(i=this.config)==null?void 0:i.domain}/api/device/auth/request-otp/`,{phone:l}));return u==null?void 0:u.data}catch(u){throw console.error("Ошибка получения sms-code:",u),u}}async sendSmsCodeForAuth(l,i){var o,u;try{const f=await((u=this.axiosInstanceAuthenticationPostApiKey)==null?void 0:u.post(`${(o=this.config)==null?void 0:o.domain}/api/device/auth/`,{code:l,phone:i}));return f==null?void 0:f.data}catch(f){throw console.error("Ошибка отправки sms-code:",f),f}}async callStaff(l,i,o){var u,f,m,p;try{const _=await((m=this.axiosInstancePost)==null?void 0:m.post(`${(u=this.config)==null?void 0:u.domain}/api/org_unit/${(f=this.config)==null?void 0:f.pointId}/table/${l}/call-staff/`,{...i},o));return(p=_==null?void 0:_.data)==null?void 0:p.response_text}catch(_){throw console.error("Ошибка[callStaff]",_),_}}async confirmOrder(l){var o,u;const i=await((u=this.axiosInstancePost)==null?void 0:u.post(`/org_unit/${(o=this.config)==null?void 0:o.pointId}/confirm-order/`,{order:l}));return(i==null?void 0:i.status)===200}async createOrder(l,i,o=!0,u,f=!1,m){var T,D,k,P,M;const p=Mt(),_=f?this.axiosInstanceAuthenticationPostApiKey:this.axiosInstancePostApiKey,x=o?_:this.axiosInstanceAuthenticationPost,C=o?"/device/order/create":"/order/create",y=o?(T=this.config)==null?void 0:T.pointId:(D=this.config)==null?void 0:D.pointId,I={items:l,comment:u};return i&&(I.table=i),o&&((k=p.selectedOrderType)!=null&&k.id)&&(I.order_type_id=(P=p.selectedOrderType)==null?void 0:P.id),await(x==null?void 0:x.post(`${(M=this.config)==null?void 0:M.domain}/api/org_unit/${y}${C}`,I,{signal:m}))}async extendOrder(l){var m,p;const i=Vn();if(!i.id)throw Error("Неверный стол");if(!((m=i.data)!=null&&m.order))throw Error("Заказ не найден");const o=this.axiosInstanceAuthenticationPost,u={items:l,table:i.id},f=await(o==null?void 0:o.post(`/org_unit/${(p=this.config)==null?void 0:p.pointId}/order/${i.data.order}/extend`,u));return f==null?void 0:f.data}async initPaymentLink(l,i){var _,x,C;const o=this.axiosInstanceAuthenticationPost,u=ot(),f=Vn(),m={order:l,provider_type:i};u.countBonus>0&&(m.by_bonuses=u.countBonus),f.isTableService&&((_=f.order)==null?void 0:_.remaining_amount)!==((x=f.order)==null?void 0:x.total_cost)&&(m.amount=(C=f.order)==null?void 0:C.remaining_amount),m.by_bonuses&&m.amount&&(m.amount=+(+m.amount-+m.by_bonuses).toFixed(2));const p=await(o==null?void 0:o.post("payment/init",m));return p==null?void 0:p.data}async orderPay(l){var i;return(i=this.axiosInstanceAuthenticationPostApiKey)==null?void 0:i.post(`order/${l}/pay/`,{order_id:l})}async getProfile(){var i,o;const l=await((o=this.axiosInstanceAuthenticationGet)==null?void 0:o.get(`user/current?organization=${(i=this.config)==null?void 0:i.orgId}`));if((l==null?void 0:l.status)===200){const u=ot();return u.profile=l.data,u.is18Allowed=sessionStorage.getItem("is_adult")==="true",l.data}else return l}async joinLoyalty(){var i;const l=await((i=this.axiosInstanceAuthenticationGet)==null?void 0:i.post("user/join-loyalty/"));return{success:(l==null?void 0:l.status)===200}}async isPhoneExist(l,i={}){var o,u;try{const f=await((u=this.axiosInstanceGet)==null?void 0:u.get("user/check-phone",{...i,params:{organization:(o=this.config)==null?void 0:o.orgId,phone:l}}));return(f==null?void 0:f.status)===200}catch{return!1}}async sendOTP(l,i={}){var u,f;const o=await((f=this.axiosInstancePost)==null?void 0:f.post("user/check-phone",{organization:(u=this.config)==null?void 0:u.orgId,phone:l},i));return o==null?void 0:o.data}async auth(l,i={}){var u,f;return await((f=this.axiosInstancePost)==null?void 0:f.post("user/auth",{organization:(u=this.config)==null?void 0:u.orgId,...l},i))}async signup(l,i={}){var u,f;return await((f=this.axiosInstancePost)==null?void 0:f.post("user/register",{organization:(u=this.config)==null?void 0:u.orgId,...l},i))}async calculateDiscount(l,i=!0,o=!1,u){var C,y;const f=o?this.axiosInstanceAuthenticationPostApiKey:this.axiosInstancePostApiKey,m=o?this.axiosInstanceAuthenticationPost:this.axiosInstancePost,p=i?f:m,_=i?(C=this.config)==null?void 0:C.pointId:(y=this.config)==null?void 0:y.pointId,x=await(p==null?void 0:p.post(`/org_unit/${_}/cart/calculate-discount/`,l,{signal:u}));return(x==null?void 0:x.status)===200?x.data:x}async maxPayByBonuses(l,i=!0,o=!1,u){const f=ot(),m=o?this.axiosInstanceAuthenticationPostApiKey:this.axiosInstancePostApiKey,p=o?this.axiosInstanceAuthenticationPost:this.axiosInstancePost,_=i?m:p,x=await(_==null?void 0:_.post("/cart/max-pay-by-bonuses/",{order_id:l},{signal:u})),C=x==null?void 0:x.data;return f.profile&&C&&"balance"in C&&(f.profile.balance=C.balance),C}async getDeviceInfo(){var o;const l=Mt(),i=await((o=this.axiosInstanceGetApiKey)==null?void 0:o.get("/device/current/"));return(i==null?void 0:i.status)===200?(l.orderTypes=i.data.order_types,l.providerTypes=i.data.payment_provider_type,i.data):i}async validateApiKey(l,i){var u,f;const o=await((f=this.axiosInstancePost)==null?void 0:f.post(`/device/org_unit/${(u=this.config)==null?void 0:u.pointId}/validate-api-key/`,{api_key:l},i));return(o==null?void 0:o.status)===200}async productUpsale(l){var f,m,p;const i=Lt(),{dataUpSale:o}=_e.storeToRefs(i);(f=this.currentUpsaleController)==null||f.abort();const u=new AbortController;this.currentUpsaleController=u;try{const _=await((p=this.axiosInstanceGet)==null?void 0:p.get(`/${(m=this.config)==null?void 0:m.pointId}/products/${l}/recommendation/`,{signal:u.signal}));u.signal.aborted||(o.value=_==null?void 0:_.data)}catch(_){if(_.name==="AbortError"||_.name==="CanceledError"){console.warn("Upsale отменён — пришёл новый запрос");return}throw console.error("Ошибка upsale:",_),_}finally{this.currentUpsaleController===u&&(this.currentUpsaleController=null)}}};Be(ze,"_config",null),Be(ze,"_axiosGet"),Be(ze,"_axiosGetApiKey"),Be(ze,"_axiosPostApiKey"),Be(ze,"_axiosAuthPostApiKey"),Be(ze,"_axiosPost"),Be(ze,"_axiosAuthGet"),Be(ze,"_axiosAuthPost"),Be(ze,"_cardStore",null),Be(ze,"_stateCard",null),Be(ze,"_recountGroupTotalAmount",null);let yn=ze;const oa=r.ref(!1),sa=r.ref(window.innerWidth),Wn=()=>{const a=r.computed({get:()=>oa.value,set:u=>{oa.value=u}}),l=r.computed(()=>a.value&&sa.value>1024),i=()=>sa.value=window.innerWidth;return r.onMounted(()=>{window.addEventListener("resize",i)}),r.onUnmounted(()=>{window.removeEventListener("resize",i)}),{isDesktop:a,shouldUseDragScroll:l,syncWithRoute:u=>{a.value=u.query.mode==="pdf"}}},Xd=r.defineComponent({__name:"UseScrollCenter",props:{axis:{},behavior:{},autoScroll:{type:Boolean},container:{},idActive:{},clearContainer:{type:Boolean}},setup(a,{expose:l}){const i=a,o=ot(),u=r.ref(null),{isDesktop:f}=Wn(),m=async _=>{if(!u.value||!_)return;let x=window;i.container&&(x=typeof i.container=="string"?document.querySelector(i.container)||window:i.container);const C={behavior:i.behavior};if(i.axis==="x"){const y=x===window?window.innerWidth:x.clientWidth,I=_.offsetWidth;let B=_.offsetLeft;if(x!==window){const T=x.getBoundingClientRect();B=_.getBoundingClientRect().left-T.left+x.scrollLeft}B-=(y-I)/2,C.left=Math.max(0,B)}else{const y=x===window?window.innerHeight:x.clientHeight,I=_.offsetHeight;let B=_.offsetTop;if(x!==window){const T=x.getBoundingClientRect();B=_.getBoundingClientRect().top-T.top+x.scrollTop}B-=(y-I)/2,C.top=Math.max(0,B)}try{x===window?window.scrollTo(C):x.scrollTo(C)}catch(y){console.error("Scroll error:",y)}};r.onMounted(async()=>{if(i.autoScroll){let _=null;if(await r.nextTick(),o.activeScrolling_lib){const x=o.activeScrolling_lib.findIndex(C=>C.id===i.idActive);i.idActive?(_=document.getElementById(`scrolling${i.idActive}`),_&&x!==-1&&(o.activeScrolling_lib[x]=_)):o.activeScrolling_lib[x]&&(_=o.activeScrolling_lib[x]),m(_)}}});const p=async _=>{i.clearContainer&&(o.activeScrolling_lib=[]);const x=_.currentTarget;await r.nextTick(),o.activeScrolling_lib.includes(x)||o.activeScrolling_lib.push(x),m(x)};return l({scrollToElement:m}),(_,x)=>(r.openBlock(),r.createElementBlock("div",{ref_key:"wrapperRef",ref:u,class:r.normalizeClass(["scroll-to-wrapper",{scroll_pdf:r.unref(f)}])},[r.renderSlot(_.$slots,"default",{handleTargetClick:p},void 0,!0)],2))}}),We=(a,l)=>{const i=a.__vccOpts||a;for(const[o,u]of l)i[o]=u;return i},ho=We(Xd,[["__scopeId","data-v-e47a167d"]]),Xr={mounted(a){let l=!1,i,o,u,f,m,p=0,_=0,x=0,C=0,y=0,I=!1;const B=5;a.style.cursor="grab";const T=P=>{P.button===0&&(m&&(cancelAnimationFrame(m),m=0),l=!0,I=!1,i=P.pageX-a.offsetLeft,o=P.pageY-a.offsetTop,u=a.scrollLeft,f=a.scrollTop,x=P.pageX,C=P.pageY,y=Date.now(),p=0,_=0)},D=P=>{if(!l)return;const M=P.pageX,v=P.pageY,j=Math.abs(M-x),H=Math.abs(v-C);if(!I&&(j>B||H>B)&&(I=!0,a.style.pointerEvents="none"),I){P.stopPropagation(),P.preventDefault();const Z=Date.now(),V=Z-y;V>0&&(p=(M-x)/V*16,_=(v-C)/V*16),x=M,C=v,y=Z;const L=M-a.offsetLeft,F=v-a.offsetTop,re=L-i,K=F-o;a.scrollLeft=u-re,a.scrollTop=f-K}else x=M,C=v,y=Date.now()},k=P=>{if(l){if(I){if(P.stopPropagation(),P.preventDefault(),a.style.pointerEvents="",Math.abs(p)>.1||Math.abs(_)>.1){const M=()=>{a.scrollLeft-=p,a.scrollTop-=_,p*=.95,_*=.95,Math.abs(p)>.1||Math.abs(_)>.1?m=requestAnimationFrame(M):m=0};m=requestAnimationFrame(M)}}else a.style.pointerEvents="";l=!1,I=!1}};a.addEventListener("mousedown",T),window.addEventListener("mousemove",D),window.addEventListener("mouseup",k),a._dragScrollCleanup=()=>{m&&cancelAnimationFrame(m),a.removeEventListener("mousedown",T),window.removeEventListener("mousemove",D),window.removeEventListener("mouseup",k),a.style.pointerEvents=""}},unmounted(a){a._dragScrollCleanup&&a._dragScrollCleanup()}},$d={},jd={id:"custom_svg_lib",width:"26.000000",height:"26.000000",viewBox:"0 0 26 26",fill:"none",xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink"};function qd(a,l){return r.openBlock(),r.createElementBlock("svg",jd,[...l[0]||(l[0]=[r.createElementVNode("defs",null,null,-1),r.createElementVNode("path",{id:"custom_svg_color",d:"M11.83 26L11.83 14.15L0 14.15L0 11.84L11.83 11.84L11.83 0L14.15 0L14.15 11.84L26 11.84L26 14.15L14.15 14.15L14.15 26L11.83 26Z",fill:"#FF6D2E","fill-opacity":"1.000000","fill-rule":"nonzero"},null,-1)])])}const wi=We($d,[["render",qd]]),Zd=["id","onClick"],Yd={class:"modified_plus_btn"},Kd=["src"],Qd={key:2,class:"wrapper_modifier_item"},Jd={key:0,class:"modifier_item_n_wrapper"},eu=["src"],tu={key:1,class:"modifier_plus_item"},nu=["src"],ru=["src"],aa=We(r.defineComponent({__name:"PlusModifier",props:{isSectionModifier:{type:Boolean},toggleNotRequire:{type:Function}},setup(a){const l=Lt(),i=Ct(),{stateCard:o}=_e.storeToRefs(l),{itemThemes:u}=_e.storeToRefs(i),{shouldUseDragScroll:f}=Wn(),m=r.ref([]),p=r.ref([]),_=r.ref(null),x=r.ref(null),C=r.ref(null),y=B=>{B instanceof HTMLElement&&!m.value.includes(B)&&m.value.push(B)},I=B=>{C.value=B};return r.onMounted(async()=>{await r.nextTick(),o.value.plusButtonsRefs=m.value}),r.watchEffect(()=>{p.value=o.value.groupModifiersSelected,document.body.style.overflow=""}),r.watch(()=>{var B;return(B=o.value.groupCurrentOpen)==null?void 0:B.id},async B=>{var D;if(!B)return;await r.nextTick();const T=m.value.find(k=>k.id==="scrolling"+B);T&&((D=x.value)==null||D.scrollToElement(T))}),r.onBeforeUnmount(()=>{m.value=[],o.value.plusButtonsRefs=[]}),(B,T)=>(r.openBlock(),r.createElementBlock("div",{class:r.normalizeClass({card_modified_wrapper_many:r.unref(o).groupModifiers.length>=5})},[r.unref(o).groupModifiersSelected?r.withDirectives((r.openBlock(),r.createElementBlock("div",{key:0,class:r.normalizeClass(["card_modified_wrapper",[r.unref(o).groupModifiers.length<=4?"card_modified_wrapper_center":""]]),ref_key:"scrollPlusContainer",ref:_},[r.createVNode(ho,{ref_key:"scrollCenterRef",ref:x,axis:"x",behavior:"smooth",container:_.value,autoScroll:!0,idActive:C.value,clearContainer:!0},{default:r.withCtx(({handleTargetClick:D})=>[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(r.unref(o).groupModifiers,(k,P)=>{var M,v;return r.openBlock(),r.createElementBlock("div",{class:"button_modified",key:k.id,ref_for:!0,ref:y,id:"scrolling"+k.id,"data-clickable":"true",onClick:j=>{a.toggleNotRequire&&a.toggleNotRequire(k,P),I(k.id),D(j)}},[r.createElementVNode("div",Yd,[p.value[P].modifiers.length===0?(r.openBlock(),r.createElementBlock("div",{key:0,class:r.normalizeClass([{modified_plus_btn_active:k.id===((M=r.unref(o).groupCurrentOpen)==null?void 0:M.id)&&a.isSectionModifier},"modified_plus_active"])},[r.createVNode(wi,{"aria-label":`Открыть группу модификаторов ${k.name}`},null,8,["aria-label"])],2)):p.value[P].modifiers.length===1?(r.openBlock(),r.createElementBlock("div",{key:1,class:r.normalizeClass(["modified_plus_btn modified_plus_btn_solo",{modified_plus_btn_active:k.id===((v=r.unref(o).groupCurrentOpen)==null?void 0:v.id)&&a.isSectionModifier}])},[r.createElementVNode("img",{src:p.value[P].modifiers[0].image_link||r.unref(u).fallback_image||"",alt:"Модификатор"},null,8,Kd)],2)):(r.openBlock(),r.createElementBlock("div",Qd,[p.value[P].modifiers.length>2?(r.openBlock(),r.createElementBlock("div",Jd,[p.value[P].modifiers.length===3?(r.openBlock(),r.createElementBlock("img",{key:0,class:"modifier_plus_item modifier_item_three",src:p.value[P].modifiers[2].image_link||r.unref(u).fallback_image||""},null,8,eu)):(r.openBlock(),r.createElementBlock("p",tu," + "+r.toDisplayString(p.value[P].modifiers.length-2),1))])):r.createCommentVNode("",!0),r.createElementVNode("div",null,[p.value[P].modifiers.length>0?(r.openBlock(),r.createElementBlock("img",{key:0,src:p.value[P].modifiers[0].image_link||r.unref(u).fallback_image||"",class:"modifier_plus_item modifier_item_first"},null,8,nu)):r.createCommentVNode("",!0),p.value[P].modifiers.length>1?(r.openBlock(),r.createElementBlock("img",{key:1,src:p.value[P].modifiers[1].image_link||r.unref(u).fallback_image||"",class:"modifier_plus_item modifier_item_second"},null,8,ru)):r.createCommentVNode("",!0)])]))]),r.createElementVNode("p",null,r.toDisplayString(k.name),1)],8,Zd)}),128))]),_:1},8,["container","idActive"])],2)),[[r.unref(Xr),r.unref(f)?{}:!1]]):r.createCommentVNode("",!0)],2))}}),[["__scopeId","data-v-7f238435"]]),iu={width:"24",height:"24",viewBox:"0 0 24 24",id:"custom_svg_lib",fill:"none",xmlns:"http://www.w3.org/2000/svg"},ou=["stroke"],la=r.defineComponent({__name:"Close",props:{color:{type:String,required:!1,default:"currentColor"}},setup(a){const l=a;return(i,o)=>(r.openBlock(),r.createElementBlock("svg",iu,[r.createElementVNode("path",{d:"M18 18L12 12M12 12L6 6M12 12L18 6M12 12L6 18",stroke:l.color,"stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},null,8,ou)]))}}),su={},au={id:"custom_svg_lib",width:"21.847656",height:"21.846924",viewBox:"0 0 21.8477 21.8469",fill:"none",xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink"};function lu(a,l){return r.openBlock(),r.createElementBlock("svg",au,[...l[0]||(l[0]=[r.createElementVNode("desc",null," Created with Pixso. ",-1),r.createElementVNode("defs",null,null,-1),r.createElementVNode("circle",{id:"Ellipse 1",cx:"10.923828",cy:"10.923462",r:"10.923489",fill:"#FF6D2E","fill-opacity":"1.000000"},null,-1),r.createElementVNode("path",{id:"Vector",d:"M12.38 15.9L12.89 15.39C12.96 15.33 13 15.25 13 15.16C13 15.08 12.96 15 12.89 14.93L8.84 11L12.89 7.06C12.96 6.99 13 6.91 13 6.83C13 6.74 12.96 6.66 12.89 6.6L12.38 6.1C12.31 6.03 12.23 6 12.14 6C12.05 6 11.97 6.03 11.9 6.1L7.1 10.76C7.03 10.83 7 10.91 7 11C7 11.08 7.03 11.16 7.1 11.23L11.9 15.9C11.97 15.96 12.05 16 12.14 16C12.23 16 12.31 15.96 12.38 15.9Z",fill:"#F2F7FF","fill-opacity":"1.000000","fill-rule":"nonzero"},null,-1)])])}const Cr=We(su,[["render",lu]]),Er={mounted(a){a.muted=!0,a.setAttribute("muted","")}},cu=["disabled","id"],sn=r.defineComponent({__name:"ButtonDefault",props:{textButtonDefault:{type:String,required:!0},disabled:{type:Boolean,default:!1},onClick:{type:Function,required:!0}},setup(a){const l=a,i=()=>{l.onClick()};return(o,u)=>(r.openBlock(),r.createElementBlock("button",{class:"buttonDefaultWrapper",disabled:a.disabled,onClick:i,id:a.disabled?"buttonDefaultDisabled":""},r.toDisplayString(a.textButtonDefault),9,cu))}}),du={class:"notification_info"},uu={key:0,class:"notification_18plus"},fu={class:"notification_18plus_image"},hu=["src"],mu={class:"notification_18plus_text"},gu={class:"notification_18plus_accept"},pu={key:1,class:"notification_text"},xu={key:0,class:"wrapper_button_accept"},Ci=r.defineComponent({__name:"NotificationWindow",props:r.mergeModels({textNotificationDefault:{},backgroundColor:{},buttonAccept:{},type:{type:Boolean},is_qr:{type:Boolean}},{visible:{default:!1},visibleModifiers:{}}),emits:["update:visible"],setup(a){const l=a,i=Ct(),o=ot(),{is18Allowed:u,notificationData_lib:f}=_e.storeToRefs(o),{itemThemes:m}=_e.storeToRefs(i),p=r.computed(()=>l.backgroundColor||"rgba(50, 50, 50, 0.9)"),_=r.computed(()=>{var T;return!!((T=m.value)!=null&&T.kiosk_hide_menu_update_notification)});let x;const C=r.useModel(a,"visible"),y=()=>{f.value.fastAdd&&(o.addToCart(f.value.fastAdd),f.value.fastAdd=null),sessionStorage.setItem("is_adult","true"),u.value=!0,C.value=!1,f.value.callback&&(f.value.callback(),f.value.callback=null)},I=()=>{C.value=!1},B=()=>{C.value=!1,clearTimeout(x)};return r.watch([C,()=>l.textNotificationDefault,_],([T,D,k],[P,M])=>{x&&(!T||T!==P||D!==M)&&clearTimeout(x),k&&T&&(x=setTimeout(B,4e3))},{immediate:!0}),r.onUnmounted(()=>{x&&B()}),(T,D)=>(r.openBlock(),r.createElementBlock(r.Fragment,null,[!_.value&&C.value?(r.openBlock(),r.createBlock(r.Transition,{key:0,name:"notificationBlack",appear:""},{default:r.withCtx(()=>[r.createElementVNode("div",{class:"notification_background_black",onClick:I})]),_:1})):r.createCommentVNode("",!0),r.createVNode(r.Transition,{name:"notification"},{default:r.withCtx(()=>{var k;return[C.value?(r.openBlock(),r.createElementBlock("div",{key:0,class:"notification_overlay",onClick:I},[r.createElementVNode("div",{class:"notification_wrapper",style:r.normalizeStyle({"background-color":p.value,border:`2px solid ${p.value}`})},[r.createElementVNode("div",du,[a.type?(r.openBlock(),r.createElementBlock("div",uu,[r.createElementVNode("div",fu,[r.createElementVNode("img",{src:r.unref(m).adult_disclaimer_image||r.unref(m).fallback_image,alt:"Дисклеймер"},null,8,hu)]),r.createElementVNode("div",mu,r.toDisplayString(r.unref(m).adult_disclaimer_text),1),r.createElementVNode("div",gu,[D[0]||(D[0]=r.createElementVNode("label",{for:"plus18"},"Содержащиеся в настоящем разделе материалы предназначены для лиц старше 18 лет, носят информационный характер об ассортименте товаров и не являются рекламой. ",-1)),r.createVNode(sn,{textButtonDefault:"Мне есть 18",onClick:y,style:{fontSize:"1rem",padding:"6px 24px",marginLeft:"10px"}})])])):(r.openBlock(),r.createElementBlock("div",pu,[r.createTextVNode(r.toDisplayString(a.textNotificationDefault)+" ",1),(k=a.buttonAccept)!=null&&k.state?(r.openBlock(),r.createElementBlock("div",xu,[r.createVNode(sn,{class:"button_accept",textButtonDefault:a.buttonAccept.text,onClick:a.buttonAccept.acceptBtn,disabled:a.buttonAccept.disabled},null,8,["textButtonDefault","onClick","disabled"])])):r.createCommentVNode("",!0)]))])],4)])):r.createCommentVNode("",!0)]}),_:1})],64))}}),_u={class:"wrapper_modifiers"},wu={class:"wrapper_nutritional_value"},Cu={class:"nutritional_scheme"},Eu={key:0,class:"nutritional_parameters"},yu={key:1,class:"nutritional_parameters"},bu={key:2,class:"nutritional_parameters"},Au={key:3,class:"nutritional_parameters"},Su={ref:"modifierBody",class:"modifier_shadow"},Iu={class:"wrapper_modifiers_title"},Nu={class:"wrapper_text_count_modifiers"},Tu=["id","aria-label","onClick"],ku={key:0,class:"counter_modifier"},Ru={class:"hide_image_corners"},Bu=["src","alt"],Ou={key:1,loop:"",autoplay:"",muted:"",playsinline:"",class:"card__video"},Mu=["src"],Du={class:"modifier_title"},vu={key:0,class:"modifier_continue_or_add_wrapper"},Pu=We(r.defineComponent({__name:"SectionModifiers",emits:["close","add-to-cart"],setup(a,{emit:l}){const i=l,o=Ct(),u=Lt(),{itemThemes:f}=_e.storeToRefs(o),{stateCard:m,recountGroupTotalAmount:p,groupTotalAmount:_,isLastGroup:x}=_e.storeToRefs(u),{isDesktop:C,shouldUseDragScroll:y}=Wn(),I=r.ref(null),B=xt.useTemplateRefsList(),T=r.ref(!1),D=M=>{if(!M)return;const v=m.value.groupModifiers.findIndex(L=>L.id===m.value.groupCurrentOpen.id),j=m.value.plusButtonsRefs[v]||m.value.plusButtonsRefs[0];if(!j)return;const H=M.getBoundingClientRect(),Z=j.getBoundingClientRect(),V=M.cloneNode(!0);V.classList.add("flyer"),Object.assign(V.style,{width:`${H.width}px`,height:`${H.height}px`,left:`${H.left}px`,top:`${H.top}px`,position:"fixed",zIndex:"1000"}),document.body.appendChild(V),I.value=V,requestAnimationFrame(()=>{const L=Z.left+Z.width/3-(H.left+H.width/2),F=Z.top+Z.height/4-(H.top+H.height/2),re=Z.width/H.width*.2;V.style.transform=`translate(${L}px, ${F}px) scale(${re})`,V.style.opacity="0.4",V.style.transition="transform 0.5s ease, opacity 0.5s ease"}),V.addEventListener("transitionend",()=>{V.remove(),I.value=null,j.classList.add("bump"),setTimeout(()=>j.classList.remove("bump"),300)},{once:!0})},k=()=>{m.value.isSectionModifier=!0;const M=m.value.groupCurrentOpen;if(!M)return;const v=m.value.groupModifiers.findIndex(H=>H.id===M.id),j=u.validateGroup(v);if(!j.valid){m.value.textErrorRequaired=j.errorText,T.value=!0;return}x.value?i("add-to-cart"):u.toggleNotRequire(M,void 0,!0)};r.watch(()=>m.value.isAnimationFly,M=>{M===!0&&m.value.currentModifier&&(D(B.value.find(v=>v.id===m.value.currentModifier.id)),m.value.isAnimationFly=!1)});const P=r.computed(()=>f.value.enable_sequential_modifiers?f.value.enable_sequential_modifiers:!0);return(M,v)=>{var j,H,Z,V,L,F,re,K,ee,G,W,N,X,$;return r.openBlock(),r.createElementBlock(r.Fragment,null,[(r.openBlock(),r.createBlock(r.Teleport,{to:"body"},[r.createVNode(Ci,{visible:T.value,textNotificationDefault:r.unref(m).textErrorRequaired,backgroundColor:r.unref(f).accent_color?r.unref(f).accent_color:"#FF6D2E","onUpdate:visible":v[0]||(v[0]=q=>T.value=q)},null,8,["visible","textNotificationDefault","backgroundColor"])])),r.createElementVNode("div",_u,[r.createElementVNode("div",wu,[r.createElementVNode("div",{class:r.normalizeClass(["card_header_inner_back",[(j=r.unref(m).openCard)!=null&&j.proteins_amount?"card_header_inner_back_nutrients":""]]),"aria-label":"Закрыть выбор модификаторов",onClick:v[1]||(v[1]=q=>i("close"))},[r.createVNode(Cr,{class:"arrow_bottom"})],2),r.createElementVNode("div",Cu,[(H=r.unref(m).openCard)!=null&&H.energy_amount?(r.openBlock(),r.createElementBlock("div",Eu,[r.createElementVNode("b",null,r.toDisplayString((Z=r.unref(m).openCard)==null?void 0:Z.energy_amount),1),v[4]||(v[4]=r.createElementVNode("p",null,"Килокалории",-1))])):r.createCommentVNode("",!0),(V=r.unref(m).openCard)!=null&&V.proteins_amount?(r.openBlock(),r.createElementBlock("div",yu,[r.createElementVNode("b",null,r.toDisplayString((L=r.unref(m).openCard)==null?void 0:L.proteins_amount),1),v[5]||(v[5]=r.createElementVNode("p",null,"Белки",-1))])):r.createCommentVNode("",!0),(F=r.unref(m).openCard)!=null&&F.fat_amount?(r.openBlock(),r.createElementBlock("div",bu,[r.createElementVNode("b",null,r.toDisplayString((re=r.unref(m).openCard)==null?void 0:re.fat_amount),1),v[6]||(v[6]=r.createElementVNode("p",null,"Жиры",-1))])):r.createCommentVNode("",!0),(K=r.unref(m).openCard)!=null&&K.carbohydrates_amount?(r.openBlock(),r.createElementBlock("div",Au,[r.createElementVNode("b",null,r.toDisplayString((ee=r.unref(m).openCard)==null?void 0:ee.carbohydrates_amount),1),v[7]||(v[7]=r.createElementVNode("p",null,"Углеводы",-1))])):r.createCommentVNode("",!0)]),r.createElementVNode("div",{class:r.normalizeClass(["card_header_inner_back",[(G=r.unref(m).openCard)!=null&&G.proteins_amount?"card_header_inner_back_nutrients":""]]),style:{marginRight:"10px"},"aria-label":"Закрыть выбор модификаторов",onClick:v[2]||(v[2]=q=>i("close"))},[r.createVNode(la,{class:"cross_bottom"})],2)]),r.createElementVNode("div",Su,[r.createElementVNode("p",Iu,r.toDisplayString((W=r.unref(m).groupCurrentOpen)==null?void 0:W.name),1),r.createElementVNode("p",Nu,"Выбрано "+r.toDisplayString(r.unref(p))+" из "+r.toDisplayString(r.unref(_)),1),r.withDirectives((r.openBlock(),r.createElementBlock("div",{class:r.normalizeClass((N=r.unref(m).groupModifiers.find(q=>{var J;return q.id===((J=r.unref(m).groupCurrentOpen)==null?void 0:J.id)}))!=null&&N.group_modifiers.length?"wrapper_modifiers_card":"wrapper_modifiers_card_column")},[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(((X=r.unref(m).groupCurrentOpen)==null?void 0:X.group_modifiers)||[],q=>{var J,le,se;return r.openBlock(),r.createElementBlock("div",{key:q.id,ref_for:!0,ref:r.unref(B).set,id:q.id,style:r.normalizeStyle({pointerEvents:r.unref(C)?"none":"auto"}),class:r.normalizeClass(["modifier_card",{hidden_modifier_card:q.default_amount===0&&((J=r.unref(m).groupCurrentOpen)==null?void 0:J.id)==="Добавки2000"&&q.min_amount===0&&q.max_amount===0}]),tabindex:"0",role:"button","data-clickable":"true","aria-label":`Выбрать модификатор группы ${q.name}`,onClick:oe=>r.unref(u).modifierSelect(q)},[r.createElementVNode("div",{class:r.normalizeClass([{modifier_card_active:r.unref(m).groupModifiersSelected.some(oe=>{var ge;return oe.group===((ge=r.unref(m).groupCurrentOpen)==null?void 0:ge.id)&&oe.modifiers.some(Ee=>Ee.id===q.id)})},"wrapper_image_corners"])},[q.amount>1?(r.openBlock(),r.createElementBlock("div",ku,r.toDisplayString(q.amount),1)):r.createCommentVNode("",!0),r.createElementVNode("div",Ru,[q.video_link?r.withDirectives((r.openBlock(),r.createElementBlock("video",Ou,[r.createElementVNode("source",{src:q.video_link||"",type:"video/webm"},null,8,Mu)])),[[r.unref(Er)]]):(r.openBlock(),r.createElementBlock("img",{key:0,class:"modifier_image",src:q.image_link||r.unref(f).fallback_image||"",alt:q.name},null,8,Bu)),r.createElementVNode("div",{class:r.normalizeClass(["wrapper_modifier_title",{wrapper_modifier_title_required:q.min_amount>0||q.required}])},[r.createElementVNode("h3",Du,r.toDisplayString(q.name),1),r.createElementVNode("p",null,"+"+r.toDisplayString(((se=(le=q.sizes)==null?void 0:le.find(oe=>oe.id===r.unref(m).selectedSize.id))==null?void 0:se.price)||q.price||0)+"₽",1)],2)])],2)],14,Tu)}),128))],2)),[[r.unref(Xr),($=r.unref(m).groupModifiers.find(q=>{var J;return q.id===((J=r.unref(m).groupCurrentOpen)==null?void 0:J.id)}))!=null&&$.group_modifiers.length?{}:!1]]),P.value?(r.openBlock(),r.createElementBlock("div",vu,[r.createElementVNode("button",{onClick:v[3]||(v[3]=q=>k()),class:"modifier_continue_or_add"},r.toDisplayString(r.unref(x)?"Добавить":"Продолжить"),1)])):r.createCommentVNode("",!0)],512)])],64)}}}),[["__scopeId","data-v-6cd4c87b"]]),Lu={key:0,class:"slider_container"},Fu={key:0,class:"card_size_place"},Vu=["onClick","aria-label"],Uu={key:1,class:"card_size static"},zu=["onClick"],mo=3,Hu=We(r.defineComponent({__name:"SizeModifier",setup(a){const l=Lt(),{stateCard:i}=_e.storeToRefs(l),{width:o}=xt.useWindowSize(),u=r.ref(50),f=r.ref(),m=r.ref(0),p=r.ref(null),_=r.computed(()=>{var k;return o.value,(((k=p.value)==null?void 0:k.offsetWidth)||0)/Math.min(i.value.productSizes.length,mo)}),x=r.computed(()=>i.value.productSizes.length<4?{left:`${u.value}%`,width:`${_.value-8}px`}:{left:"50%",transform:"translate(-50%, -50%)",width:`${_.value-8}px`}),C=r.computed(()=>{var M;if(i.value.productSizes.length<4)return i.value.productSizes[f.value.index]||i.value.productSizes[0];const k=m.value+1,P=((M=y.value[k])==null?void 0:M.originalIndex)??1;return i.value.productSizes[P]}),y=r.computed(()=>{if(i.value.productSizes.length<4)return i.value.productSizes;const k=i.value.productSizes;return[...k.map((P,M)=>({...P,originalIndex:M})),...k.map((P,M)=>({...P,originalIndex:M})),...k.map((P,M)=>({...P,originalIndex:M}))]}),I=(k,P)=>{if(f.value={id:k.id,title:k.name,index:P,is_default:k.is_default},k.price!==null&&i.value.openCard&&(i.value.openCard={...i.value.openCard,price:k.price}),i.value.selectedSize=k,i.value.productSizes.length>=4){const M=m.value+1;P<M?B():P>M&&T()}else{const M=i.value.productSizes.length,v=P*(100/M);u.value=v}},B=()=>{var k;if(!(i.value.productSizes.length<4)){if(m.value--,m.value<i.value.productSizes.length-mo+1){m.value+=i.value.productSizes.length;const P=(k=p.value)==null?void 0:k.querySelector(".card_size");P&&(P.style.transition="none",P.style.transform=`translateX(-${m.value*_.value}px)`,P.offsetHeight,P.style.transition="transform 0.2s ease-in-out")}D()}},T=()=>{var k;if(!(i.value.productSizes.length<4)){if(m.value++,m.value>=i.value.productSizes.length*2){m.value-=i.value.productSizes.length;const P=(k=p.value)==null?void 0:k.querySelector(".card_size");P&&(P.style.transition="none",P.style.transform=`translateX(-${m.value*_.value}px)`,P.offsetHeight,P.style.transition="transform 0.2s ease-in-out")}D()}},D=()=>{var v;if(i.value.productSizes.length<4)return;const k=m.value+1,P=((v=y.value[k])==null?void 0:v.originalIndex)??0,M=i.value.productSizes[P];f.value={id:M.id,title:M.name,index:P,is_default:M.is_default}};return r.watch([()=>i.value.productSizes,p],([k=[],P])=>{if(Array.isArray(k)&&k.length>0){let M=k.findIndex(v=>v.is_default===!0);console.log(M),M>-1?(m.value=M,I(k[M],M)):k.length>mo?I(k[1],1):I(k[0],0)}}),r.watch([()=>{var k;return(k=i.value.selectedSize)==null?void 0:k.id},()=>i.value.groupModifiersSelected],([k,P])=>{if(!k||!Array.isArray(P))return;const M=P.map(v=>({...v,modifiers:v.modifiers.map(j=>{if(!j.sizes||j.sizes.length===0)return j;const H=j.sizes.find(Z=>Z.id===k);return H?{...j,size:H,price:H.price??j.price}:j})}));JSON.stringify(M)!==JSON.stringify(i.value.groupModifiersSelected)&&(i.value.groupModifiersSelected=M)},{deep:!0}),(k,P)=>r.unref(i).productSizes.length>1&&f.value?(r.openBlock(),r.createElementBlock("div",Lu,[r.createElementVNode("div",{class:"card_size_place_wrapper",ref_key:"sliderWrapper",ref:p},[r.unref(i).productSizes.length>1&&f.value?(r.openBlock(),r.createElementBlock("div",Fu,[r.unref(i).productSizes.length>3?(r.openBlock(),r.createElementBlock("ul",{key:0,class:"card_size",style:r.normalizeStyle({transform:`translateX(-${m.value*_.value}px)`})},[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(y.value,(M,v)=>(r.openBlock(),r.createElementBlock("li",{key:`${M.id}-${v}`,onClick:j=>I(M,v),class:r.normalizeClass({active:f.value.id===M.id&&f.value.index===M.originalIndex}),tabindex:"0",role:"button","aria-label":`Выбрать размер ${M.name}`},[r.createElementVNode("p",null,r.toDisplayString(M.alt_name?M.alt_name:M.name),1)],10,Vu))),128))],4)):(r.openBlock(),r.createElementBlock("ul",Uu,[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(r.unref(i).productSizes,(M,v)=>(r.openBlock(),r.createElementBlock("li",{key:`${M.id}-${v}`,onClick:j=>I(M,v),class:r.normalizeClass({active:f.value.id===M.id&&f.value.index===v}),tabindex:"0",role:"button"},[r.createElementVNode("p",null,r.toDisplayString(M.alt_name?M.alt_name:M.name),1)],10,zu))),128))])),r.createElementVNode("div",{class:"size_active",style:r.normalizeStyle(x.value)},[r.createElementVNode("p",null,r.toDisplayString(C.value.alt_name?C.value.alt_name:C.value.name),1)],4)])):r.createCommentVNode("",!0)],512)])):r.createCommentVNode("",!0)}}),[["__scopeId","data-v-e2faab10"]]),Gu="data:image/svg+xml,%3csvg%20width='18'%20height='20'%20viewBox='0%200%2018%2020'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M7.3063%2019.7525C8.12104%2019.7525%208.78152%2019.1097%208.78152%2018.3167C8.78152%2017.5236%208.12104%2016.8808%207.3063%2016.8808C6.49156%2016.8808%205.83108%2017.5236%205.83108%2018.3167C5.83108%2019.1097%206.49156%2019.7525%207.3063%2019.7525Z'%20fill='%23808080'/%3e%3cpath%20d='M7.3063%2019.2525C7.83733%2019.2525%208.26782%2018.8335%208.26782%2018.3167C8.26782%2017.7998%207.83733%2017.3808%207.3063%2017.3808C6.77526%2017.3808%206.34478%2017.7998%206.34478%2018.3167C6.34478%2018.8335%206.77526%2019.2525%207.3063%2019.2525Z'%20stroke='%23F2F7FF'%20stroke-width='0.999998'/%3e%3cpath%20d='M14.4716%2019.7525C15.2864%2019.7525%2015.9469%2019.1097%2015.9469%2018.3167C15.9469%2017.5236%2015.2864%2016.8808%2014.4716%2016.8808C13.6569%2016.8808%2012.9964%2017.5236%2012.9964%2018.3167C12.9964%2019.1097%2013.6569%2019.7525%2014.4716%2019.7525Z'%20fill='%23808080'/%3e%3cpath%20d='M14.4716%2019.2525C15.0027%2019.2525%2015.4332%2018.8335%2015.4332%2018.3167C15.4332%2017.7998%2015.0027%2017.3808%2014.4716%2017.3808C13.9406%2017.3808%2013.5101%2017.7998%2013.5101%2018.3167C13.5101%2018.8335%2013.9406%2019.2525%2014.4716%2019.2525Z'%20stroke='%23F2F7FF'%20stroke-width='0.999998'/%3e%3cpath%20d='M0.770536%203.75L4.56158%206.21L6.66771%2015.23H15.1025L17.2086%208.26'%20stroke='%23F2F7FF'%20stroke-width='1.5'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3cpath%20d='M9.19507%2011.95H12.2669H15.945'%20stroke='%23F2F7FF'%20stroke-width='1.5'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3cpath%20d='M11.1908%200.830648V7.34648L8.26615%204.49981C8.03242%204.27231%207.64886%204.27231%207.41513%204.49981C7.35957%204.55378%207.3155%204.61788%207.28542%204.68845C7.25535%204.75902%207.23987%204.83467%207.23987%204.91106C7.23987%204.98746%207.25535%205.06311%207.28542%205.13368C7.3155%205.20425%207.35957%205.26835%207.41513%205.32231L11.3646%209.16648C11.5983%209.39398%2011.9759%209.39398%2012.2096%209.16648L16.159%205.32231C16.2145%205.26831%2016.2585%205.20419%2016.2885%205.13363C16.3186%205.06307%2016.334%204.98744%2016.334%204.91106C16.334%204.83469%2016.3186%204.75906%2016.2885%204.6885C16.2585%204.61794%2016.2145%204.55382%2016.159%204.49981C16.1035%204.44581%2016.0377%204.40297%2015.9652%204.37374C15.8927%204.34451%2015.815%204.32947%2015.7365%204.32947C15.658%204.32947%2015.5803%204.34451%2015.5078%204.37374C15.4353%204.40297%2015.3695%204.44581%2015.314%204.49981L12.3894%207.34648V0.830648C12.3894%200.509814%2012.1197%200.247314%2011.7901%200.247314C11.4604%200.247314%2011.1908%200.509814%2011.1908%200.830648Z'%20fill='%23F2F7FF'/%3e%3c/svg%3e",Wu={class:"counter_container"},Xu={class:"card_size_place_wrapper",ref:"sliderWrapper"},$u={class:"cart_amount_counter"},ju={class:"button_circle_number"},qu=We(r.defineComponent({__name:"NumberModifier",props:{qr_menu:{type:Boolean}},setup(a){const l=Lt(),{stateCard:i}=_e.storeToRefs(l),o=ke.useRouter(),u=a,f=()=>{var p,_,x,C;(_=(p=o.options.history.state)==null?void 0:p.back)!=null&&_.includes("mode=pdf")&&u.qr_menu||(x=i.value.openCard)!=null&&x.amount&&((C=i.value.openCard)==null?void 0:C.amount)>1&&(i.value.openCard.amount-=1)},m=()=>{var p,_,x;(_=(p=o.options.history.state)==null?void 0:p.back)!=null&&_.includes("mode=pdf")&&u.qr_menu||(x=i.value.openCard)!=null&&x.amount&&(i.value.openCard.amount+=1)};return(p,_)=>{var x,C;return r.openBlock(),r.createElementBlock("div",Wu,[r.createElementVNode("div",Xu,[r.createElementVNode("div",$u,[r.createElementVNode("p",{class:r.normalizeClass(["cart_circle_minus",[((x=r.unref(i).openCard)==null?void 0:x.amount)===1?"card_circle_minus_alone":""]]),"aria-label":"Уменьшить количество продукта","data-clickable":"true",onClick:r.withModifiers(f,["stop","prevent"])},[..._[0]||(_[0]=[r.createElementVNode("span",null,null,-1)])],2),r.createElementVNode("p",ju,r.toDisplayString((C=r.unref(i).openCard)==null?void 0:C.amount),1),r.createElementVNode("p",{class:"cart_circle_plus","aria-label":"Увеличить количество продукта","data-clickable":"true",onClick:r.withModifiers(m,["stop","prevent"])},"+")])],512)])}}}),[["__scopeId","data-v-50b09b8c"]]);function go(a,l=800){const i=r.ref(a),o=r.ref(a);let u=null,f=null,m=a;const p=_=>{f||(f=_);const x=_-f,C=Math.min(x/l,1),y=C<.5?4*C*C*C:1-Math.pow(-2*C+2,3)/2;i.value=Math.round(m+(o.value-m)*y),C<1?u=requestAnimationFrame(p):(i.value=o.value,u=null)};return r.watch(o,()=>{u&&cancelAnimationFrame(u),m=i.value,f=null,u=requestAnimationFrame(p)},{immediate:!0}),r.onUnmounted(()=>{u&&cancelAnimationFrame(u)}),{displayNumber:i,targetNumber:o,update:_=>{o.value=_}}}const ft=r.defineComponent({__name:"RecountNumber",props:{price:{type:Number,required:!0},duration:{type:Number},fixedFloat:{type:Number,require:!1}},setup(a){const l=a,{displayNumber:i,update:o}=go(l.price||0,l.duration||800);return r.watchEffect(()=>{o(l.price)}),(u,f)=>(r.openBlock(),r.createElementBlock("span",null,r.toDisplayString(r.unref(i).toFixed(a.fixedFloat)),1))}}),Zu={class:"button_price button_price_modifiers"},Yu=["src"],Ku={class:"button_text_container"},Qu={class:"button_text_price"},Ju=We(r.defineComponent({__name:"ButtonPriceCount",props:{qr_menu:{type:Boolean,default:!1},closeProduct:{}},setup(a,{expose:l}){const i=ke.useRouter(),o=ke.useRoute(),u=Lt(),f=ot(),m=Ct(),p=a,{stateCard:_,totalPrice_libCard:x,isOpenWindow:C,isAddToCard:y}=_e.storeToRefs(u),{isDesktop:I}=Wn(),{itemThemes:B}=_e.storeToRefs(m),T=r.ref(!0),D=r.ref(!1),k=r.computed(()=>I.value?!1:T.value),P=r.ref([]),M=r.ref([]),v=()=>{var H,Z,V,L,F;if((Z=(H=i.options.history.state)==null?void 0:H.back)!=null&&Z.includes("mode=pdf")&&p.qr_menu)return;if(T.value){u.setCurrentCard(_.value.openCard),D.value=!0;const re=_.value.groupModifiers.findIndex(K=>u.checkedRequiredBtn.group.id===K.id);u.checkedRequiredBtn.haveRequaire&&u.toggleNotRequire(u.checkedRequiredBtn.group,re);return}const j=_.value.groupModifiersSelected||[];if(P.value=[],M.value=[],Array.isArray(j)&&j.length>0&&j.forEach(re=>{const K=re.group,ee=re.modifiers||[];K==="Добавки2000"?P.value=ee.map(G=>{var W;return{...G,old_price:G.price,size:Array.isArray(G.size)?G.size.map(N=>N.id).filter(Boolean):(W=G.size)!=null&&W.id?G.size.id:void 0}}):ee.length>0&&M.value.push({group:K,is_fake:re.is_fake||!1,is_product_determining:re.is_product_determining||!1,modifiers:ee.map(G=>{var W;return{...G,old_price:G.price,size:Array.isArray(G.size)?G.size.map(N=>N.id).filter(Boolean):(W=G.size)!=null&&W.id?G.size.id:void 0}})})}),document.body.style.overflow="",_.value.openCard){const re={id:_.value.openCard.id,is_fake:_.value.openCard.is_fake||!1,is_od_united_product:_.value.openCard.is_od_united_product||!1,amount:_.value.openCard.amount,name:_.value.openCard.name,image_link:_.value.openCard.image_link,price:_.value.openCard.price,old_price:_.value.openCard.price,size:((V=_.value.selectedSize)==null?void 0:V.id)??((F=(L=_.value.openCard.sizes)==null?void 0:L.find(K=>K.is_default))==null?void 0:F.id),sizes:_.value.openCard.sizes||[],modifiers:P.value,groups:_.value.openCard.groups,group_modifiers:M.value,energy_amount:_.value.openCard.energy_amount??0,proteins_amount:_.value.openCard.proteins_amount??0,fat_amount:_.value.openCard.fat_amount??0,carbohydrates_amount:_.value.openCard.carbohydrates_amount??0};p.closeProduct&&p.closeProduct(),f.addToCart(re),y.value=!0}C.value=!1,p.qr_menu&&i.push(`/${o.params.orgId}/`)};return r.watch(()=>_.value.productSizes,j=>{!j||j.length===0||!_.value.selectedSize||(_.value.selectedSize={..._.value.selectedSize})},{immediate:!0}),r.watchEffect(()=>{u.checkedRequiredBtn.haveRequaire?T.value=!0:T.value=!1}),r.onMounted(()=>{y.value=!1}),l({addProductToCart:v}),(j,H)=>(r.openBlock(),r.createElementBlock(r.Fragment,null,[(r.openBlock(),r.createBlock(r.Teleport,{to:"body"},[r.createVNode(Ci,{visible:D.value,textNotificationDefault:r.unref(_).textErrorRequaired,backgroundColor:r.unref(B).accent_color?r.unref(B).accent_color:"#FF6D2E",buttonAccept:null,"onUpdate:visible":H[0]||(H[0]=Z=>D.value=Z)},null,8,["visible","textNotificationDefault","backgroundColor"])])),r.createElementVNode("div",{class:"button_price_bg_product",onTouchstart:H[3]||(H[3]=r.withModifiers(()=>{},["stop"])),onPointerdown:H[4]||(H[4]=r.withModifiers(()=>{},["stop"]))},[r.createElementVNode("div",Zu,[r.unref(I)?r.createCommentVNode("",!0):(r.openBlock(),r.createBlock(qu,{key:0,qr_menu:a.qr_menu},null,8,["qr_menu"])),r.createElementVNode("div",{class:r.normalizeClass(["card_product_button_buy",{buy_active:!k.value}]),"data-clickable":"true",onClick:v,onTouchstart:H[1]||(H[1]=r.withModifiers(()=>{},["stop"])),onPointerdown:H[2]||(H[2]=r.withModifiers(()=>{},["stop"]))},[r.unref(I)?r.createCommentVNode("",!0):(r.openBlock(),r.createElementBlock("img",{key:0,src:r.unref(Gu),class:"card_product_button_icon"},null,8,Yu)),r.createElementVNode("div",Ku,[r.createElementVNode("p",Qu,[r.createVNode(ft,{price:+r.unref(x),fixedFloat:2},null,8,["price"]),H[5]||(H[5]=r.createTextVNode(" ₽ ",-1))])])],34)])],32)],64))}}),[["__scopeId","data-v-15db613c"]]),e0={class:"modified_amount"},t0={class:"hide_image_corners"},n0=["src"],r0={class:"wrapper_modifier_title"},i0={class:"amount_title"},o0={class:"wrapper_amount_counter"},s0={class:"amount_count"},a0={class:"amount_wrapper"},l0={class:"add_counter_amount"},c0=We(r.defineComponent({__name:"ModalAmount",setup(a){const l=Lt(),i=Ct(),{itemThemes:o}=_e.storeToRefs(i),{stateCard:u}=_e.storeToRefs(l),f=r.computed(()=>{var _,x,C;return((C=(x=(_=u.value.currentModifier)==null?void 0:_.sizes)==null?void 0:x.find(y=>y.id===u.value.selectedSize.id))==null?void 0:C.price)??mr(u.value.currentModifier)}),m=()=>{u.value.currentModifier&&(u.value.currentModifier.amount=u.value.modalCount),l.modifierSelect(u.value.currentModifier),u.value.isModifiedAmount=!1},p=()=>{u.value.modalCount=1,u.value.currentModifier.amount=1};return(_,x)=>{var C,y;return r.openBlock(),r.createElementBlock(r.Fragment,null,[r.createElementVNode("div",e0,[r.createElementVNode("div",t0,[r.createElementVNode("img",{class:"modifier_image",src:((C=r.unref(u).currentModifier)==null?void 0:C.image_link)||r.unref(o).fallback_image||""},null,8,n0),r.createElementVNode("div",r0,[r.createElementVNode("p",i0,r.toDisplayString((y=r.unref(u).currentModifier)==null?void 0:y.name),1),r.createElementVNode("p",null,"+ "+r.toDisplayString(f.value)+"₽",1)])])]),r.createElementVNode("div",o0,[r.createElementVNode("div",{class:"amount_mines",onClick:x[0]||(x[0]=r.withModifiers((...I)=>r.unref(l).minusAmount&&r.unref(l).minusAmount(...I),["stop"]))},[...x[1]||(x[1]=[r.createElementVNode("div",null,null,-1)])]),r.createElementVNode("p",s0,r.toDisplayString(r.unref(u).modalCount),1),r.createElementVNode("div",a0,[r.createVNode(wi,{onClick:r.withModifiers(r.unref(l).plusAmount,["stop"])},null,8,["onClick"])])]),r.createElementVNode("p",{class:"clear_count",onClick:r.withModifiers(p,["stop"])},"Убрать все"),r.createElementVNode("div",l0,[r.createVNode(sn,{textButtonDefault:"Добавить",onClick:m,class:"button_add_group_modifiers"})])],64)}}}),[["__scopeId","data-v-84debd5d"]]),d0=(a,l,i)=>Math.max(l,Math.min(a,i)),u0=(a,l)=>Math.pow(a,l*5),ca=(a,l,i)=>l===0||Math.abs(l)===1/0?u0(a,i):a*l*i/(l+i*a),Ei=(a,l)=>l*parseFloat(a)/100,po=(a,l,i,o=.15)=>o===0?d0(a,l,i):a<l?-ca(l-a,i-l,o)+l:a>i?+ca(a-i,i-l,o)+i:a,an=(a,{min:l,max:i})=>l!==void 0&&a<l?l:i!==void 0&&a>i?i:a;function f0(a,l,i){const o=r.ref(0),u=r.computed(()=>a.value.map(_=>typeof _=="string"?Ei(_,i.value):_)),f=r.computed(()=>Math.min(...u.value)),m=r.computed(()=>Math.max(...u.value)),p=r.computed(()=>{const _=u.value.reduce((x,C)=>Math.abs(C-l.value)<Math.abs(x-l.value)?C:x);return u.value.indexOf(_)});return{currentSnapPointIndex:o,flattenedSnapPoints:u,minSnapPoint:f,maxSnapPoint:m,closestSnapPointIndex:p}}const xo=We(r.defineComponent({__name:"BottomSheet",props:{duration:{default:250},snapPoints:{},initialSnapPoint:{},blocking:{type:Boolean,default:!0},canSwipeClose:{type:Boolean,default:!0},swipeCloseThreshold:{},canBackdropClose:{type:Boolean,default:!0},expandOnContentDrag:{type:Boolean,default:!0},modelValue:{type:Boolean},teleportTo:{default:"body"},teleportDefer:{type:Boolean,default:!1},headerClass:{},contentClass:{},footerClass:{}},emits:["opened","opening-started","closed","closing-started","ready","dragging-up","dragging-down","snapped","instinctHeight","update:modelValue"],setup(a,{expose:l,emit:i}){const o=a,u=i;let f=null;const m=r.ref(0),p=r.ref(!1),_=xt.useVModel(o,"modelValue",u,{passive:!0});r.watch(_,Se=>{Se?oe():ge||Ee()}),r.onMounted(()=>{_.value&&oe()});const x=r.ref(),C=r.ref(null),y=r.ref(null),I=r.ref(null),B=r.ref(null),T=r.ref(o.expandOnContentDrag),{height:D}=xt.useWindowSize(),{height:k}=xt.useElementBounding(x),{height:P}=xt.useElementBounding(C),{height:M}=xt.useElementBounding(B),{height:v}=xt.useElementBounding(y),j=r.computed({get(){return an(Math.ceil(M.value+P.value+v.value),{max:D.value})},set(Se){[P.value,M.value,v.value]=Se}}),H=r.ref(0),Z=r.ref(0),V=Ot.useMotionValue(0),L=Ot.useMotionValue(0),{snapPoints:F}=r.toRefs(o),re=r.computed(()=>F.value??[j.value]),{flattenedSnapPoints:K,currentSnapPointIndex:ee,closestSnapPointIndex:G,minSnapPoint:W,maxSnapPoint:N}=f0(re,H,D);let X;function $(Se){T.value=!0,q(Se)}function q(Se){T.value&&Se.preventDefault()}const J=Se=>{Se.key==="Escape"&&Ee()},le=()=>{o.canBackdropClose&&Ee()};let se=!1;const oe=async()=>{var Se;if(!se){ge&&(ge=!1,f&&(clearTimeout(f),f=null)),m.value++,_.value=!0,se=!0,u("opening-started");try{await r.nextTick(),await r.nextTick();const Ve=(Se=x.value)==null?void 0:Se.$el;if(!Ve){console.warn("[BottomSheet] sheet not ready, aborting"),_.value=!1;return}k.value=Ve.getBoundingClientRect().height;const kt=Ve.querySelector("[data-vsbs-content]"),rt=Ve.querySelector("[data-vsbs-header]"),Je=Ve.querySelector("[data-vsbs-footer]");if(j.value=[rt.getBoundingClientRect().height,kt.getBoundingClientRect().height,Je.getBoundingClientRect().height],await r.nextTick(),ee.value=K.value.findIndex(ve=>ve===W.value),o.initialSnapPoint){const ve=o.initialSnapPoint;if(ve<0||ve>=re.value.length)return console.warn("Index out of bounds");H.value=typeof re.value[ve]=="number"?an(re.value[ve],{max:D.value}):Ei(re.value[ve],D.value)}else H.value=an(W.value,{max:D.value});Z.value=H.value,V.jump(H.value),L.jump(H.value),requestAnimationFrame(()=>{X=Ot.animate(V,H.value,{duration:o.duration/1e3,ease:"easeInOut"}),X=Ot.animate(L,0,{duration:o.duration/1e3,ease:"easeInOut",onComplete:()=>{o.blocking&&u("opened")}})}),window.addEventListener("keydown",J)}finally{se=!1}}};let ge=!1;const Ee=()=>{ge||(se&&(se=!1),X&&X.stop(),L.stop(),V.stop(),Ot.animate(L,H.value||500,{duration:o.duration/1e3,ease:"easeInOut"}),p.value=!1,_.value=!1,ge=!0,u("closing-started"),window.removeEventListener("keydown",J),f&&clearTimeout(f),f=setTimeout(()=>{u("closed"),ge=!1,f=null},o.duration))},Fe=Se=>{if(re.value){if(Se<0||Se>=re.value.length){console.warn("Index out of bounds");return}ee.value=Se,H.value=typeof re.value[Se]=="number"?an(re.value[Se],{max:D.value}):Ei(re.value[Se],D.value),X=Ot.animate(V,H.value,{duration:o.duration/1e3,ease:"easeInOut",onComplete:()=>u("snapped",re.value.indexOf(re.value[Se]))})}};function ue(Se){Se>0?u("dragging-down"):Se<0&&u("dragging-up")}const nt=()=>{p.value=!0,H.value=k.value,Z.value=L.get(),V.jump(H.value),L.jump(Z.value)},Ae=async(Se,Ve)=>{await r.nextTick(),x.value&&(Z.value<=0&&(H.value-=Ve.delta.y),H.value<=W.value&&(H.value=W.value,Z.value+=Ve.delta.y,p.value=!0,L.set(o.canSwipeClose?an(Z.value,{min:0}):an(po(Z.value,-k.value,0,.5),{min:0}))),V.set(an(po(H.value,0,N.value,.25),{min:0,max:D.value})),ue(Ve.delta.y))},Ke=()=>{if(o.canSwipeClose){let Se=H.value/2;o.swipeCloseThreshold&&typeof o.swipeCloseThreshold=="number"&&(Se=o.swipeCloseThreshold),o.swipeCloseThreshold&&typeof o.swipeCloseThreshold=="string"&&o.swipeCloseThreshold.includes("%")&&(Se=H.value*(Number(o.swipeCloseThreshold.replace("%",""))/100)),Math.abs(Z.value)>Se&&(Z.value=H.value)}else Z.value=0;if(X=Ot.animate(L,Z.value,{duration:o.duration/1e3,ease:"easeInOut"}),Z.value===H.value){Z.value=0,Ee();return}ee.value=G.value,H.value=typeof re.value[G.value]=="number"?an(re.value[G.value],{max:D.value}):Ei(re.value[G.value],D.value),X=Ot.animate(V,H.value,{duration:o.duration/1e3,ease:"easeInOut",onComplete:()=>u("snapped",re.value.indexOf(re.value[G.value]))}),X=Ot.animate(L,0,{duration:o.duration/1e3,ease:"easeInOut"})},st=(Se,Ve)=>{if(H.value=k.value,Z.value=L.get(),X&&X.stop(),!I.value)return;const kt=I.value.scrollTop===0,rt=Ve.delta.y>0,Je=K.value.length===1,ve=.5>Math.abs(H.value-N.value);if(Je){if(!o.expandOnContentDrag)return T.value=!1;L.get()===0&&kt&&rt&&(T.value=!0),L.get()===0&&kt&&!rt&&(T.value=!1)}else{if(!o.expandOnContentDrag)return T.value=!1;p.value=!0,T.value=!0,ve&&(rt&&kt&&(T.value=!0),!rt&&kt&&(T.value=!1),kt||(T.value=!1))}},He=async(Se,Ve)=>{if(await r.nextTick(),!o.expandOnContentDrag)return T.value=!1;if(!x.value)return;Z.value===0&&T.value&&o.expandOnContentDrag&&(H.value-=Ve.delta.y),H.value<=W.value&&(H.value=W.value,T.value&&o.expandOnContentDrag&&(Z.value+=Ve.delta.y),Z.value=an(Z.value,{min:0,max:W.value}),L.set(o.canSwipeClose?an(Z.value,{min:0}):an(po(Z.value,-k.value,0,.5),{min:0}))),H.value>N.value&&(H.value=N.value),H.value=an(H.value,{max:D.value}),!(K.value.length===1)&&H.value===N.value&&(T.value=!1),V.set(H.value),ue(Ve.delta.y)},At=()=>{if(!I.value)return;const Se=I.value.scrollTop===0;T.value=Se},Te=xt.useDebounceFn(Se=>Fe(Se),o.duration);return r.watch(re,(Se,Ve)=>{if(_.value===!1||!Se||!Ve)return;const kt=Se[ee.value],rt=Ve[ee.value];typeof kt!="string"&&typeof rt!="string"&&(H.value=an(kt,{max:D.value}),kt!==rt&&(X=Ot.animate(V,H.value,{duration:o.duration/1e3,ease:"easeInOut"})))}),r.watch(D,()=>Te(ee.value)),l({open:oe,close:Ee,snapToPoint:Fe}),r.onUnmounted(()=>{f&&clearTimeout(f)}),(Se,Ve)=>(r.openBlock(),r.createBlock(r.Teleport,{to:a.teleportTo,defer:a.teleportDefer},[r.createElementVNode("div",r.mergeProps(Se.$attrs,{"data-vsbs-container":""}),[r.createVNode(r.unref(Ot.AnimatePresence),null,{default:r.withCtx(()=>[r.unref(_)&&a.blocking?(r.openBlock(),r.createBlock(r.unref(Ot.Motion),{ref:"backdrop",key:"backdrop-"+m.value,"data-vsbs-backdrop":"",onClick:Ve[0]||(Ve[0]=kt=>le()),transition:{ease:"easeInOut",duration:a.duration/1e3},initial:{opacity:0},animate:{opacity:1},exit:{opacity:0}},null,8,["transition"])):r.createCommentVNode("",!0)]),_:1}),r.createVNode(r.unref(Ot.AnimatePresence),null,{default:r.withCtx(()=>[r.unref(_)?(r.openBlock(),r.createBlock(r.unref(Ot.Motion),{ref_key:"sheet",ref:x,exit:{opacity:0},initial:!1,key:m.value,style:r.normalizeStyle({y:r.unref(L),z:1,height:r.unref(V)}),"data-vsbs-shadow":!a.blocking,"data-vsbs-sheet-show":r.unref(_),"data-vsbs-dragging":p.value,"aria-modal":"true","data-vsbs-sheet":"",tabindex:"-1"},{default:r.withCtx(()=>[r.createVNode(r.unref(Ot.Motion),{ref_key:"sheetHeader",ref:C,"data-vsbs-header":"",onPanStart:nt,onPan:Ae,onPanEnd:Ke,onTouchmove:$,class:r.normalizeClass(a.headerClass)},{default:r.withCtx(()=>[r.renderSlot(Se.$slots,"header",{},void 0,!0)]),_:3},8,["class"]),r.createElementVNode("div",{ref_key:"sheetScroll",ref:I,"data-vsbs-scroll":"",onScrollend:At},[r.createVNode(r.unref(Ot.Motion),{ref:"sheetContentWrapper","data-vsbs-content-wrapper":"",onPanStart:st,onPan:He,onPanEnd:Ke,onTouchmove:q},{default:r.withCtx(()=>[r.createElementVNode("div",{ref_key:"sheetContent",ref:B,"data-vsbs-content":"",class:r.normalizeClass(a.contentClass)},[r.renderSlot(Se.$slots,"default",{},void 0,!0)],2)]),_:3},512)],544),r.createVNode(r.unref(Ot.Motion),{ref_key:"sheetFooter",ref:y,"data-vsbs-footer":"",onPanStart:nt,onPan:Ae,onPanEnd:Ke,onTouchmove:$,class:r.normalizeClass(a.footerClass)},{default:r.withCtx(()=>[r.renderSlot(Se.$slots,"footer",{},void 0,!0)]),_:3},8,["class"])]),_:3},8,["style","data-vsbs-shadow","data-vsbs-sheet-show","data-vsbs-dragging"])):r.createCommentVNode("",!0)]),_:3})],16)],8,["to","defer"]))}}),[["__scopeId","data-v-a8913d51"]]);function bn(a,l=null){const i=oi();i.initCacheSingle("defaultImage");const o=r.computed(()=>i.cache.defaultImage||null),u=r.shallowRef(!1),f=r.computed(()=>{var x;return((x=r.toValue(a))==null?void 0:x.toString())||null}),m=xt.computedAsync(async()=>{const x=f.value;return x?(await i.initCacheSingle(x),i.cache[x]||null):null},null,{evaluating:u}),p=r.computed(()=>u.value&&f.value!==null);return{mediaUrl:r.computed(()=>m.value||r.toValue(l)||o.value||null),isLoading:p}}const h0={class:"card_product_modifiers_sheet_body"},m0={class:"card__pictures"},g0=["src"],p0=["src"],x0={class:"card_header_wrapper"},_0={key:0,class:"card_fire_kkal_wrapper"},w0={class:"card_content"},C0={class:"wrapper_size"},E0={key:0,class:"description"},y0={key:1},b0={class:"title_info_modifiers"},A0=We(r.defineComponent({__name:"CardProductPage",props:{configPage:{}},setup(a){const l=Ct(),i=Lt(),{stateCard:o,isOpenWindow:u,isAddToCard:f}=_e.storeToRefs(i),{itemThemes:m}=_e.storeToRefs(l),p=ke.useRouter(),_=ke.useRoute(),x=a,C=r.computed(()=>!!(_.query.mode==="pdf"&&x.configPage.qr_menu)),{mediaUrl:y}=bn(()=>{var P,M;return(P=o.value.openCard)!=null&&P.video_link?`${o.value.openCard.id}_video`:(M=o.value.openCard)!=null&&M.image_link?`${o.value.openCard.id}_image`:null},()=>{var P,M;return((P=o.value.openCard)==null?void 0:P.video_link)||((M=o.value.openCard)==null?void 0:M.image_link)||null}),I=()=>{x.configPage.qr_menu?C.value?p.push(`/${_.params.orgId}?mode=pdf`):p.push(`/${_.params.orgId}`):x.configPage.closeProduct()},B=()=>{f.value=!1,o.value.isSectionModifier=!1},T=()=>{o.value.isModifiedAmount=!1},D=r.ref(null),k=()=>{var P;(P=D.value)==null||P.addProductToCart()};return r.watch(()=>x.configPage.data,i.setCurrentCard),r.watch(()=>o.value.isSectionModifier,P=>{C.value&&document.body.classList.toggle("pdf_hidden",P)},{immediate:!0}),r.watchEffect(()=>{u.value||(u.value=x.configPage.is_closeProduct)}),r.onBeforeUnmount(()=>i.reset()),(P,M)=>{var v,j,H,Z,V,L;return r.openBlock(),r.createElementBlock("div",{class:"card_product_wrapper",style:r.normalizeStyle(C.value?"user-select: none;":"")},[r.createVNode(r.unref(xo),{modelValue:r.unref(o).isSectionModifier,"onUpdate:modelValue":M[0]||(M[0]=F=>r.unref(o).isSectionModifier=F),class:"card_product_modifiers_sheet",teleportTo:C.value?"#app":"body"},{default:r.withCtx(()=>[r.createElementVNode("div",h0,[r.createVNode(Pu,{onClose:B,onAddToCart:k}),r.createVNode(aa,{isSectionModifier:r.unref(o).isSectionModifier,toggleNotRequire:r.unref(i).toggleNotRequire},null,8,["isSectionModifier","toggleNotRequire"])])]),_:1},8,["modelValue","teleportTo"]),(r.openBlock(),r.createBlock(r.Teleport,{to:"body"},[r.unref(o).isModifiedAmount?(r.openBlock(),r.createElementBlock("div",{key:0,class:"wrapper_modified_amount",onClick:r.withModifiers(T,["stop"])},[r.createVNode(c0)])):r.createCommentVNode("",!0)])),r.createElementVNode("div",m0,[(v=r.unref(o).openCard)!=null&&v.video_link&&r.unref(y)?r.withDirectives((r.openBlock(),r.createElementBlock("video",{key:r.unref(y),loop:"",autoplay:"",muted:"",playsinline:"",class:"card__video"},[r.createElementVNode("source",{src:r.unref(y)||"",type:"video/webm"},null,8,g0)])),[[r.unref(Er)]]):(r.openBlock(),r.createElementBlock("img",{key:1,class:"card__pictures_images",src:r.unref(y)||"",alt:"Product image"},null,8,p0)),r.createElementVNode("div",x0,[r.createVNode(Cr,{class:"card_header_back",onClick:I,"aria-label":"Вернуться назад"}),(j=r.unref(o).openCard)!=null&&j.energy_amount?(r.openBlock(),r.createElementBlock("div",_0,[M[2]||(M[2]=r.createElementVNode("div",{class:"card_fire_kkal"},null,-1)),r.createElementVNode("p",null,[r.createElementVNode("b",null,r.toDisplayString((H=r.unref(o).openCard)==null?void 0:H.energy_amount),1),M[1]||(M[1]=r.createTextVNode(" Ккал ",-1))])])):r.createCommentVNode("",!0)]),r.createElementVNode("h4",null,r.toDisplayString((Z=r.unref(o).openCard)==null?void 0:Z.name),1),r.createElementVNode("div",{class:"card__pictures__gradient",style:r.normalizeStyle(r.unref(m).gradientStyle)},null,4)]),r.createElementVNode("div",w0,[r.createElementVNode("div",C0,[r.createVNode(Hu)]),(V=r.unref(o).openCard)!=null&&V.description?(r.openBlock(),r.createElementBlock("p",E0,r.toDisplayString((L=r.unref(o).openCard)==null?void 0:L.description),1)):r.createCommentVNode("",!0),r.unref(o).groupModifiers.length?(r.openBlock(),r.createElementBlock("div",y0,[r.createElementVNode("p",b0,r.toDisplayString(r.unref(m).dish_cart_mod_choice_text||"Настрой, как ты любишь"),1),r.createVNode(aa,{isSectionModifier:r.unref(o).isSectionModifier,toggleNotRequire:r.unref(i).toggleNotRequire},null,8,["isSectionModifier","toggleNotRequire"])])):r.createCommentVNode("",!0),r.createVNode(Ju,{ref_key:"buttonPriceRef",ref:D,qr_menu:a.configPage.qr_menu,closeProduct:a.configPage.closeProduct},null,8,["qr_menu","closeProduct"])])],4)}}}),[["__scopeId","data-v-a84e5942"]]),yi=_e.defineStore("modals",()=>{const a=new Map,l=(u,f)=>{const m=o(u).value;m.visible=!0,m.context=f},i=u=>{const f=o(u).value;f.visible=!1},o=u=>(a.has(u)||a.set(u,r.ref({visible:!1})),a.get(u));return{state:o,open:l,close:i}}),S0={key:0,class:"popupWindowDefault_overlay"},da=We(r.defineComponent({__name:"PopupWindowDefault",props:{visible:{type:Boolean}},emits:["update:visible"],setup(a,{emit:l}){const i=a,o=l,u=()=>{o("update:visible",!1)};return r.watch(()=>i.visible,async f=>{f&&await r.nextTick(),i.isVisible=f}),(f,m)=>(r.openBlock(),r.createElementBlock(r.Fragment,null,[r.createVNode(r.Transition,{name:"popupWindowDefaultBlack",appear:"",onAfterLeave:m[0]||(m[0]=()=>{o("update:visible",!1)})},{default:r.withCtx(()=>[i.visible?(r.openBlock(),r.createElementBlock("div",{key:0,class:"background_black",onClick:u})):r.createCommentVNode("",!0)]),_:1}),r.createVNode(r.Transition,{name:"popupWindowDefault",appear:"",onAfterLeave:m[1]||(m[1]=()=>{o("update:visible",!1)})},{default:r.withCtx(()=>[i.visible?(r.openBlock(),r.createElementBlock("div",S0,[r.renderSlot(f.$slots,"default",{},void 0,!0)])):r.createCommentVNode("",!0)]),_:3})],64))}}),[["__scopeId","data-v-08e0e008"]]),I0=["src"],N0={class:"cart_box_content_wrapper"},T0={class:"cart_box_content_info"},k0={class:"cart_box_name"},R0={class:"cart_box_size"},B0={class:"cart_amount"},O0={class:"cart_amount_count"},M0={class:"cart_box_info_more"},D0={key:1,class:"cart_modifier_info"},v0={class:"cart_modifier_content"},P0={class:"wrapper_price_count_cart"},L0={class:"count_cart_box"},F0={class:"wrapper_modifiers_discount"},ua=We(r.defineComponent({__name:"CartBox",props:{index:Number,cardItem:Object,isShowModifiers:Boolean},emits:["delete"],setup(a,{emit:l}){const i=a,o=ot(),u=Ct(),f=yi(),{itemThemes:m}=_e.storeToRefs(u),p=r.ref(0),_=r.ref(0),x=r.ref(!1),C=r.ref(!1),y=r.ref(i.isShowModifiers?u.itemThemes.qr_show_modifiers_in_cart??!1:u.itemThemes.kiosk_show_modifiers_in_cart??!1),{displayNumber:I,update:B}=go(0,800),T=r.computed(()=>{var K,ee;const F=((K=i.cardItem)==null?void 0:K.modifiers)??[],re=(((ee=i.cardItem)==null?void 0:ee.group_modifiers)??[]).flatMap(G=>G.modifiers??[]);return[...F,...re]}),{mediaUrl:D}=bn(()=>{var F;return((F=i.cardItem)==null?void 0:F.id)+"_image"},()=>{var F;return(F=i.cardItem)==null?void 0:F.image_link}),k=r.computed(()=>{var F,re;return((F=i.cardItem)==null?void 0:F.total_new_price)??mr(i.cardItem)*((re=i.cardItem)==null?void 0:re.amount)}),P=()=>f.open("cart-delete-confirm",i.cardItem),M=()=>{y.value=!y.value},v=()=>{o.plusAmount(i.cardItem.idSystem)},j=()=>{i.cardItem.amount>1?o.minusAmount(i.cardItem.idSystem):P()},H=F=>{p.value=F.touches[0].clientX,x.value=!0},Z=F=>{x.value&&(_.value=F.touches[0].clientX-p.value,_.value>0&&(_.value=0))},V=()=>{x.value=!1,_.value<-115&&P(),_.value=0};r.onMounted(()=>{i.index===0&&(C.value=!0,setTimeout(()=>{_.value=-90,setTimeout(()=>{_.value=0,C.value=!1},700)},0))});const L=r.computed(()=>{const F=i.index===0&&C.value?1:`${1-Math.abs(_.value)/200}`;return{transform:`translateX(${_.value}px)`,opacity:F,transition:x.value?"none":"transform 0.7s, opacity 0.7s"}});return r.watch(k,B,{immediate:!0}),(F,re)=>{var K,ee,G,W,N,X,$,q;return r.openBlock(),r.createElementBlock("div",{class:"cart_box_wrapper",onTouchstart:H,onTouchmove:Z,onTouchend:V,style:r.normalizeStyle(L.value)},[re[2]||(re[2]=r.createElementVNode("div",{class:"wrapper_cart_delete"},[r.createElementVNode("div",{class:"cart_delete"})],-1)),r.createElementVNode("img",{src:r.unref(D)||"",class:"cart_box_image"},null,8,I0),r.createElementVNode("div",N0,[r.createElementVNode("div",T0,[r.createElementVNode("p",k0,r.toDisplayString((K=a.cardItem)==null?void 0:K.name),1),r.createElementVNode("p",R0,r.toDisplayString(((G=(ee=a.cardItem)==null?void 0:ee.sizes.find(J=>{var le;return J.id===((le=a.cardItem)==null?void 0:le.size)}))==null?void 0:G.alt_name)||((N=(W=a.cardItem)==null?void 0:W.sizes.find(J=>{var le;return J.id===((le=a.cardItem)==null?void 0:le.size)}))==null?void 0:N.name)),1),(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(((X=i.cardItem)==null?void 0:X.discounts)||[],(J,le)=>(r.openBlock(),r.createElementBlock("div",{key:le,class:"discount_banner"},[r.createElementVNode("p",null,r.toDisplayString(J.name),1),r.createElementVNode("p",null,r.toDisplayString(J.discount)+"₽",1)]))),128)),r.createElementVNode("div",B0,[r.createElementVNode("button",{onClick:j},"-"),r.createElementVNode("p",O0,r.toDisplayString(i.cardItem.amount),1),r.createElementVNode("button",{onClick:v},"+")])]),r.createElementVNode("div",M0,[r.createElementVNode("div",{class:"cart_box_remove_item",onClick:P},[r.createVNode(la)]),($=i.cardItem)!=null&&$.new_price?(r.openBlock(),r.createElementBlock("p",{key:0,class:r.normalizeClass({discount_new_price:(q=i.cardItem)==null?void 0:q.new_price})},r.toDisplayString((i.cardItem.new_price*i.cardItem.amount).toFixed(2)+"₽"),3)):r.createCommentVNode("",!0),r.createElementVNode("p",null,r.toDisplayString(r.unref(I).toFixed(2)+"₽"),1)])]),!y.value&&T.value.length>0?(r.openBlock(),r.createElementBlock("div",{key:0,class:"cart_modifier_toggle",onTouchstart:r.withModifiers(M,["stop"])},[...re[0]||(re[0]=[r.createElementVNode("p",{class:"cart_info_more"},"Посмотреть модификаторы",-1),r.createElementVNode("p",{class:"cart_arrow"},null,-1)])],32)):r.createCommentVNode("",!0),y.value&&T.value.length>0?(r.openBlock(),r.createElementBlock("div",D0,[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(T.value,J=>{var le;return r.openBlock(),r.createElementBlock("div",{class:"cart_modifier_item",key:J.id},[r.createElementVNode("div",v0,[r.createVNode(wi,{id:"plus_orange"}),r.createElementVNode("p",null,r.toDisplayString(J.name),1)]),r.createElementVNode("div",P0,[r.createElementVNode("p",L0,r.toDisplayString(`x${J.amount}`),1),r.createElementVNode("div",F0,[J!=null&&J.new_price?(r.openBlock(),r.createElementBlock("p",{key:0,class:r.normalizeClass({discount_new_price:(le=J==null?void 0:J.new_price)==null?void 0:le.toFixed(2)})},r.toDisplayString((J.new_price*J.amount).toFixed(2)+"₽"),3)):r.createCommentVNode("",!0),r.createElementVNode("p",null,r.toDisplayString((J.total_new_price??J.price*J.amount).toFixed(2)+"₽"),1)])])])}),128)),r.createElementVNode("div",{class:"cart_modifier_arrow",onTouchstart:r.withModifiers(M,["stop"])},[...re[1]||(re[1]=[r.createElementVNode("p",{class:"cart_info_more"},"Скрыть",-1),r.createElementVNode("p",{class:"cart_arrow_top"},null,-1)])],32)])):r.createCommentVNode("",!0)],36)}}}),[["__scopeId","data-v-9cc87c29"]]),V0={},U0={class:"nfc_x",viewBox:"0 0 48 48"};function z0(a,l){return r.openBlock(),r.createElementBlock("svg",U0,[...l[0]||(l[0]=[r.createElementVNode("rect",{x:"8",y:"12",width:"32",height:"24",rx:"4",ry:"4",stroke:"#B00020","stroke-width":"2.4",fill:"none"},null,-1),r.createElementVNode("path",{d:"M14 16L34 30M34 16L14 30",stroke:"#B00020","stroke-width":"3","stroke-linecap":"round"},null,-1)])])}const H0=We(V0,[["render",z0]]),G0={},W0={style:{},"aria-hidden":"true",viewBox:"0 0 48 48",class:"nfc_ok"};function X0(a,l){return r.openBlock(),r.createElementBlock("svg",W0,[...l[0]||(l[0]=[r.createElementVNode("rect",{x:"8",y:"12",width:"32",height:"24",rx:"4",ry:"4",stroke:"#5D534B","stroke-width":"none",fill:"none"},null,-1),r.createElementVNode("path",{d:"M16 22h16m-10 6h6",stroke:"#5D534B","stroke-width":"2.4","stroke-linecap":"round"},null,-1),r.createElementVNode("path",{d:"M14 28l6 6l14-14",fill:"none",stroke:"#2ECC71","stroke-width":"3","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)])])}const $0=We(G0,[["render",X0]]),j0={key:0,class:"nfc_ok",viewBox:"0 0 48 48","aria-hidden":"true"},q0=r.defineComponent({__name:"CardReaderRetry",props:{styleRetry:{type:Boolean}},setup(a){return(l,i)=>a.styleRetry?r.createCommentVNode("",!0):(r.openBlock(),r.createElementBlock("svg",j0,[...i[0]||(i[0]=[r.createElementVNode("rect",{x:"8",y:"12",width:"32",height:"24",rx:"4",ry:"4"},null,-1),r.createElementVNode("path",{d:"M16 22h16m-10 6h6"},null,-1)])]))}}),Z0={class:"sheet_header"},Y0={class:"sheet_title",id:"sheetTitle"},K0={class:"sheet_body"},Q0={class:"sheet_card"},J0={class:"nfc_title"},e1={class:"lead"},t1={class:"wrapper_input_accept"},n1={key:1},r1={key:0,class:"card_phone_auth_wrapper"},i1={class:"sr_only","aria-live":"polite"},fa=r.defineComponent({__name:"CardReader",setup(a){const l=ot(),i=Ct(),{is_OpenLoyal:o}=_e.storeToRefs(l),{itemThemes:u}=_e.storeToRefs(i),f=Mt(),m=r.ref(),p=r.ref(null),_=r.ref(""),x={wait:{text:"Лояльность",title:""},success:{text:"Стикер распознан",title:"Стикер распознан"},not_found:{text:"Стикер не распознан",title:"Стикер не распознали"}},C=r.computed({get:()=>_.value,set:$=>{_.value=$.replace(/\s/g,"")}}),y=r.computed(()=>f.currentState),I=r.computed(()=>f.isDrawerOpen),B=r.computed(()=>{var $;return(($=x[y.value])==null?void 0:$.text)||""}),T=r.computed(()=>{var $;($=x[y.value])!=null&&$.title}),D=r.computed(()=>y.value==="success"?"Добро пожаловать!":u.value.kiosk_show_loyalty_phone_input_button?"Поднесите стикер к считывателю или войдите по номеру телефона":"Поднесите стикер к считывателю или введите номер карты вручную"),k=r.computed(()=>({ok:y.value==="success",warn:y.value==="not_found"})),P=r.computed(()=>{const $=[];return y.value==="wait"&&$.push("pulse","show-x"),y.value==="not_found"&&$.push("pulse","show-x"),y.value==="success"&&$.push("pulse","show-ok"),$}),M=r.computed(()=>y.value==="not_found"),v=r.computed(()=>y.value==="success"),j=r.computed(()=>y.value==="not_found"),H=r.computed(()=>["not_found"].includes(y.value)),Z=r.computed(()=>({wait:"Стикер не распознан. Нажмите «Повторить».",success:"Стикер распознан. Нажмите «Продолжить».",not_found:"Стикер не распознан. Нажмите «Повторить»."})[y.value]||""),V=()=>{f.closeDrawer(),o.value=!0},L=async $=>{var q,J;f.error="",p.value=null;try{const le=new yn;await le.authorizeByCard($.trim()),await le.getProfile(),l.loadCart(),f.setState("success"),f.isDrawerOpen=!1,f.showNotification("Вы успешно авторизовались в программе лояльности!")}catch(le){f.error=((J=(q=le.response)==null?void 0:q.data)==null?void 0:J.user_friendly_message)||"Ошибка",f.setState("not_found"),p.value=C.value,C.value=""}},F=r.computed(()=>{var q;const $=(q=u.value)==null?void 0:q.kiosk_hide_manual_input_loyalty_card;return $??!1}),re=()=>{f.setState("wait"),f.error="",C.value="",p.value=null},K=()=>{f.closeDrawer(),p.value=null,C.value=""},ee=()=>{var $,q;f.setState("wait"),(q=($=C.value)==null?void 0:$.trim())!=null&&q.length&&L(C.value.trim())},G=$=>{$.stopPropagation(),document.activeElement!==m.value&&W()},W=()=>{r.nextTick(()=>{m.value&&(m.value.focus(),_.value&&m.value.select())})},N=$=>{const q=document.activeElement===m.value;if(!I.value||q)return;const J=$.key.toLowerCase();if(J==="backspace")return C.value=C.value.slice(0,-1);if(J==="escape")return K();if(J==="r"&&j.value)return re();if(J==="c"&&y.value==="success")return K();if(J==="enter")return ee();C.value+=J},X={mounted($){$==null||$.focus()}};return r.onMounted(()=>{document==null||document.addEventListener("keydown",N)}),r.onBeforeUnmount(()=>{document==null||document.removeEventListener("keydown",N)}),r.watchEffect(()=>{I.value&&(f.error="")}),($,q)=>(r.openBlock(),r.createElementBlock(r.Fragment,null,[I.value?(r.openBlock(),r.createElementBlock("div",{key:0,class:"backdrop show",onClick:K,"aria-hidden":"true"})):r.createCommentVNode("",!0),I.value?(r.openBlock(),r.createElementBlock("section",{key:1,class:r.normalizeClass(["sheet show",{sheet_retry:j.value}]),"aria-modal":"true","aria-labelledby":"sheetTitle",onClick:G},[r.createElementVNode("header",Z0,[r.createElementVNode("div",Y0,r.toDisplayString(B.value),1),j.value?(r.openBlock(),r.createElementBlock("div",{key:0,class:r.normalizeClass(["sheet_status",k.value])},r.toDisplayString(p.value),3)):r.createCommentVNode("",!0),r.createElementVNode("button",{class:"sheet_close",onClick:K,"aria-label":"Закрыть"}," Закрыть ")]),r.createElementVNode("div",K0,[r.createElementVNode("div",Q0,[r.createElementVNode("div",{class:r.normalizeClass(["nfc",P.value])},[r.createVNode(q0,{styleRetry:H.value},null,8,["styleRetry"]),M.value?(r.openBlock(),r.createBlock(H0,{key:0})):r.createCommentVNode("",!0),r.createElementVNode("div",{class:"overlay check",style:r.normalizeStyle({display:v.value?"grid":"none"}),"aria-hidden":"true"},[r.createVNode($0)],4)],2),r.createElementVNode("h2",J0,r.toDisplayString(T.value),1),r.createElementVNode("p",e1,r.toDisplayString(D.value),1),r.createElementVNode("div",t1,[r.withDirectives(r.createElementVNode("input",{style:r.normalizeStyle(F.value?{position:"absolute",left:"-9999px"}:{}),ref_key:"cardInputManualRef",ref:m,"onUpdate:modelValue":q[0]||(q[0]=J=>C.value=J),class:"nfc_title_read_input",type:"text",placeholder:"Введите трек карты","aria-live":"polite",onKeydown:r.withKeys(ee,["enter"])},null,36),[[r.vModelText,C.value],[X]]),j.value?(r.openBlock(),r.createElementBlock("button",{key:0,class:"btn btn_ghost",onClick:re},"Повторить")):(r.openBlock(),r.createElementBlock("div",n1,[F.value?r.createCommentVNode("",!0):(r.openBlock(),r.createElementBlock("button",{key:0,class:"btn btn_ghost",onClick:q[1]||(q[1]=J=>j.value?K:ee())},"Отправить"))]))]),y.value==="wait"&&r.unref(u).kiosk_show_loyalty_phone_input_button?(r.openBlock(),r.createElementBlock("div",r1,[r.createElementVNode("button",{class:"card_phone_auth_button",onClick:V},"Войти по номеру телефона")])):r.createCommentVNode("",!0)])]),r.createElementVNode("div",i1,r.toDisplayString(Z.value),1)],2)):r.createCommentVNode("",!0)],64))}}),o1="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxMDAiIGhlaWdodD0iMTAwIiB2aWV3Qm94PSIwIDAgMTAwIDEwMCIgcm9sZT0iaW1nIiBhcmlhLWxhYmVsPSJJTk5PIGJhbmsgY2FyZCBpY29uIj4NCiAgPGRlZnM+DQogICAgPGxpbmVhckdyYWRpZW50IGlkPSJibGFja0dyYWQiIHgxPSIwIiB5MT0iMCIgeDI9IjEiIHkyPSIxIj4NCiAgICAgIDxzdG9wIG9mZnNldD0iMCUiIHN0b3AtY29sb3I9IiMxQTFBMUEiLz4NCiAgICAgIDxzdG9wIG9mZnNldD0iMTAwJSIgc3RvcC1jb2xvcj0iIzAwMDAwMCIvPg0KICAgIDwvbGluZWFyR3JhZGllbnQ+DQoNCiAgICA8bGluZWFyR3JhZGllbnQgaWQ9InNoaW5lIiB4MT0iMCIgeTE9IjAiIHgyPSIxIiB5Mj0iMCI+DQogICAgICA8c3RvcCBvZmZzZXQ9IjAlIiBzdG9wLWNvbG9yPSIjRkZGRkZGIiBzdG9wLW9wYWNpdHk9IjAiLz4NCiAgICAgIDxzdG9wIG9mZnNldD0iNTAlIiBzdG9wLWNvbG9yPSIjRkZGRkZGIiBzdG9wLW9wYWNpdHk9IjAuMTgiLz4NCiAgICAgIDxzdG9wIG9mZnNldD0iMTAwJSIgc3RvcC1jb2xvcj0iI0ZGRkZGRiIgc3RvcC1vcGFjaXR5PSIwIi8+DQogICAgPC9saW5lYXJHcmFkaWVudD4NCg0KICAgIDxmaWx0ZXIgaWQ9InNoYWRvdyIgeD0iLTMwJSIgeT0iLTMwJSIgd2lkdGg9IjE2MCUiIGhlaWdodD0iMTYwJSI+DQogICAgICA8ZmVEcm9wU2hhZG93IGR4PSIwIiBkeT0iNiIgc3RkRGV2aWF0aW9uPSI2IiBmbG9vZC1jb2xvcj0iIzAwMCIgZmxvb2Qtb3BhY2l0eT0iMC4yNSIvPg0KICAgIDwvZmlsdGVyPg0KICA8L2RlZnM+DQoNCiAgPCEtLSBDZW50ZXJlZCBjYXJkIC0tPg0KICA8ZyB0cmFuc2Zvcm09InRyYW5zbGF0ZSg3LjUgMjMpIHJvdGF0ZSgtMTIpIiBmaWx0ZXI9InVybCgjc2hhZG93KSI+DQogICAgPCEtLSBjYXJkIGJvZHkgLS0+DQogICAgPHJlY3QgeD0iMCIgeT0iMCIgd2lkdGg9Ijg1IiBoZWlnaHQ9IjU0IiByeD0iMTAiIGZpbGw9InVybCgjYmxhY2tHcmFkKSIvPg0KDQogICAgPCEtLSB0b3Agc3RyaXBlIC0tPg0KICAgIDxyZWN0IHg9IjAiIHk9IjgiIHdpZHRoPSI4NSIgaGVpZ2h0PSI4IiByeD0iNCIgZmlsbD0iI0ZGRkZGRiIgb3BhY2l0eT0iMC4wNSIvPg0KDQogICAgPCEtLSBjaGlwIC0tPg0KICAgIDxnIHRyYW5zZm9ybT0idHJhbnNsYXRlKDEwIDI3KSI+DQogICAgICA8cmVjdCB3aWR0aD0iMTgiIGhlaWdodD0iMTUiIHJ4PSIzIiBmaWxsPSIjQ0ZBRTcwIi8+DQogICAgICA8cmVjdCB4PSIyLjUiIHk9IjMuNSIgd2lkdGg9IjEzIiBoZWlnaHQ9IjEuMiIgZmlsbD0iIzlFODM0RSIvPg0KICAgICAgPHJlY3QgeD0iMi41IiB5PSI2LjUiIHdpZHRoPSIxMyIgaGVpZ2h0PSIxLjIiIGZpbGw9IiM5RTgzNEUiLz4NCiAgICAgIDxyZWN0IHg9IjIuNSIgeT0iOS41IiB3aWR0aD0iMTMiIGhlaWdodD0iMS4yIiBmaWxsPSIjOUU4MzRFIi8+DQogICAgICA8cmVjdCB4PSI4LjUiIHk9IjAiIHdpZHRoPSIxLjUiIGhlaWdodD0iMTUiIGZpbGw9IiM5RTgzNEUiIG9wYWNpdHk9IjAuNiIvPg0KICAgIDwvZz4NCg0KICAgIDwhLS0gSU5OTyBsb2dvIC0tPg0KICAgIDx0ZXh0IHg9IjYxIiB5PSIzOSINCiAgICAgICAgICBmb250LWZhbWlseT0ic3lzdGVtLXVpLCAtYXBwbGUtc3lzdGVtLCBTZWdvZSBVSSwgUm9ib3RvLCBBcmlhbCwgc2Fucy1zZXJpZiINCiAgICAgICAgICBmb250LXNpemU9IjEzIg0KICAgICAgICAgIGZvbnQtd2VpZ2h0PSI4MDAiDQogICAgICAgICAgbGV0dGVyLXNwYWNpbmc9IjEuMiINCiAgICAgICAgICBmaWxsPSIjRkZGRkZGIg0KICAgICAgICAgIG9wYWNpdHk9IjAuOTUiDQogICAgICAgICAgdGV4dC1hbmNob3I9Im1pZGRsZSI+DQogICAgICBpbm5vDQogICAgPC90ZXh0Pg0KDQogICAgPCEtLSBzaGluZSAtLT4NCiAgICA8cGF0aCBkPSJNLTggNiBMMjUgLTMgTDk0IDQ3IEw2MCA2MiBMLTggMjUgWiIgZmlsbD0idXJsKCNzaGluZSkiLz4NCiAgPC9nPg0KPC9zdmc+",ha="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20512%20512'%20width='100'%20height='100'%20fill='none'%3e%3c!--%20Big%20QR%20corners%20(outer%20shape%20with%20inner%20cutout)%20--%3e%3cpath%20fill='currentColor'%20fill-rule='evenodd'%20d='%20M72%200H163C202.765%200%20235%2032.235%20235%2072V163C235%20202.765%20202.765%20235%20163%20235H72C32.235%20235%200%20202.765%200%20163V72C0%2032.235%2032.235%200%2072%200Z%20M102%2086H133C141.837%2086%20149%2093.163%20149%20102V133C149%20141.837%20141.837%20149%20133%20149H102C93.163%20149%2086%20141.837%2086%20133V102C86%2093.163%2093.163%2086%20102%2086Z%20'/%3e%3cpath%20fill='currentColor'%20fill-rule='evenodd'%20d='%20M349%200H440C479.765%200%20512%2032.235%20512%2072V163C512%20202.765%20479.765%20235%20440%20235H349C309.235%20235%20277%20202.765%20277%20163V72C277%2032.235%20309.235%200%20349%200Z%20M379%2086H410C418.837%2086%20426%2093.163%20426%20102V133C426%20141.837%20418.837%20149%20410%20149H379C370.163%20149%20363%20141.837%20363%20133V102C363%2093.163%20370.163%2086%20379%2086Z%20'/%3e%3cpath%20fill='currentColor'%20fill-rule='evenodd'%20d='%20M72%20277H163C202.765%20277%20235%20309.235%20235%20349V440C235%20479.765%20202.765%20512%20163%20512H72C32.235%20512%200%20479.765%200%20440V349C0%20309.235%2032.235%20277%2072%20277Z%20M102%20363H133C141.837%20363%20149%20370.163%20149%20379V410C149%20418.837%20141.837%20426%20133%20426H102C93.163%20426%2086%20418.837%2086%20410V379C86%20370.163%2093.163%20363%20102%20363Z%20'/%3e%3c!--%20Small%20modules%20--%3e%3crect%20x='277'%20y='277'%20width='86'%20height='86'%20rx='26'%20fill='currentColor'/%3e%3crect%20x='426'%20y='277'%20width='86'%20height='86'%20rx='28'%20fill='currentColor'/%3e%3crect%20x='277'%20y='426'%20width='86'%20height='86'%20rx='26'%20fill='currentColor'/%3e%3c!--%20Center%20dot%20--%3e%3ccircle%20cx='394.17'%20cy='394.17'%20r='33'%20fill='currentColor'/%3e%3c/svg%3e",s1=["src"],a1={class:"header_description"},l1=We(r.defineComponent({__name:"PaymentBoxes",props:{configPage:{},comment:{},cartItems:{},isAuthorized:{type:Boolean},orderId:{default:null},signal:{},provider:{}},emits:["select"],setup(a,{emit:l}){const i=a,o=l,u=Mt(),f=Lt(),{selectedProvider:m,isButtonDisabled:p}=_e.storeToRefs(u),{isAddToCard:_}=_e.storeToRefs(f),x={default:o1,SBP:ha},C=async()=>{m.value=i.provider;const I=i.provider.front_type;I&&(_.value=!1,p.value=!0,o("select",I),lo(i.orderId,i.provider.type))},y=r.computed(()=>x[i.provider.front_type]||x.default);return(I,B)=>(r.openBlock(),r.createElementBlock("div",{class:"payment_boxes_wrapper",onClick:C},[r.createElementVNode("img",{class:"picture",src:y.value},null,8,s1),r.createElementVNode("div",a1,[r.createElementVNode("b",null,r.toDisplayString(a.provider.name),1),r.createElementVNode("p",null,r.toDisplayString(a.provider.description),1)]),r.createVNode(Cr)]))}}),[["__scopeId","data-v-c4a0ed62"]]),c1={key:0,class:"wrapper_cart_payment"},d1={class:"wrapper_paid"},u1={class:"to_be_paid"},f1=We(r.defineComponent({__name:"CartPayment",props:{configPage:{},comment:{},cartItems:{},isAuthorized:{type:Boolean},orderId:{},signal:{}},emits:["selectPayment"],setup(a,{emit:l}){const i=Mt(),o=ot(),u=a,{totalPrice_lib:f,countBonus:m}=_e.storeToRefs(o),p=l,_=C=>{p("selectPayment",C)},x=()=>{p("selectPayment","")};return(C,y)=>r.unref(i).providerTypes.length>1?(r.openBlock(),r.createElementBlock("div",c1,[y[2]||(y[2]=r.createElementVNode("h2",null,"Выберите способ оплаты",-1)),y[3]||(y[3]=r.createElementVNode("p",{class:"description_payment"},"Можно изменить позже до оплаты",-1)),(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(r.unref(i).providerTypes,(I,B)=>(r.openBlock(),r.createElementBlock("div",{key:B},[r.createVNode(l1,{provider:I,"config-page":u.configPage,comment:u.comment,"cart-items":u.cartItems,"is-authorized":u.isAuthorized,"order-id":u.orderId,signal:u.signal,onSelect:_},null,8,["provider","config-page","comment","cart-items","is-authorized","order-id","signal"])]))),128)),r.createElementVNode("div",d1,[r.createElementVNode("p",u1,[y[0]||(y[0]=r.createTextVNode("К оплате ",-1)),r.createVNode(ft,{price:r.unref(f)-r.unref(m),fixedFloat:2},null,8,["price"]),y[1]||(y[1]=r.createTextVNode(" ₽",-1))]),r.createVNode(sn,{textButtonDefault:"Назад",onClick:x,class:"btn_payment"})])])):r.createCommentVNode("",!0)}}),[["__scopeId","data-v-f7657882"]]),h1={class:"start_page"},m1=["src"],g1={class:"wrap"},p1={class:"wrap_box"},x1={class:"title_fiscal_order"},_1={class:"wrapper_accept"},w1={ref:"barRef",class:"bar_complete","aria-hidden":"true"},C1=We(r.defineComponent({__name:"CartCompleteKioskSuccess",props:{mediaUrl:{},orderNumber:{}},setup(a){const l=ot(),i=Mt(),o=Lt(),u=Ct(),{cartProducts_lib:f}=_e.storeToRefs(l),{orderNumber:m,orderCompleted_lib:p,selectedOrderType:_}=_e.storeToRefs(i),{is_startPage:x}=_e.storeToRefs(o),{mediaUrl:C}=bn(()=>u.itemThemes.kiosk_preloader?"preloader":null),y=ke.useRouter(),I=ke.useRoute();let B=null;r.onMounted(()=>{B=setTimeout(()=>{x.value=!u.itemThemes.kiosk_disable_lock_screen,_.value=null,l.isOrderTypeSubmited=!1,y.replace(`/${I.params.orgId}`)},1e4)});const T=()=>{gr(["cart","authTokensAccess","authTokensRefresh"]),f.value=[],p.value=null,_.value=null,l.isOrderTypeSubmited=!1,i.clearCard(),l.profile=null,y.replace(`/${I.params.orgId}`)};return r.onUnmounted(()=>{B&&clearInterval(B)}),(D,k)=>(r.openBlock(),r.createElementBlock("div",h1,[r.withDirectives((r.openBlock(),r.createElementBlock("video",{loop:"",autoplay:"",muted:"",playsinline:"",key:r.unref(C)},[r.createElementVNode("source",{src:r.unref(C)||"",type:"video/webm"},null,8,m1)])),[[r.unref(Er)]]),k[4]||(k[4]=r.createElementVNode("div",{class:"start_img_black"},null,-1)),r.createElementVNode("div",g1,[r.createElementVNode("div",p1,[k[1]||(k[1]=r.createElementVNode("div",{class:"icon","aria-hidden":"true"},[r.createElementVNode("svg",{viewBox:"0 0 24 24"},[r.createElementVNode("path",{d:"M20 6L9 17l-5-5"})])],-1)),k[2]||(k[2]=r.createElementVNode("h1",null," Заказ успешно оплачен ",-1)),r.createElementVNode("p",x1,"№ "+r.toDisplayString(r.unref(m)),1),k[3]||(k[3]=r.createElementVNode("p",{class:"title_fiscal_completed"},"Спасибо! Заказ передан в работу.",-1)),r.createElementVNode("div",_1,[r.createElementVNode("button",{class:"btn","aria-label":"Новый заказ",onClick:T},[k[0]||(k[0]=r.createElementVNode("span",{class:"label"},"Новый заказ",-1)),r.createElementVNode("span",w1,null,512)])])])])]))}}),[["__scopeId","data-v-79c00acf"]]),E1={class:"fiscal_wrapper"},y1=["src"],b1={class:"fiscal_container"},A1={class:"fiscal_stage","aria-hidden":"true"},S1={class:"fiscal_printer"},I1={class:"fiscal_receipt"},N1=["src"],T1=We(r.defineComponent({__name:"CartCompleteFiscal",setup(a){const l=Ct(),{mediaUrl:i}=bn(()=>l.itemThemes.kiosk_preloader?"preloader":null);return(o,u)=>(r.openBlock(),r.createElementBlock(r.Fragment,null,[r.createElementVNode("div",E1,[r.withDirectives((r.openBlock(),r.createElementBlock("video",{loop:"",autoplay:"",muted:"",playsinline:"",key:r.unref(i)},[r.createElementVNode("source",{src:r.unref(i)||"",type:"video/webm"},null,8,y1)])),[[r.unref(Er)]])]),r.createElementVNode("div",b1,[r.createElementVNode("div",A1,[r.createElementVNode("div",S1,[u[2]||(u[2]=r.createElementVNode("div",{class:"fiscal_led"},null,-1)),u[3]||(u[3]=r.createElementVNode("div",{class:"fiscal_slot"},null,-1)),r.createElementVNode("div",I1,[u[0]||(u[0]=r.createElementVNode("div",{class:"fiscal_tear"},null,-1)),r.createElementVNode("img",{class:"fiscal_logo_img",src:r.unref(l).itemThemes.logo||"",alt:"Логотип"},null,8,N1),u[1]||(u[1]=r.createStaticVNode('<div class="fiscal_line accent" data-v-3f29ae57></div><div class="fiscal_line" data-v-3f29ae57></div><div class="fiscal_line sm" data-v-3f29ae57></div><div class="fiscal_line" data-v-3f29ae57></div><div class="fiscal_line sm" data-v-3f29ae57></div><div class="fiscal_line" data-v-3f29ae57></div><div class="fiscal_line sm" data-v-3f29ae57></div>',7))])])]),u[4]||(u[4]=r.createElementVNode("h1",{class:"fiscal_title_fiscal"},"После оплаты дождитесь печати второго чека для получения заказа",-1))])],64))}}),[["__scopeId","data-v-3f29ae57"]]),k1={},R1={class:"center"};function B1(a,l){return r.openBlock(),r.createElementBlock("div",R1,[...l[0]||(l[0]=[r.createStaticVNode('<div class="stack" data-v-f0859fd1><h1 class="title_fiscal" data-v-f0859fd1>Приложите карту для оплаты</h1><p class="reminder" data-v-f0859fd1>Держите карту у терминала, пока операция не завершится.</p><div class="stageCard" aria-hidden="true" data-v-f0859fd1><div class="waves" data-v-f0859fd1><span data-v-f0859fd1></span><span data-v-f0859fd1></span><span data-v-f0859fd1></span></div><div class="nfc" data-v-f0859fd1><svg viewBox="0 0 24 24" data-v-f0859fd1><path d="M6 8c2.5 2.5 2.5 5.5 0 8" data-v-f0859fd1></path><path d="M10 6c4 4 4 8 0 12" data-v-f0859fd1></path><path d="M14 4c5.5 5.5 5.5 11 0 16" data-v-f0859fd1></path></svg></div><div class="card" data-v-f0859fd1><div class="logo" data-v-f0859fd1>inno.</div><div class="chip" data-v-f0859fd1></div><div class="digits" data-v-f0859fd1>4815 1623 4200 0900</div><div class="holder" data-v-f0859fd1>Гость</div></div></div></div>',1)])])}const O1=We(k1,[["render",B1],["__scopeId","data-v-f0859fd1"]]);/*!
7
7
  * qrcode.vue v3.6.0
8
8
  * A Vue.js component to generate QRCode. Both support Vue 2 and Vue 3
9
9
  * © 2017-PRESENT @scopewu(https://github.com/scopewu)
10
10
  * MIT License.
11
- */var kn=function(){return kn=Object.assign||function(l){for(var i,s=1,u=arguments.length;s<u;s++){i=arguments[s];for(var f in i)Object.prototype.hasOwnProperty.call(i,f)&&(l[f]=i[f])}return l},kn.apply(this,arguments)};typeof SuppressedError=="function"&&SuppressedError;var rr;(function(a){var l=function(){function m(p,_,x,C){if(this.version=p,this.errorCorrectionLevel=_,this.modules=[],this.isFunction=[],p<m.MIN_VERSION||p>m.MAX_VERSION)throw new RangeError("Version value out of range");if(C<-1||C>7)throw new RangeError("Mask value out of range");this.size=p*4+17;for(var y=[],I=0;I<this.size;I++)y.push(!1);for(var I=0;I<this.size;I++)this.modules.push(y.slice()),this.isFunction.push(y.slice());this.drawFunctionPatterns();var O=this.addEccAndInterleave(x);if(this.drawCodewords(O),C==-1)for(var T=1e9,I=0;I<8;I++){this.applyMask(I),this.drawFormatBits(I);var D=this.getPenaltyScore();D<T&&(C=I,T=D),this.applyMask(I)}u(0<=C&&C<=7),this.mask=C,this.applyMask(C),this.drawFormatBits(C),this.isFunction=[]}return m.encodeText=function(p,_){var x=a.QrSegment.makeSegments(p);return m.encodeSegments(x,_)},m.encodeBinary=function(p,_){var x=a.QrSegment.makeBytes(p);return m.encodeSegments([x],_)},m.encodeSegments=function(p,_,x,C,y,I){if(x===void 0&&(x=1),C===void 0&&(C=40),y===void 0&&(y=-1),I===void 0&&(I=!0),!(m.MIN_VERSION<=x&&x<=C&&C<=m.MAX_VERSION)||y<-1||y>7)throw new RangeError("Invalid value");var O,T;for(O=x;;O++){var D=m.getNumDataCodewords(O,_)*8,k=f.getTotalBits(p,O);if(k<=D){T=k;break}if(O>=C)throw new RangeError("Data too long")}for(var P=0,M=[m.Ecc.MEDIUM,m.Ecc.QUARTILE,m.Ecc.HIGH];P<M.length;P++){var v=M[P];I&&T<=m.getNumDataCodewords(O,v)*8&&(_=v)}for(var W=[],X=0,Z=p;X<Z.length;X++){var F=Z[X];i(F.mode.modeBits,4,W),i(F.numChars,F.mode.numCharCountBits(O),W);for(var L=0,V=F.getData();L<V.length;L++){var ie=V[L];W.push(ie)}}u(W.length==T);var K=m.getNumDataCodewords(O,_)*8;u(W.length<=K),i(0,Math.min(4,K-W.length),W),i(0,(8-W.length%8)%8,W),u(W.length%8==0);for(var ee=236;W.length<K;ee^=253)i(ee,8,W);for(var G=[];G.length*8<W.length;)G.push(0);return W.forEach(function(z,N){return G[N>>>3]|=z<<7-(N&7)}),new m(O,_,G,y)},m.prototype.getModule=function(p,_){return 0<=p&&p<this.size&&0<=_&&_<this.size&&this.modules[_][p]},m.prototype.getModules=function(){return this.modules},m.prototype.drawFunctionPatterns=function(){for(var p=0;p<this.size;p++)this.setFunctionModule(6,p,p%2==0),this.setFunctionModule(p,6,p%2==0);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);for(var _=this.getAlignmentPatternPositions(),x=_.length,p=0;p<x;p++)for(var C=0;C<x;C++)p==0&&C==0||p==0&&C==x-1||p==x-1&&C==0||this.drawAlignmentPattern(_[p],_[C]);this.drawFormatBits(0),this.drawVersion()},m.prototype.drawFormatBits=function(p){for(var _=this.errorCorrectionLevel.formatBits<<3|p,x=_,C=0;C<10;C++)x=x<<1^(x>>>9)*1335;var y=(_<<10|x)^21522;u(y>>>15==0);for(var C=0;C<=5;C++)this.setFunctionModule(8,C,s(y,C));this.setFunctionModule(8,7,s(y,6)),this.setFunctionModule(8,8,s(y,7)),this.setFunctionModule(7,8,s(y,8));for(var C=9;C<15;C++)this.setFunctionModule(14-C,8,s(y,C));for(var C=0;C<8;C++)this.setFunctionModule(this.size-1-C,8,s(y,C));for(var C=8;C<15;C++)this.setFunctionModule(8,this.size-15+C,s(y,C));this.setFunctionModule(8,this.size-8,!0)},m.prototype.drawVersion=function(){if(!(this.version<7)){for(var p=this.version,_=0;_<12;_++)p=p<<1^(p>>>11)*7973;var x=this.version<<12|p;u(x>>>18==0);for(var _=0;_<18;_++){var C=s(x,_),y=this.size-11+_%3,I=Math.floor(_/3);this.setFunctionModule(y,I,C),this.setFunctionModule(I,y,C)}}},m.prototype.drawFinderPattern=function(p,_){for(var x=-4;x<=4;x++)for(var C=-4;C<=4;C++){var y=Math.max(Math.abs(C),Math.abs(x)),I=p+C,O=_+x;0<=I&&I<this.size&&0<=O&&O<this.size&&this.setFunctionModule(I,O,y!=2&&y!=4)}},m.prototype.drawAlignmentPattern=function(p,_){for(var x=-2;x<=2;x++)for(var C=-2;C<=2;C++)this.setFunctionModule(p+C,_+x,Math.max(Math.abs(C),Math.abs(x))!=1)},m.prototype.setFunctionModule=function(p,_,x){this.modules[_][p]=x,this.isFunction[_][p]=!0},m.prototype.addEccAndInterleave=function(p){var _=this.version,x=this.errorCorrectionLevel;if(p.length!=m.getNumDataCodewords(_,x))throw new RangeError("Invalid argument");for(var C=m.NUM_ERROR_CORRECTION_BLOCKS[x.ordinal][_],y=m.ECC_CODEWORDS_PER_BLOCK[x.ordinal][_],I=Math.floor(m.getNumRawDataModules(_)/8),O=C-I%C,T=Math.floor(I/C),D=[],k=m.reedSolomonComputeDivisor(y),P=0,M=0;P<C;P++){var v=p.slice(M,M+T-y+(P<O?0:1));M+=v.length;var W=m.reedSolomonComputeRemainder(v,k);P<O&&v.push(0),D.push(v.concat(W))}for(var X=[],Z=function(F){D.forEach(function(L,V){(F!=T-y||V>=O)&&X.push(L[F])})},P=0;P<D[0].length;P++)Z(P);return u(X.length==I),X},m.prototype.drawCodewords=function(p){if(p.length!=Math.floor(m.getNumRawDataModules(this.version)/8))throw new RangeError("Invalid argument");for(var _=0,x=this.size-1;x>=1;x-=2){x==6&&(x=5);for(var C=0;C<this.size;C++)for(var y=0;y<2;y++){var I=x-y,O=(x+1&2)==0,T=O?this.size-1-C:C;!this.isFunction[T][I]&&_<p.length*8&&(this.modules[T][I]=s(p[_>>>3],7-(_&7)),_++)}}u(_==p.length*8)},m.prototype.applyMask=function(p){if(p<0||p>7)throw new RangeError("Mask value out of range");for(var _=0;_<this.size;_++)for(var x=0;x<this.size;x++){var C=void 0;switch(p){case 0:C=(x+_)%2==0;break;case 1:C=_%2==0;break;case 2:C=x%3==0;break;case 3:C=(x+_)%3==0;break;case 4:C=(Math.floor(x/3)+Math.floor(_/2))%2==0;break;case 5:C=x*_%2+x*_%3==0;break;case 6:C=(x*_%2+x*_%3)%2==0;break;case 7:C=((x+_)%2+x*_%3)%2==0;break;default:throw new Error("Unreachable")}!this.isFunction[_][x]&&C&&(this.modules[_][x]=!this.modules[_][x])}},m.prototype.getPenaltyScore=function(){for(var p=0,_=0;_<this.size;_++){for(var x=!1,C=0,y=[0,0,0,0,0,0,0],I=0;I<this.size;I++)this.modules[_][I]==x?(C++,C==5?p+=m.PENALTY_N1:C>5&&p++):(this.finderPenaltyAddHistory(C,y),x||(p+=this.finderPenaltyCountPatterns(y)*m.PENALTY_N3),x=this.modules[_][I],C=1);p+=this.finderPenaltyTerminateAndCount(x,C,y)*m.PENALTY_N3}for(var I=0;I<this.size;I++){for(var x=!1,O=0,y=[0,0,0,0,0,0,0],_=0;_<this.size;_++)this.modules[_][I]==x?(O++,O==5?p+=m.PENALTY_N1:O>5&&p++):(this.finderPenaltyAddHistory(O,y),x||(p+=this.finderPenaltyCountPatterns(y)*m.PENALTY_N3),x=this.modules[_][I],O=1);p+=this.finderPenaltyTerminateAndCount(x,O,y)*m.PENALTY_N3}for(var _=0;_<this.size-1;_++)for(var I=0;I<this.size-1;I++){var T=this.modules[_][I];T==this.modules[_][I+1]&&T==this.modules[_+1][I]&&T==this.modules[_+1][I+1]&&(p+=m.PENALTY_N2)}for(var D=0,k=0,P=this.modules;k<P.length;k++){var M=P[k];D=M.reduce(function(X,Z){return X+(Z?1:0)},D)}var v=this.size*this.size,W=Math.ceil(Math.abs(D*20-v*10)/v)-1;return u(0<=W&&W<=9),p+=W*m.PENALTY_N4,u(0<=p&&p<=2568888),p},m.prototype.getAlignmentPatternPositions=function(){if(this.version==1)return[];for(var p=Math.floor(this.version/7)+2,_=Math.floor((this.version*8+p*3+5)/(p*4-4))*2,x=[6],C=this.size-7;x.length<p;C-=_)x.splice(1,0,C);return x},m.getNumRawDataModules=function(p){if(p<m.MIN_VERSION||p>m.MAX_VERSION)throw new RangeError("Version number out of range");var _=(16*p+128)*p+64;if(p>=2){var x=Math.floor(p/7)+2;_-=(25*x-10)*x-55,p>=7&&(_-=36)}return u(208<=_&&_<=29648),_},m.getNumDataCodewords=function(p,_){return Math.floor(m.getNumRawDataModules(p)/8)-m.ECC_CODEWORDS_PER_BLOCK[_.ordinal][p]*m.NUM_ERROR_CORRECTION_BLOCKS[_.ordinal][p]},m.reedSolomonComputeDivisor=function(p){if(p<1||p>255)throw new RangeError("Degree out of range");for(var _=[],x=0;x<p-1;x++)_.push(0);_.push(1);for(var C=1,x=0;x<p;x++){for(var y=0;y<_.length;y++)_[y]=m.reedSolomonMultiply(_[y],C),y+1<_.length&&(_[y]^=_[y+1]);C=m.reedSolomonMultiply(C,2)}return _},m.reedSolomonComputeRemainder=function(p,_){for(var x=_.map(function(T){return 0}),C=function(T){var D=T^x.shift();x.push(0),_.forEach(function(k,P){return x[P]^=m.reedSolomonMultiply(k,D)})},y=0,I=p;y<I.length;y++){var O=I[y];C(O)}return x},m.reedSolomonMultiply=function(p,_){if(p>>>8||_>>>8)throw new RangeError("Byte out of range");for(var x=0,C=7;C>=0;C--)x=x<<1^(x>>>7)*285,x^=(_>>>C&1)*p;return u(x>>>8==0),x},m.prototype.finderPenaltyCountPatterns=function(p){var _=p[1];u(_<=this.size*3);var x=_>0&&p[2]==_&&p[3]==_*3&&p[4]==_&&p[5]==_;return(x&&p[0]>=_*4&&p[6]>=_?1:0)+(x&&p[6]>=_*4&&p[0]>=_?1:0)},m.prototype.finderPenaltyTerminateAndCount=function(p,_,x){return p&&(this.finderPenaltyAddHistory(_,x),_=0),_+=this.size,this.finderPenaltyAddHistory(_,x),this.finderPenaltyCountPatterns(x)},m.prototype.finderPenaltyAddHistory=function(p,_){_[0]==0&&(p+=this.size),_.pop(),_.unshift(p)},m.MIN_VERSION=1,m.MAX_VERSION=40,m.PENALTY_N1=3,m.PENALTY_N2=3,m.PENALTY_N3=40,m.PENALTY_N4=10,m.ECC_CODEWORDS_PER_BLOCK=[[-1,7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],[-1,13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]],m.NUM_ERROR_CORRECTION_BLOCKS=[[-1,1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],[-1,1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],[-1,1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],[-1,1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]],m}();a.QrCode=l;function i(m,p,_){if(p<0||p>31||m>>>p)throw new RangeError("Value out of range");for(var x=p-1;x>=0;x--)_.push(m>>>x&1)}function s(m,p){return(m>>>p&1)!=0}function u(m){if(!m)throw new Error("Assertion error")}var f=function(){function m(p,_,x){if(this.mode=p,this.numChars=_,this.bitData=x,_<0)throw new RangeError("Invalid argument");this.bitData=x.slice()}return m.makeBytes=function(p){for(var _=[],x=0,C=p;x<C.length;x++){var y=C[x];i(y,8,_)}return new m(m.Mode.BYTE,p.length,_)},m.makeNumeric=function(p){if(!m.isNumeric(p))throw new RangeError("String contains non-numeric characters");for(var _=[],x=0;x<p.length;){var C=Math.min(p.length-x,3);i(parseInt(p.substring(x,x+C),10),C*3+1,_),x+=C}return new m(m.Mode.NUMERIC,p.length,_)},m.makeAlphanumeric=function(p){if(!m.isAlphanumeric(p))throw new RangeError("String contains unencodable characters in alphanumeric mode");var _=[],x;for(x=0;x+2<=p.length;x+=2){var C=m.ALPHANUMERIC_CHARSET.indexOf(p.charAt(x))*45;C+=m.ALPHANUMERIC_CHARSET.indexOf(p.charAt(x+1)),i(C,11,_)}return x<p.length&&i(m.ALPHANUMERIC_CHARSET.indexOf(p.charAt(x)),6,_),new m(m.Mode.ALPHANUMERIC,p.length,_)},m.makeSegments=function(p){return p==""?[]:m.isNumeric(p)?[m.makeNumeric(p)]:m.isAlphanumeric(p)?[m.makeAlphanumeric(p)]:[m.makeBytes(m.toUtf8ByteArray(p))]},m.makeEci=function(p){var _=[];if(p<0)throw new RangeError("ECI assignment value out of range");if(p<128)i(p,8,_);else if(p<16384)i(2,2,_),i(p,14,_);else if(p<1e6)i(6,3,_),i(p,21,_);else throw new RangeError("ECI assignment value out of range");return new m(m.Mode.ECI,0,_)},m.isNumeric=function(p){return m.NUMERIC_REGEX.test(p)},m.isAlphanumeric=function(p){return m.ALPHANUMERIC_REGEX.test(p)},m.prototype.getData=function(){return this.bitData.slice()},m.getTotalBits=function(p,_){for(var x=0,C=0,y=p;C<y.length;C++){var I=y[C],O=I.mode.numCharCountBits(_);if(I.numChars>=1<<O)return 1/0;x+=4+O+I.bitData.length}return x},m.toUtf8ByteArray=function(p){p=encodeURI(p);for(var _=[],x=0;x<p.length;x++)p.charAt(x)!="%"?_.push(p.charCodeAt(x)):(_.push(parseInt(p.substring(x+1,x+3),16)),x+=2);return _},m.NUMERIC_REGEX=/^[0-9]*$/,m.ALPHANUMERIC_REGEX=/^[A-Z0-9 $%*+.\/:-]*$/,m.ALPHANUMERIC_CHARSET="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:",m}();a.QrSegment=f})(rr||(rr={})),function(a){(function(l){var i=function(){function s(u,f){this.ordinal=u,this.formatBits=f}return s.LOW=new s(0,1),s.MEDIUM=new s(1,0),s.QUARTILE=new s(2,3),s.HIGH=new s(3,2),s}();l.Ecc=i})(a.QrCode||(a.QrCode={}))}(rr||(rr={})),function(a){(function(l){var i=function(){function s(u,f){this.modeBits=u,this.numBitsCharCount=f}return s.prototype.numCharCountBits=function(u){return this.numBitsCharCount[Math.floor((u+7)/17)]},s.NUMERIC=new s(1,[10,12,14]),s.ALPHANUMERIC=new s(2,[9,11,13]),s.BYTE=new s(4,[8,16,16]),s.KANJI=new s(8,[8,10,12]),s.ECI=new s(7,[0,0,0]),s}();l.Mode=i})(a.QrSegment||(a.QrSegment={}))}(rr||(rr={}));var Cr=rr,_o="L",wo={L:Cr.QrCode.Ecc.LOW,M:Cr.QrCode.Ecc.MEDIUM,Q:Cr.QrCode.Ecc.QUARTILE,H:Cr.QrCode.Ecc.HIGH},T1=function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0}();function Co(a){return a in wo}function ma(a,l){l===void 0&&(l=0);var i=[];return a.forEach(function(s,u){var f=null;s.forEach(function(m,p){if(!m&&f!==null){i.push("M".concat(f+l," ").concat(u+l,"h").concat(p-f,"v1H").concat(f+l,"z")),f=null;return}if(p===s.length-1){if(!m)return;f===null?i.push("M".concat(p+l,",").concat(u+l," h1v1H").concat(p+l,"z")):i.push("M".concat(f+l,",").concat(u+l," h").concat(p+1-f,"v1H").concat(f+l,"z"));return}m&&f===null&&(f=p)})}),i.join("")}function ga(a,l,i,s){var u=s.width,f=s.height,m=s.x,p=s.y,_=a.length+i*2,x=Math.floor(l*.1),C=_/l,y=(u||x)*C,I=(f||x)*C,O=m==null?a.length/2-y/2:m*C,T=p==null?a.length/2-I/2:p*C,D=null;if(s.excavate){var k=Math.floor(O),P=Math.floor(T),M=Math.ceil(y+O-k),v=Math.ceil(I+T-P);D={x:k,y:P,w:M,h:v}}return{x:O,y:T,h:I,w:y,excavation:D}}function pa(a,l){return a.slice().map(function(i,s){return s<l.y||s>=l.y+l.h?i:i.map(function(u,f){return f<l.x||f>=l.x+l.w?u:!1})})}var Eo={value:{type:String,required:!0,default:""},size:{type:Number,default:100},level:{type:String,default:_o,validator:function(a){return Co(a)}},background:{type:String,default:"#fff"},foreground:{type:String,default:"#000"},margin:{type:Number,required:!1,default:0},imageSettings:{type:Object,required:!1,default:function(){return{}}},gradient:{type:Boolean,required:!1,default:!1},gradientType:{type:String,required:!1,default:"linear",validator:function(a){return["linear","radial"].indexOf(a)>-1}},gradientStartColor:{type:String,required:!1,default:"#000"},gradientEndColor:{type:String,required:!1,default:"#fff"}},k1=kn(kn({},Eo),{renderAs:{type:String,required:!1,default:"canvas",validator:function(a){return["canvas","svg"].indexOf(a)>-1}}}),R1=r.defineComponent({name:"QRCodeSvg",props:Eo,setup:function(a){var l=r.ref(0),i=r.ref(""),s,u=function(){var m=a.value,p=a.level,_=a.margin,x=_>>>0,C=Co(p)?p:_o,y=Cr.QrCode.encodeText(m,wo[C]).getModules();if(l.value=y.length+x*2,a.imageSettings.src){var I=ga(y,a.size,x,a.imageSettings);s={x:I.x+x,y:I.y+x,width:I.w,height:I.h},I.excavation&&(y=pa(y,I.excavation))}i.value=ma(y,x)},f=function(){if(!a.gradient)return null;var m=a.gradientType==="linear"?{x1:"0%",y1:"0%",x2:"100%",y2:"100%"}:{cx:"50%",cy:"50%",r:"50%",fx:"50%",fy:"50%"};return r.h(a.gradientType==="linear"?"linearGradient":"radialGradient",kn({id:"qr-gradient"},m),[r.h("stop",{offset:"0%",style:{stopColor:a.gradientStartColor}}),r.h("stop",{offset:"100%",style:{stopColor:a.gradientEndColor}})])};return u(),r.onUpdated(u),function(){return r.h("svg",{width:a.size,height:a.size,"shape-rendering":"crispEdges",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 ".concat(l.value," ").concat(l.value)},[r.h("defs",{},[f()]),r.h("rect",{width:"100%",height:"100%",fill:a.background}),r.h("path",{fill:a.gradient?"url(#qr-gradient)":a.foreground,d:i.value}),a.imageSettings.src&&r.h("image",kn({href:a.imageSettings.src},s))])}}}),B1=r.defineComponent({name:"QRCodeCanvas",props:Eo,setup:function(a,l){var i=r.ref(null),s=r.ref(null),u=function(){var m=a.value,p=a.level,_=a.size,x=a.margin,C=a.background,y=a.foreground,I=a.gradient,O=a.gradientType,T=a.gradientStartColor,D=a.gradientEndColor,k=x>>>0,P=Co(p)?p:_o,M=i.value;if(M){var v=M.getContext("2d");if(v){var W=Cr.QrCode.encodeText(m,wo[P]).getModules(),X=W.length+k*2,Z=s.value,F={x:0,y:0,width:0,height:0},L=a.imageSettings.src&&Z!=null&&Z.naturalWidth!==0&&Z.naturalHeight!==0;if(L){var V=ga(W,a.size,k,a.imageSettings);F={x:V.x+k,y:V.y+k,width:V.w,height:V.h},V.excavation&&(W=pa(W,V.excavation))}var ie=window.devicePixelRatio||1,K=_/X*ie;if(M.height=M.width=_*ie,v.scale(K,K),v.fillStyle=C,v.fillRect(0,0,X,X),I){var ee=void 0;O==="linear"?ee=v.createLinearGradient(0,0,X,X):ee=v.createRadialGradient(X/2,X/2,0,X/2,X/2,X/2),ee.addColorStop(0,T),ee.addColorStop(1,D),v.fillStyle=ee}else v.fillStyle=y;T1?v.fill(new Path2D(ma(W,k))):W.forEach(function(G,z){G.forEach(function(N,$){N&&v.fillRect($+k,z+k,1,1)})}),L&&v.drawImage(Z,F.x,F.y,F.width,F.height)}}};r.onMounted(u),r.onUpdated(u);var f=l.attrs.style;return function(){return r.h(r.Fragment,[r.h("canvas",kn(kn({},l.attrs),{ref:i,style:kn(kn({},f),{width:"".concat(a.size,"px"),height:"".concat(a.size,"px")})})),a.imageSettings.src&&r.h("img",{ref:s,src:a.imageSettings.src,style:{display:"none"},onLoad:u})])}}}),xa=r.defineComponent({name:"Qrcode",render:function(){var a=this.$props,l=a.renderAs,i=a.value,s=a.size,u=a.margin,f=a.level,m=a.background,p=a.foreground,_=a.imageSettings,x=a.gradient,C=a.gradientType,y=a.gradientStartColor,I=a.gradientEndColor;return r.h(l==="svg"?R1:B1,{value:i,size:s,margin:u,level:f,background:m,foreground:p,imageSettings:_,gradient:x,gradientType:C,gradientStartColor:y,gradientEndColor:I})},props:k1});const O1={},M1={viewBox:"0 0 24 24","aria-hidden":"true"};function D1(a,l){return r.openBlock(),r.createElementBlock("svg",M1,[...l[0]||(l[0]=[r.createElementVNode("path",{d:"M7 4h10a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2z"},null,-1),r.createElementVNode("path",{d:"M9 7h6"},null,-1),r.createElementVNode("path",{d:"M10 18h4"},null,-1)])])}const v1=Xe(O1,[["render",D1]]),P1={},L1={viewBox:"0 0 24 24","aria-hidden":"true"};function F1(a,l){return r.openBlock(),r.createElementBlock("svg",L1,[...l[0]||(l[0]=[r.createStaticVNode('<path d="M4 8V6a2 2 0 0 1 2-2h2"></path><path d="M20 8V6a2 2 0 0 0-2-2h-2"></path><path d="M4 16v2a2 2 0 0 0 2 2h2"></path><path d="M20 16v2a2 2 0 0 1-2 2h-2"></path><path d="M7 12h10"></path>',5)])])}const V1=Xe(P1,[["render",F1]]),U1="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20viewBox='0%200%2019.6108%2014.0107'%20width='19.610840'%20height='14.010742'%20fill='none'%20customFrame='%23000000'%3e%3cpath%20id='Форма%20'%20d='M18.3054%201.30566L6.61792%2012.639L1.30542%207.48747'%20stroke='rgb(255,255,255)'%20stroke-linecap='round'%20stroke-linejoin='round'%20stroke-width='2.5999999'/%3e%3c/svg%3e",z1={class:"wrapper_qr_page"},H1=["src"],G1={class:"modal_qr"},W1={class:"modal_qr_content"},X1={class:"wrapper_icon_qr"},$1=["src"],j1={class:"total_order_price"},q1={class:"ttl_wrapper"},Z1={class:"ttl_head"},Y1={class:"ttl_bar"},K1={class:"hint hint-anim","aria-label":"Инструкция по оплате"},Q1={class:"steps","aria-hidden":"true"},J1={class:"step is-active","data-i":"0"},ef={class:"ico"},tf={class:"step","data-i":"1"},nf={class:"ico"},rf={class:"step","data-i":"2"},of={class:"ico"},sf=["src"],af={class:"qr_border"},lf=Xe(r.defineComponent({__name:"CompletedQRCode",setup(a){const l=St(),i=Mt(),s=st(),u=ke.useRouter(),f={src:l.itemThemes.logo||"",width:60,height:60,excavate:!0},m=r.computed(()=>l.itemThemes.kiosk_qr_payment_timeout||60).value,p=r.ref(m);let _=0;const x=r.computed(()=>{const D=Math.floor(p.value/60),k=p.value%60;return`${D}:${k.toString().padStart(2,"0")}`}),C=r.computed(()=>p.value/m*100),y=r.computed(()=>i.paymentCostQR),I=()=>{p.value--,p.value<=0&&(clearInterval(_),O())},O=()=>{s.removeFromLocalStorage(["cart","authTokensAccess","authTokensRefresh","user"]),sessionStorage.removeItem("is_adult"),u.replace({name:"home"}).then(()=>u.go(0))};r.onMounted(()=>{_=setInterval(I,1e3)}),r.onBeforeUnmount(()=>{clearInterval(_)});const{mediaUrl:T}=Tn(()=>l.itemThemes.kiosk_preloader?"preloader":null);return(D,k)=>(r.openBlock(),r.createElementBlock("div",z1,[(r.openBlock(),r.createElementBlock("video",{loop:"",autoplay:"",muted:"",playsinline:"",key:r.unref(T)},[r.createElementVNode("source",{src:r.unref(T)||"",type:"video/webm"},null,8,H1)])),k[7]||(k[7]=r.createElementVNode("div",{class:"start_img_black"},null,-1)),r.createElementVNode("div",G1,[r.createElementVNode("div",W1,[r.createElementVNode("div",X1,[r.createElementVNode("img",{src:r.unref(ha),width:"100",height:"100"},null,8,$1)]),k[6]||(k[6]=r.createElementVNode("h1",null,"Оплата по QR",-1)),r.createElementVNode("p",j1,[r.createVNode(ft,{price:y.value,fixedFloat:2},null,8,["price"]),r.createTextVNode(" "+r.toDisplayString(r.unref(s).config_lib.currency_symbol),1)]),r.createElementVNode("div",q1,[r.createElementVNode("div",Z1,[k[0]||(k[0]=r.createElementVNode("span",null,"Срок жизни QR-кода",-1)),r.createElementVNode("b",null,r.toDisplayString(x.value),1)]),r.createElementVNode("div",Y1,[r.createElementVNode("div",{class:"ttl_fill",style:r.normalizeStyle({width:`${C.value}%`})},null,4)])]),r.createElementVNode("p",K1,[r.createElementVNode("div",Q1,[r.createElementVNode("div",J1,[r.createElementVNode("div",ef,[r.createVNode(v1)]),k[1]||(k[1]=r.createElementVNode("div",{class:"txt"},"Возьмите телефон →",-1))]),k[4]||(k[4]=r.createElementVNode("div",{class:"sep"},null,-1)),r.createElementVNode("div",tf,[r.createElementVNode("div",nf,[r.createVNode(V1)]),k[2]||(k[2]=r.createElementVNode("span",{class:"txt"},"Отсканируйте QR-код",-1))]),k[5]||(k[5]=r.createElementVNode("span",{class:"sep"},"→",-1)),r.createElementVNode("div",rf,[r.createElementVNode("div",of,[r.createElementVNode("img",{src:r.unref(U1),width:"30",height:"30"},null,8,sf)]),k[3]||(k[3]=r.createElementVNode("span",{class:"txt"},"Оплатите заказ",-1))])])]),r.createElementVNode("div",af,[r.createVNode(xa,{value:r.unref(i).linkQR,size:200,level:"Q","render-as":"svg","image-settings":f},null,8,["value"])]),r.createVNode(an,{textButtonDefault:"Отменить заказ",onClick:O,class:"cancel_order_btn"})])])]))}}),[["__scopeId","data-v-bd3b4b16"]]),cf={key:0,class:"wrapper_qr"},df={key:1,class:"wrapper_qr"},uf={key:2,class:"wrapper_qr"},ff={key:3,class:"wrapper_qr"},hf=Xe(r.defineComponent({__name:"CartCompletedOrder",props:{orderNumber:{}},setup(a){const l=Mt(),i=St(),{orderNumber:s,orderCompleted_lib:u}=xe.storeToRefs(l),{mediaUrl:f}=Tn(()=>i.itemThemes.kiosk_preloader?"preloader":null);return(m,p)=>(r.openBlock(),r.createElementBlock(r.Fragment,null,[r.unref(u)&&r.unref(u)===1?(r.openBlock(),r.createElementBlock("section",cf,[r.createVNode(b1)])):r.unref(u)&&r.unref(u)===2?(r.openBlock(),r.createElementBlock("section",df,[r.createVNode(N1)])):r.createCommentVNode("",!0),r.unref(u)&&r.unref(u)===3?(r.openBlock(),r.createElementBlock("section",uf,[r.createVNode(C1,{orderNumber:r.unref(s),mediaUrl:r.unref(f)},null,8,["orderNumber","mediaUrl"])])):r.createCommentVNode("",!0),r.unref(u)&&r.unref(u)===4?(r.openBlock(),r.createElementBlock("section",ff,[r.createVNode(lf)])):r.createCommentVNode("",!0)],64))}}),[["__scopeId","data-v-3779e8ee"]]);function mf(){const a=ke.useRoute(),l=Mt(),i=st(),s=Fn(),{isButtonDisabled:u}=xe.storeToRefs(l),f=(p,_)=>{const x=s.isTableService?"tableservice":p.kiosk_menu?"kiosk":"qr",C=l.createPaymentHandler(x,p.kiosk_menu,_);return C?{...C.config,route:{params:{orgId:String(a.params.orgId)}},handler:C.handler,resetDiscounts:p.resetDiscounts,setButtonDisabled:y=>{u.value=y},on403Kiosk:()=>{localStorage.removeItem("apiKey"),i.is_showApiKey=!0}}:null};return{getCreateOrderConfig:f,makeCreateOrderRequest:async(p,_)=>{const x=f(p,_.paymentMethodId);if(x)return Ld(_.items,x,{comment:_.comment,is_authorized:_.isAuthorized,signal:_.signal})}}}const gf={},pf={class:"cart_loyal_qr",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none"};function xf(a,l){return r.openBlock(),r.createElementBlock("svg",pf,[...l[0]||(l[0]=[r.createElementVNode("path",{d:"M19 20H20M16 20H14V17M17 17H20V14H19M14 14H16M4 16.9997C4 16.0679 4 15.6019 4.15224 15.2344C4.35523 14.7443 4.74432 14.3552 5.23438 14.1522C5.60192 14 6.06786 14 6.99974 14C7.93163 14 8.39808 14 8.76562 14.1522C9.25568 14.3552 9.64467 14.7443 9.84766 15.2344C9.9999 15.6019 9.9999 16.0681 9.9999 17C9.9999 17.9319 9.9999 18.3978 9.84766 18.7654C9.64467 19.2554 9.25568 19.6447 8.76562 19.8477C8.39808 19.9999 7.93162 19.9999 6.99974 19.9999C6.06786 19.9999 5.60192 19.9999 5.23438 19.8477C4.74432 19.6447 4.35523 19.2557 4.15224 18.7656C4 18.3981 4 17.9316 4 16.9997ZM14 6.99974C14 6.06786 14 5.60192 14.1522 5.23438C14.3552 4.74432 14.7443 4.35523 15.2344 4.15224C15.6019 4 16.0679 4 16.9997 4C17.9316 4 18.3981 4 18.7656 4.15224C19.2557 4.35523 19.6447 4.74432 19.8477 5.23438C19.9999 5.60192 19.9999 6.06812 19.9999 7C19.9999 7.93188 19.9999 8.39783 19.8477 8.76537C19.6447 9.25542 19.2557 9.64467 18.7656 9.84766C18.3981 9.9999 17.9316 9.9999 16.9997 9.9999C16.0679 9.9999 15.6019 9.9999 15.2344 9.84766C14.7443 9.64467 14.3552 9.25568 14.1522 8.76562C14 8.39808 14 7.93163 14 6.99974ZM4 6.99974C4 6.06786 4 5.60192 4.15224 5.23438C4.35523 4.74432 4.74432 4.35523 5.23438 4.15224C5.60192 4 6.06786 4 6.99974 4C7.93163 4 8.39808 4 8.76562 4.15224C9.25568 4.35523 9.64467 4.74432 9.84766 5.23438C9.9999 5.60192 9.9999 6.06812 9.9999 7C9.9999 7.93188 9.9999 8.39783 9.84766 8.76537C9.64467 9.25542 9.25568 9.64467 8.76562 9.84766C8.39808 9.9999 7.93162 9.9999 6.99974 9.9999C6.06786 9.9999 5.60192 9.9999 5.23438 9.84766C4.74432 9.64467 4.35523 9.25568 4.15224 8.76562C4 8.39808 4 7.93163 4 6.99974Z",stroke:"white","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)])])}const _f=Xe(gf,[["render",xf]]),yo=a=>{const l=bi(),i=p=>l.open(a,p),s=()=>l.close(a),u=l.state(a),f=r.computed({get:()=>u.value.visible,set:p=>p&&i()||s()}),m=r.computed(()=>u.value.context);return{visible:f,context:m,open:i,close:s}},wf={class:"cart_deletion_modal_content"},Cf={class:"cart_deletion_modal_title"},Ef={class:"cart_deletion_modal_footer"},yf=Xe(r.defineComponent({__name:"CartDeleteConfirm",emits:["confirm"],setup(a,{emit:l}){const i=l,{visible:s,context:u,close:f}=yo("cart-delete-confirm"),m=()=>{i("confirm",u.value.idSystem),f()};return(p,_)=>(r.openBlock(),r.createBlock(r.Transition,{name:"fade"},{default:r.withCtx(()=>[r.unref(s)?(r.openBlock(),r.createElementBlock("div",{key:0,class:"cart_deletion_modal_overlay",onClick:_[1]||(_[1]=r.withModifiers((...x)=>r.unref(f)&&r.unref(f)(...x),["self"]))},[r.createElementVNode("div",wf,[r.createElementVNode("div",Cf,"Удалить "+r.toDisplayString(r.unref(u).name)+"?",1),_[2]||(_[2]=r.createElementVNode("div",{class:"cart_deletion_modal_body"},"Эта позиция будет полностью удалена из заказа.",-1)),r.createElementVNode("div",Ef,[r.createElementVNode("button",{class:"primary",onClick:m}," Удалить "),r.createElementVNode("button",{onClick:_[0]||(_[0]=(...x)=>r.unref(f)&&r.unref(f)(...x))},"Отмена")])])])):r.createCommentVNode("",!0)]),_:1}))}}),[["__scopeId","data-v-018f66f3"]]),bf={class:"cart_extend_modal_content"},Af={class:"cart_extend_modal_footer"},Sf=Xe(r.defineComponent({__name:"CartExtendConfirm",emits:["confirm"],setup(a,{emit:l}){const i=l,{visible:s,context:u,close:f}=yo("cart-extend-confirm"),m=()=>{i("confirm"),f()};return(p,_)=>(r.openBlock(),r.createBlock(r.Transition,{name:"fade"},{default:r.withCtx(()=>[r.unref(s)?(r.openBlock(),r.createElementBlock("div",{key:0,class:"cart_extend_modal_overlay",onClick:_[1]||(_[1]=r.withModifiers((...x)=>r.unref(f)&&r.unref(f)(...x),["self"]))},[r.createElementVNode("div",bf,[_[2]||(_[2]=r.createElementVNode("div",{class:"cart_extend_modal_title"},"Дополнить заказ?",-1)),_[3]||(_[3]=r.createElementVNode("div",{class:"cart_extend_modal_body"},"В заказ добавлены новые позиции. Подтвердить дополнение заказа? После подтверждения позиции нельзя отменить.",-1)),r.createElementVNode("div",Af,[r.createElementVNode("button",{onClick:_[0]||(_[0]=(...x)=>r.unref(f)&&r.unref(f)(...x))},"Отмена"),r.createElementVNode("button",{class:"primary",onClick:m}," Продолжить ")])])])):r.createCommentVNode("",!0)]),_:1}))}}),[["__scopeId","data-v-15f3f7bf"]]),If={class:"order_box_wrapper"},Nf=["src"],Tf={class:"order_box_content_wrapper"},kf={class:"order_box_content_info"},Rf={class:"order_box_name"},Bf={key:0,class:"order_box_size"},Of={class:"order_box_amount"},Mf={class:"order_box_amount_count"},Df={key:1,class:"order_box_status"},vf=["data-state"],Pf={class:"order_box_info_more"},Lf={key:1,class:"cart_modifier_info"},Ff={class:"cart_modifier_content"},Vf={class:"wrapper_price_count_cart"},Uf={class:"count_order_box"},zf={class:"wrapper_modifiers_discount"},bo=Xe(r.defineComponent({__name:"OrderBox",props:{index:Number,cardItem:Object},emits:["delete"],setup(a,{emit:l}){const i=a,s=St(),u=r.ref(s.itemThemes.qr_show_modifiers_in_cart??!1),{displayNumber:f,update:m}=go(0,800),p=r.computed(()=>{var T,D;const I=((T=i.cardItem)==null?void 0:T.modifiers)??[],O=(((D=i.cardItem)==null?void 0:D.group_modifiers)??[]).flatMap(k=>k.modifiers??[]);return[...I,...O]}),{mediaUrl:_}=Tn(()=>{var I;return((I=i.cardItem)==null?void 0:I.id)+"_image"},()=>{var I;return(I=i.cardItem)==null?void 0:I.image_link}),x=r.computed(()=>{var I;return(I=i.cardItem)==null?void 0:I.total_cost}),C=()=>{u.value=!u.value},y=r.computed(()=>{var O,T;if((O=i.cardItem)!=null&&O.correlation_id)return"Ожидает добавления 🕓";const I=(T=i.cardItem)==null?void 0:T.cooking_state;return!I&&I!==0?null:I===0?"Создан":I===1?"Готовится":I===2?"Приготовлен":I===3?"Выдан":null});return r.watch(x,m,{immediate:!0}),(I,O)=>{var T,D,k,P,M,v,W,X,Z;return r.openBlock(),r.createElementBlock("div",If,[r.createElementVNode("img",{src:r.unref(_)||"",class:"order_box_image"},null,8,Nf),r.createElementVNode("div",Tf,[r.createElementVNode("div",kf,[r.createElementVNode("p",Rf,r.toDisplayString((T=a.cardItem)==null?void 0:T.name),1),(D=a.cardItem)!=null&&D.size?(r.openBlock(),r.createElementBlock("p",Bf,r.toDisplayString(((P=(k=a.cardItem)==null?void 0:k.size)==null?void 0:P.alt_name)||((M=a.cardItem)==null?void 0:M.size.name)),1)):r.createCommentVNode("",!0),r.createElementVNode("div",Of,[O[0]||(O[0]=r.createElementVNode("button",{disabled:""},"-",-1)),r.createElementVNode("p",Mf,r.toDisplayString((v=i.cardItem)==null?void 0:v.amount),1),O[1]||(O[1]=r.createElementVNode("button",{disabled:""},"+",-1))]),y.value?(r.openBlock(),r.createElementBlock("div",Df,[r.createElementVNode("span",{"data-state":(W=a.cardItem)==null?void 0:W.cooking_state},r.toDisplayString(y.value),9,vf)])):r.createCommentVNode("",!0)]),r.createElementVNode("div",Pf,[(X=i.cardItem)!=null&&X.new_price?(r.openBlock(),r.createElementBlock("p",{key:0,class:r.normalizeClass({discount_new_price:(Z=i.cardItem)==null?void 0:Z.new_price})},r.toDisplayString((i.cardItem.new_price*i.cardItem.amount).toFixed(2)+"₽"),3)):r.createCommentVNode("",!0),r.createElementVNode("p",null,r.toDisplayString(r.unref(f).toFixed(2)+"₽"),1)])]),!u.value&&p.value.length>0?(r.openBlock(),r.createElementBlock("div",{key:0,class:"cart_modifier_toggle",onClick:r.withModifiers(C,["stop"])},[...O[2]||(O[2]=[r.createElementVNode("p",{class:"cart_info_more"},"Посмотреть модификаторы",-1),r.createElementVNode("p",{class:"cart_arrow"},null,-1)])])):r.createCommentVNode("",!0),u.value&&p.value.length>0?(r.openBlock(),r.createElementBlock("div",Lf,[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(p.value,F=>{var L;return r.openBlock(),r.createElementBlock("div",{class:"cart_modifier_item",key:F.id},[r.createElementVNode("div",Ff,[r.createVNode(Ci,{id:"plus_orange"}),r.createElementVNode("p",null,r.toDisplayString(F.name),1)]),r.createElementVNode("div",Vf,[r.createElementVNode("p",Uf,r.toDisplayString(`x${F.amount}`),1),r.createElementVNode("div",zf,[F!=null&&F.new_price?(r.openBlock(),r.createElementBlock("p",{key:0,class:r.normalizeClass({discount_new_price:(L=F==null?void 0:F.new_price)==null?void 0:L.toFixed(2)})},r.toDisplayString((F.new_price*F.amount).toFixed(2)+"₽"),3)):r.createCommentVNode("",!0),r.createElementVNode("p",null,r.toDisplayString((F.total_new_price||F.price*F.amount).toFixed(2)+"₽"),1)])])])}),128)),r.createElementVNode("div",{class:"cart_modifier_arrow",onClick:r.withModifiers(C,["stop"])},[...O[3]||(O[3]=[r.createElementVNode("p",{class:"cart_info_more"},"Скрыть",-1),r.createElementVNode("p",{class:"cart_arrow_top"},null,-1)])])])):r.createCommentVNode("",!0)])}}}),[["__scopeId","data-v-ea6dee7e"]]),Hf={class:"cart_wrapper"},Gf={class:"cart_header_content"},Wf={key:0,class:"cart_header_subwrapper"},Xf={class:"cart_kso_button_wrapper"},$f={key:0},jf={key:0,class:"kso_btn_wrapper"},qf=["src"],Zf={key:0,class:"cart_qr_button_wrapper"},Yf={class:"cart_header_info"},Kf={class:"cart_header_info"},Qf={class:"cart_header_info"},Jf={class:"cart_header_info"},eh={key:1,class:"cart-tabs-wrapper"},th={class:"cart-tabs-container"},nh=["data-active","onClick"],rh={key:0,class:"wrapper_comment"},ih={class:"wrapper_limit_in_area"},oh=["placeholder","aria-invalid"],sh={class:"limit_comment"},ah={key:1,class:"wrapper_comment"},lh={class:"wrapper_limit_in_area"},ch=["placeholder","aria-invalid"],dh={class:"limit_comment"},uh={key:2},fh={class:"table_order_desk_number"},hh={key:0,class:"table_order_indent_number"},mh={class:"cart_cards"},gh={class:"cart_footer_wrapper"},ph={key:0,class:"footer_title"},xh=["disabled","max"],_h={key:1,class:"footer_sales"},wh=["step","max"],Ch={class:"list_price"},Eh={key:0},yh={key:1},bh={key:2},Ah={class:"accept_field"},Sh={class:"accept_field"},Ih={key:3},Nh={class:"accept_field"},Th={class:"accept_field"},kh={key:4},Rh={key:5},Bh={key:0,class:"accept_field"},Oh={key:1,class:"accept_field"},Mh={key:3,class:"cart_min_order_notice"},Dh={class:"wrapper_footer_cart_btn"},vh=r.defineComponent({__name:"CartPage",props:{configPage:{},textPaymentBtn:{},config_qr:{type:Boolean}},setup(a){const l=yn.create();let i;const s=st(),u=Mt(),f=St(),m=Fn(),p=bi(),_=a,{initialCartPrice_lib:x,totalPrice_lib:C,countBonus:y,config_lib:I,cartProducts_lib:O,profile:T}=xe.storeToRefs(s),{itemThemes:D}=xe.storeToRefs(f),{isButtonDisabled:k,orderCompleted_lib:P,orderNumber:M,extraDiscount:v,is_notification_lib:W,isCreateButtonVisible:X,is_paymentCart:Z,providerTypes:F,notificationData_lib:L,selectedProvider:V,configPayment:ie}=xe.storeToRefs(u),K=ke.useRouter(),ee=ke.useRoute(),G=r.useTemplateRef("stickerLoyality"),z=r.ref(!1),N=r.ref(!1),$=r.ref(!1),q=r.useTemplateRef("commentEl"),j=r.ref(""),te=r.ref(!1),J=r.ref(!1),se=r.ref(!1),ce=r.ref(0),we=r.ref(0),Ce=r.ref(!0),Ae=r.ref(),ge=r.computed(()=>_.configPage.qr_menu?"YOOKASSA_BASE":F.value[0].front_type),ht=r.computed(()=>_.configPage.qr_menu?"YOOKASSA":F.value[0].type),be=r.computed(()=>{var pe,ae;return _.configPage.kiosk_menu&&((pe=I.value)==null?void 0:pe.loyalty)==="IIKO"&&(I.value.has_loyalty_default_user||T.value)||_.configPage.qr_menu&&((ae=I.value)==null?void 0:ae.loyalty)==="IIKO"&&(T.value||D.value.qr_auth_required===!1)}),et=r.computed(()=>["АВТОРИЗОВАТЬСЯ ДЛЯ ЗАКАЗА"].includes(_.textPaymentBtn.toUpperCase())?_.textPaymentBtn:m.isTableService&&m.hasOrder?"Дополнить заказ":X.value?"Создать заказ":_.textPaymentBtn),{width:rt}=wt.useElementSize(G,{width:0,height:0},{box:"border-box"}),Ve=r.computed(()=>{var $e,Se,zt,An;const pe={energy_amount:0,proteins_amount:0,fat_amount:0,carbohydrates_amount:0};let ae=pe;return m.isTableService&&((Se=($e=m.order)==null?void 0:$e.items)!=null&&Se.length)&&(ae=((An=(zt=m.order)==null?void 0:zt.items)==null?void 0:An.reduce((ct,Pe)=>(Pe!=null&&Pe.nutrition&&(ct.energy_amount+=(Pe.nutrition.energy_amount||0)*(Pe.amount||0),ct.proteins_amount+=(Pe.nutrition.proteins_amount||0)*(Pe.amount||0),ct.fat_amount+=(Pe.nutrition.fat_amount||0)*(Pe.amount||0),ct.carbohydrates_amount+=(Pe.nutrition.carbohydrates_amount||0)*(Pe.amount||0)),ct),pe))||pe),O.value.reduce((ct,Pe)=>(ct.energy_amount+=(Pe.energy_amount||0)*(Pe.amount||0),ct.proteins_amount+=(Pe.proteins_amount||0)*(Pe.amount||0),ct.fat_amount+=(Pe.fat_amount||0)*(Pe.amount||0),ct.carbohydrates_amount+=(Pe.carbohydrates_amount||0)*(Pe.amount||0),ct),ae)}),it=r.computed(()=>{var pe;if((pe=D.value)!=null&&pe.comments){const ae=D.value.comments;return{fieldName:_.configPage.kiosk_menu?ae.kiosk_comment_field_name:ae.qr_comment_field_name,placeholder:_.configPage.kiosk_menu?ae.kiosk_comment_field_placeholder:ae.qr_comment_field_placeholder,show:_.configPage.kiosk_menu?ae.kiosk_show_order_comment:ae.qr_show_order_comment}}}),De=wt.computedAsync(async pe=>{var Se;const ae=new AbortController;if(pe(()=>ae.abort()),!z.value||!((Se=T.value)!=null&&Se.balance)||!C.value)return 0;const $e=await l.maxPayByBonuses(Ae.value,_.configPage.kiosk_menu,!!_.configPage.userData||!!T.value,ae.signal);return $e!=null&&$e.by_bonuses?($.value=$e.non_integers_allowed||!1,Math.min($e.by_bonuses,T.value.balance,C.value)):0},0,{shallow:!0}),Ne=()=>K.push(`/${ee.params.orgId}/`),Ue=pe=>{($.value?["a","A","+","-","."]:["a","A","+","-",".",","]).includes(pe.key)&&pe.preventDefault()},Nt=pe=>{s.deleteItemFromCart(pe),O.value.length===0&&(J.value=!1,se.value=!1,m.hasOrder&&K.replace({name:"order-ts"}))},ot=()=>{J.value=!J.value,j.value.length},Qe=r.computed(()=>{var ae;return(((ae=D.value.cart_loyalty_button)==null?void 0:ae.cart_loyalty_button_text)||"Программа лояльности").replace(/\S+/g,$e=>$e.length>15?$e.slice(0,15)+"...":$e)}),ve=()=>{se.value=!se.value,j.value.length},ar=()=>{let pe=$.value?+y.value.toFixed(2):Math.floor(y.value)||0;pe>De.value&&(pe=De.value),pe!==y.value&&s.setBonus(pe)};r.watchEffect(()=>{ar(),s.setBonus(C.value===0?0:$.value?+y.value.toFixed(2):Math.floor(y.value))});const ye=()=>O.value.map(pe=>({id:pe.id,front_item_id:pe.idSystem,is_fake:!!pe.is_fake,is_od_united_product:!!pe.is_od_united_product,removals:pe.removals??null,amount:pe.amount,size:pe.size,modifiers:pe.modifiers??[],group_modifiers:pe.group_modifiers??[]})),{makeCreateOrderRequest:br}=mf(),qr=r.computed(()=>ye()),Dt=r.computed(()=>{var pe,ae,$e,Se;return _.configPage.qr_menu&&((ae=(pe=D.value)==null?void 0:pe.comments)==null?void 0:ae.qr_is_order_comment_required)||_.configPage.kiosk_menu&&((Se=($e=D.value)==null?void 0:$e.comments)==null?void 0:Se.kiosk_is_order_comment_required)}),Ar=()=>{var pe,ae;return!(Dt.value&&((ae=(pe=j.value)==null?void 0:pe.trim())==null?void 0:ae.length)<1&&q.value)||m.isTableService&&m.hasOrder?!1:(u.showNotification("Обязательно перед созданием заказа укажите комментарий к заказу"),q.value.focus(),te.value=!0,Ot.animate(q.value.parentElement,{x:[0,-10,0,10,0]},{duration:.1,repeat:2}),!0)},dn=async()=>{var pe,ae,$e;if(_.configPage.qr_menu&&!T.value&&D.value.qr_auth_required!==!1){K.push(`/${ee.params.orgId}/register`);return}if(!(Dt.value&&Ar())){if(m.isTableService){if((pe=m.data)!=null&&pe.available_extend||m.hasOrder){u.showNotification("Для данного стола уже был создан заказ."),m.refresh();return}if(m.hasOrder)p.open("cart-extend-confirm");else try{k.value=!0,await l.confirmOrder(Ae.value),u.deleteCart(),m.refresh(),K.push({name:"order-ts"})}catch(Se){u.showNotification((($e=(ae=Se==null?void 0:Se.response)==null?void 0:ae.data)==null?void 0:$e.user_friendly_message)||"Ошибка при создании заказа"),m.refresh(),k.value=!1,at()}return}if(_.configPage.qr_menu||F.value.length<=1){k.value=!0,await lo(Ae.value,ht.value).then(Se=>{ie.value&&Se.url&&_.configPage.qr_menu&&window.location.replace(Se.url)});return}return Z.value=!Z.value}},Ri=()=>{Z.value=!1},Rn=async()=>{var ae,$e,Se,zt,An;v.value=0;const pe={items:[...ye()],comment:j.value,combos:[]};m.id&&(pe.table=m.id),(ae=_.configPage)!=null&&ae.kiosk_menu&&(($e=u.selectedOrderType)!=null&&$e.id)&&(pe.order_type_id=(Se=u.selectedOrderType)==null?void 0:Se.id);try{N.value=!0;const ct=await l.calculateDiscount(pe,_.configPage.kiosk_menu,!!_.configPage.userData||!!T.value,i.signal);if(!O.value)return;O.value.forEach(Pe=>{const qt=ct.items.find(Ye=>Ye.front_item_id===Pe.idSystem);if(qt&&(Pe.group_modifiers.forEach(Ye=>{const Et=qt.group_modifiers.find(Tt=>Tt.group===Ye.group);Et&&Ye.modifiers.forEach(Tt=>{const xt=Et.modifiers.find(ze=>ze.id===Tt.id);if(xt&&Number(Tt.price)!==Number(xt==null?void 0:xt.new_price)){const ze=(xt.discounts||[]).reduce((un,Wn)=>un+=+Wn.discount,0);ce.value+=ze,Tt.new_price=Tt.price,Tt.price=Number(xt==null?void 0:xt.new_price),Tt.total_new_price=Number(xt.total_new_price)}})}),Pe.modifiers.forEach(Ye=>{const Et=qt.modifiers.find(Tt=>Tt.id===Ye.id);if(Et&&Number(Ye.price)!==Number(Et==null?void 0:Et.new_price)){const Tt=(Et.discounts||[]).reduce((xt,ze)=>xt+=+ze.discount,0);ce.value+=Tt,Ye.new_price=Ye.price,Ye.price=Number(Et==null?void 0:Et.new_price),Ye.total_new_price=Number(Et.total_new_price)}}),Pe.price!==Number(qt.new_price))){const Ye=(qt.discounts||[]).reduce((Et,Tt)=>Et+=+Tt.discount,0);ce.value=ce.value+Ye,Pe.new_price=Pe.price,Pe.price=qt.new_price,Pe.discounts=qt.discounts,Pe.total_new_price=Number(qt.total_new_price)}}),O.value=[...O.value],ce.value!==0&&(C.value=ct.total_cart_price)}catch(ct){if(N.value=!1,!Ze.isCancel(ct))throw u.showNotification(((An=(zt=ct==null?void 0:ct.response)==null?void 0:zt.data)==null?void 0:An.user_friendly_message)||"Скидки временно недоступны"),ct}},Ut=async()=>{var ae,$e;let pe=k.value;k.value=!0;try{await l.extendOrder([...ye()]),u.deleteCart(),m.refreshOrder(),K.push({name:"order-ts"})}catch(Se){throw u.showNotification((($e=(ae=Se==null?void 0:Se.response)==null?void 0:ae.data)==null?void 0:$e.user_friendly_message)||"Не удалось дополнить заказ"),Se}finally{k.value=pe}},Bi=async()=>{var pe;if(!(Dt.value&&Ar())){Ae.value=null,i=new AbortController,k.value=!0;try{be.value&&await Rn(),V.value={front_type:ge};const ae={paymentMethodId:ge.value,items:qr.value,comment:j.value,isAuthorized:!!_.configPage.userData||!!T,signal:i==null?void 0:i.signal},$e=await br({..._.configPage,resetDiscounts:at},ae);Ae.value=(pe=$e==null?void 0:$e.data)==null?void 0:pe.id,X.value=!1}catch(ae){console.log("[cart](createOrder)",ae),!Ze.isCancel(ae)&&m.isTableService&&m.refresh(),k.value=!1,at()}}},Sr=()=>{var pe;return _.configPage.qr_menu&&["АВТОРИЗОВАТЬСЯ ДЛЯ ЗАКАЗА"].includes(_.textPaymentBtn.toUpperCase())&&!T.value&&D.value.qr_auth_required!==!1?K.push(`/${ee.params.orgId}/register`):m.isTableService&&((pe=m.data)!=null&&pe.available_extend)?p.open("cart-extend-confirm"):X.value?Bi():dn()},Oo=()=>{var pe;(pe=T.value)!=null&&pe.balance?T.value.balance>0&&(z.value=!z.value):u.showNotification("У Вас пока нет бонусов")};r.onMounted(async()=>{s.loadCart(),P.value=null,C.value=null,v.value=0,at()}),r.onUnmounted(()=>{i&&(i==null||i.abort(),i=null),k.value=!1,Ae.value=null,P.value=null,C.value=null,v.value=0,O.value.splice(0,O.value.length,...O.value.map(s.makeProductFullyReactive))});const mt=r.computed(()=>_.configPage.qr_menu?I.value.qr_order_minimum_price||0:_.configPage.kiosk_menu&&I.value.kiosk_order_minimum_price||0),me=r.computed(()=>{var pe;return["АВТОРИЗОВАТЬСЯ ДЛЯ ЗАКАЗА"].includes(_.textPaymentBtn.toUpperCase())?!1:m.isTableService&&m.hasOrder&&!((pe=m.data)!=null&&pe.available_extend)||mt.value>x.value&&!m.hasOrder||N.value||k.value||O.value.length===0?!0:(P.value=null,k.value)}),bt=r.computed(()=>{var pe;return((pe=O.value)==null?void 0:pe.reduce((ae,$e)=>ae+$e.amount,0))||0}),tt=r.computed(()=>{var pe;return(pe=T.value)==null?void 0:pe.phone});r.watch(j,pe=>{var ae;return((ae=pe==null?void 0:pe.trim())==null?void 0:ae.length)&&(te.value=!1)}),r.watch([bt,tt,()=>u.selectedOrderType],()=>{bt.value===0&&(i=null),i==null||i.abort(),k.value=!1});const at=()=>{X.value=!0,s.setBonus(0),O.value.splice(0,O.value.length,...O.value.map(s.makeProductFullyReactive)),ce.value=0,C.value=null,v.value=0};return r.watch([()=>s.cartProducts_lib,tt,bt,()=>u.selectedOrderType],pe=>{if(we.value>0){we.value--;return}pe&&!N.value&&(z.value=!1,at(),we.value=1),N.value=!1},{deep:!0}),(pe,ae)=>{var $e,Se,zt,An,ct,Pe,qt,Ye,Et,Tt,xt;return r.openBlock(),r.createElementBlock(r.Fragment,null,[r.createElementVNode("div",Hf,[r.createVNode(yf,{onConfirm:Nt}),r.createVNode(Sf,{onConfirm:Ut}),r.createVNode(da,{visible:r.unref(u).isDrawerOpen,"onUpdate:visible":ae[0]||(ae[0]=ze=>r.unref(u).isDrawerOpen=ze)},{default:r.withCtx(()=>[r.createVNode(fa)]),_:1},8,["visible"]),r.createElementVNode("header",Gf,[_.configPage.kiosk_menu?(r.openBlock(),r.createElementBlock("div",Wf,[r.createElementVNode("div",Xf,[r.createElementVNode("div",{class:r.normalizeClass(["arrow_wrapper",{arrow_wrapper_kso:_.configPage.kiosk_menu}]),onClick:Ne},[r.createVNode(wr,{class:"cart_header_back_button"}),_.configPage.kiosk_menu?(r.openBlock(),r.createElementBlock("span",$f,"Назад")):r.createCommentVNode("",!0)],2)]),it.value&&it.value.show?(r.openBlock(),r.createElementBlock("div",jf,[Dt.value?r.createCommentVNode("",!0):(r.openBlock(),r.createBlock(an,{key:0,style:r.normalizeStyle({visibility:!J.value&&r.unref(O).length>0?"visible":"hidden"}),class:r.normalizeClass({button_kso_comment:a.configPage.kiosk_menu}),textButtonDefault:j.value.length>0?"Редактировать":it.value&&it.value.fieldName||"",onClick:()=>J.value=!J.value,id:"button_kso_comment"},null,8,["style","class","textButtonDefault","onClick"]))])):r.createCommentVNode("",!0),r.createElementVNode("div",{class:r.normalizeClass({cart_header_wrapper:_.configPage.kiosk_menu})},[(r.unref(D).kiosk_show_loyalty_card_button||r.unref(D).kiosk_show_loyalty_phone_input_button)&&!_.config_qr?(r.openBlock(),r.createElementBlock("button",{key:0,class:"buttonDefaultWrapper button_payment_cart button_payment_cart_loyal",style:r.normalizeStyle({marginRight:($e=r.unref(D).cart_loyalty_button)!=null&&$e.cart_loyalty_button_sticker?`${Math.ceil(r.unref(rt)/2+10)}px`:"",paddingRight:(Se=r.unref(D).cart_loyalty_button)!=null&&Se.cart_loyalty_button_sticker?0:""}),onClick:ae[1]||(ae[1]=(...ze)=>r.unref(u).openDrawer&&r.unref(u).openDrawer(...ze))},[r.createElementVNode("p",{class:"cart_loyal_program",style:r.normalizeStyle({marginRight:`${Math.ceil(r.unref(rt)/2)}px`})},r.toDisplayString(Qe.value),5),(zt=r.unref(D).cart_loyalty_button)!=null&&zt.cart_loyalty_button_sticker?(r.openBlock(),r.createElementBlock("div",{key:0,ref_key:"stickerLoyality",ref:G,class:"cart_loyal_program_icon",style:r.normalizeStyle({"--sticker-mask":`url(${r.unref(D).cart_loyalty_button.cart_loyalty_button_sticker})`})},[r.createElementVNode("img",{src:r.unref(D).cart_loyalty_button.cart_loyalty_button_sticker},null,8,qf)],4)):(r.openBlock(),r.createBlock(_f,{key:1,class:"cart_loyal_qr"}))],4)):r.createCommentVNode("",!0)],2)])):r.createCommentVNode("",!0),r.createElementVNode("div",{class:r.normalizeClass([a.config_qr?"cart_kbju_qr_wrapper":"cart_kbju_kso_wrapper"])},[a.config_qr?(r.openBlock(),r.createElementBlock("div",Zf,[r.createElementVNode("div",{class:"arrow_wrapper",onClick:Ne},[r.createVNode(wr,{class:"cart_header_back_button"})])])):r.createCommentVNode("",!0),r.unref(D).show_nutrition_in_cart?(r.openBlock(),r.createElementBlock("div",{key:1,class:"cart_header",style:r.normalizeStyle({paddingTop:_.config_qr?0:"10px",paddingRight:_.config_qr?"10px":0})},[r.createElementVNode("div",Yf,[r.createElementVNode("p",null,[r.createVNode(ft,{price:Ve.value.energy_amount,duration:800},null,8,["price"]),ae[9]||(ae[9]=r.createTextVNode(" г",-1))]),ae[10]||(ae[10]=r.createElementVNode("p",{class:"cart_info_name"},"Килокалории",-1))]),r.createElementVNode("div",Kf,[r.createElementVNode("p",null,[r.createVNode(ft,{price:Ve.value.proteins_amount,duration:900},null,8,["price"]),ae[11]||(ae[11]=r.createTextVNode(" г",-1))]),ae[12]||(ae[12]=r.createElementVNode("p",{class:"cart_info_name"},"Белки",-1))]),r.createElementVNode("div",Qf,[r.createElementVNode("p",null,[r.createVNode(ft,{price:Ve.value.fat_amount,duration:1e3},null,8,["price"]),ae[13]||(ae[13]=r.createTextVNode(" г",-1))]),ae[14]||(ae[14]=r.createElementVNode("p",{class:"cart_info_name"},"Жиры",-1))]),r.createElementVNode("div",Jf,[r.createElementVNode("p",null,[r.createVNode(ft,{price:Ve.value.carbohydrates_amount,duration:1100},null,8,["price"]),ae[15]||(ae[15]=r.createTextVNode(" г",-1))]),ae[16]||(ae[16]=r.createElementVNode("p",{class:"cart_info_name"},"Углеводы",-1))])],4)):r.createCommentVNode("",!0)],2),a.configPage.kiosk_menu&&r.unref(u).orderTypes.length>1?(r.openBlock(),r.createElementBlock("div",eh,[r.createElementVNode("ul",th,[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(r.unref(u).orderTypes,ze=>{var un,Wn;return r.openBlock(),r.createElementBlock("li",{key:ze.id,class:"cart-tab","data-active":ze.id===((un=r.unref(u).selectedOrderType)==null?void 0:un.id),onClick:Zt=>r.unref(u).selectedOrderType=ze},[ze.id===((Wn=r.unref(u).selectedOrderType)==null?void 0:Wn.id)?(r.openBlock(),r.createBlock(r.unref(Ot.motion).div,{key:0,class:"cart-underline","layout-id":"cart-underline",id:"cart-underline"})):r.createCommentVNode("",!0),r.createElementVNode("span",null,r.toDisplayString(ze.name),1)],8,nh)}),128))])])):r.createCommentVNode("",!0)]),(Dt.value||J.value)&&a.configPage.kiosk_menu&&((An=r.unref(O))!=null&&An.length)?(r.openBlock(),r.createElementBlock("div",rh,[r.createElementVNode("div",ih,[r.withDirectives(r.createElementVNode("textarea",{ref_key:"commentEl",ref:q,class:"comment_order",placeholder:it.value&&it.value.placeholder||"Ваш комментарий к заказу...",name:"commentKso",maxlength:"50","aria-invalid":te.value,"onUpdate:modelValue":ae[2]||(ae[2]=ze=>j.value=ze)},null,8,oh),[[r.vModelText,j.value]]),r.createElementVNode("p",sh,r.toDisplayString(j.value.length+" / 50"),1)]),Dt.value?r.createCommentVNode("",!0):(r.openBlock(),r.createBlock(an,{key:0,textButtonDefault:"Сохранить",onClick:ot,class:"button_bonus_cart"}))])):r.createCommentVNode("",!0),(Dt.value||se.value)&&a.config_qr&&((ct=r.unref(O))!=null&&ct.length)&&!(r.unref(m).isTableService&&r.unref(m).hasOrder)?(r.openBlock(),r.createElementBlock("div",ah,[r.createElementVNode("div",lh,[r.withDirectives(r.createElementVNode("textarea",{ref_key:"commentEl",ref:q,class:"comment_order",placeholder:it.value&&it.value.placeholder||"Ваш комментарий к заказу...",name:"commentQr",maxlength:"50","aria-invalid":te.value,"onUpdate:modelValue":ae[3]||(ae[3]=ze=>j.value=ze)},null,8,ch),[[r.vModelText,j.value]]),r.createElementVNode("p",dh,r.toDisplayString(j.value.length+" / 50"),1)]),Dt.value?r.createCommentVNode("",!0):(r.openBlock(),r.createBlock(an,{key:0,textButtonDefault:"Сохранить",onClick:ve,class:"button_bonus_cart"}))])):r.createCommentVNode("",!0),a.config_qr&&it.value&&it.value.show&&!(r.unref(m).isTableService&&r.unref(m).hasOrder)?(r.openBlock(),r.createElementBlock("div",uh,[!Dt.value&&!se.value&&r.unref(O).length>0?(r.openBlock(),r.createBlock(an,{key:0,textButtonDefault:j.value.length>0?"Редактировать":it.value.fieldName||"",onClick:()=>se.value=!se.value,id:"button_comments"},null,8,["textButtonDefault","onClick"])):r.createCommentVNode("",!0)])):r.createCommentVNode("",!0),r.unref(m).isTableService&&((Pe=r.unref(m).data)!=null&&Pe.number.toString())?(r.openBlock(),r.createElementBlock("div",{key:3,class:"table_order_table_wrapper",onClick:ae[4]||(ae[4]=ze=>r.unref(m).order&&r.unref(K).push({name:"order-ts"}))},[r.createElementVNode("p",fh,r.toDisplayString(`Стол № ${(qt=r.unref(m).data)==null?void 0:qt.number}`),1),(Ye=r.unref(m).order)!=null&&Ye.id?(r.openBlock(),r.createElementBlock("p",hh,r.toDisplayString(`Заказ ${r.unref(m).order.plugin_order.number}`),1)):r.createCommentVNode("",!0)])):r.createCommentVNode("",!0),r.createElementVNode("div",mh,[r.unref(m).hasOrder&&((Tt=(Et=r.unref(m).order)==null?void 0:Et.items)!=null&&Tt.length)&&Ce.value?(r.openBlock(!0),r.createElementBlock(r.Fragment,{key:0},r.renderList(r.unref(m).order.items,ze=>(r.openBlock(),r.createBlock(bo,{key:ze.idSystem,cardItem:ze},null,8,["cardItem"]))),128)):r.createCommentVNode("",!0),(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(r.unref(O),ze=>(r.openBlock(),r.createBlock(ua,{key:ze.idSystem,cardItem:ze,isShowModifiers:_.config_qr,onDelete:un=>Nt(ze.idSystem)},null,8,["cardItem","isShowModifiers","onDelete"]))),128))]),r.createElementVNode("div",gh,[z.value&&!r.unref(X)?(r.openBlock(),r.createElementBlock("p",ph,[ae[17]||(ae[17]=r.createTextVNode(" Списать ",-1)),r.withDirectives(r.createElementVNode("input",{type:"number",placeholder:"0",style:r.normalizeStyle({maxWidth:`${r.unref(y).toString().length||1}em`}),disabled:r.unref(T)===null||((xt=r.unref(T))==null?void 0:xt.balance)===0,"onUpdate:modelValue":ae[5]||(ae[5]=ze=>r.isRef(y)?y.value=ze:null),onInput:ar,min:"0",max:r.unref(De),step:".01",onKeypress:Ue},null,44,xh),[[r.vModelText,r.unref(y),void 0,{number:!0}]]),ae[18]||(ae[18]=r.createTextVNode(" бонусов ",-1))])):r.createCommentVNode("",!0),z.value&&!r.unref(X)?(r.openBlock(),r.createElementBlock("p",_h,"У вас есть "+r.toDisplayString(r.unref(T)?r.unref(T).balance:0)+" B",1)):r.createCommentVNode("",!0),z.value&&!r.unref(X)?r.withDirectives((r.openBlock(),r.createElementBlock("input",{key:2,type:"range",class:"footer_range","onUpdate:modelValue":ae[6]||(ae[6]=ze=>r.isRef(y)?y.value=ze:null),step:$.value?".01":"1",min:0,max:r.unref(De)},null,8,wh)),[[r.vModelText,r.unref(y),void 0,{number:!0}]]):r.createCommentVNode("",!0),r.createElementVNode("ul",Ch,[z.value&&!r.unref(X)?(r.openBlock(),r.createElementBlock("li",Eh,[ae[20]||(ae[20]=r.createElementVNode("p",null,"Сумма заказа:",-1)),r.createElementVNode("p",null,[r.createVNode(ft,{price:r.unref(C),fixedFloat:2},null,8,["price"]),ae[19]||(ae[19]=r.createTextVNode(" ₽",-1))])])):r.createCommentVNode("",!0),z.value&&!r.unref(X)?(r.openBlock(),r.createElementBlock("li",yh,[ae[22]||(ae[22]=r.createElementVNode("p",null,"Будет оплачено бонусами:",-1)),r.createElementVNode("p",null,[r.createVNode(ft,{price:r.unref(y),fixedFloat:2},null,8,["price"]),ae[21]||(ae[21]=r.createTextVNode(" Б",-1))])])):r.createCommentVNode("",!0),r.unref(v)!==0?(r.openBlock(),r.createElementBlock("li",bh,[r.createElementVNode("p",Ah,r.toDisplayString(r.unref(v)>0?"Надбавка":"Скидка")+": ",1),r.createElementVNode("p",Sh,[r.createVNode(ft,{price:Math.abs(r.unref(v)),fixedFloat:2},null,8,["price"]),ae[23]||(ae[23]=r.createTextVNode(" ₽",-1))])])):ce.value!==0?(r.openBlock(),r.createElementBlock("li",Ih,[r.createElementVNode("p",Nh,r.toDisplayString(ce.value>0?"Надбавка":"Скидка")+": ",1),r.createElementVNode("p",Th,[r.createVNode(ft,{price:Math.abs(ce.value),fixedFloat:2},null,8,["price"]),ae[24]||(ae[24]=r.createTextVNode(" ₽",-1))])])):r.createCommentVNode("",!0),r.unref(m).isTableService&&r.unref(m).order?(r.openBlock(),r.createElementBlock("li",kh,[ae[26]||(ae[26]=r.createElementVNode("p",null,"Сумма заказа:",-1)),r.createElementVNode("p",null,[r.createVNode(ft,{price:r.unref(m).order.total_cost,fixedFloat:2},null,8,["price"]),ae[25]||(ae[25]=r.createTextVNode(" ₽",-1))])])):r.createCommentVNode("",!0),r.unref(m).isTableService&&r.unref(m).order?(r.openBlock(),r.createElementBlock("li",Rh,[ae[28]||(ae[28]=r.createElementVNode("p",null,"К счёту добавится:",-1)),r.createElementVNode("p",null,[r.createVNode(ft,{price:r.unref(C),fixedFloat:2},null,8,["price"]),ae[27]||(ae[27]=r.createTextVNode(" ₽",-1))])])):r.createCommentVNode("",!0),r.createElementVNode("li",null,[ae[31]||(ae[31]=r.createElementVNode("p",{class:"accept_field"},"Итого к оплате:",-1)),r.unref(m).isTableService&&r.unref(m).order?(r.openBlock(),r.createElementBlock("p",Bh,[r.createVNode(ft,{price:r.unref(m).order.total_cost+r.unref(C),fixedFloat:2},null,8,["price"]),ae[29]||(ae[29]=r.createTextVNode(" ₽",-1))])):(r.openBlock(),r.createElementBlock("p",Oh,[r.createVNode(ft,{price:r.unref(C)-r.unref(y),fixedFloat:2},null,8,["price"]),ae[30]||(ae[30]=r.createTextVNode(" ₽",-1))]))])]),mt.value&&mt.value>r.unref(x)&&!r.unref(m).hasOrder?(r.openBlock(),r.createElementBlock("div",Mh,[ae[32]||(ae[32]=r.createTextVNode(" Минимальная сумма заказа ",-1)),r.createVNode(ft,{price:mt.value,fixedFloat:2},null,8,["price"]),r.createTextVNode(" "+r.toDisplayString(r.unref(I).currency_symbol)+". Для оформления заказа необходимо добавить товаров на сумму ",1),r.createVNode(ft,{price:mt.value-r.unref(x),fixedFloat:2},null,8,["price"]),r.createTextVNode(" "+r.toDisplayString(r.unref(I).currency_symbol),1)])):r.createCommentVNode("",!0),r.createElementVNode("div",Dh,[r.unref(T)&&!r.unref(X)&&!r.unref(m).isTableService?(r.openBlock(),r.createBlock(an,{key:0,textButtonDefault:r.unref(D).bonuses_button_name||"Бонусы",onClick:Oo,class:"button_bonus_cart"},null,8,["textButtonDefault"])):r.createCommentVNode("",!0),r.createVNode(an,{textButtonDefault:et.value,onClick:Sr,class:"button_payment_cart",disabled:me.value},null,8,["textButtonDefault","disabled"])])])]),r.unref(m).isTableService?r.createCommentVNode("",!0):(r.openBlock(),r.createBlock(hf,{key:0,orderNumber:r.unref(M),pageNumber:1},null,8,["orderNumber"])),r.createVNode(Ei,{visible:r.unref(W),"onUpdate:visible":ae[7]||(ae[7]=ze=>r.isRef(W)?W.value=ze:null),textNotificationDefault:r.unref(L).textNotification,backgroundColor:r.unref(D).accent_color?r.unref(D).accent_color:"#FF6D2E",buttonAccept:null},null,8,["visible","textNotificationDefault","backgroundColor"]),r.createVNode(xo,{modelValue:r.unref(Z),"onUpdate:modelValue":ae[8]||(ae[8]=ze=>r.isRef(Z)?Z.value=ze:null),class:"product_card_sheet","snap-points":["80%"]},{default:r.withCtx(()=>{var ze;return[r.createVNode(f1,{"config-page":a.configPage,comment:j.value,"cart-items":qr.value,"is-authorized":!!_.configPage.userData||!!r.unref(T),"order-id":Ae.value,signal:(ze=r.unref(i))==null?void 0:ze.signal,onSelectPayment:Ri},null,8,["config-page","comment","cart-items","is-authorized","order-id","signal"])]}),_:1},8,["modelValue"])],64)}}}),Ph={},Lh={viewBox:"0 0 24 24"};function Fh(a,l){return r.openBlock(),r.createElementBlock("svg",Lh,[...l[0]||(l[0]=[r.createElementVNode("path",{d:"M18 6L6 18M6 6l12 12"},null,-1)])])}const Vh=Xe(Ph,[["render",Fh]]),Uh={class:"retry_screen"},zh={class:"retry_all_in_screen"},Hh={class:"retry_content"},Gh={class:"retry_icon_wrap"},Wh={class:"retry_icon_circle"},Xh={class:"retry_error_x"},$h=r.defineComponent({__name:"RetryPage",setup(a){const l=Mt(),i=ke.useRouter(),s=ke.useRoute(),u=()=>{l.notificationData_lib.textNotification="",l.is_notification_lib=!1,i.replace(`/${s.params.orgId}/`)};return(f,m)=>(r.openBlock(),r.createElementBlock("section",Uh,[r.createElementVNode("div",zh,[r.createElementVNode("main",Hh,[r.createElementVNode("div",Gh,[r.createElementVNode("div",Wh,[m[0]||(m[0]=r.createElementVNode("div",{class:"retry_loader_mini"},null,-1)),r.createElementVNode("div",Xh,[r.createVNode(Vh)])])]),m[1]||(m[1]=r.createElementVNode("div",{class:"retry_oops"},"OOPS",-1)),m[2]||(m[2]=r.createElementVNode("h1",{class:"retry_title"},"Что-то пошло не так",-1)),m[3]||(m[3]=r.createElementVNode("div",{class:"retry_hint"},[r.createElementVNode("p",null,"Похоже, произошёл технический сбой."),r.createElementVNode("p",null,"Мы уже знаем о проблеме и сейчас разбираемся."),r.createElementVNode("p",null,"Приносим извинения за доставленные неудобства."),r.createElementVNode("p",null,"Попробуйте начать новый заказ.")],-1))]),r.createElementVNode("div",{class:"retry_footer"},[r.createElementVNode("button",{onClick:u,class:"retry_new_order_btn"},"Новый заказ")]),m[4]||(m[4]=r.createElementVNode("p",{class:"retry_bottom_note"},"Если ошибка повторяется — обратитесь к сотруднику зала.",-1))])]))}}),jh={class:"table_order_wrapper"},qh={class:"table_order_header_content"},Zh={class:"table_order_kbju_qr_wrapper"},Yh={class:"table_order_qr_button_wrapper"},Kh={key:0,class:"table_order_header",style:{paddingRight:"10px"}},Qh={class:"table_order_header_info"},Jh={class:"table_order_header_info"},e2={class:"table_order_header_info"},t2={class:"table_order_header_info"},n2={key:0,class:"table_order_table_wrapper"},r2={class:"table_order_desk_number"},i2={class:"table_order_indent_number"},o2={class:"table_order_cards"},s2={class:"table_order_footer_wrapper"},a2={key:0,class:"footer_title"},l2=["disabled","max"],c2={key:1,class:"footer_sales"},d2=["step","max"],u2={class:"list_price"},f2={key:0},h2={key:1},m2={key:2},g2={key:3},p2={class:"accept_field"},x2={key:3,class:"wrapper_footer_table_order_btn"},_2=Xe(r.defineComponent({__name:"TableOrderPage",setup(a){const l=st(),i=Gr(),s=St(),u=Fn(),{countBonus:f}=xe.storeToRefs(l),{itemThemes:m}=xe.storeToRefs(s),p=ke.useRouter(),_=ke.useRoute(),x=yn.create(),C=r.ref(!1),y=r.ref(!1),I=r.ref(!1),O=r.ref(!1),T=r.ref(!1),D=r.computed(()=>C.value||!u.hasOrder),k=r.computed(()=>{var L,V;const F={energy_amount:0,proteins_amount:0,fat_amount:0,carbohydrates_amount:0};return((V=(L=u.order)==null?void 0:L.items)==null?void 0:V.reduce((ie,K)=>(K!=null&&K.nutrition&&(ie.energy_amount+=(K.nutrition.energy_amount||0)*(K.amount||0),ie.proteins_amount+=(K.nutrition.proteins_amount||0)*(K.amount||0),ie.fat_amount+=(K.nutrition.fat_amount||0)*(K.amount||0),ie.carbohydrates_amount+=(K.nutrition.carbohydrates_amount||0)*(K.amount||0)),ie),F))||F}),P=wt.computedAsync(async F=>{var ie;const L=new AbortController;if(F(()=>L.abort()),!y.value||!((ie=l.profile)!=null&&ie.balance))return 0;const V=await x.maxPayByBonuses(u.order.id,!1,l.profile,L.signal);return V!=null&&V.by_bonuses?(I.value=V.non_integers_allowed||!1,Math.min(u.order.remaining_amount,l.profile.balance,V.by_bonuses)):0},0,{shallow:!0}),M=()=>{T.value=!0},v=()=>p.push(`/${_.params.orgId}/`),W=async()=>{var F,L;C.value=!0;try{const V=await lo(u.order.id,"YOOKASSA");V.url&&window.location.replace(V.url)}catch(V){throw i.showNotification(((L=(F=V==null?void 0:V.response)==null?void 0:F.data)==null?void 0:L.user_friendly_message)||"Ошибка при оплате заказа"),V}finally{C.value=!1}},X=F=>{(I.value?["a","A","+","-","."]:["a","A","+","-",".",","]).includes(F.key)&&F.preventDefault()},Z=()=>{let F=I.value?+f.value.toFixed(2):Math.floor(f.value)||0;F>P.value&&(F=P.value),F!==f.value&&l.setBonus(F)};return(F,L)=>{var V,ie,K,ee,G,z,N,$;return r.openBlock(),r.createElementBlock("div",jh,[r.createElementVNode("header",qh,[r.createElementVNode("div",Zh,[r.createElementVNode("div",Yh,[r.createElementVNode("div",{class:"arrow_wrapper",onClick:v},[r.createVNode(wr,{class:"table_order_header_back_button"})])]),r.unref(m).show_nutrition_in_cart?(r.openBlock(),r.createElementBlock("div",Kh,[r.createElementVNode("div",Qh,[r.createElementVNode("p",null,[r.createVNode(ft,{price:k.value.energy_amount,duration:800},null,8,["price"]),L[2]||(L[2]=r.createTextVNode(" г ",-1))]),L[3]||(L[3]=r.createElementVNode("p",{class:"table_order_info_name"},"Килокалории",-1))]),r.createElementVNode("div",Jh,[r.createElementVNode("p",null,[r.createVNode(ft,{price:k.value.proteins_amount,duration:900},null,8,["price"]),L[4]||(L[4]=r.createTextVNode(" г ",-1))]),L[5]||(L[5]=r.createElementVNode("p",{class:"table_order_info_name"},"Белки",-1))]),r.createElementVNode("div",e2,[r.createElementVNode("p",null,[r.createVNode(ft,{price:k.value.fat_amount,duration:1e3},null,8,["price"]),L[6]||(L[6]=r.createTextVNode(" г ",-1))]),L[7]||(L[7]=r.createElementVNode("p",{class:"table_order_info_name"},"Жиры",-1))]),r.createElementVNode("div",t2,[r.createElementVNode("p",null,[r.createVNode(ft,{price:k.value.carbohydrates_amount,duration:1100},null,8,["price"]),L[8]||(L[8]=r.createTextVNode(" г ",-1))]),L[9]||(L[9]=r.createElementVNode("p",{class:"table_order_info_name"},"Углеводы",-1))])])):r.createCommentVNode("",!0)])]),(V=r.unref(u).order)!=null&&V.id?(r.openBlock(),r.createElementBlock("div",n2,[r.createElementVNode("p",r2,r.toDisplayString(`Стол № ${(ie=r.unref(u).data)==null?void 0:ie.number}`),1),r.createElementVNode("p",i2,r.toDisplayString(`Заказ ${r.unref(u).order.plugin_order.number}`),1)])):r.createCommentVNode("",!0),r.createElementVNode("div",o2,[(ee=(K=r.unref(u).order)==null?void 0:K.items)!=null&&ee.length?(r.openBlock(!0),r.createElementBlock(r.Fragment,{key:0},r.renderList(r.unref(u).order.items,q=>(r.openBlock(),r.createBlock(bo,{key:q.idSystem,cardItem:q},null,8,["cardItem"]))),128)):r.createCommentVNode("",!0)]),r.createElementVNode("div",s2,[y.value?(r.openBlock(),r.createElementBlock("p",a2,[L[10]||(L[10]=r.createTextVNode(" Списать ",-1)),r.withDirectives(r.createElementVNode("input",{type:"number",placeholder:"0",style:r.normalizeStyle({maxWidth:`${r.unref(f).toString().length||1}em`}),disabled:r.unref(l).profile===null||((G=r.unref(l).profile)==null?void 0:G.balance)===0,"onUpdate:modelValue":L[0]||(L[0]=q=>r.isRef(f)?f.value=q:null),onInput:Z,min:"0",max:r.unref(P),step:".01",onKeypress:X},null,44,l2),[[r.vModelText,r.unref(f),void 0,{number:!0}]]),L[11]||(L[11]=r.createTextVNode(" бонусов ",-1))])):r.createCommentVNode("",!0),y.value?(r.openBlock(),r.createElementBlock("p",c2," У вас есть "+r.toDisplayString(r.unref(l).profile.balance??0)+" B ",1)):r.createCommentVNode("",!0),y.value?r.withDirectives((r.openBlock(),r.createElementBlock("input",{key:2,type:"range",class:"footer_range","onUpdate:modelValue":L[1]||(L[1]=q=>r.isRef(f)?f.value=q:null),step:I.value?".01":"1",min:0,max:r.unref(P)},null,8,d2)),[[r.vModelText,r.unref(f),void 0,{number:!0}]]):r.createCommentVNode("",!0),r.createElementVNode("ul",u2,[r.unref(u).order&&r.unref(u).order.total_cost-r.unref(u).order.remaining_amount>0?(r.openBlock(),r.createElementBlock("li",f2,[L[13]||(L[13]=r.createElementVNode("p",null,"Сумма заказа:",-1)),r.createElementVNode("p",null,[r.createVNode(ft,{price:(z=r.unref(u).order)==null?void 0:z.total_cost,fixedFloat:2},null,8,["price"]),L[12]||(L[12]=r.createTextVNode(" ₽ ",-1))])])):r.createCommentVNode("",!0),r.unref(u).order&&r.unref(u).order.total_cost-r.unref(u).order.remaining_amount>0?(r.openBlock(),r.createElementBlock("li",h2,[L[15]||(L[15]=r.createElementVNode("p",null,"Оплачено:",-1)),r.createElementVNode("p",null,[r.createVNode(ft,{price:r.unref(u).order.total_cost-r.unref(u).order.remaining_amount,fixedFloat:2},null,8,["price"]),L[14]||(L[14]=r.createTextVNode(" ₽ ",-1))])])):r.createCommentVNode("",!0),y.value?(r.openBlock(),r.createElementBlock("li",m2,[L[17]||(L[17]=r.createElementVNode("p",null,"Будет оплачено бонусами:",-1)),r.createElementVNode("p",null,[r.createVNode(ft,{price:r.unref(f),fixedFloat:2},null,8,["price"]),L[16]||(L[16]=r.createTextVNode(" Б ",-1))])])):r.createCommentVNode("",!0),(N=r.unref(u).order)!=null&&N.remaining_amount?(r.openBlock(),r.createElementBlock("li",g2,[L[19]||(L[19]=r.createElementVNode("p",{class:"accept_field"},"Итого к оплате:",-1)),r.createElementVNode("p",p2,[r.createVNode(ft,{price:r.unref(u).order.remaining_amount-r.unref(f),fixedFloat:2},null,8,["price"]),L[18]||(L[18]=r.createTextVNode(" ₽ ",-1))])])):r.createCommentVNode("",!0)]),($=r.unref(u).order)!=null&&$.remaining_amount&&r.unref(s).itemThemes.qr_show_pay_button_ts!==!1?(r.openBlock(),r.createElementBlock("div",x2,[r.createVNode(an,{textButtonDefault:O.value?"Запросить счёт":"Оплатить заказ",onClick:O.value?M:W,class:"button_payment_cart",disabled:D.value},null,8,["textButtonDefault","onClick","disabled"])])):r.createCommentVNode("",!0)])])}}}),[["__scopeId","data-v-75fa9255"]]),w2={class:"wrapper_loader"},C2=r.defineComponent({__name:"Loader",props:{size:{type:String,default:"40px"}},setup(a){return(l,i)=>(r.openBlock(),r.createElementBlock("div",w2,[r.createElementVNode("div",{class:"loader",style:r.normalizeStyle({width:a.size})},null,4)]))}}),E2=Xe(r.defineComponent({__name:"AnimationLoader",props:{id:{}},setup(a){const l=r.ref(!0);return r.watch(()=>l.value,()=>{l.value=!1,setTimeout(()=>{l.value=!0},0)}),(i,s)=>(r.openBlock(),r.createElementBlock("div",{class:"opacity-animation",key:a.id},[r.renderSlot(i.$slots,"opacityLoader",{},void 0,!0)]))}}),[["__scopeId","data-v-c6b97942"]]),y2={key:0},b2={class:"card__main__wrapper"},A2={key:0,class:"folder_content_top"},S2={key:0,class:"loader_card_main"},I2=["src","alt"],N2={class:"card_title_price_wrapper"},T2={class:"title"},k2={key:0,class:"price"},R2={key:1},B2={key:0,class:"card_button_add_wrapper"},_a=Xe(r.defineComponent({__name:"CardMain",props:{data:{},activeTags:{},is_group:{type:Boolean},parent:{},isLoading:{type:Boolean},selectGroupChild:{type:Function},takeCurrentCard:{type:Function}},setup(a){St();const l=st(),i=Lt(),{is_18_above_content:s,is18Allowed:u,notificationData_lib:f}=xe.storeToRefs(l),{isDesktop:m}=Hn(),p=a,_=(I,O)=>{var k,P,M;const T={id:I.id,is_fake:I.is_fake||!1,is_od_united_product:I.is_od_united_product||!1,amount:I.amount||1,name:I.name,image_link:I.image_link,price:I.price,old_price:I.price,size:void 0,sizes:[],modifiers:[],groups:I.groups,group_modifiers:[],energy_amount:I.energy_amount??0,proteins_amount:I.proteins_amount??0,fat_amount:I.fat_amount??0,carbohydrates_amount:I.carbohydrates_amount??0},D=!((k=I.modifiers)!=null&&k.length)&&!((P=I.group_modifiers)!=null&&P.length)&&!((M=I.sizes)!=null&&M.length);if(i.isUpSale=!1,I.adult&&!u.value){s.value=!0,D&&(f.value.fastAdd=T);return}if(D){l.addToCart(T);return}if(I.amount||(I.amount=1),p.is_group&&p.selectGroupChild){p.selectGroupChild({...I,parent:p.parent,child:O.child_groups});return}p.takeCurrentCard&&p.takeCurrentCard(O.id)},x=I=>{if(p.is_group&&p.selectGroupChild){I={...I,parent:p.parent,child:I.child_groups},p.selectGroupChild(I);return}if(I.adult&&!u.value){s.value=!0;return}p.takeCurrentCard&&p.takeCurrentCard(I.id)},C=r.computed(()=>p.activeTags.every(I=>p.data.tags.includes(I))),{mediaUrl:y}=Tn(()=>p.data.id+"_image",()=>p.data.image_link);return(I,O)=>{var T;return((T=p.activeTags)==null?void 0:T.length)===0||C.value||p.is_group?(r.openBlock(),r.createElementBlock("div",y2,[r.createVNode(E2,{id:p.data.id},{opacityLoader:r.withCtx(()=>[r.createElementVNode("div",b2,[a.is_group?(r.openBlock(),r.createElementBlock("div",A2)):r.createCommentVNode("",!0),r.createElementVNode("div",{onClick:O[0]||(O[0]=D=>x(p.data)),class:r.normalizeClass(["card__main",{card__main_folder:a.is_group}])},[a.isLoading?(r.openBlock(),r.createElementBlock("div",S2,[r.createVNode(C2)])):(r.openBlock(),r.createElementBlock("div",{key:1,class:r.normalizeClass(["card__main_content",{card_main_desktop_qr:r.unref(m)}])},[r.createElementVNode("img",{src:r.unref(y)||"",class:r.normalizeClass(["img",{card_blur_image:p.data.adult&&!r.unref(u)}]),loading:"lazy",alt:a.data.name},null,10,I2),r.createElementVNode("div",N2,[r.createElementVNode("p",T2,r.toDisplayString(a.data.name),1),a.is_group?r.createCommentVNode("",!0):(r.openBlock(),r.createElementBlock("p",k2,r.toDisplayString(r.unref(hr)(a.data))+" ₽",1))])],2))],2),r.unref(m)?r.createCommentVNode("",!0):(r.openBlock(),r.createElementBlock("div",R2,[a.is_group?r.createCommentVNode("",!0):(r.openBlock(),r.createElementBlock("div",B2,[r.createElementVNode("div",{onClick:O[1]||(O[1]=D=>_(a.data,p.data)),class:"add_button"},[...O[2]||(O[2]=[r.createElementVNode("div",{class:"image_add_button"},null,-1)])])]))]))])]),_:1},8,["id"])])):r.createCommentVNode("",!0)}}}),[["__scopeId","data-v-bfc53e47"]]),O2=["id","onClick"],M2=Xe(r.defineComponent({__name:"GroupMain",props:{menuGroup:{},idActiveGroup:{},activeTakeGroup:{type:Function}},setup(a){const{shouldUseDragScroll:l}=Hn(),i=r.ref(null);return(s,u)=>a.menuGroup.length?r.withDirectives((r.openBlock(),r.createElementBlock("ul",{key:0,class:"main__menu",ref_key:"scrollGroup",ref:i},[r.createVNode(ho,{axis:"x",behavior:"smooth",container:i.value,autoScroll:!0,idActive:a.idActiveGroup,clearContainer:!0},{default:r.withCtx(({handleTargetClick:f})=>[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(a.menuGroup,(m,p)=>(r.openBlock(),r.createElementBlock("li",{key:m.id,id:"scrolling"+m.id,onClick:_=>{a.activeTakeGroup&&a.activeTakeGroup(m.id,p),f(_)},style:r.normalizeStyle(a.idActiveGroup==m.id?{fontFamily:"Bounded"}:{})},r.toDisplayString(m.name),13,O2))),128))]),_:1},8,["container","idActive"])])),[[r.unref(Wr),r.unref(l)?{}:!1]]):r.createCommentVNode("",!0)}}),[["__scopeId","data-v-aa0ca388"]]),D2=["id","onClick"],v2=Xe(r.defineComponent({__name:"TagsMain",props:{menuTags:{default:()=>[]},groupIndex:{default:null},isSolo:{type:Boolean,default:!1},currentActiveTag:{},activeTakeTags:{type:Function,default:void 0},activeTakeTagsSolo:{type:Function,default:void 0}},setup(a){const l=a,{shouldUseDragScroll:i}=Hn(),s=r.ref(null),u=r.computed(()=>{if(l.isSolo&&!l.groupIndex)return Array.isArray(l.currentActiveTag)?l.currentActiveTag:[];if(l.groupIndex!==null&&l.groupIndex!==void 0){const f=l.currentActiveTag[l.groupIndex];return Array.isArray(f)?f:[]}return[]});return(f,m)=>a.menuTags.length>0?r.withDirectives((r.openBlock(),r.createElementBlock("ul",{key:0,class:"main__filters",ref_key:"scrollTagContainer",ref:s},[r.createVNode(ho,{axis:"x",behavior:"smooth",container:s.value,autoScroll:!0,idActive:u.value?u.value[a.currentActiveTag.length-1]:null,clearContainer:!1},{default:r.withCtx(({handleTargetClick:p})=>[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(a.menuTags,(_,x)=>(r.openBlock(),r.createElementBlock("li",{key:x,id:`scrolling${_}`,onClick:C=>{a.activeTakeTags&&(a.groupIndex||a.groupIndex===0)?a.activeTakeTags(_,a.groupIndex):a.activeTakeTagsSolo&&a.activeTakeTagsSolo(_),p(C)},class:r.normalizeClass({main__filter_active:(u.value??[]).includes(_)})},r.toDisplayString(_),11,D2))),128))]),_:1},8,["container","idActive"])])),[[r.unref(Wr),r.unref(i)?{}:!1]]):r.createCommentVNode("",!0)}}),[["__scopeId","data-v-afba730a"]]),P2=["data-id"],L2=["src"],F2=["src"],V2=Xe(r.defineComponent({__name:"DrumItem",props:{group:{},index:{},active:{type:Boolean}},setup(a){const l=a,{mediaUrl:i}=Tn(()=>{var s,u;return(s=l.group)!=null&&s.video_link?`${l.group.id}_video`:(u=l.group)!=null&&u.image_link?`${l.group.id}_image`:null});return(s,u)=>a.group?(r.openBlock(),r.createElementBlock("div",{key:0,class:r.normalizeClass(["drum_item",{active:l.active}]),"data-id":a.group.id},[a.group.video_link?r.withDirectives((r.openBlock(),r.createElementBlock("video",{key:r.unref(i),loop:"",autoplay:"",muted:"",playsinline:"",class:"drum_img"},[r.createElementVNode("source",{src:r.unref(i)||"",type:"video/webm"},null,8,L2)])),[[r.unref(Xr)]]):(r.openBlock(),r.createElementBlock("img",{key:1,class:"drum_img",src:r.unref(i)||""},null,8,F2)),r.createElementVNode("p",null,r.toDisplayString(a.group.name),1)],10,P2)):r.createCommentVNode("",!0)}}),[["__scopeId","data-v-2b994529"]]),U2={},z2={width:"9.998535",height:"10.000000",viewBox:"0 0 9.99854 10",fill:"none",xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink"};function H2(a,l){return r.openBlock(),r.createElementBlock("svg",z2,[...l[0]||(l[0]=[r.createElementVNode("desc",null," Created with Pixso. ",-1),r.createElementVNode("defs",null,null,-1),r.createElementVNode("path",{id:"Форма 5",d:"M4.23 10L5.76 10L5.76 5.74L9.99 5.74L9.99 4.25L5.76 4.25L5.76 0L4.23 0L4.23 4.25L0 4.25L0 5.74L4.23 5.74L4.23 10Z",fill:"#F2F7FF","fill-opacity":"1.000000","fill-rule":"nonzero"},null,-1)])])}const G2=Xe(U2,[["render",H2]]),W2={class:"recommendation_wrapper"},X2={class:"recommendation_header"},$2={class:"recommendation_info"},j2=Xe(r.defineComponent({__name:"Recommendation",props:{closeCurrentCard:{},openCurrentCard:{}},setup(a){const l=Lt(),{isUpSale:i,dataUpSale:s}=xe.storeToRefs(l),u=()=>{i.value=!1};return r.onUnmounted(()=>{s.value=null}),(f,m)=>(r.openBlock(),r.createElementBlock("div",W2,[r.createElementVNode("div",X2,[m[0]||(m[0]=r.createElementVNode("p",{class:"header_title"},"Часто берут вместе",-1)),r.createElementVNode("div",{class:"header_close",onClick:u},[r.createVNode(G2,{class:"close_icon"})])]),r.createElementVNode("div",$2,[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(r.unref(s),p=>(r.openBlock(),r.createBlock(_a,{data:p,key:p.id,parent:p.id,is_group:!1,is_product:!0,class:"card",activeTags:[],isLoading:!1,closeCurrentCard:a.closeCurrentCard,takeCurrentCard:()=>a.openCurrentCard(p.id,!0)},null,8,["data","parent","closeCurrentCard","takeCurrentCard"]))),128))])]))}}),[["__scopeId","data-v-d545ec45"]]),q2=r.defineComponent({__name:"Blackout",props:{data:{type:Boolean}},setup(a){const l=a;return r.watch(()=>l.data,i=>{document.body.style.overflow=i?"hidden":""}),()=>{}}}),Z2={class:"wrapper_modal"},Y2={class:"card_modal"},K2=Xe(r.defineComponent({__name:"ModalWindows",props:{visible:{type:Boolean}},setup(a){const l=a,i=Lt(),{isUpSale:s}=xe.storeToRefs(i),u=()=>{s.value=!1};return(f,m)=>(r.openBlock(),r.createElementBlock(r.Fragment,null,[r.createVNode(q2,{data:l.visible},null,8,["data"]),r.createElementVNode("div",{class:"black_modal",onClick:u}),r.createElementVNode("div",Z2,[r.createElementVNode("div",Y2,[r.renderSlot(f.$slots,"default",{},void 0,!0)])])],64))}}),[["__scopeId","data-v-ec2b2c4d"]]);var _e;(function(a){a[a.QR_CODE=0]="QR_CODE",a[a.AZTEC=1]="AZTEC",a[a.CODABAR=2]="CODABAR",a[a.CODE_39=3]="CODE_39",a[a.CODE_93=4]="CODE_93",a[a.CODE_128=5]="CODE_128",a[a.DATA_MATRIX=6]="DATA_MATRIX",a[a.MAXICODE=7]="MAXICODE",a[a.ITF=8]="ITF",a[a.EAN_13=9]="EAN_13",a[a.EAN_8=10]="EAN_8",a[a.PDF_417=11]="PDF_417",a[a.RSS_14=12]="RSS_14",a[a.RSS_EXPANDED=13]="RSS_EXPANDED",a[a.UPC_A=14]="UPC_A",a[a.UPC_E=15]="UPC_E",a[a.UPC_EAN_EXTENSION=16]="UPC_EAN_EXTENSION"})(_e||(_e={}));var wa=new Map([[_e.QR_CODE,"QR_CODE"],[_e.AZTEC,"AZTEC"],[_e.CODABAR,"CODABAR"],[_e.CODE_39,"CODE_39"],[_e.CODE_93,"CODE_93"],[_e.CODE_128,"CODE_128"],[_e.DATA_MATRIX,"DATA_MATRIX"],[_e.MAXICODE,"MAXICODE"],[_e.ITF,"ITF"],[_e.EAN_13,"EAN_13"],[_e.EAN_8,"EAN_8"],[_e.PDF_417,"PDF_417"],[_e.RSS_14,"RSS_14"],[_e.RSS_EXPANDED,"RSS_EXPANDED"],[_e.UPC_A,"UPC_A"],[_e.UPC_E,"UPC_E"],[_e.UPC_EAN_EXTENSION,"UPC_EAN_EXTENSION"]]),Ca;(function(a){a[a.UNKNOWN=0]="UNKNOWN",a[a.URL=1]="URL"})(Ca||(Ca={}));function Q2(a){return Object.values(_e).includes(a)}var Ai;(function(a){a[a.SCAN_TYPE_CAMERA=0]="SCAN_TYPE_CAMERA",a[a.SCAN_TYPE_FILE=1]="SCAN_TYPE_FILE"})(Ai||(Ai={}));var J2=function(){function a(){}return a.GITHUB_PROJECT_URL="https://github.com/mebjas/html5-qrcode",a.SCAN_DEFAULT_FPS=2,a.DEFAULT_DISABLE_FLIP=!1,a.DEFAULT_REMEMBER_LAST_CAMERA_USED=!0,a.DEFAULT_SUPPORTED_SCAN_TYPE=[Ai.SCAN_TYPE_CAMERA,Ai.SCAN_TYPE_FILE],a}(),Ea=function(){function a(l,i){this.format=l,this.formatName=i}return a.prototype.toString=function(){return this.formatName},a.create=function(l){if(!wa.has(l))throw"".concat(l," not in html5QrcodeSupportedFormatsTextMap");return new a(l,wa.get(l))},a}(),ya=function(){function a(){}return a.createFromText=function(l){var i={text:l};return{decodedText:l,result:i}},a.createFromQrcodeResult=function(l){return{decodedText:l.text,result:l}},a}(),Ao;(function(a){a[a.UNKWOWN_ERROR=0]="UNKWOWN_ERROR",a[a.IMPLEMENTATION_ERROR=1]="IMPLEMENTATION_ERROR",a[a.NO_CODE_FOUND_ERROR=2]="NO_CODE_FOUND_ERROR"})(Ao||(Ao={}));var em=function(){function a(){}return a.createFrom=function(l){return{errorMessage:l,type:Ao.UNKWOWN_ERROR}},a}(),tm=function(){function a(l){this.verbose=l}return a.prototype.log=function(l){this.verbose&&console.log(l)},a.prototype.warn=function(l){this.verbose&&console.warn(l)},a.prototype.logError=function(l,i){(this.verbose||i===!0)&&console.error(l)},a.prototype.logErrors=function(l){if(l.length===0)throw"Logger#logError called without arguments";this.verbose&&console.error(l)},a}();function Un(a){return typeof a>"u"||a===null}var Er=function(){function a(){}return a.codeParseError=function(l){return"QR code parse error, error = ".concat(l)},a.errorGettingUserMedia=function(l){return"Error getting userMedia, error = ".concat(l)},a.onlyDeviceSupportedError=function(){return"The device doesn't support navigator.mediaDevices , only supported cameraIdOrConfig in this case is deviceId parameter (string)."},a.cameraStreamingNotSupported=function(){return"Camera streaming not supported by the browser."},a.unableToQuerySupportedDevices=function(){return"Unable to query supported devices, unknown error."},a.insecureContextCameraQueryError=function(){return"Camera access is only supported in secure context like https or localhost."},a.scannerPaused=function(){return"Scanner paused"},a}(),ba=function(){function a(){}return a.isMediaStreamConstraintsValid=function(l,i){if(typeof l!="object"){var s=typeof l;return i.logError("videoConstraints should be of type object, the "+"object passed is of type ".concat(s,"."),!0),!1}for(var u=["autoGainControl","channelCount","echoCancellation","latency","noiseSuppression","sampleRate","sampleSize","volume"],f=new Set(u),m=Object.keys(l),p=0,_=m;p<_.length;p++){var x=_[p];if(f.has(x))return i.logError("".concat(x," is not supported videoConstaints."),!0),!1}return!0},a}(),So={exports:{}};(function(a,l){(function(i,s){s(l)})(_r,function(i){function s(b){return b==null}var u=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(b,e){b.__proto__=e}||function(b,e){for(var t in e)e.hasOwnProperty(t)&&(b[t]=e[t])};function f(b,e){u(b,e);function t(){this.constructor=b}b.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}function m(b,e){var t=Object.setPrototypeOf;t?t(b,e):b.__proto__=e}function p(b,e){e===void 0&&(e=b.constructor);var t=Error.captureStackTrace;t&&t(b,e)}var _=function(b){f(e,b);function e(t){var n=this.constructor,o=b.call(this,t)||this;return Object.defineProperty(o,"name",{value:n.name,enumerable:!1}),m(o,n.prototype),p(o),o}return e}(Error);class x extends _{constructor(e=void 0){super(e),this.message=e}getKind(){return this.constructor.kind}}x.kind="Exception";class C extends x{}C.kind="ArgumentException";class y extends x{}y.kind="IllegalArgumentException";class I{constructor(e){if(this.binarizer=e,e===null)throw new y("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,o){const c=this.binarizer.getLuminanceSource().crop(e,t,n,o);return new I(this.binarizer.createBinarizer(c))}isRotateSupported(){return this.binarizer.getLuminanceSource().isRotateSupported()}rotateCounterClockwise(){const e=this.binarizer.getLuminanceSource().rotateCounterClockwise();return new I(this.binarizer.createBinarizer(e))}rotateCounterClockwise45(){const e=this.binarizer.getLuminanceSource().rotateCounterClockwise45();return new I(this.binarizer.createBinarizer(e))}toString(){try{return this.getBlackMatrix().toString()}catch{return""}}}class O extends x{static getChecksumInstance(){return new O}}O.kind="ChecksumException";class T{constructor(e){this.source=e}getLuminanceSource(){return this.source}getWidth(){return this.source.getWidth()}getHeight(){return this.source.getHeight()}}class D{static arraycopy(e,t,n,o,c){for(;c--;)n[o++]=e[t++]}static currentTimeMillis(){return Date.now()}}class k extends x{}k.kind="IndexOutOfBoundsException";class P extends k{constructor(e=void 0,t=void 0){super(t),this.index=e,this.message=t}}P.kind="ArrayIndexOutOfBoundsException";class M{static fill(e,t){for(let n=0,o=e.length;n<o;n++)e[n]=t}static fillWithin(e,t,n,o){M.rangeCheck(e.length,t,n);for(let c=t;c<n;c++)e[c]=o}static rangeCheck(e,t,n){if(t>n)throw new y("fromIndex("+t+") > toIndex("+n+")");if(t<0)throw new P(t);if(n>e)throw new P(n)}static asList(...e){return e}static create(e,t,n){return Array.from({length:e}).map(c=>Array.from({length:t}).fill(n))}static createInt32Array(e,t,n){return Array.from({length:e}).map(c=>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,o=e.length;n<o;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 o=n-t,c=new Int32Array(o);return D.arraycopy(e,t,c,0,o),c}static binarySearch(e,t,n){n===void 0&&(n=M.numberComparator);let o=0,c=e.length-1;for(;o<=c;){const d=c+o>>1,h=n(t,e[d]);if(h>0)o=d+1;else if(h<0)c=d-1;else return d}return-o-1}static numberComparator(e,t){return e-t}}class v{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)}}v.MIN_VALUE_32_BITS=-2147483648,v.MAX_VALUE=Number.MAX_SAFE_INTEGER;class W{constructor(e,t){e===void 0?(this.size=0,this.bits=new Int32Array(1)):(this.size=e,t==null?this.bits=W.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=W.makeArray(e);D.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 o=Math.floor(e/32),c=n[o];c&=~((1<<(e&31))-1);const d=n.length;for(;c===0;){if(++o===d)return t;c=n[o]}const h=o*32+v.numberOfTrailingZeros(c);return h>t?t:h}getNextUnset(e){const t=this.size;if(e>=t)return t;const n=this.bits;let o=Math.floor(e/32),c=~n[o];c&=~((1<<(e&31))-1);const d=n.length;for(;c===0;){if(++o===d)return t;c=~n[o]}const h=o*32+v.numberOfTrailingZeros(c);return h>t?t:h}setBulk(e,t){this.bits[Math.floor(e/32)]=t}setRange(e,t){if(t<e||e<0||t>this.size)throw new y;if(t===e)return;t--;const n=Math.floor(e/32),o=Math.floor(t/32),c=this.bits;for(let d=n;d<=o;d++){const h=d>n?0:e&31,w=(2<<(d<o?31:t&31))-(1<<h);c[d]|=w}}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 y;if(t===e)return!0;t--;const o=Math.floor(e/32),c=Math.floor(t/32),d=this.bits;for(let h=o;h<=c;h++){const g=h>o?0:e&31,E=(2<<(h<c?31:t&31))-(1<<g)&4294967295;if((d[h]&E)!==(n?E: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 y("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 y("Sizes don't match");const t=this.bits;for(let n=0,o=t.length;n<o;n++)t[n]^=e.bits[n]}toBytes(e,t,n,o){for(let c=0;c<o;c++){let d=0;for(let h=0;h<8;h++)this.get(e)&&(d|=1<<7-h),e++;t[n+c]=d}}getBitArray(){return this.bits}reverse(){const e=new Int32Array(this.bits.length),t=Math.floor((this.size-1)/32),n=t+1,o=this.bits;for(let c=0;c<n;c++){let d=o[c];d=d>>1&1431655765|(d&1431655765)<<1,d=d>>2&858993459|(d&858993459)<<2,d=d>>4&252645135|(d&252645135)<<4,d=d>>8&16711935|(d&16711935)<<8,d=d>>16&65535|(d&65535)<<16,e[t-c]=d}if(this.size!==n*32){const c=n*32-this.size;let d=e[0]>>>c;for(let h=1;h<n;h++){const g=e[h];d|=g<<32-c,e[h-1]=d,d=g>>>c}e[n-1]=d}this.bits=e}static makeArray(e){return new Int32Array(Math.floor((e+31)/32))}equals(e){if(!(e instanceof W))return!1;const t=e;return this.size===t.size&&M.equals(this.bits,t.bits)}hashCode(){return 31*this.size+M.hashCode(this.bits)}toString(){let e="";for(let t=0,n=this.size;t<n;t++)t&7||(e+=" "),e+=this.get(t)?"X":".";return e}clone(){return new W(this.size,this.bits.slice())}}var X;(function(b){b[b.OTHER=0]="OTHER",b[b.PURE_BARCODE=1]="PURE_BARCODE",b[b.POSSIBLE_FORMATS=2]="POSSIBLE_FORMATS",b[b.TRY_HARDER=3]="TRY_HARDER",b[b.CHARACTER_SET=4]="CHARACTER_SET",b[b.ALLOWED_LENGTHS=5]="ALLOWED_LENGTHS",b[b.ASSUME_CODE_39_CHECK_DIGIT=6]="ASSUME_CODE_39_CHECK_DIGIT",b[b.ASSUME_GS1=7]="ASSUME_GS1",b[b.RETURN_CODABAR_START_END=8]="RETURN_CODABAR_START_END",b[b.NEED_RESULT_POINT_CALLBACK=9]="NEED_RESULT_POINT_CALLBACK",b[b.ALLOWED_EAN_EXTENSIONS=10]="ALLOWED_EAN_EXTENSIONS"})(X||(X={}));var Z=X;class F extends x{static getFormatInstance(){return new F}}F.kind="FormatException";var L;(function(b){b[b.Cp437=0]="Cp437",b[b.ISO8859_1=1]="ISO8859_1",b[b.ISO8859_2=2]="ISO8859_2",b[b.ISO8859_3=3]="ISO8859_3",b[b.ISO8859_4=4]="ISO8859_4",b[b.ISO8859_5=5]="ISO8859_5",b[b.ISO8859_6=6]="ISO8859_6",b[b.ISO8859_7=7]="ISO8859_7",b[b.ISO8859_8=8]="ISO8859_8",b[b.ISO8859_9=9]="ISO8859_9",b[b.ISO8859_10=10]="ISO8859_10",b[b.ISO8859_11=11]="ISO8859_11",b[b.ISO8859_13=12]="ISO8859_13",b[b.ISO8859_14=13]="ISO8859_14",b[b.ISO8859_15=14]="ISO8859_15",b[b.ISO8859_16=15]="ISO8859_16",b[b.SJIS=16]="SJIS",b[b.Cp1250=17]="Cp1250",b[b.Cp1251=18]="Cp1251",b[b.Cp1252=19]="Cp1252",b[b.Cp1256=20]="Cp1256",b[b.UnicodeBigUnmarked=21]="UnicodeBigUnmarked",b[b.UTF8=22]="UTF8",b[b.ASCII=23]="ASCII",b[b.Big5=24]="Big5",b[b.GB18030=25]="GB18030",b[b.EUC_KR=26]="EUC_KR"})(L||(L={}));class V{constructor(e,t,n,...o){this.valueIdentifier=e,this.name=n,typeof t=="number"?this.values=Int32Array.from([t]):this.values=t,this.otherEncodingNames=o,V.VALUE_IDENTIFIER_TO_ECI.set(e,this),V.NAME_TO_ECI.set(n,this);const c=this.values;for(let d=0,h=c.length;d!==h;d++){const g=c[d];V.VALUES_TO_ECI.set(g,this)}for(const d of o)V.NAME_TO_ECI.set(d,this)}getValueIdentifier(){return this.valueIdentifier}getName(){return this.name}getValue(){return this.values[0]}static getCharacterSetECIByValue(e){if(e<0||e>=900)throw new F("incorect value");const t=V.VALUES_TO_ECI.get(e);if(t===void 0)throw new F("incorect value");return t}static getCharacterSetECIByName(e){const t=V.NAME_TO_ECI.get(e);if(t===void 0)throw new F("incorect value");return t}equals(e){if(!(e instanceof V))return!1;const t=e;return this.getName()===t.getName()}}V.VALUE_IDENTIFIER_TO_ECI=new Map,V.VALUES_TO_ECI=new Map,V.NAME_TO_ECI=new Map,V.Cp437=new V(L.Cp437,Int32Array.from([0,2]),"Cp437"),V.ISO8859_1=new V(L.ISO8859_1,Int32Array.from([1,3]),"ISO-8859-1","ISO88591","ISO8859_1"),V.ISO8859_2=new V(L.ISO8859_2,4,"ISO-8859-2","ISO88592","ISO8859_2"),V.ISO8859_3=new V(L.ISO8859_3,5,"ISO-8859-3","ISO88593","ISO8859_3"),V.ISO8859_4=new V(L.ISO8859_4,6,"ISO-8859-4","ISO88594","ISO8859_4"),V.ISO8859_5=new V(L.ISO8859_5,7,"ISO-8859-5","ISO88595","ISO8859_5"),V.ISO8859_6=new V(L.ISO8859_6,8,"ISO-8859-6","ISO88596","ISO8859_6"),V.ISO8859_7=new V(L.ISO8859_7,9,"ISO-8859-7","ISO88597","ISO8859_7"),V.ISO8859_8=new V(L.ISO8859_8,10,"ISO-8859-8","ISO88598","ISO8859_8"),V.ISO8859_9=new V(L.ISO8859_9,11,"ISO-8859-9","ISO88599","ISO8859_9"),V.ISO8859_10=new V(L.ISO8859_10,12,"ISO-8859-10","ISO885910","ISO8859_10"),V.ISO8859_11=new V(L.ISO8859_11,13,"ISO-8859-11","ISO885911","ISO8859_11"),V.ISO8859_13=new V(L.ISO8859_13,15,"ISO-8859-13","ISO885913","ISO8859_13"),V.ISO8859_14=new V(L.ISO8859_14,16,"ISO-8859-14","ISO885914","ISO8859_14"),V.ISO8859_15=new V(L.ISO8859_15,17,"ISO-8859-15","ISO885915","ISO8859_15"),V.ISO8859_16=new V(L.ISO8859_16,18,"ISO-8859-16","ISO885916","ISO8859_16"),V.SJIS=new V(L.SJIS,20,"SJIS","Shift_JIS"),V.Cp1250=new V(L.Cp1250,21,"Cp1250","windows-1250"),V.Cp1251=new V(L.Cp1251,22,"Cp1251","windows-1251"),V.Cp1252=new V(L.Cp1252,23,"Cp1252","windows-1252"),V.Cp1256=new V(L.Cp1256,24,"Cp1256","windows-1256"),V.UnicodeBigUnmarked=new V(L.UnicodeBigUnmarked,25,"UnicodeBigUnmarked","UTF-16BE","UnicodeBig"),V.UTF8=new V(L.UTF8,26,"UTF8","UTF-8"),V.ASCII=new V(L.ASCII,Int32Array.from([27,170]),"ASCII","US-ASCII"),V.Big5=new V(L.Big5,28,"Big5"),V.GB18030=new V(L.GB18030,29,"GB18030","GB2312","EUC_CN","GBK"),V.EUC_KR=new V(L.EUC_KR,30,"EUC_KR","EUC-KR");class ie extends x{}ie.kind="UnsupportedOperationException";class K{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!K.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 V?e:V.getCharacterSetECIByName(e)}static decodeFallback(e,t){const n=this.encodingCharacterSet(t);if(K.isDecodeFallbackSupported(n)){let o="";for(let c=0,d=e.length;c<d;c++){let h=e[c].toString(16);h.length<2&&(h="0"+h),o+="%"+h}return decodeURIComponent(o)}if(n.equals(V.UnicodeBigUnmarked))return String.fromCharCode.apply(null,new Uint16Array(e.buffer));throw new ie(`Encoding ${this.encodingName(t)} not supported by fallback.`)}static isDecodeFallbackSupported(e){return e.equals(V.UTF8)||e.equals(V.ISO8859_1)||e.equals(V.ASCII)}static encodeFallback(e){const n=btoa(unescape(encodeURIComponent(e))).split(""),o=[];for(let c=0;c<n.length;c++)o.push(n[c].charCodeAt(0));return new Uint8Array(o)}}class ee{static castAsNonUtf8Char(e,t=null){const n=t?t.getName():this.ISO88591;return K.decode(new Uint8Array([e]),n)}static guessEncoding(e,t){if(t!=null&&t.get(Z.CHARACTER_SET)!==void 0)return t.get(Z.CHARACTER_SET).toString();const n=e.length;let o=!0,c=!0,d=!0,h=0,g=0,w=0,E=0,A=0,S=0,B=0,U=0,H=0,Y=0,oe=0;const ue=e.length>3&&e[0]===239&&e[1]===187&&e[2]===191;for(let he=0;he<n&&(o||c||d);he++){const de=e[he]&255;d&&(h>0?de&128?h--:d=!1:de&128&&(de&64?(h++,de&32?(h++,de&16?(h++,de&8?d=!1:E++):w++):g++):d=!1)),o&&(de>127&&de<160?o=!1:de>159&&(de<192||de===215||de===247)&&oe++),c&&(A>0?de<64||de===127||de>252?c=!1:A--:de===128||de===160||de>239?c=!1:de>160&&de<224?(S++,U=0,B++,B>H&&(H=B)):de>127?(A++,B=0,U++,U>Y&&(Y=U)):(B=0,U=0))}return d&&h>0&&(d=!1),c&&A>0&&(c=!1),d&&(ue||g+w+E>0)?ee.UTF8:c&&(ee.ASSUME_SHIFT_JIS||H>=3||Y>=3)?ee.SHIFT_JIS:o&&c?H===2&&S===2||oe*10>=n?ee.SHIFT_JIS:ee.ISO88591:o?ee.ISO88591:c?ee.SHIFT_JIS:d?ee.UTF8:ee.PLATFORM_DEFAULT_ENCODING}static format(e,...t){let n=-1;function o(d,h,g,w,E,A){if(d==="%%")return"%";if(t[++n]===void 0)return;d=w?parseInt(w.substr(1)):void 0;let S=E?parseInt(E.substr(1)):void 0,B;switch(A){case"s":B=t[n];break;case"c":B=t[n][0];break;case"f":B=parseFloat(t[n]).toFixed(d);break;case"p":B=parseFloat(t[n]).toPrecision(d);break;case"e":B=parseFloat(t[n]).toExponential(d);break;case"x":B=parseInt(t[n]).toString(S||16);break;case"d":B=parseFloat(parseInt(t[n],S||10).toPrecision(d)).toFixed(0);break}B=typeof B=="object"?JSON.stringify(B):(+B).toString(S);let U=parseInt(g),H=g&&g[0]+""=="0"?"0":" ";for(;B.length<U;)B=h!==void 0?B+H:H+B;return B}let c=/%(-)?(0?[0-9]+)?([.][0-9]+)?([#][0-9]+)?([scfpexd%])/g;return e.replace(c,o)}static getBytes(e,t){return K.encode(e,t)}static getCharCode(e,t=0){return e.charCodeAt(t)}static getCharAt(e){return String.fromCharCode(e)}}ee.SHIFT_JIS=V.SJIS.getName(),ee.GB2312="GB2312",ee.ISO88591=V.ISO8859_1.getName(),ee.EUC_JP="EUC_JP",ee.UTF8=V.UTF8.getName(),ee.PLATFORM_DEFAULT_ENCODING=ee.UTF8,ee.ASSUME_SHIFT_JIS=!1;class G{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+=ee.castAsNonUtf8Char(e,this.encoding):this.value+=String.fromCharCode(e),this}appendChars(e,t,n){for(let o=t;t<t+n;o++)this.append(e[o]);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 z{constructor(e,t,n,o){if(this.width=e,this.height=t,this.rowSize=n,this.bits=o,t==null&&(t=e),this.height=t,e<1||t<1)throw new y("Both dimensions must be greater than 0");n==null&&(n=Math.floor((e+31)/32)),this.rowSize=n,o==null&&(this.bits=new Int32Array(this.rowSize*this.height))}static parseFromBooleanArray(e){const t=e.length,n=e[0].length,o=new z(n,t);for(let c=0;c<t;c++){const d=e[c];for(let h=0;h<n;h++)d[h]&&o.set(h,c)}return o}static parseFromString(e,t,n){if(e===null)throw new y("stringRepresentation cannot be null");const o=new Array(e.length);let c=0,d=0,h=-1,g=0,w=0;for(;w<e.length;)if(e.charAt(w)===`
12
- `||e.charAt(w)==="\r"){if(c>d){if(h===-1)h=c-d;else if(c-d!==h)throw new y("row lengths do not match");d=c,g++}w++}else if(e.substring(w,w+t.length)===t)w+=t.length,o[c]=!0,c++;else if(e.substring(w,w+n.length)===n)w+=n.length,o[c]=!1,c++;else throw new y("illegal character encountered: "+e.substring(w));if(c>d){if(h===-1)h=c-d;else if(c-d!==h)throw new y("row lengths do not match");g++}const E=new z(h,g);for(let A=0;A<c;A++)o[A]&&E.set(Math.floor(A%h),Math.floor(A/h));return E}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 y("input matrix dimensions do not match");const t=new W(Math.floor(this.width/32)+1),n=this.rowSize,o=this.bits;for(let c=0,d=this.height;c<d;c++){const h=c*n,g=e.getRow(c,t).getBitArray();for(let w=0;w<n;w++)o[h+w]^=g[w]}}clear(){const e=this.bits,t=e.length;for(let n=0;n<t;n++)e[n]=0}setRegion(e,t,n,o){if(t<0||e<0)throw new y("Left and top must be nonnegative");if(o<1||n<1)throw new y("Height and width must be at least 1");const c=e+n,d=t+o;if(d>this.height||c>this.width)throw new y("The region must fit inside the matrix");const h=this.rowSize,g=this.bits;for(let w=t;w<d;w++){const E=w*h;for(let A=e;A<c;A++)g[E+Math.floor(A/32)]|=1<<(A&31)&4294967295}}getRow(e,t){t==null||t.getSize()<this.width?t=new W(this.width):t.clear();const n=this.rowSize,o=this.bits,c=e*n;for(let d=0;d<n;d++)t.setBulk(d*32,o[c+d]);return t}setRow(e,t){D.arraycopy(t.getBitArray(),0,this.bits,e*this.rowSize,this.rowSize)}rotate180(){const e=this.getWidth(),t=this.getHeight();let n=new W(e),o=new W(e);for(let c=0,d=Math.floor((t+1)/2);c<d;c++)n=this.getRow(c,n),o=this.getRow(t-1-c,o),n.reverse(),o.reverse(),this.setRow(c,o),this.setRow(t-1-c,n)}getEnclosingRectangle(){const e=this.width,t=this.height,n=this.rowSize,o=this.bits;let c=e,d=t,h=-1,g=-1;for(let w=0;w<t;w++)for(let E=0;E<n;E++){const A=o[w*n+E];if(A!==0){if(w<d&&(d=w),w>g&&(g=w),E*32<c){let S=0;for(;!(A<<31-S&4294967295);)S++;E*32+S<c&&(c=E*32+S)}if(E*32+31>h){let S=31;for(;!(A>>>S);)S--;E*32+S>h&&(h=E*32+S)}}}return h<c||g<d?null:Int32Array.from([c,d,h-c+1,g-d+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 o=n/e;let c=n%e*32;const d=t[n];let h=0;for(;!(d<<31-h&4294967295);)h++;return c+=h,Int32Array.from([c,o])}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 o=Math.floor(n/e);let c=Math.floor(n%e)*32;const d=t[n];let h=31;for(;!(d>>>h);)h--;return c+=h,Int32Array.from([c,o])}getWidth(){return this.width}getHeight(){return this.height}getRowSize(){return this.rowSize}equals(e){if(!(e instanceof z))return!1;const t=e;return this.width===t.width&&this.height===t.height&&this.rowSize===t.rowSize&&M.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+M.hashCode(this.bits),e}toString(e="X ",t=" ",n=`
13
- `){return this.buildToString(e,t,n)}buildToString(e,t,n){let o=new G;for(let c=0,d=this.height;c<d;c++){for(let h=0,g=this.width;h<g;h++)o.append(this.get(h,c)?e:t);o.append(n)}return o.toString()}clone(){return new z(this.width,this.height,this.rowSize,this.bits.slice())}}class N extends x{static getNotFoundInstance(){return new N}}N.kind="NotFoundException";class $ extends T{constructor(e){super(e),this.luminances=$.EMPTY,this.buckets=new Int32Array($.LUMINANCE_BUCKETS)}getBlackRow(e,t){const n=this.getLuminanceSource(),o=n.getWidth();t==null||t.getSize()<o?t=new W(o):t.clear(),this.initArrays(o);const c=n.getRow(e,this.luminances),d=this.buckets;for(let g=0;g<o;g++)d[(c[g]&255)>>$.LUMINANCE_SHIFT]++;const h=$.estimateBlackPoint(d);if(o<3)for(let g=0;g<o;g++)(c[g]&255)<h&&t.set(g);else{let g=c[0]&255,w=c[1]&255;for(let E=1;E<o-1;E++){const A=c[E+1]&255;(w*4-g-A)/2<h&&t.set(E),g=w,w=A}}return t}getBlackMatrix(){const e=this.getLuminanceSource(),t=e.getWidth(),n=e.getHeight(),o=new z(t,n);this.initArrays(t);const c=this.buckets;for(let g=1;g<5;g++){const w=Math.floor(n*g/5),E=e.getRow(w,this.luminances),A=Math.floor(t*4/5);for(let S=Math.floor(t/5);S<A;S++){const B=E[S]&255;c[B>>$.LUMINANCE_SHIFT]++}}const d=$.estimateBlackPoint(c),h=e.getMatrix();for(let g=0;g<n;g++){const w=g*t;for(let E=0;E<t;E++)(h[w+E]&255)<d&&o.set(E,g)}return o}createBinarizer(e){return new $(e)}initArrays(e){this.luminances.length<e&&(this.luminances=new Uint8ClampedArray(e));const t=this.buckets;for(let n=0;n<$.LUMINANCE_BUCKETS;n++)t[n]=0}static estimateBlackPoint(e){const t=e.length;let n=0,o=0,c=0;for(let E=0;E<t;E++)e[E]>c&&(o=E,c=e[E]),e[E]>n&&(n=e[E]);let d=0,h=0;for(let E=0;E<t;E++){const A=E-o,S=e[E]*A*A;S>h&&(d=E,h=S)}if(o>d){const E=o;o=d,d=E}if(d-o<=t/16)throw new N;let g=d-1,w=-1;for(let E=d-1;E>o;E--){const A=E-o,S=A*A*(d-E)*(n-e[E]);S>w&&(g=E,w=S)}return g<<$.LUMINANCE_SHIFT}}$.LUMINANCE_BITS=5,$.LUMINANCE_SHIFT=8-$.LUMINANCE_BITS,$.LUMINANCE_BUCKETS=1<<$.LUMINANCE_BITS,$.EMPTY=Uint8ClampedArray.from([0]);class q extends ${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>=q.MINIMUM_DIMENSION&&n>=q.MINIMUM_DIMENSION){const o=e.getMatrix();let c=t>>q.BLOCK_SIZE_POWER;t&q.BLOCK_SIZE_MASK&&c++;let d=n>>q.BLOCK_SIZE_POWER;n&q.BLOCK_SIZE_MASK&&d++;const h=q.calculateBlackPoints(o,c,d,t,n),g=new z(t,n);q.calculateThresholdForBlock(o,c,d,t,n,h,g),this.matrix=g}else this.matrix=super.getBlackMatrix();return this.matrix}createBinarizer(e){return new q(e)}static calculateThresholdForBlock(e,t,n,o,c,d,h){const g=c-q.BLOCK_SIZE,w=o-q.BLOCK_SIZE;for(let E=0;E<n;E++){let A=E<<q.BLOCK_SIZE_POWER;A>g&&(A=g);const S=q.cap(E,2,n-3);for(let B=0;B<t;B++){let U=B<<q.BLOCK_SIZE_POWER;U>w&&(U=w);const H=q.cap(B,2,t-3);let Y=0;for(let ue=-2;ue<=2;ue++){const he=d[S+ue];Y+=he[H-2]+he[H-1]+he[H]+he[H+1]+he[H+2]}const oe=Y/25;q.thresholdBlock(e,U,A,oe,o,h)}}}static cap(e,t,n){return e<t?t:e>n?n:e}static thresholdBlock(e,t,n,o,c,d){for(let h=0,g=n*c+t;h<q.BLOCK_SIZE;h++,g+=c)for(let w=0;w<q.BLOCK_SIZE;w++)(e[g+w]&255)<=o&&d.set(t+w,n+h)}static calculateBlackPoints(e,t,n,o,c){const d=c-q.BLOCK_SIZE,h=o-q.BLOCK_SIZE,g=new Array(n);for(let w=0;w<n;w++){g[w]=new Int32Array(t);let E=w<<q.BLOCK_SIZE_POWER;E>d&&(E=d);for(let A=0;A<t;A++){let S=A<<q.BLOCK_SIZE_POWER;S>h&&(S=h);let B=0,U=255,H=0;for(let oe=0,ue=E*o+S;oe<q.BLOCK_SIZE;oe++,ue+=o){for(let he=0;he<q.BLOCK_SIZE;he++){const de=e[ue+he]&255;B+=de,de<U&&(U=de),de>H&&(H=de)}if(H-U>q.MIN_DYNAMIC_RANGE)for(oe++,ue+=o;oe<q.BLOCK_SIZE;oe++,ue+=o)for(let he=0;he<q.BLOCK_SIZE;he++)B+=e[ue+he]&255}let Y=B>>q.BLOCK_SIZE_POWER*2;if(H-U<=q.MIN_DYNAMIC_RANGE&&(Y=U/2,w>0&&A>0)){const oe=(g[w-1][A]+2*g[w][A-1]+g[w-1][A-1])/4;U<oe&&(Y=oe)}g[w][A]=Y}}return g}}q.BLOCK_SIZE_POWER=3,q.BLOCK_SIZE=1<<q.BLOCK_SIZE_POWER,q.BLOCK_SIZE_MASK=q.BLOCK_SIZE-1,q.MINIMUM_DIMENSION=q.BLOCK_SIZE*5,q.MIN_DYNAMIC_RANGE=24;class j{constructor(e,t){this.width=e,this.height=t}getWidth(){return this.width}getHeight(){return this.height}isCropSupported(){return!1}crop(e,t,n,o){throw new ie("This luminance source does not support cropping.")}isRotateSupported(){return!1}rotateCounterClockwise(){throw new ie("This luminance source does not support rotation by 90 degrees.")}rotateCounterClockwise45(){throw new ie("This luminance source does not support rotation by 45 degrees.")}toString(){const e=new Uint8ClampedArray(this.width);let t=new G;for(let n=0;n<this.height;n++){const o=this.getRow(n,e);for(let c=0;c<this.width;c++){const d=o[c]&255;let h;d<64?h="#":d<128?h="+":d<192?h=".":h=" ",t.append(h)}t.append(`
14
- `)}return t.toString()}}class te extends j{constructor(e){super(e.getWidth(),e.getHeight()),this.delegate=e}getRow(e,t){const n=this.delegate.getRow(e,t),o=this.getWidth();for(let c=0;c<o;c++)n[c]=255-(n[c]&255);return n}getMatrix(){const e=this.delegate.getMatrix(),t=this.getWidth()*this.getHeight(),n=new Uint8ClampedArray(t);for(let o=0;o<t;o++)n[o]=255-(e[o]&255);return n}isCropSupported(){return this.delegate.isCropSupported()}crop(e,t,n,o){return new te(this.delegate.crop(e,t,n,o))}isRotateSupported(){return this.delegate.isRotateSupported()}invert(){return this.delegate}rotateCounterClockwise(){return new te(this.delegate.rotateCounterClockwise())}rotateCounterClockwise45(){return new te(this.delegate.rotateCounterClockwise45())}}class J extends j{constructor(e){super(e.width,e.height),this.canvas=e,this.tempCanvasElement=null,this.buffer=J.makeBufferFromCanvasImageData(e)}static makeBufferFromCanvasImageData(e){const t=e.getContext("2d").getImageData(0,0,e.width,e.height);return J.toGrayscaleBuffer(t.data,e.width,e.height)}static toGrayscaleBuffer(e,t,n){const o=new Uint8ClampedArray(t*n);for(let c=0,d=0,h=e.length;c<h;c+=4,d++){let g;if(e[c+3]===0)g=255;else{const E=e[c],A=e[c+1],S=e[c+2];g=306*E+601*A+117*S+512>>10}o[d]=g}return o}getRow(e,t){if(e<0||e>=this.getHeight())throw new y("Requested row is outside the image: "+e);const n=this.getWidth(),o=e*n;return t===null?t=this.buffer.slice(o,o+n):(t.length<n&&(t=new Uint8ClampedArray(n)),t.set(this.buffer.slice(o,o+n))),t}getMatrix(){return this.buffer}isCropSupported(){return!0}crop(e,t,n,o){return super.crop(e,t,n,o),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"),o=e*J.DEGREE_TO_RADIANS,c=this.canvas.width,d=this.canvas.height,h=Math.ceil(Math.abs(Math.cos(o))*c+Math.abs(Math.sin(o))*d),g=Math.ceil(Math.abs(Math.sin(o))*c+Math.abs(Math.cos(o))*d);return t.width=h,t.height=g,n.translate(h/2,g/2),n.rotate(o),n.drawImage(this.canvas,c/-2,d/-2),this.buffer=J.makeBufferFromCanvasImageData(t),this}invert(){return new te(this)}}J.DEGREE_TO_RADIANS=Math.PI/180;class se{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 ce=(globalThis||_r||self||window||void 0)&&(globalThis||_r||self||window||void 0).__awaiter||function(b,e,t,n){function o(c){return c instanceof t?c:new t(function(d){d(c)})}return new(t||(t=Promise))(function(c,d){function h(E){try{w(n.next(E))}catch(A){d(A)}}function g(E){try{w(n.throw(E))}catch(A){d(A)}}function w(E){E.done?c(E.value):o(E.value).then(h,g)}w((n=n.apply(b,e||[])).next())})};class we{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 ce(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 o=n.kind==="video"?"videoinput":n.kind;if(o!=="videoinput")continue;const c=n.deviceId||n.id,d=n.label||`Video device ${t.length+1}`,h=n.groupId,g={deviceId:c,label:d,kind:o,groupId:h};t.push(g)}return t})}getVideoInputDevices(){return ce(this,void 0,void 0,function*(){return(yield this.listVideoInputDevices()).map(t=>new se(t.deviceId,t.label))})}findDeviceById(e){return ce(this,void 0,void 0,function*(){const t=yield this.listVideoInputDevices();return t?t.find(n=>n.deviceId===e):null})}decodeFromInputVideoDevice(e,t){return ce(this,void 0,void 0,function*(){return yield this.decodeOnceFromVideoDevice(e,t)})}decodeOnceFromVideoDevice(e,t){return ce(this,void 0,void 0,function*(){this.reset();let n;e?n={deviceId:{exact:e}}:n={facingMode:"environment"};const o={video:n};return yield this.decodeOnceFromConstraints(o,t)})}decodeOnceFromConstraints(e,t){return ce(this,void 0,void 0,function*(){const n=yield navigator.mediaDevices.getUserMedia(e);return yield this.decodeOnceFromStream(n,t)})}decodeOnceFromStream(e,t){return ce(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 ce(this,void 0,void 0,function*(){return yield this.decodeFromVideoDevice(e,t,n)})}decodeFromVideoDevice(e,t,n){return ce(this,void 0,void 0,function*(){let o;e?o={deviceId:{exact:e}}:o={facingMode:"environment"};const c={video:o};return yield this.decodeFromConstraints(c,t,n)})}decodeFromConstraints(e,t,n){return ce(this,void 0,void 0,function*(){const o=yield navigator.mediaDevices.getUserMedia(e);return yield this.decodeFromStream(o,t,n)})}decodeFromStream(e,t,n){return ce(this,void 0,void 0,function*(){this.reset();const o=yield this.attachStreamToVideo(e,t);return yield this.decodeContinuously(o,n)})}stopAsyncDecode(){this._stopAsyncDecode=!0}stopContinuousDecode(){this._stopContinuousDecode=!0}attachStreamToVideo(e,t){return ce(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 ce(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 C(`element with id '${e}' not found`);if(n.nodeName.toLowerCase()!==t.toLowerCase())throw new C(`element with id '${e}' must be an ${t} element`);return n}decodeFromImage(e,t){if(!e&&!t)throw new C("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 C("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 C("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 C("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 C("A video element must be provided.");this.reset();const t=this.prepareVideoElement(e);return this.videoElement=t,t}decodeFromImageUrl(e){if(!e)throw new C("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 C("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 C("An URL must be provided.");this.reset();const n=this.prepareVideoElement(),o=this.decodeFromVideoElementContinuously(n,t);return n.src=e,o}_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 ce(this,void 0,void 0,function*(){return yield this.playVideoOnLoadAsync(e),yield this.decodeOnce(e)})}_decodeOnLoadVideoContinuously(e,t){return ce(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 o=(c,d)=>{if(this._stopAsyncDecode){d(new N("Video stream has ended before any code could be detected.")),this._stopAsyncDecode=void 0;return}try{const h=this.decode(e);c(h)}catch(h){const g=t&&h instanceof N,E=(h instanceof O||h instanceof F)&&n;if(g||E)return setTimeout(o,this._timeBetweenDecodingAttempts,c,d);d(h)}};return new Promise((c,d)=>o(c,d))}decodeContinuously(e,t){this._stopContinuousDecode=!1;const n=()=>{if(this._stopContinuousDecode){this._stopContinuousDecode=void 0;return}try{const o=this.decode(e);t(o,null),setTimeout(n,this.timeBetweenScansMillis)}catch(o){t(null,o);const c=o instanceof O||o instanceof F,d=o instanceof N;(c||d)&&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 J(t),o=new q(n);return new I(o)}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,o;return typeof e<"u"&&(e instanceof HTMLVideoElement?(n=e.videoWidth,o=e.videoHeight):e instanceof HTMLImageElement&&(n=e.naturalWidth||e.width,o=e.naturalHeight||e.height)),t.style.width=n+"px",t.style.height=o+"px",t.width=n,t.height=o,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 Ce{constructor(e,t,n=t==null?0:8*t.length,o,c,d=D.currentTimeMillis()){this.text=e,this.rawBytes=t,this.numBits=n,this.resultPoints=o,this.format=c,this.timestamp=d,this.text=e,this.rawBytes=t,n==null?this.numBits=t==null?0:8*t.length:this.numBits=n,this.resultPoints=o,this.format=c,this.resultMetadata=null,d==null?this.timestamp=D.currentTimeMillis():this.timestamp=d}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);D.arraycopy(t,0,n,0,t.length),D.arraycopy(e,0,n,t.length,e.length),this.resultPoints=n}}getTimestamp(){return this.timestamp}toString(){return this.text}}var Ae;(function(b){b[b.AZTEC=0]="AZTEC",b[b.CODABAR=1]="CODABAR",b[b.CODE_39=2]="CODE_39",b[b.CODE_93=3]="CODE_93",b[b.CODE_128=4]="CODE_128",b[b.DATA_MATRIX=5]="DATA_MATRIX",b[b.EAN_8=6]="EAN_8",b[b.EAN_13=7]="EAN_13",b[b.ITF=8]="ITF",b[b.MAXICODE=9]="MAXICODE",b[b.PDF_417=10]="PDF_417",b[b.QR_CODE=11]="QR_CODE",b[b.RSS_14=12]="RSS_14",b[b.RSS_EXPANDED=13]="RSS_EXPANDED",b[b.UPC_A=14]="UPC_A",b[b.UPC_E=15]="UPC_E",b[b.UPC_EAN_EXTENSION=16]="UPC_EAN_EXTENSION"})(Ae||(Ae={}));var ge=Ae,ht;(function(b){b[b.OTHER=0]="OTHER",b[b.ORIENTATION=1]="ORIENTATION",b[b.BYTE_SEGMENTS=2]="BYTE_SEGMENTS",b[b.ERROR_CORRECTION_LEVEL=3]="ERROR_CORRECTION_LEVEL",b[b.ISSUE_NUMBER=4]="ISSUE_NUMBER",b[b.SUGGESTED_PRICE=5]="SUGGESTED_PRICE",b[b.POSSIBLE_COUNTRY=6]="POSSIBLE_COUNTRY",b[b.UPC_EAN_EXTENSION=7]="UPC_EAN_EXTENSION",b[b.PDF417_EXTRA_METADATA=8]="PDF417_EXTRA_METADATA",b[b.STRUCTURED_APPEND_SEQUENCE=9]="STRUCTURED_APPEND_SEQUENCE",b[b.STRUCTURED_APPEND_PARITY=10]="STRUCTURED_APPEND_PARITY"})(ht||(ht={}));var be=ht;class et{constructor(e,t,n,o,c=-1,d=-1){this.rawBytes=e,this.text=t,this.byteSegments=n,this.ecLevel=o,this.structuredAppendSequenceNumber=c,this.structuredAppendParity=d,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 rt{exp(e){return this.expTable[e]}log(e){if(e===0)throw new y;return this.logTable[e]}static addOrSubtract(e,t){return e^t}}class Ve{constructor(e,t){if(t.length===0)throw new y;this.field=e;const n=t.length;if(n>1&&t[0]===0){let o=1;for(;o<n&&t[o]===0;)o++;o===n?this.coefficients=Int32Array.from([0]):(this.coefficients=new Int32Array(n-o),D.arraycopy(t,o,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 d=0,h=t.length;d!==h;d++){const g=t[d];n=rt.addOrSubtract(n,g)}return n}n=t[0];const o=t.length,c=this.field;for(let d=1;d<o;d++)n=rt.addOrSubtract(c.multiply(e,n),t[d]);return n}addOrSubtract(e){if(!this.field.equals(e.field))throw new y("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 d=t;t=n,n=d}let o=new Int32Array(n.length);const c=n.length-t.length;D.arraycopy(n,0,o,0,c);for(let d=c;d<n.length;d++)o[d]=rt.addOrSubtract(t[d-c],n[d]);return new Ve(this.field,o)}multiply(e){if(!this.field.equals(e.field))throw new y("GenericGFPolys do not have same GenericGF field");if(this.isZero()||e.isZero())return this.field.getZero();const t=this.coefficients,n=t.length,o=e.coefficients,c=o.length,d=new Int32Array(n+c-1),h=this.field;for(let g=0;g<n;g++){const w=t[g];for(let E=0;E<c;E++)d[g+E]=rt.addOrSubtract(d[g+E],h.multiply(w,o[E]))}return new Ve(h,d)}multiplyScalar(e){if(e===0)return this.field.getZero();if(e===1)return this;const t=this.coefficients.length,n=this.field,o=new Int32Array(t),c=this.coefficients;for(let d=0;d<t;d++)o[d]=n.multiply(c[d],e);return new Ve(n,o)}multiplyByMonomial(e,t){if(e<0)throw new y;if(t===0)return this.field.getZero();const n=this.coefficients,o=n.length,c=new Int32Array(o+e),d=this.field;for(let h=0;h<o;h++)c[h]=d.multiply(n[h],t);return new Ve(d,c)}divide(e){if(!this.field.equals(e.field))throw new y("GenericGFPolys do not have same GenericGF field");if(e.isZero())throw new y("Divide by 0");const t=this.field;let n=t.getZero(),o=this;const c=e.getCoefficient(e.getDegree()),d=t.inverse(c);for(;o.getDegree()>=e.getDegree()&&!o.isZero();){const h=o.getDegree()-e.getDegree(),g=t.multiply(o.getCoefficient(o.getDegree()),d),w=e.multiplyByMonomial(h,g),E=t.buildMonomial(h,g);n=n.addOrSubtract(E),o=o.addOrSubtract(w)}return[n,o]}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 o=this.field.log(n);o===0?e+="1":o===1?e+="a":(e+="a^",e+=o)}t!==0&&(t===1?e+="x":(e+="x^",e+=t))}}return e}}class it extends x{}it.kind="ArithmeticException";class De extends rt{constructor(e,t,n){super(),this.primitive=e,this.size=t,this.generatorBase=n;const o=new Int32Array(t);let c=1;for(let h=0;h<t;h++)o[h]=c,c*=2,c>=t&&(c^=e,c&=t-1);this.expTable=o;const d=new Int32Array(t);for(let h=0;h<t-1;h++)d[o[h]]=h;this.logTable=d,this.zero=new Ve(this,Int32Array.from([0])),this.one=new Ve(this,Int32Array.from([1]))}getZero(){return this.zero}getOne(){return this.one}buildMonomial(e,t){if(e<0)throw new y;if(t===0)return this.zero;const n=new Int32Array(e+1);return n[0]=t,new Ve(this,n)}inverse(e){if(e===0)throw new it;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"+v.toHexString(this.primitive)+","+this.size+")"}equals(e){return e===this}}De.AZTEC_DATA_12=new De(4201,4096,1),De.AZTEC_DATA_10=new De(1033,1024,1),De.AZTEC_DATA_6=new De(67,64,1),De.AZTEC_PARAM=new De(19,16,1),De.QR_CODE_FIELD_256=new De(285,256,0),De.DATA_MATRIX_FIELD_256=new De(301,256,1),De.AZTEC_DATA_8=De.DATA_MATRIX_FIELD_256,De.MAXICODE_FIELD_64=De.AZTEC_DATA_6;class Ne extends x{}Ne.kind="ReedSolomonException";class Ue extends x{}Ue.kind="IllegalStateException";class Nt{constructor(e){this.field=e}decode(e,t){const n=this.field,o=new Ve(n,e),c=new Int32Array(t);let d=!0;for(let B=0;B<t;B++){const U=o.evaluateAt(n.exp(B+n.getGeneratorBase()));c[c.length-1-B]=U,U!==0&&(d=!1)}if(d)return;const h=new Ve(n,c),g=this.runEuclideanAlgorithm(n.buildMonomial(t,1),h,t),w=g[0],E=g[1],A=this.findErrorLocations(w),S=this.findErrorMagnitudes(E,A);for(let B=0;B<A.length;B++){const U=e.length-1-n.log(A[B]);if(U<0)throw new Ne("Bad error location");e[U]=De.addOrSubtract(e[U],S[B])}}runEuclideanAlgorithm(e,t,n){if(e.getDegree()<t.getDegree()){const B=e;e=t,t=B}const o=this.field;let c=e,d=t,h=o.getZero(),g=o.getOne();for(;d.getDegree()>=(n/2|0);){let B=c,U=h;if(c=d,h=g,c.isZero())throw new Ne("r_{i-1} was zero");d=B;let H=o.getZero();const Y=c.getCoefficient(c.getDegree()),oe=o.inverse(Y);for(;d.getDegree()>=c.getDegree()&&!d.isZero();){const ue=d.getDegree()-c.getDegree(),he=o.multiply(d.getCoefficient(d.getDegree()),oe);H=H.addOrSubtract(o.buildMonomial(ue,he)),d=d.addOrSubtract(c.multiplyByMonomial(ue,he))}if(g=H.multiply(h).addOrSubtract(U),d.getDegree()>=c.getDegree())throw new Ue("Division algorithm failed to reduce polynomial?")}const w=g.getCoefficient(0);if(w===0)throw new Ne("sigmaTilde(0) was zero");const E=o.inverse(w),A=g.multiplyScalar(E),S=d.multiplyScalar(E);return[A,S]}findErrorLocations(e){const t=e.getDegree();if(t===1)return Int32Array.from([e.getCoefficient(1)]);const n=new Int32Array(t);let o=0;const c=this.field;for(let d=1;d<c.getSize()&&o<t;d++)e.evaluateAt(d)===0&&(n[o]=c.inverse(d),o++);if(o!==t)throw new Ne("Error locator degree does not match number of roots");return n}findErrorMagnitudes(e,t){const n=t.length,o=new Int32Array(n),c=this.field;for(let d=0;d<n;d++){const h=c.inverse(t[d]);let g=1;for(let w=0;w<n;w++)if(d!==w){const E=c.multiply(t[w],h),A=E&1?E&-2:E|1;g=c.multiply(g,A)}o[d]=c.multiply(e.evaluateAt(h),c.inverse(g)),c.getGeneratorBase()!==0&&(o[d]=c.multiply(o[d],h))}return o}}var ot;(function(b){b[b.UPPER=0]="UPPER",b[b.LOWER=1]="LOWER",b[b.MIXED=2]="MIXED",b[b.DIGIT=3]="DIGIT",b[b.PUNCT=4]="PUNCT",b[b.BINARY=5]="BINARY"})(ot||(ot={}));class Qe{decode(e){this.ddata=e;let t=e.getBits(),n=this.extractBits(t),o=this.correctBits(n),c=Qe.convertBoolArrayToByteArray(o),d=Qe.getEncodedData(o),h=new et(c,d,null,null);return h.setNumBits(o.length),h}static highLevelDecode(e){return this.getEncodedData(e)}static getEncodedData(e){let t=e.length,n=ot.UPPER,o=ot.UPPER,c="",d=0;for(;d<t;)if(o===ot.BINARY){if(t-d<5)break;let h=Qe.readCode(e,d,5);if(d+=5,h===0){if(t-d<11)break;h=Qe.readCode(e,d,11)+31,d+=11}for(let g=0;g<h;g++){if(t-d<8){d=t;break}const w=Qe.readCode(e,d,8);c+=ee.castAsNonUtf8Char(w),d+=8}o=n}else{let h=o===ot.DIGIT?4:5;if(t-d<h)break;let g=Qe.readCode(e,d,h);d+=h;let w=Qe.getCharacter(o,g);w.startsWith("CTRL_")?(n=o,o=Qe.getTable(w.charAt(5)),w.charAt(6)==="L"&&(n=o)):(c+=w,o=n)}return c}static getTable(e){switch(e){case"L":return ot.LOWER;case"P":return ot.PUNCT;case"M":return ot.MIXED;case"D":return ot.DIGIT;case"B":return ot.BINARY;case"U":default:return ot.UPPER}}static getCharacter(e,t){switch(e){case ot.UPPER:return Qe.UPPER_TABLE[t];case ot.LOWER:return Qe.LOWER_TABLE[t];case ot.MIXED:return Qe.MIXED_TABLE[t];case ot.PUNCT:return Qe.PUNCT_TABLE[t];case ot.DIGIT:return Qe.DIGIT_TABLE[t];default:throw new Ue("Bad table")}}correctBits(e){let t,n;this.ddata.getNbLayers()<=2?(n=6,t=De.AZTEC_DATA_6):this.ddata.getNbLayers()<=8?(n=8,t=De.AZTEC_DATA_8):this.ddata.getNbLayers()<=22?(n=10,t=De.AZTEC_DATA_10):(n=12,t=De.AZTEC_DATA_12);let o=this.ddata.getNbDatablocks(),c=e.length/n;if(c<o)throw new F;let d=e.length%n,h=new Int32Array(c);for(let S=0;S<c;S++,d+=n)h[S]=Qe.readCode(e,d,n);try{new Nt(t).decode(h,c-o)}catch(S){throw new F(S)}let g=(1<<n)-1,w=0;for(let S=0;S<o;S++){let B=h[S];if(B===0||B===g)throw new F;(B===1||B===g-1)&&w++}let E=new Array(o*n-w),A=0;for(let S=0;S<o;S++){let B=h[S];if(B===1||B===g-1)E.fill(B>1,A,A+n-1),A+=n-1;else for(let U=n-1;U>=0;--U)E[A++]=(B&1<<U)!==0}return E}extractBits(e){let t=this.ddata.isCompact(),n=this.ddata.getNbLayers(),o=(t?11:14)+n*4,c=new Int32Array(o),d=new Array(this.totalBitsInLayer(n,t));if(t)for(let h=0;h<c.length;h++)c[h]=h;else{let h=o+1+2*v.truncDivision(v.truncDivision(o,2)-1,15),g=o/2,w=v.truncDivision(h,2);for(let E=0;E<g;E++){let A=E+v.truncDivision(E,15);c[g-E-1]=w-A-1,c[g+E]=w+A+1}}for(let h=0,g=0;h<n;h++){let w=(n-h)*4+(t?9:12),E=h*2,A=o-1-E;for(let S=0;S<w;S++){let B=S*2;for(let U=0;U<2;U++)d[g+B+U]=e.get(c[E+U],c[E+S]),d[g+2*w+B+U]=e.get(c[E+S],c[A-U]),d[g+4*w+B+U]=e.get(c[A-U],c[A-S]),d[g+6*w+B+U]=e.get(c[A-S],c[E+U])}g+=w*8}return d}static readCode(e,t,n){let o=0;for(let c=t;c<t+n;c++)o<<=1,e[c]&&(o|=1);return o}static readByte(e,t){let n=e.length-t;return n>=8?Qe.readCode(e,t,8):Qe.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]=Qe.readByte(e,8*n);return t}totalBitsInLayer(e,t){return((t?88:112)+16*e)*e}}Qe.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"],Qe.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"],Qe.MIXED_TABLE=["CTRL_PS"," ","\\1","\\2","\\3","\\4","\\5","\\6","\\7","\b"," ",`
15
- `,"\\13","\f","\r","\\33","\\34","\\35","\\36","\\37","@","\\","^","_","`","|","~","\\177","CTRL_LL","CTRL_UL","CTRL_PL","CTRL_BS"],Qe.PUNCT_TABLE=["","\r",`\r
16
- `,". ",", ",": ","!",'"',"#","$","%","&","'","(",")","*","+",",","-",".","/",":",";","<","=",">","?","[","]","{","}","CTRL_UL"],Qe.DIGIT_TABLE=["CTRL_PS"," ","0","1","2","3","4","5","6","7","8","9",",",".","CTRL_UL","CTRL_US"];class ve{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,o){const c=e-n,d=t-o;return Math.sqrt(c*c+d*d)}static sum(e){let t=0;for(let n=0,o=e.length;n!==o;n++){const c=e[n];t+=c}return t}}class ar{static floatToIntBits(e){return e}}ar.MAX_VALUE=Number.MAX_SAFE_INTEGER;class ye{constructor(e,t){this.x=e,this.y=t}getX(){return this.x}getY(){return this.y}equals(e){if(e instanceof ye){const t=e;return this.x===t.x&&this.y===t.y}return!1}hashCode(){return 31*ar.floatToIntBits(this.x)+ar.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]),o=this.distance(e[0],e[2]);let c,d,h;if(n>=t&&n>=o?(d=e[0],c=e[1],h=e[2]):o>=n&&o>=t?(d=e[1],c=e[0],h=e[2]):(d=e[2],c=e[0],h=e[1]),this.crossProductZ(c,d,h)<0){const g=c;c=h,h=g}e[0]=c,e[1]=d,e[2]=h}static distance(e,t){return ve.distance(e.x,e.y,t.x,t.y)}static crossProductZ(e,t,n){const o=t.x,c=t.y;return(n.x-o)*(e.y-c)-(n.y-c)*(e.x-o)}}class br{constructor(e,t){this.bits=e,this.points=t}getBits(){return this.bits}getPoints(){return this.points}}class qr extends br{constructor(e,t,n,o,c){super(e,t),this.compact=n,this.nbDatablocks=o,this.nbLayers=c}getNbLayers(){return this.nbLayers}getNbDatablocks(){return this.nbDatablocks}isCompact(){return this.compact}}class Dt{constructor(e,t,n,o){this.image=e,this.height=e.getHeight(),this.width=e.getWidth(),t==null&&(t=Dt.INIT_SIZE),n==null&&(n=e.getWidth()/2|0),o==null&&(o=e.getHeight()/2|0);const c=t/2|0;if(this.leftInit=n-c,this.rightInit=n+c,this.upInit=o-c,this.downInit=o+c,this.upInit<0||this.leftInit<0||this.downInit>=this.height||this.rightInit>=this.width)throw new N}detect(){let e=this.leftInit,t=this.rightInit,n=this.upInit,o=this.downInit,c=!1,d=!0,h=!1,g=!1,w=!1,E=!1,A=!1;const S=this.width,B=this.height;for(;d;){d=!1;let U=!0;for(;(U||!g)&&t<S;)U=this.containsBlackPoint(n,o,t,!1),U?(t++,d=!0,g=!0):g||t++;if(t>=S){c=!0;break}let H=!0;for(;(H||!w)&&o<B;)H=this.containsBlackPoint(e,t,o,!0),H?(o++,d=!0,w=!0):w||o++;if(o>=B){c=!0;break}let Y=!0;for(;(Y||!E)&&e>=0;)Y=this.containsBlackPoint(n,o,e,!1),Y?(e--,d=!0,E=!0):E||e--;if(e<0){c=!0;break}let oe=!0;for(;(oe||!A)&&n>=0;)oe=this.containsBlackPoint(e,t,n,!0),oe?(n--,d=!0,A=!0):A||n--;if(n<0){c=!0;break}d&&(h=!0)}if(!c&&h){const U=t-e;let H=null;for(let he=1;H===null&&he<U;he++)H=this.getBlackPointOnSegment(e,o-he,e+he,o);if(H==null)throw new N;let Y=null;for(let he=1;Y===null&&he<U;he++)Y=this.getBlackPointOnSegment(e,n+he,e+he,n);if(Y==null)throw new N;let oe=null;for(let he=1;oe===null&&he<U;he++)oe=this.getBlackPointOnSegment(t,n+he,t-he,n);if(oe==null)throw new N;let ue=null;for(let he=1;ue===null&&he<U;he++)ue=this.getBlackPointOnSegment(t,o-he,t-he,o);if(ue==null)throw new N;return this.centerEdges(ue,H,oe,Y)}else throw new N}getBlackPointOnSegment(e,t,n,o){const c=ve.round(ve.distance(e,t,n,o)),d=(n-e)/c,h=(o-t)/c,g=this.image;for(let w=0;w<c;w++){const E=ve.round(e+w*d),A=ve.round(t+w*h);if(g.get(E,A))return new ye(E,A)}return null}centerEdges(e,t,n,o){const c=e.getX(),d=e.getY(),h=t.getX(),g=t.getY(),w=n.getX(),E=n.getY(),A=o.getX(),S=o.getY(),B=Dt.CORR;return c<this.width/2?[new ye(A-B,S+B),new ye(h+B,g+B),new ye(w-B,E-B),new ye(c+B,d-B)]:[new ye(A+B,S+B),new ye(h+B,g-B),new ye(w-B,E+B),new ye(c-B,d-B)]}containsBlackPoint(e,t,n,o){const c=this.image;if(o){for(let d=e;d<=t;d++)if(c.get(d,n))return!0}else for(let d=e;d<=t;d++)if(c.get(n,d))return!0;return!1}}Dt.INIT_SIZE=10,Dt.CORR=1;class Ar{static checkAndNudgePoints(e,t){const n=e.getWidth(),o=e.getHeight();let c=!0;for(let d=0;d<t.length&&c;d+=2){const h=Math.floor(t[d]),g=Math.floor(t[d+1]);if(h<-1||h>n||g<-1||g>o)throw new N;c=!1,h===-1?(t[d]=0,c=!0):h===n&&(t[d]=n-1,c=!0),g===-1?(t[d+1]=0,c=!0):g===o&&(t[d+1]=o-1,c=!0)}c=!0;for(let d=t.length-2;d>=0&&c;d-=2){const h=Math.floor(t[d]),g=Math.floor(t[d+1]);if(h<-1||h>n||g<-1||g>o)throw new N;c=!1,h===-1?(t[d]=0,c=!0):h===n&&(t[d]=n-1,c=!0),g===-1?(t[d+1]=0,c=!0):g===o&&(t[d+1]=o-1,c=!0)}}}class dn{constructor(e,t,n,o,c,d,h,g,w){this.a11=e,this.a21=t,this.a31=n,this.a12=o,this.a22=c,this.a32=d,this.a13=h,this.a23=g,this.a33=w}static quadrilateralToQuadrilateral(e,t,n,o,c,d,h,g,w,E,A,S,B,U,H,Y){const oe=dn.quadrilateralToSquare(e,t,n,o,c,d,h,g);return dn.squareToQuadrilateral(w,E,A,S,B,U,H,Y).times(oe)}transformPoints(e){const t=e.length,n=this.a11,o=this.a12,c=this.a13,d=this.a21,h=this.a22,g=this.a23,w=this.a31,E=this.a32,A=this.a33;for(let S=0;S<t;S+=2){const B=e[S],U=e[S+1],H=c*B+g*U+A;e[S]=(n*B+d*U+w)/H,e[S+1]=(o*B+h*U+E)/H}}transformPointsWithValues(e,t){const n=this.a11,o=this.a12,c=this.a13,d=this.a21,h=this.a22,g=this.a23,w=this.a31,E=this.a32,A=this.a33,S=e.length;for(let B=0;B<S;B++){const U=e[B],H=t[B],Y=c*U+g*H+A;e[B]=(n*U+d*H+w)/Y,t[B]=(o*U+h*H+E)/Y}}static squareToQuadrilateral(e,t,n,o,c,d,h,g){const w=e-n+c-h,E=t-o+d-g;if(w===0&&E===0)return new dn(n-e,c-n,e,o-t,d-o,t,0,0,1);{const A=n-c,S=h-c,B=o-d,U=g-d,H=A*U-S*B,Y=(w*U-S*E)/H,oe=(A*E-w*B)/H;return new dn(n-e+Y*n,h-e+oe*h,e,o-t+Y*o,g-t+oe*g,t,Y,oe,1)}}static quadrilateralToSquare(e,t,n,o,c,d,h,g){return dn.squareToQuadrilateral(e,t,n,o,c,d,h,g).buildAdjoint()}buildAdjoint(){return new dn(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 dn(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 Ri extends Ar{sampleGrid(e,t,n,o,c,d,h,g,w,E,A,S,B,U,H,Y,oe,ue,he){const de=dn.quadrilateralToQuadrilateral(o,c,d,h,g,w,E,A,S,B,U,H,Y,oe,ue,he);return this.sampleGridWithTransform(e,t,n,de)}sampleGridWithTransform(e,t,n,o){if(t<=0||n<=0)throw new N;const c=new z(t,n),d=new Float32Array(2*t);for(let h=0;h<n;h++){const g=d.length,w=h+.5;for(let E=0;E<g;E+=2)d[E]=E/2+.5,d[E+1]=w;o.transformPoints(d),Ar.checkAndNudgePoints(e,d);try{for(let E=0;E<g;E+=2)e.get(Math.floor(d[E]),Math.floor(d[E+1]))&&c.set(E/2,h)}catch{throw new N}}return c}}class Rn{static setGridSampler(e){Rn.gridSampler=e}static getInstance(){return Rn.gridSampler}}Rn.gridSampler=new Ri;class Ut{constructor(e,t){this.x=e,this.y=t}toResultPoint(){return new ye(this.getX(),this.getY())}getX(){return this.x}getY(){return this.y}}class Bi{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 d=n[0];n[0]=n[2],n[2]=d}this.extractParameters(n);let o=this.sampleGrid(this.image,n[this.shift%4],n[(this.shift+1)%4],n[(this.shift+2)%4],n[(this.shift+3)%4]),c=this.getMatrixCornerPoints(n);return new qr(o,c,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 N;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 o=0;for(let d=0;d<4;d++){let h=n[(this.shift+d)%4];this.compact?(o<<=7,o+=h>>1&127):(o<<=10,o+=(h>>2&992)+(h>>1&31))}let c=this.getCorrectedParameterData(o,this.compact);this.compact?(this.nbLayers=(c>>6)+1,this.nbDataBlocks=(c&63)+1):(this.nbLayers=(c>>11)+1,this.nbDataBlocks=(c&2047)+1)}getRotation(e,t){let n=0;e.forEach((o,c,d)=>{let h=(o>>t-2<<1)+(o&1);n=(n<<3)+h}),n=((n&1)<<11)+(n>>1);for(let o=0;o<4;o++)if(v.bitCount(n^this.EXPECTED_CORNER_BITS[o])<=2)return o;throw new N}getCorrectedParameterData(e,t){let n,o;t?(n=7,o=2):(n=10,o=4);let c=n-o,d=new Int32Array(n);for(let g=n-1;g>=0;--g)d[g]=e&15,e>>=4;try{new Nt(De.AZTEC_PARAM).decode(d,c)}catch{throw new N}let h=0;for(let g=0;g<o;g++)h=(h<<4)+d[g];return h}getBullsEyeCorners(e){let t=e,n=e,o=e,c=e,d=!0;for(this.nbCenterLayers=1;this.nbCenterLayers<9;this.nbCenterLayers++){let A=this.getFirstDifferent(t,d,1,-1),S=this.getFirstDifferent(n,d,1,1),B=this.getFirstDifferent(o,d,-1,1),U=this.getFirstDifferent(c,d,-1,-1);if(this.nbCenterLayers>2){let H=this.distancePoint(U,A)*this.nbCenterLayers/(this.distancePoint(c,t)*(this.nbCenterLayers+2));if(H<.75||H>1.25||!this.isWhiteOrBlackRectangle(A,S,B,U))break}t=A,n=S,o=B,c=U,d=!d}if(this.nbCenterLayers!==5&&this.nbCenterLayers!==7)throw new N;this.compact=this.nbCenterLayers===5;let h=new ye(t.getX()+.5,t.getY()-.5),g=new ye(n.getX()+.5,n.getY()+.5),w=new ye(o.getX()-.5,o.getY()+.5),E=new ye(c.getX()-.5,c.getY()-.5);return this.expandSquare([h,g,w,E],2*this.nbCenterLayers-3,2*this.nbCenterLayers)}getMatrixCenter(){let e,t,n,o;try{let h=new Dt(this.image).detect();e=h[0],t=h[1],n=h[2],o=h[3]}catch{let g=this.image.getWidth()/2,w=this.image.getHeight()/2;e=this.getFirstDifferent(new Ut(g+7,w-7),!1,1,-1).toResultPoint(),t=this.getFirstDifferent(new Ut(g+7,w+7),!1,1,1).toResultPoint(),n=this.getFirstDifferent(new Ut(g-7,w+7),!1,-1,1).toResultPoint(),o=this.getFirstDifferent(new Ut(g-7,w-7),!1,-1,-1).toResultPoint()}let c=ve.round((e.getX()+o.getX()+t.getX()+n.getX())/4),d=ve.round((e.getY()+o.getY()+t.getY()+n.getY())/4);try{let h=new Dt(this.image,15,c,d).detect();e=h[0],t=h[1],n=h[2],o=h[3]}catch{e=this.getFirstDifferent(new Ut(c+7,d-7),!1,1,-1).toResultPoint(),t=this.getFirstDifferent(new Ut(c+7,d+7),!1,1,1).toResultPoint(),n=this.getFirstDifferent(new Ut(c-7,d+7),!1,-1,1).toResultPoint(),o=this.getFirstDifferent(new Ut(c-7,d-7),!1,-1,-1).toResultPoint()}return c=ve.round((e.getX()+o.getX()+t.getX()+n.getX())/4),d=ve.round((e.getY()+o.getY()+t.getY()+n.getY())/4),new Ut(c,d)}getMatrixCornerPoints(e){return this.expandSquare(e,2*this.nbCenterLayers,this.getDimension())}sampleGrid(e,t,n,o,c){let d=Rn.getInstance(),h=this.getDimension(),g=h/2-this.nbCenterLayers,w=h/2+this.nbCenterLayers;return d.sampleGrid(e,h,h,g,g,w,g,w,w,g,w,t.getX(),t.getY(),n.getX(),n.getY(),o.getX(),o.getY(),c.getX(),c.getY())}sampleLine(e,t,n){let o=0,c=this.distanceResultPoint(e,t),d=c/n,h=e.getX(),g=e.getY(),w=d*(t.getX()-e.getX())/c,E=d*(t.getY()-e.getY())/c;for(let A=0;A<n;A++)this.image.get(ve.round(h+A*w),ve.round(g+A*E))&&(o|=1<<n-A-1);return o}isWhiteOrBlackRectangle(e,t,n,o){let c=3;e=new Ut(e.getX()-c,e.getY()+c),t=new Ut(t.getX()-c,t.getY()-c),n=new Ut(n.getX()+c,n.getY()-c),o=new Ut(o.getX()+c,o.getY()+c);let d=this.getColor(o,e);if(d===0)return!1;let h=this.getColor(e,t);return h!==d||(h=this.getColor(t,n),h!==d)?!1:(h=this.getColor(n,o),h===d)}getColor(e,t){let n=this.distancePoint(e,t),o=(t.getX()-e.getX())/n,c=(t.getY()-e.getY())/n,d=0,h=e.getX(),g=e.getY(),w=this.image.get(e.getX(),e.getY()),E=Math.ceil(n);for(let S=0;S<E;S++)h+=o,g+=c,this.image.get(ve.round(h),ve.round(g))!==w&&d++;let A=d/n;return A>.1&&A<.9?0:A<=.1===w?1:-1}getFirstDifferent(e,t,n,o){let c=e.getX()+n,d=e.getY()+o;for(;this.isValid(c,d)&&this.image.get(c,d)===t;)c+=n,d+=o;for(c-=n,d-=o;this.isValid(c,d)&&this.image.get(c,d)===t;)c+=n;for(c-=n;this.isValid(c,d)&&this.image.get(c,d)===t;)d+=o;return d-=o,new Ut(c,d)}expandSquare(e,t,n){let o=n/(2*t),c=e[0].getX()-e[2].getX(),d=e[0].getY()-e[2].getY(),h=(e[0].getX()+e[2].getX())/2,g=(e[0].getY()+e[2].getY())/2,w=new ye(h+o*c,g+o*d),E=new ye(h-o*c,g-o*d);c=e[1].getX()-e[3].getX(),d=e[1].getY()-e[3].getY(),h=(e[1].getX()+e[3].getX())/2,g=(e[1].getY()+e[3].getY())/2;let A=new ye(h+o*c,g+o*d),S=new ye(h-o*c,g-o*d);return[w,A,E,S]}isValid(e,t){return e>=0&&e<this.image.getWidth()&&t>0&&t<this.image.getHeight()}isValidPoint(e){let t=ve.round(e.getX()),n=ve.round(e.getY());return this.isValid(t,n)}distancePoint(e,t){return ve.distance(e.getX(),e.getY(),t.getX(),t.getY())}distanceResultPoint(e,t){return ve.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*(v.truncDivision(this.nbLayers-4,8)+1)+15}}class Sr{decode(e,t=null){let n=null,o=new Bi(e.getBlackMatrix()),c=null,d=null;try{let E=o.detectMirror(!1);c=E.getPoints(),this.reportFoundResultPoints(t,c),d=new Qe().decode(E)}catch(E){n=E}if(d==null)try{let E=o.detectMirror(!0);c=E.getPoints(),this.reportFoundResultPoints(t,c),d=new Qe().decode(E)}catch(E){throw n??E}let h=new Ce(d.getText(),d.getRawBytes(),d.getNumBits(),c,ge.AZTEC,D.currentTimeMillis()),g=d.getByteSegments();g!=null&&h.putMetadata(be.BYTE_SEGMENTS,g);let w=d.getECLevel();return w!=null&&h.putMetadata(be.ERROR_CORRECTION_LEVEL,w),h}reportFoundResultPoints(e,t){if(e!=null){let n=e.get(Z.NEED_RESULT_POINT_CALLBACK);n!=null&&t.forEach((o,c,d)=>{n.foundPossibleResultPoint(o)})}}reset(){}}class Oo extends we{constructor(e=500){super(new Sr,e)}}class mt{decode(e,t){try{return this.doDecode(e,t)}catch{if(t&&t.get(Z.TRY_HARDER)===!0&&e.isRotateSupported()){const c=e.rotateCounterClockwise(),d=this.doDecode(c,t),h=d.getResultMetadata();let g=270;h!==null&&h.get(be.ORIENTATION)===!0&&(g=g+h.get(be.ORIENTATION)%360),d.putMetadata(be.ORIENTATION,g);const w=d.getResultPoints();if(w!==null){const E=c.getHeight();for(let A=0;A<w.length;A++)w[A]=new ye(E-w[A].getY()-1,w[A].getX())}return d}else throw new N}}reset(){}doDecode(e,t){const n=e.getWidth(),o=e.getHeight();let c=new W(n);const d=t&&t.get(Z.TRY_HARDER)===!0,h=Math.max(1,o>>(d?8:5));let g;d?g=o:g=15;const w=Math.trunc(o/2);for(let E=0;E<g;E++){const A=Math.trunc((E+1)/2),S=(E&1)===0,B=w+h*(S?A:-A);if(B<0||B>=o)break;try{c=e.getBlackRow(B,c)}catch{continue}for(let U=0;U<2;U++){if(U===1&&(c.reverse(),t&&t.get(Z.NEED_RESULT_POINT_CALLBACK)===!0)){const H=new Map;t.forEach((Y,oe)=>H.set(oe,Y)),H.delete(Z.NEED_RESULT_POINT_CALLBACK),t=H}try{const H=this.decodeRow(B,c,t);if(U===1){H.putMetadata(be.ORIENTATION,180);const Y=H.getResultPoints();Y!==null&&(Y[0]=new ye(n-Y[0].getX()-1,Y[0].getY()),Y[1]=new ye(n-Y[1].getX()-1,Y[1].getY()))}return H}catch{}}}throw new N}static recordPattern(e,t,n){const o=n.length;for(let w=0;w<o;w++)n[w]=0;const c=e.getSize();if(t>=c)throw new N;let d=!e.get(t),h=0,g=t;for(;g<c;){if(e.get(g)!==d)n[h]++;else{if(++h===o)break;n[h]=1,d=!d}g++}if(!(h===o||h===o-1&&g===c))throw new N}static recordPatternInReverse(e,t,n){let o=n.length,c=e.get(t);for(;t>0&&o>=0;)e.get(--t)!==c&&(o--,c=!c);if(o>=0)throw new N;mt.recordPattern(e,t+1,n)}static patternMatchVariance(e,t,n){const o=e.length;let c=0,d=0;for(let w=0;w<o;w++)c+=e[w],d+=t[w];if(c<d)return Number.POSITIVE_INFINITY;const h=c/d;n*=h;let g=0;for(let w=0;w<o;w++){const E=e[w],A=t[w]*h,S=E>A?E-A:A-E;if(S>n)return Number.POSITIVE_INFINITY;g+=S}return g/c}}class me extends mt{static findStartPattern(e){const t=e.getSize(),n=e.getNextSet(0);let o=0,c=Int32Array.from([0,0,0,0,0,0]),d=n,h=!1;const g=6;for(let w=n;w<t;w++)if(e.get(w)!==h)c[o]++;else{if(o===g-1){let E=me.MAX_AVG_VARIANCE,A=-1;for(let S=me.CODE_START_A;S<=me.CODE_START_C;S++){const B=mt.patternMatchVariance(c,me.CODE_PATTERNS[S],me.MAX_INDIVIDUAL_VARIANCE);B<E&&(E=B,A=S)}if(A>=0&&e.isRange(Math.max(0,d-(w-d)/2),d,!1))return Int32Array.from([d,w,A]);d+=c[0]+c[1],c=c.slice(2,c.length-1),c[o-1]=0,c[o]=0,o--}else o++;c[o]=1,h=!h}throw new N}static decodeCode(e,t,n){mt.recordPattern(e,n,t);let o=me.MAX_AVG_VARIANCE,c=-1;for(let d=0;d<me.CODE_PATTERNS.length;d++){const h=me.CODE_PATTERNS[d],g=this.patternMatchVariance(t,h,me.MAX_INDIVIDUAL_VARIANCE);g<o&&(o=g,c=d)}if(c>=0)return c;throw new N}decodeRow(e,t,n){const o=n&&n.get(Z.ASSUME_GS1)===!0,c=me.findStartPattern(t),d=c[2];let h=0;const g=new Uint8Array(20);g[h++]=d;let w;switch(d){case me.CODE_START_A:w=me.CODE_CODE_A;break;case me.CODE_START_B:w=me.CODE_CODE_B;break;case me.CODE_START_C:w=me.CODE_CODE_C;break;default:throw new F}let E=!1,A=!1,S="",B=c[0],U=c[1];const H=Int32Array.from([0,0,0,0,0,0]);let Y=0,oe=0,ue=d,he=0,de=!0,je=!1,Fe=!1;for(;!E;){const Mr=A;switch(A=!1,Y=oe,oe=me.decodeCode(t,H,U),g[h++]=oe,oe!==me.CODE_STOP&&(de=!0),oe!==me.CODE_STOP&&(he++,ue+=he*oe),B=U,U+=H.reduce(($g,jg)=>$g+jg,0),oe){case me.CODE_START_A:case me.CODE_START_B:case me.CODE_START_C:throw new F}switch(w){case me.CODE_CODE_A:if(oe<64)Fe===je?S+=String.fromCharCode(32+oe):S+=String.fromCharCode(32+oe+128),Fe=!1;else if(oe<96)Fe===je?S+=String.fromCharCode(oe-64):S+=String.fromCharCode(oe+64),Fe=!1;else switch(oe!==me.CODE_STOP&&(de=!1),oe){case me.CODE_FNC_1:o&&(S.length===0?S+="]C1":S+="");break;case me.CODE_FNC_2:case me.CODE_FNC_3:break;case me.CODE_FNC_4_A:!je&&Fe?(je=!0,Fe=!1):je&&Fe?(je=!1,Fe=!1):Fe=!0;break;case me.CODE_SHIFT:A=!0,w=me.CODE_CODE_B;break;case me.CODE_CODE_B:w=me.CODE_CODE_B;break;case me.CODE_CODE_C:w=me.CODE_CODE_C;break;case me.CODE_STOP:E=!0;break}break;case me.CODE_CODE_B:if(oe<96)Fe===je?S+=String.fromCharCode(32+oe):S+=String.fromCharCode(32+oe+128),Fe=!1;else switch(oe!==me.CODE_STOP&&(de=!1),oe){case me.CODE_FNC_1:o&&(S.length===0?S+="]C1":S+="");break;case me.CODE_FNC_2:case me.CODE_FNC_3:break;case me.CODE_FNC_4_B:!je&&Fe?(je=!0,Fe=!1):je&&Fe?(je=!1,Fe=!1):Fe=!0;break;case me.CODE_SHIFT:A=!0,w=me.CODE_CODE_A;break;case me.CODE_CODE_A:w=me.CODE_CODE_A;break;case me.CODE_CODE_C:w=me.CODE_CODE_C;break;case me.CODE_STOP:E=!0;break}break;case me.CODE_CODE_C:if(oe<100)oe<10&&(S+="0"),S+=oe;else switch(oe!==me.CODE_STOP&&(de=!1),oe){case me.CODE_FNC_1:o&&(S.length===0?S+="]C1":S+="");break;case me.CODE_CODE_A:w=me.CODE_CODE_A;break;case me.CODE_CODE_B:w=me.CODE_CODE_B;break;case me.CODE_STOP:E=!0;break}break}Mr&&(w=w===me.CODE_CODE_A?me.CODE_CODE_B:me.CODE_CODE_A)}const rn=U-B;if(U=t.getNextUnset(U),!t.isRange(U,Math.min(t.getSize(),U+(U-B)/2),!1))throw new N;if(ue-=he*Y,ue%103!==Y)throw new O;const Sn=S.length;if(Sn===0)throw new N;Sn>0&&de&&(w===me.CODE_CODE_C?S=S.substring(0,Sn-2):S=S.substring(0,Sn-1));const on=(c[1]+c[0])/2,ut=B+rn/2,Wt=g.length,fn=new Uint8Array(Wt);for(let Mr=0;Mr<Wt;Mr++)fn[Mr]=g[Mr];const Or=[new ye(on,e),new ye(ut,e)];return new Ce(S,fn,0,Or,ge.CODE_128,new Date().getTime())}}me.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])],me.MAX_AVG_VARIANCE=.25,me.MAX_INDIVIDUAL_VARIANCE=.7,me.CODE_SHIFT=98,me.CODE_CODE_C=99,me.CODE_CODE_B=100,me.CODE_CODE_A=101,me.CODE_FNC_1=102,me.CODE_FNC_2=97,me.CODE_FNC_3=96,me.CODE_FNC_4_A=101,me.CODE_FNC_4_B=100,me.CODE_START_A=103,me.CODE_START_B=104,me.CODE_START_C=105,me.CODE_STOP=106;class bt extends mt{constructor(e=!1,t=!1){super(),this.usingCheckDigit=e,this.extendedMode=t,this.decodeRowResult="",this.counters=new Int32Array(9)}decodeRow(e,t,n){let o=this.counters;o.fill(0),this.decodeRowResult="";let c=bt.findAsteriskPattern(t,o),d=t.getNextSet(c[1]),h=t.getSize(),g,w;do{bt.recordPattern(t,d,o);let H=bt.toNarrowWidePattern(o);if(H<0)throw new N;g=bt.patternToChar(H),this.decodeRowResult+=g,w=d;for(let Y of o)d+=Y;d=t.getNextSet(d)}while(g!=="*");this.decodeRowResult=this.decodeRowResult.substring(0,this.decodeRowResult.length-1);let E=0;for(let H of o)E+=H;let A=d-w-E;if(d!==h&&A*2<E)throw new N;if(this.usingCheckDigit){let H=this.decodeRowResult.length-1,Y=0;for(let oe=0;oe<H;oe++)Y+=bt.ALPHABET_STRING.indexOf(this.decodeRowResult.charAt(oe));if(this.decodeRowResult.charAt(H)!==bt.ALPHABET_STRING.charAt(Y%43))throw new O;this.decodeRowResult=this.decodeRowResult.substring(0,H)}if(this.decodeRowResult.length===0)throw new N;let S;this.extendedMode?S=bt.decodeExtended(this.decodeRowResult):S=this.decodeRowResult;let B=(c[1]+c[0])/2,U=w+E/2;return new Ce(S,null,0,[new ye(B,e),new ye(U,e)],ge.CODE_39,new Date().getTime())}static findAsteriskPattern(e,t){let n=e.getSize(),o=e.getNextSet(0),c=0,d=o,h=!1,g=t.length;for(let w=o;w<n;w++)if(e.get(w)!==h)t[c]++;else{if(c===g-1){if(this.toNarrowWidePattern(t)===bt.ASTERISK_ENCODING&&e.isRange(Math.max(0,d-Math.floor((w-d)/2)),d,!1))return[d,w];d+=t[0]+t[1],t.copyWithin(0,2,2+c-1),t[c-1]=0,t[c]=0,c--}else c++;t[c]=1,h=!h}throw new N}static toNarrowWidePattern(e){let t=e.length,n=0,o;do{let c=2147483647;for(let g of e)g<c&&g>n&&(c=g);n=c,o=0;let d=0,h=0;for(let g=0;g<t;g++){let w=e[g];w>n&&(h|=1<<t-1-g,o++,d+=w)}if(o===3){for(let g=0;g<t&&o>0;g++){let w=e[g];if(w>n&&(o--,w*2>=d))return-1}return h}}while(o>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 N}static decodeExtended(e){let t=e.length,n="";for(let o=0;o<t;o++){let c=e.charAt(o);if(c==="+"||c==="$"||c==="%"||c==="/"){let d=e.charAt(o+1),h="\0";switch(c){case"+":if(d>="A"&&d<="Z")h=String.fromCharCode(d.charCodeAt(0)+32);else throw new F;break;case"$":if(d>="A"&&d<="Z")h=String.fromCharCode(d.charCodeAt(0)-64);else throw new F;break;case"%":if(d>="A"&&d<="E")h=String.fromCharCode(d.charCodeAt(0)-38);else if(d>="F"&&d<="J")h=String.fromCharCode(d.charCodeAt(0)-11);else if(d>="K"&&d<="O")h=String.fromCharCode(d.charCodeAt(0)+16);else if(d>="P"&&d<="T")h=String.fromCharCode(d.charCodeAt(0)+43);else if(d==="U")h="\0";else if(d==="V")h="@";else if(d==="W")h="`";else if(d==="X"||d==="Y"||d==="Z")h="";else throw new F;break;case"/":if(d>="A"&&d<="O")h=String.fromCharCode(d.charCodeAt(0)-32);else if(d==="Z")h=":";else throw new F;break}n+=h,o++}else n+=c}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 tt extends mt{constructor(){super(...arguments),this.narrowLineWidth=-1}decodeRow(e,t,n){let o=this.decodeStart(t),c=this.decodeEnd(t),d=new G;tt.decodeMiddle(t,o[1],c[0],d);let h=d.toString(),g=null;n!=null&&(g=n.get(Z.ALLOWED_LENGTHS)),g==null&&(g=tt.DEFAULT_ALLOWED_LENGTHS);let w=h.length,E=!1,A=0;for(let U of g){if(w===U){E=!0;break}U>A&&(A=U)}if(!E&&w>A&&(E=!0),!E)throw new F;const S=[new ye(o[1],e),new ye(c[0],e)];return new Ce(h,null,0,S,ge.ITF,new Date().getTime())}static decodeMiddle(e,t,n,o){let c=new Int32Array(10),d=new Int32Array(5),h=new Int32Array(5);for(c.fill(0),d.fill(0),h.fill(0);t<n;){mt.recordPattern(e,t,c);for(let w=0;w<5;w++){let E=2*w;d[w]=c[E],h[w]=c[E+1]}let g=tt.decodeDigit(d);o.append(g.toString()),g=this.decodeDigit(h),o.append(g.toString()),c.forEach(function(w){t+=w})}}decodeStart(e){let t=tt.skipWhiteSpace(e),n=tt.findGuardPattern(e,t,tt.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 o=t-1;n>0&&o>=0&&!e.get(o);o--)n--;if(n!==0)throw new N}static skipWhiteSpace(e){const t=e.getSize(),n=e.getNextSet(0);if(n===t)throw new N;return n}decodeEnd(e){e.reverse();try{let t=tt.skipWhiteSpace(e),n;try{n=tt.findGuardPattern(e,t,tt.END_PATTERN_REVERSED[0])}catch(c){c instanceof N&&(n=tt.findGuardPattern(e,t,tt.END_PATTERN_REVERSED[1]))}this.validateQuietZone(e,n[0]);let o=n[0];return n[0]=e.getSize()-n[1],n[1]=e.getSize()-o,n}finally{e.reverse()}}static findGuardPattern(e,t,n){let o=n.length,c=new Int32Array(o),d=e.getSize(),h=!1,g=0,w=t;c.fill(0);for(let E=t;E<d;E++)if(e.get(E)!==h)c[g]++;else{if(g===o-1){if(mt.patternMatchVariance(c,n,tt.MAX_INDIVIDUAL_VARIANCE)<tt.MAX_AVG_VARIANCE)return[w,E];w+=c[0]+c[1],D.arraycopy(c,2,c,0,g-1),c[g-1]=0,c[g]=0,g--}else g++;c[g]=1,h=!h}throw new N}static decodeDigit(e){let t=tt.MAX_AVG_VARIANCE,n=-1,o=tt.PATTERNS.length;for(let c=0;c<o;c++){let d=tt.PATTERNS[c],h=mt.patternMatchVariance(e,d,tt.MAX_INDIVIDUAL_VARIANCE);h<t?(t=h,n=c):h===t&&(n=-1)}if(n>=0)return n%10;throw new N}}tt.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])],tt.MAX_AVG_VARIANCE=.38,tt.MAX_INDIVIDUAL_VARIANCE=.5,tt.DEFAULT_ALLOWED_LENGTHS=[6,8,10,12,14],tt.START_PATTERN=Int32Array.from([1,1,1,1]),tt.END_PATTERN_REVERSED=[Int32Array.from([1,1,2]),Int32Array.from([1,1,3])];class at extends mt{constructor(){super(...arguments),this.decodeRowStringBuffer=""}static findStartGuardPattern(e){let t=!1,n,o=0,c=Int32Array.from([0,0,0]);for(;!t;){c=Int32Array.from([0,0,0]),n=at.findGuardPattern(e,o,!1,this.START_END_PATTERN,c);let d=n[0];o=n[1];let h=d-(o-d);h>=0&&(t=e.isRange(h,d,!1))}return n}static checkChecksum(e){return at.checkStandardUPCEANChecksum(e)}static checkStandardUPCEANChecksum(e){let t=e.length;if(t===0)return!1;let n=parseInt(e.charAt(t-1),10);return at.getStandardUPCEANChecksum(e.substring(0,t-1))===n}static getStandardUPCEANChecksum(e){let t=e.length,n=0;for(let o=t-1;o>=0;o-=2){let c=e.charAt(o).charCodeAt(0)-48;if(c<0||c>9)throw new F;n+=c}n*=3;for(let o=t-2;o>=0;o-=2){let c=e.charAt(o).charCodeAt(0)-48;if(c<0||c>9)throw new F;n+=c}return(1e3-n)%10}static decodeEnd(e,t){return at.findGuardPattern(e,t,!1,at.START_END_PATTERN,new Int32Array(at.START_END_PATTERN.length).fill(0))}static findGuardPatternWithoutCounters(e,t,n,o){return this.findGuardPattern(e,t,n,o,new Int32Array(o.length))}static findGuardPattern(e,t,n,o,c){let d=e.getSize();t=n?e.getNextUnset(t):e.getNextSet(t);let h=0,g=t,w=o.length,E=n;for(let A=t;A<d;A++)if(e.get(A)!==E)c[h]++;else{if(h===w-1){if(mt.patternMatchVariance(c,o,at.MAX_INDIVIDUAL_VARIANCE)<at.MAX_AVG_VARIANCE)return Int32Array.from([g,A]);g+=c[0]+c[1];let S=c.slice(2,c.length-1);for(let B=0;B<h-1;B++)c[B]=S[B];c[h-1]=0,c[h]=0,h--}else h++;c[h]=1,E=!E}throw new N}static decodeDigit(e,t,n,o){this.recordPattern(e,n,t);let c=this.MAX_AVG_VARIANCE,d=-1,h=o.length;for(let g=0;g<h;g++){let w=o[g],E=mt.patternMatchVariance(t,w,at.MAX_INDIVIDUAL_VARIANCE);E<c&&(c=E,d=g)}if(d>=0)return d;throw new N}}at.MAX_AVG_VARIANCE=.48,at.MAX_INDIVIDUAL_VARIANCE=.7,at.START_END_PATTERN=Int32Array.from([1,1,1]),at.MIDDLE_PATTERN=Int32Array.from([1,1,1,1,1]),at.END_PATTERN=Int32Array.from([1,1,1,1,1,1]),at.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 pe{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 o=this.decodeRowStringBuffer,c=this.decodeMiddle(t,n,o),d=o.toString(),h=pe.parseExtensionString(d),g=[new ye((n[0]+n[1])/2,e),new ye(c,e)],w=new Ce(d,null,0,g,ge.UPC_EAN_EXTENSION,new Date().getTime());return h!=null&&w.putAllMetadata(h),w}decodeMiddle(e,t,n){let o=this.decodeMiddleCounters;o[0]=0,o[1]=0,o[2]=0,o[3]=0;let c=e.getSize(),d=t[1],h=0;for(let w=0;w<5&&d<c;w++){let E=at.decodeDigit(e,o,d,at.L_AND_G_PATTERNS);n+=String.fromCharCode(48+E%10);for(let A of o)d+=A;E>=10&&(h|=1<<4-w),w!==4&&(d=e.getNextSet(d),d=e.getNextUnset(d))}if(n.length!==5)throw new N;let g=this.determineCheckDigit(h);if(pe.extensionChecksum(n.toString())!==g)throw new N;return d}static extensionChecksum(e){let t=e.length,n=0;for(let o=t-2;o>=0;o-=2)n+=e.charAt(o).charCodeAt(0)-48;n*=3;for(let o=t-1;o>=0;o-=2)n+=e.charAt(o).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 N}static parseExtensionString(e){if(e.length!==5)return null;let t=pe.parseExtension5String(e);return t==null?null:new Map([[be.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)),o=(n/100).toString(),c=n%100,d=c<10?"0"+c:c.toString();return t+o+"."+d}}class ae{constructor(){this.decodeMiddleCounters=Int32Array.from([0,0,0,0]),this.decodeRowStringBuffer=""}decodeRow(e,t,n){let o=this.decodeRowStringBuffer,c=this.decodeMiddle(t,n,o),d=o.toString(),h=ae.parseExtensionString(d),g=[new ye((n[0]+n[1])/2,e),new ye(c,e)],w=new Ce(d,null,0,g,ge.UPC_EAN_EXTENSION,new Date().getTime());return h!=null&&w.putAllMetadata(h),w}decodeMiddle(e,t,n){let o=this.decodeMiddleCounters;o[0]=0,o[1]=0,o[2]=0,o[3]=0;let c=e.getSize(),d=t[1],h=0;for(let g=0;g<2&&d<c;g++){let w=at.decodeDigit(e,o,d,at.L_AND_G_PATTERNS);n+=String.fromCharCode(48+w%10);for(let E of o)d+=E;w>=10&&(h|=1<<1-g),g!==1&&(d=e.getNextSet(d),d=e.getNextUnset(d))}if(n.length!==2)throw new N;if(parseInt(n.toString())%4!==h)throw new N;return d}static parseExtensionString(e){return e.length!==2?null:new Map([[be.ISSUE_NUMBER,parseInt(e)]])}}class $e{static decodeRow(e,t,n){let o=at.findGuardPattern(t,n,!1,this.EXTENSION_START_PATTERN,new Int32Array(this.EXTENSION_START_PATTERN.length).fill(0));try{return new pe().decodeRow(e,t,o)}catch{return new ae().decodeRow(e,t,o)}}}$e.EXTENSION_START_PATTERN=Int32Array.from([1,1,2]);class Se extends at{constructor(){super(),this.decodeRowStringBuffer="",Se.L_AND_G_PATTERNS=Se.L_PATTERNS.map(e=>Int32Array.from(e));for(let e=10;e<20;e++){let t=Se.L_PATTERNS[e-10],n=new Int32Array(t.length);for(let o=0;o<t.length;o++)n[o]=t[t.length-o-1];Se.L_AND_G_PATTERNS[e]=n}}decodeRow(e,t,n){let o=Se.findStartGuardPattern(t),c=n==null?null:n.get(Z.NEED_RESULT_POINT_CALLBACK);if(c!=null){const de=new ye((o[0]+o[1])/2,e);c.foundPossibleResultPoint(de)}let d=this.decodeMiddle(t,o,this.decodeRowStringBuffer),h=d.rowOffset,g=d.resultString;if(c!=null){const de=new ye(h,e);c.foundPossibleResultPoint(de)}let w=this.decodeEnd(t,h);if(c!=null){const de=new ye((w[0]+w[1])/2,e);c.foundPossibleResultPoint(de)}let E=w[1],A=E+(E-w[0]);if(A>=t.getSize()||!t.isRange(E,A,!1))throw new N;let S=g.toString();if(S.length<8)throw new F;if(!Se.checkChecksum(S))throw new O;let B=(o[1]+o[0])/2,U=(w[1]+w[0])/2,H=this.getBarcodeFormat(),Y=[new ye(B,e),new ye(U,e)],oe=new Ce(S,null,0,Y,H,new Date().getTime()),ue=0;try{let de=$e.decodeRow(e,t,w[1]);oe.putMetadata(be.UPC_EAN_EXTENSION,de.getText()),oe.putAllMetadata(de.getResultMetadata()),oe.addResultPoints(de.getResultPoints()),ue=de.getText().length}catch{}let he=n==null?null:n.get(Z.ALLOWED_EAN_EXTENSIONS);if(he!=null){let de=!1;for(let je in he)if(ue.toString()===je){de=!0;break}if(!de)throw new N}return oe}decodeEnd(e,t){return Se.findGuardPattern(e,t,!1,Se.START_END_PATTERN,new Int32Array(Se.START_END_PATTERN.length).fill(0))}static checkChecksum(e){return Se.checkStandardUPCEANChecksum(e)}static checkStandardUPCEANChecksum(e){let t=e.length;if(t===0)return!1;let n=parseInt(e.charAt(t-1),10);return Se.getStandardUPCEANChecksum(e.substring(0,t-1))===n}static getStandardUPCEANChecksum(e){let t=e.length,n=0;for(let o=t-1;o>=0;o-=2){let c=e.charAt(o).charCodeAt(0)-48;if(c<0||c>9)throw new F;n+=c}n*=3;for(let o=t-2;o>=0;o-=2){let c=e.charAt(o).charCodeAt(0)-48;if(c<0||c>9)throw new F;n+=c}return(1e3-n)%10}}class zt extends Se{constructor(){super(),this.decodeMiddleCounters=Int32Array.from([0,0,0,0])}decodeMiddle(e,t,n){let o=this.decodeMiddleCounters;o[0]=0,o[1]=0,o[2]=0,o[3]=0;let c=e.getSize(),d=t[1],h=0;for(let w=0;w<6&&d<c;w++){let E=Se.decodeDigit(e,o,d,Se.L_AND_G_PATTERNS);n+=String.fromCharCode(48+E%10);for(let A of o)d+=A;E>=10&&(h|=1<<5-w)}n=zt.determineFirstDigit(n,h),d=Se.findGuardPattern(e,d,!0,Se.MIDDLE_PATTERN,new Int32Array(Se.MIDDLE_PATTERN.length).fill(0))[1];for(let w=0;w<6&&d<c;w++){let E=Se.decodeDigit(e,o,d,Se.L_PATTERNS);n+=String.fromCharCode(48+E);for(let A of o)d+=A}return{rowOffset:d,resultString:n}}getBarcodeFormat(){return ge.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 N}}zt.FIRST_DIGIT_ENCODINGS=[0,11,13,14,19,25,28,21,22,26];class An extends Se{constructor(){super(),this.decodeMiddleCounters=Int32Array.from([0,0,0,0])}decodeMiddle(e,t,n){const o=this.decodeMiddleCounters;o[0]=0,o[1]=0,o[2]=0,o[3]=0;let c=e.getSize(),d=t[1];for(let g=0;g<4&&d<c;g++){let w=Se.decodeDigit(e,o,d,Se.L_PATTERNS);n+=String.fromCharCode(48+w);for(let E of o)d+=E}d=Se.findGuardPattern(e,d,!0,Se.MIDDLE_PATTERN,new Int32Array(Se.MIDDLE_PATTERN.length).fill(0))[1];for(let g=0;g<4&&d<c;g++){let w=Se.decodeDigit(e,o,d,Se.L_PATTERNS);n+=String.fromCharCode(48+w);for(let E of o)d+=E}return{rowOffset:d,resultString:n}}getBarcodeFormat(){return ge.EAN_8}}class ct extends Se{constructor(){super(...arguments),this.ean13Reader=new zt}getBarcodeFormat(){return ge.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 Ce(t.substring(1),null,null,e.getResultPoints(),ge.UPC_A);return e.getResultMetadata()!=null&&n.putAllMetadata(e.getResultMetadata()),n}else throw new N}reset(){this.ean13Reader.reset()}}class Pe extends Se{constructor(){super(),this.decodeMiddleCounters=new Int32Array(4)}decodeMiddle(e,t,n){const o=this.decodeMiddleCounters.map(w=>w);o[0]=0,o[1]=0,o[2]=0,o[3]=0;const c=e.getSize();let d=t[1],h=0;for(let w=0;w<6&&d<c;w++){const E=Pe.decodeDigit(e,o,d,Pe.L_AND_G_PATTERNS);n+=String.fromCharCode(48+E%10);for(let A of o)d+=A;E>=10&&(h|=1<<5-w)}let g=Pe.determineNumSysAndCheckDigit(n,h);return{rowOffset:d,resultString:g}}decodeEnd(e,t){return Pe.findGuardPatternWithoutCounters(e,t,!0,Pe.MIDDLE_END_PATTERN)}checkChecksum(e){return Se.checkChecksum(Pe.convertUPCEtoUPCA(e))}static determineNumSysAndCheckDigit(e,t){for(let n=0;n<=1;n++)for(let o=0;o<10;o++)if(t===this.NUMSYS_AND_CHECK_DIGIT_PATTERNS[n][o]){let c=String.fromCharCode(48+n),d=String.fromCharCode(48+o);return c+e+d}throw N.getNotFoundInstance()}getBarcodeFormat(){return ge.UPC_E}static convertUPCEtoUPCA(e){const t=e.slice(1,7).split("").map(c=>c.charCodeAt(0)),n=new G;n.append(e.charAt(0));let o=t[5];switch(o){case 0:case 1:case 2:n.appendChars(t,0,2),n.append(o),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(o);break}return e.length>=8&&n.append(e.charAt(7)),n.toString()}}Pe.MIDDLE_END_PATTERN=Int32Array.from([1,1,1,1,1,1]),Pe.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 qt extends mt{constructor(e){super();let t=e==null?null:e.get(Z.POSSIBLE_FORMATS),n=[];s(t)?(n.push(new zt),n.push(new ct),n.push(new An),n.push(new Pe)):(t.indexOf(ge.EAN_13)>-1&&n.push(new zt),t.indexOf(ge.UPC_A)>-1&&n.push(new ct),t.indexOf(ge.EAN_8)>-1&&n.push(new An),t.indexOf(ge.UPC_E)>-1&&n.push(new Pe)),this.readers=n}decodeRow(e,t,n){for(let o of this.readers)try{const c=o.decodeRow(e,t,n),d=c.getBarcodeFormat()===ge.EAN_13&&c.getText().charAt(0)==="0",h=n==null?null:n.get(Z.POSSIBLE_FORMATS),g=h==null||h.includes(ge.UPC_A);if(d&&g){const w=c.getRawBytes(),E=new Ce(c.getText().substring(1),w,w?w.length:null,c.getResultPoints(),ge.UPC_A);return E.putAllMetadata(c.getResultMetadata()),E}return c}catch{}throw new N}reset(){for(let e of this.readers)e.reset()}}class Ye extends mt{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(mt.patternMatchVariance(e,t[n],Ye.MAX_INDIVIDUAL_VARIANCE)<Ye.MAX_AVG_VARIANCE)return n;throw new N}static count(e){return ve.sum(new Int32Array(e))}static increment(e,t){let n=0,o=t[0];for(let c=1;c<e.length;c++)t[c]>o&&(o=t[c],n=c);e[n]++}static decrement(e,t){let n=0,o=t[0];for(let c=1;c<e.length;c++)t[c]<o&&(o=t[c],n=c);e[n]--}static isFinderPattern(e){let t=e[0]+e[1],n=t+e[2]+e[3],o=t/n;if(o>=Ye.MIN_FINDER_PATTERN_RATIO&&o<=Ye.MAX_FINDER_PATTERN_RATIO){let c=Number.MAX_SAFE_INTEGER,d=Number.MIN_SAFE_INTEGER;for(let h of e)h>d&&(d=h),h<c&&(c=h);return d<10*c}return!1}}Ye.MAX_AVG_VARIANCE=.2,Ye.MAX_INDIVIDUAL_VARIANCE=.45,Ye.MIN_FINDER_PATTERN_RATIO=9.5/12,Ye.MAX_FINDER_PATTERN_RATIO=12.5/14;class Et{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 Et))return!1;const t=e;return this.value===t.value&&this.checksumPortion===t.checksumPortion}hashCode(){return this.value^this.checksumPortion}}class Tt{constructor(e,t,n,o,c){this.value=e,this.startEnd=t,this.value=e,this.startEnd=t,this.resultPoints=new Array,this.resultPoints.push(new ye(n,c)),this.resultPoints.push(new ye(o,c))}getValue(){return this.value}getStartEnd(){return this.startEnd}getResultPoints(){return this.resultPoints}equals(e){if(!(e instanceof Tt))return!1;const t=e;return this.value===t.value}hashCode(){return this.value}}class xt{constructor(){}static getRSSvalue(e,t,n){let o=0;for(let g of e)o+=g;let c=0,d=0,h=e.length;for(let g=0;g<h-1;g++){let w;for(w=1,d|=1<<g;w<e[g];w++,d&=~(1<<g)){let E=xt.combins(o-w-1,h-g-2);if(n&&d===0&&o-w-(h-g-1)>=h-g-1&&(E-=xt.combins(o-w-(h-g),h-g-2)),h-g-1>1){let A=0;for(let S=o-w-(h-g-2);S>t;S--)A+=xt.combins(o-w-S-1,h-g-3);E-=A*(h-1-g)}else o-w>t&&E--;c+=E}o-=w}return c}static combins(e,t){let n,o;e-t>t?(o=t,n=e-t):(o=e-t,n=t);let c=1,d=1;for(let h=e;h>n;h--)c*=h,d<=o&&(c/=d,d++);for(;d<=o;)c/=d,d++;return c}}class ze{static buildBitArray(e){let t=e.length*2-1;e[e.length-1].getRightChar()==null&&(t-=1);let n=12*t,o=new W(n),c=0,h=e[0].getRightChar().getValue();for(let g=11;g>=0;--g)h&1<<g&&o.set(c),c++;for(let g=1;g<e.length;++g){let w=e[g],E=w.getLeftChar().getValue();for(let A=11;A>=0;--A)E&1<<A&&o.set(c),c++;if(w.getRightChar()!=null){let A=w.getRightChar().getValue();for(let S=11;S>=0;--S)A&1<<S&&o.set(c),c++}}return o}}class un{constructor(e,t){t?this.decodedInformation=null:(this.finished=e,this.decodedInformation=t)}getDecodedInformation(){return this.decodedInformation}isFinished(){return this.finished}}class Wn{constructor(e){this.newPosition=e}getNewPosition(){return this.newPosition}}class Zt extends Wn{constructor(e,t){super(e),this.value=t}getValue(){return this.value}isFNC1(){return this.value===Zt.FNC1}}Zt.FNC1="$";class lr extends Wn{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 mn extends Wn{constructor(e,t,n){if(super(e),t<0||t>10||n<0||n>10)throw new F;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===mn.FNC1}isSecondDigitFNC1(){return this.secondDigit===mn.FNC1}isAnyFNC1(){return this.firstDigit===mn.FNC1||this.secondDigit===mn.FNC1}}mn.FNC1=10;class Ee{constructor(){}static parseFieldsInGeneralPurpose(e){if(!e)return null;if(e.length<2)throw new N;let t=e.substring(0,2);for(let c of Ee.TWO_DIGIT_DATA_LENGTH)if(c[0]===t)return c[1]===Ee.VARIABLE_LENGTH?Ee.processVariableAI(2,c[2],e):Ee.processFixedAI(2,c[1],e);if(e.length<3)throw new N;let n=e.substring(0,3);for(let c of Ee.THREE_DIGIT_DATA_LENGTH)if(c[0]===n)return c[1]===Ee.VARIABLE_LENGTH?Ee.processVariableAI(3,c[2],e):Ee.processFixedAI(3,c[1],e);for(let c of Ee.THREE_DIGIT_PLUS_DIGIT_DATA_LENGTH)if(c[0]===n)return c[1]===Ee.VARIABLE_LENGTH?Ee.processVariableAI(4,c[2],e):Ee.processFixedAI(4,c[1],e);if(e.length<4)throw new N;let o=e.substring(0,4);for(let c of Ee.FOUR_DIGIT_DATA_LENGTH)if(c[0]===o)return c[1]===Ee.VARIABLE_LENGTH?Ee.processVariableAI(4,c[2],e):Ee.processFixedAI(4,c[1],e);throw new N}static processFixedAI(e,t,n){if(n.length<e)throw new N;let o=n.substring(0,e);if(n.length<e+t)throw new N;let c=n.substring(e,e+t),d=n.substring(e+t),h="("+o+")"+c,g=Ee.parseFieldsInGeneralPurpose(d);return g==null?h:h+g}static processVariableAI(e,t,n){let o=n.substring(0,e),c;n.length<e+t?c=n.length:c=e+t;let d=n.substring(e,c),h=n.substring(c),g="("+o+")"+d,w=Ee.parseFieldsInGeneralPurpose(h);return w==null?g:g+w}}Ee.VARIABLE_LENGTH=[],Ee.TWO_DIGIT_DATA_LENGTH=[["00",18],["01",14],["02",14],["10",Ee.VARIABLE_LENGTH,20],["11",6],["12",6],["13",6],["15",6],["17",6],["20",2],["21",Ee.VARIABLE_LENGTH,20],["22",Ee.VARIABLE_LENGTH,29],["30",Ee.VARIABLE_LENGTH,8],["37",Ee.VARIABLE_LENGTH,8],["90",Ee.VARIABLE_LENGTH,30],["91",Ee.VARIABLE_LENGTH,30],["92",Ee.VARIABLE_LENGTH,30],["93",Ee.VARIABLE_LENGTH,30],["94",Ee.VARIABLE_LENGTH,30],["95",Ee.VARIABLE_LENGTH,30],["96",Ee.VARIABLE_LENGTH,30],["97",Ee.VARIABLE_LENGTH,3],["98",Ee.VARIABLE_LENGTH,30],["99",Ee.VARIABLE_LENGTH,30]],Ee.THREE_DIGIT_DATA_LENGTH=[["240",Ee.VARIABLE_LENGTH,30],["241",Ee.VARIABLE_LENGTH,30],["242",Ee.VARIABLE_LENGTH,6],["250",Ee.VARIABLE_LENGTH,30],["251",Ee.VARIABLE_LENGTH,30],["253",Ee.VARIABLE_LENGTH,17],["254",Ee.VARIABLE_LENGTH,20],["400",Ee.VARIABLE_LENGTH,30],["401",Ee.VARIABLE_LENGTH,30],["402",17],["403",Ee.VARIABLE_LENGTH,30],["410",13],["411",13],["412",13],["413",13],["414",13],["420",Ee.VARIABLE_LENGTH,20],["421",Ee.VARIABLE_LENGTH,15],["422",3],["423",Ee.VARIABLE_LENGTH,15],["424",3],["425",3],["426",3]],Ee.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",Ee.VARIABLE_LENGTH,15],["391",Ee.VARIABLE_LENGTH,18],["392",Ee.VARIABLE_LENGTH,15],["393",Ee.VARIABLE_LENGTH,18],["703",Ee.VARIABLE_LENGTH,30]],Ee.FOUR_DIGIT_DATA_LENGTH=[["7001",13],["7002",Ee.VARIABLE_LENGTH,30],["7003",10],["8001",14],["8002",Ee.VARIABLE_LENGTH,20],["8003",Ee.VARIABLE_LENGTH,30],["8004",Ee.VARIABLE_LENGTH,30],["8005",6],["8006",18],["8007",Ee.VARIABLE_LENGTH,30],["8008",Ee.VARIABLE_LENGTH,12],["8018",18],["8020",Ee.VARIABLE_LENGTH,25],["8100",6],["8101",10],["8102",2],["8110",Ee.VARIABLE_LENGTH,70],["8200",Ee.VARIABLE_LENGTH,70]];class Ir{constructor(e){this.buffer=new G,this.information=e}decodeAllCodes(e,t){let n=t,o=null;do{let c=this.decodeGeneralPurposeField(n,o),d=Ee.parseFieldsInGeneralPurpose(c.getNewString());if(d!=null&&e.append(d),c.isRemaining()?o=""+c.getRemainingValue():o=null,n===c.getNewPosition())break;n=c.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 c=this.extractNumericValueFromBitArray(e,4);return c===0?new mn(this.information.getSize(),mn.FNC1,mn.FNC1):new mn(this.information.getSize(),c-1,mn.FNC1)}let t=this.extractNumericValueFromBitArray(e,7),n=(t-8)/11,o=(t-8)%11;return new mn(e+7,n,o)}extractNumericValueFromBitArray(e,t){return Ir.extractNumericValueFromBitArray(this.information,e,t)}static extractNumericValueFromBitArray(e,t,n){let o=0;for(let c=0;c<n;++c)e.get(t+c)&&(o|=1<<n-c-1);return o}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 lr(this.current.getPosition(),this.buffer.toString(),n.getRemainingValue()):new lr(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 lr(this.current.getPosition(),this.buffer.toString()):t=new lr(this.current.getPosition(),this.buffer.toString(),e.getSecondDigit()),new un(!0,t)}if(this.buffer.append(e.getFirstDigit()),e.isSecondDigitFNC1()){let t=new lr(this.current.getPosition(),this.buffer.toString());return new un(!0,t)}this.buffer.append(e.getSecondDigit())}return this.isNumericToAlphaNumericLatch(this.current.getPosition())&&(this.current.setAlpha(),this.current.incrementPosition(4)),new un(!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 lr(this.current.getPosition(),this.buffer.toString());return new un(!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 un(!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 lr(this.current.getPosition(),this.buffer.toString());return new un(!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 un(!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 o=this.extractNumericValueFromBitArray(e,8);return o>=232&&o<253}decodeIsoIec646(e){let t=this.extractNumericValueFromBitArray(e,5);if(t===15)return new Zt(e+5,Zt.FNC1);if(t>=5&&t<15)return new Zt(e+5,"0"+(t-5));let n=this.extractNumericValueFromBitArray(e,7);if(n>=64&&n<90)return new Zt(e+7,""+(n+1));if(n>=90&&n<116)return new Zt(e+7,""+(n+7));let o=this.extractNumericValueFromBitArray(e,8),c;switch(o){case 232:c="!";break;case 233:c='"';break;case 234:c="%";break;case 235:c="&";break;case 236:c="'";break;case 237:c="(";break;case 238:c=")";break;case 239:c="*";break;case 240:c="+";break;case 241:c=",";break;case 242:c="-";break;case 243:c=".";break;case 244:c="/";break;case 245:c=":";break;case 246:c=";";break;case 247:c="<";break;case 248:c="=";break;case 249:c=">";break;case 250:c="?";break;case 251:c="_";break;case 252:c=" ";break;default:throw new F}return new Zt(e+8,c)}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 Zt(e+5,Zt.FNC1);if(t>=5&&t<15)return new Zt(e+5,"0"+(t-5));let n=this.extractNumericValueFromBitArray(e,6);if(n>=32&&n<58)return new Zt(e+6,""+(n+33));let o;switch(n){case 58:o="*";break;case 59:o=",";break;case 60:o="-";break;case 61:o=".";break;case 62:o="/";break;default:throw new Ue("Decoding invalid alphanumeric value: "+n)}return new Zt(e+6,o)}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 Mo{constructor(e){this.information=e,this.generalDecoder=new Ir(e)}getInformation(){return this.information}getGeneralDecoder(){return this.generalDecoder}}class tn extends Mo{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 o=0;o<4;++o){let c=this.getGeneralDecoder().extractNumericValueFromBitArray(t+10*o,10);c/100===0&&e.append("0"),c/10===0&&e.append("0"),e.append(c)}tn.appendCheckDigit(e,n)}static appendCheckDigit(e,t){let n=0;for(let o=0;o<13;o++){let c=e.charAt(o+t).charCodeAt(0)-48;n+=o&1?c:3*c}n=10-n%10,n===10&&(n=0),e.append(n)}}tn.GTIN_SIZE=40;class Nr extends tn{constructor(e){super(e)}parseInformation(){let e=new G;e.append("(01)");let t=e.length(),n=this.getGeneralDecoder().extractNumericValueFromBitArray(Nr.HEADER_SIZE,4);return e.append(n),this.encodeCompressedGtinWithoutAI(e,Nr.HEADER_SIZE+4,t),this.getGeneralDecoder().decodeAllCodes(e,Nr.HEADER_SIZE+44)}}Nr.HEADER_SIZE=4;class Oi extends Mo{constructor(e){super(e)}parseInformation(){let e=new G;return this.getGeneralDecoder().decodeAllCodes(e,Oi.HEADER_SIZE)}}Oi.HEADER_SIZE=5;class Mi extends tn{constructor(e){super(e)}encodeCompressedWeight(e,t,n){let o=this.getGeneralDecoder().extractNumericValueFromBitArray(t,n);this.addWeightCode(e,o);let c=this.checkWeight(o),d=1e5;for(let h=0;h<5;++h)c/d===0&&e.append("0"),d/=10;e.append(c)}}class Bn extends Mi{constructor(e){super(e)}parseInformation(){if(this.getInformation().getSize()!=Bn.HEADER_SIZE+Mi.GTIN_SIZE+Bn.WEIGHT_SIZE)throw new N;let e=new G;return this.encodeCompressedGtin(e,Bn.HEADER_SIZE),this.encodeCompressedWeight(e,Bn.HEADER_SIZE+Mi.GTIN_SIZE,Bn.WEIGHT_SIZE),e.toString()}}Bn.HEADER_SIZE=5,Bn.WEIGHT_SIZE=15;class wg extends Bn{constructor(e){super(e)}addWeightCode(e,t){e.append("(3103)")}checkWeight(e){return e}}class Cg extends Bn{constructor(e){super(e)}addWeightCode(e,t){t<1e4?e.append("(3202)"):e.append("(3203)")}checkWeight(e){return e<1e4?e:e-1e4}}class On extends tn{constructor(e){super(e)}parseInformation(){if(this.getInformation().getSize()<On.HEADER_SIZE+tn.GTIN_SIZE)throw new N;let e=new G;this.encodeCompressedGtin(e,On.HEADER_SIZE);let t=this.getGeneralDecoder().extractNumericValueFromBitArray(On.HEADER_SIZE+tn.GTIN_SIZE,On.LAST_DIGIT_SIZE);e.append("(392"),e.append(t),e.append(")");let n=this.getGeneralDecoder().decodeGeneralPurposeField(On.HEADER_SIZE+tn.GTIN_SIZE+On.LAST_DIGIT_SIZE,null);return e.append(n.getNewString()),e.toString()}}On.HEADER_SIZE=8,On.LAST_DIGIT_SIZE=2;class Yt extends tn{constructor(e){super(e)}parseInformation(){if(this.getInformation().getSize()<Yt.HEADER_SIZE+tn.GTIN_SIZE)throw new N;let e=new G;this.encodeCompressedGtin(e,Yt.HEADER_SIZE);let t=this.getGeneralDecoder().extractNumericValueFromBitArray(Yt.HEADER_SIZE+tn.GTIN_SIZE,Yt.LAST_DIGIT_SIZE);e.append("(393"),e.append(t),e.append(")");let n=this.getGeneralDecoder().extractNumericValueFromBitArray(Yt.HEADER_SIZE+tn.GTIN_SIZE+Yt.LAST_DIGIT_SIZE,Yt.FIRST_THREE_DIGITS_SIZE);n/100==0&&e.append("0"),n/10==0&&e.append("0"),e.append(n);let o=this.getGeneralDecoder().decodeGeneralPurposeField(Yt.HEADER_SIZE+tn.GTIN_SIZE+Yt.LAST_DIGIT_SIZE+Yt.FIRST_THREE_DIGITS_SIZE,null);return e.append(o.getNewString()),e.toString()}}Yt.HEADER_SIZE=8,Yt.LAST_DIGIT_SIZE=2,Yt.FIRST_THREE_DIGITS_SIZE=10;class yt extends Mi{constructor(e,t,n){super(e),this.dateCode=n,this.firstAIdigits=t}parseInformation(){if(this.getInformation().getSize()!=yt.HEADER_SIZE+yt.GTIN_SIZE+yt.WEIGHT_SIZE+yt.DATE_SIZE)throw new N;let e=new G;return this.encodeCompressedGtin(e,yt.HEADER_SIZE),this.encodeCompressedWeight(e,yt.HEADER_SIZE+yt.GTIN_SIZE,yt.WEIGHT_SIZE),this.encodeCompressedDate(e,yt.HEADER_SIZE+yt.GTIN_SIZE+yt.WEIGHT_SIZE),e.toString()}encodeCompressedDate(e,t){let n=this.getGeneralDecoder().extractNumericValueFromBitArray(t,yt.DATE_SIZE);if(n==38400)return;e.append("("),e.append(this.dateCode),e.append(")");let o=n%32;n/=32;let c=n%12+1;n/=12;let d=n;d/10==0&&e.append("0"),e.append(d),c/10==0&&e.append("0"),e.append(c),o/10==0&&e.append("0"),e.append(o)}addWeightCode(e,t){e.append("("),e.append(this.firstAIdigits),e.append(t/1e5),e.append(")")}checkWeight(e){return e%1e5}}yt.HEADER_SIZE=8,yt.WEIGHT_SIZE=20,yt.DATE_SIZE=16;function ja(b){try{if(b.get(1))return new Nr(b);if(!b.get(2))return new Oi(b);switch(Ir.extractNumericValueFromBitArray(b,1,4)){case 4:return new wg(b);case 5:return new Cg(b)}switch(Ir.extractNumericValueFromBitArray(b,1,5)){case 12:return new On(b);case 13:return new Yt(b)}switch(Ir.extractNumericValueFromBitArray(b,1,7)){case 56:return new yt(b,"310","11");case 57:return new yt(b,"320","11");case 58:return new yt(b,"310","13");case 59:return new yt(b,"320","13");case 60:return new yt(b,"310","15");case 61:return new yt(b,"320","15");case 62:return new yt(b,"310","17");case 63:return new yt(b,"320","17")}}catch(e){throw console.log(e),new Ue("unknown decoder: "+b)}}class Xn{constructor(e,t,n,o){this.leftchar=e,this.rightchar=t,this.finderpattern=n,this.maybeLast=o}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 Xn?Xn.equalsOrNull(e.leftchar,t.leftchar)&&Xn.equalsOrNull(e.rightchar,t.rightchar)&&Xn.equalsOrNull(e.finderpattern,t.finderpattern):!1}static equalsOrNull(e,t){return e===null?t===null:Xn.equals(e,t)}hashCode(){return this.leftchar.getValue()^this.rightchar.getValue()^this.finderpattern.getValue()}}class Do{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 Do?this.checkEqualitity(e,t)&&e.wasReversed===t.wasReversed:!1}checkEqualitity(e,t){if(!e||!t)return;let n;return e.forEach((o,c)=>{t.forEach(d=>{o.getLeftChar().getValue()===d.getLeftChar().getValue()&&o.getRightChar().getValue()===d.getRightChar().getValue()&&o.getFinderPatter().getValue()===d.getFinderPatter().getValue()&&(n=!0)})}),n}}class le extends Ye{constructor(e){super(...arguments),this.pairs=new Array(le.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 le.constructResult(this.decodeRow2pairs(e,t))}catch(o){this.verbose&&console.log(o)}return this.pairs.length=0,this.startFromEven=!0,le.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(c){if(c instanceof N){if(!this.pairs.length)throw new N;n=!0}}if(this.checkChecksum())return this.pairs;let o;if(this.rows.length?o=!0:o=!1,this.storeRow(e,!1),o){let c=this.checkRowsBoolean(!1);if(c!=null||(c=this.checkRowsBoolean(!0),c!=null))return c}throw new N}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 o=this.rows[n];this.pairs.length=0;for(let d of e)this.pairs.push(d.getPairs());if(this.pairs.push(o.getPairs()),!le.isValidSequence(this.pairs))continue;if(this.checkChecksum())return this.pairs;let c=new Array(e);c.push(o);try{return this.checkRows(c,n+1)}catch(d){this.verbose&&console.log(d)}}throw new N}static isValidSequence(e){for(let t of le.FINDER_PATTERN_SEQUENCES){if(e.length>t.length)continue;let n=!0;for(let o=0;o<e.length;o++)if(e[o].getFinderPattern().getValue()!=t[o]){n=!1;break}if(n)return!0}return!1}storeRow(e,t){let n=0,o=!1,c=!1;for(;n<this.rows.length;){let d=this.rows[n];if(d.getRowNumber()>e){c=d.isEquivalent(this.pairs);break}o=d.isEquivalent(this.pairs),n++}c||o||le.isPartialRow(this.pairs,this.rows)||(this.rows.push(n,new Do(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 o of n.getPairs())for(let c of e)if(Xn.equals(o,c))break}}static isPartialRow(e,t){for(let n of t){let o=!0;for(let c of e){let d=!1;for(let h of n.getPairs())if(c.equals(h)){d=!0;break}if(!d){o=!1;break}}if(o)return!0}return!1}getRows(){return this.rows}static constructResult(e){let t=ze.buildBitArray(e),o=ja(t).parseInformation(),c=e[0].getFinderPattern().getResultPoints(),d=e[e.length-1].getFinderPattern().getResultPoints(),h=[c[0],c[1],d[0],d[1]];return new Ce(o,null,null,h,ge.RSS_EXPANDED,null)}checkChecksum(){let e=this.pairs.get(0),t=e.getLeftChar(),n=e.getRightChar();if(n==null)return!1;let o=n.getChecksumPortion(),c=2;for(let h=1;h<this.pairs.size();++h){let g=this.pairs.get(h);o+=g.getLeftChar().getChecksumPortion(),c++;let w=g.getRightChar();w!=null&&(o+=w.getChecksumPortion(),c++)}return o%=211,211*(c-4)+o==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 o=t.length%2==0;this.startFromEven&&(o=!o);let c,d=!0,h=-1;do this.findNextPair(e,t,h),c=this.parseFoundFinderPattern(e,n,o),c==null?h=le.getNextSecondBar(e,this.startEnd[0]):d=!1;while(d);let g=this.decodeDataCharacter(e,c,o,!0);if(!this.isEmptyPair(t)&&t[t.length-1].mustBeLast())throw new N;let w;try{w=this.decodeDataCharacter(e,c,o,!1)}catch(E){w=null,this.verbose&&console.log(E)}return new Xn(g,w,c,!0)}isEmptyPair(e){return e.length===0}findNextPair(e,t,n){let o=this.getDecodeFinderCounters();o[0]=0,o[1]=0,o[2]=0,o[3]=0;let c=e.getSize(),d;n>=0?d=n:this.isEmptyPair(t)?d=0:d=t[t.length-1].getFinderPattern().getStartEnd()[1];let h=t.length%2!=0;this.startFromEven&&(h=!h);let g=!1;for(;d<c&&(g=!e.get(d),!!g);)d++;let w=0,E=d;for(let A=d;A<c;A++)if(e.get(A)!=g)o[w]++;else{if(w==3){if(h&&le.reverseCounters(o),le.isFinderPattern(o)){this.startEnd[0]=E,this.startEnd[1]=A;return}h&&le.reverseCounters(o),E+=o[0]+o[1],o[0]=o[2],o[1]=o[3],o[2]=0,o[3]=0,w--}else w++;o[w]=1,g=!g}throw new N}static reverseCounters(e){let t=e.length;for(let n=0;n<t/2;++n){let o=e[n];e[n]=e[t-n-1],e[t-n-1]=o}}parseFoundFinderPattern(e,t,n){let o,c,d;if(n){let w=this.startEnd[0]-1;for(;w>=0&&!e.get(w);)w--;w++,o=this.startEnd[0]-w,c=w,d=this.startEnd[1]}else c=this.startEnd[0],d=e.getNextUnset(this.startEnd[1]+1),o=d-this.startEnd[1];let h=this.getDecodeFinderCounters();D.arraycopy(h,0,h,1,h.length-1),h[0]=o;let g;try{g=this.parseFinderValue(h,le.FINDER_PATTERNS)}catch{return null}return new Tt(g,[c,d],c,d,t)}decodeDataCharacter(e,t,n,o){let c=this.getDataCharacterCounters();for(let ut=0;ut<c.length;ut++)c[ut]=0;if(o)le.recordPatternInReverse(e,t.getStartEnd()[0],c);else{le.recordPattern(e,t.getStartEnd()[1],c);for(let ut=0,Wt=c.length-1;ut<Wt;ut++,Wt--){let fn=c[ut];c[ut]=c[Wt],c[Wt]=fn}}let d=17,h=ve.sum(new Int32Array(c))/d,g=(t.getStartEnd()[1]-t.getStartEnd()[0])/15;if(Math.abs(h-g)/g>.3)throw new N;let w=this.getOddCounts(),E=this.getEvenCounts(),A=this.getOddRoundingErrors(),S=this.getEvenRoundingErrors();for(let ut=0;ut<c.length;ut++){let Wt=1*c[ut]/h,fn=Wt+.5;if(fn<1){if(Wt<.3)throw new N;fn=1}else if(fn>8){if(Wt>8.7)throw new N;fn=8}let Or=ut/2;ut&1?(E[Or]=fn,S[Or]=Wt-fn):(w[Or]=fn,A[Or]=Wt-fn)}this.adjustOddEvenCounts(d);let B=4*t.getValue()+(n?0:2)+(o?0:1)-1,U=0,H=0;for(let ut=w.length-1;ut>=0;ut--){if(le.isNotA1left(t,n,o)){let Wt=le.WEIGHTS[B][2*ut];H+=w[ut]*Wt}U+=w[ut]}let Y=0;for(let ut=E.length-1;ut>=0;ut--)if(le.isNotA1left(t,n,o)){let Wt=le.WEIGHTS[B][2*ut+1];Y+=E[ut]*Wt}let oe=H+Y;if(U&1||U>13||U<4)throw new N;let ue=(13-U)/2,he=le.SYMBOL_WIDEST[ue],de=9-he,je=xt.getRSSvalue(w,he,!0),Fe=xt.getRSSvalue(E,de,!1),rn=le.EVEN_TOTAL_SUBSET[ue],Sn=le.GSUM[ue],on=je*rn+Fe+Sn;return new Et(on,oe)}static isNotA1left(e,t,n){return!(e.getValue()==0&&t&&n)}adjustOddEvenCounts(e){let t=ve.sum(new Int32Array(this.getOddCounts())),n=ve.sum(new Int32Array(this.getEvenCounts())),o=!1,c=!1;t>13?c=!0:t<4&&(o=!0);let d=!1,h=!1;n>13?h=!0:n<4&&(d=!0);let g=t+n-e,w=(t&1)==1,E=(n&1)==0;if(g==1)if(w){if(E)throw new N;c=!0}else{if(!E)throw new N;h=!0}else if(g==-1)if(w){if(E)throw new N;o=!0}else{if(!E)throw new N;d=!0}else if(g==0){if(w){if(!E)throw new N;t<n?(o=!0,h=!0):(c=!0,d=!0)}else if(E)throw new N}else throw new N;if(o){if(c)throw new N;le.increment(this.getOddCounts(),this.getOddRoundingErrors())}if(c&&le.decrement(this.getOddCounts(),this.getOddRoundingErrors()),d){if(h)throw new N;le.increment(this.getEvenCounts(),this.getOddRoundingErrors())}h&&le.decrement(this.getEvenCounts(),this.getEvenRoundingErrors())}}le.SYMBOL_WIDEST=[7,5,4,3,1],le.EVEN_TOTAL_SUBSET=[4,20,52,104,204],le.GSUM=[0,348,1388,2948,3988],le.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])],le.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]],le.FINDER_PAT_A=0,le.FINDER_PAT_B=1,le.FINDER_PAT_C=2,le.FINDER_PAT_D=3,le.FINDER_PAT_E=4,le.FINDER_PAT_F=5,le.FINDER_PATTERN_SEQUENCES=[[le.FINDER_PAT_A,le.FINDER_PAT_A],[le.FINDER_PAT_A,le.FINDER_PAT_B,le.FINDER_PAT_B],[le.FINDER_PAT_A,le.FINDER_PAT_C,le.FINDER_PAT_B,le.FINDER_PAT_D],[le.FINDER_PAT_A,le.FINDER_PAT_E,le.FINDER_PAT_B,le.FINDER_PAT_D,le.FINDER_PAT_C],[le.FINDER_PAT_A,le.FINDER_PAT_E,le.FINDER_PAT_B,le.FINDER_PAT_D,le.FINDER_PAT_D,le.FINDER_PAT_F],[le.FINDER_PAT_A,le.FINDER_PAT_E,le.FINDER_PAT_B,le.FINDER_PAT_D,le.FINDER_PAT_E,le.FINDER_PAT_F,le.FINDER_PAT_F],[le.FINDER_PAT_A,le.FINDER_PAT_A,le.FINDER_PAT_B,le.FINDER_PAT_B,le.FINDER_PAT_C,le.FINDER_PAT_C,le.FINDER_PAT_D,le.FINDER_PAT_D],[le.FINDER_PAT_A,le.FINDER_PAT_A,le.FINDER_PAT_B,le.FINDER_PAT_B,le.FINDER_PAT_C,le.FINDER_PAT_C,le.FINDER_PAT_D,le.FINDER_PAT_E,le.FINDER_PAT_E],[le.FINDER_PAT_A,le.FINDER_PAT_A,le.FINDER_PAT_B,le.FINDER_PAT_B,le.FINDER_PAT_C,le.FINDER_PAT_C,le.FINDER_PAT_D,le.FINDER_PAT_E,le.FINDER_PAT_F,le.FINDER_PAT_F],[le.FINDER_PAT_A,le.FINDER_PAT_A,le.FINDER_PAT_B,le.FINDER_PAT_B,le.FINDER_PAT_C,le.FINDER_PAT_D,le.FINDER_PAT_D,le.FINDER_PAT_E,le.FINDER_PAT_E,le.FINDER_PAT_F,le.FINDER_PAT_F]],le.MAX_PAIRS=11;class Eg extends Et{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 kt extends Ye{constructor(){super(...arguments),this.possibleLeftPairs=[],this.possibleRightPairs=[]}decodeRow(e,t,n){const o=this.decodePair(t,!1,e,n);kt.addOrTally(this.possibleLeftPairs,o),t.reverse();let c=this.decodePair(t,!0,e,n);kt.addOrTally(this.possibleRightPairs,c),t.reverse();for(let d of this.possibleLeftPairs)if(d.getCount()>1){for(let h of this.possibleRightPairs)if(h.getCount()>1&&kt.checkChecksum(d,h))return kt.constructResult(d,h)}throw new N}static addOrTally(e,t){if(t==null)return;let n=!1;for(let o of e)if(o.getValue()===t.getValue()){o.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(),o=new String(n).toString(),c=new G;for(let w=13-o.length;w>0;w--)c.append("0");c.append(o);let d=0;for(let w=0;w<13;w++){let E=c.charAt(w).charCodeAt(0)-48;d+=w&1?E:3*E}d=10-d%10,d===10&&(d=0),c.append(d.toString());let h=e.getFinderPattern().getResultPoints(),g=t.getFinderPattern().getResultPoints();return new Ce(c.toString(),null,0,[h[0],h[1],g[0],g[1]],ge.RSS_14,new Date().getTime())}static checkChecksum(e,t){let n=(e.getChecksumPortion()+16*t.getChecksumPortion())%79,o=9*e.getFinderPattern().getValue()+t.getFinderPattern().getValue();return o>72&&o--,o>8&&o--,n===o}decodePair(e,t,n,o){try{let c=this.findFinderPattern(e,t),d=this.parseFoundFinderPattern(e,n,t,c),h=o==null?null:o.get(Z.NEED_RESULT_POINT_CALLBACK);if(h!=null){let E=(c[0]+c[1])/2;t&&(E=e.getSize()-1-E),h.foundPossibleResultPoint(new ye(E,n))}let g=this.decodeDataCharacter(e,d,!0),w=this.decodeDataCharacter(e,d,!1);return new Eg(1597*g.getValue()+w.getValue(),g.getChecksumPortion()+4*w.getChecksumPortion(),d)}catch{return null}}decodeDataCharacter(e,t,n){let o=this.getDataCharacterCounters();for(let Y=0;Y<o.length;Y++)o[Y]=0;if(n)mt.recordPatternInReverse(e,t.getStartEnd()[0],o);else{mt.recordPattern(e,t.getStartEnd()[1]+1,o);for(let Y=0,oe=o.length-1;Y<oe;Y++,oe--){let ue=o[Y];o[Y]=o[oe],o[oe]=ue}}let c=n?16:15,d=ve.sum(new Int32Array(o))/c,h=this.getOddCounts(),g=this.getEvenCounts(),w=this.getOddRoundingErrors(),E=this.getEvenRoundingErrors();for(let Y=0;Y<o.length;Y++){let oe=o[Y]/d,ue=Math.floor(oe+.5);ue<1?ue=1:ue>8&&(ue=8);let he=Math.floor(Y/2);Y&1?(g[he]=ue,E[he]=oe-ue):(h[he]=ue,w[he]=oe-ue)}this.adjustOddEvenCounts(n,c);let A=0,S=0;for(let Y=h.length-1;Y>=0;Y--)S*=9,S+=h[Y],A+=h[Y];let B=0,U=0;for(let Y=g.length-1;Y>=0;Y--)B*=9,B+=g[Y],U+=g[Y];let H=S+3*B;if(n){if(A&1||A>12||A<4)throw new N;let Y=(12-A)/2,oe=kt.OUTSIDE_ODD_WIDEST[Y],ue=9-oe,he=xt.getRSSvalue(h,oe,!1),de=xt.getRSSvalue(g,ue,!0),je=kt.OUTSIDE_EVEN_TOTAL_SUBSET[Y],Fe=kt.OUTSIDE_GSUM[Y];return new Et(he*je+de+Fe,H)}else{if(U&1||U>10||U<4)throw new N;let Y=(10-U)/2,oe=kt.INSIDE_ODD_WIDEST[Y],ue=9-oe,he=xt.getRSSvalue(h,oe,!0),de=xt.getRSSvalue(g,ue,!1),je=kt.INSIDE_ODD_TOTAL_SUBSET[Y],Fe=kt.INSIDE_GSUM[Y];return new Et(de*je+he+Fe,H)}}findFinderPattern(e,t){let n=this.getDecodeFinderCounters();n[0]=0,n[1]=0,n[2]=0,n[3]=0;let o=e.getSize(),c=!1,d=0;for(;d<o&&(c=!e.get(d),t!==c);)d++;let h=0,g=d;for(let w=d;w<o;w++)if(e.get(w)!==c)n[h]++;else{if(h===3){if(Ye.isFinderPattern(n))return[g,w];g+=n[0]+n[1],n[0]=n[2],n[1]=n[3],n[2]=0,n[3]=0,h--}else h++;n[h]=1,c=!c}throw new N}parseFoundFinderPattern(e,t,n,o){let c=e.get(o[0]),d=o[0]-1;for(;d>=0&&c!==e.get(d);)d--;d++;const h=o[0]-d,g=this.getDecodeFinderCounters(),w=new Int32Array(g.length);D.arraycopy(g,0,w,1,g.length-1),w[0]=h;const E=this.parseFinderValue(w,kt.FINDER_PATTERNS);let A=d,S=o[1];return n&&(A=e.getSize()-1-A,S=e.getSize()-1-S),new Tt(E,[d,o[1]],A,S,t)}adjustOddEvenCounts(e,t){let n=ve.sum(new Int32Array(this.getOddCounts())),o=ve.sum(new Int32Array(this.getEvenCounts())),c=!1,d=!1,h=!1,g=!1;e?(n>12?d=!0:n<4&&(c=!0),o>12?g=!0:o<4&&(h=!0)):(n>11?d=!0:n<5&&(c=!0),o>10?g=!0:o<4&&(h=!0));let w=n+o-t,E=(n&1)===(e?1:0),A=(o&1)===1;if(w===1)if(E){if(A)throw new N;d=!0}else{if(!A)throw new N;g=!0}else if(w===-1)if(E){if(A)throw new N;c=!0}else{if(!A)throw new N;h=!0}else if(w===0){if(E){if(!A)throw new N;n<o?(c=!0,g=!0):(d=!0,h=!0)}else if(A)throw new N}else throw new N;if(c){if(d)throw new N;Ye.increment(this.getOddCounts(),this.getOddRoundingErrors())}if(d&&Ye.decrement(this.getOddCounts(),this.getOddRoundingErrors()),h){if(g)throw new N;Ye.increment(this.getEvenCounts(),this.getOddRoundingErrors())}g&&Ye.decrement(this.getEvenCounts(),this.getEvenRoundingErrors())}}kt.OUTSIDE_EVEN_TOTAL_SUBSET=[1,10,34,70,126],kt.INSIDE_ODD_TOTAL_SUBSET=[4,20,48,81],kt.OUTSIDE_GSUM=[0,161,961,2015,2715],kt.INSIDE_GSUM=[0,336,1036,1516],kt.OUTSIDE_ODD_WIDEST=[8,6,4,3,1],kt.INSIDE_ODD_WIDEST=[2,4,6,8],kt.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 Tr extends mt{constructor(e,t){super(),this.readers=[],this.verbose=t===!0;const n=e?e.get(Z.POSSIBLE_FORMATS):null,o=e&&e.get(Z.ASSUME_CODE_39_CHECK_DIGIT)!==void 0;n?((n.includes(ge.EAN_13)||n.includes(ge.UPC_A)||n.includes(ge.EAN_8)||n.includes(ge.UPC_E))&&this.readers.push(new qt(e)),n.includes(ge.CODE_39)&&this.readers.push(new bt(o)),n.includes(ge.CODE_128)&&this.readers.push(new me),n.includes(ge.ITF)&&this.readers.push(new tt),n.includes(ge.RSS_14)&&this.readers.push(new kt),n.includes(ge.RSS_EXPANDED)&&this.readers.push(new le(this.verbose))):(this.readers.push(new qt(e)),this.readers.push(new bt),this.readers.push(new qt(e)),this.readers.push(new me),this.readers.push(new tt),this.readers.push(new kt),this.readers.push(new le(this.verbose)))}decodeRow(e,t,n){for(let o=0;o<this.readers.length;o++)try{return this.readers[o].decodeRow(e,t,n)}catch{}throw new N}reset(){this.readers.forEach(e=>e.reset())}}class yg extends we{constructor(e=500,t){super(new Tr(t),e,t)}}class nt{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 qe{constructor(e,t,n,o,c,d){this.versionNumber=e,this.symbolSizeRows=t,this.symbolSizeColumns=n,this.dataRegionSizeRows=o,this.dataRegionSizeColumns=c,this.ecBlocks=d;let h=0;const g=d.getECCodewords(),w=d.getECBlocks();for(let E of w)h+=E.getCount()*(E.getDataCodewords()+g);this.totalCodewords=h}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||t&1)throw new F;for(let n of qe.VERSIONS)if(n.symbolSizeRows===e&&n.symbolSizeColumns===t)return n;throw new F}toString(){return""+this.versionNumber}static buildVersions(){return[new qe(1,10,10,8,8,new nt(5,new Je(1,3))),new qe(2,12,12,10,10,new nt(7,new Je(1,5))),new qe(3,14,14,12,12,new nt(10,new Je(1,8))),new qe(4,16,16,14,14,new nt(12,new Je(1,12))),new qe(5,18,18,16,16,new nt(14,new Je(1,18))),new qe(6,20,20,18,18,new nt(18,new Je(1,22))),new qe(7,22,22,20,20,new nt(20,new Je(1,30))),new qe(8,24,24,22,22,new nt(24,new Je(1,36))),new qe(9,26,26,24,24,new nt(28,new Je(1,44))),new qe(10,32,32,14,14,new nt(36,new Je(1,62))),new qe(11,36,36,16,16,new nt(42,new Je(1,86))),new qe(12,40,40,18,18,new nt(48,new Je(1,114))),new qe(13,44,44,20,20,new nt(56,new Je(1,144))),new qe(14,48,48,22,22,new nt(68,new Je(1,174))),new qe(15,52,52,24,24,new nt(42,new Je(2,102))),new qe(16,64,64,14,14,new nt(56,new Je(2,140))),new qe(17,72,72,16,16,new nt(36,new Je(4,92))),new qe(18,80,80,18,18,new nt(48,new Je(4,114))),new qe(19,88,88,20,20,new nt(56,new Je(4,144))),new qe(20,96,96,22,22,new nt(68,new Je(4,174))),new qe(21,104,104,24,24,new nt(56,new Je(6,136))),new qe(22,120,120,18,18,new nt(68,new Je(6,175))),new qe(23,132,132,20,20,new nt(62,new Je(8,163))),new qe(24,144,144,22,22,new nt(62,new Je(8,156),new Je(2,155))),new qe(25,8,18,6,16,new nt(7,new Je(1,5))),new qe(26,8,32,6,14,new nt(11,new Je(1,10))),new qe(27,12,26,10,24,new nt(14,new Je(1,16))),new qe(28,12,36,10,16,new nt(18,new Je(1,22))),new qe(29,16,36,14,16,new nt(24,new Je(1,32))),new qe(30,16,48,14,22,new nt(28,new Je(1,49)))]}}qe.VERSIONS=qe.buildVersions();class vo{constructor(e){const t=e.getHeight();if(t<8||t>144||t&1)throw new F;this.version=vo.readVersion(e),this.mappingBitMatrix=this.extractDataRegion(e),this.readMappingMatrix=new z(this.mappingBitMatrix.getWidth(),this.mappingBitMatrix.getHeight())}getVersion(){return this.version}static readVersion(e){const t=e.getHeight(),n=e.getWidth();return qe.getVersionForDimensions(t,n)}readCodewords(){const e=new Int8Array(this.version.getTotalCodewords());let t=0,n=4,o=0;const c=this.mappingBitMatrix.getHeight(),d=this.mappingBitMatrix.getWidth();let h=!1,g=!1,w=!1,E=!1;do if(n===c&&o===0&&!h)e[t++]=this.readCorner1(c,d)&255,n-=2,o+=2,h=!0;else if(n===c-2&&o===0&&d&3&&!g)e[t++]=this.readCorner2(c,d)&255,n-=2,o+=2,g=!0;else if(n===c+4&&o===2&&!(d&7)&&!w)e[t++]=this.readCorner3(c,d)&255,n-=2,o+=2,w=!0;else if(n===c-2&&o===0&&(d&7)===4&&!E)e[t++]=this.readCorner4(c,d)&255,n-=2,o+=2,E=!0;else{do n<c&&o>=0&&!this.readMappingMatrix.get(o,n)&&(e[t++]=this.readUtah(n,o,c,d)&255),n-=2,o+=2;while(n>=0&&o<d);n+=1,o+=3;do n>=0&&o<d&&!this.readMappingMatrix.get(o,n)&&(e[t++]=this.readUtah(n,o,c,d)&255),n+=2,o-=2;while(n<c&&o>=0);n+=3,o+=1}while(n<c||o<d);if(t!==this.version.getTotalCodewords())throw new F;return e}readModule(e,t,n,o){return e<0&&(e+=n,t+=4-(n+4&7)),t<0&&(t+=o,e+=4-(o+4&7)),this.readMappingMatrix.set(t,e),this.mappingBitMatrix.get(t,e)}readUtah(e,t,n,o){let c=0;return this.readModule(e-2,t-2,n,o)&&(c|=1),c<<=1,this.readModule(e-2,t-1,n,o)&&(c|=1),c<<=1,this.readModule(e-1,t-2,n,o)&&(c|=1),c<<=1,this.readModule(e-1,t-1,n,o)&&(c|=1),c<<=1,this.readModule(e-1,t,n,o)&&(c|=1),c<<=1,this.readModule(e,t-2,n,o)&&(c|=1),c<<=1,this.readModule(e,t-1,n,o)&&(c|=1),c<<=1,this.readModule(e,t,n,o)&&(c|=1),c}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 y("Dimension of bitMatrix must match the version size");const o=this.version.getDataRegionSizeRows(),c=this.version.getDataRegionSizeColumns(),d=t/o|0,h=n/c|0,g=d*o,w=h*c,E=new z(w,g);for(let A=0;A<d;++A){const S=A*o;for(let B=0;B<h;++B){const U=B*c;for(let H=0;H<o;++H){const Y=A*(o+2)+1+H,oe=S+H;for(let ue=0;ue<c;++ue){const he=B*(c+2)+1+ue;if(e.get(he,Y)){const de=U+ue;E.set(de,oe)}}}}}return E}}class Po{constructor(e,t){this.numDataCodewords=e,this.codewords=t}static getDataBlocks(e,t){const n=t.getECBlocks();let o=0;const c=n.getECBlocks();for(let H of c)o+=H.getCount();const d=new Array(o);let h=0;for(let H of c)for(let Y=0;Y<H.getCount();Y++){const oe=H.getDataCodewords(),ue=n.getECCodewords()+oe;d[h++]=new Po(oe,new Uint8Array(ue))}const w=d[0].codewords.length-n.getECCodewords(),E=w-1;let A=0;for(let H=0;H<E;H++)for(let Y=0;Y<h;Y++)d[Y].codewords[H]=e[A++];const S=t.getVersionNumber()===24,B=S?8:h;for(let H=0;H<B;H++)d[H].codewords[w-1]=e[A++];const U=d[0].codewords.length;for(let H=w;H<U;H++)for(let Y=0;Y<h;Y++){const oe=S?(Y+8)%h:Y,ue=S&&oe>7?H-1:H;d[oe].codewords[ue]=e[A++]}if(A!==e.length)throw new y;return d}getNumDataCodewords(){return this.numDataCodewords}getCodewords(){return this.codewords}}class Lo{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 y(""+e);let t=0,n=this.bitOffset,o=this.byteOffset;const c=this.bytes;if(n>0){const d=8-n,h=e<d?e:d,g=d-h,w=255>>8-h<<g;t=(c[o]&w)>>g,e-=h,n+=h,n===8&&(n=0,o++)}if(e>0){for(;e>=8;)t=t<<8|c[o]&255,o++,e-=8;if(e>0){const d=8-e,h=255>>d<<d;t=t<<e|(c[o]&h)>>d,n+=e}}return this.bitOffset=n,this.byteOffset=o,t}available(){return 8*(this.bytes.length-this.byteOffset)-this.bitOffset}}var vt;(function(b){b[b.PAD_ENCODE=0]="PAD_ENCODE",b[b.ASCII_ENCODE=1]="ASCII_ENCODE",b[b.C40_ENCODE=2]="C40_ENCODE",b[b.TEXT_ENCODE=3]="TEXT_ENCODE",b[b.ANSIX12_ENCODE=4]="ANSIX12_ENCODE",b[b.EDIFACT_ENCODE=5]="EDIFACT_ENCODE",b[b.BASE256_ENCODE=6]="BASE256_ENCODE"})(vt||(vt={}));class $n{static decode(e){const t=new Lo(e),n=new G,o=new G,c=new Array;let d=vt.ASCII_ENCODE;do if(d===vt.ASCII_ENCODE)d=this.decodeAsciiSegment(t,n,o);else{switch(d){case vt.C40_ENCODE:this.decodeC40Segment(t,n);break;case vt.TEXT_ENCODE:this.decodeTextSegment(t,n);break;case vt.ANSIX12_ENCODE:this.decodeAnsiX12Segment(t,n);break;case vt.EDIFACT_ENCODE:this.decodeEdifactSegment(t,n);break;case vt.BASE256_ENCODE:this.decodeBase256Segment(t,n,c);break;default:throw new F}d=vt.ASCII_ENCODE}while(d!==vt.PAD_ENCODE&&t.available()>0);return o.length()>0&&n.append(o.toString()),new et(e,n.toString(),c.length===0?null:c,null)}static decodeAsciiSegment(e,t,n){let o=!1;do{let c=e.readBits(8);if(c===0)throw new F;if(c<=128)return o&&(c+=128),t.append(String.fromCharCode(c-1)),vt.ASCII_ENCODE;if(c===129)return vt.PAD_ENCODE;if(c<=229){const d=c-130;d<10&&t.append("0"),t.append(""+d)}else switch(c){case 230:return vt.C40_ENCODE;case 231:return vt.BASE256_ENCODE;case 232:t.append("");break;case 233:case 234:break;case 235:o=!0;break;case 236:t.append("[)>05"),n.insert(0,"");break;case 237:t.append("[)>06"),n.insert(0,"");break;case 238:return vt.ANSIX12_ENCODE;case 239:return vt.TEXT_ENCODE;case 240:return vt.EDIFACT_ENCODE;case 241:break;default:if(c!==254||e.available()!==0)throw new F;break}}while(e.available()>0);return vt.ASCII_ENCODE}static decodeC40Segment(e,t){let n=!1;const o=[];let c=0;do{if(e.available()===8)return;const d=e.readBits(8);if(d===254)return;this.parseTwoBytes(d,e.readBits(8),o);for(let h=0;h<3;h++){const g=o[h];switch(c){case 0:if(g<3)c=g+1;else if(g<this.C40_BASIC_SET_CHARS.length){const w=this.C40_BASIC_SET_CHARS[g];n?(t.append(String.fromCharCode(w.charCodeAt(0)+128)),n=!1):t.append(w)}else throw new F;break;case 1:n?(t.append(String.fromCharCode(g+128)),n=!1):t.append(String.fromCharCode(g)),c=0;break;case 2:if(g<this.C40_SHIFT2_SET_CHARS.length){const w=this.C40_SHIFT2_SET_CHARS[g];n?(t.append(String.fromCharCode(w.charCodeAt(0)+128)),n=!1):t.append(w)}else switch(g){case 27:t.append("");break;case 30:n=!0;break;default:throw new F}c=0;break;case 3:n?(t.append(String.fromCharCode(g+224)),n=!1):t.append(String.fromCharCode(g+96)),c=0;break;default:throw new F}}}while(e.available()>0)}static decodeTextSegment(e,t){let n=!1,o=[],c=0;do{if(e.available()===8)return;const d=e.readBits(8);if(d===254)return;this.parseTwoBytes(d,e.readBits(8),o);for(let h=0;h<3;h++){const g=o[h];switch(c){case 0:if(g<3)c=g+1;else if(g<this.TEXT_BASIC_SET_CHARS.length){const w=this.TEXT_BASIC_SET_CHARS[g];n?(t.append(String.fromCharCode(w.charCodeAt(0)+128)),n=!1):t.append(w)}else throw new F;break;case 1:n?(t.append(String.fromCharCode(g+128)),n=!1):t.append(String.fromCharCode(g)),c=0;break;case 2:if(g<this.TEXT_SHIFT2_SET_CHARS.length){const w=this.TEXT_SHIFT2_SET_CHARS[g];n?(t.append(String.fromCharCode(w.charCodeAt(0)+128)),n=!1):t.append(w)}else switch(g){case 27:t.append("");break;case 30:n=!0;break;default:throw new F}c=0;break;case 3:if(g<this.TEXT_SHIFT3_SET_CHARS.length){const w=this.TEXT_SHIFT3_SET_CHARS[g];n?(t.append(String.fromCharCode(w.charCodeAt(0)+128)),n=!1):t.append(w),c=0}else throw new F;break;default:throw new F}}}while(e.available()>0)}static decodeAnsiX12Segment(e,t){const n=[];do{if(e.available()===8)return;const o=e.readBits(8);if(o===254)return;this.parseTwoBytes(o,e.readBits(8),n);for(let c=0;c<3;c++){const d=n[c];switch(d){case 0:t.append("\r");break;case 1:t.append("*");break;case 2:t.append(">");break;case 3:t.append(" ");break;default:if(d<14)t.append(String.fromCharCode(d+44));else if(d<40)t.append(String.fromCharCode(d+51));else throw new F;break}}}while(e.available()>0)}static parseTwoBytes(e,t,n){let o=(e<<8)+t-1,c=Math.floor(o/1600);n[0]=c,o-=c*1600,c=Math.floor(o/40),n[1]=c,n[2]=o-c*40}static decodeEdifactSegment(e,t){do{if(e.available()<=16)return;for(let n=0;n<4;n++){let o=e.readBits(6);if(o===31){const c=8-e.getBitOffset();c!==8&&e.readBits(c);return}o&32||(o|=64),t.append(String.fromCharCode(o))}}while(e.available()>0)}static decodeBase256Segment(e,t,n){let o=1+e.getByteOffset();const c=this.unrandomize255State(e.readBits(8),o++);let d;if(c===0?d=e.available()/8|0:c<250?d=c:d=250*(c-249)+this.unrandomize255State(e.readBits(8),o++),d<0)throw new F;const h=new Uint8Array(d);for(let g=0;g<d;g++){if(e.available()<8)throw new F;h[g]=this.unrandomize255State(e.readBits(8),o++)}n.push(h);try{t.append(K.decode(h,ee.ISO88591))}catch(g){throw new Ue("Platform does not support required encoding: "+g.message)}}static unrandomize255State(e,t){const n=149*t%255+1,o=e-n;return o>=0?o:o+256}}$n.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"],$n.C40_SHIFT2_SET_CHARS=["!",'"',"#","$","%","&","'","(",")","*","+",",","-",".","/",":",";","<","=",">","?","@","[","\\","]","^","_"],$n.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"],$n.TEXT_SHIFT2_SET_CHARS=$n.C40_SHIFT2_SET_CHARS,$n.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 bg{constructor(){this.rsDecoder=new Nt(De.DATA_MATRIX_FIELD_256)}decode(e){const t=new vo(e),n=t.getVersion(),o=t.readCodewords(),c=Po.getDataBlocks(o,n);let d=0;for(let w of c)d+=w.getNumDataCodewords();const h=new Uint8Array(d),g=c.length;for(let w=0;w<g;w++){const E=c[w],A=E.getCodewords(),S=E.getNumDataCodewords();this.correctErrors(A,S);for(let B=0;B<S;B++)h[B*g+w]=A[B]}return $n.decode(h)}correctErrors(e,t){const n=new Int32Array(e);try{this.rsDecoder.decode(n,e.length-t)}catch{throw new O}for(let o=0;o<t;o++)e[o]=n[o]}}class Bt{constructor(e){this.image=e,this.rectangleDetector=new Dt(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 N;t=this.shiftToModuleCenter(t);const n=t[0],o=t[1],c=t[2],d=t[3];let h=this.transitionsBetween(n,d)+1,g=this.transitionsBetween(c,d)+1;(h&1)===1&&(h+=1),(g&1)===1&&(g+=1),4*h<7*g&&4*g<7*h&&(h=g=Math.max(h,g));let w=Bt.sampleGrid(this.image,n,o,c,d,h,g);return new br(w,[n,o,c,d])}static shiftPoint(e,t,n){let o=(t.getX()-e.getX())/(n+1),c=(t.getY()-e.getY())/(n+1);return new ye(e.getX()+o,e.getY()+c)}static moveAway(e,t,n){let o=e.getX(),c=e.getY();return o<t?o-=1:o+=1,c<n?c-=1:c+=1,new ye(o,c)}detectSolid1(e){let t=e[0],n=e[1],o=e[3],c=e[2],d=this.transitionsBetween(t,n),h=this.transitionsBetween(n,o),g=this.transitionsBetween(o,c),w=this.transitionsBetween(c,t),E=d,A=[c,t,n,o];return E>h&&(E=h,A[0]=t,A[1]=n,A[2]=o,A[3]=c),E>g&&(E=g,A[0]=n,A[1]=o,A[2]=c,A[3]=t),E>w&&(A[0]=o,A[1]=c,A[2]=t,A[3]=n),A}detectSolid2(e){let t=e[0],n=e[1],o=e[2],c=e[3],d=this.transitionsBetween(t,c),h=Bt.shiftPoint(n,o,(d+1)*4),g=Bt.shiftPoint(o,n,(d+1)*4),w=this.transitionsBetween(h,t),E=this.transitionsBetween(g,c);return w<E?(e[0]=t,e[1]=n,e[2]=o,e[3]=c):(e[0]=n,e[1]=o,e[2]=c,e[3]=t),e}correctTopRight(e){let t=e[0],n=e[1],o=e[2],c=e[3],d=this.transitionsBetween(t,c),h=this.transitionsBetween(n,c),g=Bt.shiftPoint(t,n,(h+1)*4),w=Bt.shiftPoint(o,n,(d+1)*4);d=this.transitionsBetween(g,c),h=this.transitionsBetween(w,c);let E=new ye(c.getX()+(o.getX()-n.getX())/(d+1),c.getY()+(o.getY()-n.getY())/(d+1)),A=new ye(c.getX()+(t.getX()-n.getX())/(h+1),c.getY()+(t.getY()-n.getY())/(h+1));if(!this.isValid(E))return this.isValid(A)?A:null;if(!this.isValid(A))return E;let S=this.transitionsBetween(g,E)+this.transitionsBetween(w,E),B=this.transitionsBetween(g,A)+this.transitionsBetween(w,A);return S>B?E:A}shiftToModuleCenter(e){let t=e[0],n=e[1],o=e[2],c=e[3],d=this.transitionsBetween(t,c)+1,h=this.transitionsBetween(o,c)+1,g=Bt.shiftPoint(t,n,h*4),w=Bt.shiftPoint(o,n,d*4);d=this.transitionsBetween(g,c)+1,h=this.transitionsBetween(w,c)+1,(d&1)===1&&(d+=1),(h&1)===1&&(h+=1);let E=(t.getX()+n.getX()+o.getX()+c.getX())/4,A=(t.getY()+n.getY()+o.getY()+c.getY())/4;t=Bt.moveAway(t,E,A),n=Bt.moveAway(n,E,A),o=Bt.moveAway(o,E,A),c=Bt.moveAway(c,E,A);let S,B;return g=Bt.shiftPoint(t,n,h*4),g=Bt.shiftPoint(g,c,d*4),S=Bt.shiftPoint(n,t,h*4),S=Bt.shiftPoint(S,o,d*4),w=Bt.shiftPoint(o,c,h*4),w=Bt.shiftPoint(w,n,d*4),B=Bt.shiftPoint(c,o,h*4),B=Bt.shiftPoint(B,t,d*4),[g,S,w,B]}isValid(e){return e.getX()>=0&&e.getX()<this.image.getWidth()&&e.getY()>0&&e.getY()<this.image.getHeight()}static sampleGrid(e,t,n,o,c,d,h){return Rn.getInstance().sampleGrid(e,d,h,.5,.5,d-.5,.5,d-.5,h-.5,.5,h-.5,t.getX(),t.getY(),c.getX(),c.getY(),o.getX(),o.getY(),n.getX(),n.getY())}transitionsBetween(e,t){let n=Math.trunc(e.getX()),o=Math.trunc(e.getY()),c=Math.trunc(t.getX()),d=Math.trunc(t.getY()),h=Math.abs(d-o)>Math.abs(c-n);if(h){let H=n;n=o,o=H,H=c,c=d,d=H}let g=Math.abs(c-n),w=Math.abs(d-o),E=-g/2,A=o<d?1:-1,S=n<c?1:-1,B=0,U=this.image.get(h?o:n,h?n:o);for(let H=n,Y=o;H!==c;H+=S){let oe=this.image.get(h?Y:H,h?H:Y);if(oe!==U&&(B++,U=oe),E+=w,E>0){if(Y===d)break;Y+=A,E-=g}}return B}}class jn{constructor(){this.decoder=new bg}decode(e,t=null){let n,o;if(t!=null&&t.has(Z.PURE_BARCODE)){const w=jn.extractPureBits(e.getBlackMatrix());n=this.decoder.decode(w),o=jn.NO_POINTS}else{const w=new Bt(e.getBlackMatrix()).detect();n=this.decoder.decode(w.getBits()),o=w.getPoints()}const c=n.getRawBytes(),d=new Ce(n.getText(),c,8*c.length,o,ge.DATA_MATRIX,D.currentTimeMillis()),h=n.getByteSegments();h!=null&&d.putMetadata(be.BYTE_SEGMENTS,h);const g=n.getECLevel();return g!=null&&d.putMetadata(be.ERROR_CORRECTION_LEVEL,g),d}reset(){}static extractPureBits(e){const t=e.getTopLeftOnBit(),n=e.getBottomRightOnBit();if(t==null||n==null)throw new N;const o=this.moduleSize(t,e);let c=t[1];const d=n[1];let h=t[0];const w=(n[0]-h+1)/o,E=(d-c+1)/o;if(w<=0||E<=0)throw new N;const A=o/2;c+=A,h+=A;const S=new z(w,E);for(let B=0;B<E;B++){const U=c+B*o;for(let H=0;H<w;H++)e.get(h+H*o,U)&&S.set(H,B)}return S}static moduleSize(e,t){const n=t.getWidth();let o=e[0];const c=e[1];for(;o<n&&t.get(o,c);)o++;if(o===n)throw new N;const d=o-e[0];if(d===0)throw new N;return d}}jn.NO_POINTS=[];class Ag extends we{constructor(e=500){super(new jn,e)}}var kr;(function(b){b[b.L=0]="L",b[b.M=1]="M",b[b.Q=2]="Q",b[b.H=3]="H"})(kr||(kr={}));class gt{constructor(e,t,n){this.value=e,this.stringValue=t,this.bits=n,gt.FOR_BITS.set(n,this),gt.FOR_VALUE.set(e,this)}getValue(){return this.value}getBits(){return this.bits}static fromString(e){switch(e){case"L":return gt.L;case"M":return gt.M;case"Q":return gt.Q;case"H":return gt.H;default:throw new C(e+"not available")}}toString(){return this.stringValue}equals(e){if(!(e instanceof gt))return!1;const t=e;return this.value===t.value}static forBits(e){if(e<0||e>=gt.FOR_BITS.size)throw new y;return gt.FOR_BITS.get(e)}}gt.FOR_BITS=new Map,gt.FOR_VALUE=new Map,gt.L=new gt(kr.L,"L",1),gt.M=new gt(kr.M,"M",0),gt.Q=new gt(kr.Q,"Q",3),gt.H=new gt(kr.H,"H",2);class $t{constructor(e){this.errorCorrectionLevel=gt.forBits(e>>3&3),this.dataMask=e&7}static numBitsDiffering(e,t){return v.bitCount(e^t)}static decodeFormatInformation(e,t){const n=$t.doDecodeFormatInformation(e,t);return n!==null?n:$t.doDecodeFormatInformation(e^$t.FORMAT_INFO_MASK_QR,t^$t.FORMAT_INFO_MASK_QR)}static doDecodeFormatInformation(e,t){let n=Number.MAX_SAFE_INTEGER,o=0;for(const c of $t.FORMAT_INFO_DECODE_LOOKUP){const d=c[0];if(d===e||d===t)return new $t(c[1]);let h=$t.numBitsDiffering(e,d);h<n&&(o=c[1],n=h),e!==t&&(h=$t.numBitsDiffering(t,d),h<n&&(o=c[1],n=h))}return n<=3?new $t(o):null}getErrorCorrectionLevel(){return this.errorCorrectionLevel}getDataMask(){return this.dataMask}hashCode(){return this.errorCorrectionLevel.getBits()<<3|this.dataMask}equals(e){if(!(e instanceof $t))return!1;const t=e;return this.errorCorrectionLevel===t.errorCorrectionLevel&&this.dataMask===t.dataMask}}$t.FORMAT_INFO_MASK_QR=21522,$t.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 Q{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 Te{constructor(e,t,...n){this.versionNumber=e,this.alignmentPatternCenters=t,this.ecBlocks=n;let o=0;const c=n[0].getECCodewordsPerBlock(),d=n[0].getECBlocks();for(const h of d)o+=h.getCount()*(h.getDataCodewords()+c);this.totalCodewords=o}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 F;try{return this.getVersionForNumber((e-17)/4)}catch{throw new F}}static getVersionForNumber(e){if(e<1||e>40)throw new y;return Te.VERSIONS[e-1]}static decodeVersionInformation(e){let t=Number.MAX_SAFE_INTEGER,n=0;for(let o=0;o<Te.VERSION_DECODE_INFO.length;o++){const c=Te.VERSION_DECODE_INFO[o];if(c===e)return Te.getVersionForNumber(o+7);const d=$t.numBitsDiffering(e,c);d<t&&(n=o+7,t=d)}return t<=3?Te.getVersionForNumber(n):null}buildFunctionPattern(){const e=this.getDimensionForVersion(),t=new z(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 o=0;o<n;o++){const c=this.alignmentPatternCenters[o]-2;for(let d=0;d<n;d++)o===0&&(d===0||d===n-1)||o===n-1&&d===0||t.setRegion(this.alignmentPatternCenters[d]-2,c,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}}Te.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]),Te.VERSIONS=[new Te(1,new Int32Array(0),new Q(7,new R(1,19)),new Q(10,new R(1,16)),new Q(13,new R(1,13)),new Q(17,new R(1,9))),new Te(2,Int32Array.from([6,18]),new Q(10,new R(1,34)),new Q(16,new R(1,28)),new Q(22,new R(1,22)),new Q(28,new R(1,16))),new Te(3,Int32Array.from([6,22]),new Q(15,new R(1,55)),new Q(26,new R(1,44)),new Q(18,new R(2,17)),new Q(22,new R(2,13))),new Te(4,Int32Array.from([6,26]),new Q(20,new R(1,80)),new Q(18,new R(2,32)),new Q(26,new R(2,24)),new Q(16,new R(4,9))),new Te(5,Int32Array.from([6,30]),new Q(26,new R(1,108)),new Q(24,new R(2,43)),new Q(18,new R(2,15),new R(2,16)),new Q(22,new R(2,11),new R(2,12))),new Te(6,Int32Array.from([6,34]),new Q(18,new R(2,68)),new Q(16,new R(4,27)),new Q(24,new R(4,19)),new Q(28,new R(4,15))),new Te(7,Int32Array.from([6,22,38]),new Q(20,new R(2,78)),new Q(18,new R(4,31)),new Q(18,new R(2,14),new R(4,15)),new Q(26,new R(4,13),new R(1,14))),new Te(8,Int32Array.from([6,24,42]),new Q(24,new R(2,97)),new Q(22,new R(2,38),new R(2,39)),new Q(22,new R(4,18),new R(2,19)),new Q(26,new R(4,14),new R(2,15))),new Te(9,Int32Array.from([6,26,46]),new Q(30,new R(2,116)),new Q(22,new R(3,36),new R(2,37)),new Q(20,new R(4,16),new R(4,17)),new Q(24,new R(4,12),new R(4,13))),new Te(10,Int32Array.from([6,28,50]),new Q(18,new R(2,68),new R(2,69)),new Q(26,new R(4,43),new R(1,44)),new Q(24,new R(6,19),new R(2,20)),new Q(28,new R(6,15),new R(2,16))),new Te(11,Int32Array.from([6,30,54]),new Q(20,new R(4,81)),new Q(30,new R(1,50),new R(4,51)),new Q(28,new R(4,22),new R(4,23)),new Q(24,new R(3,12),new R(8,13))),new Te(12,Int32Array.from([6,32,58]),new Q(24,new R(2,92),new R(2,93)),new Q(22,new R(6,36),new R(2,37)),new Q(26,new R(4,20),new R(6,21)),new Q(28,new R(7,14),new R(4,15))),new Te(13,Int32Array.from([6,34,62]),new Q(26,new R(4,107)),new Q(22,new R(8,37),new R(1,38)),new Q(24,new R(8,20),new R(4,21)),new Q(22,new R(12,11),new R(4,12))),new Te(14,Int32Array.from([6,26,46,66]),new Q(30,new R(3,115),new R(1,116)),new Q(24,new R(4,40),new R(5,41)),new Q(20,new R(11,16),new R(5,17)),new Q(24,new R(11,12),new R(5,13))),new Te(15,Int32Array.from([6,26,48,70]),new Q(22,new R(5,87),new R(1,88)),new Q(24,new R(5,41),new R(5,42)),new Q(30,new R(5,24),new R(7,25)),new Q(24,new R(11,12),new R(7,13))),new Te(16,Int32Array.from([6,26,50,74]),new Q(24,new R(5,98),new R(1,99)),new Q(28,new R(7,45),new R(3,46)),new Q(24,new R(15,19),new R(2,20)),new Q(30,new R(3,15),new R(13,16))),new Te(17,Int32Array.from([6,30,54,78]),new Q(28,new R(1,107),new R(5,108)),new Q(28,new R(10,46),new R(1,47)),new Q(28,new R(1,22),new R(15,23)),new Q(28,new R(2,14),new R(17,15))),new Te(18,Int32Array.from([6,30,56,82]),new Q(30,new R(5,120),new R(1,121)),new Q(26,new R(9,43),new R(4,44)),new Q(28,new R(17,22),new R(1,23)),new Q(28,new R(2,14),new R(19,15))),new Te(19,Int32Array.from([6,30,58,86]),new Q(28,new R(3,113),new R(4,114)),new Q(26,new R(3,44),new R(11,45)),new Q(26,new R(17,21),new R(4,22)),new Q(26,new R(9,13),new R(16,14))),new Te(20,Int32Array.from([6,34,62,90]),new Q(28,new R(3,107),new R(5,108)),new Q(26,new R(3,41),new R(13,42)),new Q(30,new R(15,24),new R(5,25)),new Q(28,new R(15,15),new R(10,16))),new Te(21,Int32Array.from([6,28,50,72,94]),new Q(28,new R(4,116),new R(4,117)),new Q(26,new R(17,42)),new Q(28,new R(17,22),new R(6,23)),new Q(30,new R(19,16),new R(6,17))),new Te(22,Int32Array.from([6,26,50,74,98]),new Q(28,new R(2,111),new R(7,112)),new Q(28,new R(17,46)),new Q(30,new R(7,24),new R(16,25)),new Q(24,new R(34,13))),new Te(23,Int32Array.from([6,30,54,78,102]),new Q(30,new R(4,121),new R(5,122)),new Q(28,new R(4,47),new R(14,48)),new Q(30,new R(11,24),new R(14,25)),new Q(30,new R(16,15),new R(14,16))),new Te(24,Int32Array.from([6,28,54,80,106]),new Q(30,new R(6,117),new R(4,118)),new Q(28,new R(6,45),new R(14,46)),new Q(30,new R(11,24),new R(16,25)),new Q(30,new R(30,16),new R(2,17))),new Te(25,Int32Array.from([6,32,58,84,110]),new Q(26,new R(8,106),new R(4,107)),new Q(28,new R(8,47),new R(13,48)),new Q(30,new R(7,24),new R(22,25)),new Q(30,new R(22,15),new R(13,16))),new Te(26,Int32Array.from([6,30,58,86,114]),new Q(28,new R(10,114),new R(2,115)),new Q(28,new R(19,46),new R(4,47)),new Q(28,new R(28,22),new R(6,23)),new Q(30,new R(33,16),new R(4,17))),new Te(27,Int32Array.from([6,34,62,90,118]),new Q(30,new R(8,122),new R(4,123)),new Q(28,new R(22,45),new R(3,46)),new Q(30,new R(8,23),new R(26,24)),new Q(30,new R(12,15),new R(28,16))),new Te(28,Int32Array.from([6,26,50,74,98,122]),new Q(30,new R(3,117),new R(10,118)),new Q(28,new R(3,45),new R(23,46)),new Q(30,new R(4,24),new R(31,25)),new Q(30,new R(11,15),new R(31,16))),new Te(29,Int32Array.from([6,30,54,78,102,126]),new Q(30,new R(7,116),new R(7,117)),new Q(28,new R(21,45),new R(7,46)),new Q(30,new R(1,23),new R(37,24)),new Q(30,new R(19,15),new R(26,16))),new Te(30,Int32Array.from([6,26,52,78,104,130]),new Q(30,new R(5,115),new R(10,116)),new Q(28,new R(19,47),new R(10,48)),new Q(30,new R(15,24),new R(25,25)),new Q(30,new R(23,15),new R(25,16))),new Te(31,Int32Array.from([6,30,56,82,108,134]),new Q(30,new R(13,115),new R(3,116)),new Q(28,new R(2,46),new R(29,47)),new Q(30,new R(42,24),new R(1,25)),new Q(30,new R(23,15),new R(28,16))),new Te(32,Int32Array.from([6,34,60,86,112,138]),new Q(30,new R(17,115)),new Q(28,new R(10,46),new R(23,47)),new Q(30,new R(10,24),new R(35,25)),new Q(30,new R(19,15),new R(35,16))),new Te(33,Int32Array.from([6,30,58,86,114,142]),new Q(30,new R(17,115),new R(1,116)),new Q(28,new R(14,46),new R(21,47)),new Q(30,new R(29,24),new R(19,25)),new Q(30,new R(11,15),new R(46,16))),new Te(34,Int32Array.from([6,34,62,90,118,146]),new Q(30,new R(13,115),new R(6,116)),new Q(28,new R(14,46),new R(23,47)),new Q(30,new R(44,24),new R(7,25)),new Q(30,new R(59,16),new R(1,17))),new Te(35,Int32Array.from([6,30,54,78,102,126,150]),new Q(30,new R(12,121),new R(7,122)),new Q(28,new R(12,47),new R(26,48)),new Q(30,new R(39,24),new R(14,25)),new Q(30,new R(22,15),new R(41,16))),new Te(36,Int32Array.from([6,24,50,76,102,128,154]),new Q(30,new R(6,121),new R(14,122)),new Q(28,new R(6,47),new R(34,48)),new Q(30,new R(46,24),new R(10,25)),new Q(30,new R(2,15),new R(64,16))),new Te(37,Int32Array.from([6,28,54,80,106,132,158]),new Q(30,new R(17,122),new R(4,123)),new Q(28,new R(29,46),new R(14,47)),new Q(30,new R(49,24),new R(10,25)),new Q(30,new R(24,15),new R(46,16))),new Te(38,Int32Array.from([6,32,58,84,110,136,162]),new Q(30,new R(4,122),new R(18,123)),new Q(28,new R(13,46),new R(32,47)),new Q(30,new R(48,24),new R(14,25)),new Q(30,new R(42,15),new R(32,16))),new Te(39,Int32Array.from([6,26,54,82,110,138,166]),new Q(30,new R(20,117),new R(4,118)),new Q(28,new R(40,47),new R(7,48)),new Q(30,new R(43,24),new R(22,25)),new Q(30,new R(10,15),new R(67,16))),new Te(40,Int32Array.from([6,30,58,86,114,142,170]),new Q(30,new R(19,118),new R(6,119)),new Q(28,new R(18,47),new R(31,48)),new Q(30,new R(34,24),new R(34,25)),new Q(30,new R(20,15),new R(61,16)))];var Ft;(function(b){b[b.DATA_MASK_000=0]="DATA_MASK_000",b[b.DATA_MASK_001=1]="DATA_MASK_001",b[b.DATA_MASK_010=2]="DATA_MASK_010",b[b.DATA_MASK_011=3]="DATA_MASK_011",b[b.DATA_MASK_100=4]="DATA_MASK_100",b[b.DATA_MASK_101=5]="DATA_MASK_101",b[b.DATA_MASK_110=6]="DATA_MASK_110",b[b.DATA_MASK_111=7]="DATA_MASK_111"})(Ft||(Ft={}));class gn{constructor(e,t){this.value=e,this.isMasked=t}unmaskBitMatrix(e,t){for(let n=0;n<t;n++)for(let o=0;o<t;o++)this.isMasked(n,o)&&e.flip(o,n)}}gn.values=new Map([[Ft.DATA_MASK_000,new gn(Ft.DATA_MASK_000,(b,e)=>(b+e&1)===0)],[Ft.DATA_MASK_001,new gn(Ft.DATA_MASK_001,(b,e)=>(b&1)===0)],[Ft.DATA_MASK_010,new gn(Ft.DATA_MASK_010,(b,e)=>e%3===0)],[Ft.DATA_MASK_011,new gn(Ft.DATA_MASK_011,(b,e)=>(b+e)%3===0)],[Ft.DATA_MASK_100,new gn(Ft.DATA_MASK_100,(b,e)=>(Math.floor(b/2)+Math.floor(e/3)&1)===0)],[Ft.DATA_MASK_101,new gn(Ft.DATA_MASK_101,(b,e)=>b*e%6===0)],[Ft.DATA_MASK_110,new gn(Ft.DATA_MASK_110,(b,e)=>b*e%6<3)],[Ft.DATA_MASK_111,new gn(Ft.DATA_MASK_111,(b,e)=>(b+e+b*e%3&1)===0)]]);class Sg{constructor(e){const t=e.getHeight();if(t<21||(t&3)!==1)throw new F;this.bitMatrix=e}readFormatInformation(){if(this.parsedFormatInfo!==null&&this.parsedFormatInfo!==void 0)return this.parsedFormatInfo;let e=0;for(let c=0;c<6;c++)e=this.copyBit(c,8,e);e=this.copyBit(7,8,e),e=this.copyBit(8,8,e),e=this.copyBit(8,7,e);for(let c=5;c>=0;c--)e=this.copyBit(8,c,e);const t=this.bitMatrix.getHeight();let n=0;const o=t-7;for(let c=t-1;c>=o;c--)n=this.copyBit(8,c,n);for(let c=t-8;c<t;c++)n=this.copyBit(c,8,n);if(this.parsedFormatInfo=$t.decodeFormatInformation(e,n),this.parsedFormatInfo!==null)return this.parsedFormatInfo;throw new F}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 Te.getVersionForNumber(t);let n=0;const o=e-11;for(let d=5;d>=0;d--)for(let h=e-9;h>=o;h--)n=this.copyBit(h,d,n);let c=Te.decodeVersionInformation(n);if(c!==null&&c.getDimensionForVersion()===e)return this.parsedVersion=c,c;n=0;for(let d=5;d>=0;d--)for(let h=e-9;h>=o;h--)n=this.copyBit(d,h,n);if(c=Te.decodeVersionInformation(n),c!==null&&c.getDimensionForVersion()===e)return this.parsedVersion=c,c;throw new F}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=gn.values.get(e.getDataMask()),o=this.bitMatrix.getHeight();n.unmaskBitMatrix(this.bitMatrix,o);const c=t.buildFunctionPattern();let d=!0;const h=new Uint8Array(t.getTotalCodewords());let g=0,w=0,E=0;for(let A=o-1;A>0;A-=2){A===6&&A--;for(let S=0;S<o;S++){const B=d?o-1-S:S;for(let U=0;U<2;U++)c.get(A-U,B)||(E++,w<<=1,this.bitMatrix.get(A-U,B)&&(w|=1),E===8&&(h[g++]=w,E=0,w=0))}d=!d}if(g!==t.getTotalCodewords())throw new F;return h}remask(){if(this.parsedFormatInfo===null)return;const e=gn.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 o=t+1,c=e.getHeight();o<c;o++)e.get(t,o)!==e.get(o,t)&&(e.flip(o,t),e.flip(t,o))}}class Fo{constructor(e,t){this.numDataCodewords=e,this.codewords=t}static getDataBlocks(e,t,n){if(e.length!==t.getTotalCodewords())throw new y;const o=t.getECBlocksForLevel(n);let c=0;const d=o.getECBlocks();for(const U of d)c+=U.getCount();const h=new Array(c);let g=0;for(const U of d)for(let H=0;H<U.getCount();H++){const Y=U.getDataCodewords(),oe=o.getECCodewordsPerBlock()+Y;h[g++]=new Fo(Y,new Uint8Array(oe))}const w=h[0].codewords.length;let E=h.length-1;for(;E>=0&&h[E].codewords.length!==w;)E--;E++;const A=w-o.getECCodewordsPerBlock();let S=0;for(let U=0;U<A;U++)for(let H=0;H<g;H++)h[H].codewords[U]=e[S++];for(let U=E;U<g;U++)h[U].codewords[A]=e[S++];const B=h[0].codewords.length;for(let U=A;U<B;U++)for(let H=0;H<g;H++){const Y=H<E?U:U+1;h[H].codewords[Y]=e[S++]}return h}getNumDataCodewords(){return this.numDataCodewords}getCodewords(){return this.codewords}}var pn;(function(b){b[b.TERMINATOR=0]="TERMINATOR",b[b.NUMERIC=1]="NUMERIC",b[b.ALPHANUMERIC=2]="ALPHANUMERIC",b[b.STRUCTURED_APPEND=3]="STRUCTURED_APPEND",b[b.BYTE=4]="BYTE",b[b.ECI=5]="ECI",b[b.KANJI=6]="KANJI",b[b.FNC1_FIRST_POSITION=7]="FNC1_FIRST_POSITION",b[b.FNC1_SECOND_POSITION=8]="FNC1_SECOND_POSITION",b[b.HANZI=9]="HANZI"})(pn||(pn={}));class Re{constructor(e,t,n,o){this.value=e,this.stringValue=t,this.characterCountBitsForVersions=n,this.bits=o,Re.FOR_BITS.set(o,this),Re.FOR_VALUE.set(e,this)}static forBits(e){const t=Re.FOR_BITS.get(e);if(t===void 0)throw new y;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 Re))return!1;const t=e;return this.value===t.value}toString(){return this.stringValue}}Re.FOR_BITS=new Map,Re.FOR_VALUE=new Map,Re.TERMINATOR=new Re(pn.TERMINATOR,"TERMINATOR",Int32Array.from([0,0,0]),0),Re.NUMERIC=new Re(pn.NUMERIC,"NUMERIC",Int32Array.from([10,12,14]),1),Re.ALPHANUMERIC=new Re(pn.ALPHANUMERIC,"ALPHANUMERIC",Int32Array.from([9,11,13]),2),Re.STRUCTURED_APPEND=new Re(pn.STRUCTURED_APPEND,"STRUCTURED_APPEND",Int32Array.from([0,0,0]),3),Re.BYTE=new Re(pn.BYTE,"BYTE",Int32Array.from([8,16,16]),4),Re.ECI=new Re(pn.ECI,"ECI",Int32Array.from([0,0,0]),7),Re.KANJI=new Re(pn.KANJI,"KANJI",Int32Array.from([8,10,12]),8),Re.FNC1_FIRST_POSITION=new Re(pn.FNC1_FIRST_POSITION,"FNC1_FIRST_POSITION",Int32Array.from([0,0,0]),5),Re.FNC1_SECOND_POSITION=new Re(pn.FNC1_SECOND_POSITION,"FNC1_SECOND_POSITION",Int32Array.from([0,0,0]),9),Re.HANZI=new Re(pn.HANZI,"HANZI",Int32Array.from([8,10,12]),13);class At{static decode(e,t,n,o){const c=new Lo(e);let d=new G;const h=new Array;let g=-1,w=-1;try{let E=null,A=!1,S;do{if(c.available()<4)S=Re.TERMINATOR;else{const B=c.readBits(4);S=Re.forBits(B)}switch(S){case Re.TERMINATOR:break;case Re.FNC1_FIRST_POSITION:case Re.FNC1_SECOND_POSITION:A=!0;break;case Re.STRUCTURED_APPEND:if(c.available()<16)throw new F;g=c.readBits(8),w=c.readBits(8);break;case Re.ECI:const B=At.parseECIValue(c);if(E=V.getCharacterSetECIByValue(B),E===null)throw new F;break;case Re.HANZI:const U=c.readBits(4),H=c.readBits(S.getCharacterCountBits(t));U===At.GB2312_SUBSET&&At.decodeHanziSegment(c,d,H);break;default:const Y=c.readBits(S.getCharacterCountBits(t));switch(S){case Re.NUMERIC:At.decodeNumericSegment(c,d,Y);break;case Re.ALPHANUMERIC:At.decodeAlphanumericSegment(c,d,Y,A);break;case Re.BYTE:At.decodeByteSegment(c,d,Y,E,h,o);break;case Re.KANJI:At.decodeKanjiSegment(c,d,Y);break;default:throw new F}break}}while(S!==Re.TERMINATOR)}catch{throw new F}return new et(e,d.toString(),h.length===0?null:h,n===null?null:n.toString(),g,w)}static decodeHanziSegment(e,t,n){if(n*13>e.available())throw new F;const o=new Uint8Array(2*n);let c=0;for(;n>0;){const d=e.readBits(13);let h=d/96<<8&4294967295|d%96;h<959?h+=41377:h+=42657,o[c]=h>>8&255,o[c+1]=h&255,c+=2,n--}try{t.append(K.decode(o,ee.GB2312))}catch(d){throw new F(d)}}static decodeKanjiSegment(e,t,n){if(n*13>e.available())throw new F;const o=new Uint8Array(2*n);let c=0;for(;n>0;){const d=e.readBits(13);let h=d/192<<8&4294967295|d%192;h<7936?h+=33088:h+=49472,o[c]=h>>8,o[c+1]=h,c+=2,n--}try{t.append(K.decode(o,ee.SHIFT_JIS))}catch(d){throw new F(d)}}static decodeByteSegment(e,t,n,o,c,d){if(8*n>e.available())throw new F;const h=new Uint8Array(n);for(let w=0;w<n;w++)h[w]=e.readBits(8);let g;o===null?g=ee.guessEncoding(h,d):g=o.getName();try{t.append(K.decode(h,g))}catch(w){throw new F(w)}c.push(h)}static toAlphaNumericChar(e){if(e>=At.ALPHANUMERIC_CHARS.length)throw new F;return At.ALPHANUMERIC_CHARS[e]}static decodeAlphanumericSegment(e,t,n,o){const c=t.length();for(;n>1;){if(e.available()<11)throw new F;const d=e.readBits(11);t.append(At.toAlphaNumericChar(Math.floor(d/45))),t.append(At.toAlphaNumericChar(d%45)),n-=2}if(n===1){if(e.available()<6)throw new F;t.append(At.toAlphaNumericChar(e.readBits(6)))}if(o)for(let d=c;d<t.length();d++)t.charAt(d)==="%"&&(d<t.length()-1&&t.charAt(d+1)==="%"?t.deleteCharAt(d+1):t.setCharAt(d,""))}static decodeNumericSegment(e,t,n){for(;n>=3;){if(e.available()<10)throw new F;const o=e.readBits(10);if(o>=1e3)throw new F;t.append(At.toAlphaNumericChar(Math.floor(o/100))),t.append(At.toAlphaNumericChar(Math.floor(o/10)%10)),t.append(At.toAlphaNumericChar(o%10)),n-=3}if(n===2){if(e.available()<7)throw new F;const o=e.readBits(7);if(o>=100)throw new F;t.append(At.toAlphaNumericChar(Math.floor(o/10))),t.append(At.toAlphaNumericChar(o%10))}else if(n===1){if(e.available()<4)throw new F;const o=e.readBits(4);if(o>=10)throw new F;t.append(At.toAlphaNumericChar(o))}}static parseECIValue(e){const t=e.readBits(8);if(!(t&128))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 F}}At.ALPHANUMERIC_CHARS="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:",At.GB2312_SUBSET=1;class qa{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 Ig{constructor(){this.rsDecoder=new Nt(De.QR_CODE_FIELD_256)}decodeBooleanArray(e,t){return this.decodeBitMatrix(z.parseFromBooleanArray(e),t)}decodeBitMatrix(e,t){const n=new Sg(e);let o=null;try{return this.decodeBitMatrixParser(n,t)}catch(c){o=c}try{n.remask(),n.setMirror(!0),n.readVersion(),n.readFormatInformation(),n.mirror();const c=this.decodeBitMatrixParser(n,t);return c.setOther(new qa(!0)),c}catch(c){throw o!==null?o:c}}decodeBitMatrixParser(e,t){const n=e.readVersion(),o=e.readFormatInformation().getErrorCorrectionLevel(),c=e.readCodewords(),d=Fo.getDataBlocks(c,n,o);let h=0;for(const E of d)h+=E.getNumDataCodewords();const g=new Uint8Array(h);let w=0;for(const E of d){const A=E.getCodewords(),S=E.getNumDataCodewords();this.correctErrors(A,S);for(let B=0;B<S;B++)g[w++]=A[B]}return At.decode(g,n,o,t)}correctErrors(e,t){const n=new Int32Array(e);try{this.rsDecoder.decode(n,e.length-t)}catch{throw new O}for(let o=0;o<t;o++)e[o]=n[o]}}class Vo extends ye{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 o=Math.abs(e-this.estimatedModuleSize);return o<=1||o<=this.estimatedModuleSize}return!1}combineEstimate(e,t,n){const o=(this.getX()+t)/2,c=(this.getY()+e)/2,d=(this.estimatedModuleSize+n)/2;return new Vo(o,c,d)}}class Di{constructor(e,t,n,o,c,d,h){this.image=e,this.startX=t,this.startY=n,this.width=o,this.height=c,this.moduleSize=d,this.resultPointCallback=h,this.possibleCenters=[],this.crossCheckStateCount=new Int32Array(3)}find(){const e=this.startX,t=this.height,n=this.width,o=e+n,c=this.startY+t/2,d=new Int32Array(3),h=this.image;for(let g=0;g<t;g++){const w=c+(g&1?-Math.floor((g+1)/2):Math.floor((g+1)/2));d[0]=0,d[1]=0,d[2]=0;let E=e;for(;E<o&&!h.get(E,w);)E++;let A=0;for(;E<o;){if(h.get(E,w))if(A===1)d[1]++;else if(A===2){if(this.foundPatternCross(d)){const S=this.handlePossibleCenter(d,w,E);if(S!==null)return S}d[0]=d[2],d[1]=1,d[2]=0,A=1}else d[++A]++;else A===1&&A++,d[A]++;E++}if(this.foundPatternCross(d)){const S=this.handlePossibleCenter(d,w,o);if(S!==null)return S}}if(this.possibleCenters.length!==0)return this.possibleCenters[0];throw new N}static centerFromEnd(e,t){return t-e[2]-e[1]/2}foundPatternCross(e){const t=this.moduleSize,n=t/2;for(let o=0;o<3;o++)if(Math.abs(t-e[o])>=n)return!1;return!0}crossCheckVertical(e,t,n,o){const c=this.image,d=c.getHeight(),h=this.crossCheckStateCount;h[0]=0,h[1]=0,h[2]=0;let g=e;for(;g>=0&&c.get(t,g)&&h[1]<=n;)h[1]++,g--;if(g<0||h[1]>n)return NaN;for(;g>=0&&!c.get(t,g)&&h[0]<=n;)h[0]++,g--;if(h[0]>n)return NaN;for(g=e+1;g<d&&c.get(t,g)&&h[1]<=n;)h[1]++,g++;if(g===d||h[1]>n)return NaN;for(;g<d&&!c.get(t,g)&&h[2]<=n;)h[2]++,g++;if(h[2]>n)return NaN;const w=h[0]+h[1]+h[2];return 5*Math.abs(w-o)>=2*o?NaN:this.foundPatternCross(h)?Di.centerFromEnd(h,g):NaN}handlePossibleCenter(e,t,n){const o=e[0]+e[1]+e[2],c=Di.centerFromEnd(e,n),d=this.crossCheckVertical(t,c,2*e[1],o);if(!isNaN(d)){const h=(e[0]+e[1]+e[2])/3;for(const w of this.possibleCenters)if(w.aboutEquals(h,d,c))return w.combineEstimate(d,c,h);const g=new Vo(c,d,h);this.possibleCenters.push(g),this.resultPointCallback!==null&&this.resultPointCallback!==void 0&&this.resultPointCallback.foundPossibleResultPoint(g)}return null}}class Uo extends ye{constructor(e,t,n,o){super(e,t),this.estimatedModuleSize=n,this.count=o,o===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 o=Math.abs(e-this.estimatedModuleSize);return o<=1||o<=this.estimatedModuleSize}return!1}combineEstimate(e,t,n){const o=this.count+1,c=(this.count*this.getX()+t)/o,d=(this.count*this.getY()+e)/o,h=(this.count*this.estimatedModuleSize+n)/o;return new Uo(c,d,h,o)}}class Ng{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 Vt{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(Z.TRY_HARDER)!==void 0,n=e!=null&&e.get(Z.PURE_BARCODE)!==void 0,o=this.image,c=o.getHeight(),d=o.getWidth();let h=Math.floor(3*c/(4*Vt.MAX_MODULES));(h<Vt.MIN_SKIP||t)&&(h=Vt.MIN_SKIP);let g=!1;const w=new Int32Array(5);for(let A=h-1;A<c&&!g;A+=h){w[0]=0,w[1]=0,w[2]=0,w[3]=0,w[4]=0;let S=0;for(let B=0;B<d;B++)if(o.get(B,A))(S&1)===1&&S++,w[S]++;else if(S&1)w[S]++;else if(S===4)if(Vt.foundPatternCross(w)){if(this.handlePossibleCenter(w,A,B,n)===!0)if(h=2,this.hasSkipped===!0)g=this.haveMultiplyConfirmedCenters();else{const H=this.findRowSkip();H>w[2]&&(A+=H-w[2]-h,B=d-1)}else{w[0]=w[2],w[1]=w[3],w[2]=w[4],w[3]=1,w[4]=0,S=3;continue}S=0,w[0]=0,w[1]=0,w[2]=0,w[3]=0,w[4]=0}else w[0]=w[2],w[1]=w[3],w[2]=w[4],w[3]=1,w[4]=0,S=3;else w[++S]++;Vt.foundPatternCross(w)&&this.handlePossibleCenter(w,A,d,n)===!0&&(h=w[0],this.hasSkipped&&(g=this.haveMultiplyConfirmedCenters()))}const E=this.selectBestPatterns();return ye.orderBestPatterns(E),new Ng(E)}static centerFromEnd(e,t){return t-e[4]-e[3]-e[2]/2}static foundPatternCross(e){let t=0;for(let c=0;c<5;c++){const d=e[c];if(d===0)return!1;t+=d}if(t<7)return!1;const n=t/7,o=n/2;return Math.abs(n-e[0])<o&&Math.abs(n-e[1])<o&&Math.abs(3*n-e[2])<3*o&&Math.abs(n-e[3])<o&&Math.abs(n-e[4])<o}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,o){const c=this.getCrossCheckStateCount();let d=0;const h=this.image;for(;e>=d&&t>=d&&h.get(t-d,e-d);)c[2]++,d++;if(e<d||t<d)return!1;for(;e>=d&&t>=d&&!h.get(t-d,e-d)&&c[1]<=n;)c[1]++,d++;if(e<d||t<d||c[1]>n)return!1;for(;e>=d&&t>=d&&h.get(t-d,e-d)&&c[0]<=n;)c[0]++,d++;if(c[0]>n)return!1;const g=h.getHeight(),w=h.getWidth();for(d=1;e+d<g&&t+d<w&&h.get(t+d,e+d);)c[2]++,d++;if(e+d>=g||t+d>=w)return!1;for(;e+d<g&&t+d<w&&!h.get(t+d,e+d)&&c[3]<n;)c[3]++,d++;if(e+d>=g||t+d>=w||c[3]>=n)return!1;for(;e+d<g&&t+d<w&&h.get(t+d,e+d)&&c[4]<n;)c[4]++,d++;if(c[4]>=n)return!1;const E=c[0]+c[1]+c[2]+c[3]+c[4];return Math.abs(E-o)<2*o&&Vt.foundPatternCross(c)}crossCheckVertical(e,t,n,o){const c=this.image,d=c.getHeight(),h=this.getCrossCheckStateCount();let g=e;for(;g>=0&&c.get(t,g);)h[2]++,g--;if(g<0)return NaN;for(;g>=0&&!c.get(t,g)&&h[1]<=n;)h[1]++,g--;if(g<0||h[1]>n)return NaN;for(;g>=0&&c.get(t,g)&&h[0]<=n;)h[0]++,g--;if(h[0]>n)return NaN;for(g=e+1;g<d&&c.get(t,g);)h[2]++,g++;if(g===d)return NaN;for(;g<d&&!c.get(t,g)&&h[3]<n;)h[3]++,g++;if(g===d||h[3]>=n)return NaN;for(;g<d&&c.get(t,g)&&h[4]<n;)h[4]++,g++;if(h[4]>=n)return NaN;const w=h[0]+h[1]+h[2]+h[3]+h[4];return 5*Math.abs(w-o)>=2*o?NaN:Vt.foundPatternCross(h)?Vt.centerFromEnd(h,g):NaN}crossCheckHorizontal(e,t,n,o){const c=this.image,d=c.getWidth(),h=this.getCrossCheckStateCount();let g=e;for(;g>=0&&c.get(g,t);)h[2]++,g--;if(g<0)return NaN;for(;g>=0&&!c.get(g,t)&&h[1]<=n;)h[1]++,g--;if(g<0||h[1]>n)return NaN;for(;g>=0&&c.get(g,t)&&h[0]<=n;)h[0]++,g--;if(h[0]>n)return NaN;for(g=e+1;g<d&&c.get(g,t);)h[2]++,g++;if(g===d)return NaN;for(;g<d&&!c.get(g,t)&&h[3]<n;)h[3]++,g++;if(g===d||h[3]>=n)return NaN;for(;g<d&&c.get(g,t)&&h[4]<n;)h[4]++,g++;if(h[4]>=n)return NaN;const w=h[0]+h[1]+h[2]+h[3]+h[4];return 5*Math.abs(w-o)>=o?NaN:Vt.foundPatternCross(h)?Vt.centerFromEnd(h,g):NaN}handlePossibleCenter(e,t,n,o){const c=e[0]+e[1]+e[2]+e[3]+e[4];let d=Vt.centerFromEnd(e,n),h=this.crossCheckVertical(t,Math.floor(d),e[2],c);if(!isNaN(h)&&(d=this.crossCheckHorizontal(Math.floor(d),Math.floor(h),e[2],c),!isNaN(d)&&(!o||this.crossCheckDiagonal(Math.floor(h),Math.floor(d),e[2],c)))){const g=c/7;let w=!1;const E=this.possibleCenters;for(let A=0,S=E.length;A<S;A++){const B=E[A];if(B.aboutEquals(g,h,d)){E[A]=B.combineEstimate(h,d,g),w=!0;break}}if(!w){const A=new Uo(d,h,g);E.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()>=Vt.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 d of this.possibleCenters)d.getCount()>=Vt.CENTER_QUORUM&&(e++,t+=d.getEstimatedModuleSize());if(e<3)return!1;const o=t/n;let c=0;for(const d of this.possibleCenters)c+=Math.abs(d.getEstimatedModuleSize()-o);return c<=.05*t}selectBestPatterns(){const e=this.possibleCenters.length;if(e<3)throw new N;const t=this.possibleCenters;let n;if(e>3){let o=0,c=0;for(const g of this.possibleCenters){const w=g.getEstimatedModuleSize();o+=w,c+=w*w}n=o/e;let d=Math.sqrt(c/e-n*n);t.sort((g,w)=>{const E=Math.abs(w.getEstimatedModuleSize()-n),A=Math.abs(g.getEstimatedModuleSize()-n);return E<A?-1:E>A?1:0});const h=Math.max(.2*n,d);for(let g=0;g<t.length&&t.length>3;g++){const w=t[g];Math.abs(w.getEstimatedModuleSize()-n)>h&&(t.splice(g,1),g--)}}if(t.length>3){let o=0;for(const c of t)o+=c.getEstimatedModuleSize();n=o/t.length,t.sort((c,d)=>{if(d.getCount()===c.getCount()){const h=Math.abs(d.getEstimatedModuleSize()-n),g=Math.abs(c.getEstimatedModuleSize()-n);return h<g?1:h>g?-1:0}else return d.getCount()-c.getCount()}),t.splice(3)}return[t[0],t[1],t[2]]}}Vt.CENTER_QUORUM=2,Vt.MIN_SKIP=3,Vt.MAX_MODULES=57;class Zr{constructor(e){this.image=e}getImage(){return this.image}getResultPointCallback(){return this.resultPointCallback}detect(e){this.resultPointCallback=e==null?null:e.get(Z.NEED_RESULT_POINT_CALLBACK);const n=new Vt(this.image,this.resultPointCallback).find(e);return this.processFinderPatternInfo(n)}processFinderPatternInfo(e){const t=e.getTopLeft(),n=e.getTopRight(),o=e.getBottomLeft(),c=this.calculateModuleSize(t,n,o);if(c<1)throw new N("No pattern found in proccess finder.");const d=Zr.computeDimension(t,n,o,c),h=Te.getProvisionalVersionForDimension(d),g=h.getDimensionForVersion()-7;let w=null;if(h.getAlignmentPatternCenters().length>0){const B=n.getX()-t.getX()+o.getX(),U=n.getY()-t.getY()+o.getY(),H=1-3/g,Y=Math.floor(t.getX()+H*(B-t.getX())),oe=Math.floor(t.getY()+H*(U-t.getY()));for(let ue=4;ue<=16;ue<<=1)try{w=this.findAlignmentInRegion(c,Y,oe,ue);break}catch(he){if(!(he instanceof N))throw he}}const E=Zr.createTransform(t,n,o,w,d),A=Zr.sampleGrid(this.image,E,d);let S;return w===null?S=[o,t,n]:S=[o,t,n,w],new br(A,S)}static createTransform(e,t,n,o,c){const d=c-3.5;let h,g,w,E;return o!==null?(h=o.getX(),g=o.getY(),w=d-3,E=w):(h=t.getX()-e.getX()+n.getX(),g=t.getY()-e.getY()+n.getY(),w=d,E=d),dn.quadrilateralToQuadrilateral(3.5,3.5,d,3.5,w,E,3.5,d,e.getX(),e.getY(),t.getX(),t.getY(),h,g,n.getX(),n.getY())}static sampleGrid(e,t,n){return Rn.getInstance().sampleGridWithTransform(e,n,n,t)}static computeDimension(e,t,n,o){const c=ve.round(ye.distance(e,t)/o),d=ve.round(ye.distance(e,n)/o);let h=Math.floor((c+d)/2)+7;switch(h&3){case 0:h++;break;case 2:h--;break;case 3:throw new N("Dimensions could be not found.")}return h}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())),o=this.sizeOfBlackWhiteBlackRunBothWays(Math.floor(t.getX()),Math.floor(t.getY()),Math.floor(e.getX()),Math.floor(e.getY()));return isNaN(n)?o/7:isNaN(o)?n/7:(n+o)/14}sizeOfBlackWhiteBlackRunBothWays(e,t,n,o){let c=this.sizeOfBlackWhiteBlackRun(e,t,n,o),d=1,h=e-(n-e);h<0?(d=e/(e-h),h=0):h>=this.image.getWidth()&&(d=(this.image.getWidth()-1-e)/(h-e),h=this.image.getWidth()-1);let g=Math.floor(t-(o-t)*d);return d=1,g<0?(d=t/(t-g),g=0):g>=this.image.getHeight()&&(d=(this.image.getHeight()-1-t)/(g-t),g=this.image.getHeight()-1),h=Math.floor(e+(h-e)*d),c+=this.sizeOfBlackWhiteBlackRun(e,t,h,g),c-1}sizeOfBlackWhiteBlackRun(e,t,n,o){const c=Math.abs(o-t)>Math.abs(n-e);if(c){let B=e;e=t,t=B,B=n,n=o,o=B}const d=Math.abs(n-e),h=Math.abs(o-t);let g=-d/2;const w=e<n?1:-1,E=t<o?1:-1;let A=0;const S=n+w;for(let B=e,U=t;B!==S;B+=w){const H=c?U:B,Y=c?B:U;if(A===1===this.image.get(H,Y)){if(A===2)return ve.distance(B,U,e,t);A++}if(g+=h,g>0){if(U===o)break;U+=E,g-=d}}return A===2?ve.distance(n+w,o,e,t):NaN}findAlignmentInRegion(e,t,n,o){const c=Math.floor(o*e),d=Math.max(0,t-c),h=Math.min(this.image.getWidth()-1,t+c);if(h-d<e*3)throw new N("Alignment top exceeds estimated module size.");const g=Math.max(0,n-c),w=Math.min(this.image.getHeight()-1,n+c);if(w-g<e*3)throw new N("Alignment bottom exceeds estimated module size.");return new Di(this.image,d,g,h-d,w-g,e,this.resultPointCallback).find()}}class qn{constructor(){this.decoder=new Ig}getDecoder(){return this.decoder}decode(e,t){let n,o;if(t!=null&&t.get(Z.PURE_BARCODE)!==void 0){const g=qn.extractPureBits(e.getBlackMatrix());n=this.decoder.decodeBitMatrix(g,t),o=qn.NO_POINTS}else{const g=new Zr(e.getBlackMatrix()).detect(t);n=this.decoder.decodeBitMatrix(g.getBits(),t),o=g.getPoints()}n.getOther()instanceof qa&&n.getOther().applyMirroredCorrection(o);const c=new Ce(n.getText(),n.getRawBytes(),void 0,o,ge.QR_CODE,void 0),d=n.getByteSegments();d!==null&&c.putMetadata(be.BYTE_SEGMENTS,d);const h=n.getECLevel();return h!==null&&c.putMetadata(be.ERROR_CORRECTION_LEVEL,h),n.hasStructuredAppend()&&(c.putMetadata(be.STRUCTURED_APPEND_SEQUENCE,n.getStructuredAppendSequenceNumber()),c.putMetadata(be.STRUCTURED_APPEND_PARITY,n.getStructuredAppendParity())),c}reset(){}static extractPureBits(e){const t=e.getTopLeftOnBit(),n=e.getBottomRightOnBit();if(t===null||n===null)throw new N;const o=this.moduleSize(t,e);let c=t[1],d=n[1],h=t[0],g=n[0];if(h>=g||c>=d)throw new N;if(d-c!==g-h&&(g=h+(d-c),g>=e.getWidth()))throw new N;const w=Math.round((g-h+1)/o),E=Math.round((d-c+1)/o);if(w<=0||E<=0)throw new N;if(E!==w)throw new N;const A=Math.floor(o/2);c+=A,h+=A;const S=h+Math.floor((w-1)*o)-g;if(S>0){if(S>A)throw new N;h-=S}const B=c+Math.floor((E-1)*o)-d;if(B>0){if(B>A)throw new N;c-=B}const U=new z(w,E);for(let H=0;H<E;H++){const Y=c+Math.floor(H*o);for(let oe=0;oe<w;oe++)e.get(h+Math.floor(oe*o),Y)&&U.set(oe,H)}return U}static moduleSize(e,t){const n=t.getHeight(),o=t.getWidth();let c=e[0],d=e[1],h=!0,g=0;for(;c<o&&d<n;){if(h!==t.get(c,d)){if(++g===5)break;h=!h}c++,d++}if(c===o||d===n)throw new N;return(c-e[0])/7}}qn.NO_POINTS=new Array;class Me{PDF417Common(){}static getBitCountSum(e){return ve.sum(e)}static toIntArray(e){if(e==null||!e.length)return Me.EMPTY_INT_ARRAY;const t=new Int32Array(e.length);let n=0;for(const o of e)t[n++]=o;return t}static getCodeword(e){const t=M.binarySearch(Me.SYMBOL_TABLE,e&262143);return t<0?-1:(Me.CODEWORD_TABLE[t]-1)%Me.NUMBER_OF_CODEWORDS}}Me.NUMBER_OF_CODEWORDS=929,Me.MAX_CODEWORDS_IN_BARCODE=Me.NUMBER_OF_CODEWORDS-1,Me.MIN_ROWS_IN_BARCODE=3,Me.MAX_ROWS_IN_BARCODE=90,Me.MODULES_IN_CODEWORD=17,Me.MODULES_IN_STOP_PATTERN=18,Me.BARS_IN_MODULE=8,Me.EMPTY_INT_ARRAY=new Int32Array([]),Me.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]),Me.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 Tg{constructor(e,t){this.bits=e,this.points=t}getBits(){return this.bits}getPoints(){return this.points}}class He{static detectMultiple(e,t,n){let o=e.getBlackMatrix(),c=He.detect(n,o);return c.length||(o=o.clone(),o.rotate180(),c=He.detect(n,o)),new Tg(o,c)}static detect(e,t){const n=new Array;let o=0,c=0,d=!1;for(;o<t.getHeight();){const h=He.findVertices(t,o,c);if(h[0]==null&&h[3]==null){if(!d)break;d=!1,c=0;for(const g of n)g[1]!=null&&(o=Math.trunc(Math.max(o,g[1].getY()))),g[3]!=null&&(o=Math.max(o,Math.trunc(g[3].getY())));o+=He.ROW_STEP;continue}if(d=!0,n.push(h),!e)break;h[2]!=null?(c=Math.trunc(h[2].getX()),o=Math.trunc(h[2].getY())):(c=Math.trunc(h[4].getX()),o=Math.trunc(h[4].getY()))}return n}static findVertices(e,t,n){const o=e.getHeight(),c=e.getWidth(),d=new Array(8);return He.copyToResult(d,He.findRowsWithPattern(e,o,c,t,n,He.START_PATTERN),He.INDEXES_START_PATTERN),d[4]!=null&&(n=Math.trunc(d[4].getX()),t=Math.trunc(d[4].getY())),He.copyToResult(d,He.findRowsWithPattern(e,o,c,t,n,He.STOP_PATTERN),He.INDEXES_STOP_PATTERN),d}static copyToResult(e,t,n){for(let o=0;o<n.length;o++)e[n[o]]=t[o]}static findRowsWithPattern(e,t,n,o,c,d){const h=new Array(4);let g=!1;const w=new Int32Array(d.length);for(;o<t;o+=He.ROW_STEP){let A=He.findGuardPattern(e,c,o,n,!1,d,w);if(A!=null){for(;o>0;){const S=He.findGuardPattern(e,c,--o,n,!1,d,w);if(S!=null)A=S;else{o++;break}}h[0]=new ye(A[0],o),h[1]=new ye(A[1],o),g=!0;break}}let E=o+1;if(g){let A=0,S=Int32Array.from([Math.trunc(h[0].getX()),Math.trunc(h[1].getX())]);for(;E<t;E++){const B=He.findGuardPattern(e,S[0],E,n,!1,d,w);if(B!=null&&Math.abs(S[0]-B[0])<He.MAX_PATTERN_DRIFT&&Math.abs(S[1]-B[1])<He.MAX_PATTERN_DRIFT)S=B,A=0;else{if(A>He.SKIPPED_ROW_COUNT_MAX)break;A++}}E-=A+1,h[2]=new ye(S[0],E),h[3]=new ye(S[1],E)}return E-o<He.BARCODE_MIN_HEIGHT&&M.fill(h,null),h}static findGuardPattern(e,t,n,o,c,d,h){M.fillWithin(h,0,h.length,0);let g=t,w=0;for(;e.get(g,n)&&g>0&&w++<He.MAX_PIXEL_DRIFT;)g--;let E=g,A=0,S=d.length;for(let B=c;E<o;E++)if(e.get(E,n)!==B)h[A]++;else{if(A===S-1){if(He.patternMatchVariance(h,d,He.MAX_INDIVIDUAL_VARIANCE)<He.MAX_AVG_VARIANCE)return new Int32Array([g,E]);g+=h[0]+h[1],D.arraycopy(h,2,h,0,A-1),h[A-1]=0,h[A]=0,A--}else A++;h[A]=1,B=!B}return A===S-1&&He.patternMatchVariance(h,d,He.MAX_INDIVIDUAL_VARIANCE)<He.MAX_AVG_VARIANCE?new Int32Array([g,E-1]):null}static patternMatchVariance(e,t,n){let o=e.length,c=0,d=0;for(let w=0;w<o;w++)c+=e[w],d+=t[w];if(c<d)return 1/0;let h=c/d;n*=h;let g=0;for(let w=0;w<o;w++){let E=e[w],A=t[w]*h,S=E>A?E-A:A-E;if(S>n)return 1/0;g+=S}return g/c}}He.INDEXES_START_PATTERN=Int32Array.from([0,4,1,5]),He.INDEXES_STOP_PATTERN=Int32Array.from([6,2,7,3]),He.MAX_AVG_VARIANCE=.42,He.MAX_INDIVIDUAL_VARIANCE=.8,He.START_PATTERN=Int32Array.from([8,1,1,1,1,1,1,3]),He.STOP_PATTERN=Int32Array.from([7,1,1,3,1,1,1,2,1]),He.MAX_PIXEL_DRIFT=3,He.MAX_PATTERN_DRIFT=5,He.SKIPPED_ROW_COUNT_MAX=25,He.ROW_STEP=5,He.BARCODE_MIN_HEIGHT=10;class Ht{constructor(e,t){if(t.length===0)throw new y;this.field=e;let n=t.length;if(n>1&&t[0]===0){let o=1;for(;o<n&&t[o]===0;)o++;o===n?this.coefficients=new Int32Array([0]):(this.coefficients=new Int32Array(n-o),D.arraycopy(t,o,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 o=0;for(let c of this.coefficients)o=this.field.add(o,c);return o}let t=this.coefficients[0],n=this.coefficients.length;for(let o=1;o<n;o++)t=this.field.add(this.field.multiply(e,t),this.coefficients[o]);return t}add(e){if(!this.field.equals(e.field))throw new y("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 d=t;t=n,n=d}let o=new Int32Array(n.length),c=n.length-t.length;D.arraycopy(n,0,o,0,c);for(let d=c;d<n.length;d++)o[d]=this.field.add(t[d-c],n[d]);return new Ht(this.field,o)}subtract(e){if(!this.field.equals(e.field))throw new y("ModulusPolys do not have same ModulusGF field");return e.isZero()?this:this.add(e.negative())}multiply(e){return e instanceof Ht?this.multiplyOther(e):this.multiplyScalar(e)}multiplyOther(e){if(!this.field.equals(e.field))throw new y("ModulusPolys do not have same ModulusGF field");if(this.isZero()||e.isZero())return new Ht(this.field,new Int32Array([0]));let t=this.coefficients,n=t.length,o=e.coefficients,c=o.length,d=new Int32Array(n+c-1);for(let h=0;h<n;h++){let g=t[h];for(let w=0;w<c;w++)d[h+w]=this.field.add(d[h+w],this.field.multiply(g,o[w]))}return new Ht(this.field,d)}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 Ht(this.field,t)}multiplyScalar(e){if(e===0)return new Ht(this.field,new Int32Array([0]));if(e===1)return this;let t=this.coefficients.length,n=new Int32Array(t);for(let o=0;o<t;o++)n[o]=this.field.multiply(this.coefficients[o],e);return new Ht(this.field,n)}multiplyByMonomial(e,t){if(e<0)throw new y;if(t===0)return new Ht(this.field,new Int32Array([0]));let n=this.coefficients.length,o=new Int32Array(n+e);for(let c=0;c<n;c++)o[c]=this.field.multiply(this.coefficients[c],t);return new Ht(this.field,o)}toString(){let e=new G;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 kg{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 y;return this.logTable[e]}inverse(e){if(e===0)throw new it;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 zo extends kg{constructor(e,t){super(),this.modulus=e,this.expTable=new Int32Array(e),this.logTable=new Int32Array(e);let n=1;for(let o=0;o<e;o++)this.expTable[o]=n,n=n*t%e;for(let o=0;o<e-1;o++)this.logTable[this.expTable[o]]=o;this.zero=new Ht(this,new Int32Array([0])),this.one=new Ht(this,new Int32Array([1]))}getZero(){return this.zero}getOne(){return this.one}buildMonomial(e,t){if(e<0)throw new y;if(t===0)return this.zero;let n=new Int32Array(e+1);return n[0]=t,new Ht(this,n)}}zo.PDF417_GF=new zo(Me.NUMBER_OF_CODEWORDS,3);class Za{constructor(){this.field=zo.PDF417_GF}decode(e,t,n){let o=new Ht(this.field,e),c=new Int32Array(t),d=!1;for(let U=t;U>0;U--){let H=o.evaluateAt(this.field.exp(U));c[t-U]=H,H!==0&&(d=!0)}if(!d)return 0;let h=this.field.getOne();if(n!=null)for(const U of n){let H=this.field.exp(e.length-1-U),Y=new Ht(this.field,new Int32Array([this.field.subtract(0,H),1]));h=h.multiply(Y)}let g=new Ht(this.field,c),w=this.runEuclideanAlgorithm(this.field.buildMonomial(t,1),g,t),E=w[0],A=w[1],S=this.findErrorLocations(E),B=this.findErrorMagnitudes(A,E,S);for(let U=0;U<S.length;U++){let H=e.length-1-this.field.log(S[U]);if(H<0)throw O.getChecksumInstance();e[H]=this.field.subtract(e[H],B[U])}return S.length}runEuclideanAlgorithm(e,t,n){if(e.getDegree()<t.getDegree()){let S=e;e=t,t=S}let o=e,c=t,d=this.field.getZero(),h=this.field.getOne();for(;c.getDegree()>=Math.round(n/2);){let S=o,B=d;if(o=c,d=h,o.isZero())throw O.getChecksumInstance();c=S;let U=this.field.getZero(),H=o.getCoefficient(o.getDegree()),Y=this.field.inverse(H);for(;c.getDegree()>=o.getDegree()&&!c.isZero();){let oe=c.getDegree()-o.getDegree(),ue=this.field.multiply(c.getCoefficient(c.getDegree()),Y);U=U.add(this.field.buildMonomial(oe,ue)),c=c.subtract(o.multiplyByMonomial(oe,ue))}h=U.multiply(d).subtract(B).negative()}let g=h.getCoefficient(0);if(g===0)throw O.getChecksumInstance();let w=this.field.inverse(g),E=h.multiply(w),A=c.multiply(w);return[E,A]}findErrorLocations(e){let t=e.getDegree(),n=new Int32Array(t),o=0;for(let c=1;c<this.field.getSize()&&o<t;c++)e.evaluateAt(c)===0&&(n[o]=this.field.inverse(c),o++);if(o!==t)throw O.getChecksumInstance();return n}findErrorMagnitudes(e,t,n){let o=t.getDegree(),c=new Int32Array(o);for(let w=1;w<=o;w++)c[o-w]=this.field.multiply(w,t.getCoefficient(w));let d=new Ht(this.field,c),h=n.length,g=new Int32Array(h);for(let w=0;w<h;w++){let E=this.field.inverse(n[w]),A=this.field.subtract(0,e.evaluateAt(E)),S=this.field.inverse(d.evaluateAt(E));g[w]=this.field.multiply(A,S)}return g}}class cr{constructor(e,t,n,o,c){e instanceof cr?this.constructor_2(e):this.constructor_1(e,t,n,o,c)}constructor_1(e,t,n,o,c){const d=t==null||n==null,h=o==null||c==null;if(d&&h)throw new N;d?(t=new ye(0,o.getY()),n=new ye(0,c.getY())):h&&(o=new ye(e.getWidth()-1,t.getY()),c=new ye(e.getWidth()-1,n.getY())),this.image=e,this.topLeft=t,this.bottomLeft=n,this.topRight=o,this.bottomRight=c,this.minX=Math.trunc(Math.min(t.getX(),n.getX())),this.maxX=Math.trunc(Math.max(o.getX(),c.getX())),this.minY=Math.trunc(Math.min(t.getY(),o.getY())),this.maxY=Math.trunc(Math.max(n.getY(),c.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 cr(e.image,e.topLeft,e.bottomLeft,t.topRight,t.bottomRight)}addMissingRows(e,t,n){let o=this.topLeft,c=this.bottomLeft,d=this.topRight,h=this.bottomRight;if(e>0){let g=n?this.topLeft:this.topRight,w=Math.trunc(g.getY()-e);w<0&&(w=0);let E=new ye(g.getX(),w);n?o=E:d=E}if(t>0){let g=n?this.bottomLeft:this.bottomRight,w=Math.trunc(g.getY()+t);w>=this.image.getHeight()&&(w=this.image.getHeight()-1);let E=new ye(g.getX(),w);n?c=E:h=E}return new cr(this.image,o,c,d,h)}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 Rg{constructor(e,t,n,o){this.columnCount=e,this.errorCorrectionLevel=o,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 Yr{constructor(){this.buffer=""}static form(e,t){let n=-1;function o(d,h,g,w,E,A){if(d==="%%")return"%";if(t[++n]===void 0)return;d=w?parseInt(w.substr(1)):void 0;let S=E?parseInt(E.substr(1)):void 0,B;switch(A){case"s":B=t[n];break;case"c":B=t[n][0];break;case"f":B=parseFloat(t[n]).toFixed(d);break;case"p":B=parseFloat(t[n]).toPrecision(d);break;case"e":B=parseFloat(t[n]).toExponential(d);break;case"x":B=parseInt(t[n]).toString(S||16);break;case"d":B=parseFloat(parseInt(t[n],S||10).toPrecision(d)).toFixed(0);break}B=typeof B=="object"?JSON.stringify(B):(+B).toString(S);let U=parseInt(g),H=g&&g[0]+""=="0"?"0":" ";for(;B.length<U;)B=h!==void 0?B+H:H+B;return B}let c=/%(-)?(0?[0-9]+)?([.][0-9]+)?([#][0-9]+)?([scfpexd%])/g;return e.replace(c,o)}format(e,...t){this.buffer+=Yr.form(e,t)}toString(){return this.buffer}}class Kr{constructor(e){this.boundingBox=new cr(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<Kr.MAX_NEARBY_DISTANCE;n++){let o=this.imageRowToCodewordIndex(e)-n;if(o>=0&&(t=this.codewords[o],t!=null)||(o=this.imageRowToCodewordIndex(e)+n,o<this.codewords.length&&(t=this.codewords[o],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 Yr;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()}}Kr.MAX_NEARBY_DISTANCE=5;class Qr{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,o]of this.values.entries()){const c={getKey:()=>n,getValue:()=>o};c.getValue()>e?(e=c.getValue(),t=[],t.push(c.getKey())):c.getValue()===e&&t.push(c.getKey())}return Me.toIntArray(t)}getConfidence(e){return this.values.get(e)}}class Ya extends Kr{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(),o=this._isLeft?n.getTopLeft():n.getTopRight(),c=this._isLeft?n.getBottomLeft():n.getBottomRight(),d=this.imageRowToCodewordIndex(Math.trunc(o.getY())),h=this.imageRowToCodewordIndex(Math.trunc(c.getY())),g=-1,w=1,E=0;for(let A=d;A<h;A++){if(t[A]==null)continue;let S=t[A],B=S.getRowNumber()-g;if(B===0)E++;else if(B===1)w=Math.max(w,E),E=1,g=S.getRowNumber();else if(B<0||S.getRowNumber()>=e.getRowCount()||B>A)t[A]=null;else{let U;w>2?U=(w-2)*B:U=B;let H=U>=A;for(let Y=1;Y<=U&&!H;Y++)H=t[A-Y]!=null;H?t[A]=null:(g=S.getRowNumber(),E=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 o=n.getRowNumber();if(o>=t.length)continue;t[o]++}return t}adjustIncompleteIndicatorColumnRowNumbers(e){let t=this.getBoundingBox(),n=this._isLeft?t.getTopLeft():t.getTopRight(),o=this._isLeft?t.getBottomLeft():t.getBottomRight(),c=this.imageRowToCodewordIndex(Math.trunc(n.getY())),d=this.imageRowToCodewordIndex(Math.trunc(o.getY())),h=this.getCodewords(),g=-1;for(let w=c;w<d;w++){if(h[w]==null)continue;let E=h[w];E.setRowNumberAsRowIndicatorColumn();let A=E.getRowNumber()-g;A===0||(A===1?g=E.getRowNumber():E.getRowNumber()>=e.getRowCount()?h[w]=null:g=E.getRowNumber())}}getBarcodeMetadata(){let e=this.getCodewords(),t=new Qr,n=new Qr,o=new Qr,c=new Qr;for(let h of e){if(h==null)continue;h.setRowNumberAsRowIndicatorColumn();let g=h.getValue()%30,w=h.getRowNumber();switch(this._isLeft||(w+=2),w%3){case 0:n.setValue(g*3+1);break;case 1:c.setValue(g/3),o.setValue(g%3);break;case 2:t.setValue(g+1);break}}if(t.getValue().length===0||n.getValue().length===0||o.getValue().length===0||c.getValue().length===0||t.getValue()[0]<1||n.getValue()[0]+o.getValue()[0]<Me.MIN_ROWS_IN_BARCODE||n.getValue()[0]+o.getValue()[0]>Me.MAX_ROWS_IN_BARCODE)return null;let d=new Rg(t.getValue()[0],n.getValue()[0],o.getValue()[0],c.getValue()[0]);return this.removeIncorrectCodewords(e,d),d}removeIncorrectCodewords(e,t){for(let n=0;n<e.length;n++){let o=e[n];if(e[n]==null)continue;let c=o.getValue()%30,d=o.getRowNumber();if(d>t.getRowCount()){e[n]=null;continue}switch(this._isLeft||(d+=2),d%3){case 0:c*3+1!==t.getRowCountUpperPart()&&(e[n]=null);break;case 1:(Math.trunc(c/3)!==t.getErrorCorrectionLevel()||c%3!==t.getRowCountLowerPart())&&(e[n]=null);break;case 2:c+1!==t.getColumnCount()&&(e[n]=null);break}}}isLeft(){return this._isLeft}toString(){return"IsLeft: "+this._isLeft+`
17
- `+super.toString()}}class Jr{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=Me.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 o=0;o<n.length;o++)n[o]!=null&&(n[o].hasValidRowNumber()||this.adjustRowNumbers(t,o,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 o=1;o<=this.barcodeColumnCount;o++){let c=this.detectionResultColumns[o].getCodewords()[n];c!=null&&(c.setRowNumber(e[n].getRowNumber()),c.hasValidRowNumber()||(this.detectionResultColumns[o].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 o=t[n].getRowNumber(),c=0;for(let d=this.barcodeColumnCount+1;d>0&&c<this.ADJUST_ROW_NUMBER_SKIP;d--){let h=this.detectionResultColumns[d].getCodewords()[n];h!=null&&(c=Jr.adjustRowNumberIfValid(o,c,h),h.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 o=t[n].getRowNumber(),c=0;for(let d=1;d<this.barcodeColumnCount+1&&c<this.ADJUST_ROW_NUMBER_SKIP;d++){let h=this.detectionResultColumns[d].getCodewords()[n];h!=null&&(c=Jr.adjustRowNumberIfValid(o,c,h),h.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 o=n[t],c=this.detectionResultColumns[e-1].getCodewords(),d=c;this.detectionResultColumns[e+1]!=null&&(d=this.detectionResultColumns[e+1].getCodewords());let h=new Array(14);h[2]=c[t],h[3]=d[t],t>0&&(h[0]=n[t-1],h[4]=c[t-1],h[5]=d[t-1]),t>1&&(h[8]=n[t-2],h[10]=c[t-2],h[11]=d[t-2]),t<n.length-1&&(h[1]=n[t+1],h[6]=c[t+1],h[7]=d[t+1]),t<n.length-2&&(h[9]=n[t+2],h[12]=c[t+2],h[13]=d[t+2]);for(let g of h)if(Jr.adjustRowNumber(o,g))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 Yr;for(let n=0;n<e.getCodewords().length;n++){t.format("CW %3d:",n);for(let o=0;o<this.barcodeColumnCount+2;o++){if(this.detectionResultColumns[o]==null){t.format(" | ");continue}let c=this.detectionResultColumns[o].getCodewords()[n];if(c==null){t.format(" | ");continue}t.format(" %3d|%3d",c.getRowNumber(),c.getValue())}t.format("%n")}return t.toString()}}class ei{constructor(e,t,n,o){this.rowNumber=ei.BARCODE_ROW_UNKNOWN,this.startX=Math.trunc(e),this.endX=Math.trunc(t),this.bucket=Math.trunc(n),this.value=Math.trunc(o)}hasValidRowNumber(){return this.isValidRowNumber(this.rowNumber)}isValidRowNumber(e){return e!==ei.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}}ei.BARCODE_ROW_UNKNOWN=-1;class nn{static initialize(){for(let e=0;e<Me.SYMBOL_TABLE.length;e++){let t=Me.SYMBOL_TABLE[e],n=t&1;for(let o=0;o<Me.BARS_IN_MODULE;o++){let c=0;for(;(t&1)===n;)c+=1,t>>=1;n=t&1,nn.RATIOS_TABLE[e]||(nn.RATIOS_TABLE[e]=new Array(Me.BARS_IN_MODULE)),nn.RATIOS_TABLE[e][Me.BARS_IN_MODULE-o-1]=Math.fround(c/Me.MODULES_IN_CODEWORD)}}this.bSymbolTableReady=!0}static getDecodedValue(e){let t=nn.getDecodedCodewordValue(nn.sampleBitCounts(e));return t!==-1?t:nn.getClosestDecodedValue(e)}static sampleBitCounts(e){let t=ve.sum(e),n=new Int32Array(Me.BARS_IN_MODULE),o=0,c=0;for(let d=0;d<Me.MODULES_IN_CODEWORD;d++){let h=t/(2*Me.MODULES_IN_CODEWORD)+d*t/Me.MODULES_IN_CODEWORD;c+e[o]<=h&&(c+=e[o],o++),n[o]++}return n}static getDecodedCodewordValue(e){let t=nn.getBitValue(e);return Me.getCodeword(t)===-1?-1:t}static getBitValue(e){let t=0;for(let n=0;n<e.length;n++)for(let o=0;o<e[n];o++)t=t<<1|(n%2===0?1:0);return Math.trunc(t)}static getClosestDecodedValue(e){let t=ve.sum(e),n=new Array(Me.BARS_IN_MODULE);if(t>1)for(let d=0;d<n.length;d++)n[d]=Math.fround(e[d]/t);let o=ar.MAX_VALUE,c=-1;this.bSymbolTableReady||nn.initialize();for(let d=0;d<nn.RATIOS_TABLE.length;d++){let h=0,g=nn.RATIOS_TABLE[d];for(let w=0;w<Me.BARS_IN_MODULE;w++){let E=Math.fround(g[w]-n[w]);if(h+=Math.fround(E*E),h>=o)break}h<o&&(o=h,c=Me.SYMBOL_TABLE[d])}return c}}nn.bSymbolTableReady=!1,nn.RATIOS_TABLE=new Array(Me.SYMBOL_TABLE.length).map(b=>new Array(Me.BARS_IN_MODULE));class Ka{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 Qa{static parseLong(e,t=void 0){return parseInt(e,t)}}class Ja extends x{}Ja.kind="NullPointerException";class Bg{writeBytes(e){this.writeBytesOffset(e,0,e.length)}writeBytesOffset(e,t,n){if(e==null)throw new Ja;if(t<0||t>e.length||n<0||t+n>e.length||t+n<0)throw new k;if(n===0)return;for(let o=0;o<n;o++)this.write(e[t+o])}flush(){}close(){}}class Og extends x{}class Mg extends Bg{constructor(e=32){if(super(),this.count=0,e<0)throw new y("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 Og;n=v.MAX_VALUE}this.buf=M.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 k;this.ensureCapacity(this.count+n),D.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 M.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(b){b[b.ALPHA=0]="ALPHA",b[b.LOWER=1]="LOWER",b[b.MIXED=2]="MIXED",b[b.PUNCT=3]="PUNCT",b[b.ALPHA_SHIFT=4]="ALPHA_SHIFT",b[b.PUNCT_SHIFT=5]="PUNCT_SHIFT"})(lt||(lt={}));function el(){if(typeof window<"u")return window.BigInt||null;if(typeof _r<"u")return _r.BigInt||null;if(typeof self<"u")return self.BigInt||null;throw new Error("Can't search globals for BigInt!")}let vi;function Zn(b){if(typeof vi>"u"&&(vi=el()),vi===null)throw new Error("BigInt is not supported!");return vi(b)}function Dg(){let b=[];b[0]=Zn(1);let e=Zn(900);b[1]=e;for(let t=2;t<16;t++)b[t]=b[t-1]*e;return b}class re{static decode(e,t){let n=new G(""),o=V.ISO8859_1;n.enableDecoding(o);let c=1,d=e[c++],h=new Ka;for(;c<e[0];){switch(d){case re.TEXT_COMPACTION_MODE_LATCH:c=re.textCompaction(e,c,n);break;case re.BYTE_COMPACTION_MODE_LATCH:case re.BYTE_COMPACTION_MODE_LATCH_6:c=re.byteCompaction(d,e,o,c,n);break;case re.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:n.append(e[c++]);break;case re.NUMERIC_COMPACTION_MODE_LATCH:c=re.numericCompaction(e,c,n);break;case re.ECI_CHARSET:V.getCharacterSetECIByValue(e[c++]);break;case re.ECI_GENERAL_PURPOSE:c+=2;break;case re.ECI_USER_DEFINED:c++;break;case re.BEGIN_MACRO_PDF417_CONTROL_BLOCK:c=re.decodeMacroBlock(e,c,h);break;case re.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case re.MACRO_PDF417_TERMINATOR:throw new F;default:c--,c=re.textCompaction(e,c,n);break}if(c<e.length)d=e[c++];else throw F.getFormatInstance()}if(n.length()===0)throw F.getFormatInstance();let g=new et(null,n.toString(),null,t);return g.setOther(h),g}static decodeMacroBlock(e,t,n){if(t+re.NUMBER_OF_SEQUENCE_CODEWORDS>e[0])throw F.getFormatInstance();let o=new Int32Array(re.NUMBER_OF_SEQUENCE_CODEWORDS);for(let h=0;h<re.NUMBER_OF_SEQUENCE_CODEWORDS;h++,t++)o[h]=e[t];n.setSegmentIndex(v.parseInt(re.decodeBase900toBase10(o,re.NUMBER_OF_SEQUENCE_CODEWORDS)));let c=new G;t=re.textCompaction(e,t,c),n.setFileId(c.toString());let d=-1;for(e[t]===re.BEGIN_MACRO_PDF417_OPTIONAL_FIELD&&(d=t+1);t<e[0];)switch(e[t]){case re.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:switch(t++,e[t]){case re.MACRO_PDF417_OPTIONAL_FIELD_FILE_NAME:let h=new G;t=re.textCompaction(e,t+1,h),n.setFileName(h.toString());break;case re.MACRO_PDF417_OPTIONAL_FIELD_SENDER:let g=new G;t=re.textCompaction(e,t+1,g),n.setSender(g.toString());break;case re.MACRO_PDF417_OPTIONAL_FIELD_ADDRESSEE:let w=new G;t=re.textCompaction(e,t+1,w),n.setAddressee(w.toString());break;case re.MACRO_PDF417_OPTIONAL_FIELD_SEGMENT_COUNT:let E=new G;t=re.numericCompaction(e,t+1,E),n.setSegmentCount(v.parseInt(E.toString()));break;case re.MACRO_PDF417_OPTIONAL_FIELD_TIME_STAMP:let A=new G;t=re.numericCompaction(e,t+1,A),n.setTimestamp(Qa.parseLong(A.toString()));break;case re.MACRO_PDF417_OPTIONAL_FIELD_CHECKSUM:let S=new G;t=re.numericCompaction(e,t+1,S),n.setChecksum(v.parseInt(S.toString()));break;case re.MACRO_PDF417_OPTIONAL_FIELD_FILE_SIZE:let B=new G;t=re.numericCompaction(e,t+1,B),n.setFileSize(Qa.parseLong(B.toString()));break;default:throw F.getFormatInstance()}break;case re.MACRO_PDF417_TERMINATOR:t++,n.setLastSegment(!0);break;default:throw F.getFormatInstance()}if(d!==-1){let h=t-d;n.isLastSegment()&&h--,n.setOptionalData(M.copyOfRange(e,d,d+h))}return t}static textCompaction(e,t,n){let o=new Int32Array((e[0]-t)*2),c=new Int32Array((e[0]-t)*2),d=0,h=!1;for(;t<e[0]&&!h;){let g=e[t++];if(g<re.TEXT_COMPACTION_MODE_LATCH)o[d]=g/30,o[d+1]=g%30,d+=2;else switch(g){case re.TEXT_COMPACTION_MODE_LATCH:o[d++]=re.TEXT_COMPACTION_MODE_LATCH;break;case re.BYTE_COMPACTION_MODE_LATCH:case re.BYTE_COMPACTION_MODE_LATCH_6:case re.NUMERIC_COMPACTION_MODE_LATCH:case re.BEGIN_MACRO_PDF417_CONTROL_BLOCK:case re.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case re.MACRO_PDF417_TERMINATOR:t--,h=!0;break;case re.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:o[d]=re.MODE_SHIFT_TO_BYTE_COMPACTION_MODE,g=e[t++],c[d]=g,d++;break}}return re.decodeTextCompaction(o,c,d,n),t}static decodeTextCompaction(e,t,n,o){let c=lt.ALPHA,d=lt.ALPHA,h=0;for(;h<n;){let g=e[h],w="";switch(c){case lt.ALPHA:if(g<26)w=String.fromCharCode(65+g);else switch(g){case 26:w=" ";break;case re.LL:c=lt.LOWER;break;case re.ML:c=lt.MIXED;break;case re.PS:d=c,c=lt.PUNCT_SHIFT;break;case re.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:o.append(t[h]);break;case re.TEXT_COMPACTION_MODE_LATCH:c=lt.ALPHA;break}break;case lt.LOWER:if(g<26)w=String.fromCharCode(97+g);else switch(g){case 26:w=" ";break;case re.AS:d=c,c=lt.ALPHA_SHIFT;break;case re.ML:c=lt.MIXED;break;case re.PS:d=c,c=lt.PUNCT_SHIFT;break;case re.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:o.append(t[h]);break;case re.TEXT_COMPACTION_MODE_LATCH:c=lt.ALPHA;break}break;case lt.MIXED:if(g<re.PL)w=re.MIXED_CHARS[g];else switch(g){case re.PL:c=lt.PUNCT;break;case 26:w=" ";break;case re.LL:c=lt.LOWER;break;case re.AL:c=lt.ALPHA;break;case re.PS:d=c,c=lt.PUNCT_SHIFT;break;case re.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:o.append(t[h]);break;case re.TEXT_COMPACTION_MODE_LATCH:c=lt.ALPHA;break}break;case lt.PUNCT:if(g<re.PAL)w=re.PUNCT_CHARS[g];else switch(g){case re.PAL:c=lt.ALPHA;break;case re.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:o.append(t[h]);break;case re.TEXT_COMPACTION_MODE_LATCH:c=lt.ALPHA;break}break;case lt.ALPHA_SHIFT:if(c=d,g<26)w=String.fromCharCode(65+g);else switch(g){case 26:w=" ";break;case re.TEXT_COMPACTION_MODE_LATCH:c=lt.ALPHA;break}break;case lt.PUNCT_SHIFT:if(c=d,g<re.PAL)w=re.PUNCT_CHARS[g];else switch(g){case re.PAL:c=lt.ALPHA;break;case re.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:o.append(t[h]);break;case re.TEXT_COMPACTION_MODE_LATCH:c=lt.ALPHA;break}break}w!==""&&o.append(w),h++}}static byteCompaction(e,t,n,o,c){let d=new Mg,h=0,g=0,w=!1;switch(e){case re.BYTE_COMPACTION_MODE_LATCH:let E=new Int32Array(6),A=t[o++];for(;o<t[0]&&!w;)switch(E[h++]=A,g=900*g+A,A=t[o++],A){case re.TEXT_COMPACTION_MODE_LATCH:case re.BYTE_COMPACTION_MODE_LATCH:case re.NUMERIC_COMPACTION_MODE_LATCH:case re.BYTE_COMPACTION_MODE_LATCH_6:case re.BEGIN_MACRO_PDF417_CONTROL_BLOCK:case re.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case re.MACRO_PDF417_TERMINATOR:o--,w=!0;break;default:if(h%5===0&&h>0){for(let S=0;S<6;++S)d.write(Number(Zn(g)>>Zn(8*(5-S))));g=0,h=0}break}o===t[0]&&A<re.TEXT_COMPACTION_MODE_LATCH&&(E[h++]=A);for(let S=0;S<h;S++)d.write(E[S]);break;case re.BYTE_COMPACTION_MODE_LATCH_6:for(;o<t[0]&&!w;){let S=t[o++];if(S<re.TEXT_COMPACTION_MODE_LATCH)h++,g=900*g+S;else switch(S){case re.TEXT_COMPACTION_MODE_LATCH:case re.BYTE_COMPACTION_MODE_LATCH:case re.NUMERIC_COMPACTION_MODE_LATCH:case re.BYTE_COMPACTION_MODE_LATCH_6:case re.BEGIN_MACRO_PDF417_CONTROL_BLOCK:case re.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case re.MACRO_PDF417_TERMINATOR:o--,w=!0;break}if(h%5===0&&h>0){for(let B=0;B<6;++B)d.write(Number(Zn(g)>>Zn(8*(5-B))));g=0,h=0}}break}return c.append(K.decode(d.toByteArray(),n)),o}static numericCompaction(e,t,n){let o=0,c=!1,d=new Int32Array(re.MAX_NUMERIC_CODEWORDS);for(;t<e[0]&&!c;){let h=e[t++];if(t===e[0]&&(c=!0),h<re.TEXT_COMPACTION_MODE_LATCH)d[o]=h,o++;else switch(h){case re.TEXT_COMPACTION_MODE_LATCH:case re.BYTE_COMPACTION_MODE_LATCH:case re.BYTE_COMPACTION_MODE_LATCH_6:case re.BEGIN_MACRO_PDF417_CONTROL_BLOCK:case re.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case re.MACRO_PDF417_TERMINATOR:t--,c=!0;break}(o%re.MAX_NUMERIC_CODEWORDS===0||h===re.NUMERIC_COMPACTION_MODE_LATCH||c)&&o>0&&(n.append(re.decodeBase900toBase10(d,o)),o=0)}return t}static decodeBase900toBase10(e,t){let n=Zn(0);for(let c=0;c<t;c++)n+=re.EXP900[t-c-1]*Zn(e[c]);let o=n.toString();if(o.charAt(0)!=="1")throw new F;return o.substring(1)}}re.TEXT_COMPACTION_MODE_LATCH=900,re.BYTE_COMPACTION_MODE_LATCH=901,re.NUMERIC_COMPACTION_MODE_LATCH=902,re.BYTE_COMPACTION_MODE_LATCH_6=924,re.ECI_USER_DEFINED=925,re.ECI_GENERAL_PURPOSE=926,re.ECI_CHARSET=927,re.BEGIN_MACRO_PDF417_CONTROL_BLOCK=928,re.BEGIN_MACRO_PDF417_OPTIONAL_FIELD=923,re.MACRO_PDF417_TERMINATOR=922,re.MODE_SHIFT_TO_BYTE_COMPACTION_MODE=913,re.MAX_NUMERIC_CODEWORDS=15,re.MACRO_PDF417_OPTIONAL_FIELD_FILE_NAME=0,re.MACRO_PDF417_OPTIONAL_FIELD_SEGMENT_COUNT=1,re.MACRO_PDF417_OPTIONAL_FIELD_TIME_STAMP=2,re.MACRO_PDF417_OPTIONAL_FIELD_SENDER=3,re.MACRO_PDF417_OPTIONAL_FIELD_ADDRESSEE=4,re.MACRO_PDF417_OPTIONAL_FIELD_FILE_SIZE=5,re.MACRO_PDF417_OPTIONAL_FIELD_CHECKSUM=6,re.PL=25,re.LL=27,re.AS=27,re.ML=28,re.AL=28,re.PS=29,re.PAL=29,re.PUNCT_CHARS=`;<>@[\\]_\`~!\r ,:
18
- -.$/"|*()?{}'`,re.MIXED_CHARS="0123456789&\r ,:#-.$/+%*=^",re.EXP900=el()?Dg():[],re.NUMBER_OF_SEQUENCE_CODEWORDS=2;class We{constructor(){}static decode(e,t,n,o,c,d,h){let g=new cr(e,t,n,o,c),w=null,E=null,A;for(let U=!0;;U=!1){if(t!=null&&(w=We.getRowIndicatorColumn(e,g,t,!0,d,h)),o!=null&&(E=We.getRowIndicatorColumn(e,g,o,!1,d,h)),A=We.merge(w,E),A==null)throw N.getNotFoundInstance();let H=A.getBoundingBox();if(U&&H!=null&&(H.getMinY()<g.getMinY()||H.getMaxY()>g.getMaxY()))g=H;else break}A.setBoundingBox(g);let S=A.getBarcodeColumnCount()+1;A.setDetectionResultColumn(0,w),A.setDetectionResultColumn(S,E);let B=w!=null;for(let U=1;U<=S;U++){let H=B?U:S-U;if(A.getDetectionResultColumn(H)!==void 0)continue;let Y;H===0||H===S?Y=new Ya(g,H===0):Y=new Kr(g),A.setDetectionResultColumn(H,Y);let oe=-1,ue=oe;for(let he=g.getMinY();he<=g.getMaxY();he++){if(oe=We.getStartColumn(A,H,he,B),oe<0||oe>g.getMaxX()){if(ue===-1)continue;oe=ue}let de=We.detectCodeword(e,g.getMinX(),g.getMaxX(),B,oe,he,d,h);de!=null&&(Y.setCodeword(he,de),ue=oe,d=Math.min(d,de.getWidth()),h=Math.max(h,de.getWidth()))}}return We.createDecoderResult(A)}static merge(e,t){if(e==null&&t==null)return null;let n=We.getBarcodeMetadata(e,t);if(n==null)return null;let o=cr.merge(We.adjustBoundingBox(e),We.adjustBoundingBox(t));return new Jr(n,o)}static adjustBoundingBox(e){if(e==null)return null;let t=e.getRowHeights();if(t==null)return null;let n=We.getMax(t),o=0;for(let h of t)if(o+=n-h,h>0)break;let c=e.getCodewords();for(let h=0;o>0&&c[h]==null;h++)o--;let d=0;for(let h=t.length-1;h>=0&&(d+=n-t[h],!(t[h]>0));h--);for(let h=c.length-1;d>0&&c[h]==null;h--)d--;return e.getBoundingBox().addMissingRows(o,d,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 o;return t==null||(o=t.getBarcodeMetadata())==null?n:n.getColumnCount()!==o.getColumnCount()&&n.getErrorCorrectionLevel()!==o.getErrorCorrectionLevel()&&n.getRowCount()!==o.getRowCount()?null:n}static getRowIndicatorColumn(e,t,n,o,c,d){let h=new Ya(t,o);for(let g=0;g<2;g++){let w=g===0?1:-1,E=Math.trunc(Math.trunc(n.getX()));for(let A=Math.trunc(Math.trunc(n.getY()));A<=t.getMaxY()&&A>=t.getMinY();A+=w){let S=We.detectCodeword(e,0,e.getWidth(),o,E,A,c,d);S!=null&&(h.setCodeword(A,S),o?E=S.getStartX():E=S.getEndX())}}return h}static adjustCodewordCount(e,t){let n=t[0][1],o=n.getValue(),c=e.getBarcodeColumnCount()*e.getBarcodeRowCount()-We.getNumberOfECCodeWords(e.getBarcodeECLevel());if(o.length===0){if(c<1||c>Me.MAX_CODEWORDS_IN_BARCODE)throw N.getNotFoundInstance();n.setValue(c)}else o[0]!==c&&n.setValue(c)}static createDecoderResult(e){let t=We.createBarcodeMatrix(e);We.adjustCodewordCount(e,t);let n=new Array,o=new Int32Array(e.getBarcodeRowCount()*e.getBarcodeColumnCount()),c=[],d=new Array;for(let g=0;g<e.getBarcodeRowCount();g++)for(let w=0;w<e.getBarcodeColumnCount();w++){let E=t[g][w+1].getValue(),A=g*e.getBarcodeColumnCount()+w;E.length===0?n.push(A):E.length===1?o[A]=E[0]:(d.push(A),c.push(E))}let h=new Array(c.length);for(let g=0;g<h.length;g++)h[g]=c[g];return We.createDecoderResultFromAmbiguousValues(e.getBarcodeECLevel(),o,Me.toIntArray(n),Me.toIntArray(d),h)}static createDecoderResultFromAmbiguousValues(e,t,n,o,c){let d=new Int32Array(o.length),h=100;for(;h-- >0;){for(let g=0;g<d.length;g++)t[o[g]]=c[g][d[g]];try{return We.decodeCodewords(t,e,n)}catch(g){if(!(g instanceof O))throw g}if(d.length===0)throw O.getChecksumInstance();for(let g=0;g<d.length;g++)if(d[g]<c[g].length-1){d[g]++;break}else if(d[g]=0,g===d.length-1)throw O.getChecksumInstance()}throw O.getChecksumInstance()}static createBarcodeMatrix(e){let t=Array.from({length:e.getBarcodeRowCount()},()=>new Array(e.getBarcodeColumnCount()+2));for(let o=0;o<t.length;o++)for(let c=0;c<t[o].length;c++)t[o][c]=new Qr;let n=0;for(let o of e.getDetectionResultColumns()){if(o!=null){for(let c of o.getCodewords())if(c!=null){let d=c.getRowNumber();if(d>=0){if(d>=t.length)continue;t[d][n].setValue(c.getValue())}}}n++}return t}static isValidBarcodeColumn(e,t){return t>=0&&t<=e.getBarcodeColumnCount()+1}static getStartColumn(e,t,n,o){let c=o?1:-1,d=null;if(We.isValidBarcodeColumn(e,t-c)&&(d=e.getDetectionResultColumn(t-c).getCodeword(n)),d!=null)return o?d.getEndX():d.getStartX();if(d=e.getDetectionResultColumn(t).getCodewordNearby(n),d!=null)return o?d.getStartX():d.getEndX();if(We.isValidBarcodeColumn(e,t-c)&&(d=e.getDetectionResultColumn(t-c).getCodewordNearby(n)),d!=null)return o?d.getEndX():d.getStartX();let h=0;for(;We.isValidBarcodeColumn(e,t-c);){t-=c;for(let g of e.getDetectionResultColumn(t).getCodewords())if(g!=null)return(o?g.getEndX():g.getStartX())+c*h*(g.getEndX()-g.getStartX());h++}return o?e.getBoundingBox().getMinX():e.getBoundingBox().getMaxX()}static detectCodeword(e,t,n,o,c,d,h,g){c=We.adjustCodewordStartColumn(e,t,n,o,c,d);let w=We.getModuleBitCount(e,t,n,o,c,d);if(w==null)return null;let E,A=ve.sum(w);if(o)E=c+A;else{for(let U=0;U<w.length/2;U++){let H=w[U];w[U]=w[w.length-1-U],w[w.length-1-U]=H}E=c,c=E-A}if(!We.checkCodewordSkew(A,h,g))return null;let S=nn.getDecodedValue(w),B=Me.getCodeword(S);return B===-1?null:new ei(c,E,We.getCodewordBucketNumber(S),B)}static getModuleBitCount(e,t,n,o,c,d){let h=c,g=new Int32Array(8),w=0,E=o?1:-1,A=o;for(;(o?h<n:h>=t)&&w<g.length;)e.get(h,d)===A?(g[w]++,h+=E):(w++,A=!A);return w===g.length||h===(o?n:t)&&w===g.length-1?g:null}static getNumberOfECCodeWords(e){return 2<<e}static adjustCodewordStartColumn(e,t,n,o,c,d){let h=c,g=o?-1:1;for(let w=0;w<2;w++){for(;(o?h>=t:h<n)&&o===e.get(h,d);){if(Math.abs(c-h)>We.CODEWORD_SKEW_SIZE)return c;h+=g}g=-g,o=!o}return h}static checkCodewordSkew(e,t,n){return t-We.CODEWORD_SKEW_SIZE<=e&&e<=n+We.CODEWORD_SKEW_SIZE}static decodeCodewords(e,t,n){if(e.length===0)throw F.getFormatInstance();let o=1<<t+1,c=We.correctErrors(e,n,o);We.verifyCodewordCount(e,o);let d=re.decode(e,""+t);return d.setErrorsCorrected(c),d.setErasures(n.length),d}static correctErrors(e,t,n){if(t!=null&&t.length>n/2+We.MAX_ERRORS||n<0||n>We.MAX_EC_CODEWORDS)throw O.getChecksumInstance();return We.errorCorrection.decode(e,n,t)}static verifyCodewordCount(e,t){if(e.length<4)throw F.getFormatInstance();let n=e[0];if(n>e.length)throw F.getFormatInstance();if(n===0)if(t<e.length)e[0]=e.length-t;else throw F.getFormatInstance()}static getBitCountForCodeword(e){let t=new Int32Array(8),n=0,o=t.length-1;for(;!((e&1)!==n&&(n=e&1,o--,o<0));)t[o]++,e>>=1;return t}static getCodewordBucketNumber(e){return e instanceof Int32Array?this.getCodewordBucketNumber_Int32Array(e):this.getCodewordBucketNumber_number(e)}static getCodewordBucketNumber_number(e){return We.getCodewordBucketNumber(We.getBitCountForCodeword(e))}static getCodewordBucketNumber_Int32Array(e){return(e[0]-e[2]+e[4]-e[6]+9)%9}static toString(e){let t=new Yr;for(let n=0;n<e.length;n++){t.format("Row %2d: ",n);for(let o=0;o<e[n].length;o++){let c=e[n][o];c.getValue().length===0?t.format(" ",null):t.format("%4d(%2d)",c.getValue()[0],c.getConfidence(c.getValue()[0]))}t.format("%n")}return t.toString()}}We.CODEWORD_SKEW_SIZE=2,We.MAX_ERRORS=3,We.MAX_EC_CODEWORDS=512,We.errorCorrection=new Za;class Gt{decode(e,t=null){let n=Gt.decode(e,t,!1);if(n==null||n.length===0||n[0]==null)throw N.getNotFoundInstance();return n[0]}decodeMultiple(e,t=null){try{return Gt.decode(e,t,!0)}catch(n){throw n instanceof F||n instanceof O?N.getNotFoundInstance():n}}static decode(e,t,n){const o=new Array,c=He.detectMultiple(e,t,n);for(const d of c.getPoints()){const h=We.decode(c.getBits(),d[4],d[5],d[6],d[7],Gt.getMinCodewordWidth(d),Gt.getMaxCodewordWidth(d)),g=new Ce(h.getText(),h.getRawBytes(),void 0,d,ge.PDF_417);g.putMetadata(be.ERROR_CORRECTION_LEVEL,h.getECLevel());const w=h.getOther();w!=null&&g.putMetadata(be.PDF417_EXTRA_METADATA,w),o.push(g)}return o.map(d=>d)}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?v.MAX_VALUE:Math.trunc(Math.abs(e.getX()-t.getX()))}static getMaxCodewordWidth(e){return Math.floor(Math.max(Math.max(Gt.getMaxWidth(e[0],e[4]),Gt.getMaxWidth(e[6],e[2])*Me.MODULES_IN_CODEWORD/Me.MODULES_IN_STOP_PATTERN),Math.max(Gt.getMaxWidth(e[1],e[5]),Gt.getMaxWidth(e[7],e[3])*Me.MODULES_IN_CODEWORD/Me.MODULES_IN_STOP_PATTERN)))}static getMinCodewordWidth(e){return Math.floor(Math.min(Math.min(Gt.getMinWidth(e[0],e[4]),Gt.getMinWidth(e[6],e[2])*Me.MODULES_IN_CODEWORD/Me.MODULES_IN_STOP_PATTERN),Math.min(Gt.getMinWidth(e[1],e[5]),Gt.getMinWidth(e[7],e[3])*Me.MODULES_IN_CODEWORD/Me.MODULES_IN_STOP_PATTERN)))}reset(){}}class Pi extends x{}Pi.kind="ReaderException";class tl{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=!s(e)&&e.get(Z.TRY_HARDER)===!0,n=s(e)?null:e.get(Z.POSSIBLE_FORMATS),o=new Array;if(!s(n)){const c=n.some(d=>d===ge.UPC_A||d===ge.UPC_E||d===ge.EAN_13||d===ge.EAN_8||d===ge.CODABAR||d===ge.CODE_39||d===ge.CODE_93||d===ge.CODE_128||d===ge.ITF||d===ge.RSS_14||d===ge.RSS_EXPANDED);c&&!t&&o.push(new Tr(e,this.verbose)),n.includes(ge.QR_CODE)&&o.push(new qn),n.includes(ge.DATA_MATRIX)&&o.push(new jn),n.includes(ge.AZTEC)&&o.push(new Sr),n.includes(ge.PDF_417)&&o.push(new Gt),c&&t&&o.push(new Tr(e,this.verbose))}o.length===0&&(t||o.push(new Tr(e,this.verbose)),o.push(new qn),o.push(new jn),o.push(new Sr),o.push(new Gt),t&&o.push(new Tr(e,this.verbose))),this.readers=o}reset(){if(this.readers!==null)for(const e of this.readers)e.reset()}decodeInternal(e){if(this.readers===null)throw new Pi("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 Pi)continue}throw new N("No MultiFormat Readers were able to detect the code.")}}class vg extends we{constructor(e=null,t=500){const n=new tl;n.setHints(e),super(n,t)}decodeBitmap(e){return this.reader.decodeWithState(e)}}class Pg extends we{constructor(e=500){super(new Gt,e)}}class Lg extends we{constructor(e=500){super(new qn,e)}}var Ho;(function(b){b[b.ERROR_CORRECTION=0]="ERROR_CORRECTION",b[b.CHARACTER_SET=1]="CHARACTER_SET",b[b.DATA_MATRIX_SHAPE=2]="DATA_MATRIX_SHAPE",b[b.MIN_SIZE=3]="MIN_SIZE",b[b.MAX_SIZE=4]="MAX_SIZE",b[b.MARGIN=5]="MARGIN",b[b.PDF417_COMPACT=6]="PDF417_COMPACT",b[b.PDF417_COMPACTION=7]="PDF417_COMPACTION",b[b.PDF417_DIMENSIONS=8]="PDF417_DIMENSIONS",b[b.AZTEC_LAYERS=9]="AZTEC_LAYERS",b[b.QR_VERSION=10]="QR_VERSION"})(Ho||(Ho={}));var Pt=Ho;class Go{constructor(e){this.field=e,this.cachedGenerators=[],this.cachedGenerators.push(new Ve(e,Int32Array.from([1])))}buildGenerator(e){const t=this.cachedGenerators;if(e>=t.length){let n=t[t.length-1];const o=this.field;for(let c=t.length;c<=e;c++){const d=n.multiply(new Ve(o,Int32Array.from([1,o.exp(c-1+o.getGeneratorBase())])));t.push(d),n=d}}return t[e]}encode(e,t){if(t===0)throw new y("No error correction bytes");const n=e.length-t;if(n<=0)throw new y("No data bytes provided");const o=this.buildGenerator(t),c=new Int32Array(n);D.arraycopy(e,0,c,0,n);let d=new Ve(this.field,c);d=d.multiplyByMonomial(t,1);const g=d.divide(o)[1].getCoefficients(),w=t-g.length;for(let E=0;E<w;E++)e[n+E]=0;D.arraycopy(g,0,e,n+w,g.length)}}class Rt{constructor(){}static applyMaskPenaltyRule1(e){return Rt.applyMaskPenaltyRule1Internal(e,!0)+Rt.applyMaskPenaltyRule1Internal(e,!1)}static applyMaskPenaltyRule2(e){let t=0;const n=e.getArray(),o=e.getWidth(),c=e.getHeight();for(let d=0;d<c-1;d++){const h=n[d];for(let g=0;g<o-1;g++){const w=h[g];w===h[g+1]&&w===n[d+1][g]&&w===n[d+1][g+1]&&t++}}return Rt.N2*t}static applyMaskPenaltyRule3(e){let t=0;const n=e.getArray(),o=e.getWidth(),c=e.getHeight();for(let d=0;d<c;d++)for(let h=0;h<o;h++){const g=n[d];h+6<o&&g[h]===1&&g[h+1]===0&&g[h+2]===1&&g[h+3]===1&&g[h+4]===1&&g[h+5]===0&&g[h+6]===1&&(Rt.isWhiteHorizontal(g,h-4,h)||Rt.isWhiteHorizontal(g,h+7,h+11))&&t++,d+6<c&&n[d][h]===1&&n[d+1][h]===0&&n[d+2][h]===1&&n[d+3][h]===1&&n[d+4][h]===1&&n[d+5][h]===0&&n[d+6][h]===1&&(Rt.isWhiteVertical(n,h,d-4,d)||Rt.isWhiteVertical(n,h,d+7,d+11))&&t++}return t*Rt.N3}static isWhiteHorizontal(e,t,n){t=Math.max(t,0),n=Math.min(n,e.length);for(let o=t;o<n;o++)if(e[o]===1)return!1;return!0}static isWhiteVertical(e,t,n,o){n=Math.max(n,0),o=Math.min(o,e.length);for(let c=n;c<o;c++)if(e[c][t]===1)return!1;return!0}static applyMaskPenaltyRule4(e){let t=0;const n=e.getArray(),o=e.getWidth(),c=e.getHeight();for(let g=0;g<c;g++){const w=n[g];for(let E=0;E<o;E++)w[E]===1&&t++}const d=e.getHeight()*e.getWidth();return Math.floor(Math.abs(t*2-d)*10/d)*Rt.N4}static getDataMaskBit(e,t,n){let o,c;switch(e){case 0:o=n+t&1;break;case 1:o=n&1;break;case 2:o=t%3;break;case 3:o=(n+t)%3;break;case 4:o=Math.floor(n/2)+Math.floor(t/3)&1;break;case 5:c=n*t,o=(c&1)+c%3;break;case 6:c=n*t,o=(c&1)+c%3&1;break;case 7:c=n*t,o=c%3+(n+t&1)&1;break;default:throw new y("Invalid mask pattern: "+e)}return o===0}static applyMaskPenaltyRule1Internal(e,t){let n=0;const o=t?e.getHeight():e.getWidth(),c=t?e.getWidth():e.getHeight(),d=e.getArray();for(let h=0;h<o;h++){let g=0,w=-1;for(let E=0;E<c;E++){const A=t?d[h][E]:d[E][h];A===w?g++:(g>=5&&(n+=Rt.N1+(g-5)),g=1,w=A)}g>=5&&(n+=Rt.N1+(g-5))}return n}}Rt.N1=3,Rt.N2=3,Rt.N3=40,Rt.N4=10;class Li{constructor(e,t){this.width=e,this.height=t;const n=new Array(t);for(let o=0;o!==t;o++)n[o]=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)M.fill(t,e)}equals(e){if(!(e instanceof Li))return!1;const t=e;if(this.width!==t.width||this.height!==t.height)return!1;for(let n=0,o=this.height;n<o;++n){const c=this.bytes[n],d=t.bytes[n];for(let h=0,g=this.width;h<g;++h)if(c[h]!==d[h])return!1}return!0}toString(){const e=new G;for(let t=0,n=this.height;t<n;++t){const o=this.bytes[t];for(let c=0,d=this.width;c<d;++c)switch(o[c]){case 0:e.append(" 0");break;case 1:e.append(" 1");break;default:e.append(" ");break}e.append(`
19
- `)}return e.toString()}}class dr{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 G;return e.append(`<<
11
+ */var Rn=function(){return Rn=Object.assign||function(l){for(var i,o=1,u=arguments.length;o<u;o++){i=arguments[o];for(var f in i)Object.prototype.hasOwnProperty.call(i,f)&&(l[f]=i[f])}return l},Rn.apply(this,arguments)};typeof SuppressedError=="function"&&SuppressedError;var sr;(function(a){var l=function(){function m(p,_,x,C){if(this.version=p,this.errorCorrectionLevel=_,this.modules=[],this.isFunction=[],p<m.MIN_VERSION||p>m.MAX_VERSION)throw new RangeError("Version value out of range");if(C<-1||C>7)throw new RangeError("Mask value out of range");this.size=p*4+17;for(var y=[],I=0;I<this.size;I++)y.push(!1);for(var I=0;I<this.size;I++)this.modules.push(y.slice()),this.isFunction.push(y.slice());this.drawFunctionPatterns();var B=this.addEccAndInterleave(x);if(this.drawCodewords(B),C==-1)for(var T=1e9,I=0;I<8;I++){this.applyMask(I),this.drawFormatBits(I);var D=this.getPenaltyScore();D<T&&(C=I,T=D),this.applyMask(I)}u(0<=C&&C<=7),this.mask=C,this.applyMask(C),this.drawFormatBits(C),this.isFunction=[]}return m.encodeText=function(p,_){var x=a.QrSegment.makeSegments(p);return m.encodeSegments(x,_)},m.encodeBinary=function(p,_){var x=a.QrSegment.makeBytes(p);return m.encodeSegments([x],_)},m.encodeSegments=function(p,_,x,C,y,I){if(x===void 0&&(x=1),C===void 0&&(C=40),y===void 0&&(y=-1),I===void 0&&(I=!0),!(m.MIN_VERSION<=x&&x<=C&&C<=m.MAX_VERSION)||y<-1||y>7)throw new RangeError("Invalid value");var B,T;for(B=x;;B++){var D=m.getNumDataCodewords(B,_)*8,k=f.getTotalBits(p,B);if(k<=D){T=k;break}if(B>=C)throw new RangeError("Data too long")}for(var P=0,M=[m.Ecc.MEDIUM,m.Ecc.QUARTILE,m.Ecc.HIGH];P<M.length;P++){var v=M[P];I&&T<=m.getNumDataCodewords(B,v)*8&&(_=v)}for(var j=[],H=0,Z=p;H<Z.length;H++){var V=Z[H];i(V.mode.modeBits,4,j),i(V.numChars,V.mode.numCharCountBits(B),j);for(var L=0,F=V.getData();L<F.length;L++){var re=F[L];j.push(re)}}u(j.length==T);var K=m.getNumDataCodewords(B,_)*8;u(j.length<=K),i(0,Math.min(4,K-j.length),j),i(0,(8-j.length%8)%8,j),u(j.length%8==0);for(var ee=236;j.length<K;ee^=253)i(ee,8,j);for(var G=[];G.length*8<j.length;)G.push(0);return j.forEach(function(W,N){return G[N>>>3]|=W<<7-(N&7)}),new m(B,_,G,y)},m.prototype.getModule=function(p,_){return 0<=p&&p<this.size&&0<=_&&_<this.size&&this.modules[_][p]},m.prototype.getModules=function(){return this.modules},m.prototype.drawFunctionPatterns=function(){for(var p=0;p<this.size;p++)this.setFunctionModule(6,p,p%2==0),this.setFunctionModule(p,6,p%2==0);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);for(var _=this.getAlignmentPatternPositions(),x=_.length,p=0;p<x;p++)for(var C=0;C<x;C++)p==0&&C==0||p==0&&C==x-1||p==x-1&&C==0||this.drawAlignmentPattern(_[p],_[C]);this.drawFormatBits(0),this.drawVersion()},m.prototype.drawFormatBits=function(p){for(var _=this.errorCorrectionLevel.formatBits<<3|p,x=_,C=0;C<10;C++)x=x<<1^(x>>>9)*1335;var y=(_<<10|x)^21522;u(y>>>15==0);for(var C=0;C<=5;C++)this.setFunctionModule(8,C,o(y,C));this.setFunctionModule(8,7,o(y,6)),this.setFunctionModule(8,8,o(y,7)),this.setFunctionModule(7,8,o(y,8));for(var C=9;C<15;C++)this.setFunctionModule(14-C,8,o(y,C));for(var C=0;C<8;C++)this.setFunctionModule(this.size-1-C,8,o(y,C));for(var C=8;C<15;C++)this.setFunctionModule(8,this.size-15+C,o(y,C));this.setFunctionModule(8,this.size-8,!0)},m.prototype.drawVersion=function(){if(!(this.version<7)){for(var p=this.version,_=0;_<12;_++)p=p<<1^(p>>>11)*7973;var x=this.version<<12|p;u(x>>>18==0);for(var _=0;_<18;_++){var C=o(x,_),y=this.size-11+_%3,I=Math.floor(_/3);this.setFunctionModule(y,I,C),this.setFunctionModule(I,y,C)}}},m.prototype.drawFinderPattern=function(p,_){for(var x=-4;x<=4;x++)for(var C=-4;C<=4;C++){var y=Math.max(Math.abs(C),Math.abs(x)),I=p+C,B=_+x;0<=I&&I<this.size&&0<=B&&B<this.size&&this.setFunctionModule(I,B,y!=2&&y!=4)}},m.prototype.drawAlignmentPattern=function(p,_){for(var x=-2;x<=2;x++)for(var C=-2;C<=2;C++)this.setFunctionModule(p+C,_+x,Math.max(Math.abs(C),Math.abs(x))!=1)},m.prototype.setFunctionModule=function(p,_,x){this.modules[_][p]=x,this.isFunction[_][p]=!0},m.prototype.addEccAndInterleave=function(p){var _=this.version,x=this.errorCorrectionLevel;if(p.length!=m.getNumDataCodewords(_,x))throw new RangeError("Invalid argument");for(var C=m.NUM_ERROR_CORRECTION_BLOCKS[x.ordinal][_],y=m.ECC_CODEWORDS_PER_BLOCK[x.ordinal][_],I=Math.floor(m.getNumRawDataModules(_)/8),B=C-I%C,T=Math.floor(I/C),D=[],k=m.reedSolomonComputeDivisor(y),P=0,M=0;P<C;P++){var v=p.slice(M,M+T-y+(P<B?0:1));M+=v.length;var j=m.reedSolomonComputeRemainder(v,k);P<B&&v.push(0),D.push(v.concat(j))}for(var H=[],Z=function(V){D.forEach(function(L,F){(V!=T-y||F>=B)&&H.push(L[V])})},P=0;P<D[0].length;P++)Z(P);return u(H.length==I),H},m.prototype.drawCodewords=function(p){if(p.length!=Math.floor(m.getNumRawDataModules(this.version)/8))throw new RangeError("Invalid argument");for(var _=0,x=this.size-1;x>=1;x-=2){x==6&&(x=5);for(var C=0;C<this.size;C++)for(var y=0;y<2;y++){var I=x-y,B=(x+1&2)==0,T=B?this.size-1-C:C;!this.isFunction[T][I]&&_<p.length*8&&(this.modules[T][I]=o(p[_>>>3],7-(_&7)),_++)}}u(_==p.length*8)},m.prototype.applyMask=function(p){if(p<0||p>7)throw new RangeError("Mask value out of range");for(var _=0;_<this.size;_++)for(var x=0;x<this.size;x++){var C=void 0;switch(p){case 0:C=(x+_)%2==0;break;case 1:C=_%2==0;break;case 2:C=x%3==0;break;case 3:C=(x+_)%3==0;break;case 4:C=(Math.floor(x/3)+Math.floor(_/2))%2==0;break;case 5:C=x*_%2+x*_%3==0;break;case 6:C=(x*_%2+x*_%3)%2==0;break;case 7:C=((x+_)%2+x*_%3)%2==0;break;default:throw new Error("Unreachable")}!this.isFunction[_][x]&&C&&(this.modules[_][x]=!this.modules[_][x])}},m.prototype.getPenaltyScore=function(){for(var p=0,_=0;_<this.size;_++){for(var x=!1,C=0,y=[0,0,0,0,0,0,0],I=0;I<this.size;I++)this.modules[_][I]==x?(C++,C==5?p+=m.PENALTY_N1:C>5&&p++):(this.finderPenaltyAddHistory(C,y),x||(p+=this.finderPenaltyCountPatterns(y)*m.PENALTY_N3),x=this.modules[_][I],C=1);p+=this.finderPenaltyTerminateAndCount(x,C,y)*m.PENALTY_N3}for(var I=0;I<this.size;I++){for(var x=!1,B=0,y=[0,0,0,0,0,0,0],_=0;_<this.size;_++)this.modules[_][I]==x?(B++,B==5?p+=m.PENALTY_N1:B>5&&p++):(this.finderPenaltyAddHistory(B,y),x||(p+=this.finderPenaltyCountPatterns(y)*m.PENALTY_N3),x=this.modules[_][I],B=1);p+=this.finderPenaltyTerminateAndCount(x,B,y)*m.PENALTY_N3}for(var _=0;_<this.size-1;_++)for(var I=0;I<this.size-1;I++){var T=this.modules[_][I];T==this.modules[_][I+1]&&T==this.modules[_+1][I]&&T==this.modules[_+1][I+1]&&(p+=m.PENALTY_N2)}for(var D=0,k=0,P=this.modules;k<P.length;k++){var M=P[k];D=M.reduce(function(H,Z){return H+(Z?1:0)},D)}var v=this.size*this.size,j=Math.ceil(Math.abs(D*20-v*10)/v)-1;return u(0<=j&&j<=9),p+=j*m.PENALTY_N4,u(0<=p&&p<=2568888),p},m.prototype.getAlignmentPatternPositions=function(){if(this.version==1)return[];for(var p=Math.floor(this.version/7)+2,_=Math.floor((this.version*8+p*3+5)/(p*4-4))*2,x=[6],C=this.size-7;x.length<p;C-=_)x.splice(1,0,C);return x},m.getNumRawDataModules=function(p){if(p<m.MIN_VERSION||p>m.MAX_VERSION)throw new RangeError("Version number out of range");var _=(16*p+128)*p+64;if(p>=2){var x=Math.floor(p/7)+2;_-=(25*x-10)*x-55,p>=7&&(_-=36)}return u(208<=_&&_<=29648),_},m.getNumDataCodewords=function(p,_){return Math.floor(m.getNumRawDataModules(p)/8)-m.ECC_CODEWORDS_PER_BLOCK[_.ordinal][p]*m.NUM_ERROR_CORRECTION_BLOCKS[_.ordinal][p]},m.reedSolomonComputeDivisor=function(p){if(p<1||p>255)throw new RangeError("Degree out of range");for(var _=[],x=0;x<p-1;x++)_.push(0);_.push(1);for(var C=1,x=0;x<p;x++){for(var y=0;y<_.length;y++)_[y]=m.reedSolomonMultiply(_[y],C),y+1<_.length&&(_[y]^=_[y+1]);C=m.reedSolomonMultiply(C,2)}return _},m.reedSolomonComputeRemainder=function(p,_){for(var x=_.map(function(T){return 0}),C=function(T){var D=T^x.shift();x.push(0),_.forEach(function(k,P){return x[P]^=m.reedSolomonMultiply(k,D)})},y=0,I=p;y<I.length;y++){var B=I[y];C(B)}return x},m.reedSolomonMultiply=function(p,_){if(p>>>8||_>>>8)throw new RangeError("Byte out of range");for(var x=0,C=7;C>=0;C--)x=x<<1^(x>>>7)*285,x^=(_>>>C&1)*p;return u(x>>>8==0),x},m.prototype.finderPenaltyCountPatterns=function(p){var _=p[1];u(_<=this.size*3);var x=_>0&&p[2]==_&&p[3]==_*3&&p[4]==_&&p[5]==_;return(x&&p[0]>=_*4&&p[6]>=_?1:0)+(x&&p[6]>=_*4&&p[0]>=_?1:0)},m.prototype.finderPenaltyTerminateAndCount=function(p,_,x){return p&&(this.finderPenaltyAddHistory(_,x),_=0),_+=this.size,this.finderPenaltyAddHistory(_,x),this.finderPenaltyCountPatterns(x)},m.prototype.finderPenaltyAddHistory=function(p,_){_[0]==0&&(p+=this.size),_.pop(),_.unshift(p)},m.MIN_VERSION=1,m.MAX_VERSION=40,m.PENALTY_N1=3,m.PENALTY_N2=3,m.PENALTY_N3=40,m.PENALTY_N4=10,m.ECC_CODEWORDS_PER_BLOCK=[[-1,7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],[-1,13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]],m.NUM_ERROR_CORRECTION_BLOCKS=[[-1,1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],[-1,1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],[-1,1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],[-1,1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]],m}();a.QrCode=l;function i(m,p,_){if(p<0||p>31||m>>>p)throw new RangeError("Value out of range");for(var x=p-1;x>=0;x--)_.push(m>>>x&1)}function o(m,p){return(m>>>p&1)!=0}function u(m){if(!m)throw new Error("Assertion error")}var f=function(){function m(p,_,x){if(this.mode=p,this.numChars=_,this.bitData=x,_<0)throw new RangeError("Invalid argument");this.bitData=x.slice()}return m.makeBytes=function(p){for(var _=[],x=0,C=p;x<C.length;x++){var y=C[x];i(y,8,_)}return new m(m.Mode.BYTE,p.length,_)},m.makeNumeric=function(p){if(!m.isNumeric(p))throw new RangeError("String contains non-numeric characters");for(var _=[],x=0;x<p.length;){var C=Math.min(p.length-x,3);i(parseInt(p.substring(x,x+C),10),C*3+1,_),x+=C}return new m(m.Mode.NUMERIC,p.length,_)},m.makeAlphanumeric=function(p){if(!m.isAlphanumeric(p))throw new RangeError("String contains unencodable characters in alphanumeric mode");var _=[],x;for(x=0;x+2<=p.length;x+=2){var C=m.ALPHANUMERIC_CHARSET.indexOf(p.charAt(x))*45;C+=m.ALPHANUMERIC_CHARSET.indexOf(p.charAt(x+1)),i(C,11,_)}return x<p.length&&i(m.ALPHANUMERIC_CHARSET.indexOf(p.charAt(x)),6,_),new m(m.Mode.ALPHANUMERIC,p.length,_)},m.makeSegments=function(p){return p==""?[]:m.isNumeric(p)?[m.makeNumeric(p)]:m.isAlphanumeric(p)?[m.makeAlphanumeric(p)]:[m.makeBytes(m.toUtf8ByteArray(p))]},m.makeEci=function(p){var _=[];if(p<0)throw new RangeError("ECI assignment value out of range");if(p<128)i(p,8,_);else if(p<16384)i(2,2,_),i(p,14,_);else if(p<1e6)i(6,3,_),i(p,21,_);else throw new RangeError("ECI assignment value out of range");return new m(m.Mode.ECI,0,_)},m.isNumeric=function(p){return m.NUMERIC_REGEX.test(p)},m.isAlphanumeric=function(p){return m.ALPHANUMERIC_REGEX.test(p)},m.prototype.getData=function(){return this.bitData.slice()},m.getTotalBits=function(p,_){for(var x=0,C=0,y=p;C<y.length;C++){var I=y[C],B=I.mode.numCharCountBits(_);if(I.numChars>=1<<B)return 1/0;x+=4+B+I.bitData.length}return x},m.toUtf8ByteArray=function(p){p=encodeURI(p);for(var _=[],x=0;x<p.length;x++)p.charAt(x)!="%"?_.push(p.charCodeAt(x)):(_.push(parseInt(p.substring(x+1,x+3),16)),x+=2);return _},m.NUMERIC_REGEX=/^[0-9]*$/,m.ALPHANUMERIC_REGEX=/^[A-Z0-9 $%*+.\/:-]*$/,m.ALPHANUMERIC_CHARSET="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:",m}();a.QrSegment=f})(sr||(sr={})),function(a){(function(l){var i=function(){function o(u,f){this.ordinal=u,this.formatBits=f}return o.LOW=new o(0,1),o.MEDIUM=new o(1,0),o.QUARTILE=new o(2,3),o.HIGH=new o(3,2),o}();l.Ecc=i})(a.QrCode||(a.QrCode={}))}(sr||(sr={})),function(a){(function(l){var i=function(){function o(u,f){this.modeBits=u,this.numBitsCharCount=f}return o.prototype.numCharCountBits=function(u){return this.numBitsCharCount[Math.floor((u+7)/17)]},o.NUMERIC=new o(1,[10,12,14]),o.ALPHANUMERIC=new o(2,[9,11,13]),o.BYTE=new o(4,[8,16,16]),o.KANJI=new o(8,[8,10,12]),o.ECI=new o(7,[0,0,0]),o}();l.Mode=i})(a.QrSegment||(a.QrSegment={}))}(sr||(sr={}));var yr=sr,_o="L",wo={L:yr.QrCode.Ecc.LOW,M:yr.QrCode.Ecc.MEDIUM,Q:yr.QrCode.Ecc.QUARTILE,H:yr.QrCode.Ecc.HIGH},M1=function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0}();function Co(a){return a in wo}function ma(a,l){l===void 0&&(l=0);var i=[];return a.forEach(function(o,u){var f=null;o.forEach(function(m,p){if(!m&&f!==null){i.push("M".concat(f+l," ").concat(u+l,"h").concat(p-f,"v1H").concat(f+l,"z")),f=null;return}if(p===o.length-1){if(!m)return;f===null?i.push("M".concat(p+l,",").concat(u+l," h1v1H").concat(p+l,"z")):i.push("M".concat(f+l,",").concat(u+l," h").concat(p+1-f,"v1H").concat(f+l,"z"));return}m&&f===null&&(f=p)})}),i.join("")}function ga(a,l,i,o){var u=o.width,f=o.height,m=o.x,p=o.y,_=a.length+i*2,x=Math.floor(l*.1),C=_/l,y=(u||x)*C,I=(f||x)*C,B=m==null?a.length/2-y/2:m*C,T=p==null?a.length/2-I/2:p*C,D=null;if(o.excavate){var k=Math.floor(B),P=Math.floor(T),M=Math.ceil(y+B-k),v=Math.ceil(I+T-P);D={x:k,y:P,w:M,h:v}}return{x:B,y:T,h:I,w:y,excavation:D}}function pa(a,l){return a.slice().map(function(i,o){return o<l.y||o>=l.y+l.h?i:i.map(function(u,f){return f<l.x||f>=l.x+l.w?u:!1})})}var Eo={value:{type:String,required:!0,default:""},size:{type:Number,default:100},level:{type:String,default:_o,validator:function(a){return Co(a)}},background:{type:String,default:"#fff"},foreground:{type:String,default:"#000"},margin:{type:Number,required:!1,default:0},imageSettings:{type:Object,required:!1,default:function(){return{}}},gradient:{type:Boolean,required:!1,default:!1},gradientType:{type:String,required:!1,default:"linear",validator:function(a){return["linear","radial"].indexOf(a)>-1}},gradientStartColor:{type:String,required:!1,default:"#000"},gradientEndColor:{type:String,required:!1,default:"#fff"}},D1=Rn(Rn({},Eo),{renderAs:{type:String,required:!1,default:"canvas",validator:function(a){return["canvas","svg"].indexOf(a)>-1}}}),v1=r.defineComponent({name:"QRCodeSvg",props:Eo,setup:function(a){var l=r.ref(0),i=r.ref(""),o,u=function(){var m=a.value,p=a.level,_=a.margin,x=_>>>0,C=Co(p)?p:_o,y=yr.QrCode.encodeText(m,wo[C]).getModules();if(l.value=y.length+x*2,a.imageSettings.src){var I=ga(y,a.size,x,a.imageSettings);o={x:I.x+x,y:I.y+x,width:I.w,height:I.h},I.excavation&&(y=pa(y,I.excavation))}i.value=ma(y,x)},f=function(){if(!a.gradient)return null;var m=a.gradientType==="linear"?{x1:"0%",y1:"0%",x2:"100%",y2:"100%"}:{cx:"50%",cy:"50%",r:"50%",fx:"50%",fy:"50%"};return r.h(a.gradientType==="linear"?"linearGradient":"radialGradient",Rn({id:"qr-gradient"},m),[r.h("stop",{offset:"0%",style:{stopColor:a.gradientStartColor}}),r.h("stop",{offset:"100%",style:{stopColor:a.gradientEndColor}})])};return u(),r.onUpdated(u),function(){return r.h("svg",{width:a.size,height:a.size,"shape-rendering":"crispEdges",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 ".concat(l.value," ").concat(l.value)},[r.h("defs",{},[f()]),r.h("rect",{width:"100%",height:"100%",fill:a.background}),r.h("path",{fill:a.gradient?"url(#qr-gradient)":a.foreground,d:i.value}),a.imageSettings.src&&r.h("image",Rn({href:a.imageSettings.src},o))])}}}),P1=r.defineComponent({name:"QRCodeCanvas",props:Eo,setup:function(a,l){var i=r.ref(null),o=r.ref(null),u=function(){var m=a.value,p=a.level,_=a.size,x=a.margin,C=a.background,y=a.foreground,I=a.gradient,B=a.gradientType,T=a.gradientStartColor,D=a.gradientEndColor,k=x>>>0,P=Co(p)?p:_o,M=i.value;if(M){var v=M.getContext("2d");if(v){var j=yr.QrCode.encodeText(m,wo[P]).getModules(),H=j.length+k*2,Z=o.value,V={x:0,y:0,width:0,height:0},L=a.imageSettings.src&&Z!=null&&Z.naturalWidth!==0&&Z.naturalHeight!==0;if(L){var F=ga(j,a.size,k,a.imageSettings);V={x:F.x+k,y:F.y+k,width:F.w,height:F.h},F.excavation&&(j=pa(j,F.excavation))}var re=window.devicePixelRatio||1,K=_/H*re;if(M.height=M.width=_*re,v.scale(K,K),v.fillStyle=C,v.fillRect(0,0,H,H),I){var ee=void 0;B==="linear"?ee=v.createLinearGradient(0,0,H,H):ee=v.createRadialGradient(H/2,H/2,0,H/2,H/2,H/2),ee.addColorStop(0,T),ee.addColorStop(1,D),v.fillStyle=ee}else v.fillStyle=y;M1?v.fill(new Path2D(ma(j,k))):j.forEach(function(G,W){G.forEach(function(N,X){N&&v.fillRect(X+k,W+k,1,1)})}),L&&v.drawImage(Z,V.x,V.y,V.width,V.height)}}};r.onMounted(u),r.onUpdated(u);var f=l.attrs.style;return function(){return r.h(r.Fragment,[r.h("canvas",Rn(Rn({},l.attrs),{ref:i,style:Rn(Rn({},f),{width:"".concat(a.size,"px"),height:"".concat(a.size,"px")})})),a.imageSettings.src&&r.h("img",{ref:o,src:a.imageSettings.src,style:{display:"none"},onLoad:u})])}}}),xa=r.defineComponent({name:"Qrcode",render:function(){var a=this.$props,l=a.renderAs,i=a.value,o=a.size,u=a.margin,f=a.level,m=a.background,p=a.foreground,_=a.imageSettings,x=a.gradient,C=a.gradientType,y=a.gradientStartColor,I=a.gradientEndColor;return r.h(l==="svg"?v1:P1,{value:i,size:o,margin:u,level:f,background:m,foreground:p,imageSettings:_,gradient:x,gradientType:C,gradientStartColor:y,gradientEndColor:I})},props:D1});const L1={},F1={viewBox:"0 0 24 24","aria-hidden":"true"};function V1(a,l){return r.openBlock(),r.createElementBlock("svg",F1,[...l[0]||(l[0]=[r.createElementVNode("path",{d:"M7 4h10a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2z"},null,-1),r.createElementVNode("path",{d:"M9 7h6"},null,-1),r.createElementVNode("path",{d:"M10 18h4"},null,-1)])])}const U1=We(L1,[["render",V1]]),z1={},H1={viewBox:"0 0 24 24","aria-hidden":"true"};function G1(a,l){return r.openBlock(),r.createElementBlock("svg",H1,[...l[0]||(l[0]=[r.createStaticVNode('<path d="M4 8V6a2 2 0 0 1 2-2h2"></path><path d="M20 8V6a2 2 0 0 0-2-2h-2"></path><path d="M4 16v2a2 2 0 0 0 2 2h2"></path><path d="M20 16v2a2 2 0 0 1-2 2h-2"></path><path d="M7 12h10"></path>',5)])])}const W1=We(z1,[["render",G1]]),X1="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20viewBox='0%200%2019.6108%2014.0107'%20width='19.610840'%20height='14.010742'%20fill='none'%20customFrame='%23000000'%3e%3cpath%20id='Форма%20'%20d='M18.3054%201.30566L6.61792%2012.639L1.30542%207.48747'%20stroke='rgb(255,255,255)'%20stroke-linecap='round'%20stroke-linejoin='round'%20stroke-width='2.5999999'/%3e%3c/svg%3e",$1={class:"wrapper_qr_page"},j1=["src"],q1={class:"modal_qr"},Z1={class:"modal_qr_content"},Y1={class:"wrapper_icon_qr"},K1=["src"],Q1={class:"total_order_price"},J1={class:"ttl_wrapper"},ef={class:"ttl_head"},tf={class:"ttl_bar"},nf={class:"hint hint-anim","aria-label":"Инструкция по оплате"},rf={class:"steps","aria-hidden":"true"},of={class:"step is-active","data-i":"0"},sf={class:"ico"},af={class:"step","data-i":"1"},lf={class:"ico"},cf={class:"step","data-i":"2"},df={class:"ico"},uf=["src"],ff={class:"qr_border"},hf=We(r.defineComponent({__name:"CompletedQRCode",setup(a){const l=Ct(),i=Mt(),o=ot(),u=ke.useRouter(),f={src:l.itemThemes.logo||"",width:60,height:60,excavate:!0},m=r.computed(()=>l.itemThemes.kiosk_qr_payment_timeout||60).value,p=r.ref(m);let _=0;const x=r.computed(()=>{const D=Math.floor(p.value/60),k=p.value%60;return`${D}:${k.toString().padStart(2,"0")}`}),C=r.computed(()=>p.value/m*100),y=r.computed(()=>i.paymentCostQR),I=()=>{p.value--,p.value<=0&&(clearInterval(_),B())},B=()=>{o.removeFromLocalStorage(["cart","authTokensAccess","authTokensRefresh","user"]),sessionStorage.removeItem("is_adult"),u.replace({name:"home"}).then(()=>u.go(0))};r.onMounted(()=>{_=setInterval(I,1e3)}),r.onBeforeUnmount(()=>{clearInterval(_)});const{mediaUrl:T}=bn(()=>l.itemThemes.kiosk_preloader?"preloader":null);return(D,k)=>(r.openBlock(),r.createElementBlock("div",$1,[(r.openBlock(),r.createElementBlock("video",{loop:"",autoplay:"",muted:"",playsinline:"",key:r.unref(T)},[r.createElementVNode("source",{src:r.unref(T)||"",type:"video/webm"},null,8,j1)])),k[7]||(k[7]=r.createElementVNode("div",{class:"start_img_black"},null,-1)),r.createElementVNode("div",q1,[r.createElementVNode("div",Z1,[r.createElementVNode("div",Y1,[r.createElementVNode("img",{src:r.unref(ha),width:"100",height:"100"},null,8,K1)]),k[6]||(k[6]=r.createElementVNode("h1",null,"Оплата по QR",-1)),r.createElementVNode("p",Q1,[r.createVNode(ft,{price:y.value,fixedFloat:2},null,8,["price"]),r.createTextVNode(" "+r.toDisplayString(r.unref(o).config_lib.currency_symbol),1)]),r.createElementVNode("div",J1,[r.createElementVNode("div",ef,[k[0]||(k[0]=r.createElementVNode("span",null,"Срок жизни QR-кода",-1)),r.createElementVNode("b",null,r.toDisplayString(x.value),1)]),r.createElementVNode("div",tf,[r.createElementVNode("div",{class:"ttl_fill",style:r.normalizeStyle({width:`${C.value}%`})},null,4)])]),r.createElementVNode("p",nf,[r.createElementVNode("div",rf,[r.createElementVNode("div",of,[r.createElementVNode("div",sf,[r.createVNode(U1)]),k[1]||(k[1]=r.createElementVNode("div",{class:"txt"},"Возьмите телефон →",-1))]),k[4]||(k[4]=r.createElementVNode("div",{class:"sep"},null,-1)),r.createElementVNode("div",af,[r.createElementVNode("div",lf,[r.createVNode(W1)]),k[2]||(k[2]=r.createElementVNode("span",{class:"txt"},"Отсканируйте QR-код",-1))]),k[5]||(k[5]=r.createElementVNode("span",{class:"sep"},"→",-1)),r.createElementVNode("div",cf,[r.createElementVNode("div",df,[r.createElementVNode("img",{src:r.unref(X1),width:"30",height:"30"},null,8,uf)]),k[3]||(k[3]=r.createElementVNode("span",{class:"txt"},"Оплатите заказ",-1))])])]),r.createElementVNode("div",ff,[r.createVNode(xa,{value:r.unref(i).linkQR,size:200,level:"Q","render-as":"svg","image-settings":f},null,8,["value"])]),r.createVNode(sn,{textButtonDefault:"Отменить заказ",onClick:B,class:"cancel_order_btn"})])])]))}}),[["__scopeId","data-v-bd3b4b16"]]),mf={key:0,class:"wrapper_qr"},gf={key:1,class:"wrapper_qr"},pf={key:2,class:"wrapper_qr"},xf={key:3,class:"wrapper_qr"},_f=We(r.defineComponent({__name:"CartCompletedOrder",props:{orderNumber:{}},setup(a){const l=Mt(),i=Ct(),{orderNumber:o,orderCompleted_lib:u}=_e.storeToRefs(l),{mediaUrl:f}=bn(()=>i.itemThemes.kiosk_preloader?"preloader":null);return(m,p)=>(r.openBlock(),r.createElementBlock(r.Fragment,null,[r.unref(u)&&r.unref(u)===1?(r.openBlock(),r.createElementBlock("section",mf,[r.createVNode(T1)])):r.unref(u)&&r.unref(u)===2?(r.openBlock(),r.createElementBlock("section",gf,[r.createVNode(O1)])):r.createCommentVNode("",!0),r.unref(u)&&r.unref(u)===3?(r.openBlock(),r.createElementBlock("section",pf,[r.createVNode(C1,{orderNumber:r.unref(o),mediaUrl:r.unref(f)},null,8,["orderNumber","mediaUrl"])])):r.createCommentVNode("",!0),r.unref(u)&&r.unref(u)===4?(r.openBlock(),r.createElementBlock("section",xf,[r.createVNode(hf)])):r.createCommentVNode("",!0)],64))}}),[["__scopeId","data-v-3779e8ee"]]);function wf(){const a=ke.useRoute(),l=Mt(),i=ot(),o=Vn(),{isButtonDisabled:u}=_e.storeToRefs(l),f=(p,_)=>{const x=o.isTableService?"tableservice":p.kiosk_menu?"kiosk":"qr",C=l.createPaymentHandler(x,p.kiosk_menu,_);return C?{...C.config,route:{params:{orgId:String(a.params.orgId)}},handler:C.handler,resetDiscounts:p.resetDiscounts,setButtonDisabled:y=>{u.value=y},on403Kiosk:()=>{localStorage.removeItem("apiKey"),i.is_showApiKey=!0}}:null};return{getCreateOrderConfig:f,makeCreateOrderRequest:async(p,_)=>{const x=f(p,_.paymentMethodId);if(x)return Ld(_.items,x,{comment:_.comment,is_authorized:_.isAuthorized,signal:_.signal})}}}const Cf={},Ef={class:"cart_loyal_qr",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none"};function yf(a,l){return r.openBlock(),r.createElementBlock("svg",Ef,[...l[0]||(l[0]=[r.createElementVNode("path",{d:"M19 20H20M16 20H14V17M17 17H20V14H19M14 14H16M4 16.9997C4 16.0679 4 15.6019 4.15224 15.2344C4.35523 14.7443 4.74432 14.3552 5.23438 14.1522C5.60192 14 6.06786 14 6.99974 14C7.93163 14 8.39808 14 8.76562 14.1522C9.25568 14.3552 9.64467 14.7443 9.84766 15.2344C9.9999 15.6019 9.9999 16.0681 9.9999 17C9.9999 17.9319 9.9999 18.3978 9.84766 18.7654C9.64467 19.2554 9.25568 19.6447 8.76562 19.8477C8.39808 19.9999 7.93162 19.9999 6.99974 19.9999C6.06786 19.9999 5.60192 19.9999 5.23438 19.8477C4.74432 19.6447 4.35523 19.2557 4.15224 18.7656C4 18.3981 4 17.9316 4 16.9997ZM14 6.99974C14 6.06786 14 5.60192 14.1522 5.23438C14.3552 4.74432 14.7443 4.35523 15.2344 4.15224C15.6019 4 16.0679 4 16.9997 4C17.9316 4 18.3981 4 18.7656 4.15224C19.2557 4.35523 19.6447 4.74432 19.8477 5.23438C19.9999 5.60192 19.9999 6.06812 19.9999 7C19.9999 7.93188 19.9999 8.39783 19.8477 8.76537C19.6447 9.25542 19.2557 9.64467 18.7656 9.84766C18.3981 9.9999 17.9316 9.9999 16.9997 9.9999C16.0679 9.9999 15.6019 9.9999 15.2344 9.84766C14.7443 9.64467 14.3552 9.25568 14.1522 8.76562C14 8.39808 14 7.93163 14 6.99974ZM4 6.99974C4 6.06786 4 5.60192 4.15224 5.23438C4.35523 4.74432 4.74432 4.35523 5.23438 4.15224C5.60192 4 6.06786 4 6.99974 4C7.93163 4 8.39808 4 8.76562 4.15224C9.25568 4.35523 9.64467 4.74432 9.84766 5.23438C9.9999 5.60192 9.9999 6.06812 9.9999 7C9.9999 7.93188 9.9999 8.39783 9.84766 8.76537C9.64467 9.25542 9.25568 9.64467 8.76562 9.84766C8.39808 9.9999 7.93162 9.9999 6.99974 9.9999C6.06786 9.9999 5.60192 9.9999 5.23438 9.84766C4.74432 9.64467 4.35523 9.25568 4.15224 8.76562C4 8.39808 4 7.93163 4 6.99974Z",stroke:"white","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)])])}const bf=We(Cf,[["render",yf]]),yo=a=>{const l=yi(),i=p=>l.open(a,p),o=()=>l.close(a),u=l.state(a),f=r.computed({get:()=>u.value.visible,set:p=>p&&i()||o()}),m=r.computed(()=>u.value.context);return{visible:f,context:m,open:i,close:o}},Af={class:"cart_deletion_modal_content"},Sf={class:"cart_deletion_modal_title"},If={class:"cart_deletion_modal_footer"},Nf=We(r.defineComponent({__name:"CartDeleteConfirm",emits:["confirm"],setup(a,{emit:l}){const i=l,{visible:o,context:u,close:f}=yo("cart-delete-confirm"),m=()=>{i("confirm",u.value.idSystem),f()};return(p,_)=>(r.openBlock(),r.createBlock(r.Transition,{name:"fade"},{default:r.withCtx(()=>[r.unref(o)?(r.openBlock(),r.createElementBlock("div",{key:0,class:"cart_deletion_modal_overlay",onClick:_[1]||(_[1]=r.withModifiers((...x)=>r.unref(f)&&r.unref(f)(...x),["self"]))},[r.createElementVNode("div",Af,[r.createElementVNode("div",Sf,"Удалить "+r.toDisplayString(r.unref(u).name)+"?",1),_[2]||(_[2]=r.createElementVNode("div",{class:"cart_deletion_modal_body"},"Эта позиция будет полностью удалена из заказа.",-1)),r.createElementVNode("div",If,[r.createElementVNode("button",{class:"primary",onClick:m}," Удалить "),r.createElementVNode("button",{onClick:_[0]||(_[0]=(...x)=>r.unref(f)&&r.unref(f)(...x))},"Отмена")])])])):r.createCommentVNode("",!0)]),_:1}))}}),[["__scopeId","data-v-018f66f3"]]),Tf={class:"cart_extend_modal_content"},kf={class:"cart_extend_modal_footer"},Rf=We(r.defineComponent({__name:"CartExtendConfirm",emits:["confirm"],setup(a,{emit:l}){const i=l,{visible:o,context:u,close:f}=yo("cart-extend-confirm"),m=()=>{i("confirm"),f()};return(p,_)=>(r.openBlock(),r.createBlock(r.Transition,{name:"fade"},{default:r.withCtx(()=>[r.unref(o)?(r.openBlock(),r.createElementBlock("div",{key:0,class:"cart_extend_modal_overlay",onClick:_[1]||(_[1]=r.withModifiers((...x)=>r.unref(f)&&r.unref(f)(...x),["self"]))},[r.createElementVNode("div",Tf,[_[2]||(_[2]=r.createElementVNode("div",{class:"cart_extend_modal_title"},"Дополнить заказ?",-1)),_[3]||(_[3]=r.createElementVNode("div",{class:"cart_extend_modal_body"},"В заказ добавлены новые позиции. Подтвердить дополнение заказа? После подтверждения позиции нельзя отменить.",-1)),r.createElementVNode("div",kf,[r.createElementVNode("button",{onClick:_[0]||(_[0]=(...x)=>r.unref(f)&&r.unref(f)(...x))},"Отмена"),r.createElementVNode("button",{class:"primary",onClick:m}," Продолжить ")])])])):r.createCommentVNode("",!0)]),_:1}))}}),[["__scopeId","data-v-15f3f7bf"]]),Bf={class:"order_box_wrapper"},Of=["src"],Mf={class:"order_box_content_wrapper"},Df={class:"order_box_content_info"},vf={class:"order_box_name"},Pf={key:0,class:"order_box_size"},Lf={class:"order_box_amount"},Ff={class:"order_box_amount_count"},Vf={key:1,class:"order_box_status"},Uf=["data-state"],zf={class:"order_box_info_more"},Hf={key:1,class:"cart_modifier_info"},Gf={class:"cart_modifier_content"},Wf={class:"wrapper_price_count_cart"},Xf={class:"count_order_box"},$f={class:"wrapper_modifiers_discount"},bo=We(r.defineComponent({__name:"OrderBox",props:{index:Number,cardItem:Object},emits:["delete"],setup(a,{emit:l}){const i=a,o=Ct(),u=r.ref(o.itemThemes.qr_show_modifiers_in_cart??!1),{displayNumber:f,update:m}=go(0,800),p=r.computed(()=>{var T,D;const I=((T=i.cardItem)==null?void 0:T.modifiers)??[],B=(((D=i.cardItem)==null?void 0:D.group_modifiers)??[]).flatMap(k=>k.modifiers??[]);return[...I,...B]}),{mediaUrl:_}=bn(()=>{var I;return((I=i.cardItem)==null?void 0:I.id)+"_image"},()=>{var I;return(I=i.cardItem)==null?void 0:I.image_link}),x=r.computed(()=>{var I;return(I=i.cardItem)==null?void 0:I.total_cost}),C=()=>{u.value=!u.value},y=r.computed(()=>{var B,T;if((B=i.cardItem)!=null&&B.correlation_id)return"Ожидает добавления 🕓";const I=(T=i.cardItem)==null?void 0:T.cooking_state;return!I&&I!==0?null:I===0?"Создан":I===1?"Готовится":I===2?"Приготовлен":I===3?"Выдан":null});return r.watch(x,m,{immediate:!0}),(I,B)=>{var T,D,k,P,M,v,j,H,Z;return r.openBlock(),r.createElementBlock("div",Bf,[r.createElementVNode("img",{src:r.unref(_)||"",class:"order_box_image"},null,8,Of),r.createElementVNode("div",Mf,[r.createElementVNode("div",Df,[r.createElementVNode("p",vf,r.toDisplayString((T=a.cardItem)==null?void 0:T.name),1),(D=a.cardItem)!=null&&D.size?(r.openBlock(),r.createElementBlock("p",Pf,r.toDisplayString(((P=(k=a.cardItem)==null?void 0:k.size)==null?void 0:P.alt_name)||((M=a.cardItem)==null?void 0:M.size.name)),1)):r.createCommentVNode("",!0),r.createElementVNode("div",Lf,[B[0]||(B[0]=r.createElementVNode("button",{disabled:""},"-",-1)),r.createElementVNode("p",Ff,r.toDisplayString((v=i.cardItem)==null?void 0:v.amount),1),B[1]||(B[1]=r.createElementVNode("button",{disabled:""},"+",-1))]),y.value?(r.openBlock(),r.createElementBlock("div",Vf,[r.createElementVNode("span",{"data-state":(j=a.cardItem)==null?void 0:j.cooking_state},r.toDisplayString(y.value),9,Uf)])):r.createCommentVNode("",!0)]),r.createElementVNode("div",zf,[(H=i.cardItem)!=null&&H.new_price?(r.openBlock(),r.createElementBlock("p",{key:0,class:r.normalizeClass({discount_new_price:(Z=i.cardItem)==null?void 0:Z.new_price})},r.toDisplayString((i.cardItem.new_price*i.cardItem.amount).toFixed(2)+"₽"),3)):r.createCommentVNode("",!0),r.createElementVNode("p",null,r.toDisplayString(r.unref(f).toFixed(2)+"₽"),1)])]),!u.value&&p.value.length>0?(r.openBlock(),r.createElementBlock("div",{key:0,class:"cart_modifier_toggle",onClick:r.withModifiers(C,["stop"])},[...B[2]||(B[2]=[r.createElementVNode("p",{class:"cart_info_more"},"Посмотреть модификаторы",-1),r.createElementVNode("p",{class:"cart_arrow"},null,-1)])])):r.createCommentVNode("",!0),u.value&&p.value.length>0?(r.openBlock(),r.createElementBlock("div",Hf,[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(p.value,V=>{var L;return r.openBlock(),r.createElementBlock("div",{class:"cart_modifier_item",key:V.id},[r.createElementVNode("div",Gf,[r.createVNode(wi,{id:"plus_orange"}),r.createElementVNode("p",null,r.toDisplayString(V.name),1)]),r.createElementVNode("div",Wf,[r.createElementVNode("p",Xf,r.toDisplayString(`x${V.amount}`),1),r.createElementVNode("div",$f,[V!=null&&V.new_price?(r.openBlock(),r.createElementBlock("p",{key:0,class:r.normalizeClass({discount_new_price:(L=V==null?void 0:V.new_price)==null?void 0:L.toFixed(2)})},r.toDisplayString((V.new_price*V.amount).toFixed(2)+"₽"),3)):r.createCommentVNode("",!0),r.createElementVNode("p",null,r.toDisplayString((V.total_new_price||V.price*V.amount).toFixed(2)+"₽"),1)])])])}),128)),r.createElementVNode("div",{class:"cart_modifier_arrow",onClick:r.withModifiers(C,["stop"])},[...B[3]||(B[3]=[r.createElementVNode("p",{class:"cart_info_more"},"Скрыть",-1),r.createElementVNode("p",{class:"cart_arrow_top"},null,-1)])])])):r.createCommentVNode("",!0)])}}}),[["__scopeId","data-v-ea6dee7e"]]),jf={class:"cart_wrapper"},qf={class:"cart_header_content"},Zf={key:0,class:"cart_header_subwrapper"},Yf={class:"cart_kso_button_wrapper"},Kf={key:0},Qf={key:0,class:"kso_btn_wrapper"},Jf=["src"],eh={key:0,class:"cart_qr_button_wrapper"},th={class:"cart_header_info"},nh={class:"cart_header_info"},rh={class:"cart_header_info"},ih={class:"cart_header_info"},oh={key:1,class:"cart-tabs-wrapper"},sh={class:"cart-tabs-container"},ah=["data-active","onClick"],lh={key:0,class:"wrapper_comment"},ch={class:"wrapper_limit_in_area"},dh=["placeholder","aria-invalid"],uh={class:"limit_comment"},fh={key:1,class:"wrapper_comment"},hh={class:"wrapper_limit_in_area"},mh=["placeholder","aria-invalid"],gh={class:"limit_comment"},ph={key:2},xh={class:"table_order_desk_number"},_h={key:0,class:"table_order_indent_number"},wh={class:"cart_footer_wrapper"},Ch={key:0,class:"footer_title"},Eh=["disabled","max"],yh={key:1,class:"footer_sales"},bh=["step","max"],Ah={class:"list_price"},Sh={key:0},Ih={key:1},Nh={key:2},Th={class:"accept_field"},kh={class:"accept_field"},Rh={key:3},Bh={class:"accept_field"},Oh={class:"accept_field"},Mh={key:4},Dh={key:5},vh={key:0,class:"accept_field"},Ph={key:1,class:"accept_field"},Lh={key:3,class:"cart_min_order_notice"},Fh={class:"wrapper_footer_cart_btn"},Vh=r.defineComponent({__name:"CartPage",props:{configPage:{},textPaymentBtn:{},config_qr:{type:Boolean}},setup(a){const l=yn.create();let i;const o=ot(),u=Mt(),f=Ct(),m=Vn(),p=yi(),_=a,{initialCartPrice_lib:x,totalPrice_lib:C,countBonus:y,config_lib:I,cartProducts_lib:B,profile:T}=_e.storeToRefs(o),{itemThemes:D}=_e.storeToRefs(f),{isButtonDisabled:k,orderCompleted_lib:P,orderNumber:M,extraDiscount:v,is_notification_lib:j,isCreateButtonVisible:H,is_paymentCart:Z,providerTypes:V,notificationData_lib:L,selectedProvider:F,configPayment:re}=_e.storeToRefs(u),K=ke.useRouter(),ee=ke.useRoute(),G=r.useTemplateRef("stickerLoyality"),W=r.useTemplateRef("cartCardsEl"),N=r.ref(!1),X=r.ref(!1),$=r.ref(!1),q=r.useTemplateRef("commentEl"),J=r.ref(""),le=r.ref(!1),se=r.ref(!1),oe=r.ref(!1),ge=r.ref(0),Ee=r.ref(0),Fe=r.ref(!0),ue=r.ref(),nt=r.computed(()=>_.configPage.qr_menu?"YOOKASSA_BASE":V.value[0].front_type),Ae=r.computed(()=>_.configPage.qr_menu?"YOOKASSA":V.value[0].type),Ke=r.computed(()=>{var xe,ae;return _.configPage.kiosk_menu&&((xe=I.value)==null?void 0:xe.loyalty)==="IIKO"&&(I.value.has_loyalty_default_user||T.value)||_.configPage.qr_menu&&((ae=I.value)==null?void 0:ae.loyalty)==="IIKO"&&(T.value||D.value.qr_auth_required===!1)}),st=r.computed(()=>["АВТОРИЗОВАТЬСЯ ДЛЯ ЗАКАЗА"].includes(_.textPaymentBtn.toUpperCase())?_.textPaymentBtn:m.isTableService&&m.hasOrder?"Дополнить заказ":H.value?"Создать заказ":_.textPaymentBtn),{width:He}=xt.useElementSize(G,{width:0,height:0},{box:"border-box"}),At=r.computed(()=>{var Ce,Ye,hn,In;const xe={energy_amount:0,proteins_amount:0,fat_amount:0,carbohydrates_amount:0};let ae=xe;return m.isTableService&&((Ye=(Ce=m.order)==null?void 0:Ce.items)!=null&&Ye.length)&&(ae=((In=(hn=m.order)==null?void 0:hn.items)==null?void 0:In.reduce(($e,Xe)=>(Xe!=null&&Xe.nutrition&&($e.energy_amount+=(Xe.nutrition.energy_amount||0)*(Xe.amount||0),$e.proteins_amount+=(Xe.nutrition.proteins_amount||0)*(Xe.amount||0),$e.fat_amount+=(Xe.nutrition.fat_amount||0)*(Xe.amount||0),$e.carbohydrates_amount+=(Xe.nutrition.carbohydrates_amount||0)*(Xe.amount||0)),$e),xe))||xe),B.value.reduce(($e,Xe)=>($e.energy_amount+=(Xe.energy_amount||0)*(Xe.amount||0),$e.proteins_amount+=(Xe.proteins_amount||0)*(Xe.amount||0),$e.fat_amount+=(Xe.fat_amount||0)*(Xe.amount||0),$e.carbohydrates_amount+=(Xe.carbohydrates_amount||0)*(Xe.amount||0),$e),ae)}),Te=r.computed(()=>{var xe;if((xe=D.value)!=null&&xe.comments){const ae=D.value.comments;return{fieldName:_.configPage.kiosk_menu?ae.kiosk_comment_field_name:ae.qr_comment_field_name,placeholder:_.configPage.kiosk_menu?ae.kiosk_comment_field_placeholder:ae.qr_comment_field_placeholder,show:_.configPage.kiosk_menu?ae.kiosk_show_order_comment:ae.qr_show_order_comment}}}),Se=xt.computedAsync(async xe=>{var Ye;const ae=new AbortController;if(xe(()=>ae.abort()),!N.value||!((Ye=T.value)!=null&&Ye.balance)||!C.value)return 0;const Ce=await l.maxPayByBonuses(ue.value,_.configPage.kiosk_menu,!!_.configPage.userData||!!T.value,ae.signal);return Ce!=null&&Ce.by_bonuses?($.value=Ce.non_integers_allowed||!1,Math.min(Ce.by_bonuses,T.value.balance,C.value)):0},0,{shallow:!0}),Ve=()=>K.push(`/${ee.params.orgId}/`),kt=xe=>{($.value?["a","A","+","-","."]:["a","A","+","-",".",","]).includes(xe.key)&&xe.preventDefault()},rt=xe=>{o.deleteItemFromCart(xe),B.value.length===0&&(se.value=!1,oe.value=!1,m.hasOrder&&K.replace({name:"order-ts"}))},Je=()=>{se.value=!se.value,J.value.length},ve=r.computed(()=>{var ae;return(((ae=D.value.cart_loyalty_button)==null?void 0:ae.cart_loyalty_button_text)||"Программа лояльности").replace(/\S+/g,Ce=>Ce.length>15?Ce.slice(0,15)+"...":Ce)}),Sr=()=>{oe.value=!oe.value,J.value.length},be=()=>{let xe=$.value?+y.value.toFixed(2):Math.floor(y.value)||0;xe>Se.value&&(xe=Se.value),xe!==y.value&&o.setBonus(xe)};r.watchEffect(()=>{be(),o.setBonus(C.value===0?0:$.value?+y.value.toFixed(2):Math.floor(y.value))});const $n=()=>B.value.map(xe=>({id:xe.id,front_item_id:xe.idSystem,is_fake:!!xe.is_fake,is_od_united_product:!!xe.is_od_united_product,removals:xe.removals??null,amount:xe.amount,size:xe.size,modifiers:xe.modifiers??[],group_modifiers:xe.group_modifiers??[]})),{makeCreateOrderRequest:ki}=wf(),fn=r.computed(()=>$n()),cn=r.computed(()=>{var xe,ae,Ce,Ye;return _.configPage.qr_menu&&((ae=(xe=D.value)==null?void 0:xe.comments)==null?void 0:ae.qr_is_order_comment_required)||_.configPage.kiosk_menu&&((Ye=(Ce=D.value)==null?void 0:Ce.comments)==null?void 0:Ye.kiosk_is_order_comment_required)}),Jt=()=>{var xe,ae;return!(cn.value&&((ae=(xe=J.value)==null?void 0:xe.trim())==null?void 0:ae.length)<1&&q.value)||m.isTableService&&m.hasOrder?!1:(u.showNotification("Обязательно перед созданием заказа укажите комментарий к заказу"),q.value.focus(),le.value=!0,Ot.animate(q.value.parentElement,{x:[0,-10,0,10,0]},{duration:.1,repeat:2}),!0)},Ri=async()=>{var xe,ae,Ce;if(_.configPage.qr_menu&&!T.value&&D.value.qr_auth_required!==!1){K.push(`/${ee.params.orgId}/register`);return}if(!(cn.value&&Jt())){if(m.isTableService){if((xe=m.data)!=null&&xe.available_extend||m.hasOrder){u.showNotification("Для данного стола уже был создан заказ."),m.refresh();return}if(m.hasOrder)p.open("cart-extend-confirm");else try{k.value=!0,await l.confirmOrder(ue.value),u.deleteCart(),m.refresh(),K.push({name:"order-ts"})}catch(Ye){u.showNotification(((Ce=(ae=Ye==null?void 0:Ye.response)==null?void 0:ae.data)==null?void 0:Ce.user_friendly_message)||"Ошибка при создании заказа"),m.refresh(),k.value=!1,Sn()}return}if(_.configPage.qr_menu||V.value.length<=1){k.value=!0,await lo(ue.value,Ae.value).then(Ye=>{re.value&&Ye.url&&_.configPage.qr_menu&&window.location.replace(Ye.url)});return}return Z.value=!Z.value}},Bn=()=>{Z.value=!1},Ut=async()=>{var ae,Ce,Ye,hn,In;v.value=0;const xe={items:[...$n()],comment:J.value,combos:[]};m.id&&(xe.table=m.id),(ae=_.configPage)!=null&&ae.kiosk_menu&&((Ce=u.selectedOrderType)!=null&&Ce.id)&&(xe.order_type_id=(Ye=u.selectedOrderType)==null?void 0:Ye.id);try{X.value=!0;const $e=await l.calculateDiscount(xe,_.configPage.kiosk_menu,!!_.configPage.userData||!!T.value,i.signal);if(!B.value)return;B.value.forEach(Xe=>{const at=$e.items.find(Et=>Et.front_item_id===Xe.idSystem);if(at&&(Xe.group_modifiers.forEach(Et=>{const It=at.group_modifiers.find(lt=>lt.group===Et.group);It&&Et.modifiers.forEach(lt=>{const Xt=It.modifiers.find(De=>De.id===lt.id);if(Xt&&Number(lt.price)!==Number(Xt==null?void 0:Xt.new_price)){const De=(Xt.discounts||[]).reduce((Hn,Dt)=>Hn+=+Dt.discount,0);ge.value+=De,lt.new_price=lt.price,lt.price=Number(Xt==null?void 0:Xt.new_price),lt.total_new_price=Number(Xt.total_new_price)}})}),Xe.modifiers.forEach(Et=>{const It=at.modifiers.find(lt=>lt.id===Et.id);if(It&&Number(Et.price)!==Number(It==null?void 0:It.new_price)){const lt=(It.discounts||[]).reduce((Xt,De)=>Xt+=+De.discount,0);ge.value+=lt,Et.new_price=Et.price,Et.price=Number(It==null?void 0:It.new_price),Et.total_new_price=Number(It.total_new_price)}}),Xe.price!==Number(at.new_price))){const Et=(at.discounts||[]).reduce((It,lt)=>It+=+lt.discount,0);ge.value=ge.value+Et,Xe.new_price=Xe.price,Xe.price=at.new_price,Xe.discounts=at.discounts,Xe.total_new_price=Number(at.total_new_price)}}),B.value=[...B.value],ge.value!==0&&(C.value=$e.total_cart_price)}catch($e){if(X.value=!1,!Ze.isCancel($e))throw u.showNotification(((In=(hn=$e==null?void 0:$e.response)==null?void 0:hn.data)==null?void 0:In.user_friendly_message)||"Скидки временно недоступны"),$e}},Bi=async()=>{var ae,Ce;let xe=k.value;k.value=!0;try{await l.extendOrder([...$n()]),u.deleteCart(),m.refreshOrder(),K.push({name:"order-ts"})}catch(Ye){throw u.showNotification(((Ce=(ae=Ye==null?void 0:Ye.response)==null?void 0:ae.data)==null?void 0:Ce.user_friendly_message)||"Не удалось дополнить заказ"),Ye}finally{k.value=xe}},Ir=async()=>{var xe;if(!(cn.value&&Jt())){ue.value=null,i=new AbortController,k.value=!0;try{Ke.value&&await Ut(),F.value={front_type:nt};const ae={paymentMethodId:nt.value,items:fn.value,comment:J.value,isAuthorized:!!_.configPage.userData||!!T,signal:i==null?void 0:i.signal},Ce=await ki({..._.configPage,resetDiscounts:Sn},ae);ue.value=(xe=Ce==null?void 0:Ce.data)==null?void 0:xe.id,H.value=!1}catch(ae){console.log("[cart](createOrder)",ae),!Ze.isCancel(ae)&&m.isTableService&&m.refresh(),k.value=!1,Sn()}}},Oo=()=>{var xe;return _.configPage.qr_menu&&["АВТОРИЗОВАТЬСЯ ДЛЯ ЗАКАЗА"].includes(_.textPaymentBtn.toUpperCase())&&!T.value&&D.value.qr_auth_required!==!1?K.push(`/${ee.params.orgId}/register`):m.isTableService&&((xe=m.data)!=null&&xe.available_extend)?p.open("cart-extend-confirm"):H.value?Ir():Ri()},St=()=>{var xe;(xe=T.value)!=null&&xe.balance?T.value.balance>0&&(N.value=!N.value):u.showNotification("У Вас пока нет бонусов")};r.onMounted(async()=>{o.loadCart(),P.value=null,C.value=null,v.value=0,Sn()}),r.onUnmounted(()=>{i&&(i==null||i.abort(),i=null),k.value=!1,ue.value=null,P.value=null,C.value=null,v.value=0,B.value.splice(0,B.value.length,...B.value.map(o.makeProductFullyReactive))});const pe=r.computed(()=>_.configPage.qr_menu?I.value.qr_order_minimum_price||0:_.configPage.kiosk_menu&&I.value.kiosk_order_minimum_price||0),Rt=r.computed(()=>{var xe;return["АВТОРИЗОВАТЬСЯ ДЛЯ ЗАКАЗА"].includes(_.textPaymentBtn.toUpperCase())?!1:m.isTableService&&m.hasOrder&&!((xe=m.data)!=null&&xe.available_extend)||pe.value>x.value&&!m.hasOrder||X.value||k.value||B.value.length===0?!0:(P.value=null,k.value)}),et=r.computed(()=>{var xe;return((xe=B.value)==null?void 0:xe.reduce((ae,Ce)=>ae+Ce.amount,0))||0}),gt=r.computed(()=>{var xe;return(xe=T.value)==null?void 0:xe.phone});r.watch(J,xe=>{var ae;return((ae=xe==null?void 0:xe.trim())==null?void 0:ae.length)&&(le.value=!1)}),r.watch(()=>B.value.length,(xe,ae)=>{ae!==void 0&&(xe<=ae||r.nextTick(()=>{const Ce=W.value;Ce&&Ce.scrollTo({top:Ce.scrollHeight,behavior:"smooth"})}))}),r.watch([et,gt,()=>u.selectedOrderType],()=>{et.value===0&&(i=null),i==null||i.abort(),k.value=!1});const Sn=()=>{H.value=!0,o.setBonus(0),B.value.splice(0,B.value.length,...B.value.map(o.makeProductFullyReactive)),ge.value=0,C.value=null,v.value=0};return r.watch([()=>o.cartProducts_lib,gt,et,()=>u.selectedOrderType],xe=>{if(Ee.value>0){Ee.value--;return}xe&&!X.value&&(N.value=!1,Sn(),Ee.value=1),X.value=!1},{deep:!0}),(xe,ae)=>{var Ce,Ye,hn,In,$e,Xe,at,Et,It,lt,Xt;return r.openBlock(),r.createElementBlock(r.Fragment,null,[r.createElementVNode("div",jf,[r.createVNode(Nf,{onConfirm:rt}),r.createVNode(Rf,{onConfirm:Bi}),r.createVNode(da,{visible:r.unref(u).isDrawerOpen,"onUpdate:visible":ae[0]||(ae[0]=De=>r.unref(u).isDrawerOpen=De)},{default:r.withCtx(()=>[r.createVNode(fa)]),_:1},8,["visible"]),r.createElementVNode("header",qf,[_.configPage.kiosk_menu?(r.openBlock(),r.createElementBlock("div",Zf,[r.createElementVNode("div",Yf,[r.createElementVNode("div",{class:r.normalizeClass(["arrow_wrapper",{arrow_wrapper_kso:_.configPage.kiosk_menu}]),onClick:Ve},[r.createVNode(Cr,{class:"cart_header_back_button"}),_.configPage.kiosk_menu?(r.openBlock(),r.createElementBlock("span",Kf,"Назад")):r.createCommentVNode("",!0)],2)]),Te.value&&Te.value.show?(r.openBlock(),r.createElementBlock("div",Qf,[cn.value?r.createCommentVNode("",!0):(r.openBlock(),r.createBlock(sn,{key:0,style:r.normalizeStyle({visibility:!se.value&&r.unref(B).length>0?"visible":"hidden"}),class:r.normalizeClass({button_kso_comment:a.configPage.kiosk_menu}),textButtonDefault:J.value.length>0?"Редактировать":Te.value&&Te.value.fieldName||"",onClick:()=>se.value=!se.value,id:"button_kso_comment"},null,8,["style","class","textButtonDefault","onClick"]))])):r.createCommentVNode("",!0),r.createElementVNode("div",{class:r.normalizeClass({cart_header_wrapper:_.configPage.kiosk_menu})},[(r.unref(D).kiosk_show_loyalty_card_button||r.unref(D).kiosk_show_loyalty_phone_input_button)&&!_.config_qr?(r.openBlock(),r.createElementBlock("button",{key:0,class:"buttonDefaultWrapper button_payment_cart button_payment_cart_loyal",style:r.normalizeStyle({marginRight:(Ce=r.unref(D).cart_loyalty_button)!=null&&Ce.cart_loyalty_button_sticker?`${Math.ceil(r.unref(He)/2+10)}px`:"",paddingRight:(Ye=r.unref(D).cart_loyalty_button)!=null&&Ye.cart_loyalty_button_sticker?0:""}),onClick:ae[1]||(ae[1]=(...De)=>r.unref(u).openDrawer&&r.unref(u).openDrawer(...De))},[r.createElementVNode("p",{class:"cart_loyal_program",style:r.normalizeStyle({marginRight:`${Math.ceil(r.unref(He)/2)}px`})},r.toDisplayString(ve.value),5),(hn=r.unref(D).cart_loyalty_button)!=null&&hn.cart_loyalty_button_sticker?(r.openBlock(),r.createElementBlock("div",{key:0,ref_key:"stickerLoyality",ref:G,class:"cart_loyal_program_icon",style:r.normalizeStyle({"--sticker-mask":`url(${r.unref(D).cart_loyalty_button.cart_loyalty_button_sticker})`})},[r.createElementVNode("img",{src:r.unref(D).cart_loyalty_button.cart_loyalty_button_sticker},null,8,Jf)],4)):(r.openBlock(),r.createBlock(bf,{key:1,class:"cart_loyal_qr"}))],4)):r.createCommentVNode("",!0)],2)])):r.createCommentVNode("",!0),r.createElementVNode("div",{class:r.normalizeClass([a.config_qr?"cart_kbju_qr_wrapper":"cart_kbju_kso_wrapper"])},[a.config_qr?(r.openBlock(),r.createElementBlock("div",eh,[r.createElementVNode("div",{class:"arrow_wrapper",onClick:Ve},[r.createVNode(Cr,{class:"cart_header_back_button"})])])):r.createCommentVNode("",!0),r.unref(D).show_nutrition_in_cart?(r.openBlock(),r.createElementBlock("div",{key:1,class:"cart_header",style:r.normalizeStyle({paddingTop:_.config_qr?0:"10px",paddingRight:_.config_qr?"10px":0})},[r.createElementVNode("div",th,[r.createElementVNode("p",null,[r.createVNode(ft,{price:At.value.energy_amount,duration:800},null,8,["price"]),ae[9]||(ae[9]=r.createTextVNode(" г",-1))]),ae[10]||(ae[10]=r.createElementVNode("p",{class:"cart_info_name"},"Килокалории",-1))]),r.createElementVNode("div",nh,[r.createElementVNode("p",null,[r.createVNode(ft,{price:At.value.proteins_amount,duration:900},null,8,["price"]),ae[11]||(ae[11]=r.createTextVNode(" г",-1))]),ae[12]||(ae[12]=r.createElementVNode("p",{class:"cart_info_name"},"Белки",-1))]),r.createElementVNode("div",rh,[r.createElementVNode("p",null,[r.createVNode(ft,{price:At.value.fat_amount,duration:1e3},null,8,["price"]),ae[13]||(ae[13]=r.createTextVNode(" г",-1))]),ae[14]||(ae[14]=r.createElementVNode("p",{class:"cart_info_name"},"Жиры",-1))]),r.createElementVNode("div",ih,[r.createElementVNode("p",null,[r.createVNode(ft,{price:At.value.carbohydrates_amount,duration:1100},null,8,["price"]),ae[15]||(ae[15]=r.createTextVNode(" г",-1))]),ae[16]||(ae[16]=r.createElementVNode("p",{class:"cart_info_name"},"Углеводы",-1))])],4)):r.createCommentVNode("",!0)],2),a.configPage.kiosk_menu&&r.unref(u).orderTypes.length>1?(r.openBlock(),r.createElementBlock("div",oh,[r.createElementVNode("ul",sh,[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(r.unref(u).orderTypes,De=>{var Hn,Dt;return r.openBlock(),r.createElementBlock("li",{key:De.id,class:"cart-tab","data-active":De.id===((Hn=r.unref(u).selectedOrderType)==null?void 0:Hn.id),onClick:jn=>r.unref(u).selectedOrderType=De},[De.id===((Dt=r.unref(u).selectedOrderType)==null?void 0:Dt.id)?(r.openBlock(),r.createBlock(r.unref(Ot.motion).div,{key:0,class:"cart-underline","layout-id":"cart-underline",id:"cart-underline"})):r.createCommentVNode("",!0),r.createElementVNode("span",null,r.toDisplayString(De.name),1)],8,ah)}),128))])])):r.createCommentVNode("",!0)]),(cn.value||se.value)&&a.configPage.kiosk_menu&&((In=r.unref(B))!=null&&In.length)?(r.openBlock(),r.createElementBlock("div",lh,[r.createElementVNode("div",ch,[r.withDirectives(r.createElementVNode("textarea",{ref_key:"commentEl",ref:q,class:"comment_order",placeholder:Te.value&&Te.value.placeholder||"Ваш комментарий к заказу...",name:"commentKso",maxlength:"50","aria-invalid":le.value,"onUpdate:modelValue":ae[2]||(ae[2]=De=>J.value=De)},null,8,dh),[[r.vModelText,J.value]]),r.createElementVNode("p",uh,r.toDisplayString(J.value.length+" / 50"),1)]),cn.value?r.createCommentVNode("",!0):(r.openBlock(),r.createBlock(sn,{key:0,textButtonDefault:"Сохранить",onClick:Je,class:"button_bonus_cart"}))])):r.createCommentVNode("",!0),(cn.value||oe.value)&&a.config_qr&&(($e=r.unref(B))!=null&&$e.length)&&!(r.unref(m).isTableService&&r.unref(m).hasOrder)?(r.openBlock(),r.createElementBlock("div",fh,[r.createElementVNode("div",hh,[r.withDirectives(r.createElementVNode("textarea",{ref_key:"commentEl",ref:q,class:"comment_order",placeholder:Te.value&&Te.value.placeholder||"Ваш комментарий к заказу...",name:"commentQr",maxlength:"50","aria-invalid":le.value,"onUpdate:modelValue":ae[3]||(ae[3]=De=>J.value=De)},null,8,mh),[[r.vModelText,J.value]]),r.createElementVNode("p",gh,r.toDisplayString(J.value.length+" / 50"),1)]),cn.value?r.createCommentVNode("",!0):(r.openBlock(),r.createBlock(sn,{key:0,textButtonDefault:"Сохранить",onClick:Sr,class:"button_bonus_cart"}))])):r.createCommentVNode("",!0),a.config_qr&&Te.value&&Te.value.show&&!(r.unref(m).isTableService&&r.unref(m).hasOrder)?(r.openBlock(),r.createElementBlock("div",ph,[!cn.value&&!oe.value&&r.unref(B).length>0?(r.openBlock(),r.createBlock(sn,{key:0,textButtonDefault:J.value.length>0?"Редактировать":Te.value.fieldName||"",onClick:()=>oe.value=!oe.value,id:"button_comments"},null,8,["textButtonDefault","onClick"])):r.createCommentVNode("",!0)])):r.createCommentVNode("",!0),r.unref(m).isTableService&&((Xe=r.unref(m).data)!=null&&Xe.number.toString())?(r.openBlock(),r.createElementBlock("div",{key:3,class:"table_order_table_wrapper",onClick:ae[4]||(ae[4]=De=>r.unref(m).order&&r.unref(K).push({name:"order-ts"}))},[r.createElementVNode("p",xh,r.toDisplayString(`Стол № ${(at=r.unref(m).data)==null?void 0:at.number}`),1),(Et=r.unref(m).order)!=null&&Et.id?(r.openBlock(),r.createElementBlock("p",_h,r.toDisplayString(`Заказ ${r.unref(m).order.plugin_order.number}`),1)):r.createCommentVNode("",!0)])):r.createCommentVNode("",!0),r.createElementVNode("div",{ref_key:"cartCardsEl",ref:W,class:"cart_cards"},[r.unref(m).hasOrder&&((lt=(It=r.unref(m).order)==null?void 0:It.items)!=null&&lt.length)&&Fe.value?(r.openBlock(!0),r.createElementBlock(r.Fragment,{key:0},r.renderList(r.unref(m).order.items,De=>(r.openBlock(),r.createBlock(bo,{key:De.idSystem,cardItem:De},null,8,["cardItem"]))),128)):r.createCommentVNode("",!0),(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(r.unref(B),De=>(r.openBlock(),r.createBlock(ua,{key:De.idSystem,cardItem:De,isShowModifiers:_.config_qr,onDelete:Hn=>rt(De.idSystem)},null,8,["cardItem","isShowModifiers","onDelete"]))),128))],512),r.createElementVNode("div",wh,[N.value&&!r.unref(H)?(r.openBlock(),r.createElementBlock("p",Ch,[ae[17]||(ae[17]=r.createTextVNode(" Списать ",-1)),r.withDirectives(r.createElementVNode("input",{type:"number",placeholder:"0",style:r.normalizeStyle({maxWidth:`${r.unref(y).toString().length||1}em`}),disabled:r.unref(T)===null||((Xt=r.unref(T))==null?void 0:Xt.balance)===0,"onUpdate:modelValue":ae[5]||(ae[5]=De=>r.isRef(y)?y.value=De:null),onInput:be,min:"0",max:r.unref(Se),step:".01",onKeypress:kt},null,44,Eh),[[r.vModelText,r.unref(y),void 0,{number:!0}]]),ae[18]||(ae[18]=r.createTextVNode(" бонусов ",-1))])):r.createCommentVNode("",!0),N.value&&!r.unref(H)?(r.openBlock(),r.createElementBlock("p",yh,"У вас есть "+r.toDisplayString(r.unref(T)?r.unref(T).balance:0)+" B",1)):r.createCommentVNode("",!0),N.value&&!r.unref(H)?r.withDirectives((r.openBlock(),r.createElementBlock("input",{key:2,type:"range",class:"footer_range","onUpdate:modelValue":ae[6]||(ae[6]=De=>r.isRef(y)?y.value=De:null),step:$.value?".01":"1",min:0,max:r.unref(Se)},null,8,bh)),[[r.vModelText,r.unref(y),void 0,{number:!0}]]):r.createCommentVNode("",!0),r.createElementVNode("ul",Ah,[N.value&&!r.unref(H)?(r.openBlock(),r.createElementBlock("li",Sh,[ae[20]||(ae[20]=r.createElementVNode("p",null,"Сумма заказа:",-1)),r.createElementVNode("p",null,[r.createVNode(ft,{price:r.unref(C),fixedFloat:2},null,8,["price"]),ae[19]||(ae[19]=r.createTextVNode(" ₽",-1))])])):r.createCommentVNode("",!0),N.value&&!r.unref(H)?(r.openBlock(),r.createElementBlock("li",Ih,[ae[22]||(ae[22]=r.createElementVNode("p",null,"Будет оплачено бонусами:",-1)),r.createElementVNode("p",null,[r.createVNode(ft,{price:r.unref(y),fixedFloat:2},null,8,["price"]),ae[21]||(ae[21]=r.createTextVNode(" Б",-1))])])):r.createCommentVNode("",!0),r.unref(v)!==0?(r.openBlock(),r.createElementBlock("li",Nh,[r.createElementVNode("p",Th,r.toDisplayString(r.unref(v)>0?"Надбавка":"Скидка")+": ",1),r.createElementVNode("p",kh,[r.createVNode(ft,{price:Math.abs(r.unref(v)),fixedFloat:2},null,8,["price"]),ae[23]||(ae[23]=r.createTextVNode(" ₽",-1))])])):ge.value!==0?(r.openBlock(),r.createElementBlock("li",Rh,[r.createElementVNode("p",Bh,r.toDisplayString(ge.value>0?"Надбавка":"Скидка")+": ",1),r.createElementVNode("p",Oh,[r.createVNode(ft,{price:Math.abs(ge.value),fixedFloat:2},null,8,["price"]),ae[24]||(ae[24]=r.createTextVNode(" ₽",-1))])])):r.createCommentVNode("",!0),r.unref(m).isTableService&&r.unref(m).order?(r.openBlock(),r.createElementBlock("li",Mh,[ae[26]||(ae[26]=r.createElementVNode("p",null,"Сумма заказа:",-1)),r.createElementVNode("p",null,[r.createVNode(ft,{price:r.unref(m).order.total_cost,fixedFloat:2},null,8,["price"]),ae[25]||(ae[25]=r.createTextVNode(" ₽",-1))])])):r.createCommentVNode("",!0),r.unref(m).isTableService&&r.unref(m).order?(r.openBlock(),r.createElementBlock("li",Dh,[ae[28]||(ae[28]=r.createElementVNode("p",null,"К счёту добавится:",-1)),r.createElementVNode("p",null,[r.createVNode(ft,{price:r.unref(C),fixedFloat:2},null,8,["price"]),ae[27]||(ae[27]=r.createTextVNode(" ₽",-1))])])):r.createCommentVNode("",!0),r.createElementVNode("li",null,[ae[31]||(ae[31]=r.createElementVNode("p",{class:"accept_field"},"Итого к оплате:",-1)),r.unref(m).isTableService&&r.unref(m).order?(r.openBlock(),r.createElementBlock("p",vh,[r.createVNode(ft,{price:r.unref(m).order.total_cost+r.unref(C),fixedFloat:2},null,8,["price"]),ae[29]||(ae[29]=r.createTextVNode(" ₽",-1))])):(r.openBlock(),r.createElementBlock("p",Ph,[r.createVNode(ft,{price:r.unref(C)-r.unref(y),fixedFloat:2},null,8,["price"]),ae[30]||(ae[30]=r.createTextVNode(" ₽",-1))]))])]),pe.value&&pe.value>r.unref(x)&&!r.unref(m).hasOrder?(r.openBlock(),r.createElementBlock("div",Lh,[ae[32]||(ae[32]=r.createTextVNode(" Минимальная сумма заказа ",-1)),r.createVNode(ft,{price:pe.value,fixedFloat:2},null,8,["price"]),r.createTextVNode(" "+r.toDisplayString(r.unref(I).currency_symbol)+". Для оформления заказа необходимо добавить товаров на сумму ",1),r.createVNode(ft,{price:pe.value-r.unref(x),fixedFloat:2},null,8,["price"]),r.createTextVNode(" "+r.toDisplayString(r.unref(I).currency_symbol),1)])):r.createCommentVNode("",!0),r.createElementVNode("div",Fh,[r.unref(T)&&!r.unref(H)&&!r.unref(m).isTableService?(r.openBlock(),r.createBlock(sn,{key:0,textButtonDefault:r.unref(D).bonuses_button_name||"Бонусы",onClick:St,class:"button_bonus_cart"},null,8,["textButtonDefault"])):r.createCommentVNode("",!0),r.createVNode(sn,{textButtonDefault:st.value,onClick:Oo,class:"button_payment_cart",disabled:Rt.value},null,8,["textButtonDefault","disabled"])])])]),r.unref(m).isTableService?r.createCommentVNode("",!0):(r.openBlock(),r.createBlock(_f,{key:0,orderNumber:r.unref(M),pageNumber:1},null,8,["orderNumber"])),r.createVNode(Ci,{visible:r.unref(j),"onUpdate:visible":ae[7]||(ae[7]=De=>r.isRef(j)?j.value=De:null),textNotificationDefault:r.unref(L).textNotification,backgroundColor:r.unref(D).accent_color?r.unref(D).accent_color:"#FF6D2E",buttonAccept:null},null,8,["visible","textNotificationDefault","backgroundColor"]),r.createVNode(xo,{modelValue:r.unref(Z),"onUpdate:modelValue":ae[8]||(ae[8]=De=>r.isRef(Z)?Z.value=De:null),class:"product_card_sheet","snap-points":["80%"]},{default:r.withCtx(()=>{var De;return[r.createVNode(f1,{"config-page":a.configPage,comment:J.value,"cart-items":fn.value,"is-authorized":!!_.configPage.userData||!!r.unref(T),"order-id":ue.value,signal:(De=r.unref(i))==null?void 0:De.signal,onSelectPayment:Bn},null,8,["config-page","comment","cart-items","is-authorized","order-id","signal"])]}),_:1},8,["modelValue"])],64)}}}),Uh={},zh={viewBox:"0 0 24 24"};function Hh(a,l){return r.openBlock(),r.createElementBlock("svg",zh,[...l[0]||(l[0]=[r.createElementVNode("path",{d:"M18 6L6 18M6 6l12 12"},null,-1)])])}const Gh=We(Uh,[["render",Hh]]),Wh={class:"retry_screen"},Xh={class:"retry_all_in_screen"},$h={class:"retry_content"},jh={class:"retry_icon_wrap"},qh={class:"retry_icon_circle"},Zh={class:"retry_error_x"},Yh=r.defineComponent({__name:"RetryPage",setup(a){const l=Mt(),i=ke.useRouter(),o=ke.useRoute(),u=()=>{l.notificationData_lib.textNotification="",l.is_notification_lib=!1,i.replace(`/${o.params.orgId}/`)};return(f,m)=>(r.openBlock(),r.createElementBlock("section",Wh,[r.createElementVNode("div",Xh,[r.createElementVNode("main",$h,[r.createElementVNode("div",jh,[r.createElementVNode("div",qh,[m[0]||(m[0]=r.createElementVNode("div",{class:"retry_loader_mini"},null,-1)),r.createElementVNode("div",Zh,[r.createVNode(Gh)])])]),m[1]||(m[1]=r.createElementVNode("div",{class:"retry_oops"},"OOPS",-1)),m[2]||(m[2]=r.createElementVNode("h1",{class:"retry_title"},"Что-то пошло не так",-1)),m[3]||(m[3]=r.createElementVNode("div",{class:"retry_hint"},[r.createElementVNode("p",null,"Похоже, произошёл технический сбой."),r.createElementVNode("p",null,"Мы уже знаем о проблеме и сейчас разбираемся."),r.createElementVNode("p",null,"Приносим извинения за доставленные неудобства."),r.createElementVNode("p",null,"Попробуйте начать новый заказ.")],-1))]),r.createElementVNode("div",{class:"retry_footer"},[r.createElementVNode("button",{onClick:u,class:"retry_new_order_btn"},"Новый заказ")]),m[4]||(m[4]=r.createElementVNode("p",{class:"retry_bottom_note"},"Если ошибка повторяется — обратитесь к сотруднику зала.",-1))])]))}}),Kh={class:"table_order_wrapper"},Qh={class:"table_order_header_content"},Jh={class:"table_order_kbju_qr_wrapper"},e2={class:"table_order_qr_button_wrapper"},t2={key:0,class:"table_order_header",style:{paddingRight:"10px"}},n2={class:"table_order_header_info"},r2={class:"table_order_header_info"},i2={class:"table_order_header_info"},o2={class:"table_order_header_info"},s2={key:0,class:"table_order_table_wrapper"},a2={class:"table_order_desk_number"},l2={class:"table_order_indent_number"},c2={class:"table_order_cards"},d2={class:"table_order_footer_wrapper"},u2={key:0,class:"footer_title"},f2=["disabled","max"],h2={key:1,class:"footer_sales"},m2=["step","max"],g2={class:"list_price"},p2={key:0},x2={key:1},_2={key:2},w2={key:3},C2={class:"accept_field"},E2={key:3,class:"wrapper_footer_table_order_btn"},y2=We(r.defineComponent({__name:"TableOrderPage",setup(a){const l=ot(),i=Wr(),o=Ct(),u=Vn(),{countBonus:f}=_e.storeToRefs(l),{itemThemes:m}=_e.storeToRefs(o),p=ke.useRouter(),_=ke.useRoute(),x=yn.create(),C=r.ref(!1),y=r.ref(!1),I=r.ref(!1),B=r.ref(!1),T=r.ref(!1),D=r.computed(()=>C.value||!u.hasOrder),k=r.computed(()=>{var L,F;const V={energy_amount:0,proteins_amount:0,fat_amount:0,carbohydrates_amount:0};return((F=(L=u.order)==null?void 0:L.items)==null?void 0:F.reduce((re,K)=>(K!=null&&K.nutrition&&(re.energy_amount+=(K.nutrition.energy_amount||0)*(K.amount||0),re.proteins_amount+=(K.nutrition.proteins_amount||0)*(K.amount||0),re.fat_amount+=(K.nutrition.fat_amount||0)*(K.amount||0),re.carbohydrates_amount+=(K.nutrition.carbohydrates_amount||0)*(K.amount||0)),re),V))||V}),P=xt.computedAsync(async V=>{var re;const L=new AbortController;if(V(()=>L.abort()),!y.value||!((re=l.profile)!=null&&re.balance))return 0;const F=await x.maxPayByBonuses(u.order.id,!1,l.profile,L.signal);return F!=null&&F.by_bonuses?(I.value=F.non_integers_allowed||!1,Math.min(u.order.remaining_amount,l.profile.balance,F.by_bonuses)):0},0,{shallow:!0}),M=()=>{T.value=!0},v=()=>p.push(`/${_.params.orgId}/`),j=async()=>{var V,L;C.value=!0;try{const F=await lo(u.order.id,"YOOKASSA");F.url&&window.location.replace(F.url)}catch(F){throw i.showNotification(((L=(V=F==null?void 0:F.response)==null?void 0:V.data)==null?void 0:L.user_friendly_message)||"Ошибка при оплате заказа"),F}finally{C.value=!1}},H=V=>{(I.value?["a","A","+","-","."]:["a","A","+","-",".",","]).includes(V.key)&&V.preventDefault()},Z=()=>{let V=I.value?+f.value.toFixed(2):Math.floor(f.value)||0;V>P.value&&(V=P.value),V!==f.value&&l.setBonus(V)};return(V,L)=>{var F,re,K,ee,G,W,N,X;return r.openBlock(),r.createElementBlock("div",Kh,[r.createElementVNode("header",Qh,[r.createElementVNode("div",Jh,[r.createElementVNode("div",e2,[r.createElementVNode("div",{class:"arrow_wrapper",onClick:v},[r.createVNode(Cr,{class:"table_order_header_back_button"})])]),r.unref(m).show_nutrition_in_cart?(r.openBlock(),r.createElementBlock("div",t2,[r.createElementVNode("div",n2,[r.createElementVNode("p",null,[r.createVNode(ft,{price:k.value.energy_amount,duration:800},null,8,["price"]),L[2]||(L[2]=r.createTextVNode(" г ",-1))]),L[3]||(L[3]=r.createElementVNode("p",{class:"table_order_info_name"},"Килокалории",-1))]),r.createElementVNode("div",r2,[r.createElementVNode("p",null,[r.createVNode(ft,{price:k.value.proteins_amount,duration:900},null,8,["price"]),L[4]||(L[4]=r.createTextVNode(" г ",-1))]),L[5]||(L[5]=r.createElementVNode("p",{class:"table_order_info_name"},"Белки",-1))]),r.createElementVNode("div",i2,[r.createElementVNode("p",null,[r.createVNode(ft,{price:k.value.fat_amount,duration:1e3},null,8,["price"]),L[6]||(L[6]=r.createTextVNode(" г ",-1))]),L[7]||(L[7]=r.createElementVNode("p",{class:"table_order_info_name"},"Жиры",-1))]),r.createElementVNode("div",o2,[r.createElementVNode("p",null,[r.createVNode(ft,{price:k.value.carbohydrates_amount,duration:1100},null,8,["price"]),L[8]||(L[8]=r.createTextVNode(" г ",-1))]),L[9]||(L[9]=r.createElementVNode("p",{class:"table_order_info_name"},"Углеводы",-1))])])):r.createCommentVNode("",!0)])]),(F=r.unref(u).order)!=null&&F.id?(r.openBlock(),r.createElementBlock("div",s2,[r.createElementVNode("p",a2,r.toDisplayString(`Стол № ${(re=r.unref(u).data)==null?void 0:re.number}`),1),r.createElementVNode("p",l2,r.toDisplayString(`Заказ ${r.unref(u).order.plugin_order.number}`),1)])):r.createCommentVNode("",!0),r.createElementVNode("div",c2,[(ee=(K=r.unref(u).order)==null?void 0:K.items)!=null&&ee.length?(r.openBlock(!0),r.createElementBlock(r.Fragment,{key:0},r.renderList(r.unref(u).order.items,$=>(r.openBlock(),r.createBlock(bo,{key:$.idSystem,cardItem:$},null,8,["cardItem"]))),128)):r.createCommentVNode("",!0)]),r.createElementVNode("div",d2,[y.value?(r.openBlock(),r.createElementBlock("p",u2,[L[10]||(L[10]=r.createTextVNode(" Списать ",-1)),r.withDirectives(r.createElementVNode("input",{type:"number",placeholder:"0",style:r.normalizeStyle({maxWidth:`${r.unref(f).toString().length||1}em`}),disabled:r.unref(l).profile===null||((G=r.unref(l).profile)==null?void 0:G.balance)===0,"onUpdate:modelValue":L[0]||(L[0]=$=>r.isRef(f)?f.value=$:null),onInput:Z,min:"0",max:r.unref(P),step:".01",onKeypress:H},null,44,f2),[[r.vModelText,r.unref(f),void 0,{number:!0}]]),L[11]||(L[11]=r.createTextVNode(" бонусов ",-1))])):r.createCommentVNode("",!0),y.value?(r.openBlock(),r.createElementBlock("p",h2," У вас есть "+r.toDisplayString(r.unref(l).profile.balance??0)+" B ",1)):r.createCommentVNode("",!0),y.value?r.withDirectives((r.openBlock(),r.createElementBlock("input",{key:2,type:"range",class:"footer_range","onUpdate:modelValue":L[1]||(L[1]=$=>r.isRef(f)?f.value=$:null),step:I.value?".01":"1",min:0,max:r.unref(P)},null,8,m2)),[[r.vModelText,r.unref(f),void 0,{number:!0}]]):r.createCommentVNode("",!0),r.createElementVNode("ul",g2,[r.unref(u).order&&r.unref(u).order.total_cost-r.unref(u).order.remaining_amount>0?(r.openBlock(),r.createElementBlock("li",p2,[L[13]||(L[13]=r.createElementVNode("p",null,"Сумма заказа:",-1)),r.createElementVNode("p",null,[r.createVNode(ft,{price:(W=r.unref(u).order)==null?void 0:W.total_cost,fixedFloat:2},null,8,["price"]),L[12]||(L[12]=r.createTextVNode(" ₽ ",-1))])])):r.createCommentVNode("",!0),r.unref(u).order&&r.unref(u).order.total_cost-r.unref(u).order.remaining_amount>0?(r.openBlock(),r.createElementBlock("li",x2,[L[15]||(L[15]=r.createElementVNode("p",null,"Оплачено:",-1)),r.createElementVNode("p",null,[r.createVNode(ft,{price:r.unref(u).order.total_cost-r.unref(u).order.remaining_amount,fixedFloat:2},null,8,["price"]),L[14]||(L[14]=r.createTextVNode(" ₽ ",-1))])])):r.createCommentVNode("",!0),y.value?(r.openBlock(),r.createElementBlock("li",_2,[L[17]||(L[17]=r.createElementVNode("p",null,"Будет оплачено бонусами:",-1)),r.createElementVNode("p",null,[r.createVNode(ft,{price:r.unref(f),fixedFloat:2},null,8,["price"]),L[16]||(L[16]=r.createTextVNode(" Б ",-1))])])):r.createCommentVNode("",!0),(N=r.unref(u).order)!=null&&N.remaining_amount?(r.openBlock(),r.createElementBlock("li",w2,[L[19]||(L[19]=r.createElementVNode("p",{class:"accept_field"},"Итого к оплате:",-1)),r.createElementVNode("p",C2,[r.createVNode(ft,{price:r.unref(u).order.remaining_amount-r.unref(f),fixedFloat:2},null,8,["price"]),L[18]||(L[18]=r.createTextVNode(" ₽ ",-1))])])):r.createCommentVNode("",!0)]),(X=r.unref(u).order)!=null&&X.remaining_amount&&r.unref(o).itemThemes.qr_show_pay_button_ts!==!1?(r.openBlock(),r.createElementBlock("div",E2,[r.createVNode(sn,{textButtonDefault:B.value?"Запросить счёт":"Оплатить заказ",onClick:B.value?M:j,class:"button_payment_cart",disabled:D.value},null,8,["textButtonDefault","onClick","disabled"])])):r.createCommentVNode("",!0)])])}}}),[["__scopeId","data-v-75fa9255"]]),b2={class:"wrapper_loader"},A2=r.defineComponent({__name:"Loader",props:{size:{type:String,default:"40px"}},setup(a){return(l,i)=>(r.openBlock(),r.createElementBlock("div",b2,[r.createElementVNode("div",{class:"loader",style:r.normalizeStyle({width:a.size})},null,4)]))}}),S2=We(r.defineComponent({__name:"AnimationLoader",props:{id:{}},setup(a){const l=r.ref(!0);return r.watch(()=>l.value,()=>{l.value=!1,setTimeout(()=>{l.value=!0},0)}),(i,o)=>(r.openBlock(),r.createElementBlock("div",{class:"opacity-animation",key:a.id},[r.renderSlot(i.$slots,"opacityLoader",{},void 0,!0)]))}}),[["__scopeId","data-v-c6b97942"]]),I2={key:0},N2={class:"card__main__wrapper"},T2={key:0,class:"folder_content_top"},k2={key:0,class:"loader_card_main"},R2=["src","alt"],B2={class:"card_title_price_wrapper"},O2={class:"title"},M2={key:0,class:"price"},D2={key:1},v2={key:0,class:"card_button_add_wrapper"},_a=We(r.defineComponent({__name:"CardMain",props:{data:{},activeTags:{},is_group:{type:Boolean},parent:{},isLoading:{type:Boolean},selectGroupChild:{type:Function},takeCurrentCard:{type:Function}},setup(a){Ct();const l=ot(),i=Lt(),{is_18_above_content:o,is18Allowed:u,notificationData_lib:f}=_e.storeToRefs(l),{isDesktop:m}=Wn(),p=a,_=(I,B)=>{var k,P,M;const T={id:I.id,is_fake:I.is_fake||!1,is_od_united_product:I.is_od_united_product||!1,amount:I.amount||1,name:I.name,image_link:I.image_link,price:I.price,old_price:I.price,size:void 0,sizes:[],modifiers:[],groups:I.groups,group_modifiers:[],energy_amount:I.energy_amount??0,proteins_amount:I.proteins_amount??0,fat_amount:I.fat_amount??0,carbohydrates_amount:I.carbohydrates_amount??0},D=!((k=I.modifiers)!=null&&k.length)&&!((P=I.group_modifiers)!=null&&P.length)&&!((M=I.sizes)!=null&&M.length);if(i.isUpSale=!1,I.adult&&!u.value){o.value=!0,D&&(f.value.fastAdd=T);return}if(D){l.addToCart(T);return}if(I.amount||(I.amount=1),p.is_group&&p.selectGroupChild){p.selectGroupChild({...I,parent:p.parent,child:B.child_groups});return}p.takeCurrentCard&&p.takeCurrentCard(B.id)},x=I=>{if(p.is_group&&p.selectGroupChild){I={...I,parent:p.parent,child:I.child_groups},p.selectGroupChild(I);return}if(I.adult&&!u.value){o.value=!0;return}p.takeCurrentCard&&p.takeCurrentCard(I.id)},C=r.computed(()=>p.activeTags.every(I=>p.data.tags.includes(I))),{mediaUrl:y}=bn(()=>p.data.id+"_image",()=>p.data.image_link);return(I,B)=>{var T;return((T=p.activeTags)==null?void 0:T.length)===0||C.value||p.is_group?(r.openBlock(),r.createElementBlock("div",I2,[r.createVNode(S2,{id:p.data.id},{opacityLoader:r.withCtx(()=>[r.createElementVNode("div",N2,[a.is_group?(r.openBlock(),r.createElementBlock("div",T2)):r.createCommentVNode("",!0),r.createElementVNode("div",{onClick:B[0]||(B[0]=D=>x(p.data)),class:r.normalizeClass(["card__main",{card__main_folder:a.is_group}])},[a.isLoading?(r.openBlock(),r.createElementBlock("div",k2,[r.createVNode(A2)])):(r.openBlock(),r.createElementBlock("div",{key:1,class:r.normalizeClass(["card__main_content",{card_main_desktop_qr:r.unref(m)}])},[r.createElementVNode("img",{src:r.unref(y)||"",class:r.normalizeClass(["img",{card_blur_image:p.data.adult&&!r.unref(u)}]),loading:"lazy",alt:a.data.name},null,10,R2),r.createElementVNode("div",B2,[r.createElementVNode("p",O2,r.toDisplayString(a.data.name),1),a.is_group?r.createCommentVNode("",!0):(r.openBlock(),r.createElementBlock("p",M2,r.toDisplayString(r.unref(mr)(a.data))+" ₽",1))])],2))],2),r.unref(m)?r.createCommentVNode("",!0):(r.openBlock(),r.createElementBlock("div",D2,[a.is_group?r.createCommentVNode("",!0):(r.openBlock(),r.createElementBlock("div",v2,[r.createElementVNode("div",{onClick:B[1]||(B[1]=D=>_(a.data,p.data)),class:"add_button"},[...B[2]||(B[2]=[r.createElementVNode("div",{class:"image_add_button"},null,-1)])])]))]))])]),_:1},8,["id"])])):r.createCommentVNode("",!0)}}}),[["__scopeId","data-v-bfc53e47"]]),P2=["id","onClick"],L2=We(r.defineComponent({__name:"GroupMain",props:{menuGroup:{},idActiveGroup:{},activeTakeGroup:{type:Function}},setup(a){const{shouldUseDragScroll:l}=Wn(),i=r.ref(null);return(o,u)=>a.menuGroup.length?r.withDirectives((r.openBlock(),r.createElementBlock("ul",{key:0,class:"main__menu",ref_key:"scrollGroup",ref:i},[r.createVNode(ho,{axis:"x",behavior:"smooth",container:i.value,autoScroll:!0,idActive:a.idActiveGroup,clearContainer:!0},{default:r.withCtx(({handleTargetClick:f})=>[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(a.menuGroup,(m,p)=>(r.openBlock(),r.createElementBlock("li",{key:m.id,id:"scrolling"+m.id,onClick:_=>{a.activeTakeGroup&&a.activeTakeGroup(m.id,p),f(_)},style:r.normalizeStyle(a.idActiveGroup==m.id?{fontFamily:"Bounded"}:{})},r.toDisplayString(m.name),13,P2))),128))]),_:1},8,["container","idActive"])])),[[r.unref(Xr),r.unref(l)?{}:!1]]):r.createCommentVNode("",!0)}}),[["__scopeId","data-v-aa0ca388"]]),F2=["id","onClick"],V2=We(r.defineComponent({__name:"TagsMain",props:{menuTags:{default:()=>[]},groupIndex:{default:null},isSolo:{type:Boolean,default:!1},currentActiveTag:{},activeTakeTags:{type:Function,default:void 0},activeTakeTagsSolo:{type:Function,default:void 0}},setup(a){const l=a,{shouldUseDragScroll:i}=Wn(),o=r.ref(null),u=r.computed(()=>{if(l.isSolo&&!l.groupIndex)return Array.isArray(l.currentActiveTag)?l.currentActiveTag:[];if(l.groupIndex!==null&&l.groupIndex!==void 0){const f=l.currentActiveTag[l.groupIndex];return Array.isArray(f)?f:[]}return[]});return(f,m)=>a.menuTags.length>0?r.withDirectives((r.openBlock(),r.createElementBlock("ul",{key:0,class:"main__filters",ref_key:"scrollTagContainer",ref:o},[r.createVNode(ho,{axis:"x",behavior:"smooth",container:o.value,autoScroll:!0,idActive:u.value?u.value[a.currentActiveTag.length-1]:null,clearContainer:!1},{default:r.withCtx(({handleTargetClick:p})=>[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(a.menuTags,(_,x)=>(r.openBlock(),r.createElementBlock("li",{key:x,id:`scrolling${_}`,onClick:C=>{a.activeTakeTags&&(a.groupIndex||a.groupIndex===0)?a.activeTakeTags(_,a.groupIndex):a.activeTakeTagsSolo&&a.activeTakeTagsSolo(_),p(C)},class:r.normalizeClass({main__filter_active:(u.value??[]).includes(_)})},r.toDisplayString(_),11,F2))),128))]),_:1},8,["container","idActive"])])),[[r.unref(Xr),r.unref(i)?{}:!1]]):r.createCommentVNode("",!0)}}),[["__scopeId","data-v-afba730a"]]),U2=["data-id"],z2=["src"],H2=["src"],G2=We(r.defineComponent({__name:"DrumItem",props:{group:{},index:{},active:{type:Boolean}},setup(a){const l=a,{mediaUrl:i}=bn(()=>{var o,u;return(o=l.group)!=null&&o.video_link?`${l.group.id}_video`:(u=l.group)!=null&&u.image_link?`${l.group.id}_image`:null});return(o,u)=>a.group?(r.openBlock(),r.createElementBlock("div",{key:0,class:r.normalizeClass(["drum_item",{active:l.active}]),"data-id":a.group.id},[a.group.video_link?r.withDirectives((r.openBlock(),r.createElementBlock("video",{key:r.unref(i),loop:"",autoplay:"",muted:"",playsinline:"",class:"drum_img"},[r.createElementVNode("source",{src:r.unref(i)||"",type:"video/webm"},null,8,z2)])),[[r.unref(Er)]]):(r.openBlock(),r.createElementBlock("img",{key:1,class:"drum_img",src:r.unref(i)||""},null,8,H2)),r.createElementVNode("p",null,r.toDisplayString(a.group.name),1)],10,U2)):r.createCommentVNode("",!0)}}),[["__scopeId","data-v-2b994529"]]),W2={},X2={width:"9.998535",height:"10.000000",viewBox:"0 0 9.99854 10",fill:"none",xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink"};function $2(a,l){return r.openBlock(),r.createElementBlock("svg",X2,[...l[0]||(l[0]=[r.createElementVNode("desc",null," Created with Pixso. ",-1),r.createElementVNode("defs",null,null,-1),r.createElementVNode("path",{id:"Форма 5",d:"M4.23 10L5.76 10L5.76 5.74L9.99 5.74L9.99 4.25L5.76 4.25L5.76 0L4.23 0L4.23 4.25L0 4.25L0 5.74L4.23 5.74L4.23 10Z",fill:"#F2F7FF","fill-opacity":"1.000000","fill-rule":"nonzero"},null,-1)])])}const j2=We(W2,[["render",$2]]),q2={class:"recommendation_wrapper"},Z2={class:"recommendation_header"},Y2={class:"recommendation_info"},K2=We(r.defineComponent({__name:"Recommendation",props:{closeCurrentCard:{},openCurrentCard:{}},setup(a){const l=Lt(),{isUpSale:i,dataUpSale:o}=_e.storeToRefs(l),u=()=>{i.value=!1};return r.onUnmounted(()=>{o.value=null}),(f,m)=>(r.openBlock(),r.createElementBlock("div",q2,[r.createElementVNode("div",Z2,[m[0]||(m[0]=r.createElementVNode("p",{class:"header_title"},"Часто берут вместе",-1)),r.createElementVNode("div",{class:"header_close",onClick:u},[r.createVNode(j2,{class:"close_icon"})])]),r.createElementVNode("div",Y2,[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(r.unref(o),p=>(r.openBlock(),r.createBlock(_a,{data:p,key:p.id,parent:p.id,is_group:!1,is_product:!0,class:"card",activeTags:[],isLoading:!1,closeCurrentCard:a.closeCurrentCard,takeCurrentCard:()=>a.openCurrentCard(p.id,!0)},null,8,["data","parent","closeCurrentCard","takeCurrentCard"]))),128))])]))}}),[["__scopeId","data-v-d545ec45"]]),Q2=r.defineComponent({__name:"Blackout",props:{data:{type:Boolean}},setup(a){const l=a;return r.watch(()=>l.data,i=>{document.body.style.overflow=i?"hidden":""}),()=>{}}}),J2={class:"wrapper_modal"},em={class:"card_modal"},tm=We(r.defineComponent({__name:"ModalWindows",props:{visible:{type:Boolean}},setup(a){const l=a,i=Lt(),{isUpSale:o}=_e.storeToRefs(i),u=()=>{o.value=!1};return(f,m)=>(r.openBlock(),r.createElementBlock(r.Fragment,null,[r.createVNode(Q2,{data:l.visible},null,8,["data"]),r.createElementVNode("div",{class:"black_modal",onClick:u}),r.createElementVNode("div",J2,[r.createElementVNode("div",em,[r.renderSlot(f.$slots,"default",{},void 0,!0)])])],64))}}),[["__scopeId","data-v-ec2b2c4d"]]);var we;(function(a){a[a.QR_CODE=0]="QR_CODE",a[a.AZTEC=1]="AZTEC",a[a.CODABAR=2]="CODABAR",a[a.CODE_39=3]="CODE_39",a[a.CODE_93=4]="CODE_93",a[a.CODE_128=5]="CODE_128",a[a.DATA_MATRIX=6]="DATA_MATRIX",a[a.MAXICODE=7]="MAXICODE",a[a.ITF=8]="ITF",a[a.EAN_13=9]="EAN_13",a[a.EAN_8=10]="EAN_8",a[a.PDF_417=11]="PDF_417",a[a.RSS_14=12]="RSS_14",a[a.RSS_EXPANDED=13]="RSS_EXPANDED",a[a.UPC_A=14]="UPC_A",a[a.UPC_E=15]="UPC_E",a[a.UPC_EAN_EXTENSION=16]="UPC_EAN_EXTENSION"})(we||(we={}));var wa=new Map([[we.QR_CODE,"QR_CODE"],[we.AZTEC,"AZTEC"],[we.CODABAR,"CODABAR"],[we.CODE_39,"CODE_39"],[we.CODE_93,"CODE_93"],[we.CODE_128,"CODE_128"],[we.DATA_MATRIX,"DATA_MATRIX"],[we.MAXICODE,"MAXICODE"],[we.ITF,"ITF"],[we.EAN_13,"EAN_13"],[we.EAN_8,"EAN_8"],[we.PDF_417,"PDF_417"],[we.RSS_14,"RSS_14"],[we.RSS_EXPANDED,"RSS_EXPANDED"],[we.UPC_A,"UPC_A"],[we.UPC_E,"UPC_E"],[we.UPC_EAN_EXTENSION,"UPC_EAN_EXTENSION"]]),Ca;(function(a){a[a.UNKNOWN=0]="UNKNOWN",a[a.URL=1]="URL"})(Ca||(Ca={}));function nm(a){return Object.values(we).includes(a)}var bi;(function(a){a[a.SCAN_TYPE_CAMERA=0]="SCAN_TYPE_CAMERA",a[a.SCAN_TYPE_FILE=1]="SCAN_TYPE_FILE"})(bi||(bi={}));var rm=function(){function a(){}return a.GITHUB_PROJECT_URL="https://github.com/mebjas/html5-qrcode",a.SCAN_DEFAULT_FPS=2,a.DEFAULT_DISABLE_FLIP=!1,a.DEFAULT_REMEMBER_LAST_CAMERA_USED=!0,a.DEFAULT_SUPPORTED_SCAN_TYPE=[bi.SCAN_TYPE_CAMERA,bi.SCAN_TYPE_FILE],a}(),Ea=function(){function a(l,i){this.format=l,this.formatName=i}return a.prototype.toString=function(){return this.formatName},a.create=function(l){if(!wa.has(l))throw"".concat(l," not in html5QrcodeSupportedFormatsTextMap");return new a(l,wa.get(l))},a}(),ya=function(){function a(){}return a.createFromText=function(l){var i={text:l};return{decodedText:l,result:i}},a.createFromQrcodeResult=function(l){return{decodedText:l.text,result:l}},a}(),Ao;(function(a){a[a.UNKWOWN_ERROR=0]="UNKWOWN_ERROR",a[a.IMPLEMENTATION_ERROR=1]="IMPLEMENTATION_ERROR",a[a.NO_CODE_FOUND_ERROR=2]="NO_CODE_FOUND_ERROR"})(Ao||(Ao={}));var im=function(){function a(){}return a.createFrom=function(l){return{errorMessage:l,type:Ao.UNKWOWN_ERROR}},a}(),om=function(){function a(l){this.verbose=l}return a.prototype.log=function(l){this.verbose&&console.log(l)},a.prototype.warn=function(l){this.verbose&&console.warn(l)},a.prototype.logError=function(l,i){(this.verbose||i===!0)&&console.error(l)},a.prototype.logErrors=function(l){if(l.length===0)throw"Logger#logError called without arguments";this.verbose&&console.error(l)},a}();function zn(a){return typeof a>"u"||a===null}var br=function(){function a(){}return a.codeParseError=function(l){return"QR code parse error, error = ".concat(l)},a.errorGettingUserMedia=function(l){return"Error getting userMedia, error = ".concat(l)},a.onlyDeviceSupportedError=function(){return"The device doesn't support navigator.mediaDevices , only supported cameraIdOrConfig in this case is deviceId parameter (string)."},a.cameraStreamingNotSupported=function(){return"Camera streaming not supported by the browser."},a.unableToQuerySupportedDevices=function(){return"Unable to query supported devices, unknown error."},a.insecureContextCameraQueryError=function(){return"Camera access is only supported in secure context like https or localhost."},a.scannerPaused=function(){return"Scanner paused"},a}(),ba=function(){function a(){}return a.isMediaStreamConstraintsValid=function(l,i){if(typeof l!="object"){var o=typeof l;return i.logError("videoConstraints should be of type object, the "+"object passed is of type ".concat(o,"."),!0),!1}for(var u=["autoGainControl","channelCount","echoCancellation","latency","noiseSuppression","sampleRate","sampleSize","volume"],f=new Set(u),m=Object.keys(l),p=0,_=m;p<_.length;p++){var x=_[p];if(f.has(x))return i.logError("".concat(x," is not supported videoConstaints."),!0),!1}return!0},a}(),So={exports:{}};(function(a,l){(function(i,o){o(l)})(wr,function(i){function o(b){return b==null}var u=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(b,e){b.__proto__=e}||function(b,e){for(var t in e)e.hasOwnProperty(t)&&(b[t]=e[t])};function f(b,e){u(b,e);function t(){this.constructor=b}b.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}function m(b,e){var t=Object.setPrototypeOf;t?t(b,e):b.__proto__=e}function p(b,e){e===void 0&&(e=b.constructor);var t=Error.captureStackTrace;t&&t(b,e)}var _=function(b){f(e,b);function e(t){var n=this.constructor,s=b.call(this,t)||this;return Object.defineProperty(s,"name",{value:n.name,enumerable:!1}),m(s,n.prototype),p(s),s}return e}(Error);class x extends _{constructor(e=void 0){super(e),this.message=e}getKind(){return this.constructor.kind}}x.kind="Exception";class C extends x{}C.kind="ArgumentException";class y extends x{}y.kind="IllegalArgumentException";class I{constructor(e){if(this.binarizer=e,e===null)throw new y("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,s){const c=this.binarizer.getLuminanceSource().crop(e,t,n,s);return new I(this.binarizer.createBinarizer(c))}isRotateSupported(){return this.binarizer.getLuminanceSource().isRotateSupported()}rotateCounterClockwise(){const e=this.binarizer.getLuminanceSource().rotateCounterClockwise();return new I(this.binarizer.createBinarizer(e))}rotateCounterClockwise45(){const e=this.binarizer.getLuminanceSource().rotateCounterClockwise45();return new I(this.binarizer.createBinarizer(e))}toString(){try{return this.getBlackMatrix().toString()}catch{return""}}}class B extends x{static getChecksumInstance(){return new B}}B.kind="ChecksumException";class T{constructor(e){this.source=e}getLuminanceSource(){return this.source}getWidth(){return this.source.getWidth()}getHeight(){return this.source.getHeight()}}class D{static arraycopy(e,t,n,s,c){for(;c--;)n[s++]=e[t++]}static currentTimeMillis(){return Date.now()}}class k extends x{}k.kind="IndexOutOfBoundsException";class P extends k{constructor(e=void 0,t=void 0){super(t),this.index=e,this.message=t}}P.kind="ArrayIndexOutOfBoundsException";class M{static fill(e,t){for(let n=0,s=e.length;n<s;n++)e[n]=t}static fillWithin(e,t,n,s){M.rangeCheck(e.length,t,n);for(let c=t;c<n;c++)e[c]=s}static rangeCheck(e,t,n){if(t>n)throw new y("fromIndex("+t+") > toIndex("+n+")");if(t<0)throw new P(t);if(n>e)throw new P(n)}static asList(...e){return e}static create(e,t,n){return Array.from({length:e}).map(c=>Array.from({length:t}).fill(n))}static createInt32Array(e,t,n){return Array.from({length:e}).map(c=>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,s=e.length;n<s;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 s=n-t,c=new Int32Array(s);return D.arraycopy(e,t,c,0,s),c}static binarySearch(e,t,n){n===void 0&&(n=M.numberComparator);let s=0,c=e.length-1;for(;s<=c;){const d=c+s>>1,h=n(t,e[d]);if(h>0)s=d+1;else if(h<0)c=d-1;else return d}return-s-1}static numberComparator(e,t){return e-t}}class v{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)}}v.MIN_VALUE_32_BITS=-2147483648,v.MAX_VALUE=Number.MAX_SAFE_INTEGER;class j{constructor(e,t){e===void 0?(this.size=0,this.bits=new Int32Array(1)):(this.size=e,t==null?this.bits=j.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=j.makeArray(e);D.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 s=Math.floor(e/32),c=n[s];c&=~((1<<(e&31))-1);const d=n.length;for(;c===0;){if(++s===d)return t;c=n[s]}const h=s*32+v.numberOfTrailingZeros(c);return h>t?t:h}getNextUnset(e){const t=this.size;if(e>=t)return t;const n=this.bits;let s=Math.floor(e/32),c=~n[s];c&=~((1<<(e&31))-1);const d=n.length;for(;c===0;){if(++s===d)return t;c=~n[s]}const h=s*32+v.numberOfTrailingZeros(c);return h>t?t:h}setBulk(e,t){this.bits[Math.floor(e/32)]=t}setRange(e,t){if(t<e||e<0||t>this.size)throw new y;if(t===e)return;t--;const n=Math.floor(e/32),s=Math.floor(t/32),c=this.bits;for(let d=n;d<=s;d++){const h=d>n?0:e&31,w=(2<<(d<s?31:t&31))-(1<<h);c[d]|=w}}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 y;if(t===e)return!0;t--;const s=Math.floor(e/32),c=Math.floor(t/32),d=this.bits;for(let h=s;h<=c;h++){const g=h>s?0:e&31,E=(2<<(h<c?31:t&31))-(1<<g)&4294967295;if((d[h]&E)!==(n?E: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 y("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 y("Sizes don't match");const t=this.bits;for(let n=0,s=t.length;n<s;n++)t[n]^=e.bits[n]}toBytes(e,t,n,s){for(let c=0;c<s;c++){let d=0;for(let h=0;h<8;h++)this.get(e)&&(d|=1<<7-h),e++;t[n+c]=d}}getBitArray(){return this.bits}reverse(){const e=new Int32Array(this.bits.length),t=Math.floor((this.size-1)/32),n=t+1,s=this.bits;for(let c=0;c<n;c++){let d=s[c];d=d>>1&1431655765|(d&1431655765)<<1,d=d>>2&858993459|(d&858993459)<<2,d=d>>4&252645135|(d&252645135)<<4,d=d>>8&16711935|(d&16711935)<<8,d=d>>16&65535|(d&65535)<<16,e[t-c]=d}if(this.size!==n*32){const c=n*32-this.size;let d=e[0]>>>c;for(let h=1;h<n;h++){const g=e[h];d|=g<<32-c,e[h-1]=d,d=g>>>c}e[n-1]=d}this.bits=e}static makeArray(e){return new Int32Array(Math.floor((e+31)/32))}equals(e){if(!(e instanceof j))return!1;const t=e;return this.size===t.size&&M.equals(this.bits,t.bits)}hashCode(){return 31*this.size+M.hashCode(this.bits)}toString(){let e="";for(let t=0,n=this.size;t<n;t++)t&7||(e+=" "),e+=this.get(t)?"X":".";return e}clone(){return new j(this.size,this.bits.slice())}}var H;(function(b){b[b.OTHER=0]="OTHER",b[b.PURE_BARCODE=1]="PURE_BARCODE",b[b.POSSIBLE_FORMATS=2]="POSSIBLE_FORMATS",b[b.TRY_HARDER=3]="TRY_HARDER",b[b.CHARACTER_SET=4]="CHARACTER_SET",b[b.ALLOWED_LENGTHS=5]="ALLOWED_LENGTHS",b[b.ASSUME_CODE_39_CHECK_DIGIT=6]="ASSUME_CODE_39_CHECK_DIGIT",b[b.ASSUME_GS1=7]="ASSUME_GS1",b[b.RETURN_CODABAR_START_END=8]="RETURN_CODABAR_START_END",b[b.NEED_RESULT_POINT_CALLBACK=9]="NEED_RESULT_POINT_CALLBACK",b[b.ALLOWED_EAN_EXTENSIONS=10]="ALLOWED_EAN_EXTENSIONS"})(H||(H={}));var Z=H;class V extends x{static getFormatInstance(){return new V}}V.kind="FormatException";var L;(function(b){b[b.Cp437=0]="Cp437",b[b.ISO8859_1=1]="ISO8859_1",b[b.ISO8859_2=2]="ISO8859_2",b[b.ISO8859_3=3]="ISO8859_3",b[b.ISO8859_4=4]="ISO8859_4",b[b.ISO8859_5=5]="ISO8859_5",b[b.ISO8859_6=6]="ISO8859_6",b[b.ISO8859_7=7]="ISO8859_7",b[b.ISO8859_8=8]="ISO8859_8",b[b.ISO8859_9=9]="ISO8859_9",b[b.ISO8859_10=10]="ISO8859_10",b[b.ISO8859_11=11]="ISO8859_11",b[b.ISO8859_13=12]="ISO8859_13",b[b.ISO8859_14=13]="ISO8859_14",b[b.ISO8859_15=14]="ISO8859_15",b[b.ISO8859_16=15]="ISO8859_16",b[b.SJIS=16]="SJIS",b[b.Cp1250=17]="Cp1250",b[b.Cp1251=18]="Cp1251",b[b.Cp1252=19]="Cp1252",b[b.Cp1256=20]="Cp1256",b[b.UnicodeBigUnmarked=21]="UnicodeBigUnmarked",b[b.UTF8=22]="UTF8",b[b.ASCII=23]="ASCII",b[b.Big5=24]="Big5",b[b.GB18030=25]="GB18030",b[b.EUC_KR=26]="EUC_KR"})(L||(L={}));class F{constructor(e,t,n,...s){this.valueIdentifier=e,this.name=n,typeof t=="number"?this.values=Int32Array.from([t]):this.values=t,this.otherEncodingNames=s,F.VALUE_IDENTIFIER_TO_ECI.set(e,this),F.NAME_TO_ECI.set(n,this);const c=this.values;for(let d=0,h=c.length;d!==h;d++){const g=c[d];F.VALUES_TO_ECI.set(g,this)}for(const d of s)F.NAME_TO_ECI.set(d,this)}getValueIdentifier(){return this.valueIdentifier}getName(){return this.name}getValue(){return this.values[0]}static getCharacterSetECIByValue(e){if(e<0||e>=900)throw new V("incorect value");const t=F.VALUES_TO_ECI.get(e);if(t===void 0)throw new V("incorect value");return t}static getCharacterSetECIByName(e){const t=F.NAME_TO_ECI.get(e);if(t===void 0)throw new V("incorect value");return t}equals(e){if(!(e instanceof F))return!1;const t=e;return this.getName()===t.getName()}}F.VALUE_IDENTIFIER_TO_ECI=new Map,F.VALUES_TO_ECI=new Map,F.NAME_TO_ECI=new Map,F.Cp437=new F(L.Cp437,Int32Array.from([0,2]),"Cp437"),F.ISO8859_1=new F(L.ISO8859_1,Int32Array.from([1,3]),"ISO-8859-1","ISO88591","ISO8859_1"),F.ISO8859_2=new F(L.ISO8859_2,4,"ISO-8859-2","ISO88592","ISO8859_2"),F.ISO8859_3=new F(L.ISO8859_3,5,"ISO-8859-3","ISO88593","ISO8859_3"),F.ISO8859_4=new F(L.ISO8859_4,6,"ISO-8859-4","ISO88594","ISO8859_4"),F.ISO8859_5=new F(L.ISO8859_5,7,"ISO-8859-5","ISO88595","ISO8859_5"),F.ISO8859_6=new F(L.ISO8859_6,8,"ISO-8859-6","ISO88596","ISO8859_6"),F.ISO8859_7=new F(L.ISO8859_7,9,"ISO-8859-7","ISO88597","ISO8859_7"),F.ISO8859_8=new F(L.ISO8859_8,10,"ISO-8859-8","ISO88598","ISO8859_8"),F.ISO8859_9=new F(L.ISO8859_9,11,"ISO-8859-9","ISO88599","ISO8859_9"),F.ISO8859_10=new F(L.ISO8859_10,12,"ISO-8859-10","ISO885910","ISO8859_10"),F.ISO8859_11=new F(L.ISO8859_11,13,"ISO-8859-11","ISO885911","ISO8859_11"),F.ISO8859_13=new F(L.ISO8859_13,15,"ISO-8859-13","ISO885913","ISO8859_13"),F.ISO8859_14=new F(L.ISO8859_14,16,"ISO-8859-14","ISO885914","ISO8859_14"),F.ISO8859_15=new F(L.ISO8859_15,17,"ISO-8859-15","ISO885915","ISO8859_15"),F.ISO8859_16=new F(L.ISO8859_16,18,"ISO-8859-16","ISO885916","ISO8859_16"),F.SJIS=new F(L.SJIS,20,"SJIS","Shift_JIS"),F.Cp1250=new F(L.Cp1250,21,"Cp1250","windows-1250"),F.Cp1251=new F(L.Cp1251,22,"Cp1251","windows-1251"),F.Cp1252=new F(L.Cp1252,23,"Cp1252","windows-1252"),F.Cp1256=new F(L.Cp1256,24,"Cp1256","windows-1256"),F.UnicodeBigUnmarked=new F(L.UnicodeBigUnmarked,25,"UnicodeBigUnmarked","UTF-16BE","UnicodeBig"),F.UTF8=new F(L.UTF8,26,"UTF8","UTF-8"),F.ASCII=new F(L.ASCII,Int32Array.from([27,170]),"ASCII","US-ASCII"),F.Big5=new F(L.Big5,28,"Big5"),F.GB18030=new F(L.GB18030,29,"GB18030","GB2312","EUC_CN","GBK"),F.EUC_KR=new F(L.EUC_KR,30,"EUC_KR","EUC-KR");class re extends x{}re.kind="UnsupportedOperationException";class K{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!K.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 F?e:F.getCharacterSetECIByName(e)}static decodeFallback(e,t){const n=this.encodingCharacterSet(t);if(K.isDecodeFallbackSupported(n)){let s="";for(let c=0,d=e.length;c<d;c++){let h=e[c].toString(16);h.length<2&&(h="0"+h),s+="%"+h}return decodeURIComponent(s)}if(n.equals(F.UnicodeBigUnmarked))return String.fromCharCode.apply(null,new Uint16Array(e.buffer));throw new re(`Encoding ${this.encodingName(t)} not supported by fallback.`)}static isDecodeFallbackSupported(e){return e.equals(F.UTF8)||e.equals(F.ISO8859_1)||e.equals(F.ASCII)}static encodeFallback(e){const n=btoa(unescape(encodeURIComponent(e))).split(""),s=[];for(let c=0;c<n.length;c++)s.push(n[c].charCodeAt(0));return new Uint8Array(s)}}class ee{static castAsNonUtf8Char(e,t=null){const n=t?t.getName():this.ISO88591;return K.decode(new Uint8Array([e]),n)}static guessEncoding(e,t){if(t!=null&&t.get(Z.CHARACTER_SET)!==void 0)return t.get(Z.CHARACTER_SET).toString();const n=e.length;let s=!0,c=!0,d=!0,h=0,g=0,w=0,E=0,A=0,S=0,O=0,U=0,z=0,Y=0,ie=0;const fe=e.length>3&&e[0]===239&&e[1]===187&&e[2]===191;for(let me=0;me<n&&(s||c||d);me++){const de=e[me]&255;d&&(h>0?de&128?h--:d=!1:de&128&&(de&64?(h++,de&32?(h++,de&16?(h++,de&8?d=!1:E++):w++):g++):d=!1)),s&&(de>127&&de<160?s=!1:de>159&&(de<192||de===215||de===247)&&ie++),c&&(A>0?de<64||de===127||de>252?c=!1:A--:de===128||de===160||de>239?c=!1:de>160&&de<224?(S++,U=0,O++,O>z&&(z=O)):de>127?(A++,O=0,U++,U>Y&&(Y=U)):(O=0,U=0))}return d&&h>0&&(d=!1),c&&A>0&&(c=!1),d&&(fe||g+w+E>0)?ee.UTF8:c&&(ee.ASSUME_SHIFT_JIS||z>=3||Y>=3)?ee.SHIFT_JIS:s&&c?z===2&&S===2||ie*10>=n?ee.SHIFT_JIS:ee.ISO88591:s?ee.ISO88591:c?ee.SHIFT_JIS:d?ee.UTF8:ee.PLATFORM_DEFAULT_ENCODING}static format(e,...t){let n=-1;function s(d,h,g,w,E,A){if(d==="%%")return"%";if(t[++n]===void 0)return;d=w?parseInt(w.substr(1)):void 0;let S=E?parseInt(E.substr(1)):void 0,O;switch(A){case"s":O=t[n];break;case"c":O=t[n][0];break;case"f":O=parseFloat(t[n]).toFixed(d);break;case"p":O=parseFloat(t[n]).toPrecision(d);break;case"e":O=parseFloat(t[n]).toExponential(d);break;case"x":O=parseInt(t[n]).toString(S||16);break;case"d":O=parseFloat(parseInt(t[n],S||10).toPrecision(d)).toFixed(0);break}O=typeof O=="object"?JSON.stringify(O):(+O).toString(S);let U=parseInt(g),z=g&&g[0]+""=="0"?"0":" ";for(;O.length<U;)O=h!==void 0?O+z:z+O;return O}let c=/%(-)?(0?[0-9]+)?([.][0-9]+)?([#][0-9]+)?([scfpexd%])/g;return e.replace(c,s)}static getBytes(e,t){return K.encode(e,t)}static getCharCode(e,t=0){return e.charCodeAt(t)}static getCharAt(e){return String.fromCharCode(e)}}ee.SHIFT_JIS=F.SJIS.getName(),ee.GB2312="GB2312",ee.ISO88591=F.ISO8859_1.getName(),ee.EUC_JP="EUC_JP",ee.UTF8=F.UTF8.getName(),ee.PLATFORM_DEFAULT_ENCODING=ee.UTF8,ee.ASSUME_SHIFT_JIS=!1;class G{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+=ee.castAsNonUtf8Char(e,this.encoding):this.value+=String.fromCharCode(e),this}appendChars(e,t,n){for(let s=t;t<t+n;s++)this.append(e[s]);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 W{constructor(e,t,n,s){if(this.width=e,this.height=t,this.rowSize=n,this.bits=s,t==null&&(t=e),this.height=t,e<1||t<1)throw new y("Both dimensions must be greater than 0");n==null&&(n=Math.floor((e+31)/32)),this.rowSize=n,s==null&&(this.bits=new Int32Array(this.rowSize*this.height))}static parseFromBooleanArray(e){const t=e.length,n=e[0].length,s=new W(n,t);for(let c=0;c<t;c++){const d=e[c];for(let h=0;h<n;h++)d[h]&&s.set(h,c)}return s}static parseFromString(e,t,n){if(e===null)throw new y("stringRepresentation cannot be null");const s=new Array(e.length);let c=0,d=0,h=-1,g=0,w=0;for(;w<e.length;)if(e.charAt(w)===`
12
+ `||e.charAt(w)==="\r"){if(c>d){if(h===-1)h=c-d;else if(c-d!==h)throw new y("row lengths do not match");d=c,g++}w++}else if(e.substring(w,w+t.length)===t)w+=t.length,s[c]=!0,c++;else if(e.substring(w,w+n.length)===n)w+=n.length,s[c]=!1,c++;else throw new y("illegal character encountered: "+e.substring(w));if(c>d){if(h===-1)h=c-d;else if(c-d!==h)throw new y("row lengths do not match");g++}const E=new W(h,g);for(let A=0;A<c;A++)s[A]&&E.set(Math.floor(A%h),Math.floor(A/h));return E}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 y("input matrix dimensions do not match");const t=new j(Math.floor(this.width/32)+1),n=this.rowSize,s=this.bits;for(let c=0,d=this.height;c<d;c++){const h=c*n,g=e.getRow(c,t).getBitArray();for(let w=0;w<n;w++)s[h+w]^=g[w]}}clear(){const e=this.bits,t=e.length;for(let n=0;n<t;n++)e[n]=0}setRegion(e,t,n,s){if(t<0||e<0)throw new y("Left and top must be nonnegative");if(s<1||n<1)throw new y("Height and width must be at least 1");const c=e+n,d=t+s;if(d>this.height||c>this.width)throw new y("The region must fit inside the matrix");const h=this.rowSize,g=this.bits;for(let w=t;w<d;w++){const E=w*h;for(let A=e;A<c;A++)g[E+Math.floor(A/32)]|=1<<(A&31)&4294967295}}getRow(e,t){t==null||t.getSize()<this.width?t=new j(this.width):t.clear();const n=this.rowSize,s=this.bits,c=e*n;for(let d=0;d<n;d++)t.setBulk(d*32,s[c+d]);return t}setRow(e,t){D.arraycopy(t.getBitArray(),0,this.bits,e*this.rowSize,this.rowSize)}rotate180(){const e=this.getWidth(),t=this.getHeight();let n=new j(e),s=new j(e);for(let c=0,d=Math.floor((t+1)/2);c<d;c++)n=this.getRow(c,n),s=this.getRow(t-1-c,s),n.reverse(),s.reverse(),this.setRow(c,s),this.setRow(t-1-c,n)}getEnclosingRectangle(){const e=this.width,t=this.height,n=this.rowSize,s=this.bits;let c=e,d=t,h=-1,g=-1;for(let w=0;w<t;w++)for(let E=0;E<n;E++){const A=s[w*n+E];if(A!==0){if(w<d&&(d=w),w>g&&(g=w),E*32<c){let S=0;for(;!(A<<31-S&4294967295);)S++;E*32+S<c&&(c=E*32+S)}if(E*32+31>h){let S=31;for(;!(A>>>S);)S--;E*32+S>h&&(h=E*32+S)}}}return h<c||g<d?null:Int32Array.from([c,d,h-c+1,g-d+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 s=n/e;let c=n%e*32;const d=t[n];let h=0;for(;!(d<<31-h&4294967295);)h++;return c+=h,Int32Array.from([c,s])}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 s=Math.floor(n/e);let c=Math.floor(n%e)*32;const d=t[n];let h=31;for(;!(d>>>h);)h--;return c+=h,Int32Array.from([c,s])}getWidth(){return this.width}getHeight(){return this.height}getRowSize(){return this.rowSize}equals(e){if(!(e instanceof W))return!1;const t=e;return this.width===t.width&&this.height===t.height&&this.rowSize===t.rowSize&&M.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+M.hashCode(this.bits),e}toString(e="X ",t=" ",n=`
13
+ `){return this.buildToString(e,t,n)}buildToString(e,t,n){let s=new G;for(let c=0,d=this.height;c<d;c++){for(let h=0,g=this.width;h<g;h++)s.append(this.get(h,c)?e:t);s.append(n)}return s.toString()}clone(){return new W(this.width,this.height,this.rowSize,this.bits.slice())}}class N extends x{static getNotFoundInstance(){return new N}}N.kind="NotFoundException";class X extends T{constructor(e){super(e),this.luminances=X.EMPTY,this.buckets=new Int32Array(X.LUMINANCE_BUCKETS)}getBlackRow(e,t){const n=this.getLuminanceSource(),s=n.getWidth();t==null||t.getSize()<s?t=new j(s):t.clear(),this.initArrays(s);const c=n.getRow(e,this.luminances),d=this.buckets;for(let g=0;g<s;g++)d[(c[g]&255)>>X.LUMINANCE_SHIFT]++;const h=X.estimateBlackPoint(d);if(s<3)for(let g=0;g<s;g++)(c[g]&255)<h&&t.set(g);else{let g=c[0]&255,w=c[1]&255;for(let E=1;E<s-1;E++){const A=c[E+1]&255;(w*4-g-A)/2<h&&t.set(E),g=w,w=A}}return t}getBlackMatrix(){const e=this.getLuminanceSource(),t=e.getWidth(),n=e.getHeight(),s=new W(t,n);this.initArrays(t);const c=this.buckets;for(let g=1;g<5;g++){const w=Math.floor(n*g/5),E=e.getRow(w,this.luminances),A=Math.floor(t*4/5);for(let S=Math.floor(t/5);S<A;S++){const O=E[S]&255;c[O>>X.LUMINANCE_SHIFT]++}}const d=X.estimateBlackPoint(c),h=e.getMatrix();for(let g=0;g<n;g++){const w=g*t;for(let E=0;E<t;E++)(h[w+E]&255)<d&&s.set(E,g)}return s}createBinarizer(e){return new X(e)}initArrays(e){this.luminances.length<e&&(this.luminances=new Uint8ClampedArray(e));const t=this.buckets;for(let n=0;n<X.LUMINANCE_BUCKETS;n++)t[n]=0}static estimateBlackPoint(e){const t=e.length;let n=0,s=0,c=0;for(let E=0;E<t;E++)e[E]>c&&(s=E,c=e[E]),e[E]>n&&(n=e[E]);let d=0,h=0;for(let E=0;E<t;E++){const A=E-s,S=e[E]*A*A;S>h&&(d=E,h=S)}if(s>d){const E=s;s=d,d=E}if(d-s<=t/16)throw new N;let g=d-1,w=-1;for(let E=d-1;E>s;E--){const A=E-s,S=A*A*(d-E)*(n-e[E]);S>w&&(g=E,w=S)}return g<<X.LUMINANCE_SHIFT}}X.LUMINANCE_BITS=5,X.LUMINANCE_SHIFT=8-X.LUMINANCE_BITS,X.LUMINANCE_BUCKETS=1<<X.LUMINANCE_BITS,X.EMPTY=Uint8ClampedArray.from([0]);class $ extends X{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>=$.MINIMUM_DIMENSION&&n>=$.MINIMUM_DIMENSION){const s=e.getMatrix();let c=t>>$.BLOCK_SIZE_POWER;t&$.BLOCK_SIZE_MASK&&c++;let d=n>>$.BLOCK_SIZE_POWER;n&$.BLOCK_SIZE_MASK&&d++;const h=$.calculateBlackPoints(s,c,d,t,n),g=new W(t,n);$.calculateThresholdForBlock(s,c,d,t,n,h,g),this.matrix=g}else this.matrix=super.getBlackMatrix();return this.matrix}createBinarizer(e){return new $(e)}static calculateThresholdForBlock(e,t,n,s,c,d,h){const g=c-$.BLOCK_SIZE,w=s-$.BLOCK_SIZE;for(let E=0;E<n;E++){let A=E<<$.BLOCK_SIZE_POWER;A>g&&(A=g);const S=$.cap(E,2,n-3);for(let O=0;O<t;O++){let U=O<<$.BLOCK_SIZE_POWER;U>w&&(U=w);const z=$.cap(O,2,t-3);let Y=0;for(let fe=-2;fe<=2;fe++){const me=d[S+fe];Y+=me[z-2]+me[z-1]+me[z]+me[z+1]+me[z+2]}const ie=Y/25;$.thresholdBlock(e,U,A,ie,s,h)}}}static cap(e,t,n){return e<t?t:e>n?n:e}static thresholdBlock(e,t,n,s,c,d){for(let h=0,g=n*c+t;h<$.BLOCK_SIZE;h++,g+=c)for(let w=0;w<$.BLOCK_SIZE;w++)(e[g+w]&255)<=s&&d.set(t+w,n+h)}static calculateBlackPoints(e,t,n,s,c){const d=c-$.BLOCK_SIZE,h=s-$.BLOCK_SIZE,g=new Array(n);for(let w=0;w<n;w++){g[w]=new Int32Array(t);let E=w<<$.BLOCK_SIZE_POWER;E>d&&(E=d);for(let A=0;A<t;A++){let S=A<<$.BLOCK_SIZE_POWER;S>h&&(S=h);let O=0,U=255,z=0;for(let ie=0,fe=E*s+S;ie<$.BLOCK_SIZE;ie++,fe+=s){for(let me=0;me<$.BLOCK_SIZE;me++){const de=e[fe+me]&255;O+=de,de<U&&(U=de),de>z&&(z=de)}if(z-U>$.MIN_DYNAMIC_RANGE)for(ie++,fe+=s;ie<$.BLOCK_SIZE;ie++,fe+=s)for(let me=0;me<$.BLOCK_SIZE;me++)O+=e[fe+me]&255}let Y=O>>$.BLOCK_SIZE_POWER*2;if(z-U<=$.MIN_DYNAMIC_RANGE&&(Y=U/2,w>0&&A>0)){const ie=(g[w-1][A]+2*g[w][A-1]+g[w-1][A-1])/4;U<ie&&(Y=ie)}g[w][A]=Y}}return g}}$.BLOCK_SIZE_POWER=3,$.BLOCK_SIZE=1<<$.BLOCK_SIZE_POWER,$.BLOCK_SIZE_MASK=$.BLOCK_SIZE-1,$.MINIMUM_DIMENSION=$.BLOCK_SIZE*5,$.MIN_DYNAMIC_RANGE=24;class q{constructor(e,t){this.width=e,this.height=t}getWidth(){return this.width}getHeight(){return this.height}isCropSupported(){return!1}crop(e,t,n,s){throw new re("This luminance source does not support cropping.")}isRotateSupported(){return!1}rotateCounterClockwise(){throw new re("This luminance source does not support rotation by 90 degrees.")}rotateCounterClockwise45(){throw new re("This luminance source does not support rotation by 45 degrees.")}toString(){const e=new Uint8ClampedArray(this.width);let t=new G;for(let n=0;n<this.height;n++){const s=this.getRow(n,e);for(let c=0;c<this.width;c++){const d=s[c]&255;let h;d<64?h="#":d<128?h="+":d<192?h=".":h=" ",t.append(h)}t.append(`
14
+ `)}return t.toString()}}class J extends q{constructor(e){super(e.getWidth(),e.getHeight()),this.delegate=e}getRow(e,t){const n=this.delegate.getRow(e,t),s=this.getWidth();for(let c=0;c<s;c++)n[c]=255-(n[c]&255);return n}getMatrix(){const e=this.delegate.getMatrix(),t=this.getWidth()*this.getHeight(),n=new Uint8ClampedArray(t);for(let s=0;s<t;s++)n[s]=255-(e[s]&255);return n}isCropSupported(){return this.delegate.isCropSupported()}crop(e,t,n,s){return new J(this.delegate.crop(e,t,n,s))}isRotateSupported(){return this.delegate.isRotateSupported()}invert(){return this.delegate}rotateCounterClockwise(){return new J(this.delegate.rotateCounterClockwise())}rotateCounterClockwise45(){return new J(this.delegate.rotateCounterClockwise45())}}class le extends q{constructor(e){super(e.width,e.height),this.canvas=e,this.tempCanvasElement=null,this.buffer=le.makeBufferFromCanvasImageData(e)}static makeBufferFromCanvasImageData(e){const t=e.getContext("2d").getImageData(0,0,e.width,e.height);return le.toGrayscaleBuffer(t.data,e.width,e.height)}static toGrayscaleBuffer(e,t,n){const s=new Uint8ClampedArray(t*n);for(let c=0,d=0,h=e.length;c<h;c+=4,d++){let g;if(e[c+3]===0)g=255;else{const E=e[c],A=e[c+1],S=e[c+2];g=306*E+601*A+117*S+512>>10}s[d]=g}return s}getRow(e,t){if(e<0||e>=this.getHeight())throw new y("Requested row is outside the image: "+e);const n=this.getWidth(),s=e*n;return t===null?t=this.buffer.slice(s,s+n):(t.length<n&&(t=new Uint8ClampedArray(n)),t.set(this.buffer.slice(s,s+n))),t}getMatrix(){return this.buffer}isCropSupported(){return!0}crop(e,t,n,s){return super.crop(e,t,n,s),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"),s=e*le.DEGREE_TO_RADIANS,c=this.canvas.width,d=this.canvas.height,h=Math.ceil(Math.abs(Math.cos(s))*c+Math.abs(Math.sin(s))*d),g=Math.ceil(Math.abs(Math.sin(s))*c+Math.abs(Math.cos(s))*d);return t.width=h,t.height=g,n.translate(h/2,g/2),n.rotate(s),n.drawImage(this.canvas,c/-2,d/-2),this.buffer=le.makeBufferFromCanvasImageData(t),this}invert(){return new J(this)}}le.DEGREE_TO_RADIANS=Math.PI/180;class se{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 oe=(globalThis||wr||self||window||void 0)&&(globalThis||wr||self||window||void 0).__awaiter||function(b,e,t,n){function s(c){return c instanceof t?c:new t(function(d){d(c)})}return new(t||(t=Promise))(function(c,d){function h(E){try{w(n.next(E))}catch(A){d(A)}}function g(E){try{w(n.throw(E))}catch(A){d(A)}}function w(E){E.done?c(E.value):s(E.value).then(h,g)}w((n=n.apply(b,e||[])).next())})};class ge{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 oe(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 s=n.kind==="video"?"videoinput":n.kind;if(s!=="videoinput")continue;const c=n.deviceId||n.id,d=n.label||`Video device ${t.length+1}`,h=n.groupId,g={deviceId:c,label:d,kind:s,groupId:h};t.push(g)}return t})}getVideoInputDevices(){return oe(this,void 0,void 0,function*(){return(yield this.listVideoInputDevices()).map(t=>new se(t.deviceId,t.label))})}findDeviceById(e){return oe(this,void 0,void 0,function*(){const t=yield this.listVideoInputDevices();return t?t.find(n=>n.deviceId===e):null})}decodeFromInputVideoDevice(e,t){return oe(this,void 0,void 0,function*(){return yield this.decodeOnceFromVideoDevice(e,t)})}decodeOnceFromVideoDevice(e,t){return oe(this,void 0,void 0,function*(){this.reset();let n;e?n={deviceId:{exact:e}}:n={facingMode:"environment"};const s={video:n};return yield this.decodeOnceFromConstraints(s,t)})}decodeOnceFromConstraints(e,t){return oe(this,void 0,void 0,function*(){const n=yield navigator.mediaDevices.getUserMedia(e);return yield this.decodeOnceFromStream(n,t)})}decodeOnceFromStream(e,t){return oe(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 oe(this,void 0,void 0,function*(){return yield this.decodeFromVideoDevice(e,t,n)})}decodeFromVideoDevice(e,t,n){return oe(this,void 0,void 0,function*(){let s;e?s={deviceId:{exact:e}}:s={facingMode:"environment"};const c={video:s};return yield this.decodeFromConstraints(c,t,n)})}decodeFromConstraints(e,t,n){return oe(this,void 0,void 0,function*(){const s=yield navigator.mediaDevices.getUserMedia(e);return yield this.decodeFromStream(s,t,n)})}decodeFromStream(e,t,n){return oe(this,void 0,void 0,function*(){this.reset();const s=yield this.attachStreamToVideo(e,t);return yield this.decodeContinuously(s,n)})}stopAsyncDecode(){this._stopAsyncDecode=!0}stopContinuousDecode(){this._stopContinuousDecode=!0}attachStreamToVideo(e,t){return oe(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 oe(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 C(`element with id '${e}' not found`);if(n.nodeName.toLowerCase()!==t.toLowerCase())throw new C(`element with id '${e}' must be an ${t} element`);return n}decodeFromImage(e,t){if(!e&&!t)throw new C("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 C("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 C("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 C("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 C("A video element must be provided.");this.reset();const t=this.prepareVideoElement(e);return this.videoElement=t,t}decodeFromImageUrl(e){if(!e)throw new C("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 C("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 C("An URL must be provided.");this.reset();const n=this.prepareVideoElement(),s=this.decodeFromVideoElementContinuously(n,t);return n.src=e,s}_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 oe(this,void 0,void 0,function*(){return yield this.playVideoOnLoadAsync(e),yield this.decodeOnce(e)})}_decodeOnLoadVideoContinuously(e,t){return oe(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 s=(c,d)=>{if(this._stopAsyncDecode){d(new N("Video stream has ended before any code could be detected.")),this._stopAsyncDecode=void 0;return}try{const h=this.decode(e);c(h)}catch(h){const g=t&&h instanceof N,E=(h instanceof B||h instanceof V)&&n;if(g||E)return setTimeout(s,this._timeBetweenDecodingAttempts,c,d);d(h)}};return new Promise((c,d)=>s(c,d))}decodeContinuously(e,t){this._stopContinuousDecode=!1;const n=()=>{if(this._stopContinuousDecode){this._stopContinuousDecode=void 0;return}try{const s=this.decode(e);t(s,null),setTimeout(n,this.timeBetweenScansMillis)}catch(s){t(null,s);const c=s instanceof B||s instanceof V,d=s instanceof N;(c||d)&&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 le(t),s=new $(n);return new I(s)}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,s;return typeof e<"u"&&(e instanceof HTMLVideoElement?(n=e.videoWidth,s=e.videoHeight):e instanceof HTMLImageElement&&(n=e.naturalWidth||e.width,s=e.naturalHeight||e.height)),t.style.width=n+"px",t.style.height=s+"px",t.width=n,t.height=s,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 Ee{constructor(e,t,n=t==null?0:8*t.length,s,c,d=D.currentTimeMillis()){this.text=e,this.rawBytes=t,this.numBits=n,this.resultPoints=s,this.format=c,this.timestamp=d,this.text=e,this.rawBytes=t,n==null?this.numBits=t==null?0:8*t.length:this.numBits=n,this.resultPoints=s,this.format=c,this.resultMetadata=null,d==null?this.timestamp=D.currentTimeMillis():this.timestamp=d}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);D.arraycopy(t,0,n,0,t.length),D.arraycopy(e,0,n,t.length,e.length),this.resultPoints=n}}getTimestamp(){return this.timestamp}toString(){return this.text}}var Fe;(function(b){b[b.AZTEC=0]="AZTEC",b[b.CODABAR=1]="CODABAR",b[b.CODE_39=2]="CODE_39",b[b.CODE_93=3]="CODE_93",b[b.CODE_128=4]="CODE_128",b[b.DATA_MATRIX=5]="DATA_MATRIX",b[b.EAN_8=6]="EAN_8",b[b.EAN_13=7]="EAN_13",b[b.ITF=8]="ITF",b[b.MAXICODE=9]="MAXICODE",b[b.PDF_417=10]="PDF_417",b[b.QR_CODE=11]="QR_CODE",b[b.RSS_14=12]="RSS_14",b[b.RSS_EXPANDED=13]="RSS_EXPANDED",b[b.UPC_A=14]="UPC_A",b[b.UPC_E=15]="UPC_E",b[b.UPC_EAN_EXTENSION=16]="UPC_EAN_EXTENSION"})(Fe||(Fe={}));var ue=Fe,nt;(function(b){b[b.OTHER=0]="OTHER",b[b.ORIENTATION=1]="ORIENTATION",b[b.BYTE_SEGMENTS=2]="BYTE_SEGMENTS",b[b.ERROR_CORRECTION_LEVEL=3]="ERROR_CORRECTION_LEVEL",b[b.ISSUE_NUMBER=4]="ISSUE_NUMBER",b[b.SUGGESTED_PRICE=5]="SUGGESTED_PRICE",b[b.POSSIBLE_COUNTRY=6]="POSSIBLE_COUNTRY",b[b.UPC_EAN_EXTENSION=7]="UPC_EAN_EXTENSION",b[b.PDF417_EXTRA_METADATA=8]="PDF417_EXTRA_METADATA",b[b.STRUCTURED_APPEND_SEQUENCE=9]="STRUCTURED_APPEND_SEQUENCE",b[b.STRUCTURED_APPEND_PARITY=10]="STRUCTURED_APPEND_PARITY"})(nt||(nt={}));var Ae=nt;class Ke{constructor(e,t,n,s,c=-1,d=-1){this.rawBytes=e,this.text=t,this.byteSegments=n,this.ecLevel=s,this.structuredAppendSequenceNumber=c,this.structuredAppendParity=d,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 st{exp(e){return this.expTable[e]}log(e){if(e===0)throw new y;return this.logTable[e]}static addOrSubtract(e,t){return e^t}}class He{constructor(e,t){if(t.length===0)throw new y;this.field=e;const n=t.length;if(n>1&&t[0]===0){let s=1;for(;s<n&&t[s]===0;)s++;s===n?this.coefficients=Int32Array.from([0]):(this.coefficients=new Int32Array(n-s),D.arraycopy(t,s,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 d=0,h=t.length;d!==h;d++){const g=t[d];n=st.addOrSubtract(n,g)}return n}n=t[0];const s=t.length,c=this.field;for(let d=1;d<s;d++)n=st.addOrSubtract(c.multiply(e,n),t[d]);return n}addOrSubtract(e){if(!this.field.equals(e.field))throw new y("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 d=t;t=n,n=d}let s=new Int32Array(n.length);const c=n.length-t.length;D.arraycopy(n,0,s,0,c);for(let d=c;d<n.length;d++)s[d]=st.addOrSubtract(t[d-c],n[d]);return new He(this.field,s)}multiply(e){if(!this.field.equals(e.field))throw new y("GenericGFPolys do not have same GenericGF field");if(this.isZero()||e.isZero())return this.field.getZero();const t=this.coefficients,n=t.length,s=e.coefficients,c=s.length,d=new Int32Array(n+c-1),h=this.field;for(let g=0;g<n;g++){const w=t[g];for(let E=0;E<c;E++)d[g+E]=st.addOrSubtract(d[g+E],h.multiply(w,s[E]))}return new He(h,d)}multiplyScalar(e){if(e===0)return this.field.getZero();if(e===1)return this;const t=this.coefficients.length,n=this.field,s=new Int32Array(t),c=this.coefficients;for(let d=0;d<t;d++)s[d]=n.multiply(c[d],e);return new He(n,s)}multiplyByMonomial(e,t){if(e<0)throw new y;if(t===0)return this.field.getZero();const n=this.coefficients,s=n.length,c=new Int32Array(s+e),d=this.field;for(let h=0;h<s;h++)c[h]=d.multiply(n[h],t);return new He(d,c)}divide(e){if(!this.field.equals(e.field))throw new y("GenericGFPolys do not have same GenericGF field");if(e.isZero())throw new y("Divide by 0");const t=this.field;let n=t.getZero(),s=this;const c=e.getCoefficient(e.getDegree()),d=t.inverse(c);for(;s.getDegree()>=e.getDegree()&&!s.isZero();){const h=s.getDegree()-e.getDegree(),g=t.multiply(s.getCoefficient(s.getDegree()),d),w=e.multiplyByMonomial(h,g),E=t.buildMonomial(h,g);n=n.addOrSubtract(E),s=s.addOrSubtract(w)}return[n,s]}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 s=this.field.log(n);s===0?e+="1":s===1?e+="a":(e+="a^",e+=s)}t!==0&&(t===1?e+="x":(e+="x^",e+=t))}}return e}}class At extends x{}At.kind="ArithmeticException";class Te extends st{constructor(e,t,n){super(),this.primitive=e,this.size=t,this.generatorBase=n;const s=new Int32Array(t);let c=1;for(let h=0;h<t;h++)s[h]=c,c*=2,c>=t&&(c^=e,c&=t-1);this.expTable=s;const d=new Int32Array(t);for(let h=0;h<t-1;h++)d[s[h]]=h;this.logTable=d,this.zero=new He(this,Int32Array.from([0])),this.one=new He(this,Int32Array.from([1]))}getZero(){return this.zero}getOne(){return this.one}buildMonomial(e,t){if(e<0)throw new y;if(t===0)return this.zero;const n=new Int32Array(e+1);return n[0]=t,new He(this,n)}inverse(e){if(e===0)throw new At;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"+v.toHexString(this.primitive)+","+this.size+")"}equals(e){return e===this}}Te.AZTEC_DATA_12=new Te(4201,4096,1),Te.AZTEC_DATA_10=new Te(1033,1024,1),Te.AZTEC_DATA_6=new Te(67,64,1),Te.AZTEC_PARAM=new Te(19,16,1),Te.QR_CODE_FIELD_256=new Te(285,256,0),Te.DATA_MATRIX_FIELD_256=new Te(301,256,1),Te.AZTEC_DATA_8=Te.DATA_MATRIX_FIELD_256,Te.MAXICODE_FIELD_64=Te.AZTEC_DATA_6;class Se extends x{}Se.kind="ReedSolomonException";class Ve extends x{}Ve.kind="IllegalStateException";class kt{constructor(e){this.field=e}decode(e,t){const n=this.field,s=new He(n,e),c=new Int32Array(t);let d=!0;for(let O=0;O<t;O++){const U=s.evaluateAt(n.exp(O+n.getGeneratorBase()));c[c.length-1-O]=U,U!==0&&(d=!1)}if(d)return;const h=new He(n,c),g=this.runEuclideanAlgorithm(n.buildMonomial(t,1),h,t),w=g[0],E=g[1],A=this.findErrorLocations(w),S=this.findErrorMagnitudes(E,A);for(let O=0;O<A.length;O++){const U=e.length-1-n.log(A[O]);if(U<0)throw new Se("Bad error location");e[U]=Te.addOrSubtract(e[U],S[O])}}runEuclideanAlgorithm(e,t,n){if(e.getDegree()<t.getDegree()){const O=e;e=t,t=O}const s=this.field;let c=e,d=t,h=s.getZero(),g=s.getOne();for(;d.getDegree()>=(n/2|0);){let O=c,U=h;if(c=d,h=g,c.isZero())throw new Se("r_{i-1} was zero");d=O;let z=s.getZero();const Y=c.getCoefficient(c.getDegree()),ie=s.inverse(Y);for(;d.getDegree()>=c.getDegree()&&!d.isZero();){const fe=d.getDegree()-c.getDegree(),me=s.multiply(d.getCoefficient(d.getDegree()),ie);z=z.addOrSubtract(s.buildMonomial(fe,me)),d=d.addOrSubtract(c.multiplyByMonomial(fe,me))}if(g=z.multiply(h).addOrSubtract(U),d.getDegree()>=c.getDegree())throw new Ve("Division algorithm failed to reduce polynomial?")}const w=g.getCoefficient(0);if(w===0)throw new Se("sigmaTilde(0) was zero");const E=s.inverse(w),A=g.multiplyScalar(E),S=d.multiplyScalar(E);return[A,S]}findErrorLocations(e){const t=e.getDegree();if(t===1)return Int32Array.from([e.getCoefficient(1)]);const n=new Int32Array(t);let s=0;const c=this.field;for(let d=1;d<c.getSize()&&s<t;d++)e.evaluateAt(d)===0&&(n[s]=c.inverse(d),s++);if(s!==t)throw new Se("Error locator degree does not match number of roots");return n}findErrorMagnitudes(e,t){const n=t.length,s=new Int32Array(n),c=this.field;for(let d=0;d<n;d++){const h=c.inverse(t[d]);let g=1;for(let w=0;w<n;w++)if(d!==w){const E=c.multiply(t[w],h),A=E&1?E&-2:E|1;g=c.multiply(g,A)}s[d]=c.multiply(e.evaluateAt(h),c.inverse(g)),c.getGeneratorBase()!==0&&(s[d]=c.multiply(s[d],h))}return s}}var rt;(function(b){b[b.UPPER=0]="UPPER",b[b.LOWER=1]="LOWER",b[b.MIXED=2]="MIXED",b[b.DIGIT=3]="DIGIT",b[b.PUNCT=4]="PUNCT",b[b.BINARY=5]="BINARY"})(rt||(rt={}));class Je{decode(e){this.ddata=e;let t=e.getBits(),n=this.extractBits(t),s=this.correctBits(n),c=Je.convertBoolArrayToByteArray(s),d=Je.getEncodedData(s),h=new Ke(c,d,null,null);return h.setNumBits(s.length),h}static highLevelDecode(e){return this.getEncodedData(e)}static getEncodedData(e){let t=e.length,n=rt.UPPER,s=rt.UPPER,c="",d=0;for(;d<t;)if(s===rt.BINARY){if(t-d<5)break;let h=Je.readCode(e,d,5);if(d+=5,h===0){if(t-d<11)break;h=Je.readCode(e,d,11)+31,d+=11}for(let g=0;g<h;g++){if(t-d<8){d=t;break}const w=Je.readCode(e,d,8);c+=ee.castAsNonUtf8Char(w),d+=8}s=n}else{let h=s===rt.DIGIT?4:5;if(t-d<h)break;let g=Je.readCode(e,d,h);d+=h;let w=Je.getCharacter(s,g);w.startsWith("CTRL_")?(n=s,s=Je.getTable(w.charAt(5)),w.charAt(6)==="L"&&(n=s)):(c+=w,s=n)}return c}static getTable(e){switch(e){case"L":return rt.LOWER;case"P":return rt.PUNCT;case"M":return rt.MIXED;case"D":return rt.DIGIT;case"B":return rt.BINARY;case"U":default:return rt.UPPER}}static getCharacter(e,t){switch(e){case rt.UPPER:return Je.UPPER_TABLE[t];case rt.LOWER:return Je.LOWER_TABLE[t];case rt.MIXED:return Je.MIXED_TABLE[t];case rt.PUNCT:return Je.PUNCT_TABLE[t];case rt.DIGIT:return Je.DIGIT_TABLE[t];default:throw new Ve("Bad table")}}correctBits(e){let t,n;this.ddata.getNbLayers()<=2?(n=6,t=Te.AZTEC_DATA_6):this.ddata.getNbLayers()<=8?(n=8,t=Te.AZTEC_DATA_8):this.ddata.getNbLayers()<=22?(n=10,t=Te.AZTEC_DATA_10):(n=12,t=Te.AZTEC_DATA_12);let s=this.ddata.getNbDatablocks(),c=e.length/n;if(c<s)throw new V;let d=e.length%n,h=new Int32Array(c);for(let S=0;S<c;S++,d+=n)h[S]=Je.readCode(e,d,n);try{new kt(t).decode(h,c-s)}catch(S){throw new V(S)}let g=(1<<n)-1,w=0;for(let S=0;S<s;S++){let O=h[S];if(O===0||O===g)throw new V;(O===1||O===g-1)&&w++}let E=new Array(s*n-w),A=0;for(let S=0;S<s;S++){let O=h[S];if(O===1||O===g-1)E.fill(O>1,A,A+n-1),A+=n-1;else for(let U=n-1;U>=0;--U)E[A++]=(O&1<<U)!==0}return E}extractBits(e){let t=this.ddata.isCompact(),n=this.ddata.getNbLayers(),s=(t?11:14)+n*4,c=new Int32Array(s),d=new Array(this.totalBitsInLayer(n,t));if(t)for(let h=0;h<c.length;h++)c[h]=h;else{let h=s+1+2*v.truncDivision(v.truncDivision(s,2)-1,15),g=s/2,w=v.truncDivision(h,2);for(let E=0;E<g;E++){let A=E+v.truncDivision(E,15);c[g-E-1]=w-A-1,c[g+E]=w+A+1}}for(let h=0,g=0;h<n;h++){let w=(n-h)*4+(t?9:12),E=h*2,A=s-1-E;for(let S=0;S<w;S++){let O=S*2;for(let U=0;U<2;U++)d[g+O+U]=e.get(c[E+U],c[E+S]),d[g+2*w+O+U]=e.get(c[E+S],c[A-U]),d[g+4*w+O+U]=e.get(c[A-U],c[A-S]),d[g+6*w+O+U]=e.get(c[A-S],c[E+U])}g+=w*8}return d}static readCode(e,t,n){let s=0;for(let c=t;c<t+n;c++)s<<=1,e[c]&&(s|=1);return s}static readByte(e,t){let n=e.length-t;return n>=8?Je.readCode(e,t,8):Je.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]=Je.readByte(e,8*n);return t}totalBitsInLayer(e,t){return((t?88:112)+16*e)*e}}Je.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"],Je.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"],Je.MIXED_TABLE=["CTRL_PS"," ","\\1","\\2","\\3","\\4","\\5","\\6","\\7","\b"," ",`
15
+ `,"\\13","\f","\r","\\33","\\34","\\35","\\36","\\37","@","\\","^","_","`","|","~","\\177","CTRL_LL","CTRL_UL","CTRL_PL","CTRL_BS"],Je.PUNCT_TABLE=["","\r",`\r
16
+ `,". ",", ",": ","!",'"',"#","$","%","&","'","(",")","*","+",",","-",".","/",":",";","<","=",">","?","[","]","{","}","CTRL_UL"],Je.DIGIT_TABLE=["CTRL_PS"," ","0","1","2","3","4","5","6","7","8","9",",",".","CTRL_UL","CTRL_US"];class ve{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,s){const c=e-n,d=t-s;return Math.sqrt(c*c+d*d)}static sum(e){let t=0;for(let n=0,s=e.length;n!==s;n++){const c=e[n];t+=c}return t}}class Sr{static floatToIntBits(e){return e}}Sr.MAX_VALUE=Number.MAX_SAFE_INTEGER;class be{constructor(e,t){this.x=e,this.y=t}getX(){return this.x}getY(){return this.y}equals(e){if(e instanceof be){const t=e;return this.x===t.x&&this.y===t.y}return!1}hashCode(){return 31*Sr.floatToIntBits(this.x)+Sr.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]),s=this.distance(e[0],e[2]);let c,d,h;if(n>=t&&n>=s?(d=e[0],c=e[1],h=e[2]):s>=n&&s>=t?(d=e[1],c=e[0],h=e[2]):(d=e[2],c=e[0],h=e[1]),this.crossProductZ(c,d,h)<0){const g=c;c=h,h=g}e[0]=c,e[1]=d,e[2]=h}static distance(e,t){return ve.distance(e.x,e.y,t.x,t.y)}static crossProductZ(e,t,n){const s=t.x,c=t.y;return(n.x-s)*(e.y-c)-(n.y-c)*(e.x-s)}}class $n{constructor(e,t){this.bits=e,this.points=t}getBits(){return this.bits}getPoints(){return this.points}}class ki extends $n{constructor(e,t,n,s,c){super(e,t),this.compact=n,this.nbDatablocks=s,this.nbLayers=c}getNbLayers(){return this.nbLayers}getNbDatablocks(){return this.nbDatablocks}isCompact(){return this.compact}}class fn{constructor(e,t,n,s){this.image=e,this.height=e.getHeight(),this.width=e.getWidth(),t==null&&(t=fn.INIT_SIZE),n==null&&(n=e.getWidth()/2|0),s==null&&(s=e.getHeight()/2|0);const c=t/2|0;if(this.leftInit=n-c,this.rightInit=n+c,this.upInit=s-c,this.downInit=s+c,this.upInit<0||this.leftInit<0||this.downInit>=this.height||this.rightInit>=this.width)throw new N}detect(){let e=this.leftInit,t=this.rightInit,n=this.upInit,s=this.downInit,c=!1,d=!0,h=!1,g=!1,w=!1,E=!1,A=!1;const S=this.width,O=this.height;for(;d;){d=!1;let U=!0;for(;(U||!g)&&t<S;)U=this.containsBlackPoint(n,s,t,!1),U?(t++,d=!0,g=!0):g||t++;if(t>=S){c=!0;break}let z=!0;for(;(z||!w)&&s<O;)z=this.containsBlackPoint(e,t,s,!0),z?(s++,d=!0,w=!0):w||s++;if(s>=O){c=!0;break}let Y=!0;for(;(Y||!E)&&e>=0;)Y=this.containsBlackPoint(n,s,e,!1),Y?(e--,d=!0,E=!0):E||e--;if(e<0){c=!0;break}let ie=!0;for(;(ie||!A)&&n>=0;)ie=this.containsBlackPoint(e,t,n,!0),ie?(n--,d=!0,A=!0):A||n--;if(n<0){c=!0;break}d&&(h=!0)}if(!c&&h){const U=t-e;let z=null;for(let me=1;z===null&&me<U;me++)z=this.getBlackPointOnSegment(e,s-me,e+me,s);if(z==null)throw new N;let Y=null;for(let me=1;Y===null&&me<U;me++)Y=this.getBlackPointOnSegment(e,n+me,e+me,n);if(Y==null)throw new N;let ie=null;for(let me=1;ie===null&&me<U;me++)ie=this.getBlackPointOnSegment(t,n+me,t-me,n);if(ie==null)throw new N;let fe=null;for(let me=1;fe===null&&me<U;me++)fe=this.getBlackPointOnSegment(t,s-me,t-me,s);if(fe==null)throw new N;return this.centerEdges(fe,z,ie,Y)}else throw new N}getBlackPointOnSegment(e,t,n,s){const c=ve.round(ve.distance(e,t,n,s)),d=(n-e)/c,h=(s-t)/c,g=this.image;for(let w=0;w<c;w++){const E=ve.round(e+w*d),A=ve.round(t+w*h);if(g.get(E,A))return new be(E,A)}return null}centerEdges(e,t,n,s){const c=e.getX(),d=e.getY(),h=t.getX(),g=t.getY(),w=n.getX(),E=n.getY(),A=s.getX(),S=s.getY(),O=fn.CORR;return c<this.width/2?[new be(A-O,S+O),new be(h+O,g+O),new be(w-O,E-O),new be(c+O,d-O)]:[new be(A+O,S+O),new be(h+O,g-O),new be(w-O,E+O),new be(c-O,d-O)]}containsBlackPoint(e,t,n,s){const c=this.image;if(s){for(let d=e;d<=t;d++)if(c.get(d,n))return!0}else for(let d=e;d<=t;d++)if(c.get(n,d))return!0;return!1}}fn.INIT_SIZE=10,fn.CORR=1;class cn{static checkAndNudgePoints(e,t){const n=e.getWidth(),s=e.getHeight();let c=!0;for(let d=0;d<t.length&&c;d+=2){const h=Math.floor(t[d]),g=Math.floor(t[d+1]);if(h<-1||h>n||g<-1||g>s)throw new N;c=!1,h===-1?(t[d]=0,c=!0):h===n&&(t[d]=n-1,c=!0),g===-1?(t[d+1]=0,c=!0):g===s&&(t[d+1]=s-1,c=!0)}c=!0;for(let d=t.length-2;d>=0&&c;d-=2){const h=Math.floor(t[d]),g=Math.floor(t[d+1]);if(h<-1||h>n||g<-1||g>s)throw new N;c=!1,h===-1?(t[d]=0,c=!0):h===n&&(t[d]=n-1,c=!0),g===-1?(t[d+1]=0,c=!0):g===s&&(t[d+1]=s-1,c=!0)}}}class Jt{constructor(e,t,n,s,c,d,h,g,w){this.a11=e,this.a21=t,this.a31=n,this.a12=s,this.a22=c,this.a32=d,this.a13=h,this.a23=g,this.a33=w}static quadrilateralToQuadrilateral(e,t,n,s,c,d,h,g,w,E,A,S,O,U,z,Y){const ie=Jt.quadrilateralToSquare(e,t,n,s,c,d,h,g);return Jt.squareToQuadrilateral(w,E,A,S,O,U,z,Y).times(ie)}transformPoints(e){const t=e.length,n=this.a11,s=this.a12,c=this.a13,d=this.a21,h=this.a22,g=this.a23,w=this.a31,E=this.a32,A=this.a33;for(let S=0;S<t;S+=2){const O=e[S],U=e[S+1],z=c*O+g*U+A;e[S]=(n*O+d*U+w)/z,e[S+1]=(s*O+h*U+E)/z}}transformPointsWithValues(e,t){const n=this.a11,s=this.a12,c=this.a13,d=this.a21,h=this.a22,g=this.a23,w=this.a31,E=this.a32,A=this.a33,S=e.length;for(let O=0;O<S;O++){const U=e[O],z=t[O],Y=c*U+g*z+A;e[O]=(n*U+d*z+w)/Y,t[O]=(s*U+h*z+E)/Y}}static squareToQuadrilateral(e,t,n,s,c,d,h,g){const w=e-n+c-h,E=t-s+d-g;if(w===0&&E===0)return new Jt(n-e,c-n,e,s-t,d-s,t,0,0,1);{const A=n-c,S=h-c,O=s-d,U=g-d,z=A*U-S*O,Y=(w*U-S*E)/z,ie=(A*E-w*O)/z;return new Jt(n-e+Y*n,h-e+ie*h,e,s-t+Y*s,g-t+ie*g,t,Y,ie,1)}}static quadrilateralToSquare(e,t,n,s,c,d,h,g){return Jt.squareToQuadrilateral(e,t,n,s,c,d,h,g).buildAdjoint()}buildAdjoint(){return new Jt(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 Jt(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 Ri extends cn{sampleGrid(e,t,n,s,c,d,h,g,w,E,A,S,O,U,z,Y,ie,fe,me){const de=Jt.quadrilateralToQuadrilateral(s,c,d,h,g,w,E,A,S,O,U,z,Y,ie,fe,me);return this.sampleGridWithTransform(e,t,n,de)}sampleGridWithTransform(e,t,n,s){if(t<=0||n<=0)throw new N;const c=new W(t,n),d=new Float32Array(2*t);for(let h=0;h<n;h++){const g=d.length,w=h+.5;for(let E=0;E<g;E+=2)d[E]=E/2+.5,d[E+1]=w;s.transformPoints(d),cn.checkAndNudgePoints(e,d);try{for(let E=0;E<g;E+=2)e.get(Math.floor(d[E]),Math.floor(d[E+1]))&&c.set(E/2,h)}catch{throw new N}}return c}}class Bn{static setGridSampler(e){Bn.gridSampler=e}static getInstance(){return Bn.gridSampler}}Bn.gridSampler=new Ri;class Ut{constructor(e,t){this.x=e,this.y=t}toResultPoint(){return new be(this.getX(),this.getY())}getX(){return this.x}getY(){return this.y}}class Bi{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 d=n[0];n[0]=n[2],n[2]=d}this.extractParameters(n);let s=this.sampleGrid(this.image,n[this.shift%4],n[(this.shift+1)%4],n[(this.shift+2)%4],n[(this.shift+3)%4]),c=this.getMatrixCornerPoints(n);return new ki(s,c,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 N;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 s=0;for(let d=0;d<4;d++){let h=n[(this.shift+d)%4];this.compact?(s<<=7,s+=h>>1&127):(s<<=10,s+=(h>>2&992)+(h>>1&31))}let c=this.getCorrectedParameterData(s,this.compact);this.compact?(this.nbLayers=(c>>6)+1,this.nbDataBlocks=(c&63)+1):(this.nbLayers=(c>>11)+1,this.nbDataBlocks=(c&2047)+1)}getRotation(e,t){let n=0;e.forEach((s,c,d)=>{let h=(s>>t-2<<1)+(s&1);n=(n<<3)+h}),n=((n&1)<<11)+(n>>1);for(let s=0;s<4;s++)if(v.bitCount(n^this.EXPECTED_CORNER_BITS[s])<=2)return s;throw new N}getCorrectedParameterData(e,t){let n,s;t?(n=7,s=2):(n=10,s=4);let c=n-s,d=new Int32Array(n);for(let g=n-1;g>=0;--g)d[g]=e&15,e>>=4;try{new kt(Te.AZTEC_PARAM).decode(d,c)}catch{throw new N}let h=0;for(let g=0;g<s;g++)h=(h<<4)+d[g];return h}getBullsEyeCorners(e){let t=e,n=e,s=e,c=e,d=!0;for(this.nbCenterLayers=1;this.nbCenterLayers<9;this.nbCenterLayers++){let A=this.getFirstDifferent(t,d,1,-1),S=this.getFirstDifferent(n,d,1,1),O=this.getFirstDifferent(s,d,-1,1),U=this.getFirstDifferent(c,d,-1,-1);if(this.nbCenterLayers>2){let z=this.distancePoint(U,A)*this.nbCenterLayers/(this.distancePoint(c,t)*(this.nbCenterLayers+2));if(z<.75||z>1.25||!this.isWhiteOrBlackRectangle(A,S,O,U))break}t=A,n=S,s=O,c=U,d=!d}if(this.nbCenterLayers!==5&&this.nbCenterLayers!==7)throw new N;this.compact=this.nbCenterLayers===5;let h=new be(t.getX()+.5,t.getY()-.5),g=new be(n.getX()+.5,n.getY()+.5),w=new be(s.getX()-.5,s.getY()+.5),E=new be(c.getX()-.5,c.getY()-.5);return this.expandSquare([h,g,w,E],2*this.nbCenterLayers-3,2*this.nbCenterLayers)}getMatrixCenter(){let e,t,n,s;try{let h=new fn(this.image).detect();e=h[0],t=h[1],n=h[2],s=h[3]}catch{let g=this.image.getWidth()/2,w=this.image.getHeight()/2;e=this.getFirstDifferent(new Ut(g+7,w-7),!1,1,-1).toResultPoint(),t=this.getFirstDifferent(new Ut(g+7,w+7),!1,1,1).toResultPoint(),n=this.getFirstDifferent(new Ut(g-7,w+7),!1,-1,1).toResultPoint(),s=this.getFirstDifferent(new Ut(g-7,w-7),!1,-1,-1).toResultPoint()}let c=ve.round((e.getX()+s.getX()+t.getX()+n.getX())/4),d=ve.round((e.getY()+s.getY()+t.getY()+n.getY())/4);try{let h=new fn(this.image,15,c,d).detect();e=h[0],t=h[1],n=h[2],s=h[3]}catch{e=this.getFirstDifferent(new Ut(c+7,d-7),!1,1,-1).toResultPoint(),t=this.getFirstDifferent(new Ut(c+7,d+7),!1,1,1).toResultPoint(),n=this.getFirstDifferent(new Ut(c-7,d+7),!1,-1,1).toResultPoint(),s=this.getFirstDifferent(new Ut(c-7,d-7),!1,-1,-1).toResultPoint()}return c=ve.round((e.getX()+s.getX()+t.getX()+n.getX())/4),d=ve.round((e.getY()+s.getY()+t.getY()+n.getY())/4),new Ut(c,d)}getMatrixCornerPoints(e){return this.expandSquare(e,2*this.nbCenterLayers,this.getDimension())}sampleGrid(e,t,n,s,c){let d=Bn.getInstance(),h=this.getDimension(),g=h/2-this.nbCenterLayers,w=h/2+this.nbCenterLayers;return d.sampleGrid(e,h,h,g,g,w,g,w,w,g,w,t.getX(),t.getY(),n.getX(),n.getY(),s.getX(),s.getY(),c.getX(),c.getY())}sampleLine(e,t,n){let s=0,c=this.distanceResultPoint(e,t),d=c/n,h=e.getX(),g=e.getY(),w=d*(t.getX()-e.getX())/c,E=d*(t.getY()-e.getY())/c;for(let A=0;A<n;A++)this.image.get(ve.round(h+A*w),ve.round(g+A*E))&&(s|=1<<n-A-1);return s}isWhiteOrBlackRectangle(e,t,n,s){let c=3;e=new Ut(e.getX()-c,e.getY()+c),t=new Ut(t.getX()-c,t.getY()-c),n=new Ut(n.getX()+c,n.getY()-c),s=new Ut(s.getX()+c,s.getY()+c);let d=this.getColor(s,e);if(d===0)return!1;let h=this.getColor(e,t);return h!==d||(h=this.getColor(t,n),h!==d)?!1:(h=this.getColor(n,s),h===d)}getColor(e,t){let n=this.distancePoint(e,t),s=(t.getX()-e.getX())/n,c=(t.getY()-e.getY())/n,d=0,h=e.getX(),g=e.getY(),w=this.image.get(e.getX(),e.getY()),E=Math.ceil(n);for(let S=0;S<E;S++)h+=s,g+=c,this.image.get(ve.round(h),ve.round(g))!==w&&d++;let A=d/n;return A>.1&&A<.9?0:A<=.1===w?1:-1}getFirstDifferent(e,t,n,s){let c=e.getX()+n,d=e.getY()+s;for(;this.isValid(c,d)&&this.image.get(c,d)===t;)c+=n,d+=s;for(c-=n,d-=s;this.isValid(c,d)&&this.image.get(c,d)===t;)c+=n;for(c-=n;this.isValid(c,d)&&this.image.get(c,d)===t;)d+=s;return d-=s,new Ut(c,d)}expandSquare(e,t,n){let s=n/(2*t),c=e[0].getX()-e[2].getX(),d=e[0].getY()-e[2].getY(),h=(e[0].getX()+e[2].getX())/2,g=(e[0].getY()+e[2].getY())/2,w=new be(h+s*c,g+s*d),E=new be(h-s*c,g-s*d);c=e[1].getX()-e[3].getX(),d=e[1].getY()-e[3].getY(),h=(e[1].getX()+e[3].getX())/2,g=(e[1].getY()+e[3].getY())/2;let A=new be(h+s*c,g+s*d),S=new be(h-s*c,g-s*d);return[w,A,E,S]}isValid(e,t){return e>=0&&e<this.image.getWidth()&&t>0&&t<this.image.getHeight()}isValidPoint(e){let t=ve.round(e.getX()),n=ve.round(e.getY());return this.isValid(t,n)}distancePoint(e,t){return ve.distance(e.getX(),e.getY(),t.getX(),t.getY())}distanceResultPoint(e,t){return ve.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*(v.truncDivision(this.nbLayers-4,8)+1)+15}}class Ir{decode(e,t=null){let n=null,s=new Bi(e.getBlackMatrix()),c=null,d=null;try{let E=s.detectMirror(!1);c=E.getPoints(),this.reportFoundResultPoints(t,c),d=new Je().decode(E)}catch(E){n=E}if(d==null)try{let E=s.detectMirror(!0);c=E.getPoints(),this.reportFoundResultPoints(t,c),d=new Je().decode(E)}catch(E){throw n??E}let h=new Ee(d.getText(),d.getRawBytes(),d.getNumBits(),c,ue.AZTEC,D.currentTimeMillis()),g=d.getByteSegments();g!=null&&h.putMetadata(Ae.BYTE_SEGMENTS,g);let w=d.getECLevel();return w!=null&&h.putMetadata(Ae.ERROR_CORRECTION_LEVEL,w),h}reportFoundResultPoints(e,t){if(e!=null){let n=e.get(Z.NEED_RESULT_POINT_CALLBACK);n!=null&&t.forEach((s,c,d)=>{n.foundPossibleResultPoint(s)})}}reset(){}}class Oo extends ge{constructor(e=500){super(new Ir,e)}}class St{decode(e,t){try{return this.doDecode(e,t)}catch{if(t&&t.get(Z.TRY_HARDER)===!0&&e.isRotateSupported()){const c=e.rotateCounterClockwise(),d=this.doDecode(c,t),h=d.getResultMetadata();let g=270;h!==null&&h.get(Ae.ORIENTATION)===!0&&(g=g+h.get(Ae.ORIENTATION)%360),d.putMetadata(Ae.ORIENTATION,g);const w=d.getResultPoints();if(w!==null){const E=c.getHeight();for(let A=0;A<w.length;A++)w[A]=new be(E-w[A].getY()-1,w[A].getX())}return d}else throw new N}}reset(){}doDecode(e,t){const n=e.getWidth(),s=e.getHeight();let c=new j(n);const d=t&&t.get(Z.TRY_HARDER)===!0,h=Math.max(1,s>>(d?8:5));let g;d?g=s:g=15;const w=Math.trunc(s/2);for(let E=0;E<g;E++){const A=Math.trunc((E+1)/2),S=(E&1)===0,O=w+h*(S?A:-A);if(O<0||O>=s)break;try{c=e.getBlackRow(O,c)}catch{continue}for(let U=0;U<2;U++){if(U===1&&(c.reverse(),t&&t.get(Z.NEED_RESULT_POINT_CALLBACK)===!0)){const z=new Map;t.forEach((Y,ie)=>z.set(ie,Y)),z.delete(Z.NEED_RESULT_POINT_CALLBACK),t=z}try{const z=this.decodeRow(O,c,t);if(U===1){z.putMetadata(Ae.ORIENTATION,180);const Y=z.getResultPoints();Y!==null&&(Y[0]=new be(n-Y[0].getX()-1,Y[0].getY()),Y[1]=new be(n-Y[1].getX()-1,Y[1].getY()))}return z}catch{}}}throw new N}static recordPattern(e,t,n){const s=n.length;for(let w=0;w<s;w++)n[w]=0;const c=e.getSize();if(t>=c)throw new N;let d=!e.get(t),h=0,g=t;for(;g<c;){if(e.get(g)!==d)n[h]++;else{if(++h===s)break;n[h]=1,d=!d}g++}if(!(h===s||h===s-1&&g===c))throw new N}static recordPatternInReverse(e,t,n){let s=n.length,c=e.get(t);for(;t>0&&s>=0;)e.get(--t)!==c&&(s--,c=!c);if(s>=0)throw new N;St.recordPattern(e,t+1,n)}static patternMatchVariance(e,t,n){const s=e.length;let c=0,d=0;for(let w=0;w<s;w++)c+=e[w],d+=t[w];if(c<d)return Number.POSITIVE_INFINITY;const h=c/d;n*=h;let g=0;for(let w=0;w<s;w++){const E=e[w],A=t[w]*h,S=E>A?E-A:A-E;if(S>n)return Number.POSITIVE_INFINITY;g+=S}return g/c}}class pe extends St{static findStartPattern(e){const t=e.getSize(),n=e.getNextSet(0);let s=0,c=Int32Array.from([0,0,0,0,0,0]),d=n,h=!1;const g=6;for(let w=n;w<t;w++)if(e.get(w)!==h)c[s]++;else{if(s===g-1){let E=pe.MAX_AVG_VARIANCE,A=-1;for(let S=pe.CODE_START_A;S<=pe.CODE_START_C;S++){const O=St.patternMatchVariance(c,pe.CODE_PATTERNS[S],pe.MAX_INDIVIDUAL_VARIANCE);O<E&&(E=O,A=S)}if(A>=0&&e.isRange(Math.max(0,d-(w-d)/2),d,!1))return Int32Array.from([d,w,A]);d+=c[0]+c[1],c=c.slice(2,c.length-1),c[s-1]=0,c[s]=0,s--}else s++;c[s]=1,h=!h}throw new N}static decodeCode(e,t,n){St.recordPattern(e,n,t);let s=pe.MAX_AVG_VARIANCE,c=-1;for(let d=0;d<pe.CODE_PATTERNS.length;d++){const h=pe.CODE_PATTERNS[d],g=this.patternMatchVariance(t,h,pe.MAX_INDIVIDUAL_VARIANCE);g<s&&(s=g,c=d)}if(c>=0)return c;throw new N}decodeRow(e,t,n){const s=n&&n.get(Z.ASSUME_GS1)===!0,c=pe.findStartPattern(t),d=c[2];let h=0;const g=new Uint8Array(20);g[h++]=d;let w;switch(d){case pe.CODE_START_A:w=pe.CODE_CODE_A;break;case pe.CODE_START_B:w=pe.CODE_CODE_B;break;case pe.CODE_START_C:w=pe.CODE_CODE_C;break;default:throw new V}let E=!1,A=!1,S="",O=c[0],U=c[1];const z=Int32Array.from([0,0,0,0,0,0]);let Y=0,ie=0,fe=d,me=0,de=!0,je=!1,Le=!1;for(;!E;){const Dr=A;switch(A=!1,Y=ie,ie=pe.decodeCode(t,z,U),g[h++]=ie,ie!==pe.CODE_STOP&&(de=!0),ie!==pe.CODE_STOP&&(me++,fe+=me*ie),O=U,U+=z.reduce((Yg,Kg)=>Yg+Kg,0),ie){case pe.CODE_START_A:case pe.CODE_START_B:case pe.CODE_START_C:throw new V}switch(w){case pe.CODE_CODE_A:if(ie<64)Le===je?S+=String.fromCharCode(32+ie):S+=String.fromCharCode(32+ie+128),Le=!1;else if(ie<96)Le===je?S+=String.fromCharCode(ie-64):S+=String.fromCharCode(ie+64),Le=!1;else switch(ie!==pe.CODE_STOP&&(de=!1),ie){case pe.CODE_FNC_1:s&&(S.length===0?S+="]C1":S+="");break;case pe.CODE_FNC_2:case pe.CODE_FNC_3:break;case pe.CODE_FNC_4_A:!je&&Le?(je=!0,Le=!1):je&&Le?(je=!1,Le=!1):Le=!0;break;case pe.CODE_SHIFT:A=!0,w=pe.CODE_CODE_B;break;case pe.CODE_CODE_B:w=pe.CODE_CODE_B;break;case pe.CODE_CODE_C:w=pe.CODE_CODE_C;break;case pe.CODE_STOP:E=!0;break}break;case pe.CODE_CODE_B:if(ie<96)Le===je?S+=String.fromCharCode(32+ie):S+=String.fromCharCode(32+ie+128),Le=!1;else switch(ie!==pe.CODE_STOP&&(de=!1),ie){case pe.CODE_FNC_1:s&&(S.length===0?S+="]C1":S+="");break;case pe.CODE_FNC_2:case pe.CODE_FNC_3:break;case pe.CODE_FNC_4_B:!je&&Le?(je=!0,Le=!1):je&&Le?(je=!1,Le=!1):Le=!0;break;case pe.CODE_SHIFT:A=!0,w=pe.CODE_CODE_A;break;case pe.CODE_CODE_A:w=pe.CODE_CODE_A;break;case pe.CODE_CODE_C:w=pe.CODE_CODE_C;break;case pe.CODE_STOP:E=!0;break}break;case pe.CODE_CODE_C:if(ie<100)ie<10&&(S+="0"),S+=ie;else switch(ie!==pe.CODE_STOP&&(de=!1),ie){case pe.CODE_FNC_1:s&&(S.length===0?S+="]C1":S+="");break;case pe.CODE_CODE_A:w=pe.CODE_CODE_A;break;case pe.CODE_CODE_B:w=pe.CODE_CODE_B;break;case pe.CODE_STOP:E=!0;break}break}Dr&&(w=w===pe.CODE_CODE_A?pe.CODE_CODE_B:pe.CODE_CODE_A)}const nn=U-O;if(U=t.getNextUnset(U),!t.isRange(U,Math.min(t.getSize(),U+(U-O)/2),!1))throw new N;if(fe-=me*Y,fe%103!==Y)throw new B;const Nn=S.length;if(Nn===0)throw new N;Nn>0&&de&&(w===pe.CODE_CODE_C?S=S.substring(0,Nn-2):S=S.substring(0,Nn-1));const rn=(c[1]+c[0])/2,ut=O+nn/2,Gt=g.length,dn=new Uint8Array(Gt);for(let Dr=0;Dr<Gt;Dr++)dn[Dr]=g[Dr];const Mr=[new be(rn,e),new be(ut,e)];return new Ee(S,dn,0,Mr,ue.CODE_128,new Date().getTime())}}pe.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])],pe.MAX_AVG_VARIANCE=.25,pe.MAX_INDIVIDUAL_VARIANCE=.7,pe.CODE_SHIFT=98,pe.CODE_CODE_C=99,pe.CODE_CODE_B=100,pe.CODE_CODE_A=101,pe.CODE_FNC_1=102,pe.CODE_FNC_2=97,pe.CODE_FNC_3=96,pe.CODE_FNC_4_A=101,pe.CODE_FNC_4_B=100,pe.CODE_START_A=103,pe.CODE_START_B=104,pe.CODE_START_C=105,pe.CODE_STOP=106;class Rt extends St{constructor(e=!1,t=!1){super(),this.usingCheckDigit=e,this.extendedMode=t,this.decodeRowResult="",this.counters=new Int32Array(9)}decodeRow(e,t,n){let s=this.counters;s.fill(0),this.decodeRowResult="";let c=Rt.findAsteriskPattern(t,s),d=t.getNextSet(c[1]),h=t.getSize(),g,w;do{Rt.recordPattern(t,d,s);let z=Rt.toNarrowWidePattern(s);if(z<0)throw new N;g=Rt.patternToChar(z),this.decodeRowResult+=g,w=d;for(let Y of s)d+=Y;d=t.getNextSet(d)}while(g!=="*");this.decodeRowResult=this.decodeRowResult.substring(0,this.decodeRowResult.length-1);let E=0;for(let z of s)E+=z;let A=d-w-E;if(d!==h&&A*2<E)throw new N;if(this.usingCheckDigit){let z=this.decodeRowResult.length-1,Y=0;for(let ie=0;ie<z;ie++)Y+=Rt.ALPHABET_STRING.indexOf(this.decodeRowResult.charAt(ie));if(this.decodeRowResult.charAt(z)!==Rt.ALPHABET_STRING.charAt(Y%43))throw new B;this.decodeRowResult=this.decodeRowResult.substring(0,z)}if(this.decodeRowResult.length===0)throw new N;let S;this.extendedMode?S=Rt.decodeExtended(this.decodeRowResult):S=this.decodeRowResult;let O=(c[1]+c[0])/2,U=w+E/2;return new Ee(S,null,0,[new be(O,e),new be(U,e)],ue.CODE_39,new Date().getTime())}static findAsteriskPattern(e,t){let n=e.getSize(),s=e.getNextSet(0),c=0,d=s,h=!1,g=t.length;for(let w=s;w<n;w++)if(e.get(w)!==h)t[c]++;else{if(c===g-1){if(this.toNarrowWidePattern(t)===Rt.ASTERISK_ENCODING&&e.isRange(Math.max(0,d-Math.floor((w-d)/2)),d,!1))return[d,w];d+=t[0]+t[1],t.copyWithin(0,2,2+c-1),t[c-1]=0,t[c]=0,c--}else c++;t[c]=1,h=!h}throw new N}static toNarrowWidePattern(e){let t=e.length,n=0,s;do{let c=2147483647;for(let g of e)g<c&&g>n&&(c=g);n=c,s=0;let d=0,h=0;for(let g=0;g<t;g++){let w=e[g];w>n&&(h|=1<<t-1-g,s++,d+=w)}if(s===3){for(let g=0;g<t&&s>0;g++){let w=e[g];if(w>n&&(s--,w*2>=d))return-1}return h}}while(s>3);return-1}static patternToChar(e){for(let t=0;t<Rt.CHARACTER_ENCODINGS.length;t++)if(Rt.CHARACTER_ENCODINGS[t]===e)return Rt.ALPHABET_STRING.charAt(t);if(e===Rt.ASTERISK_ENCODING)return"*";throw new N}static decodeExtended(e){let t=e.length,n="";for(let s=0;s<t;s++){let c=e.charAt(s);if(c==="+"||c==="$"||c==="%"||c==="/"){let d=e.charAt(s+1),h="\0";switch(c){case"+":if(d>="A"&&d<="Z")h=String.fromCharCode(d.charCodeAt(0)+32);else throw new V;break;case"$":if(d>="A"&&d<="Z")h=String.fromCharCode(d.charCodeAt(0)-64);else throw new V;break;case"%":if(d>="A"&&d<="E")h=String.fromCharCode(d.charCodeAt(0)-38);else if(d>="F"&&d<="J")h=String.fromCharCode(d.charCodeAt(0)-11);else if(d>="K"&&d<="O")h=String.fromCharCode(d.charCodeAt(0)+16);else if(d>="P"&&d<="T")h=String.fromCharCode(d.charCodeAt(0)+43);else if(d==="U")h="\0";else if(d==="V")h="@";else if(d==="W")h="`";else if(d==="X"||d==="Y"||d==="Z")h="";else throw new V;break;case"/":if(d>="A"&&d<="O")h=String.fromCharCode(d.charCodeAt(0)-32);else if(d==="Z")h=":";else throw new V;break}n+=h,s++}else n+=c}return n}}Rt.ALPHABET_STRING="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%",Rt.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],Rt.ASTERISK_ENCODING=148;class et extends St{constructor(){super(...arguments),this.narrowLineWidth=-1}decodeRow(e,t,n){let s=this.decodeStart(t),c=this.decodeEnd(t),d=new G;et.decodeMiddle(t,s[1],c[0],d);let h=d.toString(),g=null;n!=null&&(g=n.get(Z.ALLOWED_LENGTHS)),g==null&&(g=et.DEFAULT_ALLOWED_LENGTHS);let w=h.length,E=!1,A=0;for(let U of g){if(w===U){E=!0;break}U>A&&(A=U)}if(!E&&w>A&&(E=!0),!E)throw new V;const S=[new be(s[1],e),new be(c[0],e)];return new Ee(h,null,0,S,ue.ITF,new Date().getTime())}static decodeMiddle(e,t,n,s){let c=new Int32Array(10),d=new Int32Array(5),h=new Int32Array(5);for(c.fill(0),d.fill(0),h.fill(0);t<n;){St.recordPattern(e,t,c);for(let w=0;w<5;w++){let E=2*w;d[w]=c[E],h[w]=c[E+1]}let g=et.decodeDigit(d);s.append(g.toString()),g=this.decodeDigit(h),s.append(g.toString()),c.forEach(function(w){t+=w})}}decodeStart(e){let t=et.skipWhiteSpace(e),n=et.findGuardPattern(e,t,et.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 s=t-1;n>0&&s>=0&&!e.get(s);s--)n--;if(n!==0)throw new N}static skipWhiteSpace(e){const t=e.getSize(),n=e.getNextSet(0);if(n===t)throw new N;return n}decodeEnd(e){e.reverse();try{let t=et.skipWhiteSpace(e),n;try{n=et.findGuardPattern(e,t,et.END_PATTERN_REVERSED[0])}catch(c){c instanceof N&&(n=et.findGuardPattern(e,t,et.END_PATTERN_REVERSED[1]))}this.validateQuietZone(e,n[0]);let s=n[0];return n[0]=e.getSize()-n[1],n[1]=e.getSize()-s,n}finally{e.reverse()}}static findGuardPattern(e,t,n){let s=n.length,c=new Int32Array(s),d=e.getSize(),h=!1,g=0,w=t;c.fill(0);for(let E=t;E<d;E++)if(e.get(E)!==h)c[g]++;else{if(g===s-1){if(St.patternMatchVariance(c,n,et.MAX_INDIVIDUAL_VARIANCE)<et.MAX_AVG_VARIANCE)return[w,E];w+=c[0]+c[1],D.arraycopy(c,2,c,0,g-1),c[g-1]=0,c[g]=0,g--}else g++;c[g]=1,h=!h}throw new N}static decodeDigit(e){let t=et.MAX_AVG_VARIANCE,n=-1,s=et.PATTERNS.length;for(let c=0;c<s;c++){let d=et.PATTERNS[c],h=St.patternMatchVariance(e,d,et.MAX_INDIVIDUAL_VARIANCE);h<t?(t=h,n=c):h===t&&(n=-1)}if(n>=0)return n%10;throw new N}}et.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])],et.MAX_AVG_VARIANCE=.38,et.MAX_INDIVIDUAL_VARIANCE=.5,et.DEFAULT_ALLOWED_LENGTHS=[6,8,10,12,14],et.START_PATTERN=Int32Array.from([1,1,1,1]),et.END_PATTERN_REVERSED=[Int32Array.from([1,1,2]),Int32Array.from([1,1,3])];class gt extends St{constructor(){super(...arguments),this.decodeRowStringBuffer=""}static findStartGuardPattern(e){let t=!1,n,s=0,c=Int32Array.from([0,0,0]);for(;!t;){c=Int32Array.from([0,0,0]),n=gt.findGuardPattern(e,s,!1,this.START_END_PATTERN,c);let d=n[0];s=n[1];let h=d-(s-d);h>=0&&(t=e.isRange(h,d,!1))}return n}static checkChecksum(e){return gt.checkStandardUPCEANChecksum(e)}static checkStandardUPCEANChecksum(e){let t=e.length;if(t===0)return!1;let n=parseInt(e.charAt(t-1),10);return gt.getStandardUPCEANChecksum(e.substring(0,t-1))===n}static getStandardUPCEANChecksum(e){let t=e.length,n=0;for(let s=t-1;s>=0;s-=2){let c=e.charAt(s).charCodeAt(0)-48;if(c<0||c>9)throw new V;n+=c}n*=3;for(let s=t-2;s>=0;s-=2){let c=e.charAt(s).charCodeAt(0)-48;if(c<0||c>9)throw new V;n+=c}return(1e3-n)%10}static decodeEnd(e,t){return gt.findGuardPattern(e,t,!1,gt.START_END_PATTERN,new Int32Array(gt.START_END_PATTERN.length).fill(0))}static findGuardPatternWithoutCounters(e,t,n,s){return this.findGuardPattern(e,t,n,s,new Int32Array(s.length))}static findGuardPattern(e,t,n,s,c){let d=e.getSize();t=n?e.getNextUnset(t):e.getNextSet(t);let h=0,g=t,w=s.length,E=n;for(let A=t;A<d;A++)if(e.get(A)!==E)c[h]++;else{if(h===w-1){if(St.patternMatchVariance(c,s,gt.MAX_INDIVIDUAL_VARIANCE)<gt.MAX_AVG_VARIANCE)return Int32Array.from([g,A]);g+=c[0]+c[1];let S=c.slice(2,c.length-1);for(let O=0;O<h-1;O++)c[O]=S[O];c[h-1]=0,c[h]=0,h--}else h++;c[h]=1,E=!E}throw new N}static decodeDigit(e,t,n,s){this.recordPattern(e,n,t);let c=this.MAX_AVG_VARIANCE,d=-1,h=s.length;for(let g=0;g<h;g++){let w=s[g],E=St.patternMatchVariance(t,w,gt.MAX_INDIVIDUAL_VARIANCE);E<c&&(c=E,d=g)}if(d>=0)return d;throw new N}}gt.MAX_AVG_VARIANCE=.48,gt.MAX_INDIVIDUAL_VARIANCE=.7,gt.START_END_PATTERN=Int32Array.from([1,1,1]),gt.MIDDLE_PATTERN=Int32Array.from([1,1,1,1,1]),gt.END_PATTERN=Int32Array.from([1,1,1,1,1,1]),gt.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 Sn{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 s=this.decodeRowStringBuffer,c=this.decodeMiddle(t,n,s),d=s.toString(),h=Sn.parseExtensionString(d),g=[new be((n[0]+n[1])/2,e),new be(c,e)],w=new Ee(d,null,0,g,ue.UPC_EAN_EXTENSION,new Date().getTime());return h!=null&&w.putAllMetadata(h),w}decodeMiddle(e,t,n){let s=this.decodeMiddleCounters;s[0]=0,s[1]=0,s[2]=0,s[3]=0;let c=e.getSize(),d=t[1],h=0;for(let w=0;w<5&&d<c;w++){let E=gt.decodeDigit(e,s,d,gt.L_AND_G_PATTERNS);n+=String.fromCharCode(48+E%10);for(let A of s)d+=A;E>=10&&(h|=1<<4-w),w!==4&&(d=e.getNextSet(d),d=e.getNextUnset(d))}if(n.length!==5)throw new N;let g=this.determineCheckDigit(h);if(Sn.extensionChecksum(n.toString())!==g)throw new N;return d}static extensionChecksum(e){let t=e.length,n=0;for(let s=t-2;s>=0;s-=2)n+=e.charAt(s).charCodeAt(0)-48;n*=3;for(let s=t-1;s>=0;s-=2)n+=e.charAt(s).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 N}static parseExtensionString(e){if(e.length!==5)return null;let t=Sn.parseExtension5String(e);return t==null?null:new Map([[Ae.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)),s=(n/100).toString(),c=n%100,d=c<10?"0"+c:c.toString();return t+s+"."+d}}class xe{constructor(){this.decodeMiddleCounters=Int32Array.from([0,0,0,0]),this.decodeRowStringBuffer=""}decodeRow(e,t,n){let s=this.decodeRowStringBuffer,c=this.decodeMiddle(t,n,s),d=s.toString(),h=xe.parseExtensionString(d),g=[new be((n[0]+n[1])/2,e),new be(c,e)],w=new Ee(d,null,0,g,ue.UPC_EAN_EXTENSION,new Date().getTime());return h!=null&&w.putAllMetadata(h),w}decodeMiddle(e,t,n){let s=this.decodeMiddleCounters;s[0]=0,s[1]=0,s[2]=0,s[3]=0;let c=e.getSize(),d=t[1],h=0;for(let g=0;g<2&&d<c;g++){let w=gt.decodeDigit(e,s,d,gt.L_AND_G_PATTERNS);n+=String.fromCharCode(48+w%10);for(let E of s)d+=E;w>=10&&(h|=1<<1-g),g!==1&&(d=e.getNextSet(d),d=e.getNextUnset(d))}if(n.length!==2)throw new N;if(parseInt(n.toString())%4!==h)throw new N;return d}static parseExtensionString(e){return e.length!==2?null:new Map([[Ae.ISSUE_NUMBER,parseInt(e)]])}}class ae{static decodeRow(e,t,n){let s=gt.findGuardPattern(t,n,!1,this.EXTENSION_START_PATTERN,new Int32Array(this.EXTENSION_START_PATTERN.length).fill(0));try{return new Sn().decodeRow(e,t,s)}catch{return new xe().decodeRow(e,t,s)}}}ae.EXTENSION_START_PATTERN=Int32Array.from([1,1,2]);class Ce extends gt{constructor(){super(),this.decodeRowStringBuffer="",Ce.L_AND_G_PATTERNS=Ce.L_PATTERNS.map(e=>Int32Array.from(e));for(let e=10;e<20;e++){let t=Ce.L_PATTERNS[e-10],n=new Int32Array(t.length);for(let s=0;s<t.length;s++)n[s]=t[t.length-s-1];Ce.L_AND_G_PATTERNS[e]=n}}decodeRow(e,t,n){let s=Ce.findStartGuardPattern(t),c=n==null?null:n.get(Z.NEED_RESULT_POINT_CALLBACK);if(c!=null){const de=new be((s[0]+s[1])/2,e);c.foundPossibleResultPoint(de)}let d=this.decodeMiddle(t,s,this.decodeRowStringBuffer),h=d.rowOffset,g=d.resultString;if(c!=null){const de=new be(h,e);c.foundPossibleResultPoint(de)}let w=this.decodeEnd(t,h);if(c!=null){const de=new be((w[0]+w[1])/2,e);c.foundPossibleResultPoint(de)}let E=w[1],A=E+(E-w[0]);if(A>=t.getSize()||!t.isRange(E,A,!1))throw new N;let S=g.toString();if(S.length<8)throw new V;if(!Ce.checkChecksum(S))throw new B;let O=(s[1]+s[0])/2,U=(w[1]+w[0])/2,z=this.getBarcodeFormat(),Y=[new be(O,e),new be(U,e)],ie=new Ee(S,null,0,Y,z,new Date().getTime()),fe=0;try{let de=ae.decodeRow(e,t,w[1]);ie.putMetadata(Ae.UPC_EAN_EXTENSION,de.getText()),ie.putAllMetadata(de.getResultMetadata()),ie.addResultPoints(de.getResultPoints()),fe=de.getText().length}catch{}let me=n==null?null:n.get(Z.ALLOWED_EAN_EXTENSIONS);if(me!=null){let de=!1;for(let je in me)if(fe.toString()===je){de=!0;break}if(!de)throw new N}return ie}decodeEnd(e,t){return Ce.findGuardPattern(e,t,!1,Ce.START_END_PATTERN,new Int32Array(Ce.START_END_PATTERN.length).fill(0))}static checkChecksum(e){return Ce.checkStandardUPCEANChecksum(e)}static checkStandardUPCEANChecksum(e){let t=e.length;if(t===0)return!1;let n=parseInt(e.charAt(t-1),10);return Ce.getStandardUPCEANChecksum(e.substring(0,t-1))===n}static getStandardUPCEANChecksum(e){let t=e.length,n=0;for(let s=t-1;s>=0;s-=2){let c=e.charAt(s).charCodeAt(0)-48;if(c<0||c>9)throw new V;n+=c}n*=3;for(let s=t-2;s>=0;s-=2){let c=e.charAt(s).charCodeAt(0)-48;if(c<0||c>9)throw new V;n+=c}return(1e3-n)%10}}class Ye extends Ce{constructor(){super(),this.decodeMiddleCounters=Int32Array.from([0,0,0,0])}decodeMiddle(e,t,n){let s=this.decodeMiddleCounters;s[0]=0,s[1]=0,s[2]=0,s[3]=0;let c=e.getSize(),d=t[1],h=0;for(let w=0;w<6&&d<c;w++){let E=Ce.decodeDigit(e,s,d,Ce.L_AND_G_PATTERNS);n+=String.fromCharCode(48+E%10);for(let A of s)d+=A;E>=10&&(h|=1<<5-w)}n=Ye.determineFirstDigit(n,h),d=Ce.findGuardPattern(e,d,!0,Ce.MIDDLE_PATTERN,new Int32Array(Ce.MIDDLE_PATTERN.length).fill(0))[1];for(let w=0;w<6&&d<c;w++){let E=Ce.decodeDigit(e,s,d,Ce.L_PATTERNS);n+=String.fromCharCode(48+E);for(let A of s)d+=A}return{rowOffset:d,resultString:n}}getBarcodeFormat(){return ue.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 N}}Ye.FIRST_DIGIT_ENCODINGS=[0,11,13,14,19,25,28,21,22,26];class hn extends Ce{constructor(){super(),this.decodeMiddleCounters=Int32Array.from([0,0,0,0])}decodeMiddle(e,t,n){const s=this.decodeMiddleCounters;s[0]=0,s[1]=0,s[2]=0,s[3]=0;let c=e.getSize(),d=t[1];for(let g=0;g<4&&d<c;g++){let w=Ce.decodeDigit(e,s,d,Ce.L_PATTERNS);n+=String.fromCharCode(48+w);for(let E of s)d+=E}d=Ce.findGuardPattern(e,d,!0,Ce.MIDDLE_PATTERN,new Int32Array(Ce.MIDDLE_PATTERN.length).fill(0))[1];for(let g=0;g<4&&d<c;g++){let w=Ce.decodeDigit(e,s,d,Ce.L_PATTERNS);n+=String.fromCharCode(48+w);for(let E of s)d+=E}return{rowOffset:d,resultString:n}}getBarcodeFormat(){return ue.EAN_8}}class In extends Ce{constructor(){super(...arguments),this.ean13Reader=new Ye}getBarcodeFormat(){return ue.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 Ee(t.substring(1),null,null,e.getResultPoints(),ue.UPC_A);return e.getResultMetadata()!=null&&n.putAllMetadata(e.getResultMetadata()),n}else throw new N}reset(){this.ean13Reader.reset()}}class $e extends Ce{constructor(){super(),this.decodeMiddleCounters=new Int32Array(4)}decodeMiddle(e,t,n){const s=this.decodeMiddleCounters.map(w=>w);s[0]=0,s[1]=0,s[2]=0,s[3]=0;const c=e.getSize();let d=t[1],h=0;for(let w=0;w<6&&d<c;w++){const E=$e.decodeDigit(e,s,d,$e.L_AND_G_PATTERNS);n+=String.fromCharCode(48+E%10);for(let A of s)d+=A;E>=10&&(h|=1<<5-w)}let g=$e.determineNumSysAndCheckDigit(n,h);return{rowOffset:d,resultString:g}}decodeEnd(e,t){return $e.findGuardPatternWithoutCounters(e,t,!0,$e.MIDDLE_END_PATTERN)}checkChecksum(e){return Ce.checkChecksum($e.convertUPCEtoUPCA(e))}static determineNumSysAndCheckDigit(e,t){for(let n=0;n<=1;n++)for(let s=0;s<10;s++)if(t===this.NUMSYS_AND_CHECK_DIGIT_PATTERNS[n][s]){let c=String.fromCharCode(48+n),d=String.fromCharCode(48+s);return c+e+d}throw N.getNotFoundInstance()}getBarcodeFormat(){return ue.UPC_E}static convertUPCEtoUPCA(e){const t=e.slice(1,7).split("").map(c=>c.charCodeAt(0)),n=new G;n.append(e.charAt(0));let s=t[5];switch(s){case 0:case 1:case 2:n.appendChars(t,0,2),n.append(s),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(s);break}return e.length>=8&&n.append(e.charAt(7)),n.toString()}}$e.MIDDLE_END_PATTERN=Int32Array.from([1,1,1,1,1,1]),$e.NUMSYS_AND_CHECK_DIGIT_PATTERNS=[Int32Array.from([56,52,50,49,44,38,35,42,41,37]),Int32Array.from([7,11,13,14,19,25,28,21,22,26])];class Xe extends St{constructor(e){super();let t=e==null?null:e.get(Z.POSSIBLE_FORMATS),n=[];o(t)?(n.push(new Ye),n.push(new In),n.push(new hn),n.push(new $e)):(t.indexOf(ue.EAN_13)>-1&&n.push(new Ye),t.indexOf(ue.UPC_A)>-1&&n.push(new In),t.indexOf(ue.EAN_8)>-1&&n.push(new hn),t.indexOf(ue.UPC_E)>-1&&n.push(new $e)),this.readers=n}decodeRow(e,t,n){for(let s of this.readers)try{const c=s.decodeRow(e,t,n),d=c.getBarcodeFormat()===ue.EAN_13&&c.getText().charAt(0)==="0",h=n==null?null:n.get(Z.POSSIBLE_FORMATS),g=h==null||h.includes(ue.UPC_A);if(d&&g){const w=c.getRawBytes(),E=new Ee(c.getText().substring(1),w,w?w.length:null,c.getResultPoints(),ue.UPC_A);return E.putAllMetadata(c.getResultMetadata()),E}return c}catch{}throw new N}reset(){for(let e of this.readers)e.reset()}}class at extends St{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(St.patternMatchVariance(e,t[n],at.MAX_INDIVIDUAL_VARIANCE)<at.MAX_AVG_VARIANCE)return n;throw new N}static count(e){return ve.sum(new Int32Array(e))}static increment(e,t){let n=0,s=t[0];for(let c=1;c<e.length;c++)t[c]>s&&(s=t[c],n=c);e[n]++}static decrement(e,t){let n=0,s=t[0];for(let c=1;c<e.length;c++)t[c]<s&&(s=t[c],n=c);e[n]--}static isFinderPattern(e){let t=e[0]+e[1],n=t+e[2]+e[3],s=t/n;if(s>=at.MIN_FINDER_PATTERN_RATIO&&s<=at.MAX_FINDER_PATTERN_RATIO){let c=Number.MAX_SAFE_INTEGER,d=Number.MIN_SAFE_INTEGER;for(let h of e)h>d&&(d=h),h<c&&(c=h);return d<10*c}return!1}}at.MAX_AVG_VARIANCE=.2,at.MAX_INDIVIDUAL_VARIANCE=.45,at.MIN_FINDER_PATTERN_RATIO=9.5/12,at.MAX_FINDER_PATTERN_RATIO=12.5/14;class Et{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 Et))return!1;const t=e;return this.value===t.value&&this.checksumPortion===t.checksumPortion}hashCode(){return this.value^this.checksumPortion}}class It{constructor(e,t,n,s,c){this.value=e,this.startEnd=t,this.value=e,this.startEnd=t,this.resultPoints=new Array,this.resultPoints.push(new be(n,c)),this.resultPoints.push(new be(s,c))}getValue(){return this.value}getStartEnd(){return this.startEnd}getResultPoints(){return this.resultPoints}equals(e){if(!(e instanceof It))return!1;const t=e;return this.value===t.value}hashCode(){return this.value}}class lt{constructor(){}static getRSSvalue(e,t,n){let s=0;for(let g of e)s+=g;let c=0,d=0,h=e.length;for(let g=0;g<h-1;g++){let w;for(w=1,d|=1<<g;w<e[g];w++,d&=~(1<<g)){let E=lt.combins(s-w-1,h-g-2);if(n&&d===0&&s-w-(h-g-1)>=h-g-1&&(E-=lt.combins(s-w-(h-g),h-g-2)),h-g-1>1){let A=0;for(let S=s-w-(h-g-2);S>t;S--)A+=lt.combins(s-w-S-1,h-g-3);E-=A*(h-1-g)}else s-w>t&&E--;c+=E}s-=w}return c}static combins(e,t){let n,s;e-t>t?(s=t,n=e-t):(s=e-t,n=t);let c=1,d=1;for(let h=e;h>n;h--)c*=h,d<=s&&(c/=d,d++);for(;d<=s;)c/=d,d++;return c}}class Xt{static buildBitArray(e){let t=e.length*2-1;e[e.length-1].getRightChar()==null&&(t-=1);let n=12*t,s=new j(n),c=0,h=e[0].getRightChar().getValue();for(let g=11;g>=0;--g)h&1<<g&&s.set(c),c++;for(let g=1;g<e.length;++g){let w=e[g],E=w.getLeftChar().getValue();for(let A=11;A>=0;--A)E&1<<A&&s.set(c),c++;if(w.getRightChar()!=null){let A=w.getRightChar().getValue();for(let S=11;S>=0;--S)A&1<<S&&s.set(c),c++}}return s}}class De{constructor(e,t){t?this.decodedInformation=null:(this.finished=e,this.decodedInformation=t)}getDecodedInformation(){return this.decodedInformation}isFinished(){return this.finished}}class Hn{constructor(e){this.newPosition=e}getNewPosition(){return this.newPosition}}class Dt extends Hn{constructor(e,t){super(e),this.value=t}getValue(){return this.value}isFNC1(){return this.value===Dt.FNC1}}Dt.FNC1="$";class jn extends Hn{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 mn extends Hn{constructor(e,t,n){if(super(e),t<0||t>10||n<0||n>10)throw new V;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===mn.FNC1}isSecondDigitFNC1(){return this.secondDigit===mn.FNC1}isAnyFNC1(){return this.firstDigit===mn.FNC1||this.secondDigit===mn.FNC1}}mn.FNC1=10;class ye{constructor(){}static parseFieldsInGeneralPurpose(e){if(!e)return null;if(e.length<2)throw new N;let t=e.substring(0,2);for(let c of ye.TWO_DIGIT_DATA_LENGTH)if(c[0]===t)return c[1]===ye.VARIABLE_LENGTH?ye.processVariableAI(2,c[2],e):ye.processFixedAI(2,c[1],e);if(e.length<3)throw new N;let n=e.substring(0,3);for(let c of ye.THREE_DIGIT_DATA_LENGTH)if(c[0]===n)return c[1]===ye.VARIABLE_LENGTH?ye.processVariableAI(3,c[2],e):ye.processFixedAI(3,c[1],e);for(let c of ye.THREE_DIGIT_PLUS_DIGIT_DATA_LENGTH)if(c[0]===n)return c[1]===ye.VARIABLE_LENGTH?ye.processVariableAI(4,c[2],e):ye.processFixedAI(4,c[1],e);if(e.length<4)throw new N;let s=e.substring(0,4);for(let c of ye.FOUR_DIGIT_DATA_LENGTH)if(c[0]===s)return c[1]===ye.VARIABLE_LENGTH?ye.processVariableAI(4,c[2],e):ye.processFixedAI(4,c[1],e);throw new N}static processFixedAI(e,t,n){if(n.length<e)throw new N;let s=n.substring(0,e);if(n.length<e+t)throw new N;let c=n.substring(e,e+t),d=n.substring(e+t),h="("+s+")"+c,g=ye.parseFieldsInGeneralPurpose(d);return g==null?h:h+g}static processVariableAI(e,t,n){let s=n.substring(0,e),c;n.length<e+t?c=n.length:c=e+t;let d=n.substring(e,c),h=n.substring(c),g="("+s+")"+d,w=ye.parseFieldsInGeneralPurpose(h);return w==null?g:g+w}}ye.VARIABLE_LENGTH=[],ye.TWO_DIGIT_DATA_LENGTH=[["00",18],["01",14],["02",14],["10",ye.VARIABLE_LENGTH,20],["11",6],["12",6],["13",6],["15",6],["17",6],["20",2],["21",ye.VARIABLE_LENGTH,20],["22",ye.VARIABLE_LENGTH,29],["30",ye.VARIABLE_LENGTH,8],["37",ye.VARIABLE_LENGTH,8],["90",ye.VARIABLE_LENGTH,30],["91",ye.VARIABLE_LENGTH,30],["92",ye.VARIABLE_LENGTH,30],["93",ye.VARIABLE_LENGTH,30],["94",ye.VARIABLE_LENGTH,30],["95",ye.VARIABLE_LENGTH,30],["96",ye.VARIABLE_LENGTH,30],["97",ye.VARIABLE_LENGTH,3],["98",ye.VARIABLE_LENGTH,30],["99",ye.VARIABLE_LENGTH,30]],ye.THREE_DIGIT_DATA_LENGTH=[["240",ye.VARIABLE_LENGTH,30],["241",ye.VARIABLE_LENGTH,30],["242",ye.VARIABLE_LENGTH,6],["250",ye.VARIABLE_LENGTH,30],["251",ye.VARIABLE_LENGTH,30],["253",ye.VARIABLE_LENGTH,17],["254",ye.VARIABLE_LENGTH,20],["400",ye.VARIABLE_LENGTH,30],["401",ye.VARIABLE_LENGTH,30],["402",17],["403",ye.VARIABLE_LENGTH,30],["410",13],["411",13],["412",13],["413",13],["414",13],["420",ye.VARIABLE_LENGTH,20],["421",ye.VARIABLE_LENGTH,15],["422",3],["423",ye.VARIABLE_LENGTH,15],["424",3],["425",3],["426",3]],ye.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",ye.VARIABLE_LENGTH,15],["391",ye.VARIABLE_LENGTH,18],["392",ye.VARIABLE_LENGTH,15],["393",ye.VARIABLE_LENGTH,18],["703",ye.VARIABLE_LENGTH,30]],ye.FOUR_DIGIT_DATA_LENGTH=[["7001",13],["7002",ye.VARIABLE_LENGTH,30],["7003",10],["8001",14],["8002",ye.VARIABLE_LENGTH,20],["8003",ye.VARIABLE_LENGTH,30],["8004",ye.VARIABLE_LENGTH,30],["8005",6],["8006",18],["8007",ye.VARIABLE_LENGTH,30],["8008",ye.VARIABLE_LENGTH,12],["8018",18],["8020",ye.VARIABLE_LENGTH,25],["8100",6],["8101",10],["8102",2],["8110",ye.VARIABLE_LENGTH,70],["8200",ye.VARIABLE_LENGTH,70]];class Nr{constructor(e){this.buffer=new G,this.information=e}decodeAllCodes(e,t){let n=t,s=null;do{let c=this.decodeGeneralPurposeField(n,s),d=ye.parseFieldsInGeneralPurpose(c.getNewString());if(d!=null&&e.append(d),c.isRemaining()?s=""+c.getRemainingValue():s=null,n===c.getNewPosition())break;n=c.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 c=this.extractNumericValueFromBitArray(e,4);return c===0?new mn(this.information.getSize(),mn.FNC1,mn.FNC1):new mn(this.information.getSize(),c-1,mn.FNC1)}let t=this.extractNumericValueFromBitArray(e,7),n=(t-8)/11,s=(t-8)%11;return new mn(e+7,n,s)}extractNumericValueFromBitArray(e,t){return Nr.extractNumericValueFromBitArray(this.information,e,t)}static extractNumericValueFromBitArray(e,t,n){let s=0;for(let c=0;c<n;++c)e.get(t+c)&&(s|=1<<n-c-1);return s}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 jn(this.current.getPosition(),this.buffer.toString(),n.getRemainingValue()):new jn(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 jn(this.current.getPosition(),this.buffer.toString()):t=new jn(this.current.getPosition(),this.buffer.toString(),e.getSecondDigit()),new De(!0,t)}if(this.buffer.append(e.getFirstDigit()),e.isSecondDigitFNC1()){let t=new jn(this.current.getPosition(),this.buffer.toString());return new De(!0,t)}this.buffer.append(e.getSecondDigit())}return this.isNumericToAlphaNumericLatch(this.current.getPosition())&&(this.current.setAlpha(),this.current.incrementPosition(4)),new De(!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 jn(this.current.getPosition(),this.buffer.toString());return new De(!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 De(!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 jn(this.current.getPosition(),this.buffer.toString());return new De(!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 De(!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 s=this.extractNumericValueFromBitArray(e,8);return s>=232&&s<253}decodeIsoIec646(e){let t=this.extractNumericValueFromBitArray(e,5);if(t===15)return new Dt(e+5,Dt.FNC1);if(t>=5&&t<15)return new Dt(e+5,"0"+(t-5));let n=this.extractNumericValueFromBitArray(e,7);if(n>=64&&n<90)return new Dt(e+7,""+(n+1));if(n>=90&&n<116)return new Dt(e+7,""+(n+7));let s=this.extractNumericValueFromBitArray(e,8),c;switch(s){case 232:c="!";break;case 233:c='"';break;case 234:c="%";break;case 235:c="&";break;case 236:c="'";break;case 237:c="(";break;case 238:c=")";break;case 239:c="*";break;case 240:c="+";break;case 241:c=",";break;case 242:c="-";break;case 243:c=".";break;case 244:c="/";break;case 245:c=":";break;case 246:c=";";break;case 247:c="<";break;case 248:c="=";break;case 249:c=">";break;case 250:c="?";break;case 251:c="_";break;case 252:c=" ";break;default:throw new V}return new Dt(e+8,c)}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 Dt(e+5,Dt.FNC1);if(t>=5&&t<15)return new Dt(e+5,"0"+(t-5));let n=this.extractNumericValueFromBitArray(e,6);if(n>=32&&n<58)return new Dt(e+6,""+(n+33));let s;switch(n){case 58:s="*";break;case 59:s=",";break;case 60:s="-";break;case 61:s=".";break;case 62:s="/";break;default:throw new Ve("Decoding invalid alphanumeric value: "+n)}return new Dt(e+6,s)}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 Mo{constructor(e){this.information=e,this.generalDecoder=new Nr(e)}getInformation(){return this.information}getGeneralDecoder(){return this.generalDecoder}}class en extends Mo{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 s=0;s<4;++s){let c=this.getGeneralDecoder().extractNumericValueFromBitArray(t+10*s,10);c/100===0&&e.append("0"),c/10===0&&e.append("0"),e.append(c)}en.appendCheckDigit(e,n)}static appendCheckDigit(e,t){let n=0;for(let s=0;s<13;s++){let c=e.charAt(s+t).charCodeAt(0)-48;n+=s&1?c:3*c}n=10-n%10,n===10&&(n=0),e.append(n)}}en.GTIN_SIZE=40;class Tr extends en{constructor(e){super(e)}parseInformation(){let e=new G;e.append("(01)");let t=e.length(),n=this.getGeneralDecoder().extractNumericValueFromBitArray(Tr.HEADER_SIZE,4);return e.append(n),this.encodeCompressedGtinWithoutAI(e,Tr.HEADER_SIZE+4,t),this.getGeneralDecoder().decodeAllCodes(e,Tr.HEADER_SIZE+44)}}Tr.HEADER_SIZE=4;class Oi extends Mo{constructor(e){super(e)}parseInformation(){let e=new G;return this.getGeneralDecoder().decodeAllCodes(e,Oi.HEADER_SIZE)}}Oi.HEADER_SIZE=5;class Mi extends en{constructor(e){super(e)}encodeCompressedWeight(e,t,n){let s=this.getGeneralDecoder().extractNumericValueFromBitArray(t,n);this.addWeightCode(e,s);let c=this.checkWeight(s),d=1e5;for(let h=0;h<5;++h)c/d===0&&e.append("0"),d/=10;e.append(c)}}class On extends Mi{constructor(e){super(e)}parseInformation(){if(this.getInformation().getSize()!=On.HEADER_SIZE+Mi.GTIN_SIZE+On.WEIGHT_SIZE)throw new N;let e=new G;return this.encodeCompressedGtin(e,On.HEADER_SIZE),this.encodeCompressedWeight(e,On.HEADER_SIZE+Mi.GTIN_SIZE,On.WEIGHT_SIZE),e.toString()}}On.HEADER_SIZE=5,On.WEIGHT_SIZE=15;class bg extends On{constructor(e){super(e)}addWeightCode(e,t){e.append("(3103)")}checkWeight(e){return e}}class Ag extends On{constructor(e){super(e)}addWeightCode(e,t){t<1e4?e.append("(3202)"):e.append("(3203)")}checkWeight(e){return e<1e4?e:e-1e4}}class Mn extends en{constructor(e){super(e)}parseInformation(){if(this.getInformation().getSize()<Mn.HEADER_SIZE+en.GTIN_SIZE)throw new N;let e=new G;this.encodeCompressedGtin(e,Mn.HEADER_SIZE);let t=this.getGeneralDecoder().extractNumericValueFromBitArray(Mn.HEADER_SIZE+en.GTIN_SIZE,Mn.LAST_DIGIT_SIZE);e.append("(392"),e.append(t),e.append(")");let n=this.getGeneralDecoder().decodeGeneralPurposeField(Mn.HEADER_SIZE+en.GTIN_SIZE+Mn.LAST_DIGIT_SIZE,null);return e.append(n.getNewString()),e.toString()}}Mn.HEADER_SIZE=8,Mn.LAST_DIGIT_SIZE=2;class qt extends en{constructor(e){super(e)}parseInformation(){if(this.getInformation().getSize()<qt.HEADER_SIZE+en.GTIN_SIZE)throw new N;let e=new G;this.encodeCompressedGtin(e,qt.HEADER_SIZE);let t=this.getGeneralDecoder().extractNumericValueFromBitArray(qt.HEADER_SIZE+en.GTIN_SIZE,qt.LAST_DIGIT_SIZE);e.append("(393"),e.append(t),e.append(")");let n=this.getGeneralDecoder().extractNumericValueFromBitArray(qt.HEADER_SIZE+en.GTIN_SIZE+qt.LAST_DIGIT_SIZE,qt.FIRST_THREE_DIGITS_SIZE);n/100==0&&e.append("0"),n/10==0&&e.append("0"),e.append(n);let s=this.getGeneralDecoder().decodeGeneralPurposeField(qt.HEADER_SIZE+en.GTIN_SIZE+qt.LAST_DIGIT_SIZE+qt.FIRST_THREE_DIGITS_SIZE,null);return e.append(s.getNewString()),e.toString()}}qt.HEADER_SIZE=8,qt.LAST_DIGIT_SIZE=2,qt.FIRST_THREE_DIGITS_SIZE=10;class wt extends Mi{constructor(e,t,n){super(e),this.dateCode=n,this.firstAIdigits=t}parseInformation(){if(this.getInformation().getSize()!=wt.HEADER_SIZE+wt.GTIN_SIZE+wt.WEIGHT_SIZE+wt.DATE_SIZE)throw new N;let e=new G;return this.encodeCompressedGtin(e,wt.HEADER_SIZE),this.encodeCompressedWeight(e,wt.HEADER_SIZE+wt.GTIN_SIZE,wt.WEIGHT_SIZE),this.encodeCompressedDate(e,wt.HEADER_SIZE+wt.GTIN_SIZE+wt.WEIGHT_SIZE),e.toString()}encodeCompressedDate(e,t){let n=this.getGeneralDecoder().extractNumericValueFromBitArray(t,wt.DATE_SIZE);if(n==38400)return;e.append("("),e.append(this.dateCode),e.append(")");let s=n%32;n/=32;let c=n%12+1;n/=12;let d=n;d/10==0&&e.append("0"),e.append(d),c/10==0&&e.append("0"),e.append(c),s/10==0&&e.append("0"),e.append(s)}addWeightCode(e,t){e.append("("),e.append(this.firstAIdigits),e.append(t/1e5),e.append(")")}checkWeight(e){return e%1e5}}wt.HEADER_SIZE=8,wt.WEIGHT_SIZE=20,wt.DATE_SIZE=16;function ja(b){try{if(b.get(1))return new Tr(b);if(!b.get(2))return new Oi(b);switch(Nr.extractNumericValueFromBitArray(b,1,4)){case 4:return new bg(b);case 5:return new Ag(b)}switch(Nr.extractNumericValueFromBitArray(b,1,5)){case 12:return new Mn(b);case 13:return new qt(b)}switch(Nr.extractNumericValueFromBitArray(b,1,7)){case 56:return new wt(b,"310","11");case 57:return new wt(b,"320","11");case 58:return new wt(b,"310","13");case 59:return new wt(b,"320","13");case 60:return new wt(b,"310","15");case 61:return new wt(b,"320","15");case 62:return new wt(b,"310","17");case 63:return new wt(b,"320","17")}}catch(e){throw console.log(e),new Ve("unknown decoder: "+b)}}class qn{constructor(e,t,n,s){this.leftchar=e,this.rightchar=t,this.finderpattern=n,this.maybeLast=s}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 qn?qn.equalsOrNull(e.leftchar,t.leftchar)&&qn.equalsOrNull(e.rightchar,t.rightchar)&&qn.equalsOrNull(e.finderpattern,t.finderpattern):!1}static equalsOrNull(e,t){return e===null?t===null:qn.equals(e,t)}hashCode(){return this.leftchar.getValue()^this.rightchar.getValue()^this.finderpattern.getValue()}}class Do{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 Do?this.checkEqualitity(e,t)&&e.wasReversed===t.wasReversed:!1}checkEqualitity(e,t){if(!e||!t)return;let n;return e.forEach((s,c)=>{t.forEach(d=>{s.getLeftChar().getValue()===d.getLeftChar().getValue()&&s.getRightChar().getValue()===d.getRightChar().getValue()&&s.getFinderPatter().getValue()===d.getFinderPatter().getValue()&&(n=!0)})}),n}}class ce extends at{constructor(e){super(...arguments),this.pairs=new Array(ce.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 ce.constructResult(this.decodeRow2pairs(e,t))}catch(s){this.verbose&&console.log(s)}return this.pairs.length=0,this.startFromEven=!0,ce.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(c){if(c instanceof N){if(!this.pairs.length)throw new N;n=!0}}if(this.checkChecksum())return this.pairs;let s;if(this.rows.length?s=!0:s=!1,this.storeRow(e,!1),s){let c=this.checkRowsBoolean(!1);if(c!=null||(c=this.checkRowsBoolean(!0),c!=null))return c}throw new N}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 s=this.rows[n];this.pairs.length=0;for(let d of e)this.pairs.push(d.getPairs());if(this.pairs.push(s.getPairs()),!ce.isValidSequence(this.pairs))continue;if(this.checkChecksum())return this.pairs;let c=new Array(e);c.push(s);try{return this.checkRows(c,n+1)}catch(d){this.verbose&&console.log(d)}}throw new N}static isValidSequence(e){for(let t of ce.FINDER_PATTERN_SEQUENCES){if(e.length>t.length)continue;let n=!0;for(let s=0;s<e.length;s++)if(e[s].getFinderPattern().getValue()!=t[s]){n=!1;break}if(n)return!0}return!1}storeRow(e,t){let n=0,s=!1,c=!1;for(;n<this.rows.length;){let d=this.rows[n];if(d.getRowNumber()>e){c=d.isEquivalent(this.pairs);break}s=d.isEquivalent(this.pairs),n++}c||s||ce.isPartialRow(this.pairs,this.rows)||(this.rows.push(n,new Do(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 s of n.getPairs())for(let c of e)if(qn.equals(s,c))break}}static isPartialRow(e,t){for(let n of t){let s=!0;for(let c of e){let d=!1;for(let h of n.getPairs())if(c.equals(h)){d=!0;break}if(!d){s=!1;break}}if(s)return!0}return!1}getRows(){return this.rows}static constructResult(e){let t=Xt.buildBitArray(e),s=ja(t).parseInformation(),c=e[0].getFinderPattern().getResultPoints(),d=e[e.length-1].getFinderPattern().getResultPoints(),h=[c[0],c[1],d[0],d[1]];return new Ee(s,null,null,h,ue.RSS_EXPANDED,null)}checkChecksum(){let e=this.pairs.get(0),t=e.getLeftChar(),n=e.getRightChar();if(n==null)return!1;let s=n.getChecksumPortion(),c=2;for(let h=1;h<this.pairs.size();++h){let g=this.pairs.get(h);s+=g.getLeftChar().getChecksumPortion(),c++;let w=g.getRightChar();w!=null&&(s+=w.getChecksumPortion(),c++)}return s%=211,211*(c-4)+s==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 s=t.length%2==0;this.startFromEven&&(s=!s);let c,d=!0,h=-1;do this.findNextPair(e,t,h),c=this.parseFoundFinderPattern(e,n,s),c==null?h=ce.getNextSecondBar(e,this.startEnd[0]):d=!1;while(d);let g=this.decodeDataCharacter(e,c,s,!0);if(!this.isEmptyPair(t)&&t[t.length-1].mustBeLast())throw new N;let w;try{w=this.decodeDataCharacter(e,c,s,!1)}catch(E){w=null,this.verbose&&console.log(E)}return new qn(g,w,c,!0)}isEmptyPair(e){return e.length===0}findNextPair(e,t,n){let s=this.getDecodeFinderCounters();s[0]=0,s[1]=0,s[2]=0,s[3]=0;let c=e.getSize(),d;n>=0?d=n:this.isEmptyPair(t)?d=0:d=t[t.length-1].getFinderPattern().getStartEnd()[1];let h=t.length%2!=0;this.startFromEven&&(h=!h);let g=!1;for(;d<c&&(g=!e.get(d),!!g);)d++;let w=0,E=d;for(let A=d;A<c;A++)if(e.get(A)!=g)s[w]++;else{if(w==3){if(h&&ce.reverseCounters(s),ce.isFinderPattern(s)){this.startEnd[0]=E,this.startEnd[1]=A;return}h&&ce.reverseCounters(s),E+=s[0]+s[1],s[0]=s[2],s[1]=s[3],s[2]=0,s[3]=0,w--}else w++;s[w]=1,g=!g}throw new N}static reverseCounters(e){let t=e.length;for(let n=0;n<t/2;++n){let s=e[n];e[n]=e[t-n-1],e[t-n-1]=s}}parseFoundFinderPattern(e,t,n){let s,c,d;if(n){let w=this.startEnd[0]-1;for(;w>=0&&!e.get(w);)w--;w++,s=this.startEnd[0]-w,c=w,d=this.startEnd[1]}else c=this.startEnd[0],d=e.getNextUnset(this.startEnd[1]+1),s=d-this.startEnd[1];let h=this.getDecodeFinderCounters();D.arraycopy(h,0,h,1,h.length-1),h[0]=s;let g;try{g=this.parseFinderValue(h,ce.FINDER_PATTERNS)}catch{return null}return new It(g,[c,d],c,d,t)}decodeDataCharacter(e,t,n,s){let c=this.getDataCharacterCounters();for(let ut=0;ut<c.length;ut++)c[ut]=0;if(s)ce.recordPatternInReverse(e,t.getStartEnd()[0],c);else{ce.recordPattern(e,t.getStartEnd()[1],c);for(let ut=0,Gt=c.length-1;ut<Gt;ut++,Gt--){let dn=c[ut];c[ut]=c[Gt],c[Gt]=dn}}let d=17,h=ve.sum(new Int32Array(c))/d,g=(t.getStartEnd()[1]-t.getStartEnd()[0])/15;if(Math.abs(h-g)/g>.3)throw new N;let w=this.getOddCounts(),E=this.getEvenCounts(),A=this.getOddRoundingErrors(),S=this.getEvenRoundingErrors();for(let ut=0;ut<c.length;ut++){let Gt=1*c[ut]/h,dn=Gt+.5;if(dn<1){if(Gt<.3)throw new N;dn=1}else if(dn>8){if(Gt>8.7)throw new N;dn=8}let Mr=ut/2;ut&1?(E[Mr]=dn,S[Mr]=Gt-dn):(w[Mr]=dn,A[Mr]=Gt-dn)}this.adjustOddEvenCounts(d);let O=4*t.getValue()+(n?0:2)+(s?0:1)-1,U=0,z=0;for(let ut=w.length-1;ut>=0;ut--){if(ce.isNotA1left(t,n,s)){let Gt=ce.WEIGHTS[O][2*ut];z+=w[ut]*Gt}U+=w[ut]}let Y=0;for(let ut=E.length-1;ut>=0;ut--)if(ce.isNotA1left(t,n,s)){let Gt=ce.WEIGHTS[O][2*ut+1];Y+=E[ut]*Gt}let ie=z+Y;if(U&1||U>13||U<4)throw new N;let fe=(13-U)/2,me=ce.SYMBOL_WIDEST[fe],de=9-me,je=lt.getRSSvalue(w,me,!0),Le=lt.getRSSvalue(E,de,!1),nn=ce.EVEN_TOTAL_SUBSET[fe],Nn=ce.GSUM[fe],rn=je*nn+Le+Nn;return new Et(rn,ie)}static isNotA1left(e,t,n){return!(e.getValue()==0&&t&&n)}adjustOddEvenCounts(e){let t=ve.sum(new Int32Array(this.getOddCounts())),n=ve.sum(new Int32Array(this.getEvenCounts())),s=!1,c=!1;t>13?c=!0:t<4&&(s=!0);let d=!1,h=!1;n>13?h=!0:n<4&&(d=!0);let g=t+n-e,w=(t&1)==1,E=(n&1)==0;if(g==1)if(w){if(E)throw new N;c=!0}else{if(!E)throw new N;h=!0}else if(g==-1)if(w){if(E)throw new N;s=!0}else{if(!E)throw new N;d=!0}else if(g==0){if(w){if(!E)throw new N;t<n?(s=!0,h=!0):(c=!0,d=!0)}else if(E)throw new N}else throw new N;if(s){if(c)throw new N;ce.increment(this.getOddCounts(),this.getOddRoundingErrors())}if(c&&ce.decrement(this.getOddCounts(),this.getOddRoundingErrors()),d){if(h)throw new N;ce.increment(this.getEvenCounts(),this.getOddRoundingErrors())}h&&ce.decrement(this.getEvenCounts(),this.getEvenRoundingErrors())}}ce.SYMBOL_WIDEST=[7,5,4,3,1],ce.EVEN_TOTAL_SUBSET=[4,20,52,104,204],ce.GSUM=[0,348,1388,2948,3988],ce.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])],ce.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]],ce.FINDER_PAT_A=0,ce.FINDER_PAT_B=1,ce.FINDER_PAT_C=2,ce.FINDER_PAT_D=3,ce.FINDER_PAT_E=4,ce.FINDER_PAT_F=5,ce.FINDER_PATTERN_SEQUENCES=[[ce.FINDER_PAT_A,ce.FINDER_PAT_A],[ce.FINDER_PAT_A,ce.FINDER_PAT_B,ce.FINDER_PAT_B],[ce.FINDER_PAT_A,ce.FINDER_PAT_C,ce.FINDER_PAT_B,ce.FINDER_PAT_D],[ce.FINDER_PAT_A,ce.FINDER_PAT_E,ce.FINDER_PAT_B,ce.FINDER_PAT_D,ce.FINDER_PAT_C],[ce.FINDER_PAT_A,ce.FINDER_PAT_E,ce.FINDER_PAT_B,ce.FINDER_PAT_D,ce.FINDER_PAT_D,ce.FINDER_PAT_F],[ce.FINDER_PAT_A,ce.FINDER_PAT_E,ce.FINDER_PAT_B,ce.FINDER_PAT_D,ce.FINDER_PAT_E,ce.FINDER_PAT_F,ce.FINDER_PAT_F],[ce.FINDER_PAT_A,ce.FINDER_PAT_A,ce.FINDER_PAT_B,ce.FINDER_PAT_B,ce.FINDER_PAT_C,ce.FINDER_PAT_C,ce.FINDER_PAT_D,ce.FINDER_PAT_D],[ce.FINDER_PAT_A,ce.FINDER_PAT_A,ce.FINDER_PAT_B,ce.FINDER_PAT_B,ce.FINDER_PAT_C,ce.FINDER_PAT_C,ce.FINDER_PAT_D,ce.FINDER_PAT_E,ce.FINDER_PAT_E],[ce.FINDER_PAT_A,ce.FINDER_PAT_A,ce.FINDER_PAT_B,ce.FINDER_PAT_B,ce.FINDER_PAT_C,ce.FINDER_PAT_C,ce.FINDER_PAT_D,ce.FINDER_PAT_E,ce.FINDER_PAT_F,ce.FINDER_PAT_F],[ce.FINDER_PAT_A,ce.FINDER_PAT_A,ce.FINDER_PAT_B,ce.FINDER_PAT_B,ce.FINDER_PAT_C,ce.FINDER_PAT_D,ce.FINDER_PAT_D,ce.FINDER_PAT_E,ce.FINDER_PAT_E,ce.FINDER_PAT_F,ce.FINDER_PAT_F]],ce.MAX_PAIRS=11;class Sg extends Et{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 Nt extends at{constructor(){super(...arguments),this.possibleLeftPairs=[],this.possibleRightPairs=[]}decodeRow(e,t,n){const s=this.decodePair(t,!1,e,n);Nt.addOrTally(this.possibleLeftPairs,s),t.reverse();let c=this.decodePair(t,!0,e,n);Nt.addOrTally(this.possibleRightPairs,c),t.reverse();for(let d of this.possibleLeftPairs)if(d.getCount()>1){for(let h of this.possibleRightPairs)if(h.getCount()>1&&Nt.checkChecksum(d,h))return Nt.constructResult(d,h)}throw new N}static addOrTally(e,t){if(t==null)return;let n=!1;for(let s of e)if(s.getValue()===t.getValue()){s.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(),s=new String(n).toString(),c=new G;for(let w=13-s.length;w>0;w--)c.append("0");c.append(s);let d=0;for(let w=0;w<13;w++){let E=c.charAt(w).charCodeAt(0)-48;d+=w&1?E:3*E}d=10-d%10,d===10&&(d=0),c.append(d.toString());let h=e.getFinderPattern().getResultPoints(),g=t.getFinderPattern().getResultPoints();return new Ee(c.toString(),null,0,[h[0],h[1],g[0],g[1]],ue.RSS_14,new Date().getTime())}static checkChecksum(e,t){let n=(e.getChecksumPortion()+16*t.getChecksumPortion())%79,s=9*e.getFinderPattern().getValue()+t.getFinderPattern().getValue();return s>72&&s--,s>8&&s--,n===s}decodePair(e,t,n,s){try{let c=this.findFinderPattern(e,t),d=this.parseFoundFinderPattern(e,n,t,c),h=s==null?null:s.get(Z.NEED_RESULT_POINT_CALLBACK);if(h!=null){let E=(c[0]+c[1])/2;t&&(E=e.getSize()-1-E),h.foundPossibleResultPoint(new be(E,n))}let g=this.decodeDataCharacter(e,d,!0),w=this.decodeDataCharacter(e,d,!1);return new Sg(1597*g.getValue()+w.getValue(),g.getChecksumPortion()+4*w.getChecksumPortion(),d)}catch{return null}}decodeDataCharacter(e,t,n){let s=this.getDataCharacterCounters();for(let Y=0;Y<s.length;Y++)s[Y]=0;if(n)St.recordPatternInReverse(e,t.getStartEnd()[0],s);else{St.recordPattern(e,t.getStartEnd()[1]+1,s);for(let Y=0,ie=s.length-1;Y<ie;Y++,ie--){let fe=s[Y];s[Y]=s[ie],s[ie]=fe}}let c=n?16:15,d=ve.sum(new Int32Array(s))/c,h=this.getOddCounts(),g=this.getEvenCounts(),w=this.getOddRoundingErrors(),E=this.getEvenRoundingErrors();for(let Y=0;Y<s.length;Y++){let ie=s[Y]/d,fe=Math.floor(ie+.5);fe<1?fe=1:fe>8&&(fe=8);let me=Math.floor(Y/2);Y&1?(g[me]=fe,E[me]=ie-fe):(h[me]=fe,w[me]=ie-fe)}this.adjustOddEvenCounts(n,c);let A=0,S=0;for(let Y=h.length-1;Y>=0;Y--)S*=9,S+=h[Y],A+=h[Y];let O=0,U=0;for(let Y=g.length-1;Y>=0;Y--)O*=9,O+=g[Y],U+=g[Y];let z=S+3*O;if(n){if(A&1||A>12||A<4)throw new N;let Y=(12-A)/2,ie=Nt.OUTSIDE_ODD_WIDEST[Y],fe=9-ie,me=lt.getRSSvalue(h,ie,!1),de=lt.getRSSvalue(g,fe,!0),je=Nt.OUTSIDE_EVEN_TOTAL_SUBSET[Y],Le=Nt.OUTSIDE_GSUM[Y];return new Et(me*je+de+Le,z)}else{if(U&1||U>10||U<4)throw new N;let Y=(10-U)/2,ie=Nt.INSIDE_ODD_WIDEST[Y],fe=9-ie,me=lt.getRSSvalue(h,ie,!0),de=lt.getRSSvalue(g,fe,!1),je=Nt.INSIDE_ODD_TOTAL_SUBSET[Y],Le=Nt.INSIDE_GSUM[Y];return new Et(de*je+me+Le,z)}}findFinderPattern(e,t){let n=this.getDecodeFinderCounters();n[0]=0,n[1]=0,n[2]=0,n[3]=0;let s=e.getSize(),c=!1,d=0;for(;d<s&&(c=!e.get(d),t!==c);)d++;let h=0,g=d;for(let w=d;w<s;w++)if(e.get(w)!==c)n[h]++;else{if(h===3){if(at.isFinderPattern(n))return[g,w];g+=n[0]+n[1],n[0]=n[2],n[1]=n[3],n[2]=0,n[3]=0,h--}else h++;n[h]=1,c=!c}throw new N}parseFoundFinderPattern(e,t,n,s){let c=e.get(s[0]),d=s[0]-1;for(;d>=0&&c!==e.get(d);)d--;d++;const h=s[0]-d,g=this.getDecodeFinderCounters(),w=new Int32Array(g.length);D.arraycopy(g,0,w,1,g.length-1),w[0]=h;const E=this.parseFinderValue(w,Nt.FINDER_PATTERNS);let A=d,S=s[1];return n&&(A=e.getSize()-1-A,S=e.getSize()-1-S),new It(E,[d,s[1]],A,S,t)}adjustOddEvenCounts(e,t){let n=ve.sum(new Int32Array(this.getOddCounts())),s=ve.sum(new Int32Array(this.getEvenCounts())),c=!1,d=!1,h=!1,g=!1;e?(n>12?d=!0:n<4&&(c=!0),s>12?g=!0:s<4&&(h=!0)):(n>11?d=!0:n<5&&(c=!0),s>10?g=!0:s<4&&(h=!0));let w=n+s-t,E=(n&1)===(e?1:0),A=(s&1)===1;if(w===1)if(E){if(A)throw new N;d=!0}else{if(!A)throw new N;g=!0}else if(w===-1)if(E){if(A)throw new N;c=!0}else{if(!A)throw new N;h=!0}else if(w===0){if(E){if(!A)throw new N;n<s?(c=!0,g=!0):(d=!0,h=!0)}else if(A)throw new N}else throw new N;if(c){if(d)throw new N;at.increment(this.getOddCounts(),this.getOddRoundingErrors())}if(d&&at.decrement(this.getOddCounts(),this.getOddRoundingErrors()),h){if(g)throw new N;at.increment(this.getEvenCounts(),this.getOddRoundingErrors())}g&&at.decrement(this.getEvenCounts(),this.getEvenRoundingErrors())}}Nt.OUTSIDE_EVEN_TOTAL_SUBSET=[1,10,34,70,126],Nt.INSIDE_ODD_TOTAL_SUBSET=[4,20,48,81],Nt.OUTSIDE_GSUM=[0,161,961,2015,2715],Nt.INSIDE_GSUM=[0,336,1036,1516],Nt.OUTSIDE_ODD_WIDEST=[8,6,4,3,1],Nt.INSIDE_ODD_WIDEST=[2,4,6,8],Nt.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 kr extends St{constructor(e,t){super(),this.readers=[],this.verbose=t===!0;const n=e?e.get(Z.POSSIBLE_FORMATS):null,s=e&&e.get(Z.ASSUME_CODE_39_CHECK_DIGIT)!==void 0;n?((n.includes(ue.EAN_13)||n.includes(ue.UPC_A)||n.includes(ue.EAN_8)||n.includes(ue.UPC_E))&&this.readers.push(new Xe(e)),n.includes(ue.CODE_39)&&this.readers.push(new Rt(s)),n.includes(ue.CODE_128)&&this.readers.push(new pe),n.includes(ue.ITF)&&this.readers.push(new et),n.includes(ue.RSS_14)&&this.readers.push(new Nt),n.includes(ue.RSS_EXPANDED)&&this.readers.push(new ce(this.verbose))):(this.readers.push(new Xe(e)),this.readers.push(new Rt),this.readers.push(new Xe(e)),this.readers.push(new pe),this.readers.push(new et),this.readers.push(new Nt),this.readers.push(new ce(this.verbose)))}decodeRow(e,t,n){for(let s=0;s<this.readers.length;s++)try{return this.readers[s].decodeRow(e,t,n)}catch{}throw new N}reset(){this.readers.forEach(e=>e.reset())}}class Ig extends ge{constructor(e=500,t){super(new kr(t),e,t)}}class it{constructor(e,t,n){this.ecCodewords=e,this.ecBlocks=[t],n&&this.ecBlocks.push(n)}getECCodewords(){return this.ecCodewords}getECBlocks(){return this.ecBlocks}}class tt{constructor(e,t){this.count=e,this.dataCodewords=t}getCount(){return this.count}getDataCodewords(){return this.dataCodewords}}class qe{constructor(e,t,n,s,c,d){this.versionNumber=e,this.symbolSizeRows=t,this.symbolSizeColumns=n,this.dataRegionSizeRows=s,this.dataRegionSizeColumns=c,this.ecBlocks=d;let h=0;const g=d.getECCodewords(),w=d.getECBlocks();for(let E of w)h+=E.getCount()*(E.getDataCodewords()+g);this.totalCodewords=h}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||t&1)throw new V;for(let n of qe.VERSIONS)if(n.symbolSizeRows===e&&n.symbolSizeColumns===t)return n;throw new V}toString(){return""+this.versionNumber}static buildVersions(){return[new qe(1,10,10,8,8,new it(5,new tt(1,3))),new qe(2,12,12,10,10,new it(7,new tt(1,5))),new qe(3,14,14,12,12,new it(10,new tt(1,8))),new qe(4,16,16,14,14,new it(12,new tt(1,12))),new qe(5,18,18,16,16,new it(14,new tt(1,18))),new qe(6,20,20,18,18,new it(18,new tt(1,22))),new qe(7,22,22,20,20,new it(20,new tt(1,30))),new qe(8,24,24,22,22,new it(24,new tt(1,36))),new qe(9,26,26,24,24,new it(28,new tt(1,44))),new qe(10,32,32,14,14,new it(36,new tt(1,62))),new qe(11,36,36,16,16,new it(42,new tt(1,86))),new qe(12,40,40,18,18,new it(48,new tt(1,114))),new qe(13,44,44,20,20,new it(56,new tt(1,144))),new qe(14,48,48,22,22,new it(68,new tt(1,174))),new qe(15,52,52,24,24,new it(42,new tt(2,102))),new qe(16,64,64,14,14,new it(56,new tt(2,140))),new qe(17,72,72,16,16,new it(36,new tt(4,92))),new qe(18,80,80,18,18,new it(48,new tt(4,114))),new qe(19,88,88,20,20,new it(56,new tt(4,144))),new qe(20,96,96,22,22,new it(68,new tt(4,174))),new qe(21,104,104,24,24,new it(56,new tt(6,136))),new qe(22,120,120,18,18,new it(68,new tt(6,175))),new qe(23,132,132,20,20,new it(62,new tt(8,163))),new qe(24,144,144,22,22,new it(62,new tt(8,156),new tt(2,155))),new qe(25,8,18,6,16,new it(7,new tt(1,5))),new qe(26,8,32,6,14,new it(11,new tt(1,10))),new qe(27,12,26,10,24,new it(14,new tt(1,16))),new qe(28,12,36,10,16,new it(18,new tt(1,22))),new qe(29,16,36,14,16,new it(24,new tt(1,32))),new qe(30,16,48,14,22,new it(28,new tt(1,49)))]}}qe.VERSIONS=qe.buildVersions();class vo{constructor(e){const t=e.getHeight();if(t<8||t>144||t&1)throw new V;this.version=vo.readVersion(e),this.mappingBitMatrix=this.extractDataRegion(e),this.readMappingMatrix=new W(this.mappingBitMatrix.getWidth(),this.mappingBitMatrix.getHeight())}getVersion(){return this.version}static readVersion(e){const t=e.getHeight(),n=e.getWidth();return qe.getVersionForDimensions(t,n)}readCodewords(){const e=new Int8Array(this.version.getTotalCodewords());let t=0,n=4,s=0;const c=this.mappingBitMatrix.getHeight(),d=this.mappingBitMatrix.getWidth();let h=!1,g=!1,w=!1,E=!1;do if(n===c&&s===0&&!h)e[t++]=this.readCorner1(c,d)&255,n-=2,s+=2,h=!0;else if(n===c-2&&s===0&&d&3&&!g)e[t++]=this.readCorner2(c,d)&255,n-=2,s+=2,g=!0;else if(n===c+4&&s===2&&!(d&7)&&!w)e[t++]=this.readCorner3(c,d)&255,n-=2,s+=2,w=!0;else if(n===c-2&&s===0&&(d&7)===4&&!E)e[t++]=this.readCorner4(c,d)&255,n-=2,s+=2,E=!0;else{do n<c&&s>=0&&!this.readMappingMatrix.get(s,n)&&(e[t++]=this.readUtah(n,s,c,d)&255),n-=2,s+=2;while(n>=0&&s<d);n+=1,s+=3;do n>=0&&s<d&&!this.readMappingMatrix.get(s,n)&&(e[t++]=this.readUtah(n,s,c,d)&255),n+=2,s-=2;while(n<c&&s>=0);n+=3,s+=1}while(n<c||s<d);if(t!==this.version.getTotalCodewords())throw new V;return e}readModule(e,t,n,s){return e<0&&(e+=n,t+=4-(n+4&7)),t<0&&(t+=s,e+=4-(s+4&7)),this.readMappingMatrix.set(t,e),this.mappingBitMatrix.get(t,e)}readUtah(e,t,n,s){let c=0;return this.readModule(e-2,t-2,n,s)&&(c|=1),c<<=1,this.readModule(e-2,t-1,n,s)&&(c|=1),c<<=1,this.readModule(e-1,t-2,n,s)&&(c|=1),c<<=1,this.readModule(e-1,t-1,n,s)&&(c|=1),c<<=1,this.readModule(e-1,t,n,s)&&(c|=1),c<<=1,this.readModule(e,t-2,n,s)&&(c|=1),c<<=1,this.readModule(e,t-1,n,s)&&(c|=1),c<<=1,this.readModule(e,t,n,s)&&(c|=1),c}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 y("Dimension of bitMatrix must match the version size");const s=this.version.getDataRegionSizeRows(),c=this.version.getDataRegionSizeColumns(),d=t/s|0,h=n/c|0,g=d*s,w=h*c,E=new W(w,g);for(let A=0;A<d;++A){const S=A*s;for(let O=0;O<h;++O){const U=O*c;for(let z=0;z<s;++z){const Y=A*(s+2)+1+z,ie=S+z;for(let fe=0;fe<c;++fe){const me=O*(c+2)+1+fe;if(e.get(me,Y)){const de=U+fe;E.set(de,ie)}}}}}return E}}class Po{constructor(e,t){this.numDataCodewords=e,this.codewords=t}static getDataBlocks(e,t){const n=t.getECBlocks();let s=0;const c=n.getECBlocks();for(let z of c)s+=z.getCount();const d=new Array(s);let h=0;for(let z of c)for(let Y=0;Y<z.getCount();Y++){const ie=z.getDataCodewords(),fe=n.getECCodewords()+ie;d[h++]=new Po(ie,new Uint8Array(fe))}const w=d[0].codewords.length-n.getECCodewords(),E=w-1;let A=0;for(let z=0;z<E;z++)for(let Y=0;Y<h;Y++)d[Y].codewords[z]=e[A++];const S=t.getVersionNumber()===24,O=S?8:h;for(let z=0;z<O;z++)d[z].codewords[w-1]=e[A++];const U=d[0].codewords.length;for(let z=w;z<U;z++)for(let Y=0;Y<h;Y++){const ie=S?(Y+8)%h:Y,fe=S&&ie>7?z-1:z;d[ie].codewords[fe]=e[A++]}if(A!==e.length)throw new y;return d}getNumDataCodewords(){return this.numDataCodewords}getCodewords(){return this.codewords}}class Lo{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 y(""+e);let t=0,n=this.bitOffset,s=this.byteOffset;const c=this.bytes;if(n>0){const d=8-n,h=e<d?e:d,g=d-h,w=255>>8-h<<g;t=(c[s]&w)>>g,e-=h,n+=h,n===8&&(n=0,s++)}if(e>0){for(;e>=8;)t=t<<8|c[s]&255,s++,e-=8;if(e>0){const d=8-e,h=255>>d<<d;t=t<<e|(c[s]&h)>>d,n+=e}}return this.bitOffset=n,this.byteOffset=s,t}available(){return 8*(this.bytes.length-this.byteOffset)-this.bitOffset}}var vt;(function(b){b[b.PAD_ENCODE=0]="PAD_ENCODE",b[b.ASCII_ENCODE=1]="ASCII_ENCODE",b[b.C40_ENCODE=2]="C40_ENCODE",b[b.TEXT_ENCODE=3]="TEXT_ENCODE",b[b.ANSIX12_ENCODE=4]="ANSIX12_ENCODE",b[b.EDIFACT_ENCODE=5]="EDIFACT_ENCODE",b[b.BASE256_ENCODE=6]="BASE256_ENCODE"})(vt||(vt={}));class Zn{static decode(e){const t=new Lo(e),n=new G,s=new G,c=new Array;let d=vt.ASCII_ENCODE;do if(d===vt.ASCII_ENCODE)d=this.decodeAsciiSegment(t,n,s);else{switch(d){case vt.C40_ENCODE:this.decodeC40Segment(t,n);break;case vt.TEXT_ENCODE:this.decodeTextSegment(t,n);break;case vt.ANSIX12_ENCODE:this.decodeAnsiX12Segment(t,n);break;case vt.EDIFACT_ENCODE:this.decodeEdifactSegment(t,n);break;case vt.BASE256_ENCODE:this.decodeBase256Segment(t,n,c);break;default:throw new V}d=vt.ASCII_ENCODE}while(d!==vt.PAD_ENCODE&&t.available()>0);return s.length()>0&&n.append(s.toString()),new Ke(e,n.toString(),c.length===0?null:c,null)}static decodeAsciiSegment(e,t,n){let s=!1;do{let c=e.readBits(8);if(c===0)throw new V;if(c<=128)return s&&(c+=128),t.append(String.fromCharCode(c-1)),vt.ASCII_ENCODE;if(c===129)return vt.PAD_ENCODE;if(c<=229){const d=c-130;d<10&&t.append("0"),t.append(""+d)}else switch(c){case 230:return vt.C40_ENCODE;case 231:return vt.BASE256_ENCODE;case 232:t.append("");break;case 233:case 234:break;case 235:s=!0;break;case 236:t.append("[)>05"),n.insert(0,"");break;case 237:t.append("[)>06"),n.insert(0,"");break;case 238:return vt.ANSIX12_ENCODE;case 239:return vt.TEXT_ENCODE;case 240:return vt.EDIFACT_ENCODE;case 241:break;default:if(c!==254||e.available()!==0)throw new V;break}}while(e.available()>0);return vt.ASCII_ENCODE}static decodeC40Segment(e,t){let n=!1;const s=[];let c=0;do{if(e.available()===8)return;const d=e.readBits(8);if(d===254)return;this.parseTwoBytes(d,e.readBits(8),s);for(let h=0;h<3;h++){const g=s[h];switch(c){case 0:if(g<3)c=g+1;else if(g<this.C40_BASIC_SET_CHARS.length){const w=this.C40_BASIC_SET_CHARS[g];n?(t.append(String.fromCharCode(w.charCodeAt(0)+128)),n=!1):t.append(w)}else throw new V;break;case 1:n?(t.append(String.fromCharCode(g+128)),n=!1):t.append(String.fromCharCode(g)),c=0;break;case 2:if(g<this.C40_SHIFT2_SET_CHARS.length){const w=this.C40_SHIFT2_SET_CHARS[g];n?(t.append(String.fromCharCode(w.charCodeAt(0)+128)),n=!1):t.append(w)}else switch(g){case 27:t.append("");break;case 30:n=!0;break;default:throw new V}c=0;break;case 3:n?(t.append(String.fromCharCode(g+224)),n=!1):t.append(String.fromCharCode(g+96)),c=0;break;default:throw new V}}}while(e.available()>0)}static decodeTextSegment(e,t){let n=!1,s=[],c=0;do{if(e.available()===8)return;const d=e.readBits(8);if(d===254)return;this.parseTwoBytes(d,e.readBits(8),s);for(let h=0;h<3;h++){const g=s[h];switch(c){case 0:if(g<3)c=g+1;else if(g<this.TEXT_BASIC_SET_CHARS.length){const w=this.TEXT_BASIC_SET_CHARS[g];n?(t.append(String.fromCharCode(w.charCodeAt(0)+128)),n=!1):t.append(w)}else throw new V;break;case 1:n?(t.append(String.fromCharCode(g+128)),n=!1):t.append(String.fromCharCode(g)),c=0;break;case 2:if(g<this.TEXT_SHIFT2_SET_CHARS.length){const w=this.TEXT_SHIFT2_SET_CHARS[g];n?(t.append(String.fromCharCode(w.charCodeAt(0)+128)),n=!1):t.append(w)}else switch(g){case 27:t.append("");break;case 30:n=!0;break;default:throw new V}c=0;break;case 3:if(g<this.TEXT_SHIFT3_SET_CHARS.length){const w=this.TEXT_SHIFT3_SET_CHARS[g];n?(t.append(String.fromCharCode(w.charCodeAt(0)+128)),n=!1):t.append(w),c=0}else throw new V;break;default:throw new V}}}while(e.available()>0)}static decodeAnsiX12Segment(e,t){const n=[];do{if(e.available()===8)return;const s=e.readBits(8);if(s===254)return;this.parseTwoBytes(s,e.readBits(8),n);for(let c=0;c<3;c++){const d=n[c];switch(d){case 0:t.append("\r");break;case 1:t.append("*");break;case 2:t.append(">");break;case 3:t.append(" ");break;default:if(d<14)t.append(String.fromCharCode(d+44));else if(d<40)t.append(String.fromCharCode(d+51));else throw new V;break}}}while(e.available()>0)}static parseTwoBytes(e,t,n){let s=(e<<8)+t-1,c=Math.floor(s/1600);n[0]=c,s-=c*1600,c=Math.floor(s/40),n[1]=c,n[2]=s-c*40}static decodeEdifactSegment(e,t){do{if(e.available()<=16)return;for(let n=0;n<4;n++){let s=e.readBits(6);if(s===31){const c=8-e.getBitOffset();c!==8&&e.readBits(c);return}s&32||(s|=64),t.append(String.fromCharCode(s))}}while(e.available()>0)}static decodeBase256Segment(e,t,n){let s=1+e.getByteOffset();const c=this.unrandomize255State(e.readBits(8),s++);let d;if(c===0?d=e.available()/8|0:c<250?d=c:d=250*(c-249)+this.unrandomize255State(e.readBits(8),s++),d<0)throw new V;const h=new Uint8Array(d);for(let g=0;g<d;g++){if(e.available()<8)throw new V;h[g]=this.unrandomize255State(e.readBits(8),s++)}n.push(h);try{t.append(K.decode(h,ee.ISO88591))}catch(g){throw new Ve("Platform does not support required encoding: "+g.message)}}static unrandomize255State(e,t){const n=149*t%255+1,s=e-n;return s>=0?s:s+256}}Zn.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"],Zn.C40_SHIFT2_SET_CHARS=["!",'"',"#","$","%","&","'","(",")","*","+",",","-",".","/",":",";","<","=",">","?","@","[","\\","]","^","_"],Zn.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"],Zn.TEXT_SHIFT2_SET_CHARS=Zn.C40_SHIFT2_SET_CHARS,Zn.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 Ng{constructor(){this.rsDecoder=new kt(Te.DATA_MATRIX_FIELD_256)}decode(e){const t=new vo(e),n=t.getVersion(),s=t.readCodewords(),c=Po.getDataBlocks(s,n);let d=0;for(let w of c)d+=w.getNumDataCodewords();const h=new Uint8Array(d),g=c.length;for(let w=0;w<g;w++){const E=c[w],A=E.getCodewords(),S=E.getNumDataCodewords();this.correctErrors(A,S);for(let O=0;O<S;O++)h[O*g+w]=A[O]}return Zn.decode(h)}correctErrors(e,t){const n=new Int32Array(e);try{this.rsDecoder.decode(n,e.length-t)}catch{throw new B}for(let s=0;s<t;s++)e[s]=n[s]}}class Bt{constructor(e){this.image=e,this.rectangleDetector=new fn(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 N;t=this.shiftToModuleCenter(t);const n=t[0],s=t[1],c=t[2],d=t[3];let h=this.transitionsBetween(n,d)+1,g=this.transitionsBetween(c,d)+1;(h&1)===1&&(h+=1),(g&1)===1&&(g+=1),4*h<7*g&&4*g<7*h&&(h=g=Math.max(h,g));let w=Bt.sampleGrid(this.image,n,s,c,d,h,g);return new $n(w,[n,s,c,d])}static shiftPoint(e,t,n){let s=(t.getX()-e.getX())/(n+1),c=(t.getY()-e.getY())/(n+1);return new be(e.getX()+s,e.getY()+c)}static moveAway(e,t,n){let s=e.getX(),c=e.getY();return s<t?s-=1:s+=1,c<n?c-=1:c+=1,new be(s,c)}detectSolid1(e){let t=e[0],n=e[1],s=e[3],c=e[2],d=this.transitionsBetween(t,n),h=this.transitionsBetween(n,s),g=this.transitionsBetween(s,c),w=this.transitionsBetween(c,t),E=d,A=[c,t,n,s];return E>h&&(E=h,A[0]=t,A[1]=n,A[2]=s,A[3]=c),E>g&&(E=g,A[0]=n,A[1]=s,A[2]=c,A[3]=t),E>w&&(A[0]=s,A[1]=c,A[2]=t,A[3]=n),A}detectSolid2(e){let t=e[0],n=e[1],s=e[2],c=e[3],d=this.transitionsBetween(t,c),h=Bt.shiftPoint(n,s,(d+1)*4),g=Bt.shiftPoint(s,n,(d+1)*4),w=this.transitionsBetween(h,t),E=this.transitionsBetween(g,c);return w<E?(e[0]=t,e[1]=n,e[2]=s,e[3]=c):(e[0]=n,e[1]=s,e[2]=c,e[3]=t),e}correctTopRight(e){let t=e[0],n=e[1],s=e[2],c=e[3],d=this.transitionsBetween(t,c),h=this.transitionsBetween(n,c),g=Bt.shiftPoint(t,n,(h+1)*4),w=Bt.shiftPoint(s,n,(d+1)*4);d=this.transitionsBetween(g,c),h=this.transitionsBetween(w,c);let E=new be(c.getX()+(s.getX()-n.getX())/(d+1),c.getY()+(s.getY()-n.getY())/(d+1)),A=new be(c.getX()+(t.getX()-n.getX())/(h+1),c.getY()+(t.getY()-n.getY())/(h+1));if(!this.isValid(E))return this.isValid(A)?A:null;if(!this.isValid(A))return E;let S=this.transitionsBetween(g,E)+this.transitionsBetween(w,E),O=this.transitionsBetween(g,A)+this.transitionsBetween(w,A);return S>O?E:A}shiftToModuleCenter(e){let t=e[0],n=e[1],s=e[2],c=e[3],d=this.transitionsBetween(t,c)+1,h=this.transitionsBetween(s,c)+1,g=Bt.shiftPoint(t,n,h*4),w=Bt.shiftPoint(s,n,d*4);d=this.transitionsBetween(g,c)+1,h=this.transitionsBetween(w,c)+1,(d&1)===1&&(d+=1),(h&1)===1&&(h+=1);let E=(t.getX()+n.getX()+s.getX()+c.getX())/4,A=(t.getY()+n.getY()+s.getY()+c.getY())/4;t=Bt.moveAway(t,E,A),n=Bt.moveAway(n,E,A),s=Bt.moveAway(s,E,A),c=Bt.moveAway(c,E,A);let S,O;return g=Bt.shiftPoint(t,n,h*4),g=Bt.shiftPoint(g,c,d*4),S=Bt.shiftPoint(n,t,h*4),S=Bt.shiftPoint(S,s,d*4),w=Bt.shiftPoint(s,c,h*4),w=Bt.shiftPoint(w,n,d*4),O=Bt.shiftPoint(c,s,h*4),O=Bt.shiftPoint(O,t,d*4),[g,S,w,O]}isValid(e){return e.getX()>=0&&e.getX()<this.image.getWidth()&&e.getY()>0&&e.getY()<this.image.getHeight()}static sampleGrid(e,t,n,s,c,d,h){return Bn.getInstance().sampleGrid(e,d,h,.5,.5,d-.5,.5,d-.5,h-.5,.5,h-.5,t.getX(),t.getY(),c.getX(),c.getY(),s.getX(),s.getY(),n.getX(),n.getY())}transitionsBetween(e,t){let n=Math.trunc(e.getX()),s=Math.trunc(e.getY()),c=Math.trunc(t.getX()),d=Math.trunc(t.getY()),h=Math.abs(d-s)>Math.abs(c-n);if(h){let z=n;n=s,s=z,z=c,c=d,d=z}let g=Math.abs(c-n),w=Math.abs(d-s),E=-g/2,A=s<d?1:-1,S=n<c?1:-1,O=0,U=this.image.get(h?s:n,h?n:s);for(let z=n,Y=s;z!==c;z+=S){let ie=this.image.get(h?Y:z,h?z:Y);if(ie!==U&&(O++,U=ie),E+=w,E>0){if(Y===d)break;Y+=A,E-=g}}return O}}class Yn{constructor(){this.decoder=new Ng}decode(e,t=null){let n,s;if(t!=null&&t.has(Z.PURE_BARCODE)){const w=Yn.extractPureBits(e.getBlackMatrix());n=this.decoder.decode(w),s=Yn.NO_POINTS}else{const w=new Bt(e.getBlackMatrix()).detect();n=this.decoder.decode(w.getBits()),s=w.getPoints()}const c=n.getRawBytes(),d=new Ee(n.getText(),c,8*c.length,s,ue.DATA_MATRIX,D.currentTimeMillis()),h=n.getByteSegments();h!=null&&d.putMetadata(Ae.BYTE_SEGMENTS,h);const g=n.getECLevel();return g!=null&&d.putMetadata(Ae.ERROR_CORRECTION_LEVEL,g),d}reset(){}static extractPureBits(e){const t=e.getTopLeftOnBit(),n=e.getBottomRightOnBit();if(t==null||n==null)throw new N;const s=this.moduleSize(t,e);let c=t[1];const d=n[1];let h=t[0];const w=(n[0]-h+1)/s,E=(d-c+1)/s;if(w<=0||E<=0)throw new N;const A=s/2;c+=A,h+=A;const S=new W(w,E);for(let O=0;O<E;O++){const U=c+O*s;for(let z=0;z<w;z++)e.get(h+z*s,U)&&S.set(z,O)}return S}static moduleSize(e,t){const n=t.getWidth();let s=e[0];const c=e[1];for(;s<n&&t.get(s,c);)s++;if(s===n)throw new N;const d=s-e[0];if(d===0)throw new N;return d}}Yn.NO_POINTS=[];class Tg extends ge{constructor(e=500){super(new Yn,e)}}var Rr;(function(b){b[b.L=0]="L",b[b.M=1]="M",b[b.Q=2]="Q",b[b.H=3]="H"})(Rr||(Rr={}));class ht{constructor(e,t,n){this.value=e,this.stringValue=t,this.bits=n,ht.FOR_BITS.set(n,this),ht.FOR_VALUE.set(e,this)}getValue(){return this.value}getBits(){return this.bits}static fromString(e){switch(e){case"L":return ht.L;case"M":return ht.M;case"Q":return ht.Q;case"H":return ht.H;default:throw new C(e+"not available")}}toString(){return this.stringValue}equals(e){if(!(e instanceof ht))return!1;const t=e;return this.value===t.value}static forBits(e){if(e<0||e>=ht.FOR_BITS.size)throw new y;return ht.FOR_BITS.get(e)}}ht.FOR_BITS=new Map,ht.FOR_VALUE=new Map,ht.L=new ht(Rr.L,"L",1),ht.M=new ht(Rr.M,"M",0),ht.Q=new ht(Rr.Q,"Q",3),ht.H=new ht(Rr.H,"H",2);class $t{constructor(e){this.errorCorrectionLevel=ht.forBits(e>>3&3),this.dataMask=e&7}static numBitsDiffering(e,t){return v.bitCount(e^t)}static decodeFormatInformation(e,t){const n=$t.doDecodeFormatInformation(e,t);return n!==null?n:$t.doDecodeFormatInformation(e^$t.FORMAT_INFO_MASK_QR,t^$t.FORMAT_INFO_MASK_QR)}static doDecodeFormatInformation(e,t){let n=Number.MAX_SAFE_INTEGER,s=0;for(const c of $t.FORMAT_INFO_DECODE_LOOKUP){const d=c[0];if(d===e||d===t)return new $t(c[1]);let h=$t.numBitsDiffering(e,d);h<n&&(s=c[1],n=h),e!==t&&(h=$t.numBitsDiffering(t,d),h<n&&(s=c[1],n=h))}return n<=3?new $t(s):null}getErrorCorrectionLevel(){return this.errorCorrectionLevel}getDataMask(){return this.dataMask}hashCode(){return this.errorCorrectionLevel.getBits()<<3|this.dataMask}equals(e){if(!(e instanceof $t))return!1;const t=e;return this.errorCorrectionLevel===t.errorCorrectionLevel&&this.dataMask===t.dataMask}}$t.FORMAT_INFO_MASK_QR=21522,$t.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 Q{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 Ne{constructor(e,t,...n){this.versionNumber=e,this.alignmentPatternCenters=t,this.ecBlocks=n;let s=0;const c=n[0].getECCodewordsPerBlock(),d=n[0].getECBlocks();for(const h of d)s+=h.getCount()*(h.getDataCodewords()+c);this.totalCodewords=s}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 V;try{return this.getVersionForNumber((e-17)/4)}catch{throw new V}}static getVersionForNumber(e){if(e<1||e>40)throw new y;return Ne.VERSIONS[e-1]}static decodeVersionInformation(e){let t=Number.MAX_SAFE_INTEGER,n=0;for(let s=0;s<Ne.VERSION_DECODE_INFO.length;s++){const c=Ne.VERSION_DECODE_INFO[s];if(c===e)return Ne.getVersionForNumber(s+7);const d=$t.numBitsDiffering(e,c);d<t&&(n=s+7,t=d)}return t<=3?Ne.getVersionForNumber(n):null}buildFunctionPattern(){const e=this.getDimensionForVersion(),t=new W(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 s=0;s<n;s++){const c=this.alignmentPatternCenters[s]-2;for(let d=0;d<n;d++)s===0&&(d===0||d===n-1)||s===n-1&&d===0||t.setRegion(this.alignmentPatternCenters[d]-2,c,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}}Ne.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]),Ne.VERSIONS=[new Ne(1,new Int32Array(0),new Q(7,new R(1,19)),new Q(10,new R(1,16)),new Q(13,new R(1,13)),new Q(17,new R(1,9))),new Ne(2,Int32Array.from([6,18]),new Q(10,new R(1,34)),new Q(16,new R(1,28)),new Q(22,new R(1,22)),new Q(28,new R(1,16))),new Ne(3,Int32Array.from([6,22]),new Q(15,new R(1,55)),new Q(26,new R(1,44)),new Q(18,new R(2,17)),new Q(22,new R(2,13))),new Ne(4,Int32Array.from([6,26]),new Q(20,new R(1,80)),new Q(18,new R(2,32)),new Q(26,new R(2,24)),new Q(16,new R(4,9))),new Ne(5,Int32Array.from([6,30]),new Q(26,new R(1,108)),new Q(24,new R(2,43)),new Q(18,new R(2,15),new R(2,16)),new Q(22,new R(2,11),new R(2,12))),new Ne(6,Int32Array.from([6,34]),new Q(18,new R(2,68)),new Q(16,new R(4,27)),new Q(24,new R(4,19)),new Q(28,new R(4,15))),new Ne(7,Int32Array.from([6,22,38]),new Q(20,new R(2,78)),new Q(18,new R(4,31)),new Q(18,new R(2,14),new R(4,15)),new Q(26,new R(4,13),new R(1,14))),new Ne(8,Int32Array.from([6,24,42]),new Q(24,new R(2,97)),new Q(22,new R(2,38),new R(2,39)),new Q(22,new R(4,18),new R(2,19)),new Q(26,new R(4,14),new R(2,15))),new Ne(9,Int32Array.from([6,26,46]),new Q(30,new R(2,116)),new Q(22,new R(3,36),new R(2,37)),new Q(20,new R(4,16),new R(4,17)),new Q(24,new R(4,12),new R(4,13))),new Ne(10,Int32Array.from([6,28,50]),new Q(18,new R(2,68),new R(2,69)),new Q(26,new R(4,43),new R(1,44)),new Q(24,new R(6,19),new R(2,20)),new Q(28,new R(6,15),new R(2,16))),new Ne(11,Int32Array.from([6,30,54]),new Q(20,new R(4,81)),new Q(30,new R(1,50),new R(4,51)),new Q(28,new R(4,22),new R(4,23)),new Q(24,new R(3,12),new R(8,13))),new Ne(12,Int32Array.from([6,32,58]),new Q(24,new R(2,92),new R(2,93)),new Q(22,new R(6,36),new R(2,37)),new Q(26,new R(4,20),new R(6,21)),new Q(28,new R(7,14),new R(4,15))),new Ne(13,Int32Array.from([6,34,62]),new Q(26,new R(4,107)),new Q(22,new R(8,37),new R(1,38)),new Q(24,new R(8,20),new R(4,21)),new Q(22,new R(12,11),new R(4,12))),new Ne(14,Int32Array.from([6,26,46,66]),new Q(30,new R(3,115),new R(1,116)),new Q(24,new R(4,40),new R(5,41)),new Q(20,new R(11,16),new R(5,17)),new Q(24,new R(11,12),new R(5,13))),new Ne(15,Int32Array.from([6,26,48,70]),new Q(22,new R(5,87),new R(1,88)),new Q(24,new R(5,41),new R(5,42)),new Q(30,new R(5,24),new R(7,25)),new Q(24,new R(11,12),new R(7,13))),new Ne(16,Int32Array.from([6,26,50,74]),new Q(24,new R(5,98),new R(1,99)),new Q(28,new R(7,45),new R(3,46)),new Q(24,new R(15,19),new R(2,20)),new Q(30,new R(3,15),new R(13,16))),new Ne(17,Int32Array.from([6,30,54,78]),new Q(28,new R(1,107),new R(5,108)),new Q(28,new R(10,46),new R(1,47)),new Q(28,new R(1,22),new R(15,23)),new Q(28,new R(2,14),new R(17,15))),new Ne(18,Int32Array.from([6,30,56,82]),new Q(30,new R(5,120),new R(1,121)),new Q(26,new R(9,43),new R(4,44)),new Q(28,new R(17,22),new R(1,23)),new Q(28,new R(2,14),new R(19,15))),new Ne(19,Int32Array.from([6,30,58,86]),new Q(28,new R(3,113),new R(4,114)),new Q(26,new R(3,44),new R(11,45)),new Q(26,new R(17,21),new R(4,22)),new Q(26,new R(9,13),new R(16,14))),new Ne(20,Int32Array.from([6,34,62,90]),new Q(28,new R(3,107),new R(5,108)),new Q(26,new R(3,41),new R(13,42)),new Q(30,new R(15,24),new R(5,25)),new Q(28,new R(15,15),new R(10,16))),new Ne(21,Int32Array.from([6,28,50,72,94]),new Q(28,new R(4,116),new R(4,117)),new Q(26,new R(17,42)),new Q(28,new R(17,22),new R(6,23)),new Q(30,new R(19,16),new R(6,17))),new Ne(22,Int32Array.from([6,26,50,74,98]),new Q(28,new R(2,111),new R(7,112)),new Q(28,new R(17,46)),new Q(30,new R(7,24),new R(16,25)),new Q(24,new R(34,13))),new Ne(23,Int32Array.from([6,30,54,78,102]),new Q(30,new R(4,121),new R(5,122)),new Q(28,new R(4,47),new R(14,48)),new Q(30,new R(11,24),new R(14,25)),new Q(30,new R(16,15),new R(14,16))),new Ne(24,Int32Array.from([6,28,54,80,106]),new Q(30,new R(6,117),new R(4,118)),new Q(28,new R(6,45),new R(14,46)),new Q(30,new R(11,24),new R(16,25)),new Q(30,new R(30,16),new R(2,17))),new Ne(25,Int32Array.from([6,32,58,84,110]),new Q(26,new R(8,106),new R(4,107)),new Q(28,new R(8,47),new R(13,48)),new Q(30,new R(7,24),new R(22,25)),new Q(30,new R(22,15),new R(13,16))),new Ne(26,Int32Array.from([6,30,58,86,114]),new Q(28,new R(10,114),new R(2,115)),new Q(28,new R(19,46),new R(4,47)),new Q(28,new R(28,22),new R(6,23)),new Q(30,new R(33,16),new R(4,17))),new Ne(27,Int32Array.from([6,34,62,90,118]),new Q(30,new R(8,122),new R(4,123)),new Q(28,new R(22,45),new R(3,46)),new Q(30,new R(8,23),new R(26,24)),new Q(30,new R(12,15),new R(28,16))),new Ne(28,Int32Array.from([6,26,50,74,98,122]),new Q(30,new R(3,117),new R(10,118)),new Q(28,new R(3,45),new R(23,46)),new Q(30,new R(4,24),new R(31,25)),new Q(30,new R(11,15),new R(31,16))),new Ne(29,Int32Array.from([6,30,54,78,102,126]),new Q(30,new R(7,116),new R(7,117)),new Q(28,new R(21,45),new R(7,46)),new Q(30,new R(1,23),new R(37,24)),new Q(30,new R(19,15),new R(26,16))),new Ne(30,Int32Array.from([6,26,52,78,104,130]),new Q(30,new R(5,115),new R(10,116)),new Q(28,new R(19,47),new R(10,48)),new Q(30,new R(15,24),new R(25,25)),new Q(30,new R(23,15),new R(25,16))),new Ne(31,Int32Array.from([6,30,56,82,108,134]),new Q(30,new R(13,115),new R(3,116)),new Q(28,new R(2,46),new R(29,47)),new Q(30,new R(42,24),new R(1,25)),new Q(30,new R(23,15),new R(28,16))),new Ne(32,Int32Array.from([6,34,60,86,112,138]),new Q(30,new R(17,115)),new Q(28,new R(10,46),new R(23,47)),new Q(30,new R(10,24),new R(35,25)),new Q(30,new R(19,15),new R(35,16))),new Ne(33,Int32Array.from([6,30,58,86,114,142]),new Q(30,new R(17,115),new R(1,116)),new Q(28,new R(14,46),new R(21,47)),new Q(30,new R(29,24),new R(19,25)),new Q(30,new R(11,15),new R(46,16))),new Ne(34,Int32Array.from([6,34,62,90,118,146]),new Q(30,new R(13,115),new R(6,116)),new Q(28,new R(14,46),new R(23,47)),new Q(30,new R(44,24),new R(7,25)),new Q(30,new R(59,16),new R(1,17))),new Ne(35,Int32Array.from([6,30,54,78,102,126,150]),new Q(30,new R(12,121),new R(7,122)),new Q(28,new R(12,47),new R(26,48)),new Q(30,new R(39,24),new R(14,25)),new Q(30,new R(22,15),new R(41,16))),new Ne(36,Int32Array.from([6,24,50,76,102,128,154]),new Q(30,new R(6,121),new R(14,122)),new Q(28,new R(6,47),new R(34,48)),new Q(30,new R(46,24),new R(10,25)),new Q(30,new R(2,15),new R(64,16))),new Ne(37,Int32Array.from([6,28,54,80,106,132,158]),new Q(30,new R(17,122),new R(4,123)),new Q(28,new R(29,46),new R(14,47)),new Q(30,new R(49,24),new R(10,25)),new Q(30,new R(24,15),new R(46,16))),new Ne(38,Int32Array.from([6,32,58,84,110,136,162]),new Q(30,new R(4,122),new R(18,123)),new Q(28,new R(13,46),new R(32,47)),new Q(30,new R(48,24),new R(14,25)),new Q(30,new R(42,15),new R(32,16))),new Ne(39,Int32Array.from([6,26,54,82,110,138,166]),new Q(30,new R(20,117),new R(4,118)),new Q(28,new R(40,47),new R(7,48)),new Q(30,new R(43,24),new R(22,25)),new Q(30,new R(10,15),new R(67,16))),new Ne(40,Int32Array.from([6,30,58,86,114,142,170]),new Q(30,new R(19,118),new R(6,119)),new Q(28,new R(18,47),new R(31,48)),new Q(30,new R(34,24),new R(34,25)),new Q(30,new R(20,15),new R(61,16)))];var Ft;(function(b){b[b.DATA_MASK_000=0]="DATA_MASK_000",b[b.DATA_MASK_001=1]="DATA_MASK_001",b[b.DATA_MASK_010=2]="DATA_MASK_010",b[b.DATA_MASK_011=3]="DATA_MASK_011",b[b.DATA_MASK_100=4]="DATA_MASK_100",b[b.DATA_MASK_101=5]="DATA_MASK_101",b[b.DATA_MASK_110=6]="DATA_MASK_110",b[b.DATA_MASK_111=7]="DATA_MASK_111"})(Ft||(Ft={}));class gn{constructor(e,t){this.value=e,this.isMasked=t}unmaskBitMatrix(e,t){for(let n=0;n<t;n++)for(let s=0;s<t;s++)this.isMasked(n,s)&&e.flip(s,n)}}gn.values=new Map([[Ft.DATA_MASK_000,new gn(Ft.DATA_MASK_000,(b,e)=>(b+e&1)===0)],[Ft.DATA_MASK_001,new gn(Ft.DATA_MASK_001,(b,e)=>(b&1)===0)],[Ft.DATA_MASK_010,new gn(Ft.DATA_MASK_010,(b,e)=>e%3===0)],[Ft.DATA_MASK_011,new gn(Ft.DATA_MASK_011,(b,e)=>(b+e)%3===0)],[Ft.DATA_MASK_100,new gn(Ft.DATA_MASK_100,(b,e)=>(Math.floor(b/2)+Math.floor(e/3)&1)===0)],[Ft.DATA_MASK_101,new gn(Ft.DATA_MASK_101,(b,e)=>b*e%6===0)],[Ft.DATA_MASK_110,new gn(Ft.DATA_MASK_110,(b,e)=>b*e%6<3)],[Ft.DATA_MASK_111,new gn(Ft.DATA_MASK_111,(b,e)=>(b+e+b*e%3&1)===0)]]);class kg{constructor(e){const t=e.getHeight();if(t<21||(t&3)!==1)throw new V;this.bitMatrix=e}readFormatInformation(){if(this.parsedFormatInfo!==null&&this.parsedFormatInfo!==void 0)return this.parsedFormatInfo;let e=0;for(let c=0;c<6;c++)e=this.copyBit(c,8,e);e=this.copyBit(7,8,e),e=this.copyBit(8,8,e),e=this.copyBit(8,7,e);for(let c=5;c>=0;c--)e=this.copyBit(8,c,e);const t=this.bitMatrix.getHeight();let n=0;const s=t-7;for(let c=t-1;c>=s;c--)n=this.copyBit(8,c,n);for(let c=t-8;c<t;c++)n=this.copyBit(c,8,n);if(this.parsedFormatInfo=$t.decodeFormatInformation(e,n),this.parsedFormatInfo!==null)return this.parsedFormatInfo;throw new V}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 Ne.getVersionForNumber(t);let n=0;const s=e-11;for(let d=5;d>=0;d--)for(let h=e-9;h>=s;h--)n=this.copyBit(h,d,n);let c=Ne.decodeVersionInformation(n);if(c!==null&&c.getDimensionForVersion()===e)return this.parsedVersion=c,c;n=0;for(let d=5;d>=0;d--)for(let h=e-9;h>=s;h--)n=this.copyBit(d,h,n);if(c=Ne.decodeVersionInformation(n),c!==null&&c.getDimensionForVersion()===e)return this.parsedVersion=c,c;throw new V}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=gn.values.get(e.getDataMask()),s=this.bitMatrix.getHeight();n.unmaskBitMatrix(this.bitMatrix,s);const c=t.buildFunctionPattern();let d=!0;const h=new Uint8Array(t.getTotalCodewords());let g=0,w=0,E=0;for(let A=s-1;A>0;A-=2){A===6&&A--;for(let S=0;S<s;S++){const O=d?s-1-S:S;for(let U=0;U<2;U++)c.get(A-U,O)||(E++,w<<=1,this.bitMatrix.get(A-U,O)&&(w|=1),E===8&&(h[g++]=w,E=0,w=0))}d=!d}if(g!==t.getTotalCodewords())throw new V;return h}remask(){if(this.parsedFormatInfo===null)return;const e=gn.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 s=t+1,c=e.getHeight();s<c;s++)e.get(t,s)!==e.get(s,t)&&(e.flip(s,t),e.flip(t,s))}}class Fo{constructor(e,t){this.numDataCodewords=e,this.codewords=t}static getDataBlocks(e,t,n){if(e.length!==t.getTotalCodewords())throw new y;const s=t.getECBlocksForLevel(n);let c=0;const d=s.getECBlocks();for(const U of d)c+=U.getCount();const h=new Array(c);let g=0;for(const U of d)for(let z=0;z<U.getCount();z++){const Y=U.getDataCodewords(),ie=s.getECCodewordsPerBlock()+Y;h[g++]=new Fo(Y,new Uint8Array(ie))}const w=h[0].codewords.length;let E=h.length-1;for(;E>=0&&h[E].codewords.length!==w;)E--;E++;const A=w-s.getECCodewordsPerBlock();let S=0;for(let U=0;U<A;U++)for(let z=0;z<g;z++)h[z].codewords[U]=e[S++];for(let U=E;U<g;U++)h[U].codewords[A]=e[S++];const O=h[0].codewords.length;for(let U=A;U<O;U++)for(let z=0;z<g;z++){const Y=z<E?U:U+1;h[z].codewords[Y]=e[S++]}return h}getNumDataCodewords(){return this.numDataCodewords}getCodewords(){return this.codewords}}var pn;(function(b){b[b.TERMINATOR=0]="TERMINATOR",b[b.NUMERIC=1]="NUMERIC",b[b.ALPHANUMERIC=2]="ALPHANUMERIC",b[b.STRUCTURED_APPEND=3]="STRUCTURED_APPEND",b[b.BYTE=4]="BYTE",b[b.ECI=5]="ECI",b[b.KANJI=6]="KANJI",b[b.FNC1_FIRST_POSITION=7]="FNC1_FIRST_POSITION",b[b.FNC1_SECOND_POSITION=8]="FNC1_SECOND_POSITION",b[b.HANZI=9]="HANZI"})(pn||(pn={}));class Re{constructor(e,t,n,s){this.value=e,this.stringValue=t,this.characterCountBitsForVersions=n,this.bits=s,Re.FOR_BITS.set(s,this),Re.FOR_VALUE.set(e,this)}static forBits(e){const t=Re.FOR_BITS.get(e);if(t===void 0)throw new y;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 Re))return!1;const t=e;return this.value===t.value}toString(){return this.stringValue}}Re.FOR_BITS=new Map,Re.FOR_VALUE=new Map,Re.TERMINATOR=new Re(pn.TERMINATOR,"TERMINATOR",Int32Array.from([0,0,0]),0),Re.NUMERIC=new Re(pn.NUMERIC,"NUMERIC",Int32Array.from([10,12,14]),1),Re.ALPHANUMERIC=new Re(pn.ALPHANUMERIC,"ALPHANUMERIC",Int32Array.from([9,11,13]),2),Re.STRUCTURED_APPEND=new Re(pn.STRUCTURED_APPEND,"STRUCTURED_APPEND",Int32Array.from([0,0,0]),3),Re.BYTE=new Re(pn.BYTE,"BYTE",Int32Array.from([8,16,16]),4),Re.ECI=new Re(pn.ECI,"ECI",Int32Array.from([0,0,0]),7),Re.KANJI=new Re(pn.KANJI,"KANJI",Int32Array.from([8,10,12]),8),Re.FNC1_FIRST_POSITION=new Re(pn.FNC1_FIRST_POSITION,"FNC1_FIRST_POSITION",Int32Array.from([0,0,0]),5),Re.FNC1_SECOND_POSITION=new Re(pn.FNC1_SECOND_POSITION,"FNC1_SECOND_POSITION",Int32Array.from([0,0,0]),9),Re.HANZI=new Re(pn.HANZI,"HANZI",Int32Array.from([8,10,12]),13);class yt{static decode(e,t,n,s){const c=new Lo(e);let d=new G;const h=new Array;let g=-1,w=-1;try{let E=null,A=!1,S;do{if(c.available()<4)S=Re.TERMINATOR;else{const O=c.readBits(4);S=Re.forBits(O)}switch(S){case Re.TERMINATOR:break;case Re.FNC1_FIRST_POSITION:case Re.FNC1_SECOND_POSITION:A=!0;break;case Re.STRUCTURED_APPEND:if(c.available()<16)throw new V;g=c.readBits(8),w=c.readBits(8);break;case Re.ECI:const O=yt.parseECIValue(c);if(E=F.getCharacterSetECIByValue(O),E===null)throw new V;break;case Re.HANZI:const U=c.readBits(4),z=c.readBits(S.getCharacterCountBits(t));U===yt.GB2312_SUBSET&&yt.decodeHanziSegment(c,d,z);break;default:const Y=c.readBits(S.getCharacterCountBits(t));switch(S){case Re.NUMERIC:yt.decodeNumericSegment(c,d,Y);break;case Re.ALPHANUMERIC:yt.decodeAlphanumericSegment(c,d,Y,A);break;case Re.BYTE:yt.decodeByteSegment(c,d,Y,E,h,s);break;case Re.KANJI:yt.decodeKanjiSegment(c,d,Y);break;default:throw new V}break}}while(S!==Re.TERMINATOR)}catch{throw new V}return new Ke(e,d.toString(),h.length===0?null:h,n===null?null:n.toString(),g,w)}static decodeHanziSegment(e,t,n){if(n*13>e.available())throw new V;const s=new Uint8Array(2*n);let c=0;for(;n>0;){const d=e.readBits(13);let h=d/96<<8&4294967295|d%96;h<959?h+=41377:h+=42657,s[c]=h>>8&255,s[c+1]=h&255,c+=2,n--}try{t.append(K.decode(s,ee.GB2312))}catch(d){throw new V(d)}}static decodeKanjiSegment(e,t,n){if(n*13>e.available())throw new V;const s=new Uint8Array(2*n);let c=0;for(;n>0;){const d=e.readBits(13);let h=d/192<<8&4294967295|d%192;h<7936?h+=33088:h+=49472,s[c]=h>>8,s[c+1]=h,c+=2,n--}try{t.append(K.decode(s,ee.SHIFT_JIS))}catch(d){throw new V(d)}}static decodeByteSegment(e,t,n,s,c,d){if(8*n>e.available())throw new V;const h=new Uint8Array(n);for(let w=0;w<n;w++)h[w]=e.readBits(8);let g;s===null?g=ee.guessEncoding(h,d):g=s.getName();try{t.append(K.decode(h,g))}catch(w){throw new V(w)}c.push(h)}static toAlphaNumericChar(e){if(e>=yt.ALPHANUMERIC_CHARS.length)throw new V;return yt.ALPHANUMERIC_CHARS[e]}static decodeAlphanumericSegment(e,t,n,s){const c=t.length();for(;n>1;){if(e.available()<11)throw new V;const d=e.readBits(11);t.append(yt.toAlphaNumericChar(Math.floor(d/45))),t.append(yt.toAlphaNumericChar(d%45)),n-=2}if(n===1){if(e.available()<6)throw new V;t.append(yt.toAlphaNumericChar(e.readBits(6)))}if(s)for(let d=c;d<t.length();d++)t.charAt(d)==="%"&&(d<t.length()-1&&t.charAt(d+1)==="%"?t.deleteCharAt(d+1):t.setCharAt(d,""))}static decodeNumericSegment(e,t,n){for(;n>=3;){if(e.available()<10)throw new V;const s=e.readBits(10);if(s>=1e3)throw new V;t.append(yt.toAlphaNumericChar(Math.floor(s/100))),t.append(yt.toAlphaNumericChar(Math.floor(s/10)%10)),t.append(yt.toAlphaNumericChar(s%10)),n-=3}if(n===2){if(e.available()<7)throw new V;const s=e.readBits(7);if(s>=100)throw new V;t.append(yt.toAlphaNumericChar(Math.floor(s/10))),t.append(yt.toAlphaNumericChar(s%10))}else if(n===1){if(e.available()<4)throw new V;const s=e.readBits(4);if(s>=10)throw new V;t.append(yt.toAlphaNumericChar(s))}}static parseECIValue(e){const t=e.readBits(8);if(!(t&128))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 V}}yt.ALPHANUMERIC_CHARS="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:",yt.GB2312_SUBSET=1;class qa{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 Rg{constructor(){this.rsDecoder=new kt(Te.QR_CODE_FIELD_256)}decodeBooleanArray(e,t){return this.decodeBitMatrix(W.parseFromBooleanArray(e),t)}decodeBitMatrix(e,t){const n=new kg(e);let s=null;try{return this.decodeBitMatrixParser(n,t)}catch(c){s=c}try{n.remask(),n.setMirror(!0),n.readVersion(),n.readFormatInformation(),n.mirror();const c=this.decodeBitMatrixParser(n,t);return c.setOther(new qa(!0)),c}catch(c){throw s!==null?s:c}}decodeBitMatrixParser(e,t){const n=e.readVersion(),s=e.readFormatInformation().getErrorCorrectionLevel(),c=e.readCodewords(),d=Fo.getDataBlocks(c,n,s);let h=0;for(const E of d)h+=E.getNumDataCodewords();const g=new Uint8Array(h);let w=0;for(const E of d){const A=E.getCodewords(),S=E.getNumDataCodewords();this.correctErrors(A,S);for(let O=0;O<S;O++)g[w++]=A[O]}return yt.decode(g,n,s,t)}correctErrors(e,t){const n=new Int32Array(e);try{this.rsDecoder.decode(n,e.length-t)}catch{throw new B}for(let s=0;s<t;s++)e[s]=n[s]}}class Vo extends be{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 s=Math.abs(e-this.estimatedModuleSize);return s<=1||s<=this.estimatedModuleSize}return!1}combineEstimate(e,t,n){const s=(this.getX()+t)/2,c=(this.getY()+e)/2,d=(this.estimatedModuleSize+n)/2;return new Vo(s,c,d)}}class Di{constructor(e,t,n,s,c,d,h){this.image=e,this.startX=t,this.startY=n,this.width=s,this.height=c,this.moduleSize=d,this.resultPointCallback=h,this.possibleCenters=[],this.crossCheckStateCount=new Int32Array(3)}find(){const e=this.startX,t=this.height,n=this.width,s=e+n,c=this.startY+t/2,d=new Int32Array(3),h=this.image;for(let g=0;g<t;g++){const w=c+(g&1?-Math.floor((g+1)/2):Math.floor((g+1)/2));d[0]=0,d[1]=0,d[2]=0;let E=e;for(;E<s&&!h.get(E,w);)E++;let A=0;for(;E<s;){if(h.get(E,w))if(A===1)d[1]++;else if(A===2){if(this.foundPatternCross(d)){const S=this.handlePossibleCenter(d,w,E);if(S!==null)return S}d[0]=d[2],d[1]=1,d[2]=0,A=1}else d[++A]++;else A===1&&A++,d[A]++;E++}if(this.foundPatternCross(d)){const S=this.handlePossibleCenter(d,w,s);if(S!==null)return S}}if(this.possibleCenters.length!==0)return this.possibleCenters[0];throw new N}static centerFromEnd(e,t){return t-e[2]-e[1]/2}foundPatternCross(e){const t=this.moduleSize,n=t/2;for(let s=0;s<3;s++)if(Math.abs(t-e[s])>=n)return!1;return!0}crossCheckVertical(e,t,n,s){const c=this.image,d=c.getHeight(),h=this.crossCheckStateCount;h[0]=0,h[1]=0,h[2]=0;let g=e;for(;g>=0&&c.get(t,g)&&h[1]<=n;)h[1]++,g--;if(g<0||h[1]>n)return NaN;for(;g>=0&&!c.get(t,g)&&h[0]<=n;)h[0]++,g--;if(h[0]>n)return NaN;for(g=e+1;g<d&&c.get(t,g)&&h[1]<=n;)h[1]++,g++;if(g===d||h[1]>n)return NaN;for(;g<d&&!c.get(t,g)&&h[2]<=n;)h[2]++,g++;if(h[2]>n)return NaN;const w=h[0]+h[1]+h[2];return 5*Math.abs(w-s)>=2*s?NaN:this.foundPatternCross(h)?Di.centerFromEnd(h,g):NaN}handlePossibleCenter(e,t,n){const s=e[0]+e[1]+e[2],c=Di.centerFromEnd(e,n),d=this.crossCheckVertical(t,c,2*e[1],s);if(!isNaN(d)){const h=(e[0]+e[1]+e[2])/3;for(const w of this.possibleCenters)if(w.aboutEquals(h,d,c))return w.combineEstimate(d,c,h);const g=new Vo(c,d,h);this.possibleCenters.push(g),this.resultPointCallback!==null&&this.resultPointCallback!==void 0&&this.resultPointCallback.foundPossibleResultPoint(g)}return null}}class Uo extends be{constructor(e,t,n,s){super(e,t),this.estimatedModuleSize=n,this.count=s,s===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 s=Math.abs(e-this.estimatedModuleSize);return s<=1||s<=this.estimatedModuleSize}return!1}combineEstimate(e,t,n){const s=this.count+1,c=(this.count*this.getX()+t)/s,d=(this.count*this.getY()+e)/s,h=(this.count*this.estimatedModuleSize+n)/s;return new Uo(c,d,h,s)}}class Bg{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 Vt{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(Z.TRY_HARDER)!==void 0,n=e!=null&&e.get(Z.PURE_BARCODE)!==void 0,s=this.image,c=s.getHeight(),d=s.getWidth();let h=Math.floor(3*c/(4*Vt.MAX_MODULES));(h<Vt.MIN_SKIP||t)&&(h=Vt.MIN_SKIP);let g=!1;const w=new Int32Array(5);for(let A=h-1;A<c&&!g;A+=h){w[0]=0,w[1]=0,w[2]=0,w[3]=0,w[4]=0;let S=0;for(let O=0;O<d;O++)if(s.get(O,A))(S&1)===1&&S++,w[S]++;else if(S&1)w[S]++;else if(S===4)if(Vt.foundPatternCross(w)){if(this.handlePossibleCenter(w,A,O,n)===!0)if(h=2,this.hasSkipped===!0)g=this.haveMultiplyConfirmedCenters();else{const z=this.findRowSkip();z>w[2]&&(A+=z-w[2]-h,O=d-1)}else{w[0]=w[2],w[1]=w[3],w[2]=w[4],w[3]=1,w[4]=0,S=3;continue}S=0,w[0]=0,w[1]=0,w[2]=0,w[3]=0,w[4]=0}else w[0]=w[2],w[1]=w[3],w[2]=w[4],w[3]=1,w[4]=0,S=3;else w[++S]++;Vt.foundPatternCross(w)&&this.handlePossibleCenter(w,A,d,n)===!0&&(h=w[0],this.hasSkipped&&(g=this.haveMultiplyConfirmedCenters()))}const E=this.selectBestPatterns();return be.orderBestPatterns(E),new Bg(E)}static centerFromEnd(e,t){return t-e[4]-e[3]-e[2]/2}static foundPatternCross(e){let t=0;for(let c=0;c<5;c++){const d=e[c];if(d===0)return!1;t+=d}if(t<7)return!1;const n=t/7,s=n/2;return Math.abs(n-e[0])<s&&Math.abs(n-e[1])<s&&Math.abs(3*n-e[2])<3*s&&Math.abs(n-e[3])<s&&Math.abs(n-e[4])<s}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,s){const c=this.getCrossCheckStateCount();let d=0;const h=this.image;for(;e>=d&&t>=d&&h.get(t-d,e-d);)c[2]++,d++;if(e<d||t<d)return!1;for(;e>=d&&t>=d&&!h.get(t-d,e-d)&&c[1]<=n;)c[1]++,d++;if(e<d||t<d||c[1]>n)return!1;for(;e>=d&&t>=d&&h.get(t-d,e-d)&&c[0]<=n;)c[0]++,d++;if(c[0]>n)return!1;const g=h.getHeight(),w=h.getWidth();for(d=1;e+d<g&&t+d<w&&h.get(t+d,e+d);)c[2]++,d++;if(e+d>=g||t+d>=w)return!1;for(;e+d<g&&t+d<w&&!h.get(t+d,e+d)&&c[3]<n;)c[3]++,d++;if(e+d>=g||t+d>=w||c[3]>=n)return!1;for(;e+d<g&&t+d<w&&h.get(t+d,e+d)&&c[4]<n;)c[4]++,d++;if(c[4]>=n)return!1;const E=c[0]+c[1]+c[2]+c[3]+c[4];return Math.abs(E-s)<2*s&&Vt.foundPatternCross(c)}crossCheckVertical(e,t,n,s){const c=this.image,d=c.getHeight(),h=this.getCrossCheckStateCount();let g=e;for(;g>=0&&c.get(t,g);)h[2]++,g--;if(g<0)return NaN;for(;g>=0&&!c.get(t,g)&&h[1]<=n;)h[1]++,g--;if(g<0||h[1]>n)return NaN;for(;g>=0&&c.get(t,g)&&h[0]<=n;)h[0]++,g--;if(h[0]>n)return NaN;for(g=e+1;g<d&&c.get(t,g);)h[2]++,g++;if(g===d)return NaN;for(;g<d&&!c.get(t,g)&&h[3]<n;)h[3]++,g++;if(g===d||h[3]>=n)return NaN;for(;g<d&&c.get(t,g)&&h[4]<n;)h[4]++,g++;if(h[4]>=n)return NaN;const w=h[0]+h[1]+h[2]+h[3]+h[4];return 5*Math.abs(w-s)>=2*s?NaN:Vt.foundPatternCross(h)?Vt.centerFromEnd(h,g):NaN}crossCheckHorizontal(e,t,n,s){const c=this.image,d=c.getWidth(),h=this.getCrossCheckStateCount();let g=e;for(;g>=0&&c.get(g,t);)h[2]++,g--;if(g<0)return NaN;for(;g>=0&&!c.get(g,t)&&h[1]<=n;)h[1]++,g--;if(g<0||h[1]>n)return NaN;for(;g>=0&&c.get(g,t)&&h[0]<=n;)h[0]++,g--;if(h[0]>n)return NaN;for(g=e+1;g<d&&c.get(g,t);)h[2]++,g++;if(g===d)return NaN;for(;g<d&&!c.get(g,t)&&h[3]<n;)h[3]++,g++;if(g===d||h[3]>=n)return NaN;for(;g<d&&c.get(g,t)&&h[4]<n;)h[4]++,g++;if(h[4]>=n)return NaN;const w=h[0]+h[1]+h[2]+h[3]+h[4];return 5*Math.abs(w-s)>=s?NaN:Vt.foundPatternCross(h)?Vt.centerFromEnd(h,g):NaN}handlePossibleCenter(e,t,n,s){const c=e[0]+e[1]+e[2]+e[3]+e[4];let d=Vt.centerFromEnd(e,n),h=this.crossCheckVertical(t,Math.floor(d),e[2],c);if(!isNaN(h)&&(d=this.crossCheckHorizontal(Math.floor(d),Math.floor(h),e[2],c),!isNaN(d)&&(!s||this.crossCheckDiagonal(Math.floor(h),Math.floor(d),e[2],c)))){const g=c/7;let w=!1;const E=this.possibleCenters;for(let A=0,S=E.length;A<S;A++){const O=E[A];if(O.aboutEquals(g,h,d)){E[A]=O.combineEstimate(h,d,g),w=!0;break}}if(!w){const A=new Uo(d,h,g);E.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()>=Vt.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 d of this.possibleCenters)d.getCount()>=Vt.CENTER_QUORUM&&(e++,t+=d.getEstimatedModuleSize());if(e<3)return!1;const s=t/n;let c=0;for(const d of this.possibleCenters)c+=Math.abs(d.getEstimatedModuleSize()-s);return c<=.05*t}selectBestPatterns(){const e=this.possibleCenters.length;if(e<3)throw new N;const t=this.possibleCenters;let n;if(e>3){let s=0,c=0;for(const g of this.possibleCenters){const w=g.getEstimatedModuleSize();s+=w,c+=w*w}n=s/e;let d=Math.sqrt(c/e-n*n);t.sort((g,w)=>{const E=Math.abs(w.getEstimatedModuleSize()-n),A=Math.abs(g.getEstimatedModuleSize()-n);return E<A?-1:E>A?1:0});const h=Math.max(.2*n,d);for(let g=0;g<t.length&&t.length>3;g++){const w=t[g];Math.abs(w.getEstimatedModuleSize()-n)>h&&(t.splice(g,1),g--)}}if(t.length>3){let s=0;for(const c of t)s+=c.getEstimatedModuleSize();n=s/t.length,t.sort((c,d)=>{if(d.getCount()===c.getCount()){const h=Math.abs(d.getEstimatedModuleSize()-n),g=Math.abs(c.getEstimatedModuleSize()-n);return h<g?1:h>g?-1:0}else return d.getCount()-c.getCount()}),t.splice(3)}return[t[0],t[1],t[2]]}}Vt.CENTER_QUORUM=2,Vt.MIN_SKIP=3,Vt.MAX_MODULES=57;class qr{constructor(e){this.image=e}getImage(){return this.image}getResultPointCallback(){return this.resultPointCallback}detect(e){this.resultPointCallback=e==null?null:e.get(Z.NEED_RESULT_POINT_CALLBACK);const n=new Vt(this.image,this.resultPointCallback).find(e);return this.processFinderPatternInfo(n)}processFinderPatternInfo(e){const t=e.getTopLeft(),n=e.getTopRight(),s=e.getBottomLeft(),c=this.calculateModuleSize(t,n,s);if(c<1)throw new N("No pattern found in proccess finder.");const d=qr.computeDimension(t,n,s,c),h=Ne.getProvisionalVersionForDimension(d),g=h.getDimensionForVersion()-7;let w=null;if(h.getAlignmentPatternCenters().length>0){const O=n.getX()-t.getX()+s.getX(),U=n.getY()-t.getY()+s.getY(),z=1-3/g,Y=Math.floor(t.getX()+z*(O-t.getX())),ie=Math.floor(t.getY()+z*(U-t.getY()));for(let fe=4;fe<=16;fe<<=1)try{w=this.findAlignmentInRegion(c,Y,ie,fe);break}catch(me){if(!(me instanceof N))throw me}}const E=qr.createTransform(t,n,s,w,d),A=qr.sampleGrid(this.image,E,d);let S;return w===null?S=[s,t,n]:S=[s,t,n,w],new $n(A,S)}static createTransform(e,t,n,s,c){const d=c-3.5;let h,g,w,E;return s!==null?(h=s.getX(),g=s.getY(),w=d-3,E=w):(h=t.getX()-e.getX()+n.getX(),g=t.getY()-e.getY()+n.getY(),w=d,E=d),Jt.quadrilateralToQuadrilateral(3.5,3.5,d,3.5,w,E,3.5,d,e.getX(),e.getY(),t.getX(),t.getY(),h,g,n.getX(),n.getY())}static sampleGrid(e,t,n){return Bn.getInstance().sampleGridWithTransform(e,n,n,t)}static computeDimension(e,t,n,s){const c=ve.round(be.distance(e,t)/s),d=ve.round(be.distance(e,n)/s);let h=Math.floor((c+d)/2)+7;switch(h&3){case 0:h++;break;case 2:h--;break;case 3:throw new N("Dimensions could be not found.")}return h}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())),s=this.sizeOfBlackWhiteBlackRunBothWays(Math.floor(t.getX()),Math.floor(t.getY()),Math.floor(e.getX()),Math.floor(e.getY()));return isNaN(n)?s/7:isNaN(s)?n/7:(n+s)/14}sizeOfBlackWhiteBlackRunBothWays(e,t,n,s){let c=this.sizeOfBlackWhiteBlackRun(e,t,n,s),d=1,h=e-(n-e);h<0?(d=e/(e-h),h=0):h>=this.image.getWidth()&&(d=(this.image.getWidth()-1-e)/(h-e),h=this.image.getWidth()-1);let g=Math.floor(t-(s-t)*d);return d=1,g<0?(d=t/(t-g),g=0):g>=this.image.getHeight()&&(d=(this.image.getHeight()-1-t)/(g-t),g=this.image.getHeight()-1),h=Math.floor(e+(h-e)*d),c+=this.sizeOfBlackWhiteBlackRun(e,t,h,g),c-1}sizeOfBlackWhiteBlackRun(e,t,n,s){const c=Math.abs(s-t)>Math.abs(n-e);if(c){let O=e;e=t,t=O,O=n,n=s,s=O}const d=Math.abs(n-e),h=Math.abs(s-t);let g=-d/2;const w=e<n?1:-1,E=t<s?1:-1;let A=0;const S=n+w;for(let O=e,U=t;O!==S;O+=w){const z=c?U:O,Y=c?O:U;if(A===1===this.image.get(z,Y)){if(A===2)return ve.distance(O,U,e,t);A++}if(g+=h,g>0){if(U===s)break;U+=E,g-=d}}return A===2?ve.distance(n+w,s,e,t):NaN}findAlignmentInRegion(e,t,n,s){const c=Math.floor(s*e),d=Math.max(0,t-c),h=Math.min(this.image.getWidth()-1,t+c);if(h-d<e*3)throw new N("Alignment top exceeds estimated module size.");const g=Math.max(0,n-c),w=Math.min(this.image.getHeight()-1,n+c);if(w-g<e*3)throw new N("Alignment bottom exceeds estimated module size.");return new Di(this.image,d,g,h-d,w-g,e,this.resultPointCallback).find()}}class Kn{constructor(){this.decoder=new Rg}getDecoder(){return this.decoder}decode(e,t){let n,s;if(t!=null&&t.get(Z.PURE_BARCODE)!==void 0){const g=Kn.extractPureBits(e.getBlackMatrix());n=this.decoder.decodeBitMatrix(g,t),s=Kn.NO_POINTS}else{const g=new qr(e.getBlackMatrix()).detect(t);n=this.decoder.decodeBitMatrix(g.getBits(),t),s=g.getPoints()}n.getOther()instanceof qa&&n.getOther().applyMirroredCorrection(s);const c=new Ee(n.getText(),n.getRawBytes(),void 0,s,ue.QR_CODE,void 0),d=n.getByteSegments();d!==null&&c.putMetadata(Ae.BYTE_SEGMENTS,d);const h=n.getECLevel();return h!==null&&c.putMetadata(Ae.ERROR_CORRECTION_LEVEL,h),n.hasStructuredAppend()&&(c.putMetadata(Ae.STRUCTURED_APPEND_SEQUENCE,n.getStructuredAppendSequenceNumber()),c.putMetadata(Ae.STRUCTURED_APPEND_PARITY,n.getStructuredAppendParity())),c}reset(){}static extractPureBits(e){const t=e.getTopLeftOnBit(),n=e.getBottomRightOnBit();if(t===null||n===null)throw new N;const s=this.moduleSize(t,e);let c=t[1],d=n[1],h=t[0],g=n[0];if(h>=g||c>=d)throw new N;if(d-c!==g-h&&(g=h+(d-c),g>=e.getWidth()))throw new N;const w=Math.round((g-h+1)/s),E=Math.round((d-c+1)/s);if(w<=0||E<=0)throw new N;if(E!==w)throw new N;const A=Math.floor(s/2);c+=A,h+=A;const S=h+Math.floor((w-1)*s)-g;if(S>0){if(S>A)throw new N;h-=S}const O=c+Math.floor((E-1)*s)-d;if(O>0){if(O>A)throw new N;c-=O}const U=new W(w,E);for(let z=0;z<E;z++){const Y=c+Math.floor(z*s);for(let ie=0;ie<w;ie++)e.get(h+Math.floor(ie*s),Y)&&U.set(ie,z)}return U}static moduleSize(e,t){const n=t.getHeight(),s=t.getWidth();let c=e[0],d=e[1],h=!0,g=0;for(;c<s&&d<n;){if(h!==t.get(c,d)){if(++g===5)break;h=!h}c++,d++}if(c===s||d===n)throw new N;return(c-e[0])/7}}Kn.NO_POINTS=new Array;class Me{PDF417Common(){}static getBitCountSum(e){return ve.sum(e)}static toIntArray(e){if(e==null||!e.length)return Me.EMPTY_INT_ARRAY;const t=new Int32Array(e.length);let n=0;for(const s of e)t[n++]=s;return t}static getCodeword(e){const t=M.binarySearch(Me.SYMBOL_TABLE,e&262143);return t<0?-1:(Me.CODEWORD_TABLE[t]-1)%Me.NUMBER_OF_CODEWORDS}}Me.NUMBER_OF_CODEWORDS=929,Me.MAX_CODEWORDS_IN_BARCODE=Me.NUMBER_OF_CODEWORDS-1,Me.MIN_ROWS_IN_BARCODE=3,Me.MAX_ROWS_IN_BARCODE=90,Me.MODULES_IN_CODEWORD=17,Me.MODULES_IN_STOP_PATTERN=18,Me.BARS_IN_MODULE=8,Me.EMPTY_INT_ARRAY=new Int32Array([]),Me.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]),Me.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 Og{constructor(e,t){this.bits=e,this.points=t}getBits(){return this.bits}getPoints(){return this.points}}class Ue{static detectMultiple(e,t,n){let s=e.getBlackMatrix(),c=Ue.detect(n,s);return c.length||(s=s.clone(),s.rotate180(),c=Ue.detect(n,s)),new Og(s,c)}static detect(e,t){const n=new Array;let s=0,c=0,d=!1;for(;s<t.getHeight();){const h=Ue.findVertices(t,s,c);if(h[0]==null&&h[3]==null){if(!d)break;d=!1,c=0;for(const g of n)g[1]!=null&&(s=Math.trunc(Math.max(s,g[1].getY()))),g[3]!=null&&(s=Math.max(s,Math.trunc(g[3].getY())));s+=Ue.ROW_STEP;continue}if(d=!0,n.push(h),!e)break;h[2]!=null?(c=Math.trunc(h[2].getX()),s=Math.trunc(h[2].getY())):(c=Math.trunc(h[4].getX()),s=Math.trunc(h[4].getY()))}return n}static findVertices(e,t,n){const s=e.getHeight(),c=e.getWidth(),d=new Array(8);return Ue.copyToResult(d,Ue.findRowsWithPattern(e,s,c,t,n,Ue.START_PATTERN),Ue.INDEXES_START_PATTERN),d[4]!=null&&(n=Math.trunc(d[4].getX()),t=Math.trunc(d[4].getY())),Ue.copyToResult(d,Ue.findRowsWithPattern(e,s,c,t,n,Ue.STOP_PATTERN),Ue.INDEXES_STOP_PATTERN),d}static copyToResult(e,t,n){for(let s=0;s<n.length;s++)e[n[s]]=t[s]}static findRowsWithPattern(e,t,n,s,c,d){const h=new Array(4);let g=!1;const w=new Int32Array(d.length);for(;s<t;s+=Ue.ROW_STEP){let A=Ue.findGuardPattern(e,c,s,n,!1,d,w);if(A!=null){for(;s>0;){const S=Ue.findGuardPattern(e,c,--s,n,!1,d,w);if(S!=null)A=S;else{s++;break}}h[0]=new be(A[0],s),h[1]=new be(A[1],s),g=!0;break}}let E=s+1;if(g){let A=0,S=Int32Array.from([Math.trunc(h[0].getX()),Math.trunc(h[1].getX())]);for(;E<t;E++){const O=Ue.findGuardPattern(e,S[0],E,n,!1,d,w);if(O!=null&&Math.abs(S[0]-O[0])<Ue.MAX_PATTERN_DRIFT&&Math.abs(S[1]-O[1])<Ue.MAX_PATTERN_DRIFT)S=O,A=0;else{if(A>Ue.SKIPPED_ROW_COUNT_MAX)break;A++}}E-=A+1,h[2]=new be(S[0],E),h[3]=new be(S[1],E)}return E-s<Ue.BARCODE_MIN_HEIGHT&&M.fill(h,null),h}static findGuardPattern(e,t,n,s,c,d,h){M.fillWithin(h,0,h.length,0);let g=t,w=0;for(;e.get(g,n)&&g>0&&w++<Ue.MAX_PIXEL_DRIFT;)g--;let E=g,A=0,S=d.length;for(let O=c;E<s;E++)if(e.get(E,n)!==O)h[A]++;else{if(A===S-1){if(Ue.patternMatchVariance(h,d,Ue.MAX_INDIVIDUAL_VARIANCE)<Ue.MAX_AVG_VARIANCE)return new Int32Array([g,E]);g+=h[0]+h[1],D.arraycopy(h,2,h,0,A-1),h[A-1]=0,h[A]=0,A--}else A++;h[A]=1,O=!O}return A===S-1&&Ue.patternMatchVariance(h,d,Ue.MAX_INDIVIDUAL_VARIANCE)<Ue.MAX_AVG_VARIANCE?new Int32Array([g,E-1]):null}static patternMatchVariance(e,t,n){let s=e.length,c=0,d=0;for(let w=0;w<s;w++)c+=e[w],d+=t[w];if(c<d)return 1/0;let h=c/d;n*=h;let g=0;for(let w=0;w<s;w++){let E=e[w],A=t[w]*h,S=E>A?E-A:A-E;if(S>n)return 1/0;g+=S}return g/c}}Ue.INDEXES_START_PATTERN=Int32Array.from([0,4,1,5]),Ue.INDEXES_STOP_PATTERN=Int32Array.from([6,2,7,3]),Ue.MAX_AVG_VARIANCE=.42,Ue.MAX_INDIVIDUAL_VARIANCE=.8,Ue.START_PATTERN=Int32Array.from([8,1,1,1,1,1,1,3]),Ue.STOP_PATTERN=Int32Array.from([7,1,1,3,1,1,1,2,1]),Ue.MAX_PIXEL_DRIFT=3,Ue.MAX_PATTERN_DRIFT=5,Ue.SKIPPED_ROW_COUNT_MAX=25,Ue.ROW_STEP=5,Ue.BARCODE_MIN_HEIGHT=10;class zt{constructor(e,t){if(t.length===0)throw new y;this.field=e;let n=t.length;if(n>1&&t[0]===0){let s=1;for(;s<n&&t[s]===0;)s++;s===n?this.coefficients=new Int32Array([0]):(this.coefficients=new Int32Array(n-s),D.arraycopy(t,s,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 s=0;for(let c of this.coefficients)s=this.field.add(s,c);return s}let t=this.coefficients[0],n=this.coefficients.length;for(let s=1;s<n;s++)t=this.field.add(this.field.multiply(e,t),this.coefficients[s]);return t}add(e){if(!this.field.equals(e.field))throw new y("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 d=t;t=n,n=d}let s=new Int32Array(n.length),c=n.length-t.length;D.arraycopy(n,0,s,0,c);for(let d=c;d<n.length;d++)s[d]=this.field.add(t[d-c],n[d]);return new zt(this.field,s)}subtract(e){if(!this.field.equals(e.field))throw new y("ModulusPolys do not have same ModulusGF field");return e.isZero()?this:this.add(e.negative())}multiply(e){return e instanceof zt?this.multiplyOther(e):this.multiplyScalar(e)}multiplyOther(e){if(!this.field.equals(e.field))throw new y("ModulusPolys do not have same ModulusGF field");if(this.isZero()||e.isZero())return new zt(this.field,new Int32Array([0]));let t=this.coefficients,n=t.length,s=e.coefficients,c=s.length,d=new Int32Array(n+c-1);for(let h=0;h<n;h++){let g=t[h];for(let w=0;w<c;w++)d[h+w]=this.field.add(d[h+w],this.field.multiply(g,s[w]))}return new zt(this.field,d)}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 zt(this.field,t)}multiplyScalar(e){if(e===0)return new zt(this.field,new Int32Array([0]));if(e===1)return this;let t=this.coefficients.length,n=new Int32Array(t);for(let s=0;s<t;s++)n[s]=this.field.multiply(this.coefficients[s],e);return new zt(this.field,n)}multiplyByMonomial(e,t){if(e<0)throw new y;if(t===0)return new zt(this.field,new Int32Array([0]));let n=this.coefficients.length,s=new Int32Array(n+e);for(let c=0;c<n;c++)s[c]=this.field.multiply(this.coefficients[c],t);return new zt(this.field,s)}toString(){let e=new G;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 Mg{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 y;return this.logTable[e]}inverse(e){if(e===0)throw new At;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 zo extends Mg{constructor(e,t){super(),this.modulus=e,this.expTable=new Int32Array(e),this.logTable=new Int32Array(e);let n=1;for(let s=0;s<e;s++)this.expTable[s]=n,n=n*t%e;for(let s=0;s<e-1;s++)this.logTable[this.expTable[s]]=s;this.zero=new zt(this,new Int32Array([0])),this.one=new zt(this,new Int32Array([1]))}getZero(){return this.zero}getOne(){return this.one}buildMonomial(e,t){if(e<0)throw new y;if(t===0)return this.zero;let n=new Int32Array(e+1);return n[0]=t,new zt(this,n)}}zo.PDF417_GF=new zo(Me.NUMBER_OF_CODEWORDS,3);class Za{constructor(){this.field=zo.PDF417_GF}decode(e,t,n){let s=new zt(this.field,e),c=new Int32Array(t),d=!1;for(let U=t;U>0;U--){let z=s.evaluateAt(this.field.exp(U));c[t-U]=z,z!==0&&(d=!0)}if(!d)return 0;let h=this.field.getOne();if(n!=null)for(const U of n){let z=this.field.exp(e.length-1-U),Y=new zt(this.field,new Int32Array([this.field.subtract(0,z),1]));h=h.multiply(Y)}let g=new zt(this.field,c),w=this.runEuclideanAlgorithm(this.field.buildMonomial(t,1),g,t),E=w[0],A=w[1],S=this.findErrorLocations(E),O=this.findErrorMagnitudes(A,E,S);for(let U=0;U<S.length;U++){let z=e.length-1-this.field.log(S[U]);if(z<0)throw B.getChecksumInstance();e[z]=this.field.subtract(e[z],O[U])}return S.length}runEuclideanAlgorithm(e,t,n){if(e.getDegree()<t.getDegree()){let S=e;e=t,t=S}let s=e,c=t,d=this.field.getZero(),h=this.field.getOne();for(;c.getDegree()>=Math.round(n/2);){let S=s,O=d;if(s=c,d=h,s.isZero())throw B.getChecksumInstance();c=S;let U=this.field.getZero(),z=s.getCoefficient(s.getDegree()),Y=this.field.inverse(z);for(;c.getDegree()>=s.getDegree()&&!c.isZero();){let ie=c.getDegree()-s.getDegree(),fe=this.field.multiply(c.getCoefficient(c.getDegree()),Y);U=U.add(this.field.buildMonomial(ie,fe)),c=c.subtract(s.multiplyByMonomial(ie,fe))}h=U.multiply(d).subtract(O).negative()}let g=h.getCoefficient(0);if(g===0)throw B.getChecksumInstance();let w=this.field.inverse(g),E=h.multiply(w),A=c.multiply(w);return[E,A]}findErrorLocations(e){let t=e.getDegree(),n=new Int32Array(t),s=0;for(let c=1;c<this.field.getSize()&&s<t;c++)e.evaluateAt(c)===0&&(n[s]=this.field.inverse(c),s++);if(s!==t)throw B.getChecksumInstance();return n}findErrorMagnitudes(e,t,n){let s=t.getDegree(),c=new Int32Array(s);for(let w=1;w<=s;w++)c[s-w]=this.field.multiply(w,t.getCoefficient(w));let d=new zt(this.field,c),h=n.length,g=new Int32Array(h);for(let w=0;w<h;w++){let E=this.field.inverse(n[w]),A=this.field.subtract(0,e.evaluateAt(E)),S=this.field.inverse(d.evaluateAt(E));g[w]=this.field.multiply(A,S)}return g}}class dr{constructor(e,t,n,s,c){e instanceof dr?this.constructor_2(e):this.constructor_1(e,t,n,s,c)}constructor_1(e,t,n,s,c){const d=t==null||n==null,h=s==null||c==null;if(d&&h)throw new N;d?(t=new be(0,s.getY()),n=new be(0,c.getY())):h&&(s=new be(e.getWidth()-1,t.getY()),c=new be(e.getWidth()-1,n.getY())),this.image=e,this.topLeft=t,this.bottomLeft=n,this.topRight=s,this.bottomRight=c,this.minX=Math.trunc(Math.min(t.getX(),n.getX())),this.maxX=Math.trunc(Math.max(s.getX(),c.getX())),this.minY=Math.trunc(Math.min(t.getY(),s.getY())),this.maxY=Math.trunc(Math.max(n.getY(),c.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 dr(e.image,e.topLeft,e.bottomLeft,t.topRight,t.bottomRight)}addMissingRows(e,t,n){let s=this.topLeft,c=this.bottomLeft,d=this.topRight,h=this.bottomRight;if(e>0){let g=n?this.topLeft:this.topRight,w=Math.trunc(g.getY()-e);w<0&&(w=0);let E=new be(g.getX(),w);n?s=E:d=E}if(t>0){let g=n?this.bottomLeft:this.bottomRight,w=Math.trunc(g.getY()+t);w>=this.image.getHeight()&&(w=this.image.getHeight()-1);let E=new be(g.getX(),w);n?c=E:h=E}return new dr(this.image,s,c,d,h)}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 Dg{constructor(e,t,n,s){this.columnCount=e,this.errorCorrectionLevel=s,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 Zr{constructor(){this.buffer=""}static form(e,t){let n=-1;function s(d,h,g,w,E,A){if(d==="%%")return"%";if(t[++n]===void 0)return;d=w?parseInt(w.substr(1)):void 0;let S=E?parseInt(E.substr(1)):void 0,O;switch(A){case"s":O=t[n];break;case"c":O=t[n][0];break;case"f":O=parseFloat(t[n]).toFixed(d);break;case"p":O=parseFloat(t[n]).toPrecision(d);break;case"e":O=parseFloat(t[n]).toExponential(d);break;case"x":O=parseInt(t[n]).toString(S||16);break;case"d":O=parseFloat(parseInt(t[n],S||10).toPrecision(d)).toFixed(0);break}O=typeof O=="object"?JSON.stringify(O):(+O).toString(S);let U=parseInt(g),z=g&&g[0]+""=="0"?"0":" ";for(;O.length<U;)O=h!==void 0?O+z:z+O;return O}let c=/%(-)?(0?[0-9]+)?([.][0-9]+)?([#][0-9]+)?([scfpexd%])/g;return e.replace(c,s)}format(e,...t){this.buffer+=Zr.form(e,t)}toString(){return this.buffer}}class Yr{constructor(e){this.boundingBox=new dr(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<Yr.MAX_NEARBY_DISTANCE;n++){let s=this.imageRowToCodewordIndex(e)-n;if(s>=0&&(t=this.codewords[s],t!=null)||(s=this.imageRowToCodewordIndex(e)+n,s<this.codewords.length&&(t=this.codewords[s],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 Zr;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()}}Yr.MAX_NEARBY_DISTANCE=5;class Kr{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,s]of this.values.entries()){const c={getKey:()=>n,getValue:()=>s};c.getValue()>e?(e=c.getValue(),t=[],t.push(c.getKey())):c.getValue()===e&&t.push(c.getKey())}return Me.toIntArray(t)}getConfidence(e){return this.values.get(e)}}class Ya extends Yr{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(),s=this._isLeft?n.getTopLeft():n.getTopRight(),c=this._isLeft?n.getBottomLeft():n.getBottomRight(),d=this.imageRowToCodewordIndex(Math.trunc(s.getY())),h=this.imageRowToCodewordIndex(Math.trunc(c.getY())),g=-1,w=1,E=0;for(let A=d;A<h;A++){if(t[A]==null)continue;let S=t[A],O=S.getRowNumber()-g;if(O===0)E++;else if(O===1)w=Math.max(w,E),E=1,g=S.getRowNumber();else if(O<0||S.getRowNumber()>=e.getRowCount()||O>A)t[A]=null;else{let U;w>2?U=(w-2)*O:U=O;let z=U>=A;for(let Y=1;Y<=U&&!z;Y++)z=t[A-Y]!=null;z?t[A]=null:(g=S.getRowNumber(),E=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 s=n.getRowNumber();if(s>=t.length)continue;t[s]++}return t}adjustIncompleteIndicatorColumnRowNumbers(e){let t=this.getBoundingBox(),n=this._isLeft?t.getTopLeft():t.getTopRight(),s=this._isLeft?t.getBottomLeft():t.getBottomRight(),c=this.imageRowToCodewordIndex(Math.trunc(n.getY())),d=this.imageRowToCodewordIndex(Math.trunc(s.getY())),h=this.getCodewords(),g=-1;for(let w=c;w<d;w++){if(h[w]==null)continue;let E=h[w];E.setRowNumberAsRowIndicatorColumn();let A=E.getRowNumber()-g;A===0||(A===1?g=E.getRowNumber():E.getRowNumber()>=e.getRowCount()?h[w]=null:g=E.getRowNumber())}}getBarcodeMetadata(){let e=this.getCodewords(),t=new Kr,n=new Kr,s=new Kr,c=new Kr;for(let h of e){if(h==null)continue;h.setRowNumberAsRowIndicatorColumn();let g=h.getValue()%30,w=h.getRowNumber();switch(this._isLeft||(w+=2),w%3){case 0:n.setValue(g*3+1);break;case 1:c.setValue(g/3),s.setValue(g%3);break;case 2:t.setValue(g+1);break}}if(t.getValue().length===0||n.getValue().length===0||s.getValue().length===0||c.getValue().length===0||t.getValue()[0]<1||n.getValue()[0]+s.getValue()[0]<Me.MIN_ROWS_IN_BARCODE||n.getValue()[0]+s.getValue()[0]>Me.MAX_ROWS_IN_BARCODE)return null;let d=new Dg(t.getValue()[0],n.getValue()[0],s.getValue()[0],c.getValue()[0]);return this.removeIncorrectCodewords(e,d),d}removeIncorrectCodewords(e,t){for(let n=0;n<e.length;n++){let s=e[n];if(e[n]==null)continue;let c=s.getValue()%30,d=s.getRowNumber();if(d>t.getRowCount()){e[n]=null;continue}switch(this._isLeft||(d+=2),d%3){case 0:c*3+1!==t.getRowCountUpperPart()&&(e[n]=null);break;case 1:(Math.trunc(c/3)!==t.getErrorCorrectionLevel()||c%3!==t.getRowCountLowerPart())&&(e[n]=null);break;case 2:c+1!==t.getColumnCount()&&(e[n]=null);break}}}isLeft(){return this._isLeft}toString(){return"IsLeft: "+this._isLeft+`
17
+ `+super.toString()}}class Qr{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=Me.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 s=0;s<n.length;s++)n[s]!=null&&(n[s].hasValidRowNumber()||this.adjustRowNumbers(t,s,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 s=1;s<=this.barcodeColumnCount;s++){let c=this.detectionResultColumns[s].getCodewords()[n];c!=null&&(c.setRowNumber(e[n].getRowNumber()),c.hasValidRowNumber()||(this.detectionResultColumns[s].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 s=t[n].getRowNumber(),c=0;for(let d=this.barcodeColumnCount+1;d>0&&c<this.ADJUST_ROW_NUMBER_SKIP;d--){let h=this.detectionResultColumns[d].getCodewords()[n];h!=null&&(c=Qr.adjustRowNumberIfValid(s,c,h),h.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 s=t[n].getRowNumber(),c=0;for(let d=1;d<this.barcodeColumnCount+1&&c<this.ADJUST_ROW_NUMBER_SKIP;d++){let h=this.detectionResultColumns[d].getCodewords()[n];h!=null&&(c=Qr.adjustRowNumberIfValid(s,c,h),h.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 s=n[t],c=this.detectionResultColumns[e-1].getCodewords(),d=c;this.detectionResultColumns[e+1]!=null&&(d=this.detectionResultColumns[e+1].getCodewords());let h=new Array(14);h[2]=c[t],h[3]=d[t],t>0&&(h[0]=n[t-1],h[4]=c[t-1],h[5]=d[t-1]),t>1&&(h[8]=n[t-2],h[10]=c[t-2],h[11]=d[t-2]),t<n.length-1&&(h[1]=n[t+1],h[6]=c[t+1],h[7]=d[t+1]),t<n.length-2&&(h[9]=n[t+2],h[12]=c[t+2],h[13]=d[t+2]);for(let g of h)if(Qr.adjustRowNumber(s,g))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 Zr;for(let n=0;n<e.getCodewords().length;n++){t.format("CW %3d:",n);for(let s=0;s<this.barcodeColumnCount+2;s++){if(this.detectionResultColumns[s]==null){t.format(" | ");continue}let c=this.detectionResultColumns[s].getCodewords()[n];if(c==null){t.format(" | ");continue}t.format(" %3d|%3d",c.getRowNumber(),c.getValue())}t.format("%n")}return t.toString()}}class Jr{constructor(e,t,n,s){this.rowNumber=Jr.BARCODE_ROW_UNKNOWN,this.startX=Math.trunc(e),this.endX=Math.trunc(t),this.bucket=Math.trunc(n),this.value=Math.trunc(s)}hasValidRowNumber(){return this.isValidRowNumber(this.rowNumber)}isValidRowNumber(e){return e!==Jr.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}}Jr.BARCODE_ROW_UNKNOWN=-1;class tn{static initialize(){for(let e=0;e<Me.SYMBOL_TABLE.length;e++){let t=Me.SYMBOL_TABLE[e],n=t&1;for(let s=0;s<Me.BARS_IN_MODULE;s++){let c=0;for(;(t&1)===n;)c+=1,t>>=1;n=t&1,tn.RATIOS_TABLE[e]||(tn.RATIOS_TABLE[e]=new Array(Me.BARS_IN_MODULE)),tn.RATIOS_TABLE[e][Me.BARS_IN_MODULE-s-1]=Math.fround(c/Me.MODULES_IN_CODEWORD)}}this.bSymbolTableReady=!0}static getDecodedValue(e){let t=tn.getDecodedCodewordValue(tn.sampleBitCounts(e));return t!==-1?t:tn.getClosestDecodedValue(e)}static sampleBitCounts(e){let t=ve.sum(e),n=new Int32Array(Me.BARS_IN_MODULE),s=0,c=0;for(let d=0;d<Me.MODULES_IN_CODEWORD;d++){let h=t/(2*Me.MODULES_IN_CODEWORD)+d*t/Me.MODULES_IN_CODEWORD;c+e[s]<=h&&(c+=e[s],s++),n[s]++}return n}static getDecodedCodewordValue(e){let t=tn.getBitValue(e);return Me.getCodeword(t)===-1?-1:t}static getBitValue(e){let t=0;for(let n=0;n<e.length;n++)for(let s=0;s<e[n];s++)t=t<<1|(n%2===0?1:0);return Math.trunc(t)}static getClosestDecodedValue(e){let t=ve.sum(e),n=new Array(Me.BARS_IN_MODULE);if(t>1)for(let d=0;d<n.length;d++)n[d]=Math.fround(e[d]/t);let s=Sr.MAX_VALUE,c=-1;this.bSymbolTableReady||tn.initialize();for(let d=0;d<tn.RATIOS_TABLE.length;d++){let h=0,g=tn.RATIOS_TABLE[d];for(let w=0;w<Me.BARS_IN_MODULE;w++){let E=Math.fround(g[w]-n[w]);if(h+=Math.fround(E*E),h>=s)break}h<s&&(s=h,c=Me.SYMBOL_TABLE[d])}return c}}tn.bSymbolTableReady=!1,tn.RATIOS_TABLE=new Array(Me.SYMBOL_TABLE.length).map(b=>new Array(Me.BARS_IN_MODULE));class Ka{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 Qa{static parseLong(e,t=void 0){return parseInt(e,t)}}class Ja extends x{}Ja.kind="NullPointerException";class vg{writeBytes(e){this.writeBytesOffset(e,0,e.length)}writeBytesOffset(e,t,n){if(e==null)throw new Ja;if(t<0||t>e.length||n<0||t+n>e.length||t+n<0)throw new k;if(n===0)return;for(let s=0;s<n;s++)this.write(e[t+s])}flush(){}close(){}}class Pg extends x{}class Lg extends vg{constructor(e=32){if(super(),this.count=0,e<0)throw new y("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 Pg;n=v.MAX_VALUE}this.buf=M.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 k;this.ensureCapacity(this.count+n),D.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 M.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 ct;(function(b){b[b.ALPHA=0]="ALPHA",b[b.LOWER=1]="LOWER",b[b.MIXED=2]="MIXED",b[b.PUNCT=3]="PUNCT",b[b.ALPHA_SHIFT=4]="ALPHA_SHIFT",b[b.PUNCT_SHIFT=5]="PUNCT_SHIFT"})(ct||(ct={}));function el(){if(typeof window<"u")return window.BigInt||null;if(typeof wr<"u")return wr.BigInt||null;if(typeof self<"u")return self.BigInt||null;throw new Error("Can't search globals for BigInt!")}let vi;function Qn(b){if(typeof vi>"u"&&(vi=el()),vi===null)throw new Error("BigInt is not supported!");return vi(b)}function Fg(){let b=[];b[0]=Qn(1);let e=Qn(900);b[1]=e;for(let t=2;t<16;t++)b[t]=b[t-1]*e;return b}class ne{static decode(e,t){let n=new G(""),s=F.ISO8859_1;n.enableDecoding(s);let c=1,d=e[c++],h=new Ka;for(;c<e[0];){switch(d){case ne.TEXT_COMPACTION_MODE_LATCH:c=ne.textCompaction(e,c,n);break;case ne.BYTE_COMPACTION_MODE_LATCH:case ne.BYTE_COMPACTION_MODE_LATCH_6:c=ne.byteCompaction(d,e,s,c,n);break;case ne.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:n.append(e[c++]);break;case ne.NUMERIC_COMPACTION_MODE_LATCH:c=ne.numericCompaction(e,c,n);break;case ne.ECI_CHARSET:F.getCharacterSetECIByValue(e[c++]);break;case ne.ECI_GENERAL_PURPOSE:c+=2;break;case ne.ECI_USER_DEFINED:c++;break;case ne.BEGIN_MACRO_PDF417_CONTROL_BLOCK:c=ne.decodeMacroBlock(e,c,h);break;case ne.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case ne.MACRO_PDF417_TERMINATOR:throw new V;default:c--,c=ne.textCompaction(e,c,n);break}if(c<e.length)d=e[c++];else throw V.getFormatInstance()}if(n.length()===0)throw V.getFormatInstance();let g=new Ke(null,n.toString(),null,t);return g.setOther(h),g}static decodeMacroBlock(e,t,n){if(t+ne.NUMBER_OF_SEQUENCE_CODEWORDS>e[0])throw V.getFormatInstance();let s=new Int32Array(ne.NUMBER_OF_SEQUENCE_CODEWORDS);for(let h=0;h<ne.NUMBER_OF_SEQUENCE_CODEWORDS;h++,t++)s[h]=e[t];n.setSegmentIndex(v.parseInt(ne.decodeBase900toBase10(s,ne.NUMBER_OF_SEQUENCE_CODEWORDS)));let c=new G;t=ne.textCompaction(e,t,c),n.setFileId(c.toString());let d=-1;for(e[t]===ne.BEGIN_MACRO_PDF417_OPTIONAL_FIELD&&(d=t+1);t<e[0];)switch(e[t]){case ne.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:switch(t++,e[t]){case ne.MACRO_PDF417_OPTIONAL_FIELD_FILE_NAME:let h=new G;t=ne.textCompaction(e,t+1,h),n.setFileName(h.toString());break;case ne.MACRO_PDF417_OPTIONAL_FIELD_SENDER:let g=new G;t=ne.textCompaction(e,t+1,g),n.setSender(g.toString());break;case ne.MACRO_PDF417_OPTIONAL_FIELD_ADDRESSEE:let w=new G;t=ne.textCompaction(e,t+1,w),n.setAddressee(w.toString());break;case ne.MACRO_PDF417_OPTIONAL_FIELD_SEGMENT_COUNT:let E=new G;t=ne.numericCompaction(e,t+1,E),n.setSegmentCount(v.parseInt(E.toString()));break;case ne.MACRO_PDF417_OPTIONAL_FIELD_TIME_STAMP:let A=new G;t=ne.numericCompaction(e,t+1,A),n.setTimestamp(Qa.parseLong(A.toString()));break;case ne.MACRO_PDF417_OPTIONAL_FIELD_CHECKSUM:let S=new G;t=ne.numericCompaction(e,t+1,S),n.setChecksum(v.parseInt(S.toString()));break;case ne.MACRO_PDF417_OPTIONAL_FIELD_FILE_SIZE:let O=new G;t=ne.numericCompaction(e,t+1,O),n.setFileSize(Qa.parseLong(O.toString()));break;default:throw V.getFormatInstance()}break;case ne.MACRO_PDF417_TERMINATOR:t++,n.setLastSegment(!0);break;default:throw V.getFormatInstance()}if(d!==-1){let h=t-d;n.isLastSegment()&&h--,n.setOptionalData(M.copyOfRange(e,d,d+h))}return t}static textCompaction(e,t,n){let s=new Int32Array((e[0]-t)*2),c=new Int32Array((e[0]-t)*2),d=0,h=!1;for(;t<e[0]&&!h;){let g=e[t++];if(g<ne.TEXT_COMPACTION_MODE_LATCH)s[d]=g/30,s[d+1]=g%30,d+=2;else switch(g){case ne.TEXT_COMPACTION_MODE_LATCH:s[d++]=ne.TEXT_COMPACTION_MODE_LATCH;break;case ne.BYTE_COMPACTION_MODE_LATCH:case ne.BYTE_COMPACTION_MODE_LATCH_6:case ne.NUMERIC_COMPACTION_MODE_LATCH:case ne.BEGIN_MACRO_PDF417_CONTROL_BLOCK:case ne.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case ne.MACRO_PDF417_TERMINATOR:t--,h=!0;break;case ne.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:s[d]=ne.MODE_SHIFT_TO_BYTE_COMPACTION_MODE,g=e[t++],c[d]=g,d++;break}}return ne.decodeTextCompaction(s,c,d,n),t}static decodeTextCompaction(e,t,n,s){let c=ct.ALPHA,d=ct.ALPHA,h=0;for(;h<n;){let g=e[h],w="";switch(c){case ct.ALPHA:if(g<26)w=String.fromCharCode(65+g);else switch(g){case 26:w=" ";break;case ne.LL:c=ct.LOWER;break;case ne.ML:c=ct.MIXED;break;case ne.PS:d=c,c=ct.PUNCT_SHIFT;break;case ne.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:s.append(t[h]);break;case ne.TEXT_COMPACTION_MODE_LATCH:c=ct.ALPHA;break}break;case ct.LOWER:if(g<26)w=String.fromCharCode(97+g);else switch(g){case 26:w=" ";break;case ne.AS:d=c,c=ct.ALPHA_SHIFT;break;case ne.ML:c=ct.MIXED;break;case ne.PS:d=c,c=ct.PUNCT_SHIFT;break;case ne.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:s.append(t[h]);break;case ne.TEXT_COMPACTION_MODE_LATCH:c=ct.ALPHA;break}break;case ct.MIXED:if(g<ne.PL)w=ne.MIXED_CHARS[g];else switch(g){case ne.PL:c=ct.PUNCT;break;case 26:w=" ";break;case ne.LL:c=ct.LOWER;break;case ne.AL:c=ct.ALPHA;break;case ne.PS:d=c,c=ct.PUNCT_SHIFT;break;case ne.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:s.append(t[h]);break;case ne.TEXT_COMPACTION_MODE_LATCH:c=ct.ALPHA;break}break;case ct.PUNCT:if(g<ne.PAL)w=ne.PUNCT_CHARS[g];else switch(g){case ne.PAL:c=ct.ALPHA;break;case ne.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:s.append(t[h]);break;case ne.TEXT_COMPACTION_MODE_LATCH:c=ct.ALPHA;break}break;case ct.ALPHA_SHIFT:if(c=d,g<26)w=String.fromCharCode(65+g);else switch(g){case 26:w=" ";break;case ne.TEXT_COMPACTION_MODE_LATCH:c=ct.ALPHA;break}break;case ct.PUNCT_SHIFT:if(c=d,g<ne.PAL)w=ne.PUNCT_CHARS[g];else switch(g){case ne.PAL:c=ct.ALPHA;break;case ne.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:s.append(t[h]);break;case ne.TEXT_COMPACTION_MODE_LATCH:c=ct.ALPHA;break}break}w!==""&&s.append(w),h++}}static byteCompaction(e,t,n,s,c){let d=new Lg,h=0,g=0,w=!1;switch(e){case ne.BYTE_COMPACTION_MODE_LATCH:let E=new Int32Array(6),A=t[s++];for(;s<t[0]&&!w;)switch(E[h++]=A,g=900*g+A,A=t[s++],A){case ne.TEXT_COMPACTION_MODE_LATCH:case ne.BYTE_COMPACTION_MODE_LATCH:case ne.NUMERIC_COMPACTION_MODE_LATCH:case ne.BYTE_COMPACTION_MODE_LATCH_6:case ne.BEGIN_MACRO_PDF417_CONTROL_BLOCK:case ne.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case ne.MACRO_PDF417_TERMINATOR:s--,w=!0;break;default:if(h%5===0&&h>0){for(let S=0;S<6;++S)d.write(Number(Qn(g)>>Qn(8*(5-S))));g=0,h=0}break}s===t[0]&&A<ne.TEXT_COMPACTION_MODE_LATCH&&(E[h++]=A);for(let S=0;S<h;S++)d.write(E[S]);break;case ne.BYTE_COMPACTION_MODE_LATCH_6:for(;s<t[0]&&!w;){let S=t[s++];if(S<ne.TEXT_COMPACTION_MODE_LATCH)h++,g=900*g+S;else switch(S){case ne.TEXT_COMPACTION_MODE_LATCH:case ne.BYTE_COMPACTION_MODE_LATCH:case ne.NUMERIC_COMPACTION_MODE_LATCH:case ne.BYTE_COMPACTION_MODE_LATCH_6:case ne.BEGIN_MACRO_PDF417_CONTROL_BLOCK:case ne.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case ne.MACRO_PDF417_TERMINATOR:s--,w=!0;break}if(h%5===0&&h>0){for(let O=0;O<6;++O)d.write(Number(Qn(g)>>Qn(8*(5-O))));g=0,h=0}}break}return c.append(K.decode(d.toByteArray(),n)),s}static numericCompaction(e,t,n){let s=0,c=!1,d=new Int32Array(ne.MAX_NUMERIC_CODEWORDS);for(;t<e[0]&&!c;){let h=e[t++];if(t===e[0]&&(c=!0),h<ne.TEXT_COMPACTION_MODE_LATCH)d[s]=h,s++;else switch(h){case ne.TEXT_COMPACTION_MODE_LATCH:case ne.BYTE_COMPACTION_MODE_LATCH:case ne.BYTE_COMPACTION_MODE_LATCH_6:case ne.BEGIN_MACRO_PDF417_CONTROL_BLOCK:case ne.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case ne.MACRO_PDF417_TERMINATOR:t--,c=!0;break}(s%ne.MAX_NUMERIC_CODEWORDS===0||h===ne.NUMERIC_COMPACTION_MODE_LATCH||c)&&s>0&&(n.append(ne.decodeBase900toBase10(d,s)),s=0)}return t}static decodeBase900toBase10(e,t){let n=Qn(0);for(let c=0;c<t;c++)n+=ne.EXP900[t-c-1]*Qn(e[c]);let s=n.toString();if(s.charAt(0)!=="1")throw new V;return s.substring(1)}}ne.TEXT_COMPACTION_MODE_LATCH=900,ne.BYTE_COMPACTION_MODE_LATCH=901,ne.NUMERIC_COMPACTION_MODE_LATCH=902,ne.BYTE_COMPACTION_MODE_LATCH_6=924,ne.ECI_USER_DEFINED=925,ne.ECI_GENERAL_PURPOSE=926,ne.ECI_CHARSET=927,ne.BEGIN_MACRO_PDF417_CONTROL_BLOCK=928,ne.BEGIN_MACRO_PDF417_OPTIONAL_FIELD=923,ne.MACRO_PDF417_TERMINATOR=922,ne.MODE_SHIFT_TO_BYTE_COMPACTION_MODE=913,ne.MAX_NUMERIC_CODEWORDS=15,ne.MACRO_PDF417_OPTIONAL_FIELD_FILE_NAME=0,ne.MACRO_PDF417_OPTIONAL_FIELD_SEGMENT_COUNT=1,ne.MACRO_PDF417_OPTIONAL_FIELD_TIME_STAMP=2,ne.MACRO_PDF417_OPTIONAL_FIELD_SENDER=3,ne.MACRO_PDF417_OPTIONAL_FIELD_ADDRESSEE=4,ne.MACRO_PDF417_OPTIONAL_FIELD_FILE_SIZE=5,ne.MACRO_PDF417_OPTIONAL_FIELD_CHECKSUM=6,ne.PL=25,ne.LL=27,ne.AS=27,ne.ML=28,ne.AL=28,ne.PS=29,ne.PAL=29,ne.PUNCT_CHARS=`;<>@[\\]_\`~!\r ,:
18
+ -.$/"|*()?{}'`,ne.MIXED_CHARS="0123456789&\r ,:#-.$/+%*=^",ne.EXP900=el()?Fg():[],ne.NUMBER_OF_SEQUENCE_CODEWORDS=2;class Ge{constructor(){}static decode(e,t,n,s,c,d,h){let g=new dr(e,t,n,s,c),w=null,E=null,A;for(let U=!0;;U=!1){if(t!=null&&(w=Ge.getRowIndicatorColumn(e,g,t,!0,d,h)),s!=null&&(E=Ge.getRowIndicatorColumn(e,g,s,!1,d,h)),A=Ge.merge(w,E),A==null)throw N.getNotFoundInstance();let z=A.getBoundingBox();if(U&&z!=null&&(z.getMinY()<g.getMinY()||z.getMaxY()>g.getMaxY()))g=z;else break}A.setBoundingBox(g);let S=A.getBarcodeColumnCount()+1;A.setDetectionResultColumn(0,w),A.setDetectionResultColumn(S,E);let O=w!=null;for(let U=1;U<=S;U++){let z=O?U:S-U;if(A.getDetectionResultColumn(z)!==void 0)continue;let Y;z===0||z===S?Y=new Ya(g,z===0):Y=new Yr(g),A.setDetectionResultColumn(z,Y);let ie=-1,fe=ie;for(let me=g.getMinY();me<=g.getMaxY();me++){if(ie=Ge.getStartColumn(A,z,me,O),ie<0||ie>g.getMaxX()){if(fe===-1)continue;ie=fe}let de=Ge.detectCodeword(e,g.getMinX(),g.getMaxX(),O,ie,me,d,h);de!=null&&(Y.setCodeword(me,de),fe=ie,d=Math.min(d,de.getWidth()),h=Math.max(h,de.getWidth()))}}return Ge.createDecoderResult(A)}static merge(e,t){if(e==null&&t==null)return null;let n=Ge.getBarcodeMetadata(e,t);if(n==null)return null;let s=dr.merge(Ge.adjustBoundingBox(e),Ge.adjustBoundingBox(t));return new Qr(n,s)}static adjustBoundingBox(e){if(e==null)return null;let t=e.getRowHeights();if(t==null)return null;let n=Ge.getMax(t),s=0;for(let h of t)if(s+=n-h,h>0)break;let c=e.getCodewords();for(let h=0;s>0&&c[h]==null;h++)s--;let d=0;for(let h=t.length-1;h>=0&&(d+=n-t[h],!(t[h]>0));h--);for(let h=c.length-1;d>0&&c[h]==null;h--)d--;return e.getBoundingBox().addMissingRows(s,d,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 s;return t==null||(s=t.getBarcodeMetadata())==null?n:n.getColumnCount()!==s.getColumnCount()&&n.getErrorCorrectionLevel()!==s.getErrorCorrectionLevel()&&n.getRowCount()!==s.getRowCount()?null:n}static getRowIndicatorColumn(e,t,n,s,c,d){let h=new Ya(t,s);for(let g=0;g<2;g++){let w=g===0?1:-1,E=Math.trunc(Math.trunc(n.getX()));for(let A=Math.trunc(Math.trunc(n.getY()));A<=t.getMaxY()&&A>=t.getMinY();A+=w){let S=Ge.detectCodeword(e,0,e.getWidth(),s,E,A,c,d);S!=null&&(h.setCodeword(A,S),s?E=S.getStartX():E=S.getEndX())}}return h}static adjustCodewordCount(e,t){let n=t[0][1],s=n.getValue(),c=e.getBarcodeColumnCount()*e.getBarcodeRowCount()-Ge.getNumberOfECCodeWords(e.getBarcodeECLevel());if(s.length===0){if(c<1||c>Me.MAX_CODEWORDS_IN_BARCODE)throw N.getNotFoundInstance();n.setValue(c)}else s[0]!==c&&n.setValue(c)}static createDecoderResult(e){let t=Ge.createBarcodeMatrix(e);Ge.adjustCodewordCount(e,t);let n=new Array,s=new Int32Array(e.getBarcodeRowCount()*e.getBarcodeColumnCount()),c=[],d=new Array;for(let g=0;g<e.getBarcodeRowCount();g++)for(let w=0;w<e.getBarcodeColumnCount();w++){let E=t[g][w+1].getValue(),A=g*e.getBarcodeColumnCount()+w;E.length===0?n.push(A):E.length===1?s[A]=E[0]:(d.push(A),c.push(E))}let h=new Array(c.length);for(let g=0;g<h.length;g++)h[g]=c[g];return Ge.createDecoderResultFromAmbiguousValues(e.getBarcodeECLevel(),s,Me.toIntArray(n),Me.toIntArray(d),h)}static createDecoderResultFromAmbiguousValues(e,t,n,s,c){let d=new Int32Array(s.length),h=100;for(;h-- >0;){for(let g=0;g<d.length;g++)t[s[g]]=c[g][d[g]];try{return Ge.decodeCodewords(t,e,n)}catch(g){if(!(g instanceof B))throw g}if(d.length===0)throw B.getChecksumInstance();for(let g=0;g<d.length;g++)if(d[g]<c[g].length-1){d[g]++;break}else if(d[g]=0,g===d.length-1)throw B.getChecksumInstance()}throw B.getChecksumInstance()}static createBarcodeMatrix(e){let t=Array.from({length:e.getBarcodeRowCount()},()=>new Array(e.getBarcodeColumnCount()+2));for(let s=0;s<t.length;s++)for(let c=0;c<t[s].length;c++)t[s][c]=new Kr;let n=0;for(let s of e.getDetectionResultColumns()){if(s!=null){for(let c of s.getCodewords())if(c!=null){let d=c.getRowNumber();if(d>=0){if(d>=t.length)continue;t[d][n].setValue(c.getValue())}}}n++}return t}static isValidBarcodeColumn(e,t){return t>=0&&t<=e.getBarcodeColumnCount()+1}static getStartColumn(e,t,n,s){let c=s?1:-1,d=null;if(Ge.isValidBarcodeColumn(e,t-c)&&(d=e.getDetectionResultColumn(t-c).getCodeword(n)),d!=null)return s?d.getEndX():d.getStartX();if(d=e.getDetectionResultColumn(t).getCodewordNearby(n),d!=null)return s?d.getStartX():d.getEndX();if(Ge.isValidBarcodeColumn(e,t-c)&&(d=e.getDetectionResultColumn(t-c).getCodewordNearby(n)),d!=null)return s?d.getEndX():d.getStartX();let h=0;for(;Ge.isValidBarcodeColumn(e,t-c);){t-=c;for(let g of e.getDetectionResultColumn(t).getCodewords())if(g!=null)return(s?g.getEndX():g.getStartX())+c*h*(g.getEndX()-g.getStartX());h++}return s?e.getBoundingBox().getMinX():e.getBoundingBox().getMaxX()}static detectCodeword(e,t,n,s,c,d,h,g){c=Ge.adjustCodewordStartColumn(e,t,n,s,c,d);let w=Ge.getModuleBitCount(e,t,n,s,c,d);if(w==null)return null;let E,A=ve.sum(w);if(s)E=c+A;else{for(let U=0;U<w.length/2;U++){let z=w[U];w[U]=w[w.length-1-U],w[w.length-1-U]=z}E=c,c=E-A}if(!Ge.checkCodewordSkew(A,h,g))return null;let S=tn.getDecodedValue(w),O=Me.getCodeword(S);return O===-1?null:new Jr(c,E,Ge.getCodewordBucketNumber(S),O)}static getModuleBitCount(e,t,n,s,c,d){let h=c,g=new Int32Array(8),w=0,E=s?1:-1,A=s;for(;(s?h<n:h>=t)&&w<g.length;)e.get(h,d)===A?(g[w]++,h+=E):(w++,A=!A);return w===g.length||h===(s?n:t)&&w===g.length-1?g:null}static getNumberOfECCodeWords(e){return 2<<e}static adjustCodewordStartColumn(e,t,n,s,c,d){let h=c,g=s?-1:1;for(let w=0;w<2;w++){for(;(s?h>=t:h<n)&&s===e.get(h,d);){if(Math.abs(c-h)>Ge.CODEWORD_SKEW_SIZE)return c;h+=g}g=-g,s=!s}return h}static checkCodewordSkew(e,t,n){return t-Ge.CODEWORD_SKEW_SIZE<=e&&e<=n+Ge.CODEWORD_SKEW_SIZE}static decodeCodewords(e,t,n){if(e.length===0)throw V.getFormatInstance();let s=1<<t+1,c=Ge.correctErrors(e,n,s);Ge.verifyCodewordCount(e,s);let d=ne.decode(e,""+t);return d.setErrorsCorrected(c),d.setErasures(n.length),d}static correctErrors(e,t,n){if(t!=null&&t.length>n/2+Ge.MAX_ERRORS||n<0||n>Ge.MAX_EC_CODEWORDS)throw B.getChecksumInstance();return Ge.errorCorrection.decode(e,n,t)}static verifyCodewordCount(e,t){if(e.length<4)throw V.getFormatInstance();let n=e[0];if(n>e.length)throw V.getFormatInstance();if(n===0)if(t<e.length)e[0]=e.length-t;else throw V.getFormatInstance()}static getBitCountForCodeword(e){let t=new Int32Array(8),n=0,s=t.length-1;for(;!((e&1)!==n&&(n=e&1,s--,s<0));)t[s]++,e>>=1;return t}static getCodewordBucketNumber(e){return e instanceof Int32Array?this.getCodewordBucketNumber_Int32Array(e):this.getCodewordBucketNumber_number(e)}static getCodewordBucketNumber_number(e){return Ge.getCodewordBucketNumber(Ge.getBitCountForCodeword(e))}static getCodewordBucketNumber_Int32Array(e){return(e[0]-e[2]+e[4]-e[6]+9)%9}static toString(e){let t=new Zr;for(let n=0;n<e.length;n++){t.format("Row %2d: ",n);for(let s=0;s<e[n].length;s++){let c=e[n][s];c.getValue().length===0?t.format(" ",null):t.format("%4d(%2d)",c.getValue()[0],c.getConfidence(c.getValue()[0]))}t.format("%n")}return t.toString()}}Ge.CODEWORD_SKEW_SIZE=2,Ge.MAX_ERRORS=3,Ge.MAX_EC_CODEWORDS=512,Ge.errorCorrection=new Za;class Ht{decode(e,t=null){let n=Ht.decode(e,t,!1);if(n==null||n.length===0||n[0]==null)throw N.getNotFoundInstance();return n[0]}decodeMultiple(e,t=null){try{return Ht.decode(e,t,!0)}catch(n){throw n instanceof V||n instanceof B?N.getNotFoundInstance():n}}static decode(e,t,n){const s=new Array,c=Ue.detectMultiple(e,t,n);for(const d of c.getPoints()){const h=Ge.decode(c.getBits(),d[4],d[5],d[6],d[7],Ht.getMinCodewordWidth(d),Ht.getMaxCodewordWidth(d)),g=new Ee(h.getText(),h.getRawBytes(),void 0,d,ue.PDF_417);g.putMetadata(Ae.ERROR_CORRECTION_LEVEL,h.getECLevel());const w=h.getOther();w!=null&&g.putMetadata(Ae.PDF417_EXTRA_METADATA,w),s.push(g)}return s.map(d=>d)}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?v.MAX_VALUE:Math.trunc(Math.abs(e.getX()-t.getX()))}static getMaxCodewordWidth(e){return Math.floor(Math.max(Math.max(Ht.getMaxWidth(e[0],e[4]),Ht.getMaxWidth(e[6],e[2])*Me.MODULES_IN_CODEWORD/Me.MODULES_IN_STOP_PATTERN),Math.max(Ht.getMaxWidth(e[1],e[5]),Ht.getMaxWidth(e[7],e[3])*Me.MODULES_IN_CODEWORD/Me.MODULES_IN_STOP_PATTERN)))}static getMinCodewordWidth(e){return Math.floor(Math.min(Math.min(Ht.getMinWidth(e[0],e[4]),Ht.getMinWidth(e[6],e[2])*Me.MODULES_IN_CODEWORD/Me.MODULES_IN_STOP_PATTERN),Math.min(Ht.getMinWidth(e[1],e[5]),Ht.getMinWidth(e[7],e[3])*Me.MODULES_IN_CODEWORD/Me.MODULES_IN_STOP_PATTERN)))}reset(){}}class Pi extends x{}Pi.kind="ReaderException";class tl{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=!o(e)&&e.get(Z.TRY_HARDER)===!0,n=o(e)?null:e.get(Z.POSSIBLE_FORMATS),s=new Array;if(!o(n)){const c=n.some(d=>d===ue.UPC_A||d===ue.UPC_E||d===ue.EAN_13||d===ue.EAN_8||d===ue.CODABAR||d===ue.CODE_39||d===ue.CODE_93||d===ue.CODE_128||d===ue.ITF||d===ue.RSS_14||d===ue.RSS_EXPANDED);c&&!t&&s.push(new kr(e,this.verbose)),n.includes(ue.QR_CODE)&&s.push(new Kn),n.includes(ue.DATA_MATRIX)&&s.push(new Yn),n.includes(ue.AZTEC)&&s.push(new Ir),n.includes(ue.PDF_417)&&s.push(new Ht),c&&t&&s.push(new kr(e,this.verbose))}s.length===0&&(t||s.push(new kr(e,this.verbose)),s.push(new Kn),s.push(new Yn),s.push(new Ir),s.push(new Ht),t&&s.push(new kr(e,this.verbose))),this.readers=s}reset(){if(this.readers!==null)for(const e of this.readers)e.reset()}decodeInternal(e){if(this.readers===null)throw new Pi("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 Pi)continue}throw new N("No MultiFormat Readers were able to detect the code.")}}class Vg extends ge{constructor(e=null,t=500){const n=new tl;n.setHints(e),super(n,t)}decodeBitmap(e){return this.reader.decodeWithState(e)}}class Ug extends ge{constructor(e=500){super(new Ht,e)}}class zg extends ge{constructor(e=500){super(new Kn,e)}}var Ho;(function(b){b[b.ERROR_CORRECTION=0]="ERROR_CORRECTION",b[b.CHARACTER_SET=1]="CHARACTER_SET",b[b.DATA_MATRIX_SHAPE=2]="DATA_MATRIX_SHAPE",b[b.MIN_SIZE=3]="MIN_SIZE",b[b.MAX_SIZE=4]="MAX_SIZE",b[b.MARGIN=5]="MARGIN",b[b.PDF417_COMPACT=6]="PDF417_COMPACT",b[b.PDF417_COMPACTION=7]="PDF417_COMPACTION",b[b.PDF417_DIMENSIONS=8]="PDF417_DIMENSIONS",b[b.AZTEC_LAYERS=9]="AZTEC_LAYERS",b[b.QR_VERSION=10]="QR_VERSION"})(Ho||(Ho={}));var Pt=Ho;class Go{constructor(e){this.field=e,this.cachedGenerators=[],this.cachedGenerators.push(new He(e,Int32Array.from([1])))}buildGenerator(e){const t=this.cachedGenerators;if(e>=t.length){let n=t[t.length-1];const s=this.field;for(let c=t.length;c<=e;c++){const d=n.multiply(new He(s,Int32Array.from([1,s.exp(c-1+s.getGeneratorBase())])));t.push(d),n=d}}return t[e]}encode(e,t){if(t===0)throw new y("No error correction bytes");const n=e.length-t;if(n<=0)throw new y("No data bytes provided");const s=this.buildGenerator(t),c=new Int32Array(n);D.arraycopy(e,0,c,0,n);let d=new He(this.field,c);d=d.multiplyByMonomial(t,1);const g=d.divide(s)[1].getCoefficients(),w=t-g.length;for(let E=0;E<w;E++)e[n+E]=0;D.arraycopy(g,0,e,n+w,g.length)}}class Tt{constructor(){}static applyMaskPenaltyRule1(e){return Tt.applyMaskPenaltyRule1Internal(e,!0)+Tt.applyMaskPenaltyRule1Internal(e,!1)}static applyMaskPenaltyRule2(e){let t=0;const n=e.getArray(),s=e.getWidth(),c=e.getHeight();for(let d=0;d<c-1;d++){const h=n[d];for(let g=0;g<s-1;g++){const w=h[g];w===h[g+1]&&w===n[d+1][g]&&w===n[d+1][g+1]&&t++}}return Tt.N2*t}static applyMaskPenaltyRule3(e){let t=0;const n=e.getArray(),s=e.getWidth(),c=e.getHeight();for(let d=0;d<c;d++)for(let h=0;h<s;h++){const g=n[d];h+6<s&&g[h]===1&&g[h+1]===0&&g[h+2]===1&&g[h+3]===1&&g[h+4]===1&&g[h+5]===0&&g[h+6]===1&&(Tt.isWhiteHorizontal(g,h-4,h)||Tt.isWhiteHorizontal(g,h+7,h+11))&&t++,d+6<c&&n[d][h]===1&&n[d+1][h]===0&&n[d+2][h]===1&&n[d+3][h]===1&&n[d+4][h]===1&&n[d+5][h]===0&&n[d+6][h]===1&&(Tt.isWhiteVertical(n,h,d-4,d)||Tt.isWhiteVertical(n,h,d+7,d+11))&&t++}return t*Tt.N3}static isWhiteHorizontal(e,t,n){t=Math.max(t,0),n=Math.min(n,e.length);for(let s=t;s<n;s++)if(e[s]===1)return!1;return!0}static isWhiteVertical(e,t,n,s){n=Math.max(n,0),s=Math.min(s,e.length);for(let c=n;c<s;c++)if(e[c][t]===1)return!1;return!0}static applyMaskPenaltyRule4(e){let t=0;const n=e.getArray(),s=e.getWidth(),c=e.getHeight();for(let g=0;g<c;g++){const w=n[g];for(let E=0;E<s;E++)w[E]===1&&t++}const d=e.getHeight()*e.getWidth();return Math.floor(Math.abs(t*2-d)*10/d)*Tt.N4}static getDataMaskBit(e,t,n){let s,c;switch(e){case 0:s=n+t&1;break;case 1:s=n&1;break;case 2:s=t%3;break;case 3:s=(n+t)%3;break;case 4:s=Math.floor(n/2)+Math.floor(t/3)&1;break;case 5:c=n*t,s=(c&1)+c%3;break;case 6:c=n*t,s=(c&1)+c%3&1;break;case 7:c=n*t,s=c%3+(n+t&1)&1;break;default:throw new y("Invalid mask pattern: "+e)}return s===0}static applyMaskPenaltyRule1Internal(e,t){let n=0;const s=t?e.getHeight():e.getWidth(),c=t?e.getWidth():e.getHeight(),d=e.getArray();for(let h=0;h<s;h++){let g=0,w=-1;for(let E=0;E<c;E++){const A=t?d[h][E]:d[E][h];A===w?g++:(g>=5&&(n+=Tt.N1+(g-5)),g=1,w=A)}g>=5&&(n+=Tt.N1+(g-5))}return n}}Tt.N1=3,Tt.N2=3,Tt.N3=40,Tt.N4=10;class Li{constructor(e,t){this.width=e,this.height=t;const n=new Array(t);for(let s=0;s!==t;s++)n[s]=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)M.fill(t,e)}equals(e){if(!(e instanceof Li))return!1;const t=e;if(this.width!==t.width||this.height!==t.height)return!1;for(let n=0,s=this.height;n<s;++n){const c=this.bytes[n],d=t.bytes[n];for(let h=0,g=this.width;h<g;++h)if(c[h]!==d[h])return!1}return!0}toString(){const e=new G;for(let t=0,n=this.height;t<n;++t){const s=this.bytes[t];for(let c=0,d=this.width;c<d;++c)switch(s[c]){case 0:e.append(" 0");break;case 1:e.append(" 1");break;default:e.append(" ");break}e.append(`
19
+ `)}return e.toString()}}class ur{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 G;return e.append(`<<
20
20
  `),e.append(" mode: "),e.append(this.mode?this.mode.toString():"null"),e.append(`
21
21
  ecLevel: `),e.append(this.ecLevel?this.ecLevel.toString():"null"),e.append(`
22
22
  version: `),e.append(this.version?this.version.toString():"null"),e.append(`
@@ -25,7 +25,7 @@
25
25
  `),e.append(this.matrix.toString())):e.append(`
26
26
  matrix: null
27
27
  `),e.append(`>>
28
- `),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<dr.NUM_MASK_PATTERNS}}dr.NUM_MASK_PATTERNS=8;class dt extends x{}dt.kind="WriterException";class Oe{constructor(){}static clearMatrix(e){e.clear(255)}static buildMatrix(e,t,n,o,c){Oe.clearMatrix(c),Oe.embedBasicPatterns(n,c),Oe.embedTypeInfo(t,o,c),Oe.maybeEmbedVersionInfo(n,c),Oe.embedDataBits(e,o,c)}static embedBasicPatterns(e,t){Oe.embedPositionDetectionPatternsAndSeparators(t),Oe.embedDarkDotAtLeftBottomCorner(t),Oe.maybeEmbedPositionAdjustmentPatterns(e,t),Oe.embedTimingPatterns(t)}static embedTypeInfo(e,t,n){const o=new W;Oe.makeTypeInfoBits(e,t,o);for(let c=0,d=o.getSize();c<d;++c){const h=o.get(o.getSize()-1-c),g=Oe.TYPE_INFO_COORDINATES[c],w=g[0],E=g[1];if(n.setBoolean(w,E,h),c<8){const A=n.getWidth()-c-1;n.setBoolean(A,8,h)}else{const S=n.getHeight()-7+(c-8);n.setBoolean(8,S,h)}}}static maybeEmbedVersionInfo(e,t){if(e.getVersionNumber()<7)return;const n=new W;Oe.makeVersionInfoBits(e,n);let o=6*3-1;for(let c=0;c<6;++c)for(let d=0;d<3;++d){const h=n.get(o);o--,t.setBoolean(c,t.getHeight()-11+d,h),t.setBoolean(t.getHeight()-11+d,c,h)}}static embedDataBits(e,t,n){let o=0,c=-1,d=n.getWidth()-1,h=n.getHeight()-1;for(;d>0;){for(d===6&&(d-=1);h>=0&&h<n.getHeight();){for(let g=0;g<2;++g){const w=d-g;if(!Oe.isEmpty(n.get(w,h)))continue;let E;o<e.getSize()?(E=e.get(o),++o):E=!1,t!==255&&Rt.getDataMaskBit(t,w,h)&&(E=!E),n.setBoolean(w,h,E)}h+=c}c=-c,h+=c,d-=2}if(o!==e.getSize())throw new dt("Not all bits consumed: "+o+"/"+e.getSize())}static findMSBSet(e){return 32-v.numberOfLeadingZeros(e)}static calculateBCHCode(e,t){if(t===0)throw new y("0 polynomial");const n=Oe.findMSBSet(t);for(e<<=n-1;Oe.findMSBSet(e)>=n;)e^=t<<Oe.findMSBSet(e)-n;return e}static makeTypeInfoBits(e,t,n){if(!dr.isValidMaskPattern(t))throw new dt("Invalid mask pattern");const o=e.getBits()<<3|t;n.appendBits(o,5);const c=Oe.calculateBCHCode(o,Oe.TYPE_INFO_POLY);n.appendBits(c,10);const d=new W;if(d.appendBits(Oe.TYPE_INFO_MASK_PATTERN,15),n.xor(d),n.getSize()!==15)throw new dt("should not happen but we got: "+n.getSize())}static makeVersionInfoBits(e,t){t.appendBits(e.getVersionNumber(),6);const n=Oe.calculateBCHCode(e.getVersionNumber(),Oe.VERSION_INFO_POLY);if(t.appendBits(n,12),t.getSize()!==18)throw new dt("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;Oe.isEmpty(e.get(t,6))&&e.setNumber(t,6,n),Oe.isEmpty(e.get(6,t))&&e.setNumber(6,t,n)}}static embedDarkDotAtLeftBottomCorner(e){if(e.get(8,e.getHeight()-8)===0)throw new dt;e.setNumber(8,e.getHeight()-8,1)}static embedHorizontalSeparationPattern(e,t,n){for(let o=0;o<8;++o){if(!Oe.isEmpty(n.get(e+o,t)))throw new dt;n.setNumber(e+o,t,0)}}static embedVerticalSeparationPattern(e,t,n){for(let o=0;o<7;++o){if(!Oe.isEmpty(n.get(e,t+o)))throw new dt;n.setNumber(e,t+o,0)}}static embedPositionAdjustmentPattern(e,t,n){for(let o=0;o<5;++o){const c=Oe.POSITION_ADJUSTMENT_PATTERN[o];for(let d=0;d<5;++d)n.setNumber(e+d,t+o,c[d])}}static embedPositionDetectionPattern(e,t,n){for(let o=0;o<7;++o){const c=Oe.POSITION_DETECTION_PATTERN[o];for(let d=0;d<7;++d)n.setNumber(e+d,t+o,c[d])}}static embedPositionDetectionPatternsAndSeparators(e){const t=Oe.POSITION_DETECTION_PATTERN[0].length;Oe.embedPositionDetectionPattern(0,0,e),Oe.embedPositionDetectionPattern(e.getWidth()-t,0,e),Oe.embedPositionDetectionPattern(0,e.getWidth()-t,e);const n=8;Oe.embedHorizontalSeparationPattern(0,n-1,e),Oe.embedHorizontalSeparationPattern(e.getWidth()-n,n-1,e),Oe.embedHorizontalSeparationPattern(0,e.getWidth()-n,e);const o=7;Oe.embedVerticalSeparationPattern(o,0,e),Oe.embedVerticalSeparationPattern(e.getHeight()-o-1,0,e),Oe.embedVerticalSeparationPattern(o,e.getHeight()-o,e)}static maybeEmbedPositionAdjustmentPatterns(e,t){if(e.getVersionNumber()<2)return;const n=e.getVersionNumber()-1,o=Oe.POSITION_ADJUSTMENT_PATTERN_COORDINATE_TABLE[n];for(let c=0,d=o.length;c!==d;c++){const h=o[c];if(h>=0)for(let g=0;g!==d;g++){const w=o[g];w>=0&&Oe.isEmpty(t.get(w,h))&&Oe.embedPositionAdjustmentPattern(w-2,h-2,t)}}}}Oe.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])]),Oe.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])]),Oe.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])]),Oe.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])]),Oe.VERSION_INFO_POLY=7973,Oe.TYPE_INFO_POLY=1335,Oe.TYPE_INFO_MASK_PATTERN=21522;class Fg{constructor(e,t){this.dataBytes=e,this.errorCorrectionBytes=t}getDataBytes(){return this.dataBytes}getErrorCorrectionBytes(){return this.errorCorrectionBytes}}class _t{constructor(){}static calculateMaskPenalty(e){return Rt.applyMaskPenaltyRule1(e)+Rt.applyMaskPenaltyRule2(e)+Rt.applyMaskPenaltyRule3(e)+Rt.applyMaskPenaltyRule4(e)}static encode(e,t,n=null){let o=_t.DEFAULT_BYTE_MODE_ENCODING;const c=n!==null&&n.get(Pt.CHARACTER_SET)!==void 0;c&&(o=n.get(Pt.CHARACTER_SET).toString());const d=this.chooseMode(e,o),h=new W;if(d===Re.BYTE&&(c||_t.DEFAULT_BYTE_MODE_ENCODING!==o)){const he=V.getCharacterSetECIByName(o);he!==void 0&&this.appendECI(he,h)}this.appendModeInfo(d,h);const g=new W;this.appendBytes(e,d,g,o);let w;if(n!==null&&n.get(Pt.QR_VERSION)!==void 0){const he=Number.parseInt(n.get(Pt.QR_VERSION).toString(),10);w=Te.getVersionForNumber(he);const de=this.calculateBitsNeeded(d,h,g,w);if(!this.willFit(de,w,t))throw new dt("Data too big for requested version")}else w=this.recommendVersion(t,d,h,g);const E=new W;E.appendBitArray(h);const A=d===Re.BYTE?g.getSizeInBytes():e.length;this.appendLengthInfo(A,w,d,E),E.appendBitArray(g);const S=w.getECBlocksForLevel(t),B=w.getTotalCodewords()-S.getTotalECCodewords();this.terminateBits(B,E);const U=this.interleaveWithECBytes(E,w.getTotalCodewords(),B,S.getNumBlocks()),H=new dr;H.setECLevel(t),H.setMode(d),H.setVersion(w);const Y=w.getDimensionForVersion(),oe=new Li(Y,Y),ue=this.chooseMaskPattern(U,t,w,oe);return H.setMaskPattern(ue),Oe.buildMatrix(U,t,w,ue,oe),H.setMatrix(oe),H}static recommendVersion(e,t,n,o){const c=this.calculateBitsNeeded(t,n,o,Te.getVersionForNumber(1)),d=this.chooseVersion(c,e),h=this.calculateBitsNeeded(t,n,o,d);return this.chooseVersion(h,e)}static calculateBitsNeeded(e,t,n,o){return t.getSize()+e.getCharacterCountBits(o)+n.getSize()}static getAlphanumericCode(e){return e<_t.ALPHANUMERIC_TABLE.length?_t.ALPHANUMERIC_TABLE[e]:-1}static chooseMode(e,t=null){if(V.SJIS.getName()===t&&this.isOnlyDoubleByteKanji(e))return Re.KANJI;let n=!1,o=!1;for(let c=0,d=e.length;c<d;++c){const h=e.charAt(c);if(_t.isDigit(h))n=!0;else if(this.getAlphanumericCode(h.charCodeAt(0))!==-1)o=!0;else return Re.BYTE}return o?Re.ALPHANUMERIC:n?Re.NUMERIC:Re.BYTE}static isOnlyDoubleByteKanji(e){let t;try{t=K.encode(e,V.SJIS)}catch{return!1}const n=t.length;if(n%2!==0)return!1;for(let o=0;o<n;o+=2){const c=t[o]&255;if((c<129||c>159)&&(c<224||c>235))return!1}return!0}static chooseMaskPattern(e,t,n,o){let c=Number.MAX_SAFE_INTEGER,d=-1;for(let h=0;h<dr.NUM_MASK_PATTERNS;h++){Oe.buildMatrix(e,t,n,h,o);let g=this.calculateMaskPenalty(o);g<c&&(c=g,d=h)}return d}static chooseVersion(e,t){for(let n=1;n<=40;n++){const o=Te.getVersionForNumber(n);if(_t.willFit(e,o,t))return o}throw new dt("Data too big")}static willFit(e,t,n){const o=t.getTotalCodewords(),d=t.getECBlocksForLevel(n).getTotalECCodewords(),h=o-d,g=(e+7)/8;return h>=g}static terminateBits(e,t){const n=e*8;if(t.getSize()>n)throw new dt("data bits cannot fit in the QR Code"+t.getSize()+" > "+n);for(let d=0;d<4&&t.getSize()<n;++d)t.appendBit(!1);const o=t.getSize()&7;if(o>0)for(let d=o;d<8;d++)t.appendBit(!1);const c=e-t.getSizeInBytes();for(let d=0;d<c;++d)t.appendBits(d&1?17:236,8);if(t.getSize()!==n)throw new dt("Bits size does not equal capacity")}static getNumDataBytesAndNumECBytesForBlockID(e,t,n,o,c,d){if(o>=n)throw new dt("Block ID too large");const h=e%n,g=n-h,w=Math.floor(e/n),E=w+1,A=Math.floor(t/n),S=A+1,B=w-A,U=E-S;if(B!==U)throw new dt("EC bytes mismatch");if(n!==g+h)throw new dt("RS blocks mismatch");if(e!==(A+B)*g+(S+U)*h)throw new dt("Total bytes mismatch");o<g?(c[0]=A,d[0]=B):(c[0]=S,d[0]=U)}static interleaveWithECBytes(e,t,n,o){if(e.getSizeInBytes()!==n)throw new dt("Number of bits and data bytes does not match");let c=0,d=0,h=0;const g=new Array;for(let E=0;E<o;++E){const A=new Int32Array(1),S=new Int32Array(1);_t.getNumDataBytesAndNumECBytesForBlockID(t,n,o,E,A,S);const B=A[0],U=new Uint8Array(B);e.toBytes(8*c,U,0,B);const H=_t.generateECBytes(U,S[0]);g.push(new Fg(U,H)),d=Math.max(d,B),h=Math.max(h,H.length),c+=A[0]}if(n!==c)throw new dt("Data bytes does not match offset");const w=new W;for(let E=0;E<d;++E)for(const A of g){const S=A.getDataBytes();E<S.length&&w.appendBits(S[E],8)}for(let E=0;E<h;++E)for(const A of g){const S=A.getErrorCorrectionBytes();E<S.length&&w.appendBits(S[E],8)}if(t!==w.getSizeInBytes())throw new dt("Interleaving error: "+t+" and "+w.getSizeInBytes()+" differ.");return w}static generateECBytes(e,t){const n=e.length,o=new Int32Array(n+t);for(let d=0;d<n;d++)o[d]=e[d]&255;new Go(De.QR_CODE_FIELD_256).encode(o,t);const c=new Uint8Array(t);for(let d=0;d<t;d++)c[d]=o[n+d];return c}static appendModeInfo(e,t){t.appendBits(e.getBits(),4)}static appendLengthInfo(e,t,n,o){const c=n.getCharacterCountBits(t);if(e>=1<<c)throw new dt(e+" is bigger than "+((1<<c)-1));o.appendBits(e,c)}static appendBytes(e,t,n,o){switch(t){case Re.NUMERIC:_t.appendNumericBytes(e,n);break;case Re.ALPHANUMERIC:_t.appendAlphanumericBytes(e,n);break;case Re.BYTE:_t.append8BitBytes(e,n,o);break;case Re.KANJI:_t.appendKanjiBytes(e,n);break;default:throw new dt("Invalid mode: "+t)}}static getDigit(e){return e.charCodeAt(0)-48}static isDigit(e){const t=_t.getDigit(e);return t>=0&&t<=9}static appendNumericBytes(e,t){const n=e.length;let o=0;for(;o<n;){const c=_t.getDigit(e.charAt(o));if(o+2<n){const d=_t.getDigit(e.charAt(o+1)),h=_t.getDigit(e.charAt(o+2));t.appendBits(c*100+d*10+h,10),o+=3}else if(o+1<n){const d=_t.getDigit(e.charAt(o+1));t.appendBits(c*10+d,7),o+=2}else t.appendBits(c,4),o++}}static appendAlphanumericBytes(e,t){const n=e.length;let o=0;for(;o<n;){const c=_t.getAlphanumericCode(e.charCodeAt(o));if(c===-1)throw new dt;if(o+1<n){const d=_t.getAlphanumericCode(e.charCodeAt(o+1));if(d===-1)throw new dt;t.appendBits(c*45+d,11),o+=2}else t.appendBits(c,6),o++}}static append8BitBytes(e,t,n){let o;try{o=K.encode(e,n)}catch(c){throw new dt(c)}for(let c=0,d=o.length;c!==d;c++){const h=o[c];t.appendBits(h,8)}}static appendKanjiBytes(e,t){let n;try{n=K.encode(e,V.SJIS)}catch(c){throw new dt(c)}const o=n.length;for(let c=0;c<o;c+=2){const d=n[c]&255,h=n[c+1]&255,g=d<<8&4294967295|h;let w=-1;if(g>=33088&&g<=40956?w=g-33088:g>=57408&&g<=60351&&(w=g-49472),w===-1)throw new dt("Invalid byte sequence");const E=(w>>8)*192+(w&255);t.appendBits(E,13)}}static appendECI(e,t){t.appendBits(Re.ECI.getBits(),4),t.appendBits(e.getValue(),8)}}_t.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]),_t.DEFAULT_BYTE_MODE_ENCODING=V.UTF8.getName();class ur{write(e,t,n,o=null){if(e.length===0)throw new y("Found empty contents");if(t<0||n<0)throw new y("Requested dimensions are too small: "+t+"x"+n);let c=gt.L,d=ur.QUIET_ZONE_SIZE;o!==null&&(o.get(Pt.ERROR_CORRECTION)!==void 0&&(c=gt.fromString(o.get(Pt.ERROR_CORRECTION).toString())),o.get(Pt.MARGIN)!==void 0&&(d=Number.parseInt(o.get(Pt.MARGIN).toString(),10)));const h=_t.encode(e,c,o);return this.renderResult(h,t,n,d)}writeToDom(e,t,n,o,c=null){typeof e=="string"&&(e=document.querySelector(e));const d=this.write(t,n,o,c);e&&e.appendChild(d)}renderResult(e,t,n,o){const c=e.getMatrix();if(c===null)throw new Ue;const d=c.getWidth(),h=c.getHeight(),g=d+o*2,w=h+o*2,E=Math.max(t,g),A=Math.max(n,w),S=Math.min(Math.floor(E/g),Math.floor(A/w)),B=Math.floor((E-d*S)/2),U=Math.floor((A-h*S)/2),H=this.createSVGElement(E,A);for(let Y=0,oe=U;Y<h;Y++,oe+=S)for(let ue=0,he=B;ue<d;ue++,he+=S)if(c.get(ue,Y)===1){const de=this.createSvgRectElement(he,oe,S,S);H.appendChild(de)}return H}createSVGElement(e,t){const n=document.createElementNS(ur.SVG_NS,"svg");return n.setAttributeNS(null,"height",e.toString()),n.setAttributeNS(null,"width",t.toString()),n}createSvgRectElement(e,t,n,o){const c=document.createElementNS(ur.SVG_NS,"rect");return c.setAttributeNS(null,"x",e.toString()),c.setAttributeNS(null,"y",t.toString()),c.setAttributeNS(null,"height",n.toString()),c.setAttributeNS(null,"width",o.toString()),c.setAttributeNS(null,"fill","#000000"),c}}ur.QUIET_ZONE_SIZE=4,ur.SVG_NS="http://www.w3.org/2000/svg";class Rr{encode(e,t,n,o,c){if(e.length===0)throw new y("Found empty contents");if(t!==ge.QR_CODE)throw new y("Can only encode QR_CODE, but got "+t);if(n<0||o<0)throw new y(`Requested dimensions are too small: ${n}x${o}`);let d=gt.L,h=Rr.QUIET_ZONE_SIZE;c!==null&&(c.get(Pt.ERROR_CORRECTION)!==void 0&&(d=gt.fromString(c.get(Pt.ERROR_CORRECTION).toString())),c.get(Pt.MARGIN)!==void 0&&(h=Number.parseInt(c.get(Pt.MARGIN).toString(),10)));const g=_t.encode(e,d,c);return Rr.renderResult(g,n,o,h)}static renderResult(e,t,n,o){const c=e.getMatrix();if(c===null)throw new Ue;const d=c.getWidth(),h=c.getHeight(),g=d+o*2,w=h+o*2,E=Math.max(t,g),A=Math.max(n,w),S=Math.min(Math.floor(E/g),Math.floor(A/w)),B=Math.floor((E-d*S)/2),U=Math.floor((A-h*S)/2),H=new z(E,A);for(let Y=0,oe=U;Y<h;Y++,oe+=S)for(let ue=0,he=B;ue<d;ue++,he+=S)c.get(ue,Y)===1&&H.setRegion(he,oe,S,S);return H}}Rr.QUIET_ZONE_SIZE=4;class Vg{encode(e,t,n,o,c){let d;switch(t){case ge.QR_CODE:d=new Rr;break;default:throw new y("No encoder available for format "+t)}return d.encode(e,t,n,o,c)}}class Mn extends j{constructor(e,t,n,o,c,d,h,g){if(super(d,h),this.yuvData=e,this.dataWidth=t,this.dataHeight=n,this.left=o,this.top=c,o+d>t||c+h>n)throw new y("Crop rectangle does not fit within image data.");g&&this.reverseHorizontal(d,h)}getRow(e,t){if(e<0||e>=this.getHeight())throw new y("Requested row is outside the image: "+e);const n=this.getWidth();(t==null||t.length<n)&&(t=new Uint8ClampedArray(n));const o=(e+this.top)*this.dataWidth+this.left;return D.arraycopy(this.yuvData,o,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,o=new Uint8ClampedArray(n);let c=this.top*this.dataWidth+this.left;if(e===this.dataWidth)return D.arraycopy(this.yuvData,c,o,0,n),o;for(let d=0;d<t;d++){const h=d*e;D.arraycopy(this.yuvData,c,o,h,e),c+=this.dataWidth}return o}isCropSupported(){return!0}crop(e,t,n,o){return new Mn(this.yuvData,this.dataWidth,this.dataHeight,this.left+e,this.top+t,n,o,!1)}renderThumbnail(){const e=this.getWidth()/Mn.THUMBNAIL_SCALE_FACTOR,t=this.getHeight()/Mn.THUMBNAIL_SCALE_FACTOR,n=new Int32Array(e*t),o=this.yuvData;let c=this.top*this.dataWidth+this.left;for(let d=0;d<t;d++){const h=d*e;for(let g=0;g<e;g++){const w=o[c+g*Mn.THUMBNAIL_SCALE_FACTOR]&255;n[h+g]=4278190080|w*65793}c+=this.dataWidth*Mn.THUMBNAIL_SCALE_FACTOR}return n}getThumbnailWidth(){return this.getWidth()/Mn.THUMBNAIL_SCALE_FACTOR}getThumbnailHeight(){return this.getHeight()/Mn.THUMBNAIL_SCALE_FACTOR}reverseHorizontal(e,t){const n=this.yuvData;for(let o=0,c=this.top*this.dataWidth+this.left;o<t;o++,c+=this.dataWidth){const d=c+e/2;for(let h=c,g=c+e-1;h<d;h++,g--){const w=n[h];n[h]=n[g],n[g]=w}}}invert(){return new te(this)}}Mn.THUMBNAIL_SCALE_FACTOR=2;class Wo extends j{constructor(e,t,n,o,c,d,h){if(super(t,n),this.dataWidth=o,this.dataHeight=c,this.left=d,this.top=h,e.BYTES_PER_ELEMENT===4){const g=t*n,w=new Uint8ClampedArray(g);for(let E=0;E<g;E++){const A=e[E],S=A>>16&255,B=A>>7&510,U=A&255;w[E]=(S+B+U)/4&255}this.luminances=w}else this.luminances=e;if(o===void 0&&(this.dataWidth=t),c===void 0&&(this.dataHeight=n),d===void 0&&(this.left=0),h===void 0&&(this.top=0),this.left+t>this.dataWidth||this.top+n>this.dataHeight)throw new y("Crop rectangle does not fit within image data.")}getRow(e,t){if(e<0||e>=this.getHeight())throw new y("Requested row is outside the image: "+e);const n=this.getWidth();(t==null||t.length<n)&&(t=new Uint8ClampedArray(n));const o=(e+this.top)*this.dataWidth+this.left;return D.arraycopy(this.luminances,o,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,o=new Uint8ClampedArray(n);let c=this.top*this.dataWidth+this.left;if(e===this.dataWidth)return D.arraycopy(this.luminances,c,o,0,n),o;for(let d=0;d<t;d++){const h=d*e;D.arraycopy(this.luminances,c,o,h,e),c+=this.dataWidth}return o}isCropSupported(){return!0}crop(e,t,n,o){return new Wo(this.luminances,n,o,this.dataWidth,this.dataHeight,this.left+e,this.top+t)}invert(){return new te(this)}}class nl extends V{static forName(e){return this.getCharacterSetECIByName(e)}}class Xo{}Xo.ISO_8859_1=V.ISO8859_1;class rl{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 il{static singletonList(e){return[e]}static min(e,t){return e.sort(t)[0]}}class Ug{constructor(e){this.previous=e}getPrevious(){return this.previous}}class Br extends Ug{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 Br(this,e,t)}addBinaryShift(e,t){return console.warn("addBinaryShift on SimpleToken, this simply returns a copy of this token"),new Br(this,e,t)}toString(){let e=this.value&(1<<this.bitCount)-1;return e|=1<<this.bitCount,"<"+v.toBinaryString(e|1<<this.bitCount).substring(1)+">"}}class $o extends Br{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 $o(this,e,t)}toString(){return"<"+this.binaryShiftStart+"::"+(this.binaryShiftStart+this.binaryShiftByteCount-1)+">"}}function zg(b,e,t){return new $o(b,e,t)}function ti(b,e,t){return new Br(b,e,t)}const Hg=["UPPER","LOWER","DIGIT","MIXED","PUNCT"],Yn=0,Fi=1,xn=2,ol=3,Dn=4,Gg=new Br(null,0,0),jo=[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 Wg(b){for(let e of b)M.fill(e,-1);return b[Yn][Dn]=0,b[Fi][Dn]=0,b[Fi][Yn]=28,b[ol][Dn]=0,b[xn][Dn]=0,b[xn][Yn]=15,b}const sl=Wg(M.createInt32Array(6,6));class vn{constructor(e,t,n,o){this.token=e,this.mode=t,this.binaryShiftByteCount=n,this.bitCount=o}getMode(){return this.mode}getToken(){return this.token}getBinaryShiftByteCount(){return this.binaryShiftByteCount}getBitCount(){return this.bitCount}latchAndAppend(e,t){let n=this.bitCount,o=this.token;if(e!==this.mode){let d=jo[this.mode][e];o=ti(o,d&65535,d>>16),n+=d>>16}let c=e===xn?4:5;return o=ti(o,t,c),new vn(o,e,0,n+c)}shiftAndAppend(e,t){let n=this.token,o=this.mode===xn?4:5;return n=ti(n,sl[this.mode][e],o),n=ti(n,t,5),new vn(n,this.mode,0,this.bitCount+o+5)}addBinaryShiftChar(e){let t=this.token,n=this.mode,o=this.bitCount;if(this.mode===Dn||this.mode===xn){let h=jo[n][Yn];t=ti(t,h&65535,h>>16),o+=h>>16,n=Yn}let c=this.binaryShiftByteCount===0||this.binaryShiftByteCount===31?18:this.binaryShiftByteCount===62?9:8,d=new vn(t,n,this.binaryShiftByteCount+1,o+c);return d.binaryShiftByteCount===2078&&(d=d.endBinaryShift(e+1)),d}endBinaryShift(e){if(this.binaryShiftByteCount===0)return this;let t=this.token;return t=zg(t,e-this.binaryShiftByteCount,this.binaryShiftByteCount),new vn(t,this.mode,0,this.bitCount)}isBetterThanOrEqualTo(e){let t=this.bitCount+(jo[this.mode][e.mode]>>16);return this.binaryShiftByteCount<e.binaryShiftByteCount?t+=vn.calculateBinaryShiftCost(e)-vn.calculateBinaryShiftCost(this):this.binaryShiftByteCount>e.binaryShiftByteCount&&e.binaryShiftByteCount>0&&(t+=10),t<=e.bitCount}toBitArray(e){let t=[];for(let o=this.endBinaryShift(e.length).token;o!==null;o=o.getPrevious())t.unshift(o);let n=new W;for(const o of t)o.appendTo(n,e);return n}toString(){return ee.format("%s bits=%d bytes=%d",Hg[this.mode],this.bitCount,this.binaryShiftByteCount)}static calculateBinaryShiftCost(e){return e.binaryShiftByteCount>62?21:e.binaryShiftByteCount>31?20:e.binaryShiftByteCount>0?10:0}}vn.INITIAL_STATE=new vn(Gg,Yn,0,0);function Xg(b){const e=ee.getCharCode(" "),t=ee.getCharCode("."),n=ee.getCharCode(",");b[Yn][e]=1;const o=ee.getCharCode("Z"),c=ee.getCharCode("A");for(let S=c;S<=o;S++)b[Yn][S]=S-c+2;b[Fi][e]=1;const d=ee.getCharCode("z"),h=ee.getCharCode("a");for(let S=h;S<=d;S++)b[Fi][S]=S-h+2;b[xn][e]=1;const g=ee.getCharCode("9"),w=ee.getCharCode("0");for(let S=w;S<=g;S++)b[xn][S]=S-w+2;b[xn][n]=12,b[xn][t]=13;const E=["\0"," ","","","","","","","\x07","\b"," ",`
29
- `,"\v","\f","\r","\x1B","","","","","@","\\","^","_","`","|","~",""];for(let S=0;S<E.length;S++)b[ol][ee.getCharCode(E[S])]=S;const A=["\0","\r","\0","\0","\0","\0","!","'","#","$","%","&","'","(",")","*","+",",","-",".","/",":",";","<","=",">","?","[","]","{","}"];for(let S=0;S<A.length;S++)ee.getCharCode(A[S])>0&&(b[Dn][ee.getCharCode(A[S])]=S);return b}const qo=Xg(M.createInt32Array(5,256));class ni{constructor(e){this.text=e}encode(){const e=ee.getCharCode(" "),t=ee.getCharCode(`
30
- `);let n=il.singletonList(vn.INITIAL_STATE);for(let c=0;c<this.text.length;c++){let d,h=c+1<this.text.length?this.text[c+1]:0;switch(this.text[c]){case ee.getCharCode("\r"):d=h===t?2:0;break;case ee.getCharCode("."):d=h===e?3:0;break;case ee.getCharCode(","):d=h===e?4:0;break;case ee.getCharCode(":"):d=h===e?5:0;break;default:d=0}d>0?(n=ni.updateStateListForPair(n,c,d),c++):n=this.updateStateListForChar(n,c)}return il.min(n,(c,d)=>c.getBitCount()-d.getBitCount()).toBitArray(this.text)}updateStateListForChar(e,t){const n=[];for(let o of e)this.updateStateForChar(o,t,n);return ni.simplifyStates(n)}updateStateForChar(e,t,n){let o=this.text[t]&255,c=qo[e.getMode()][o]>0,d=null;for(let h=0;h<=Dn;h++){let g=qo[h][o];if(g>0){if(d==null&&(d=e.endBinaryShift(t)),!c||h===e.getMode()||h===xn){const w=d.latchAndAppend(h,g);n.push(w)}if(!c&&sl[e.getMode()][h]>=0){const w=d.shiftAndAppend(h,g);n.push(w)}}}if(e.getBinaryShiftByteCount()>0||qo[e.getMode()][o]===0){let h=e.addBinaryShiftChar(t);n.push(h)}}static updateStateListForPair(e,t,n){const o=[];for(let c of e)this.updateStateForPair(c,t,n,o);return this.simplifyStates(o)}static updateStateForPair(e,t,n,o){let c=e.endBinaryShift(t);if(o.push(c.latchAndAppend(Dn,n)),e.getMode()!==Dn&&o.push(c.shiftAndAppend(Dn,n)),n===3||n===4){let d=c.latchAndAppend(xn,16-n).latchAndAppend(xn,1);o.push(d)}if(e.getBinaryShiftByteCount()>0){let d=e.addBinaryShiftChar(t).addBinaryShiftChar(t+1);o.push(d)}}static simplifyStates(e){let t=[];for(const n of e){let o=!0;for(const c of t){if(c.isBetterThanOrEqualTo(n)){o=!1;break}n.isBetterThanOrEqualTo(c)&&(t=t.filter(d=>d!==c))}o&&t.push(n)}return t}}class Ke{constructor(){}static encodeBytes(e){return Ke.encode(e,Ke.DEFAULT_EC_PERCENT,Ke.DEFAULT_AZTEC_LAYERS)}static encode(e,t,n){let o=new ni(e).encode(),c=v.truncDivision(o.getSize()*t,100)+11,d=o.getSize()+c,h,g,w,E,A;if(n!==Ke.DEFAULT_AZTEC_LAYERS){if(h=n<0,g=Math.abs(n),g>(h?Ke.MAX_NB_BITS_COMPACT:Ke.MAX_NB_BITS))throw new y(ee.format("Illegal value %s for layers",n));w=Ke.totalBitsInLayer(g,h),E=Ke.WORD_SIZE[g];let de=w-w%E;if(A=Ke.stuffBits(o,E),A.getSize()+c>de)throw new y("Data to large for user specified layer");if(h&&A.getSize()>E*64)throw new y("Data to large for user specified layer")}else{E=0,A=null;for(let de=0;;de++){if(de>Ke.MAX_NB_BITS)throw new y("Data too large for an Aztec code");if(h=de<=3,g=h?de+1:de,w=Ke.totalBitsInLayer(g,h),d>w)continue;(A==null||E!==Ke.WORD_SIZE[g])&&(E=Ke.WORD_SIZE[g],A=Ke.stuffBits(o,E));let je=w-w%E;if(!(h&&A.getSize()>E*64)&&A.getSize()+c<=je)break}}let S=Ke.generateCheckWords(A,w,E),B=A.getSize()/E,U=Ke.generateModeMessage(h,g,B),H=(h?11:14)+g*4,Y=new Int32Array(H),oe;if(h){oe=H;for(let de=0;de<Y.length;de++)Y[de]=de}else{oe=H+1+2*v.truncDivision(v.truncDivision(H,2)-1,15);let de=v.truncDivision(H,2),je=v.truncDivision(oe,2);for(let Fe=0;Fe<de;Fe++){let rn=Fe+v.truncDivision(Fe,15);Y[de-Fe-1]=je-rn-1,Y[de+Fe]=je+rn+1}}let ue=new z(oe);for(let de=0,je=0;de<g;de++){let Fe=(g-de)*4+(h?9:12);for(let rn=0;rn<Fe;rn++){let Sn=rn*2;for(let on=0;on<2;on++)S.get(je+Sn+on)&&ue.set(Y[de*2+on],Y[de*2+rn]),S.get(je+Fe*2+Sn+on)&&ue.set(Y[de*2+rn],Y[H-1-de*2-on]),S.get(je+Fe*4+Sn+on)&&ue.set(Y[H-1-de*2-on],Y[H-1-de*2-rn]),S.get(je+Fe*6+Sn+on)&&ue.set(Y[H-1-de*2-rn],Y[de*2+on])}je+=Fe*8}if(Ke.drawModeMessage(ue,h,oe,U),h)Ke.drawBullsEye(ue,v.truncDivision(oe,2),5);else{Ke.drawBullsEye(ue,v.truncDivision(oe,2),7);for(let de=0,je=0;de<v.truncDivision(H,2)-1;de+=15,je+=16)for(let Fe=v.truncDivision(oe,2)&1;Fe<oe;Fe+=2)ue.set(v.truncDivision(oe,2)-je,Fe),ue.set(v.truncDivision(oe,2)+je,Fe),ue.set(Fe,v.truncDivision(oe,2)-je),ue.set(Fe,v.truncDivision(oe,2)+je)}let he=new rl;return he.setCompact(h),he.setSize(oe),he.setLayers(g),he.setCodeWords(B),he.setMatrix(ue),he}static drawBullsEye(e,t,n){for(let o=0;o<n;o+=2)for(let c=t-o;c<=t+o;c++)e.set(c,t-o),e.set(c,t+o),e.set(t-o,c),e.set(t+o,c);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 o=new W;return e?(o.appendBits(t-1,2),o.appendBits(n-1,6),o=Ke.generateCheckWords(o,28,4)):(o.appendBits(t-1,5),o.appendBits(n-1,11),o=Ke.generateCheckWords(o,40,4)),o}static drawModeMessage(e,t,n,o){let c=v.truncDivision(n,2);if(t)for(let d=0;d<7;d++){let h=c-3+d;o.get(d)&&e.set(h,c-5),o.get(d+7)&&e.set(c+5,h),o.get(20-d)&&e.set(h,c+5),o.get(27-d)&&e.set(c-5,h)}else for(let d=0;d<10;d++){let h=c-5+d+v.truncDivision(d,5);o.get(d)&&e.set(h,c-7),o.get(d+10)&&e.set(c+7,h),o.get(29-d)&&e.set(h,c+7),o.get(39-d)&&e.set(c-7,h)}}static generateCheckWords(e,t,n){let o=e.getSize()/n,c=new Go(Ke.getGF(n)),d=v.truncDivision(t,n),h=Ke.bitsToWords(e,n,d);c.encode(h,d-o);let g=t%n,w=new W;w.appendBits(0,g);for(const E of Array.from(h))w.appendBits(E,n);return w}static bitsToWords(e,t,n){let o=new Int32Array(n),c,d;for(c=0,d=e.getSize()/t;c<d;c++){let h=0;for(let g=0;g<t;g++)h|=e.get(c*t+g)?1<<t-g-1:0;o[c]=h}return o}static getGF(e){switch(e){case 4:return De.AZTEC_PARAM;case 6:return De.AZTEC_DATA_6;case 8:return De.AZTEC_DATA_8;case 10:return De.AZTEC_DATA_10;case 12:return De.AZTEC_DATA_12;default:throw new y("Unsupported word size "+e)}}static stuffBits(e,t){let n=new W,o=e.getSize(),c=(1<<t)-2;for(let d=0;d<o;d+=t){let h=0;for(let g=0;g<t;g++)(d+g>=o||e.get(d+g))&&(h|=1<<t-1-g);(h&c)===c?(n.appendBits(h&c,t),d--):h&c?n.appendBits(h,t):(n.appendBits(h|1,t),d--)}return n}static totalBitsInLayer(e,t){return((t?88:112)+16*e)*e}}Ke.DEFAULT_EC_PERCENT=33,Ke.DEFAULT_AZTEC_LAYERS=0,Ke.MAX_NB_BITS=32,Ke.MAX_NB_BITS_COMPACT=4,Ke.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 Vi{encode(e,t,n,o){return this.encodeWithHints(e,t,n,o,null)}encodeWithHints(e,t,n,o,c){let d=Xo.ISO_8859_1,h=Ke.DEFAULT_EC_PERCENT,g=Ke.DEFAULT_AZTEC_LAYERS;return c!=null&&(c.has(Pt.CHARACTER_SET)&&(d=nl.forName(c.get(Pt.CHARACTER_SET).toString())),c.has(Pt.ERROR_CORRECTION)&&(h=v.parseInt(c.get(Pt.ERROR_CORRECTION).toString())),c.has(Pt.AZTEC_LAYERS)&&(g=v.parseInt(c.get(Pt.AZTEC_LAYERS).toString()))),Vi.encodeLayers(e,t,n,o,d,h,g)}static encodeLayers(e,t,n,o,c,d,h){if(t!==ge.AZTEC)throw new y("Can only encode AZTEC, but got "+t);let g=Ke.encode(ee.getBytes(e,c),d,h);return Vi.renderResult(g,n,o)}static renderResult(e,t,n){let o=e.getMatrix();if(o==null)throw new Ue;let c=o.getWidth(),d=o.getHeight(),h=Math.max(t,c),g=Math.max(n,d),w=Math.min(h/c,g/d),E=(h-c*w)/2,A=(g-d*w)/2,S=new z(h,g);for(let B=0,U=A;B<d;B++,U+=w)for(let H=0,Y=E;H<c;H++,Y+=w)o.get(H,B)&&S.setRegion(Y,U,w,w);return S}}i.AbstractExpandedDecoder=Mo,i.ArgumentException=C,i.ArithmeticException=it,i.AztecCode=rl,i.AztecCodeReader=Sr,i.AztecCodeWriter=Vi,i.AztecDecoder=Qe,i.AztecDetector=Bi,i.AztecDetectorResult=qr,i.AztecEncoder=Ke,i.AztecHighLevelEncoder=ni,i.AztecPoint=Ut,i.BarcodeFormat=ge,i.Binarizer=T,i.BinaryBitmap=I,i.BitArray=W,i.BitMatrix=z,i.BitSource=Lo,i.BrowserAztecCodeReader=Oo,i.BrowserBarcodeReader=yg,i.BrowserCodeReader=we,i.BrowserDatamatrixCodeReader=Ag,i.BrowserMultiFormatReader=vg,i.BrowserPDF417Reader=Pg,i.BrowserQRCodeReader=Lg,i.BrowserQRCodeSvgWriter=ur,i.CharacterSetECI=V,i.ChecksumException=O,i.Code128Reader=me,i.Code39Reader=bt,i.DataMatrixDecodedBitStreamParser=$n,i.DataMatrixReader=jn,i.DecodeHintType=Z,i.DecoderResult=et,i.DefaultGridSampler=Ri,i.DetectorResult=br,i.EAN13Reader=zt,i.EncodeHintType=Pt,i.Exception=x,i.FormatException=F,i.GenericGF=De,i.GenericGFPoly=Ve,i.GlobalHistogramBinarizer=$,i.GridSampler=Ar,i.GridSamplerInstance=Rn,i.HTMLCanvasElementLuminanceSource=J,i.HybridBinarizer=q,i.ITFReader=tt,i.IllegalArgumentException=y,i.IllegalStateException=Ue,i.InvertedLuminanceSource=te,i.LuminanceSource=j,i.MathUtils=ve,i.MultiFormatOneDReader=Tr,i.MultiFormatReader=tl,i.MultiFormatWriter=Vg,i.NotFoundException=N,i.OneDReader=mt,i.PDF417DecodedBitStreamParser=re,i.PDF417DecoderErrorCorrection=Za,i.PDF417Reader=Gt,i.PDF417ResultMetadata=Ka,i.PerspectiveTransform=dn,i.PlanarYUVLuminanceSource=Mn,i.QRCodeByteMatrix=Li,i.QRCodeDataMask=gn,i.QRCodeDecodedBitStreamParser=At,i.QRCodeDecoderErrorCorrectionLevel=gt,i.QRCodeDecoderFormatInformation=$t,i.QRCodeEncoder=_t,i.QRCodeEncoderQRCode=dr,i.QRCodeMaskUtil=Rt,i.QRCodeMatrixUtil=Oe,i.QRCodeMode=Re,i.QRCodeReader=qn,i.QRCodeVersion=Te,i.QRCodeWriter=Rr,i.RGBLuminanceSource=Wo,i.RSS14Reader=kt,i.RSSExpandedReader=le,i.ReaderException=Pi,i.ReedSolomonDecoder=Nt,i.ReedSolomonEncoder=Go,i.ReedSolomonException=Ne,i.Result=Ce,i.ResultMetadataType=be,i.ResultPoint=ye,i.StringUtils=ee,i.UnsupportedOperationException=ie,i.VideoInputDevice=se,i.WhiteRectangleDetector=Dt,i.WriterException=dt,i.ZXingArrays=M,i.ZXingCharset=nl,i.ZXingInteger=v,i.ZXingStandardCharsets=Xo,i.ZXingStringBuilder=G,i.ZXingStringEncoding=K,i.ZXingSystem=D,i.createAbstractExpandedDecoder=ja,Object.defineProperty(i,"__esModule",{value:!0})})})(So,So.exports);var pt=So.exports;const nm=dl({__proto__:null,default:ta(pt)},[pt]);var Aa=function(){function a(l,i,s){if(this.formatMap=new Map([[_e.QR_CODE,pt.BarcodeFormat.QR_CODE],[_e.AZTEC,pt.BarcodeFormat.AZTEC],[_e.CODABAR,pt.BarcodeFormat.CODABAR],[_e.CODE_39,pt.BarcodeFormat.CODE_39],[_e.CODE_93,pt.BarcodeFormat.CODE_93],[_e.CODE_128,pt.BarcodeFormat.CODE_128],[_e.DATA_MATRIX,pt.BarcodeFormat.DATA_MATRIX],[_e.MAXICODE,pt.BarcodeFormat.MAXICODE],[_e.ITF,pt.BarcodeFormat.ITF],[_e.EAN_13,pt.BarcodeFormat.EAN_13],[_e.EAN_8,pt.BarcodeFormat.EAN_8],[_e.PDF_417,pt.BarcodeFormat.PDF_417],[_e.RSS_14,pt.BarcodeFormat.RSS_14],[_e.RSS_EXPANDED,pt.BarcodeFormat.RSS_EXPANDED],[_e.UPC_A,pt.BarcodeFormat.UPC_A],[_e.UPC_E,pt.BarcodeFormat.UPC_E],[_e.UPC_EAN_EXTENSION,pt.BarcodeFormat.UPC_EAN_EXTENSION]]),this.reverseFormatMap=this.createReverseFormatMap(),!nm)throw"Use html5qrcode.min.js without edit, ZXing not found.";this.verbose=i,this.logger=s;var u=this.createZXingFormats(l),f=new Map;f.set(pt.DecodeHintType.POSSIBLE_FORMATS,u),f.set(pt.DecodeHintType.TRY_HARDER,!1),this.hints=f}return a.prototype.decodeAsync=function(l){var i=this;return new Promise(function(s,u){try{s(i.decode(l))}catch(f){u(f)}})},a.prototype.decode=function(l){var i=new pt.MultiFormatReader(this.verbose,this.hints),s=new pt.HTMLCanvasElementLuminanceSource(l),u=new pt.BinaryBitmap(new pt.HybridBinarizer(s)),f=i.decode(u);return{text:f.text,format:Ea.create(this.toHtml5QrcodeSupportedFormats(f.format)),debugData:this.createDebugData()}},a.prototype.createReverseFormatMap=function(){var l=new Map;return this.formatMap.forEach(function(i,s,u){l.set(i,s)}),l},a.prototype.toHtml5QrcodeSupportedFormats=function(l){if(!this.reverseFormatMap.has(l))throw"reverseFormatMap doesn't have ".concat(l);return this.reverseFormatMap.get(l)},a.prototype.createZXingFormats=function(l){for(var i=[],s=0,u=l;s<u.length;s++){var f=u[s];this.formatMap.has(f)?i.push(this.formatMap.get(f)):this.logger.logError("".concat(f," is not supported by")+"ZXingHtml5QrcodeShim")}return i},a.prototype.createDebugData=function(){return{decoderName:"zxing-js"}},a}(),rm=function(a,l,i,s){function u(f){return f instanceof i?f:new i(function(m){m(f)})}return new(i||(i=Promise))(function(f,m){function p(C){try{x(s.next(C))}catch(y){m(y)}}function _(C){try{x(s.throw(C))}catch(y){m(y)}}function x(C){C.done?f(C.value):u(C.value).then(p,_)}x((s=s.apply(a,l||[])).next())})},im=function(a,l){var i={label:0,sent:function(){if(f[0]&1)throw f[1];return f[1]},trys:[],ops:[]},s,u,f,m;return m={next:p(0),throw:p(1),return:p(2)},typeof Symbol=="function"&&(m[Symbol.iterator]=function(){return this}),m;function p(x){return function(C){return _([x,C])}}function _(x){if(s)throw new TypeError("Generator is already executing.");for(;m&&(m=0,x[0]&&(i=0)),i;)try{if(s=1,u&&(f=x[0]&2?u.return:x[0]?u.throw||((f=u.return)&&f.call(u),0):u.next)&&!(f=f.call(u,x[1])).done)return f;switch(u=0,f&&(x=[x[0]&2,f.value]),x[0]){case 0:case 1:f=x;break;case 4:return i.label++,{value:x[1],done:!1};case 5:i.label++,u=x[1],x=[0];continue;case 7:x=i.ops.pop(),i.trys.pop();continue;default:if(f=i.trys,!(f=f.length>0&&f[f.length-1])&&(x[0]===6||x[0]===2)){i=0;continue}if(x[0]===3&&(!f||x[1]>f[0]&&x[1]<f[3])){i.label=x[1];break}if(x[0]===6&&i.label<f[1]){i.label=f[1],f=x;break}if(f&&i.label<f[2]){i.label=f[2],i.ops.push(x);break}f[2]&&i.ops.pop(),i.trys.pop();continue}x=l.call(a,i)}catch(C){x=[6,C],u=0}finally{s=f=0}if(x[0]&5)throw x[1];return{value:x[0]?x[1]:void 0,done:!0}}},Sa=function(){function a(l,i,s){if(this.formatMap=new Map([[_e.QR_CODE,"qr_code"],[_e.AZTEC,"aztec"],[_e.CODABAR,"codabar"],[_e.CODE_39,"code_39"],[_e.CODE_93,"code_93"],[_e.CODE_128,"code_128"],[_e.DATA_MATRIX,"data_matrix"],[_e.ITF,"itf"],[_e.EAN_13,"ean_13"],[_e.EAN_8,"ean_8"],[_e.PDF_417,"pdf417"],[_e.UPC_A,"upc_a"],[_e.UPC_E,"upc_e"]]),this.reverseFormatMap=this.createReverseFormatMap(),!a.isSupported())throw"Use html5qrcode.min.js without edit, Use BarcodeDetectorDelegate only if it isSupported();";this.verbose=i,this.logger=s;var u=this.createBarcodeDetectorFormats(l);if(this.detector=new BarcodeDetector(u),!this.detector)throw"BarcodeDetector detector not supported"}return a.isSupported=function(){if(!("BarcodeDetector"in window))return!1;var l=new BarcodeDetector({formats:["qr_code"]});return typeof l<"u"},a.prototype.decodeAsync=function(l){return rm(this,void 0,void 0,function(){var i,s;return im(this,function(u){switch(u.label){case 0:return[4,this.detector.detect(l)];case 1:if(i=u.sent(),!i||i.length===0)throw"No barcode or QR code detected.";return s=this.selectLargestBarcode(i),[2,{text:s.rawValue,format:Ea.create(this.toHtml5QrcodeSupportedFormats(s.format)),debugData:this.createDebugData()}]}})})},a.prototype.selectLargestBarcode=function(l){for(var i=null,s=0,u=0,f=l;u<f.length;u++){var m=f[u],p=m.boundingBox.width*m.boundingBox.height;p>s&&(s=p,i=m)}if(!i)throw"No largest barcode found";return i},a.prototype.createBarcodeDetectorFormats=function(l){for(var i=[],s=0,u=l;s<u.length;s++){var f=u[s];this.formatMap.has(f)?i.push(this.formatMap.get(f)):this.logger.warn("".concat(f," is not supported by")+"BarcodeDetectorDelegate")}return{formats:i}},a.prototype.toHtml5QrcodeSupportedFormats=function(l){if(!this.reverseFormatMap.has(l))throw"reverseFormatMap doesn't have ".concat(l);return this.reverseFormatMap.get(l)},a.prototype.createReverseFormatMap=function(){var l=new Map;return this.formatMap.forEach(function(i,s,u){l.set(i,s)}),l},a.prototype.createDebugData=function(){return{decoderName:"BarcodeDetector"}},a}(),Ia=function(a,l,i,s){function u(f){return f instanceof i?f:new i(function(m){m(f)})}return new(i||(i=Promise))(function(f,m){function p(C){try{x(s.next(C))}catch(y){m(y)}}function _(C){try{x(s.throw(C))}catch(y){m(y)}}function x(C){C.done?f(C.value):u(C.value).then(p,_)}x((s=s.apply(a,l||[])).next())})},Na=function(a,l){var i={label:0,sent:function(){if(f[0]&1)throw f[1];return f[1]},trys:[],ops:[]},s,u,f,m;return m={next:p(0),throw:p(1),return:p(2)},typeof Symbol=="function"&&(m[Symbol.iterator]=function(){return this}),m;function p(x){return function(C){return _([x,C])}}function _(x){if(s)throw new TypeError("Generator is already executing.");for(;m&&(m=0,x[0]&&(i=0)),i;)try{if(s=1,u&&(f=x[0]&2?u.return:x[0]?u.throw||((f=u.return)&&f.call(u),0):u.next)&&!(f=f.call(u,x[1])).done)return f;switch(u=0,f&&(x=[x[0]&2,f.value]),x[0]){case 0:case 1:f=x;break;case 4:return i.label++,{value:x[1],done:!1};case 5:i.label++,u=x[1],x=[0];continue;case 7:x=i.ops.pop(),i.trys.pop();continue;default:if(f=i.trys,!(f=f.length>0&&f[f.length-1])&&(x[0]===6||x[0]===2)){i=0;continue}if(x[0]===3&&(!f||x[1]>f[0]&&x[1]<f[3])){i.label=x[1];break}if(x[0]===6&&i.label<f[1]){i.label=f[1],f=x;break}if(f&&i.label<f[2]){i.label=f[2],i.ops.push(x);break}f[2]&&i.ops.pop(),i.trys.pop();continue}x=l.call(a,i)}catch(C){x=[6,C],u=0}finally{s=f=0}if(x[0]&5)throw x[1];return{value:x[0]?x[1]:void 0,done:!0}}},om=function(){function a(l,i,s,u){this.EXECUTIONS_TO_REPORT_PERFORMANCE=100,this.executions=0,this.executionResults=[],this.wasPrimaryDecoderUsedInLastDecode=!1,this.verbose=s,i&&Sa.isSupported()?(this.primaryDecoder=new Sa(l,s,u),this.secondaryDecoder=new Aa(l,s,u)):this.primaryDecoder=new Aa(l,s,u)}return a.prototype.decodeAsync=function(l){return Ia(this,void 0,void 0,function(){var i;return Na(this,function(s){switch(s.label){case 0:i=performance.now(),s.label=1;case 1:return s.trys.push([1,,3,4]),[4,this.getDecoder().decodeAsync(l)];case 2:return[2,s.sent()];case 3:return this.possiblyLogPerformance(i),[7];case 4:return[2]}})})},a.prototype.decodeRobustlyAsync=function(l){return Ia(this,void 0,void 0,function(){var i,s;return Na(this,function(u){switch(u.label){case 0:i=performance.now(),u.label=1;case 1:return u.trys.push([1,3,4,5]),[4,this.primaryDecoder.decodeAsync(l)];case 2:return[2,u.sent()];case 3:if(s=u.sent(),this.secondaryDecoder)return[2,this.secondaryDecoder.decodeAsync(l)];throw s;case 4:return this.possiblyLogPerformance(i),[7];case 5:return[2]}})})},a.prototype.getDecoder=function(){return this.secondaryDecoder?this.wasPrimaryDecoderUsedInLastDecode===!1?(this.wasPrimaryDecoderUsedInLastDecode=!0,this.primaryDecoder):(this.wasPrimaryDecoderUsedInLastDecode=!1,this.secondaryDecoder):this.primaryDecoder},a.prototype.possiblyLogPerformance=function(l){if(this.verbose){var i=performance.now()-l;this.executionResults.push(i),this.executions++,this.possiblyFlushPerformanceReport()}},a.prototype.possiblyFlushPerformanceReport=function(){if(!(this.executions<this.EXECUTIONS_TO_REPORT_PERFORMANCE)){for(var l=0,i=0,s=this.executionResults;i<s.length;i++){var u=s[i];l+=u}var f=l/this.executionResults.length;console.log("".concat(f," ms for ").concat(this.executionResults.length," last runs.")),this.executions=0,this.executionResults=[]}},a}(),Io=function(){var a=function(l,i){return a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(s,u){s.__proto__=u}||function(s,u){for(var f in u)Object.prototype.hasOwnProperty.call(u,f)&&(s[f]=u[f])},a(l,i)};return function(l,i){if(typeof i!="function"&&i!==null)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");a(l,i);function s(){this.constructor=l}l.prototype=i===null?Object.create(i):(s.prototype=i.prototype,new s)}}(),Si=function(a,l,i,s){function u(f){return f instanceof i?f:new i(function(m){m(f)})}return new(i||(i=Promise))(function(f,m){function p(C){try{x(s.next(C))}catch(y){m(y)}}function _(C){try{x(s.throw(C))}catch(y){m(y)}}function x(C){C.done?f(C.value):u(C.value).then(p,_)}x((s=s.apply(a,l||[])).next())})},Ii=function(a,l){var i={label:0,sent:function(){if(f[0]&1)throw f[1];return f[1]},trys:[],ops:[]},s,u,f,m;return m={next:p(0),throw:p(1),return:p(2)},typeof Symbol=="function"&&(m[Symbol.iterator]=function(){return this}),m;function p(x){return function(C){return _([x,C])}}function _(x){if(s)throw new TypeError("Generator is already executing.");for(;m&&(m=0,x[0]&&(i=0)),i;)try{if(s=1,u&&(f=x[0]&2?u.return:x[0]?u.throw||((f=u.return)&&f.call(u),0):u.next)&&!(f=f.call(u,x[1])).done)return f;switch(u=0,f&&(x=[x[0]&2,f.value]),x[0]){case 0:case 1:f=x;break;case 4:return i.label++,{value:x[1],done:!1};case 5:i.label++,u=x[1],x=[0];continue;case 7:x=i.ops.pop(),i.trys.pop();continue;default:if(f=i.trys,!(f=f.length>0&&f[f.length-1])&&(x[0]===6||x[0]===2)){i=0;continue}if(x[0]===3&&(!f||x[1]>f[0]&&x[1]<f[3])){i.label=x[1];break}if(x[0]===6&&i.label<f[1]){i.label=f[1],f=x;break}if(f&&i.label<f[2]){i.label=f[2],i.ops.push(x);break}f[2]&&i.ops.pop(),i.trys.pop();continue}x=l.call(a,i)}catch(C){x=[6,C],u=0}finally{s=f=0}if(x[0]&5)throw x[1];return{value:x[0]?x[1]:void 0,done:!0}}},Ta=function(){function a(l,i){this.name=l,this.track=i}return a.prototype.isSupported=function(){return this.track.getCapabilities?this.name in this.track.getCapabilities():!1},a.prototype.apply=function(l){var i={};i[this.name]=l;var s={advanced:[i]};return this.track.applyConstraints(s)},a.prototype.value=function(){var l=this.track.getSettings();if(this.name in l){var i=l[this.name];return i}return null},a}(),sm=function(a){Io(l,a);function l(i,s){return a.call(this,i,s)||this}return l.prototype.min=function(){return this.getCapabilities().min},l.prototype.max=function(){return this.getCapabilities().max},l.prototype.step=function(){return this.getCapabilities().step},l.prototype.apply=function(i){var s={};s[this.name]=i;var u={advanced:[s]};return this.track.applyConstraints(u)},l.prototype.getCapabilities=function(){this.failIfNotSupported();var i=this.track.getCapabilities(),s=i[this.name];return{min:s.min,max:s.max,step:s.step}},l.prototype.failIfNotSupported=function(){if(!this.isSupported())throw new Error("".concat(this.name," capability not supported"))},l}(Ta),am=function(a){Io(l,a);function l(i){return a.call(this,"zoom",i)||this}return l}(sm),lm=function(a){Io(l,a);function l(i){return a.call(this,"torch",i)||this}return l}(Ta),cm=function(){function a(l){this.track=l}return a.prototype.zoomFeature=function(){return new am(this.track)},a.prototype.torchFeature=function(){return new lm(this.track)},a}(),dm=function(){function a(l,i,s){this.isClosed=!1,this.parentElement=l,this.mediaStream=i,this.callbacks=s,this.surface=this.createVideoElement(this.parentElement.clientWidth),l.append(this.surface)}return a.prototype.createVideoElement=function(l){var i=document.createElement("video");return i.style.width="".concat(l,"px"),i.style.display="block",i.muted=!0,i.setAttribute("muted","true"),i.playsInline=!0,i},a.prototype.setupSurface=function(){var l=this;this.surface.onabort=function(){throw"RenderedCameraImpl video surface onabort() called"},this.surface.onerror=function(){throw"RenderedCameraImpl video surface onerror() called"};var i=function(){var s=l.surface.clientWidth,u=l.surface.clientHeight;l.callbacks.onRenderSurfaceReady(s,u),l.surface.removeEventListener("playing",i)};this.surface.addEventListener("playing",i),this.surface.srcObject=this.mediaStream,this.surface.play()},a.create=function(l,i,s,u){return Si(this,void 0,void 0,function(){var f,m;return Ii(this,function(p){switch(p.label){case 0:return f=new a(l,i,u),s.aspectRatio?(m={aspectRatio:s.aspectRatio},[4,f.getFirstTrackOrFail().applyConstraints(m)]):[3,2];case 1:p.sent(),p.label=2;case 2:return f.setupSurface(),[2,f]}})})},a.prototype.failIfClosed=function(){if(this.isClosed)throw"The RenderedCamera has already been closed."},a.prototype.getFirstTrackOrFail=function(){if(this.failIfClosed(),this.mediaStream.getVideoTracks().length===0)throw"No video tracks found";return this.mediaStream.getVideoTracks()[0]},a.prototype.pause=function(){this.failIfClosed(),this.surface.pause()},a.prototype.resume=function(l){this.failIfClosed();var i=this,s=function(){setTimeout(l,200),i.surface.removeEventListener("playing",s)};this.surface.addEventListener("playing",s),this.surface.play()},a.prototype.isPaused=function(){return this.failIfClosed(),this.surface.paused},a.prototype.getSurface=function(){return this.failIfClosed(),this.surface},a.prototype.getRunningTrackCapabilities=function(){return this.getFirstTrackOrFail().getCapabilities()},a.prototype.getRunningTrackSettings=function(){return this.getFirstTrackOrFail().getSettings()},a.prototype.applyVideoConstraints=function(l){return Si(this,void 0,void 0,function(){return Ii(this,function(i){if("aspectRatio"in l)throw"Changing 'aspectRatio' in run-time is not yet supported.";return[2,this.getFirstTrackOrFail().applyConstraints(l)]})})},a.prototype.close=function(){if(this.isClosed)return Promise.resolve();var l=this;return new Promise(function(i,s){var u=l.mediaStream.getVideoTracks(),f=u.length,m=0;l.mediaStream.getVideoTracks().forEach(function(p){l.mediaStream.removeTrack(p),p.stop(),++m,m>=f&&(l.isClosed=!0,l.parentElement.removeChild(l.surface),i())})})},a.prototype.getCapabilities=function(){return new cm(this.getFirstTrackOrFail())},a}(),um=function(){function a(l){this.mediaStream=l}return a.prototype.render=function(l,i,s){return Si(this,void 0,void 0,function(){return Ii(this,function(u){return[2,dm.create(l,this.mediaStream,i,s)]})})},a.create=function(l){return Si(this,void 0,void 0,function(){var i,s;return Ii(this,function(u){switch(u.label){case 0:if(!navigator.mediaDevices)throw"navigator.mediaDevices not supported";return i={audio:!1,video:l},[4,navigator.mediaDevices.getUserMedia(i)];case 1:return s=u.sent(),[2,new a(s)]}})})},a}(),ka=function(a,l,i,s){function u(f){return f instanceof i?f:new i(function(m){m(f)})}return new(i||(i=Promise))(function(f,m){function p(C){try{x(s.next(C))}catch(y){m(y)}}function _(C){try{x(s.throw(C))}catch(y){m(y)}}function x(C){C.done?f(C.value):u(C.value).then(p,_)}x((s=s.apply(a,l||[])).next())})},Ra=function(a,l){var i={label:0,sent:function(){if(f[0]&1)throw f[1];return f[1]},trys:[],ops:[]},s,u,f,m;return m={next:p(0),throw:p(1),return:p(2)},typeof Symbol=="function"&&(m[Symbol.iterator]=function(){return this}),m;function p(x){return function(C){return _([x,C])}}function _(x){if(s)throw new TypeError("Generator is already executing.");for(;m&&(m=0,x[0]&&(i=0)),i;)try{if(s=1,u&&(f=x[0]&2?u.return:x[0]?u.throw||((f=u.return)&&f.call(u),0):u.next)&&!(f=f.call(u,x[1])).done)return f;switch(u=0,f&&(x=[x[0]&2,f.value]),x[0]){case 0:case 1:f=x;break;case 4:return i.label++,{value:x[1],done:!1};case 5:i.label++,u=x[1],x=[0];continue;case 7:x=i.ops.pop(),i.trys.pop();continue;default:if(f=i.trys,!(f=f.length>0&&f[f.length-1])&&(x[0]===6||x[0]===2)){i=0;continue}if(x[0]===3&&(!f||x[1]>f[0]&&x[1]<f[3])){i.label=x[1];break}if(x[0]===6&&i.label<f[1]){i.label=f[1],f=x;break}if(f&&i.label<f[2]){i.label=f[2],i.ops.push(x);break}f[2]&&i.ops.pop(),i.trys.pop();continue}x=l.call(a,i)}catch(C){x=[6,C],u=0}finally{s=f=0}if(x[0]&5)throw x[1];return{value:x[0]?x[1]:void 0,done:!0}}},fm=function(){function a(){}return a.failIfNotSupported=function(){return ka(this,void 0,void 0,function(){return Ra(this,function(l){if(!navigator.mediaDevices)throw"navigator.mediaDevices not supported";return[2,new a]})})},a.prototype.create=function(l){return ka(this,void 0,void 0,function(){return Ra(this,function(i){return[2,um.create(l)]})})},a}(),hm=function(a,l,i,s){function u(f){return f instanceof i?f:new i(function(m){m(f)})}return new(i||(i=Promise))(function(f,m){function p(C){try{x(s.next(C))}catch(y){m(y)}}function _(C){try{x(s.throw(C))}catch(y){m(y)}}function x(C){C.done?f(C.value):u(C.value).then(p,_)}x((s=s.apply(a,l||[])).next())})},mm=function(a,l){var i={label:0,sent:function(){if(f[0]&1)throw f[1];return f[1]},trys:[],ops:[]},s,u,f,m;return m={next:p(0),throw:p(1),return:p(2)},typeof Symbol=="function"&&(m[Symbol.iterator]=function(){return this}),m;function p(x){return function(C){return _([x,C])}}function _(x){if(s)throw new TypeError("Generator is already executing.");for(;m&&(m=0,x[0]&&(i=0)),i;)try{if(s=1,u&&(f=x[0]&2?u.return:x[0]?u.throw||((f=u.return)&&f.call(u),0):u.next)&&!(f=f.call(u,x[1])).done)return f;switch(u=0,f&&(x=[x[0]&2,f.value]),x[0]){case 0:case 1:f=x;break;case 4:return i.label++,{value:x[1],done:!1};case 5:i.label++,u=x[1],x=[0];continue;case 7:x=i.ops.pop(),i.trys.pop();continue;default:if(f=i.trys,!(f=f.length>0&&f[f.length-1])&&(x[0]===6||x[0]===2)){i=0;continue}if(x[0]===3&&(!f||x[1]>f[0]&&x[1]<f[3])){i.label=x[1];break}if(x[0]===6&&i.label<f[1]){i.label=f[1],f=x;break}if(f&&i.label<f[2]){i.label=f[2],i.ops.push(x);break}f[2]&&i.ops.pop(),i.trys.pop();continue}x=l.call(a,i)}catch(C){x=[6,C],u=0}finally{s=f=0}if(x[0]&5)throw x[1];return{value:x[0]?x[1]:void 0,done:!0}}},gm=function(){function a(){}return a.retrieve=function(){if(navigator.mediaDevices)return a.getCamerasFromMediaDevices();var l=MediaStreamTrack;return MediaStreamTrack&&l.getSources?a.getCamerasFromMediaStreamTrack():a.rejectWithError()},a.rejectWithError=function(){var l=Er.unableToQuerySupportedDevices();return a.isHttpsOrLocalhost()||(l=Er.insecureContextCameraQueryError()),Promise.reject(l)},a.isHttpsOrLocalhost=function(){if(location.protocol==="https:")return!0;var l=location.host.split(":")[0];return l==="127.0.0.1"||l==="localhost"},a.getCamerasFromMediaDevices=function(){return hm(this,void 0,void 0,function(){var l,i,s,u,f,m,p;return mm(this,function(_){switch(_.label){case 0:return l=function(x){for(var C=x.getVideoTracks(),y=0,I=C;y<I.length;y++){var O=I[y];O.enabled=!1,O.stop(),x.removeTrack(O)}},[4,navigator.mediaDevices.getUserMedia({audio:!1,video:!0})];case 1:return i=_.sent(),[4,navigator.mediaDevices.enumerateDevices()];case 2:for(s=_.sent(),u=[],f=0,m=s;f<m.length;f++)p=m[f],p.kind==="videoinput"&&u.push({id:p.deviceId,label:p.label});return l(i),[2,u]}})})},a.getCamerasFromMediaStreamTrack=function(){return new Promise(function(l,i){var s=function(f){for(var m=[],p=0,_=f;p<_.length;p++){var x=_[p];x.kind==="video"&&m.push({id:x.id,label:x.label})}l(m)},u=MediaStreamTrack;u.getSources(s)})},a}(),It;(function(a){a[a.UNKNOWN=0]="UNKNOWN",a[a.NOT_STARTED=1]="NOT_STARTED",a[a.SCANNING=2]="SCANNING",a[a.PAUSED=3]="PAUSED"})(It||(It={}));var pm=function(){function a(){this.state=It.NOT_STARTED,this.onGoingTransactionNewState=It.UNKNOWN}return a.prototype.directTransition=function(l){this.failIfTransitionOngoing(),this.validateTransition(l),this.state=l},a.prototype.startTransition=function(l){return this.failIfTransitionOngoing(),this.validateTransition(l),this.onGoingTransactionNewState=l,this},a.prototype.execute=function(){if(this.onGoingTransactionNewState===It.UNKNOWN)throw"Transaction is already cancelled, cannot execute().";var l=this.onGoingTransactionNewState;this.onGoingTransactionNewState=It.UNKNOWN,this.directTransition(l)},a.prototype.cancel=function(){if(this.onGoingTransactionNewState===It.UNKNOWN)throw"Transaction is already cancelled, cannot cancel().";this.onGoingTransactionNewState=It.UNKNOWN},a.prototype.getState=function(){return this.state},a.prototype.failIfTransitionOngoing=function(){if(this.onGoingTransactionNewState!==It.UNKNOWN)throw"Cannot transition to a new state, already under transition"},a.prototype.validateTransition=function(l){switch(this.state){case It.UNKNOWN:throw"Transition from unknown is not allowed";case It.NOT_STARTED:this.failIfNewStateIs(l,[It.PAUSED]);break;case It.SCANNING:break;case It.PAUSED:break}},a.prototype.failIfNewStateIs=function(l,i){for(var s=0,u=i;s<u.length;s++){var f=u[s];if(l===f)throw"Cannot transition from ".concat(this.state," to ").concat(l)}},a}(),xm=function(){function a(l){this.stateManager=l}return a.prototype.startTransition=function(l){return this.stateManager.startTransition(l)},a.prototype.directTransition=function(l){this.stateManager.directTransition(l)},a.prototype.getState=function(){return this.stateManager.getState()},a.prototype.canScanFile=function(){return this.stateManager.getState()===It.NOT_STARTED},a.prototype.isScanning=function(){return this.stateManager.getState()!==It.NOT_STARTED},a.prototype.isStrictlyScanning=function(){return this.stateManager.getState()===It.SCANNING},a.prototype.isPaused=function(){return this.stateManager.getState()===It.PAUSED},a}(),_m=function(){function a(){}return a.create=function(){return new xm(new pm)},a}(),wm=function(){var a=function(l,i){return a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(s,u){s.__proto__=u}||function(s,u){for(var f in u)Object.prototype.hasOwnProperty.call(u,f)&&(s[f]=u[f])},a(l,i)};return function(l,i){if(typeof i!="function"&&i!==null)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");a(l,i);function s(){this.constructor=l}l.prototype=i===null?Object.create(i):(s.prototype=i.prototype,new s)}}(),cn=function(a){wm(l,a);function l(){return a!==null&&a.apply(this,arguments)||this}return l.DEFAULT_WIDTH=300,l.DEFAULT_WIDTH_OFFSET=2,l.FILE_SCAN_MIN_HEIGHT=300,l.FILE_SCAN_HIDDEN_CANVAS_PADDING=100,l.MIN_QR_BOX_SIZE=50,l.SHADED_LEFT=1,l.SHADED_RIGHT=2,l.SHADED_TOP=3,l.SHADED_BOTTOM=4,l.SHADED_REGION_ELEMENT_ID="qr-shaded-region",l.VERBOSE=!1,l.BORDER_SHADER_DEFAULT_COLOR="#ffffff",l.BORDER_SHADER_MATCH_COLOR="rgb(90, 193, 56)",l}(J2),Cm=function(){function a(l,i){this.logger=i,this.fps=cn.SCAN_DEFAULT_FPS,l?(l.fps&&(this.fps=l.fps),this.disableFlip=l.disableFlip===!0,this.qrbox=l.qrbox,this.aspectRatio=l.aspectRatio,this.videoConstraints=l.videoConstraints):this.disableFlip=cn.DEFAULT_DISABLE_FLIP}return a.prototype.isMediaStreamConstraintsValid=function(){return this.videoConstraints?ba.isMediaStreamConstraintsValid(this.videoConstraints,this.logger):(this.logger.logError("Empty videoConstraints",!0),!1)},a.prototype.isShadedBoxEnabled=function(){return!Un(this.qrbox)},a.create=function(l,i){return new a(l,i)},a}(),Ba=function(){function a(l,i){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(l))throw"HTML Element with id=".concat(l," not found");this.elementId=l,this.verbose=!1;var s;typeof i=="boolean"?this.verbose=i===!0:i&&(s=i,this.verbose=s.verbose===!0,s.experimentalFeatures),this.logger=new tm(this.verbose),this.qrcode=new om(this.getSupportedFormats(i),this.getUseBarCodeDetectorIfSupported(s),this.verbose,this.logger),this.foreverScanTimeout,this.shouldScan=!0,this.stateManagerProxy=_m.create()}return a.prototype.start=function(l,i,s,u){var f=this;if(!l)throw"cameraIdOrConfig is required";if(!s||typeof s!="function")throw"qrCodeSuccessCallback is required and should be a function.";var m;u?m=u:m=this.verbose?this.logger.log:function(){};var p=Cm.create(i,this.logger);this.clearElement();var _=!1;p.videoConstraints&&(p.isMediaStreamConstraintsValid()?_=!0:this.logger.logError("'videoConstraints' is not valid 'MediaStreamConstraints, it will be ignored.'",!0));var x=_,C=document.getElementById(this.elementId);C.clientWidth?C.clientWidth:cn.DEFAULT_WIDTH,C.style.position="relative",this.shouldScan=!0,this.element=C;var y=this,I=this.stateManagerProxy.startTransition(It.SCANNING);return new Promise(function(O,T){var D=x?p.videoConstraints:y.createVideoConstraints(l);if(!D){I.cancel(),T("videoConstraints should be defined");return}var k={};(!x||p.aspectRatio)&&(k.aspectRatio=p.aspectRatio);var P={onRenderSurfaceReady:function(M,v){y.setupUi(M,v,p),y.isScanning=!0,y.foreverScan(p,s,m)}};fm.failIfNotSupported().then(function(M){M.create(D).then(function(v){return v.render(f.element,k,P).then(function(W){y.renderedCamera=W,I.execute(),O(null)}).catch(function(W){I.cancel(),T(W)})}).catch(function(v){I.cancel(),T(Er.errorGettingUserMedia(v))})}).catch(function(M){I.cancel(),T(Er.cameraStreamingNotSupported())})})},a.prototype.pause=function(l){if(!this.stateManagerProxy.isStrictlyScanning())throw"Cannot pause, scanner is not scanning.";this.stateManagerProxy.directTransition(It.PAUSED),this.showPausedState(),(Un(l)||l!==!0)&&(l=!1),l&&this.renderedCamera&&this.renderedCamera.pause()},a.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 l=this,i=function(){l.stateManagerProxy.directTransition(It.SCANNING),l.hidePausedState()};if(!this.renderedCamera.isPaused()){i();return}this.renderedCamera.resume(function(){i()})},a.prototype.getState=function(){return this.stateManagerProxy.getState()},a.prototype.stop=function(){var l=this;if(!this.stateManagerProxy.isScanning())throw"Cannot stop, scanner is not running or paused.";var i=this.stateManagerProxy.startTransition(It.NOT_STARTED);this.shouldScan=!1,this.foreverScanTimeout&&clearTimeout(this.foreverScanTimeout);var s=function(){if(l.element){var f=document.getElementById(cn.SHADED_REGION_ELEMENT_ID);f&&l.element.removeChild(f)}},u=this;return this.renderedCamera.close().then(function(){return u.renderedCamera=null,u.element&&(u.element.removeChild(u.canvasElement),u.canvasElement=null),s(),u.qrRegion&&(u.qrRegion=null),u.context&&(u.context=null),i.execute(),u.hidePausedState(),u.isScanning=!1,Promise.resolve()})},a.prototype.scanFile=function(l,i){return this.scanFileV2(l,i).then(function(s){return s.decodedText})},a.prototype.scanFileV2=function(l,i){var s=this;if(!l||!(l instanceof File))throw"imageFile argument is mandatory and should be instance of File. Use 'event.target.files[0]'.";if(Un(i)&&(i=!0),!this.stateManagerProxy.canScanFile())throw"Cannot start file scan - ongoing camera scan";return new Promise(function(u,f){s.possiblyCloseLastScanImageFile(),s.clearElement(),s.lastScanImageFile=URL.createObjectURL(l);var m=new Image;m.onload=function(){var p=m.width,_=m.height,x=document.getElementById(s.elementId),C=x.clientWidth?x.clientWidth:cn.DEFAULT_WIDTH,y=Math.max(x.clientHeight?x.clientHeight:_,cn.FILE_SCAN_MIN_HEIGHT),I=s.computeCanvasDrawConfig(p,_,C,y);if(i){var O=s.createCanvasElement(C,y,"qr-canvas-visible");O.style.display="inline-block",x.appendChild(O);var T=O.getContext("2d");if(!T)throw"Unable to get 2d context from canvas";T.canvas.width=C,T.canvas.height=y,T.drawImage(m,0,0,p,_,I.x,I.y,I.width,I.height)}var D=cn.FILE_SCAN_HIDDEN_CANVAS_PADDING,k=Math.max(m.width,I.width),P=Math.max(m.height,I.height),M=k+2*D,v=P+2*D,W=s.createCanvasElement(M,v);x.appendChild(W);var X=W.getContext("2d");if(!X)throw"Unable to get 2d context from canvas";X.canvas.width=M,X.canvas.height=v,X.drawImage(m,0,0,p,_,D,D,k,P);try{s.qrcode.decodeRobustlyAsync(W).then(function(Z){u(ya.createFromQrcodeResult(Z))}).catch(f)}catch(Z){f("QR code parse error, error = ".concat(Z))}},m.onerror=f,m.onabort=f,m.onstalled=f,m.onsuspend=f,m.src=URL.createObjectURL(l)})},a.prototype.clear=function(){this.clearElement()},a.getCameras=function(){return gm.retrieve()},a.prototype.getRunningTrackCapabilities=function(){return this.getRenderedCameraOrFail().getRunningTrackCapabilities()},a.prototype.getRunningTrackSettings=function(){return this.getRenderedCameraOrFail().getRunningTrackSettings()},a.prototype.getRunningTrackCameraCapabilities=function(){return this.getRenderedCameraOrFail().getCapabilities()},a.prototype.applyVideoConstraints=function(l){if(l){if(!ba.isMediaStreamConstraintsValid(l,this.logger))throw"invalid videoConstaints passed, check logs for more details"}else throw"videoConstaints is required argument.";return this.getRenderedCameraOrFail().applyVideoConstraints(l)},a.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},a.prototype.getSupportedFormats=function(l){var i=[_e.QR_CODE,_e.AZTEC,_e.CODABAR,_e.CODE_39,_e.CODE_93,_e.CODE_128,_e.DATA_MATRIX,_e.MAXICODE,_e.ITF,_e.EAN_13,_e.EAN_8,_e.PDF_417,_e.RSS_14,_e.RSS_EXPANDED,_e.UPC_A,_e.UPC_E,_e.UPC_EAN_EXTENSION];if(!l||typeof l=="boolean"||!l.formatsToSupport)return i;if(!Array.isArray(l.formatsToSupport))throw"configOrVerbosityFlag.formatsToSupport should be undefined or an array.";if(l.formatsToSupport.length===0)throw"Atleast 1 formatsToSupport is needed.";for(var s=[],u=0,f=l.formatsToSupport;u<f.length;u++){var m=f[u];Q2(m)?s.push(m):this.logger.warn("Invalid format: ".concat(m," passed in config, ignoring."))}if(s.length===0)throw"None of formatsToSupport match supported values.";return s},a.prototype.getUseBarCodeDetectorIfSupported=function(l){if(Un(l))return!0;if(!Un(l.useBarCodeDetectorIfSupported))return l.useBarCodeDetectorIfSupported!==!1;if(Un(l.experimentalFeatures))return!0;var i=l.experimentalFeatures;return Un(i.useBarCodeDetectorIfSupported)?!0:i.useBarCodeDetectorIfSupported!==!1},a.prototype.validateQrboxSize=function(l,i,s){var u=this,f=s.qrbox;this.validateQrboxConfig(f);var m=this.toQrdimensions(l,i,f),p=function(x){if(x<cn.MIN_QR_BOX_SIZE)throw"minimum size of 'config.qrbox' dimension value is"+" ".concat(cn.MIN_QR_BOX_SIZE,"px.")},_=function(x){return x>l&&(u.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."),x=l),x};p(m.width),p(m.height),m.width=_(m.width)},a.prototype.validateQrboxConfig=function(l){if(typeof l!="number"&&typeof l!="function"&&(l.width===void 0||l.height===void 0))throw"Invalid instance of QrDimensions passed for 'config.qrbox'. Both 'width' and 'height' should be set."},a.prototype.toQrdimensions=function(l,i,s){if(typeof s=="number")return{width:s,height:s};if(typeof s=="function")try{return s(l,i)}catch(u){throw new Error("qrbox config was passed as a function but it failed with unknown error"+u)}return s},a.prototype.setupUi=function(l,i,s){s.isShadedBoxEnabled()&&this.validateQrboxSize(l,i,s);var u=Un(s.qrbox)?{width:l,height:i}:s.qrbox;this.validateQrboxConfig(u);var f=this.toQrdimensions(l,i,u);f.height>i&&this.logger.warn("[Html5Qrcode] config.qrbox has height that isgreater than the height of the video stream. Shading will be ignored");var m=s.isShadedBoxEnabled()&&f.height<=i,p={x:0,y:0,width:l,height:i},_=m?this.getShadedRegionBounds(l,i,f):p,x=this.createCanvasElement(_.width,_.height),C={willReadFrequently:!0},y=x.getContext("2d",C);y.canvas.width=_.width,y.canvas.height=_.height,this.element.append(x),m&&this.possiblyInsertShadingElement(this.element,l,i,f),this.createScannerPausedUiElement(this.element),this.qrRegion=_,this.context=y,this.canvasElement=x},a.prototype.createScannerPausedUiElement=function(l){var i=document.createElement("div");i.innerText=Er.scannerPaused(),i.style.display="none",i.style.position="absolute",i.style.top="0px",i.style.zIndex="1",i.style.background="rgba(9, 9, 9, 0.46)",i.style.color="#FFECEC",i.style.textAlign="center",i.style.width="100%",l.appendChild(i),this.scannerPausedUiElement=i},a.prototype.scanContext=function(l,i){var s=this;return this.stateManagerProxy.isPaused()?Promise.resolve(!1):this.qrcode.decodeAsync(this.canvasElement).then(function(u){return l(u.text,ya.createFromQrcodeResult(u)),s.possiblyUpdateShaders(!0),!0}).catch(function(u){s.possiblyUpdateShaders(!1);var f=Er.codeParseError(u);return i(f,em.createFrom(f)),!1})},a.prototype.foreverScan=function(l,i,s){var u=this;if(this.shouldScan&&this.renderedCamera){var f=this.renderedCamera.getSurface(),m=f.videoWidth/f.clientWidth,p=f.videoHeight/f.clientHeight;if(!this.qrRegion)throw"qrRegion undefined when localMediaStream is ready.";var _=this.qrRegion.width*m,x=this.qrRegion.height*p,C=this.qrRegion.x*m,y=this.qrRegion.y*p;this.context.drawImage(f,C,y,_,x,0,0,this.qrRegion.width,this.qrRegion.height);var I=function(){u.foreverScanTimeout=setTimeout(function(){u.foreverScan(l,i,s)},u.getTimeoutFps(l.fps))};this.scanContext(i,s).then(function(O){!O&&l.disableFlip!==!0?(u.context.translate(u.context.canvas.width,0),u.context.scale(-1,1),u.scanContext(i,s).finally(function(){I()})):I()}).catch(function(O){u.logger.logError("Error happend while scanning context",O),I()})}},a.prototype.createVideoConstraints=function(l){if(typeof l=="string")return{deviceId:{exact:l}};if(typeof l=="object"){var i="facingMode",s="deviceId",u={user:!0,environment:!0},f="exact",m=function(T){if(T in u)return!0;throw"config has invalid 'facingMode' value = "+"'".concat(T,"'")},p=Object.keys(l);if(p.length!==1)throw"'cameraIdOrConfig' object should have exactly 1 key,"+" if passed as an object, found ".concat(p.length," keys");var _=Object.keys(l)[0];if(_!==i&&_!==s)throw"Only '".concat(i,"' and '").concat(s,"' ")+" are supported for 'cameraIdOrConfig'";if(_===i){var x=l.facingMode;if(typeof x=="string"){if(m(x))return{facingMode:x}}else if(typeof x=="object")if(f in x){if(m(x["".concat(f)]))return{facingMode:{exact:x["".concat(f)]}}}else throw"'facingMode' should be string or object with"+" ".concat(f," as key.");else{var C=typeof x;throw"Invalid type of 'facingMode' = ".concat(C)}}else{var y=l.deviceId;if(typeof y=="string")return{deviceId:y};if(typeof y=="object"){if(f in y)return{deviceId:{exact:y["".concat(f)]}};throw"'deviceId' should be string or object with"+" ".concat(f," as key.")}else{var I=typeof y;throw"Invalid type of 'deviceId' = ".concat(I)}}}var O=typeof l;throw"Invalid type of 'cameraIdOrConfig' = ".concat(O)},a.prototype.computeCanvasDrawConfig=function(l,i,s,u){if(l<=s&&i<=u){var f=(s-l)/2,m=(u-i)/2;return{x:f,y:m,width:l,height:i}}else{var p=l,_=i;return l>s&&(i=s/l*i,l=s),i>u&&(l=u/i*l,i=u),this.logger.log("Image downsampled from "+"".concat(p,"X").concat(_)+" to ".concat(l,"X").concat(i,".")),this.computeCanvasDrawConfig(l,i,s,u)}},a.prototype.clearElement=function(){if(this.stateManagerProxy.isScanning())throw"Cannot clear while scan is ongoing, close it first.";var l=document.getElementById(this.elementId);l&&(l.innerHTML="")},a.prototype.possiblyUpdateShaders=function(l){this.qrMatch!==l&&(this.hasBorderShaders&&this.borderShaders&&this.borderShaders.length&&this.borderShaders.forEach(function(i){i.style.backgroundColor=l?cn.BORDER_SHADER_MATCH_COLOR:cn.BORDER_SHADER_DEFAULT_COLOR}),this.qrMatch=l)},a.prototype.possiblyCloseLastScanImageFile=function(){this.lastScanImageFile&&(URL.revokeObjectURL(this.lastScanImageFile),this.lastScanImageFile=null)},a.prototype.createCanvasElement=function(l,i,s){var u=l,f=i,m=document.createElement("canvas");return m.style.width="".concat(u,"px"),m.style.height="".concat(f,"px"),m.style.display="none",m.id=Un(s)?"qr-canvas":s,m},a.prototype.getShadedRegionBounds=function(l,i,s){if(s.width>l||s.height>i)throw"'config.qrbox' dimensions should not be greater than the dimensions of the root HTML element.";return{x:(l-s.width)/2,y:(i-s.height)/2,width:s.width,height:s.height}},a.prototype.possiblyInsertShadingElement=function(l,i,s,u){if(!(i-u.width<1||s-u.height<1)){var f=document.createElement("div");f.style.position="absolute";var m=(i-u.width)/2,p=(s-u.height)/2;if(f.style.borderLeft="".concat(m,"px solid rgba(0, 0, 0, 0.48)"),f.style.borderRight="".concat(m,"px solid rgba(0, 0, 0, 0.48)"),f.style.borderTop="".concat(p,"px solid rgba(0, 0, 0, 0.48)"),f.style.borderBottom="".concat(p,"px solid rgba(0, 0, 0, 0.48)"),f.style.boxSizing="border-box",f.style.top="0px",f.style.bottom="0px",f.style.left="0px",f.style.right="0px",f.id="".concat(cn.SHADED_REGION_ELEMENT_ID),i-u.width<11||s-u.height<11)this.hasBorderShaders=!1;else{var _=5,x=40;this.insertShaderBorders(f,x,_,-_,null,0,!0),this.insertShaderBorders(f,x,_,-_,null,0,!1),this.insertShaderBorders(f,x,_,null,-_,0,!0),this.insertShaderBorders(f,x,_,null,-_,0,!1),this.insertShaderBorders(f,_,x+_,-_,null,-_,!0),this.insertShaderBorders(f,_,x+_,null,-_,-_,!0),this.insertShaderBorders(f,_,x+_,-_,null,-_,!1),this.insertShaderBorders(f,_,x+_,null,-_,-_,!1),this.hasBorderShaders=!0}l.append(f)}},a.prototype.insertShaderBorders=function(l,i,s,u,f,m,p){var _=document.createElement("div");_.style.position="absolute",_.style.backgroundColor=cn.BORDER_SHADER_DEFAULT_COLOR,_.style.width="".concat(i,"px"),_.style.height="".concat(s,"px"),u!==null&&(_.style.top="".concat(u,"px")),f!==null&&(_.style.bottom="".concat(f,"px")),p?_.style.left="".concat(m,"px"):_.style.right="".concat(m,"px"),this.borderShaders||(this.borderShaders=[]),this.borderShaders.push(_),l.appendChild(_)},a.prototype.showPausedState=function(){if(!this.scannerPausedUiElement)throw"[internal error] scanner paused UI element not found";this.scannerPausedUiElement.style.display="block"},a.prototype.hidePausedState=function(){if(!this.scannerPausedUiElement)throw"[internal error] scanner paused UI element not found";this.scannerPausedUiElement.style.display="none"},a.prototype.getTimeoutFps=function(l){return 1e3/l},a}(),Oa;(function(a){a[a.STATUS_DEFAULT=0]="STATUS_DEFAULT",a[a.STATUS_SUCCESS=1]="STATUS_SUCCESS",a[a.STATUS_WARNING=2]="STATUS_WARNING",a[a.STATUS_REQUESTING_PERMISSION=3]="STATUS_REQUESTING_PERMISSION"})(Oa||(Oa={}));const Em={width:"38",height:"38",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"none"},ym=["stroke"],bm=["stroke"],Am=["stroke"],Sm=["stroke"],Im=["stroke"],Nm=r.defineComponent({__name:"QR",props:{color:{type:String,required:!1,default:"#FFFFFF"}},setup(a){return(l,i)=>(r.openBlock(),r.createElementBlock("svg",Em,[r.createElementVNode("path",{d:"M11 11H7V7h4ZM17 7h-2v2h2ZM13 17h4v-4h-4ZM7 17h2v-2H7Z",stroke:a.color,"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"1.5"},null,8,ym),r.createElementVNode("path",{d:"M8 3H4a1 1 0 0 0-1 1V8",stroke:a.color,"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"1.5"},null,8,bm),r.createElementVNode("path",{d:"M21 8V4a1 1 0 0 0-1-1H16",stroke:a.color,"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"1.5"},null,8,Am),r.createElementVNode("path",{d:"M3 16v4a1 1 0 0 0 1 1H8",stroke:a.color,"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"1.5"},null,8,Sm),r.createElementVNode("path",{d:"M16 21h4a1 1 0 0 0 1-1V16",stroke:a.color,"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"1.5"},null,8,Im)]))}}),No={back:["Задняя","Задней","Зад","e pasme","rear","back","atzekoa","задні","отзад","pozadi","cefn","hátulsó","traseira","achterkant","όπισθεν","bag","דערציען","cúil","aftan","trasero","posteriore","posterior","aizmugure","galinis","задниот дел","wara","hinteren","bak","tył","tyl","traseira","spate","задњи","zadný","zadaj","задній","takaosa","arrière","straga","zadní","bak","tagumine","environment","arxa","թիկունք","পিছনে","နောက်ဘက်","ở phía sau","უკანა","પાછળ","артқы","ಹಿಂದಿನ","後部","后部","뒤쪽","ខាងក្រោយ","ຫລັງ","പുറകിലുള്ള","मागील","арын","पछाडि","පසුපස","пушти","หลัง","பின்புறம்","వెనుక","arka","orqa","پیچھے","पिछला","qab","後方","مؤخرة","חלק אחורי","عقب","agter","ngemuva","azụ","leyin","kamorao","gadaale","nyuma","baya","kumbuyo","belakang","aoriana","belakang","muri","luyo","likuran","mburi","dèyè","tergo","malantaŭo"],front:["FaceTime","Передняя","përpara","front","aurrean","пярэдні","отпред","front","blaen","elülső","diante","voorkant","εμπρός","foran","פראָנט","tosaigh","framan","frente","davanti","davant","priekšā","priekyje","напред","quddiem","Vorderseite","front","przód","frente","față","фронт","vpredu","spredaj","перед","edessä","devant","ispred","přední","främre","ees","ön","ճակատ","সামনে","ရှေ့","đằng trước","წინა","આગળ","алдыңғы","ಮುಂಭಾಗ","正面","正面","앞쪽","ខាងមុខ","ດ້ານໜ້າ","മുന്നിൽ","समोर","урд","अगाडि","ඉදිරිපස","пеш","ด้านหน้า","முன்","ముందు","ön","old","سامنے","सामने","pem hauv ntej","フロント","أمام","חֲזִית","جلو","voor","ngaphambili","n'ihu","iwaju","ka pele","hore","mbele","gaba","kutsogolo","depan","anoloana","hadapan","mua","atubangan","harap","ngarep","devan","front","fronto"]},Tm={key:0,class:"qr_text"},km=r.defineComponent({__name:"QrCameraScanner",props:{axiosInstanceGet:{type:[Function,Object]},is_toggleAffiliation:{type:Boolean},is_notification:{type:Boolean},notificationData:{},isQr:{type:[Boolean,null]},takeDataTable:{type:Function}},emits:["update:notificationData","update:is_notification","update:is_toggleAffiliation"],setup(a,{emit:l}){const i=a;let s=null;const u=r.ref(!1),f=r.ref(!1),m=r.ref(!1),p=r.ref(!1);let _=null;const x=St(),{itemThemes:C}=xe.storeToRefs(x),y=l,I=P=>P.replace(/^[\s\S]*?((?:tel|sms|smsto|mailto|callto|facetime|viber|whatsapp):)?[\s\S]*?(%2B)?[\s\S]*?/i,(M,v,W)=>W?"+":""),O=async(P,M)=>{var Z,F,L;if(console.log(P,M),p.value)return;i.isQr||(p.value=!0),k();const v=/[?&]table_id=([a-zA-Z0-9-]+)/,W=P.match(v),X=P.match(/\/([a-f0-9\-]{36})\?/);if(i.isQr){if(W&&X)return(Z=i.takeDataTable)==null?void 0:Z.call(i,X[1],W[1],"qr");{const V=localStorage.getItem("orgID");if(V){const ie=await i.axiosInstanceGet.get(`org_unit/${V}/table`,{params:{external_link:P}}).then(K=>{var ee,G;return((ee=K.data)==null?void 0:ee.length)>0?(G=K.data[0])==null?void 0:G.id:null}).catch(()=>null);if(ie)return(F=i.takeDataTable)==null?void 0:F.call(i,V,ie)}}y("update:is_notification",!0),y("update:notificationData",{textNotification:"Стол не найден"}),y("update:is_toggleAffiliation",!0)}else{const V=new yn,ie=P||M.text,K=I(ie);try{await V.authorizeByCard(K);const ee=await V.getProfile();y("update:is_notification",!0),y("update:notificationData",{textNotification:`Здравствуйте, ${ee.first_name}
31
- Баланс: ${ee.balance}`})}catch(ee){y("update:is_notification",!0),y("update:notificationData",{textNotification:((L=ee.response)==null?void 0:L.user_friendly_message)||"Карта не найдена"})}finally{m.value=!0,_&&clearTimeout(_),_=setTimeout(()=>{m.value=!1},2e3),p.value=!1}}};window.debugScan=O;const T=()=>{},D=async()=>{if(!(u.value||s!=null&&s.isScanning||m.value))try{u.value=!0;try{(await navigator.mediaDevices.getUserMedia({video:!0})).getTracks().forEach(Z=>Z.stop())}catch{y("update:is_notification",!0),y("update:notificationData",{textNotification:"Разрешите доступ к камере"}),u.value=!1,y("update:is_toggleAffiliation",!0);return}s=new Ba("reader");const P=await Ba.getCameras();if(!P||P.length===0){console.error("Камеры не найдены"),u.value=!1;return}let M;if(i.isQr)M=P.find(X=>No.back.some(Z=>new RegExp(Z,"i").test(X.label))),M||(M=P.find(X=>No.front.some(Z=>new RegExp(Z,"i").test(X.label))));else if(M=P.find(X=>No.front.some(Z=>new RegExp(Z,"i").test(X.label))),M||(M=P.find(X=>new RegExp("amera","i").test(X.label))),!M){y("update:is_notification",!0),y("update:notificationData",{textNotification:"Не найдена фронтальная камера. Для сканирования карт нужна фронтальная камера."}),u.value=!1,y("update:is_toggleAffiliation",!0);return}const v=i.isQr?[_e.QR_CODE]:[_e.QR_CODE,_e.PDF_417,_e.EAN_13,_e.EAN_8,_e.CODE_128],W={fps:60,qrbox:{width:320,height:500}};await s.start(M.id,W,O,T,void 0,v),f.value=!0}catch(P){y("update:is_notification",!0),y("update:notificationData",{textNotification:"Разрешите доступ к камере для сканирования"}),console.error("Ошибка доступа к камере:",P),u.value=!1,f.value=!1,y("update:is_toggleAffiliation",!0)}},k=async()=>{if(s&&s.isScanning)try{await s.stop(),u.value=!1,s=null}catch(P){console.error("Ошибка остановки камеры:",P)}else u.value=!1,s=null,y("update:is_toggleAffiliation",!0);f.value=!1};return r.onUnmounted(()=>{u.value&&k(),_&&(clearTimeout(_),_=null),p.value=!1,m.value=!1,f.value=!1}),(P,M)=>(r.openBlock(),r.createElementBlock("div",null,[(r.openBlock(),r.createBlock(r.Teleport,{to:"body"},[r.withDirectives(r.createElementVNode("div",{class:"blackWindow",onClick:k},[M[0]||(M[0]=r.createElementVNode("div",{id:"reader"},null,-1)),f.value&&!a.isQr?(r.openBlock(),r.createElementBlock("p",Tm,"Наведите QR на камеру")):r.createCommentVNode("",!0)],512),[[r.vShow,u.value]])])),r.createVNode(Nm,{color:a.isQr?void 0:"#FFFFFF",onClick:D},null,8,["color"])]))}}),Ni=Symbol("clickOutside"),Rm={mounted(a,l){a[Ni]=i=>{a.contains(i.target)||l.value(i)},document.addEventListener("click",a[Ni])},unmounted(a){a[Ni]&&document.removeEventListener("click",a[Ni])}};let ir=[],To;const Ma=["#FFD700","#FF6B8A","#7ECFC0","#C4B5FD","#FFA726","#EF5350","#AB47BC","#66BB6A","#42A5F5","#FFCA28"];class Da{constructor(l){Be(this,"x");Be(this,"y");Be(this,"vx");Be(this,"vy");Be(this,"color");Be(this,"size");Be(this,"rotation");Be(this,"rotationSpeed");Be(this,"gravity");Be(this,"friction");Be(this,"opacity");Be(this,"fadeSpeed");Be(this,"shape");Be(this,"width");Be(this,"height");Be(this,"ctx");this.x=window.innerWidth/2,this.y=window.innerHeight/2;const i=Math.random()*Math.PI*2,s=4+Math.random()*8;this.vx=Math.cos(i)*s,this.vy=Math.sin(i)*s-4,this.color=Ma[Math.floor(Math.random()*Ma.length)],this.size=4+Math.random()*6,this.rotation=Math.random()*360,this.rotationSpeed=(Math.random()-.5)*12,this.gravity=.12+Math.random()*.05,this.friction=.98,this.opacity=1,this.fadeSpeed=.005+Math.random()*.008,this.shape=Math.random()>.5?"rect":"circle",this.width=this.shape==="rect"?this.size*(.4+Math.random()*.6):this.size,this.height=this.shape==="rect"?this.size*(.8+Math.random()*.4):this.size,this.ctx=l}update(){this.vy+=this.gravity,this.vx*=this.friction,this.vy*=this.friction,this.x+=this.vx,this.y+=this.vy,this.rotation+=this.rotationSpeed,this.opacity-=this.fadeSpeed}draw(){this.ctx&&(this.ctx.save(),this.ctx.translate(this.x,this.y),this.ctx.rotate(this.rotation*Math.PI/180),this.ctx.globalAlpha=Math.max(0,this.opacity),this.ctx.fillStyle=this.color,this.shape==="rect"?this.ctx.fillRect(-this.width/2,-this.height/2,this.width,this.height):(this.ctx.beginPath(),this.ctx.arc(0,0,this.size/2,0,Math.PI*2),this.ctx.fill()),this.ctx.restore())}}const Bm={mounted(a){const l=a.getContext("2d"),i=()=>{l.clearRect(0,0,window.innerWidth,window.innerHeight);for(let s of ir)s.update(),s.draw();ir=ir.filter(s=>s.opacity>0),ir.length>0&&(To=requestAnimationFrame(i))};a._resize=()=>{const s=window.devicePixelRatio||1;a.width=window.innerWidth*s,a.height=window.innerHeight*s,l.scale(s,s)},a._resize(),window.addEventListener("resize",a._resize),setTimeout(()=>{for(let s=0;s<90;s++)ir.push(new Da(l));i()},400),setTimeout(()=>{for(let s=0;s<40;s++)ir.push(new Da(l))},900)},unmounted(a){window.removeEventListener("resize",a._resize),To&&cancelAnimationFrame(To),ir=[]}},Om={mounted(a){const l=a.getContext("2d");a._resize=()=>{a.width=window.innerWidth,a.height=window.innerHeight},a._resize(),window.addEventListener("resize",a._resize);const i=4,s=null,u="#E52222",f="#fed1b0",m="#1a1aff",p="#222",_="#E8B84B",x=[[s,s,s,u,u,u,u,u,s,s,s,s,s,s,s,s],[s,s,u,u,u,u,u,u,u,u,u,s,s,s,s,s],[s,s,p,p,p,f,f,p,f,s,s,s,s,s,s,s],[s,p,f,p,f,f,f,p,f,f,f,s,s,s,s,s],[s,p,f,p,p,f,f,f,p,f,f,f,s,s,s,s],[s,p,p,f,f,f,f,p,p,p,p,s,s,s,s,s],[s,s,s,f,f,f,f,f,f,f,s,s,s,s,s,s],[s,s,m,m,u,m,m,m,s,s,s,s,s,s,s,s],[s,m,m,m,u,m,m,m,m,m,s,s,s,s,s,s],[m,m,m,m,u,u,m,m,m,m,m,s,s,s,s,s],[f,f,m,u,_,u,u,_,m,f,f,s,s,s,s,s],[f,f,f,u,u,u,u,u,f,f,f,s,s,s,s,s],[f,f,u,u,u,u,u,u,u,f,f,s,s,s,s,s],[s,s,u,u,u,s,s,u,u,u,s,s,s,s,s,s],[s,p,p,p,s,s,s,p,p,p,s,s,s,s,s,s],[p,p,p,p,s,s,p,p,p,p,s,s,s,s,s,s]],C=[[s,s,s,u,u,u,u,u,s,s,s,s,s,s,s,s],[s,s,u,u,u,u,u,u,u,u,u,s,s,s,s,s],[s,s,p,p,p,f,f,p,f,s,s,s,s,s,s,s],[s,p,f,p,f,f,f,p,f,f,f,s,s,s,s,s],[s,p,f,p,p,f,f,f,p,f,f,f,s,s,s,s],[s,p,p,f,f,f,f,p,p,p,p,s,s,s,s,s],[s,s,s,f,f,f,f,f,f,f,s,s,s,s,s,s],[s,s,m,m,u,m,m,m,s,s,s,s,s,s,s,s],[s,m,m,m,u,m,m,m,m,m,s,s,s,s,s,s],[m,m,m,m,u,u,m,m,m,m,m,s,s,s,s,s],[f,f,m,u,_,u,u,_,m,f,f,s,s,s,s,s],[f,f,f,u,u,u,u,u,f,f,f,s,s,s,s,s],[f,f,u,u,u,u,u,u,u,f,f,s,s,s,s,s],[s,u,u,u,s,s,s,s,u,u,u,s,s,s,s,s],[p,p,p,s,s,s,s,s,p,p,p,s,s,s,s,s],[p,p,s,s,s,s,s,s,s,p,p,s,s,s,s,s]],y=[[s,s,s,u,u,u,u,u,s,s,s,s,s,s,s,s],[s,s,u,u,u,u,u,u,u,u,u,s,s,s,s,s],[s,s,p,p,p,f,f,p,f,s,s,s,s,s,s,s],[s,p,f,p,f,f,f,p,f,f,f,s,s,s,s,s],[s,p,f,p,p,f,f,f,p,f,f,f,s,s,s,s],[s,p,p,f,f,f,f,p,p,p,p,s,s,s,s,s],[s,s,s,f,f,f,f,f,f,f,s,s,s,s,s,s],[s,s,m,m,u,m,m,m,s,s,s,s,s,s,s,s],[s,m,m,m,u,m,m,m,m,m,s,s,s,s,s,s],[m,m,m,m,u,u,m,m,m,m,m,s,s,s,s,s],[f,f,m,u,_,u,u,_,m,f,f,s,s,s,s,s],[f,f,f,u,u,u,u,u,f,f,f,s,s,s,s,s],[f,f,u,u,u,u,u,u,u,f,f,s,s,s,s,s],[s,s,s,s,u,u,u,u,s,s,s,s,s,s,s,s],[s,s,s,s,p,p,p,p,p,s,s,s,s,s,s,s],[s,s,s,s,s,p,p,p,p,p,s,s,s,s,s,s]],I=[[s,s,s,s,u,u,u,u,u,s,s,s,s,s,s,s],[s,s,s,u,u,u,u,u,u,u,u,u,s,s,s,s],[s,s,s,p,p,p,f,f,p,f,s,s,s,s,s,s],[s,s,p,f,p,f,f,f,p,f,f,f,s,s,s,s],[s,s,p,f,p,p,f,f,f,p,f,f,s,s,s,s],[s,s,p,p,f,f,f,f,p,p,p,p,s,s,s,s],[s,s,s,s,f,f,f,f,f,f,f,s,s,s,s,s],[s,m,s,s,m,m,u,m,m,m,s,s,m,s,s,s],[m,m,m,m,m,u,m,m,m,m,m,m,m,s,s,s],[m,m,m,m,u,u,m,m,m,m,m,s,s,s,s,s],[f,f,m,u,_,u,u,_,m,f,f,s,s,s,s,s],[f,f,f,u,u,u,u,u,f,f,f,s,s,s,s,s],[f,f,u,u,u,u,u,u,u,f,f,s,s,s,s,s],[s,s,u,u,u,s,s,u,u,u,s,s,s,s,s,s],[s,p,p,p,s,s,s,p,p,p,s,s,s,s,s,s],[p,p,p,p,s,s,p,p,p,p,s,s,s,s,s,s]],O=[[s,_,_,_,_,_,s,s],[_,_,p,_,_,_,_,s],[_,p,_,_,_,_,_,s],[_,p,_,_,_,_,_,s],[_,p,_,_,_,_,_,s],[_,_,p,_,_,_,_,s],[s,_,_,_,_,_,s,s],[s,s,s,s,s,s,s,s]];function T(z,N,$,q,j,te){const J=N.length,se=N[0].length;for(let ce=0;ce<J;ce++)for(let we=0;we<se;we++){const Ce=N[ce][we];if(!Ce)continue;const Ae=te?$+(se-1-we)*j:$+we*j,ge=q+ce*j;z.fillStyle=Ce,z.fillRect(Ae,ge,j,j)}}let D,k,P,M,v,W,X,Z,F,L,V,ie=!1;function K(){Z=a.height*.46,k=-20*i,P=Z,M=3.2,v=0,D="enter",W=0,X=0,V=!1,F=Z-32*i,L=0,ie=!0}function ee(){return a.width/2-6*i}function G(){if(!ie)return;const z=a.width,N=a.height;l.clearRect(0,0,z,N),V&&(F+=L,L+=.4,T(l,O,a.width/2-3*i,F,i,!1),F>N+16*i&&(V=!1)),(D==="enter"||D==="exit")&&(X++,X>=6&&(X=0,W=(W+1)%3));const $=[x,C,y];if(D==="enter")k+=M,T(l,$[W],k,P,i,!1),k+5*i>=ee()&&(D="bump_up",M=0,v=-7);else if(D==="bump_up")v+=.7,P+=v,T(l,I,k,P,i,!1),v>=0&&(D="bump_down",V=!0,L=-10,F=P-10*i);else if(D==="bump_down")v+=.7,P+=v,T(l,I,k,P,i,!1),P>=Z&&(P=Z,v=0,M=-3.2,D="exit");else if(D==="exit"&&(k+=M,T(l,$[W],k,P,i,!0),k<-20*i)){ie=!1,setTimeout(()=>{K(),G()},2500);return}requestAnimationFrame(G)}setTimeout(()=>{K(),G()},1200)},unmounted(a){window.removeEventListener("resize",a._resize)}};class Mm{constructor(l){Be(this,"value");Be(this,"next");this.value=l}}class Dm{constructor(){Ui(this,en);Ui(this,Gn);Ui(this,sr);this.clear()}enqueue(l){const i=new Mm(l);_n(this,en)?(_n(this,Gn).next=i,Pn(this,Gn,i)):(Pn(this,en,i),Pn(this,Gn,i)),Zo(this,sr)._++}dequeue(){const l=_n(this,en);if(l)return Pn(this,en,_n(this,en).next),Zo(this,sr)._--,_n(this,en)||Pn(this,Gn,void 0),l.value}peek(){if(_n(this,en))return _n(this,en).value}clear(){Pn(this,en,void 0),Pn(this,Gn,void 0),Pn(this,sr,0)}get size(){return _n(this,sr)}*[Symbol.iterator](){let l=_n(this,en);for(;l;)yield l.value,l=l.next}*drain(){for(;_n(this,en);)yield this.dequeue()}}en=new WeakMap,Gn=new WeakMap,sr=new WeakMap;function vm(a){va(a);const l=new Dm;let i=0;const s=()=>{i<a&&l.size>0&&(i++,l.dequeue()())},u=()=>{i--,s()},f=async(_,x,C)=>{const y=(async()=>_(...C))();x(y);try{await y}catch{}u()},m=(_,x,C)=>{new Promise(y=>{l.enqueue(y)}).then(f.bind(void 0,_,x,C)),i<a&&s()},p=(_,...x)=>new Promise(C=>{m(_,C,x)});return Object.defineProperties(p,{activeCount:{get:()=>i},pendingCount:{get:()=>l.size},clearQueue:{value(){l.clear()}},concurrency:{get:()=>a,set(_){va(_),a=_,queueMicrotask(()=>{for(;i<a&&l.size>0;)s()})}},map:{async value(_,x){const C=Array.from(_,(y,I)=>this(x,y,I));return Promise.all(C)}}}),p}function va(a){if(!((Number.isInteger(a)||a===Number.POSITIVE_INFINITY)&&a>0))throw new TypeError("Expected `concurrency` to be a number from 1 and up")}let Jt=null;const Pa=vm(5),Pm=async(a,l)=>{Jt&&Um();const i=st(),s=St(),u=Gr(),f=Lt(),{itemThemes:m}=xe.storeToRefs(s),{displayCards:p}=xe.storeToRefs(i),{is_notification_lib:_,notificationData_lib:x}=xe.storeToRefs(u),{stateCard:C,openProduct:y}=xe.storeToRefs(f),I=yn.create();await Lm(a),Jt=Lr(`wss://${l}/ws/org-unit/${a}/`,{heartbeatTimeout:3e4}),Jt.on("open",()=>console.warn("Realtime WebSocket подключён (pointId:",a,")")),Jt.on("error",O=>console.warn("WebSocket ошибка:",O)),Jt.on("close",()=>console.warn("Realtime WebSocket закрыт")),Jt.on("message",async O=>{try{if(O.type)return;m.value.kiosk_hide_menu_update_notification||(x.value.textNotification="Мы обновили меню");const T=O.params||O,D=T.active_groups||[],k=T.updated_groups||[],P=T.updated_product_groups||[],M=await Qn(),v=new Set(D.map(K=>K)),W=new Map(p.value.map(K=>[K.id,K])),X=[],Z=M.transaction("groups","readwrite");let L=await Z.objectStore("groups").openCursor();for(;L;){const K=L.key;!v.has(K)&&K!==a&&(X.push(K),await L.delete(),W.delete(K)),L=await L.continue()}await Z.done,p.value=Array.from(W.values()),X.length>0&&await Fm(v);const V=[...k.map(K=>Pa(async()=>{const[ee,G]=await Promise.all([I.getGroupByID(K),I.loadGroupProducts(K)]);ee.products=G,W.set(K,ee),await Dr(K,ee),await Fa(ee,G,!0)})),...P.map(K=>Pa(async()=>{const[ee,G]=await Promise.all([I.getGroupByID(K),I.loadGroupProducts(K)]);ee.products=G,W.set(K,ee),await Dr(K,ee),await Fa(ee,G,!0),await Vm(G,K)}))];await Promise.all(V),p.value=Array.from(W.values()),await Tl(a,p),x.value.textNotification.length>1&&(_.value=!0);const ie=C.value.openCard;if(ie!=null&&ie.id){const K=new Set(ie.groups??[]),ee=new Set;let G=!1;for(const N of W.values()){const $=N==null?void 0:N.products;if(!Array.isArray($))continue;const q=$.find(j=>(j==null?void 0:j.id)===ie.id);if((q==null?void 0:q.adult)===!0){y.value={id:null,visible:!1},f.reset();return}q&&(N==null?void 0:N.id)!=null&&(ee.add(N.id),(k.includes(N.id)||P.includes(N.id))&&(G=!0))}if(ee.size===0){y.value={id:null,visible:!1},f.reset();return}(!(K.size===ee.size&&[...K].every(N=>ee.has(N)))||G)&&await I.getSingleProduct(ie==null?void 0:ie.id)}}catch(T){console.error("ошибка обновления indexedDB [updateIndexedDB]",T)}}),Jt.connect()},Lm=async a=>{try{const l=st(),i=await qi(a);i!=null&&i.data&&(l.displayCards=i.data)}catch(l){console.error("Ошибка загрузки кэша групп:",l)}},La=async a=>{const l=st(),i=Gr(),s=Lt(),{stateCard:u,openProduct:f}=xe.storeToRefs(s),{cartProducts_lib:m}=xe.storeToRefs(l),p=m.value,_=[],x=[],C=u.value.openCard;for(const y of p)a(y)?(_.push(y),(y.id===(C==null?void 0:C.id)||C!=null&&C.adult)&&(f.value={id:null,visible:!1})):x.push(y);if(_.length>0){const y=_.map(I=>I.name).slice(0,3).join(", ");i.notificationData_lib.textNotification=`Некоторые позиции стали недоступны и были убраны из заказа: ${y}${_.length>3?` и ещё ${_.length-3}`:""}`,m.value=x,l.updateCartInLocalStorage()}},Fm=async a=>{await La(l=>{var i;return(i=l.groups)!=null&&i.length?!l.groups.some(s=>a.has(s)):!0})},Vm=async(a,l)=>{const i=st(),s=new Set(a.filter(u=>!u.adult||i.is18Allowed).map(u=>u.id));await La(u=>{var f;return(f=u.groups)!=null&&f.includes(l)?!s.has(u.id):!1})},Fa=async(a,l,i=!0)=>{if(a.video_link&&Ti(a.video_link,`${a.id}_video`,i),a.image_link&&Ti(a.image_link,`${a.id}_image`,i),l!=null&&l.length)for(const s of l)s.video_link&&Ti(s.video_link,`${s.id}_video`,i),s.image_link&&Ti(s.image_link,`${s.id}_image`,i)},Ti=async(a,l,i=!1)=>{try{const s=si();if(!i){const m=await fr(l);if(m){s.updateCacheFromBlob(l,m),window.dispatchEvent(new CustomEvent("image-cached",{detail:{id:l,blob:m}}));return}}const u=await fetch(a);if(!u.ok)throw new Error("Network error");const f=await u.blob();if(f.size===0)throw new Error("Empty blob");await Zi(l,f),s.updateCacheFromBlob(l,f),window.dispatchEvent(new CustomEvent("image-cached",{detail:{id:l,blob:f}}))}catch(s){console.warn(`[MediaCache] Failed for ${l}:`,s)}},Um=()=>{Jt&&(Jt.off("open"),Jt.off("message"),Jt.off("error"),Jt.off("close"),Jt.close(!0),Jt=null)},zm={key:0,class:"valentine-hearts"},Hm=r.defineComponent({__name:"FallingHearts",props:{symbols:{default:()=>["❤","♥","💕"]},max:{default:15},interval:{default:1500}},setup(a){const l=a,i=wt.useDocumentVisibility(),s=wt.useMediaQuery("(prefers-reduced-motion: reduce)"),u=r.ref([]);let f=null;const m=(C,y)=>Math.random()*(y-C)+C,p=()=>{if(s.value||u.value.length>=l.max)return;const C=l.symbols[Math.floor(Math.random()*l.symbols.length)],y=m(18,26),I=m(5,95),O=m(10,18),T=m(0,.3),D=m(.6,.9),k=Math.floor(m(1,6)),M={id:crypto.randomUUID(),icon:C,style:{left:`${I}%`,fontSize:`${y}px`,color:`rgba(255, 105, 180, ${D})`,animationName:`heartFall${k}`,animationDuration:`${O}s`,animationDelay:`${T}s`}};u.value.push(M);const W=setTimeout(()=>{u.value=u.value.filter(X=>X.id!==M.id),clearTimeout(W)},(T+O+1)*1e3)},_=()=>{if(!s.value){for(let C=0;C<3;C++){const y=setTimeout(()=>{p(),clearTimeout(y)},C*200)}f=setInterval(p,l.interval)}},x=()=>{f&&(clearInterval(f),f=null),u.value=[]};return r.onMounted(()=>{s.value||_()}),r.onUnmounted(()=>{x()}),r.watch(i,(C,y)=>{C==="visible"&&y==="hidden"&&_(),C==="hidden"&&y==="visible"&&x()}),(C,y)=>r.unref(s)?r.createCommentVNode("",!0):(r.openBlock(),r.createElementBlock("div",zm,[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(u.value,I=>(r.openBlock(),r.createElementBlock("span",{key:I.id,class:"heart",style:r.normalizeStyle(I.style)},r.toDisplayString(I.icon),5))),128))]))}}),Gm=["src"],Wm=r.defineComponent({__name:"BasketImage",props:{id:{},fallback:{}},setup(a){const l=a,{mediaUrl:i}=Tn(()=>l.id,()=>l.fallback);return(s,u)=>(r.openBlock(),r.createElementBlock("img",{src:r.unref(i)||""},null,8,Gm))}}),Xm={class:"button_price_bg"},$m={class:"wrapper_container_price_bg"},jm={class:"button_price"},qm={key:0,class:"image_product_container"},Zm=r.defineComponent({__name:"BasketButton",emits:["goToCart"],setup(a,{emit:l}){const i=l,s=ke.useRouter(),u=st(),f=Fn(),{totalPrice_lib:m,cartProducts_lib:p}=xe.storeToRefs(u),_=r.computed(()=>{var y;return m.value+(((y=f.order)==null?void 0:y.remaining_amount)||0)}),x=r.computed(()=>{var y;return(y=p.value)!=null&&y.length,p.value.slice(0,3).map(I=>({id:`${I.id}_image`,fallback:I.image_link}))}),C=()=>{var y;if(f.isTableService&&f.hasOrder&&!((y=p.value)!=null&&y.length))return s.push({name:"order-ts"});i("goToCart")};return(y,I)=>(r.openBlock(),r.createElementBlock("div",Xm,[r.createElementVNode("div",$m,[r.createElementVNode("div",jm,[r.unref(m)>0&&x.value.length>0?(r.openBlock(),r.createElementBlock("div",qm,[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(x.value,O=>(r.openBlock(),r.createElementBlock("div",{key:O.id,class:"filter_image_product"},[r.createVNode(Wm,{id:O.id,fallback:O.fallback,class:"img_product"},null,8,["id","fallback"])]))),128))])):r.createCommentVNode("",!0),r.createVNode(r.unref(Ot.motion).div,{class:"button_default_main",whilePress:{scale:.92},onClick:C},{default:r.withCtx(()=>[I[1]||(I[1]=r.createElementVNode("div",{class:"icont_cart"},null,-1)),r.createElementVNode("p",null,[r.createVNode(ft,{price:_.value,fixedFloat:2},null,8,["price"]),I[0]||(I[0]=r.createTextVNode(" ₽",-1))])]),_:1})])])]))}}),$r=null,{min:or,max:bn,abs:Va,floor:Ym}=Math,Ua=(a,l,i)=>or(i,bn(l,a)),za=a=>[...a].sort((l,i)=>l-i),Km=typeof queueMicrotask=="function"?queueMicrotask:a=>{Promise.resolve().then(a)},ko=()=>{let a;return[new Promise(l=>{a=l}),a]},Ha=a=>{let l;return()=>(a&&(l=a(),a=void 0),l)},jr=(a,l,i)=>{const s=i?"unshift":"push";for(let u=0;u<l;u++)a[s](-1);return a},Ga=(a,l)=>{const i=a.t[l];return i===-1?a.o:i},Qm=(a,l,i)=>{const s=a.t[l]===-1;return a.t[l]=i,a.i=or(l,a.i),s},ki=(a,l)=>{if(!a.l)return 0;if(a.i>=l)return a.u[l];a.i<0&&(a.u[0]=0,a.i=0);let i=a.i,s=a.u[i];for(;i<l;)s+=Ga(a,i),a.u[++i]=s;return a.i=l,s},yr=(a,l,i=0,s=a.l-1)=>{let u=i;for(;i<=s;){const f=Ym((i+s)/2);ki(a,f)<=l?(u=f,i=f+1):s=f-1}return Ua(u,0,a.l-1)},Wa=(a,l,i)=>{const s=l-a.l;return a.i=i?-1:or(l-1,a.i),a.l=l,s>0?(jr(a.u,s),jr(a.t,s,i),a.o*s):(a.u.splice(s),(i?a.t.splice(0,-s):a.t.splice(s)).reduce((u,f)=>u-(f===-1?a.o:f),0))},Jm=a=>a.documentElement,eg=a=>a.ownerDocument,tg=a=>a.defaultView,Xa=Ha(()=>!!/iP(hone|od|ad)/.test(navigator.userAgent)||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>0),ng=Ha(()=>"scrollBehavior"in Jm(document).style),rg=(a,l=40,i=0,s,u=!1)=>{let f=!!i,m=1,p=0,_=0,x=0,C=0,y=0,I=0,O=0,T=0,D=$r,k=[0,f?bn(i-1,0):-1],P=0,M=!1;const v=((G,z,N)=>({o:z,t:N?jr(N.slice(0,or(G,N.length)),bn(0,G-N.length)):jr([],G),l:G,i:-1,u:jr([],G+1)}))(a,s?s[1]:l,s&&s[0]),W=new Set,X=()=>x-_,Z=()=>X()+y+C,F=(G,z)=>((N,$,q,j)=>{if(j=or(j,N.l-1),ki(N,j)<=$){const te=yr(N,q,j);return[yr(N,$,j,te),te]}{const te=yr(N,$,void 0,j);return[te,yr(N,q,te)]}})(v,G,z,k[0]),L=()=>ki(v,v.l),V=(G,z)=>{const N=ki(v,G)-y;return z?L()-N-ie(G):N},ie=G=>Ga(v,G),K=(G,z=-1)=>v.t[G]===z,ee=G=>{G&&(Xa()&&O!==0||D&&T===1?y+=G:C+=G)};return{p:()=>{W.clear()},h:()=>m,m:()=>(G=>[G.t.slice(),G.o])(v),v:(G=200)=>{if(!M||f)return k;let z,N;if(I)[z,N]=k;else{let $=bn(0,Z()),q=$+p;u||(G=bn(0,G),O!==1&&($-=G),O!==2&&(q+=G)),[z,N]=k=F(bn(0,$),bn(0,q)),D&&(z=or(z,D[0]),N=bn(N,D[1]))}return[bn(z,0),or(N,v.l-1)]},S:G=>yr(v,G-_),I:K,O:V,k:ie,j:()=>v.l,N:()=>x,B:()=>O!==0,T:()=>p,q:()=>_,M:L,P:()=>(I=C,C=0,[I,T===2]),R:(G,z)=>{const N=[G,z];return W.add(N),()=>{W.delete(N)}},A:(G,z)=>{let N,$,q=0;switch(G){case 1:{if(z===x&&T===0)break;const j=I;I=0;const te=z-x,J=Va(te);j&&J<Va(j)+1||T!==0||(O=te<0?2:1),f&&(f=!1),x=z,q=4;const se=X();se>=-p&&se<=L()&&(q+=1,$=J>p);break}case 2:q=8,O!==0&&(N=!0,q+=1),O=0,T=0,D=$r;break;case 3:{const j=z.filter(([te,J])=>!K(te,J));if(!j.length)break;ee(j.reduce((te,[J,se])=>((T===2||(D&&T===1?J<D[0]:V(J+(O===0&&T===0?1:0))<X()))&&(te+=se-ie(J)),te),0));for(const[te,J]of j){const se=ie(te),ce=Qm(v,te,J);u&&(P+=ce?J:J-se)}u&&p&&P>p&&(ee(((te,J)=>{let se=0;const ce=[];te.t.forEach((be,et)=>{be!==-1&&(ce.push(be),et<J&&se++)}),te.i=-1;const we=za(ce),Ce=we.length,Ae=Ce/2|0,ge=Ce%2==0?(we[Ae-1]+we[Ae])/2:we[Ae],ht=te.o;return((te.o=ge)-ht)*bn(J-se,0)})(v,yr(v,Z()))),u=!1),q=3,$=!0;break}case 4:p!==z&&(p||(M=$=!0),p=z,q=3);break;case 5:z[1]?(ee(Wa(v,z[0],!0)),T=2,q=1):(Wa(v,z[0]),q=1);break;case 6:_=z;break;case 7:T=1;break;case 8:D=F(z,z+p),q=1}q&&(m=1+(2147483647&m),N&&y&&(C+=y,y=0),W.forEach(([j,te])=>{q&j&&te($)}))}}},Ro=setTimeout,Bo=(a,l)=>l?-a:a,ig=(a,l,i,s,u,f)=>{const m=Date.now;let p=0,_=!1,x=!1,C=!1,y=!1;const I=(()=>{let P;const M=()=>{P!=$r&&clearTimeout(P)},v=()=>{M(),P=Ro(()=>{P=$r,(()=>{if(_||x)return _=!1,void I();C=!1,a.A(2)})()},150)};return v.C=M,v})(),O=()=>{p=m(),C&&(y=!0),a.A(1,s()),I()},T=P=>{if(_||!a.B()||P.ctrlKey)return;const M=m()-p;150>M&&50<M&&(i?P.deltaX:P.deltaY)&&(_=!0)},D=()=>{x=!0,C=y=!1},k=()=>{x=!1,Xa()&&(C=!0)};return l.addEventListener("scroll",O),l.addEventListener("wheel",T,{passive:!0}),l.addEventListener("touchstart",D,{passive:!0}),l.addEventListener("touchend",k,{passive:!0}),{H:()=>{l.removeEventListener("scroll",O),l.removeEventListener("wheel",T),l.removeEventListener("touchstart",D),l.removeEventListener("touchend",k),I.C()},V:()=>{const[P,M]=a.P();P&&(u(P,M,y),y=!1,M&&a.T()>a.M()&&a.A(1,s()))}}},og=(a,l,i)=>{let s;return[async(u,f)=>{if(!await l())return;s&&s();const m=()=>{const[p,_]=ko();return s=()=>{_(!1)},a.T()&&Ro(s,150),[p,a.R(2,()=>{_(!0)})]};if(f&&ng())a.A(8,u()),Km(async()=>{for(;;){let p=!0;for(let[C,y]=a.v();C<=y;C++)if(a.I(C)){p=!1;break}if(p)break;const[_,x]=m();try{if(!await _)return}finally{x()}}a.A(7),i(u(),f)});else for(;;){const[p,_]=m();try{if(a.A(7),i(u()),!await p)return}finally{_()}}},()=>{s&&s()}]},sg=a=>{let l;return{F(i){(l||(l=new(tg(eg(i))).ResizeObserver(a))).observe(i)},J(i){l.unobserve(i)},H(){l&&l.disconnect()}}},ag=r.defineComponent({props:{L:{type:Object,required:!0},W:{type:Object,required:!0},X:{type:Object,required:!0},Y:{type:Function,required:!0},D:{type:Number,required:!0},U:{type:Boolean},G:{type:Boolean},K:{type:Boolean},Z:{type:String,required:!0},ee:Object},setup(a){const l=r.ref(),i=r.computed(()=>a.L.value&&a.W.O(a.D,a.K)),s=r.computed(()=>a.L.value&&a.W.I(a.D));return r.watch(()=>l.value&&a.D,(u,f,m)=>{m(a.Y(l.value,a.D))},{flush:"post"}),()=>{var u;const{X:f,U:m,G:p,Z:_}=a,x=s.value,{style:C,...y}=(u=a.ee)!==null&&u!==void 0?u:{},I={contain:"layout style",position:x&&p?void 0:"absolute",[m?"height":"width"]:"100%",[m?"top":"left"]:"0px",[m?"left":"top"]:i.value+"px",visibility:!x||p?void 0:"hidden",...C};return m&&(I.display="inline-flex"),r.createVNode(_,r.mergeProps({ref:l,style:I},y),typeof(O=f)=="function"||Object.prototype.toString.call(O)==="[object Object]"&&!r.isVNode(O)?f:{default:()=>[f],_:2},16,["style"]);var O}}}),lg=(a,l)=>{const i=a.key;return i??"_"+l},cg=(a,l)=>a[0]===l[0]&&a[1]===l[1],$a=r.defineComponent({props:{data:{type:Array,required:!0},bufferSize:Number,itemSize:Number,shift:Boolean,horizontal:Boolean,startMargin:{type:Number,default:0},ssrCount:Number,scrollRef:Object,as:{type:String,default:"div"},item:{type:String,default:"div"},itemProps:Function,keepMounted:Array,cache:Object},emits:["scroll","scrollEnd"],setup(a,{emit:l,expose:i,slots:s}){let u=!!a.ssrCount;const f=a.horizontal,m=r.ref(),p=rg(a.data.length,a.itemSize,a.ssrCount,a.cache,!a.itemSize),_=((T,D)=>{let k;const P=D?"width":"height",M=new WeakMap,v=sg(W=>{const X=[];for(const{target:Z,contentRect:F}of W)if(Z.offsetParent)if(Z===k)T.A(4,F[P]);else{const L=M.get(Z);L!=$r&&X.push([L,F[P]])}X.length&&T.A(3,X)});return{te(W){v.F(k=W)},re:(W,X)=>(M.set(W,X),v.F(W),()=>{M.delete(W),v.J(W)}),p:v.H}})(p,f),x=((T,D)=>{let k,P,M=ko(),v=!1;const W=D?"scrollLeft":"scrollTop",X=D?"overflowX":"overflowY",[Z,F]=og(T,()=>M[0],(L,V)=>{L=Bo(L,v),V?k.scrollTo({[D?"left":"top"]:L,behavior:"smooth"}):k[W]=L});return{oe(L){k=L,D&&(v=getComputedStyle(L).direction==="rtl"),P=ig(T,L,D,()=>Bo(L[W],v),(V,ie,K)=>{if(K){const ee=L.style,G=ee[X];ee[X]="hidden",Ro(()=>{ee[X]=G})}L[W]=Bo(T.N()+V,v),ie&&F()}),M[1](!0)},p(){P&&P.H(),M[1](!1),M=ko()},ne:()=>v,se(L){Z(()=>L)},ie(L){L+=T.N(),Z(()=>L)},le(L,{align:V,smooth:ie,offset:K=0}={}){if(L=Ua(L,0,T.j()-1),V==="nearest"){const ee=T.O(L),G=T.N();if(ee<G)V="start";else{if(!(ee+T.k(L)>G+T.T()))return;V="end"}}Z(()=>K+T.q()+T.O(L)+(V==="end"?T.k(L)-T.T():V==="center"?(T.k(L)-T.T())/2:0),ie)},ce:()=>{P&&P.V()}}})(p,f),C=r.ref(p.h());p.R(1,()=>{C.value=p.h()}),p.R(4,()=>{l("scroll",p.N())}),p.R(8,()=>{l("scrollEnd")});const y=r.computed(T=>{C.value;const D=p.v(a.bufferSize);return T&&cg(T,D)?T:D}),I=r.computed(()=>C.value&&p.B()),O=r.computed(()=>C.value&&p.M());return r.onMounted(()=>{u=!1;const T=requestAnimationFrame(()=>{const D=k=>{_.te(k),x.oe(k)};a.scrollRef?D(a.scrollRef):D(m.value.parentElement)});r.onUnmounted(()=>{cancelAnimationFrame(T)})}),r.onUnmounted(()=>{p.p(),_.p(),x.p()}),r.watch(()=>a.data.length,T=>{p.A(5,[T,a.shift])}),r.watch(()=>a.startMargin,T=>{p.A(6,T)},{immediate:!0}),r.watch([C],()=>{x.ce()},{flush:"post"}),i({get cache(){return p.m()},get scrollOffset(){return p.N()},get scrollSize(){return(T=>bn(T.M(),T.T()))(p)},get viewportSize(){return p.T()},findItemIndex:p.S,getItemOffset:p.O,getItemSize:p.k,scrollToIndex:x.le,scrollTo:x.se,scrollBy:x.ie}),()=>{const T=a.as,D=a.item,k=O.value,P=x.ne(),M=!f&&P?"unshift":"push",v=[],W=Z=>{var F;const L=s.default({item:a.data[Z],index:Z})[0];return r.createVNode(ag,{key:lg(L,Z),L:C,W:p,Y:_.re,D:Z,X:L,U:f,K:P,G:u,Z:D,ee:(F=a.itemProps)===null||F===void 0?void 0:F.call(a,{item:a.data[Z],index:Z})},null,8,["L","W","Y","D","X","U","K","G","Z","ee"])};if(a.keepMounted){const Z=new Set(a.keepMounted);for(let[F,L]=y.value;F<=L;F++)Z.add(F);za([...Z]).forEach(F=>{v[M](W(F))})}else for(let[Z,F]=y.value;Z<=F;Z++)v[M](W(Z));return r.createVNode(T,{ref:m,style:{contain:"size style",overflowAnchor:"none",flex:"none",position:"relative",width:f?k+"px":"100%",height:f?"100%":k+"px",pointerEvents:I.value?"none":void 0}},typeof(X=v)=="function"||Object.prototype.toString.call(X)==="[object Object]"&&!r.isVNode(X)?v:{default:()=>[v],_:2},8,["style"]);var X}}}),dg=r.defineComponent({props:{data:{type:Array,required:!0},bufferSize:Number,itemSize:Number,shift:Boolean,horizontal:Boolean,ssrCount:Number,itemProps:Function,keepMounted:Array,cache:Object},emits:["scroll","scrollEnd"],setup(a,{emit:l,expose:i,slots:s}){const u=a.horizontal,f=_=>{l("scroll",_)},m=()=>{l("scrollEnd")},p=r.ref();return i({get cache(){return p.value.cache},get scrollOffset(){return p.value.scrollOffset},get scrollSize(){return p.value.scrollSize},get viewportSize(){return p.value.viewportSize},findItemIndex:(..._)=>p.value.findItemIndex(..._),getItemOffset:(..._)=>p.value.getItemOffset(..._),getItemSize:(..._)=>p.value.getItemSize(..._),scrollToIndex:(..._)=>p.value.scrollToIndex(..._),scrollTo:(..._)=>p.value.scrollTo(..._),scrollBy:(..._)=>p.value.scrollBy(..._)}),()=>{return r.createVNode("div",{style:{display:u?"inline-block":"block",[u?"overflowX":"overflowY"]:"auto",contain:"strict",width:"100%",height:"100%"}},[r.createVNode($a,{ref:p,data:a.data,bufferSize:a.bufferSize,itemSize:a.itemSize,itemProps:a.itemProps,shift:a.shift,ssrCount:a.ssrCount,horizontal:u,keepMounted:a.keepMounted,cache:a.cache,onScroll:f,onScrollEnd:m},(_=s,typeof _=="function"||Object.prototype.toString.call(_)==="[object Object]"&&!r.isVNode(_)?s:{default:()=>[s],_:2}),8,["data","bufferSize","itemSize","itemProps","shift","ssrCount","horizontal","keepMounted","cache","onScroll","onScrollEnd"])],4);var _}}}),ug=(a,l=10)=>new Promise(i=>{let s=0,u=0,f=0;const m=()=>{if(!a||a.scrollSize===void 0){i();return}const p=a.scrollSize;p===f&&p>0?s++:(s=0)&&(f=p),u++,s>=2||u>=l?i():requestAnimationFrame(m)};requestAnimationFrame(m)});function fg(a,l){const i=(l==null?void 0:l.align)??"start";let s=!1;const u=r.ref(null),f=r.ref(!1),m=r.ref("measure"),p=r.computed(()=>r.toValue(a).length),_=r.computed(()=>m.value==="measure"||m.value==="virtual"?1:5),x=r.computed(()=>Array.from({length:p.value*_.value},(k,P)=>P)),C=async()=>{if(u.value&&(m.value="measure",s=!1,f.value=!1,await r.nextTick(),!(!u.value||m.value!=="measure")&&(await ug(u.value),!!u.value))){if(f.value=u.value.scrollSize>u.value.viewportSize,!f.value){s=!1;return}s=!0,m.value=(l==null?void 0:l.mode)||"loop",await r.nextTick(),u.value&&u.value.scrollToIndex(p.value*3,{align:i})}},y=k=>m.value==="measure"?k:p.value===0?0:k%p.value,I=(k,P)=>{u.value&&u.value.scrollToIndex(k,P)},O=(k,P)=>!s||m.value!=="loop"?P:P+Math.round((k-P)/p.value)*p.value,T=k=>{if(!s||m.value!=="loop"||!u.value)return;const P=p.value-1,M=p.value*4;if(k<P)return I(p.value*3-1,{align:"start"});if(k>=M)return I(p.value*3,{align:"start"})},D=()=>{if(!u.value||!s)return;const k=u.value.findItemIndex(u.value.scrollOffset);T(k)};return r.onMounted(C),r.onUnmounted(()=>u.value=null),r.watch(p,()=>r.nextTick(C)),{listRef:u,items:x,hasScroll:f,realIndex:y,findNearestIndex:O,scrollToIndex:I,init:C,onScroll:D}}const hg=Object.prototype.toString,mg=a=>hg.call(a)==="[object Error]",gg=new Set(["network error","NetworkError when attempting to fetch resource.","The Internet connection appears to be offline.","Network request failed","fetch failed","terminated"," A network error occurred.","Network connection lost"]),pg=a=>{if(!(a&&mg(a)&&a.name==="TypeError"&&typeof a.message=="string"))return!1;const{message:i,stack:s}=a;return i==="Load failed"?s===void 0||"__sentry_captured__"in a:i.startsWith("error sending request for url")||i==="Failed to fetch"||i.startsWith("Failed to fetch (")&&i.endsWith(")")?!0:gg.has(i)},xg={pinch:!0,doubleTap:!0,wheel:!0,buttons:["+","-","=","0"]},_g=a=>{var i;const l=Object.assign({},xg,a);if(l.pinch&&(document.addEventListener("touchstart",s=>s.touches.length>1&&s.preventDefault(),{passive:!1}),document.addEventListener("gesturestart",s=>s.preventDefault(),{passive:!1})),l.doubleTap){let s=0;document.addEventListener("touchend",u=>{const f=Date.now();f-s<=250&&u.preventDefault(),s=f},{passive:!1})}l.wheel&&document.addEventListener("wheel",s=>(s.ctrlKey||s.metaKey)&&s.preventDefault(),{passive:!1}),(i=l.buttons)!=null&&i.length&&document.addEventListener("keydown",s=>(s.ctrlKey||s.metaKey)&&l.buttons.includes(s.key)&&s.preventDefault())};Object.defineProperty(fe,"useRoute",{enumerable:!0,get:()=>ke.useRoute}),Object.defineProperty(fe,"useRouter",{enumerable:!0,get:()=>ke.useRouter}),fe.BasketButton=Zm,fe.BottomSheet=xo,fe.ButtonDefault=an,fe.CardMain=_a,fe.CardProductPage=A0,fe.CardReader=fa,fe.CartBox=ua,fe.CartPage=vh,fe.DrumItem=V2,fe.FallingHearts=Hm,fe.GroupMain=M2,fe.InitConnection=yn,fe.ModalWindows=K2,fe.NotificationWindow=Ei,fe.OrderBox=bo,fe.PopupWindowDefault=da,fe.PricePrerender=hr,fe.QrCameraScanner=km,fe.QrcodeVue=xa,fe.Recommendation=j2,fe.RetryPage=$h,fe.TableOrderPage=_2,fe.TagsMain=v2,fe.VList=dg,fe.Virtualizer=$a,fe.clearAllProductDB=Rl,fe.clearLocalStorage=mr,fe.getCachedGroup=qi,fe.getCachedProduct=rs,fe.getWebSocketInstance=Lr,fe.initPinia=ul,fe.initRouter=hl,fe.isNetworkError=pg,fe.parseTheme=ia,fe.preventZoom=_g,fe.updateIndexedDB=Pm,fe.useCachedMedia=Tn,fe.useCardLibStore=Lt,fe.useCartLibStore=Mt,fe.useImageCacheStore=si,fe.useMainLibStore=st,fe.useModal=yo,fe.useModalStore=bi,fe.useModulesLibStore=Gr,fe.usePdf=Hn,fe.useTableStore=Fn,fe.useThemeStore=St,fe.useVirtuaLoop=fg,fe.vClickOutside=Rm,fe.vConfetti=Bm,fe.vDragScroll=Wr,fe.vMario=Om,fe.vMuted=Xr,Object.defineProperty(fe,Symbol.toStringTag,{value:"Module"})});
28
+ `),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<ur.NUM_MASK_PATTERNS}}ur.NUM_MASK_PATTERNS=8;class dt extends x{}dt.kind="WriterException";class Oe{constructor(){}static clearMatrix(e){e.clear(255)}static buildMatrix(e,t,n,s,c){Oe.clearMatrix(c),Oe.embedBasicPatterns(n,c),Oe.embedTypeInfo(t,s,c),Oe.maybeEmbedVersionInfo(n,c),Oe.embedDataBits(e,s,c)}static embedBasicPatterns(e,t){Oe.embedPositionDetectionPatternsAndSeparators(t),Oe.embedDarkDotAtLeftBottomCorner(t),Oe.maybeEmbedPositionAdjustmentPatterns(e,t),Oe.embedTimingPatterns(t)}static embedTypeInfo(e,t,n){const s=new j;Oe.makeTypeInfoBits(e,t,s);for(let c=0,d=s.getSize();c<d;++c){const h=s.get(s.getSize()-1-c),g=Oe.TYPE_INFO_COORDINATES[c],w=g[0],E=g[1];if(n.setBoolean(w,E,h),c<8){const A=n.getWidth()-c-1;n.setBoolean(A,8,h)}else{const S=n.getHeight()-7+(c-8);n.setBoolean(8,S,h)}}}static maybeEmbedVersionInfo(e,t){if(e.getVersionNumber()<7)return;const n=new j;Oe.makeVersionInfoBits(e,n);let s=6*3-1;for(let c=0;c<6;++c)for(let d=0;d<3;++d){const h=n.get(s);s--,t.setBoolean(c,t.getHeight()-11+d,h),t.setBoolean(t.getHeight()-11+d,c,h)}}static embedDataBits(e,t,n){let s=0,c=-1,d=n.getWidth()-1,h=n.getHeight()-1;for(;d>0;){for(d===6&&(d-=1);h>=0&&h<n.getHeight();){for(let g=0;g<2;++g){const w=d-g;if(!Oe.isEmpty(n.get(w,h)))continue;let E;s<e.getSize()?(E=e.get(s),++s):E=!1,t!==255&&Tt.getDataMaskBit(t,w,h)&&(E=!E),n.setBoolean(w,h,E)}h+=c}c=-c,h+=c,d-=2}if(s!==e.getSize())throw new dt("Not all bits consumed: "+s+"/"+e.getSize())}static findMSBSet(e){return 32-v.numberOfLeadingZeros(e)}static calculateBCHCode(e,t){if(t===0)throw new y("0 polynomial");const n=Oe.findMSBSet(t);for(e<<=n-1;Oe.findMSBSet(e)>=n;)e^=t<<Oe.findMSBSet(e)-n;return e}static makeTypeInfoBits(e,t,n){if(!ur.isValidMaskPattern(t))throw new dt("Invalid mask pattern");const s=e.getBits()<<3|t;n.appendBits(s,5);const c=Oe.calculateBCHCode(s,Oe.TYPE_INFO_POLY);n.appendBits(c,10);const d=new j;if(d.appendBits(Oe.TYPE_INFO_MASK_PATTERN,15),n.xor(d),n.getSize()!==15)throw new dt("should not happen but we got: "+n.getSize())}static makeVersionInfoBits(e,t){t.appendBits(e.getVersionNumber(),6);const n=Oe.calculateBCHCode(e.getVersionNumber(),Oe.VERSION_INFO_POLY);if(t.appendBits(n,12),t.getSize()!==18)throw new dt("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;Oe.isEmpty(e.get(t,6))&&e.setNumber(t,6,n),Oe.isEmpty(e.get(6,t))&&e.setNumber(6,t,n)}}static embedDarkDotAtLeftBottomCorner(e){if(e.get(8,e.getHeight()-8)===0)throw new dt;e.setNumber(8,e.getHeight()-8,1)}static embedHorizontalSeparationPattern(e,t,n){for(let s=0;s<8;++s){if(!Oe.isEmpty(n.get(e+s,t)))throw new dt;n.setNumber(e+s,t,0)}}static embedVerticalSeparationPattern(e,t,n){for(let s=0;s<7;++s){if(!Oe.isEmpty(n.get(e,t+s)))throw new dt;n.setNumber(e,t+s,0)}}static embedPositionAdjustmentPattern(e,t,n){for(let s=0;s<5;++s){const c=Oe.POSITION_ADJUSTMENT_PATTERN[s];for(let d=0;d<5;++d)n.setNumber(e+d,t+s,c[d])}}static embedPositionDetectionPattern(e,t,n){for(let s=0;s<7;++s){const c=Oe.POSITION_DETECTION_PATTERN[s];for(let d=0;d<7;++d)n.setNumber(e+d,t+s,c[d])}}static embedPositionDetectionPatternsAndSeparators(e){const t=Oe.POSITION_DETECTION_PATTERN[0].length;Oe.embedPositionDetectionPattern(0,0,e),Oe.embedPositionDetectionPattern(e.getWidth()-t,0,e),Oe.embedPositionDetectionPattern(0,e.getWidth()-t,e);const n=8;Oe.embedHorizontalSeparationPattern(0,n-1,e),Oe.embedHorizontalSeparationPattern(e.getWidth()-n,n-1,e),Oe.embedHorizontalSeparationPattern(0,e.getWidth()-n,e);const s=7;Oe.embedVerticalSeparationPattern(s,0,e),Oe.embedVerticalSeparationPattern(e.getHeight()-s-1,0,e),Oe.embedVerticalSeparationPattern(s,e.getHeight()-s,e)}static maybeEmbedPositionAdjustmentPatterns(e,t){if(e.getVersionNumber()<2)return;const n=e.getVersionNumber()-1,s=Oe.POSITION_ADJUSTMENT_PATTERN_COORDINATE_TABLE[n];for(let c=0,d=s.length;c!==d;c++){const h=s[c];if(h>=0)for(let g=0;g!==d;g++){const w=s[g];w>=0&&Oe.isEmpty(t.get(w,h))&&Oe.embedPositionAdjustmentPattern(w-2,h-2,t)}}}}Oe.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])]),Oe.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])]),Oe.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])]),Oe.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])]),Oe.VERSION_INFO_POLY=7973,Oe.TYPE_INFO_POLY=1335,Oe.TYPE_INFO_MASK_PATTERN=21522;class Hg{constructor(e,t){this.dataBytes=e,this.errorCorrectionBytes=t}getDataBytes(){return this.dataBytes}getErrorCorrectionBytes(){return this.errorCorrectionBytes}}class pt{constructor(){}static calculateMaskPenalty(e){return Tt.applyMaskPenaltyRule1(e)+Tt.applyMaskPenaltyRule2(e)+Tt.applyMaskPenaltyRule3(e)+Tt.applyMaskPenaltyRule4(e)}static encode(e,t,n=null){let s=pt.DEFAULT_BYTE_MODE_ENCODING;const c=n!==null&&n.get(Pt.CHARACTER_SET)!==void 0;c&&(s=n.get(Pt.CHARACTER_SET).toString());const d=this.chooseMode(e,s),h=new j;if(d===Re.BYTE&&(c||pt.DEFAULT_BYTE_MODE_ENCODING!==s)){const me=F.getCharacterSetECIByName(s);me!==void 0&&this.appendECI(me,h)}this.appendModeInfo(d,h);const g=new j;this.appendBytes(e,d,g,s);let w;if(n!==null&&n.get(Pt.QR_VERSION)!==void 0){const me=Number.parseInt(n.get(Pt.QR_VERSION).toString(),10);w=Ne.getVersionForNumber(me);const de=this.calculateBitsNeeded(d,h,g,w);if(!this.willFit(de,w,t))throw new dt("Data too big for requested version")}else w=this.recommendVersion(t,d,h,g);const E=new j;E.appendBitArray(h);const A=d===Re.BYTE?g.getSizeInBytes():e.length;this.appendLengthInfo(A,w,d,E),E.appendBitArray(g);const S=w.getECBlocksForLevel(t),O=w.getTotalCodewords()-S.getTotalECCodewords();this.terminateBits(O,E);const U=this.interleaveWithECBytes(E,w.getTotalCodewords(),O,S.getNumBlocks()),z=new ur;z.setECLevel(t),z.setMode(d),z.setVersion(w);const Y=w.getDimensionForVersion(),ie=new Li(Y,Y),fe=this.chooseMaskPattern(U,t,w,ie);return z.setMaskPattern(fe),Oe.buildMatrix(U,t,w,fe,ie),z.setMatrix(ie),z}static recommendVersion(e,t,n,s){const c=this.calculateBitsNeeded(t,n,s,Ne.getVersionForNumber(1)),d=this.chooseVersion(c,e),h=this.calculateBitsNeeded(t,n,s,d);return this.chooseVersion(h,e)}static calculateBitsNeeded(e,t,n,s){return t.getSize()+e.getCharacterCountBits(s)+n.getSize()}static getAlphanumericCode(e){return e<pt.ALPHANUMERIC_TABLE.length?pt.ALPHANUMERIC_TABLE[e]:-1}static chooseMode(e,t=null){if(F.SJIS.getName()===t&&this.isOnlyDoubleByteKanji(e))return Re.KANJI;let n=!1,s=!1;for(let c=0,d=e.length;c<d;++c){const h=e.charAt(c);if(pt.isDigit(h))n=!0;else if(this.getAlphanumericCode(h.charCodeAt(0))!==-1)s=!0;else return Re.BYTE}return s?Re.ALPHANUMERIC:n?Re.NUMERIC:Re.BYTE}static isOnlyDoubleByteKanji(e){let t;try{t=K.encode(e,F.SJIS)}catch{return!1}const n=t.length;if(n%2!==0)return!1;for(let s=0;s<n;s+=2){const c=t[s]&255;if((c<129||c>159)&&(c<224||c>235))return!1}return!0}static chooseMaskPattern(e,t,n,s){let c=Number.MAX_SAFE_INTEGER,d=-1;for(let h=0;h<ur.NUM_MASK_PATTERNS;h++){Oe.buildMatrix(e,t,n,h,s);let g=this.calculateMaskPenalty(s);g<c&&(c=g,d=h)}return d}static chooseVersion(e,t){for(let n=1;n<=40;n++){const s=Ne.getVersionForNumber(n);if(pt.willFit(e,s,t))return s}throw new dt("Data too big")}static willFit(e,t,n){const s=t.getTotalCodewords(),d=t.getECBlocksForLevel(n).getTotalECCodewords(),h=s-d,g=(e+7)/8;return h>=g}static terminateBits(e,t){const n=e*8;if(t.getSize()>n)throw new dt("data bits cannot fit in the QR Code"+t.getSize()+" > "+n);for(let d=0;d<4&&t.getSize()<n;++d)t.appendBit(!1);const s=t.getSize()&7;if(s>0)for(let d=s;d<8;d++)t.appendBit(!1);const c=e-t.getSizeInBytes();for(let d=0;d<c;++d)t.appendBits(d&1?17:236,8);if(t.getSize()!==n)throw new dt("Bits size does not equal capacity")}static getNumDataBytesAndNumECBytesForBlockID(e,t,n,s,c,d){if(s>=n)throw new dt("Block ID too large");const h=e%n,g=n-h,w=Math.floor(e/n),E=w+1,A=Math.floor(t/n),S=A+1,O=w-A,U=E-S;if(O!==U)throw new dt("EC bytes mismatch");if(n!==g+h)throw new dt("RS blocks mismatch");if(e!==(A+O)*g+(S+U)*h)throw new dt("Total bytes mismatch");s<g?(c[0]=A,d[0]=O):(c[0]=S,d[0]=U)}static interleaveWithECBytes(e,t,n,s){if(e.getSizeInBytes()!==n)throw new dt("Number of bits and data bytes does not match");let c=0,d=0,h=0;const g=new Array;for(let E=0;E<s;++E){const A=new Int32Array(1),S=new Int32Array(1);pt.getNumDataBytesAndNumECBytesForBlockID(t,n,s,E,A,S);const O=A[0],U=new Uint8Array(O);e.toBytes(8*c,U,0,O);const z=pt.generateECBytes(U,S[0]);g.push(new Hg(U,z)),d=Math.max(d,O),h=Math.max(h,z.length),c+=A[0]}if(n!==c)throw new dt("Data bytes does not match offset");const w=new j;for(let E=0;E<d;++E)for(const A of g){const S=A.getDataBytes();E<S.length&&w.appendBits(S[E],8)}for(let E=0;E<h;++E)for(const A of g){const S=A.getErrorCorrectionBytes();E<S.length&&w.appendBits(S[E],8)}if(t!==w.getSizeInBytes())throw new dt("Interleaving error: "+t+" and "+w.getSizeInBytes()+" differ.");return w}static generateECBytes(e,t){const n=e.length,s=new Int32Array(n+t);for(let d=0;d<n;d++)s[d]=e[d]&255;new Go(Te.QR_CODE_FIELD_256).encode(s,t);const c=new Uint8Array(t);for(let d=0;d<t;d++)c[d]=s[n+d];return c}static appendModeInfo(e,t){t.appendBits(e.getBits(),4)}static appendLengthInfo(e,t,n,s){const c=n.getCharacterCountBits(t);if(e>=1<<c)throw new dt(e+" is bigger than "+((1<<c)-1));s.appendBits(e,c)}static appendBytes(e,t,n,s){switch(t){case Re.NUMERIC:pt.appendNumericBytes(e,n);break;case Re.ALPHANUMERIC:pt.appendAlphanumericBytes(e,n);break;case Re.BYTE:pt.append8BitBytes(e,n,s);break;case Re.KANJI:pt.appendKanjiBytes(e,n);break;default:throw new dt("Invalid mode: "+t)}}static getDigit(e){return e.charCodeAt(0)-48}static isDigit(e){const t=pt.getDigit(e);return t>=0&&t<=9}static appendNumericBytes(e,t){const n=e.length;let s=0;for(;s<n;){const c=pt.getDigit(e.charAt(s));if(s+2<n){const d=pt.getDigit(e.charAt(s+1)),h=pt.getDigit(e.charAt(s+2));t.appendBits(c*100+d*10+h,10),s+=3}else if(s+1<n){const d=pt.getDigit(e.charAt(s+1));t.appendBits(c*10+d,7),s+=2}else t.appendBits(c,4),s++}}static appendAlphanumericBytes(e,t){const n=e.length;let s=0;for(;s<n;){const c=pt.getAlphanumericCode(e.charCodeAt(s));if(c===-1)throw new dt;if(s+1<n){const d=pt.getAlphanumericCode(e.charCodeAt(s+1));if(d===-1)throw new dt;t.appendBits(c*45+d,11),s+=2}else t.appendBits(c,6),s++}}static append8BitBytes(e,t,n){let s;try{s=K.encode(e,n)}catch(c){throw new dt(c)}for(let c=0,d=s.length;c!==d;c++){const h=s[c];t.appendBits(h,8)}}static appendKanjiBytes(e,t){let n;try{n=K.encode(e,F.SJIS)}catch(c){throw new dt(c)}const s=n.length;for(let c=0;c<s;c+=2){const d=n[c]&255,h=n[c+1]&255,g=d<<8&4294967295|h;let w=-1;if(g>=33088&&g<=40956?w=g-33088:g>=57408&&g<=60351&&(w=g-49472),w===-1)throw new dt("Invalid byte sequence");const E=(w>>8)*192+(w&255);t.appendBits(E,13)}}static appendECI(e,t){t.appendBits(Re.ECI.getBits(),4),t.appendBits(e.getValue(),8)}}pt.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]),pt.DEFAULT_BYTE_MODE_ENCODING=F.UTF8.getName();class fr{write(e,t,n,s=null){if(e.length===0)throw new y("Found empty contents");if(t<0||n<0)throw new y("Requested dimensions are too small: "+t+"x"+n);let c=ht.L,d=fr.QUIET_ZONE_SIZE;s!==null&&(s.get(Pt.ERROR_CORRECTION)!==void 0&&(c=ht.fromString(s.get(Pt.ERROR_CORRECTION).toString())),s.get(Pt.MARGIN)!==void 0&&(d=Number.parseInt(s.get(Pt.MARGIN).toString(),10)));const h=pt.encode(e,c,s);return this.renderResult(h,t,n,d)}writeToDom(e,t,n,s,c=null){typeof e=="string"&&(e=document.querySelector(e));const d=this.write(t,n,s,c);e&&e.appendChild(d)}renderResult(e,t,n,s){const c=e.getMatrix();if(c===null)throw new Ve;const d=c.getWidth(),h=c.getHeight(),g=d+s*2,w=h+s*2,E=Math.max(t,g),A=Math.max(n,w),S=Math.min(Math.floor(E/g),Math.floor(A/w)),O=Math.floor((E-d*S)/2),U=Math.floor((A-h*S)/2),z=this.createSVGElement(E,A);for(let Y=0,ie=U;Y<h;Y++,ie+=S)for(let fe=0,me=O;fe<d;fe++,me+=S)if(c.get(fe,Y)===1){const de=this.createSvgRectElement(me,ie,S,S);z.appendChild(de)}return z}createSVGElement(e,t){const n=document.createElementNS(fr.SVG_NS,"svg");return n.setAttributeNS(null,"height",e.toString()),n.setAttributeNS(null,"width",t.toString()),n}createSvgRectElement(e,t,n,s){const c=document.createElementNS(fr.SVG_NS,"rect");return c.setAttributeNS(null,"x",e.toString()),c.setAttributeNS(null,"y",t.toString()),c.setAttributeNS(null,"height",n.toString()),c.setAttributeNS(null,"width",s.toString()),c.setAttributeNS(null,"fill","#000000"),c}}fr.QUIET_ZONE_SIZE=4,fr.SVG_NS="http://www.w3.org/2000/svg";class Br{encode(e,t,n,s,c){if(e.length===0)throw new y("Found empty contents");if(t!==ue.QR_CODE)throw new y("Can only encode QR_CODE, but got "+t);if(n<0||s<0)throw new y(`Requested dimensions are too small: ${n}x${s}`);let d=ht.L,h=Br.QUIET_ZONE_SIZE;c!==null&&(c.get(Pt.ERROR_CORRECTION)!==void 0&&(d=ht.fromString(c.get(Pt.ERROR_CORRECTION).toString())),c.get(Pt.MARGIN)!==void 0&&(h=Number.parseInt(c.get(Pt.MARGIN).toString(),10)));const g=pt.encode(e,d,c);return Br.renderResult(g,n,s,h)}static renderResult(e,t,n,s){const c=e.getMatrix();if(c===null)throw new Ve;const d=c.getWidth(),h=c.getHeight(),g=d+s*2,w=h+s*2,E=Math.max(t,g),A=Math.max(n,w),S=Math.min(Math.floor(E/g),Math.floor(A/w)),O=Math.floor((E-d*S)/2),U=Math.floor((A-h*S)/2),z=new W(E,A);for(let Y=0,ie=U;Y<h;Y++,ie+=S)for(let fe=0,me=O;fe<d;fe++,me+=S)c.get(fe,Y)===1&&z.setRegion(me,ie,S,S);return z}}Br.QUIET_ZONE_SIZE=4;class Gg{encode(e,t,n,s,c){let d;switch(t){case ue.QR_CODE:d=new Br;break;default:throw new y("No encoder available for format "+t)}return d.encode(e,t,n,s,c)}}class Dn extends q{constructor(e,t,n,s,c,d,h,g){if(super(d,h),this.yuvData=e,this.dataWidth=t,this.dataHeight=n,this.left=s,this.top=c,s+d>t||c+h>n)throw new y("Crop rectangle does not fit within image data.");g&&this.reverseHorizontal(d,h)}getRow(e,t){if(e<0||e>=this.getHeight())throw new y("Requested row is outside the image: "+e);const n=this.getWidth();(t==null||t.length<n)&&(t=new Uint8ClampedArray(n));const s=(e+this.top)*this.dataWidth+this.left;return D.arraycopy(this.yuvData,s,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,s=new Uint8ClampedArray(n);let c=this.top*this.dataWidth+this.left;if(e===this.dataWidth)return D.arraycopy(this.yuvData,c,s,0,n),s;for(let d=0;d<t;d++){const h=d*e;D.arraycopy(this.yuvData,c,s,h,e),c+=this.dataWidth}return s}isCropSupported(){return!0}crop(e,t,n,s){return new Dn(this.yuvData,this.dataWidth,this.dataHeight,this.left+e,this.top+t,n,s,!1)}renderThumbnail(){const e=this.getWidth()/Dn.THUMBNAIL_SCALE_FACTOR,t=this.getHeight()/Dn.THUMBNAIL_SCALE_FACTOR,n=new Int32Array(e*t),s=this.yuvData;let c=this.top*this.dataWidth+this.left;for(let d=0;d<t;d++){const h=d*e;for(let g=0;g<e;g++){const w=s[c+g*Dn.THUMBNAIL_SCALE_FACTOR]&255;n[h+g]=4278190080|w*65793}c+=this.dataWidth*Dn.THUMBNAIL_SCALE_FACTOR}return n}getThumbnailWidth(){return this.getWidth()/Dn.THUMBNAIL_SCALE_FACTOR}getThumbnailHeight(){return this.getHeight()/Dn.THUMBNAIL_SCALE_FACTOR}reverseHorizontal(e,t){const n=this.yuvData;for(let s=0,c=this.top*this.dataWidth+this.left;s<t;s++,c+=this.dataWidth){const d=c+e/2;for(let h=c,g=c+e-1;h<d;h++,g--){const w=n[h];n[h]=n[g],n[g]=w}}}invert(){return new J(this)}}Dn.THUMBNAIL_SCALE_FACTOR=2;class Wo extends q{constructor(e,t,n,s,c,d,h){if(super(t,n),this.dataWidth=s,this.dataHeight=c,this.left=d,this.top=h,e.BYTES_PER_ELEMENT===4){const g=t*n,w=new Uint8ClampedArray(g);for(let E=0;E<g;E++){const A=e[E],S=A>>16&255,O=A>>7&510,U=A&255;w[E]=(S+O+U)/4&255}this.luminances=w}else this.luminances=e;if(s===void 0&&(this.dataWidth=t),c===void 0&&(this.dataHeight=n),d===void 0&&(this.left=0),h===void 0&&(this.top=0),this.left+t>this.dataWidth||this.top+n>this.dataHeight)throw new y("Crop rectangle does not fit within image data.")}getRow(e,t){if(e<0||e>=this.getHeight())throw new y("Requested row is outside the image: "+e);const n=this.getWidth();(t==null||t.length<n)&&(t=new Uint8ClampedArray(n));const s=(e+this.top)*this.dataWidth+this.left;return D.arraycopy(this.luminances,s,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,s=new Uint8ClampedArray(n);let c=this.top*this.dataWidth+this.left;if(e===this.dataWidth)return D.arraycopy(this.luminances,c,s,0,n),s;for(let d=0;d<t;d++){const h=d*e;D.arraycopy(this.luminances,c,s,h,e),c+=this.dataWidth}return s}isCropSupported(){return!0}crop(e,t,n,s){return new Wo(this.luminances,n,s,this.dataWidth,this.dataHeight,this.left+e,this.top+t)}invert(){return new J(this)}}class nl extends F{static forName(e){return this.getCharacterSetECIByName(e)}}class Xo{}Xo.ISO_8859_1=F.ISO8859_1;class rl{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 il{static singletonList(e){return[e]}static min(e,t){return e.sort(t)[0]}}class Wg{constructor(e){this.previous=e}getPrevious(){return this.previous}}class Or extends Wg{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 Or(this,e,t)}addBinaryShift(e,t){return console.warn("addBinaryShift on SimpleToken, this simply returns a copy of this token"),new Or(this,e,t)}toString(){let e=this.value&(1<<this.bitCount)-1;return e|=1<<this.bitCount,"<"+v.toBinaryString(e|1<<this.bitCount).substring(1)+">"}}class $o extends Or{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 $o(this,e,t)}toString(){return"<"+this.binaryShiftStart+"::"+(this.binaryShiftStart+this.binaryShiftByteCount-1)+">"}}function Xg(b,e,t){return new $o(b,e,t)}function ei(b,e,t){return new Or(b,e,t)}const $g=["UPPER","LOWER","DIGIT","MIXED","PUNCT"],Jn=0,Fi=1,xn=2,ol=3,vn=4,jg=new Or(null,0,0),jo=[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 qg(b){for(let e of b)M.fill(e,-1);return b[Jn][vn]=0,b[Fi][vn]=0,b[Fi][Jn]=28,b[ol][vn]=0,b[xn][vn]=0,b[xn][Jn]=15,b}const sl=qg(M.createInt32Array(6,6));class Pn{constructor(e,t,n,s){this.token=e,this.mode=t,this.binaryShiftByteCount=n,this.bitCount=s}getMode(){return this.mode}getToken(){return this.token}getBinaryShiftByteCount(){return this.binaryShiftByteCount}getBitCount(){return this.bitCount}latchAndAppend(e,t){let n=this.bitCount,s=this.token;if(e!==this.mode){let d=jo[this.mode][e];s=ei(s,d&65535,d>>16),n+=d>>16}let c=e===xn?4:5;return s=ei(s,t,c),new Pn(s,e,0,n+c)}shiftAndAppend(e,t){let n=this.token,s=this.mode===xn?4:5;return n=ei(n,sl[this.mode][e],s),n=ei(n,t,5),new Pn(n,this.mode,0,this.bitCount+s+5)}addBinaryShiftChar(e){let t=this.token,n=this.mode,s=this.bitCount;if(this.mode===vn||this.mode===xn){let h=jo[n][Jn];t=ei(t,h&65535,h>>16),s+=h>>16,n=Jn}let c=this.binaryShiftByteCount===0||this.binaryShiftByteCount===31?18:this.binaryShiftByteCount===62?9:8,d=new Pn(t,n,this.binaryShiftByteCount+1,s+c);return d.binaryShiftByteCount===2078&&(d=d.endBinaryShift(e+1)),d}endBinaryShift(e){if(this.binaryShiftByteCount===0)return this;let t=this.token;return t=Xg(t,e-this.binaryShiftByteCount,this.binaryShiftByteCount),new Pn(t,this.mode,0,this.bitCount)}isBetterThanOrEqualTo(e){let t=this.bitCount+(jo[this.mode][e.mode]>>16);return this.binaryShiftByteCount<e.binaryShiftByteCount?t+=Pn.calculateBinaryShiftCost(e)-Pn.calculateBinaryShiftCost(this):this.binaryShiftByteCount>e.binaryShiftByteCount&&e.binaryShiftByteCount>0&&(t+=10),t<=e.bitCount}toBitArray(e){let t=[];for(let s=this.endBinaryShift(e.length).token;s!==null;s=s.getPrevious())t.unshift(s);let n=new j;for(const s of t)s.appendTo(n,e);return n}toString(){return ee.format("%s bits=%d bytes=%d",$g[this.mode],this.bitCount,this.binaryShiftByteCount)}static calculateBinaryShiftCost(e){return e.binaryShiftByteCount>62?21:e.binaryShiftByteCount>31?20:e.binaryShiftByteCount>0?10:0}}Pn.INITIAL_STATE=new Pn(jg,Jn,0,0);function Zg(b){const e=ee.getCharCode(" "),t=ee.getCharCode("."),n=ee.getCharCode(",");b[Jn][e]=1;const s=ee.getCharCode("Z"),c=ee.getCharCode("A");for(let S=c;S<=s;S++)b[Jn][S]=S-c+2;b[Fi][e]=1;const d=ee.getCharCode("z"),h=ee.getCharCode("a");for(let S=h;S<=d;S++)b[Fi][S]=S-h+2;b[xn][e]=1;const g=ee.getCharCode("9"),w=ee.getCharCode("0");for(let S=w;S<=g;S++)b[xn][S]=S-w+2;b[xn][n]=12,b[xn][t]=13;const E=["\0"," ","","","","","","","\x07","\b"," ",`
29
+ `,"\v","\f","\r","\x1B","","","","","@","\\","^","_","`","|","~",""];for(let S=0;S<E.length;S++)b[ol][ee.getCharCode(E[S])]=S;const A=["\0","\r","\0","\0","\0","\0","!","'","#","$","%","&","'","(",")","*","+",",","-",".","/",":",";","<","=",">","?","[","]","{","}"];for(let S=0;S<A.length;S++)ee.getCharCode(A[S])>0&&(b[vn][ee.getCharCode(A[S])]=S);return b}const qo=Zg(M.createInt32Array(5,256));class ti{constructor(e){this.text=e}encode(){const e=ee.getCharCode(" "),t=ee.getCharCode(`
30
+ `);let n=il.singletonList(Pn.INITIAL_STATE);for(let c=0;c<this.text.length;c++){let d,h=c+1<this.text.length?this.text[c+1]:0;switch(this.text[c]){case ee.getCharCode("\r"):d=h===t?2:0;break;case ee.getCharCode("."):d=h===e?3:0;break;case ee.getCharCode(","):d=h===e?4:0;break;case ee.getCharCode(":"):d=h===e?5:0;break;default:d=0}d>0?(n=ti.updateStateListForPair(n,c,d),c++):n=this.updateStateListForChar(n,c)}return il.min(n,(c,d)=>c.getBitCount()-d.getBitCount()).toBitArray(this.text)}updateStateListForChar(e,t){const n=[];for(let s of e)this.updateStateForChar(s,t,n);return ti.simplifyStates(n)}updateStateForChar(e,t,n){let s=this.text[t]&255,c=qo[e.getMode()][s]>0,d=null;for(let h=0;h<=vn;h++){let g=qo[h][s];if(g>0){if(d==null&&(d=e.endBinaryShift(t)),!c||h===e.getMode()||h===xn){const w=d.latchAndAppend(h,g);n.push(w)}if(!c&&sl[e.getMode()][h]>=0){const w=d.shiftAndAppend(h,g);n.push(w)}}}if(e.getBinaryShiftByteCount()>0||qo[e.getMode()][s]===0){let h=e.addBinaryShiftChar(t);n.push(h)}}static updateStateListForPair(e,t,n){const s=[];for(let c of e)this.updateStateForPair(c,t,n,s);return this.simplifyStates(s)}static updateStateForPair(e,t,n,s){let c=e.endBinaryShift(t);if(s.push(c.latchAndAppend(vn,n)),e.getMode()!==vn&&s.push(c.shiftAndAppend(vn,n)),n===3||n===4){let d=c.latchAndAppend(xn,16-n).latchAndAppend(xn,1);s.push(d)}if(e.getBinaryShiftByteCount()>0){let d=e.addBinaryShiftChar(t).addBinaryShiftChar(t+1);s.push(d)}}static simplifyStates(e){let t=[];for(const n of e){let s=!0;for(const c of t){if(c.isBetterThanOrEqualTo(n)){s=!1;break}n.isBetterThanOrEqualTo(c)&&(t=t.filter(d=>d!==c))}s&&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 s=new ti(e).encode(),c=v.truncDivision(s.getSize()*t,100)+11,d=s.getSize()+c,h,g,w,E,A;if(n!==Qe.DEFAULT_AZTEC_LAYERS){if(h=n<0,g=Math.abs(n),g>(h?Qe.MAX_NB_BITS_COMPACT:Qe.MAX_NB_BITS))throw new y(ee.format("Illegal value %s for layers",n));w=Qe.totalBitsInLayer(g,h),E=Qe.WORD_SIZE[g];let de=w-w%E;if(A=Qe.stuffBits(s,E),A.getSize()+c>de)throw new y("Data to large for user specified layer");if(h&&A.getSize()>E*64)throw new y("Data to large for user specified layer")}else{E=0,A=null;for(let de=0;;de++){if(de>Qe.MAX_NB_BITS)throw new y("Data too large for an Aztec code");if(h=de<=3,g=h?de+1:de,w=Qe.totalBitsInLayer(g,h),d>w)continue;(A==null||E!==Qe.WORD_SIZE[g])&&(E=Qe.WORD_SIZE[g],A=Qe.stuffBits(s,E));let je=w-w%E;if(!(h&&A.getSize()>E*64)&&A.getSize()+c<=je)break}}let S=Qe.generateCheckWords(A,w,E),O=A.getSize()/E,U=Qe.generateModeMessage(h,g,O),z=(h?11:14)+g*4,Y=new Int32Array(z),ie;if(h){ie=z;for(let de=0;de<Y.length;de++)Y[de]=de}else{ie=z+1+2*v.truncDivision(v.truncDivision(z,2)-1,15);let de=v.truncDivision(z,2),je=v.truncDivision(ie,2);for(let Le=0;Le<de;Le++){let nn=Le+v.truncDivision(Le,15);Y[de-Le-1]=je-nn-1,Y[de+Le]=je+nn+1}}let fe=new W(ie);for(let de=0,je=0;de<g;de++){let Le=(g-de)*4+(h?9:12);for(let nn=0;nn<Le;nn++){let Nn=nn*2;for(let rn=0;rn<2;rn++)S.get(je+Nn+rn)&&fe.set(Y[de*2+rn],Y[de*2+nn]),S.get(je+Le*2+Nn+rn)&&fe.set(Y[de*2+nn],Y[z-1-de*2-rn]),S.get(je+Le*4+Nn+rn)&&fe.set(Y[z-1-de*2-rn],Y[z-1-de*2-nn]),S.get(je+Le*6+Nn+rn)&&fe.set(Y[z-1-de*2-nn],Y[de*2+rn])}je+=Le*8}if(Qe.drawModeMessage(fe,h,ie,U),h)Qe.drawBullsEye(fe,v.truncDivision(ie,2),5);else{Qe.drawBullsEye(fe,v.truncDivision(ie,2),7);for(let de=0,je=0;de<v.truncDivision(z,2)-1;de+=15,je+=16)for(let Le=v.truncDivision(ie,2)&1;Le<ie;Le+=2)fe.set(v.truncDivision(ie,2)-je,Le),fe.set(v.truncDivision(ie,2)+je,Le),fe.set(Le,v.truncDivision(ie,2)-je),fe.set(Le,v.truncDivision(ie,2)+je)}let me=new rl;return me.setCompact(h),me.setSize(ie),me.setLayers(g),me.setCodeWords(O),me.setMatrix(fe),me}static drawBullsEye(e,t,n){for(let s=0;s<n;s+=2)for(let c=t-s;c<=t+s;c++)e.set(c,t-s),e.set(c,t+s),e.set(t-s,c),e.set(t+s,c);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 s=new j;return e?(s.appendBits(t-1,2),s.appendBits(n-1,6),s=Qe.generateCheckWords(s,28,4)):(s.appendBits(t-1,5),s.appendBits(n-1,11),s=Qe.generateCheckWords(s,40,4)),s}static drawModeMessage(e,t,n,s){let c=v.truncDivision(n,2);if(t)for(let d=0;d<7;d++){let h=c-3+d;s.get(d)&&e.set(h,c-5),s.get(d+7)&&e.set(c+5,h),s.get(20-d)&&e.set(h,c+5),s.get(27-d)&&e.set(c-5,h)}else for(let d=0;d<10;d++){let h=c-5+d+v.truncDivision(d,5);s.get(d)&&e.set(h,c-7),s.get(d+10)&&e.set(c+7,h),s.get(29-d)&&e.set(h,c+7),s.get(39-d)&&e.set(c-7,h)}}static generateCheckWords(e,t,n){let s=e.getSize()/n,c=new Go(Qe.getGF(n)),d=v.truncDivision(t,n),h=Qe.bitsToWords(e,n,d);c.encode(h,d-s);let g=t%n,w=new j;w.appendBits(0,g);for(const E of Array.from(h))w.appendBits(E,n);return w}static bitsToWords(e,t,n){let s=new Int32Array(n),c,d;for(c=0,d=e.getSize()/t;c<d;c++){let h=0;for(let g=0;g<t;g++)h|=e.get(c*t+g)?1<<t-g-1:0;s[c]=h}return s}static getGF(e){switch(e){case 4:return Te.AZTEC_PARAM;case 6:return Te.AZTEC_DATA_6;case 8:return Te.AZTEC_DATA_8;case 10:return Te.AZTEC_DATA_10;case 12:return Te.AZTEC_DATA_12;default:throw new y("Unsupported word size "+e)}}static stuffBits(e,t){let n=new j,s=e.getSize(),c=(1<<t)-2;for(let d=0;d<s;d+=t){let h=0;for(let g=0;g<t;g++)(d+g>=s||e.get(d+g))&&(h|=1<<t-1-g);(h&c)===c?(n.appendBits(h&c,t),d--):h&c?n.appendBits(h,t):(n.appendBits(h|1,t),d--)}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 Vi{encode(e,t,n,s){return this.encodeWithHints(e,t,n,s,null)}encodeWithHints(e,t,n,s,c){let d=Xo.ISO_8859_1,h=Qe.DEFAULT_EC_PERCENT,g=Qe.DEFAULT_AZTEC_LAYERS;return c!=null&&(c.has(Pt.CHARACTER_SET)&&(d=nl.forName(c.get(Pt.CHARACTER_SET).toString())),c.has(Pt.ERROR_CORRECTION)&&(h=v.parseInt(c.get(Pt.ERROR_CORRECTION).toString())),c.has(Pt.AZTEC_LAYERS)&&(g=v.parseInt(c.get(Pt.AZTEC_LAYERS).toString()))),Vi.encodeLayers(e,t,n,s,d,h,g)}static encodeLayers(e,t,n,s,c,d,h){if(t!==ue.AZTEC)throw new y("Can only encode AZTEC, but got "+t);let g=Qe.encode(ee.getBytes(e,c),d,h);return Vi.renderResult(g,n,s)}static renderResult(e,t,n){let s=e.getMatrix();if(s==null)throw new Ve;let c=s.getWidth(),d=s.getHeight(),h=Math.max(t,c),g=Math.max(n,d),w=Math.min(h/c,g/d),E=(h-c*w)/2,A=(g-d*w)/2,S=new W(h,g);for(let O=0,U=A;O<d;O++,U+=w)for(let z=0,Y=E;z<c;z++,Y+=w)s.get(z,O)&&S.setRegion(Y,U,w,w);return S}}i.AbstractExpandedDecoder=Mo,i.ArgumentException=C,i.ArithmeticException=At,i.AztecCode=rl,i.AztecCodeReader=Ir,i.AztecCodeWriter=Vi,i.AztecDecoder=Je,i.AztecDetector=Bi,i.AztecDetectorResult=ki,i.AztecEncoder=Qe,i.AztecHighLevelEncoder=ti,i.AztecPoint=Ut,i.BarcodeFormat=ue,i.Binarizer=T,i.BinaryBitmap=I,i.BitArray=j,i.BitMatrix=W,i.BitSource=Lo,i.BrowserAztecCodeReader=Oo,i.BrowserBarcodeReader=Ig,i.BrowserCodeReader=ge,i.BrowserDatamatrixCodeReader=Tg,i.BrowserMultiFormatReader=Vg,i.BrowserPDF417Reader=Ug,i.BrowserQRCodeReader=zg,i.BrowserQRCodeSvgWriter=fr,i.CharacterSetECI=F,i.ChecksumException=B,i.Code128Reader=pe,i.Code39Reader=Rt,i.DataMatrixDecodedBitStreamParser=Zn,i.DataMatrixReader=Yn,i.DecodeHintType=Z,i.DecoderResult=Ke,i.DefaultGridSampler=Ri,i.DetectorResult=$n,i.EAN13Reader=Ye,i.EncodeHintType=Pt,i.Exception=x,i.FormatException=V,i.GenericGF=Te,i.GenericGFPoly=He,i.GlobalHistogramBinarizer=X,i.GridSampler=cn,i.GridSamplerInstance=Bn,i.HTMLCanvasElementLuminanceSource=le,i.HybridBinarizer=$,i.ITFReader=et,i.IllegalArgumentException=y,i.IllegalStateException=Ve,i.InvertedLuminanceSource=J,i.LuminanceSource=q,i.MathUtils=ve,i.MultiFormatOneDReader=kr,i.MultiFormatReader=tl,i.MultiFormatWriter=Gg,i.NotFoundException=N,i.OneDReader=St,i.PDF417DecodedBitStreamParser=ne,i.PDF417DecoderErrorCorrection=Za,i.PDF417Reader=Ht,i.PDF417ResultMetadata=Ka,i.PerspectiveTransform=Jt,i.PlanarYUVLuminanceSource=Dn,i.QRCodeByteMatrix=Li,i.QRCodeDataMask=gn,i.QRCodeDecodedBitStreamParser=yt,i.QRCodeDecoderErrorCorrectionLevel=ht,i.QRCodeDecoderFormatInformation=$t,i.QRCodeEncoder=pt,i.QRCodeEncoderQRCode=ur,i.QRCodeMaskUtil=Tt,i.QRCodeMatrixUtil=Oe,i.QRCodeMode=Re,i.QRCodeReader=Kn,i.QRCodeVersion=Ne,i.QRCodeWriter=Br,i.RGBLuminanceSource=Wo,i.RSS14Reader=Nt,i.RSSExpandedReader=ce,i.ReaderException=Pi,i.ReedSolomonDecoder=kt,i.ReedSolomonEncoder=Go,i.ReedSolomonException=Se,i.Result=Ee,i.ResultMetadataType=Ae,i.ResultPoint=be,i.StringUtils=ee,i.UnsupportedOperationException=re,i.VideoInputDevice=se,i.WhiteRectangleDetector=fn,i.WriterException=dt,i.ZXingArrays=M,i.ZXingCharset=nl,i.ZXingInteger=v,i.ZXingStandardCharsets=Xo,i.ZXingStringBuilder=G,i.ZXingStringEncoding=K,i.ZXingSystem=D,i.createAbstractExpandedDecoder=ja,Object.defineProperty(i,"__esModule",{value:!0})})})(So,So.exports);var mt=So.exports;const sm=dl({__proto__:null,default:ta(mt)},[mt]);var Aa=function(){function a(l,i,o){if(this.formatMap=new Map([[we.QR_CODE,mt.BarcodeFormat.QR_CODE],[we.AZTEC,mt.BarcodeFormat.AZTEC],[we.CODABAR,mt.BarcodeFormat.CODABAR],[we.CODE_39,mt.BarcodeFormat.CODE_39],[we.CODE_93,mt.BarcodeFormat.CODE_93],[we.CODE_128,mt.BarcodeFormat.CODE_128],[we.DATA_MATRIX,mt.BarcodeFormat.DATA_MATRIX],[we.MAXICODE,mt.BarcodeFormat.MAXICODE],[we.ITF,mt.BarcodeFormat.ITF],[we.EAN_13,mt.BarcodeFormat.EAN_13],[we.EAN_8,mt.BarcodeFormat.EAN_8],[we.PDF_417,mt.BarcodeFormat.PDF_417],[we.RSS_14,mt.BarcodeFormat.RSS_14],[we.RSS_EXPANDED,mt.BarcodeFormat.RSS_EXPANDED],[we.UPC_A,mt.BarcodeFormat.UPC_A],[we.UPC_E,mt.BarcodeFormat.UPC_E],[we.UPC_EAN_EXTENSION,mt.BarcodeFormat.UPC_EAN_EXTENSION]]),this.reverseFormatMap=this.createReverseFormatMap(),!sm)throw"Use html5qrcode.min.js without edit, ZXing not found.";this.verbose=i,this.logger=o;var u=this.createZXingFormats(l),f=new Map;f.set(mt.DecodeHintType.POSSIBLE_FORMATS,u),f.set(mt.DecodeHintType.TRY_HARDER,!1),this.hints=f}return a.prototype.decodeAsync=function(l){var i=this;return new Promise(function(o,u){try{o(i.decode(l))}catch(f){u(f)}})},a.prototype.decode=function(l){var i=new mt.MultiFormatReader(this.verbose,this.hints),o=new mt.HTMLCanvasElementLuminanceSource(l),u=new mt.BinaryBitmap(new mt.HybridBinarizer(o)),f=i.decode(u);return{text:f.text,format:Ea.create(this.toHtml5QrcodeSupportedFormats(f.format)),debugData:this.createDebugData()}},a.prototype.createReverseFormatMap=function(){var l=new Map;return this.formatMap.forEach(function(i,o,u){l.set(i,o)}),l},a.prototype.toHtml5QrcodeSupportedFormats=function(l){if(!this.reverseFormatMap.has(l))throw"reverseFormatMap doesn't have ".concat(l);return this.reverseFormatMap.get(l)},a.prototype.createZXingFormats=function(l){for(var i=[],o=0,u=l;o<u.length;o++){var f=u[o];this.formatMap.has(f)?i.push(this.formatMap.get(f)):this.logger.logError("".concat(f," is not supported by")+"ZXingHtml5QrcodeShim")}return i},a.prototype.createDebugData=function(){return{decoderName:"zxing-js"}},a}(),am=function(a,l,i,o){function u(f){return f instanceof i?f:new i(function(m){m(f)})}return new(i||(i=Promise))(function(f,m){function p(C){try{x(o.next(C))}catch(y){m(y)}}function _(C){try{x(o.throw(C))}catch(y){m(y)}}function x(C){C.done?f(C.value):u(C.value).then(p,_)}x((o=o.apply(a,l||[])).next())})},lm=function(a,l){var i={label:0,sent:function(){if(f[0]&1)throw f[1];return f[1]},trys:[],ops:[]},o,u,f,m;return m={next:p(0),throw:p(1),return:p(2)},typeof Symbol=="function"&&(m[Symbol.iterator]=function(){return this}),m;function p(x){return function(C){return _([x,C])}}function _(x){if(o)throw new TypeError("Generator is already executing.");for(;m&&(m=0,x[0]&&(i=0)),i;)try{if(o=1,u&&(f=x[0]&2?u.return:x[0]?u.throw||((f=u.return)&&f.call(u),0):u.next)&&!(f=f.call(u,x[1])).done)return f;switch(u=0,f&&(x=[x[0]&2,f.value]),x[0]){case 0:case 1:f=x;break;case 4:return i.label++,{value:x[1],done:!1};case 5:i.label++,u=x[1],x=[0];continue;case 7:x=i.ops.pop(),i.trys.pop();continue;default:if(f=i.trys,!(f=f.length>0&&f[f.length-1])&&(x[0]===6||x[0]===2)){i=0;continue}if(x[0]===3&&(!f||x[1]>f[0]&&x[1]<f[3])){i.label=x[1];break}if(x[0]===6&&i.label<f[1]){i.label=f[1],f=x;break}if(f&&i.label<f[2]){i.label=f[2],i.ops.push(x);break}f[2]&&i.ops.pop(),i.trys.pop();continue}x=l.call(a,i)}catch(C){x=[6,C],u=0}finally{o=f=0}if(x[0]&5)throw x[1];return{value:x[0]?x[1]:void 0,done:!0}}},Sa=function(){function a(l,i,o){if(this.formatMap=new Map([[we.QR_CODE,"qr_code"],[we.AZTEC,"aztec"],[we.CODABAR,"codabar"],[we.CODE_39,"code_39"],[we.CODE_93,"code_93"],[we.CODE_128,"code_128"],[we.DATA_MATRIX,"data_matrix"],[we.ITF,"itf"],[we.EAN_13,"ean_13"],[we.EAN_8,"ean_8"],[we.PDF_417,"pdf417"],[we.UPC_A,"upc_a"],[we.UPC_E,"upc_e"]]),this.reverseFormatMap=this.createReverseFormatMap(),!a.isSupported())throw"Use html5qrcode.min.js without edit, Use BarcodeDetectorDelegate only if it isSupported();";this.verbose=i,this.logger=o;var u=this.createBarcodeDetectorFormats(l);if(this.detector=new BarcodeDetector(u),!this.detector)throw"BarcodeDetector detector not supported"}return a.isSupported=function(){if(!("BarcodeDetector"in window))return!1;var l=new BarcodeDetector({formats:["qr_code"]});return typeof l<"u"},a.prototype.decodeAsync=function(l){return am(this,void 0,void 0,function(){var i,o;return lm(this,function(u){switch(u.label){case 0:return[4,this.detector.detect(l)];case 1:if(i=u.sent(),!i||i.length===0)throw"No barcode or QR code detected.";return o=this.selectLargestBarcode(i),[2,{text:o.rawValue,format:Ea.create(this.toHtml5QrcodeSupportedFormats(o.format)),debugData:this.createDebugData()}]}})})},a.prototype.selectLargestBarcode=function(l){for(var i=null,o=0,u=0,f=l;u<f.length;u++){var m=f[u],p=m.boundingBox.width*m.boundingBox.height;p>o&&(o=p,i=m)}if(!i)throw"No largest barcode found";return i},a.prototype.createBarcodeDetectorFormats=function(l){for(var i=[],o=0,u=l;o<u.length;o++){var f=u[o];this.formatMap.has(f)?i.push(this.formatMap.get(f)):this.logger.warn("".concat(f," is not supported by")+"BarcodeDetectorDelegate")}return{formats:i}},a.prototype.toHtml5QrcodeSupportedFormats=function(l){if(!this.reverseFormatMap.has(l))throw"reverseFormatMap doesn't have ".concat(l);return this.reverseFormatMap.get(l)},a.prototype.createReverseFormatMap=function(){var l=new Map;return this.formatMap.forEach(function(i,o,u){l.set(i,o)}),l},a.prototype.createDebugData=function(){return{decoderName:"BarcodeDetector"}},a}(),Ia=function(a,l,i,o){function u(f){return f instanceof i?f:new i(function(m){m(f)})}return new(i||(i=Promise))(function(f,m){function p(C){try{x(o.next(C))}catch(y){m(y)}}function _(C){try{x(o.throw(C))}catch(y){m(y)}}function x(C){C.done?f(C.value):u(C.value).then(p,_)}x((o=o.apply(a,l||[])).next())})},Na=function(a,l){var i={label:0,sent:function(){if(f[0]&1)throw f[1];return f[1]},trys:[],ops:[]},o,u,f,m;return m={next:p(0),throw:p(1),return:p(2)},typeof Symbol=="function"&&(m[Symbol.iterator]=function(){return this}),m;function p(x){return function(C){return _([x,C])}}function _(x){if(o)throw new TypeError("Generator is already executing.");for(;m&&(m=0,x[0]&&(i=0)),i;)try{if(o=1,u&&(f=x[0]&2?u.return:x[0]?u.throw||((f=u.return)&&f.call(u),0):u.next)&&!(f=f.call(u,x[1])).done)return f;switch(u=0,f&&(x=[x[0]&2,f.value]),x[0]){case 0:case 1:f=x;break;case 4:return i.label++,{value:x[1],done:!1};case 5:i.label++,u=x[1],x=[0];continue;case 7:x=i.ops.pop(),i.trys.pop();continue;default:if(f=i.trys,!(f=f.length>0&&f[f.length-1])&&(x[0]===6||x[0]===2)){i=0;continue}if(x[0]===3&&(!f||x[1]>f[0]&&x[1]<f[3])){i.label=x[1];break}if(x[0]===6&&i.label<f[1]){i.label=f[1],f=x;break}if(f&&i.label<f[2]){i.label=f[2],i.ops.push(x);break}f[2]&&i.ops.pop(),i.trys.pop();continue}x=l.call(a,i)}catch(C){x=[6,C],u=0}finally{o=f=0}if(x[0]&5)throw x[1];return{value:x[0]?x[1]:void 0,done:!0}}},cm=function(){function a(l,i,o,u){this.EXECUTIONS_TO_REPORT_PERFORMANCE=100,this.executions=0,this.executionResults=[],this.wasPrimaryDecoderUsedInLastDecode=!1,this.verbose=o,i&&Sa.isSupported()?(this.primaryDecoder=new Sa(l,o,u),this.secondaryDecoder=new Aa(l,o,u)):this.primaryDecoder=new Aa(l,o,u)}return a.prototype.decodeAsync=function(l){return Ia(this,void 0,void 0,function(){var i;return Na(this,function(o){switch(o.label){case 0:i=performance.now(),o.label=1;case 1:return o.trys.push([1,,3,4]),[4,this.getDecoder().decodeAsync(l)];case 2:return[2,o.sent()];case 3:return this.possiblyLogPerformance(i),[7];case 4:return[2]}})})},a.prototype.decodeRobustlyAsync=function(l){return Ia(this,void 0,void 0,function(){var i,o;return Na(this,function(u){switch(u.label){case 0:i=performance.now(),u.label=1;case 1:return u.trys.push([1,3,4,5]),[4,this.primaryDecoder.decodeAsync(l)];case 2:return[2,u.sent()];case 3:if(o=u.sent(),this.secondaryDecoder)return[2,this.secondaryDecoder.decodeAsync(l)];throw o;case 4:return this.possiblyLogPerformance(i),[7];case 5:return[2]}})})},a.prototype.getDecoder=function(){return this.secondaryDecoder?this.wasPrimaryDecoderUsedInLastDecode===!1?(this.wasPrimaryDecoderUsedInLastDecode=!0,this.primaryDecoder):(this.wasPrimaryDecoderUsedInLastDecode=!1,this.secondaryDecoder):this.primaryDecoder},a.prototype.possiblyLogPerformance=function(l){if(this.verbose){var i=performance.now()-l;this.executionResults.push(i),this.executions++,this.possiblyFlushPerformanceReport()}},a.prototype.possiblyFlushPerformanceReport=function(){if(!(this.executions<this.EXECUTIONS_TO_REPORT_PERFORMANCE)){for(var l=0,i=0,o=this.executionResults;i<o.length;i++){var u=o[i];l+=u}var f=l/this.executionResults.length;console.log("".concat(f," ms for ").concat(this.executionResults.length," last runs.")),this.executions=0,this.executionResults=[]}},a}(),Io=function(){var a=function(l,i){return a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(o,u){o.__proto__=u}||function(o,u){for(var f in u)Object.prototype.hasOwnProperty.call(u,f)&&(o[f]=u[f])},a(l,i)};return function(l,i){if(typeof i!="function"&&i!==null)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");a(l,i);function o(){this.constructor=l}l.prototype=i===null?Object.create(i):(o.prototype=i.prototype,new o)}}(),Ai=function(a,l,i,o){function u(f){return f instanceof i?f:new i(function(m){m(f)})}return new(i||(i=Promise))(function(f,m){function p(C){try{x(o.next(C))}catch(y){m(y)}}function _(C){try{x(o.throw(C))}catch(y){m(y)}}function x(C){C.done?f(C.value):u(C.value).then(p,_)}x((o=o.apply(a,l||[])).next())})},Si=function(a,l){var i={label:0,sent:function(){if(f[0]&1)throw f[1];return f[1]},trys:[],ops:[]},o,u,f,m;return m={next:p(0),throw:p(1),return:p(2)},typeof Symbol=="function"&&(m[Symbol.iterator]=function(){return this}),m;function p(x){return function(C){return _([x,C])}}function _(x){if(o)throw new TypeError("Generator is already executing.");for(;m&&(m=0,x[0]&&(i=0)),i;)try{if(o=1,u&&(f=x[0]&2?u.return:x[0]?u.throw||((f=u.return)&&f.call(u),0):u.next)&&!(f=f.call(u,x[1])).done)return f;switch(u=0,f&&(x=[x[0]&2,f.value]),x[0]){case 0:case 1:f=x;break;case 4:return i.label++,{value:x[1],done:!1};case 5:i.label++,u=x[1],x=[0];continue;case 7:x=i.ops.pop(),i.trys.pop();continue;default:if(f=i.trys,!(f=f.length>0&&f[f.length-1])&&(x[0]===6||x[0]===2)){i=0;continue}if(x[0]===3&&(!f||x[1]>f[0]&&x[1]<f[3])){i.label=x[1];break}if(x[0]===6&&i.label<f[1]){i.label=f[1],f=x;break}if(f&&i.label<f[2]){i.label=f[2],i.ops.push(x);break}f[2]&&i.ops.pop(),i.trys.pop();continue}x=l.call(a,i)}catch(C){x=[6,C],u=0}finally{o=f=0}if(x[0]&5)throw x[1];return{value:x[0]?x[1]:void 0,done:!0}}},Ta=function(){function a(l,i){this.name=l,this.track=i}return a.prototype.isSupported=function(){return this.track.getCapabilities?this.name in this.track.getCapabilities():!1},a.prototype.apply=function(l){var i={};i[this.name]=l;var o={advanced:[i]};return this.track.applyConstraints(o)},a.prototype.value=function(){var l=this.track.getSettings();if(this.name in l){var i=l[this.name];return i}return null},a}(),dm=function(a){Io(l,a);function l(i,o){return a.call(this,i,o)||this}return l.prototype.min=function(){return this.getCapabilities().min},l.prototype.max=function(){return this.getCapabilities().max},l.prototype.step=function(){return this.getCapabilities().step},l.prototype.apply=function(i){var o={};o[this.name]=i;var u={advanced:[o]};return this.track.applyConstraints(u)},l.prototype.getCapabilities=function(){this.failIfNotSupported();var i=this.track.getCapabilities(),o=i[this.name];return{min:o.min,max:o.max,step:o.step}},l.prototype.failIfNotSupported=function(){if(!this.isSupported())throw new Error("".concat(this.name," capability not supported"))},l}(Ta),um=function(a){Io(l,a);function l(i){return a.call(this,"zoom",i)||this}return l}(dm),fm=function(a){Io(l,a);function l(i){return a.call(this,"torch",i)||this}return l}(Ta),hm=function(){function a(l){this.track=l}return a.prototype.zoomFeature=function(){return new um(this.track)},a.prototype.torchFeature=function(){return new fm(this.track)},a}(),mm=function(){function a(l,i,o){this.isClosed=!1,this.parentElement=l,this.mediaStream=i,this.callbacks=o,this.surface=this.createVideoElement(this.parentElement.clientWidth),l.append(this.surface)}return a.prototype.createVideoElement=function(l){var i=document.createElement("video");return i.style.width="".concat(l,"px"),i.style.display="block",i.muted=!0,i.setAttribute("muted","true"),i.playsInline=!0,i},a.prototype.setupSurface=function(){var l=this;this.surface.onabort=function(){throw"RenderedCameraImpl video surface onabort() called"},this.surface.onerror=function(){throw"RenderedCameraImpl video surface onerror() called"};var i=function(){var o=l.surface.clientWidth,u=l.surface.clientHeight;l.callbacks.onRenderSurfaceReady(o,u),l.surface.removeEventListener("playing",i)};this.surface.addEventListener("playing",i),this.surface.srcObject=this.mediaStream,this.surface.play()},a.create=function(l,i,o,u){return Ai(this,void 0,void 0,function(){var f,m;return Si(this,function(p){switch(p.label){case 0:return f=new a(l,i,u),o.aspectRatio?(m={aspectRatio:o.aspectRatio},[4,f.getFirstTrackOrFail().applyConstraints(m)]):[3,2];case 1:p.sent(),p.label=2;case 2:return f.setupSurface(),[2,f]}})})},a.prototype.failIfClosed=function(){if(this.isClosed)throw"The RenderedCamera has already been closed."},a.prototype.getFirstTrackOrFail=function(){if(this.failIfClosed(),this.mediaStream.getVideoTracks().length===0)throw"No video tracks found";return this.mediaStream.getVideoTracks()[0]},a.prototype.pause=function(){this.failIfClosed(),this.surface.pause()},a.prototype.resume=function(l){this.failIfClosed();var i=this,o=function(){setTimeout(l,200),i.surface.removeEventListener("playing",o)};this.surface.addEventListener("playing",o),this.surface.play()},a.prototype.isPaused=function(){return this.failIfClosed(),this.surface.paused},a.prototype.getSurface=function(){return this.failIfClosed(),this.surface},a.prototype.getRunningTrackCapabilities=function(){return this.getFirstTrackOrFail().getCapabilities()},a.prototype.getRunningTrackSettings=function(){return this.getFirstTrackOrFail().getSettings()},a.prototype.applyVideoConstraints=function(l){return Ai(this,void 0,void 0,function(){return Si(this,function(i){if("aspectRatio"in l)throw"Changing 'aspectRatio' in run-time is not yet supported.";return[2,this.getFirstTrackOrFail().applyConstraints(l)]})})},a.prototype.close=function(){if(this.isClosed)return Promise.resolve();var l=this;return new Promise(function(i,o){var u=l.mediaStream.getVideoTracks(),f=u.length,m=0;l.mediaStream.getVideoTracks().forEach(function(p){l.mediaStream.removeTrack(p),p.stop(),++m,m>=f&&(l.isClosed=!0,l.parentElement.removeChild(l.surface),i())})})},a.prototype.getCapabilities=function(){return new hm(this.getFirstTrackOrFail())},a}(),gm=function(){function a(l){this.mediaStream=l}return a.prototype.render=function(l,i,o){return Ai(this,void 0,void 0,function(){return Si(this,function(u){return[2,mm.create(l,this.mediaStream,i,o)]})})},a.create=function(l){return Ai(this,void 0,void 0,function(){var i,o;return Si(this,function(u){switch(u.label){case 0:if(!navigator.mediaDevices)throw"navigator.mediaDevices not supported";return i={audio:!1,video:l},[4,navigator.mediaDevices.getUserMedia(i)];case 1:return o=u.sent(),[2,new a(o)]}})})},a}(),ka=function(a,l,i,o){function u(f){return f instanceof i?f:new i(function(m){m(f)})}return new(i||(i=Promise))(function(f,m){function p(C){try{x(o.next(C))}catch(y){m(y)}}function _(C){try{x(o.throw(C))}catch(y){m(y)}}function x(C){C.done?f(C.value):u(C.value).then(p,_)}x((o=o.apply(a,l||[])).next())})},Ra=function(a,l){var i={label:0,sent:function(){if(f[0]&1)throw f[1];return f[1]},trys:[],ops:[]},o,u,f,m;return m={next:p(0),throw:p(1),return:p(2)},typeof Symbol=="function"&&(m[Symbol.iterator]=function(){return this}),m;function p(x){return function(C){return _([x,C])}}function _(x){if(o)throw new TypeError("Generator is already executing.");for(;m&&(m=0,x[0]&&(i=0)),i;)try{if(o=1,u&&(f=x[0]&2?u.return:x[0]?u.throw||((f=u.return)&&f.call(u),0):u.next)&&!(f=f.call(u,x[1])).done)return f;switch(u=0,f&&(x=[x[0]&2,f.value]),x[0]){case 0:case 1:f=x;break;case 4:return i.label++,{value:x[1],done:!1};case 5:i.label++,u=x[1],x=[0];continue;case 7:x=i.ops.pop(),i.trys.pop();continue;default:if(f=i.trys,!(f=f.length>0&&f[f.length-1])&&(x[0]===6||x[0]===2)){i=0;continue}if(x[0]===3&&(!f||x[1]>f[0]&&x[1]<f[3])){i.label=x[1];break}if(x[0]===6&&i.label<f[1]){i.label=f[1],f=x;break}if(f&&i.label<f[2]){i.label=f[2],i.ops.push(x);break}f[2]&&i.ops.pop(),i.trys.pop();continue}x=l.call(a,i)}catch(C){x=[6,C],u=0}finally{o=f=0}if(x[0]&5)throw x[1];return{value:x[0]?x[1]:void 0,done:!0}}},pm=function(){function a(){}return a.failIfNotSupported=function(){return ka(this,void 0,void 0,function(){return Ra(this,function(l){if(!navigator.mediaDevices)throw"navigator.mediaDevices not supported";return[2,new a]})})},a.prototype.create=function(l){return ka(this,void 0,void 0,function(){return Ra(this,function(i){return[2,gm.create(l)]})})},a}(),xm=function(a,l,i,o){function u(f){return f instanceof i?f:new i(function(m){m(f)})}return new(i||(i=Promise))(function(f,m){function p(C){try{x(o.next(C))}catch(y){m(y)}}function _(C){try{x(o.throw(C))}catch(y){m(y)}}function x(C){C.done?f(C.value):u(C.value).then(p,_)}x((o=o.apply(a,l||[])).next())})},_m=function(a,l){var i={label:0,sent:function(){if(f[0]&1)throw f[1];return f[1]},trys:[],ops:[]},o,u,f,m;return m={next:p(0),throw:p(1),return:p(2)},typeof Symbol=="function"&&(m[Symbol.iterator]=function(){return this}),m;function p(x){return function(C){return _([x,C])}}function _(x){if(o)throw new TypeError("Generator is already executing.");for(;m&&(m=0,x[0]&&(i=0)),i;)try{if(o=1,u&&(f=x[0]&2?u.return:x[0]?u.throw||((f=u.return)&&f.call(u),0):u.next)&&!(f=f.call(u,x[1])).done)return f;switch(u=0,f&&(x=[x[0]&2,f.value]),x[0]){case 0:case 1:f=x;break;case 4:return i.label++,{value:x[1],done:!1};case 5:i.label++,u=x[1],x=[0];continue;case 7:x=i.ops.pop(),i.trys.pop();continue;default:if(f=i.trys,!(f=f.length>0&&f[f.length-1])&&(x[0]===6||x[0]===2)){i=0;continue}if(x[0]===3&&(!f||x[1]>f[0]&&x[1]<f[3])){i.label=x[1];break}if(x[0]===6&&i.label<f[1]){i.label=f[1],f=x;break}if(f&&i.label<f[2]){i.label=f[2],i.ops.push(x);break}f[2]&&i.ops.pop(),i.trys.pop();continue}x=l.call(a,i)}catch(C){x=[6,C],u=0}finally{o=f=0}if(x[0]&5)throw x[1];return{value:x[0]?x[1]:void 0,done:!0}}},wm=function(){function a(){}return a.retrieve=function(){if(navigator.mediaDevices)return a.getCamerasFromMediaDevices();var l=MediaStreamTrack;return MediaStreamTrack&&l.getSources?a.getCamerasFromMediaStreamTrack():a.rejectWithError()},a.rejectWithError=function(){var l=br.unableToQuerySupportedDevices();return a.isHttpsOrLocalhost()||(l=br.insecureContextCameraQueryError()),Promise.reject(l)},a.isHttpsOrLocalhost=function(){if(location.protocol==="https:")return!0;var l=location.host.split(":")[0];return l==="127.0.0.1"||l==="localhost"},a.getCamerasFromMediaDevices=function(){return xm(this,void 0,void 0,function(){var l,i,o,u,f,m,p;return _m(this,function(_){switch(_.label){case 0:return l=function(x){for(var C=x.getVideoTracks(),y=0,I=C;y<I.length;y++){var B=I[y];B.enabled=!1,B.stop(),x.removeTrack(B)}},[4,navigator.mediaDevices.getUserMedia({audio:!1,video:!0})];case 1:return i=_.sent(),[4,navigator.mediaDevices.enumerateDevices()];case 2:for(o=_.sent(),u=[],f=0,m=o;f<m.length;f++)p=m[f],p.kind==="videoinput"&&u.push({id:p.deviceId,label:p.label});return l(i),[2,u]}})})},a.getCamerasFromMediaStreamTrack=function(){return new Promise(function(l,i){var o=function(f){for(var m=[],p=0,_=f;p<_.length;p++){var x=_[p];x.kind==="video"&&m.push({id:x.id,label:x.label})}l(m)},u=MediaStreamTrack;u.getSources(o)})},a}(),bt;(function(a){a[a.UNKNOWN=0]="UNKNOWN",a[a.NOT_STARTED=1]="NOT_STARTED",a[a.SCANNING=2]="SCANNING",a[a.PAUSED=3]="PAUSED"})(bt||(bt={}));var Cm=function(){function a(){this.state=bt.NOT_STARTED,this.onGoingTransactionNewState=bt.UNKNOWN}return a.prototype.directTransition=function(l){this.failIfTransitionOngoing(),this.validateTransition(l),this.state=l},a.prototype.startTransition=function(l){return this.failIfTransitionOngoing(),this.validateTransition(l),this.onGoingTransactionNewState=l,this},a.prototype.execute=function(){if(this.onGoingTransactionNewState===bt.UNKNOWN)throw"Transaction is already cancelled, cannot execute().";var l=this.onGoingTransactionNewState;this.onGoingTransactionNewState=bt.UNKNOWN,this.directTransition(l)},a.prototype.cancel=function(){if(this.onGoingTransactionNewState===bt.UNKNOWN)throw"Transaction is already cancelled, cannot cancel().";this.onGoingTransactionNewState=bt.UNKNOWN},a.prototype.getState=function(){return this.state},a.prototype.failIfTransitionOngoing=function(){if(this.onGoingTransactionNewState!==bt.UNKNOWN)throw"Cannot transition to a new state, already under transition"},a.prototype.validateTransition=function(l){switch(this.state){case bt.UNKNOWN:throw"Transition from unknown is not allowed";case bt.NOT_STARTED:this.failIfNewStateIs(l,[bt.PAUSED]);break;case bt.SCANNING:break;case bt.PAUSED:break}},a.prototype.failIfNewStateIs=function(l,i){for(var o=0,u=i;o<u.length;o++){var f=u[o];if(l===f)throw"Cannot transition from ".concat(this.state," to ").concat(l)}},a}(),Em=function(){function a(l){this.stateManager=l}return a.prototype.startTransition=function(l){return this.stateManager.startTransition(l)},a.prototype.directTransition=function(l){this.stateManager.directTransition(l)},a.prototype.getState=function(){return this.stateManager.getState()},a.prototype.canScanFile=function(){return this.stateManager.getState()===bt.NOT_STARTED},a.prototype.isScanning=function(){return this.stateManager.getState()!==bt.NOT_STARTED},a.prototype.isStrictlyScanning=function(){return this.stateManager.getState()===bt.SCANNING},a.prototype.isPaused=function(){return this.stateManager.getState()===bt.PAUSED},a}(),ym=function(){function a(){}return a.create=function(){return new Em(new Cm)},a}(),bm=function(){var a=function(l,i){return a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(o,u){o.__proto__=u}||function(o,u){for(var f in u)Object.prototype.hasOwnProperty.call(u,f)&&(o[f]=u[f])},a(l,i)};return function(l,i){if(typeof i!="function"&&i!==null)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");a(l,i);function o(){this.constructor=l}l.prototype=i===null?Object.create(i):(o.prototype=i.prototype,new o)}}(),ln=function(a){bm(l,a);function l(){return a!==null&&a.apply(this,arguments)||this}return l.DEFAULT_WIDTH=300,l.DEFAULT_WIDTH_OFFSET=2,l.FILE_SCAN_MIN_HEIGHT=300,l.FILE_SCAN_HIDDEN_CANVAS_PADDING=100,l.MIN_QR_BOX_SIZE=50,l.SHADED_LEFT=1,l.SHADED_RIGHT=2,l.SHADED_TOP=3,l.SHADED_BOTTOM=4,l.SHADED_REGION_ELEMENT_ID="qr-shaded-region",l.VERBOSE=!1,l.BORDER_SHADER_DEFAULT_COLOR="#ffffff",l.BORDER_SHADER_MATCH_COLOR="rgb(90, 193, 56)",l}(rm),Am=function(){function a(l,i){this.logger=i,this.fps=ln.SCAN_DEFAULT_FPS,l?(l.fps&&(this.fps=l.fps),this.disableFlip=l.disableFlip===!0,this.qrbox=l.qrbox,this.aspectRatio=l.aspectRatio,this.videoConstraints=l.videoConstraints):this.disableFlip=ln.DEFAULT_DISABLE_FLIP}return a.prototype.isMediaStreamConstraintsValid=function(){return this.videoConstraints?ba.isMediaStreamConstraintsValid(this.videoConstraints,this.logger):(this.logger.logError("Empty videoConstraints",!0),!1)},a.prototype.isShadedBoxEnabled=function(){return!zn(this.qrbox)},a.create=function(l,i){return new a(l,i)},a}(),Ba=function(){function a(l,i){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(l))throw"HTML Element with id=".concat(l," not found");this.elementId=l,this.verbose=!1;var o;typeof i=="boolean"?this.verbose=i===!0:i&&(o=i,this.verbose=o.verbose===!0,o.experimentalFeatures),this.logger=new om(this.verbose),this.qrcode=new cm(this.getSupportedFormats(i),this.getUseBarCodeDetectorIfSupported(o),this.verbose,this.logger),this.foreverScanTimeout,this.shouldScan=!0,this.stateManagerProxy=ym.create()}return a.prototype.start=function(l,i,o,u){var f=this;if(!l)throw"cameraIdOrConfig is required";if(!o||typeof o!="function")throw"qrCodeSuccessCallback is required and should be a function.";var m;u?m=u:m=this.verbose?this.logger.log:function(){};var p=Am.create(i,this.logger);this.clearElement();var _=!1;p.videoConstraints&&(p.isMediaStreamConstraintsValid()?_=!0:this.logger.logError("'videoConstraints' is not valid 'MediaStreamConstraints, it will be ignored.'",!0));var x=_,C=document.getElementById(this.elementId);C.clientWidth?C.clientWidth:ln.DEFAULT_WIDTH,C.style.position="relative",this.shouldScan=!0,this.element=C;var y=this,I=this.stateManagerProxy.startTransition(bt.SCANNING);return new Promise(function(B,T){var D=x?p.videoConstraints:y.createVideoConstraints(l);if(!D){I.cancel(),T("videoConstraints should be defined");return}var k={};(!x||p.aspectRatio)&&(k.aspectRatio=p.aspectRatio);var P={onRenderSurfaceReady:function(M,v){y.setupUi(M,v,p),y.isScanning=!0,y.foreverScan(p,o,m)}};pm.failIfNotSupported().then(function(M){M.create(D).then(function(v){return v.render(f.element,k,P).then(function(j){y.renderedCamera=j,I.execute(),B(null)}).catch(function(j){I.cancel(),T(j)})}).catch(function(v){I.cancel(),T(br.errorGettingUserMedia(v))})}).catch(function(M){I.cancel(),T(br.cameraStreamingNotSupported())})})},a.prototype.pause=function(l){if(!this.stateManagerProxy.isStrictlyScanning())throw"Cannot pause, scanner is not scanning.";this.stateManagerProxy.directTransition(bt.PAUSED),this.showPausedState(),(zn(l)||l!==!0)&&(l=!1),l&&this.renderedCamera&&this.renderedCamera.pause()},a.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 l=this,i=function(){l.stateManagerProxy.directTransition(bt.SCANNING),l.hidePausedState()};if(!this.renderedCamera.isPaused()){i();return}this.renderedCamera.resume(function(){i()})},a.prototype.getState=function(){return this.stateManagerProxy.getState()},a.prototype.stop=function(){var l=this;if(!this.stateManagerProxy.isScanning())throw"Cannot stop, scanner is not running or paused.";var i=this.stateManagerProxy.startTransition(bt.NOT_STARTED);this.shouldScan=!1,this.foreverScanTimeout&&clearTimeout(this.foreverScanTimeout);var o=function(){if(l.element){var f=document.getElementById(ln.SHADED_REGION_ELEMENT_ID);f&&l.element.removeChild(f)}},u=this;return this.renderedCamera.close().then(function(){return u.renderedCamera=null,u.element&&(u.element.removeChild(u.canvasElement),u.canvasElement=null),o(),u.qrRegion&&(u.qrRegion=null),u.context&&(u.context=null),i.execute(),u.hidePausedState(),u.isScanning=!1,Promise.resolve()})},a.prototype.scanFile=function(l,i){return this.scanFileV2(l,i).then(function(o){return o.decodedText})},a.prototype.scanFileV2=function(l,i){var o=this;if(!l||!(l instanceof File))throw"imageFile argument is mandatory and should be instance of File. Use 'event.target.files[0]'.";if(zn(i)&&(i=!0),!this.stateManagerProxy.canScanFile())throw"Cannot start file scan - ongoing camera scan";return new Promise(function(u,f){o.possiblyCloseLastScanImageFile(),o.clearElement(),o.lastScanImageFile=URL.createObjectURL(l);var m=new Image;m.onload=function(){var p=m.width,_=m.height,x=document.getElementById(o.elementId),C=x.clientWidth?x.clientWidth:ln.DEFAULT_WIDTH,y=Math.max(x.clientHeight?x.clientHeight:_,ln.FILE_SCAN_MIN_HEIGHT),I=o.computeCanvasDrawConfig(p,_,C,y);if(i){var B=o.createCanvasElement(C,y,"qr-canvas-visible");B.style.display="inline-block",x.appendChild(B);var T=B.getContext("2d");if(!T)throw"Unable to get 2d context from canvas";T.canvas.width=C,T.canvas.height=y,T.drawImage(m,0,0,p,_,I.x,I.y,I.width,I.height)}var D=ln.FILE_SCAN_HIDDEN_CANVAS_PADDING,k=Math.max(m.width,I.width),P=Math.max(m.height,I.height),M=k+2*D,v=P+2*D,j=o.createCanvasElement(M,v);x.appendChild(j);var H=j.getContext("2d");if(!H)throw"Unable to get 2d context from canvas";H.canvas.width=M,H.canvas.height=v,H.drawImage(m,0,0,p,_,D,D,k,P);try{o.qrcode.decodeRobustlyAsync(j).then(function(Z){u(ya.createFromQrcodeResult(Z))}).catch(f)}catch(Z){f("QR code parse error, error = ".concat(Z))}},m.onerror=f,m.onabort=f,m.onstalled=f,m.onsuspend=f,m.src=URL.createObjectURL(l)})},a.prototype.clear=function(){this.clearElement()},a.getCameras=function(){return wm.retrieve()},a.prototype.getRunningTrackCapabilities=function(){return this.getRenderedCameraOrFail().getRunningTrackCapabilities()},a.prototype.getRunningTrackSettings=function(){return this.getRenderedCameraOrFail().getRunningTrackSettings()},a.prototype.getRunningTrackCameraCapabilities=function(){return this.getRenderedCameraOrFail().getCapabilities()},a.prototype.applyVideoConstraints=function(l){if(l){if(!ba.isMediaStreamConstraintsValid(l,this.logger))throw"invalid videoConstaints passed, check logs for more details"}else throw"videoConstaints is required argument.";return this.getRenderedCameraOrFail().applyVideoConstraints(l)},a.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},a.prototype.getSupportedFormats=function(l){var i=[we.QR_CODE,we.AZTEC,we.CODABAR,we.CODE_39,we.CODE_93,we.CODE_128,we.DATA_MATRIX,we.MAXICODE,we.ITF,we.EAN_13,we.EAN_8,we.PDF_417,we.RSS_14,we.RSS_EXPANDED,we.UPC_A,we.UPC_E,we.UPC_EAN_EXTENSION];if(!l||typeof l=="boolean"||!l.formatsToSupport)return i;if(!Array.isArray(l.formatsToSupport))throw"configOrVerbosityFlag.formatsToSupport should be undefined or an array.";if(l.formatsToSupport.length===0)throw"Atleast 1 formatsToSupport is needed.";for(var o=[],u=0,f=l.formatsToSupport;u<f.length;u++){var m=f[u];nm(m)?o.push(m):this.logger.warn("Invalid format: ".concat(m," passed in config, ignoring."))}if(o.length===0)throw"None of formatsToSupport match supported values.";return o},a.prototype.getUseBarCodeDetectorIfSupported=function(l){if(zn(l))return!0;if(!zn(l.useBarCodeDetectorIfSupported))return l.useBarCodeDetectorIfSupported!==!1;if(zn(l.experimentalFeatures))return!0;var i=l.experimentalFeatures;return zn(i.useBarCodeDetectorIfSupported)?!0:i.useBarCodeDetectorIfSupported!==!1},a.prototype.validateQrboxSize=function(l,i,o){var u=this,f=o.qrbox;this.validateQrboxConfig(f);var m=this.toQrdimensions(l,i,f),p=function(x){if(x<ln.MIN_QR_BOX_SIZE)throw"minimum size of 'config.qrbox' dimension value is"+" ".concat(ln.MIN_QR_BOX_SIZE,"px.")},_=function(x){return x>l&&(u.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."),x=l),x};p(m.width),p(m.height),m.width=_(m.width)},a.prototype.validateQrboxConfig=function(l){if(typeof l!="number"&&typeof l!="function"&&(l.width===void 0||l.height===void 0))throw"Invalid instance of QrDimensions passed for 'config.qrbox'. Both 'width' and 'height' should be set."},a.prototype.toQrdimensions=function(l,i,o){if(typeof o=="number")return{width:o,height:o};if(typeof o=="function")try{return o(l,i)}catch(u){throw new Error("qrbox config was passed as a function but it failed with unknown error"+u)}return o},a.prototype.setupUi=function(l,i,o){o.isShadedBoxEnabled()&&this.validateQrboxSize(l,i,o);var u=zn(o.qrbox)?{width:l,height:i}:o.qrbox;this.validateQrboxConfig(u);var f=this.toQrdimensions(l,i,u);f.height>i&&this.logger.warn("[Html5Qrcode] config.qrbox has height that isgreater than the height of the video stream. Shading will be ignored");var m=o.isShadedBoxEnabled()&&f.height<=i,p={x:0,y:0,width:l,height:i},_=m?this.getShadedRegionBounds(l,i,f):p,x=this.createCanvasElement(_.width,_.height),C={willReadFrequently:!0},y=x.getContext("2d",C);y.canvas.width=_.width,y.canvas.height=_.height,this.element.append(x),m&&this.possiblyInsertShadingElement(this.element,l,i,f),this.createScannerPausedUiElement(this.element),this.qrRegion=_,this.context=y,this.canvasElement=x},a.prototype.createScannerPausedUiElement=function(l){var i=document.createElement("div");i.innerText=br.scannerPaused(),i.style.display="none",i.style.position="absolute",i.style.top="0px",i.style.zIndex="1",i.style.background="rgba(9, 9, 9, 0.46)",i.style.color="#FFECEC",i.style.textAlign="center",i.style.width="100%",l.appendChild(i),this.scannerPausedUiElement=i},a.prototype.scanContext=function(l,i){var o=this;return this.stateManagerProxy.isPaused()?Promise.resolve(!1):this.qrcode.decodeAsync(this.canvasElement).then(function(u){return l(u.text,ya.createFromQrcodeResult(u)),o.possiblyUpdateShaders(!0),!0}).catch(function(u){o.possiblyUpdateShaders(!1);var f=br.codeParseError(u);return i(f,im.createFrom(f)),!1})},a.prototype.foreverScan=function(l,i,o){var u=this;if(this.shouldScan&&this.renderedCamera){var f=this.renderedCamera.getSurface(),m=f.videoWidth/f.clientWidth,p=f.videoHeight/f.clientHeight;if(!this.qrRegion)throw"qrRegion undefined when localMediaStream is ready.";var _=this.qrRegion.width*m,x=this.qrRegion.height*p,C=this.qrRegion.x*m,y=this.qrRegion.y*p;this.context.drawImage(f,C,y,_,x,0,0,this.qrRegion.width,this.qrRegion.height);var I=function(){u.foreverScanTimeout=setTimeout(function(){u.foreverScan(l,i,o)},u.getTimeoutFps(l.fps))};this.scanContext(i,o).then(function(B){!B&&l.disableFlip!==!0?(u.context.translate(u.context.canvas.width,0),u.context.scale(-1,1),u.scanContext(i,o).finally(function(){I()})):I()}).catch(function(B){u.logger.logError("Error happend while scanning context",B),I()})}},a.prototype.createVideoConstraints=function(l){if(typeof l=="string")return{deviceId:{exact:l}};if(typeof l=="object"){var i="facingMode",o="deviceId",u={user:!0,environment:!0},f="exact",m=function(T){if(T in u)return!0;throw"config has invalid 'facingMode' value = "+"'".concat(T,"'")},p=Object.keys(l);if(p.length!==1)throw"'cameraIdOrConfig' object should have exactly 1 key,"+" if passed as an object, found ".concat(p.length," keys");var _=Object.keys(l)[0];if(_!==i&&_!==o)throw"Only '".concat(i,"' and '").concat(o,"' ")+" are supported for 'cameraIdOrConfig'";if(_===i){var x=l.facingMode;if(typeof x=="string"){if(m(x))return{facingMode:x}}else if(typeof x=="object")if(f in x){if(m(x["".concat(f)]))return{facingMode:{exact:x["".concat(f)]}}}else throw"'facingMode' should be string or object with"+" ".concat(f," as key.");else{var C=typeof x;throw"Invalid type of 'facingMode' = ".concat(C)}}else{var y=l.deviceId;if(typeof y=="string")return{deviceId:y};if(typeof y=="object"){if(f in y)return{deviceId:{exact:y["".concat(f)]}};throw"'deviceId' should be string or object with"+" ".concat(f," as key.")}else{var I=typeof y;throw"Invalid type of 'deviceId' = ".concat(I)}}}var B=typeof l;throw"Invalid type of 'cameraIdOrConfig' = ".concat(B)},a.prototype.computeCanvasDrawConfig=function(l,i,o,u){if(l<=o&&i<=u){var f=(o-l)/2,m=(u-i)/2;return{x:f,y:m,width:l,height:i}}else{var p=l,_=i;return l>o&&(i=o/l*i,l=o),i>u&&(l=u/i*l,i=u),this.logger.log("Image downsampled from "+"".concat(p,"X").concat(_)+" to ".concat(l,"X").concat(i,".")),this.computeCanvasDrawConfig(l,i,o,u)}},a.prototype.clearElement=function(){if(this.stateManagerProxy.isScanning())throw"Cannot clear while scan is ongoing, close it first.";var l=document.getElementById(this.elementId);l&&(l.innerHTML="")},a.prototype.possiblyUpdateShaders=function(l){this.qrMatch!==l&&(this.hasBorderShaders&&this.borderShaders&&this.borderShaders.length&&this.borderShaders.forEach(function(i){i.style.backgroundColor=l?ln.BORDER_SHADER_MATCH_COLOR:ln.BORDER_SHADER_DEFAULT_COLOR}),this.qrMatch=l)},a.prototype.possiblyCloseLastScanImageFile=function(){this.lastScanImageFile&&(URL.revokeObjectURL(this.lastScanImageFile),this.lastScanImageFile=null)},a.prototype.createCanvasElement=function(l,i,o){var u=l,f=i,m=document.createElement("canvas");return m.style.width="".concat(u,"px"),m.style.height="".concat(f,"px"),m.style.display="none",m.id=zn(o)?"qr-canvas":o,m},a.prototype.getShadedRegionBounds=function(l,i,o){if(o.width>l||o.height>i)throw"'config.qrbox' dimensions should not be greater than the dimensions of the root HTML element.";return{x:(l-o.width)/2,y:(i-o.height)/2,width:o.width,height:o.height}},a.prototype.possiblyInsertShadingElement=function(l,i,o,u){if(!(i-u.width<1||o-u.height<1)){var f=document.createElement("div");f.style.position="absolute";var m=(i-u.width)/2,p=(o-u.height)/2;if(f.style.borderLeft="".concat(m,"px solid rgba(0, 0, 0, 0.48)"),f.style.borderRight="".concat(m,"px solid rgba(0, 0, 0, 0.48)"),f.style.borderTop="".concat(p,"px solid rgba(0, 0, 0, 0.48)"),f.style.borderBottom="".concat(p,"px solid rgba(0, 0, 0, 0.48)"),f.style.boxSizing="border-box",f.style.top="0px",f.style.bottom="0px",f.style.left="0px",f.style.right="0px",f.id="".concat(ln.SHADED_REGION_ELEMENT_ID),i-u.width<11||o-u.height<11)this.hasBorderShaders=!1;else{var _=5,x=40;this.insertShaderBorders(f,x,_,-_,null,0,!0),this.insertShaderBorders(f,x,_,-_,null,0,!1),this.insertShaderBorders(f,x,_,null,-_,0,!0),this.insertShaderBorders(f,x,_,null,-_,0,!1),this.insertShaderBorders(f,_,x+_,-_,null,-_,!0),this.insertShaderBorders(f,_,x+_,null,-_,-_,!0),this.insertShaderBorders(f,_,x+_,-_,null,-_,!1),this.insertShaderBorders(f,_,x+_,null,-_,-_,!1),this.hasBorderShaders=!0}l.append(f)}},a.prototype.insertShaderBorders=function(l,i,o,u,f,m,p){var _=document.createElement("div");_.style.position="absolute",_.style.backgroundColor=ln.BORDER_SHADER_DEFAULT_COLOR,_.style.width="".concat(i,"px"),_.style.height="".concat(o,"px"),u!==null&&(_.style.top="".concat(u,"px")),f!==null&&(_.style.bottom="".concat(f,"px")),p?_.style.left="".concat(m,"px"):_.style.right="".concat(m,"px"),this.borderShaders||(this.borderShaders=[]),this.borderShaders.push(_),l.appendChild(_)},a.prototype.showPausedState=function(){if(!this.scannerPausedUiElement)throw"[internal error] scanner paused UI element not found";this.scannerPausedUiElement.style.display="block"},a.prototype.hidePausedState=function(){if(!this.scannerPausedUiElement)throw"[internal error] scanner paused UI element not found";this.scannerPausedUiElement.style.display="none"},a.prototype.getTimeoutFps=function(l){return 1e3/l},a}(),Oa;(function(a){a[a.STATUS_DEFAULT=0]="STATUS_DEFAULT",a[a.STATUS_SUCCESS=1]="STATUS_SUCCESS",a[a.STATUS_WARNING=2]="STATUS_WARNING",a[a.STATUS_REQUESTING_PERMISSION=3]="STATUS_REQUESTING_PERMISSION"})(Oa||(Oa={}));const Sm={width:"38",height:"38",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"none"},Im=["stroke"],Nm=["stroke"],Tm=["stroke"],km=["stroke"],Rm=["stroke"],Bm=r.defineComponent({__name:"QR",props:{color:{type:String,required:!1,default:"#FFFFFF"}},setup(a){return(l,i)=>(r.openBlock(),r.createElementBlock("svg",Sm,[r.createElementVNode("path",{d:"M11 11H7V7h4ZM17 7h-2v2h2ZM13 17h4v-4h-4ZM7 17h2v-2H7Z",stroke:a.color,"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"1.5"},null,8,Im),r.createElementVNode("path",{d:"M8 3H4a1 1 0 0 0-1 1V8",stroke:a.color,"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"1.5"},null,8,Nm),r.createElementVNode("path",{d:"M21 8V4a1 1 0 0 0-1-1H16",stroke:a.color,"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"1.5"},null,8,Tm),r.createElementVNode("path",{d:"M3 16v4a1 1 0 0 0 1 1H8",stroke:a.color,"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"1.5"},null,8,km),r.createElementVNode("path",{d:"M16 21h4a1 1 0 0 0 1-1V16",stroke:a.color,"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"1.5"},null,8,Rm)]))}}),No={back:["Задняя","Задней","Зад","e pasme","rear","back","atzekoa","задні","отзад","pozadi","cefn","hátulsó","traseira","achterkant","όπισθεν","bag","דערציען","cúil","aftan","trasero","posteriore","posterior","aizmugure","galinis","задниот дел","wara","hinteren","bak","tył","tyl","traseira","spate","задњи","zadný","zadaj","задній","takaosa","arrière","straga","zadní","bak","tagumine","environment","arxa","թիկունք","পিছনে","နောက်ဘက်","ở phía sau","უკანა","પાછળ","артқы","ಹಿಂದಿನ","後部","后部","뒤쪽","ខាងក្រោយ","ຫລັງ","പുറകിലുള്ള","मागील","арын","पछाडि","පසුපස","пушти","หลัง","பின்புறம்","వెనుక","arka","orqa","پیچھے","पिछला","qab","後方","مؤخرة","חלק אחורי","عقب","agter","ngemuva","azụ","leyin","kamorao","gadaale","nyuma","baya","kumbuyo","belakang","aoriana","belakang","muri","luyo","likuran","mburi","dèyè","tergo","malantaŭo"],front:["FaceTime","Передняя","përpara","front","aurrean","пярэдні","отпред","front","blaen","elülső","diante","voorkant","εμπρός","foran","פראָנט","tosaigh","framan","frente","davanti","davant","priekšā","priekyje","напред","quddiem","Vorderseite","front","przód","frente","față","фронт","vpredu","spredaj","перед","edessä","devant","ispred","přední","främre","ees","ön","ճակատ","সামনে","ရှေ့","đằng trước","წინა","આગળ","алдыңғы","ಮುಂಭಾಗ","正面","正面","앞쪽","ខាងមុខ","ດ້ານໜ້າ","മുന്നിൽ","समोर","урд","अगाडि","ඉදිරිපස","пеш","ด้านหน้า","முன்","ముందు","ön","old","سامنے","सामने","pem hauv ntej","フロント","أمام","חֲזִית","جلو","voor","ngaphambili","n'ihu","iwaju","ka pele","hore","mbele","gaba","kutsogolo","depan","anoloana","hadapan","mua","atubangan","harap","ngarep","devan","front","fronto"]},Om={key:0,class:"qr_text"},Mm=r.defineComponent({__name:"QrCameraScanner",props:{axiosInstanceGet:{type:[Function,Object]},is_toggleAffiliation:{type:Boolean},is_notification:{type:Boolean},notificationData:{},isQr:{type:[Boolean,null]},takeDataTable:{type:Function}},emits:["update:notificationData","update:is_notification","update:is_toggleAffiliation"],setup(a,{emit:l}){const i=a;let o=null;const u=r.ref(!1),f=r.ref(!1),m=r.ref(!1),p=r.ref(!1);let _=null;const x=Ct(),{itemThemes:C}=_e.storeToRefs(x),y=l,I=P=>P.replace(/^[\s\S]*?((?:tel|sms|smsto|mailto|callto|facetime|viber|whatsapp):)?[\s\S]*?(%2B)?[\s\S]*?/i,(M,v,j)=>j?"+":""),B=async(P,M)=>{var Z,V,L;if(console.log(P,M),p.value)return;i.isQr||(p.value=!0),k();const v=/[?&]table_id=([a-zA-Z0-9-]+)/,j=P.match(v),H=P.match(/\/([a-f0-9\-]{36})\?/);if(i.isQr){if(j&&H)return(Z=i.takeDataTable)==null?void 0:Z.call(i,H[1],j[1],"qr");{const F=localStorage.getItem("orgID");if(F){const re=await i.axiosInstanceGet.get(`org_unit/${F}/table`,{params:{external_link:P}}).then(K=>{var ee,G;return((ee=K.data)==null?void 0:ee.length)>0?(G=K.data[0])==null?void 0:G.id:null}).catch(()=>null);if(re)return(V=i.takeDataTable)==null?void 0:V.call(i,F,re)}}y("update:is_notification",!0),y("update:notificationData",{textNotification:"Стол не найден"}),y("update:is_toggleAffiliation",!0)}else{const F=new yn,re=P||M.text,K=I(re);try{await F.authorizeByCard(K);const ee=await F.getProfile();y("update:is_notification",!0),y("update:notificationData",{textNotification:`Здравствуйте, ${ee.first_name}
31
+ Баланс: ${ee.balance}`})}catch(ee){y("update:is_notification",!0),y("update:notificationData",{textNotification:((L=ee.response)==null?void 0:L.user_friendly_message)||"Карта не найдена"})}finally{m.value=!0,_&&clearTimeout(_),_=setTimeout(()=>{m.value=!1},2e3),p.value=!1}}};window.debugScan=B;const T=()=>{},D=async()=>{if(!(u.value||o!=null&&o.isScanning||m.value))try{u.value=!0;try{(await navigator.mediaDevices.getUserMedia({video:!0})).getTracks().forEach(Z=>Z.stop())}catch{y("update:is_notification",!0),y("update:notificationData",{textNotification:"Разрешите доступ к камере"}),u.value=!1,y("update:is_toggleAffiliation",!0);return}o=new Ba("reader");const P=await Ba.getCameras();if(!P||P.length===0){console.error("Камеры не найдены"),u.value=!1;return}let M;if(i.isQr)M=P.find(H=>No.back.some(Z=>new RegExp(Z,"i").test(H.label))),M||(M=P.find(H=>No.front.some(Z=>new RegExp(Z,"i").test(H.label))));else if(M=P.find(H=>No.front.some(Z=>new RegExp(Z,"i").test(H.label))),M||(M=P.find(H=>new RegExp("amera","i").test(H.label))),!M){y("update:is_notification",!0),y("update:notificationData",{textNotification:"Не найдена фронтальная камера. Для сканирования карт нужна фронтальная камера."}),u.value=!1,y("update:is_toggleAffiliation",!0);return}const v=i.isQr?[we.QR_CODE]:[we.QR_CODE,we.PDF_417,we.EAN_13,we.EAN_8,we.CODE_128],j={fps:60,qrbox:{width:320,height:500}};await o.start(M.id,j,B,T,void 0,v),f.value=!0}catch(P){y("update:is_notification",!0),y("update:notificationData",{textNotification:"Разрешите доступ к камере для сканирования"}),console.error("Ошибка доступа к камере:",P),u.value=!1,f.value=!1,y("update:is_toggleAffiliation",!0)}},k=async()=>{if(o&&o.isScanning)try{await o.stop(),u.value=!1,o=null}catch(P){console.error("Ошибка остановки камеры:",P)}else u.value=!1,o=null,y("update:is_toggleAffiliation",!0);f.value=!1};return r.onUnmounted(()=>{u.value&&k(),_&&(clearTimeout(_),_=null),p.value=!1,m.value=!1,f.value=!1}),(P,M)=>(r.openBlock(),r.createElementBlock("div",null,[(r.openBlock(),r.createBlock(r.Teleport,{to:"body"},[r.withDirectives(r.createElementVNode("div",{class:"blackWindow",onClick:k},[M[0]||(M[0]=r.createElementVNode("div",{id:"reader"},null,-1)),f.value&&!a.isQr?(r.openBlock(),r.createElementBlock("p",Om,"Наведите QR на камеру")):r.createCommentVNode("",!0)],512),[[r.vShow,u.value]])])),r.createVNode(Bm,{color:a.isQr?void 0:"#FFFFFF",onClick:D},null,8,["color"])]))}}),Ii=Symbol("clickOutside"),Dm={mounted(a,l){a[Ii]=i=>{a.contains(i.target)||l.value(i)},document.addEventListener("click",a[Ii])},unmounted(a){a[Ii]&&document.removeEventListener("click",a[Ii])}};let ar=[],To;const Ma=["#FFD700","#FF6B8A","#7ECFC0","#C4B5FD","#FFA726","#EF5350","#AB47BC","#66BB6A","#42A5F5","#FFCA28"];class Da{constructor(l){Be(this,"x");Be(this,"y");Be(this,"vx");Be(this,"vy");Be(this,"color");Be(this,"size");Be(this,"rotation");Be(this,"rotationSpeed");Be(this,"gravity");Be(this,"friction");Be(this,"opacity");Be(this,"fadeSpeed");Be(this,"shape");Be(this,"width");Be(this,"height");Be(this,"ctx");this.x=window.innerWidth/2,this.y=window.innerHeight/2;const i=Math.random()*Math.PI*2,o=4+Math.random()*8;this.vx=Math.cos(i)*o,this.vy=Math.sin(i)*o-4,this.color=Ma[Math.floor(Math.random()*Ma.length)],this.size=4+Math.random()*6,this.rotation=Math.random()*360,this.rotationSpeed=(Math.random()-.5)*12,this.gravity=.12+Math.random()*.05,this.friction=.98,this.opacity=1,this.fadeSpeed=.005+Math.random()*.008,this.shape=Math.random()>.5?"rect":"circle",this.width=this.shape==="rect"?this.size*(.4+Math.random()*.6):this.size,this.height=this.shape==="rect"?this.size*(.8+Math.random()*.4):this.size,this.ctx=l}update(){this.vy+=this.gravity,this.vx*=this.friction,this.vy*=this.friction,this.x+=this.vx,this.y+=this.vy,this.rotation+=this.rotationSpeed,this.opacity-=this.fadeSpeed}draw(){this.ctx&&(this.ctx.save(),this.ctx.translate(this.x,this.y),this.ctx.rotate(this.rotation*Math.PI/180),this.ctx.globalAlpha=Math.max(0,this.opacity),this.ctx.fillStyle=this.color,this.shape==="rect"?this.ctx.fillRect(-this.width/2,-this.height/2,this.width,this.height):(this.ctx.beginPath(),this.ctx.arc(0,0,this.size/2,0,Math.PI*2),this.ctx.fill()),this.ctx.restore())}}const vm={mounted(a){const l=a.getContext("2d"),i=()=>{l.clearRect(0,0,window.innerWidth,window.innerHeight);for(let o of ar)o.update(),o.draw();ar=ar.filter(o=>o.opacity>0),ar.length>0&&(To=requestAnimationFrame(i))};a._resize=()=>{const o=window.devicePixelRatio||1;a.width=window.innerWidth*o,a.height=window.innerHeight*o,l.scale(o,o)},a._resize(),window.addEventListener("resize",a._resize),setTimeout(()=>{for(let o=0;o<90;o++)ar.push(new Da(l));i()},400),setTimeout(()=>{for(let o=0;o<40;o++)ar.push(new Da(l))},900)},unmounted(a){window.removeEventListener("resize",a._resize),To&&cancelAnimationFrame(To),ar=[]}},Pm={mounted(a){const l=a.getContext("2d");a._resize=()=>{a.width=window.innerWidth,a.height=window.innerHeight},a._resize(),window.addEventListener("resize",a._resize);const i=4,o=null,u="#E52222",f="#fed1b0",m="#1a1aff",p="#222",_="#E8B84B",x=[[o,o,o,u,u,u,u,u,o,o,o,o,o,o,o,o],[o,o,u,u,u,u,u,u,u,u,u,o,o,o,o,o],[o,o,p,p,p,f,f,p,f,o,o,o,o,o,o,o],[o,p,f,p,f,f,f,p,f,f,f,o,o,o,o,o],[o,p,f,p,p,f,f,f,p,f,f,f,o,o,o,o],[o,p,p,f,f,f,f,p,p,p,p,o,o,o,o,o],[o,o,o,f,f,f,f,f,f,f,o,o,o,o,o,o],[o,o,m,m,u,m,m,m,o,o,o,o,o,o,o,o],[o,m,m,m,u,m,m,m,m,m,o,o,o,o,o,o],[m,m,m,m,u,u,m,m,m,m,m,o,o,o,o,o],[f,f,m,u,_,u,u,_,m,f,f,o,o,o,o,o],[f,f,f,u,u,u,u,u,f,f,f,o,o,o,o,o],[f,f,u,u,u,u,u,u,u,f,f,o,o,o,o,o],[o,o,u,u,u,o,o,u,u,u,o,o,o,o,o,o],[o,p,p,p,o,o,o,p,p,p,o,o,o,o,o,o],[p,p,p,p,o,o,p,p,p,p,o,o,o,o,o,o]],C=[[o,o,o,u,u,u,u,u,o,o,o,o,o,o,o,o],[o,o,u,u,u,u,u,u,u,u,u,o,o,o,o,o],[o,o,p,p,p,f,f,p,f,o,o,o,o,o,o,o],[o,p,f,p,f,f,f,p,f,f,f,o,o,o,o,o],[o,p,f,p,p,f,f,f,p,f,f,f,o,o,o,o],[o,p,p,f,f,f,f,p,p,p,p,o,o,o,o,o],[o,o,o,f,f,f,f,f,f,f,o,o,o,o,o,o],[o,o,m,m,u,m,m,m,o,o,o,o,o,o,o,o],[o,m,m,m,u,m,m,m,m,m,o,o,o,o,o,o],[m,m,m,m,u,u,m,m,m,m,m,o,o,o,o,o],[f,f,m,u,_,u,u,_,m,f,f,o,o,o,o,o],[f,f,f,u,u,u,u,u,f,f,f,o,o,o,o,o],[f,f,u,u,u,u,u,u,u,f,f,o,o,o,o,o],[o,u,u,u,o,o,o,o,u,u,u,o,o,o,o,o],[p,p,p,o,o,o,o,o,p,p,p,o,o,o,o,o],[p,p,o,o,o,o,o,o,o,p,p,o,o,o,o,o]],y=[[o,o,o,u,u,u,u,u,o,o,o,o,o,o,o,o],[o,o,u,u,u,u,u,u,u,u,u,o,o,o,o,o],[o,o,p,p,p,f,f,p,f,o,o,o,o,o,o,o],[o,p,f,p,f,f,f,p,f,f,f,o,o,o,o,o],[o,p,f,p,p,f,f,f,p,f,f,f,o,o,o,o],[o,p,p,f,f,f,f,p,p,p,p,o,o,o,o,o],[o,o,o,f,f,f,f,f,f,f,o,o,o,o,o,o],[o,o,m,m,u,m,m,m,o,o,o,o,o,o,o,o],[o,m,m,m,u,m,m,m,m,m,o,o,o,o,o,o],[m,m,m,m,u,u,m,m,m,m,m,o,o,o,o,o],[f,f,m,u,_,u,u,_,m,f,f,o,o,o,o,o],[f,f,f,u,u,u,u,u,f,f,f,o,o,o,o,o],[f,f,u,u,u,u,u,u,u,f,f,o,o,o,o,o],[o,o,o,o,u,u,u,u,o,o,o,o,o,o,o,o],[o,o,o,o,p,p,p,p,p,o,o,o,o,o,o,o],[o,o,o,o,o,p,p,p,p,p,o,o,o,o,o,o]],I=[[o,o,o,o,u,u,u,u,u,o,o,o,o,o,o,o],[o,o,o,u,u,u,u,u,u,u,u,u,o,o,o,o],[o,o,o,p,p,p,f,f,p,f,o,o,o,o,o,o],[o,o,p,f,p,f,f,f,p,f,f,f,o,o,o,o],[o,o,p,f,p,p,f,f,f,p,f,f,o,o,o,o],[o,o,p,p,f,f,f,f,p,p,p,p,o,o,o,o],[o,o,o,o,f,f,f,f,f,f,f,o,o,o,o,o],[o,m,o,o,m,m,u,m,m,m,o,o,m,o,o,o],[m,m,m,m,m,u,m,m,m,m,m,m,m,o,o,o],[m,m,m,m,u,u,m,m,m,m,m,o,o,o,o,o],[f,f,m,u,_,u,u,_,m,f,f,o,o,o,o,o],[f,f,f,u,u,u,u,u,f,f,f,o,o,o,o,o],[f,f,u,u,u,u,u,u,u,f,f,o,o,o,o,o],[o,o,u,u,u,o,o,u,u,u,o,o,o,o,o,o],[o,p,p,p,o,o,o,p,p,p,o,o,o,o,o,o],[p,p,p,p,o,o,p,p,p,p,o,o,o,o,o,o]],B=[[o,_,_,_,_,_,o,o],[_,_,p,_,_,_,_,o],[_,p,_,_,_,_,_,o],[_,p,_,_,_,_,_,o],[_,p,_,_,_,_,_,o],[_,_,p,_,_,_,_,o],[o,_,_,_,_,_,o,o],[o,o,o,o,o,o,o,o]];function T(W,N,X,$,q,J){const le=N.length,se=N[0].length;for(let oe=0;oe<le;oe++)for(let ge=0;ge<se;ge++){const Ee=N[oe][ge];if(!Ee)continue;const Fe=J?X+(se-1-ge)*q:X+ge*q,ue=$+oe*q;W.fillStyle=Ee,W.fillRect(Fe,ue,q,q)}}let D,k,P,M,v,j,H,Z,V,L,F,re=!1;function K(){Z=a.height*.46,k=-20*i,P=Z,M=3.2,v=0,D="enter",j=0,H=0,F=!1,V=Z-32*i,L=0,re=!0}function ee(){return a.width/2-6*i}function G(){if(!re)return;const W=a.width,N=a.height;l.clearRect(0,0,W,N),F&&(V+=L,L+=.4,T(l,B,a.width/2-3*i,V,i,!1),V>N+16*i&&(F=!1)),(D==="enter"||D==="exit")&&(H++,H>=6&&(H=0,j=(j+1)%3));const X=[x,C,y];if(D==="enter")k+=M,T(l,X[j],k,P,i,!1),k+5*i>=ee()&&(D="bump_up",M=0,v=-7);else if(D==="bump_up")v+=.7,P+=v,T(l,I,k,P,i,!1),v>=0&&(D="bump_down",F=!0,L=-10,V=P-10*i);else if(D==="bump_down")v+=.7,P+=v,T(l,I,k,P,i,!1),P>=Z&&(P=Z,v=0,M=-3.2,D="exit");else if(D==="exit"&&(k+=M,T(l,X[j],k,P,i,!0),k<-20*i)){re=!1,setTimeout(()=>{K(),G()},2500);return}requestAnimationFrame(G)}setTimeout(()=>{K(),G()},1200)},unmounted(a){window.removeEventListener("resize",a._resize)}};class Lm{constructor(l){Be(this,"value");Be(this,"next");this.value=l}}class Fm{constructor(){Ui(this,Qt);Ui(this,Xn);Ui(this,cr);this.clear()}enqueue(l){const i=new Lm(l);_n(this,Qt)?(_n(this,Xn).next=i,Ln(this,Xn,i)):(Ln(this,Qt,i),Ln(this,Xn,i)),Zo(this,cr)._++}dequeue(){const l=_n(this,Qt);if(l)return Ln(this,Qt,_n(this,Qt).next),Zo(this,cr)._--,_n(this,Qt)||Ln(this,Xn,void 0),l.value}peek(){if(_n(this,Qt))return _n(this,Qt).value}clear(){Ln(this,Qt,void 0),Ln(this,Xn,void 0),Ln(this,cr,0)}get size(){return _n(this,cr)}*[Symbol.iterator](){let l=_n(this,Qt);for(;l;)yield l.value,l=l.next}*drain(){for(;_n(this,Qt);)yield this.dequeue()}}Qt=new WeakMap,Xn=new WeakMap,cr=new WeakMap;function Vm(a){va(a);const l=new Fm;let i=0;const o=()=>{i<a&&l.size>0&&(i++,l.dequeue()())},u=()=>{i--,o()},f=async(_,x,C)=>{const y=(async()=>_(...C))();x(y);try{await y}catch{}u()},m=(_,x,C)=>{new Promise(y=>{l.enqueue(y)}).then(f.bind(void 0,_,x,C)),i<a&&o()},p=(_,...x)=>new Promise(C=>{m(_,C,x)});return Object.defineProperties(p,{activeCount:{get:()=>i},pendingCount:{get:()=>l.size},clearQueue:{value(){l.clear()}},concurrency:{get:()=>a,set(_){va(_),a=_,queueMicrotask(()=>{for(;i<a&&l.size>0;)o()})}},map:{async value(_,x){const C=Array.from(_,(y,I)=>this(x,y,I));return Promise.all(C)}}}),p}function va(a){if(!((Number.isInteger(a)||a===Number.POSITIVE_INFINITY)&&a>0))throw new TypeError("Expected `concurrency` to be a number from 1 and up")}let Kt=null;const Pa=Vm(5),Um=async(a,l)=>{Kt&&Wm();const i=ot(),o=Ct(),u=Wr(),f=Lt(),{itemThemes:m}=_e.storeToRefs(o),{displayCards:p}=_e.storeToRefs(i),{is_notification_lib:_,notificationData_lib:x}=_e.storeToRefs(u),{stateCard:C,openProduct:y}=_e.storeToRefs(f),I=yn.create();await zm(a),Kt=Fr(`wss://${l}/ws/org-unit/${a}/`,{heartbeatTimeout:3e4}),Kt.on("open",()=>console.warn("Realtime WebSocket подключён (pointId:",a,")")),Kt.on("error",B=>console.warn("WebSocket ошибка:",B)),Kt.on("close",()=>console.warn("Realtime WebSocket закрыт")),Kt.on("message",async B=>{try{if(B.type)return;m.value.kiosk_hide_menu_update_notification||(x.value.textNotification="Мы обновили меню");const T=B.params||B,D=T.active_groups||[],k=T.updated_groups||[],P=T.updated_product_groups||[],M=await tr(),v=new Set(D.map(K=>K)),j=new Map(p.value.map(K=>[K.id,K])),H=[],Z=M.transaction("groups","readwrite");let L=await Z.objectStore("groups").openCursor();for(;L;){const K=L.key;!v.has(K)&&K!==a&&(H.push(K),await L.delete(),j.delete(K)),L=await L.continue()}await Z.done,p.value=Array.from(j.values()),H.length>0&&await Hm(v);const F=[...k.map(K=>Pa(async()=>{const[ee,G]=await Promise.all([I.getGroupByID(K),I.loadGroupProducts(K)]);ee.products=G,j.set(K,ee),await vr(K,ee),await Fa(ee,G,!0)})),...P.map(K=>Pa(async()=>{const[ee,G]=await Promise.all([I.getGroupByID(K),I.loadGroupProducts(K)]);ee.products=G,j.set(K,ee),await vr(K,ee),await Fa(ee,G,!0),await Gm(G,K)}))];await Promise.all(F),p.value=Array.from(j.values()),await Tl(a,p),x.value.textNotification.length>1&&(_.value=!0);const re=C.value.openCard;if(re!=null&&re.id){const K=new Set(re.groups??[]),ee=new Set;let G=!1;for(const N of j.values()){const X=N==null?void 0:N.products;if(!Array.isArray(X))continue;const $=X.find(q=>(q==null?void 0:q.id)===re.id);if(($==null?void 0:$.adult)===!0){y.value={id:null,visible:!1},f.reset();return}$&&(N==null?void 0:N.id)!=null&&(ee.add(N.id),(k.includes(N.id)||P.includes(N.id))&&(G=!0))}if(ee.size===0){y.value={id:null,visible:!1},f.reset();return}(!(K.size===ee.size&&[...K].every(N=>ee.has(N)))||G)&&await I.getSingleProduct(re==null?void 0:re.id)}}catch(T){console.error("ошибка обновления indexedDB [updateIndexedDB]",T)}}),Kt.connect()},zm=async a=>{try{const l=ot(),i=await qi(a);i!=null&&i.data&&(l.displayCards=i.data)}catch(l){console.error("Ошибка загрузки кэша групп:",l)}},La=async a=>{const l=ot(),i=Wr(),o=Lt(),{stateCard:u,openProduct:f}=_e.storeToRefs(o),{cartProducts_lib:m}=_e.storeToRefs(l),p=m.value,_=[],x=[],C=u.value.openCard;for(const y of p)a(y)?(_.push(y),(y.id===(C==null?void 0:C.id)||C!=null&&C.adult)&&(f.value={id:null,visible:!1})):x.push(y);if(_.length>0){const y=_.map(I=>I.name).slice(0,3).join(", ");i.notificationData_lib.textNotification=`Некоторые позиции стали недоступны и были убраны из заказа: ${y}${_.length>3?` и ещё ${_.length-3}`:""}`,m.value=x,l.updateCartInLocalStorage()}},Hm=async a=>{await La(l=>{var i;return(i=l.groups)!=null&&i.length?!l.groups.some(o=>a.has(o)):!0})},Gm=async(a,l)=>{const i=ot(),o=new Set(a.filter(u=>!u.adult||i.is18Allowed).map(u=>u.id));await La(u=>{var f;return(f=u.groups)!=null&&f.includes(l)?!o.has(u.id):!1})},Fa=async(a,l,i=!0)=>{if(a.video_link&&Ni(a.video_link,`${a.id}_video`,i),a.image_link&&Ni(a.image_link,`${a.id}_image`,i),l!=null&&l.length)for(const o of l)o.video_link&&Ni(o.video_link,`${o.id}_video`,i),o.image_link&&Ni(o.image_link,`${o.id}_image`,i)},Ni=async(a,l,i=!1)=>{try{const o=oi();if(!i){const m=await hr(l);if(m){o.updateCacheFromBlob(l,m),window.dispatchEvent(new CustomEvent("image-cached",{detail:{id:l,blob:m}}));return}}const u=await fetch(a);if(!u.ok)throw new Error("Network error");const f=await u.blob();if(f.size===0)throw new Error("Empty blob");await Zi(l,f),o.updateCacheFromBlob(l,f),window.dispatchEvent(new CustomEvent("image-cached",{detail:{id:l,blob:f}}))}catch(o){console.warn(`[MediaCache] Failed for ${l}:`,o)}},Wm=()=>{Kt&&(Kt.off("open"),Kt.off("message"),Kt.off("error"),Kt.off("close"),Kt.close(!0),Kt=null)},Xm={key:0,class:"valentine-hearts"},$m=r.defineComponent({__name:"FallingHearts",props:{symbols:{default:()=>["❤","♥","💕"]},max:{default:15},interval:{default:1500}},setup(a){const l=a,i=xt.useDocumentVisibility(),o=xt.useMediaQuery("(prefers-reduced-motion: reduce)"),u=r.ref([]);let f=null;const m=(C,y)=>Math.random()*(y-C)+C,p=()=>{if(o.value||u.value.length>=l.max)return;const C=l.symbols[Math.floor(Math.random()*l.symbols.length)],y=m(18,26),I=m(5,95),B=m(10,18),T=m(0,.3),D=m(.6,.9),k=Math.floor(m(1,6)),M={id:crypto.randomUUID(),icon:C,style:{left:`${I}%`,fontSize:`${y}px`,color:`rgba(255, 105, 180, ${D})`,animationName:`heartFall${k}`,animationDuration:`${B}s`,animationDelay:`${T}s`}};u.value.push(M);const j=setTimeout(()=>{u.value=u.value.filter(H=>H.id!==M.id),clearTimeout(j)},(T+B+1)*1e3)},_=()=>{if(!o.value){for(let C=0;C<3;C++){const y=setTimeout(()=>{p(),clearTimeout(y)},C*200)}f=setInterval(p,l.interval)}},x=()=>{f&&(clearInterval(f),f=null),u.value=[]};return r.onMounted(()=>{o.value||_()}),r.onUnmounted(()=>{x()}),r.watch(i,(C,y)=>{C==="visible"&&y==="hidden"&&_(),C==="hidden"&&y==="visible"&&x()}),(C,y)=>r.unref(o)?r.createCommentVNode("",!0):(r.openBlock(),r.createElementBlock("div",Xm,[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(u.value,I=>(r.openBlock(),r.createElementBlock("span",{key:I.id,class:"heart",style:r.normalizeStyle(I.style)},r.toDisplayString(I.icon),5))),128))]))}}),jm=["src"],qm=r.defineComponent({__name:"BasketImage",props:{id:{},fallback:{}},setup(a){const l=a,{mediaUrl:i}=bn(()=>l.id,()=>l.fallback);return(o,u)=>(r.openBlock(),r.createElementBlock("img",{src:r.unref(i)||""},null,8,jm))}}),Zm={class:"button_price_bg"},Ym={class:"wrapper_container_price_bg"},Km={class:"button_price"},Qm={key:0,class:"image_product_container"},Jm=r.defineComponent({__name:"BasketButton",emits:["goToCart"],setup(a,{emit:l}){const i=l,o=ke.useRouter(),u=ot(),f=Vn(),{totalPrice_lib:m,cartProducts_lib:p,cartBasketBumpKey:_}=_e.storeToRefs(u),x=r.computed(()=>{var I;return m.value+(((I=f.order)==null?void 0:I.remaining_amount)||0)}),C=r.computed(()=>{var I;return(I=p.value)!=null&&I.length,p.value.slice(0,3).map(B=>({id:`${B.id}_image`,fallback:B.image_link}))}),y=()=>{var I;if(f.isTableService&&f.hasOrder&&!((I=p.value)!=null&&I.length))return o.push({name:"order-ts"});i("goToCart")};return(I,B)=>(r.openBlock(),r.createElementBlock("div",Zm,[r.createElementVNode("div",Ym,[r.createElementVNode("div",Km,[r.unref(m)>0&&C.value.length>0?(r.openBlock(),r.createElementBlock("div",Qm,[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(C.value,T=>(r.openBlock(),r.createElementBlock("div",{key:T.id,class:"filter_image_product"},[r.createVNode(qm,{id:T.id,fallback:T.fallback,class:"img_product"},null,8,["id","fallback"])]))),128))])):r.createCommentVNode("",!0),(r.openBlock(),r.createBlock(r.unref(Ot.motion).div,{key:r.unref(_),class:"button_default_main","data-retail-basket-target":"",initial:{scale:1},animate:r.unref(_)===0?{scale:1}:{scale:[1,1.1,1]},transition:{duration:.38,ease:"easeOut"},whilePress:{scale:.92},onClick:y},{default:r.withCtx(()=>[B[1]||(B[1]=r.createElementVNode("div",{class:"icont_cart"},null,-1)),r.createElementVNode("p",null,[r.createVNode(ft,{price:x.value,fixedFloat:2},null,8,["price"]),B[0]||(B[0]=r.createTextVNode(" ₽",-1))])]),_:1},8,["animate"]))])])]))}}),$r=null,{min:lr,max:An,abs:Va,floor:eg}=Math,Ua=(a,l,i)=>lr(i,An(l,a)),za=a=>[...a].sort((l,i)=>l-i),tg=typeof queueMicrotask=="function"?queueMicrotask:a=>{Promise.resolve().then(a)},ko=()=>{let a;return[new Promise(l=>{a=l}),a]},Ha=a=>{let l;return()=>(a&&(l=a(),a=void 0),l)},jr=(a,l,i)=>{const o=i?"unshift":"push";for(let u=0;u<l;u++)a[o](-1);return a},Ga=(a,l)=>{const i=a.t[l];return i===-1?a.o:i},ng=(a,l,i)=>{const o=a.t[l]===-1;return a.t[l]=i,a.i=lr(l,a.i),o},Ti=(a,l)=>{if(!a.l)return 0;if(a.i>=l)return a.u[l];a.i<0&&(a.u[0]=0,a.i=0);let i=a.i,o=a.u[i];for(;i<l;)o+=Ga(a,i),a.u[++i]=o;return a.i=l,o},Ar=(a,l,i=0,o=a.l-1)=>{let u=i;for(;i<=o;){const f=eg((i+o)/2);Ti(a,f)<=l?(u=f,i=f+1):o=f-1}return Ua(u,0,a.l-1)},Wa=(a,l,i)=>{const o=l-a.l;return a.i=i?-1:lr(l-1,a.i),a.l=l,o>0?(jr(a.u,o),jr(a.t,o,i),a.o*o):(a.u.splice(o),(i?a.t.splice(0,-o):a.t.splice(o)).reduce((u,f)=>u-(f===-1?a.o:f),0))},rg=a=>a.documentElement,ig=a=>a.ownerDocument,og=a=>a.defaultView,Xa=Ha(()=>!!/iP(hone|od|ad)/.test(navigator.userAgent)||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>0),sg=Ha(()=>"scrollBehavior"in rg(document).style),ag=(a,l=40,i=0,o,u=!1)=>{let f=!!i,m=1,p=0,_=0,x=0,C=0,y=0,I=0,B=0,T=0,D=$r,k=[0,f?An(i-1,0):-1],P=0,M=!1;const v=((G,W,N)=>({o:W,t:N?jr(N.slice(0,lr(G,N.length)),An(0,G-N.length)):jr([],G),l:G,i:-1,u:jr([],G+1)}))(a,o?o[1]:l,o&&o[0]),j=new Set,H=()=>x-_,Z=()=>H()+y+C,V=(G,W)=>((N,X,$,q)=>{if(q=lr(q,N.l-1),Ti(N,q)<=X){const J=Ar(N,$,q);return[Ar(N,X,q,J),J]}{const J=Ar(N,X,void 0,q);return[J,Ar(N,$,J)]}})(v,G,W,k[0]),L=()=>Ti(v,v.l),F=(G,W)=>{const N=Ti(v,G)-y;return W?L()-N-re(G):N},re=G=>Ga(v,G),K=(G,W=-1)=>v.t[G]===W,ee=G=>{G&&(Xa()&&B!==0||D&&T===1?y+=G:C+=G)};return{p:()=>{j.clear()},h:()=>m,m:()=>(G=>[G.t.slice(),G.o])(v),v:(G=200)=>{if(!M||f)return k;let W,N;if(I)[W,N]=k;else{let X=An(0,Z()),$=X+p;u||(G=An(0,G),B!==1&&(X-=G),B!==2&&($+=G)),[W,N]=k=V(An(0,X),An(0,$)),D&&(W=lr(W,D[0]),N=An(N,D[1]))}return[An(W,0),lr(N,v.l-1)]},S:G=>Ar(v,G-_),I:K,O:F,k:re,j:()=>v.l,N:()=>x,B:()=>B!==0,T:()=>p,q:()=>_,M:L,P:()=>(I=C,C=0,[I,T===2]),R:(G,W)=>{const N=[G,W];return j.add(N),()=>{j.delete(N)}},A:(G,W)=>{let N,X,$=0;switch(G){case 1:{if(W===x&&T===0)break;const q=I;I=0;const J=W-x,le=Va(J);q&&le<Va(q)+1||T!==0||(B=J<0?2:1),f&&(f=!1),x=W,$=4;const se=H();se>=-p&&se<=L()&&($+=1,X=le>p);break}case 2:$=8,B!==0&&(N=!0,$+=1),B=0,T=0,D=$r;break;case 3:{const q=W.filter(([J,le])=>!K(J,le));if(!q.length)break;ee(q.reduce((J,[le,se])=>((T===2||(D&&T===1?le<D[0]:F(le+(B===0&&T===0?1:0))<H()))&&(J+=se-re(le)),J),0));for(const[J,le]of q){const se=re(J),oe=ng(v,J,le);u&&(P+=oe?le:le-se)}u&&p&&P>p&&(ee(((J,le)=>{let se=0;const oe=[];J.t.forEach((Ae,Ke)=>{Ae!==-1&&(oe.push(Ae),Ke<le&&se++)}),J.i=-1;const ge=za(oe),Ee=ge.length,Fe=Ee/2|0,ue=Ee%2==0?(ge[Fe-1]+ge[Fe])/2:ge[Fe],nt=J.o;return((J.o=ue)-nt)*An(le-se,0)})(v,Ar(v,Z()))),u=!1),$=3,X=!0;break}case 4:p!==W&&(p||(M=X=!0),p=W,$=3);break;case 5:W[1]?(ee(Wa(v,W[0],!0)),T=2,$=1):(Wa(v,W[0]),$=1);break;case 6:_=W;break;case 7:T=1;break;case 8:D=V(W,W+p),$=1}$&&(m=1+(2147483647&m),N&&y&&(C+=y,y=0),j.forEach(([q,J])=>{$&q&&J(X)}))}}},Ro=setTimeout,Bo=(a,l)=>l?-a:a,lg=(a,l,i,o,u,f)=>{const m=Date.now;let p=0,_=!1,x=!1,C=!1,y=!1;const I=(()=>{let P;const M=()=>{P!=$r&&clearTimeout(P)},v=()=>{M(),P=Ro(()=>{P=$r,(()=>{if(_||x)return _=!1,void I();C=!1,a.A(2)})()},150)};return v.C=M,v})(),B=()=>{p=m(),C&&(y=!0),a.A(1,o()),I()},T=P=>{if(_||!a.B()||P.ctrlKey)return;const M=m()-p;150>M&&50<M&&(i?P.deltaX:P.deltaY)&&(_=!0)},D=()=>{x=!0,C=y=!1},k=()=>{x=!1,Xa()&&(C=!0)};return l.addEventListener("scroll",B),l.addEventListener("wheel",T,{passive:!0}),l.addEventListener("touchstart",D,{passive:!0}),l.addEventListener("touchend",k,{passive:!0}),{H:()=>{l.removeEventListener("scroll",B),l.removeEventListener("wheel",T),l.removeEventListener("touchstart",D),l.removeEventListener("touchend",k),I.C()},V:()=>{const[P,M]=a.P();P&&(u(P,M,y),y=!1,M&&a.T()>a.M()&&a.A(1,o()))}}},cg=(a,l,i)=>{let o;return[async(u,f)=>{if(!await l())return;o&&o();const m=()=>{const[p,_]=ko();return o=()=>{_(!1)},a.T()&&Ro(o,150),[p,a.R(2,()=>{_(!0)})]};if(f&&sg())a.A(8,u()),tg(async()=>{for(;;){let p=!0;for(let[C,y]=a.v();C<=y;C++)if(a.I(C)){p=!1;break}if(p)break;const[_,x]=m();try{if(!await _)return}finally{x()}}a.A(7),i(u(),f)});else for(;;){const[p,_]=m();try{if(a.A(7),i(u()),!await p)return}finally{_()}}},()=>{o&&o()}]},dg=a=>{let l;return{F(i){(l||(l=new(og(ig(i))).ResizeObserver(a))).observe(i)},J(i){l.unobserve(i)},H(){l&&l.disconnect()}}},ug=r.defineComponent({props:{L:{type:Object,required:!0},W:{type:Object,required:!0},X:{type:Object,required:!0},Y:{type:Function,required:!0},D:{type:Number,required:!0},U:{type:Boolean},G:{type:Boolean},K:{type:Boolean},Z:{type:String,required:!0},ee:Object},setup(a){const l=r.ref(),i=r.computed(()=>a.L.value&&a.W.O(a.D,a.K)),o=r.computed(()=>a.L.value&&a.W.I(a.D));return r.watch(()=>l.value&&a.D,(u,f,m)=>{m(a.Y(l.value,a.D))},{flush:"post"}),()=>{var u;const{X:f,U:m,G:p,Z:_}=a,x=o.value,{style:C,...y}=(u=a.ee)!==null&&u!==void 0?u:{},I={contain:"layout style",position:x&&p?void 0:"absolute",[m?"height":"width"]:"100%",[m?"top":"left"]:"0px",[m?"left":"top"]:i.value+"px",visibility:!x||p?void 0:"hidden",...C};return m&&(I.display="inline-flex"),r.createVNode(_,r.mergeProps({ref:l,style:I},y),typeof(B=f)=="function"||Object.prototype.toString.call(B)==="[object Object]"&&!r.isVNode(B)?f:{default:()=>[f],_:2},16,["style"]);var B}}}),fg=(a,l)=>{const i=a.key;return i??"_"+l},hg=(a,l)=>a[0]===l[0]&&a[1]===l[1],$a=r.defineComponent({props:{data:{type:Array,required:!0},bufferSize:Number,itemSize:Number,shift:Boolean,horizontal:Boolean,startMargin:{type:Number,default:0},ssrCount:Number,scrollRef:Object,as:{type:String,default:"div"},item:{type:String,default:"div"},itemProps:Function,keepMounted:Array,cache:Object},emits:["scroll","scrollEnd"],setup(a,{emit:l,expose:i,slots:o}){let u=!!a.ssrCount;const f=a.horizontal,m=r.ref(),p=ag(a.data.length,a.itemSize,a.ssrCount,a.cache,!a.itemSize),_=((T,D)=>{let k;const P=D?"width":"height",M=new WeakMap,v=dg(j=>{const H=[];for(const{target:Z,contentRect:V}of j)if(Z.offsetParent)if(Z===k)T.A(4,V[P]);else{const L=M.get(Z);L!=$r&&H.push([L,V[P]])}H.length&&T.A(3,H)});return{te(j){v.F(k=j)},re:(j,H)=>(M.set(j,H),v.F(j),()=>{M.delete(j),v.J(j)}),p:v.H}})(p,f),x=((T,D)=>{let k,P,M=ko(),v=!1;const j=D?"scrollLeft":"scrollTop",H=D?"overflowX":"overflowY",[Z,V]=cg(T,()=>M[0],(L,F)=>{L=Bo(L,v),F?k.scrollTo({[D?"left":"top"]:L,behavior:"smooth"}):k[j]=L});return{oe(L){k=L,D&&(v=getComputedStyle(L).direction==="rtl"),P=lg(T,L,D,()=>Bo(L[j],v),(F,re,K)=>{if(K){const ee=L.style,G=ee[H];ee[H]="hidden",Ro(()=>{ee[H]=G})}L[j]=Bo(T.N()+F,v),re&&V()}),M[1](!0)},p(){P&&P.H(),M[1](!1),M=ko()},ne:()=>v,se(L){Z(()=>L)},ie(L){L+=T.N(),Z(()=>L)},le(L,{align:F,smooth:re,offset:K=0}={}){if(L=Ua(L,0,T.j()-1),F==="nearest"){const ee=T.O(L),G=T.N();if(ee<G)F="start";else{if(!(ee+T.k(L)>G+T.T()))return;F="end"}}Z(()=>K+T.q()+T.O(L)+(F==="end"?T.k(L)-T.T():F==="center"?(T.k(L)-T.T())/2:0),re)},ce:()=>{P&&P.V()}}})(p,f),C=r.ref(p.h());p.R(1,()=>{C.value=p.h()}),p.R(4,()=>{l("scroll",p.N())}),p.R(8,()=>{l("scrollEnd")});const y=r.computed(T=>{C.value;const D=p.v(a.bufferSize);return T&&hg(T,D)?T:D}),I=r.computed(()=>C.value&&p.B()),B=r.computed(()=>C.value&&p.M());return r.onMounted(()=>{u=!1;const T=requestAnimationFrame(()=>{const D=k=>{_.te(k),x.oe(k)};a.scrollRef?D(a.scrollRef):D(m.value.parentElement)});r.onUnmounted(()=>{cancelAnimationFrame(T)})}),r.onUnmounted(()=>{p.p(),_.p(),x.p()}),r.watch(()=>a.data.length,T=>{p.A(5,[T,a.shift])}),r.watch(()=>a.startMargin,T=>{p.A(6,T)},{immediate:!0}),r.watch([C],()=>{x.ce()},{flush:"post"}),i({get cache(){return p.m()},get scrollOffset(){return p.N()},get scrollSize(){return(T=>An(T.M(),T.T()))(p)},get viewportSize(){return p.T()},findItemIndex:p.S,getItemOffset:p.O,getItemSize:p.k,scrollToIndex:x.le,scrollTo:x.se,scrollBy:x.ie}),()=>{const T=a.as,D=a.item,k=B.value,P=x.ne(),M=!f&&P?"unshift":"push",v=[],j=Z=>{var V;const L=o.default({item:a.data[Z],index:Z})[0];return r.createVNode(ug,{key:fg(L,Z),L:C,W:p,Y:_.re,D:Z,X:L,U:f,K:P,G:u,Z:D,ee:(V=a.itemProps)===null||V===void 0?void 0:V.call(a,{item:a.data[Z],index:Z})},null,8,["L","W","Y","D","X","U","K","G","Z","ee"])};if(a.keepMounted){const Z=new Set(a.keepMounted);for(let[V,L]=y.value;V<=L;V++)Z.add(V);za([...Z]).forEach(V=>{v[M](j(V))})}else for(let[Z,V]=y.value;Z<=V;Z++)v[M](j(Z));return r.createVNode(T,{ref:m,style:{contain:"size style",overflowAnchor:"none",flex:"none",position:"relative",width:f?k+"px":"100%",height:f?"100%":k+"px",pointerEvents:I.value?"none":void 0}},typeof(H=v)=="function"||Object.prototype.toString.call(H)==="[object Object]"&&!r.isVNode(H)?v:{default:()=>[v],_:2},8,["style"]);var H}}}),mg=r.defineComponent({props:{data:{type:Array,required:!0},bufferSize:Number,itemSize:Number,shift:Boolean,horizontal:Boolean,ssrCount:Number,itemProps:Function,keepMounted:Array,cache:Object},emits:["scroll","scrollEnd"],setup(a,{emit:l,expose:i,slots:o}){const u=a.horizontal,f=_=>{l("scroll",_)},m=()=>{l("scrollEnd")},p=r.ref();return i({get cache(){return p.value.cache},get scrollOffset(){return p.value.scrollOffset},get scrollSize(){return p.value.scrollSize},get viewportSize(){return p.value.viewportSize},findItemIndex:(..._)=>p.value.findItemIndex(..._),getItemOffset:(..._)=>p.value.getItemOffset(..._),getItemSize:(..._)=>p.value.getItemSize(..._),scrollToIndex:(..._)=>p.value.scrollToIndex(..._),scrollTo:(..._)=>p.value.scrollTo(..._),scrollBy:(..._)=>p.value.scrollBy(..._)}),()=>{return r.createVNode("div",{style:{display:u?"inline-block":"block",[u?"overflowX":"overflowY"]:"auto",contain:"strict",width:"100%",height:"100%"}},[r.createVNode($a,{ref:p,data:a.data,bufferSize:a.bufferSize,itemSize:a.itemSize,itemProps:a.itemProps,shift:a.shift,ssrCount:a.ssrCount,horizontal:u,keepMounted:a.keepMounted,cache:a.cache,onScroll:f,onScrollEnd:m},(_=o,typeof _=="function"||Object.prototype.toString.call(_)==="[object Object]"&&!r.isVNode(_)?o:{default:()=>[o],_:2}),8,["data","bufferSize","itemSize","itemProps","shift","ssrCount","horizontal","keepMounted","cache","onScroll","onScrollEnd"])],4);var _}}}),gg=(a,l=10)=>new Promise(i=>{let o=0,u=0,f=0;const m=()=>{if(!a||a.scrollSize===void 0){i();return}const p=a.scrollSize;p===f&&p>0?o++:(o=0)&&(f=p),u++,o>=2||u>=l?i():requestAnimationFrame(m)};requestAnimationFrame(m)});function pg(a,l){const i=(l==null?void 0:l.align)??"start";let o=!1;const u=r.ref(null),f=r.ref(!1),m=r.ref("measure"),p=r.computed(()=>r.toValue(a).length),_=r.computed(()=>m.value==="measure"||m.value==="virtual"?1:5),x=r.computed(()=>Array.from({length:p.value*_.value},(k,P)=>P)),C=async()=>{if(u.value&&(m.value="measure",o=!1,f.value=!1,await r.nextTick(),!(!u.value||m.value!=="measure")&&(await gg(u.value),!!u.value))){if(f.value=u.value.scrollSize>u.value.viewportSize,!f.value){o=!1;return}o=!0,m.value=(l==null?void 0:l.mode)||"loop",await r.nextTick(),u.value&&u.value.scrollToIndex(p.value*3,{align:i})}},y=k=>m.value==="measure"?k:p.value===0?0:k%p.value,I=(k,P)=>{u.value&&u.value.scrollToIndex(k,P)},B=(k,P)=>!o||m.value!=="loop"?P:P+Math.round((k-P)/p.value)*p.value,T=k=>{if(!o||m.value!=="loop"||!u.value)return;const P=p.value-1,M=p.value*4;if(k<P)return I(p.value*3-1,{align:"start"});if(k>=M)return I(p.value*3,{align:"start"})},D=()=>{if(!u.value||!o)return;const k=u.value.findItemIndex(u.value.scrollOffset);T(k)};return r.onMounted(C),r.onUnmounted(()=>u.value=null),r.watch(p,()=>r.nextTick(C)),{listRef:u,items:x,hasScroll:f,realIndex:y,findNearestIndex:B,scrollToIndex:I,init:C,onScroll:D}}const xg=Object.prototype.toString,_g=a=>xg.call(a)==="[object Error]",wg=new Set(["network error","NetworkError when attempting to fetch resource.","The Internet connection appears to be offline.","Network request failed","fetch failed","terminated"," A network error occurred.","Network connection lost"]),Cg=a=>{if(!(a&&_g(a)&&a.name==="TypeError"&&typeof a.message=="string"))return!1;const{message:i,stack:o}=a;return i==="Load failed"?o===void 0||"__sentry_captured__"in a:i.startsWith("error sending request for url")||i==="Failed to fetch"||i.startsWith("Failed to fetch (")&&i.endsWith(")")?!0:wg.has(i)},Eg={pinch:!0,doubleTap:!0,wheel:!0,buttons:["+","-","=","0"]},yg=a=>{var i;const l=Object.assign({},Eg,a);if(l.pinch&&(document.addEventListener("touchstart",o=>o.touches.length>1&&o.preventDefault(),{passive:!1}),document.addEventListener("gesturestart",o=>o.preventDefault(),{passive:!1})),l.doubleTap){let o=0;document.addEventListener("touchend",u=>{const f=Date.now();f-o<=250&&u.preventDefault(),o=f},{passive:!1})}l.wheel&&document.addEventListener("wheel",o=>(o.ctrlKey||o.metaKey)&&o.preventDefault(),{passive:!1}),(i=l.buttons)!=null&&i.length&&document.addEventListener("keydown",o=>(o.ctrlKey||o.metaKey)&&l.buttons.includes(o.key)&&o.preventDefault())};Object.defineProperty(he,"useRoute",{enumerable:!0,get:()=>ke.useRoute}),Object.defineProperty(he,"useRouter",{enumerable:!0,get:()=>ke.useRouter}),he.BasketButton=Jm,he.BottomSheet=xo,he.ButtonDefault=sn,he.CardMain=_a,he.CardProductPage=A0,he.CardReader=fa,he.CartBox=ua,he.CartPage=Vh,he.DrumItem=G2,he.FallingHearts=$m,he.GroupMain=L2,he.InitConnection=yn,he.ModalWindows=tm,he.NotificationWindow=Ci,he.OrderBox=bo,he.PopupWindowDefault=da,he.PricePrerender=mr,he.QrCameraScanner=Mm,he.QrcodeVue=xa,he.Recommendation=K2,he.RetryPage=Yh,he.TableOrderPage=y2,he.TagsMain=V2,he.VList=mg,he.Virtualizer=$a,he.clearAllProductDB=Rl,he.clearLocalStorage=gr,he.getCachedGroup=qi,he.getCachedProduct=rs,he.getWebSocketInstance=Fr,he.initPinia=ul,he.initRouter=hl,he.isNetworkError=Cg,he.parseTheme=ia,he.preventZoom=yg,he.updateIndexedDB=Um,he.useCachedMedia=bn,he.useCardLibStore=Lt,he.useCartLibStore=Mt,he.useImageCacheStore=oi,he.useMainLibStore=ot,he.useModal=yo,he.useModalStore=yi,he.useModulesLibStore=Wr,he.usePdf=Wn,he.useTableStore=Vn,he.useThemeStore=Ct,he.useVirtuaLoop=pg,he.vClickOutside=Dm,he.vConfetti=vm,he.vDragScroll=Xr,he.vMario=Pm,he.vMuted=Er,Object.defineProperty(he,Symbol.toStringTag,{value:"Module"})});