@inno_user/inno_clouds_lib 9.6.0 → 9.6.2

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,21 +1,21 @@
1
- (function(fe,Ne){typeof exports=="object"&&typeof module<"u"?Ne(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"],Ne):(fe=typeof globalThis<"u"?globalThis:fe||self,Ne(fe.InnoCloudsLib={},fe.VueRouter,fe.Pinia,fe.Vue,fe.VueuseCore,fe.motionV))})(this,function(fe,Ne,we,r,pt,Dt){"use strict";var dp=Object.defineProperty;var al=fe=>{throw TypeError(fe)};var up=(fe,Ne,we)=>Ne in fe?dp(fe,Ne,{enumerable:!0,configurable:!0,writable:!0,value:we}):fe[Ne]=we;var ke=(fe,Ne,we)=>up(fe,typeof Ne!="symbol"?Ne+"":Ne,we),ll=(fe,Ne,we)=>Ne.has(fe)||al("Cannot "+we);var wn=(fe,Ne,we)=>(ll(fe,Ne,"read from private field"),we?we.call(fe):Ne.get(fe)),Ui=(fe,Ne,we)=>Ne.has(fe)?al("Cannot add the same private member more than once"):Ne instanceof WeakSet?Ne.add(fe):Ne.set(fe,we),vn=(fe,Ne,we,r)=>(ll(fe,Ne,"write to private field"),r?r.call(fe,we):Ne.set(fe,we),we);var Yo=(fe,Ne,we,r)=>({set _(pt){vn(fe,Ne,pt,we)},get _(){return wn(fe,Ne,r)}});var tn,Hn,ir;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 Ne.createRouter({history:Ne.createWebHistory(),routes:fl})}const zi=(a,l)=>l.some(i=>a instanceof i);let Ko,Qo;function ml(){return Ko||(Ko=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function gl(){return Qo||(Qo=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}const Hi=new WeakMap,Gi=new WeakMap,ii=new WeakMap;function pl(a){const l=new Promise((i,o)=>{const u=()=>{a.removeEventListener("success",f),a.removeEventListener("error",m)},f=()=>{i(Un(a.result)),u()},m=()=>{o(a.error),u()};a.addEventListener("success",f),a.addEventListener("error",m)});return ii.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 Un(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 Jo(a){Wi=a(Wi)}function _l(a){return gl().includes(a)?function(...l){return a.apply(Xi(this),l),Un(this.request)}:function(...l){return Un(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 Un(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),ii.set(l,a)),l}const Xi=a=>ii.get(a);function Cl(a,l,{blocked:i,upgrade:o,blocking:u,terminated:f}={}){const m=indexedDB.open(a,l),p=Un(m);return o&&m.addEventListener("upgradeneeded",_=>{o(Un(m.result),_.oldVersion,_.newVersion,Un(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)),Un(i).then(()=>{})}const yl=["get","getKey","getAll","getAllKeys","count"],bl=["put","add","delete","clear"],$i=new Map;function es(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}Jo(a=>({...a,get:(l,i,o)=>es(l,i)||a.get(l,i,o),has:(l,i)=>!!es(l,i)||a.has(l,i)}));const Al=["continue","continuePrimaryKey","advance"],ts={},ji=new WeakMap,ns=new WeakMap,Sl={get(a,l){if(!Al.includes(l))return a[l];let i=ts[l];return i||(i=ts[l]=function(...o){ji.set(this,ns.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(ns.set(i,l),ii.set(i,Xi(l));l;)yield i,l=await(ji.get(i)||l.continue()),ji.delete(i)}function rs(a,l){return l===Symbol.asyncIterator&&zi(a,[IDBIndex,IDBObjectStore,IDBCursor])||l==="iterate"&&zi(a,[IDBIndex,IDBObjectStore])}Jo(a=>({...a,get(l,i,o){return rs(l,i)?Il:a.get(l,i,o)},has(l,i){return rs(l,i)||a.has(l,i)}}));let Zn;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 Yn(){if(Zn)try{const a=await Zn;return a.transaction("groups","readonly").commit(),a}catch{Zn=void 0}return Zn=Nl(),Zn}async function qi(a){return(await Yn()).transaction("groups","readonly").objectStore("groups").get(a)}async function Dr(a,l){const o=(await Yn()).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 Dr(a,i)}async function Zi(a,l){const o=(await Yn()).transaction("media","readwrite");await o.objectStore("media").put({id:a,blob:l,timestamp:Date.now()}),await o.done}async function fr(a){const u=await(await Yn()).transaction("media","readonly").objectStore("media").get(a);return u==null?void 0:u.blob}async function kl(a){const i=(await Yn()).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 is(a){const u=await(await Yn()).transaction("products","readonly").objectStore("products").get(a);return u==null?void 0:u.product}async function Rl(){const a=Zn;if(Zn=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 oi(a){"@babel/helpers - typeof";return oi=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},oi(a)}var Bl=/^\s+/,Ol=/\s+$/;function Se(a,l){if(a=a||"",l=l||{},a instanceof Se)return a;if(!(this instanceof Se))return new Se(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}Se.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=ds(l),this._roundA=Math.round(100*this._a)/100,this},toHsv:function(){var l=ss(this._r,this._g,this._b);return{h:l.h*360,s:l.s,v:l.v,a:this._a}},toHsvString:function(){var l=ss(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=os(this._r,this._g,this._b);return{h:l.h*360,s:l.s,l:l.l,a:this._a}},toHslString: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.l*100);return this._a==1?"hsl("+i+", "+o+"%, "+u+"%)":"hsla("+i+", "+o+"%, "+u+"%, "+this._roundA+")"},toHex:function(l){return as(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(yt(this._r,255)*100)+"%",g:Math.round(yt(this._g,255)*100)+"%",b:Math.round(yt(this._b,255)*100)+"%",a:this._a}},toPercentageRgbString:function(){return this._a==1?"rgb("+Math.round(yt(this._r,255)*100)+"%, "+Math.round(yt(this._g,255)*100)+"%, "+Math.round(yt(this._b,255)*100)+"%)":"rgba("+Math.round(yt(this._r,255)*100)+"%, "+Math.round(yt(this._g,255)*100)+"%, "+Math.round(yt(this._b,255)*100)+"%, "+this._roundA+")"},toName:function(){return this._a===0?"transparent":this._a<1?!1:Zl[as(this._r,this._g,this._b,!0)]||!1},toFilter:function(l){var i="#"+ls(this._r,this._g,this._b,this._a),o=i,u=this._gradientType?"GradientType = 1, ":"";if(l){var f=Se(l);o="#"+ls(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 Se(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(cs,[3])},tetrad:function(){return this._applyCombination(cs,[4])}},Se.fromRatio=function(a,l){if(oi(a)=="object"){var i={};for(var o in a)a.hasOwnProperty(o)&&(o==="a"?i[o]=a[o]:i[o]=vr(a[o]));a=i}return Se(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)),oi(a)=="object"&&(Pn(a.r)&&Pn(a.g)&&Pn(a.b)?(l=Dl(a.r,a.g,a.b),m=!0,p=String(a.r).substr(-1)==="%"?"prgb":"rgb"):Pn(a.h)&&Pn(a.s)&&Pn(a.v)?(o=vr(a.s),u=vr(a.v),l=Pl(a.h,o,u),m=!0,p="hsv"):Pn(a.h)&&Pn(a.s)&&Pn(a.l)&&(o=vr(a.s),f=vr(a.l),l=vl(a.h,o,f),m=!0,p="hsl"),a.hasOwnProperty("a")&&(i=a.a)),i=ds(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:yt(a,255)*255,g:yt(l,255)*255,b:yt(i,255)*255}}function os(a,l,i){a=yt(a,255),l=yt(l,255),i=yt(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=yt(a,360),l=yt(l,100),i=yt(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 ss(a,l,i){a=yt(a,255),l=yt(l,255),i=yt(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=yt(a,360)*6,l=yt(l,100),i=yt(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 as(a,l,i,o){var u=[Cn(Math.round(a).toString(16)),Cn(Math.round(l).toString(16)),Cn(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=[Cn(Math.round(a).toString(16)),Cn(Math.round(l).toString(16)),Cn(Math.round(i).toString(16)),Cn(us(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 ls(a,l,i,o){var u=[Cn(us(o)),Cn(Math.round(a).toString(16)),Cn(Math.round(l).toString(16)),Cn(Math.round(i).toString(16))];return u.join("")}Se.equals=function(a,l){return!a||!l?!1:Se(a).toRgbString()==Se(l).toRgbString()},Se.random=function(){return Se.fromRatio({r:Math.random(),g:Math.random(),b:Math.random()})};function Fl(a,l){l=l===0?0:l||10;var i=Se(a).toHsl();return i.s-=l/100,i.s=si(i.s),Se(i)}function Vl(a,l){l=l===0?0:l||10;var i=Se(a).toHsl();return i.s+=l/100,i.s=si(i.s),Se(i)}function Ul(a){return Se(a).desaturate(100)}function zl(a,l){l=l===0?0:l||10;var i=Se(a).toHsl();return i.l+=l/100,i.l=si(i.l),Se(i)}function Hl(a,l){l=l===0?0:l||10;var i=Se(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)))),Se(i)}function Gl(a,l){l=l===0?0:l||10;var i=Se(a).toHsl();return i.l-=l/100,i.l=si(i.l),Se(i)}function Wl(a,l){var i=Se(a).toHsl(),o=(i.h+l)%360;return i.h=o<0?360+o:o,Se(i)}function Xl(a){var l=Se(a).toHsl();return l.h=(l.h+180)%360,Se(l)}function cs(a,l){if(isNaN(l)||l<=0)throw new Error("Argument to polyad must be a positive number");for(var i=Se(a).toHsl(),o=[Se(a)],u=360/l,f=1;f<l;f++)o.push(Se({h:(i.h+f*u)%360,s:i.s,l:i.l}));return o}function $l(a){var l=Se(a).toHsl(),i=l.h;return[Se(a),Se({h:(i+72)%360,s:l.s,l:l.l}),Se({h:(i+216)%360,s:l.s,l:l.l})]}function jl(a,l,i){l=l||6,i=i||30;var o=Se(a).toHsl(),u=360/i,f=[Se(a)];for(o.h=(o.h-(u*l>>1)+720)%360;--l;)o.h=(o.h+u)%360,f.push(Se(o));return f}function ql(a,l){l=l||6;for(var i=Se(a).toHsv(),o=i.h,u=i.s,f=i.v,m=[],p=1/l;l--;)m.push(Se({h:o,s:u,v:f})),f=(f+p)%1;return m}Se.mix=function(a,l,i){i=i===0?0:i||50;var o=Se(a).toRgb(),u=Se(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 Se(m)},Se.readability=function(a,l){var i=Se(a),o=Se(l);return(Math.max(i.getLuminance(),o.getLuminance())+.05)/(Math.min(i.getLuminance(),o.getLuminance())+.05)},Se.isReadable=function(a,l,i){var o=Se.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},Se.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=Se.readability(a,l[x]),f>u&&(u=f,o=Se(l[x]));return Se.isReadable(a,o,{level:p,size:_})||!m?o:(i.includeFallbackColors=!1,Se.mostReadable(a,["#fff","#000"],i))};var Yi=Se.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=Se.hexNames=Yl(Yi);function Yl(a){var l={};for(var i in a)a.hasOwnProperty(i)&&(l[a[i]]=i);return l}function ds(a){return a=parseFloat(a),(isNaN(a)||a<0||a>1)&&(a=1),a}function yt(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 si(a){return Math.min(1,Math.max(0,a))}function ln(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 Cn(a){return a.length==1?"0"+a:""+a}function vr(a){return a<=1&&(a=a*100+"%"),a}function us(a){return Math.round(parseFloat(a)*255).toString(16)}function fs(a){return ln(a)/255}var En=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 Pn(a){return!!En.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=En.rgb.exec(a))?{r:i[1],g:i[2],b:i[3]}:(i=En.rgba.exec(a))?{r:i[1],g:i[2],b:i[3],a:i[4]}:(i=En.hsl.exec(a))?{h:i[1],s:i[2],l:i[3]}:(i=En.hsla.exec(a))?{h:i[1],s:i[2],l:i[3],a:i[4]}:(i=En.hsv.exec(a))?{h:i[1],s:i[2],v:i[3]}:(i=En.hsva.exec(a))?{h:i[1],s:i[2],v:i[3],a:i[4]}:(i=En.hex8.exec(a))?{r:ln(i[1]),g:ln(i[2]),b:ln(i[3]),a:fs(i[4]),format:l?"name":"hex8"}:(i=En.hex6.exec(a))?{r:ln(i[1]),g:ln(i[2]),b:ln(i[3]),format:l?"name":"hex"}:(i=En.hex4.exec(a))?{r:ln(i[1]+""+i[1]),g:ln(i[2]+""+i[2]),b:ln(i[3]+""+i[3]),a:fs(i[4]+""+i[4]),format:l?"name":"hex8"}:(i=En.hex3.exec(a))?{r:ln(i[1]+""+i[1]),g:ln(i[2]+""+i[2]),b:ln(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 ai=we.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 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:o,updateCacheFromBlob:i,cleanup:p,setupEventListener:f,removeEventListener:m}}),At=we.defineStore("themeLib",()=>{const a=ai(),{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_enable_locators: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_menu_btn:null,kiosk_hide_manual_input_loyalty_card:null,kiosk_camera_scan_loyalty_card:null,kiosk_hide_menu_update_notification:null,kiosk_infinite_scroll: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 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=Se(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}}),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 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 hs(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,o=a.split(".")[i];if(typeof o!="string")throw new Pr(`Invalid token specified: missing part #${i+1}`);let u;try{u=nc(o)}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 hs(JSON.parse(i))}catch(o){return console.error("Failed to decode JWT:",o),l}}return l},ms=(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},mr=a=>{a.forEach(l=>{try{localStorage.removeItem(l)}catch(i){console.error(`Ошибка при удалении ключа "${l}":`,i)}})};class oc{constructor(l,i={}){ke(this,"url");ke(this,"options");ke(this,"ws");ke(this,"reconnectInterval");ke(this,"listeners");ke(this,"isConnected");ke(this,"heartbeat");ke(this,"heartbeatTimeout");ke(this,"pingTimeout");ke(this,"pingResponseTimeout");ke(this,"signal");ke(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 li=new Map;function Lr(a,l={}){var o;if(li.has(a)){const u=li.get(a);if(u.isConnected.value&&((o=u.ws)==null?void 0:o.readyState)===WebSocket.OPEN)return u.listeners.clear(),u;u.close(!0),li.delete(a)}const i=new oc(a,l);return li.set(a,i),i}const lt=we.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),v=r.ref(),k=r.ref(!localStorage.getItem("apiKey")),P=r.ref(!1),D=r.ref({textNotification:""}),M=r.ref([]),j=r.ref(0);let H=null;const Z=ae=>{const oe=`wss://${x.value.area}/ws/device/${ae}/`;H=Lr(oe);function xe(){console.log("WebSocket connection opened")}function _e(he){if(he.error)P.value=!0,D.value.textNotification=he.error,H==null||H.close(!0);else{if(!(he!=null&&he.params))return;v.value=he.params,typeof he.params.components.shift.is_ok!==null?T.value=he.params.components.shift.is_ok:T.value=!0}}function Pe(he){console.error("WebSocket error:",he),H.close(!0)}H.on("open",xe),H.on("message",_e),H.on("error",Pe),H.connect()},V=ae=>{o.value=ae,localStorage.setItem("kiosk_timeout",ae)},L=ae=>{l.value=ae},F=r.ref(null),re=r.computed(()=>m.value.reduce((ae,oe)=>{let xe=0,_e=0;return oe.group_modifiers&&(xe=oe.group_modifiers.reduce((Pe,he)=>he.modifiers?Pe+he.modifiers.reduce((qe,ye)=>qe+ye.old_price*ye.amount,0):0,0)*oe.amount),oe.modifiers&&(_e=oe.modifiers.reduce((Pe,he)=>Pe+he.old_price*he.amount,0)*oe.amount),ae+oe.old_price*oe.amount+xe+_e},0)),K=r.computed({get:()=>m.value.length===0||F.value===0?0:F.value&&F.value!==0?F.value:m.value.reduce((ae,oe)=>{const xe=hr(oe)*oe.amount;let _e=0,Pe=0;return oe.group_modifiers&&(_e=oe.group_modifiers.reduce((he,qe)=>qe.modifiers?he+qe.modifiers.reduce((ye,Ke)=>ye+Ke.price*Ke.amount,0):0,0)*oe.amount),oe.modifiers&&(Pe=oe.modifiers.reduce((he,qe)=>he+qe.price*qe.amount,0)*oe.amount),ae+xe+_e+Pe},0),set(ae){F.value=ae}}),ee=ae=>{y.value=ae,localStorage.removeItem("bonus"),ms("bonus",y.value)},G=ae=>{mr(ae)},W=ae=>{ae={...ae,idSystem:crypto.randomUUID()};const oe=X(ae);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(ae){console.error("Failed to update cart in localStorage:",ae)}},X=ae=>r.reactive({...ae,amount:ae.amount??1,price:ae.old_price,new_price:null,total_new_price:null,discounts:[],modifiers:(ae.modifiers||[]).map(oe=>r.reactive({...oe,price:oe.old_price,new_price:null,total_new_price:null})),group_modifiers:(ae.group_modifiers||[]).map(oe=>r.reactive({...oe,modifiers:(oe.modifiers||[]).map(xe=>r.reactive({...xe,price:xe.old_price,new_price:null,total_new_price:null}))}))}),$=ae=>{const oe=m.value.find(xe=>xe.idSystem===ae);oe&&(oe.amount+=1),N()},q=ae=>{const oe=m.value.find(xe=>xe.idSystem===ae);oe&&(oe.amount>=1&&(oe.amount-=1),N())},J=()=>{try{const ae=localStorage.getItem("cart");if(ae){const oe=JSON.parse(ae);m.value.splice(0,m.value.length,...oe.map(X)),F.value=null}}catch(ae){console.error("Failed to load cart from localStorage:",ae)}};return J(),{cartProducts_lib:m,activeScrolling_lib:p,config_lib:x,totalPrice_lib:K,initialCartPrice_lib:re,is_notification_lib:P,notificationData_lib:D,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:v,displayCards:M,isOrderTypeSubmited:_,cartBasketBumpKey:j,removeFromLocalStorage:G,setKioskTimeout:V,setBonus:ee,setStateDrum:L,addToCart:W,plusAmount:$,minusAmount:q,loadCart:J,deleteItemFromCart:ae=>{if(ae){const oe=m.value.findIndex(xe=>xe.idSystem===ae);if(oe===-1)return;m.value.splice(oe,1),N(),F.value=null}else m.value=[],N()},updateCartInLocalStorage:N,makeProductFullyReactive:X,checkHeartbeatApp:Z}});function gs(a,l){return function(){return a.apply(l,arguments)}}const{toString:sc}=Object.prototype,{getPrototypeOf:Ki}=Object,{iterator:ci,toStringTag:ps}=Symbol,di=(a=>l=>{const i=sc.call(l);return a[i]||(a[i]=i.slice(8,-1).toLowerCase())})(Object.create(null)),yn=a=>(a=a.toLowerCase(),l=>di(l)===a),ui=a=>l=>typeof l===a,{isArray:gr}=Array,pr=ui("undefined");function Fr(a){return a!==null&&!pr(a)&&a.constructor!==null&&!pr(a.constructor)&&Qt(a.constructor.isBuffer)&&a.constructor.isBuffer(a)}const xs=yn("ArrayBuffer");function ac(a){let l;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?l=ArrayBuffer.isView(a):l=a&&a.buffer&&xs(a.buffer),l}const lc=ui("string"),Qt=ui("function"),_s=ui("number"),Vr=a=>a!==null&&typeof a=="object",cc=a=>a===!0||a===!1,fi=a=>{if(di(a)!=="object")return!1;const l=Ki(a);return(l===null||l===Object.prototype||Object.getPrototypeOf(l)===null)&&!(ps in a)&&!(ci 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=yn("Date"),fc=yn("File"),hc=yn("Blob"),mc=yn("FileList"),gc=a=>Vr(a)&&Qt(a.pipe),pc=a=>{let l;return a&&(typeof FormData=="function"&&a instanceof FormData||Qt(a.append)&&((l=di(a))==="formdata"||l==="object"&&Qt(a.toString)&&a.toString()==="[object FormData]"))},xc=yn("URLSearchParams"),[_c,wc,Cc,Ec]=["ReadableStream","Request","Response","Headers"].map(yn),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 o,u;if(typeof a!="object"&&(a=[a]),gr(a))for(o=0,u=a.length;o<u;o++)l.call(null,a[o],o,a);else{if(Fr(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 ws(a,l){if(Fr(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 Kn=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,Cs=a=>!pr(a)&&a!==Kn;function Qi(){const{caseless:a,skipUndefined:l}=Cs(this)&&this||{},i={},o=(u,f)=>{const m=a&&ws(i,f)||f;fi(i[m])&&fi(u)?i[m]=Qi(i[m],u):fi(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],o);return i}const bc=(a,l,i,{allOwnKeys:o}={})=>(Ur(l,(u,f)=>{i&&Qt(u)?a[f]=gs(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(gr(a))return a;let l=a.length;if(!_s(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[ci]).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=yn("HTMLFormElement"),Mc=a=>a.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(i,o,u){return o.toUpperCase()+u}),Es=(({hasOwnProperty:a})=>(l,i)=>a.call(l,i))(Object.prototype),Dc=yn("RegExp"),ys=(a,l)=>{const i=Object.getOwnPropertyDescriptors(a),o={};Ur(i,(u,f)=>{let m;(m=l(u,f,a))!==!1&&(o[f]=m||u)}),Object.defineProperties(a,o)},vc=a=>{ys(a,(l,i)=>{if(Qt(a)&&["arguments","caller","callee"].indexOf(i)!==-1)return!1;const o=a[i];if(Qt(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 gr(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&&Qt(a.append)&&a[ps]==="FormData"&&a[ci])}const Uc=a=>{const l=new Array(10),i=(o,u)=>{if(Vr(o)){if(l.indexOf(o)>=0)return;if(Fr(o))return o;if(!("toJSON"in o)){l[u]=o;const f=gr(o)?[]:{};return Ur(o,(m,p)=>{const _=i(m,u+1);!pr(_)&&(f[p]=_)}),l[u]=void 0,f}}return o};return i(a,0)},zc=yn("AsyncFunction"),Hc=a=>a&&(Vr(a)||Qt(a))&&Qt(a.then)&&Qt(a.catch),bs=((a,l)=>a?setImmediate:l?((i,o)=>(Kn.addEventListener("message",({source:u,data:f})=>{u===Kn&&f===i&&o.length&&o.shift()()},!1),u=>{o.push(u),Kn.postMessage(i,"*")}))(`axios@${Math.random()}`,[]):i=>setTimeout(i))(typeof setImmediate=="function",Qt(Kn.postMessage)),Gc=typeof queueMicrotask<"u"?queueMicrotask.bind(Kn):typeof process<"u"&&process.nextTick||bs,te={isArray:gr,isArrayBuffer:xs,isBuffer:Fr,isFormData:pc,isArrayBufferView:ac,isString:lc,isNumber:_s,isBoolean:cc,isObject:Vr,isPlainObject:fi,isEmptyObject:dc,isReadableStream:_c,isRequest:wc,isResponse:Cc,isHeaders:Ec,isUndefined:pr,isDate:uc,isFile:fc,isBlob:hc,isRegExp:Dc,isFunction:Qt,isStream:gc,isURLSearchParams:xc,isTypedArray:kc,isFileList:mc,forEach:Ur,merge:Qi,extend:bc,trim:yc,stripBOM:Ac,inherits:Sc,toFlatObject:Ic,kindOf:di,kindOfTest:yn,endsWith:Nc,toArray:Tc,forEachEntry:Rc,matchAll:Bc,isHTMLForm:Oc,hasOwnProperty:Es,hasOwnProp:Es,reduceDescriptors:ys,freezeMethods:vc,toObjectSet:Pc,toCamelCase:Mc,noop:Lc,toFiniteNumber:Fc,findKey:ws,global:Kn,isContextDefined:Cs,isSpecCompliantForm:Vc,toJSONObject:Uc,isAsyncFn:zc,isThenable:Hc,setImmediate:bs,asap:Gc,isIterable:a=>a!=null&&Qt(a[ci])};function Le(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(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:te.toJSONObject(this.config),code:this.code,status:this.status}}});const As=Le.prototype,Ss={};["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=>{Ss[a]={value:a}}),Object.defineProperties(Le,Ss),Object.defineProperty(As,"isAxiosError",{value:!0}),Le.from=(a,l,i,o,u,f)=>{const m=Object.create(As);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 Le.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 Is(a){return te.endsWith(a,"[]")?a.slice(0,-2):a}function Ns(a,l,i){return a?a.concat(l).map(function(u,f){return u=Is(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 hi(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(v,k){return!te.isUndefined(k[v])});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 Le("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,v,k){let P=T;if(T&&!k&&typeof T=="object"){if(te.endsWith(v,"{}"))v=o?v:v.slice(0,-2),T=JSON.stringify(T);else if(te.isArray(T)&&Xc(T)||(te.isFileList(T)||te.endsWith(v,"[]"))&&(P=te.toArray(T)))return v=Is(v),P.forEach(function(M,j){!(te.isUndefined(M)||M===null)&&l.append(m===!0?Ns([v],j,f):m===null?v:v+"[]",x(M))}),!1}return Ji(T)?!0:(l.append(Ns(k,v,f),x(T)),!1)}const y=[],I=Object.assign($c,{defaultVisitor:C,convertValue:x,isVisitable:Ji});function B(T,v){if(!te.isUndefined(T)){if(y.indexOf(T)!==-1)throw Error("Circular reference detected in "+v.join("."));y.push(T),te.forEach(T,function(P,D){(!(te.isUndefined(P)||P===null)&&u.call(l,P,te.isString(D)?D.trim():D,v,I))===!0&&B(P,v?v.concat(D):[D])}),y.pop()}}if(!te.isObject(a))throw new TypeError("data must be an object");return B(a),l}function Ts(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&&hi(a,this,l)}const ks=eo.prototype;ks.append=function(l,i){this._pairs.push([l,i])},ks.toString=function(l){const i=l?function(o){return l.call(this,o,Ts)}:Ts;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 Rs(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 Bs{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 Os={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",qt={...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 hi(a,new qt.classes.URLSearchParams,{visitor:function(i,o,u,f){return qt.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 Ms(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 zr={transitional:Os,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(Ms(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 hi(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,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"?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:qt.classes.FormData,Blob:qt.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=>{zr.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},Ds=Symbol("internals");function Hr(a){return a&&String(a).trim().toLowerCase()}function mi(a){return a===!1||a==null?a:te.isArray(a)?a.map(mi):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 Jt=class{constructor(l){l&&this.set(l)}set(l,i,o){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=te.findKey(u,C);(!y||u[y]===void 0||x===!0||x===void 0&&u[y]!==!1)&&(u[y||_]=mi(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=Hr(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=Hr(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=Hr(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]=mi(u),delete i[f];return}const p=l?sd(f):String(f).trim();p!==f&&delete i[f],i[p]=mi(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[Ds]=this[Ds]={accessors:{}}).accessors,u=this.prototype;function f(m){const p=Hr(m);o[p]||(ad(u,m),o[p]=!0)}return te.isArray(l)?l.forEach(f):f(l),this}};Jt.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),te.reduceDescriptors(Jt.prototype,({value:a},l)=>{let i=l[0].toUpperCase()+l.slice(1);return{get:()=>a,set(o){this[i]=o}}}),te.freezeMethods(Jt);function io(a,l){const i=this||zr,o=l||i,u=Jt.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 vs(a){return!!(a&&a.__CANCEL__)}function xr(a,l,i){Le.call(this,a??"canceled",Le.ERR_CANCELED,l,i),this.name="CanceledError"}te.inherits(xr,Le,{__CANCEL__:!0});function Ps(a,l,i){const o=i.config.validateStatus;!i.status||!o||o(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),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 gi=(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)},Ls=(a,l)=>{const i=a!=null;return[o=>l[0]({lengthComputable:i,total:a,loaded:o}),l[1]]},Fs=a=>(...l)=>te.asap(()=>a(...l)),ud=qt.hasStandardBrowserEnv?((a,l)=>i=>(i=new URL(i,qt.origin),a.protocol===i.protocol&&a.host===i.host&&(l||a.port===i.port)))(new URL(qt.origin),qt.navigator&&/(msie|trident)/i.test(qt.navigator.userAgent)):()=>!0,fd=qt.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 Vs(a,l,i){let o=!hd(l);return a&&(o||i==!1)?md(a,l):l}const Us=a=>a instanceof Jt?{...a}:a;function Qn(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(Us(x),Us(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 zs=a=>{const l=Qn({},a);let{data:i,withXSRFToken:o,xsrfHeaderName:u,xsrfCookieName:f,headers:m,auth:p}=l;if(l.headers=m=Jt.from(m),l.url=Rs(Vs(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(qt.hasStandardBrowserEnv||qt.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(qt.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=zs(a);let f=u.data;const m=Jt.from(u.headers).normalize();let{responseType:p,onUploadProgress:_,onDownloadProgress:x}=u,C,y,I,B,T;function v(){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 M=Jt.from("getAllResponseHeaders"in k&&k.getAllResponseHeaders()),H={data:!p||p==="text"||p==="json"?k.responseText:k.response,status:k.status,statusText:k.statusText,headers:M,config:a,request:k};Ps(function(V){i(V),v()},function(V){o(V),v()},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 Le("Request aborted",Le.ECONNABORTED,a,k)),k=null)},k.onerror=function(j){const H=j&&j.message?j.message:"Network Error",Z=new Le(H,Le.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||Os;u.timeoutErrorMessage&&(j=u.timeoutErrorMessage),o(new Le(j,H.clarifyTimeoutError?Le.ETIMEDOUT:Le.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]=gi(x,!0),k.addEventListener("progress",I)),_&&k.upload&&([y,B]=gi(_),k.upload.addEventListener("progress",y),k.upload.addEventListener("loadend",B)),(u.cancelToken||u.signal)&&(C=M=>{k&&(o(!M||M.type?new xr(null,a,k):M),k.abort(),k=null)},u.cancelToken&&u.cancelToken.subscribe(C),u.signal&&(u.signal.aborted?C():u.signal.addEventListener("abort",C)));const D=ld(u.url);if(D&&qt.protocols.indexOf(D)===-1){o(new Le("Unsupported protocol "+D+":",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 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 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:_}=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()}},Hs=(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})},Gs=64*1024,{isFunction:pi}=te,Cd=(({Request:a,Response:l})=>({Request:a,Response:l}))(te.global),{ReadableStream:Ws,TextEncoder:Xs}=te.global,$s=(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?pi(l):typeof fetch=="function",f=pi(i),m=pi(o);if(!u)return!1;const p=u&&pi(Ws),_=u&&(typeof Xs=="function"?(T=>v=>T.encode(v))(new Xs):async T=>new Uint8Array(await new i(T).arrayBuffer())),x=f&&p&&$s(()=>{let T=!1;const v=new i(qt.origin,{body:new Ws,method:"POST",get duplex(){return T=!0,"half"}}).headers.has("Content-Type");return T&&!v}),C=m&&p&&$s(()=>te.isReadableStream(new o("").body)),y={stream:C&&(T=>T.body)};u&&["text","arrayBuffer","blob","formData","stream"].forEach(T=>{!y[T]&&(y[T]=(v,k)=>{let P=v&&v[T];if(P)return P.call(v);throw new Le(`Response type '${T}' is not supported`,Le.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(qt.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,v)=>{const k=te.toFiniteNumber(T.getContentLength());return k??I(v)};return async T=>{let{url:v,method:k,data:P,signal:D,cancelToken:M,timeout:j,onDownloadProgress:H,onUploadProgress:Z,responseType:V,headers:L,withCredentials:F="same-origin",fetchOptions:re}=zs(T),K=l||fetch;V=V?(V+"").toLowerCase():"text";let ee=pd([D,M&&M.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 ae=new i(v,{method:"POST",body:P,duplex:"half"}),oe;if(te.isFormData(P)&&(oe=ae.headers.get("content-type"))&&L.setContentType(oe),ae.body){const[xe,_e]=Ls(N,gi(Fs(Z)));P=Hs(ae.body,Gs,xe,_e)}}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(v,$);let q=await(f?K(G,re):K(v,$));const J=C&&(V==="stream"||V==="response");if(C&&(H||J&&W)){const ae={};["status","statusText","headers"].forEach(Pe=>{ae[Pe]=q[Pe]});const oe=te.toFiniteNumber(q.headers.get("content-length")),[xe,_e]=H&&Ls(oe,gi(Fs(H),!0))||[];q=new o(Hs(q.body,Gs,xe,()=>{_e&&_e(),W&&W()}),ae)}V=V||"text";let le=await y[te.findKey(y,V)||"text"](q,T);return!J&&W&&W(),await new Promise((ae,oe)=>{Ps(ae,oe,{data:le,headers:Jt.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 Le("Network Error",Le.ERR_NETWORK,T,G),{cause:X.cause||X}):Le.from(X,X&&X.code,T,G)}}},yd=new Map,js=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};js();const oo={http:Wc,xhr:gd,fetch:{get:js}};te.forEach(oo,(a,l)=>{if(a){try{Object.defineProperty(a,"name",{value:l})}catch{}Object.defineProperty(a,"adapterName",{value:l})}});const qs=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 Le(`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
- `+m.map(qs).join(`
5
- `):" "+qs(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 Zs={getAdapter:Ad,adapters:oo};function so(a){if(a.cancelToken&&a.cancelToken.throwIfRequested(),a.signal&&a.signal.aborted)throw new xr(null,a)}function Ys(a){return so(a),a.headers=Jt.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),Zs.getAdapter(a.adapter||zr.adapter,a)(a).then(function(o){return so(a),o.data=io.call(a,a.transformResponse,o),o.headers=Jt.from(o.headers),o},function(o){return vs(o)||(so(a),o&&o.response&&(o.response.data=io.call(a,a.transformResponse,o.response),o.response.headers=Jt.from(o.response.headers))),Promise.reject(o)})}const Ks="1.13.2",xi={};["object","boolean","number","function","string","symbol"].forEach((a,l)=>{xi[a]=function(o){return typeof o===a||"a"+(l<1?"n ":" ")+a}});const Qs={};xi.transitional=function(l,i,o){function u(f,m){return"[Axios v"+Ks+"] Transitional option '"+f+"'"+m+(o?". "+o:"")}return(f,m,p)=>{if(l===!1)throw new Le(u(m," has been removed"+(i?" in "+i:"")),Le.ERR_DEPRECATED);return i&&!Qs[m]&&(Qs[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}},xi.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 Le("options must be an object",Le.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 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 _i={assertOptions:Sd,validators:xi},Nn=_i.validators;let Jn=class{constructor(l){this.defaults=l||{},this.interceptors={request:new Bs,response:new Bs}}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=Qn(this.defaults,i);const{transitional:o,paramsSerializer:u,headers:f}=i;o!==void 0&&_i.assertOptions(o,{silentJSONParsing:Nn.transitional(Nn.boolean),forcedJSONParsing:Nn.transitional(Nn.boolean),clarifyTimeoutError:Nn.transitional(Nn.boolean)},!1),u!=null&&(te.isFunction(u)?i.paramsSerializer={serialize:u}:_i.assertOptions(u,{encode:Nn.function,serialize:Nn.function},!0)),i.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?i.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:i.allowAbsoluteUrls=!0),_i.assertOptions(i,{baseUrl:Nn.spelling("baseURL"),withXsrfToken:Nn.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=Jt.concat(m,f);const p=[];let _=!0;this.interceptors.request.forEach(function(v){typeof v.runWhen=="function"&&v.runWhen(i)===!1||(_=_&&v.synchronous,p.unshift(v.fulfilled,v.rejected))});const x=[];this.interceptors.response.forEach(function(v){x.push(v.fulfilled,v.rejected)});let C,y=0,I;if(!_){const T=[Ys.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++],v=p[y++];try{B=T(B)}catch(k){v.call(this,k);break}}try{C=Ys.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=Qn(this.defaults,l);const i=Vs(l.baseURL,l.url,l.allowAbsoluteUrls);return Rs(i,l.params,l.paramsSerializer)}};te.forEach(["delete","get","head","options"],function(l){Jn.prototype[l]=function(i,o){return this.request(Qn(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(Qn(p||{},{method:l,headers:o?{"Content-Type":"multipart/form-data"}:{},url:f,data:m}))}}Jn.prototype[l]=i(),Jn.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 xr(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 Js(a){const l=new Jn(a),i=gs(Jn.prototype.request,l);return te.extend(i,Jn.prototype,l,{allOwnKeys:!0}),te.extend(i,l,null,{allOwnKeys:!0}),i.create=function(u){return Js(Qn(a,u))},i}const Ye=Js(zr);Ye.Axios=Jn,Ye.CanceledError=xr,Ye.CancelToken=Id,Ye.isCancel=vs,Ye.VERSION=Ks,Ye.toFormData=hi,Ye.AxiosError=Le,Ye.Cancel=Ye.CanceledError,Ye.all=function(l){return Promise.all(l)},Ye.spread=Nd,Ye.isAxiosError=Td,Ye.mergeConfig=Qn,Ye.AxiosHeaders=Jt,Ye.formToJSON=a=>Ms(te.isHTMLForm(a)?new FormData(a):a),Ye.getAdapter=Zs.getAdapter,Ye.HttpStatusCode=ao,Ye.default=Ye;const{Axios:_p,AxiosError:wp,CanceledError:Cp,isCancel:Ep,CancelToken:yp,VERSION:bp,all:Ap,Cancel:Sp,isAxiosError:Ip,spread:Np,toFormData:Tp,AxiosHeaders:kp,HttpStatusCode:Rp,formToJSON:Bp,getAdapter:Op,mergeConfig:Mp}=Ye,Gr=we.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"],Ln=we.defineStore("table-data",()=>{const a=Ne.useRoute(),l=Ne.useRouter(),i=lt(),o=Gr(),u=r.ref(1),f=r.ref(1),m=pt.useLocalStorage("appMode",null,{shallow:!0}),p=pt.useLocalStorage("tableData",null,{shallow:!0,serializer:pt.StorageSerializers.object}),_=pt.useLocalStorage("tableId",null),x=pt.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 v=null;const k=pt.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 Ye.get(`/org_unit/${I.value}/table/${re}/`,{baseURL:`https://${i.config_lib.area}/api/`,signal:F.signal})).data,__v:u.value}}catch(W){return Ye.isCancel(W)?null:m.value==="table-tent"?p.value:re===(v==null?void 0:v.id)?v:(v=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=pt.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 Ye.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 D=null;const M=L=>{D&&(D==null||D.close(),D=null),L&&(D=Lr(`wss://${i.config_lib.area}/ws/order/${L.id}/`),D.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())}),D.connect())},j=()=>{u.value++},H=()=>{f.value++},Z=L=>{L&&(v=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)&&M(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 Tn=null,Zt=null;function er(a){a&&a.close(!0)}async function lo(a,l){const i=vt(),o=lt(),u=bn.create();try{const f=await u.initPaymentLink(a,l);return i.paymentCostQR=o.totalPrice_lib-o.countBonus,i.linkQR=f.url,Zt==null||Zt.deleteCart(null,Zt==null?void 0:Zt.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=At();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),gn(l,null),uo(l);return}i(a,l)}}function co(a,l){const i=vt(),o=lt();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 gn=(a,l)=>{a.updateOrderStatus&&a.updateOrderStatus(l)},Md=a=>{a.loadCart&&a.loadCart()},wi=a=>{a.resetBonuses&&a.resetBonuses()},Dd=a=>{a.resetDiscounts&&a.resetDiscounts()},uo=a=>{a.closeWebSocket&&a.closeWebSocket()},ea=(a,l,i,o)=>{var m;if(((m=a.params)==null?void 0:m.need_pay)===!1)return;const u=l.ws||i;bn.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:()=>er(u)})})},fo=(a,l,i)=>{const o=a.ws||l;(a.errorHandler||i).handleOrderError({...a,closeWebSocket:()=>er(o)})},vd=(a,l,i)=>{const o=vt(),u=o.getCurrentPaymentMethodId();if(!u||!Fn.getConfig(u)||!Fn.isMethodAvailable(u,a))return null;const m=Fn.createHandler(u);if(!m)return null;const p=o.createPaymentHandler(a,l,u,i);return p?{handler:m,config:p.config}:null},Pd=a=>{if(!Zt)return;const l=Zt.context,i=Zt.is_requestKiosk,o=vd(l,i,Zt.locator);if(!o){console.warn("handleWebSocketMessageWithDynamicHandler: не удалось получить handler");return}const{handler:u,config:f}=o,m={...f,...Zt};Od(a,m,u.handleWebSocketStatus)};async function Ld(a,l,i){var x,C;const o=Ln(),{is_requestKiosk:u}=l,{comment:f,is_authorized:m,signal:p}=i;l.setButtonDisabled(!0);const _=bn.create();try{const y=await _.createOrder(a,o.id,u,f,m,p,l.locator);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};Zt=B;const v=`wss://${B.area||""}/ws/order/${I}/`;Tn=Lr(v,{signal:p});const k=()=>{console.warn("WebSocket connection opened (centralized mode)")},P=M=>{var j;console.error("WebSocket error (centralized mode):",M),er(Tn),Tn=null,Zt=null,l.setButtonDisabled(!1),(j=l.errorHandler)==null||j.handlePaymentError(M,B)},D=M=>{Pd(M)};Tn.on("open",k),Tn.on("message",D),Tn.on("error",P),Tn.connect(),Zt.ws=Tn,Zt.closeWebSocket=()=>{er(Tn),Tn=null,Zt=null}}return y}catch(y){throw Ye.isCancel(y)||((C=l.errorHandler)==null||C.handleCreateOrderError(y,l),l.setButtonDisabled(!1)),y}}const ta=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 Ci(){const a=vt(),l=Ln();return{handlePaymentError(i,o){var f,m,p,_,x,C;const u=ta(i);gn(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():(wi(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"&&(wi(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=ta(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)),gn(o,null)):(wi(o),o.navigation?o.navigation.redirectToError():o.redirect&&o.redirect(`/${((_=(p=o.route)==null?void 0:p.params)==null?void 0:_.orgId)||""}/errorPayment`),gn(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)):(wi(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=vt();let l=null;const i=Ci(),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")gn(f,1);else if(m==="payment_initiation_retry"||m==="fiscalized")ea(u,f,l,i);else if(m==="payment_initiation")gn(f,2);else if(m==="paid"){gn(f,3);const y=f.ws||l;er(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=vt();let l=null;const i=Ci(),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")gn(f,1);else if(m==="waiting_payment")gn(f,4);else if(m==="paid"){gn(f,3);const y=f.ws||l;er(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=vt();let l=null;const i=Ci(),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")ea(u,f,l,i);else if(m==="payment_initiation")gn(f,2);else if(m==="paid"){gn(f,3);const x=f.ws||l;er(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 Fn{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)}}ke(Fn,"methods",new Map),Fn.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 vt=we.defineStore("cartLib",()=>{const a=Ne.useRouter(),l=Ne.useRoute(),i=At(),o=lt(),{config_lib:u,countBonus:f,totalPrice_lib:m,initialCartPrice_lib:p,is18Allowed:_}=we.storeToRefs(o),{itemThemes:x}=we.storeToRefs(i),C=r.ref(!1),y=r.ref(""),I=r.ref(null),B=r.ref("wait"),T=r.ref(!0),v=r.ref(0),k=r.ref(""),P=r.ref([]),D=r.ref([]),M=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:ye=>{(ye==null?void 0:ye.length)===1&&(F.value=ye[0]),P.value=ye}}),K=r.ref(!1),ee=r.ref(null),G=r.ref(0),W=r.ref(!1),N=r.ref({textNotification:""}),X=ye=>{W.value=!0,N.value.textNotification=ye},$=()=>{var ye,Ke;return(ye=M.value)!=null&&ye.front_type?M.value.front_type:((Ke=D.value[0])==null?void 0:Ke.front_type)||null},q=(ye,Ke,ct,et)=>{var Be;const _t=ct??((Be=D.value[0])==null?void 0:Be.front_type);if(!_t)return console.warn("Не удалось определить метод оплаты"),null;const De=Fn.getConfig(_t);if(!De||!Fn.isMethodAvailable(_t,ye))return console.warn(`Метод ${_t} недоступен для контекста ${ye}`),null;const Ae=Fn.createHandler(_t);return Ae?(Z.value=J(De.method,ye,Ke,et),{handler:Ae,config:Z.value}):(console.warn(`Не удалось создать обработчик для метода ${_t}`),null)},J=(ye,Ke,ct,et)=>{const _t={method:ye,context:Ke,is_requestKiosk:ct,router:a,route:l,orderErrors:L.value,area:u.value.area,totalPrice:m,initialCartPrice:p,locator:et,showNotification:X,deleteCart:qe,resetStores:he,redirect:rt=>a.push(rt),updateOrderStatus:rt=>{ee.value=rt},setOrderNumber:rt=>{V.value=rt},loadCart:()=>o.loadCart(),resetBonuses:()=>{f.value=0}},De=Ci(),Ae=zd(_t),Be=Hd(_t);return{..._t,errorHandler:De,cartCleanup:Ae,navigation:Be}},le=r.computed(()=>!!I.value),ae=ye=>{B.value=ye},oe=ye=>{I.value=ye},xe=()=>{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=""},_e=()=>{C.value=!1,B.value="wait",y.value=""},Pe=()=>{I.value=null,y.value="",B.value="wait",_e()},he=()=>{K.value=!1,ee.value=null},qe=(ye=null,Ke=!1)=>{o.cartProducts_lib=[],o.is_OpenLoyal=!1,mr(["cart"]),Ke&&(mr(["authTokensAccess","authTokensRefresh","user"]),o.profile=null,sessionStorage.removeItem("is_adult"),_.value=!1),ye&&a.push(`/${l.params.orgId}/${ye}`)};return{isButtonDisabled:K,orderCompleted_lib:ee,extraDiscount:v,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:D,is_paymentCart:H,selectedOrderType:F,selectedProvider:M,configPayment:Z,paymentCostQR:j,deleteCart:qe,setGuestInfo:oe,setState:ae,openDrawer:xe,closeDrawer:_e,clearCard:Pe,showNotification:X,createPaymentHandler:q,getCurrentPaymentMethodId:$,getAvailablePaymentMethods:ye=>Fn.getAvailableMethods(ye)}}),Ut=we.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=At(),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=hr(N)||0,$=N.amount||1;return(i.value.groupModifiersSelected.reduce((J,le)=>(le.modifiers.forEach(ae=>{var oe,xe;ae.sizes&&(ae.price=((xe=(oe=ae.sizes)==null?void 0:oe.find(_e=>_e.id===i.value.selectedSize.id))==null?void 0:xe.price)??ae.price),J+=ae.price*ae.amount}),J),0)+X)*$+G}return(W=i.value.addedProducts)!=null&&W.length?G:0}),v=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]}}),D=()=>{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))})})},M=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,xe)=>oe+=xe.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,xe)=>oe+=xe.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:v,setProduct:H,summModifierAmount:I,setAddedProducts:M,setCurrentCard:j,minusAmount:V,plusAmount:L,toggleNotRequire:Z,modifierSelect:re,defaultAmountModifiers:D,validateGroup:k,reset:o}});var _r=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function na(a){return a&&a.__esModule&&Object.prototype.hasOwnProperty.call(a,"default")?a.default:a}var ra={exports:{}};(function(a,l){(function(i,o){a.exports=o()})(_r,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",v="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,D={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])+"]"}},M=function(W,N,X){var $=String(W);return!$||$.length>=N?W:""+Array(N+1-$.length).join(X)+W},j={s:M,z:function(W){var N=-W.utcOffset(),X=Math.abs(N),$=Math.floor(X/60),q=X%60;return(N<=0?"+":"-")+M($,2,"0")+":"+M(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]=D;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 ae=N.name;Z[ae]=N,q=ae}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 ae=le[2]-1||0,oe=(le[7]||"0").substring(0,3);return J?new Date(Date.UTC(le[1],ae,le[3]||1,le[4]||0,le[5]||0,le[6]||0,oe)):new Date(le[1],ae,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()!==v},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),ae=function(Ke,ct){var et=K.w(q.$u?Date.UTC(q.$y,ct,Ke):new Date(q.$y,ct,Ke),q);return J?et:et.endOf(x)},oe=function(Ke,ct){return K.w(q.toDate()[Ke].apply(q.toDate("s"),(J?[0,0,0,0]:[23,59,59,999]).slice(ct)),q)},xe=this.$W,_e=this.$M,Pe=this.$D,he="set"+(this.$u?"UTC":"");switch(le){case B:return J?ae(1,0):ae(31,11);case y:return J?ae(1,_e):ae(0,_e+1);case C:var qe=this.$locale().weekStart||0,ye=(xe<qe?xe+7:xe)-qe;return ae(J?Pe-ye:Pe+(6-ye),_e);case x:case T:return oe(he+"Hours",0);case _:return oe(he+"Minutes",1);case p:return oe(he+"Seconds",2);case m:return oe(he+"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":""),ae=(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 xe=this.clone().set(T,1);xe.$d[ae](oe),xe.init(),this.$d=xe.set(T,Math.min(this.$D,xe.daysInMonth())).$d}else ae&&this.$d[ae](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($),ae=function(_e){var Pe=re(J);return K.w(Pe.date(Pe.date()+Math.round(_e*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 ae(1);if(le===C)return ae(7);var oe=(q={},q[p]=o,q[_]=u,q[m]=i,q)[le]||1,xe=this.$d.getTime()+X*oe;return K.w(xe,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||v;var J=X||"YYYY-MM-DDTHH:mm:ssZ",le=K.z(this),ae=this.$H,oe=this.$m,xe=this.$M,_e=q.weekdays,Pe=q.months,he=q.meridiem,qe=function(ct,et,_t,De){return ct&&(ct[et]||ct($,J))||_t[et].slice(0,De)},ye=function(ct){return K.s(ae%12||12,ct,"0")},Ke=he||function(ct,et,_t){var De=ct<12?"AM":"PM";return _t?De.toLowerCase():De};return J.replace(P,function(ct,et){return et||function(_t){switch(_t){case"YY":return String($.$y).slice(-2);case"YYYY":return K.s($.$y,4,"0");case"M":return xe+1;case"MM":return K.s(xe+1,2,"0");case"MMM":return qe(q.monthsShort,xe,Pe,3);case"MMMM":return qe(Pe,xe);case"D":return $.$D;case"DD":return K.s($.$D,2,"0");case"d":return String($.$W);case"dd":return qe(q.weekdaysMin,$.$W,_e,2);case"ddd":return qe(q.weekdaysShort,$.$W,_e,3);case"dddd":return _e[$.$W];case"H":return String(ae);case"HH":return K.s(ae,2,"0");case"h":return ye(1);case"hh":return ye(2);case"a":return Ke(ae,oe,!0);case"A":return Ke(ae,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}(ct)||le.replace(":","")})},N.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},N.diff=function(X,$,q){var J,le=this,ae=K.p($),oe=re(X),xe=(oe.utcOffset()-this.utcOffset())*o,_e=this-oe,Pe=function(){return K.m(le,oe)};switch(ae){case B:J=Pe()/12;break;case y:J=Pe();break;case I:J=Pe()/3;break;case C:J=(_e-xe)/6048e5;break;case x:J=(_e-xe)/864e5;break;case _:J=_e/u;break;case p:J=_e/o;break;case m:J=_e/i;break;default:J=_e}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})})(ra);var Gd=ra.exports;const ia=na(Gd),Wd=a=>{const l=Ne.useRouter(),i=`${a.domain}/api/`,o=Ye.create({baseURL:i}),u=Ye.create({baseURL:i}),f=Ye.create({baseURL:i}),m=Ye.create({baseURL:i}),p=Ye.create({baseURL:i}),_=Ye.create({baseURL:i}),x=Ye.create({baseURL:i}),C=D=>{try{const M=JSON.parse(localStorage.getItem("authTokensAccess")||"");M.length>0&&(D.headers.Authorization=`Bearer ${M}`)}catch{console.warn("accessToken is undefined [useAxios]")}return D},y=D=>{const M=localStorage.getItem("apiKey");return D.headers={"Content-Type":"application/json","x-api-key":M},D},I=async D=>{if(!a.user)return D;const M=a.user.exp??0;if(!(ia.unix(M).diff(ia())<3e3))return D;const H=ms("authTokensRefresh",null,"string");try{const Z=await Ye.post(`${i}user/token/refresh/`,{refresh:H.value});if(!Z.data.access)return P(),D;localStorage.setItem("authTokensAccess",JSON.stringify(Z.data.access)),v(Z.data),k(hs(Z.data.access)),D.headers={...D.headers,Authorization:`Bearer ${Z.data.access}`}}catch(Z){console.error("Failed to refresh token:",Z),P()}return D},B=D=>{D.interceptors.request.use(M=>I(C(M)),M=>Promise.reject(M))};B(f),B(p),B(x);const T=D=>{D.interceptors.request.use(M=>y(M))};T(_),T(u),T(x);const v=(D,M=!1)=>{localStorage.setItem("authTokensAccess",JSON.stringify(D.access)),M&&localStorage.setItem("authTokensRefresh",JSON.stringify(D.refresh))},k=D=>{a.user=D,localStorage.setItem("user",JSON.stringify(D))},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:o,axiosInstanceGetApiKey:u,axiosInstancePostApiKey:_}},oa=(a="themeConfig")=>{try{const l=localStorage.getItem(a);return l?JSON.parse(l):null}catch{return null}},He=class He{constructor(){ke(this,"axiosInstanceGet");ke(this,"axiosInstancePost");ke(this,"axiosInstanceAuthenticationGet");ke(this,"axiosInstanceAuthenticationPost");ke(this,"axiosInstanceGetApiKey");ke(this,"axiosInstancePostApiKey");ke(this,"axiosInstanceAuthenticationPostApiKey");ke(this,"currentUpsaleController",null);ke(this,"controller",new AbortController);this.axiosInstanceGet=He._axiosGet,this.axiosInstancePost=He._axiosPost,this.axiosInstanceGetApiKey=He._axiosPostApiKey,this.axiosInstancePostApiKey=He._axiosPostApiKey,this.axiosInstanceAuthenticationPostApiKey=He._axiosAuthPostApiKey,this.axiosInstanceAuthenticationGet=He._axiosAuthGet,this.axiosInstanceAuthenticationPost=He._axiosAuthPost}static create(l){return l&&!He._config&&He._initialize(l),He._config||console.warn("InitConnection не инициализирован"),new He}static _initialize(l,i=null){const o=lt(),u=Ut(),{config_lib:f}=we.storeToRefs(o),{stateCard:m,recountGroupTotalAmount:p}=we.storeToRefs(u);He._config=l,He._cardStore=u,He._stateCard=m,He._recountGroupTotalAmount=p,f.value=l;const _=Wd(l);He._axiosPostApiKey=_.axiosInstanceGetApiKey,He._axiosPostApiKey=_.axiosInstancePostApiKey,He._axiosAuthPostApiKey=_.axiosInstanceAuthenticationPostApiKey,He._axiosGet=_.axiosInstanceGet,He._axiosPost=_.axiosInstancePost,He._axiosAuthGet=_.axiosInstanceAuthenticationGet,He._axiosAuthPost=_.axiosInstanceAuthenticationPost}get config(){return He._config}get cardStore(){return He._cardStore}get stateCard(){return He._stateCard}get recountGroupTotalAmount(){return He._recountGroupTotalAmount}async updateTheme(){var f,m;const l=oa(),i=At();if(l!==null){i.updateColor(l);return}const o=lt(),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 Dr(_.id,_),p.push(_);const x=await this.loadGroupProducts(_.id);_.products=x}return await this.cacheImagesInBackground(m),await Dr(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 fr(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=lt(),{config_lib:o}=we.storeToRefs(i);try{let f=await is(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=Ut();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,p){var v,k,P,D,M;const _=vt(),x=f?this.axiosInstanceAuthenticationPostApiKey:this.axiosInstancePostApiKey,C=o?x:this.axiosInstanceAuthenticationPost,y=o?"/device/order/create":"/order/create",I=o?(v=this.config)==null?void 0:v.pointId:(k=this.config)==null?void 0:k.pointId,B={items:l,comment:u,locator:p||void 0};return i&&(B.table=i),o&&((P=_.selectedOrderType)!=null&&P.id)&&(B.order_type_id=(D=_.selectedOrderType)==null?void 0:D.id),await(C==null?void 0:C.post(`${(M=this.config)==null?void 0:M.domain}/api/org_unit/${I}${y}`,B,{signal:m}))}async extendOrder(l){var m,p;const i=Ln();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=lt(),f=Ln(),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=lt();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=lt(),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=vt(),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=Ut(),{dataUpSale:o}=we.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)}}};ke(He,"_config",null),ke(He,"_axiosGet"),ke(He,"_axiosGetApiKey"),ke(He,"_axiosPostApiKey"),ke(He,"_axiosAuthPostApiKey"),ke(He,"_axiosPost"),ke(He,"_axiosAuthGet"),ke(He,"_axiosAuthPost"),ke(He,"_cardStore",null),ke(He,"_stateCard",null),ke(He,"_recountGroupTotalAmount",null);let bn=He;const sa=r.ref(!1),zn=()=>{const{width:a}=pt.useWindowSize(),l=r.computed(()=>sa.value),i=r.computed(()=>l.value&&a.value>1024);return{isDesktop:l,shouldUseDragScroll:i,syncWithRoute:u=>{var f;sa.value=((f=u.query)==null?void 0:f.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=lt(),u=r.ref(null),{isDesktop:f}=zn(),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"]]),Wr={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)},v=P=>{if(!l)return;const D=P.pageX,M=P.pageY,j=Math.abs(D-i),H=Math.abs(M-o);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=(D-x)/V*16,_=(M-C)/V*16),x=D,C=M,y=Z;const L=D-a.offsetLeft,F=M-a.offsetTop,re=L-i,K=F-o;a.scrollLeft=u-re,a.scrollTop=f-K}else x=D,C=M,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 D=()=>{a.scrollLeft-=p,a.scrollTop-=_,p*=.95,_*=.95,Math.abs(p)>.1||Math.abs(_)>.1?m=requestAnimationFrame(D):m=0};m=requestAnimationFrame(D)}}else a.style.pointerEvents="";l=!1,I=!1}};a.addEventListener("mousedown",T),window.addEventListener("mousemove",v),window.addEventListener("mouseup",k),a._dragScrollCleanup=()=>{m&&cancelAnimationFrame(m),a.removeEventListener("mousedown",T),window.removeEventListener("mousemove",v),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 Ei=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=Ut(),i=At(),{stateCard:o}=we.storeToRefs(l),{itemThemes:u}=we.storeToRefs(i),{shouldUseDragScroll:f}=zn(),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 v;if(!B)return;await r.nextTick();const T=m.value.find(k=>k.id==="scrolling"+B);T&&((v=x.value)==null||v.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:v})=>[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(r.unref(o).groupModifiers,(k,P)=>{var D,M;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),v(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===((D=r.unref(o).groupCurrentOpen)==null?void 0:D.id)&&a.isSectionModifier},"modified_plus_active"])},[r.createVNode(Ei,{"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===((M=r.unref(o).groupCurrentOpen)==null?void 0:M.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"],mo=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 wr=We(su,[["render",lu]]),Cr={mounted(a){a.muted=!0,a.setAttribute("muted","")}},cu=["disabled","id"],cn=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"},yi=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=At(),o=lt(),{is18Allowed:u,notificationData_lib:f}=we.storeToRefs(o),{itemThemes:m}=we.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,v,k],[P,D])=>{x&&(!T||T!==P||v!==D)&&clearTimeout(x),k&&T&&(x=setTimeout(B,4e3))},{immediate:!0}),r.onUnmounted(()=>{x&&B()}),(T,v)=>(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,[v[0]||(v[0]=r.createElementVNode("label",{for:"plus18"},"Содержащиеся в настоящем разделе материалы предназначены для лиц старше 18 лет, носят информационный характер об ассортименте товаров и не являются рекламой. ",-1)),r.createVNode(cn,{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(cn,{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=At(),u=Ut(),{itemThemes:f}=we.storeToRefs(o),{stateCard:m,recountGroupTotalAmount:p,groupTotalAmount:_,isLastGroup:x}=we.storeToRefs(u),{isDesktop:C,shouldUseDragScroll:y}=zn(),I=r.ref(null),B=pt.useTemplateRefsList(),T=r.ref(!1),v=D=>{if(!D)return;const M=m.value.groupModifiers.findIndex(L=>L.id===m.value.groupCurrentOpen.id),j=m.value.plusButtonsRefs[M]||m.value.plusButtonsRefs[0];if(!j)return;const H=D.getBoundingClientRect(),Z=j.getBoundingClientRect(),V=D.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 D=m.value.groupCurrentOpen;if(!D)return;const M=m.value.groupModifiers.findIndex(H=>H.id===D.id),j=u.validateGroup(M);if(!j.valid){m.value.textErrorRequaired=j.errorText,T.value=!0;return}x.value?i("add-to-cart"):u.toggleNotRequire(D,void 0,!0)};r.watch(()=>m.value.isAnimationFly,D=>{D===!0&&m.value.currentModifier&&(v(B.value.find(M=>M.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(D,M)=>{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(yi,{visible:T.value,textNotificationDefault:r.unref(m).textErrorRequaired,backgroundColor:r.unref(f).accent_color?r.unref(f).accent_color:"#FF6D2E","onUpdate:visible":M[0]||(M[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:M[1]||(M[1]=q=>i("close"))},[r.createVNode(wr,{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),M[4]||(M[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),M[5]||(M[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),M[6]||(M[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),M[7]||(M[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:M[2]||(M[2]=q=>i("close"))},[r.createVNode(mo,{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,ae;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 xe;return oe.group===((xe=r.unref(m).groupCurrentOpen)==null?void 0:xe.id)&&oe.modifiers.some(_e=>_e.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(Cr)]]):(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(((ae=(le=q.sizes)==null?void 0:le.find(oe=>oe.id===r.unref(m).selectedSize.id))==null?void 0:ae.price)||q.price||0)+"₽",1)],2)])],2)],14,Tu)}),128))],2)),[[r.unref(Wr),($=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:M[3]||(M[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"],go=3,Hu=We(r.defineComponent({__name:"SizeModifier",setup(a){const l=Ut(),{stateCard:i}=we.storeToRefs(l),{width:o}=pt.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,go)}),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 D;if(i.value.productSizes.length<4)return i.value.productSizes[f.value.index]||i.value.productSizes[0];const k=m.value+1,P=((D=y.value[k])==null?void 0:D.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,D)=>({...P,originalIndex:D})),...k.map((P,D)=>({...P,originalIndex:D})),...k.map((P,D)=>({...P,originalIndex:D}))]}),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 D=m.value+1;P<D?B():P>D&&T()}else{const D=i.value.productSizes.length,M=P*(100/D);u.value=M}},B=()=>{var k;if(!(i.value.productSizes.length<4)){if(m.value--,m.value<i.value.productSizes.length-go+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")}v()}},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")}v()}},v=()=>{var M;if(i.value.productSizes.length<4)return;const k=m.value+1,P=((M=y.value[k])==null?void 0:M.originalIndex)??0,D=i.value.productSizes[P];f.value={id:D.id,title:D.name,index:P,is_default:D.is_default}};return r.watch([()=>i.value.productSizes,p],([k=[],P])=>{if(Array.isArray(k)&&k.length>0){let D=k.findIndex(M=>M.is_default===!0);D>-1?(m.value=D,I(k[D],D)):k.length>go?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 D=P.map(M=>({...M,modifiers:M.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(D)!==JSON.stringify(i.value.groupModifiersSelected)&&(i.value.groupModifiersSelected=D)},{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,(D,M)=>(r.openBlock(),r.createElementBlock("li",{key:`${D.id}-${M}`,onClick:j=>I(D,M),class:r.normalizeClass({active:f.value.id===D.id&&f.value.index===D.originalIndex}),tabindex:"0",role:"button","aria-label":`Выбрать размер ${D.name}`},[r.createElementVNode("p",null,r.toDisplayString(D.alt_name?D.alt_name:D.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,(D,M)=>(r.openBlock(),r.createElementBlock("li",{key:`${D.id}-${M}`,onClick:j=>I(D,M),class:r.normalizeClass({active:f.value.id===D.id&&f.value.index===M}),tabindex:"0",role:"button"},[r.createElementVNode("p",null,r.toDisplayString(D.alt_name?D.alt_name:D.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-75aa7dcd"]]),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=Ut(),{stateCard:i}=we.storeToRefs(l),o=Ne.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 po(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 mt=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}=po(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=Ne.useRouter(),o=Ne.useRoute(),u=Ut(),f=lt(),m=At(),p=a,{stateCard:_,totalPrice_libCard:x,isOpenWindow:C,isAddToCard:y}=we.storeToRefs(u),{isDesktop:I}=zn(),{itemThemes:B}=we.storeToRefs(m),T=r.ref(!0),v=r.ref(!1),k=r.computed(()=>I.value?!1:T.value),P=r.ref([]),D=r.ref([]),M=()=>{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),v.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=[],D.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&&D.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:D.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:M}),(j,H)=>(r.openBlock(),r.createElementBlock(r.Fragment,null,[(r.openBlock(),r.createBlock(r.Teleport,{to:"body"},[r.createVNode(yi,{visible:v.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=>v.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:M,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(mt,{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=Ut(),i=At(),{itemThemes:o}=we.storeToRefs(i),{stateCard:u}=we.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(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(Ei,{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(cn,{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),la=(a,l,i)=>l===0||Math.abs(l)===1/0?u0(a,i):a*l*i/(l+i*a),bi=(a,l)=>l*parseFloat(a)/100,xo=(a,l,i,o=.15)=>o===0?d0(a,l,i):a<l?-la(l-a,i-l,o)+l:a>i?+la(a-i,i-l,o)+i:a,dn=(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"?bi(_,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 _o=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),_=pt.useVModel(o,"modelValue",u,{passive:!0});r.watch(_,Ae=>{Ae?oe():xe||_e()}),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:v}=pt.useWindowSize(),{height:k}=pt.useElementBounding(x),{height:P}=pt.useElementBounding(C),{height:D}=pt.useElementBounding(B),{height:M}=pt.useElementBounding(y),j=r.computed({get(){return dn(Math.ceil(D.value+P.value+M.value),{max:v.value})},set(Ae){[P.value,D.value,M.value]=Ae}}),H=r.ref(0),Z=r.ref(0),V=Dt.useMotionValue(0),L=Dt.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,v);let X;function $(Ae){T.value=!0,q(Ae)}function q(Ae){T.value&&Ae.preventDefault()}const J=Ae=>{Ae.key==="Escape"&&_e()},le=()=>{o.canBackdropClose&&_e()};let ae=!1;const oe=async()=>{var Ae;if(!ae){xe&&(xe=!1,f&&(clearTimeout(f),f=null)),m.value++,_.value=!0,ae=!0,u("opening-started");try{await r.nextTick(),await r.nextTick();const Be=(Ae=x.value)==null?void 0:Ae.$el;if(!Be){console.warn("[BottomSheet] sheet not ready, aborting"),_.value=!1;return}k.value=Be.getBoundingClientRect().height;const rt=Be.querySelector("[data-vsbs-content]"),it=Be.querySelector("[data-vsbs-header]"),Je=Be.querySelector("[data-vsbs-footer]");if(j.value=[it.getBoundingClientRect().height,rt.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"?dn(re.value[ve],{max:v.value}):bi(re.value[ve],v.value)}else H.value=dn(W.value,{max:v.value});Z.value=H.value,V.jump(H.value),L.jump(H.value),requestAnimationFrame(()=>{X=Dt.animate(V,H.value,{duration:o.duration/1e3,ease:"easeInOut"}),X=Dt.animate(L,0,{duration:o.duration/1e3,ease:"easeInOut",onComplete:()=>{o.blocking&&u("opened")}})}),window.addEventListener("keydown",J)}finally{ae=!1}}};let xe=!1;const _e=()=>{xe||(ae&&(ae=!1),X&&X.stop(),L.stop(),V.stop(),Dt.animate(L,H.value||500,{duration:o.duration/1e3,ease:"easeInOut"}),p.value=!1,_.value=!1,xe=!0,u("closing-started"),window.removeEventListener("keydown",J),f&&clearTimeout(f),f=setTimeout(()=>{u("closed"),xe=!1,f=null},o.duration))},Pe=Ae=>{if(re.value){if(Ae<0||Ae>=re.value.length){console.warn("Index out of bounds");return}ee.value=Ae,H.value=typeof re.value[Ae]=="number"?dn(re.value[Ae],{max:v.value}):bi(re.value[Ae],v.value),X=Dt.animate(V,H.value,{duration:o.duration/1e3,ease:"easeInOut",onComplete:()=>u("snapped",re.value.indexOf(re.value[Ae]))})}};function he(Ae){Ae>0?u("dragging-down"):Ae<0&&u("dragging-up")}const qe=()=>{p.value=!0,H.value=k.value,Z.value=L.get(),V.jump(H.value),L.jump(Z.value)},ye=async(Ae,Be)=>{await r.nextTick(),x.value&&(Z.value<=0&&(H.value-=Be.delta.y),H.value<=W.value&&(H.value=W.value,Z.value+=Be.delta.y,p.value=!0,L.set(o.canSwipeClose?dn(Z.value,{min:0}):dn(xo(Z.value,-k.value,0,.5),{min:0}))),V.set(dn(xo(H.value,0,N.value,.25),{min:0,max:v.value})),he(Be.delta.y))},Ke=()=>{if(o.canSwipeClose){let Ae=H.value/2;o.swipeCloseThreshold&&typeof o.swipeCloseThreshold=="number"&&(Ae=o.swipeCloseThreshold),o.swipeCloseThreshold&&typeof o.swipeCloseThreshold=="string"&&o.swipeCloseThreshold.includes("%")&&(Ae=H.value*(Number(o.swipeCloseThreshold.replace("%",""))/100)),Math.abs(Z.value)>Ae&&(Z.value=H.value)}else Z.value=0;if(X=Dt.animate(L,Z.value,{duration:o.duration/1e3,ease:"easeInOut"}),Z.value===H.value){Z.value=0,_e();return}ee.value=G.value,H.value=typeof re.value[G.value]=="number"?dn(re.value[G.value],{max:v.value}):bi(re.value[G.value],v.value),X=Dt.animate(V,H.value,{duration:o.duration/1e3,ease:"easeInOut",onComplete:()=>u("snapped",re.value.indexOf(re.value[G.value]))}),X=Dt.animate(L,0,{duration:o.duration/1e3,ease:"easeInOut"})},ct=(Ae,Be)=>{if(H.value=k.value,Z.value=L.get(),X&&X.stop(),!I.value)return;const rt=I.value.scrollTop===0,it=Be.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&&rt&&it&&(T.value=!0),L.get()===0&&rt&&!it&&(T.value=!1)}else{if(!o.expandOnContentDrag)return T.value=!1;p.value=!0,T.value=!0,ve&&(it&&rt&&(T.value=!0),!it&&rt&&(T.value=!1),rt||(T.value=!1))}},et=async(Ae,Be)=>{if(await r.nextTick(),!o.expandOnContentDrag)return T.value=!1;if(!x.value)return;Z.value===0&&T.value&&o.expandOnContentDrag&&(H.value-=Be.delta.y),H.value<=W.value&&(H.value=W.value,T.value&&o.expandOnContentDrag&&(Z.value+=Be.delta.y),Z.value=dn(Z.value,{min:0,max:W.value}),L.set(o.canSwipeClose?dn(Z.value,{min:0}):dn(xo(Z.value,-k.value,0,.5),{min:0}))),H.value>N.value&&(H.value=N.value),H.value=dn(H.value,{max:v.value}),!(K.value.length===1)&&H.value===N.value&&(T.value=!1),V.set(H.value),he(Be.delta.y)},_t=()=>{if(!I.value)return;const Ae=I.value.scrollTop===0;T.value=Ae},De=pt.useDebounceFn(Ae=>Pe(Ae),o.duration);return r.watch(re,(Ae,Be)=>{if(_.value===!1||!Ae||!Be)return;const rt=Ae[ee.value],it=Be[ee.value];typeof rt!="string"&&typeof it!="string"&&(H.value=dn(rt,{max:v.value}),rt!==it&&(X=Dt.animate(V,H.value,{duration:o.duration/1e3,ease:"easeInOut"})))}),r.watch(v,()=>De(ee.value)),l({open:oe,close:_e,snapToPoint:Pe}),r.onUnmounted(()=>{f&&clearTimeout(f)}),(Ae,Be)=>(r.openBlock(),r.createBlock(r.Teleport,{to:a.teleportTo,defer:a.teleportDefer},[r.createElementVNode("div",r.mergeProps(Ae.$attrs,{"data-vsbs-container":""}),[r.createVNode(r.unref(Dt.AnimatePresence),null,{default:r.withCtx(()=>[r.unref(_)&&a.blocking?(r.openBlock(),r.createBlock(r.unref(Dt.Motion),{ref:"backdrop",key:"backdrop-"+m.value,"data-vsbs-backdrop":"",onClick:Be[0]||(Be[0]=rt=>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(Dt.AnimatePresence),null,{default:r.withCtx(()=>[r.unref(_)?(r.openBlock(),r.createBlock(r.unref(Dt.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(Dt.Motion),{ref_key:"sheetHeader",ref:C,"data-vsbs-header":"",onPanStart:qe,onPan:ye,onPanEnd:Ke,onTouchmove:$,class:r.normalizeClass(a.headerClass)},{default:r.withCtx(()=>[r.renderSlot(Ae.$slots,"header",{},void 0,!0)]),_:3},8,["class"]),r.createElementVNode("div",{ref_key:"sheetScroll",ref:I,"data-vsbs-scroll":"",onScrollend:_t},[r.createVNode(r.unref(Dt.Motion),{ref:"sheetContentWrapper","data-vsbs-content-wrapper":"",onPanStart:ct,onPan:et,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(Ae.$slots,"default",{},void 0,!0)],2)]),_:3},512)],544),r.createVNode(r.unref(Dt.Motion),{ref_key:"sheetFooter",ref:y,"data-vsbs-footer":"",onPanStart:qe,onPan:ye,onPanEnd:Ke,onTouchmove:$,class:r.normalizeClass(a.footerClass)},{default:r.withCtx(()=>[r.renderSlot(Ae.$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 An(a,l=null){const i=ai();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=pt.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=At(),i=Ut(),{stateCard:o,isOpenWindow:u,isAddToCard:f}=we.storeToRefs(i),{itemThemes:m}=we.storeToRefs(l),p=Ne.useRouter(),_=Ne.useRoute(),x=a,C=r.computed(()=>!!(_.query.mode==="pdf"&&x.configPage.qr_menu)),{mediaUrl:y}=An(()=>{var P,D;return(P=o.value.openCard)!=null&&P.video_link?`${o.value.openCard.id}_video`:(D=o.value.openCard)!=null&&D.image_link?`${o.value.openCard.id}_image`:null},()=>{var P,D;return((P=o.value.openCard)==null?void 0:P.video_link)||((D=o.value.openCard)==null?void 0:D.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},v=r.ref(null),k=()=>{var P;(P=v.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,D)=>{var M,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(_o),{modelValue:r.unref(o).isSectionModifier,"onUpdate:modelValue":D[0]||(D[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,[(M=r.unref(o).openCard)!=null&&M.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(Cr)]]):(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":"Вернуться назад"}),(j=r.unref(o).openCard)!=null&&j.energy_amount?(r.openBlock(),r.createElementBlock("div",_0,[D[2]||(D[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),D[1]||(D[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:v,qr_menu:a.configPage.qr_menu,closeProduct:a.configPage.closeProduct},null,8,["qr_menu","closeProduct"])])],4)}}}),[["__scopeId","data-v-a84e5942"]]),Ai=we.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"},ca=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"},da=We(r.defineComponent({__name:"CartBox",props:{index:Number,cardItem:Object,isShowModifiers:Boolean},emits:["delete"],setup(a,{emit:l}){const i=a,o=lt(),u=At(),f=Ai(),{itemThemes:m}=we.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}=po(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:v}=An(()=>{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)??hr(i.cardItem)*((re=i.cardItem)==null?void 0:re.amount)}),P=()=>f.open("cart-delete-confirm",i.cardItem),D=()=>{y.value=!y.value},M=()=>{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(v)||"",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:M},"+")])]),r.createElementVNode("div",M0,[r.createElementVNode("div",{class:"cart_box_remove_item",onClick:P},[r.createVNode(mo)]),($=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(D,["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(Ei,{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(D,["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"},ua=r.defineComponent({__name:"CardReader",setup(a){const l=lt(),i=At(),{is_OpenLoyal:o}=we.storeToRefs(l),{itemThemes:u}=we.storeToRefs(i),f=vt(),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}),v=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"),$}),D=r.computed(()=>y.value==="not_found"),M=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 bn;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"]),D.value?(r.openBlock(),r.createBlock(H0,{key:0})):r.createCommentVNode("",!0),r.createElementVNode("div",{class:"overlay check",style:r.normalizeStyle({display:M.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(v.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+",fa="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=vt(),f=Ut(),{selectedProvider:m,isButtonDisabled:p}=we.storeToRefs(u),{isAddToCard:_}=we.storeToRefs(f),x={default:o1,SBP:fa},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(wr)]))}}),[["__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=vt(),o=lt(),u=a,{totalPrice_lib:f,countBonus:m}=we.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(mt,{price:r.unref(f)-r.unref(m),fixedFloat:2},null,8,["price"]),y[1]||(y[1]=r.createTextVNode(" ₽",-1))]),r.createVNode(cn,{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=lt(),i=vt(),o=Ut(),u=At(),{cartProducts_lib:f}=we.storeToRefs(l),{orderNumber:m,orderCompleted_lib:p,selectedOrderType:_}=we.storeToRefs(i),{is_startPage:x}=we.storeToRefs(o),{mediaUrl:C}=An(()=>u.itemThemes.kiosk_preloader?"preloader":null),y=Ne.useRouter(),I=Ne.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=()=>{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(()=>{B&&clearInterval(B)}),(v,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(Cr)]]),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=At(),{mediaUrl:i}=An(()=>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(Cr)]])]),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"]]);/*!
1
+ (function(fe,Ne){typeof exports=="object"&&typeof module<"u"?Ne(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"],Ne):(fe=typeof globalThis<"u"?globalThis:fe||self,Ne(fe.InnoCloudsLib={},fe.VueRouter,fe.Pinia,fe.Vue,fe.VueuseCore,fe.motionV))})(this,function(fe,Ne,we,r,mt,Dt){"use strict";var hp=Object.defineProperty;var ll=fe=>{throw TypeError(fe)};var mp=(fe,Ne,we)=>Ne in fe?hp(fe,Ne,{enumerable:!0,configurable:!0,writable:!0,value:we}):fe[Ne]=we;var ke=(fe,Ne,we)=>mp(fe,typeof Ne!="symbol"?Ne+"":Ne,we),cl=(fe,Ne,we)=>Ne.has(fe)||ll("Cannot "+we);var wn=(fe,Ne,we)=>(cl(fe,Ne,"read from private field"),we?we.call(fe):Ne.get(fe)),Ui=(fe,Ne,we)=>Ne.has(fe)?ll("Cannot add the same private member more than once"):Ne instanceof WeakSet?Ne.add(fe):Ne.set(fe,we),vn=(fe,Ne,we,r)=>(cl(fe,Ne,"write to private field"),r?r.call(fe,we):Ne.set(fe,we),we);var Ko=(fe,Ne,we,r)=>({set _(mt){vn(fe,Ne,mt,we)},get _(){return wn(fe,Ne,r)}});var tn,Hn,ir;function ul(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 fl(a){return a}const hl=[];function ml(){return Ne.createRouter({history:Ne.createWebHistory(),routes:hl})}const zi=(a,l)=>l.some(i=>a instanceof i);let Qo,Jo;function gl(){return Qo||(Qo=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function pl(){return Jo||(Jo=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}const Hi=new WeakMap,Gi=new WeakMap,ii=new WeakMap;function xl(a){const l=new Promise((i,o)=>{const u=()=>{a.removeEventListener("success",f),a.removeEventListener("error",m)},f=()=>{i(Un(a.result)),u()},m=()=>{o(a.error),u()};a.addEventListener("success",f),a.addEventListener("error",m)});return ii.set(l,a),l}function _l(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 Un(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 es(a){Wi=a(Wi)}function wl(a){return pl().includes(a)?function(...l){return a.apply(Xi(this),l),Un(this.request)}:function(...l){return Un(a.apply(Xi(this),l))}}function Cl(a){return typeof a=="function"?wl(a):(a instanceof IDBTransaction&&_l(a),zi(a,gl())?new Proxy(a,Wi):a)}function Un(a){if(a instanceof IDBRequest)return xl(a);if(Gi.has(a))return Gi.get(a);const l=Cl(a);return l!==a&&(Gi.set(a,l),ii.set(l,a)),l}const Xi=a=>ii.get(a);function El(a,l,{blocked:i,upgrade:o,blocking:u,terminated:f}={}){const m=indexedDB.open(a,l),p=Un(m);return o&&m.addEventListener("upgradeneeded",_=>{o(Un(m.result),_.oldVersion,_.newVersion,Un(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 yl(a,{blocked:l}={}){const i=indexedDB.deleteDatabase(a);return l&&i.addEventListener("blocked",o=>l(o.oldVersion,o)),Un(i).then(()=>{})}const bl=["get","getKey","getAll","getAllKeys","count"],Al=["put","add","delete","clear"],$i=new Map;function ts(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=Al.includes(i);if(!(i in(o?IDBIndex:IDBObjectStore).prototype)||!(u||bl.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}es(a=>({...a,get:(l,i,o)=>ts(l,i)||a.get(l,i,o),has:(l,i)=>!!ts(l,i)||a.has(l,i)}));const Sl=["continue","continuePrimaryKey","advance"],ns={},ji=new WeakMap,rs=new WeakMap,Il={get(a,l){if(!Sl.includes(l))return a[l];let i=ns[l];return i||(i=ns[l]=function(...o){ji.set(this,rs.get(this)[l](...o))}),i}};async function*Nl(...a){let l=this;if(l instanceof IDBCursor||(l=await l.openCursor(...a)),!l)return;l=l;const i=new Proxy(l,Il);for(rs.set(i,l),ii.set(i,Xi(l));l;)yield i,l=await(ji.get(i)||l.continue()),ji.delete(i)}function is(a,l){return l===Symbol.asyncIterator&&zi(a,[IDBIndex,IDBObjectStore,IDBCursor])||l==="iterate"&&zi(a,[IDBIndex,IDBObjectStore])}es(a=>({...a,get(l,i,o){return is(l,i)?Nl:a.get(l,i,o)},has(l,i){return is(l,i)||a.has(l,i)}}));let Zn;function Tl(){return El("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 Yn(){if(Zn)try{const a=await Zn;return a.transaction("groups","readonly").commit(),a}catch{Zn=void 0}return Zn=Tl(),Zn}async function qi(a){return(await Yn()).transaction("groups","readonly").objectStore("groups").get(a)}async function Dr(a,l){const o=(await Yn()).transaction("groups","readwrite");await o.objectStore("groups").put({id:a,data:l,timestamp:Date.now()}),await o.done}async function kl(a,l){const i=JSON.parse(JSON.stringify(r.toRaw(l.value)));await Dr(a,i)}async function Zi(a,l){const o=(await Yn()).transaction("media","readwrite");await o.objectStore("media").put({id:a,blob:l,timestamp:Date.now()}),await o.done}async function fr(a){const u=await(await Yn()).transaction("media","readonly").objectStore("media").get(a);return u==null?void 0:u.blob}async function Rl(a){const i=(await Yn()).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 os(a){const u=await(await Yn()).transaction("products","readonly").objectStore("products").get(a);return u==null?void 0:u.product}async function Bl(){const a=Zn;if(Zn=void 0,a){const l=await a.catch(()=>null);l&&l.close()}try{await yl("data",{blocked(){console.warn("Удаление заблокировано. открыты другие вкладки с сайтом.")}})}catch(l){console.error("Не удалось удалить базу: [lib, indexedDB]",l)}}function oi(a){"@babel/helpers - typeof";return oi=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},oi(a)}var Ol=/^\s+/,Ml=/\s+$/;function Se(a,l){if(a=a||"",l=l||{},a instanceof Se)return a;if(!(this instanceof Se))return new Se(a,l);var i=Dl(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}Se.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=us(l),this._roundA=Math.round(100*this._a)/100,this},toHsv:function(){var l=as(this._r,this._g,this._b);return{h:l.h*360,s:l.s,v:l.v,a:this._a}},toHsvString:function(){var l=as(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=ss(this._r,this._g,this._b);return{h:l.h*360,s:l.s,l:l.l,a:this._a}},toHslString:function(){var l=ss(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 ls(this._r,this._g,this._b,l)},toHexString:function(l){return"#"+this.toHex(l)},toHex8:function(l){return Fl(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(yt(this._r,255)*100)+"%",g:Math.round(yt(this._g,255)*100)+"%",b:Math.round(yt(this._b,255)*100)+"%",a:this._a}},toPercentageRgbString:function(){return this._a==1?"rgb("+Math.round(yt(this._r,255)*100)+"%, "+Math.round(yt(this._g,255)*100)+"%, "+Math.round(yt(this._b,255)*100)+"%)":"rgba("+Math.round(yt(this._r,255)*100)+"%, "+Math.round(yt(this._g,255)*100)+"%, "+Math.round(yt(this._b,255)*100)+"%, "+this._roundA+")"},toName:function(){return this._a===0?"transparent":this._a<1?!1:Yl[ls(this._r,this._g,this._b,!0)]||!1},toFilter:function(l){var i="#"+cs(this._r,this._g,this._b,this._a),o=i,u=this._gradientType?"GradientType = 1, ":"";if(l){var f=Se(l);o="#"+cs(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 Se(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(Hl,arguments)},brighten:function(){return this._applyModification(Gl,arguments)},darken:function(){return this._applyModification(Wl,arguments)},desaturate:function(){return this._applyModification(Vl,arguments)},saturate:function(){return this._applyModification(Ul,arguments)},greyscale:function(){return this._applyModification(zl,arguments)},spin:function(){return this._applyModification(Xl,arguments)},_applyCombination:function(l,i){return l.apply(null,[this].concat([].slice.call(i)))},analogous:function(){return this._applyCombination(ql,arguments)},complement:function(){return this._applyCombination($l,arguments)},monochromatic:function(){return this._applyCombination(Zl,arguments)},splitcomplement:function(){return this._applyCombination(jl,arguments)},triad:function(){return this._applyCombination(ds,[3])},tetrad:function(){return this._applyCombination(ds,[4])}},Se.fromRatio=function(a,l){if(oi(a)=="object"){var i={};for(var o in a)a.hasOwnProperty(o)&&(o==="a"?i[o]=a[o]:i[o]=vr(a[o]));a=i}return Se(a,l)};function Dl(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=ec(a)),oi(a)=="object"&&(Pn(a.r)&&Pn(a.g)&&Pn(a.b)?(l=vl(a.r,a.g,a.b),m=!0,p=String(a.r).substr(-1)==="%"?"prgb":"rgb"):Pn(a.h)&&Pn(a.s)&&Pn(a.v)?(o=vr(a.s),u=vr(a.v),l=Ll(a.h,o,u),m=!0,p="hsv"):Pn(a.h)&&Pn(a.s)&&Pn(a.l)&&(o=vr(a.s),f=vr(a.l),l=Pl(a.h,o,f),m=!0,p="hsl"),a.hasOwnProperty("a")&&(i=a.a)),i=us(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 vl(a,l,i){return{r:yt(a,255)*255,g:yt(l,255)*255,b:yt(i,255)*255}}function ss(a,l,i){a=yt(a,255),l=yt(l,255),i=yt(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 Pl(a,l,i){var o,u,f;a=yt(a,360),l=yt(l,100),i=yt(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 as(a,l,i){a=yt(a,255),l=yt(l,255),i=yt(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 Ll(a,l,i){a=yt(a,360)*6,l=yt(l,100),i=yt(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 ls(a,l,i,o){var u=[Cn(Math.round(a).toString(16)),Cn(Math.round(l).toString(16)),Cn(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 Fl(a,l,i,o,u){var f=[Cn(Math.round(a).toString(16)),Cn(Math.round(l).toString(16)),Cn(Math.round(i).toString(16)),Cn(fs(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 cs(a,l,i,o){var u=[Cn(fs(o)),Cn(Math.round(a).toString(16)),Cn(Math.round(l).toString(16)),Cn(Math.round(i).toString(16))];return u.join("")}Se.equals=function(a,l){return!a||!l?!1:Se(a).toRgbString()==Se(l).toRgbString()},Se.random=function(){return Se.fromRatio({r:Math.random(),g:Math.random(),b:Math.random()})};function Vl(a,l){l=l===0?0:l||10;var i=Se(a).toHsl();return i.s-=l/100,i.s=si(i.s),Se(i)}function Ul(a,l){l=l===0?0:l||10;var i=Se(a).toHsl();return i.s+=l/100,i.s=si(i.s),Se(i)}function zl(a){return Se(a).desaturate(100)}function Hl(a,l){l=l===0?0:l||10;var i=Se(a).toHsl();return i.l+=l/100,i.l=si(i.l),Se(i)}function Gl(a,l){l=l===0?0:l||10;var i=Se(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)))),Se(i)}function Wl(a,l){l=l===0?0:l||10;var i=Se(a).toHsl();return i.l-=l/100,i.l=si(i.l),Se(i)}function Xl(a,l){var i=Se(a).toHsl(),o=(i.h+l)%360;return i.h=o<0?360+o:o,Se(i)}function $l(a){var l=Se(a).toHsl();return l.h=(l.h+180)%360,Se(l)}function ds(a,l){if(isNaN(l)||l<=0)throw new Error("Argument to polyad must be a positive number");for(var i=Se(a).toHsl(),o=[Se(a)],u=360/l,f=1;f<l;f++)o.push(Se({h:(i.h+f*u)%360,s:i.s,l:i.l}));return o}function jl(a){var l=Se(a).toHsl(),i=l.h;return[Se(a),Se({h:(i+72)%360,s:l.s,l:l.l}),Se({h:(i+216)%360,s:l.s,l:l.l})]}function ql(a,l,i){l=l||6,i=i||30;var o=Se(a).toHsl(),u=360/i,f=[Se(a)];for(o.h=(o.h-(u*l>>1)+720)%360;--l;)o.h=(o.h+u)%360,f.push(Se(o));return f}function Zl(a,l){l=l||6;for(var i=Se(a).toHsv(),o=i.h,u=i.s,f=i.v,m=[],p=1/l;l--;)m.push(Se({h:o,s:u,v:f})),f=(f+p)%1;return m}Se.mix=function(a,l,i){i=i===0?0:i||50;var o=Se(a).toRgb(),u=Se(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 Se(m)},Se.readability=function(a,l){var i=Se(a),o=Se(l);return(Math.max(i.getLuminance(),o.getLuminance())+.05)/(Math.min(i.getLuminance(),o.getLuminance())+.05)},Se.isReadable=function(a,l,i){var o=Se.readability(a,l),u,f;switch(f=!1,u=tc(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},Se.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=Se.readability(a,l[x]),f>u&&(u=f,o=Se(l[x]));return Se.isReadable(a,o,{level:p,size:_})||!m?o:(i.includeFallbackColors=!1,Se.mostReadable(a,["#fff","#000"],i))};var Yi=Se.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"},Yl=Se.hexNames=Kl(Yi);function Kl(a){var l={};for(var i in a)a.hasOwnProperty(i)&&(l[a[i]]=i);return l}function us(a){return a=parseFloat(a),(isNaN(a)||a<0||a>1)&&(a=1),a}function yt(a,l){Ql(a)&&(a="100%");var i=Jl(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 si(a){return Math.min(1,Math.max(0,a))}function ln(a){return parseInt(a,16)}function Ql(a){return typeof a=="string"&&a.indexOf(".")!=-1&&parseFloat(a)===1}function Jl(a){return typeof a=="string"&&a.indexOf("%")!=-1}function Cn(a){return a.length==1?"0"+a:""+a}function vr(a){return a<=1&&(a=a*100+"%"),a}function fs(a){return Math.round(parseFloat(a)*255).toString(16)}function hs(a){return ln(a)/255}var En=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 Pn(a){return!!En.CSS_UNIT.exec(a)}function ec(a){a=a.replace(Ol,"").replace(Ml,"").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=En.rgb.exec(a))?{r:i[1],g:i[2],b:i[3]}:(i=En.rgba.exec(a))?{r:i[1],g:i[2],b:i[3],a:i[4]}:(i=En.hsl.exec(a))?{h:i[1],s:i[2],l:i[3]}:(i=En.hsla.exec(a))?{h:i[1],s:i[2],l:i[3],a:i[4]}:(i=En.hsv.exec(a))?{h:i[1],s:i[2],v:i[3]}:(i=En.hsva.exec(a))?{h:i[1],s:i[2],v:i[3],a:i[4]}:(i=En.hex8.exec(a))?{r:ln(i[1]),g:ln(i[2]),b:ln(i[3]),a:hs(i[4]),format:l?"name":"hex8"}:(i=En.hex6.exec(a))?{r:ln(i[1]),g:ln(i[2]),b:ln(i[3]),format:l?"name":"hex"}:(i=En.hex4.exec(a))?{r:ln(i[1]+""+i[1]),g:ln(i[2]+""+i[2]),b:ln(i[3]+""+i[3]),a:hs(i[4]+""+i[4]),format:l?"name":"hex8"}:(i=En.hex3.exec(a))?{r:ln(i[1]+""+i[1]),g:ln(i[2]+""+i[2]),b:ln(i[3]+""+i[3]),format:l?"name":"hex"}:!1}function tc(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 ai=we.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 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:o,updateCacheFromBlob:i,cleanup:p,setupEventListener:f,removeEventListener:m}}),bt=we.defineStore("themeLib",()=>{const a=ai(),{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_enable_locators: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},system_notification_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_menu_btn:null,kiosk_hide_manual_input_loyalty_card:null,kiosk_camera_scan_loyalty_card:null,kiosk_hide_menu_update_notification:null,kiosk_infinite_scroll: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 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=Se(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}}),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 nc(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 rc(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 nc(l)}catch{return atob(l)}}function ms(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,o=a.split(".")[i];if(typeof o!="string")throw new Pr(`Invalid token specified: missing part #${i+1}`);let u;try{u=rc(o)}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 ic=(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},oc=(a,l)=>{if(typeof window<"u"){const i=localStorage.getItem(a);if(i)try{return ms(JSON.parse(i))}catch(o){return console.error("Failed to decode JWT:",o),l}}return l},gs=(a,l,i="normal")=>{const o=r.ref(i==="jwt"?oc(a,l):ic(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},mr=a=>{a.forEach(l=>{try{localStorage.removeItem(l)}catch(i){console.error(`Ошибка при удалении ключа "${l}":`,i)}})};class sc{constructor(l,i={}){ke(this,"url");ke(this,"options");ke(this,"ws");ke(this,"reconnectInterval");ke(this,"listeners");ke(this,"isConnected");ke(this,"heartbeat");ke(this,"heartbeatTimeout");ke(this,"pingTimeout");ke(this,"pingResponseTimeout");ke(this,"signal");ke(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 li=new Map;function Lr(a,l={}){var o;if(li.has(a)){const u=li.get(a);if(u.isConnected.value&&((o=u.ws)==null?void 0:o.readyState)===WebSocket.OPEN)return u.listeners.clear(),u;u.close(!0),li.delete(a)}const i=new sc(a,l);return li.set(a,i),i}const lt=we.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),v=r.ref(),k=r.ref(!localStorage.getItem("apiKey")),P=r.ref(!1),D=r.ref({textNotification:""}),M=r.ref([]),j=r.ref(0);let z=null;const Z=ae=>{const oe=`wss://${x.value.area}/ws/device/${ae}/`;z=Lr(oe);function xe(){console.log("WebSocket connection opened")}function _e(he){if(he.error)P.value=!0,D.value.textNotification=he.error,z==null||z.close(!0);else{if(!(he!=null&&he.params))return;v.value=he.params,typeof he.params.components.shift.is_ok!==null?T.value=he.params.components.shift.is_ok:T.value=!0}}function Pe(he){console.error("WebSocket error:",he),z.close(!0)}z.on("open",xe),z.on("message",_e),z.on("error",Pe),z.connect()},V=ae=>{o.value=ae,localStorage.setItem("kiosk_timeout",ae)},L=ae=>{l.value=ae},F=r.ref(null),re=r.computed(()=>m.value.reduce((ae,oe)=>{let xe=0,_e=0;return oe.group_modifiers&&(xe=oe.group_modifiers.reduce((Pe,he)=>he.modifiers?Pe+he.modifiers.reduce((qe,ye)=>qe+ye.old_price*ye.amount,0):0,0)*oe.amount),oe.modifiers&&(_e=oe.modifiers.reduce((Pe,he)=>Pe+he.old_price*he.amount,0)*oe.amount),ae+oe.old_price*oe.amount+xe+_e},0)),K=r.computed({get:()=>m.value.length===0||F.value===0?0:F.value&&F.value!==0?F.value:m.value.reduce((ae,oe)=>{const xe=hr(oe)*oe.amount;let _e=0,Pe=0;return oe.group_modifiers&&(_e=oe.group_modifiers.reduce((he,qe)=>qe.modifiers?he+qe.modifiers.reduce((ye,Qe)=>ye+Qe.price*Qe.amount,0):0,0)*oe.amount),oe.modifiers&&(Pe=oe.modifiers.reduce((he,qe)=>he+qe.price*qe.amount,0)*oe.amount),ae+xe+_e+Pe},0),set(ae){F.value=ae}}),ee=ae=>{y.value=ae,localStorage.removeItem("bonus"),gs("bonus",y.value)},G=ae=>{mr(ae)},W=ae=>{ae={...ae,idSystem:crypto.randomUUID()};const oe=X(ae);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(ae){console.error("Failed to update cart in localStorage:",ae)}},X=ae=>r.reactive({...ae,amount:ae.amount??1,price:ae.old_price,new_price:null,total_new_price:null,discounts:[],modifiers:(ae.modifiers||[]).map(oe=>r.reactive({...oe,price:oe.old_price,new_price:null,total_new_price:null})),group_modifiers:(ae.group_modifiers||[]).map(oe=>r.reactive({...oe,modifiers:(oe.modifiers||[]).map(xe=>r.reactive({...xe,price:xe.old_price,new_price:null,total_new_price:null}))}))}),$=ae=>{const oe=m.value.find(xe=>xe.idSystem===ae);oe&&(oe.amount+=1),N()},q=ae=>{const oe=m.value.find(xe=>xe.idSystem===ae);oe&&(oe.amount>=1&&(oe.amount-=1),N())},J=()=>{try{const ae=localStorage.getItem("cart");if(ae){const oe=JSON.parse(ae);m.value.splice(0,m.value.length,...oe.map(X)),F.value=null}}catch(ae){console.error("Failed to load cart from localStorage:",ae)}};return J(),{cartProducts_lib:m,activeScrolling_lib:p,config_lib:x,totalPrice_lib:K,initialCartPrice_lib:re,is_notification_lib:P,notificationData_lib:D,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:v,displayCards:M,isOrderTypeSubmited:_,cartBasketBumpKey:j,removeFromLocalStorage:G,setKioskTimeout:V,setBonus:ee,setStateDrum:L,addToCart:W,plusAmount:$,minusAmount:q,loadCart:J,deleteItemFromCart:ae=>{if(ae){const oe=m.value.findIndex(xe=>xe.idSystem===ae);if(oe===-1)return;m.value.splice(oe,1),N(),F.value=null}else m.value=[],N()},updateCartInLocalStorage:N,makeProductFullyReactive:X,checkHeartbeatApp:Z}});function ps(a,l){return function(){return a.apply(l,arguments)}}const{toString:ac}=Object.prototype,{getPrototypeOf:Ki}=Object,{iterator:ci,toStringTag:xs}=Symbol,di=(a=>l=>{const i=ac.call(l);return a[i]||(a[i]=i.slice(8,-1).toLowerCase())})(Object.create(null)),yn=a=>(a=a.toLowerCase(),l=>di(l)===a),ui=a=>l=>typeof l===a,{isArray:gr}=Array,pr=ui("undefined");function Fr(a){return a!==null&&!pr(a)&&a.constructor!==null&&!pr(a.constructor)&&Qt(a.constructor.isBuffer)&&a.constructor.isBuffer(a)}const _s=yn("ArrayBuffer");function lc(a){let l;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?l=ArrayBuffer.isView(a):l=a&&a.buffer&&_s(a.buffer),l}const cc=ui("string"),Qt=ui("function"),ws=ui("number"),Vr=a=>a!==null&&typeof a=="object",dc=a=>a===!0||a===!1,fi=a=>{if(di(a)!=="object")return!1;const l=Ki(a);return(l===null||l===Object.prototype||Object.getPrototypeOf(l)===null)&&!(xs in a)&&!(ci in a)},uc=a=>{if(!Vr(a)||Fr(a))return!1;try{return Object.keys(a).length===0&&Object.getPrototypeOf(a)===Object.prototype}catch{return!1}},fc=yn("Date"),hc=yn("File"),mc=yn("Blob"),gc=yn("FileList"),pc=a=>Vr(a)&&Qt(a.pipe),xc=a=>{let l;return a&&(typeof FormData=="function"&&a instanceof FormData||Qt(a.append)&&((l=di(a))==="formdata"||l==="object"&&Qt(a.toString)&&a.toString()==="[object FormData]"))},_c=yn("URLSearchParams"),[wc,Cc,Ec,yc]=["ReadableStream","Request","Response","Headers"].map(yn),bc=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 o,u;if(typeof a!="object"&&(a=[a]),gr(a))for(o=0,u=a.length;o<u;o++)l.call(null,a[o],o,a);else{if(Fr(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 Cs(a,l){if(Fr(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 Kn=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,Es=a=>!pr(a)&&a!==Kn;function Qi(){const{caseless:a,skipUndefined:l}=Es(this)&&this||{},i={},o=(u,f)=>{const m=a&&Cs(i,f)||f;fi(i[m])&&fi(u)?i[m]=Qi(i[m],u):fi(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],o);return i}const Ac=(a,l,i,{allOwnKeys:o}={})=>(Ur(l,(u,f)=>{i&&Qt(u)?a[f]=ps(u,i):a[f]=u},{allOwnKeys:o}),a),Sc=a=>(a.charCodeAt(0)===65279&&(a=a.slice(1)),a),Ic=(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)},Nc=(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},Tc=(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},kc=a=>{if(!a)return null;if(gr(a))return a;let l=a.length;if(!ws(l))return null;const i=new Array(l);for(;l-- >0;)i[l]=a[l];return i},Rc=(a=>l=>a&&l instanceof a)(typeof Uint8Array<"u"&&Ki(Uint8Array)),Bc=(a,l)=>{const o=(a&&a[ci]).call(a);let u;for(;(u=o.next())&&!u.done;){const f=u.value;l.call(a,f[0],f[1])}},Oc=(a,l)=>{let i;const o=[];for(;(i=a.exec(l))!==null;)o.push(i);return o},Mc=yn("HTMLFormElement"),Dc=a=>a.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(i,o,u){return o.toUpperCase()+u}),ys=(({hasOwnProperty:a})=>(l,i)=>a.call(l,i))(Object.prototype),vc=yn("RegExp"),bs=(a,l)=>{const i=Object.getOwnPropertyDescriptors(a),o={};Ur(i,(u,f)=>{let m;(m=l(u,f,a))!==!1&&(o[f]=m||u)}),Object.defineProperties(a,o)},Pc=a=>{bs(a,(l,i)=>{if(Qt(a)&&["arguments","caller","callee"].indexOf(i)!==-1)return!1;const o=a[i];if(Qt(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+"'")})}})},Lc=(a,l)=>{const i={},o=u=>{u.forEach(f=>{i[f]=!0})};return gr(a)?o(a):o(String(a).split(l)),i},Fc=()=>{},Vc=(a,l)=>a!=null&&Number.isFinite(a=+a)?a:l;function Uc(a){return!!(a&&Qt(a.append)&&a[xs]==="FormData"&&a[ci])}const zc=a=>{const l=new Array(10),i=(o,u)=>{if(Vr(o)){if(l.indexOf(o)>=0)return;if(Fr(o))return o;if(!("toJSON"in o)){l[u]=o;const f=gr(o)?[]:{};return Ur(o,(m,p)=>{const _=i(m,u+1);!pr(_)&&(f[p]=_)}),l[u]=void 0,f}}return o};return i(a,0)},Hc=yn("AsyncFunction"),Gc=a=>a&&(Vr(a)||Qt(a))&&Qt(a.then)&&Qt(a.catch),As=((a,l)=>a?setImmediate:l?((i,o)=>(Kn.addEventListener("message",({source:u,data:f})=>{u===Kn&&f===i&&o.length&&o.shift()()},!1),u=>{o.push(u),Kn.postMessage(i,"*")}))(`axios@${Math.random()}`,[]):i=>setTimeout(i))(typeof setImmediate=="function",Qt(Kn.postMessage)),Wc=typeof queueMicrotask<"u"?queueMicrotask.bind(Kn):typeof process<"u"&&process.nextTick||As,te={isArray:gr,isArrayBuffer:_s,isBuffer:Fr,isFormData:xc,isArrayBufferView:lc,isString:cc,isNumber:ws,isBoolean:dc,isObject:Vr,isPlainObject:fi,isEmptyObject:uc,isReadableStream:wc,isRequest:Cc,isResponse:Ec,isHeaders:yc,isUndefined:pr,isDate:fc,isFile:hc,isBlob:mc,isRegExp:vc,isFunction:Qt,isStream:pc,isURLSearchParams:_c,isTypedArray:Rc,isFileList:gc,forEach:Ur,merge:Qi,extend:Ac,trim:bc,stripBOM:Sc,inherits:Ic,toFlatObject:Nc,kindOf:di,kindOfTest:yn,endsWith:Tc,toArray:kc,forEachEntry:Bc,matchAll:Oc,isHTMLForm:Mc,hasOwnProperty:ys,hasOwnProp:ys,reduceDescriptors:bs,freezeMethods:Pc,toObjectSet:Lc,toCamelCase:Dc,noop:Fc,toFiniteNumber:Vc,findKey:Cs,global:Kn,isContextDefined:Es,isSpecCompliantForm:Uc,toJSONObject:zc,isAsyncFn:Hc,isThenable:Gc,setImmediate:As,asap:Wc,isIterable:a=>a!=null&&Qt(a[ci])};function Le(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(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:te.toJSONObject(this.config),code:this.code,status:this.status}}});const Ss=Le.prototype,Is={};["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=>{Is[a]={value:a}}),Object.defineProperties(Le,Is),Object.defineProperty(Ss,"isAxiosError",{value:!0}),Le.from=(a,l,i,o,u,f)=>{const m=Object.create(Ss);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 Le.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 Xc=null;function Ji(a){return te.isPlainObject(a)||te.isArray(a)}function Ns(a){return te.endsWith(a,"[]")?a.slice(0,-2):a}function Ts(a,l,i){return a?a.concat(l).map(function(u,f){return u=Ns(u),!i&&f?"["+u+"]":u}).join(i?".":""):l}function $c(a){return te.isArray(a)&&!a.some(Ji)}const jc=te.toFlatObject(te,{},null,function(l){return/^is[A-Z]/.test(l)});function hi(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(v,k){return!te.isUndefined(k[v])});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 Le("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,v,k){let P=T;if(T&&!k&&typeof T=="object"){if(te.endsWith(v,"{}"))v=o?v:v.slice(0,-2),T=JSON.stringify(T);else if(te.isArray(T)&&$c(T)||(te.isFileList(T)||te.endsWith(v,"[]"))&&(P=te.toArray(T)))return v=Ns(v),P.forEach(function(M,j){!(te.isUndefined(M)||M===null)&&l.append(m===!0?Ts([v],j,f):m===null?v:v+"[]",x(M))}),!1}return Ji(T)?!0:(l.append(Ts(k,v,f),x(T)),!1)}const y=[],I=Object.assign(jc,{defaultVisitor:C,convertValue:x,isVisitable:Ji});function B(T,v){if(!te.isUndefined(T)){if(y.indexOf(T)!==-1)throw Error("Circular reference detected in "+v.join("."));y.push(T),te.forEach(T,function(P,D){(!(te.isUndefined(P)||P===null)&&u.call(l,P,te.isString(D)?D.trim():D,v,I))===!0&&B(P,v?v.concat(D):[D])}),y.pop()}}if(!te.isObject(a))throw new TypeError("data must be an object");return B(a),l}function ks(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&&hi(a,this,l)}const Rs=eo.prototype;Rs.append=function(l,i){this._pairs.push([l,i])},Rs.toString=function(l){const i=l?function(o){return l.call(this,o,ks)}:ks;return this._pairs.map(function(u){return i(u[0])+"="+i(u[1])},"").join("&")};function qc(a){return encodeURIComponent(a).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function Bs(a,l,i){if(!l)return a;const o=i&&i.encode||qc;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 Os{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 Ms={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Zc={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,Yc=to&&(!no||["ReactNative","NativeScript","NS"].indexOf(no.product)<0),Kc=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Qc=to&&window.location.href||"http://localhost",qt={...Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:to,hasStandardBrowserEnv:Yc,hasStandardBrowserWebWorkerEnv:Kc,navigator:no,origin:Qc},Symbol.toStringTag,{value:"Module"})),...Zc};function Jc(a,l){return hi(a,new qt.classes.URLSearchParams,{visitor:function(i,o,u,f){return qt.isNode&&te.isBuffer(i)?(this.append(o,i.toString("base64")),!1):f.defaultVisitor.apply(this,arguments)},...l})}function ed(a){return te.matchAll(/\w+|\[(\w*)]/g,a).map(l=>l[0]==="[]"?"":l[1]||l[0])}function td(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 Ds(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]=td(u[m])),!p)}if(te.isFormData(a)&&te.isFunction(a.entries)){const i={};return te.forEachEntry(a,(o,u)=>{l(ed(o),u,i,0)}),i}return null}function nd(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 zr={transitional:Ms,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(Ds(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 Jc(l,this.formSerializer).toString();if((p=te.isFileList(l))||o.indexOf("multipart/form-data")>-1){const _=this.env&&this.env.FormData;return hi(p?{"files[]":l}:l,_&&new _,this.formSerializer)}}return f||u?(i.setContentType("application/json",!1),nd(l)):l}],transformResponse:[function(l){const i=this.transitional||zr.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"?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:qt.classes.FormData,Blob:qt.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=>{zr.headers[a]={}});const rd=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"]),id=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]&&rd[i])&&(i==="set-cookie"?l[i]?l[i].push(o):l[i]=[o]:l[i]=l[i]?l[i]+", "+o:o)}),l},vs=Symbol("internals");function Hr(a){return a&&String(a).trim().toLowerCase()}function mi(a){return a===!1||a==null?a:te.isArray(a)?a.map(mi):String(a)}function od(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 sd=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 ad(a){return a.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(l,i,o)=>i.toUpperCase()+o)}function ld(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 Jt=class{constructor(l){l&&this.set(l)}set(l,i,o){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=te.findKey(u,C);(!y||u[y]===void 0||x===!0||x===void 0&&u[y]!==!1)&&(u[y||_]=mi(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())&&!sd(l))m(id(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=Hr(l),l){const o=te.findKey(this,l);if(o){const u=this[o];if(!i)return u;if(i===!0)return od(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=Hr(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=Hr(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]=mi(u),delete i[f];return}const p=l?ad(f):String(f).trim();p!==f&&delete i[f],i[p]=mi(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[vs]=this[vs]={accessors:{}}).accessors,u=this.prototype;function f(m){const p=Hr(m);o[p]||(ld(u,m),o[p]=!0)}return te.isArray(l)?l.forEach(f):f(l),this}};Jt.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),te.reduceDescriptors(Jt.prototype,({value:a},l)=>{let i=l[0].toUpperCase()+l.slice(1);return{get:()=>a,set(o){this[i]=o}}}),te.freezeMethods(Jt);function io(a,l){const i=this||zr,o=l||i,u=Jt.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 Ps(a){return!!(a&&a.__CANCEL__)}function xr(a,l,i){Le.call(this,a??"canceled",Le.ERR_CANCELED,l,i),this.name="CanceledError"}te.inherits(xr,Le,{__CANCEL__:!0});function Ls(a,l,i){const o=i.config.validateStatus;!i.status||!o||o(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 cd(a){const l=/^([-+\w]{1,25})(:?\/\/|:)/.exec(a);return l&&l[1]||""}function dd(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 ud(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 gi=(a,l,i=3)=>{let o=0;const u=dd(50,250);return ud(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)},Fs=(a,l)=>{const i=a!=null;return[o=>l[0]({lengthComputable:i,total:a,loaded:o}),l[1]]},Vs=a=>(...l)=>te.asap(()=>a(...l)),fd=qt.hasStandardBrowserEnv?((a,l)=>i=>(i=new URL(i,qt.origin),a.protocol===i.protocol&&a.host===i.host&&(l||a.port===i.port)))(new URL(qt.origin),qt.navigator&&/(msie|trident)/i.test(qt.navigator.userAgent)):()=>!0,hd=qt.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 md(a){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(a)}function gd(a,l){return l?a.replace(/\/?\/$/,"")+"/"+l.replace(/^\/+/,""):a}function Us(a,l,i){let o=!md(l);return a&&(o||i==!1)?gd(a,l):l}const zs=a=>a instanceof Jt?{...a}:a;function Qn(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(zs(x),zs(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 Hs=a=>{const l=Qn({},a);let{data:i,withXSRFToken:o,xsrfHeaderName:u,xsrfCookieName:f,headers:m,auth:p}=l;if(l.headers=m=Jt.from(m),l.url=Bs(Us(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(qt.hasStandardBrowserEnv||qt.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(qt.hasStandardBrowserEnv&&(o&&te.isFunction(o)&&(o=o(l)),o||o!==!1&&fd(l.url))){const _=u&&f&&hd.read(f);_&&m.set(u,_)}return l},pd=typeof XMLHttpRequest<"u"&&function(a){return new Promise(function(i,o){const u=Hs(a);let f=u.data;const m=Jt.from(u.headers).normalize();let{responseType:p,onUploadProgress:_,onDownloadProgress:x}=u,C,y,I,B,T;function v(){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 M=Jt.from("getAllResponseHeaders"in k&&k.getAllResponseHeaders()),z={data:!p||p==="text"||p==="json"?k.responseText:k.response,status:k.status,statusText:k.statusText,headers:M,config:a,request:k};Ls(function(V){i(V),v()},function(V){o(V),v()},z),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 Le("Request aborted",Le.ECONNABORTED,a,k)),k=null)},k.onerror=function(j){const z=j&&j.message?j.message:"Network Error",Z=new Le(z,Le.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 z=u.transitional||Ms;u.timeoutErrorMessage&&(j=u.timeoutErrorMessage),o(new Le(j,z.clarifyTimeoutError?Le.ETIMEDOUT:Le.ECONNABORTED,a,k)),k=null},f===void 0&&m.setContentType(null),"setRequestHeader"in k&&te.forEach(m.toJSON(),function(j,z){k.setRequestHeader(z,j)}),te.isUndefined(u.withCredentials)||(k.withCredentials=!!u.withCredentials),p&&p!=="json"&&(k.responseType=u.responseType),x&&([I,T]=gi(x,!0),k.addEventListener("progress",I)),_&&k.upload&&([y,B]=gi(_),k.upload.addEventListener("progress",y),k.upload.addEventListener("loadend",B)),(u.cancelToken||u.signal)&&(C=M=>{k&&(o(!M||M.type?new xr(null,a,k):M),k.abort(),k=null)},u.cancelToken&&u.cancelToken.subscribe(C),u.signal&&(u.signal.aborted?C():u.signal.addEventListener("abort",C)));const D=cd(u.url);if(D&&qt.protocols.indexOf(D)===-1){o(new Le("Unsupported protocol "+D+":",Le.ERR_BAD_REQUEST,a));return}k.send(f||null)})},xd=(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 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:_}=o;return _.unsubscribe=()=>te.asap(p),_}},_d=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},wd=async function*(a,l){for await(const i of Cd(a))yield*_d(i,l)},Cd=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()}},Gs=(a,l,i,o)=>{const u=wd(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})},Ws=64*1024,{isFunction:pi}=te,Ed=(({Request:a,Response:l})=>({Request:a,Response:l}))(te.global),{ReadableStream:Xs,TextEncoder:$s}=te.global,js=(a,...l)=>{try{return!!a(...l)}catch{return!1}},yd=a=>{a=te.merge.call({skipUndefined:!0},Ed,a);const{fetch:l,Request:i,Response:o}=a,u=l?pi(l):typeof fetch=="function",f=pi(i),m=pi(o);if(!u)return!1;const p=u&&pi(Xs),_=u&&(typeof $s=="function"?(T=>v=>T.encode(v))(new $s):async T=>new Uint8Array(await new i(T).arrayBuffer())),x=f&&p&&js(()=>{let T=!1;const v=new i(qt.origin,{body:new Xs,method:"POST",get duplex(){return T=!0,"half"}}).headers.has("Content-Type");return T&&!v}),C=m&&p&&js(()=>te.isReadableStream(new o("").body)),y={stream:C&&(T=>T.body)};u&&["text","arrayBuffer","blob","formData","stream"].forEach(T=>{!y[T]&&(y[T]=(v,k)=>{let P=v&&v[T];if(P)return P.call(v);throw new Le(`Response type '${T}' is not supported`,Le.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(qt.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,v)=>{const k=te.toFiniteNumber(T.getContentLength());return k??I(v)};return async T=>{let{url:v,method:k,data:P,signal:D,cancelToken:M,timeout:j,onDownloadProgress:z,onUploadProgress:Z,responseType:V,headers:L,withCredentials:F="same-origin",fetchOptions:re}=Hs(T),K=l||fetch;V=V?(V+"").toLowerCase():"text";let ee=xd([D,M&&M.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 ae=new i(v,{method:"POST",body:P,duplex:"half"}),oe;if(te.isFormData(P)&&(oe=ae.headers.get("content-type"))&&L.setContentType(oe),ae.body){const[xe,_e]=Fs(N,gi(Vs(Z)));P=Gs(ae.body,Ws,xe,_e)}}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(v,$);let q=await(f?K(G,re):K(v,$));const J=C&&(V==="stream"||V==="response");if(C&&(z||J&&W)){const ae={};["status","statusText","headers"].forEach(Pe=>{ae[Pe]=q[Pe]});const oe=te.toFiniteNumber(q.headers.get("content-length")),[xe,_e]=z&&Fs(oe,gi(Vs(z),!0))||[];q=new o(Gs(q.body,Ws,xe,()=>{_e&&_e(),W&&W()}),ae)}V=V||"text";let le=await y[te.findKey(y,V)||"text"](q,T);return!J&&W&&W(),await new Promise((ae,oe)=>{Ls(ae,oe,{data:le,headers:Jt.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 Le("Network Error",Le.ERR_NETWORK,T,G),{cause:X.cause||X}):Le.from(X,X&&X.code,T,G)}}},bd=new Map,qs=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=bd;for(;p--;)_=f[p],x=C.get(_),x===void 0&&C.set(_,x=p?new Map:yd(l)),C=x;return x};qs();const oo={http:Xc,xhr:pd,fetch:{get:qs}};te.forEach(oo,(a,l)=>{if(a){try{Object.defineProperty(a,"name",{value:l})}catch{}Object.defineProperty(a,"adapterName",{value:l})}});const Zs=a=>`- ${a}`,Ad=a=>te.isFunction(a)||a===null||a===!1;function Sd(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,!Ad(o)&&(u=oo[(p=String(o)).toLowerCase()],u===void 0))throw new Le(`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
+ `+m.map(Zs).join(`
5
+ `):" "+Zs(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 Ys={getAdapter:Sd,adapters:oo};function so(a){if(a.cancelToken&&a.cancelToken.throwIfRequested(),a.signal&&a.signal.aborted)throw new xr(null,a)}function Ks(a){return so(a),a.headers=Jt.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),Ys.getAdapter(a.adapter||zr.adapter,a)(a).then(function(o){return so(a),o.data=io.call(a,a.transformResponse,o),o.headers=Jt.from(o.headers),o},function(o){return Ps(o)||(so(a),o&&o.response&&(o.response.data=io.call(a,a.transformResponse,o.response),o.response.headers=Jt.from(o.response.headers))),Promise.reject(o)})}const Qs="1.13.2",xi={};["object","boolean","number","function","string","symbol"].forEach((a,l)=>{xi[a]=function(o){return typeof o===a||"a"+(l<1?"n ":" ")+a}});const Js={};xi.transitional=function(l,i,o){function u(f,m){return"[Axios v"+Qs+"] Transitional option '"+f+"'"+m+(o?". "+o:"")}return(f,m,p)=>{if(l===!1)throw new Le(u(m," has been removed"+(i?" in "+i:"")),Le.ERR_DEPRECATED);return i&&!Js[m]&&(Js[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}},xi.spelling=function(l){return(i,o)=>(console.warn(`${o} is likely a misspelling of ${l}`),!0)};function Id(a,l,i){if(typeof a!="object")throw new Le("options must be an object",Le.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 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 _i={assertOptions:Id,validators:xi},Nn=_i.validators;let Jn=class{constructor(l){this.defaults=l||{},this.interceptors={request:new Os,response:new Os}}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=Qn(this.defaults,i);const{transitional:o,paramsSerializer:u,headers:f}=i;o!==void 0&&_i.assertOptions(o,{silentJSONParsing:Nn.transitional(Nn.boolean),forcedJSONParsing:Nn.transitional(Nn.boolean),clarifyTimeoutError:Nn.transitional(Nn.boolean)},!1),u!=null&&(te.isFunction(u)?i.paramsSerializer={serialize:u}:_i.assertOptions(u,{encode:Nn.function,serialize:Nn.function},!0)),i.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?i.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:i.allowAbsoluteUrls=!0),_i.assertOptions(i,{baseUrl:Nn.spelling("baseURL"),withXsrfToken:Nn.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=Jt.concat(m,f);const p=[];let _=!0;this.interceptors.request.forEach(function(v){typeof v.runWhen=="function"&&v.runWhen(i)===!1||(_=_&&v.synchronous,p.unshift(v.fulfilled,v.rejected))});const x=[];this.interceptors.response.forEach(function(v){x.push(v.fulfilled,v.rejected)});let C,y=0,I;if(!_){const T=[Ks.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++],v=p[y++];try{B=T(B)}catch(k){v.call(this,k);break}}try{C=Ks.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=Qn(this.defaults,l);const i=Us(l.baseURL,l.url,l.allowAbsoluteUrls);return Bs(i,l.params,l.paramsSerializer)}};te.forEach(["delete","get","head","options"],function(l){Jn.prototype[l]=function(i,o){return this.request(Qn(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(Qn(p||{},{method:l,headers:o?{"Content-Type":"multipart/form-data"}:{},url:f,data:m}))}}Jn.prototype[l]=i(),Jn.prototype[l+"Form"]=i(!0)});let Nd=class dl{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 xr(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 dl(function(u){l=u}),cancel:l}}};function Td(a){return function(i){return a.apply(null,i)}}function kd(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 ea(a){const l=new Jn(a),i=ps(Jn.prototype.request,l);return te.extend(i,Jn.prototype,l,{allOwnKeys:!0}),te.extend(i,l,null,{allOwnKeys:!0}),i.create=function(u){return ea(Qn(a,u))},i}const Ye=ea(zr);Ye.Axios=Jn,Ye.CanceledError=xr,Ye.CancelToken=Nd,Ye.isCancel=Ps,Ye.VERSION=Qs,Ye.toFormData=hi,Ye.AxiosError=Le,Ye.Cancel=Ye.CanceledError,Ye.all=function(l){return Promise.all(l)},Ye.spread=Td,Ye.isAxiosError=kd,Ye.mergeConfig=Qn,Ye.AxiosHeaders=Jt,Ye.formToJSON=a=>Ds(te.isHTMLForm(a)?new FormData(a):a),Ye.getAdapter=Ys.getAdapter,Ye.HttpStatusCode=ao,Ye.default=Ye;const{Axios:Ep,AxiosError:yp,CanceledError:bp,isCancel:Ap,CancelToken:Sp,VERSION:Ip,all:Np,Cancel:Tp,isAxiosError:kp,spread:Rp,toFormData:Bp,AxiosHeaders:Op,HttpStatusCode:Mp,formToJSON:Dp,getAdapter:vp,mergeConfig:Pp}=Ye,Gr=we.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}}}),Rd=["ping","pong"],Bd=["confirmed","waiting_payment","partial_paid"],Od=["cancelled"],Ln=we.defineStore("table-data",()=>{const a=Ne.useRoute(),l=Ne.useRouter(),i=lt(),o=Gr(),u=r.ref(1),f=r.ref(1),m=mt.useLocalStorage("appMode",null,{shallow:!0}),p=mt.useLocalStorage("tableData",null,{shallow:!0,serializer:mt.StorageSerializers.object}),_=mt.useLocalStorage("tableId",null),x=mt.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 v=null;const k=mt.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 Ye.get(`/org_unit/${I.value}/table/${re}/`,{baseURL:`https://${i.config_lib.area}/api/`,signal:F.signal})).data,__v:u.value}}catch(W){return Ye.isCancel(W)?null:m.value==="table-tent"?p.value:re===(v==null?void 0:v.id)?v:(v=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=mt.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 Ye.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 D=null;const M=L=>{D&&(D==null||D.close(),D=null),L&&(D=Lr(`wss://${i.config_lib.area}/ws/order/${L.id}/`),D.on("message",F=>{Rd.includes(F==null?void 0:F.type)||((F==null?void 0:F.method)==="update_order_status"&&Od.includes(F.params.status)&&o.showNotification("Ваш заказ был отменён"),z())}),D.connect())},j=()=>{u.value++},z=()=>{f.value++},Z=L=>{L&&(v=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)&&M(L),L&&!Bd.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:z}});let Tn=null,Zt=null;function er(a){a&&a.close(!0)}async function lo(a,l){const i=vt(),o=lt(),u=bn.create();try{const f=await u.initPaymentLink(a,l);return i.paymentCostQR=o.totalPrice_lib-o.countBonus,i.linkQR=f.url,Zt==null||Zt.deleteCart(null,Zt==null?void 0:Zt.is_requestKiosk),f}catch(f){throw i.isButtonDisabled=!1,i.showNotification(f==null?void 0:f.response.data.user_friendly_message),f}}function Md(a,l,i){const o=bt();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),gn(l,null),uo(l);return}i(a,l)}}function co(a,l){const i=vt(),o=lt();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 gn=(a,l)=>{a.updateOrderStatus&&a.updateOrderStatus(l)},Dd=a=>{a.loadCart&&a.loadCart()},wi=a=>{a.resetBonuses&&a.resetBonuses()},vd=a=>{a.resetDiscounts&&a.resetDiscounts()},uo=a=>{a.closeWebSocket&&a.closeWebSocket()},ta=(a,l,i,o)=>{var m;if(((m=a.params)==null?void 0:m.need_pay)===!1)return;const u=l.ws||i;bn.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:()=>er(u)})})},fo=(a,l,i)=>{const o=a.ws||l;(a.errorHandler||i).handleOrderError({...a,closeWebSocket:()=>er(o)})},Pd=(a,l,i)=>{const o=vt(),u=o.getCurrentPaymentMethodId();if(!u||!Fn.getConfig(u)||!Fn.isMethodAvailable(u,a))return null;const m=Fn.createHandler(u);if(!m)return null;const p=o.createPaymentHandler(a,l,u,i);return p?{handler:m,config:p.config}:null},Ld=a=>{if(!Zt)return;const l=Zt.context,i=Zt.is_requestKiosk,o=Pd(l,i,Zt.locator);if(!o){console.warn("handleWebSocketMessageWithDynamicHandler: не удалось получить handler");return}const{handler:u,config:f}=o,m={...f,...Zt};Md(a,m,u.handleWebSocketStatus)};async function Fd(a,l,i){var x,C;const o=Ln(),{is_requestKiosk:u}=l,{comment:f,is_authorized:m,signal:p}=i;l.setButtonDisabled(!0);const _=bn.create();try{const y=await _.createOrder(a,o.id,u,f,m,p,l.locator);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};Zt=B;const v=`wss://${B.area||""}/ws/order/${I}/`;Tn=Lr(v,{signal:p});const k=()=>{console.warn("WebSocket connection opened (centralized mode)")},P=M=>{var j;console.error("WebSocket error (centralized mode):",M),er(Tn),Tn=null,Zt=null,l.setButtonDisabled(!1),(j=l.errorHandler)==null||j.handlePaymentError(M,B)},D=M=>{Ld(M)};Tn.on("open",k),Tn.on("message",D),Tn.on("error",P),Tn.connect(),Zt.ws=Tn,Zt.closeWebSocket=()=>{er(Tn),Tn=null,Zt=null}}return y}catch(y){throw Ye.isCancel(y)||((C=l.errorHandler)==null||C.handleCreateOrderError(y,l),l.setButtonDisabled(!1)),y}}const na=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 Ci(){const a=vt(),l=Ln();return{handlePaymentError(i,o){var f,m,p,_,x,C;const u=na(i);gn(o,null),Dd(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():(wi(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"&&(wi(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=na(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)),gn(o,null)):(wi(o),o.navigation?o.navigation.redirectToError():o.redirect&&o.redirect(`/${((_=(p=o.route)==null?void 0:p.params)==null?void 0:_.orgId)||""}/errorPayment`),gn(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("Ошибка создания заказа. Пожалуйста, попробуйте еще раз"),vd(i)):(wi(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 Vd=()=>{const a=vt();let l=null;const i=Ci(),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")gn(f,1);else if(m==="payment_initiation_retry"||m==="fiscalized")ta(u,f,l,i);else if(m==="payment_initiation")gn(f,2);else if(m==="paid"){gn(f,3);const y=f.ws||l;er(y),localStorage.removeItem("cart")}else(C=f.orderErrors)!=null&&C.includes(m)&&fo(f,l,i)};return{handleWebSocketStatus(u,f){o(u,f)}}};function Ud(){const a=vt();let l=null;const i=Ci(),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")gn(f,1);else if(m==="waiting_payment")gn(f,4);else if(m==="paid"){gn(f,3);const y=f.ws||l;er(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 zd=()=>{const a=vt();let l=null;const i=Ci(),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")ta(u,f,l,i);else if(m==="payment_initiation")gn(f,2);else if(m==="paid"){gn(f,3);const x=f.ws||l;er(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 Fn{static initialize(){this.register({id:"TERMINAL_BASE",method:"TERMINAL",handlerFactory:Vd,availableContexts:["kiosk"]}),this.register({id:"YOOKASSA_BASE",method:"YOOKASSA",handlerFactory:zd,availableContexts:["qr","tableservice"]}),this.register({id:"SBP",method:"YOOKASSA",handlerFactory:Ud,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)}}ke(Fn,"methods",new Map),Fn.initialize();function Hd(a){return{cleanupAndNavigate(l,i){a.deleteCart(l,i)},cleanup(l){a.deleteCart(null,l)},clearTokens(){a.deleteCart(null,!0)},resetStores(){a.resetStores()}}}function Gd(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 vt=we.defineStore("cartLib",()=>{const a=Ne.useRouter(),l=Ne.useRoute(),i=bt(),o=lt(),{config_lib:u,countBonus:f,totalPrice_lib:m,initialCartPrice_lib:p,is18Allowed:_}=we.storeToRefs(o),{itemThemes:x}=we.storeToRefs(i),C=r.ref(!1),y=r.ref(""),I=r.ref(null),B=r.ref("wait"),T=r.ref(!0),v=r.ref(0),k=r.ref(""),P=r.ref([]),D=r.ref([]),M=r.ref(),j=r.ref(0),z=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:ye=>{(ye==null?void 0:ye.length)===1&&(F.value=ye[0]),P.value=ye}}),K=r.ref(!1),ee=r.ref(null),G=r.ref(0),W=r.ref(!1),N=r.ref({textNotification:""}),X=ye=>{W.value=!0,N.value.textNotification=ye},$=()=>{var ye,Qe;return(ye=M.value)!=null&&ye.front_type?M.value.front_type:((Qe=D.value[0])==null?void 0:Qe.front_type)||null},q=(ye,Qe,ct,tt)=>{var Be;const _t=ct??((Be=D.value[0])==null?void 0:Be.front_type);if(!_t)return console.warn("Не удалось определить метод оплаты"),null;const De=Fn.getConfig(_t);if(!De||!Fn.isMethodAvailable(_t,ye))return console.warn(`Метод ${_t} недоступен для контекста ${ye}`),null;const Ae=Fn.createHandler(_t);return Ae?(Z.value=J(De.method,ye,Qe,tt),{handler:Ae,config:Z.value}):(console.warn(`Не удалось создать обработчик для метода ${_t}`),null)},J=(ye,Qe,ct,tt)=>{const _t={method:ye,context:Qe,is_requestKiosk:ct,router:a,route:l,orderErrors:L.value,area:u.value.area,totalPrice:m,initialCartPrice:p,locator:tt,showNotification:X,deleteCart:qe,resetStores:he,redirect:Ke=>a.push(Ke),updateOrderStatus:Ke=>{ee.value=Ke},setOrderNumber:Ke=>{V.value=Ke},loadCart:()=>o.loadCart(),resetBonuses:()=>{f.value=0}},De=Ci(),Ae=Hd(_t),Be=Gd(_t);return{..._t,errorHandler:De,cartCleanup:Ae,navigation:Be}},le=r.computed(()=>!!I.value),ae=ye=>{B.value=ye},oe=ye=>{I.value=ye},xe=()=>{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=""},_e=()=>{C.value=!1,B.value="wait",y.value=""},Pe=()=>{I.value=null,y.value="",B.value="wait",_e()},he=()=>{K.value=!1,ee.value=null},qe=(ye=null,Qe=!1)=>{o.cartProducts_lib=[],o.is_OpenLoyal=!1,mr(["cart"]),Qe&&(mr(["authTokensAccess","authTokensRefresh","user"]),o.profile=null,sessionStorage.removeItem("is_adult"),_.value=!1),ye&&a.push(`/${l.params.orgId}/${ye}`)};return{isButtonDisabled:K,orderCompleted_lib:ee,extraDiscount:v,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:D,is_paymentCart:z,selectedOrderType:F,selectedProvider:M,configPayment:Z,paymentCostQR:j,deleteCart:qe,setGuestInfo:oe,setState:ae,openDrawer:xe,closeDrawer:_e,clearCard:Pe,showNotification:X,createPaymentHandler:q,getCurrentPaymentMethodId:$,getAvailablePaymentMethods:ye=>Fn.getAvailableMethods(ye)}}),Ut=we.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=bt(),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=hr(N)||0,$=N.amount||1;return(i.value.groupModifiersSelected.reduce((J,le)=>(le.modifiers.forEach(ae=>{var oe,xe;ae.sizes&&(ae.price=((xe=(oe=ae.sizes)==null?void 0:oe.find(_e=>_e.id===i.value.selectedSize.id))==null?void 0:xe.price)??ae.price),J+=ae.price*ae.amount}),J),0)+X)*$+G}return(W=i.value.addedProducts)!=null&&W.length?G:0}),v=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]}}),D=()=>{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))})})},M=G=>{i.value.addedProducts.push(G)},j=G=>{i.value.openCard=G},z=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,xe)=>oe+=xe.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,xe)=>oe+=xe.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:v,setProduct:z,summModifierAmount:I,setAddedProducts:M,setCurrentCard:j,minusAmount:V,plusAmount:L,toggleNotRequire:Z,modifierSelect:re,defaultAmountModifiers:D,validateGroup:k,reset:o}});var _r=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function ra(a){return a&&a.__esModule&&Object.prototype.hasOwnProperty.call(a,"default")?a.default:a}var ia={exports:{}};(function(a,l){(function(i,o){a.exports=o()})(_r,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",v="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,D={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])+"]"}},M=function(W,N,X){var $=String(W);return!$||$.length>=N?W:""+Array(N+1-$.length).join(X)+W},j={s:M,z:function(W){var N=-W.utcOffset(),X=Math.abs(N),$=Math.floor(X/60),q=X%60;return(N<=0?"+":"-")+M($,2,"0")+":"+M(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}},z="en",Z={};Z[z]=D;var V="$isDayjsObject",L=function(W){return W instanceof ee||!(!W||!W[V])},F=function W(N,X,$){var q;if(!N)return z;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 ae=N.name;Z[ae]=N,q=ae}return!$&&q&&(z=q),q||!$&&z},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 ae=le[2]-1||0,oe=(le[7]||"0").substring(0,3);return J?new Date(Date.UTC(le[1],ae,le[3]||1,le[4]||0,le[5]||0,le[6]||0,oe)):new Date(le[1],ae,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()!==v},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),ae=function(Qe,ct){var tt=K.w(q.$u?Date.UTC(q.$y,ct,Qe):new Date(q.$y,ct,Qe),q);return J?tt:tt.endOf(x)},oe=function(Qe,ct){return K.w(q.toDate()[Qe].apply(q.toDate("s"),(J?[0,0,0,0]:[23,59,59,999]).slice(ct)),q)},xe=this.$W,_e=this.$M,Pe=this.$D,he="set"+(this.$u?"UTC":"");switch(le){case B:return J?ae(1,0):ae(31,11);case y:return J?ae(1,_e):ae(0,_e+1);case C:var qe=this.$locale().weekStart||0,ye=(xe<qe?xe+7:xe)-qe;return ae(J?Pe-ye:Pe+(6-ye),_e);case x:case T:return oe(he+"Hours",0);case _:return oe(he+"Minutes",1);case p:return oe(he+"Seconds",2);case m:return oe(he+"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":""),ae=(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 xe=this.clone().set(T,1);xe.$d[ae](oe),xe.init(),this.$d=xe.set(T,Math.min(this.$D,xe.daysInMonth())).$d}else ae&&this.$d[ae](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($),ae=function(_e){var Pe=re(J);return K.w(Pe.date(Pe.date()+Math.round(_e*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 ae(1);if(le===C)return ae(7);var oe=(q={},q[p]=o,q[_]=u,q[m]=i,q)[le]||1,xe=this.$d.getTime()+X*oe;return K.w(xe,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||v;var J=X||"YYYY-MM-DDTHH:mm:ssZ",le=K.z(this),ae=this.$H,oe=this.$m,xe=this.$M,_e=q.weekdays,Pe=q.months,he=q.meridiem,qe=function(ct,tt,_t,De){return ct&&(ct[tt]||ct($,J))||_t[tt].slice(0,De)},ye=function(ct){return K.s(ae%12||12,ct,"0")},Qe=he||function(ct,tt,_t){var De=ct<12?"AM":"PM";return _t?De.toLowerCase():De};return J.replace(P,function(ct,tt){return tt||function(_t){switch(_t){case"YY":return String($.$y).slice(-2);case"YYYY":return K.s($.$y,4,"0");case"M":return xe+1;case"MM":return K.s(xe+1,2,"0");case"MMM":return qe(q.monthsShort,xe,Pe,3);case"MMMM":return qe(Pe,xe);case"D":return $.$D;case"DD":return K.s($.$D,2,"0");case"d":return String($.$W);case"dd":return qe(q.weekdaysMin,$.$W,_e,2);case"ddd":return qe(q.weekdaysShort,$.$W,_e,3);case"dddd":return _e[$.$W];case"H":return String(ae);case"HH":return K.s(ae,2,"0");case"h":return ye(1);case"hh":return ye(2);case"a":return Qe(ae,oe,!0);case"A":return Qe(ae,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}(ct)||le.replace(":","")})},N.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},N.diff=function(X,$,q){var J,le=this,ae=K.p($),oe=re(X),xe=(oe.utcOffset()-this.utcOffset())*o,_e=this-oe,Pe=function(){return K.m(le,oe)};switch(ae){case B:J=Pe()/12;break;case y:J=Pe();break;case I:J=Pe()/3;break;case C:J=(_e-xe)/6048e5;break;case x:J=(_e-xe)/864e5;break;case _:J=_e/u;break;case p:J=_e/o;break;case m:J=_e/i;break;default:J=_e}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[z],re.Ls=Z,re.p={},re})})(ia);var Wd=ia.exports;const oa=ra(Wd),Xd=a=>{const l=Ne.useRouter(),i=`${a.domain}/api/`,o=Ye.create({baseURL:i}),u=Ye.create({baseURL:i}),f=Ye.create({baseURL:i}),m=Ye.create({baseURL:i}),p=Ye.create({baseURL:i}),_=Ye.create({baseURL:i}),x=Ye.create({baseURL:i}),C=D=>{try{const M=JSON.parse(localStorage.getItem("authTokensAccess")||"");M.length>0&&(D.headers.Authorization=`Bearer ${M}`)}catch{console.warn("accessToken is undefined [useAxios]")}return D},y=D=>{const M=localStorage.getItem("apiKey");return D.headers={"Content-Type":"application/json","x-api-key":M},D},I=async D=>{if(!a.user)return D;const M=a.user.exp??0;if(!(oa.unix(M).diff(oa())<3e3))return D;const z=gs("authTokensRefresh",null,"string");try{const Z=await Ye.post(`${i}user/token/refresh/`,{refresh:z.value});if(!Z.data.access)return P(),D;localStorage.setItem("authTokensAccess",JSON.stringify(Z.data.access)),v(Z.data),k(ms(Z.data.access)),D.headers={...D.headers,Authorization:`Bearer ${Z.data.access}`}}catch(Z){console.error("Failed to refresh token:",Z),P()}return D},B=D=>{D.interceptors.request.use(M=>I(C(M)),M=>Promise.reject(M))};B(f),B(p),B(x);const T=D=>{D.interceptors.request.use(M=>y(M))};T(_),T(u),T(x);const v=(D,M=!1)=>{localStorage.setItem("authTokensAccess",JSON.stringify(D.access)),M&&localStorage.setItem("authTokensRefresh",JSON.stringify(D.refresh))},k=D=>{a.user=D,localStorage.setItem("user",JSON.stringify(D))},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:o,axiosInstanceGetApiKey:u,axiosInstancePostApiKey:_}},sa=(a="themeConfig")=>{try{const l=localStorage.getItem(a);return l?JSON.parse(l):null}catch{return null}},Ge=class Ge{constructor(){ke(this,"axiosInstanceGet");ke(this,"axiosInstancePost");ke(this,"axiosInstanceAuthenticationGet");ke(this,"axiosInstanceAuthenticationPost");ke(this,"axiosInstanceGetApiKey");ke(this,"axiosInstancePostApiKey");ke(this,"axiosInstanceAuthenticationPostApiKey");ke(this,"currentUpsaleController",null);ke(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 o=lt(),u=Ut(),{config_lib:f}=we.storeToRefs(o),{stateCard:m,recountGroupTotalAmount:p}=we.storeToRefs(u);Ge._config=l,Ge._cardStore=u,Ge._stateCard=m,Ge._recountGroupTotalAmount=p,f.value=l;const _=Xd(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=sa(),i=bt();if(l!==null){i.updateColor(l);return}const o=lt(),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 Rl(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 Dr(_.id,_),p.push(_);const x=await this.loadGroupProducts(_.id);_.products=x}return await this.cacheImagesInBackground(m),await Dr(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 fr(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=lt(),{config_lib:o}=we.storeToRefs(i);try{let f=await os(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=Ut();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,p){var v,k,P,D,M;const _=vt(),x=f?this.axiosInstanceAuthenticationPostApiKey:this.axiosInstancePostApiKey,C=o?x:this.axiosInstanceAuthenticationPost,y=o?"/device/order/create":"/order/create",I=o?(v=this.config)==null?void 0:v.pointId:(k=this.config)==null?void 0:k.pointId,B={items:l,comment:u,locator:p||void 0};return i&&(B.table=i),o&&((P=_.selectedOrderType)!=null&&P.id)&&(B.order_type_id=(D=_.selectedOrderType)==null?void 0:D.id),await(C==null?void 0:C.post(`${(M=this.config)==null?void 0:M.domain}/api/org_unit/${I}${y}`,B,{signal:m}))}async extendOrder(l){var m,p;const i=Ln();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=lt(),f=Ln(),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=lt();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=lt(),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=vt(),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=Ut(),{dataUpSale:o}=we.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)}}};ke(Ge,"_config",null),ke(Ge,"_axiosGet"),ke(Ge,"_axiosGetApiKey"),ke(Ge,"_axiosPostApiKey"),ke(Ge,"_axiosAuthPostApiKey"),ke(Ge,"_axiosPost"),ke(Ge,"_axiosAuthGet"),ke(Ge,"_axiosAuthPost"),ke(Ge,"_cardStore",null),ke(Ge,"_stateCard",null),ke(Ge,"_recountGroupTotalAmount",null);let bn=Ge;const aa=r.ref(!1),zn=()=>{const{width:a}=mt.useWindowSize(),l=r.computed(()=>aa.value),i=r.computed(()=>l.value&&a.value>1024);return{isDesktop:l,shouldUseDragScroll:i,syncWithRoute:u=>{var f;aa.value=((f=u.query)==null?void 0:f.mode)==="pdf"}}},$d=r.defineComponent({__name:"UseScrollCenter",props:{axis:{},behavior:{},autoScroll:{type:Boolean},container:{},idActive:{},clearContainer:{type:Boolean}},setup(a,{expose:l}){const i=a,o=lt(),u=r.ref(null),{isDesktop:f}=zn(),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))}}),He=(a,l)=>{const i=a.__vccOpts||a;for(const[o,u]of l)i[o]=u;return i},ho=He($d,[["__scopeId","data-v-e47a167d"]]),Wr={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)},v=P=>{if(!l)return;const D=P.pageX,M=P.pageY,j=Math.abs(D-i),z=Math.abs(M-o);if(!I&&(j>B||z>B)&&(I=!0,a.style.pointerEvents="none"),I){P.stopPropagation(),P.preventDefault();const Z=Date.now(),V=Z-y;V>0&&(p=(D-x)/V*16,_=(M-C)/V*16),x=D,C=M,y=Z;const L=D-a.offsetLeft,F=M-a.offsetTop,re=L-i,K=F-o;a.scrollLeft=u-re,a.scrollTop=f-K}else x=D,C=M,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 D=()=>{a.scrollLeft-=p,a.scrollTop-=_,p*=.95,_*=.95,Math.abs(p)>.1||Math.abs(_)>.1?m=requestAnimationFrame(D):m=0};m=requestAnimationFrame(D)}}else a.style.pointerEvents="";l=!1,I=!1}};a.addEventListener("mousedown",T),window.addEventListener("mousemove",v),window.addEventListener("mouseup",k),a._dragScrollCleanup=()=>{m&&cancelAnimationFrame(m),a.removeEventListener("mousedown",T),window.removeEventListener("mousemove",v),window.removeEventListener("mouseup",k),a.style.pointerEvents=""}},unmounted(a){a._dragScrollCleanup&&a._dragScrollCleanup()}},jd={},qd={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 Zd(a,l){return r.openBlock(),r.createElementBlock("svg",qd,[...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 Ei=He(jd,[["render",Zd]]),Yd=["id","onClick"],Kd={class:"modified_plus_btn"},Qd=["src"],Jd={key:2,class:"wrapper_modifier_item"},eu={key:0,class:"modifier_item_n_wrapper"},tu=["src"],nu={key:1,class:"modifier_plus_item"},ru=["src"],iu=["src"],la=He(r.defineComponent({__name:"PlusModifier",props:{isSectionModifier:{type:Boolean},toggleNotRequire:{type:Function}},setup(a){const l=Ut(),i=bt(),{stateCard:o}=we.storeToRefs(l),{itemThemes:u}=we.storeToRefs(i),{shouldUseDragScroll:f}=zn(),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 v;if(!B)return;await r.nextTick();const T=m.value.find(k=>k.id==="scrolling"+B);T&&((v=x.value)==null||v.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:v})=>[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(r.unref(o).groupModifiers,(k,P)=>{var D,M;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),v(j)}},[r.createElementVNode("div",Kd,[p.value[P].modifiers.length===0?(r.openBlock(),r.createElementBlock("div",{key:0,class:r.normalizeClass([{modified_plus_btn_active:k.id===((D=r.unref(o).groupCurrentOpen)==null?void 0:D.id)&&a.isSectionModifier},"modified_plus_active"])},[r.createVNode(Ei,{"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===((M=r.unref(o).groupCurrentOpen)==null?void 0:M.id)&&a.isSectionModifier}])},[r.createElementVNode("img",{src:p.value[P].modifiers[0].image_link||r.unref(u).fallback_image||"",alt:"Модификатор"},null,8,Qd)],2)):(r.openBlock(),r.createElementBlock("div",Jd,[p.value[P].modifiers.length>2?(r.openBlock(),r.createElementBlock("div",eu,[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,tu)):(r.openBlock(),r.createElementBlock("p",nu," + "+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,ru)):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,iu)):r.createCommentVNode("",!0)])]))]),r.createElementVNode("p",null,r.toDisplayString(k.name),1)],8,Yd)}),128))]),_:1},8,["container","idActive"])],2)),[[r.unref(Wr),r.unref(f)?{}:!1]]):r.createCommentVNode("",!0)],2))}}),[["__scopeId","data-v-7f238435"]]),ou={width:"24",height:"24",viewBox:"0 0 24 24",id:"custom_svg_lib",fill:"none",xmlns:"http://www.w3.org/2000/svg"},su=["stroke"],mo=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",ou,[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,su)]))}}),au={},lu={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 cu(a,l){return r.openBlock(),r.createElementBlock("svg",lu,[...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=He(au,[["render",cu]]),Cr={mounted(a){a.muted=!0,a.setAttribute("muted","")}},du=["disabled","id"],cn=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,du))}}),uu={class:"notification_info"},fu={key:0,class:"notification_18plus"},hu={class:"notification_18plus_image"},mu=["src"],gu={class:"notification_18plus_text"},pu={class:"notification_18plus_accept"},xu={key:1,class:"notification_text"},_u={key:0,class:"wrapper_button_accept"},yi=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=bt(),o=lt(),{is18Allowed:u,notificationData_lib:f}=we.storeToRefs(o),{itemThemes:m}=we.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,v,k],[P,D])=>{x&&(!T||T!==P||v!==D)&&clearTimeout(x),k&&T&&(x=setTimeout(B,4e3))},{immediate:!0}),r.onUnmounted(()=>{x&&B()}),(T,v)=>(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",uu,[a.type?(r.openBlock(),r.createElementBlock("div",fu,[r.createElementVNode("div",hu,[r.createElementVNode("img",{src:r.unref(m).adult_disclaimer_image||r.unref(m).fallback_image,alt:"Дисклеймер"},null,8,mu)]),r.createElementVNode("div",gu,r.toDisplayString(r.unref(m).adult_disclaimer_text),1),r.createElementVNode("div",pu,[v[0]||(v[0]=r.createElementVNode("label",{for:"plus18"},"Содержащиеся в настоящем разделе материалы предназначены для лиц старше 18 лет, носят информационный характер об ассортименте товаров и не являются рекламой. ",-1)),r.createVNode(cn,{textButtonDefault:"Мне есть 18",onClick:y,style:{fontSize:"1rem",padding:"6px 24px",marginLeft:"10px"}})])])):(r.openBlock(),r.createElementBlock("div",xu,[r.createTextVNode(r.toDisplayString(a.textNotificationDefault)+" ",1),(k=a.buttonAccept)!=null&&k.state?(r.openBlock(),r.createElementBlock("div",_u,[r.createVNode(cn,{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))}}),wu={class:"wrapper_modifiers"},Cu={class:"wrapper_nutritional_value"},Eu={class:"nutritional_scheme"},yu={key:0,class:"nutritional_parameters"},bu={key:1,class:"nutritional_parameters"},Au={key:2,class:"nutritional_parameters"},Su={key:3,class:"nutritional_parameters"},Iu={ref:"modifierBody",class:"modifier_shadow"},Nu={class:"wrapper_modifiers_title"},Tu={class:"wrapper_text_count_modifiers"},ku=["id","aria-label","onClick"],Ru={key:0,class:"counter_modifier"},Bu={class:"hide_image_corners"},Ou=["src","alt"],Mu={key:1,loop:"",autoplay:"",muted:"",playsinline:"",class:"card__video"},Du=["src"],vu={class:"modifier_title"},Pu={key:0,class:"modifier_continue_or_add_wrapper"},Lu=He(r.defineComponent({__name:"SectionModifiers",emits:["close","add-to-cart"],setup(a,{emit:l}){const i=l,o=bt(),u=Ut(),{itemThemes:f}=we.storeToRefs(o),{stateCard:m,recountGroupTotalAmount:p,groupTotalAmount:_,isLastGroup:x}=we.storeToRefs(u),{isDesktop:C,shouldUseDragScroll:y}=zn(),I=r.ref(null),B=mt.useTemplateRefsList(),T=r.ref(!1),v=D=>{if(!D)return;const M=m.value.groupModifiers.findIndex(L=>L.id===m.value.groupCurrentOpen.id),j=m.value.plusButtonsRefs[M]||m.value.plusButtonsRefs[0];if(!j)return;const z=D.getBoundingClientRect(),Z=j.getBoundingClientRect(),V=D.cloneNode(!0);V.classList.add("flyer"),Object.assign(V.style,{width:`${z.width}px`,height:`${z.height}px`,left:`${z.left}px`,top:`${z.top}px`,position:"fixed",zIndex:"1000"}),document.body.appendChild(V),I.value=V,requestAnimationFrame(()=>{const L=Z.left+Z.width/3-(z.left+z.width/2),F=Z.top+Z.height/4-(z.top+z.height/2),re=Z.width/z.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 D=m.value.groupCurrentOpen;if(!D)return;const M=m.value.groupModifiers.findIndex(z=>z.id===D.id),j=u.validateGroup(M);if(!j.valid){m.value.textErrorRequaired=j.errorText,T.value=!0;return}x.value?i("add-to-cart"):u.toggleNotRequire(D,void 0,!0)};r.watch(()=>m.value.isAnimationFly,D=>{D===!0&&m.value.currentModifier&&(v(B.value.find(M=>M.id===m.value.currentModifier.id)),m.value.isAnimationFly=!1)});const P=r.computed(()=>!f.value.enable_sequential_modifiers);return(D,M)=>{var j,z,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(yi,{visible:T.value,textNotificationDefault:r.unref(m).textErrorRequaired,backgroundColor:r.unref(f).accent_color?r.unref(f).accent_color:"#FF6D2E","onUpdate:visible":M[0]||(M[0]=q=>T.value=q)},null,8,["visible","textNotificationDefault","backgroundColor"])])),r.createElementVNode("div",wu,[r.createElementVNode("div",Cu,[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:M[1]||(M[1]=q=>i("close"))},[r.createVNode(wr,{class:"arrow_bottom"})],2),r.createElementVNode("div",Eu,[(z=r.unref(m).openCard)!=null&&z.energy_amount?(r.openBlock(),r.createElementBlock("div",yu,[r.createElementVNode("b",null,r.toDisplayString((Z=r.unref(m).openCard)==null?void 0:Z.energy_amount),1),M[4]||(M[4]=r.createElementVNode("p",null,"Килокалории",-1))])):r.createCommentVNode("",!0),(V=r.unref(m).openCard)!=null&&V.proteins_amount?(r.openBlock(),r.createElementBlock("div",bu,[r.createElementVNode("b",null,r.toDisplayString((L=r.unref(m).openCard)==null?void 0:L.proteins_amount),1),M[5]||(M[5]=r.createElementVNode("p",null,"Белки",-1))])):r.createCommentVNode("",!0),(F=r.unref(m).openCard)!=null&&F.fat_amount?(r.openBlock(),r.createElementBlock("div",Au,[r.createElementVNode("b",null,r.toDisplayString((re=r.unref(m).openCard)==null?void 0:re.fat_amount),1),M[6]||(M[6]=r.createElementVNode("p",null,"Жиры",-1))])):r.createCommentVNode("",!0),(K=r.unref(m).openCard)!=null&&K.carbohydrates_amount?(r.openBlock(),r.createElementBlock("div",Su,[r.createElementVNode("b",null,r.toDisplayString((ee=r.unref(m).openCard)==null?void 0:ee.carbohydrates_amount),1),M[7]||(M[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:M[2]||(M[2]=q=>i("close"))},[r.createVNode(mo,{class:"cross_bottom"})],2)]),r.createElementVNode("div",Iu,[r.createElementVNode("p",Nu,r.toDisplayString((W=r.unref(m).groupCurrentOpen)==null?void 0:W.name),1),r.createElementVNode("p",Tu,"Выбрано "+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,ae;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 xe;return oe.group===((xe=r.unref(m).groupCurrentOpen)==null?void 0:xe.id)&&oe.modifiers.some(_e=>_e.id===q.id)})},"wrapper_image_corners"])},[q.amount>1?(r.openBlock(),r.createElementBlock("div",Ru,r.toDisplayString(q.amount),1)):r.createCommentVNode("",!0),r.createElementVNode("div",Bu,[q.video_link?r.withDirectives((r.openBlock(),r.createElementBlock("video",Mu,[r.createElementVNode("source",{src:q.video_link||"",type:"video/webm"},null,8,Du)])),[[r.unref(Cr)]]):(r.openBlock(),r.createElementBlock("img",{key:0,class:"modifier_image",src:q.image_link||r.unref(f).fallback_image||"",alt:q.name},null,8,Ou)),r.createElementVNode("div",{class:r.normalizeClass(["wrapper_modifier_title",{wrapper_modifier_title_required:q.min_amount>0||q.required}])},[r.createElementVNode("h3",vu,r.toDisplayString(q.name),1),r.createElementVNode("p",null,"+"+r.toDisplayString(((ae=(le=q.sizes)==null?void 0:le.find(oe=>oe.id===r.unref(m).selectedSize.id))==null?void 0:ae.price)||q.price||0)+"₽",1)],2)])],2)],14,ku)}),128))],2)),[[r.unref(Wr),($=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",Pu,[r.createElementVNode("button",{onClick:M[3]||(M[3]=q=>k()),class:"modifier_continue_or_add"},r.toDisplayString(r.unref(x)?"Добавить":"Продолжить"),1)])):r.createCommentVNode("",!0)],512)])],64)}}}),[["__scopeId","data-v-b3aaf5bc"]]),Fu={key:0,class:"slider_container"},Vu={key:0,class:"card_size_place"},Uu=["onClick","aria-label"],zu={key:1,class:"card_size static"},Hu=["onClick"],go=3,Gu=He(r.defineComponent({__name:"SizeModifier",setup(a){const l=Ut(),{stateCard:i}=we.storeToRefs(l),{width:o}=mt.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,go)}),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 D;if(i.value.productSizes.length<4)return i.value.productSizes[f.value.index]||i.value.productSizes[0];const k=m.value+1,P=((D=y.value[k])==null?void 0:D.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,D)=>({...P,originalIndex:D})),...k.map((P,D)=>({...P,originalIndex:D})),...k.map((P,D)=>({...P,originalIndex:D}))]}),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 D=m.value+1;P<D?B():P>D&&T()}else{const D=i.value.productSizes.length,M=P*(100/D);u.value=M}},B=()=>{var k;if(!(i.value.productSizes.length<4)){if(m.value--,m.value<i.value.productSizes.length-go+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")}v()}},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")}v()}},v=()=>{var M;if(i.value.productSizes.length<4)return;const k=m.value+1,P=((M=y.value[k])==null?void 0:M.originalIndex)??0,D=i.value.productSizes[P];f.value={id:D.id,title:D.name,index:P,is_default:D.is_default}};return r.watch([()=>i.value.productSizes,p],([k=[],P])=>{if(Array.isArray(k)&&k.length>0){let D=k.findIndex(M=>M.is_default===!0);D>-1?(m.value=D,I(k[D],D)):k.length>go?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 D=P.map(M=>({...M,modifiers:M.modifiers.map(j=>{if(!j.sizes||j.sizes.length===0)return j;const z=j.sizes.find(Z=>Z.id===k);return z?{...j,size:z,price:z.price??j.price}:j})}));JSON.stringify(D)!==JSON.stringify(i.value.groupModifiersSelected)&&(i.value.groupModifiersSelected=D)},{deep:!0}),(k,P)=>r.unref(i).productSizes.length>1&&f.value?(r.openBlock(),r.createElementBlock("div",Fu,[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",Vu,[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,(D,M)=>(r.openBlock(),r.createElementBlock("li",{key:`${D.id}-${M}`,onClick:j=>I(D,M),class:r.normalizeClass({active:f.value.id===D.id&&f.value.index===D.originalIndex}),tabindex:"0",role:"button","aria-label":`Выбрать размер ${D.name}`},[r.createElementVNode("p",null,r.toDisplayString(D.alt_name?D.alt_name:D.name),1)],10,Uu))),128))],4)):(r.openBlock(),r.createElementBlock("ul",zu,[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(r.unref(i).productSizes,(D,M)=>(r.openBlock(),r.createElementBlock("li",{key:`${D.id}-${M}`,onClick:j=>I(D,M),class:r.normalizeClass({active:f.value.id===D.id&&f.value.index===M}),tabindex:"0",role:"button"},[r.createElementVNode("p",null,r.toDisplayString(D.alt_name?D.alt_name:D.name),1)],10,Hu))),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-75aa7dcd"]]),Wu="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",Xu={class:"counter_container"},$u={class:"card_size_place_wrapper",ref:"sliderWrapper"},ju={class:"cart_amount_counter"},qu={class:"button_circle_number"},Zu=He(r.defineComponent({__name:"NumberModifier",props:{qr_menu:{type:Boolean}},setup(a){const l=Ut(),{stateCard:i}=we.storeToRefs(l),o=Ne.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",Xu,[r.createElementVNode("div",$u,[r.createElementVNode("div",ju,[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",qu,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 po(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 gt=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}=po(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))}}),Yu={class:"button_price button_price_modifiers"},Ku=["src"],Qu={class:"button_text_container"},Ju={class:"button_text_price"},e0=He(r.defineComponent({__name:"ButtonPriceCount",props:{qr_menu:{type:Boolean,default:!1},closeProduct:{}},setup(a,{expose:l}){const i=Ne.useRouter(),o=Ne.useRoute(),u=Ut(),f=lt(),m=bt(),p=a,{stateCard:_,totalPrice_libCard:x,isOpenWindow:C,isAddToCard:y}=we.storeToRefs(u),{isDesktop:I}=zn(),{itemThemes:B}=we.storeToRefs(m),T=r.ref(!0),v=r.ref(!1),k=r.computed(()=>I.value?!1:T.value),P=r.ref([]),D=r.ref([]),M=()=>{var z,Z,V,L,F;if((Z=(z=i.options.history.state)==null?void 0:z.back)!=null&&Z.includes("mode=pdf")&&p.qr_menu)return;if(T.value){u.setCurrentCard(_.value.openCard),v.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=[],D.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&&D.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:D.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:M}),(j,z)=>(r.openBlock(),r.createElementBlock(r.Fragment,null,[(r.openBlock(),r.createBlock(r.Teleport,{to:"body"},[r.createVNode(yi,{visible:v.value,textNotificationDefault:r.unref(_).textErrorRequaired,backgroundColor:r.unref(B).accent_color?r.unref(B).accent_color:"#FF6D2E",buttonAccept:null,"onUpdate:visible":z[0]||(z[0]=Z=>v.value=Z)},null,8,["visible","textNotificationDefault","backgroundColor"])])),r.createElementVNode("div",{class:"button_price_bg_product",onTouchstart:z[3]||(z[3]=r.withModifiers(()=>{},["stop"])),onPointerdown:z[4]||(z[4]=r.withModifiers(()=>{},["stop"]))},[r.createElementVNode("div",Yu,[r.unref(I)?r.createCommentVNode("",!0):(r.openBlock(),r.createBlock(Zu,{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:M,onTouchstart:z[1]||(z[1]=r.withModifiers(()=>{},["stop"])),onPointerdown:z[2]||(z[2]=r.withModifiers(()=>{},["stop"]))},[r.unref(I)?r.createCommentVNode("",!0):(r.openBlock(),r.createElementBlock("img",{key:0,src:r.unref(Wu),class:"card_product_button_icon"},null,8,Ku)),r.createElementVNode("div",Qu,[r.createElementVNode("p",Ju,[r.createVNode(gt,{price:+r.unref(x),fixedFloat:2},null,8,["price"]),z[5]||(z[5]=r.createTextVNode(" ₽ ",-1))])])],34)])],32)],64))}}),[["__scopeId","data-v-15db613c"]]),t0={class:"modified_amount"},n0={class:"hide_image_corners"},r0=["src"],i0={class:"wrapper_modifier_title"},o0={class:"amount_title"},s0={class:"wrapper_amount_counter"},a0={class:"amount_count"},l0={class:"amount_wrapper"},c0={class:"add_counter_amount"},d0=He(r.defineComponent({__name:"ModalAmount",setup(a){const l=Ut(),i=bt(),{itemThemes:o}=we.storeToRefs(i),{stateCard:u}=we.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",t0,[r.createElementVNode("div",n0,[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,r0),r.createElementVNode("div",i0,[r.createElementVNode("p",o0,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",s0,[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",a0,r.toDisplayString(r.unref(u).modalCount),1),r.createElementVNode("div",l0,[r.createVNode(Ei,{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",c0,[r.createVNode(cn,{textButtonDefault:"Добавить",onClick:m,class:"button_add_group_modifiers"})])],64)}}}),[["__scopeId","data-v-84debd5d"]]),xo=He(r.defineComponent({__name:"SystemNotification",setup(a){const l=bt(),i=r.useTemplateRef("el"),o=r.computed(()=>{var f,m;return(m=(f=l==null?void 0:l.itemThemes)==null?void 0:f.system_notification_text)==null?void 0:m.length}),{height:u}=mt.useElementBounding(i);return r.watch(u,f=>{document.body.style.setProperty("--system-notification-height",`${f||0}px`)}),(f,m)=>o.value?(r.openBlock(),r.createElementBlock("div",{key:0,ref_key:"el",ref:i,class:"system_notification"},r.toDisplayString(r.unref(l).itemThemes.system_notification_text),513)):r.createCommentVNode("",!0)}}),[["__scopeId","data-v-7d34b686"]]),u0=(a,l,i)=>Math.max(l,Math.min(a,i)),f0=(a,l)=>Math.pow(a,l*5),ca=(a,l,i)=>l===0||Math.abs(l)===1/0?f0(a,i):a*l*i/(l+i*a),bi=(a,l)=>l*parseFloat(a)/100,_o=(a,l,i,o=.15)=>o===0?u0(a,l,i):a<l?-ca(l-a,i-l,o)+l:a>i?+ca(a-i,i-l,o)+i:a,dn=(a,{min:l,max:i})=>l!==void 0&&a<l?l:i!==void 0&&a>i?i:a;function h0(a,l,i){const o=r.ref(0),u=r.computed(()=>a.value.map(_=>typeof _=="string"?bi(_,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 wo=He(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),_=mt.useVModel(o,"modelValue",u,{passive:!0});r.watch(_,Ae=>{Ae?oe():xe||_e()}),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:v}=mt.useWindowSize(),{height:k}=mt.useElementBounding(x),{height:P}=mt.useElementBounding(C),{height:D}=mt.useElementBounding(B),{height:M}=mt.useElementBounding(y),j=r.computed({get(){return dn(Math.ceil(D.value+P.value+M.value),{max:v.value})},set(Ae){[P.value,D.value,M.value]=Ae}}),z=r.ref(0),Z=r.ref(0),V=Dt.useMotionValue(0),L=Dt.useMotionValue(0),{snapPoints:F}=r.toRefs(o),re=r.computed(()=>F.value??[j.value]),{flattenedSnapPoints:K,currentSnapPointIndex:ee,closestSnapPointIndex:G,minSnapPoint:W,maxSnapPoint:N}=h0(re,z,v);let X;function $(Ae){T.value=!0,q(Ae)}function q(Ae){T.value&&Ae.preventDefault()}const J=Ae=>{Ae.key==="Escape"&&_e()},le=()=>{o.canBackdropClose&&_e()};let ae=!1;const oe=async()=>{var Ae;if(!ae){xe&&(xe=!1,f&&(clearTimeout(f),f=null)),m.value++,_.value=!0,ae=!0,u("opening-started");try{await r.nextTick(),await r.nextTick();const Be=(Ae=x.value)==null?void 0:Ae.$el;if(!Be){console.warn("[BottomSheet] sheet not ready, aborting"),_.value=!1;return}k.value=Be.getBoundingClientRect().height;const Ke=Be.querySelector("[data-vsbs-content]"),it=Be.querySelector("[data-vsbs-header]"),et=Be.querySelector("[data-vsbs-footer]");if(j.value=[it.getBoundingClientRect().height,Ke.getBoundingClientRect().height,et.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");z.value=typeof re.value[ve]=="number"?dn(re.value[ve],{max:v.value}):bi(re.value[ve],v.value)}else z.value=dn(W.value,{max:v.value});Z.value=z.value,V.jump(z.value),L.jump(z.value),requestAnimationFrame(()=>{X=Dt.animate(V,z.value,{duration:o.duration/1e3,ease:"easeInOut"}),X=Dt.animate(L,0,{duration:o.duration/1e3,ease:"easeInOut",onComplete:()=>{o.blocking&&u("opened")}})}),window.addEventListener("keydown",J)}finally{ae=!1}}};let xe=!1;const _e=()=>{xe||(ae&&(ae=!1),X&&X.stop(),L.stop(),V.stop(),Dt.animate(L,z.value||500,{duration:o.duration/1e3,ease:"easeInOut"}),p.value=!1,_.value=!1,xe=!0,u("closing-started"),window.removeEventListener("keydown",J),f&&clearTimeout(f),f=setTimeout(()=>{u("closed"),xe=!1,f=null},o.duration))},Pe=Ae=>{if(re.value){if(Ae<0||Ae>=re.value.length){console.warn("Index out of bounds");return}ee.value=Ae,z.value=typeof re.value[Ae]=="number"?dn(re.value[Ae],{max:v.value}):bi(re.value[Ae],v.value),X=Dt.animate(V,z.value,{duration:o.duration/1e3,ease:"easeInOut",onComplete:()=>u("snapped",re.value.indexOf(re.value[Ae]))})}};function he(Ae){Ae>0?u("dragging-down"):Ae<0&&u("dragging-up")}const qe=()=>{p.value=!0,z.value=k.value,Z.value=L.get(),V.jump(z.value),L.jump(Z.value)},ye=async(Ae,Be)=>{await r.nextTick(),x.value&&(Z.value<=0&&(z.value-=Be.delta.y),z.value<=W.value&&(z.value=W.value,Z.value+=Be.delta.y,p.value=!0,L.set(o.canSwipeClose?dn(Z.value,{min:0}):dn(_o(Z.value,-k.value,0,.5),{min:0}))),V.set(dn(_o(z.value,0,N.value,.25),{min:0,max:v.value})),he(Be.delta.y))},Qe=()=>{if(o.canSwipeClose){let Ae=z.value/2;o.swipeCloseThreshold&&typeof o.swipeCloseThreshold=="number"&&(Ae=o.swipeCloseThreshold),o.swipeCloseThreshold&&typeof o.swipeCloseThreshold=="string"&&o.swipeCloseThreshold.includes("%")&&(Ae=z.value*(Number(o.swipeCloseThreshold.replace("%",""))/100)),Math.abs(Z.value)>Ae&&(Z.value=z.value)}else Z.value=0;if(X=Dt.animate(L,Z.value,{duration:o.duration/1e3,ease:"easeInOut"}),Z.value===z.value){Z.value=0,_e();return}ee.value=G.value,z.value=typeof re.value[G.value]=="number"?dn(re.value[G.value],{max:v.value}):bi(re.value[G.value],v.value),X=Dt.animate(V,z.value,{duration:o.duration/1e3,ease:"easeInOut",onComplete:()=>u("snapped",re.value.indexOf(re.value[G.value]))}),X=Dt.animate(L,0,{duration:o.duration/1e3,ease:"easeInOut"})},ct=(Ae,Be)=>{if(z.value=k.value,Z.value=L.get(),X&&X.stop(),!I.value)return;const Ke=I.value.scrollTop===0,it=Be.delta.y>0,et=K.value.length===1,ve=.5>Math.abs(z.value-N.value);if(et){if(!o.expandOnContentDrag)return T.value=!1;L.get()===0&&Ke&&it&&(T.value=!0),L.get()===0&&Ke&&!it&&(T.value=!1)}else{if(!o.expandOnContentDrag)return T.value=!1;p.value=!0,T.value=!0,ve&&(it&&Ke&&(T.value=!0),!it&&Ke&&(T.value=!1),Ke||(T.value=!1))}},tt=async(Ae,Be)=>{if(await r.nextTick(),!o.expandOnContentDrag)return T.value=!1;if(!x.value)return;Z.value===0&&T.value&&o.expandOnContentDrag&&(z.value-=Be.delta.y),z.value<=W.value&&(z.value=W.value,T.value&&o.expandOnContentDrag&&(Z.value+=Be.delta.y),Z.value=dn(Z.value,{min:0,max:W.value}),L.set(o.canSwipeClose?dn(Z.value,{min:0}):dn(_o(Z.value,-k.value,0,.5),{min:0}))),z.value>N.value&&(z.value=N.value),z.value=dn(z.value,{max:v.value}),!(K.value.length===1)&&z.value===N.value&&(T.value=!1),V.set(z.value),he(Be.delta.y)},_t=()=>{if(!I.value)return;const Ae=I.value.scrollTop===0;T.value=Ae},De=mt.useDebounceFn(Ae=>Pe(Ae),o.duration);return r.watch(re,(Ae,Be)=>{if(_.value===!1||!Ae||!Be)return;const Ke=Ae[ee.value],it=Be[ee.value];typeof Ke!="string"&&typeof it!="string"&&(z.value=dn(Ke,{max:v.value}),Ke!==it&&(X=Dt.animate(V,z.value,{duration:o.duration/1e3,ease:"easeInOut"})))}),r.watch(v,()=>De(ee.value)),l({open:oe,close:_e,snapToPoint:Pe}),r.onUnmounted(()=>{f&&clearTimeout(f)}),(Ae,Be)=>(r.openBlock(),r.createBlock(r.Teleport,{to:a.teleportTo,defer:a.teleportDefer},[r.createElementVNode("div",r.mergeProps(Ae.$attrs,{"data-vsbs-container":""}),[r.createVNode(r.unref(Dt.AnimatePresence),null,{default:r.withCtx(()=>[r.unref(_)&&a.blocking?(r.openBlock(),r.createBlock(r.unref(Dt.Motion),{ref:"backdrop",key:"backdrop-"+m.value,"data-vsbs-backdrop":"",onClick:Be[0]||(Be[0]=Ke=>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(Dt.AnimatePresence),null,{default:r.withCtx(()=>[r.unref(_)?(r.openBlock(),r.createBlock(r.unref(Dt.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(Dt.Motion),{ref_key:"sheetHeader",ref:C,"data-vsbs-header":"",onPanStart:qe,onPan:ye,onPanEnd:Qe,onTouchmove:$,class:r.normalizeClass(a.headerClass)},{default:r.withCtx(()=>[r.renderSlot(Ae.$slots,"header",{},void 0,!0)]),_:3},8,["class"]),r.createElementVNode("div",{ref_key:"sheetScroll",ref:I,"data-vsbs-scroll":"",onScrollend:_t},[r.createVNode(r.unref(Dt.Motion),{ref:"sheetContentWrapper","data-vsbs-content-wrapper":"",onPanStart:ct,onPan:tt,onPanEnd:Qe,onTouchmove:q},{default:r.withCtx(()=>[r.createElementVNode("div",{ref_key:"sheetContent",ref:B,"data-vsbs-content":"",class:r.normalizeClass(a.contentClass)},[r.renderSlot(Ae.$slots,"default",{},void 0,!0)],2)]),_:3},512)],544),r.createVNode(r.unref(Dt.Motion),{ref_key:"sheetFooter",ref:y,"data-vsbs-footer":"",onPanStart:qe,onPan:ye,onPanEnd:Qe,onTouchmove:$,class:r.normalizeClass(a.footerClass)},{default:r.withCtx(()=>[r.renderSlot(Ae.$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 An(a,l=null){const i=ai();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=mt.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 m0={class:"card_product_modifiers_sheet_body"},g0={class:"card__pictures"},p0=["src"],x0=["src"],_0={class:"card_header_wrapper_container"},w0={class:"card_header_wrapper"},C0={key:0,class:"card_fire_kkal_wrapper"},E0={class:"card_content"},y0={class:"wrapper_size"},b0={key:0,class:"description"},A0={key:1},S0={class:"title_info_modifiers"},I0=He(r.defineComponent({__name:"CardProductPage",props:{configPage:{}},setup(a){const l=bt(),i=Ut(),{stateCard:o,isOpenWindow:u,isAddToCard:f}=we.storeToRefs(i),{itemThemes:m}=we.storeToRefs(l),p=Ne.useRouter(),_=Ne.useRoute(),x=a,C=r.computed(()=>!!(_.query.mode==="pdf"&&x.configPage.qr_menu)),{mediaUrl:y}=An(()=>{var P,D;return(P=o.value.openCard)!=null&&P.video_link?`${o.value.openCard.id}_video`:(D=o.value.openCard)!=null&&D.image_link?`${o.value.openCard.id}_image`:null},()=>{var P,D;return((P=o.value.openCard)==null?void 0:P.video_link)||((D=o.value.openCard)==null?void 0:D.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},v=r.ref(null),k=()=>{var P;(P=v.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,D)=>{var M,j,z,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(wo),{modelValue:r.unref(o).isSectionModifier,"onUpdate:modelValue":D[0]||(D[0]=F=>r.unref(o).isSectionModifier=F),class:"card_product_modifiers_sheet",teleportTo:C.value?"#app":"body"},{default:r.withCtx(()=>[r.createElementVNode("div",m0,[r.createVNode(Lu,{onClose:B,onAddToCart:k}),r.createVNode(la,{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(d0)])):r.createCommentVNode("",!0)])),r.createElementVNode("div",g0,[(M=r.unref(o).openCard)!=null&&M.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,p0)])),[[r.unref(Cr)]]):(r.openBlock(),r.createElementBlock("img",{key:1,class:"card__pictures_images",src:r.unref(y)||"",alt:"Product image"},null,8,x0)),r.createElementVNode("div",_0,[r.createVNode(xo),r.createElementVNode("div",w0,[r.createVNode(wr,{class:"card_header_back",onClick:I,"aria-label":"Вернуться назад"}),(j=r.unref(o).openCard)!=null&&j.energy_amount?(r.openBlock(),r.createElementBlock("div",C0,[D[2]||(D[2]=r.createElementVNode("div",{class:"card_fire_kkal"},null,-1)),r.createElementVNode("p",null,[r.createElementVNode("b",null,r.toDisplayString((z=r.unref(o).openCard)==null?void 0:z.energy_amount),1),D[1]||(D[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",E0,[r.createElementVNode("div",y0,[r.createVNode(Gu)]),(V=r.unref(o).openCard)!=null&&V.description?(r.openBlock(),r.createElementBlock("p",b0,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",A0,[r.createElementVNode("p",S0,r.toDisplayString(r.unref(m).dish_cart_mod_choice_text||"Настрой, как ты любишь"),1),r.createVNode(la,{isSectionModifier:r.unref(o).isSectionModifier,toggleNotRequire:r.unref(i).toggleNotRequire},null,8,["isSectionModifier","toggleNotRequire"])])):r.createCommentVNode("",!0),r.createVNode(e0,{ref_key:"buttonPriceRef",ref:v,qr_menu:a.configPage.qr_menu,closeProduct:a.configPage.closeProduct},null,8,["qr_menu","closeProduct"])])],4)}}}),[["__scopeId","data-v-43979f87"]]),Ai=we.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}}),N0={key:0,class:"popupWindowDefault_overlay"},da=He(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",N0,[r.renderSlot(f.$slots,"default",{},void 0,!0)])):r.createCommentVNode("",!0)]),_:3})],64))}}),[["__scopeId","data-v-08e0e008"]]),T0=["src"],k0={class:"cart_box_content_wrapper"},R0={class:"cart_box_content_info"},B0={class:"cart_box_name"},O0={class:"cart_box_size"},M0={class:"cart_amount"},D0={class:"cart_amount_count"},v0={class:"cart_box_info_more"},P0={key:1,class:"cart_modifier_info"},L0={class:"cart_modifier_content"},F0={class:"wrapper_price_count_cart"},V0={class:"count_cart_box"},U0={class:"wrapper_modifiers_discount"},ua=He(r.defineComponent({__name:"CartBox",props:{index:Number,cardItem:Object,isShowModifiers:Boolean},emits:["delete"],setup(a,{emit:l}){const i=a,o=lt(),u=bt(),f=Ai(),{itemThemes:m}=we.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}=po(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:v}=An(()=>{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)??hr(i.cardItem)*((re=i.cardItem)==null?void 0:re.amount)}),P=()=>f.open("cart-delete-confirm",i.cardItem),D=()=>{y.value=!y.value},M=()=>{o.plusAmount(i.cardItem.idSystem)},j=()=>{i.cardItem.amount>1?o.minusAmount(i.cardItem.idSystem):P()},z=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:z,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(v)||"",class:"cart_box_image"},null,8,T0),r.createElementVNode("div",k0,[r.createElementVNode("div",R0,[r.createElementVNode("p",B0,r.toDisplayString((K=a.cardItem)==null?void 0:K.name),1),r.createElementVNode("p",O0,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",M0,[r.createElementVNode("button",{onClick:j},"-"),r.createElementVNode("p",D0,r.toDisplayString(i.cardItem.amount),1),r.createElementVNode("button",{onClick:M},"+")])]),r.createElementVNode("div",v0,[r.createElementVNode("div",{class:"cart_box_remove_item",onClick:P},[r.createVNode(mo)]),($=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(D,["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",P0,[(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",L0,[r.createVNode(Ei,{id:"plus_orange"}),r.createElementVNode("p",null,r.toDisplayString(J.name),1)]),r.createElementVNode("div",F0,[r.createElementVNode("p",V0,r.toDisplayString(`x${J.amount}`),1),r.createElementVNode("div",U0,[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(D,["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"]]),z0={},H0={class:"nfc_x",viewBox:"0 0 48 48"};function G0(a,l){return r.openBlock(),r.createElementBlock("svg",H0,[...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 W0=He(z0,[["render",G0]]),X0={},$0={style:{},"aria-hidden":"true",viewBox:"0 0 48 48",class:"nfc_ok"};function j0(a,l){return r.openBlock(),r.createElementBlock("svg",$0,[...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 q0=He(X0,[["render",j0]]),Z0={key:0,class:"nfc_ok",viewBox:"0 0 48 48","aria-hidden":"true"},Y0=r.defineComponent({__name:"CardReaderRetry",props:{styleRetry:{type:Boolean}},setup(a){return(l,i)=>a.styleRetry?r.createCommentVNode("",!0):(r.openBlock(),r.createElementBlock("svg",Z0,[...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)])]))}}),K0={class:"sheet_header"},Q0={class:"sheet_title",id:"sheetTitle"},J0={class:"sheet_body"},e1={class:"sheet_card"},t1={class:"nfc_title"},n1={class:"lead"},r1={class:"wrapper_input_accept"},i1={key:1},o1={key:0,class:"card_phone_auth_wrapper"},s1={class:"sr_only","aria-live":"polite"},fa=r.defineComponent({__name:"CardReader",setup(a){const l=lt(),i=bt(),{is_OpenLoyal:o}=we.storeToRefs(l),{itemThemes:u}=we.storeToRefs(i),f=vt(),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}),v=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"),$}),D=r.computed(()=>y.value==="not_found"),M=r.computed(()=>y.value==="success"),j=r.computed(()=>y.value==="not_found"),z=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 bn;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",K0,[r.createElementVNode("div",Q0,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",J0,[r.createElementVNode("div",e1,[r.createElementVNode("div",{class:r.normalizeClass(["nfc",P.value])},[r.createVNode(Y0,{styleRetry:z.value},null,8,["styleRetry"]),D.value?(r.openBlock(),r.createBlock(W0,{key:0})):r.createCommentVNode("",!0),r.createElementVNode("div",{class:"overlay check",style:r.normalizeStyle({display:M.value?"grid":"none"}),"aria-hidden":"true"},[r.createVNode(q0)],4)],2),r.createElementVNode("h2",t1,r.toDisplayString(T.value),1),r.createElementVNode("p",n1,r.toDisplayString(v.value),1),r.createElementVNode("div",r1,[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",i1,[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",o1,[r.createElementVNode("button",{class:"card_phone_auth_button",onClick:V},"Войти по номеру телефона")])):r.createCommentVNode("",!0)])]),r.createElementVNode("div",s1,r.toDisplayString(Z.value),1)],2)):r.createCommentVNode("",!0)],64))}}),a1="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",l1=["src"],c1={class:"header_description"},d1=He(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=vt(),f=Ut(),{selectedProvider:m,isButtonDisabled:p}=we.storeToRefs(u),{isAddToCard:_}=we.storeToRefs(f),x={default:a1,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,l1),r.createElementVNode("div",c1,[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"]]),u1={key:0,class:"wrapper_cart_payment"},f1={class:"wrapper_paid"},h1={class:"to_be_paid"},m1=He(r.defineComponent({__name:"CartPayment",props:{configPage:{},comment:{},cartItems:{},isAuthorized:{type:Boolean},orderId:{},signal:{}},emits:["selectPayment"],setup(a,{emit:l}){const i=vt(),o=lt(),u=a,{totalPrice_lib:f,countBonus:m}=we.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",u1,[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(d1,{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",f1,[r.createElementVNode("p",h1,[y[0]||(y[0]=r.createTextVNode("К оплате ",-1)),r.createVNode(gt,{price:r.unref(f)-r.unref(m),fixedFloat:2},null,8,["price"]),y[1]||(y[1]=r.createTextVNode(" ₽",-1))]),r.createVNode(cn,{textButtonDefault:"Назад",onClick:x,class:"btn_payment"})])])):r.createCommentVNode("",!0)}}),[["__scopeId","data-v-f7657882"]]),g1={class:"start_page"},p1=["src"],x1={class:"wrap"},_1={class:"wrap_box"},w1={class:"title_fiscal_order"},C1={class:"wrapper_accept"},E1={ref:"barRef",class:"bar_complete","aria-hidden":"true"},y1=He(r.defineComponent({__name:"CartCompleteKioskSuccess",props:{mediaUrl:{},orderNumber:{}},setup(a){const l=lt(),i=vt(),o=Ut(),u=bt(),{cartProducts_lib:f}=we.storeToRefs(l),{orderNumber:m,orderCompleted_lib:p,selectedOrderType:_}=we.storeToRefs(i),{is_startPage:x}=we.storeToRefs(o),{mediaUrl:C}=An(()=>u.itemThemes.kiosk_preloader?"preloader":null),y=Ne.useRouter(),I=Ne.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=()=>{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(()=>{B&&clearInterval(B)}),(v,k)=>(r.openBlock(),r.createElementBlock("div",g1,[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,p1)])),[[r.unref(Cr)]]),k[4]||(k[4]=r.createElementVNode("div",{class:"start_img_black"},null,-1)),r.createElementVNode("div",x1,[r.createElementVNode("div",_1,[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",w1,"№ "+r.toDisplayString(r.unref(m)),1),k[3]||(k[3]=r.createElementVNode("p",{class:"title_fiscal_completed"},"Спасибо! Заказ передан в работу.",-1)),r.createElementVNode("div",C1,[r.createElementVNode("button",{class:"btn","aria-label":"Новый заказ",onClick:T},[k[0]||(k[0]=r.createElementVNode("span",{class:"label"},"Новый заказ",-1)),r.createElementVNode("span",E1,null,512)])])])])]))}}),[["__scopeId","data-v-79c00acf"]]),b1={class:"fiscal_wrapper"},A1=["src"],S1={class:"fiscal_container"},I1={class:"fiscal_stage","aria-hidden":"true"},N1={class:"fiscal_printer"},T1={class:"fiscal_receipt"},k1=["src"],R1=He(r.defineComponent({__name:"CartCompleteFiscal",setup(a){const l=bt(),{mediaUrl:i}=An(()=>l.itemThemes.kiosk_preloader?"preloader":null);return(o,u)=>(r.openBlock(),r.createElementBlock(r.Fragment,null,[r.createElementVNode("div",b1,[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,A1)])),[[r.unref(Cr)]])]),r.createElementVNode("div",S1,[r.createElementVNode("div",I1,[r.createElementVNode("div",N1,[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",T1,[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,k1),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"]]),B1={},O1={class:"center"};function M1(a,l){return r.openBlock(),r.createElementBlock("div",O1,[...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 D1=He(B1,[["render",M1],["__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,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},kn.apply(this,arguments)};typeof SuppressedError=="function"&&SuppressedError;var tr;(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 v=this.getPenaltyScore();v<T&&(C=I,T=v),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 v=m.getNumDataCodewords(B,_)*8,k=f.getTotalBits(p,B);if(k<=v){T=k;break}if(B>=C)throw new RangeError("Data too long")}for(var P=0,D=[m.Ecc.MEDIUM,m.Ecc.QUARTILE,m.Ecc.HIGH];P<D.length;P++){var M=D[P];I&&T<=m.getNumDataCodewords(B,M)*8&&(_=M)}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),v=[],k=m.reedSolomonComputeDivisor(y),P=0,D=0;P<C;P++){var M=p.slice(D,D+T-y+(P<B?0:1));D+=M.length;var j=m.reedSolomonComputeRemainder(M,k);P<B&&M.push(0),v.push(M.concat(j))}for(var H=[],Z=function(V){v.forEach(function(L,F){(V!=T-y||F>=B)&&H.push(L[V])})},P=0;P<v[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 v=0,k=0,P=this.modules;k<P.length;k++){var D=P[k];v=D.reduce(function(H,Z){return H+(Z?1:0)},v)}var M=this.size*this.size,j=Math.ceil(Math.abs(v*20-M*10)/M)-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 v=T^x.shift();x.push(0),_.forEach(function(k,P){return x[P]^=m.reedSolomonMultiply(k,v)})},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})(tr||(tr={})),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={}))}(tr||(tr={})),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={}))}(tr||(tr={}));var Er=tr,wo="L",Co={L:Er.QrCode.Ecc.LOW,M:Er.QrCode.Ecc.MEDIUM,Q:Er.QrCode.Ecc.QUARTILE,H:Er.QrCode.Ecc.HIGH},M1=function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0}();function Eo(a){return a in Co}function ha(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 ma(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,v=null;if(o.excavate){var k=Math.floor(B),P=Math.floor(T),D=Math.ceil(y+B-k),M=Math.ceil(I+T-P);v={x:k,y:P,w:D,h:M}}return{x:B,y:T,h:I,w:y,excavation:v}}function ga(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 yo={value:{type:String,required:!0,default:""},size:{type:Number,default:100},level:{type:String,default:wo,validator:function(a){return Eo(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=kn(kn({},yo),{renderAs:{type:String,required:!1,default:"canvas",validator:function(a){return["canvas","svg"].indexOf(a)>-1}}}),v1=r.defineComponent({name:"QRCodeSvg",props:yo,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=Eo(p)?p:wo,y=Er.QrCode.encodeText(m,Co[C]).getModules();if(l.value=y.length+x*2,a.imageSettings.src){var I=ma(y,a.size,x,a.imageSettings);o={x:I.x+x,y:I.y+x,width:I.w,height:I.h},I.excavation&&(y=ga(y,I.excavation))}i.value=ha(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},o))])}}}),P1=r.defineComponent({name:"QRCodeCanvas",props:yo,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,v=a.gradientEndColor,k=x>>>0,P=Eo(p)?p:wo,D=i.value;if(D){var M=D.getContext("2d");if(M){var j=Er.QrCode.encodeText(m,Co[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=ma(j,a.size,k,a.imageSettings);V={x:F.x+k,y:F.y+k,width:F.w,height:F.h},F.excavation&&(j=ga(j,F.excavation))}var re=window.devicePixelRatio||1,K=_/H*re;if(D.height=D.width=_*re,M.scale(K,K),M.fillStyle=C,M.fillRect(0,0,H,H),I){var ee=void 0;B==="linear"?ee=M.createLinearGradient(0,0,H,H):ee=M.createRadialGradient(H/2,H/2,0,H/2,H/2,H/2),ee.addColorStop(0,T),ee.addColorStop(1,v),M.fillStyle=ee}else M.fillStyle=y;M1?M.fill(new Path2D(ha(j,k))):j.forEach(function(G,W){G.forEach(function(N,X){N&&M.fillRect(X+k,W+k,1,1)})}),L&&M.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",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:o,src:a.imageSettings.src,style:{display:"none"},onLoad:u})])}}}),pa=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=At(),i=vt(),o=lt(),u=Ne.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 v=Math.floor(p.value/60),k=p.value%60;return`${v}:${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}=An(()=>l.itemThemes.kiosk_preloader?"preloader":null);return(v,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(fa),width:"100",height:"100"},null,8,K1)]),k[6]||(k[6]=r.createElementVNode("h1",null,"Оплата по QR",-1)),r.createElementVNode("p",Q1,[r.createVNode(mt,{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(pa,{value:r.unref(i).linkQR,size:200,level:"Q","render-as":"svg","image-settings":f},null,8,["value"])]),r.createVNode(cn,{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=vt(),i=At(),{orderNumber:o,orderCompleted_lib:u}=we.storeToRefs(l),{mediaUrl:f}=An(()=>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=Ne.useRoute(),l=vt(),i=lt(),o=Ln(),{isButtonDisabled:u}=we.storeToRefs(l),f=(p,_,x)=>{const C=o.isTableService?"tableservice":p.kiosk_menu?"kiosk":"qr",y=l.createPaymentHandler(C,p.kiosk_menu,_,x);return y?{...y.config,route:{params:{orgId:String(a.params.orgId)}},handler:y.handler,resetDiscounts:p.resetDiscounts,setButtonDisabled:I=>{u.value=I},on403Kiosk:()=>{localStorage.removeItem("apiKey"),i.is_showApiKey=!0}}:null};return{getCreateOrderConfig:f,makeCreateOrderRequest:async(p,_)=>{const x=f(p,_.paymentMethodId,_.locator);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]]),bo=a=>{const l=Ai(),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}=bo("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}=bo("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:"locator_card"},Of={class:"locator_top_row"},Mf={class:"locator_circle"},Df={class:"locator_number"},vf={class:"locator_keypad"},Pf=["onClick"],Lf={class:"locator_last_row"},Ff={class:"locator_actions"},Vf=["disabled"],Uf=3,zf=r.defineComponent({__name:"Locator",emits:["close","create-order"],setup(a,{emit:l}){const i=r.ref(""),o=l,u=r.ref(!1);let f=null;const m=()=>{u.value=!1,f&&clearTimeout(f),f=setTimeout(()=>{u.value=!1},260),u.value=!0},p=C=>{i.value.length<Uf&&(i.value+=C,m())},_=()=>{i.value.length>0&&(i.value=i.value.slice(0,-1))},x=(C=!1)=>{const y=C?"":i.value.trim();o("create-order",y||void 0),o("close")};return r.onBeforeUnmount(()=>{f&&clearTimeout(f)}),(C,y)=>(r.openBlock(),r.createElementBlock("div",{class:r.normalizeClass(["locator_overlay",{locator_feedback_active:u.value}]),onClick:y[4]||(y[4]=r.withModifiers(I=>o("close"),["self"]))},[r.createElementVNode("div",Bf,[r.createElementVNode("div",Of,[r.createElementVNode("button",{class:"locator_back_button",onClick:y[0]||(y[0]=I=>o("close"))},[r.createVNode(mo,{class:"locator_back_svg"})]),r.createElementVNode("div",Mf,[y[5]||(y[5]=r.createElementVNode("div",{class:"locator_ring"},null,-1)),y[6]||(y[6]=r.createElementVNode("div",{class:"locator_ring"},null,-1)),y[7]||(y[7]=r.createElementVNode("div",{class:"locator_ring"},null,-1)),r.createElementVNode("p",Df,r.toDisplayString(i.value||""),1)])]),y[8]||(y[8]=r.createElementVNode("p",{class:"locator_title"},"Введите номер вашего локатора",-1)),r.createElementVNode("div",vf,[(r.openBlock(),r.createElementBlock(r.Fragment,null,r.renderList(9,I=>r.createElementVNode("button",{key:I,class:"locator_key",onClick:B=>p(I.toString())},r.toDisplayString(I),9,Pf)),64)),r.createElementVNode("div",Lf,[r.createElementVNode("button",{class:"locator_key",onClick:y[1]||(y[1]=I=>p("0"))},"0"),r.createElementVNode("button",{class:"locator_key locator_delete_key",onClick:_},"⌫")])]),r.createElementVNode("div",Ff,[r.createElementVNode("button",{class:"locator_btn locator_continue_btn",disabled:i.value.length===0,onClick:y[2]||(y[2]=I=>x(!1))}," Продолжить ",8,Vf),r.createElementVNode("button",{class:"locator_btn no_locator_btn",onClick:y[3]||(y[3]=I=>x(!0))},"Нет локатора")])])],2))}}),Hf={class:"order_box_wrapper"},Gf=["src"],Wf={class:"order_box_content_wrapper"},Xf={class:"order_box_content_info"},$f={class:"order_box_name"},jf={key:0,class:"order_box_size"},qf={class:"order_box_amount"},Zf={class:"order_box_amount_count"},Yf={key:1,class:"order_box_status"},Kf=["data-state"],Qf={class:"order_box_info_more"},Jf={key:1,class:"cart_modifier_info"},eh={class:"cart_modifier_content"},th={class:"wrapper_price_count_cart"},nh={class:"count_order_box"},rh={class:"wrapper_modifiers_discount"},Ao=We(r.defineComponent({__name:"OrderBox",props:{index:Number,cardItem:Object},emits:["delete"],setup(a,{emit:l}){const i=a,o=At(),u=r.ref(o.itemThemes.qr_show_modifiers_in_cart??!1),{displayNumber:f,update:m}=po(0,800),p=r.computed(()=>{var T,v;const I=((T=i.cardItem)==null?void 0:T.modifiers)??[],B=(((v=i.cardItem)==null?void 0:v.group_modifiers)??[]).flatMap(k=>k.modifiers??[]);return[...I,...B]}),{mediaUrl:_}=An(()=>{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,v,k,P,D,M,j,H,Z;return r.openBlock(),r.createElementBlock("div",Hf,[r.createElementVNode("img",{src:r.unref(_)||"",class:"order_box_image"},null,8,Gf),r.createElementVNode("div",Wf,[r.createElementVNode("div",Xf,[r.createElementVNode("p",$f,r.toDisplayString((T=a.cardItem)==null?void 0:T.name),1),(v=a.cardItem)!=null&&v.size?(r.openBlock(),r.createElementBlock("p",jf,r.toDisplayString(((P=(k=a.cardItem)==null?void 0:k.size)==null?void 0:P.alt_name)||((D=a.cardItem)==null?void 0:D.size.name)),1)):r.createCommentVNode("",!0),r.createElementVNode("div",qf,[B[0]||(B[0]=r.createElementVNode("button",{disabled:""},"-",-1)),r.createElementVNode("p",Zf,r.toDisplayString((M=i.cardItem)==null?void 0:M.amount),1),B[1]||(B[1]=r.createElementVNode("button",{disabled:""},"+",-1))]),y.value?(r.openBlock(),r.createElementBlock("div",Yf,[r.createElementVNode("span",{"data-state":(j=a.cardItem)==null?void 0:j.cooking_state},r.toDisplayString(y.value),9,Kf)])):r.createCommentVNode("",!0)]),r.createElementVNode("div",Qf,[(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",Jf,[(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",eh,[r.createVNode(Ei,{id:"plus_orange"}),r.createElementVNode("p",null,r.toDisplayString(V.name),1)]),r.createElementVNode("div",th,[r.createElementVNode("p",nh,r.toDisplayString(`x${V.amount}`),1),r.createElementVNode("div",rh,[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"]]),ih={class:"cart_wrapper"},oh={class:"cart_header_content"},sh={key:0,class:"cart_header_subwrapper"},ah={class:"cart_kso_button_wrapper"},lh={key:0},ch={key:0,class:"kso_btn_wrapper"},dh=["src"],uh={key:0,class:"cart_qr_button_wrapper"},fh={class:"cart_header_info"},hh={class:"cart_header_info"},mh={class:"cart_header_info"},gh={class:"cart_header_info"},ph={key:1,class:"cart-tabs-wrapper"},xh={class:"cart-tabs-container"},_h=["data-active","onClick"],wh={key:0,class:"wrapper_comment"},Ch={class:"wrapper_limit_in_area"},Eh=["placeholder","maxlength","aria-invalid"],yh={class:"limit_comment"},bh={key:1,class:"wrapper_comment"},Ah={class:"wrapper_limit_in_area"},Sh=["placeholder","maxlength","aria-invalid"],Ih={class:"limit_comment"},Nh={key:2},Th={class:"table_order_desk_number"},kh={key:0,class:"table_order_indent_number"},Rh={class:"cart_footer_wrapper"},Bh={key:0,class:"footer_title"},Oh=["disabled","max"],Mh={key:1,class:"footer_sales"},Dh=["step","max"],vh={class:"list_price"},Ph={key:0},Lh={key:1},Fh={key:2},Vh={class:"accept_field"},Uh={class:"accept_field"},zh={key:3},Hh={class:"accept_field"},Gh={class:"accept_field"},Wh={key:4},Xh={key:5},$h={key:0,class:"accept_field"},jh={key:1,class:"accept_field"},qh={key:3,class:"cart_min_order_notice"},Zh={class:"wrapper_footer_cart_btn"},Yh=50,xa=46,Kh=r.defineComponent({__name:"CartPage",props:{configPage:{},textPaymentBtn:{},config_qr:{type:Boolean}},setup(a){const l=bn.create();let i;const o=lt(),u=vt(),f=At(),m=Ln(),p=Ai(),_=a,{initialCartPrice_lib:x,totalPrice_lib:C,countBonus:y,config_lib:I,cartProducts_lib:B,profile:T}=we.storeToRefs(o),{itemThemes:v}=we.storeToRefs(f),{isButtonDisabled:k,orderCompleted_lib:P,orderNumber:D,extraDiscount:M,is_notification_lib:j,isCreateButtonVisible:H,is_paymentCart:Z,providerTypes:V,notificationData_lib:L,selectedProvider:F,configPayment:re}=we.storeToRefs(u),K=Ne.useRouter(),ee=Ne.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),ae=r.ref(!1),oe=r.ref(!1),xe=r.ref(!1),_e=r.ref(0),Pe=r.ref(0),he=r.ref(!0),qe=r.ref(),ye=r.computed(()=>_.configPage.qr_menu?"YOOKASSA_BASE":V.value[0].front_type),Ke=r.computed(()=>_.configPage.qr_menu?"YOOKASSA":V.value[0].type),ct=r.computed(()=>{var ge,se;return _.configPage.kiosk_menu&&((ge=I.value)==null?void 0:ge.loyalty)==="IIKO"&&(I.value.has_loyalty_default_user||T.value)||_.configPage.qr_menu&&((se=I.value)==null?void 0:se.loyalty)==="IIKO"&&(T.value||v.value.qr_auth_required===!1)}),et=r.computed(()=>["АВТОРИЗОВАТЬСЯ ДЛЯ ЗАКАЗА"].includes(_.textPaymentBtn.toUpperCase())?_.textPaymentBtn:m.isTableService&&m.hasOrder?"Дополнить заказ":H.value?"Создать заказ":_.textPaymentBtn),_t=r.computed(()=>{var se;if(!_.configPage.kiosk_menu)return!1;const ge=(se=v.value)==null?void 0:se.kiosk_enable_locators;return ge!==!1&&ge!=="false"}),{width:De}=pt.useElementSize(G,{width:0,height:0},{box:"border-box"}),Ae=r.computed(()=>{var Ue,Fe,hn,wt;const ge={energy_amount:0,proteins_amount:0,fat_amount:0,carbohydrates_amount:0};let se=ge;return m.isTableService&&((Fe=(Ue=m.order)==null?void 0:Ue.items)!=null&&Fe.length)&&(se=((wt=(hn=m.order)==null?void 0:hn.items)==null?void 0:wt.reduce((tt,Xe)=>(Xe!=null&&Xe.nutrition&&(tt.energy_amount+=(Xe.nutrition.energy_amount||0)*(Xe.amount||0),tt.proteins_amount+=(Xe.nutrition.proteins_amount||0)*(Xe.amount||0),tt.fat_amount+=(Xe.nutrition.fat_amount||0)*(Xe.amount||0),tt.carbohydrates_amount+=(Xe.nutrition.carbohydrates_amount||0)*(Xe.amount||0)),tt),ge))||ge),B.value.reduce((tt,Xe)=>(tt.energy_amount+=(Xe.energy_amount||0)*(Xe.amount||0),tt.proteins_amount+=(Xe.proteins_amount||0)*(Xe.amount||0),tt.fat_amount+=(Xe.fat_amount||0)*(Xe.amount||0),tt.carbohydrates_amount+=(Xe.carbohydrates_amount||0)*(Xe.amount||0),tt),se)}),Be=r.computed(()=>{var ge;if((ge=v.value)!=null&&ge.comments){const se=v.value.comments;return{fieldName:_.configPage.kiosk_menu?se.kiosk_comment_field_name:se.qr_comment_field_name,placeholder:_.configPage.kiosk_menu?se.kiosk_comment_field_placeholder:se.qr_comment_field_placeholder,show:_.configPage.kiosk_menu?se.kiosk_show_order_comment:se.qr_show_order_comment}}}),rt=pt.computedAsync(async ge=>{var Fe;const se=new AbortController;if(ge(()=>se.abort()),!N.value||!((Fe=T.value)!=null&&Fe.balance)||!C.value)return 0;const Ue=await l.maxPayByBonuses(qe.value,_.configPage.kiosk_menu,!!_.configPage.userData||!!T.value,se.signal);return Ue!=null&&Ue.by_bonuses?($.value=Ue.non_integers_allowed||!1,Math.min(Ue.by_bonuses,T.value.balance,C.value)):0},0,{shallow:!0}),it=()=>K.push(`/${ee.params.orgId}/`),Je=ge=>{($.value?["a","A","+","-","."]:["a","A","+","-",".",","]).includes(ge.key)&&ge.preventDefault()},ve=ge=>{o.deleteItemFromCart(ge),B.value.length===0&&(ae.value=!1,oe.value=!1,m.hasOrder&&K.replace({name:"order-ts"}))},Ar=()=>{ae.value=!ae.value,J.value.length},be=r.computed(()=>{var se;return(((se=v.value.cart_loyalty_button)==null?void 0:se.cart_loyalty_button_text)||"Программа лояльности").replace(/\S+/g,Ue=>Ue.length>15?Ue.slice(0,15)+"...":Ue)}),Sr=()=>{oe.value=!oe.value,J.value.length},jr=()=>{let ge=$.value?+y.value.toFixed(2):Math.floor(y.value)||0;ge>rt.value&&(ge=rt.value),ge!==y.value&&o.setBonus(ge)};r.watchEffect(()=>{jr(),o.setBonus(C.value===0?0:$.value?+y.value.toFixed(2):Math.floor(y.value))});const fn=()=>B.value.map(ge=>({id:ge.id,front_item_id:ge.idSystem,is_fake:!!ge.is_fake,is_od_united_product:!!ge.is_od_united_product,removals:ge.removals??null,amount:ge.amount,size:ge.size,modifiers:ge.modifiers??[],group_modifiers:ge.group_modifiers??[]})),{makeCreateOrderRequest:qr}=wf(),nn=r.computed(()=>fn()),or=r.computed(()=>xe.value?xa:Yh),Pt=r.computed(()=>{var ge,se,Ue,Fe;return _.configPage.qr_menu&&((se=(ge=v.value)==null?void 0:ge.comments)==null?void 0:se.qr_is_order_comment_required)||_.configPage.kiosk_menu&&((Fe=(Ue=v.value)==null?void 0:Ue.comments)==null?void 0:Fe.kiosk_is_order_comment_required)}),Lt=()=>{var ge,se;return!(Pt.value&&((se=(ge=J.value)==null?void 0:ge.trim())==null?void 0:se.length)<1&&q.value)||m.isTableService&&m.hasOrder?!1:(u.showNotification("Обязательно перед созданием заказа укажите комментарий к заказу"),q.value.focus(),le.value=!0,Dt.animate(q.value.parentElement,{x:[0,-10,0,10,0]},{duration:.1,repeat:2}),!0)},Bi=async()=>{var ge,se,Ue;if(_.configPage.qr_menu&&!T.value&&v.value.qr_auth_required!==!1){K.push(`/${ee.params.orgId}/register`);return}if(!(Pt.value&&Lt())){if(m.isTableService){if((ge=m.data)!=null&&ge.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(qe.value),u.deleteCart(),m.refresh(),K.push({name:"order-ts"})}catch(Fe){u.showNotification(((Ue=(se=Fe==null?void 0:Fe.response)==null?void 0:se.data)==null?void 0:Ue.user_friendly_message)||"Ошибка при создании заказа"),m.refresh(),k.value=!1,$e()}return}if(_.configPage.qr_menu||V.value.length<=1){k.value=!0,await lo(qe.value,Ke.value).then(Fe=>{re.value&&Fe.url&&_.configPage.qr_menu&&window.location.replace(Fe.url)});return}return Z.value=!Z.value}},Ir=()=>{Z.value=!1},Mo=async()=>{var se,Ue,Fe,hn,wt;M.value=0;const ge={items:[...fn()],comment:J.value,combos:[]};m.id&&(ge.table=m.id),(se=_.configPage)!=null&&se.kiosk_menu&&((Ue=u.selectedOrderType)!=null&&Ue.id)&&(ge.order_type_id=(Fe=u.selectedOrderType)==null?void 0:Fe.id);try{X.value=!0;const tt=await l.calculateDiscount(ge,_.configPage.kiosk_menu,!!_.configPage.userData||!!T.value,i.signal);if(!B.value)return;B.value.forEach(Xe=>{const Tt=tt.items.find(zt=>zt.front_item_id===Xe.idSystem);if(Tt&&(Xe.group_modifiers.forEach(zt=>{const Ct=Tt.group_modifiers.find(Ot=>Ot.group===zt.group);Ct&&zt.modifiers.forEach(Ot=>{const at=Ct.modifiers.find(Oe=>Oe.id===Ot.id);if(at&&Number(Ot.price)!==Number(at==null?void 0:at.new_price)){const Oe=(at.discounts||[]).reduce((Ht,Ee)=>Ht+=+Ee.discount,0);_e.value+=Oe,Ot.new_price=Ot.price,Ot.price=Number(at==null?void 0:at.new_price),Ot.total_new_price=Number(at.total_new_price)}})}),Xe.modifiers.forEach(zt=>{const Ct=Tt.modifiers.find(Ot=>Ot.id===zt.id);if(Ct&&Number(zt.price)!==Number(Ct==null?void 0:Ct.new_price)){const Ot=(Ct.discounts||[]).reduce((at,Oe)=>at+=+Oe.discount,0);_e.value+=Ot,zt.new_price=zt.price,zt.price=Number(Ct==null?void 0:Ct.new_price),zt.total_new_price=Number(Ct.total_new_price)}}),Xe.price!==Number(Tt.new_price))){const zt=(Tt.discounts||[]).reduce((Ct,Ot)=>Ct+=+Ot.discount,0);_e.value=_e.value+zt,Xe.new_price=Xe.price,Xe.price=Tt.new_price,Xe.discounts=Tt.discounts,Xe.total_new_price=Number(Tt.total_new_price)}}),B.value=[...B.value],_e.value!==0&&(C.value=tt.total_cart_price)}catch(tt){if(X.value=!1,!Ye.isCancel(tt))throw u.showNotification(((wt=(hn=tt==null?void 0:tt.response)==null?void 0:hn.data)==null?void 0:wt.user_friendly_message)||"Скидки временно недоступны"),tt}},Nt=async()=>{var se,Ue;let ge=k.value;k.value=!0;try{await l.extendOrder([...fn()]),u.deleteCart(),m.refreshOrder(),K.push({name:"order-ts"})}catch(Fe){throw u.showNotification(((Ue=(se=Fe==null?void 0:Fe.response)==null?void 0:se.data)==null?void 0:Ue.user_friendly_message)||"Не удалось дополнить заказ"),Fe}finally{k.value=ge}},pe=async ge=>{var se;if(!(Pt.value&&Lt())){qe.value=null,i=new AbortController,k.value=!0;try{ct.value&&await Mo(),F.value={front_type:ye};const Ue={paymentMethodId:ye.value,items:nn.value,comment:ge?J.value.slice(0,xa):J.value,isAuthorized:!!_.configPage.userData||!!T,signal:i==null?void 0:i.signal,locator:ge||void 0},Fe=await qr({..._.configPage,resetDiscounts:$e},Ue);qe.value=(se=Fe==null?void 0:Fe.data)==null?void 0:se.id,H.value=!1}catch(Ue){console.log("[cart](createOrder)",Ue),!Ye.isCancel(Ue)&&m.isTableService&&m.refresh(),k.value=!1,$e()}}},Bt=()=>{var ge;if(_.configPage.qr_menu&&["АВТОРИЗОВАТЬСЯ ДЛЯ ЗАКАЗА"].includes(_.textPaymentBtn.toUpperCase())&&!T.value&&v.value.qr_auth_required!==!1)return K.push(`/${ee.params.orgId}/register`);if(m.isTableService&&((ge=m.data)!=null&&ge.available_extend))return p.open("cart-extend-confirm");if(H.value){if(Pt.value&&Lt())return;if(!_t.value)return pe();xe.value=!0;return}return Bi()},st=()=>{var ge;(ge=T.value)!=null&&ge.balance?T.value.balance>0&&(N.value=!N.value):u.showNotification("У Вас пока нет бонусов")};r.onMounted(async()=>{o.loadCart(),P.value=null,C.value=null,M.value=0,$e()}),r.onUnmounted(()=>{i&&(i==null||i.abort(),i=null),k.value=!1,qe.value=null,P.value=null,C.value=null,M.value=0,B.value.splice(0,B.value.length,...B.value.map(o.makeProductFullyReactive))});const dt=r.computed(()=>_.configPage.qr_menu?I.value.qr_order_minimum_price||0:_.configPage.kiosk_menu&&I.value.kiosk_order_minimum_price||0),sr=r.computed(()=>{var ge;return["АВТОРИЗОВАТЬСЯ ДЛЯ ЗАКАЗА"].includes(_.textPaymentBtn.toUpperCase())?!1:m.isTableService&&m.hasOrder&&!((ge=m.data)!=null&&ge.available_extend)||dt.value>x.value&&!m.hasOrder||X.value||k.value||B.value.length===0?!0:(P.value=null,k.value)}),ar=r.computed(()=>{var ge;return((ge=B.value)==null?void 0:ge.reduce((se,Ue)=>se+Ue.amount,0))||0}),Zr=r.computed(()=>{var ge;return(ge=T.value)==null?void 0:ge.phone});r.watch(J,ge=>{var se;return((se=ge==null?void 0:ge.trim())==null?void 0:se.length)&&(le.value=!1)}),r.watch(()=>B.value.length,(ge,se)=>{se!==void 0&&(ge<=se||r.nextTick(()=>{const Ue=W.value;Ue&&Ue.scrollTo({top:Ue.scrollHeight,behavior:"smooth"})}))}),r.watch([ar,Zr,()=>u.selectedOrderType],()=>{ar.value===0&&(i=null),i==null||i.abort(),k.value=!1});const $e=()=>{H.value=!0,o.setBonus(0),B.value.splice(0,B.value.length,...B.value.map(o.makeProductFullyReactive)),_e.value=0,C.value=null,M.value=0};return r.watch([()=>o.cartProducts_lib,Zr,ar,()=>u.selectedOrderType],ge=>{if(Pe.value>0){Pe.value--;return}ge&&!X.value&&(N.value=!1,$e(),Pe.value=1),X.value=!1},{deep:!0}),(ge,se)=>{var Ue,Fe,hn,wt,tt,Xe,Tt,zt,Ct,Ot,at;return r.openBlock(),r.createElementBlock(r.Fragment,null,[r.createElementVNode("div",ih,[r.createVNode(Nf,{onConfirm:ve}),r.createVNode(Rf,{onConfirm:Nt}),r.createVNode(ca,{visible:r.unref(u).isDrawerOpen,"onUpdate:visible":se[0]||(se[0]=Oe=>r.unref(u).isDrawerOpen=Oe)},{default:r.withCtx(()=>[r.createVNode(ua)]),_:1},8,["visible"]),r.createElementVNode("header",oh,[_.configPage.kiosk_menu?(r.openBlock(),r.createElementBlock("div",sh,[r.createElementVNode("div",ah,[r.createElementVNode("div",{class:r.normalizeClass(["arrow_wrapper",{arrow_wrapper_kso:_.configPage.kiosk_menu}]),onClick:it},[r.createVNode(wr,{class:"cart_header_back_button"}),_.configPage.kiosk_menu?(r.openBlock(),r.createElementBlock("span",lh,"Назад")):r.createCommentVNode("",!0)],2)]),Be.value&&Be.value.show?(r.openBlock(),r.createElementBlock("div",ch,[Pt.value?r.createCommentVNode("",!0):(r.openBlock(),r.createBlock(cn,{key:0,style:r.normalizeStyle({visibility:!ae.value&&r.unref(B).length>0?"visible":"hidden"}),class:r.normalizeClass({button_kso_comment:a.configPage.kiosk_menu}),textButtonDefault:J.value.length>0?"Редактировать":Be.value&&Be.value.fieldName||"",onClick:()=>ae.value=!ae.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(v).kiosk_show_loyalty_card_button||r.unref(v).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:(Ue=r.unref(v).cart_loyalty_button)!=null&&Ue.cart_loyalty_button_sticker?`${Math.ceil(r.unref(De)/2+10)}px`:"",paddingRight:(Fe=r.unref(v).cart_loyalty_button)!=null&&Fe.cart_loyalty_button_sticker?0:""}),onClick:se[1]||(se[1]=(...Oe)=>r.unref(u).openDrawer&&r.unref(u).openDrawer(...Oe))},[r.createElementVNode("p",{class:"cart_loyal_program",style:r.normalizeStyle({marginRight:`${Math.ceil(r.unref(De)/2)}px`})},r.toDisplayString(be.value),5),(hn=r.unref(v).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(v).cart_loyalty_button.cart_loyalty_button_sticker})`})},[r.createElementVNode("img",{src:r.unref(v).cart_loyalty_button.cart_loyalty_button_sticker},null,8,dh)],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",uh,[r.createElementVNode("div",{class:"arrow_wrapper",onClick:it},[r.createVNode(wr,{class:"cart_header_back_button"})])])):r.createCommentVNode("",!0),r.unref(v).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",fh,[r.createElementVNode("p",null,[r.createVNode(mt,{price:Ae.value.energy_amount,duration:800},null,8,["price"]),se[11]||(se[11]=r.createTextVNode(" г",-1))]),se[12]||(se[12]=r.createElementVNode("p",{class:"cart_info_name"},"Килокалории",-1))]),r.createElementVNode("div",hh,[r.createElementVNode("p",null,[r.createVNode(mt,{price:Ae.value.proteins_amount,duration:900},null,8,["price"]),se[13]||(se[13]=r.createTextVNode(" г",-1))]),se[14]||(se[14]=r.createElementVNode("p",{class:"cart_info_name"},"Белки",-1))]),r.createElementVNode("div",mh,[r.createElementVNode("p",null,[r.createVNode(mt,{price:Ae.value.fat_amount,duration:1e3},null,8,["price"]),se[15]||(se[15]=r.createTextVNode(" г",-1))]),se[16]||(se[16]=r.createElementVNode("p",{class:"cart_info_name"},"Жиры",-1))]),r.createElementVNode("div",gh,[r.createElementVNode("p",null,[r.createVNode(mt,{price:Ae.value.carbohydrates_amount,duration:1100},null,8,["price"]),se[17]||(se[17]=r.createTextVNode(" г",-1))]),se[18]||(se[18]=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",ph,[r.createElementVNode("ul",xh,[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(r.unref(u).orderTypes,Oe=>{var Ht,Ee;return r.openBlock(),r.createElementBlock("li",{key:Oe.id,class:"cart-tab","data-active":Oe.id===((Ht=r.unref(u).selectedOrderType)==null?void 0:Ht.id),onClick:lr=>r.unref(u).selectedOrderType=Oe},[Oe.id===((Ee=r.unref(u).selectedOrderType)==null?void 0:Ee.id)?(r.openBlock(),r.createBlock(r.unref(Dt.motion).div,{key:0,class:"cart-underline","layout-id":"cart-underline",id:"cart-underline"})):r.createCommentVNode("",!0),r.createElementVNode("span",null,r.toDisplayString(Oe.name),1)],8,_h)}),128))])])):r.createCommentVNode("",!0)]),(Pt.value||ae.value)&&a.configPage.kiosk_menu&&((wt=r.unref(B))!=null&&wt.length)?(r.openBlock(),r.createElementBlock("div",wh,[r.createElementVNode("div",Ch,[r.withDirectives(r.createElementVNode("textarea",{ref_key:"commentEl",ref:q,class:"comment_order",placeholder:Be.value&&Be.value.placeholder||"Ваш комментарий к заказу...",name:"commentKso",maxlength:or.value,"aria-invalid":le.value,"onUpdate:modelValue":se[2]||(se[2]=Oe=>J.value=Oe)},null,8,Eh),[[r.vModelText,J.value]]),r.createElementVNode("p",yh,r.toDisplayString(J.value.length+" / "+or.value),1)]),Pt.value?r.createCommentVNode("",!0):(r.openBlock(),r.createBlock(cn,{key:0,textButtonDefault:"Сохранить",onClick:Ar,class:"button_bonus_cart"}))])):r.createCommentVNode("",!0),(Pt.value||oe.value)&&a.config_qr&&((tt=r.unref(B))!=null&&tt.length)&&!(r.unref(m).isTableService&&r.unref(m).hasOrder)?(r.openBlock(),r.createElementBlock("div",bh,[r.createElementVNode("div",Ah,[r.withDirectives(r.createElementVNode("textarea",{ref_key:"commentEl",ref:q,class:"comment_order",placeholder:Be.value&&Be.value.placeholder||"Ваш комментарий к заказу...",name:"commentQr",maxlength:or.value,"aria-invalid":le.value,"onUpdate:modelValue":se[3]||(se[3]=Oe=>J.value=Oe)},null,8,Sh),[[r.vModelText,J.value]]),r.createElementVNode("p",Ih,r.toDisplayString(J.value.length+" / "+or.value),1)]),Pt.value?r.createCommentVNode("",!0):(r.openBlock(),r.createBlock(cn,{key:0,textButtonDefault:"Сохранить",onClick:Sr,class:"button_bonus_cart"}))])):r.createCommentVNode("",!0),a.config_qr&&Be.value&&Be.value.show&&!(r.unref(m).isTableService&&r.unref(m).hasOrder)?(r.openBlock(),r.createElementBlock("div",Nh,[!Pt.value&&!oe.value&&r.unref(B).length>0?(r.openBlock(),r.createBlock(cn,{key:0,textButtonDefault:J.value.length>0?"Редактировать":Be.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:se[4]||(se[4]=Oe=>r.unref(m).order&&r.unref(K).push({name:"order-ts"}))},[r.createElementVNode("p",Th,r.toDisplayString(`Стол № ${(Tt=r.unref(m).data)==null?void 0:Tt.number}`),1),(zt=r.unref(m).order)!=null&&zt.id?(r.openBlock(),r.createElementBlock("p",kh,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&&((Ot=(Ct=r.unref(m).order)==null?void 0:Ct.items)!=null&&Ot.length)&&he.value?(r.openBlock(!0),r.createElementBlock(r.Fragment,{key:0},r.renderList(r.unref(m).order.items,Oe=>(r.openBlock(),r.createBlock(Ao,{key:Oe.idSystem,cardItem:Oe},null,8,["cardItem"]))),128)):r.createCommentVNode("",!0),(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(r.unref(B),Oe=>(r.openBlock(),r.createBlock(da,{key:Oe.idSystem,cardItem:Oe,isShowModifiers:_.config_qr,onDelete:Ht=>ve(Oe.idSystem)},null,8,["cardItem","isShowModifiers","onDelete"]))),128))],512),r.createElementVNode("div",Rh,[N.value&&!r.unref(H)?(r.openBlock(),r.createElementBlock("p",Bh,[se[19]||(se[19]=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||((at=r.unref(T))==null?void 0:at.balance)===0,"onUpdate:modelValue":se[5]||(se[5]=Oe=>r.isRef(y)?y.value=Oe:null),onInput:jr,min:"0",max:r.unref(rt),step:".01",onKeypress:Je},null,44,Oh),[[r.vModelText,r.unref(y),void 0,{number:!0}]]),se[20]||(se[20]=r.createTextVNode(" бонусов ",-1))])):r.createCommentVNode("",!0),N.value&&!r.unref(H)?(r.openBlock(),r.createElementBlock("p",Mh,"У вас есть "+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":se[6]||(se[6]=Oe=>r.isRef(y)?y.value=Oe:null),step:$.value?".01":"1",min:0,max:r.unref(rt)},null,8,Dh)),[[r.vModelText,r.unref(y),void 0,{number:!0}]]):r.createCommentVNode("",!0),r.createElementVNode("ul",vh,[N.value&&!r.unref(H)?(r.openBlock(),r.createElementBlock("li",Ph,[se[22]||(se[22]=r.createElementVNode("p",null,"Сумма заказа:",-1)),r.createElementVNode("p",null,[r.createVNode(mt,{price:r.unref(C),fixedFloat:2},null,8,["price"]),se[21]||(se[21]=r.createTextVNode(" ₽",-1))])])):r.createCommentVNode("",!0),N.value&&!r.unref(H)?(r.openBlock(),r.createElementBlock("li",Lh,[se[24]||(se[24]=r.createElementVNode("p",null,"Будет оплачено бонусами:",-1)),r.createElementVNode("p",null,[r.createVNode(mt,{price:r.unref(y),fixedFloat:2},null,8,["price"]),se[23]||(se[23]=r.createTextVNode(" Б",-1))])])):r.createCommentVNode("",!0),r.unref(M)!==0?(r.openBlock(),r.createElementBlock("li",Fh,[r.createElementVNode("p",Vh,r.toDisplayString(r.unref(M)>0?"Надбавка":"Скидка")+": ",1),r.createElementVNode("p",Uh,[r.createVNode(mt,{price:Math.abs(r.unref(M)),fixedFloat:2},null,8,["price"]),se[25]||(se[25]=r.createTextVNode(" ₽",-1))])])):_e.value!==0?(r.openBlock(),r.createElementBlock("li",zh,[r.createElementVNode("p",Hh,r.toDisplayString(_e.value>0?"Надбавка":"Скидка")+": ",1),r.createElementVNode("p",Gh,[r.createVNode(mt,{price:Math.abs(_e.value),fixedFloat:2},null,8,["price"]),se[26]||(se[26]=r.createTextVNode(" ₽",-1))])])):r.createCommentVNode("",!0),r.unref(m).isTableService&&r.unref(m).order?(r.openBlock(),r.createElementBlock("li",Wh,[se[28]||(se[28]=r.createElementVNode("p",null,"Сумма заказа:",-1)),r.createElementVNode("p",null,[r.createVNode(mt,{price:r.unref(m).order.total_cost,fixedFloat:2},null,8,["price"]),se[27]||(se[27]=r.createTextVNode(" ₽",-1))])])):r.createCommentVNode("",!0),r.unref(m).isTableService&&r.unref(m).order?(r.openBlock(),r.createElementBlock("li",Xh,[se[30]||(se[30]=r.createElementVNode("p",null,"К счёту добавится:",-1)),r.createElementVNode("p",null,[r.createVNode(mt,{price:r.unref(C),fixedFloat:2},null,8,["price"]),se[29]||(se[29]=r.createTextVNode(" ₽",-1))])])):r.createCommentVNode("",!0),r.createElementVNode("li",null,[se[33]||(se[33]=r.createElementVNode("p",{class:"accept_field"},"Итого к оплате:",-1)),r.unref(m).isTableService&&r.unref(m).order?(r.openBlock(),r.createElementBlock("p",$h,[r.createVNode(mt,{price:r.unref(m).order.total_cost+r.unref(C),fixedFloat:2},null,8,["price"]),se[31]||(se[31]=r.createTextVNode(" ₽",-1))])):(r.openBlock(),r.createElementBlock("p",jh,[r.createVNode(mt,{price:r.unref(C)-r.unref(y),fixedFloat:2},null,8,["price"]),se[32]||(se[32]=r.createTextVNode(" ₽",-1))]))])]),dt.value&&dt.value>r.unref(x)&&!r.unref(m).hasOrder?(r.openBlock(),r.createElementBlock("div",qh,[se[34]||(se[34]=r.createTextVNode(" Минимальная сумма заказа ",-1)),r.createVNode(mt,{price:dt.value,fixedFloat:2},null,8,["price"]),r.createTextVNode(" "+r.toDisplayString(r.unref(I).currency_symbol)+". Для оформления заказа необходимо добавить товаров на сумму ",1),r.createVNode(mt,{price:dt.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",Zh,[r.unref(T)&&!r.unref(H)&&!r.unref(m).isTableService?(r.openBlock(),r.createBlock(cn,{key:0,textButtonDefault:r.unref(v).bonuses_button_name||"Бонусы",onClick:st,class:"button_bonus_cart"},null,8,["textButtonDefault"])):r.createCommentVNode("",!0),r.createVNode(cn,{textButtonDefault:et.value,onClick:Bt,class:"button_payment_cart",disabled:sr.value},null,8,["textButtonDefault","disabled"])])])]),r.unref(m).isTableService?r.createCommentVNode("",!0):(r.openBlock(),r.createBlock(_f,{key:0,orderNumber:r.unref(D),pageNumber:1},null,8,["orderNumber"])),r.createVNode(yi,{visible:r.unref(j),"onUpdate:visible":se[7]||(se[7]=Oe=>r.isRef(j)?j.value=Oe:null),textNotificationDefault:r.unref(L).textNotification,backgroundColor:r.unref(v).accent_color?r.unref(v).accent_color:"#FF6D2E",buttonAccept:null},null,8,["visible","textNotificationDefault","backgroundColor"]),r.createVNode(_o,{modelValue:r.unref(Z),"onUpdate:modelValue":se[8]||(se[8]=Oe=>r.isRef(Z)?Z.value=Oe:null),class:"product_card_sheet","snap-points":["80%"]},{default:r.withCtx(()=>{var Oe;return[r.createVNode(f1,{"config-page":a.configPage,comment:J.value,"cart-items":nn.value,"is-authorized":!!_.configPage.userData||!!r.unref(T),"order-id":qe.value,signal:(Oe=r.unref(i))==null?void 0:Oe.signal,onSelectPayment:Ir},null,8,["config-page","comment","cart-items","is-authorized","order-id","signal"])]}),_:1},8,["modelValue"]),(r.openBlock(),r.createBlock(r.Teleport,{to:"body"},[xe.value?(r.openBlock(),r.createBlock(zf,{key:0,onClose:se[9]||(se[9]=Oe=>xe.value=!1),onCreateOrder:se[10]||(se[10]=Oe=>pe(Oe))})):r.createCommentVNode("",!0)]))],64)}}}),Qh={},Jh={viewBox:"0 0 24 24"};function e2(a,l){return r.openBlock(),r.createElementBlock("svg",Jh,[...l[0]||(l[0]=[r.createElementVNode("path",{d:"M18 6L6 18M6 6l12 12"},null,-1)])])}const t2=We(Qh,[["render",e2]]),n2={class:"retry_screen"},r2={class:"retry_all_in_screen"},i2={class:"retry_content"},o2={class:"retry_icon_wrap"},s2={class:"retry_icon_circle"},a2={class:"retry_error_x"},l2=r.defineComponent({__name:"RetryPage",setup(a){const l=vt(),i=Ne.useRouter(),o=Ne.useRoute(),u=()=>{l.notificationData_lib.textNotification="",l.is_notification_lib=!1,i.replace(`/${o.params.orgId}/`)};return(f,m)=>(r.openBlock(),r.createElementBlock("section",n2,[r.createElementVNode("div",r2,[r.createElementVNode("main",i2,[r.createElementVNode("div",o2,[r.createElementVNode("div",s2,[m[0]||(m[0]=r.createElementVNode("div",{class:"retry_loader_mini"},null,-1)),r.createElementVNode("div",a2,[r.createVNode(t2)])])]),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))])]))}}),c2={class:"table_order_wrapper"},d2={class:"table_order_header_content"},u2={class:"table_order_kbju_qr_wrapper"},f2={class:"table_order_qr_button_wrapper"},h2={key:0,class:"table_order_header",style:{paddingRight:"10px"}},m2={class:"table_order_header_info"},g2={class:"table_order_header_info"},p2={class:"table_order_header_info"},x2={class:"table_order_header_info"},_2={key:0,class:"table_order_table_wrapper"},w2={class:"table_order_desk_number"},C2={class:"table_order_indent_number"},E2={class:"table_order_cards"},y2={class:"table_order_footer_wrapper"},b2={key:0,class:"footer_title"},A2=["disabled","max"],S2={key:1,class:"footer_sales"},I2=["step","max"],N2={class:"list_price"},T2={key:0},k2={key:1},R2={key:2},B2={key:3},O2={class:"accept_field"},M2={key:3,class:"wrapper_footer_table_order_btn"},D2=We(r.defineComponent({__name:"TableOrderPage",setup(a){const l=lt(),i=Gr(),o=At(),u=Ln(),{countBonus:f}=we.storeToRefs(l),{itemThemes:m}=we.storeToRefs(o),p=Ne.useRouter(),_=Ne.useRoute(),x=bn.create(),C=r.ref(!1),y=r.ref(!1),I=r.ref(!1),B=r.ref(!1),T=r.ref(!1),v=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=pt.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}),D=()=>{T.value=!0},M=()=>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",c2,[r.createElementVNode("header",d2,[r.createElementVNode("div",u2,[r.createElementVNode("div",f2,[r.createElementVNode("div",{class:"arrow_wrapper",onClick:M},[r.createVNode(wr,{class:"table_order_header_back_button"})])]),r.unref(m).show_nutrition_in_cart?(r.openBlock(),r.createElementBlock("div",h2,[r.createElementVNode("div",m2,[r.createElementVNode("p",null,[r.createVNode(mt,{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",g2,[r.createElementVNode("p",null,[r.createVNode(mt,{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",p2,[r.createElementVNode("p",null,[r.createVNode(mt,{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",x2,[r.createElementVNode("p",null,[r.createVNode(mt,{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",_2,[r.createElementVNode("p",w2,r.toDisplayString(`Стол № ${(re=r.unref(u).data)==null?void 0:re.number}`),1),r.createElementVNode("p",C2,r.toDisplayString(`Заказ ${r.unref(u).order.plugin_order.number}`),1)])):r.createCommentVNode("",!0),r.createElementVNode("div",E2,[(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(Ao,{key:$.idSystem,cardItem:$},null,8,["cardItem"]))),128)):r.createCommentVNode("",!0)]),r.createElementVNode("div",y2,[y.value?(r.openBlock(),r.createElementBlock("p",b2,[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,A2),[[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",S2," У вас есть "+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,I2)),[[r.vModelText,r.unref(f),void 0,{number:!0}]]):r.createCommentVNode("",!0),r.createElementVNode("ul",N2,[r.unref(u).order&&r.unref(u).order.total_cost-r.unref(u).order.remaining_amount>0?(r.openBlock(),r.createElementBlock("li",T2,[L[13]||(L[13]=r.createElementVNode("p",null,"Сумма заказа:",-1)),r.createElementVNode("p",null,[r.createVNode(mt,{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",k2,[L[15]||(L[15]=r.createElementVNode("p",null,"Оплачено:",-1)),r.createElementVNode("p",null,[r.createVNode(mt,{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",R2,[L[17]||(L[17]=r.createElementVNode("p",null,"Будет оплачено бонусами:",-1)),r.createElementVNode("p",null,[r.createVNode(mt,{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",B2,[L[19]||(L[19]=r.createElementVNode("p",{class:"accept_field"},"Итого к оплате:",-1)),r.createElementVNode("p",O2,[r.createVNode(mt,{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",M2,[r.createVNode(cn,{textButtonDefault:B.value?"Запросить счёт":"Оплатить заказ",onClick:B.value?D:j,class:"button_payment_cart",disabled:v.value},null,8,["textButtonDefault","onClick","disabled"])])):r.createCommentVNode("",!0)])])}}}),[["__scopeId","data-v-75fa9255"]]),v2={class:"wrapper_loader"},P2=r.defineComponent({__name:"Loader",props:{size:{type:String,default:"40px"}},setup(a){return(l,i)=>(r.openBlock(),r.createElementBlock("div",v2,[r.createElementVNode("div",{class:"loader",style:r.normalizeStyle({width:a.size})},null,4)]))}}),L2=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"]]),F2={key:0},V2={class:"card__main__wrapper"},U2={key:0,class:"folder_content_top"},z2={key:0,class:"loader_card_main"},H2=["src","alt"],G2={class:"card_title_price_wrapper"},W2={class:"title"},X2={key:0,class:"price"},$2={key:1},j2={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){At();const l=lt(),i=Ut(),{is_18_above_content:o,is18Allowed:u,notificationData_lib:f}=we.storeToRefs(l),{isDesktop:m}=zn(),p=a,_=(I,B)=>{var k,P,D;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},v=!((k=I.modifiers)!=null&&k.length)&&!((P=I.group_modifiers)!=null&&P.length)&&!((D=I.sizes)!=null&&D.length);if(i.isUpSale=!1,I.adult&&!u.value){o.value=!0,v&&(f.value.fastAdd=T);return}if(v){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}=An(()=>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",F2,[r.createVNode(L2,{id:p.data.id},{opacityLoader:r.withCtx(()=>[r.createElementVNode("div",V2,[a.is_group?(r.openBlock(),r.createElementBlock("div",U2)):r.createCommentVNode("",!0),r.createElementVNode("div",{onClick:B[0]||(B[0]=v=>x(p.data)),class:r.normalizeClass(["card__main",{card__main_folder:a.is_group}])},[a.isLoading?(r.openBlock(),r.createElementBlock("div",z2,[r.createVNode(P2)])):(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,H2),r.createElementVNode("div",G2,[r.createElementVNode("p",W2,r.toDisplayString(a.data.name),1),a.is_group?r.createCommentVNode("",!0):(r.openBlock(),r.createElementBlock("p",X2,r.toDisplayString(r.unref(hr)(a.data))+" ₽",1))])],2))],2),r.unref(m)?r.createCommentVNode("",!0):(r.openBlock(),r.createElementBlock("div",$2,[a.is_group?r.createCommentVNode("",!0):(r.openBlock(),r.createElementBlock("div",j2,[r.createElementVNode("div",{onClick:B[1]||(B[1]=v=>_(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"]]),q2=["id","onClick"],Z2=We(r.defineComponent({__name:"GroupMain",props:{menuGroup:{},idActiveGroup:{},activeTakeGroup:{type:Function}},setup(a){const{shouldUseDragScroll:l}=zn(),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,q2))),128))]),_:1},8,["container","idActive"])])),[[r.unref(Wr),r.unref(l)?{}:!1]]):r.createCommentVNode("",!0)}}),[["__scopeId","data-v-aa0ca388"]]),Y2=["id","onClick"],K2=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}=zn(),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,Y2))),128))]),_:1},8,["container","idActive"])])),[[r.unref(Wr),r.unref(i)?{}:!1]]):r.createCommentVNode("",!0)}}),[["__scopeId","data-v-afba730a"]]),Q2=["data-id","data-last"],J2=["src"],em=["src"],tm=We(r.defineComponent({__name:"DrumItem",props:{group:{},index:{},active:{type:Boolean}},setup(a){const l=a,{mediaUrl:i}=An(()=>{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,"data-last":a.group.is_last},[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,J2)])),[[r.unref(Cr)]]):(r.openBlock(),r.createElementBlock("img",{key:1,class:"drum_img",src:r.unref(i)||""},null,8,em)),r.createElementVNode("p",null,r.toDisplayString(a.group.name),1)],10,Q2)):r.createCommentVNode("",!0)}}),[["__scopeId","data-v-108110a6"]]),nm={},rm={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 im(a,l){return r.openBlock(),r.createElementBlock("svg",rm,[...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 om=We(nm,[["render",im]]),sm={class:"recommendation_wrapper"},am={class:"recommendation_header"},lm={class:"recommendation_info"},cm=We(r.defineComponent({__name:"Recommendation",props:{closeCurrentCard:{},openCurrentCard:{}},setup(a){const l=Ut(),{isUpSale:i,dataUpSale:o}=we.storeToRefs(l),u=()=>{i.value=!1};return r.onUnmounted(()=>{o.value=null}),(f,m)=>(r.openBlock(),r.createElementBlock("div",sm,[r.createElementVNode("div",am,[m[0]||(m[0]=r.createElementVNode("p",{class:"header_title"},"Часто берут вместе",-1)),r.createElementVNode("div",{class:"header_close",onClick:u},[r.createVNode(om,{class:"close_icon"})])]),r.createElementVNode("div",lm,[(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"]]),dm=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":""}),(i,o)=>null}}),um={class:"wrapper_modal"},fm={class:"card_modal"},hm=We(r.defineComponent({__name:"ModalWindows",props:{visible:{type:Boolean}},setup(a){const l=a,i=Ut(),{isUpSale:o}=we.storeToRefs(i),u=()=>{o.value=!1};return(f,m)=>(r.openBlock(),r.createElementBlock(r.Fragment,null,[r.createVNode(dm,{data:l.visible},null,8,["data"]),r.createElementVNode("div",{class:"black_modal",onClick:u}),r.createElementVNode("div",um,[r.createElementVNode("div",fm,[r.renderSlot(f.$slots,"default",{},void 0,!0)])])],64))}}),[["__scopeId","data-v-ec2b2c4d"]]);var Ce;(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"})(Ce||(Ce={}));var wa=new Map([[Ce.QR_CODE,"QR_CODE"],[Ce.AZTEC,"AZTEC"],[Ce.CODABAR,"CODABAR"],[Ce.CODE_39,"CODE_39"],[Ce.CODE_93,"CODE_93"],[Ce.CODE_128,"CODE_128"],[Ce.DATA_MATRIX,"DATA_MATRIX"],[Ce.MAXICODE,"MAXICODE"],[Ce.ITF,"ITF"],[Ce.EAN_13,"EAN_13"],[Ce.EAN_8,"EAN_8"],[Ce.PDF_417,"PDF_417"],[Ce.RSS_14,"RSS_14"],[Ce.RSS_EXPANDED,"RSS_EXPANDED"],[Ce.UPC_A,"UPC_A"],[Ce.UPC_E,"UPC_E"],[Ce.UPC_EAN_EXTENSION,"UPC_EAN_EXTENSION"]]),Ca;(function(a){a[a.UNKNOWN=0]="UNKNOWN",a[a.URL=1]="URL"})(Ca||(Ca={}));function mm(a){return Object.values(Ce).includes(a)}var Si;(function(a){a[a.SCAN_TYPE_CAMERA=0]="SCAN_TYPE_CAMERA",a[a.SCAN_TYPE_FILE=1]="SCAN_TYPE_FILE"})(Si||(Si={}));var gm=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=[Si.SCAN_TYPE_CAMERA,Si.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}(),So;(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"})(So||(So={}));var pm=function(){function a(){}return a.createFrom=function(l){return{errorMessage:l,type:So.UNKWOWN_ERROR}},a}(),xm=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 Vn(a){return typeof a>"u"||a===null}var yr=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}(),Io={exports:{}};(function(a,l){(function(i,o){o(l)})(_r,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 v{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 D{static fill(e,t){for(let n=0,s=e.length;n<s;n++)e[n]=t}static fillWithin(e,t,n,s){D.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 v.arraycopy(e,t,c,0,s),c}static binarySearch(e,t,n){n===void 0&&(n=D.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 M{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)}}M.MIN_VALUE_32_BITS=-2147483648,M.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);v.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+M.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+M.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&&D.equals(this.bits,t.bits)}hashCode(){return 31*this.size+D.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 ue=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&&(ue||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)===`
11
+ */var kn=function(){return kn=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},kn.apply(this,arguments)};typeof SuppressedError=="function"&&SuppressedError;var tr;(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 v=this.getPenaltyScore();v<T&&(C=I,T=v),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 v=m.getNumDataCodewords(B,_)*8,k=f.getTotalBits(p,B);if(k<=v){T=k;break}if(B>=C)throw new RangeError("Data too long")}for(var P=0,D=[m.Ecc.MEDIUM,m.Ecc.QUARTILE,m.Ecc.HIGH];P<D.length;P++){var M=D[P];I&&T<=m.getNumDataCodewords(B,M)*8&&(_=M)}for(var j=[],z=0,Z=p;z<Z.length;z++){var V=Z[z];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),v=[],k=m.reedSolomonComputeDivisor(y),P=0,D=0;P<C;P++){var M=p.slice(D,D+T-y+(P<B?0:1));D+=M.length;var j=m.reedSolomonComputeRemainder(M,k);P<B&&M.push(0),v.push(M.concat(j))}for(var z=[],Z=function(V){v.forEach(function(L,F){(V!=T-y||F>=B)&&z.push(L[V])})},P=0;P<v[0].length;P++)Z(P);return u(z.length==I),z},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 v=0,k=0,P=this.modules;k<P.length;k++){var D=P[k];v=D.reduce(function(z,Z){return z+(Z?1:0)},v)}var M=this.size*this.size,j=Math.ceil(Math.abs(v*20-M*10)/M)-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 v=T^x.shift();x.push(0),_.forEach(function(k,P){return x[P]^=m.reedSolomonMultiply(k,v)})},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})(tr||(tr={})),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={}))}(tr||(tr={})),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={}))}(tr||(tr={}));var Er=tr,Co="L",Eo={L:Er.QrCode.Ecc.LOW,M:Er.QrCode.Ecc.MEDIUM,Q:Er.QrCode.Ecc.QUARTILE,H:Er.QrCode.Ecc.HIGH},v1=function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0}();function yo(a){return a in Eo}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,v=null;if(o.excavate){var k=Math.floor(B),P=Math.floor(T),D=Math.ceil(y+B-k),M=Math.ceil(I+T-P);v={x:k,y:P,w:D,h:M}}return{x:B,y:T,h:I,w:y,excavation:v}}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 bo={value:{type:String,required:!0,default:""},size:{type:Number,default:100},level:{type:String,default:Co,validator:function(a){return yo(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"}},P1=kn(kn({},bo),{renderAs:{type:String,required:!1,default:"canvas",validator:function(a){return["canvas","svg"].indexOf(a)>-1}}}),L1=r.defineComponent({name:"QRCodeSvg",props:bo,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=yo(p)?p:Co,y=Er.QrCode.encodeText(m,Eo[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",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},o))])}}}),F1=r.defineComponent({name:"QRCodeCanvas",props:bo,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,v=a.gradientEndColor,k=x>>>0,P=yo(p)?p:Co,D=i.value;if(D){var M=D.getContext("2d");if(M){var j=Er.QrCode.encodeText(m,Eo[P]).getModules(),z=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=_/z*re;if(D.height=D.width=_*re,M.scale(K,K),M.fillStyle=C,M.fillRect(0,0,z,z),I){var ee=void 0;B==="linear"?ee=M.createLinearGradient(0,0,z,z):ee=M.createRadialGradient(z/2,z/2,0,z/2,z/2,z/2),ee.addColorStop(0,T),ee.addColorStop(1,v),M.fillStyle=ee}else M.fillStyle=y;v1?M.fill(new Path2D(ma(j,k))):j.forEach(function(G,W){G.forEach(function(N,X){N&&M.fillRect(X+k,W+k,1,1)})}),L&&M.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",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: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"?L1:F1,{value:i,size:o,margin:u,level:f,background:m,foreground:p,imageSettings:_,gradient:x,gradientType:C,gradientStartColor:y,gradientEndColor:I})},props:P1});const V1={},U1={viewBox:"0 0 24 24","aria-hidden":"true"};function z1(a,l){return r.openBlock(),r.createElementBlock("svg",U1,[...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 H1=He(V1,[["render",z1]]),G1={},W1={viewBox:"0 0 24 24","aria-hidden":"true"};function X1(a,l){return r.openBlock(),r.createElementBlock("svg",W1,[...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 $1=He(G1,[["render",X1]]),j1="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",q1={class:"wrapper_qr_page"},Z1=["src"],Y1={class:"modal_qr"},K1={class:"modal_qr_content"},Q1={class:"wrapper_icon_qr"},J1=["src"],ef={class:"total_order_price"},tf={class:"ttl_wrapper"},nf={class:"ttl_head"},rf={class:"ttl_bar"},of={class:"hint hint-anim","aria-label":"Инструкция по оплате"},sf={class:"steps","aria-hidden":"true"},af={class:"step is-active","data-i":"0"},lf={class:"ico"},cf={class:"step","data-i":"1"},df={class:"ico"},uf={class:"step","data-i":"2"},ff={class:"ico"},hf=["src"],mf={class:"qr_border"},gf=He(r.defineComponent({__name:"CompletedQRCode",setup(a){const l=bt(),i=vt(),o=lt(),u=Ne.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 v=Math.floor(p.value/60),k=p.value%60;return`${v}:${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}=An(()=>l.itemThemes.kiosk_preloader?"preloader":null);return(v,k)=>(r.openBlock(),r.createElementBlock("div",q1,[(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,Z1)])),k[7]||(k[7]=r.createElementVNode("div",{class:"start_img_black"},null,-1)),r.createElementVNode("div",Y1,[r.createElementVNode("div",K1,[r.createElementVNode("div",Q1,[r.createElementVNode("img",{src:r.unref(ha),width:"100",height:"100"},null,8,J1)]),k[6]||(k[6]=r.createElementVNode("h1",null,"Оплата по QR",-1)),r.createElementVNode("p",ef,[r.createVNode(gt,{price:y.value,fixedFloat:2},null,8,["price"]),r.createTextVNode(" "+r.toDisplayString(r.unref(o).config_lib.currency_symbol),1)]),r.createElementVNode("div",tf,[r.createElementVNode("div",nf,[k[0]||(k[0]=r.createElementVNode("span",null,"Срок жизни QR-кода",-1)),r.createElementVNode("b",null,r.toDisplayString(x.value),1)]),r.createElementVNode("div",rf,[r.createElementVNode("div",{class:"ttl_fill",style:r.normalizeStyle({width:`${C.value}%`})},null,4)])]),r.createElementVNode("p",of,[r.createElementVNode("div",sf,[r.createElementVNode("div",af,[r.createElementVNode("div",lf,[r.createVNode(H1)]),k[1]||(k[1]=r.createElementVNode("div",{class:"txt"},"Возьмите телефон →",-1))]),k[4]||(k[4]=r.createElementVNode("div",{class:"sep"},null,-1)),r.createElementVNode("div",cf,[r.createElementVNode("div",df,[r.createVNode($1)]),k[2]||(k[2]=r.createElementVNode("span",{class:"txt"},"Отсканируйте QR-код",-1))]),k[5]||(k[5]=r.createElementVNode("span",{class:"sep"},"→",-1)),r.createElementVNode("div",uf,[r.createElementVNode("div",ff,[r.createElementVNode("img",{src:r.unref(j1),width:"30",height:"30"},null,8,hf)]),k[3]||(k[3]=r.createElementVNode("span",{class:"txt"},"Оплатите заказ",-1))])])]),r.createElementVNode("div",mf,[r.createVNode(xa,{value:r.unref(i).linkQR,size:200,level:"Q","render-as":"svg","image-settings":f},null,8,["value"])]),r.createVNode(cn,{textButtonDefault:"Отменить заказ",onClick:B,class:"cancel_order_btn"})])])]))}}),[["__scopeId","data-v-bd3b4b16"]]),pf={key:0,class:"wrapper_qr"},xf={key:1,class:"wrapper_qr"},_f={key:2,class:"wrapper_qr"},wf={key:3,class:"wrapper_qr"},Cf=He(r.defineComponent({__name:"CartCompletedOrder",props:{orderNumber:{}},setup(a){const l=vt(),i=bt(),{orderNumber:o,orderCompleted_lib:u}=we.storeToRefs(l),{mediaUrl:f}=An(()=>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",pf,[r.createVNode(R1)])):r.unref(u)&&r.unref(u)===2?(r.openBlock(),r.createElementBlock("section",xf,[r.createVNode(D1)])):r.createCommentVNode("",!0),r.unref(u)&&r.unref(u)===3?(r.openBlock(),r.createElementBlock("section",_f,[r.createVNode(y1,{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",wf,[r.createVNode(gf)])):r.createCommentVNode("",!0)],64))}}),[["__scopeId","data-v-3779e8ee"]]);function Ef(){const a=Ne.useRoute(),l=vt(),i=lt(),o=Ln(),{isButtonDisabled:u}=we.storeToRefs(l),f=(p,_,x)=>{const C=o.isTableService?"tableservice":p.kiosk_menu?"kiosk":"qr",y=l.createPaymentHandler(C,p.kiosk_menu,_,x);return y?{...y.config,route:{params:{orgId:String(a.params.orgId)}},handler:y.handler,resetDiscounts:p.resetDiscounts,setButtonDisabled:I=>{u.value=I},on403Kiosk:()=>{localStorage.removeItem("apiKey"),i.is_showApiKey=!0}}:null};return{getCreateOrderConfig:f,makeCreateOrderRequest:async(p,_)=>{const x=f(p,_.paymentMethodId,_.locator);if(x)return Fd(_.items,x,{comment:_.comment,is_authorized:_.isAuthorized,signal:_.signal})}}}const yf={},bf={class:"cart_loyal_qr",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none"};function Af(a,l){return r.openBlock(),r.createElementBlock("svg",bf,[...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 Sf=He(yf,[["render",Af]]),Ao=a=>{const l=Ai(),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}},If={class:"cart_deletion_modal_content"},Nf={class:"cart_deletion_modal_title"},Tf={class:"cart_deletion_modal_footer"},kf=He(r.defineComponent({__name:"CartDeleteConfirm",emits:["confirm"],setup(a,{emit:l}){const i=l,{visible:o,context:u,close:f}=Ao("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",If,[r.createElementVNode("div",Nf,"Удалить "+r.toDisplayString(r.unref(u).name)+"?",1),_[2]||(_[2]=r.createElementVNode("div",{class:"cart_deletion_modal_body"},"Эта позиция будет полностью удалена из заказа.",-1)),r.createElementVNode("div",Tf,[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"]]),Rf={class:"cart_extend_modal_content"},Bf={class:"cart_extend_modal_footer"},Of=He(r.defineComponent({__name:"CartExtendConfirm",emits:["confirm"],setup(a,{emit:l}){const i=l,{visible:o,context:u,close:f}=Ao("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",Rf,[_[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",Bf,[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"]]),Mf={class:"locator_card"},Df={class:"locator_top_row"},vf={class:"locator_circle"},Pf={class:"locator_number"},Lf={class:"locator_keypad"},Ff=["onClick"],Vf={class:"locator_last_row"},Uf={class:"locator_actions"},zf=["disabled"],Hf=3,Gf=r.defineComponent({__name:"Locator",emits:["close","create-order"],setup(a,{emit:l}){const i=r.ref(""),o=l,u=r.ref(!1);let f=null;const m=()=>{u.value=!1,f&&clearTimeout(f),f=setTimeout(()=>{u.value=!1},260),u.value=!0},p=C=>{i.value.length<Hf&&(i.value+=C,m())},_=()=>{i.value.length>0&&(i.value=i.value.slice(0,-1))},x=(C=!1)=>{const y=C?"":i.value.trim();o("create-order",y||void 0),o("close")};return r.onBeforeUnmount(()=>{f&&clearTimeout(f)}),(C,y)=>(r.openBlock(),r.createElementBlock("div",{class:r.normalizeClass(["locator_overlay",{locator_feedback_active:u.value}]),onClick:y[4]||(y[4]=r.withModifiers(I=>o("close"),["self"]))},[r.createElementVNode("div",Mf,[r.createElementVNode("div",Df,[r.createElementVNode("button",{class:"locator_back_button",onClick:y[0]||(y[0]=I=>o("close"))},[r.createVNode(mo,{class:"locator_back_svg"})]),r.createElementVNode("div",vf,[y[5]||(y[5]=r.createElementVNode("div",{class:"locator_ring"},null,-1)),y[6]||(y[6]=r.createElementVNode("div",{class:"locator_ring"},null,-1)),y[7]||(y[7]=r.createElementVNode("div",{class:"locator_ring"},null,-1)),r.createElementVNode("p",Pf,r.toDisplayString(i.value||""),1)])]),y[8]||(y[8]=r.createElementVNode("p",{class:"locator_title"},"Введите номер вашего локатора",-1)),r.createElementVNode("div",Lf,[(r.openBlock(),r.createElementBlock(r.Fragment,null,r.renderList(9,I=>r.createElementVNode("button",{key:I,class:"locator_key",onClick:B=>p(I.toString())},r.toDisplayString(I),9,Ff)),64)),r.createElementVNode("div",Vf,[r.createElementVNode("button",{class:"locator_key",onClick:y[1]||(y[1]=I=>p("0"))},"0"),r.createElementVNode("button",{class:"locator_key locator_delete_key",onClick:_},"⌫")])]),r.createElementVNode("div",Uf,[r.createElementVNode("button",{class:"locator_btn locator_continue_btn",disabled:i.value.length===0,onClick:y[2]||(y[2]=I=>x(!1))}," Продолжить ",8,zf),r.createElementVNode("button",{class:"locator_btn no_locator_btn",onClick:y[3]||(y[3]=I=>x(!0))},"Нет локатора")])])],2))}}),Wf={class:"order_box_wrapper"},Xf=["src"],$f={class:"order_box_content_wrapper"},jf={class:"order_box_content_info"},qf={class:"order_box_name"},Zf={key:0,class:"order_box_size"},Yf={class:"order_box_amount"},Kf={class:"order_box_amount_count"},Qf={key:1,class:"order_box_status"},Jf=["data-state"],eh={class:"order_box_info_more"},th={key:1,class:"cart_modifier_info"},nh={class:"cart_modifier_content"},rh={class:"wrapper_price_count_cart"},ih={class:"count_order_box"},oh={class:"wrapper_modifiers_discount"},So=He(r.defineComponent({__name:"OrderBox",props:{index:Number,cardItem:Object},emits:["delete"],setup(a,{emit:l}){const i=a,o=bt(),u=r.ref(o.itemThemes.qr_show_modifiers_in_cart??!1),{displayNumber:f,update:m}=po(0,800),p=r.computed(()=>{var T,v;const I=((T=i.cardItem)==null?void 0:T.modifiers)??[],B=(((v=i.cardItem)==null?void 0:v.group_modifiers)??[]).flatMap(k=>k.modifiers??[]);return[...I,...B]}),{mediaUrl:_}=An(()=>{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,v,k,P,D,M,j,z,Z;return r.openBlock(),r.createElementBlock("div",Wf,[r.createElementVNode("img",{src:r.unref(_)||"",class:"order_box_image"},null,8,Xf),r.createElementVNode("div",$f,[r.createElementVNode("div",jf,[r.createElementVNode("p",qf,r.toDisplayString((T=a.cardItem)==null?void 0:T.name),1),(v=a.cardItem)!=null&&v.size?(r.openBlock(),r.createElementBlock("p",Zf,r.toDisplayString(((P=(k=a.cardItem)==null?void 0:k.size)==null?void 0:P.alt_name)||((D=a.cardItem)==null?void 0:D.size.name)),1)):r.createCommentVNode("",!0),r.createElementVNode("div",Yf,[B[0]||(B[0]=r.createElementVNode("button",{disabled:""},"-",-1)),r.createElementVNode("p",Kf,r.toDisplayString((M=i.cardItem)==null?void 0:M.amount),1),B[1]||(B[1]=r.createElementVNode("button",{disabled:""},"+",-1))]),y.value?(r.openBlock(),r.createElementBlock("div",Qf,[r.createElementVNode("span",{"data-state":(j=a.cardItem)==null?void 0:j.cooking_state},r.toDisplayString(y.value),9,Jf)])):r.createCommentVNode("",!0)]),r.createElementVNode("div",eh,[(z=i.cardItem)!=null&&z.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",th,[(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",nh,[r.createVNode(Ei,{id:"plus_orange"}),r.createElementVNode("p",null,r.toDisplayString(V.name),1)]),r.createElementVNode("div",rh,[r.createElementVNode("p",ih,r.toDisplayString(`x${V.amount}`),1),r.createElementVNode("div",oh,[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"]]),sh={class:"cart_wrapper"},ah={class:"cart_header_content"},lh={key:0,class:"cart_header_subwrapper"},ch={class:"cart_kso_button_wrapper"},dh={key:0},uh={key:0,class:"kso_btn_wrapper"},fh=["src"],hh={key:0,class:"cart_qr_button_wrapper"},mh={class:"cart_header_info"},gh={class:"cart_header_info"},ph={class:"cart_header_info"},xh={class:"cart_header_info"},_h={key:1,class:"cart-tabs-wrapper"},wh={class:"cart-tabs-container"},Ch=["data-active","onClick"],Eh={key:0,class:"wrapper_comment"},yh={class:"wrapper_limit_in_area"},bh=["placeholder","maxlength","aria-invalid"],Ah={class:"limit_comment"},Sh={key:1,class:"wrapper_comment"},Ih={class:"wrapper_limit_in_area"},Nh=["placeholder","maxlength","aria-invalid"],Th={class:"limit_comment"},kh={key:2},Rh={class:"table_order_desk_number"},Bh={key:0,class:"table_order_indent_number"},Oh={class:"cart_footer_wrapper"},Mh={key:0,class:"footer_title",'"':""},Dh=["disabled","max"],vh={key:1,class:"footer_sales"},Ph={key:2,class:"footer_sales"},Lh=["step","max"],Fh={class:"list_price"},Vh={key:0},Uh={key:1},zh={key:2},Hh={class:"accept_field"},Gh={class:"accept_field"},Wh={key:3},Xh={class:"accept_field"},$h={class:"accept_field"},jh={key:4},qh={key:5},Zh={key:0,class:"accept_field"},Yh={key:1,class:"accept_field"},Kh={key:4,class:"cart_min_order_notice"},Qh={class:"wrapper_footer_cart_btn"},Jh=50,_a=46,e2=r.defineComponent({__name:"CartPage",props:{configPage:{},textPaymentBtn:{},config_qr:{type:Boolean}},setup(a){const l=bn.create();let i;const o=lt(),u=vt(),f=bt(),m=Ln(),p=Ai(),_=a,{initialCartPrice_lib:x,totalPrice_lib:C,countBonus:y,config_lib:I,cartProducts_lib:B,profile:T}=we.storeToRefs(o),{itemThemes:v}=we.storeToRefs(f),{isButtonDisabled:k,orderCompleted_lib:P,orderNumber:D,extraDiscount:M,is_notification_lib:j,isCreateButtonVisible:z,is_paymentCart:Z,providerTypes:V,notificationData_lib:L,selectedProvider:F,configPayment:re}=we.storeToRefs(u),K=Ne.useRouter(),ee=Ne.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),ae=r.ref(!1),oe=r.ref(!1),xe=r.ref(!1),_e=r.ref(0),Pe=r.ref(0),he=r.ref(!0),qe=r.ref(),ye=r.computed(()=>_.configPage.qr_menu?"YOOKASSA_BASE":V.value[0].front_type),Qe=r.computed(()=>_.configPage.qr_menu?"YOOKASSA":V.value[0].type),ct=r.computed(()=>{var ge,se;return _.configPage.kiosk_menu&&((ge=I.value)==null?void 0:ge.loyalty)==="IIKO"&&(I.value.has_loyalty_default_user||T.value)||_.configPage.qr_menu&&((se=I.value)==null?void 0:se.loyalty)==="IIKO"&&(T.value||v.value.qr_auth_required===!1)}),tt=r.computed(()=>["АВТОРИЗОВАТЬСЯ ДЛЯ ЗАКАЗА"].includes(_.textPaymentBtn.toUpperCase())?_.textPaymentBtn:m.isTableService&&m.hasOrder?"Дополнить заказ":z.value?"Создать заказ":_.textPaymentBtn),_t=r.computed(()=>{var se;if(!_.configPage.kiosk_menu)return!1;const ge=(se=v.value)==null?void 0:se.kiosk_enable_locators;return ge!==!1&&ge!=="false"}),{width:De}=mt.useElementSize(G,{width:0,height:0},{box:"border-box"}),Ae=r.computed(()=>{var Ue,Fe,hn,wt;const ge={energy_amount:0,proteins_amount:0,fat_amount:0,carbohydrates_amount:0};let se=ge;return m.isTableService&&((Fe=(Ue=m.order)==null?void 0:Ue.items)!=null&&Fe.length)&&(se=((wt=(hn=m.order)==null?void 0:hn.items)==null?void 0:wt.reduce((nt,Xe)=>(Xe!=null&&Xe.nutrition&&(nt.energy_amount+=(Xe.nutrition.energy_amount||0)*(Xe.amount||0),nt.proteins_amount+=(Xe.nutrition.proteins_amount||0)*(Xe.amount||0),nt.fat_amount+=(Xe.nutrition.fat_amount||0)*(Xe.amount||0),nt.carbohydrates_amount+=(Xe.nutrition.carbohydrates_amount||0)*(Xe.amount||0)),nt),ge))||ge),B.value.reduce((nt,Xe)=>(nt.energy_amount+=(Xe.energy_amount||0)*(Xe.amount||0),nt.proteins_amount+=(Xe.proteins_amount||0)*(Xe.amount||0),nt.fat_amount+=(Xe.fat_amount||0)*(Xe.amount||0),nt.carbohydrates_amount+=(Xe.carbohydrates_amount||0)*(Xe.amount||0),nt),se)}),Be=r.computed(()=>{var ge;if((ge=v.value)!=null&&ge.comments){const se=v.value.comments;return{fieldName:_.configPage.kiosk_menu?se.kiosk_comment_field_name:se.qr_comment_field_name,placeholder:_.configPage.kiosk_menu?se.kiosk_comment_field_placeholder:se.qr_comment_field_placeholder,show:_.configPage.kiosk_menu?se.kiosk_show_order_comment:se.qr_show_order_comment}}}),Ke=mt.computedAsync(async ge=>{var Fe;const se=new AbortController;if(ge(()=>se.abort()),!N.value||!((Fe=T.value)!=null&&Fe.balance)||!C.value)return 0;const Ue=await l.maxPayByBonuses(qe.value,_.configPage.kiosk_menu,!!_.configPage.userData||!!T.value,se.signal);return Ue!=null&&Ue.by_bonuses?($.value=Ue.non_integers_allowed||!1,Math.min(Ue.by_bonuses,T.value.balance,C.value)):0},0,{shallow:!0}),it=()=>K.push(`/${ee.params.orgId}/`),et=ge=>{($.value?["a","A","+","-","."]:["a","A","+","-",".",","]).includes(ge.key)&&ge.preventDefault()},ve=ge=>{o.deleteItemFromCart(ge),B.value.length===0&&(ae.value=!1,oe.value=!1,m.hasOrder&&K.replace({name:"order-ts"}))},Ar=()=>{ae.value=!ae.value,J.value.length},be=r.computed(()=>{var se;return(((se=v.value.cart_loyalty_button)==null?void 0:se.cart_loyalty_button_text)||"Программа лояльности").replace(/\S+/g,Ue=>Ue.length>15?Ue.slice(0,15)+"...":Ue)}),Sr=()=>{oe.value=!oe.value,J.value.length},jr=()=>{let ge=$.value?+y.value.toFixed(2):Math.floor(y.value)||0;ge>Ke.value&&(ge=Ke.value),ge!==y.value&&o.setBonus(ge)};r.watchEffect(()=>{jr(),o.setBonus(C.value===0?0:$.value?+y.value.toFixed(2):Math.floor(y.value))});const fn=()=>B.value.map(ge=>({id:ge.id,front_item_id:ge.idSystem,is_fake:!!ge.is_fake,is_od_united_product:!!ge.is_od_united_product,removals:ge.removals??null,amount:ge.amount,size:ge.size,modifiers:ge.modifiers??[],group_modifiers:ge.group_modifiers??[]})),{makeCreateOrderRequest:qr}=Ef(),nn=r.computed(()=>fn()),or=r.computed(()=>xe.value?_a:Jh),Pt=r.computed(()=>{var ge,se,Ue,Fe;return _.configPage.qr_menu&&((se=(ge=v.value)==null?void 0:ge.comments)==null?void 0:se.qr_is_order_comment_required)||_.configPage.kiosk_menu&&((Fe=(Ue=v.value)==null?void 0:Ue.comments)==null?void 0:Fe.kiosk_is_order_comment_required)}),Lt=()=>{var ge,se;return!(Pt.value&&((se=(ge=J.value)==null?void 0:ge.trim())==null?void 0:se.length)<1&&q.value)||m.isTableService&&m.hasOrder?!1:(u.showNotification("Обязательно перед созданием заказа укажите комментарий к заказу"),q.value.focus(),le.value=!0,Dt.animate(q.value.parentElement,{x:[0,-10,0,10,0]},{duration:.1,repeat:2}),!0)},Bi=async()=>{var ge,se,Ue;if(_.configPage.qr_menu&&!T.value&&v.value.qr_auth_required!==!1){K.push(`/${ee.params.orgId}/register`);return}if(!(Pt.value&&Lt())){if(m.isTableService){if((ge=m.data)!=null&&ge.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(qe.value),u.deleteCart(),m.refresh(),K.push({name:"order-ts"})}catch(Fe){u.showNotification(((Ue=(se=Fe==null?void 0:Fe.response)==null?void 0:se.data)==null?void 0:Ue.user_friendly_message)||"Ошибка при создании заказа"),m.refresh(),k.value=!1,$e()}return}if(_.configPage.qr_menu||V.value.length<=1){k.value=!0,await lo(qe.value,Qe.value).then(Fe=>{re.value&&Fe.url&&_.configPage.qr_menu&&window.location.replace(Fe.url)});return}return Z.value=!Z.value}},Ir=()=>{Z.value=!1},Do=async()=>{var se,Ue,Fe,hn,wt;M.value=0;const ge={items:[...fn()],comment:J.value,combos:[]};m.id&&(ge.table=m.id),(se=_.configPage)!=null&&se.kiosk_menu&&((Ue=u.selectedOrderType)!=null&&Ue.id)&&(ge.order_type_id=(Fe=u.selectedOrderType)==null?void 0:Fe.id);try{X.value=!0;const nt=await l.calculateDiscount(ge,_.configPage.kiosk_menu,!!_.configPage.userData||!!T.value,i.signal);if(!B.value)return;B.value.forEach(Xe=>{const Tt=nt.items.find(zt=>zt.front_item_id===Xe.idSystem);if(Tt&&(Xe.group_modifiers.forEach(zt=>{const Ct=Tt.group_modifiers.find(Ot=>Ot.group===zt.group);Ct&&zt.modifiers.forEach(Ot=>{const at=Ct.modifiers.find(Oe=>Oe.id===Ot.id);if(at&&Number(Ot.price)!==Number(at==null?void 0:at.new_price)){const Oe=(at.discounts||[]).reduce((Ht,Ee)=>Ht+=+Ee.discount,0);_e.value+=Oe,Ot.new_price=Ot.price,Ot.price=Number(at==null?void 0:at.new_price),Ot.total_new_price=Number(at.total_new_price)}})}),Xe.modifiers.forEach(zt=>{const Ct=Tt.modifiers.find(Ot=>Ot.id===zt.id);if(Ct&&Number(zt.price)!==Number(Ct==null?void 0:Ct.new_price)){const Ot=(Ct.discounts||[]).reduce((at,Oe)=>at+=+Oe.discount,0);_e.value+=Ot,zt.new_price=zt.price,zt.price=Number(Ct==null?void 0:Ct.new_price),zt.total_new_price=Number(Ct.total_new_price)}}),Xe.price!==Number(Tt.new_price))){const zt=(Tt.discounts||[]).reduce((Ct,Ot)=>Ct+=+Ot.discount,0);_e.value=_e.value+zt,Xe.new_price=Xe.price,Xe.price=Tt.new_price,Xe.discounts=Tt.discounts,Xe.total_new_price=Number(Tt.total_new_price)}}),B.value=[...B.value],_e.value!==0&&(C.value=nt.total_cart_price)}catch(nt){if(X.value=!1,!Ye.isCancel(nt))throw u.showNotification(((wt=(hn=nt==null?void 0:nt.response)==null?void 0:hn.data)==null?void 0:wt.user_friendly_message)||"Скидки временно недоступны"),nt}},Nt=async()=>{var se,Ue;let ge=k.value;k.value=!0;try{await l.extendOrder([...fn()]),u.deleteCart(),m.refreshOrder(),K.push({name:"order-ts"})}catch(Fe){throw u.showNotification(((Ue=(se=Fe==null?void 0:Fe.response)==null?void 0:se.data)==null?void 0:Ue.user_friendly_message)||"Не удалось дополнить заказ"),Fe}finally{k.value=ge}},pe=async ge=>{var se;if(!(Pt.value&&Lt())){qe.value=null,i=new AbortController,k.value=!0;try{ct.value&&await Do(),F.value={front_type:ye};const Ue={paymentMethodId:ye.value,items:nn.value,comment:ge?J.value.slice(0,_a):J.value,isAuthorized:!!_.configPage.userData||!!T,signal:i==null?void 0:i.signal,locator:ge||void 0},Fe=await qr({..._.configPage,resetDiscounts:$e},Ue);qe.value=(se=Fe==null?void 0:Fe.data)==null?void 0:se.id,z.value=!1}catch(Ue){console.log("[cart](createOrder)",Ue),!Ye.isCancel(Ue)&&m.isTableService&&m.refresh(),k.value=!1,$e()}}},Bt=()=>{var ge;if(_.configPage.qr_menu&&["АВТОРИЗОВАТЬСЯ ДЛЯ ЗАКАЗА"].includes(_.textPaymentBtn.toUpperCase())&&!T.value&&v.value.qr_auth_required!==!1)return K.push(`/${ee.params.orgId}/register`);if(m.isTableService&&((ge=m.data)!=null&&ge.available_extend))return p.open("cart-extend-confirm");if(z.value){if(Pt.value&&Lt())return;if(!_t.value)return pe();xe.value=!0;return}return Bi()},st=()=>{var ge;(ge=T.value)!=null&&ge.balance?T.value.balance>0&&(N.value=!N.value):u.showNotification("У Вас пока нет бонусов")};r.onMounted(async()=>{o.loadCart(),P.value=null,C.value=null,M.value=0,$e()}),r.onUnmounted(()=>{i&&(i==null||i.abort(),i=null),k.value=!1,qe.value=null,P.value=null,C.value=null,M.value=0,B.value.splice(0,B.value.length,...B.value.map(o.makeProductFullyReactive))});const dt=r.computed(()=>_.configPage.qr_menu?I.value.qr_order_minimum_price||0:_.configPage.kiosk_menu&&I.value.kiosk_order_minimum_price||0),sr=r.computed(()=>{var ge;return["АВТОРИЗОВАТЬСЯ ДЛЯ ЗАКАЗА"].includes(_.textPaymentBtn.toUpperCase())?!1:m.isTableService&&m.hasOrder&&!((ge=m.data)!=null&&ge.available_extend)||dt.value>x.value&&!m.hasOrder||X.value||k.value||B.value.length===0?!0:(P.value=null,k.value)}),ar=r.computed(()=>{var ge;return((ge=B.value)==null?void 0:ge.reduce((se,Ue)=>se+Ue.amount,0))||0}),Zr=r.computed(()=>{var ge;return(ge=T.value)==null?void 0:ge.phone});r.watch(J,ge=>{var se;return((se=ge==null?void 0:ge.trim())==null?void 0:se.length)&&(le.value=!1)}),r.watch(()=>B.value.length,(ge,se)=>{se!==void 0&&(ge<=se||r.nextTick(()=>{const Ue=W.value;Ue&&Ue.scrollTo({top:Ue.scrollHeight,behavior:"smooth"})}))}),r.watch([ar,Zr,()=>u.selectedOrderType],()=>{ar.value===0&&(i=null),i==null||i.abort(),k.value=!1});const $e=()=>{z.value=!0,o.setBonus(0),B.value.splice(0,B.value.length,...B.value.map(o.makeProductFullyReactive)),_e.value=0,C.value=null,M.value=0};return r.watch([()=>o.cartProducts_lib,Zr,ar,()=>u.selectedOrderType],ge=>{if(Pe.value>0){Pe.value--;return}ge&&!X.value&&(N.value=!1,$e(),Pe.value=1),X.value=!1},{deep:!0}),(ge,se)=>{var Ue,Fe,hn,wt,nt,Xe,Tt,zt,Ct,Ot,at;return r.openBlock(),r.createElementBlock(r.Fragment,null,[r.createElementVNode("div",sh,[r.createVNode(kf,{onConfirm:ve}),r.createVNode(Of,{onConfirm:Nt}),r.createVNode(da,{visible:r.unref(u).isDrawerOpen,"onUpdate:visible":se[0]||(se[0]=Oe=>r.unref(u).isDrawerOpen=Oe)},{default:r.withCtx(()=>[r.createVNode(fa)]),_:1},8,["visible"]),r.createVNode(xo),r.createElementVNode("header",ah,[_.configPage.kiosk_menu?(r.openBlock(),r.createElementBlock("div",lh,[r.createElementVNode("div",ch,[r.createElementVNode("div",{class:r.normalizeClass(["arrow_wrapper",{arrow_wrapper_kso:_.configPage.kiosk_menu}]),onClick:it},[r.createVNode(wr,{class:"cart_header_back_button"}),_.configPage.kiosk_menu?(r.openBlock(),r.createElementBlock("span",dh,"Назад")):r.createCommentVNode("",!0)],2)]),Be.value&&Be.value.show?(r.openBlock(),r.createElementBlock("div",uh,[Pt.value?r.createCommentVNode("",!0):(r.openBlock(),r.createBlock(cn,{key:0,style:r.normalizeStyle({visibility:!ae.value&&r.unref(B).length>0?"visible":"hidden"}),class:r.normalizeClass({button_kso_comment:a.configPage.kiosk_menu}),textButtonDefault:J.value.length>0?"Редактировать":Be.value&&Be.value.fieldName||"",onClick:()=>ae.value=!ae.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(v).kiosk_show_loyalty_card_button||r.unref(v).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:(Ue=r.unref(v).cart_loyalty_button)!=null&&Ue.cart_loyalty_button_sticker?`${Math.ceil(r.unref(De)/2+10)}px`:"",paddingRight:(Fe=r.unref(v).cart_loyalty_button)!=null&&Fe.cart_loyalty_button_sticker?0:""}),onClick:se[1]||(se[1]=(...Oe)=>r.unref(u).openDrawer&&r.unref(u).openDrawer(...Oe))},[r.createElementVNode("p",{class:"cart_loyal_program",style:r.normalizeStyle({marginRight:`${Math.ceil(r.unref(De)/2)}px`})},r.toDisplayString(be.value),5),(hn=r.unref(v).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(v).cart_loyalty_button.cart_loyalty_button_sticker})`})},[r.createElementVNode("img",{src:r.unref(v).cart_loyalty_button.cart_loyalty_button_sticker},null,8,fh)],4)):(r.openBlock(),r.createBlock(Sf,{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",hh,[r.createElementVNode("div",{class:"arrow_wrapper",onClick:it},[r.createVNode(wr,{class:"cart_header_back_button"})])])):r.createCommentVNode("",!0),r.unref(v).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",mh,[r.createElementVNode("p",null,[r.createVNode(gt,{price:Ae.value.energy_amount,duration:800},null,8,["price"]),se[11]||(se[11]=r.createTextVNode(" г",-1))]),se[12]||(se[12]=r.createElementVNode("p",{class:"cart_info_name"},"Килокалории",-1))]),r.createElementVNode("div",gh,[r.createElementVNode("p",null,[r.createVNode(gt,{price:Ae.value.proteins_amount,duration:900},null,8,["price"]),se[13]||(se[13]=r.createTextVNode(" г",-1))]),se[14]||(se[14]=r.createElementVNode("p",{class:"cart_info_name"},"Белки",-1))]),r.createElementVNode("div",ph,[r.createElementVNode("p",null,[r.createVNode(gt,{price:Ae.value.fat_amount,duration:1e3},null,8,["price"]),se[15]||(se[15]=r.createTextVNode(" г",-1))]),se[16]||(se[16]=r.createElementVNode("p",{class:"cart_info_name"},"Жиры",-1))]),r.createElementVNode("div",xh,[r.createElementVNode("p",null,[r.createVNode(gt,{price:Ae.value.carbohydrates_amount,duration:1100},null,8,["price"]),se[17]||(se[17]=r.createTextVNode(" г",-1))]),se[18]||(se[18]=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",_h,[r.createElementVNode("ul",wh,[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(r.unref(u).orderTypes,Oe=>{var Ht,Ee;return r.openBlock(),r.createElementBlock("li",{key:Oe.id,class:"cart-tab","data-active":Oe.id===((Ht=r.unref(u).selectedOrderType)==null?void 0:Ht.id),onClick:lr=>r.unref(u).selectedOrderType=Oe},[Oe.id===((Ee=r.unref(u).selectedOrderType)==null?void 0:Ee.id)?(r.openBlock(),r.createBlock(r.unref(Dt.motion).div,{key:0,class:"cart-underline","layout-id":"cart-underline",id:"cart-underline"})):r.createCommentVNode("",!0),r.createElementVNode("span",null,r.toDisplayString(Oe.name),1)],8,Ch)}),128))])])):r.createCommentVNode("",!0)]),(Pt.value||ae.value)&&a.configPage.kiosk_menu&&((wt=r.unref(B))!=null&&wt.length)?(r.openBlock(),r.createElementBlock("div",Eh,[r.createElementVNode("div",yh,[r.withDirectives(r.createElementVNode("textarea",{ref_key:"commentEl",ref:q,class:"comment_order",placeholder:Be.value&&Be.value.placeholder||"Ваш комментарий к заказу...",name:"commentKso",maxlength:or.value,"aria-invalid":le.value,"onUpdate:modelValue":se[2]||(se[2]=Oe=>J.value=Oe)},null,8,bh),[[r.vModelText,J.value]]),r.createElementVNode("p",Ah,r.toDisplayString(J.value.length+" / "+or.value),1)]),Pt.value?r.createCommentVNode("",!0):(r.openBlock(),r.createBlock(cn,{key:0,textButtonDefault:"Сохранить",onClick:Ar,class:"button_bonus_cart"}))])):r.createCommentVNode("",!0),(Pt.value||oe.value)&&a.config_qr&&((nt=r.unref(B))!=null&&nt.length)&&!(r.unref(m).isTableService&&r.unref(m).hasOrder)?(r.openBlock(),r.createElementBlock("div",Sh,[r.createElementVNode("div",Ih,[r.withDirectives(r.createElementVNode("textarea",{ref_key:"commentEl",ref:q,class:"comment_order",placeholder:Be.value&&Be.value.placeholder||"Ваш комментарий к заказу...",name:"commentQr",maxlength:or.value,"aria-invalid":le.value,"onUpdate:modelValue":se[3]||(se[3]=Oe=>J.value=Oe)},null,8,Nh),[[r.vModelText,J.value]]),r.createElementVNode("p",Th,r.toDisplayString(J.value.length+" / "+or.value),1)]),Pt.value?r.createCommentVNode("",!0):(r.openBlock(),r.createBlock(cn,{key:0,textButtonDefault:"Сохранить",onClick:Sr,class:"button_bonus_cart"}))])):r.createCommentVNode("",!0),a.config_qr&&Be.value&&Be.value.show&&!(r.unref(m).isTableService&&r.unref(m).hasOrder)?(r.openBlock(),r.createElementBlock("div",kh,[!Pt.value&&!oe.value&&r.unref(B).length>0?(r.openBlock(),r.createBlock(cn,{key:0,textButtonDefault:J.value.length>0?"Редактировать":Be.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:se[4]||(se[4]=Oe=>r.unref(m).order&&r.unref(K).push({name:"order-ts"}))},[r.createElementVNode("p",Rh,r.toDisplayString(`Стол № ${(Tt=r.unref(m).data)==null?void 0:Tt.number}`),1),(zt=r.unref(m).order)!=null&&zt.id?(r.openBlock(),r.createElementBlock("p",Bh,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&&((Ot=(Ct=r.unref(m).order)==null?void 0:Ct.items)!=null&&Ot.length)&&he.value?(r.openBlock(!0),r.createElementBlock(r.Fragment,{key:0},r.renderList(r.unref(m).order.items,Oe=>(r.openBlock(),r.createBlock(So,{key:Oe.idSystem,cardItem:Oe},null,8,["cardItem"]))),128)):r.createCommentVNode("",!0),(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(r.unref(B),Oe=>(r.openBlock(),r.createBlock(ua,{key:Oe.idSystem,cardItem:Oe,isShowModifiers:_.config_qr,onDelete:Ht=>ve(Oe.idSystem)},null,8,["cardItem","isShowModifiers","onDelete"]))),128))],512),r.createElementVNode("div",Oh,[N.value&&!r.unref(z)&&r.unref(Ke)>0?(r.openBlock(),r.createElementBlock("p",Mh,[se[19]||(se[19]=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||((at=r.unref(T))==null?void 0:at.balance)===0,"onUpdate:modelValue":se[5]||(se[5]=Oe=>r.isRef(y)?y.value=Oe:null),onInput:jr,min:"0",max:r.unref(Ke),step:".01",onKeypress:et},null,44,Dh),[[r.vModelText,r.unref(y),void 0,{number:!0}]]),se[20]||(se[20]=r.createTextVNode(" бонусов ",-1))])):r.createCommentVNode("",!0),N.value&&!r.unref(z)&&r.unref(Ke)>0?(r.openBlock(),r.createElementBlock("p",vh,"Доступно к списанию "+r.toDisplayString(r.unref(Ke))+" B из "+r.toDisplayString(r.unref(T)?r.unref(T).balance:0)+" B",1)):N.value&&!r.unref(z)?(r.openBlock(),r.createElementBlock("p",Ph,"Нет доступных для списания бонусов")):r.createCommentVNode("",!0),N.value&&!r.unref(z)&&r.unref(Ke)>0?r.withDirectives((r.openBlock(),r.createElementBlock("input",{key:3,type:"range",class:"footer_range","onUpdate:modelValue":se[6]||(se[6]=Oe=>r.isRef(y)?y.value=Oe:null),step:$.value?".01":"1",min:0,max:r.unref(Ke)},null,8,Lh)),[[r.vModelText,r.unref(y),void 0,{number:!0}]]):r.createCommentVNode("",!0),r.createElementVNode("ul",Fh,[N.value&&!r.unref(z)?(r.openBlock(),r.createElementBlock("li",Vh,[se[22]||(se[22]=r.createElementVNode("p",null,"Сумма заказа:",-1)),r.createElementVNode("p",null,[r.createVNode(gt,{price:r.unref(C),fixedFloat:2},null,8,["price"]),se[21]||(se[21]=r.createTextVNode(" ₽",-1))])])):r.createCommentVNode("",!0),N.value&&!r.unref(z)?(r.openBlock(),r.createElementBlock("li",Uh,[se[24]||(se[24]=r.createElementVNode("p",null,"Будет оплачено бонусами:",-1)),r.createElementVNode("p",null,[r.createVNode(gt,{price:r.unref(y),fixedFloat:2},null,8,["price"]),se[23]||(se[23]=r.createTextVNode(" Б",-1))])])):r.createCommentVNode("",!0),r.unref(M)!==0?(r.openBlock(),r.createElementBlock("li",zh,[r.createElementVNode("p",Hh,r.toDisplayString(r.unref(M)>0?"Надбавка":"Скидка")+": ",1),r.createElementVNode("p",Gh,[r.createVNode(gt,{price:Math.abs(r.unref(M)),fixedFloat:2},null,8,["price"]),se[25]||(se[25]=r.createTextVNode(" ₽",-1))])])):_e.value!==0?(r.openBlock(),r.createElementBlock("li",Wh,[r.createElementVNode("p",Xh,r.toDisplayString(_e.value>0?"Надбавка":"Скидка")+": ",1),r.createElementVNode("p",$h,[r.createVNode(gt,{price:Math.abs(_e.value),fixedFloat:2},null,8,["price"]),se[26]||(se[26]=r.createTextVNode(" ₽",-1))])])):r.createCommentVNode("",!0),r.unref(m).isTableService&&r.unref(m).order?(r.openBlock(),r.createElementBlock("li",jh,[se[28]||(se[28]=r.createElementVNode("p",null,"Сумма заказа:",-1)),r.createElementVNode("p",null,[r.createVNode(gt,{price:r.unref(m).order.total_cost,fixedFloat:2},null,8,["price"]),se[27]||(se[27]=r.createTextVNode(" ₽",-1))])])):r.createCommentVNode("",!0),r.unref(m).isTableService&&r.unref(m).order?(r.openBlock(),r.createElementBlock("li",qh,[se[30]||(se[30]=r.createElementVNode("p",null,"К счёту добавится:",-1)),r.createElementVNode("p",null,[r.createVNode(gt,{price:r.unref(C),fixedFloat:2},null,8,["price"]),se[29]||(se[29]=r.createTextVNode(" ₽",-1))])])):r.createCommentVNode("",!0),r.createElementVNode("li",null,[se[33]||(se[33]=r.createElementVNode("p",{class:"accept_field"},"Итого к оплате:",-1)),r.unref(m).isTableService&&r.unref(m).order?(r.openBlock(),r.createElementBlock("p",Zh,[r.createVNode(gt,{price:r.unref(m).order.total_cost+r.unref(C),fixedFloat:2},null,8,["price"]),se[31]||(se[31]=r.createTextVNode(" ₽",-1))])):(r.openBlock(),r.createElementBlock("p",Yh,[r.createVNode(gt,{price:r.unref(C)-r.unref(y),fixedFloat:2},null,8,["price"]),se[32]||(se[32]=r.createTextVNode(" ₽",-1))]))])]),dt.value&&dt.value>r.unref(x)&&!r.unref(m).hasOrder?(r.openBlock(),r.createElementBlock("div",Kh,[se[34]||(se[34]=r.createTextVNode(" Минимальная сумма заказа ",-1)),r.createVNode(gt,{price:dt.value,fixedFloat:2},null,8,["price"]),r.createTextVNode(" "+r.toDisplayString(r.unref(I).currency_symbol)+". Для оформления заказа необходимо добавить товаров на сумму ",1),r.createVNode(gt,{price:dt.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",Qh,[r.unref(T)&&!r.unref(z)&&!r.unref(m).isTableService?(r.openBlock(),r.createBlock(cn,{key:0,textButtonDefault:r.unref(v).bonuses_button_name||"Бонусы",onClick:st,class:"button_bonus_cart"},null,8,["textButtonDefault"])):r.createCommentVNode("",!0),r.createVNode(cn,{textButtonDefault:tt.value,onClick:Bt,class:"button_payment_cart",disabled:sr.value},null,8,["textButtonDefault","disabled"])])])]),r.unref(m).isTableService?r.createCommentVNode("",!0):(r.openBlock(),r.createBlock(Cf,{key:0,orderNumber:r.unref(D),pageNumber:1},null,8,["orderNumber"])),r.createVNode(yi,{visible:r.unref(j),"onUpdate:visible":se[7]||(se[7]=Oe=>r.isRef(j)?j.value=Oe:null),textNotificationDefault:r.unref(L).textNotification,backgroundColor:r.unref(v).accent_color?r.unref(v).accent_color:"#FF6D2E",buttonAccept:null},null,8,["visible","textNotificationDefault","backgroundColor"]),r.createVNode(wo,{modelValue:r.unref(Z),"onUpdate:modelValue":se[8]||(se[8]=Oe=>r.isRef(Z)?Z.value=Oe:null),class:"product_card_sheet","snap-points":["80%"]},{default:r.withCtx(()=>{var Oe;return[r.createVNode(m1,{"config-page":a.configPage,comment:J.value,"cart-items":nn.value,"is-authorized":!!_.configPage.userData||!!r.unref(T),"order-id":qe.value,signal:(Oe=r.unref(i))==null?void 0:Oe.signal,onSelectPayment:Ir},null,8,["config-page","comment","cart-items","is-authorized","order-id","signal"])]}),_:1},8,["modelValue"]),(r.openBlock(),r.createBlock(r.Teleport,{to:"body"},[xe.value?(r.openBlock(),r.createBlock(Gf,{key:0,onClose:se[9]||(se[9]=Oe=>xe.value=!1),onCreateOrder:se[10]||(se[10]=Oe=>pe(Oe))})):r.createCommentVNode("",!0)]))],64)}}}),t2={},n2={viewBox:"0 0 24 24"};function r2(a,l){return r.openBlock(),r.createElementBlock("svg",n2,[...l[0]||(l[0]=[r.createElementVNode("path",{d:"M18 6L6 18M6 6l12 12"},null,-1)])])}const i2=He(t2,[["render",r2]]),o2={class:"retry_screen"},s2={class:"retry_all_in_screen"},a2={class:"retry_content"},l2={class:"retry_icon_wrap"},c2={class:"retry_icon_circle"},d2={class:"retry_error_x"},u2=r.defineComponent({__name:"RetryPage",setup(a){const l=vt(),i=Ne.useRouter(),o=Ne.useRoute(),u=()=>{l.notificationData_lib.textNotification="",l.is_notification_lib=!1,i.replace(`/${o.params.orgId}/`)};return(f,m)=>(r.openBlock(),r.createElementBlock("section",o2,[r.createElementVNode("div",s2,[r.createElementVNode("main",a2,[r.createElementVNode("div",l2,[r.createElementVNode("div",c2,[m[0]||(m[0]=r.createElementVNode("div",{class:"retry_loader_mini"},null,-1)),r.createElementVNode("div",d2,[r.createVNode(i2)])])]),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))])]))}}),f2={class:"table_order_wrapper"},h2={class:"table_order_header_content"},m2={class:"table_order_kbju_qr_wrapper"},g2={class:"table_order_qr_button_wrapper"},p2={key:0,class:"table_order_header",style:{paddingRight:"10px"}},x2={class:"table_order_header_info"},_2={class:"table_order_header_info"},w2={class:"table_order_header_info"},C2={class:"table_order_header_info"},E2={key:0,class:"table_order_table_wrapper"},y2={class:"table_order_desk_number"},b2={class:"table_order_indent_number"},A2={class:"table_order_cards"},S2={class:"table_order_footer_wrapper"},I2={key:0,class:"footer_title"},N2=["disabled","max"],T2={key:1,class:"footer_sales"},k2=["step","max"],R2={class:"list_price"},B2={key:0},O2={key:1},M2={key:2},D2={key:3},v2={class:"accept_field"},P2={key:3,class:"wrapper_footer_table_order_btn"},L2=He(r.defineComponent({__name:"TableOrderPage",setup(a){const l=lt(),i=Gr(),o=bt(),u=Ln(),{countBonus:f}=we.storeToRefs(l),{itemThemes:m}=we.storeToRefs(o),p=Ne.useRouter(),_=Ne.useRoute(),x=bn.create(),C=r.ref(!1),y=r.ref(!1),I=r.ref(!1),B=r.ref(!1),T=r.ref(!1),v=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=mt.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}),D=()=>{T.value=!0},M=()=>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}},z=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",f2,[r.createElementVNode("header",h2,[r.createElementVNode("div",m2,[r.createElementVNode("div",g2,[r.createElementVNode("div",{class:"arrow_wrapper",onClick:M},[r.createVNode(wr,{class:"table_order_header_back_button"})])]),r.unref(m).show_nutrition_in_cart?(r.openBlock(),r.createElementBlock("div",p2,[r.createElementVNode("div",x2,[r.createElementVNode("p",null,[r.createVNode(gt,{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",_2,[r.createElementVNode("p",null,[r.createVNode(gt,{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",w2,[r.createElementVNode("p",null,[r.createVNode(gt,{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",C2,[r.createElementVNode("p",null,[r.createVNode(gt,{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",E2,[r.createElementVNode("p",y2,r.toDisplayString(`Стол № ${(re=r.unref(u).data)==null?void 0:re.number}`),1),r.createElementVNode("p",b2,r.toDisplayString(`Заказ ${r.unref(u).order.plugin_order.number}`),1)])):r.createCommentVNode("",!0),r.createElementVNode("div",A2,[(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(So,{key:$.idSystem,cardItem:$},null,8,["cardItem"]))),128)):r.createCommentVNode("",!0)]),r.createElementVNode("div",S2,[y.value?(r.openBlock(),r.createElementBlock("p",I2,[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:z},null,44,N2),[[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",T2," У вас есть "+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,k2)),[[r.vModelText,r.unref(f),void 0,{number:!0}]]):r.createCommentVNode("",!0),r.createElementVNode("ul",R2,[r.unref(u).order&&r.unref(u).order.total_cost-r.unref(u).order.remaining_amount>0?(r.openBlock(),r.createElementBlock("li",B2,[L[13]||(L[13]=r.createElementVNode("p",null,"Сумма заказа:",-1)),r.createElementVNode("p",null,[r.createVNode(gt,{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",O2,[L[15]||(L[15]=r.createElementVNode("p",null,"Оплачено:",-1)),r.createElementVNode("p",null,[r.createVNode(gt,{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(gt,{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",D2,[L[19]||(L[19]=r.createElementVNode("p",{class:"accept_field"},"Итого к оплате:",-1)),r.createElementVNode("p",v2,[r.createVNode(gt,{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",P2,[r.createVNode(cn,{textButtonDefault:B.value?"Запросить счёт":"Оплатить заказ",onClick:B.value?D:j,class:"button_payment_cart",disabled:v.value},null,8,["textButtonDefault","onClick","disabled"])])):r.createCommentVNode("",!0)])])}}}),[["__scopeId","data-v-75fa9255"]]),F2={class:"wrapper_loader"},V2=r.defineComponent({__name:"Loader",props:{size:{type:String,default:"40px"}},setup(a){return(l,i)=>(r.openBlock(),r.createElementBlock("div",F2,[r.createElementVNode("div",{class:"loader",style:r.normalizeStyle({width:a.size})},null,4)]))}}),U2=He(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"]]),z2={key:0},H2={class:"card__main__wrapper"},G2={key:0,class:"folder_content_top"},W2={key:0,class:"loader_card_main"},X2=["src","alt"],$2={class:"card_title_price_wrapper"},j2={class:"title"},q2={key:0,class:"price"},Z2={key:1},Y2={key:0,class:"card_button_add_wrapper"},wa=He(r.defineComponent({__name:"CardMain",props:{data:{},activeTags:{},is_group:{type:Boolean},parent:{},isLoading:{type:Boolean},selectGroupChild:{type:Function},takeCurrentCard:{type:Function}},setup(a){bt();const l=lt(),i=Ut(),{is_18_above_content:o,is18Allowed:u,notificationData_lib:f}=we.storeToRefs(l),{isDesktop:m}=zn(),p=a,_=(I,B)=>{var k,P,D;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},v=!((k=I.modifiers)!=null&&k.length)&&!((P=I.group_modifiers)!=null&&P.length)&&!((D=I.sizes)!=null&&D.length);if(i.isUpSale=!1,I.adult&&!u.value){o.value=!0,v&&(f.value.fastAdd=T);return}if(v){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}=An(()=>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",z2,[r.createVNode(U2,{id:p.data.id},{opacityLoader:r.withCtx(()=>[r.createElementVNode("div",H2,[a.is_group?(r.openBlock(),r.createElementBlock("div",G2)):r.createCommentVNode("",!0),r.createElementVNode("div",{onClick:B[0]||(B[0]=v=>x(p.data)),class:r.normalizeClass(["card__main",{card__main_folder:a.is_group}])},[a.isLoading?(r.openBlock(),r.createElementBlock("div",W2,[r.createVNode(V2)])):(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,X2),r.createElementVNode("div",$2,[r.createElementVNode("p",j2,r.toDisplayString(a.data.name),1),a.is_group?r.createCommentVNode("",!0):(r.openBlock(),r.createElementBlock("p",q2,r.toDisplayString(r.unref(hr)(a.data))+" ₽",1))])],2))],2),r.unref(m)?r.createCommentVNode("",!0):(r.openBlock(),r.createElementBlock("div",Z2,[a.is_group?r.createCommentVNode("",!0):(r.openBlock(),r.createElementBlock("div",Y2,[r.createElementVNode("div",{onClick:B[1]||(B[1]=v=>_(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"]]),K2=["id","onClick"],Q2=He(r.defineComponent({__name:"GroupMain",props:{menuGroup:{},idActiveGroup:{},activeTakeGroup:{type:Function}},setup(a){const{shouldUseDragScroll:l}=zn(),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,K2))),128))]),_:1},8,["container","idActive"])])),[[r.unref(Wr),r.unref(l)?{}:!1]]):r.createCommentVNode("",!0)}}),[["__scopeId","data-v-aa0ca388"]]),J2=["id","onClick"],em=He(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}=zn(),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,J2))),128))]),_:1},8,["container","idActive"])])),[[r.unref(Wr),r.unref(i)?{}:!1]]):r.createCommentVNode("",!0)}}),[["__scopeId","data-v-afba730a"]]),tm=["data-id","data-last"],nm=["src"],rm=["src"],im=He(r.defineComponent({__name:"DrumItem",props:{group:{},index:{},active:{type:Boolean}},setup(a){const l=a,{mediaUrl:i}=An(()=>{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,"data-last":a.group.is_last},[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,nm)])),[[r.unref(Cr)]]):(r.openBlock(),r.createElementBlock("img",{key:1,class:"drum_img",src:r.unref(i)||""},null,8,rm)),r.createElementVNode("p",null,r.toDisplayString(a.group.name),1)],10,tm)):r.createCommentVNode("",!0)}}),[["__scopeId","data-v-108110a6"]]),om={},sm={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 am(a,l){return r.openBlock(),r.createElementBlock("svg",sm,[...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 lm=He(om,[["render",am]]),cm={class:"recommendation_wrapper"},dm={class:"recommendation_header"},um={class:"recommendation_info"},fm=He(r.defineComponent({__name:"Recommendation",props:{closeCurrentCard:{},openCurrentCard:{}},setup(a){const l=Ut(),{isUpSale:i,dataUpSale:o}=we.storeToRefs(l),u=()=>{i.value=!1};return r.onUnmounted(()=>{o.value=null}),(f,m)=>(r.openBlock(),r.createElementBlock("div",cm,[r.createElementVNode("div",dm,[m[0]||(m[0]=r.createElementVNode("p",{class:"header_title"},"Часто берут вместе",-1)),r.createElementVNode("div",{class:"header_close",onClick:u},[r.createVNode(lm,{class:"close_icon"})])]),r.createElementVNode("div",um,[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(r.unref(o),p=>(r.openBlock(),r.createBlock(wa,{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"]]),hm=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":""}),(i,o)=>null}}),mm={class:"wrapper_modal"},gm={class:"card_modal"},pm=He(r.defineComponent({__name:"ModalWindows",props:{visible:{type:Boolean}},setup(a){const l=a,i=Ut(),{isUpSale:o}=we.storeToRefs(i),u=()=>{o.value=!1};return(f,m)=>(r.openBlock(),r.createElementBlock(r.Fragment,null,[r.createVNode(hm,{data:l.visible},null,8,["data"]),r.createElementVNode("div",{class:"black_modal",onClick:u}),r.createElementVNode("div",mm,[r.createElementVNode("div",gm,[r.renderSlot(f.$slots,"default",{},void 0,!0)])])],64))}}),[["__scopeId","data-v-ec2b2c4d"]]);var Ce;(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"})(Ce||(Ce={}));var Ca=new Map([[Ce.QR_CODE,"QR_CODE"],[Ce.AZTEC,"AZTEC"],[Ce.CODABAR,"CODABAR"],[Ce.CODE_39,"CODE_39"],[Ce.CODE_93,"CODE_93"],[Ce.CODE_128,"CODE_128"],[Ce.DATA_MATRIX,"DATA_MATRIX"],[Ce.MAXICODE,"MAXICODE"],[Ce.ITF,"ITF"],[Ce.EAN_13,"EAN_13"],[Ce.EAN_8,"EAN_8"],[Ce.PDF_417,"PDF_417"],[Ce.RSS_14,"RSS_14"],[Ce.RSS_EXPANDED,"RSS_EXPANDED"],[Ce.UPC_A,"UPC_A"],[Ce.UPC_E,"UPC_E"],[Ce.UPC_EAN_EXTENSION,"UPC_EAN_EXTENSION"]]),Ea;(function(a){a[a.UNKNOWN=0]="UNKNOWN",a[a.URL=1]="URL"})(Ea||(Ea={}));function xm(a){return Object.values(Ce).includes(a)}var Si;(function(a){a[a.SCAN_TYPE_CAMERA=0]="SCAN_TYPE_CAMERA",a[a.SCAN_TYPE_FILE=1]="SCAN_TYPE_FILE"})(Si||(Si={}));var _m=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=[Si.SCAN_TYPE_CAMERA,Si.SCAN_TYPE_FILE],a}(),ya=function(){function a(l,i){this.format=l,this.formatName=i}return a.prototype.toString=function(){return this.formatName},a.create=function(l){if(!Ca.has(l))throw"".concat(l," not in html5QrcodeSupportedFormatsTextMap");return new a(l,Ca.get(l))},a}(),ba=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}(),Io;(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"})(Io||(Io={}));var wm=function(){function a(){}return a.createFrom=function(l){return{errorMessage:l,type:Io.UNKWOWN_ERROR}},a}(),Cm=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 Vn(a){return typeof a>"u"||a===null}var yr=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}(),Aa=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}(),No={exports:{}};(function(a,l){(function(i,o){o(l)})(_r,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 v{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 D{static fill(e,t){for(let n=0,s=e.length;n<s;n++)e[n]=t}static fillWithin(e,t,n,s){D.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 v.arraycopy(e,t,c,0,s),c}static binarySearch(e,t,n){n===void 0&&(n=D.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 M{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)}}M.MIN_VALUE_32_BITS=-2147483648,M.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);v.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+M.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+M.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&&D.equals(this.bits,t.bits)}hashCode(){return 31*this.size+D.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 z;(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"})(z||(z={}));var Z=z;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,H=0,Y=0,ie=0;const ue=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>H&&(H=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&&(ue||g+w+E>0)?ee.UTF8:c&&(ee.ASSUME_SHIFT_JIS||H>=3||Y>=3)?ee.SHIFT_JIS:s&&c?H===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),H=g&&g[0]+""=="0"?"0":" ";for(;O.length<U;)O=h!==void 0?O+H:H+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
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){v.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&&D.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+D.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 ue=-2;ue<=2;ue++){const me=d[S+ue];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,ue=E*s+S;ie<$.BLOCK_SIZE;ie++,ue+=s){for(let me=0;me<$.BLOCK_SIZE;me++){const de=e[ue+me]&255;O+=de,de<U&&(U=de),de>z&&(z=de)}if(z-U>$.MIN_DYNAMIC_RANGE)for(ie++,ue+=s;ie<$.BLOCK_SIZE;ie++,ue+=s)for(let me=0;me<$.BLOCK_SIZE;me++)O+=e[ue+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 ae{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||_r||self||window||void 0)&&(globalThis||_r||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 xe{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 ae(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 _e{constructor(e,t,n=t==null?0:8*t.length,s,c,d=v.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=v.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);v.arraycopy(t,0,n,0,t.length),v.arraycopy(e,0,n,t.length,e.length),this.resultPoints=n}}getTimestamp(){return this.timestamp}toString(){return this.text}}var Pe;(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"})(Pe||(Pe={}));var he=Pe,qe;(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"})(qe||(qe={}));var ye=qe;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 ct{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 et{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),v.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=ct.addOrSubtract(n,g)}return n}n=t[0];const s=t.length,c=this.field;for(let d=1;d<s;d++)n=ct.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;v.arraycopy(n,0,s,0,c);for(let d=c;d<n.length;d++)s[d]=ct.addOrSubtract(t[d-c],n[d]);return new et(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]=ct.addOrSubtract(d[g+E],h.multiply(w,s[E]))}return new et(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 et(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 et(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 _t extends x{}_t.kind="ArithmeticException";class De extends ct{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 et(this,Int32Array.from([0])),this.one=new et(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 et(this,n)}inverse(e){if(e===0)throw new _t;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"+M.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 Ae extends x{}Ae.kind="ReedSolomonException";class Be extends x{}Be.kind="IllegalStateException";class rt{constructor(e){this.field=e}decode(e,t){const n=this.field,s=new et(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 et(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 Ae("Bad error location");e[U]=De.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 Ae("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 ue=d.getDegree()-c.getDegree(),me=s.multiply(d.getCoefficient(d.getDegree()),ie);z=z.addOrSubtract(s.buildMonomial(ue,me)),d=d.addOrSubtract(c.multiplyByMonomial(ue,me))}if(g=z.multiply(h).addOrSubtract(U),d.getDegree()>=c.getDegree())throw new Be("Division algorithm failed to reduce polynomial?")}const w=g.getCoefficient(0);if(w===0)throw new Ae("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 Ae("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 it;(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"})(it||(it={}));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=it.UPPER,s=it.UPPER,c="",d=0;for(;d<t;)if(s===it.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===it.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 it.LOWER;case"P":return it.PUNCT;case"M":return it.MIXED;case"D":return it.DIGIT;case"B":return it.BINARY;case"U":default:return it.UPPER}}static getCharacter(e,t){switch(e){case it.UPPER:return Je.UPPER_TABLE[t];case it.LOWER:return Je.LOWER_TABLE[t];case it.MIXED:return Je.MIXED_TABLE[t];case it.PUNCT:return Je.PUNCT_TABLE[t];case it.DIGIT:return Je.DIGIT_TABLE[t];default:throw new Be("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 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 rt(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*M.truncDivision(M.truncDivision(s,2)-1,15),g=s/2,w=M.truncDivision(h,2);for(let E=0;E<g;E++){let A=E+M.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 Ar{static floatToIntBits(e){return e}}Ar.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*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]),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 Sr{constructor(e,t){this.bits=e,this.points=t}getBits(){return this.bits}getPoints(){return this.points}}class jr extends Sr{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 ue=null;for(let me=1;ue===null&&me<U;me++)ue=this.getBlackPointOnSegment(t,s-me,t-me,s);if(ue==null)throw new N;return this.centerEdges(ue,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 qr{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 nn{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=nn.quadrilateralToSquare(e,t,n,s,c,d,h,g);return nn.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 nn(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 nn(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 nn.squareToQuadrilateral(e,t,n,s,c,d,h,g).buildAdjoint()}buildAdjoint(){return new nn(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 nn(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 or extends qr{sampleGrid(e,t,n,s,c,d,h,g,w,E,A,S,O,U,z,Y,ie,ue,me){const de=nn.quadrilateralToQuadrilateral(s,c,d,h,g,w,E,A,S,O,U,z,Y,ie,ue,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),qr.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 Pt{static setGridSampler(e){Pt.gridSampler=e}static getInstance(){return Pt.gridSampler}}Pt.gridSampler=new or;class Lt{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 jr(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(M.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 rt(De.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 Lt(g+7,w-7),!1,1,-1).toResultPoint(),t=this.getFirstDifferent(new Lt(g+7,w+7),!1,1,1).toResultPoint(),n=this.getFirstDifferent(new Lt(g-7,w+7),!1,-1,1).toResultPoint(),s=this.getFirstDifferent(new Lt(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 Lt(c+7,d-7),!1,1,-1).toResultPoint(),t=this.getFirstDifferent(new Lt(c+7,d+7),!1,1,1).toResultPoint(),n=this.getFirstDifferent(new Lt(c-7,d+7),!1,-1,1).toResultPoint(),s=this.getFirstDifferent(new Lt(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 Lt(c,d)}getMatrixCornerPoints(e){return this.expandSquare(e,2*this.nbCenterLayers,this.getDimension())}sampleGrid(e,t,n,s,c){let d=Pt.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 Lt(e.getX()-c,e.getY()+c),t=new Lt(t.getX()-c,t.getY()-c),n=new Lt(n.getX()+c,n.getY()-c),s=new Lt(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 Lt(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*(M.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 _e(d.getText(),d.getRawBytes(),d.getNumBits(),c,he.AZTEC,v.currentTimeMillis()),g=d.getByteSegments();g!=null&&h.putMetadata(ye.BYTE_SEGMENTS,g);let w=d.getECLevel();return w!=null&&h.putMetadata(ye.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 Mo extends xe{constructor(e=500){super(new Ir,e)}}class Nt{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(ye.ORIENTATION)===!0&&(g=g+h.get(ye.ORIENTATION)%360),d.putMetadata(ye.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(ye.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;Nt.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 Nt{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=Nt.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){Nt.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,ue=d,me=0,de=!0,je=!1,Ve=!1;for(;!E;){const Mr=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++,ue+=me*ie),O=U,U+=z.reduce((lp,cp)=>lp+cp,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)Ve===je?S+=String.fromCharCode(32+ie):S+=String.fromCharCode(32+ie+128),Ve=!1;else if(ie<96)Ve===je?S+=String.fromCharCode(ie-64):S+=String.fromCharCode(ie+64),Ve=!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&&Ve?(je=!0,Ve=!1):je&&Ve?(je=!1,Ve=!1):Ve=!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)Ve===je?S+=String.fromCharCode(32+ie):S+=String.fromCharCode(32+ie+128),Ve=!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&&Ve?(je=!0,Ve=!1):je&&Ve?(je=!1,Ve=!1):Ve=!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}Mr&&(w=w===pe.CODE_CODE_A?pe.CODE_CODE_B:pe.CODE_CODE_A)}const sn=U-O;if(U=t.getNextUnset(U),!t.isRange(U,Math.min(t.getSize(),U+(U-O)/2),!1))throw new N;if(ue-=me*Y,ue%103!==Y)throw new B;const In=S.length;if(In===0)throw new N;In>0&&de&&(w===pe.CODE_CODE_C?S=S.substring(0,In-2):S=S.substring(0,In-1));const an=(c[1]+c[0])/2,ht=O+sn/2,jt=g.length,mn=new Uint8Array(jt);for(let Mr=0;Mr<jt;Mr++)mn[Mr]=g[Mr];const Or=[new be(an,e),new be(ht,e)];return new _e(S,mn,0,Or,he.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 Bt extends Nt{constructor(e=!1,t=!1){super(),this.usingCheckDigit=e,this.extendedMode=t,this.decodeRowResult="",this.counters=new Int32Array(9)}decodeRow(e,t,n){let s=this.counters;s.fill(0),this.decodeRowResult="";let c=Bt.findAsteriskPattern(t,s),d=t.getNextSet(c[1]),h=t.getSize(),g,w;do{Bt.recordPattern(t,d,s);let z=Bt.toNarrowWidePattern(s);if(z<0)throw new N;g=Bt.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+=Bt.ALPHABET_STRING.indexOf(this.decodeRowResult.charAt(ie));if(this.decodeRowResult.charAt(z)!==Bt.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=Bt.decodeExtended(this.decodeRowResult):S=this.decodeRowResult;let O=(c[1]+c[0])/2,U=w+E/2;return new _e(S,null,0,[new be(O,e),new be(U,e)],he.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)===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,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<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 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}}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 st extends Nt{constructor(){super(...arguments),this.narrowLineWidth=-1}decodeRow(e,t,n){let s=this.decodeStart(t),c=this.decodeEnd(t),d=new G;st.decodeMiddle(t,s[1],c[0],d);let h=d.toString(),g=null;n!=null&&(g=n.get(Z.ALLOWED_LENGTHS)),g==null&&(g=st.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 _e(h,null,0,S,he.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;){Nt.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=st.decodeDigit(d);s.append(g.toString()),g=this.decodeDigit(h),s.append(g.toString()),c.forEach(function(w){t+=w})}}decodeStart(e){let t=st.skipWhiteSpace(e),n=st.findGuardPattern(e,t,st.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=st.skipWhiteSpace(e),n;try{n=st.findGuardPattern(e,t,st.END_PATTERN_REVERSED[0])}catch(c){c instanceof N&&(n=st.findGuardPattern(e,t,st.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(Nt.patternMatchVariance(c,n,st.MAX_INDIVIDUAL_VARIANCE)<st.MAX_AVG_VARIANCE)return[w,E];w+=c[0]+c[1],v.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=st.MAX_AVG_VARIANCE,n=-1,s=st.PATTERNS.length;for(let c=0;c<s;c++){let d=st.PATTERNS[c],h=Nt.patternMatchVariance(e,d,st.MAX_INDIVIDUAL_VARIANCE);h<t?(t=h,n=c):h===t&&(n=-1)}if(n>=0)return n%10;throw new N}}st.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])],st.MAX_AVG_VARIANCE=.38,st.MAX_INDIVIDUAL_VARIANCE=.5,st.DEFAULT_ALLOWED_LENGTHS=[6,8,10,12,14],st.START_PATTERN=Int32Array.from([1,1,1,1]),st.END_PATTERN_REVERSED=[Int32Array.from([1,1,2]),Int32Array.from([1,1,3])];class dt extends Nt{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=dt.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 dt.checkStandardUPCEANChecksum(e)}static checkStandardUPCEANChecksum(e){let t=e.length;if(t===0)return!1;let n=parseInt(e.charAt(t-1),10);return dt.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 dt.findGuardPattern(e,t,!1,dt.START_END_PATTERN,new Int32Array(dt.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(Nt.patternMatchVariance(c,s,dt.MAX_INDIVIDUAL_VARIANCE)<dt.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=Nt.patternMatchVariance(t,w,dt.MAX_INDIVIDUAL_VARIANCE);E<c&&(c=E,d=g)}if(d>=0)return d;throw new N}}dt.MAX_AVG_VARIANCE=.48,dt.MAX_INDIVIDUAL_VARIANCE=.7,dt.START_END_PATTERN=Int32Array.from([1,1,1]),dt.MIDDLE_PATTERN=Int32Array.from([1,1,1,1,1]),dt.END_PATTERN=Int32Array.from([1,1,1,1,1,1]),dt.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 sr{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=sr.parseExtensionString(d),g=[new be((n[0]+n[1])/2,e),new be(c,e)],w=new _e(d,null,0,g,he.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=dt.decodeDigit(e,s,d,dt.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(sr.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=sr.parseExtension5String(e);return t==null?null:new Map([[ye.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 ar{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=ar.parseExtensionString(d),g=[new be((n[0]+n[1])/2,e),new be(c,e)],w=new _e(d,null,0,g,he.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=dt.decodeDigit(e,s,d,dt.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([[ye.ISSUE_NUMBER,parseInt(e)]])}}class Zr{static decodeRow(e,t,n){let s=dt.findGuardPattern(t,n,!1,this.EXTENSION_START_PATTERN,new Int32Array(this.EXTENSION_START_PATTERN.length).fill(0));try{return new sr().decodeRow(e,t,s)}catch{return new ar().decodeRow(e,t,s)}}}Zr.EXTENSION_START_PATTERN=Int32Array.from([1,1,2]);class $e extends dt{constructor(){super(),this.decodeRowStringBuffer="",$e.L_AND_G_PATTERNS=$e.L_PATTERNS.map(e=>Int32Array.from(e));for(let e=10;e<20;e++){let t=$e.L_PATTERNS[e-10],n=new Int32Array(t.length);for(let s=0;s<t.length;s++)n[s]=t[t.length-s-1];$e.L_AND_G_PATTERNS[e]=n}}decodeRow(e,t,n){let s=$e.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(!$e.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 _e(S,null,0,Y,z,new Date().getTime()),ue=0;try{let de=Zr.decodeRow(e,t,w[1]);ie.putMetadata(ye.UPC_EAN_EXTENSION,de.getText()),ie.putAllMetadata(de.getResultMetadata()),ie.addResultPoints(de.getResultPoints()),ue=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(ue.toString()===je){de=!0;break}if(!de)throw new N}return ie}decodeEnd(e,t){return $e.findGuardPattern(e,t,!1,$e.START_END_PATTERN,new Int32Array($e.START_END_PATTERN.length).fill(0))}static checkChecksum(e){return $e.checkStandardUPCEANChecksum(e)}static checkStandardUPCEANChecksum(e){let t=e.length;if(t===0)return!1;let n=parseInt(e.charAt(t-1),10);return $e.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 ge extends $e{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=$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)}n=ge.determineFirstDigit(n,h),d=$e.findGuardPattern(e,d,!0,$e.MIDDLE_PATTERN,new Int32Array($e.MIDDLE_PATTERN.length).fill(0))[1];for(let w=0;w<6&&d<c;w++){let E=$e.decodeDigit(e,s,d,$e.L_PATTERNS);n+=String.fromCharCode(48+E);for(let A of s)d+=A}return{rowOffset:d,resultString:n}}getBarcodeFormat(){return he.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}}ge.FIRST_DIGIT_ENCODINGS=[0,11,13,14,19,25,28,21,22,26];class se extends $e{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=$e.decodeDigit(e,s,d,$e.L_PATTERNS);n+=String.fromCharCode(48+w);for(let E of s)d+=E}d=$e.findGuardPattern(e,d,!0,$e.MIDDLE_PATTERN,new Int32Array($e.MIDDLE_PATTERN.length).fill(0))[1];for(let g=0;g<4&&d<c;g++){let w=$e.decodeDigit(e,s,d,$e.L_PATTERNS);n+=String.fromCharCode(48+w);for(let E of s)d+=E}return{rowOffset:d,resultString:n}}getBarcodeFormat(){return he.EAN_8}}class Ue extends $e{constructor(){super(...arguments),this.ean13Reader=new ge}getBarcodeFormat(){return he.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 _e(t.substring(1),null,null,e.getResultPoints(),he.UPC_A);return e.getResultMetadata()!=null&&n.putAllMetadata(e.getResultMetadata()),n}else throw new N}reset(){this.ean13Reader.reset()}}class Fe extends $e{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=Fe.decodeDigit(e,s,d,Fe.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=Fe.determineNumSysAndCheckDigit(n,h);return{rowOffset:d,resultString:g}}decodeEnd(e,t){return Fe.findGuardPatternWithoutCounters(e,t,!0,Fe.MIDDLE_END_PATTERN)}checkChecksum(e){return $e.checkChecksum(Fe.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 he.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()}}Fe.MIDDLE_END_PATTERN=Int32Array.from([1,1,1,1,1,1]),Fe.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 hn extends Nt{constructor(e){super();let t=e==null?null:e.get(Z.POSSIBLE_FORMATS),n=[];o(t)?(n.push(new ge),n.push(new Ue),n.push(new se),n.push(new Fe)):(t.indexOf(he.EAN_13)>-1&&n.push(new ge),t.indexOf(he.UPC_A)>-1&&n.push(new Ue),t.indexOf(he.EAN_8)>-1&&n.push(new se),t.indexOf(he.UPC_E)>-1&&n.push(new Fe)),this.readers=n}decodeRow(e,t,n){for(let s of this.readers)try{const c=s.decodeRow(e,t,n),d=c.getBarcodeFormat()===he.EAN_13&&c.getText().charAt(0)==="0",h=n==null?null:n.get(Z.POSSIBLE_FORMATS),g=h==null||h.includes(he.UPC_A);if(d&&g){const w=c.getRawBytes(),E=new _e(c.getText().substring(1),w,w?w.length:null,c.getResultPoints(),he.UPC_A);return E.putAllMetadata(c.getResultMetadata()),E}return c}catch{}throw new N}reset(){for(let e of this.readers)e.reset()}}class wt extends Nt{constructor(){super(),this.decodeFinderCounters=new Int32Array(4),this.dataCharacterCounters=new Int32Array(8),this.oddRoundingErrors=new Array(4),this.evenRoundingErrors=new Array(4),this.oddCounts=new Array(this.dataCharacterCounters.length/2),this.evenCounts=new Array(this.dataCharacterCounters.length/2)}getDecodeFinderCounters(){return this.decodeFinderCounters}getDataCharacterCounters(){return this.dataCharacterCounters}getOddRoundingErrors(){return this.oddRoundingErrors}getEvenRoundingErrors(){return this.evenRoundingErrors}getOddCounts(){return this.oddCounts}getEvenCounts(){return this.evenCounts}parseFinderValue(e,t){for(let n=0;n<t.length;n++)if(Nt.patternMatchVariance(e,t[n],wt.MAX_INDIVIDUAL_VARIANCE)<wt.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>=wt.MIN_FINDER_PATTERN_RATIO&&s<=wt.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}}wt.MAX_AVG_VARIANCE=.2,wt.MAX_INDIVIDUAL_VARIANCE=.45,wt.MIN_FINDER_PATTERN_RATIO=9.5/12,wt.MAX_FINDER_PATTERN_RATIO=12.5/14;class tt{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 tt))return!1;const t=e;return this.value===t.value&&this.checksumPortion===t.checksumPortion}hashCode(){return this.value^this.checksumPortion}}class Xe{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 Xe))return!1;const t=e;return this.value===t.value}hashCode(){return this.value}}class Tt{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=Tt.combins(s-w-1,h-g-2);if(n&&d===0&&s-w-(h-g-1)>=h-g-1&&(E-=Tt.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+=Tt.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 zt{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 Ct{constructor(e,t){t?this.decodedInformation=null:(this.finished=e,this.decodedInformation=t)}getDecodedInformation(){return this.decodedInformation}isFinished(){return this.finished}}class Ot{constructor(e){this.newPosition=e}getNewPosition(){return this.newPosition}}class at extends Ot{constructor(e,t){super(e),this.value=t}getValue(){return this.value}isFNC1(){return this.value===at.FNC1}}at.FNC1="$";class Oe extends Ot{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 Ht extends Ot{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===Ht.FNC1}isSecondDigitFNC1(){return this.secondDigit===Ht.FNC1}isAnyFNC1(){return this.firstDigit===Ht.FNC1||this.secondDigit===Ht.FNC1}}Ht.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 s=e.substring(0,4);for(let c of Ee.FOUR_DIGIT_DATA_LENGTH)if(c[0]===s)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 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=Ee.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=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 lr{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=Ee.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 Ht(this.information.getSize(),Ht.FNC1,Ht.FNC1):new Ht(this.information.getSize(),c-1,Ht.FNC1)}let t=this.extractNumericValueFromBitArray(e,7),n=(t-8)/11,s=(t-8)%11;return new Ht(e+7,n,s)}extractNumericValueFromBitArray(e,t){return lr.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 Oe(this.current.getPosition(),this.buffer.toString(),n.getRemainingValue()):new Oe(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 Oe(this.current.getPosition(),this.buffer.toString()):t=new Oe(this.current.getPosition(),this.buffer.toString(),e.getSecondDigit()),new Ct(!0,t)}if(this.buffer.append(e.getFirstDigit()),e.isSecondDigitFNC1()){let t=new Oe(this.current.getPosition(),this.buffer.toString());return new Ct(!0,t)}this.buffer.append(e.getSecondDigit())}return this.isNumericToAlphaNumericLatch(this.current.getPosition())&&(this.current.setAlpha(),this.current.incrementPosition(4)),new Ct(!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 Oe(this.current.getPosition(),this.buffer.toString());return new Ct(!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 Ct(!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 Oe(this.current.getPosition(),this.buffer.toString());return new Ct(!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 Ct(!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 at(e+5,at.FNC1);if(t>=5&&t<15)return new at(e+5,"0"+(t-5));let n=this.extractNumericValueFromBitArray(e,7);if(n>=64&&n<90)return new at(e+7,""+(n+1));if(n>=90&&n<116)return new at(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 at(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 at(e+5,at.FNC1);if(t>=5&&t<15)return new at(e+5,"0"+(t-5));let n=this.extractNumericValueFromBitArray(e,6);if(n>=32&&n<58)return new at(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 Be("Decoding invalid alphanumeric value: "+n)}return new at(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 Do{constructor(e){this.information=e,this.generalDecoder=new lr(e)}getInformation(){return this.information}getGeneralDecoder(){return this.generalDecoder}}class rn extends Do{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)}rn.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)}}rn.GTIN_SIZE=40;class Nr extends rn{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 Do{constructor(e){super(e)}parseInformation(){let e=new G;return this.getGeneralDecoder().decodeAllCodes(e,Oi.HEADER_SIZE)}}Oi.HEADER_SIZE=5;class Mi extends rn{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 Rn extends Mi{constructor(e){super(e)}parseInformation(){if(this.getInformation().getSize()!=Rn.HEADER_SIZE+Mi.GTIN_SIZE+Rn.WEIGHT_SIZE)throw new N;let e=new G;return this.encodeCompressedGtin(e,Rn.HEADER_SIZE),this.encodeCompressedWeight(e,Rn.HEADER_SIZE+Mi.GTIN_SIZE,Rn.WEIGHT_SIZE),e.toString()}}Rn.HEADER_SIZE=5,Rn.WEIGHT_SIZE=15;class vg extends Rn{constructor(e){super(e)}addWeightCode(e,t){e.append("(3103)")}checkWeight(e){return e}}class Pg extends Rn{constructor(e){super(e)}addWeightCode(e,t){t<1e4?e.append("(3202)"):e.append("(3203)")}checkWeight(e){return e<1e4?e:e-1e4}}class Bn extends rn{constructor(e){super(e)}parseInformation(){if(this.getInformation().getSize()<Bn.HEADER_SIZE+rn.GTIN_SIZE)throw new N;let e=new G;this.encodeCompressedGtin(e,Bn.HEADER_SIZE);let t=this.getGeneralDecoder().extractNumericValueFromBitArray(Bn.HEADER_SIZE+rn.GTIN_SIZE,Bn.LAST_DIGIT_SIZE);e.append("(392"),e.append(t),e.append(")");let n=this.getGeneralDecoder().decodeGeneralPurposeField(Bn.HEADER_SIZE+rn.GTIN_SIZE+Bn.LAST_DIGIT_SIZE,null);return e.append(n.getNewString()),e.toString()}}Bn.HEADER_SIZE=8,Bn.LAST_DIGIT_SIZE=2;class Kt extends rn{constructor(e){super(e)}parseInformation(){if(this.getInformation().getSize()<Kt.HEADER_SIZE+rn.GTIN_SIZE)throw new N;let e=new G;this.encodeCompressedGtin(e,Kt.HEADER_SIZE);let t=this.getGeneralDecoder().extractNumericValueFromBitArray(Kt.HEADER_SIZE+rn.GTIN_SIZE,Kt.LAST_DIGIT_SIZE);e.append("(393"),e.append(t),e.append(")");let n=this.getGeneralDecoder().extractNumericValueFromBitArray(Kt.HEADER_SIZE+rn.GTIN_SIZE+Kt.LAST_DIGIT_SIZE,Kt.FIRST_THREE_DIGITS_SIZE);n/100==0&&e.append("0"),n/10==0&&e.append("0"),e.append(n);let s=this.getGeneralDecoder().decodeGeneralPurposeField(Kt.HEADER_SIZE+rn.GTIN_SIZE+Kt.LAST_DIGIT_SIZE+Kt.FIRST_THREE_DIGITS_SIZE,null);return e.append(s.getNewString()),e.toString()}}Kt.HEADER_SIZE=8,Kt.LAST_DIGIT_SIZE=2,Kt.FIRST_THREE_DIGITS_SIZE=10;class bt extends Mi{constructor(e,t,n){super(e),this.dateCode=n,this.firstAIdigits=t}parseInformation(){if(this.getInformation().getSize()!=bt.HEADER_SIZE+bt.GTIN_SIZE+bt.WEIGHT_SIZE+bt.DATE_SIZE)throw new N;let e=new G;return this.encodeCompressedGtin(e,bt.HEADER_SIZE),this.encodeCompressedWeight(e,bt.HEADER_SIZE+bt.GTIN_SIZE,bt.WEIGHT_SIZE),this.encodeCompressedDate(e,bt.HEADER_SIZE+bt.GTIN_SIZE+bt.WEIGHT_SIZE),e.toString()}encodeCompressedDate(e,t){let n=this.getGeneralDecoder().extractNumericValueFromBitArray(t,bt.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}}bt.HEADER_SIZE=8,bt.WEIGHT_SIZE=20,bt.DATE_SIZE=16;function ja(b){try{if(b.get(1))return new Nr(b);if(!b.get(2))return new Oi(b);switch(lr.extractNumericValueFromBitArray(b,1,4)){case 4:return new vg(b);case 5:return new Pg(b)}switch(lr.extractNumericValueFromBitArray(b,1,5)){case 12:return new Bn(b);case 13:return new Kt(b)}switch(lr.extractNumericValueFromBitArray(b,1,7)){case 56:return new bt(b,"310","11");case 57:return new bt(b,"320","11");case 58:return new bt(b,"310","13");case 59:return new bt(b,"320","13");case 60:return new bt(b,"310","15");case 61:return new bt(b,"320","15");case 62:return new bt(b,"310","17");case 63:return new bt(b,"320","17")}}catch(e){throw console.log(e),new Be("unknown decoder: "+b)}}class Gn{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 Gn?Gn.equalsOrNull(e.leftchar,t.leftchar)&&Gn.equalsOrNull(e.rightchar,t.rightchar)&&Gn.equalsOrNull(e.finderpattern,t.finderpattern):!1}static equalsOrNull(e,t){return e===null?t===null:Gn.equals(e,t)}hashCode(){return this.leftchar.getValue()^this.rightchar.getValue()^this.finderpattern.getValue()}}class vo{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 vo?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 wt{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 vo(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(Gn.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=zt.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 _e(s,null,null,h,he.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 Gn(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();v.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 Xe(g,[c,d],c,d,t)}decodeDataCharacter(e,t,n,s){let c=this.getDataCharacterCounters();for(let ht=0;ht<c.length;ht++)c[ht]=0;if(s)ce.recordPatternInReverse(e,t.getStartEnd()[0],c);else{ce.recordPattern(e,t.getStartEnd()[1],c);for(let ht=0,jt=c.length-1;ht<jt;ht++,jt--){let mn=c[ht];c[ht]=c[jt],c[jt]=mn}}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 ht=0;ht<c.length;ht++){let jt=1*c[ht]/h,mn=jt+.5;if(mn<1){if(jt<.3)throw new N;mn=1}else if(mn>8){if(jt>8.7)throw new N;mn=8}let Or=ht/2;ht&1?(E[Or]=mn,S[Or]=jt-mn):(w[Or]=mn,A[Or]=jt-mn)}this.adjustOddEvenCounts(d);let O=4*t.getValue()+(n?0:2)+(s?0:1)-1,U=0,z=0;for(let ht=w.length-1;ht>=0;ht--){if(ce.isNotA1left(t,n,s)){let jt=ce.WEIGHTS[O][2*ht];z+=w[ht]*jt}U+=w[ht]}let Y=0;for(let ht=E.length-1;ht>=0;ht--)if(ce.isNotA1left(t,n,s)){let jt=ce.WEIGHTS[O][2*ht+1];Y+=E[ht]*jt}let ie=z+Y;if(U&1||U>13||U<4)throw new N;let ue=(13-U)/2,me=ce.SYMBOL_WIDEST[ue],de=9-me,je=Tt.getRSSvalue(w,me,!0),Ve=Tt.getRSSvalue(E,de,!1),sn=ce.EVEN_TOTAL_SUBSET[ue],In=ce.GSUM[ue],an=je*sn+Ve+In;return new tt(an,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 Lg extends tt{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 wt{constructor(){super(...arguments),this.possibleLeftPairs=[],this.possibleRightPairs=[]}decodeRow(e,t,n){const s=this.decodePair(t,!1,e,n);kt.addOrTally(this.possibleLeftPairs,s),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 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 _e(c.toString(),null,0,[h[0],h[1],g[0],g[1]],he.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 Lg(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)Nt.recordPatternInReverse(e,t.getStartEnd()[0],s);else{Nt.recordPattern(e,t.getStartEnd()[1]+1,s);for(let Y=0,ie=s.length-1;Y<ie;Y++,ie--){let ue=s[Y];s[Y]=s[ie],s[ie]=ue}}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,ue=Math.floor(ie+.5);ue<1?ue=1:ue>8&&(ue=8);let me=Math.floor(Y/2);Y&1?(g[me]=ue,E[me]=ie-ue):(h[me]=ue,w[me]=ie-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 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=kt.OUTSIDE_ODD_WIDEST[Y],ue=9-ie,me=Tt.getRSSvalue(h,ie,!1),de=Tt.getRSSvalue(g,ue,!0),je=kt.OUTSIDE_EVEN_TOTAL_SUBSET[Y],Ve=kt.OUTSIDE_GSUM[Y];return new tt(me*je+de+Ve,z)}else{if(U&1||U>10||U<4)throw new N;let Y=(10-U)/2,ie=kt.INSIDE_ODD_WIDEST[Y],ue=9-ie,me=Tt.getRSSvalue(h,ie,!0),de=Tt.getRSSvalue(g,ue,!1),je=kt.INSIDE_ODD_TOTAL_SUBSET[Y],Ve=kt.INSIDE_GSUM[Y];return new tt(de*je+me+Ve,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(wt.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);v.arraycopy(g,0,w,1,g.length-1),w[0]=h;const E=this.parseFinderValue(w,kt.FINDER_PATTERNS);let A=d,S=s[1];return n&&(A=e.getSize()-1-A,S=e.getSize()-1-S),new Xe(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;wt.increment(this.getOddCounts(),this.getOddRoundingErrors())}if(d&&wt.decrement(this.getOddCounts(),this.getOddRoundingErrors()),h){if(g)throw new N;wt.increment(this.getEvenCounts(),this.getOddRoundingErrors())}g&&wt.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 Nt{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(he.EAN_13)||n.includes(he.UPC_A)||n.includes(he.EAN_8)||n.includes(he.UPC_E))&&this.readers.push(new hn(e)),n.includes(he.CODE_39)&&this.readers.push(new Bt(s)),n.includes(he.CODE_128)&&this.readers.push(new pe),n.includes(he.ITF)&&this.readers.push(new st),n.includes(he.RSS_14)&&this.readers.push(new kt),n.includes(he.RSS_EXPANDED)&&this.readers.push(new ce(this.verbose))):(this.readers.push(new hn(e)),this.readers.push(new Bt),this.readers.push(new hn(e)),this.readers.push(new pe),this.readers.push(new st),this.readers.push(new kt),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 Fg extends xe{constructor(e=500,t){super(new Tr(t),e,t)}}class ot{constructor(e,t,n){this.ecCodewords=e,this.ecBlocks=[t],n&&this.ecBlocks.push(n)}getECCodewords(){return this.ecCodewords}getECBlocks(){return this.ecBlocks}}class nt{constructor(e,t){this.count=e,this.dataCodewords=t}getCount(){return this.count}getDataCodewords(){return this.dataCodewords}}class Ze{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 Ze.VERSIONS)if(n.symbolSizeRows===e&&n.symbolSizeColumns===t)return n;throw new V}toString(){return""+this.versionNumber}static buildVersions(){return[new Ze(1,10,10,8,8,new ot(5,new nt(1,3))),new Ze(2,12,12,10,10,new ot(7,new nt(1,5))),new Ze(3,14,14,12,12,new ot(10,new nt(1,8))),new Ze(4,16,16,14,14,new ot(12,new nt(1,12))),new Ze(5,18,18,16,16,new ot(14,new nt(1,18))),new Ze(6,20,20,18,18,new ot(18,new nt(1,22))),new Ze(7,22,22,20,20,new ot(20,new nt(1,30))),new Ze(8,24,24,22,22,new ot(24,new nt(1,36))),new Ze(9,26,26,24,24,new ot(28,new nt(1,44))),new Ze(10,32,32,14,14,new ot(36,new nt(1,62))),new Ze(11,36,36,16,16,new ot(42,new nt(1,86))),new Ze(12,40,40,18,18,new ot(48,new nt(1,114))),new Ze(13,44,44,20,20,new ot(56,new nt(1,144))),new Ze(14,48,48,22,22,new ot(68,new nt(1,174))),new Ze(15,52,52,24,24,new ot(42,new nt(2,102))),new Ze(16,64,64,14,14,new ot(56,new nt(2,140))),new Ze(17,72,72,16,16,new ot(36,new nt(4,92))),new Ze(18,80,80,18,18,new ot(48,new nt(4,114))),new Ze(19,88,88,20,20,new ot(56,new nt(4,144))),new Ze(20,96,96,22,22,new ot(68,new nt(4,174))),new Ze(21,104,104,24,24,new ot(56,new nt(6,136))),new Ze(22,120,120,18,18,new ot(68,new nt(6,175))),new Ze(23,132,132,20,20,new ot(62,new nt(8,163))),new Ze(24,144,144,22,22,new ot(62,new nt(8,156),new nt(2,155))),new Ze(25,8,18,6,16,new ot(7,new nt(1,5))),new Ze(26,8,32,6,14,new ot(11,new nt(1,10))),new Ze(27,12,26,10,24,new ot(14,new nt(1,16))),new Ze(28,12,36,10,16,new ot(18,new nt(1,22))),new Ze(29,16,36,14,16,new ot(24,new nt(1,32))),new Ze(30,16,48,14,22,new ot(28,new nt(1,49)))]}}Ze.VERSIONS=Ze.buildVersions();class Po{constructor(e){const t=e.getHeight();if(t<8||t>144||t&1)throw new V;this.version=Po.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 Ze.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 ue=0;ue<c;++ue){const me=O*(c+2)+1+ue;if(e.get(me,Y)){const de=U+ue;E.set(de,ie)}}}}}return E}}class Lo{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(),ue=n.getECCodewords()+ie;d[h++]=new Lo(ie,new Uint8Array(ue))}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,ue=S&&ie>7?z-1:z;d[ie].codewords[ue]=e[A++]}if(A!==e.length)throw new y;return d}getNumDataCodewords(){return this.numDataCodewords}getCodewords(){return this.codewords}}class Fo{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 Ft;(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"})(Ft||(Ft={}));class Wn{static decode(e){const t=new Fo(e),n=new G,s=new G,c=new Array;let d=Ft.ASCII_ENCODE;do if(d===Ft.ASCII_ENCODE)d=this.decodeAsciiSegment(t,n,s);else{switch(d){case Ft.C40_ENCODE:this.decodeC40Segment(t,n);break;case Ft.TEXT_ENCODE:this.decodeTextSegment(t,n);break;case Ft.ANSIX12_ENCODE:this.decodeAnsiX12Segment(t,n);break;case Ft.EDIFACT_ENCODE:this.decodeEdifactSegment(t,n);break;case Ft.BASE256_ENCODE:this.decodeBase256Segment(t,n,c);break;default:throw new V}d=Ft.ASCII_ENCODE}while(d!==Ft.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)),Ft.ASCII_ENCODE;if(c===129)return Ft.PAD_ENCODE;if(c<=229){const d=c-130;d<10&&t.append("0"),t.append(""+d)}else switch(c){case 230:return Ft.C40_ENCODE;case 231:return Ft.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 Ft.ANSIX12_ENCODE;case 239:return Ft.TEXT_ENCODE;case 240:return Ft.EDIFACT_ENCODE;case 241:break;default:if(c!==254||e.available()!==0)throw new V;break}}while(e.available()>0);return Ft.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 Be("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}}Wn.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"],Wn.C40_SHIFT2_SET_CHARS=["!",'"',"#","$","%","&","'","(",")","*","+",",","-",".","/",":",";","<","=",">","?","@","[","\\","]","^","_"],Wn.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"],Wn.TEXT_SHIFT2_SET_CHARS=Wn.C40_SHIFT2_SET_CHARS,Wn.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 Vg{constructor(){this.rsDecoder=new rt(De.DATA_MATRIX_FIELD_256)}decode(e){const t=new Po(e),n=t.getVersion(),s=t.readCodewords(),c=Lo.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 Wn.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 Mt{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=Mt.sampleGrid(this.image,n,s,c,d,h,g);return new Sr(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=Mt.shiftPoint(n,s,(d+1)*4),g=Mt.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=Mt.shiftPoint(t,n,(h+1)*4),w=Mt.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=Mt.shiftPoint(t,n,h*4),w=Mt.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=Mt.moveAway(t,E,A),n=Mt.moveAway(n,E,A),s=Mt.moveAway(s,E,A),c=Mt.moveAway(c,E,A);let S,O;return g=Mt.shiftPoint(t,n,h*4),g=Mt.shiftPoint(g,c,d*4),S=Mt.shiftPoint(n,t,h*4),S=Mt.shiftPoint(S,s,d*4),w=Mt.shiftPoint(s,c,h*4),w=Mt.shiftPoint(w,n,d*4),O=Mt.shiftPoint(c,s,h*4),O=Mt.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 Pt.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 Xn{constructor(){this.decoder=new Vg}decode(e,t=null){let n,s;if(t!=null&&t.has(Z.PURE_BARCODE)){const w=Xn.extractPureBits(e.getBlackMatrix());n=this.decoder.decode(w),s=Xn.NO_POINTS}else{const w=new Mt(e.getBlackMatrix()).detect();n=this.decoder.decode(w.getBits()),s=w.getPoints()}const c=n.getRawBytes(),d=new _e(n.getText(),c,8*c.length,s,he.DATA_MATRIX,v.currentTimeMillis()),h=n.getByteSegments();h!=null&&d.putMetadata(ye.BYTE_SEGMENTS,h);const g=n.getECLevel();return g!=null&&d.putMetadata(ye.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}}Xn.NO_POINTS=[];class Ug extends xe{constructor(e=500){super(new Xn,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 Yt{constructor(e){this.errorCorrectionLevel=gt.forBits(e>>3&3),this.dataMask=e&7}static numBitsDiffering(e,t){return M.bitCount(e^t)}static decodeFormatInformation(e,t){const n=Yt.doDecodeFormatInformation(e,t);return n!==null?n:Yt.doDecodeFormatInformation(e^Yt.FORMAT_INFO_MASK_QR,t^Yt.FORMAT_INFO_MASK_QR)}static doDecodeFormatInformation(e,t){let n=Number.MAX_SAFE_INTEGER,s=0;for(const c of Yt.FORMAT_INFO_DECODE_LOOKUP){const d=c[0];if(d===e||d===t)return new Yt(c[1]);let h=Yt.numBitsDiffering(e,d);h<n&&(s=c[1],n=h),e!==t&&(h=Yt.numBitsDiffering(t,d),h<n&&(s=c[1],n=h))}return n<=3?new Yt(s):null}getErrorCorrectionLevel(){return this.errorCorrectionLevel}getDataMask(){return this.dataMask}hashCode(){return this.errorCorrectionLevel.getBits()<<3|this.dataMask}equals(e){if(!(e instanceof Yt))return!1;const t=e;return this.errorCorrectionLevel===t.errorCorrectionLevel&&this.dataMask===t.dataMask}}Yt.FORMAT_INFO_MASK_QR=21522,Yt.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 Ie{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 Ie.VERSIONS[e-1]}static decodeVersionInformation(e){let t=Number.MAX_SAFE_INTEGER,n=0;for(let s=0;s<Ie.VERSION_DECODE_INFO.length;s++){const c=Ie.VERSION_DECODE_INFO[s];if(c===e)return Ie.getVersionForNumber(s+7);const d=Yt.numBitsDiffering(e,c);d<t&&(n=s+7,t=d)}return t<=3?Ie.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}}Ie.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]),Ie.VERSIONS=[new Ie(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 Ie(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 Ie(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 Ie(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 Ie(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 Ie(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 Ie(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 Ie(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 Ie(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 Ie(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 Ie(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 Ie(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 Ie(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 Ie(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 Ie(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 Ie(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 Ie(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 Ie(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 Ie(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 Ie(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 Ie(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 Ie(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 Ie(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 Ie(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 Ie(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 Ie(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 Ie(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 Ie(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 Ie(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 Ie(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 Ie(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 Ie(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 Ie(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 Ie(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 Ie(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 Ie(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 Ie(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 Ie(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 Ie(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 Ie(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 Gt;(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"})(Gt||(Gt={}));class pn{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)}}pn.values=new Map([[Gt.DATA_MASK_000,new pn(Gt.DATA_MASK_000,(b,e)=>(b+e&1)===0)],[Gt.DATA_MASK_001,new pn(Gt.DATA_MASK_001,(b,e)=>(b&1)===0)],[Gt.DATA_MASK_010,new pn(Gt.DATA_MASK_010,(b,e)=>e%3===0)],[Gt.DATA_MASK_011,new pn(Gt.DATA_MASK_011,(b,e)=>(b+e)%3===0)],[Gt.DATA_MASK_100,new pn(Gt.DATA_MASK_100,(b,e)=>(Math.floor(b/2)+Math.floor(e/3)&1)===0)],[Gt.DATA_MASK_101,new pn(Gt.DATA_MASK_101,(b,e)=>b*e%6===0)],[Gt.DATA_MASK_110,new pn(Gt.DATA_MASK_110,(b,e)=>b*e%6<3)],[Gt.DATA_MASK_111,new pn(Gt.DATA_MASK_111,(b,e)=>(b+e+b*e%3&1)===0)]]);class zg{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=Yt.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 Ie.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=Ie.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=Ie.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=pn.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=pn.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 Vo{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 Vo(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 xn;(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"})(xn||(xn={}));class Te{constructor(e,t,n,s){this.value=e,this.stringValue=t,this.characterCountBitsForVersions=n,this.bits=s,Te.FOR_BITS.set(s,this),Te.FOR_VALUE.set(e,this)}static forBits(e){const t=Te.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 Te))return!1;const t=e;return this.value===t.value}toString(){return this.stringValue}}Te.FOR_BITS=new Map,Te.FOR_VALUE=new Map,Te.TERMINATOR=new Te(xn.TERMINATOR,"TERMINATOR",Int32Array.from([0,0,0]),0),Te.NUMERIC=new Te(xn.NUMERIC,"NUMERIC",Int32Array.from([10,12,14]),1),Te.ALPHANUMERIC=new Te(xn.ALPHANUMERIC,"ALPHANUMERIC",Int32Array.from([9,11,13]),2),Te.STRUCTURED_APPEND=new Te(xn.STRUCTURED_APPEND,"STRUCTURED_APPEND",Int32Array.from([0,0,0]),3),Te.BYTE=new Te(xn.BYTE,"BYTE",Int32Array.from([8,16,16]),4),Te.ECI=new Te(xn.ECI,"ECI",Int32Array.from([0,0,0]),7),Te.KANJI=new Te(xn.KANJI,"KANJI",Int32Array.from([8,10,12]),8),Te.FNC1_FIRST_POSITION=new Te(xn.FNC1_FIRST_POSITION,"FNC1_FIRST_POSITION",Int32Array.from([0,0,0]),5),Te.FNC1_SECOND_POSITION=new Te(xn.FNC1_SECOND_POSITION,"FNC1_SECOND_POSITION",Int32Array.from([0,0,0]),9),Te.HANZI=new Te(xn.HANZI,"HANZI",Int32Array.from([8,10,12]),13);class St{static decode(e,t,n,s){const c=new Fo(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=Te.TERMINATOR;else{const O=c.readBits(4);S=Te.forBits(O)}switch(S){case Te.TERMINATOR:break;case Te.FNC1_FIRST_POSITION:case Te.FNC1_SECOND_POSITION:A=!0;break;case Te.STRUCTURED_APPEND:if(c.available()<16)throw new V;g=c.readBits(8),w=c.readBits(8);break;case Te.ECI:const O=St.parseECIValue(c);if(E=F.getCharacterSetECIByValue(O),E===null)throw new V;break;case Te.HANZI:const U=c.readBits(4),z=c.readBits(S.getCharacterCountBits(t));U===St.GB2312_SUBSET&&St.decodeHanziSegment(c,d,z);break;default:const Y=c.readBits(S.getCharacterCountBits(t));switch(S){case Te.NUMERIC:St.decodeNumericSegment(c,d,Y);break;case Te.ALPHANUMERIC:St.decodeAlphanumericSegment(c,d,Y,A);break;case Te.BYTE:St.decodeByteSegment(c,d,Y,E,h,s);break;case Te.KANJI:St.decodeKanjiSegment(c,d,Y);break;default:throw new V}break}}while(S!==Te.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>=St.ALPHANUMERIC_CHARS.length)throw new V;return St.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(St.toAlphaNumericChar(Math.floor(d/45))),t.append(St.toAlphaNumericChar(d%45)),n-=2}if(n===1){if(e.available()<6)throw new V;t.append(St.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(St.toAlphaNumericChar(Math.floor(s/100))),t.append(St.toAlphaNumericChar(Math.floor(s/10)%10)),t.append(St.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(St.toAlphaNumericChar(Math.floor(s/10))),t.append(St.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(St.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}}St.ALPHANUMERIC_CHARS="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:",St.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 Hg{constructor(){this.rsDecoder=new rt(De.QR_CODE_FIELD_256)}decodeBooleanArray(e,t){return this.decodeBitMatrix(W.parseFromBooleanArray(e),t)}decodeBitMatrix(e,t){const n=new zg(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=Vo.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 St.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 Uo 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 Uo(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 Uo(c,d,h);this.possibleCenters.push(g),this.resultPointCallback!==null&&this.resultPointCallback!==void 0&&this.resultPointCallback.foundPossibleResultPoint(g)}return null}}class zo 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 zo(c,d,h,s)}}class Gg{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 Wt{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*Wt.MAX_MODULES));(h<Wt.MIN_SKIP||t)&&(h=Wt.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(Wt.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]++;Wt.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 Gg(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&&Wt.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:Wt.foundPatternCross(h)?Wt.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:Wt.foundPatternCross(h)?Wt.centerFromEnd(h,g):NaN}handlePossibleCenter(e,t,n,s){const c=e[0]+e[1]+e[2]+e[3]+e[4];let d=Wt.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 zo(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()>=Wt.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()>=Wt.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]]}}Wt.CENTER_QUORUM=2,Wt.MIN_SKIP=3,Wt.MAX_MODULES=57;class Yr{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 Wt(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=Yr.computeDimension(t,n,s,c),h=Ie.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 ue=4;ue<=16;ue<<=1)try{w=this.findAlignmentInRegion(c,Y,ie,ue);break}catch(me){if(!(me instanceof N))throw me}}const E=Yr.createTransform(t,n,s,w,d),A=Yr.sampleGrid(this.image,E,d);let S;return w===null?S=[s,t,n]:S=[s,t,n,w],new Sr(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),nn.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 Pt.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 $n{constructor(){this.decoder=new Hg}getDecoder(){return this.decoder}decode(e,t){let n,s;if(t!=null&&t.get(Z.PURE_BARCODE)!==void 0){const g=$n.extractPureBits(e.getBlackMatrix());n=this.decoder.decodeBitMatrix(g,t),s=$n.NO_POINTS}else{const g=new Yr(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 _e(n.getText(),n.getRawBytes(),void 0,s,he.QR_CODE,void 0),d=n.getByteSegments();d!==null&&c.putMetadata(ye.BYTE_SEGMENTS,d);const h=n.getECLevel();return h!==null&&c.putMetadata(ye.ERROR_CORRECTION_LEVEL,h),n.hasStructuredAppend()&&(c.putMetadata(ye.STRUCTURED_APPEND_SEQUENCE,n.getStructuredAppendSequenceNumber()),c.putMetadata(ye.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}}$n.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=D.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 Wg{constructor(e,t){this.bits=e,this.points=t}getBits(){return this.bits}getPoints(){return this.points}}class ze{static detectMultiple(e,t,n){let s=e.getBlackMatrix(),c=ze.detect(n,s);return c.length||(s=s.clone(),s.rotate180(),c=ze.detect(n,s)),new Wg(s,c)}static detect(e,t){const n=new Array;let s=0,c=0,d=!1;for(;s<t.getHeight();){const h=ze.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+=ze.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 ze.copyToResult(d,ze.findRowsWithPattern(e,s,c,t,n,ze.START_PATTERN),ze.INDEXES_START_PATTERN),d[4]!=null&&(n=Math.trunc(d[4].getX()),t=Math.trunc(d[4].getY())),ze.copyToResult(d,ze.findRowsWithPattern(e,s,c,t,n,ze.STOP_PATTERN),ze.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+=ze.ROW_STEP){let A=ze.findGuardPattern(e,c,s,n,!1,d,w);if(A!=null){for(;s>0;){const S=ze.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=ze.findGuardPattern(e,S[0],E,n,!1,d,w);if(O!=null&&Math.abs(S[0]-O[0])<ze.MAX_PATTERN_DRIFT&&Math.abs(S[1]-O[1])<ze.MAX_PATTERN_DRIFT)S=O,A=0;else{if(A>ze.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<ze.BARCODE_MIN_HEIGHT&&D.fill(h,null),h}static findGuardPattern(e,t,n,s,c,d,h){D.fillWithin(h,0,h.length,0);let g=t,w=0;for(;e.get(g,n)&&g>0&&w++<ze.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(ze.patternMatchVariance(h,d,ze.MAX_INDIVIDUAL_VARIANCE)<ze.MAX_AVG_VARIANCE)return new Int32Array([g,E]);g+=h[0]+h[1],v.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&&ze.patternMatchVariance(h,d,ze.MAX_INDIVIDUAL_VARIANCE)<ze.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}}ze.INDEXES_START_PATTERN=Int32Array.from([0,4,1,5]),ze.INDEXES_STOP_PATTERN=Int32Array.from([6,2,7,3]),ze.MAX_AVG_VARIANCE=.42,ze.MAX_INDIVIDUAL_VARIANCE=.8,ze.START_PATTERN=Int32Array.from([8,1,1,1,1,1,1,3]),ze.STOP_PATTERN=Int32Array.from([7,1,1,3,1,1,1,2,1]),ze.MAX_PIXEL_DRIFT=3,ze.MAX_PATTERN_DRIFT=5,ze.SKIPPED_ROW_COUNT_MAX=25,ze.ROW_STEP=5,ze.BARCODE_MIN_HEIGHT=10;class Xt{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),v.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;v.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 Xt(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 Xt?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 Xt(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 Xt(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 Xt(this.field,t)}multiplyScalar(e){if(e===0)return new Xt(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 Xt(this.field,n)}multiplyByMonomial(e,t){if(e<0)throw new y;if(t===0)return new Xt(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 Xt(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 Xg{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 _t;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 Ho extends Xg{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 Xt(this,new Int32Array([0])),this.one=new Xt(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 Xt(this,n)}}Ho.PDF417_GF=new Ho(Me.NUMBER_OF_CODEWORDS,3);class Za{constructor(){this.field=Ho.PDF417_GF}decode(e,t,n){let s=new Xt(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 Xt(this.field,new Int32Array([this.field.subtract(0,z),1]));h=h.multiply(Y)}let g=new Xt(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(),ue=this.field.multiply(c.getCoefficient(c.getDegree()),Y);U=U.add(this.field.buildMonomial(ie,ue)),c=c.subtract(s.multiplyByMonomial(ie,ue))}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 Xt(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,s,c){e instanceof cr?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 cr(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 cr(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 $g{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 Kr{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+=Kr.form(e,t)}toString(){return this.buffer}}class Qr{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<Qr.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 Kr;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()}}Qr.MAX_NEARBY_DISTANCE=5;class Jr{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 Qr{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 Jr,n=new Jr,s=new Jr,c=new Jr;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 $g(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 ei{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=ei.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=ei.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(ei.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 Kr;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 ti{constructor(e,t,n,s){this.rowNumber=ti.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!==ti.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}}ti.BARCODE_ROW_UNKNOWN=-1;class on{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,on.RATIOS_TABLE[e]||(on.RATIOS_TABLE[e]=new Array(Me.BARS_IN_MODULE)),on.RATIOS_TABLE[e][Me.BARS_IN_MODULE-s-1]=Math.fround(c/Me.MODULES_IN_CODEWORD)}}this.bSymbolTableReady=!0}static getDecodedValue(e){let t=on.getDecodedCodewordValue(on.sampleBitCounts(e));return t!==-1?t:on.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=on.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=Ar.MAX_VALUE,c=-1;this.bSymbolTableReady||on.initialize();for(let d=0;d<on.RATIOS_TABLE.length;d++){let h=0,g=on.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}}on.bSymbolTableReady=!1,on.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 jg{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 qg extends x{}class Zg extends jg{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 qg;n=M.MAX_VALUE}this.buf=D.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),v.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 D.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 ut;(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"})(ut||(ut={}));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 jn(b){if(typeof vi>"u"&&(vi=el()),vi===null)throw new Error("BigInt is not supported!");return vi(b)}function Yg(){let b=[];b[0]=jn(1);let e=jn(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(M.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(M.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(M.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(D.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=ut.ALPHA,d=ut.ALPHA,h=0;for(;h<n;){let g=e[h],w="";switch(c){case ut.ALPHA:if(g<26)w=String.fromCharCode(65+g);else switch(g){case 26:w=" ";break;case ne.LL:c=ut.LOWER;break;case ne.ML:c=ut.MIXED;break;case ne.PS:d=c,c=ut.PUNCT_SHIFT;break;case ne.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:s.append(t[h]);break;case ne.TEXT_COMPACTION_MODE_LATCH:c=ut.ALPHA;break}break;case ut.LOWER:if(g<26)w=String.fromCharCode(97+g);else switch(g){case 26:w=" ";break;case ne.AS:d=c,c=ut.ALPHA_SHIFT;break;case ne.ML:c=ut.MIXED;break;case ne.PS:d=c,c=ut.PUNCT_SHIFT;break;case ne.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:s.append(t[h]);break;case ne.TEXT_COMPACTION_MODE_LATCH:c=ut.ALPHA;break}break;case ut.MIXED:if(g<ne.PL)w=ne.MIXED_CHARS[g];else switch(g){case ne.PL:c=ut.PUNCT;break;case 26:w=" ";break;case ne.LL:c=ut.LOWER;break;case ne.AL:c=ut.ALPHA;break;case ne.PS:d=c,c=ut.PUNCT_SHIFT;break;case ne.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:s.append(t[h]);break;case ne.TEXT_COMPACTION_MODE_LATCH:c=ut.ALPHA;break}break;case ut.PUNCT:if(g<ne.PAL)w=ne.PUNCT_CHARS[g];else switch(g){case ne.PAL:c=ut.ALPHA;break;case ne.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:s.append(t[h]);break;case ne.TEXT_COMPACTION_MODE_LATCH:c=ut.ALPHA;break}break;case ut.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=ut.ALPHA;break}break;case ut.PUNCT_SHIFT:if(c=d,g<ne.PAL)w=ne.PUNCT_CHARS[g];else switch(g){case ne.PAL:c=ut.ALPHA;break;case ne.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:s.append(t[h]);break;case ne.TEXT_COMPACTION_MODE_LATCH:c=ut.ALPHA;break}break}w!==""&&s.append(w),h++}}static byteCompaction(e,t,n,s,c){let d=new Zg,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(jn(g)>>jn(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(jn(g)>>jn(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=jn(0);for(let c=0;c<t;c++)n+=ne.EXP900[t-c-1]*jn(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()?Yg():[],ne.NUMBER_OF_SEQUENCE_CODEWORDS=2;class Ge{constructor(){}static decode(e,t,n,s,c,d,h){let g=new cr(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 Qr(g),A.setDetectionResultColumn(z,Y);let ie=-1,ue=ie;for(let me=g.getMinY();me<=g.getMaxY();me++){if(ie=Ge.getStartColumn(A,z,me,O),ie<0||ie>g.getMaxX()){if(ue===-1)continue;ie=ue}let de=Ge.detectCodeword(e,g.getMinX(),g.getMaxX(),O,ie,me,d,h);de!=null&&(Y.setCodeword(me,de),ue=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=cr.merge(Ge.adjustBoundingBox(e),Ge.adjustBoundingBox(t));return new ei(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 Jr;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=on.getDecodedValue(w),O=Me.getCodeword(S);return O===-1?null:new ti(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 Kr;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 $t{decode(e,t=null){let n=$t.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 $t.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=ze.detectMultiple(e,t,n);for(const d of c.getPoints()){const h=Ge.decode(c.getBits(),d[4],d[5],d[6],d[7],$t.getMinCodewordWidth(d),$t.getMaxCodewordWidth(d)),g=new _e(h.getText(),h.getRawBytes(),void 0,d,he.PDF_417);g.putMetadata(ye.ERROR_CORRECTION_LEVEL,h.getECLevel());const w=h.getOther();w!=null&&g.putMetadata(ye.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?M.MAX_VALUE:Math.trunc(Math.abs(e.getX()-t.getX()))}static getMaxCodewordWidth(e){return Math.floor(Math.max(Math.max($t.getMaxWidth(e[0],e[4]),$t.getMaxWidth(e[6],e[2])*Me.MODULES_IN_CODEWORD/Me.MODULES_IN_STOP_PATTERN),Math.max($t.getMaxWidth(e[1],e[5]),$t.getMaxWidth(e[7],e[3])*Me.MODULES_IN_CODEWORD/Me.MODULES_IN_STOP_PATTERN)))}static getMinCodewordWidth(e){return Math.floor(Math.min(Math.min($t.getMinWidth(e[0],e[4]),$t.getMinWidth(e[6],e[2])*Me.MODULES_IN_CODEWORD/Me.MODULES_IN_STOP_PATTERN),Math.min($t.getMinWidth(e[1],e[5]),$t.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===he.UPC_A||d===he.UPC_E||d===he.EAN_13||d===he.EAN_8||d===he.CODABAR||d===he.CODE_39||d===he.CODE_93||d===he.CODE_128||d===he.ITF||d===he.RSS_14||d===he.RSS_EXPANDED);c&&!t&&s.push(new Tr(e,this.verbose)),n.includes(he.QR_CODE)&&s.push(new $n),n.includes(he.DATA_MATRIX)&&s.push(new Xn),n.includes(he.AZTEC)&&s.push(new Ir),n.includes(he.PDF_417)&&s.push(new $t),c&&t&&s.push(new Tr(e,this.verbose))}s.length===0&&(t||s.push(new Tr(e,this.verbose)),s.push(new $n),s.push(new Xn),s.push(new Ir),s.push(new $t),t&&s.push(new Tr(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 Kg extends xe{constructor(e=null,t=500){const n=new tl;n.setHints(e),super(n,t)}decodeBitmap(e){return this.reader.decodeWithState(e)}}class Qg extends xe{constructor(e=500){super(new $t,e)}}class Jg extends xe{constructor(e=500){super(new $n,e)}}var Go;(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"})(Go||(Go={}));var Vt=Go;class Wo{constructor(e){this.field=e,this.cachedGenerators=[],this.cachedGenerators.push(new et(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 et(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);v.arraycopy(e,0,c,0,n);let d=new et(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;v.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(),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 Rt.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&&(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 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)*Rt.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+=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 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)D.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(`
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 H=$.cap(O,2,t-3);let Y=0;for(let ue=-2;ue<=2;ue++){const me=d[S+ue];Y+=me[H-2]+me[H-1]+me[H]+me[H+1]+me[H+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,H=0;for(let ie=0,ue=E*s+S;ie<$.BLOCK_SIZE;ie++,ue+=s){for(let me=0;me<$.BLOCK_SIZE;me++){const de=e[ue+me]&255;O+=de,de<U&&(U=de),de>H&&(H=de)}if(H-U>$.MIN_DYNAMIC_RANGE)for(ie++,ue+=s;ie<$.BLOCK_SIZE;ie++,ue+=s)for(let me=0;me<$.BLOCK_SIZE;me++)O+=e[ue+me]&255}let Y=O>>$.BLOCK_SIZE_POWER*2;if(H-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 ae{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||_r||self||window||void 0)&&(globalThis||_r||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 xe{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 ae(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 _e{constructor(e,t,n=t==null?0:8*t.length,s,c,d=v.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=v.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);v.arraycopy(t,0,n,0,t.length),v.arraycopy(e,0,n,t.length,e.length),this.resultPoints=n}}getTimestamp(){return this.timestamp}toString(){return this.text}}var Pe;(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"})(Pe||(Pe={}));var he=Pe,qe;(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"})(qe||(qe={}));var ye=qe;class Qe{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 ct{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 tt{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),v.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=ct.addOrSubtract(n,g)}return n}n=t[0];const s=t.length,c=this.field;for(let d=1;d<s;d++)n=ct.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;v.arraycopy(n,0,s,0,c);for(let d=c;d<n.length;d++)s[d]=ct.addOrSubtract(t[d-c],n[d]);return new tt(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]=ct.addOrSubtract(d[g+E],h.multiply(w,s[E]))}return new tt(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 tt(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 tt(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 _t extends x{}_t.kind="ArithmeticException";class De extends ct{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 tt(this,Int32Array.from([0])),this.one=new tt(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 tt(this,n)}inverse(e){if(e===0)throw new _t;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"+M.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 Ae extends x{}Ae.kind="ReedSolomonException";class Be extends x{}Be.kind="IllegalStateException";class Ke{constructor(e){this.field=e}decode(e,t){const n=this.field,s=new tt(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 tt(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 Ae("Bad error location");e[U]=De.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 Ae("r_{i-1} was zero");d=O;let H=s.getZero();const Y=c.getCoefficient(c.getDegree()),ie=s.inverse(Y);for(;d.getDegree()>=c.getDegree()&&!d.isZero();){const ue=d.getDegree()-c.getDegree(),me=s.multiply(d.getCoefficient(d.getDegree()),ie);H=H.addOrSubtract(s.buildMonomial(ue,me)),d=d.addOrSubtract(c.multiplyByMonomial(ue,me))}if(g=H.multiply(h).addOrSubtract(U),d.getDegree()>=c.getDegree())throw new Be("Division algorithm failed to reduce polynomial?")}const w=g.getCoefficient(0);if(w===0)throw new Ae("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 Ae("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 it;(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"})(it||(it={}));class et{decode(e){this.ddata=e;let t=e.getBits(),n=this.extractBits(t),s=this.correctBits(n),c=et.convertBoolArrayToByteArray(s),d=et.getEncodedData(s),h=new Qe(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=it.UPPER,s=it.UPPER,c="",d=0;for(;d<t;)if(s===it.BINARY){if(t-d<5)break;let h=et.readCode(e,d,5);if(d+=5,h===0){if(t-d<11)break;h=et.readCode(e,d,11)+31,d+=11}for(let g=0;g<h;g++){if(t-d<8){d=t;break}const w=et.readCode(e,d,8);c+=ee.castAsNonUtf8Char(w),d+=8}s=n}else{let h=s===it.DIGIT?4:5;if(t-d<h)break;let g=et.readCode(e,d,h);d+=h;let w=et.getCharacter(s,g);w.startsWith("CTRL_")?(n=s,s=et.getTable(w.charAt(5)),w.charAt(6)==="L"&&(n=s)):(c+=w,s=n)}return c}static getTable(e){switch(e){case"L":return it.LOWER;case"P":return it.PUNCT;case"M":return it.MIXED;case"D":return it.DIGIT;case"B":return it.BINARY;case"U":default:return it.UPPER}}static getCharacter(e,t){switch(e){case it.UPPER:return et.UPPER_TABLE[t];case it.LOWER:return et.LOWER_TABLE[t];case it.MIXED:return et.MIXED_TABLE[t];case it.PUNCT:return et.PUNCT_TABLE[t];case it.DIGIT:return et.DIGIT_TABLE[t];default:throw new Be("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 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]=et.readCode(e,d,n);try{new Ke(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*M.truncDivision(M.truncDivision(s,2)-1,15),g=s/2,w=M.truncDivision(h,2);for(let E=0;E<g;E++){let A=E+M.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?et.readCode(e,t,8):et.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]=et.readByte(e,8*n);return t}totalBitsInLayer(e,t){return((t?88:112)+16*e)*e}}et.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"],et.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"],et.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"],et.PUNCT_TABLE=["","\r",`\r
16
+ `,". ",", ",": ","!",'"',"#","$","%","&","'","(",")","*","+",",","-",".","/",":",";","<","=",">","?","[","]","{","}","CTRL_UL"],et.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 Ar{static floatToIntBits(e){return e}}Ar.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*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]),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 Sr{constructor(e,t){this.bits=e,this.points=t}getBits(){return this.bits}getPoints(){return this.points}}class jr extends Sr{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 H=!0;for(;(H||!w)&&s<O;)H=this.containsBlackPoint(e,t,s,!0),H?(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 H=null;for(let me=1;H===null&&me<U;me++)H=this.getBlackPointOnSegment(e,s-me,e+me,s);if(H==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 ue=null;for(let me=1;ue===null&&me<U;me++)ue=this.getBlackPointOnSegment(t,s-me,t-me,s);if(ue==null)throw new N;return this.centerEdges(ue,H,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 qr{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 nn{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,H,Y){const ie=nn.quadrilateralToSquare(e,t,n,s,c,d,h,g);return nn.squareToQuadrilateral(w,E,A,S,O,U,H,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],H=c*O+g*U+A;e[S]=(n*O+d*U+w)/H,e[S+1]=(s*O+h*U+E)/H}}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],H=t[O],Y=c*U+g*H+A;e[O]=(n*U+d*H+w)/Y,t[O]=(s*U+h*H+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 nn(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,H=A*U-S*O,Y=(w*U-S*E)/H,ie=(A*E-w*O)/H;return new nn(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 nn.squareToQuadrilateral(e,t,n,s,c,d,h,g).buildAdjoint()}buildAdjoint(){return new nn(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 nn(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 or extends qr{sampleGrid(e,t,n,s,c,d,h,g,w,E,A,S,O,U,H,Y,ie,ue,me){const de=nn.quadrilateralToQuadrilateral(s,c,d,h,g,w,E,A,S,O,U,H,Y,ie,ue,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),qr.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 Pt{static setGridSampler(e){Pt.gridSampler=e}static getInstance(){return Pt.gridSampler}}Pt.gridSampler=new or;class Lt{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 jr(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(M.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 Ke(De.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 H=this.distancePoint(U,A)*this.nbCenterLayers/(this.distancePoint(c,t)*(this.nbCenterLayers+2));if(H<.75||H>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 Lt(g+7,w-7),!1,1,-1).toResultPoint(),t=this.getFirstDifferent(new Lt(g+7,w+7),!1,1,1).toResultPoint(),n=this.getFirstDifferent(new Lt(g-7,w+7),!1,-1,1).toResultPoint(),s=this.getFirstDifferent(new Lt(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 Lt(c+7,d-7),!1,1,-1).toResultPoint(),t=this.getFirstDifferent(new Lt(c+7,d+7),!1,1,1).toResultPoint(),n=this.getFirstDifferent(new Lt(c-7,d+7),!1,-1,1).toResultPoint(),s=this.getFirstDifferent(new Lt(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 Lt(c,d)}getMatrixCornerPoints(e){return this.expandSquare(e,2*this.nbCenterLayers,this.getDimension())}sampleGrid(e,t,n,s,c){let d=Pt.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 Lt(e.getX()-c,e.getY()+c),t=new Lt(t.getX()-c,t.getY()-c),n=new Lt(n.getX()+c,n.getY()-c),s=new Lt(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 Lt(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*(M.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 et().decode(E)}catch(E){n=E}if(d==null)try{let E=s.detectMirror(!0);c=E.getPoints(),this.reportFoundResultPoints(t,c),d=new et().decode(E)}catch(E){throw n??E}let h=new _e(d.getText(),d.getRawBytes(),d.getNumBits(),c,he.AZTEC,v.currentTimeMillis()),g=d.getByteSegments();g!=null&&h.putMetadata(ye.BYTE_SEGMENTS,g);let w=d.getECLevel();return w!=null&&h.putMetadata(ye.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 Do extends xe{constructor(e=500){super(new Ir,e)}}class Nt{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(ye.ORIENTATION)===!0&&(g=g+h.get(ye.ORIENTATION)%360),d.putMetadata(ye.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 H=new Map;t.forEach((Y,ie)=>H.set(ie,Y)),H.delete(Z.NEED_RESULT_POINT_CALLBACK),t=H}try{const H=this.decodeRow(O,c,t);if(U===1){H.putMetadata(ye.ORIENTATION,180);const Y=H.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 H}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;Nt.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 Nt{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=Nt.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){Nt.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 H=Int32Array.from([0,0,0,0,0,0]);let Y=0,ie=0,ue=d,me=0,de=!0,je=!1,Ve=!1;for(;!E;){const Mr=A;switch(A=!1,Y=ie,ie=pe.decodeCode(t,H,U),g[h++]=ie,ie!==pe.CODE_STOP&&(de=!0),ie!==pe.CODE_STOP&&(me++,ue+=me*ie),O=U,U+=H.reduce((up,fp)=>up+fp,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)Ve===je?S+=String.fromCharCode(32+ie):S+=String.fromCharCode(32+ie+128),Ve=!1;else if(ie<96)Ve===je?S+=String.fromCharCode(ie-64):S+=String.fromCharCode(ie+64),Ve=!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&&Ve?(je=!0,Ve=!1):je&&Ve?(je=!1,Ve=!1):Ve=!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)Ve===je?S+=String.fromCharCode(32+ie):S+=String.fromCharCode(32+ie+128),Ve=!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&&Ve?(je=!0,Ve=!1):je&&Ve?(je=!1,Ve=!1):Ve=!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}Mr&&(w=w===pe.CODE_CODE_A?pe.CODE_CODE_B:pe.CODE_CODE_A)}const sn=U-O;if(U=t.getNextUnset(U),!t.isRange(U,Math.min(t.getSize(),U+(U-O)/2),!1))throw new N;if(ue-=me*Y,ue%103!==Y)throw new B;const In=S.length;if(In===0)throw new N;In>0&&de&&(w===pe.CODE_CODE_C?S=S.substring(0,In-2):S=S.substring(0,In-1));const an=(c[1]+c[0])/2,ht=O+sn/2,jt=g.length,mn=new Uint8Array(jt);for(let Mr=0;Mr<jt;Mr++)mn[Mr]=g[Mr];const Or=[new be(an,e),new be(ht,e)];return new _e(S,mn,0,Or,he.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 Bt extends Nt{constructor(e=!1,t=!1){super(),this.usingCheckDigit=e,this.extendedMode=t,this.decodeRowResult="",this.counters=new Int32Array(9)}decodeRow(e,t,n){let s=this.counters;s.fill(0),this.decodeRowResult="";let c=Bt.findAsteriskPattern(t,s),d=t.getNextSet(c[1]),h=t.getSize(),g,w;do{Bt.recordPattern(t,d,s);let H=Bt.toNarrowWidePattern(s);if(H<0)throw new N;g=Bt.patternToChar(H),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 H of s)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 ie=0;ie<H;ie++)Y+=Bt.ALPHABET_STRING.indexOf(this.decodeRowResult.charAt(ie));if(this.decodeRowResult.charAt(H)!==Bt.ALPHABET_STRING.charAt(Y%43))throw new B;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 O=(c[1]+c[0])/2,U=w+E/2;return new _e(S,null,0,[new be(O,e),new be(U,e)],he.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)===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,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<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 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}}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 st extends Nt{constructor(){super(...arguments),this.narrowLineWidth=-1}decodeRow(e,t,n){let s=this.decodeStart(t),c=this.decodeEnd(t),d=new G;st.decodeMiddle(t,s[1],c[0],d);let h=d.toString(),g=null;n!=null&&(g=n.get(Z.ALLOWED_LENGTHS)),g==null&&(g=st.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 _e(h,null,0,S,he.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;){Nt.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=st.decodeDigit(d);s.append(g.toString()),g=this.decodeDigit(h),s.append(g.toString()),c.forEach(function(w){t+=w})}}decodeStart(e){let t=st.skipWhiteSpace(e),n=st.findGuardPattern(e,t,st.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=st.skipWhiteSpace(e),n;try{n=st.findGuardPattern(e,t,st.END_PATTERN_REVERSED[0])}catch(c){c instanceof N&&(n=st.findGuardPattern(e,t,st.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(Nt.patternMatchVariance(c,n,st.MAX_INDIVIDUAL_VARIANCE)<st.MAX_AVG_VARIANCE)return[w,E];w+=c[0]+c[1],v.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=st.MAX_AVG_VARIANCE,n=-1,s=st.PATTERNS.length;for(let c=0;c<s;c++){let d=st.PATTERNS[c],h=Nt.patternMatchVariance(e,d,st.MAX_INDIVIDUAL_VARIANCE);h<t?(t=h,n=c):h===t&&(n=-1)}if(n>=0)return n%10;throw new N}}st.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])],st.MAX_AVG_VARIANCE=.38,st.MAX_INDIVIDUAL_VARIANCE=.5,st.DEFAULT_ALLOWED_LENGTHS=[6,8,10,12,14],st.START_PATTERN=Int32Array.from([1,1,1,1]),st.END_PATTERN_REVERSED=[Int32Array.from([1,1,2]),Int32Array.from([1,1,3])];class dt extends Nt{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=dt.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 dt.checkStandardUPCEANChecksum(e)}static checkStandardUPCEANChecksum(e){let t=e.length;if(t===0)return!1;let n=parseInt(e.charAt(t-1),10);return dt.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 dt.findGuardPattern(e,t,!1,dt.START_END_PATTERN,new Int32Array(dt.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(Nt.patternMatchVariance(c,s,dt.MAX_INDIVIDUAL_VARIANCE)<dt.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=Nt.patternMatchVariance(t,w,dt.MAX_INDIVIDUAL_VARIANCE);E<c&&(c=E,d=g)}if(d>=0)return d;throw new N}}dt.MAX_AVG_VARIANCE=.48,dt.MAX_INDIVIDUAL_VARIANCE=.7,dt.START_END_PATTERN=Int32Array.from([1,1,1]),dt.MIDDLE_PATTERN=Int32Array.from([1,1,1,1,1]),dt.END_PATTERN=Int32Array.from([1,1,1,1,1,1]),dt.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 sr{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=sr.parseExtensionString(d),g=[new be((n[0]+n[1])/2,e),new be(c,e)],w=new _e(d,null,0,g,he.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=dt.decodeDigit(e,s,d,dt.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(sr.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=sr.parseExtension5String(e);return t==null?null:new Map([[ye.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 ar{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=ar.parseExtensionString(d),g=[new be((n[0]+n[1])/2,e),new be(c,e)],w=new _e(d,null,0,g,he.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=dt.decodeDigit(e,s,d,dt.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([[ye.ISSUE_NUMBER,parseInt(e)]])}}class Zr{static decodeRow(e,t,n){let s=dt.findGuardPattern(t,n,!1,this.EXTENSION_START_PATTERN,new Int32Array(this.EXTENSION_START_PATTERN.length).fill(0));try{return new sr().decodeRow(e,t,s)}catch{return new ar().decodeRow(e,t,s)}}}Zr.EXTENSION_START_PATTERN=Int32Array.from([1,1,2]);class $e extends dt{constructor(){super(),this.decodeRowStringBuffer="",$e.L_AND_G_PATTERNS=$e.L_PATTERNS.map(e=>Int32Array.from(e));for(let e=10;e<20;e++){let t=$e.L_PATTERNS[e-10],n=new Int32Array(t.length);for(let s=0;s<t.length;s++)n[s]=t[t.length-s-1];$e.L_AND_G_PATTERNS[e]=n}}decodeRow(e,t,n){let s=$e.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(!$e.checkChecksum(S))throw new B;let O=(s[1]+s[0])/2,U=(w[1]+w[0])/2,H=this.getBarcodeFormat(),Y=[new be(O,e),new be(U,e)],ie=new _e(S,null,0,Y,H,new Date().getTime()),ue=0;try{let de=Zr.decodeRow(e,t,w[1]);ie.putMetadata(ye.UPC_EAN_EXTENSION,de.getText()),ie.putAllMetadata(de.getResultMetadata()),ie.addResultPoints(de.getResultPoints()),ue=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(ue.toString()===je){de=!0;break}if(!de)throw new N}return ie}decodeEnd(e,t){return $e.findGuardPattern(e,t,!1,$e.START_END_PATTERN,new Int32Array($e.START_END_PATTERN.length).fill(0))}static checkChecksum(e){return $e.checkStandardUPCEANChecksum(e)}static checkStandardUPCEANChecksum(e){let t=e.length;if(t===0)return!1;let n=parseInt(e.charAt(t-1),10);return $e.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 ge extends $e{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=$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)}n=ge.determineFirstDigit(n,h),d=$e.findGuardPattern(e,d,!0,$e.MIDDLE_PATTERN,new Int32Array($e.MIDDLE_PATTERN.length).fill(0))[1];for(let w=0;w<6&&d<c;w++){let E=$e.decodeDigit(e,s,d,$e.L_PATTERNS);n+=String.fromCharCode(48+E);for(let A of s)d+=A}return{rowOffset:d,resultString:n}}getBarcodeFormat(){return he.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}}ge.FIRST_DIGIT_ENCODINGS=[0,11,13,14,19,25,28,21,22,26];class se extends $e{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=$e.decodeDigit(e,s,d,$e.L_PATTERNS);n+=String.fromCharCode(48+w);for(let E of s)d+=E}d=$e.findGuardPattern(e,d,!0,$e.MIDDLE_PATTERN,new Int32Array($e.MIDDLE_PATTERN.length).fill(0))[1];for(let g=0;g<4&&d<c;g++){let w=$e.decodeDigit(e,s,d,$e.L_PATTERNS);n+=String.fromCharCode(48+w);for(let E of s)d+=E}return{rowOffset:d,resultString:n}}getBarcodeFormat(){return he.EAN_8}}class Ue extends $e{constructor(){super(...arguments),this.ean13Reader=new ge}getBarcodeFormat(){return he.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 _e(t.substring(1),null,null,e.getResultPoints(),he.UPC_A);return e.getResultMetadata()!=null&&n.putAllMetadata(e.getResultMetadata()),n}else throw new N}reset(){this.ean13Reader.reset()}}class Fe extends $e{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=Fe.decodeDigit(e,s,d,Fe.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=Fe.determineNumSysAndCheckDigit(n,h);return{rowOffset:d,resultString:g}}decodeEnd(e,t){return Fe.findGuardPatternWithoutCounters(e,t,!0,Fe.MIDDLE_END_PATTERN)}checkChecksum(e){return $e.checkChecksum(Fe.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 he.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()}}Fe.MIDDLE_END_PATTERN=Int32Array.from([1,1,1,1,1,1]),Fe.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 hn extends Nt{constructor(e){super();let t=e==null?null:e.get(Z.POSSIBLE_FORMATS),n=[];o(t)?(n.push(new ge),n.push(new Ue),n.push(new se),n.push(new Fe)):(t.indexOf(he.EAN_13)>-1&&n.push(new ge),t.indexOf(he.UPC_A)>-1&&n.push(new Ue),t.indexOf(he.EAN_8)>-1&&n.push(new se),t.indexOf(he.UPC_E)>-1&&n.push(new Fe)),this.readers=n}decodeRow(e,t,n){for(let s of this.readers)try{const c=s.decodeRow(e,t,n),d=c.getBarcodeFormat()===he.EAN_13&&c.getText().charAt(0)==="0",h=n==null?null:n.get(Z.POSSIBLE_FORMATS),g=h==null||h.includes(he.UPC_A);if(d&&g){const w=c.getRawBytes(),E=new _e(c.getText().substring(1),w,w?w.length:null,c.getResultPoints(),he.UPC_A);return E.putAllMetadata(c.getResultMetadata()),E}return c}catch{}throw new N}reset(){for(let e of this.readers)e.reset()}}class wt extends Nt{constructor(){super(),this.decodeFinderCounters=new Int32Array(4),this.dataCharacterCounters=new Int32Array(8),this.oddRoundingErrors=new Array(4),this.evenRoundingErrors=new Array(4),this.oddCounts=new Array(this.dataCharacterCounters.length/2),this.evenCounts=new Array(this.dataCharacterCounters.length/2)}getDecodeFinderCounters(){return this.decodeFinderCounters}getDataCharacterCounters(){return this.dataCharacterCounters}getOddRoundingErrors(){return this.oddRoundingErrors}getEvenRoundingErrors(){return this.evenRoundingErrors}getOddCounts(){return this.oddCounts}getEvenCounts(){return this.evenCounts}parseFinderValue(e,t){for(let n=0;n<t.length;n++)if(Nt.patternMatchVariance(e,t[n],wt.MAX_INDIVIDUAL_VARIANCE)<wt.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>=wt.MIN_FINDER_PATTERN_RATIO&&s<=wt.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}}wt.MAX_AVG_VARIANCE=.2,wt.MAX_INDIVIDUAL_VARIANCE=.45,wt.MIN_FINDER_PATTERN_RATIO=9.5/12,wt.MAX_FINDER_PATTERN_RATIO=12.5/14;class nt{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 nt))return!1;const t=e;return this.value===t.value&&this.checksumPortion===t.checksumPortion}hashCode(){return this.value^this.checksumPortion}}class Xe{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 Xe))return!1;const t=e;return this.value===t.value}hashCode(){return this.value}}class Tt{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=Tt.combins(s-w-1,h-g-2);if(n&&d===0&&s-w-(h-g-1)>=h-g-1&&(E-=Tt.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+=Tt.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 zt{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 Ct{constructor(e,t){t?this.decodedInformation=null:(this.finished=e,this.decodedInformation=t)}getDecodedInformation(){return this.decodedInformation}isFinished(){return this.finished}}class Ot{constructor(e){this.newPosition=e}getNewPosition(){return this.newPosition}}class at extends Ot{constructor(e,t){super(e),this.value=t}getValue(){return this.value}isFNC1(){return this.value===at.FNC1}}at.FNC1="$";class Oe extends Ot{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 Ht extends Ot{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===Ht.FNC1}isSecondDigitFNC1(){return this.secondDigit===Ht.FNC1}isAnyFNC1(){return this.firstDigit===Ht.FNC1||this.secondDigit===Ht.FNC1}}Ht.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 s=e.substring(0,4);for(let c of Ee.FOUR_DIGIT_DATA_LENGTH)if(c[0]===s)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 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=Ee.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=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 lr{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=Ee.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 Ht(this.information.getSize(),Ht.FNC1,Ht.FNC1):new Ht(this.information.getSize(),c-1,Ht.FNC1)}let t=this.extractNumericValueFromBitArray(e,7),n=(t-8)/11,s=(t-8)%11;return new Ht(e+7,n,s)}extractNumericValueFromBitArray(e,t){return lr.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 Oe(this.current.getPosition(),this.buffer.toString(),n.getRemainingValue()):new Oe(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 Oe(this.current.getPosition(),this.buffer.toString()):t=new Oe(this.current.getPosition(),this.buffer.toString(),e.getSecondDigit()),new Ct(!0,t)}if(this.buffer.append(e.getFirstDigit()),e.isSecondDigitFNC1()){let t=new Oe(this.current.getPosition(),this.buffer.toString());return new Ct(!0,t)}this.buffer.append(e.getSecondDigit())}return this.isNumericToAlphaNumericLatch(this.current.getPosition())&&(this.current.setAlpha(),this.current.incrementPosition(4)),new Ct(!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 Oe(this.current.getPosition(),this.buffer.toString());return new Ct(!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 Ct(!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 Oe(this.current.getPosition(),this.buffer.toString());return new Ct(!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 Ct(!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 at(e+5,at.FNC1);if(t>=5&&t<15)return new at(e+5,"0"+(t-5));let n=this.extractNumericValueFromBitArray(e,7);if(n>=64&&n<90)return new at(e+7,""+(n+1));if(n>=90&&n<116)return new at(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 at(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 at(e+5,at.FNC1);if(t>=5&&t<15)return new at(e+5,"0"+(t-5));let n=this.extractNumericValueFromBitArray(e,6);if(n>=32&&n<58)return new at(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 Be("Decoding invalid alphanumeric value: "+n)}return new at(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 vo{constructor(e){this.information=e,this.generalDecoder=new lr(e)}getInformation(){return this.information}getGeneralDecoder(){return this.generalDecoder}}class rn extends vo{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)}rn.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)}}rn.GTIN_SIZE=40;class Nr extends rn{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 vo{constructor(e){super(e)}parseInformation(){let e=new G;return this.getGeneralDecoder().decodeAllCodes(e,Oi.HEADER_SIZE)}}Oi.HEADER_SIZE=5;class Mi extends rn{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 Rn extends Mi{constructor(e){super(e)}parseInformation(){if(this.getInformation().getSize()!=Rn.HEADER_SIZE+Mi.GTIN_SIZE+Rn.WEIGHT_SIZE)throw new N;let e=new G;return this.encodeCompressedGtin(e,Rn.HEADER_SIZE),this.encodeCompressedWeight(e,Rn.HEADER_SIZE+Mi.GTIN_SIZE,Rn.WEIGHT_SIZE),e.toString()}}Rn.HEADER_SIZE=5,Rn.WEIGHT_SIZE=15;class Fg extends Rn{constructor(e){super(e)}addWeightCode(e,t){e.append("(3103)")}checkWeight(e){return e}}class Vg extends Rn{constructor(e){super(e)}addWeightCode(e,t){t<1e4?e.append("(3202)"):e.append("(3203)")}checkWeight(e){return e<1e4?e:e-1e4}}class Bn extends rn{constructor(e){super(e)}parseInformation(){if(this.getInformation().getSize()<Bn.HEADER_SIZE+rn.GTIN_SIZE)throw new N;let e=new G;this.encodeCompressedGtin(e,Bn.HEADER_SIZE);let t=this.getGeneralDecoder().extractNumericValueFromBitArray(Bn.HEADER_SIZE+rn.GTIN_SIZE,Bn.LAST_DIGIT_SIZE);e.append("(392"),e.append(t),e.append(")");let n=this.getGeneralDecoder().decodeGeneralPurposeField(Bn.HEADER_SIZE+rn.GTIN_SIZE+Bn.LAST_DIGIT_SIZE,null);return e.append(n.getNewString()),e.toString()}}Bn.HEADER_SIZE=8,Bn.LAST_DIGIT_SIZE=2;class Kt extends rn{constructor(e){super(e)}parseInformation(){if(this.getInformation().getSize()<Kt.HEADER_SIZE+rn.GTIN_SIZE)throw new N;let e=new G;this.encodeCompressedGtin(e,Kt.HEADER_SIZE);let t=this.getGeneralDecoder().extractNumericValueFromBitArray(Kt.HEADER_SIZE+rn.GTIN_SIZE,Kt.LAST_DIGIT_SIZE);e.append("(393"),e.append(t),e.append(")");let n=this.getGeneralDecoder().extractNumericValueFromBitArray(Kt.HEADER_SIZE+rn.GTIN_SIZE+Kt.LAST_DIGIT_SIZE,Kt.FIRST_THREE_DIGITS_SIZE);n/100==0&&e.append("0"),n/10==0&&e.append("0"),e.append(n);let s=this.getGeneralDecoder().decodeGeneralPurposeField(Kt.HEADER_SIZE+rn.GTIN_SIZE+Kt.LAST_DIGIT_SIZE+Kt.FIRST_THREE_DIGITS_SIZE,null);return e.append(s.getNewString()),e.toString()}}Kt.HEADER_SIZE=8,Kt.LAST_DIGIT_SIZE=2,Kt.FIRST_THREE_DIGITS_SIZE=10;class At extends Mi{constructor(e,t,n){super(e),this.dateCode=n,this.firstAIdigits=t}parseInformation(){if(this.getInformation().getSize()!=At.HEADER_SIZE+At.GTIN_SIZE+At.WEIGHT_SIZE+At.DATE_SIZE)throw new N;let e=new G;return this.encodeCompressedGtin(e,At.HEADER_SIZE),this.encodeCompressedWeight(e,At.HEADER_SIZE+At.GTIN_SIZE,At.WEIGHT_SIZE),this.encodeCompressedDate(e,At.HEADER_SIZE+At.GTIN_SIZE+At.WEIGHT_SIZE),e.toString()}encodeCompressedDate(e,t){let n=this.getGeneralDecoder().extractNumericValueFromBitArray(t,At.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}}At.HEADER_SIZE=8,At.WEIGHT_SIZE=20,At.DATE_SIZE=16;function qa(b){try{if(b.get(1))return new Nr(b);if(!b.get(2))return new Oi(b);switch(lr.extractNumericValueFromBitArray(b,1,4)){case 4:return new Fg(b);case 5:return new Vg(b)}switch(lr.extractNumericValueFromBitArray(b,1,5)){case 12:return new Bn(b);case 13:return new Kt(b)}switch(lr.extractNumericValueFromBitArray(b,1,7)){case 56:return new At(b,"310","11");case 57:return new At(b,"320","11");case 58:return new At(b,"310","13");case 59:return new At(b,"320","13");case 60:return new At(b,"310","15");case 61:return new At(b,"320","15");case 62:return new At(b,"310","17");case 63:return new At(b,"320","17")}}catch(e){throw console.log(e),new Be("unknown decoder: "+b)}}class Gn{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 Gn?Gn.equalsOrNull(e.leftchar,t.leftchar)&&Gn.equalsOrNull(e.rightchar,t.rightchar)&&Gn.equalsOrNull(e.finderpattern,t.finderpattern):!1}static equalsOrNull(e,t){return e===null?t===null:Gn.equals(e,t)}hashCode(){return this.leftchar.getValue()^this.rightchar.getValue()^this.finderpattern.getValue()}}class Po{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 Po?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 wt{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 Po(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(Gn.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=zt.buildBitArray(e),s=qa(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 _e(s,null,null,h,he.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 Gn(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();v.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 Xe(g,[c,d],c,d,t)}decodeDataCharacter(e,t,n,s){let c=this.getDataCharacterCounters();for(let ht=0;ht<c.length;ht++)c[ht]=0;if(s)ce.recordPatternInReverse(e,t.getStartEnd()[0],c);else{ce.recordPattern(e,t.getStartEnd()[1],c);for(let ht=0,jt=c.length-1;ht<jt;ht++,jt--){let mn=c[ht];c[ht]=c[jt],c[jt]=mn}}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 ht=0;ht<c.length;ht++){let jt=1*c[ht]/h,mn=jt+.5;if(mn<1){if(jt<.3)throw new N;mn=1}else if(mn>8){if(jt>8.7)throw new N;mn=8}let Or=ht/2;ht&1?(E[Or]=mn,S[Or]=jt-mn):(w[Or]=mn,A[Or]=jt-mn)}this.adjustOddEvenCounts(d);let O=4*t.getValue()+(n?0:2)+(s?0:1)-1,U=0,H=0;for(let ht=w.length-1;ht>=0;ht--){if(ce.isNotA1left(t,n,s)){let jt=ce.WEIGHTS[O][2*ht];H+=w[ht]*jt}U+=w[ht]}let Y=0;for(let ht=E.length-1;ht>=0;ht--)if(ce.isNotA1left(t,n,s)){let jt=ce.WEIGHTS[O][2*ht+1];Y+=E[ht]*jt}let ie=H+Y;if(U&1||U>13||U<4)throw new N;let ue=(13-U)/2,me=ce.SYMBOL_WIDEST[ue],de=9-me,je=Tt.getRSSvalue(w,me,!0),Ve=Tt.getRSSvalue(E,de,!1),sn=ce.EVEN_TOTAL_SUBSET[ue],In=ce.GSUM[ue],an=je*sn+Ve+In;return new nt(an,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 Ug extends nt{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 wt{constructor(){super(...arguments),this.possibleLeftPairs=[],this.possibleRightPairs=[]}decodeRow(e,t,n){const s=this.decodePair(t,!1,e,n);kt.addOrTally(this.possibleLeftPairs,s),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 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 _e(c.toString(),null,0,[h[0],h[1],g[0],g[1]],he.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 Ug(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)Nt.recordPatternInReverse(e,t.getStartEnd()[0],s);else{Nt.recordPattern(e,t.getStartEnd()[1]+1,s);for(let Y=0,ie=s.length-1;Y<ie;Y++,ie--){let ue=s[Y];s[Y]=s[ie],s[ie]=ue}}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,ue=Math.floor(ie+.5);ue<1?ue=1:ue>8&&(ue=8);let me=Math.floor(Y/2);Y&1?(g[me]=ue,E[me]=ie-ue):(h[me]=ue,w[me]=ie-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 O=0,U=0;for(let Y=g.length-1;Y>=0;Y--)O*=9,O+=g[Y],U+=g[Y];let H=S+3*O;if(n){if(A&1||A>12||A<4)throw new N;let Y=(12-A)/2,ie=kt.OUTSIDE_ODD_WIDEST[Y],ue=9-ie,me=Tt.getRSSvalue(h,ie,!1),de=Tt.getRSSvalue(g,ue,!0),je=kt.OUTSIDE_EVEN_TOTAL_SUBSET[Y],Ve=kt.OUTSIDE_GSUM[Y];return new nt(me*je+de+Ve,H)}else{if(U&1||U>10||U<4)throw new N;let Y=(10-U)/2,ie=kt.INSIDE_ODD_WIDEST[Y],ue=9-ie,me=Tt.getRSSvalue(h,ie,!0),de=Tt.getRSSvalue(g,ue,!1),je=kt.INSIDE_ODD_TOTAL_SUBSET[Y],Ve=kt.INSIDE_GSUM[Y];return new nt(de*je+me+Ve,H)}}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(wt.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);v.arraycopy(g,0,w,1,g.length-1),w[0]=h;const E=this.parseFinderValue(w,kt.FINDER_PATTERNS);let A=d,S=s[1];return n&&(A=e.getSize()-1-A,S=e.getSize()-1-S),new Xe(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;wt.increment(this.getOddCounts(),this.getOddRoundingErrors())}if(d&&wt.decrement(this.getOddCounts(),this.getOddRoundingErrors()),h){if(g)throw new N;wt.increment(this.getEvenCounts(),this.getOddRoundingErrors())}g&&wt.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 Nt{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(he.EAN_13)||n.includes(he.UPC_A)||n.includes(he.EAN_8)||n.includes(he.UPC_E))&&this.readers.push(new hn(e)),n.includes(he.CODE_39)&&this.readers.push(new Bt(s)),n.includes(he.CODE_128)&&this.readers.push(new pe),n.includes(he.ITF)&&this.readers.push(new st),n.includes(he.RSS_14)&&this.readers.push(new kt),n.includes(he.RSS_EXPANDED)&&this.readers.push(new ce(this.verbose))):(this.readers.push(new hn(e)),this.readers.push(new Bt),this.readers.push(new hn(e)),this.readers.push(new pe),this.readers.push(new st),this.readers.push(new kt),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 zg extends xe{constructor(e=500,t){super(new Tr(t),e,t)}}class ot{constructor(e,t,n){this.ecCodewords=e,this.ecBlocks=[t],n&&this.ecBlocks.push(n)}getECCodewords(){return this.ecCodewords}getECBlocks(){return this.ecBlocks}}class rt{constructor(e,t){this.count=e,this.dataCodewords=t}getCount(){return this.count}getDataCodewords(){return this.dataCodewords}}class Ze{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 Ze.VERSIONS)if(n.symbolSizeRows===e&&n.symbolSizeColumns===t)return n;throw new V}toString(){return""+this.versionNumber}static buildVersions(){return[new Ze(1,10,10,8,8,new ot(5,new rt(1,3))),new Ze(2,12,12,10,10,new ot(7,new rt(1,5))),new Ze(3,14,14,12,12,new ot(10,new rt(1,8))),new Ze(4,16,16,14,14,new ot(12,new rt(1,12))),new Ze(5,18,18,16,16,new ot(14,new rt(1,18))),new Ze(6,20,20,18,18,new ot(18,new rt(1,22))),new Ze(7,22,22,20,20,new ot(20,new rt(1,30))),new Ze(8,24,24,22,22,new ot(24,new rt(1,36))),new Ze(9,26,26,24,24,new ot(28,new rt(1,44))),new Ze(10,32,32,14,14,new ot(36,new rt(1,62))),new Ze(11,36,36,16,16,new ot(42,new rt(1,86))),new Ze(12,40,40,18,18,new ot(48,new rt(1,114))),new Ze(13,44,44,20,20,new ot(56,new rt(1,144))),new Ze(14,48,48,22,22,new ot(68,new rt(1,174))),new Ze(15,52,52,24,24,new ot(42,new rt(2,102))),new Ze(16,64,64,14,14,new ot(56,new rt(2,140))),new Ze(17,72,72,16,16,new ot(36,new rt(4,92))),new Ze(18,80,80,18,18,new ot(48,new rt(4,114))),new Ze(19,88,88,20,20,new ot(56,new rt(4,144))),new Ze(20,96,96,22,22,new ot(68,new rt(4,174))),new Ze(21,104,104,24,24,new ot(56,new rt(6,136))),new Ze(22,120,120,18,18,new ot(68,new rt(6,175))),new Ze(23,132,132,20,20,new ot(62,new rt(8,163))),new Ze(24,144,144,22,22,new ot(62,new rt(8,156),new rt(2,155))),new Ze(25,8,18,6,16,new ot(7,new rt(1,5))),new Ze(26,8,32,6,14,new ot(11,new rt(1,10))),new Ze(27,12,26,10,24,new ot(14,new rt(1,16))),new Ze(28,12,36,10,16,new ot(18,new rt(1,22))),new Ze(29,16,36,14,16,new ot(24,new rt(1,32))),new Ze(30,16,48,14,22,new ot(28,new rt(1,49)))]}}Ze.VERSIONS=Ze.buildVersions();class Lo{constructor(e){const t=e.getHeight();if(t<8||t>144||t&1)throw new V;this.version=Lo.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 Ze.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 H=0;H<s;++H){const Y=A*(s+2)+1+H,ie=S+H;for(let ue=0;ue<c;++ue){const me=O*(c+2)+1+ue;if(e.get(me,Y)){const de=U+ue;E.set(de,ie)}}}}}return E}}class Fo{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 H of c)s+=H.getCount();const d=new Array(s);let h=0;for(let H of c)for(let Y=0;Y<H.getCount();Y++){const ie=H.getDataCodewords(),ue=n.getECCodewords()+ie;d[h++]=new Fo(ie,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,O=S?8:h;for(let H=0;H<O;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 ie=S?(Y+8)%h:Y,ue=S&&ie>7?H-1:H;d[ie].codewords[ue]=e[A++]}if(A!==e.length)throw new y;return d}getNumDataCodewords(){return this.numDataCodewords}getCodewords(){return this.codewords}}class Vo{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 Ft;(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"})(Ft||(Ft={}));class Wn{static decode(e){const t=new Vo(e),n=new G,s=new G,c=new Array;let d=Ft.ASCII_ENCODE;do if(d===Ft.ASCII_ENCODE)d=this.decodeAsciiSegment(t,n,s);else{switch(d){case Ft.C40_ENCODE:this.decodeC40Segment(t,n);break;case Ft.TEXT_ENCODE:this.decodeTextSegment(t,n);break;case Ft.ANSIX12_ENCODE:this.decodeAnsiX12Segment(t,n);break;case Ft.EDIFACT_ENCODE:this.decodeEdifactSegment(t,n);break;case Ft.BASE256_ENCODE:this.decodeBase256Segment(t,n,c);break;default:throw new V}d=Ft.ASCII_ENCODE}while(d!==Ft.PAD_ENCODE&&t.available()>0);return s.length()>0&&n.append(s.toString()),new Qe(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)),Ft.ASCII_ENCODE;if(c===129)return Ft.PAD_ENCODE;if(c<=229){const d=c-130;d<10&&t.append("0"),t.append(""+d)}else switch(c){case 230:return Ft.C40_ENCODE;case 231:return Ft.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 Ft.ANSIX12_ENCODE;case 239:return Ft.TEXT_ENCODE;case 240:return Ft.EDIFACT_ENCODE;case 241:break;default:if(c!==254||e.available()!==0)throw new V;break}}while(e.available()>0);return Ft.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 Be("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}}Wn.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"],Wn.C40_SHIFT2_SET_CHARS=["!",'"',"#","$","%","&","'","(",")","*","+",",","-",".","/",":",";","<","=",">","?","@","[","\\","]","^","_"],Wn.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"],Wn.TEXT_SHIFT2_SET_CHARS=Wn.C40_SHIFT2_SET_CHARS,Wn.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 Hg{constructor(){this.rsDecoder=new Ke(De.DATA_MATRIX_FIELD_256)}decode(e){const t=new Lo(e),n=t.getVersion(),s=t.readCodewords(),c=Fo.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 Wn.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 Mt{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=Mt.sampleGrid(this.image,n,s,c,d,h,g);return new Sr(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=Mt.shiftPoint(n,s,(d+1)*4),g=Mt.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=Mt.shiftPoint(t,n,(h+1)*4),w=Mt.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=Mt.shiftPoint(t,n,h*4),w=Mt.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=Mt.moveAway(t,E,A),n=Mt.moveAway(n,E,A),s=Mt.moveAway(s,E,A),c=Mt.moveAway(c,E,A);let S,O;return g=Mt.shiftPoint(t,n,h*4),g=Mt.shiftPoint(g,c,d*4),S=Mt.shiftPoint(n,t,h*4),S=Mt.shiftPoint(S,s,d*4),w=Mt.shiftPoint(s,c,h*4),w=Mt.shiftPoint(w,n,d*4),O=Mt.shiftPoint(c,s,h*4),O=Mt.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 Pt.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 H=n;n=s,s=H,H=c,c=d,d=H}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 H=n,Y=s;H!==c;H+=S){let ie=this.image.get(h?Y:H,h?H:Y);if(ie!==U&&(O++,U=ie),E+=w,E>0){if(Y===d)break;Y+=A,E-=g}}return O}}class Xn{constructor(){this.decoder=new Hg}decode(e,t=null){let n,s;if(t!=null&&t.has(Z.PURE_BARCODE)){const w=Xn.extractPureBits(e.getBlackMatrix());n=this.decoder.decode(w),s=Xn.NO_POINTS}else{const w=new Mt(e.getBlackMatrix()).detect();n=this.decoder.decode(w.getBits()),s=w.getPoints()}const c=n.getRawBytes(),d=new _e(n.getText(),c,8*c.length,s,he.DATA_MATRIX,v.currentTimeMillis()),h=n.getByteSegments();h!=null&&d.putMetadata(ye.BYTE_SEGMENTS,h);const g=n.getECLevel();return g!=null&&d.putMetadata(ye.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 H=0;H<w;H++)e.get(h+H*s,U)&&S.set(H,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}}Xn.NO_POINTS=[];class Gg extends xe{constructor(e=500){super(new Xn,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 pt{constructor(e,t,n){this.value=e,this.stringValue=t,this.bits=n,pt.FOR_BITS.set(n,this),pt.FOR_VALUE.set(e,this)}getValue(){return this.value}getBits(){return this.bits}static fromString(e){switch(e){case"L":return pt.L;case"M":return pt.M;case"Q":return pt.Q;case"H":return pt.H;default:throw new C(e+"not available")}}toString(){return this.stringValue}equals(e){if(!(e instanceof pt))return!1;const t=e;return this.value===t.value}static forBits(e){if(e<0||e>=pt.FOR_BITS.size)throw new y;return pt.FOR_BITS.get(e)}}pt.FOR_BITS=new Map,pt.FOR_VALUE=new Map,pt.L=new pt(kr.L,"L",1),pt.M=new pt(kr.M,"M",0),pt.Q=new pt(kr.Q,"Q",3),pt.H=new pt(kr.H,"H",2);class Yt{constructor(e){this.errorCorrectionLevel=pt.forBits(e>>3&3),this.dataMask=e&7}static numBitsDiffering(e,t){return M.bitCount(e^t)}static decodeFormatInformation(e,t){const n=Yt.doDecodeFormatInformation(e,t);return n!==null?n:Yt.doDecodeFormatInformation(e^Yt.FORMAT_INFO_MASK_QR,t^Yt.FORMAT_INFO_MASK_QR)}static doDecodeFormatInformation(e,t){let n=Number.MAX_SAFE_INTEGER,s=0;for(const c of Yt.FORMAT_INFO_DECODE_LOOKUP){const d=c[0];if(d===e||d===t)return new Yt(c[1]);let h=Yt.numBitsDiffering(e,d);h<n&&(s=c[1],n=h),e!==t&&(h=Yt.numBitsDiffering(t,d),h<n&&(s=c[1],n=h))}return n<=3?new Yt(s):null}getErrorCorrectionLevel(){return this.errorCorrectionLevel}getDataMask(){return this.dataMask}hashCode(){return this.errorCorrectionLevel.getBits()<<3|this.dataMask}equals(e){if(!(e instanceof Yt))return!1;const t=e;return this.errorCorrectionLevel===t.errorCorrectionLevel&&this.dataMask===t.dataMask}}Yt.FORMAT_INFO_MASK_QR=21522,Yt.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 Ie{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 Ie.VERSIONS[e-1]}static decodeVersionInformation(e){let t=Number.MAX_SAFE_INTEGER,n=0;for(let s=0;s<Ie.VERSION_DECODE_INFO.length;s++){const c=Ie.VERSION_DECODE_INFO[s];if(c===e)return Ie.getVersionForNumber(s+7);const d=Yt.numBitsDiffering(e,c);d<t&&(n=s+7,t=d)}return t<=3?Ie.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}}Ie.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]),Ie.VERSIONS=[new Ie(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 Ie(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 Ie(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 Ie(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 Ie(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 Ie(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 Ie(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 Ie(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 Ie(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 Ie(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 Ie(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 Ie(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 Ie(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 Ie(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 Ie(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 Ie(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 Ie(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 Ie(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 Ie(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 Ie(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 Ie(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 Ie(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 Ie(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 Ie(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 Ie(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 Ie(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 Ie(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 Ie(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 Ie(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 Ie(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 Ie(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 Ie(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 Ie(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 Ie(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 Ie(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 Ie(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 Ie(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 Ie(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 Ie(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 Ie(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 Gt;(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"})(Gt||(Gt={}));class pn{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)}}pn.values=new Map([[Gt.DATA_MASK_000,new pn(Gt.DATA_MASK_000,(b,e)=>(b+e&1)===0)],[Gt.DATA_MASK_001,new pn(Gt.DATA_MASK_001,(b,e)=>(b&1)===0)],[Gt.DATA_MASK_010,new pn(Gt.DATA_MASK_010,(b,e)=>e%3===0)],[Gt.DATA_MASK_011,new pn(Gt.DATA_MASK_011,(b,e)=>(b+e)%3===0)],[Gt.DATA_MASK_100,new pn(Gt.DATA_MASK_100,(b,e)=>(Math.floor(b/2)+Math.floor(e/3)&1)===0)],[Gt.DATA_MASK_101,new pn(Gt.DATA_MASK_101,(b,e)=>b*e%6===0)],[Gt.DATA_MASK_110,new pn(Gt.DATA_MASK_110,(b,e)=>b*e%6<3)],[Gt.DATA_MASK_111,new pn(Gt.DATA_MASK_111,(b,e)=>(b+e+b*e%3&1)===0)]]);class Wg{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=Yt.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 Ie.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=Ie.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=Ie.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=pn.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=pn.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 Uo{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 H=0;H<U.getCount();H++){const Y=U.getDataCodewords(),ie=s.getECCodewordsPerBlock()+Y;h[g++]=new Uo(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 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 O=h[0].codewords.length;for(let U=A;U<O;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 xn;(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"})(xn||(xn={}));class Te{constructor(e,t,n,s){this.value=e,this.stringValue=t,this.characterCountBitsForVersions=n,this.bits=s,Te.FOR_BITS.set(s,this),Te.FOR_VALUE.set(e,this)}static forBits(e){const t=Te.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 Te))return!1;const t=e;return this.value===t.value}toString(){return this.stringValue}}Te.FOR_BITS=new Map,Te.FOR_VALUE=new Map,Te.TERMINATOR=new Te(xn.TERMINATOR,"TERMINATOR",Int32Array.from([0,0,0]),0),Te.NUMERIC=new Te(xn.NUMERIC,"NUMERIC",Int32Array.from([10,12,14]),1),Te.ALPHANUMERIC=new Te(xn.ALPHANUMERIC,"ALPHANUMERIC",Int32Array.from([9,11,13]),2),Te.STRUCTURED_APPEND=new Te(xn.STRUCTURED_APPEND,"STRUCTURED_APPEND",Int32Array.from([0,0,0]),3),Te.BYTE=new Te(xn.BYTE,"BYTE",Int32Array.from([8,16,16]),4),Te.ECI=new Te(xn.ECI,"ECI",Int32Array.from([0,0,0]),7),Te.KANJI=new Te(xn.KANJI,"KANJI",Int32Array.from([8,10,12]),8),Te.FNC1_FIRST_POSITION=new Te(xn.FNC1_FIRST_POSITION,"FNC1_FIRST_POSITION",Int32Array.from([0,0,0]),5),Te.FNC1_SECOND_POSITION=new Te(xn.FNC1_SECOND_POSITION,"FNC1_SECOND_POSITION",Int32Array.from([0,0,0]),9),Te.HANZI=new Te(xn.HANZI,"HANZI",Int32Array.from([8,10,12]),13);class St{static decode(e,t,n,s){const c=new Vo(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=Te.TERMINATOR;else{const O=c.readBits(4);S=Te.forBits(O)}switch(S){case Te.TERMINATOR:break;case Te.FNC1_FIRST_POSITION:case Te.FNC1_SECOND_POSITION:A=!0;break;case Te.STRUCTURED_APPEND:if(c.available()<16)throw new V;g=c.readBits(8),w=c.readBits(8);break;case Te.ECI:const O=St.parseECIValue(c);if(E=F.getCharacterSetECIByValue(O),E===null)throw new V;break;case Te.HANZI:const U=c.readBits(4),H=c.readBits(S.getCharacterCountBits(t));U===St.GB2312_SUBSET&&St.decodeHanziSegment(c,d,H);break;default:const Y=c.readBits(S.getCharacterCountBits(t));switch(S){case Te.NUMERIC:St.decodeNumericSegment(c,d,Y);break;case Te.ALPHANUMERIC:St.decodeAlphanumericSegment(c,d,Y,A);break;case Te.BYTE:St.decodeByteSegment(c,d,Y,E,h,s);break;case Te.KANJI:St.decodeKanjiSegment(c,d,Y);break;default:throw new V}break}}while(S!==Te.TERMINATOR)}catch{throw new V}return new Qe(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>=St.ALPHANUMERIC_CHARS.length)throw new V;return St.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(St.toAlphaNumericChar(Math.floor(d/45))),t.append(St.toAlphaNumericChar(d%45)),n-=2}if(n===1){if(e.available()<6)throw new V;t.append(St.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(St.toAlphaNumericChar(Math.floor(s/100))),t.append(St.toAlphaNumericChar(Math.floor(s/10)%10)),t.append(St.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(St.toAlphaNumericChar(Math.floor(s/10))),t.append(St.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(St.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}}St.ALPHANUMERIC_CHARS="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:",St.GB2312_SUBSET=1;class Za{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 Xg{constructor(){this.rsDecoder=new Ke(De.QR_CODE_FIELD_256)}decodeBooleanArray(e,t){return this.decodeBitMatrix(W.parseFromBooleanArray(e),t)}decodeBitMatrix(e,t){const n=new Wg(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 Za(!0)),c}catch(c){throw s!==null?s:c}}decodeBitMatrixParser(e,t){const n=e.readVersion(),s=e.readFormatInformation().getErrorCorrectionLevel(),c=e.readCodewords(),d=Uo.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 St.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 zo 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 zo(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 zo(c,d,h);this.possibleCenters.push(g),this.resultPointCallback!==null&&this.resultPointCallback!==void 0&&this.resultPointCallback.foundPossibleResultPoint(g)}return null}}class Ho 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 Ho(c,d,h,s)}}class $g{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 Wt{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*Wt.MAX_MODULES));(h<Wt.MIN_SKIP||t)&&(h=Wt.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(Wt.foundPatternCross(w)){if(this.handlePossibleCenter(w,A,O,n)===!0)if(h=2,this.hasSkipped===!0)g=this.haveMultiplyConfirmedCenters();else{const H=this.findRowSkip();H>w[2]&&(A+=H-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]++;Wt.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 $g(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&&Wt.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:Wt.foundPatternCross(h)?Wt.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:Wt.foundPatternCross(h)?Wt.centerFromEnd(h,g):NaN}handlePossibleCenter(e,t,n,s){const c=e[0]+e[1]+e[2]+e[3]+e[4];let d=Wt.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 Ho(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()>=Wt.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()>=Wt.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]]}}Wt.CENTER_QUORUM=2,Wt.MIN_SKIP=3,Wt.MAX_MODULES=57;class Yr{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 Wt(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=Yr.computeDimension(t,n,s,c),h=Ie.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(),H=1-3/g,Y=Math.floor(t.getX()+H*(O-t.getX())),ie=Math.floor(t.getY()+H*(U-t.getY()));for(let ue=4;ue<=16;ue<<=1)try{w=this.findAlignmentInRegion(c,Y,ie,ue);break}catch(me){if(!(me instanceof N))throw me}}const E=Yr.createTransform(t,n,s,w,d),A=Yr.sampleGrid(this.image,E,d);let S;return w===null?S=[s,t,n]:S=[s,t,n,w],new Sr(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),nn.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 Pt.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 H=c?U:O,Y=c?O:U;if(A===1===this.image.get(H,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 $n{constructor(){this.decoder=new Xg}getDecoder(){return this.decoder}decode(e,t){let n,s;if(t!=null&&t.get(Z.PURE_BARCODE)!==void 0){const g=$n.extractPureBits(e.getBlackMatrix());n=this.decoder.decodeBitMatrix(g,t),s=$n.NO_POINTS}else{const g=new Yr(e.getBlackMatrix()).detect(t);n=this.decoder.decodeBitMatrix(g.getBits(),t),s=g.getPoints()}n.getOther()instanceof Za&&n.getOther().applyMirroredCorrection(s);const c=new _e(n.getText(),n.getRawBytes(),void 0,s,he.QR_CODE,void 0),d=n.getByteSegments();d!==null&&c.putMetadata(ye.BYTE_SEGMENTS,d);const h=n.getECLevel();return h!==null&&c.putMetadata(ye.ERROR_CORRECTION_LEVEL,h),n.hasStructuredAppend()&&(c.putMetadata(ye.STRUCTURED_APPEND_SEQUENCE,n.getStructuredAppendSequenceNumber()),c.putMetadata(ye.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 H=0;H<E;H++){const Y=c+Math.floor(H*s);for(let ie=0;ie<w;ie++)e.get(h+Math.floor(ie*s),Y)&&U.set(ie,H)}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}}$n.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=D.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 jg{constructor(e,t){this.bits=e,this.points=t}getBits(){return this.bits}getPoints(){return this.points}}class ze{static detectMultiple(e,t,n){let s=e.getBlackMatrix(),c=ze.detect(n,s);return c.length||(s=s.clone(),s.rotate180(),c=ze.detect(n,s)),new jg(s,c)}static detect(e,t){const n=new Array;let s=0,c=0,d=!1;for(;s<t.getHeight();){const h=ze.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+=ze.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 ze.copyToResult(d,ze.findRowsWithPattern(e,s,c,t,n,ze.START_PATTERN),ze.INDEXES_START_PATTERN),d[4]!=null&&(n=Math.trunc(d[4].getX()),t=Math.trunc(d[4].getY())),ze.copyToResult(d,ze.findRowsWithPattern(e,s,c,t,n,ze.STOP_PATTERN),ze.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+=ze.ROW_STEP){let A=ze.findGuardPattern(e,c,s,n,!1,d,w);if(A!=null){for(;s>0;){const S=ze.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=ze.findGuardPattern(e,S[0],E,n,!1,d,w);if(O!=null&&Math.abs(S[0]-O[0])<ze.MAX_PATTERN_DRIFT&&Math.abs(S[1]-O[1])<ze.MAX_PATTERN_DRIFT)S=O,A=0;else{if(A>ze.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<ze.BARCODE_MIN_HEIGHT&&D.fill(h,null),h}static findGuardPattern(e,t,n,s,c,d,h){D.fillWithin(h,0,h.length,0);let g=t,w=0;for(;e.get(g,n)&&g>0&&w++<ze.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(ze.patternMatchVariance(h,d,ze.MAX_INDIVIDUAL_VARIANCE)<ze.MAX_AVG_VARIANCE)return new Int32Array([g,E]);g+=h[0]+h[1],v.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&&ze.patternMatchVariance(h,d,ze.MAX_INDIVIDUAL_VARIANCE)<ze.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}}ze.INDEXES_START_PATTERN=Int32Array.from([0,4,1,5]),ze.INDEXES_STOP_PATTERN=Int32Array.from([6,2,7,3]),ze.MAX_AVG_VARIANCE=.42,ze.MAX_INDIVIDUAL_VARIANCE=.8,ze.START_PATTERN=Int32Array.from([8,1,1,1,1,1,1,3]),ze.STOP_PATTERN=Int32Array.from([7,1,1,3,1,1,1,2,1]),ze.MAX_PIXEL_DRIFT=3,ze.MAX_PATTERN_DRIFT=5,ze.SKIPPED_ROW_COUNT_MAX=25,ze.ROW_STEP=5,ze.BARCODE_MIN_HEIGHT=10;class Xt{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),v.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;v.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 Xt(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 Xt?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 Xt(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 Xt(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 Xt(this.field,t)}multiplyScalar(e){if(e===0)return new Xt(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 Xt(this.field,n)}multiplyByMonomial(e,t){if(e<0)throw new y;if(t===0)return new Xt(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 Xt(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 qg{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 _t;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 Go extends qg{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 Xt(this,new Int32Array([0])),this.one=new Xt(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 Xt(this,n)}}Go.PDF417_GF=new Go(Me.NUMBER_OF_CODEWORDS,3);class Ya{constructor(){this.field=Go.PDF417_GF}decode(e,t,n){let s=new Xt(this.field,e),c=new Int32Array(t),d=!1;for(let U=t;U>0;U--){let H=s.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 Xt(this.field,new Int32Array([this.field.subtract(0,H),1]));h=h.multiply(Y)}let g=new Xt(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 H=e.length-1-this.field.log(S[U]);if(H<0)throw B.getChecksumInstance();e[H]=this.field.subtract(e[H],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(),H=s.getCoefficient(s.getDegree()),Y=this.field.inverse(H);for(;c.getDegree()>=s.getDegree()&&!c.isZero();){let ie=c.getDegree()-s.getDegree(),ue=this.field.multiply(c.getCoefficient(c.getDegree()),Y);U=U.add(this.field.buildMonomial(ie,ue)),c=c.subtract(s.multiplyByMonomial(ie,ue))}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 Xt(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,s,c){e instanceof cr?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 cr(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 cr(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 Zg{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 Kr{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),H=g&&g[0]+""=="0"?"0":" ";for(;O.length<U;)O=h!==void 0?O+H:H+O;return O}let c=/%(-)?(0?[0-9]+)?([.][0-9]+)?([#][0-9]+)?([scfpexd%])/g;return e.replace(c,s)}format(e,...t){this.buffer+=Kr.form(e,t)}toString(){return this.buffer}}class Qr{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<Qr.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 Kr;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()}}Qr.MAX_NEARBY_DISTANCE=5;class Jr{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 Ka extends Qr{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 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 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 Jr,n=new Jr,s=new Jr,c=new Jr;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 Zg(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 ei{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=ei.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=ei.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(ei.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 Kr;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 ti{constructor(e,t,n,s){this.rowNumber=ti.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!==ti.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}}ti.BARCODE_ROW_UNKNOWN=-1;class on{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,on.RATIOS_TABLE[e]||(on.RATIOS_TABLE[e]=new Array(Me.BARS_IN_MODULE)),on.RATIOS_TABLE[e][Me.BARS_IN_MODULE-s-1]=Math.fround(c/Me.MODULES_IN_CODEWORD)}}this.bSymbolTableReady=!0}static getDecodedValue(e){let t=on.getDecodedCodewordValue(on.sampleBitCounts(e));return t!==-1?t:on.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=on.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=Ar.MAX_VALUE,c=-1;this.bSymbolTableReady||on.initialize();for(let d=0;d<on.RATIOS_TABLE.length;d++){let h=0,g=on.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}}on.bSymbolTableReady=!1,on.RATIOS_TABLE=new Array(Me.SYMBOL_TABLE.length).map(b=>new Array(Me.BARS_IN_MODULE));class Qa{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 Ja{static parseLong(e,t=void 0){return parseInt(e,t)}}class el extends x{}el.kind="NullPointerException";class Yg{writeBytes(e){this.writeBytesOffset(e,0,e.length)}writeBytesOffset(e,t,n){if(e==null)throw new el;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 Kg extends x{}class Qg extends Yg{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 Kg;n=M.MAX_VALUE}this.buf=D.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),v.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 D.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 ut;(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"})(ut||(ut={}));function tl(){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 jn(b){if(typeof vi>"u"&&(vi=tl()),vi===null)throw new Error("BigInt is not supported!");return vi(b)}function Jg(){let b=[];b[0]=jn(1);let e=jn(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 Qa;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 Qe(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(M.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(M.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(Ja.parseLong(A.toString()));break;case ne.MACRO_PDF417_OPTIONAL_FIELD_CHECKSUM:let S=new G;t=ne.numericCompaction(e,t+1,S),n.setChecksum(M.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(Ja.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(D.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=ut.ALPHA,d=ut.ALPHA,h=0;for(;h<n;){let g=e[h],w="";switch(c){case ut.ALPHA:if(g<26)w=String.fromCharCode(65+g);else switch(g){case 26:w=" ";break;case ne.LL:c=ut.LOWER;break;case ne.ML:c=ut.MIXED;break;case ne.PS:d=c,c=ut.PUNCT_SHIFT;break;case ne.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:s.append(t[h]);break;case ne.TEXT_COMPACTION_MODE_LATCH:c=ut.ALPHA;break}break;case ut.LOWER:if(g<26)w=String.fromCharCode(97+g);else switch(g){case 26:w=" ";break;case ne.AS:d=c,c=ut.ALPHA_SHIFT;break;case ne.ML:c=ut.MIXED;break;case ne.PS:d=c,c=ut.PUNCT_SHIFT;break;case ne.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:s.append(t[h]);break;case ne.TEXT_COMPACTION_MODE_LATCH:c=ut.ALPHA;break}break;case ut.MIXED:if(g<ne.PL)w=ne.MIXED_CHARS[g];else switch(g){case ne.PL:c=ut.PUNCT;break;case 26:w=" ";break;case ne.LL:c=ut.LOWER;break;case ne.AL:c=ut.ALPHA;break;case ne.PS:d=c,c=ut.PUNCT_SHIFT;break;case ne.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:s.append(t[h]);break;case ne.TEXT_COMPACTION_MODE_LATCH:c=ut.ALPHA;break}break;case ut.PUNCT:if(g<ne.PAL)w=ne.PUNCT_CHARS[g];else switch(g){case ne.PAL:c=ut.ALPHA;break;case ne.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:s.append(t[h]);break;case ne.TEXT_COMPACTION_MODE_LATCH:c=ut.ALPHA;break}break;case ut.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=ut.ALPHA;break}break;case ut.PUNCT_SHIFT:if(c=d,g<ne.PAL)w=ne.PUNCT_CHARS[g];else switch(g){case ne.PAL:c=ut.ALPHA;break;case ne.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:s.append(t[h]);break;case ne.TEXT_COMPACTION_MODE_LATCH:c=ut.ALPHA;break}break}w!==""&&s.append(w),h++}}static byteCompaction(e,t,n,s,c){let d=new Qg,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(jn(g)>>jn(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(jn(g)>>jn(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=jn(0);for(let c=0;c<t;c++)n+=ne.EXP900[t-c-1]*jn(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=tl()?Jg():[],ne.NUMBER_OF_SEQUENCE_CODEWORDS=2;class We{constructor(){}static decode(e,t,n,s,c,d,h){let g=new cr(e,t,n,s,c),w=null,E=null,A;for(let U=!0;;U=!1){if(t!=null&&(w=We.getRowIndicatorColumn(e,g,t,!0,d,h)),s!=null&&(E=We.getRowIndicatorColumn(e,g,s,!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 O=w!=null;for(let U=1;U<=S;U++){let H=O?U:S-U;if(A.getDetectionResultColumn(H)!==void 0)continue;let Y;H===0||H===S?Y=new Ka(g,H===0):Y=new Qr(g),A.setDetectionResultColumn(H,Y);let ie=-1,ue=ie;for(let me=g.getMinY();me<=g.getMaxY();me++){if(ie=We.getStartColumn(A,H,me,O),ie<0||ie>g.getMaxX()){if(ue===-1)continue;ie=ue}let de=We.detectCodeword(e,g.getMinX(),g.getMaxX(),O,ie,me,d,h);de!=null&&(Y.setCodeword(me,de),ue=ie,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 s=cr.merge(We.adjustBoundingBox(e),We.adjustBoundingBox(t));return new ei(n,s)}static adjustBoundingBox(e){if(e==null)return null;let t=e.getRowHeights();if(t==null)return null;let n=We.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 Ka(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=We.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()-We.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=We.createBarcodeMatrix(e);We.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 We.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 We.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 Jr;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(We.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(We.isValidBarcodeColumn(e,t-c)&&(d=e.getDetectionResultColumn(t-c).getCodewordNearby(n)),d!=null)return s?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(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=We.adjustCodewordStartColumn(e,t,n,s,c,d);let w=We.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 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=on.getDecodedValue(w),O=Me.getCodeword(S);return O===-1?null:new ti(c,E,We.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)>We.CODEWORD_SKEW_SIZE)return c;h+=g}g=-g,s=!s}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 V.getFormatInstance();let s=1<<t+1,c=We.correctErrors(e,n,s);We.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+We.MAX_ERRORS||n<0||n>We.MAX_EC_CODEWORDS)throw B.getChecksumInstance();return We.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 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 Kr;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()}}We.CODEWORD_SKEW_SIZE=2,We.MAX_ERRORS=3,We.MAX_EC_CODEWORDS=512,We.errorCorrection=new Ya;class $t{decode(e,t=null){let n=$t.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 $t.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=ze.detectMultiple(e,t,n);for(const d of c.getPoints()){const h=We.decode(c.getBits(),d[4],d[5],d[6],d[7],$t.getMinCodewordWidth(d),$t.getMaxCodewordWidth(d)),g=new _e(h.getText(),h.getRawBytes(),void 0,d,he.PDF_417);g.putMetadata(ye.ERROR_CORRECTION_LEVEL,h.getECLevel());const w=h.getOther();w!=null&&g.putMetadata(ye.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?M.MAX_VALUE:Math.trunc(Math.abs(e.getX()-t.getX()))}static getMaxCodewordWidth(e){return Math.floor(Math.max(Math.max($t.getMaxWidth(e[0],e[4]),$t.getMaxWidth(e[6],e[2])*Me.MODULES_IN_CODEWORD/Me.MODULES_IN_STOP_PATTERN),Math.max($t.getMaxWidth(e[1],e[5]),$t.getMaxWidth(e[7],e[3])*Me.MODULES_IN_CODEWORD/Me.MODULES_IN_STOP_PATTERN)))}static getMinCodewordWidth(e){return Math.floor(Math.min(Math.min($t.getMinWidth(e[0],e[4]),$t.getMinWidth(e[6],e[2])*Me.MODULES_IN_CODEWORD/Me.MODULES_IN_STOP_PATTERN),Math.min($t.getMinWidth(e[1],e[5]),$t.getMinWidth(e[7],e[3])*Me.MODULES_IN_CODEWORD/Me.MODULES_IN_STOP_PATTERN)))}reset(){}}class Pi extends x{}Pi.kind="ReaderException";class nl{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===he.UPC_A||d===he.UPC_E||d===he.EAN_13||d===he.EAN_8||d===he.CODABAR||d===he.CODE_39||d===he.CODE_93||d===he.CODE_128||d===he.ITF||d===he.RSS_14||d===he.RSS_EXPANDED);c&&!t&&s.push(new Tr(e,this.verbose)),n.includes(he.QR_CODE)&&s.push(new $n),n.includes(he.DATA_MATRIX)&&s.push(new Xn),n.includes(he.AZTEC)&&s.push(new Ir),n.includes(he.PDF_417)&&s.push(new $t),c&&t&&s.push(new Tr(e,this.verbose))}s.length===0&&(t||s.push(new Tr(e,this.verbose)),s.push(new $n),s.push(new Xn),s.push(new Ir),s.push(new $t),t&&s.push(new Tr(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 ep extends xe{constructor(e=null,t=500){const n=new nl;n.setHints(e),super(n,t)}decodeBitmap(e){return this.reader.decodeWithState(e)}}class tp extends xe{constructor(e=500){super(new $t,e)}}class np extends xe{constructor(e=500){super(new $n,e)}}var Wo;(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"})(Wo||(Wo={}));var Vt=Wo;class Xo{constructor(e){this.field=e,this.cachedGenerators=[],this.cachedGenerators.push(new tt(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 tt(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);v.arraycopy(e,0,c,0,n);let d=new tt(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;v.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(),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 Rt.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&&(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 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)*Rt.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+=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 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)D.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
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(`<<
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(`
@@ -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 ft extends x{}ft.kind="WriterException";class Re{constructor(){}static clearMatrix(e){e.clear(255)}static buildMatrix(e,t,n,s,c){Re.clearMatrix(c),Re.embedBasicPatterns(n,c),Re.embedTypeInfo(t,s,c),Re.maybeEmbedVersionInfo(n,c),Re.embedDataBits(e,s,c)}static embedBasicPatterns(e,t){Re.embedPositionDetectionPatternsAndSeparators(t),Re.embedDarkDotAtLeftBottomCorner(t),Re.maybeEmbedPositionAdjustmentPatterns(e,t),Re.embedTimingPatterns(t)}static embedTypeInfo(e,t,n){const s=new j;Re.makeTypeInfoBits(e,t,s);for(let c=0,d=s.getSize();c<d;++c){const h=s.get(s.getSize()-1-c),g=Re.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;Re.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(!Re.isEmpty(n.get(w,h)))continue;let E;s<e.getSize()?(E=e.get(s),++s):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(s!==e.getSize())throw new ft("Not all bits consumed: "+s+"/"+e.getSize())}static findMSBSet(e){return 32-M.numberOfLeadingZeros(e)}static calculateBCHCode(e,t){if(t===0)throw new y("0 polynomial");const n=Re.findMSBSet(t);for(e<<=n-1;Re.findMSBSet(e)>=n;)e^=t<<Re.findMSBSet(e)-n;return e}static makeTypeInfoBits(e,t,n){if(!dr.isValidMaskPattern(t))throw new ft("Invalid mask pattern");const s=e.getBits()<<3|t;n.appendBits(s,5);const c=Re.calculateBCHCode(s,Re.TYPE_INFO_POLY);n.appendBits(c,10);const d=new j;if(d.appendBits(Re.TYPE_INFO_MASK_PATTERN,15),n.xor(d),n.getSize()!==15)throw new ft("should not happen but we got: "+n.getSize())}static makeVersionInfoBits(e,t){t.appendBits(e.getVersionNumber(),6);const n=Re.calculateBCHCode(e.getVersionNumber(),Re.VERSION_INFO_POLY);if(t.appendBits(n,12),t.getSize()!==18)throw new ft("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;Re.isEmpty(e.get(t,6))&&e.setNumber(t,6,n),Re.isEmpty(e.get(6,t))&&e.setNumber(6,t,n)}}static embedDarkDotAtLeftBottomCorner(e){if(e.get(8,e.getHeight()-8)===0)throw new ft;e.setNumber(8,e.getHeight()-8,1)}static embedHorizontalSeparationPattern(e,t,n){for(let s=0;s<8;++s){if(!Re.isEmpty(n.get(e+s,t)))throw new ft;n.setNumber(e+s,t,0)}}static embedVerticalSeparationPattern(e,t,n){for(let s=0;s<7;++s){if(!Re.isEmpty(n.get(e,t+s)))throw new ft;n.setNumber(e,t+s,0)}}static embedPositionAdjustmentPattern(e,t,n){for(let s=0;s<5;++s){const c=Re.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=Re.POSITION_DETECTION_PATTERN[s];for(let d=0;d<7;++d)n.setNumber(e+d,t+s,c[d])}}static embedPositionDetectionPatternsAndSeparators(e){const t=Re.POSITION_DETECTION_PATTERN[0].length;Re.embedPositionDetectionPattern(0,0,e),Re.embedPositionDetectionPattern(e.getWidth()-t,0,e),Re.embedPositionDetectionPattern(0,e.getWidth()-t,e);const n=8;Re.embedHorizontalSeparationPattern(0,n-1,e),Re.embedHorizontalSeparationPattern(e.getWidth()-n,n-1,e),Re.embedHorizontalSeparationPattern(0,e.getWidth()-n,e);const s=7;Re.embedVerticalSeparationPattern(s,0,e),Re.embedVerticalSeparationPattern(e.getHeight()-s-1,0,e),Re.embedVerticalSeparationPattern(s,e.getHeight()-s,e)}static maybeEmbedPositionAdjustmentPatterns(e,t){if(e.getVersionNumber()<2)return;const n=e.getVersionNumber()-1,s=Re.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&&Re.isEmpty(t.get(w,h))&&Re.embedPositionAdjustmentPattern(w-2,h-2,t)}}}}Re.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])]),Re.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])]),Re.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])]),Re.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])]),Re.VERSION_INFO_POLY=7973,Re.TYPE_INFO_POLY=1335,Re.TYPE_INFO_MASK_PATTERN=21522;class ep{constructor(e,t){this.dataBytes=e,this.errorCorrectionBytes=t}getDataBytes(){return this.dataBytes}getErrorCorrectionBytes(){return this.errorCorrectionBytes}}class Et{constructor(){}static calculateMaskPenalty(e){return Rt.applyMaskPenaltyRule1(e)+Rt.applyMaskPenaltyRule2(e)+Rt.applyMaskPenaltyRule3(e)+Rt.applyMaskPenaltyRule4(e)}static encode(e,t,n=null){let s=Et.DEFAULT_BYTE_MODE_ENCODING;const c=n!==null&&n.get(Vt.CHARACTER_SET)!==void 0;c&&(s=n.get(Vt.CHARACTER_SET).toString());const d=this.chooseMode(e,s),h=new j;if(d===Te.BYTE&&(c||Et.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(Vt.QR_VERSION)!==void 0){const me=Number.parseInt(n.get(Vt.QR_VERSION).toString(),10);w=Ie.getVersionForNumber(me);const de=this.calculateBitsNeeded(d,h,g,w);if(!this.willFit(de,w,t))throw new ft("Data too big for requested version")}else w=this.recommendVersion(t,d,h,g);const E=new j;E.appendBitArray(h);const A=d===Te.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 dr;z.setECLevel(t),z.setMode(d),z.setVersion(w);const Y=w.getDimensionForVersion(),ie=new Li(Y,Y),ue=this.chooseMaskPattern(U,t,w,ie);return z.setMaskPattern(ue),Re.buildMatrix(U,t,w,ue,ie),z.setMatrix(ie),z}static recommendVersion(e,t,n,s){const c=this.calculateBitsNeeded(t,n,s,Ie.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<Et.ALPHANUMERIC_TABLE.length?Et.ALPHANUMERIC_TABLE[e]:-1}static chooseMode(e,t=null){if(F.SJIS.getName()===t&&this.isOnlyDoubleByteKanji(e))return Te.KANJI;let n=!1,s=!1;for(let c=0,d=e.length;c<d;++c){const h=e.charAt(c);if(Et.isDigit(h))n=!0;else if(this.getAlphanumericCode(h.charCodeAt(0))!==-1)s=!0;else return Te.BYTE}return s?Te.ALPHANUMERIC:n?Te.NUMERIC:Te.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<dr.NUM_MASK_PATTERNS;h++){Re.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=Ie.getVersionForNumber(n);if(Et.willFit(e,s,t))return s}throw new ft("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 ft("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 ft("Bits size does not equal capacity")}static getNumDataBytesAndNumECBytesForBlockID(e,t,n,s,c,d){if(s>=n)throw new ft("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 ft("EC bytes mismatch");if(n!==g+h)throw new ft("RS blocks mismatch");if(e!==(A+O)*g+(S+U)*h)throw new ft("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 ft("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);Et.getNumDataBytesAndNumECBytesForBlockID(t,n,s,E,A,S);const O=A[0],U=new Uint8Array(O);e.toBytes(8*c,U,0,O);const z=Et.generateECBytes(U,S[0]);g.push(new ep(U,z)),d=Math.max(d,O),h=Math.max(h,z.length),c+=A[0]}if(n!==c)throw new ft("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 ft("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 Wo(De.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 ft(e+" is bigger than "+((1<<c)-1));s.appendBits(e,c)}static appendBytes(e,t,n,s){switch(t){case Te.NUMERIC:Et.appendNumericBytes(e,n);break;case Te.ALPHANUMERIC:Et.appendAlphanumericBytes(e,n);break;case Te.BYTE:Et.append8BitBytes(e,n,s);break;case Te.KANJI:Et.appendKanjiBytes(e,n);break;default:throw new ft("Invalid mode: "+t)}}static getDigit(e){return e.charCodeAt(0)-48}static isDigit(e){const t=Et.getDigit(e);return t>=0&&t<=9}static appendNumericBytes(e,t){const n=e.length;let s=0;for(;s<n;){const c=Et.getDigit(e.charAt(s));if(s+2<n){const d=Et.getDigit(e.charAt(s+1)),h=Et.getDigit(e.charAt(s+2));t.appendBits(c*100+d*10+h,10),s+=3}else if(s+1<n){const d=Et.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=Et.getAlphanumericCode(e.charCodeAt(s));if(c===-1)throw new ft;if(s+1<n){const d=Et.getAlphanumericCode(e.charCodeAt(s+1));if(d===-1)throw new ft;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 ft(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 ft(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 ft("Invalid byte sequence");const E=(w>>8)*192+(w&255);t.appendBits(E,13)}}static appendECI(e,t){t.appendBits(Te.ECI.getBits(),4),t.appendBits(e.getValue(),8)}}Et.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]),Et.DEFAULT_BYTE_MODE_ENCODING=F.UTF8.getName();class ur{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=gt.L,d=ur.QUIET_ZONE_SIZE;s!==null&&(s.get(Vt.ERROR_CORRECTION)!==void 0&&(c=gt.fromString(s.get(Vt.ERROR_CORRECTION).toString())),s.get(Vt.MARGIN)!==void 0&&(d=Number.parseInt(s.get(Vt.MARGIN).toString(),10)));const h=Et.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 Be;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 ue=0,me=O;ue<d;ue++,me+=S)if(c.get(ue,Y)===1){const de=this.createSvgRectElement(me,ie,S,S);z.appendChild(de)}return z}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,s){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",s.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,s,c){if(e.length===0)throw new y("Found empty contents");if(t!==he.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=gt.L,h=Rr.QUIET_ZONE_SIZE;c!==null&&(c.get(Vt.ERROR_CORRECTION)!==void 0&&(d=gt.fromString(c.get(Vt.ERROR_CORRECTION).toString())),c.get(Vt.MARGIN)!==void 0&&(h=Number.parseInt(c.get(Vt.MARGIN).toString(),10)));const g=Et.encode(e,d,c);return Rr.renderResult(g,n,s,h)}static renderResult(e,t,n,s){const c=e.getMatrix();if(c===null)throw new Be;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 ue=0,me=O;ue<d;ue++,me+=S)c.get(ue,Y)===1&&z.setRegion(me,ie,S,S);return z}}Rr.QUIET_ZONE_SIZE=4;class tp{encode(e,t,n,s,c){let d;switch(t){case he.QR_CODE:d=new Rr;break;default:throw new y("No encoder available for format "+t)}return d.encode(e,t,n,s,c)}}class On 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 v.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 v.arraycopy(this.yuvData,c,s,0,n),s;for(let d=0;d<t;d++){const h=d*e;v.arraycopy(this.yuvData,c,s,h,e),c+=this.dataWidth}return s}isCropSupported(){return!0}crop(e,t,n,s){return new On(this.yuvData,this.dataWidth,this.dataHeight,this.left+e,this.top+t,n,s,!1)}renderThumbnail(){const e=this.getWidth()/On.THUMBNAIL_SCALE_FACTOR,t=this.getHeight()/On.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*On.THUMBNAIL_SCALE_FACTOR]&255;n[h+g]=4278190080|w*65793}c+=this.dataWidth*On.THUMBNAIL_SCALE_FACTOR}return n}getThumbnailWidth(){return this.getWidth()/On.THUMBNAIL_SCALE_FACTOR}getThumbnailHeight(){return this.getHeight()/On.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)}}On.THUMBNAIL_SCALE_FACTOR=2;class Xo 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 v.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 v.arraycopy(this.luminances,c,s,0,n),s;for(let d=0;d<t;d++){const h=d*e;v.arraycopy(this.luminances,c,s,h,e),c+=this.dataWidth}return s}isCropSupported(){return!0}crop(e,t,n,s){return new Xo(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 $o{}$o.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 np{constructor(e){this.previous=e}getPrevious(){return this.previous}}class Br extends np{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,"<"+M.toBinaryString(e|1<<this.bitCount).substring(1)+">"}}class jo 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 jo(this,e,t)}toString(){return"<"+this.binaryShiftStart+"::"+(this.binaryShiftStart+this.binaryShiftByteCount-1)+">"}}function rp(b,e,t){return new jo(b,e,t)}function ni(b,e,t){return new Br(b,e,t)}const ip=["UPPER","LOWER","DIGIT","MIXED","PUNCT"],qn=0,Fi=1,_n=2,ol=3,Mn=4,op=new Br(null,0,0),qo=[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 sp(b){for(let e of b)D.fill(e,-1);return b[qn][Mn]=0,b[Fi][Mn]=0,b[Fi][qn]=28,b[ol][Mn]=0,b[_n][Mn]=0,b[_n][qn]=15,b}const sl=sp(D.createInt32Array(6,6));class Dn{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=qo[this.mode][e];s=ni(s,d&65535,d>>16),n+=d>>16}let c=e===_n?4:5;return s=ni(s,t,c),new Dn(s,e,0,n+c)}shiftAndAppend(e,t){let n=this.token,s=this.mode===_n?4:5;return n=ni(n,sl[this.mode][e],s),n=ni(n,t,5),new Dn(n,this.mode,0,this.bitCount+s+5)}addBinaryShiftChar(e){let t=this.token,n=this.mode,s=this.bitCount;if(this.mode===Mn||this.mode===_n){let h=qo[n][qn];t=ni(t,h&65535,h>>16),s+=h>>16,n=qn}let c=this.binaryShiftByteCount===0||this.binaryShiftByteCount===31?18:this.binaryShiftByteCount===62?9:8,d=new Dn(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=rp(t,e-this.binaryShiftByteCount,this.binaryShiftByteCount),new Dn(t,this.mode,0,this.bitCount)}isBetterThanOrEqualTo(e){let t=this.bitCount+(qo[this.mode][e.mode]>>16);return this.binaryShiftByteCount<e.binaryShiftByteCount?t+=Dn.calculateBinaryShiftCost(e)-Dn.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",ip[this.mode],this.bitCount,this.binaryShiftByteCount)}static calculateBinaryShiftCost(e){return e.binaryShiftByteCount>62?21:e.binaryShiftByteCount>31?20:e.binaryShiftByteCount>0?10:0}}Dn.INITIAL_STATE=new Dn(op,qn,0,0);function ap(b){const e=ee.getCharCode(" "),t=ee.getCharCode("."),n=ee.getCharCode(",");b[qn][e]=1;const s=ee.getCharCode("Z"),c=ee.getCharCode("A");for(let S=c;S<=s;S++)b[qn][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[_n][e]=1;const g=ee.getCharCode("9"),w=ee.getCharCode("0");for(let S=w;S<=g;S++)b[_n][S]=S-w+2;b[_n][n]=12,b[_n][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[Mn][ee.getCharCode(A[S])]=S);return b}const Zo=ap(D.createInt32Array(5,256));class ri{constructor(e){this.text=e}encode(){const e=ee.getCharCode(" "),t=ee.getCharCode(`
30
- `);let n=il.singletonList(Dn.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=ri.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 ri.simplifyStates(n)}updateStateForChar(e,t,n){let s=this.text[t]&255,c=Zo[e.getMode()][s]>0,d=null;for(let h=0;h<=Mn;h++){let g=Zo[h][s];if(g>0){if(d==null&&(d=e.endBinaryShift(t)),!c||h===e.getMode()||h===_n){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||Zo[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(Mn,n)),e.getMode()!==Mn&&s.push(c.shiftAndAppend(Mn,n)),n===3||n===4){let d=c.latchAndAppend(_n,16-n).latchAndAppend(_n,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 ri(e).encode(),c=M.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*M.truncDivision(M.truncDivision(z,2)-1,15);let de=M.truncDivision(z,2),je=M.truncDivision(ie,2);for(let Ve=0;Ve<de;Ve++){let sn=Ve+M.truncDivision(Ve,15);Y[de-Ve-1]=je-sn-1,Y[de+Ve]=je+sn+1}}let ue=new W(ie);for(let de=0,je=0;de<g;de++){let Ve=(g-de)*4+(h?9:12);for(let sn=0;sn<Ve;sn++){let In=sn*2;for(let an=0;an<2;an++)S.get(je+In+an)&&ue.set(Y[de*2+an],Y[de*2+sn]),S.get(je+Ve*2+In+an)&&ue.set(Y[de*2+sn],Y[z-1-de*2-an]),S.get(je+Ve*4+In+an)&&ue.set(Y[z-1-de*2-an],Y[z-1-de*2-sn]),S.get(je+Ve*6+In+an)&&ue.set(Y[z-1-de*2-sn],Y[de*2+an])}je+=Ve*8}if(Qe.drawModeMessage(ue,h,ie,U),h)Qe.drawBullsEye(ue,M.truncDivision(ie,2),5);else{Qe.drawBullsEye(ue,M.truncDivision(ie,2),7);for(let de=0,je=0;de<M.truncDivision(z,2)-1;de+=15,je+=16)for(let Ve=M.truncDivision(ie,2)&1;Ve<ie;Ve+=2)ue.set(M.truncDivision(ie,2)-je,Ve),ue.set(M.truncDivision(ie,2)+je,Ve),ue.set(Ve,M.truncDivision(ie,2)-je),ue.set(Ve,M.truncDivision(ie,2)+je)}let me=new rl;return me.setCompact(h),me.setSize(ie),me.setLayers(g),me.setCodeWords(O),me.setMatrix(ue),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=M.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+M.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 Wo(Qe.getGF(n)),d=M.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 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 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=$o.ISO_8859_1,h=Qe.DEFAULT_EC_PERCENT,g=Qe.DEFAULT_AZTEC_LAYERS;return c!=null&&(c.has(Vt.CHARACTER_SET)&&(d=nl.forName(c.get(Vt.CHARACTER_SET).toString())),c.has(Vt.ERROR_CORRECTION)&&(h=M.parseInt(c.get(Vt.ERROR_CORRECTION).toString())),c.has(Vt.AZTEC_LAYERS)&&(g=M.parseInt(c.get(Vt.AZTEC_LAYERS).toString()))),Vi.encodeLayers(e,t,n,s,d,h,g)}static encodeLayers(e,t,n,s,c,d,h){if(t!==he.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 Be;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=Do,i.ArgumentException=C,i.ArithmeticException=_t,i.AztecCode=rl,i.AztecCodeReader=Ir,i.AztecCodeWriter=Vi,i.AztecDecoder=Je,i.AztecDetector=Bi,i.AztecDetectorResult=jr,i.AztecEncoder=Qe,i.AztecHighLevelEncoder=ri,i.AztecPoint=Lt,i.BarcodeFormat=he,i.Binarizer=T,i.BinaryBitmap=I,i.BitArray=j,i.BitMatrix=W,i.BitSource=Fo,i.BrowserAztecCodeReader=Mo,i.BrowserBarcodeReader=Fg,i.BrowserCodeReader=xe,i.BrowserDatamatrixCodeReader=Ug,i.BrowserMultiFormatReader=Kg,i.BrowserPDF417Reader=Qg,i.BrowserQRCodeReader=Jg,i.BrowserQRCodeSvgWriter=ur,i.CharacterSetECI=F,i.ChecksumException=B,i.Code128Reader=pe,i.Code39Reader=Bt,i.DataMatrixDecodedBitStreamParser=Wn,i.DataMatrixReader=Xn,i.DecodeHintType=Z,i.DecoderResult=Ke,i.DefaultGridSampler=or,i.DetectorResult=Sr,i.EAN13Reader=ge,i.EncodeHintType=Vt,i.Exception=x,i.FormatException=V,i.GenericGF=De,i.GenericGFPoly=et,i.GlobalHistogramBinarizer=X,i.GridSampler=qr,i.GridSamplerInstance=Pt,i.HTMLCanvasElementLuminanceSource=le,i.HybridBinarizer=$,i.ITFReader=st,i.IllegalArgumentException=y,i.IllegalStateException=Be,i.InvertedLuminanceSource=J,i.LuminanceSource=q,i.MathUtils=ve,i.MultiFormatOneDReader=Tr,i.MultiFormatReader=tl,i.MultiFormatWriter=tp,i.NotFoundException=N,i.OneDReader=Nt,i.PDF417DecodedBitStreamParser=ne,i.PDF417DecoderErrorCorrection=Za,i.PDF417Reader=$t,i.PDF417ResultMetadata=Ka,i.PerspectiveTransform=nn,i.PlanarYUVLuminanceSource=On,i.QRCodeByteMatrix=Li,i.QRCodeDataMask=pn,i.QRCodeDecodedBitStreamParser=St,i.QRCodeDecoderErrorCorrectionLevel=gt,i.QRCodeDecoderFormatInformation=Yt,i.QRCodeEncoder=Et,i.QRCodeEncoderQRCode=dr,i.QRCodeMaskUtil=Rt,i.QRCodeMatrixUtil=Re,i.QRCodeMode=Te,i.QRCodeReader=$n,i.QRCodeVersion=Ie,i.QRCodeWriter=Rr,i.RGBLuminanceSource=Xo,i.RSS14Reader=kt,i.RSSExpandedReader=ce,i.ReaderException=Pi,i.ReedSolomonDecoder=rt,i.ReedSolomonEncoder=Wo,i.ReedSolomonException=Ae,i.Result=_e,i.ResultMetadataType=ye,i.ResultPoint=be,i.StringUtils=ee,i.UnsupportedOperationException=re,i.VideoInputDevice=ae,i.WhiteRectangleDetector=fn,i.WriterException=ft,i.ZXingArrays=D,i.ZXingCharset=nl,i.ZXingInteger=M,i.ZXingStandardCharsets=$o,i.ZXingStringBuilder=G,i.ZXingStringEncoding=K,i.ZXingSystem=v,i.createAbstractExpandedDecoder=ja,Object.defineProperty(i,"__esModule",{value:!0})})})(Io,Io.exports);var xt=Io.exports;const _m=dl({__proto__:null,default:na(xt)},[xt]);var Aa=function(){function a(l,i,o){if(this.formatMap=new Map([[Ce.QR_CODE,xt.BarcodeFormat.QR_CODE],[Ce.AZTEC,xt.BarcodeFormat.AZTEC],[Ce.CODABAR,xt.BarcodeFormat.CODABAR],[Ce.CODE_39,xt.BarcodeFormat.CODE_39],[Ce.CODE_93,xt.BarcodeFormat.CODE_93],[Ce.CODE_128,xt.BarcodeFormat.CODE_128],[Ce.DATA_MATRIX,xt.BarcodeFormat.DATA_MATRIX],[Ce.MAXICODE,xt.BarcodeFormat.MAXICODE],[Ce.ITF,xt.BarcodeFormat.ITF],[Ce.EAN_13,xt.BarcodeFormat.EAN_13],[Ce.EAN_8,xt.BarcodeFormat.EAN_8],[Ce.PDF_417,xt.BarcodeFormat.PDF_417],[Ce.RSS_14,xt.BarcodeFormat.RSS_14],[Ce.RSS_EXPANDED,xt.BarcodeFormat.RSS_EXPANDED],[Ce.UPC_A,xt.BarcodeFormat.UPC_A],[Ce.UPC_E,xt.BarcodeFormat.UPC_E],[Ce.UPC_EAN_EXTENSION,xt.BarcodeFormat.UPC_EAN_EXTENSION]]),this.reverseFormatMap=this.createReverseFormatMap(),!_m)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(xt.DecodeHintType.POSSIBLE_FORMATS,u),f.set(xt.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 xt.MultiFormatReader(this.verbose,this.hints),o=new xt.HTMLCanvasElementLuminanceSource(l),u=new xt.BinaryBitmap(new xt.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}(),wm=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())})},Cm=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([[Ce.QR_CODE,"qr_code"],[Ce.AZTEC,"aztec"],[Ce.CODABAR,"codabar"],[Ce.CODE_39,"code_39"],[Ce.CODE_93,"code_93"],[Ce.CODE_128,"code_128"],[Ce.DATA_MATRIX,"data_matrix"],[Ce.ITF,"itf"],[Ce.EAN_13,"ean_13"],[Ce.EAN_8,"ean_8"],[Ce.PDF_417,"pdf417"],[Ce.UPC_A,"upc_a"],[Ce.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 wm(this,void 0,void 0,function(){var i,o;return Cm(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}}},Em=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}(),No=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)}}(),Ii=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())})},Ni=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}(),ym=function(a){No(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),bm=function(a){No(l,a);function l(i){return a.call(this,"zoom",i)||this}return l}(ym),Am=function(a){No(l,a);function l(i){return a.call(this,"torch",i)||this}return l}(Ta),Sm=function(){function a(l){this.track=l}return a.prototype.zoomFeature=function(){return new bm(this.track)},a.prototype.torchFeature=function(){return new Am(this.track)},a}(),Im=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 Ii(this,void 0,void 0,function(){var f,m;return Ni(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 Ii(this,void 0,void 0,function(){return Ni(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 Sm(this.getFirstTrackOrFail())},a}(),Nm=function(){function a(l){this.mediaStream=l}return a.prototype.render=function(l,i,o){return Ii(this,void 0,void 0,function(){return Ni(this,function(u){return[2,Im.create(l,this.mediaStream,i,o)]})})},a.create=function(l){return Ii(this,void 0,void 0,function(){var i,o;return Ni(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}}},Tm=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,Nm.create(l)]})})},a}(),km=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())})},Rm=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}}},Bm=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=yr.unableToQuerySupportedDevices();return a.isHttpsOrLocalhost()||(l=yr.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 km(this,void 0,void 0,function(){var l,i,o,u,f,m,p;return Rm(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}(),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 Om=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 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}(),Mm=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}(),Dm=function(){function a(){}return a.create=function(){return new Mm(new Om)},a}(),vm=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)}}(),un=function(a){vm(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}(gm),Pm=function(){function a(l,i){this.logger=i,this.fps=un.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=un.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!Vn(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 xm(this.verbose),this.qrcode=new Em(this.getSupportedFormats(i),this.getUseBarCodeDetectorIfSupported(o),this.verbose,this.logger),this.foreverScanTimeout,this.shouldScan=!0,this.stateManagerProxy=Dm.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=Pm.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:un.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(B,T){var v=x?p.videoConstraints:y.createVideoConstraints(l);if(!v){I.cancel(),T("videoConstraints should be defined");return}var k={};(!x||p.aspectRatio)&&(k.aspectRatio=p.aspectRatio);var P={onRenderSurfaceReady:function(D,M){y.setupUi(D,M,p),y.isScanning=!0,y.foreverScan(p,o,m)}};Tm.failIfNotSupported().then(function(D){D.create(v).then(function(M){return M.render(f.element,k,P).then(function(j){y.renderedCamera=j,I.execute(),B(null)}).catch(function(j){I.cancel(),T(j)})}).catch(function(M){I.cancel(),T(yr.errorGettingUserMedia(M))})}).catch(function(D){I.cancel(),T(yr.cameraStreamingNotSupported())})})},a.prototype.pause=function(l){if(!this.stateManagerProxy.isStrictlyScanning())throw"Cannot pause, scanner is not scanning.";this.stateManagerProxy.directTransition(It.PAUSED),this.showPausedState(),(Vn(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 o=function(){if(l.element){var f=document.getElementById(un.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(Vn(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:un.DEFAULT_WIDTH,y=Math.max(x.clientHeight?x.clientHeight:_,un.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 v=un.FILE_SCAN_HIDDEN_CANVAS_PADDING,k=Math.max(m.width,I.width),P=Math.max(m.height,I.height),D=k+2*v,M=P+2*v,j=o.createCanvasElement(D,M);x.appendChild(j);var H=j.getContext("2d");if(!H)throw"Unable to get 2d context from canvas";H.canvas.width=D,H.canvas.height=M,H.drawImage(m,0,0,p,_,v,v,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 Bm.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=[Ce.QR_CODE,Ce.AZTEC,Ce.CODABAR,Ce.CODE_39,Ce.CODE_93,Ce.CODE_128,Ce.DATA_MATRIX,Ce.MAXICODE,Ce.ITF,Ce.EAN_13,Ce.EAN_8,Ce.PDF_417,Ce.RSS_14,Ce.RSS_EXPANDED,Ce.UPC_A,Ce.UPC_E,Ce.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];mm(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(Vn(l))return!0;if(!Vn(l.useBarCodeDetectorIfSupported))return l.useBarCodeDetectorIfSupported!==!1;if(Vn(l.experimentalFeatures))return!0;var i=l.experimentalFeatures;return Vn(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<un.MIN_QR_BOX_SIZE)throw"minimum size of 'config.qrbox' dimension value is"+" ".concat(un.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=Vn(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=yr.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=yr.codeParseError(u);return i(f,pm.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?un.BORDER_SHADER_MATCH_COLOR:un.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=Vn(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(un.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=un.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 Lm={width:"38",height:"38",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"none"},Fm=["stroke"],Vm=["stroke"],Um=["stroke"],zm=["stroke"],Hm=["stroke"],Gm=r.defineComponent({__name:"QR",props:{color:{type:String,required:!1,default:"#FFFFFF"}},setup(a){return(l,i)=>(r.openBlock(),r.createElementBlock("svg",Lm,[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,Fm),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,Vm),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,Um),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,zm),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,Hm)]))}}),To={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"]},Wm={key:0,class:"qr_text"},Xm=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=At(),{itemThemes:C}=we.storeToRefs(x),y=l,I=P=>P.replace(/^[\s\S]*?((?:tel|sms|smsto|mailto|callto|facetime|viber|whatsapp):)?[\s\S]*?(%2B)?[\s\S]*?/i,(D,M,j)=>j?"+":""),B=async(P,D)=>{var Z,V,L;if(console.log(P,D),p.value)return;i.isQr||(p.value=!0),k();const M=/[?&]table_id=([a-zA-Z0-9-]+)/,j=P.match(M),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 bn,re=P||D.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=()=>{},v=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 D;if(i.isQr)D=P.find(H=>To.back.some(Z=>new RegExp(Z,"i").test(H.label))),D||(D=P.find(H=>To.front.some(Z=>new RegExp(Z,"i").test(H.label))));else if(D=P.find(H=>To.front.some(Z=>new RegExp(Z,"i").test(H.label))),D||(D=P.find(H=>new RegExp("amera","i").test(H.label))),!D){y("update:is_notification",!0),y("update:notificationData",{textNotification:"Не найдена фронтальная камера. Для сканирования карт нужна фронтальная камера."}),u.value=!1,y("update:is_toggleAffiliation",!0);return}const M=i.isQr?[Ce.QR_CODE]:[Ce.QR_CODE,Ce.PDF_417,Ce.EAN_13,Ce.EAN_8,Ce.CODE_128],j={fps:60,qrbox:{width:320,height:500}};await o.start(D.id,j,B,T,void 0,M),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,D)=>(r.openBlock(),r.createElementBlock("div",null,[(r.openBlock(),r.createBlock(r.Teleport,{to:"body"},[r.withDirectives(r.createElementVNode("div",{class:"blackWindow",onClick:k},[D[0]||(D[0]=r.createElementVNode("div",{id:"reader"},null,-1)),f.value&&!a.isQr?(r.openBlock(),r.createElementBlock("p",Wm,"Наведите QR на камеру")):r.createCommentVNode("",!0)],512),[[r.vShow,u.value]])])),r.createVNode(Gm,{color:a.isQr?void 0:"#FFFFFF",onClick:v},null,8,["color"])]))}}),Ti=Symbol("clickOutside"),$m={mounted(a,l){a[Ti]=i=>{a.contains(i.target)||l.value(i)},document.addEventListener("click",a[Ti])},unmounted(a){a[Ti]&&document.removeEventListener("click",a[Ti])}};let nr=[],ko;const Ma=["#FFD700","#FF6B8A","#7ECFC0","#C4B5FD","#FFA726","#EF5350","#AB47BC","#66BB6A","#42A5F5","#FFCA28"];class Da{constructor(l){ke(this,"x");ke(this,"y");ke(this,"vx");ke(this,"vy");ke(this,"color");ke(this,"size");ke(this,"rotation");ke(this,"rotationSpeed");ke(this,"gravity");ke(this,"friction");ke(this,"opacity");ke(this,"fadeSpeed");ke(this,"shape");ke(this,"width");ke(this,"height");ke(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 jm={mounted(a){const l=a.getContext("2d"),i=()=>{l.clearRect(0,0,window.innerWidth,window.innerHeight);for(let o of nr)o.update(),o.draw();nr=nr.filter(o=>o.opacity>0),nr.length>0&&(ko=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++)nr.push(new Da(l));i()},400),setTimeout(()=>{for(let o=0;o<40;o++)nr.push(new Da(l))},900)},unmounted(a){window.removeEventListener("resize",a._resize),ko&&cancelAnimationFrame(ko),nr=[]}},qm={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,ae=N[0].length;for(let oe=0;oe<le;oe++)for(let xe=0;xe<ae;xe++){const _e=N[oe][xe];if(!_e)continue;const Pe=J?X+(ae-1-xe)*q:X+xe*q,he=$+oe*q;W.fillStyle=_e,W.fillRect(Pe,he,q,q)}}let v,k,P,D,M,j,H,Z,V,L,F,re=!1;function K(){Z=a.height*.46,k=-20*i,P=Z,D=3.2,M=0,v="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)),(v==="enter"||v==="exit")&&(H++,H>=6&&(H=0,j=(j+1)%3));const X=[x,C,y];if(v==="enter")k+=D,T(l,X[j],k,P,i,!1),k+5*i>=ee()&&(v="bump_up",D=0,M=-7);else if(v==="bump_up")M+=.7,P+=M,T(l,I,k,P,i,!1),M>=0&&(v="bump_down",F=!0,L=-10,V=P-10*i);else if(v==="bump_down")M+=.7,P+=M,T(l,I,k,P,i,!1),P>=Z&&(P=Z,M=0,D=-3.2,v="exit");else if(v==="exit"&&(k+=D,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 Zm{constructor(l){ke(this,"value");ke(this,"next");this.value=l}}class Ym{constructor(){Ui(this,tn);Ui(this,Hn);Ui(this,ir);this.clear()}enqueue(l){const i=new Zm(l);wn(this,tn)?(wn(this,Hn).next=i,vn(this,Hn,i)):(vn(this,tn,i),vn(this,Hn,i)),Yo(this,ir)._++}dequeue(){const l=wn(this,tn);if(l)return vn(this,tn,wn(this,tn).next),Yo(this,ir)._--,wn(this,tn)||vn(this,Hn,void 0),l.value}peek(){if(wn(this,tn))return wn(this,tn).value}clear(){vn(this,tn,void 0),vn(this,Hn,void 0),vn(this,ir,0)}get size(){return wn(this,ir)}*[Symbol.iterator](){let l=wn(this,tn);for(;l;)yield l.value,l=l.next}*drain(){for(;wn(this,tn);)yield this.dequeue()}}tn=new WeakMap,Hn=new WeakMap,ir=new WeakMap;function Km(a){va(a);const l=new Ym;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 en=null;const Pa=Km(5),Qm=async(a,l)=>{en&&ng();const i=lt(),o=At(),u=Gr(),f=Ut(),{itemThemes:m}=we.storeToRefs(o),{displayCards:p}=we.storeToRefs(i),{is_notification_lib:_,notificationData_lib:x}=we.storeToRefs(u),{stateCard:C,openProduct:y}=we.storeToRefs(f),I=bn.create();await Jm(a),en=Lr(`wss://${l}/ws/org-unit/${a}/`,{heartbeatTimeout:3e4}),en.on("open",()=>console.warn("Realtime WebSocket подключён (pointId:",a,")")),en.on("error",B=>console.warn("WebSocket ошибка:",B)),en.on("close",()=>console.warn("Realtime WebSocket закрыт")),en.on("message",async B=>{try{if(B.type)return;m.value.kiosk_hide_menu_update_notification||(x.value.textNotification="Мы обновили меню");const T=B.params||B,v=T.active_groups||[],k=T.updated_groups||[],P=T.updated_product_groups||[],D=await Yn(),M=new Set(v.map(K=>K)),j=new Map(p.value.map(K=>[K.id,K])),H=[],Z=D.transaction("groups","readwrite");let L=await Z.objectStore("groups").openCursor();for(;L;){const K=L.key;!M.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 eg(M);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 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,j.set(K,ee),await Dr(K,ee),await Fa(ee,G,!0),await tg(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)}}),en.connect()},Jm=async a=>{try{const l=lt(),i=await qi(a);i!=null&&i.data&&(l.displayCards=i.data)}catch(l){console.error("Ошибка загрузки кэша групп:",l)}},La=async a=>{const l=lt(),i=Gr(),o=Ut(),{stateCard:u,openProduct:f}=we.storeToRefs(o),{cartProducts_lib:m}=we.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()}},eg=async a=>{await La(l=>{var i;return(i=l.groups)!=null&&i.length?!l.groups.some(o=>a.has(o)):!0})},tg=async(a,l)=>{const i=lt(),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&&ki(a.video_link,`${a.id}_video`,i),a.image_link&&ki(a.image_link,`${a.id}_image`,i),l!=null&&l.length)for(const o of l)o.video_link&&ki(o.video_link,`${o.id}_video`,i),o.image_link&&ki(o.image_link,`${o.id}_image`,i)},ki=async(a,l,i=!1)=>{try{const o=ai();if(!i){const m=await fr(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)}},ng=()=>{en&&(en.off("open"),en.off("message"),en.off("error"),en.off("close"),en.close(!0),en=null)},rg={key:0,class:"valentine-hearts"},ig=r.defineComponent({__name:"FallingHearts",props:{symbols:{default:()=>["❤","♥","💕"]},max:{default:15},interval:{default:1500}},setup(a){const l=a,i=pt.useDocumentVisibility(),o=pt.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),v=m(.6,.9),k=Math.floor(m(1,6)),D={id:crypto.randomUUID(),icon:C,style:{left:`${I}%`,fontSize:`${y}px`,color:`rgba(255, 105, 180, ${v})`,animationName:`heartFall${k}`,animationDuration:`${B}s`,animationDelay:`${T}s`}};u.value.push(D);const j=setTimeout(()=>{u.value=u.value.filter(H=>H.id!==D.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",rg,[(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))]))}}),og=["src"],sg=r.defineComponent({__name:"BasketImage",props:{id:{},fallback:{}},setup(a){const l=a,{mediaUrl:i}=An(()=>l.id,()=>l.fallback);return(o,u)=>(r.openBlock(),r.createElementBlock("img",{src:r.unref(i)||""},null,8,og))}}),ag={class:"button_price_bg"},lg={class:"wrapper_container_price_bg"},cg={class:"button_price"},dg={key:0,class:"image_product_container"},ug=r.defineComponent({__name:"BasketButton",emits:["goToCart"],setup(a,{emit:l}){const i=l,o=Ne.useRouter(),u=lt(),f=Ln(),{totalPrice_lib:m,cartProducts_lib:p,cartBasketBumpKey:_}=we.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",ag,[r.createElementVNode("div",lg,[r.createElementVNode("div",cg,[r.unref(m)>0&&C.value.length>0?(r.openBlock(),r.createElementBlock("div",dg,[(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(sg,{id:T.id,fallback:T.fallback,class:"img_product"},null,8,["id","fallback"])]))),128))])):r.createCommentVNode("",!0),(r.openBlock(),r.createBlock(r.unref(Dt.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(mt,{price:x.value,fixedFloat:2},null,8,["price"]),B[0]||(B[0]=r.createTextVNode(" ₽",-1))])]),_:1},8,["animate"]))])])]))}}),Xr=null,{min:rr,max:Sn,abs:Va,floor:fg}=Math,Ua=(a,l,i)=>rr(i,Sn(l,a)),za=a=>[...a].sort((l,i)=>l-i),hg=typeof queueMicrotask=="function"?queueMicrotask:a=>{Promise.resolve().then(a)},Ro=()=>{let a;return[new Promise(l=>{a=l}),a]},Ha=a=>{let l;return()=>(a&&(l=a(),a=void 0),l)},$r=(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},mg=(a,l,i)=>{const o=a.t[l]===-1;return a.t[l]=i,a.i=rr(l,a.i),o},Ri=(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},br=(a,l,i=0,o=a.l-1)=>{let u=i;for(;i<=o;){const f=fg((i+o)/2);Ri(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:rr(l-1,a.i),a.l=l,o>0?($r(a.u,o),$r(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))},gg=a=>a.documentElement,pg=a=>a.ownerDocument,xg=a=>a.defaultView,Xa=Ha(()=>!!/iP(hone|od|ad)/.test(navigator.userAgent)||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>0),_g=Ha(()=>"scrollBehavior"in gg(document).style),wg=(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,v=Xr,k=[0,f?Sn(i-1,0):-1],P=0,D=!1;const M=((G,W,N)=>({o:W,t:N?$r(N.slice(0,rr(G,N.length)),Sn(0,G-N.length)):$r([],G),l:G,i:-1,u:$r([],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=rr(q,N.l-1),Ri(N,q)<=X){const J=br(N,$,q);return[br(N,X,q,J),J]}{const J=br(N,X,void 0,q);return[J,br(N,$,J)]}})(M,G,W,k[0]),L=()=>Ri(M,M.l),F=(G,W)=>{const N=Ri(M,G)-y;return W?L()-N-re(G):N},re=G=>Ga(M,G),K=(G,W=-1)=>M.t[G]===W,ee=G=>{G&&(Xa()&&B!==0||v&&T===1?y+=G:C+=G)};return{p:()=>{j.clear()},h:()=>m,m:()=>(G=>[G.t.slice(),G.o])(M),v:(G=200)=>{if(!D||f)return k;let W,N;if(I)[W,N]=k;else{let X=Sn(0,Z()),$=X+p;u||(G=Sn(0,G),B!==1&&(X-=G),B!==2&&($+=G)),[W,N]=k=V(Sn(0,X),Sn(0,$)),v&&(W=rr(W,v[0]),N=Sn(N,v[1]))}return[Sn(W,0),rr(N,M.l-1)]},S:G=>br(M,G-_),I:K,O:F,k:re,j:()=>M.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 ae=H();ae>=-p&&ae<=L()&&($+=1,X=le>p);break}case 2:$=8,B!==0&&(N=!0,$+=1),B=0,T=0,v=Xr;break;case 3:{const q=W.filter(([J,le])=>!K(J,le));if(!q.length)break;ee(q.reduce((J,[le,ae])=>((T===2||(v&&T===1?le<v[0]:F(le+(B===0&&T===0?1:0))<H()))&&(J+=ae-re(le)),J),0));for(const[J,le]of q){const ae=re(J),oe=mg(M,J,le);u&&(P+=oe?le:le-ae)}u&&p&&P>p&&(ee(((J,le)=>{let ae=0;const oe=[];J.t.forEach((ye,Ke)=>{ye!==-1&&(oe.push(ye),Ke<le&&ae++)}),J.i=-1;const xe=za(oe),_e=xe.length,Pe=_e/2|0,he=_e%2==0?(xe[Pe-1]+xe[Pe])/2:xe[Pe],qe=J.o;return((J.o=he)-qe)*Sn(le-ae,0)})(M,br(M,Z()))),u=!1),$=3,X=!0;break}case 4:p!==W&&(p||(D=X=!0),p=W,$=3);break;case 5:W[1]?(ee(Wa(M,W[0],!0)),T=2,$=1):(Wa(M,W[0]),$=1);break;case 6:_=W;break;case 7:T=1;break;case 8:v=V(W,W+p),$=1}$&&(m=1+(2147483647&m),N&&y&&(C+=y,y=0),j.forEach(([q,J])=>{$&q&&J(X)}))}}},Bo=setTimeout,Oo=(a,l)=>l?-a:a,Cg=(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 D=()=>{P!=Xr&&clearTimeout(P)},M=()=>{D(),P=Bo(()=>{P=Xr,(()=>{if(_||x)return _=!1,void I();C=!1,a.A(2)})()},150)};return M.C=D,M})(),B=()=>{p=m(),C&&(y=!0),a.A(1,o()),I()},T=P=>{if(_||!a.B()||P.ctrlKey)return;const D=m()-p;150>D&&50<D&&(i?P.deltaX:P.deltaY)&&(_=!0)},v=()=>{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",v,{passive:!0}),l.addEventListener("touchend",k,{passive:!0}),{H:()=>{l.removeEventListener("scroll",B),l.removeEventListener("wheel",T),l.removeEventListener("touchstart",v),l.removeEventListener("touchend",k),I.C()},V:()=>{const[P,D]=a.P();P&&(u(P,D,y),y=!1,D&&a.T()>a.M()&&a.A(1,o()))}}},Eg=(a,l,i)=>{let o;return[async(u,f)=>{if(!await l())return;o&&o();const m=()=>{const[p,_]=Ro();return o=()=>{_(!1)},a.T()&&Bo(o,150),[p,a.R(2,()=>{_(!0)})]};if(f&&_g())a.A(8,u()),hg(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()}]},yg=a=>{let l;return{F(i){(l||(l=new(xg(pg(i))).ResizeObserver(a))).observe(i)},J(i){l.unobserve(i)},H(){l&&l.disconnect()}}},bg=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}}}),Ag=(a,l)=>{const i=a.key;return i??"_"+l},Sg=(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=wg(a.data.length,a.itemSize,a.ssrCount,a.cache,!a.itemSize),_=((T,v)=>{let k;const P=v?"width":"height",D=new WeakMap,M=yg(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=D.get(Z);L!=Xr&&H.push([L,V[P]])}H.length&&T.A(3,H)});return{te(j){M.F(k=j)},re:(j,H)=>(D.set(j,H),M.F(j),()=>{D.delete(j),M.J(j)}),p:M.H}})(p,f),x=((T,v)=>{let k,P,D=Ro(),M=!1;const j=v?"scrollLeft":"scrollTop",H=v?"overflowX":"overflowY",[Z,V]=Eg(T,()=>D[0],(L,F)=>{L=Oo(L,M),F?k.scrollTo({[v?"left":"top"]:L,behavior:"smooth"}):k[j]=L});return{oe(L){k=L,v&&(M=getComputedStyle(L).direction==="rtl"),P=Cg(T,L,v,()=>Oo(L[j],M),(F,re,K)=>{if(K){const ee=L.style,G=ee[H];ee[H]="hidden",Bo(()=>{ee[H]=G})}L[j]=Oo(T.N()+F,M),re&&V()}),D[1](!0)},p(){P&&P.H(),D[1](!1),D=Ro()},ne:()=>M,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 v=p.v(a.bufferSize);return T&&Sg(T,v)?T:v}),I=r.computed(()=>C.value&&p.B()),B=r.computed(()=>C.value&&p.M());return r.onMounted(()=>{u=!1;const T=requestAnimationFrame(()=>{const v=k=>{_.te(k),x.oe(k)};a.scrollRef?v(a.scrollRef):v(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=>Sn(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,v=a.item,k=B.value,P=x.ne(),D=!f&&P?"unshift":"push",M=[],j=Z=>{var V;const L=o.default({item:a.data[Z],index:Z})[0];return r.createVNode(bg,{key:Ag(L,Z),L:C,W:p,Y:_.re,D:Z,X:L,U:f,K:P,G:u,Z:v,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=>{M[D](j(V))})}else for(let[Z,V]=y.value;Z<=V;Z++)M[D](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=M)=="function"||Object.prototype.toString.call(H)==="[object Object]"&&!r.isVNode(H)?M:{default:()=>[M],_:2},8,["style"]);var H}}}),Ig=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 _}}}),Ng=(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 Tg(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 Ng(u.value),!!u.value))){if(f.value=u.value.scrollSize>u.value.viewportSize,!f.value){o=!1;return}o=!0,m.value=r.toValue(l==null?void 0:l.mode)||"loop",await r.nextTick(),u.value&&u.value.scrollToIndex(m.value==="loop"?p.value*3:0,{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,D=p.value*4;if(k<P)return I(p.value*3-1,{align:"start"});if(k>=D)return I(p.value*3,{align:"start"})},v=()=>{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)),r.watch(()=>l==null?void 0:l.mode,()=>C),{listRef:u,items:x,hasScroll:f,realIndex:y,findNearestIndex:B,scrollToIndex:I,init:C,onScroll:v}}const kg=Object.prototype.toString,Rg=a=>kg.call(a)==="[object Error]",Bg=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"]),Og=a=>{if(!(a&&Rg(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:Bg.has(i)},Mg={pinch:!0,doubleTap:!0,wheel:!0,buttons:["+","-","=","0"]},Dg=a=>{var i;const l=Object.assign({},Mg,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(fe,"useRoute",{enumerable:!0,get:()=>Ne.useRoute}),Object.defineProperty(fe,"useRouter",{enumerable:!0,get:()=>Ne.useRouter}),fe.BasketButton=ug,fe.BottomSheet=_o,fe.ButtonDefault=cn,fe.CardMain=_a,fe.CardProductPage=A0,fe.CardReader=ua,fe.CartBox=da,fe.CartPage=Kh,fe.DrumItem=tm,fe.FallingHearts=ig,fe.GroupMain=Z2,fe.InitConnection=bn,fe.ModalWindows=hm,fe.NotificationWindow=yi,fe.OrderBox=Ao,fe.PopupWindowDefault=ca,fe.PricePrerender=hr,fe.QrCameraScanner=Xm,fe.QrcodeVue=pa,fe.Recommendation=cm,fe.RetryPage=l2,fe.TableOrderPage=D2,fe.TagsMain=K2,fe.VList=Ig,fe.Virtualizer=$a,fe.clearAllProductDB=Rl,fe.clearLocalStorage=mr,fe.getCachedGroup=qi,fe.getCachedProduct=is,fe.getWebSocketInstance=Lr,fe.initPinia=ul,fe.initRouter=hl,fe.isNetworkError=Og,fe.parseTheme=oa,fe.preventZoom=Dg,fe.updateIndexedDB=Qm,fe.useCachedMedia=An,fe.useCardLibStore=Ut,fe.useCartLibStore=vt,fe.useImageCacheStore=ai,fe.useMainLibStore=lt,fe.useModal=bo,fe.useModalStore=Ai,fe.useModulesLibStore=Gr,fe.usePdf=zn,fe.useTableStore=Ln,fe.useThemeStore=At,fe.useVirtuaLoop=Tg,fe.vClickOutside=$m,fe.vConfetti=jm,fe.vDragScroll=Wr,fe.vMario=qm,fe.vMuted=Cr,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<dr.NUM_MASK_PATTERNS}}dr.NUM_MASK_PATTERNS=8;class ft extends x{}ft.kind="WriterException";class Re{constructor(){}static clearMatrix(e){e.clear(255)}static buildMatrix(e,t,n,s,c){Re.clearMatrix(c),Re.embedBasicPatterns(n,c),Re.embedTypeInfo(t,s,c),Re.maybeEmbedVersionInfo(n,c),Re.embedDataBits(e,s,c)}static embedBasicPatterns(e,t){Re.embedPositionDetectionPatternsAndSeparators(t),Re.embedDarkDotAtLeftBottomCorner(t),Re.maybeEmbedPositionAdjustmentPatterns(e,t),Re.embedTimingPatterns(t)}static embedTypeInfo(e,t,n){const s=new j;Re.makeTypeInfoBits(e,t,s);for(let c=0,d=s.getSize();c<d;++c){const h=s.get(s.getSize()-1-c),g=Re.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;Re.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(!Re.isEmpty(n.get(w,h)))continue;let E;s<e.getSize()?(E=e.get(s),++s):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(s!==e.getSize())throw new ft("Not all bits consumed: "+s+"/"+e.getSize())}static findMSBSet(e){return 32-M.numberOfLeadingZeros(e)}static calculateBCHCode(e,t){if(t===0)throw new y("0 polynomial");const n=Re.findMSBSet(t);for(e<<=n-1;Re.findMSBSet(e)>=n;)e^=t<<Re.findMSBSet(e)-n;return e}static makeTypeInfoBits(e,t,n){if(!dr.isValidMaskPattern(t))throw new ft("Invalid mask pattern");const s=e.getBits()<<3|t;n.appendBits(s,5);const c=Re.calculateBCHCode(s,Re.TYPE_INFO_POLY);n.appendBits(c,10);const d=new j;if(d.appendBits(Re.TYPE_INFO_MASK_PATTERN,15),n.xor(d),n.getSize()!==15)throw new ft("should not happen but we got: "+n.getSize())}static makeVersionInfoBits(e,t){t.appendBits(e.getVersionNumber(),6);const n=Re.calculateBCHCode(e.getVersionNumber(),Re.VERSION_INFO_POLY);if(t.appendBits(n,12),t.getSize()!==18)throw new ft("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;Re.isEmpty(e.get(t,6))&&e.setNumber(t,6,n),Re.isEmpty(e.get(6,t))&&e.setNumber(6,t,n)}}static embedDarkDotAtLeftBottomCorner(e){if(e.get(8,e.getHeight()-8)===0)throw new ft;e.setNumber(8,e.getHeight()-8,1)}static embedHorizontalSeparationPattern(e,t,n){for(let s=0;s<8;++s){if(!Re.isEmpty(n.get(e+s,t)))throw new ft;n.setNumber(e+s,t,0)}}static embedVerticalSeparationPattern(e,t,n){for(let s=0;s<7;++s){if(!Re.isEmpty(n.get(e,t+s)))throw new ft;n.setNumber(e,t+s,0)}}static embedPositionAdjustmentPattern(e,t,n){for(let s=0;s<5;++s){const c=Re.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=Re.POSITION_DETECTION_PATTERN[s];for(let d=0;d<7;++d)n.setNumber(e+d,t+s,c[d])}}static embedPositionDetectionPatternsAndSeparators(e){const t=Re.POSITION_DETECTION_PATTERN[0].length;Re.embedPositionDetectionPattern(0,0,e),Re.embedPositionDetectionPattern(e.getWidth()-t,0,e),Re.embedPositionDetectionPattern(0,e.getWidth()-t,e);const n=8;Re.embedHorizontalSeparationPattern(0,n-1,e),Re.embedHorizontalSeparationPattern(e.getWidth()-n,n-1,e),Re.embedHorizontalSeparationPattern(0,e.getWidth()-n,e);const s=7;Re.embedVerticalSeparationPattern(s,0,e),Re.embedVerticalSeparationPattern(e.getHeight()-s-1,0,e),Re.embedVerticalSeparationPattern(s,e.getHeight()-s,e)}static maybeEmbedPositionAdjustmentPatterns(e,t){if(e.getVersionNumber()<2)return;const n=e.getVersionNumber()-1,s=Re.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&&Re.isEmpty(t.get(w,h))&&Re.embedPositionAdjustmentPattern(w-2,h-2,t)}}}}Re.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])]),Re.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])]),Re.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])]),Re.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])]),Re.VERSION_INFO_POLY=7973,Re.TYPE_INFO_POLY=1335,Re.TYPE_INFO_MASK_PATTERN=21522;class rp{constructor(e,t){this.dataBytes=e,this.errorCorrectionBytes=t}getDataBytes(){return this.dataBytes}getErrorCorrectionBytes(){return this.errorCorrectionBytes}}class Et{constructor(){}static calculateMaskPenalty(e){return Rt.applyMaskPenaltyRule1(e)+Rt.applyMaskPenaltyRule2(e)+Rt.applyMaskPenaltyRule3(e)+Rt.applyMaskPenaltyRule4(e)}static encode(e,t,n=null){let s=Et.DEFAULT_BYTE_MODE_ENCODING;const c=n!==null&&n.get(Vt.CHARACTER_SET)!==void 0;c&&(s=n.get(Vt.CHARACTER_SET).toString());const d=this.chooseMode(e,s),h=new j;if(d===Te.BYTE&&(c||Et.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(Vt.QR_VERSION)!==void 0){const me=Number.parseInt(n.get(Vt.QR_VERSION).toString(),10);w=Ie.getVersionForNumber(me);const de=this.calculateBitsNeeded(d,h,g,w);if(!this.willFit(de,w,t))throw new ft("Data too big for requested version")}else w=this.recommendVersion(t,d,h,g);const E=new j;E.appendBitArray(h);const A=d===Te.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()),H=new dr;H.setECLevel(t),H.setMode(d),H.setVersion(w);const Y=w.getDimensionForVersion(),ie=new Li(Y,Y),ue=this.chooseMaskPattern(U,t,w,ie);return H.setMaskPattern(ue),Re.buildMatrix(U,t,w,ue,ie),H.setMatrix(ie),H}static recommendVersion(e,t,n,s){const c=this.calculateBitsNeeded(t,n,s,Ie.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<Et.ALPHANUMERIC_TABLE.length?Et.ALPHANUMERIC_TABLE[e]:-1}static chooseMode(e,t=null){if(F.SJIS.getName()===t&&this.isOnlyDoubleByteKanji(e))return Te.KANJI;let n=!1,s=!1;for(let c=0,d=e.length;c<d;++c){const h=e.charAt(c);if(Et.isDigit(h))n=!0;else if(this.getAlphanumericCode(h.charCodeAt(0))!==-1)s=!0;else return Te.BYTE}return s?Te.ALPHANUMERIC:n?Te.NUMERIC:Te.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<dr.NUM_MASK_PATTERNS;h++){Re.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=Ie.getVersionForNumber(n);if(Et.willFit(e,s,t))return s}throw new ft("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 ft("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 ft("Bits size does not equal capacity")}static getNumDataBytesAndNumECBytesForBlockID(e,t,n,s,c,d){if(s>=n)throw new ft("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 ft("EC bytes mismatch");if(n!==g+h)throw new ft("RS blocks mismatch");if(e!==(A+O)*g+(S+U)*h)throw new ft("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 ft("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);Et.getNumDataBytesAndNumECBytesForBlockID(t,n,s,E,A,S);const O=A[0],U=new Uint8Array(O);e.toBytes(8*c,U,0,O);const H=Et.generateECBytes(U,S[0]);g.push(new rp(U,H)),d=Math.max(d,O),h=Math.max(h,H.length),c+=A[0]}if(n!==c)throw new ft("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 ft("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 Xo(De.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 ft(e+" is bigger than "+((1<<c)-1));s.appendBits(e,c)}static appendBytes(e,t,n,s){switch(t){case Te.NUMERIC:Et.appendNumericBytes(e,n);break;case Te.ALPHANUMERIC:Et.appendAlphanumericBytes(e,n);break;case Te.BYTE:Et.append8BitBytes(e,n,s);break;case Te.KANJI:Et.appendKanjiBytes(e,n);break;default:throw new ft("Invalid mode: "+t)}}static getDigit(e){return e.charCodeAt(0)-48}static isDigit(e){const t=Et.getDigit(e);return t>=0&&t<=9}static appendNumericBytes(e,t){const n=e.length;let s=0;for(;s<n;){const c=Et.getDigit(e.charAt(s));if(s+2<n){const d=Et.getDigit(e.charAt(s+1)),h=Et.getDigit(e.charAt(s+2));t.appendBits(c*100+d*10+h,10),s+=3}else if(s+1<n){const d=Et.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=Et.getAlphanumericCode(e.charCodeAt(s));if(c===-1)throw new ft;if(s+1<n){const d=Et.getAlphanumericCode(e.charCodeAt(s+1));if(d===-1)throw new ft;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 ft(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 ft(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 ft("Invalid byte sequence");const E=(w>>8)*192+(w&255);t.appendBits(E,13)}}static appendECI(e,t){t.appendBits(Te.ECI.getBits(),4),t.appendBits(e.getValue(),8)}}Et.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]),Et.DEFAULT_BYTE_MODE_ENCODING=F.UTF8.getName();class ur{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=pt.L,d=ur.QUIET_ZONE_SIZE;s!==null&&(s.get(Vt.ERROR_CORRECTION)!==void 0&&(c=pt.fromString(s.get(Vt.ERROR_CORRECTION).toString())),s.get(Vt.MARGIN)!==void 0&&(d=Number.parseInt(s.get(Vt.MARGIN).toString(),10)));const h=Et.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 Be;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),H=this.createSVGElement(E,A);for(let Y=0,ie=U;Y<h;Y++,ie+=S)for(let ue=0,me=O;ue<d;ue++,me+=S)if(c.get(ue,Y)===1){const de=this.createSvgRectElement(me,ie,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,s){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",s.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,s,c){if(e.length===0)throw new y("Found empty contents");if(t!==he.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=pt.L,h=Rr.QUIET_ZONE_SIZE;c!==null&&(c.get(Vt.ERROR_CORRECTION)!==void 0&&(d=pt.fromString(c.get(Vt.ERROR_CORRECTION).toString())),c.get(Vt.MARGIN)!==void 0&&(h=Number.parseInt(c.get(Vt.MARGIN).toString(),10)));const g=Et.encode(e,d,c);return Rr.renderResult(g,n,s,h)}static renderResult(e,t,n,s){const c=e.getMatrix();if(c===null)throw new Be;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),H=new W(E,A);for(let Y=0,ie=U;Y<h;Y++,ie+=S)for(let ue=0,me=O;ue<d;ue++,me+=S)c.get(ue,Y)===1&&H.setRegion(me,ie,S,S);return H}}Rr.QUIET_ZONE_SIZE=4;class ip{encode(e,t,n,s,c){let d;switch(t){case he.QR_CODE:d=new Rr;break;default:throw new y("No encoder available for format "+t)}return d.encode(e,t,n,s,c)}}class On 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 v.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 v.arraycopy(this.yuvData,c,s,0,n),s;for(let d=0;d<t;d++){const h=d*e;v.arraycopy(this.yuvData,c,s,h,e),c+=this.dataWidth}return s}isCropSupported(){return!0}crop(e,t,n,s){return new On(this.yuvData,this.dataWidth,this.dataHeight,this.left+e,this.top+t,n,s,!1)}renderThumbnail(){const e=this.getWidth()/On.THUMBNAIL_SCALE_FACTOR,t=this.getHeight()/On.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*On.THUMBNAIL_SCALE_FACTOR]&255;n[h+g]=4278190080|w*65793}c+=this.dataWidth*On.THUMBNAIL_SCALE_FACTOR}return n}getThumbnailWidth(){return this.getWidth()/On.THUMBNAIL_SCALE_FACTOR}getThumbnailHeight(){return this.getHeight()/On.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)}}On.THUMBNAIL_SCALE_FACTOR=2;class $o 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 v.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 v.arraycopy(this.luminances,c,s,0,n),s;for(let d=0;d<t;d++){const h=d*e;v.arraycopy(this.luminances,c,s,h,e),c+=this.dataWidth}return s}isCropSupported(){return!0}crop(e,t,n,s){return new $o(this.luminances,n,s,this.dataWidth,this.dataHeight,this.left+e,this.top+t)}invert(){return new J(this)}}class rl extends F{static forName(e){return this.getCharacterSetECIByName(e)}}class jo{}jo.ISO_8859_1=F.ISO8859_1;class il{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 ol{static singletonList(e){return[e]}static min(e,t){return e.sort(t)[0]}}class op{constructor(e){this.previous=e}getPrevious(){return this.previous}}class Br extends op{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,"<"+M.toBinaryString(e|1<<this.bitCount).substring(1)+">"}}class qo 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 qo(this,e,t)}toString(){return"<"+this.binaryShiftStart+"::"+(this.binaryShiftStart+this.binaryShiftByteCount-1)+">"}}function sp(b,e,t){return new qo(b,e,t)}function ni(b,e,t){return new Br(b,e,t)}const ap=["UPPER","LOWER","DIGIT","MIXED","PUNCT"],qn=0,Fi=1,_n=2,sl=3,Mn=4,lp=new Br(null,0,0),Zo=[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 cp(b){for(let e of b)D.fill(e,-1);return b[qn][Mn]=0,b[Fi][Mn]=0,b[Fi][qn]=28,b[sl][Mn]=0,b[_n][Mn]=0,b[_n][qn]=15,b}const al=cp(D.createInt32Array(6,6));class Dn{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=Zo[this.mode][e];s=ni(s,d&65535,d>>16),n+=d>>16}let c=e===_n?4:5;return s=ni(s,t,c),new Dn(s,e,0,n+c)}shiftAndAppend(e,t){let n=this.token,s=this.mode===_n?4:5;return n=ni(n,al[this.mode][e],s),n=ni(n,t,5),new Dn(n,this.mode,0,this.bitCount+s+5)}addBinaryShiftChar(e){let t=this.token,n=this.mode,s=this.bitCount;if(this.mode===Mn||this.mode===_n){let h=Zo[n][qn];t=ni(t,h&65535,h>>16),s+=h>>16,n=qn}let c=this.binaryShiftByteCount===0||this.binaryShiftByteCount===31?18:this.binaryShiftByteCount===62?9:8,d=new Dn(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=sp(t,e-this.binaryShiftByteCount,this.binaryShiftByteCount),new Dn(t,this.mode,0,this.bitCount)}isBetterThanOrEqualTo(e){let t=this.bitCount+(Zo[this.mode][e.mode]>>16);return this.binaryShiftByteCount<e.binaryShiftByteCount?t+=Dn.calculateBinaryShiftCost(e)-Dn.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",ap[this.mode],this.bitCount,this.binaryShiftByteCount)}static calculateBinaryShiftCost(e){return e.binaryShiftByteCount>62?21:e.binaryShiftByteCount>31?20:e.binaryShiftByteCount>0?10:0}}Dn.INITIAL_STATE=new Dn(lp,qn,0,0);function dp(b){const e=ee.getCharCode(" "),t=ee.getCharCode("."),n=ee.getCharCode(",");b[qn][e]=1;const s=ee.getCharCode("Z"),c=ee.getCharCode("A");for(let S=c;S<=s;S++)b[qn][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[_n][e]=1;const g=ee.getCharCode("9"),w=ee.getCharCode("0");for(let S=w;S<=g;S++)b[_n][S]=S-w+2;b[_n][n]=12,b[_n][t]=13;const E=["\0"," ","","","","","","","\x07","\b"," ",`
29
+ `,"\v","\f","\r","\x1B","","","","","@","\\","^","_","`","|","~",""];for(let S=0;S<E.length;S++)b[sl][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[Mn][ee.getCharCode(A[S])]=S);return b}const Yo=dp(D.createInt32Array(5,256));class ri{constructor(e){this.text=e}encode(){const e=ee.getCharCode(" "),t=ee.getCharCode(`
30
+ `);let n=ol.singletonList(Dn.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=ri.updateStateListForPair(n,c,d),c++):n=this.updateStateListForChar(n,c)}return ol.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 ri.simplifyStates(n)}updateStateForChar(e,t,n){let s=this.text[t]&255,c=Yo[e.getMode()][s]>0,d=null;for(let h=0;h<=Mn;h++){let g=Yo[h][s];if(g>0){if(d==null&&(d=e.endBinaryShift(t)),!c||h===e.getMode()||h===_n){const w=d.latchAndAppend(h,g);n.push(w)}if(!c&&al[e.getMode()][h]>=0){const w=d.shiftAndAppend(h,g);n.push(w)}}}if(e.getBinaryShiftByteCount()>0||Yo[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(Mn,n)),e.getMode()!==Mn&&s.push(c.shiftAndAppend(Mn,n)),n===3||n===4){let d=c.latchAndAppend(_n,16-n).latchAndAppend(_n,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 Je{constructor(){}static encodeBytes(e){return Je.encode(e,Je.DEFAULT_EC_PERCENT,Je.DEFAULT_AZTEC_LAYERS)}static encode(e,t,n){let s=new ri(e).encode(),c=M.truncDivision(s.getSize()*t,100)+11,d=s.getSize()+c,h,g,w,E,A;if(n!==Je.DEFAULT_AZTEC_LAYERS){if(h=n<0,g=Math.abs(n),g>(h?Je.MAX_NB_BITS_COMPACT:Je.MAX_NB_BITS))throw new y(ee.format("Illegal value %s for layers",n));w=Je.totalBitsInLayer(g,h),E=Je.WORD_SIZE[g];let de=w-w%E;if(A=Je.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>Je.MAX_NB_BITS)throw new y("Data too large for an Aztec code");if(h=de<=3,g=h?de+1:de,w=Je.totalBitsInLayer(g,h),d>w)continue;(A==null||E!==Je.WORD_SIZE[g])&&(E=Je.WORD_SIZE[g],A=Je.stuffBits(s,E));let je=w-w%E;if(!(h&&A.getSize()>E*64)&&A.getSize()+c<=je)break}}let S=Je.generateCheckWords(A,w,E),O=A.getSize()/E,U=Je.generateModeMessage(h,g,O),H=(h?11:14)+g*4,Y=new Int32Array(H),ie;if(h){ie=H;for(let de=0;de<Y.length;de++)Y[de]=de}else{ie=H+1+2*M.truncDivision(M.truncDivision(H,2)-1,15);let de=M.truncDivision(H,2),je=M.truncDivision(ie,2);for(let Ve=0;Ve<de;Ve++){let sn=Ve+M.truncDivision(Ve,15);Y[de-Ve-1]=je-sn-1,Y[de+Ve]=je+sn+1}}let ue=new W(ie);for(let de=0,je=0;de<g;de++){let Ve=(g-de)*4+(h?9:12);for(let sn=0;sn<Ve;sn++){let In=sn*2;for(let an=0;an<2;an++)S.get(je+In+an)&&ue.set(Y[de*2+an],Y[de*2+sn]),S.get(je+Ve*2+In+an)&&ue.set(Y[de*2+sn],Y[H-1-de*2-an]),S.get(je+Ve*4+In+an)&&ue.set(Y[H-1-de*2-an],Y[H-1-de*2-sn]),S.get(je+Ve*6+In+an)&&ue.set(Y[H-1-de*2-sn],Y[de*2+an])}je+=Ve*8}if(Je.drawModeMessage(ue,h,ie,U),h)Je.drawBullsEye(ue,M.truncDivision(ie,2),5);else{Je.drawBullsEye(ue,M.truncDivision(ie,2),7);for(let de=0,je=0;de<M.truncDivision(H,2)-1;de+=15,je+=16)for(let Ve=M.truncDivision(ie,2)&1;Ve<ie;Ve+=2)ue.set(M.truncDivision(ie,2)-je,Ve),ue.set(M.truncDivision(ie,2)+je,Ve),ue.set(Ve,M.truncDivision(ie,2)-je),ue.set(Ve,M.truncDivision(ie,2)+je)}let me=new il;return me.setCompact(h),me.setSize(ie),me.setLayers(g),me.setCodeWords(O),me.setMatrix(ue),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=Je.generateCheckWords(s,28,4)):(s.appendBits(t-1,5),s.appendBits(n-1,11),s=Je.generateCheckWords(s,40,4)),s}static drawModeMessage(e,t,n,s){let c=M.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+M.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 Xo(Je.getGF(n)),d=M.truncDivision(t,n),h=Je.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 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 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}}Je.DEFAULT_EC_PERCENT=33,Je.DEFAULT_AZTEC_LAYERS=0,Je.MAX_NB_BITS=32,Je.MAX_NB_BITS_COMPACT=4,Je.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=jo.ISO_8859_1,h=Je.DEFAULT_EC_PERCENT,g=Je.DEFAULT_AZTEC_LAYERS;return c!=null&&(c.has(Vt.CHARACTER_SET)&&(d=rl.forName(c.get(Vt.CHARACTER_SET).toString())),c.has(Vt.ERROR_CORRECTION)&&(h=M.parseInt(c.get(Vt.ERROR_CORRECTION).toString())),c.has(Vt.AZTEC_LAYERS)&&(g=M.parseInt(c.get(Vt.AZTEC_LAYERS).toString()))),Vi.encodeLayers(e,t,n,s,d,h,g)}static encodeLayers(e,t,n,s,c,d,h){if(t!==he.AZTEC)throw new y("Can only encode AZTEC, but got "+t);let g=Je.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 Be;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 H=0,Y=E;H<c;H++,Y+=w)s.get(H,O)&&S.setRegion(Y,U,w,w);return S}}i.AbstractExpandedDecoder=vo,i.ArgumentException=C,i.ArithmeticException=_t,i.AztecCode=il,i.AztecCodeReader=Ir,i.AztecCodeWriter=Vi,i.AztecDecoder=et,i.AztecDetector=Bi,i.AztecDetectorResult=jr,i.AztecEncoder=Je,i.AztecHighLevelEncoder=ri,i.AztecPoint=Lt,i.BarcodeFormat=he,i.Binarizer=T,i.BinaryBitmap=I,i.BitArray=j,i.BitMatrix=W,i.BitSource=Vo,i.BrowserAztecCodeReader=Do,i.BrowserBarcodeReader=zg,i.BrowserCodeReader=xe,i.BrowserDatamatrixCodeReader=Gg,i.BrowserMultiFormatReader=ep,i.BrowserPDF417Reader=tp,i.BrowserQRCodeReader=np,i.BrowserQRCodeSvgWriter=ur,i.CharacterSetECI=F,i.ChecksumException=B,i.Code128Reader=pe,i.Code39Reader=Bt,i.DataMatrixDecodedBitStreamParser=Wn,i.DataMatrixReader=Xn,i.DecodeHintType=Z,i.DecoderResult=Qe,i.DefaultGridSampler=or,i.DetectorResult=Sr,i.EAN13Reader=ge,i.EncodeHintType=Vt,i.Exception=x,i.FormatException=V,i.GenericGF=De,i.GenericGFPoly=tt,i.GlobalHistogramBinarizer=X,i.GridSampler=qr,i.GridSamplerInstance=Pt,i.HTMLCanvasElementLuminanceSource=le,i.HybridBinarizer=$,i.ITFReader=st,i.IllegalArgumentException=y,i.IllegalStateException=Be,i.InvertedLuminanceSource=J,i.LuminanceSource=q,i.MathUtils=ve,i.MultiFormatOneDReader=Tr,i.MultiFormatReader=nl,i.MultiFormatWriter=ip,i.NotFoundException=N,i.OneDReader=Nt,i.PDF417DecodedBitStreamParser=ne,i.PDF417DecoderErrorCorrection=Ya,i.PDF417Reader=$t,i.PDF417ResultMetadata=Qa,i.PerspectiveTransform=nn,i.PlanarYUVLuminanceSource=On,i.QRCodeByteMatrix=Li,i.QRCodeDataMask=pn,i.QRCodeDecodedBitStreamParser=St,i.QRCodeDecoderErrorCorrectionLevel=pt,i.QRCodeDecoderFormatInformation=Yt,i.QRCodeEncoder=Et,i.QRCodeEncoderQRCode=dr,i.QRCodeMaskUtil=Rt,i.QRCodeMatrixUtil=Re,i.QRCodeMode=Te,i.QRCodeReader=$n,i.QRCodeVersion=Ie,i.QRCodeWriter=Rr,i.RGBLuminanceSource=$o,i.RSS14Reader=kt,i.RSSExpandedReader=ce,i.ReaderException=Pi,i.ReedSolomonDecoder=Ke,i.ReedSolomonEncoder=Xo,i.ReedSolomonException=Ae,i.Result=_e,i.ResultMetadataType=ye,i.ResultPoint=be,i.StringUtils=ee,i.UnsupportedOperationException=re,i.VideoInputDevice=ae,i.WhiteRectangleDetector=fn,i.WriterException=ft,i.ZXingArrays=D,i.ZXingCharset=rl,i.ZXingInteger=M,i.ZXingStandardCharsets=jo,i.ZXingStringBuilder=G,i.ZXingStringEncoding=K,i.ZXingSystem=v,i.createAbstractExpandedDecoder=qa,Object.defineProperty(i,"__esModule",{value:!0})})})(No,No.exports);var xt=No.exports;const Em=ul({__proto__:null,default:ra(xt)},[xt]);var Sa=function(){function a(l,i,o){if(this.formatMap=new Map([[Ce.QR_CODE,xt.BarcodeFormat.QR_CODE],[Ce.AZTEC,xt.BarcodeFormat.AZTEC],[Ce.CODABAR,xt.BarcodeFormat.CODABAR],[Ce.CODE_39,xt.BarcodeFormat.CODE_39],[Ce.CODE_93,xt.BarcodeFormat.CODE_93],[Ce.CODE_128,xt.BarcodeFormat.CODE_128],[Ce.DATA_MATRIX,xt.BarcodeFormat.DATA_MATRIX],[Ce.MAXICODE,xt.BarcodeFormat.MAXICODE],[Ce.ITF,xt.BarcodeFormat.ITF],[Ce.EAN_13,xt.BarcodeFormat.EAN_13],[Ce.EAN_8,xt.BarcodeFormat.EAN_8],[Ce.PDF_417,xt.BarcodeFormat.PDF_417],[Ce.RSS_14,xt.BarcodeFormat.RSS_14],[Ce.RSS_EXPANDED,xt.BarcodeFormat.RSS_EXPANDED],[Ce.UPC_A,xt.BarcodeFormat.UPC_A],[Ce.UPC_E,xt.BarcodeFormat.UPC_E],[Ce.UPC_EAN_EXTENSION,xt.BarcodeFormat.UPC_EAN_EXTENSION]]),this.reverseFormatMap=this.createReverseFormatMap(),!Em)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(xt.DecodeHintType.POSSIBLE_FORMATS,u),f.set(xt.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 xt.MultiFormatReader(this.verbose,this.hints),o=new xt.HTMLCanvasElementLuminanceSource(l),u=new xt.BinaryBitmap(new xt.HybridBinarizer(o)),f=i.decode(u);return{text:f.text,format:ya.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}(),ym=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())})},bm=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}}},Ia=function(){function a(l,i,o){if(this.formatMap=new Map([[Ce.QR_CODE,"qr_code"],[Ce.AZTEC,"aztec"],[Ce.CODABAR,"codabar"],[Ce.CODE_39,"code_39"],[Ce.CODE_93,"code_93"],[Ce.CODE_128,"code_128"],[Ce.DATA_MATRIX,"data_matrix"],[Ce.ITF,"itf"],[Ce.EAN_13,"ean_13"],[Ce.EAN_8,"ean_8"],[Ce.PDF_417,"pdf417"],[Ce.UPC_A,"upc_a"],[Ce.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 ym(this,void 0,void 0,function(){var i,o;return bm(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:ya.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}(),Na=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())})},Ta=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}}},Am=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&&Ia.isSupported()?(this.primaryDecoder=new Ia(l,o,u),this.secondaryDecoder=new Sa(l,o,u)):this.primaryDecoder=new Sa(l,o,u)}return a.prototype.decodeAsync=function(l){return Na(this,void 0,void 0,function(){var i;return Ta(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 Na(this,void 0,void 0,function(){var i,o;return Ta(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}(),To=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)}}(),Ii=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())})},Ni=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}}},ka=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}(),Sm=function(a){To(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}(ka),Im=function(a){To(l,a);function l(i){return a.call(this,"zoom",i)||this}return l}(Sm),Nm=function(a){To(l,a);function l(i){return a.call(this,"torch",i)||this}return l}(ka),Tm=function(){function a(l){this.track=l}return a.prototype.zoomFeature=function(){return new Im(this.track)},a.prototype.torchFeature=function(){return new Nm(this.track)},a}(),km=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 Ii(this,void 0,void 0,function(){var f,m;return Ni(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 Ii(this,void 0,void 0,function(){return Ni(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 Tm(this.getFirstTrackOrFail())},a}(),Rm=function(){function a(l){this.mediaStream=l}return a.prototype.render=function(l,i,o){return Ii(this,void 0,void 0,function(){return Ni(this,function(u){return[2,km.create(l,this.mediaStream,i,o)]})})},a.create=function(l){return Ii(this,void 0,void 0,function(){var i,o;return Ni(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}(),Ra=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())})},Ba=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}}},Bm=function(){function a(){}return a.failIfNotSupported=function(){return Ra(this,void 0,void 0,function(){return Ba(this,function(l){if(!navigator.mediaDevices)throw"navigator.mediaDevices not supported";return[2,new a]})})},a.prototype.create=function(l){return Ra(this,void 0,void 0,function(){return Ba(this,function(i){return[2,Rm.create(l)]})})},a}(),Om=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())})},Mm=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}}},Dm=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=yr.unableToQuerySupportedDevices();return a.isHttpsOrLocalhost()||(l=yr.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 Om(this,void 0,void 0,function(){var l,i,o,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 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}(),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 vm=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 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}(),Pm=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}(),Lm=function(){function a(){}return a.create=function(){return new Pm(new vm)},a}(),Fm=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)}}(),un=function(a){Fm(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}(_m),Vm=function(){function a(l,i){this.logger=i,this.fps=un.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=un.DEFAULT_DISABLE_FLIP}return a.prototype.isMediaStreamConstraintsValid=function(){return this.videoConstraints?Aa.isMediaStreamConstraintsValid(this.videoConstraints,this.logger):(this.logger.logError("Empty videoConstraints",!0),!1)},a.prototype.isShadedBoxEnabled=function(){return!Vn(this.qrbox)},a.create=function(l,i){return new a(l,i)},a}(),Oa=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 Cm(this.verbose),this.qrcode=new Am(this.getSupportedFormats(i),this.getUseBarCodeDetectorIfSupported(o),this.verbose,this.logger),this.foreverScanTimeout,this.shouldScan=!0,this.stateManagerProxy=Lm.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=Vm.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:un.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(B,T){var v=x?p.videoConstraints:y.createVideoConstraints(l);if(!v){I.cancel(),T("videoConstraints should be defined");return}var k={};(!x||p.aspectRatio)&&(k.aspectRatio=p.aspectRatio);var P={onRenderSurfaceReady:function(D,M){y.setupUi(D,M,p),y.isScanning=!0,y.foreverScan(p,o,m)}};Bm.failIfNotSupported().then(function(D){D.create(v).then(function(M){return M.render(f.element,k,P).then(function(j){y.renderedCamera=j,I.execute(),B(null)}).catch(function(j){I.cancel(),T(j)})}).catch(function(M){I.cancel(),T(yr.errorGettingUserMedia(M))})}).catch(function(D){I.cancel(),T(yr.cameraStreamingNotSupported())})})},a.prototype.pause=function(l){if(!this.stateManagerProxy.isStrictlyScanning())throw"Cannot pause, scanner is not scanning.";this.stateManagerProxy.directTransition(It.PAUSED),this.showPausedState(),(Vn(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 o=function(){if(l.element){var f=document.getElementById(un.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(Vn(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:un.DEFAULT_WIDTH,y=Math.max(x.clientHeight?x.clientHeight:_,un.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 v=un.FILE_SCAN_HIDDEN_CANVAS_PADDING,k=Math.max(m.width,I.width),P=Math.max(m.height,I.height),D=k+2*v,M=P+2*v,j=o.createCanvasElement(D,M);x.appendChild(j);var z=j.getContext("2d");if(!z)throw"Unable to get 2d context from canvas";z.canvas.width=D,z.canvas.height=M,z.drawImage(m,0,0,p,_,v,v,k,P);try{o.qrcode.decodeRobustlyAsync(j).then(function(Z){u(ba.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 Dm.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(!Aa.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=[Ce.QR_CODE,Ce.AZTEC,Ce.CODABAR,Ce.CODE_39,Ce.CODE_93,Ce.CODE_128,Ce.DATA_MATRIX,Ce.MAXICODE,Ce.ITF,Ce.EAN_13,Ce.EAN_8,Ce.PDF_417,Ce.RSS_14,Ce.RSS_EXPANDED,Ce.UPC_A,Ce.UPC_E,Ce.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];xm(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(Vn(l))return!0;if(!Vn(l.useBarCodeDetectorIfSupported))return l.useBarCodeDetectorIfSupported!==!1;if(Vn(l.experimentalFeatures))return!0;var i=l.experimentalFeatures;return Vn(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<un.MIN_QR_BOX_SIZE)throw"minimum size of 'config.qrbox' dimension value is"+" ".concat(un.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=Vn(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=yr.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,ba.createFromQrcodeResult(u)),o.possiblyUpdateShaders(!0),!0}).catch(function(u){o.possiblyUpdateShaders(!1);var f=yr.codeParseError(u);return i(f,wm.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?un.BORDER_SHADER_MATCH_COLOR:un.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=Vn(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(un.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=un.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}(),Ma;(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"})(Ma||(Ma={}));const Um={width:"38",height:"38",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"none"},zm=["stroke"],Hm=["stroke"],Gm=["stroke"],Wm=["stroke"],Xm=["stroke"],$m=r.defineComponent({__name:"QR",props:{color:{type:String,required:!1,default:"#FFFFFF"}},setup(a){return(l,i)=>(r.openBlock(),r.createElementBlock("svg",Um,[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,zm),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,Hm),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,Gm),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,Wm),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,Xm)]))}}),ko={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"]},jm={key:0,class:"qr_text"},qm=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=bt(),{itemThemes:C}=we.storeToRefs(x),y=l,I=P=>P.replace(/^[\s\S]*?((?:tel|sms|smsto|mailto|callto|facetime|viber|whatsapp):)?[\s\S]*?(%2B)?[\s\S]*?/i,(D,M,j)=>j?"+":""),B=async(P,D)=>{var Z,V,L;if(console.log(P,D),p.value)return;i.isQr||(p.value=!0),k();const M=/[?&]table_id=([a-zA-Z0-9-]+)/,j=P.match(M),z=P.match(/\/([a-f0-9\-]{36})\?/);if(i.isQr){if(j&&z)return(Z=i.takeDataTable)==null?void 0:Z.call(i,z[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 bn,re=P||D.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=()=>{},v=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 Oa("reader");const P=await Oa.getCameras();if(!P||P.length===0){console.error("Камеры не найдены"),u.value=!1;return}let D;if(i.isQr)D=P.find(z=>ko.back.some(Z=>new RegExp(Z,"i").test(z.label))),D||(D=P.find(z=>ko.front.some(Z=>new RegExp(Z,"i").test(z.label))));else if(D=P.find(z=>ko.front.some(Z=>new RegExp(Z,"i").test(z.label))),D||(D=P.find(z=>new RegExp("amera","i").test(z.label))),!D){y("update:is_notification",!0),y("update:notificationData",{textNotification:"Не найдена фронтальная камера. Для сканирования карт нужна фронтальная камера."}),u.value=!1,y("update:is_toggleAffiliation",!0);return}const M=i.isQr?[Ce.QR_CODE]:[Ce.QR_CODE,Ce.PDF_417,Ce.EAN_13,Ce.EAN_8,Ce.CODE_128],j={fps:60,qrbox:{width:320,height:500}};await o.start(D.id,j,B,T,void 0,M),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,D)=>(r.openBlock(),r.createElementBlock("div",null,[(r.openBlock(),r.createBlock(r.Teleport,{to:"body"},[r.withDirectives(r.createElementVNode("div",{class:"blackWindow",onClick:k},[D[0]||(D[0]=r.createElementVNode("div",{id:"reader"},null,-1)),f.value&&!a.isQr?(r.openBlock(),r.createElementBlock("p",jm,"Наведите QR на камеру")):r.createCommentVNode("",!0)],512),[[r.vShow,u.value]])])),r.createVNode($m,{color:a.isQr?void 0:"#FFFFFF",onClick:v},null,8,["color"])]))}}),Ti=Symbol("clickOutside"),Zm={mounted(a,l){a[Ti]=i=>{a.contains(i.target)||l.value(i)},document.addEventListener("click",a[Ti])},unmounted(a){a[Ti]&&document.removeEventListener("click",a[Ti])}};let nr=[],Ro;const Da=["#FFD700","#FF6B8A","#7ECFC0","#C4B5FD","#FFA726","#EF5350","#AB47BC","#66BB6A","#42A5F5","#FFCA28"];class va{constructor(l){ke(this,"x");ke(this,"y");ke(this,"vx");ke(this,"vy");ke(this,"color");ke(this,"size");ke(this,"rotation");ke(this,"rotationSpeed");ke(this,"gravity");ke(this,"friction");ke(this,"opacity");ke(this,"fadeSpeed");ke(this,"shape");ke(this,"width");ke(this,"height");ke(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=Da[Math.floor(Math.random()*Da.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 Ym={mounted(a){const l=a.getContext("2d"),i=()=>{l.clearRect(0,0,window.innerWidth,window.innerHeight);for(let o of nr)o.update(),o.draw();nr=nr.filter(o=>o.opacity>0),nr.length>0&&(Ro=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++)nr.push(new va(l));i()},400),setTimeout(()=>{for(let o=0;o<40;o++)nr.push(new va(l))},900)},unmounted(a){window.removeEventListener("resize",a._resize),Ro&&cancelAnimationFrame(Ro),nr=[]}},Km={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,ae=N[0].length;for(let oe=0;oe<le;oe++)for(let xe=0;xe<ae;xe++){const _e=N[oe][xe];if(!_e)continue;const Pe=J?X+(ae-1-xe)*q:X+xe*q,he=$+oe*q;W.fillStyle=_e,W.fillRect(Pe,he,q,q)}}let v,k,P,D,M,j,z,Z,V,L,F,re=!1;function K(){Z=a.height*.46,k=-20*i,P=Z,D=3.2,M=0,v="enter",j=0,z=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)),(v==="enter"||v==="exit")&&(z++,z>=6&&(z=0,j=(j+1)%3));const X=[x,C,y];if(v==="enter")k+=D,T(l,X[j],k,P,i,!1),k+5*i>=ee()&&(v="bump_up",D=0,M=-7);else if(v==="bump_up")M+=.7,P+=M,T(l,I,k,P,i,!1),M>=0&&(v="bump_down",F=!0,L=-10,V=P-10*i);else if(v==="bump_down")M+=.7,P+=M,T(l,I,k,P,i,!1),P>=Z&&(P=Z,M=0,D=-3.2,v="exit");else if(v==="exit"&&(k+=D,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 Qm{constructor(l){ke(this,"value");ke(this,"next");this.value=l}}class Jm{constructor(){Ui(this,tn);Ui(this,Hn);Ui(this,ir);this.clear()}enqueue(l){const i=new Qm(l);wn(this,tn)?(wn(this,Hn).next=i,vn(this,Hn,i)):(vn(this,tn,i),vn(this,Hn,i)),Ko(this,ir)._++}dequeue(){const l=wn(this,tn);if(l)return vn(this,tn,wn(this,tn).next),Ko(this,ir)._--,wn(this,tn)||vn(this,Hn,void 0),l.value}peek(){if(wn(this,tn))return wn(this,tn).value}clear(){vn(this,tn,void 0),vn(this,Hn,void 0),vn(this,ir,0)}get size(){return wn(this,ir)}*[Symbol.iterator](){let l=wn(this,tn);for(;l;)yield l.value,l=l.next}*drain(){for(;wn(this,tn);)yield this.dequeue()}}tn=new WeakMap,Hn=new WeakMap,ir=new WeakMap;function eg(a){Pa(a);const l=new Jm;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(_){Pa(_),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 Pa(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 en=null;const La=eg(5),tg=async(a,l)=>{en&&og();const i=lt(),o=bt(),u=Gr(),f=Ut(),{itemThemes:m}=we.storeToRefs(o),{displayCards:p}=we.storeToRefs(i),{is_notification_lib:_,notificationData_lib:x}=we.storeToRefs(u),{stateCard:C,openProduct:y}=we.storeToRefs(f),I=bn.create();await ng(a),en=Lr(`wss://${l}/ws/org-unit/${a}/`,{heartbeatTimeout:3e4}),en.on("open",()=>console.warn("Realtime WebSocket подключён (pointId:",a,")")),en.on("error",B=>console.warn("WebSocket ошибка:",B)),en.on("close",()=>console.warn("Realtime WebSocket закрыт")),en.on("message",async B=>{try{if(B.type||B.method&&B.method!=="update_menu")return;m.value.kiosk_hide_menu_update_notification||(x.value.textNotification="Мы обновили меню");const T=B.params||B,v=T.active_groups||[],k=T.updated_groups||[],P=T.updated_product_groups||[],D=await Yn(),M=new Set(v.map(K=>K)),j=new Map(p.value.map(K=>[K.id,K])),z=[],Z=D.transaction("groups","readwrite");let L=await Z.objectStore("groups").openCursor();for(;L;){const K=L.key;!M.has(K)&&K!==a&&(z.push(K),await L.delete(),j.delete(K)),L=await L.continue()}await Z.done,p.value=Array.from(j.values()),z.length>0&&await rg(M);const F=[...k.map(K=>La(async()=>{const[ee,G]=await Promise.all([I.getGroupByID(K),I.loadGroupProducts(K)]);ee.products=G,j.set(K,ee),await Dr(K,ee),await Va(ee,G,!0)})),...P.map(K=>La(async()=>{const[ee,G]=await Promise.all([I.getGroupByID(K),I.loadGroupProducts(K)]);ee.products=G,j.set(K,ee),await Dr(K,ee),await Va(ee,G,!0),await ig(G,K)}))];await Promise.all(F),p.value=Array.from(j.values()),await kl(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)}}),en.connect()},ng=async a=>{try{const l=lt(),i=await qi(a);i!=null&&i.data&&(l.displayCards=i.data)}catch(l){console.error("Ошибка загрузки кэша групп:",l)}},Fa=async a=>{const l=lt(),i=Gr(),o=Ut(),{stateCard:u,openProduct:f}=we.storeToRefs(o),{cartProducts_lib:m}=we.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()}},rg=async a=>{await Fa(l=>{var i;return(i=l.groups)!=null&&i.length?!l.groups.some(o=>a.has(o)):!0})},ig=async(a,l)=>{const i=lt(),o=new Set(a.filter(u=>!u.adult||i.is18Allowed).map(u=>u.id));await Fa(u=>{var f;return(f=u.groups)!=null&&f.includes(l)?!o.has(u.id):!1})},Va=async(a,l,i=!0)=>{if(a.video_link&&ki(a.video_link,`${a.id}_video`,i),a.image_link&&ki(a.image_link,`${a.id}_image`,i),l!=null&&l.length)for(const o of l)o.video_link&&ki(o.video_link,`${o.id}_video`,i),o.image_link&&ki(o.image_link,`${o.id}_image`,i)},ki=async(a,l,i=!1)=>{try{const o=ai();if(!i){const m=await fr(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)}},og=()=>{en&&(en.off("open"),en.off("message"),en.off("error"),en.off("close"),en.close(!0),en=null)},sg={key:0,class:"valentine-hearts"},ag=r.defineComponent({__name:"FallingHearts",props:{symbols:{default:()=>["❤","♥","💕"]},max:{default:15},interval:{default:1500}},setup(a){const l=a,i=mt.useDocumentVisibility(),o=mt.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),v=m(.6,.9),k=Math.floor(m(1,6)),D={id:crypto.randomUUID(),icon:C,style:{left:`${I}%`,fontSize:`${y}px`,color:`rgba(255, 105, 180, ${v})`,animationName:`heartFall${k}`,animationDuration:`${B}s`,animationDelay:`${T}s`}};u.value.push(D);const j=setTimeout(()=>{u.value=u.value.filter(z=>z.id!==D.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",sg,[(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))]))}}),lg=["src"],cg=r.defineComponent({__name:"BasketImage",props:{id:{},fallback:{}},setup(a){const l=a,{mediaUrl:i}=An(()=>l.id,()=>l.fallback);return(o,u)=>(r.openBlock(),r.createElementBlock("img",{src:r.unref(i)||""},null,8,lg))}}),dg={class:"button_price_bg"},ug={class:"wrapper_container_price_bg"},fg={class:"button_price"},hg={key:0,class:"image_product_container"},mg=r.defineComponent({__name:"BasketButton",emits:["goToCart"],setup(a,{emit:l}){const i=l,o=Ne.useRouter(),u=lt(),f=Ln(),{totalPrice_lib:m,cartProducts_lib:p,cartBasketBumpKey:_}=we.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",dg,[r.createElementVNode("div",ug,[r.createElementVNode("div",fg,[r.unref(m)>0&&C.value.length>0?(r.openBlock(),r.createElementBlock("div",hg,[(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(cg,{id:T.id,fallback:T.fallback,class:"img_product"},null,8,["id","fallback"])]))),128))])):r.createCommentVNode("",!0),(r.openBlock(),r.createBlock(r.unref(Dt.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(gt,{price:x.value,fixedFloat:2},null,8,["price"]),B[0]||(B[0]=r.createTextVNode(" ₽",-1))])]),_:1},8,["animate"]))])])]))}}),Xr=null,{min:rr,max:Sn,abs:Ua,floor:gg}=Math,za=(a,l,i)=>rr(i,Sn(l,a)),Ha=a=>[...a].sort((l,i)=>l-i),pg=typeof queueMicrotask=="function"?queueMicrotask:a=>{Promise.resolve().then(a)},Bo=()=>{let a;return[new Promise(l=>{a=l}),a]},Ga=a=>{let l;return()=>(a&&(l=a(),a=void 0),l)},$r=(a,l,i)=>{const o=i?"unshift":"push";for(let u=0;u<l;u++)a[o](-1);return a},Wa=(a,l)=>{const i=a.t[l];return i===-1?a.o:i},xg=(a,l,i)=>{const o=a.t[l]===-1;return a.t[l]=i,a.i=rr(l,a.i),o},Ri=(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+=Wa(a,i),a.u[++i]=o;return a.i=l,o},br=(a,l,i=0,o=a.l-1)=>{let u=i;for(;i<=o;){const f=gg((i+o)/2);Ri(a,f)<=l?(u=f,i=f+1):o=f-1}return za(u,0,a.l-1)},Xa=(a,l,i)=>{const o=l-a.l;return a.i=i?-1:rr(l-1,a.i),a.l=l,o>0?($r(a.u,o),$r(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))},_g=a=>a.documentElement,wg=a=>a.ownerDocument,Cg=a=>a.defaultView,$a=Ga(()=>!!/iP(hone|od|ad)/.test(navigator.userAgent)||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>0),Eg=Ga(()=>"scrollBehavior"in _g(document).style),yg=(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,v=Xr,k=[0,f?Sn(i-1,0):-1],P=0,D=!1;const M=((G,W,N)=>({o:W,t:N?$r(N.slice(0,rr(G,N.length)),Sn(0,G-N.length)):$r([],G),l:G,i:-1,u:$r([],G+1)}))(a,o?o[1]:l,o&&o[0]),j=new Set,z=()=>x-_,Z=()=>z()+y+C,V=(G,W)=>((N,X,$,q)=>{if(q=rr(q,N.l-1),Ri(N,q)<=X){const J=br(N,$,q);return[br(N,X,q,J),J]}{const J=br(N,X,void 0,q);return[J,br(N,$,J)]}})(M,G,W,k[0]),L=()=>Ri(M,M.l),F=(G,W)=>{const N=Ri(M,G)-y;return W?L()-N-re(G):N},re=G=>Wa(M,G),K=(G,W=-1)=>M.t[G]===W,ee=G=>{G&&($a()&&B!==0||v&&T===1?y+=G:C+=G)};return{p:()=>{j.clear()},h:()=>m,m:()=>(G=>[G.t.slice(),G.o])(M),v:(G=200)=>{if(!D||f)return k;let W,N;if(I)[W,N]=k;else{let X=Sn(0,Z()),$=X+p;u||(G=Sn(0,G),B!==1&&(X-=G),B!==2&&($+=G)),[W,N]=k=V(Sn(0,X),Sn(0,$)),v&&(W=rr(W,v[0]),N=Sn(N,v[1]))}return[Sn(W,0),rr(N,M.l-1)]},S:G=>br(M,G-_),I:K,O:F,k:re,j:()=>M.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=Ua(J);q&&le<Ua(q)+1||T!==0||(B=J<0?2:1),f&&(f=!1),x=W,$=4;const ae=z();ae>=-p&&ae<=L()&&($+=1,X=le>p);break}case 2:$=8,B!==0&&(N=!0,$+=1),B=0,T=0,v=Xr;break;case 3:{const q=W.filter(([J,le])=>!K(J,le));if(!q.length)break;ee(q.reduce((J,[le,ae])=>((T===2||(v&&T===1?le<v[0]:F(le+(B===0&&T===0?1:0))<z()))&&(J+=ae-re(le)),J),0));for(const[J,le]of q){const ae=re(J),oe=xg(M,J,le);u&&(P+=oe?le:le-ae)}u&&p&&P>p&&(ee(((J,le)=>{let ae=0;const oe=[];J.t.forEach((ye,Qe)=>{ye!==-1&&(oe.push(ye),Qe<le&&ae++)}),J.i=-1;const xe=Ha(oe),_e=xe.length,Pe=_e/2|0,he=_e%2==0?(xe[Pe-1]+xe[Pe])/2:xe[Pe],qe=J.o;return((J.o=he)-qe)*Sn(le-ae,0)})(M,br(M,Z()))),u=!1),$=3,X=!0;break}case 4:p!==W&&(p||(D=X=!0),p=W,$=3);break;case 5:W[1]?(ee(Xa(M,W[0],!0)),T=2,$=1):(Xa(M,W[0]),$=1);break;case 6:_=W;break;case 7:T=1;break;case 8:v=V(W,W+p),$=1}$&&(m=1+(2147483647&m),N&&y&&(C+=y,y=0),j.forEach(([q,J])=>{$&q&&J(X)}))}}},Oo=setTimeout,Mo=(a,l)=>l?-a:a,bg=(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 D=()=>{P!=Xr&&clearTimeout(P)},M=()=>{D(),P=Oo(()=>{P=Xr,(()=>{if(_||x)return _=!1,void I();C=!1,a.A(2)})()},150)};return M.C=D,M})(),B=()=>{p=m(),C&&(y=!0),a.A(1,o()),I()},T=P=>{if(_||!a.B()||P.ctrlKey)return;const D=m()-p;150>D&&50<D&&(i?P.deltaX:P.deltaY)&&(_=!0)},v=()=>{x=!0,C=y=!1},k=()=>{x=!1,$a()&&(C=!0)};return l.addEventListener("scroll",B),l.addEventListener("wheel",T,{passive:!0}),l.addEventListener("touchstart",v,{passive:!0}),l.addEventListener("touchend",k,{passive:!0}),{H:()=>{l.removeEventListener("scroll",B),l.removeEventListener("wheel",T),l.removeEventListener("touchstart",v),l.removeEventListener("touchend",k),I.C()},V:()=>{const[P,D]=a.P();P&&(u(P,D,y),y=!1,D&&a.T()>a.M()&&a.A(1,o()))}}},Ag=(a,l,i)=>{let o;return[async(u,f)=>{if(!await l())return;o&&o();const m=()=>{const[p,_]=Bo();return o=()=>{_(!1)},a.T()&&Oo(o,150),[p,a.R(2,()=>{_(!0)})]};if(f&&Eg())a.A(8,u()),pg(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()}]},Sg=a=>{let l;return{F(i){(l||(l=new(Cg(wg(i))).ResizeObserver(a))).observe(i)},J(i){l.unobserve(i)},H(){l&&l.disconnect()}}},Ig=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}}}),Ng=(a,l)=>{const i=a.key;return i??"_"+l},Tg=(a,l)=>a[0]===l[0]&&a[1]===l[1],ja=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=yg(a.data.length,a.itemSize,a.ssrCount,a.cache,!a.itemSize),_=((T,v)=>{let k;const P=v?"width":"height",D=new WeakMap,M=Sg(j=>{const z=[];for(const{target:Z,contentRect:V}of j)if(Z.offsetParent)if(Z===k)T.A(4,V[P]);else{const L=D.get(Z);L!=Xr&&z.push([L,V[P]])}z.length&&T.A(3,z)});return{te(j){M.F(k=j)},re:(j,z)=>(D.set(j,z),M.F(j),()=>{D.delete(j),M.J(j)}),p:M.H}})(p,f),x=((T,v)=>{let k,P,D=Bo(),M=!1;const j=v?"scrollLeft":"scrollTop",z=v?"overflowX":"overflowY",[Z,V]=Ag(T,()=>D[0],(L,F)=>{L=Mo(L,M),F?k.scrollTo({[v?"left":"top"]:L,behavior:"smooth"}):k[j]=L});return{oe(L){k=L,v&&(M=getComputedStyle(L).direction==="rtl"),P=bg(T,L,v,()=>Mo(L[j],M),(F,re,K)=>{if(K){const ee=L.style,G=ee[z];ee[z]="hidden",Oo(()=>{ee[z]=G})}L[j]=Mo(T.N()+F,M),re&&V()}),D[1](!0)},p(){P&&P.H(),D[1](!1),D=Bo()},ne:()=>M,se(L){Z(()=>L)},ie(L){L+=T.N(),Z(()=>L)},le(L,{align:F,smooth:re,offset:K=0}={}){if(L=za(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 v=p.v(a.bufferSize);return T&&Tg(T,v)?T:v}),I=r.computed(()=>C.value&&p.B()),B=r.computed(()=>C.value&&p.M());return r.onMounted(()=>{u=!1;const T=requestAnimationFrame(()=>{const v=k=>{_.te(k),x.oe(k)};a.scrollRef?v(a.scrollRef):v(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=>Sn(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,v=a.item,k=B.value,P=x.ne(),D=!f&&P?"unshift":"push",M=[],j=Z=>{var V;const L=o.default({item:a.data[Z],index:Z})[0];return r.createVNode(Ig,{key:Ng(L,Z),L:C,W:p,Y:_.re,D:Z,X:L,U:f,K:P,G:u,Z:v,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);Ha([...Z]).forEach(V=>{M[D](j(V))})}else for(let[Z,V]=y.value;Z<=V;Z++)M[D](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(z=M)=="function"||Object.prototype.toString.call(z)==="[object Object]"&&!r.isVNode(z)?M:{default:()=>[M],_:2},8,["style"]);var z}}}),kg=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(ja,{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 _}}}),Rg=(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 Bg(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 Rg(u.value),!!u.value))){if(f.value=u.value.scrollSize>u.value.viewportSize,!f.value){o=!1;return}o=!0,m.value=r.toValue(l==null?void 0:l.mode)||"loop",await r.nextTick(),u.value&&u.value.scrollToIndex(m.value==="loop"?p.value*3:0,{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,D=p.value*4;if(k<P)return I(p.value*3-1,{align:"start"});if(k>=D)return I(p.value*3,{align:"start"})},v=()=>{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)),r.watch(()=>l==null?void 0:l.mode,()=>C),{listRef:u,items:x,hasScroll:f,realIndex:y,findNearestIndex:B,scrollToIndex:I,init:C,onScroll:v}}const Og=Object.prototype.toString,Mg=a=>Og.call(a)==="[object Error]",Dg=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"]),vg=a=>{if(!(a&&Mg(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:Dg.has(i)},Pg={pinch:!0,doubleTap:!0,wheel:!0,buttons:["+","-","=","0"]},Lg=a=>{var i;const l=Object.assign({},Pg,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(fe,"useRoute",{enumerable:!0,get:()=>Ne.useRoute}),Object.defineProperty(fe,"useRouter",{enumerable:!0,get:()=>Ne.useRouter}),fe.BasketButton=mg,fe.BottomSheet=wo,fe.ButtonDefault=cn,fe.CardMain=wa,fe.CardProductPage=I0,fe.CardReader=fa,fe.CartBox=ua,fe.CartPage=e2,fe.DrumItem=im,fe.FallingHearts=ag,fe.GroupMain=Q2,fe.InitConnection=bn,fe.ModalWindows=pm,fe.NotificationWindow=yi,fe.OrderBox=So,fe.PopupWindowDefault=da,fe.PricePrerender=hr,fe.QrCameraScanner=qm,fe.QrcodeVue=xa,fe.Recommendation=fm,fe.RetryPage=u2,fe.SystemNotification=xo,fe.TableOrderPage=L2,fe.TagsMain=em,fe.VList=kg,fe.Virtualizer=ja,fe.clearAllProductDB=Bl,fe.clearLocalStorage=mr,fe.getCachedGroup=qi,fe.getCachedProduct=os,fe.getWebSocketInstance=Lr,fe.initPinia=fl,fe.initRouter=ml,fe.isNetworkError=vg,fe.parseTheme=sa,fe.preventZoom=Lg,fe.updateIndexedDB=tg,fe.useCachedMedia=An,fe.useCardLibStore=Ut,fe.useCartLibStore=vt,fe.useImageCacheStore=ai,fe.useMainLibStore=lt,fe.useModal=Ao,fe.useModalStore=Ai,fe.useModulesLibStore=Gr,fe.usePdf=zn,fe.useTableStore=Ln,fe.useThemeStore=bt,fe.useVirtuaLoop=Bg,fe.vClickOutside=Zm,fe.vConfetti=Ym,fe.vDragScroll=Wr,fe.vMario=Km,fe.vMuted=Cr,Object.defineProperty(fe,Symbol.toStringTag,{value:"Module"})});