@inno_user/inno_clouds_lib 9.4.7 → 9.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,22 +1,22 @@
1
- (function(he,Te){typeof exports=="object"&&typeof module<"u"?Te(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"],Te):(he=typeof globalThis<"u"?globalThis:he||self,Te(he.InnoCloudsLib={},he.VueRouter,he.Pinia,he.Vue,he.VueuseCore,he.motionV))})(this,function(he,Te,we,r,yt,Ot){"use strict";var Hg=Object.defineProperty;var sl=he=>{throw TypeError(he)};var Gg=(he,Te,we)=>Te in he?Hg(he,Te,{enumerable:!0,configurable:!0,writable:!0,value:we}):he[Te]=we;var Re=(he,Te,we)=>Gg(he,typeof Te!="symbol"?Te+"":Te,we),al=(he,Te,we)=>Te.has(he)||sl("Cannot "+we);var wn=(he,Te,we)=>(al(he,Te,"read from private field"),we?we.call(he):Te.get(he)),Ui=(he,Te,we)=>Te.has(he)?sl("Cannot add the same private member more than once"):Te instanceof WeakSet?Te.add(he):Te.set(he,we),Pn=(he,Te,we,r)=>(al(he,Te,"write to private field"),r?r.call(he,we):Te.set(he,we),we);var Zo=(he,Te,we,r)=>({set _(yt){Pn(he,Te,yt,we)},get _(){return wn(he,Te,r)}});var en,Gn,sr;function cl(a,l){for(var o=0;o<l.length;o++){const i=l[o];if(typeof i!="string"&&!Array.isArray(i)){for(const u in i)if(u!=="default"&&!(u in a)){const f=Object.getOwnPropertyDescriptor(i,u);f&&Object.defineProperty(a,u,f.get?f:{enumerable:!0,get:()=>i[u]})}}}return Object.freeze(Object.defineProperty(a,Symbol.toStringTag,{value:"Module"}))}function dl(a){return a}const ul=[];function fl(){return Te.createRouter({history:Te.createWebHistory(),routes:ul})}const zi=(a,l)=>l.some(o=>a instanceof o);let Yo,Ko;function hl(){return Yo||(Yo=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function ml(){return Ko||(Ko=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}const Hi=new WeakMap,Gi=new WeakMap,ri=new WeakMap;function gl(a){const l=new Promise((o,i)=>{const u=()=>{a.removeEventListener("success",f),a.removeEventListener("error",m)},f=()=>{o(Hn(a.result)),u()},m=()=>{i(a.error),u()};a.addEventListener("success",f),a.addEventListener("error",m)});return ri.set(l,a),l}function pl(a){if(Hi.has(a))return;const l=new Promise((o,i)=>{const u=()=>{a.removeEventListener("complete",f),a.removeEventListener("error",m),a.removeEventListener("abort",m)},f=()=>{o(),u()},m=()=>{i(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,o){if(a instanceof IDBTransaction){if(l==="done")return Hi.get(a);if(l==="store")return o.objectStoreNames[1]?void 0:o.objectStore(o.objectStoreNames[0])}return Hn(a[l])},set(a,l,o){return a[l]=o,!0},has(a,l){return a instanceof IDBTransaction&&(l==="done"||l==="store")?!0:l in a}};function Qo(a){Wi=a(Wi)}function xl(a){return ml().includes(a)?function(...l){return a.apply(Xi(this),l),Hn(this.request)}:function(...l){return Hn(a.apply(Xi(this),l))}}function wl(a){return typeof a=="function"?xl(a):(a instanceof IDBTransaction&&pl(a),zi(a,hl())?new Proxy(a,Wi):a)}function Hn(a){if(a instanceof IDBRequest)return gl(a);if(Gi.has(a))return Gi.get(a);const l=wl(a);return l!==a&&(Gi.set(a,l),ri.set(l,a)),l}const Xi=a=>ri.get(a);function _l(a,l,{blocked:o,upgrade:i,blocking:u,terminated:f}={}){const m=indexedDB.open(a,l),p=Hn(m);return i&&m.addEventListener("upgradeneeded",w=>{i(Hn(m.result),w.oldVersion,w.newVersion,Hn(m.transaction),w)}),o&&m.addEventListener("blocked",w=>o(w.oldVersion,w.newVersion,w)),p.then(w=>{f&&w.addEventListener("close",()=>f()),u&&w.addEventListener("versionchange",x=>u(x.oldVersion,x.newVersion,x))}).catch(()=>{}),p}function Cl(a,{blocked:l}={}){const o=indexedDB.deleteDatabase(a);return l&&o.addEventListener("blocked",i=>l(i.oldVersion,i)),Hn(o).then(()=>{})}const El=["get","getKey","getAll","getAllKeys","count"],yl=["put","add","delete","clear"],$i=new Map;function Jo(a,l){if(!(a instanceof IDBDatabase&&!(l in a)&&typeof l=="string"))return;if($i.get(l))return $i.get(l);const o=l.replace(/FromIndex$/,""),i=l!==o,u=yl.includes(o);if(!(o in(i?IDBIndex:IDBObjectStore).prototype)||!(u||El.includes(o)))return;const f=async function(m,...p){const w=this.transaction(m,u?"readwrite":"readonly");let x=w.store;return i&&(x=x.index(p.shift())),(await Promise.all([x[o](...p),u&&w.done]))[0]};return $i.set(l,f),f}Qo(a=>({...a,get:(l,o,i)=>Jo(l,o)||a.get(l,o,i),has:(l,o)=>!!Jo(l,o)||a.has(l,o)}));const bl=["continue","continuePrimaryKey","advance"],es={},ji=new WeakMap,ts=new WeakMap,Al={get(a,l){if(!bl.includes(l))return a[l];let o=es[l];return o||(o=es[l]=function(...i){ji.set(this,ts.get(this)[l](...i))}),o}};async function*Sl(...a){let l=this;if(l instanceof IDBCursor||(l=await l.openCursor(...a)),!l)return;l=l;const o=new Proxy(l,Al);for(ts.set(o,l),ri.set(o,Xi(l));l;)yield o,l=await(ji.get(o)||l.continue()),ji.delete(o)}function ns(a,l){return l===Symbol.asyncIterator&&zi(a,[IDBIndex,IDBObjectStore,IDBCursor])||l==="iterate"&&zi(a,[IDBIndex,IDBObjectStore])}Qo(a=>({...a,get(l,o,i){return ns(l,o)?Sl:a.get(l,o,i)},has(l,o){return ns(l,o)||a.has(l,o)}}));let Kn;function Il(){return _l("data",1,{upgrade(a){a.objectStoreNames.contains("groups")||a.createObjectStore("groups",{keyPath:"id"}),a.objectStoreNames.contains("media")||a.createObjectStore("media",{keyPath:"id"}),a.objectStoreNames.contains("products")||a.createObjectStore("products",{keyPath:"id"})}})}async function Qn(){if(Kn)try{const a=await Kn;return a.transaction("groups","readonly").commit(),a}catch{Kn=void 0}return Kn=Il(),Kn}async function qi(a){return(await Qn()).transaction("groups","readonly").objectStore("groups").get(a)}async function Dr(a,l){const i=(await Qn()).transaction("groups","readwrite");await i.objectStore("groups").put({id:a,data:l,timestamp:Date.now()}),await i.done}async function Nl(a,l){const o=JSON.parse(JSON.stringify(r.toRaw(l.value)));await Dr(a,o)}async function Zi(a,l){const i=(await Qn()).transaction("media","readwrite");await i.objectStore("media").put({id:a,blob:l,timestamp:Date.now()}),await i.done}async function fr(a){const u=await(await Qn()).transaction("media","readonly").objectStore("media").get(a);return u==null?void 0:u.blob}async function Tl(a){const o=(await Qn()).transaction("products","readwrite"),i=o.objectStore("products"),u=a.id;await i.put({id:u,product:a,timestamp:Date.now()}),await o.done}async function rs(a){const u=await(await Qn()).transaction("products","readonly").objectStore("products").get(a);return u==null?void 0:u.product}async function kl(){const a=Kn;if(Kn=void 0,a){const l=await a.catch(()=>null);l&&l.close()}try{await Cl("data",{blocked(){console.warn("Удаление заблокировано. открыты другие вкладки с сайтом.")}})}catch(l){console.error("Не удалось удалить базу: [lib, indexedDB]",l)}}function ii(a){"@babel/helpers - typeof";return ii=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(l){return typeof l}:function(l){return l&&typeof Symbol=="function"&&l.constructor===Symbol&&l!==Symbol.prototype?"symbol":typeof l},ii(a)}var Rl=/^\s+/,Bl=/\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 o=Ol(a);this._originalInput=a,this._r=o.r,this._g=o.g,this._b=o.b,this._a=o.a,this._roundA=Math.round(100*this._a)/100,this._format=l.format||o.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=o.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(),o,i,u,f,m,p;return o=l.r/255,i=l.g/255,u=l.b/255,o<=.03928?f=o/12.92:f=Math.pow((o+.055)/1.055,2.4),i<=.03928?m=i/12.92:m=Math.pow((i+.055)/1.055,2.4),u<=.03928?p=u/12.92:p=Math.pow((u+.055)/1.055,2.4),.2126*f+.7152*m+.0722*p},setAlpha:function(l){return this._a=cs(l),this._roundA=Math.round(100*this._a)/100,this},toHsv:function(){var l=os(this._r,this._g,this._b);return{h:l.h*360,s:l.s,v:l.v,a:this._a}},toHsvString:function(){var l=os(this._r,this._g,this._b),o=Math.round(l.h*360),i=Math.round(l.s*100),u=Math.round(l.v*100);return this._a==1?"hsv("+o+", "+i+"%, "+u+"%)":"hsva("+o+", "+i+"%, "+u+"%, "+this._roundA+")"},toHsl:function(){var l=is(this._r,this._g,this._b);return{h:l.h*360,s:l.s,l:l.l,a:this._a}},toHslString:function(){var l=is(this._r,this._g,this._b),o=Math.round(l.h*360),i=Math.round(l.s*100),u=Math.round(l.l*100);return this._a==1?"hsl("+o+", "+i+"%, "+u+"%)":"hsla("+o+", "+i+"%, "+u+"%, "+this._roundA+")"},toHex:function(l){return ss(this._r,this._g,this._b,l)},toHexString:function(l){return"#"+this.toHex(l)},toHex8:function(l){return Pl(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(wt(this._r,255)*100)+"%",g:Math.round(wt(this._g,255)*100)+"%",b:Math.round(wt(this._b,255)*100)+"%",a:this._a}},toPercentageRgbString:function(){return this._a==1?"rgb("+Math.round(wt(this._r,255)*100)+"%, "+Math.round(wt(this._g,255)*100)+"%, "+Math.round(wt(this._b,255)*100)+"%)":"rgba("+Math.round(wt(this._r,255)*100)+"%, "+Math.round(wt(this._g,255)*100)+"%, "+Math.round(wt(this._b,255)*100)+"%, "+this._roundA+")"},toName:function(){return this._a===0?"transparent":this._a<1?!1:ql[ss(this._r,this._g,this._b,!0)]||!1},toFilter:function(l){var o="#"+as(this._r,this._g,this._b,this._a),i=o,u=this._gradientType?"GradientType = 1, ":"";if(l){var f=Se(l);i="#"+as(f._r,f._g,f._b,f._a)}return"progid:DXImageTransform.Microsoft.gradient("+u+"startColorstr="+o+",endColorstr="+i+")"},toString:function(l){var o=!!l;l=l||this._format;var i=!1,u=this._a<1&&this._a>=0,f=!o&&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"&&(i=this.toRgbString()),l==="prgb"&&(i=this.toPercentageRgbString()),(l==="hex"||l==="hex6")&&(i=this.toHexString()),l==="hex3"&&(i=this.toHexString(!0)),l==="hex4"&&(i=this.toHex8String(!0)),l==="hex8"&&(i=this.toHex8String()),l==="name"&&(i=this.toName()),l==="hsl"&&(i=this.toHslString()),l==="hsv"&&(i=this.toHsvString()),i||this.toHexString())},clone:function(){return Se(this.toString())},_applyModification:function(l,o){var i=l.apply(null,[this].concat([].slice.call(o)));return this._r=i._r,this._g=i._g,this._b=i._b,this.setAlpha(i._a),this},lighten:function(){return this._applyModification(Ul,arguments)},brighten:function(){return this._applyModification(zl,arguments)},darken:function(){return this._applyModification(Hl,arguments)},desaturate:function(){return this._applyModification(Ll,arguments)},saturate:function(){return this._applyModification(Fl,arguments)},greyscale:function(){return this._applyModification(Vl,arguments)},spin:function(){return this._applyModification(Gl,arguments)},_applyCombination:function(l,o){return l.apply(null,[this].concat([].slice.call(o)))},analogous:function(){return this._applyCombination($l,arguments)},complement:function(){return this._applyCombination(Wl,arguments)},monochromatic:function(){return this._applyCombination(jl,arguments)},splitcomplement:function(){return this._applyCombination(Xl,arguments)},triad:function(){return this._applyCombination(ls,[3])},tetrad:function(){return this._applyCombination(ls,[4])}},Se.fromRatio=function(a,l){if(ii(a)=="object"){var o={};for(var i in a)a.hasOwnProperty(i)&&(i==="a"?o[i]=a[i]:o[i]=vr(a[i]));a=o}return Se(a,l)};function Ol(a){var l={r:0,g:0,b:0},o=1,i=null,u=null,f=null,m=!1,p=!1;return typeof a=="string"&&(a=Ql(a)),ii(a)=="object"&&(Ln(a.r)&&Ln(a.g)&&Ln(a.b)?(l=Ml(a.r,a.g,a.b),m=!0,p=String(a.r).substr(-1)==="%"?"prgb":"rgb"):Ln(a.h)&&Ln(a.s)&&Ln(a.v)?(i=vr(a.s),u=vr(a.v),l=vl(a.h,i,u),m=!0,p="hsv"):Ln(a.h)&&Ln(a.s)&&Ln(a.l)&&(i=vr(a.s),f=vr(a.l),l=Dl(a.h,i,f),m=!0,p="hsl"),a.hasOwnProperty("a")&&(o=a.a)),o=cs(o),{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:o}}function Ml(a,l,o){return{r:wt(a,255)*255,g:wt(l,255)*255,b:wt(o,255)*255}}function is(a,l,o){a=wt(a,255),l=wt(l,255),o=wt(o,255);var i=Math.max(a,l,o),u=Math.min(a,l,o),f,m,p=(i+u)/2;if(i==u)f=m=0;else{var w=i-u;switch(m=p>.5?w/(2-i-u):w/(i+u),i){case a:f=(l-o)/w+(l<o?6:0);break;case l:f=(o-a)/w+2;break;case o:f=(a-l)/w+4;break}f/=6}return{h:f,s:m,l:p}}function Dl(a,l,o){var i,u,f;a=wt(a,360),l=wt(l,100),o=wt(o,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)i=u=f=o;else{var p=o<.5?o*(1+l):o+l-o*l,w=2*o-p;i=m(w,p,a+1/3),u=m(w,p,a),f=m(w,p,a-1/3)}return{r:i*255,g:u*255,b:f*255}}function os(a,l,o){a=wt(a,255),l=wt(l,255),o=wt(o,255);var i=Math.max(a,l,o),u=Math.min(a,l,o),f,m,p=i,w=i-u;if(m=i===0?0:w/i,i==u)f=0;else{switch(i){case a:f=(l-o)/w+(l<o?6:0);break;case l:f=(o-a)/w+2;break;case o:f=(a-l)/w+4;break}f/=6}return{h:f,s:m,v:p}}function vl(a,l,o){a=wt(a,360)*6,l=wt(l,100),o=wt(o,100);var i=Math.floor(a),u=a-i,f=o*(1-l),m=o*(1-u*l),p=o*(1-(1-u)*l),w=i%6,x=[o,m,f,f,p,o][w],C=[p,o,o,m,f,f][w],y=[f,f,p,o,o,m][w];return{r:x*255,g:C*255,b:y*255}}function ss(a,l,o,i){var u=[_n(Math.round(a).toString(16)),_n(Math.round(l).toString(16)),_n(Math.round(o).toString(16))];return i&&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 Pl(a,l,o,i,u){var f=[_n(Math.round(a).toString(16)),_n(Math.round(l).toString(16)),_n(Math.round(o).toString(16)),_n(ds(i))];return u&&f[0].charAt(0)==f[0].charAt(1)&&f[1].charAt(0)==f[1].charAt(1)&&f[2].charAt(0)==f[2].charAt(1)&&f[3].charAt(0)==f[3].charAt(1)?f[0].charAt(0)+f[1].charAt(0)+f[2].charAt(0)+f[3].charAt(0):f.join("")}function as(a,l,o,i){var u=[_n(ds(i)),_n(Math.round(a).toString(16)),_n(Math.round(l).toString(16)),_n(Math.round(o).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 Ll(a,l){l=l===0?0:l||10;var o=Se(a).toHsl();return o.s-=l/100,o.s=oi(o.s),Se(o)}function Fl(a,l){l=l===0?0:l||10;var o=Se(a).toHsl();return o.s+=l/100,o.s=oi(o.s),Se(o)}function Vl(a){return Se(a).desaturate(100)}function Ul(a,l){l=l===0?0:l||10;var o=Se(a).toHsl();return o.l+=l/100,o.l=oi(o.l),Se(o)}function zl(a,l){l=l===0?0:l||10;var o=Se(a).toRgb();return o.r=Math.max(0,Math.min(255,o.r-Math.round(255*-(l/100)))),o.g=Math.max(0,Math.min(255,o.g-Math.round(255*-(l/100)))),o.b=Math.max(0,Math.min(255,o.b-Math.round(255*-(l/100)))),Se(o)}function Hl(a,l){l=l===0?0:l||10;var o=Se(a).toHsl();return o.l-=l/100,o.l=oi(o.l),Se(o)}function Gl(a,l){var o=Se(a).toHsl(),i=(o.h+l)%360;return o.h=i<0?360+i:i,Se(o)}function Wl(a){var l=Se(a).toHsl();return l.h=(l.h+180)%360,Se(l)}function ls(a,l){if(isNaN(l)||l<=0)throw new Error("Argument to polyad must be a positive number");for(var o=Se(a).toHsl(),i=[Se(a)],u=360/l,f=1;f<l;f++)i.push(Se({h:(o.h+f*u)%360,s:o.s,l:o.l}));return i}function Xl(a){var l=Se(a).toHsl(),o=l.h;return[Se(a),Se({h:(o+72)%360,s:l.s,l:l.l}),Se({h:(o+216)%360,s:l.s,l:l.l})]}function $l(a,l,o){l=l||6,o=o||30;var i=Se(a).toHsl(),u=360/o,f=[Se(a)];for(i.h=(i.h-(u*l>>1)+720)%360;--l;)i.h=(i.h+u)%360,f.push(Se(i));return f}function jl(a,l){l=l||6;for(var o=Se(a).toHsv(),i=o.h,u=o.s,f=o.v,m=[],p=1/l;l--;)m.push(Se({h:i,s:u,v:f})),f=(f+p)%1;return m}Se.mix=function(a,l,o){o=o===0?0:o||50;var i=Se(a).toRgb(),u=Se(l).toRgb(),f=o/100,m={r:(u.r-i.r)*f+i.r,g:(u.g-i.g)*f+i.g,b:(u.b-i.b)*f+i.b,a:(u.a-i.a)*f+i.a};return Se(m)},Se.readability=function(a,l){var o=Se(a),i=Se(l);return(Math.max(o.getLuminance(),i.getLuminance())+.05)/(Math.min(o.getLuminance(),i.getLuminance())+.05)},Se.isReadable=function(a,l,o){var i=Se.readability(a,l),u,f;switch(f=!1,u=Jl(o),u.level+u.size){case"AAsmall":case"AAAlarge":f=i>=4.5;break;case"AAlarge":f=i>=3;break;case"AAAsmall":f=i>=7;break}return f},Se.mostReadable=function(a,l,o){var i=null,u=0,f,m,p,w;o=o||{},m=o.includeFallbackColors,p=o.level,w=o.size;for(var x=0;x<l.length;x++)f=Se.readability(a,l[x]),f>u&&(u=f,i=Se(l[x]));return Se.isReadable(a,i,{level:p,size:w})||!m?i:(o.includeFallbackColors=!1,Se.mostReadable(a,["#fff","#000"],o))};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"},ql=Se.hexNames=Zl(Yi);function Zl(a){var l={};for(var o in a)a.hasOwnProperty(o)&&(l[a[o]]=o);return l}function cs(a){return a=parseFloat(a),(isNaN(a)||a<0||a>1)&&(a=1),a}function wt(a,l){Yl(a)&&(a="100%");var o=Kl(a);return a=Math.min(l,Math.max(0,parseFloat(a))),o&&(a=parseInt(a*l,10)/100),Math.abs(a-l)<1e-6?1:a%l/parseFloat(l)}function oi(a){return Math.min(1,Math.max(0,a))}function sn(a){return parseInt(a,16)}function Yl(a){return typeof a=="string"&&a.indexOf(".")!=-1&&parseFloat(a)===1}function Kl(a){return typeof a=="string"&&a.indexOf("%")!=-1}function _n(a){return a.length==1?"0"+a:""+a}function vr(a){return a<=1&&(a=a*100+"%"),a}function ds(a){return Math.round(parseFloat(a)*255).toString(16)}function us(a){return sn(a)/255}var Cn=function(){var a="[-\\+]?\\d+%?",l="[-\\+]?\\d*\\.\\d+%?",o="(?:"+l+")|(?:"+a+")",i="[\\s|\\(]+("+o+")[,|\\s]+("+o+")[,|\\s]+("+o+")\\s*\\)?",u="[\\s|\\(]+("+o+")[,|\\s]+("+o+")[,|\\s]+("+o+")[,|\\s]+("+o+")\\s*\\)?";return{CSS_UNIT:new RegExp(o),rgb:new RegExp("rgb"+i),rgba:new RegExp("rgba"+u),hsl:new RegExp("hsl"+i),hsla:new RegExp("hsla"+u),hsv:new RegExp("hsv"+i),hsva:new RegExp("hsva"+u),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}}();function Ln(a){return!!Cn.CSS_UNIT.exec(a)}function Ql(a){a=a.replace(Rl,"").replace(Bl,"").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 o;return(o=Cn.rgb.exec(a))?{r:o[1],g:o[2],b:o[3]}:(o=Cn.rgba.exec(a))?{r:o[1],g:o[2],b:o[3],a:o[4]}:(o=Cn.hsl.exec(a))?{h:o[1],s:o[2],l:o[3]}:(o=Cn.hsla.exec(a))?{h:o[1],s:o[2],l:o[3],a:o[4]}:(o=Cn.hsv.exec(a))?{h:o[1],s:o[2],v:o[3]}:(o=Cn.hsva.exec(a))?{h:o[1],s:o[2],v:o[3],a:o[4]}:(o=Cn.hex8.exec(a))?{r:sn(o[1]),g:sn(o[2]),b:sn(o[3]),a:us(o[4]),format:l?"name":"hex8"}:(o=Cn.hex6.exec(a))?{r:sn(o[1]),g:sn(o[2]),b:sn(o[3]),format:l?"name":"hex"}:(o=Cn.hex4.exec(a))?{r:sn(o[1]+""+o[1]),g:sn(o[2]+""+o[2]),b:sn(o[3]+""+o[3]),a:us(o[4]+""+o[4]),format:l?"name":"hex8"}:(o=Cn.hex3.exec(a))?{r:sn(o[1]+""+o[1]),g:sn(o[2]+""+o[2]),b:sn(o[3]+""+o[3]),format:l?"name":"hex"}:!1}function Jl(a){var l,o;return a=a||{level:"AA",size:"small"},l=(a.level||"AA").toUpperCase(),o=(a.size||"small").toLowerCase(),l!=="AA"&&l!=="AAA"&&(l="AA"),o!=="small"&&o!=="large"&&(o="small"),{level:l,size:o}}const si=we.defineStore("imageCache",()=>{const a=r.ref({});let l=!1;function o(w,x){const C=String(w);a.value[C]&&URL.revokeObjectURL(a.value[C]);const y=URL.createObjectURL(x);a.value[C]=y}async function i(w){if(!w){console.warn("initCacheSingle called with null/undefined id");return}const x=String(w);if(a.value[x])return;const C=await fr(x);C&&(await scheduler.yield(),o(x,C),window.dispatchEvent(new CustomEvent("image-cached",{detail:{id:x,blob:C}})))}function u(w){const{id:x,blob:C}=w.detail;x&&C&&o(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:i,updateCacheFromBlob:o,cleanup:p,setupEventListener:f,removeEventListener:m}}),Rt=we.defineStore("themeLib",()=>{const a=si(),{initCacheSingle:l}=a,o=r.ref({id:"",created_at:null,logo:null,primary_color:null,accent_color:null,accent_light_color:null,accent_dark_color:null,bg_button_color:null,bonuses_button_name:void 0,qr_auth_required:!0,qr_bypass_guest_auth:null,qr_show_pay_button_ts:null,kiosk_bypass_guest_auth:null,kiosk_disable_lock_screen:null,kiosk_hide_banner:null,inactive_button_color:null,cards_color:null,text_color:null,nonworking_bg_color:null,retail_mode:null,splash_image_url:null,splash_video:null,splash_duration:0,splash_type:null,fallback_image:null,adult_disclaimer_text:null,adult_disclaimer_image:null,kiosk_enable_wheel:null,kiosk_banner:null,kiosk_preloader:null,organization:"",kiosk_qr_payment_timeout:null,gradientStyle:null,kiosk_inactivity_timeout:null,kiosk_show_loyalty_card_button:null,kiosk_show_loyalty_phone_input_button:null,cart_loyalty_button:{cart_loyalty_button_sticker:null,cart_loyalty_button_text:null},comments:null,show_nutrition_in_cart:null,apply_custom_size_picker_fonts:null,size_picker_unselected_font_size:null,size_picker_selected_font_size:null,hide_discounts_calculate_button:!1,enable_sequential_modifiers:!1,pdf_return_url:null,kiosk_hide_manual_input_loyalty_card:null,kiosk_camera_scan_loyalty_card:null,kiosk_hide_menu_update_notification:null,kiosk_proceed_to_payment_text:null}),i=async f=>{if(!f)return;o.value={...f};const m=await fr("banner"),p=await fr("preloader"),w=await fr("defaultImage");m||u(f.kiosk_banner,"banner"),p||u(f.kiosk_preloader,"preloader"),w||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=o.value.primary_color||"#F2F7FF",C=Se(x).setAlpha(.7).toRgbString(),y=`linear-gradient(to bottom, transparent 10%, ${C} 50%, ${x} 85%)`,N=`-webkit-linear-gradient(to bottom, transparent 10%, ${C} 50%, ${x} 85%)`;return o.value.gradientStyle={background:y,backgroundColor:N},o.value},u=async(f,m)=>{if(f){const p=await fetch(f);if(!p.ok)throw new Error("Network error");const w=await p.blob();Zi(m,w),l(m)}};return{itemThemes:o,updateColor:i}}),hr=a=>{if(!a)return 0;if((a.price===0||a.price===null)&&a.sizes&&a.sizes.length>0){const l=a.sizes.find(o=>o.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 ec(a){return decodeURIComponent(atob(a).replace(/(.)/g,(l,o)=>{let i=o.charCodeAt(0).toString(16).toUpperCase();return i.length<2&&(i="0"+i),"%"+i}))}function tc(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 ec(l)}catch{return atob(l)}}function fs(a,l){if(typeof a!="string")throw new Pr("Invalid token specified: must be a string");l||(l={});const o=l.header===!0?0:1,i=a.split(".")[o];if(typeof i!="string")throw new Pr(`Invalid token specified: missing part #${o+1}`);let u;try{u=tc(i)}catch(f){throw new Pr(`Invalid token specified: invalid base64 for part #${o+1} (${f.message})`)}try{return JSON.parse(u)}catch(f){throw new Pr(`Invalid token specified: invalid json for part #${o+1} (${f.message})`)}}const nc=(a,l)=>{if(typeof window<"u"){const o=localStorage.getItem(a);if(o)try{return JSON.parse(o)}catch{return l}return l}return l},rc=(a,l)=>{if(typeof window<"u"){const o=localStorage.getItem(a);if(o)try{return fs(JSON.parse(o))}catch(i){return console.error("Failed to decode JWT:",i),l}}return l},hs=(a,l,o="normal")=>{const i=r.ref(o==="jwt"?rc(a,l):nc(a,l));return r.watchEffect(()=>{i.value===null||i.value===void 0?localStorage.removeItem(a):o!=="jwt"&&localStorage.setItem(a,JSON.stringify(i.value))}),i},mr=a=>{a.forEach(l=>{try{localStorage.removeItem(l)}catch(o){console.error(`Ошибка при удалении ключа "${l}":`,o)}})};class ic{constructor(l,o={}){Re(this,"url");Re(this,"options");Re(this,"ws");Re(this,"reconnectInterval");Re(this,"listeners");Re(this,"isConnected");Re(this,"heartbeat");Re(this,"heartbeatTimeout");Re(this,"pingTimeout");Re(this,"pingResponseTimeout");Re(this,"signal");Re(this,"_shouldReconnect",!0);this.url=l,this.options=o,this.ws=null,this.reconnectInterval=5e3,this.pingResponseTimeout=5e3,this.listeners=new Map,this.isConnected=r.ref(!1),this.heartbeatTimeout=o.heartbeatTimeout||3e5}connect(){var o,i;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),(o=this.options.signal)!=null&&o.aborted&&this.close(!0),(i=this.options.signal)==null||i.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 o;this.isConnected.value&&((o=this.ws)==null?void 0:o.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,o){this.listeners.has(l)||this.listeners.set(l,[]),this.listeners.get(l).push(o)}off(l,o){const i=this.listeners.get(l);i&&this.listeners.set(l,i.filter(u=>u!==o))}emit(l,o=null){const i=this.listeners.get(l);i&&i.forEach(u=>u(o))}getConnectionStatus(){return this.isConnected}}let ai=new Map;function Lr(a,l={}){var i;if(ai.has(a)){const u=ai.get(a);if(u.isConnected.value&&((i=u.ws)==null?void 0:i.readyState)===WebSocket.OPEN)return u.listeners.clear(),u;u.close(!0),ai.delete(a)}const o=new ic(a,l);return ai.set(a,o),o}const st=we.defineStore("mainLib",()=>{const a=r.ref(),l=r.ref(!1),o=r.ref(localStorage.getItem("kiosk_timeout")),i=r.ref(0),u=r.ref(!1),f=r.ref(sessionStorage.getItem("is_adult")==="true"),m=r.ref([]),p=r.ref([]),w=r.ref(!1),x=r.ref(),C=r.ref(""),y=r.ref(0),N=r.ref(!1),O=r.ref(!1),T=r.ref(!0),v=r.ref(!localStorage.getItem("apiKey")),D=r.ref(!1),U=r.ref({textNotification:""}),M=r.ref([]);let R=null;const F=K=>{const oe=`wss://${x.value.area}/ws/device/${K}/`;R=Lr(oe);function de(){console.log("WebSocket connection opened")}function ce(ge){if(ge.error)D.value=!0,U.value.textNotification=ge.error,R==null||R.close(!0);else{if(!(ge!=null&&ge.params))return;typeof ge.params.components.shift.is_ok!==null?T.value=ge.params.components.shift.is_ok:T.value=!0}}function Ce(ge){console.error("WebSocket error:",ge),R.close(!0)}R.on("open",de),R.on("message",ce),R.on("error",Ce),R.connect()},G=K=>{i.value=K,localStorage.setItem("kiosk_timeout",K)},Z=K=>{l.value=K},V=r.ref(null),P=r.computed(()=>m.value.reduce((K,oe)=>{let de=0,ce=0;return oe.group_modifiers&&(de=oe.group_modifiers.reduce((Ce,ge)=>ge.modifiers?Ce+ge.modifiers.reduce((De,xe)=>De+xe.old_price*xe.amount,0):0,0)*oe.amount),oe.modifiers&&(ce=oe.modifiers.reduce((Ce,ge)=>Ce+ge.old_price*ge.amount,0)*oe.amount),K+oe.old_price*oe.amount+de+ce},0)),L=r.computed({get:()=>m.value.length===0||V.value===0?0:V.value&&V.value!==0?V.value:m.value.reduce((K,oe)=>{const de=hr(oe)*oe.amount;let ce=0,Ce=0;return oe.group_modifiers&&(ce=oe.group_modifiers.reduce((ge,De)=>De.modifiers?ge+De.modifiers.reduce((xe,_t)=>xe+_t.price*_t.amount,0):0,0)*oe.amount),oe.modifiers&&(Ce=oe.modifiers.reduce((ge,De)=>ge+De.price*De.amount,0)*oe.amount),K+de+ce+Ce},0),set(K){V.value=K}}),re=K=>{y.value=K,localStorage.removeItem("bonus"),hs("bonus",y.value)},Q=K=>{mr(K)},ee=K=>{K={...K,idSystem:crypto.randomUUID()};const oe=H(K);m.value.push(oe),X()},X=()=>{try{if(!m.value||m.value.length===0){localStorage.removeItem("cart");return}localStorage.setItem("cart",JSON.stringify(r.toRaw(m.value)))}catch(K){console.error("Failed to update cart in localStorage:",K)}},H=K=>r.reactive({...K,amount:K.amount??1,price:K.old_price,new_price:null,total_new_price:null,discounts:[],modifiers:(K.modifiers||[]).map(oe=>r.reactive({...oe,price:oe.old_price,new_price:null,total_new_price:null})),group_modifiers:(K.group_modifiers||[]).map(oe=>r.reactive({...oe,modifiers:(oe.modifiers||[]).map(de=>r.reactive({...de,price:de.old_price,new_price:null,total_new_price:null}))}))}),I=K=>{const oe=m.value.find(de=>de.idSystem===K);oe&&(oe.amount+=1),X()},$=K=>{const oe=m.value.find(de=>de.idSystem===K);oe&&(oe.amount>=1&&(oe.amount-=1),X())},j=()=>{try{const K=localStorage.getItem("cart");if(K){const oe=JSON.parse(K);m.value.splice(0,m.value.length,...oe.map(H)),V.value=null}}catch(K){console.error("Failed to load cart from localStorage:",K)}};return j(),{cartProducts_lib:m,activeScrolling_lib:p,config_lib:x,totalPrice_lib:L,initialCartPrice_lib:P,is_notification_lib:D,notificationData_lib:U,xApiKey_lib:C,countBonus:y,toggleDrum:l,is_showApiKey:v,openApiKey:N,kiosk_timeout:o,kiosk_FirstTimeout:i,is_OpenLoyal:O,profile:a,is_18_above_content:u,is18Allowed:f,healthState:T,displayCards:M,isOrderTypeSubmited:w,removeFromLocalStorage:Q,setKioskTimeout:G,setBonus:re,setStateDrum:Z,addToCart:ee,plusAmount:I,minusAmount:$,loadCart:j,deleteItemFromCart:K=>{if(K){const oe=m.value.findIndex(de=>de.idSystem===K);if(oe===-1)return;m.value.splice(oe,1),X(),V.value=null}else m.value=[],X()},updateCartInLocalStorage:X,makeProductFullyReactive:H,checkHeartbeatApp:F}});function ms(a,l){return function(){return a.apply(l,arguments)}}const{toString:oc}=Object.prototype,{getPrototypeOf:Ki}=Object,{iterator:li,toStringTag:gs}=Symbol,ci=(a=>l=>{const o=oc.call(l);return a[o]||(a[o]=o.slice(8,-1).toLowerCase())})(Object.create(null)),En=a=>(a=a.toLowerCase(),l=>ci(l)===a),di=a=>l=>typeof l===a,{isArray:gr}=Array,pr=di("undefined");function Fr(a){return a!==null&&!pr(a)&&a.constructor!==null&&!pr(a.constructor)&&Kt(a.constructor.isBuffer)&&a.constructor.isBuffer(a)}const ps=En("ArrayBuffer");function sc(a){let l;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?l=ArrayBuffer.isView(a):l=a&&a.buffer&&ps(a.buffer),l}const ac=di("string"),Kt=di("function"),xs=di("number"),Vr=a=>a!==null&&typeof a=="object",lc=a=>a===!0||a===!1,ui=a=>{if(ci(a)!=="object")return!1;const l=Ki(a);return(l===null||l===Object.prototype||Object.getPrototypeOf(l)===null)&&!(gs in a)&&!(li in a)},cc=a=>{if(!Vr(a)||Fr(a))return!1;try{return Object.keys(a).length===0&&Object.getPrototypeOf(a)===Object.prototype}catch{return!1}},dc=En("Date"),uc=En("File"),fc=En("Blob"),hc=En("FileList"),mc=a=>Vr(a)&&Kt(a.pipe),gc=a=>{let l;return a&&(typeof FormData=="function"&&a instanceof FormData||Kt(a.append)&&((l=ci(a))==="formdata"||l==="object"&&Kt(a.toString)&&a.toString()==="[object FormData]"))},pc=En("URLSearchParams"),[xc,wc,_c,Cc]=["ReadableStream","Request","Response","Headers"].map(En),Ec=a=>a.trim?a.trim():a.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Ur(a,l,{allOwnKeys:o=!1}={}){if(a===null||typeof a>"u")return;let i,u;if(typeof a!="object"&&(a=[a]),gr(a))for(i=0,u=a.length;i<u;i++)l.call(null,a[i],i,a);else{if(Fr(a))return;const f=o?Object.getOwnPropertyNames(a):Object.keys(a),m=f.length;let p;for(i=0;i<m;i++)p=f[i],l.call(null,a[p],p,a)}}function ws(a,l){if(Fr(a))return null;l=l.toLowerCase();const o=Object.keys(a);let i=o.length,u;for(;i-- >0;)if(u=o[i],l===u.toLowerCase())return u;return null}const Jn=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,_s=a=>!pr(a)&&a!==Jn;function Qi(){const{caseless:a,skipUndefined:l}=_s(this)&&this||{},o={},i=(u,f)=>{const m=a&&ws(o,f)||f;ui(o[m])&&ui(u)?o[m]=Qi(o[m],u):ui(u)?o[m]=Qi({},u):gr(u)?o[m]=u.slice():(!l||!pr(u))&&(o[m]=u)};for(let u=0,f=arguments.length;u<f;u++)arguments[u]&&Ur(arguments[u],i);return o}const yc=(a,l,o,{allOwnKeys:i}={})=>(Ur(l,(u,f)=>{o&&Kt(u)?a[f]=ms(u,o):a[f]=u},{allOwnKeys:i}),a),bc=a=>(a.charCodeAt(0)===65279&&(a=a.slice(1)),a),Ac=(a,l,o,i)=>{a.prototype=Object.create(l.prototype,i),a.prototype.constructor=a,Object.defineProperty(a,"super",{value:l.prototype}),o&&Object.assign(a.prototype,o)},Sc=(a,l,o,i)=>{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],(!i||i(m,a,l))&&!p[m]&&(l[m]=a[m],p[m]=!0);a=o!==!1&&Ki(a)}while(a&&(!o||o(a,l))&&a!==Object.prototype);return l},Ic=(a,l,o)=>{a=String(a),(o===void 0||o>a.length)&&(o=a.length),o-=l.length;const i=a.indexOf(l,o);return i!==-1&&i===o},Nc=a=>{if(!a)return null;if(gr(a))return a;let l=a.length;if(!xs(l))return null;const o=new Array(l);for(;l-- >0;)o[l]=a[l];return o},Tc=(a=>l=>a&&l instanceof a)(typeof Uint8Array<"u"&&Ki(Uint8Array)),kc=(a,l)=>{const i=(a&&a[li]).call(a);let u;for(;(u=i.next())&&!u.done;){const f=u.value;l.call(a,f[0],f[1])}},Rc=(a,l)=>{let o;const i=[];for(;(o=a.exec(l))!==null;)i.push(o);return i},Bc=En("HTMLFormElement"),Oc=a=>a.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(o,i,u){return i.toUpperCase()+u}),Cs=(({hasOwnProperty:a})=>(l,o)=>a.call(l,o))(Object.prototype),Mc=En("RegExp"),Es=(a,l)=>{const o=Object.getOwnPropertyDescriptors(a),i={};Ur(o,(u,f)=>{let m;(m=l(u,f,a))!==!1&&(i[f]=m||u)}),Object.defineProperties(a,i)},Dc=a=>{Es(a,(l,o)=>{if(Kt(a)&&["arguments","caller","callee"].indexOf(o)!==-1)return!1;const i=a[o];if(Kt(i)){if(l.enumerable=!1,"writable"in l){l.writable=!1;return}l.set||(l.set=()=>{throw Error("Can not rewrite read-only method '"+o+"'")})}})},vc=(a,l)=>{const o={},i=u=>{u.forEach(f=>{o[f]=!0})};return gr(a)?i(a):i(String(a).split(l)),o},Pc=()=>{},Lc=(a,l)=>a!=null&&Number.isFinite(a=+a)?a:l;function Fc(a){return!!(a&&Kt(a.append)&&a[gs]==="FormData"&&a[li])}const Vc=a=>{const l=new Array(10),o=(i,u)=>{if(Vr(i)){if(l.indexOf(i)>=0)return;if(Fr(i))return i;if(!("toJSON"in i)){l[u]=i;const f=gr(i)?[]:{};return Ur(i,(m,p)=>{const w=o(m,u+1);!pr(w)&&(f[p]=w)}),l[u]=void 0,f}}return i};return o(a,0)},Uc=En("AsyncFunction"),zc=a=>a&&(Vr(a)||Kt(a))&&Kt(a.then)&&Kt(a.catch),ys=((a,l)=>a?setImmediate:l?((o,i)=>(Jn.addEventListener("message",({source:u,data:f})=>{u===Jn&&f===o&&i.length&&i.shift()()},!1),u=>{i.push(u),Jn.postMessage(o,"*")}))(`axios@${Math.random()}`,[]):o=>setTimeout(o))(typeof setImmediate=="function",Kt(Jn.postMessage)),Hc=typeof queueMicrotask<"u"?queueMicrotask.bind(Jn):typeof process<"u"&&process.nextTick||ys,te={isArray:gr,isArrayBuffer:ps,isBuffer:Fr,isFormData:gc,isArrayBufferView:sc,isString:ac,isNumber:xs,isBoolean:lc,isObject:Vr,isPlainObject:ui,isEmptyObject:cc,isReadableStream:xc,isRequest:wc,isResponse:_c,isHeaders:Cc,isUndefined:pr,isDate:dc,isFile:uc,isBlob:fc,isRegExp:Mc,isFunction:Kt,isStream:mc,isURLSearchParams:pc,isTypedArray:Tc,isFileList:hc,forEach:Ur,merge:Qi,extend:yc,trim:Ec,stripBOM:bc,inherits:Ac,toFlatObject:Sc,kindOf:ci,kindOfTest:En,endsWith:Ic,toArray:Nc,forEachEntry:kc,matchAll:Rc,isHTMLForm:Bc,hasOwnProperty:Cs,hasOwnProp:Cs,reduceDescriptors:Es,freezeMethods:Dc,toObjectSet:vc,toCamelCase:Oc,noop:Pc,toFiniteNumber:Lc,findKey:ws,global:Jn,isContextDefined:_s,isSpecCompliantForm:Fc,toJSONObject:Vc,isAsyncFn:Uc,isThenable:zc,setImmediate:ys,asap:Hc,isIterable:a=>a!=null&&Kt(a[li])};function Le(a,l,o,i,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),o&&(this.config=o),i&&(this.request=i),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 bs=Le.prototype,As={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(a=>{As[a]={value:a}}),Object.defineProperties(Le,As),Object.defineProperty(bs,"isAxiosError",{value:!0}),Le.from=(a,l,o,i,u,f)=>{const m=Object.create(bs);te.toFlatObject(a,m,function(C){return C!==Error.prototype},x=>x!=="isAxiosError");const p=a&&a.message?a.message:"Error",w=l==null&&a?a.code:l;return Le.call(m,p,w,o,i,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 Gc=null;function Ji(a){return te.isPlainObject(a)||te.isArray(a)}function Ss(a){return te.endsWith(a,"[]")?a.slice(0,-2):a}function Is(a,l,o){return a?a.concat(l).map(function(u,f){return u=Ss(u),!o&&f?"["+u+"]":u}).join(o?".":""):l}function Wc(a){return te.isArray(a)&&!a.some(Ji)}const Xc=te.toFlatObject(te,{},null,function(l){return/^is[A-Z]/.test(l)});function fi(a,l,o){if(!te.isObject(a))throw new TypeError("target must be an object");l=l||new FormData,o=te.toFlatObject(o,{metaTokens:!0,dots:!1,indexes:!1},!1,function(v,D){return!te.isUndefined(D[v])});const i=o.metaTokens,u=o.visitor||C,f=o.dots,m=o.indexes,w=(o.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(!w&&te.isBlob(T))throw new Le("Blob is not supported. Use a Buffer instead.");return te.isArrayBuffer(T)||te.isTypedArray(T)?w&&typeof Blob=="function"?new Blob([T]):Buffer.from(T):T}function C(T,v,D){let U=T;if(T&&!D&&typeof T=="object"){if(te.endsWith(v,"{}"))v=i?v:v.slice(0,-2),T=JSON.stringify(T);else if(te.isArray(T)&&Wc(T)||(te.isFileList(T)||te.endsWith(v,"[]"))&&(U=te.toArray(T)))return v=Ss(v),U.forEach(function(R,F){!(te.isUndefined(R)||R===null)&&l.append(m===!0?Is([v],F,f):m===null?v:v+"[]",x(R))}),!1}return Ji(T)?!0:(l.append(Is(D,v,f),x(T)),!1)}const y=[],N=Object.assign(Xc,{defaultVisitor:C,convertValue:x,isVisitable:Ji});function O(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(U,M){(!(te.isUndefined(U)||U===null)&&u.call(l,U,te.isString(M)?M.trim():M,v,N))===!0&&O(U,v?v.concat(M):[M])}),y.pop()}}if(!te.isObject(a))throw new TypeError("data must be an object");return O(a),l}function Ns(a){const l={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(a).replace(/[!'()~]|%20|%00/g,function(i){return l[i]})}function eo(a,l){this._pairs=[],a&&fi(a,this,l)}const Ts=eo.prototype;Ts.append=function(l,o){this._pairs.push([l,o])},Ts.toString=function(l){const o=l?function(i){return l.call(this,i,Ns)}:Ns;return this._pairs.map(function(u){return o(u[0])+"="+o(u[1])},"").join("&")};function $c(a){return encodeURIComponent(a).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function ks(a,l,o){if(!l)return a;const i=o&&o.encode||$c;te.isFunction(o)&&(o={serialize:o});const u=o&&o.serialize;let f;if(u?f=u(l,o):f=te.isURLSearchParams(l)?l.toString():new eo(l,o).toString(i),f){const m=a.indexOf("#");m!==-1&&(a=a.slice(0,m)),a+=(a.indexOf("?")===-1?"?":"&")+f}return a}class Rs{constructor(){this.handlers=[]}use(l,o,i){return this.handlers.push({fulfilled:l,rejected:o,synchronous:i?i.synchronous:!1,runWhen:i?i.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(i){i!==null&&l(i)})}}const Bs={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},jc={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,qc=to&&(!no||["ReactNative","NativeScript","NS"].indexOf(no.product)<0),Zc=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Yc=to&&window.location.href||"http://localhost",Xt={...Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:to,hasStandardBrowserEnv:qc,hasStandardBrowserWebWorkerEnv:Zc,navigator:no,origin:Yc},Symbol.toStringTag,{value:"Module"})),...jc};function Kc(a,l){return fi(a,new Xt.classes.URLSearchParams,{visitor:function(o,i,u,f){return Xt.isNode&&te.isBuffer(o)?(this.append(i,o.toString("base64")),!1):f.defaultVisitor.apply(this,arguments)},...l})}function Qc(a){return te.matchAll(/\w+|\[(\w*)]/g,a).map(l=>l[0]==="[]"?"":l[1]||l[0])}function Jc(a){const l={},o=Object.keys(a);let i;const u=o.length;let f;for(i=0;i<u;i++)f=o[i],l[f]=a[f];return l}function Os(a){function l(o,i,u,f){let m=o[f++];if(m==="__proto__")return!0;const p=Number.isFinite(+m),w=f>=o.length;return m=!m&&te.isArray(u)?u.length:m,w?(te.hasOwnProp(u,m)?u[m]=[u[m],i]:u[m]=i,!p):((!u[m]||!te.isObject(u[m]))&&(u[m]=[]),l(o,i,u[m],f)&&te.isArray(u[m])&&(u[m]=Jc(u[m])),!p)}if(te.isFormData(a)&&te.isFunction(a.entries)){const o={};return te.forEachEntry(a,(i,u)=>{l(Qc(i),u,o,0)}),o}return null}function ed(a,l,o){if(te.isString(a))try{return(l||JSON.parse)(a),te.trim(a)}catch(i){if(i.name!=="SyntaxError")throw i}return(o||JSON.stringify)(a)}const zr={transitional:Bs,adapter:["xhr","http","fetch"],transformRequest:[function(l,o){const i=o.getContentType()||"",u=i.indexOf("application/json")>-1,f=te.isObject(l);if(f&&te.isHTMLForm(l)&&(l=new FormData(l)),te.isFormData(l))return u?JSON.stringify(Os(l)):l;if(te.isArrayBuffer(l)||te.isBuffer(l)||te.isStream(l)||te.isFile(l)||te.isBlob(l)||te.isReadableStream(l))return l;if(te.isArrayBufferView(l))return l.buffer;if(te.isURLSearchParams(l))return o.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),l.toString();let p;if(f){if(i.indexOf("application/x-www-form-urlencoded")>-1)return Kc(l,this.formSerializer).toString();if((p=te.isFileList(l))||i.indexOf("multipart/form-data")>-1){const w=this.env&&this.env.FormData;return fi(p?{"files[]":l}:l,w&&new w,this.formSerializer)}}return f||u?(o.setContentType("application/json",!1),ed(l)):l}],transformResponse:[function(l){const o=this.transitional||zr.transitional,i=o&&o.forcedJSONParsing,u=this.responseType==="json";if(te.isResponse(l)||te.isReadableStream(l))return l;if(l&&te.isString(l)&&(i&&!this.responseType||u)){const m=!(o&&o.silentJSONParsing)&&u;try{return JSON.parse(l,this.parseReviver)}catch(p){if(m)throw p.name==="SyntaxError"?Le.from(p,Le.ERR_BAD_RESPONSE,this,null,this.response):p}}return l}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Xt.classes.FormData,Blob:Xt.classes.Blob},validateStatus:function(l){return l>=200&&l<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};te.forEach(["delete","get","head","post","put","patch"],a=>{zr.headers[a]={}});const td=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"]),nd=a=>{const l={};let o,i,u;return a&&a.split(`
2
- `).forEach(function(m){u=m.indexOf(":"),o=m.substring(0,u).trim().toLowerCase(),i=m.substring(u+1).trim(),!(!o||l[o]&&td[o])&&(o==="set-cookie"?l[o]?l[o].push(i):l[o]=[i]:l[o]=l[o]?l[o]+", "+i:i)}),l},Ms=Symbol("internals");function Hr(a){return a&&String(a).trim().toLowerCase()}function hi(a){return a===!1||a==null?a:te.isArray(a)?a.map(hi):String(a)}function rd(a){const l=Object.create(null),o=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let i;for(;i=o.exec(a);)l[i[1]]=i[2];return l}const id=a=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(a.trim());function ro(a,l,o,i,u){if(te.isFunction(i))return i.call(this,l,o);if(u&&(l=o),!!te.isString(l)){if(te.isString(i))return l.indexOf(i)!==-1;if(te.isRegExp(i))return i.test(l)}}function od(a){return a.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(l,o,i)=>o.toUpperCase()+i)}function sd(a,l){const o=te.toCamelCase(" "+l);["get","set","has"].forEach(i=>{Object.defineProperty(a,i+o,{value:function(u,f,m){return this[i].call(this,l,u,f,m)},configurable:!0})})}let Qt=class{constructor(l){l&&this.set(l)}set(l,o,i){const u=this;function f(p,w,x){const C=Hr(w);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||w]=hi(p))}const m=(p,w)=>te.forEach(p,(x,C)=>f(x,C,w));if(te.isPlainObject(l)||l instanceof this.constructor)m(l,o);else if(te.isString(l)&&(l=l.trim())&&!id(l))m(nd(l),o);else if(te.isObject(l)&&te.isIterable(l)){let p={},w,x;for(const C of l){if(!te.isArray(C))throw TypeError("Object iterator must return a key-value pair");p[x=C[0]]=(w=p[x])?te.isArray(w)?[...w,C[1]]:[w,C[1]]:C[1]}m(p,o)}else l!=null&&f(o,l,i);return this}get(l,o){if(l=Hr(l),l){const i=te.findKey(this,l);if(i){const u=this[i];if(!o)return u;if(o===!0)return rd(u);if(te.isFunction(o))return o.call(this,u,i);if(te.isRegExp(o))return o.exec(u);throw new TypeError("parser must be boolean|regexp|function")}}}has(l,o){if(l=Hr(l),l){const i=te.findKey(this,l);return!!(i&&this[i]!==void 0&&(!o||ro(this,this[i],i,o)))}return!1}delete(l,o){const i=this;let u=!1;function f(m){if(m=Hr(m),m){const p=te.findKey(i,m);p&&(!o||ro(i,i[p],p,o))&&(delete i[p],u=!0)}}return te.isArray(l)?l.forEach(f):f(l),u}clear(l){const o=Object.keys(this);let i=o.length,u=!1;for(;i--;){const f=o[i];(!l||ro(this,this[f],f,l,!0))&&(delete this[f],u=!0)}return u}normalize(l){const o=this,i={};return te.forEach(this,(u,f)=>{const m=te.findKey(i,f);if(m){o[m]=hi(u),delete o[f];return}const p=l?od(f):String(f).trim();p!==f&&delete o[f],o[p]=hi(u),i[p]=!0}),this}concat(...l){return this.constructor.concat(this,...l)}toJSON(l){const o=Object.create(null);return te.forEach(this,(i,u)=>{i!=null&&i!==!1&&(o[u]=l&&te.isArray(i)?i.join(", "):i)}),o}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([l,o])=>l+": "+o).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,...o){const i=new this(l);return o.forEach(u=>i.set(u)),i}static accessor(l){const i=(this[Ms]=this[Ms]={accessors:{}}).accessors,u=this.prototype;function f(m){const p=Hr(m);i[p]||(sd(u,m),i[p]=!0)}return te.isArray(l)?l.forEach(f):f(l),this}};Qt.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),te.reduceDescriptors(Qt.prototype,({value:a},l)=>{let o=l[0].toUpperCase()+l.slice(1);return{get:()=>a,set(i){this[o]=i}}}),te.freezeMethods(Qt);function io(a,l){const o=this||zr,i=l||o,u=Qt.from(i.headers);let f=i.data;return te.forEach(a,function(p){f=p.call(o,f,u.normalize(),l?l.status:void 0)}),u.normalize(),f}function Ds(a){return!!(a&&a.__CANCEL__)}function xr(a,l,o){Le.call(this,a??"canceled",Le.ERR_CANCELED,l,o),this.name="CanceledError"}te.inherits(xr,Le,{__CANCEL__:!0});function vs(a,l,o){const i=o.config.validateStatus;!o.status||!i||i(o.status)?a(o):l(new Le("Request failed with status code "+o.status,[Le.ERR_BAD_REQUEST,Le.ERR_BAD_RESPONSE][Math.floor(o.status/100)-4],o.config,o.request,o))}function ad(a){const l=/^([-+\w]{1,25})(:?\/\/|:)/.exec(a);return l&&l[1]||""}function ld(a,l){a=a||10;const o=new Array(a),i=new Array(a);let u=0,f=0,m;return l=l!==void 0?l:1e3,function(w){const x=Date.now(),C=i[f];m||(m=x),o[u]=w,i[u]=x;let y=f,N=0;for(;y!==u;)N+=o[y++],y=y%a;if(u=(u+1)%a,u===f&&(f=(f+1)%a),x-m<l)return;const O=C&&x-C;return O?Math.round(N*1e3/O):void 0}}function cd(a,l){let o=0,i=1e3/l,u,f;const m=(x,C=Date.now())=>{o=C,u=null,f&&(clearTimeout(f),f=null),a(...x)};return[(...x)=>{const C=Date.now(),y=C-o;y>=i?m(x,C):(u=x,f||(f=setTimeout(()=>{f=null,m(u)},i-y)))},()=>u&&m(u)]}const mi=(a,l,o=3)=>{let i=0;const u=ld(50,250);return cd(f=>{const m=f.loaded,p=f.lengthComputable?f.total:void 0,w=m-i,x=u(w),C=m<=p;i=m;const y={loaded:m,total:p,progress:p?m/p:void 0,bytes:w,rate:x||void 0,estimated:x&&p&&C?(p-m)/x:void 0,event:f,lengthComputable:p!=null,[l?"download":"upload"]:!0};a(y)},o)},Ps=(a,l)=>{const o=a!=null;return[i=>l[0]({lengthComputable:o,total:a,loaded:i}),l[1]]},Ls=a=>(...l)=>te.asap(()=>a(...l)),dd=Xt.hasStandardBrowserEnv?((a,l)=>o=>(o=new URL(o,Xt.origin),a.protocol===o.protocol&&a.host===o.host&&(l||a.port===o.port)))(new URL(Xt.origin),Xt.navigator&&/(msie|trident)/i.test(Xt.navigator.userAgent)):()=>!0,ud=Xt.hasStandardBrowserEnv?{write(a,l,o,i,u,f,m){if(typeof document>"u")return;const p=[`${a}=${encodeURIComponent(l)}`];te.isNumber(o)&&p.push(`expires=${new Date(o).toUTCString()}`),te.isString(i)&&p.push(`path=${i}`),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 fd(a){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(a)}function hd(a,l){return l?a.replace(/\/?\/$/,"")+"/"+l.replace(/^\/+/,""):a}function Fs(a,l,o){let i=!fd(l);return a&&(i||o==!1)?hd(a,l):l}const Vs=a=>a instanceof Qt?{...a}:a;function er(a,l){l=l||{};const o={};function i(x,C,y,N){return te.isPlainObject(x)&&te.isPlainObject(C)?te.merge.call({caseless:N},x,C):te.isPlainObject(C)?te.merge({},C):te.isArray(C)?C.slice():C}function u(x,C,y,N){if(te.isUndefined(C)){if(!te.isUndefined(x))return i(void 0,x,y,N)}else return i(x,C,y,N)}function f(x,C){if(!te.isUndefined(C))return i(void 0,C)}function m(x,C){if(te.isUndefined(C)){if(!te.isUndefined(x))return i(void 0,x)}else return i(void 0,C)}function p(x,C,y){if(y in l)return i(x,C);if(y in a)return i(void 0,x)}const w={url:f,method:f,data:f,baseURL:m,transformRequest:m,transformResponse:m,paramsSerializer:m,timeout:m,timeoutMessage:m,withCredentials:m,withXSRFToken:m,adapter:m,responseType:m,xsrfCookieName:m,xsrfHeaderName:m,onUploadProgress:m,onDownloadProgress:m,decompress:m,maxContentLength:m,maxBodyLength:m,beforeRedirect:m,transport:m,httpAgent:m,httpsAgent:m,cancelToken:m,socketPath:m,responseEncoding:m,validateStatus:p,headers:(x,C,y)=>u(Vs(x),Vs(C),y,!0)};return te.forEach(Object.keys({...a,...l}),function(C){const y=w[C]||u,N=y(a[C],l[C],C);te.isUndefined(N)&&y!==p||(o[C]=N)}),o}const Us=a=>{const l=er({},a);let{data:o,withXSRFToken:i,xsrfHeaderName:u,xsrfCookieName:f,headers:m,auth:p}=l;if(l.headers=m=Qt.from(m),l.url=ks(Fs(l.baseURL,l.url,l.allowAbsoluteUrls),a.params,a.paramsSerializer),p&&m.set("Authorization","Basic "+btoa((p.username||"")+":"+(p.password?unescape(encodeURIComponent(p.password)):""))),te.isFormData(o)){if(Xt.hasStandardBrowserEnv||Xt.hasStandardBrowserWebWorkerEnv)m.setContentType(void 0);else if(te.isFunction(o.getHeaders)){const w=o.getHeaders(),x=["content-type","content-length"];Object.entries(w).forEach(([C,y])=>{x.includes(C.toLowerCase())&&m.set(C,y)})}}if(Xt.hasStandardBrowserEnv&&(i&&te.isFunction(i)&&(i=i(l)),i||i!==!1&&dd(l.url))){const w=u&&f&&ud.read(f);w&&m.set(u,w)}return l},md=typeof XMLHttpRequest<"u"&&function(a){return new Promise(function(o,i){const u=Us(a);let f=u.data;const m=Qt.from(u.headers).normalize();let{responseType:p,onUploadProgress:w,onDownloadProgress:x}=u,C,y,N,O,T;function v(){O&&O(),T&&T(),u.cancelToken&&u.cancelToken.unsubscribe(C),u.signal&&u.signal.removeEventListener("abort",C)}let D=new XMLHttpRequest;D.open(u.method.toUpperCase(),u.url,!0),D.timeout=u.timeout;function U(){if(!D)return;const R=Qt.from("getAllResponseHeaders"in D&&D.getAllResponseHeaders()),G={data:!p||p==="text"||p==="json"?D.responseText:D.response,status:D.status,statusText:D.statusText,headers:R,config:a,request:D};vs(function(V){o(V),v()},function(V){i(V),v()},G),D=null}"onloadend"in D?D.onloadend=U:D.onreadystatechange=function(){!D||D.readyState!==4||D.status===0&&!(D.responseURL&&D.responseURL.indexOf("file:")===0)||setTimeout(U)},D.onabort=function(){D&&(i(new Le("Request aborted",Le.ECONNABORTED,a,D)),D=null)},D.onerror=function(F){const G=F&&F.message?F.message:"Network Error",Z=new Le(G,Le.ERR_NETWORK,a,D);Z.event=F||null,i(Z),D=null},D.ontimeout=function(){let F=u.timeout?"timeout of "+u.timeout+"ms exceeded":"timeout exceeded";const G=u.transitional||Bs;u.timeoutErrorMessage&&(F=u.timeoutErrorMessage),i(new Le(F,G.clarifyTimeoutError?Le.ETIMEDOUT:Le.ECONNABORTED,a,D)),D=null},f===void 0&&m.setContentType(null),"setRequestHeader"in D&&te.forEach(m.toJSON(),function(F,G){D.setRequestHeader(G,F)}),te.isUndefined(u.withCredentials)||(D.withCredentials=!!u.withCredentials),p&&p!=="json"&&(D.responseType=u.responseType),x&&([N,T]=mi(x,!0),D.addEventListener("progress",N)),w&&D.upload&&([y,O]=mi(w),D.upload.addEventListener("progress",y),D.upload.addEventListener("loadend",O)),(u.cancelToken||u.signal)&&(C=R=>{D&&(i(!R||R.type?new xr(null,a,D):R),D.abort(),D=null)},u.cancelToken&&u.cancelToken.subscribe(C),u.signal&&(u.signal.aborted?C():u.signal.addEventListener("abort",C)));const M=ad(u.url);if(M&&Xt.protocols.indexOf(M)===-1){i(new Le("Unsupported protocol "+M+":",Le.ERR_BAD_REQUEST,a));return}D.send(f||null)})},gd=(a,l)=>{const{length:o}=a=a?a.filter(Boolean):[];if(l||o){let i=new AbortController,u;const f=function(x){if(!u){u=!0,p();const C=x instanceof Error?x:this.reason;i.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:w}=i;return w.unsubscribe=()=>te.asap(p),w}},pd=function*(a,l){let o=a.byteLength;if(o<l){yield a;return}let i=0,u;for(;i<o;)u=i+l,yield a.slice(i,u),i=u},xd=async function*(a,l){for await(const o of wd(a))yield*pd(o,l)},wd=async function*(a){if(a[Symbol.asyncIterator]){yield*a;return}const l=a.getReader();try{for(;;){const{done:o,value:i}=await l.read();if(o)break;yield i}}finally{await l.cancel()}},zs=(a,l,o,i)=>{const u=xd(a,l);let f=0,m,p=w=>{m||(m=!0,i&&i(w))};return new ReadableStream({async pull(w){try{const{done:x,value:C}=await u.next();if(x){p(),w.close();return}let y=C.byteLength;if(o){let N=f+=y;o(N)}w.enqueue(new Uint8Array(C))}catch(x){throw p(x),x}},cancel(w){return p(w),u.return()}},{highWaterMark:2})},Hs=64*1024,{isFunction:gi}=te,_d=(({Request:a,Response:l})=>({Request:a,Response:l}))(te.global),{ReadableStream:Gs,TextEncoder:Ws}=te.global,Xs=(a,...l)=>{try{return!!a(...l)}catch{return!1}},Cd=a=>{a=te.merge.call({skipUndefined:!0},_d,a);const{fetch:l,Request:o,Response:i}=a,u=l?gi(l):typeof fetch=="function",f=gi(o),m=gi(i);if(!u)return!1;const p=u&&gi(Gs),w=u&&(typeof Ws=="function"?(T=>v=>T.encode(v))(new Ws):async T=>new Uint8Array(await new o(T).arrayBuffer())),x=f&&p&&Xs(()=>{let T=!1;const v=new o(Xt.origin,{body:new Gs,method:"POST",get duplex(){return T=!0,"half"}}).headers.has("Content-Type");return T&&!v}),C=m&&p&&Xs(()=>te.isReadableStream(new i("").body)),y={stream:C&&(T=>T.body)};u&&["text","arrayBuffer","blob","formData","stream"].forEach(T=>{!y[T]&&(y[T]=(v,D)=>{let U=v&&v[T];if(U)return U.call(v);throw new Le(`Response type '${T}' is not supported`,Le.ERR_NOT_SUPPORT,D)})});const N=async T=>{if(T==null)return 0;if(te.isBlob(T))return T.size;if(te.isSpecCompliantForm(T))return(await new o(Xt.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 w(T)).byteLength},O=async(T,v)=>{const D=te.toFiniteNumber(T.getContentLength());return D??N(v)};return async T=>{let{url:v,method:D,data:U,signal:M,cancelToken:R,timeout:F,onDownloadProgress:G,onUploadProgress:Z,responseType:V,headers:P,withCredentials:L="same-origin",fetchOptions:re}=Us(T),Q=l||fetch;V=V?(V+"").toLowerCase():"text";let ee=gd([M,R&&R.toAbortSignal()],F),X=null;const H=ee&&ee.unsubscribe&&(()=>{ee.unsubscribe()});let I;try{if(Z&&x&&D!=="get"&&D!=="head"&&(I=await O(P,U))!==0){let de=new o(v,{method:"POST",body:U,duplex:"half"}),ce;if(te.isFormData(U)&&(ce=de.headers.get("content-type"))&&P.setContentType(ce),de.body){const[Ce,ge]=Ps(I,mi(Ls(Z)));U=zs(de.body,Hs,Ce,ge)}}te.isString(L)||(L=L?"include":"omit");const $=f&&"credentials"in o.prototype,j={...re,signal:ee,method:D.toUpperCase(),headers:P.normalize().toJSON(),body:U,duplex:"half",credentials:$?L:void 0};X=f&&new o(v,j);let q=await(f?Q(X,re):Q(v,j));const K=C&&(V==="stream"||V==="response");if(C&&(G||K&&H)){const de={};["status","statusText","headers"].forEach(De=>{de[De]=q[De]});const ce=te.toFiniteNumber(q.headers.get("content-length")),[Ce,ge]=G&&Ps(ce,mi(Ls(G),!0))||[];q=new i(zs(q.body,Hs,Ce,()=>{ge&&ge(),H&&H()}),de)}V=V||"text";let oe=await y[te.findKey(y,V)||"text"](q,T);return!K&&H&&H(),await new Promise((de,ce)=>{vs(de,ce,{data:oe,headers:Qt.from(q.headers),status:q.status,statusText:q.statusText,config:T,request:X})})}catch($){throw H&&H(),$&&$.name==="TypeError"&&/Load failed|fetch/i.test($.message)?Object.assign(new Le("Network Error",Le.ERR_NETWORK,T,X),{cause:$.cause||$}):Le.from($,$&&$.code,T,X)}}},Ed=new Map,$s=a=>{let l=a&&a.env||{};const{fetch:o,Request:i,Response:u}=l,f=[i,u,o];let m=f.length,p=m,w,x,C=Ed;for(;p--;)w=f[p],x=C.get(w),x===void 0&&C.set(w,x=p?new Map:Cd(l)),C=x;return x};$s();const oo={http:Gc,xhr:md,fetch:{get:$s}};te.forEach(oo,(a,l)=>{if(a){try{Object.defineProperty(a,"name",{value:l})}catch{}Object.defineProperty(a,"adapterName",{value:l})}});const js=a=>`- ${a}`,yd=a=>te.isFunction(a)||a===null||a===!1;function bd(a,l){a=te.isArray(a)?a:[a];const{length:o}=a;let i,u;const f={};for(let m=0;m<o;m++){i=a[m];let p;if(u=i,!yd(i)&&(u=oo[(p=String(i)).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(([w,x])=>`adapter ${w} `+(x===!1?"is not supported by the environment":"is not available in the build"));let p=o?m.length>1?`since :
1
+ (function(he,Te){typeof exports=="object"&&typeof module<"u"?Te(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"],Te):(he=typeof globalThis<"u"?globalThis:he||self,Te(he.InnoCloudsLib={},he.VueRouter,he.Pinia,he.Vue,he.VueuseCore,he.motionV))})(this,function(he,Te,_e,r,_t,Ot){"use strict";var qg=Object.defineProperty;var sl=he=>{throw TypeError(he)};var Zg=(he,Te,_e)=>Te in he?qg(he,Te,{enumerable:!0,configurable:!0,writable:!0,value:_e}):he[Te]=_e;var Re=(he,Te,_e)=>Zg(he,typeof Te!="symbol"?Te+"":Te,_e),al=(he,Te,_e)=>Te.has(he)||sl("Cannot "+_e);var _n=(he,Te,_e)=>(al(he,Te,"read from private field"),_e?_e.call(he):Te.get(he)),Ui=(he,Te,_e)=>Te.has(he)?sl("Cannot add the same private member more than once"):Te instanceof WeakSet?Te.add(he):Te.set(he,_e),Pn=(he,Te,_e,r)=>(al(he,Te,"write to private field"),r?r.call(he,_e):Te.set(he,_e),_e);var Zo=(he,Te,_e,r)=>({set _(_t){Pn(he,Te,_t,_e)},get _(){return _n(he,Te,r)}});var en,Gn,sr;function cl(a,l){for(var i=0;i<l.length;i++){const s=l[i];if(typeof s!="string"&&!Array.isArray(s)){for(const u in s)if(u!=="default"&&!(u in a)){const f=Object.getOwnPropertyDescriptor(s,u);f&&Object.defineProperty(a,u,f.get?f:{enumerable:!0,get:()=>s[u]})}}}return Object.freeze(Object.defineProperty(a,Symbol.toStringTag,{value:"Module"}))}function dl(a){return a}const ul=[];function fl(){return Te.createRouter({history:Te.createWebHistory(),routes:ul})}const zi=(a,l)=>l.some(i=>a instanceof i);let Yo,Ko;function hl(){return Yo||(Yo=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function ml(){return Ko||(Ko=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}const Hi=new WeakMap,Gi=new WeakMap,ri=new WeakMap;function gl(a){const l=new Promise((i,s)=>{const u=()=>{a.removeEventListener("success",f),a.removeEventListener("error",m)},f=()=>{i(zn(a.result)),u()},m=()=>{s(a.error),u()};a.addEventListener("success",f),a.addEventListener("error",m)});return ri.set(l,a),l}function pl(a){if(Hi.has(a))return;const l=new Promise((i,s)=>{const u=()=>{a.removeEventListener("complete",f),a.removeEventListener("error",m),a.removeEventListener("abort",m)},f=()=>{i(),u()},m=()=>{s(a.error||new DOMException("AbortError","AbortError")),u()};a.addEventListener("complete",f),a.addEventListener("error",m),a.addEventListener("abort",m)});Hi.set(a,l)}let Wi={get(a,l,i){if(a instanceof IDBTransaction){if(l==="done")return Hi.get(a);if(l==="store")return i.objectStoreNames[1]?void 0:i.objectStore(i.objectStoreNames[0])}return zn(a[l])},set(a,l,i){return a[l]=i,!0},has(a,l){return a instanceof IDBTransaction&&(l==="done"||l==="store")?!0:l in a}};function Qo(a){Wi=a(Wi)}function xl(a){return ml().includes(a)?function(...l){return a.apply(Xi(this),l),zn(this.request)}:function(...l){return zn(a.apply(Xi(this),l))}}function _l(a){return typeof a=="function"?xl(a):(a instanceof IDBTransaction&&pl(a),zi(a,hl())?new Proxy(a,Wi):a)}function zn(a){if(a instanceof IDBRequest)return gl(a);if(Gi.has(a))return Gi.get(a);const l=_l(a);return l!==a&&(Gi.set(a,l),ri.set(l,a)),l}const Xi=a=>ri.get(a);function wl(a,l,{blocked:i,upgrade:s,blocking:u,terminated:f}={}){const m=indexedDB.open(a,l),p=zn(m);return s&&m.addEventListener("upgradeneeded",_=>{s(zn(m.result),_.oldVersion,_.newVersion,zn(m.transaction),_)}),i&&m.addEventListener("blocked",_=>i(_.oldVersion,_.newVersion,_)),p.then(_=>{f&&_.addEventListener("close",()=>f()),u&&_.addEventListener("versionchange",x=>u(x.oldVersion,x.newVersion,x))}).catch(()=>{}),p}function Cl(a,{blocked:l}={}){const i=indexedDB.deleteDatabase(a);return l&&i.addEventListener("blocked",s=>l(s.oldVersion,s)),zn(i).then(()=>{})}const El=["get","getKey","getAll","getAllKeys","count"],yl=["put","add","delete","clear"],$i=new Map;function Jo(a,l){if(!(a instanceof IDBDatabase&&!(l in a)&&typeof l=="string"))return;if($i.get(l))return $i.get(l);const i=l.replace(/FromIndex$/,""),s=l!==i,u=yl.includes(i);if(!(i in(s?IDBIndex:IDBObjectStore).prototype)||!(u||El.includes(i)))return;const f=async function(m,...p){const _=this.transaction(m,u?"readwrite":"readonly");let x=_.store;return s&&(x=x.index(p.shift())),(await Promise.all([x[i](...p),u&&_.done]))[0]};return $i.set(l,f),f}Qo(a=>({...a,get:(l,i,s)=>Jo(l,i)||a.get(l,i,s),has:(l,i)=>!!Jo(l,i)||a.has(l,i)}));const bl=["continue","continuePrimaryKey","advance"],es={},ji=new WeakMap,ts=new WeakMap,Al={get(a,l){if(!bl.includes(l))return a[l];let i=es[l];return i||(i=es[l]=function(...s){ji.set(this,ts.get(this)[l](...s))}),i}};async function*Sl(...a){let l=this;if(l instanceof IDBCursor||(l=await l.openCursor(...a)),!l)return;l=l;const i=new Proxy(l,Al);for(ts.set(i,l),ri.set(i,Xi(l));l;)yield i,l=await(ji.get(i)||l.continue()),ji.delete(i)}function ns(a,l){return l===Symbol.asyncIterator&&zi(a,[IDBIndex,IDBObjectStore,IDBCursor])||l==="iterate"&&zi(a,[IDBIndex,IDBObjectStore])}Qo(a=>({...a,get(l,i,s){return ns(l,i)?Sl:a.get(l,i,s)},has(l,i){return ns(l,i)||a.has(l,i)}}));let Kn;function Il(){return wl("data",1,{upgrade(a){a.objectStoreNames.contains("groups")||a.createObjectStore("groups",{keyPath:"id"}),a.objectStoreNames.contains("media")||a.createObjectStore("media",{keyPath:"id"}),a.objectStoreNames.contains("products")||a.createObjectStore("products",{keyPath:"id"})}})}async function Qn(){if(Kn)try{const a=await Kn;return a.transaction("groups","readonly").commit(),a}catch{Kn=void 0}return Kn=Il(),Kn}async function qi(a){return(await Qn()).transaction("groups","readonly").objectStore("groups").get(a)}async function Dr(a,l){const s=(await Qn()).transaction("groups","readwrite");await s.objectStore("groups").put({id:a,data:l,timestamp:Date.now()}),await s.done}async function Nl(a,l){const i=JSON.parse(JSON.stringify(r.toRaw(l.value)));await Dr(a,i)}async function Zi(a,l){const s=(await Qn()).transaction("media","readwrite");await s.objectStore("media").put({id:a,blob:l,timestamp:Date.now()}),await s.done}async function fr(a){const u=await(await Qn()).transaction("media","readonly").objectStore("media").get(a);return u==null?void 0:u.blob}async function Tl(a){const i=(await Qn()).transaction("products","readwrite"),s=i.objectStore("products"),u=a.id;await s.put({id:u,product:a,timestamp:Date.now()}),await i.done}async function rs(a){const u=await(await Qn()).transaction("products","readonly").objectStore("products").get(a);return u==null?void 0:u.product}async function kl(){const a=Kn;if(Kn=void 0,a){const l=await a.catch(()=>null);l&&l.close()}try{await Cl("data",{blocked(){console.warn("Удаление заблокировано. открыты другие вкладки с сайтом.")}})}catch(l){console.error("Не удалось удалить базу: [lib, indexedDB]",l)}}function ii(a){"@babel/helpers - typeof";return ii=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(l){return typeof l}:function(l){return l&&typeof Symbol=="function"&&l.constructor===Symbol&&l!==Symbol.prototype?"symbol":typeof l},ii(a)}var Rl=/^\s+/,Bl=/\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=Ol(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,s,u,f,m,p;return i=l.r/255,s=l.g/255,u=l.b/255,i<=.03928?f=i/12.92:f=Math.pow((i+.055)/1.055,2.4),s<=.03928?m=s/12.92:m=Math.pow((s+.055)/1.055,2.4),u<=.03928?p=u/12.92:p=Math.pow((u+.055)/1.055,2.4),.2126*f+.7152*m+.0722*p},setAlpha:function(l){return this._a=cs(l),this._roundA=Math.round(100*this._a)/100,this},toHsv:function(){var l=os(this._r,this._g,this._b);return{h:l.h*360,s:l.s,v:l.v,a:this._a}},toHsvString:function(){var l=os(this._r,this._g,this._b),i=Math.round(l.h*360),s=Math.round(l.s*100),u=Math.round(l.v*100);return this._a==1?"hsv("+i+", "+s+"%, "+u+"%)":"hsva("+i+", "+s+"%, "+u+"%, "+this._roundA+")"},toHsl:function(){var l=is(this._r,this._g,this._b);return{h:l.h*360,s:l.s,l:l.l,a:this._a}},toHslString:function(){var l=is(this._r,this._g,this._b),i=Math.round(l.h*360),s=Math.round(l.s*100),u=Math.round(l.l*100);return this._a==1?"hsl("+i+", "+s+"%, "+u+"%)":"hsla("+i+", "+s+"%, "+u+"%, "+this._roundA+")"},toHex:function(l){return ss(this._r,this._g,this._b,l)},toHexString:function(l){return"#"+this.toHex(l)},toHex8:function(l){return Pl(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(wt(this._r,255)*100)+"%",g:Math.round(wt(this._g,255)*100)+"%",b:Math.round(wt(this._b,255)*100)+"%",a:this._a}},toPercentageRgbString:function(){return this._a==1?"rgb("+Math.round(wt(this._r,255)*100)+"%, "+Math.round(wt(this._g,255)*100)+"%, "+Math.round(wt(this._b,255)*100)+"%)":"rgba("+Math.round(wt(this._r,255)*100)+"%, "+Math.round(wt(this._g,255)*100)+"%, "+Math.round(wt(this._b,255)*100)+"%, "+this._roundA+")"},toName:function(){return this._a===0?"transparent":this._a<1?!1:ql[ss(this._r,this._g,this._b,!0)]||!1},toFilter:function(l){var i="#"+as(this._r,this._g,this._b,this._a),s=i,u=this._gradientType?"GradientType = 1, ":"";if(l){var f=Se(l);s="#"+as(f._r,f._g,f._b,f._a)}return"progid:DXImageTransform.Microsoft.gradient("+u+"startColorstr="+i+",endColorstr="+s+")"},toString:function(l){var i=!!l;l=l||this._format;var s=!1,u=this._a<1&&this._a>=0,f=!i&&u&&(l==="hex"||l==="hex6"||l==="hex3"||l==="hex4"||l==="hex8"||l==="name");return f?l==="name"&&this._a===0?this.toName():this.toRgbString():(l==="rgb"&&(s=this.toRgbString()),l==="prgb"&&(s=this.toPercentageRgbString()),(l==="hex"||l==="hex6")&&(s=this.toHexString()),l==="hex3"&&(s=this.toHexString(!0)),l==="hex4"&&(s=this.toHex8String(!0)),l==="hex8"&&(s=this.toHex8String()),l==="name"&&(s=this.toName()),l==="hsl"&&(s=this.toHslString()),l==="hsv"&&(s=this.toHsvString()),s||this.toHexString())},clone:function(){return Se(this.toString())},_applyModification:function(l,i){var s=l.apply(null,[this].concat([].slice.call(i)));return this._r=s._r,this._g=s._g,this._b=s._b,this.setAlpha(s._a),this},lighten:function(){return this._applyModification(Ul,arguments)},brighten:function(){return this._applyModification(zl,arguments)},darken:function(){return this._applyModification(Hl,arguments)},desaturate:function(){return this._applyModification(Ll,arguments)},saturate:function(){return this._applyModification(Fl,arguments)},greyscale:function(){return this._applyModification(Vl,arguments)},spin:function(){return this._applyModification(Gl,arguments)},_applyCombination:function(l,i){return l.apply(null,[this].concat([].slice.call(i)))},analogous:function(){return this._applyCombination($l,arguments)},complement:function(){return this._applyCombination(Wl,arguments)},monochromatic:function(){return this._applyCombination(jl,arguments)},splitcomplement:function(){return this._applyCombination(Xl,arguments)},triad:function(){return this._applyCombination(ls,[3])},tetrad:function(){return this._applyCombination(ls,[4])}},Se.fromRatio=function(a,l){if(ii(a)=="object"){var i={};for(var s in a)a.hasOwnProperty(s)&&(s==="a"?i[s]=a[s]:i[s]=vr(a[s]));a=i}return Se(a,l)};function Ol(a){var l={r:0,g:0,b:0},i=1,s=null,u=null,f=null,m=!1,p=!1;return typeof a=="string"&&(a=Ql(a)),ii(a)=="object"&&(Ln(a.r)&&Ln(a.g)&&Ln(a.b)?(l=Ml(a.r,a.g,a.b),m=!0,p=String(a.r).substr(-1)==="%"?"prgb":"rgb"):Ln(a.h)&&Ln(a.s)&&Ln(a.v)?(s=vr(a.s),u=vr(a.v),l=vl(a.h,s,u),m=!0,p="hsv"):Ln(a.h)&&Ln(a.s)&&Ln(a.l)&&(s=vr(a.s),f=vr(a.l),l=Dl(a.h,s,f),m=!0,p="hsl"),a.hasOwnProperty("a")&&(i=a.a)),i=cs(i),{ok:m,format:a.format||p,r:Math.min(255,Math.max(l.r,0)),g:Math.min(255,Math.max(l.g,0)),b:Math.min(255,Math.max(l.b,0)),a:i}}function Ml(a,l,i){return{r:wt(a,255)*255,g:wt(l,255)*255,b:wt(i,255)*255}}function is(a,l,i){a=wt(a,255),l=wt(l,255),i=wt(i,255);var s=Math.max(a,l,i),u=Math.min(a,l,i),f,m,p=(s+u)/2;if(s==u)f=m=0;else{var _=s-u;switch(m=p>.5?_/(2-s-u):_/(s+u),s){case a:f=(l-i)/_+(l<i?6:0);break;case l:f=(i-a)/_+2;break;case i:f=(a-l)/_+4;break}f/=6}return{h:f,s:m,l:p}}function Dl(a,l,i){var s,u,f;a=wt(a,360),l=wt(l,100),i=wt(i,100);function m(x,C,y){return y<0&&(y+=1),y>1&&(y-=1),y<1/6?x+(C-x)*6*y:y<1/2?C:y<2/3?x+(C-x)*(2/3-y)*6:x}if(l===0)s=u=f=i;else{var p=i<.5?i*(1+l):i+l-i*l,_=2*i-p;s=m(_,p,a+1/3),u=m(_,p,a),f=m(_,p,a-1/3)}return{r:s*255,g:u*255,b:f*255}}function os(a,l,i){a=wt(a,255),l=wt(l,255),i=wt(i,255);var s=Math.max(a,l,i),u=Math.min(a,l,i),f,m,p=s,_=s-u;if(m=s===0?0:_/s,s==u)f=0;else{switch(s){case a:f=(l-i)/_+(l<i?6:0);break;case l:f=(i-a)/_+2;break;case i:f=(a-l)/_+4;break}f/=6}return{h:f,s:m,v:p}}function vl(a,l,i){a=wt(a,360)*6,l=wt(l,100),i=wt(i,100);var s=Math.floor(a),u=a-s,f=i*(1-l),m=i*(1-u*l),p=i*(1-(1-u)*l),_=s%6,x=[i,m,f,f,p,i][_],C=[p,i,i,m,f,f][_],y=[f,f,p,i,i,m][_];return{r:x*255,g:C*255,b:y*255}}function ss(a,l,i,s){var u=[wn(Math.round(a).toString(16)),wn(Math.round(l).toString(16)),wn(Math.round(i).toString(16))];return s&&u[0].charAt(0)==u[0].charAt(1)&&u[1].charAt(0)==u[1].charAt(1)&&u[2].charAt(0)==u[2].charAt(1)?u[0].charAt(0)+u[1].charAt(0)+u[2].charAt(0):u.join("")}function Pl(a,l,i,s,u){var f=[wn(Math.round(a).toString(16)),wn(Math.round(l).toString(16)),wn(Math.round(i).toString(16)),wn(ds(s))];return u&&f[0].charAt(0)==f[0].charAt(1)&&f[1].charAt(0)==f[1].charAt(1)&&f[2].charAt(0)==f[2].charAt(1)&&f[3].charAt(0)==f[3].charAt(1)?f[0].charAt(0)+f[1].charAt(0)+f[2].charAt(0)+f[3].charAt(0):f.join("")}function as(a,l,i,s){var u=[wn(ds(s)),wn(Math.round(a).toString(16)),wn(Math.round(l).toString(16)),wn(Math.round(i).toString(16))];return u.join("")}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 Ll(a,l){l=l===0?0:l||10;var i=Se(a).toHsl();return i.s-=l/100,i.s=oi(i.s),Se(i)}function Fl(a,l){l=l===0?0:l||10;var i=Se(a).toHsl();return i.s+=l/100,i.s=oi(i.s),Se(i)}function Vl(a){return Se(a).desaturate(100)}function Ul(a,l){l=l===0?0:l||10;var i=Se(a).toHsl();return i.l+=l/100,i.l=oi(i.l),Se(i)}function zl(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 Hl(a,l){l=l===0?0:l||10;var i=Se(a).toHsl();return i.l-=l/100,i.l=oi(i.l),Se(i)}function Gl(a,l){var i=Se(a).toHsl(),s=(i.h+l)%360;return i.h=s<0?360+s:s,Se(i)}function Wl(a){var l=Se(a).toHsl();return l.h=(l.h+180)%360,Se(l)}function ls(a,l){if(isNaN(l)||l<=0)throw new Error("Argument to polyad must be a positive number");for(var i=Se(a).toHsl(),s=[Se(a)],u=360/l,f=1;f<l;f++)s.push(Se({h:(i.h+f*u)%360,s:i.s,l:i.l}));return s}function Xl(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 $l(a,l,i){l=l||6,i=i||30;var s=Se(a).toHsl(),u=360/i,f=[Se(a)];for(s.h=(s.h-(u*l>>1)+720)%360;--l;)s.h=(s.h+u)%360,f.push(Se(s));return f}function jl(a,l){l=l||6;for(var i=Se(a).toHsv(),s=i.h,u=i.s,f=i.v,m=[],p=1/l;l--;)m.push(Se({h:s,s:u,v:f})),f=(f+p)%1;return m}Se.mix=function(a,l,i){i=i===0?0:i||50;var s=Se(a).toRgb(),u=Se(l).toRgb(),f=i/100,m={r:(u.r-s.r)*f+s.r,g:(u.g-s.g)*f+s.g,b:(u.b-s.b)*f+s.b,a:(u.a-s.a)*f+s.a};return Se(m)},Se.readability=function(a,l){var i=Se(a),s=Se(l);return(Math.max(i.getLuminance(),s.getLuminance())+.05)/(Math.min(i.getLuminance(),s.getLuminance())+.05)},Se.isReadable=function(a,l,i){var s=Se.readability(a,l),u,f;switch(f=!1,u=Jl(i),u.level+u.size){case"AAsmall":case"AAAlarge":f=s>=4.5;break;case"AAlarge":f=s>=3;break;case"AAAsmall":f=s>=7;break}return f},Se.mostReadable=function(a,l,i){var s=null,u=0,f,m,p,_;i=i||{},m=i.includeFallbackColors,p=i.level,_=i.size;for(var x=0;x<l.length;x++)f=Se.readability(a,l[x]),f>u&&(u=f,s=Se(l[x]));return Se.isReadable(a,s,{level:p,size:_})||!m?s:(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"},ql=Se.hexNames=Zl(Yi);function Zl(a){var l={};for(var i in a)a.hasOwnProperty(i)&&(l[a[i]]=i);return l}function cs(a){return a=parseFloat(a),(isNaN(a)||a<0||a>1)&&(a=1),a}function wt(a,l){Yl(a)&&(a="100%");var i=Kl(a);return a=Math.min(l,Math.max(0,parseFloat(a))),i&&(a=parseInt(a*l,10)/100),Math.abs(a-l)<1e-6?1:a%l/parseFloat(l)}function oi(a){return Math.min(1,Math.max(0,a))}function sn(a){return parseInt(a,16)}function Yl(a){return typeof a=="string"&&a.indexOf(".")!=-1&&parseFloat(a)===1}function Kl(a){return typeof a=="string"&&a.indexOf("%")!=-1}function wn(a){return a.length==1?"0"+a:""+a}function vr(a){return a<=1&&(a=a*100+"%"),a}function ds(a){return Math.round(parseFloat(a)*255).toString(16)}function us(a){return sn(a)/255}var Cn=function(){var a="[-\\+]?\\d+%?",l="[-\\+]?\\d*\\.\\d+%?",i="(?:"+l+")|(?:"+a+")",s="[\\s|\\(]+("+i+")[,|\\s]+("+i+")[,|\\s]+("+i+")\\s*\\)?",u="[\\s|\\(]+("+i+")[,|\\s]+("+i+")[,|\\s]+("+i+")[,|\\s]+("+i+")\\s*\\)?";return{CSS_UNIT:new RegExp(i),rgb:new RegExp("rgb"+s),rgba:new RegExp("rgba"+u),hsl:new RegExp("hsl"+s),hsla:new RegExp("hsla"+u),hsv:new RegExp("hsv"+s),hsva:new RegExp("hsva"+u),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}}();function Ln(a){return!!Cn.CSS_UNIT.exec(a)}function Ql(a){a=a.replace(Rl,"").replace(Bl,"").toLowerCase();var l=!1;if(Yi[a])a=Yi[a],l=!0;else if(a=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var i;return(i=Cn.rgb.exec(a))?{r:i[1],g:i[2],b:i[3]}:(i=Cn.rgba.exec(a))?{r:i[1],g:i[2],b:i[3],a:i[4]}:(i=Cn.hsl.exec(a))?{h:i[1],s:i[2],l:i[3]}:(i=Cn.hsla.exec(a))?{h:i[1],s:i[2],l:i[3],a:i[4]}:(i=Cn.hsv.exec(a))?{h:i[1],s:i[2],v:i[3]}:(i=Cn.hsva.exec(a))?{h:i[1],s:i[2],v:i[3],a:i[4]}:(i=Cn.hex8.exec(a))?{r:sn(i[1]),g:sn(i[2]),b:sn(i[3]),a:us(i[4]),format:l?"name":"hex8"}:(i=Cn.hex6.exec(a))?{r:sn(i[1]),g:sn(i[2]),b:sn(i[3]),format:l?"name":"hex"}:(i=Cn.hex4.exec(a))?{r:sn(i[1]+""+i[1]),g:sn(i[2]+""+i[2]),b:sn(i[3]+""+i[3]),a:us(i[4]+""+i[4]),format:l?"name":"hex8"}:(i=Cn.hex3.exec(a))?{r:sn(i[1]+""+i[1]),g:sn(i[2]+""+i[2]),b:sn(i[3]+""+i[3]),format:l?"name":"hex"}:!1}function Jl(a){var l,i;return a=a||{level:"AA",size:"small"},l=(a.level||"AA").toUpperCase(),i=(a.size||"small").toLowerCase(),l!=="AA"&&l!=="AAA"&&(l="AA"),i!=="small"&&i!=="large"&&(i="small"),{level:l,size:i}}const si=_e.defineStore("imageCache",()=>{const a=r.ref({});let l=!1;function i(_,x){const C=String(_);a.value[C]&&URL.revokeObjectURL(a.value[C]);const y=URL.createObjectURL(x);a.value[C]=y}async function s(_){if(!_){console.warn("initCacheSingle called with null/undefined id");return}const x=String(_);if(a.value[x])return;const C=await fr(x);C&&(await scheduler.yield(),i(x,C),window.dispatchEvent(new CustomEvent("image-cached",{detail:{id:x,blob:C}})))}function u(_){const{id:x,blob:C}=_.detail;x&&C&&i(x,C)}function f(){typeof window>"u"||l||(window.addEventListener("image-cached",u),l=!0)}function m(){typeof window>"u"||!l||(window.removeEventListener("image-cached",u),l=!1)}function p(){Object.values(a.value).forEach(URL.revokeObjectURL),a.value={}}return typeof window<"u"&&f(),{cache:a,initCacheSingle:s,updateCacheFromBlob:i,cleanup:p,setupEventListener:f,removeEventListener:m}}),St=_e.defineStore("themeLib",()=>{const a=si(),{initCacheSingle:l}=a,i=r.ref({id:"",created_at:null,logo:null,primary_color:null,accent_color:null,accent_light_color:null,accent_dark_color:null,bg_button_color:null,bonuses_button_name:void 0,qr_auth_required:!0,qr_bypass_guest_auth:null,qr_show_pay_button_ts:null,kiosk_bypass_guest_auth:null,kiosk_disable_lock_screen:null,kiosk_hide_banner:null,inactive_button_color:null,cards_color:null,text_color:null,nonworking_bg_color:null,retail_mode:null,splash_image_url:null,splash_video:null,splash_duration:0,splash_type:null,fallback_image:null,adult_disclaimer_text:null,adult_disclaimer_image:null,kiosk_enable_wheel:null,kiosk_banner:null,kiosk_preloader:null,organization:"",kiosk_qr_payment_timeout:null,gradientStyle:null,kiosk_inactivity_timeout:null,kiosk_show_loyalty_card_button:null,kiosk_show_loyalty_phone_input_button:null,cart_loyalty_button:{cart_loyalty_button_sticker:null,cart_loyalty_button_text:null},comments:null,show_nutrition_in_cart:null,apply_custom_size_picker_fonts:null,size_picker_unselected_font_size:null,size_picker_selected_font_size:null,hide_discounts_calculate_button:!1,enable_sequential_modifiers:!1,pdf_return_url:null,kiosk_hide_manual_input_loyalty_card:null,kiosk_camera_scan_loyalty_card:null,kiosk_hide_menu_update_notification:null,kiosk_proceed_to_payment_text:null,dish_cart_mod_choice_text:null,qr_show_modifiers_in_cart:null,kiosk_show_modifiers_in_cart:null}),s=async f=>{if(!f)return;i.value={...f};const m=await fr("banner"),p=await fr("preloader"),_=await fr("defaultImage");m||u(f.kiosk_banner,"banner"),p||u(f.kiosk_preloader,"preloader"),_||u(f.fallback_image,"defaultImage"),document.documentElement.style.setProperty("--primaryColor",f.primary_color),document.documentElement.style.setProperty("--accentColor",f.accent_color),document.documentElement.style.setProperty("--accentLightColor",f.accent_light_color),document.documentElement.style.setProperty("--accentDarkColor",f.accent_dark_color),document.documentElement.style.setProperty("--bgButtonColor",f.bg_button_color),document.documentElement.style.setProperty("--inactiveButtonColor",f.inactive_button_color),document.documentElement.style.setProperty("--cardsColor",f.cards_color),document.documentElement.style.setProperty("--textColor",f.text_color),document.documentElement.style.setProperty("--nonworkingBgColor",f.nonworking_bg_color),f.apply_custom_size_picker_fonts&&f.size_picker_unselected_font_size&&f.size_picker_unselected_font_size>0&&document.documentElement.style.setProperty("--sizePickerUnselectedFontSize",`${f.size_picker_unselected_font_size}rem`),f.apply_custom_size_picker_fonts&&f.size_picker_selected_font_size&&f.size_picker_selected_font_size>0&&document.documentElement.style.setProperty("--sizePickerSelectedFontSize",`${f.size_picker_selected_font_size}rem`);const x=i.value.primary_color||"#F2F7FF",C=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:s}}),hr=a=>{if(!a)return 0;if((a.price===0||a.price===null)&&a.sizes&&a.sizes.length>0){const l=a.sizes.find(i=>i.is_default===!0);return l?l.price:a.sizes.length>1?a.sizes[1].price??a.sizes[0].price:a.sizes[0].price}return a.price};class Pr extends Error{}Pr.prototype.name="InvalidTokenError";function ec(a){return decodeURIComponent(atob(a).replace(/(.)/g,(l,i)=>{let s=i.charCodeAt(0).toString(16).toUpperCase();return s.length<2&&(s="0"+s),"%"+s}))}function tc(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 ec(l)}catch{return atob(l)}}function fs(a,l){if(typeof a!="string")throw new Pr("Invalid token specified: must be a string");l||(l={});const i=l.header===!0?0:1,s=a.split(".")[i];if(typeof s!="string")throw new Pr(`Invalid token specified: missing part #${i+1}`);let u;try{u=tc(s)}catch(f){throw new Pr(`Invalid token specified: invalid base64 for part #${i+1} (${f.message})`)}try{return JSON.parse(u)}catch(f){throw new Pr(`Invalid token specified: invalid json for part #${i+1} (${f.message})`)}}const nc=(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},rc=(a,l)=>{if(typeof window<"u"){const i=localStorage.getItem(a);if(i)try{return fs(JSON.parse(i))}catch(s){return console.error("Failed to decode JWT:",s),l}}return l},hs=(a,l,i="normal")=>{const s=r.ref(i==="jwt"?rc(a,l):nc(a,l));return r.watchEffect(()=>{s.value===null||s.value===void 0?localStorage.removeItem(a):i!=="jwt"&&localStorage.setItem(a,JSON.stringify(s.value))}),s},mr=a=>{a.forEach(l=>{try{localStorage.removeItem(l)}catch(i){console.error(`Ошибка при удалении ключа "${l}":`,i)}})};class ic{constructor(l,i={}){Re(this,"url");Re(this,"options");Re(this,"ws");Re(this,"reconnectInterval");Re(this,"listeners");Re(this,"isConnected");Re(this,"heartbeat");Re(this,"heartbeatTimeout");Re(this,"pingTimeout");Re(this,"pingResponseTimeout");Re(this,"signal");Re(this,"_shouldReconnect",!0);this.url=l,this.options=i,this.ws=null,this.reconnectInterval=5e3,this.pingResponseTimeout=5e3,this.listeners=new Map,this.isConnected=r.ref(!1),this.heartbeatTimeout=i.heartbeatTimeout||3e5}connect(){var i,s;if(this.ws&&this.ws.readyState===WebSocket.OPEN){console.warn("WebSocket already open");return}if(!this._shouldReconnect){console.warn("Reconnection disabled");return}const l=`${this.url}`;this.ws=new WebSocket(l),(i=this.options.signal)!=null&&i.aborted&&this.close(!0),(s=this.options.signal)==null||s.addEventListener("abort",()=>this.close(!0)),this.ws.onopen=()=>{console.warn("WebSocket connected"),this.isConnected.value=!0,this.emit("open"),this.heartbeat=setInterval(()=>this.sendPing(),this.heartbeatTimeout)},this.ws.onmessage=u=>{try{const f=JSON.parse(u.data);this.emit("message",f),f!=null&&f.type&&f.type!=="ping"&&clearTimeout(this.pingTimeout)}catch(f){console.error("Error parsing WebSocket message:",f)}},this.ws.onerror=u=>{console.error("WebSocket error:",u),this.emit("error",u),this.close(!0)},this.ws.onclose=()=>{this.isConnected.value=!1,console.warn("WebSocket closed"),this.emit("close"),clearInterval(this.heartbeat),clearTimeout(this.pingTimeout),this._shouldReconnect&&(console.log(`Reconnecting in ${this.reconnectInterval}ms...`),setTimeout(()=>this.connect(),this.reconnectInterval))}}sendPing(){var l;this.isConnected.value&&((l=this.ws)==null?void 0:l.readyState)===WebSocket.OPEN?(this.ws.send(JSON.stringify({type:"ping"})),this.pingTimeout=setTimeout(()=>{console.warn("No pong received, reconnecting..."),this.close(!0),this.connect()},this.pingResponseTimeout)):console.warn("WebSocket not connected, cannot send ping")}send(l){var i;this.isConnected.value&&((i=this.ws)==null?void 0:i.readyState)===WebSocket.OPEN?this.ws.send(JSON.stringify(l)):console.warn("WebSocket not connected")}close(l=!1){this.ws&&(this._shouldReconnect=!l,this.ws.close(),clearInterval(this.heartbeat),clearTimeout(this.pingTimeout),this.ws=null,this.listeners.clear())}on(l,i){this.listeners.has(l)||this.listeners.set(l,[]),this.listeners.get(l).push(i)}off(l,i){const s=this.listeners.get(l);s&&this.listeners.set(l,s.filter(u=>u!==i))}emit(l,i=null){const s=this.listeners.get(l);s&&s.forEach(u=>u(i))}getConnectionStatus(){return this.isConnected}}let ai=new Map;function Lr(a,l={}){var s;if(ai.has(a)){const u=ai.get(a);if(u.isConnected.value&&((s=u.ws)==null?void 0:s.readyState)===WebSocket.OPEN)return u.listeners.clear(),u;u.close(!0),ai.delete(a)}const i=new ic(a,l);return ai.set(a,i),i}const st=_e.defineStore("mainLib",()=>{const a=r.ref(),l=r.ref(!1),i=r.ref(localStorage.getItem("kiosk_timeout")),s=r.ref(0),u=r.ref(!1),f=r.ref(sessionStorage.getItem("is_adult")==="true"),m=r.ref([]),p=r.ref([]),_=r.ref(!1),x=r.ref(),C=r.ref(""),y=r.ref(0),I=r.ref(!1),O=r.ref(!1),N=r.ref(!0),v=r.ref(!localStorage.getItem("apiKey")),k=r.ref(!1),P=r.ref({textNotification:""}),D=r.ref([]);let M=null;const q=Z=>{const ee=`wss://${x.value.area}/ws/device/${Z}/`;M=Lr(ee);function de(){console.log("WebSocket connection opened")}function ce(ge){if(ge.error)k.value=!0,P.value.textNotification=ge.error,M==null||M.close(!0);else{if(!(ge!=null&&ge.params))return;typeof ge.params.components.shift.is_ok!==null?N.value=ge.params.components.shift.is_ok:N.value=!0}}function Ce(ge){console.error("WebSocket error:",ge),M.close(!0)}M.on("open",de),M.on("message",ce),M.on("error",Ce),M.connect()},W=Z=>{s.value=Z,localStorage.setItem("kiosk_timeout",Z)},Y=Z=>{l.value=Z},F=r.ref(null),L=r.computed(()=>m.value.reduce((Z,ee)=>{let de=0,ce=0;return ee.group_modifiers&&(de=ee.group_modifiers.reduce((Ce,ge)=>ge.modifiers?Ce+ge.modifiers.reduce((De,xe)=>De+xe.old_price*xe.amount,0):0,0)*ee.amount),ee.modifiers&&(ce=ee.modifiers.reduce((Ce,ge)=>Ce+ge.old_price*ge.amount,0)*ee.amount),Z+ee.old_price*ee.amount+de+ce},0)),V=r.computed({get:()=>m.value.length===0||F.value===0?0:F.value&&F.value!==0?F.value:m.value.reduce((Z,ee)=>{const de=hr(ee)*ee.amount;let ce=0,Ce=0;return ee.group_modifiers&&(ce=ee.group_modifiers.reduce((ge,De)=>De.modifiers?ge+De.modifiers.reduce((xe,Ct)=>xe+Ct.price*Ct.amount,0):0,0)*ee.amount),ee.modifiers&&(Ce=ee.modifiers.reduce((ge,De)=>ge+De.price*De.amount,0)*ee.amount),Z+de+ce+Ce},0),set(Z){F.value=Z}}),ie=Z=>{y.value=Z,localStorage.removeItem("bonus"),hs("bonus",y.value)},Q=Z=>{mr(Z)},te=Z=>{Z={...Z,idSystem:crypto.randomUUID()};const ee=z(Z);m.value.push(ee),G()},G=()=>{try{if(!m.value||m.value.length===0){localStorage.removeItem("cart");return}localStorage.setItem("cart",JSON.stringify(r.toRaw(m.value)))}catch(Z){console.error("Failed to update cart in localStorage:",Z)}},z=Z=>r.reactive({...Z,amount:Z.amount??1,price:Z.old_price,new_price:null,total_new_price:null,discounts:[],modifiers:(Z.modifiers||[]).map(ee=>r.reactive({...ee,price:ee.old_price,new_price:null,total_new_price:null})),group_modifiers:(Z.group_modifiers||[]).map(ee=>r.reactive({...ee,modifiers:(ee.modifiers||[]).map(de=>r.reactive({...de,price:de.old_price,new_price:null,total_new_price:null}))}))}),T=Z=>{const ee=m.value.find(de=>de.idSystem===Z);ee&&(ee.amount+=1),G()},X=Z=>{const ee=m.value.find(de=>de.idSystem===Z);ee&&(ee.amount>=1&&(ee.amount-=1),G())},$=()=>{try{const Z=localStorage.getItem("cart");if(Z){const ee=JSON.parse(Z);m.value.splice(0,m.value.length,...ee.map(z)),F.value=null}}catch(Z){console.error("Failed to load cart from localStorage:",Z)}};return $(),{cartProducts_lib:m,activeScrolling_lib:p,config_lib:x,totalPrice_lib:V,initialCartPrice_lib:L,is_notification_lib:k,notificationData_lib:P,xApiKey_lib:C,countBonus:y,toggleDrum:l,is_showApiKey:v,openApiKey:I,kiosk_timeout:i,kiosk_FirstTimeout:s,is_OpenLoyal:O,profile:a,is_18_above_content:u,is18Allowed:f,healthState:N,displayCards:D,isOrderTypeSubmited:_,removeFromLocalStorage:Q,setKioskTimeout:W,setBonus:ie,setStateDrum:Y,addToCart:te,plusAmount:T,minusAmount:X,loadCart:$,deleteItemFromCart:Z=>{if(Z){const ee=m.value.findIndex(de=>de.idSystem===Z);if(ee===-1)return;m.value.splice(ee,1),G(),F.value=null}else m.value=[],G()},updateCartInLocalStorage:G,makeProductFullyReactive:z,checkHeartbeatApp:q}});function ms(a,l){return function(){return a.apply(l,arguments)}}const{toString:oc}=Object.prototype,{getPrototypeOf:Ki}=Object,{iterator:li,toStringTag:gs}=Symbol,ci=(a=>l=>{const i=oc.call(l);return a[i]||(a[i]=i.slice(8,-1).toLowerCase())})(Object.create(null)),En=a=>(a=a.toLowerCase(),l=>ci(l)===a),di=a=>l=>typeof l===a,{isArray:gr}=Array,pr=di("undefined");function Fr(a){return a!==null&&!pr(a)&&a.constructor!==null&&!pr(a.constructor)&&Kt(a.constructor.isBuffer)&&a.constructor.isBuffer(a)}const ps=En("ArrayBuffer");function sc(a){let l;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?l=ArrayBuffer.isView(a):l=a&&a.buffer&&ps(a.buffer),l}const ac=di("string"),Kt=di("function"),xs=di("number"),Vr=a=>a!==null&&typeof a=="object",lc=a=>a===!0||a===!1,ui=a=>{if(ci(a)!=="object")return!1;const l=Ki(a);return(l===null||l===Object.prototype||Object.getPrototypeOf(l)===null)&&!(gs in a)&&!(li in a)},cc=a=>{if(!Vr(a)||Fr(a))return!1;try{return Object.keys(a).length===0&&Object.getPrototypeOf(a)===Object.prototype}catch{return!1}},dc=En("Date"),uc=En("File"),fc=En("Blob"),hc=En("FileList"),mc=a=>Vr(a)&&Kt(a.pipe),gc=a=>{let l;return a&&(typeof FormData=="function"&&a instanceof FormData||Kt(a.append)&&((l=ci(a))==="formdata"||l==="object"&&Kt(a.toString)&&a.toString()==="[object FormData]"))},pc=En("URLSearchParams"),[xc,_c,wc,Cc]=["ReadableStream","Request","Response","Headers"].map(En),Ec=a=>a.trim?a.trim():a.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Ur(a,l,{allOwnKeys:i=!1}={}){if(a===null||typeof a>"u")return;let s,u;if(typeof a!="object"&&(a=[a]),gr(a))for(s=0,u=a.length;s<u;s++)l.call(null,a[s],s,a);else{if(Fr(a))return;const f=i?Object.getOwnPropertyNames(a):Object.keys(a),m=f.length;let p;for(s=0;s<m;s++)p=f[s],l.call(null,a[p],p,a)}}function _s(a,l){if(Fr(a))return null;l=l.toLowerCase();const i=Object.keys(a);let s=i.length,u;for(;s-- >0;)if(u=i[s],l===u.toLowerCase())return u;return null}const Jn=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,ws=a=>!pr(a)&&a!==Jn;function Qi(){const{caseless:a,skipUndefined:l}=ws(this)&&this||{},i={},s=(u,f)=>{const m=a&&_s(i,f)||f;ui(i[m])&&ui(u)?i[m]=Qi(i[m],u):ui(u)?i[m]=Qi({},u):gr(u)?i[m]=u.slice():(!l||!pr(u))&&(i[m]=u)};for(let u=0,f=arguments.length;u<f;u++)arguments[u]&&Ur(arguments[u],s);return i}const yc=(a,l,i,{allOwnKeys:s}={})=>(Ur(l,(u,f)=>{i&&Kt(u)?a[f]=ms(u,i):a[f]=u},{allOwnKeys:s}),a),bc=a=>(a.charCodeAt(0)===65279&&(a=a.slice(1)),a),Ac=(a,l,i,s)=>{a.prototype=Object.create(l.prototype,s),a.prototype.constructor=a,Object.defineProperty(a,"super",{value:l.prototype}),i&&Object.assign(a.prototype,i)},Sc=(a,l,i,s)=>{let u,f,m;const p={};if(l=l||{},a==null)return l;do{for(u=Object.getOwnPropertyNames(a),f=u.length;f-- >0;)m=u[f],(!s||s(m,a,l))&&!p[m]&&(l[m]=a[m],p[m]=!0);a=i!==!1&&Ki(a)}while(a&&(!i||i(a,l))&&a!==Object.prototype);return l},Ic=(a,l,i)=>{a=String(a),(i===void 0||i>a.length)&&(i=a.length),i-=l.length;const s=a.indexOf(l,i);return s!==-1&&s===i},Nc=a=>{if(!a)return null;if(gr(a))return a;let l=a.length;if(!xs(l))return null;const i=new Array(l);for(;l-- >0;)i[l]=a[l];return i},Tc=(a=>l=>a&&l instanceof a)(typeof Uint8Array<"u"&&Ki(Uint8Array)),kc=(a,l)=>{const s=(a&&a[li]).call(a);let u;for(;(u=s.next())&&!u.done;){const f=u.value;l.call(a,f[0],f[1])}},Rc=(a,l)=>{let i;const s=[];for(;(i=a.exec(l))!==null;)s.push(i);return s},Bc=En("HTMLFormElement"),Oc=a=>a.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(i,s,u){return s.toUpperCase()+u}),Cs=(({hasOwnProperty:a})=>(l,i)=>a.call(l,i))(Object.prototype),Mc=En("RegExp"),Es=(a,l)=>{const i=Object.getOwnPropertyDescriptors(a),s={};Ur(i,(u,f)=>{let m;(m=l(u,f,a))!==!1&&(s[f]=m||u)}),Object.defineProperties(a,s)},Dc=a=>{Es(a,(l,i)=>{if(Kt(a)&&["arguments","caller","callee"].indexOf(i)!==-1)return!1;const s=a[i];if(Kt(s)){if(l.enumerable=!1,"writable"in l){l.writable=!1;return}l.set||(l.set=()=>{throw Error("Can not rewrite read-only method '"+i+"'")})}})},vc=(a,l)=>{const i={},s=u=>{u.forEach(f=>{i[f]=!0})};return gr(a)?s(a):s(String(a).split(l)),i},Pc=()=>{},Lc=(a,l)=>a!=null&&Number.isFinite(a=+a)?a:l;function Fc(a){return!!(a&&Kt(a.append)&&a[gs]==="FormData"&&a[li])}const Vc=a=>{const l=new Array(10),i=(s,u)=>{if(Vr(s)){if(l.indexOf(s)>=0)return;if(Fr(s))return s;if(!("toJSON"in s)){l[u]=s;const f=gr(s)?[]:{};return Ur(s,(m,p)=>{const _=i(m,u+1);!pr(_)&&(f[p]=_)}),l[u]=void 0,f}}return s};return i(a,0)},Uc=En("AsyncFunction"),zc=a=>a&&(Vr(a)||Kt(a))&&Kt(a.then)&&Kt(a.catch),ys=((a,l)=>a?setImmediate:l?((i,s)=>(Jn.addEventListener("message",({source:u,data:f})=>{u===Jn&&f===i&&s.length&&s.shift()()},!1),u=>{s.push(u),Jn.postMessage(i,"*")}))(`axios@${Math.random()}`,[]):i=>setTimeout(i))(typeof setImmediate=="function",Kt(Jn.postMessage)),Hc=typeof queueMicrotask<"u"?queueMicrotask.bind(Jn):typeof process<"u"&&process.nextTick||ys,ne={isArray:gr,isArrayBuffer:ps,isBuffer:Fr,isFormData:gc,isArrayBufferView:sc,isString:ac,isNumber:xs,isBoolean:lc,isObject:Vr,isPlainObject:ui,isEmptyObject:cc,isReadableStream:xc,isRequest:_c,isResponse:wc,isHeaders:Cc,isUndefined:pr,isDate:dc,isFile:uc,isBlob:fc,isRegExp:Mc,isFunction:Kt,isStream:mc,isURLSearchParams:pc,isTypedArray:Tc,isFileList:hc,forEach:Ur,merge:Qi,extend:yc,trim:Ec,stripBOM:bc,inherits:Ac,toFlatObject:Sc,kindOf:ci,kindOfTest:En,endsWith:Ic,toArray:Nc,forEachEntry:kc,matchAll:Rc,isHTMLForm:Bc,hasOwnProperty:Cs,hasOwnProp:Cs,reduceDescriptors:Es,freezeMethods:Dc,toObjectSet:vc,toCamelCase:Oc,noop:Pc,toFiniteNumber:Lc,findKey:_s,global:Jn,isContextDefined:ws,isSpecCompliantForm:Fc,toJSONObject:Vc,isAsyncFn:Uc,isThenable:zc,setImmediate:ys,asap:Hc,isIterable:a=>a!=null&&Kt(a[li])};function Le(a,l,i,s,u){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=a,this.name="AxiosError",l&&(this.code=l),i&&(this.config=i),s&&(this.request=s),u&&(this.response=u,this.status=u.status?u.status:null)}ne.inherits(Le,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:ne.toJSONObject(this.config),code:this.code,status:this.status}}});const bs=Le.prototype,As={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(a=>{As[a]={value:a}}),Object.defineProperties(Le,As),Object.defineProperty(bs,"isAxiosError",{value:!0}),Le.from=(a,l,i,s,u,f)=>{const m=Object.create(bs);ne.toFlatObject(a,m,function(C){return C!==Error.prototype},x=>x!=="isAxiosError");const p=a&&a.message?a.message:"Error",_=l==null&&a?a.code:l;return Le.call(m,p,_,i,s,u),a&&m.cause==null&&Object.defineProperty(m,"cause",{value:a,configurable:!0}),m.name=a&&a.name||"Error",f&&Object.assign(m,f),m};const Gc=null;function Ji(a){return ne.isPlainObject(a)||ne.isArray(a)}function Ss(a){return ne.endsWith(a,"[]")?a.slice(0,-2):a}function Is(a,l,i){return a?a.concat(l).map(function(u,f){return u=Ss(u),!i&&f?"["+u+"]":u}).join(i?".":""):l}function Wc(a){return ne.isArray(a)&&!a.some(Ji)}const Xc=ne.toFlatObject(ne,{},null,function(l){return/^is[A-Z]/.test(l)});function fi(a,l,i){if(!ne.isObject(a))throw new TypeError("target must be an object");l=l||new FormData,i=ne.toFlatObject(i,{metaTokens:!0,dots:!1,indexes:!1},!1,function(v,k){return!ne.isUndefined(k[v])});const s=i.metaTokens,u=i.visitor||C,f=i.dots,m=i.indexes,_=(i.Blob||typeof Blob<"u"&&Blob)&&ne.isSpecCompliantForm(l);if(!ne.isFunction(u))throw new TypeError("visitor must be a function");function x(N){if(N===null)return"";if(ne.isDate(N))return N.toISOString();if(ne.isBoolean(N))return N.toString();if(!_&&ne.isBlob(N))throw new Le("Blob is not supported. Use a Buffer instead.");return ne.isArrayBuffer(N)||ne.isTypedArray(N)?_&&typeof Blob=="function"?new Blob([N]):Buffer.from(N):N}function C(N,v,k){let P=N;if(N&&!k&&typeof N=="object"){if(ne.endsWith(v,"{}"))v=s?v:v.slice(0,-2),N=JSON.stringify(N);else if(ne.isArray(N)&&Wc(N)||(ne.isFileList(N)||ne.endsWith(v,"[]"))&&(P=ne.toArray(N)))return v=Ss(v),P.forEach(function(M,q){!(ne.isUndefined(M)||M===null)&&l.append(m===!0?Is([v],q,f):m===null?v:v+"[]",x(M))}),!1}return Ji(N)?!0:(l.append(Is(k,v,f),x(N)),!1)}const y=[],I=Object.assign(Xc,{defaultVisitor:C,convertValue:x,isVisitable:Ji});function O(N,v){if(!ne.isUndefined(N)){if(y.indexOf(N)!==-1)throw Error("Circular reference detected in "+v.join("."));y.push(N),ne.forEach(N,function(P,D){(!(ne.isUndefined(P)||P===null)&&u.call(l,P,ne.isString(D)?D.trim():D,v,I))===!0&&O(P,v?v.concat(D):[D])}),y.pop()}}if(!ne.isObject(a))throw new TypeError("data must be an object");return O(a),l}function Ns(a){const l={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(a).replace(/[!'()~]|%20|%00/g,function(s){return l[s]})}function eo(a,l){this._pairs=[],a&&fi(a,this,l)}const Ts=eo.prototype;Ts.append=function(l,i){this._pairs.push([l,i])},Ts.toString=function(l){const i=l?function(s){return l.call(this,s,Ns)}:Ns;return this._pairs.map(function(u){return i(u[0])+"="+i(u[1])},"").join("&")};function $c(a){return encodeURIComponent(a).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function ks(a,l,i){if(!l)return a;const s=i&&i.encode||$c;ne.isFunction(i)&&(i={serialize:i});const u=i&&i.serialize;let f;if(u?f=u(l,i):f=ne.isURLSearchParams(l)?l.toString():new eo(l,i).toString(s),f){const m=a.indexOf("#");m!==-1&&(a=a.slice(0,m)),a+=(a.indexOf("?")===-1?"?":"&")+f}return a}class Rs{constructor(){this.handlers=[]}use(l,i,s){return this.handlers.push({fulfilled:l,rejected:i,synchronous:s?s.synchronous:!1,runWhen:s?s.runWhen:null}),this.handlers.length-1}eject(l){this.handlers[l]&&(this.handlers[l]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(l){ne.forEach(this.handlers,function(s){s!==null&&l(s)})}}const Bs={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},jc={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,qc=to&&(!no||["ReactNative","NativeScript","NS"].indexOf(no.product)<0),Zc=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Yc=to&&window.location.href||"http://localhost",Xt={...Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:to,hasStandardBrowserEnv:qc,hasStandardBrowserWebWorkerEnv:Zc,navigator:no,origin:Yc},Symbol.toStringTag,{value:"Module"})),...jc};function Kc(a,l){return fi(a,new Xt.classes.URLSearchParams,{visitor:function(i,s,u,f){return Xt.isNode&&ne.isBuffer(i)?(this.append(s,i.toString("base64")),!1):f.defaultVisitor.apply(this,arguments)},...l})}function Qc(a){return ne.matchAll(/\w+|\[(\w*)]/g,a).map(l=>l[0]==="[]"?"":l[1]||l[0])}function Jc(a){const l={},i=Object.keys(a);let s;const u=i.length;let f;for(s=0;s<u;s++)f=i[s],l[f]=a[f];return l}function Os(a){function l(i,s,u,f){let m=i[f++];if(m==="__proto__")return!0;const p=Number.isFinite(+m),_=f>=i.length;return m=!m&&ne.isArray(u)?u.length:m,_?(ne.hasOwnProp(u,m)?u[m]=[u[m],s]:u[m]=s,!p):((!u[m]||!ne.isObject(u[m]))&&(u[m]=[]),l(i,s,u[m],f)&&ne.isArray(u[m])&&(u[m]=Jc(u[m])),!p)}if(ne.isFormData(a)&&ne.isFunction(a.entries)){const i={};return ne.forEachEntry(a,(s,u)=>{l(Qc(s),u,i,0)}),i}return null}function ed(a,l,i){if(ne.isString(a))try{return(l||JSON.parse)(a),ne.trim(a)}catch(s){if(s.name!=="SyntaxError")throw s}return(i||JSON.stringify)(a)}const zr={transitional:Bs,adapter:["xhr","http","fetch"],transformRequest:[function(l,i){const s=i.getContentType()||"",u=s.indexOf("application/json")>-1,f=ne.isObject(l);if(f&&ne.isHTMLForm(l)&&(l=new FormData(l)),ne.isFormData(l))return u?JSON.stringify(Os(l)):l;if(ne.isArrayBuffer(l)||ne.isBuffer(l)||ne.isStream(l)||ne.isFile(l)||ne.isBlob(l)||ne.isReadableStream(l))return l;if(ne.isArrayBufferView(l))return l.buffer;if(ne.isURLSearchParams(l))return i.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),l.toString();let p;if(f){if(s.indexOf("application/x-www-form-urlencoded")>-1)return Kc(l,this.formSerializer).toString();if((p=ne.isFileList(l))||s.indexOf("multipart/form-data")>-1){const _=this.env&&this.env.FormData;return fi(p?{"files[]":l}:l,_&&new _,this.formSerializer)}}return f||u?(i.setContentType("application/json",!1),ed(l)):l}],transformResponse:[function(l){const i=this.transitional||zr.transitional,s=i&&i.forcedJSONParsing,u=this.responseType==="json";if(ne.isResponse(l)||ne.isReadableStream(l))return l;if(l&&ne.isString(l)&&(s&&!this.responseType||u)){const m=!(i&&i.silentJSONParsing)&&u;try{return JSON.parse(l,this.parseReviver)}catch(p){if(m)throw p.name==="SyntaxError"?Le.from(p,Le.ERR_BAD_RESPONSE,this,null,this.response):p}}return l}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Xt.classes.FormData,Blob:Xt.classes.Blob},validateStatus:function(l){return l>=200&&l<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};ne.forEach(["delete","get","head","post","put","patch"],a=>{zr.headers[a]={}});const td=ne.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),nd=a=>{const l={};let i,s,u;return a&&a.split(`
2
+ `).forEach(function(m){u=m.indexOf(":"),i=m.substring(0,u).trim().toLowerCase(),s=m.substring(u+1).trim(),!(!i||l[i]&&td[i])&&(i==="set-cookie"?l[i]?l[i].push(s):l[i]=[s]:l[i]=l[i]?l[i]+", "+s:s)}),l},Ms=Symbol("internals");function Hr(a){return a&&String(a).trim().toLowerCase()}function hi(a){return a===!1||a==null?a:ne.isArray(a)?a.map(hi):String(a)}function rd(a){const l=Object.create(null),i=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let s;for(;s=i.exec(a);)l[s[1]]=s[2];return l}const id=a=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(a.trim());function ro(a,l,i,s,u){if(ne.isFunction(s))return s.call(this,l,i);if(u&&(l=i),!!ne.isString(l)){if(ne.isString(s))return l.indexOf(s)!==-1;if(ne.isRegExp(s))return s.test(l)}}function od(a){return a.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(l,i,s)=>i.toUpperCase()+s)}function sd(a,l){const i=ne.toCamelCase(" "+l);["get","set","has"].forEach(s=>{Object.defineProperty(a,s+i,{value:function(u,f,m){return this[s].call(this,l,u,f,m)},configurable:!0})})}let Qt=class{constructor(l){l&&this.set(l)}set(l,i,s){const u=this;function f(p,_,x){const C=Hr(_);if(!C)throw new Error("header name must be a non-empty string");const y=ne.findKey(u,C);(!y||u[y]===void 0||x===!0||x===void 0&&u[y]!==!1)&&(u[y||_]=hi(p))}const m=(p,_)=>ne.forEach(p,(x,C)=>f(x,C,_));if(ne.isPlainObject(l)||l instanceof this.constructor)m(l,i);else if(ne.isString(l)&&(l=l.trim())&&!id(l))m(nd(l),i);else if(ne.isObject(l)&&ne.isIterable(l)){let p={},_,x;for(const C of l){if(!ne.isArray(C))throw TypeError("Object iterator must return a key-value pair");p[x=C[0]]=(_=p[x])?ne.isArray(_)?[..._,C[1]]:[_,C[1]]:C[1]}m(p,i)}else l!=null&&f(i,l,s);return this}get(l,i){if(l=Hr(l),l){const s=ne.findKey(this,l);if(s){const u=this[s];if(!i)return u;if(i===!0)return rd(u);if(ne.isFunction(i))return i.call(this,u,s);if(ne.isRegExp(i))return i.exec(u);throw new TypeError("parser must be boolean|regexp|function")}}}has(l,i){if(l=Hr(l),l){const s=ne.findKey(this,l);return!!(s&&this[s]!==void 0&&(!i||ro(this,this[s],s,i)))}return!1}delete(l,i){const s=this;let u=!1;function f(m){if(m=Hr(m),m){const p=ne.findKey(s,m);p&&(!i||ro(s,s[p],p,i))&&(delete s[p],u=!0)}}return ne.isArray(l)?l.forEach(f):f(l),u}clear(l){const i=Object.keys(this);let s=i.length,u=!1;for(;s--;){const f=i[s];(!l||ro(this,this[f],f,l,!0))&&(delete this[f],u=!0)}return u}normalize(l){const i=this,s={};return ne.forEach(this,(u,f)=>{const m=ne.findKey(s,f);if(m){i[m]=hi(u),delete i[f];return}const p=l?od(f):String(f).trim();p!==f&&delete i[f],i[p]=hi(u),s[p]=!0}),this}concat(...l){return this.constructor.concat(this,...l)}toJSON(l){const i=Object.create(null);return ne.forEach(this,(s,u)=>{s!=null&&s!==!1&&(i[u]=l&&ne.isArray(s)?s.join(", "):s)}),i}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([l,i])=>l+": "+i).join(`
3
+ `)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(l){return l instanceof this?l:new this(l)}static concat(l,...i){const s=new this(l);return i.forEach(u=>s.set(u)),s}static accessor(l){const s=(this[Ms]=this[Ms]={accessors:{}}).accessors,u=this.prototype;function f(m){const p=Hr(m);s[p]||(sd(u,m),s[p]=!0)}return ne.isArray(l)?l.forEach(f):f(l),this}};Qt.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),ne.reduceDescriptors(Qt.prototype,({value:a},l)=>{let i=l[0].toUpperCase()+l.slice(1);return{get:()=>a,set(s){this[i]=s}}}),ne.freezeMethods(Qt);function io(a,l){const i=this||zr,s=l||i,u=Qt.from(s.headers);let f=s.data;return ne.forEach(a,function(p){f=p.call(i,f,u.normalize(),l?l.status:void 0)}),u.normalize(),f}function Ds(a){return!!(a&&a.__CANCEL__)}function xr(a,l,i){Le.call(this,a??"canceled",Le.ERR_CANCELED,l,i),this.name="CanceledError"}ne.inherits(xr,Le,{__CANCEL__:!0});function vs(a,l,i){const s=i.config.validateStatus;!i.status||!s||s(i.status)?a(i):l(new Le("Request failed with status code "+i.status,[Le.ERR_BAD_REQUEST,Le.ERR_BAD_RESPONSE][Math.floor(i.status/100)-4],i.config,i.request,i))}function ad(a){const l=/^([-+\w]{1,25})(:?\/\/|:)/.exec(a);return l&&l[1]||""}function ld(a,l){a=a||10;const i=new Array(a),s=new Array(a);let u=0,f=0,m;return l=l!==void 0?l:1e3,function(_){const x=Date.now(),C=s[f];m||(m=x),i[u]=_,s[u]=x;let y=f,I=0;for(;y!==u;)I+=i[y++],y=y%a;if(u=(u+1)%a,u===f&&(f=(f+1)%a),x-m<l)return;const O=C&&x-C;return O?Math.round(I*1e3/O):void 0}}function cd(a,l){let i=0,s=1e3/l,u,f;const m=(x,C=Date.now())=>{i=C,u=null,f&&(clearTimeout(f),f=null),a(...x)};return[(...x)=>{const C=Date.now(),y=C-i;y>=s?m(x,C):(u=x,f||(f=setTimeout(()=>{f=null,m(u)},s-y)))},()=>u&&m(u)]}const mi=(a,l,i=3)=>{let s=0;const u=ld(50,250);return cd(f=>{const m=f.loaded,p=f.lengthComputable?f.total:void 0,_=m-s,x=u(_),C=m<=p;s=m;const y={loaded:m,total:p,progress:p?m/p:void 0,bytes:_,rate:x||void 0,estimated:x&&p&&C?(p-m)/x:void 0,event:f,lengthComputable:p!=null,[l?"download":"upload"]:!0};a(y)},i)},Ps=(a,l)=>{const i=a!=null;return[s=>l[0]({lengthComputable:i,total:a,loaded:s}),l[1]]},Ls=a=>(...l)=>ne.asap(()=>a(...l)),dd=Xt.hasStandardBrowserEnv?((a,l)=>i=>(i=new URL(i,Xt.origin),a.protocol===i.protocol&&a.host===i.host&&(l||a.port===i.port)))(new URL(Xt.origin),Xt.navigator&&/(msie|trident)/i.test(Xt.navigator.userAgent)):()=>!0,ud=Xt.hasStandardBrowserEnv?{write(a,l,i,s,u,f,m){if(typeof document>"u")return;const p=[`${a}=${encodeURIComponent(l)}`];ne.isNumber(i)&&p.push(`expires=${new Date(i).toUTCString()}`),ne.isString(s)&&p.push(`path=${s}`),ne.isString(u)&&p.push(`domain=${u}`),f===!0&&p.push("secure"),ne.isString(m)&&p.push(`SameSite=${m}`),document.cookie=p.join("; ")},read(a){if(typeof document>"u")return null;const l=document.cookie.match(new RegExp("(?:^|; )"+a+"=([^;]*)"));return l?decodeURIComponent(l[1]):null},remove(a){this.write(a,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function fd(a){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(a)}function hd(a,l){return l?a.replace(/\/?\/$/,"")+"/"+l.replace(/^\/+/,""):a}function Fs(a,l,i){let s=!fd(l);return a&&(s||i==!1)?hd(a,l):l}const Vs=a=>a instanceof Qt?{...a}:a;function er(a,l){l=l||{};const i={};function s(x,C,y,I){return ne.isPlainObject(x)&&ne.isPlainObject(C)?ne.merge.call({caseless:I},x,C):ne.isPlainObject(C)?ne.merge({},C):ne.isArray(C)?C.slice():C}function u(x,C,y,I){if(ne.isUndefined(C)){if(!ne.isUndefined(x))return s(void 0,x,y,I)}else return s(x,C,y,I)}function f(x,C){if(!ne.isUndefined(C))return s(void 0,C)}function m(x,C){if(ne.isUndefined(C)){if(!ne.isUndefined(x))return s(void 0,x)}else return s(void 0,C)}function p(x,C,y){if(y in l)return s(x,C);if(y in a)return s(void 0,x)}const _={url:f,method:f,data:f,baseURL:m,transformRequest:m,transformResponse:m,paramsSerializer:m,timeout:m,timeoutMessage:m,withCredentials:m,withXSRFToken:m,adapter:m,responseType:m,xsrfCookieName:m,xsrfHeaderName:m,onUploadProgress:m,onDownloadProgress:m,decompress:m,maxContentLength:m,maxBodyLength:m,beforeRedirect:m,transport:m,httpAgent:m,httpsAgent:m,cancelToken:m,socketPath:m,responseEncoding:m,validateStatus:p,headers:(x,C,y)=>u(Vs(x),Vs(C),y,!0)};return ne.forEach(Object.keys({...a,...l}),function(C){const y=_[C]||u,I=y(a[C],l[C],C);ne.isUndefined(I)&&y!==p||(i[C]=I)}),i}const Us=a=>{const l=er({},a);let{data:i,withXSRFToken:s,xsrfHeaderName:u,xsrfCookieName:f,headers:m,auth:p}=l;if(l.headers=m=Qt.from(m),l.url=ks(Fs(l.baseURL,l.url,l.allowAbsoluteUrls),a.params,a.paramsSerializer),p&&m.set("Authorization","Basic "+btoa((p.username||"")+":"+(p.password?unescape(encodeURIComponent(p.password)):""))),ne.isFormData(i)){if(Xt.hasStandardBrowserEnv||Xt.hasStandardBrowserWebWorkerEnv)m.setContentType(void 0);else if(ne.isFunction(i.getHeaders)){const _=i.getHeaders(),x=["content-type","content-length"];Object.entries(_).forEach(([C,y])=>{x.includes(C.toLowerCase())&&m.set(C,y)})}}if(Xt.hasStandardBrowserEnv&&(s&&ne.isFunction(s)&&(s=s(l)),s||s!==!1&&dd(l.url))){const _=u&&f&&ud.read(f);_&&m.set(u,_)}return l},md=typeof XMLHttpRequest<"u"&&function(a){return new Promise(function(i,s){const u=Us(a);let f=u.data;const m=Qt.from(u.headers).normalize();let{responseType:p,onUploadProgress:_,onDownloadProgress:x}=u,C,y,I,O,N;function v(){O&&O(),N&&N(),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=Qt.from("getAllResponseHeaders"in k&&k.getAllResponseHeaders()),W={data:!p||p==="text"||p==="json"?k.responseText:k.response,status:k.status,statusText:k.statusText,headers:M,config:a,request:k};vs(function(F){i(F),v()},function(F){s(F),v()},W),k=null}"onloadend"in k?k.onloadend=P:k.onreadystatechange=function(){!k||k.readyState!==4||k.status===0&&!(k.responseURL&&k.responseURL.indexOf("file:")===0)||setTimeout(P)},k.onabort=function(){k&&(s(new Le("Request aborted",Le.ECONNABORTED,a,k)),k=null)},k.onerror=function(q){const W=q&&q.message?q.message:"Network Error",Y=new Le(W,Le.ERR_NETWORK,a,k);Y.event=q||null,s(Y),k=null},k.ontimeout=function(){let q=u.timeout?"timeout of "+u.timeout+"ms exceeded":"timeout exceeded";const W=u.transitional||Bs;u.timeoutErrorMessage&&(q=u.timeoutErrorMessage),s(new Le(q,W.clarifyTimeoutError?Le.ETIMEDOUT:Le.ECONNABORTED,a,k)),k=null},f===void 0&&m.setContentType(null),"setRequestHeader"in k&&ne.forEach(m.toJSON(),function(q,W){k.setRequestHeader(W,q)}),ne.isUndefined(u.withCredentials)||(k.withCredentials=!!u.withCredentials),p&&p!=="json"&&(k.responseType=u.responseType),x&&([I,N]=mi(x,!0),k.addEventListener("progress",I)),_&&k.upload&&([y,O]=mi(_),k.upload.addEventListener("progress",y),k.upload.addEventListener("loadend",O)),(u.cancelToken||u.signal)&&(C=M=>{k&&(s(!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=ad(u.url);if(D&&Xt.protocols.indexOf(D)===-1){s(new Le("Unsupported protocol "+D+":",Le.ERR_BAD_REQUEST,a));return}k.send(f||null)})},gd=(a,l)=>{const{length:i}=a=a?a.filter(Boolean):[];if(l||i){let s=new AbortController,u;const f=function(x){if(!u){u=!0,p();const C=x instanceof Error?x:this.reason;s.abort(C instanceof Le?C:new xr(C instanceof Error?C.message:C))}};let m=l&&setTimeout(()=>{m=null,f(new Le(`timeout ${l} of ms exceeded`,Le.ETIMEDOUT))},l);const p=()=>{a&&(m&&clearTimeout(m),m=null,a.forEach(x=>{x.unsubscribe?x.unsubscribe(f):x.removeEventListener("abort",f)}),a=null)};a.forEach(x=>x.addEventListener("abort",f));const{signal:_}=s;return _.unsubscribe=()=>ne.asap(p),_}},pd=function*(a,l){let i=a.byteLength;if(i<l){yield a;return}let s=0,u;for(;s<i;)u=s+l,yield a.slice(s,u),s=u},xd=async function*(a,l){for await(const i of _d(a))yield*pd(i,l)},_d=async function*(a){if(a[Symbol.asyncIterator]){yield*a;return}const l=a.getReader();try{for(;;){const{done:i,value:s}=await l.read();if(i)break;yield s}}finally{await l.cancel()}},zs=(a,l,i,s)=>{const u=xd(a,l);let f=0,m,p=_=>{m||(m=!0,s&&s(_))};return new ReadableStream({async pull(_){try{const{done:x,value:C}=await u.next();if(x){p(),_.close();return}let y=C.byteLength;if(i){let I=f+=y;i(I)}_.enqueue(new Uint8Array(C))}catch(x){throw p(x),x}},cancel(_){return p(_),u.return()}},{highWaterMark:2})},Hs=64*1024,{isFunction:gi}=ne,wd=(({Request:a,Response:l})=>({Request:a,Response:l}))(ne.global),{ReadableStream:Gs,TextEncoder:Ws}=ne.global,Xs=(a,...l)=>{try{return!!a(...l)}catch{return!1}},Cd=a=>{a=ne.merge.call({skipUndefined:!0},wd,a);const{fetch:l,Request:i,Response:s}=a,u=l?gi(l):typeof fetch=="function",f=gi(i),m=gi(s);if(!u)return!1;const p=u&&gi(Gs),_=u&&(typeof Ws=="function"?(N=>v=>N.encode(v))(new Ws):async N=>new Uint8Array(await new i(N).arrayBuffer())),x=f&&p&&Xs(()=>{let N=!1;const v=new i(Xt.origin,{body:new Gs,method:"POST",get duplex(){return N=!0,"half"}}).headers.has("Content-Type");return N&&!v}),C=m&&p&&Xs(()=>ne.isReadableStream(new s("").body)),y={stream:C&&(N=>N.body)};u&&["text","arrayBuffer","blob","formData","stream"].forEach(N=>{!y[N]&&(y[N]=(v,k)=>{let P=v&&v[N];if(P)return P.call(v);throw new Le(`Response type '${N}' is not supported`,Le.ERR_NOT_SUPPORT,k)})});const I=async N=>{if(N==null)return 0;if(ne.isBlob(N))return N.size;if(ne.isSpecCompliantForm(N))return(await new i(Xt.origin,{method:"POST",body:N}).arrayBuffer()).byteLength;if(ne.isArrayBufferView(N)||ne.isArrayBuffer(N))return N.byteLength;if(ne.isURLSearchParams(N)&&(N=N+""),ne.isString(N))return(await _(N)).byteLength},O=async(N,v)=>{const k=ne.toFiniteNumber(N.getContentLength());return k??I(v)};return async N=>{let{url:v,method:k,data:P,signal:D,cancelToken:M,timeout:q,onDownloadProgress:W,onUploadProgress:Y,responseType:F,headers:L,withCredentials:V="same-origin",fetchOptions:ie}=Us(N),Q=l||fetch;F=F?(F+"").toLowerCase():"text";let te=gd([D,M&&M.toAbortSignal()],q),G=null;const z=te&&te.unsubscribe&&(()=>{te.unsubscribe()});let T;try{if(Y&&x&&k!=="get"&&k!=="head"&&(T=await O(L,P))!==0){let de=new i(v,{method:"POST",body:P,duplex:"half"}),ce;if(ne.isFormData(P)&&(ce=de.headers.get("content-type"))&&L.setContentType(ce),de.body){const[Ce,ge]=Ps(T,mi(Ls(Y)));P=zs(de.body,Hs,Ce,ge)}}ne.isString(V)||(V=V?"include":"omit");const X=f&&"credentials"in i.prototype,$={...ie,signal:te,method:k.toUpperCase(),headers:L.normalize().toJSON(),body:P,duplex:"half",credentials:X?V:void 0};G=f&&new i(v,$);let j=await(f?Q(G,ie):Q(v,$));const Z=C&&(F==="stream"||F==="response");if(C&&(W||Z&&z)){const de={};["status","statusText","headers"].forEach(De=>{de[De]=j[De]});const ce=ne.toFiniteNumber(j.headers.get("content-length")),[Ce,ge]=W&&Ps(ce,mi(Ls(W),!0))||[];j=new s(zs(j.body,Hs,Ce,()=>{ge&&ge(),z&&z()}),de)}F=F||"text";let ee=await y[ne.findKey(y,F)||"text"](j,N);return!Z&&z&&z(),await new Promise((de,ce)=>{vs(de,ce,{data:ee,headers:Qt.from(j.headers),status:j.status,statusText:j.statusText,config:N,request:G})})}catch(X){throw z&&z(),X&&X.name==="TypeError"&&/Load failed|fetch/i.test(X.message)?Object.assign(new Le("Network Error",Le.ERR_NETWORK,N,G),{cause:X.cause||X}):Le.from(X,X&&X.code,N,G)}}},Ed=new Map,$s=a=>{let l=a&&a.env||{};const{fetch:i,Request:s,Response:u}=l,f=[s,u,i];let m=f.length,p=m,_,x,C=Ed;for(;p--;)_=f[p],x=C.get(_),x===void 0&&C.set(_,x=p?new Map:Cd(l)),C=x;return x};$s();const oo={http:Gc,xhr:md,fetch:{get:$s}};ne.forEach(oo,(a,l)=>{if(a){try{Object.defineProperty(a,"name",{value:l})}catch{}Object.defineProperty(a,"adapterName",{value:l})}});const js=a=>`- ${a}`,yd=a=>ne.isFunction(a)||a===null||a===!1;function bd(a,l){a=ne.isArray(a)?a:[a];const{length:i}=a;let s,u;const f={};for(let m=0;m<i;m++){s=a[m];let p;if(u=s,!yd(s)&&(u=oo[(p=String(s)).toLowerCase()],u===void 0))throw new Le(`Unknown adapter '${p}'`);if(u&&(ne.isFunction(u)||(u=u.get(l))))break;f[p||"#"+m]=u}if(!u){const m=Object.entries(f).map(([_,x])=>`adapter ${_} `+(x===!1?"is not supported by the environment":"is not available in the build"));let p=i?m.length>1?`since :
4
4
  `+m.map(js).join(`
5
- `):" "+js(m[0]):"as no adapter specified";throw new Le("There is no suitable adapter to dispatch the request "+p,"ERR_NOT_SUPPORT")}return u}const qs={getAdapter:bd,adapters:oo};function so(a){if(a.cancelToken&&a.cancelToken.throwIfRequested(),a.signal&&a.signal.aborted)throw new xr(null,a)}function Zs(a){return so(a),a.headers=Qt.from(a.headers),a.data=io.call(a,a.transformRequest),["post","put","patch"].indexOf(a.method)!==-1&&a.headers.setContentType("application/x-www-form-urlencoded",!1),qs.getAdapter(a.adapter||zr.adapter,a)(a).then(function(i){return so(a),i.data=io.call(a,a.transformResponse,i),i.headers=Qt.from(i.headers),i},function(i){return Ds(i)||(so(a),i&&i.response&&(i.response.data=io.call(a,a.transformResponse,i.response),i.response.headers=Qt.from(i.response.headers))),Promise.reject(i)})}const Ys="1.13.2",pi={};["object","boolean","number","function","string","symbol"].forEach((a,l)=>{pi[a]=function(i){return typeof i===a||"a"+(l<1?"n ":" ")+a}});const Ks={};pi.transitional=function(l,o,i){function u(f,m){return"[Axios v"+Ys+"] Transitional option '"+f+"'"+m+(i?". "+i:"")}return(f,m,p)=>{if(l===!1)throw new Le(u(m," has been removed"+(o?" in "+o:"")),Le.ERR_DEPRECATED);return o&&!Ks[m]&&(Ks[m]=!0,console.warn(u(m," has been deprecated since v"+o+" and will be removed in the near future"))),l?l(f,m,p):!0}},pi.spelling=function(l){return(o,i)=>(console.warn(`${i} is likely a misspelling of ${l}`),!0)};function Ad(a,l,o){if(typeof a!="object")throw new Le("options must be an object",Le.ERR_BAD_OPTION_VALUE);const i=Object.keys(a);let u=i.length;for(;u-- >0;){const f=i[u],m=l[f];if(m){const p=a[f],w=p===void 0||m(p,f,a);if(w!==!0)throw new Le("option "+f+" must be "+w,Le.ERR_BAD_OPTION_VALUE);continue}if(o!==!0)throw new Le("Unknown option "+f,Le.ERR_BAD_OPTION)}}const xi={assertOptions:Ad,validators:pi},In=xi.validators;let tr=class{constructor(l){this.defaults=l||{},this.interceptors={request:new Rs,response:new Rs}}async request(l,o){try{return await this._request(l,o)}catch(i){if(i instanceof Error){let u={};Error.captureStackTrace?Error.captureStackTrace(u):u=new Error;const f=u.stack?u.stack.replace(/^.+\n/,""):"";try{i.stack?f&&!String(i.stack).endsWith(f.replace(/^.+\n.+\n/,""))&&(i.stack+=`
6
- `+f):i.stack=f}catch{}}throw i}}_request(l,o){typeof l=="string"?(o=o||{},o.url=l):o=l||{},o=er(this.defaults,o);const{transitional:i,paramsSerializer:u,headers:f}=o;i!==void 0&&xi.assertOptions(i,{silentJSONParsing:In.transitional(In.boolean),forcedJSONParsing:In.transitional(In.boolean),clarifyTimeoutError:In.transitional(In.boolean)},!1),u!=null&&(te.isFunction(u)?o.paramsSerializer={serialize:u}:xi.assertOptions(u,{encode:In.function,serialize:In.function},!0)),o.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?o.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:o.allowAbsoluteUrls=!0),xi.assertOptions(o,{baseUrl:In.spelling("baseURL"),withXsrfToken:In.spelling("withXSRFToken")},!0),o.method=(o.method||this.defaults.method||"get").toLowerCase();let m=f&&te.merge(f.common,f[o.method]);f&&te.forEach(["delete","get","head","post","put","patch","common"],T=>{delete f[T]}),o.headers=Qt.concat(m,f);const p=[];let w=!0;this.interceptors.request.forEach(function(v){typeof v.runWhen=="function"&&v.runWhen(o)===!1||(w=w&&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,N;if(!w){const T=[Zs.bind(this),void 0];for(T.unshift(...p),T.push(...x),N=T.length,C=Promise.resolve(o);y<N;)C=C.then(T[y++],T[y++]);return C}N=p.length;let O=o;for(;y<N;){const T=p[y++],v=p[y++];try{O=T(O)}catch(D){v.call(this,D);break}}try{C=Zs.call(this,O)}catch(T){return Promise.reject(T)}for(y=0,N=x.length;y<N;)C=C.then(x[y++],x[y++]);return C}getUri(l){l=er(this.defaults,l);const o=Fs(l.baseURL,l.url,l.allowAbsoluteUrls);return ks(o,l.params,l.paramsSerializer)}};te.forEach(["delete","get","head","options"],function(l){tr.prototype[l]=function(o,i){return this.request(er(i||{},{method:l,url:o,data:(i||{}).data}))}}),te.forEach(["post","put","patch"],function(l){function o(i){return function(f,m,p){return this.request(er(p||{},{method:l,headers:i?{"Content-Type":"multipart/form-data"}:{},url:f,data:m}))}}tr.prototype[l]=o(),tr.prototype[l+"Form"]=o(!0)});let Sd=class ll{constructor(l){if(typeof l!="function")throw new TypeError("executor must be a function.");let o;this.promise=new Promise(function(f){o=f});const i=this;this.promise.then(u=>{if(!i._listeners)return;let f=i._listeners.length;for(;f-- >0;)i._listeners[f](u);i._listeners=null}),this.promise.then=u=>{let f;const m=new Promise(p=>{i.subscribe(p),f=p}).then(u);return m.cancel=function(){i.unsubscribe(f)},m},l(function(f,m,p){i.reason||(i.reason=new xr(f,m,p),o(i.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 o=this._listeners.indexOf(l);o!==-1&&this._listeners.splice(o,1)}toAbortSignal(){const l=new AbortController,o=i=>{l.abort(i)};return this.subscribe(o),l.signal.unsubscribe=()=>this.unsubscribe(o),l.signal}static source(){let l;return{token:new ll(function(u){l=u}),cancel:l}}};function Id(a){return function(o){return a.apply(null,o)}}function Nd(a){return te.isObject(a)&&a.isAxiosError===!0}const ao={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(ao).forEach(([a,l])=>{ao[l]=a});function Qs(a){const l=new tr(a),o=ms(tr.prototype.request,l);return te.extend(o,tr.prototype,l,{allOwnKeys:!0}),te.extend(o,l,null,{allOwnKeys:!0}),o.create=function(u){return Qs(er(a,u))},o}const Ze=Qs(zr);Ze.Axios=tr,Ze.CanceledError=xr,Ze.CancelToken=Sd,Ze.isCancel=Ds,Ze.VERSION=Ys,Ze.toFormData=fi,Ze.AxiosError=Le,Ze.Cancel=Ze.CanceledError,Ze.all=function(l){return Promise.all(l)},Ze.spread=Id,Ze.isAxiosError=Nd,Ze.mergeConfig=er,Ze.AxiosHeaders=Qt,Ze.formToJSON=a=>Os(te.isHTMLForm(a)?new FormData(a):a),Ze.getAdapter=qs.getAdapter,Ze.HttpStatusCode=ao,Ze.default=Ze;const{Axios:Yg,AxiosError:Kg,CanceledError:Qg,isCancel:Jg,CancelToken:ep,VERSION:tp,all:np,Cancel:rp,isAxiosError:ip,spread:op,toFormData:sp,AxiosHeaders:ap,HttpStatusCode:lp,formToJSON:cp,getAdapter:dp,mergeConfig:up}=Ze,Gr=we.defineStore("modulesLib",()=>{const a=r.ref(!1),l=r.ref({textNotification:""});return{is_notification_lib:a,notificationData_lib:l,showNotification:i=>{a.value=!0,l.value.textNotification=i}}}),Td=["ping","pong"],kd=["confirmed","waiting_payment","partial_paid"],Rd=["cancelled"],Fn=we.defineStore("table-data",()=>{const a=Te.useRoute(),l=Te.useRouter(),o=st(),i=Gr(),u=r.ref(1),f=r.ref(1),m=yt.useLocalStorage("appMode",null,{shallow:!0}),p=yt.useLocalStorage("tableData",null,{shallow:!0,serializer:yt.StorageSerializers.object}),w=yt.useLocalStorage("tableId",null),x=yt.useLocalStorage("orgID",null),C=r.computed({get:()=>{var P;return(P=D.value)==null?void 0:P.id},set:P=>{w.value=P}}),y=r.computed(()=>{var P;return(P=a.query.table_id)==null?void 0:P.toString()}),N=r.computed(()=>{var P;return x.value||((P=a.params.orgId)==null?void 0:P.toString())}),O=r.computed(()=>{var P;return((P=D.value)==null?void 0:P.branch.work_mode)==="table-service"}),T=r.computed(()=>{var P;return O.value&&!!((P=D.value)!=null&&P.order)});let v=null;const D=yt.computedAsync(async P=>{var Q,ee,X;u.value;const L=new AbortController;if(P(()=>L.abort()),!N.value||!((Q=o.config_lib)!=null&&Q.area))return null;const re=y.value||w.value;if(!re)return null;try{return{...(await Ze.get(`/org_unit/${N.value}/table/${re}/`,{baseURL:`https://${o.config_lib.area}/api/`,signal:L.signal})).data,__v:u.value}}catch(H){return Ze.isCancel(H)?null:m.value==="table-tent"?p.value:re===(v==null?void 0:v.id)?v:(v=null,i.showNotification(((X=(ee=H==null?void 0:H.response)==null?void 0:ee.data)==null?void 0:X.user_friendly_message)||"Ошибка при загрузке данных стола"),null)}},null),U=yt.computedAsync(async P=>{var re;f.value;const L=new AbortController;if(P(()=>L.abort()),!O.value||!((re=D.value)!=null&&re.order))return null;try{const Q=await Ze.get(`/order/${D.value.order}/`,{baseURL:`https://${o.config_lib.area}/api/`,signal:L.signal});return Q.data.items=Q.data.items.map(ee=>({...ee,idSystem:crypto.randomUUID()})),{...Q.data,__v:f.value}}catch{return null}},null);let M=null;const R=P=>{M&&(M==null||M.close(),M=null),P&&(M=Lr(`wss://${o.config_lib.area}/ws/order/${P.id}/`),M.on("message",L=>{Td.includes(L==null?void 0:L.type)||((L==null?void 0:L.method)==="update_order_status"&&Rd.includes(L.params.status)&&i.showNotification("Ваш заказ был отменён"),G())}),M.connect())},F=()=>{u.value++},G=()=>{f.value++},Z=P=>{P&&(v=P,m.value==="table-tent"&&(p.value=P),w.value!==P.id&&(w.value=P.id))},V=(P,L)=>{var re,Q;if((P==null?void 0:P.id)!==(L==null?void 0:L.id)&&R(P),P&&!kd.includes(P.status)&&F(),!P&&L&&((re=L.table)==null?void 0:re.id)===((Q=D.value)==null?void 0:Q.id))return l.replace({name:"order-ts-status",params:{id:L.id}})};return r.watch(U,V,{immediate:!0}),r.watch(D,Z,{immediate:!0}),{id:C,isTableService:O,hasOrder:T,data:D,order:U,refresh:F,refreshOrder:G}});let Nn=null,jt=null;function nr(a){a&&a.close(!0)}async function lo(a,l){const o=Mt(),i=st(),u=yn.create();try{const f=await u.initPaymentLink(a,l);return o.paymentCostQR=i.totalPrice_lib-i.countBonus,o.linkQR=f.url,jt==null||jt.deleteCart(null,jt==null?void 0:jt.is_requestKiosk),f}catch(f){throw o.isButtonDisabled=!1,o.showNotification(f==null?void 0:f.response.data.user_friendly_message),f}}function Bd(a,l,o){const i=Rt();if(a!=null&&a.params){if(a.params.status==="sent"&&i.itemThemes.kiosk_proceed_to_payment_text&&l.showNotification(i.itemThemes.kiosk_proceed_to_payment_text),a.error){l.showNotification(a.error),hn(l,null),uo(l);return}o(a,l)}}function co(a,l){const o=Mt(),i=st();return a.params.new_discounts&&(o.extraDiscount=Number(a.params.new_total_cost)-l.initialCartPrice,i.totalPrice_lib=Number(a.params.new_total_cost),l.showNotification("К заказу были добавлены скидки")),!0}const hn=(a,l)=>{a.updateOrderStatus&&a.updateOrderStatus(l)},Od=a=>{a.loadCart&&a.loadCart()},wi=a=>{a.resetBonuses&&a.resetBonuses()},Md=a=>{a.resetDiscounts&&a.resetDiscounts()},uo=a=>{a.closeWebSocket&&a.closeWebSocket()},Js=(a,l,o,i)=>{var m;if(((m=a.params)==null?void 0:m.need_pay)===!1)return;const u=l.ws||o;yn.create().orderPay(a.params.order_id||"").then(p=>{l.setOrderNumber&&l.setOrderNumber(p.data.order_number)}).catch(p=>{(l.errorHandler||i).handleOrderPayError(p,{...l,closeWebSocket:()=>nr(u)})})},fo=(a,l,o)=>{const i=a.ws||l;(a.errorHandler||o).handleOrderError({...a,closeWebSocket:()=>nr(i)})},Dd=(a,l)=>{const o=Mt(),i=o.getCurrentPaymentMethodId();if(!i||!Vn.getConfig(i)||!Vn.isMethodAvailable(i,a))return null;const f=Vn.createHandler(i);if(!f)return null;const m=o.createPaymentHandler(a,l,i);return m?{handler:f,config:m.config}:null},vd=a=>{if(!jt)return;const l=jt.context,o=jt.is_requestKiosk,i=Dd(l,o);if(!i){console.warn("handleWebSocketMessageWithDynamicHandler: не удалось получить handler");return}const{handler:u,config:f}=i,m={...f,...jt};Bd(a,m,u.handleWebSocketStatus)};async function Pd(a,l,o){var x,C;const i=Fn(),{is_requestKiosk:u}=l,{comment:f,is_authorized:m,signal:p}=o;l.setButtonDisabled(!0);const w=yn.create();try{const y=await w.createOrder(a,i.id,u,f,m,p);if((y==null?void 0:y.status)===201&&((x=y==null?void 0:y.data)!=null&&x.id)){const N=y.data.id,O={...l,signal:p};jt=O;const v=`wss://${O.area||""}/ws/order/${N}/`;Nn=Lr(v,{signal:p});const D=()=>{console.warn("WebSocket connection opened (centralized mode)")},U=R=>{var F;console.error("WebSocket error (centralized mode):",R),nr(Nn),Nn=null,jt=null,l.setButtonDisabled(!1),(F=l.errorHandler)==null||F.handlePaymentError(R,O)},M=R=>{vd(R)};Nn.on("open",D),Nn.on("message",M),Nn.on("error",U),Nn.connect(),jt.ws=Nn,jt.closeWebSocket=()=>{nr(Nn),Nn=null,jt=null}}return y}catch(y){throw Ze.isCancel(y)||((C=l.errorHandler)==null||C.handleCreateOrderError(y,l),l.setButtonDisabled(!1)),y}}const ea=a=>{var l,o;return((o=(l=a==null?void 0:a.response)==null?void 0:l.data)==null?void 0:o.user_friendly_message)||null};function _i(){const a=Mt(),l=Fn();return{handlePaymentError(o,i){var f,m,p,w,x,C;const u=ea(o);hn(i,null),Od(i),u?(i.showNotification(u),uo(i),i.is_requestKiosk&&((m=i.orderErrors)!=null&&m.includes((f=o.response)==null?void 0:f.status))&&(i.cartCleanup?i.cartCleanup.cleanupAndNavigate("retryPage",i.is_requestKiosk):i.deleteCart("retryPage",i.is_requestKiosk),i.ws.close(!0)),l.isTableService?i.resetStores():(wi(i),i.context==="qr"&&i.navigation?i.navigation.redirectToError():i.context==="qr"&&i.redirect&&(a.isButtonDisabled=!1,i.redirect(`/${((w=(p=i.route)==null?void 0:p.params)==null?void 0:w.orgId)||""}/errorPayment`)))):i.context==="qr"&&(wi(i),i.navigation?i.navigation.redirectToError():i.redirect&&i.redirect(`/${((C=(x=i.route)==null?void 0:x.params)==null?void 0:C.orgId)||""}/errorPayment`)),a.isButtonDisabled=!1},handleOrderPayError(o,i){var f,m,p,w;const u=ea(o);u&&(i.showNotification(u),uo(i),i.is_requestKiosk?((m=i.orderErrors)!=null&&m.includes((f=o.response)==null?void 0:f.status)&&(i.cartCleanup.cleanupAndNavigate("retryPage",i.is_requestKiosk),i.deleteCart("retryPage",i.is_requestKiosk)),hn(i,null)):(wi(i),i.navigation?i.navigation.redirectToError():i.redirect&&i.redirect(`/${((w=(p=i.route)==null?void 0:p.params)==null?void 0:w.orgId)||""}/errorPayment`),hn(i,null)))},handleOrderError(o){var i,u;o.is_requestKiosk?(o.cartCleanup?o.cartCleanup.cleanupAndNavigate("retryPage",o.is_requestKiosk):o.deleteCart("retryPage",o.is_requestKiosk),o.ws.close(!0)):l.isTableService?(a.isCreateButtonVisible=!0,o.showNotification("Ошибка создания заказа. Пожалуйста, попробуйте еще раз"),Md(o)):(wi(o),o.navigation?o.navigation.redirectToError():o.redirect&&(a.isButtonDisabled=!1,o.redirect(`/${((u=(i=o.route)==null?void 0:i.params)==null?void 0:u.orgId)||""}/errorPayment`)))},handleCreateOrderError(o,i){var m,p,w,x,C,y;const{is_requestKiosk:u}=i,f=i.route.params.orgId;u?(((m=o==null?void 0:o.response)==null?void 0:m.status)===403&&((p=i.on403Kiosk)==null||p.call(i),(w=i.redirect)==null||w.call(i,`/${f}/retryPage`)),i.deleteCart("retryPage",u)):l.isTableService?i.showNotification(((C=(x=o==null?void 0:o.response)==null?void 0:x.data)==null?void 0:C.user_friendly_message)||"Ошибка создания заказа"):(y=i.redirect)==null||y.call(i,`/${f}/errorPayment`)}}}const Ld=()=>{const a=Mt();let l=null;const o=_i(),i=(u,f)=>{var p,w,x,C;const m=(p=u.params)==null?void 0:p.status;if((w=u.params)!=null&&w.number&&(a.orderNumber=(x=u.params)==null?void 0:x.number),m==="sent")co(u,f),a.isButtonDisabled=!1;else if(m==="waiting_for_fiscalization")hn(f,1);else if(m==="payment_initiation_retry"||m==="fiscalized")Js(u,f,l,o);else if(m==="payment_initiation")hn(f,2);else if(m==="paid"){hn(f,3);const y=f.ws||l;nr(y),localStorage.removeItem("cart")}else(C=f.orderErrors)!=null&&C.includes(m)&&fo(f,l,o)};return{handleWebSocketStatus(u,f){i(u,f)}}};function Fd(){const a=Mt();let l=null;const o=_i(),i=(u,f)=>{var p,w,x,C;const m=(p=u.params)==null?void 0:p.status;if((w=u.params)!=null&&w.number&&(a.orderNumber=(x=u.params)==null?void 0:x.number),m==="sent")co(u,f),a.isButtonDisabled=!1;else if(m==="sent_fiscalization")hn(f,1);else if(m==="waiting_payment")hn(f,4);else if(m==="paid"){hn(f,3);const y=f.ws||l;nr(y),localStorage.removeItem("cart")}else(C=f.orderErrors)!=null&&C.includes(m)&&(a.isButtonDisabled=!1,fo(f,l,o))};return{handleWebSocketStatus(u,f){i(u,f)}}}const Vd=()=>{const a=Mt();let l=null;const o=_i(),i=(u,f)=>{var p,w;const m=(p=u.params)==null?void 0:p.status;if(m==="sent")co(u,f),a.isButtonDisabled=!1;else if(m==="payment_initiation_retry"||m==="fiscalized")Js(u,f,l,o);else if(m==="payment_initiation")hn(f,2);else if(m==="paid"){hn(f,3);const x=f.ws||l;nr(x),localStorage.removeItem("cart")}else(w=f.orderErrors)!=null&&w.includes(m)&&(a.isButtonDisabled=!1,fo(f,l,o))};return{handleWebSocketStatus(u,f){i(u,f)}}};class Vn{static initialize(){this.register({id:"TERMINAL_BASE",method:"TERMINAL",handlerFactory:Ld,availableContexts:["kiosk"]}),this.register({id:"YOOKASSA_BASE",method:"YOOKASSA",handlerFactory:Vd,availableContexts:["qr","tableservice"]}),this.register({id:"SBP",method:"YOOKASSA",handlerFactory:Fd,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(([o,i])=>i.availableContexts.includes(l)).map(([o])=>o)}static isMethodAvailable(l,o){const i=this.getConfig(l);return i?i.availableContexts.includes(o):!1}static createHandler(l){const o=this.getConfig(l);return o?o.handlerFactory():(console.warn(`PaymentMethodRegistry: метод оплаты ${l} не зарегистрирован`),null)}}Re(Vn,"methods",new Map),Vn.initialize();function Ud(a){return{cleanupAndNavigate(l,o){a.deleteCart(l,o)},cleanup(l){a.deleteCart(null,l)},clearTokens(){a.deleteCart(null,!0)},resetStores(){a.resetStores()}}}function zd(a){var o,i;const l=((i=(o=a.route)==null?void 0:o.params)==null?void 0:i.orgId)||"";return{redirectToError(){const u=`/${l}/errorPayment`;a.redirect?a.redirect(u):a.router&&a.router.push(u)},redirectToSuccess(u){const f=u?`/${l}/${u}`:`/${l}/profile`;a.redirect?a.redirect(f):a.router&&a.router.push(f)},redirect(u){a.redirect?a.redirect(u):a.router&&a.router.push(u)},getErrorPath(){return`/${l}/errorPayment`},getSuccessPath(){return`/${l}/profile`}}}const Mt=we.defineStore("cartLib",()=>{const a=Te.useRouter(),l=Te.useRoute(),o=Rt(),i=st(),{config_lib:u,countBonus:f,totalPrice_lib:m,initialCartPrice_lib:p,is18Allowed:w}=we.storeToRefs(i),{itemThemes:x}=we.storeToRefs(o),C=r.ref(!1),y=r.ref(""),N=r.ref(null),O=r.ref("wait"),T=r.ref(!0),v=r.ref(0),D=r.ref(""),U=r.ref([]),M=r.ref([]),R=r.ref(),F=r.ref(0),G=r.ref(!1),Z=r.ref(),V=r.ref(null),P=r.ref(["failed_payment","failed_after_paid","failed","failed_after_sent","failed_after_sent_fiscalization","payment_initiation_retry","cancelled","failed_after_payment_initiation"]),L=r.ref(),re=r.computed({get:()=>U.value||[],set:be=>{(be==null?void 0:be.length)===1&&(L.value=be[0]),U.value=be}}),Q=r.ref(!1),ee=r.ref(null),X=r.ref(0),H=r.ref(!1),I=r.ref({textNotification:""}),$=be=>{H.value=!0,I.value.textNotification=be},j=()=>{var be,et;return(be=R.value)!=null&&be.front_type?R.value.front_type:((et=M.value[0])==null?void 0:et.front_type)||null},q=(be,et,rt)=>{var Ie;const Ve=rt??((Ie=M.value[0])==null?void 0:Ie.front_type);if(!Ve)return console.warn("Не удалось определить метод оплаты"),null;const it=Vn.getConfig(Ve);if(!it||!Vn.isMethodAvailable(Ve,be))return console.warn(`Метод ${Ve} недоступен для контекста ${be}`),null;const Me=Vn.createHandler(Ve);return Me?(Z.value=K(it.method,be,et),{handler:Me,config:Z.value}):(console.warn(`Не удалось создать обработчик для метода ${Ve}`),null)},K=(be,et,rt)=>{const Ve={method:be,context:et,is_requestKiosk:rt,router:a,route:l,orderErrors:P.value,area:u.value.area,totalPrice:m,initialCartPrice:p,showNotification:$,deleteCart:_t,resetStores:xe,redirect:Ue=>a.push(Ue),updateOrderStatus:Ue=>{ee.value=Ue},setOrderNumber:Ue=>{V.value=Ue},loadCart:()=>i.loadCart(),resetBonuses:()=>{f.value=0}},it=_i(),Me=Ud(Ve),Ie=zd(Ve);return{...Ve,errorHandler:it,cartCleanup:Me,navigation:Ie}},oe=r.computed(()=>!!N.value),de=be=>{O.value=be},ce=be=>{N.value=be},Ce=()=>{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?i.is_OpenLoyal=!0:C.value=!0,O.value="wait",y.value=""},ge=()=>{C.value=!1,O.value="wait",y.value=""},De=()=>{N.value=null,y.value="",O.value="wait",ge()},xe=()=>{Q.value=!1,ee.value=null},_t=(be=null,et=!1)=>{i.cartProducts_lib=[],i.is_OpenLoyal=!1,mr(["cart"]),et&&(mr(["authTokensAccess","authTokensRefresh","user"]),i.profile=null,sessionStorage.removeItem("is_adult"),w.value=!1),be&&a.push(`/${l.params.orgId}/${be}`)};return{isButtonDisabled:Q,orderCompleted_lib:ee,extraDiscount:v,orderNumber:V,is_notification_lib:H,notificationData_lib:I,count:X,guestInfo:N,error:y,isDrawerOpen:C,currentState:O,isAuthorized:oe,isCreateButtonVisible:T,linkQR:D,orderTypes:re,providerTypes:M,is_paymentCart:G,selectedOrderType:L,selectedProvider:R,configPayment:Z,paymentCostQR:F,deleteCart:_t,setGuestInfo:ce,setState:de,openDrawer:Ce,closeDrawer:ge,clearCard:De,showNotification:$,createPaymentHandler:q,getCurrentPaymentMethodId:j,getAvailablePaymentMethods:be=>Vn.getAvailableMethods(be)}}),Lt=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=Rt(),o=r.ref(a()),i=()=>o.value=a(),u=r.ref(!1),f=r.ref(!1),m=r.ref(!1),p=r.ref(),w=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 X=o.value.groupModifiersSelected.findIndex(H=>H.group===o.value.groupCurrentOpen.id);return N(X)}),N=X=>X===-1?0:(o.value.groupModifiersSelected[X].modifiers||[]).reduce((I,$)=>I+($.amount||0),0),O=r.computed(()=>{var H;const X=(H=o.value.openCard)==null?void 0:H.group_modifiers.findIndex(I=>I.id===o.value.groupCurrentOpen.id);return X===-1||!o.value.openCard?0:o.value.openCard.modifiers.length>0&&X===0?o.value.openCard.modifiers.reduce((I,$)=>I+$.max_amount,0):o.value.groupModifiers[X].max_amount}),T=r.computed(()=>{var H;const X=(o.value.addedProducts??[]).reduce((I,$)=>I+$.price,0);if(o.value.openCard){const I=o.value.openCard,$=hr(I)||0,j=I.amount||1;return(o.value.groupModifiersSelected.reduce((K,oe)=>(oe.modifiers.forEach(de=>{var ce,Ce;de.sizes&&(de.price=((Ce=(ce=de.sizes)==null?void 0:ce.find(ge=>ge.id===o.value.selectedSize.id))==null?void 0:Ce.price)??de.price),K+=de.price*de.amount}),K),0)+$)*j+X}return(H=o.value.addedProducts)!=null&&H.length?X:0}),v=r.computed(()=>{const X=o.value.groupCurrentOpen;if(!X)return!1;const H=o.value.groupModifiers,I=H.findIndex($=>$.id===X.id);return I===-1?!1:I===H.length-1}),D=X=>{const H=o.value.groupModifiers[X],I=o.value.groupModifiersSelected[X];if(!H)return{valid:!1};if(H.min_amount>0&&N(X)<H.min_amount)return{valid:!1,errorText:`В группе "${H.name}" должно содержаться не меньше ${H.min_amount} модификатора(ов)`};if(I){for(const $ of H.group_modifiers)if($.min_amount>0){const j=I.modifiers.find(q=>q.id===$.id);if(!j||j.amount<$.min_amount)return{valid:!1,errorText:`В группе "${H.name}" выберите все обязательные модификаторы`}}}return{valid:!0}},U=r.computed(()=>{const X=o.value.groupModifiers;for(let H=0;H<X.length;H++){const I=D(H);if(!I.valid)return o.value.textErrorRequaired=I.errorText,{haveRequaire:!0,group:X[H]}}return{haveRequaire:!1,group:X[0]}}),M=()=>{o.value.groupModifiers.forEach((X,H)=>{o.value.groupCurrentOpen={...X,index:H},X.group_modifiers.forEach(I=>{I.default_amount>0&&(I.amount=I.default_amount,re(I,!0))})})},R=X=>{o.value.addedProducts.push(X)},F=X=>{o.value.openCard=X},G=X=>{w.value=[...X]},Z=(X,H,I)=>{var j;const $=o.value.groupModifiers.findIndex(q=>q.id===X.id);if($!==-1)if(I){const q=o.value.groupModifiers,K=$+1;if(K<q.length){const oe=q[K];o.value.groupCurrentOpen={...oe,index:K},o.value.isSectionModifier=!0}}else{const q=X.id!==((j=o.value.groupCurrentOpen)==null?void 0:j.id);o.value.groupCurrentOpen={...X,index:$},o.value.isSectionModifier=q?!0:!o.value.isSectionModifier}},V=()=>{o.value.modalCount>o.value.currentModifier.min_amount&&o.value.modalCount>=2&&(o.value.modalCount-=1)},P=()=>{o.value.groupCurrentOpen&&o.value.modalCount+y.value<O.value&&(o.value.currentModifier.max_amount===0||o.value.currentModifier.max_amount>o.value.modalCount)&&(o.value.modalCount+=1)},L=(X,H)=>{var $;const I=($=o.value.groupCurrentOpen)==null?void 0:$.id.toUpperCase();if(!X&&!o.value.isModifiedAmount&&H.max_amount!==1){if(I==="Добавки2000"&&H.max_amount>1)return!0;if(Math.abs(O.value-y.value)>1&&I!=="Добавки2000")return!0}return!1},re=(X,H=!1)=>{o.value.modalCount=1,o.value.currentModifier=X;const I=o.value.groupModifiersSelected.findIndex($=>$.group===o.value.groupCurrentOpen.id);Q(I,X,H)},Q=(X,H,I)=>{var j,q,K;let $=o.value.groupModifiersSelected;if(X===-1)L(I,H)?o.value.isModifiedAmount=!0:$[o.value.groupCurrentOpen.index]={group:o.value.groupCurrentOpen.id,is_fake:((j=o.value.groupCurrentOpen)==null?void 0:j.is_fake)||!1,is_product_determining:((q=o.value.groupCurrentOpen)==null?void 0:q.is_product_determining)||!1,modifier_count:((K=o.value.currentModifier)==null?void 0:K.amount)||0,modifiers:[{...H,amount:(H==null?void 0:H.amount)??1}]};else{const oe=o.value.groupModifiers[X].group_modifiers.findIndex(ce=>ce.id===H.id);if($[X].modifiers.findIndex(ce=>ce.id===H.id)===-1){if(O.value===1)$[X].modifiers=[];else if(y.value>=O.value)return;L(I,H)?o.value.isModifiedAmount=!0:($[X].modifiers.push({...H,amount:(H==null?void 0:H.amount)??1}),$[X].modifier_count=$[X].modifiers.reduce((ce,Ce)=>ce+=Ce.amount,0),o.value.isAnimationFly=!0)}else $[X].modifiers=$[X].modifiers.filter(ce=>ce.id!==H.id),$[X].modifier_count=$[X].modifiers.reduce((ce,Ce)=>ce+=Ce.amount,0),o.value.groupModifiers[X].group_modifiers[oe].amount=1,o.value.groupModifiers[X].group_modifiers[oe].default_amount=0,o.value.isAnimationFly=!1}o.value.groupModifiersSelected=$};return{stateCard:o,totalPrice_libCard:T,recountGroupTotalAmount:y,groupTotalAmount:O,isOpenWindow:u,isUpSale:f,checkedRequiredBtn:U,dataUpSale:p,productCards:w,isAddToCard:m,openProduct:x,is_startPage:C,isLastGroup:v,setProduct:G,summModifierAmount:N,setAddedProducts:R,setCurrentCard:F,minusAmount:V,plusAmount:P,toggleNotRequire:Z,modifierSelect:re,defaultAmountModifiers:M,validateGroup:D,reset:i}});var wr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function ta(a){return a&&a.__esModule&&Object.prototype.hasOwnProperty.call(a,"default")?a.default:a}var na={exports:{}};(function(a,l){(function(o,i){a.exports=i()})(wr,function(){var o=1e3,i=6e4,u=36e5,f="millisecond",m="second",p="minute",w="hour",x="day",C="week",y="month",N="quarter",O="year",T="date",v="Invalid Date",D=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,U=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,M={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(H){var I=["th","st","nd","rd"],$=H%100;return"["+H+(I[($-20)%10]||I[$]||I[0])+"]"}},R=function(H,I,$){var j=String(H);return!j||j.length>=I?H:""+Array(I+1-j.length).join($)+H},F={s:R,z:function(H){var I=-H.utcOffset(),$=Math.abs(I),j=Math.floor($/60),q=$%60;return(I<=0?"+":"-")+R(j,2,"0")+":"+R(q,2,"0")},m:function H(I,$){if(I.date()<$.date())return-H($,I);var j=12*($.year()-I.year())+($.month()-I.month()),q=I.clone().add(j,y),K=$-q<0,oe=I.clone().add(j+(K?-1:1),y);return+(-(j+($-q)/(K?q-oe:oe-q))||0)},a:function(H){return H<0?Math.ceil(H)||0:Math.floor(H)},p:function(H){return{M:y,y:O,w:C,d:x,D:T,h:w,m:p,s:m,ms:f,Q:N}[H]||String(H||"").toLowerCase().replace(/s$/,"")},u:function(H){return H===void 0}},G="en",Z={};Z[G]=M;var V="$isDayjsObject",P=function(H){return H instanceof ee||!(!H||!H[V])},L=function H(I,$,j){var q;if(!I)return G;if(typeof I=="string"){var K=I.toLowerCase();Z[K]&&(q=K),$&&(Z[K]=$,q=K);var oe=I.split("-");if(!q&&oe.length>1)return H(oe[0])}else{var de=I.name;Z[de]=I,q=de}return!j&&q&&(G=q),q||!j&&G},re=function(H,I){if(P(H))return H.clone();var $=typeof I=="object"?I:{};return $.date=H,$.args=arguments,new ee($)},Q=F;Q.l=L,Q.i=P,Q.w=function(H,I){return re(H,{locale:I.$L,utc:I.$u,x:I.$x,$offset:I.$offset})};var ee=function(){function H($){this.$L=L($.locale,null,!0),this.parse($),this.$x=this.$x||$.x||{},this[V]=!0}var I=H.prototype;return I.parse=function($){this.$d=function(j){var q=j.date,K=j.utc;if(q===null)return new Date(NaN);if(Q.u(q))return new Date;if(q instanceof Date)return new Date(q);if(typeof q=="string"&&!/Z$/i.test(q)){var oe=q.match(D);if(oe){var de=oe[2]-1||0,ce=(oe[7]||"0").substring(0,3);return K?new Date(Date.UTC(oe[1],de,oe[3]||1,oe[4]||0,oe[5]||0,oe[6]||0,ce)):new Date(oe[1],de,oe[3]||1,oe[4]||0,oe[5]||0,oe[6]||0,ce)}}return new Date(q)}($),this.init()},I.init=function(){var $=this.$d;this.$y=$.getFullYear(),this.$M=$.getMonth(),this.$D=$.getDate(),this.$W=$.getDay(),this.$H=$.getHours(),this.$m=$.getMinutes(),this.$s=$.getSeconds(),this.$ms=$.getMilliseconds()},I.$utils=function(){return Q},I.isValid=function(){return this.$d.toString()!==v},I.isSame=function($,j){var q=re($);return this.startOf(j)<=q&&q<=this.endOf(j)},I.isAfter=function($,j){return re($)<this.startOf(j)},I.isBefore=function($,j){return this.endOf(j)<re($)},I.$g=function($,j,q){return Q.u($)?this[j]:this.set(q,$)},I.unix=function(){return Math.floor(this.valueOf()/1e3)},I.valueOf=function(){return this.$d.getTime()},I.startOf=function($,j){var q=this,K=!!Q.u(j)||j,oe=Q.p($),de=function(et,rt){var Ve=Q.w(q.$u?Date.UTC(q.$y,rt,et):new Date(q.$y,rt,et),q);return K?Ve:Ve.endOf(x)},ce=function(et,rt){return Q.w(q.toDate()[et].apply(q.toDate("s"),(K?[0,0,0,0]:[23,59,59,999]).slice(rt)),q)},Ce=this.$W,ge=this.$M,De=this.$D,xe="set"+(this.$u?"UTC":"");switch(oe){case O:return K?de(1,0):de(31,11);case y:return K?de(1,ge):de(0,ge+1);case C:var _t=this.$locale().weekStart||0,be=(Ce<_t?Ce+7:Ce)-_t;return de(K?De-be:De+(6-be),ge);case x:case T:return ce(xe+"Hours",0);case w:return ce(xe+"Minutes",1);case p:return ce(xe+"Seconds",2);case m:return ce(xe+"Milliseconds",3);default:return this.clone()}},I.endOf=function($){return this.startOf($,!1)},I.$set=function($,j){var q,K=Q.p($),oe="set"+(this.$u?"UTC":""),de=(q={},q[x]=oe+"Date",q[T]=oe+"Date",q[y]=oe+"Month",q[O]=oe+"FullYear",q[w]=oe+"Hours",q[p]=oe+"Minutes",q[m]=oe+"Seconds",q[f]=oe+"Milliseconds",q)[K],ce=K===x?this.$D+(j-this.$W):j;if(K===y||K===O){var Ce=this.clone().set(T,1);Ce.$d[de](ce),Ce.init(),this.$d=Ce.set(T,Math.min(this.$D,Ce.daysInMonth())).$d}else de&&this.$d[de](ce);return this.init(),this},I.set=function($,j){return this.clone().$set($,j)},I.get=function($){return this[Q.p($)]()},I.add=function($,j){var q,K=this;$=Number($);var oe=Q.p(j),de=function(ge){var De=re(K);return Q.w(De.date(De.date()+Math.round(ge*$)),K)};if(oe===y)return this.set(y,this.$M+$);if(oe===O)return this.set(O,this.$y+$);if(oe===x)return de(1);if(oe===C)return de(7);var ce=(q={},q[p]=i,q[w]=u,q[m]=o,q)[oe]||1,Ce=this.$d.getTime()+$*ce;return Q.w(Ce,this)},I.subtract=function($,j){return this.add(-1*$,j)},I.format=function($){var j=this,q=this.$locale();if(!this.isValid())return q.invalidDate||v;var K=$||"YYYY-MM-DDTHH:mm:ssZ",oe=Q.z(this),de=this.$H,ce=this.$m,Ce=this.$M,ge=q.weekdays,De=q.months,xe=q.meridiem,_t=function(rt,Ve,it,Me){return rt&&(rt[Ve]||rt(j,K))||it[Ve].slice(0,Me)},be=function(rt){return Q.s(de%12||12,rt,"0")},et=xe||function(rt,Ve,it){var Me=rt<12?"AM":"PM";return it?Me.toLowerCase():Me};return K.replace(U,function(rt,Ve){return Ve||function(it){switch(it){case"YY":return String(j.$y).slice(-2);case"YYYY":return Q.s(j.$y,4,"0");case"M":return Ce+1;case"MM":return Q.s(Ce+1,2,"0");case"MMM":return _t(q.monthsShort,Ce,De,3);case"MMMM":return _t(De,Ce);case"D":return j.$D;case"DD":return Q.s(j.$D,2,"0");case"d":return String(j.$W);case"dd":return _t(q.weekdaysMin,j.$W,ge,2);case"ddd":return _t(q.weekdaysShort,j.$W,ge,3);case"dddd":return ge[j.$W];case"H":return String(de);case"HH":return Q.s(de,2,"0");case"h":return be(1);case"hh":return be(2);case"a":return et(de,ce,!0);case"A":return et(de,ce,!1);case"m":return String(ce);case"mm":return Q.s(ce,2,"0");case"s":return String(j.$s);case"ss":return Q.s(j.$s,2,"0");case"SSS":return Q.s(j.$ms,3,"0");case"Z":return oe}return null}(rt)||oe.replace(":","")})},I.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},I.diff=function($,j,q){var K,oe=this,de=Q.p(j),ce=re($),Ce=(ce.utcOffset()-this.utcOffset())*i,ge=this-ce,De=function(){return Q.m(oe,ce)};switch(de){case O:K=De()/12;break;case y:K=De();break;case N:K=De()/3;break;case C:K=(ge-Ce)/6048e5;break;case x:K=(ge-Ce)/864e5;break;case w:K=ge/u;break;case p:K=ge/i;break;case m:K=ge/o;break;default:K=ge}return q?K:Q.a(K)},I.daysInMonth=function(){return this.endOf(y).$D},I.$locale=function(){return Z[this.$L]},I.locale=function($,j){if(!$)return this.$L;var q=this.clone(),K=L($,j,!0);return K&&(q.$L=K),q},I.clone=function(){return Q.w(this.$d,this)},I.toDate=function(){return new Date(this.valueOf())},I.toJSON=function(){return this.isValid()?this.toISOString():null},I.toISOString=function(){return this.$d.toISOString()},I.toString=function(){return this.$d.toUTCString()},H}(),X=ee.prototype;return re.prototype=X,[["$ms",f],["$s",m],["$m",p],["$H",w],["$W",x],["$M",y],["$y",O],["$D",T]].forEach(function(H){X[H[1]]=function(I){return this.$g(I,H[0],H[1])}}),re.extend=function(H,I){return H.$i||(H(I,ee,re),H.$i=!0),re},re.locale=L,re.isDayjs=P,re.unix=function(H){return re(1e3*H)},re.en=Z[G],re.Ls=Z,re.p={},re})})(na);var Hd=na.exports;const ra=ta(Hd),Gd=a=>{const l=Te.useRouter(),o=`${a.domain}/api/`,i=Ze.create({baseURL:o}),u=Ze.create({baseURL:o}),f=Ze.create({baseURL:o}),m=Ze.create({baseURL:o}),p=Ze.create({baseURL:o}),w=Ze.create({baseURL:o}),x=Ze.create({baseURL:o}),C=M=>{try{const R=JSON.parse(localStorage.getItem("authTokensAccess")||"");R.length>0&&(M.headers.Authorization=`Bearer ${R}`)}catch{console.warn("accessToken is undefined [useAxios]")}return M},y=M=>{const R=localStorage.getItem("apiKey");return M.headers={"Content-Type":"application/json","x-api-key":R},M},N=async M=>{if(!a.user)return M;const R=a.user.exp??0;if(!(ra.unix(R).diff(ra())<3e3))return M;const G=hs("authTokensRefresh",null,"string");try{const Z=await Ze.post(`${o}user/token/refresh/`,{refresh:G.value});if(!Z.data.access)return U(),M;localStorage.setItem("authTokensAccess",JSON.stringify(Z.data.access)),v(Z.data),D(fs(Z.data.access)),M.headers={...M.headers,Authorization:`Bearer ${Z.data.access}`}}catch(Z){console.error("Failed to refresh token:",Z),U()}return M},O=M=>{M.interceptors.request.use(R=>N(C(R)),R=>Promise.reject(R))};O(f),O(p),O(x);const T=M=>{M.interceptors.request.use(R=>y(R))};T(w),T(u),T(x);const v=(M,R=!1)=>{localStorage.setItem("authTokensAccess",JSON.stringify(M.access)),R&&localStorage.setItem("authTokensRefresh",JSON.stringify(M.refresh))},D=M=>{a.user=M,localStorage.setItem("user",JSON.stringify(M))},U=()=>{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:i,axiosInstanceGetApiKey:u,axiosInstancePostApiKey:w}},ia=(a="themeConfig")=>{try{const l=localStorage.getItem(a);return l?JSON.parse(l):null}catch{return null}},Ge=class Ge{constructor(){Re(this,"axiosInstanceGet");Re(this,"axiosInstancePost");Re(this,"axiosInstanceAuthenticationGet");Re(this,"axiosInstanceAuthenticationPost");Re(this,"axiosInstanceGetApiKey");Re(this,"axiosInstancePostApiKey");Re(this,"axiosInstanceAuthenticationPostApiKey");Re(this,"currentUpsaleController",null);Re(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,o=null){const i=st(),u=Lt(),{config_lib:f}=we.storeToRefs(i),{stateCard:m,recountGroupTotalAmount:p}=we.storeToRefs(u);Ge._config=l,Ge._cardStore=u,Ge._stateCard=m,Ge._recountGroupTotalAmount=p,f.value=l;const w=Gd(l);Ge._axiosPostApiKey=w.axiosInstanceGetApiKey,Ge._axiosPostApiKey=w.axiosInstancePostApiKey,Ge._axiosAuthPostApiKey=w.axiosInstanceAuthenticationPostApiKey,Ge._axiosGet=w.axiosInstanceGet,Ge._axiosPost=w.axiosInstancePost,Ge._axiosAuthGet=w.axiosInstanceAuthenticationGet,Ge._axiosAuthPost=w.axiosInstanceAuthenticationPost}get config(){return Ge._config}get cardStore(){return Ge._cardStore}get stateCard(){return Ge._stateCard}get recountGroupTotalAmount(){return Ge._recountGroupTotalAmount}async updateTheme(){var f,m;const l=ia(),o=Rt();if(l!==null){o.updateColor(l);return}const i=st(),u=await((m=this.axiosInstanceGet)==null?void 0:m.get(`org/organizations/${(f=this.config)==null?void 0:f.orgId}/design/`));i.setStateDrum(u==null?void 0:u.data.hide_barban),i.setKioskTimeout(u==null?void 0:u.data.kiosk_timeout),localStorage.setItem("themeConfig",JSON.stringify(u.data)),o.updateColor(u.data)}async getGroupByID(l){var o,i;try{const u=await((i=this.axiosInstanceGet)==null?void 0:i.get(`${(o=this.config)==null?void 0:o.pointId}/group/${l}`));return u==null?void 0:u.data}catch(u){throw console.error("Ошибка в request.ts[getGroupByID]",u),u}}async loadGroupProducts(l){var o,i;try{const u=await((i=this.axiosInstanceGet)==null?void 0:i.get(`${(o=this.config)==null?void 0:o.pointId}/products/?group=${l}`)),f=(u==null?void 0:u.data)||[];for(const m of f)m&&await Tl(m);return await this.cacheImagesInBackground(f),f}catch(u){return console.error("Ошибка загрузки группы:",u),[]}}async getGroup(){var l,o;try{const i=await((o=this.axiosInstanceGet)==null?void 0:o.get(`${(l=this.config)==null?void 0:l.pointId}/groups/`));return i==null?void 0:i.data}catch(i){return console.error("Error fetching products:",i),[]}}async fetchAndCacheAllPages(){var l,o;try{const i=((l=this.config)==null?void 0:l.pointId)||"",u=await qi(i);if(u)return u.data;const f=await((o=this.axiosInstanceGet)==null?void 0:o.get(`${i}/group/`)),m=(f==null?void 0:f.data)||[],p=[];for(const w of m){w.products=w.products||[],await Dr(w.id,w),p.push(w);const x=await this.loadGroupProducts(w.id);w.products=x}return await this.cacheImagesInBackground(m),await Dr(i,m),p}catch(i){return console.error("fetchAndCacheAllPages error:",i),[]}}cacheImagesInBackground(l){l.forEach(o=>{var i;o.video_link&&this.loadAndCacheMedia(o.video_link,o.id+"_video"),o.image_link&&this.loadAndCacheMedia(o.image_link,o.id+"_image"),(i=o.products)==null||i.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,o){const i=await fr(o);if(i){this.dispatchImageCachedEvent(o,i);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(o,f),this.dispatchImageCachedEvent(o,f)}catch(u){console.warn(`[ImageCache] Failed for ${o}:`,u)}}dispatchImageCachedEvent(l,o){window.dispatchEvent(new CustomEvent("image-cached",{detail:{id:l,blob:o}}))}async getProduct(l=null){var o,i;if(!l)return[];try{const u=await((i=this.axiosInstanceGet)==null?void 0:i.get(`${(o=this.config)==null?void 0:o.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 o=st(),{config_lib:i}=we.storeToRefs(o);try{let f=await rs(l);if(f)this._fullCardProduct(f);else{const m=await((u=this.axiosInstanceGet)==null?void 0:u.get(`${i.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 o=Lt();o.stateCard.openCard={...l,amount:1},o.stateCard.groupModifiers=l.group_modifiers,l.modifiers.length>0&&o.stateCard.groupModifiers.unshift({default_amount:0,description:"",group_modifiers:l.modifiers,id:"Добавки2000",image_link:null,max_amount:1,min_amount:l.modifiers.reduce((i,u)=>i+=u.min_amount,0),name:"Добавки",required:!1}),o.stateCard.groupModifiersSelected=new Array(o.stateCard.groupModifiers.length).fill({group:"",modifiers:[],is_fake:!1,is_product_determining:!1,modifier_count:0}),o.stateCard.productSizes=l.sizes,o.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 o,i;try{const u=await((i=this.axiosInstanceAuthenticationPostApiKey)==null?void 0:i.post(`${(o=this.config)==null?void 0:o.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 o,i;try{const u=await((i=this.axiosInstancePostApiKey)==null?void 0:i.post(`${(o=this.config)==null?void 0:o.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,o){var i,u;try{const f=await((u=this.axiosInstanceAuthenticationPostApiKey)==null?void 0:u.post(`${(i=this.config)==null?void 0:i.domain}/api/device/auth/`,{code:l,phone:o}));return f==null?void 0:f.data}catch(f){throw console.error("Ошибка отправки sms-code:",f),f}}async callStaff(l,o,i){var u,f,m,p;try{const w=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/`,{...o},i));return(p=w==null?void 0:w.data)==null?void 0:p.response_text}catch(w){throw console.error("Ошибка[callStaff]",w),w}}async confirmOrder(l){var i,u;const o=await((u=this.axiosInstancePost)==null?void 0:u.post(`/org_unit/${(i=this.config)==null?void 0:i.pointId}/confirm-order/`,{order:l}));return(o==null?void 0:o.status)===200}async createOrder(l,o,i=!0,u,f=!1,m){var T,v,D,U,M;const p=Mt(),w=f?this.axiosInstanceAuthenticationPostApiKey:this.axiosInstancePostApiKey,x=i?w:this.axiosInstanceAuthenticationPost,C=i?"/device/order/create":"/order/create",y=i?(T=this.config)==null?void 0:T.pointId:(v=this.config)==null?void 0:v.pointId,N={items:l,comment:u};return o&&(N.table=o),i&&((D=p.selectedOrderType)!=null&&D.id)&&(N.order_type_id=(U=p.selectedOrderType)==null?void 0:U.id),await(x==null?void 0:x.post(`${(M=this.config)==null?void 0:M.domain}/api/org_unit/${y}${C}`,N,{signal:m}))}async extendOrder(l){var m,p;const o=Fn();if(!o.id)throw Error("Неверный стол");if(!((m=o.data)!=null&&m.order))throw Error("Заказ не найден");const i=this.axiosInstanceAuthenticationPost,u={items:l,table:o.id},f=await(i==null?void 0:i.post(`/org_unit/${(p=this.config)==null?void 0:p.pointId}/order/${o.data.order}/extend`,u));return f==null?void 0:f.data}async initPaymentLink(l,o){var w,x,C;const i=this.axiosInstanceAuthenticationPost,u=st(),f=Fn(),m={order:l,provider_type:o};u.countBonus>0&&(m.by_bonuses=u.countBonus),f.isTableService&&((w=f.order)==null?void 0:w.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(i==null?void 0:i.post("payment/init",m));return p==null?void 0:p.data}async orderPay(l){var o;return(o=this.axiosInstanceAuthenticationPostApiKey)==null?void 0:o.post(`order/${l}/pay/`,{order_id:l})}async getProfile(){var o,i;const l=await((i=this.axiosInstanceAuthenticationGet)==null?void 0:i.get(`user/current?organization=${(o=this.config)==null?void 0:o.orgId}`));if((l==null?void 0:l.status)===200){const u=st();return u.profile=l.data,u.is18Allowed=sessionStorage.getItem("is_adult")==="true",l.data}else return l}async joinLoyalty(){var o;const l=await((o=this.axiosInstanceAuthenticationGet)==null?void 0:o.post("user/join-loyalty/"));return{success:(l==null?void 0:l.status)===200}}async isPhoneExist(l,o={}){var i,u;try{const f=await((u=this.axiosInstanceGet)==null?void 0:u.get("user/check-phone",{...o,params:{organization:(i=this.config)==null?void 0:i.orgId,phone:l}}));return(f==null?void 0:f.status)===200}catch{return!1}}async sendOTP(l,o={}){var u,f;const i=await((f=this.axiosInstancePost)==null?void 0:f.post("user/check-phone",{organization:(u=this.config)==null?void 0:u.orgId,phone:l},o));return i==null?void 0:i.data}async auth(l,o={}){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},o))}async signup(l,o={}){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},o))}async calculateDiscount(l,o=!0,i=!1,u){var C,y;const f=i?this.axiosInstanceAuthenticationPostApiKey:this.axiosInstancePostApiKey,m=i?this.axiosInstanceAuthenticationPost:this.axiosInstancePost,p=o?f:m,w=o?(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/${w}/cart/calculate-discount/`,l,{signal:u}));return(x==null?void 0:x.status)===200?x.data:x}async maxPayByBonuses(l,o=!0,i=!1,u){const f=st(),m=i?this.axiosInstanceAuthenticationPostApiKey:this.axiosInstancePostApiKey,p=i?this.axiosInstanceAuthenticationPost:this.axiosInstancePost,w=o?m:p,x=await(w==null?void 0:w.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 i;const l=Mt(),o=await((i=this.axiosInstanceGetApiKey)==null?void 0:i.get("/device/current/"));return(o==null?void 0:o.status)===200?(l.orderTypes=o.data.order_types,l.providerTypes=o.data.payment_provider_type,o.data):o}async validateApiKey(l,o){var u,f;const i=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},o));return(i==null?void 0:i.status)===200}async productUpsale(l){var f,m,p;const o=Lt(),{dataUpSale:i}=we.storeToRefs(o);(f=this.currentUpsaleController)==null||f.abort();const u=new AbortController;this.currentUpsaleController=u;try{const w=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||(i.value=w==null?void 0:w.data)}catch(w){if(w.name==="AbortError"||w.name==="CanceledError"){console.warn("Upsale отменён — пришёл новый запрос");return}throw console.error("Ошибка upsale:",w),w}finally{this.currentUpsaleController===u&&(this.currentUpsaleController=null)}}};Re(Ge,"_config",null),Re(Ge,"_axiosGet"),Re(Ge,"_axiosGetApiKey"),Re(Ge,"_axiosPostApiKey"),Re(Ge,"_axiosAuthPostApiKey"),Re(Ge,"_axiosPost"),Re(Ge,"_axiosAuthGet"),Re(Ge,"_axiosAuthPost"),Re(Ge,"_cardStore",null),Re(Ge,"_stateCard",null),Re(Ge,"_recountGroupTotalAmount",null);let yn=Ge;const oa=r.ref(!1),sa=r.ref(window.innerWidth),Un=()=>{const a=r.computed({get:()=>oa.value,set:u=>{oa.value=u}}),l=r.computed(()=>a.value&&sa.value>1024),o=()=>sa.value=window.innerWidth;return r.onMounted(()=>{window.addEventListener("resize",o)}),r.onUnmounted(()=>{window.removeEventListener("resize",o)}),{isDesktop:a,shouldUseDragScroll:l,syncWithRoute:u=>{a.value=u.query.mode==="pdf"}}},Wd=r.defineComponent({__name:"UseScrollCenter",props:{axis:{},behavior:{},autoScroll:{type:Boolean},container:{},idActive:{},clearContainer:{type:Boolean}},setup(a,{expose:l}){const o=a,i=st(),u=r.ref(null),{isDesktop:f}=Un(),m=async w=>{if(!u.value||!w)return;let x=window;o.container&&(x=typeof o.container=="string"?document.querySelector(o.container)||window:o.container);const C={behavior:o.behavior};if(o.axis==="x"){const y=x===window?window.innerWidth:x.clientWidth,N=w.offsetWidth;let O=w.offsetLeft;if(x!==window){const T=x.getBoundingClientRect();O=w.getBoundingClientRect().left-T.left+x.scrollLeft}O-=(y-N)/2,C.left=Math.max(0,O)}else{const y=x===window?window.innerHeight:x.clientHeight,N=w.offsetHeight;let O=w.offsetTop;if(x!==window){const T=x.getBoundingClientRect();O=w.getBoundingClientRect().top-T.top+x.scrollTop}O-=(y-N)/2,C.top=Math.max(0,O)}try{x===window?window.scrollTo(C):x.scrollTo(C)}catch(y){console.error("Scroll error:",y)}};r.onMounted(async()=>{if(o.autoScroll){let w=null;if(await r.nextTick(),i.activeScrolling_lib){const x=i.activeScrolling_lib.findIndex(C=>C.id===o.idActive);o.idActive?(w=document.getElementById(`scrolling${o.idActive}`),w&&x!==-1&&(i.activeScrolling_lib[x]=w)):i.activeScrolling_lib[x]&&(w=i.activeScrolling_lib[x]),m(w)}}});const p=async w=>{o.clearContainer&&(i.activeScrolling_lib=[]);const x=w.currentTarget;await r.nextTick(),i.activeScrolling_lib.includes(x)||i.activeScrolling_lib.push(x),m(x)};return l({scrollToElement:m}),(w,x)=>(r.openBlock(),r.createElementBlock("div",{ref_key:"wrapperRef",ref:u,class:r.normalizeClass(["scroll-to-wrapper",{scroll_pdf:r.unref(f)}])},[r.renderSlot(w.$slots,"default",{handleTargetClick:p},void 0,!0)],2))}}),Xe=(a,l)=>{const o=a.__vccOpts||a;for(const[i,u]of l)o[i]=u;return o},ho=Xe(Wd,[["__scopeId","data-v-e47a167d"]]),Wr={mounted(a){let l=!1,o,i,u,f,m,p=0,w=0,x=0,C=0,y=0,N=!1;const O=5;a.style.cursor="grab";const T=U=>{U.button===0&&(m&&(cancelAnimationFrame(m),m=0),l=!0,N=!1,o=U.pageX-a.offsetLeft,i=U.pageY-a.offsetTop,u=a.scrollLeft,f=a.scrollTop,x=U.pageX,C=U.pageY,y=Date.now(),p=0,w=0)},v=U=>{if(!l)return;const M=U.pageX,R=U.pageY,F=Math.abs(M-x),G=Math.abs(R-C);if(!N&&(F>O||G>O)&&(N=!0,a.style.pointerEvents="none"),N){U.stopPropagation(),U.preventDefault();const Z=Date.now(),V=Z-y;V>0&&(p=(M-x)/V*16,w=(R-C)/V*16),x=M,C=R,y=Z;const P=M-a.offsetLeft,L=R-a.offsetTop,re=P-o,Q=L-i;a.scrollLeft=u-re,a.scrollTop=f-Q}else x=M,C=R,y=Date.now()},D=U=>{if(l){if(N){if(U.stopPropagation(),U.preventDefault(),a.style.pointerEvents="",Math.abs(p)>.1||Math.abs(w)>.1){const M=()=>{a.scrollLeft-=p,a.scrollTop-=w,p*=.95,w*=.95,Math.abs(p)>.1||Math.abs(w)>.1?m=requestAnimationFrame(M):m=0};m=requestAnimationFrame(M)}}else a.style.pointerEvents="";l=!1,N=!1}};a.addEventListener("mousedown",T),window.addEventListener("mousemove",v),window.addEventListener("mouseup",D),a._dragScrollCleanup=()=>{m&&cancelAnimationFrame(m),a.removeEventListener("mousedown",T),window.removeEventListener("mousemove",v),window.removeEventListener("mouseup",D),a.style.pointerEvents=""}},unmounted(a){a._dragScrollCleanup&&a._dragScrollCleanup()}},Xd={},$d={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 jd(a,l){return r.openBlock(),r.createElementBlock("svg",$d,[...l[0]||(l[0]=[r.createElementVNode("defs",null,null,-1),r.createElementVNode("path",{id:"custom_svg_color",d:"M11.83 26L11.83 14.15L0 14.15L0 11.84L11.83 11.84L11.83 0L14.15 0L14.15 11.84L26 11.84L26 14.15L14.15 14.15L14.15 26L11.83 26Z",fill:"#FF6D2E","fill-opacity":"1.000000","fill-rule":"nonzero"},null,-1)])])}const Ci=Xe(Xd,[["render",jd]]),qd=["id","onClick"],Zd={class:"modified_plus_btn"},Yd=["src"],Kd={key:2,class:"wrapper_modifier_item"},Qd={key:0,class:"modifier_item_n_wrapper"},Jd=["src"],eu={key:1,class:"modifier_plus_item"},tu=["src"],nu=["src"],aa=Xe(r.defineComponent({__name:"PlusModifier",props:{isSectionModifier:{type:Boolean},toggleNotRequire:{type:Function}},setup(a){const l=Lt(),o=Rt(),{stateCard:i}=we.storeToRefs(l),{itemThemes:u}=we.storeToRefs(o),{shouldUseDragScroll:f}=Un(),m=r.ref([]),p=r.ref([]),w=r.ref(null),x=r.ref(null),C=r.ref(null),y=O=>{O instanceof HTMLElement&&!m.value.includes(O)&&m.value.push(O)},N=O=>{C.value=O};return r.onMounted(async()=>{await r.nextTick(),i.value.plusButtonsRefs=m.value}),r.watchEffect(()=>{p.value=i.value.groupModifiersSelected,document.body.style.overflow=""}),r.watch(()=>{var O;return(O=i.value.groupCurrentOpen)==null?void 0:O.id},async O=>{var v;if(!O)return;await r.nextTick();const T=m.value.find(D=>D.id==="scrolling"+O);T&&((v=x.value)==null||v.scrollToElement(T))}),r.onBeforeUnmount(()=>{m.value=[],i.value.plusButtonsRefs=[]}),(O,T)=>(r.openBlock(),r.createElementBlock("div",{class:r.normalizeClass({card_modified_wrapper_many:r.unref(i).groupModifiers.length>=5})},[r.unref(i).groupModifiersSelected?r.withDirectives((r.openBlock(),r.createElementBlock("div",{key:0,class:r.normalizeClass(["card_modified_wrapper",[r.unref(i).groupModifiers.length<=4?"card_modified_wrapper_center":""]]),ref_key:"scrollPlusContainer",ref:w},[r.createVNode(ho,{ref_key:"scrollCenterRef",ref:x,axis:"x",behavior:"smooth",container:w.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(i).groupModifiers,(D,U)=>{var M,R;return r.openBlock(),r.createElementBlock("div",{class:"button_modified",key:D.id,ref_for:!0,ref:y,id:"scrolling"+D.id,"data-clickable":"true",onClick:F=>{a.toggleNotRequire&&a.toggleNotRequire(D,U),N(D.id),v(F)}},[r.createElementVNode("div",Zd,[p.value[U].modifiers.length===0?(r.openBlock(),r.createElementBlock("div",{key:0,class:r.normalizeClass([{modified_plus_btn_active:D.id===((M=r.unref(i).groupCurrentOpen)==null?void 0:M.id)&&a.isSectionModifier},"modified_plus_active"])},[r.createVNode(Ci,{"aria-label":`Открыть группу модификаторов ${D.name}`},null,8,["aria-label"])],2)):p.value[U].modifiers.length===1?(r.openBlock(),r.createElementBlock("div",{key:1,class:r.normalizeClass(["modified_plus_btn modified_plus_btn_solo",{modified_plus_btn_active:D.id===((R=r.unref(i).groupCurrentOpen)==null?void 0:R.id)&&a.isSectionModifier}])},[r.createElementVNode("img",{src:p.value[U].modifiers[0].image_link||r.unref(u).fallback_image||"",alt:"Модификатор"},null,8,Yd)],2)):(r.openBlock(),r.createElementBlock("div",Kd,[p.value[U].modifiers.length>2?(r.openBlock(),r.createElementBlock("div",Qd,[p.value[U].modifiers.length===3?(r.openBlock(),r.createElementBlock("img",{key:0,class:"modifier_plus_item modifier_item_three",src:p.value[U].modifiers[2].image_link||r.unref(u).fallback_image||""},null,8,Jd)):(r.openBlock(),r.createElementBlock("p",eu," + "+r.toDisplayString(p.value[U].modifiers.length-2),1))])):r.createCommentVNode("",!0),r.createElementVNode("div",null,[p.value[U].modifiers.length>0?(r.openBlock(),r.createElementBlock("img",{key:0,src:p.value[U].modifiers[0].image_link||r.unref(u).fallback_image||"",class:"modifier_plus_item modifier_item_first"},null,8,tu)):r.createCommentVNode("",!0),p.value[U].modifiers.length>1?(r.openBlock(),r.createElementBlock("img",{key:1,src:p.value[U].modifiers[1].image_link||r.unref(u).fallback_image||"",class:"modifier_plus_item modifier_item_second"},null,8,nu)):r.createCommentVNode("",!0)])]))]),r.createElementVNode("p",null,r.toDisplayString(D.name),1)],8,qd)}),128))]),_:1},8,["container","idActive"])],2)),[[r.unref(Wr),r.unref(f)?{}:!1]]):r.createCommentVNode("",!0)],2))}}),[["__scopeId","data-v-7f238435"]]),ru={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},iu=["stroke"],la=r.defineComponent({__name:"Close",props:{color:{type:String,required:!1,default:"currentColor"}},setup(a){const l=a;return(o,i)=>(r.openBlock(),r.createElementBlock("svg",ru,[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,iu)]))}}),ou={},su={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 au(a,l){return r.openBlock(),r.createElementBlock("svg",su,[...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 _r=Xe(ou,[["render",au]]),Xr={mounted(a){a.muted=!0,a.setAttribute("muted","")}},lu=["disabled","id"],an=r.defineComponent({__name:"ButtonDefault",props:{textButtonDefault:{type:String,required:!0},disabled:{type:Boolean,default:!1},onClick:{type:Function,required:!0}},setup(a){const l=a,o=()=>{l.onClick()};return(i,u)=>(r.openBlock(),r.createElementBlock("button",{class:"buttonDefaultWrapper",disabled:a.disabled,onClick:o,id:a.disabled?"buttonDefaultDisabled":""},r.toDisplayString(a.textButtonDefault),9,lu))}}),cu={class:"notification_info"},du={key:0,class:"notification_18plus"},uu={class:"notification_18plus_image"},fu=["src"],hu={class:"notification_18plus_text"},mu={class:"notification_18plus_accept"},gu={key:1,class:"notification_text"},pu={key:0,class:"wrapper_button_accept"},Ei=r.defineComponent({__name:"NotificationWindow",props:r.mergeModels({textNotificationDefault:{},backgroundColor:{},buttonAccept:{},type:{type:Boolean},is_qr:{type:Boolean}},{visible:{default:!1},visibleModifiers:{}}),emits:["update:visible"],setup(a){const l=a,o=Rt(),i=st(),{is18Allowed:u,notificationData_lib:f}=we.storeToRefs(i),{itemThemes:m}=we.storeToRefs(o),p=r.computed(()=>l.backgroundColor||"rgba(50, 50, 50, 0.9)"),w=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&&(i.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)},N=()=>{C.value=!1},O=()=>{C.value=!1,clearTimeout(x)};return r.watch([C,()=>l.textNotificationDefault,w],([T,v,D],[U,M])=>{x&&(!T||T!==U||v!==M)&&clearTimeout(x),D&&T&&(x=setTimeout(O,4e3))},{immediate:!0}),r.onUnmounted(()=>{x&&O()}),(T,v)=>(r.openBlock(),r.createElementBlock(r.Fragment,null,[!w.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:N})]),_:1})):r.createCommentVNode("",!0),r.createVNode(r.Transition,{name:"notification"},{default:r.withCtx(()=>{var D;return[C.value?(r.openBlock(),r.createElementBlock("div",{key:0,class:"notification_overlay",onClick:N},[r.createElementVNode("div",{class:"notification_wrapper",style:r.normalizeStyle({"background-color":p.value,border:`2px solid ${p.value}`})},[r.createElementVNode("div",cu,[a.type?(r.openBlock(),r.createElementBlock("div",du,[r.createElementVNode("div",uu,[r.createElementVNode("img",{src:r.unref(m).adult_disclaimer_image||r.unref(m).fallback_image,alt:"Дисклеймер"},null,8,fu)]),r.createElementVNode("div",hu,r.toDisplayString(r.unref(m).adult_disclaimer_text),1),r.createElementVNode("div",mu,[v[0]||(v[0]=r.createElementVNode("label",{for:"plus18"},"Содержащиеся в настоящем разделе материалы предназначены для лиц старше 18 лет, носят информационный характер об ассортименте товаров и не являются рекламой. ",-1)),r.createVNode(an,{textButtonDefault:"Мне есть 18",onClick:y,style:{fontSize:"1rem",padding:"6px 24px",marginLeft:"10px"}})])])):(r.openBlock(),r.createElementBlock("div",gu,[r.createTextVNode(r.toDisplayString(a.textNotificationDefault)+" ",1),(D=a.buttonAccept)!=null&&D.state?(r.openBlock(),r.createElementBlock("div",pu,[r.createVNode(an,{class:"button_accept",textButtonDefault:a.buttonAccept.text,onClick:a.buttonAccept.acceptBtn,disabled:a.buttonAccept.disabled},null,8,["textButtonDefault","onClick","disabled"])])):r.createCommentVNode("",!0)]))])],4)])):r.createCommentVNode("",!0)]}),_:1})],64))}}),xu={class:"wrapper_modifiers"},wu={class:"wrapper_nutritional_value"},_u={class:"nutritional_scheme"},Cu={key:0,class:"nutritional_parameters"},Eu={key:1,class:"nutritional_parameters"},yu={key:2,class:"nutritional_parameters"},bu={key:3,class:"nutritional_parameters"},Au={ref:"modifierBody",class:"modifier_shadow"},Su={class:"wrapper_modifiers_title"},Iu={class:"wrapper_text_count_modifiers"},Nu=["id","aria-label","onClick"],Tu={key:0,class:"counter_modifier"},ku={class:"hide_image_corners"},Ru=["src","alt"],Bu={key:1,loop:"",autoplay:"",muted:"",playsinline:"",class:"card__video"},Ou=["src"],Mu={class:"modifier_title"},Du={key:0,class:"modifier_continue_or_add_wrapper"},vu=Xe(r.defineComponent({__name:"SectionModifiers",emits:["close","add-to-cart"],setup(a,{emit:l}){const o=l,i=Rt(),u=Lt(),{itemThemes:f}=we.storeToRefs(i),{stateCard:m,recountGroupTotalAmount:p,groupTotalAmount:w,isLastGroup:x}=we.storeToRefs(u),{isDesktop:C,shouldUseDragScroll:y}=Un(),N=r.ref(null),O=yt.useTemplateRefsList(),T=r.ref(!1),v=M=>{if(!M)return;const R=m.value.groupModifiers.findIndex(P=>P.id===m.value.groupCurrentOpen.id),F=m.value.plusButtonsRefs[R]||m.value.plusButtonsRefs[0];if(!F)return;const G=M.getBoundingClientRect(),Z=F.getBoundingClientRect(),V=M.cloneNode(!0);V.classList.add("flyer"),Object.assign(V.style,{width:`${G.width}px`,height:`${G.height}px`,left:`${G.left}px`,top:`${G.top}px`,position:"fixed",zIndex:"1000"}),document.body.appendChild(V),N.value=V,requestAnimationFrame(()=>{const P=Z.left+Z.width/3-(G.left+G.width/2),L=Z.top+Z.height/4-(G.top+G.height/2),re=Z.width/G.width*.2;V.style.transform=`translate(${P}px, ${L}px) scale(${re})`,V.style.opacity="0.4",V.style.transition="transform 0.5s ease, opacity 0.5s ease"}),V.addEventListener("transitionend",()=>{V.remove(),N.value=null,F.classList.add("bump"),setTimeout(()=>F.classList.remove("bump"),300)},{once:!0})},D=()=>{m.value.isSectionModifier=!0;const M=m.value.groupCurrentOpen;if(!M)return;const R=m.value.groupModifiers.findIndex(G=>G.id===M.id),F=u.validateGroup(R);if(!F.valid){m.value.textErrorRequaired=F.errorText,T.value=!0;return}x.value?o("add-to-cart"):u.toggleNotRequire(M,void 0,!0)};r.watch(()=>m.value.isAnimationFly,M=>{M===!0&&m.value.currentModifier&&(v(O.value.find(R=>R.id===m.value.currentModifier.id)),m.value.isAnimationFly=!1)});const U=r.computed(()=>f.value.enable_sequential_modifiers?f.value.enable_sequential_modifiers:!0);return(M,R)=>{var F,G,Z,V,P,L,re,Q,ee,X,H,I,$,j;return r.openBlock(),r.createElementBlock(r.Fragment,null,[(r.openBlock(),r.createBlock(r.Teleport,{to:"body"},[r.createVNode(Ei,{visible:T.value,textNotificationDefault:r.unref(m).textErrorRequaired,backgroundColor:r.unref(f).accent_color?r.unref(f).accent_color:"#FF6D2E","onUpdate:visible":R[0]||(R[0]=q=>T.value=q)},null,8,["visible","textNotificationDefault","backgroundColor"])])),r.createElementVNode("div",xu,[r.createElementVNode("div",wu,[r.createElementVNode("div",{class:r.normalizeClass(["card_header_inner_back",[(F=r.unref(m).openCard)!=null&&F.proteins_amount?"card_header_inner_back_nutrients":""]]),"aria-label":"Закрыть выбор модификаторов",onClick:R[1]||(R[1]=q=>o("close"))},[r.createVNode(_r,{class:"arrow_bottom"})],2),r.createElementVNode("div",_u,[(G=r.unref(m).openCard)!=null&&G.energy_amount?(r.openBlock(),r.createElementBlock("div",Cu,[r.createElementVNode("b",null,r.toDisplayString((Z=r.unref(m).openCard)==null?void 0:Z.energy_amount),1),R[4]||(R[4]=r.createElementVNode("p",null,"Килокалории",-1))])):r.createCommentVNode("",!0),(V=r.unref(m).openCard)!=null&&V.proteins_amount?(r.openBlock(),r.createElementBlock("div",Eu,[r.createElementVNode("b",null,r.toDisplayString((P=r.unref(m).openCard)==null?void 0:P.proteins_amount),1),R[5]||(R[5]=r.createElementVNode("p",null,"Белки",-1))])):r.createCommentVNode("",!0),(L=r.unref(m).openCard)!=null&&L.fat_amount?(r.openBlock(),r.createElementBlock("div",yu,[r.createElementVNode("b",null,r.toDisplayString((re=r.unref(m).openCard)==null?void 0:re.fat_amount),1),R[6]||(R[6]=r.createElementVNode("p",null,"Жиры",-1))])):r.createCommentVNode("",!0),(Q=r.unref(m).openCard)!=null&&Q.carbohydrates_amount?(r.openBlock(),r.createElementBlock("div",bu,[r.createElementVNode("b",null,r.toDisplayString((ee=r.unref(m).openCard)==null?void 0:ee.carbohydrates_amount),1),R[7]||(R[7]=r.createElementVNode("p",null,"Углеводы",-1))])):r.createCommentVNode("",!0)]),r.createElementVNode("div",{class:r.normalizeClass(["card_header_inner_back card_header_inner_close_back",[(X=r.unref(m).openCard)!=null&&X.proteins_amount?"card_header_inner_back_nutrients":""]]),style:{marginRight:"10px"},"aria-label":"Закрыть выбор модификаторов",onClick:R[2]||(R[2]=q=>o("close"))},[r.createVNode(la,{class:"cross_bottom",color:"#FFFFFF"})],2)]),r.createElementVNode("div",Au,[r.createElementVNode("p",Su,r.toDisplayString((H=r.unref(m).groupCurrentOpen)==null?void 0:H.name),1),r.createElementVNode("p",Iu,"Выбрано "+r.toDisplayString(r.unref(p))+" из "+r.toDisplayString(r.unref(w)),1),r.withDirectives((r.openBlock(),r.createElementBlock("div",{class:r.normalizeClass((I=r.unref(m).groupModifiers.find(q=>{var K;return q.id===((K=r.unref(m).groupCurrentOpen)==null?void 0:K.id)}))!=null&&I.group_modifiers.length?"wrapper_modifiers_card":"wrapper_modifiers_card_column")},[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList((($=r.unref(m).groupCurrentOpen)==null?void 0:$.group_modifiers)||[],q=>{var K,oe,de;return r.openBlock(),r.createElementBlock("div",{key:q.id,ref_for:!0,ref:r.unref(O).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&&((K=r.unref(m).groupCurrentOpen)==null?void 0:K.id)==="Добавки2000"&&q.min_amount===0&&q.max_amount===0}]),tabindex:"0",role:"button","data-clickable":"true","aria-label":`Выбрать модификатор группы ${q.name}`,onClick:ce=>r.unref(u).modifierSelect(q)},[r.createElementVNode("div",{class:r.normalizeClass([{modifier_card_active:r.unref(m).groupModifiersSelected.some(ce=>{var Ce;return ce.group===((Ce=r.unref(m).groupCurrentOpen)==null?void 0:Ce.id)&&ce.modifiers.some(ge=>ge.id===q.id)})},"wrapper_image_corners"])},[q.amount>1?(r.openBlock(),r.createElementBlock("div",Tu,r.toDisplayString(q.amount),1)):r.createCommentVNode("",!0),r.createElementVNode("div",ku,[q.video_link?r.withDirectives((r.openBlock(),r.createElementBlock("video",Bu,[r.createElementVNode("source",{src:q.video_link||"",type:"video/webm"},null,8,Ou)])),[[r.unref(Xr)]]):(r.openBlock(),r.createElementBlock("img",{key:0,class:"modifier_image",src:q.image_link||r.unref(f).fallback_image||"",alt:q.name},null,8,Ru)),r.createElementVNode("div",{class:r.normalizeClass(["wrapper_modifier_title",{wrapper_modifier_title_required:q.min_amount>0||q.required}])},[r.createElementVNode("h3",Mu,r.toDisplayString(q.name),1),r.createElementVNode("p",null,"+"+r.toDisplayString(((de=(oe=q.sizes)==null?void 0:oe.find(ce=>ce.id===r.unref(m).selectedSize.id))==null?void 0:de.price)||q.price||0)+"₽",1)],2)])],2)],14,Nu)}),128))],2)),[[r.unref(Wr),(j=r.unref(m).groupModifiers.find(q=>{var K;return q.id===((K=r.unref(m).groupCurrentOpen)==null?void 0:K.id)}))!=null&&j.group_modifiers.length?{}:!1]]),U.value?(r.openBlock(),r.createElementBlock("div",Du,[r.createElementVNode("button",{onClick:R[3]||(R[3]=q=>D()),class:"modifier_continue_or_add"},r.toDisplayString(r.unref(x)?"Добавить":"Продолжить"),1)])):r.createCommentVNode("",!0)],512)])],64)}}}),[["__scopeId","data-v-9c8507e6"]]),Pu={key:0,class:"card_size_place"},Lu=["onClick","aria-label"],Fu={key:1,class:"card_size static"},Vu=["onClick","aria-label"],mo=3,Uu=Xe(r.defineComponent({__name:"SizeModifier",setup(a){const l=Lt(),{stateCard:o}=we.storeToRefs(l),i=r.ref(null),{isDesktop:u}=Un(),f=r.ref(50),m=r.ref(),p=r.ref(0),w=r.ref(0),x=r.ref(null),C=r.computed(()=>{var F;if(o.value.productSizes.length<=3)return o.value.productSizes[m.value.index]||o.value.productSizes[0];const M=p.value+1,R=((F=N.value[M])==null?void 0:F.originalIndex)??1;return o.value.productSizes[R]}),y=()=>{x.value&&o.value.productSizes.length>=3&&(w.value=x.value.offsetWidth/mo)},N=r.computed(()=>{if(o.value.productSizes.length<=3)return o.value.productSizes;const M=o.value.productSizes;return[...M.map((R,F)=>({...R,originalIndex:F})),...M.map((R,F)=>({...R,originalIndex:F})),...M.map((R,F)=>({...R,originalIndex:F}))]}),O=(M,R)=>{if(m.value={id:M.id,title:M.name,index:R,is_default:M.is_default},M.price!==null&&o.value.openCard&&(o.value.openCard={...o.value.openCard,price:M.price}),o.value.selectedSize=M,o.value.productSizes.length>3){y();const F=p.value+1;R<F?T():R>F&&v()}else{const F=o.value.productSizes.length,G=(R+.5)*(100/F);f.value=G}},T=()=>{var M;if(!(o.value.productSizes.length<=3)){if(p.value--,p.value<o.value.productSizes.length-mo+1){p.value+=o.value.productSizes.length;const R=(M=x.value)==null?void 0:M.querySelector(".card_size");R&&(R.style.transition="none",R.style.transform=`translateX(-${p.value*w.value}px)`,R.offsetHeight,R.style.transition="transform 0.2s ease-in-out")}D()}},v=()=>{var M;if(!(o.value.productSizes.length<=3)){if(p.value++,p.value>=o.value.productSizes.length*2){p.value-=o.value.productSizes.length;const R=(M=x.value)==null?void 0:M.querySelector(".card_size");R&&(R.style.transition="none",R.style.transform=`translateX(-${p.value*w.value}px)`,R.offsetHeight,R.style.transition="transform 0.2s ease-in-out")}D()}},D=()=>{var G;if(o.value.productSizes.length<=3)return;const M=p.value+1,R=((G=N.value[M])==null?void 0:G.originalIndex)??0,F=o.value.productSizes[R];m.value={id:F.id,title:F.name,index:R,is_default:F.is_default}};r.watch(()=>[o.value.productSizes,x.value],([M=[],R])=>{if(Array.isArray(M)&&M.length>0&&R!==null){let F=M.findIndex(G=>G.is_default===!0);M.length<3&&i.value&&parseInt(i.value.style.minWidth)<767&&(i.value.style.width="100px"),F>-1?(p.value=F,O(M[F],F),w.value=120/mo):M.length===2||M.length===1?(O(M[0],0),f.value=(0+.5)*(100/2)):(O(M[1],1),f.value=(1+.5)*(100/3))}}),r.watch(()=>{var M;return[(M=o.value.selectedSize)==null?void 0:M.id,o.value.groupModifiersSelected]},([M,R])=>{if(!M||!Array.isArray(R))return;const F=R.map(G=>({...G,modifiers:G.modifiers.map(Z=>{if(!Z.sizes||Z.sizes.length===0)return Z;const V=Z.sizes.find(P=>P.id===M);return V?{...Z,size:V,price:V.price??Z.price}:Z})}));JSON.stringify(F)!==JSON.stringify(o.value.groupModifiersSelected)&&(o.value.groupModifiersSelected=F)},{deep:!0});const U={mounted:y};return r.onBeforeUnmount(()=>{window.removeEventListener("resize",y)}),(M,R)=>r.withDirectives((r.openBlock(),r.createElementBlock("div",{class:"slider_container",ref_key:"slider_container",ref:i},[r.createElementVNode("div",{class:"card_size_place_wrapper",ref_key:"sliderWrapper",ref:x},[r.unref(o).productSizes.length>1&&m.value?(r.openBlock(),r.createElementBlock("div",Pu,[r.unref(o).productSizes.length>3?(r.openBlock(),r.createElementBlock("ul",{key:0,class:"card_size",style:r.normalizeStyle({transform:`translateX(-${p.value*w.value}px)`})},[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(N.value,(F,G)=>(r.openBlock(),r.createElementBlock("li",{key:`${F.id}-${G}`,onClick:Z=>O(F,G),class:r.normalizeClass({active:m.value.id===F.id&&m.value.index===F.originalIndex}),tabindex:"0",role:"button","aria-label":`Выбрать размер ${F.name}`},r.toDisplayString(F.alt_name?F.alt_name:F.name),11,Lu))),128))],4)):(r.openBlock(),r.createElementBlock("ul",Fu,[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(r.unref(o).productSizes,(F,G)=>(r.openBlock(),r.createElementBlock("li",{key:`${F.id}-${G}`,onClick:Z=>O(F,G),class:r.normalizeClass({active:m.value.id===F.id&&m.value.index===G}),tabindex:"0",role:"button","aria-label":`Выбрать размер ${F.name}`},r.toDisplayString(F.alt_name?F.alt_name:F.name),11,Vu))),128))])),C.value?r.withDirectives((r.openBlock(),r.createElementBlock("div",{key:2,class:"size_active",style:r.normalizeStyle(r.unref(o).productSizes.length<=3?{left:`${f.value}%`}:{})},[r.createElementVNode("p",null,r.toDisplayString(C.value.alt_name?C.value.alt_name:C.value.name),1)],4)),[[U]]):r.createCommentVNode("",!0)])):r.createCommentVNode("",!0)],512)],512)),[[r.vShow,r.unref(o).productSizes.length>1&&m.value]])}}),[["__scopeId","data-v-ec659ddc"]]),zu="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",Hu={class:"counter_container"},Gu={class:"card_size_place_wrapper",ref:"sliderWrapper"},Wu={class:"cart_amount_counter"},Xu={class:"button_circle_number"},$u=Xe(r.defineComponent({__name:"NumberModifier",props:{qr_menu:{type:Boolean}},setup(a){const l=Lt(),{stateCard:o}=we.storeToRefs(l),i=Te.useRouter(),u=a,f=()=>{var p,w,x,C;(w=(p=i.options.history.state)==null?void 0:p.back)!=null&&w.includes("mode=pdf")&&u.qr_menu||(x=o.value.openCard)!=null&&x.amount&&((C=o.value.openCard)==null?void 0:C.amount)>1&&(o.value.openCard.amount-=1)},m=()=>{var p,w,x;(w=(p=i.options.history.state)==null?void 0:p.back)!=null&&w.includes("mode=pdf")&&u.qr_menu||(x=o.value.openCard)!=null&&x.amount&&(o.value.openCard.amount+=1)};return(p,w)=>{var x,C;return r.openBlock(),r.createElementBlock("div",Hu,[r.createElementVNode("div",Gu,[r.createElementVNode("div",Wu,[r.createElementVNode("p",{class:r.normalizeClass(["cart_circle_minus",[((x=r.unref(o).openCard)==null?void 0:x.amount)===1?"card_circle_minus_alone":""]]),"aria-label":"Уменьшить количество продукта","data-clickable":"true",onClick:r.withModifiers(f,["stop","prevent"])},[...w[0]||(w[0]=[r.createElementVNode("span",null,null,-1)])],2),r.createElementVNode("p",Xu,r.toDisplayString((C=r.unref(o).openCard)==null?void 0:C.amount),1),r.createElementVNode("p",{class:"cart_circle_plus","aria-label":"Увеличить количество продукта","data-clickable":"true",onClick:r.withModifiers(m,["stop","prevent"])},"+")])],512)])}}}),[["__scopeId","data-v-50b09b8c"]]);function go(a,l=800){const o=r.ref(a),i=r.ref(a);let u=null,f=null,m=a;const p=w=>{f||(f=w);const x=w-f,C=Math.min(x/l,1),y=C<.5?4*C*C*C:1-Math.pow(-2*C+2,3)/2;o.value=Math.round(m+(i.value-m)*y),C<1?u=requestAnimationFrame(p):(o.value=i.value,u=null)};return r.watch(i,()=>{u&&cancelAnimationFrame(u),m=o.value,f=null,u=requestAnimationFrame(p)},{immediate:!0}),r.onUnmounted(()=>{u&&cancelAnimationFrame(u)}),{displayNumber:o,targetNumber:i,update:w=>{i.value=w}}}const ft=r.defineComponent({__name:"RecountNumber",props:{price:{type:Number,required:!0},duration:{type:Number},fixedFloat:{type:Number,require:!1}},setup(a){const l=a,{displayNumber:o,update:i}=go(l.price||0,l.duration||800);return r.watchEffect(()=>{i(l.price)}),(u,f)=>(r.openBlock(),r.createElementBlock("span",null,r.toDisplayString(r.unref(o).toFixed(a.fixedFloat)),1))}}),ju={class:"button_price button_price_modifiers"},qu=["src"],Zu={class:"button_text_container"},Yu={class:"button_text_price"},Ku=Xe(r.defineComponent({__name:"ButtonPriceCount",props:{qr_menu:{type:Boolean,default:!1},closeProduct:{}},setup(a,{expose:l}){const o=Te.useRouter(),i=Te.useRoute(),u=Lt(),f=st(),m=Rt(),p=a,{stateCard:w,totalPrice_libCard:x,isOpenWindow:C,isAddToCard:y}=we.storeToRefs(u),{isDesktop:N}=Un(),{itemThemes:O}=we.storeToRefs(m),T=r.ref(!0),v=r.ref(!1),D=r.computed(()=>N.value?!1:T.value),U=r.ref([]),M=r.ref([]),R=()=>{var G,Z,V,P,L;if((Z=(G=o.options.history.state)==null?void 0:G.back)!=null&&Z.includes("mode=pdf")&&p.qr_menu)return;if(T.value){u.setCurrentCard(w.value.openCard),v.value=!0;const re=w.value.groupModifiers.findIndex(Q=>u.checkedRequiredBtn.group.id===Q.id);u.checkedRequiredBtn.haveRequaire&&u.toggleNotRequire(u.checkedRequiredBtn.group,re);return}const F=w.value.groupModifiersSelected||[];if(U.value=[],M.value=[],Array.isArray(F)&&F.length>0&&F.forEach(re=>{const Q=re.group,ee=re.modifiers||[];Q==="Добавки2000"?U.value=ee.map(X=>{var H;return{...X,old_price:X.price,size:Array.isArray(X.size)?X.size.map(I=>I.id).filter(Boolean):(H=X.size)!=null&&H.id?X.size.id:void 0}}):ee.length>0&&M.value.push({group:Q,is_fake:re.is_fake||!1,is_product_determining:re.is_product_determining||!1,modifiers:ee.map(X=>{var H;return{...X,old_price:X.price,size:Array.isArray(X.size)?X.size.map(I=>I.id).filter(Boolean):(H=X.size)!=null&&H.id?X.size.id:void 0}})})}),document.body.style.overflow="",w.value.openCard){const re={id:w.value.openCard.id,is_fake:w.value.openCard.is_fake||!1,is_od_united_product:w.value.openCard.is_od_united_product||!1,amount:w.value.openCard.amount,name:w.value.openCard.name,image_link:w.value.openCard.image_link,price:w.value.openCard.price,old_price:w.value.openCard.price,size:((V=w.value.selectedSize)==null?void 0:V.id)??((L=(P=w.value.openCard.sizes)==null?void 0:P.find(Q=>Q.is_default))==null?void 0:L.id),sizes:w.value.openCard.sizes||[],modifiers:U.value,groups:w.value.openCard.groups,group_modifiers:M.value,energy_amount:w.value.openCard.energy_amount??0,proteins_amount:w.value.openCard.proteins_amount??0,fat_amount:w.value.openCard.fat_amount??0,carbohydrates_amount:w.value.openCard.carbohydrates_amount??0};p.closeProduct&&p.closeProduct(),f.addToCart(re),y.value=!0}C.value=!1,p.qr_menu&&o.push(`/${i.params.orgId}/`)};return r.watch(()=>w.value.productSizes,F=>{!F||F.length===0||!w.value.selectedSize||(w.value.selectedSize={...w.value.selectedSize})},{immediate:!0}),r.watchEffect(()=>{u.checkedRequiredBtn.haveRequaire?T.value=!0:T.value=!1}),r.onMounted(()=>{y.value=!1}),l({addProductToCart:R}),(F,G)=>(r.openBlock(),r.createElementBlock(r.Fragment,null,[(r.openBlock(),r.createBlock(r.Teleport,{to:"body"},[r.createVNode(Ei,{visible:v.value,textNotificationDefault:r.unref(w).textErrorRequaired,backgroundColor:r.unref(O).accent_color?r.unref(O).accent_color:"#FF6D2E",buttonAccept:null,"onUpdate:visible":G[0]||(G[0]=Z=>v.value=Z)},null,8,["visible","textNotificationDefault","backgroundColor"])])),r.createElementVNode("div",{class:"button_price_bg_product",onTouchstart:G[3]||(G[3]=r.withModifiers(()=>{},["stop"])),onPointerdown:G[4]||(G[4]=r.withModifiers(()=>{},["stop"]))},[r.createElementVNode("div",ju,[r.unref(N)?r.createCommentVNode("",!0):(r.openBlock(),r.createBlock($u,{key:0,qr_menu:a.qr_menu},null,8,["qr_menu"])),r.createElementVNode("div",{class:r.normalizeClass(["card_product_button_buy",{buy_active:!D.value}]),"data-clickable":"true",onClick:R,onTouchstart:G[1]||(G[1]=r.withModifiers(()=>{},["stop"])),onPointerdown:G[2]||(G[2]=r.withModifiers(()=>{},["stop"]))},[r.unref(N)?r.createCommentVNode("",!0):(r.openBlock(),r.createElementBlock("img",{key:0,src:r.unref(zu),class:"card_product_button_icon"},null,8,qu)),r.createElementVNode("div",Zu,[r.createElementVNode("p",Yu,[r.createVNode(ft,{price:+r.unref(x),fixedFloat:2},null,8,["price"]),G[5]||(G[5]=r.createTextVNode(" ₽ ",-1))])])],34)])],32)],64))}}),[["__scopeId","data-v-15db613c"]]),Qu={class:"modified_amount"},Ju={class:"hide_image_corners"},e0=["src"],t0={class:"wrapper_modifier_title"},n0={class:"amount_title"},r0={class:"wrapper_amount_counter"},i0={class:"amount_count"},o0={class:"amount_wrapper"},s0={class:"add_counter_amount"},a0=Xe(r.defineComponent({__name:"ModalAmount",setup(a){const l=Lt(),o=Rt(),{itemThemes:i}=we.storeToRefs(o),{stateCard:u}=we.storeToRefs(l),f=r.computed(()=>{var w,x,C;return((C=(x=(w=u.value.currentModifier)==null?void 0:w.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(w,x)=>{var C,y;return r.openBlock(),r.createElementBlock(r.Fragment,null,[r.createElementVNode("div",Qu,[r.createElementVNode("div",Ju,[r.createElementVNode("img",{class:"modifier_image",src:((C=r.unref(u).currentModifier)==null?void 0:C.image_link)||r.unref(i).fallback_image||""},null,8,e0),r.createElementVNode("div",t0,[r.createElementVNode("p",n0,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",r0,[r.createElementVNode("div",{class:"amount_mines",onClick:x[0]||(x[0]=r.withModifiers((...N)=>r.unref(l).minusAmount&&r.unref(l).minusAmount(...N),["stop"]))},[...x[1]||(x[1]=[r.createElementVNode("div",null,null,-1)])]),r.createElementVNode("p",i0,r.toDisplayString(r.unref(u).modalCount),1),r.createElementVNode("div",o0,[r.createVNode(Ci,{onClick:r.withModifiers(r.unref(l).plusAmount,["stop"])},null,8,["onClick"])])]),r.createElementVNode("p",{class:"clear_count",onClick:r.withModifiers(p,["stop"])},"Убрать все"),r.createElementVNode("div",s0,[r.createVNode(an,{textButtonDefault:"Добавить",onClick:m,class:"button_add_group_modifiers"})])],64)}}}),[["__scopeId","data-v-84debd5d"]]),l0=(a,l,o)=>Math.max(l,Math.min(a,o)),c0=(a,l)=>Math.pow(a,l*5),ca=(a,l,o)=>l===0||Math.abs(l)===1/0?c0(a,o):a*l*o/(l+o*a),yi=(a,l)=>l*parseFloat(a)/100,po=(a,l,o,i=.15)=>i===0?l0(a,l,o):a<l?-ca(l-a,o-l,i)+l:a>o?+ca(a-o,o-l,i)+o:a,ln=(a,{min:l,max:o})=>l!==void 0&&a<l?l:o!==void 0&&a>o?o:a;function d0(a,l,o){const i=r.ref(0),u=r.computed(()=>a.value.map(w=>typeof w=="string"?yi(w,o.value):w)),f=r.computed(()=>Math.min(...u.value)),m=r.computed(()=>Math.max(...u.value)),p=r.computed(()=>{const w=u.value.reduce((x,C)=>Math.abs(C-l.value)<Math.abs(x-l.value)?C:x);return u.value.indexOf(w)});return{currentSnapPointIndex:i,flattenedSnapPoints:u,minSnapPoint:f,maxSnapPoint:m,closestSnapPointIndex:p}}const xo=Xe(r.defineComponent({__name:"BottomSheet",props:{duration:{default:250},snapPoints:{},initialSnapPoint:{},blocking:{type:Boolean,default:!0},canSwipeClose:{type:Boolean,default:!0},swipeCloseThreshold:{},canBackdropClose:{type:Boolean,default:!0},expandOnContentDrag:{type:Boolean,default:!0},modelValue:{type:Boolean},teleportTo:{default:"body"},teleportDefer:{type:Boolean,default:!1},headerClass:{},contentClass:{},footerClass:{}},emits:["opened","opening-started","closed","closing-started","ready","dragging-up","dragging-down","snapped","instinctHeight","update:modelValue"],setup(a,{expose:l,emit:o}){const i=a,u=o;let f=null;const m=r.ref(0),p=r.ref(!1),w=yt.useVModel(i,"modelValue",u,{passive:!0});r.watch(w,Ie=>{Ie?ce():Ce||ge()}),r.onMounted(()=>{w.value&&ce()});const x=r.ref(),C=r.ref(null),y=r.ref(null),N=r.ref(null),O=r.ref(null),T=r.ref(i.expandOnContentDrag),{height:v}=yt.useWindowSize(),{height:D}=yt.useElementBounding(x),{height:U}=yt.useElementBounding(C),{height:M}=yt.useElementBounding(O),{height:R}=yt.useElementBounding(y),F=r.computed({get(){return ln(Math.ceil(M.value+U.value+R.value),{max:v.value})},set(Ie){[U.value,M.value,R.value]=Ie}}),G=r.ref(0),Z=r.ref(0),V=Ot.useMotionValue(0),P=Ot.useMotionValue(0),{snapPoints:L}=r.toRefs(i),re=r.computed(()=>L.value??[F.value]),{flattenedSnapPoints:Q,currentSnapPointIndex:ee,closestSnapPointIndex:X,minSnapPoint:H,maxSnapPoint:I}=d0(re,G,v);let $;function j(Ie){T.value=!0,q(Ie)}function q(Ie){T.value&&Ie.preventDefault()}const K=Ie=>{Ie.key==="Escape"&&ge()},oe=()=>{i.canBackdropClose&&ge()};let de=!1;const ce=async()=>{var Ie;if(!de){Ce&&(Ce=!1,f&&(clearTimeout(f),f=null)),m.value++,w.value=!0,de=!0,u("opening-started");try{await r.nextTick(),await r.nextTick();const Ue=(Ie=x.value)==null?void 0:Ie.$el;if(!Ue){console.warn("[BottomSheet] sheet not ready, aborting"),w.value=!1;return}D.value=Ue.getBoundingClientRect().height;const It=Ue.querySelector("[data-vsbs-content]"),ot=Ue.querySelector("[data-vsbs-header]"),Qe=Ue.querySelector("[data-vsbs-footer]");if(F.value=[ot.getBoundingClientRect().height,It.getBoundingClientRect().height,Qe.getBoundingClientRect().height],await r.nextTick(),ee.value=Q.value.findIndex(ve=>ve===H.value),i.initialSnapPoint){const ve=i.initialSnapPoint;if(ve<0||ve>=re.value.length)return console.warn("Index out of bounds");G.value=typeof re.value[ve]=="number"?ln(re.value[ve],{max:v.value}):yi(re.value[ve],v.value)}else G.value=ln(H.value,{max:v.value});Z.value=G.value,V.jump(G.value),P.jump(G.value),requestAnimationFrame(()=>{$=Ot.animate(V,G.value,{duration:i.duration/1e3,ease:"easeInOut"}),$=Ot.animate(P,0,{duration:i.duration/1e3,ease:"easeInOut",onComplete:()=>{i.blocking&&u("opened")}})}),window.addEventListener("keydown",K)}finally{de=!1}}};let Ce=!1;const ge=()=>{Ce||(de&&(de=!1),$&&$.stop(),P.stop(),V.stop(),Ot.animate(P,G.value||500,{duration:i.duration/1e3,ease:"easeInOut"}),p.value=!1,w.value=!1,Ce=!0,u("closing-started"),window.removeEventListener("keydown",K),f&&clearTimeout(f),f=setTimeout(()=>{u("closed"),Ce=!1,f=null},i.duration))},De=Ie=>{if(re.value){if(Ie<0||Ie>=re.value.length){console.warn("Index out of bounds");return}ee.value=Ie,G.value=typeof re.value[Ie]=="number"?ln(re.value[Ie],{max:v.value}):yi(re.value[Ie],v.value),$=Ot.animate(V,G.value,{duration:i.duration/1e3,ease:"easeInOut",onComplete:()=>u("snapped",re.value.indexOf(re.value[Ie]))})}};function xe(Ie){Ie>0?u("dragging-down"):Ie<0&&u("dragging-up")}const _t=()=>{p.value=!0,G.value=D.value,Z.value=P.get(),V.jump(G.value),P.jump(Z.value)},be=async(Ie,Ue)=>{await r.nextTick(),x.value&&(Z.value<=0&&(G.value-=Ue.delta.y),G.value<=H.value&&(G.value=H.value,Z.value+=Ue.delta.y,p.value=!0,P.set(i.canSwipeClose?ln(Z.value,{min:0}):ln(po(Z.value,-D.value,0,.5),{min:0}))),V.set(ln(po(G.value,0,I.value,.25),{min:0,max:v.value})),xe(Ue.delta.y))},et=()=>{if(i.canSwipeClose){let Ie=G.value/2;i.swipeCloseThreshold&&typeof i.swipeCloseThreshold=="number"&&(Ie=i.swipeCloseThreshold),i.swipeCloseThreshold&&typeof i.swipeCloseThreshold=="string"&&i.swipeCloseThreshold.includes("%")&&(Ie=G.value*(Number(i.swipeCloseThreshold.replace("%",""))/100)),Math.abs(Z.value)>Ie&&(Z.value=G.value)}else Z.value=0;if($=Ot.animate(P,Z.value,{duration:i.duration/1e3,ease:"easeInOut"}),Z.value===G.value){Z.value=0,ge();return}ee.value=X.value,G.value=typeof re.value[X.value]=="number"?ln(re.value[X.value],{max:v.value}):yi(re.value[X.value],v.value),$=Ot.animate(V,G.value,{duration:i.duration/1e3,ease:"easeInOut",onComplete:()=>u("snapped",re.value.indexOf(re.value[X.value]))}),$=Ot.animate(P,0,{duration:i.duration/1e3,ease:"easeInOut"})},rt=(Ie,Ue)=>{if(G.value=D.value,Z.value=P.get(),$&&$.stop(),!N.value)return;const It=N.value.scrollTop===0,ot=Ue.delta.y>0,Qe=Q.value.length===1,ve=.5>Math.abs(G.value-I.value);if(Qe){if(!i.expandOnContentDrag)return T.value=!1;P.get()===0&&It&&ot&&(T.value=!0),P.get()===0&&It&&!ot&&(T.value=!1)}else{if(!i.expandOnContentDrag)return T.value=!1;p.value=!0,T.value=!0,ve&&(ot&&It&&(T.value=!0),!ot&&It&&(T.value=!1),It||(T.value=!1))}},Ve=async(Ie,Ue)=>{if(await r.nextTick(),!i.expandOnContentDrag)return T.value=!1;if(!x.value)return;Z.value===0&&T.value&&i.expandOnContentDrag&&(G.value-=Ue.delta.y),G.value<=H.value&&(G.value=H.value,T.value&&i.expandOnContentDrag&&(Z.value+=Ue.delta.y),Z.value=ln(Z.value,{min:0,max:H.value}),P.set(i.canSwipeClose?ln(Z.value,{min:0}):ln(po(Z.value,-D.value,0,.5),{min:0}))),G.value>I.value&&(G.value=I.value),G.value=ln(G.value,{max:v.value}),!(Q.value.length===1)&&G.value===I.value&&(T.value=!1),V.set(G.value),xe(Ue.delta.y)},it=()=>{if(!N.value)return;const Ie=N.value.scrollTop===0;T.value=Ie},Me=yt.useDebounceFn(Ie=>De(Ie),i.duration);return r.watch(re,(Ie,Ue)=>{if(w.value===!1||!Ie||!Ue)return;const It=Ie[ee.value],ot=Ue[ee.value];typeof It!="string"&&typeof ot!="string"&&(G.value=ln(It,{max:v.value}),It!==ot&&($=Ot.animate(V,G.value,{duration:i.duration/1e3,ease:"easeInOut"})))}),r.watch(v,()=>Me(ee.value)),l({open:ce,close:ge,snapToPoint:De}),r.onUnmounted(()=>{f&&clearTimeout(f)}),(Ie,Ue)=>(r.openBlock(),r.createBlock(r.Teleport,{to:a.teleportTo,defer:a.teleportDefer},[r.createElementVNode("div",r.mergeProps(Ie.$attrs,{"data-vsbs-container":""}),[r.createVNode(r.unref(Ot.AnimatePresence),null,{default:r.withCtx(()=>[r.unref(w)&&a.blocking?(r.openBlock(),r.createBlock(r.unref(Ot.Motion),{ref:"backdrop",key:"backdrop-"+m.value,"data-vsbs-backdrop":"",onClick:Ue[0]||(Ue[0]=It=>oe()),transition:{ease:"easeInOut",duration:a.duration/1e3},initial:{opacity:0},animate:{opacity:1},exit:{opacity:0}},null,8,["transition"])):r.createCommentVNode("",!0)]),_:1}),r.createVNode(r.unref(Ot.AnimatePresence),null,{default:r.withCtx(()=>[r.unref(w)?(r.openBlock(),r.createBlock(r.unref(Ot.Motion),{ref_key:"sheet",ref:x,exit:{opacity:0},initial:!1,key:m.value,style:r.normalizeStyle({y:r.unref(P),z:1,height:r.unref(V)}),"data-vsbs-shadow":!a.blocking,"data-vsbs-sheet-show":r.unref(w),"data-vsbs-dragging":p.value,"aria-modal":"true","data-vsbs-sheet":"",tabindex:"-1"},{default:r.withCtx(()=>[r.createVNode(r.unref(Ot.Motion),{ref_key:"sheetHeader",ref:C,"data-vsbs-header":"",onPanStart:_t,onPan:be,onPanEnd:et,onTouchmove:j,class:r.normalizeClass(a.headerClass)},{default:r.withCtx(()=>[r.renderSlot(Ie.$slots,"header",{},void 0,!0)]),_:3},8,["class"]),r.createElementVNode("div",{ref_key:"sheetScroll",ref:N,"data-vsbs-scroll":"",onScrollend:it},[r.createVNode(r.unref(Ot.Motion),{ref:"sheetContentWrapper","data-vsbs-content-wrapper":"",onPanStart:rt,onPan:Ve,onPanEnd:et,onTouchmove:q},{default:r.withCtx(()=>[r.createElementVNode("div",{ref_key:"sheetContent",ref:O,"data-vsbs-content":"",class:r.normalizeClass(a.contentClass)},[r.renderSlot(Ie.$slots,"default",{},void 0,!0)],2)]),_:3},512)],544),r.createVNode(r.unref(Ot.Motion),{ref_key:"sheetFooter",ref:y,"data-vsbs-footer":"",onPanStart:_t,onPan:be,onPanEnd:et,onTouchmove:j,class:r.normalizeClass(a.footerClass)},{default:r.withCtx(()=>[r.renderSlot(Ie.$slots,"footer",{},void 0,!0)]),_:3},8,["class"])]),_:3},8,["style","data-vsbs-shadow","data-vsbs-sheet-show","data-vsbs-dragging"])):r.createCommentVNode("",!0)]),_:3})],16)],8,["to","defer"]))}}),[["__scopeId","data-v-a8913d51"]]);function Tn(a,l=null){const o=si();o.initCacheSingle("defaultImage");const i=r.computed(()=>o.cache.defaultImage||null),u=r.shallowRef(!1),f=r.computed(()=>{var x;return((x=r.toValue(a))==null?void 0:x.toString())||null}),m=yt.computedAsync(async()=>{const x=f.value;return x?(await o.initCacheSingle(x),o.cache[x]||null):null},null,{evaluating:u}),p=r.computed(()=>u.value&&f.value!==null);return{mediaUrl:r.computed(()=>m.value||r.toValue(l)||i.value||null),isLoading:p}}const u0={class:"card_product_modifiers_sheet_body"},f0={class:"card__pictures"},h0=["src"],m0=["src"],g0={class:"card_header_wrapper"},p0={key:0,class:"card_fire_kkal_wrapper"},x0={class:"card_content"},w0={class:"wrapper_size"},_0={key:0,class:"description"},C0={key:1},E0=Xe(r.defineComponent({__name:"CardProductPage",props:{configPage:{}},setup(a){const l=Rt(),o=Lt(),{stateCard:i,isOpenWindow:u,isAddToCard:f}=we.storeToRefs(o),{itemThemes:m}=we.storeToRefs(l),p=Te.useRouter(),w=Te.useRoute(),x=a,C=r.computed(()=>!!(w.query.mode==="pdf"&&x.configPage.qr_menu)),{mediaUrl:y}=Tn(()=>{var U,M;return(U=i.value.openCard)!=null&&U.video_link?`${i.value.openCard.id}_video`:(M=i.value.openCard)!=null&&M.image_link?`${i.value.openCard.id}_image`:null},()=>{var U,M;return((U=i.value.openCard)==null?void 0:U.video_link)||((M=i.value.openCard)==null?void 0:M.image_link)||null}),N=()=>{x.configPage.qr_menu?C.value?p.push(`/${w.params.orgId}?mode=pdf`):p.push(`/${w.params.orgId}`):x.configPage.closeProduct()},O=()=>{f.value=!1,i.value.isSectionModifier=!1},T=()=>{i.value.isModifiedAmount=!1},v=r.ref(null),D=()=>{var U;(U=v.value)==null||U.addProductToCart()};return r.watch(()=>x.configPage.data,o.setCurrentCard),r.watch(()=>i.value.isSectionModifier,U=>{C.value&&document.body.classList.toggle("pdf_hidden",U)},{immediate:!0}),r.watchEffect(()=>{u.value||(u.value=x.configPage.is_closeProduct)}),r.onBeforeUnmount(()=>o.reset()),(U,M)=>{var R,F,G,Z,V,P;return r.openBlock(),r.createElementBlock("div",{class:"card_product_wrapper",style:r.normalizeStyle(C.value?"user-select: none;":"")},[r.createVNode(r.unref(xo),{modelValue:r.unref(i).isSectionModifier,"onUpdate:modelValue":M[0]||(M[0]=L=>r.unref(i).isSectionModifier=L),class:"card_product_modifiers_sheet",teleportTo:C.value?"#app":"body"},{default:r.withCtx(()=>[r.createElementVNode("div",u0,[r.createVNode(vu,{onClose:O,onAddToCart:D}),r.createVNode(aa,{isSectionModifier:r.unref(i).isSectionModifier,toggleNotRequire:r.unref(o).toggleNotRequire},null,8,["isSectionModifier","toggleNotRequire"])])]),_:1},8,["modelValue","teleportTo"]),(r.openBlock(),r.createBlock(r.Teleport,{to:"body"},[r.unref(i).isModifiedAmount?(r.openBlock(),r.createElementBlock("div",{key:0,class:"wrapper_modified_amount",onClick:r.withModifiers(T,["stop"])},[r.createVNode(a0)])):r.createCommentVNode("",!0)])),r.createElementVNode("div",f0,[(R=r.unref(i).openCard)!=null&&R.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,h0)])),[[r.unref(Xr)]]):(r.openBlock(),r.createElementBlock("img",{key:1,class:"card__pictures_images",src:r.unref(y)||"",alt:"Product image"},null,8,m0)),r.createElementVNode("div",g0,[r.createVNode(_r,{class:"card_header_back",onClick:N,"aria-label":"Вернуться назад"}),(F=r.unref(i).openCard)!=null&&F.energy_amount?(r.openBlock(),r.createElementBlock("div",p0,[M[2]||(M[2]=r.createElementVNode("div",{class:"card_fire_kkal"},null,-1)),r.createElementVNode("p",null,[r.createElementVNode("b",null,r.toDisplayString((G=r.unref(i).openCard)==null?void 0:G.energy_amount),1),M[1]||(M[1]=r.createTextVNode(" Ккал ",-1))])])):r.createCommentVNode("",!0)]),r.createElementVNode("h4",null,r.toDisplayString((Z=r.unref(i).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",x0,[r.createElementVNode("div",w0,[r.createVNode(Uu)]),(V=r.unref(i).openCard)!=null&&V.description?(r.openBlock(),r.createElementBlock("p",_0,r.toDisplayString((P=r.unref(i).openCard)==null?void 0:P.description),1)):r.createCommentVNode("",!0),r.unref(i).groupModifiers.length?(r.openBlock(),r.createElementBlock("div",C0,[M[3]||(M[3]=r.createElementVNode("p",{class:"title_info_modifiers"},"Настрой, как ты любишь",-1)),r.createVNode(aa,{isSectionModifier:r.unref(i).isSectionModifier,toggleNotRequire:r.unref(o).toggleNotRequire},null,8,["isSectionModifier","toggleNotRequire"])])):r.createCommentVNode("",!0),r.createVNode(Ku,{ref_key:"buttonPriceRef",ref:v,qr_menu:a.configPage.qr_menu,closeProduct:a.configPage.closeProduct},null,8,["qr_menu","closeProduct"])])],4)}}}),[["__scopeId","data-v-ee9ec125"]]),bi=we.defineStore("modals",()=>{const a=new Map,l=(u,f)=>{const m=i(u).value;m.visible=!0,m.context=f},o=u=>{const f=i(u).value;f.visible=!1},i=u=>(a.has(u)||a.set(u,r.ref({visible:!1})),a.get(u));return{state:i,open:l,close:o}}),y0={key:0,class:"popupWindowDefault_overlay"},da=Xe(r.defineComponent({__name:"PopupWindowDefault",props:{visible:{type:Boolean}},emits:["update:visible"],setup(a,{emit:l}){const o=a,i=l,u=()=>{i("update:visible",!1)};return r.watch(()=>o.visible,async f=>{f&&await r.nextTick(),o.isVisible=f}),(f,m)=>(r.openBlock(),r.createElementBlock(r.Fragment,null,[r.createVNode(r.Transition,{name:"popupWindowDefaultBlack",appear:"",onAfterLeave:m[0]||(m[0]=()=>{i("update:visible",!1)})},{default:r.withCtx(()=>[o.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]=()=>{i("update:visible",!1)})},{default:r.withCtx(()=>[o.visible?(r.openBlock(),r.createElementBlock("div",y0,[r.renderSlot(f.$slots,"default",{},void 0,!0)])):r.createCommentVNode("",!0)]),_:3})],64))}}),[["__scopeId","data-v-08e0e008"]]),b0=["src"],A0={class:"cart_box_content_wrapper"},S0={class:"cart_box_content_info"},I0={class:"cart_amount"},N0={class:"cart_amount_count"},T0={class:"cart_box_info_more"},k0={key:1,class:"cart_modifier_info"},R0={class:"cart_modifier_content"},B0={class:"wrapper_price_count_cart"},O0={class:"count_cart_box"},M0={class:"wrapper_modifiers_discount"},ua=Xe(r.defineComponent({__name:"CartBox",props:{index:Number,cardItem:Object},emits:["delete"],setup(a,{emit:l}){const o=a,i=st(),u=Rt(),f=bi(),{itemThemes:m}=we.storeToRefs(u),p=r.ref(0),w=r.ref(0),x=r.ref(!1),C=r.ref(!1),y=r.ref(!1),{displayNumber:N,update:O}=go(0,800),T=r.computed(()=>{var Q,ee;const L=((Q=o.cardItem)==null?void 0:Q.modifiers)??[],re=(((ee=o.cardItem)==null?void 0:ee.group_modifiers)??[]).flatMap(X=>X.modifiers??[]);return[...L,...re]}),{mediaUrl:v}=Tn(()=>{var L;return((L=o.cardItem)==null?void 0:L.id)+"_image"},()=>{var L;return(L=o.cardItem)==null?void 0:L.image_link}),D=r.computed(()=>{var L,re;return((L=o.cardItem)==null?void 0:L.total_new_price)??hr(o.cardItem)*((re=o.cardItem)==null?void 0:re.amount)}),U=()=>f.open("cart-delete-confirm",o.cardItem),M=()=>{y.value=!y.value},R=()=>{i.plusAmount(o.cardItem.idSystem)},F=()=>{o.cardItem.amount>1?i.minusAmount(o.cardItem.idSystem):U()},G=L=>{p.value=L.touches[0].clientX,x.value=!0},Z=L=>{x.value&&(w.value=L.touches[0].clientX-p.value,w.value>0&&(w.value=0))},V=()=>{x.value=!1,w.value<-115&&U(),w.value=0};r.onMounted(()=>{o.index===0&&(C.value=!0,setTimeout(()=>{w.value=-90,setTimeout(()=>{w.value=0,C.value=!1},700)},0))});const P=r.computed(()=>{const L=o.index===0&&C.value?1:`${1-Math.abs(w.value)/200}`;return{transform:`translateX(${w.value}px)`,opacity:L,transition:x.value?"none":"transform 0.7s, opacity 0.7s"}});return r.watch(D,O,{immediate:!0}),(L,re)=>{var Q,ee,X,H;return r.openBlock(),r.createElementBlock("div",{class:"cart_box_wrapper",onTouchstart:G,onTouchmove:Z,onTouchend:V,style:r.normalizeStyle(P.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,b0),r.createElementVNode("div",A0,[r.createElementVNode("div",S0,[r.createElementVNode("p",null,r.toDisplayString((Q=a.cardItem)==null?void 0:Q.name),1),(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(((ee=o.cardItem)==null?void 0:ee.discounts)||[],(I,$)=>(r.openBlock(),r.createElementBlock("div",{key:$,class:"discount_banner"},[r.createElementVNode("p",null,r.toDisplayString(I.name),1),r.createElementVNode("p",null,r.toDisplayString(I.discount)+"₽",1)]))),128)),r.createElementVNode("div",I0,[r.createElementVNode("button",{onClick:F},"-"),r.createElementVNode("p",N0,r.toDisplayString(o.cardItem.amount),1),r.createElementVNode("button",{onClick:R},"+")])]),r.createElementVNode("div",T0,[r.createElementVNode("div",{class:"cart_box_remove_item",onClick:U},[r.createVNode(la)]),(X=o.cardItem)!=null&&X.new_price?(r.openBlock(),r.createElementBlock("p",{key:0,class:r.normalizeClass({discount_new_price:(H=o.cardItem)==null?void 0:H.new_price})},r.toDisplayString((o.cardItem.new_price*o.cardItem.amount).toFixed(2)+"₽"),3)):r.createCommentVNode("",!0),r.createElementVNode("p",null,r.toDisplayString(r.unref(N).toFixed(2)+"₽"),1)])]),!y.value&&T.value.length>0?(r.openBlock(),r.createElementBlock("div",{key:0,class:"cart_modifier_toggle",onTouchstart:r.withModifiers(M,["stop"])},[...re[0]||(re[0]=[r.createElementVNode("p",{class:"cart_info_more"},"Посмотреть модификаторы",-1),r.createElementVNode("p",{class:"cart_arrow"},null,-1)])],32)):r.createCommentVNode("",!0),y.value?(r.openBlock(),r.createElementBlock("div",k0,[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(T.value,I=>{var $;return r.openBlock(),r.createElementBlock("div",{class:"cart_modifier_item",key:I.id},[r.createElementVNode("div",R0,[r.createVNode(Ci,{id:"plus_orange"}),r.createElementVNode("p",null,r.toDisplayString(I.name),1)]),r.createElementVNode("div",B0,[r.createElementVNode("p",O0,r.toDisplayString(`x${I.amount}`),1),r.createElementVNode("div",M0,[I!=null&&I.new_price?(r.openBlock(),r.createElementBlock("p",{key:0,class:r.normalizeClass({discount_new_price:($=I==null?void 0:I.new_price)==null?void 0:$.toFixed(2)})},r.toDisplayString((I.new_price*I.amount).toFixed(2)+"₽"),3)):r.createCommentVNode("",!0),r.createElementVNode("p",null,r.toDisplayString((I.total_new_price??I.price*I.amount).toFixed(2)+"₽"),1)])])])}),128)),r.createElementVNode("div",{class:"cart_modifier_arrow",onTouchstart:r.withModifiers(M,["stop"])},[...re[1]||(re[1]=[r.createElementVNode("p",{class:"cart_info_more"},"Скрыть",-1),r.createElementVNode("p",{class:"cart_arrow_top"},null,-1)])],32)])):r.createCommentVNode("",!0)],36)}}}),[["__scopeId","data-v-b69f6323"]]),D0={},v0={class:"nfc_x",viewBox:"0 0 48 48"};function P0(a,l){return r.openBlock(),r.createElementBlock("svg",v0,[...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 L0=Xe(D0,[["render",P0]]),F0={},V0={style:{},"aria-hidden":"true",viewBox:"0 0 48 48",class:"nfc_ok"};function U0(a,l){return r.openBlock(),r.createElementBlock("svg",V0,[...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 z0=Xe(F0,[["render",U0]]),H0={key:0,class:"nfc_ok",viewBox:"0 0 48 48","aria-hidden":"true"},G0=r.defineComponent({__name:"CardReaderRetry",props:{styleRetry:{type:Boolean}},setup(a){return(l,o)=>a.styleRetry?r.createCommentVNode("",!0):(r.openBlock(),r.createElementBlock("svg",H0,[...o[0]||(o[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)])]))}}),W0={class:"sheet_header"},X0={class:"sheet_title",id:"sheetTitle"},$0={class:"sheet_body"},j0={class:"sheet_card"},q0={class:"nfc_title"},Z0={class:"lead"},Y0={class:"wrapper_input_accept"},K0={key:1},Q0={key:0,class:"card_phone_auth_wrapper"},J0={class:"sr_only","aria-live":"polite"},fa=r.defineComponent({__name:"CardReader",setup(a){const l=st(),o=Rt(),{is_OpenLoyal:i}=we.storeToRefs(l),{itemThemes:u}=we.storeToRefs(o),f=Mt(),m=r.ref(),p=r.ref(null),w=r.ref(""),x={wait:{text:"Лояльность",title:""},success:{text:"Стикер распознан",title:"Стикер распознан"},not_found:{text:"Стикер не распознан",title:"Стикер не распознали"}},C=r.computed({get:()=>w.value,set:j=>{w.value=j.replace(/\s/g,"")}}),y=r.computed(()=>f.currentState),N=r.computed(()=>f.isDrawerOpen),O=r.computed(()=>{var j;return((j=x[y.value])==null?void 0:j.text)||""}),T=r.computed(()=>{var j;(j=x[y.value])!=null&&j.title}),v=r.computed(()=>y.value==="success"?"Добро пожаловать!":u.value.kiosk_show_loyalty_phone_input_button?"Поднесите стикер к считывателю или войдите по номеру телефона":"Поднесите стикер к считывателю или введите номер карты вручную"),D=r.computed(()=>({ok:y.value==="success",warn:y.value==="not_found"})),U=r.computed(()=>{const j=[];return y.value==="wait"&&j.push("pulse","show-x"),y.value==="not_found"&&j.push("pulse","show-x"),y.value==="success"&&j.push("pulse","show-ok"),j}),M=r.computed(()=>y.value==="not_found"),R=r.computed(()=>y.value==="success"),F=r.computed(()=>y.value==="not_found"),G=r.computed(()=>["not_found"].includes(y.value)),Z=r.computed(()=>({wait:"Стикер не распознан. Нажмите «Повторить».",success:"Стикер распознан. Нажмите «Продолжить».",not_found:"Стикер не распознан. Нажмите «Повторить»."})[y.value]||""),V=()=>{f.closeDrawer(),i.value=!0},P=async j=>{var q,K;f.error="",p.value=null;try{const oe=new yn;await oe.authorizeByCard(j.trim()),await oe.getProfile(),l.loadCart(),f.setState("success"),f.isDrawerOpen=!1,f.showNotification("Вы успешно авторизовались в программе лояльности!")}catch(oe){f.error=((K=(q=oe.response)==null?void 0:q.data)==null?void 0:K.user_friendly_message)||"Ошибка",f.setState("not_found"),p.value=C.value,C.value=""}},L=r.computed(()=>{var q;const j=(q=u.value)==null?void 0:q.kiosk_hide_manual_input_loyalty_card;return j??!1}),re=()=>{f.setState("wait"),f.error="",C.value="",p.value=null},Q=()=>{f.closeDrawer(),p.value=null,C.value=""},ee=()=>{var j,q;f.setState("wait"),(q=(j=C.value)==null?void 0:j.trim())!=null&&q.length&&P(C.value.trim())},X=j=>{j.stopPropagation(),document.activeElement!==m.value&&H()},H=()=>{r.nextTick(()=>{m.value&&(m.value.focus(),w.value&&m.value.select())})},I=j=>{const q=document.activeElement===m.value;if(!N.value||q)return;const K=j.key.toLowerCase();if(K==="backspace")return C.value=C.value.slice(0,-1);if(K==="escape")return Q();if(K==="r"&&F.value)return re();if(K==="c"&&y.value==="success")return Q();if(K==="enter")return ee();C.value+=K},$={mounted(j){j==null||j.focus()}};return r.onMounted(()=>{document==null||document.addEventListener("keydown",I)}),r.onBeforeUnmount(()=>{document==null||document.removeEventListener("keydown",I)}),r.watchEffect(()=>{N.value&&(f.error="")}),(j,q)=>(r.openBlock(),r.createElementBlock(r.Fragment,null,[N.value?(r.openBlock(),r.createElementBlock("div",{key:0,class:"backdrop show",onClick:Q,"aria-hidden":"true"})):r.createCommentVNode("",!0),N.value?(r.openBlock(),r.createElementBlock("section",{key:1,class:r.normalizeClass(["sheet show",{sheet_retry:F.value}]),"aria-modal":"true","aria-labelledby":"sheetTitle",onClick:X},[r.createElementVNode("header",W0,[r.createElementVNode("div",X0,r.toDisplayString(O.value),1),F.value?(r.openBlock(),r.createElementBlock("div",{key:0,class:r.normalizeClass(["sheet_status",D.value])},r.toDisplayString(p.value),3)):r.createCommentVNode("",!0),r.createElementVNode("button",{class:"sheet_close",onClick:Q,"aria-label":"Закрыть"}," Закрыть ")]),r.createElementVNode("div",$0,[r.createElementVNode("div",j0,[r.createElementVNode("div",{class:r.normalizeClass(["nfc",U.value])},[r.createVNode(G0,{styleRetry:G.value},null,8,["styleRetry"]),M.value?(r.openBlock(),r.createBlock(L0,{key:0})):r.createCommentVNode("",!0),r.createElementVNode("div",{class:"overlay check",style:r.normalizeStyle({display:R.value?"grid":"none"}),"aria-hidden":"true"},[r.createVNode(z0)],4)],2),r.createElementVNode("h2",q0,r.toDisplayString(T.value),1),r.createElementVNode("p",Z0,r.toDisplayString(v.value),1),r.createElementVNode("div",Y0,[r.withDirectives(r.createElementVNode("input",{style:r.normalizeStyle(L.value?{position:"absolute",left:"-9999px"}:{}),ref_key:"cardInputManualRef",ref:m,"onUpdate:modelValue":q[0]||(q[0]=K=>C.value=K),class:"nfc_title_read_input",type:"text",placeholder:"Введите трек карты","aria-live":"polite",onKeydown:r.withKeys(ee,["enter"])},null,36),[[r.vModelText,C.value],[$]]),F.value?(r.openBlock(),r.createElementBlock("button",{key:0,class:"btn btn_ghost",onClick:re},"Повторить")):(r.openBlock(),r.createElementBlock("div",K0,[L.value?r.createCommentVNode("",!0):(r.openBlock(),r.createElementBlock("button",{key:0,class:"btn btn_ghost",onClick:q[1]||(q[1]=K=>F.value?Q:ee())},"Отправить"))]))]),y.value==="wait"&&r.unref(u).kiosk_show_loyalty_phone_input_button?(r.openBlock(),r.createElementBlock("div",Q0,[r.createElementVNode("button",{class:"card_phone_auth_button",onClick:V},"Войти по номеру телефона")])):r.createCommentVNode("",!0)])]),r.createElementVNode("div",J0,r.toDisplayString(Z.value),1)],2)):r.createCommentVNode("",!0)],64))}}),e1="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",t1=["src"],n1={class:"header_description"},r1=Xe(r.defineComponent({__name:"PaymentBoxes",props:{configPage:{},comment:{},cartItems:{},isAuthorized:{type:Boolean},orderId:{default:null},signal:{},provider:{}},emits:["select"],setup(a,{emit:l}){const o=a,i=l,u=Mt(),f=Lt(),{selectedProvider:m,isButtonDisabled:p}=we.storeToRefs(u),{isAddToCard:w}=we.storeToRefs(f),x={default:e1,SBP:ha},C=async()=>{m.value=o.provider;const N=o.provider.front_type;N&&(w.value=!1,p.value=!0,i("select",N),lo(o.orderId,o.provider.type))},y=r.computed(()=>x[o.provider.front_type]||x.default);return(N,O)=>(r.openBlock(),r.createElementBlock("div",{class:"payment_boxes_wrapper",onClick:C},[r.createElementVNode("img",{class:"picture",src:y.value},null,8,t1),r.createElementVNode("div",n1,[r.createElementVNode("b",null,r.toDisplayString(a.provider.name),1),r.createElementVNode("p",null,r.toDisplayString(a.provider.description),1)]),r.createVNode(_r)]))}}),[["__scopeId","data-v-c4a0ed62"]]),i1={key:0,class:"wrapper_cart_payment"},o1={class:"wrapper_paid"},s1={class:"to_be_paid"},a1=Xe(r.defineComponent({__name:"CartPayment",props:{configPage:{},comment:{},cartItems:{},isAuthorized:{type:Boolean},orderId:{},signal:{}},emits:["selectPayment"],setup(a,{emit:l}){const o=Mt(),i=st(),u=a,{totalPrice_lib:f,countBonus:m}=we.storeToRefs(i),p=l,w=C=>{p("selectPayment",C)},x=()=>{p("selectPayment","")};return(C,y)=>r.unref(o).providerTypes.length>1?(r.openBlock(),r.createElementBlock("div",i1,[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(o).providerTypes,(N,O)=>(r.openBlock(),r.createElementBlock("div",{key:O},[r.createVNode(r1,{provider:N,"config-page":u.configPage,comment:u.comment,"cart-items":u.cartItems,"is-authorized":u.isAuthorized,"order-id":u.orderId,signal:u.signal,onSelect:w},null,8,["provider","config-page","comment","cart-items","is-authorized","order-id","signal"])]))),128)),r.createElementVNode("div",o1,[r.createElementVNode("p",s1,[y[0]||(y[0]=r.createTextVNode("К оплате ",-1)),r.createVNode(ft,{price:r.unref(f)-r.unref(m),fixedFloat:2},null,8,["price"]),y[1]||(y[1]=r.createTextVNode(" ₽",-1))]),r.createVNode(an,{textButtonDefault:"Назад",onClick:x,class:"btn_payment"})])])):r.createCommentVNode("",!0)}}),[["__scopeId","data-v-f7657882"]]),l1={class:"start_page"},c1=["src"],d1={class:"wrap"},u1={class:"wrap_box"},f1={class:"title_fiscal_order"},h1={class:"wrapper_accept"},m1={ref:"barRef",class:"bar_complete","aria-hidden":"true"},g1=Xe(r.defineComponent({__name:"CartCompleteKioskSuccess",props:{mediaUrl:{},orderNumber:{}},setup(a){const l=st(),o=Mt(),i=Lt(),u=Rt(),{cartProducts_lib:f}=we.storeToRefs(l),{orderNumber:m,orderCompleted_lib:p,selectedOrderType:w}=we.storeToRefs(o),{is_startPage:x}=we.storeToRefs(i),{mediaUrl:C}=Tn(()=>u.itemThemes.kiosk_preloader?"preloader":null),y=Te.useRouter(),N=Te.useRoute();let O=null;r.onMounted(()=>{O=setTimeout(()=>{x.value=!u.itemThemes.kiosk_disable_lock_screen,w.value=null,l.isOrderTypeSubmited=!1,y.replace(`/${N.params.orgId}`)},1e4)});const T=()=>{mr(["cart","authTokensAccess","authTokensRefresh"]),f.value=[],p.value=null,w.value=null,l.isOrderTypeSubmited=!1,o.clearCard(),l.profile=null,y.replace(`/${N.params.orgId}`)};return r.onUnmounted(()=>{O&&clearInterval(O)}),(v,D)=>(r.openBlock(),r.createElementBlock("div",l1,[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,c1)])),[[r.unref(Xr)]]),D[4]||(D[4]=r.createElementVNode("div",{class:"start_img_black"},null,-1)),r.createElementVNode("div",d1,[r.createElementVNode("div",u1,[D[1]||(D[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)),D[2]||(D[2]=r.createElementVNode("h1",null," Заказ успешно оплачен ",-1)),r.createElementVNode("p",f1,"№ "+r.toDisplayString(r.unref(m)),1),D[3]||(D[3]=r.createElementVNode("p",{class:"title_fiscal_completed"},"Спасибо! Заказ передан в работу.",-1)),r.createElementVNode("div",h1,[r.createElementVNode("button",{class:"btn","aria-label":"Новый заказ",onClick:T},[D[0]||(D[0]=r.createElementVNode("span",{class:"label"},"Новый заказ",-1)),r.createElementVNode("span",m1,null,512)])])])])]))}}),[["__scopeId","data-v-79c00acf"]]),p1={};function x1(a,l){return l[0]||(l[0]=r.createStaticVNode('<div class="topProgress" aria-hidden="true" data-v-3e03a6dc><i data-v-3e03a6dc></i></div><h1 class="title_fiscal" data-v-3e03a6dc>Сейчас будет распечатан фискальный чек</h1><p class="reminder" data-v-3e03a6dc>Не забудьте <b data-v-3e03a6dc>оплатить заказ</b> после печати.</p><div class="stage" aria-hidden="true" data-v-3e03a6dc><div class="printer" data-v-3e03a6dc><div class="led" data-v-3e03a6dc></div><div class="slot" data-v-3e03a6dc></div><div class="receipt" data-v-3e03a6dc><div class="tear" data-v-3e03a6dc></div><div class="line accent" data-v-3e03a6dc></div><div class="line" data-v-3e03a6dc></div><div class="line sm" data-v-3e03a6dc></div><div class="line" data-v-3e03a6dc></div><div class="line sm" data-v-3e03a6dc></div><div class="line" data-v-3e03a6dc></div><div class="line sm" data-v-3e03a6dc></div></div></div></div>',4))}const w1=Xe(p1,[["render",x1],["__scopeId","data-v-3e03a6dc"]]),_1={},C1={class:"center"};function E1(a,l){return r.openBlock(),r.createElementBlock("div",C1,[...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 y1=Xe(_1,[["render",E1],["__scopeId","data-v-f0859fd1"]]);/*!
5
+ `):" "+js(m[0]):"as no adapter specified";throw new Le("There is no suitable adapter to dispatch the request "+p,"ERR_NOT_SUPPORT")}return u}const qs={getAdapter:bd,adapters:oo};function so(a){if(a.cancelToken&&a.cancelToken.throwIfRequested(),a.signal&&a.signal.aborted)throw new xr(null,a)}function Zs(a){return so(a),a.headers=Qt.from(a.headers),a.data=io.call(a,a.transformRequest),["post","put","patch"].indexOf(a.method)!==-1&&a.headers.setContentType("application/x-www-form-urlencoded",!1),qs.getAdapter(a.adapter||zr.adapter,a)(a).then(function(s){return so(a),s.data=io.call(a,a.transformResponse,s),s.headers=Qt.from(s.headers),s},function(s){return Ds(s)||(so(a),s&&s.response&&(s.response.data=io.call(a,a.transformResponse,s.response),s.response.headers=Qt.from(s.response.headers))),Promise.reject(s)})}const Ys="1.13.2",pi={};["object","boolean","number","function","string","symbol"].forEach((a,l)=>{pi[a]=function(s){return typeof s===a||"a"+(l<1?"n ":" ")+a}});const Ks={};pi.transitional=function(l,i,s){function u(f,m){return"[Axios v"+Ys+"] Transitional option '"+f+"'"+m+(s?". "+s:"")}return(f,m,p)=>{if(l===!1)throw new Le(u(m," has been removed"+(i?" in "+i:"")),Le.ERR_DEPRECATED);return i&&!Ks[m]&&(Ks[m]=!0,console.warn(u(m," has been deprecated since v"+i+" and will be removed in the near future"))),l?l(f,m,p):!0}},pi.spelling=function(l){return(i,s)=>(console.warn(`${s} is likely a misspelling of ${l}`),!0)};function Ad(a,l,i){if(typeof a!="object")throw new Le("options must be an object",Le.ERR_BAD_OPTION_VALUE);const s=Object.keys(a);let u=s.length;for(;u-- >0;){const f=s[u],m=l[f];if(m){const p=a[f],_=p===void 0||m(p,f,a);if(_!==!0)throw new Le("option "+f+" must be "+_,Le.ERR_BAD_OPTION_VALUE);continue}if(i!==!0)throw new Le("Unknown option "+f,Le.ERR_BAD_OPTION)}}const xi={assertOptions:Ad,validators:pi},In=xi.validators;let tr=class{constructor(l){this.defaults=l||{},this.interceptors={request:new Rs,response:new Rs}}async request(l,i){try{return await this._request(l,i)}catch(s){if(s instanceof Error){let u={};Error.captureStackTrace?Error.captureStackTrace(u):u=new Error;const f=u.stack?u.stack.replace(/^.+\n/,""):"";try{s.stack?f&&!String(s.stack).endsWith(f.replace(/^.+\n.+\n/,""))&&(s.stack+=`
6
+ `+f):s.stack=f}catch{}}throw s}}_request(l,i){typeof l=="string"?(i=i||{},i.url=l):i=l||{},i=er(this.defaults,i);const{transitional:s,paramsSerializer:u,headers:f}=i;s!==void 0&&xi.assertOptions(s,{silentJSONParsing:In.transitional(In.boolean),forcedJSONParsing:In.transitional(In.boolean),clarifyTimeoutError:In.transitional(In.boolean)},!1),u!=null&&(ne.isFunction(u)?i.paramsSerializer={serialize:u}:xi.assertOptions(u,{encode:In.function,serialize:In.function},!0)),i.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?i.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:i.allowAbsoluteUrls=!0),xi.assertOptions(i,{baseUrl:In.spelling("baseURL"),withXsrfToken:In.spelling("withXSRFToken")},!0),i.method=(i.method||this.defaults.method||"get").toLowerCase();let m=f&&ne.merge(f.common,f[i.method]);f&&ne.forEach(["delete","get","head","post","put","patch","common"],N=>{delete f[N]}),i.headers=Qt.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 N=[Zs.bind(this),void 0];for(N.unshift(...p),N.push(...x),I=N.length,C=Promise.resolve(i);y<I;)C=C.then(N[y++],N[y++]);return C}I=p.length;let O=i;for(;y<I;){const N=p[y++],v=p[y++];try{O=N(O)}catch(k){v.call(this,k);break}}try{C=Zs.call(this,O)}catch(N){return Promise.reject(N)}for(y=0,I=x.length;y<I;)C=C.then(x[y++],x[y++]);return C}getUri(l){l=er(this.defaults,l);const i=Fs(l.baseURL,l.url,l.allowAbsoluteUrls);return ks(i,l.params,l.paramsSerializer)}};ne.forEach(["delete","get","head","options"],function(l){tr.prototype[l]=function(i,s){return this.request(er(s||{},{method:l,url:i,data:(s||{}).data}))}}),ne.forEach(["post","put","patch"],function(l){function i(s){return function(f,m,p){return this.request(er(p||{},{method:l,headers:s?{"Content-Type":"multipart/form-data"}:{},url:f,data:m}))}}tr.prototype[l]=i(),tr.prototype[l+"Form"]=i(!0)});let Sd=class ll{constructor(l){if(typeof l!="function")throw new TypeError("executor must be a function.");let i;this.promise=new Promise(function(f){i=f});const s=this;this.promise.then(u=>{if(!s._listeners)return;let f=s._listeners.length;for(;f-- >0;)s._listeners[f](u);s._listeners=null}),this.promise.then=u=>{let f;const m=new Promise(p=>{s.subscribe(p),f=p}).then(u);return m.cancel=function(){s.unsubscribe(f)},m},l(function(f,m,p){s.reason||(s.reason=new xr(f,m,p),i(s.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(l){if(this.reason){l(this.reason);return}this._listeners?this._listeners.push(l):this._listeners=[l]}unsubscribe(l){if(!this._listeners)return;const i=this._listeners.indexOf(l);i!==-1&&this._listeners.splice(i,1)}toAbortSignal(){const l=new AbortController,i=s=>{l.abort(s)};return this.subscribe(i),l.signal.unsubscribe=()=>this.unsubscribe(i),l.signal}static source(){let l;return{token:new ll(function(u){l=u}),cancel:l}}};function Id(a){return function(i){return a.apply(null,i)}}function Nd(a){return ne.isObject(a)&&a.isAxiosError===!0}const ao={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(ao).forEach(([a,l])=>{ao[l]=a});function Qs(a){const l=new tr(a),i=ms(tr.prototype.request,l);return ne.extend(i,tr.prototype,l,{allOwnKeys:!0}),ne.extend(i,l,null,{allOwnKeys:!0}),i.create=function(u){return Qs(er(a,u))},i}const Ze=Qs(zr);Ze.Axios=tr,Ze.CanceledError=xr,Ze.CancelToken=Sd,Ze.isCancel=Ds,Ze.VERSION=Ys,Ze.toFormData=fi,Ze.AxiosError=Le,Ze.Cancel=Ze.CanceledError,Ze.all=function(l){return Promise.all(l)},Ze.spread=Id,Ze.isAxiosError=Nd,Ze.mergeConfig=er,Ze.AxiosHeaders=Qt,Ze.formToJSON=a=>Os(ne.isHTMLForm(a)?new FormData(a):a),Ze.getAdapter=qs.getAdapter,Ze.HttpStatusCode=ao,Ze.default=Ze;const{Axios:np,AxiosError:rp,CanceledError:ip,isCancel:op,CancelToken:sp,VERSION:ap,all:lp,Cancel:cp,isAxiosError:dp,spread:up,toFormData:fp,AxiosHeaders:hp,HttpStatusCode:mp,formToJSON:gp,getAdapter:pp,mergeConfig:xp}=Ze,Gr=_e.defineStore("modulesLib",()=>{const a=r.ref(!1),l=r.ref({textNotification:""});return{is_notification_lib:a,notificationData_lib:l,showNotification:s=>{a.value=!0,l.value.textNotification=s}}}),Td=["ping","pong"],kd=["confirmed","waiting_payment","partial_paid"],Rd=["cancelled"],Fn=_e.defineStore("table-data",()=>{const a=Te.useRoute(),l=Te.useRouter(),i=st(),s=Gr(),u=r.ref(1),f=r.ref(1),m=_t.useLocalStorage("appMode",null,{shallow:!0}),p=_t.useLocalStorage("tableData",null,{shallow:!0,serializer:_t.StorageSerializers.object}),_=_t.useLocalStorage("tableId",null),x=_t.useLocalStorage("orgID",null),C=r.computed({get:()=>{var L;return(L=k.value)==null?void 0:L.id},set:L=>{_.value=L}}),y=r.computed(()=>{var L;return(L=a.query.table_id)==null?void 0:L.toString()}),I=r.computed(()=>{var L;return x.value||((L=a.params.orgId)==null?void 0:L.toString())}),O=r.computed(()=>{var L;return((L=k.value)==null?void 0:L.branch.work_mode)==="table-service"}),N=r.computed(()=>{var L;return O.value&&!!((L=k.value)!=null&&L.order)});let v=null;const k=_t.computedAsync(async L=>{var Q,te,G;u.value;const V=new AbortController;if(L(()=>V.abort()),!I.value||!((Q=i.config_lib)!=null&&Q.area))return null;const ie=y.value||_.value;if(!ie)return null;try{return{...(await Ze.get(`/org_unit/${I.value}/table/${ie}/`,{baseURL:`https://${i.config_lib.area}/api/`,signal:V.signal})).data,__v:u.value}}catch(z){return Ze.isCancel(z)?null:m.value==="table-tent"?p.value:ie===(v==null?void 0:v.id)?v:(v=null,s.showNotification(((G=(te=z==null?void 0:z.response)==null?void 0:te.data)==null?void 0:G.user_friendly_message)||"Ошибка при загрузке данных стола"),null)}},null),P=_t.computedAsync(async L=>{var ie;f.value;const V=new AbortController;if(L(()=>V.abort()),!O.value||!((ie=k.value)!=null&&ie.order))return null;try{const Q=await Ze.get(`/order/${k.value.order}/`,{baseURL:`https://${i.config_lib.area}/api/`,signal:V.signal});return Q.data.items=Q.data.items.map(te=>({...te,idSystem:crypto.randomUUID()})),{...Q.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",V=>{Td.includes(V==null?void 0:V.type)||((V==null?void 0:V.method)==="update_order_status"&&Rd.includes(V.params.status)&&s.showNotification("Ваш заказ был отменён"),W())}),D.connect())},q=()=>{u.value++},W=()=>{f.value++},Y=L=>{L&&(v=L,m.value==="table-tent"&&(p.value=L),_.value!==L.id&&(_.value=L.id))},F=(L,V)=>{var ie,Q;if((L==null?void 0:L.id)!==(V==null?void 0:V.id)&&M(L),L&&!kd.includes(L.status)&&q(),!L&&V&&((ie=V.table)==null?void 0:ie.id)===((Q=k.value)==null?void 0:Q.id))return l.replace({name:"order-ts-status",params:{id:V.id}})};return r.watch(P,F,{immediate:!0}),r.watch(k,Y,{immediate:!0}),{id:C,isTableService:O,hasOrder:N,data:k,order:P,refresh:q,refreshOrder:W}});let Nn=null,jt=null;function nr(a){a&&a.close(!0)}async function lo(a,l){const i=Mt(),s=st(),u=yn.create();try{const f=await u.initPaymentLink(a,l);return i.paymentCostQR=s.totalPrice_lib-s.countBonus,i.linkQR=f.url,jt==null||jt.deleteCart(null,jt==null?void 0:jt.is_requestKiosk),f}catch(f){throw i.isButtonDisabled=!1,i.showNotification(f==null?void 0:f.response.data.user_friendly_message),f}}function Bd(a,l,i){const s=St();if(a!=null&&a.params){if(a.params.status==="sent"&&s.itemThemes.kiosk_proceed_to_payment_text&&l.showNotification(s.itemThemes.kiosk_proceed_to_payment_text),a.error){l.showNotification(a.error),hn(l,null),uo(l);return}i(a,l)}}function co(a,l){const i=Mt(),s=st();return a.params.new_discounts&&(i.extraDiscount=Number(a.params.new_total_cost)-l.initialCartPrice,s.totalPrice_lib=Number(a.params.new_total_cost),l.showNotification("К заказу были добавлены скидки")),!0}const hn=(a,l)=>{a.updateOrderStatus&&a.updateOrderStatus(l)},Od=a=>{a.loadCart&&a.loadCart()},_i=a=>{a.resetBonuses&&a.resetBonuses()},Md=a=>{a.resetDiscounts&&a.resetDiscounts()},uo=a=>{a.closeWebSocket&&a.closeWebSocket()},Js=(a,l,i,s)=>{var m;if(((m=a.params)==null?void 0:m.need_pay)===!1)return;const u=l.ws||i;yn.create().orderPay(a.params.order_id||"").then(p=>{l.setOrderNumber&&l.setOrderNumber(p.data.order_number)}).catch(p=>{(l.errorHandler||s).handleOrderPayError(p,{...l,closeWebSocket:()=>nr(u)})})},fo=(a,l,i)=>{const s=a.ws||l;(a.errorHandler||i).handleOrderError({...a,closeWebSocket:()=>nr(s)})},Dd=(a,l)=>{const i=Mt(),s=i.getCurrentPaymentMethodId();if(!s||!Vn.getConfig(s)||!Vn.isMethodAvailable(s,a))return null;const f=Vn.createHandler(s);if(!f)return null;const m=i.createPaymentHandler(a,l,s);return m?{handler:f,config:m.config}:null},vd=a=>{if(!jt)return;const l=jt.context,i=jt.is_requestKiosk,s=Dd(l,i);if(!s){console.warn("handleWebSocketMessageWithDynamicHandler: не удалось получить handler");return}const{handler:u,config:f}=s,m={...f,...jt};Bd(a,m,u.handleWebSocketStatus)};async function Pd(a,l,i){var x,C;const s=Fn(),{is_requestKiosk:u}=l,{comment:f,is_authorized:m,signal:p}=i;l.setButtonDisabled(!0);const _=yn.create();try{const y=await _.createOrder(a,s.id,u,f,m,p);if((y==null?void 0:y.status)===201&&((x=y==null?void 0:y.data)!=null&&x.id)){const I=y.data.id,O={...l,signal:p};jt=O;const v=`wss://${O.area||""}/ws/order/${I}/`;Nn=Lr(v,{signal:p});const k=()=>{console.warn("WebSocket connection opened (centralized mode)")},P=M=>{var q;console.error("WebSocket error (centralized mode):",M),nr(Nn),Nn=null,jt=null,l.setButtonDisabled(!1),(q=l.errorHandler)==null||q.handlePaymentError(M,O)},D=M=>{vd(M)};Nn.on("open",k),Nn.on("message",D),Nn.on("error",P),Nn.connect(),jt.ws=Nn,jt.closeWebSocket=()=>{nr(Nn),Nn=null,jt=null}}return y}catch(y){throw Ze.isCancel(y)||((C=l.errorHandler)==null||C.handleCreateOrderError(y,l),l.setButtonDisabled(!1)),y}}const ea=a=>{var l,i;return((i=(l=a==null?void 0:a.response)==null?void 0:l.data)==null?void 0:i.user_friendly_message)||null};function wi(){const a=Mt(),l=Fn();return{handlePaymentError(i,s){var f,m,p,_,x,C;const u=ea(i);hn(s,null),Od(s),u?(s.showNotification(u),uo(s),s.is_requestKiosk&&((m=s.orderErrors)!=null&&m.includes((f=i.response)==null?void 0:f.status))&&(s.cartCleanup?s.cartCleanup.cleanupAndNavigate("retryPage",s.is_requestKiosk):s.deleteCart("retryPage",s.is_requestKiosk),s.ws.close(!0)),l.isTableService?s.resetStores():(_i(s),s.context==="qr"&&s.navigation?s.navigation.redirectToError():s.context==="qr"&&s.redirect&&(a.isButtonDisabled=!1,s.redirect(`/${((_=(p=s.route)==null?void 0:p.params)==null?void 0:_.orgId)||""}/errorPayment`)))):s.context==="qr"&&(_i(s),s.navigation?s.navigation.redirectToError():s.redirect&&s.redirect(`/${((C=(x=s.route)==null?void 0:x.params)==null?void 0:C.orgId)||""}/errorPayment`)),a.isButtonDisabled=!1},handleOrderPayError(i,s){var f,m,p,_;const u=ea(i);u&&(s.showNotification(u),uo(s),s.is_requestKiosk?((m=s.orderErrors)!=null&&m.includes((f=i.response)==null?void 0:f.status)&&(s.cartCleanup.cleanupAndNavigate("retryPage",s.is_requestKiosk),s.deleteCart("retryPage",s.is_requestKiosk)),hn(s,null)):(_i(s),s.navigation?s.navigation.redirectToError():s.redirect&&s.redirect(`/${((_=(p=s.route)==null?void 0:p.params)==null?void 0:_.orgId)||""}/errorPayment`),hn(s,null)))},handleOrderError(i){var s,u;i.is_requestKiosk?(i.cartCleanup?i.cartCleanup.cleanupAndNavigate("retryPage",i.is_requestKiosk):i.deleteCart("retryPage",i.is_requestKiosk),i.ws.close(!0)):l.isTableService?(a.isCreateButtonVisible=!0,i.showNotification("Ошибка создания заказа. Пожалуйста, попробуйте еще раз"),Md(i)):(_i(i),i.navigation?i.navigation.redirectToError():i.redirect&&(a.isButtonDisabled=!1,i.redirect(`/${((u=(s=i.route)==null?void 0:s.params)==null?void 0:u.orgId)||""}/errorPayment`)))},handleCreateOrderError(i,s){var m,p,_,x,C,y;const{is_requestKiosk:u}=s,f=s.route.params.orgId;u?(((m=i==null?void 0:i.response)==null?void 0:m.status)===403&&((p=s.on403Kiosk)==null||p.call(s),(_=s.redirect)==null||_.call(s,`/${f}/retryPage`)),s.deleteCart("retryPage",u)):l.isTableService?s.showNotification(((C=(x=i==null?void 0:i.response)==null?void 0:x.data)==null?void 0:C.user_friendly_message)||"Ошибка создания заказа"):(y=s.redirect)==null||y.call(s,`/${f}/errorPayment`)}}}const Ld=()=>{const a=Mt();let l=null;const i=wi(),s=(u,f)=>{var p,_,x,C;const m=(p=u.params)==null?void 0:p.status;if((_=u.params)!=null&&_.number&&(a.orderNumber=(x=u.params)==null?void 0:x.number),m==="sent")co(u,f),a.isButtonDisabled=!1;else if(m==="waiting_for_fiscalization")hn(f,1);else if(m==="payment_initiation_retry"||m==="fiscalized")Js(u,f,l,i);else if(m==="payment_initiation")hn(f,2);else if(m==="paid"){hn(f,3);const y=f.ws||l;nr(y),localStorage.removeItem("cart")}else(C=f.orderErrors)!=null&&C.includes(m)&&fo(f,l,i)};return{handleWebSocketStatus(u,f){s(u,f)}}};function Fd(){const a=Mt();let l=null;const i=wi(),s=(u,f)=>{var p,_,x,C;const m=(p=u.params)==null?void 0:p.status;if((_=u.params)!=null&&_.number&&(a.orderNumber=(x=u.params)==null?void 0:x.number),m==="sent")co(u,f),a.isButtonDisabled=!1;else if(m==="sent_fiscalization")hn(f,1);else if(m==="waiting_payment")hn(f,4);else if(m==="paid"){hn(f,3);const y=f.ws||l;nr(y),localStorage.removeItem("cart")}else(C=f.orderErrors)!=null&&C.includes(m)&&(a.isButtonDisabled=!1,fo(f,l,i))};return{handleWebSocketStatus(u,f){s(u,f)}}}const Vd=()=>{const a=Mt();let l=null;const i=wi(),s=(u,f)=>{var p,_;const m=(p=u.params)==null?void 0:p.status;if(m==="sent")co(u,f),a.isButtonDisabled=!1;else if(m==="payment_initiation_retry"||m==="fiscalized")Js(u,f,l,i);else if(m==="payment_initiation")hn(f,2);else if(m==="paid"){hn(f,3);const x=f.ws||l;nr(x),localStorage.removeItem("cart")}else(_=f.orderErrors)!=null&&_.includes(m)&&(a.isButtonDisabled=!1,fo(f,l,i))};return{handleWebSocketStatus(u,f){s(u,f)}}};class Vn{static initialize(){this.register({id:"TERMINAL_BASE",method:"TERMINAL",handlerFactory:Ld,availableContexts:["kiosk"]}),this.register({id:"YOOKASSA_BASE",method:"YOOKASSA",handlerFactory:Vd,availableContexts:["qr","tableservice"]}),this.register({id:"SBP",method:"YOOKASSA",handlerFactory:Fd,availableContexts:["kiosk"]})}static register(l){this.methods.set(l.id,l)}static getConfig(l){return this.methods.get(l)??null}static getAvailableMethods(l){return Array.from(this.methods.entries()).filter(([i,s])=>s.availableContexts.includes(l)).map(([i])=>i)}static isMethodAvailable(l,i){const s=this.getConfig(l);return s?s.availableContexts.includes(i):!1}static createHandler(l){const i=this.getConfig(l);return i?i.handlerFactory():(console.warn(`PaymentMethodRegistry: метод оплаты ${l} не зарегистрирован`),null)}}Re(Vn,"methods",new Map),Vn.initialize();function Ud(a){return{cleanupAndNavigate(l,i){a.deleteCart(l,i)},cleanup(l){a.deleteCart(null,l)},clearTokens(){a.deleteCart(null,!0)},resetStores(){a.resetStores()}}}function zd(a){var i,s;const l=((s=(i=a.route)==null?void 0:i.params)==null?void 0:s.orgId)||"";return{redirectToError(){const u=`/${l}/errorPayment`;a.redirect?a.redirect(u):a.router&&a.router.push(u)},redirectToSuccess(u){const f=u?`/${l}/${u}`:`/${l}/profile`;a.redirect?a.redirect(f):a.router&&a.router.push(f)},redirect(u){a.redirect?a.redirect(u):a.router&&a.router.push(u)},getErrorPath(){return`/${l}/errorPayment`},getSuccessPath(){return`/${l}/profile`}}}const Mt=_e.defineStore("cartLib",()=>{const a=Te.useRouter(),l=Te.useRoute(),i=St(),s=st(),{config_lib:u,countBonus:f,totalPrice_lib:m,initialCartPrice_lib:p,is18Allowed:_}=_e.storeToRefs(s),{itemThemes:x}=_e.storeToRefs(i),C=r.ref(!1),y=r.ref(""),I=r.ref(null),O=r.ref("wait"),N=r.ref(!0),v=r.ref(0),k=r.ref(""),P=r.ref([]),D=r.ref([]),M=r.ref(),q=r.ref(0),W=r.ref(!1),Y=r.ref(),F=r.ref(null),L=r.ref(["failed_payment","failed_after_paid","failed","failed_after_sent","failed_after_sent_fiscalization","payment_initiation_retry","cancelled","failed_after_payment_initiation"]),V=r.ref(),ie=r.computed({get:()=>P.value||[],set:be=>{(be==null?void 0:be.length)===1&&(V.value=be[0]),P.value=be}}),Q=r.ref(!1),te=r.ref(null),G=r.ref(0),z=r.ref(!1),T=r.ref({textNotification:""}),X=be=>{z.value=!0,T.value.textNotification=be},$=()=>{var be,et;return(be=M.value)!=null&&be.front_type?M.value.front_type:((et=D.value[0])==null?void 0:et.front_type)||null},j=(be,et,rt)=>{var Ie;const Ve=rt??((Ie=D.value[0])==null?void 0:Ie.front_type);if(!Ve)return console.warn("Не удалось определить метод оплаты"),null;const it=Vn.getConfig(Ve);if(!it||!Vn.isMethodAvailable(Ve,be))return console.warn(`Метод ${Ve} недоступен для контекста ${be}`),null;const Me=Vn.createHandler(Ve);return Me?(Y.value=Z(it.method,be,et),{handler:Me,config:Y.value}):(console.warn(`Не удалось создать обработчик для метода ${Ve}`),null)},Z=(be,et,rt)=>{const Ve={method:be,context:et,is_requestKiosk:rt,router:a,route:l,orderErrors:L.value,area:u.value.area,totalPrice:m,initialCartPrice:p,showNotification:X,deleteCart:Ct,resetStores:xe,redirect:Ue=>a.push(Ue),updateOrderStatus:Ue=>{te.value=Ue},setOrderNumber:Ue=>{F.value=Ue},loadCart:()=>s.loadCart(),resetBonuses:()=>{f.value=0}},it=wi(),Me=Ud(Ve),Ie=zd(Ve);return{...Ve,errorHandler:it,cartCleanup:Me,navigation:Ie}},ee=r.computed(()=>!!I.value),de=be=>{O.value=be},ce=be=>{I.value=be},Ce=()=>{x.value.kiosk_show_loyalty_card_button&&x.value.kiosk_show_loyalty_phone_input_button?C.value=!0:!x.value.kiosk_show_loyalty_card_button&&x.value.kiosk_show_loyalty_phone_input_button?s.is_OpenLoyal=!0:C.value=!0,O.value="wait",y.value=""},ge=()=>{C.value=!1,O.value="wait",y.value=""},De=()=>{I.value=null,y.value="",O.value="wait",ge()},xe=()=>{Q.value=!1,te.value=null},Ct=(be=null,et=!1)=>{s.cartProducts_lib=[],s.is_OpenLoyal=!1,mr(["cart"]),et&&(mr(["authTokensAccess","authTokensRefresh","user"]),s.profile=null,sessionStorage.removeItem("is_adult"),_.value=!1),be&&a.push(`/${l.params.orgId}/${be}`)};return{isButtonDisabled:Q,orderCompleted_lib:te,extraDiscount:v,orderNumber:F,is_notification_lib:z,notificationData_lib:T,count:G,guestInfo:I,error:y,isDrawerOpen:C,currentState:O,isAuthorized:ee,isCreateButtonVisible:N,linkQR:k,orderTypes:ie,providerTypes:D,is_paymentCart:W,selectedOrderType:V,selectedProvider:M,configPayment:Y,paymentCostQR:q,deleteCart:Ct,setGuestInfo:ce,setState:de,openDrawer:Ce,closeDrawer:ge,clearCard:De,showNotification:X,createPaymentHandler:j,getCurrentPaymentMethodId:$,getAvailablePaymentMethods:be=>Vn.getAvailableMethods(be)}}),Lt=_e.defineStore("cardLib",()=>{var te;const a=()=>({openCard:null,currentModifier:null,groupModifiers:[],groupModifiersSelected:[],groupCurrentOpen:null,isModifiedAmount:!1,selectedSize:{},productSizes:[],addedProducts:[],plusButtonsRefs:[],modalCount:1,isSectionModifier:!1,isAnimationFly:!0,textErrorRequaired:"",prevLast:{}}),l=St(),i=r.ref(a()),s=()=>i.value=a(),u=r.ref(!1),f=r.ref(!1),m=r.ref(!1),p=r.ref(),_=r.ref([]),x=r.ref({id:null,visible:!1}),C=r.ref(!((te=l.itemThemes)!=null&&te.kiosk_disable_lock_screen)),y=r.computed(()=>{const G=i.value.groupModifiersSelected.findIndex(z=>z.group===i.value.groupCurrentOpen.id);return I(G)}),I=G=>G===-1?0:(i.value.groupModifiersSelected[G].modifiers||[]).reduce((T,X)=>T+(X.amount||0),0),O=r.computed(()=>{var z;const G=(z=i.value.openCard)==null?void 0:z.group_modifiers.findIndex(T=>T.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((T,X)=>T+X.max_amount,0):i.value.groupModifiers[G].max_amount}),N=r.computed(()=>{var z;const G=(i.value.addedProducts??[]).reduce((T,X)=>T+X.price,0);if(i.value.openCard){const T=i.value.openCard,X=hr(T)||0,$=T.amount||1;return(i.value.groupModifiersSelected.reduce((Z,ee)=>(ee.modifiers.forEach(de=>{var ce,Ce;de.sizes&&(de.price=((Ce=(ce=de.sizes)==null?void 0:ce.find(ge=>ge.id===i.value.selectedSize.id))==null?void 0:Ce.price)??de.price),Z+=de.price*de.amount}),Z),0)+X)*$+G}return(z=i.value.addedProducts)!=null&&z.length?G:0}),v=r.computed(()=>{const G=i.value.groupCurrentOpen;if(!G)return!1;const z=i.value.groupModifiers,T=z.findIndex(X=>X.id===G.id);return T===-1?!1:T===z.length-1}),k=G=>{const z=i.value.groupModifiers[G],T=i.value.groupModifiersSelected[G];if(!z)return{valid:!1};if(z.min_amount>0&&I(G)<z.min_amount)return{valid:!1,errorText:`В группе "${z.name}" должно содержаться не меньше ${z.min_amount} модификатора(ов)`};if(T){for(const X of z.group_modifiers)if(X.min_amount>0){const $=T.modifiers.find(j=>j.id===X.id);if(!$||$.amount<X.min_amount)return{valid:!1,errorText:`В группе "${z.name}" выберите все обязательные модификаторы`}}}return{valid:!0}},P=r.computed(()=>{const G=i.value.groupModifiers;for(let z=0;z<G.length;z++){const T=k(z);if(!T.valid)return i.value.textErrorRequaired=T.errorText,{haveRequaire:!0,group:G[z]}}return{haveRequaire:!1,group:G[0]}}),D=()=>{i.value.groupModifiers.forEach((G,z)=>{i.value.groupCurrentOpen={...G,index:z},G.group_modifiers.forEach(T=>{T.default_amount>0&&(T.amount=T.default_amount,ie(T,!0))})})},M=G=>{i.value.addedProducts.push(G)},q=G=>{i.value.openCard=G},W=G=>{_.value=[...G]},Y=(G,z,T)=>{var $;const X=i.value.groupModifiers.findIndex(j=>j.id===G.id);if(X!==-1)if(T){const j=i.value.groupModifiers,Z=X+1;if(Z<j.length){const ee=j[Z];i.value.groupCurrentOpen={...ee,index:Z},i.value.isSectionModifier=!0}}else{const j=G.id!==(($=i.value.groupCurrentOpen)==null?void 0:$.id);i.value.groupCurrentOpen={...G,index:X},i.value.isSectionModifier=j?!0:!i.value.isSectionModifier}},F=()=>{i.value.modalCount>i.value.currentModifier.min_amount&&i.value.modalCount>=2&&(i.value.modalCount-=1)},L=()=>{i.value.groupCurrentOpen&&i.value.modalCount+y.value<O.value&&(i.value.currentModifier.max_amount===0||i.value.currentModifier.max_amount>i.value.modalCount)&&(i.value.modalCount+=1)},V=(G,z)=>{var X;const T=(X=i.value.groupCurrentOpen)==null?void 0:X.id.toUpperCase();if(!G&&!i.value.isModifiedAmount&&z.max_amount!==1){if(T==="Добавки2000"&&z.max_amount>1)return!0;if(Math.abs(O.value-y.value)>1&&T!=="Добавки2000")return!0}return!1},ie=(G,z=!1)=>{i.value.modalCount=1,i.value.currentModifier=G;const T=i.value.groupModifiersSelected.findIndex(X=>X.group===i.value.groupCurrentOpen.id);Q(T,G,z)},Q=(G,z,T)=>{var $,j,Z;let X=i.value.groupModifiersSelected;if(G===-1)V(T,z)?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:((j=i.value.groupCurrentOpen)==null?void 0:j.is_product_determining)||!1,modifier_count:((Z=i.value.currentModifier)==null?void 0:Z.amount)||0,modifiers:[{...z,amount:(z==null?void 0:z.amount)??1}]};else{const ee=i.value.groupModifiers[G].group_modifiers.findIndex(ce=>ce.id===z.id);if(X[G].modifiers.findIndex(ce=>ce.id===z.id)===-1){if(O.value===1)X[G].modifiers=[];else if(y.value>=O.value)return;V(T,z)?i.value.isModifiedAmount=!0:(X[G].modifiers.push({...z,amount:(z==null?void 0:z.amount)??1}),X[G].modifier_count=X[G].modifiers.reduce((ce,Ce)=>ce+=Ce.amount,0),i.value.isAnimationFly=!0)}else X[G].modifiers=X[G].modifiers.filter(ce=>ce.id!==z.id),X[G].modifier_count=X[G].modifiers.reduce((ce,Ce)=>ce+=Ce.amount,0),i.value.groupModifiers[G].group_modifiers[ee].amount=1,i.value.groupModifiers[G].group_modifiers[ee].default_amount=0,i.value.isAnimationFly=!1}i.value.groupModifiersSelected=X};return{stateCard:i,totalPrice_libCard:N,recountGroupTotalAmount:y,groupTotalAmount:O,isOpenWindow:u,isUpSale:f,checkedRequiredBtn:P,dataUpSale:p,productCards:_,isAddToCard:m,openProduct:x,is_startPage:C,isLastGroup:v,setProduct:W,summModifierAmount:I,setAddedProducts:M,setCurrentCard:q,minusAmount:F,plusAmount:L,toggleNotRequire:Y,modifierSelect:ie,defaultAmountModifiers:D,validateGroup:k,reset:s}});var _r=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function ta(a){return a&&a.__esModule&&Object.prototype.hasOwnProperty.call(a,"default")?a.default:a}var na={exports:{}};(function(a,l){(function(i,s){a.exports=s()})(_r,function(){var i=1e3,s=6e4,u=36e5,f="millisecond",m="second",p="minute",_="hour",x="day",C="week",y="month",I="quarter",O="year",N="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(z){var T=["th","st","nd","rd"],X=z%100;return"["+z+(T[(X-20)%10]||T[X]||T[0])+"]"}},M=function(z,T,X){var $=String(z);return!$||$.length>=T?z:""+Array(T+1-$.length).join(X)+z},q={s:M,z:function(z){var T=-z.utcOffset(),X=Math.abs(T),$=Math.floor(X/60),j=X%60;return(T<=0?"+":"-")+M($,2,"0")+":"+M(j,2,"0")},m:function z(T,X){if(T.date()<X.date())return-z(X,T);var $=12*(X.year()-T.year())+(X.month()-T.month()),j=T.clone().add($,y),Z=X-j<0,ee=T.clone().add($+(Z?-1:1),y);return+(-($+(X-j)/(Z?j-ee:ee-j))||0)},a:function(z){return z<0?Math.ceil(z)||0:Math.floor(z)},p:function(z){return{M:y,y:O,w:C,d:x,D:N,h:_,m:p,s:m,ms:f,Q:I}[z]||String(z||"").toLowerCase().replace(/s$/,"")},u:function(z){return z===void 0}},W="en",Y={};Y[W]=D;var F="$isDayjsObject",L=function(z){return z instanceof te||!(!z||!z[F])},V=function z(T,X,$){var j;if(!T)return W;if(typeof T=="string"){var Z=T.toLowerCase();Y[Z]&&(j=Z),X&&(Y[Z]=X,j=Z);var ee=T.split("-");if(!j&&ee.length>1)return z(ee[0])}else{var de=T.name;Y[de]=T,j=de}return!$&&j&&(W=j),j||!$&&W},ie=function(z,T){if(L(z))return z.clone();var X=typeof T=="object"?T:{};return X.date=z,X.args=arguments,new te(X)},Q=q;Q.l=V,Q.i=L,Q.w=function(z,T){return ie(z,{locale:T.$L,utc:T.$u,x:T.$x,$offset:T.$offset})};var te=function(){function z(X){this.$L=V(X.locale,null,!0),this.parse(X),this.$x=this.$x||X.x||{},this[F]=!0}var T=z.prototype;return T.parse=function(X){this.$d=function($){var j=$.date,Z=$.utc;if(j===null)return new Date(NaN);if(Q.u(j))return new Date;if(j instanceof Date)return new Date(j);if(typeof j=="string"&&!/Z$/i.test(j)){var ee=j.match(k);if(ee){var de=ee[2]-1||0,ce=(ee[7]||"0").substring(0,3);return Z?new Date(Date.UTC(ee[1],de,ee[3]||1,ee[4]||0,ee[5]||0,ee[6]||0,ce)):new Date(ee[1],de,ee[3]||1,ee[4]||0,ee[5]||0,ee[6]||0,ce)}}return new Date(j)}(X),this.init()},T.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()},T.$utils=function(){return Q},T.isValid=function(){return this.$d.toString()!==v},T.isSame=function(X,$){var j=ie(X);return this.startOf($)<=j&&j<=this.endOf($)},T.isAfter=function(X,$){return ie(X)<this.startOf($)},T.isBefore=function(X,$){return this.endOf($)<ie(X)},T.$g=function(X,$,j){return Q.u(X)?this[$]:this.set(j,X)},T.unix=function(){return Math.floor(this.valueOf()/1e3)},T.valueOf=function(){return this.$d.getTime()},T.startOf=function(X,$){var j=this,Z=!!Q.u($)||$,ee=Q.p(X),de=function(et,rt){var Ve=Q.w(j.$u?Date.UTC(j.$y,rt,et):new Date(j.$y,rt,et),j);return Z?Ve:Ve.endOf(x)},ce=function(et,rt){return Q.w(j.toDate()[et].apply(j.toDate("s"),(Z?[0,0,0,0]:[23,59,59,999]).slice(rt)),j)},Ce=this.$W,ge=this.$M,De=this.$D,xe="set"+(this.$u?"UTC":"");switch(ee){case O:return Z?de(1,0):de(31,11);case y:return Z?de(1,ge):de(0,ge+1);case C:var Ct=this.$locale().weekStart||0,be=(Ce<Ct?Ce+7:Ce)-Ct;return de(Z?De-be:De+(6-be),ge);case x:case N:return ce(xe+"Hours",0);case _:return ce(xe+"Minutes",1);case p:return ce(xe+"Seconds",2);case m:return ce(xe+"Milliseconds",3);default:return this.clone()}},T.endOf=function(X){return this.startOf(X,!1)},T.$set=function(X,$){var j,Z=Q.p(X),ee="set"+(this.$u?"UTC":""),de=(j={},j[x]=ee+"Date",j[N]=ee+"Date",j[y]=ee+"Month",j[O]=ee+"FullYear",j[_]=ee+"Hours",j[p]=ee+"Minutes",j[m]=ee+"Seconds",j[f]=ee+"Milliseconds",j)[Z],ce=Z===x?this.$D+($-this.$W):$;if(Z===y||Z===O){var Ce=this.clone().set(N,1);Ce.$d[de](ce),Ce.init(),this.$d=Ce.set(N,Math.min(this.$D,Ce.daysInMonth())).$d}else de&&this.$d[de](ce);return this.init(),this},T.set=function(X,$){return this.clone().$set(X,$)},T.get=function(X){return this[Q.p(X)]()},T.add=function(X,$){var j,Z=this;X=Number(X);var ee=Q.p($),de=function(ge){var De=ie(Z);return Q.w(De.date(De.date()+Math.round(ge*X)),Z)};if(ee===y)return this.set(y,this.$M+X);if(ee===O)return this.set(O,this.$y+X);if(ee===x)return de(1);if(ee===C)return de(7);var ce=(j={},j[p]=s,j[_]=u,j[m]=i,j)[ee]||1,Ce=this.$d.getTime()+X*ce;return Q.w(Ce,this)},T.subtract=function(X,$){return this.add(-1*X,$)},T.format=function(X){var $=this,j=this.$locale();if(!this.isValid())return j.invalidDate||v;var Z=X||"YYYY-MM-DDTHH:mm:ssZ",ee=Q.z(this),de=this.$H,ce=this.$m,Ce=this.$M,ge=j.weekdays,De=j.months,xe=j.meridiem,Ct=function(rt,Ve,it,Me){return rt&&(rt[Ve]||rt($,Z))||it[Ve].slice(0,Me)},be=function(rt){return Q.s(de%12||12,rt,"0")},et=xe||function(rt,Ve,it){var Me=rt<12?"AM":"PM";return it?Me.toLowerCase():Me};return Z.replace(P,function(rt,Ve){return Ve||function(it){switch(it){case"YY":return String($.$y).slice(-2);case"YYYY":return Q.s($.$y,4,"0");case"M":return Ce+1;case"MM":return Q.s(Ce+1,2,"0");case"MMM":return Ct(j.monthsShort,Ce,De,3);case"MMMM":return Ct(De,Ce);case"D":return $.$D;case"DD":return Q.s($.$D,2,"0");case"d":return String($.$W);case"dd":return Ct(j.weekdaysMin,$.$W,ge,2);case"ddd":return Ct(j.weekdaysShort,$.$W,ge,3);case"dddd":return ge[$.$W];case"H":return String(de);case"HH":return Q.s(de,2,"0");case"h":return be(1);case"hh":return be(2);case"a":return et(de,ce,!0);case"A":return et(de,ce,!1);case"m":return String(ce);case"mm":return Q.s(ce,2,"0");case"s":return String($.$s);case"ss":return Q.s($.$s,2,"0");case"SSS":return Q.s($.$ms,3,"0");case"Z":return ee}return null}(rt)||ee.replace(":","")})},T.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},T.diff=function(X,$,j){var Z,ee=this,de=Q.p($),ce=ie(X),Ce=(ce.utcOffset()-this.utcOffset())*s,ge=this-ce,De=function(){return Q.m(ee,ce)};switch(de){case O:Z=De()/12;break;case y:Z=De();break;case I:Z=De()/3;break;case C:Z=(ge-Ce)/6048e5;break;case x:Z=(ge-Ce)/864e5;break;case _:Z=ge/u;break;case p:Z=ge/s;break;case m:Z=ge/i;break;default:Z=ge}return j?Z:Q.a(Z)},T.daysInMonth=function(){return this.endOf(y).$D},T.$locale=function(){return Y[this.$L]},T.locale=function(X,$){if(!X)return this.$L;var j=this.clone(),Z=V(X,$,!0);return Z&&(j.$L=Z),j},T.clone=function(){return Q.w(this.$d,this)},T.toDate=function(){return new Date(this.valueOf())},T.toJSON=function(){return this.isValid()?this.toISOString():null},T.toISOString=function(){return this.$d.toISOString()},T.toString=function(){return this.$d.toUTCString()},z}(),G=te.prototype;return ie.prototype=G,[["$ms",f],["$s",m],["$m",p],["$H",_],["$W",x],["$M",y],["$y",O],["$D",N]].forEach(function(z){G[z[1]]=function(T){return this.$g(T,z[0],z[1])}}),ie.extend=function(z,T){return z.$i||(z(T,te,ie),z.$i=!0),ie},ie.locale=V,ie.isDayjs=L,ie.unix=function(z){return ie(1e3*z)},ie.en=Y[W],ie.Ls=Y,ie.p={},ie})})(na);var Hd=na.exports;const ra=ta(Hd),Gd=a=>{const l=Te.useRouter(),i=`${a.domain}/api/`,s=Ze.create({baseURL:i}),u=Ze.create({baseURL:i}),f=Ze.create({baseURL:i}),m=Ze.create({baseURL:i}),p=Ze.create({baseURL:i}),_=Ze.create({baseURL:i}),x=Ze.create({baseURL:i}),C=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(!(ra.unix(M).diff(ra())<3e3))return D;const W=hs("authTokensRefresh",null,"string");try{const Y=await Ze.post(`${i}user/token/refresh/`,{refresh:W.value});if(!Y.data.access)return P(),D;localStorage.setItem("authTokensAccess",JSON.stringify(Y.data.access)),v(Y.data),k(fs(Y.data.access)),D.headers={...D.headers,Authorization:`Bearer ${Y.data.access}`}}catch(Y){console.error("Failed to refresh token:",Y),P()}return D},O=D=>{D.interceptors.request.use(M=>I(C(M)),M=>Promise.reject(M))};O(f),O(p),O(x);const N=D=>{D.interceptors.request.use(M=>y(M))};N(_),N(u),N(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:s,axiosInstanceGetApiKey:u,axiosInstancePostApiKey:_}},ia=(a="themeConfig")=>{try{const l=localStorage.getItem(a);return l?JSON.parse(l):null}catch{return null}},Ge=class Ge{constructor(){Re(this,"axiosInstanceGet");Re(this,"axiosInstancePost");Re(this,"axiosInstanceAuthenticationGet");Re(this,"axiosInstanceAuthenticationPost");Re(this,"axiosInstanceGetApiKey");Re(this,"axiosInstancePostApiKey");Re(this,"axiosInstanceAuthenticationPostApiKey");Re(this,"currentUpsaleController",null);Re(this,"controller",new AbortController);this.axiosInstanceGet=Ge._axiosGet,this.axiosInstancePost=Ge._axiosPost,this.axiosInstanceGetApiKey=Ge._axiosPostApiKey,this.axiosInstancePostApiKey=Ge._axiosPostApiKey,this.axiosInstanceAuthenticationPostApiKey=Ge._axiosAuthPostApiKey,this.axiosInstanceAuthenticationGet=Ge._axiosAuthGet,this.axiosInstanceAuthenticationPost=Ge._axiosAuthPost}static create(l){return l&&!Ge._config&&Ge._initialize(l),Ge._config||console.warn("InitConnection не инициализирован"),new Ge}static _initialize(l,i=null){const s=st(),u=Lt(),{config_lib:f}=_e.storeToRefs(s),{stateCard:m,recountGroupTotalAmount:p}=_e.storeToRefs(u);Ge._config=l,Ge._cardStore=u,Ge._stateCard=m,Ge._recountGroupTotalAmount=p,f.value=l;const _=Gd(l);Ge._axiosPostApiKey=_.axiosInstanceGetApiKey,Ge._axiosPostApiKey=_.axiosInstancePostApiKey,Ge._axiosAuthPostApiKey=_.axiosInstanceAuthenticationPostApiKey,Ge._axiosGet=_.axiosInstanceGet,Ge._axiosPost=_.axiosInstancePost,Ge._axiosAuthGet=_.axiosInstanceAuthenticationGet,Ge._axiosAuthPost=_.axiosInstanceAuthenticationPost}get config(){return Ge._config}get cardStore(){return Ge._cardStore}get stateCard(){return Ge._stateCard}get recountGroupTotalAmount(){return Ge._recountGroupTotalAmount}async updateTheme(){var f,m;const l=ia(),i=St();if(l!==null){i.updateColor(l);return}const s=st(),u=await((m=this.axiosInstanceGet)==null?void 0:m.get(`org/organizations/${(f=this.config)==null?void 0:f.orgId}/design/`));s.setStateDrum(u==null?void 0:u.data.hide_barban),s.setKioskTimeout(u==null?void 0:u.data.kiosk_timeout),localStorage.setItem("themeConfig",JSON.stringify(u.data)),i.updateColor(u.data)}async getGroupByID(l){var i,s;try{const u=await((s=this.axiosInstanceGet)==null?void 0:s.get(`${(i=this.config)==null?void 0:i.pointId}/group/${l}`));return u==null?void 0:u.data}catch(u){throw console.error("Ошибка в request.ts[getGroupByID]",u),u}}async loadGroupProducts(l){var i,s;try{const u=await((s=this.axiosInstanceGet)==null?void 0:s.get(`${(i=this.config)==null?void 0:i.pointId}/products/?group=${l}`)),f=(u==null?void 0:u.data)||[];for(const m of f)m&&await Tl(m);return await this.cacheImagesInBackground(f),f}catch(u){return console.error("Ошибка загрузки группы:",u),[]}}async getGroup(){var l,i;try{const s=await((i=this.axiosInstanceGet)==null?void 0:i.get(`${(l=this.config)==null?void 0:l.pointId}/groups/`));return s==null?void 0:s.data}catch(s){return console.error("Error fetching products:",s),[]}}async fetchAndCacheAllPages(){var l,i;try{const s=((l=this.config)==null?void 0:l.pointId)||"",u=await qi(s);if(u)return u.data;const f=await((i=this.axiosInstanceGet)==null?void 0:i.get(`${s}/group/`)),m=(f==null?void 0:f.data)||[],p=[];for(const _ of m){_.products=_.products||[],await Dr(_.id,_),p.push(_);const x=await this.loadGroupProducts(_.id);_.products=x}return await this.cacheImagesInBackground(m),await Dr(s,m),p}catch(s){return console.error("fetchAndCacheAllPages error:",s),[]}}cacheImagesInBackground(l){l.forEach(i=>{var s;i.video_link&&this.loadAndCacheMedia(i.video_link,i.id+"_video"),i.image_link&&this.loadAndCacheMedia(i.image_link,i.id+"_image"),(s=i.products)==null||s.forEach(u=>{u.video_link&&this.loadAndCacheMedia(u.video_link,u.id+"_video"),u.image_link&&this.loadAndCacheMedia(u.image_link,u.id+"_image")})})}async loadAndCacheMedia(l,i){const s=await fr(i);if(s){this.dispatchImageCachedEvent(i,s);return}try{const u=await fetch(l);if(!u.ok)throw new Error("Network error");const f=await u.blob();if(f.size===0)throw new Error("Empty blob");await Zi(i,f),this.dispatchImageCachedEvent(i,f)}catch(u){console.warn(`[ImageCache] Failed for ${i}:`,u)}}dispatchImageCachedEvent(l,i){window.dispatchEvent(new CustomEvent("image-cached",{detail:{id:l,blob:i}}))}async getProduct(l=null){var i,s;if(!l)return[];try{const u=await((s=this.axiosInstanceGet)==null?void 0:s.get(`${(i=this.config)==null?void 0:i.pointId}/products/${l}`));return u==null?void 0:u.data}catch(u){return console.error("Error fetching cardProducts:",u),[]}}async getSingleProduct(l){var u;const i=st(),{config_lib:s}=_e.storeToRefs(i);try{let f=await rs(l);if(f)this._fullCardProduct(f);else{const m=await((u=this.axiosInstanceGet)==null?void 0:u.get(`${s.value.pointId}/products/${l}`));(m==null?void 0:m.status)===200&&this._fullCardProduct(m.data)}}catch(f){throw console.warn("store card[getFetchProducts]:",f),f}}_fullCardProduct(l){const i=Lt();i.stateCard.openCard={...l,amount:1},i.stateCard.groupModifiers=l.group_modifiers,l.modifiers.length>0&&i.stateCard.groupModifiers.unshift({default_amount:0,description:"",group_modifiers:l.modifiers,id:"Добавки2000",image_link:null,max_amount:1,min_amount:l.modifiers.reduce((s,u)=>s+=u.min_amount,0),name:"Добавки",required:!1}),i.stateCard.groupModifiersSelected=new Array(i.stateCard.groupModifiers.length).fill({group:"",modifiers:[],is_fake:!1,is_product_determining:!1,modifier_count:0}),i.stateCard.productSizes=l.sizes,i.defaultAmountModifiers(),l.show_recommendations&&this.productUpsale(l.id)}async getTheme(){try{this.updateTheme()}catch(l){return console.error("Error fetching products:",l),[]}}async authorizeByCard(l){var i,s;try{const u=await((s=this.axiosInstanceAuthenticationPostApiKey)==null?void 0:s.post(`${(i=this.config)==null?void 0:i.domain}/api/user/validate-card/`,{card_number:l}));return localStorage.setItem("authTokensAccess",JSON.stringify(u==null?void 0:u.data.access)),localStorage.setItem("authTokensRefresh",JSON.stringify(u==null?void 0:u.data.refresh)),u==null?void 0:u.data}catch(u){throw console.error("Ошибка авторизации:",u),u}}async getLoyalSmsCode(l){var i,s;try{const u=await((s=this.axiosInstancePostApiKey)==null?void 0:s.post(`${(i=this.config)==null?void 0:i.domain}/api/device/auth/request-otp/`,{phone:l}));return u==null?void 0:u.data}catch(u){throw console.error("Ошибка получения sms-code:",u),u}}async sendSmsCodeForAuth(l,i){var s,u;try{const f=await((u=this.axiosInstanceAuthenticationPostApiKey)==null?void 0:u.post(`${(s=this.config)==null?void 0:s.domain}/api/device/auth/`,{code:l,phone:i}));return f==null?void 0:f.data}catch(f){throw console.error("Ошибка отправки sms-code:",f),f}}async callStaff(l,i,s){var u,f,m,p;try{const _=await((m=this.axiosInstancePost)==null?void 0:m.post(`${(u=this.config)==null?void 0:u.domain}/api/org_unit/${(f=this.config)==null?void 0:f.pointId}/table/${l}/call-staff/`,{...i},s));return(p=_==null?void 0:_.data)==null?void 0:p.response_text}catch(_){throw console.error("Ошибка[callStaff]",_),_}}async confirmOrder(l){var s,u;const i=await((u=this.axiosInstancePost)==null?void 0:u.post(`/org_unit/${(s=this.config)==null?void 0:s.pointId}/confirm-order/`,{order:l}));return(i==null?void 0:i.status)===200}async createOrder(l,i,s=!0,u,f=!1,m){var N,v,k,P,D;const p=Mt(),_=f?this.axiosInstanceAuthenticationPostApiKey:this.axiosInstancePostApiKey,x=s?_:this.axiosInstanceAuthenticationPost,C=s?"/device/order/create":"/order/create",y=s?(N=this.config)==null?void 0:N.pointId:(v=this.config)==null?void 0:v.pointId,I={items:l,comment:u};return i&&(I.table=i),s&&((k=p.selectedOrderType)!=null&&k.id)&&(I.order_type_id=(P=p.selectedOrderType)==null?void 0:P.id),await(x==null?void 0:x.post(`${(D=this.config)==null?void 0:D.domain}/api/org_unit/${y}${C}`,I,{signal:m}))}async extendOrder(l){var m,p;const i=Fn();if(!i.id)throw Error("Неверный стол");if(!((m=i.data)!=null&&m.order))throw Error("Заказ не найден");const s=this.axiosInstanceAuthenticationPost,u={items:l,table:i.id},f=await(s==null?void 0:s.post(`/org_unit/${(p=this.config)==null?void 0:p.pointId}/order/${i.data.order}/extend`,u));return f==null?void 0:f.data}async initPaymentLink(l,i){var _,x,C;const s=this.axiosInstanceAuthenticationPost,u=st(),f=Fn(),m={order:l,provider_type:i};u.countBonus>0&&(m.by_bonuses=u.countBonus),f.isTableService&&((_=f.order)==null?void 0:_.remaining_amount)!==((x=f.order)==null?void 0:x.total_cost)&&(m.amount=(C=f.order)==null?void 0:C.remaining_amount),m.by_bonuses&&m.amount&&(m.amount=+(+m.amount-+m.by_bonuses).toFixed(2));const p=await(s==null?void 0:s.post("payment/init",m));return p==null?void 0:p.data}async orderPay(l){var i;return(i=this.axiosInstanceAuthenticationPostApiKey)==null?void 0:i.post(`order/${l}/pay/`,{order_id:l})}async getProfile(){var i,s;const l=await((s=this.axiosInstanceAuthenticationGet)==null?void 0:s.get(`user/current?organization=${(i=this.config)==null?void 0:i.orgId}`));if((l==null?void 0:l.status)===200){const u=st();return u.profile=l.data,u.is18Allowed=sessionStorage.getItem("is_adult")==="true",l.data}else return l}async joinLoyalty(){var i;const l=await((i=this.axiosInstanceAuthenticationGet)==null?void 0:i.post("user/join-loyalty/"));return{success:(l==null?void 0:l.status)===200}}async isPhoneExist(l,i={}){var s,u;try{const f=await((u=this.axiosInstanceGet)==null?void 0:u.get("user/check-phone",{...i,params:{organization:(s=this.config)==null?void 0:s.orgId,phone:l}}));return(f==null?void 0:f.status)===200}catch{return!1}}async sendOTP(l,i={}){var u,f;const s=await((f=this.axiosInstancePost)==null?void 0:f.post("user/check-phone",{organization:(u=this.config)==null?void 0:u.orgId,phone:l},i));return s==null?void 0:s.data}async auth(l,i={}){var u,f;return await((f=this.axiosInstancePost)==null?void 0:f.post("user/auth",{organization:(u=this.config)==null?void 0:u.orgId,...l},i))}async signup(l,i={}){var u,f;return await((f=this.axiosInstancePost)==null?void 0:f.post("user/register",{organization:(u=this.config)==null?void 0:u.orgId,...l},i))}async calculateDiscount(l,i=!0,s=!1,u){var C,y;const f=s?this.axiosInstanceAuthenticationPostApiKey:this.axiosInstancePostApiKey,m=s?this.axiosInstanceAuthenticationPost:this.axiosInstancePost,p=i?f:m,_=i?(C=this.config)==null?void 0:C.pointId:(y=this.config)==null?void 0:y.pointId,x=await(p==null?void 0:p.post(`/org_unit/${_}/cart/calculate-discount/`,l,{signal:u}));return(x==null?void 0:x.status)===200?x.data:x}async maxPayByBonuses(l,i=!0,s=!1,u){const f=st(),m=s?this.axiosInstanceAuthenticationPostApiKey:this.axiosInstancePostApiKey,p=s?this.axiosInstanceAuthenticationPost:this.axiosInstancePost,_=i?m:p,x=await(_==null?void 0:_.post("/cart/max-pay-by-bonuses/",{order_id:l},{signal:u})),C=x==null?void 0:x.data;return f.profile&&C&&"balance"in C&&(f.profile.balance=C.balance),C}async getDeviceInfo(){var s;const l=Mt(),i=await((s=this.axiosInstanceGetApiKey)==null?void 0:s.get("/device/current/"));return(i==null?void 0:i.status)===200?(l.orderTypes=i.data.order_types,l.providerTypes=i.data.payment_provider_type,i.data):i}async validateApiKey(l,i){var u,f;const s=await((f=this.axiosInstancePost)==null?void 0:f.post(`/device/org_unit/${(u=this.config)==null?void 0:u.pointId}/validate-api-key/`,{api_key:l},i));return(s==null?void 0:s.status)===200}async productUpsale(l){var f,m,p;const i=Lt(),{dataUpSale:s}=_e.storeToRefs(i);(f=this.currentUpsaleController)==null||f.abort();const u=new AbortController;this.currentUpsaleController=u;try{const _=await((p=this.axiosInstanceGet)==null?void 0:p.get(`/${(m=this.config)==null?void 0:m.pointId}/products/${l}/recommendation/`,{signal:u.signal}));u.signal.aborted||(s.value=_==null?void 0:_.data)}catch(_){if(_.name==="AbortError"||_.name==="CanceledError"){console.warn("Upsale отменён — пришёл новый запрос");return}throw console.error("Ошибка upsale:",_),_}finally{this.currentUpsaleController===u&&(this.currentUpsaleController=null)}}};Re(Ge,"_config",null),Re(Ge,"_axiosGet"),Re(Ge,"_axiosGetApiKey"),Re(Ge,"_axiosPostApiKey"),Re(Ge,"_axiosAuthPostApiKey"),Re(Ge,"_axiosPost"),Re(Ge,"_axiosAuthGet"),Re(Ge,"_axiosAuthPost"),Re(Ge,"_cardStore",null),Re(Ge,"_stateCard",null),Re(Ge,"_recountGroupTotalAmount",null);let yn=Ge;const oa=r.ref(!1),sa=r.ref(window.innerWidth),Hn=()=>{const a=r.computed({get:()=>oa.value,set:u=>{oa.value=u}}),l=r.computed(()=>a.value&&sa.value>1024),i=()=>sa.value=window.innerWidth;return r.onMounted(()=>{window.addEventListener("resize",i)}),r.onUnmounted(()=>{window.removeEventListener("resize",i)}),{isDesktop:a,shouldUseDragScroll:l,syncWithRoute:u=>{a.value=u.query.mode==="pdf"}}},Wd=r.defineComponent({__name:"UseScrollCenter",props:{axis:{},behavior:{},autoScroll:{type:Boolean},container:{},idActive:{},clearContainer:{type:Boolean}},setup(a,{expose:l}){const i=a,s=st(),u=r.ref(null),{isDesktop:f}=Hn(),m=async _=>{if(!u.value||!_)return;let x=window;i.container&&(x=typeof i.container=="string"?document.querySelector(i.container)||window:i.container);const C={behavior:i.behavior};if(i.axis==="x"){const y=x===window?window.innerWidth:x.clientWidth,I=_.offsetWidth;let O=_.offsetLeft;if(x!==window){const N=x.getBoundingClientRect();O=_.getBoundingClientRect().left-N.left+x.scrollLeft}O-=(y-I)/2,C.left=Math.max(0,O)}else{const y=x===window?window.innerHeight:x.clientHeight,I=_.offsetHeight;let O=_.offsetTop;if(x!==window){const N=x.getBoundingClientRect();O=_.getBoundingClientRect().top-N.top+x.scrollTop}O-=(y-I)/2,C.top=Math.max(0,O)}try{x===window?window.scrollTo(C):x.scrollTo(C)}catch(y){console.error("Scroll error:",y)}};r.onMounted(async()=>{if(i.autoScroll){let _=null;if(await r.nextTick(),s.activeScrolling_lib){const x=s.activeScrolling_lib.findIndex(C=>C.id===i.idActive);i.idActive?(_=document.getElementById(`scrolling${i.idActive}`),_&&x!==-1&&(s.activeScrolling_lib[x]=_)):s.activeScrolling_lib[x]&&(_=s.activeScrolling_lib[x]),m(_)}}});const p=async _=>{i.clearContainer&&(s.activeScrolling_lib=[]);const x=_.currentTarget;await r.nextTick(),s.activeScrolling_lib.includes(x)||s.activeScrolling_lib.push(x),m(x)};return l({scrollToElement:m}),(_,x)=>(r.openBlock(),r.createElementBlock("div",{ref_key:"wrapperRef",ref:u,class:r.normalizeClass(["scroll-to-wrapper",{scroll_pdf:r.unref(f)}])},[r.renderSlot(_.$slots,"default",{handleTargetClick:p},void 0,!0)],2))}}),Xe=(a,l)=>{const i=a.__vccOpts||a;for(const[s,u]of l)i[s]=u;return i},ho=Xe(Wd,[["__scopeId","data-v-e47a167d"]]),Wr={mounted(a){let l=!1,i,s,u,f,m,p=0,_=0,x=0,C=0,y=0,I=!1;const O=5;a.style.cursor="grab";const N=P=>{P.button===0&&(m&&(cancelAnimationFrame(m),m=0),l=!0,I=!1,i=P.pageX-a.offsetLeft,s=P.pageY-a.offsetTop,u=a.scrollLeft,f=a.scrollTop,x=P.pageX,C=P.pageY,y=Date.now(),p=0,_=0)},v=P=>{if(!l)return;const D=P.pageX,M=P.pageY,q=Math.abs(D-x),W=Math.abs(M-C);if(!I&&(q>O||W>O)&&(I=!0,a.style.pointerEvents="none"),I){P.stopPropagation(),P.preventDefault();const Y=Date.now(),F=Y-y;F>0&&(p=(D-x)/F*16,_=(M-C)/F*16),x=D,C=M,y=Y;const L=D-a.offsetLeft,V=M-a.offsetTop,ie=L-i,Q=V-s;a.scrollLeft=u-ie,a.scrollTop=f-Q}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",N),window.addEventListener("mousemove",v),window.addEventListener("mouseup",k),a._dragScrollCleanup=()=>{m&&cancelAnimationFrame(m),a.removeEventListener("mousedown",N),window.removeEventListener("mousemove",v),window.removeEventListener("mouseup",k),a.style.pointerEvents=""}},unmounted(a){a._dragScrollCleanup&&a._dragScrollCleanup()}},Xd={},$d={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 jd(a,l){return r.openBlock(),r.createElementBlock("svg",$d,[...l[0]||(l[0]=[r.createElementVNode("defs",null,null,-1),r.createElementVNode("path",{id:"custom_svg_color",d:"M11.83 26L11.83 14.15L0 14.15L0 11.84L11.83 11.84L11.83 0L14.15 0L14.15 11.84L26 11.84L26 14.15L14.15 14.15L14.15 26L11.83 26Z",fill:"#FF6D2E","fill-opacity":"1.000000","fill-rule":"nonzero"},null,-1)])])}const Ci=Xe(Xd,[["render",jd]]),qd=["id","onClick"],Zd={class:"modified_plus_btn"},Yd=["src"],Kd={key:2,class:"wrapper_modifier_item"},Qd={key:0,class:"modifier_item_n_wrapper"},Jd=["src"],eu={key:1,class:"modifier_plus_item"},tu=["src"],nu=["src"],aa=Xe(r.defineComponent({__name:"PlusModifier",props:{isSectionModifier:{type:Boolean},toggleNotRequire:{type:Function}},setup(a){const l=Lt(),i=St(),{stateCard:s}=_e.storeToRefs(l),{itemThemes:u}=_e.storeToRefs(i),{shouldUseDragScroll:f}=Hn(),m=r.ref([]),p=r.ref([]),_=r.ref(null),x=r.ref(null),C=r.ref(null),y=O=>{O instanceof HTMLElement&&!m.value.includes(O)&&m.value.push(O)},I=O=>{C.value=O};return r.onMounted(async()=>{await r.nextTick(),s.value.plusButtonsRefs=m.value}),r.watchEffect(()=>{p.value=s.value.groupModifiersSelected,document.body.style.overflow=""}),r.watch(()=>{var O;return(O=s.value.groupCurrentOpen)==null?void 0:O.id},async O=>{var v;if(!O)return;await r.nextTick();const N=m.value.find(k=>k.id==="scrolling"+O);N&&((v=x.value)==null||v.scrollToElement(N))}),r.onBeforeUnmount(()=>{m.value=[],s.value.plusButtonsRefs=[]}),(O,N)=>(r.openBlock(),r.createElementBlock("div",{class:r.normalizeClass({card_modified_wrapper_many:r.unref(s).groupModifiers.length>=5})},[r.unref(s).groupModifiersSelected?r.withDirectives((r.openBlock(),r.createElementBlock("div",{key:0,class:r.normalizeClass(["card_modified_wrapper",[r.unref(s).groupModifiers.length<=4?"card_modified_wrapper_center":""]]),ref_key:"scrollPlusContainer",ref:_},[r.createVNode(ho,{ref_key:"scrollCenterRef",ref:x,axis:"x",behavior:"smooth",container:_.value,autoScroll:!0,idActive:C.value,clearContainer:!0},{default:r.withCtx(({handleTargetClick:v})=>[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(r.unref(s).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:q=>{a.toggleNotRequire&&a.toggleNotRequire(k,P),I(k.id),v(q)}},[r.createElementVNode("div",Zd,[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(s).groupCurrentOpen)==null?void 0:D.id)&&a.isSectionModifier},"modified_plus_active"])},[r.createVNode(Ci,{"aria-label":`Открыть группу модификаторов ${k.name}`},null,8,["aria-label"])],2)):p.value[P].modifiers.length===1?(r.openBlock(),r.createElementBlock("div",{key:1,class:r.normalizeClass(["modified_plus_btn modified_plus_btn_solo",{modified_plus_btn_active:k.id===((M=r.unref(s).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,Yd)],2)):(r.openBlock(),r.createElementBlock("div",Kd,[p.value[P].modifiers.length>2?(r.openBlock(),r.createElementBlock("div",Qd,[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,Jd)):(r.openBlock(),r.createElementBlock("p",eu," + "+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,tu)):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,nu)):r.createCommentVNode("",!0)])]))]),r.createElementVNode("p",null,r.toDisplayString(k.name),1)],8,qd)}),128))]),_:1},8,["container","idActive"])],2)),[[r.unref(Wr),r.unref(f)?{}:!1]]):r.createCommentVNode("",!0)],2))}}),[["__scopeId","data-v-7f238435"]]),ru={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},iu=["stroke"],la=r.defineComponent({__name:"Close",props:{color:{type:String,required:!1,default:"currentColor"}},setup(a){const l=a;return(i,s)=>(r.openBlock(),r.createElementBlock("svg",ru,[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,iu)]))}}),ou={},su={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 au(a,l){return r.openBlock(),r.createElementBlock("svg",su,[...l[0]||(l[0]=[r.createElementVNode("desc",null," Created with Pixso. ",-1),r.createElementVNode("defs",null,null,-1),r.createElementVNode("circle",{id:"Ellipse 1",cx:"10.923828",cy:"10.923462",r:"10.923489",fill:"#FF6D2E","fill-opacity":"1.000000"},null,-1),r.createElementVNode("path",{id:"Vector",d:"M12.38 15.9L12.89 15.39C12.96 15.33 13 15.25 13 15.16C13 15.08 12.96 15 12.89 14.93L8.84 11L12.89 7.06C12.96 6.99 13 6.91 13 6.83C13 6.74 12.96 6.66 12.89 6.6L12.38 6.1C12.31 6.03 12.23 6 12.14 6C12.05 6 11.97 6.03 11.9 6.1L7.1 10.76C7.03 10.83 7 10.91 7 11C7 11.08 7.03 11.16 7.1 11.23L11.9 15.9C11.97 15.96 12.05 16 12.14 16C12.23 16 12.31 15.96 12.38 15.9Z",fill:"#F2F7FF","fill-opacity":"1.000000","fill-rule":"nonzero"},null,-1)])])}const wr=Xe(ou,[["render",au]]),Xr={mounted(a){a.muted=!0,a.setAttribute("muted","")}},lu=["disabled","id"],an=r.defineComponent({__name:"ButtonDefault",props:{textButtonDefault:{type:String,required:!0},disabled:{type:Boolean,default:!1},onClick:{type:Function,required:!0}},setup(a){const l=a,i=()=>{l.onClick()};return(s,u)=>(r.openBlock(),r.createElementBlock("button",{class:"buttonDefaultWrapper",disabled:a.disabled,onClick:i,id:a.disabled?"buttonDefaultDisabled":""},r.toDisplayString(a.textButtonDefault),9,lu))}}),cu={class:"notification_info"},du={key:0,class:"notification_18plus"},uu={class:"notification_18plus_image"},fu=["src"],hu={class:"notification_18plus_text"},mu={class:"notification_18plus_accept"},gu={key:1,class:"notification_text"},pu={key:0,class:"wrapper_button_accept"},Ei=r.defineComponent({__name:"NotificationWindow",props:r.mergeModels({textNotificationDefault:{},backgroundColor:{},buttonAccept:{},type:{type:Boolean},is_qr:{type:Boolean}},{visible:{default:!1},visibleModifiers:{}}),emits:["update:visible"],setup(a){const l=a,i=St(),s=st(),{is18Allowed:u,notificationData_lib:f}=_e.storeToRefs(s),{itemThemes:m}=_e.storeToRefs(i),p=r.computed(()=>l.backgroundColor||"rgba(50, 50, 50, 0.9)"),_=r.computed(()=>{var N;return!!((N=m.value)!=null&&N.kiosk_hide_menu_update_notification)});let x;const C=r.useModel(a,"visible"),y=()=>{f.value.fastAdd&&(s.addToCart(f.value.fastAdd),f.value.fastAdd=null),sessionStorage.setItem("is_adult","true"),u.value=!0,C.value=!1,f.value.callback&&(f.value.callback(),f.value.callback=null)},I=()=>{C.value=!1},O=()=>{C.value=!1,clearTimeout(x)};return r.watch([C,()=>l.textNotificationDefault,_],([N,v,k],[P,D])=>{x&&(!N||N!==P||v!==D)&&clearTimeout(x),k&&N&&(x=setTimeout(O,4e3))},{immediate:!0}),r.onUnmounted(()=>{x&&O()}),(N,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",cu,[a.type?(r.openBlock(),r.createElementBlock("div",du,[r.createElementVNode("div",uu,[r.createElementVNode("img",{src:r.unref(m).adult_disclaimer_image||r.unref(m).fallback_image,alt:"Дисклеймер"},null,8,fu)]),r.createElementVNode("div",hu,r.toDisplayString(r.unref(m).adult_disclaimer_text),1),r.createElementVNode("div",mu,[v[0]||(v[0]=r.createElementVNode("label",{for:"plus18"},"Содержащиеся в настоящем разделе материалы предназначены для лиц старше 18 лет, носят информационный характер об ассортименте товаров и не являются рекламой. ",-1)),r.createVNode(an,{textButtonDefault:"Мне есть 18",onClick:y,style:{fontSize:"1rem",padding:"6px 24px",marginLeft:"10px"}})])])):(r.openBlock(),r.createElementBlock("div",gu,[r.createTextVNode(r.toDisplayString(a.textNotificationDefault)+" ",1),(k=a.buttonAccept)!=null&&k.state?(r.openBlock(),r.createElementBlock("div",pu,[r.createVNode(an,{class:"button_accept",textButtonDefault:a.buttonAccept.text,onClick:a.buttonAccept.acceptBtn,disabled:a.buttonAccept.disabled},null,8,["textButtonDefault","onClick","disabled"])])):r.createCommentVNode("",!0)]))])],4)])):r.createCommentVNode("",!0)]}),_:1})],64))}}),xu={class:"wrapper_modifiers"},_u={class:"wrapper_nutritional_value"},wu={class:"nutritional_scheme"},Cu={key:0,class:"nutritional_parameters"},Eu={key:1,class:"nutritional_parameters"},yu={key:2,class:"nutritional_parameters"},bu={key:3,class:"nutritional_parameters"},Au={ref:"modifierBody",class:"modifier_shadow"},Su={class:"wrapper_modifiers_title"},Iu={class:"wrapper_text_count_modifiers"},Nu=["id","aria-label","onClick"],Tu={key:0,class:"counter_modifier"},ku={class:"hide_image_corners"},Ru=["src","alt"],Bu={key:1,loop:"",autoplay:"",muted:"",playsinline:"",class:"card__video"},Ou=["src"],Mu={class:"modifier_title"},Du={key:0,class:"modifier_continue_or_add_wrapper"},vu=Xe(r.defineComponent({__name:"SectionModifiers",emits:["close","add-to-cart"],setup(a,{emit:l}){const i=l,s=St(),u=Lt(),{itemThemes:f}=_e.storeToRefs(s),{stateCard:m,recountGroupTotalAmount:p,groupTotalAmount:_,isLastGroup:x}=_e.storeToRefs(u),{isDesktop:C,shouldUseDragScroll:y}=Hn(),I=r.ref(null),O=_t.useTemplateRefsList(),N=r.ref(!1),v=D=>{if(!D)return;const M=m.value.groupModifiers.findIndex(L=>L.id===m.value.groupCurrentOpen.id),q=m.value.plusButtonsRefs[M]||m.value.plusButtonsRefs[0];if(!q)return;const W=D.getBoundingClientRect(),Y=q.getBoundingClientRect(),F=D.cloneNode(!0);F.classList.add("flyer"),Object.assign(F.style,{width:`${W.width}px`,height:`${W.height}px`,left:`${W.left}px`,top:`${W.top}px`,position:"fixed",zIndex:"1000"}),document.body.appendChild(F),I.value=F,requestAnimationFrame(()=>{const L=Y.left+Y.width/3-(W.left+W.width/2),V=Y.top+Y.height/4-(W.top+W.height/2),ie=Y.width/W.width*.2;F.style.transform=`translate(${L}px, ${V}px) scale(${ie})`,F.style.opacity="0.4",F.style.transition="transform 0.5s ease, opacity 0.5s ease"}),F.addEventListener("transitionend",()=>{F.remove(),I.value=null,q.classList.add("bump"),setTimeout(()=>q.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(W=>W.id===D.id),q=u.validateGroup(M);if(!q.valid){m.value.textErrorRequaired=q.errorText,N.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(O.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 q,W,Y,F,L,V,ie,Q,te,G,z,T,X,$;return r.openBlock(),r.createElementBlock(r.Fragment,null,[(r.openBlock(),r.createBlock(r.Teleport,{to:"body"},[r.createVNode(Ei,{visible:N.value,textNotificationDefault:r.unref(m).textErrorRequaired,backgroundColor:r.unref(f).accent_color?r.unref(f).accent_color:"#FF6D2E","onUpdate:visible":M[0]||(M[0]=j=>N.value=j)},null,8,["visible","textNotificationDefault","backgroundColor"])])),r.createElementVNode("div",xu,[r.createElementVNode("div",_u,[r.createElementVNode("div",{class:r.normalizeClass(["card_header_inner_back",[(q=r.unref(m).openCard)!=null&&q.proteins_amount?"card_header_inner_back_nutrients":""]]),"aria-label":"Закрыть выбор модификаторов",onClick:M[1]||(M[1]=j=>i("close"))},[r.createVNode(wr,{class:"arrow_bottom"})],2),r.createElementVNode("div",wu,[(W=r.unref(m).openCard)!=null&&W.energy_amount?(r.openBlock(),r.createElementBlock("div",Cu,[r.createElementVNode("b",null,r.toDisplayString((Y=r.unref(m).openCard)==null?void 0:Y.energy_amount),1),M[4]||(M[4]=r.createElementVNode("p",null,"Килокалории",-1))])):r.createCommentVNode("",!0),(F=r.unref(m).openCard)!=null&&F.proteins_amount?(r.openBlock(),r.createElementBlock("div",Eu,[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),(V=r.unref(m).openCard)!=null&&V.fat_amount?(r.openBlock(),r.createElementBlock("div",yu,[r.createElementVNode("b",null,r.toDisplayString((ie=r.unref(m).openCard)==null?void 0:ie.fat_amount),1),M[6]||(M[6]=r.createElementVNode("p",null,"Жиры",-1))])):r.createCommentVNode("",!0),(Q=r.unref(m).openCard)!=null&&Q.carbohydrates_amount?(r.openBlock(),r.createElementBlock("div",bu,[r.createElementVNode("b",null,r.toDisplayString((te=r.unref(m).openCard)==null?void 0:te.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 card_header_inner_close_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]=j=>i("close"))},[r.createVNode(la,{class:"cross_bottom",color:"#FFFFFF"})],2)]),r.createElementVNode("div",Au,[r.createElementVNode("p",Su,r.toDisplayString((z=r.unref(m).groupCurrentOpen)==null?void 0:z.name),1),r.createElementVNode("p",Iu,"Выбрано "+r.toDisplayString(r.unref(p))+" из "+r.toDisplayString(r.unref(_)),1),r.withDirectives((r.openBlock(),r.createElementBlock("div",{class:r.normalizeClass((T=r.unref(m).groupModifiers.find(j=>{var Z;return j.id===((Z=r.unref(m).groupCurrentOpen)==null?void 0:Z.id)}))!=null&&T.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)||[],j=>{var Z,ee,de;return r.openBlock(),r.createElementBlock("div",{key:j.id,ref_for:!0,ref:r.unref(O).set,id:j.id,style:r.normalizeStyle({pointerEvents:r.unref(C)?"none":"auto"}),class:r.normalizeClass(["modifier_card",{hidden_modifier_card:j.default_amount===0&&((Z=r.unref(m).groupCurrentOpen)==null?void 0:Z.id)==="Добавки2000"&&j.min_amount===0&&j.max_amount===0}]),tabindex:"0",role:"button","data-clickable":"true","aria-label":`Выбрать модификатор группы ${j.name}`,onClick:ce=>r.unref(u).modifierSelect(j)},[r.createElementVNode("div",{class:r.normalizeClass([{modifier_card_active:r.unref(m).groupModifiersSelected.some(ce=>{var Ce;return ce.group===((Ce=r.unref(m).groupCurrentOpen)==null?void 0:Ce.id)&&ce.modifiers.some(ge=>ge.id===j.id)})},"wrapper_image_corners"])},[j.amount>1?(r.openBlock(),r.createElementBlock("div",Tu,r.toDisplayString(j.amount),1)):r.createCommentVNode("",!0),r.createElementVNode("div",ku,[j.video_link?r.withDirectives((r.openBlock(),r.createElementBlock("video",Bu,[r.createElementVNode("source",{src:j.video_link||"",type:"video/webm"},null,8,Ou)])),[[r.unref(Xr)]]):(r.openBlock(),r.createElementBlock("img",{key:0,class:"modifier_image",src:j.image_link||r.unref(f).fallback_image||"",alt:j.name},null,8,Ru)),r.createElementVNode("div",{class:r.normalizeClass(["wrapper_modifier_title",{wrapper_modifier_title_required:j.min_amount>0||j.required}])},[r.createElementVNode("h3",Mu,r.toDisplayString(j.name),1),r.createElementVNode("p",null,"+"+r.toDisplayString(((de=(ee=j.sizes)==null?void 0:ee.find(ce=>ce.id===r.unref(m).selectedSize.id))==null?void 0:de.price)||j.price||0)+"₽",1)],2)])],2)],14,Nu)}),128))],2)),[[r.unref(Wr),($=r.unref(m).groupModifiers.find(j=>{var Z;return j.id===((Z=r.unref(m).groupCurrentOpen)==null?void 0:Z.id)}))!=null&&$.group_modifiers.length?{}:!1]]),P.value?(r.openBlock(),r.createElementBlock("div",Du,[r.createElementVNode("button",{onClick:M[3]||(M[3]=j=>k()),class:"modifier_continue_or_add"},r.toDisplayString(r.unref(x)?"Добавить":"Продолжить"),1)])):r.createCommentVNode("",!0)],512)])],64)}}}),[["__scopeId","data-v-9c8507e6"]]),Pu={key:0,class:"slider_container"},Lu={key:0,class:"card_size_place"},Fu=["onClick","aria-label"],Vu={key:1,class:"card_size static"},Uu=["onClick"],mo=3,zu=Xe(r.defineComponent({__name:"SizeModifier",setup(a){const l=Lt(),{stateCard:i}=_e.storeToRefs(l),{width:s}=_t.useWindowSize(),u=r.ref(50),f=r.ref(),m=r.ref(0),p=r.ref(null),_=r.computed(()=>{var k;return s.value,(((k=p.value)==null?void 0:k.offsetWidth)||0)/Math.min(i.value.productSizes.length,mo)}),x=r.computed(()=>i.value.productSizes.length<4?{left:`${u.value}%`,width:`${_.value-8}px`}:{left:"50%",transform:"translate(-50%, -50%)",width:`${_.value-8}px`}),C=r.computed(()=>{var 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?O():P>D&&N()}else{const D=i.value.productSizes.length,M=P*(100/D);u.value=M}},O=()=>{var k;if(!(i.value.productSizes.length<4)){if(m.value--,m.value<i.value.productSizes.length-mo+1){m.value+=i.value.productSizes.length;const P=(k=p.value)==null?void 0:k.querySelector(".card_size");P&&(P.style.transition="none",P.style.transform=`translateX(-${m.value*_.value}px)`,P.offsetHeight,P.style.transition="transform 0.2s ease-in-out")}v()}},N=()=>{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);console.log(D),D>-1?(m.value=D,I(k[D],D)):k.length>mo?I(k[1],1):I(k[0],0)}}),r.watch([()=>{var k;return(k=i.value.selectedSize)==null?void 0:k.id},()=>i.value.groupModifiersSelected],([k,P])=>{if(!k||!Array.isArray(P))return;const D=P.map(M=>({...M,modifiers:M.modifiers.map(q=>{if(!q.sizes||q.sizes.length===0)return q;const W=q.sizes.find(Y=>Y.id===k);return W?{...q,size:W,price:W.price??q.price}:q})}));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",Pu,[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",Lu,[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:q=>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,Fu))),128))],4)):(r.openBlock(),r.createElementBlock("ul",Vu,[(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:q=>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,Uu))),128))])),r.createElementVNode("div",{class:"size_active",style:r.normalizeStyle(x.value)},[r.createElementVNode("p",null,r.toDisplayString(C.value.alt_name?C.value.alt_name:C.value.name),1)],4)])):r.createCommentVNode("",!0)],512)])):r.createCommentVNode("",!0)}}),[["__scopeId","data-v-e2faab10"]]),Hu="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",Gu={class:"counter_container"},Wu={class:"card_size_place_wrapper",ref:"sliderWrapper"},Xu={class:"cart_amount_counter"},$u={class:"button_circle_number"},ju=Xe(r.defineComponent({__name:"NumberModifier",props:{qr_menu:{type:Boolean}},setup(a){const l=Lt(),{stateCard:i}=_e.storeToRefs(l),s=Te.useRouter(),u=a,f=()=>{var p,_,x,C;(_=(p=s.options.history.state)==null?void 0:p.back)!=null&&_.includes("mode=pdf")&&u.qr_menu||(x=i.value.openCard)!=null&&x.amount&&((C=i.value.openCard)==null?void 0:C.amount)>1&&(i.value.openCard.amount-=1)},m=()=>{var p,_,x;(_=(p=s.options.history.state)==null?void 0:p.back)!=null&&_.includes("mode=pdf")&&u.qr_menu||(x=i.value.openCard)!=null&&x.amount&&(i.value.openCard.amount+=1)};return(p,_)=>{var x,C;return r.openBlock(),r.createElementBlock("div",Gu,[r.createElementVNode("div",Wu,[r.createElementVNode("div",Xu,[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",$u,r.toDisplayString((C=r.unref(i).openCard)==null?void 0:C.amount),1),r.createElementVNode("p",{class:"cart_circle_plus","aria-label":"Увеличить количество продукта","data-clickable":"true",onClick:r.withModifiers(m,["stop","prevent"])},"+")])],512)])}}}),[["__scopeId","data-v-50b09b8c"]]);function go(a,l=800){const i=r.ref(a),s=r.ref(a);let u=null,f=null,m=a;const p=_=>{f||(f=_);const x=_-f,C=Math.min(x/l,1),y=C<.5?4*C*C*C:1-Math.pow(-2*C+2,3)/2;i.value=Math.round(m+(s.value-m)*y),C<1?u=requestAnimationFrame(p):(i.value=s.value,u=null)};return r.watch(s,()=>{u&&cancelAnimationFrame(u),m=i.value,f=null,u=requestAnimationFrame(p)},{immediate:!0}),r.onUnmounted(()=>{u&&cancelAnimationFrame(u)}),{displayNumber:i,targetNumber:s,update:_=>{s.value=_}}}const ft=r.defineComponent({__name:"RecountNumber",props:{price:{type:Number,required:!0},duration:{type:Number},fixedFloat:{type:Number,require:!1}},setup(a){const l=a,{displayNumber:i,update:s}=go(l.price||0,l.duration||800);return r.watchEffect(()=>{s(l.price)}),(u,f)=>(r.openBlock(),r.createElementBlock("span",null,r.toDisplayString(r.unref(i).toFixed(a.fixedFloat)),1))}}),qu={class:"button_price button_price_modifiers"},Zu=["src"],Yu={class:"button_text_container"},Ku={class:"button_text_price"},Qu=Xe(r.defineComponent({__name:"ButtonPriceCount",props:{qr_menu:{type:Boolean,default:!1},closeProduct:{}},setup(a,{expose:l}){const i=Te.useRouter(),s=Te.useRoute(),u=Lt(),f=st(),m=St(),p=a,{stateCard:_,totalPrice_libCard:x,isOpenWindow:C,isAddToCard:y}=_e.storeToRefs(u),{isDesktop:I}=Hn(),{itemThemes:O}=_e.storeToRefs(m),N=r.ref(!0),v=r.ref(!1),k=r.computed(()=>I.value?!1:N.value),P=r.ref([]),D=r.ref([]),M=()=>{var W,Y,F,L,V;if((Y=(W=i.options.history.state)==null?void 0:W.back)!=null&&Y.includes("mode=pdf")&&p.qr_menu)return;if(N.value){u.setCurrentCard(_.value.openCard),v.value=!0;const ie=_.value.groupModifiers.findIndex(Q=>u.checkedRequiredBtn.group.id===Q.id);u.checkedRequiredBtn.haveRequaire&&u.toggleNotRequire(u.checkedRequiredBtn.group,ie);return}const q=_.value.groupModifiersSelected||[];if(P.value=[],D.value=[],Array.isArray(q)&&q.length>0&&q.forEach(ie=>{const Q=ie.group,te=ie.modifiers||[];Q==="Добавки2000"?P.value=te.map(G=>{var z;return{...G,old_price:G.price,size:Array.isArray(G.size)?G.size.map(T=>T.id).filter(Boolean):(z=G.size)!=null&&z.id?G.size.id:void 0}}):te.length>0&&D.value.push({group:Q,is_fake:ie.is_fake||!1,is_product_determining:ie.is_product_determining||!1,modifiers:te.map(G=>{var z;return{...G,old_price:G.price,size:Array.isArray(G.size)?G.size.map(T=>T.id).filter(Boolean):(z=G.size)!=null&&z.id?G.size.id:void 0}})})}),document.body.style.overflow="",_.value.openCard){const ie={id:_.value.openCard.id,is_fake:_.value.openCard.is_fake||!1,is_od_united_product:_.value.openCard.is_od_united_product||!1,amount:_.value.openCard.amount,name:_.value.openCard.name,image_link:_.value.openCard.image_link,price:_.value.openCard.price,old_price:_.value.openCard.price,size:((F=_.value.selectedSize)==null?void 0:F.id)??((V=(L=_.value.openCard.sizes)==null?void 0:L.find(Q=>Q.is_default))==null?void 0:V.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(ie),y.value=!0}C.value=!1,p.qr_menu&&i.push(`/${s.params.orgId}/`)};return r.watch(()=>_.value.productSizes,q=>{!q||q.length===0||!_.value.selectedSize||(_.value.selectedSize={..._.value.selectedSize})},{immediate:!0}),r.watchEffect(()=>{u.checkedRequiredBtn.haveRequaire?N.value=!0:N.value=!1}),r.onMounted(()=>{y.value=!1}),l({addProductToCart:M}),(q,W)=>(r.openBlock(),r.createElementBlock(r.Fragment,null,[(r.openBlock(),r.createBlock(r.Teleport,{to:"body"},[r.createVNode(Ei,{visible:v.value,textNotificationDefault:r.unref(_).textErrorRequaired,backgroundColor:r.unref(O).accent_color?r.unref(O).accent_color:"#FF6D2E",buttonAccept:null,"onUpdate:visible":W[0]||(W[0]=Y=>v.value=Y)},null,8,["visible","textNotificationDefault","backgroundColor"])])),r.createElementVNode("div",{class:"button_price_bg_product",onTouchstart:W[3]||(W[3]=r.withModifiers(()=>{},["stop"])),onPointerdown:W[4]||(W[4]=r.withModifiers(()=>{},["stop"]))},[r.createElementVNode("div",qu,[r.unref(I)?r.createCommentVNode("",!0):(r.openBlock(),r.createBlock(ju,{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:W[1]||(W[1]=r.withModifiers(()=>{},["stop"])),onPointerdown:W[2]||(W[2]=r.withModifiers(()=>{},["stop"]))},[r.unref(I)?r.createCommentVNode("",!0):(r.openBlock(),r.createElementBlock("img",{key:0,src:r.unref(Hu),class:"card_product_button_icon"},null,8,Zu)),r.createElementVNode("div",Yu,[r.createElementVNode("p",Ku,[r.createVNode(ft,{price:+r.unref(x),fixedFloat:2},null,8,["price"]),W[5]||(W[5]=r.createTextVNode(" ₽ ",-1))])])],34)])],32)],64))}}),[["__scopeId","data-v-15db613c"]]),Ju={class:"modified_amount"},e0={class:"hide_image_corners"},t0=["src"],n0={class:"wrapper_modifier_title"},r0={class:"amount_title"},i0={class:"wrapper_amount_counter"},o0={class:"amount_count"},s0={class:"amount_wrapper"},a0={class:"add_counter_amount"},l0=Xe(r.defineComponent({__name:"ModalAmount",setup(a){const l=Lt(),i=St(),{itemThemes:s}=_e.storeToRefs(i),{stateCard:u}=_e.storeToRefs(l),f=r.computed(()=>{var _,x,C;return((C=(x=(_=u.value.currentModifier)==null?void 0:_.sizes)==null?void 0:x.find(y=>y.id===u.value.selectedSize.id))==null?void 0:C.price)??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",Ju,[r.createElementVNode("div",e0,[r.createElementVNode("img",{class:"modifier_image",src:((C=r.unref(u).currentModifier)==null?void 0:C.image_link)||r.unref(s).fallback_image||""},null,8,t0),r.createElementVNode("div",n0,[r.createElementVNode("p",r0,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",i0,[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",o0,r.toDisplayString(r.unref(u).modalCount),1),r.createElementVNode("div",s0,[r.createVNode(Ci,{onClick:r.withModifiers(r.unref(l).plusAmount,["stop"])},null,8,["onClick"])])]),r.createElementVNode("p",{class:"clear_count",onClick:r.withModifiers(p,["stop"])},"Убрать все"),r.createElementVNode("div",a0,[r.createVNode(an,{textButtonDefault:"Добавить",onClick:m,class:"button_add_group_modifiers"})])],64)}}}),[["__scopeId","data-v-84debd5d"]]),c0=(a,l,i)=>Math.max(l,Math.min(a,i)),d0=(a,l)=>Math.pow(a,l*5),ca=(a,l,i)=>l===0||Math.abs(l)===1/0?d0(a,i):a*l*i/(l+i*a),yi=(a,l)=>l*parseFloat(a)/100,po=(a,l,i,s=.15)=>s===0?c0(a,l,i):a<l?-ca(l-a,i-l,s)+l:a>i?+ca(a-i,i-l,s)+i:a,ln=(a,{min:l,max:i})=>l!==void 0&&a<l?l:i!==void 0&&a>i?i:a;function u0(a,l,i){const s=r.ref(0),u=r.computed(()=>a.value.map(_=>typeof _=="string"?yi(_,i.value):_)),f=r.computed(()=>Math.min(...u.value)),m=r.computed(()=>Math.max(...u.value)),p=r.computed(()=>{const _=u.value.reduce((x,C)=>Math.abs(C-l.value)<Math.abs(x-l.value)?C:x);return u.value.indexOf(_)});return{currentSnapPointIndex:s,flattenedSnapPoints:u,minSnapPoint:f,maxSnapPoint:m,closestSnapPointIndex:p}}const xo=Xe(r.defineComponent({__name:"BottomSheet",props:{duration:{default:250},snapPoints:{},initialSnapPoint:{},blocking:{type:Boolean,default:!0},canSwipeClose:{type:Boolean,default:!0},swipeCloseThreshold:{},canBackdropClose:{type:Boolean,default:!0},expandOnContentDrag:{type:Boolean,default:!0},modelValue:{type:Boolean},teleportTo:{default:"body"},teleportDefer:{type:Boolean,default:!1},headerClass:{},contentClass:{},footerClass:{}},emits:["opened","opening-started","closed","closing-started","ready","dragging-up","dragging-down","snapped","instinctHeight","update:modelValue"],setup(a,{expose:l,emit:i}){const s=a,u=i;let f=null;const m=r.ref(0),p=r.ref(!1),_=_t.useVModel(s,"modelValue",u,{passive:!0});r.watch(_,Ie=>{Ie?ce():Ce||ge()}),r.onMounted(()=>{_.value&&ce()});const x=r.ref(),C=r.ref(null),y=r.ref(null),I=r.ref(null),O=r.ref(null),N=r.ref(s.expandOnContentDrag),{height:v}=_t.useWindowSize(),{height:k}=_t.useElementBounding(x),{height:P}=_t.useElementBounding(C),{height:D}=_t.useElementBounding(O),{height:M}=_t.useElementBounding(y),q=r.computed({get(){return ln(Math.ceil(D.value+P.value+M.value),{max:v.value})},set(Ie){[P.value,D.value,M.value]=Ie}}),W=r.ref(0),Y=r.ref(0),F=Ot.useMotionValue(0),L=Ot.useMotionValue(0),{snapPoints:V}=r.toRefs(s),ie=r.computed(()=>V.value??[q.value]),{flattenedSnapPoints:Q,currentSnapPointIndex:te,closestSnapPointIndex:G,minSnapPoint:z,maxSnapPoint:T}=u0(ie,W,v);let X;function $(Ie){N.value=!0,j(Ie)}function j(Ie){N.value&&Ie.preventDefault()}const Z=Ie=>{Ie.key==="Escape"&&ge()},ee=()=>{s.canBackdropClose&&ge()};let de=!1;const ce=async()=>{var Ie;if(!de){Ce&&(Ce=!1,f&&(clearTimeout(f),f=null)),m.value++,_.value=!0,de=!0,u("opening-started");try{await r.nextTick(),await r.nextTick();const Ue=(Ie=x.value)==null?void 0:Ie.$el;if(!Ue){console.warn("[BottomSheet] sheet not ready, aborting"),_.value=!1;return}k.value=Ue.getBoundingClientRect().height;const Nt=Ue.querySelector("[data-vsbs-content]"),ot=Ue.querySelector("[data-vsbs-header]"),Qe=Ue.querySelector("[data-vsbs-footer]");if(q.value=[ot.getBoundingClientRect().height,Nt.getBoundingClientRect().height,Qe.getBoundingClientRect().height],await r.nextTick(),te.value=Q.value.findIndex(ve=>ve===z.value),s.initialSnapPoint){const ve=s.initialSnapPoint;if(ve<0||ve>=ie.value.length)return console.warn("Index out of bounds");W.value=typeof ie.value[ve]=="number"?ln(ie.value[ve],{max:v.value}):yi(ie.value[ve],v.value)}else W.value=ln(z.value,{max:v.value});Y.value=W.value,F.jump(W.value),L.jump(W.value),requestAnimationFrame(()=>{X=Ot.animate(F,W.value,{duration:s.duration/1e3,ease:"easeInOut"}),X=Ot.animate(L,0,{duration:s.duration/1e3,ease:"easeInOut",onComplete:()=>{s.blocking&&u("opened")}})}),window.addEventListener("keydown",Z)}finally{de=!1}}};let Ce=!1;const ge=()=>{Ce||(de&&(de=!1),X&&X.stop(),L.stop(),F.stop(),Ot.animate(L,W.value||500,{duration:s.duration/1e3,ease:"easeInOut"}),p.value=!1,_.value=!1,Ce=!0,u("closing-started"),window.removeEventListener("keydown",Z),f&&clearTimeout(f),f=setTimeout(()=>{u("closed"),Ce=!1,f=null},s.duration))},De=Ie=>{if(ie.value){if(Ie<0||Ie>=ie.value.length){console.warn("Index out of bounds");return}te.value=Ie,W.value=typeof ie.value[Ie]=="number"?ln(ie.value[Ie],{max:v.value}):yi(ie.value[Ie],v.value),X=Ot.animate(F,W.value,{duration:s.duration/1e3,ease:"easeInOut",onComplete:()=>u("snapped",ie.value.indexOf(ie.value[Ie]))})}};function xe(Ie){Ie>0?u("dragging-down"):Ie<0&&u("dragging-up")}const Ct=()=>{p.value=!0,W.value=k.value,Y.value=L.get(),F.jump(W.value),L.jump(Y.value)},be=async(Ie,Ue)=>{await r.nextTick(),x.value&&(Y.value<=0&&(W.value-=Ue.delta.y),W.value<=z.value&&(W.value=z.value,Y.value+=Ue.delta.y,p.value=!0,L.set(s.canSwipeClose?ln(Y.value,{min:0}):ln(po(Y.value,-k.value,0,.5),{min:0}))),F.set(ln(po(W.value,0,T.value,.25),{min:0,max:v.value})),xe(Ue.delta.y))},et=()=>{if(s.canSwipeClose){let Ie=W.value/2;s.swipeCloseThreshold&&typeof s.swipeCloseThreshold=="number"&&(Ie=s.swipeCloseThreshold),s.swipeCloseThreshold&&typeof s.swipeCloseThreshold=="string"&&s.swipeCloseThreshold.includes("%")&&(Ie=W.value*(Number(s.swipeCloseThreshold.replace("%",""))/100)),Math.abs(Y.value)>Ie&&(Y.value=W.value)}else Y.value=0;if(X=Ot.animate(L,Y.value,{duration:s.duration/1e3,ease:"easeInOut"}),Y.value===W.value){Y.value=0,ge();return}te.value=G.value,W.value=typeof ie.value[G.value]=="number"?ln(ie.value[G.value],{max:v.value}):yi(ie.value[G.value],v.value),X=Ot.animate(F,W.value,{duration:s.duration/1e3,ease:"easeInOut",onComplete:()=>u("snapped",ie.value.indexOf(ie.value[G.value]))}),X=Ot.animate(L,0,{duration:s.duration/1e3,ease:"easeInOut"})},rt=(Ie,Ue)=>{if(W.value=k.value,Y.value=L.get(),X&&X.stop(),!I.value)return;const Nt=I.value.scrollTop===0,ot=Ue.delta.y>0,Qe=Q.value.length===1,ve=.5>Math.abs(W.value-T.value);if(Qe){if(!s.expandOnContentDrag)return N.value=!1;L.get()===0&&Nt&&ot&&(N.value=!0),L.get()===0&&Nt&&!ot&&(N.value=!1)}else{if(!s.expandOnContentDrag)return N.value=!1;p.value=!0,N.value=!0,ve&&(ot&&Nt&&(N.value=!0),!ot&&Nt&&(N.value=!1),Nt||(N.value=!1))}},Ve=async(Ie,Ue)=>{if(await r.nextTick(),!s.expandOnContentDrag)return N.value=!1;if(!x.value)return;Y.value===0&&N.value&&s.expandOnContentDrag&&(W.value-=Ue.delta.y),W.value<=z.value&&(W.value=z.value,N.value&&s.expandOnContentDrag&&(Y.value+=Ue.delta.y),Y.value=ln(Y.value,{min:0,max:z.value}),L.set(s.canSwipeClose?ln(Y.value,{min:0}):ln(po(Y.value,-k.value,0,.5),{min:0}))),W.value>T.value&&(W.value=T.value),W.value=ln(W.value,{max:v.value}),!(Q.value.length===1)&&W.value===T.value&&(N.value=!1),F.set(W.value),xe(Ue.delta.y)},it=()=>{if(!I.value)return;const Ie=I.value.scrollTop===0;N.value=Ie},Me=_t.useDebounceFn(Ie=>De(Ie),s.duration);return r.watch(ie,(Ie,Ue)=>{if(_.value===!1||!Ie||!Ue)return;const Nt=Ie[te.value],ot=Ue[te.value];typeof Nt!="string"&&typeof ot!="string"&&(W.value=ln(Nt,{max:v.value}),Nt!==ot&&(X=Ot.animate(F,W.value,{duration:s.duration/1e3,ease:"easeInOut"})))}),r.watch(v,()=>Me(te.value)),l({open:ce,close:ge,snapToPoint:De}),r.onUnmounted(()=>{f&&clearTimeout(f)}),(Ie,Ue)=>(r.openBlock(),r.createBlock(r.Teleport,{to:a.teleportTo,defer:a.teleportDefer},[r.createElementVNode("div",r.mergeProps(Ie.$attrs,{"data-vsbs-container":""}),[r.createVNode(r.unref(Ot.AnimatePresence),null,{default:r.withCtx(()=>[r.unref(_)&&a.blocking?(r.openBlock(),r.createBlock(r.unref(Ot.Motion),{ref:"backdrop",key:"backdrop-"+m.value,"data-vsbs-backdrop":"",onClick:Ue[0]||(Ue[0]=Nt=>ee()),transition:{ease:"easeInOut",duration:a.duration/1e3},initial:{opacity:0},animate:{opacity:1},exit:{opacity:0}},null,8,["transition"])):r.createCommentVNode("",!0)]),_:1}),r.createVNode(r.unref(Ot.AnimatePresence),null,{default:r.withCtx(()=>[r.unref(_)?(r.openBlock(),r.createBlock(r.unref(Ot.Motion),{ref_key:"sheet",ref:x,exit:{opacity:0},initial:!1,key:m.value,style:r.normalizeStyle({y:r.unref(L),z:1,height:r.unref(F)}),"data-vsbs-shadow":!a.blocking,"data-vsbs-sheet-show":r.unref(_),"data-vsbs-dragging":p.value,"aria-modal":"true","data-vsbs-sheet":"",tabindex:"-1"},{default:r.withCtx(()=>[r.createVNode(r.unref(Ot.Motion),{ref_key:"sheetHeader",ref:C,"data-vsbs-header":"",onPanStart:Ct,onPan:be,onPanEnd:et,onTouchmove:$,class:r.normalizeClass(a.headerClass)},{default:r.withCtx(()=>[r.renderSlot(Ie.$slots,"header",{},void 0,!0)]),_:3},8,["class"]),r.createElementVNode("div",{ref_key:"sheetScroll",ref:I,"data-vsbs-scroll":"",onScrollend:it},[r.createVNode(r.unref(Ot.Motion),{ref:"sheetContentWrapper","data-vsbs-content-wrapper":"",onPanStart:rt,onPan:Ve,onPanEnd:et,onTouchmove:j},{default:r.withCtx(()=>[r.createElementVNode("div",{ref_key:"sheetContent",ref:O,"data-vsbs-content":"",class:r.normalizeClass(a.contentClass)},[r.renderSlot(Ie.$slots,"default",{},void 0,!0)],2)]),_:3},512)],544),r.createVNode(r.unref(Ot.Motion),{ref_key:"sheetFooter",ref:y,"data-vsbs-footer":"",onPanStart:Ct,onPan:be,onPanEnd:et,onTouchmove:$,class:r.normalizeClass(a.footerClass)},{default:r.withCtx(()=>[r.renderSlot(Ie.$slots,"footer",{},void 0,!0)]),_:3},8,["class"])]),_:3},8,["style","data-vsbs-shadow","data-vsbs-sheet-show","data-vsbs-dragging"])):r.createCommentVNode("",!0)]),_:3})],16)],8,["to","defer"]))}}),[["__scopeId","data-v-a8913d51"]]);function Tn(a,l=null){const i=si();i.initCacheSingle("defaultImage");const s=r.computed(()=>i.cache.defaultImage||null),u=r.shallowRef(!1),f=r.computed(()=>{var x;return((x=r.toValue(a))==null?void 0:x.toString())||null}),m=_t.computedAsync(async()=>{const x=f.value;return x?(await i.initCacheSingle(x),i.cache[x]||null):null},null,{evaluating:u}),p=r.computed(()=>u.value&&f.value!==null);return{mediaUrl:r.computed(()=>m.value||r.toValue(l)||s.value||null),isLoading:p}}const f0={class:"card_product_modifiers_sheet_body"},h0={class:"card__pictures"},m0=["src"],g0=["src"],p0={class:"card_header_wrapper"},x0={key:0,class:"card_fire_kkal_wrapper"},_0={class:"card_content"},w0={class:"wrapper_size"},C0={key:0,class:"description"},E0={key:1},y0={class:"title_info_modifiers"},b0=Xe(r.defineComponent({__name:"CardProductPage",props:{configPage:{}},setup(a){const l=St(),i=Lt(),{stateCard:s,isOpenWindow:u,isAddToCard:f}=_e.storeToRefs(i),{itemThemes:m}=_e.storeToRefs(l),p=Te.useRouter(),_=Te.useRoute(),x=a,C=r.computed(()=>!!(_.query.mode==="pdf"&&x.configPage.qr_menu)),{mediaUrl:y}=Tn(()=>{var P,D;return(P=s.value.openCard)!=null&&P.video_link?`${s.value.openCard.id}_video`:(D=s.value.openCard)!=null&&D.image_link?`${s.value.openCard.id}_image`:null},()=>{var P,D;return((P=s.value.openCard)==null?void 0:P.video_link)||((D=s.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()},O=()=>{f.value=!1,s.value.isSectionModifier=!1},N=()=>{s.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(()=>s.value.isSectionModifier,P=>{C.value&&document.body.classList.toggle("pdf_hidden",P)},{immediate:!0}),r.watchEffect(()=>{u.value||(u.value=x.configPage.is_closeProduct)}),r.onBeforeUnmount(()=>i.reset()),(P,D)=>{var M,q,W,Y,F,L;return r.openBlock(),r.createElementBlock("div",{class:"card_product_wrapper",style:r.normalizeStyle(C.value?"user-select: none;":"")},[r.createVNode(r.unref(xo),{modelValue:r.unref(s).isSectionModifier,"onUpdate:modelValue":D[0]||(D[0]=V=>r.unref(s).isSectionModifier=V),class:"card_product_modifiers_sheet",teleportTo:C.value?"#app":"body"},{default:r.withCtx(()=>[r.createElementVNode("div",f0,[r.createVNode(vu,{onClose:O,onAddToCart:k}),r.createVNode(aa,{isSectionModifier:r.unref(s).isSectionModifier,toggleNotRequire:r.unref(i).toggleNotRequire},null,8,["isSectionModifier","toggleNotRequire"])])]),_:1},8,["modelValue","teleportTo"]),(r.openBlock(),r.createBlock(r.Teleport,{to:"body"},[r.unref(s).isModifiedAmount?(r.openBlock(),r.createElementBlock("div",{key:0,class:"wrapper_modified_amount",onClick:r.withModifiers(N,["stop"])},[r.createVNode(l0)])):r.createCommentVNode("",!0)])),r.createElementVNode("div",h0,[(M=r.unref(s).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,m0)])),[[r.unref(Xr)]]):(r.openBlock(),r.createElementBlock("img",{key:1,class:"card__pictures_images",src:r.unref(y)||"",alt:"Product image"},null,8,g0)),r.createElementVNode("div",p0,[r.createVNode(wr,{class:"card_header_back",onClick:I,"aria-label":"Вернуться назад"}),(q=r.unref(s).openCard)!=null&&q.energy_amount?(r.openBlock(),r.createElementBlock("div",x0,[D[2]||(D[2]=r.createElementVNode("div",{class:"card_fire_kkal"},null,-1)),r.createElementVNode("p",null,[r.createElementVNode("b",null,r.toDisplayString((W=r.unref(s).openCard)==null?void 0:W.energy_amount),1),D[1]||(D[1]=r.createTextVNode(" Ккал ",-1))])])):r.createCommentVNode("",!0)]),r.createElementVNode("h4",null,r.toDisplayString((Y=r.unref(s).openCard)==null?void 0:Y.name),1),r.createElementVNode("div",{class:"card__pictures__gradient",style:r.normalizeStyle(r.unref(m).gradientStyle)},null,4)]),r.createElementVNode("div",_0,[r.createElementVNode("div",w0,[r.createVNode(zu)]),(F=r.unref(s).openCard)!=null&&F.description?(r.openBlock(),r.createElementBlock("p",C0,r.toDisplayString((L=r.unref(s).openCard)==null?void 0:L.description),1)):r.createCommentVNode("",!0),r.unref(s).groupModifiers.length?(r.openBlock(),r.createElementBlock("div",E0,[r.createElementVNode("p",y0,r.toDisplayString(r.unref(m).dish_cart_mod_choice_text||"Настрой, как ты любишь"),1),r.createVNode(aa,{isSectionModifier:r.unref(s).isSectionModifier,toggleNotRequire:r.unref(i).toggleNotRequire},null,8,["isSectionModifier","toggleNotRequire"])])):r.createCommentVNode("",!0),r.createVNode(Qu,{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"]]),bi=_e.defineStore("modals",()=>{const a=new Map,l=(u,f)=>{const m=s(u).value;m.visible=!0,m.context=f},i=u=>{const f=s(u).value;f.visible=!1},s=u=>(a.has(u)||a.set(u,r.ref({visible:!1})),a.get(u));return{state:s,open:l,close:i}}),A0={key:0,class:"popupWindowDefault_overlay"},da=Xe(r.defineComponent({__name:"PopupWindowDefault",props:{visible:{type:Boolean}},emits:["update:visible"],setup(a,{emit:l}){const i=a,s=l,u=()=>{s("update:visible",!1)};return r.watch(()=>i.visible,async f=>{f&&await r.nextTick(),i.isVisible=f}),(f,m)=>(r.openBlock(),r.createElementBlock(r.Fragment,null,[r.createVNode(r.Transition,{name:"popupWindowDefaultBlack",appear:"",onAfterLeave:m[0]||(m[0]=()=>{s("update:visible",!1)})},{default:r.withCtx(()=>[i.visible?(r.openBlock(),r.createElementBlock("div",{key:0,class:"background_black",onClick:u})):r.createCommentVNode("",!0)]),_:1}),r.createVNode(r.Transition,{name:"popupWindowDefault",appear:"",onAfterLeave:m[1]||(m[1]=()=>{s("update:visible",!1)})},{default:r.withCtx(()=>[i.visible?(r.openBlock(),r.createElementBlock("div",A0,[r.renderSlot(f.$slots,"default",{},void 0,!0)])):r.createCommentVNode("",!0)]),_:3})],64))}}),[["__scopeId","data-v-08e0e008"]]),S0=["src"],I0={class:"cart_box_content_wrapper"},N0={class:"cart_box_content_info"},T0={class:"cart_box_name"},k0={class:"cart_box_size"},R0={class:"cart_amount"},B0={class:"cart_amount_count"},O0={class:"cart_box_info_more"},M0={key:1,class:"cart_modifier_info"},D0={class:"cart_modifier_content"},v0={class:"wrapper_price_count_cart"},P0={class:"count_cart_box"},L0={class:"wrapper_modifiers_discount"},ua=Xe(r.defineComponent({__name:"CartBox",props:{index:Number,cardItem:Object,isShowModifiers:Boolean},emits:["delete"],setup(a,{emit:l}){const i=a,s=st(),u=St(),f=bi(),{itemThemes:m}=_e.storeToRefs(u),p=r.ref(0),_=r.ref(0),x=r.ref(!1),C=r.ref(!1),y=r.ref(i.isShowModifiers?u.itemThemes.qr_show_modifiers_in_cart??!1:u.itemThemes.kiosk_show_modifiers_in_cart??!1),{displayNumber:I,update:O}=go(0,800),N=r.computed(()=>{var Q,te;const V=((Q=i.cardItem)==null?void 0:Q.modifiers)??[],ie=(((te=i.cardItem)==null?void 0:te.group_modifiers)??[]).flatMap(G=>G.modifiers??[]);return[...V,...ie]}),{mediaUrl:v}=Tn(()=>{var V;return((V=i.cardItem)==null?void 0:V.id)+"_image"},()=>{var V;return(V=i.cardItem)==null?void 0:V.image_link}),k=r.computed(()=>{var V,ie;return((V=i.cardItem)==null?void 0:V.total_new_price)??hr(i.cardItem)*((ie=i.cardItem)==null?void 0:ie.amount)}),P=()=>f.open("cart-delete-confirm",i.cardItem),D=()=>{y.value=!y.value},M=()=>{s.plusAmount(i.cardItem.idSystem)},q=()=>{i.cardItem.amount>1?s.minusAmount(i.cardItem.idSystem):P()},W=V=>{p.value=V.touches[0].clientX,x.value=!0},Y=V=>{x.value&&(_.value=V.touches[0].clientX-p.value,_.value>0&&(_.value=0))},F=()=>{x.value=!1,_.value<-115&&P(),_.value=0};r.onMounted(()=>{i.index===0&&(C.value=!0,setTimeout(()=>{_.value=-90,setTimeout(()=>{_.value=0,C.value=!1},700)},0))});const L=r.computed(()=>{const V=i.index===0&&C.value?1:`${1-Math.abs(_.value)/200}`;return{transform:`translateX(${_.value}px)`,opacity:V,transition:x.value?"none":"transform 0.7s, opacity 0.7s"}});return r.watch(k,O,{immediate:!0}),(V,ie)=>{var Q,te,G,z,T,X,$,j;return r.openBlock(),r.createElementBlock("div",{class:"cart_box_wrapper",onTouchstart:W,onTouchmove:Y,onTouchend:F,style:r.normalizeStyle(L.value)},[ie[2]||(ie[2]=r.createElementVNode("div",{class:"wrapper_cart_delete"},[r.createElementVNode("div",{class:"cart_delete"})],-1)),r.createElementVNode("img",{src:r.unref(v)||"",class:"cart_box_image"},null,8,S0),r.createElementVNode("div",I0,[r.createElementVNode("div",N0,[r.createElementVNode("p",T0,r.toDisplayString((Q=a.cardItem)==null?void 0:Q.name),1),r.createElementVNode("p",k0,r.toDisplayString(((G=(te=a.cardItem)==null?void 0:te.sizes.find(Z=>{var ee;return Z.id===((ee=a.cardItem)==null?void 0:ee.size)}))==null?void 0:G.alt_name)||((T=(z=a.cardItem)==null?void 0:z.sizes.find(Z=>{var ee;return Z.id===((ee=a.cardItem)==null?void 0:ee.size)}))==null?void 0:T.name)),1),(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(((X=i.cardItem)==null?void 0:X.discounts)||[],(Z,ee)=>(r.openBlock(),r.createElementBlock("div",{key:ee,class:"discount_banner"},[r.createElementVNode("p",null,r.toDisplayString(Z.name),1),r.createElementVNode("p",null,r.toDisplayString(Z.discount)+"₽",1)]))),128)),r.createElementVNode("div",R0,[r.createElementVNode("button",{onClick:q},"-"),r.createElementVNode("p",B0,r.toDisplayString(i.cardItem.amount),1),r.createElementVNode("button",{onClick:M},"+")])]),r.createElementVNode("div",O0,[r.createElementVNode("div",{class:"cart_box_remove_item",onClick:P},[r.createVNode(la)]),($=i.cardItem)!=null&&$.new_price?(r.openBlock(),r.createElementBlock("p",{key:0,class:r.normalizeClass({discount_new_price:(j=i.cardItem)==null?void 0:j.new_price})},r.toDisplayString((i.cardItem.new_price*i.cardItem.amount).toFixed(2)+"₽"),3)):r.createCommentVNode("",!0),r.createElementVNode("p",null,r.toDisplayString(r.unref(I).toFixed(2)+"₽"),1)])]),!y.value&&N.value.length>0?(r.openBlock(),r.createElementBlock("div",{key:0,class:"cart_modifier_toggle",onTouchstart:r.withModifiers(D,["stop"])},[...ie[0]||(ie[0]=[r.createElementVNode("p",{class:"cart_info_more"},"Посмотреть модификаторы",-1),r.createElementVNode("p",{class:"cart_arrow"},null,-1)])],32)):r.createCommentVNode("",!0),y.value&&N.value.length>0?(r.openBlock(),r.createElementBlock("div",M0,[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(N.value,Z=>{var ee;return r.openBlock(),r.createElementBlock("div",{class:"cart_modifier_item",key:Z.id},[r.createElementVNode("div",D0,[r.createVNode(Ci,{id:"plus_orange"}),r.createElementVNode("p",null,r.toDisplayString(Z.name),1)]),r.createElementVNode("div",v0,[r.createElementVNode("p",P0,r.toDisplayString(`x${Z.amount}`),1),r.createElementVNode("div",L0,[Z!=null&&Z.new_price?(r.openBlock(),r.createElementBlock("p",{key:0,class:r.normalizeClass({discount_new_price:(ee=Z==null?void 0:Z.new_price)==null?void 0:ee.toFixed(2)})},r.toDisplayString((Z.new_price*Z.amount).toFixed(2)+"₽"),3)):r.createCommentVNode("",!0),r.createElementVNode("p",null,r.toDisplayString((Z.total_new_price??Z.price*Z.amount).toFixed(2)+"₽"),1)])])])}),128)),r.createElementVNode("div",{class:"cart_modifier_arrow",onTouchstart:r.withModifiers(D,["stop"])},[...ie[1]||(ie[1]=[r.createElementVNode("p",{class:"cart_info_more"},"Скрыть",-1),r.createElementVNode("p",{class:"cart_arrow_top"},null,-1)])],32)])):r.createCommentVNode("",!0)],36)}}}),[["__scopeId","data-v-9cc87c29"]]),F0={},V0={class:"nfc_x",viewBox:"0 0 48 48"};function U0(a,l){return r.openBlock(),r.createElementBlock("svg",V0,[...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 z0=Xe(F0,[["render",U0]]),H0={},G0={style:{},"aria-hidden":"true",viewBox:"0 0 48 48",class:"nfc_ok"};function W0(a,l){return r.openBlock(),r.createElementBlock("svg",G0,[...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 X0=Xe(H0,[["render",W0]]),$0={key:0,class:"nfc_ok",viewBox:"0 0 48 48","aria-hidden":"true"},j0=r.defineComponent({__name:"CardReaderRetry",props:{styleRetry:{type:Boolean}},setup(a){return(l,i)=>a.styleRetry?r.createCommentVNode("",!0):(r.openBlock(),r.createElementBlock("svg",$0,[...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)])]))}}),q0={class:"sheet_header"},Z0={class:"sheet_title",id:"sheetTitle"},Y0={class:"sheet_body"},K0={class:"sheet_card"},Q0={class:"nfc_title"},J0={class:"lead"},e1={class:"wrapper_input_accept"},t1={key:1},n1={key:0,class:"card_phone_auth_wrapper"},r1={class:"sr_only","aria-live":"polite"},fa=r.defineComponent({__name:"CardReader",setup(a){const l=st(),i=St(),{is_OpenLoyal:s}=_e.storeToRefs(l),{itemThemes:u}=_e.storeToRefs(i),f=Mt(),m=r.ref(),p=r.ref(null),_=r.ref(""),x={wait:{text:"Лояльность",title:""},success:{text:"Стикер распознан",title:"Стикер распознан"},not_found:{text:"Стикер не распознан",title:"Стикер не распознали"}},C=r.computed({get:()=>_.value,set:$=>{_.value=$.replace(/\s/g,"")}}),y=r.computed(()=>f.currentState),I=r.computed(()=>f.isDrawerOpen),O=r.computed(()=>{var $;return(($=x[y.value])==null?void 0:$.text)||""}),N=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"),q=r.computed(()=>y.value==="not_found"),W=r.computed(()=>["not_found"].includes(y.value)),Y=r.computed(()=>({wait:"Стикер не распознан. Нажмите «Повторить».",success:"Стикер распознан. Нажмите «Продолжить».",not_found:"Стикер не распознан. Нажмите «Повторить»."})[y.value]||""),F=()=>{f.closeDrawer(),s.value=!0},L=async $=>{var j,Z;f.error="",p.value=null;try{const ee=new yn;await ee.authorizeByCard($.trim()),await ee.getProfile(),l.loadCart(),f.setState("success"),f.isDrawerOpen=!1,f.showNotification("Вы успешно авторизовались в программе лояльности!")}catch(ee){f.error=((Z=(j=ee.response)==null?void 0:j.data)==null?void 0:Z.user_friendly_message)||"Ошибка",f.setState("not_found"),p.value=C.value,C.value=""}},V=r.computed(()=>{var j;const $=(j=u.value)==null?void 0:j.kiosk_hide_manual_input_loyalty_card;return $??!1}),ie=()=>{f.setState("wait"),f.error="",C.value="",p.value=null},Q=()=>{f.closeDrawer(),p.value=null,C.value=""},te=()=>{var $,j;f.setState("wait"),(j=($=C.value)==null?void 0:$.trim())!=null&&j.length&&L(C.value.trim())},G=$=>{$.stopPropagation(),document.activeElement!==m.value&&z()},z=()=>{r.nextTick(()=>{m.value&&(m.value.focus(),_.value&&m.value.select())})},T=$=>{const j=document.activeElement===m.value;if(!I.value||j)return;const Z=$.key.toLowerCase();if(Z==="backspace")return C.value=C.value.slice(0,-1);if(Z==="escape")return Q();if(Z==="r"&&q.value)return ie();if(Z==="c"&&y.value==="success")return Q();if(Z==="enter")return te();C.value+=Z},X={mounted($){$==null||$.focus()}};return r.onMounted(()=>{document==null||document.addEventListener("keydown",T)}),r.onBeforeUnmount(()=>{document==null||document.removeEventListener("keydown",T)}),r.watchEffect(()=>{I.value&&(f.error="")}),($,j)=>(r.openBlock(),r.createElementBlock(r.Fragment,null,[I.value?(r.openBlock(),r.createElementBlock("div",{key:0,class:"backdrop show",onClick:Q,"aria-hidden":"true"})):r.createCommentVNode("",!0),I.value?(r.openBlock(),r.createElementBlock("section",{key:1,class:r.normalizeClass(["sheet show",{sheet_retry:q.value}]),"aria-modal":"true","aria-labelledby":"sheetTitle",onClick:G},[r.createElementVNode("header",q0,[r.createElementVNode("div",Z0,r.toDisplayString(O.value),1),q.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:Q,"aria-label":"Закрыть"}," Закрыть ")]),r.createElementVNode("div",Y0,[r.createElementVNode("div",K0,[r.createElementVNode("div",{class:r.normalizeClass(["nfc",P.value])},[r.createVNode(j0,{styleRetry:W.value},null,8,["styleRetry"]),D.value?(r.openBlock(),r.createBlock(z0,{key:0})):r.createCommentVNode("",!0),r.createElementVNode("div",{class:"overlay check",style:r.normalizeStyle({display:M.value?"grid":"none"}),"aria-hidden":"true"},[r.createVNode(X0)],4)],2),r.createElementVNode("h2",Q0,r.toDisplayString(N.value),1),r.createElementVNode("p",J0,r.toDisplayString(v.value),1),r.createElementVNode("div",e1,[r.withDirectives(r.createElementVNode("input",{style:r.normalizeStyle(V.value?{position:"absolute",left:"-9999px"}:{}),ref_key:"cardInputManualRef",ref:m,"onUpdate:modelValue":j[0]||(j[0]=Z=>C.value=Z),class:"nfc_title_read_input",type:"text",placeholder:"Введите трек карты","aria-live":"polite",onKeydown:r.withKeys(te,["enter"])},null,36),[[r.vModelText,C.value],[X]]),q.value?(r.openBlock(),r.createElementBlock("button",{key:0,class:"btn btn_ghost",onClick:ie},"Повторить")):(r.openBlock(),r.createElementBlock("div",t1,[V.value?r.createCommentVNode("",!0):(r.openBlock(),r.createElementBlock("button",{key:0,class:"btn btn_ghost",onClick:j[1]||(j[1]=Z=>q.value?Q:te())},"Отправить"))]))]),y.value==="wait"&&r.unref(u).kiosk_show_loyalty_phone_input_button?(r.openBlock(),r.createElementBlock("div",n1,[r.createElementVNode("button",{class:"card_phone_auth_button",onClick:F},"Войти по номеру телефона")])):r.createCommentVNode("",!0)])]),r.createElementVNode("div",r1,r.toDisplayString(Y.value),1)],2)):r.createCommentVNode("",!0)],64))}}),i1="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",o1=["src"],s1={class:"header_description"},a1=Xe(r.defineComponent({__name:"PaymentBoxes",props:{configPage:{},comment:{},cartItems:{},isAuthorized:{type:Boolean},orderId:{default:null},signal:{},provider:{}},emits:["select"],setup(a,{emit:l}){const i=a,s=l,u=Mt(),f=Lt(),{selectedProvider:m,isButtonDisabled:p}=_e.storeToRefs(u),{isAddToCard:_}=_e.storeToRefs(f),x={default:i1,SBP:ha},C=async()=>{m.value=i.provider;const I=i.provider.front_type;I&&(_.value=!1,p.value=!0,s("select",I),lo(i.orderId,i.provider.type))},y=r.computed(()=>x[i.provider.front_type]||x.default);return(I,O)=>(r.openBlock(),r.createElementBlock("div",{class:"payment_boxes_wrapper",onClick:C},[r.createElementVNode("img",{class:"picture",src:y.value},null,8,o1),r.createElementVNode("div",s1,[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"]]),l1={key:0,class:"wrapper_cart_payment"},c1={class:"wrapper_paid"},d1={class:"to_be_paid"},u1=Xe(r.defineComponent({__name:"CartPayment",props:{configPage:{},comment:{},cartItems:{},isAuthorized:{type:Boolean},orderId:{},signal:{}},emits:["selectPayment"],setup(a,{emit:l}){const i=Mt(),s=st(),u=a,{totalPrice_lib:f,countBonus:m}=_e.storeToRefs(s),p=l,_=C=>{p("selectPayment",C)},x=()=>{p("selectPayment","")};return(C,y)=>r.unref(i).providerTypes.length>1?(r.openBlock(),r.createElementBlock("div",l1,[y[2]||(y[2]=r.createElementVNode("h2",null,"Выберите способ оплаты",-1)),y[3]||(y[3]=r.createElementVNode("p",{class:"description_payment"},"Можно изменить позже до оплаты",-1)),(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(r.unref(i).providerTypes,(I,O)=>(r.openBlock(),r.createElementBlock("div",{key:O},[r.createVNode(a1,{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",c1,[r.createElementVNode("p",d1,[y[0]||(y[0]=r.createTextVNode("К оплате ",-1)),r.createVNode(ft,{price:r.unref(f)-r.unref(m),fixedFloat:2},null,8,["price"]),y[1]||(y[1]=r.createTextVNode(" ₽",-1))]),r.createVNode(an,{textButtonDefault:"Назад",onClick:x,class:"btn_payment"})])])):r.createCommentVNode("",!0)}}),[["__scopeId","data-v-f7657882"]]),f1={class:"start_page"},h1=["src"],m1={class:"wrap"},g1={class:"wrap_box"},p1={class:"title_fiscal_order"},x1={class:"wrapper_accept"},_1={ref:"barRef",class:"bar_complete","aria-hidden":"true"},w1=Xe(r.defineComponent({__name:"CartCompleteKioskSuccess",props:{mediaUrl:{},orderNumber:{}},setup(a){const l=st(),i=Mt(),s=Lt(),u=St(),{cartProducts_lib:f}=_e.storeToRefs(l),{orderNumber:m,orderCompleted_lib:p,selectedOrderType:_}=_e.storeToRefs(i),{is_startPage:x}=_e.storeToRefs(s),{mediaUrl:C}=Tn(()=>u.itemThemes.kiosk_preloader?"preloader":null),y=Te.useRouter(),I=Te.useRoute();let O=null;r.onMounted(()=>{O=setTimeout(()=>{x.value=!u.itemThemes.kiosk_disable_lock_screen,_.value=null,l.isOrderTypeSubmited=!1,y.replace(`/${I.params.orgId}`)},1e4)});const N=()=>{mr(["cart","authTokensAccess","authTokensRefresh"]),f.value=[],p.value=null,_.value=null,l.isOrderTypeSubmited=!1,i.clearCard(),l.profile=null,y.replace(`/${I.params.orgId}`)};return r.onUnmounted(()=>{O&&clearInterval(O)}),(v,k)=>(r.openBlock(),r.createElementBlock("div",f1,[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,h1)])),[[r.unref(Xr)]]),k[4]||(k[4]=r.createElementVNode("div",{class:"start_img_black"},null,-1)),r.createElementVNode("div",m1,[r.createElementVNode("div",g1,[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",p1,"№ "+r.toDisplayString(r.unref(m)),1),k[3]||(k[3]=r.createElementVNode("p",{class:"title_fiscal_completed"},"Спасибо! Заказ передан в работу.",-1)),r.createElementVNode("div",x1,[r.createElementVNode("button",{class:"btn","aria-label":"Новый заказ",onClick:N},[k[0]||(k[0]=r.createElementVNode("span",{class:"label"},"Новый заказ",-1)),r.createElementVNode("span",_1,null,512)])])])])]))}}),[["__scopeId","data-v-79c00acf"]]),C1={};function E1(a,l){return l[0]||(l[0]=r.createStaticVNode('<div class="topProgress" aria-hidden="true" data-v-3e03a6dc><i data-v-3e03a6dc></i></div><h1 class="title_fiscal" data-v-3e03a6dc>Сейчас будет распечатан фискальный чек</h1><p class="reminder" data-v-3e03a6dc>Не забудьте <b data-v-3e03a6dc>оплатить заказ</b> после печати.</p><div class="stage" aria-hidden="true" data-v-3e03a6dc><div class="printer" data-v-3e03a6dc><div class="led" data-v-3e03a6dc></div><div class="slot" data-v-3e03a6dc></div><div class="receipt" data-v-3e03a6dc><div class="tear" data-v-3e03a6dc></div><div class="line accent" data-v-3e03a6dc></div><div class="line" data-v-3e03a6dc></div><div class="line sm" data-v-3e03a6dc></div><div class="line" data-v-3e03a6dc></div><div class="line sm" data-v-3e03a6dc></div><div class="line" data-v-3e03a6dc></div><div class="line sm" data-v-3e03a6dc></div></div></div></div>',4))}const y1=Xe(C1,[["render",E1],["__scopeId","data-v-3e03a6dc"]]),b1={},A1={class:"center"};function S1(a,l){return r.openBlock(),r.createElementBlock("div",A1,[...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 I1=Xe(b1,[["render",S1],["__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 o,i=1,u=arguments.length;i<u;i++){o=arguments[i];for(var f in o)Object.prototype.hasOwnProperty.call(o,f)&&(l[f]=o[f])}return l},kn.apply(this,arguments)};typeof SuppressedError=="function"&&SuppressedError;var rr;(function(a){var l=function(){function m(p,w,x,C){if(this.version=p,this.errorCorrectionLevel=w,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=[],N=0;N<this.size;N++)y.push(!1);for(var N=0;N<this.size;N++)this.modules.push(y.slice()),this.isFunction.push(y.slice());this.drawFunctionPatterns();var O=this.addEccAndInterleave(x);if(this.drawCodewords(O),C==-1)for(var T=1e9,N=0;N<8;N++){this.applyMask(N),this.drawFormatBits(N);var v=this.getPenaltyScore();v<T&&(C=N,T=v),this.applyMask(N)}u(0<=C&&C<=7),this.mask=C,this.applyMask(C),this.drawFormatBits(C),this.isFunction=[]}return m.encodeText=function(p,w){var x=a.QrSegment.makeSegments(p);return m.encodeSegments(x,w)},m.encodeBinary=function(p,w){var x=a.QrSegment.makeBytes(p);return m.encodeSegments([x],w)},m.encodeSegments=function(p,w,x,C,y,N){if(x===void 0&&(x=1),C===void 0&&(C=40),y===void 0&&(y=-1),N===void 0&&(N=!0),!(m.MIN_VERSION<=x&&x<=C&&C<=m.MAX_VERSION)||y<-1||y>7)throw new RangeError("Invalid value");var O,T;for(O=x;;O++){var v=m.getNumDataCodewords(O,w)*8,D=f.getTotalBits(p,O);if(D<=v){T=D;break}if(O>=C)throw new RangeError("Data too long")}for(var U=0,M=[m.Ecc.MEDIUM,m.Ecc.QUARTILE,m.Ecc.HIGH];U<M.length;U++){var R=M[U];N&&T<=m.getNumDataCodewords(O,R)*8&&(w=R)}for(var F=[],G=0,Z=p;G<Z.length;G++){var V=Z[G];o(V.mode.modeBits,4,F),o(V.numChars,V.mode.numCharCountBits(O),F);for(var P=0,L=V.getData();P<L.length;P++){var re=L[P];F.push(re)}}u(F.length==T);var Q=m.getNumDataCodewords(O,w)*8;u(F.length<=Q),o(0,Math.min(4,Q-F.length),F),o(0,(8-F.length%8)%8,F),u(F.length%8==0);for(var ee=236;F.length<Q;ee^=253)o(ee,8,F);for(var X=[];X.length*8<F.length;)X.push(0);return F.forEach(function(H,I){return X[I>>>3]|=H<<7-(I&7)}),new m(O,w,X,y)},m.prototype.getModule=function(p,w){return 0<=p&&p<this.size&&0<=w&&w<this.size&&this.modules[w][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 w=this.getAlignmentPatternPositions(),x=w.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(w[p],w[C]);this.drawFormatBits(0),this.drawVersion()},m.prototype.drawFormatBits=function(p){for(var w=this.errorCorrectionLevel.formatBits<<3|p,x=w,C=0;C<10;C++)x=x<<1^(x>>>9)*1335;var y=(w<<10|x)^21522;u(y>>>15==0);for(var C=0;C<=5;C++)this.setFunctionModule(8,C,i(y,C));this.setFunctionModule(8,7,i(y,6)),this.setFunctionModule(8,8,i(y,7)),this.setFunctionModule(7,8,i(y,8));for(var C=9;C<15;C++)this.setFunctionModule(14-C,8,i(y,C));for(var C=0;C<8;C++)this.setFunctionModule(this.size-1-C,8,i(y,C));for(var C=8;C<15;C++)this.setFunctionModule(8,this.size-15+C,i(y,C));this.setFunctionModule(8,this.size-8,!0)},m.prototype.drawVersion=function(){if(!(this.version<7)){for(var p=this.version,w=0;w<12;w++)p=p<<1^(p>>>11)*7973;var x=this.version<<12|p;u(x>>>18==0);for(var w=0;w<18;w++){var C=i(x,w),y=this.size-11+w%3,N=Math.floor(w/3);this.setFunctionModule(y,N,C),this.setFunctionModule(N,y,C)}}},m.prototype.drawFinderPattern=function(p,w){for(var x=-4;x<=4;x++)for(var C=-4;C<=4;C++){var y=Math.max(Math.abs(C),Math.abs(x)),N=p+C,O=w+x;0<=N&&N<this.size&&0<=O&&O<this.size&&this.setFunctionModule(N,O,y!=2&&y!=4)}},m.prototype.drawAlignmentPattern=function(p,w){for(var x=-2;x<=2;x++)for(var C=-2;C<=2;C++)this.setFunctionModule(p+C,w+x,Math.max(Math.abs(C),Math.abs(x))!=1)},m.prototype.setFunctionModule=function(p,w,x){this.modules[w][p]=x,this.isFunction[w][p]=!0},m.prototype.addEccAndInterleave=function(p){var w=this.version,x=this.errorCorrectionLevel;if(p.length!=m.getNumDataCodewords(w,x))throw new RangeError("Invalid argument");for(var C=m.NUM_ERROR_CORRECTION_BLOCKS[x.ordinal][w],y=m.ECC_CODEWORDS_PER_BLOCK[x.ordinal][w],N=Math.floor(m.getNumRawDataModules(w)/8),O=C-N%C,T=Math.floor(N/C),v=[],D=m.reedSolomonComputeDivisor(y),U=0,M=0;U<C;U++){var R=p.slice(M,M+T-y+(U<O?0:1));M+=R.length;var F=m.reedSolomonComputeRemainder(R,D);U<O&&R.push(0),v.push(R.concat(F))}for(var G=[],Z=function(V){v.forEach(function(P,L){(V!=T-y||L>=O)&&G.push(P[V])})},U=0;U<v[0].length;U++)Z(U);return u(G.length==N),G},m.prototype.drawCodewords=function(p){if(p.length!=Math.floor(m.getNumRawDataModules(this.version)/8))throw new RangeError("Invalid argument");for(var w=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 N=x-y,O=(x+1&2)==0,T=O?this.size-1-C:C;!this.isFunction[T][N]&&w<p.length*8&&(this.modules[T][N]=i(p[w>>>3],7-(w&7)),w++)}}u(w==p.length*8)},m.prototype.applyMask=function(p){if(p<0||p>7)throw new RangeError("Mask value out of range");for(var w=0;w<this.size;w++)for(var x=0;x<this.size;x++){var C=void 0;switch(p){case 0:C=(x+w)%2==0;break;case 1:C=w%2==0;break;case 2:C=x%3==0;break;case 3:C=(x+w)%3==0;break;case 4:C=(Math.floor(x/3)+Math.floor(w/2))%2==0;break;case 5:C=x*w%2+x*w%3==0;break;case 6:C=(x*w%2+x*w%3)%2==0;break;case 7:C=((x+w)%2+x*w%3)%2==0;break;default:throw new Error("Unreachable")}!this.isFunction[w][x]&&C&&(this.modules[w][x]=!this.modules[w][x])}},m.prototype.getPenaltyScore=function(){for(var p=0,w=0;w<this.size;w++){for(var x=!1,C=0,y=[0,0,0,0,0,0,0],N=0;N<this.size;N++)this.modules[w][N]==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[w][N],C=1);p+=this.finderPenaltyTerminateAndCount(x,C,y)*m.PENALTY_N3}for(var N=0;N<this.size;N++){for(var x=!1,O=0,y=[0,0,0,0,0,0,0],w=0;w<this.size;w++)this.modules[w][N]==x?(O++,O==5?p+=m.PENALTY_N1:O>5&&p++):(this.finderPenaltyAddHistory(O,y),x||(p+=this.finderPenaltyCountPatterns(y)*m.PENALTY_N3),x=this.modules[w][N],O=1);p+=this.finderPenaltyTerminateAndCount(x,O,y)*m.PENALTY_N3}for(var w=0;w<this.size-1;w++)for(var N=0;N<this.size-1;N++){var T=this.modules[w][N];T==this.modules[w][N+1]&&T==this.modules[w+1][N]&&T==this.modules[w+1][N+1]&&(p+=m.PENALTY_N2)}for(var v=0,D=0,U=this.modules;D<U.length;D++){var M=U[D];v=M.reduce(function(G,Z){return G+(Z?1:0)},v)}var R=this.size*this.size,F=Math.ceil(Math.abs(v*20-R*10)/R)-1;return u(0<=F&&F<=9),p+=F*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,w=Math.floor((this.version*8+p*3+5)/(p*4-4))*2,x=[6],C=this.size-7;x.length<p;C-=w)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 w=(16*p+128)*p+64;if(p>=2){var x=Math.floor(p/7)+2;w-=(25*x-10)*x-55,p>=7&&(w-=36)}return u(208<=w&&w<=29648),w},m.getNumDataCodewords=function(p,w){return Math.floor(m.getNumRawDataModules(p)/8)-m.ECC_CODEWORDS_PER_BLOCK[w.ordinal][p]*m.NUM_ERROR_CORRECTION_BLOCKS[w.ordinal][p]},m.reedSolomonComputeDivisor=function(p){if(p<1||p>255)throw new RangeError("Degree out of range");for(var w=[],x=0;x<p-1;x++)w.push(0);w.push(1);for(var C=1,x=0;x<p;x++){for(var y=0;y<w.length;y++)w[y]=m.reedSolomonMultiply(w[y],C),y+1<w.length&&(w[y]^=w[y+1]);C=m.reedSolomonMultiply(C,2)}return w},m.reedSolomonComputeRemainder=function(p,w){for(var x=w.map(function(T){return 0}),C=function(T){var v=T^x.shift();x.push(0),w.forEach(function(D,U){return x[U]^=m.reedSolomonMultiply(D,v)})},y=0,N=p;y<N.length;y++){var O=N[y];C(O)}return x},m.reedSolomonMultiply=function(p,w){if(p>>>8||w>>>8)throw new RangeError("Byte out of range");for(var x=0,C=7;C>=0;C--)x=x<<1^(x>>>7)*285,x^=(w>>>C&1)*p;return u(x>>>8==0),x},m.prototype.finderPenaltyCountPatterns=function(p){var w=p[1];u(w<=this.size*3);var x=w>0&&p[2]==w&&p[3]==w*3&&p[4]==w&&p[5]==w;return(x&&p[0]>=w*4&&p[6]>=w?1:0)+(x&&p[6]>=w*4&&p[0]>=w?1:0)},m.prototype.finderPenaltyTerminateAndCount=function(p,w,x){return p&&(this.finderPenaltyAddHistory(w,x),w=0),w+=this.size,this.finderPenaltyAddHistory(w,x),this.finderPenaltyCountPatterns(x)},m.prototype.finderPenaltyAddHistory=function(p,w){w[0]==0&&(p+=this.size),w.pop(),w.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 o(m,p,w){if(p<0||p>31||m>>>p)throw new RangeError("Value out of range");for(var x=p-1;x>=0;x--)w.push(m>>>x&1)}function i(m,p){return(m>>>p&1)!=0}function u(m){if(!m)throw new Error("Assertion error")}var f=function(){function m(p,w,x){if(this.mode=p,this.numChars=w,this.bitData=x,w<0)throw new RangeError("Invalid argument");this.bitData=x.slice()}return m.makeBytes=function(p){for(var w=[],x=0,C=p;x<C.length;x++){var y=C[x];o(y,8,w)}return new m(m.Mode.BYTE,p.length,w)},m.makeNumeric=function(p){if(!m.isNumeric(p))throw new RangeError("String contains non-numeric characters");for(var w=[],x=0;x<p.length;){var C=Math.min(p.length-x,3);o(parseInt(p.substring(x,x+C),10),C*3+1,w),x+=C}return new m(m.Mode.NUMERIC,p.length,w)},m.makeAlphanumeric=function(p){if(!m.isAlphanumeric(p))throw new RangeError("String contains unencodable characters in alphanumeric mode");var w=[],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)),o(C,11,w)}return x<p.length&&o(m.ALPHANUMERIC_CHARSET.indexOf(p.charAt(x)),6,w),new m(m.Mode.ALPHANUMERIC,p.length,w)},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 w=[];if(p<0)throw new RangeError("ECI assignment value out of range");if(p<128)o(p,8,w);else if(p<16384)o(2,2,w),o(p,14,w);else if(p<1e6)o(6,3,w),o(p,21,w);else throw new RangeError("ECI assignment value out of range");return new m(m.Mode.ECI,0,w)},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,w){for(var x=0,C=0,y=p;C<y.length;C++){var N=y[C],O=N.mode.numCharCountBits(w);if(N.numChars>=1<<O)return 1/0;x+=4+O+N.bitData.length}return x},m.toUtf8ByteArray=function(p){p=encodeURI(p);for(var w=[],x=0;x<p.length;x++)p.charAt(x)!="%"?w.push(p.charCodeAt(x)):(w.push(parseInt(p.substring(x+1,x+3),16)),x+=2);return w},m.NUMERIC_REGEX=/^[0-9]*$/,m.ALPHANUMERIC_REGEX=/^[A-Z0-9 $%*+.\/:-]*$/,m.ALPHANUMERIC_CHARSET="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:",m}();a.QrSegment=f})(rr||(rr={})),function(a){(function(l){var o=function(){function i(u,f){this.ordinal=u,this.formatBits=f}return i.LOW=new i(0,1),i.MEDIUM=new i(1,0),i.QUARTILE=new i(2,3),i.HIGH=new i(3,2),i}();l.Ecc=o})(a.QrCode||(a.QrCode={}))}(rr||(rr={})),function(a){(function(l){var o=function(){function i(u,f){this.modeBits=u,this.numBitsCharCount=f}return i.prototype.numCharCountBits=function(u){return this.numBitsCharCount[Math.floor((u+7)/17)]},i.NUMERIC=new i(1,[10,12,14]),i.ALPHANUMERIC=new i(2,[9,11,13]),i.BYTE=new i(4,[8,16,16]),i.KANJI=new i(8,[8,10,12]),i.ECI=new i(7,[0,0,0]),i}();l.Mode=o})(a.QrSegment||(a.QrSegment={}))}(rr||(rr={}));var Cr=rr,wo="L",_o={L:Cr.QrCode.Ecc.LOW,M:Cr.QrCode.Ecc.MEDIUM,Q:Cr.QrCode.Ecc.QUARTILE,H:Cr.QrCode.Ecc.HIGH},b1=function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0}();function Co(a){return a in _o}function ma(a,l){l===void 0&&(l=0);var o=[];return a.forEach(function(i,u){var f=null;i.forEach(function(m,p){if(!m&&f!==null){o.push("M".concat(f+l," ").concat(u+l,"h").concat(p-f,"v1H").concat(f+l,"z")),f=null;return}if(p===i.length-1){if(!m)return;f===null?o.push("M".concat(p+l,",").concat(u+l," h1v1H").concat(p+l,"z")):o.push("M".concat(f+l,",").concat(u+l," h").concat(p+1-f,"v1H").concat(f+l,"z"));return}m&&f===null&&(f=p)})}),o.join("")}function ga(a,l,o,i){var u=i.width,f=i.height,m=i.x,p=i.y,w=a.length+o*2,x=Math.floor(l*.1),C=w/l,y=(u||x)*C,N=(f||x)*C,O=m==null?a.length/2-y/2:m*C,T=p==null?a.length/2-N/2:p*C,v=null;if(i.excavate){var D=Math.floor(O),U=Math.floor(T),M=Math.ceil(y+O-D),R=Math.ceil(N+T-U);v={x:D,y:U,w:M,h:R}}return{x:O,y:T,h:N,w:y,excavation:v}}function pa(a,l){return a.slice().map(function(o,i){return i<l.y||i>=l.y+l.h?o:o.map(function(u,f){return f<l.x||f>=l.x+l.w?u:!1})})}var Eo={value:{type:String,required:!0,default:""},size:{type:Number,default:100},level:{type:String,default:wo,validator:function(a){return Co(a)}},background:{type:String,default:"#fff"},foreground:{type:String,default:"#000"},margin:{type:Number,required:!1,default:0},imageSettings:{type:Object,required:!1,default:function(){return{}}},gradient:{type:Boolean,required:!1,default:!1},gradientType:{type:String,required:!1,default:"linear",validator:function(a){return["linear","radial"].indexOf(a)>-1}},gradientStartColor:{type:String,required:!1,default:"#000"},gradientEndColor:{type:String,required:!1,default:"#fff"}},A1=kn(kn({},Eo),{renderAs:{type:String,required:!1,default:"canvas",validator:function(a){return["canvas","svg"].indexOf(a)>-1}}}),S1=r.defineComponent({name:"QRCodeSvg",props:Eo,setup:function(a){var l=r.ref(0),o=r.ref(""),i,u=function(){var m=a.value,p=a.level,w=a.margin,x=w>>>0,C=Co(p)?p:wo,y=Cr.QrCode.encodeText(m,_o[C]).getModules();if(l.value=y.length+x*2,a.imageSettings.src){var N=ga(y,a.size,x,a.imageSettings);i={x:N.x+x,y:N.y+x,width:N.w,height:N.h},N.excavation&&(y=pa(y,N.excavation))}o.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:o.value}),a.imageSettings.src&&r.h("image",kn({href:a.imageSettings.src},i))])}}}),I1=r.defineComponent({name:"QRCodeCanvas",props:Eo,setup:function(a,l){var o=r.ref(null),i=r.ref(null),u=function(){var m=a.value,p=a.level,w=a.size,x=a.margin,C=a.background,y=a.foreground,N=a.gradient,O=a.gradientType,T=a.gradientStartColor,v=a.gradientEndColor,D=x>>>0,U=Co(p)?p:wo,M=o.value;if(M){var R=M.getContext("2d");if(R){var F=Cr.QrCode.encodeText(m,_o[U]).getModules(),G=F.length+D*2,Z=i.value,V={x:0,y:0,width:0,height:0},P=a.imageSettings.src&&Z!=null&&Z.naturalWidth!==0&&Z.naturalHeight!==0;if(P){var L=ga(F,a.size,D,a.imageSettings);V={x:L.x+D,y:L.y+D,width:L.w,height:L.h},L.excavation&&(F=pa(F,L.excavation))}var re=window.devicePixelRatio||1,Q=w/G*re;if(M.height=M.width=w*re,R.scale(Q,Q),R.fillStyle=C,R.fillRect(0,0,G,G),N){var ee=void 0;O==="linear"?ee=R.createLinearGradient(0,0,G,G):ee=R.createRadialGradient(G/2,G/2,0,G/2,G/2,G/2),ee.addColorStop(0,T),ee.addColorStop(1,v),R.fillStyle=ee}else R.fillStyle=y;b1?R.fill(new Path2D(ma(F,D))):F.forEach(function(X,H){X.forEach(function(I,$){I&&R.fillRect($+D,H+D,1,1)})}),P&&R.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:o,style:kn(kn({},f),{width:"".concat(a.size,"px"),height:"".concat(a.size,"px")})})),a.imageSettings.src&&r.h("img",{ref:i,src:a.imageSettings.src,style:{display:"none"},onLoad:u})])}}}),N1=r.defineComponent({name:"Qrcode",render:function(){var a=this.$props,l=a.renderAs,o=a.value,i=a.size,u=a.margin,f=a.level,m=a.background,p=a.foreground,w=a.imageSettings,x=a.gradient,C=a.gradientType,y=a.gradientStartColor,N=a.gradientEndColor;return r.h(l==="svg"?S1:I1,{value:o,size:i,margin:u,level:f,background:m,foreground:p,imageSettings:w,gradient:x,gradientType:C,gradientStartColor:y,gradientEndColor:N})},props:A1});const T1={},k1={viewBox:"0 0 24 24","aria-hidden":"true"};function R1(a,l){return r.openBlock(),r.createElementBlock("svg",k1,[...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 B1=Xe(T1,[["render",R1]]),O1={},M1={viewBox:"0 0 24 24","aria-hidden":"true"};function D1(a,l){return r.openBlock(),r.createElementBlock("svg",M1,[...l[0]||(l[0]=[r.createStaticVNode('<path d="M4 8V6a2 2 0 0 1 2-2h2"></path><path d="M20 8V6a2 2 0 0 0-2-2h-2"></path><path d="M4 16v2a2 2 0 0 0 2 2h2"></path><path d="M20 16v2a2 2 0 0 1-2 2h-2"></path><path d="M7 12h10"></path>',5)])])}const v1=Xe(O1,[["render",D1]]),P1="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",L1={class:"wrapper_qr_page"},F1=["src"],V1={class:"modal_qr"},U1={class:"modal_qr_content"},z1={class:"wrapper_icon_qr"},H1=["src"],G1={class:"total_order_price"},W1={class:"ttl_wrapper"},X1={class:"ttl_head"},$1={class:"ttl_bar"},j1={class:"hint hint-anim","aria-label":"Инструкция по оплате"},q1={class:"steps","aria-hidden":"true"},Z1={class:"step is-active","data-i":"0"},Y1={class:"ico"},K1={class:"step","data-i":"1"},Q1={class:"ico"},J1={class:"step","data-i":"2"},ef={class:"ico"},tf=["src"],nf={class:"qr_border"},rf=Xe(r.defineComponent({__name:"CompletedQRCode",setup(a){const l=Rt(),o=Mt(),i=st(),u=Te.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 w=0;const x=r.computed(()=>{const v=Math.floor(p.value/60),D=p.value%60;return`${v}:${D.toString().padStart(2,"0")}`}),C=r.computed(()=>p.value/m*100),y=r.computed(()=>o.paymentCostQR),N=()=>{p.value--,p.value<=0&&(clearInterval(w),O())},O=()=>{i.removeFromLocalStorage(["cart","authTokensAccess","authTokensRefresh","user"]),sessionStorage.removeItem("is_adult"),u.replace({name:"home"}).then(()=>u.go(0))};r.onMounted(()=>{w=setInterval(N,1e3)}),r.onBeforeUnmount(()=>{clearInterval(w)});const{mediaUrl:T}=Tn(()=>l.itemThemes.kiosk_preloader?"preloader":null);return(v,D)=>(r.openBlock(),r.createElementBlock("div",L1,[(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,F1)])),D[7]||(D[7]=r.createElementVNode("div",{class:"start_img_black"},null,-1)),r.createElementVNode("div",V1,[r.createElementVNode("div",U1,[r.createElementVNode("div",z1,[r.createElementVNode("img",{src:r.unref(ha),width:"100",height:"100"},null,8,H1)]),D[6]||(D[6]=r.createElementVNode("h1",null,"Оплата по QR",-1)),r.createElementVNode("p",G1,[r.createVNode(ft,{price:y.value,fixedFloat:2},null,8,["price"]),r.createTextVNode(" "+r.toDisplayString(r.unref(i).config_lib.currency_symbol),1)]),r.createElementVNode("div",W1,[r.createElementVNode("div",X1,[D[0]||(D[0]=r.createElementVNode("span",null,"Срок жизни QR-кода",-1)),r.createElementVNode("b",null,r.toDisplayString(x.value),1)]),r.createElementVNode("div",$1,[r.createElementVNode("div",{class:"ttl_fill",style:r.normalizeStyle({width:`${C.value}%`})},null,4)])]),r.createElementVNode("p",j1,[r.createElementVNode("div",q1,[r.createElementVNode("div",Z1,[r.createElementVNode("div",Y1,[r.createVNode(B1)]),D[1]||(D[1]=r.createElementVNode("div",{class:"txt"},"Возьмите телефон →",-1))]),D[4]||(D[4]=r.createElementVNode("div",{class:"sep"},null,-1)),r.createElementVNode("div",K1,[r.createElementVNode("div",Q1,[r.createVNode(v1)]),D[2]||(D[2]=r.createElementVNode("span",{class:"txt"},"Отсканируйте QR-код",-1))]),D[5]||(D[5]=r.createElementVNode("span",{class:"sep"},"→",-1)),r.createElementVNode("div",J1,[r.createElementVNode("div",ef,[r.createElementVNode("img",{src:r.unref(P1),width:"30",height:"30"},null,8,tf)]),D[3]||(D[3]=r.createElementVNode("span",{class:"txt"},"Оплатите заказ",-1))])])]),r.createElementVNode("div",nf,[r.createVNode(N1,{value:r.unref(o).linkQR,size:200,level:"Q","render-as":"svg","image-settings":f},null,8,["value"])]),r.createVNode(an,{textButtonDefault:"Отменить заказ",onClick:O,class:"cancel_order_btn"})])])]))}}),[["__scopeId","data-v-bd3b4b16"]]),of={key:0,class:"wrapper_qr"},sf={key:1,class:"wrapper_qr"},af={key:2,class:"wrapper_qr"},lf={key:3,class:"wrapper_qr"},cf=Xe(r.defineComponent({__name:"CartCompletedOrder",props:{orderNumber:{}},setup(a){const l=Mt(),o=Rt(),{orderNumber:i,orderCompleted_lib:u}=we.storeToRefs(l),{mediaUrl:f}=Tn(()=>o.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",of,[r.createVNode(w1)])):r.unref(u)&&r.unref(u)===2?(r.openBlock(),r.createElementBlock("section",sf,[r.createVNode(y1)])):r.createCommentVNode("",!0),r.unref(u)&&r.unref(u)===3?(r.openBlock(),r.createElementBlock("section",af,[r.createVNode(g1,{orderNumber:r.unref(i),mediaUrl:r.unref(f)},null,8,["orderNumber","mediaUrl"])])):r.createCommentVNode("",!0),r.unref(u)&&r.unref(u)===4?(r.openBlock(),r.createElementBlock("section",lf,[r.createVNode(rf)])):r.createCommentVNode("",!0)],64))}}),[["__scopeId","data-v-3779e8ee"]]);function df(){const a=Te.useRoute(),l=Mt(),o=st(),i=Fn(),{isButtonDisabled:u}=we.storeToRefs(l),f=(p,w)=>{const x=i.isTableService?"tableservice":p.kiosk_menu?"kiosk":"qr",C=l.createPaymentHandler(x,p.kiosk_menu,w);return C?{...C.config,route:{params:{orgId:String(a.params.orgId)}},handler:C.handler,resetDiscounts:p.resetDiscounts,setButtonDisabled:y=>{u.value=y},on403Kiosk:()=>{localStorage.removeItem("apiKey"),o.is_showApiKey=!0}}:null};return{getCreateOrderConfig:f,makeCreateOrderRequest:async(p,w)=>{const x=f(p,w.paymentMethodId);if(x)return Pd(w.items,x,{comment:w.comment,is_authorized:w.isAuthorized,signal:w.signal})}}}const uf={},ff={class:"cart_loyal_qr",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none"};function hf(a,l){return r.openBlock(),r.createElementBlock("svg",ff,[...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 mf=Xe(uf,[["render",hf]]),yo=a=>{const l=bi(),o=p=>l.open(a,p),i=()=>l.close(a),u=l.state(a),f=r.computed({get:()=>u.value.visible,set:p=>p&&o()||i()}),m=r.computed(()=>u.value.context);return{visible:f,context:m,open:o,close:i}},gf={class:"cart_deletion_modal_content"},pf={class:"cart_deletion_modal_title"},xf={class:"cart_deletion_modal_footer"},wf=Xe(r.defineComponent({__name:"CartDeleteConfirm",emits:["confirm"],setup(a,{emit:l}){const o=l,{visible:i,context:u,close:f}=yo("cart-delete-confirm"),m=()=>{o("confirm",u.value.idSystem),f()};return(p,w)=>(r.openBlock(),r.createBlock(r.Transition,{name:"fade"},{default:r.withCtx(()=>[r.unref(i)?(r.openBlock(),r.createElementBlock("div",{key:0,class:"cart_deletion_modal_overlay",onClick:w[1]||(w[1]=r.withModifiers((...x)=>r.unref(f)&&r.unref(f)(...x),["self"]))},[r.createElementVNode("div",gf,[r.createElementVNode("div",pf,"Удалить "+r.toDisplayString(r.unref(u).name)+"?",1),w[2]||(w[2]=r.createElementVNode("div",{class:"cart_deletion_modal_body"},"Эта позиция будет полностью удалена из заказа.",-1)),r.createElementVNode("div",xf,[r.createElementVNode("button",{class:"primary",onClick:m}," Удалить "),r.createElementVNode("button",{onClick:w[0]||(w[0]=(...x)=>r.unref(f)&&r.unref(f)(...x))},"Отмена")])])])):r.createCommentVNode("",!0)]),_:1}))}}),[["__scopeId","data-v-018f66f3"]]),_f={class:"cart_extend_modal_content"},Cf={class:"cart_extend_modal_footer"},Ef=Xe(r.defineComponent({__name:"CartExtendConfirm",emits:["confirm"],setup(a,{emit:l}){const o=l,{visible:i,context:u,close:f}=yo("cart-extend-confirm"),m=()=>{o("confirm"),f()};return(p,w)=>(r.openBlock(),r.createBlock(r.Transition,{name:"fade"},{default:r.withCtx(()=>[r.unref(i)?(r.openBlock(),r.createElementBlock("div",{key:0,class:"cart_extend_modal_overlay",onClick:w[1]||(w[1]=r.withModifiers((...x)=>r.unref(f)&&r.unref(f)(...x),["self"]))},[r.createElementVNode("div",_f,[w[2]||(w[2]=r.createElementVNode("div",{class:"cart_extend_modal_title"},"Дополнить заказ?",-1)),w[3]||(w[3]=r.createElementVNode("div",{class:"cart_extend_modal_body"},"В заказ добавлены новые позиции. Подтвердить дополнение заказа? После подтверждения позиции нельзя отменить.",-1)),r.createElementVNode("div",Cf,[r.createElementVNode("button",{onClick:w[0]||(w[0]=(...x)=>r.unref(f)&&r.unref(f)(...x))},"Отмена"),r.createElementVNode("button",{class:"primary",onClick:m}," Продолжить ")])])])):r.createCommentVNode("",!0)]),_:1}))}}),[["__scopeId","data-v-15f3f7bf"]]),yf={class:"order_box_wrapper"},bf=["src"],Af={class:"order_box_content_wrapper"},Sf={class:"order_box_content_info"},If={class:"order_box_amount"},Nf={class:"order_box_amount_count"},Tf={key:0,class:"order_box_status"},kf=["data-state"],Rf={class:"order_box_info_more"},Bf={key:1,class:"cart_modifier_info"},Of={class:"cart_modifier_content"},Mf={class:"wrapper_price_count_cart"},Df={class:"count_order_box"},vf={class:"wrapper_modifiers_discount"},bo=Xe(r.defineComponent({__name:"OrderBox",props:{index:Number,cardItem:Object},emits:["delete"],setup(a,{emit:l}){const o=a,i=r.ref(!1),{displayNumber:u,update:f}=go(0,800),m=r.computed(()=>{var O,T;const y=((O=o.cardItem)==null?void 0:O.modifiers)??[],N=(((T=o.cardItem)==null?void 0:T.group_modifiers)??[]).flatMap(v=>v.modifiers??[]);return[...y,...N]}),{mediaUrl:p}=Tn(()=>{var y;return((y=o.cardItem)==null?void 0:y.id)+"_image"},()=>{var y;return(y=o.cardItem)==null?void 0:y.image_link}),w=r.computed(()=>{var y;return(y=o.cardItem)==null?void 0:y.total_cost}),x=()=>{i.value=!i.value},C=r.computed(()=>{var N,O;if((N=o.cardItem)!=null&&N.correlation_id)return"Ожидает добавления 🕓";const y=(O=o.cardItem)==null?void 0:O.cooking_state;return!y&&y!==0?null:y===0?"Создан":y===1?"Готовится":y===2?"Приготовлен":y===3?"Выдан":null});return r.watch(w,f,{immediate:!0}),(y,N)=>{var O,T,v,D,U;return r.openBlock(),r.createElementBlock("div",yf,[r.createElementVNode("img",{src:r.unref(p)||"",class:"order_box_image"},null,8,bf),r.createElementVNode("div",Af,[r.createElementVNode("div",Sf,[r.createElementVNode("p",null,r.toDisplayString((O=a.cardItem)==null?void 0:O.name),1),r.createElementVNode("div",If,[N[0]||(N[0]=r.createElementVNode("button",{disabled:""},"-",-1)),r.createElementVNode("p",Nf,r.toDisplayString((T=o.cardItem)==null?void 0:T.amount),1),N[1]||(N[1]=r.createElementVNode("button",{disabled:""},"+",-1))]),C.value?(r.openBlock(),r.createElementBlock("div",Tf,[r.createElementVNode("span",{"data-state":(v=a.cardItem)==null?void 0:v.cooking_state},r.toDisplayString(C.value),9,kf)])):r.createCommentVNode("",!0)]),r.createElementVNode("div",Rf,[(D=o.cardItem)!=null&&D.new_price?(r.openBlock(),r.createElementBlock("p",{key:0,class:r.normalizeClass({discount_new_price:(U=o.cardItem)==null?void 0:U.new_price})},r.toDisplayString((o.cardItem.new_price*o.cardItem.amount).toFixed(2)+"₽"),3)):r.createCommentVNode("",!0),r.createElementVNode("p",null,r.toDisplayString(r.unref(u).toFixed(2)+"₽"),1)])]),!i.value&&m.value.length>0?(r.openBlock(),r.createElementBlock("div",{key:0,class:"cart_modifier_toggle",onClick:r.withModifiers(x,["stop"])},[...N[2]||(N[2]=[r.createElementVNode("p",{class:"cart_info_more"},"Посмотреть модификаторы",-1),r.createElementVNode("p",{class:"cart_arrow"},null,-1)])])):r.createCommentVNode("",!0),i.value?(r.openBlock(),r.createElementBlock("div",Bf,[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(m.value,M=>{var R;return r.openBlock(),r.createElementBlock("div",{class:"cart_modifier_item",key:M.id},[r.createElementVNode("div",Of,[r.createVNode(Ci,{id:"plus_orange"}),r.createElementVNode("p",null,r.toDisplayString(M.name),1)]),r.createElementVNode("div",Mf,[r.createElementVNode("p",Df,r.toDisplayString(`x${M.amount}`),1),r.createElementVNode("div",vf,[M!=null&&M.new_price?(r.openBlock(),r.createElementBlock("p",{key:0,class:r.normalizeClass({discount_new_price:(R=M==null?void 0:M.new_price)==null?void 0:R.toFixed(2)})},r.toDisplayString((M.new_price*M.amount).toFixed(2)+"₽"),3)):r.createCommentVNode("",!0),r.createElementVNode("p",null,r.toDisplayString((M.total_new_price||M.price*M.amount).toFixed(2)+"₽"),1)])])])}),128)),r.createElementVNode("div",{class:"cart_modifier_arrow",onClick:r.withModifiers(x,["stop"])},[...N[3]||(N[3]=[r.createElementVNode("p",{class:"cart_info_more"},"Скрыть",-1),r.createElementVNode("p",{class:"cart_arrow_top"},null,-1)])])])):r.createCommentVNode("",!0)])}}}),[["__scopeId","data-v-453214a0"]]),Pf={class:"cart_wrapper"},Lf={class:"cart_header_content"},Ff={key:0,class:"cart_header_subwrapper"},Vf={class:"cart_kso_button_wrapper"},Uf={key:0},zf={key:0,class:"kso_btn_wrapper"},Hf=["src"],Gf={key:0,class:"cart_qr_button_wrapper"},Wf={class:"cart_header_info"},Xf={class:"cart_header_info"},$f={class:"cart_header_info"},jf={class:"cart_header_info"},qf={key:1,class:"cart-tabs-wrapper"},Zf={class:"cart-tabs-container"},Yf=["data-active","onClick"],Kf={key:0,class:"wrapper_comment"},Qf={class:"wrapper_limit_in_area"},Jf=["placeholder","aria-invalid"],eh={class:"limit_comment"},th={key:1,class:"wrapper_comment"},nh={class:"wrapper_limit_in_area"},rh=["placeholder","aria-invalid"],ih={class:"limit_comment"},oh={key:2},sh={class:"table_order_desk_number"},ah={key:0,class:"table_order_indent_number"},lh={class:"cart_cards"},ch={class:"cart_footer_wrapper"},dh={key:0,class:"footer_title"},uh=["disabled","max"],fh={key:1,class:"footer_sales"},hh=["step","max"],mh={class:"list_price"},gh={key:0},ph={key:1},xh={key:2},wh={class:"accept_field"},_h={class:"accept_field"},Ch={key:3},Eh={class:"accept_field"},yh={class:"accept_field"},bh={key:4},Ah={key:5},Sh={key:0,class:"accept_field"},Ih={key:1,class:"accept_field"},Nh={key:3,class:"cart_min_order_notice"},Th={class:"wrapper_footer_cart_btn"},kh=r.defineComponent({__name:"CartPage",props:{configPage:{},textPaymentBtn:{},config_qr:{type:Boolean}},setup(a){const l=yn.create();let o;const i=st(),u=Mt(),f=Rt(),m=Fn(),p=bi(),w=a,{initialCartPrice_lib:x,totalPrice_lib:C,countBonus:y,config_lib:N,cartProducts_lib:O,profile:T}=we.storeToRefs(i),{itemThemes:v}=we.storeToRefs(f),{isButtonDisabled:D,orderCompleted_lib:U,orderNumber:M,extraDiscount:R,is_notification_lib:F,isCreateButtonVisible:G,is_paymentCart:Z,providerTypes:V,notificationData_lib:P,selectedProvider:L,configPayment:re}=we.storeToRefs(u),Q=Te.useRouter(),ee=Te.useRoute(),X=r.useTemplateRef("stickerLoyality"),H=r.ref(!1),I=r.ref(!1),$=r.ref(!1),j=r.useTemplateRef("commentEl"),q=r.ref(""),K=r.ref(!1),oe=r.ref(!1),de=r.ref(!1),ce=r.ref(0),Ce=r.ref(0),ge=r.ref(!0),De=r.ref(),xe=r.computed(()=>w.configPage.qr_menu?"YOOKASSA_BASE":V.value[0].front_type),_t=r.computed(()=>w.configPage.qr_menu?"YOOKASSA":V.value[0].type),be=r.computed(()=>{var pe,se;return w.configPage.kiosk_menu&&((pe=N.value)==null?void 0:pe.loyalty)==="IIKO"&&(N.value.has_loyalty_default_user||T.value)||w.configPage.qr_menu&&((se=N.value)==null?void 0:se.loyalty)==="IIKO"&&(T.value||v.value.qr_auth_required===!1)}),et=r.computed(()=>["АВТОРИЗОВАТЬСЯ ДЛЯ ЗАКАЗА"].includes(w.textPaymentBtn.toUpperCase())?w.textPaymentBtn:m.isTableService&&m.hasOrder?"Дополнить заказ":G.value?"Создать заказ":w.textPaymentBtn),{width:rt}=yt.useElementSize(X,{width:0,height:0},{box:"border-box"}),Ve=r.computed(()=>{var $e,Ae,zt,An;const pe={energy_amount:0,proteins_amount:0,fat_amount:0,carbohydrates_amount:0};let se=pe;return m.isTableService&&((Ae=($e=m.order)==null?void 0:$e.items)!=null&&Ae.length)&&(se=((An=(zt=m.order)==null?void 0:zt.items)==null?void 0:An.reduce((ct,Pe)=>(Pe!=null&&Pe.nutrition&&(ct.energy_amount+=(Pe.nutrition.energy_amount||0)*(Pe.amount||0),ct.proteins_amount+=(Pe.nutrition.proteins_amount||0)*(Pe.amount||0),ct.fat_amount+=(Pe.nutrition.fat_amount||0)*(Pe.amount||0),ct.carbohydrates_amount+=(Pe.nutrition.carbohydrates_amount||0)*(Pe.amount||0)),ct),pe))||pe),O.value.reduce((ct,Pe)=>(ct.energy_amount+=(Pe.energy_amount||0)*(Pe.amount||0),ct.proteins_amount+=(Pe.proteins_amount||0)*(Pe.amount||0),ct.fat_amount+=(Pe.fat_amount||0)*(Pe.amount||0),ct.carbohydrates_amount+=(Pe.carbohydrates_amount||0)*(Pe.amount||0),ct),se)}),it=r.computed(()=>{var pe;if((pe=v.value)!=null&&pe.comments){const se=v.value.comments;return{fieldName:w.configPage.kiosk_menu?se.kiosk_comment_field_name:se.qr_comment_field_name,placeholder:w.configPage.kiosk_menu?se.kiosk_comment_field_placeholder:se.qr_comment_field_placeholder,show:w.configPage.kiosk_menu?se.kiosk_show_order_comment:se.qr_show_order_comment}}}),Me=yt.computedAsync(async pe=>{var Ae;const se=new AbortController;if(pe(()=>se.abort()),!H.value||!((Ae=T.value)!=null&&Ae.balance)||!C.value)return 0;const $e=await l.maxPayByBonuses(De.value,w.configPage.kiosk_menu,!!w.configPage.userData||!!T.value,se.signal);return $e!=null&&$e.by_bonuses?($.value=$e.non_integers_allowed||!1,Math.min($e.by_bonuses,T.value.balance,C.value)):0},0,{shallow:!0}),Ie=()=>Q.push(`/${ee.params.orgId}/`),Ue=pe=>{($.value?["a","A","+","-","."]:["a","A","+","-",".",","]).includes(pe.key)&&pe.preventDefault()},It=pe=>{i.deleteItemFromCart(pe),O.value.length===0&&(oe.value=!1,de.value=!1,m.hasOrder&&Q.replace({name:"order-ts"}))},ot=()=>{oe.value=!oe.value,q.value.length},Qe=r.computed(()=>{var se;return(((se=v.value.cart_loyalty_button)==null?void 0:se.cart_loyalty_button_text)||"Программа лояльности").replace(/\S+/g,$e=>$e.length>15?$e.slice(0,15)+"...":$e)}),ve=()=>{de.value=!de.value,q.value.length},ar=()=>{let pe=$.value?+y.value.toFixed(2):Math.floor(y.value)||0;pe>Me.value&&(pe=Me.value),pe!==y.value&&i.setBonus(pe)};r.watchEffect(()=>{ar(),i.setBonus(C.value===0?0:$.value?+y.value.toFixed(2):Math.floor(y.value))});const ye=()=>O.value.map(pe=>({id:pe.id,front_item_id:pe.idSystem,is_fake:!!pe.is_fake,is_od_united_product:!!pe.is_od_united_product,removals:pe.removals??null,amount:pe.amount,size:pe.size,modifiers:pe.modifiers??[],group_modifiers:pe.group_modifiers??[]})),{makeCreateOrderRequest:br}=df(),qr=r.computed(()=>ye()),Dt=r.computed(()=>{var pe,se,$e,Ae;return w.configPage.qr_menu&&((se=(pe=v.value)==null?void 0:pe.comments)==null?void 0:se.qr_is_order_comment_required)||w.configPage.kiosk_menu&&((Ae=($e=v.value)==null?void 0:$e.comments)==null?void 0:Ae.kiosk_is_order_comment_required)}),Ar=()=>{var pe,se;return!(Dt.value&&((se=(pe=q.value)==null?void 0:pe.trim())==null?void 0:se.length)<1&&j.value)||m.isTableService&&m.hasOrder?!1:(u.showNotification("Обязательно перед созданием заказа укажите комментарий к заказу"),j.value.focus(),K.value=!0,Ot.animate(j.value.parentElement,{x:[0,-10,0,10,0]},{duration:.1,repeat:2}),!0)},dn=async()=>{var pe,se,$e;if(w.configPage.qr_menu&&!T.value&&v.value.qr_auth_required!==!1){Q.push(`/${ee.params.orgId}/register`);return}if(!(Dt.value&&Ar())){if(m.isTableService){if((pe=m.data)!=null&&pe.available_extend||m.hasOrder){u.showNotification("Для данного стола уже был создан заказ."),m.refresh();return}if(m.hasOrder)p.open("cart-extend-confirm");else try{D.value=!0,await l.confirmOrder(De.value),u.deleteCart(),m.refresh(),Q.push({name:"order-ts"})}catch(Ae){u.showNotification((($e=(se=Ae==null?void 0:Ae.response)==null?void 0:se.data)==null?void 0:$e.user_friendly_message)||"Ошибка при создании заказа"),m.refresh(),D.value=!1,at()}return}if(w.configPage.qr_menu||V.value.length<=1){D.value=!0,await lo(De.value,_t.value).then(Ae=>{re.value&&Ae.url&&w.configPage.qr_menu&&window.location.replace(Ae.url)});return}return Z.value=!Z.value}},Ri=()=>{Z.value=!1},Rn=async()=>{var se,$e,Ae,zt,An;R.value=0;const pe={items:[...ye()],comment:q.value,combos:[]};m.id&&(pe.table=m.id),(se=w.configPage)!=null&&se.kiosk_menu&&(($e=u.selectedOrderType)!=null&&$e.id)&&(pe.order_type_id=(Ae=u.selectedOrderType)==null?void 0:Ae.id);try{I.value=!0;const ct=await l.calculateDiscount(pe,w.configPage.kiosk_menu,!!w.configPage.userData||!!T.value,o.signal);if(!O.value)return;O.value.forEach(Pe=>{const qt=ct.items.find(Ye=>Ye.front_item_id===Pe.idSystem);if(qt&&(Pe.group_modifiers.forEach(Ye=>{const Ct=qt.group_modifiers.find(Nt=>Nt.group===Ye.group);Ct&&Ye.modifiers.forEach(Nt=>{const pt=Ct.modifiers.find(ze=>ze.id===Nt.id);if(pt&&Number(Nt.price)!==Number(pt==null?void 0:pt.new_price)){const ze=(pt.discounts||[]).reduce((un,Wn)=>un+=+Wn.discount,0);ce.value+=ze,Nt.new_price=Nt.price,Nt.price=Number(pt==null?void 0:pt.new_price),Nt.total_new_price=Number(pt.total_new_price)}})}),Pe.modifiers.forEach(Ye=>{const Ct=qt.modifiers.find(Nt=>Nt.id===Ye.id);if(Ct&&Number(Ye.price)!==Number(Ct==null?void 0:Ct.new_price)){const Nt=(Ct.discounts||[]).reduce((pt,ze)=>pt+=+ze.discount,0);ce.value+=Nt,Ye.new_price=Ye.price,Ye.price=Number(Ct==null?void 0:Ct.new_price),Ye.total_new_price=Number(Ct.total_new_price)}}),Pe.price!==Number(qt.new_price))){const Ye=(qt.discounts||[]).reduce((Ct,Nt)=>Ct+=+Nt.discount,0);ce.value=ce.value+Ye,Pe.new_price=Pe.price,Pe.price=qt.new_price,Pe.discounts=qt.discounts,Pe.total_new_price=Number(qt.total_new_price)}}),O.value=[...O.value],ce.value!==0&&(C.value=ct.total_cart_price)}catch(ct){if(I.value=!1,!Ze.isCancel(ct))throw u.showNotification(((An=(zt=ct==null?void 0:ct.response)==null?void 0:zt.data)==null?void 0:An.user_friendly_message)||"Скидки временно недоступны"),ct}},Ut=async()=>{var se,$e;let pe=D.value;D.value=!0;try{await l.extendOrder([...ye()]),u.deleteCart(),m.refreshOrder(),Q.push({name:"order-ts"})}catch(Ae){throw u.showNotification((($e=(se=Ae==null?void 0:Ae.response)==null?void 0:se.data)==null?void 0:$e.user_friendly_message)||"Не удалось дополнить заказ"),Ae}finally{D.value=pe}},Bi=async()=>{var pe;if(!(Dt.value&&Ar())){De.value=null,o=new AbortController,D.value=!0;try{be.value&&await Rn(),L.value={front_type:xe};const se={paymentMethodId:xe.value,items:qr.value,comment:q.value,isAuthorized:!!w.configPage.userData||!!T,signal:o==null?void 0:o.signal},$e=await br({...w.configPage,resetDiscounts:at},se);De.value=(pe=$e==null?void 0:$e.data)==null?void 0:pe.id,G.value=!1}catch(se){console.log("[cart](createOrder)",se),!Ze.isCancel(se)&&m.isTableService&&m.refresh(),D.value=!1,at()}}},Sr=()=>{var pe;return w.configPage.qr_menu&&["АВТОРИЗОВАТЬСЯ ДЛЯ ЗАКАЗА"].includes(w.textPaymentBtn.toUpperCase())&&!T.value&&v.value.qr_auth_required!==!1?Q.push(`/${ee.params.orgId}/register`):m.isTableService&&((pe=m.data)!=null&&pe.available_extend)?p.open("cart-extend-confirm"):G.value?Bi():dn()},Oo=()=>{var pe;(pe=T.value)!=null&&pe.balance?T.value.balance>0&&(H.value=!H.value):u.showNotification("У Вас пока нет бонусов")};r.onMounted(async()=>{i.loadCart(),U.value=null,C.value=null,R.value=0,at()}),r.onUnmounted(()=>{o&&(o==null||o.abort(),o=null),D.value=!1,De.value=null,U.value=null,C.value=null,R.value=0,O.value.splice(0,O.value.length,...O.value.map(i.makeProductFullyReactive))});const ht=r.computed(()=>w.configPage.qr_menu?N.value.qr_order_minimum_price||0:w.configPage.kiosk_menu&&N.value.kiosk_order_minimum_price||0),me=r.computed(()=>{var pe;return["АВТОРИЗОВАТЬСЯ ДЛЯ ЗАКАЗА"].includes(w.textPaymentBtn.toUpperCase())?!1:m.isTableService&&m.hasOrder&&!((pe=m.data)!=null&&pe.available_extend)||ht.value>x.value&&!m.hasOrder||I.value||D.value||O.value.length===0?!0:(U.value=null,D.value)}),bt=r.computed(()=>{var pe;return((pe=O.value)==null?void 0:pe.reduce((se,$e)=>se+$e.amount,0))||0}),tt=r.computed(()=>{var pe;return(pe=T.value)==null?void 0:pe.phone});r.watch(q,pe=>{var se;return((se=pe==null?void 0:pe.trim())==null?void 0:se.length)&&(K.value=!1)}),r.watch([bt,tt,()=>u.selectedOrderType],()=>{bt.value===0&&(o=null),o==null||o.abort(),D.value=!1});const at=()=>{G.value=!0,i.setBonus(0),O.value.splice(0,O.value.length,...O.value.map(i.makeProductFullyReactive)),ce.value=0,C.value=null,R.value=0};return r.watch([()=>i.cartProducts_lib,tt,bt,()=>u.selectedOrderType],pe=>{if(Ce.value>0){Ce.value--;return}pe&&!I.value&&(H.value=!1,at(),Ce.value=1),I.value=!1},{deep:!0}),(pe,se)=>{var $e,Ae,zt,An,ct,Pe,qt,Ye,Ct,Nt,pt;return r.openBlock(),r.createElementBlock(r.Fragment,null,[r.createElementVNode("div",Pf,[r.createVNode(wf,{onConfirm:It}),r.createVNode(Ef,{onConfirm:Ut}),r.createVNode(da,{visible:r.unref(u).isDrawerOpen,"onUpdate:visible":se[0]||(se[0]=ze=>r.unref(u).isDrawerOpen=ze)},{default:r.withCtx(()=>[r.createVNode(fa)]),_:1},8,["visible"]),r.createElementVNode("header",Lf,[w.configPage.kiosk_menu?(r.openBlock(),r.createElementBlock("div",Ff,[r.createElementVNode("div",Vf,[r.createElementVNode("div",{class:r.normalizeClass(["arrow_wrapper",{arrow_wrapper_kso:w.configPage.kiosk_menu}]),onClick:Ie},[r.createVNode(_r,{class:"cart_header_back_button"}),w.configPage.kiosk_menu?(r.openBlock(),r.createElementBlock("span",Uf,"Назад")):r.createCommentVNode("",!0)],2)]),it.value&&it.value.show?(r.openBlock(),r.createElementBlock("div",zf,[Dt.value?r.createCommentVNode("",!0):(r.openBlock(),r.createBlock(an,{key:0,style:r.normalizeStyle({visibility:!oe.value&&r.unref(O).length>0?"visible":"hidden"}),class:r.normalizeClass({button_kso_comment:a.configPage.kiosk_menu}),textButtonDefault:q.value.length>0?"Редактировать":it.value&&it.value.fieldName||"",onClick:()=>oe.value=!oe.value,id:"button_kso_comment"},null,8,["style","class","textButtonDefault","onClick"]))])):r.createCommentVNode("",!0),r.createElementVNode("div",{class:r.normalizeClass({cart_header_wrapper:w.configPage.kiosk_menu})},[(r.unref(v).kiosk_show_loyalty_card_button||r.unref(v).kiosk_show_loyalty_phone_input_button)&&!w.config_qr?(r.openBlock(),r.createElementBlock("button",{key:0,class:"buttonDefaultWrapper button_payment_cart button_payment_cart_loyal",style:r.normalizeStyle({marginRight:($e=r.unref(v).cart_loyalty_button)!=null&&$e.cart_loyalty_button_sticker?`${Math.ceil(r.unref(rt)/2+10)}px`:"",paddingRight:(Ae=r.unref(v).cart_loyalty_button)!=null&&Ae.cart_loyalty_button_sticker?0:""}),onClick:se[1]||(se[1]=(...ze)=>r.unref(u).openDrawer&&r.unref(u).openDrawer(...ze))},[r.createElementVNode("p",{class:"cart_loyal_program",style:r.normalizeStyle({marginRight:`${Math.ceil(r.unref(rt)/2)}px`})},r.toDisplayString(Qe.value),5),(zt=r.unref(v).cart_loyalty_button)!=null&&zt.cart_loyalty_button_sticker?(r.openBlock(),r.createElementBlock("div",{key:0,ref_key:"stickerLoyality",ref:X,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,Hf)],4)):(r.openBlock(),r.createBlock(mf,{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",Gf,[r.createElementVNode("div",{class:"arrow_wrapper",onClick:Ie},[r.createVNode(_r,{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:w.config_qr?0:"10px",paddingRight:w.config_qr?"10px":0})},[r.createElementVNode("div",Wf,[r.createElementVNode("p",null,[r.createVNode(ft,{price:Ve.value.energy_amount,duration:800},null,8,["price"]),se[9]||(se[9]=r.createTextVNode(" г",-1))]),se[10]||(se[10]=r.createElementVNode("p",{class:"cart_info_name"},"Килокалории",-1))]),r.createElementVNode("div",Xf,[r.createElementVNode("p",null,[r.createVNode(ft,{price:Ve.value.proteins_amount,duration:900},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",$f,[r.createElementVNode("p",null,[r.createVNode(ft,{price:Ve.value.fat_amount,duration:1e3},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",jf,[r.createElementVNode("p",null,[r.createVNode(ft,{price:Ve.value.carbohydrates_amount,duration:1100},null,8,["price"]),se[15]||(se[15]=r.createTextVNode(" г",-1))]),se[16]||(se[16]=r.createElementVNode("p",{class:"cart_info_name"},"Углеводы",-1))])],4)):r.createCommentVNode("",!0)],2),a.configPage.kiosk_menu&&r.unref(u).orderTypes.length>1?(r.openBlock(),r.createElementBlock("div",qf,[r.createElementVNode("ul",Zf,[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(r.unref(u).orderTypes,ze=>{var un,Wn;return r.openBlock(),r.createElementBlock("li",{key:ze.id,class:"cart-tab","data-active":ze.id===((un=r.unref(u).selectedOrderType)==null?void 0:un.id),onClick:Zt=>r.unref(u).selectedOrderType=ze},[ze.id===((Wn=r.unref(u).selectedOrderType)==null?void 0:Wn.id)?(r.openBlock(),r.createBlock(r.unref(Ot.motion).div,{key:0,class:"cart-underline","layout-id":"cart-underline",id:"cart-underline"})):r.createCommentVNode("",!0),r.createElementVNode("span",null,r.toDisplayString(ze.name),1)],8,Yf)}),128))])])):r.createCommentVNode("",!0)]),(Dt.value||oe.value)&&a.configPage.kiosk_menu&&((An=r.unref(O))!=null&&An.length)?(r.openBlock(),r.createElementBlock("div",Kf,[r.createElementVNode("div",Qf,[r.withDirectives(r.createElementVNode("textarea",{ref_key:"commentEl",ref:j,class:"comment_order",placeholder:it.value&&it.value.placeholder||"Ваш комментарий к заказу...",name:"commentKso",maxlength:"50","aria-invalid":K.value,"onUpdate:modelValue":se[2]||(se[2]=ze=>q.value=ze)},null,8,Jf),[[r.vModelText,q.value]]),r.createElementVNode("p",eh,r.toDisplayString(q.value.length+" / 50"),1)]),Dt.value?r.createCommentVNode("",!0):(r.openBlock(),r.createBlock(an,{key:0,textButtonDefault:"Сохранить",onClick:ot,class:"button_bonus_cart"}))])):r.createCommentVNode("",!0),(Dt.value||de.value)&&a.config_qr&&((ct=r.unref(O))!=null&&ct.length)&&!(r.unref(m).isTableService&&r.unref(m).hasOrder)?(r.openBlock(),r.createElementBlock("div",th,[r.createElementVNode("div",nh,[r.withDirectives(r.createElementVNode("textarea",{ref_key:"commentEl",ref:j,class:"comment_order",placeholder:it.value&&it.value.placeholder||"Ваш комментарий к заказу...",name:"commentQr",maxlength:"50","aria-invalid":K.value,"onUpdate:modelValue":se[3]||(se[3]=ze=>q.value=ze)},null,8,rh),[[r.vModelText,q.value]]),r.createElementVNode("p",ih,r.toDisplayString(q.value.length+" / 50"),1)]),Dt.value?r.createCommentVNode("",!0):(r.openBlock(),r.createBlock(an,{key:0,textButtonDefault:"Сохранить",onClick:ve,class:"button_bonus_cart"}))])):r.createCommentVNode("",!0),a.config_qr&&it.value&&it.value.show&&!(r.unref(m).isTableService&&r.unref(m).hasOrder)?(r.openBlock(),r.createElementBlock("div",oh,[!Dt.value&&!de.value&&r.unref(O).length>0?(r.openBlock(),r.createBlock(an,{key:0,textButtonDefault:q.value.length>0?"Редактировать":it.value.fieldName||"",onClick:()=>de.value=!de.value,id:"button_comments"},null,8,["textButtonDefault","onClick"])):r.createCommentVNode("",!0)])):r.createCommentVNode("",!0),r.unref(m).isTableService&&((Pe=r.unref(m).data)!=null&&Pe.number.toString())?(r.openBlock(),r.createElementBlock("div",{key:3,class:"table_order_table_wrapper",onClick:se[4]||(se[4]=ze=>r.unref(m).order&&r.unref(Q).push({name:"order-ts"}))},[r.createElementVNode("p",sh,r.toDisplayString(`Стол № ${(qt=r.unref(m).data)==null?void 0:qt.number}`),1),(Ye=r.unref(m).order)!=null&&Ye.id?(r.openBlock(),r.createElementBlock("p",ah,r.toDisplayString(`Заказ ${r.unref(m).order.plugin_order.number}`),1)):r.createCommentVNode("",!0)])):r.createCommentVNode("",!0),r.createElementVNode("div",lh,[r.unref(m).hasOrder&&((Nt=(Ct=r.unref(m).order)==null?void 0:Ct.items)!=null&&Nt.length)&&ge.value?(r.openBlock(!0),r.createElementBlock(r.Fragment,{key:0},r.renderList(r.unref(m).order.items,ze=>(r.openBlock(),r.createBlock(bo,{key:ze.idSystem,cardItem:ze},null,8,["cardItem"]))),128)):r.createCommentVNode("",!0),(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(r.unref(O),ze=>(r.openBlock(),r.createBlock(ua,{key:ze.idSystem,cardItem:ze,onDelete:un=>It(ze.idSystem)},null,8,["cardItem","onDelete"]))),128))]),r.createElementVNode("div",ch,[H.value&&!r.unref(G)?(r.openBlock(),r.createElementBlock("p",dh,[se[17]||(se[17]=r.createTextVNode(" Списать ",-1)),r.withDirectives(r.createElementVNode("input",{type:"number",placeholder:"0",style:r.normalizeStyle({maxWidth:`${r.unref(y).toString().length||1}em`}),disabled:r.unref(T)===null||((pt=r.unref(T))==null?void 0:pt.balance)===0,"onUpdate:modelValue":se[5]||(se[5]=ze=>r.isRef(y)?y.value=ze:null),onInput:ar,min:"0",max:r.unref(Me),step:".01",onKeypress:Ue},null,44,uh),[[r.vModelText,r.unref(y),void 0,{number:!0}]]),se[18]||(se[18]=r.createTextVNode(" бонусов ",-1))])):r.createCommentVNode("",!0),H.value&&!r.unref(G)?(r.openBlock(),r.createElementBlock("p",fh,"У вас есть "+r.toDisplayString(r.unref(T)?r.unref(T).balance:0)+" B",1)):r.createCommentVNode("",!0),H.value&&!r.unref(G)?r.withDirectives((r.openBlock(),r.createElementBlock("input",{key:2,type:"range",class:"footer_range","onUpdate:modelValue":se[6]||(se[6]=ze=>r.isRef(y)?y.value=ze:null),step:$.value?".01":"1",min:0,max:r.unref(Me)},null,8,hh)),[[r.vModelText,r.unref(y),void 0,{number:!0}]]):r.createCommentVNode("",!0),r.createElementVNode("ul",mh,[H.value&&!r.unref(G)?(r.openBlock(),r.createElementBlock("li",gh,[se[20]||(se[20]=r.createElementVNode("p",null,"Сумма заказа:",-1)),r.createElementVNode("p",null,[r.createVNode(ft,{price:r.unref(C),fixedFloat:2},null,8,["price"]),se[19]||(se[19]=r.createTextVNode(" ₽",-1))])])):r.createCommentVNode("",!0),H.value&&!r.unref(G)?(r.openBlock(),r.createElementBlock("li",ph,[se[22]||(se[22]=r.createElementVNode("p",null,"Будет оплачено бонусами:",-1)),r.createElementVNode("p",null,[r.createVNode(ft,{price:r.unref(y),fixedFloat:2},null,8,["price"]),se[21]||(se[21]=r.createTextVNode(" Б",-1))])])):r.createCommentVNode("",!0),r.unref(R)!==0?(r.openBlock(),r.createElementBlock("li",xh,[r.createElementVNode("p",wh,r.toDisplayString(r.unref(R)>0?"Надбавка":"Скидка")+": ",1),r.createElementVNode("p",_h,[r.createVNode(ft,{price:Math.abs(r.unref(R)),fixedFloat:2},null,8,["price"]),se[23]||(se[23]=r.createTextVNode(" ₽",-1))])])):ce.value!==0?(r.openBlock(),r.createElementBlock("li",Ch,[r.createElementVNode("p",Eh,r.toDisplayString(ce.value>0?"Надбавка":"Скидка")+": ",1),r.createElementVNode("p",yh,[r.createVNode(ft,{price:Math.abs(ce.value),fixedFloat:2},null,8,["price"]),se[24]||(se[24]=r.createTextVNode(" ₽",-1))])])):r.createCommentVNode("",!0),r.unref(m).isTableService&&r.unref(m).order?(r.openBlock(),r.createElementBlock("li",bh,[se[26]||(se[26]=r.createElementVNode("p",null,"Сумма заказа:",-1)),r.createElementVNode("p",null,[r.createVNode(ft,{price:r.unref(m).order.total_cost,fixedFloat:2},null,8,["price"]),se[25]||(se[25]=r.createTextVNode(" ₽",-1))])])):r.createCommentVNode("",!0),r.unref(m).isTableService&&r.unref(m).order?(r.openBlock(),r.createElementBlock("li",Ah,[se[28]||(se[28]=r.createElementVNode("p",null,"К счёту добавится:",-1)),r.createElementVNode("p",null,[r.createVNode(ft,{price:r.unref(C),fixedFloat:2},null,8,["price"]),se[27]||(se[27]=r.createTextVNode(" ₽",-1))])])):r.createCommentVNode("",!0),r.createElementVNode("li",null,[se[31]||(se[31]=r.createElementVNode("p",{class:"accept_field"},"Итого к оплате:",-1)),r.unref(m).isTableService&&r.unref(m).order?(r.openBlock(),r.createElementBlock("p",Sh,[r.createVNode(ft,{price:r.unref(m).order.total_cost+r.unref(C),fixedFloat:2},null,8,["price"]),se[29]||(se[29]=r.createTextVNode(" ₽",-1))])):(r.openBlock(),r.createElementBlock("p",Ih,[r.createVNode(ft,{price:r.unref(C)-r.unref(y),fixedFloat:2},null,8,["price"]),se[30]||(se[30]=r.createTextVNode(" ₽",-1))]))])]),ht.value&&ht.value>r.unref(x)&&!r.unref(m).hasOrder?(r.openBlock(),r.createElementBlock("div",Nh,[se[32]||(se[32]=r.createTextVNode(" Минимальная сумма заказа ",-1)),r.createVNode(ft,{price:ht.value,fixedFloat:2},null,8,["price"]),r.createTextVNode(" "+r.toDisplayString(r.unref(N).currency_symbol)+". Для оформления заказа необходимо добавить товаров на сумму ",1),r.createVNode(ft,{price:ht.value-r.unref(x),fixedFloat:2},null,8,["price"]),r.createTextVNode(" "+r.toDisplayString(r.unref(N).currency_symbol),1)])):r.createCommentVNode("",!0),r.createElementVNode("div",Th,[r.unref(T)&&!r.unref(G)&&!r.unref(m).isTableService?(r.openBlock(),r.createBlock(an,{key:0,textButtonDefault:r.unref(v).bonuses_button_name||"Бонусы",onClick:Oo,class:"button_bonus_cart"},null,8,["textButtonDefault"])):r.createCommentVNode("",!0),r.createVNode(an,{textButtonDefault:et.value,onClick:Sr,class:"button_payment_cart",disabled:me.value},null,8,["textButtonDefault","disabled"])])])]),r.unref(m).isTableService?r.createCommentVNode("",!0):(r.openBlock(),r.createBlock(cf,{key:0,orderNumber:r.unref(M),pageNumber:1},null,8,["orderNumber"])),r.createVNode(Ei,{visible:r.unref(F),"onUpdate:visible":se[7]||(se[7]=ze=>r.isRef(F)?F.value=ze:null),textNotificationDefault:r.unref(P).textNotification,backgroundColor:r.unref(v).accent_color?r.unref(v).accent_color:"#FF6D2E",buttonAccept:null},null,8,["visible","textNotificationDefault","backgroundColor"]),r.createVNode(xo,{modelValue:r.unref(Z),"onUpdate:modelValue":se[8]||(se[8]=ze=>r.isRef(Z)?Z.value=ze:null),class:"product_card_sheet","snap-points":["80%"]},{default:r.withCtx(()=>{var ze;return[r.createVNode(a1,{"config-page":a.configPage,comment:q.value,"cart-items":qr.value,"is-authorized":!!w.configPage.userData||!!r.unref(T),"order-id":De.value,signal:(ze=r.unref(o))==null?void 0:ze.signal,onSelectPayment:Ri},null,8,["config-page","comment","cart-items","is-authorized","order-id","signal"])]}),_:1},8,["modelValue"])],64)}}}),Rh={},Bh={viewBox:"0 0 24 24"};function Oh(a,l){return r.openBlock(),r.createElementBlock("svg",Bh,[...l[0]||(l[0]=[r.createElementVNode("path",{d:"M18 6L6 18M6 6l12 12"},null,-1)])])}const Mh=Xe(Rh,[["render",Oh]]),Dh={class:"retry_screen"},vh={class:"retry_all_in_screen"},Ph={class:"retry_content"},Lh={class:"retry_icon_wrap"},Fh={class:"retry_icon_circle"},Vh={class:"retry_error_x"},Uh=r.defineComponent({__name:"RetryPage",setup(a){const l=Mt(),o=Te.useRouter(),i=Te.useRoute(),u=()=>{l.notificationData_lib.textNotification="",l.is_notification_lib=!1,o.replace(`/${i.params.orgId}/`)};return(f,m)=>(r.openBlock(),r.createElementBlock("section",Dh,[r.createElementVNode("div",vh,[r.createElementVNode("main",Ph,[r.createElementVNode("div",Lh,[r.createElementVNode("div",Fh,[m[0]||(m[0]=r.createElementVNode("div",{class:"retry_loader_mini"},null,-1)),r.createElementVNode("div",Vh,[r.createVNode(Mh)])])]),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))])]))}}),zh={class:"table_order_wrapper"},Hh={class:"table_order_header_content"},Gh={class:"table_order_kbju_qr_wrapper"},Wh={class:"table_order_qr_button_wrapper"},Xh={key:0,class:"table_order_header",style:{paddingRight:"10px"}},$h={class:"table_order_header_info"},jh={class:"table_order_header_info"},qh={class:"table_order_header_info"},Zh={class:"table_order_header_info"},Yh={key:0,class:"table_order_table_wrapper"},Kh={class:"table_order_desk_number"},Qh={class:"table_order_indent_number"},Jh={class:"table_order_cards"},e2={class:"table_order_footer_wrapper"},t2={key:0,class:"footer_title"},n2=["disabled","max"],r2={key:1,class:"footer_sales"},i2=["step","max"],o2={class:"list_price"},s2={key:0},a2={key:1},l2={key:2},c2={key:3},d2={class:"accept_field"},u2={key:3,class:"wrapper_footer_table_order_btn"},f2=Xe(r.defineComponent({__name:"TableOrderPage",setup(a){const l=st(),o=Gr(),i=Rt(),u=Fn(),{countBonus:f}=we.storeToRefs(l),{itemThemes:m}=we.storeToRefs(i),p=Te.useRouter(),w=Te.useRoute(),x=yn.create(),C=r.ref(!1),y=r.ref(!1),N=r.ref(!1),O=r.ref(!1),T=r.ref(!1),v=r.computed(()=>C.value||!u.hasOrder),D=r.computed(()=>{var P,L;const V={energy_amount:0,proteins_amount:0,fat_amount:0,carbohydrates_amount:0};return((L=(P=u.order)==null?void 0:P.items)==null?void 0:L.reduce((re,Q)=>(Q!=null&&Q.nutrition&&(re.energy_amount+=(Q.nutrition.energy_amount||0)*(Q.amount||0),re.proteins_amount+=(Q.nutrition.proteins_amount||0)*(Q.amount||0),re.fat_amount+=(Q.nutrition.fat_amount||0)*(Q.amount||0),re.carbohydrates_amount+=(Q.nutrition.carbohydrates_amount||0)*(Q.amount||0)),re),V))||V}),U=yt.computedAsync(async V=>{var re;const P=new AbortController;if(V(()=>P.abort()),!y.value||!((re=l.profile)!=null&&re.balance))return 0;const L=await x.maxPayByBonuses(u.order.id,!1,l.profile,P.signal);return L!=null&&L.by_bonuses?(N.value=L.non_integers_allowed||!1,Math.min(u.order.remaining_amount,l.profile.balance,L.by_bonuses)):0},0,{shallow:!0}),M=()=>{T.value=!0},R=()=>p.push(`/${w.params.orgId}/`),F=async()=>{var V,P;C.value=!0;try{const L=await lo(u.order.id,"YOOKASSA");L.url&&window.location.replace(L.url)}catch(L){throw o.showNotification(((P=(V=L==null?void 0:L.response)==null?void 0:V.data)==null?void 0:P.user_friendly_message)||"Ошибка при оплате заказа"),L}finally{C.value=!1}},G=V=>{(N.value?["a","A","+","-","."]:["a","A","+","-",".",","]).includes(V.key)&&V.preventDefault()},Z=()=>{let V=N.value?+f.value.toFixed(2):Math.floor(f.value)||0;V>U.value&&(V=U.value),V!==f.value&&l.setBonus(V)};return(V,P)=>{var L,re,Q,ee,X,H,I,$;return r.openBlock(),r.createElementBlock("div",zh,[r.createElementVNode("header",Hh,[r.createElementVNode("div",Gh,[r.createElementVNode("div",Wh,[r.createElementVNode("div",{class:"arrow_wrapper",onClick:R},[r.createVNode(_r,{class:"table_order_header_back_button"})])]),r.unref(m).show_nutrition_in_cart?(r.openBlock(),r.createElementBlock("div",Xh,[r.createElementVNode("div",$h,[r.createElementVNode("p",null,[r.createVNode(ft,{price:D.value.energy_amount,duration:800},null,8,["price"]),P[2]||(P[2]=r.createTextVNode(" г ",-1))]),P[3]||(P[3]=r.createElementVNode("p",{class:"table_order_info_name"},"Килокалории",-1))]),r.createElementVNode("div",jh,[r.createElementVNode("p",null,[r.createVNode(ft,{price:D.value.proteins_amount,duration:900},null,8,["price"]),P[4]||(P[4]=r.createTextVNode(" г ",-1))]),P[5]||(P[5]=r.createElementVNode("p",{class:"table_order_info_name"},"Белки",-1))]),r.createElementVNode("div",qh,[r.createElementVNode("p",null,[r.createVNode(ft,{price:D.value.fat_amount,duration:1e3},null,8,["price"]),P[6]||(P[6]=r.createTextVNode(" г ",-1))]),P[7]||(P[7]=r.createElementVNode("p",{class:"table_order_info_name"},"Жиры",-1))]),r.createElementVNode("div",Zh,[r.createElementVNode("p",null,[r.createVNode(ft,{price:D.value.carbohydrates_amount,duration:1100},null,8,["price"]),P[8]||(P[8]=r.createTextVNode(" г ",-1))]),P[9]||(P[9]=r.createElementVNode("p",{class:"table_order_info_name"},"Углеводы",-1))])])):r.createCommentVNode("",!0)])]),(L=r.unref(u).order)!=null&&L.id?(r.openBlock(),r.createElementBlock("div",Yh,[r.createElementVNode("p",Kh,r.toDisplayString(`Стол № ${(re=r.unref(u).data)==null?void 0:re.number}`),1),r.createElementVNode("p",Qh,r.toDisplayString(`Заказ ${r.unref(u).order.plugin_order.number}`),1)])):r.createCommentVNode("",!0),r.createElementVNode("div",Jh,[(ee=(Q=r.unref(u).order)==null?void 0:Q.items)!=null&&ee.length?(r.openBlock(!0),r.createElementBlock(r.Fragment,{key:0},r.renderList(r.unref(u).order.items,j=>(r.openBlock(),r.createBlock(bo,{key:j.idSystem,cardItem:j},null,8,["cardItem"]))),128)):r.createCommentVNode("",!0)]),r.createElementVNode("div",e2,[y.value?(r.openBlock(),r.createElementBlock("p",t2,[P[10]||(P[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||((X=r.unref(l).profile)==null?void 0:X.balance)===0,"onUpdate:modelValue":P[0]||(P[0]=j=>r.isRef(f)?f.value=j:null),onInput:Z,min:"0",max:r.unref(U),step:".01",onKeypress:G},null,44,n2),[[r.vModelText,r.unref(f),void 0,{number:!0}]]),P[11]||(P[11]=r.createTextVNode(" бонусов ",-1))])):r.createCommentVNode("",!0),y.value?(r.openBlock(),r.createElementBlock("p",r2," У вас есть "+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":P[1]||(P[1]=j=>r.isRef(f)?f.value=j:null),step:N.value?".01":"1",min:0,max:r.unref(U)},null,8,i2)),[[r.vModelText,r.unref(f),void 0,{number:!0}]]):r.createCommentVNode("",!0),r.createElementVNode("ul",o2,[r.unref(u).order&&r.unref(u).order.total_cost-r.unref(u).order.remaining_amount>0?(r.openBlock(),r.createElementBlock("li",s2,[P[13]||(P[13]=r.createElementVNode("p",null,"Сумма заказа:",-1)),r.createElementVNode("p",null,[r.createVNode(ft,{price:(H=r.unref(u).order)==null?void 0:H.total_cost,fixedFloat:2},null,8,["price"]),P[12]||(P[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",a2,[P[15]||(P[15]=r.createElementVNode("p",null,"Оплачено:",-1)),r.createElementVNode("p",null,[r.createVNode(ft,{price:r.unref(u).order.total_cost-r.unref(u).order.remaining_amount,fixedFloat:2},null,8,["price"]),P[14]||(P[14]=r.createTextVNode(" ₽ ",-1))])])):r.createCommentVNode("",!0),y.value?(r.openBlock(),r.createElementBlock("li",l2,[P[17]||(P[17]=r.createElementVNode("p",null,"Будет оплачено бонусами:",-1)),r.createElementVNode("p",null,[r.createVNode(ft,{price:r.unref(f),fixedFloat:2},null,8,["price"]),P[16]||(P[16]=r.createTextVNode(" Б ",-1))])])):r.createCommentVNode("",!0),(I=r.unref(u).order)!=null&&I.remaining_amount?(r.openBlock(),r.createElementBlock("li",c2,[P[19]||(P[19]=r.createElementVNode("p",{class:"accept_field"},"Итого к оплате:",-1)),r.createElementVNode("p",d2,[r.createVNode(ft,{price:r.unref(u).order.remaining_amount-r.unref(f),fixedFloat:2},null,8,["price"]),P[18]||(P[18]=r.createTextVNode(" ₽ ",-1))])])):r.createCommentVNode("",!0)]),($=r.unref(u).order)!=null&&$.remaining_amount&&r.unref(i).itemThemes.qr_show_pay_button_ts!==!1?(r.openBlock(),r.createElementBlock("div",u2,[r.createVNode(an,{textButtonDefault:O.value?"Запросить счёт":"Оплатить заказ",onClick:O.value?M:F,class:"button_payment_cart",disabled:v.value},null,8,["textButtonDefault","onClick","disabled"])])):r.createCommentVNode("",!0)])])}}}),[["__scopeId","data-v-75fa9255"]]),h2={class:"wrapper_loader"},m2=r.defineComponent({__name:"Loader",props:{size:{type:String,default:"40px"}},setup(a){return(l,o)=>(r.openBlock(),r.createElementBlock("div",h2,[r.createElementVNode("div",{class:"loader",style:r.normalizeStyle({width:a.size})},null,4)]))}}),g2=Xe(r.defineComponent({__name:"AnimationLoader",props:{id:{}},setup(a){const l=r.ref(!0);return r.watch(()=>l.value,()=>{l.value=!1,setTimeout(()=>{l.value=!0},0)}),(o,i)=>(r.openBlock(),r.createElementBlock("div",{class:"opacity-animation",key:a.id},[r.renderSlot(o.$slots,"opacityLoader",{},void 0,!0)]))}}),[["__scopeId","data-v-c6b97942"]]),p2={key:0},x2={class:"card__main__wrapper"},w2={key:0,class:"folder_content_top"},_2={key:0,class:"loader_card_main"},C2=["src","alt"],E2={class:"card_title_price_wrapper"},y2={class:"title"},b2={key:0,class:"price"},A2={key:1},S2={key:0,class:"card_button_add_wrapper"},xa=Xe(r.defineComponent({__name:"CardMain",props:{data:{},activeTags:{},is_group:{type:Boolean},parent:{},isLoading:{type:Boolean},selectGroupChild:{type:Function},takeCurrentCard:{type:Function}},setup(a){Rt();const l=st(),o=Lt(),{is_18_above_content:i,is18Allowed:u,notificationData_lib:f}=we.storeToRefs(l),{isDesktop:m}=Un(),p=a,w=(N,O)=>{var D,U,M;const T={id:N.id,is_fake:N.is_fake||!1,is_od_united_product:N.is_od_united_product||!1,amount:N.amount||1,name:N.name,image_link:N.image_link,price:N.price,old_price:N.price,size:void 0,sizes:[],modifiers:[],groups:N.groups,group_modifiers:[],energy_amount:N.energy_amount??0,proteins_amount:N.proteins_amount??0,fat_amount:N.fat_amount??0,carbohydrates_amount:N.carbohydrates_amount??0},v=!((D=N.modifiers)!=null&&D.length)&&!((U=N.group_modifiers)!=null&&U.length)&&!((M=N.sizes)!=null&&M.length);if(o.isUpSale=!1,N.adult&&!u.value){i.value=!0,v&&(f.value.fastAdd=T);return}if(v){l.addToCart(T);return}if(N.amount||(N.amount=1),p.is_group&&p.selectGroupChild){p.selectGroupChild({...N,parent:p.parent,child:O.child_groups});return}p.takeCurrentCard&&p.takeCurrentCard(O.id)},x=N=>{if(p.is_group&&p.selectGroupChild){N={...N,parent:p.parent,child:N.child_groups},p.selectGroupChild(N);return}if(N.adult&&!u.value){i.value=!0;return}p.takeCurrentCard&&p.takeCurrentCard(N.id)},C=r.computed(()=>p.activeTags.every(N=>p.data.tags.includes(N))),{mediaUrl:y}=Tn(()=>p.data.id+"_image",()=>p.data.image_link);return(N,O)=>{var T;return((T=p.activeTags)==null?void 0:T.length)===0||C.value||p.is_group?(r.openBlock(),r.createElementBlock("div",p2,[r.createVNode(g2,{id:p.data.id},{opacityLoader:r.withCtx(()=>[r.createElementVNode("div",x2,[a.is_group?(r.openBlock(),r.createElementBlock("div",w2)):r.createCommentVNode("",!0),r.createElementVNode("div",{onClick:O[0]||(O[0]=v=>x(p.data)),class:r.normalizeClass(["card__main",{card__main_folder:a.is_group}])},[a.isLoading?(r.openBlock(),r.createElementBlock("div",_2,[r.createVNode(m2)])):(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,C2),r.createElementVNode("div",E2,[r.createElementVNode("p",y2,r.toDisplayString(a.data.name),1),a.is_group?r.createCommentVNode("",!0):(r.openBlock(),r.createElementBlock("p",b2,r.toDisplayString(r.unref(hr)(a.data))+" ₽",1))])],2))],2),r.unref(m)?r.createCommentVNode("",!0):(r.openBlock(),r.createElementBlock("div",A2,[a.is_group?r.createCommentVNode("",!0):(r.openBlock(),r.createElementBlock("div",S2,[r.createElementVNode("div",{onClick:O[1]||(O[1]=v=>w(a.data,p.data)),class:"add_button"},[...O[2]||(O[2]=[r.createElementVNode("div",{class:"image_add_button"},null,-1)])])]))]))])]),_:1},8,["id"])])):r.createCommentVNode("",!0)}}}),[["__scopeId","data-v-bfc53e47"]]),I2=["id","onClick"],N2=Xe(r.defineComponent({__name:"GroupMain",props:{menuGroup:{},idActiveGroup:{},activeTakeGroup:{type:Function}},setup(a){const{shouldUseDragScroll:l}=Un(),o=r.ref(null);return(i,u)=>a.menuGroup.length?r.withDirectives((r.openBlock(),r.createElementBlock("ul",{key:0,class:"main__menu",ref_key:"scrollGroup",ref:o},[r.createVNode(ho,{axis:"x",behavior:"smooth",container:o.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:w=>{a.activeTakeGroup&&a.activeTakeGroup(m.id,p),f(w)},style:r.normalizeStyle(a.idActiveGroup==m.id?{fontFamily:"Bounded"}:{})},r.toDisplayString(m.name),13,I2))),128))]),_:1},8,["container","idActive"])])),[[r.unref(Wr),r.unref(l)?{}:!1]]):r.createCommentVNode("",!0)}}),[["__scopeId","data-v-aa0ca388"]]),T2=["id","onClick"],k2=Xe(r.defineComponent({__name:"TagsMain",props:{menuTags:{default:()=>[]},groupIndex:{default:null},isSolo:{type:Boolean,default:!1},currentActiveTag:{},activeTakeTags:{type:Function,default:void 0},activeTakeTagsSolo:{type:Function,default:void 0}},setup(a){const l=a,{shouldUseDragScroll:o}=Un(),i=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:i},[r.createVNode(ho,{axis:"x",behavior:"smooth",container:i.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,(w,x)=>(r.openBlock(),r.createElementBlock("li",{key:x,id:`scrolling${w}`,onClick:C=>{a.activeTakeTags&&(a.groupIndex||a.groupIndex===0)?a.activeTakeTags(w,a.groupIndex):a.activeTakeTagsSolo&&a.activeTakeTagsSolo(w),p(C)},class:r.normalizeClass({main__filter_active:(u.value??[]).includes(w)})},r.toDisplayString(w),11,T2))),128))]),_:1},8,["container","idActive"])])),[[r.unref(Wr),r.unref(o)?{}:!1]]):r.createCommentVNode("",!0)}}),[["__scopeId","data-v-afba730a"]]),R2=["data-id"],B2=["src"],O2=["src"],M2=Xe(r.defineComponent({__name:"DrumItem",props:{group:{},index:{},active:{type:Boolean}},setup(a){const l=a,{mediaUrl:o}=Tn(()=>{var i,u;return(i=l.group)!=null&&i.video_link?`${l.group.id}_video`:(u=l.group)!=null&&u.image_link?`${l.group.id}_image`:null});return(i,u)=>a.group?(r.openBlock(),r.createElementBlock("div",{key:0,class:r.normalizeClass(["drum_item",{active:l.active}]),"data-id":a.group.id},[a.group.video_link?r.withDirectives((r.openBlock(),r.createElementBlock("video",{key:r.unref(o),loop:"",autoplay:"",muted:"",playsinline:"",class:"drum_img"},[r.createElementVNode("source",{src:r.unref(o)||"",type:"video/webm"},null,8,B2)])),[[r.unref(Xr)]]):(r.openBlock(),r.createElementBlock("img",{key:1,class:"drum_img",src:r.unref(o)||""},null,8,O2)),r.createElementVNode("p",null,r.toDisplayString(a.group.name),1)],10,R2)):r.createCommentVNode("",!0)}}),[["__scopeId","data-v-2b994529"]]),D2={},v2={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 P2(a,l){return r.openBlock(),r.createElementBlock("svg",v2,[...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 L2=Xe(D2,[["render",P2]]),F2={class:"recommendation_wrapper"},V2={class:"recommendation_header"},U2={class:"recommendation_info"},z2=Xe(r.defineComponent({__name:"Recommendation",props:{closeCurrentCard:{},openCurrentCard:{}},setup(a){const l=Lt(),{isUpSale:o,dataUpSale:i}=we.storeToRefs(l),u=()=>{o.value=!1};return r.onUnmounted(()=>{i.value=null}),(f,m)=>(r.openBlock(),r.createElementBlock("div",F2,[r.createElementVNode("div",V2,[m[0]||(m[0]=r.createElementVNode("p",{class:"header_title"},"Часто берут вместе",-1)),r.createElementVNode("div",{class:"header_close",onClick:u},[r.createVNode(L2,{class:"close_icon"})])]),r.createElementVNode("div",U2,[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(r.unref(i),p=>(r.openBlock(),r.createBlock(xa,{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"]]),H2=r.defineComponent({__name:"Blackout",props:{data:{type:Boolean}},setup(a){const l=a;return r.watch(()=>l.data,o=>{document.body.style.overflow=o?"hidden":""}),()=>{}}}),G2={class:"wrapper_modal"},W2={class:"card_modal"},X2=Xe(r.defineComponent({__name:"ModalWindows",props:{visible:{type:Boolean}},setup(a){const l=a,o=Lt(),{isUpSale:i}=we.storeToRefs(o),u=()=>{i.value=!1};return(f,m)=>(r.openBlock(),r.createElementBlock(r.Fragment,null,[r.createVNode(H2,{data:l.visible},null,8,["data"]),r.createElementVNode("div",{class:"black_modal",onClick:u}),r.createElementVNode("div",G2,[r.createElementVNode("div",W2,[r.renderSlot(f.$slots,"default",{},void 0,!0)])])],64))}}),[["__scopeId","data-v-ec2b2c4d"]]);var _e;(function(a){a[a.QR_CODE=0]="QR_CODE",a[a.AZTEC=1]="AZTEC",a[a.CODABAR=2]="CODABAR",a[a.CODE_39=3]="CODE_39",a[a.CODE_93=4]="CODE_93",a[a.CODE_128=5]="CODE_128",a[a.DATA_MATRIX=6]="DATA_MATRIX",a[a.MAXICODE=7]="MAXICODE",a[a.ITF=8]="ITF",a[a.EAN_13=9]="EAN_13",a[a.EAN_8=10]="EAN_8",a[a.PDF_417=11]="PDF_417",a[a.RSS_14=12]="RSS_14",a[a.RSS_EXPANDED=13]="RSS_EXPANDED",a[a.UPC_A=14]="UPC_A",a[a.UPC_E=15]="UPC_E",a[a.UPC_EAN_EXTENSION=16]="UPC_EAN_EXTENSION"})(_e||(_e={}));var wa=new Map([[_e.QR_CODE,"QR_CODE"],[_e.AZTEC,"AZTEC"],[_e.CODABAR,"CODABAR"],[_e.CODE_39,"CODE_39"],[_e.CODE_93,"CODE_93"],[_e.CODE_128,"CODE_128"],[_e.DATA_MATRIX,"DATA_MATRIX"],[_e.MAXICODE,"MAXICODE"],[_e.ITF,"ITF"],[_e.EAN_13,"EAN_13"],[_e.EAN_8,"EAN_8"],[_e.PDF_417,"PDF_417"],[_e.RSS_14,"RSS_14"],[_e.RSS_EXPANDED,"RSS_EXPANDED"],[_e.UPC_A,"UPC_A"],[_e.UPC_E,"UPC_E"],[_e.UPC_EAN_EXTENSION,"UPC_EAN_EXTENSION"]]),_a;(function(a){a[a.UNKNOWN=0]="UNKNOWN",a[a.URL=1]="URL"})(_a||(_a={}));function $2(a){return Object.values(_e).includes(a)}var Ai;(function(a){a[a.SCAN_TYPE_CAMERA=0]="SCAN_TYPE_CAMERA",a[a.SCAN_TYPE_FILE=1]="SCAN_TYPE_FILE"})(Ai||(Ai={}));var j2=function(){function a(){}return a.GITHUB_PROJECT_URL="https://github.com/mebjas/html5-qrcode",a.SCAN_DEFAULT_FPS=2,a.DEFAULT_DISABLE_FLIP=!1,a.DEFAULT_REMEMBER_LAST_CAMERA_USED=!0,a.DEFAULT_SUPPORTED_SCAN_TYPE=[Ai.SCAN_TYPE_CAMERA,Ai.SCAN_TYPE_FILE],a}(),Ca=function(){function a(l,o){this.format=l,this.formatName=o}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}(),Ea=function(){function a(){}return a.createFromText=function(l){var o={text:l};return{decodedText:l,result:o}},a.createFromQrcodeResult=function(l){return{decodedText:l.text,result:l}},a}(),Ao;(function(a){a[a.UNKWOWN_ERROR=0]="UNKWOWN_ERROR",a[a.IMPLEMENTATION_ERROR=1]="IMPLEMENTATION_ERROR",a[a.NO_CODE_FOUND_ERROR=2]="NO_CODE_FOUND_ERROR"})(Ao||(Ao={}));var q2=function(){function a(){}return a.createFrom=function(l){return{errorMessage:l,type:Ao.UNKWOWN_ERROR}},a}(),Z2=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,o){(this.verbose||o===!0)&&console.error(l)},a.prototype.logErrors=function(l){if(l.length===0)throw"Logger#logError called without arguments";this.verbose&&console.error(l)},a}();function zn(a){return typeof a>"u"||a===null}var Er=function(){function a(){}return a.codeParseError=function(l){return"QR code parse error, error = ".concat(l)},a.errorGettingUserMedia=function(l){return"Error getting userMedia, error = ".concat(l)},a.onlyDeviceSupportedError=function(){return"The device doesn't support navigator.mediaDevices , only supported cameraIdOrConfig in this case is deviceId parameter (string)."},a.cameraStreamingNotSupported=function(){return"Camera streaming not supported by the browser."},a.unableToQuerySupportedDevices=function(){return"Unable to query supported devices, unknown error."},a.insecureContextCameraQueryError=function(){return"Camera access is only supported in secure context like https or localhost."},a.scannerPaused=function(){return"Scanner paused"},a}(),ya=function(){function a(){}return a.isMediaStreamConstraintsValid=function(l,o){if(typeof l!="object"){var i=typeof l;return o.logError("videoConstraints should be of type object, the "+"object passed is of type ".concat(i,"."),!0),!1}for(var u=["autoGainControl","channelCount","echoCancellation","latency","noiseSuppression","sampleRate","sampleSize","volume"],f=new Set(u),m=Object.keys(l),p=0,w=m;p<w.length;p++){var x=w[p];if(f.has(x))return o.logError("".concat(x," is not supported videoConstaints."),!0),!1}return!0},a}(),So={exports:{}};(function(a,l){(function(o,i){i(l)})(wr,function(o){function i(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 w=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 w{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 N{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 N(this.binarizer.createBinarizer(c))}isRotateSupported(){return this.binarizer.getLuminanceSource().isRotateSupported()}rotateCounterClockwise(){const e=this.binarizer.getLuminanceSource().rotateCounterClockwise();return new N(this.binarizer.createBinarizer(e))}rotateCounterClockwise45(){const e=this.binarizer.getLuminanceSource().rotateCounterClockwise45();return new N(this.binarizer.createBinarizer(e))}toString(){try{return this.getBlackMatrix().toString()}catch{return""}}}class O extends x{static getChecksumInstance(){return new O}}O.kind="ChecksumException";class T{constructor(e){this.source=e}getLuminanceSource(){return this.source}getWidth(){return this.source.getWidth()}getHeight(){return this.source.getHeight()}}class v{static arraycopy(e,t,n,s,c){for(;c--;)n[s++]=e[t++]}static currentTimeMillis(){return Date.now()}}class D extends x{}D.kind="IndexOutOfBoundsException";class U extends D{constructor(e=void 0,t=void 0){super(t),this.index=e,this.message=t}}U.kind="ArrayIndexOutOfBoundsException";class M{static fill(e,t){for(let n=0,s=e.length;n<s;n++)e[n]=t}static fillWithin(e,t,n,s){M.rangeCheck(e.length,t,n);for(let c=t;c<n;c++)e[c]=s}static rangeCheck(e,t,n){if(t>n)throw new y("fromIndex("+t+") > toIndex("+n+")");if(t<0)throw new U(t);if(n>e)throw new U(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=M.numberComparator);let s=0,c=e.length-1;for(;s<=c;){const d=c+s>>1,h=n(t,e[d]);if(h>0)s=d+1;else if(h<0)c=d-1;else return d}return-s-1}static numberComparator(e,t){return e-t}}class R{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)}}R.MIN_VALUE_32_BITS=-2147483648,R.MAX_VALUE=Number.MAX_SAFE_INTEGER;class F{constructor(e,t){e===void 0?(this.size=0,this.bits=new Int32Array(1)):(this.size=e,t==null?this.bits=F.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=F.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+R.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+R.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,_=(2<<(d<s?31:t&31))-(1<<h);c[d]|=_}}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 F))return!1;const t=e;return this.size===t.size&&M.equals(this.bits,t.bits)}hashCode(){return 31*this.size+M.hashCode(this.bits)}toString(){let e="";for(let t=0,n=this.size;t<n;t++)t&7||(e+=" "),e+=this.get(t)?"X":".";return e}clone(){return new F(this.size,this.bits.slice())}}var G;(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"})(G||(G={}));var Z=G;class V extends x{static getFormatInstance(){return new V}}V.kind="FormatException";var P;(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"})(P||(P={}));class L{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,L.VALUE_IDENTIFIER_TO_ECI.set(e,this),L.NAME_TO_ECI.set(n,this);const c=this.values;for(let d=0,h=c.length;d!==h;d++){const g=c[d];L.VALUES_TO_ECI.set(g,this)}for(const d of s)L.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=L.VALUES_TO_ECI.get(e);if(t===void 0)throw new V("incorect value");return t}static getCharacterSetECIByName(e){const t=L.NAME_TO_ECI.get(e);if(t===void 0)throw new V("incorect value");return t}equals(e){if(!(e instanceof L))return!1;const t=e;return this.getName()===t.getName()}}L.VALUE_IDENTIFIER_TO_ECI=new Map,L.VALUES_TO_ECI=new Map,L.NAME_TO_ECI=new Map,L.Cp437=new L(P.Cp437,Int32Array.from([0,2]),"Cp437"),L.ISO8859_1=new L(P.ISO8859_1,Int32Array.from([1,3]),"ISO-8859-1","ISO88591","ISO8859_1"),L.ISO8859_2=new L(P.ISO8859_2,4,"ISO-8859-2","ISO88592","ISO8859_2"),L.ISO8859_3=new L(P.ISO8859_3,5,"ISO-8859-3","ISO88593","ISO8859_3"),L.ISO8859_4=new L(P.ISO8859_4,6,"ISO-8859-4","ISO88594","ISO8859_4"),L.ISO8859_5=new L(P.ISO8859_5,7,"ISO-8859-5","ISO88595","ISO8859_5"),L.ISO8859_6=new L(P.ISO8859_6,8,"ISO-8859-6","ISO88596","ISO8859_6"),L.ISO8859_7=new L(P.ISO8859_7,9,"ISO-8859-7","ISO88597","ISO8859_7"),L.ISO8859_8=new L(P.ISO8859_8,10,"ISO-8859-8","ISO88598","ISO8859_8"),L.ISO8859_9=new L(P.ISO8859_9,11,"ISO-8859-9","ISO88599","ISO8859_9"),L.ISO8859_10=new L(P.ISO8859_10,12,"ISO-8859-10","ISO885910","ISO8859_10"),L.ISO8859_11=new L(P.ISO8859_11,13,"ISO-8859-11","ISO885911","ISO8859_11"),L.ISO8859_13=new L(P.ISO8859_13,15,"ISO-8859-13","ISO885913","ISO8859_13"),L.ISO8859_14=new L(P.ISO8859_14,16,"ISO-8859-14","ISO885914","ISO8859_14"),L.ISO8859_15=new L(P.ISO8859_15,17,"ISO-8859-15","ISO885915","ISO8859_15"),L.ISO8859_16=new L(P.ISO8859_16,18,"ISO-8859-16","ISO885916","ISO8859_16"),L.SJIS=new L(P.SJIS,20,"SJIS","Shift_JIS"),L.Cp1250=new L(P.Cp1250,21,"Cp1250","windows-1250"),L.Cp1251=new L(P.Cp1251,22,"Cp1251","windows-1251"),L.Cp1252=new L(P.Cp1252,23,"Cp1252","windows-1252"),L.Cp1256=new L(P.Cp1256,24,"Cp1256","windows-1256"),L.UnicodeBigUnmarked=new L(P.UnicodeBigUnmarked,25,"UnicodeBigUnmarked","UTF-16BE","UnicodeBig"),L.UTF8=new L(P.UTF8,26,"UTF8","UTF-8"),L.ASCII=new L(P.ASCII,Int32Array.from([27,170]),"ASCII","US-ASCII"),L.Big5=new L(P.Big5,28,"Big5"),L.GB18030=new L(P.GB18030,29,"GB18030","GB2312","EUC_CN","GBK"),L.EUC_KR=new L(P.EUC_KR,30,"EUC_KR","EUC-KR");class re extends x{}re.kind="UnsupportedOperationException";class Q{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!Q.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 L?e:L.getCharacterSetECIByName(e)}static decodeFallback(e,t){const n=this.encodingCharacterSet(t);if(Q.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(L.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(L.UTF8)||e.equals(L.ISO8859_1)||e.equals(L.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 Q.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,_=0,E=0,A=0,S=0,B=0,z=0,W=0,Y=0,ie=0;const ue=e.length>3&&e[0]===239&&e[1]===187&&e[2]===191;for(let fe=0;fe<n&&(s||c||d);fe++){const le=e[fe]&255;d&&(h>0?le&128?h--:d=!1:le&128&&(le&64?(h++,le&32?(h++,le&16?(h++,le&8?d=!1:E++):_++):g++):d=!1)),s&&(le>127&&le<160?s=!1:le>159&&(le<192||le===215||le===247)&&ie++),c&&(A>0?le<64||le===127||le>252?c=!1:A--:le===128||le===160||le>239?c=!1:le>160&&le<224?(S++,z=0,B++,B>W&&(W=B)):le>127?(A++,B=0,z++,z>Y&&(Y=z)):(B=0,z=0))}return d&&h>0&&(d=!1),c&&A>0&&(c=!1),d&&(ue||g+_+E>0)?ee.UTF8:c&&(ee.ASSUME_SHIFT_JIS||W>=3||Y>=3)?ee.SHIFT_JIS:s&&c?W===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,_,E,A){if(d==="%%")return"%";if(t[++n]===void 0)return;d=_?parseInt(_.substr(1)):void 0;let S=E?parseInt(E.substr(1)):void 0,B;switch(A){case"s":B=t[n];break;case"c":B=t[n][0];break;case"f":B=parseFloat(t[n]).toFixed(d);break;case"p":B=parseFloat(t[n]).toPrecision(d);break;case"e":B=parseFloat(t[n]).toExponential(d);break;case"x":B=parseInt(t[n]).toString(S||16);break;case"d":B=parseFloat(parseInt(t[n],S||10).toPrecision(d)).toFixed(0);break}B=typeof B=="object"?JSON.stringify(B):(+B).toString(S);let z=parseInt(g),W=g&&g[0]+""=="0"?"0":" ";for(;B.length<z;)B=h!==void 0?B+W:W+B;return B}let c=/%(-)?(0?[0-9]+)?([.][0-9]+)?([#][0-9]+)?([scfpexd%])/g;return e.replace(c,s)}static getBytes(e,t){return Q.encode(e,t)}static getCharCode(e,t=0){return e.charCodeAt(t)}static getCharAt(e){return String.fromCharCode(e)}}ee.SHIFT_JIS=L.SJIS.getName(),ee.GB2312="GB2312",ee.ISO88591=L.ISO8859_1.getName(),ee.EUC_JP="EUC_JP",ee.UTF8=L.UTF8.getName(),ee.PLATFORM_DEFAULT_ENCODING=ee.UTF8,ee.ASSUME_SHIFT_JIS=!1;class X{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 H{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 H(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,_=0;for(;_<e.length;)if(e.charAt(_)===`
12
- `||e.charAt(_)==="\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++}_++}else if(e.substring(_,_+t.length)===t)_+=t.length,s[c]=!0,c++;else if(e.substring(_,_+n.length)===n)_+=n.length,s[c]=!1,c++;else throw new y("illegal character encountered: "+e.substring(_));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 H(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 F(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 _=0;_<n;_++)s[h+_]^=g[_]}}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 _=t;_<d;_++){const E=_*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 F(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 F(e),s=new F(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 _=0;_<t;_++)for(let E=0;E<n;E++){const A=s[_*n+E];if(A!==0){if(_<d&&(d=_),_>g&&(g=_),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 H))return!1;const t=e;return this.width===t.width&&this.height===t.height&&this.rowSize===t.rowSize&&M.equals(this.bits,t.bits)}hashCode(){let e=this.width;return e=31*e+this.width,e=31*e+this.height,e=31*e+this.rowSize,e=31*e+M.hashCode(this.bits),e}toString(e="X ",t=" ",n=`
13
- `){return this.buildToString(e,t,n)}buildToString(e,t,n){let s=new X;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 H(this.width,this.height,this.rowSize,this.bits.slice())}}class I extends x{static getNotFoundInstance(){return new I}}I.kind="NotFoundException";class $ extends T{constructor(e){super(e),this.luminances=$.EMPTY,this.buckets=new Int32Array($.LUMINANCE_BUCKETS)}getBlackRow(e,t){const n=this.getLuminanceSource(),s=n.getWidth();t==null||t.getSize()<s?t=new F(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)>>$.LUMINANCE_SHIFT]++;const h=$.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,_=c[1]&255;for(let E=1;E<s-1;E++){const A=c[E+1]&255;(_*4-g-A)/2<h&&t.set(E),g=_,_=A}}return t}getBlackMatrix(){const e=this.getLuminanceSource(),t=e.getWidth(),n=e.getHeight(),s=new H(t,n);this.initArrays(t);const c=this.buckets;for(let g=1;g<5;g++){const _=Math.floor(n*g/5),E=e.getRow(_,this.luminances),A=Math.floor(t*4/5);for(let S=Math.floor(t/5);S<A;S++){const B=E[S]&255;c[B>>$.LUMINANCE_SHIFT]++}}const d=$.estimateBlackPoint(c),h=e.getMatrix();for(let g=0;g<n;g++){const _=g*t;for(let E=0;E<t;E++)(h[_+E]&255)<d&&s.set(E,g)}return s}createBinarizer(e){return new $(e)}initArrays(e){this.luminances.length<e&&(this.luminances=new Uint8ClampedArray(e));const t=this.buckets;for(let n=0;n<$.LUMINANCE_BUCKETS;n++)t[n]=0}static estimateBlackPoint(e){const t=e.length;let n=0,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 I;let g=d-1,_=-1;for(let E=d-1;E>s;E--){const A=E-s,S=A*A*(d-E)*(n-e[E]);S>_&&(g=E,_=S)}return g<<$.LUMINANCE_SHIFT}}$.LUMINANCE_BITS=5,$.LUMINANCE_SHIFT=8-$.LUMINANCE_BITS,$.LUMINANCE_BUCKETS=1<<$.LUMINANCE_BITS,$.EMPTY=Uint8ClampedArray.from([0]);class j extends ${constructor(e){super(e),this.matrix=null}getBlackMatrix(){if(this.matrix!==null)return this.matrix;const e=this.getLuminanceSource(),t=e.getWidth(),n=e.getHeight();if(t>=j.MINIMUM_DIMENSION&&n>=j.MINIMUM_DIMENSION){const s=e.getMatrix();let c=t>>j.BLOCK_SIZE_POWER;t&j.BLOCK_SIZE_MASK&&c++;let d=n>>j.BLOCK_SIZE_POWER;n&j.BLOCK_SIZE_MASK&&d++;const h=j.calculateBlackPoints(s,c,d,t,n),g=new H(t,n);j.calculateThresholdForBlock(s,c,d,t,n,h,g),this.matrix=g}else this.matrix=super.getBlackMatrix();return this.matrix}createBinarizer(e){return new j(e)}static calculateThresholdForBlock(e,t,n,s,c,d,h){const g=c-j.BLOCK_SIZE,_=s-j.BLOCK_SIZE;for(let E=0;E<n;E++){let A=E<<j.BLOCK_SIZE_POWER;A>g&&(A=g);const S=j.cap(E,2,n-3);for(let B=0;B<t;B++){let z=B<<j.BLOCK_SIZE_POWER;z>_&&(z=_);const W=j.cap(B,2,t-3);let Y=0;for(let ue=-2;ue<=2;ue++){const fe=d[S+ue];Y+=fe[W-2]+fe[W-1]+fe[W]+fe[W+1]+fe[W+2]}const ie=Y/25;j.thresholdBlock(e,z,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<j.BLOCK_SIZE;h++,g+=c)for(let _=0;_<j.BLOCK_SIZE;_++)(e[g+_]&255)<=s&&d.set(t+_,n+h)}static calculateBlackPoints(e,t,n,s,c){const d=c-j.BLOCK_SIZE,h=s-j.BLOCK_SIZE,g=new Array(n);for(let _=0;_<n;_++){g[_]=new Int32Array(t);let E=_<<j.BLOCK_SIZE_POWER;E>d&&(E=d);for(let A=0;A<t;A++){let S=A<<j.BLOCK_SIZE_POWER;S>h&&(S=h);let B=0,z=255,W=0;for(let ie=0,ue=E*s+S;ie<j.BLOCK_SIZE;ie++,ue+=s){for(let fe=0;fe<j.BLOCK_SIZE;fe++){const le=e[ue+fe]&255;B+=le,le<z&&(z=le),le>W&&(W=le)}if(W-z>j.MIN_DYNAMIC_RANGE)for(ie++,ue+=s;ie<j.BLOCK_SIZE;ie++,ue+=s)for(let fe=0;fe<j.BLOCK_SIZE;fe++)B+=e[ue+fe]&255}let Y=B>>j.BLOCK_SIZE_POWER*2;if(W-z<=j.MIN_DYNAMIC_RANGE&&(Y=z/2,_>0&&A>0)){const ie=(g[_-1][A]+2*g[_][A-1]+g[_-1][A-1])/4;z<ie&&(Y=ie)}g[_][A]=Y}}return g}}j.BLOCK_SIZE_POWER=3,j.BLOCK_SIZE=1<<j.BLOCK_SIZE_POWER,j.BLOCK_SIZE_MASK=j.BLOCK_SIZE-1,j.MINIMUM_DIMENSION=j.BLOCK_SIZE*5,j.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 X;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 K 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 K(this.delegate.crop(e,t,n,s))}isRotateSupported(){return this.delegate.isRotateSupported()}invert(){return this.delegate}rotateCounterClockwise(){return new K(this.delegate.rotateCounterClockwise())}rotateCounterClockwise45(){return new K(this.delegate.rotateCounterClockwise45())}}class oe extends q{constructor(e){super(e.width,e.height),this.canvas=e,this.tempCanvasElement=null,this.buffer=oe.makeBufferFromCanvasImageData(e)}static makeBufferFromCanvasImageData(e){const t=e.getContext("2d").getImageData(0,0,e.width,e.height);return oe.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*oe.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=oe.makeBufferFromCanvasImageData(t),this}invert(){return new K(this)}}oe.DEGREE_TO_RADIANS=Math.PI/180;class de{constructor(e,t,n){this.deviceId=e,this.label=t,this.kind="videoinput",this.groupId=n||void 0}toJSON(){return{kind:this.kind,groupId:this.groupId,deviceId:this.deviceId,label:this.label}}}var ce=(globalThis||wr||self||window||void 0)&&(globalThis||wr||self||window||void 0).__awaiter||function(b,e,t,n){function s(c){return c instanceof t?c:new t(function(d){d(c)})}return new(t||(t=Promise))(function(c,d){function h(E){try{_(n.next(E))}catch(A){d(A)}}function g(E){try{_(n.throw(E))}catch(A){d(A)}}function _(E){E.done?c(E.value):s(E.value).then(h,g)}_((n=n.apply(b,e||[])).next())})};class Ce{constructor(e,t=500,n){this.reader=e,this.timeBetweenScansMillis=t,this._hints=n,this._stopContinuousDecode=!1,this._stopAsyncDecode=!1,this._timeBetweenDecodingAttempts=0}get hasNavigator(){return typeof navigator<"u"}get isMediaDevicesSuported(){return this.hasNavigator&&!!navigator.mediaDevices}get canEnumerateDevices(){return!!(this.isMediaDevicesSuported&&navigator.mediaDevices.enumerateDevices)}get timeBetweenDecodingAttempts(){return this._timeBetweenDecodingAttempts}set timeBetweenDecodingAttempts(e){this._timeBetweenDecodingAttempts=e<0?0:e}set hints(e){this._hints=e||null}get hints(){return this._hints}listVideoInputDevices(){return ce(this,void 0,void 0,function*(){if(!this.hasNavigator)throw new Error("Can't enumerate devices, navigator is not present.");if(!this.canEnumerateDevices)throw new Error("Can't enumerate devices, method not supported.");const e=yield navigator.mediaDevices.enumerateDevices(),t=[];for(const n of e){const 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 ce(this,void 0,void 0,function*(){return(yield this.listVideoInputDevices()).map(t=>new de(t.deviceId,t.label))})}findDeviceById(e){return ce(this,void 0,void 0,function*(){const t=yield this.listVideoInputDevices();return t?t.find(n=>n.deviceId===e):null})}decodeFromInputVideoDevice(e,t){return ce(this,void 0,void 0,function*(){return yield this.decodeOnceFromVideoDevice(e,t)})}decodeOnceFromVideoDevice(e,t){return ce(this,void 0,void 0,function*(){this.reset();let n;e?n={deviceId:{exact:e}}:n={facingMode:"environment"};const s={video:n};return yield this.decodeOnceFromConstraints(s,t)})}decodeOnceFromConstraints(e,t){return ce(this,void 0,void 0,function*(){const n=yield navigator.mediaDevices.getUserMedia(e);return yield this.decodeOnceFromStream(n,t)})}decodeOnceFromStream(e,t){return ce(this,void 0,void 0,function*(){this.reset();const n=yield this.attachStreamToVideo(e,t);return yield this.decodeOnce(n)})}decodeFromInputVideoDeviceContinuously(e,t,n){return ce(this,void 0,void 0,function*(){return yield this.decodeFromVideoDevice(e,t,n)})}decodeFromVideoDevice(e,t,n){return ce(this,void 0,void 0,function*(){let 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 ce(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 ce(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 ce(this,void 0,void 0,function*(){const n=this.prepareVideoElement(t);return this.addVideoSource(n,e),this.videoElement=n,this.stream=e,yield this.playVideoOnLoadAsync(n),n})}playVideoOnLoadAsync(e){return new Promise((t,n)=>this.playVideoOnLoad(e,()=>t()))}playVideoOnLoad(e,t){this.videoEndedListener=()=>this.stopStreams(),this.videoCanPlayListener=()=>this.tryPlayVideo(e),e.addEventListener("ended",this.videoEndedListener),e.addEventListener("canplay",this.videoCanPlayListener),e.addEventListener("playing",t),this.tryPlayVideo(e)}isVideoPlaying(e){return e.currentTime>0&&!e.paused&&!e.ended&&e.readyState>2}tryPlayVideo(e){return ce(this,void 0,void 0,function*(){if(this.isVideoPlaying(e)){console.warn("Trying to play video that is already playing.");return}try{yield e.play()}catch{console.warn("It was not possible to play the video.")}})}getMediaElement(e,t){const n=document.getElementById(e);if(!n)throw new C(`element with id '${e}' not found`);if(n.nodeName.toLowerCase()!==t.toLowerCase())throw new C(`element with id '${e}' must be an ${t} element`);return n}decodeFromImage(e,t){if(!e&&!t)throw new C("either imageElement with a src set or an url must be provided");return t&&!e?this.decodeFromImageUrl(t):this.decodeFromImageElement(e)}decodeFromVideo(e,t){if(!e&&!t)throw new C("Either an element with a src set or an URL must be provided");return t&&!e?this.decodeFromVideoUrl(t):this.decodeFromVideoElement(e)}decodeFromVideoContinuously(e,t,n){if(e===void 0&&t===void 0)throw new C("Either an element with a src set or an URL must be provided");return t&&!e?this.decodeFromVideoUrlContinuously(t,n):this.decodeFromVideoElementContinuously(e,n)}decodeFromImageElement(e){if(!e)throw new C("An image element must be provided.");this.reset();const t=this.prepareImageElement(e);this.imageElement=t;let n;return this.isImageLoaded(t)?n=this.decodeOnce(t,!1,!0):n=this._decodeOnLoadImage(t),n}decodeFromVideoElement(e){const t=this._decodeFromVideoElementSetup(e);return this._decodeOnLoadVideo(t)}decodeFromVideoElementContinuously(e,t){const n=this._decodeFromVideoElementSetup(e);return this._decodeOnLoadVideoContinuously(n,t)}_decodeFromVideoElementSetup(e){if(!e)throw new C("A video element must be provided.");this.reset();const t=this.prepareVideoElement(e);return this.videoElement=t,t}decodeFromImageUrl(e){if(!e)throw new C("An URL must be provided.");this.reset();const t=this.prepareImageElement();this.imageElement=t;const n=this._decodeOnLoadImage(t);return t.src=e,n}decodeFromVideoUrl(e){if(!e)throw new C("An URL must be provided.");this.reset();const t=this.prepareVideoElement(),n=this.decodeFromVideoElement(t);return t.src=e,n}decodeFromVideoUrlContinuously(e,t){if(!e)throw new C("An URL must be provided.");this.reset();const n=this.prepareVideoElement(),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 ce(this,void 0,void 0,function*(){return yield this.playVideoOnLoadAsync(e),yield this.decodeOnce(e)})}_decodeOnLoadVideoContinuously(e,t){return ce(this,void 0,void 0,function*(){yield this.playVideoOnLoadAsync(e),this.decodeContinuously(e,t)})}isImageLoaded(e){return!(!e.complete||e.naturalWidth===0)}prepareImageElement(e){let t;return typeof e>"u"&&(t=document.createElement("img"),t.width=200,t.height=200),typeof e=="string"&&(t=this.getMediaElement(e,"img")),e instanceof HTMLImageElement&&(t=e),t}prepareVideoElement(e){let t;return!e&&typeof document<"u"&&(t=document.createElement("video"),t.width=200,t.height=200),typeof e=="string"&&(t=this.getMediaElement(e,"video")),e instanceof HTMLVideoElement&&(t=e),t.setAttribute("autoplay","true"),t.setAttribute("muted","true"),t.setAttribute("playsinline","true"),t}decodeOnce(e,t=!0,n=!0){this._stopAsyncDecode=!1;const s=(c,d)=>{if(this._stopAsyncDecode){d(new I("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 I,E=(h instanceof O||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 O||s instanceof V,d=s instanceof I;(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 oe(t),s=new j(n);return new N(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 ge{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 De;(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"})(De||(De={}));var xe=De,_t;(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"})(_t||(_t={}));var be=_t;class et{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 rt{exp(e){return this.expTable[e]}log(e){if(e===0)throw new y;return this.logTable[e]}static addOrSubtract(e,t){return e^t}}class Ve{constructor(e,t){if(t.length===0)throw new y;this.field=e;const n=t.length;if(n>1&&t[0]===0){let 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=rt.addOrSubtract(n,g)}return n}n=t[0];const s=t.length,c=this.field;for(let d=1;d<s;d++)n=rt.addOrSubtract(c.multiply(e,n),t[d]);return n}addOrSubtract(e){if(!this.field.equals(e.field))throw new y("GenericGFPolys do not have same GenericGF field");if(this.isZero())return e;if(e.isZero())return this;let t=this.coefficients,n=e.coefficients;if(t.length>n.length){const d=t;t=n,n=d}let 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]=rt.addOrSubtract(t[d-c],n[d]);return new Ve(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 _=t[g];for(let E=0;E<c;E++)d[g+E]=rt.addOrSubtract(d[g+E],h.multiply(_,s[E]))}return new Ve(h,d)}multiplyScalar(e){if(e===0)return this.field.getZero();if(e===1)return this;const t=this.coefficients.length,n=this.field,s=new Int32Array(t),c=this.coefficients;for(let d=0;d<t;d++)s[d]=n.multiply(c[d],e);return new Ve(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 Ve(d,c)}divide(e){if(!this.field.equals(e.field))throw new y("GenericGFPolys do not have same GenericGF field");if(e.isZero())throw new y("Divide by 0");const t=this.field;let n=t.getZero(),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),_=e.multiplyByMonomial(h,g),E=t.buildMonomial(h,g);n=n.addOrSubtract(E),s=s.addOrSubtract(_)}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 it extends x{}it.kind="ArithmeticException";class Me extends rt{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 Ve(this,Int32Array.from([0])),this.one=new Ve(this,Int32Array.from([1]))}getZero(){return this.zero}getOne(){return this.one}buildMonomial(e,t){if(e<0)throw new y;if(t===0)return this.zero;const n=new Int32Array(e+1);return n[0]=t,new Ve(this,n)}inverse(e){if(e===0)throw new it;return this.expTable[this.size-this.logTable[e]-1]}multiply(e,t){return e===0||t===0?0:this.expTable[(this.logTable[e]+this.logTable[t])%(this.size-1)]}getSize(){return this.size}getGeneratorBase(){return this.generatorBase}toString(){return"GF(0x"+R.toHexString(this.primitive)+","+this.size+")"}equals(e){return e===this}}Me.AZTEC_DATA_12=new Me(4201,4096,1),Me.AZTEC_DATA_10=new Me(1033,1024,1),Me.AZTEC_DATA_6=new Me(67,64,1),Me.AZTEC_PARAM=new Me(19,16,1),Me.QR_CODE_FIELD_256=new Me(285,256,0),Me.DATA_MATRIX_FIELD_256=new Me(301,256,1),Me.AZTEC_DATA_8=Me.DATA_MATRIX_FIELD_256,Me.MAXICODE_FIELD_64=Me.AZTEC_DATA_6;class Ie extends x{}Ie.kind="ReedSolomonException";class Ue extends x{}Ue.kind="IllegalStateException";class It{constructor(e){this.field=e}decode(e,t){const n=this.field,s=new Ve(n,e),c=new Int32Array(t);let d=!0;for(let B=0;B<t;B++){const z=s.evaluateAt(n.exp(B+n.getGeneratorBase()));c[c.length-1-B]=z,z!==0&&(d=!1)}if(d)return;const h=new Ve(n,c),g=this.runEuclideanAlgorithm(n.buildMonomial(t,1),h,t),_=g[0],E=g[1],A=this.findErrorLocations(_),S=this.findErrorMagnitudes(E,A);for(let B=0;B<A.length;B++){const z=e.length-1-n.log(A[B]);if(z<0)throw new Ie("Bad error location");e[z]=Me.addOrSubtract(e[z],S[B])}}runEuclideanAlgorithm(e,t,n){if(e.getDegree()<t.getDegree()){const B=e;e=t,t=B}const s=this.field;let c=e,d=t,h=s.getZero(),g=s.getOne();for(;d.getDegree()>=(n/2|0);){let B=c,z=h;if(c=d,h=g,c.isZero())throw new Ie("r_{i-1} was zero");d=B;let W=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(),fe=s.multiply(d.getCoefficient(d.getDegree()),ie);W=W.addOrSubtract(s.buildMonomial(ue,fe)),d=d.addOrSubtract(c.multiplyByMonomial(ue,fe))}if(g=W.multiply(h).addOrSubtract(z),d.getDegree()>=c.getDegree())throw new Ue("Division algorithm failed to reduce polynomial?")}const _=g.getCoefficient(0);if(_===0)throw new Ie("sigmaTilde(0) was zero");const E=s.inverse(_),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 Ie("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 _=0;_<n;_++)if(d!==_){const E=c.multiply(t[_],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 ot;(function(b){b[b.UPPER=0]="UPPER",b[b.LOWER=1]="LOWER",b[b.MIXED=2]="MIXED",b[b.DIGIT=3]="DIGIT",b[b.PUNCT=4]="PUNCT",b[b.BINARY=5]="BINARY"})(ot||(ot={}));class Qe{decode(e){this.ddata=e;let t=e.getBits(),n=this.extractBits(t),s=this.correctBits(n),c=Qe.convertBoolArrayToByteArray(s),d=Qe.getEncodedData(s),h=new et(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=ot.UPPER,s=ot.UPPER,c="",d=0;for(;d<t;)if(s===ot.BINARY){if(t-d<5)break;let h=Qe.readCode(e,d,5);if(d+=5,h===0){if(t-d<11)break;h=Qe.readCode(e,d,11)+31,d+=11}for(let g=0;g<h;g++){if(t-d<8){d=t;break}const _=Qe.readCode(e,d,8);c+=ee.castAsNonUtf8Char(_),d+=8}s=n}else{let h=s===ot.DIGIT?4:5;if(t-d<h)break;let g=Qe.readCode(e,d,h);d+=h;let _=Qe.getCharacter(s,g);_.startsWith("CTRL_")?(n=s,s=Qe.getTable(_.charAt(5)),_.charAt(6)==="L"&&(n=s)):(c+=_,s=n)}return c}static getTable(e){switch(e){case"L":return ot.LOWER;case"P":return ot.PUNCT;case"M":return ot.MIXED;case"D":return ot.DIGIT;case"B":return ot.BINARY;case"U":default:return ot.UPPER}}static getCharacter(e,t){switch(e){case ot.UPPER:return Qe.UPPER_TABLE[t];case ot.LOWER:return Qe.LOWER_TABLE[t];case ot.MIXED:return Qe.MIXED_TABLE[t];case ot.PUNCT:return Qe.PUNCT_TABLE[t];case ot.DIGIT:return Qe.DIGIT_TABLE[t];default:throw new Ue("Bad table")}}correctBits(e){let t,n;this.ddata.getNbLayers()<=2?(n=6,t=Me.AZTEC_DATA_6):this.ddata.getNbLayers()<=8?(n=8,t=Me.AZTEC_DATA_8):this.ddata.getNbLayers()<=22?(n=10,t=Me.AZTEC_DATA_10):(n=12,t=Me.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]=Qe.readCode(e,d,n);try{new It(t).decode(h,c-s)}catch(S){throw new V(S)}let g=(1<<n)-1,_=0;for(let S=0;S<s;S++){let B=h[S];if(B===0||B===g)throw new V;(B===1||B===g-1)&&_++}let E=new Array(s*n-_),A=0;for(let S=0;S<s;S++){let B=h[S];if(B===1||B===g-1)E.fill(B>1,A,A+n-1),A+=n-1;else for(let z=n-1;z>=0;--z)E[A++]=(B&1<<z)!==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*R.truncDivision(R.truncDivision(s,2)-1,15),g=s/2,_=R.truncDivision(h,2);for(let E=0;E<g;E++){let A=E+R.truncDivision(E,15);c[g-E-1]=_-A-1,c[g+E]=_+A+1}}for(let h=0,g=0;h<n;h++){let _=(n-h)*4+(t?9:12),E=h*2,A=s-1-E;for(let S=0;S<_;S++){let B=S*2;for(let z=0;z<2;z++)d[g+B+z]=e.get(c[E+z],c[E+S]),d[g+2*_+B+z]=e.get(c[E+S],c[A-z]),d[g+4*_+B+z]=e.get(c[A-z],c[A-S]),d[g+6*_+B+z]=e.get(c[A-S],c[E+z])}g+=_*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?Qe.readCode(e,t,8):Qe.readCode(e,t,n)<<8-n}static convertBoolArrayToByteArray(e){let t=new Uint8Array((e.length+7)/8);for(let n=0;n<t.length;n++)t[n]=Qe.readByte(e,8*n);return t}totalBitsInLayer(e,t){return((t?88:112)+16*e)*e}}Qe.UPPER_TABLE=["CTRL_PS"," ","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","CTRL_LL","CTRL_ML","CTRL_DL","CTRL_BS"],Qe.LOWER_TABLE=["CTRL_PS"," ","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","CTRL_US","CTRL_ML","CTRL_DL","CTRL_BS"],Qe.MIXED_TABLE=["CTRL_PS"," ","\\1","\\2","\\3","\\4","\\5","\\6","\\7","\b"," ",`
11
+ */var kn=function(){return kn=Object.assign||function(l){for(var i,s=1,u=arguments.length;s<u;s++){i=arguments[s];for(var f in i)Object.prototype.hasOwnProperty.call(i,f)&&(l[f]=i[f])}return l},kn.apply(this,arguments)};typeof SuppressedError=="function"&&SuppressedError;var rr;(function(a){var l=function(){function m(p,_,x,C){if(this.version=p,this.errorCorrectionLevel=_,this.modules=[],this.isFunction=[],p<m.MIN_VERSION||p>m.MAX_VERSION)throw new RangeError("Version value out of range");if(C<-1||C>7)throw new RangeError("Mask value out of range");this.size=p*4+17;for(var y=[],I=0;I<this.size;I++)y.push(!1);for(var I=0;I<this.size;I++)this.modules.push(y.slice()),this.isFunction.push(y.slice());this.drawFunctionPatterns();var O=this.addEccAndInterleave(x);if(this.drawCodewords(O),C==-1)for(var N=1e9,I=0;I<8;I++){this.applyMask(I),this.drawFormatBits(I);var v=this.getPenaltyScore();v<N&&(C=I,N=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 O,N;for(O=x;;O++){var v=m.getNumDataCodewords(O,_)*8,k=f.getTotalBits(p,O);if(k<=v){N=k;break}if(O>=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&&N<=m.getNumDataCodewords(O,M)*8&&(_=M)}for(var q=[],W=0,Y=p;W<Y.length;W++){var F=Y[W];i(F.mode.modeBits,4,q),i(F.numChars,F.mode.numCharCountBits(O),q);for(var L=0,V=F.getData();L<V.length;L++){var ie=V[L];q.push(ie)}}u(q.length==N);var Q=m.getNumDataCodewords(O,_)*8;u(q.length<=Q),i(0,Math.min(4,Q-q.length),q),i(0,(8-q.length%8)%8,q),u(q.length%8==0);for(var te=236;q.length<Q;te^=253)i(te,8,q);for(var G=[];G.length*8<q.length;)G.push(0);return q.forEach(function(z,T){return G[T>>>3]|=z<<7-(T&7)}),new m(O,_,G,y)},m.prototype.getModule=function(p,_){return 0<=p&&p<this.size&&0<=_&&_<this.size&&this.modules[_][p]},m.prototype.getModules=function(){return this.modules},m.prototype.drawFunctionPatterns=function(){for(var p=0;p<this.size;p++)this.setFunctionModule(6,p,p%2==0),this.setFunctionModule(p,6,p%2==0);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);for(var _=this.getAlignmentPatternPositions(),x=_.length,p=0;p<x;p++)for(var C=0;C<x;C++)p==0&&C==0||p==0&&C==x-1||p==x-1&&C==0||this.drawAlignmentPattern(_[p],_[C]);this.drawFormatBits(0),this.drawVersion()},m.prototype.drawFormatBits=function(p){for(var _=this.errorCorrectionLevel.formatBits<<3|p,x=_,C=0;C<10;C++)x=x<<1^(x>>>9)*1335;var y=(_<<10|x)^21522;u(y>>>15==0);for(var C=0;C<=5;C++)this.setFunctionModule(8,C,s(y,C));this.setFunctionModule(8,7,s(y,6)),this.setFunctionModule(8,8,s(y,7)),this.setFunctionModule(7,8,s(y,8));for(var C=9;C<15;C++)this.setFunctionModule(14-C,8,s(y,C));for(var C=0;C<8;C++)this.setFunctionModule(this.size-1-C,8,s(y,C));for(var C=8;C<15;C++)this.setFunctionModule(8,this.size-15+C,s(y,C));this.setFunctionModule(8,this.size-8,!0)},m.prototype.drawVersion=function(){if(!(this.version<7)){for(var p=this.version,_=0;_<12;_++)p=p<<1^(p>>>11)*7973;var x=this.version<<12|p;u(x>>>18==0);for(var _=0;_<18;_++){var C=s(x,_),y=this.size-11+_%3,I=Math.floor(_/3);this.setFunctionModule(y,I,C),this.setFunctionModule(I,y,C)}}},m.prototype.drawFinderPattern=function(p,_){for(var x=-4;x<=4;x++)for(var C=-4;C<=4;C++){var y=Math.max(Math.abs(C),Math.abs(x)),I=p+C,O=_+x;0<=I&&I<this.size&&0<=O&&O<this.size&&this.setFunctionModule(I,O,y!=2&&y!=4)}},m.prototype.drawAlignmentPattern=function(p,_){for(var x=-2;x<=2;x++)for(var C=-2;C<=2;C++)this.setFunctionModule(p+C,_+x,Math.max(Math.abs(C),Math.abs(x))!=1)},m.prototype.setFunctionModule=function(p,_,x){this.modules[_][p]=x,this.isFunction[_][p]=!0},m.prototype.addEccAndInterleave=function(p){var _=this.version,x=this.errorCorrectionLevel;if(p.length!=m.getNumDataCodewords(_,x))throw new RangeError("Invalid argument");for(var C=m.NUM_ERROR_CORRECTION_BLOCKS[x.ordinal][_],y=m.ECC_CODEWORDS_PER_BLOCK[x.ordinal][_],I=Math.floor(m.getNumRawDataModules(_)/8),O=C-I%C,N=Math.floor(I/C),v=[],k=m.reedSolomonComputeDivisor(y),P=0,D=0;P<C;P++){var M=p.slice(D,D+N-y+(P<O?0:1));D+=M.length;var q=m.reedSolomonComputeRemainder(M,k);P<O&&M.push(0),v.push(M.concat(q))}for(var W=[],Y=function(F){v.forEach(function(L,V){(F!=N-y||V>=O)&&W.push(L[F])})},P=0;P<v[0].length;P++)Y(P);return u(W.length==I),W},m.prototype.drawCodewords=function(p){if(p.length!=Math.floor(m.getNumRawDataModules(this.version)/8))throw new RangeError("Invalid argument");for(var _=0,x=this.size-1;x>=1;x-=2){x==6&&(x=5);for(var C=0;C<this.size;C++)for(var y=0;y<2;y++){var I=x-y,O=(x+1&2)==0,N=O?this.size-1-C:C;!this.isFunction[N][I]&&_<p.length*8&&(this.modules[N][I]=s(p[_>>>3],7-(_&7)),_++)}}u(_==p.length*8)},m.prototype.applyMask=function(p){if(p<0||p>7)throw new RangeError("Mask value out of range");for(var _=0;_<this.size;_++)for(var x=0;x<this.size;x++){var C=void 0;switch(p){case 0:C=(x+_)%2==0;break;case 1:C=_%2==0;break;case 2:C=x%3==0;break;case 3:C=(x+_)%3==0;break;case 4:C=(Math.floor(x/3)+Math.floor(_/2))%2==0;break;case 5:C=x*_%2+x*_%3==0;break;case 6:C=(x*_%2+x*_%3)%2==0;break;case 7:C=((x+_)%2+x*_%3)%2==0;break;default:throw new Error("Unreachable")}!this.isFunction[_][x]&&C&&(this.modules[_][x]=!this.modules[_][x])}},m.prototype.getPenaltyScore=function(){for(var p=0,_=0;_<this.size;_++){for(var x=!1,C=0,y=[0,0,0,0,0,0,0],I=0;I<this.size;I++)this.modules[_][I]==x?(C++,C==5?p+=m.PENALTY_N1:C>5&&p++):(this.finderPenaltyAddHistory(C,y),x||(p+=this.finderPenaltyCountPatterns(y)*m.PENALTY_N3),x=this.modules[_][I],C=1);p+=this.finderPenaltyTerminateAndCount(x,C,y)*m.PENALTY_N3}for(var I=0;I<this.size;I++){for(var x=!1,O=0,y=[0,0,0,0,0,0,0],_=0;_<this.size;_++)this.modules[_][I]==x?(O++,O==5?p+=m.PENALTY_N1:O>5&&p++):(this.finderPenaltyAddHistory(O,y),x||(p+=this.finderPenaltyCountPatterns(y)*m.PENALTY_N3),x=this.modules[_][I],O=1);p+=this.finderPenaltyTerminateAndCount(x,O,y)*m.PENALTY_N3}for(var _=0;_<this.size-1;_++)for(var I=0;I<this.size-1;I++){var N=this.modules[_][I];N==this.modules[_][I+1]&&N==this.modules[_+1][I]&&N==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(W,Y){return W+(Y?1:0)},v)}var M=this.size*this.size,q=Math.ceil(Math.abs(v*20-M*10)/M)-1;return u(0<=q&&q<=9),p+=q*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(N){return 0}),C=function(N){var v=N^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 O=I[y];C(O)}return x},m.reedSolomonMultiply=function(p,_){if(p>>>8||_>>>8)throw new RangeError("Byte out of range");for(var x=0,C=7;C>=0;C--)x=x<<1^(x>>>7)*285,x^=(_>>>C&1)*p;return u(x>>>8==0),x},m.prototype.finderPenaltyCountPatterns=function(p){var _=p[1];u(_<=this.size*3);var x=_>0&&p[2]==_&&p[3]==_*3&&p[4]==_&&p[5]==_;return(x&&p[0]>=_*4&&p[6]>=_?1:0)+(x&&p[6]>=_*4&&p[0]>=_?1:0)},m.prototype.finderPenaltyTerminateAndCount=function(p,_,x){return p&&(this.finderPenaltyAddHistory(_,x),_=0),_+=this.size,this.finderPenaltyAddHistory(_,x),this.finderPenaltyCountPatterns(x)},m.prototype.finderPenaltyAddHistory=function(p,_){_[0]==0&&(p+=this.size),_.pop(),_.unshift(p)},m.MIN_VERSION=1,m.MAX_VERSION=40,m.PENALTY_N1=3,m.PENALTY_N2=3,m.PENALTY_N3=40,m.PENALTY_N4=10,m.ECC_CODEWORDS_PER_BLOCK=[[-1,7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],[-1,13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]],m.NUM_ERROR_CORRECTION_BLOCKS=[[-1,1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],[-1,1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],[-1,1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],[-1,1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]],m}();a.QrCode=l;function i(m,p,_){if(p<0||p>31||m>>>p)throw new RangeError("Value out of range");for(var x=p-1;x>=0;x--)_.push(m>>>x&1)}function s(m,p){return(m>>>p&1)!=0}function u(m){if(!m)throw new Error("Assertion error")}var f=function(){function m(p,_,x){if(this.mode=p,this.numChars=_,this.bitData=x,_<0)throw new RangeError("Invalid argument");this.bitData=x.slice()}return m.makeBytes=function(p){for(var _=[],x=0,C=p;x<C.length;x++){var y=C[x];i(y,8,_)}return new m(m.Mode.BYTE,p.length,_)},m.makeNumeric=function(p){if(!m.isNumeric(p))throw new RangeError("String contains non-numeric characters");for(var _=[],x=0;x<p.length;){var C=Math.min(p.length-x,3);i(parseInt(p.substring(x,x+C),10),C*3+1,_),x+=C}return new m(m.Mode.NUMERIC,p.length,_)},m.makeAlphanumeric=function(p){if(!m.isAlphanumeric(p))throw new RangeError("String contains unencodable characters in alphanumeric mode");var _=[],x;for(x=0;x+2<=p.length;x+=2){var C=m.ALPHANUMERIC_CHARSET.indexOf(p.charAt(x))*45;C+=m.ALPHANUMERIC_CHARSET.indexOf(p.charAt(x+1)),i(C,11,_)}return x<p.length&&i(m.ALPHANUMERIC_CHARSET.indexOf(p.charAt(x)),6,_),new m(m.Mode.ALPHANUMERIC,p.length,_)},m.makeSegments=function(p){return p==""?[]:m.isNumeric(p)?[m.makeNumeric(p)]:m.isAlphanumeric(p)?[m.makeAlphanumeric(p)]:[m.makeBytes(m.toUtf8ByteArray(p))]},m.makeEci=function(p){var _=[];if(p<0)throw new RangeError("ECI assignment value out of range");if(p<128)i(p,8,_);else if(p<16384)i(2,2,_),i(p,14,_);else if(p<1e6)i(6,3,_),i(p,21,_);else throw new RangeError("ECI assignment value out of range");return new m(m.Mode.ECI,0,_)},m.isNumeric=function(p){return m.NUMERIC_REGEX.test(p)},m.isAlphanumeric=function(p){return m.ALPHANUMERIC_REGEX.test(p)},m.prototype.getData=function(){return this.bitData.slice()},m.getTotalBits=function(p,_){for(var x=0,C=0,y=p;C<y.length;C++){var I=y[C],O=I.mode.numCharCountBits(_);if(I.numChars>=1<<O)return 1/0;x+=4+O+I.bitData.length}return x},m.toUtf8ByteArray=function(p){p=encodeURI(p);for(var _=[],x=0;x<p.length;x++)p.charAt(x)!="%"?_.push(p.charCodeAt(x)):(_.push(parseInt(p.substring(x+1,x+3),16)),x+=2);return _},m.NUMERIC_REGEX=/^[0-9]*$/,m.ALPHANUMERIC_REGEX=/^[A-Z0-9 $%*+.\/:-]*$/,m.ALPHANUMERIC_CHARSET="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:",m}();a.QrSegment=f})(rr||(rr={})),function(a){(function(l){var i=function(){function s(u,f){this.ordinal=u,this.formatBits=f}return s.LOW=new s(0,1),s.MEDIUM=new s(1,0),s.QUARTILE=new s(2,3),s.HIGH=new s(3,2),s}();l.Ecc=i})(a.QrCode||(a.QrCode={}))}(rr||(rr={})),function(a){(function(l){var i=function(){function s(u,f){this.modeBits=u,this.numBitsCharCount=f}return s.prototype.numCharCountBits=function(u){return this.numBitsCharCount[Math.floor((u+7)/17)]},s.NUMERIC=new s(1,[10,12,14]),s.ALPHANUMERIC=new s(2,[9,11,13]),s.BYTE=new s(4,[8,16,16]),s.KANJI=new s(8,[8,10,12]),s.ECI=new s(7,[0,0,0]),s}();l.Mode=i})(a.QrSegment||(a.QrSegment={}))}(rr||(rr={}));var Cr=rr,_o="L",wo={L:Cr.QrCode.Ecc.LOW,M:Cr.QrCode.Ecc.MEDIUM,Q:Cr.QrCode.Ecc.QUARTILE,H:Cr.QrCode.Ecc.HIGH},N1=function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0}();function Co(a){return a in wo}function ma(a,l){l===void 0&&(l=0);var i=[];return a.forEach(function(s,u){var f=null;s.forEach(function(m,p){if(!m&&f!==null){i.push("M".concat(f+l," ").concat(u+l,"h").concat(p-f,"v1H").concat(f+l,"z")),f=null;return}if(p===s.length-1){if(!m)return;f===null?i.push("M".concat(p+l,",").concat(u+l," h1v1H").concat(p+l,"z")):i.push("M".concat(f+l,",").concat(u+l," h").concat(p+1-f,"v1H").concat(f+l,"z"));return}m&&f===null&&(f=p)})}),i.join("")}function ga(a,l,i,s){var u=s.width,f=s.height,m=s.x,p=s.y,_=a.length+i*2,x=Math.floor(l*.1),C=_/l,y=(u||x)*C,I=(f||x)*C,O=m==null?a.length/2-y/2:m*C,N=p==null?a.length/2-I/2:p*C,v=null;if(s.excavate){var k=Math.floor(O),P=Math.floor(N),D=Math.ceil(y+O-k),M=Math.ceil(I+N-P);v={x:k,y:P,w:D,h:M}}return{x:O,y:N,h:I,w:y,excavation:v}}function pa(a,l){return a.slice().map(function(i,s){return s<l.y||s>=l.y+l.h?i:i.map(function(u,f){return f<l.x||f>=l.x+l.w?u:!1})})}var Eo={value:{type:String,required:!0,default:""},size:{type:Number,default:100},level:{type:String,default:_o,validator:function(a){return Co(a)}},background:{type:String,default:"#fff"},foreground:{type:String,default:"#000"},margin:{type:Number,required:!1,default:0},imageSettings:{type:Object,required:!1,default:function(){return{}}},gradient:{type:Boolean,required:!1,default:!1},gradientType:{type:String,required:!1,default:"linear",validator:function(a){return["linear","radial"].indexOf(a)>-1}},gradientStartColor:{type:String,required:!1,default:"#000"},gradientEndColor:{type:String,required:!1,default:"#fff"}},T1=kn(kn({},Eo),{renderAs:{type:String,required:!1,default:"canvas",validator:function(a){return["canvas","svg"].indexOf(a)>-1}}}),k1=r.defineComponent({name:"QRCodeSvg",props:Eo,setup:function(a){var l=r.ref(0),i=r.ref(""),s,u=function(){var m=a.value,p=a.level,_=a.margin,x=_>>>0,C=Co(p)?p:_o,y=Cr.QrCode.encodeText(m,wo[C]).getModules();if(l.value=y.length+x*2,a.imageSettings.src){var I=ga(y,a.size,x,a.imageSettings);s={x:I.x+x,y:I.y+x,width:I.w,height:I.h},I.excavation&&(y=pa(y,I.excavation))}i.value=ma(y,x)},f=function(){if(!a.gradient)return null;var m=a.gradientType==="linear"?{x1:"0%",y1:"0%",x2:"100%",y2:"100%"}:{cx:"50%",cy:"50%",r:"50%",fx:"50%",fy:"50%"};return r.h(a.gradientType==="linear"?"linearGradient":"radialGradient",kn({id:"qr-gradient"},m),[r.h("stop",{offset:"0%",style:{stopColor:a.gradientStartColor}}),r.h("stop",{offset:"100%",style:{stopColor:a.gradientEndColor}})])};return u(),r.onUpdated(u),function(){return r.h("svg",{width:a.size,height:a.size,"shape-rendering":"crispEdges",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 ".concat(l.value," ").concat(l.value)},[r.h("defs",{},[f()]),r.h("rect",{width:"100%",height:"100%",fill:a.background}),r.h("path",{fill:a.gradient?"url(#qr-gradient)":a.foreground,d:i.value}),a.imageSettings.src&&r.h("image",kn({href:a.imageSettings.src},s))])}}}),R1=r.defineComponent({name:"QRCodeCanvas",props:Eo,setup:function(a,l){var i=r.ref(null),s=r.ref(null),u=function(){var m=a.value,p=a.level,_=a.size,x=a.margin,C=a.background,y=a.foreground,I=a.gradient,O=a.gradientType,N=a.gradientStartColor,v=a.gradientEndColor,k=x>>>0,P=Co(p)?p:_o,D=i.value;if(D){var M=D.getContext("2d");if(M){var q=Cr.QrCode.encodeText(m,wo[P]).getModules(),W=q.length+k*2,Y=s.value,F={x:0,y:0,width:0,height:0},L=a.imageSettings.src&&Y!=null&&Y.naturalWidth!==0&&Y.naturalHeight!==0;if(L){var V=ga(q,a.size,k,a.imageSettings);F={x:V.x+k,y:V.y+k,width:V.w,height:V.h},V.excavation&&(q=pa(q,V.excavation))}var ie=window.devicePixelRatio||1,Q=_/W*ie;if(D.height=D.width=_*ie,M.scale(Q,Q),M.fillStyle=C,M.fillRect(0,0,W,W),I){var te=void 0;O==="linear"?te=M.createLinearGradient(0,0,W,W):te=M.createRadialGradient(W/2,W/2,0,W/2,W/2,W/2),te.addColorStop(0,N),te.addColorStop(1,v),M.fillStyle=te}else M.fillStyle=y;N1?M.fill(new Path2D(ma(q,k))):q.forEach(function(G,z){G.forEach(function(T,X){T&&M.fillRect(X+k,z+k,1,1)})}),L&&M.drawImage(Y,F.x,F.y,F.width,F.height)}}};r.onMounted(u),r.onUpdated(u);var f=l.attrs.style;return function(){return r.h(r.Fragment,[r.h("canvas",kn(kn({},l.attrs),{ref:i,style:kn(kn({},f),{width:"".concat(a.size,"px"),height:"".concat(a.size,"px")})})),a.imageSettings.src&&r.h("img",{ref:s,src:a.imageSettings.src,style:{display:"none"},onLoad:u})])}}}),B1=r.defineComponent({name:"Qrcode",render:function(){var a=this.$props,l=a.renderAs,i=a.value,s=a.size,u=a.margin,f=a.level,m=a.background,p=a.foreground,_=a.imageSettings,x=a.gradient,C=a.gradientType,y=a.gradientStartColor,I=a.gradientEndColor;return r.h(l==="svg"?k1:R1,{value:i,size:s,margin:u,level:f,background:m,foreground:p,imageSettings:_,gradient:x,gradientType:C,gradientStartColor:y,gradientEndColor:I})},props:T1});const O1={},M1={viewBox:"0 0 24 24","aria-hidden":"true"};function D1(a,l){return r.openBlock(),r.createElementBlock("svg",M1,[...l[0]||(l[0]=[r.createElementVNode("path",{d:"M7 4h10a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2z"},null,-1),r.createElementVNode("path",{d:"M9 7h6"},null,-1),r.createElementVNode("path",{d:"M10 18h4"},null,-1)])])}const v1=Xe(O1,[["render",D1]]),P1={},L1={viewBox:"0 0 24 24","aria-hidden":"true"};function F1(a,l){return r.openBlock(),r.createElementBlock("svg",L1,[...l[0]||(l[0]=[r.createStaticVNode('<path d="M4 8V6a2 2 0 0 1 2-2h2"></path><path d="M20 8V6a2 2 0 0 0-2-2h-2"></path><path d="M4 16v2a2 2 0 0 0 2 2h2"></path><path d="M20 16v2a2 2 0 0 1-2 2h-2"></path><path d="M7 12h10"></path>',5)])])}const V1=Xe(P1,[["render",F1]]),U1="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20viewBox='0%200%2019.6108%2014.0107'%20width='19.610840'%20height='14.010742'%20fill='none'%20customFrame='%23000000'%3e%3cpath%20id='Форма%20'%20d='M18.3054%201.30566L6.61792%2012.639L1.30542%207.48747'%20stroke='rgb(255,255,255)'%20stroke-linecap='round'%20stroke-linejoin='round'%20stroke-width='2.5999999'/%3e%3c/svg%3e",z1={class:"wrapper_qr_page"},H1=["src"],G1={class:"modal_qr"},W1={class:"modal_qr_content"},X1={class:"wrapper_icon_qr"},$1=["src"],j1={class:"total_order_price"},q1={class:"ttl_wrapper"},Z1={class:"ttl_head"},Y1={class:"ttl_bar"},K1={class:"hint hint-anim","aria-label":"Инструкция по оплате"},Q1={class:"steps","aria-hidden":"true"},J1={class:"step is-active","data-i":"0"},ef={class:"ico"},tf={class:"step","data-i":"1"},nf={class:"ico"},rf={class:"step","data-i":"2"},of={class:"ico"},sf=["src"],af={class:"qr_border"},lf=Xe(r.defineComponent({__name:"CompletedQRCode",setup(a){const l=St(),i=Mt(),s=st(),u=Te.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(_),O())},O=()=>{s.removeFromLocalStorage(["cart","authTokensAccess","authTokensRefresh","user"]),sessionStorage.removeItem("is_adult"),u.replace({name:"home"}).then(()=>u.go(0))};r.onMounted(()=>{_=setInterval(I,1e3)}),r.onBeforeUnmount(()=>{clearInterval(_)});const{mediaUrl:N}=Tn(()=>l.itemThemes.kiosk_preloader?"preloader":null);return(v,k)=>(r.openBlock(),r.createElementBlock("div",z1,[(r.openBlock(),r.createElementBlock("video",{loop:"",autoplay:"",muted:"",playsinline:"",key:r.unref(N)},[r.createElementVNode("source",{src:r.unref(N)||"",type:"video/webm"},null,8,H1)])),k[7]||(k[7]=r.createElementVNode("div",{class:"start_img_black"},null,-1)),r.createElementVNode("div",G1,[r.createElementVNode("div",W1,[r.createElementVNode("div",X1,[r.createElementVNode("img",{src:r.unref(ha),width:"100",height:"100"},null,8,$1)]),k[6]||(k[6]=r.createElementVNode("h1",null,"Оплата по QR",-1)),r.createElementVNode("p",j1,[r.createVNode(ft,{price:y.value,fixedFloat:2},null,8,["price"]),r.createTextVNode(" "+r.toDisplayString(r.unref(s).config_lib.currency_symbol),1)]),r.createElementVNode("div",q1,[r.createElementVNode("div",Z1,[k[0]||(k[0]=r.createElementVNode("span",null,"Срок жизни QR-кода",-1)),r.createElementVNode("b",null,r.toDisplayString(x.value),1)]),r.createElementVNode("div",Y1,[r.createElementVNode("div",{class:"ttl_fill",style:r.normalizeStyle({width:`${C.value}%`})},null,4)])]),r.createElementVNode("p",K1,[r.createElementVNode("div",Q1,[r.createElementVNode("div",J1,[r.createElementVNode("div",ef,[r.createVNode(v1)]),k[1]||(k[1]=r.createElementVNode("div",{class:"txt"},"Возьмите телефон →",-1))]),k[4]||(k[4]=r.createElementVNode("div",{class:"sep"},null,-1)),r.createElementVNode("div",tf,[r.createElementVNode("div",nf,[r.createVNode(V1)]),k[2]||(k[2]=r.createElementVNode("span",{class:"txt"},"Отсканируйте QR-код",-1))]),k[5]||(k[5]=r.createElementVNode("span",{class:"sep"},"→",-1)),r.createElementVNode("div",rf,[r.createElementVNode("div",of,[r.createElementVNode("img",{src:r.unref(U1),width:"30",height:"30"},null,8,sf)]),k[3]||(k[3]=r.createElementVNode("span",{class:"txt"},"Оплатите заказ",-1))])])]),r.createElementVNode("div",af,[r.createVNode(B1,{value:r.unref(i).linkQR,size:200,level:"Q","render-as":"svg","image-settings":f},null,8,["value"])]),r.createVNode(an,{textButtonDefault:"Отменить заказ",onClick:O,class:"cancel_order_btn"})])])]))}}),[["__scopeId","data-v-bd3b4b16"]]),cf={key:0,class:"wrapper_qr"},df={key:1,class:"wrapper_qr"},uf={key:2,class:"wrapper_qr"},ff={key:3,class:"wrapper_qr"},hf=Xe(r.defineComponent({__name:"CartCompletedOrder",props:{orderNumber:{}},setup(a){const l=Mt(),i=St(),{orderNumber:s,orderCompleted_lib:u}=_e.storeToRefs(l),{mediaUrl:f}=Tn(()=>i.itemThemes.kiosk_preloader?"preloader":null);return(m,p)=>(r.openBlock(),r.createElementBlock(r.Fragment,null,[r.unref(u)&&r.unref(u)===1?(r.openBlock(),r.createElementBlock("section",cf,[r.createVNode(y1)])):r.unref(u)&&r.unref(u)===2?(r.openBlock(),r.createElementBlock("section",df,[r.createVNode(I1)])):r.createCommentVNode("",!0),r.unref(u)&&r.unref(u)===3?(r.openBlock(),r.createElementBlock("section",uf,[r.createVNode(w1,{orderNumber:r.unref(s),mediaUrl:r.unref(f)},null,8,["orderNumber","mediaUrl"])])):r.createCommentVNode("",!0),r.unref(u)&&r.unref(u)===4?(r.openBlock(),r.createElementBlock("section",ff,[r.createVNode(lf)])):r.createCommentVNode("",!0)],64))}}),[["__scopeId","data-v-3779e8ee"]]);function mf(){const a=Te.useRoute(),l=Mt(),i=st(),s=Fn(),{isButtonDisabled:u}=_e.storeToRefs(l),f=(p,_)=>{const x=s.isTableService?"tableservice":p.kiosk_menu?"kiosk":"qr",C=l.createPaymentHandler(x,p.kiosk_menu,_);return C?{...C.config,route:{params:{orgId:String(a.params.orgId)}},handler:C.handler,resetDiscounts:p.resetDiscounts,setButtonDisabled:y=>{u.value=y},on403Kiosk:()=>{localStorage.removeItem("apiKey"),i.is_showApiKey=!0}}:null};return{getCreateOrderConfig:f,makeCreateOrderRequest:async(p,_)=>{const x=f(p,_.paymentMethodId);if(x)return Pd(_.items,x,{comment:_.comment,is_authorized:_.isAuthorized,signal:_.signal})}}}const gf={},pf={class:"cart_loyal_qr",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none"};function xf(a,l){return r.openBlock(),r.createElementBlock("svg",pf,[...l[0]||(l[0]=[r.createElementVNode("path",{d:"M19 20H20M16 20H14V17M17 17H20V14H19M14 14H16M4 16.9997C4 16.0679 4 15.6019 4.15224 15.2344C4.35523 14.7443 4.74432 14.3552 5.23438 14.1522C5.60192 14 6.06786 14 6.99974 14C7.93163 14 8.39808 14 8.76562 14.1522C9.25568 14.3552 9.64467 14.7443 9.84766 15.2344C9.9999 15.6019 9.9999 16.0681 9.9999 17C9.9999 17.9319 9.9999 18.3978 9.84766 18.7654C9.64467 19.2554 9.25568 19.6447 8.76562 19.8477C8.39808 19.9999 7.93162 19.9999 6.99974 19.9999C6.06786 19.9999 5.60192 19.9999 5.23438 19.8477C4.74432 19.6447 4.35523 19.2557 4.15224 18.7656C4 18.3981 4 17.9316 4 16.9997ZM14 6.99974C14 6.06786 14 5.60192 14.1522 5.23438C14.3552 4.74432 14.7443 4.35523 15.2344 4.15224C15.6019 4 16.0679 4 16.9997 4C17.9316 4 18.3981 4 18.7656 4.15224C19.2557 4.35523 19.6447 4.74432 19.8477 5.23438C19.9999 5.60192 19.9999 6.06812 19.9999 7C19.9999 7.93188 19.9999 8.39783 19.8477 8.76537C19.6447 9.25542 19.2557 9.64467 18.7656 9.84766C18.3981 9.9999 17.9316 9.9999 16.9997 9.9999C16.0679 9.9999 15.6019 9.9999 15.2344 9.84766C14.7443 9.64467 14.3552 9.25568 14.1522 8.76562C14 8.39808 14 7.93163 14 6.99974ZM4 6.99974C4 6.06786 4 5.60192 4.15224 5.23438C4.35523 4.74432 4.74432 4.35523 5.23438 4.15224C5.60192 4 6.06786 4 6.99974 4C7.93163 4 8.39808 4 8.76562 4.15224C9.25568 4.35523 9.64467 4.74432 9.84766 5.23438C9.9999 5.60192 9.9999 6.06812 9.9999 7C9.9999 7.93188 9.9999 8.39783 9.84766 8.76537C9.64467 9.25542 9.25568 9.64467 8.76562 9.84766C8.39808 9.9999 7.93162 9.9999 6.99974 9.9999C6.06786 9.9999 5.60192 9.9999 5.23438 9.84766C4.74432 9.64467 4.35523 9.25568 4.15224 8.76562C4 8.39808 4 7.93163 4 6.99974Z",stroke:"white","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)])])}const _f=Xe(gf,[["render",xf]]),yo=a=>{const l=bi(),i=p=>l.open(a,p),s=()=>l.close(a),u=l.state(a),f=r.computed({get:()=>u.value.visible,set:p=>p&&i()||s()}),m=r.computed(()=>u.value.context);return{visible:f,context:m,open:i,close:s}},wf={class:"cart_deletion_modal_content"},Cf={class:"cart_deletion_modal_title"},Ef={class:"cart_deletion_modal_footer"},yf=Xe(r.defineComponent({__name:"CartDeleteConfirm",emits:["confirm"],setup(a,{emit:l}){const i=l,{visible:s,context:u,close:f}=yo("cart-delete-confirm"),m=()=>{i("confirm",u.value.idSystem),f()};return(p,_)=>(r.openBlock(),r.createBlock(r.Transition,{name:"fade"},{default:r.withCtx(()=>[r.unref(s)?(r.openBlock(),r.createElementBlock("div",{key:0,class:"cart_deletion_modal_overlay",onClick:_[1]||(_[1]=r.withModifiers((...x)=>r.unref(f)&&r.unref(f)(...x),["self"]))},[r.createElementVNode("div",wf,[r.createElementVNode("div",Cf,"Удалить "+r.toDisplayString(r.unref(u).name)+"?",1),_[2]||(_[2]=r.createElementVNode("div",{class:"cart_deletion_modal_body"},"Эта позиция будет полностью удалена из заказа.",-1)),r.createElementVNode("div",Ef,[r.createElementVNode("button",{class:"primary",onClick:m}," Удалить "),r.createElementVNode("button",{onClick:_[0]||(_[0]=(...x)=>r.unref(f)&&r.unref(f)(...x))},"Отмена")])])])):r.createCommentVNode("",!0)]),_:1}))}}),[["__scopeId","data-v-018f66f3"]]),bf={class:"cart_extend_modal_content"},Af={class:"cart_extend_modal_footer"},Sf=Xe(r.defineComponent({__name:"CartExtendConfirm",emits:["confirm"],setup(a,{emit:l}){const i=l,{visible:s,context:u,close:f}=yo("cart-extend-confirm"),m=()=>{i("confirm"),f()};return(p,_)=>(r.openBlock(),r.createBlock(r.Transition,{name:"fade"},{default:r.withCtx(()=>[r.unref(s)?(r.openBlock(),r.createElementBlock("div",{key:0,class:"cart_extend_modal_overlay",onClick:_[1]||(_[1]=r.withModifiers((...x)=>r.unref(f)&&r.unref(f)(...x),["self"]))},[r.createElementVNode("div",bf,[_[2]||(_[2]=r.createElementVNode("div",{class:"cart_extend_modal_title"},"Дополнить заказ?",-1)),_[3]||(_[3]=r.createElementVNode("div",{class:"cart_extend_modal_body"},"В заказ добавлены новые позиции. Подтвердить дополнение заказа? После подтверждения позиции нельзя отменить.",-1)),r.createElementVNode("div",Af,[r.createElementVNode("button",{onClick:_[0]||(_[0]=(...x)=>r.unref(f)&&r.unref(f)(...x))},"Отмена"),r.createElementVNode("button",{class:"primary",onClick:m}," Продолжить ")])])])):r.createCommentVNode("",!0)]),_:1}))}}),[["__scopeId","data-v-15f3f7bf"]]),If={class:"order_box_wrapper"},Nf=["src"],Tf={class:"order_box_content_wrapper"},kf={class:"order_box_content_info"},Rf={class:"order_box_name"},Bf={key:0,class:"order_box_size"},Of={class:"order_box_amount"},Mf={class:"order_box_amount_count"},Df={key:1,class:"order_box_status"},vf=["data-state"],Pf={class:"order_box_info_more"},Lf={key:1,class:"cart_modifier_info"},Ff={class:"cart_modifier_content"},Vf={class:"wrapper_price_count_cart"},Uf={class:"count_order_box"},zf={class:"wrapper_modifiers_discount"},bo=Xe(r.defineComponent({__name:"OrderBox",props:{index:Number,cardItem:Object},emits:["delete"],setup(a,{emit:l}){const i=a,s=St(),u=r.ref(s.itemThemes.qr_show_modifiers_in_cart??!1),{displayNumber:f,update:m}=go(0,800),p=r.computed(()=>{var N,v;const I=((N=i.cardItem)==null?void 0:N.modifiers)??[],O=(((v=i.cardItem)==null?void 0:v.group_modifiers)??[]).flatMap(k=>k.modifiers??[]);return[...I,...O]}),{mediaUrl:_}=Tn(()=>{var I;return((I=i.cardItem)==null?void 0:I.id)+"_image"},()=>{var I;return(I=i.cardItem)==null?void 0:I.image_link}),x=r.computed(()=>{var I;return(I=i.cardItem)==null?void 0:I.total_cost}),C=()=>{u.value=!u.value},y=r.computed(()=>{var O,N;if((O=i.cardItem)!=null&&O.correlation_id)return"Ожидает добавления 🕓";const I=(N=i.cardItem)==null?void 0:N.cooking_state;return!I&&I!==0?null:I===0?"Создан":I===1?"Готовится":I===2?"Приготовлен":I===3?"Выдан":null});return r.watch(x,m,{immediate:!0}),(I,O)=>{var N,v,k,P,D,M,q,W,Y;return r.openBlock(),r.createElementBlock("div",If,[r.createElementVNode("img",{src:r.unref(_)||"",class:"order_box_image"},null,8,Nf),r.createElementVNode("div",Tf,[r.createElementVNode("div",kf,[r.createElementVNode("p",Rf,r.toDisplayString((N=a.cardItem)==null?void 0:N.name),1),(v=a.cardItem)!=null&&v.size?(r.openBlock(),r.createElementBlock("p",Bf,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",Of,[O[0]||(O[0]=r.createElementVNode("button",{disabled:""},"-",-1)),r.createElementVNode("p",Mf,r.toDisplayString((M=i.cardItem)==null?void 0:M.amount),1),O[1]||(O[1]=r.createElementVNode("button",{disabled:""},"+",-1))]),y.value?(r.openBlock(),r.createElementBlock("div",Df,[r.createElementVNode("span",{"data-state":(q=a.cardItem)==null?void 0:q.cooking_state},r.toDisplayString(y.value),9,vf)])):r.createCommentVNode("",!0)]),r.createElementVNode("div",Pf,[(W=i.cardItem)!=null&&W.new_price?(r.openBlock(),r.createElementBlock("p",{key:0,class:r.normalizeClass({discount_new_price:(Y=i.cardItem)==null?void 0:Y.new_price})},r.toDisplayString((i.cardItem.new_price*i.cardItem.amount).toFixed(2)+"₽"),3)):r.createCommentVNode("",!0),r.createElementVNode("p",null,r.toDisplayString(r.unref(f).toFixed(2)+"₽"),1)])]),!u.value&&p.value.length>0?(r.openBlock(),r.createElementBlock("div",{key:0,class:"cart_modifier_toggle",onClick:r.withModifiers(C,["stop"])},[...O[2]||(O[2]=[r.createElementVNode("p",{class:"cart_info_more"},"Посмотреть модификаторы",-1),r.createElementVNode("p",{class:"cart_arrow"},null,-1)])])):r.createCommentVNode("",!0),u.value&&p.value.length>0?(r.openBlock(),r.createElementBlock("div",Lf,[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(p.value,F=>{var L;return r.openBlock(),r.createElementBlock("div",{class:"cart_modifier_item",key:F.id},[r.createElementVNode("div",Ff,[r.createVNode(Ci,{id:"plus_orange"}),r.createElementVNode("p",null,r.toDisplayString(F.name),1)]),r.createElementVNode("div",Vf,[r.createElementVNode("p",Uf,r.toDisplayString(`x${F.amount}`),1),r.createElementVNode("div",zf,[F!=null&&F.new_price?(r.openBlock(),r.createElementBlock("p",{key:0,class:r.normalizeClass({discount_new_price:(L=F==null?void 0:F.new_price)==null?void 0:L.toFixed(2)})},r.toDisplayString((F.new_price*F.amount).toFixed(2)+"₽"),3)):r.createCommentVNode("",!0),r.createElementVNode("p",null,r.toDisplayString((F.total_new_price||F.price*F.amount).toFixed(2)+"₽"),1)])])])}),128)),r.createElementVNode("div",{class:"cart_modifier_arrow",onClick:r.withModifiers(C,["stop"])},[...O[3]||(O[3]=[r.createElementVNode("p",{class:"cart_info_more"},"Скрыть",-1),r.createElementVNode("p",{class:"cart_arrow_top"},null,-1)])])])):r.createCommentVNode("",!0)])}}}),[["__scopeId","data-v-ea6dee7e"]]),Hf={class:"cart_wrapper"},Gf={class:"cart_header_content"},Wf={key:0,class:"cart_header_subwrapper"},Xf={class:"cart_kso_button_wrapper"},$f={key:0},jf={key:0,class:"kso_btn_wrapper"},qf=["src"],Zf={key:0,class:"cart_qr_button_wrapper"},Yf={class:"cart_header_info"},Kf={class:"cart_header_info"},Qf={class:"cart_header_info"},Jf={class:"cart_header_info"},eh={key:1,class:"cart-tabs-wrapper"},th={class:"cart-tabs-container"},nh=["data-active","onClick"],rh={key:0,class:"wrapper_comment"},ih={class:"wrapper_limit_in_area"},oh=["placeholder","aria-invalid"],sh={class:"limit_comment"},ah={key:1,class:"wrapper_comment"},lh={class:"wrapper_limit_in_area"},ch=["placeholder","aria-invalid"],dh={class:"limit_comment"},uh={key:2},fh={class:"table_order_desk_number"},hh={key:0,class:"table_order_indent_number"},mh={class:"cart_cards"},gh={class:"cart_footer_wrapper"},ph={key:0,class:"footer_title"},xh=["disabled","max"],_h={key:1,class:"footer_sales"},wh=["step","max"],Ch={class:"list_price"},Eh={key:0},yh={key:1},bh={key:2},Ah={class:"accept_field"},Sh={class:"accept_field"},Ih={key:3},Nh={class:"accept_field"},Th={class:"accept_field"},kh={key:4},Rh={key:5},Bh={key:0,class:"accept_field"},Oh={key:1,class:"accept_field"},Mh={key:3,class:"cart_min_order_notice"},Dh={class:"wrapper_footer_cart_btn"},vh=r.defineComponent({__name:"CartPage",props:{configPage:{},textPaymentBtn:{},config_qr:{type:Boolean}},setup(a){const l=yn.create();let i;const s=st(),u=Mt(),f=St(),m=Fn(),p=bi(),_=a,{initialCartPrice_lib:x,totalPrice_lib:C,countBonus:y,config_lib:I,cartProducts_lib:O,profile:N}=_e.storeToRefs(s),{itemThemes:v}=_e.storeToRefs(f),{isButtonDisabled:k,orderCompleted_lib:P,orderNumber:D,extraDiscount:M,is_notification_lib:q,isCreateButtonVisible:W,is_paymentCart:Y,providerTypes:F,notificationData_lib:L,selectedProvider:V,configPayment:ie}=_e.storeToRefs(u),Q=Te.useRouter(),te=Te.useRoute(),G=r.useTemplateRef("stickerLoyality"),z=r.ref(!1),T=r.ref(!1),X=r.ref(!1),$=r.useTemplateRef("commentEl"),j=r.ref(""),Z=r.ref(!1),ee=r.ref(!1),de=r.ref(!1),ce=r.ref(0),Ce=r.ref(0),ge=r.ref(!0),De=r.ref(),xe=r.computed(()=>_.configPage.qr_menu?"YOOKASSA_BASE":F.value[0].front_type),Ct=r.computed(()=>_.configPage.qr_menu?"YOOKASSA":F.value[0].type),be=r.computed(()=>{var pe,se;return _.configPage.kiosk_menu&&((pe=I.value)==null?void 0:pe.loyalty)==="IIKO"&&(I.value.has_loyalty_default_user||N.value)||_.configPage.qr_menu&&((se=I.value)==null?void 0:se.loyalty)==="IIKO"&&(N.value||v.value.qr_auth_required===!1)}),et=r.computed(()=>["АВТОРИЗОВАТЬСЯ ДЛЯ ЗАКАЗА"].includes(_.textPaymentBtn.toUpperCase())?_.textPaymentBtn:m.isTableService&&m.hasOrder?"Дополнить заказ":W.value?"Создать заказ":_.textPaymentBtn),{width:rt}=_t.useElementSize(G,{width:0,height:0},{box:"border-box"}),Ve=r.computed(()=>{var $e,Ae,zt,An;const pe={energy_amount:0,proteins_amount:0,fat_amount:0,carbohydrates_amount:0};let se=pe;return m.isTableService&&((Ae=($e=m.order)==null?void 0:$e.items)!=null&&Ae.length)&&(se=((An=(zt=m.order)==null?void 0:zt.items)==null?void 0:An.reduce((ct,Pe)=>(Pe!=null&&Pe.nutrition&&(ct.energy_amount+=(Pe.nutrition.energy_amount||0)*(Pe.amount||0),ct.proteins_amount+=(Pe.nutrition.proteins_amount||0)*(Pe.amount||0),ct.fat_amount+=(Pe.nutrition.fat_amount||0)*(Pe.amount||0),ct.carbohydrates_amount+=(Pe.nutrition.carbohydrates_amount||0)*(Pe.amount||0)),ct),pe))||pe),O.value.reduce((ct,Pe)=>(ct.energy_amount+=(Pe.energy_amount||0)*(Pe.amount||0),ct.proteins_amount+=(Pe.proteins_amount||0)*(Pe.amount||0),ct.fat_amount+=(Pe.fat_amount||0)*(Pe.amount||0),ct.carbohydrates_amount+=(Pe.carbohydrates_amount||0)*(Pe.amount||0),ct),se)}),it=r.computed(()=>{var pe;if((pe=v.value)!=null&&pe.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}}}),Me=_t.computedAsync(async pe=>{var Ae;const se=new AbortController;if(pe(()=>se.abort()),!z.value||!((Ae=N.value)!=null&&Ae.balance)||!C.value)return 0;const $e=await l.maxPayByBonuses(De.value,_.configPage.kiosk_menu,!!_.configPage.userData||!!N.value,se.signal);return $e!=null&&$e.by_bonuses?(X.value=$e.non_integers_allowed||!1,Math.min($e.by_bonuses,N.value.balance,C.value)):0},0,{shallow:!0}),Ie=()=>Q.push(`/${te.params.orgId}/`),Ue=pe=>{(X.value?["a","A","+","-","."]:["a","A","+","-",".",","]).includes(pe.key)&&pe.preventDefault()},Nt=pe=>{s.deleteItemFromCart(pe),O.value.length===0&&(ee.value=!1,de.value=!1,m.hasOrder&&Q.replace({name:"order-ts"}))},ot=()=>{ee.value=!ee.value,j.value.length},Qe=r.computed(()=>{var se;return(((se=v.value.cart_loyalty_button)==null?void 0:se.cart_loyalty_button_text)||"Программа лояльности").replace(/\S+/g,$e=>$e.length>15?$e.slice(0,15)+"...":$e)}),ve=()=>{de.value=!de.value,j.value.length},ar=()=>{let pe=X.value?+y.value.toFixed(2):Math.floor(y.value)||0;pe>Me.value&&(pe=Me.value),pe!==y.value&&s.setBonus(pe)};r.watchEffect(()=>{ar(),s.setBonus(C.value===0?0:X.value?+y.value.toFixed(2):Math.floor(y.value))});const ye=()=>O.value.map(pe=>({id:pe.id,front_item_id:pe.idSystem,is_fake:!!pe.is_fake,is_od_united_product:!!pe.is_od_united_product,removals:pe.removals??null,amount:pe.amount,size:pe.size,modifiers:pe.modifiers??[],group_modifiers:pe.group_modifiers??[]})),{makeCreateOrderRequest:br}=mf(),qr=r.computed(()=>ye()),Dt=r.computed(()=>{var pe,se,$e,Ae;return _.configPage.qr_menu&&((se=(pe=v.value)==null?void 0:pe.comments)==null?void 0:se.qr_is_order_comment_required)||_.configPage.kiosk_menu&&((Ae=($e=v.value)==null?void 0:$e.comments)==null?void 0:Ae.kiosk_is_order_comment_required)}),Ar=()=>{var pe,se;return!(Dt.value&&((se=(pe=j.value)==null?void 0:pe.trim())==null?void 0:se.length)<1&&$.value)||m.isTableService&&m.hasOrder?!1:(u.showNotification("Обязательно перед созданием заказа укажите комментарий к заказу"),$.value.focus(),Z.value=!0,Ot.animate($.value.parentElement,{x:[0,-10,0,10,0]},{duration:.1,repeat:2}),!0)},dn=async()=>{var pe,se,$e;if(_.configPage.qr_menu&&!N.value&&v.value.qr_auth_required!==!1){Q.push(`/${te.params.orgId}/register`);return}if(!(Dt.value&&Ar())){if(m.isTableService){if((pe=m.data)!=null&&pe.available_extend||m.hasOrder){u.showNotification("Для данного стола уже был создан заказ."),m.refresh();return}if(m.hasOrder)p.open("cart-extend-confirm");else try{k.value=!0,await l.confirmOrder(De.value),u.deleteCart(),m.refresh(),Q.push({name:"order-ts"})}catch(Ae){u.showNotification((($e=(se=Ae==null?void 0:Ae.response)==null?void 0:se.data)==null?void 0:$e.user_friendly_message)||"Ошибка при создании заказа"),m.refresh(),k.value=!1,at()}return}if(_.configPage.qr_menu||F.value.length<=1){k.value=!0,await lo(De.value,Ct.value).then(Ae=>{ie.value&&Ae.url&&_.configPage.qr_menu&&window.location.replace(Ae.url)});return}return Y.value=!Y.value}},Ri=()=>{Y.value=!1},Rn=async()=>{var se,$e,Ae,zt,An;M.value=0;const pe={items:[...ye()],comment:j.value,combos:[]};m.id&&(pe.table=m.id),(se=_.configPage)!=null&&se.kiosk_menu&&(($e=u.selectedOrderType)!=null&&$e.id)&&(pe.order_type_id=(Ae=u.selectedOrderType)==null?void 0:Ae.id);try{T.value=!0;const ct=await l.calculateDiscount(pe,_.configPage.kiosk_menu,!!_.configPage.userData||!!N.value,i.signal);if(!O.value)return;O.value.forEach(Pe=>{const qt=ct.items.find(Ye=>Ye.front_item_id===Pe.idSystem);if(qt&&(Pe.group_modifiers.forEach(Ye=>{const Et=qt.group_modifiers.find(Tt=>Tt.group===Ye.group);Et&&Ye.modifiers.forEach(Tt=>{const pt=Et.modifiers.find(ze=>ze.id===Tt.id);if(pt&&Number(Tt.price)!==Number(pt==null?void 0:pt.new_price)){const ze=(pt.discounts||[]).reduce((un,Wn)=>un+=+Wn.discount,0);ce.value+=ze,Tt.new_price=Tt.price,Tt.price=Number(pt==null?void 0:pt.new_price),Tt.total_new_price=Number(pt.total_new_price)}})}),Pe.modifiers.forEach(Ye=>{const Et=qt.modifiers.find(Tt=>Tt.id===Ye.id);if(Et&&Number(Ye.price)!==Number(Et==null?void 0:Et.new_price)){const Tt=(Et.discounts||[]).reduce((pt,ze)=>pt+=+ze.discount,0);ce.value+=Tt,Ye.new_price=Ye.price,Ye.price=Number(Et==null?void 0:Et.new_price),Ye.total_new_price=Number(Et.total_new_price)}}),Pe.price!==Number(qt.new_price))){const Ye=(qt.discounts||[]).reduce((Et,Tt)=>Et+=+Tt.discount,0);ce.value=ce.value+Ye,Pe.new_price=Pe.price,Pe.price=qt.new_price,Pe.discounts=qt.discounts,Pe.total_new_price=Number(qt.total_new_price)}}),O.value=[...O.value],ce.value!==0&&(C.value=ct.total_cart_price)}catch(ct){if(T.value=!1,!Ze.isCancel(ct))throw u.showNotification(((An=(zt=ct==null?void 0:ct.response)==null?void 0:zt.data)==null?void 0:An.user_friendly_message)||"Скидки временно недоступны"),ct}},Ut=async()=>{var se,$e;let pe=k.value;k.value=!0;try{await l.extendOrder([...ye()]),u.deleteCart(),m.refreshOrder(),Q.push({name:"order-ts"})}catch(Ae){throw u.showNotification((($e=(se=Ae==null?void 0:Ae.response)==null?void 0:se.data)==null?void 0:$e.user_friendly_message)||"Не удалось дополнить заказ"),Ae}finally{k.value=pe}},Bi=async()=>{var pe;if(!(Dt.value&&Ar())){De.value=null,i=new AbortController,k.value=!0;try{be.value&&await Rn(),V.value={front_type:xe};const se={paymentMethodId:xe.value,items:qr.value,comment:j.value,isAuthorized:!!_.configPage.userData||!!N,signal:i==null?void 0:i.signal},$e=await br({..._.configPage,resetDiscounts:at},se);De.value=(pe=$e==null?void 0:$e.data)==null?void 0:pe.id,W.value=!1}catch(se){console.log("[cart](createOrder)",se),!Ze.isCancel(se)&&m.isTableService&&m.refresh(),k.value=!1,at()}}},Sr=()=>{var pe;return _.configPage.qr_menu&&["АВТОРИЗОВАТЬСЯ ДЛЯ ЗАКАЗА"].includes(_.textPaymentBtn.toUpperCase())&&!N.value&&v.value.qr_auth_required!==!1?Q.push(`/${te.params.orgId}/register`):m.isTableService&&((pe=m.data)!=null&&pe.available_extend)?p.open("cart-extend-confirm"):W.value?Bi():dn()},Oo=()=>{var pe;(pe=N.value)!=null&&pe.balance?N.value.balance>0&&(z.value=!z.value):u.showNotification("У Вас пока нет бонусов")};r.onMounted(async()=>{s.loadCart(),P.value=null,C.value=null,M.value=0,at()}),r.onUnmounted(()=>{i&&(i==null||i.abort(),i=null),k.value=!1,De.value=null,P.value=null,C.value=null,M.value=0,O.value.splice(0,O.value.length,...O.value.map(s.makeProductFullyReactive))});const ht=r.computed(()=>_.configPage.qr_menu?I.value.qr_order_minimum_price||0:_.configPage.kiosk_menu&&I.value.kiosk_order_minimum_price||0),me=r.computed(()=>{var pe;return["АВТОРИЗОВАТЬСЯ ДЛЯ ЗАКАЗА"].includes(_.textPaymentBtn.toUpperCase())?!1:m.isTableService&&m.hasOrder&&!((pe=m.data)!=null&&pe.available_extend)||ht.value>x.value&&!m.hasOrder||T.value||k.value||O.value.length===0?!0:(P.value=null,k.value)}),bt=r.computed(()=>{var pe;return((pe=O.value)==null?void 0:pe.reduce((se,$e)=>se+$e.amount,0))||0}),tt=r.computed(()=>{var pe;return(pe=N.value)==null?void 0:pe.phone});r.watch(j,pe=>{var se;return((se=pe==null?void 0:pe.trim())==null?void 0:se.length)&&(Z.value=!1)}),r.watch([bt,tt,()=>u.selectedOrderType],()=>{bt.value===0&&(i=null),i==null||i.abort(),k.value=!1});const at=()=>{W.value=!0,s.setBonus(0),O.value.splice(0,O.value.length,...O.value.map(s.makeProductFullyReactive)),ce.value=0,C.value=null,M.value=0};return r.watch([()=>s.cartProducts_lib,tt,bt,()=>u.selectedOrderType],pe=>{if(Ce.value>0){Ce.value--;return}pe&&!T.value&&(z.value=!1,at(),Ce.value=1),T.value=!1},{deep:!0}),(pe,se)=>{var $e,Ae,zt,An,ct,Pe,qt,Ye,Et,Tt,pt;return r.openBlock(),r.createElementBlock(r.Fragment,null,[r.createElementVNode("div",Hf,[r.createVNode(yf,{onConfirm:Nt}),r.createVNode(Sf,{onConfirm:Ut}),r.createVNode(da,{visible:r.unref(u).isDrawerOpen,"onUpdate:visible":se[0]||(se[0]=ze=>r.unref(u).isDrawerOpen=ze)},{default:r.withCtx(()=>[r.createVNode(fa)]),_:1},8,["visible"]),r.createElementVNode("header",Gf,[_.configPage.kiosk_menu?(r.openBlock(),r.createElementBlock("div",Wf,[r.createElementVNode("div",Xf,[r.createElementVNode("div",{class:r.normalizeClass(["arrow_wrapper",{arrow_wrapper_kso:_.configPage.kiosk_menu}]),onClick:Ie},[r.createVNode(wr,{class:"cart_header_back_button"}),_.configPage.kiosk_menu?(r.openBlock(),r.createElementBlock("span",$f,"Назад")):r.createCommentVNode("",!0)],2)]),it.value&&it.value.show?(r.openBlock(),r.createElementBlock("div",jf,[Dt.value?r.createCommentVNode("",!0):(r.openBlock(),r.createBlock(an,{key:0,style:r.normalizeStyle({visibility:!ee.value&&r.unref(O).length>0?"visible":"hidden"}),class:r.normalizeClass({button_kso_comment:a.configPage.kiosk_menu}),textButtonDefault:j.value.length>0?"Редактировать":it.value&&it.value.fieldName||"",onClick:()=>ee.value=!ee.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:($e=r.unref(v).cart_loyalty_button)!=null&&$e.cart_loyalty_button_sticker?`${Math.ceil(r.unref(rt)/2+10)}px`:"",paddingRight:(Ae=r.unref(v).cart_loyalty_button)!=null&&Ae.cart_loyalty_button_sticker?0:""}),onClick:se[1]||(se[1]=(...ze)=>r.unref(u).openDrawer&&r.unref(u).openDrawer(...ze))},[r.createElementVNode("p",{class:"cart_loyal_program",style:r.normalizeStyle({marginRight:`${Math.ceil(r.unref(rt)/2)}px`})},r.toDisplayString(Qe.value),5),(zt=r.unref(v).cart_loyalty_button)!=null&&zt.cart_loyalty_button_sticker?(r.openBlock(),r.createElementBlock("div",{key:0,ref_key:"stickerLoyality",ref:G,class:"cart_loyal_program_icon",style:r.normalizeStyle({"--sticker-mask":`url(${r.unref(v).cart_loyalty_button.cart_loyalty_button_sticker})`})},[r.createElementVNode("img",{src:r.unref(v).cart_loyalty_button.cart_loyalty_button_sticker},null,8,qf)],4)):(r.openBlock(),r.createBlock(_f,{key:1,class:"cart_loyal_qr"}))],4)):r.createCommentVNode("",!0)],2)])):r.createCommentVNode("",!0),r.createElementVNode("div",{class:r.normalizeClass([a.config_qr?"cart_kbju_qr_wrapper":"cart_kbju_kso_wrapper"])},[a.config_qr?(r.openBlock(),r.createElementBlock("div",Zf,[r.createElementVNode("div",{class:"arrow_wrapper",onClick:Ie},[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",Yf,[r.createElementVNode("p",null,[r.createVNode(ft,{price:Ve.value.energy_amount,duration:800},null,8,["price"]),se[9]||(se[9]=r.createTextVNode(" г",-1))]),se[10]||(se[10]=r.createElementVNode("p",{class:"cart_info_name"},"Килокалории",-1))]),r.createElementVNode("div",Kf,[r.createElementVNode("p",null,[r.createVNode(ft,{price:Ve.value.proteins_amount,duration:900},null,8,["price"]),se[11]||(se[11]=r.createTextVNode(" г",-1))]),se[12]||(se[12]=r.createElementVNode("p",{class:"cart_info_name"},"Белки",-1))]),r.createElementVNode("div",Qf,[r.createElementVNode("p",null,[r.createVNode(ft,{price:Ve.value.fat_amount,duration:1e3},null,8,["price"]),se[13]||(se[13]=r.createTextVNode(" г",-1))]),se[14]||(se[14]=r.createElementVNode("p",{class:"cart_info_name"},"Жиры",-1))]),r.createElementVNode("div",Jf,[r.createElementVNode("p",null,[r.createVNode(ft,{price:Ve.value.carbohydrates_amount,duration:1100},null,8,["price"]),se[15]||(se[15]=r.createTextVNode(" г",-1))]),se[16]||(se[16]=r.createElementVNode("p",{class:"cart_info_name"},"Углеводы",-1))])],4)):r.createCommentVNode("",!0)],2),a.configPage.kiosk_menu&&r.unref(u).orderTypes.length>1?(r.openBlock(),r.createElementBlock("div",eh,[r.createElementVNode("ul",th,[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(r.unref(u).orderTypes,ze=>{var un,Wn;return r.openBlock(),r.createElementBlock("li",{key:ze.id,class:"cart-tab","data-active":ze.id===((un=r.unref(u).selectedOrderType)==null?void 0:un.id),onClick:Zt=>r.unref(u).selectedOrderType=ze},[ze.id===((Wn=r.unref(u).selectedOrderType)==null?void 0:Wn.id)?(r.openBlock(),r.createBlock(r.unref(Ot.motion).div,{key:0,class:"cart-underline","layout-id":"cart-underline",id:"cart-underline"})):r.createCommentVNode("",!0),r.createElementVNode("span",null,r.toDisplayString(ze.name),1)],8,nh)}),128))])])):r.createCommentVNode("",!0)]),(Dt.value||ee.value)&&a.configPage.kiosk_menu&&((An=r.unref(O))!=null&&An.length)?(r.openBlock(),r.createElementBlock("div",rh,[r.createElementVNode("div",ih,[r.withDirectives(r.createElementVNode("textarea",{ref_key:"commentEl",ref:$,class:"comment_order",placeholder:it.value&&it.value.placeholder||"Ваш комментарий к заказу...",name:"commentKso",maxlength:"50","aria-invalid":Z.value,"onUpdate:modelValue":se[2]||(se[2]=ze=>j.value=ze)},null,8,oh),[[r.vModelText,j.value]]),r.createElementVNode("p",sh,r.toDisplayString(j.value.length+" / 50"),1)]),Dt.value?r.createCommentVNode("",!0):(r.openBlock(),r.createBlock(an,{key:0,textButtonDefault:"Сохранить",onClick:ot,class:"button_bonus_cart"}))])):r.createCommentVNode("",!0),(Dt.value||de.value)&&a.config_qr&&((ct=r.unref(O))!=null&&ct.length)&&!(r.unref(m).isTableService&&r.unref(m).hasOrder)?(r.openBlock(),r.createElementBlock("div",ah,[r.createElementVNode("div",lh,[r.withDirectives(r.createElementVNode("textarea",{ref_key:"commentEl",ref:$,class:"comment_order",placeholder:it.value&&it.value.placeholder||"Ваш комментарий к заказу...",name:"commentQr",maxlength:"50","aria-invalid":Z.value,"onUpdate:modelValue":se[3]||(se[3]=ze=>j.value=ze)},null,8,ch),[[r.vModelText,j.value]]),r.createElementVNode("p",dh,r.toDisplayString(j.value.length+" / 50"),1)]),Dt.value?r.createCommentVNode("",!0):(r.openBlock(),r.createBlock(an,{key:0,textButtonDefault:"Сохранить",onClick:ve,class:"button_bonus_cart"}))])):r.createCommentVNode("",!0),a.config_qr&&it.value&&it.value.show&&!(r.unref(m).isTableService&&r.unref(m).hasOrder)?(r.openBlock(),r.createElementBlock("div",uh,[!Dt.value&&!de.value&&r.unref(O).length>0?(r.openBlock(),r.createBlock(an,{key:0,textButtonDefault:j.value.length>0?"Редактировать":it.value.fieldName||"",onClick:()=>de.value=!de.value,id:"button_comments"},null,8,["textButtonDefault","onClick"])):r.createCommentVNode("",!0)])):r.createCommentVNode("",!0),r.unref(m).isTableService&&((Pe=r.unref(m).data)!=null&&Pe.number.toString())?(r.openBlock(),r.createElementBlock("div",{key:3,class:"table_order_table_wrapper",onClick:se[4]||(se[4]=ze=>r.unref(m).order&&r.unref(Q).push({name:"order-ts"}))},[r.createElementVNode("p",fh,r.toDisplayString(`Стол № ${(qt=r.unref(m).data)==null?void 0:qt.number}`),1),(Ye=r.unref(m).order)!=null&&Ye.id?(r.openBlock(),r.createElementBlock("p",hh,r.toDisplayString(`Заказ ${r.unref(m).order.plugin_order.number}`),1)):r.createCommentVNode("",!0)])):r.createCommentVNode("",!0),r.createElementVNode("div",mh,[r.unref(m).hasOrder&&((Tt=(Et=r.unref(m).order)==null?void 0:Et.items)!=null&&Tt.length)&&ge.value?(r.openBlock(!0),r.createElementBlock(r.Fragment,{key:0},r.renderList(r.unref(m).order.items,ze=>(r.openBlock(),r.createBlock(bo,{key:ze.idSystem,cardItem:ze},null,8,["cardItem"]))),128)):r.createCommentVNode("",!0),(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(r.unref(O),ze=>(r.openBlock(),r.createBlock(ua,{key:ze.idSystem,cardItem:ze,isShowModifiers:_.config_qr,onDelete:un=>Nt(ze.idSystem)},null,8,["cardItem","isShowModifiers","onDelete"]))),128))]),r.createElementVNode("div",gh,[z.value&&!r.unref(W)?(r.openBlock(),r.createElementBlock("p",ph,[se[17]||(se[17]=r.createTextVNode(" Списать ",-1)),r.withDirectives(r.createElementVNode("input",{type:"number",placeholder:"0",style:r.normalizeStyle({maxWidth:`${r.unref(y).toString().length||1}em`}),disabled:r.unref(N)===null||((pt=r.unref(N))==null?void 0:pt.balance)===0,"onUpdate:modelValue":se[5]||(se[5]=ze=>r.isRef(y)?y.value=ze:null),onInput:ar,min:"0",max:r.unref(Me),step:".01",onKeypress:Ue},null,44,xh),[[r.vModelText,r.unref(y),void 0,{number:!0}]]),se[18]||(se[18]=r.createTextVNode(" бонусов ",-1))])):r.createCommentVNode("",!0),z.value&&!r.unref(W)?(r.openBlock(),r.createElementBlock("p",_h,"У вас есть "+r.toDisplayString(r.unref(N)?r.unref(N).balance:0)+" B",1)):r.createCommentVNode("",!0),z.value&&!r.unref(W)?r.withDirectives((r.openBlock(),r.createElementBlock("input",{key:2,type:"range",class:"footer_range","onUpdate:modelValue":se[6]||(se[6]=ze=>r.isRef(y)?y.value=ze:null),step:X.value?".01":"1",min:0,max:r.unref(Me)},null,8,wh)),[[r.vModelText,r.unref(y),void 0,{number:!0}]]):r.createCommentVNode("",!0),r.createElementVNode("ul",Ch,[z.value&&!r.unref(W)?(r.openBlock(),r.createElementBlock("li",Eh,[se[20]||(se[20]=r.createElementVNode("p",null,"Сумма заказа:",-1)),r.createElementVNode("p",null,[r.createVNode(ft,{price:r.unref(C),fixedFloat:2},null,8,["price"]),se[19]||(se[19]=r.createTextVNode(" ₽",-1))])])):r.createCommentVNode("",!0),z.value&&!r.unref(W)?(r.openBlock(),r.createElementBlock("li",yh,[se[22]||(se[22]=r.createElementVNode("p",null,"Будет оплачено бонусами:",-1)),r.createElementVNode("p",null,[r.createVNode(ft,{price:r.unref(y),fixedFloat:2},null,8,["price"]),se[21]||(se[21]=r.createTextVNode(" Б",-1))])])):r.createCommentVNode("",!0),r.unref(M)!==0?(r.openBlock(),r.createElementBlock("li",bh,[r.createElementVNode("p",Ah,r.toDisplayString(r.unref(M)>0?"Надбавка":"Скидка")+": ",1),r.createElementVNode("p",Sh,[r.createVNode(ft,{price:Math.abs(r.unref(M)),fixedFloat:2},null,8,["price"]),se[23]||(se[23]=r.createTextVNode(" ₽",-1))])])):ce.value!==0?(r.openBlock(),r.createElementBlock("li",Ih,[r.createElementVNode("p",Nh,r.toDisplayString(ce.value>0?"Надбавка":"Скидка")+": ",1),r.createElementVNode("p",Th,[r.createVNode(ft,{price:Math.abs(ce.value),fixedFloat:2},null,8,["price"]),se[24]||(se[24]=r.createTextVNode(" ₽",-1))])])):r.createCommentVNode("",!0),r.unref(m).isTableService&&r.unref(m).order?(r.openBlock(),r.createElementBlock("li",kh,[se[26]||(se[26]=r.createElementVNode("p",null,"Сумма заказа:",-1)),r.createElementVNode("p",null,[r.createVNode(ft,{price:r.unref(m).order.total_cost,fixedFloat:2},null,8,["price"]),se[25]||(se[25]=r.createTextVNode(" ₽",-1))])])):r.createCommentVNode("",!0),r.unref(m).isTableService&&r.unref(m).order?(r.openBlock(),r.createElementBlock("li",Rh,[se[28]||(se[28]=r.createElementVNode("p",null,"К счёту добавится:",-1)),r.createElementVNode("p",null,[r.createVNode(ft,{price:r.unref(C),fixedFloat:2},null,8,["price"]),se[27]||(se[27]=r.createTextVNode(" ₽",-1))])])):r.createCommentVNode("",!0),r.createElementVNode("li",null,[se[31]||(se[31]=r.createElementVNode("p",{class:"accept_field"},"Итого к оплате:",-1)),r.unref(m).isTableService&&r.unref(m).order?(r.openBlock(),r.createElementBlock("p",Bh,[r.createVNode(ft,{price:r.unref(m).order.total_cost+r.unref(C),fixedFloat:2},null,8,["price"]),se[29]||(se[29]=r.createTextVNode(" ₽",-1))])):(r.openBlock(),r.createElementBlock("p",Oh,[r.createVNode(ft,{price:r.unref(C)-r.unref(y),fixedFloat:2},null,8,["price"]),se[30]||(se[30]=r.createTextVNode(" ₽",-1))]))])]),ht.value&&ht.value>r.unref(x)&&!r.unref(m).hasOrder?(r.openBlock(),r.createElementBlock("div",Mh,[se[32]||(se[32]=r.createTextVNode(" Минимальная сумма заказа ",-1)),r.createVNode(ft,{price:ht.value,fixedFloat:2},null,8,["price"]),r.createTextVNode(" "+r.toDisplayString(r.unref(I).currency_symbol)+". Для оформления заказа необходимо добавить товаров на сумму ",1),r.createVNode(ft,{price:ht.value-r.unref(x),fixedFloat:2},null,8,["price"]),r.createTextVNode(" "+r.toDisplayString(r.unref(I).currency_symbol),1)])):r.createCommentVNode("",!0),r.createElementVNode("div",Dh,[r.unref(N)&&!r.unref(W)&&!r.unref(m).isTableService?(r.openBlock(),r.createBlock(an,{key:0,textButtonDefault:r.unref(v).bonuses_button_name||"Бонусы",onClick:Oo,class:"button_bonus_cart"},null,8,["textButtonDefault"])):r.createCommentVNode("",!0),r.createVNode(an,{textButtonDefault:et.value,onClick:Sr,class:"button_payment_cart",disabled:me.value},null,8,["textButtonDefault","disabled"])])])]),r.unref(m).isTableService?r.createCommentVNode("",!0):(r.openBlock(),r.createBlock(hf,{key:0,orderNumber:r.unref(D),pageNumber:1},null,8,["orderNumber"])),r.createVNode(Ei,{visible:r.unref(q),"onUpdate:visible":se[7]||(se[7]=ze=>r.isRef(q)?q.value=ze: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(xo,{modelValue:r.unref(Y),"onUpdate:modelValue":se[8]||(se[8]=ze=>r.isRef(Y)?Y.value=ze:null),class:"product_card_sheet","snap-points":["80%"]},{default:r.withCtx(()=>{var ze;return[r.createVNode(u1,{"config-page":a.configPage,comment:j.value,"cart-items":qr.value,"is-authorized":!!_.configPage.userData||!!r.unref(N),"order-id":De.value,signal:(ze=r.unref(i))==null?void 0:ze.signal,onSelectPayment:Ri},null,8,["config-page","comment","cart-items","is-authorized","order-id","signal"])]}),_:1},8,["modelValue"])],64)}}}),Ph={},Lh={viewBox:"0 0 24 24"};function Fh(a,l){return r.openBlock(),r.createElementBlock("svg",Lh,[...l[0]||(l[0]=[r.createElementVNode("path",{d:"M18 6L6 18M6 6l12 12"},null,-1)])])}const Vh=Xe(Ph,[["render",Fh]]),Uh={class:"retry_screen"},zh={class:"retry_all_in_screen"},Hh={class:"retry_content"},Gh={class:"retry_icon_wrap"},Wh={class:"retry_icon_circle"},Xh={class:"retry_error_x"},$h=r.defineComponent({__name:"RetryPage",setup(a){const l=Mt(),i=Te.useRouter(),s=Te.useRoute(),u=()=>{l.notificationData_lib.textNotification="",l.is_notification_lib=!1,i.replace(`/${s.params.orgId}/`)};return(f,m)=>(r.openBlock(),r.createElementBlock("section",Uh,[r.createElementVNode("div",zh,[r.createElementVNode("main",Hh,[r.createElementVNode("div",Gh,[r.createElementVNode("div",Wh,[m[0]||(m[0]=r.createElementVNode("div",{class:"retry_loader_mini"},null,-1)),r.createElementVNode("div",Xh,[r.createVNode(Vh)])])]),m[1]||(m[1]=r.createElementVNode("div",{class:"retry_oops"},"OOPS",-1)),m[2]||(m[2]=r.createElementVNode("h1",{class:"retry_title"},"Что-то пошло не так",-1)),m[3]||(m[3]=r.createElementVNode("div",{class:"retry_hint"},[r.createElementVNode("p",null,"Похоже, произошёл технический сбой."),r.createElementVNode("p",null,"Мы уже знаем о проблеме и сейчас разбираемся."),r.createElementVNode("p",null,"Приносим извинения за доставленные неудобства."),r.createElementVNode("p",null,"Попробуйте начать новый заказ.")],-1))]),r.createElementVNode("div",{class:"retry_footer"},[r.createElementVNode("button",{onClick:u,class:"retry_new_order_btn"},"Новый заказ")]),m[4]||(m[4]=r.createElementVNode("p",{class:"retry_bottom_note"},"Если ошибка повторяется — обратитесь к сотруднику зала.",-1))])]))}}),jh={class:"table_order_wrapper"},qh={class:"table_order_header_content"},Zh={class:"table_order_kbju_qr_wrapper"},Yh={class:"table_order_qr_button_wrapper"},Kh={key:0,class:"table_order_header",style:{paddingRight:"10px"}},Qh={class:"table_order_header_info"},Jh={class:"table_order_header_info"},e2={class:"table_order_header_info"},t2={class:"table_order_header_info"},n2={key:0,class:"table_order_table_wrapper"},r2={class:"table_order_desk_number"},i2={class:"table_order_indent_number"},o2={class:"table_order_cards"},s2={class:"table_order_footer_wrapper"},a2={key:0,class:"footer_title"},l2=["disabled","max"],c2={key:1,class:"footer_sales"},d2=["step","max"],u2={class:"list_price"},f2={key:0},h2={key:1},m2={key:2},g2={key:3},p2={class:"accept_field"},x2={key:3,class:"wrapper_footer_table_order_btn"},_2=Xe(r.defineComponent({__name:"TableOrderPage",setup(a){const l=st(),i=Gr(),s=St(),u=Fn(),{countBonus:f}=_e.storeToRefs(l),{itemThemes:m}=_e.storeToRefs(s),p=Te.useRouter(),_=Te.useRoute(),x=yn.create(),C=r.ref(!1),y=r.ref(!1),I=r.ref(!1),O=r.ref(!1),N=r.ref(!1),v=r.computed(()=>C.value||!u.hasOrder),k=r.computed(()=>{var L,V;const F={energy_amount:0,proteins_amount:0,fat_amount:0,carbohydrates_amount:0};return((V=(L=u.order)==null?void 0:L.items)==null?void 0:V.reduce((ie,Q)=>(Q!=null&&Q.nutrition&&(ie.energy_amount+=(Q.nutrition.energy_amount||0)*(Q.amount||0),ie.proteins_amount+=(Q.nutrition.proteins_amount||0)*(Q.amount||0),ie.fat_amount+=(Q.nutrition.fat_amount||0)*(Q.amount||0),ie.carbohydrates_amount+=(Q.nutrition.carbohydrates_amount||0)*(Q.amount||0)),ie),F))||F}),P=_t.computedAsync(async F=>{var ie;const L=new AbortController;if(F(()=>L.abort()),!y.value||!((ie=l.profile)!=null&&ie.balance))return 0;const V=await x.maxPayByBonuses(u.order.id,!1,l.profile,L.signal);return V!=null&&V.by_bonuses?(I.value=V.non_integers_allowed||!1,Math.min(u.order.remaining_amount,l.profile.balance,V.by_bonuses)):0},0,{shallow:!0}),D=()=>{N.value=!0},M=()=>p.push(`/${_.params.orgId}/`),q=async()=>{var F,L;C.value=!0;try{const V=await lo(u.order.id,"YOOKASSA");V.url&&window.location.replace(V.url)}catch(V){throw i.showNotification(((L=(F=V==null?void 0:V.response)==null?void 0:F.data)==null?void 0:L.user_friendly_message)||"Ошибка при оплате заказа"),V}finally{C.value=!1}},W=F=>{(I.value?["a","A","+","-","."]:["a","A","+","-",".",","]).includes(F.key)&&F.preventDefault()},Y=()=>{let F=I.value?+f.value.toFixed(2):Math.floor(f.value)||0;F>P.value&&(F=P.value),F!==f.value&&l.setBonus(F)};return(F,L)=>{var V,ie,Q,te,G,z,T,X;return r.openBlock(),r.createElementBlock("div",jh,[r.createElementVNode("header",qh,[r.createElementVNode("div",Zh,[r.createElementVNode("div",Yh,[r.createElementVNode("div",{class:"arrow_wrapper",onClick:M},[r.createVNode(wr,{class:"table_order_header_back_button"})])]),r.unref(m).show_nutrition_in_cart?(r.openBlock(),r.createElementBlock("div",Kh,[r.createElementVNode("div",Qh,[r.createElementVNode("p",null,[r.createVNode(ft,{price:k.value.energy_amount,duration:800},null,8,["price"]),L[2]||(L[2]=r.createTextVNode(" г ",-1))]),L[3]||(L[3]=r.createElementVNode("p",{class:"table_order_info_name"},"Килокалории",-1))]),r.createElementVNode("div",Jh,[r.createElementVNode("p",null,[r.createVNode(ft,{price:k.value.proteins_amount,duration:900},null,8,["price"]),L[4]||(L[4]=r.createTextVNode(" г ",-1))]),L[5]||(L[5]=r.createElementVNode("p",{class:"table_order_info_name"},"Белки",-1))]),r.createElementVNode("div",e2,[r.createElementVNode("p",null,[r.createVNode(ft,{price:k.value.fat_amount,duration:1e3},null,8,["price"]),L[6]||(L[6]=r.createTextVNode(" г ",-1))]),L[7]||(L[7]=r.createElementVNode("p",{class:"table_order_info_name"},"Жиры",-1))]),r.createElementVNode("div",t2,[r.createElementVNode("p",null,[r.createVNode(ft,{price:k.value.carbohydrates_amount,duration:1100},null,8,["price"]),L[8]||(L[8]=r.createTextVNode(" г ",-1))]),L[9]||(L[9]=r.createElementVNode("p",{class:"table_order_info_name"},"Углеводы",-1))])])):r.createCommentVNode("",!0)])]),(V=r.unref(u).order)!=null&&V.id?(r.openBlock(),r.createElementBlock("div",n2,[r.createElementVNode("p",r2,r.toDisplayString(`Стол № ${(ie=r.unref(u).data)==null?void 0:ie.number}`),1),r.createElementVNode("p",i2,r.toDisplayString(`Заказ ${r.unref(u).order.plugin_order.number}`),1)])):r.createCommentVNode("",!0),r.createElementVNode("div",o2,[(te=(Q=r.unref(u).order)==null?void 0:Q.items)!=null&&te.length?(r.openBlock(!0),r.createElementBlock(r.Fragment,{key:0},r.renderList(r.unref(u).order.items,$=>(r.openBlock(),r.createBlock(bo,{key:$.idSystem,cardItem:$},null,8,["cardItem"]))),128)):r.createCommentVNode("",!0)]),r.createElementVNode("div",s2,[y.value?(r.openBlock(),r.createElementBlock("p",a2,[L[10]||(L[10]=r.createTextVNode(" Списать ",-1)),r.withDirectives(r.createElementVNode("input",{type:"number",placeholder:"0",style:r.normalizeStyle({maxWidth:`${r.unref(f).toString().length||1}em`}),disabled:r.unref(l).profile===null||((G=r.unref(l).profile)==null?void 0:G.balance)===0,"onUpdate:modelValue":L[0]||(L[0]=$=>r.isRef(f)?f.value=$:null),onInput:Y,min:"0",max:r.unref(P),step:".01",onKeypress:W},null,44,l2),[[r.vModelText,r.unref(f),void 0,{number:!0}]]),L[11]||(L[11]=r.createTextVNode(" бонусов ",-1))])):r.createCommentVNode("",!0),y.value?(r.openBlock(),r.createElementBlock("p",c2," У вас есть "+r.toDisplayString(r.unref(l).profile.balance??0)+" B ",1)):r.createCommentVNode("",!0),y.value?r.withDirectives((r.openBlock(),r.createElementBlock("input",{key:2,type:"range",class:"footer_range","onUpdate:modelValue":L[1]||(L[1]=$=>r.isRef(f)?f.value=$:null),step:I.value?".01":"1",min:0,max:r.unref(P)},null,8,d2)),[[r.vModelText,r.unref(f),void 0,{number:!0}]]):r.createCommentVNode("",!0),r.createElementVNode("ul",u2,[r.unref(u).order&&r.unref(u).order.total_cost-r.unref(u).order.remaining_amount>0?(r.openBlock(),r.createElementBlock("li",f2,[L[13]||(L[13]=r.createElementVNode("p",null,"Сумма заказа:",-1)),r.createElementVNode("p",null,[r.createVNode(ft,{price:(z=r.unref(u).order)==null?void 0:z.total_cost,fixedFloat:2},null,8,["price"]),L[12]||(L[12]=r.createTextVNode(" ₽ ",-1))])])):r.createCommentVNode("",!0),r.unref(u).order&&r.unref(u).order.total_cost-r.unref(u).order.remaining_amount>0?(r.openBlock(),r.createElementBlock("li",h2,[L[15]||(L[15]=r.createElementVNode("p",null,"Оплачено:",-1)),r.createElementVNode("p",null,[r.createVNode(ft,{price:r.unref(u).order.total_cost-r.unref(u).order.remaining_amount,fixedFloat:2},null,8,["price"]),L[14]||(L[14]=r.createTextVNode(" ₽ ",-1))])])):r.createCommentVNode("",!0),y.value?(r.openBlock(),r.createElementBlock("li",m2,[L[17]||(L[17]=r.createElementVNode("p",null,"Будет оплачено бонусами:",-1)),r.createElementVNode("p",null,[r.createVNode(ft,{price:r.unref(f),fixedFloat:2},null,8,["price"]),L[16]||(L[16]=r.createTextVNode(" Б ",-1))])])):r.createCommentVNode("",!0),(T=r.unref(u).order)!=null&&T.remaining_amount?(r.openBlock(),r.createElementBlock("li",g2,[L[19]||(L[19]=r.createElementVNode("p",{class:"accept_field"},"Итого к оплате:",-1)),r.createElementVNode("p",p2,[r.createVNode(ft,{price:r.unref(u).order.remaining_amount-r.unref(f),fixedFloat:2},null,8,["price"]),L[18]||(L[18]=r.createTextVNode(" ₽ ",-1))])])):r.createCommentVNode("",!0)]),(X=r.unref(u).order)!=null&&X.remaining_amount&&r.unref(s).itemThemes.qr_show_pay_button_ts!==!1?(r.openBlock(),r.createElementBlock("div",x2,[r.createVNode(an,{textButtonDefault:O.value?"Запросить счёт":"Оплатить заказ",onClick:O.value?D:q,class:"button_payment_cart",disabled:v.value},null,8,["textButtonDefault","onClick","disabled"])])):r.createCommentVNode("",!0)])])}}}),[["__scopeId","data-v-75fa9255"]]),w2={class:"wrapper_loader"},C2=r.defineComponent({__name:"Loader",props:{size:{type:String,default:"40px"}},setup(a){return(l,i)=>(r.openBlock(),r.createElementBlock("div",w2,[r.createElementVNode("div",{class:"loader",style:r.normalizeStyle({width:a.size})},null,4)]))}}),E2=Xe(r.defineComponent({__name:"AnimationLoader",props:{id:{}},setup(a){const l=r.ref(!0);return r.watch(()=>l.value,()=>{l.value=!1,setTimeout(()=>{l.value=!0},0)}),(i,s)=>(r.openBlock(),r.createElementBlock("div",{class:"opacity-animation",key:a.id},[r.renderSlot(i.$slots,"opacityLoader",{},void 0,!0)]))}}),[["__scopeId","data-v-c6b97942"]]),y2={key:0},b2={class:"card__main__wrapper"},A2={key:0,class:"folder_content_top"},S2={key:0,class:"loader_card_main"},I2=["src","alt"],N2={class:"card_title_price_wrapper"},T2={class:"title"},k2={key:0,class:"price"},R2={key:1},B2={key:0,class:"card_button_add_wrapper"},xa=Xe(r.defineComponent({__name:"CardMain",props:{data:{},activeTags:{},is_group:{type:Boolean},parent:{},isLoading:{type:Boolean},selectGroupChild:{type:Function},takeCurrentCard:{type:Function}},setup(a){St();const l=st(),i=Lt(),{is_18_above_content:s,is18Allowed:u,notificationData_lib:f}=_e.storeToRefs(l),{isDesktop:m}=Hn(),p=a,_=(I,O)=>{var k,P,D;const N={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){s.value=!0,v&&(f.value.fastAdd=N);return}if(v){l.addToCart(N);return}if(I.amount||(I.amount=1),p.is_group&&p.selectGroupChild){p.selectGroupChild({...I,parent:p.parent,child:O.child_groups});return}p.takeCurrentCard&&p.takeCurrentCard(O.id)},x=I=>{if(p.is_group&&p.selectGroupChild){I={...I,parent:p.parent,child:I.child_groups},p.selectGroupChild(I);return}if(I.adult&&!u.value){s.value=!0;return}p.takeCurrentCard&&p.takeCurrentCard(I.id)},C=r.computed(()=>p.activeTags.every(I=>p.data.tags.includes(I))),{mediaUrl:y}=Tn(()=>p.data.id+"_image",()=>p.data.image_link);return(I,O)=>{var N;return((N=p.activeTags)==null?void 0:N.length)===0||C.value||p.is_group?(r.openBlock(),r.createElementBlock("div",y2,[r.createVNode(E2,{id:p.data.id},{opacityLoader:r.withCtx(()=>[r.createElementVNode("div",b2,[a.is_group?(r.openBlock(),r.createElementBlock("div",A2)):r.createCommentVNode("",!0),r.createElementVNode("div",{onClick:O[0]||(O[0]=v=>x(p.data)),class:r.normalizeClass(["card__main",{card__main_folder:a.is_group}])},[a.isLoading?(r.openBlock(),r.createElementBlock("div",S2,[r.createVNode(C2)])):(r.openBlock(),r.createElementBlock("div",{key:1,class:r.normalizeClass(["card__main_content",{card_main_desktop_qr:r.unref(m)}])},[r.createElementVNode("img",{src:r.unref(y)||"",class:r.normalizeClass(["img",{card_blur_image:p.data.adult&&!r.unref(u)}]),loading:"lazy",alt:a.data.name},null,10,I2),r.createElementVNode("div",N2,[r.createElementVNode("p",T2,r.toDisplayString(a.data.name),1),a.is_group?r.createCommentVNode("",!0):(r.openBlock(),r.createElementBlock("p",k2,r.toDisplayString(r.unref(hr)(a.data))+" ₽",1))])],2))],2),r.unref(m)?r.createCommentVNode("",!0):(r.openBlock(),r.createElementBlock("div",R2,[a.is_group?r.createCommentVNode("",!0):(r.openBlock(),r.createElementBlock("div",B2,[r.createElementVNode("div",{onClick:O[1]||(O[1]=v=>_(a.data,p.data)),class:"add_button"},[...O[2]||(O[2]=[r.createElementVNode("div",{class:"image_add_button"},null,-1)])])]))]))])]),_:1},8,["id"])])):r.createCommentVNode("",!0)}}}),[["__scopeId","data-v-bfc53e47"]]),O2=["id","onClick"],M2=Xe(r.defineComponent({__name:"GroupMain",props:{menuGroup:{},idActiveGroup:{},activeTakeGroup:{type:Function}},setup(a){const{shouldUseDragScroll:l}=Hn(),i=r.ref(null);return(s,u)=>a.menuGroup.length?r.withDirectives((r.openBlock(),r.createElementBlock("ul",{key:0,class:"main__menu",ref_key:"scrollGroup",ref:i},[r.createVNode(ho,{axis:"x",behavior:"smooth",container:i.value,autoScroll:!0,idActive:a.idActiveGroup,clearContainer:!0},{default:r.withCtx(({handleTargetClick:f})=>[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(a.menuGroup,(m,p)=>(r.openBlock(),r.createElementBlock("li",{key:m.id,id:"scrolling"+m.id,onClick:_=>{a.activeTakeGroup&&a.activeTakeGroup(m.id,p),f(_)},style:r.normalizeStyle(a.idActiveGroup==m.id?{fontFamily:"Bounded"}:{})},r.toDisplayString(m.name),13,O2))),128))]),_:1},8,["container","idActive"])])),[[r.unref(Wr),r.unref(l)?{}:!1]]):r.createCommentVNode("",!0)}}),[["__scopeId","data-v-aa0ca388"]]),D2=["id","onClick"],v2=Xe(r.defineComponent({__name:"TagsMain",props:{menuTags:{default:()=>[]},groupIndex:{default:null},isSolo:{type:Boolean,default:!1},currentActiveTag:{},activeTakeTags:{type:Function,default:void 0},activeTakeTagsSolo:{type:Function,default:void 0}},setup(a){const l=a,{shouldUseDragScroll:i}=Hn(),s=r.ref(null),u=r.computed(()=>{if(l.isSolo&&!l.groupIndex)return Array.isArray(l.currentActiveTag)?l.currentActiveTag:[];if(l.groupIndex!==null&&l.groupIndex!==void 0){const f=l.currentActiveTag[l.groupIndex];return Array.isArray(f)?f:[]}return[]});return(f,m)=>a.menuTags.length>0?r.withDirectives((r.openBlock(),r.createElementBlock("ul",{key:0,class:"main__filters",ref_key:"scrollTagContainer",ref:s},[r.createVNode(ho,{axis:"x",behavior:"smooth",container:s.value,autoScroll:!0,idActive:u.value?u.value[a.currentActiveTag.length-1]:null,clearContainer:!1},{default:r.withCtx(({handleTargetClick:p})=>[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(a.menuTags,(_,x)=>(r.openBlock(),r.createElementBlock("li",{key:x,id:`scrolling${_}`,onClick:C=>{a.activeTakeTags&&(a.groupIndex||a.groupIndex===0)?a.activeTakeTags(_,a.groupIndex):a.activeTakeTagsSolo&&a.activeTakeTagsSolo(_),p(C)},class:r.normalizeClass({main__filter_active:(u.value??[]).includes(_)})},r.toDisplayString(_),11,D2))),128))]),_:1},8,["container","idActive"])])),[[r.unref(Wr),r.unref(i)?{}:!1]]):r.createCommentVNode("",!0)}}),[["__scopeId","data-v-afba730a"]]),P2=["data-id"],L2=["src"],F2=["src"],V2=Xe(r.defineComponent({__name:"DrumItem",props:{group:{},index:{},active:{type:Boolean}},setup(a){const l=a,{mediaUrl:i}=Tn(()=>{var s,u;return(s=l.group)!=null&&s.video_link?`${l.group.id}_video`:(u=l.group)!=null&&u.image_link?`${l.group.id}_image`:null});return(s,u)=>a.group?(r.openBlock(),r.createElementBlock("div",{key:0,class:r.normalizeClass(["drum_item",{active:l.active}]),"data-id":a.group.id},[a.group.video_link?r.withDirectives((r.openBlock(),r.createElementBlock("video",{key:r.unref(i),loop:"",autoplay:"",muted:"",playsinline:"",class:"drum_img"},[r.createElementVNode("source",{src:r.unref(i)||"",type:"video/webm"},null,8,L2)])),[[r.unref(Xr)]]):(r.openBlock(),r.createElementBlock("img",{key:1,class:"drum_img",src:r.unref(i)||""},null,8,F2)),r.createElementVNode("p",null,r.toDisplayString(a.group.name),1)],10,P2)):r.createCommentVNode("",!0)}}),[["__scopeId","data-v-2b994529"]]),U2={},z2={width:"9.998535",height:"10.000000",viewBox:"0 0 9.99854 10",fill:"none",xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink"};function H2(a,l){return r.openBlock(),r.createElementBlock("svg",z2,[...l[0]||(l[0]=[r.createElementVNode("desc",null," Created with Pixso. ",-1),r.createElementVNode("defs",null,null,-1),r.createElementVNode("path",{id:"Форма 5",d:"M4.23 10L5.76 10L5.76 5.74L9.99 5.74L9.99 4.25L5.76 4.25L5.76 0L4.23 0L4.23 4.25L0 4.25L0 5.74L4.23 5.74L4.23 10Z",fill:"#F2F7FF","fill-opacity":"1.000000","fill-rule":"nonzero"},null,-1)])])}const G2=Xe(U2,[["render",H2]]),W2={class:"recommendation_wrapper"},X2={class:"recommendation_header"},$2={class:"recommendation_info"},j2=Xe(r.defineComponent({__name:"Recommendation",props:{closeCurrentCard:{},openCurrentCard:{}},setup(a){const l=Lt(),{isUpSale:i,dataUpSale:s}=_e.storeToRefs(l),u=()=>{i.value=!1};return r.onUnmounted(()=>{s.value=null}),(f,m)=>(r.openBlock(),r.createElementBlock("div",W2,[r.createElementVNode("div",X2,[m[0]||(m[0]=r.createElementVNode("p",{class:"header_title"},"Часто берут вместе",-1)),r.createElementVNode("div",{class:"header_close",onClick:u},[r.createVNode(G2,{class:"close_icon"})])]),r.createElementVNode("div",$2,[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(r.unref(s),p=>(r.openBlock(),r.createBlock(xa,{data:p,key:p.id,parent:p.id,is_group:!1,is_product:!0,class:"card",activeTags:[],isLoading:!1,closeCurrentCard:a.closeCurrentCard,takeCurrentCard:()=>a.openCurrentCard(p.id,!0)},null,8,["data","parent","closeCurrentCard","takeCurrentCard"]))),128))])]))}}),[["__scopeId","data-v-d545ec45"]]),q2=r.defineComponent({__name:"Blackout",props:{data:{type:Boolean}},setup(a){const l=a;return r.watch(()=>l.data,i=>{document.body.style.overflow=i?"hidden":""}),()=>{}}}),Z2={class:"wrapper_modal"},Y2={class:"card_modal"},K2=Xe(r.defineComponent({__name:"ModalWindows",props:{visible:{type:Boolean}},setup(a){const l=a,i=Lt(),{isUpSale:s}=_e.storeToRefs(i),u=()=>{s.value=!1};return(f,m)=>(r.openBlock(),r.createElementBlock(r.Fragment,null,[r.createVNode(q2,{data:l.visible},null,8,["data"]),r.createElementVNode("div",{class:"black_modal",onClick:u}),r.createElementVNode("div",Z2,[r.createElementVNode("div",Y2,[r.renderSlot(f.$slots,"default",{},void 0,!0)])])],64))}}),[["__scopeId","data-v-ec2b2c4d"]]);var we;(function(a){a[a.QR_CODE=0]="QR_CODE",a[a.AZTEC=1]="AZTEC",a[a.CODABAR=2]="CODABAR",a[a.CODE_39=3]="CODE_39",a[a.CODE_93=4]="CODE_93",a[a.CODE_128=5]="CODE_128",a[a.DATA_MATRIX=6]="DATA_MATRIX",a[a.MAXICODE=7]="MAXICODE",a[a.ITF=8]="ITF",a[a.EAN_13=9]="EAN_13",a[a.EAN_8=10]="EAN_8",a[a.PDF_417=11]="PDF_417",a[a.RSS_14=12]="RSS_14",a[a.RSS_EXPANDED=13]="RSS_EXPANDED",a[a.UPC_A=14]="UPC_A",a[a.UPC_E=15]="UPC_E",a[a.UPC_EAN_EXTENSION=16]="UPC_EAN_EXTENSION"})(we||(we={}));var _a=new Map([[we.QR_CODE,"QR_CODE"],[we.AZTEC,"AZTEC"],[we.CODABAR,"CODABAR"],[we.CODE_39,"CODE_39"],[we.CODE_93,"CODE_93"],[we.CODE_128,"CODE_128"],[we.DATA_MATRIX,"DATA_MATRIX"],[we.MAXICODE,"MAXICODE"],[we.ITF,"ITF"],[we.EAN_13,"EAN_13"],[we.EAN_8,"EAN_8"],[we.PDF_417,"PDF_417"],[we.RSS_14,"RSS_14"],[we.RSS_EXPANDED,"RSS_EXPANDED"],[we.UPC_A,"UPC_A"],[we.UPC_E,"UPC_E"],[we.UPC_EAN_EXTENSION,"UPC_EAN_EXTENSION"]]),wa;(function(a){a[a.UNKNOWN=0]="UNKNOWN",a[a.URL=1]="URL"})(wa||(wa={}));function Q2(a){return Object.values(we).includes(a)}var Ai;(function(a){a[a.SCAN_TYPE_CAMERA=0]="SCAN_TYPE_CAMERA",a[a.SCAN_TYPE_FILE=1]="SCAN_TYPE_FILE"})(Ai||(Ai={}));var J2=function(){function a(){}return a.GITHUB_PROJECT_URL="https://github.com/mebjas/html5-qrcode",a.SCAN_DEFAULT_FPS=2,a.DEFAULT_DISABLE_FLIP=!1,a.DEFAULT_REMEMBER_LAST_CAMERA_USED=!0,a.DEFAULT_SUPPORTED_SCAN_TYPE=[Ai.SCAN_TYPE_CAMERA,Ai.SCAN_TYPE_FILE],a}(),Ca=function(){function a(l,i){this.format=l,this.formatName=i}return a.prototype.toString=function(){return this.formatName},a.create=function(l){if(!_a.has(l))throw"".concat(l," not in html5QrcodeSupportedFormatsTextMap");return new a(l,_a.get(l))},a}(),Ea=function(){function a(){}return a.createFromText=function(l){var i={text:l};return{decodedText:l,result:i}},a.createFromQrcodeResult=function(l){return{decodedText:l.text,result:l}},a}(),Ao;(function(a){a[a.UNKWOWN_ERROR=0]="UNKWOWN_ERROR",a[a.IMPLEMENTATION_ERROR=1]="IMPLEMENTATION_ERROR",a[a.NO_CODE_FOUND_ERROR=2]="NO_CODE_FOUND_ERROR"})(Ao||(Ao={}));var em=function(){function a(){}return a.createFrom=function(l){return{errorMessage:l,type:Ao.UNKWOWN_ERROR}},a}(),tm=function(){function a(l){this.verbose=l}return a.prototype.log=function(l){this.verbose&&console.log(l)},a.prototype.warn=function(l){this.verbose&&console.warn(l)},a.prototype.logError=function(l,i){(this.verbose||i===!0)&&console.error(l)},a.prototype.logErrors=function(l){if(l.length===0)throw"Logger#logError called without arguments";this.verbose&&console.error(l)},a}();function Un(a){return typeof a>"u"||a===null}var Er=function(){function a(){}return a.codeParseError=function(l){return"QR code parse error, error = ".concat(l)},a.errorGettingUserMedia=function(l){return"Error getting userMedia, error = ".concat(l)},a.onlyDeviceSupportedError=function(){return"The device doesn't support navigator.mediaDevices , only supported cameraIdOrConfig in this case is deviceId parameter (string)."},a.cameraStreamingNotSupported=function(){return"Camera streaming not supported by the browser."},a.unableToQuerySupportedDevices=function(){return"Unable to query supported devices, unknown error."},a.insecureContextCameraQueryError=function(){return"Camera access is only supported in secure context like https or localhost."},a.scannerPaused=function(){return"Scanner paused"},a}(),ya=function(){function a(){}return a.isMediaStreamConstraintsValid=function(l,i){if(typeof l!="object"){var s=typeof l;return i.logError("videoConstraints should be of type object, the "+"object passed is of type ".concat(s,"."),!0),!1}for(var u=["autoGainControl","channelCount","echoCancellation","latency","noiseSuppression","sampleRate","sampleSize","volume"],f=new Set(u),m=Object.keys(l),p=0,_=m;p<_.length;p++){var x=_[p];if(f.has(x))return i.logError("".concat(x," is not supported videoConstaints."),!0),!1}return!0},a}(),So={exports:{}};(function(a,l){(function(i,s){s(l)})(_r,function(i){function s(b){return b==null}var u=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(b,e){b.__proto__=e}||function(b,e){for(var t in e)e.hasOwnProperty(t)&&(b[t]=e[t])};function f(b,e){u(b,e);function t(){this.constructor=b}b.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}function m(b,e){var t=Object.setPrototypeOf;t?t(b,e):b.__proto__=e}function p(b,e){e===void 0&&(e=b.constructor);var t=Error.captureStackTrace;t&&t(b,e)}var _=function(b){f(e,b);function e(t){var n=this.constructor,o=b.call(this,t)||this;return Object.defineProperty(o,"name",{value:n.name,enumerable:!1}),m(o,n.prototype),p(o),o}return e}(Error);class x extends _{constructor(e=void 0){super(e),this.message=e}getKind(){return this.constructor.kind}}x.kind="Exception";class C extends x{}C.kind="ArgumentException";class y extends x{}y.kind="IllegalArgumentException";class I{constructor(e){if(this.binarizer=e,e===null)throw new y("Binarizer must be non-null.")}getWidth(){return this.binarizer.getWidth()}getHeight(){return this.binarizer.getHeight()}getBlackRow(e,t){return this.binarizer.getBlackRow(e,t)}getBlackMatrix(){return(this.matrix===null||this.matrix===void 0)&&(this.matrix=this.binarizer.getBlackMatrix()),this.matrix}isCropSupported(){return this.binarizer.getLuminanceSource().isCropSupported()}crop(e,t,n,o){const c=this.binarizer.getLuminanceSource().crop(e,t,n,o);return new I(this.binarizer.createBinarizer(c))}isRotateSupported(){return this.binarizer.getLuminanceSource().isRotateSupported()}rotateCounterClockwise(){const e=this.binarizer.getLuminanceSource().rotateCounterClockwise();return new I(this.binarizer.createBinarizer(e))}rotateCounterClockwise45(){const e=this.binarizer.getLuminanceSource().rotateCounterClockwise45();return new I(this.binarizer.createBinarizer(e))}toString(){try{return this.getBlackMatrix().toString()}catch{return""}}}class O extends x{static getChecksumInstance(){return new O}}O.kind="ChecksumException";class N{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,o,c){for(;c--;)n[o++]=e[t++]}static currentTimeMillis(){return Date.now()}}class k extends x{}k.kind="IndexOutOfBoundsException";class P extends k{constructor(e=void 0,t=void 0){super(t),this.index=e,this.message=t}}P.kind="ArrayIndexOutOfBoundsException";class D{static fill(e,t){for(let n=0,o=e.length;n<o;n++)e[n]=t}static fillWithin(e,t,n,o){D.rangeCheck(e.length,t,n);for(let c=t;c<n;c++)e[c]=o}static rangeCheck(e,t,n){if(t>n)throw new y("fromIndex("+t+") > toIndex("+n+")");if(t<0)throw new P(t);if(n>e)throw new P(n)}static asList(...e){return e}static create(e,t,n){return Array.from({length:e}).map(c=>Array.from({length:t}).fill(n))}static createInt32Array(e,t,n){return Array.from({length:e}).map(c=>Int32Array.from({length:t}).fill(n))}static equals(e,t){if(!e||!t||!e.length||!t.length||e.length!==t.length)return!1;for(let n=0,o=e.length;n<o;n++)if(e[n]!==t[n])return!1;return!0}static hashCode(e){if(e===null)return 0;let t=1;for(const n of e)t=31*t+n;return t}static fillUint8Array(e,t){for(let n=0;n!==e.length;n++)e[n]=t}static copyOf(e,t){return e.slice(0,t)}static copyOfUint8Array(e,t){if(e.length<=t){const n=new Uint8Array(t);return n.set(e),n}return e.slice(0,t)}static copyOfRange(e,t,n){const o=n-t,c=new Int32Array(o);return v.arraycopy(e,t,c,0,o),c}static binarySearch(e,t,n){n===void 0&&(n=D.numberComparator);let o=0,c=e.length-1;for(;o<=c;){const d=c+o>>1,h=n(t,e[d]);if(h>0)o=d+1;else if(h<0)c=d-1;else return d}return-o-1}static numberComparator(e,t){return e-t}}class 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 q{constructor(e,t){e===void 0?(this.size=0,this.bits=new Int32Array(1)):(this.size=e,t==null?this.bits=q.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=q.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 o=Math.floor(e/32),c=n[o];c&=~((1<<(e&31))-1);const d=n.length;for(;c===0;){if(++o===d)return t;c=n[o]}const h=o*32+M.numberOfTrailingZeros(c);return h>t?t:h}getNextUnset(e){const t=this.size;if(e>=t)return t;const n=this.bits;let o=Math.floor(e/32),c=~n[o];c&=~((1<<(e&31))-1);const d=n.length;for(;c===0;){if(++o===d)return t;c=~n[o]}const h=o*32+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),o=Math.floor(t/32),c=this.bits;for(let d=n;d<=o;d++){const h=d>n?0:e&31,w=(2<<(d<o?31:t&31))-(1<<h);c[d]|=w}}clear(){const e=this.bits.length,t=this.bits;for(let n=0;n<e;n++)t[n]=0}isRange(e,t,n){if(t<e||e<0||t>this.size)throw new y;if(t===e)return!0;t--;const o=Math.floor(e/32),c=Math.floor(t/32),d=this.bits;for(let h=o;h<=c;h++){const g=h>o?0:e&31,E=(2<<(h<c?31:t&31))-(1<<g)&4294967295;if((d[h]&E)!==(n?E:0))return!1}return!0}appendBit(e){this.ensureCapacity(this.size+1),e&&(this.bits[Math.floor(this.size/32)]|=1<<(this.size&31)),this.size++}appendBits(e,t){if(t<0||t>32)throw new y("Num bits must be between 0 and 32");this.ensureCapacity(this.size+t);for(let n=t;n>0;n--)this.appendBit((e>>n-1&1)===1)}appendBitArray(e){const t=e.size;this.ensureCapacity(this.size+t);for(let n=0;n<t;n++)this.appendBit(e.get(n))}xor(e){if(this.size!==e.size)throw new y("Sizes don't match");const t=this.bits;for(let n=0,o=t.length;n<o;n++)t[n]^=e.bits[n]}toBytes(e,t,n,o){for(let c=0;c<o;c++){let d=0;for(let h=0;h<8;h++)this.get(e)&&(d|=1<<7-h),e++;t[n+c]=d}}getBitArray(){return this.bits}reverse(){const e=new Int32Array(this.bits.length),t=Math.floor((this.size-1)/32),n=t+1,o=this.bits;for(let c=0;c<n;c++){let d=o[c];d=d>>1&1431655765|(d&1431655765)<<1,d=d>>2&858993459|(d&858993459)<<2,d=d>>4&252645135|(d&252645135)<<4,d=d>>8&16711935|(d&16711935)<<8,d=d>>16&65535|(d&65535)<<16,e[t-c]=d}if(this.size!==n*32){const c=n*32-this.size;let d=e[0]>>>c;for(let h=1;h<n;h++){const g=e[h];d|=g<<32-c,e[h-1]=d,d=g>>>c}e[n-1]=d}this.bits=e}static makeArray(e){return new Int32Array(Math.floor((e+31)/32))}equals(e){if(!(e instanceof q))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 q(this.size,this.bits.slice())}}var W;(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"})(W||(W={}));var Y=W;class F extends x{static getFormatInstance(){return new F}}F.kind="FormatException";var L;(function(b){b[b.Cp437=0]="Cp437",b[b.ISO8859_1=1]="ISO8859_1",b[b.ISO8859_2=2]="ISO8859_2",b[b.ISO8859_3=3]="ISO8859_3",b[b.ISO8859_4=4]="ISO8859_4",b[b.ISO8859_5=5]="ISO8859_5",b[b.ISO8859_6=6]="ISO8859_6",b[b.ISO8859_7=7]="ISO8859_7",b[b.ISO8859_8=8]="ISO8859_8",b[b.ISO8859_9=9]="ISO8859_9",b[b.ISO8859_10=10]="ISO8859_10",b[b.ISO8859_11=11]="ISO8859_11",b[b.ISO8859_13=12]="ISO8859_13",b[b.ISO8859_14=13]="ISO8859_14",b[b.ISO8859_15=14]="ISO8859_15",b[b.ISO8859_16=15]="ISO8859_16",b[b.SJIS=16]="SJIS",b[b.Cp1250=17]="Cp1250",b[b.Cp1251=18]="Cp1251",b[b.Cp1252=19]="Cp1252",b[b.Cp1256=20]="Cp1256",b[b.UnicodeBigUnmarked=21]="UnicodeBigUnmarked",b[b.UTF8=22]="UTF8",b[b.ASCII=23]="ASCII",b[b.Big5=24]="Big5",b[b.GB18030=25]="GB18030",b[b.EUC_KR=26]="EUC_KR"})(L||(L={}));class V{constructor(e,t,n,...o){this.valueIdentifier=e,this.name=n,typeof t=="number"?this.values=Int32Array.from([t]):this.values=t,this.otherEncodingNames=o,V.VALUE_IDENTIFIER_TO_ECI.set(e,this),V.NAME_TO_ECI.set(n,this);const c=this.values;for(let d=0,h=c.length;d!==h;d++){const g=c[d];V.VALUES_TO_ECI.set(g,this)}for(const d of o)V.NAME_TO_ECI.set(d,this)}getValueIdentifier(){return this.valueIdentifier}getName(){return this.name}getValue(){return this.values[0]}static getCharacterSetECIByValue(e){if(e<0||e>=900)throw new F("incorect value");const t=V.VALUES_TO_ECI.get(e);if(t===void 0)throw new F("incorect value");return t}static getCharacterSetECIByName(e){const t=V.NAME_TO_ECI.get(e);if(t===void 0)throw new F("incorect value");return t}equals(e){if(!(e instanceof V))return!1;const t=e;return this.getName()===t.getName()}}V.VALUE_IDENTIFIER_TO_ECI=new Map,V.VALUES_TO_ECI=new Map,V.NAME_TO_ECI=new Map,V.Cp437=new V(L.Cp437,Int32Array.from([0,2]),"Cp437"),V.ISO8859_1=new V(L.ISO8859_1,Int32Array.from([1,3]),"ISO-8859-1","ISO88591","ISO8859_1"),V.ISO8859_2=new V(L.ISO8859_2,4,"ISO-8859-2","ISO88592","ISO8859_2"),V.ISO8859_3=new V(L.ISO8859_3,5,"ISO-8859-3","ISO88593","ISO8859_3"),V.ISO8859_4=new V(L.ISO8859_4,6,"ISO-8859-4","ISO88594","ISO8859_4"),V.ISO8859_5=new V(L.ISO8859_5,7,"ISO-8859-5","ISO88595","ISO8859_5"),V.ISO8859_6=new V(L.ISO8859_6,8,"ISO-8859-6","ISO88596","ISO8859_6"),V.ISO8859_7=new V(L.ISO8859_7,9,"ISO-8859-7","ISO88597","ISO8859_7"),V.ISO8859_8=new V(L.ISO8859_8,10,"ISO-8859-8","ISO88598","ISO8859_8"),V.ISO8859_9=new V(L.ISO8859_9,11,"ISO-8859-9","ISO88599","ISO8859_9"),V.ISO8859_10=new V(L.ISO8859_10,12,"ISO-8859-10","ISO885910","ISO8859_10"),V.ISO8859_11=new V(L.ISO8859_11,13,"ISO-8859-11","ISO885911","ISO8859_11"),V.ISO8859_13=new V(L.ISO8859_13,15,"ISO-8859-13","ISO885913","ISO8859_13"),V.ISO8859_14=new V(L.ISO8859_14,16,"ISO-8859-14","ISO885914","ISO8859_14"),V.ISO8859_15=new V(L.ISO8859_15,17,"ISO-8859-15","ISO885915","ISO8859_15"),V.ISO8859_16=new V(L.ISO8859_16,18,"ISO-8859-16","ISO885916","ISO8859_16"),V.SJIS=new V(L.SJIS,20,"SJIS","Shift_JIS"),V.Cp1250=new V(L.Cp1250,21,"Cp1250","windows-1250"),V.Cp1251=new V(L.Cp1251,22,"Cp1251","windows-1251"),V.Cp1252=new V(L.Cp1252,23,"Cp1252","windows-1252"),V.Cp1256=new V(L.Cp1256,24,"Cp1256","windows-1256"),V.UnicodeBigUnmarked=new V(L.UnicodeBigUnmarked,25,"UnicodeBigUnmarked","UTF-16BE","UnicodeBig"),V.UTF8=new V(L.UTF8,26,"UTF8","UTF-8"),V.ASCII=new V(L.ASCII,Int32Array.from([27,170]),"ASCII","US-ASCII"),V.Big5=new V(L.Big5,28,"Big5"),V.GB18030=new V(L.GB18030,29,"GB18030","GB2312","EUC_CN","GBK"),V.EUC_KR=new V(L.EUC_KR,30,"EUC_KR","EUC-KR");class ie extends x{}ie.kind="UnsupportedOperationException";class Q{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!Q.isBrowser()&&e==="ISO-8859-1"}static encode(e,t){const n=this.encodingName(t);return this.customEncoder?this.customEncoder(e,n):typeof TextEncoder>"u"?this.encodeFallback(e):new TextEncoder().encode(e)}static isBrowser(){return typeof window<"u"&&{}.toString.call(window)==="[object Window]"}static encodingName(e){return typeof e=="string"?e:e.getName()}static encodingCharacterSet(e){return e instanceof V?e:V.getCharacterSetECIByName(e)}static decodeFallback(e,t){const n=this.encodingCharacterSet(t);if(Q.isDecodeFallbackSupported(n)){let o="";for(let c=0,d=e.length;c<d;c++){let h=e[c].toString(16);h.length<2&&(h="0"+h),o+="%"+h}return decodeURIComponent(o)}if(n.equals(V.UnicodeBigUnmarked))return String.fromCharCode.apply(null,new Uint16Array(e.buffer));throw new ie(`Encoding ${this.encodingName(t)} not supported by fallback.`)}static isDecodeFallbackSupported(e){return e.equals(V.UTF8)||e.equals(V.ISO8859_1)||e.equals(V.ASCII)}static encodeFallback(e){const n=btoa(unescape(encodeURIComponent(e))).split(""),o=[];for(let c=0;c<n.length;c++)o.push(n[c].charCodeAt(0));return new Uint8Array(o)}}class te{static castAsNonUtf8Char(e,t=null){const n=t?t.getName():this.ISO88591;return Q.decode(new Uint8Array([e]),n)}static guessEncoding(e,t){if(t!=null&&t.get(Y.CHARACTER_SET)!==void 0)return t.get(Y.CHARACTER_SET).toString();const n=e.length;let o=!0,c=!0,d=!0,h=0,g=0,w=0,E=0,A=0,S=0,B=0,U=0,H=0,K=0,oe=0;const ue=e.length>3&&e[0]===239&&e[1]===187&&e[2]===191;for(let fe=0;fe<n&&(o||c||d);fe++){const le=e[fe]&255;d&&(h>0?le&128?h--:d=!1:le&128&&(le&64?(h++,le&32?(h++,le&16?(h++,le&8?d=!1:E++):w++):g++):d=!1)),o&&(le>127&&le<160?o=!1:le>159&&(le<192||le===215||le===247)&&oe++),c&&(A>0?le<64||le===127||le>252?c=!1:A--:le===128||le===160||le>239?c=!1:le>160&&le<224?(S++,U=0,B++,B>H&&(H=B)):le>127?(A++,B=0,U++,U>K&&(K=U)):(B=0,U=0))}return d&&h>0&&(d=!1),c&&A>0&&(c=!1),d&&(ue||g+w+E>0)?te.UTF8:c&&(te.ASSUME_SHIFT_JIS||H>=3||K>=3)?te.SHIFT_JIS:o&&c?H===2&&S===2||oe*10>=n?te.SHIFT_JIS:te.ISO88591:o?te.ISO88591:c?te.SHIFT_JIS:d?te.UTF8:te.PLATFORM_DEFAULT_ENCODING}static format(e,...t){let n=-1;function o(d,h,g,w,E,A){if(d==="%%")return"%";if(t[++n]===void 0)return;d=w?parseInt(w.substr(1)):void 0;let S=E?parseInt(E.substr(1)):void 0,B;switch(A){case"s":B=t[n];break;case"c":B=t[n][0];break;case"f":B=parseFloat(t[n]).toFixed(d);break;case"p":B=parseFloat(t[n]).toPrecision(d);break;case"e":B=parseFloat(t[n]).toExponential(d);break;case"x":B=parseInt(t[n]).toString(S||16);break;case"d":B=parseFloat(parseInt(t[n],S||10).toPrecision(d)).toFixed(0);break}B=typeof B=="object"?JSON.stringify(B):(+B).toString(S);let U=parseInt(g),H=g&&g[0]+""=="0"?"0":" ";for(;B.length<U;)B=h!==void 0?B+H:H+B;return B}let c=/%(-)?(0?[0-9]+)?([.][0-9]+)?([#][0-9]+)?([scfpexd%])/g;return e.replace(c,o)}static getBytes(e,t){return Q.encode(e,t)}static getCharCode(e,t=0){return e.charCodeAt(t)}static getCharAt(e){return String.fromCharCode(e)}}te.SHIFT_JIS=V.SJIS.getName(),te.GB2312="GB2312",te.ISO88591=V.ISO8859_1.getName(),te.EUC_JP="EUC_JP",te.UTF8=V.UTF8.getName(),te.PLATFORM_DEFAULT_ENCODING=te.UTF8,te.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+=te.castAsNonUtf8Char(e,this.encoding):this.value+=String.fromCharCode(e),this}appendChars(e,t,n){for(let o=t;t<t+n;o++)this.append(e[o]);return this}length(){return this.value.length}charAt(e){return this.value.charAt(e)}deleteCharAt(e){this.value=this.value.substr(0,e)+this.value.substring(e+1)}setCharAt(e,t){this.value=this.value.substr(0,e)+t+this.value.substr(e+1)}substring(e,t){return this.value.substring(e,t)}setLengthToZero(){this.value=""}toString(){return this.value}insert(e,t){this.value=this.value.substr(0,e)+t+this.value.substr(e+t.length)}}class z{constructor(e,t,n,o){if(this.width=e,this.height=t,this.rowSize=n,this.bits=o,t==null&&(t=e),this.height=t,e<1||t<1)throw new y("Both dimensions must be greater than 0");n==null&&(n=Math.floor((e+31)/32)),this.rowSize=n,o==null&&(this.bits=new Int32Array(this.rowSize*this.height))}static parseFromBooleanArray(e){const t=e.length,n=e[0].length,o=new z(n,t);for(let c=0;c<t;c++){const d=e[c];for(let h=0;h<n;h++)d[h]&&o.set(h,c)}return o}static parseFromString(e,t,n){if(e===null)throw new y("stringRepresentation cannot be null");const o=new Array(e.length);let c=0,d=0,h=-1,g=0,w=0;for(;w<e.length;)if(e.charAt(w)===`
12
+ `||e.charAt(w)==="\r"){if(c>d){if(h===-1)h=c-d;else if(c-d!==h)throw new y("row lengths do not match");d=c,g++}w++}else if(e.substring(w,w+t.length)===t)w+=t.length,o[c]=!0,c++;else if(e.substring(w,w+n.length)===n)w+=n.length,o[c]=!1,c++;else throw new y("illegal character encountered: "+e.substring(w));if(c>d){if(h===-1)h=c-d;else if(c-d!==h)throw new y("row lengths do not match");g++}const E=new z(h,g);for(let A=0;A<c;A++)o[A]&&E.set(Math.floor(A%h),Math.floor(A/h));return E}get(e,t){const n=t*this.rowSize+Math.floor(e/32);return(this.bits[n]>>>(e&31)&1)!==0}set(e,t){const n=t*this.rowSize+Math.floor(e/32);this.bits[n]|=1<<(e&31)&4294967295}unset(e,t){const n=t*this.rowSize+Math.floor(e/32);this.bits[n]&=~(1<<(e&31)&4294967295)}flip(e,t){const n=t*this.rowSize+Math.floor(e/32);this.bits[n]^=1<<(e&31)&4294967295}xor(e){if(this.width!==e.getWidth()||this.height!==e.getHeight()||this.rowSize!==e.getRowSize())throw new y("input matrix dimensions do not match");const t=new q(Math.floor(this.width/32)+1),n=this.rowSize,o=this.bits;for(let c=0,d=this.height;c<d;c++){const h=c*n,g=e.getRow(c,t).getBitArray();for(let w=0;w<n;w++)o[h+w]^=g[w]}}clear(){const e=this.bits,t=e.length;for(let n=0;n<t;n++)e[n]=0}setRegion(e,t,n,o){if(t<0||e<0)throw new y("Left and top must be nonnegative");if(o<1||n<1)throw new y("Height and width must be at least 1");const c=e+n,d=t+o;if(d>this.height||c>this.width)throw new y("The region must fit inside the matrix");const h=this.rowSize,g=this.bits;for(let w=t;w<d;w++){const E=w*h;for(let A=e;A<c;A++)g[E+Math.floor(A/32)]|=1<<(A&31)&4294967295}}getRow(e,t){t==null||t.getSize()<this.width?t=new q(this.width):t.clear();const n=this.rowSize,o=this.bits,c=e*n;for(let d=0;d<n;d++)t.setBulk(d*32,o[c+d]);return t}setRow(e,t){v.arraycopy(t.getBitArray(),0,this.bits,e*this.rowSize,this.rowSize)}rotate180(){const e=this.getWidth(),t=this.getHeight();let n=new q(e),o=new q(e);for(let c=0,d=Math.floor((t+1)/2);c<d;c++)n=this.getRow(c,n),o=this.getRow(t-1-c,o),n.reverse(),o.reverse(),this.setRow(c,o),this.setRow(t-1-c,n)}getEnclosingRectangle(){const e=this.width,t=this.height,n=this.rowSize,o=this.bits;let c=e,d=t,h=-1,g=-1;for(let w=0;w<t;w++)for(let E=0;E<n;E++){const A=o[w*n+E];if(A!==0){if(w<d&&(d=w),w>g&&(g=w),E*32<c){let S=0;for(;!(A<<31-S&4294967295);)S++;E*32+S<c&&(c=E*32+S)}if(E*32+31>h){let S=31;for(;!(A>>>S);)S--;E*32+S>h&&(h=E*32+S)}}}return h<c||g<d?null:Int32Array.from([c,d,h-c+1,g-d+1])}getTopLeftOnBit(){const e=this.rowSize,t=this.bits;let n=0;for(;n<t.length&&t[n]===0;)n++;if(n===t.length)return null;const o=n/e;let c=n%e*32;const d=t[n];let h=0;for(;!(d<<31-h&4294967295);)h++;return c+=h,Int32Array.from([c,o])}getBottomRightOnBit(){const e=this.rowSize,t=this.bits;let n=t.length-1;for(;n>=0&&t[n]===0;)n--;if(n<0)return null;const o=Math.floor(n/e);let c=Math.floor(n%e)*32;const d=t[n];let h=31;for(;!(d>>>h);)h--;return c+=h,Int32Array.from([c,o])}getWidth(){return this.width}getHeight(){return this.height}getRowSize(){return this.rowSize}equals(e){if(!(e instanceof z))return!1;const t=e;return this.width===t.width&&this.height===t.height&&this.rowSize===t.rowSize&&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 o=new G;for(let c=0,d=this.height;c<d;c++){for(let h=0,g=this.width;h<g;h++)o.append(this.get(h,c)?e:t);o.append(n)}return o.toString()}clone(){return new z(this.width,this.height,this.rowSize,this.bits.slice())}}class T extends x{static getNotFoundInstance(){return new T}}T.kind="NotFoundException";class X extends N{constructor(e){super(e),this.luminances=X.EMPTY,this.buckets=new Int32Array(X.LUMINANCE_BUCKETS)}getBlackRow(e,t){const n=this.getLuminanceSource(),o=n.getWidth();t==null||t.getSize()<o?t=new q(o):t.clear(),this.initArrays(o);const c=n.getRow(e,this.luminances),d=this.buckets;for(let g=0;g<o;g++)d[(c[g]&255)>>X.LUMINANCE_SHIFT]++;const h=X.estimateBlackPoint(d);if(o<3)for(let g=0;g<o;g++)(c[g]&255)<h&&t.set(g);else{let g=c[0]&255,w=c[1]&255;for(let E=1;E<o-1;E++){const A=c[E+1]&255;(w*4-g-A)/2<h&&t.set(E),g=w,w=A}}return t}getBlackMatrix(){const e=this.getLuminanceSource(),t=e.getWidth(),n=e.getHeight(),o=new z(t,n);this.initArrays(t);const c=this.buckets;for(let g=1;g<5;g++){const w=Math.floor(n*g/5),E=e.getRow(w,this.luminances),A=Math.floor(t*4/5);for(let S=Math.floor(t/5);S<A;S++){const B=E[S]&255;c[B>>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&&o.set(E,g)}return o}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,o=0,c=0;for(let E=0;E<t;E++)e[E]>c&&(o=E,c=e[E]),e[E]>n&&(n=e[E]);let d=0,h=0;for(let E=0;E<t;E++){const A=E-o,S=e[E]*A*A;S>h&&(d=E,h=S)}if(o>d){const E=o;o=d,d=E}if(d-o<=t/16)throw new T;let g=d-1,w=-1;for(let E=d-1;E>o;E--){const A=E-o,S=A*A*(d-E)*(n-e[E]);S>w&&(g=E,w=S)}return g<<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 o=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(o,c,d,t,n),g=new z(t,n);$.calculateThresholdForBlock(o,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,o,c,d,h){const g=c-$.BLOCK_SIZE,w=o-$.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 B=0;B<t;B++){let U=B<<$.BLOCK_SIZE_POWER;U>w&&(U=w);const H=$.cap(B,2,t-3);let K=0;for(let ue=-2;ue<=2;ue++){const fe=d[S+ue];K+=fe[H-2]+fe[H-1]+fe[H]+fe[H+1]+fe[H+2]}const oe=K/25;$.thresholdBlock(e,U,A,oe,o,h)}}}static cap(e,t,n){return e<t?t:e>n?n:e}static thresholdBlock(e,t,n,o,c,d){for(let h=0,g=n*c+t;h<$.BLOCK_SIZE;h++,g+=c)for(let w=0;w<$.BLOCK_SIZE;w++)(e[g+w]&255)<=o&&d.set(t+w,n+h)}static calculateBlackPoints(e,t,n,o,c){const d=c-$.BLOCK_SIZE,h=o-$.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 B=0,U=255,H=0;for(let oe=0,ue=E*o+S;oe<$.BLOCK_SIZE;oe++,ue+=o){for(let fe=0;fe<$.BLOCK_SIZE;fe++){const le=e[ue+fe]&255;B+=le,le<U&&(U=le),le>H&&(H=le)}if(H-U>$.MIN_DYNAMIC_RANGE)for(oe++,ue+=o;oe<$.BLOCK_SIZE;oe++,ue+=o)for(let fe=0;fe<$.BLOCK_SIZE;fe++)B+=e[ue+fe]&255}let K=B>>$.BLOCK_SIZE_POWER*2;if(H-U<=$.MIN_DYNAMIC_RANGE&&(K=U/2,w>0&&A>0)){const oe=(g[w-1][A]+2*g[w][A-1]+g[w-1][A-1])/4;U<oe&&(K=oe)}g[w][A]=K}}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 j{constructor(e,t){this.width=e,this.height=t}getWidth(){return this.width}getHeight(){return this.height}isCropSupported(){return!1}crop(e,t,n,o){throw new ie("This luminance source does not support cropping.")}isRotateSupported(){return!1}rotateCounterClockwise(){throw new ie("This luminance source does not support rotation by 90 degrees.")}rotateCounterClockwise45(){throw new ie("This luminance source does not support rotation by 45 degrees.")}toString(){const e=new Uint8ClampedArray(this.width);let t=new G;for(let n=0;n<this.height;n++){const o=this.getRow(n,e);for(let c=0;c<this.width;c++){const d=o[c]&255;let h;d<64?h="#":d<128?h="+":d<192?h=".":h=" ",t.append(h)}t.append(`
14
+ `)}return t.toString()}}class Z extends j{constructor(e){super(e.getWidth(),e.getHeight()),this.delegate=e}getRow(e,t){const n=this.delegate.getRow(e,t),o=this.getWidth();for(let c=0;c<o;c++)n[c]=255-(n[c]&255);return n}getMatrix(){const e=this.delegate.getMatrix(),t=this.getWidth()*this.getHeight(),n=new Uint8ClampedArray(t);for(let o=0;o<t;o++)n[o]=255-(e[o]&255);return n}isCropSupported(){return this.delegate.isCropSupported()}crop(e,t,n,o){return new Z(this.delegate.crop(e,t,n,o))}isRotateSupported(){return this.delegate.isRotateSupported()}invert(){return this.delegate}rotateCounterClockwise(){return new Z(this.delegate.rotateCounterClockwise())}rotateCounterClockwise45(){return new Z(this.delegate.rotateCounterClockwise45())}}class ee extends j{constructor(e){super(e.width,e.height),this.canvas=e,this.tempCanvasElement=null,this.buffer=ee.makeBufferFromCanvasImageData(e)}static makeBufferFromCanvasImageData(e){const t=e.getContext("2d").getImageData(0,0,e.width,e.height);return ee.toGrayscaleBuffer(t.data,e.width,e.height)}static toGrayscaleBuffer(e,t,n){const o=new Uint8ClampedArray(t*n);for(let c=0,d=0,h=e.length;c<h;c+=4,d++){let g;if(e[c+3]===0)g=255;else{const E=e[c],A=e[c+1],S=e[c+2];g=306*E+601*A+117*S+512>>10}o[d]=g}return o}getRow(e,t){if(e<0||e>=this.getHeight())throw new y("Requested row is outside the image: "+e);const n=this.getWidth(),o=e*n;return t===null?t=this.buffer.slice(o,o+n):(t.length<n&&(t=new Uint8ClampedArray(n)),t.set(this.buffer.slice(o,o+n))),t}getMatrix(){return this.buffer}isCropSupported(){return!0}crop(e,t,n,o){return super.crop(e,t,n,o),this}isRotateSupported(){return!0}rotateCounterClockwise(){return this.rotate(-90),this}rotateCounterClockwise45(){return this.rotate(-45),this}getTempCanvasElement(){if(this.tempCanvasElement===null){const e=this.canvas.ownerDocument.createElement("canvas");e.width=this.canvas.width,e.height=this.canvas.height,this.tempCanvasElement=e}return this.tempCanvasElement}rotate(e){const t=this.getTempCanvasElement(),n=t.getContext("2d"),o=e*ee.DEGREE_TO_RADIANS,c=this.canvas.width,d=this.canvas.height,h=Math.ceil(Math.abs(Math.cos(o))*c+Math.abs(Math.sin(o))*d),g=Math.ceil(Math.abs(Math.sin(o))*c+Math.abs(Math.cos(o))*d);return t.width=h,t.height=g,n.translate(h/2,g/2),n.rotate(o),n.drawImage(this.canvas,c/-2,d/-2),this.buffer=ee.makeBufferFromCanvasImageData(t),this}invert(){return new Z(this)}}ee.DEGREE_TO_RADIANS=Math.PI/180;class de{constructor(e,t,n){this.deviceId=e,this.label=t,this.kind="videoinput",this.groupId=n||void 0}toJSON(){return{kind:this.kind,groupId:this.groupId,deviceId:this.deviceId,label:this.label}}}var ce=(globalThis||_r||self||window||void 0)&&(globalThis||_r||self||window||void 0).__awaiter||function(b,e,t,n){function o(c){return c instanceof t?c:new t(function(d){d(c)})}return new(t||(t=Promise))(function(c,d){function h(E){try{w(n.next(E))}catch(A){d(A)}}function g(E){try{w(n.throw(E))}catch(A){d(A)}}function w(E){E.done?c(E.value):o(E.value).then(h,g)}w((n=n.apply(b,e||[])).next())})};class Ce{constructor(e,t=500,n){this.reader=e,this.timeBetweenScansMillis=t,this._hints=n,this._stopContinuousDecode=!1,this._stopAsyncDecode=!1,this._timeBetweenDecodingAttempts=0}get hasNavigator(){return typeof navigator<"u"}get isMediaDevicesSuported(){return this.hasNavigator&&!!navigator.mediaDevices}get canEnumerateDevices(){return!!(this.isMediaDevicesSuported&&navigator.mediaDevices.enumerateDevices)}get timeBetweenDecodingAttempts(){return this._timeBetweenDecodingAttempts}set timeBetweenDecodingAttempts(e){this._timeBetweenDecodingAttempts=e<0?0:e}set hints(e){this._hints=e||null}get hints(){return this._hints}listVideoInputDevices(){return ce(this,void 0,void 0,function*(){if(!this.hasNavigator)throw new Error("Can't enumerate devices, navigator is not present.");if(!this.canEnumerateDevices)throw new Error("Can't enumerate devices, method not supported.");const e=yield navigator.mediaDevices.enumerateDevices(),t=[];for(const n of e){const o=n.kind==="video"?"videoinput":n.kind;if(o!=="videoinput")continue;const c=n.deviceId||n.id,d=n.label||`Video device ${t.length+1}`,h=n.groupId,g={deviceId:c,label:d,kind:o,groupId:h};t.push(g)}return t})}getVideoInputDevices(){return ce(this,void 0,void 0,function*(){return(yield this.listVideoInputDevices()).map(t=>new de(t.deviceId,t.label))})}findDeviceById(e){return ce(this,void 0,void 0,function*(){const t=yield this.listVideoInputDevices();return t?t.find(n=>n.deviceId===e):null})}decodeFromInputVideoDevice(e,t){return ce(this,void 0,void 0,function*(){return yield this.decodeOnceFromVideoDevice(e,t)})}decodeOnceFromVideoDevice(e,t){return ce(this,void 0,void 0,function*(){this.reset();let n;e?n={deviceId:{exact:e}}:n={facingMode:"environment"};const o={video:n};return yield this.decodeOnceFromConstraints(o,t)})}decodeOnceFromConstraints(e,t){return ce(this,void 0,void 0,function*(){const n=yield navigator.mediaDevices.getUserMedia(e);return yield this.decodeOnceFromStream(n,t)})}decodeOnceFromStream(e,t){return ce(this,void 0,void 0,function*(){this.reset();const n=yield this.attachStreamToVideo(e,t);return yield this.decodeOnce(n)})}decodeFromInputVideoDeviceContinuously(e,t,n){return ce(this,void 0,void 0,function*(){return yield this.decodeFromVideoDevice(e,t,n)})}decodeFromVideoDevice(e,t,n){return ce(this,void 0,void 0,function*(){let o;e?o={deviceId:{exact:e}}:o={facingMode:"environment"};const c={video:o};return yield this.decodeFromConstraints(c,t,n)})}decodeFromConstraints(e,t,n){return ce(this,void 0,void 0,function*(){const o=yield navigator.mediaDevices.getUserMedia(e);return yield this.decodeFromStream(o,t,n)})}decodeFromStream(e,t,n){return ce(this,void 0,void 0,function*(){this.reset();const o=yield this.attachStreamToVideo(e,t);return yield this.decodeContinuously(o,n)})}stopAsyncDecode(){this._stopAsyncDecode=!0}stopContinuousDecode(){this._stopContinuousDecode=!0}attachStreamToVideo(e,t){return ce(this,void 0,void 0,function*(){const n=this.prepareVideoElement(t);return this.addVideoSource(n,e),this.videoElement=n,this.stream=e,yield this.playVideoOnLoadAsync(n),n})}playVideoOnLoadAsync(e){return new Promise((t,n)=>this.playVideoOnLoad(e,()=>t()))}playVideoOnLoad(e,t){this.videoEndedListener=()=>this.stopStreams(),this.videoCanPlayListener=()=>this.tryPlayVideo(e),e.addEventListener("ended",this.videoEndedListener),e.addEventListener("canplay",this.videoCanPlayListener),e.addEventListener("playing",t),this.tryPlayVideo(e)}isVideoPlaying(e){return e.currentTime>0&&!e.paused&&!e.ended&&e.readyState>2}tryPlayVideo(e){return ce(this,void 0,void 0,function*(){if(this.isVideoPlaying(e)){console.warn("Trying to play video that is already playing.");return}try{yield e.play()}catch{console.warn("It was not possible to play the video.")}})}getMediaElement(e,t){const n=document.getElementById(e);if(!n)throw new C(`element with id '${e}' not found`);if(n.nodeName.toLowerCase()!==t.toLowerCase())throw new C(`element with id '${e}' must be an ${t} element`);return n}decodeFromImage(e,t){if(!e&&!t)throw new C("either imageElement with a src set or an url must be provided");return t&&!e?this.decodeFromImageUrl(t):this.decodeFromImageElement(e)}decodeFromVideo(e,t){if(!e&&!t)throw new C("Either an element with a src set or an URL must be provided");return t&&!e?this.decodeFromVideoUrl(t):this.decodeFromVideoElement(e)}decodeFromVideoContinuously(e,t,n){if(e===void 0&&t===void 0)throw new C("Either an element with a src set or an URL must be provided");return t&&!e?this.decodeFromVideoUrlContinuously(t,n):this.decodeFromVideoElementContinuously(e,n)}decodeFromImageElement(e){if(!e)throw new C("An image element must be provided.");this.reset();const t=this.prepareImageElement(e);this.imageElement=t;let n;return this.isImageLoaded(t)?n=this.decodeOnce(t,!1,!0):n=this._decodeOnLoadImage(t),n}decodeFromVideoElement(e){const t=this._decodeFromVideoElementSetup(e);return this._decodeOnLoadVideo(t)}decodeFromVideoElementContinuously(e,t){const n=this._decodeFromVideoElementSetup(e);return this._decodeOnLoadVideoContinuously(n,t)}_decodeFromVideoElementSetup(e){if(!e)throw new C("A video element must be provided.");this.reset();const t=this.prepareVideoElement(e);return this.videoElement=t,t}decodeFromImageUrl(e){if(!e)throw new C("An URL must be provided.");this.reset();const t=this.prepareImageElement();this.imageElement=t;const n=this._decodeOnLoadImage(t);return t.src=e,n}decodeFromVideoUrl(e){if(!e)throw new C("An URL must be provided.");this.reset();const t=this.prepareVideoElement(),n=this.decodeFromVideoElement(t);return t.src=e,n}decodeFromVideoUrlContinuously(e,t){if(!e)throw new C("An URL must be provided.");this.reset();const n=this.prepareVideoElement(),o=this.decodeFromVideoElementContinuously(n,t);return n.src=e,o}_decodeOnLoadImage(e){return new Promise((t,n)=>{this.imageLoadedListener=()=>this.decodeOnce(e,!1,!0).then(t,n),e.addEventListener("load",this.imageLoadedListener)})}_decodeOnLoadVideo(e){return ce(this,void 0,void 0,function*(){return yield this.playVideoOnLoadAsync(e),yield this.decodeOnce(e)})}_decodeOnLoadVideoContinuously(e,t){return ce(this,void 0,void 0,function*(){yield this.playVideoOnLoadAsync(e),this.decodeContinuously(e,t)})}isImageLoaded(e){return!(!e.complete||e.naturalWidth===0)}prepareImageElement(e){let t;return typeof e>"u"&&(t=document.createElement("img"),t.width=200,t.height=200),typeof e=="string"&&(t=this.getMediaElement(e,"img")),e instanceof HTMLImageElement&&(t=e),t}prepareVideoElement(e){let t;return!e&&typeof document<"u"&&(t=document.createElement("video"),t.width=200,t.height=200),typeof e=="string"&&(t=this.getMediaElement(e,"video")),e instanceof HTMLVideoElement&&(t=e),t.setAttribute("autoplay","true"),t.setAttribute("muted","true"),t.setAttribute("playsinline","true"),t}decodeOnce(e,t=!0,n=!0){this._stopAsyncDecode=!1;const o=(c,d)=>{if(this._stopAsyncDecode){d(new T("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 T,E=(h instanceof O||h instanceof F)&&n;if(g||E)return setTimeout(o,this._timeBetweenDecodingAttempts,c,d);d(h)}};return new Promise((c,d)=>o(c,d))}decodeContinuously(e,t){this._stopContinuousDecode=!1;const n=()=>{if(this._stopContinuousDecode){this._stopContinuousDecode=void 0;return}try{const o=this.decode(e);t(o,null),setTimeout(n,this.timeBetweenScansMillis)}catch(o){t(null,o);const c=o instanceof O||o instanceof F,d=o instanceof T;(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 ee(t),o=new $(n);return new I(o)}getCaptureCanvasContext(e){if(!this.captureCanvasContext){const n=this.getCaptureCanvas(e).getContext("2d");this.captureCanvasContext=n}return this.captureCanvasContext}getCaptureCanvas(e){if(!this.captureCanvas){const t=this.createCaptureCanvas(e);this.captureCanvas=t}return this.captureCanvas}decodeBitmap(e){return this.reader.decode(e,this._hints)}createCaptureCanvas(e){if(typeof document>"u")return this._destroyCaptureCanvas(),null;const t=document.createElement("canvas");let n,o;return typeof e<"u"&&(e instanceof HTMLVideoElement?(n=e.videoWidth,o=e.videoHeight):e instanceof HTMLImageElement&&(n=e.naturalWidth||e.width,o=e.naturalHeight||e.height)),t.style.width=n+"px",t.style.height=o+"px",t.width=n,t.height=o,t}stopStreams(){this.stream&&(this.stream.getVideoTracks().forEach(e=>e.stop()),this.stream=void 0),this._stopAsyncDecode===!1&&this.stopAsyncDecode(),this._stopContinuousDecode===!1&&this.stopContinuousDecode()}reset(){this.stopStreams(),this._destroyVideoElement(),this._destroyImageElement(),this._destroyCaptureCanvas()}_destroyVideoElement(){this.videoElement&&(typeof this.videoEndedListener<"u"&&this.videoElement.removeEventListener("ended",this.videoEndedListener),typeof this.videoPlayingEventListener<"u"&&this.videoElement.removeEventListener("playing",this.videoPlayingEventListener),typeof this.videoCanPlayListener<"u"&&this.videoElement.removeEventListener("loadedmetadata",this.videoCanPlayListener),this.cleanVideoSource(this.videoElement),this.videoElement=void 0)}_destroyImageElement(){this.imageElement&&(this.imageLoadedListener!==void 0&&this.imageElement.removeEventListener("load",this.imageLoadedListener),this.imageElement.src=void 0,this.imageElement.removeAttribute("src"),this.imageElement=void 0)}_destroyCaptureCanvas(){this.captureCanvasContext=void 0,this.captureCanvas=void 0}addVideoSource(e,t){try{e.srcObject=t}catch{e.src=URL.createObjectURL(t)}}cleanVideoSource(e){try{e.srcObject=null}catch{e.src=""}this.videoElement.removeAttribute("src")}}class ge{constructor(e,t,n=t==null?0:8*t.length,o,c,d=v.currentTimeMillis()){this.text=e,this.rawBytes=t,this.numBits=n,this.resultPoints=o,this.format=c,this.timestamp=d,this.text=e,this.rawBytes=t,n==null?this.numBits=t==null?0:8*t.length:this.numBits=n,this.resultPoints=o,this.format=c,this.resultMetadata=null,d==null?this.timestamp=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 De;(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"})(De||(De={}));var xe=De,Ct;(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"})(Ct||(Ct={}));var be=Ct;class et{constructor(e,t,n,o,c=-1,d=-1){this.rawBytes=e,this.text=t,this.byteSegments=n,this.ecLevel=o,this.structuredAppendSequenceNumber=c,this.structuredAppendParity=d,this.numBits=e==null?0:8*e.length}getRawBytes(){return this.rawBytes}getNumBits(){return this.numBits}setNumBits(e){this.numBits=e}getText(){return this.text}getByteSegments(){return this.byteSegments}getECLevel(){return this.ecLevel}getErrorsCorrected(){return this.errorsCorrected}setErrorsCorrected(e){this.errorsCorrected=e}getErasures(){return this.erasures}setErasures(e){this.erasures=e}getOther(){return this.other}setOther(e){this.other=e}hasStructuredAppend(){return this.structuredAppendParity>=0&&this.structuredAppendSequenceNumber>=0}getStructuredAppendParity(){return this.structuredAppendParity}getStructuredAppendSequenceNumber(){return this.structuredAppendSequenceNumber}}class rt{exp(e){return this.expTable[e]}log(e){if(e===0)throw new y;return this.logTable[e]}static addOrSubtract(e,t){return e^t}}class Ve{constructor(e,t){if(t.length===0)throw new y;this.field=e;const n=t.length;if(n>1&&t[0]===0){let o=1;for(;o<n&&t[o]===0;)o++;o===n?this.coefficients=Int32Array.from([0]):(this.coefficients=new Int32Array(n-o),v.arraycopy(t,o,this.coefficients,0,this.coefficients.length))}else this.coefficients=t}getCoefficients(){return this.coefficients}getDegree(){return this.coefficients.length-1}isZero(){return this.coefficients[0]===0}getCoefficient(e){return this.coefficients[this.coefficients.length-1-e]}evaluateAt(e){if(e===0)return this.getCoefficient(0);const t=this.coefficients;let n;if(e===1){n=0;for(let d=0,h=t.length;d!==h;d++){const g=t[d];n=rt.addOrSubtract(n,g)}return n}n=t[0];const o=t.length,c=this.field;for(let d=1;d<o;d++)n=rt.addOrSubtract(c.multiply(e,n),t[d]);return n}addOrSubtract(e){if(!this.field.equals(e.field))throw new y("GenericGFPolys do not have same GenericGF field");if(this.isZero())return e;if(e.isZero())return this;let t=this.coefficients,n=e.coefficients;if(t.length>n.length){const d=t;t=n,n=d}let o=new Int32Array(n.length);const c=n.length-t.length;v.arraycopy(n,0,o,0,c);for(let d=c;d<n.length;d++)o[d]=rt.addOrSubtract(t[d-c],n[d]);return new Ve(this.field,o)}multiply(e){if(!this.field.equals(e.field))throw new y("GenericGFPolys do not have same GenericGF field");if(this.isZero()||e.isZero())return this.field.getZero();const t=this.coefficients,n=t.length,o=e.coefficients,c=o.length,d=new Int32Array(n+c-1),h=this.field;for(let g=0;g<n;g++){const w=t[g];for(let E=0;E<c;E++)d[g+E]=rt.addOrSubtract(d[g+E],h.multiply(w,o[E]))}return new Ve(h,d)}multiplyScalar(e){if(e===0)return this.field.getZero();if(e===1)return this;const t=this.coefficients.length,n=this.field,o=new Int32Array(t),c=this.coefficients;for(let d=0;d<t;d++)o[d]=n.multiply(c[d],e);return new Ve(n,o)}multiplyByMonomial(e,t){if(e<0)throw new y;if(t===0)return this.field.getZero();const n=this.coefficients,o=n.length,c=new Int32Array(o+e),d=this.field;for(let h=0;h<o;h++)c[h]=d.multiply(n[h],t);return new Ve(d,c)}divide(e){if(!this.field.equals(e.field))throw new y("GenericGFPolys do not have same GenericGF field");if(e.isZero())throw new y("Divide by 0");const t=this.field;let n=t.getZero(),o=this;const c=e.getCoefficient(e.getDegree()),d=t.inverse(c);for(;o.getDegree()>=e.getDegree()&&!o.isZero();){const h=o.getDegree()-e.getDegree(),g=t.multiply(o.getCoefficient(o.getDegree()),d),w=e.multiplyByMonomial(h,g),E=t.buildMonomial(h,g);n=n.addOrSubtract(E),o=o.addOrSubtract(w)}return[n,o]}toString(){let e="";for(let t=this.getDegree();t>=0;t--){let n=this.getCoefficient(t);if(n!==0){if(n<0?(e+=" - ",n=-n):e.length>0&&(e+=" + "),t===0||n!==1){const o=this.field.log(n);o===0?e+="1":o===1?e+="a":(e+="a^",e+=o)}t!==0&&(t===1?e+="x":(e+="x^",e+=t))}}return e}}class it extends x{}it.kind="ArithmeticException";class Me extends rt{constructor(e,t,n){super(),this.primitive=e,this.size=t,this.generatorBase=n;const o=new Int32Array(t);let c=1;for(let h=0;h<t;h++)o[h]=c,c*=2,c>=t&&(c^=e,c&=t-1);this.expTable=o;const d=new Int32Array(t);for(let h=0;h<t-1;h++)d[o[h]]=h;this.logTable=d,this.zero=new Ve(this,Int32Array.from([0])),this.one=new Ve(this,Int32Array.from([1]))}getZero(){return this.zero}getOne(){return this.one}buildMonomial(e,t){if(e<0)throw new y;if(t===0)return this.zero;const n=new Int32Array(e+1);return n[0]=t,new Ve(this,n)}inverse(e){if(e===0)throw new it;return this.expTable[this.size-this.logTable[e]-1]}multiply(e,t){return e===0||t===0?0:this.expTable[(this.logTable[e]+this.logTable[t])%(this.size-1)]}getSize(){return this.size}getGeneratorBase(){return this.generatorBase}toString(){return"GF(0x"+M.toHexString(this.primitive)+","+this.size+")"}equals(e){return e===this}}Me.AZTEC_DATA_12=new Me(4201,4096,1),Me.AZTEC_DATA_10=new Me(1033,1024,1),Me.AZTEC_DATA_6=new Me(67,64,1),Me.AZTEC_PARAM=new Me(19,16,1),Me.QR_CODE_FIELD_256=new Me(285,256,0),Me.DATA_MATRIX_FIELD_256=new Me(301,256,1),Me.AZTEC_DATA_8=Me.DATA_MATRIX_FIELD_256,Me.MAXICODE_FIELD_64=Me.AZTEC_DATA_6;class Ie extends x{}Ie.kind="ReedSolomonException";class Ue extends x{}Ue.kind="IllegalStateException";class Nt{constructor(e){this.field=e}decode(e,t){const n=this.field,o=new Ve(n,e),c=new Int32Array(t);let d=!0;for(let B=0;B<t;B++){const U=o.evaluateAt(n.exp(B+n.getGeneratorBase()));c[c.length-1-B]=U,U!==0&&(d=!1)}if(d)return;const h=new Ve(n,c),g=this.runEuclideanAlgorithm(n.buildMonomial(t,1),h,t),w=g[0],E=g[1],A=this.findErrorLocations(w),S=this.findErrorMagnitudes(E,A);for(let B=0;B<A.length;B++){const U=e.length-1-n.log(A[B]);if(U<0)throw new Ie("Bad error location");e[U]=Me.addOrSubtract(e[U],S[B])}}runEuclideanAlgorithm(e,t,n){if(e.getDegree()<t.getDegree()){const B=e;e=t,t=B}const o=this.field;let c=e,d=t,h=o.getZero(),g=o.getOne();for(;d.getDegree()>=(n/2|0);){let B=c,U=h;if(c=d,h=g,c.isZero())throw new Ie("r_{i-1} was zero");d=B;let H=o.getZero();const K=c.getCoefficient(c.getDegree()),oe=o.inverse(K);for(;d.getDegree()>=c.getDegree()&&!d.isZero();){const ue=d.getDegree()-c.getDegree(),fe=o.multiply(d.getCoefficient(d.getDegree()),oe);H=H.addOrSubtract(o.buildMonomial(ue,fe)),d=d.addOrSubtract(c.multiplyByMonomial(ue,fe))}if(g=H.multiply(h).addOrSubtract(U),d.getDegree()>=c.getDegree())throw new Ue("Division algorithm failed to reduce polynomial?")}const w=g.getCoefficient(0);if(w===0)throw new Ie("sigmaTilde(0) was zero");const E=o.inverse(w),A=g.multiplyScalar(E),S=d.multiplyScalar(E);return[A,S]}findErrorLocations(e){const t=e.getDegree();if(t===1)return Int32Array.from([e.getCoefficient(1)]);const n=new Int32Array(t);let o=0;const c=this.field;for(let d=1;d<c.getSize()&&o<t;d++)e.evaluateAt(d)===0&&(n[o]=c.inverse(d),o++);if(o!==t)throw new Ie("Error locator degree does not match number of roots");return n}findErrorMagnitudes(e,t){const n=t.length,o=new Int32Array(n),c=this.field;for(let d=0;d<n;d++){const h=c.inverse(t[d]);let g=1;for(let w=0;w<n;w++)if(d!==w){const E=c.multiply(t[w],h),A=E&1?E&-2:E|1;g=c.multiply(g,A)}o[d]=c.multiply(e.evaluateAt(h),c.inverse(g)),c.getGeneratorBase()!==0&&(o[d]=c.multiply(o[d],h))}return o}}var ot;(function(b){b[b.UPPER=0]="UPPER",b[b.LOWER=1]="LOWER",b[b.MIXED=2]="MIXED",b[b.DIGIT=3]="DIGIT",b[b.PUNCT=4]="PUNCT",b[b.BINARY=5]="BINARY"})(ot||(ot={}));class Qe{decode(e){this.ddata=e;let t=e.getBits(),n=this.extractBits(t),o=this.correctBits(n),c=Qe.convertBoolArrayToByteArray(o),d=Qe.getEncodedData(o),h=new et(c,d,null,null);return h.setNumBits(o.length),h}static highLevelDecode(e){return this.getEncodedData(e)}static getEncodedData(e){let t=e.length,n=ot.UPPER,o=ot.UPPER,c="",d=0;for(;d<t;)if(o===ot.BINARY){if(t-d<5)break;let h=Qe.readCode(e,d,5);if(d+=5,h===0){if(t-d<11)break;h=Qe.readCode(e,d,11)+31,d+=11}for(let g=0;g<h;g++){if(t-d<8){d=t;break}const w=Qe.readCode(e,d,8);c+=te.castAsNonUtf8Char(w),d+=8}o=n}else{let h=o===ot.DIGIT?4:5;if(t-d<h)break;let g=Qe.readCode(e,d,h);d+=h;let w=Qe.getCharacter(o,g);w.startsWith("CTRL_")?(n=o,o=Qe.getTable(w.charAt(5)),w.charAt(6)==="L"&&(n=o)):(c+=w,o=n)}return c}static getTable(e){switch(e){case"L":return ot.LOWER;case"P":return ot.PUNCT;case"M":return ot.MIXED;case"D":return ot.DIGIT;case"B":return ot.BINARY;case"U":default:return ot.UPPER}}static getCharacter(e,t){switch(e){case ot.UPPER:return Qe.UPPER_TABLE[t];case ot.LOWER:return Qe.LOWER_TABLE[t];case ot.MIXED:return Qe.MIXED_TABLE[t];case ot.PUNCT:return Qe.PUNCT_TABLE[t];case ot.DIGIT:return Qe.DIGIT_TABLE[t];default:throw new Ue("Bad table")}}correctBits(e){let t,n;this.ddata.getNbLayers()<=2?(n=6,t=Me.AZTEC_DATA_6):this.ddata.getNbLayers()<=8?(n=8,t=Me.AZTEC_DATA_8):this.ddata.getNbLayers()<=22?(n=10,t=Me.AZTEC_DATA_10):(n=12,t=Me.AZTEC_DATA_12);let o=this.ddata.getNbDatablocks(),c=e.length/n;if(c<o)throw new F;let d=e.length%n,h=new Int32Array(c);for(let S=0;S<c;S++,d+=n)h[S]=Qe.readCode(e,d,n);try{new Nt(t).decode(h,c-o)}catch(S){throw new F(S)}let g=(1<<n)-1,w=0;for(let S=0;S<o;S++){let B=h[S];if(B===0||B===g)throw new F;(B===1||B===g-1)&&w++}let E=new Array(o*n-w),A=0;for(let S=0;S<o;S++){let B=h[S];if(B===1||B===g-1)E.fill(B>1,A,A+n-1),A+=n-1;else for(let U=n-1;U>=0;--U)E[A++]=(B&1<<U)!==0}return E}extractBits(e){let t=this.ddata.isCompact(),n=this.ddata.getNbLayers(),o=(t?11:14)+n*4,c=new Int32Array(o),d=new Array(this.totalBitsInLayer(n,t));if(t)for(let h=0;h<c.length;h++)c[h]=h;else{let h=o+1+2*M.truncDivision(M.truncDivision(o,2)-1,15),g=o/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=o-1-E;for(let S=0;S<w;S++){let B=S*2;for(let U=0;U<2;U++)d[g+B+U]=e.get(c[E+U],c[E+S]),d[g+2*w+B+U]=e.get(c[E+S],c[A-U]),d[g+4*w+B+U]=e.get(c[A-U],c[A-S]),d[g+6*w+B+U]=e.get(c[A-S],c[E+U])}g+=w*8}return d}static readCode(e,t,n){let o=0;for(let c=t;c<t+n;c++)o<<=1,e[c]&&(o|=1);return o}static readByte(e,t){let n=e.length-t;return n>=8?Qe.readCode(e,t,8):Qe.readCode(e,t,n)<<8-n}static convertBoolArrayToByteArray(e){let t=new Uint8Array((e.length+7)/8);for(let n=0;n<t.length;n++)t[n]=Qe.readByte(e,8*n);return t}totalBitsInLayer(e,t){return((t?88:112)+16*e)*e}}Qe.UPPER_TABLE=["CTRL_PS"," ","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","CTRL_LL","CTRL_ML","CTRL_DL","CTRL_BS"],Qe.LOWER_TABLE=["CTRL_PS"," ","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","CTRL_US","CTRL_ML","CTRL_DL","CTRL_BS"],Qe.MIXED_TABLE=["CTRL_PS"," ","\\1","\\2","\\3","\\4","\\5","\\6","\\7","\b"," ",`
15
15
  `,"\\13","\f","\r","\\33","\\34","\\35","\\36","\\37","@","\\","^","_","`","|","~","\\177","CTRL_LL","CTRL_UL","CTRL_PL","CTRL_BS"],Qe.PUNCT_TABLE=["","\r",`\r
16
- `,". ",", ",": ","!",'"',"#","$","%","&","'","(",")","*","+",",","-",".","/",":",";","<","=",">","?","[","]","{","}","CTRL_UL"],Qe.DIGIT_TABLE=["CTRL_PS"," ","0","1","2","3","4","5","6","7","8","9",",",".","CTRL_UL","CTRL_US"];class ve{constructor(){}static round(e){return e===NaN?0:e<=Number.MIN_SAFE_INTEGER?Number.MIN_SAFE_INTEGER:e>=Number.MAX_SAFE_INTEGER?Number.MAX_SAFE_INTEGER:e+(e<0?-.5:.5)|0}static distance(e,t,n,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 ye{constructor(e,t){this.x=e,this.y=t}getX(){return this.x}getY(){return this.y}equals(e){if(e instanceof ye){const t=e;return this.x===t.x&&this.y===t.y}return!1}hashCode(){return 31*ar.floatToIntBits(this.x)+ar.floatToIntBits(this.y)}toString(){return"("+this.x+","+this.y+")"}static orderBestPatterns(e){const t=this.distance(e[0],e[1]),n=this.distance(e[1],e[2]),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 br{constructor(e,t){this.bits=e,this.points=t}getBits(){return this.bits}getPoints(){return this.points}}class qr extends br{constructor(e,t,n,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 Dt{constructor(e,t,n,s){this.image=e,this.height=e.getHeight(),this.width=e.getWidth(),t==null&&(t=Dt.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 I}detect(){let e=this.leftInit,t=this.rightInit,n=this.upInit,s=this.downInit,c=!1,d=!0,h=!1,g=!1,_=!1,E=!1,A=!1;const S=this.width,B=this.height;for(;d;){d=!1;let z=!0;for(;(z||!g)&&t<S;)z=this.containsBlackPoint(n,s,t,!1),z?(t++,d=!0,g=!0):g||t++;if(t>=S){c=!0;break}let W=!0;for(;(W||!_)&&s<B;)W=this.containsBlackPoint(e,t,s,!0),W?(s++,d=!0,_=!0):_||s++;if(s>=B){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 z=t-e;let W=null;for(let fe=1;W===null&&fe<z;fe++)W=this.getBlackPointOnSegment(e,s-fe,e+fe,s);if(W==null)throw new I;let Y=null;for(let fe=1;Y===null&&fe<z;fe++)Y=this.getBlackPointOnSegment(e,n+fe,e+fe,n);if(Y==null)throw new I;let ie=null;for(let fe=1;ie===null&&fe<z;fe++)ie=this.getBlackPointOnSegment(t,n+fe,t-fe,n);if(ie==null)throw new I;let ue=null;for(let fe=1;ue===null&&fe<z;fe++)ue=this.getBlackPointOnSegment(t,s-fe,t-fe,s);if(ue==null)throw new I;return this.centerEdges(ue,W,ie,Y)}else throw new I}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 _=0;_<c;_++){const E=ve.round(e+_*d),A=ve.round(t+_*h);if(g.get(E,A))return new ye(E,A)}return null}centerEdges(e,t,n,s){const c=e.getX(),d=e.getY(),h=t.getX(),g=t.getY(),_=n.getX(),E=n.getY(),A=s.getX(),S=s.getY(),B=Dt.CORR;return c<this.width/2?[new ye(A-B,S+B),new ye(h+B,g+B),new ye(_-B,E-B),new ye(c+B,d-B)]:[new ye(A+B,S+B),new ye(h+B,g-B),new ye(_-B,E+B),new ye(c-B,d-B)]}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}}Dt.INIT_SIZE=10,Dt.CORR=1;class Ar{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 I;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 I;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 dn{constructor(e,t,n,s,c,d,h,g,_){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=_}static quadrilateralToQuadrilateral(e,t,n,s,c,d,h,g,_,E,A,S,B,z,W,Y){const ie=dn.quadrilateralToSquare(e,t,n,s,c,d,h,g);return dn.squareToQuadrilateral(_,E,A,S,B,z,W,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,_=this.a31,E=this.a32,A=this.a33;for(let S=0;S<t;S+=2){const B=e[S],z=e[S+1],W=c*B+g*z+A;e[S]=(n*B+d*z+_)/W,e[S+1]=(s*B+h*z+E)/W}}transformPointsWithValues(e,t){const n=this.a11,s=this.a12,c=this.a13,d=this.a21,h=this.a22,g=this.a23,_=this.a31,E=this.a32,A=this.a33,S=e.length;for(let B=0;B<S;B++){const z=e[B],W=t[B],Y=c*z+g*W+A;e[B]=(n*z+d*W+_)/Y,t[B]=(s*z+h*W+E)/Y}}static squareToQuadrilateral(e,t,n,s,c,d,h,g){const _=e-n+c-h,E=t-s+d-g;if(_===0&&E===0)return new dn(n-e,c-n,e,s-t,d-s,t,0,0,1);{const A=n-c,S=h-c,B=s-d,z=g-d,W=A*z-S*B,Y=(_*z-S*E)/W,ie=(A*E-_*B)/W;return new dn(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 dn.squareToQuadrilateral(e,t,n,s,c,d,h,g).buildAdjoint()}buildAdjoint(){return new dn(this.a22*this.a33-this.a23*this.a32,this.a23*this.a31-this.a21*this.a33,this.a21*this.a32-this.a22*this.a31,this.a13*this.a32-this.a12*this.a33,this.a11*this.a33-this.a13*this.a31,this.a12*this.a31-this.a11*this.a32,this.a12*this.a23-this.a13*this.a22,this.a13*this.a21-this.a11*this.a23,this.a11*this.a22-this.a12*this.a21)}times(e){return new dn(this.a11*e.a11+this.a21*e.a12+this.a31*e.a13,this.a11*e.a21+this.a21*e.a22+this.a31*e.a23,this.a11*e.a31+this.a21*e.a32+this.a31*e.a33,this.a12*e.a11+this.a22*e.a12+this.a32*e.a13,this.a12*e.a21+this.a22*e.a22+this.a32*e.a23,this.a12*e.a31+this.a22*e.a32+this.a32*e.a33,this.a13*e.a11+this.a23*e.a12+this.a33*e.a13,this.a13*e.a21+this.a23*e.a22+this.a33*e.a23,this.a13*e.a31+this.a23*e.a32+this.a33*e.a33)}}class Ri extends Ar{sampleGrid(e,t,n,s,c,d,h,g,_,E,A,S,B,z,W,Y,ie,ue,fe){const le=dn.quadrilateralToQuadrilateral(s,c,d,h,g,_,E,A,S,B,z,W,Y,ie,ue,fe);return this.sampleGridWithTransform(e,t,n,le)}sampleGridWithTransform(e,t,n,s){if(t<=0||n<=0)throw new I;const c=new H(t,n),d=new Float32Array(2*t);for(let h=0;h<n;h++){const g=d.length,_=h+.5;for(let E=0;E<g;E+=2)d[E]=E/2+.5,d[E+1]=_;s.transformPoints(d),Ar.checkAndNudgePoints(e,d);try{for(let E=0;E<g;E+=2)e.get(Math.floor(d[E]),Math.floor(d[E+1]))&&c.set(E/2,h)}catch{throw new I}}return c}}class Rn{static setGridSampler(e){Rn.gridSampler=e}static getInstance(){return Rn.gridSampler}}Rn.gridSampler=new Ri;class Ut{constructor(e,t){this.x=e,this.y=t}toResultPoint(){return new ye(this.getX(),this.getY())}getX(){return this.x}getY(){return this.y}}class Bi{constructor(e){this.EXPECTED_CORNER_BITS=new Int32Array([3808,476,2107,1799]),this.image=e}detect(){return this.detectMirror(!1)}detectMirror(e){let t=this.getMatrixCenter(),n=this.getBullsEyeCorners(t);if(e){let d=n[0];n[0]=n[2],n[2]=d}this.extractParameters(n);let 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 qr(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 I;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(R.bitCount(n^this.EXPECTED_CORNER_BITS[s])<=2)return s;throw new I}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 It(Me.AZTEC_PARAM).decode(d,c)}catch{throw new I}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),B=this.getFirstDifferent(s,d,-1,1),z=this.getFirstDifferent(c,d,-1,-1);if(this.nbCenterLayers>2){let W=this.distancePoint(z,A)*this.nbCenterLayers/(this.distancePoint(c,t)*(this.nbCenterLayers+2));if(W<.75||W>1.25||!this.isWhiteOrBlackRectangle(A,S,B,z))break}t=A,n=S,s=B,c=z,d=!d}if(this.nbCenterLayers!==5&&this.nbCenterLayers!==7)throw new I;this.compact=this.nbCenterLayers===5;let h=new ye(t.getX()+.5,t.getY()-.5),g=new ye(n.getX()+.5,n.getY()+.5),_=new ye(s.getX()-.5,s.getY()+.5),E=new ye(c.getX()-.5,c.getY()-.5);return this.expandSquare([h,g,_,E],2*this.nbCenterLayers-3,2*this.nbCenterLayers)}getMatrixCenter(){let e,t,n,s;try{let h=new Dt(this.image).detect();e=h[0],t=h[1],n=h[2],s=h[3]}catch{let g=this.image.getWidth()/2,_=this.image.getHeight()/2;e=this.getFirstDifferent(new Ut(g+7,_-7),!1,1,-1).toResultPoint(),t=this.getFirstDifferent(new Ut(g+7,_+7),!1,1,1).toResultPoint(),n=this.getFirstDifferent(new Ut(g-7,_+7),!1,-1,1).toResultPoint(),s=this.getFirstDifferent(new Ut(g-7,_-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 Dt(this.image,15,c,d).detect();e=h[0],t=h[1],n=h[2],s=h[3]}catch{e=this.getFirstDifferent(new Ut(c+7,d-7),!1,1,-1).toResultPoint(),t=this.getFirstDifferent(new Ut(c+7,d+7),!1,1,1).toResultPoint(),n=this.getFirstDifferent(new Ut(c-7,d+7),!1,-1,1).toResultPoint(),s=this.getFirstDifferent(new Ut(c-7,d-7),!1,-1,-1).toResultPoint()}return c=ve.round((e.getX()+s.getX()+t.getX()+n.getX())/4),d=ve.round((e.getY()+s.getY()+t.getY()+n.getY())/4),new Ut(c,d)}getMatrixCornerPoints(e){return this.expandSquare(e,2*this.nbCenterLayers,this.getDimension())}sampleGrid(e,t,n,s,c){let d=Rn.getInstance(),h=this.getDimension(),g=h/2-this.nbCenterLayers,_=h/2+this.nbCenterLayers;return d.sampleGrid(e,h,h,g,g,_,g,_,_,g,_,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(),_=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*_),ve.round(g+A*E))&&(s|=1<<n-A-1);return s}isWhiteOrBlackRectangle(e,t,n,s){let c=3;e=new Ut(e.getX()-c,e.getY()+c),t=new Ut(t.getX()-c,t.getY()-c),n=new Ut(n.getX()+c,n.getY()-c),s=new Ut(s.getX()+c,s.getY()+c);let d=this.getColor(s,e);if(d===0)return!1;let h=this.getColor(e,t);return h!==d||(h=this.getColor(t,n),h!==d)?!1:(h=this.getColor(n,s),h===d)}getColor(e,t){let n=this.distancePoint(e,t),s=(t.getX()-e.getX())/n,c=(t.getY()-e.getY())/n,d=0,h=e.getX(),g=e.getY(),_=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))!==_&&d++;let A=d/n;return A>.1&&A<.9?0:A<=.1===_?1:-1}getFirstDifferent(e,t,n,s){let c=e.getX()+n,d=e.getY()+s;for(;this.isValid(c,d)&&this.image.get(c,d)===t;)c+=n,d+=s;for(c-=n,d-=s;this.isValid(c,d)&&this.image.get(c,d)===t;)c+=n;for(c-=n;this.isValid(c,d)&&this.image.get(c,d)===t;)d+=s;return d-=s,new Ut(c,d)}expandSquare(e,t,n){let s=n/(2*t),c=e[0].getX()-e[2].getX(),d=e[0].getY()-e[2].getY(),h=(e[0].getX()+e[2].getX())/2,g=(e[0].getY()+e[2].getY())/2,_=new ye(h+s*c,g+s*d),E=new ye(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 ye(h+s*c,g+s*d),S=new ye(h-s*c,g-s*d);return[_,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*(R.truncDivision(this.nbLayers-4,8)+1)+15}}class Sr{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 Qe().decode(E)}catch(E){n=E}if(d==null)try{let E=s.detectMirror(!0);c=E.getPoints(),this.reportFoundResultPoints(t,c),d=new Qe().decode(E)}catch(E){throw n??E}let h=new ge(d.getText(),d.getRawBytes(),d.getNumBits(),c,xe.AZTEC,v.currentTimeMillis()),g=d.getByteSegments();g!=null&&h.putMetadata(be.BYTE_SEGMENTS,g);let _=d.getECLevel();return _!=null&&h.putMetadata(be.ERROR_CORRECTION_LEVEL,_),h}reportFoundResultPoints(e,t){if(e!=null){let n=e.get(Z.NEED_RESULT_POINT_CALLBACK);n!=null&&t.forEach((s,c,d)=>{n.foundPossibleResultPoint(s)})}}reset(){}}class Oo extends Ce{constructor(e=500){super(new Sr,e)}}class ht{decode(e,t){try{return this.doDecode(e,t)}catch{if(t&&t.get(Z.TRY_HARDER)===!0&&e.isRotateSupported()){const c=e.rotateCounterClockwise(),d=this.doDecode(c,t),h=d.getResultMetadata();let g=270;h!==null&&h.get(be.ORIENTATION)===!0&&(g=g+h.get(be.ORIENTATION)%360),d.putMetadata(be.ORIENTATION,g);const _=d.getResultPoints();if(_!==null){const E=c.getHeight();for(let A=0;A<_.length;A++)_[A]=new ye(E-_[A].getY()-1,_[A].getX())}return d}else throw new I}}reset(){}doDecode(e,t){const n=e.getWidth(),s=e.getHeight();let c=new F(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 _=Math.trunc(s/2);for(let E=0;E<g;E++){const A=Math.trunc((E+1)/2),S=(E&1)===0,B=_+h*(S?A:-A);if(B<0||B>=s)break;try{c=e.getBlackRow(B,c)}catch{continue}for(let z=0;z<2;z++){if(z===1&&(c.reverse(),t&&t.get(Z.NEED_RESULT_POINT_CALLBACK)===!0)){const W=new Map;t.forEach((Y,ie)=>W.set(ie,Y)),W.delete(Z.NEED_RESULT_POINT_CALLBACK),t=W}try{const W=this.decodeRow(B,c,t);if(z===1){W.putMetadata(be.ORIENTATION,180);const Y=W.getResultPoints();Y!==null&&(Y[0]=new ye(n-Y[0].getX()-1,Y[0].getY()),Y[1]=new ye(n-Y[1].getX()-1,Y[1].getY()))}return W}catch{}}}throw new I}static recordPattern(e,t,n){const s=n.length;for(let _=0;_<s;_++)n[_]=0;const c=e.getSize();if(t>=c)throw new I;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 I}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 I;ht.recordPattern(e,t+1,n)}static patternMatchVariance(e,t,n){const s=e.length;let c=0,d=0;for(let _=0;_<s;_++)c+=e[_],d+=t[_];if(c<d)return Number.POSITIVE_INFINITY;const h=c/d;n*=h;let g=0;for(let _=0;_<s;_++){const E=e[_],A=t[_]*h,S=E>A?E-A:A-E;if(S>n)return Number.POSITIVE_INFINITY;g+=S}return g/c}}class me extends ht{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 _=n;_<t;_++)if(e.get(_)!==h)c[s]++;else{if(s===g-1){let E=me.MAX_AVG_VARIANCE,A=-1;for(let S=me.CODE_START_A;S<=me.CODE_START_C;S++){const B=ht.patternMatchVariance(c,me.CODE_PATTERNS[S],me.MAX_INDIVIDUAL_VARIANCE);B<E&&(E=B,A=S)}if(A>=0&&e.isRange(Math.max(0,d-(_-d)/2),d,!1))return Int32Array.from([d,_,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 I}static decodeCode(e,t,n){ht.recordPattern(e,n,t);let s=me.MAX_AVG_VARIANCE,c=-1;for(let d=0;d<me.CODE_PATTERNS.length;d++){const h=me.CODE_PATTERNS[d],g=this.patternMatchVariance(t,h,me.MAX_INDIVIDUAL_VARIANCE);g<s&&(s=g,c=d)}if(c>=0)return c;throw new I}decodeRow(e,t,n){const s=n&&n.get(Z.ASSUME_GS1)===!0,c=me.findStartPattern(t),d=c[2];let h=0;const g=new Uint8Array(20);g[h++]=d;let _;switch(d){case me.CODE_START_A:_=me.CODE_CODE_A;break;case me.CODE_START_B:_=me.CODE_CODE_B;break;case me.CODE_START_C:_=me.CODE_CODE_C;break;default:throw new V}let E=!1,A=!1,S="",B=c[0],z=c[1];const W=Int32Array.from([0,0,0,0,0,0]);let Y=0,ie=0,ue=d,fe=0,le=!0,je=!1,Fe=!1;for(;!E;){const Mr=A;switch(A=!1,Y=ie,ie=me.decodeCode(t,W,z),g[h++]=ie,ie!==me.CODE_STOP&&(le=!0),ie!==me.CODE_STOP&&(fe++,ue+=fe*ie),B=z,z+=W.reduce((Ug,zg)=>Ug+zg,0),ie){case me.CODE_START_A:case me.CODE_START_B:case me.CODE_START_C:throw new V}switch(_){case me.CODE_CODE_A:if(ie<64)Fe===je?S+=String.fromCharCode(32+ie):S+=String.fromCharCode(32+ie+128),Fe=!1;else if(ie<96)Fe===je?S+=String.fromCharCode(ie-64):S+=String.fromCharCode(ie+64),Fe=!1;else switch(ie!==me.CODE_STOP&&(le=!1),ie){case me.CODE_FNC_1:s&&(S.length===0?S+="]C1":S+="");break;case me.CODE_FNC_2:case me.CODE_FNC_3:break;case me.CODE_FNC_4_A:!je&&Fe?(je=!0,Fe=!1):je&&Fe?(je=!1,Fe=!1):Fe=!0;break;case me.CODE_SHIFT:A=!0,_=me.CODE_CODE_B;break;case me.CODE_CODE_B:_=me.CODE_CODE_B;break;case me.CODE_CODE_C:_=me.CODE_CODE_C;break;case me.CODE_STOP:E=!0;break}break;case me.CODE_CODE_B:if(ie<96)Fe===je?S+=String.fromCharCode(32+ie):S+=String.fromCharCode(32+ie+128),Fe=!1;else switch(ie!==me.CODE_STOP&&(le=!1),ie){case me.CODE_FNC_1:s&&(S.length===0?S+="]C1":S+="");break;case me.CODE_FNC_2:case me.CODE_FNC_3:break;case me.CODE_FNC_4_B:!je&&Fe?(je=!0,Fe=!1):je&&Fe?(je=!1,Fe=!1):Fe=!0;break;case me.CODE_SHIFT:A=!0,_=me.CODE_CODE_A;break;case me.CODE_CODE_A:_=me.CODE_CODE_A;break;case me.CODE_CODE_C:_=me.CODE_CODE_C;break;case me.CODE_STOP:E=!0;break}break;case me.CODE_CODE_C:if(ie<100)ie<10&&(S+="0"),S+=ie;else switch(ie!==me.CODE_STOP&&(le=!1),ie){case me.CODE_FNC_1:s&&(S.length===0?S+="]C1":S+="");break;case me.CODE_CODE_A:_=me.CODE_CODE_A;break;case me.CODE_CODE_B:_=me.CODE_CODE_B;break;case me.CODE_STOP:E=!0;break}break}Mr&&(_=_===me.CODE_CODE_A?me.CODE_CODE_B:me.CODE_CODE_A)}const rn=z-B;if(z=t.getNextUnset(z),!t.isRange(z,Math.min(t.getSize(),z+(z-B)/2),!1))throw new I;if(ue-=fe*Y,ue%103!==Y)throw new O;const Sn=S.length;if(Sn===0)throw new I;Sn>0&&le&&(_===me.CODE_CODE_C?S=S.substring(0,Sn-2):S=S.substring(0,Sn-1));const on=(c[1]+c[0])/2,ut=B+rn/2,Wt=g.length,fn=new Uint8Array(Wt);for(let Mr=0;Mr<Wt;Mr++)fn[Mr]=g[Mr];const Or=[new ye(on,e),new ye(ut,e)];return new ge(S,fn,0,Or,xe.CODE_128,new Date().getTime())}}me.CODE_PATTERNS=[Int32Array.from([2,1,2,2,2,2]),Int32Array.from([2,2,2,1,2,2]),Int32Array.from([2,2,2,2,2,1]),Int32Array.from([1,2,1,2,2,3]),Int32Array.from([1,2,1,3,2,2]),Int32Array.from([1,3,1,2,2,2]),Int32Array.from([1,2,2,2,1,3]),Int32Array.from([1,2,2,3,1,2]),Int32Array.from([1,3,2,2,1,2]),Int32Array.from([2,2,1,2,1,3]),Int32Array.from([2,2,1,3,1,2]),Int32Array.from([2,3,1,2,1,2]),Int32Array.from([1,1,2,2,3,2]),Int32Array.from([1,2,2,1,3,2]),Int32Array.from([1,2,2,2,3,1]),Int32Array.from([1,1,3,2,2,2]),Int32Array.from([1,2,3,1,2,2]),Int32Array.from([1,2,3,2,2,1]),Int32Array.from([2,2,3,2,1,1]),Int32Array.from([2,2,1,1,3,2]),Int32Array.from([2,2,1,2,3,1]),Int32Array.from([2,1,3,2,1,2]),Int32Array.from([2,2,3,1,1,2]),Int32Array.from([3,1,2,1,3,1]),Int32Array.from([3,1,1,2,2,2]),Int32Array.from([3,2,1,1,2,2]),Int32Array.from([3,2,1,2,2,1]),Int32Array.from([3,1,2,2,1,2]),Int32Array.from([3,2,2,1,1,2]),Int32Array.from([3,2,2,2,1,1]),Int32Array.from([2,1,2,1,2,3]),Int32Array.from([2,1,2,3,2,1]),Int32Array.from([2,3,2,1,2,1]),Int32Array.from([1,1,1,3,2,3]),Int32Array.from([1,3,1,1,2,3]),Int32Array.from([1,3,1,3,2,1]),Int32Array.from([1,1,2,3,1,3]),Int32Array.from([1,3,2,1,1,3]),Int32Array.from([1,3,2,3,1,1]),Int32Array.from([2,1,1,3,1,3]),Int32Array.from([2,3,1,1,1,3]),Int32Array.from([2,3,1,3,1,1]),Int32Array.from([1,1,2,1,3,3]),Int32Array.from([1,1,2,3,3,1]),Int32Array.from([1,3,2,1,3,1]),Int32Array.from([1,1,3,1,2,3]),Int32Array.from([1,1,3,3,2,1]),Int32Array.from([1,3,3,1,2,1]),Int32Array.from([3,1,3,1,2,1]),Int32Array.from([2,1,1,3,3,1]),Int32Array.from([2,3,1,1,3,1]),Int32Array.from([2,1,3,1,1,3]),Int32Array.from([2,1,3,3,1,1]),Int32Array.from([2,1,3,1,3,1]),Int32Array.from([3,1,1,1,2,3]),Int32Array.from([3,1,1,3,2,1]),Int32Array.from([3,3,1,1,2,1]),Int32Array.from([3,1,2,1,1,3]),Int32Array.from([3,1,2,3,1,1]),Int32Array.from([3,3,2,1,1,1]),Int32Array.from([3,1,4,1,1,1]),Int32Array.from([2,2,1,4,1,1]),Int32Array.from([4,3,1,1,1,1]),Int32Array.from([1,1,1,2,2,4]),Int32Array.from([1,1,1,4,2,2]),Int32Array.from([1,2,1,1,2,4]),Int32Array.from([1,2,1,4,2,1]),Int32Array.from([1,4,1,1,2,2]),Int32Array.from([1,4,1,2,2,1]),Int32Array.from([1,1,2,2,1,4]),Int32Array.from([1,1,2,4,1,2]),Int32Array.from([1,2,2,1,1,4]),Int32Array.from([1,2,2,4,1,1]),Int32Array.from([1,4,2,1,1,2]),Int32Array.from([1,4,2,2,1,1]),Int32Array.from([2,4,1,2,1,1]),Int32Array.from([2,2,1,1,1,4]),Int32Array.from([4,1,3,1,1,1]),Int32Array.from([2,4,1,1,1,2]),Int32Array.from([1,3,4,1,1,1]),Int32Array.from([1,1,1,2,4,2]),Int32Array.from([1,2,1,1,4,2]),Int32Array.from([1,2,1,2,4,1]),Int32Array.from([1,1,4,2,1,2]),Int32Array.from([1,2,4,1,1,2]),Int32Array.from([1,2,4,2,1,1]),Int32Array.from([4,1,1,2,1,2]),Int32Array.from([4,2,1,1,1,2]),Int32Array.from([4,2,1,2,1,1]),Int32Array.from([2,1,2,1,4,1]),Int32Array.from([2,1,4,1,2,1]),Int32Array.from([4,1,2,1,2,1]),Int32Array.from([1,1,1,1,4,3]),Int32Array.from([1,1,1,3,4,1]),Int32Array.from([1,3,1,1,4,1]),Int32Array.from([1,1,4,1,1,3]),Int32Array.from([1,1,4,3,1,1]),Int32Array.from([4,1,1,1,1,3]),Int32Array.from([4,1,1,3,1,1]),Int32Array.from([1,1,3,1,4,1]),Int32Array.from([1,1,4,1,3,1]),Int32Array.from([3,1,1,1,4,1]),Int32Array.from([4,1,1,1,3,1]),Int32Array.from([2,1,1,4,1,2]),Int32Array.from([2,1,1,2,1,4]),Int32Array.from([2,1,1,2,3,2]),Int32Array.from([2,3,3,1,1,1,2])],me.MAX_AVG_VARIANCE=.25,me.MAX_INDIVIDUAL_VARIANCE=.7,me.CODE_SHIFT=98,me.CODE_CODE_C=99,me.CODE_CODE_B=100,me.CODE_CODE_A=101,me.CODE_FNC_1=102,me.CODE_FNC_2=97,me.CODE_FNC_3=96,me.CODE_FNC_4_A=101,me.CODE_FNC_4_B=100,me.CODE_START_A=103,me.CODE_START_B=104,me.CODE_START_C=105,me.CODE_STOP=106;class bt extends ht{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,_;do{bt.recordPattern(t,d,s);let W=bt.toNarrowWidePattern(s);if(W<0)throw new I;g=bt.patternToChar(W),this.decodeRowResult+=g,_=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 W of s)E+=W;let A=d-_-E;if(d!==h&&A*2<E)throw new I;if(this.usingCheckDigit){let W=this.decodeRowResult.length-1,Y=0;for(let ie=0;ie<W;ie++)Y+=bt.ALPHABET_STRING.indexOf(this.decodeRowResult.charAt(ie));if(this.decodeRowResult.charAt(W)!==bt.ALPHABET_STRING.charAt(Y%43))throw new O;this.decodeRowResult=this.decodeRowResult.substring(0,W)}if(this.decodeRowResult.length===0)throw new I;let S;this.extendedMode?S=bt.decodeExtended(this.decodeRowResult):S=this.decodeRowResult;let B=(c[1]+c[0])/2,z=_+E/2;return new ge(S,null,0,[new ye(B,e),new ye(z,e)],xe.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 _=s;_<n;_++)if(e.get(_)!==h)t[c]++;else{if(c===g-1){if(this.toNarrowWidePattern(t)===bt.ASTERISK_ENCODING&&e.isRange(Math.max(0,d-Math.floor((_-d)/2)),d,!1))return[d,_];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 I}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 _=e[g];_>n&&(h|=1<<t-1-g,s++,d+=_)}if(s===3){for(let g=0;g<t&&s>0;g++){let _=e[g];if(_>n&&(s--,_*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 I}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 tt extends ht{constructor(){super(...arguments),this.narrowLineWidth=-1}decodeRow(e,t,n){let s=this.decodeStart(t),c=this.decodeEnd(t),d=new X;tt.decodeMiddle(t,s[1],c[0],d);let h=d.toString(),g=null;n!=null&&(g=n.get(Z.ALLOWED_LENGTHS)),g==null&&(g=tt.DEFAULT_ALLOWED_LENGTHS);let _=h.length,E=!1,A=0;for(let z of g){if(_===z){E=!0;break}z>A&&(A=z)}if(!E&&_>A&&(E=!0),!E)throw new V;const S=[new ye(s[1],e),new ye(c[0],e)];return new ge(h,null,0,S,xe.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;){ht.recordPattern(e,t,c);for(let _=0;_<5;_++){let E=2*_;d[_]=c[E],h[_]=c[E+1]}let g=tt.decodeDigit(d);s.append(g.toString()),g=this.decodeDigit(h),s.append(g.toString()),c.forEach(function(_){t+=_})}}decodeStart(e){let t=tt.skipWhiteSpace(e),n=tt.findGuardPattern(e,t,tt.START_PATTERN);return this.narrowLineWidth=(n[1]-n[0])/4,this.validateQuietZone(e,n[0]),n}validateQuietZone(e,t){let n=this.narrowLineWidth*10;n=n<t?n:t;for(let s=t-1;n>0&&s>=0&&!e.get(s);s--)n--;if(n!==0)throw new I}static skipWhiteSpace(e){const t=e.getSize(),n=e.getNextSet(0);if(n===t)throw new I;return n}decodeEnd(e){e.reverse();try{let t=tt.skipWhiteSpace(e),n;try{n=tt.findGuardPattern(e,t,tt.END_PATTERN_REVERSED[0])}catch(c){c instanceof I&&(n=tt.findGuardPattern(e,t,tt.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,_=t;c.fill(0);for(let E=t;E<d;E++)if(e.get(E)!==h)c[g]++;else{if(g===s-1){if(ht.patternMatchVariance(c,n,tt.MAX_INDIVIDUAL_VARIANCE)<tt.MAX_AVG_VARIANCE)return[_,E];_+=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 I}static decodeDigit(e){let t=tt.MAX_AVG_VARIANCE,n=-1,s=tt.PATTERNS.length;for(let c=0;c<s;c++){let d=tt.PATTERNS[c],h=ht.patternMatchVariance(e,d,tt.MAX_INDIVIDUAL_VARIANCE);h<t?(t=h,n=c):h===t&&(n=-1)}if(n>=0)return n%10;throw new I}}tt.PATTERNS=[Int32Array.from([1,1,2,2,1]),Int32Array.from([2,1,1,1,2]),Int32Array.from([1,2,1,1,2]),Int32Array.from([2,2,1,1,1]),Int32Array.from([1,1,2,1,2]),Int32Array.from([2,1,2,1,1]),Int32Array.from([1,2,2,1,1]),Int32Array.from([1,1,1,2,2]),Int32Array.from([2,1,1,2,1]),Int32Array.from([1,2,1,2,1]),Int32Array.from([1,1,3,3,1]),Int32Array.from([3,1,1,1,3]),Int32Array.from([1,3,1,1,3]),Int32Array.from([3,3,1,1,1]),Int32Array.from([1,1,3,1,3]),Int32Array.from([3,1,3,1,1]),Int32Array.from([1,3,3,1,1]),Int32Array.from([1,1,1,3,3]),Int32Array.from([3,1,1,3,1]),Int32Array.from([1,3,1,3,1])],tt.MAX_AVG_VARIANCE=.38,tt.MAX_INDIVIDUAL_VARIANCE=.5,tt.DEFAULT_ALLOWED_LENGTHS=[6,8,10,12,14],tt.START_PATTERN=Int32Array.from([1,1,1,1]),tt.END_PATTERN_REVERSED=[Int32Array.from([1,1,2]),Int32Array.from([1,1,3])];class at extends ht{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=at.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 at.checkStandardUPCEANChecksum(e)}static checkStandardUPCEANChecksum(e){let t=e.length;if(t===0)return!1;let n=parseInt(e.charAt(t-1),10);return at.getStandardUPCEANChecksum(e.substring(0,t-1))===n}static getStandardUPCEANChecksum(e){let t=e.length,n=0;for(let 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 at.findGuardPattern(e,t,!1,at.START_END_PATTERN,new Int32Array(at.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,_=s.length,E=n;for(let A=t;A<d;A++)if(e.get(A)!==E)c[h]++;else{if(h===_-1){if(ht.patternMatchVariance(c,s,at.MAX_INDIVIDUAL_VARIANCE)<at.MAX_AVG_VARIANCE)return Int32Array.from([g,A]);g+=c[0]+c[1];let S=c.slice(2,c.length-1);for(let B=0;B<h-1;B++)c[B]=S[B];c[h-1]=0,c[h]=0,h--}else h++;c[h]=1,E=!E}throw new I}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 _=s[g],E=ht.patternMatchVariance(t,_,at.MAX_INDIVIDUAL_VARIANCE);E<c&&(c=E,d=g)}if(d>=0)return d;throw new I}}at.MAX_AVG_VARIANCE=.48,at.MAX_INDIVIDUAL_VARIANCE=.7,at.START_END_PATTERN=Int32Array.from([1,1,1]),at.MIDDLE_PATTERN=Int32Array.from([1,1,1,1,1]),at.END_PATTERN=Int32Array.from([1,1,1,1,1,1]),at.L_PATTERNS=[Int32Array.from([3,2,1,1]),Int32Array.from([2,2,2,1]),Int32Array.from([2,1,2,2]),Int32Array.from([1,4,1,1]),Int32Array.from([1,1,3,2]),Int32Array.from([1,2,3,1]),Int32Array.from([1,1,1,4]),Int32Array.from([1,3,1,2]),Int32Array.from([1,2,1,3]),Int32Array.from([3,1,1,2])];class pe{constructor(){this.CHECK_DIGIT_ENCODINGS=[24,20,18,17,12,6,3,10,9,5],this.decodeMiddleCounters=Int32Array.from([0,0,0,0]),this.decodeRowStringBuffer=""}decodeRow(e,t,n){let s=this.decodeRowStringBuffer,c=this.decodeMiddle(t,n,s),d=s.toString(),h=pe.parseExtensionString(d),g=[new ye((n[0]+n[1])/2,e),new ye(c,e)],_=new ge(d,null,0,g,xe.UPC_EAN_EXTENSION,new Date().getTime());return h!=null&&_.putAllMetadata(h),_}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 _=0;_<5&&d<c;_++){let E=at.decodeDigit(e,s,d,at.L_AND_G_PATTERNS);n+=String.fromCharCode(48+E%10);for(let A of s)d+=A;E>=10&&(h|=1<<4-_),_!==4&&(d=e.getNextSet(d),d=e.getNextUnset(d))}if(n.length!==5)throw new I;let g=this.determineCheckDigit(h);if(pe.extensionChecksum(n.toString())!==g)throw new I;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 I}static parseExtensionString(e){if(e.length!==5)return null;let t=pe.parseExtension5String(e);return t==null?null:new Map([[be.SUGGESTED_PRICE,t]])}static parseExtension5String(e){let t;switch(e.charAt(0)){case"0":t="£";break;case"5":t="$";break;case"9":switch(e){case"90000":return null;case"99991":return"0.00";case"99990":return"Used"}t="";break;default:t="";break}let n=parseInt(e.substring(1)),s=(n/100).toString(),c=n%100,d=c<10?"0"+c:c.toString();return t+s+"."+d}}class se{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=se.parseExtensionString(d),g=[new ye((n[0]+n[1])/2,e),new ye(c,e)],_=new ge(d,null,0,g,xe.UPC_EAN_EXTENSION,new Date().getTime());return h!=null&&_.putAllMetadata(h),_}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 _=at.decodeDigit(e,s,d,at.L_AND_G_PATTERNS);n+=String.fromCharCode(48+_%10);for(let E of s)d+=E;_>=10&&(h|=1<<1-g),g!==1&&(d=e.getNextSet(d),d=e.getNextUnset(d))}if(n.length!==2)throw new I;if(parseInt(n.toString())%4!==h)throw new I;return d}static parseExtensionString(e){return e.length!==2?null:new Map([[be.ISSUE_NUMBER,parseInt(e)]])}}class $e{static decodeRow(e,t,n){let s=at.findGuardPattern(t,n,!1,this.EXTENSION_START_PATTERN,new Int32Array(this.EXTENSION_START_PATTERN.length).fill(0));try{return new pe().decodeRow(e,t,s)}catch{return new se().decodeRow(e,t,s)}}}$e.EXTENSION_START_PATTERN=Int32Array.from([1,1,2]);class Ae extends at{constructor(){super(),this.decodeRowStringBuffer="",Ae.L_AND_G_PATTERNS=Ae.L_PATTERNS.map(e=>Int32Array.from(e));for(let e=10;e<20;e++){let t=Ae.L_PATTERNS[e-10],n=new Int32Array(t.length);for(let s=0;s<t.length;s++)n[s]=t[t.length-s-1];Ae.L_AND_G_PATTERNS[e]=n}}decodeRow(e,t,n){let s=Ae.findStartGuardPattern(t),c=n==null?null:n.get(Z.NEED_RESULT_POINT_CALLBACK);if(c!=null){const le=new ye((s[0]+s[1])/2,e);c.foundPossibleResultPoint(le)}let d=this.decodeMiddle(t,s,this.decodeRowStringBuffer),h=d.rowOffset,g=d.resultString;if(c!=null){const le=new ye(h,e);c.foundPossibleResultPoint(le)}let _=this.decodeEnd(t,h);if(c!=null){const le=new ye((_[0]+_[1])/2,e);c.foundPossibleResultPoint(le)}let E=_[1],A=E+(E-_[0]);if(A>=t.getSize()||!t.isRange(E,A,!1))throw new I;let S=g.toString();if(S.length<8)throw new V;if(!Ae.checkChecksum(S))throw new O;let B=(s[1]+s[0])/2,z=(_[1]+_[0])/2,W=this.getBarcodeFormat(),Y=[new ye(B,e),new ye(z,e)],ie=new ge(S,null,0,Y,W,new Date().getTime()),ue=0;try{let le=$e.decodeRow(e,t,_[1]);ie.putMetadata(be.UPC_EAN_EXTENSION,le.getText()),ie.putAllMetadata(le.getResultMetadata()),ie.addResultPoints(le.getResultPoints()),ue=le.getText().length}catch{}let fe=n==null?null:n.get(Z.ALLOWED_EAN_EXTENSIONS);if(fe!=null){let le=!1;for(let je in fe)if(ue.toString()===je){le=!0;break}if(!le)throw new I}return ie}decodeEnd(e,t){return Ae.findGuardPattern(e,t,!1,Ae.START_END_PATTERN,new Int32Array(Ae.START_END_PATTERN.length).fill(0))}static checkChecksum(e){return Ae.checkStandardUPCEANChecksum(e)}static checkStandardUPCEANChecksum(e){let t=e.length;if(t===0)return!1;let n=parseInt(e.charAt(t-1),10);return Ae.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 zt extends Ae{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 _=0;_<6&&d<c;_++){let E=Ae.decodeDigit(e,s,d,Ae.L_AND_G_PATTERNS);n+=String.fromCharCode(48+E%10);for(let A of s)d+=A;E>=10&&(h|=1<<5-_)}n=zt.determineFirstDigit(n,h),d=Ae.findGuardPattern(e,d,!0,Ae.MIDDLE_PATTERN,new Int32Array(Ae.MIDDLE_PATTERN.length).fill(0))[1];for(let _=0;_<6&&d<c;_++){let E=Ae.decodeDigit(e,s,d,Ae.L_PATTERNS);n+=String.fromCharCode(48+E);for(let A of s)d+=A}return{rowOffset:d,resultString:n}}getBarcodeFormat(){return xe.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 I}}zt.FIRST_DIGIT_ENCODINGS=[0,11,13,14,19,25,28,21,22,26];class An extends Ae{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 _=Ae.decodeDigit(e,s,d,Ae.L_PATTERNS);n+=String.fromCharCode(48+_);for(let E of s)d+=E}d=Ae.findGuardPattern(e,d,!0,Ae.MIDDLE_PATTERN,new Int32Array(Ae.MIDDLE_PATTERN.length).fill(0))[1];for(let g=0;g<4&&d<c;g++){let _=Ae.decodeDigit(e,s,d,Ae.L_PATTERNS);n+=String.fromCharCode(48+_);for(let E of s)d+=E}return{rowOffset:d,resultString:n}}getBarcodeFormat(){return xe.EAN_8}}class ct extends Ae{constructor(){super(...arguments),this.ean13Reader=new zt}getBarcodeFormat(){return xe.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 ge(t.substring(1),null,null,e.getResultPoints(),xe.UPC_A);return e.getResultMetadata()!=null&&n.putAllMetadata(e.getResultMetadata()),n}else throw new I}reset(){this.ean13Reader.reset()}}class Pe extends Ae{constructor(){super(),this.decodeMiddleCounters=new Int32Array(4)}decodeMiddle(e,t,n){const s=this.decodeMiddleCounters.map(_=>_);s[0]=0,s[1]=0,s[2]=0,s[3]=0;const c=e.getSize();let d=t[1],h=0;for(let _=0;_<6&&d<c;_++){const E=Pe.decodeDigit(e,s,d,Pe.L_AND_G_PATTERNS);n+=String.fromCharCode(48+E%10);for(let A of s)d+=A;E>=10&&(h|=1<<5-_)}let g=Pe.determineNumSysAndCheckDigit(n,h);return{rowOffset:d,resultString:g}}decodeEnd(e,t){return Pe.findGuardPatternWithoutCounters(e,t,!0,Pe.MIDDLE_END_PATTERN)}checkChecksum(e){return Ae.checkChecksum(Pe.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 I.getNotFoundInstance()}getBarcodeFormat(){return xe.UPC_E}static convertUPCEtoUPCA(e){const t=e.slice(1,7).split("").map(c=>c.charCodeAt(0)),n=new X;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()}}Pe.MIDDLE_END_PATTERN=Int32Array.from([1,1,1,1,1,1]),Pe.NUMSYS_AND_CHECK_DIGIT_PATTERNS=[Int32Array.from([56,52,50,49,44,38,35,42,41,37]),Int32Array.from([7,11,13,14,19,25,28,21,22,26])];class qt extends ht{constructor(e){super();let t=e==null?null:e.get(Z.POSSIBLE_FORMATS),n=[];i(t)?(n.push(new zt),n.push(new ct),n.push(new An),n.push(new Pe)):(t.indexOf(xe.EAN_13)>-1&&n.push(new zt),t.indexOf(xe.UPC_A)>-1&&n.push(new ct),t.indexOf(xe.EAN_8)>-1&&n.push(new An),t.indexOf(xe.UPC_E)>-1&&n.push(new Pe)),this.readers=n}decodeRow(e,t,n){for(let s of this.readers)try{const c=s.decodeRow(e,t,n),d=c.getBarcodeFormat()===xe.EAN_13&&c.getText().charAt(0)==="0",h=n==null?null:n.get(Z.POSSIBLE_FORMATS),g=h==null||h.includes(xe.UPC_A);if(d&&g){const _=c.getRawBytes(),E=new ge(c.getText().substring(1),_,_?_.length:null,c.getResultPoints(),xe.UPC_A);return E.putAllMetadata(c.getResultMetadata()),E}return c}catch{}throw new I}reset(){for(let e of this.readers)e.reset()}}class Ye extends ht{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(ht.patternMatchVariance(e,t[n],Ye.MAX_INDIVIDUAL_VARIANCE)<Ye.MAX_AVG_VARIANCE)return n;throw new I}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>=Ye.MIN_FINDER_PATTERN_RATIO&&s<=Ye.MAX_FINDER_PATTERN_RATIO){let c=Number.MAX_SAFE_INTEGER,d=Number.MIN_SAFE_INTEGER;for(let h of e)h>d&&(d=h),h<c&&(c=h);return d<10*c}return!1}}Ye.MAX_AVG_VARIANCE=.2,Ye.MAX_INDIVIDUAL_VARIANCE=.45,Ye.MIN_FINDER_PATTERN_RATIO=9.5/12,Ye.MAX_FINDER_PATTERN_RATIO=12.5/14;class Ct{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 Ct))return!1;const t=e;return this.value===t.value&&this.checksumPortion===t.checksumPortion}hashCode(){return this.value^this.checksumPortion}}class Nt{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 ye(n,c)),this.resultPoints.push(new ye(s,c))}getValue(){return this.value}getStartEnd(){return this.startEnd}getResultPoints(){return this.resultPoints}equals(e){if(!(e instanceof Nt))return!1;const t=e;return this.value===t.value}hashCode(){return this.value}}class pt{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 _;for(_=1,d|=1<<g;_<e[g];_++,d&=~(1<<g)){let E=pt.combins(s-_-1,h-g-2);if(n&&d===0&&s-_-(h-g-1)>=h-g-1&&(E-=pt.combins(s-_-(h-g),h-g-2)),h-g-1>1){let A=0;for(let S=s-_-(h-g-2);S>t;S--)A+=pt.combins(s-_-S-1,h-g-3);E-=A*(h-1-g)}else s-_>t&&E--;c+=E}s-=_}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 ze{static buildBitArray(e){let t=e.length*2-1;e[e.length-1].getRightChar()==null&&(t-=1);let n=12*t,s=new F(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 _=e[g],E=_.getLeftChar().getValue();for(let A=11;A>=0;--A)E&1<<A&&s.set(c),c++;if(_.getRightChar()!=null){let A=_.getRightChar().getValue();for(let S=11;S>=0;--S)A&1<<S&&s.set(c),c++}}return s}}class un{constructor(e,t){t?this.decodedInformation=null:(this.finished=e,this.decodedInformation=t)}getDecodedInformation(){return this.decodedInformation}isFinished(){return this.finished}}class Wn{constructor(e){this.newPosition=e}getNewPosition(){return this.newPosition}}class Zt extends Wn{constructor(e,t){super(e),this.value=t}getValue(){return this.value}isFNC1(){return this.value===Zt.FNC1}}Zt.FNC1="$";class lr extends Wn{constructor(e,t,n){super(e),n?(this.remaining=!0,this.remainingValue=this.remainingValue):(this.remaining=!1,this.remainingValue=0),this.newString=t}getNewString(){return this.newString}isRemaining(){return this.remaining}getRemainingValue(){return this.remainingValue}}class mn extends Wn{constructor(e,t,n){if(super(e),t<0||t>10||n<0||n>10)throw new V;this.firstDigit=t,this.secondDigit=n}getFirstDigit(){return this.firstDigit}getSecondDigit(){return this.secondDigit}getValue(){return this.firstDigit*10+this.secondDigit}isFirstDigitFNC1(){return this.firstDigit===mn.FNC1}isSecondDigitFNC1(){return this.secondDigit===mn.FNC1}isAnyFNC1(){return this.firstDigit===mn.FNC1||this.secondDigit===mn.FNC1}}mn.FNC1=10;class Ee{constructor(){}static parseFieldsInGeneralPurpose(e){if(!e)return null;if(e.length<2)throw new I;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 I;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 I;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 I}static processFixedAI(e,t,n){if(n.length<e)throw new I;let s=n.substring(0,e);if(n.length<e+t)throw new I;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,_=Ee.parseFieldsInGeneralPurpose(h);return _==null?g:g+_}}Ee.VARIABLE_LENGTH=[],Ee.TWO_DIGIT_DATA_LENGTH=[["00",18],["01",14],["02",14],["10",Ee.VARIABLE_LENGTH,20],["11",6],["12",6],["13",6],["15",6],["17",6],["20",2],["21",Ee.VARIABLE_LENGTH,20],["22",Ee.VARIABLE_LENGTH,29],["30",Ee.VARIABLE_LENGTH,8],["37",Ee.VARIABLE_LENGTH,8],["90",Ee.VARIABLE_LENGTH,30],["91",Ee.VARIABLE_LENGTH,30],["92",Ee.VARIABLE_LENGTH,30],["93",Ee.VARIABLE_LENGTH,30],["94",Ee.VARIABLE_LENGTH,30],["95",Ee.VARIABLE_LENGTH,30],["96",Ee.VARIABLE_LENGTH,30],["97",Ee.VARIABLE_LENGTH,3],["98",Ee.VARIABLE_LENGTH,30],["99",Ee.VARIABLE_LENGTH,30]],Ee.THREE_DIGIT_DATA_LENGTH=[["240",Ee.VARIABLE_LENGTH,30],["241",Ee.VARIABLE_LENGTH,30],["242",Ee.VARIABLE_LENGTH,6],["250",Ee.VARIABLE_LENGTH,30],["251",Ee.VARIABLE_LENGTH,30],["253",Ee.VARIABLE_LENGTH,17],["254",Ee.VARIABLE_LENGTH,20],["400",Ee.VARIABLE_LENGTH,30],["401",Ee.VARIABLE_LENGTH,30],["402",17],["403",Ee.VARIABLE_LENGTH,30],["410",13],["411",13],["412",13],["413",13],["414",13],["420",Ee.VARIABLE_LENGTH,20],["421",Ee.VARIABLE_LENGTH,15],["422",3],["423",Ee.VARIABLE_LENGTH,15],["424",3],["425",3],["426",3]],Ee.THREE_DIGIT_PLUS_DIGIT_DATA_LENGTH=[["310",6],["311",6],["312",6],["313",6],["314",6],["315",6],["316",6],["320",6],["321",6],["322",6],["323",6],["324",6],["325",6],["326",6],["327",6],["328",6],["329",6],["330",6],["331",6],["332",6],["333",6],["334",6],["335",6],["336",6],["340",6],["341",6],["342",6],["343",6],["344",6],["345",6],["346",6],["347",6],["348",6],["349",6],["350",6],["351",6],["352",6],["353",6],["354",6],["355",6],["356",6],["357",6],["360",6],["361",6],["362",6],["363",6],["364",6],["365",6],["366",6],["367",6],["368",6],["369",6],["390",Ee.VARIABLE_LENGTH,15],["391",Ee.VARIABLE_LENGTH,18],["392",Ee.VARIABLE_LENGTH,15],["393",Ee.VARIABLE_LENGTH,18],["703",Ee.VARIABLE_LENGTH,30]],Ee.FOUR_DIGIT_DATA_LENGTH=[["7001",13],["7002",Ee.VARIABLE_LENGTH,30],["7003",10],["8001",14],["8002",Ee.VARIABLE_LENGTH,20],["8003",Ee.VARIABLE_LENGTH,30],["8004",Ee.VARIABLE_LENGTH,30],["8005",6],["8006",18],["8007",Ee.VARIABLE_LENGTH,30],["8008",Ee.VARIABLE_LENGTH,12],["8018",18],["8020",Ee.VARIABLE_LENGTH,25],["8100",6],["8101",10],["8102",2],["8110",Ee.VARIABLE_LENGTH,70],["8200",Ee.VARIABLE_LENGTH,70]];class Ir{constructor(e){this.buffer=new X,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 mn(this.information.getSize(),mn.FNC1,mn.FNC1):new mn(this.information.getSize(),c-1,mn.FNC1)}let t=this.extractNumericValueFromBitArray(e,7),n=(t-8)/11,s=(t-8)%11;return new mn(e+7,n,s)}extractNumericValueFromBitArray(e,t){return Ir.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 lr(this.current.getPosition(),this.buffer.toString(),n.getRemainingValue()):new lr(this.current.getPosition(),this.buffer.toString())}parseBlocks(){let e,t;do{let n=this.current.getPosition();if(this.current.isAlpha()?(t=this.parseAlphaBlock(),e=t.isFinished()):this.current.isIsoIec646()?(t=this.parseIsoIec646Block(),e=t.isFinished()):(t=this.parseNumericBlock(),e=t.isFinished()),!(n!==this.current.getPosition())&&!e)break}while(!e);return t.getDecodedInformation()}parseNumericBlock(){for(;this.isStillNumeric(this.current.getPosition());){let e=this.decodeNumeric(this.current.getPosition());if(this.current.setPosition(e.getNewPosition()),e.isFirstDigitFNC1()){let t;return e.isSecondDigitFNC1()?t=new lr(this.current.getPosition(),this.buffer.toString()):t=new lr(this.current.getPosition(),this.buffer.toString(),e.getSecondDigit()),new un(!0,t)}if(this.buffer.append(e.getFirstDigit()),e.isSecondDigitFNC1()){let t=new lr(this.current.getPosition(),this.buffer.toString());return new un(!0,t)}this.buffer.append(e.getSecondDigit())}return this.isNumericToAlphaNumericLatch(this.current.getPosition())&&(this.current.setAlpha(),this.current.incrementPosition(4)),new un(!1)}parseIsoIec646Block(){for(;this.isStillIsoIec646(this.current.getPosition());){let e=this.decodeIsoIec646(this.current.getPosition());if(this.current.setPosition(e.getNewPosition()),e.isFNC1()){let t=new lr(this.current.getPosition(),this.buffer.toString());return new un(!0,t)}this.buffer.append(e.getValue())}return this.isAlphaOr646ToNumericLatch(this.current.getPosition())?(this.current.incrementPosition(3),this.current.setNumeric()):this.isAlphaTo646ToAlphaLatch(this.current.getPosition())&&(this.current.getPosition()+5<this.information.getSize()?this.current.incrementPosition(5):this.current.setPosition(this.information.getSize()),this.current.setAlpha()),new un(!1)}parseAlphaBlock(){for(;this.isStillAlpha(this.current.getPosition());){let e=this.decodeAlphanumeric(this.current.getPosition());if(this.current.setPosition(e.getNewPosition()),e.isFNC1()){let t=new lr(this.current.getPosition(),this.buffer.toString());return new un(!0,t)}this.buffer.append(e.getValue())}return this.isAlphaOr646ToNumericLatch(this.current.getPosition())?(this.current.incrementPosition(3),this.current.setNumeric()):this.isAlphaTo646ToAlphaLatch(this.current.getPosition())&&(this.current.getPosition()+5<this.information.getSize()?this.current.incrementPosition(5):this.current.setPosition(this.information.getSize()),this.current.setIsoIec646()),new un(!1)}isStillIsoIec646(e){if(e+5>this.information.getSize())return!1;let t=this.extractNumericValueFromBitArray(e,5);if(t>=5&&t<16)return!0;if(e+7>this.information.getSize())return!1;let n=this.extractNumericValueFromBitArray(e,7);if(n>=64&&n<116)return!0;if(e+8>this.information.getSize())return!1;let s=this.extractNumericValueFromBitArray(e,8);return s>=232&&s<253}decodeIsoIec646(e){let t=this.extractNumericValueFromBitArray(e,5);if(t===15)return new Zt(e+5,Zt.FNC1);if(t>=5&&t<15)return new Zt(e+5,"0"+(t-5));let n=this.extractNumericValueFromBitArray(e,7);if(n>=64&&n<90)return new Zt(e+7,""+(n+1));if(n>=90&&n<116)return new Zt(e+7,""+(n+7));let 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 Zt(e+8,c)}isStillAlpha(e){if(e+5>this.information.getSize())return!1;let t=this.extractNumericValueFromBitArray(e,5);if(t>=5&&t<16)return!0;if(e+6>this.information.getSize())return!1;let n=this.extractNumericValueFromBitArray(e,6);return n>=16&&n<63}decodeAlphanumeric(e){let t=this.extractNumericValueFromBitArray(e,5);if(t===15)return new Zt(e+5,Zt.FNC1);if(t>=5&&t<15)return new Zt(e+5,"0"+(t-5));let n=this.extractNumericValueFromBitArray(e,6);if(n>=32&&n<58)return new Zt(e+6,""+(n+33));let 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 Ue("Decoding invalid alphanumeric value: "+n)}return new Zt(e+6,s)}isAlphaTo646ToAlphaLatch(e){if(e+1>this.information.getSize())return!1;for(let t=0;t<5&&t+e<this.information.getSize();++t)if(t===2){if(!this.information.get(e+2))return!1}else if(this.information.get(e+t))return!1;return!0}isAlphaOr646ToNumericLatch(e){if(e+3>this.information.getSize())return!1;for(let t=e;t<e+3;++t)if(this.information.get(t))return!1;return!0}isNumericToAlphaNumericLatch(e){if(e+1>this.information.getSize())return!1;for(let t=0;t<4&&t+e<this.information.getSize();++t)if(this.information.get(e+t))return!1;return!0}}class Mo{constructor(e){this.information=e,this.generalDecoder=new Ir(e)}getInformation(){return this.information}getGeneralDecoder(){return this.generalDecoder}}class tn extends Mo{constructor(e){super(e)}encodeCompressedGtin(e,t){e.append("(01)");let n=e.length();e.append("9"),this.encodeCompressedGtinWithoutAI(e,t,n)}encodeCompressedGtinWithoutAI(e,t,n){for(let 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)}tn.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)}}tn.GTIN_SIZE=40;class Nr extends tn{constructor(e){super(e)}parseInformation(){let e=new X;e.append("(01)");let t=e.length(),n=this.getGeneralDecoder().extractNumericValueFromBitArray(Nr.HEADER_SIZE,4);return e.append(n),this.encodeCompressedGtinWithoutAI(e,Nr.HEADER_SIZE+4,t),this.getGeneralDecoder().decodeAllCodes(e,Nr.HEADER_SIZE+44)}}Nr.HEADER_SIZE=4;class Oi extends Mo{constructor(e){super(e)}parseInformation(){let e=new X;return this.getGeneralDecoder().decodeAllCodes(e,Oi.HEADER_SIZE)}}Oi.HEADER_SIZE=5;class Mi extends tn{constructor(e){super(e)}encodeCompressedWeight(e,t,n){let 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 Bn extends Mi{constructor(e){super(e)}parseInformation(){if(this.getInformation().getSize()!=Bn.HEADER_SIZE+Mi.GTIN_SIZE+Bn.WEIGHT_SIZE)throw new I;let e=new X;return this.encodeCompressedGtin(e,Bn.HEADER_SIZE),this.encodeCompressedWeight(e,Bn.HEADER_SIZE+Mi.GTIN_SIZE,Bn.WEIGHT_SIZE),e.toString()}}Bn.HEADER_SIZE=5,Bn.WEIGHT_SIZE=15;class hg extends Bn{constructor(e){super(e)}addWeightCode(e,t){e.append("(3103)")}checkWeight(e){return e}}class mg extends Bn{constructor(e){super(e)}addWeightCode(e,t){t<1e4?e.append("(3202)"):e.append("(3203)")}checkWeight(e){return e<1e4?e:e-1e4}}class On extends tn{constructor(e){super(e)}parseInformation(){if(this.getInformation().getSize()<On.HEADER_SIZE+tn.GTIN_SIZE)throw new I;let e=new X;this.encodeCompressedGtin(e,On.HEADER_SIZE);let t=this.getGeneralDecoder().extractNumericValueFromBitArray(On.HEADER_SIZE+tn.GTIN_SIZE,On.LAST_DIGIT_SIZE);e.append("(392"),e.append(t),e.append(")");let n=this.getGeneralDecoder().decodeGeneralPurposeField(On.HEADER_SIZE+tn.GTIN_SIZE+On.LAST_DIGIT_SIZE,null);return e.append(n.getNewString()),e.toString()}}On.HEADER_SIZE=8,On.LAST_DIGIT_SIZE=2;class Yt extends tn{constructor(e){super(e)}parseInformation(){if(this.getInformation().getSize()<Yt.HEADER_SIZE+tn.GTIN_SIZE)throw new I;let e=new X;this.encodeCompressedGtin(e,Yt.HEADER_SIZE);let t=this.getGeneralDecoder().extractNumericValueFromBitArray(Yt.HEADER_SIZE+tn.GTIN_SIZE,Yt.LAST_DIGIT_SIZE);e.append("(393"),e.append(t),e.append(")");let n=this.getGeneralDecoder().extractNumericValueFromBitArray(Yt.HEADER_SIZE+tn.GTIN_SIZE+Yt.LAST_DIGIT_SIZE,Yt.FIRST_THREE_DIGITS_SIZE);n/100==0&&e.append("0"),n/10==0&&e.append("0"),e.append(n);let s=this.getGeneralDecoder().decodeGeneralPurposeField(Yt.HEADER_SIZE+tn.GTIN_SIZE+Yt.LAST_DIGIT_SIZE+Yt.FIRST_THREE_DIGITS_SIZE,null);return e.append(s.getNewString()),e.toString()}}Yt.HEADER_SIZE=8,Yt.LAST_DIGIT_SIZE=2,Yt.FIRST_THREE_DIGITS_SIZE=10;class Et extends Mi{constructor(e,t,n){super(e),this.dateCode=n,this.firstAIdigits=t}parseInformation(){if(this.getInformation().getSize()!=Et.HEADER_SIZE+Et.GTIN_SIZE+Et.WEIGHT_SIZE+Et.DATE_SIZE)throw new I;let e=new X;return this.encodeCompressedGtin(e,Et.HEADER_SIZE),this.encodeCompressedWeight(e,Et.HEADER_SIZE+Et.GTIN_SIZE,Et.WEIGHT_SIZE),this.encodeCompressedDate(e,Et.HEADER_SIZE+Et.GTIN_SIZE+Et.WEIGHT_SIZE),e.toString()}encodeCompressedDate(e,t){let n=this.getGeneralDecoder().extractNumericValueFromBitArray(t,Et.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}}Et.HEADER_SIZE=8,Et.WEIGHT_SIZE=20,Et.DATE_SIZE=16;function $a(b){try{if(b.get(1))return new Nr(b);if(!b.get(2))return new Oi(b);switch(Ir.extractNumericValueFromBitArray(b,1,4)){case 4:return new hg(b);case 5:return new mg(b)}switch(Ir.extractNumericValueFromBitArray(b,1,5)){case 12:return new On(b);case 13:return new Yt(b)}switch(Ir.extractNumericValueFromBitArray(b,1,7)){case 56:return new Et(b,"310","11");case 57:return new Et(b,"320","11");case 58:return new Et(b,"310","13");case 59:return new Et(b,"320","13");case 60:return new Et(b,"310","15");case 61:return new Et(b,"320","15");case 62:return new Et(b,"310","17");case 63:return new Et(b,"320","17")}}catch(e){throw console.log(e),new Ue("unknown decoder: "+b)}}class Xn{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 Xn?Xn.equalsOrNull(e.leftchar,t.leftchar)&&Xn.equalsOrNull(e.rightchar,t.rightchar)&&Xn.equalsOrNull(e.finderpattern,t.finderpattern):!1}static equalsOrNull(e,t){return e===null?t===null:Xn.equals(e,t)}hashCode(){return this.leftchar.getValue()^this.rightchar.getValue()^this.finderpattern.getValue()}}class Do{constructor(e,t,n){this.pairs=e,this.rowNumber=t,this.wasReversed=n}getPairs(){return this.pairs}getRowNumber(){return this.rowNumber}isReversed(){return this.wasReversed}isEquivalent(e){return this.checkEqualitity(this,e)}toString(){return"{ "+this.pairs+" }"}equals(e,t){return e instanceof Do?this.checkEqualitity(e,t)&&e.wasReversed===t.wasReversed:!1}checkEqualitity(e,t){if(!e||!t)return;let n;return e.forEach((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 ae extends Ye{constructor(e){super(...arguments),this.pairs=new Array(ae.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 ae.constructResult(this.decodeRow2pairs(e,t))}catch(s){this.verbose&&console.log(s)}return this.pairs.length=0,this.startFromEven=!0,ae.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 I){if(!this.pairs.length)throw new I;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 I}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()),!ae.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 I}static isValidSequence(e){for(let t of ae.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||ae.isPartialRow(this.pairs,this.rows)||(this.rows.push(n,new Do(this.pairs,e,t)),this.removePartialRows(this.pairs,this.rows))}removePartialRows(e,t){for(let n of t)if(n.getPairs().length!==e.length){for(let s of n.getPairs())for(let c of e)if(Xn.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=ze.buildBitArray(e),s=$a(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 ge(s,null,null,h,xe.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 _=g.getRightChar();_!=null&&(s+=_.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=ae.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 I;let _;try{_=this.decodeDataCharacter(e,c,s,!1)}catch(E){_=null,this.verbose&&console.log(E)}return new Xn(g,_,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 _=0,E=d;for(let A=d;A<c;A++)if(e.get(A)!=g)s[_]++;else{if(_==3){if(h&&ae.reverseCounters(s),ae.isFinderPattern(s)){this.startEnd[0]=E,this.startEnd[1]=A;return}h&&ae.reverseCounters(s),E+=s[0]+s[1],s[0]=s[2],s[1]=s[3],s[2]=0,s[3]=0,_--}else _++;s[_]=1,g=!g}throw new I}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 _=this.startEnd[0]-1;for(;_>=0&&!e.get(_);)_--;_++,s=this.startEnd[0]-_,c=_,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,ae.FINDER_PATTERNS)}catch{return null}return new Nt(g,[c,d],c,d,t)}decodeDataCharacter(e,t,n,s){let c=this.getDataCharacterCounters();for(let ut=0;ut<c.length;ut++)c[ut]=0;if(s)ae.recordPatternInReverse(e,t.getStartEnd()[0],c);else{ae.recordPattern(e,t.getStartEnd()[1],c);for(let ut=0,Wt=c.length-1;ut<Wt;ut++,Wt--){let fn=c[ut];c[ut]=c[Wt],c[Wt]=fn}}let d=17,h=ve.sum(new Int32Array(c))/d,g=(t.getStartEnd()[1]-t.getStartEnd()[0])/15;if(Math.abs(h-g)/g>.3)throw new I;let _=this.getOddCounts(),E=this.getEvenCounts(),A=this.getOddRoundingErrors(),S=this.getEvenRoundingErrors();for(let ut=0;ut<c.length;ut++){let Wt=1*c[ut]/h,fn=Wt+.5;if(fn<1){if(Wt<.3)throw new I;fn=1}else if(fn>8){if(Wt>8.7)throw new I;fn=8}let Or=ut/2;ut&1?(E[Or]=fn,S[Or]=Wt-fn):(_[Or]=fn,A[Or]=Wt-fn)}this.adjustOddEvenCounts(d);let B=4*t.getValue()+(n?0:2)+(s?0:1)-1,z=0,W=0;for(let ut=_.length-1;ut>=0;ut--){if(ae.isNotA1left(t,n,s)){let Wt=ae.WEIGHTS[B][2*ut];W+=_[ut]*Wt}z+=_[ut]}let Y=0;for(let ut=E.length-1;ut>=0;ut--)if(ae.isNotA1left(t,n,s)){let Wt=ae.WEIGHTS[B][2*ut+1];Y+=E[ut]*Wt}let ie=W+Y;if(z&1||z>13||z<4)throw new I;let ue=(13-z)/2,fe=ae.SYMBOL_WIDEST[ue],le=9-fe,je=pt.getRSSvalue(_,fe,!0),Fe=pt.getRSSvalue(E,le,!1),rn=ae.EVEN_TOTAL_SUBSET[ue],Sn=ae.GSUM[ue],on=je*rn+Fe+Sn;return new Ct(on,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,_=(t&1)==1,E=(n&1)==0;if(g==1)if(_){if(E)throw new I;c=!0}else{if(!E)throw new I;h=!0}else if(g==-1)if(_){if(E)throw new I;s=!0}else{if(!E)throw new I;d=!0}else if(g==0){if(_){if(!E)throw new I;t<n?(s=!0,h=!0):(c=!0,d=!0)}else if(E)throw new I}else throw new I;if(s){if(c)throw new I;ae.increment(this.getOddCounts(),this.getOddRoundingErrors())}if(c&&ae.decrement(this.getOddCounts(),this.getOddRoundingErrors()),d){if(h)throw new I;ae.increment(this.getEvenCounts(),this.getOddRoundingErrors())}h&&ae.decrement(this.getEvenCounts(),this.getEvenRoundingErrors())}}ae.SYMBOL_WIDEST=[7,5,4,3,1],ae.EVEN_TOTAL_SUBSET=[4,20,52,104,204],ae.GSUM=[0,348,1388,2948,3988],ae.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])],ae.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]],ae.FINDER_PAT_A=0,ae.FINDER_PAT_B=1,ae.FINDER_PAT_C=2,ae.FINDER_PAT_D=3,ae.FINDER_PAT_E=4,ae.FINDER_PAT_F=5,ae.FINDER_PATTERN_SEQUENCES=[[ae.FINDER_PAT_A,ae.FINDER_PAT_A],[ae.FINDER_PAT_A,ae.FINDER_PAT_B,ae.FINDER_PAT_B],[ae.FINDER_PAT_A,ae.FINDER_PAT_C,ae.FINDER_PAT_B,ae.FINDER_PAT_D],[ae.FINDER_PAT_A,ae.FINDER_PAT_E,ae.FINDER_PAT_B,ae.FINDER_PAT_D,ae.FINDER_PAT_C],[ae.FINDER_PAT_A,ae.FINDER_PAT_E,ae.FINDER_PAT_B,ae.FINDER_PAT_D,ae.FINDER_PAT_D,ae.FINDER_PAT_F],[ae.FINDER_PAT_A,ae.FINDER_PAT_E,ae.FINDER_PAT_B,ae.FINDER_PAT_D,ae.FINDER_PAT_E,ae.FINDER_PAT_F,ae.FINDER_PAT_F],[ae.FINDER_PAT_A,ae.FINDER_PAT_A,ae.FINDER_PAT_B,ae.FINDER_PAT_B,ae.FINDER_PAT_C,ae.FINDER_PAT_C,ae.FINDER_PAT_D,ae.FINDER_PAT_D],[ae.FINDER_PAT_A,ae.FINDER_PAT_A,ae.FINDER_PAT_B,ae.FINDER_PAT_B,ae.FINDER_PAT_C,ae.FINDER_PAT_C,ae.FINDER_PAT_D,ae.FINDER_PAT_E,ae.FINDER_PAT_E],[ae.FINDER_PAT_A,ae.FINDER_PAT_A,ae.FINDER_PAT_B,ae.FINDER_PAT_B,ae.FINDER_PAT_C,ae.FINDER_PAT_C,ae.FINDER_PAT_D,ae.FINDER_PAT_E,ae.FINDER_PAT_F,ae.FINDER_PAT_F],[ae.FINDER_PAT_A,ae.FINDER_PAT_A,ae.FINDER_PAT_B,ae.FINDER_PAT_B,ae.FINDER_PAT_C,ae.FINDER_PAT_D,ae.FINDER_PAT_D,ae.FINDER_PAT_E,ae.FINDER_PAT_E,ae.FINDER_PAT_F,ae.FINDER_PAT_F]],ae.MAX_PAIRS=11;class gg extends Ct{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 Tt extends Ye{constructor(){super(...arguments),this.possibleLeftPairs=[],this.possibleRightPairs=[]}decodeRow(e,t,n){const s=this.decodePair(t,!1,e,n);Tt.addOrTally(this.possibleLeftPairs,s),t.reverse();let c=this.decodePair(t,!0,e,n);Tt.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&&Tt.checkChecksum(d,h))return Tt.constructResult(d,h)}throw new I}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 X;for(let _=13-s.length;_>0;_--)c.append("0");c.append(s);let d=0;for(let _=0;_<13;_++){let E=c.charAt(_).charCodeAt(0)-48;d+=_&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 ge(c.toString(),null,0,[h[0],h[1],g[0],g[1]],xe.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 ye(E,n))}let g=this.decodeDataCharacter(e,d,!0),_=this.decodeDataCharacter(e,d,!1);return new gg(1597*g.getValue()+_.getValue(),g.getChecksumPortion()+4*_.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)ht.recordPatternInReverse(e,t.getStartEnd()[0],s);else{ht.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(),_=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 fe=Math.floor(Y/2);Y&1?(g[fe]=ue,E[fe]=ie-ue):(h[fe]=ue,_[fe]=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 B=0,z=0;for(let Y=g.length-1;Y>=0;Y--)B*=9,B+=g[Y],z+=g[Y];let W=S+3*B;if(n){if(A&1||A>12||A<4)throw new I;let Y=(12-A)/2,ie=Tt.OUTSIDE_ODD_WIDEST[Y],ue=9-ie,fe=pt.getRSSvalue(h,ie,!1),le=pt.getRSSvalue(g,ue,!0),je=Tt.OUTSIDE_EVEN_TOTAL_SUBSET[Y],Fe=Tt.OUTSIDE_GSUM[Y];return new Ct(fe*je+le+Fe,W)}else{if(z&1||z>10||z<4)throw new I;let Y=(10-z)/2,ie=Tt.INSIDE_ODD_WIDEST[Y],ue=9-ie,fe=pt.getRSSvalue(h,ie,!0),le=pt.getRSSvalue(g,ue,!1),je=Tt.INSIDE_ODD_TOTAL_SUBSET[Y],Fe=Tt.INSIDE_GSUM[Y];return new Ct(le*je+fe+Fe,W)}}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 _=d;_<s;_++)if(e.get(_)!==c)n[h]++;else{if(h===3){if(Ye.isFinderPattern(n))return[g,_];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 I}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(),_=new Int32Array(g.length);v.arraycopy(g,0,_,1,g.length-1),_[0]=h;const E=this.parseFinderValue(_,Tt.FINDER_PATTERNS);let A=d,S=s[1];return n&&(A=e.getSize()-1-A,S=e.getSize()-1-S),new Nt(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 _=n+s-t,E=(n&1)===(e?1:0),A=(s&1)===1;if(_===1)if(E){if(A)throw new I;d=!0}else{if(!A)throw new I;g=!0}else if(_===-1)if(E){if(A)throw new I;c=!0}else{if(!A)throw new I;h=!0}else if(_===0){if(E){if(!A)throw new I;n<s?(c=!0,g=!0):(d=!0,h=!0)}else if(A)throw new I}else throw new I;if(c){if(d)throw new I;Ye.increment(this.getOddCounts(),this.getOddRoundingErrors())}if(d&&Ye.decrement(this.getOddCounts(),this.getOddRoundingErrors()),h){if(g)throw new I;Ye.increment(this.getEvenCounts(),this.getOddRoundingErrors())}g&&Ye.decrement(this.getEvenCounts(),this.getEvenRoundingErrors())}}Tt.OUTSIDE_EVEN_TOTAL_SUBSET=[1,10,34,70,126],Tt.INSIDE_ODD_TOTAL_SUBSET=[4,20,48,81],Tt.OUTSIDE_GSUM=[0,161,961,2015,2715],Tt.INSIDE_GSUM=[0,336,1036,1516],Tt.OUTSIDE_ODD_WIDEST=[8,6,4,3,1],Tt.INSIDE_ODD_WIDEST=[2,4,6,8],Tt.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 ht{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(xe.EAN_13)||n.includes(xe.UPC_A)||n.includes(xe.EAN_8)||n.includes(xe.UPC_E))&&this.readers.push(new qt(e)),n.includes(xe.CODE_39)&&this.readers.push(new bt(s)),n.includes(xe.CODE_128)&&this.readers.push(new me),n.includes(xe.ITF)&&this.readers.push(new tt),n.includes(xe.RSS_14)&&this.readers.push(new Tt),n.includes(xe.RSS_EXPANDED)&&this.readers.push(new ae(this.verbose))):(this.readers.push(new qt(e)),this.readers.push(new bt),this.readers.push(new qt(e)),this.readers.push(new me),this.readers.push(new tt),this.readers.push(new Tt),this.readers.push(new ae(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 I}reset(){this.readers.forEach(e=>e.reset())}}class pg extends Ce{constructor(e=500,t){super(new Tr(t),e,t)}}class nt{constructor(e,t,n){this.ecCodewords=e,this.ecBlocks=[t],n&&this.ecBlocks.push(n)}getECCodewords(){return this.ecCodewords}getECBlocks(){return this.ecBlocks}}class Je{constructor(e,t){this.count=e,this.dataCodewords=t}getCount(){return this.count}getDataCodewords(){return this.dataCodewords}}class qe{constructor(e,t,n,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(),_=d.getECBlocks();for(let E of _)h+=E.getCount()*(E.getDataCodewords()+g);this.totalCodewords=h}getVersionNumber(){return this.versionNumber}getSymbolSizeRows(){return this.symbolSizeRows}getSymbolSizeColumns(){return this.symbolSizeColumns}getDataRegionSizeRows(){return this.dataRegionSizeRows}getDataRegionSizeColumns(){return this.dataRegionSizeColumns}getTotalCodewords(){return this.totalCodewords}getECBlocks(){return this.ecBlocks}static getVersionForDimensions(e,t){if(e&1||t&1)throw new V;for(let n of qe.VERSIONS)if(n.symbolSizeRows===e&&n.symbolSizeColumns===t)return n;throw new V}toString(){return""+this.versionNumber}static buildVersions(){return[new qe(1,10,10,8,8,new nt(5,new Je(1,3))),new qe(2,12,12,10,10,new nt(7,new Je(1,5))),new qe(3,14,14,12,12,new nt(10,new Je(1,8))),new qe(4,16,16,14,14,new nt(12,new Je(1,12))),new qe(5,18,18,16,16,new nt(14,new Je(1,18))),new qe(6,20,20,18,18,new nt(18,new Je(1,22))),new qe(7,22,22,20,20,new nt(20,new Je(1,30))),new qe(8,24,24,22,22,new nt(24,new Je(1,36))),new qe(9,26,26,24,24,new nt(28,new Je(1,44))),new qe(10,32,32,14,14,new nt(36,new Je(1,62))),new qe(11,36,36,16,16,new nt(42,new Je(1,86))),new qe(12,40,40,18,18,new nt(48,new Je(1,114))),new qe(13,44,44,20,20,new nt(56,new Je(1,144))),new qe(14,48,48,22,22,new nt(68,new Je(1,174))),new qe(15,52,52,24,24,new nt(42,new Je(2,102))),new qe(16,64,64,14,14,new nt(56,new Je(2,140))),new qe(17,72,72,16,16,new nt(36,new Je(4,92))),new qe(18,80,80,18,18,new nt(48,new Je(4,114))),new qe(19,88,88,20,20,new nt(56,new Je(4,144))),new qe(20,96,96,22,22,new nt(68,new Je(4,174))),new qe(21,104,104,24,24,new nt(56,new Je(6,136))),new qe(22,120,120,18,18,new nt(68,new Je(6,175))),new qe(23,132,132,20,20,new nt(62,new Je(8,163))),new qe(24,144,144,22,22,new nt(62,new Je(8,156),new Je(2,155))),new qe(25,8,18,6,16,new nt(7,new Je(1,5))),new qe(26,8,32,6,14,new nt(11,new Je(1,10))),new qe(27,12,26,10,24,new nt(14,new Je(1,16))),new qe(28,12,36,10,16,new nt(18,new Je(1,22))),new qe(29,16,36,14,16,new nt(24,new Je(1,32))),new qe(30,16,48,14,22,new nt(28,new Je(1,49)))]}}qe.VERSIONS=qe.buildVersions();class vo{constructor(e){const t=e.getHeight();if(t<8||t>144||t&1)throw new V;this.version=vo.readVersion(e),this.mappingBitMatrix=this.extractDataRegion(e),this.readMappingMatrix=new H(this.mappingBitMatrix.getWidth(),this.mappingBitMatrix.getHeight())}getVersion(){return this.version}static readVersion(e){const t=e.getHeight(),n=e.getWidth();return qe.getVersionForDimensions(t,n)}readCodewords(){const e=new Int8Array(this.version.getTotalCodewords());let t=0,n=4,s=0;const c=this.mappingBitMatrix.getHeight(),d=this.mappingBitMatrix.getWidth();let h=!1,g=!1,_=!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)&&!_)e[t++]=this.readCorner3(c,d)&255,n-=2,s+=2,_=!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,_=h*c,E=new H(_,g);for(let A=0;A<d;++A){const S=A*s;for(let B=0;B<h;++B){const z=B*c;for(let W=0;W<s;++W){const Y=A*(s+2)+1+W,ie=S+W;for(let ue=0;ue<c;++ue){const fe=B*(c+2)+1+ue;if(e.get(fe,Y)){const le=z+ue;E.set(le,ie)}}}}}return E}}class Po{constructor(e,t){this.numDataCodewords=e,this.codewords=t}static getDataBlocks(e,t){const n=t.getECBlocks();let s=0;const c=n.getECBlocks();for(let W of c)s+=W.getCount();const d=new Array(s);let h=0;for(let W of c)for(let Y=0;Y<W.getCount();Y++){const ie=W.getDataCodewords(),ue=n.getECCodewords()+ie;d[h++]=new Po(ie,new Uint8Array(ue))}const _=d[0].codewords.length-n.getECCodewords(),E=_-1;let A=0;for(let W=0;W<E;W++)for(let Y=0;Y<h;Y++)d[Y].codewords[W]=e[A++];const S=t.getVersionNumber()===24,B=S?8:h;for(let W=0;W<B;W++)d[W].codewords[_-1]=e[A++];const z=d[0].codewords.length;for(let W=_;W<z;W++)for(let Y=0;Y<h;Y++){const ie=S?(Y+8)%h:Y,ue=S&&ie>7?W-1:W;d[ie].codewords[ue]=e[A++]}if(A!==e.length)throw new y;return d}getNumDataCodewords(){return this.numDataCodewords}getCodewords(){return this.codewords}}class Lo{constructor(e){this.bytes=e,this.byteOffset=0,this.bitOffset=0}getBitOffset(){return this.bitOffset}getByteOffset(){return this.byteOffset}readBits(e){if(e<1||e>32||e>this.available())throw new y(""+e);let t=0,n=this.bitOffset,s=this.byteOffset;const c=this.bytes;if(n>0){const d=8-n,h=e<d?e:d,g=d-h,_=255>>8-h<<g;t=(c[s]&_)>>g,e-=h,n+=h,n===8&&(n=0,s++)}if(e>0){for(;e>=8;)t=t<<8|c[s]&255,s++,e-=8;if(e>0){const d=8-e,h=255>>d<<d;t=t<<e|(c[s]&h)>>d,n+=e}}return this.bitOffset=n,this.byteOffset=s,t}available(){return 8*(this.bytes.length-this.byteOffset)-this.bitOffset}}var vt;(function(b){b[b.PAD_ENCODE=0]="PAD_ENCODE",b[b.ASCII_ENCODE=1]="ASCII_ENCODE",b[b.C40_ENCODE=2]="C40_ENCODE",b[b.TEXT_ENCODE=3]="TEXT_ENCODE",b[b.ANSIX12_ENCODE=4]="ANSIX12_ENCODE",b[b.EDIFACT_ENCODE=5]="EDIFACT_ENCODE",b[b.BASE256_ENCODE=6]="BASE256_ENCODE"})(vt||(vt={}));class $n{static decode(e){const t=new Lo(e),n=new X,s=new X,c=new Array;let d=vt.ASCII_ENCODE;do if(d===vt.ASCII_ENCODE)d=this.decodeAsciiSegment(t,n,s);else{switch(d){case vt.C40_ENCODE:this.decodeC40Segment(t,n);break;case vt.TEXT_ENCODE:this.decodeTextSegment(t,n);break;case vt.ANSIX12_ENCODE:this.decodeAnsiX12Segment(t,n);break;case vt.EDIFACT_ENCODE:this.decodeEdifactSegment(t,n);break;case vt.BASE256_ENCODE:this.decodeBase256Segment(t,n,c);break;default:throw new V}d=vt.ASCII_ENCODE}while(d!==vt.PAD_ENCODE&&t.available()>0);return s.length()>0&&n.append(s.toString()),new et(e,n.toString(),c.length===0?null:c,null)}static decodeAsciiSegment(e,t,n){let s=!1;do{let c=e.readBits(8);if(c===0)throw new V;if(c<=128)return s&&(c+=128),t.append(String.fromCharCode(c-1)),vt.ASCII_ENCODE;if(c===129)return vt.PAD_ENCODE;if(c<=229){const d=c-130;d<10&&t.append("0"),t.append(""+d)}else switch(c){case 230:return vt.C40_ENCODE;case 231:return vt.BASE256_ENCODE;case 232:t.append("");break;case 233:case 234:break;case 235:s=!0;break;case 236:t.append("[)>05"),n.insert(0,"");break;case 237:t.append("[)>06"),n.insert(0,"");break;case 238:return vt.ANSIX12_ENCODE;case 239:return vt.TEXT_ENCODE;case 240:return vt.EDIFACT_ENCODE;case 241:break;default:if(c!==254||e.available()!==0)throw new V;break}}while(e.available()>0);return vt.ASCII_ENCODE}static decodeC40Segment(e,t){let n=!1;const s=[];let c=0;do{if(e.available()===8)return;const d=e.readBits(8);if(d===254)return;this.parseTwoBytes(d,e.readBits(8),s);for(let h=0;h<3;h++){const g=s[h];switch(c){case 0:if(g<3)c=g+1;else if(g<this.C40_BASIC_SET_CHARS.length){const _=this.C40_BASIC_SET_CHARS[g];n?(t.append(String.fromCharCode(_.charCodeAt(0)+128)),n=!1):t.append(_)}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 _=this.C40_SHIFT2_SET_CHARS[g];n?(t.append(String.fromCharCode(_.charCodeAt(0)+128)),n=!1):t.append(_)}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 _=this.TEXT_BASIC_SET_CHARS[g];n?(t.append(String.fromCharCode(_.charCodeAt(0)+128)),n=!1):t.append(_)}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 _=this.TEXT_SHIFT2_SET_CHARS[g];n?(t.append(String.fromCharCode(_.charCodeAt(0)+128)),n=!1):t.append(_)}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 _=this.TEXT_SHIFT3_SET_CHARS[g];n?(t.append(String.fromCharCode(_.charCodeAt(0)+128)),n=!1):t.append(_),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(Q.decode(h,ee.ISO88591))}catch(g){throw new Ue("Platform does not support required encoding: "+g.message)}}static unrandomize255State(e,t){const n=149*t%255+1,s=e-n;return s>=0?s:s+256}}$n.C40_BASIC_SET_CHARS=["*","*","*"," ","0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],$n.C40_SHIFT2_SET_CHARS=["!",'"',"#","$","%","&","'","(",")","*","+",",","-",".","/",":",";","<","=",">","?","@","[","\\","]","^","_"],$n.TEXT_BASIC_SET_CHARS=["*","*","*"," ","0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"],$n.TEXT_SHIFT2_SET_CHARS=$n.C40_SHIFT2_SET_CHARS,$n.TEXT_SHIFT3_SET_CHARS=["`","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","{","|","}","~",""];class xg{constructor(){this.rsDecoder=new It(Me.DATA_MATRIX_FIELD_256)}decode(e){const t=new vo(e),n=t.getVersion(),s=t.readCodewords(),c=Po.getDataBlocks(s,n);let d=0;for(let _ of c)d+=_.getNumDataCodewords();const h=new Uint8Array(d),g=c.length;for(let _=0;_<g;_++){const E=c[_],A=E.getCodewords(),S=E.getNumDataCodewords();this.correctErrors(A,S);for(let B=0;B<S;B++)h[B*g+_]=A[B]}return $n.decode(h)}correctErrors(e,t){const n=new Int32Array(e);try{this.rsDecoder.decode(n,e.length-t)}catch{throw new O}for(let s=0;s<t;s++)e[s]=n[s]}}class Bt{constructor(e){this.image=e,this.rectangleDetector=new Dt(this.image)}detect(){const e=this.rectangleDetector.detect();let t=this.detectSolid1(e);if(t=this.detectSolid2(t),t[3]=this.correctTopRight(t),!t[3])throw new I;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 _=Bt.sampleGrid(this.image,n,s,c,d,h,g);return new br(_,[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 ye(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 ye(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),_=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>_&&(A[0]=s,A[1]=c,A[2]=t,A[3]=n),A}detectSolid2(e){let t=e[0],n=e[1],s=e[2],c=e[3],d=this.transitionsBetween(t,c),h=Bt.shiftPoint(n,s,(d+1)*4),g=Bt.shiftPoint(s,n,(d+1)*4),_=this.transitionsBetween(h,t),E=this.transitionsBetween(g,c);return _<E?(e[0]=t,e[1]=n,e[2]=s,e[3]=c):(e[0]=n,e[1]=s,e[2]=c,e[3]=t),e}correctTopRight(e){let t=e[0],n=e[1],s=e[2],c=e[3],d=this.transitionsBetween(t,c),h=this.transitionsBetween(n,c),g=Bt.shiftPoint(t,n,(h+1)*4),_=Bt.shiftPoint(s,n,(d+1)*4);d=this.transitionsBetween(g,c),h=this.transitionsBetween(_,c);let E=new ye(c.getX()+(s.getX()-n.getX())/(d+1),c.getY()+(s.getY()-n.getY())/(d+1)),A=new ye(c.getX()+(t.getX()-n.getX())/(h+1),c.getY()+(t.getY()-n.getY())/(h+1));if(!this.isValid(E))return this.isValid(A)?A:null;if(!this.isValid(A))return E;let S=this.transitionsBetween(g,E)+this.transitionsBetween(_,E),B=this.transitionsBetween(g,A)+this.transitionsBetween(_,A);return S>B?E:A}shiftToModuleCenter(e){let t=e[0],n=e[1],s=e[2],c=e[3],d=this.transitionsBetween(t,c)+1,h=this.transitionsBetween(s,c)+1,g=Bt.shiftPoint(t,n,h*4),_=Bt.shiftPoint(s,n,d*4);d=this.transitionsBetween(g,c)+1,h=this.transitionsBetween(_,c)+1,(d&1)===1&&(d+=1),(h&1)===1&&(h+=1);let E=(t.getX()+n.getX()+s.getX()+c.getX())/4,A=(t.getY()+n.getY()+s.getY()+c.getY())/4;t=Bt.moveAway(t,E,A),n=Bt.moveAway(n,E,A),s=Bt.moveAway(s,E,A),c=Bt.moveAway(c,E,A);let S,B;return g=Bt.shiftPoint(t,n,h*4),g=Bt.shiftPoint(g,c,d*4),S=Bt.shiftPoint(n,t,h*4),S=Bt.shiftPoint(S,s,d*4),_=Bt.shiftPoint(s,c,h*4),_=Bt.shiftPoint(_,n,d*4),B=Bt.shiftPoint(c,s,h*4),B=Bt.shiftPoint(B,t,d*4),[g,S,_,B]}isValid(e){return e.getX()>=0&&e.getX()<this.image.getWidth()&&e.getY()>0&&e.getY()<this.image.getHeight()}static sampleGrid(e,t,n,s,c,d,h){return Rn.getInstance().sampleGrid(e,d,h,.5,.5,d-.5,.5,d-.5,h-.5,.5,h-.5,t.getX(),t.getY(),c.getX(),c.getY(),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 W=n;n=s,s=W,W=c,c=d,d=W}let g=Math.abs(c-n),_=Math.abs(d-s),E=-g/2,A=s<d?1:-1,S=n<c?1:-1,B=0,z=this.image.get(h?s:n,h?n:s);for(let W=n,Y=s;W!==c;W+=S){let ie=this.image.get(h?Y:W,h?W:Y);if(ie!==z&&(B++,z=ie),E+=_,E>0){if(Y===d)break;Y+=A,E-=g}}return B}}class jn{constructor(){this.decoder=new xg}decode(e,t=null){let n,s;if(t!=null&&t.has(Z.PURE_BARCODE)){const _=jn.extractPureBits(e.getBlackMatrix());n=this.decoder.decode(_),s=jn.NO_POINTS}else{const _=new Bt(e.getBlackMatrix()).detect();n=this.decoder.decode(_.getBits()),s=_.getPoints()}const c=n.getRawBytes(),d=new ge(n.getText(),c,8*c.length,s,xe.DATA_MATRIX,v.currentTimeMillis()),h=n.getByteSegments();h!=null&&d.putMetadata(be.BYTE_SEGMENTS,h);const g=n.getECLevel();return g!=null&&d.putMetadata(be.ERROR_CORRECTION_LEVEL,g),d}reset(){}static extractPureBits(e){const t=e.getTopLeftOnBit(),n=e.getBottomRightOnBit();if(t==null||n==null)throw new I;const s=this.moduleSize(t,e);let c=t[1];const d=n[1];let h=t[0];const _=(n[0]-h+1)/s,E=(d-c+1)/s;if(_<=0||E<=0)throw new I;const A=s/2;c+=A,h+=A;const S=new H(_,E);for(let B=0;B<E;B++){const z=c+B*s;for(let W=0;W<_;W++)e.get(h+W*s,z)&&S.set(W,B)}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 I;const d=s-e[0];if(d===0)throw new I;return d}}jn.NO_POINTS=[];class wg extends Ce{constructor(e=500){super(new jn,e)}}var kr;(function(b){b[b.L=0]="L",b[b.M=1]="M",b[b.Q=2]="Q",b[b.H=3]="H"})(kr||(kr={}));class mt{constructor(e,t,n){this.value=e,this.stringValue=t,this.bits=n,mt.FOR_BITS.set(n,this),mt.FOR_VALUE.set(e,this)}getValue(){return this.value}getBits(){return this.bits}static fromString(e){switch(e){case"L":return mt.L;case"M":return mt.M;case"Q":return mt.Q;case"H":return mt.H;default:throw new C(e+"not available")}}toString(){return this.stringValue}equals(e){if(!(e instanceof mt))return!1;const t=e;return this.value===t.value}static forBits(e){if(e<0||e>=mt.FOR_BITS.size)throw new y;return mt.FOR_BITS.get(e)}}mt.FOR_BITS=new Map,mt.FOR_VALUE=new Map,mt.L=new mt(kr.L,"L",1),mt.M=new mt(kr.M,"M",0),mt.Q=new mt(kr.Q,"Q",3),mt.H=new mt(kr.H,"H",2);class $t{constructor(e){this.errorCorrectionLevel=mt.forBits(e>>3&3),this.dataMask=e&7}static numBitsDiffering(e,t){return R.bitCount(e^t)}static decodeFormatInformation(e,t){const n=$t.doDecodeFormatInformation(e,t);return n!==null?n:$t.doDecodeFormatInformation(e^$t.FORMAT_INFO_MASK_QR,t^$t.FORMAT_INFO_MASK_QR)}static doDecodeFormatInformation(e,t){let n=Number.MAX_SAFE_INTEGER,s=0;for(const c of $t.FORMAT_INFO_DECODE_LOOKUP){const d=c[0];if(d===e||d===t)return new $t(c[1]);let h=$t.numBitsDiffering(e,d);h<n&&(s=c[1],n=h),e!==t&&(h=$t.numBitsDiffering(t,d),h<n&&(s=c[1],n=h))}return n<=3?new $t(s):null}getErrorCorrectionLevel(){return this.errorCorrectionLevel}getDataMask(){return this.dataMask}hashCode(){return this.errorCorrectionLevel.getBits()<<3|this.dataMask}equals(e){if(!(e instanceof $t))return!1;const t=e;return this.errorCorrectionLevel===t.errorCorrectionLevel&&this.dataMask===t.dataMask}}$t.FORMAT_INFO_MASK_QR=21522,$t.FORMAT_INFO_DECODE_LOOKUP=[Int32Array.from([21522,0]),Int32Array.from([20773,1]),Int32Array.from([24188,2]),Int32Array.from([23371,3]),Int32Array.from([17913,4]),Int32Array.from([16590,5]),Int32Array.from([20375,6]),Int32Array.from([19104,7]),Int32Array.from([30660,8]),Int32Array.from([29427,9]),Int32Array.from([32170,10]),Int32Array.from([30877,11]),Int32Array.from([26159,12]),Int32Array.from([25368,13]),Int32Array.from([27713,14]),Int32Array.from([26998,15]),Int32Array.from([5769,16]),Int32Array.from([5054,17]),Int32Array.from([7399,18]),Int32Array.from([6608,19]),Int32Array.from([1890,20]),Int32Array.from([597,21]),Int32Array.from([3340,22]),Int32Array.from([2107,23]),Int32Array.from([13663,24]),Int32Array.from([12392,25]),Int32Array.from([16177,26]),Int32Array.from([14854,27]),Int32Array.from([9396,28]),Int32Array.from([8579,29]),Int32Array.from([11994,30]),Int32Array.from([11245,31])];class J{constructor(e,...t){this.ecCodewordsPerBlock=e,this.ecBlocks=t}getECCodewordsPerBlock(){return this.ecCodewordsPerBlock}getNumBlocks(){let e=0;const t=this.ecBlocks;for(const n of t)e+=n.getCount();return e}getTotalECCodewords(){return this.ecCodewordsPerBlock*this.getNumBlocks()}getECBlocks(){return this.ecBlocks}}class k{constructor(e,t){this.count=e,this.dataCodewords=t}getCount(){return this.count}getDataCodewords(){return this.dataCodewords}}class Ne{constructor(e,t,...n){this.versionNumber=e,this.alignmentPatternCenters=t,this.ecBlocks=n;let s=0;const c=n[0].getECCodewordsPerBlock(),d=n[0].getECBlocks();for(const h of d)s+=h.getCount()*(h.getDataCodewords()+c);this.totalCodewords=s}getVersionNumber(){return this.versionNumber}getAlignmentPatternCenters(){return this.alignmentPatternCenters}getTotalCodewords(){return this.totalCodewords}getDimensionForVersion(){return 17+4*this.versionNumber}getECBlocksForLevel(e){return this.ecBlocks[e.getValue()]}static getProvisionalVersionForDimension(e){if(e%4!==1)throw new V;try{return this.getVersionForNumber((e-17)/4)}catch{throw new V}}static getVersionForNumber(e){if(e<1||e>40)throw new y;return Ne.VERSIONS[e-1]}static decodeVersionInformation(e){let t=Number.MAX_SAFE_INTEGER,n=0;for(let s=0;s<Ne.VERSION_DECODE_INFO.length;s++){const c=Ne.VERSION_DECODE_INFO[s];if(c===e)return Ne.getVersionForNumber(s+7);const d=$t.numBitsDiffering(e,c);d<t&&(n=s+7,t=d)}return t<=3?Ne.getVersionForNumber(n):null}buildFunctionPattern(){const e=this.getDimensionForVersion(),t=new H(e);t.setRegion(0,0,9,9),t.setRegion(e-8,0,8,9),t.setRegion(0,e-8,9,8);const n=this.alignmentPatternCenters.length;for(let s=0;s<n;s++){const c=this.alignmentPatternCenters[s]-2;for(let d=0;d<n;d++)s===0&&(d===0||d===n-1)||s===n-1&&d===0||t.setRegion(this.alignmentPatternCenters[d]-2,c,5,5)}return t.setRegion(6,9,1,e-17),t.setRegion(9,6,e-17,1),this.versionNumber>6&&(t.setRegion(e-11,0,3,6),t.setRegion(0,e-11,6,3)),t}toString(){return""+this.versionNumber}}Ne.VERSION_DECODE_INFO=Int32Array.from([31892,34236,39577,42195,48118,51042,55367,58893,63784,68472,70749,76311,79154,84390,87683,92361,96236,102084,102881,110507,110734,117786,119615,126325,127568,133589,136944,141498,145311,150283,152622,158308,161089,167017]),Ne.VERSIONS=[new Ne(1,new Int32Array(0),new J(7,new k(1,19)),new J(10,new k(1,16)),new J(13,new k(1,13)),new J(17,new k(1,9))),new Ne(2,Int32Array.from([6,18]),new J(10,new k(1,34)),new J(16,new k(1,28)),new J(22,new k(1,22)),new J(28,new k(1,16))),new Ne(3,Int32Array.from([6,22]),new J(15,new k(1,55)),new J(26,new k(1,44)),new J(18,new k(2,17)),new J(22,new k(2,13))),new Ne(4,Int32Array.from([6,26]),new J(20,new k(1,80)),new J(18,new k(2,32)),new J(26,new k(2,24)),new J(16,new k(4,9))),new Ne(5,Int32Array.from([6,30]),new J(26,new k(1,108)),new J(24,new k(2,43)),new J(18,new k(2,15),new k(2,16)),new J(22,new k(2,11),new k(2,12))),new Ne(6,Int32Array.from([6,34]),new J(18,new k(2,68)),new J(16,new k(4,27)),new J(24,new k(4,19)),new J(28,new k(4,15))),new Ne(7,Int32Array.from([6,22,38]),new J(20,new k(2,78)),new J(18,new k(4,31)),new J(18,new k(2,14),new k(4,15)),new J(26,new k(4,13),new k(1,14))),new Ne(8,Int32Array.from([6,24,42]),new J(24,new k(2,97)),new J(22,new k(2,38),new k(2,39)),new J(22,new k(4,18),new k(2,19)),new J(26,new k(4,14),new k(2,15))),new Ne(9,Int32Array.from([6,26,46]),new J(30,new k(2,116)),new J(22,new k(3,36),new k(2,37)),new J(20,new k(4,16),new k(4,17)),new J(24,new k(4,12),new k(4,13))),new Ne(10,Int32Array.from([6,28,50]),new J(18,new k(2,68),new k(2,69)),new J(26,new k(4,43),new k(1,44)),new J(24,new k(6,19),new k(2,20)),new J(28,new k(6,15),new k(2,16))),new Ne(11,Int32Array.from([6,30,54]),new J(20,new k(4,81)),new J(30,new k(1,50),new k(4,51)),new J(28,new k(4,22),new k(4,23)),new J(24,new k(3,12),new k(8,13))),new Ne(12,Int32Array.from([6,32,58]),new J(24,new k(2,92),new k(2,93)),new J(22,new k(6,36),new k(2,37)),new J(26,new k(4,20),new k(6,21)),new J(28,new k(7,14),new k(4,15))),new Ne(13,Int32Array.from([6,34,62]),new J(26,new k(4,107)),new J(22,new k(8,37),new k(1,38)),new J(24,new k(8,20),new k(4,21)),new J(22,new k(12,11),new k(4,12))),new Ne(14,Int32Array.from([6,26,46,66]),new J(30,new k(3,115),new k(1,116)),new J(24,new k(4,40),new k(5,41)),new J(20,new k(11,16),new k(5,17)),new J(24,new k(11,12),new k(5,13))),new Ne(15,Int32Array.from([6,26,48,70]),new J(22,new k(5,87),new k(1,88)),new J(24,new k(5,41),new k(5,42)),new J(30,new k(5,24),new k(7,25)),new J(24,new k(11,12),new k(7,13))),new Ne(16,Int32Array.from([6,26,50,74]),new J(24,new k(5,98),new k(1,99)),new J(28,new k(7,45),new k(3,46)),new J(24,new k(15,19),new k(2,20)),new J(30,new k(3,15),new k(13,16))),new Ne(17,Int32Array.from([6,30,54,78]),new J(28,new k(1,107),new k(5,108)),new J(28,new k(10,46),new k(1,47)),new J(28,new k(1,22),new k(15,23)),new J(28,new k(2,14),new k(17,15))),new Ne(18,Int32Array.from([6,30,56,82]),new J(30,new k(5,120),new k(1,121)),new J(26,new k(9,43),new k(4,44)),new J(28,new k(17,22),new k(1,23)),new J(28,new k(2,14),new k(19,15))),new Ne(19,Int32Array.from([6,30,58,86]),new J(28,new k(3,113),new k(4,114)),new J(26,new k(3,44),new k(11,45)),new J(26,new k(17,21),new k(4,22)),new J(26,new k(9,13),new k(16,14))),new Ne(20,Int32Array.from([6,34,62,90]),new J(28,new k(3,107),new k(5,108)),new J(26,new k(3,41),new k(13,42)),new J(30,new k(15,24),new k(5,25)),new J(28,new k(15,15),new k(10,16))),new Ne(21,Int32Array.from([6,28,50,72,94]),new J(28,new k(4,116),new k(4,117)),new J(26,new k(17,42)),new J(28,new k(17,22),new k(6,23)),new J(30,new k(19,16),new k(6,17))),new Ne(22,Int32Array.from([6,26,50,74,98]),new J(28,new k(2,111),new k(7,112)),new J(28,new k(17,46)),new J(30,new k(7,24),new k(16,25)),new J(24,new k(34,13))),new Ne(23,Int32Array.from([6,30,54,78,102]),new J(30,new k(4,121),new k(5,122)),new J(28,new k(4,47),new k(14,48)),new J(30,new k(11,24),new k(14,25)),new J(30,new k(16,15),new k(14,16))),new Ne(24,Int32Array.from([6,28,54,80,106]),new J(30,new k(6,117),new k(4,118)),new J(28,new k(6,45),new k(14,46)),new J(30,new k(11,24),new k(16,25)),new J(30,new k(30,16),new k(2,17))),new Ne(25,Int32Array.from([6,32,58,84,110]),new J(26,new k(8,106),new k(4,107)),new J(28,new k(8,47),new k(13,48)),new J(30,new k(7,24),new k(22,25)),new J(30,new k(22,15),new k(13,16))),new Ne(26,Int32Array.from([6,30,58,86,114]),new J(28,new k(10,114),new k(2,115)),new J(28,new k(19,46),new k(4,47)),new J(28,new k(28,22),new k(6,23)),new J(30,new k(33,16),new k(4,17))),new Ne(27,Int32Array.from([6,34,62,90,118]),new J(30,new k(8,122),new k(4,123)),new J(28,new k(22,45),new k(3,46)),new J(30,new k(8,23),new k(26,24)),new J(30,new k(12,15),new k(28,16))),new Ne(28,Int32Array.from([6,26,50,74,98,122]),new J(30,new k(3,117),new k(10,118)),new J(28,new k(3,45),new k(23,46)),new J(30,new k(4,24),new k(31,25)),new J(30,new k(11,15),new k(31,16))),new Ne(29,Int32Array.from([6,30,54,78,102,126]),new J(30,new k(7,116),new k(7,117)),new J(28,new k(21,45),new k(7,46)),new J(30,new k(1,23),new k(37,24)),new J(30,new k(19,15),new k(26,16))),new Ne(30,Int32Array.from([6,26,52,78,104,130]),new J(30,new k(5,115),new k(10,116)),new J(28,new k(19,47),new k(10,48)),new J(30,new k(15,24),new k(25,25)),new J(30,new k(23,15),new k(25,16))),new Ne(31,Int32Array.from([6,30,56,82,108,134]),new J(30,new k(13,115),new k(3,116)),new J(28,new k(2,46),new k(29,47)),new J(30,new k(42,24),new k(1,25)),new J(30,new k(23,15),new k(28,16))),new Ne(32,Int32Array.from([6,34,60,86,112,138]),new J(30,new k(17,115)),new J(28,new k(10,46),new k(23,47)),new J(30,new k(10,24),new k(35,25)),new J(30,new k(19,15),new k(35,16))),new Ne(33,Int32Array.from([6,30,58,86,114,142]),new J(30,new k(17,115),new k(1,116)),new J(28,new k(14,46),new k(21,47)),new J(30,new k(29,24),new k(19,25)),new J(30,new k(11,15),new k(46,16))),new Ne(34,Int32Array.from([6,34,62,90,118,146]),new J(30,new k(13,115),new k(6,116)),new J(28,new k(14,46),new k(23,47)),new J(30,new k(44,24),new k(7,25)),new J(30,new k(59,16),new k(1,17))),new Ne(35,Int32Array.from([6,30,54,78,102,126,150]),new J(30,new k(12,121),new k(7,122)),new J(28,new k(12,47),new k(26,48)),new J(30,new k(39,24),new k(14,25)),new J(30,new k(22,15),new k(41,16))),new Ne(36,Int32Array.from([6,24,50,76,102,128,154]),new J(30,new k(6,121),new k(14,122)),new J(28,new k(6,47),new k(34,48)),new J(30,new k(46,24),new k(10,25)),new J(30,new k(2,15),new k(64,16))),new Ne(37,Int32Array.from([6,28,54,80,106,132,158]),new J(30,new k(17,122),new k(4,123)),new J(28,new k(29,46),new k(14,47)),new J(30,new k(49,24),new k(10,25)),new J(30,new k(24,15),new k(46,16))),new Ne(38,Int32Array.from([6,32,58,84,110,136,162]),new J(30,new k(4,122),new k(18,123)),new J(28,new k(13,46),new k(32,47)),new J(30,new k(48,24),new k(14,25)),new J(30,new k(42,15),new k(32,16))),new Ne(39,Int32Array.from([6,26,54,82,110,138,166]),new J(30,new k(20,117),new k(4,118)),new J(28,new k(40,47),new k(7,48)),new J(30,new k(43,24),new k(22,25)),new J(30,new k(10,15),new k(67,16))),new Ne(40,Int32Array.from([6,30,58,86,114,142,170]),new J(30,new k(19,118),new k(6,119)),new J(28,new k(18,47),new k(31,48)),new J(30,new k(34,24),new k(34,25)),new J(30,new k(20,15),new k(61,16)))];var Ft;(function(b){b[b.DATA_MASK_000=0]="DATA_MASK_000",b[b.DATA_MASK_001=1]="DATA_MASK_001",b[b.DATA_MASK_010=2]="DATA_MASK_010",b[b.DATA_MASK_011=3]="DATA_MASK_011",b[b.DATA_MASK_100=4]="DATA_MASK_100",b[b.DATA_MASK_101=5]="DATA_MASK_101",b[b.DATA_MASK_110=6]="DATA_MASK_110",b[b.DATA_MASK_111=7]="DATA_MASK_111"})(Ft||(Ft={}));class gn{constructor(e,t){this.value=e,this.isMasked=t}unmaskBitMatrix(e,t){for(let n=0;n<t;n++)for(let s=0;s<t;s++)this.isMasked(n,s)&&e.flip(s,n)}}gn.values=new Map([[Ft.DATA_MASK_000,new gn(Ft.DATA_MASK_000,(b,e)=>(b+e&1)===0)],[Ft.DATA_MASK_001,new gn(Ft.DATA_MASK_001,(b,e)=>(b&1)===0)],[Ft.DATA_MASK_010,new gn(Ft.DATA_MASK_010,(b,e)=>e%3===0)],[Ft.DATA_MASK_011,new gn(Ft.DATA_MASK_011,(b,e)=>(b+e)%3===0)],[Ft.DATA_MASK_100,new gn(Ft.DATA_MASK_100,(b,e)=>(Math.floor(b/2)+Math.floor(e/3)&1)===0)],[Ft.DATA_MASK_101,new gn(Ft.DATA_MASK_101,(b,e)=>b*e%6===0)],[Ft.DATA_MASK_110,new gn(Ft.DATA_MASK_110,(b,e)=>b*e%6<3)],[Ft.DATA_MASK_111,new gn(Ft.DATA_MASK_111,(b,e)=>(b+e+b*e%3&1)===0)]]);class _g{constructor(e){const t=e.getHeight();if(t<21||(t&3)!==1)throw new V;this.bitMatrix=e}readFormatInformation(){if(this.parsedFormatInfo!==null&&this.parsedFormatInfo!==void 0)return this.parsedFormatInfo;let e=0;for(let c=0;c<6;c++)e=this.copyBit(c,8,e);e=this.copyBit(7,8,e),e=this.copyBit(8,8,e),e=this.copyBit(8,7,e);for(let c=5;c>=0;c--)e=this.copyBit(8,c,e);const t=this.bitMatrix.getHeight();let n=0;const s=t-7;for(let c=t-1;c>=s;c--)n=this.copyBit(8,c,n);for(let c=t-8;c<t;c++)n=this.copyBit(c,8,n);if(this.parsedFormatInfo=$t.decodeFormatInformation(e,n),this.parsedFormatInfo!==null)return this.parsedFormatInfo;throw new V}readVersion(){if(this.parsedVersion!==null&&this.parsedVersion!==void 0)return this.parsedVersion;const e=this.bitMatrix.getHeight(),t=Math.floor((e-17)/4);if(t<=6)return Ne.getVersionForNumber(t);let n=0;const s=e-11;for(let d=5;d>=0;d--)for(let h=e-9;h>=s;h--)n=this.copyBit(h,d,n);let c=Ne.decodeVersionInformation(n);if(c!==null&&c.getDimensionForVersion()===e)return this.parsedVersion=c,c;n=0;for(let d=5;d>=0;d--)for(let h=e-9;h>=s;h--)n=this.copyBit(d,h,n);if(c=Ne.decodeVersionInformation(n),c!==null&&c.getDimensionForVersion()===e)return this.parsedVersion=c,c;throw new V}copyBit(e,t,n){return(this.isMirror?this.bitMatrix.get(t,e):this.bitMatrix.get(e,t))?n<<1|1:n<<1}readCodewords(){const e=this.readFormatInformation(),t=this.readVersion(),n=gn.values.get(e.getDataMask()),s=this.bitMatrix.getHeight();n.unmaskBitMatrix(this.bitMatrix,s);const c=t.buildFunctionPattern();let d=!0;const h=new Uint8Array(t.getTotalCodewords());let g=0,_=0,E=0;for(let A=s-1;A>0;A-=2){A===6&&A--;for(let S=0;S<s;S++){const B=d?s-1-S:S;for(let z=0;z<2;z++)c.get(A-z,B)||(E++,_<<=1,this.bitMatrix.get(A-z,B)&&(_|=1),E===8&&(h[g++]=_,E=0,_=0))}d=!d}if(g!==t.getTotalCodewords())throw new V;return h}remask(){if(this.parsedFormatInfo===null)return;const e=gn.values[this.parsedFormatInfo.getDataMask()],t=this.bitMatrix.getHeight();e.unmaskBitMatrix(this.bitMatrix,t)}setMirror(e){this.parsedVersion=null,this.parsedFormatInfo=null,this.isMirror=e}mirror(){const e=this.bitMatrix;for(let t=0,n=e.getWidth();t<n;t++)for(let s=t+1,c=e.getHeight();s<c;s++)e.get(t,s)!==e.get(s,t)&&(e.flip(s,t),e.flip(t,s))}}class Fo{constructor(e,t){this.numDataCodewords=e,this.codewords=t}static getDataBlocks(e,t,n){if(e.length!==t.getTotalCodewords())throw new y;const s=t.getECBlocksForLevel(n);let c=0;const d=s.getECBlocks();for(const z of d)c+=z.getCount();const h=new Array(c);let g=0;for(const z of d)for(let W=0;W<z.getCount();W++){const Y=z.getDataCodewords(),ie=s.getECCodewordsPerBlock()+Y;h[g++]=new Fo(Y,new Uint8Array(ie))}const _=h[0].codewords.length;let E=h.length-1;for(;E>=0&&h[E].codewords.length!==_;)E--;E++;const A=_-s.getECCodewordsPerBlock();let S=0;for(let z=0;z<A;z++)for(let W=0;W<g;W++)h[W].codewords[z]=e[S++];for(let z=E;z<g;z++)h[z].codewords[A]=e[S++];const B=h[0].codewords.length;for(let z=A;z<B;z++)for(let W=0;W<g;W++){const Y=W<E?z:z+1;h[W].codewords[Y]=e[S++]}return h}getNumDataCodewords(){return this.numDataCodewords}getCodewords(){return this.codewords}}var pn;(function(b){b[b.TERMINATOR=0]="TERMINATOR",b[b.NUMERIC=1]="NUMERIC",b[b.ALPHANUMERIC=2]="ALPHANUMERIC",b[b.STRUCTURED_APPEND=3]="STRUCTURED_APPEND",b[b.BYTE=4]="BYTE",b[b.ECI=5]="ECI",b[b.KANJI=6]="KANJI",b[b.FNC1_FIRST_POSITION=7]="FNC1_FIRST_POSITION",b[b.FNC1_SECOND_POSITION=8]="FNC1_SECOND_POSITION",b[b.HANZI=9]="HANZI"})(pn||(pn={}));class ke{constructor(e,t,n,s){this.value=e,this.stringValue=t,this.characterCountBitsForVersions=n,this.bits=s,ke.FOR_BITS.set(s,this),ke.FOR_VALUE.set(e,this)}static forBits(e){const t=ke.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 ke))return!1;const t=e;return this.value===t.value}toString(){return this.stringValue}}ke.FOR_BITS=new Map,ke.FOR_VALUE=new Map,ke.TERMINATOR=new ke(pn.TERMINATOR,"TERMINATOR",Int32Array.from([0,0,0]),0),ke.NUMERIC=new ke(pn.NUMERIC,"NUMERIC",Int32Array.from([10,12,14]),1),ke.ALPHANUMERIC=new ke(pn.ALPHANUMERIC,"ALPHANUMERIC",Int32Array.from([9,11,13]),2),ke.STRUCTURED_APPEND=new ke(pn.STRUCTURED_APPEND,"STRUCTURED_APPEND",Int32Array.from([0,0,0]),3),ke.BYTE=new ke(pn.BYTE,"BYTE",Int32Array.from([8,16,16]),4),ke.ECI=new ke(pn.ECI,"ECI",Int32Array.from([0,0,0]),7),ke.KANJI=new ke(pn.KANJI,"KANJI",Int32Array.from([8,10,12]),8),ke.FNC1_FIRST_POSITION=new ke(pn.FNC1_FIRST_POSITION,"FNC1_FIRST_POSITION",Int32Array.from([0,0,0]),5),ke.FNC1_SECOND_POSITION=new ke(pn.FNC1_SECOND_POSITION,"FNC1_SECOND_POSITION",Int32Array.from([0,0,0]),9),ke.HANZI=new ke(pn.HANZI,"HANZI",Int32Array.from([8,10,12]),13);class At{static decode(e,t,n,s){const c=new Lo(e);let d=new X;const h=new Array;let g=-1,_=-1;try{let E=null,A=!1,S;do{if(c.available()<4)S=ke.TERMINATOR;else{const B=c.readBits(4);S=ke.forBits(B)}switch(S){case ke.TERMINATOR:break;case ke.FNC1_FIRST_POSITION:case ke.FNC1_SECOND_POSITION:A=!0;break;case ke.STRUCTURED_APPEND:if(c.available()<16)throw new V;g=c.readBits(8),_=c.readBits(8);break;case ke.ECI:const B=At.parseECIValue(c);if(E=L.getCharacterSetECIByValue(B),E===null)throw new V;break;case ke.HANZI:const z=c.readBits(4),W=c.readBits(S.getCharacterCountBits(t));z===At.GB2312_SUBSET&&At.decodeHanziSegment(c,d,W);break;default:const Y=c.readBits(S.getCharacterCountBits(t));switch(S){case ke.NUMERIC:At.decodeNumericSegment(c,d,Y);break;case ke.ALPHANUMERIC:At.decodeAlphanumericSegment(c,d,Y,A);break;case ke.BYTE:At.decodeByteSegment(c,d,Y,E,h,s);break;case ke.KANJI:At.decodeKanjiSegment(c,d,Y);break;default:throw new V}break}}while(S!==ke.TERMINATOR)}catch{throw new V}return new et(e,d.toString(),h.length===0?null:h,n===null?null:n.toString(),g,_)}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(Q.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(Q.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 _=0;_<n;_++)h[_]=e.readBits(8);let g;s===null?g=ee.guessEncoding(h,d):g=s.getName();try{t.append(Q.decode(h,g))}catch(_){throw new V(_)}c.push(h)}static toAlphaNumericChar(e){if(e>=At.ALPHANUMERIC_CHARS.length)throw new V;return At.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(At.toAlphaNumericChar(Math.floor(d/45))),t.append(At.toAlphaNumericChar(d%45)),n-=2}if(n===1){if(e.available()<6)throw new V;t.append(At.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(At.toAlphaNumericChar(Math.floor(s/100))),t.append(At.toAlphaNumericChar(Math.floor(s/10)%10)),t.append(At.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(At.toAlphaNumericChar(Math.floor(s/10))),t.append(At.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(At.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}}At.ALPHANUMERIC_CHARS="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:",At.GB2312_SUBSET=1;class ja{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 Cg{constructor(){this.rsDecoder=new It(Me.QR_CODE_FIELD_256)}decodeBooleanArray(e,t){return this.decodeBitMatrix(H.parseFromBooleanArray(e),t)}decodeBitMatrix(e,t){const n=new _g(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 ja(!0)),c}catch(c){throw s!==null?s:c}}decodeBitMatrixParser(e,t){const n=e.readVersion(),s=e.readFormatInformation().getErrorCorrectionLevel(),c=e.readCodewords(),d=Fo.getDataBlocks(c,n,s);let h=0;for(const E of d)h+=E.getNumDataCodewords();const g=new Uint8Array(h);let _=0;for(const E of d){const A=E.getCodewords(),S=E.getNumDataCodewords();this.correctErrors(A,S);for(let B=0;B<S;B++)g[_++]=A[B]}return At.decode(g,n,s,t)}correctErrors(e,t){const n=new Int32Array(e);try{this.rsDecoder.decode(n,e.length-t)}catch{throw new O}for(let s=0;s<t;s++)e[s]=n[s]}}class Vo extends ye{constructor(e,t,n){super(e,t),this.estimatedModuleSize=n}aboutEquals(e,t,n){if(Math.abs(t-this.getY())<=e&&Math.abs(n-this.getX())<=e){const s=Math.abs(e-this.estimatedModuleSize);return s<=1||s<=this.estimatedModuleSize}return!1}combineEstimate(e,t,n){const s=(this.getX()+t)/2,c=(this.getY()+e)/2,d=(this.estimatedModuleSize+n)/2;return new Vo(s,c,d)}}class Di{constructor(e,t,n,s,c,d,h){this.image=e,this.startX=t,this.startY=n,this.width=s,this.height=c,this.moduleSize=d,this.resultPointCallback=h,this.possibleCenters=[],this.crossCheckStateCount=new Int32Array(3)}find(){const e=this.startX,t=this.height,n=this.width,s=e+n,c=this.startY+t/2,d=new Int32Array(3),h=this.image;for(let g=0;g<t;g++){const _=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,_);)E++;let A=0;for(;E<s;){if(h.get(E,_))if(A===1)d[1]++;else if(A===2){if(this.foundPatternCross(d)){const S=this.handlePossibleCenter(d,_,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,_,s);if(S!==null)return S}}if(this.possibleCenters.length!==0)return this.possibleCenters[0];throw new I}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 _=h[0]+h[1]+h[2];return 5*Math.abs(_-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 _ of this.possibleCenters)if(_.aboutEquals(h,d,c))return _.combineEstimate(d,c,h);const g=new Vo(c,d,h);this.possibleCenters.push(g),this.resultPointCallback!==null&&this.resultPointCallback!==void 0&&this.resultPointCallback.foundPossibleResultPoint(g)}return null}}class Uo extends ye{constructor(e,t,n,s){super(e,t),this.estimatedModuleSize=n,this.count=s,s===void 0&&(this.count=1)}getEstimatedModuleSize(){return this.estimatedModuleSize}getCount(){return this.count}aboutEquals(e,t,n){if(Math.abs(t-this.getY())<=e&&Math.abs(n-this.getX())<=e){const s=Math.abs(e-this.estimatedModuleSize);return s<=1||s<=this.estimatedModuleSize}return!1}combineEstimate(e,t,n){const s=this.count+1,c=(this.count*this.getX()+t)/s,d=(this.count*this.getY()+e)/s,h=(this.count*this.estimatedModuleSize+n)/s;return new Uo(c,d,h,s)}}class Eg{constructor(e){this.bottomLeft=e[0],this.topLeft=e[1],this.topRight=e[2]}getBottomLeft(){return this.bottomLeft}getTopLeft(){return this.topLeft}getTopRight(){return this.topRight}}class Vt{constructor(e,t){this.image=e,this.resultPointCallback=t,this.possibleCenters=[],this.crossCheckStateCount=new Int32Array(5),this.resultPointCallback=t}getImage(){return this.image}getPossibleCenters(){return this.possibleCenters}find(e){const t=e!=null&&e.get(Z.TRY_HARDER)!==void 0,n=e!=null&&e.get(Z.PURE_BARCODE)!==void 0,s=this.image,c=s.getHeight(),d=s.getWidth();let h=Math.floor(3*c/(4*Vt.MAX_MODULES));(h<Vt.MIN_SKIP||t)&&(h=Vt.MIN_SKIP);let g=!1;const _=new Int32Array(5);for(let A=h-1;A<c&&!g;A+=h){_[0]=0,_[1]=0,_[2]=0,_[3]=0,_[4]=0;let S=0;for(let B=0;B<d;B++)if(s.get(B,A))(S&1)===1&&S++,_[S]++;else if(S&1)_[S]++;else if(S===4)if(Vt.foundPatternCross(_)){if(this.handlePossibleCenter(_,A,B,n)===!0)if(h=2,this.hasSkipped===!0)g=this.haveMultiplyConfirmedCenters();else{const W=this.findRowSkip();W>_[2]&&(A+=W-_[2]-h,B=d-1)}else{_[0]=_[2],_[1]=_[3],_[2]=_[4],_[3]=1,_[4]=0,S=3;continue}S=0,_[0]=0,_[1]=0,_[2]=0,_[3]=0,_[4]=0}else _[0]=_[2],_[1]=_[3],_[2]=_[4],_[3]=1,_[4]=0,S=3;else _[++S]++;Vt.foundPatternCross(_)&&this.handlePossibleCenter(_,A,d,n)===!0&&(h=_[0],this.hasSkipped&&(g=this.haveMultiplyConfirmedCenters()))}const E=this.selectBestPatterns();return ye.orderBestPatterns(E),new Eg(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(),_=h.getWidth();for(d=1;e+d<g&&t+d<_&&h.get(t+d,e+d);)c[2]++,d++;if(e+d>=g||t+d>=_)return!1;for(;e+d<g&&t+d<_&&!h.get(t+d,e+d)&&c[3]<n;)c[3]++,d++;if(e+d>=g||t+d>=_||c[3]>=n)return!1;for(;e+d<g&&t+d<_&&h.get(t+d,e+d)&&c[4]<n;)c[4]++,d++;if(c[4]>=n)return!1;const E=c[0]+c[1]+c[2]+c[3]+c[4];return Math.abs(E-s)<2*s&&Vt.foundPatternCross(c)}crossCheckVertical(e,t,n,s){const c=this.image,d=c.getHeight(),h=this.getCrossCheckStateCount();let g=e;for(;g>=0&&c.get(t,g);)h[2]++,g--;if(g<0)return NaN;for(;g>=0&&!c.get(t,g)&&h[1]<=n;)h[1]++,g--;if(g<0||h[1]>n)return NaN;for(;g>=0&&c.get(t,g)&&h[0]<=n;)h[0]++,g--;if(h[0]>n)return NaN;for(g=e+1;g<d&&c.get(t,g);)h[2]++,g++;if(g===d)return NaN;for(;g<d&&!c.get(t,g)&&h[3]<n;)h[3]++,g++;if(g===d||h[3]>=n)return NaN;for(;g<d&&c.get(t,g)&&h[4]<n;)h[4]++,g++;if(h[4]>=n)return NaN;const _=h[0]+h[1]+h[2]+h[3]+h[4];return 5*Math.abs(_-s)>=2*s?NaN:Vt.foundPatternCross(h)?Vt.centerFromEnd(h,g):NaN}crossCheckHorizontal(e,t,n,s){const c=this.image,d=c.getWidth(),h=this.getCrossCheckStateCount();let g=e;for(;g>=0&&c.get(g,t);)h[2]++,g--;if(g<0)return NaN;for(;g>=0&&!c.get(g,t)&&h[1]<=n;)h[1]++,g--;if(g<0||h[1]>n)return NaN;for(;g>=0&&c.get(g,t)&&h[0]<=n;)h[0]++,g--;if(h[0]>n)return NaN;for(g=e+1;g<d&&c.get(g,t);)h[2]++,g++;if(g===d)return NaN;for(;g<d&&!c.get(g,t)&&h[3]<n;)h[3]++,g++;if(g===d||h[3]>=n)return NaN;for(;g<d&&c.get(g,t)&&h[4]<n;)h[4]++,g++;if(h[4]>=n)return NaN;const _=h[0]+h[1]+h[2]+h[3]+h[4];return 5*Math.abs(_-s)>=s?NaN:Vt.foundPatternCross(h)?Vt.centerFromEnd(h,g):NaN}handlePossibleCenter(e,t,n,s){const c=e[0]+e[1]+e[2]+e[3]+e[4];let d=Vt.centerFromEnd(e,n),h=this.crossCheckVertical(t,Math.floor(d),e[2],c);if(!isNaN(h)&&(d=this.crossCheckHorizontal(Math.floor(d),Math.floor(h),e[2],c),!isNaN(d)&&(!s||this.crossCheckDiagonal(Math.floor(h),Math.floor(d),e[2],c)))){const g=c/7;let _=!1;const E=this.possibleCenters;for(let A=0,S=E.length;A<S;A++){const B=E[A];if(B.aboutEquals(g,h,d)){E[A]=B.combineEstimate(h,d,g),_=!0;break}}if(!_){const A=new Uo(d,h,g);E.push(A),this.resultPointCallback!==null&&this.resultPointCallback!==void 0&&this.resultPointCallback.foundPossibleResultPoint(A)}return!0}return!1}findRowSkip(){if(this.possibleCenters.length<=1)return 0;let t=null;for(const n of this.possibleCenters)if(n.getCount()>=Vt.CENTER_QUORUM)if(t==null)t=n;else return this.hasSkipped=!0,Math.floor((Math.abs(t.getX()-n.getX())-Math.abs(t.getY()-n.getY()))/2);return 0}haveMultiplyConfirmedCenters(){let e=0,t=0;const n=this.possibleCenters.length;for(const d of this.possibleCenters)d.getCount()>=Vt.CENTER_QUORUM&&(e++,t+=d.getEstimatedModuleSize());if(e<3)return!1;const s=t/n;let c=0;for(const d of this.possibleCenters)c+=Math.abs(d.getEstimatedModuleSize()-s);return c<=.05*t}selectBestPatterns(){const e=this.possibleCenters.length;if(e<3)throw new I;const t=this.possibleCenters;let n;if(e>3){let s=0,c=0;for(const g of this.possibleCenters){const _=g.getEstimatedModuleSize();s+=_,c+=_*_}n=s/e;let d=Math.sqrt(c/e-n*n);t.sort((g,_)=>{const E=Math.abs(_.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 _=t[g];Math.abs(_.getEstimatedModuleSize()-n)>h&&(t.splice(g,1),g--)}}if(t.length>3){let s=0;for(const c of t)s+=c.getEstimatedModuleSize();n=s/t.length,t.sort((c,d)=>{if(d.getCount()===c.getCount()){const h=Math.abs(d.getEstimatedModuleSize()-n),g=Math.abs(c.getEstimatedModuleSize()-n);return h<g?1:h>g?-1:0}else return d.getCount()-c.getCount()}),t.splice(3)}return[t[0],t[1],t[2]]}}Vt.CENTER_QUORUM=2,Vt.MIN_SKIP=3,Vt.MAX_MODULES=57;class Zr{constructor(e){this.image=e}getImage(){return this.image}getResultPointCallback(){return this.resultPointCallback}detect(e){this.resultPointCallback=e==null?null:e.get(Z.NEED_RESULT_POINT_CALLBACK);const n=new Vt(this.image,this.resultPointCallback).find(e);return this.processFinderPatternInfo(n)}processFinderPatternInfo(e){const t=e.getTopLeft(),n=e.getTopRight(),s=e.getBottomLeft(),c=this.calculateModuleSize(t,n,s);if(c<1)throw new I("No pattern found in proccess finder.");const d=Zr.computeDimension(t,n,s,c),h=Ne.getProvisionalVersionForDimension(d),g=h.getDimensionForVersion()-7;let _=null;if(h.getAlignmentPatternCenters().length>0){const B=n.getX()-t.getX()+s.getX(),z=n.getY()-t.getY()+s.getY(),W=1-3/g,Y=Math.floor(t.getX()+W*(B-t.getX())),ie=Math.floor(t.getY()+W*(z-t.getY()));for(let ue=4;ue<=16;ue<<=1)try{_=this.findAlignmentInRegion(c,Y,ie,ue);break}catch(fe){if(!(fe instanceof I))throw fe}}const E=Zr.createTransform(t,n,s,_,d),A=Zr.sampleGrid(this.image,E,d);let S;return _===null?S=[s,t,n]:S=[s,t,n,_],new br(A,S)}static createTransform(e,t,n,s,c){const d=c-3.5;let h,g,_,E;return s!==null?(h=s.getX(),g=s.getY(),_=d-3,E=_):(h=t.getX()-e.getX()+n.getX(),g=t.getY()-e.getY()+n.getY(),_=d,E=d),dn.quadrilateralToQuadrilateral(3.5,3.5,d,3.5,_,E,3.5,d,e.getX(),e.getY(),t.getX(),t.getY(),h,g,n.getX(),n.getY())}static sampleGrid(e,t,n){return Rn.getInstance().sampleGridWithTransform(e,n,n,t)}static computeDimension(e,t,n,s){const c=ve.round(ye.distance(e,t)/s),d=ve.round(ye.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 I("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 B=e;e=t,t=B,B=n,n=s,s=B}const d=Math.abs(n-e),h=Math.abs(s-t);let g=-d/2;const _=e<n?1:-1,E=t<s?1:-1;let A=0;const S=n+_;for(let B=e,z=t;B!==S;B+=_){const W=c?z:B,Y=c?B:z;if(A===1===this.image.get(W,Y)){if(A===2)return ve.distance(B,z,e,t);A++}if(g+=h,g>0){if(z===s)break;z+=E,g-=d}}return A===2?ve.distance(n+_,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 I("Alignment top exceeds estimated module size.");const g=Math.max(0,n-c),_=Math.min(this.image.getHeight()-1,n+c);if(_-g<e*3)throw new I("Alignment bottom exceeds estimated module size.");return new Di(this.image,d,g,h-d,_-g,e,this.resultPointCallback).find()}}class qn{constructor(){this.decoder=new Cg}getDecoder(){return this.decoder}decode(e,t){let n,s;if(t!=null&&t.get(Z.PURE_BARCODE)!==void 0){const g=qn.extractPureBits(e.getBlackMatrix());n=this.decoder.decodeBitMatrix(g,t),s=qn.NO_POINTS}else{const g=new Zr(e.getBlackMatrix()).detect(t);n=this.decoder.decodeBitMatrix(g.getBits(),t),s=g.getPoints()}n.getOther()instanceof ja&&n.getOther().applyMirroredCorrection(s);const c=new ge(n.getText(),n.getRawBytes(),void 0,s,xe.QR_CODE,void 0),d=n.getByteSegments();d!==null&&c.putMetadata(be.BYTE_SEGMENTS,d);const h=n.getECLevel();return h!==null&&c.putMetadata(be.ERROR_CORRECTION_LEVEL,h),n.hasStructuredAppend()&&(c.putMetadata(be.STRUCTURED_APPEND_SEQUENCE,n.getStructuredAppendSequenceNumber()),c.putMetadata(be.STRUCTURED_APPEND_PARITY,n.getStructuredAppendParity())),c}reset(){}static extractPureBits(e){const t=e.getTopLeftOnBit(),n=e.getBottomRightOnBit();if(t===null||n===null)throw new I;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 I;if(d-c!==g-h&&(g=h+(d-c),g>=e.getWidth()))throw new I;const _=Math.round((g-h+1)/s),E=Math.round((d-c+1)/s);if(_<=0||E<=0)throw new I;if(E!==_)throw new I;const A=Math.floor(s/2);c+=A,h+=A;const S=h+Math.floor((_-1)*s)-g;if(S>0){if(S>A)throw new I;h-=S}const B=c+Math.floor((E-1)*s)-d;if(B>0){if(B>A)throw new I;c-=B}const z=new H(_,E);for(let W=0;W<E;W++){const Y=c+Math.floor(W*s);for(let ie=0;ie<_;ie++)e.get(h+Math.floor(ie*s),Y)&&z.set(ie,W)}return z}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 I;return(c-e[0])/7}}qn.NO_POINTS=new Array;class Oe{PDF417Common(){}static getBitCountSum(e){return ve.sum(e)}static toIntArray(e){if(e==null||!e.length)return Oe.EMPTY_INT_ARRAY;const t=new Int32Array(e.length);let n=0;for(const s of e)t[n++]=s;return t}static getCodeword(e){const t=M.binarySearch(Oe.SYMBOL_TABLE,e&262143);return t<0?-1:(Oe.CODEWORD_TABLE[t]-1)%Oe.NUMBER_OF_CODEWORDS}}Oe.NUMBER_OF_CODEWORDS=929,Oe.MAX_CODEWORDS_IN_BARCODE=Oe.NUMBER_OF_CODEWORDS-1,Oe.MIN_ROWS_IN_BARCODE=3,Oe.MAX_ROWS_IN_BARCODE=90,Oe.MODULES_IN_CODEWORD=17,Oe.MODULES_IN_STOP_PATTERN=18,Oe.BARS_IN_MODULE=8,Oe.EMPTY_INT_ARRAY=new Int32Array([]),Oe.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]),Oe.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 yg{constructor(e,t){this.bits=e,this.points=t}getBits(){return this.bits}getPoints(){return this.points}}class He{static detectMultiple(e,t,n){let s=e.getBlackMatrix(),c=He.detect(n,s);return c.length||(s=s.clone(),s.rotate180(),c=He.detect(n,s)),new yg(s,c)}static detect(e,t){const n=new Array;let s=0,c=0,d=!1;for(;s<t.getHeight();){const h=He.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+=He.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 He.copyToResult(d,He.findRowsWithPattern(e,s,c,t,n,He.START_PATTERN),He.INDEXES_START_PATTERN),d[4]!=null&&(n=Math.trunc(d[4].getX()),t=Math.trunc(d[4].getY())),He.copyToResult(d,He.findRowsWithPattern(e,s,c,t,n,He.STOP_PATTERN),He.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 _=new Int32Array(d.length);for(;s<t;s+=He.ROW_STEP){let A=He.findGuardPattern(e,c,s,n,!1,d,_);if(A!=null){for(;s>0;){const S=He.findGuardPattern(e,c,--s,n,!1,d,_);if(S!=null)A=S;else{s++;break}}h[0]=new ye(A[0],s),h[1]=new ye(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 B=He.findGuardPattern(e,S[0],E,n,!1,d,_);if(B!=null&&Math.abs(S[0]-B[0])<He.MAX_PATTERN_DRIFT&&Math.abs(S[1]-B[1])<He.MAX_PATTERN_DRIFT)S=B,A=0;else{if(A>He.SKIPPED_ROW_COUNT_MAX)break;A++}}E-=A+1,h[2]=new ye(S[0],E),h[3]=new ye(S[1],E)}return E-s<He.BARCODE_MIN_HEIGHT&&M.fill(h,null),h}static findGuardPattern(e,t,n,s,c,d,h){M.fillWithin(h,0,h.length,0);let g=t,_=0;for(;e.get(g,n)&&g>0&&_++<He.MAX_PIXEL_DRIFT;)g--;let E=g,A=0,S=d.length;for(let B=c;E<s;E++)if(e.get(E,n)!==B)h[A]++;else{if(A===S-1){if(He.patternMatchVariance(h,d,He.MAX_INDIVIDUAL_VARIANCE)<He.MAX_AVG_VARIANCE)return new Int32Array([g,E]);g+=h[0]+h[1],v.arraycopy(h,2,h,0,A-1),h[A-1]=0,h[A]=0,A--}else A++;h[A]=1,B=!B}return A===S-1&&He.patternMatchVariance(h,d,He.MAX_INDIVIDUAL_VARIANCE)<He.MAX_AVG_VARIANCE?new Int32Array([g,E-1]):null}static patternMatchVariance(e,t,n){let s=e.length,c=0,d=0;for(let _=0;_<s;_++)c+=e[_],d+=t[_];if(c<d)return 1/0;let h=c/d;n*=h;let g=0;for(let _=0;_<s;_++){let E=e[_],A=t[_]*h,S=E>A?E-A:A-E;if(S>n)return 1/0;g+=S}return g/c}}He.INDEXES_START_PATTERN=Int32Array.from([0,4,1,5]),He.INDEXES_STOP_PATTERN=Int32Array.from([6,2,7,3]),He.MAX_AVG_VARIANCE=.42,He.MAX_INDIVIDUAL_VARIANCE=.8,He.START_PATTERN=Int32Array.from([8,1,1,1,1,1,1,3]),He.STOP_PATTERN=Int32Array.from([7,1,1,3,1,1,1,2,1]),He.MAX_PIXEL_DRIFT=3,He.MAX_PATTERN_DRIFT=5,He.SKIPPED_ROW_COUNT_MAX=25,He.ROW_STEP=5,He.BARCODE_MIN_HEIGHT=10;class Ht{constructor(e,t){if(t.length===0)throw new y;this.field=e;let n=t.length;if(n>1&&t[0]===0){let 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 Ht(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 Ht?this.multiplyOther(e):this.multiplyScalar(e)}multiplyOther(e){if(!this.field.equals(e.field))throw new y("ModulusPolys do not have same ModulusGF field");if(this.isZero()||e.isZero())return new Ht(this.field,new Int32Array([0]));let t=this.coefficients,n=t.length,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 _=0;_<c;_++)d[h+_]=this.field.add(d[h+_],this.field.multiply(g,s[_]))}return new Ht(this.field,d)}negative(){let e=this.coefficients.length,t=new Int32Array(e);for(let n=0;n<e;n++)t[n]=this.field.subtract(0,this.coefficients[n]);return new Ht(this.field,t)}multiplyScalar(e){if(e===0)return new Ht(this.field,new Int32Array([0]));if(e===1)return this;let t=this.coefficients.length,n=new Int32Array(t);for(let s=0;s<t;s++)n[s]=this.field.multiply(this.coefficients[s],e);return new Ht(this.field,n)}multiplyByMonomial(e,t){if(e<0)throw new y;if(t===0)return new Ht(this.field,new Int32Array([0]));let n=this.coefficients.length,s=new Int32Array(n+e);for(let c=0;c<n;c++)s[c]=this.field.multiply(this.coefficients[c],t);return new Ht(this.field,s)}toString(){let e=new X;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 bg{add(e,t){return(e+t)%this.modulus}subtract(e,t){return(this.modulus+e-t)%this.modulus}exp(e){return this.expTable[e]}log(e){if(e===0)throw new y;return this.logTable[e]}inverse(e){if(e===0)throw new it;return this.expTable[this.modulus-this.logTable[e]-1]}multiply(e,t){return e===0||t===0?0:this.expTable[(this.logTable[e]+this.logTable[t])%(this.modulus-1)]}getSize(){return this.modulus}equals(e){return e===this}}class zo extends bg{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 Ht(this,new Int32Array([0])),this.one=new Ht(this,new Int32Array([1]))}getZero(){return this.zero}getOne(){return this.one}buildMonomial(e,t){if(e<0)throw new y;if(t===0)return this.zero;let n=new Int32Array(e+1);return n[0]=t,new Ht(this,n)}}zo.PDF417_GF=new zo(Oe.NUMBER_OF_CODEWORDS,3);class qa{constructor(){this.field=zo.PDF417_GF}decode(e,t,n){let s=new Ht(this.field,e),c=new Int32Array(t),d=!1;for(let z=t;z>0;z--){let W=s.evaluateAt(this.field.exp(z));c[t-z]=W,W!==0&&(d=!0)}if(!d)return 0;let h=this.field.getOne();if(n!=null)for(const z of n){let W=this.field.exp(e.length-1-z),Y=new Ht(this.field,new Int32Array([this.field.subtract(0,W),1]));h=h.multiply(Y)}let g=new Ht(this.field,c),_=this.runEuclideanAlgorithm(this.field.buildMonomial(t,1),g,t),E=_[0],A=_[1],S=this.findErrorLocations(E),B=this.findErrorMagnitudes(A,E,S);for(let z=0;z<S.length;z++){let W=e.length-1-this.field.log(S[z]);if(W<0)throw O.getChecksumInstance();e[W]=this.field.subtract(e[W],B[z])}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,B=d;if(s=c,d=h,s.isZero())throw O.getChecksumInstance();c=S;let z=this.field.getZero(),W=s.getCoefficient(s.getDegree()),Y=this.field.inverse(W);for(;c.getDegree()>=s.getDegree()&&!c.isZero();){let ie=c.getDegree()-s.getDegree(),ue=this.field.multiply(c.getCoefficient(c.getDegree()),Y);z=z.add(this.field.buildMonomial(ie,ue)),c=c.subtract(s.multiplyByMonomial(ie,ue))}h=z.multiply(d).subtract(B).negative()}let g=h.getCoefficient(0);if(g===0)throw O.getChecksumInstance();let _=this.field.inverse(g),E=h.multiply(_),A=c.multiply(_);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 O.getChecksumInstance();return n}findErrorMagnitudes(e,t,n){let s=t.getDegree(),c=new Int32Array(s);for(let _=1;_<=s;_++)c[s-_]=this.field.multiply(_,t.getCoefficient(_));let d=new Ht(this.field,c),h=n.length,g=new Int32Array(h);for(let _=0;_<h;_++){let E=this.field.inverse(n[_]),A=this.field.subtract(0,e.evaluateAt(E)),S=this.field.inverse(d.evaluateAt(E));g[_]=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 I;d?(t=new ye(0,s.getY()),n=new ye(0,c.getY())):h&&(s=new ye(e.getWidth()-1,t.getY()),c=new ye(e.getWidth()-1,n.getY())),this.image=e,this.topLeft=t,this.bottomLeft=n,this.topRight=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,_=Math.trunc(g.getY()-e);_<0&&(_=0);let E=new ye(g.getX(),_);n?s=E:d=E}if(t>0){let g=n?this.bottomLeft:this.bottomRight,_=Math.trunc(g.getY()+t);_>=this.image.getHeight()&&(_=this.image.getHeight()-1);let E=new ye(g.getX(),_);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 Ag{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 Yr{constructor(){this.buffer=""}static form(e,t){let n=-1;function s(d,h,g,_,E,A){if(d==="%%")return"%";if(t[++n]===void 0)return;d=_?parseInt(_.substr(1)):void 0;let S=E?parseInt(E.substr(1)):void 0,B;switch(A){case"s":B=t[n];break;case"c":B=t[n][0];break;case"f":B=parseFloat(t[n]).toFixed(d);break;case"p":B=parseFloat(t[n]).toPrecision(d);break;case"e":B=parseFloat(t[n]).toExponential(d);break;case"x":B=parseInt(t[n]).toString(S||16);break;case"d":B=parseFloat(parseInt(t[n],S||10).toPrecision(d)).toFixed(0);break}B=typeof B=="object"?JSON.stringify(B):(+B).toString(S);let z=parseInt(g),W=g&&g[0]+""=="0"?"0":" ";for(;B.length<z;)B=h!==void 0?B+W:W+B;return B}let c=/%(-)?(0?[0-9]+)?([.][0-9]+)?([#][0-9]+)?([scfpexd%])/g;return e.replace(c,s)}format(e,...t){this.buffer+=Yr.form(e,t)}toString(){return this.buffer}}class Kr{constructor(e){this.boundingBox=new cr(e),this.codewords=new Array(e.getMaxY()-e.getMinY()+1)}getCodewordNearby(e){let t=this.getCodeword(e);if(t!=null)return t;for(let n=1;n<Kr.MAX_NEARBY_DISTANCE;n++){let 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 Yr;let t=0;for(const n of this.codewords){if(n==null){e.format("%3d: | %n",t++);continue}e.format("%3d: %3d|%3d%n",t++,n.getRowNumber(),n.getValue())}return e.toString()}}Kr.MAX_NEARBY_DISTANCE=5;class Qr{constructor(){this.values=new Map}setValue(e){e=Math.trunc(e);let t=this.values.get(e);t==null&&(t=0),t++,this.values.set(e,t)}getValue(){let e=-1,t=new Array;for(const[n,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 Oe.toIntArray(t)}getConfidence(e){return this.values.get(e)}}class Za extends Kr{constructor(e,t){super(e),this._isLeft=t}setRowNumbers(){for(let e of this.getCodewords())e!=null&&e.setRowNumberAsRowIndicatorColumn()}adjustCompleteIndicatorColumnRowNumbers(e){let t=this.getCodewords();this.setRowNumbers(),this.removeIncorrectCodewords(t,e);let n=this.getBoundingBox(),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,_=1,E=0;for(let A=d;A<h;A++){if(t[A]==null)continue;let S=t[A],B=S.getRowNumber()-g;if(B===0)E++;else if(B===1)_=Math.max(_,E),E=1,g=S.getRowNumber();else if(B<0||S.getRowNumber()>=e.getRowCount()||B>A)t[A]=null;else{let z;_>2?z=(_-2)*B:z=B;let W=z>=A;for(let Y=1;Y<=z&&!W;Y++)W=t[A-Y]!=null;W?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 _=c;_<d;_++){if(h[_]==null)continue;let E=h[_];E.setRowNumberAsRowIndicatorColumn();let A=E.getRowNumber()-g;A===0||(A===1?g=E.getRowNumber():E.getRowNumber()>=e.getRowCount()?h[_]=null:g=E.getRowNumber())}}getBarcodeMetadata(){let e=this.getCodewords(),t=new Qr,n=new Qr,s=new Qr,c=new Qr;for(let h of e){if(h==null)continue;h.setRowNumberAsRowIndicatorColumn();let g=h.getValue()%30,_=h.getRowNumber();switch(this._isLeft||(_+=2),_%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]<Oe.MIN_ROWS_IN_BARCODE||n.getValue()[0]+s.getValue()[0]>Oe.MAX_ROWS_IN_BARCODE)return null;let d=new Ag(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 Jr{constructor(e,t){this.ADJUST_ROW_NUMBER_SKIP=2,this.barcodeMetadata=e,this.barcodeColumnCount=e.getColumnCount(),this.boundingBox=t,this.detectionResultColumns=new Array(this.barcodeColumnCount+2)}getDetectionResultColumns(){this.adjustIndicatorColumnRowNumbers(this.detectionResultColumns[0]),this.adjustIndicatorColumnRowNumbers(this.detectionResultColumns[this.barcodeColumnCount+1]);let e=Oe.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=Jr.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=Jr.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(Jr.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 Yr;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 ei{constructor(e,t,n,s){this.rowNumber=ei.BARCODE_ROW_UNKNOWN,this.startX=Math.trunc(e),this.endX=Math.trunc(t),this.bucket=Math.trunc(n),this.value=Math.trunc(s)}hasValidRowNumber(){return this.isValidRowNumber(this.rowNumber)}isValidRowNumber(e){return e!==ei.BARCODE_ROW_UNKNOWN&&this.bucket===e%3*3}setRowNumberAsRowIndicatorColumn(){this.rowNumber=Math.trunc(Math.trunc(this.value/30)*3+Math.trunc(this.bucket/3))}getWidth(){return this.endX-this.startX}getStartX(){return this.startX}getEndX(){return this.endX}getBucket(){return this.bucket}getValue(){return this.value}getRowNumber(){return this.rowNumber}setRowNumber(e){this.rowNumber=e}toString(){return this.rowNumber+"|"+this.value}}ei.BARCODE_ROW_UNKNOWN=-1;class nn{static initialize(){for(let e=0;e<Oe.SYMBOL_TABLE.length;e++){let t=Oe.SYMBOL_TABLE[e],n=t&1;for(let s=0;s<Oe.BARS_IN_MODULE;s++){let c=0;for(;(t&1)===n;)c+=1,t>>=1;n=t&1,nn.RATIOS_TABLE[e]||(nn.RATIOS_TABLE[e]=new Array(Oe.BARS_IN_MODULE)),nn.RATIOS_TABLE[e][Oe.BARS_IN_MODULE-s-1]=Math.fround(c/Oe.MODULES_IN_CODEWORD)}}this.bSymbolTableReady=!0}static getDecodedValue(e){let t=nn.getDecodedCodewordValue(nn.sampleBitCounts(e));return t!==-1?t:nn.getClosestDecodedValue(e)}static sampleBitCounts(e){let t=ve.sum(e),n=new Int32Array(Oe.BARS_IN_MODULE),s=0,c=0;for(let d=0;d<Oe.MODULES_IN_CODEWORD;d++){let h=t/(2*Oe.MODULES_IN_CODEWORD)+d*t/Oe.MODULES_IN_CODEWORD;c+e[s]<=h&&(c+=e[s],s++),n[s]++}return n}static getDecodedCodewordValue(e){let t=nn.getBitValue(e);return Oe.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(Oe.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||nn.initialize();for(let d=0;d<nn.RATIOS_TABLE.length;d++){let h=0,g=nn.RATIOS_TABLE[d];for(let _=0;_<Oe.BARS_IN_MODULE;_++){let E=Math.fround(g[_]-n[_]);if(h+=Math.fround(E*E),h>=s)break}h<s&&(s=h,c=Oe.SYMBOL_TABLE[d])}return c}}nn.bSymbolTableReady=!1,nn.RATIOS_TABLE=new Array(Oe.SYMBOL_TABLE.length).map(b=>new Array(Oe.BARS_IN_MODULE));class Ya{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 Ka{static parseLong(e,t=void 0){return parseInt(e,t)}}class Qa extends x{}Qa.kind="NullPointerException";class Sg{writeBytes(e){this.writeBytesOffset(e,0,e.length)}writeBytesOffset(e,t,n){if(e==null)throw new Qa;if(t<0||t>e.length||n<0||t+n>e.length||t+n<0)throw new D;if(n===0)return;for(let s=0;s<n;s++)this.write(e[t+s])}flush(){}close(){}}class Ig extends x{}class Ng extends Sg{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 Ig;n=R.MAX_VALUE}this.buf=M.copyOfUint8Array(this.buf,n)}write(e){this.ensureCapacity(this.count+1),this.buf[this.count]=e,this.count+=1}writeBytesOffset(e,t,n){if(t<0||t>e.length||n<0||t+n-e.length>0)throw new D;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 M.copyOfUint8Array(this.buf,this.count)}size(){return this.count}toString(e){return e?typeof e=="string"?this.toString_string(e):this.toString_number(e):this.toString_void()}toString_void(){return new String(this.buf).toString()}toString_string(e){return new String(this.buf).toString()}toString_number(e){return new String(this.buf).toString()}close(){}}var lt;(function(b){b[b.ALPHA=0]="ALPHA",b[b.LOWER=1]="LOWER",b[b.MIXED=2]="MIXED",b[b.PUNCT=3]="PUNCT",b[b.ALPHA_SHIFT=4]="ALPHA_SHIFT",b[b.PUNCT_SHIFT=5]="PUNCT_SHIFT"})(lt||(lt={}));function Ja(){if(typeof window<"u")return window.BigInt||null;if(typeof wr<"u")return wr.BigInt||null;if(typeof self<"u")return self.BigInt||null;throw new Error("Can't search globals for BigInt!")}let vi;function Zn(b){if(typeof vi>"u"&&(vi=Ja()),vi===null)throw new Error("BigInt is not supported!");return vi(b)}function Tg(){let b=[];b[0]=Zn(1);let e=Zn(900);b[1]=e;for(let t=2;t<16;t++)b[t]=b[t-1]*e;return b}class ne{static decode(e,t){let n=new X(""),s=L.ISO8859_1;n.enableDecoding(s);let c=1,d=e[c++],h=new Ya;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:L.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 et(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(R.parseInt(ne.decodeBase900toBase10(s,ne.NUMBER_OF_SEQUENCE_CODEWORDS)));let c=new X;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 X;t=ne.textCompaction(e,t+1,h),n.setFileName(h.toString());break;case ne.MACRO_PDF417_OPTIONAL_FIELD_SENDER:let g=new X;t=ne.textCompaction(e,t+1,g),n.setSender(g.toString());break;case ne.MACRO_PDF417_OPTIONAL_FIELD_ADDRESSEE:let _=new X;t=ne.textCompaction(e,t+1,_),n.setAddressee(_.toString());break;case ne.MACRO_PDF417_OPTIONAL_FIELD_SEGMENT_COUNT:let E=new X;t=ne.numericCompaction(e,t+1,E),n.setSegmentCount(R.parseInt(E.toString()));break;case ne.MACRO_PDF417_OPTIONAL_FIELD_TIME_STAMP:let A=new X;t=ne.numericCompaction(e,t+1,A),n.setTimestamp(Ka.parseLong(A.toString()));break;case ne.MACRO_PDF417_OPTIONAL_FIELD_CHECKSUM:let S=new X;t=ne.numericCompaction(e,t+1,S),n.setChecksum(R.parseInt(S.toString()));break;case ne.MACRO_PDF417_OPTIONAL_FIELD_FILE_SIZE:let B=new X;t=ne.numericCompaction(e,t+1,B),n.setFileSize(Ka.parseLong(B.toString()));break;default:throw V.getFormatInstance()}break;case ne.MACRO_PDF417_TERMINATOR:t++,n.setLastSegment(!0);break;default:throw V.getFormatInstance()}if(d!==-1){let h=t-d;n.isLastSegment()&&h--,n.setOptionalData(M.copyOfRange(e,d,d+h))}return t}static textCompaction(e,t,n){let s=new Int32Array((e[0]-t)*2),c=new Int32Array((e[0]-t)*2),d=0,h=!1;for(;t<e[0]&&!h;){let g=e[t++];if(g<ne.TEXT_COMPACTION_MODE_LATCH)s[d]=g/30,s[d+1]=g%30,d+=2;else switch(g){case ne.TEXT_COMPACTION_MODE_LATCH:s[d++]=ne.TEXT_COMPACTION_MODE_LATCH;break;case ne.BYTE_COMPACTION_MODE_LATCH:case ne.BYTE_COMPACTION_MODE_LATCH_6:case ne.NUMERIC_COMPACTION_MODE_LATCH:case ne.BEGIN_MACRO_PDF417_CONTROL_BLOCK:case ne.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case ne.MACRO_PDF417_TERMINATOR:t--,h=!0;break;case ne.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:s[d]=ne.MODE_SHIFT_TO_BYTE_COMPACTION_MODE,g=e[t++],c[d]=g,d++;break}}return ne.decodeTextCompaction(s,c,d,n),t}static decodeTextCompaction(e,t,n,s){let c=lt.ALPHA,d=lt.ALPHA,h=0;for(;h<n;){let g=e[h],_="";switch(c){case lt.ALPHA:if(g<26)_=String.fromCharCode(65+g);else switch(g){case 26:_=" ";break;case ne.LL:c=lt.LOWER;break;case ne.ML:c=lt.MIXED;break;case ne.PS:d=c,c=lt.PUNCT_SHIFT;break;case ne.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:s.append(t[h]);break;case ne.TEXT_COMPACTION_MODE_LATCH:c=lt.ALPHA;break}break;case lt.LOWER:if(g<26)_=String.fromCharCode(97+g);else switch(g){case 26:_=" ";break;case ne.AS:d=c,c=lt.ALPHA_SHIFT;break;case ne.ML:c=lt.MIXED;break;case ne.PS:d=c,c=lt.PUNCT_SHIFT;break;case ne.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:s.append(t[h]);break;case ne.TEXT_COMPACTION_MODE_LATCH:c=lt.ALPHA;break}break;case lt.MIXED:if(g<ne.PL)_=ne.MIXED_CHARS[g];else switch(g){case ne.PL:c=lt.PUNCT;break;case 26:_=" ";break;case ne.LL:c=lt.LOWER;break;case ne.AL:c=lt.ALPHA;break;case ne.PS:d=c,c=lt.PUNCT_SHIFT;break;case ne.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:s.append(t[h]);break;case ne.TEXT_COMPACTION_MODE_LATCH:c=lt.ALPHA;break}break;case lt.PUNCT:if(g<ne.PAL)_=ne.PUNCT_CHARS[g];else switch(g){case ne.PAL:c=lt.ALPHA;break;case ne.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:s.append(t[h]);break;case ne.TEXT_COMPACTION_MODE_LATCH:c=lt.ALPHA;break}break;case lt.ALPHA_SHIFT:if(c=d,g<26)_=String.fromCharCode(65+g);else switch(g){case 26:_=" ";break;case ne.TEXT_COMPACTION_MODE_LATCH:c=lt.ALPHA;break}break;case lt.PUNCT_SHIFT:if(c=d,g<ne.PAL)_=ne.PUNCT_CHARS[g];else switch(g){case ne.PAL:c=lt.ALPHA;break;case ne.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:s.append(t[h]);break;case ne.TEXT_COMPACTION_MODE_LATCH:c=lt.ALPHA;break}break}_!==""&&s.append(_),h++}}static byteCompaction(e,t,n,s,c){let d=new Ng,h=0,g=0,_=!1;switch(e){case ne.BYTE_COMPACTION_MODE_LATCH:let E=new Int32Array(6),A=t[s++];for(;s<t[0]&&!_;)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--,_=!0;break;default:if(h%5===0&&h>0){for(let S=0;S<6;++S)d.write(Number(Zn(g)>>Zn(8*(5-S))));g=0,h=0}break}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]&&!_;){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--,_=!0;break}if(h%5===0&&h>0){for(let B=0;B<6;++B)d.write(Number(Zn(g)>>Zn(8*(5-B))));g=0,h=0}}break}return c.append(Q.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=Zn(0);for(let c=0;c<t;c++)n+=ne.EXP900[t-c-1]*Zn(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=Ja()?Tg():[],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),_=null,E=null,A;for(let z=!0;;z=!1){if(t!=null&&(_=We.getRowIndicatorColumn(e,g,t,!0,d,h)),s!=null&&(E=We.getRowIndicatorColumn(e,g,s,!1,d,h)),A=We.merge(_,E),A==null)throw I.getNotFoundInstance();let W=A.getBoundingBox();if(z&&W!=null&&(W.getMinY()<g.getMinY()||W.getMaxY()>g.getMaxY()))g=W;else break}A.setBoundingBox(g);let S=A.getBarcodeColumnCount()+1;A.setDetectionResultColumn(0,_),A.setDetectionResultColumn(S,E);let B=_!=null;for(let z=1;z<=S;z++){let W=B?z:S-z;if(A.getDetectionResultColumn(W)!==void 0)continue;let Y;W===0||W===S?Y=new Za(g,W===0):Y=new Kr(g),A.setDetectionResultColumn(W,Y);let ie=-1,ue=ie;for(let fe=g.getMinY();fe<=g.getMaxY();fe++){if(ie=We.getStartColumn(A,W,fe,B),ie<0||ie>g.getMaxX()){if(ue===-1)continue;ie=ue}let le=We.detectCodeword(e,g.getMinX(),g.getMaxX(),B,ie,fe,d,h);le!=null&&(Y.setCodeword(fe,le),ue=ie,d=Math.min(d,le.getWidth()),h=Math.max(h,le.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 Jr(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 Za(t,s);for(let g=0;g<2;g++){let _=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+=_){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>Oe.MAX_CODEWORDS_IN_BARCODE)throw I.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 _=0;_<e.getBarcodeColumnCount();_++){let E=t[g][_+1].getValue(),A=g*e.getBarcodeColumnCount()+_;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,Oe.toIntArray(n),Oe.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 O))throw g}if(d.length===0)throw O.getChecksumInstance();for(let g=0;g<d.length;g++)if(d[g]<c[g].length-1){d[g]++;break}else if(d[g]=0,g===d.length-1)throw O.getChecksumInstance()}throw O.getChecksumInstance()}static createBarcodeMatrix(e){let t=Array.from({length:e.getBarcodeRowCount()},()=>new Array(e.getBarcodeColumnCount()+2));for(let s=0;s<t.length;s++)for(let c=0;c<t[s].length;c++)t[s][c]=new Qr;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 _=We.getModuleBitCount(e,t,n,s,c,d);if(_==null)return null;let E,A=ve.sum(_);if(s)E=c+A;else{for(let z=0;z<_.length/2;z++){let W=_[z];_[z]=_[_.length-1-z],_[_.length-1-z]=W}E=c,c=E-A}if(!We.checkCodewordSkew(A,h,g))return null;let S=nn.getDecodedValue(_),B=Oe.getCodeword(S);return B===-1?null:new ei(c,E,We.getCodewordBucketNumber(S),B)}static getModuleBitCount(e,t,n,s,c,d){let h=c,g=new Int32Array(8),_=0,E=s?1:-1,A=s;for(;(s?h<n:h>=t)&&_<g.length;)e.get(h,d)===A?(g[_]++,h+=E):(_++,A=!A);return _===g.length||h===(s?n:t)&&_===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 _=0;_<2;_++){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 O.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 Yr;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 qa;class Gt{decode(e,t=null){let n=Gt.decode(e,t,!1);if(n==null||n.length===0||n[0]==null)throw I.getNotFoundInstance();return n[0]}decodeMultiple(e,t=null){try{return Gt.decode(e,t,!0)}catch(n){throw n instanceof V||n instanceof O?I.getNotFoundInstance():n}}static decode(e,t,n){const s=new Array,c=He.detectMultiple(e,t,n);for(const d of c.getPoints()){const h=We.decode(c.getBits(),d[4],d[5],d[6],d[7],Gt.getMinCodewordWidth(d),Gt.getMaxCodewordWidth(d)),g=new ge(h.getText(),h.getRawBytes(),void 0,d,xe.PDF_417);g.putMetadata(be.ERROR_CORRECTION_LEVEL,h.getECLevel());const _=h.getOther();_!=null&&g.putMetadata(be.PDF417_EXTRA_METADATA,_),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?R.MAX_VALUE:Math.trunc(Math.abs(e.getX()-t.getX()))}static getMaxCodewordWidth(e){return Math.floor(Math.max(Math.max(Gt.getMaxWidth(e[0],e[4]),Gt.getMaxWidth(e[6],e[2])*Oe.MODULES_IN_CODEWORD/Oe.MODULES_IN_STOP_PATTERN),Math.max(Gt.getMaxWidth(e[1],e[5]),Gt.getMaxWidth(e[7],e[3])*Oe.MODULES_IN_CODEWORD/Oe.MODULES_IN_STOP_PATTERN)))}static getMinCodewordWidth(e){return Math.floor(Math.min(Math.min(Gt.getMinWidth(e[0],e[4]),Gt.getMinWidth(e[6],e[2])*Oe.MODULES_IN_CODEWORD/Oe.MODULES_IN_STOP_PATTERN),Math.min(Gt.getMinWidth(e[1],e[5]),Gt.getMinWidth(e[7],e[3])*Oe.MODULES_IN_CODEWORD/Oe.MODULES_IN_STOP_PATTERN)))}reset(){}}class Pi extends x{}Pi.kind="ReaderException";class el{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=!i(e)&&e.get(Z.TRY_HARDER)===!0,n=i(e)?null:e.get(Z.POSSIBLE_FORMATS),s=new Array;if(!i(n)){const c=n.some(d=>d===xe.UPC_A||d===xe.UPC_E||d===xe.EAN_13||d===xe.EAN_8||d===xe.CODABAR||d===xe.CODE_39||d===xe.CODE_93||d===xe.CODE_128||d===xe.ITF||d===xe.RSS_14||d===xe.RSS_EXPANDED);c&&!t&&s.push(new Tr(e,this.verbose)),n.includes(xe.QR_CODE)&&s.push(new qn),n.includes(xe.DATA_MATRIX)&&s.push(new jn),n.includes(xe.AZTEC)&&s.push(new Sr),n.includes(xe.PDF_417)&&s.push(new Gt),c&&t&&s.push(new Tr(e,this.verbose))}s.length===0&&(t||s.push(new Tr(e,this.verbose)),s.push(new qn),s.push(new jn),s.push(new Sr),s.push(new Gt),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 I("No MultiFormat Readers were able to detect the code.")}}class kg extends Ce{constructor(e=null,t=500){const n=new el;n.setHints(e),super(n,t)}decodeBitmap(e){return this.reader.decodeWithState(e)}}class Rg extends Ce{constructor(e=500){super(new Gt,e)}}class Bg extends Ce{constructor(e=500){super(new qn,e)}}var Ho;(function(b){b[b.ERROR_CORRECTION=0]="ERROR_CORRECTION",b[b.CHARACTER_SET=1]="CHARACTER_SET",b[b.DATA_MATRIX_SHAPE=2]="DATA_MATRIX_SHAPE",b[b.MIN_SIZE=3]="MIN_SIZE",b[b.MAX_SIZE=4]="MAX_SIZE",b[b.MARGIN=5]="MARGIN",b[b.PDF417_COMPACT=6]="PDF417_COMPACT",b[b.PDF417_COMPACTION=7]="PDF417_COMPACTION",b[b.PDF417_DIMENSIONS=8]="PDF417_DIMENSIONS",b[b.AZTEC_LAYERS=9]="AZTEC_LAYERS",b[b.QR_VERSION=10]="QR_VERSION"})(Ho||(Ho={}));var Pt=Ho;class Go{constructor(e){this.field=e,this.cachedGenerators=[],this.cachedGenerators.push(new Ve(e,Int32Array.from([1])))}buildGenerator(e){const t=this.cachedGenerators;if(e>=t.length){let n=t[t.length-1];const s=this.field;for(let c=t.length;c<=e;c++){const d=n.multiply(new Ve(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 Ve(this.field,c);d=d.multiplyByMonomial(t,1);const g=d.divide(s)[1].getCoefficients(),_=t-g.length;for(let E=0;E<_;E++)e[n+E]=0;v.arraycopy(g,0,e,n+_,g.length)}}class kt{constructor(){}static applyMaskPenaltyRule1(e){return kt.applyMaskPenaltyRule1Internal(e,!0)+kt.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 _=h[g];_===h[g+1]&&_===n[d+1][g]&&_===n[d+1][g+1]&&t++}}return kt.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&&(kt.isWhiteHorizontal(g,h-4,h)||kt.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&&(kt.isWhiteVertical(n,h,d-4,d)||kt.isWhiteVertical(n,h,d+7,d+11))&&t++}return t*kt.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 _=n[g];for(let E=0;E<s;E++)_[E]===1&&t++}const d=e.getHeight()*e.getWidth();return Math.floor(Math.abs(t*2-d)*10/d)*kt.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,_=-1;for(let E=0;E<c;E++){const A=t?d[h][E]:d[E][h];A===_?g++:(g>=5&&(n+=kt.N1+(g-5)),g=1,_=A)}g>=5&&(n+=kt.N1+(g-5))}return n}}kt.N1=3,kt.N2=3,kt.N3=40,kt.N4=10;class Li{constructor(e,t){this.width=e,this.height=t;const n=new Array(t);for(let s=0;s!==t;s++)n[s]=new Uint8Array(e);this.bytes=n}getHeight(){return this.height}getWidth(){return this.width}get(e,t){return this.bytes[t][e]}getArray(){return this.bytes}setNumber(e,t,n){this.bytes[t][e]=n}setBoolean(e,t,n){this.bytes[t][e]=n?1:0}clear(e){for(const t of this.bytes)M.fill(t,e)}equals(e){if(!(e instanceof Li))return!1;const t=e;if(this.width!==t.width||this.height!==t.height)return!1;for(let n=0,s=this.height;n<s;++n){const c=this.bytes[n],d=t.bytes[n];for(let h=0,g=this.width;h<g;++h)if(c[h]!==d[h])return!1}return!0}toString(){const e=new X;for(let t=0,n=this.height;t<n;++t){const s=this.bytes[t];for(let c=0,d=this.width;c<d;++c)switch(s[c]){case 0:e.append(" 0");break;case 1:e.append(" 1");break;default:e.append(" ");break}e.append(`
19
- `)}return e.toString()}}class 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 X;return e.append(`<<
16
+ `,". ",", ",": ","!",'"',"#","$","%","&","'","(",")","*","+",",","-",".","/",":",";","<","=",">","?","[","]","{","}","CTRL_UL"],Qe.DIGIT_TABLE=["CTRL_PS"," ","0","1","2","3","4","5","6","7","8","9",",",".","CTRL_UL","CTRL_US"];class ve{constructor(){}static round(e){return e===NaN?0:e<=Number.MIN_SAFE_INTEGER?Number.MIN_SAFE_INTEGER:e>=Number.MAX_SAFE_INTEGER?Number.MAX_SAFE_INTEGER:e+(e<0?-.5:.5)|0}static distance(e,t,n,o){const c=e-n,d=t-o;return Math.sqrt(c*c+d*d)}static sum(e){let t=0;for(let n=0,o=e.length;n!==o;n++){const c=e[n];t+=c}return t}}class ar{static floatToIntBits(e){return e}}ar.MAX_VALUE=Number.MAX_SAFE_INTEGER;class ye{constructor(e,t){this.x=e,this.y=t}getX(){return this.x}getY(){return this.y}equals(e){if(e instanceof ye){const t=e;return this.x===t.x&&this.y===t.y}return!1}hashCode(){return 31*ar.floatToIntBits(this.x)+ar.floatToIntBits(this.y)}toString(){return"("+this.x+","+this.y+")"}static orderBestPatterns(e){const t=this.distance(e[0],e[1]),n=this.distance(e[1],e[2]),o=this.distance(e[0],e[2]);let c,d,h;if(n>=t&&n>=o?(d=e[0],c=e[1],h=e[2]):o>=n&&o>=t?(d=e[1],c=e[0],h=e[2]):(d=e[2],c=e[0],h=e[1]),this.crossProductZ(c,d,h)<0){const g=c;c=h,h=g}e[0]=c,e[1]=d,e[2]=h}static distance(e,t){return ve.distance(e.x,e.y,t.x,t.y)}static crossProductZ(e,t,n){const o=t.x,c=t.y;return(n.x-o)*(e.y-c)-(n.y-c)*(e.x-o)}}class br{constructor(e,t){this.bits=e,this.points=t}getBits(){return this.bits}getPoints(){return this.points}}class qr extends br{constructor(e,t,n,o,c){super(e,t),this.compact=n,this.nbDatablocks=o,this.nbLayers=c}getNbLayers(){return this.nbLayers}getNbDatablocks(){return this.nbDatablocks}isCompact(){return this.compact}}class Dt{constructor(e,t,n,o){this.image=e,this.height=e.getHeight(),this.width=e.getWidth(),t==null&&(t=Dt.INIT_SIZE),n==null&&(n=e.getWidth()/2|0),o==null&&(o=e.getHeight()/2|0);const c=t/2|0;if(this.leftInit=n-c,this.rightInit=n+c,this.upInit=o-c,this.downInit=o+c,this.upInit<0||this.leftInit<0||this.downInit>=this.height||this.rightInit>=this.width)throw new T}detect(){let e=this.leftInit,t=this.rightInit,n=this.upInit,o=this.downInit,c=!1,d=!0,h=!1,g=!1,w=!1,E=!1,A=!1;const S=this.width,B=this.height;for(;d;){d=!1;let U=!0;for(;(U||!g)&&t<S;)U=this.containsBlackPoint(n,o,t,!1),U?(t++,d=!0,g=!0):g||t++;if(t>=S){c=!0;break}let H=!0;for(;(H||!w)&&o<B;)H=this.containsBlackPoint(e,t,o,!0),H?(o++,d=!0,w=!0):w||o++;if(o>=B){c=!0;break}let K=!0;for(;(K||!E)&&e>=0;)K=this.containsBlackPoint(n,o,e,!1),K?(e--,d=!0,E=!0):E||e--;if(e<0){c=!0;break}let oe=!0;for(;(oe||!A)&&n>=0;)oe=this.containsBlackPoint(e,t,n,!0),oe?(n--,d=!0,A=!0):A||n--;if(n<0){c=!0;break}d&&(h=!0)}if(!c&&h){const U=t-e;let H=null;for(let fe=1;H===null&&fe<U;fe++)H=this.getBlackPointOnSegment(e,o-fe,e+fe,o);if(H==null)throw new T;let K=null;for(let fe=1;K===null&&fe<U;fe++)K=this.getBlackPointOnSegment(e,n+fe,e+fe,n);if(K==null)throw new T;let oe=null;for(let fe=1;oe===null&&fe<U;fe++)oe=this.getBlackPointOnSegment(t,n+fe,t-fe,n);if(oe==null)throw new T;let ue=null;for(let fe=1;ue===null&&fe<U;fe++)ue=this.getBlackPointOnSegment(t,o-fe,t-fe,o);if(ue==null)throw new T;return this.centerEdges(ue,H,oe,K)}else throw new T}getBlackPointOnSegment(e,t,n,o){const c=ve.round(ve.distance(e,t,n,o)),d=(n-e)/c,h=(o-t)/c,g=this.image;for(let w=0;w<c;w++){const E=ve.round(e+w*d),A=ve.round(t+w*h);if(g.get(E,A))return new ye(E,A)}return null}centerEdges(e,t,n,o){const c=e.getX(),d=e.getY(),h=t.getX(),g=t.getY(),w=n.getX(),E=n.getY(),A=o.getX(),S=o.getY(),B=Dt.CORR;return c<this.width/2?[new ye(A-B,S+B),new ye(h+B,g+B),new ye(w-B,E-B),new ye(c+B,d-B)]:[new ye(A+B,S+B),new ye(h+B,g-B),new ye(w-B,E+B),new ye(c-B,d-B)]}containsBlackPoint(e,t,n,o){const c=this.image;if(o){for(let d=e;d<=t;d++)if(c.get(d,n))return!0}else for(let d=e;d<=t;d++)if(c.get(n,d))return!0;return!1}}Dt.INIT_SIZE=10,Dt.CORR=1;class Ar{static checkAndNudgePoints(e,t){const n=e.getWidth(),o=e.getHeight();let c=!0;for(let d=0;d<t.length&&c;d+=2){const h=Math.floor(t[d]),g=Math.floor(t[d+1]);if(h<-1||h>n||g<-1||g>o)throw new T;c=!1,h===-1?(t[d]=0,c=!0):h===n&&(t[d]=n-1,c=!0),g===-1?(t[d+1]=0,c=!0):g===o&&(t[d+1]=o-1,c=!0)}c=!0;for(let d=t.length-2;d>=0&&c;d-=2){const h=Math.floor(t[d]),g=Math.floor(t[d+1]);if(h<-1||h>n||g<-1||g>o)throw new T;c=!1,h===-1?(t[d]=0,c=!0):h===n&&(t[d]=n-1,c=!0),g===-1?(t[d+1]=0,c=!0):g===o&&(t[d+1]=o-1,c=!0)}}}class dn{constructor(e,t,n,o,c,d,h,g,w){this.a11=e,this.a21=t,this.a31=n,this.a12=o,this.a22=c,this.a32=d,this.a13=h,this.a23=g,this.a33=w}static quadrilateralToQuadrilateral(e,t,n,o,c,d,h,g,w,E,A,S,B,U,H,K){const oe=dn.quadrilateralToSquare(e,t,n,o,c,d,h,g);return dn.squareToQuadrilateral(w,E,A,S,B,U,H,K).times(oe)}transformPoints(e){const t=e.length,n=this.a11,o=this.a12,c=this.a13,d=this.a21,h=this.a22,g=this.a23,w=this.a31,E=this.a32,A=this.a33;for(let S=0;S<t;S+=2){const B=e[S],U=e[S+1],H=c*B+g*U+A;e[S]=(n*B+d*U+w)/H,e[S+1]=(o*B+h*U+E)/H}}transformPointsWithValues(e,t){const n=this.a11,o=this.a12,c=this.a13,d=this.a21,h=this.a22,g=this.a23,w=this.a31,E=this.a32,A=this.a33,S=e.length;for(let B=0;B<S;B++){const U=e[B],H=t[B],K=c*U+g*H+A;e[B]=(n*U+d*H+w)/K,t[B]=(o*U+h*H+E)/K}}static squareToQuadrilateral(e,t,n,o,c,d,h,g){const w=e-n+c-h,E=t-o+d-g;if(w===0&&E===0)return new dn(n-e,c-n,e,o-t,d-o,t,0,0,1);{const A=n-c,S=h-c,B=o-d,U=g-d,H=A*U-S*B,K=(w*U-S*E)/H,oe=(A*E-w*B)/H;return new dn(n-e+K*n,h-e+oe*h,e,o-t+K*o,g-t+oe*g,t,K,oe,1)}}static quadrilateralToSquare(e,t,n,o,c,d,h,g){return dn.squareToQuadrilateral(e,t,n,o,c,d,h,g).buildAdjoint()}buildAdjoint(){return new dn(this.a22*this.a33-this.a23*this.a32,this.a23*this.a31-this.a21*this.a33,this.a21*this.a32-this.a22*this.a31,this.a13*this.a32-this.a12*this.a33,this.a11*this.a33-this.a13*this.a31,this.a12*this.a31-this.a11*this.a32,this.a12*this.a23-this.a13*this.a22,this.a13*this.a21-this.a11*this.a23,this.a11*this.a22-this.a12*this.a21)}times(e){return new dn(this.a11*e.a11+this.a21*e.a12+this.a31*e.a13,this.a11*e.a21+this.a21*e.a22+this.a31*e.a23,this.a11*e.a31+this.a21*e.a32+this.a31*e.a33,this.a12*e.a11+this.a22*e.a12+this.a32*e.a13,this.a12*e.a21+this.a22*e.a22+this.a32*e.a23,this.a12*e.a31+this.a22*e.a32+this.a32*e.a33,this.a13*e.a11+this.a23*e.a12+this.a33*e.a13,this.a13*e.a21+this.a23*e.a22+this.a33*e.a23,this.a13*e.a31+this.a23*e.a32+this.a33*e.a33)}}class Ri extends Ar{sampleGrid(e,t,n,o,c,d,h,g,w,E,A,S,B,U,H,K,oe,ue,fe){const le=dn.quadrilateralToQuadrilateral(o,c,d,h,g,w,E,A,S,B,U,H,K,oe,ue,fe);return this.sampleGridWithTransform(e,t,n,le)}sampleGridWithTransform(e,t,n,o){if(t<=0||n<=0)throw new T;const c=new z(t,n),d=new Float32Array(2*t);for(let h=0;h<n;h++){const g=d.length,w=h+.5;for(let E=0;E<g;E+=2)d[E]=E/2+.5,d[E+1]=w;o.transformPoints(d),Ar.checkAndNudgePoints(e,d);try{for(let E=0;E<g;E+=2)e.get(Math.floor(d[E]),Math.floor(d[E+1]))&&c.set(E/2,h)}catch{throw new T}}return c}}class Rn{static setGridSampler(e){Rn.gridSampler=e}static getInstance(){return Rn.gridSampler}}Rn.gridSampler=new Ri;class Ut{constructor(e,t){this.x=e,this.y=t}toResultPoint(){return new ye(this.getX(),this.getY())}getX(){return this.x}getY(){return this.y}}class Bi{constructor(e){this.EXPECTED_CORNER_BITS=new Int32Array([3808,476,2107,1799]),this.image=e}detect(){return this.detectMirror(!1)}detectMirror(e){let t=this.getMatrixCenter(),n=this.getBullsEyeCorners(t);if(e){let d=n[0];n[0]=n[2],n[2]=d}this.extractParameters(n);let o=this.sampleGrid(this.image,n[this.shift%4],n[(this.shift+1)%4],n[(this.shift+2)%4],n[(this.shift+3)%4]),c=this.getMatrixCornerPoints(n);return new qr(o,c,this.compact,this.nbDataBlocks,this.nbLayers)}extractParameters(e){if(!this.isValidPoint(e[0])||!this.isValidPoint(e[1])||!this.isValidPoint(e[2])||!this.isValidPoint(e[3]))throw new T;let t=2*this.nbCenterLayers,n=new Int32Array([this.sampleLine(e[0],e[1],t),this.sampleLine(e[1],e[2],t),this.sampleLine(e[2],e[3],t),this.sampleLine(e[3],e[0],t)]);this.shift=this.getRotation(n,t);let o=0;for(let d=0;d<4;d++){let h=n[(this.shift+d)%4];this.compact?(o<<=7,o+=h>>1&127):(o<<=10,o+=(h>>2&992)+(h>>1&31))}let c=this.getCorrectedParameterData(o,this.compact);this.compact?(this.nbLayers=(c>>6)+1,this.nbDataBlocks=(c&63)+1):(this.nbLayers=(c>>11)+1,this.nbDataBlocks=(c&2047)+1)}getRotation(e,t){let n=0;e.forEach((o,c,d)=>{let h=(o>>t-2<<1)+(o&1);n=(n<<3)+h}),n=((n&1)<<11)+(n>>1);for(let o=0;o<4;o++)if(M.bitCount(n^this.EXPECTED_CORNER_BITS[o])<=2)return o;throw new T}getCorrectedParameterData(e,t){let n,o;t?(n=7,o=2):(n=10,o=4);let c=n-o,d=new Int32Array(n);for(let g=n-1;g>=0;--g)d[g]=e&15,e>>=4;try{new Nt(Me.AZTEC_PARAM).decode(d,c)}catch{throw new T}let h=0;for(let g=0;g<o;g++)h=(h<<4)+d[g];return h}getBullsEyeCorners(e){let t=e,n=e,o=e,c=e,d=!0;for(this.nbCenterLayers=1;this.nbCenterLayers<9;this.nbCenterLayers++){let A=this.getFirstDifferent(t,d,1,-1),S=this.getFirstDifferent(n,d,1,1),B=this.getFirstDifferent(o,d,-1,1),U=this.getFirstDifferent(c,d,-1,-1);if(this.nbCenterLayers>2){let H=this.distancePoint(U,A)*this.nbCenterLayers/(this.distancePoint(c,t)*(this.nbCenterLayers+2));if(H<.75||H>1.25||!this.isWhiteOrBlackRectangle(A,S,B,U))break}t=A,n=S,o=B,c=U,d=!d}if(this.nbCenterLayers!==5&&this.nbCenterLayers!==7)throw new T;this.compact=this.nbCenterLayers===5;let h=new ye(t.getX()+.5,t.getY()-.5),g=new ye(n.getX()+.5,n.getY()+.5),w=new ye(o.getX()-.5,o.getY()+.5),E=new ye(c.getX()-.5,c.getY()-.5);return this.expandSquare([h,g,w,E],2*this.nbCenterLayers-3,2*this.nbCenterLayers)}getMatrixCenter(){let e,t,n,o;try{let h=new Dt(this.image).detect();e=h[0],t=h[1],n=h[2],o=h[3]}catch{let g=this.image.getWidth()/2,w=this.image.getHeight()/2;e=this.getFirstDifferent(new Ut(g+7,w-7),!1,1,-1).toResultPoint(),t=this.getFirstDifferent(new Ut(g+7,w+7),!1,1,1).toResultPoint(),n=this.getFirstDifferent(new Ut(g-7,w+7),!1,-1,1).toResultPoint(),o=this.getFirstDifferent(new Ut(g-7,w-7),!1,-1,-1).toResultPoint()}let c=ve.round((e.getX()+o.getX()+t.getX()+n.getX())/4),d=ve.round((e.getY()+o.getY()+t.getY()+n.getY())/4);try{let h=new Dt(this.image,15,c,d).detect();e=h[0],t=h[1],n=h[2],o=h[3]}catch{e=this.getFirstDifferent(new Ut(c+7,d-7),!1,1,-1).toResultPoint(),t=this.getFirstDifferent(new Ut(c+7,d+7),!1,1,1).toResultPoint(),n=this.getFirstDifferent(new Ut(c-7,d+7),!1,-1,1).toResultPoint(),o=this.getFirstDifferent(new Ut(c-7,d-7),!1,-1,-1).toResultPoint()}return c=ve.round((e.getX()+o.getX()+t.getX()+n.getX())/4),d=ve.round((e.getY()+o.getY()+t.getY()+n.getY())/4),new Ut(c,d)}getMatrixCornerPoints(e){return this.expandSquare(e,2*this.nbCenterLayers,this.getDimension())}sampleGrid(e,t,n,o,c){let d=Rn.getInstance(),h=this.getDimension(),g=h/2-this.nbCenterLayers,w=h/2+this.nbCenterLayers;return d.sampleGrid(e,h,h,g,g,w,g,w,w,g,w,t.getX(),t.getY(),n.getX(),n.getY(),o.getX(),o.getY(),c.getX(),c.getY())}sampleLine(e,t,n){let o=0,c=this.distanceResultPoint(e,t),d=c/n,h=e.getX(),g=e.getY(),w=d*(t.getX()-e.getX())/c,E=d*(t.getY()-e.getY())/c;for(let A=0;A<n;A++)this.image.get(ve.round(h+A*w),ve.round(g+A*E))&&(o|=1<<n-A-1);return o}isWhiteOrBlackRectangle(e,t,n,o){let c=3;e=new Ut(e.getX()-c,e.getY()+c),t=new Ut(t.getX()-c,t.getY()-c),n=new Ut(n.getX()+c,n.getY()-c),o=new Ut(o.getX()+c,o.getY()+c);let d=this.getColor(o,e);if(d===0)return!1;let h=this.getColor(e,t);return h!==d||(h=this.getColor(t,n),h!==d)?!1:(h=this.getColor(n,o),h===d)}getColor(e,t){let n=this.distancePoint(e,t),o=(t.getX()-e.getX())/n,c=(t.getY()-e.getY())/n,d=0,h=e.getX(),g=e.getY(),w=this.image.get(e.getX(),e.getY()),E=Math.ceil(n);for(let S=0;S<E;S++)h+=o,g+=c,this.image.get(ve.round(h),ve.round(g))!==w&&d++;let A=d/n;return A>.1&&A<.9?0:A<=.1===w?1:-1}getFirstDifferent(e,t,n,o){let c=e.getX()+n,d=e.getY()+o;for(;this.isValid(c,d)&&this.image.get(c,d)===t;)c+=n,d+=o;for(c-=n,d-=o;this.isValid(c,d)&&this.image.get(c,d)===t;)c+=n;for(c-=n;this.isValid(c,d)&&this.image.get(c,d)===t;)d+=o;return d-=o,new Ut(c,d)}expandSquare(e,t,n){let o=n/(2*t),c=e[0].getX()-e[2].getX(),d=e[0].getY()-e[2].getY(),h=(e[0].getX()+e[2].getX())/2,g=(e[0].getY()+e[2].getY())/2,w=new ye(h+o*c,g+o*d),E=new ye(h-o*c,g-o*d);c=e[1].getX()-e[3].getX(),d=e[1].getY()-e[3].getY(),h=(e[1].getX()+e[3].getX())/2,g=(e[1].getY()+e[3].getY())/2;let A=new ye(h+o*c,g+o*d),S=new ye(h-o*c,g-o*d);return[w,A,E,S]}isValid(e,t){return e>=0&&e<this.image.getWidth()&&t>0&&t<this.image.getHeight()}isValidPoint(e){let t=ve.round(e.getX()),n=ve.round(e.getY());return this.isValid(t,n)}distancePoint(e,t){return ve.distance(e.getX(),e.getY(),t.getX(),t.getY())}distanceResultPoint(e,t){return ve.distance(e.getX(),e.getY(),t.getX(),t.getY())}getDimension(){return this.compact?4*this.nbLayers+11:this.nbLayers<=4?4*this.nbLayers+15:4*this.nbLayers+2*(M.truncDivision(this.nbLayers-4,8)+1)+15}}class Sr{decode(e,t=null){let n=null,o=new Bi(e.getBlackMatrix()),c=null,d=null;try{let E=o.detectMirror(!1);c=E.getPoints(),this.reportFoundResultPoints(t,c),d=new Qe().decode(E)}catch(E){n=E}if(d==null)try{let E=o.detectMirror(!0);c=E.getPoints(),this.reportFoundResultPoints(t,c),d=new Qe().decode(E)}catch(E){throw n??E}let h=new ge(d.getText(),d.getRawBytes(),d.getNumBits(),c,xe.AZTEC,v.currentTimeMillis()),g=d.getByteSegments();g!=null&&h.putMetadata(be.BYTE_SEGMENTS,g);let w=d.getECLevel();return w!=null&&h.putMetadata(be.ERROR_CORRECTION_LEVEL,w),h}reportFoundResultPoints(e,t){if(e!=null){let n=e.get(Y.NEED_RESULT_POINT_CALLBACK);n!=null&&t.forEach((o,c,d)=>{n.foundPossibleResultPoint(o)})}}reset(){}}class Oo extends Ce{constructor(e=500){super(new Sr,e)}}class ht{decode(e,t){try{return this.doDecode(e,t)}catch{if(t&&t.get(Y.TRY_HARDER)===!0&&e.isRotateSupported()){const c=e.rotateCounterClockwise(),d=this.doDecode(c,t),h=d.getResultMetadata();let g=270;h!==null&&h.get(be.ORIENTATION)===!0&&(g=g+h.get(be.ORIENTATION)%360),d.putMetadata(be.ORIENTATION,g);const w=d.getResultPoints();if(w!==null){const E=c.getHeight();for(let A=0;A<w.length;A++)w[A]=new ye(E-w[A].getY()-1,w[A].getX())}return d}else throw new T}}reset(){}doDecode(e,t){const n=e.getWidth(),o=e.getHeight();let c=new q(n);const d=t&&t.get(Y.TRY_HARDER)===!0,h=Math.max(1,o>>(d?8:5));let g;d?g=o:g=15;const w=Math.trunc(o/2);for(let E=0;E<g;E++){const A=Math.trunc((E+1)/2),S=(E&1)===0,B=w+h*(S?A:-A);if(B<0||B>=o)break;try{c=e.getBlackRow(B,c)}catch{continue}for(let U=0;U<2;U++){if(U===1&&(c.reverse(),t&&t.get(Y.NEED_RESULT_POINT_CALLBACK)===!0)){const H=new Map;t.forEach((K,oe)=>H.set(oe,K)),H.delete(Y.NEED_RESULT_POINT_CALLBACK),t=H}try{const H=this.decodeRow(B,c,t);if(U===1){H.putMetadata(be.ORIENTATION,180);const K=H.getResultPoints();K!==null&&(K[0]=new ye(n-K[0].getX()-1,K[0].getY()),K[1]=new ye(n-K[1].getX()-1,K[1].getY()))}return H}catch{}}}throw new T}static recordPattern(e,t,n){const o=n.length;for(let w=0;w<o;w++)n[w]=0;const c=e.getSize();if(t>=c)throw new T;let d=!e.get(t),h=0,g=t;for(;g<c;){if(e.get(g)!==d)n[h]++;else{if(++h===o)break;n[h]=1,d=!d}g++}if(!(h===o||h===o-1&&g===c))throw new T}static recordPatternInReverse(e,t,n){let o=n.length,c=e.get(t);for(;t>0&&o>=0;)e.get(--t)!==c&&(o--,c=!c);if(o>=0)throw new T;ht.recordPattern(e,t+1,n)}static patternMatchVariance(e,t,n){const o=e.length;let c=0,d=0;for(let w=0;w<o;w++)c+=e[w],d+=t[w];if(c<d)return Number.POSITIVE_INFINITY;const h=c/d;n*=h;let g=0;for(let w=0;w<o;w++){const E=e[w],A=t[w]*h,S=E>A?E-A:A-E;if(S>n)return Number.POSITIVE_INFINITY;g+=S}return g/c}}class me extends ht{static findStartPattern(e){const t=e.getSize(),n=e.getNextSet(0);let o=0,c=Int32Array.from([0,0,0,0,0,0]),d=n,h=!1;const g=6;for(let w=n;w<t;w++)if(e.get(w)!==h)c[o]++;else{if(o===g-1){let E=me.MAX_AVG_VARIANCE,A=-1;for(let S=me.CODE_START_A;S<=me.CODE_START_C;S++){const B=ht.patternMatchVariance(c,me.CODE_PATTERNS[S],me.MAX_INDIVIDUAL_VARIANCE);B<E&&(E=B,A=S)}if(A>=0&&e.isRange(Math.max(0,d-(w-d)/2),d,!1))return Int32Array.from([d,w,A]);d+=c[0]+c[1],c=c.slice(2,c.length-1),c[o-1]=0,c[o]=0,o--}else o++;c[o]=1,h=!h}throw new T}static decodeCode(e,t,n){ht.recordPattern(e,n,t);let o=me.MAX_AVG_VARIANCE,c=-1;for(let d=0;d<me.CODE_PATTERNS.length;d++){const h=me.CODE_PATTERNS[d],g=this.patternMatchVariance(t,h,me.MAX_INDIVIDUAL_VARIANCE);g<o&&(o=g,c=d)}if(c>=0)return c;throw new T}decodeRow(e,t,n){const o=n&&n.get(Y.ASSUME_GS1)===!0,c=me.findStartPattern(t),d=c[2];let h=0;const g=new Uint8Array(20);g[h++]=d;let w;switch(d){case me.CODE_START_A:w=me.CODE_CODE_A;break;case me.CODE_START_B:w=me.CODE_CODE_B;break;case me.CODE_START_C:w=me.CODE_CODE_C;break;default:throw new F}let E=!1,A=!1,S="",B=c[0],U=c[1];const H=Int32Array.from([0,0,0,0,0,0]);let K=0,oe=0,ue=d,fe=0,le=!0,je=!1,Fe=!1;for(;!E;){const Mr=A;switch(A=!1,K=oe,oe=me.decodeCode(t,H,U),g[h++]=oe,oe!==me.CODE_STOP&&(le=!0),oe!==me.CODE_STOP&&(fe++,ue+=fe*oe),B=U,U+=H.reduce(($g,jg)=>$g+jg,0),oe){case me.CODE_START_A:case me.CODE_START_B:case me.CODE_START_C:throw new F}switch(w){case me.CODE_CODE_A:if(oe<64)Fe===je?S+=String.fromCharCode(32+oe):S+=String.fromCharCode(32+oe+128),Fe=!1;else if(oe<96)Fe===je?S+=String.fromCharCode(oe-64):S+=String.fromCharCode(oe+64),Fe=!1;else switch(oe!==me.CODE_STOP&&(le=!1),oe){case me.CODE_FNC_1:o&&(S.length===0?S+="]C1":S+="");break;case me.CODE_FNC_2:case me.CODE_FNC_3:break;case me.CODE_FNC_4_A:!je&&Fe?(je=!0,Fe=!1):je&&Fe?(je=!1,Fe=!1):Fe=!0;break;case me.CODE_SHIFT:A=!0,w=me.CODE_CODE_B;break;case me.CODE_CODE_B:w=me.CODE_CODE_B;break;case me.CODE_CODE_C:w=me.CODE_CODE_C;break;case me.CODE_STOP:E=!0;break}break;case me.CODE_CODE_B:if(oe<96)Fe===je?S+=String.fromCharCode(32+oe):S+=String.fromCharCode(32+oe+128),Fe=!1;else switch(oe!==me.CODE_STOP&&(le=!1),oe){case me.CODE_FNC_1:o&&(S.length===0?S+="]C1":S+="");break;case me.CODE_FNC_2:case me.CODE_FNC_3:break;case me.CODE_FNC_4_B:!je&&Fe?(je=!0,Fe=!1):je&&Fe?(je=!1,Fe=!1):Fe=!0;break;case me.CODE_SHIFT:A=!0,w=me.CODE_CODE_A;break;case me.CODE_CODE_A:w=me.CODE_CODE_A;break;case me.CODE_CODE_C:w=me.CODE_CODE_C;break;case me.CODE_STOP:E=!0;break}break;case me.CODE_CODE_C:if(oe<100)oe<10&&(S+="0"),S+=oe;else switch(oe!==me.CODE_STOP&&(le=!1),oe){case me.CODE_FNC_1:o&&(S.length===0?S+="]C1":S+="");break;case me.CODE_CODE_A:w=me.CODE_CODE_A;break;case me.CODE_CODE_B:w=me.CODE_CODE_B;break;case me.CODE_STOP:E=!0;break}break}Mr&&(w=w===me.CODE_CODE_A?me.CODE_CODE_B:me.CODE_CODE_A)}const rn=U-B;if(U=t.getNextUnset(U),!t.isRange(U,Math.min(t.getSize(),U+(U-B)/2),!1))throw new T;if(ue-=fe*K,ue%103!==K)throw new O;const Sn=S.length;if(Sn===0)throw new T;Sn>0&&le&&(w===me.CODE_CODE_C?S=S.substring(0,Sn-2):S=S.substring(0,Sn-1));const on=(c[1]+c[0])/2,ut=B+rn/2,Wt=g.length,fn=new Uint8Array(Wt);for(let Mr=0;Mr<Wt;Mr++)fn[Mr]=g[Mr];const Or=[new ye(on,e),new ye(ut,e)];return new ge(S,fn,0,Or,xe.CODE_128,new Date().getTime())}}me.CODE_PATTERNS=[Int32Array.from([2,1,2,2,2,2]),Int32Array.from([2,2,2,1,2,2]),Int32Array.from([2,2,2,2,2,1]),Int32Array.from([1,2,1,2,2,3]),Int32Array.from([1,2,1,3,2,2]),Int32Array.from([1,3,1,2,2,2]),Int32Array.from([1,2,2,2,1,3]),Int32Array.from([1,2,2,3,1,2]),Int32Array.from([1,3,2,2,1,2]),Int32Array.from([2,2,1,2,1,3]),Int32Array.from([2,2,1,3,1,2]),Int32Array.from([2,3,1,2,1,2]),Int32Array.from([1,1,2,2,3,2]),Int32Array.from([1,2,2,1,3,2]),Int32Array.from([1,2,2,2,3,1]),Int32Array.from([1,1,3,2,2,2]),Int32Array.from([1,2,3,1,2,2]),Int32Array.from([1,2,3,2,2,1]),Int32Array.from([2,2,3,2,1,1]),Int32Array.from([2,2,1,1,3,2]),Int32Array.from([2,2,1,2,3,1]),Int32Array.from([2,1,3,2,1,2]),Int32Array.from([2,2,3,1,1,2]),Int32Array.from([3,1,2,1,3,1]),Int32Array.from([3,1,1,2,2,2]),Int32Array.from([3,2,1,1,2,2]),Int32Array.from([3,2,1,2,2,1]),Int32Array.from([3,1,2,2,1,2]),Int32Array.from([3,2,2,1,1,2]),Int32Array.from([3,2,2,2,1,1]),Int32Array.from([2,1,2,1,2,3]),Int32Array.from([2,1,2,3,2,1]),Int32Array.from([2,3,2,1,2,1]),Int32Array.from([1,1,1,3,2,3]),Int32Array.from([1,3,1,1,2,3]),Int32Array.from([1,3,1,3,2,1]),Int32Array.from([1,1,2,3,1,3]),Int32Array.from([1,3,2,1,1,3]),Int32Array.from([1,3,2,3,1,1]),Int32Array.from([2,1,1,3,1,3]),Int32Array.from([2,3,1,1,1,3]),Int32Array.from([2,3,1,3,1,1]),Int32Array.from([1,1,2,1,3,3]),Int32Array.from([1,1,2,3,3,1]),Int32Array.from([1,3,2,1,3,1]),Int32Array.from([1,1,3,1,2,3]),Int32Array.from([1,1,3,3,2,1]),Int32Array.from([1,3,3,1,2,1]),Int32Array.from([3,1,3,1,2,1]),Int32Array.from([2,1,1,3,3,1]),Int32Array.from([2,3,1,1,3,1]),Int32Array.from([2,1,3,1,1,3]),Int32Array.from([2,1,3,3,1,1]),Int32Array.from([2,1,3,1,3,1]),Int32Array.from([3,1,1,1,2,3]),Int32Array.from([3,1,1,3,2,1]),Int32Array.from([3,3,1,1,2,1]),Int32Array.from([3,1,2,1,1,3]),Int32Array.from([3,1,2,3,1,1]),Int32Array.from([3,3,2,1,1,1]),Int32Array.from([3,1,4,1,1,1]),Int32Array.from([2,2,1,4,1,1]),Int32Array.from([4,3,1,1,1,1]),Int32Array.from([1,1,1,2,2,4]),Int32Array.from([1,1,1,4,2,2]),Int32Array.from([1,2,1,1,2,4]),Int32Array.from([1,2,1,4,2,1]),Int32Array.from([1,4,1,1,2,2]),Int32Array.from([1,4,1,2,2,1]),Int32Array.from([1,1,2,2,1,4]),Int32Array.from([1,1,2,4,1,2]),Int32Array.from([1,2,2,1,1,4]),Int32Array.from([1,2,2,4,1,1]),Int32Array.from([1,4,2,1,1,2]),Int32Array.from([1,4,2,2,1,1]),Int32Array.from([2,4,1,2,1,1]),Int32Array.from([2,2,1,1,1,4]),Int32Array.from([4,1,3,1,1,1]),Int32Array.from([2,4,1,1,1,2]),Int32Array.from([1,3,4,1,1,1]),Int32Array.from([1,1,1,2,4,2]),Int32Array.from([1,2,1,1,4,2]),Int32Array.from([1,2,1,2,4,1]),Int32Array.from([1,1,4,2,1,2]),Int32Array.from([1,2,4,1,1,2]),Int32Array.from([1,2,4,2,1,1]),Int32Array.from([4,1,1,2,1,2]),Int32Array.from([4,2,1,1,1,2]),Int32Array.from([4,2,1,2,1,1]),Int32Array.from([2,1,2,1,4,1]),Int32Array.from([2,1,4,1,2,1]),Int32Array.from([4,1,2,1,2,1]),Int32Array.from([1,1,1,1,4,3]),Int32Array.from([1,1,1,3,4,1]),Int32Array.from([1,3,1,1,4,1]),Int32Array.from([1,1,4,1,1,3]),Int32Array.from([1,1,4,3,1,1]),Int32Array.from([4,1,1,1,1,3]),Int32Array.from([4,1,1,3,1,1]),Int32Array.from([1,1,3,1,4,1]),Int32Array.from([1,1,4,1,3,1]),Int32Array.from([3,1,1,1,4,1]),Int32Array.from([4,1,1,1,3,1]),Int32Array.from([2,1,1,4,1,2]),Int32Array.from([2,1,1,2,1,4]),Int32Array.from([2,1,1,2,3,2]),Int32Array.from([2,3,3,1,1,1,2])],me.MAX_AVG_VARIANCE=.25,me.MAX_INDIVIDUAL_VARIANCE=.7,me.CODE_SHIFT=98,me.CODE_CODE_C=99,me.CODE_CODE_B=100,me.CODE_CODE_A=101,me.CODE_FNC_1=102,me.CODE_FNC_2=97,me.CODE_FNC_3=96,me.CODE_FNC_4_A=101,me.CODE_FNC_4_B=100,me.CODE_START_A=103,me.CODE_START_B=104,me.CODE_START_C=105,me.CODE_STOP=106;class bt extends ht{constructor(e=!1,t=!1){super(),this.usingCheckDigit=e,this.extendedMode=t,this.decodeRowResult="",this.counters=new Int32Array(9)}decodeRow(e,t,n){let o=this.counters;o.fill(0),this.decodeRowResult="";let c=bt.findAsteriskPattern(t,o),d=t.getNextSet(c[1]),h=t.getSize(),g,w;do{bt.recordPattern(t,d,o);let H=bt.toNarrowWidePattern(o);if(H<0)throw new T;g=bt.patternToChar(H),this.decodeRowResult+=g,w=d;for(let K of o)d+=K;d=t.getNextSet(d)}while(g!=="*");this.decodeRowResult=this.decodeRowResult.substring(0,this.decodeRowResult.length-1);let E=0;for(let H of o)E+=H;let A=d-w-E;if(d!==h&&A*2<E)throw new T;if(this.usingCheckDigit){let H=this.decodeRowResult.length-1,K=0;for(let oe=0;oe<H;oe++)K+=bt.ALPHABET_STRING.indexOf(this.decodeRowResult.charAt(oe));if(this.decodeRowResult.charAt(H)!==bt.ALPHABET_STRING.charAt(K%43))throw new O;this.decodeRowResult=this.decodeRowResult.substring(0,H)}if(this.decodeRowResult.length===0)throw new T;let S;this.extendedMode?S=bt.decodeExtended(this.decodeRowResult):S=this.decodeRowResult;let B=(c[1]+c[0])/2,U=w+E/2;return new ge(S,null,0,[new ye(B,e),new ye(U,e)],xe.CODE_39,new Date().getTime())}static findAsteriskPattern(e,t){let n=e.getSize(),o=e.getNextSet(0),c=0,d=o,h=!1,g=t.length;for(let w=o;w<n;w++)if(e.get(w)!==h)t[c]++;else{if(c===g-1){if(this.toNarrowWidePattern(t)===bt.ASTERISK_ENCODING&&e.isRange(Math.max(0,d-Math.floor((w-d)/2)),d,!1))return[d,w];d+=t[0]+t[1],t.copyWithin(0,2,2+c-1),t[c-1]=0,t[c]=0,c--}else c++;t[c]=1,h=!h}throw new T}static toNarrowWidePattern(e){let t=e.length,n=0,o;do{let c=2147483647;for(let g of e)g<c&&g>n&&(c=g);n=c,o=0;let d=0,h=0;for(let g=0;g<t;g++){let w=e[g];w>n&&(h|=1<<t-1-g,o++,d+=w)}if(o===3){for(let g=0;g<t&&o>0;g++){let w=e[g];if(w>n&&(o--,w*2>=d))return-1}return h}}while(o>3);return-1}static patternToChar(e){for(let t=0;t<bt.CHARACTER_ENCODINGS.length;t++)if(bt.CHARACTER_ENCODINGS[t]===e)return bt.ALPHABET_STRING.charAt(t);if(e===bt.ASTERISK_ENCODING)return"*";throw new T}static decodeExtended(e){let t=e.length,n="";for(let o=0;o<t;o++){let c=e.charAt(o);if(c==="+"||c==="$"||c==="%"||c==="/"){let d=e.charAt(o+1),h="\0";switch(c){case"+":if(d>="A"&&d<="Z")h=String.fromCharCode(d.charCodeAt(0)+32);else throw new F;break;case"$":if(d>="A"&&d<="Z")h=String.fromCharCode(d.charCodeAt(0)-64);else throw new F;break;case"%":if(d>="A"&&d<="E")h=String.fromCharCode(d.charCodeAt(0)-38);else if(d>="F"&&d<="J")h=String.fromCharCode(d.charCodeAt(0)-11);else if(d>="K"&&d<="O")h=String.fromCharCode(d.charCodeAt(0)+16);else if(d>="P"&&d<="T")h=String.fromCharCode(d.charCodeAt(0)+43);else if(d==="U")h="\0";else if(d==="V")h="@";else if(d==="W")h="`";else if(d==="X"||d==="Y"||d==="Z")h="";else throw new F;break;case"/":if(d>="A"&&d<="O")h=String.fromCharCode(d.charCodeAt(0)-32);else if(d==="Z")h=":";else throw new F;break}n+=h,o++}else n+=c}return n}}bt.ALPHABET_STRING="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%",bt.CHARACTER_ENCODINGS=[52,289,97,352,49,304,112,37,292,100,265,73,328,25,280,88,13,268,76,28,259,67,322,19,274,82,7,262,70,22,385,193,448,145,400,208,133,388,196,168,162,138,42],bt.ASTERISK_ENCODING=148;class tt extends ht{constructor(){super(...arguments),this.narrowLineWidth=-1}decodeRow(e,t,n){let o=this.decodeStart(t),c=this.decodeEnd(t),d=new G;tt.decodeMiddle(t,o[1],c[0],d);let h=d.toString(),g=null;n!=null&&(g=n.get(Y.ALLOWED_LENGTHS)),g==null&&(g=tt.DEFAULT_ALLOWED_LENGTHS);let w=h.length,E=!1,A=0;for(let U of g){if(w===U){E=!0;break}U>A&&(A=U)}if(!E&&w>A&&(E=!0),!E)throw new F;const S=[new ye(o[1],e),new ye(c[0],e)];return new ge(h,null,0,S,xe.ITF,new Date().getTime())}static decodeMiddle(e,t,n,o){let c=new Int32Array(10),d=new Int32Array(5),h=new Int32Array(5);for(c.fill(0),d.fill(0),h.fill(0);t<n;){ht.recordPattern(e,t,c);for(let w=0;w<5;w++){let E=2*w;d[w]=c[E],h[w]=c[E+1]}let g=tt.decodeDigit(d);o.append(g.toString()),g=this.decodeDigit(h),o.append(g.toString()),c.forEach(function(w){t+=w})}}decodeStart(e){let t=tt.skipWhiteSpace(e),n=tt.findGuardPattern(e,t,tt.START_PATTERN);return this.narrowLineWidth=(n[1]-n[0])/4,this.validateQuietZone(e,n[0]),n}validateQuietZone(e,t){let n=this.narrowLineWidth*10;n=n<t?n:t;for(let o=t-1;n>0&&o>=0&&!e.get(o);o--)n--;if(n!==0)throw new T}static skipWhiteSpace(e){const t=e.getSize(),n=e.getNextSet(0);if(n===t)throw new T;return n}decodeEnd(e){e.reverse();try{let t=tt.skipWhiteSpace(e),n;try{n=tt.findGuardPattern(e,t,tt.END_PATTERN_REVERSED[0])}catch(c){c instanceof T&&(n=tt.findGuardPattern(e,t,tt.END_PATTERN_REVERSED[1]))}this.validateQuietZone(e,n[0]);let o=n[0];return n[0]=e.getSize()-n[1],n[1]=e.getSize()-o,n}finally{e.reverse()}}static findGuardPattern(e,t,n){let o=n.length,c=new Int32Array(o),d=e.getSize(),h=!1,g=0,w=t;c.fill(0);for(let E=t;E<d;E++)if(e.get(E)!==h)c[g]++;else{if(g===o-1){if(ht.patternMatchVariance(c,n,tt.MAX_INDIVIDUAL_VARIANCE)<tt.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 T}static decodeDigit(e){let t=tt.MAX_AVG_VARIANCE,n=-1,o=tt.PATTERNS.length;for(let c=0;c<o;c++){let d=tt.PATTERNS[c],h=ht.patternMatchVariance(e,d,tt.MAX_INDIVIDUAL_VARIANCE);h<t?(t=h,n=c):h===t&&(n=-1)}if(n>=0)return n%10;throw new T}}tt.PATTERNS=[Int32Array.from([1,1,2,2,1]),Int32Array.from([2,1,1,1,2]),Int32Array.from([1,2,1,1,2]),Int32Array.from([2,2,1,1,1]),Int32Array.from([1,1,2,1,2]),Int32Array.from([2,1,2,1,1]),Int32Array.from([1,2,2,1,1]),Int32Array.from([1,1,1,2,2]),Int32Array.from([2,1,1,2,1]),Int32Array.from([1,2,1,2,1]),Int32Array.from([1,1,3,3,1]),Int32Array.from([3,1,1,1,3]),Int32Array.from([1,3,1,1,3]),Int32Array.from([3,3,1,1,1]),Int32Array.from([1,1,3,1,3]),Int32Array.from([3,1,3,1,1]),Int32Array.from([1,3,3,1,1]),Int32Array.from([1,1,1,3,3]),Int32Array.from([3,1,1,3,1]),Int32Array.from([1,3,1,3,1])],tt.MAX_AVG_VARIANCE=.38,tt.MAX_INDIVIDUAL_VARIANCE=.5,tt.DEFAULT_ALLOWED_LENGTHS=[6,8,10,12,14],tt.START_PATTERN=Int32Array.from([1,1,1,1]),tt.END_PATTERN_REVERSED=[Int32Array.from([1,1,2]),Int32Array.from([1,1,3])];class at extends ht{constructor(){super(...arguments),this.decodeRowStringBuffer=""}static findStartGuardPattern(e){let t=!1,n,o=0,c=Int32Array.from([0,0,0]);for(;!t;){c=Int32Array.from([0,0,0]),n=at.findGuardPattern(e,o,!1,this.START_END_PATTERN,c);let d=n[0];o=n[1];let h=d-(o-d);h>=0&&(t=e.isRange(h,d,!1))}return n}static checkChecksum(e){return at.checkStandardUPCEANChecksum(e)}static checkStandardUPCEANChecksum(e){let t=e.length;if(t===0)return!1;let n=parseInt(e.charAt(t-1),10);return at.getStandardUPCEANChecksum(e.substring(0,t-1))===n}static getStandardUPCEANChecksum(e){let t=e.length,n=0;for(let o=t-1;o>=0;o-=2){let c=e.charAt(o).charCodeAt(0)-48;if(c<0||c>9)throw new F;n+=c}n*=3;for(let o=t-2;o>=0;o-=2){let c=e.charAt(o).charCodeAt(0)-48;if(c<0||c>9)throw new F;n+=c}return(1e3-n)%10}static decodeEnd(e,t){return at.findGuardPattern(e,t,!1,at.START_END_PATTERN,new Int32Array(at.START_END_PATTERN.length).fill(0))}static findGuardPatternWithoutCounters(e,t,n,o){return this.findGuardPattern(e,t,n,o,new Int32Array(o.length))}static findGuardPattern(e,t,n,o,c){let d=e.getSize();t=n?e.getNextUnset(t):e.getNextSet(t);let h=0,g=t,w=o.length,E=n;for(let A=t;A<d;A++)if(e.get(A)!==E)c[h]++;else{if(h===w-1){if(ht.patternMatchVariance(c,o,at.MAX_INDIVIDUAL_VARIANCE)<at.MAX_AVG_VARIANCE)return Int32Array.from([g,A]);g+=c[0]+c[1];let S=c.slice(2,c.length-1);for(let B=0;B<h-1;B++)c[B]=S[B];c[h-1]=0,c[h]=0,h--}else h++;c[h]=1,E=!E}throw new T}static decodeDigit(e,t,n,o){this.recordPattern(e,n,t);let c=this.MAX_AVG_VARIANCE,d=-1,h=o.length;for(let g=0;g<h;g++){let w=o[g],E=ht.patternMatchVariance(t,w,at.MAX_INDIVIDUAL_VARIANCE);E<c&&(c=E,d=g)}if(d>=0)return d;throw new T}}at.MAX_AVG_VARIANCE=.48,at.MAX_INDIVIDUAL_VARIANCE=.7,at.START_END_PATTERN=Int32Array.from([1,1,1]),at.MIDDLE_PATTERN=Int32Array.from([1,1,1,1,1]),at.END_PATTERN=Int32Array.from([1,1,1,1,1,1]),at.L_PATTERNS=[Int32Array.from([3,2,1,1]),Int32Array.from([2,2,2,1]),Int32Array.from([2,1,2,2]),Int32Array.from([1,4,1,1]),Int32Array.from([1,1,3,2]),Int32Array.from([1,2,3,1]),Int32Array.from([1,1,1,4]),Int32Array.from([1,3,1,2]),Int32Array.from([1,2,1,3]),Int32Array.from([3,1,1,2])];class pe{constructor(){this.CHECK_DIGIT_ENCODINGS=[24,20,18,17,12,6,3,10,9,5],this.decodeMiddleCounters=Int32Array.from([0,0,0,0]),this.decodeRowStringBuffer=""}decodeRow(e,t,n){let o=this.decodeRowStringBuffer,c=this.decodeMiddle(t,n,o),d=o.toString(),h=pe.parseExtensionString(d),g=[new ye((n[0]+n[1])/2,e),new ye(c,e)],w=new ge(d,null,0,g,xe.UPC_EAN_EXTENSION,new Date().getTime());return h!=null&&w.putAllMetadata(h),w}decodeMiddle(e,t,n){let o=this.decodeMiddleCounters;o[0]=0,o[1]=0,o[2]=0,o[3]=0;let c=e.getSize(),d=t[1],h=0;for(let w=0;w<5&&d<c;w++){let E=at.decodeDigit(e,o,d,at.L_AND_G_PATTERNS);n+=String.fromCharCode(48+E%10);for(let A of o)d+=A;E>=10&&(h|=1<<4-w),w!==4&&(d=e.getNextSet(d),d=e.getNextUnset(d))}if(n.length!==5)throw new T;let g=this.determineCheckDigit(h);if(pe.extensionChecksum(n.toString())!==g)throw new T;return d}static extensionChecksum(e){let t=e.length,n=0;for(let o=t-2;o>=0;o-=2)n+=e.charAt(o).charCodeAt(0)-48;n*=3;for(let o=t-1;o>=0;o-=2)n+=e.charAt(o).charCodeAt(0)-48;return n*=3,n%10}determineCheckDigit(e){for(let t=0;t<10;t++)if(e===this.CHECK_DIGIT_ENCODINGS[t])return t;throw new T}static parseExtensionString(e){if(e.length!==5)return null;let t=pe.parseExtension5String(e);return t==null?null:new Map([[be.SUGGESTED_PRICE,t]])}static parseExtension5String(e){let t;switch(e.charAt(0)){case"0":t="£";break;case"5":t="$";break;case"9":switch(e){case"90000":return null;case"99991":return"0.00";case"99990":return"Used"}t="";break;default:t="";break}let n=parseInt(e.substring(1)),o=(n/100).toString(),c=n%100,d=c<10?"0"+c:c.toString();return t+o+"."+d}}class se{constructor(){this.decodeMiddleCounters=Int32Array.from([0,0,0,0]),this.decodeRowStringBuffer=""}decodeRow(e,t,n){let o=this.decodeRowStringBuffer,c=this.decodeMiddle(t,n,o),d=o.toString(),h=se.parseExtensionString(d),g=[new ye((n[0]+n[1])/2,e),new ye(c,e)],w=new ge(d,null,0,g,xe.UPC_EAN_EXTENSION,new Date().getTime());return h!=null&&w.putAllMetadata(h),w}decodeMiddle(e,t,n){let o=this.decodeMiddleCounters;o[0]=0,o[1]=0,o[2]=0,o[3]=0;let c=e.getSize(),d=t[1],h=0;for(let g=0;g<2&&d<c;g++){let w=at.decodeDigit(e,o,d,at.L_AND_G_PATTERNS);n+=String.fromCharCode(48+w%10);for(let E of o)d+=E;w>=10&&(h|=1<<1-g),g!==1&&(d=e.getNextSet(d),d=e.getNextUnset(d))}if(n.length!==2)throw new T;if(parseInt(n.toString())%4!==h)throw new T;return d}static parseExtensionString(e){return e.length!==2?null:new Map([[be.ISSUE_NUMBER,parseInt(e)]])}}class $e{static decodeRow(e,t,n){let o=at.findGuardPattern(t,n,!1,this.EXTENSION_START_PATTERN,new Int32Array(this.EXTENSION_START_PATTERN.length).fill(0));try{return new pe().decodeRow(e,t,o)}catch{return new se().decodeRow(e,t,o)}}}$e.EXTENSION_START_PATTERN=Int32Array.from([1,1,2]);class Ae extends at{constructor(){super(),this.decodeRowStringBuffer="",Ae.L_AND_G_PATTERNS=Ae.L_PATTERNS.map(e=>Int32Array.from(e));for(let e=10;e<20;e++){let t=Ae.L_PATTERNS[e-10],n=new Int32Array(t.length);for(let o=0;o<t.length;o++)n[o]=t[t.length-o-1];Ae.L_AND_G_PATTERNS[e]=n}}decodeRow(e,t,n){let o=Ae.findStartGuardPattern(t),c=n==null?null:n.get(Y.NEED_RESULT_POINT_CALLBACK);if(c!=null){const le=new ye((o[0]+o[1])/2,e);c.foundPossibleResultPoint(le)}let d=this.decodeMiddle(t,o,this.decodeRowStringBuffer),h=d.rowOffset,g=d.resultString;if(c!=null){const le=new ye(h,e);c.foundPossibleResultPoint(le)}let w=this.decodeEnd(t,h);if(c!=null){const le=new ye((w[0]+w[1])/2,e);c.foundPossibleResultPoint(le)}let E=w[1],A=E+(E-w[0]);if(A>=t.getSize()||!t.isRange(E,A,!1))throw new T;let S=g.toString();if(S.length<8)throw new F;if(!Ae.checkChecksum(S))throw new O;let B=(o[1]+o[0])/2,U=(w[1]+w[0])/2,H=this.getBarcodeFormat(),K=[new ye(B,e),new ye(U,e)],oe=new ge(S,null,0,K,H,new Date().getTime()),ue=0;try{let le=$e.decodeRow(e,t,w[1]);oe.putMetadata(be.UPC_EAN_EXTENSION,le.getText()),oe.putAllMetadata(le.getResultMetadata()),oe.addResultPoints(le.getResultPoints()),ue=le.getText().length}catch{}let fe=n==null?null:n.get(Y.ALLOWED_EAN_EXTENSIONS);if(fe!=null){let le=!1;for(let je in fe)if(ue.toString()===je){le=!0;break}if(!le)throw new T}return oe}decodeEnd(e,t){return Ae.findGuardPattern(e,t,!1,Ae.START_END_PATTERN,new Int32Array(Ae.START_END_PATTERN.length).fill(0))}static checkChecksum(e){return Ae.checkStandardUPCEANChecksum(e)}static checkStandardUPCEANChecksum(e){let t=e.length;if(t===0)return!1;let n=parseInt(e.charAt(t-1),10);return Ae.getStandardUPCEANChecksum(e.substring(0,t-1))===n}static getStandardUPCEANChecksum(e){let t=e.length,n=0;for(let o=t-1;o>=0;o-=2){let c=e.charAt(o).charCodeAt(0)-48;if(c<0||c>9)throw new F;n+=c}n*=3;for(let o=t-2;o>=0;o-=2){let c=e.charAt(o).charCodeAt(0)-48;if(c<0||c>9)throw new F;n+=c}return(1e3-n)%10}}class zt extends Ae{constructor(){super(),this.decodeMiddleCounters=Int32Array.from([0,0,0,0])}decodeMiddle(e,t,n){let o=this.decodeMiddleCounters;o[0]=0,o[1]=0,o[2]=0,o[3]=0;let c=e.getSize(),d=t[1],h=0;for(let w=0;w<6&&d<c;w++){let E=Ae.decodeDigit(e,o,d,Ae.L_AND_G_PATTERNS);n+=String.fromCharCode(48+E%10);for(let A of o)d+=A;E>=10&&(h|=1<<5-w)}n=zt.determineFirstDigit(n,h),d=Ae.findGuardPattern(e,d,!0,Ae.MIDDLE_PATTERN,new Int32Array(Ae.MIDDLE_PATTERN.length).fill(0))[1];for(let w=0;w<6&&d<c;w++){let E=Ae.decodeDigit(e,o,d,Ae.L_PATTERNS);n+=String.fromCharCode(48+E);for(let A of o)d+=A}return{rowOffset:d,resultString:n}}getBarcodeFormat(){return xe.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 T}}zt.FIRST_DIGIT_ENCODINGS=[0,11,13,14,19,25,28,21,22,26];class An extends Ae{constructor(){super(),this.decodeMiddleCounters=Int32Array.from([0,0,0,0])}decodeMiddle(e,t,n){const o=this.decodeMiddleCounters;o[0]=0,o[1]=0,o[2]=0,o[3]=0;let c=e.getSize(),d=t[1];for(let g=0;g<4&&d<c;g++){let w=Ae.decodeDigit(e,o,d,Ae.L_PATTERNS);n+=String.fromCharCode(48+w);for(let E of o)d+=E}d=Ae.findGuardPattern(e,d,!0,Ae.MIDDLE_PATTERN,new Int32Array(Ae.MIDDLE_PATTERN.length).fill(0))[1];for(let g=0;g<4&&d<c;g++){let w=Ae.decodeDigit(e,o,d,Ae.L_PATTERNS);n+=String.fromCharCode(48+w);for(let E of o)d+=E}return{rowOffset:d,resultString:n}}getBarcodeFormat(){return xe.EAN_8}}class ct extends Ae{constructor(){super(...arguments),this.ean13Reader=new zt}getBarcodeFormat(){return xe.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 ge(t.substring(1),null,null,e.getResultPoints(),xe.UPC_A);return e.getResultMetadata()!=null&&n.putAllMetadata(e.getResultMetadata()),n}else throw new T}reset(){this.ean13Reader.reset()}}class Pe extends Ae{constructor(){super(),this.decodeMiddleCounters=new Int32Array(4)}decodeMiddle(e,t,n){const o=this.decodeMiddleCounters.map(w=>w);o[0]=0,o[1]=0,o[2]=0,o[3]=0;const c=e.getSize();let d=t[1],h=0;for(let w=0;w<6&&d<c;w++){const E=Pe.decodeDigit(e,o,d,Pe.L_AND_G_PATTERNS);n+=String.fromCharCode(48+E%10);for(let A of o)d+=A;E>=10&&(h|=1<<5-w)}let g=Pe.determineNumSysAndCheckDigit(n,h);return{rowOffset:d,resultString:g}}decodeEnd(e,t){return Pe.findGuardPatternWithoutCounters(e,t,!0,Pe.MIDDLE_END_PATTERN)}checkChecksum(e){return Ae.checkChecksum(Pe.convertUPCEtoUPCA(e))}static determineNumSysAndCheckDigit(e,t){for(let n=0;n<=1;n++)for(let o=0;o<10;o++)if(t===this.NUMSYS_AND_CHECK_DIGIT_PATTERNS[n][o]){let c=String.fromCharCode(48+n),d=String.fromCharCode(48+o);return c+e+d}throw T.getNotFoundInstance()}getBarcodeFormat(){return xe.UPC_E}static convertUPCEtoUPCA(e){const t=e.slice(1,7).split("").map(c=>c.charCodeAt(0)),n=new G;n.append(e.charAt(0));let o=t[5];switch(o){case 0:case 1:case 2:n.appendChars(t,0,2),n.append(o),n.append("0000"),n.appendChars(t,2,3);break;case 3:n.appendChars(t,0,3),n.append("00000"),n.appendChars(t,3,2);break;case 4:n.appendChars(t,0,4),n.append("00000"),n.append(t[4]);break;default:n.appendChars(t,0,5),n.append("0000"),n.append(o);break}return e.length>=8&&n.append(e.charAt(7)),n.toString()}}Pe.MIDDLE_END_PATTERN=Int32Array.from([1,1,1,1,1,1]),Pe.NUMSYS_AND_CHECK_DIGIT_PATTERNS=[Int32Array.from([56,52,50,49,44,38,35,42,41,37]),Int32Array.from([7,11,13,14,19,25,28,21,22,26])];class qt extends ht{constructor(e){super();let t=e==null?null:e.get(Y.POSSIBLE_FORMATS),n=[];s(t)?(n.push(new zt),n.push(new ct),n.push(new An),n.push(new Pe)):(t.indexOf(xe.EAN_13)>-1&&n.push(new zt),t.indexOf(xe.UPC_A)>-1&&n.push(new ct),t.indexOf(xe.EAN_8)>-1&&n.push(new An),t.indexOf(xe.UPC_E)>-1&&n.push(new Pe)),this.readers=n}decodeRow(e,t,n){for(let o of this.readers)try{const c=o.decodeRow(e,t,n),d=c.getBarcodeFormat()===xe.EAN_13&&c.getText().charAt(0)==="0",h=n==null?null:n.get(Y.POSSIBLE_FORMATS),g=h==null||h.includes(xe.UPC_A);if(d&&g){const w=c.getRawBytes(),E=new ge(c.getText().substring(1),w,w?w.length:null,c.getResultPoints(),xe.UPC_A);return E.putAllMetadata(c.getResultMetadata()),E}return c}catch{}throw new T}reset(){for(let e of this.readers)e.reset()}}class Ye extends ht{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(ht.patternMatchVariance(e,t[n],Ye.MAX_INDIVIDUAL_VARIANCE)<Ye.MAX_AVG_VARIANCE)return n;throw new T}static count(e){return ve.sum(new Int32Array(e))}static increment(e,t){let n=0,o=t[0];for(let c=1;c<e.length;c++)t[c]>o&&(o=t[c],n=c);e[n]++}static decrement(e,t){let n=0,o=t[0];for(let c=1;c<e.length;c++)t[c]<o&&(o=t[c],n=c);e[n]--}static isFinderPattern(e){let t=e[0]+e[1],n=t+e[2]+e[3],o=t/n;if(o>=Ye.MIN_FINDER_PATTERN_RATIO&&o<=Ye.MAX_FINDER_PATTERN_RATIO){let c=Number.MAX_SAFE_INTEGER,d=Number.MIN_SAFE_INTEGER;for(let h of e)h>d&&(d=h),h<c&&(c=h);return d<10*c}return!1}}Ye.MAX_AVG_VARIANCE=.2,Ye.MAX_INDIVIDUAL_VARIANCE=.45,Ye.MIN_FINDER_PATTERN_RATIO=9.5/12,Ye.MAX_FINDER_PATTERN_RATIO=12.5/14;class Et{constructor(e,t){this.value=e,this.checksumPortion=t}getValue(){return this.value}getChecksumPortion(){return this.checksumPortion}toString(){return this.value+"("+this.checksumPortion+")"}equals(e){if(!(e instanceof Et))return!1;const t=e;return this.value===t.value&&this.checksumPortion===t.checksumPortion}hashCode(){return this.value^this.checksumPortion}}class Tt{constructor(e,t,n,o,c){this.value=e,this.startEnd=t,this.value=e,this.startEnd=t,this.resultPoints=new Array,this.resultPoints.push(new ye(n,c)),this.resultPoints.push(new ye(o,c))}getValue(){return this.value}getStartEnd(){return this.startEnd}getResultPoints(){return this.resultPoints}equals(e){if(!(e instanceof Tt))return!1;const t=e;return this.value===t.value}hashCode(){return this.value}}class pt{constructor(){}static getRSSvalue(e,t,n){let o=0;for(let g of e)o+=g;let c=0,d=0,h=e.length;for(let g=0;g<h-1;g++){let w;for(w=1,d|=1<<g;w<e[g];w++,d&=~(1<<g)){let E=pt.combins(o-w-1,h-g-2);if(n&&d===0&&o-w-(h-g-1)>=h-g-1&&(E-=pt.combins(o-w-(h-g),h-g-2)),h-g-1>1){let A=0;for(let S=o-w-(h-g-2);S>t;S--)A+=pt.combins(o-w-S-1,h-g-3);E-=A*(h-1-g)}else o-w>t&&E--;c+=E}o-=w}return c}static combins(e,t){let n,o;e-t>t?(o=t,n=e-t):(o=e-t,n=t);let c=1,d=1;for(let h=e;h>n;h--)c*=h,d<=o&&(c/=d,d++);for(;d<=o;)c/=d,d++;return c}}class ze{static buildBitArray(e){let t=e.length*2-1;e[e.length-1].getRightChar()==null&&(t-=1);let n=12*t,o=new q(n),c=0,h=e[0].getRightChar().getValue();for(let g=11;g>=0;--g)h&1<<g&&o.set(c),c++;for(let g=1;g<e.length;++g){let w=e[g],E=w.getLeftChar().getValue();for(let A=11;A>=0;--A)E&1<<A&&o.set(c),c++;if(w.getRightChar()!=null){let A=w.getRightChar().getValue();for(let S=11;S>=0;--S)A&1<<S&&o.set(c),c++}}return o}}class un{constructor(e,t){t?this.decodedInformation=null:(this.finished=e,this.decodedInformation=t)}getDecodedInformation(){return this.decodedInformation}isFinished(){return this.finished}}class Wn{constructor(e){this.newPosition=e}getNewPosition(){return this.newPosition}}class Zt extends Wn{constructor(e,t){super(e),this.value=t}getValue(){return this.value}isFNC1(){return this.value===Zt.FNC1}}Zt.FNC1="$";class lr extends Wn{constructor(e,t,n){super(e),n?(this.remaining=!0,this.remainingValue=this.remainingValue):(this.remaining=!1,this.remainingValue=0),this.newString=t}getNewString(){return this.newString}isRemaining(){return this.remaining}getRemainingValue(){return this.remainingValue}}class mn extends Wn{constructor(e,t,n){if(super(e),t<0||t>10||n<0||n>10)throw new F;this.firstDigit=t,this.secondDigit=n}getFirstDigit(){return this.firstDigit}getSecondDigit(){return this.secondDigit}getValue(){return this.firstDigit*10+this.secondDigit}isFirstDigitFNC1(){return this.firstDigit===mn.FNC1}isSecondDigitFNC1(){return this.secondDigit===mn.FNC1}isAnyFNC1(){return this.firstDigit===mn.FNC1||this.secondDigit===mn.FNC1}}mn.FNC1=10;class Ee{constructor(){}static parseFieldsInGeneralPurpose(e){if(!e)return null;if(e.length<2)throw new T;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 T;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 T;let o=e.substring(0,4);for(let c of Ee.FOUR_DIGIT_DATA_LENGTH)if(c[0]===o)return c[1]===Ee.VARIABLE_LENGTH?Ee.processVariableAI(4,c[2],e):Ee.processFixedAI(4,c[1],e);throw new T}static processFixedAI(e,t,n){if(n.length<e)throw new T;let o=n.substring(0,e);if(n.length<e+t)throw new T;let c=n.substring(e,e+t),d=n.substring(e+t),h="("+o+")"+c,g=Ee.parseFieldsInGeneralPurpose(d);return g==null?h:h+g}static processVariableAI(e,t,n){let o=n.substring(0,e),c;n.length<e+t?c=n.length:c=e+t;let d=n.substring(e,c),h=n.substring(c),g="("+o+")"+d,w=Ee.parseFieldsInGeneralPurpose(h);return w==null?g:g+w}}Ee.VARIABLE_LENGTH=[],Ee.TWO_DIGIT_DATA_LENGTH=[["00",18],["01",14],["02",14],["10",Ee.VARIABLE_LENGTH,20],["11",6],["12",6],["13",6],["15",6],["17",6],["20",2],["21",Ee.VARIABLE_LENGTH,20],["22",Ee.VARIABLE_LENGTH,29],["30",Ee.VARIABLE_LENGTH,8],["37",Ee.VARIABLE_LENGTH,8],["90",Ee.VARIABLE_LENGTH,30],["91",Ee.VARIABLE_LENGTH,30],["92",Ee.VARIABLE_LENGTH,30],["93",Ee.VARIABLE_LENGTH,30],["94",Ee.VARIABLE_LENGTH,30],["95",Ee.VARIABLE_LENGTH,30],["96",Ee.VARIABLE_LENGTH,30],["97",Ee.VARIABLE_LENGTH,3],["98",Ee.VARIABLE_LENGTH,30],["99",Ee.VARIABLE_LENGTH,30]],Ee.THREE_DIGIT_DATA_LENGTH=[["240",Ee.VARIABLE_LENGTH,30],["241",Ee.VARIABLE_LENGTH,30],["242",Ee.VARIABLE_LENGTH,6],["250",Ee.VARIABLE_LENGTH,30],["251",Ee.VARIABLE_LENGTH,30],["253",Ee.VARIABLE_LENGTH,17],["254",Ee.VARIABLE_LENGTH,20],["400",Ee.VARIABLE_LENGTH,30],["401",Ee.VARIABLE_LENGTH,30],["402",17],["403",Ee.VARIABLE_LENGTH,30],["410",13],["411",13],["412",13],["413",13],["414",13],["420",Ee.VARIABLE_LENGTH,20],["421",Ee.VARIABLE_LENGTH,15],["422",3],["423",Ee.VARIABLE_LENGTH,15],["424",3],["425",3],["426",3]],Ee.THREE_DIGIT_PLUS_DIGIT_DATA_LENGTH=[["310",6],["311",6],["312",6],["313",6],["314",6],["315",6],["316",6],["320",6],["321",6],["322",6],["323",6],["324",6],["325",6],["326",6],["327",6],["328",6],["329",6],["330",6],["331",6],["332",6],["333",6],["334",6],["335",6],["336",6],["340",6],["341",6],["342",6],["343",6],["344",6],["345",6],["346",6],["347",6],["348",6],["349",6],["350",6],["351",6],["352",6],["353",6],["354",6],["355",6],["356",6],["357",6],["360",6],["361",6],["362",6],["363",6],["364",6],["365",6],["366",6],["367",6],["368",6],["369",6],["390",Ee.VARIABLE_LENGTH,15],["391",Ee.VARIABLE_LENGTH,18],["392",Ee.VARIABLE_LENGTH,15],["393",Ee.VARIABLE_LENGTH,18],["703",Ee.VARIABLE_LENGTH,30]],Ee.FOUR_DIGIT_DATA_LENGTH=[["7001",13],["7002",Ee.VARIABLE_LENGTH,30],["7003",10],["8001",14],["8002",Ee.VARIABLE_LENGTH,20],["8003",Ee.VARIABLE_LENGTH,30],["8004",Ee.VARIABLE_LENGTH,30],["8005",6],["8006",18],["8007",Ee.VARIABLE_LENGTH,30],["8008",Ee.VARIABLE_LENGTH,12],["8018",18],["8020",Ee.VARIABLE_LENGTH,25],["8100",6],["8101",10],["8102",2],["8110",Ee.VARIABLE_LENGTH,70],["8200",Ee.VARIABLE_LENGTH,70]];class Ir{constructor(e){this.buffer=new G,this.information=e}decodeAllCodes(e,t){let n=t,o=null;do{let c=this.decodeGeneralPurposeField(n,o),d=Ee.parseFieldsInGeneralPurpose(c.getNewString());if(d!=null&&e.append(d),c.isRemaining()?o=""+c.getRemainingValue():o=null,n===c.getNewPosition())break;n=c.getNewPosition()}while(!0);return e.toString()}isStillNumeric(e){if(e+7>this.information.getSize())return e+4<=this.information.getSize();for(let t=e;t<e+3;++t)if(this.information.get(t))return!0;return this.information.get(e+3)}decodeNumeric(e){if(e+7>this.information.getSize()){let c=this.extractNumericValueFromBitArray(e,4);return c===0?new mn(this.information.getSize(),mn.FNC1,mn.FNC1):new mn(this.information.getSize(),c-1,mn.FNC1)}let t=this.extractNumericValueFromBitArray(e,7),n=(t-8)/11,o=(t-8)%11;return new mn(e+7,n,o)}extractNumericValueFromBitArray(e,t){return Ir.extractNumericValueFromBitArray(this.information,e,t)}static extractNumericValueFromBitArray(e,t,n){let o=0;for(let c=0;c<n;++c)e.get(t+c)&&(o|=1<<n-c-1);return o}decodeGeneralPurposeField(e,t){this.buffer.setLengthToZero(),t!=null&&this.buffer.append(t),this.current.setPosition(e);let n=this.parseBlocks();return n!=null&&n.isRemaining()?new lr(this.current.getPosition(),this.buffer.toString(),n.getRemainingValue()):new lr(this.current.getPosition(),this.buffer.toString())}parseBlocks(){let e,t;do{let n=this.current.getPosition();if(this.current.isAlpha()?(t=this.parseAlphaBlock(),e=t.isFinished()):this.current.isIsoIec646()?(t=this.parseIsoIec646Block(),e=t.isFinished()):(t=this.parseNumericBlock(),e=t.isFinished()),!(n!==this.current.getPosition())&&!e)break}while(!e);return t.getDecodedInformation()}parseNumericBlock(){for(;this.isStillNumeric(this.current.getPosition());){let e=this.decodeNumeric(this.current.getPosition());if(this.current.setPosition(e.getNewPosition()),e.isFirstDigitFNC1()){let t;return e.isSecondDigitFNC1()?t=new lr(this.current.getPosition(),this.buffer.toString()):t=new lr(this.current.getPosition(),this.buffer.toString(),e.getSecondDigit()),new un(!0,t)}if(this.buffer.append(e.getFirstDigit()),e.isSecondDigitFNC1()){let t=new lr(this.current.getPosition(),this.buffer.toString());return new un(!0,t)}this.buffer.append(e.getSecondDigit())}return this.isNumericToAlphaNumericLatch(this.current.getPosition())&&(this.current.setAlpha(),this.current.incrementPosition(4)),new un(!1)}parseIsoIec646Block(){for(;this.isStillIsoIec646(this.current.getPosition());){let e=this.decodeIsoIec646(this.current.getPosition());if(this.current.setPosition(e.getNewPosition()),e.isFNC1()){let t=new lr(this.current.getPosition(),this.buffer.toString());return new un(!0,t)}this.buffer.append(e.getValue())}return this.isAlphaOr646ToNumericLatch(this.current.getPosition())?(this.current.incrementPosition(3),this.current.setNumeric()):this.isAlphaTo646ToAlphaLatch(this.current.getPosition())&&(this.current.getPosition()+5<this.information.getSize()?this.current.incrementPosition(5):this.current.setPosition(this.information.getSize()),this.current.setAlpha()),new un(!1)}parseAlphaBlock(){for(;this.isStillAlpha(this.current.getPosition());){let e=this.decodeAlphanumeric(this.current.getPosition());if(this.current.setPosition(e.getNewPosition()),e.isFNC1()){let t=new lr(this.current.getPosition(),this.buffer.toString());return new un(!0,t)}this.buffer.append(e.getValue())}return this.isAlphaOr646ToNumericLatch(this.current.getPosition())?(this.current.incrementPosition(3),this.current.setNumeric()):this.isAlphaTo646ToAlphaLatch(this.current.getPosition())&&(this.current.getPosition()+5<this.information.getSize()?this.current.incrementPosition(5):this.current.setPosition(this.information.getSize()),this.current.setIsoIec646()),new un(!1)}isStillIsoIec646(e){if(e+5>this.information.getSize())return!1;let t=this.extractNumericValueFromBitArray(e,5);if(t>=5&&t<16)return!0;if(e+7>this.information.getSize())return!1;let n=this.extractNumericValueFromBitArray(e,7);if(n>=64&&n<116)return!0;if(e+8>this.information.getSize())return!1;let o=this.extractNumericValueFromBitArray(e,8);return o>=232&&o<253}decodeIsoIec646(e){let t=this.extractNumericValueFromBitArray(e,5);if(t===15)return new Zt(e+5,Zt.FNC1);if(t>=5&&t<15)return new Zt(e+5,"0"+(t-5));let n=this.extractNumericValueFromBitArray(e,7);if(n>=64&&n<90)return new Zt(e+7,""+(n+1));if(n>=90&&n<116)return new Zt(e+7,""+(n+7));let o=this.extractNumericValueFromBitArray(e,8),c;switch(o){case 232:c="!";break;case 233:c='"';break;case 234:c="%";break;case 235:c="&";break;case 236:c="'";break;case 237:c="(";break;case 238:c=")";break;case 239:c="*";break;case 240:c="+";break;case 241:c=",";break;case 242:c="-";break;case 243:c=".";break;case 244:c="/";break;case 245:c=":";break;case 246:c=";";break;case 247:c="<";break;case 248:c="=";break;case 249:c=">";break;case 250:c="?";break;case 251:c="_";break;case 252:c=" ";break;default:throw new F}return new Zt(e+8,c)}isStillAlpha(e){if(e+5>this.information.getSize())return!1;let t=this.extractNumericValueFromBitArray(e,5);if(t>=5&&t<16)return!0;if(e+6>this.information.getSize())return!1;let n=this.extractNumericValueFromBitArray(e,6);return n>=16&&n<63}decodeAlphanumeric(e){let t=this.extractNumericValueFromBitArray(e,5);if(t===15)return new Zt(e+5,Zt.FNC1);if(t>=5&&t<15)return new Zt(e+5,"0"+(t-5));let n=this.extractNumericValueFromBitArray(e,6);if(n>=32&&n<58)return new Zt(e+6,""+(n+33));let o;switch(n){case 58:o="*";break;case 59:o=",";break;case 60:o="-";break;case 61:o=".";break;case 62:o="/";break;default:throw new Ue("Decoding invalid alphanumeric value: "+n)}return new Zt(e+6,o)}isAlphaTo646ToAlphaLatch(e){if(e+1>this.information.getSize())return!1;for(let t=0;t<5&&t+e<this.information.getSize();++t)if(t===2){if(!this.information.get(e+2))return!1}else if(this.information.get(e+t))return!1;return!0}isAlphaOr646ToNumericLatch(e){if(e+3>this.information.getSize())return!1;for(let t=e;t<e+3;++t)if(this.information.get(t))return!1;return!0}isNumericToAlphaNumericLatch(e){if(e+1>this.information.getSize())return!1;for(let t=0;t<4&&t+e<this.information.getSize();++t)if(this.information.get(e+t))return!1;return!0}}class Mo{constructor(e){this.information=e,this.generalDecoder=new Ir(e)}getInformation(){return this.information}getGeneralDecoder(){return this.generalDecoder}}class tn extends Mo{constructor(e){super(e)}encodeCompressedGtin(e,t){e.append("(01)");let n=e.length();e.append("9"),this.encodeCompressedGtinWithoutAI(e,t,n)}encodeCompressedGtinWithoutAI(e,t,n){for(let o=0;o<4;++o){let c=this.getGeneralDecoder().extractNumericValueFromBitArray(t+10*o,10);c/100===0&&e.append("0"),c/10===0&&e.append("0"),e.append(c)}tn.appendCheckDigit(e,n)}static appendCheckDigit(e,t){let n=0;for(let o=0;o<13;o++){let c=e.charAt(o+t).charCodeAt(0)-48;n+=o&1?c:3*c}n=10-n%10,n===10&&(n=0),e.append(n)}}tn.GTIN_SIZE=40;class Nr extends tn{constructor(e){super(e)}parseInformation(){let e=new G;e.append("(01)");let t=e.length(),n=this.getGeneralDecoder().extractNumericValueFromBitArray(Nr.HEADER_SIZE,4);return e.append(n),this.encodeCompressedGtinWithoutAI(e,Nr.HEADER_SIZE+4,t),this.getGeneralDecoder().decodeAllCodes(e,Nr.HEADER_SIZE+44)}}Nr.HEADER_SIZE=4;class Oi extends Mo{constructor(e){super(e)}parseInformation(){let e=new G;return this.getGeneralDecoder().decodeAllCodes(e,Oi.HEADER_SIZE)}}Oi.HEADER_SIZE=5;class Mi extends tn{constructor(e){super(e)}encodeCompressedWeight(e,t,n){let o=this.getGeneralDecoder().extractNumericValueFromBitArray(t,n);this.addWeightCode(e,o);let c=this.checkWeight(o),d=1e5;for(let h=0;h<5;++h)c/d===0&&e.append("0"),d/=10;e.append(c)}}class Bn extends Mi{constructor(e){super(e)}parseInformation(){if(this.getInformation().getSize()!=Bn.HEADER_SIZE+Mi.GTIN_SIZE+Bn.WEIGHT_SIZE)throw new T;let e=new G;return this.encodeCompressedGtin(e,Bn.HEADER_SIZE),this.encodeCompressedWeight(e,Bn.HEADER_SIZE+Mi.GTIN_SIZE,Bn.WEIGHT_SIZE),e.toString()}}Bn.HEADER_SIZE=5,Bn.WEIGHT_SIZE=15;class wg extends Bn{constructor(e){super(e)}addWeightCode(e,t){e.append("(3103)")}checkWeight(e){return e}}class Cg extends Bn{constructor(e){super(e)}addWeightCode(e,t){t<1e4?e.append("(3202)"):e.append("(3203)")}checkWeight(e){return e<1e4?e:e-1e4}}class On extends tn{constructor(e){super(e)}parseInformation(){if(this.getInformation().getSize()<On.HEADER_SIZE+tn.GTIN_SIZE)throw new T;let e=new G;this.encodeCompressedGtin(e,On.HEADER_SIZE);let t=this.getGeneralDecoder().extractNumericValueFromBitArray(On.HEADER_SIZE+tn.GTIN_SIZE,On.LAST_DIGIT_SIZE);e.append("(392"),e.append(t),e.append(")");let n=this.getGeneralDecoder().decodeGeneralPurposeField(On.HEADER_SIZE+tn.GTIN_SIZE+On.LAST_DIGIT_SIZE,null);return e.append(n.getNewString()),e.toString()}}On.HEADER_SIZE=8,On.LAST_DIGIT_SIZE=2;class Yt extends tn{constructor(e){super(e)}parseInformation(){if(this.getInformation().getSize()<Yt.HEADER_SIZE+tn.GTIN_SIZE)throw new T;let e=new G;this.encodeCompressedGtin(e,Yt.HEADER_SIZE);let t=this.getGeneralDecoder().extractNumericValueFromBitArray(Yt.HEADER_SIZE+tn.GTIN_SIZE,Yt.LAST_DIGIT_SIZE);e.append("(393"),e.append(t),e.append(")");let n=this.getGeneralDecoder().extractNumericValueFromBitArray(Yt.HEADER_SIZE+tn.GTIN_SIZE+Yt.LAST_DIGIT_SIZE,Yt.FIRST_THREE_DIGITS_SIZE);n/100==0&&e.append("0"),n/10==0&&e.append("0"),e.append(n);let o=this.getGeneralDecoder().decodeGeneralPurposeField(Yt.HEADER_SIZE+tn.GTIN_SIZE+Yt.LAST_DIGIT_SIZE+Yt.FIRST_THREE_DIGITS_SIZE,null);return e.append(o.getNewString()),e.toString()}}Yt.HEADER_SIZE=8,Yt.LAST_DIGIT_SIZE=2,Yt.FIRST_THREE_DIGITS_SIZE=10;class yt extends Mi{constructor(e,t,n){super(e),this.dateCode=n,this.firstAIdigits=t}parseInformation(){if(this.getInformation().getSize()!=yt.HEADER_SIZE+yt.GTIN_SIZE+yt.WEIGHT_SIZE+yt.DATE_SIZE)throw new T;let e=new G;return this.encodeCompressedGtin(e,yt.HEADER_SIZE),this.encodeCompressedWeight(e,yt.HEADER_SIZE+yt.GTIN_SIZE,yt.WEIGHT_SIZE),this.encodeCompressedDate(e,yt.HEADER_SIZE+yt.GTIN_SIZE+yt.WEIGHT_SIZE),e.toString()}encodeCompressedDate(e,t){let n=this.getGeneralDecoder().extractNumericValueFromBitArray(t,yt.DATE_SIZE);if(n==38400)return;e.append("("),e.append(this.dateCode),e.append(")");let o=n%32;n/=32;let c=n%12+1;n/=12;let d=n;d/10==0&&e.append("0"),e.append(d),c/10==0&&e.append("0"),e.append(c),o/10==0&&e.append("0"),e.append(o)}addWeightCode(e,t){e.append("("),e.append(this.firstAIdigits),e.append(t/1e5),e.append(")")}checkWeight(e){return e%1e5}}yt.HEADER_SIZE=8,yt.WEIGHT_SIZE=20,yt.DATE_SIZE=16;function $a(b){try{if(b.get(1))return new Nr(b);if(!b.get(2))return new Oi(b);switch(Ir.extractNumericValueFromBitArray(b,1,4)){case 4:return new wg(b);case 5:return new Cg(b)}switch(Ir.extractNumericValueFromBitArray(b,1,5)){case 12:return new On(b);case 13:return new Yt(b)}switch(Ir.extractNumericValueFromBitArray(b,1,7)){case 56:return new yt(b,"310","11");case 57:return new yt(b,"320","11");case 58:return new yt(b,"310","13");case 59:return new yt(b,"320","13");case 60:return new yt(b,"310","15");case 61:return new yt(b,"320","15");case 62:return new yt(b,"310","17");case 63:return new yt(b,"320","17")}}catch(e){throw console.log(e),new Ue("unknown decoder: "+b)}}class Xn{constructor(e,t,n,o){this.leftchar=e,this.rightchar=t,this.finderpattern=n,this.maybeLast=o}mayBeLast(){return this.maybeLast}getLeftChar(){return this.leftchar}getRightChar(){return this.rightchar}getFinderPattern(){return this.finderpattern}mustBeLast(){return this.rightchar==null}toString(){return"[ "+this.leftchar+", "+this.rightchar+" : "+(this.finderpattern==null?"null":this.finderpattern.getValue())+" ]"}static equals(e,t){return e instanceof Xn?Xn.equalsOrNull(e.leftchar,t.leftchar)&&Xn.equalsOrNull(e.rightchar,t.rightchar)&&Xn.equalsOrNull(e.finderpattern,t.finderpattern):!1}static equalsOrNull(e,t){return e===null?t===null:Xn.equals(e,t)}hashCode(){return this.leftchar.getValue()^this.rightchar.getValue()^this.finderpattern.getValue()}}class Do{constructor(e,t,n){this.pairs=e,this.rowNumber=t,this.wasReversed=n}getPairs(){return this.pairs}getRowNumber(){return this.rowNumber}isReversed(){return this.wasReversed}isEquivalent(e){return this.checkEqualitity(this,e)}toString(){return"{ "+this.pairs+" }"}equals(e,t){return e instanceof Do?this.checkEqualitity(e,t)&&e.wasReversed===t.wasReversed:!1}checkEqualitity(e,t){if(!e||!t)return;let n;return e.forEach((o,c)=>{t.forEach(d=>{o.getLeftChar().getValue()===d.getLeftChar().getValue()&&o.getRightChar().getValue()===d.getRightChar().getValue()&&o.getFinderPatter().getValue()===d.getFinderPatter().getValue()&&(n=!0)})}),n}}class ae extends Ye{constructor(e){super(...arguments),this.pairs=new Array(ae.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 ae.constructResult(this.decodeRow2pairs(e,t))}catch(o){this.verbose&&console.log(o)}return this.pairs.length=0,this.startFromEven=!0,ae.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 T){if(!this.pairs.length)throw new T;n=!0}}if(this.checkChecksum())return this.pairs;let o;if(this.rows.length?o=!0:o=!1,this.storeRow(e,!1),o){let c=this.checkRowsBoolean(!1);if(c!=null||(c=this.checkRowsBoolean(!0),c!=null))return c}throw new T}checkRowsBoolean(e){if(this.rows.length>25)return this.rows.length=0,null;this.pairs.length=0,e&&(this.rows=this.rows.reverse());let t=null;try{t=this.checkRows(new Array,0)}catch(n){this.verbose&&console.log(n)}return e&&(this.rows=this.rows.reverse()),t}checkRows(e,t){for(let n=t;n<this.rows.length;n++){let o=this.rows[n];this.pairs.length=0;for(let d of e)this.pairs.push(d.getPairs());if(this.pairs.push(o.getPairs()),!ae.isValidSequence(this.pairs))continue;if(this.checkChecksum())return this.pairs;let c=new Array(e);c.push(o);try{return this.checkRows(c,n+1)}catch(d){this.verbose&&console.log(d)}}throw new T}static isValidSequence(e){for(let t of ae.FINDER_PATTERN_SEQUENCES){if(e.length>t.length)continue;let n=!0;for(let o=0;o<e.length;o++)if(e[o].getFinderPattern().getValue()!=t[o]){n=!1;break}if(n)return!0}return!1}storeRow(e,t){let n=0,o=!1,c=!1;for(;n<this.rows.length;){let d=this.rows[n];if(d.getRowNumber()>e){c=d.isEquivalent(this.pairs);break}o=d.isEquivalent(this.pairs),n++}c||o||ae.isPartialRow(this.pairs,this.rows)||(this.rows.push(n,new Do(this.pairs,e,t)),this.removePartialRows(this.pairs,this.rows))}removePartialRows(e,t){for(let n of t)if(n.getPairs().length!==e.length){for(let o of n.getPairs())for(let c of e)if(Xn.equals(o,c))break}}static isPartialRow(e,t){for(let n of t){let o=!0;for(let c of e){let d=!1;for(let h of n.getPairs())if(c.equals(h)){d=!0;break}if(!d){o=!1;break}}if(o)return!0}return!1}getRows(){return this.rows}static constructResult(e){let t=ze.buildBitArray(e),o=$a(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 ge(o,null,null,h,xe.RSS_EXPANDED,null)}checkChecksum(){let e=this.pairs.get(0),t=e.getLeftChar(),n=e.getRightChar();if(n==null)return!1;let o=n.getChecksumPortion(),c=2;for(let h=1;h<this.pairs.size();++h){let g=this.pairs.get(h);o+=g.getLeftChar().getChecksumPortion(),c++;let w=g.getRightChar();w!=null&&(o+=w.getChecksumPortion(),c++)}return o%=211,211*(c-4)+o==t.getValue()}static getNextSecondBar(e,t){let n;return e.get(t)?(n=e.getNextUnset(t),n=e.getNextSet(n)):(n=e.getNextSet(t),n=e.getNextUnset(n)),n}retrieveNextPair(e,t,n){let o=t.length%2==0;this.startFromEven&&(o=!o);let c,d=!0,h=-1;do this.findNextPair(e,t,h),c=this.parseFoundFinderPattern(e,n,o),c==null?h=ae.getNextSecondBar(e,this.startEnd[0]):d=!1;while(d);let g=this.decodeDataCharacter(e,c,o,!0);if(!this.isEmptyPair(t)&&t[t.length-1].mustBeLast())throw new T;let w;try{w=this.decodeDataCharacter(e,c,o,!1)}catch(E){w=null,this.verbose&&console.log(E)}return new Xn(g,w,c,!0)}isEmptyPair(e){return e.length===0}findNextPair(e,t,n){let o=this.getDecodeFinderCounters();o[0]=0,o[1]=0,o[2]=0,o[3]=0;let c=e.getSize(),d;n>=0?d=n:this.isEmptyPair(t)?d=0:d=t[t.length-1].getFinderPattern().getStartEnd()[1];let h=t.length%2!=0;this.startFromEven&&(h=!h);let g=!1;for(;d<c&&(g=!e.get(d),!!g);)d++;let w=0,E=d;for(let A=d;A<c;A++)if(e.get(A)!=g)o[w]++;else{if(w==3){if(h&&ae.reverseCounters(o),ae.isFinderPattern(o)){this.startEnd[0]=E,this.startEnd[1]=A;return}h&&ae.reverseCounters(o),E+=o[0]+o[1],o[0]=o[2],o[1]=o[3],o[2]=0,o[3]=0,w--}else w++;o[w]=1,g=!g}throw new T}static reverseCounters(e){let t=e.length;for(let n=0;n<t/2;++n){let o=e[n];e[n]=e[t-n-1],e[t-n-1]=o}}parseFoundFinderPattern(e,t,n){let o,c,d;if(n){let w=this.startEnd[0]-1;for(;w>=0&&!e.get(w);)w--;w++,o=this.startEnd[0]-w,c=w,d=this.startEnd[1]}else c=this.startEnd[0],d=e.getNextUnset(this.startEnd[1]+1),o=d-this.startEnd[1];let h=this.getDecodeFinderCounters();v.arraycopy(h,0,h,1,h.length-1),h[0]=o;let g;try{g=this.parseFinderValue(h,ae.FINDER_PATTERNS)}catch{return null}return new Tt(g,[c,d],c,d,t)}decodeDataCharacter(e,t,n,o){let c=this.getDataCharacterCounters();for(let ut=0;ut<c.length;ut++)c[ut]=0;if(o)ae.recordPatternInReverse(e,t.getStartEnd()[0],c);else{ae.recordPattern(e,t.getStartEnd()[1],c);for(let ut=0,Wt=c.length-1;ut<Wt;ut++,Wt--){let fn=c[ut];c[ut]=c[Wt],c[Wt]=fn}}let d=17,h=ve.sum(new Int32Array(c))/d,g=(t.getStartEnd()[1]-t.getStartEnd()[0])/15;if(Math.abs(h-g)/g>.3)throw new T;let w=this.getOddCounts(),E=this.getEvenCounts(),A=this.getOddRoundingErrors(),S=this.getEvenRoundingErrors();for(let ut=0;ut<c.length;ut++){let Wt=1*c[ut]/h,fn=Wt+.5;if(fn<1){if(Wt<.3)throw new T;fn=1}else if(fn>8){if(Wt>8.7)throw new T;fn=8}let Or=ut/2;ut&1?(E[Or]=fn,S[Or]=Wt-fn):(w[Or]=fn,A[Or]=Wt-fn)}this.adjustOddEvenCounts(d);let B=4*t.getValue()+(n?0:2)+(o?0:1)-1,U=0,H=0;for(let ut=w.length-1;ut>=0;ut--){if(ae.isNotA1left(t,n,o)){let Wt=ae.WEIGHTS[B][2*ut];H+=w[ut]*Wt}U+=w[ut]}let K=0;for(let ut=E.length-1;ut>=0;ut--)if(ae.isNotA1left(t,n,o)){let Wt=ae.WEIGHTS[B][2*ut+1];K+=E[ut]*Wt}let oe=H+K;if(U&1||U>13||U<4)throw new T;let ue=(13-U)/2,fe=ae.SYMBOL_WIDEST[ue],le=9-fe,je=pt.getRSSvalue(w,fe,!0),Fe=pt.getRSSvalue(E,le,!1),rn=ae.EVEN_TOTAL_SUBSET[ue],Sn=ae.GSUM[ue],on=je*rn+Fe+Sn;return new Et(on,oe)}static isNotA1left(e,t,n){return!(e.getValue()==0&&t&&n)}adjustOddEvenCounts(e){let t=ve.sum(new Int32Array(this.getOddCounts())),n=ve.sum(new Int32Array(this.getEvenCounts())),o=!1,c=!1;t>13?c=!0:t<4&&(o=!0);let d=!1,h=!1;n>13?h=!0:n<4&&(d=!0);let g=t+n-e,w=(t&1)==1,E=(n&1)==0;if(g==1)if(w){if(E)throw new T;c=!0}else{if(!E)throw new T;h=!0}else if(g==-1)if(w){if(E)throw new T;o=!0}else{if(!E)throw new T;d=!0}else if(g==0){if(w){if(!E)throw new T;t<n?(o=!0,h=!0):(c=!0,d=!0)}else if(E)throw new T}else throw new T;if(o){if(c)throw new T;ae.increment(this.getOddCounts(),this.getOddRoundingErrors())}if(c&&ae.decrement(this.getOddCounts(),this.getOddRoundingErrors()),d){if(h)throw new T;ae.increment(this.getEvenCounts(),this.getOddRoundingErrors())}h&&ae.decrement(this.getEvenCounts(),this.getEvenRoundingErrors())}}ae.SYMBOL_WIDEST=[7,5,4,3,1],ae.EVEN_TOTAL_SUBSET=[4,20,52,104,204],ae.GSUM=[0,348,1388,2948,3988],ae.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])],ae.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]],ae.FINDER_PAT_A=0,ae.FINDER_PAT_B=1,ae.FINDER_PAT_C=2,ae.FINDER_PAT_D=3,ae.FINDER_PAT_E=4,ae.FINDER_PAT_F=5,ae.FINDER_PATTERN_SEQUENCES=[[ae.FINDER_PAT_A,ae.FINDER_PAT_A],[ae.FINDER_PAT_A,ae.FINDER_PAT_B,ae.FINDER_PAT_B],[ae.FINDER_PAT_A,ae.FINDER_PAT_C,ae.FINDER_PAT_B,ae.FINDER_PAT_D],[ae.FINDER_PAT_A,ae.FINDER_PAT_E,ae.FINDER_PAT_B,ae.FINDER_PAT_D,ae.FINDER_PAT_C],[ae.FINDER_PAT_A,ae.FINDER_PAT_E,ae.FINDER_PAT_B,ae.FINDER_PAT_D,ae.FINDER_PAT_D,ae.FINDER_PAT_F],[ae.FINDER_PAT_A,ae.FINDER_PAT_E,ae.FINDER_PAT_B,ae.FINDER_PAT_D,ae.FINDER_PAT_E,ae.FINDER_PAT_F,ae.FINDER_PAT_F],[ae.FINDER_PAT_A,ae.FINDER_PAT_A,ae.FINDER_PAT_B,ae.FINDER_PAT_B,ae.FINDER_PAT_C,ae.FINDER_PAT_C,ae.FINDER_PAT_D,ae.FINDER_PAT_D],[ae.FINDER_PAT_A,ae.FINDER_PAT_A,ae.FINDER_PAT_B,ae.FINDER_PAT_B,ae.FINDER_PAT_C,ae.FINDER_PAT_C,ae.FINDER_PAT_D,ae.FINDER_PAT_E,ae.FINDER_PAT_E],[ae.FINDER_PAT_A,ae.FINDER_PAT_A,ae.FINDER_PAT_B,ae.FINDER_PAT_B,ae.FINDER_PAT_C,ae.FINDER_PAT_C,ae.FINDER_PAT_D,ae.FINDER_PAT_E,ae.FINDER_PAT_F,ae.FINDER_PAT_F],[ae.FINDER_PAT_A,ae.FINDER_PAT_A,ae.FINDER_PAT_B,ae.FINDER_PAT_B,ae.FINDER_PAT_C,ae.FINDER_PAT_D,ae.FINDER_PAT_D,ae.FINDER_PAT_E,ae.FINDER_PAT_E,ae.FINDER_PAT_F,ae.FINDER_PAT_F]],ae.MAX_PAIRS=11;class Eg extends Et{constructor(e,t,n){super(e,t),this.count=0,this.finderPattern=n}getFinderPattern(){return this.finderPattern}getCount(){return this.count}incrementCount(){this.count++}}class kt extends Ye{constructor(){super(...arguments),this.possibleLeftPairs=[],this.possibleRightPairs=[]}decodeRow(e,t,n){const o=this.decodePair(t,!1,e,n);kt.addOrTally(this.possibleLeftPairs,o),t.reverse();let c=this.decodePair(t,!0,e,n);kt.addOrTally(this.possibleRightPairs,c),t.reverse();for(let d of this.possibleLeftPairs)if(d.getCount()>1){for(let h of this.possibleRightPairs)if(h.getCount()>1&&kt.checkChecksum(d,h))return kt.constructResult(d,h)}throw new T}static addOrTally(e,t){if(t==null)return;let n=!1;for(let o of e)if(o.getValue()===t.getValue()){o.incrementCount(),n=!0;break}n||e.push(t)}reset(){this.possibleLeftPairs.length=0,this.possibleRightPairs.length=0}static constructResult(e,t){let n=4537077*e.getValue()+t.getValue(),o=new String(n).toString(),c=new G;for(let w=13-o.length;w>0;w--)c.append("0");c.append(o);let d=0;for(let w=0;w<13;w++){let E=c.charAt(w).charCodeAt(0)-48;d+=w&1?E:3*E}d=10-d%10,d===10&&(d=0),c.append(d.toString());let h=e.getFinderPattern().getResultPoints(),g=t.getFinderPattern().getResultPoints();return new ge(c.toString(),null,0,[h[0],h[1],g[0],g[1]],xe.RSS_14,new Date().getTime())}static checkChecksum(e,t){let n=(e.getChecksumPortion()+16*t.getChecksumPortion())%79,o=9*e.getFinderPattern().getValue()+t.getFinderPattern().getValue();return o>72&&o--,o>8&&o--,n===o}decodePair(e,t,n,o){try{let c=this.findFinderPattern(e,t),d=this.parseFoundFinderPattern(e,n,t,c),h=o==null?null:o.get(Y.NEED_RESULT_POINT_CALLBACK);if(h!=null){let E=(c[0]+c[1])/2;t&&(E=e.getSize()-1-E),h.foundPossibleResultPoint(new ye(E,n))}let g=this.decodeDataCharacter(e,d,!0),w=this.decodeDataCharacter(e,d,!1);return new Eg(1597*g.getValue()+w.getValue(),g.getChecksumPortion()+4*w.getChecksumPortion(),d)}catch{return null}}decodeDataCharacter(e,t,n){let o=this.getDataCharacterCounters();for(let K=0;K<o.length;K++)o[K]=0;if(n)ht.recordPatternInReverse(e,t.getStartEnd()[0],o);else{ht.recordPattern(e,t.getStartEnd()[1]+1,o);for(let K=0,oe=o.length-1;K<oe;K++,oe--){let ue=o[K];o[K]=o[oe],o[oe]=ue}}let c=n?16:15,d=ve.sum(new Int32Array(o))/c,h=this.getOddCounts(),g=this.getEvenCounts(),w=this.getOddRoundingErrors(),E=this.getEvenRoundingErrors();for(let K=0;K<o.length;K++){let oe=o[K]/d,ue=Math.floor(oe+.5);ue<1?ue=1:ue>8&&(ue=8);let fe=Math.floor(K/2);K&1?(g[fe]=ue,E[fe]=oe-ue):(h[fe]=ue,w[fe]=oe-ue)}this.adjustOddEvenCounts(n,c);let A=0,S=0;for(let K=h.length-1;K>=0;K--)S*=9,S+=h[K],A+=h[K];let B=0,U=0;for(let K=g.length-1;K>=0;K--)B*=9,B+=g[K],U+=g[K];let H=S+3*B;if(n){if(A&1||A>12||A<4)throw new T;let K=(12-A)/2,oe=kt.OUTSIDE_ODD_WIDEST[K],ue=9-oe,fe=pt.getRSSvalue(h,oe,!1),le=pt.getRSSvalue(g,ue,!0),je=kt.OUTSIDE_EVEN_TOTAL_SUBSET[K],Fe=kt.OUTSIDE_GSUM[K];return new Et(fe*je+le+Fe,H)}else{if(U&1||U>10||U<4)throw new T;let K=(10-U)/2,oe=kt.INSIDE_ODD_WIDEST[K],ue=9-oe,fe=pt.getRSSvalue(h,oe,!0),le=pt.getRSSvalue(g,ue,!1),je=kt.INSIDE_ODD_TOTAL_SUBSET[K],Fe=kt.INSIDE_GSUM[K];return new Et(le*je+fe+Fe,H)}}findFinderPattern(e,t){let n=this.getDecodeFinderCounters();n[0]=0,n[1]=0,n[2]=0,n[3]=0;let o=e.getSize(),c=!1,d=0;for(;d<o&&(c=!e.get(d),t!==c);)d++;let h=0,g=d;for(let w=d;w<o;w++)if(e.get(w)!==c)n[h]++;else{if(h===3){if(Ye.isFinderPattern(n))return[g,w];g+=n[0]+n[1],n[0]=n[2],n[1]=n[3],n[2]=0,n[3]=0,h--}else h++;n[h]=1,c=!c}throw new T}parseFoundFinderPattern(e,t,n,o){let c=e.get(o[0]),d=o[0]-1;for(;d>=0&&c!==e.get(d);)d--;d++;const h=o[0]-d,g=this.getDecodeFinderCounters(),w=new Int32Array(g.length);v.arraycopy(g,0,w,1,g.length-1),w[0]=h;const E=this.parseFinderValue(w,kt.FINDER_PATTERNS);let A=d,S=o[1];return n&&(A=e.getSize()-1-A,S=e.getSize()-1-S),new Tt(E,[d,o[1]],A,S,t)}adjustOddEvenCounts(e,t){let n=ve.sum(new Int32Array(this.getOddCounts())),o=ve.sum(new Int32Array(this.getEvenCounts())),c=!1,d=!1,h=!1,g=!1;e?(n>12?d=!0:n<4&&(c=!0),o>12?g=!0:o<4&&(h=!0)):(n>11?d=!0:n<5&&(c=!0),o>10?g=!0:o<4&&(h=!0));let w=n+o-t,E=(n&1)===(e?1:0),A=(o&1)===1;if(w===1)if(E){if(A)throw new T;d=!0}else{if(!A)throw new T;g=!0}else if(w===-1)if(E){if(A)throw new T;c=!0}else{if(!A)throw new T;h=!0}else if(w===0){if(E){if(!A)throw new T;n<o?(c=!0,g=!0):(d=!0,h=!0)}else if(A)throw new T}else throw new T;if(c){if(d)throw new T;Ye.increment(this.getOddCounts(),this.getOddRoundingErrors())}if(d&&Ye.decrement(this.getOddCounts(),this.getOddRoundingErrors()),h){if(g)throw new T;Ye.increment(this.getEvenCounts(),this.getOddRoundingErrors())}g&&Ye.decrement(this.getEvenCounts(),this.getEvenRoundingErrors())}}kt.OUTSIDE_EVEN_TOTAL_SUBSET=[1,10,34,70,126],kt.INSIDE_ODD_TOTAL_SUBSET=[4,20,48,81],kt.OUTSIDE_GSUM=[0,161,961,2015,2715],kt.INSIDE_GSUM=[0,336,1036,1516],kt.OUTSIDE_ODD_WIDEST=[8,6,4,3,1],kt.INSIDE_ODD_WIDEST=[2,4,6,8],kt.FINDER_PATTERNS=[Int32Array.from([3,8,2,1]),Int32Array.from([3,5,5,1]),Int32Array.from([3,3,7,1]),Int32Array.from([3,1,9,1]),Int32Array.from([2,7,4,1]),Int32Array.from([2,5,6,1]),Int32Array.from([2,3,8,1]),Int32Array.from([1,5,7,1]),Int32Array.from([1,3,9,1])];class Tr extends ht{constructor(e,t){super(),this.readers=[],this.verbose=t===!0;const n=e?e.get(Y.POSSIBLE_FORMATS):null,o=e&&e.get(Y.ASSUME_CODE_39_CHECK_DIGIT)!==void 0;n?((n.includes(xe.EAN_13)||n.includes(xe.UPC_A)||n.includes(xe.EAN_8)||n.includes(xe.UPC_E))&&this.readers.push(new qt(e)),n.includes(xe.CODE_39)&&this.readers.push(new bt(o)),n.includes(xe.CODE_128)&&this.readers.push(new me),n.includes(xe.ITF)&&this.readers.push(new tt),n.includes(xe.RSS_14)&&this.readers.push(new kt),n.includes(xe.RSS_EXPANDED)&&this.readers.push(new ae(this.verbose))):(this.readers.push(new qt(e)),this.readers.push(new bt),this.readers.push(new qt(e)),this.readers.push(new me),this.readers.push(new tt),this.readers.push(new kt),this.readers.push(new ae(this.verbose)))}decodeRow(e,t,n){for(let o=0;o<this.readers.length;o++)try{return this.readers[o].decodeRow(e,t,n)}catch{}throw new T}reset(){this.readers.forEach(e=>e.reset())}}class yg extends Ce{constructor(e=500,t){super(new Tr(t),e,t)}}class nt{constructor(e,t,n){this.ecCodewords=e,this.ecBlocks=[t],n&&this.ecBlocks.push(n)}getECCodewords(){return this.ecCodewords}getECBlocks(){return this.ecBlocks}}class Je{constructor(e,t){this.count=e,this.dataCodewords=t}getCount(){return this.count}getDataCodewords(){return this.dataCodewords}}class qe{constructor(e,t,n,o,c,d){this.versionNumber=e,this.symbolSizeRows=t,this.symbolSizeColumns=n,this.dataRegionSizeRows=o,this.dataRegionSizeColumns=c,this.ecBlocks=d;let h=0;const g=d.getECCodewords(),w=d.getECBlocks();for(let E of w)h+=E.getCount()*(E.getDataCodewords()+g);this.totalCodewords=h}getVersionNumber(){return this.versionNumber}getSymbolSizeRows(){return this.symbolSizeRows}getSymbolSizeColumns(){return this.symbolSizeColumns}getDataRegionSizeRows(){return this.dataRegionSizeRows}getDataRegionSizeColumns(){return this.dataRegionSizeColumns}getTotalCodewords(){return this.totalCodewords}getECBlocks(){return this.ecBlocks}static getVersionForDimensions(e,t){if(e&1||t&1)throw new F;for(let n of qe.VERSIONS)if(n.symbolSizeRows===e&&n.symbolSizeColumns===t)return n;throw new F}toString(){return""+this.versionNumber}static buildVersions(){return[new qe(1,10,10,8,8,new nt(5,new Je(1,3))),new qe(2,12,12,10,10,new nt(7,new Je(1,5))),new qe(3,14,14,12,12,new nt(10,new Je(1,8))),new qe(4,16,16,14,14,new nt(12,new Je(1,12))),new qe(5,18,18,16,16,new nt(14,new Je(1,18))),new qe(6,20,20,18,18,new nt(18,new Je(1,22))),new qe(7,22,22,20,20,new nt(20,new Je(1,30))),new qe(8,24,24,22,22,new nt(24,new Je(1,36))),new qe(9,26,26,24,24,new nt(28,new Je(1,44))),new qe(10,32,32,14,14,new nt(36,new Je(1,62))),new qe(11,36,36,16,16,new nt(42,new Je(1,86))),new qe(12,40,40,18,18,new nt(48,new Je(1,114))),new qe(13,44,44,20,20,new nt(56,new Je(1,144))),new qe(14,48,48,22,22,new nt(68,new Je(1,174))),new qe(15,52,52,24,24,new nt(42,new Je(2,102))),new qe(16,64,64,14,14,new nt(56,new Je(2,140))),new qe(17,72,72,16,16,new nt(36,new Je(4,92))),new qe(18,80,80,18,18,new nt(48,new Je(4,114))),new qe(19,88,88,20,20,new nt(56,new Je(4,144))),new qe(20,96,96,22,22,new nt(68,new Je(4,174))),new qe(21,104,104,24,24,new nt(56,new Je(6,136))),new qe(22,120,120,18,18,new nt(68,new Je(6,175))),new qe(23,132,132,20,20,new nt(62,new Je(8,163))),new qe(24,144,144,22,22,new nt(62,new Je(8,156),new Je(2,155))),new qe(25,8,18,6,16,new nt(7,new Je(1,5))),new qe(26,8,32,6,14,new nt(11,new Je(1,10))),new qe(27,12,26,10,24,new nt(14,new Je(1,16))),new qe(28,12,36,10,16,new nt(18,new Je(1,22))),new qe(29,16,36,14,16,new nt(24,new Je(1,32))),new qe(30,16,48,14,22,new nt(28,new Je(1,49)))]}}qe.VERSIONS=qe.buildVersions();class vo{constructor(e){const t=e.getHeight();if(t<8||t>144||t&1)throw new F;this.version=vo.readVersion(e),this.mappingBitMatrix=this.extractDataRegion(e),this.readMappingMatrix=new z(this.mappingBitMatrix.getWidth(),this.mappingBitMatrix.getHeight())}getVersion(){return this.version}static readVersion(e){const t=e.getHeight(),n=e.getWidth();return qe.getVersionForDimensions(t,n)}readCodewords(){const e=new Int8Array(this.version.getTotalCodewords());let t=0,n=4,o=0;const c=this.mappingBitMatrix.getHeight(),d=this.mappingBitMatrix.getWidth();let h=!1,g=!1,w=!1,E=!1;do if(n===c&&o===0&&!h)e[t++]=this.readCorner1(c,d)&255,n-=2,o+=2,h=!0;else if(n===c-2&&o===0&&d&3&&!g)e[t++]=this.readCorner2(c,d)&255,n-=2,o+=2,g=!0;else if(n===c+4&&o===2&&!(d&7)&&!w)e[t++]=this.readCorner3(c,d)&255,n-=2,o+=2,w=!0;else if(n===c-2&&o===0&&(d&7)===4&&!E)e[t++]=this.readCorner4(c,d)&255,n-=2,o+=2,E=!0;else{do n<c&&o>=0&&!this.readMappingMatrix.get(o,n)&&(e[t++]=this.readUtah(n,o,c,d)&255),n-=2,o+=2;while(n>=0&&o<d);n+=1,o+=3;do n>=0&&o<d&&!this.readMappingMatrix.get(o,n)&&(e[t++]=this.readUtah(n,o,c,d)&255),n+=2,o-=2;while(n<c&&o>=0);n+=3,o+=1}while(n<c||o<d);if(t!==this.version.getTotalCodewords())throw new F;return e}readModule(e,t,n,o){return e<0&&(e+=n,t+=4-(n+4&7)),t<0&&(t+=o,e+=4-(o+4&7)),this.readMappingMatrix.set(t,e),this.mappingBitMatrix.get(t,e)}readUtah(e,t,n,o){let c=0;return this.readModule(e-2,t-2,n,o)&&(c|=1),c<<=1,this.readModule(e-2,t-1,n,o)&&(c|=1),c<<=1,this.readModule(e-1,t-2,n,o)&&(c|=1),c<<=1,this.readModule(e-1,t-1,n,o)&&(c|=1),c<<=1,this.readModule(e-1,t,n,o)&&(c|=1),c<<=1,this.readModule(e,t-2,n,o)&&(c|=1),c<<=1,this.readModule(e,t-1,n,o)&&(c|=1),c<<=1,this.readModule(e,t,n,o)&&(c|=1),c}readCorner1(e,t){let n=0;return this.readModule(e-1,0,e,t)&&(n|=1),n<<=1,this.readModule(e-1,1,e,t)&&(n|=1),n<<=1,this.readModule(e-1,2,e,t)&&(n|=1),n<<=1,this.readModule(0,t-2,e,t)&&(n|=1),n<<=1,this.readModule(0,t-1,e,t)&&(n|=1),n<<=1,this.readModule(1,t-1,e,t)&&(n|=1),n<<=1,this.readModule(2,t-1,e,t)&&(n|=1),n<<=1,this.readModule(3,t-1,e,t)&&(n|=1),n}readCorner2(e,t){let n=0;return this.readModule(e-3,0,e,t)&&(n|=1),n<<=1,this.readModule(e-2,0,e,t)&&(n|=1),n<<=1,this.readModule(e-1,0,e,t)&&(n|=1),n<<=1,this.readModule(0,t-4,e,t)&&(n|=1),n<<=1,this.readModule(0,t-3,e,t)&&(n|=1),n<<=1,this.readModule(0,t-2,e,t)&&(n|=1),n<<=1,this.readModule(0,t-1,e,t)&&(n|=1),n<<=1,this.readModule(1,t-1,e,t)&&(n|=1),n}readCorner3(e,t){let n=0;return this.readModule(e-1,0,e,t)&&(n|=1),n<<=1,this.readModule(e-1,t-1,e,t)&&(n|=1),n<<=1,this.readModule(0,t-3,e,t)&&(n|=1),n<<=1,this.readModule(0,t-2,e,t)&&(n|=1),n<<=1,this.readModule(0,t-1,e,t)&&(n|=1),n<<=1,this.readModule(1,t-3,e,t)&&(n|=1),n<<=1,this.readModule(1,t-2,e,t)&&(n|=1),n<<=1,this.readModule(1,t-1,e,t)&&(n|=1),n}readCorner4(e,t){let n=0;return this.readModule(e-3,0,e,t)&&(n|=1),n<<=1,this.readModule(e-2,0,e,t)&&(n|=1),n<<=1,this.readModule(e-1,0,e,t)&&(n|=1),n<<=1,this.readModule(0,t-2,e,t)&&(n|=1),n<<=1,this.readModule(0,t-1,e,t)&&(n|=1),n<<=1,this.readModule(1,t-1,e,t)&&(n|=1),n<<=1,this.readModule(2,t-1,e,t)&&(n|=1),n<<=1,this.readModule(3,t-1,e,t)&&(n|=1),n}extractDataRegion(e){const t=this.version.getSymbolSizeRows(),n=this.version.getSymbolSizeColumns();if(e.getHeight()!==t)throw new y("Dimension of bitMatrix must match the version size");const o=this.version.getDataRegionSizeRows(),c=this.version.getDataRegionSizeColumns(),d=t/o|0,h=n/c|0,g=d*o,w=h*c,E=new z(w,g);for(let A=0;A<d;++A){const S=A*o;for(let B=0;B<h;++B){const U=B*c;for(let H=0;H<o;++H){const K=A*(o+2)+1+H,oe=S+H;for(let ue=0;ue<c;++ue){const fe=B*(c+2)+1+ue;if(e.get(fe,K)){const le=U+ue;E.set(le,oe)}}}}}return E}}class Po{constructor(e,t){this.numDataCodewords=e,this.codewords=t}static getDataBlocks(e,t){const n=t.getECBlocks();let o=0;const c=n.getECBlocks();for(let H of c)o+=H.getCount();const d=new Array(o);let h=0;for(let H of c)for(let K=0;K<H.getCount();K++){const oe=H.getDataCodewords(),ue=n.getECCodewords()+oe;d[h++]=new Po(oe,new Uint8Array(ue))}const w=d[0].codewords.length-n.getECCodewords(),E=w-1;let A=0;for(let H=0;H<E;H++)for(let K=0;K<h;K++)d[K].codewords[H]=e[A++];const S=t.getVersionNumber()===24,B=S?8:h;for(let H=0;H<B;H++)d[H].codewords[w-1]=e[A++];const U=d[0].codewords.length;for(let H=w;H<U;H++)for(let K=0;K<h;K++){const oe=S?(K+8)%h:K,ue=S&&oe>7?H-1:H;d[oe].codewords[ue]=e[A++]}if(A!==e.length)throw new y;return d}getNumDataCodewords(){return this.numDataCodewords}getCodewords(){return this.codewords}}class Lo{constructor(e){this.bytes=e,this.byteOffset=0,this.bitOffset=0}getBitOffset(){return this.bitOffset}getByteOffset(){return this.byteOffset}readBits(e){if(e<1||e>32||e>this.available())throw new y(""+e);let t=0,n=this.bitOffset,o=this.byteOffset;const c=this.bytes;if(n>0){const d=8-n,h=e<d?e:d,g=d-h,w=255>>8-h<<g;t=(c[o]&w)>>g,e-=h,n+=h,n===8&&(n=0,o++)}if(e>0){for(;e>=8;)t=t<<8|c[o]&255,o++,e-=8;if(e>0){const d=8-e,h=255>>d<<d;t=t<<e|(c[o]&h)>>d,n+=e}}return this.bitOffset=n,this.byteOffset=o,t}available(){return 8*(this.bytes.length-this.byteOffset)-this.bitOffset}}var vt;(function(b){b[b.PAD_ENCODE=0]="PAD_ENCODE",b[b.ASCII_ENCODE=1]="ASCII_ENCODE",b[b.C40_ENCODE=2]="C40_ENCODE",b[b.TEXT_ENCODE=3]="TEXT_ENCODE",b[b.ANSIX12_ENCODE=4]="ANSIX12_ENCODE",b[b.EDIFACT_ENCODE=5]="EDIFACT_ENCODE",b[b.BASE256_ENCODE=6]="BASE256_ENCODE"})(vt||(vt={}));class $n{static decode(e){const t=new Lo(e),n=new G,o=new G,c=new Array;let d=vt.ASCII_ENCODE;do if(d===vt.ASCII_ENCODE)d=this.decodeAsciiSegment(t,n,o);else{switch(d){case vt.C40_ENCODE:this.decodeC40Segment(t,n);break;case vt.TEXT_ENCODE:this.decodeTextSegment(t,n);break;case vt.ANSIX12_ENCODE:this.decodeAnsiX12Segment(t,n);break;case vt.EDIFACT_ENCODE:this.decodeEdifactSegment(t,n);break;case vt.BASE256_ENCODE:this.decodeBase256Segment(t,n,c);break;default:throw new F}d=vt.ASCII_ENCODE}while(d!==vt.PAD_ENCODE&&t.available()>0);return o.length()>0&&n.append(o.toString()),new et(e,n.toString(),c.length===0?null:c,null)}static decodeAsciiSegment(e,t,n){let o=!1;do{let c=e.readBits(8);if(c===0)throw new F;if(c<=128)return o&&(c+=128),t.append(String.fromCharCode(c-1)),vt.ASCII_ENCODE;if(c===129)return vt.PAD_ENCODE;if(c<=229){const d=c-130;d<10&&t.append("0"),t.append(""+d)}else switch(c){case 230:return vt.C40_ENCODE;case 231:return vt.BASE256_ENCODE;case 232:t.append("");break;case 233:case 234:break;case 235:o=!0;break;case 236:t.append("[)>05"),n.insert(0,"");break;case 237:t.append("[)>06"),n.insert(0,"");break;case 238:return vt.ANSIX12_ENCODE;case 239:return vt.TEXT_ENCODE;case 240:return vt.EDIFACT_ENCODE;case 241:break;default:if(c!==254||e.available()!==0)throw new F;break}}while(e.available()>0);return vt.ASCII_ENCODE}static decodeC40Segment(e,t){let n=!1;const o=[];let c=0;do{if(e.available()===8)return;const d=e.readBits(8);if(d===254)return;this.parseTwoBytes(d,e.readBits(8),o);for(let h=0;h<3;h++){const g=o[h];switch(c){case 0:if(g<3)c=g+1;else if(g<this.C40_BASIC_SET_CHARS.length){const w=this.C40_BASIC_SET_CHARS[g];n?(t.append(String.fromCharCode(w.charCodeAt(0)+128)),n=!1):t.append(w)}else throw new F;break;case 1:n?(t.append(String.fromCharCode(g+128)),n=!1):t.append(String.fromCharCode(g)),c=0;break;case 2:if(g<this.C40_SHIFT2_SET_CHARS.length){const w=this.C40_SHIFT2_SET_CHARS[g];n?(t.append(String.fromCharCode(w.charCodeAt(0)+128)),n=!1):t.append(w)}else switch(g){case 27:t.append("");break;case 30:n=!0;break;default:throw new F}c=0;break;case 3:n?(t.append(String.fromCharCode(g+224)),n=!1):t.append(String.fromCharCode(g+96)),c=0;break;default:throw new F}}}while(e.available()>0)}static decodeTextSegment(e,t){let n=!1,o=[],c=0;do{if(e.available()===8)return;const d=e.readBits(8);if(d===254)return;this.parseTwoBytes(d,e.readBits(8),o);for(let h=0;h<3;h++){const g=o[h];switch(c){case 0:if(g<3)c=g+1;else if(g<this.TEXT_BASIC_SET_CHARS.length){const w=this.TEXT_BASIC_SET_CHARS[g];n?(t.append(String.fromCharCode(w.charCodeAt(0)+128)),n=!1):t.append(w)}else throw new F;break;case 1:n?(t.append(String.fromCharCode(g+128)),n=!1):t.append(String.fromCharCode(g)),c=0;break;case 2:if(g<this.TEXT_SHIFT2_SET_CHARS.length){const w=this.TEXT_SHIFT2_SET_CHARS[g];n?(t.append(String.fromCharCode(w.charCodeAt(0)+128)),n=!1):t.append(w)}else switch(g){case 27:t.append("");break;case 30:n=!0;break;default:throw new F}c=0;break;case 3:if(g<this.TEXT_SHIFT3_SET_CHARS.length){const w=this.TEXT_SHIFT3_SET_CHARS[g];n?(t.append(String.fromCharCode(w.charCodeAt(0)+128)),n=!1):t.append(w),c=0}else throw new F;break;default:throw new F}}}while(e.available()>0)}static decodeAnsiX12Segment(e,t){const n=[];do{if(e.available()===8)return;const o=e.readBits(8);if(o===254)return;this.parseTwoBytes(o,e.readBits(8),n);for(let c=0;c<3;c++){const d=n[c];switch(d){case 0:t.append("\r");break;case 1:t.append("*");break;case 2:t.append(">");break;case 3:t.append(" ");break;default:if(d<14)t.append(String.fromCharCode(d+44));else if(d<40)t.append(String.fromCharCode(d+51));else throw new F;break}}}while(e.available()>0)}static parseTwoBytes(e,t,n){let o=(e<<8)+t-1,c=Math.floor(o/1600);n[0]=c,o-=c*1600,c=Math.floor(o/40),n[1]=c,n[2]=o-c*40}static decodeEdifactSegment(e,t){do{if(e.available()<=16)return;for(let n=0;n<4;n++){let o=e.readBits(6);if(o===31){const c=8-e.getBitOffset();c!==8&&e.readBits(c);return}o&32||(o|=64),t.append(String.fromCharCode(o))}}while(e.available()>0)}static decodeBase256Segment(e,t,n){let o=1+e.getByteOffset();const c=this.unrandomize255State(e.readBits(8),o++);let d;if(c===0?d=e.available()/8|0:c<250?d=c:d=250*(c-249)+this.unrandomize255State(e.readBits(8),o++),d<0)throw new F;const h=new Uint8Array(d);for(let g=0;g<d;g++){if(e.available()<8)throw new F;h[g]=this.unrandomize255State(e.readBits(8),o++)}n.push(h);try{t.append(Q.decode(h,te.ISO88591))}catch(g){throw new Ue("Platform does not support required encoding: "+g.message)}}static unrandomize255State(e,t){const n=149*t%255+1,o=e-n;return o>=0?o:o+256}}$n.C40_BASIC_SET_CHARS=["*","*","*"," ","0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],$n.C40_SHIFT2_SET_CHARS=["!",'"',"#","$","%","&","'","(",")","*","+",",","-",".","/",":",";","<","=",">","?","@","[","\\","]","^","_"],$n.TEXT_BASIC_SET_CHARS=["*","*","*"," ","0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"],$n.TEXT_SHIFT2_SET_CHARS=$n.C40_SHIFT2_SET_CHARS,$n.TEXT_SHIFT3_SET_CHARS=["`","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","{","|","}","~",""];class bg{constructor(){this.rsDecoder=new Nt(Me.DATA_MATRIX_FIELD_256)}decode(e){const t=new vo(e),n=t.getVersion(),o=t.readCodewords(),c=Po.getDataBlocks(o,n);let d=0;for(let w of c)d+=w.getNumDataCodewords();const h=new Uint8Array(d),g=c.length;for(let w=0;w<g;w++){const E=c[w],A=E.getCodewords(),S=E.getNumDataCodewords();this.correctErrors(A,S);for(let B=0;B<S;B++)h[B*g+w]=A[B]}return $n.decode(h)}correctErrors(e,t){const n=new Int32Array(e);try{this.rsDecoder.decode(n,e.length-t)}catch{throw new O}for(let o=0;o<t;o++)e[o]=n[o]}}class Bt{constructor(e){this.image=e,this.rectangleDetector=new Dt(this.image)}detect(){const e=this.rectangleDetector.detect();let t=this.detectSolid1(e);if(t=this.detectSolid2(t),t[3]=this.correctTopRight(t),!t[3])throw new T;t=this.shiftToModuleCenter(t);const n=t[0],o=t[1],c=t[2],d=t[3];let h=this.transitionsBetween(n,d)+1,g=this.transitionsBetween(c,d)+1;(h&1)===1&&(h+=1),(g&1)===1&&(g+=1),4*h<7*g&&4*g<7*h&&(h=g=Math.max(h,g));let w=Bt.sampleGrid(this.image,n,o,c,d,h,g);return new br(w,[n,o,c,d])}static shiftPoint(e,t,n){let o=(t.getX()-e.getX())/(n+1),c=(t.getY()-e.getY())/(n+1);return new ye(e.getX()+o,e.getY()+c)}static moveAway(e,t,n){let o=e.getX(),c=e.getY();return o<t?o-=1:o+=1,c<n?c-=1:c+=1,new ye(o,c)}detectSolid1(e){let t=e[0],n=e[1],o=e[3],c=e[2],d=this.transitionsBetween(t,n),h=this.transitionsBetween(n,o),g=this.transitionsBetween(o,c),w=this.transitionsBetween(c,t),E=d,A=[c,t,n,o];return E>h&&(E=h,A[0]=t,A[1]=n,A[2]=o,A[3]=c),E>g&&(E=g,A[0]=n,A[1]=o,A[2]=c,A[3]=t),E>w&&(A[0]=o,A[1]=c,A[2]=t,A[3]=n),A}detectSolid2(e){let t=e[0],n=e[1],o=e[2],c=e[3],d=this.transitionsBetween(t,c),h=Bt.shiftPoint(n,o,(d+1)*4),g=Bt.shiftPoint(o,n,(d+1)*4),w=this.transitionsBetween(h,t),E=this.transitionsBetween(g,c);return w<E?(e[0]=t,e[1]=n,e[2]=o,e[3]=c):(e[0]=n,e[1]=o,e[2]=c,e[3]=t),e}correctTopRight(e){let t=e[0],n=e[1],o=e[2],c=e[3],d=this.transitionsBetween(t,c),h=this.transitionsBetween(n,c),g=Bt.shiftPoint(t,n,(h+1)*4),w=Bt.shiftPoint(o,n,(d+1)*4);d=this.transitionsBetween(g,c),h=this.transitionsBetween(w,c);let E=new ye(c.getX()+(o.getX()-n.getX())/(d+1),c.getY()+(o.getY()-n.getY())/(d+1)),A=new ye(c.getX()+(t.getX()-n.getX())/(h+1),c.getY()+(t.getY()-n.getY())/(h+1));if(!this.isValid(E))return this.isValid(A)?A:null;if(!this.isValid(A))return E;let S=this.transitionsBetween(g,E)+this.transitionsBetween(w,E),B=this.transitionsBetween(g,A)+this.transitionsBetween(w,A);return S>B?E:A}shiftToModuleCenter(e){let t=e[0],n=e[1],o=e[2],c=e[3],d=this.transitionsBetween(t,c)+1,h=this.transitionsBetween(o,c)+1,g=Bt.shiftPoint(t,n,h*4),w=Bt.shiftPoint(o,n,d*4);d=this.transitionsBetween(g,c)+1,h=this.transitionsBetween(w,c)+1,(d&1)===1&&(d+=1),(h&1)===1&&(h+=1);let E=(t.getX()+n.getX()+o.getX()+c.getX())/4,A=(t.getY()+n.getY()+o.getY()+c.getY())/4;t=Bt.moveAway(t,E,A),n=Bt.moveAway(n,E,A),o=Bt.moveAway(o,E,A),c=Bt.moveAway(c,E,A);let S,B;return g=Bt.shiftPoint(t,n,h*4),g=Bt.shiftPoint(g,c,d*4),S=Bt.shiftPoint(n,t,h*4),S=Bt.shiftPoint(S,o,d*4),w=Bt.shiftPoint(o,c,h*4),w=Bt.shiftPoint(w,n,d*4),B=Bt.shiftPoint(c,o,h*4),B=Bt.shiftPoint(B,t,d*4),[g,S,w,B]}isValid(e){return e.getX()>=0&&e.getX()<this.image.getWidth()&&e.getY()>0&&e.getY()<this.image.getHeight()}static sampleGrid(e,t,n,o,c,d,h){return Rn.getInstance().sampleGrid(e,d,h,.5,.5,d-.5,.5,d-.5,h-.5,.5,h-.5,t.getX(),t.getY(),c.getX(),c.getY(),o.getX(),o.getY(),n.getX(),n.getY())}transitionsBetween(e,t){let n=Math.trunc(e.getX()),o=Math.trunc(e.getY()),c=Math.trunc(t.getX()),d=Math.trunc(t.getY()),h=Math.abs(d-o)>Math.abs(c-n);if(h){let H=n;n=o,o=H,H=c,c=d,d=H}let g=Math.abs(c-n),w=Math.abs(d-o),E=-g/2,A=o<d?1:-1,S=n<c?1:-1,B=0,U=this.image.get(h?o:n,h?n:o);for(let H=n,K=o;H!==c;H+=S){let oe=this.image.get(h?K:H,h?H:K);if(oe!==U&&(B++,U=oe),E+=w,E>0){if(K===d)break;K+=A,E-=g}}return B}}class jn{constructor(){this.decoder=new bg}decode(e,t=null){let n,o;if(t!=null&&t.has(Y.PURE_BARCODE)){const w=jn.extractPureBits(e.getBlackMatrix());n=this.decoder.decode(w),o=jn.NO_POINTS}else{const w=new Bt(e.getBlackMatrix()).detect();n=this.decoder.decode(w.getBits()),o=w.getPoints()}const c=n.getRawBytes(),d=new ge(n.getText(),c,8*c.length,o,xe.DATA_MATRIX,v.currentTimeMillis()),h=n.getByteSegments();h!=null&&d.putMetadata(be.BYTE_SEGMENTS,h);const g=n.getECLevel();return g!=null&&d.putMetadata(be.ERROR_CORRECTION_LEVEL,g),d}reset(){}static extractPureBits(e){const t=e.getTopLeftOnBit(),n=e.getBottomRightOnBit();if(t==null||n==null)throw new T;const o=this.moduleSize(t,e);let c=t[1];const d=n[1];let h=t[0];const w=(n[0]-h+1)/o,E=(d-c+1)/o;if(w<=0||E<=0)throw new T;const A=o/2;c+=A,h+=A;const S=new z(w,E);for(let B=0;B<E;B++){const U=c+B*o;for(let H=0;H<w;H++)e.get(h+H*o,U)&&S.set(H,B)}return S}static moduleSize(e,t){const n=t.getWidth();let o=e[0];const c=e[1];for(;o<n&&t.get(o,c);)o++;if(o===n)throw new T;const d=o-e[0];if(d===0)throw new T;return d}}jn.NO_POINTS=[];class Ag extends Ce{constructor(e=500){super(new jn,e)}}var kr;(function(b){b[b.L=0]="L",b[b.M=1]="M",b[b.Q=2]="Q",b[b.H=3]="H"})(kr||(kr={}));class mt{constructor(e,t,n){this.value=e,this.stringValue=t,this.bits=n,mt.FOR_BITS.set(n,this),mt.FOR_VALUE.set(e,this)}getValue(){return this.value}getBits(){return this.bits}static fromString(e){switch(e){case"L":return mt.L;case"M":return mt.M;case"Q":return mt.Q;case"H":return mt.H;default:throw new C(e+"not available")}}toString(){return this.stringValue}equals(e){if(!(e instanceof mt))return!1;const t=e;return this.value===t.value}static forBits(e){if(e<0||e>=mt.FOR_BITS.size)throw new y;return mt.FOR_BITS.get(e)}}mt.FOR_BITS=new Map,mt.FOR_VALUE=new Map,mt.L=new mt(kr.L,"L",1),mt.M=new mt(kr.M,"M",0),mt.Q=new mt(kr.Q,"Q",3),mt.H=new mt(kr.H,"H",2);class $t{constructor(e){this.errorCorrectionLevel=mt.forBits(e>>3&3),this.dataMask=e&7}static numBitsDiffering(e,t){return M.bitCount(e^t)}static decodeFormatInformation(e,t){const n=$t.doDecodeFormatInformation(e,t);return n!==null?n:$t.doDecodeFormatInformation(e^$t.FORMAT_INFO_MASK_QR,t^$t.FORMAT_INFO_MASK_QR)}static doDecodeFormatInformation(e,t){let n=Number.MAX_SAFE_INTEGER,o=0;for(const c of $t.FORMAT_INFO_DECODE_LOOKUP){const d=c[0];if(d===e||d===t)return new $t(c[1]);let h=$t.numBitsDiffering(e,d);h<n&&(o=c[1],n=h),e!==t&&(h=$t.numBitsDiffering(t,d),h<n&&(o=c[1],n=h))}return n<=3?new $t(o):null}getErrorCorrectionLevel(){return this.errorCorrectionLevel}getDataMask(){return this.dataMask}hashCode(){return this.errorCorrectionLevel.getBits()<<3|this.dataMask}equals(e){if(!(e instanceof $t))return!1;const t=e;return this.errorCorrectionLevel===t.errorCorrectionLevel&&this.dataMask===t.dataMask}}$t.FORMAT_INFO_MASK_QR=21522,$t.FORMAT_INFO_DECODE_LOOKUP=[Int32Array.from([21522,0]),Int32Array.from([20773,1]),Int32Array.from([24188,2]),Int32Array.from([23371,3]),Int32Array.from([17913,4]),Int32Array.from([16590,5]),Int32Array.from([20375,6]),Int32Array.from([19104,7]),Int32Array.from([30660,8]),Int32Array.from([29427,9]),Int32Array.from([32170,10]),Int32Array.from([30877,11]),Int32Array.from([26159,12]),Int32Array.from([25368,13]),Int32Array.from([27713,14]),Int32Array.from([26998,15]),Int32Array.from([5769,16]),Int32Array.from([5054,17]),Int32Array.from([7399,18]),Int32Array.from([6608,19]),Int32Array.from([1890,20]),Int32Array.from([597,21]),Int32Array.from([3340,22]),Int32Array.from([2107,23]),Int32Array.from([13663,24]),Int32Array.from([12392,25]),Int32Array.from([16177,26]),Int32Array.from([14854,27]),Int32Array.from([9396,28]),Int32Array.from([8579,29]),Int32Array.from([11994,30]),Int32Array.from([11245,31])];class J{constructor(e,...t){this.ecCodewordsPerBlock=e,this.ecBlocks=t}getECCodewordsPerBlock(){return this.ecCodewordsPerBlock}getNumBlocks(){let e=0;const t=this.ecBlocks;for(const n of t)e+=n.getCount();return e}getTotalECCodewords(){return this.ecCodewordsPerBlock*this.getNumBlocks()}getECBlocks(){return this.ecBlocks}}class R{constructor(e,t){this.count=e,this.dataCodewords=t}getCount(){return this.count}getDataCodewords(){return this.dataCodewords}}class Ne{constructor(e,t,...n){this.versionNumber=e,this.alignmentPatternCenters=t,this.ecBlocks=n;let o=0;const c=n[0].getECCodewordsPerBlock(),d=n[0].getECBlocks();for(const h of d)o+=h.getCount()*(h.getDataCodewords()+c);this.totalCodewords=o}getVersionNumber(){return this.versionNumber}getAlignmentPatternCenters(){return this.alignmentPatternCenters}getTotalCodewords(){return this.totalCodewords}getDimensionForVersion(){return 17+4*this.versionNumber}getECBlocksForLevel(e){return this.ecBlocks[e.getValue()]}static getProvisionalVersionForDimension(e){if(e%4!==1)throw new F;try{return this.getVersionForNumber((e-17)/4)}catch{throw new F}}static getVersionForNumber(e){if(e<1||e>40)throw new y;return Ne.VERSIONS[e-1]}static decodeVersionInformation(e){let t=Number.MAX_SAFE_INTEGER,n=0;for(let o=0;o<Ne.VERSION_DECODE_INFO.length;o++){const c=Ne.VERSION_DECODE_INFO[o];if(c===e)return Ne.getVersionForNumber(o+7);const d=$t.numBitsDiffering(e,c);d<t&&(n=o+7,t=d)}return t<=3?Ne.getVersionForNumber(n):null}buildFunctionPattern(){const e=this.getDimensionForVersion(),t=new z(e);t.setRegion(0,0,9,9),t.setRegion(e-8,0,8,9),t.setRegion(0,e-8,9,8);const n=this.alignmentPatternCenters.length;for(let o=0;o<n;o++){const c=this.alignmentPatternCenters[o]-2;for(let d=0;d<n;d++)o===0&&(d===0||d===n-1)||o===n-1&&d===0||t.setRegion(this.alignmentPatternCenters[d]-2,c,5,5)}return t.setRegion(6,9,1,e-17),t.setRegion(9,6,e-17,1),this.versionNumber>6&&(t.setRegion(e-11,0,3,6),t.setRegion(0,e-11,6,3)),t}toString(){return""+this.versionNumber}}Ne.VERSION_DECODE_INFO=Int32Array.from([31892,34236,39577,42195,48118,51042,55367,58893,63784,68472,70749,76311,79154,84390,87683,92361,96236,102084,102881,110507,110734,117786,119615,126325,127568,133589,136944,141498,145311,150283,152622,158308,161089,167017]),Ne.VERSIONS=[new Ne(1,new Int32Array(0),new J(7,new R(1,19)),new J(10,new R(1,16)),new J(13,new R(1,13)),new J(17,new R(1,9))),new Ne(2,Int32Array.from([6,18]),new J(10,new R(1,34)),new J(16,new R(1,28)),new J(22,new R(1,22)),new J(28,new R(1,16))),new Ne(3,Int32Array.from([6,22]),new J(15,new R(1,55)),new J(26,new R(1,44)),new J(18,new R(2,17)),new J(22,new R(2,13))),new Ne(4,Int32Array.from([6,26]),new J(20,new R(1,80)),new J(18,new R(2,32)),new J(26,new R(2,24)),new J(16,new R(4,9))),new Ne(5,Int32Array.from([6,30]),new J(26,new R(1,108)),new J(24,new R(2,43)),new J(18,new R(2,15),new R(2,16)),new J(22,new R(2,11),new R(2,12))),new Ne(6,Int32Array.from([6,34]),new J(18,new R(2,68)),new J(16,new R(4,27)),new J(24,new R(4,19)),new J(28,new R(4,15))),new Ne(7,Int32Array.from([6,22,38]),new J(20,new R(2,78)),new J(18,new R(4,31)),new J(18,new R(2,14),new R(4,15)),new J(26,new R(4,13),new R(1,14))),new Ne(8,Int32Array.from([6,24,42]),new J(24,new R(2,97)),new J(22,new R(2,38),new R(2,39)),new J(22,new R(4,18),new R(2,19)),new J(26,new R(4,14),new R(2,15))),new Ne(9,Int32Array.from([6,26,46]),new J(30,new R(2,116)),new J(22,new R(3,36),new R(2,37)),new J(20,new R(4,16),new R(4,17)),new J(24,new R(4,12),new R(4,13))),new Ne(10,Int32Array.from([6,28,50]),new J(18,new R(2,68),new R(2,69)),new J(26,new R(4,43),new R(1,44)),new J(24,new R(6,19),new R(2,20)),new J(28,new R(6,15),new R(2,16))),new Ne(11,Int32Array.from([6,30,54]),new J(20,new R(4,81)),new J(30,new R(1,50),new R(4,51)),new J(28,new R(4,22),new R(4,23)),new J(24,new R(3,12),new R(8,13))),new Ne(12,Int32Array.from([6,32,58]),new J(24,new R(2,92),new R(2,93)),new J(22,new R(6,36),new R(2,37)),new J(26,new R(4,20),new R(6,21)),new J(28,new R(7,14),new R(4,15))),new Ne(13,Int32Array.from([6,34,62]),new J(26,new R(4,107)),new J(22,new R(8,37),new R(1,38)),new J(24,new R(8,20),new R(4,21)),new J(22,new R(12,11),new R(4,12))),new Ne(14,Int32Array.from([6,26,46,66]),new J(30,new R(3,115),new R(1,116)),new J(24,new R(4,40),new R(5,41)),new J(20,new R(11,16),new R(5,17)),new J(24,new R(11,12),new R(5,13))),new Ne(15,Int32Array.from([6,26,48,70]),new J(22,new R(5,87),new R(1,88)),new J(24,new R(5,41),new R(5,42)),new J(30,new R(5,24),new R(7,25)),new J(24,new R(11,12),new R(7,13))),new Ne(16,Int32Array.from([6,26,50,74]),new J(24,new R(5,98),new R(1,99)),new J(28,new R(7,45),new R(3,46)),new J(24,new R(15,19),new R(2,20)),new J(30,new R(3,15),new R(13,16))),new Ne(17,Int32Array.from([6,30,54,78]),new J(28,new R(1,107),new R(5,108)),new J(28,new R(10,46),new R(1,47)),new J(28,new R(1,22),new R(15,23)),new J(28,new R(2,14),new R(17,15))),new Ne(18,Int32Array.from([6,30,56,82]),new J(30,new R(5,120),new R(1,121)),new J(26,new R(9,43),new R(4,44)),new J(28,new R(17,22),new R(1,23)),new J(28,new R(2,14),new R(19,15))),new Ne(19,Int32Array.from([6,30,58,86]),new J(28,new R(3,113),new R(4,114)),new J(26,new R(3,44),new R(11,45)),new J(26,new R(17,21),new R(4,22)),new J(26,new R(9,13),new R(16,14))),new Ne(20,Int32Array.from([6,34,62,90]),new J(28,new R(3,107),new R(5,108)),new J(26,new R(3,41),new R(13,42)),new J(30,new R(15,24),new R(5,25)),new J(28,new R(15,15),new R(10,16))),new Ne(21,Int32Array.from([6,28,50,72,94]),new J(28,new R(4,116),new R(4,117)),new J(26,new R(17,42)),new J(28,new R(17,22),new R(6,23)),new J(30,new R(19,16),new R(6,17))),new Ne(22,Int32Array.from([6,26,50,74,98]),new J(28,new R(2,111),new R(7,112)),new J(28,new R(17,46)),new J(30,new R(7,24),new R(16,25)),new J(24,new R(34,13))),new Ne(23,Int32Array.from([6,30,54,78,102]),new J(30,new R(4,121),new R(5,122)),new J(28,new R(4,47),new R(14,48)),new J(30,new R(11,24),new R(14,25)),new J(30,new R(16,15),new R(14,16))),new Ne(24,Int32Array.from([6,28,54,80,106]),new J(30,new R(6,117),new R(4,118)),new J(28,new R(6,45),new R(14,46)),new J(30,new R(11,24),new R(16,25)),new J(30,new R(30,16),new R(2,17))),new Ne(25,Int32Array.from([6,32,58,84,110]),new J(26,new R(8,106),new R(4,107)),new J(28,new R(8,47),new R(13,48)),new J(30,new R(7,24),new R(22,25)),new J(30,new R(22,15),new R(13,16))),new Ne(26,Int32Array.from([6,30,58,86,114]),new J(28,new R(10,114),new R(2,115)),new J(28,new R(19,46),new R(4,47)),new J(28,new R(28,22),new R(6,23)),new J(30,new R(33,16),new R(4,17))),new Ne(27,Int32Array.from([6,34,62,90,118]),new J(30,new R(8,122),new R(4,123)),new J(28,new R(22,45),new R(3,46)),new J(30,new R(8,23),new R(26,24)),new J(30,new R(12,15),new R(28,16))),new Ne(28,Int32Array.from([6,26,50,74,98,122]),new J(30,new R(3,117),new R(10,118)),new J(28,new R(3,45),new R(23,46)),new J(30,new R(4,24),new R(31,25)),new J(30,new R(11,15),new R(31,16))),new Ne(29,Int32Array.from([6,30,54,78,102,126]),new J(30,new R(7,116),new R(7,117)),new J(28,new R(21,45),new R(7,46)),new J(30,new R(1,23),new R(37,24)),new J(30,new R(19,15),new R(26,16))),new Ne(30,Int32Array.from([6,26,52,78,104,130]),new J(30,new R(5,115),new R(10,116)),new J(28,new R(19,47),new R(10,48)),new J(30,new R(15,24),new R(25,25)),new J(30,new R(23,15),new R(25,16))),new Ne(31,Int32Array.from([6,30,56,82,108,134]),new J(30,new R(13,115),new R(3,116)),new J(28,new R(2,46),new R(29,47)),new J(30,new R(42,24),new R(1,25)),new J(30,new R(23,15),new R(28,16))),new Ne(32,Int32Array.from([6,34,60,86,112,138]),new J(30,new R(17,115)),new J(28,new R(10,46),new R(23,47)),new J(30,new R(10,24),new R(35,25)),new J(30,new R(19,15),new R(35,16))),new Ne(33,Int32Array.from([6,30,58,86,114,142]),new J(30,new R(17,115),new R(1,116)),new J(28,new R(14,46),new R(21,47)),new J(30,new R(29,24),new R(19,25)),new J(30,new R(11,15),new R(46,16))),new Ne(34,Int32Array.from([6,34,62,90,118,146]),new J(30,new R(13,115),new R(6,116)),new J(28,new R(14,46),new R(23,47)),new J(30,new R(44,24),new R(7,25)),new J(30,new R(59,16),new R(1,17))),new Ne(35,Int32Array.from([6,30,54,78,102,126,150]),new J(30,new R(12,121),new R(7,122)),new J(28,new R(12,47),new R(26,48)),new J(30,new R(39,24),new R(14,25)),new J(30,new R(22,15),new R(41,16))),new Ne(36,Int32Array.from([6,24,50,76,102,128,154]),new J(30,new R(6,121),new R(14,122)),new J(28,new R(6,47),new R(34,48)),new J(30,new R(46,24),new R(10,25)),new J(30,new R(2,15),new R(64,16))),new Ne(37,Int32Array.from([6,28,54,80,106,132,158]),new J(30,new R(17,122),new R(4,123)),new J(28,new R(29,46),new R(14,47)),new J(30,new R(49,24),new R(10,25)),new J(30,new R(24,15),new R(46,16))),new Ne(38,Int32Array.from([6,32,58,84,110,136,162]),new J(30,new R(4,122),new R(18,123)),new J(28,new R(13,46),new R(32,47)),new J(30,new R(48,24),new R(14,25)),new J(30,new R(42,15),new R(32,16))),new Ne(39,Int32Array.from([6,26,54,82,110,138,166]),new J(30,new R(20,117),new R(4,118)),new J(28,new R(40,47),new R(7,48)),new J(30,new R(43,24),new R(22,25)),new J(30,new R(10,15),new R(67,16))),new Ne(40,Int32Array.from([6,30,58,86,114,142,170]),new J(30,new R(19,118),new R(6,119)),new J(28,new R(18,47),new R(31,48)),new J(30,new R(34,24),new R(34,25)),new J(30,new R(20,15),new R(61,16)))];var Ft;(function(b){b[b.DATA_MASK_000=0]="DATA_MASK_000",b[b.DATA_MASK_001=1]="DATA_MASK_001",b[b.DATA_MASK_010=2]="DATA_MASK_010",b[b.DATA_MASK_011=3]="DATA_MASK_011",b[b.DATA_MASK_100=4]="DATA_MASK_100",b[b.DATA_MASK_101=5]="DATA_MASK_101",b[b.DATA_MASK_110=6]="DATA_MASK_110",b[b.DATA_MASK_111=7]="DATA_MASK_111"})(Ft||(Ft={}));class gn{constructor(e,t){this.value=e,this.isMasked=t}unmaskBitMatrix(e,t){for(let n=0;n<t;n++)for(let o=0;o<t;o++)this.isMasked(n,o)&&e.flip(o,n)}}gn.values=new Map([[Ft.DATA_MASK_000,new gn(Ft.DATA_MASK_000,(b,e)=>(b+e&1)===0)],[Ft.DATA_MASK_001,new gn(Ft.DATA_MASK_001,(b,e)=>(b&1)===0)],[Ft.DATA_MASK_010,new gn(Ft.DATA_MASK_010,(b,e)=>e%3===0)],[Ft.DATA_MASK_011,new gn(Ft.DATA_MASK_011,(b,e)=>(b+e)%3===0)],[Ft.DATA_MASK_100,new gn(Ft.DATA_MASK_100,(b,e)=>(Math.floor(b/2)+Math.floor(e/3)&1)===0)],[Ft.DATA_MASK_101,new gn(Ft.DATA_MASK_101,(b,e)=>b*e%6===0)],[Ft.DATA_MASK_110,new gn(Ft.DATA_MASK_110,(b,e)=>b*e%6<3)],[Ft.DATA_MASK_111,new gn(Ft.DATA_MASK_111,(b,e)=>(b+e+b*e%3&1)===0)]]);class Sg{constructor(e){const t=e.getHeight();if(t<21||(t&3)!==1)throw new F;this.bitMatrix=e}readFormatInformation(){if(this.parsedFormatInfo!==null&&this.parsedFormatInfo!==void 0)return this.parsedFormatInfo;let e=0;for(let c=0;c<6;c++)e=this.copyBit(c,8,e);e=this.copyBit(7,8,e),e=this.copyBit(8,8,e),e=this.copyBit(8,7,e);for(let c=5;c>=0;c--)e=this.copyBit(8,c,e);const t=this.bitMatrix.getHeight();let n=0;const o=t-7;for(let c=t-1;c>=o;c--)n=this.copyBit(8,c,n);for(let c=t-8;c<t;c++)n=this.copyBit(c,8,n);if(this.parsedFormatInfo=$t.decodeFormatInformation(e,n),this.parsedFormatInfo!==null)return this.parsedFormatInfo;throw new F}readVersion(){if(this.parsedVersion!==null&&this.parsedVersion!==void 0)return this.parsedVersion;const e=this.bitMatrix.getHeight(),t=Math.floor((e-17)/4);if(t<=6)return Ne.getVersionForNumber(t);let n=0;const o=e-11;for(let d=5;d>=0;d--)for(let h=e-9;h>=o;h--)n=this.copyBit(h,d,n);let c=Ne.decodeVersionInformation(n);if(c!==null&&c.getDimensionForVersion()===e)return this.parsedVersion=c,c;n=0;for(let d=5;d>=0;d--)for(let h=e-9;h>=o;h--)n=this.copyBit(d,h,n);if(c=Ne.decodeVersionInformation(n),c!==null&&c.getDimensionForVersion()===e)return this.parsedVersion=c,c;throw new F}copyBit(e,t,n){return(this.isMirror?this.bitMatrix.get(t,e):this.bitMatrix.get(e,t))?n<<1|1:n<<1}readCodewords(){const e=this.readFormatInformation(),t=this.readVersion(),n=gn.values.get(e.getDataMask()),o=this.bitMatrix.getHeight();n.unmaskBitMatrix(this.bitMatrix,o);const c=t.buildFunctionPattern();let d=!0;const h=new Uint8Array(t.getTotalCodewords());let g=0,w=0,E=0;for(let A=o-1;A>0;A-=2){A===6&&A--;for(let S=0;S<o;S++){const B=d?o-1-S:S;for(let U=0;U<2;U++)c.get(A-U,B)||(E++,w<<=1,this.bitMatrix.get(A-U,B)&&(w|=1),E===8&&(h[g++]=w,E=0,w=0))}d=!d}if(g!==t.getTotalCodewords())throw new F;return h}remask(){if(this.parsedFormatInfo===null)return;const e=gn.values[this.parsedFormatInfo.getDataMask()],t=this.bitMatrix.getHeight();e.unmaskBitMatrix(this.bitMatrix,t)}setMirror(e){this.parsedVersion=null,this.parsedFormatInfo=null,this.isMirror=e}mirror(){const e=this.bitMatrix;for(let t=0,n=e.getWidth();t<n;t++)for(let o=t+1,c=e.getHeight();o<c;o++)e.get(t,o)!==e.get(o,t)&&(e.flip(o,t),e.flip(t,o))}}class Fo{constructor(e,t){this.numDataCodewords=e,this.codewords=t}static getDataBlocks(e,t,n){if(e.length!==t.getTotalCodewords())throw new y;const o=t.getECBlocksForLevel(n);let c=0;const d=o.getECBlocks();for(const U of d)c+=U.getCount();const h=new Array(c);let g=0;for(const U of d)for(let H=0;H<U.getCount();H++){const K=U.getDataCodewords(),oe=o.getECCodewordsPerBlock()+K;h[g++]=new Fo(K,new Uint8Array(oe))}const w=h[0].codewords.length;let E=h.length-1;for(;E>=0&&h[E].codewords.length!==w;)E--;E++;const A=w-o.getECCodewordsPerBlock();let S=0;for(let U=0;U<A;U++)for(let H=0;H<g;H++)h[H].codewords[U]=e[S++];for(let U=E;U<g;U++)h[U].codewords[A]=e[S++];const B=h[0].codewords.length;for(let U=A;U<B;U++)for(let H=0;H<g;H++){const K=H<E?U:U+1;h[H].codewords[K]=e[S++]}return h}getNumDataCodewords(){return this.numDataCodewords}getCodewords(){return this.codewords}}var pn;(function(b){b[b.TERMINATOR=0]="TERMINATOR",b[b.NUMERIC=1]="NUMERIC",b[b.ALPHANUMERIC=2]="ALPHANUMERIC",b[b.STRUCTURED_APPEND=3]="STRUCTURED_APPEND",b[b.BYTE=4]="BYTE",b[b.ECI=5]="ECI",b[b.KANJI=6]="KANJI",b[b.FNC1_FIRST_POSITION=7]="FNC1_FIRST_POSITION",b[b.FNC1_SECOND_POSITION=8]="FNC1_SECOND_POSITION",b[b.HANZI=9]="HANZI"})(pn||(pn={}));class ke{constructor(e,t,n,o){this.value=e,this.stringValue=t,this.characterCountBitsForVersions=n,this.bits=o,ke.FOR_BITS.set(o,this),ke.FOR_VALUE.set(e,this)}static forBits(e){const t=ke.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 ke))return!1;const t=e;return this.value===t.value}toString(){return this.stringValue}}ke.FOR_BITS=new Map,ke.FOR_VALUE=new Map,ke.TERMINATOR=new ke(pn.TERMINATOR,"TERMINATOR",Int32Array.from([0,0,0]),0),ke.NUMERIC=new ke(pn.NUMERIC,"NUMERIC",Int32Array.from([10,12,14]),1),ke.ALPHANUMERIC=new ke(pn.ALPHANUMERIC,"ALPHANUMERIC",Int32Array.from([9,11,13]),2),ke.STRUCTURED_APPEND=new ke(pn.STRUCTURED_APPEND,"STRUCTURED_APPEND",Int32Array.from([0,0,0]),3),ke.BYTE=new ke(pn.BYTE,"BYTE",Int32Array.from([8,16,16]),4),ke.ECI=new ke(pn.ECI,"ECI",Int32Array.from([0,0,0]),7),ke.KANJI=new ke(pn.KANJI,"KANJI",Int32Array.from([8,10,12]),8),ke.FNC1_FIRST_POSITION=new ke(pn.FNC1_FIRST_POSITION,"FNC1_FIRST_POSITION",Int32Array.from([0,0,0]),5),ke.FNC1_SECOND_POSITION=new ke(pn.FNC1_SECOND_POSITION,"FNC1_SECOND_POSITION",Int32Array.from([0,0,0]),9),ke.HANZI=new ke(pn.HANZI,"HANZI",Int32Array.from([8,10,12]),13);class At{static decode(e,t,n,o){const c=new Lo(e);let d=new G;const h=new Array;let g=-1,w=-1;try{let E=null,A=!1,S;do{if(c.available()<4)S=ke.TERMINATOR;else{const B=c.readBits(4);S=ke.forBits(B)}switch(S){case ke.TERMINATOR:break;case ke.FNC1_FIRST_POSITION:case ke.FNC1_SECOND_POSITION:A=!0;break;case ke.STRUCTURED_APPEND:if(c.available()<16)throw new F;g=c.readBits(8),w=c.readBits(8);break;case ke.ECI:const B=At.parseECIValue(c);if(E=V.getCharacterSetECIByValue(B),E===null)throw new F;break;case ke.HANZI:const U=c.readBits(4),H=c.readBits(S.getCharacterCountBits(t));U===At.GB2312_SUBSET&&At.decodeHanziSegment(c,d,H);break;default:const K=c.readBits(S.getCharacterCountBits(t));switch(S){case ke.NUMERIC:At.decodeNumericSegment(c,d,K);break;case ke.ALPHANUMERIC:At.decodeAlphanumericSegment(c,d,K,A);break;case ke.BYTE:At.decodeByteSegment(c,d,K,E,h,o);break;case ke.KANJI:At.decodeKanjiSegment(c,d,K);break;default:throw new F}break}}while(S!==ke.TERMINATOR)}catch{throw new F}return new et(e,d.toString(),h.length===0?null:h,n===null?null:n.toString(),g,w)}static decodeHanziSegment(e,t,n){if(n*13>e.available())throw new F;const o=new Uint8Array(2*n);let c=0;for(;n>0;){const d=e.readBits(13);let h=d/96<<8&4294967295|d%96;h<959?h+=41377:h+=42657,o[c]=h>>8&255,o[c+1]=h&255,c+=2,n--}try{t.append(Q.decode(o,te.GB2312))}catch(d){throw new F(d)}}static decodeKanjiSegment(e,t,n){if(n*13>e.available())throw new F;const o=new Uint8Array(2*n);let c=0;for(;n>0;){const d=e.readBits(13);let h=d/192<<8&4294967295|d%192;h<7936?h+=33088:h+=49472,o[c]=h>>8,o[c+1]=h,c+=2,n--}try{t.append(Q.decode(o,te.SHIFT_JIS))}catch(d){throw new F(d)}}static decodeByteSegment(e,t,n,o,c,d){if(8*n>e.available())throw new F;const h=new Uint8Array(n);for(let w=0;w<n;w++)h[w]=e.readBits(8);let g;o===null?g=te.guessEncoding(h,d):g=o.getName();try{t.append(Q.decode(h,g))}catch(w){throw new F(w)}c.push(h)}static toAlphaNumericChar(e){if(e>=At.ALPHANUMERIC_CHARS.length)throw new F;return At.ALPHANUMERIC_CHARS[e]}static decodeAlphanumericSegment(e,t,n,o){const c=t.length();for(;n>1;){if(e.available()<11)throw new F;const d=e.readBits(11);t.append(At.toAlphaNumericChar(Math.floor(d/45))),t.append(At.toAlphaNumericChar(d%45)),n-=2}if(n===1){if(e.available()<6)throw new F;t.append(At.toAlphaNumericChar(e.readBits(6)))}if(o)for(let d=c;d<t.length();d++)t.charAt(d)==="%"&&(d<t.length()-1&&t.charAt(d+1)==="%"?t.deleteCharAt(d+1):t.setCharAt(d,""))}static decodeNumericSegment(e,t,n){for(;n>=3;){if(e.available()<10)throw new F;const o=e.readBits(10);if(o>=1e3)throw new F;t.append(At.toAlphaNumericChar(Math.floor(o/100))),t.append(At.toAlphaNumericChar(Math.floor(o/10)%10)),t.append(At.toAlphaNumericChar(o%10)),n-=3}if(n===2){if(e.available()<7)throw new F;const o=e.readBits(7);if(o>=100)throw new F;t.append(At.toAlphaNumericChar(Math.floor(o/10))),t.append(At.toAlphaNumericChar(o%10))}else if(n===1){if(e.available()<4)throw new F;const o=e.readBits(4);if(o>=10)throw new F;t.append(At.toAlphaNumericChar(o))}}static parseECIValue(e){const t=e.readBits(8);if(!(t&128))return t&127;if((t&192)===128){const n=e.readBits(8);return(t&63)<<8&4294967295|n}if((t&224)===192){const n=e.readBits(16);return(t&31)<<16&4294967295|n}throw new F}}At.ALPHANUMERIC_CHARS="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:",At.GB2312_SUBSET=1;class ja{constructor(e){this.mirrored=e}isMirrored(){return this.mirrored}applyMirroredCorrection(e){if(!this.mirrored||e===null||e.length<3)return;const t=e[0];e[0]=e[2],e[2]=t}}class Ig{constructor(){this.rsDecoder=new Nt(Me.QR_CODE_FIELD_256)}decodeBooleanArray(e,t){return this.decodeBitMatrix(z.parseFromBooleanArray(e),t)}decodeBitMatrix(e,t){const n=new Sg(e);let o=null;try{return this.decodeBitMatrixParser(n,t)}catch(c){o=c}try{n.remask(),n.setMirror(!0),n.readVersion(),n.readFormatInformation(),n.mirror();const c=this.decodeBitMatrixParser(n,t);return c.setOther(new ja(!0)),c}catch(c){throw o!==null?o:c}}decodeBitMatrixParser(e,t){const n=e.readVersion(),o=e.readFormatInformation().getErrorCorrectionLevel(),c=e.readCodewords(),d=Fo.getDataBlocks(c,n,o);let h=0;for(const E of d)h+=E.getNumDataCodewords();const g=new Uint8Array(h);let w=0;for(const E of d){const A=E.getCodewords(),S=E.getNumDataCodewords();this.correctErrors(A,S);for(let B=0;B<S;B++)g[w++]=A[B]}return At.decode(g,n,o,t)}correctErrors(e,t){const n=new Int32Array(e);try{this.rsDecoder.decode(n,e.length-t)}catch{throw new O}for(let o=0;o<t;o++)e[o]=n[o]}}class Vo extends ye{constructor(e,t,n){super(e,t),this.estimatedModuleSize=n}aboutEquals(e,t,n){if(Math.abs(t-this.getY())<=e&&Math.abs(n-this.getX())<=e){const o=Math.abs(e-this.estimatedModuleSize);return o<=1||o<=this.estimatedModuleSize}return!1}combineEstimate(e,t,n){const o=(this.getX()+t)/2,c=(this.getY()+e)/2,d=(this.estimatedModuleSize+n)/2;return new Vo(o,c,d)}}class Di{constructor(e,t,n,o,c,d,h){this.image=e,this.startX=t,this.startY=n,this.width=o,this.height=c,this.moduleSize=d,this.resultPointCallback=h,this.possibleCenters=[],this.crossCheckStateCount=new Int32Array(3)}find(){const e=this.startX,t=this.height,n=this.width,o=e+n,c=this.startY+t/2,d=new Int32Array(3),h=this.image;for(let g=0;g<t;g++){const w=c+(g&1?-Math.floor((g+1)/2):Math.floor((g+1)/2));d[0]=0,d[1]=0,d[2]=0;let E=e;for(;E<o&&!h.get(E,w);)E++;let A=0;for(;E<o;){if(h.get(E,w))if(A===1)d[1]++;else if(A===2){if(this.foundPatternCross(d)){const S=this.handlePossibleCenter(d,w,E);if(S!==null)return S}d[0]=d[2],d[1]=1,d[2]=0,A=1}else d[++A]++;else A===1&&A++,d[A]++;E++}if(this.foundPatternCross(d)){const S=this.handlePossibleCenter(d,w,o);if(S!==null)return S}}if(this.possibleCenters.length!==0)return this.possibleCenters[0];throw new T}static centerFromEnd(e,t){return t-e[2]-e[1]/2}foundPatternCross(e){const t=this.moduleSize,n=t/2;for(let o=0;o<3;o++)if(Math.abs(t-e[o])>=n)return!1;return!0}crossCheckVertical(e,t,n,o){const c=this.image,d=c.getHeight(),h=this.crossCheckStateCount;h[0]=0,h[1]=0,h[2]=0;let g=e;for(;g>=0&&c.get(t,g)&&h[1]<=n;)h[1]++,g--;if(g<0||h[1]>n)return NaN;for(;g>=0&&!c.get(t,g)&&h[0]<=n;)h[0]++,g--;if(h[0]>n)return NaN;for(g=e+1;g<d&&c.get(t,g)&&h[1]<=n;)h[1]++,g++;if(g===d||h[1]>n)return NaN;for(;g<d&&!c.get(t,g)&&h[2]<=n;)h[2]++,g++;if(h[2]>n)return NaN;const w=h[0]+h[1]+h[2];return 5*Math.abs(w-o)>=2*o?NaN:this.foundPatternCross(h)?Di.centerFromEnd(h,g):NaN}handlePossibleCenter(e,t,n){const o=e[0]+e[1]+e[2],c=Di.centerFromEnd(e,n),d=this.crossCheckVertical(t,c,2*e[1],o);if(!isNaN(d)){const h=(e[0]+e[1]+e[2])/3;for(const w of this.possibleCenters)if(w.aboutEquals(h,d,c))return w.combineEstimate(d,c,h);const g=new Vo(c,d,h);this.possibleCenters.push(g),this.resultPointCallback!==null&&this.resultPointCallback!==void 0&&this.resultPointCallback.foundPossibleResultPoint(g)}return null}}class Uo extends ye{constructor(e,t,n,o){super(e,t),this.estimatedModuleSize=n,this.count=o,o===void 0&&(this.count=1)}getEstimatedModuleSize(){return this.estimatedModuleSize}getCount(){return this.count}aboutEquals(e,t,n){if(Math.abs(t-this.getY())<=e&&Math.abs(n-this.getX())<=e){const o=Math.abs(e-this.estimatedModuleSize);return o<=1||o<=this.estimatedModuleSize}return!1}combineEstimate(e,t,n){const o=this.count+1,c=(this.count*this.getX()+t)/o,d=(this.count*this.getY()+e)/o,h=(this.count*this.estimatedModuleSize+n)/o;return new Uo(c,d,h,o)}}class Ng{constructor(e){this.bottomLeft=e[0],this.topLeft=e[1],this.topRight=e[2]}getBottomLeft(){return this.bottomLeft}getTopLeft(){return this.topLeft}getTopRight(){return this.topRight}}class Vt{constructor(e,t){this.image=e,this.resultPointCallback=t,this.possibleCenters=[],this.crossCheckStateCount=new Int32Array(5),this.resultPointCallback=t}getImage(){return this.image}getPossibleCenters(){return this.possibleCenters}find(e){const t=e!=null&&e.get(Y.TRY_HARDER)!==void 0,n=e!=null&&e.get(Y.PURE_BARCODE)!==void 0,o=this.image,c=o.getHeight(),d=o.getWidth();let h=Math.floor(3*c/(4*Vt.MAX_MODULES));(h<Vt.MIN_SKIP||t)&&(h=Vt.MIN_SKIP);let g=!1;const w=new Int32Array(5);for(let A=h-1;A<c&&!g;A+=h){w[0]=0,w[1]=0,w[2]=0,w[3]=0,w[4]=0;let S=0;for(let B=0;B<d;B++)if(o.get(B,A))(S&1)===1&&S++,w[S]++;else if(S&1)w[S]++;else if(S===4)if(Vt.foundPatternCross(w)){if(this.handlePossibleCenter(w,A,B,n)===!0)if(h=2,this.hasSkipped===!0)g=this.haveMultiplyConfirmedCenters();else{const H=this.findRowSkip();H>w[2]&&(A+=H-w[2]-h,B=d-1)}else{w[0]=w[2],w[1]=w[3],w[2]=w[4],w[3]=1,w[4]=0,S=3;continue}S=0,w[0]=0,w[1]=0,w[2]=0,w[3]=0,w[4]=0}else w[0]=w[2],w[1]=w[3],w[2]=w[4],w[3]=1,w[4]=0,S=3;else w[++S]++;Vt.foundPatternCross(w)&&this.handlePossibleCenter(w,A,d,n)===!0&&(h=w[0],this.hasSkipped&&(g=this.haveMultiplyConfirmedCenters()))}const E=this.selectBestPatterns();return ye.orderBestPatterns(E),new Ng(E)}static centerFromEnd(e,t){return t-e[4]-e[3]-e[2]/2}static foundPatternCross(e){let t=0;for(let c=0;c<5;c++){const d=e[c];if(d===0)return!1;t+=d}if(t<7)return!1;const n=t/7,o=n/2;return Math.abs(n-e[0])<o&&Math.abs(n-e[1])<o&&Math.abs(3*n-e[2])<3*o&&Math.abs(n-e[3])<o&&Math.abs(n-e[4])<o}getCrossCheckStateCount(){const e=this.crossCheckStateCount;return e[0]=0,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e}crossCheckDiagonal(e,t,n,o){const c=this.getCrossCheckStateCount();let d=0;const h=this.image;for(;e>=d&&t>=d&&h.get(t-d,e-d);)c[2]++,d++;if(e<d||t<d)return!1;for(;e>=d&&t>=d&&!h.get(t-d,e-d)&&c[1]<=n;)c[1]++,d++;if(e<d||t<d||c[1]>n)return!1;for(;e>=d&&t>=d&&h.get(t-d,e-d)&&c[0]<=n;)c[0]++,d++;if(c[0]>n)return!1;const g=h.getHeight(),w=h.getWidth();for(d=1;e+d<g&&t+d<w&&h.get(t+d,e+d);)c[2]++,d++;if(e+d>=g||t+d>=w)return!1;for(;e+d<g&&t+d<w&&!h.get(t+d,e+d)&&c[3]<n;)c[3]++,d++;if(e+d>=g||t+d>=w||c[3]>=n)return!1;for(;e+d<g&&t+d<w&&h.get(t+d,e+d)&&c[4]<n;)c[4]++,d++;if(c[4]>=n)return!1;const E=c[0]+c[1]+c[2]+c[3]+c[4];return Math.abs(E-o)<2*o&&Vt.foundPatternCross(c)}crossCheckVertical(e,t,n,o){const c=this.image,d=c.getHeight(),h=this.getCrossCheckStateCount();let g=e;for(;g>=0&&c.get(t,g);)h[2]++,g--;if(g<0)return NaN;for(;g>=0&&!c.get(t,g)&&h[1]<=n;)h[1]++,g--;if(g<0||h[1]>n)return NaN;for(;g>=0&&c.get(t,g)&&h[0]<=n;)h[0]++,g--;if(h[0]>n)return NaN;for(g=e+1;g<d&&c.get(t,g);)h[2]++,g++;if(g===d)return NaN;for(;g<d&&!c.get(t,g)&&h[3]<n;)h[3]++,g++;if(g===d||h[3]>=n)return NaN;for(;g<d&&c.get(t,g)&&h[4]<n;)h[4]++,g++;if(h[4]>=n)return NaN;const w=h[0]+h[1]+h[2]+h[3]+h[4];return 5*Math.abs(w-o)>=2*o?NaN:Vt.foundPatternCross(h)?Vt.centerFromEnd(h,g):NaN}crossCheckHorizontal(e,t,n,o){const c=this.image,d=c.getWidth(),h=this.getCrossCheckStateCount();let g=e;for(;g>=0&&c.get(g,t);)h[2]++,g--;if(g<0)return NaN;for(;g>=0&&!c.get(g,t)&&h[1]<=n;)h[1]++,g--;if(g<0||h[1]>n)return NaN;for(;g>=0&&c.get(g,t)&&h[0]<=n;)h[0]++,g--;if(h[0]>n)return NaN;for(g=e+1;g<d&&c.get(g,t);)h[2]++,g++;if(g===d)return NaN;for(;g<d&&!c.get(g,t)&&h[3]<n;)h[3]++,g++;if(g===d||h[3]>=n)return NaN;for(;g<d&&c.get(g,t)&&h[4]<n;)h[4]++,g++;if(h[4]>=n)return NaN;const w=h[0]+h[1]+h[2]+h[3]+h[4];return 5*Math.abs(w-o)>=o?NaN:Vt.foundPatternCross(h)?Vt.centerFromEnd(h,g):NaN}handlePossibleCenter(e,t,n,o){const c=e[0]+e[1]+e[2]+e[3]+e[4];let d=Vt.centerFromEnd(e,n),h=this.crossCheckVertical(t,Math.floor(d),e[2],c);if(!isNaN(h)&&(d=this.crossCheckHorizontal(Math.floor(d),Math.floor(h),e[2],c),!isNaN(d)&&(!o||this.crossCheckDiagonal(Math.floor(h),Math.floor(d),e[2],c)))){const g=c/7;let w=!1;const E=this.possibleCenters;for(let A=0,S=E.length;A<S;A++){const B=E[A];if(B.aboutEquals(g,h,d)){E[A]=B.combineEstimate(h,d,g),w=!0;break}}if(!w){const A=new Uo(d,h,g);E.push(A),this.resultPointCallback!==null&&this.resultPointCallback!==void 0&&this.resultPointCallback.foundPossibleResultPoint(A)}return!0}return!1}findRowSkip(){if(this.possibleCenters.length<=1)return 0;let t=null;for(const n of this.possibleCenters)if(n.getCount()>=Vt.CENTER_QUORUM)if(t==null)t=n;else return this.hasSkipped=!0,Math.floor((Math.abs(t.getX()-n.getX())-Math.abs(t.getY()-n.getY()))/2);return 0}haveMultiplyConfirmedCenters(){let e=0,t=0;const n=this.possibleCenters.length;for(const d of this.possibleCenters)d.getCount()>=Vt.CENTER_QUORUM&&(e++,t+=d.getEstimatedModuleSize());if(e<3)return!1;const o=t/n;let c=0;for(const d of this.possibleCenters)c+=Math.abs(d.getEstimatedModuleSize()-o);return c<=.05*t}selectBestPatterns(){const e=this.possibleCenters.length;if(e<3)throw new T;const t=this.possibleCenters;let n;if(e>3){let o=0,c=0;for(const g of this.possibleCenters){const w=g.getEstimatedModuleSize();o+=w,c+=w*w}n=o/e;let d=Math.sqrt(c/e-n*n);t.sort((g,w)=>{const E=Math.abs(w.getEstimatedModuleSize()-n),A=Math.abs(g.getEstimatedModuleSize()-n);return E<A?-1:E>A?1:0});const h=Math.max(.2*n,d);for(let g=0;g<t.length&&t.length>3;g++){const w=t[g];Math.abs(w.getEstimatedModuleSize()-n)>h&&(t.splice(g,1),g--)}}if(t.length>3){let o=0;for(const c of t)o+=c.getEstimatedModuleSize();n=o/t.length,t.sort((c,d)=>{if(d.getCount()===c.getCount()){const h=Math.abs(d.getEstimatedModuleSize()-n),g=Math.abs(c.getEstimatedModuleSize()-n);return h<g?1:h>g?-1:0}else return d.getCount()-c.getCount()}),t.splice(3)}return[t[0],t[1],t[2]]}}Vt.CENTER_QUORUM=2,Vt.MIN_SKIP=3,Vt.MAX_MODULES=57;class Zr{constructor(e){this.image=e}getImage(){return this.image}getResultPointCallback(){return this.resultPointCallback}detect(e){this.resultPointCallback=e==null?null:e.get(Y.NEED_RESULT_POINT_CALLBACK);const n=new Vt(this.image,this.resultPointCallback).find(e);return this.processFinderPatternInfo(n)}processFinderPatternInfo(e){const t=e.getTopLeft(),n=e.getTopRight(),o=e.getBottomLeft(),c=this.calculateModuleSize(t,n,o);if(c<1)throw new T("No pattern found in proccess finder.");const d=Zr.computeDimension(t,n,o,c),h=Ne.getProvisionalVersionForDimension(d),g=h.getDimensionForVersion()-7;let w=null;if(h.getAlignmentPatternCenters().length>0){const B=n.getX()-t.getX()+o.getX(),U=n.getY()-t.getY()+o.getY(),H=1-3/g,K=Math.floor(t.getX()+H*(B-t.getX())),oe=Math.floor(t.getY()+H*(U-t.getY()));for(let ue=4;ue<=16;ue<<=1)try{w=this.findAlignmentInRegion(c,K,oe,ue);break}catch(fe){if(!(fe instanceof T))throw fe}}const E=Zr.createTransform(t,n,o,w,d),A=Zr.sampleGrid(this.image,E,d);let S;return w===null?S=[o,t,n]:S=[o,t,n,w],new br(A,S)}static createTransform(e,t,n,o,c){const d=c-3.5;let h,g,w,E;return o!==null?(h=o.getX(),g=o.getY(),w=d-3,E=w):(h=t.getX()-e.getX()+n.getX(),g=t.getY()-e.getY()+n.getY(),w=d,E=d),dn.quadrilateralToQuadrilateral(3.5,3.5,d,3.5,w,E,3.5,d,e.getX(),e.getY(),t.getX(),t.getY(),h,g,n.getX(),n.getY())}static sampleGrid(e,t,n){return Rn.getInstance().sampleGridWithTransform(e,n,n,t)}static computeDimension(e,t,n,o){const c=ve.round(ye.distance(e,t)/o),d=ve.round(ye.distance(e,n)/o);let h=Math.floor((c+d)/2)+7;switch(h&3){case 0:h++;break;case 2:h--;break;case 3:throw new T("Dimensions could be not found.")}return h}calculateModuleSize(e,t,n){return(this.calculateModuleSizeOneWay(e,t)+this.calculateModuleSizeOneWay(e,n))/2}calculateModuleSizeOneWay(e,t){const n=this.sizeOfBlackWhiteBlackRunBothWays(Math.floor(e.getX()),Math.floor(e.getY()),Math.floor(t.getX()),Math.floor(t.getY())),o=this.sizeOfBlackWhiteBlackRunBothWays(Math.floor(t.getX()),Math.floor(t.getY()),Math.floor(e.getX()),Math.floor(e.getY()));return isNaN(n)?o/7:isNaN(o)?n/7:(n+o)/14}sizeOfBlackWhiteBlackRunBothWays(e,t,n,o){let c=this.sizeOfBlackWhiteBlackRun(e,t,n,o),d=1,h=e-(n-e);h<0?(d=e/(e-h),h=0):h>=this.image.getWidth()&&(d=(this.image.getWidth()-1-e)/(h-e),h=this.image.getWidth()-1);let g=Math.floor(t-(o-t)*d);return d=1,g<0?(d=t/(t-g),g=0):g>=this.image.getHeight()&&(d=(this.image.getHeight()-1-t)/(g-t),g=this.image.getHeight()-1),h=Math.floor(e+(h-e)*d),c+=this.sizeOfBlackWhiteBlackRun(e,t,h,g),c-1}sizeOfBlackWhiteBlackRun(e,t,n,o){const c=Math.abs(o-t)>Math.abs(n-e);if(c){let B=e;e=t,t=B,B=n,n=o,o=B}const d=Math.abs(n-e),h=Math.abs(o-t);let g=-d/2;const w=e<n?1:-1,E=t<o?1:-1;let A=0;const S=n+w;for(let B=e,U=t;B!==S;B+=w){const H=c?U:B,K=c?B:U;if(A===1===this.image.get(H,K)){if(A===2)return ve.distance(B,U,e,t);A++}if(g+=h,g>0){if(U===o)break;U+=E,g-=d}}return A===2?ve.distance(n+w,o,e,t):NaN}findAlignmentInRegion(e,t,n,o){const c=Math.floor(o*e),d=Math.max(0,t-c),h=Math.min(this.image.getWidth()-1,t+c);if(h-d<e*3)throw new T("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 T("Alignment bottom exceeds estimated module size.");return new Di(this.image,d,g,h-d,w-g,e,this.resultPointCallback).find()}}class qn{constructor(){this.decoder=new Ig}getDecoder(){return this.decoder}decode(e,t){let n,o;if(t!=null&&t.get(Y.PURE_BARCODE)!==void 0){const g=qn.extractPureBits(e.getBlackMatrix());n=this.decoder.decodeBitMatrix(g,t),o=qn.NO_POINTS}else{const g=new Zr(e.getBlackMatrix()).detect(t);n=this.decoder.decodeBitMatrix(g.getBits(),t),o=g.getPoints()}n.getOther()instanceof ja&&n.getOther().applyMirroredCorrection(o);const c=new ge(n.getText(),n.getRawBytes(),void 0,o,xe.QR_CODE,void 0),d=n.getByteSegments();d!==null&&c.putMetadata(be.BYTE_SEGMENTS,d);const h=n.getECLevel();return h!==null&&c.putMetadata(be.ERROR_CORRECTION_LEVEL,h),n.hasStructuredAppend()&&(c.putMetadata(be.STRUCTURED_APPEND_SEQUENCE,n.getStructuredAppendSequenceNumber()),c.putMetadata(be.STRUCTURED_APPEND_PARITY,n.getStructuredAppendParity())),c}reset(){}static extractPureBits(e){const t=e.getTopLeftOnBit(),n=e.getBottomRightOnBit();if(t===null||n===null)throw new T;const o=this.moduleSize(t,e);let c=t[1],d=n[1],h=t[0],g=n[0];if(h>=g||c>=d)throw new T;if(d-c!==g-h&&(g=h+(d-c),g>=e.getWidth()))throw new T;const w=Math.round((g-h+1)/o),E=Math.round((d-c+1)/o);if(w<=0||E<=0)throw new T;if(E!==w)throw new T;const A=Math.floor(o/2);c+=A,h+=A;const S=h+Math.floor((w-1)*o)-g;if(S>0){if(S>A)throw new T;h-=S}const B=c+Math.floor((E-1)*o)-d;if(B>0){if(B>A)throw new T;c-=B}const U=new z(w,E);for(let H=0;H<E;H++){const K=c+Math.floor(H*o);for(let oe=0;oe<w;oe++)e.get(h+Math.floor(oe*o),K)&&U.set(oe,H)}return U}static moduleSize(e,t){const n=t.getHeight(),o=t.getWidth();let c=e[0],d=e[1],h=!0,g=0;for(;c<o&&d<n;){if(h!==t.get(c,d)){if(++g===5)break;h=!h}c++,d++}if(c===o||d===n)throw new T;return(c-e[0])/7}}qn.NO_POINTS=new Array;class Oe{PDF417Common(){}static getBitCountSum(e){return ve.sum(e)}static toIntArray(e){if(e==null||!e.length)return Oe.EMPTY_INT_ARRAY;const t=new Int32Array(e.length);let n=0;for(const o of e)t[n++]=o;return t}static getCodeword(e){const t=D.binarySearch(Oe.SYMBOL_TABLE,e&262143);return t<0?-1:(Oe.CODEWORD_TABLE[t]-1)%Oe.NUMBER_OF_CODEWORDS}}Oe.NUMBER_OF_CODEWORDS=929,Oe.MAX_CODEWORDS_IN_BARCODE=Oe.NUMBER_OF_CODEWORDS-1,Oe.MIN_ROWS_IN_BARCODE=3,Oe.MAX_ROWS_IN_BARCODE=90,Oe.MODULES_IN_CODEWORD=17,Oe.MODULES_IN_STOP_PATTERN=18,Oe.BARS_IN_MODULE=8,Oe.EMPTY_INT_ARRAY=new Int32Array([]),Oe.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]),Oe.CODEWORD_TABLE=Int32Array.from([2627,1819,2622,2621,1813,1812,2729,2724,2723,2779,2774,2773,902,896,908,868,865,861,859,2511,873,871,1780,835,2493,825,2491,842,837,844,1764,1762,811,810,809,2483,807,2482,806,2480,815,814,813,812,2484,817,816,1745,1744,1742,1746,2655,2637,2635,2626,2625,2623,2628,1820,2752,2739,2737,2728,2727,2725,2730,2785,2783,2778,2777,2775,2780,787,781,747,739,736,2413,754,752,1719,692,689,681,2371,678,2369,700,697,694,703,1688,1686,642,638,2343,631,2341,627,2338,651,646,643,2345,654,652,1652,1650,1647,1654,601,599,2322,596,2321,594,2319,2317,611,610,608,606,2324,603,2323,615,614,612,1617,1616,1614,1612,616,1619,1618,2575,2538,2536,905,901,898,909,2509,2507,2504,870,867,864,860,2512,875,872,1781,2490,2489,2487,2485,1748,836,834,832,830,2494,827,2492,843,841,839,845,1765,1763,2701,2676,2674,2653,2648,2656,2634,2633,2631,2629,1821,2638,2636,2770,2763,2761,2750,2745,2753,2736,2735,2733,2731,1848,2740,2738,2786,2784,591,588,576,569,566,2296,1590,537,534,526,2276,522,2274,545,542,539,548,1572,1570,481,2245,466,2242,462,2239,492,485,482,2249,496,494,1534,1531,1528,1538,413,2196,406,2191,2188,425,419,2202,415,2199,432,430,427,1472,1467,1464,433,1476,1474,368,367,2160,365,2159,362,2157,2155,2152,378,377,375,2166,372,2165,369,2162,383,381,379,2168,1419,1418,1416,1414,385,1411,384,1423,1422,1420,1424,2461,802,2441,2439,790,786,783,794,2409,2406,2403,750,742,738,2414,756,753,1720,2367,2365,2362,2359,1663,693,691,684,2373,680,2370,702,699,696,704,1690,1687,2337,2336,2334,2332,1624,2329,1622,640,637,2344,634,2342,630,2340,650,648,645,2346,655,653,1653,1651,1649,1655,2612,2597,2595,2571,2568,2565,2576,2534,2529,2526,1787,2540,2537,907,904,900,910,2503,2502,2500,2498,1768,2495,1767,2510,2508,2506,869,866,863,2513,876,874,1782,2720,2713,2711,2697,2694,2691,2702,2672,2670,2664,1828,2678,2675,2647,2646,2644,2642,1823,2639,1822,2654,2652,2650,2657,2771,1855,2765,2762,1850,1849,2751,2749,2747,2754,353,2148,344,342,336,2142,332,2140,345,1375,1373,306,2130,299,2128,295,2125,319,314,311,2132,1354,1352,1349,1356,262,257,2101,253,2096,2093,274,273,267,2107,263,2104,280,278,275,1316,1311,1308,1320,1318,2052,202,2050,2044,2040,219,2063,212,2060,208,2055,224,221,2066,1260,1258,1252,231,1248,229,1266,1264,1261,1268,155,1998,153,1996,1994,1991,1988,165,164,2007,162,2006,159,2003,2e3,172,171,169,2012,166,2010,1186,1184,1182,1179,175,1176,173,1192,1191,1189,1187,176,1194,1193,2313,2307,2305,592,589,2294,2292,2289,578,572,568,2297,580,1591,2272,2267,2264,1547,538,536,529,2278,525,2275,547,544,541,1574,1571,2237,2235,2229,1493,2225,1489,478,2247,470,2244,465,2241,493,488,484,2250,498,495,1536,1533,1530,1539,2187,2186,2184,2182,1432,2179,1430,2176,1427,414,412,2197,409,2195,405,2193,2190,426,424,421,2203,418,2201,431,429,1473,1471,1469,1466,434,1477,1475,2478,2472,2470,2459,2457,2454,2462,803,2437,2432,2429,1726,2443,2440,792,789,785,2401,2399,2393,1702,2389,1699,2411,2408,2405,745,741,2415,758,755,1721,2358,2357,2355,2353,1661,2350,1660,2347,1657,2368,2366,2364,2361,1666,690,687,2374,683,2372,701,698,705,1691,1689,2619,2617,2610,2608,2605,2613,2593,2588,2585,1803,2599,2596,2563,2561,2555,1797,2551,1795,2573,2570,2567,2577,2525,2524,2522,2520,1786,2517,1785,2514,1783,2535,2533,2531,2528,1788,2541,2539,906,903,911,2721,1844,2715,2712,1838,1836,2699,2696,2693,2703,1827,1826,1824,2673,2671,2669,2666,1829,2679,2677,1858,1857,2772,1854,1853,1851,1856,2766,2764,143,1987,139,1986,135,133,131,1984,128,1983,125,1981,138,137,136,1985,1133,1132,1130,112,110,1974,107,1973,104,1971,1969,122,121,119,117,1977,114,1976,124,1115,1114,1112,1110,1117,1116,84,83,1953,81,1952,78,1950,1948,1945,94,93,91,1959,88,1958,85,1955,99,97,95,1961,1086,1085,1083,1081,1078,100,1090,1089,1087,1091,49,47,1917,44,1915,1913,1910,1907,59,1926,56,1925,53,1922,1919,66,64,1931,61,1929,1042,1040,1038,71,1035,70,1032,68,1048,1047,1045,1043,1050,1049,12,10,1869,1867,1864,1861,21,1880,19,1877,1874,1871,28,1888,25,1886,22,1883,982,980,977,974,32,30,991,989,987,984,34,995,994,992,2151,2150,2147,2146,2144,356,355,354,2149,2139,2138,2136,2134,1359,343,341,338,2143,335,2141,348,347,346,1376,1374,2124,2123,2121,2119,1326,2116,1324,310,308,305,2131,302,2129,298,2127,320,318,316,313,2133,322,321,1355,1353,1351,1357,2092,2091,2089,2087,1276,2084,1274,2081,1271,259,2102,256,2100,252,2098,2095,272,269,2108,266,2106,281,279,277,1317,1315,1313,1310,282,1321,1319,2039,2037,2035,2032,1203,2029,1200,1197,207,2053,205,2051,201,2049,2046,2043,220,218,2064,215,2062,211,2059,228,226,223,2069,1259,1257,1254,232,1251,230,1267,1265,1263,2316,2315,2312,2311,2309,2314,2304,2303,2301,2299,1593,2308,2306,590,2288,2287,2285,2283,1578,2280,1577,2295,2293,2291,579,577,574,571,2298,582,581,1592,2263,2262,2260,2258,1545,2255,1544,2252,1541,2273,2271,2269,2266,1550,535,532,2279,528,2277,546,543,549,1575,1573,2224,2222,2220,1486,2217,1485,2214,1482,1479,2238,2236,2234,2231,1496,2228,1492,480,477,2248,473,2246,469,2243,490,487,2251,497,1537,1535,1532,2477,2476,2474,2479,2469,2468,2466,2464,1730,2473,2471,2453,2452,2450,2448,1729,2445,1728,2460,2458,2456,2463,805,804,2428,2427,2425,2423,1725,2420,1724,2417,1722,2438,2436,2434,2431,1727,2444,2442,793,791,788,795,2388,2386,2384,1697,2381,1696,2378,1694,1692,2402,2400,2398,2395,1703,2392,1701,2412,2410,2407,751,748,744,2416,759,757,1807,2620,2618,1806,1805,2611,2609,2607,2614,1802,1801,1799,2594,2592,2590,2587,1804,2600,2598,1794,1793,1791,1789,2564,2562,2560,2557,1798,2554,1796,2574,2572,2569,2578,1847,1846,2722,1843,1842,1840,1845,2716,2714,1835,1834,1832,1830,1839,1837,2700,2698,2695,2704,1817,1811,1810,897,862,1777,829,826,838,1760,1758,808,2481,1741,1740,1738,1743,2624,1818,2726,2776,782,740,737,1715,686,679,695,1682,1680,639,628,2339,647,644,1645,1643,1640,1648,602,600,597,595,2320,593,2318,609,607,604,1611,1610,1608,1606,613,1615,1613,2328,926,924,892,886,899,857,850,2505,1778,824,823,821,819,2488,818,2486,833,831,828,840,1761,1759,2649,2632,2630,2746,2734,2732,2782,2781,570,567,1587,531,527,523,540,1566,1564,476,467,463,2240,486,483,1524,1521,1518,1529,411,403,2192,399,2189,423,416,1462,1457,1454,428,1468,1465,2210,366,363,2158,360,2156,357,2153,376,373,370,2163,1410,1409,1407,1405,382,1402,380,1417,1415,1412,1421,2175,2174,777,774,771,784,732,725,722,2404,743,1716,676,674,668,2363,665,2360,685,1684,1681,626,624,622,2335,620,2333,617,2330,641,635,649,1646,1644,1642,2566,928,925,2530,2527,894,891,888,2501,2499,2496,858,856,854,851,1779,2692,2668,2665,2645,2643,2640,2651,2768,2759,2757,2744,2743,2741,2748,352,1382,340,337,333,1371,1369,307,300,296,2126,315,312,1347,1342,1350,261,258,250,2097,246,2094,271,268,264,1306,1301,1298,276,1312,1309,2115,203,2048,195,2045,191,2041,213,209,2056,1246,1244,1238,225,1234,222,1256,1253,1249,1262,2080,2079,154,1997,150,1995,147,1992,1989,163,160,2004,156,2001,1175,1174,1172,1170,1167,170,1164,167,1185,1183,1180,1177,174,1190,1188,2025,2024,2022,587,586,564,559,556,2290,573,1588,520,518,512,2268,508,2265,530,1568,1565,461,457,2233,450,2230,446,2226,479,471,489,1526,1523,1520,397,395,2185,392,2183,389,2180,2177,410,2194,402,422,1463,1461,1459,1456,1470,2455,799,2433,2430,779,776,773,2397,2394,2390,734,728,724,746,1717,2356,2354,2351,2348,1658,677,675,673,670,667,688,1685,1683,2606,2589,2586,2559,2556,2552,927,2523,2521,2518,2515,1784,2532,895,893,890,2718,2709,2707,2689,2687,2684,2663,2662,2660,2658,1825,2667,2769,1852,2760,2758,142,141,1139,1138,134,132,129,126,1982,1129,1128,1126,1131,113,111,108,105,1972,101,1970,120,118,115,1109,1108,1106,1104,123,1113,1111,82,79,1951,75,1949,72,1946,92,89,86,1956,1077,1076,1074,1072,98,1069,96,1084,1082,1079,1088,1968,1967,48,45,1916,42,1914,39,1911,1908,60,57,54,1923,50,1920,1031,1030,1028,1026,67,1023,65,1020,62,1041,1039,1036,1033,69,1046,1044,1944,1943,1941,11,9,1868,7,1865,1862,1859,20,1878,16,1875,13,1872,970,968,966,963,29,960,26,23,983,981,978,975,33,971,31,990,988,985,1906,1904,1902,993,351,2145,1383,331,330,328,326,2137,323,2135,339,1372,1370,294,293,291,289,2122,286,2120,283,2117,309,303,317,1348,1346,1344,245,244,242,2090,239,2088,236,2085,2082,260,2099,249,270,1307,1305,1303,1300,1314,189,2038,186,2036,183,2033,2030,2026,206,198,2047,194,216,1247,1245,1243,1240,227,1237,1255,2310,2302,2300,2286,2284,2281,565,563,561,558,575,1589,2261,2259,2256,2253,1542,521,519,517,514,2270,511,533,1569,1567,2223,2221,2218,2215,1483,2211,1480,459,456,453,2232,449,474,491,1527,1525,1522,2475,2467,2465,2451,2449,2446,801,800,2426,2424,2421,2418,1723,2435,780,778,775,2387,2385,2382,2379,1695,2375,1693,2396,735,733,730,727,749,1718,2616,2615,2604,2603,2601,2584,2583,2581,2579,1800,2591,2550,2549,2547,2545,1792,2542,1790,2558,929,2719,1841,2710,2708,1833,1831,2690,2688,2686,1815,1809,1808,1774,1756,1754,1737,1736,1734,1739,1816,1711,1676,1674,633,629,1638,1636,1633,1641,598,1605,1604,1602,1600,605,1609,1607,2327,887,853,1775,822,820,1757,1755,1584,524,1560,1558,468,464,1514,1511,1508,1519,408,404,400,1452,1447,1444,417,1458,1455,2208,364,361,358,2154,1401,1400,1398,1396,374,1393,371,1408,1406,1403,1413,2173,2172,772,726,723,1712,672,669,666,682,1678,1675,625,623,621,618,2331,636,632,1639,1637,1635,920,918,884,880,889,849,848,847,846,2497,855,852,1776,2641,2742,2787,1380,334,1367,1365,301,297,1340,1338,1335,1343,255,251,247,1296,1291,1288,265,1302,1299,2113,204,196,192,2042,1232,1230,1224,214,1220,210,1242,1239,1235,1250,2077,2075,151,148,1993,144,1990,1163,1162,1160,1158,1155,161,1152,157,1173,1171,1168,1165,168,1181,1178,2021,2020,2018,2023,585,560,557,1585,516,509,1562,1559,458,447,2227,472,1516,1513,1510,398,396,393,390,2181,386,2178,407,1453,1451,1449,1446,420,1460,2209,769,764,720,712,2391,729,1713,664,663,661,659,2352,656,2349,671,1679,1677,2553,922,919,2519,2516,885,883,881,2685,2661,2659,2767,2756,2755,140,1137,1136,130,127,1125,1124,1122,1127,109,106,102,1103,1102,1100,1098,116,1107,1105,1980,80,76,73,1947,1068,1067,1065,1063,90,1060,87,1075,1073,1070,1080,1966,1965,46,43,40,1912,36,1909,1019,1018,1016,1014,58,1011,55,1008,51,1029,1027,1024,1021,63,1037,1034,1940,1939,1937,1942,8,1866,4,1863,1,1860,956,954,952,949,946,17,14,969,967,964,961,27,957,24,979,976,972,1901,1900,1898,1896,986,1905,1903,350,349,1381,329,327,324,1368,1366,292,290,287,284,2118,304,1341,1339,1337,1345,243,240,237,2086,233,2083,254,1297,1295,1293,1290,1304,2114,190,187,184,2034,180,2031,177,2027,199,1233,1231,1229,1226,217,1223,1241,2078,2076,584,555,554,552,550,2282,562,1586,507,506,504,502,2257,499,2254,515,1563,1561,445,443,441,2219,438,2216,435,2212,460,454,475,1517,1515,1512,2447,798,797,2422,2419,770,768,766,2383,2380,2376,721,719,717,714,731,1714,2602,2582,2580,2548,2546,2543,923,921,2717,2706,2705,2683,2682,2680,1771,1752,1750,1733,1732,1731,1735,1814,1707,1670,1668,1631,1629,1626,1634,1599,1598,1596,1594,1603,1601,2326,1772,1753,1751,1581,1554,1552,1504,1501,1498,1509,1442,1437,1434,401,1448,1445,2206,1392,1391,1389,1387,1384,359,1399,1397,1394,1404,2171,2170,1708,1672,1669,619,1632,1630,1628,1773,1378,1363,1361,1333,1328,1336,1286,1281,1278,248,1292,1289,2111,1218,1216,1210,197,1206,193,1228,1225,1221,1236,2073,2071,1151,1150,1148,1146,152,1143,149,1140,145,1161,1159,1156,1153,158,1169,1166,2017,2016,2014,2019,1582,510,1556,1553,452,448,1506,1500,394,391,387,1443,1441,1439,1436,1450,2207,765,716,713,1709,662,660,657,1673,1671,916,914,879,878,877,882,1135,1134,1121,1120,1118,1123,1097,1096,1094,1092,103,1101,1099,1979,1059,1058,1056,1054,77,1051,74,1066,1064,1061,1071,1964,1963,1007,1006,1004,1002,999,41,996,37,1017,1015,1012,1009,52,1025,1022,1936,1935,1933,1938,942,940,938,935,932,5,2,955,953,950,947,18,943,15,965,962,958,1895,1894,1892,1890,973,1899,1897,1379,325,1364,1362,288,285,1334,1332,1330,241,238,234,1287,1285,1283,1280,1294,2112,188,185,181,178,2028,1219,1217,1215,1212,200,1209,1227,2074,2072,583,553,551,1583,505,503,500,513,1557,1555,444,442,439,436,2213,455,451,1507,1505,1502,796,763,762,760,767,711,710,708,706,2377,718,715,1710,2544,917,915,2681,1627,1597,1595,2325,1769,1749,1747,1499,1438,1435,2204,1390,1388,1385,1395,2169,2167,1704,1665,1662,1625,1623,1620,1770,1329,1282,1279,2109,1214,1207,1222,2068,2065,1149,1147,1144,1141,146,1157,1154,2013,2011,2008,2015,1579,1549,1546,1495,1487,1433,1431,1428,1425,388,1440,2205,1705,658,1667,1664,1119,1095,1093,1978,1057,1055,1052,1062,1962,1960,1005,1003,1e3,997,38,1013,1010,1932,1930,1927,1934,941,939,936,933,6,930,3,951,948,944,1889,1887,1884,1881,959,1893,1891,35,1377,1360,1358,1327,1325,1322,1331,1277,1275,1272,1269,235,1284,2110,1205,1204,1201,1198,182,1195,179,1213,2070,2067,1580,501,1551,1548,440,437,1497,1494,1490,1503,761,709,707,1706,913,912,2198,1386,2164,2161,1621,1766,2103,1208,2058,2054,1145,1142,2005,2002,1999,2009,1488,1429,1426,2200,1698,1659,1656,1975,1053,1957,1954,1001,998,1924,1921,1918,1928,937,934,931,1879,1876,1873,1870,945,1885,1882,1323,1273,1270,2105,1202,1199,1196,1211,2061,2057,1576,1543,1540,1484,1481,1478,1491,1700]);class Tg{constructor(e,t){this.bits=e,this.points=t}getBits(){return this.bits}getPoints(){return this.points}}class He{static detectMultiple(e,t,n){let o=e.getBlackMatrix(),c=He.detect(n,o);return c.length||(o=o.clone(),o.rotate180(),c=He.detect(n,o)),new Tg(o,c)}static detect(e,t){const n=new Array;let o=0,c=0,d=!1;for(;o<t.getHeight();){const h=He.findVertices(t,o,c);if(h[0]==null&&h[3]==null){if(!d)break;d=!1,c=0;for(const g of n)g[1]!=null&&(o=Math.trunc(Math.max(o,g[1].getY()))),g[3]!=null&&(o=Math.max(o,Math.trunc(g[3].getY())));o+=He.ROW_STEP;continue}if(d=!0,n.push(h),!e)break;h[2]!=null?(c=Math.trunc(h[2].getX()),o=Math.trunc(h[2].getY())):(c=Math.trunc(h[4].getX()),o=Math.trunc(h[4].getY()))}return n}static findVertices(e,t,n){const o=e.getHeight(),c=e.getWidth(),d=new Array(8);return He.copyToResult(d,He.findRowsWithPattern(e,o,c,t,n,He.START_PATTERN),He.INDEXES_START_PATTERN),d[4]!=null&&(n=Math.trunc(d[4].getX()),t=Math.trunc(d[4].getY())),He.copyToResult(d,He.findRowsWithPattern(e,o,c,t,n,He.STOP_PATTERN),He.INDEXES_STOP_PATTERN),d}static copyToResult(e,t,n){for(let o=0;o<n.length;o++)e[n[o]]=t[o]}static findRowsWithPattern(e,t,n,o,c,d){const h=new Array(4);let g=!1;const w=new Int32Array(d.length);for(;o<t;o+=He.ROW_STEP){let A=He.findGuardPattern(e,c,o,n,!1,d,w);if(A!=null){for(;o>0;){const S=He.findGuardPattern(e,c,--o,n,!1,d,w);if(S!=null)A=S;else{o++;break}}h[0]=new ye(A[0],o),h[1]=new ye(A[1],o),g=!0;break}}let E=o+1;if(g){let A=0,S=Int32Array.from([Math.trunc(h[0].getX()),Math.trunc(h[1].getX())]);for(;E<t;E++){const B=He.findGuardPattern(e,S[0],E,n,!1,d,w);if(B!=null&&Math.abs(S[0]-B[0])<He.MAX_PATTERN_DRIFT&&Math.abs(S[1]-B[1])<He.MAX_PATTERN_DRIFT)S=B,A=0;else{if(A>He.SKIPPED_ROW_COUNT_MAX)break;A++}}E-=A+1,h[2]=new ye(S[0],E),h[3]=new ye(S[1],E)}return E-o<He.BARCODE_MIN_HEIGHT&&D.fill(h,null),h}static findGuardPattern(e,t,n,o,c,d,h){D.fillWithin(h,0,h.length,0);let g=t,w=0;for(;e.get(g,n)&&g>0&&w++<He.MAX_PIXEL_DRIFT;)g--;let E=g,A=0,S=d.length;for(let B=c;E<o;E++)if(e.get(E,n)!==B)h[A]++;else{if(A===S-1){if(He.patternMatchVariance(h,d,He.MAX_INDIVIDUAL_VARIANCE)<He.MAX_AVG_VARIANCE)return new Int32Array([g,E]);g+=h[0]+h[1],v.arraycopy(h,2,h,0,A-1),h[A-1]=0,h[A]=0,A--}else A++;h[A]=1,B=!B}return A===S-1&&He.patternMatchVariance(h,d,He.MAX_INDIVIDUAL_VARIANCE)<He.MAX_AVG_VARIANCE?new Int32Array([g,E-1]):null}static patternMatchVariance(e,t,n){let o=e.length,c=0,d=0;for(let w=0;w<o;w++)c+=e[w],d+=t[w];if(c<d)return 1/0;let h=c/d;n*=h;let g=0;for(let w=0;w<o;w++){let E=e[w],A=t[w]*h,S=E>A?E-A:A-E;if(S>n)return 1/0;g+=S}return g/c}}He.INDEXES_START_PATTERN=Int32Array.from([0,4,1,5]),He.INDEXES_STOP_PATTERN=Int32Array.from([6,2,7,3]),He.MAX_AVG_VARIANCE=.42,He.MAX_INDIVIDUAL_VARIANCE=.8,He.START_PATTERN=Int32Array.from([8,1,1,1,1,1,1,3]),He.STOP_PATTERN=Int32Array.from([7,1,1,3,1,1,1,2,1]),He.MAX_PIXEL_DRIFT=3,He.MAX_PATTERN_DRIFT=5,He.SKIPPED_ROW_COUNT_MAX=25,He.ROW_STEP=5,He.BARCODE_MIN_HEIGHT=10;class Ht{constructor(e,t){if(t.length===0)throw new y;this.field=e;let n=t.length;if(n>1&&t[0]===0){let o=1;for(;o<n&&t[o]===0;)o++;o===n?this.coefficients=new Int32Array([0]):(this.coefficients=new Int32Array(n-o),v.arraycopy(t,o,this.coefficients,0,this.coefficients.length))}else this.coefficients=t}getCoefficients(){return this.coefficients}getDegree(){return this.coefficients.length-1}isZero(){return this.coefficients[0]===0}getCoefficient(e){return this.coefficients[this.coefficients.length-1-e]}evaluateAt(e){if(e===0)return this.getCoefficient(0);if(e===1){let o=0;for(let c of this.coefficients)o=this.field.add(o,c);return o}let t=this.coefficients[0],n=this.coefficients.length;for(let o=1;o<n;o++)t=this.field.add(this.field.multiply(e,t),this.coefficients[o]);return t}add(e){if(!this.field.equals(e.field))throw new y("ModulusPolys do not have same ModulusGF field");if(this.isZero())return e;if(e.isZero())return this;let t=this.coefficients,n=e.coefficients;if(t.length>n.length){let d=t;t=n,n=d}let o=new Int32Array(n.length),c=n.length-t.length;v.arraycopy(n,0,o,0,c);for(let d=c;d<n.length;d++)o[d]=this.field.add(t[d-c],n[d]);return new Ht(this.field,o)}subtract(e){if(!this.field.equals(e.field))throw new y("ModulusPolys do not have same ModulusGF field");return e.isZero()?this:this.add(e.negative())}multiply(e){return e instanceof Ht?this.multiplyOther(e):this.multiplyScalar(e)}multiplyOther(e){if(!this.field.equals(e.field))throw new y("ModulusPolys do not have same ModulusGF field");if(this.isZero()||e.isZero())return new Ht(this.field,new Int32Array([0]));let t=this.coefficients,n=t.length,o=e.coefficients,c=o.length,d=new Int32Array(n+c-1);for(let h=0;h<n;h++){let g=t[h];for(let w=0;w<c;w++)d[h+w]=this.field.add(d[h+w],this.field.multiply(g,o[w]))}return new Ht(this.field,d)}negative(){let e=this.coefficients.length,t=new Int32Array(e);for(let n=0;n<e;n++)t[n]=this.field.subtract(0,this.coefficients[n]);return new Ht(this.field,t)}multiplyScalar(e){if(e===0)return new Ht(this.field,new Int32Array([0]));if(e===1)return this;let t=this.coefficients.length,n=new Int32Array(t);for(let o=0;o<t;o++)n[o]=this.field.multiply(this.coefficients[o],e);return new Ht(this.field,n)}multiplyByMonomial(e,t){if(e<0)throw new y;if(t===0)return new Ht(this.field,new Int32Array([0]));let n=this.coefficients.length,o=new Int32Array(n+e);for(let c=0;c<n;c++)o[c]=this.field.multiply(this.coefficients[c],t);return new Ht(this.field,o)}toString(){let e=new G;for(let t=this.getDegree();t>=0;t--){let n=this.getCoefficient(t);n!==0&&(n<0?(e.append(" - "),n=-n):e.length()>0&&e.append(" + "),(t===0||n!==1)&&e.append(n),t!==0&&(t===1?e.append("x"):(e.append("x^"),e.append(t))))}return e.toString()}}class kg{add(e,t){return(e+t)%this.modulus}subtract(e,t){return(this.modulus+e-t)%this.modulus}exp(e){return this.expTable[e]}log(e){if(e===0)throw new y;return this.logTable[e]}inverse(e){if(e===0)throw new it;return this.expTable[this.modulus-this.logTable[e]-1]}multiply(e,t){return e===0||t===0?0:this.expTable[(this.logTable[e]+this.logTable[t])%(this.modulus-1)]}getSize(){return this.modulus}equals(e){return e===this}}class zo extends kg{constructor(e,t){super(),this.modulus=e,this.expTable=new Int32Array(e),this.logTable=new Int32Array(e);let n=1;for(let o=0;o<e;o++)this.expTable[o]=n,n=n*t%e;for(let o=0;o<e-1;o++)this.logTable[this.expTable[o]]=o;this.zero=new Ht(this,new Int32Array([0])),this.one=new Ht(this,new Int32Array([1]))}getZero(){return this.zero}getOne(){return this.one}buildMonomial(e,t){if(e<0)throw new y;if(t===0)return this.zero;let n=new Int32Array(e+1);return n[0]=t,new Ht(this,n)}}zo.PDF417_GF=new zo(Oe.NUMBER_OF_CODEWORDS,3);class qa{constructor(){this.field=zo.PDF417_GF}decode(e,t,n){let o=new Ht(this.field,e),c=new Int32Array(t),d=!1;for(let U=t;U>0;U--){let H=o.evaluateAt(this.field.exp(U));c[t-U]=H,H!==0&&(d=!0)}if(!d)return 0;let h=this.field.getOne();if(n!=null)for(const U of n){let H=this.field.exp(e.length-1-U),K=new Ht(this.field,new Int32Array([this.field.subtract(0,H),1]));h=h.multiply(K)}let g=new Ht(this.field,c),w=this.runEuclideanAlgorithm(this.field.buildMonomial(t,1),g,t),E=w[0],A=w[1],S=this.findErrorLocations(E),B=this.findErrorMagnitudes(A,E,S);for(let U=0;U<S.length;U++){let H=e.length-1-this.field.log(S[U]);if(H<0)throw O.getChecksumInstance();e[H]=this.field.subtract(e[H],B[U])}return S.length}runEuclideanAlgorithm(e,t,n){if(e.getDegree()<t.getDegree()){let S=e;e=t,t=S}let o=e,c=t,d=this.field.getZero(),h=this.field.getOne();for(;c.getDegree()>=Math.round(n/2);){let S=o,B=d;if(o=c,d=h,o.isZero())throw O.getChecksumInstance();c=S;let U=this.field.getZero(),H=o.getCoefficient(o.getDegree()),K=this.field.inverse(H);for(;c.getDegree()>=o.getDegree()&&!c.isZero();){let oe=c.getDegree()-o.getDegree(),ue=this.field.multiply(c.getCoefficient(c.getDegree()),K);U=U.add(this.field.buildMonomial(oe,ue)),c=c.subtract(o.multiplyByMonomial(oe,ue))}h=U.multiply(d).subtract(B).negative()}let g=h.getCoefficient(0);if(g===0)throw O.getChecksumInstance();let w=this.field.inverse(g),E=h.multiply(w),A=c.multiply(w);return[E,A]}findErrorLocations(e){let t=e.getDegree(),n=new Int32Array(t),o=0;for(let c=1;c<this.field.getSize()&&o<t;c++)e.evaluateAt(c)===0&&(n[o]=this.field.inverse(c),o++);if(o!==t)throw O.getChecksumInstance();return n}findErrorMagnitudes(e,t,n){let o=t.getDegree(),c=new Int32Array(o);for(let w=1;w<=o;w++)c[o-w]=this.field.multiply(w,t.getCoefficient(w));let d=new Ht(this.field,c),h=n.length,g=new Int32Array(h);for(let w=0;w<h;w++){let E=this.field.inverse(n[w]),A=this.field.subtract(0,e.evaluateAt(E)),S=this.field.inverse(d.evaluateAt(E));g[w]=this.field.multiply(A,S)}return g}}class cr{constructor(e,t,n,o,c){e instanceof cr?this.constructor_2(e):this.constructor_1(e,t,n,o,c)}constructor_1(e,t,n,o,c){const d=t==null||n==null,h=o==null||c==null;if(d&&h)throw new T;d?(t=new ye(0,o.getY()),n=new ye(0,c.getY())):h&&(o=new ye(e.getWidth()-1,t.getY()),c=new ye(e.getWidth()-1,n.getY())),this.image=e,this.topLeft=t,this.bottomLeft=n,this.topRight=o,this.bottomRight=c,this.minX=Math.trunc(Math.min(t.getX(),n.getX())),this.maxX=Math.trunc(Math.max(o.getX(),c.getX())),this.minY=Math.trunc(Math.min(t.getY(),o.getY())),this.maxY=Math.trunc(Math.max(n.getY(),c.getY()))}constructor_2(e){this.image=e.image,this.topLeft=e.getTopLeft(),this.bottomLeft=e.getBottomLeft(),this.topRight=e.getTopRight(),this.bottomRight=e.getBottomRight(),this.minX=e.getMinX(),this.maxX=e.getMaxX(),this.minY=e.getMinY(),this.maxY=e.getMaxY()}static merge(e,t){return e==null?t:t==null?e:new cr(e.image,e.topLeft,e.bottomLeft,t.topRight,t.bottomRight)}addMissingRows(e,t,n){let o=this.topLeft,c=this.bottomLeft,d=this.topRight,h=this.bottomRight;if(e>0){let g=n?this.topLeft:this.topRight,w=Math.trunc(g.getY()-e);w<0&&(w=0);let E=new ye(g.getX(),w);n?o=E:d=E}if(t>0){let g=n?this.bottomLeft:this.bottomRight,w=Math.trunc(g.getY()+t);w>=this.image.getHeight()&&(w=this.image.getHeight()-1);let E=new ye(g.getX(),w);n?c=E:h=E}return new cr(this.image,o,c,d,h)}getMinX(){return this.minX}getMaxX(){return this.maxX}getMinY(){return this.minY}getMaxY(){return this.maxY}getTopLeft(){return this.topLeft}getTopRight(){return this.topRight}getBottomLeft(){return this.bottomLeft}getBottomRight(){return this.bottomRight}}class Rg{constructor(e,t,n,o){this.columnCount=e,this.errorCorrectionLevel=o,this.rowCountUpperPart=t,this.rowCountLowerPart=n,this.rowCount=t+n}getColumnCount(){return this.columnCount}getErrorCorrectionLevel(){return this.errorCorrectionLevel}getRowCount(){return this.rowCount}getRowCountUpperPart(){return this.rowCountUpperPart}getRowCountLowerPart(){return this.rowCountLowerPart}}class Yr{constructor(){this.buffer=""}static form(e,t){let n=-1;function o(d,h,g,w,E,A){if(d==="%%")return"%";if(t[++n]===void 0)return;d=w?parseInt(w.substr(1)):void 0;let S=E?parseInt(E.substr(1)):void 0,B;switch(A){case"s":B=t[n];break;case"c":B=t[n][0];break;case"f":B=parseFloat(t[n]).toFixed(d);break;case"p":B=parseFloat(t[n]).toPrecision(d);break;case"e":B=parseFloat(t[n]).toExponential(d);break;case"x":B=parseInt(t[n]).toString(S||16);break;case"d":B=parseFloat(parseInt(t[n],S||10).toPrecision(d)).toFixed(0);break}B=typeof B=="object"?JSON.stringify(B):(+B).toString(S);let U=parseInt(g),H=g&&g[0]+""=="0"?"0":" ";for(;B.length<U;)B=h!==void 0?B+H:H+B;return B}let c=/%(-)?(0?[0-9]+)?([.][0-9]+)?([#][0-9]+)?([scfpexd%])/g;return e.replace(c,o)}format(e,...t){this.buffer+=Yr.form(e,t)}toString(){return this.buffer}}class Kr{constructor(e){this.boundingBox=new cr(e),this.codewords=new Array(e.getMaxY()-e.getMinY()+1)}getCodewordNearby(e){let t=this.getCodeword(e);if(t!=null)return t;for(let n=1;n<Kr.MAX_NEARBY_DISTANCE;n++){let o=this.imageRowToCodewordIndex(e)-n;if(o>=0&&(t=this.codewords[o],t!=null)||(o=this.imageRowToCodewordIndex(e)+n,o<this.codewords.length&&(t=this.codewords[o],t!=null)))return t}return null}imageRowToCodewordIndex(e){return e-this.boundingBox.getMinY()}setCodeword(e,t){this.codewords[this.imageRowToCodewordIndex(e)]=t}getCodeword(e){return this.codewords[this.imageRowToCodewordIndex(e)]}getBoundingBox(){return this.boundingBox}getCodewords(){return this.codewords}toString(){const e=new Yr;let t=0;for(const n of this.codewords){if(n==null){e.format("%3d: | %n",t++);continue}e.format("%3d: %3d|%3d%n",t++,n.getRowNumber(),n.getValue())}return e.toString()}}Kr.MAX_NEARBY_DISTANCE=5;class Qr{constructor(){this.values=new Map}setValue(e){e=Math.trunc(e);let t=this.values.get(e);t==null&&(t=0),t++,this.values.set(e,t)}getValue(){let e=-1,t=new Array;for(const[n,o]of this.values.entries()){const c={getKey:()=>n,getValue:()=>o};c.getValue()>e?(e=c.getValue(),t=[],t.push(c.getKey())):c.getValue()===e&&t.push(c.getKey())}return Oe.toIntArray(t)}getConfidence(e){return this.values.get(e)}}class Za extends Kr{constructor(e,t){super(e),this._isLeft=t}setRowNumbers(){for(let e of this.getCodewords())e!=null&&e.setRowNumberAsRowIndicatorColumn()}adjustCompleteIndicatorColumnRowNumbers(e){let t=this.getCodewords();this.setRowNumbers(),this.removeIncorrectCodewords(t,e);let n=this.getBoundingBox(),o=this._isLeft?n.getTopLeft():n.getTopRight(),c=this._isLeft?n.getBottomLeft():n.getBottomRight(),d=this.imageRowToCodewordIndex(Math.trunc(o.getY())),h=this.imageRowToCodewordIndex(Math.trunc(c.getY())),g=-1,w=1,E=0;for(let A=d;A<h;A++){if(t[A]==null)continue;let S=t[A],B=S.getRowNumber()-g;if(B===0)E++;else if(B===1)w=Math.max(w,E),E=1,g=S.getRowNumber();else if(B<0||S.getRowNumber()>=e.getRowCount()||B>A)t[A]=null;else{let U;w>2?U=(w-2)*B:U=B;let H=U>=A;for(let K=1;K<=U&&!H;K++)H=t[A-K]!=null;H?t[A]=null:(g=S.getRowNumber(),E=1)}}}getRowHeights(){let e=this.getBarcodeMetadata();if(e==null)return null;this.adjustIncompleteIndicatorColumnRowNumbers(e);let t=new Int32Array(e.getRowCount());for(let n of this.getCodewords())if(n!=null){let o=n.getRowNumber();if(o>=t.length)continue;t[o]++}return t}adjustIncompleteIndicatorColumnRowNumbers(e){let t=this.getBoundingBox(),n=this._isLeft?t.getTopLeft():t.getTopRight(),o=this._isLeft?t.getBottomLeft():t.getBottomRight(),c=this.imageRowToCodewordIndex(Math.trunc(n.getY())),d=this.imageRowToCodewordIndex(Math.trunc(o.getY())),h=this.getCodewords(),g=-1;for(let w=c;w<d;w++){if(h[w]==null)continue;let E=h[w];E.setRowNumberAsRowIndicatorColumn();let A=E.getRowNumber()-g;A===0||(A===1?g=E.getRowNumber():E.getRowNumber()>=e.getRowCount()?h[w]=null:g=E.getRowNumber())}}getBarcodeMetadata(){let e=this.getCodewords(),t=new Qr,n=new Qr,o=new Qr,c=new Qr;for(let h of e){if(h==null)continue;h.setRowNumberAsRowIndicatorColumn();let g=h.getValue()%30,w=h.getRowNumber();switch(this._isLeft||(w+=2),w%3){case 0:n.setValue(g*3+1);break;case 1:c.setValue(g/3),o.setValue(g%3);break;case 2:t.setValue(g+1);break}}if(t.getValue().length===0||n.getValue().length===0||o.getValue().length===0||c.getValue().length===0||t.getValue()[0]<1||n.getValue()[0]+o.getValue()[0]<Oe.MIN_ROWS_IN_BARCODE||n.getValue()[0]+o.getValue()[0]>Oe.MAX_ROWS_IN_BARCODE)return null;let d=new Rg(t.getValue()[0],n.getValue()[0],o.getValue()[0],c.getValue()[0]);return this.removeIncorrectCodewords(e,d),d}removeIncorrectCodewords(e,t){for(let n=0;n<e.length;n++){let o=e[n];if(e[n]==null)continue;let c=o.getValue()%30,d=o.getRowNumber();if(d>t.getRowCount()){e[n]=null;continue}switch(this._isLeft||(d+=2),d%3){case 0:c*3+1!==t.getRowCountUpperPart()&&(e[n]=null);break;case 1:(Math.trunc(c/3)!==t.getErrorCorrectionLevel()||c%3!==t.getRowCountLowerPart())&&(e[n]=null);break;case 2:c+1!==t.getColumnCount()&&(e[n]=null);break}}}isLeft(){return this._isLeft}toString(){return"IsLeft: "+this._isLeft+`
17
+ `+super.toString()}}class Jr{constructor(e,t){this.ADJUST_ROW_NUMBER_SKIP=2,this.barcodeMetadata=e,this.barcodeColumnCount=e.getColumnCount(),this.boundingBox=t,this.detectionResultColumns=new Array(this.barcodeColumnCount+2)}getDetectionResultColumns(){this.adjustIndicatorColumnRowNumbers(this.detectionResultColumns[0]),this.adjustIndicatorColumnRowNumbers(this.detectionResultColumns[this.barcodeColumnCount+1]);let e=Oe.MAX_CODEWORDS_IN_BARCODE,t;do t=e,e=this.adjustRowNumbersAndGetCount();while(e>0&&e<t);return this.detectionResultColumns}adjustIndicatorColumnRowNumbers(e){e!=null&&e.adjustCompleteIndicatorColumnRowNumbers(this.barcodeMetadata)}adjustRowNumbersAndGetCount(){let e=this.adjustRowNumbersByRow();if(e===0)return 0;for(let t=1;t<this.barcodeColumnCount+1;t++){let n=this.detectionResultColumns[t].getCodewords();for(let o=0;o<n.length;o++)n[o]!=null&&(n[o].hasValidRowNumber()||this.adjustRowNumbers(t,o,n))}return e}adjustRowNumbersByRow(){return this.adjustRowNumbersFromBothRI(),this.adjustRowNumbersFromLRI()+this.adjustRowNumbersFromRRI()}adjustRowNumbersFromBothRI(){if(this.detectionResultColumns[0]==null||this.detectionResultColumns[this.barcodeColumnCount+1]==null)return;let e=this.detectionResultColumns[0].getCodewords(),t=this.detectionResultColumns[this.barcodeColumnCount+1].getCodewords();for(let n=0;n<e.length;n++)if(e[n]!=null&&t[n]!=null&&e[n].getRowNumber()===t[n].getRowNumber())for(let o=1;o<=this.barcodeColumnCount;o++){let c=this.detectionResultColumns[o].getCodewords()[n];c!=null&&(c.setRowNumber(e[n].getRowNumber()),c.hasValidRowNumber()||(this.detectionResultColumns[o].getCodewords()[n]=null))}}adjustRowNumbersFromRRI(){if(this.detectionResultColumns[this.barcodeColumnCount+1]==null)return 0;let e=0,t=this.detectionResultColumns[this.barcodeColumnCount+1].getCodewords();for(let n=0;n<t.length;n++){if(t[n]==null)continue;let o=t[n].getRowNumber(),c=0;for(let d=this.barcodeColumnCount+1;d>0&&c<this.ADJUST_ROW_NUMBER_SKIP;d--){let h=this.detectionResultColumns[d].getCodewords()[n];h!=null&&(c=Jr.adjustRowNumberIfValid(o,c,h),h.hasValidRowNumber()||e++)}}return e}adjustRowNumbersFromLRI(){if(this.detectionResultColumns[0]==null)return 0;let e=0,t=this.detectionResultColumns[0].getCodewords();for(let n=0;n<t.length;n++){if(t[n]==null)continue;let o=t[n].getRowNumber(),c=0;for(let d=1;d<this.barcodeColumnCount+1&&c<this.ADJUST_ROW_NUMBER_SKIP;d++){let h=this.detectionResultColumns[d].getCodewords()[n];h!=null&&(c=Jr.adjustRowNumberIfValid(o,c,h),h.hasValidRowNumber()||e++)}}return e}static adjustRowNumberIfValid(e,t,n){return n==null||n.hasValidRowNumber()||(n.isValidRowNumber(e)?(n.setRowNumber(e),t=0):++t),t}adjustRowNumbers(e,t,n){if(!this.detectionResultColumns[e-1])return;let o=n[t],c=this.detectionResultColumns[e-1].getCodewords(),d=c;this.detectionResultColumns[e+1]!=null&&(d=this.detectionResultColumns[e+1].getCodewords());let h=new Array(14);h[2]=c[t],h[3]=d[t],t>0&&(h[0]=n[t-1],h[4]=c[t-1],h[5]=d[t-1]),t>1&&(h[8]=n[t-2],h[10]=c[t-2],h[11]=d[t-2]),t<n.length-1&&(h[1]=n[t+1],h[6]=c[t+1],h[7]=d[t+1]),t<n.length-2&&(h[9]=n[t+2],h[12]=c[t+2],h[13]=d[t+2]);for(let g of h)if(Jr.adjustRowNumber(o,g))return}static adjustRowNumber(e,t){return t==null?!1:t.hasValidRowNumber()&&t.getBucket()===e.getBucket()?(e.setRowNumber(t.getRowNumber()),!0):!1}getBarcodeColumnCount(){return this.barcodeColumnCount}getBarcodeRowCount(){return this.barcodeMetadata.getRowCount()}getBarcodeECLevel(){return this.barcodeMetadata.getErrorCorrectionLevel()}setBoundingBox(e){this.boundingBox=e}getBoundingBox(){return this.boundingBox}setDetectionResultColumn(e,t){this.detectionResultColumns[e]=t}getDetectionResultColumn(e){return this.detectionResultColumns[e]}toString(){let e=this.detectionResultColumns[0];e==null&&(e=this.detectionResultColumns[this.barcodeColumnCount+1]);let t=new Yr;for(let n=0;n<e.getCodewords().length;n++){t.format("CW %3d:",n);for(let o=0;o<this.barcodeColumnCount+2;o++){if(this.detectionResultColumns[o]==null){t.format(" | ");continue}let c=this.detectionResultColumns[o].getCodewords()[n];if(c==null){t.format(" | ");continue}t.format(" %3d|%3d",c.getRowNumber(),c.getValue())}t.format("%n")}return t.toString()}}class ei{constructor(e,t,n,o){this.rowNumber=ei.BARCODE_ROW_UNKNOWN,this.startX=Math.trunc(e),this.endX=Math.trunc(t),this.bucket=Math.trunc(n),this.value=Math.trunc(o)}hasValidRowNumber(){return this.isValidRowNumber(this.rowNumber)}isValidRowNumber(e){return e!==ei.BARCODE_ROW_UNKNOWN&&this.bucket===e%3*3}setRowNumberAsRowIndicatorColumn(){this.rowNumber=Math.trunc(Math.trunc(this.value/30)*3+Math.trunc(this.bucket/3))}getWidth(){return this.endX-this.startX}getStartX(){return this.startX}getEndX(){return this.endX}getBucket(){return this.bucket}getValue(){return this.value}getRowNumber(){return this.rowNumber}setRowNumber(e){this.rowNumber=e}toString(){return this.rowNumber+"|"+this.value}}ei.BARCODE_ROW_UNKNOWN=-1;class nn{static initialize(){for(let e=0;e<Oe.SYMBOL_TABLE.length;e++){let t=Oe.SYMBOL_TABLE[e],n=t&1;for(let o=0;o<Oe.BARS_IN_MODULE;o++){let c=0;for(;(t&1)===n;)c+=1,t>>=1;n=t&1,nn.RATIOS_TABLE[e]||(nn.RATIOS_TABLE[e]=new Array(Oe.BARS_IN_MODULE)),nn.RATIOS_TABLE[e][Oe.BARS_IN_MODULE-o-1]=Math.fround(c/Oe.MODULES_IN_CODEWORD)}}this.bSymbolTableReady=!0}static getDecodedValue(e){let t=nn.getDecodedCodewordValue(nn.sampleBitCounts(e));return t!==-1?t:nn.getClosestDecodedValue(e)}static sampleBitCounts(e){let t=ve.sum(e),n=new Int32Array(Oe.BARS_IN_MODULE),o=0,c=0;for(let d=0;d<Oe.MODULES_IN_CODEWORD;d++){let h=t/(2*Oe.MODULES_IN_CODEWORD)+d*t/Oe.MODULES_IN_CODEWORD;c+e[o]<=h&&(c+=e[o],o++),n[o]++}return n}static getDecodedCodewordValue(e){let t=nn.getBitValue(e);return Oe.getCodeword(t)===-1?-1:t}static getBitValue(e){let t=0;for(let n=0;n<e.length;n++)for(let o=0;o<e[n];o++)t=t<<1|(n%2===0?1:0);return Math.trunc(t)}static getClosestDecodedValue(e){let t=ve.sum(e),n=new Array(Oe.BARS_IN_MODULE);if(t>1)for(let d=0;d<n.length;d++)n[d]=Math.fround(e[d]/t);let o=ar.MAX_VALUE,c=-1;this.bSymbolTableReady||nn.initialize();for(let d=0;d<nn.RATIOS_TABLE.length;d++){let h=0,g=nn.RATIOS_TABLE[d];for(let w=0;w<Oe.BARS_IN_MODULE;w++){let E=Math.fround(g[w]-n[w]);if(h+=Math.fround(E*E),h>=o)break}h<o&&(o=h,c=Oe.SYMBOL_TABLE[d])}return c}}nn.bSymbolTableReady=!1,nn.RATIOS_TABLE=new Array(Oe.SYMBOL_TABLE.length).map(b=>new Array(Oe.BARS_IN_MODULE));class Ya{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 Ka{static parseLong(e,t=void 0){return parseInt(e,t)}}class Qa extends x{}Qa.kind="NullPointerException";class Bg{writeBytes(e){this.writeBytesOffset(e,0,e.length)}writeBytesOffset(e,t,n){if(e==null)throw new Qa;if(t<0||t>e.length||n<0||t+n>e.length||t+n<0)throw new k;if(n===0)return;for(let o=0;o<n;o++)this.write(e[t+o])}flush(){}close(){}}class Og extends x{}class Mg extends Bg{constructor(e=32){if(super(),this.count=0,e<0)throw new y("Negative initial size: "+e);this.buf=new Uint8Array(e)}ensureCapacity(e){e-this.buf.length>0&&this.grow(e)}grow(e){let n=this.buf.length<<1;if(n-e<0&&(n=e),n<0){if(e<0)throw new Og;n=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 lt;(function(b){b[b.ALPHA=0]="ALPHA",b[b.LOWER=1]="LOWER",b[b.MIXED=2]="MIXED",b[b.PUNCT=3]="PUNCT",b[b.ALPHA_SHIFT=4]="ALPHA_SHIFT",b[b.PUNCT_SHIFT=5]="PUNCT_SHIFT"})(lt||(lt={}));function Ja(){if(typeof window<"u")return window.BigInt||null;if(typeof _r<"u")return _r.BigInt||null;if(typeof self<"u")return self.BigInt||null;throw new Error("Can't search globals for BigInt!")}let vi;function Zn(b){if(typeof vi>"u"&&(vi=Ja()),vi===null)throw new Error("BigInt is not supported!");return vi(b)}function Dg(){let b=[];b[0]=Zn(1);let e=Zn(900);b[1]=e;for(let t=2;t<16;t++)b[t]=b[t-1]*e;return b}class re{static decode(e,t){let n=new G(""),o=V.ISO8859_1;n.enableDecoding(o);let c=1,d=e[c++],h=new Ya;for(;c<e[0];){switch(d){case re.TEXT_COMPACTION_MODE_LATCH:c=re.textCompaction(e,c,n);break;case re.BYTE_COMPACTION_MODE_LATCH:case re.BYTE_COMPACTION_MODE_LATCH_6:c=re.byteCompaction(d,e,o,c,n);break;case re.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:n.append(e[c++]);break;case re.NUMERIC_COMPACTION_MODE_LATCH:c=re.numericCompaction(e,c,n);break;case re.ECI_CHARSET:V.getCharacterSetECIByValue(e[c++]);break;case re.ECI_GENERAL_PURPOSE:c+=2;break;case re.ECI_USER_DEFINED:c++;break;case re.BEGIN_MACRO_PDF417_CONTROL_BLOCK:c=re.decodeMacroBlock(e,c,h);break;case re.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case re.MACRO_PDF417_TERMINATOR:throw new F;default:c--,c=re.textCompaction(e,c,n);break}if(c<e.length)d=e[c++];else throw F.getFormatInstance()}if(n.length()===0)throw F.getFormatInstance();let g=new et(null,n.toString(),null,t);return g.setOther(h),g}static decodeMacroBlock(e,t,n){if(t+re.NUMBER_OF_SEQUENCE_CODEWORDS>e[0])throw F.getFormatInstance();let o=new Int32Array(re.NUMBER_OF_SEQUENCE_CODEWORDS);for(let h=0;h<re.NUMBER_OF_SEQUENCE_CODEWORDS;h++,t++)o[h]=e[t];n.setSegmentIndex(M.parseInt(re.decodeBase900toBase10(o,re.NUMBER_OF_SEQUENCE_CODEWORDS)));let c=new G;t=re.textCompaction(e,t,c),n.setFileId(c.toString());let d=-1;for(e[t]===re.BEGIN_MACRO_PDF417_OPTIONAL_FIELD&&(d=t+1);t<e[0];)switch(e[t]){case re.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:switch(t++,e[t]){case re.MACRO_PDF417_OPTIONAL_FIELD_FILE_NAME:let h=new G;t=re.textCompaction(e,t+1,h),n.setFileName(h.toString());break;case re.MACRO_PDF417_OPTIONAL_FIELD_SENDER:let g=new G;t=re.textCompaction(e,t+1,g),n.setSender(g.toString());break;case re.MACRO_PDF417_OPTIONAL_FIELD_ADDRESSEE:let w=new G;t=re.textCompaction(e,t+1,w),n.setAddressee(w.toString());break;case re.MACRO_PDF417_OPTIONAL_FIELD_SEGMENT_COUNT:let E=new G;t=re.numericCompaction(e,t+1,E),n.setSegmentCount(M.parseInt(E.toString()));break;case re.MACRO_PDF417_OPTIONAL_FIELD_TIME_STAMP:let A=new G;t=re.numericCompaction(e,t+1,A),n.setTimestamp(Ka.parseLong(A.toString()));break;case re.MACRO_PDF417_OPTIONAL_FIELD_CHECKSUM:let S=new G;t=re.numericCompaction(e,t+1,S),n.setChecksum(M.parseInt(S.toString()));break;case re.MACRO_PDF417_OPTIONAL_FIELD_FILE_SIZE:let B=new G;t=re.numericCompaction(e,t+1,B),n.setFileSize(Ka.parseLong(B.toString()));break;default:throw F.getFormatInstance()}break;case re.MACRO_PDF417_TERMINATOR:t++,n.setLastSegment(!0);break;default:throw F.getFormatInstance()}if(d!==-1){let h=t-d;n.isLastSegment()&&h--,n.setOptionalData(D.copyOfRange(e,d,d+h))}return t}static textCompaction(e,t,n){let o=new Int32Array((e[0]-t)*2),c=new Int32Array((e[0]-t)*2),d=0,h=!1;for(;t<e[0]&&!h;){let g=e[t++];if(g<re.TEXT_COMPACTION_MODE_LATCH)o[d]=g/30,o[d+1]=g%30,d+=2;else switch(g){case re.TEXT_COMPACTION_MODE_LATCH:o[d++]=re.TEXT_COMPACTION_MODE_LATCH;break;case re.BYTE_COMPACTION_MODE_LATCH:case re.BYTE_COMPACTION_MODE_LATCH_6:case re.NUMERIC_COMPACTION_MODE_LATCH:case re.BEGIN_MACRO_PDF417_CONTROL_BLOCK:case re.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case re.MACRO_PDF417_TERMINATOR:t--,h=!0;break;case re.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:o[d]=re.MODE_SHIFT_TO_BYTE_COMPACTION_MODE,g=e[t++],c[d]=g,d++;break}}return re.decodeTextCompaction(o,c,d,n),t}static decodeTextCompaction(e,t,n,o){let c=lt.ALPHA,d=lt.ALPHA,h=0;for(;h<n;){let g=e[h],w="";switch(c){case lt.ALPHA:if(g<26)w=String.fromCharCode(65+g);else switch(g){case 26:w=" ";break;case re.LL:c=lt.LOWER;break;case re.ML:c=lt.MIXED;break;case re.PS:d=c,c=lt.PUNCT_SHIFT;break;case re.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:o.append(t[h]);break;case re.TEXT_COMPACTION_MODE_LATCH:c=lt.ALPHA;break}break;case lt.LOWER:if(g<26)w=String.fromCharCode(97+g);else switch(g){case 26:w=" ";break;case re.AS:d=c,c=lt.ALPHA_SHIFT;break;case re.ML:c=lt.MIXED;break;case re.PS:d=c,c=lt.PUNCT_SHIFT;break;case re.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:o.append(t[h]);break;case re.TEXT_COMPACTION_MODE_LATCH:c=lt.ALPHA;break}break;case lt.MIXED:if(g<re.PL)w=re.MIXED_CHARS[g];else switch(g){case re.PL:c=lt.PUNCT;break;case 26:w=" ";break;case re.LL:c=lt.LOWER;break;case re.AL:c=lt.ALPHA;break;case re.PS:d=c,c=lt.PUNCT_SHIFT;break;case re.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:o.append(t[h]);break;case re.TEXT_COMPACTION_MODE_LATCH:c=lt.ALPHA;break}break;case lt.PUNCT:if(g<re.PAL)w=re.PUNCT_CHARS[g];else switch(g){case re.PAL:c=lt.ALPHA;break;case re.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:o.append(t[h]);break;case re.TEXT_COMPACTION_MODE_LATCH:c=lt.ALPHA;break}break;case lt.ALPHA_SHIFT:if(c=d,g<26)w=String.fromCharCode(65+g);else switch(g){case 26:w=" ";break;case re.TEXT_COMPACTION_MODE_LATCH:c=lt.ALPHA;break}break;case lt.PUNCT_SHIFT:if(c=d,g<re.PAL)w=re.PUNCT_CHARS[g];else switch(g){case re.PAL:c=lt.ALPHA;break;case re.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:o.append(t[h]);break;case re.TEXT_COMPACTION_MODE_LATCH:c=lt.ALPHA;break}break}w!==""&&o.append(w),h++}}static byteCompaction(e,t,n,o,c){let d=new Mg,h=0,g=0,w=!1;switch(e){case re.BYTE_COMPACTION_MODE_LATCH:let E=new Int32Array(6),A=t[o++];for(;o<t[0]&&!w;)switch(E[h++]=A,g=900*g+A,A=t[o++],A){case re.TEXT_COMPACTION_MODE_LATCH:case re.BYTE_COMPACTION_MODE_LATCH:case re.NUMERIC_COMPACTION_MODE_LATCH:case re.BYTE_COMPACTION_MODE_LATCH_6:case re.BEGIN_MACRO_PDF417_CONTROL_BLOCK:case re.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case re.MACRO_PDF417_TERMINATOR:o--,w=!0;break;default:if(h%5===0&&h>0){for(let S=0;S<6;++S)d.write(Number(Zn(g)>>Zn(8*(5-S))));g=0,h=0}break}o===t[0]&&A<re.TEXT_COMPACTION_MODE_LATCH&&(E[h++]=A);for(let S=0;S<h;S++)d.write(E[S]);break;case re.BYTE_COMPACTION_MODE_LATCH_6:for(;o<t[0]&&!w;){let S=t[o++];if(S<re.TEXT_COMPACTION_MODE_LATCH)h++,g=900*g+S;else switch(S){case re.TEXT_COMPACTION_MODE_LATCH:case re.BYTE_COMPACTION_MODE_LATCH:case re.NUMERIC_COMPACTION_MODE_LATCH:case re.BYTE_COMPACTION_MODE_LATCH_6:case re.BEGIN_MACRO_PDF417_CONTROL_BLOCK:case re.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case re.MACRO_PDF417_TERMINATOR:o--,w=!0;break}if(h%5===0&&h>0){for(let B=0;B<6;++B)d.write(Number(Zn(g)>>Zn(8*(5-B))));g=0,h=0}}break}return c.append(Q.decode(d.toByteArray(),n)),o}static numericCompaction(e,t,n){let o=0,c=!1,d=new Int32Array(re.MAX_NUMERIC_CODEWORDS);for(;t<e[0]&&!c;){let h=e[t++];if(t===e[0]&&(c=!0),h<re.TEXT_COMPACTION_MODE_LATCH)d[o]=h,o++;else switch(h){case re.TEXT_COMPACTION_MODE_LATCH:case re.BYTE_COMPACTION_MODE_LATCH:case re.BYTE_COMPACTION_MODE_LATCH_6:case re.BEGIN_MACRO_PDF417_CONTROL_BLOCK:case re.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case re.MACRO_PDF417_TERMINATOR:t--,c=!0;break}(o%re.MAX_NUMERIC_CODEWORDS===0||h===re.NUMERIC_COMPACTION_MODE_LATCH||c)&&o>0&&(n.append(re.decodeBase900toBase10(d,o)),o=0)}return t}static decodeBase900toBase10(e,t){let n=Zn(0);for(let c=0;c<t;c++)n+=re.EXP900[t-c-1]*Zn(e[c]);let o=n.toString();if(o.charAt(0)!=="1")throw new F;return o.substring(1)}}re.TEXT_COMPACTION_MODE_LATCH=900,re.BYTE_COMPACTION_MODE_LATCH=901,re.NUMERIC_COMPACTION_MODE_LATCH=902,re.BYTE_COMPACTION_MODE_LATCH_6=924,re.ECI_USER_DEFINED=925,re.ECI_GENERAL_PURPOSE=926,re.ECI_CHARSET=927,re.BEGIN_MACRO_PDF417_CONTROL_BLOCK=928,re.BEGIN_MACRO_PDF417_OPTIONAL_FIELD=923,re.MACRO_PDF417_TERMINATOR=922,re.MODE_SHIFT_TO_BYTE_COMPACTION_MODE=913,re.MAX_NUMERIC_CODEWORDS=15,re.MACRO_PDF417_OPTIONAL_FIELD_FILE_NAME=0,re.MACRO_PDF417_OPTIONAL_FIELD_SEGMENT_COUNT=1,re.MACRO_PDF417_OPTIONAL_FIELD_TIME_STAMP=2,re.MACRO_PDF417_OPTIONAL_FIELD_SENDER=3,re.MACRO_PDF417_OPTIONAL_FIELD_ADDRESSEE=4,re.MACRO_PDF417_OPTIONAL_FIELD_FILE_SIZE=5,re.MACRO_PDF417_OPTIONAL_FIELD_CHECKSUM=6,re.PL=25,re.LL=27,re.AS=27,re.ML=28,re.AL=28,re.PS=29,re.PAL=29,re.PUNCT_CHARS=`;<>@[\\]_\`~!\r ,:
18
+ -.$/"|*()?{}'`,re.MIXED_CHARS="0123456789&\r ,:#-.$/+%*=^",re.EXP900=Ja()?Dg():[],re.NUMBER_OF_SEQUENCE_CODEWORDS=2;class We{constructor(){}static decode(e,t,n,o,c,d,h){let g=new cr(e,t,n,o,c),w=null,E=null,A;for(let U=!0;;U=!1){if(t!=null&&(w=We.getRowIndicatorColumn(e,g,t,!0,d,h)),o!=null&&(E=We.getRowIndicatorColumn(e,g,o,!1,d,h)),A=We.merge(w,E),A==null)throw T.getNotFoundInstance();let H=A.getBoundingBox();if(U&&H!=null&&(H.getMinY()<g.getMinY()||H.getMaxY()>g.getMaxY()))g=H;else break}A.setBoundingBox(g);let S=A.getBarcodeColumnCount()+1;A.setDetectionResultColumn(0,w),A.setDetectionResultColumn(S,E);let B=w!=null;for(let U=1;U<=S;U++){let H=B?U:S-U;if(A.getDetectionResultColumn(H)!==void 0)continue;let K;H===0||H===S?K=new Za(g,H===0):K=new Kr(g),A.setDetectionResultColumn(H,K);let oe=-1,ue=oe;for(let fe=g.getMinY();fe<=g.getMaxY();fe++){if(oe=We.getStartColumn(A,H,fe,B),oe<0||oe>g.getMaxX()){if(ue===-1)continue;oe=ue}let le=We.detectCodeword(e,g.getMinX(),g.getMaxX(),B,oe,fe,d,h);le!=null&&(K.setCodeword(fe,le),ue=oe,d=Math.min(d,le.getWidth()),h=Math.max(h,le.getWidth()))}}return We.createDecoderResult(A)}static merge(e,t){if(e==null&&t==null)return null;let n=We.getBarcodeMetadata(e,t);if(n==null)return null;let o=cr.merge(We.adjustBoundingBox(e),We.adjustBoundingBox(t));return new Jr(n,o)}static adjustBoundingBox(e){if(e==null)return null;let t=e.getRowHeights();if(t==null)return null;let n=We.getMax(t),o=0;for(let h of t)if(o+=n-h,h>0)break;let c=e.getCodewords();for(let h=0;o>0&&c[h]==null;h++)o--;let d=0;for(let h=t.length-1;h>=0&&(d+=n-t[h],!(t[h]>0));h--);for(let h=c.length-1;d>0&&c[h]==null;h--)d--;return e.getBoundingBox().addMissingRows(o,d,e.isLeft())}static getMax(e){let t=-1;for(let n of e)t=Math.max(t,n);return t}static getBarcodeMetadata(e,t){let n;if(e==null||(n=e.getBarcodeMetadata())==null)return t==null?null:t.getBarcodeMetadata();let o;return t==null||(o=t.getBarcodeMetadata())==null?n:n.getColumnCount()!==o.getColumnCount()&&n.getErrorCorrectionLevel()!==o.getErrorCorrectionLevel()&&n.getRowCount()!==o.getRowCount()?null:n}static getRowIndicatorColumn(e,t,n,o,c,d){let h=new Za(t,o);for(let g=0;g<2;g++){let w=g===0?1:-1,E=Math.trunc(Math.trunc(n.getX()));for(let A=Math.trunc(Math.trunc(n.getY()));A<=t.getMaxY()&&A>=t.getMinY();A+=w){let S=We.detectCodeword(e,0,e.getWidth(),o,E,A,c,d);S!=null&&(h.setCodeword(A,S),o?E=S.getStartX():E=S.getEndX())}}return h}static adjustCodewordCount(e,t){let n=t[0][1],o=n.getValue(),c=e.getBarcodeColumnCount()*e.getBarcodeRowCount()-We.getNumberOfECCodeWords(e.getBarcodeECLevel());if(o.length===0){if(c<1||c>Oe.MAX_CODEWORDS_IN_BARCODE)throw T.getNotFoundInstance();n.setValue(c)}else o[0]!==c&&n.setValue(c)}static createDecoderResult(e){let t=We.createBarcodeMatrix(e);We.adjustCodewordCount(e,t);let n=new Array,o=new Int32Array(e.getBarcodeRowCount()*e.getBarcodeColumnCount()),c=[],d=new Array;for(let g=0;g<e.getBarcodeRowCount();g++)for(let w=0;w<e.getBarcodeColumnCount();w++){let E=t[g][w+1].getValue(),A=g*e.getBarcodeColumnCount()+w;E.length===0?n.push(A):E.length===1?o[A]=E[0]:(d.push(A),c.push(E))}let h=new Array(c.length);for(let g=0;g<h.length;g++)h[g]=c[g];return We.createDecoderResultFromAmbiguousValues(e.getBarcodeECLevel(),o,Oe.toIntArray(n),Oe.toIntArray(d),h)}static createDecoderResultFromAmbiguousValues(e,t,n,o,c){let d=new Int32Array(o.length),h=100;for(;h-- >0;){for(let g=0;g<d.length;g++)t[o[g]]=c[g][d[g]];try{return We.decodeCodewords(t,e,n)}catch(g){if(!(g instanceof O))throw g}if(d.length===0)throw O.getChecksumInstance();for(let g=0;g<d.length;g++)if(d[g]<c[g].length-1){d[g]++;break}else if(d[g]=0,g===d.length-1)throw O.getChecksumInstance()}throw O.getChecksumInstance()}static createBarcodeMatrix(e){let t=Array.from({length:e.getBarcodeRowCount()},()=>new Array(e.getBarcodeColumnCount()+2));for(let o=0;o<t.length;o++)for(let c=0;c<t[o].length;c++)t[o][c]=new Qr;let n=0;for(let o of e.getDetectionResultColumns()){if(o!=null){for(let c of o.getCodewords())if(c!=null){let d=c.getRowNumber();if(d>=0){if(d>=t.length)continue;t[d][n].setValue(c.getValue())}}}n++}return t}static isValidBarcodeColumn(e,t){return t>=0&&t<=e.getBarcodeColumnCount()+1}static getStartColumn(e,t,n,o){let c=o?1:-1,d=null;if(We.isValidBarcodeColumn(e,t-c)&&(d=e.getDetectionResultColumn(t-c).getCodeword(n)),d!=null)return o?d.getEndX():d.getStartX();if(d=e.getDetectionResultColumn(t).getCodewordNearby(n),d!=null)return o?d.getStartX():d.getEndX();if(We.isValidBarcodeColumn(e,t-c)&&(d=e.getDetectionResultColumn(t-c).getCodewordNearby(n)),d!=null)return o?d.getEndX():d.getStartX();let h=0;for(;We.isValidBarcodeColumn(e,t-c);){t-=c;for(let g of e.getDetectionResultColumn(t).getCodewords())if(g!=null)return(o?g.getEndX():g.getStartX())+c*h*(g.getEndX()-g.getStartX());h++}return o?e.getBoundingBox().getMinX():e.getBoundingBox().getMaxX()}static detectCodeword(e,t,n,o,c,d,h,g){c=We.adjustCodewordStartColumn(e,t,n,o,c,d);let w=We.getModuleBitCount(e,t,n,o,c,d);if(w==null)return null;let E,A=ve.sum(w);if(o)E=c+A;else{for(let U=0;U<w.length/2;U++){let H=w[U];w[U]=w[w.length-1-U],w[w.length-1-U]=H}E=c,c=E-A}if(!We.checkCodewordSkew(A,h,g))return null;let S=nn.getDecodedValue(w),B=Oe.getCodeword(S);return B===-1?null:new ei(c,E,We.getCodewordBucketNumber(S),B)}static getModuleBitCount(e,t,n,o,c,d){let h=c,g=new Int32Array(8),w=0,E=o?1:-1,A=o;for(;(o?h<n:h>=t)&&w<g.length;)e.get(h,d)===A?(g[w]++,h+=E):(w++,A=!A);return w===g.length||h===(o?n:t)&&w===g.length-1?g:null}static getNumberOfECCodeWords(e){return 2<<e}static adjustCodewordStartColumn(e,t,n,o,c,d){let h=c,g=o?-1:1;for(let w=0;w<2;w++){for(;(o?h>=t:h<n)&&o===e.get(h,d);){if(Math.abs(c-h)>We.CODEWORD_SKEW_SIZE)return c;h+=g}g=-g,o=!o}return h}static checkCodewordSkew(e,t,n){return t-We.CODEWORD_SKEW_SIZE<=e&&e<=n+We.CODEWORD_SKEW_SIZE}static decodeCodewords(e,t,n){if(e.length===0)throw F.getFormatInstance();let o=1<<t+1,c=We.correctErrors(e,n,o);We.verifyCodewordCount(e,o);let d=re.decode(e,""+t);return d.setErrorsCorrected(c),d.setErasures(n.length),d}static correctErrors(e,t,n){if(t!=null&&t.length>n/2+We.MAX_ERRORS||n<0||n>We.MAX_EC_CODEWORDS)throw O.getChecksumInstance();return We.errorCorrection.decode(e,n,t)}static verifyCodewordCount(e,t){if(e.length<4)throw F.getFormatInstance();let n=e[0];if(n>e.length)throw F.getFormatInstance();if(n===0)if(t<e.length)e[0]=e.length-t;else throw F.getFormatInstance()}static getBitCountForCodeword(e){let t=new Int32Array(8),n=0,o=t.length-1;for(;!((e&1)!==n&&(n=e&1,o--,o<0));)t[o]++,e>>=1;return t}static getCodewordBucketNumber(e){return e instanceof Int32Array?this.getCodewordBucketNumber_Int32Array(e):this.getCodewordBucketNumber_number(e)}static getCodewordBucketNumber_number(e){return We.getCodewordBucketNumber(We.getBitCountForCodeword(e))}static getCodewordBucketNumber_Int32Array(e){return(e[0]-e[2]+e[4]-e[6]+9)%9}static toString(e){let t=new Yr;for(let n=0;n<e.length;n++){t.format("Row %2d: ",n);for(let o=0;o<e[n].length;o++){let c=e[n][o];c.getValue().length===0?t.format(" ",null):t.format("%4d(%2d)",c.getValue()[0],c.getConfidence(c.getValue()[0]))}t.format("%n")}return t.toString()}}We.CODEWORD_SKEW_SIZE=2,We.MAX_ERRORS=3,We.MAX_EC_CODEWORDS=512,We.errorCorrection=new qa;class Gt{decode(e,t=null){let n=Gt.decode(e,t,!1);if(n==null||n.length===0||n[0]==null)throw T.getNotFoundInstance();return n[0]}decodeMultiple(e,t=null){try{return Gt.decode(e,t,!0)}catch(n){throw n instanceof F||n instanceof O?T.getNotFoundInstance():n}}static decode(e,t,n){const o=new Array,c=He.detectMultiple(e,t,n);for(const d of c.getPoints()){const h=We.decode(c.getBits(),d[4],d[5],d[6],d[7],Gt.getMinCodewordWidth(d),Gt.getMaxCodewordWidth(d)),g=new ge(h.getText(),h.getRawBytes(),void 0,d,xe.PDF_417);g.putMetadata(be.ERROR_CORRECTION_LEVEL,h.getECLevel());const w=h.getOther();w!=null&&g.putMetadata(be.PDF417_EXTRA_METADATA,w),o.push(g)}return o.map(d=>d)}static getMaxWidth(e,t){return e==null||t==null?0:Math.trunc(Math.abs(e.getX()-t.getX()))}static getMinWidth(e,t){return e==null||t==null?M.MAX_VALUE:Math.trunc(Math.abs(e.getX()-t.getX()))}static getMaxCodewordWidth(e){return Math.floor(Math.max(Math.max(Gt.getMaxWidth(e[0],e[4]),Gt.getMaxWidth(e[6],e[2])*Oe.MODULES_IN_CODEWORD/Oe.MODULES_IN_STOP_PATTERN),Math.max(Gt.getMaxWidth(e[1],e[5]),Gt.getMaxWidth(e[7],e[3])*Oe.MODULES_IN_CODEWORD/Oe.MODULES_IN_STOP_PATTERN)))}static getMinCodewordWidth(e){return Math.floor(Math.min(Math.min(Gt.getMinWidth(e[0],e[4]),Gt.getMinWidth(e[6],e[2])*Oe.MODULES_IN_CODEWORD/Oe.MODULES_IN_STOP_PATTERN),Math.min(Gt.getMinWidth(e[1],e[5]),Gt.getMinWidth(e[7],e[3])*Oe.MODULES_IN_CODEWORD/Oe.MODULES_IN_STOP_PATTERN)))}reset(){}}class Pi extends x{}Pi.kind="ReaderException";class el{constructor(e,t){this.verbose=e===!0,t&&this.setHints(t)}decode(e,t){return t&&this.setHints(t),this.decodeInternal(e)}decodeWithState(e){return(this.readers===null||this.readers===void 0)&&this.setHints(null),this.decodeInternal(e)}setHints(e){this.hints=e;const t=!s(e)&&e.get(Y.TRY_HARDER)===!0,n=s(e)?null:e.get(Y.POSSIBLE_FORMATS),o=new Array;if(!s(n)){const c=n.some(d=>d===xe.UPC_A||d===xe.UPC_E||d===xe.EAN_13||d===xe.EAN_8||d===xe.CODABAR||d===xe.CODE_39||d===xe.CODE_93||d===xe.CODE_128||d===xe.ITF||d===xe.RSS_14||d===xe.RSS_EXPANDED);c&&!t&&o.push(new Tr(e,this.verbose)),n.includes(xe.QR_CODE)&&o.push(new qn),n.includes(xe.DATA_MATRIX)&&o.push(new jn),n.includes(xe.AZTEC)&&o.push(new Sr),n.includes(xe.PDF_417)&&o.push(new Gt),c&&t&&o.push(new Tr(e,this.verbose))}o.length===0&&(t||o.push(new Tr(e,this.verbose)),o.push(new qn),o.push(new jn),o.push(new Sr),o.push(new Gt),t&&o.push(new Tr(e,this.verbose))),this.readers=o}reset(){if(this.readers!==null)for(const e of this.readers)e.reset()}decodeInternal(e){if(this.readers===null)throw new Pi("No readers where selected, nothing can be read.");for(const t of this.readers)try{return t.decode(e,this.hints)}catch(n){if(n instanceof Pi)continue}throw new T("No MultiFormat Readers were able to detect the code.")}}class vg extends Ce{constructor(e=null,t=500){const n=new el;n.setHints(e),super(n,t)}decodeBitmap(e){return this.reader.decodeWithState(e)}}class Pg extends Ce{constructor(e=500){super(new Gt,e)}}class Lg extends Ce{constructor(e=500){super(new qn,e)}}var Ho;(function(b){b[b.ERROR_CORRECTION=0]="ERROR_CORRECTION",b[b.CHARACTER_SET=1]="CHARACTER_SET",b[b.DATA_MATRIX_SHAPE=2]="DATA_MATRIX_SHAPE",b[b.MIN_SIZE=3]="MIN_SIZE",b[b.MAX_SIZE=4]="MAX_SIZE",b[b.MARGIN=5]="MARGIN",b[b.PDF417_COMPACT=6]="PDF417_COMPACT",b[b.PDF417_COMPACTION=7]="PDF417_COMPACTION",b[b.PDF417_DIMENSIONS=8]="PDF417_DIMENSIONS",b[b.AZTEC_LAYERS=9]="AZTEC_LAYERS",b[b.QR_VERSION=10]="QR_VERSION"})(Ho||(Ho={}));var Pt=Ho;class Go{constructor(e){this.field=e,this.cachedGenerators=[],this.cachedGenerators.push(new Ve(e,Int32Array.from([1])))}buildGenerator(e){const t=this.cachedGenerators;if(e>=t.length){let n=t[t.length-1];const o=this.field;for(let c=t.length;c<=e;c++){const d=n.multiply(new Ve(o,Int32Array.from([1,o.exp(c-1+o.getGeneratorBase())])));t.push(d),n=d}}return t[e]}encode(e,t){if(t===0)throw new y("No error correction bytes");const n=e.length-t;if(n<=0)throw new y("No data bytes provided");const o=this.buildGenerator(t),c=new Int32Array(n);v.arraycopy(e,0,c,0,n);let d=new Ve(this.field,c);d=d.multiplyByMonomial(t,1);const g=d.divide(o)[1].getCoefficients(),w=t-g.length;for(let E=0;E<w;E++)e[n+E]=0;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(),o=e.getWidth(),c=e.getHeight();for(let d=0;d<c-1;d++){const h=n[d];for(let g=0;g<o-1;g++){const w=h[g];w===h[g+1]&&w===n[d+1][g]&&w===n[d+1][g+1]&&t++}}return Rt.N2*t}static applyMaskPenaltyRule3(e){let t=0;const n=e.getArray(),o=e.getWidth(),c=e.getHeight();for(let d=0;d<c;d++)for(let h=0;h<o;h++){const g=n[d];h+6<o&&g[h]===1&&g[h+1]===0&&g[h+2]===1&&g[h+3]===1&&g[h+4]===1&&g[h+5]===0&&g[h+6]===1&&(Rt.isWhiteHorizontal(g,h-4,h)||Rt.isWhiteHorizontal(g,h+7,h+11))&&t++,d+6<c&&n[d][h]===1&&n[d+1][h]===0&&n[d+2][h]===1&&n[d+3][h]===1&&n[d+4][h]===1&&n[d+5][h]===0&&n[d+6][h]===1&&(Rt.isWhiteVertical(n,h,d-4,d)||Rt.isWhiteVertical(n,h,d+7,d+11))&&t++}return t*Rt.N3}static isWhiteHorizontal(e,t,n){t=Math.max(t,0),n=Math.min(n,e.length);for(let o=t;o<n;o++)if(e[o]===1)return!1;return!0}static isWhiteVertical(e,t,n,o){n=Math.max(n,0),o=Math.min(o,e.length);for(let c=n;c<o;c++)if(e[c][t]===1)return!1;return!0}static applyMaskPenaltyRule4(e){let t=0;const n=e.getArray(),o=e.getWidth(),c=e.getHeight();for(let g=0;g<c;g++){const w=n[g];for(let E=0;E<o;E++)w[E]===1&&t++}const d=e.getHeight()*e.getWidth();return Math.floor(Math.abs(t*2-d)*10/d)*Rt.N4}static getDataMaskBit(e,t,n){let o,c;switch(e){case 0:o=n+t&1;break;case 1:o=n&1;break;case 2:o=t%3;break;case 3:o=(n+t)%3;break;case 4:o=Math.floor(n/2)+Math.floor(t/3)&1;break;case 5:c=n*t,o=(c&1)+c%3;break;case 6:c=n*t,o=(c&1)+c%3&1;break;case 7:c=n*t,o=c%3+(n+t&1)&1;break;default:throw new y("Invalid mask pattern: "+e)}return o===0}static applyMaskPenaltyRule1Internal(e,t){let n=0;const o=t?e.getHeight():e.getWidth(),c=t?e.getWidth():e.getHeight(),d=e.getArray();for(let h=0;h<o;h++){let g=0,w=-1;for(let E=0;E<c;E++){const A=t?d[h][E]:d[E][h];A===w?g++:(g>=5&&(n+=Rt.N1+(g-5)),g=1,w=A)}g>=5&&(n+=Rt.N1+(g-5))}return n}}Rt.N1=3,Rt.N2=3,Rt.N3=40,Rt.N4=10;class Li{constructor(e,t){this.width=e,this.height=t;const n=new Array(t);for(let o=0;o!==t;o++)n[o]=new Uint8Array(e);this.bytes=n}getHeight(){return this.height}getWidth(){return this.width}get(e,t){return this.bytes[t][e]}getArray(){return this.bytes}setNumber(e,t,n){this.bytes[t][e]=n}setBoolean(e,t,n){this.bytes[t][e]=n?1:0}clear(e){for(const t of this.bytes)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,o=this.height;n<o;++n){const c=this.bytes[n],d=t.bytes[n];for(let h=0,g=this.width;h<g;++h)if(c[h]!==d[h])return!1}return!0}toString(){const e=new G;for(let t=0,n=this.height;t<n;++t){const o=this.bytes[t];for(let c=0,d=this.width;c<d;++c)switch(o[c]){case 0:e.append(" 0");break;case 1:e.append(" 1");break;default:e.append(" ");break}e.append(`
19
+ `)}return e.toString()}}class dr{constructor(){this.maskPattern=-1}getMode(){return this.mode}getECLevel(){return this.ecLevel}getVersion(){return this.version}getMaskPattern(){return this.maskPattern}getMatrix(){return this.matrix}toString(){const e=new G;return e.append(`<<
20
20
  `),e.append(" mode: "),e.append(this.mode?this.mode.toString():"null"),e.append(`
21
21
  ecLevel: `),e.append(this.ecLevel?this.ecLevel.toString():"null"),e.append(`
22
22
  version: `),e.append(this.version?this.version.toString():"null"),e.append(`
@@ -25,7 +25,7 @@
25
25
  `),e.append(this.matrix.toString())):e.append(`
26
26
  matrix: null
27
27
  `),e.append(`>>
28
- `),e.toString()}setMode(e){this.mode=e}setECLevel(e){this.ecLevel=e}setVersion(e){this.version=e}setMaskPattern(e){this.maskPattern=e}setMatrix(e){this.matrix=e}static isValidMaskPattern(e){return e>=0&&e<dr.NUM_MASK_PATTERNS}}dr.NUM_MASK_PATTERNS=8;class dt extends x{}dt.kind="WriterException";class Be{constructor(){}static clearMatrix(e){e.clear(255)}static buildMatrix(e,t,n,s,c){Be.clearMatrix(c),Be.embedBasicPatterns(n,c),Be.embedTypeInfo(t,s,c),Be.maybeEmbedVersionInfo(n,c),Be.embedDataBits(e,s,c)}static embedBasicPatterns(e,t){Be.embedPositionDetectionPatternsAndSeparators(t),Be.embedDarkDotAtLeftBottomCorner(t),Be.maybeEmbedPositionAdjustmentPatterns(e,t),Be.embedTimingPatterns(t)}static embedTypeInfo(e,t,n){const s=new F;Be.makeTypeInfoBits(e,t,s);for(let c=0,d=s.getSize();c<d;++c){const h=s.get(s.getSize()-1-c),g=Be.TYPE_INFO_COORDINATES[c],_=g[0],E=g[1];if(n.setBoolean(_,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 F;Be.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 _=d-g;if(!Be.isEmpty(n.get(_,h)))continue;let E;s<e.getSize()?(E=e.get(s),++s):E=!1,t!==255&&kt.getDataMaskBit(t,_,h)&&(E=!E),n.setBoolean(_,h,E)}h+=c}c=-c,h+=c,d-=2}if(s!==e.getSize())throw new dt("Not all bits consumed: "+s+"/"+e.getSize())}static findMSBSet(e){return 32-R.numberOfLeadingZeros(e)}static calculateBCHCode(e,t){if(t===0)throw new y("0 polynomial");const n=Be.findMSBSet(t);for(e<<=n-1;Be.findMSBSet(e)>=n;)e^=t<<Be.findMSBSet(e)-n;return e}static makeTypeInfoBits(e,t,n){if(!dr.isValidMaskPattern(t))throw new dt("Invalid mask pattern");const s=e.getBits()<<3|t;n.appendBits(s,5);const c=Be.calculateBCHCode(s,Be.TYPE_INFO_POLY);n.appendBits(c,10);const d=new F;if(d.appendBits(Be.TYPE_INFO_MASK_PATTERN,15),n.xor(d),n.getSize()!==15)throw new dt("should not happen but we got: "+n.getSize())}static makeVersionInfoBits(e,t){t.appendBits(e.getVersionNumber(),6);const n=Be.calculateBCHCode(e.getVersionNumber(),Be.VERSION_INFO_POLY);if(t.appendBits(n,12),t.getSize()!==18)throw new dt("should not happen but we got: "+t.getSize())}static isEmpty(e){return e===255}static embedTimingPatterns(e){for(let t=8;t<e.getWidth()-8;++t){const n=(t+1)%2;Be.isEmpty(e.get(t,6))&&e.setNumber(t,6,n),Be.isEmpty(e.get(6,t))&&e.setNumber(6,t,n)}}static embedDarkDotAtLeftBottomCorner(e){if(e.get(8,e.getHeight()-8)===0)throw new dt;e.setNumber(8,e.getHeight()-8,1)}static embedHorizontalSeparationPattern(e,t,n){for(let s=0;s<8;++s){if(!Be.isEmpty(n.get(e+s,t)))throw new dt;n.setNumber(e+s,t,0)}}static embedVerticalSeparationPattern(e,t,n){for(let s=0;s<7;++s){if(!Be.isEmpty(n.get(e,t+s)))throw new dt;n.setNumber(e,t+s,0)}}static embedPositionAdjustmentPattern(e,t,n){for(let s=0;s<5;++s){const c=Be.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=Be.POSITION_DETECTION_PATTERN[s];for(let d=0;d<7;++d)n.setNumber(e+d,t+s,c[d])}}static embedPositionDetectionPatternsAndSeparators(e){const t=Be.POSITION_DETECTION_PATTERN[0].length;Be.embedPositionDetectionPattern(0,0,e),Be.embedPositionDetectionPattern(e.getWidth()-t,0,e),Be.embedPositionDetectionPattern(0,e.getWidth()-t,e);const n=8;Be.embedHorizontalSeparationPattern(0,n-1,e),Be.embedHorizontalSeparationPattern(e.getWidth()-n,n-1,e),Be.embedHorizontalSeparationPattern(0,e.getWidth()-n,e);const s=7;Be.embedVerticalSeparationPattern(s,0,e),Be.embedVerticalSeparationPattern(e.getHeight()-s-1,0,e),Be.embedVerticalSeparationPattern(s,e.getHeight()-s,e)}static maybeEmbedPositionAdjustmentPatterns(e,t){if(e.getVersionNumber()<2)return;const n=e.getVersionNumber()-1,s=Be.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 _=s[g];_>=0&&Be.isEmpty(t.get(_,h))&&Be.embedPositionAdjustmentPattern(_-2,h-2,t)}}}}Be.POSITION_DETECTION_PATTERN=Array.from([Int32Array.from([1,1,1,1,1,1,1]),Int32Array.from([1,0,0,0,0,0,1]),Int32Array.from([1,0,1,1,1,0,1]),Int32Array.from([1,0,1,1,1,0,1]),Int32Array.from([1,0,1,1,1,0,1]),Int32Array.from([1,0,0,0,0,0,1]),Int32Array.from([1,1,1,1,1,1,1])]),Be.POSITION_ADJUSTMENT_PATTERN=Array.from([Int32Array.from([1,1,1,1,1]),Int32Array.from([1,0,0,0,1]),Int32Array.from([1,0,1,0,1]),Int32Array.from([1,0,0,0,1]),Int32Array.from([1,1,1,1,1])]),Be.POSITION_ADJUSTMENT_PATTERN_COORDINATE_TABLE=Array.from([Int32Array.from([-1,-1,-1,-1,-1,-1,-1]),Int32Array.from([6,18,-1,-1,-1,-1,-1]),Int32Array.from([6,22,-1,-1,-1,-1,-1]),Int32Array.from([6,26,-1,-1,-1,-1,-1]),Int32Array.from([6,30,-1,-1,-1,-1,-1]),Int32Array.from([6,34,-1,-1,-1,-1,-1]),Int32Array.from([6,22,38,-1,-1,-1,-1]),Int32Array.from([6,24,42,-1,-1,-1,-1]),Int32Array.from([6,26,46,-1,-1,-1,-1]),Int32Array.from([6,28,50,-1,-1,-1,-1]),Int32Array.from([6,30,54,-1,-1,-1,-1]),Int32Array.from([6,32,58,-1,-1,-1,-1]),Int32Array.from([6,34,62,-1,-1,-1,-1]),Int32Array.from([6,26,46,66,-1,-1,-1]),Int32Array.from([6,26,48,70,-1,-1,-1]),Int32Array.from([6,26,50,74,-1,-1,-1]),Int32Array.from([6,30,54,78,-1,-1,-1]),Int32Array.from([6,30,56,82,-1,-1,-1]),Int32Array.from([6,30,58,86,-1,-1,-1]),Int32Array.from([6,34,62,90,-1,-1,-1]),Int32Array.from([6,28,50,72,94,-1,-1]),Int32Array.from([6,26,50,74,98,-1,-1]),Int32Array.from([6,30,54,78,102,-1,-1]),Int32Array.from([6,28,54,80,106,-1,-1]),Int32Array.from([6,32,58,84,110,-1,-1]),Int32Array.from([6,30,58,86,114,-1,-1]),Int32Array.from([6,34,62,90,118,-1,-1]),Int32Array.from([6,26,50,74,98,122,-1]),Int32Array.from([6,30,54,78,102,126,-1]),Int32Array.from([6,26,52,78,104,130,-1]),Int32Array.from([6,30,56,82,108,134,-1]),Int32Array.from([6,34,60,86,112,138,-1]),Int32Array.from([6,30,58,86,114,142,-1]),Int32Array.from([6,34,62,90,118,146,-1]),Int32Array.from([6,30,54,78,102,126,150]),Int32Array.from([6,24,50,76,102,128,154]),Int32Array.from([6,28,54,80,106,132,158]),Int32Array.from([6,32,58,84,110,136,162]),Int32Array.from([6,26,54,82,110,138,166]),Int32Array.from([6,30,58,86,114,142,170])]),Be.TYPE_INFO_COORDINATES=Array.from([Int32Array.from([8,0]),Int32Array.from([8,1]),Int32Array.from([8,2]),Int32Array.from([8,3]),Int32Array.from([8,4]),Int32Array.from([8,5]),Int32Array.from([8,7]),Int32Array.from([8,8]),Int32Array.from([7,8]),Int32Array.from([5,8]),Int32Array.from([4,8]),Int32Array.from([3,8]),Int32Array.from([2,8]),Int32Array.from([1,8]),Int32Array.from([0,8])]),Be.VERSION_INFO_POLY=7973,Be.TYPE_INFO_POLY=1335,Be.TYPE_INFO_MASK_PATTERN=21522;class Og{constructor(e,t){this.dataBytes=e,this.errorCorrectionBytes=t}getDataBytes(){return this.dataBytes}getErrorCorrectionBytes(){return this.errorCorrectionBytes}}class xt{constructor(){}static calculateMaskPenalty(e){return kt.applyMaskPenaltyRule1(e)+kt.applyMaskPenaltyRule2(e)+kt.applyMaskPenaltyRule3(e)+kt.applyMaskPenaltyRule4(e)}static encode(e,t,n=null){let s=xt.DEFAULT_BYTE_MODE_ENCODING;const c=n!==null&&n.get(Pt.CHARACTER_SET)!==void 0;c&&(s=n.get(Pt.CHARACTER_SET).toString());const d=this.chooseMode(e,s),h=new F;if(d===ke.BYTE&&(c||xt.DEFAULT_BYTE_MODE_ENCODING!==s)){const fe=L.getCharacterSetECIByName(s);fe!==void 0&&this.appendECI(fe,h)}this.appendModeInfo(d,h);const g=new F;this.appendBytes(e,d,g,s);let _;if(n!==null&&n.get(Pt.QR_VERSION)!==void 0){const fe=Number.parseInt(n.get(Pt.QR_VERSION).toString(),10);_=Ne.getVersionForNumber(fe);const le=this.calculateBitsNeeded(d,h,g,_);if(!this.willFit(le,_,t))throw new dt("Data too big for requested version")}else _=this.recommendVersion(t,d,h,g);const E=new F;E.appendBitArray(h);const A=d===ke.BYTE?g.getSizeInBytes():e.length;this.appendLengthInfo(A,_,d,E),E.appendBitArray(g);const S=_.getECBlocksForLevel(t),B=_.getTotalCodewords()-S.getTotalECCodewords();this.terminateBits(B,E);const z=this.interleaveWithECBytes(E,_.getTotalCodewords(),B,S.getNumBlocks()),W=new dr;W.setECLevel(t),W.setMode(d),W.setVersion(_);const Y=_.getDimensionForVersion(),ie=new Li(Y,Y),ue=this.chooseMaskPattern(z,t,_,ie);return W.setMaskPattern(ue),Be.buildMatrix(z,t,_,ue,ie),W.setMatrix(ie),W}static recommendVersion(e,t,n,s){const c=this.calculateBitsNeeded(t,n,s,Ne.getVersionForNumber(1)),d=this.chooseVersion(c,e),h=this.calculateBitsNeeded(t,n,s,d);return this.chooseVersion(h,e)}static calculateBitsNeeded(e,t,n,s){return t.getSize()+e.getCharacterCountBits(s)+n.getSize()}static getAlphanumericCode(e){return e<xt.ALPHANUMERIC_TABLE.length?xt.ALPHANUMERIC_TABLE[e]:-1}static chooseMode(e,t=null){if(L.SJIS.getName()===t&&this.isOnlyDoubleByteKanji(e))return ke.KANJI;let n=!1,s=!1;for(let c=0,d=e.length;c<d;++c){const h=e.charAt(c);if(xt.isDigit(h))n=!0;else if(this.getAlphanumericCode(h.charCodeAt(0))!==-1)s=!0;else return ke.BYTE}return s?ke.ALPHANUMERIC:n?ke.NUMERIC:ke.BYTE}static isOnlyDoubleByteKanji(e){let t;try{t=Q.encode(e,L.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++){Be.buildMatrix(e,t,n,h,s);let g=this.calculateMaskPenalty(s);g<c&&(c=g,d=h)}return d}static chooseVersion(e,t){for(let n=1;n<=40;n++){const s=Ne.getVersionForNumber(n);if(xt.willFit(e,s,t))return s}throw new dt("Data too big")}static willFit(e,t,n){const s=t.getTotalCodewords(),d=t.getECBlocksForLevel(n).getTotalECCodewords(),h=s-d,g=(e+7)/8;return h>=g}static terminateBits(e,t){const n=e*8;if(t.getSize()>n)throw new dt("data bits cannot fit in the QR Code"+t.getSize()+" > "+n);for(let d=0;d<4&&t.getSize()<n;++d)t.appendBit(!1);const s=t.getSize()&7;if(s>0)for(let d=s;d<8;d++)t.appendBit(!1);const c=e-t.getSizeInBytes();for(let d=0;d<c;++d)t.appendBits(d&1?17:236,8);if(t.getSize()!==n)throw new dt("Bits size does not equal capacity")}static getNumDataBytesAndNumECBytesForBlockID(e,t,n,s,c,d){if(s>=n)throw new dt("Block ID too large");const h=e%n,g=n-h,_=Math.floor(e/n),E=_+1,A=Math.floor(t/n),S=A+1,B=_-A,z=E-S;if(B!==z)throw new dt("EC bytes mismatch");if(n!==g+h)throw new dt("RS blocks mismatch");if(e!==(A+B)*g+(S+z)*h)throw new dt("Total bytes mismatch");s<g?(c[0]=A,d[0]=B):(c[0]=S,d[0]=z)}static interleaveWithECBytes(e,t,n,s){if(e.getSizeInBytes()!==n)throw new dt("Number of bits and data bytes does not match");let c=0,d=0,h=0;const g=new Array;for(let E=0;E<s;++E){const A=new Int32Array(1),S=new Int32Array(1);xt.getNumDataBytesAndNumECBytesForBlockID(t,n,s,E,A,S);const B=A[0],z=new Uint8Array(B);e.toBytes(8*c,z,0,B);const W=xt.generateECBytes(z,S[0]);g.push(new Og(z,W)),d=Math.max(d,B),h=Math.max(h,W.length),c+=A[0]}if(n!==c)throw new dt("Data bytes does not match offset");const _=new F;for(let E=0;E<d;++E)for(const A of g){const S=A.getDataBytes();E<S.length&&_.appendBits(S[E],8)}for(let E=0;E<h;++E)for(const A of g){const S=A.getErrorCorrectionBytes();E<S.length&&_.appendBits(S[E],8)}if(t!==_.getSizeInBytes())throw new dt("Interleaving error: "+t+" and "+_.getSizeInBytes()+" differ.");return _}static generateECBytes(e,t){const n=e.length,s=new Int32Array(n+t);for(let d=0;d<n;d++)s[d]=e[d]&255;new Go(Me.QR_CODE_FIELD_256).encode(s,t);const c=new Uint8Array(t);for(let d=0;d<t;d++)c[d]=s[n+d];return c}static appendModeInfo(e,t){t.appendBits(e.getBits(),4)}static appendLengthInfo(e,t,n,s){const c=n.getCharacterCountBits(t);if(e>=1<<c)throw new dt(e+" is bigger than "+((1<<c)-1));s.appendBits(e,c)}static appendBytes(e,t,n,s){switch(t){case ke.NUMERIC:xt.appendNumericBytes(e,n);break;case ke.ALPHANUMERIC:xt.appendAlphanumericBytes(e,n);break;case ke.BYTE:xt.append8BitBytes(e,n,s);break;case ke.KANJI:xt.appendKanjiBytes(e,n);break;default:throw new dt("Invalid mode: "+t)}}static getDigit(e){return e.charCodeAt(0)-48}static isDigit(e){const t=xt.getDigit(e);return t>=0&&t<=9}static appendNumericBytes(e,t){const n=e.length;let s=0;for(;s<n;){const c=xt.getDigit(e.charAt(s));if(s+2<n){const d=xt.getDigit(e.charAt(s+1)),h=xt.getDigit(e.charAt(s+2));t.appendBits(c*100+d*10+h,10),s+=3}else if(s+1<n){const d=xt.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=xt.getAlphanumericCode(e.charCodeAt(s));if(c===-1)throw new dt;if(s+1<n){const d=xt.getAlphanumericCode(e.charCodeAt(s+1));if(d===-1)throw new dt;t.appendBits(c*45+d,11),s+=2}else t.appendBits(c,6),s++}}static append8BitBytes(e,t,n){let s;try{s=Q.encode(e,n)}catch(c){throw new dt(c)}for(let c=0,d=s.length;c!==d;c++){const h=s[c];t.appendBits(h,8)}}static appendKanjiBytes(e,t){let n;try{n=Q.encode(e,L.SJIS)}catch(c){throw new dt(c)}const s=n.length;for(let c=0;c<s;c+=2){const d=n[c]&255,h=n[c+1]&255,g=d<<8&4294967295|h;let _=-1;if(g>=33088&&g<=40956?_=g-33088:g>=57408&&g<=60351&&(_=g-49472),_===-1)throw new dt("Invalid byte sequence");const E=(_>>8)*192+(_&255);t.appendBits(E,13)}}static appendECI(e,t){t.appendBits(ke.ECI.getBits(),4),t.appendBits(e.getValue(),8)}}xt.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]),xt.DEFAULT_BYTE_MODE_ENCODING=L.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=mt.L,d=ur.QUIET_ZONE_SIZE;s!==null&&(s.get(Pt.ERROR_CORRECTION)!==void 0&&(c=mt.fromString(s.get(Pt.ERROR_CORRECTION).toString())),s.get(Pt.MARGIN)!==void 0&&(d=Number.parseInt(s.get(Pt.MARGIN).toString(),10)));const h=xt.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 Ue;const d=c.getWidth(),h=c.getHeight(),g=d+s*2,_=h+s*2,E=Math.max(t,g),A=Math.max(n,_),S=Math.min(Math.floor(E/g),Math.floor(A/_)),B=Math.floor((E-d*S)/2),z=Math.floor((A-h*S)/2),W=this.createSVGElement(E,A);for(let Y=0,ie=z;Y<h;Y++,ie+=S)for(let ue=0,fe=B;ue<d;ue++,fe+=S)if(c.get(ue,Y)===1){const le=this.createSvgRectElement(fe,ie,S,S);W.appendChild(le)}return W}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!==xe.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=mt.L,h=Rr.QUIET_ZONE_SIZE;c!==null&&(c.get(Pt.ERROR_CORRECTION)!==void 0&&(d=mt.fromString(c.get(Pt.ERROR_CORRECTION).toString())),c.get(Pt.MARGIN)!==void 0&&(h=Number.parseInt(c.get(Pt.MARGIN).toString(),10)));const g=xt.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 Ue;const d=c.getWidth(),h=c.getHeight(),g=d+s*2,_=h+s*2,E=Math.max(t,g),A=Math.max(n,_),S=Math.min(Math.floor(E/g),Math.floor(A/_)),B=Math.floor((E-d*S)/2),z=Math.floor((A-h*S)/2),W=new H(E,A);for(let Y=0,ie=z;Y<h;Y++,ie+=S)for(let ue=0,fe=B;ue<d;ue++,fe+=S)c.get(ue,Y)===1&&W.setRegion(fe,ie,S,S);return W}}Rr.QUIET_ZONE_SIZE=4;class Mg{encode(e,t,n,s,c){let d;switch(t){case xe.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 Mn 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 Mn(this.yuvData,this.dataWidth,this.dataHeight,this.left+e,this.top+t,n,s,!1)}renderThumbnail(){const e=this.getWidth()/Mn.THUMBNAIL_SCALE_FACTOR,t=this.getHeight()/Mn.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 _=s[c+g*Mn.THUMBNAIL_SCALE_FACTOR]&255;n[h+g]=4278190080|_*65793}c+=this.dataWidth*Mn.THUMBNAIL_SCALE_FACTOR}return n}getThumbnailWidth(){return this.getWidth()/Mn.THUMBNAIL_SCALE_FACTOR}getThumbnailHeight(){return this.getHeight()/Mn.THUMBNAIL_SCALE_FACTOR}reverseHorizontal(e,t){const n=this.yuvData;for(let 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 _=n[h];n[h]=n[g],n[g]=_}}}invert(){return new K(this)}}Mn.THUMBNAIL_SCALE_FACTOR=2;class Wo extends q{constructor(e,t,n,s,c,d,h){if(super(t,n),this.dataWidth=s,this.dataHeight=c,this.left=d,this.top=h,e.BYTES_PER_ELEMENT===4){const g=t*n,_=new Uint8ClampedArray(g);for(let E=0;E<g;E++){const A=e[E],S=A>>16&255,B=A>>7&510,z=A&255;_[E]=(S+B+z)/4&255}this.luminances=_}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 Wo(this.luminances,n,s,this.dataWidth,this.dataHeight,this.left+e,this.top+t)}invert(){return new K(this)}}class tl extends L{static forName(e){return this.getCharacterSetECIByName(e)}}class Xo{}Xo.ISO_8859_1=L.ISO8859_1;class nl{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 rl{static singletonList(e){return[e]}static min(e,t){return e.sort(t)[0]}}class Dg{constructor(e){this.previous=e}getPrevious(){return this.previous}}class Br extends Dg{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,"<"+R.toBinaryString(e|1<<this.bitCount).substring(1)+">"}}class $o extends Br{constructor(e,t,n){super(e,0,0),this.binaryShiftStart=t,this.binaryShiftByteCount=n}appendTo(e,t){for(let n=0;n<this.binaryShiftByteCount;n++)(n===0||n===31&&this.binaryShiftByteCount<=62)&&(e.appendBits(31,5),this.binaryShiftByteCount>62?e.appendBits(this.binaryShiftByteCount-31,16):n===0?e.appendBits(Math.min(this.binaryShiftByteCount,31),5):e.appendBits(this.binaryShiftByteCount-31,5)),e.appendBits(t[this.binaryShiftStart+n],8)}addBinaryShift(e,t){return new $o(this,e,t)}toString(){return"<"+this.binaryShiftStart+"::"+(this.binaryShiftStart+this.binaryShiftByteCount-1)+">"}}function vg(b,e,t){return new $o(b,e,t)}function ti(b,e,t){return new Br(b,e,t)}const Pg=["UPPER","LOWER","DIGIT","MIXED","PUNCT"],Yn=0,Fi=1,xn=2,il=3,Dn=4,Lg=new Br(null,0,0),jo=[Int32Array.from([0,(5<<16)+28,(5<<16)+30,(5<<16)+29,656318]),Int32Array.from([(9<<16)+480+14,0,(5<<16)+30,(5<<16)+29,656318]),Int32Array.from([(4<<16)+14,(9<<16)+448+28,0,(9<<16)+448+29,932798]),Int32Array.from([(5<<16)+29,(5<<16)+28,656318,0,(5<<16)+30]),Int32Array.from([(5<<16)+31,656380,656382,656381,0])];function Fg(b){for(let e of b)M.fill(e,-1);return b[Yn][Dn]=0,b[Fi][Dn]=0,b[Fi][Yn]=28,b[il][Dn]=0,b[xn][Dn]=0,b[xn][Yn]=15,b}const ol=Fg(M.createInt32Array(6,6));class vn{constructor(e,t,n,s){this.token=e,this.mode=t,this.binaryShiftByteCount=n,this.bitCount=s}getMode(){return this.mode}getToken(){return this.token}getBinaryShiftByteCount(){return this.binaryShiftByteCount}getBitCount(){return this.bitCount}latchAndAppend(e,t){let n=this.bitCount,s=this.token;if(e!==this.mode){let d=jo[this.mode][e];s=ti(s,d&65535,d>>16),n+=d>>16}let c=e===xn?4:5;return s=ti(s,t,c),new vn(s,e,0,n+c)}shiftAndAppend(e,t){let n=this.token,s=this.mode===xn?4:5;return n=ti(n,ol[this.mode][e],s),n=ti(n,t,5),new vn(n,this.mode,0,this.bitCount+s+5)}addBinaryShiftChar(e){let t=this.token,n=this.mode,s=this.bitCount;if(this.mode===Dn||this.mode===xn){let h=jo[n][Yn];t=ti(t,h&65535,h>>16),s+=h>>16,n=Yn}let c=this.binaryShiftByteCount===0||this.binaryShiftByteCount===31?18:this.binaryShiftByteCount===62?9:8,d=new vn(t,n,this.binaryShiftByteCount+1,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=vg(t,e-this.binaryShiftByteCount,this.binaryShiftByteCount),new vn(t,this.mode,0,this.bitCount)}isBetterThanOrEqualTo(e){let t=this.bitCount+(jo[this.mode][e.mode]>>16);return this.binaryShiftByteCount<e.binaryShiftByteCount?t+=vn.calculateBinaryShiftCost(e)-vn.calculateBinaryShiftCost(this):this.binaryShiftByteCount>e.binaryShiftByteCount&&e.binaryShiftByteCount>0&&(t+=10),t<=e.bitCount}toBitArray(e){let t=[];for(let s=this.endBinaryShift(e.length).token;s!==null;s=s.getPrevious())t.unshift(s);let n=new F;for(const s of t)s.appendTo(n,e);return n}toString(){return ee.format("%s bits=%d bytes=%d",Pg[this.mode],this.bitCount,this.binaryShiftByteCount)}static calculateBinaryShiftCost(e){return e.binaryShiftByteCount>62?21:e.binaryShiftByteCount>31?20:e.binaryShiftByteCount>0?10:0}}vn.INITIAL_STATE=new vn(Lg,Yn,0,0);function Vg(b){const e=ee.getCharCode(" "),t=ee.getCharCode("."),n=ee.getCharCode(",");b[Yn][e]=1;const s=ee.getCharCode("Z"),c=ee.getCharCode("A");for(let S=c;S<=s;S++)b[Yn][S]=S-c+2;b[Fi][e]=1;const d=ee.getCharCode("z"),h=ee.getCharCode("a");for(let S=h;S<=d;S++)b[Fi][S]=S-h+2;b[xn][e]=1;const g=ee.getCharCode("9"),_=ee.getCharCode("0");for(let S=_;S<=g;S++)b[xn][S]=S-_+2;b[xn][n]=12,b[xn][t]=13;const E=["\0"," ","","","","","","","\x07","\b"," ",`
29
- `,"\v","\f","\r","\x1B","","","","","@","\\","^","_","`","|","~",""];for(let S=0;S<E.length;S++)b[il][ee.getCharCode(E[S])]=S;const A=["\0","\r","\0","\0","\0","\0","!","'","#","$","%","&","'","(",")","*","+",",","-",".","/",":",";","<","=",">","?","[","]","{","}"];for(let S=0;S<A.length;S++)ee.getCharCode(A[S])>0&&(b[Dn][ee.getCharCode(A[S])]=S);return b}const qo=Vg(M.createInt32Array(5,256));class ni{constructor(e){this.text=e}encode(){const e=ee.getCharCode(" "),t=ee.getCharCode(`
30
- `);let n=rl.singletonList(vn.INITIAL_STATE);for(let c=0;c<this.text.length;c++){let d,h=c+1<this.text.length?this.text[c+1]:0;switch(this.text[c]){case ee.getCharCode("\r"):d=h===t?2:0;break;case ee.getCharCode("."):d=h===e?3:0;break;case ee.getCharCode(","):d=h===e?4:0;break;case ee.getCharCode(":"):d=h===e?5:0;break;default:d=0}d>0?(n=ni.updateStateListForPair(n,c,d),c++):n=this.updateStateListForChar(n,c)}return rl.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 ni.simplifyStates(n)}updateStateForChar(e,t,n){let s=this.text[t]&255,c=qo[e.getMode()][s]>0,d=null;for(let h=0;h<=Dn;h++){let g=qo[h][s];if(g>0){if(d==null&&(d=e.endBinaryShift(t)),!c||h===e.getMode()||h===xn){const _=d.latchAndAppend(h,g);n.push(_)}if(!c&&ol[e.getMode()][h]>=0){const _=d.shiftAndAppend(h,g);n.push(_)}}}if(e.getBinaryShiftByteCount()>0||qo[e.getMode()][s]===0){let h=e.addBinaryShiftChar(t);n.push(h)}}static updateStateListForPair(e,t,n){const s=[];for(let c of e)this.updateStateForPair(c,t,n,s);return this.simplifyStates(s)}static updateStateForPair(e,t,n,s){let c=e.endBinaryShift(t);if(s.push(c.latchAndAppend(Dn,n)),e.getMode()!==Dn&&s.push(c.shiftAndAppend(Dn,n)),n===3||n===4){let d=c.latchAndAppend(xn,16-n).latchAndAppend(xn,1);s.push(d)}if(e.getBinaryShiftByteCount()>0){let d=e.addBinaryShiftChar(t).addBinaryShiftChar(t+1);s.push(d)}}static simplifyStates(e){let t=[];for(const n of e){let s=!0;for(const c of t){if(c.isBetterThanOrEqualTo(n)){s=!1;break}n.isBetterThanOrEqualTo(c)&&(t=t.filter(d=>d!==c))}s&&t.push(n)}return t}}class Ke{constructor(){}static encodeBytes(e){return Ke.encode(e,Ke.DEFAULT_EC_PERCENT,Ke.DEFAULT_AZTEC_LAYERS)}static encode(e,t,n){let s=new ni(e).encode(),c=R.truncDivision(s.getSize()*t,100)+11,d=s.getSize()+c,h,g,_,E,A;if(n!==Ke.DEFAULT_AZTEC_LAYERS){if(h=n<0,g=Math.abs(n),g>(h?Ke.MAX_NB_BITS_COMPACT:Ke.MAX_NB_BITS))throw new y(ee.format("Illegal value %s for layers",n));_=Ke.totalBitsInLayer(g,h),E=Ke.WORD_SIZE[g];let le=_-_%E;if(A=Ke.stuffBits(s,E),A.getSize()+c>le)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 le=0;;le++){if(le>Ke.MAX_NB_BITS)throw new y("Data too large for an Aztec code");if(h=le<=3,g=h?le+1:le,_=Ke.totalBitsInLayer(g,h),d>_)continue;(A==null||E!==Ke.WORD_SIZE[g])&&(E=Ke.WORD_SIZE[g],A=Ke.stuffBits(s,E));let je=_-_%E;if(!(h&&A.getSize()>E*64)&&A.getSize()+c<=je)break}}let S=Ke.generateCheckWords(A,_,E),B=A.getSize()/E,z=Ke.generateModeMessage(h,g,B),W=(h?11:14)+g*4,Y=new Int32Array(W),ie;if(h){ie=W;for(let le=0;le<Y.length;le++)Y[le]=le}else{ie=W+1+2*R.truncDivision(R.truncDivision(W,2)-1,15);let le=R.truncDivision(W,2),je=R.truncDivision(ie,2);for(let Fe=0;Fe<le;Fe++){let rn=Fe+R.truncDivision(Fe,15);Y[le-Fe-1]=je-rn-1,Y[le+Fe]=je+rn+1}}let ue=new H(ie);for(let le=0,je=0;le<g;le++){let Fe=(g-le)*4+(h?9:12);for(let rn=0;rn<Fe;rn++){let Sn=rn*2;for(let on=0;on<2;on++)S.get(je+Sn+on)&&ue.set(Y[le*2+on],Y[le*2+rn]),S.get(je+Fe*2+Sn+on)&&ue.set(Y[le*2+rn],Y[W-1-le*2-on]),S.get(je+Fe*4+Sn+on)&&ue.set(Y[W-1-le*2-on],Y[W-1-le*2-rn]),S.get(je+Fe*6+Sn+on)&&ue.set(Y[W-1-le*2-rn],Y[le*2+on])}je+=Fe*8}if(Ke.drawModeMessage(ue,h,ie,z),h)Ke.drawBullsEye(ue,R.truncDivision(ie,2),5);else{Ke.drawBullsEye(ue,R.truncDivision(ie,2),7);for(let le=0,je=0;le<R.truncDivision(W,2)-1;le+=15,je+=16)for(let Fe=R.truncDivision(ie,2)&1;Fe<ie;Fe+=2)ue.set(R.truncDivision(ie,2)-je,Fe),ue.set(R.truncDivision(ie,2)+je,Fe),ue.set(Fe,R.truncDivision(ie,2)-je),ue.set(Fe,R.truncDivision(ie,2)+je)}let fe=new nl;return fe.setCompact(h),fe.setSize(ie),fe.setLayers(g),fe.setCodeWords(B),fe.setMatrix(ue),fe}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 F;return e?(s.appendBits(t-1,2),s.appendBits(n-1,6),s=Ke.generateCheckWords(s,28,4)):(s.appendBits(t-1,5),s.appendBits(n-1,11),s=Ke.generateCheckWords(s,40,4)),s}static drawModeMessage(e,t,n,s){let c=R.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+R.truncDivision(d,5);s.get(d)&&e.set(h,c-7),s.get(d+10)&&e.set(c+7,h),s.get(29-d)&&e.set(h,c+7),s.get(39-d)&&e.set(c-7,h)}}static generateCheckWords(e,t,n){let s=e.getSize()/n,c=new Go(Ke.getGF(n)),d=R.truncDivision(t,n),h=Ke.bitsToWords(e,n,d);c.encode(h,d-s);let g=t%n,_=new F;_.appendBits(0,g);for(const E of Array.from(h))_.appendBits(E,n);return _}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 Me.AZTEC_PARAM;case 6:return Me.AZTEC_DATA_6;case 8:return Me.AZTEC_DATA_8;case 10:return Me.AZTEC_DATA_10;case 12:return Me.AZTEC_DATA_12;default:throw new y("Unsupported word size "+e)}}static stuffBits(e,t){let n=new F,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}}Ke.DEFAULT_EC_PERCENT=33,Ke.DEFAULT_AZTEC_LAYERS=0,Ke.MAX_NB_BITS=32,Ke.MAX_NB_BITS_COMPACT=4,Ke.WORD_SIZE=Int32Array.from([4,6,6,8,8,8,8,8,8,10,10,10,10,10,10,10,10,10,10,10,10,10,10,12,12,12,12,12,12,12,12,12,12]);class Vi{encode(e,t,n,s){return this.encodeWithHints(e,t,n,s,null)}encodeWithHints(e,t,n,s,c){let d=Xo.ISO_8859_1,h=Ke.DEFAULT_EC_PERCENT,g=Ke.DEFAULT_AZTEC_LAYERS;return c!=null&&(c.has(Pt.CHARACTER_SET)&&(d=tl.forName(c.get(Pt.CHARACTER_SET).toString())),c.has(Pt.ERROR_CORRECTION)&&(h=R.parseInt(c.get(Pt.ERROR_CORRECTION).toString())),c.has(Pt.AZTEC_LAYERS)&&(g=R.parseInt(c.get(Pt.AZTEC_LAYERS).toString()))),Vi.encodeLayers(e,t,n,s,d,h,g)}static encodeLayers(e,t,n,s,c,d,h){if(t!==xe.AZTEC)throw new y("Can only encode AZTEC, but got "+t);let g=Ke.encode(ee.getBytes(e,c),d,h);return Vi.renderResult(g,n,s)}static renderResult(e,t,n){let s=e.getMatrix();if(s==null)throw new Ue;let c=s.getWidth(),d=s.getHeight(),h=Math.max(t,c),g=Math.max(n,d),_=Math.min(h/c,g/d),E=(h-c*_)/2,A=(g-d*_)/2,S=new H(h,g);for(let B=0,z=A;B<d;B++,z+=_)for(let W=0,Y=E;W<c;W++,Y+=_)s.get(W,B)&&S.setRegion(Y,z,_,_);return S}}o.AbstractExpandedDecoder=Mo,o.ArgumentException=C,o.ArithmeticException=it,o.AztecCode=nl,o.AztecCodeReader=Sr,o.AztecCodeWriter=Vi,o.AztecDecoder=Qe,o.AztecDetector=Bi,o.AztecDetectorResult=qr,o.AztecEncoder=Ke,o.AztecHighLevelEncoder=ni,o.AztecPoint=Ut,o.BarcodeFormat=xe,o.Binarizer=T,o.BinaryBitmap=N,o.BitArray=F,o.BitMatrix=H,o.BitSource=Lo,o.BrowserAztecCodeReader=Oo,o.BrowserBarcodeReader=pg,o.BrowserCodeReader=Ce,o.BrowserDatamatrixCodeReader=wg,o.BrowserMultiFormatReader=kg,o.BrowserPDF417Reader=Rg,o.BrowserQRCodeReader=Bg,o.BrowserQRCodeSvgWriter=ur,o.CharacterSetECI=L,o.ChecksumException=O,o.Code128Reader=me,o.Code39Reader=bt,o.DataMatrixDecodedBitStreamParser=$n,o.DataMatrixReader=jn,o.DecodeHintType=Z,o.DecoderResult=et,o.DefaultGridSampler=Ri,o.DetectorResult=br,o.EAN13Reader=zt,o.EncodeHintType=Pt,o.Exception=x,o.FormatException=V,o.GenericGF=Me,o.GenericGFPoly=Ve,o.GlobalHistogramBinarizer=$,o.GridSampler=Ar,o.GridSamplerInstance=Rn,o.HTMLCanvasElementLuminanceSource=oe,o.HybridBinarizer=j,o.ITFReader=tt,o.IllegalArgumentException=y,o.IllegalStateException=Ue,o.InvertedLuminanceSource=K,o.LuminanceSource=q,o.MathUtils=ve,o.MultiFormatOneDReader=Tr,o.MultiFormatReader=el,o.MultiFormatWriter=Mg,o.NotFoundException=I,o.OneDReader=ht,o.PDF417DecodedBitStreamParser=ne,o.PDF417DecoderErrorCorrection=qa,o.PDF417Reader=Gt,o.PDF417ResultMetadata=Ya,o.PerspectiveTransform=dn,o.PlanarYUVLuminanceSource=Mn,o.QRCodeByteMatrix=Li,o.QRCodeDataMask=gn,o.QRCodeDecodedBitStreamParser=At,o.QRCodeDecoderErrorCorrectionLevel=mt,o.QRCodeDecoderFormatInformation=$t,o.QRCodeEncoder=xt,o.QRCodeEncoderQRCode=dr,o.QRCodeMaskUtil=kt,o.QRCodeMatrixUtil=Be,o.QRCodeMode=ke,o.QRCodeReader=qn,o.QRCodeVersion=Ne,o.QRCodeWriter=Rr,o.RGBLuminanceSource=Wo,o.RSS14Reader=Tt,o.RSSExpandedReader=ae,o.ReaderException=Pi,o.ReedSolomonDecoder=It,o.ReedSolomonEncoder=Go,o.ReedSolomonException=Ie,o.Result=ge,o.ResultMetadataType=be,o.ResultPoint=ye,o.StringUtils=ee,o.UnsupportedOperationException=re,o.VideoInputDevice=de,o.WhiteRectangleDetector=Dt,o.WriterException=dt,o.ZXingArrays=M,o.ZXingCharset=tl,o.ZXingInteger=R,o.ZXingStandardCharsets=Xo,o.ZXingStringBuilder=X,o.ZXingStringEncoding=Q,o.ZXingSystem=v,o.createAbstractExpandedDecoder=$a,Object.defineProperty(o,"__esModule",{value:!0})})})(So,So.exports);var gt=So.exports;const Y2=cl({__proto__:null,default:ta(gt)},[gt]);var ba=function(){function a(l,o,i){if(this.formatMap=new Map([[_e.QR_CODE,gt.BarcodeFormat.QR_CODE],[_e.AZTEC,gt.BarcodeFormat.AZTEC],[_e.CODABAR,gt.BarcodeFormat.CODABAR],[_e.CODE_39,gt.BarcodeFormat.CODE_39],[_e.CODE_93,gt.BarcodeFormat.CODE_93],[_e.CODE_128,gt.BarcodeFormat.CODE_128],[_e.DATA_MATRIX,gt.BarcodeFormat.DATA_MATRIX],[_e.MAXICODE,gt.BarcodeFormat.MAXICODE],[_e.ITF,gt.BarcodeFormat.ITF],[_e.EAN_13,gt.BarcodeFormat.EAN_13],[_e.EAN_8,gt.BarcodeFormat.EAN_8],[_e.PDF_417,gt.BarcodeFormat.PDF_417],[_e.RSS_14,gt.BarcodeFormat.RSS_14],[_e.RSS_EXPANDED,gt.BarcodeFormat.RSS_EXPANDED],[_e.UPC_A,gt.BarcodeFormat.UPC_A],[_e.UPC_E,gt.BarcodeFormat.UPC_E],[_e.UPC_EAN_EXTENSION,gt.BarcodeFormat.UPC_EAN_EXTENSION]]),this.reverseFormatMap=this.createReverseFormatMap(),!Y2)throw"Use html5qrcode.min.js without edit, ZXing not found.";this.verbose=o,this.logger=i;var u=this.createZXingFormats(l),f=new Map;f.set(gt.DecodeHintType.POSSIBLE_FORMATS,u),f.set(gt.DecodeHintType.TRY_HARDER,!1),this.hints=f}return a.prototype.decodeAsync=function(l){var o=this;return new Promise(function(i,u){try{i(o.decode(l))}catch(f){u(f)}})},a.prototype.decode=function(l){var o=new gt.MultiFormatReader(this.verbose,this.hints),i=new gt.HTMLCanvasElementLuminanceSource(l),u=new gt.BinaryBitmap(new gt.HybridBinarizer(i)),f=o.decode(u);return{text:f.text,format:Ca.create(this.toHtml5QrcodeSupportedFormats(f.format)),debugData:this.createDebugData()}},a.prototype.createReverseFormatMap=function(){var l=new Map;return this.formatMap.forEach(function(o,i,u){l.set(o,i)}),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 o=[],i=0,u=l;i<u.length;i++){var f=u[i];this.formatMap.has(f)?o.push(this.formatMap.get(f)):this.logger.logError("".concat(f," is not supported by")+"ZXingHtml5QrcodeShim")}return o},a.prototype.createDebugData=function(){return{decoderName:"zxing-js"}},a}(),K2=function(a,l,o,i){function u(f){return f instanceof o?f:new o(function(m){m(f)})}return new(o||(o=Promise))(function(f,m){function p(C){try{x(i.next(C))}catch(y){m(y)}}function w(C){try{x(i.throw(C))}catch(y){m(y)}}function x(C){C.done?f(C.value):u(C.value).then(p,w)}x((i=i.apply(a,l||[])).next())})},Q2=function(a,l){var o={label:0,sent:function(){if(f[0]&1)throw f[1];return f[1]},trys:[],ops:[]},i,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 w([x,C])}}function w(x){if(i)throw new TypeError("Generator is already executing.");for(;m&&(m=0,x[0]&&(o=0)),o;)try{if(i=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 o.label++,{value:x[1],done:!1};case 5:o.label++,u=x[1],x=[0];continue;case 7:x=o.ops.pop(),o.trys.pop();continue;default:if(f=o.trys,!(f=f.length>0&&f[f.length-1])&&(x[0]===6||x[0]===2)){o=0;continue}if(x[0]===3&&(!f||x[1]>f[0]&&x[1]<f[3])){o.label=x[1];break}if(x[0]===6&&o.label<f[1]){o.label=f[1],f=x;break}if(f&&o.label<f[2]){o.label=f[2],o.ops.push(x);break}f[2]&&o.ops.pop(),o.trys.pop();continue}x=l.call(a,o)}catch(C){x=[6,C],u=0}finally{i=f=0}if(x[0]&5)throw x[1];return{value:x[0]?x[1]:void 0,done:!0}}},Aa=function(){function a(l,o,i){if(this.formatMap=new Map([[_e.QR_CODE,"qr_code"],[_e.AZTEC,"aztec"],[_e.CODABAR,"codabar"],[_e.CODE_39,"code_39"],[_e.CODE_93,"code_93"],[_e.CODE_128,"code_128"],[_e.DATA_MATRIX,"data_matrix"],[_e.ITF,"itf"],[_e.EAN_13,"ean_13"],[_e.EAN_8,"ean_8"],[_e.PDF_417,"pdf417"],[_e.UPC_A,"upc_a"],[_e.UPC_E,"upc_e"]]),this.reverseFormatMap=this.createReverseFormatMap(),!a.isSupported())throw"Use html5qrcode.min.js without edit, Use BarcodeDetectorDelegate only if it isSupported();";this.verbose=o,this.logger=i;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 K2(this,void 0,void 0,function(){var o,i;return Q2(this,function(u){switch(u.label){case 0:return[4,this.detector.detect(l)];case 1:if(o=u.sent(),!o||o.length===0)throw"No barcode or QR code detected.";return i=this.selectLargestBarcode(o),[2,{text:i.rawValue,format:Ca.create(this.toHtml5QrcodeSupportedFormats(i.format)),debugData:this.createDebugData()}]}})})},a.prototype.selectLargestBarcode=function(l){for(var o=null,i=0,u=0,f=l;u<f.length;u++){var m=f[u],p=m.boundingBox.width*m.boundingBox.height;p>i&&(i=p,o=m)}if(!o)throw"No largest barcode found";return o},a.prototype.createBarcodeDetectorFormats=function(l){for(var o=[],i=0,u=l;i<u.length;i++){var f=u[i];this.formatMap.has(f)?o.push(this.formatMap.get(f)):this.logger.warn("".concat(f," is not supported by")+"BarcodeDetectorDelegate")}return{formats:o}},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(o,i,u){l.set(o,i)}),l},a.prototype.createDebugData=function(){return{decoderName:"BarcodeDetector"}},a}(),Sa=function(a,l,o,i){function u(f){return f instanceof o?f:new o(function(m){m(f)})}return new(o||(o=Promise))(function(f,m){function p(C){try{x(i.next(C))}catch(y){m(y)}}function w(C){try{x(i.throw(C))}catch(y){m(y)}}function x(C){C.done?f(C.value):u(C.value).then(p,w)}x((i=i.apply(a,l||[])).next())})},Ia=function(a,l){var o={label:0,sent:function(){if(f[0]&1)throw f[1];return f[1]},trys:[],ops:[]},i,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 w([x,C])}}function w(x){if(i)throw new TypeError("Generator is already executing.");for(;m&&(m=0,x[0]&&(o=0)),o;)try{if(i=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 o.label++,{value:x[1],done:!1};case 5:o.label++,u=x[1],x=[0];continue;case 7:x=o.ops.pop(),o.trys.pop();continue;default:if(f=o.trys,!(f=f.length>0&&f[f.length-1])&&(x[0]===6||x[0]===2)){o=0;continue}if(x[0]===3&&(!f||x[1]>f[0]&&x[1]<f[3])){o.label=x[1];break}if(x[0]===6&&o.label<f[1]){o.label=f[1],f=x;break}if(f&&o.label<f[2]){o.label=f[2],o.ops.push(x);break}f[2]&&o.ops.pop(),o.trys.pop();continue}x=l.call(a,o)}catch(C){x=[6,C],u=0}finally{i=f=0}if(x[0]&5)throw x[1];return{value:x[0]?x[1]:void 0,done:!0}}},J2=function(){function a(l,o,i,u){this.EXECUTIONS_TO_REPORT_PERFORMANCE=100,this.executions=0,this.executionResults=[],this.wasPrimaryDecoderUsedInLastDecode=!1,this.verbose=i,o&&Aa.isSupported()?(this.primaryDecoder=new Aa(l,i,u),this.secondaryDecoder=new ba(l,i,u)):this.primaryDecoder=new ba(l,i,u)}return a.prototype.decodeAsync=function(l){return Sa(this,void 0,void 0,function(){var o;return Ia(this,function(i){switch(i.label){case 0:o=performance.now(),i.label=1;case 1:return i.trys.push([1,,3,4]),[4,this.getDecoder().decodeAsync(l)];case 2:return[2,i.sent()];case 3:return this.possiblyLogPerformance(o),[7];case 4:return[2]}})})},a.prototype.decodeRobustlyAsync=function(l){return Sa(this,void 0,void 0,function(){var o,i;return Ia(this,function(u){switch(u.label){case 0:o=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(i=u.sent(),this.secondaryDecoder)return[2,this.secondaryDecoder.decodeAsync(l)];throw i;case 4:return this.possiblyLogPerformance(o),[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 o=performance.now()-l;this.executionResults.push(o),this.executions++,this.possiblyFlushPerformanceReport()}},a.prototype.possiblyFlushPerformanceReport=function(){if(!(this.executions<this.EXECUTIONS_TO_REPORT_PERFORMANCE)){for(var l=0,o=0,i=this.executionResults;o<i.length;o++){var u=i[o];l+=u}var f=l/this.executionResults.length;console.log("".concat(f," ms for ").concat(this.executionResults.length," last runs.")),this.executions=0,this.executionResults=[]}},a}(),Io=function(){var a=function(l,o){return a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,u){i.__proto__=u}||function(i,u){for(var f in u)Object.prototype.hasOwnProperty.call(u,f)&&(i[f]=u[f])},a(l,o)};return function(l,o){if(typeof o!="function"&&o!==null)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");a(l,o);function i(){this.constructor=l}l.prototype=o===null?Object.create(o):(i.prototype=o.prototype,new i)}}(),Si=function(a,l,o,i){function u(f){return f instanceof o?f:new o(function(m){m(f)})}return new(o||(o=Promise))(function(f,m){function p(C){try{x(i.next(C))}catch(y){m(y)}}function w(C){try{x(i.throw(C))}catch(y){m(y)}}function x(C){C.done?f(C.value):u(C.value).then(p,w)}x((i=i.apply(a,l||[])).next())})},Ii=function(a,l){var o={label:0,sent:function(){if(f[0]&1)throw f[1];return f[1]},trys:[],ops:[]},i,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 w([x,C])}}function w(x){if(i)throw new TypeError("Generator is already executing.");for(;m&&(m=0,x[0]&&(o=0)),o;)try{if(i=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 o.label++,{value:x[1],done:!1};case 5:o.label++,u=x[1],x=[0];continue;case 7:x=o.ops.pop(),o.trys.pop();continue;default:if(f=o.trys,!(f=f.length>0&&f[f.length-1])&&(x[0]===6||x[0]===2)){o=0;continue}if(x[0]===3&&(!f||x[1]>f[0]&&x[1]<f[3])){o.label=x[1];break}if(x[0]===6&&o.label<f[1]){o.label=f[1],f=x;break}if(f&&o.label<f[2]){o.label=f[2],o.ops.push(x);break}f[2]&&o.ops.pop(),o.trys.pop();continue}x=l.call(a,o)}catch(C){x=[6,C],u=0}finally{i=f=0}if(x[0]&5)throw x[1];return{value:x[0]?x[1]:void 0,done:!0}}},Na=function(){function a(l,o){this.name=l,this.track=o}return a.prototype.isSupported=function(){return this.track.getCapabilities?this.name in this.track.getCapabilities():!1},a.prototype.apply=function(l){var o={};o[this.name]=l;var i={advanced:[o]};return this.track.applyConstraints(i)},a.prototype.value=function(){var l=this.track.getSettings();if(this.name in l){var o=l[this.name];return o}return null},a}(),em=function(a){Io(l,a);function l(o,i){return a.call(this,o,i)||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(o){var i={};i[this.name]=o;var u={advanced:[i]};return this.track.applyConstraints(u)},l.prototype.getCapabilities=function(){this.failIfNotSupported();var o=this.track.getCapabilities(),i=o[this.name];return{min:i.min,max:i.max,step:i.step}},l.prototype.failIfNotSupported=function(){if(!this.isSupported())throw new Error("".concat(this.name," capability not supported"))},l}(Na),tm=function(a){Io(l,a);function l(o){return a.call(this,"zoom",o)||this}return l}(em),nm=function(a){Io(l,a);function l(o){return a.call(this,"torch",o)||this}return l}(Na),rm=function(){function a(l){this.track=l}return a.prototype.zoomFeature=function(){return new tm(this.track)},a.prototype.torchFeature=function(){return new nm(this.track)},a}(),im=function(){function a(l,o,i){this.isClosed=!1,this.parentElement=l,this.mediaStream=o,this.callbacks=i,this.surface=this.createVideoElement(this.parentElement.clientWidth),l.append(this.surface)}return a.prototype.createVideoElement=function(l){var o=document.createElement("video");return o.style.width="".concat(l,"px"),o.style.display="block",o.muted=!0,o.setAttribute("muted","true"),o.playsInline=!0,o},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 o=function(){var i=l.surface.clientWidth,u=l.surface.clientHeight;l.callbacks.onRenderSurfaceReady(i,u),l.surface.removeEventListener("playing",o)};this.surface.addEventListener("playing",o),this.surface.srcObject=this.mediaStream,this.surface.play()},a.create=function(l,o,i,u){return Si(this,void 0,void 0,function(){var f,m;return Ii(this,function(p){switch(p.label){case 0:return f=new a(l,o,u),i.aspectRatio?(m={aspectRatio:i.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 o=this,i=function(){setTimeout(l,200),o.surface.removeEventListener("playing",i)};this.surface.addEventListener("playing",i),this.surface.play()},a.prototype.isPaused=function(){return this.failIfClosed(),this.surface.paused},a.prototype.getSurface=function(){return this.failIfClosed(),this.surface},a.prototype.getRunningTrackCapabilities=function(){return this.getFirstTrackOrFail().getCapabilities()},a.prototype.getRunningTrackSettings=function(){return this.getFirstTrackOrFail().getSettings()},a.prototype.applyVideoConstraints=function(l){return Si(this,void 0,void 0,function(){return Ii(this,function(o){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(o,i){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),o())})})},a.prototype.getCapabilities=function(){return new rm(this.getFirstTrackOrFail())},a}(),om=function(){function a(l){this.mediaStream=l}return a.prototype.render=function(l,o,i){return Si(this,void 0,void 0,function(){return Ii(this,function(u){return[2,im.create(l,this.mediaStream,o,i)]})})},a.create=function(l){return Si(this,void 0,void 0,function(){var o,i;return Ii(this,function(u){switch(u.label){case 0:if(!navigator.mediaDevices)throw"navigator.mediaDevices not supported";return o={audio:!1,video:l},[4,navigator.mediaDevices.getUserMedia(o)];case 1:return i=u.sent(),[2,new a(i)]}})})},a}(),Ta=function(a,l,o,i){function u(f){return f instanceof o?f:new o(function(m){m(f)})}return new(o||(o=Promise))(function(f,m){function p(C){try{x(i.next(C))}catch(y){m(y)}}function w(C){try{x(i.throw(C))}catch(y){m(y)}}function x(C){C.done?f(C.value):u(C.value).then(p,w)}x((i=i.apply(a,l||[])).next())})},ka=function(a,l){var o={label:0,sent:function(){if(f[0]&1)throw f[1];return f[1]},trys:[],ops:[]},i,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 w([x,C])}}function w(x){if(i)throw new TypeError("Generator is already executing.");for(;m&&(m=0,x[0]&&(o=0)),o;)try{if(i=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 o.label++,{value:x[1],done:!1};case 5:o.label++,u=x[1],x=[0];continue;case 7:x=o.ops.pop(),o.trys.pop();continue;default:if(f=o.trys,!(f=f.length>0&&f[f.length-1])&&(x[0]===6||x[0]===2)){o=0;continue}if(x[0]===3&&(!f||x[1]>f[0]&&x[1]<f[3])){o.label=x[1];break}if(x[0]===6&&o.label<f[1]){o.label=f[1],f=x;break}if(f&&o.label<f[2]){o.label=f[2],o.ops.push(x);break}f[2]&&o.ops.pop(),o.trys.pop();continue}x=l.call(a,o)}catch(C){x=[6,C],u=0}finally{i=f=0}if(x[0]&5)throw x[1];return{value:x[0]?x[1]:void 0,done:!0}}},sm=function(){function a(){}return a.failIfNotSupported=function(){return Ta(this,void 0,void 0,function(){return ka(this,function(l){if(!navigator.mediaDevices)throw"navigator.mediaDevices not supported";return[2,new a]})})},a.prototype.create=function(l){return Ta(this,void 0,void 0,function(){return ka(this,function(o){return[2,om.create(l)]})})},a}(),am=function(a,l,o,i){function u(f){return f instanceof o?f:new o(function(m){m(f)})}return new(o||(o=Promise))(function(f,m){function p(C){try{x(i.next(C))}catch(y){m(y)}}function w(C){try{x(i.throw(C))}catch(y){m(y)}}function x(C){C.done?f(C.value):u(C.value).then(p,w)}x((i=i.apply(a,l||[])).next())})},lm=function(a,l){var o={label:0,sent:function(){if(f[0]&1)throw f[1];return f[1]},trys:[],ops:[]},i,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 w([x,C])}}function w(x){if(i)throw new TypeError("Generator is already executing.");for(;m&&(m=0,x[0]&&(o=0)),o;)try{if(i=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 o.label++,{value:x[1],done:!1};case 5:o.label++,u=x[1],x=[0];continue;case 7:x=o.ops.pop(),o.trys.pop();continue;default:if(f=o.trys,!(f=f.length>0&&f[f.length-1])&&(x[0]===6||x[0]===2)){o=0;continue}if(x[0]===3&&(!f||x[1]>f[0]&&x[1]<f[3])){o.label=x[1];break}if(x[0]===6&&o.label<f[1]){o.label=f[1],f=x;break}if(f&&o.label<f[2]){o.label=f[2],o.ops.push(x);break}f[2]&&o.ops.pop(),o.trys.pop();continue}x=l.call(a,o)}catch(C){x=[6,C],u=0}finally{i=f=0}if(x[0]&5)throw x[1];return{value:x[0]?x[1]:void 0,done:!0}}},cm=function(){function a(){}return a.retrieve=function(){if(navigator.mediaDevices)return a.getCamerasFromMediaDevices();var l=MediaStreamTrack;return MediaStreamTrack&&l.getSources?a.getCamerasFromMediaStreamTrack():a.rejectWithError()},a.rejectWithError=function(){var l=Er.unableToQuerySupportedDevices();return a.isHttpsOrLocalhost()||(l=Er.insecureContextCameraQueryError()),Promise.reject(l)},a.isHttpsOrLocalhost=function(){if(location.protocol==="https:")return!0;var l=location.host.split(":")[0];return l==="127.0.0.1"||l==="localhost"},a.getCamerasFromMediaDevices=function(){return am(this,void 0,void 0,function(){var l,o,i,u,f,m,p;return lm(this,function(w){switch(w.label){case 0:return l=function(x){for(var C=x.getVideoTracks(),y=0,N=C;y<N.length;y++){var O=N[y];O.enabled=!1,O.stop(),x.removeTrack(O)}},[4,navigator.mediaDevices.getUserMedia({audio:!1,video:!0})];case 1:return o=w.sent(),[4,navigator.mediaDevices.enumerateDevices()];case 2:for(i=w.sent(),u=[],f=0,m=i;f<m.length;f++)p=m[f],p.kind==="videoinput"&&u.push({id:p.deviceId,label:p.label});return l(o),[2,u]}})})},a.getCamerasFromMediaStreamTrack=function(){return new Promise(function(l,o){var i=function(f){for(var m=[],p=0,w=f;p<w.length;p++){var x=w[p];x.kind==="video"&&m.push({id:x.id,label:x.label})}l(m)},u=MediaStreamTrack;u.getSources(i)})},a}(),St;(function(a){a[a.UNKNOWN=0]="UNKNOWN",a[a.NOT_STARTED=1]="NOT_STARTED",a[a.SCANNING=2]="SCANNING",a[a.PAUSED=3]="PAUSED"})(St||(St={}));var dm=function(){function a(){this.state=St.NOT_STARTED,this.onGoingTransactionNewState=St.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===St.UNKNOWN)throw"Transaction is already cancelled, cannot execute().";var l=this.onGoingTransactionNewState;this.onGoingTransactionNewState=St.UNKNOWN,this.directTransition(l)},a.prototype.cancel=function(){if(this.onGoingTransactionNewState===St.UNKNOWN)throw"Transaction is already cancelled, cannot cancel().";this.onGoingTransactionNewState=St.UNKNOWN},a.prototype.getState=function(){return this.state},a.prototype.failIfTransitionOngoing=function(){if(this.onGoingTransactionNewState!==St.UNKNOWN)throw"Cannot transition to a new state, already under transition"},a.prototype.validateTransition=function(l){switch(this.state){case St.UNKNOWN:throw"Transition from unknown is not allowed";case St.NOT_STARTED:this.failIfNewStateIs(l,[St.PAUSED]);break;case St.SCANNING:break;case St.PAUSED:break}},a.prototype.failIfNewStateIs=function(l,o){for(var i=0,u=o;i<u.length;i++){var f=u[i];if(l===f)throw"Cannot transition from ".concat(this.state," to ").concat(l)}},a}(),um=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()===St.NOT_STARTED},a.prototype.isScanning=function(){return this.stateManager.getState()!==St.NOT_STARTED},a.prototype.isStrictlyScanning=function(){return this.stateManager.getState()===St.SCANNING},a.prototype.isPaused=function(){return this.stateManager.getState()===St.PAUSED},a}(),fm=function(){function a(){}return a.create=function(){return new um(new dm)},a}(),hm=function(){var a=function(l,o){return a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,u){i.__proto__=u}||function(i,u){for(var f in u)Object.prototype.hasOwnProperty.call(u,f)&&(i[f]=u[f])},a(l,o)};return function(l,o){if(typeof o!="function"&&o!==null)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");a(l,o);function i(){this.constructor=l}l.prototype=o===null?Object.create(o):(i.prototype=o.prototype,new i)}}(),cn=function(a){hm(l,a);function l(){return a!==null&&a.apply(this,arguments)||this}return l.DEFAULT_WIDTH=300,l.DEFAULT_WIDTH_OFFSET=2,l.FILE_SCAN_MIN_HEIGHT=300,l.FILE_SCAN_HIDDEN_CANVAS_PADDING=100,l.MIN_QR_BOX_SIZE=50,l.SHADED_LEFT=1,l.SHADED_RIGHT=2,l.SHADED_TOP=3,l.SHADED_BOTTOM=4,l.SHADED_REGION_ELEMENT_ID="qr-shaded-region",l.VERBOSE=!1,l.BORDER_SHADER_DEFAULT_COLOR="#ffffff",l.BORDER_SHADER_MATCH_COLOR="rgb(90, 193, 56)",l}(j2),mm=function(){function a(l,o){this.logger=o,this.fps=cn.SCAN_DEFAULT_FPS,l?(l.fps&&(this.fps=l.fps),this.disableFlip=l.disableFlip===!0,this.qrbox=l.qrbox,this.aspectRatio=l.aspectRatio,this.videoConstraints=l.videoConstraints):this.disableFlip=cn.DEFAULT_DISABLE_FLIP}return a.prototype.isMediaStreamConstraintsValid=function(){return this.videoConstraints?ya.isMediaStreamConstraintsValid(this.videoConstraints,this.logger):(this.logger.logError("Empty videoConstraints",!0),!1)},a.prototype.isShadedBoxEnabled=function(){return!zn(this.qrbox)},a.create=function(l,o){return new a(l,o)},a}(),Ra=function(){function a(l,o){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 i;typeof o=="boolean"?this.verbose=o===!0:o&&(i=o,this.verbose=i.verbose===!0,i.experimentalFeatures),this.logger=new Z2(this.verbose),this.qrcode=new J2(this.getSupportedFormats(o),this.getUseBarCodeDetectorIfSupported(i),this.verbose,this.logger),this.foreverScanTimeout,this.shouldScan=!0,this.stateManagerProxy=fm.create()}return a.prototype.start=function(l,o,i,u){var f=this;if(!l)throw"cameraIdOrConfig is required";if(!i||typeof i!="function")throw"qrCodeSuccessCallback is required and should be a function.";var m;u?m=u:m=this.verbose?this.logger.log:function(){};var p=mm.create(o,this.logger);this.clearElement();var w=!1;p.videoConstraints&&(p.isMediaStreamConstraintsValid()?w=!0:this.logger.logError("'videoConstraints' is not valid 'MediaStreamConstraints, it will be ignored.'",!0));var x=w,C=document.getElementById(this.elementId);C.clientWidth?C.clientWidth:cn.DEFAULT_WIDTH,C.style.position="relative",this.shouldScan=!0,this.element=C;var y=this,N=this.stateManagerProxy.startTransition(St.SCANNING);return new Promise(function(O,T){var v=x?p.videoConstraints:y.createVideoConstraints(l);if(!v){N.cancel(),T("videoConstraints should be defined");return}var D={};(!x||p.aspectRatio)&&(D.aspectRatio=p.aspectRatio);var U={onRenderSurfaceReady:function(M,R){y.setupUi(M,R,p),y.isScanning=!0,y.foreverScan(p,i,m)}};sm.failIfNotSupported().then(function(M){M.create(v).then(function(R){return R.render(f.element,D,U).then(function(F){y.renderedCamera=F,N.execute(),O(null)}).catch(function(F){N.cancel(),T(F)})}).catch(function(R){N.cancel(),T(Er.errorGettingUserMedia(R))})}).catch(function(M){N.cancel(),T(Er.cameraStreamingNotSupported())})})},a.prototype.pause=function(l){if(!this.stateManagerProxy.isStrictlyScanning())throw"Cannot pause, scanner is not scanning.";this.stateManagerProxy.directTransition(St.PAUSED),this.showPausedState(),(zn(l)||l!==!0)&&(l=!1),l&&this.renderedCamera&&this.renderedCamera.pause()},a.prototype.resume=function(){if(!this.stateManagerProxy.isPaused())throw"Cannot result, scanner is not paused.";if(!this.renderedCamera)throw"renderedCamera doesn't exist while trying resume()";var l=this,o=function(){l.stateManagerProxy.directTransition(St.SCANNING),l.hidePausedState()};if(!this.renderedCamera.isPaused()){o();return}this.renderedCamera.resume(function(){o()})},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 o=this.stateManagerProxy.startTransition(St.NOT_STARTED);this.shouldScan=!1,this.foreverScanTimeout&&clearTimeout(this.foreverScanTimeout);var i=function(){if(l.element){var f=document.getElementById(cn.SHADED_REGION_ELEMENT_ID);f&&l.element.removeChild(f)}},u=this;return this.renderedCamera.close().then(function(){return u.renderedCamera=null,u.element&&(u.element.removeChild(u.canvasElement),u.canvasElement=null),i(),u.qrRegion&&(u.qrRegion=null),u.context&&(u.context=null),o.execute(),u.hidePausedState(),u.isScanning=!1,Promise.resolve()})},a.prototype.scanFile=function(l,o){return this.scanFileV2(l,o).then(function(i){return i.decodedText})},a.prototype.scanFileV2=function(l,o){var i=this;if(!l||!(l instanceof File))throw"imageFile argument is mandatory and should be instance of File. Use 'event.target.files[0]'.";if(zn(o)&&(o=!0),!this.stateManagerProxy.canScanFile())throw"Cannot start file scan - ongoing camera scan";return new Promise(function(u,f){i.possiblyCloseLastScanImageFile(),i.clearElement(),i.lastScanImageFile=URL.createObjectURL(l);var m=new Image;m.onload=function(){var p=m.width,w=m.height,x=document.getElementById(i.elementId),C=x.clientWidth?x.clientWidth:cn.DEFAULT_WIDTH,y=Math.max(x.clientHeight?x.clientHeight:w,cn.FILE_SCAN_MIN_HEIGHT),N=i.computeCanvasDrawConfig(p,w,C,y);if(o){var O=i.createCanvasElement(C,y,"qr-canvas-visible");O.style.display="inline-block",x.appendChild(O);var T=O.getContext("2d");if(!T)throw"Unable to get 2d context from canvas";T.canvas.width=C,T.canvas.height=y,T.drawImage(m,0,0,p,w,N.x,N.y,N.width,N.height)}var v=cn.FILE_SCAN_HIDDEN_CANVAS_PADDING,D=Math.max(m.width,N.width),U=Math.max(m.height,N.height),M=D+2*v,R=U+2*v,F=i.createCanvasElement(M,R);x.appendChild(F);var G=F.getContext("2d");if(!G)throw"Unable to get 2d context from canvas";G.canvas.width=M,G.canvas.height=R,G.drawImage(m,0,0,p,w,v,v,D,U);try{i.qrcode.decodeRobustlyAsync(F).then(function(Z){u(Ea.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 cm.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(!ya.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 o=[_e.QR_CODE,_e.AZTEC,_e.CODABAR,_e.CODE_39,_e.CODE_93,_e.CODE_128,_e.DATA_MATRIX,_e.MAXICODE,_e.ITF,_e.EAN_13,_e.EAN_8,_e.PDF_417,_e.RSS_14,_e.RSS_EXPANDED,_e.UPC_A,_e.UPC_E,_e.UPC_EAN_EXTENSION];if(!l||typeof l=="boolean"||!l.formatsToSupport)return o;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 i=[],u=0,f=l.formatsToSupport;u<f.length;u++){var m=f[u];$2(m)?i.push(m):this.logger.warn("Invalid format: ".concat(m," passed in config, ignoring."))}if(i.length===0)throw"None of formatsToSupport match supported values.";return i},a.prototype.getUseBarCodeDetectorIfSupported=function(l){if(zn(l))return!0;if(!zn(l.useBarCodeDetectorIfSupported))return l.useBarCodeDetectorIfSupported!==!1;if(zn(l.experimentalFeatures))return!0;var o=l.experimentalFeatures;return zn(o.useBarCodeDetectorIfSupported)?!0:o.useBarCodeDetectorIfSupported!==!1},a.prototype.validateQrboxSize=function(l,o,i){var u=this,f=i.qrbox;this.validateQrboxConfig(f);var m=this.toQrdimensions(l,o,f),p=function(x){if(x<cn.MIN_QR_BOX_SIZE)throw"minimum size of 'config.qrbox' dimension value is"+" ".concat(cn.MIN_QR_BOX_SIZE,"px.")},w=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=w(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,o,i){if(typeof i=="number")return{width:i,height:i};if(typeof i=="function")try{return i(l,o)}catch(u){throw new Error("qrbox config was passed as a function but it failed with unknown error"+u)}return i},a.prototype.setupUi=function(l,o,i){i.isShadedBoxEnabled()&&this.validateQrboxSize(l,o,i);var u=zn(i.qrbox)?{width:l,height:o}:i.qrbox;this.validateQrboxConfig(u);var f=this.toQrdimensions(l,o,u);f.height>o&&this.logger.warn("[Html5Qrcode] config.qrbox has height that isgreater than the height of the video stream. Shading will be ignored");var m=i.isShadedBoxEnabled()&&f.height<=o,p={x:0,y:0,width:l,height:o},w=m?this.getShadedRegionBounds(l,o,f):p,x=this.createCanvasElement(w.width,w.height),C={willReadFrequently:!0},y=x.getContext("2d",C);y.canvas.width=w.width,y.canvas.height=w.height,this.element.append(x),m&&this.possiblyInsertShadingElement(this.element,l,o,f),this.createScannerPausedUiElement(this.element),this.qrRegion=w,this.context=y,this.canvasElement=x},a.prototype.createScannerPausedUiElement=function(l){var o=document.createElement("div");o.innerText=Er.scannerPaused(),o.style.display="none",o.style.position="absolute",o.style.top="0px",o.style.zIndex="1",o.style.background="rgba(9, 9, 9, 0.46)",o.style.color="#FFECEC",o.style.textAlign="center",o.style.width="100%",l.appendChild(o),this.scannerPausedUiElement=o},a.prototype.scanContext=function(l,o){var i=this;return this.stateManagerProxy.isPaused()?Promise.resolve(!1):this.qrcode.decodeAsync(this.canvasElement).then(function(u){return l(u.text,Ea.createFromQrcodeResult(u)),i.possiblyUpdateShaders(!0),!0}).catch(function(u){i.possiblyUpdateShaders(!1);var f=Er.codeParseError(u);return o(f,q2.createFrom(f)),!1})},a.prototype.foreverScan=function(l,o,i){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 w=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,w,x,0,0,this.qrRegion.width,this.qrRegion.height);var N=function(){u.foreverScanTimeout=setTimeout(function(){u.foreverScan(l,o,i)},u.getTimeoutFps(l.fps))};this.scanContext(o,i).then(function(O){!O&&l.disableFlip!==!0?(u.context.translate(u.context.canvas.width,0),u.context.scale(-1,1),u.scanContext(o,i).finally(function(){N()})):N()}).catch(function(O){u.logger.logError("Error happend while scanning context",O),N()})}},a.prototype.createVideoConstraints=function(l){if(typeof l=="string")return{deviceId:{exact:l}};if(typeof l=="object"){var o="facingMode",i="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 w=Object.keys(l)[0];if(w!==o&&w!==i)throw"Only '".concat(o,"' and '").concat(i,"' ")+" are supported for 'cameraIdOrConfig'";if(w===o){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 N=typeof y;throw"Invalid type of 'deviceId' = ".concat(N)}}}var O=typeof l;throw"Invalid type of 'cameraIdOrConfig' = ".concat(O)},a.prototype.computeCanvasDrawConfig=function(l,o,i,u){if(l<=i&&o<=u){var f=(i-l)/2,m=(u-o)/2;return{x:f,y:m,width:l,height:o}}else{var p=l,w=o;return l>i&&(o=i/l*o,l=i),o>u&&(l=u/o*l,o=u),this.logger.log("Image downsampled from "+"".concat(p,"X").concat(w)+" to ".concat(l,"X").concat(o,".")),this.computeCanvasDrawConfig(l,o,i,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(o){o.style.backgroundColor=l?cn.BORDER_SHADER_MATCH_COLOR:cn.BORDER_SHADER_DEFAULT_COLOR}),this.qrMatch=l)},a.prototype.possiblyCloseLastScanImageFile=function(){this.lastScanImageFile&&(URL.revokeObjectURL(this.lastScanImageFile),this.lastScanImageFile=null)},a.prototype.createCanvasElement=function(l,o,i){var u=l,f=o,m=document.createElement("canvas");return m.style.width="".concat(u,"px"),m.style.height="".concat(f,"px"),m.style.display="none",m.id=zn(i)?"qr-canvas":i,m},a.prototype.getShadedRegionBounds=function(l,o,i){if(i.width>l||i.height>o)throw"'config.qrbox' dimensions should not be greater than the dimensions of the root HTML element.";return{x:(l-i.width)/2,y:(o-i.height)/2,width:i.width,height:i.height}},a.prototype.possiblyInsertShadingElement=function(l,o,i,u){if(!(o-u.width<1||i-u.height<1)){var f=document.createElement("div");f.style.position="absolute";var m=(o-u.width)/2,p=(i-u.height)/2;if(f.style.borderLeft="".concat(m,"px solid rgba(0, 0, 0, 0.48)"),f.style.borderRight="".concat(m,"px solid rgba(0, 0, 0, 0.48)"),f.style.borderTop="".concat(p,"px solid rgba(0, 0, 0, 0.48)"),f.style.borderBottom="".concat(p,"px solid rgba(0, 0, 0, 0.48)"),f.style.boxSizing="border-box",f.style.top="0px",f.style.bottom="0px",f.style.left="0px",f.style.right="0px",f.id="".concat(cn.SHADED_REGION_ELEMENT_ID),o-u.width<11||i-u.height<11)this.hasBorderShaders=!1;else{var w=5,x=40;this.insertShaderBorders(f,x,w,-w,null,0,!0),this.insertShaderBorders(f,x,w,-w,null,0,!1),this.insertShaderBorders(f,x,w,null,-w,0,!0),this.insertShaderBorders(f,x,w,null,-w,0,!1),this.insertShaderBorders(f,w,x+w,-w,null,-w,!0),this.insertShaderBorders(f,w,x+w,null,-w,-w,!0),this.insertShaderBorders(f,w,x+w,-w,null,-w,!1),this.insertShaderBorders(f,w,x+w,null,-w,-w,!1),this.hasBorderShaders=!0}l.append(f)}},a.prototype.insertShaderBorders=function(l,o,i,u,f,m,p){var w=document.createElement("div");w.style.position="absolute",w.style.backgroundColor=cn.BORDER_SHADER_DEFAULT_COLOR,w.style.width="".concat(o,"px"),w.style.height="".concat(i,"px"),u!==null&&(w.style.top="".concat(u,"px")),f!==null&&(w.style.bottom="".concat(f,"px")),p?w.style.left="".concat(m,"px"):w.style.right="".concat(m,"px"),this.borderShaders||(this.borderShaders=[]),this.borderShaders.push(w),l.appendChild(w)},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}(),Ba;(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"})(Ba||(Ba={}));const gm={width:"38",height:"38",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"none"},pm=["stroke"],xm=["stroke"],wm=["stroke"],_m=["stroke"],Cm=["stroke"],Em=r.defineComponent({__name:"QR",props:{color:{type:String,required:!1,default:"#FFFFFF"}},setup(a){return(l,o)=>(r.openBlock(),r.createElementBlock("svg",gm,[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,pm),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,xm),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,wm),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,_m),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,Cm)]))}}),No={back:["Задняя","Задней","Зад","e pasme","rear","back","atzekoa","задні","отзад","pozadi","cefn","hátulsó","traseira","achterkant","όπισθεν","bag","דערציען","cúil","aftan","trasero","posteriore","posterior","aizmugure","galinis","задниот дел","wara","hinteren","bak","tył","tyl","traseira","spate","задњи","zadný","zadaj","задній","takaosa","arrière","straga","zadní","bak","tagumine","environment","arxa","թիկունք","পিছনে","နောက်ဘက်","ở phía sau","უკანა","પાછળ","артқы","ಹಿಂದಿನ","後部","后部","뒤쪽","ខាងក្រោយ","ຫລັງ","പുറകിലുള്ള","मागील","арын","पछाडि","පසුපස","пушти","หลัง","பின்புறம்","వెనుక","arka","orqa","پیچھے","पिछला","qab","後方","مؤخرة","חלק אחורי","عقب","agter","ngemuva","azụ","leyin","kamorao","gadaale","nyuma","baya","kumbuyo","belakang","aoriana","belakang","muri","luyo","likuran","mburi","dèyè","tergo","malantaŭo"],front:["FaceTime","Передняя","përpara","front","aurrean","пярэдні","отпред","front","blaen","elülső","diante","voorkant","εμπρός","foran","פראָנט","tosaigh","framan","frente","davanti","davant","priekšā","priekyje","напред","quddiem","Vorderseite","front","przód","frente","față","фронт","vpredu","spredaj","перед","edessä","devant","ispred","přední","främre","ees","ön","ճակատ","সামনে","ရှေ့","đằng trước","წინა","આગળ","алдыңғы","ಮುಂಭಾಗ","正面","正面","앞쪽","ខាងមុខ","ດ້ານໜ້າ","മുന്നിൽ","समोर","урд","अगाडि","ඉදිරිපස","пеш","ด้านหน้า","முன்","ముందు","ön","old","سامنے","सामने","pem hauv ntej","フロント","أمام","חֲזִית","جلو","voor","ngaphambili","n'ihu","iwaju","ka pele","hore","mbele","gaba","kutsogolo","depan","anoloana","hadapan","mua","atubangan","harap","ngarep","devan","front","fronto"]},ym={key:0,class:"qr_text"},bm=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 o=a;let i=null;const u=r.ref(!1),f=r.ref(!1),m=r.ref(!1),p=r.ref(!1);let w=null;const x=Rt(),{itemThemes:C}=we.storeToRefs(x),y=l,N=U=>U.replace(/^[\s\S]*?((?:tel|sms|smsto|mailto|callto|facetime|viber|whatsapp):)?[\s\S]*?(%2B)?[\s\S]*?/i,(M,R,F)=>F?"+":""),O=async(U,M)=>{var Z,V,P;if(console.log(U,M),p.value)return;o.isQr||(p.value=!0),D();const R=/[?&]table_id=([a-zA-Z0-9-]+)/,F=U.match(R),G=U.match(/\/([a-f0-9\-]{36})\?/);if(o.isQr){if(F&&G)return(Z=o.takeDataTable)==null?void 0:Z.call(o,G[1],F[1],"qr");{const L=localStorage.getItem("orgID");if(L){const re=await o.axiosInstanceGet.get(`org_unit/${L}/table`,{params:{external_link:U}}).then(Q=>{var ee,X;return((ee=Q.data)==null?void 0:ee.length)>0?(X=Q.data[0])==null?void 0:X.id:null}).catch(()=>null);if(re)return(V=o.takeDataTable)==null?void 0:V.call(o,L,re)}}y("update:is_notification",!0),y("update:notificationData",{textNotification:"Стол не найден"}),y("update:is_toggleAffiliation",!0)}else{const L=new yn,re=U||M.text,Q=N(re);try{await L.authorizeByCard(Q);const ee=await L.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:((P=ee.response)==null?void 0:P.user_friendly_message)||"Карта не найдена"})}finally{m.value=!0,w&&clearTimeout(w),w=setTimeout(()=>{m.value=!1},2e3),p.value=!1}}};window.debugScan=O;const T=()=>{},v=async()=>{if(!(u.value||i!=null&&i.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}i=new Ra("reader");const U=await Ra.getCameras();if(!U||U.length===0){console.error("Камеры не найдены"),u.value=!1;return}let M;if(o.isQr)M=U.find(G=>No.back.some(Z=>new RegExp(Z,"i").test(G.label))),M||(M=U.find(G=>No.front.some(Z=>new RegExp(Z,"i").test(G.label))));else if(M=U.find(G=>No.front.some(Z=>new RegExp(Z,"i").test(G.label))),M||(M=U.find(G=>new RegExp("amera","i").test(G.label))),!M){y("update:is_notification",!0),y("update:notificationData",{textNotification:"Не найдена фронтальная камера. Для сканирования карт нужна фронтальная камера."}),u.value=!1,y("update:is_toggleAffiliation",!0);return}const R=o.isQr?[_e.QR_CODE]:[_e.QR_CODE,_e.PDF_417,_e.EAN_13,_e.EAN_8,_e.CODE_128],F={fps:60,qrbox:{width:320,height:500}};await i.start(M.id,F,O,T,void 0,R),f.value=!0}catch(U){y("update:is_notification",!0),y("update:notificationData",{textNotification:"Разрешите доступ к камере для сканирования"}),console.error("Ошибка доступа к камере:",U),u.value=!1,f.value=!1,y("update:is_toggleAffiliation",!0)}},D=async()=>{if(i&&i.isScanning)try{await i.stop(),u.value=!1,i=null}catch(U){console.error("Ошибка остановки камеры:",U)}else u.value=!1,i=null,y("update:is_toggleAffiliation",!0);f.value=!1};return r.onUnmounted(()=>{u.value&&D(),w&&(clearTimeout(w),w=null),p.value=!1,m.value=!1,f.value=!1}),(U,M)=>(r.openBlock(),r.createElementBlock("div",null,[(r.openBlock(),r.createBlock(r.Teleport,{to:"body"},[r.withDirectives(r.createElementVNode("div",{class:"blackWindow",onClick:D},[M[0]||(M[0]=r.createElementVNode("div",{id:"reader"},null,-1)),f.value&&!a.isQr?(r.openBlock(),r.createElementBlock("p",ym,"Наведите QR на камеру")):r.createCommentVNode("",!0)],512),[[r.vShow,u.value]])])),r.createVNode(Em,{color:a.isQr?void 0:"#FFFFFF",onClick:v},null,8,["color"])]))}}),Ni=Symbol("clickOutside"),Am={mounted(a,l){a[Ni]=o=>{a.contains(o.target)||l.value(o)},document.addEventListener("click",a[Ni])},unmounted(a){a[Ni]&&document.removeEventListener("click",a[Ni])}};let ir=[],To;const Oa=["#FFD700","#FF6B8A","#7ECFC0","#C4B5FD","#FFA726","#EF5350","#AB47BC","#66BB6A","#42A5F5","#FFCA28"];class Ma{constructor(l){Re(this,"x");Re(this,"y");Re(this,"vx");Re(this,"vy");Re(this,"color");Re(this,"size");Re(this,"rotation");Re(this,"rotationSpeed");Re(this,"gravity");Re(this,"friction");Re(this,"opacity");Re(this,"fadeSpeed");Re(this,"shape");Re(this,"width");Re(this,"height");Re(this,"ctx");this.x=window.innerWidth/2,this.y=window.innerHeight/2;const o=Math.random()*Math.PI*2,i=4+Math.random()*8;this.vx=Math.cos(o)*i,this.vy=Math.sin(o)*i-4,this.color=Oa[Math.floor(Math.random()*Oa.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 Sm={mounted(a){const l=a.getContext("2d"),o=()=>{l.clearRect(0,0,window.innerWidth,window.innerHeight);for(let i of ir)i.update(),i.draw();ir=ir.filter(i=>i.opacity>0),ir.length>0&&(To=requestAnimationFrame(o))};a._resize=()=>{const i=window.devicePixelRatio||1;a.width=window.innerWidth*i,a.height=window.innerHeight*i,l.scale(i,i)},a._resize(),window.addEventListener("resize",a._resize),setTimeout(()=>{for(let i=0;i<90;i++)ir.push(new Ma(l));o()},400),setTimeout(()=>{for(let i=0;i<40;i++)ir.push(new Ma(l))},900)},unmounted(a){window.removeEventListener("resize",a._resize),To&&cancelAnimationFrame(To),ir=[]}},Im={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 o=4,i=null,u="#E52222",f="#fed1b0",m="#1a1aff",p="#222",w="#E8B84B",x=[[i,i,i,u,u,u,u,u,i,i,i,i,i,i,i,i],[i,i,u,u,u,u,u,u,u,u,u,i,i,i,i,i],[i,i,p,p,p,f,f,p,f,i,i,i,i,i,i,i],[i,p,f,p,f,f,f,p,f,f,f,i,i,i,i,i],[i,p,f,p,p,f,f,f,p,f,f,f,i,i,i,i],[i,p,p,f,f,f,f,p,p,p,p,i,i,i,i,i],[i,i,i,f,f,f,f,f,f,f,i,i,i,i,i,i],[i,i,m,m,u,m,m,m,i,i,i,i,i,i,i,i],[i,m,m,m,u,m,m,m,m,m,i,i,i,i,i,i],[m,m,m,m,u,u,m,m,m,m,m,i,i,i,i,i],[f,f,m,u,w,u,u,w,m,f,f,i,i,i,i,i],[f,f,f,u,u,u,u,u,f,f,f,i,i,i,i,i],[f,f,u,u,u,u,u,u,u,f,f,i,i,i,i,i],[i,i,u,u,u,i,i,u,u,u,i,i,i,i,i,i],[i,p,p,p,i,i,i,p,p,p,i,i,i,i,i,i],[p,p,p,p,i,i,p,p,p,p,i,i,i,i,i,i]],C=[[i,i,i,u,u,u,u,u,i,i,i,i,i,i,i,i],[i,i,u,u,u,u,u,u,u,u,u,i,i,i,i,i],[i,i,p,p,p,f,f,p,f,i,i,i,i,i,i,i],[i,p,f,p,f,f,f,p,f,f,f,i,i,i,i,i],[i,p,f,p,p,f,f,f,p,f,f,f,i,i,i,i],[i,p,p,f,f,f,f,p,p,p,p,i,i,i,i,i],[i,i,i,f,f,f,f,f,f,f,i,i,i,i,i,i],[i,i,m,m,u,m,m,m,i,i,i,i,i,i,i,i],[i,m,m,m,u,m,m,m,m,m,i,i,i,i,i,i],[m,m,m,m,u,u,m,m,m,m,m,i,i,i,i,i],[f,f,m,u,w,u,u,w,m,f,f,i,i,i,i,i],[f,f,f,u,u,u,u,u,f,f,f,i,i,i,i,i],[f,f,u,u,u,u,u,u,u,f,f,i,i,i,i,i],[i,u,u,u,i,i,i,i,u,u,u,i,i,i,i,i],[p,p,p,i,i,i,i,i,p,p,p,i,i,i,i,i],[p,p,i,i,i,i,i,i,i,p,p,i,i,i,i,i]],y=[[i,i,i,u,u,u,u,u,i,i,i,i,i,i,i,i],[i,i,u,u,u,u,u,u,u,u,u,i,i,i,i,i],[i,i,p,p,p,f,f,p,f,i,i,i,i,i,i,i],[i,p,f,p,f,f,f,p,f,f,f,i,i,i,i,i],[i,p,f,p,p,f,f,f,p,f,f,f,i,i,i,i],[i,p,p,f,f,f,f,p,p,p,p,i,i,i,i,i],[i,i,i,f,f,f,f,f,f,f,i,i,i,i,i,i],[i,i,m,m,u,m,m,m,i,i,i,i,i,i,i,i],[i,m,m,m,u,m,m,m,m,m,i,i,i,i,i,i],[m,m,m,m,u,u,m,m,m,m,m,i,i,i,i,i],[f,f,m,u,w,u,u,w,m,f,f,i,i,i,i,i],[f,f,f,u,u,u,u,u,f,f,f,i,i,i,i,i],[f,f,u,u,u,u,u,u,u,f,f,i,i,i,i,i],[i,i,i,i,u,u,u,u,i,i,i,i,i,i,i,i],[i,i,i,i,p,p,p,p,p,i,i,i,i,i,i,i],[i,i,i,i,i,p,p,p,p,p,i,i,i,i,i,i]],N=[[i,i,i,i,u,u,u,u,u,i,i,i,i,i,i,i],[i,i,i,u,u,u,u,u,u,u,u,u,i,i,i,i],[i,i,i,p,p,p,f,f,p,f,i,i,i,i,i,i],[i,i,p,f,p,f,f,f,p,f,f,f,i,i,i,i],[i,i,p,f,p,p,f,f,f,p,f,f,i,i,i,i],[i,i,p,p,f,f,f,f,p,p,p,p,i,i,i,i],[i,i,i,i,f,f,f,f,f,f,f,i,i,i,i,i],[i,m,i,i,m,m,u,m,m,m,i,i,m,i,i,i],[m,m,m,m,m,u,m,m,m,m,m,m,m,i,i,i],[m,m,m,m,u,u,m,m,m,m,m,i,i,i,i,i],[f,f,m,u,w,u,u,w,m,f,f,i,i,i,i,i],[f,f,f,u,u,u,u,u,f,f,f,i,i,i,i,i],[f,f,u,u,u,u,u,u,u,f,f,i,i,i,i,i],[i,i,u,u,u,i,i,u,u,u,i,i,i,i,i,i],[i,p,p,p,i,i,i,p,p,p,i,i,i,i,i,i],[p,p,p,p,i,i,p,p,p,p,i,i,i,i,i,i]],O=[[i,w,w,w,w,w,i,i],[w,w,p,w,w,w,w,i],[w,p,w,w,w,w,w,i],[w,p,w,w,w,w,w,i],[w,p,w,w,w,w,w,i],[w,w,p,w,w,w,w,i],[i,w,w,w,w,w,i,i],[i,i,i,i,i,i,i,i]];function T(H,I,$,j,q,K){const oe=I.length,de=I[0].length;for(let ce=0;ce<oe;ce++)for(let Ce=0;Ce<de;Ce++){const ge=I[ce][Ce];if(!ge)continue;const De=K?$+(de-1-Ce)*q:$+Ce*q,xe=j+ce*q;H.fillStyle=ge,H.fillRect(De,xe,q,q)}}let v,D,U,M,R,F,G,Z,V,P,L,re=!1;function Q(){Z=a.height*.46,D=-20*o,U=Z,M=3.2,R=0,v="enter",F=0,G=0,L=!1,V=Z-32*o,P=0,re=!0}function ee(){return a.width/2-6*o}function X(){if(!re)return;const H=a.width,I=a.height;l.clearRect(0,0,H,I),L&&(V+=P,P+=.4,T(l,O,a.width/2-3*o,V,o,!1),V>I+16*o&&(L=!1)),(v==="enter"||v==="exit")&&(G++,G>=6&&(G=0,F=(F+1)%3));const $=[x,C,y];if(v==="enter")D+=M,T(l,$[F],D,U,o,!1),D+5*o>=ee()&&(v="bump_up",M=0,R=-7);else if(v==="bump_up")R+=.7,U+=R,T(l,N,D,U,o,!1),R>=0&&(v="bump_down",L=!0,P=-10,V=U-10*o);else if(v==="bump_down")R+=.7,U+=R,T(l,N,D,U,o,!1),U>=Z&&(U=Z,R=0,M=-3.2,v="exit");else if(v==="exit"&&(D+=M,T(l,$[F],D,U,o,!0),D<-20*o)){re=!1,setTimeout(()=>{Q(),X()},2500);return}requestAnimationFrame(X)}setTimeout(()=>{Q(),X()},1200)},unmounted(a){window.removeEventListener("resize",a._resize)}};class Nm{constructor(l){Re(this,"value");Re(this,"next");this.value=l}}class Tm{constructor(){Ui(this,en);Ui(this,Gn);Ui(this,sr);this.clear()}enqueue(l){const o=new Nm(l);wn(this,en)?(wn(this,Gn).next=o,Pn(this,Gn,o)):(Pn(this,en,o),Pn(this,Gn,o)),Zo(this,sr)._++}dequeue(){const l=wn(this,en);if(l)return Pn(this,en,wn(this,en).next),Zo(this,sr)._--,wn(this,en)||Pn(this,Gn,void 0),l.value}peek(){if(wn(this,en))return wn(this,en).value}clear(){Pn(this,en,void 0),Pn(this,Gn,void 0),Pn(this,sr,0)}get size(){return wn(this,sr)}*[Symbol.iterator](){let l=wn(this,en);for(;l;)yield l.value,l=l.next}*drain(){for(;wn(this,en);)yield this.dequeue()}}en=new WeakMap,Gn=new WeakMap,sr=new WeakMap;function km(a){Da(a);const l=new Tm;let o=0;const i=()=>{o<a&&l.size>0&&(o++,l.dequeue()())},u=()=>{o--,i()},f=async(w,x,C)=>{const y=(async()=>w(...C))();x(y);try{await y}catch{}u()},m=(w,x,C)=>{new Promise(y=>{l.enqueue(y)}).then(f.bind(void 0,w,x,C)),o<a&&i()},p=(w,...x)=>new Promise(C=>{m(w,C,x)});return Object.defineProperties(p,{activeCount:{get:()=>o},pendingCount:{get:()=>l.size},clearQueue:{value(){l.clear()}},concurrency:{get:()=>a,set(w){Da(w),a=w,queueMicrotask(()=>{for(;o<a&&l.size>0;)i()})}},map:{async value(w,x){const C=Array.from(w,(y,N)=>this(x,y,N));return Promise.all(C)}}}),p}function Da(a){if(!((Number.isInteger(a)||a===Number.POSITIVE_INFINITY)&&a>0))throw new TypeError("Expected `concurrency` to be a number from 1 and up")}let Jt=null;const va=km(5),Rm=async(a,l)=>{Jt&&Dm();const o=st(),i=Rt(),u=Gr(),f=Lt(),{itemThemes:m}=we.storeToRefs(i),{displayCards:p}=we.storeToRefs(o),{is_notification_lib:w,notificationData_lib:x}=we.storeToRefs(u),{stateCard:C,openProduct:y}=we.storeToRefs(f),N=yn.create();await Bm(a),Jt=Lr(`wss://${l}/ws/org-unit/${a}/`,{heartbeatTimeout:3e4}),Jt.on("open",()=>console.warn("Realtime WebSocket подключён (pointId:",a,")")),Jt.on("error",O=>console.warn("WebSocket ошибка:",O)),Jt.on("close",()=>console.warn("Realtime WebSocket закрыт")),Jt.on("message",async O=>{try{if(O.type)return;m.value.kiosk_hide_menu_update_notification||(x.value.textNotification="Мы обновили меню");const T=O.params||O,v=T.active_groups||[],D=T.updated_groups||[],U=T.updated_product_groups||[],M=await Qn(),R=new Set(v.map(Q=>Q)),F=new Map(p.value.map(Q=>[Q.id,Q])),G=[],Z=M.transaction("groups","readwrite");let P=await Z.objectStore("groups").openCursor();for(;P;){const Q=P.key;!R.has(Q)&&Q!==a&&(G.push(Q),await P.delete(),F.delete(Q)),P=await P.continue()}await Z.done,p.value=Array.from(F.values()),G.length>0&&await Om(R);const L=[...D.map(Q=>va(async()=>{const[ee,X]=await Promise.all([N.getGroupByID(Q),N.loadGroupProducts(Q)]);ee.products=X,F.set(Q,ee),await Dr(Q,ee),await La(ee,X,!0)})),...U.map(Q=>va(async()=>{const[ee,X]=await Promise.all([N.getGroupByID(Q),N.loadGroupProducts(Q)]);ee.products=X,F.set(Q,ee),await Dr(Q,ee),await La(ee,X,!0),await Mm(X,Q)}))];await Promise.all(L),p.value=Array.from(F.values()),await Nl(a,p),x.value.textNotification.length>1&&(w.value=!0);const re=C.value.openCard;if(re!=null&&re.id){const Q=new Set(re.groups??[]),ee=new Set;let X=!1;for(const I of F.values()){const $=I==null?void 0:I.products;if(!Array.isArray($))continue;const j=$.find(q=>(q==null?void 0:q.id)===re.id);if((j==null?void 0:j.adult)===!0){y.value={id:null,visible:!1},f.reset();return}j&&(I==null?void 0:I.id)!=null&&(ee.add(I.id),(D.includes(I.id)||U.includes(I.id))&&(X=!0))}if(ee.size===0){y.value={id:null,visible:!1},f.reset();return}(!(Q.size===ee.size&&[...Q].every(I=>ee.has(I)))||X)&&await N.getSingleProduct(re==null?void 0:re.id)}}catch(T){console.error("ошибка обновления indexedDB [updateIndexedDB]",T)}}),Jt.connect()},Bm=async a=>{try{const l=st(),o=await qi(a);o!=null&&o.data&&(l.displayCards=o.data)}catch(l){console.error("Ошибка загрузки кэша групп:",l)}},Pa=async a=>{const l=st(),o=Gr(),i=Lt(),{stateCard:u,openProduct:f}=we.storeToRefs(i),{cartProducts_lib:m}=we.storeToRefs(l),p=m.value,w=[],x=[],C=u.value.openCard;for(const y of p)a(y)?(w.push(y),(y.id===(C==null?void 0:C.id)||C!=null&&C.adult)&&(f.value={id:null,visible:!1})):x.push(y);if(w.length>0){const y=w.map(N=>N.name).slice(0,3).join(", ");o.notificationData_lib.textNotification=`Некоторые позиции стали недоступны и были убраны из заказа: ${y}${w.length>3?` и ещё ${w.length-3}`:""}`,m.value=x,l.updateCartInLocalStorage()}},Om=async a=>{await Pa(l=>{var o;return(o=l.groups)!=null&&o.length?!l.groups.some(i=>a.has(i)):!0})},Mm=async(a,l)=>{const o=st(),i=new Set(a.filter(u=>!u.adult||o.is18Allowed).map(u=>u.id));await Pa(u=>{var f;return(f=u.groups)!=null&&f.includes(l)?!i.has(u.id):!1})},La=async(a,l,o=!0)=>{if(a.video_link&&Ti(a.video_link,`${a.id}_video`,o),a.image_link&&Ti(a.image_link,`${a.id}_image`,o),l!=null&&l.length)for(const i of l)i.video_link&&Ti(i.video_link,`${i.id}_video`,o),i.image_link&&Ti(i.image_link,`${i.id}_image`,o)},Ti=async(a,l,o=!1)=>{try{const i=si();if(!o){const m=await fr(l);if(m){i.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),i.updateCacheFromBlob(l,f),window.dispatchEvent(new CustomEvent("image-cached",{detail:{id:l,blob:f}}))}catch(i){console.warn(`[MediaCache] Failed for ${l}:`,i)}},Dm=()=>{Jt&&(Jt.off("open"),Jt.off("message"),Jt.off("error"),Jt.off("close"),Jt.close(!0),Jt=null)},vm={key:0,class:"valentine-hearts"},Pm=r.defineComponent({__name:"FallingHearts",props:{symbols:{default:()=>["❤","♥","💕"]},max:{default:15},interval:{default:1500}},setup(a){const l=a,o=yt.useDocumentVisibility(),i=yt.useMediaQuery("(prefers-reduced-motion: reduce)"),u=r.ref([]);let f=null;const m=(C,y)=>Math.random()*(y-C)+C,p=()=>{if(i.value||u.value.length>=l.max)return;const C=l.symbols[Math.floor(Math.random()*l.symbols.length)],y=m(18,26),N=m(5,95),O=m(10,18),T=m(0,.3),v=m(.6,.9),D=Math.floor(m(1,6)),M={id:crypto.randomUUID(),icon:C,style:{left:`${N}%`,fontSize:`${y}px`,color:`rgba(255, 105, 180, ${v})`,animationName:`heartFall${D}`,animationDuration:`${O}s`,animationDelay:`${T}s`}};u.value.push(M);const F=setTimeout(()=>{u.value=u.value.filter(G=>G.id!==M.id),clearTimeout(F)},(T+O+1)*1e3)},w=()=>{if(!i.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(()=>{i.value||w()}),r.onUnmounted(()=>{x()}),r.watch(o,(C,y)=>{C==="visible"&&y==="hidden"&&w(),C==="hidden"&&y==="visible"&&x()}),(C,y)=>r.unref(i)?r.createCommentVNode("",!0):(r.openBlock(),r.createElementBlock("div",vm,[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(u.value,N=>(r.openBlock(),r.createElementBlock("span",{key:N.id,class:"heart",style:r.normalizeStyle(N.style)},r.toDisplayString(N.icon),5))),128))]))}}),Lm=["src"],Fm=r.defineComponent({__name:"BasketImage",props:{id:{},fallback:{}},setup(a){const l=a,{mediaUrl:o}=Tn(()=>l.id,()=>l.fallback);return(i,u)=>(r.openBlock(),r.createElementBlock("img",{src:r.unref(o)||""},null,8,Lm))}}),Vm={class:"button_price_bg"},Um={class:"wrapper_container_price_bg"},zm={class:"button_price"},Hm={key:0,class:"image_product_container"},Gm=r.defineComponent({__name:"BasketButton",emits:["goToCart"],setup(a,{emit:l}){const o=l,i=Te.useRouter(),u=st(),f=Fn(),{totalPrice_lib:m,cartProducts_lib:p}=we.storeToRefs(u),w=r.computed(()=>{var y;return m.value+(((y=f.order)==null?void 0:y.remaining_amount)||0)}),x=r.computed(()=>{var y;return(y=p.value)!=null&&y.length,p.value.slice(0,3).map(N=>({id:`${N.id}_image`,fallback:N.image_link}))}),C=()=>{var y;if(f.isTableService&&f.hasOrder&&!((y=p.value)!=null&&y.length))return i.push({name:"order-ts"});o("goToCart")};return(y,N)=>(r.openBlock(),r.createElementBlock("div",Vm,[r.createElementVNode("div",Um,[r.createElementVNode("div",zm,[r.unref(m)>0&&x.value.length>0?(r.openBlock(),r.createElementBlock("div",Hm,[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(x.value,O=>(r.openBlock(),r.createElementBlock("div",{key:O.id,class:"filter_image_product"},[r.createVNode(Fm,{id:O.id,fallback:O.fallback,class:"img_product"},null,8,["id","fallback"])]))),128))])):r.createCommentVNode("",!0),r.createVNode(r.unref(Ot.motion).div,{class:"button_default_main",whilePress:{scale:.92},onClick:C},{default:r.withCtx(()=>[N[1]||(N[1]=r.createElementVNode("div",{class:"icont_cart"},null,-1)),r.createElementVNode("p",null,[r.createVNode(ft,{price:w.value,fixedFloat:2},null,8,["price"]),N[0]||(N[0]=r.createTextVNode(" ₽",-1))])]),_:1})])])]))}}),$r=null,{min:or,max:bn,abs:Fa,floor:Wm}=Math,Va=(a,l,o)=>or(o,bn(l,a)),Ua=a=>[...a].sort((l,o)=>l-o),Xm=typeof queueMicrotask=="function"?queueMicrotask:a=>{Promise.resolve().then(a)},ko=()=>{let a;return[new Promise(l=>{a=l}),a]},za=a=>{let l;return()=>(a&&(l=a(),a=void 0),l)},jr=(a,l,o)=>{const i=o?"unshift":"push";for(let u=0;u<l;u++)a[i](-1);return a},Ha=(a,l)=>{const o=a.t[l];return o===-1?a.o:o},$m=(a,l,o)=>{const i=a.t[l]===-1;return a.t[l]=o,a.i=or(l,a.i),i},ki=(a,l)=>{if(!a.l)return 0;if(a.i>=l)return a.u[l];a.i<0&&(a.u[0]=0,a.i=0);let o=a.i,i=a.u[o];for(;o<l;)i+=Ha(a,o),a.u[++o]=i;return a.i=l,i},yr=(a,l,o=0,i=a.l-1)=>{let u=o;for(;o<=i;){const f=Wm((o+i)/2);ki(a,f)<=l?(u=f,o=f+1):i=f-1}return Va(u,0,a.l-1)},Ga=(a,l,o)=>{const i=l-a.l;return a.i=o?-1:or(l-1,a.i),a.l=l,i>0?(jr(a.u,i),jr(a.t,i,o),a.o*i):(a.u.splice(i),(o?a.t.splice(0,-i):a.t.splice(i)).reduce((u,f)=>u-(f===-1?a.o:f),0))},jm=a=>a.documentElement,qm=a=>a.ownerDocument,Zm=a=>a.defaultView,Wa=za(()=>!!/iP(hone|od|ad)/.test(navigator.userAgent)||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>0),Ym=za(()=>"scrollBehavior"in jm(document).style),Km=(a,l=40,o=0,i,u=!1)=>{let f=!!o,m=1,p=0,w=0,x=0,C=0,y=0,N=0,O=0,T=0,v=$r,D=[0,f?bn(o-1,0):-1],U=0,M=!1;const R=((X,H,I)=>({o:H,t:I?jr(I.slice(0,or(X,I.length)),bn(0,X-I.length)):jr([],X),l:X,i:-1,u:jr([],X+1)}))(a,i?i[1]:l,i&&i[0]),F=new Set,G=()=>x-w,Z=()=>G()+y+C,V=(X,H)=>((I,$,j,q)=>{if(q=or(q,I.l-1),ki(I,q)<=$){const K=yr(I,j,q);return[yr(I,$,q,K),K]}{const K=yr(I,$,void 0,q);return[K,yr(I,j,K)]}})(R,X,H,D[0]),P=()=>ki(R,R.l),L=(X,H)=>{const I=ki(R,X)-y;return H?P()-I-re(X):I},re=X=>Ha(R,X),Q=(X,H=-1)=>R.t[X]===H,ee=X=>{X&&(Wa()&&O!==0||v&&T===1?y+=X:C+=X)};return{p:()=>{F.clear()},h:()=>m,m:()=>(X=>[X.t.slice(),X.o])(R),v:(X=200)=>{if(!M||f)return D;let H,I;if(N)[H,I]=D;else{let $=bn(0,Z()),j=$+p;u||(X=bn(0,X),O!==1&&($-=X),O!==2&&(j+=X)),[H,I]=D=V(bn(0,$),bn(0,j)),v&&(H=or(H,v[0]),I=bn(I,v[1]))}return[bn(H,0),or(I,R.l-1)]},S:X=>yr(R,X-w),I:Q,O:L,k:re,j:()=>R.l,N:()=>x,B:()=>O!==0,T:()=>p,q:()=>w,M:P,P:()=>(N=C,C=0,[N,T===2]),R:(X,H)=>{const I=[X,H];return F.add(I),()=>{F.delete(I)}},A:(X,H)=>{let I,$,j=0;switch(X){case 1:{if(H===x&&T===0)break;const q=N;N=0;const K=H-x,oe=Fa(K);q&&oe<Fa(q)+1||T!==0||(O=K<0?2:1),f&&(f=!1),x=H,j=4;const de=G();de>=-p&&de<=P()&&(j+=1,$=oe>p);break}case 2:j=8,O!==0&&(I=!0,j+=1),O=0,T=0,v=$r;break;case 3:{const q=H.filter(([K,oe])=>!Q(K,oe));if(!q.length)break;ee(q.reduce((K,[oe,de])=>((T===2||(v&&T===1?oe<v[0]:L(oe+(O===0&&T===0?1:0))<G()))&&(K+=de-re(oe)),K),0));for(const[K,oe]of q){const de=re(K),ce=$m(R,K,oe);u&&(U+=ce?oe:oe-de)}u&&p&&U>p&&(ee(((K,oe)=>{let de=0;const ce=[];K.t.forEach((be,et)=>{be!==-1&&(ce.push(be),et<oe&&de++)}),K.i=-1;const Ce=Ua(ce),ge=Ce.length,De=ge/2|0,xe=ge%2==0?(Ce[De-1]+Ce[De])/2:Ce[De],_t=K.o;return((K.o=xe)-_t)*bn(oe-de,0)})(R,yr(R,Z()))),u=!1),j=3,$=!0;break}case 4:p!==H&&(p||(M=$=!0),p=H,j=3);break;case 5:H[1]?(ee(Ga(R,H[0],!0)),T=2,j=1):(Ga(R,H[0]),j=1);break;case 6:w=H;break;case 7:T=1;break;case 8:v=V(H,H+p),j=1}j&&(m=1+(2147483647&m),I&&y&&(C+=y,y=0),F.forEach(([q,K])=>{j&q&&K($)}))}}},Ro=setTimeout,Bo=(a,l)=>l?-a:a,Qm=(a,l,o,i,u,f)=>{const m=Date.now;let p=0,w=!1,x=!1,C=!1,y=!1;const N=(()=>{let U;const M=()=>{U!=$r&&clearTimeout(U)},R=()=>{M(),U=Ro(()=>{U=$r,(()=>{if(w||x)return w=!1,void N();C=!1,a.A(2)})()},150)};return R.C=M,R})(),O=()=>{p=m(),C&&(y=!0),a.A(1,i()),N()},T=U=>{if(w||!a.B()||U.ctrlKey)return;const M=m()-p;150>M&&50<M&&(o?U.deltaX:U.deltaY)&&(w=!0)},v=()=>{x=!0,C=y=!1},D=()=>{x=!1,Wa()&&(C=!0)};return l.addEventListener("scroll",O),l.addEventListener("wheel",T,{passive:!0}),l.addEventListener("touchstart",v,{passive:!0}),l.addEventListener("touchend",D,{passive:!0}),{H:()=>{l.removeEventListener("scroll",O),l.removeEventListener("wheel",T),l.removeEventListener("touchstart",v),l.removeEventListener("touchend",D),N.C()},V:()=>{const[U,M]=a.P();U&&(u(U,M,y),y=!1,M&&a.T()>a.M()&&a.A(1,i()))}}},Jm=(a,l,o)=>{let i;return[async(u,f)=>{if(!await l())return;i&&i();const m=()=>{const[p,w]=ko();return i=()=>{w(!1)},a.T()&&Ro(i,150),[p,a.R(2,()=>{w(!0)})]};if(f&&Ym())a.A(8,u()),Xm(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[w,x]=m();try{if(!await w)return}finally{x()}}a.A(7),o(u(),f)});else for(;;){const[p,w]=m();try{if(a.A(7),o(u()),!await p)return}finally{w()}}},()=>{i&&i()}]},eg=a=>{let l;return{F(o){(l||(l=new(Zm(qm(o))).ResizeObserver(a))).observe(o)},J(o){l.unobserve(o)},H(){l&&l.disconnect()}}},tg=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(),o=r.computed(()=>a.L.value&&a.W.O(a.D,a.K)),i=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:w}=a,x=i.value,{style:C,...y}=(u=a.ee)!==null&&u!==void 0?u:{},N={contain:"layout style",position:x&&p?void 0:"absolute",[m?"height":"width"]:"100%",[m?"top":"left"]:"0px",[m?"left":"top"]:o.value+"px",visibility:!x||p?void 0:"hidden",...C};return m&&(N.display="inline-flex"),r.createVNode(w,r.mergeProps({ref:l,style:N},y),typeof(O=f)=="function"||Object.prototype.toString.call(O)==="[object Object]"&&!r.isVNode(O)?f:{default:()=>[f],_:2},16,["style"]);var O}}}),ng=(a,l)=>{const o=a.key;return o??"_"+l},rg=(a,l)=>a[0]===l[0]&&a[1]===l[1],Xa=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:o,slots:i}){let u=!!a.ssrCount;const f=a.horizontal,m=r.ref(),p=Km(a.data.length,a.itemSize,a.ssrCount,a.cache,!a.itemSize),w=((T,v)=>{let D;const U=v?"width":"height",M=new WeakMap,R=eg(F=>{const G=[];for(const{target:Z,contentRect:V}of F)if(Z.offsetParent)if(Z===D)T.A(4,V[U]);else{const P=M.get(Z);P!=$r&&G.push([P,V[U]])}G.length&&T.A(3,G)});return{te(F){R.F(D=F)},re:(F,G)=>(M.set(F,G),R.F(F),()=>{M.delete(F),R.J(F)}),p:R.H}})(p,f),x=((T,v)=>{let D,U,M=ko(),R=!1;const F=v?"scrollLeft":"scrollTop",G=v?"overflowX":"overflowY",[Z,V]=Jm(T,()=>M[0],(P,L)=>{P=Bo(P,R),L?D.scrollTo({[v?"left":"top"]:P,behavior:"smooth"}):D[F]=P});return{oe(P){D=P,v&&(R=getComputedStyle(P).direction==="rtl"),U=Qm(T,P,v,()=>Bo(P[F],R),(L,re,Q)=>{if(Q){const ee=P.style,X=ee[G];ee[G]="hidden",Ro(()=>{ee[G]=X})}P[F]=Bo(T.N()+L,R),re&&V()}),M[1](!0)},p(){U&&U.H(),M[1](!1),M=ko()},ne:()=>R,se(P){Z(()=>P)},ie(P){P+=T.N(),Z(()=>P)},le(P,{align:L,smooth:re,offset:Q=0}={}){if(P=Va(P,0,T.j()-1),L==="nearest"){const ee=T.O(P),X=T.N();if(ee<X)L="start";else{if(!(ee+T.k(P)>X+T.T()))return;L="end"}}Z(()=>Q+T.q()+T.O(P)+(L==="end"?T.k(P)-T.T():L==="center"?(T.k(P)-T.T())/2:0),re)},ce:()=>{U&&U.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&&rg(T,v)?T:v}),N=r.computed(()=>C.value&&p.B()),O=r.computed(()=>C.value&&p.M());return r.onMounted(()=>{u=!1;const T=requestAnimationFrame(()=>{const v=D=>{w.te(D),x.oe(D)};a.scrollRef?v(a.scrollRef):v(m.value.parentElement)});r.onUnmounted(()=>{cancelAnimationFrame(T)})}),r.onUnmounted(()=>{p.p(),w.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"}),o({get cache(){return p.m()},get scrollOffset(){return p.N()},get scrollSize(){return(T=>bn(T.M(),T.T()))(p)},get viewportSize(){return p.T()},findItemIndex:p.S,getItemOffset:p.O,getItemSize:p.k,scrollToIndex:x.le,scrollTo:x.se,scrollBy:x.ie}),()=>{const T=a.as,v=a.item,D=O.value,U=x.ne(),M=!f&&U?"unshift":"push",R=[],F=Z=>{var V;const P=i.default({item:a.data[Z],index:Z})[0];return r.createVNode(tg,{key:ng(P,Z),L:C,W:p,Y:w.re,D:Z,X:P,U:f,K:U,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,P]=y.value;V<=P;V++)Z.add(V);Ua([...Z]).forEach(V=>{R[M](F(V))})}else for(let[Z,V]=y.value;Z<=V;Z++)R[M](F(Z));return r.createVNode(T,{ref:m,style:{contain:"size style",overflowAnchor:"none",flex:"none",position:"relative",width:f?D+"px":"100%",height:f?"100%":D+"px",pointerEvents:N.value?"none":void 0}},typeof(G=R)=="function"||Object.prototype.toString.call(G)==="[object Object]"&&!r.isVNode(G)?R:{default:()=>[R],_:2},8,["style"]);var G}}}),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:o,slots:i}){const u=a.horizontal,f=w=>{l("scroll",w)},m=()=>{l("scrollEnd")},p=r.ref();return o({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:(...w)=>p.value.findItemIndex(...w),getItemOffset:(...w)=>p.value.getItemOffset(...w),getItemSize:(...w)=>p.value.getItemSize(...w),scrollToIndex:(...w)=>p.value.scrollToIndex(...w),scrollTo:(...w)=>p.value.scrollTo(...w),scrollBy:(...w)=>p.value.scrollBy(...w)}),()=>{return r.createVNode("div",{style:{display:u?"inline-block":"block",[u?"overflowX":"overflowY"]:"auto",contain:"strict",width:"100%",height:"100%"}},[r.createVNode(Xa,{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},(w=i,typeof w=="function"||Object.prototype.toString.call(w)==="[object Object]"&&!r.isVNode(w)?i:{default:()=>[i],_:2}),8,["data","bufferSize","itemSize","itemProps","shift","ssrCount","horizontal","keepMounted","cache","onScroll","onScrollEnd"])],4);var w}}}),og=(a,l=10)=>new Promise(o=>{let i=0,u=0,f=0;const m=()=>{if(!a||a.scrollSize===void 0){o();return}const p=a.scrollSize;p===f&&p>0?i++:(i=0)&&(f=p),u++,i>=2||u>=l?o():requestAnimationFrame(m)};requestAnimationFrame(m)});function sg(a,l){const o=(l==null?void 0:l.align)??"start";let i=!1;const u=r.ref(null),f=r.ref(!1),m=r.ref("measure"),p=r.computed(()=>r.toValue(a).length),w=r.computed(()=>m.value==="measure"||m.value==="virtual"?1:5),x=r.computed(()=>Array.from({length:p.value*w.value},(D,U)=>U)),C=async()=>{if(u.value&&(m.value="measure",i=!1,f.value=!1,await r.nextTick(),!(!u.value||m.value!=="measure")&&(await og(u.value),!!u.value))){if(f.value=u.value.scrollSize>u.value.viewportSize,!f.value){i=!1;return}i=!0,m.value=(l==null?void 0:l.mode)||"loop",await r.nextTick(),u.value&&u.value.scrollToIndex(p.value*3,{align:o})}},y=D=>m.value==="measure"?D:p.value===0?0:D%p.value,N=(D,U)=>{u.value&&u.value.scrollToIndex(D,U)},O=(D,U)=>!i||m.value!=="loop"?U:U+Math.round((D-U)/p.value)*p.value,T=D=>{if(!i||m.value!=="loop"||!u.value)return;const U=p.value-1,M=p.value*4;if(D<U)return N(p.value*3-1,{align:"start"});if(D>=M)return N(p.value*3,{align:"start"})},v=()=>{if(!u.value||!i)return;const D=u.value.findItemIndex(u.value.scrollOffset);T(D)};return r.onMounted(C),r.onUnmounted(()=>u.value=null),r.watch(p,()=>r.nextTick(C)),{listRef:u,items:x,hasScroll:f,realIndex:y,findNearestIndex:O,scrollToIndex:N,init:C,onScroll:v}}const ag=Object.prototype.toString,lg=a=>ag.call(a)==="[object Error]",cg=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"]),dg=a=>{if(!(a&&lg(a)&&a.name==="TypeError"&&typeof a.message=="string"))return!1;const{message:o,stack:i}=a;return o==="Load failed"?i===void 0||"__sentry_captured__"in a:o.startsWith("error sending request for url")||o==="Failed to fetch"||o.startsWith("Failed to fetch (")&&o.endsWith(")")?!0:cg.has(o)},ug={pinch:!0,doubleTap:!0,wheel:!0,buttons:["+","-","=","0"]},fg=a=>{var o;const l=Object.assign({},ug,a);if(l.pinch&&(document.addEventListener("touchstart",i=>i.touches.length>1&&i.preventDefault(),{passive:!1}),document.addEventListener("gesturestart",i=>i.preventDefault(),{passive:!1})),l.doubleTap){let i=0;document.addEventListener("touchend",u=>{const f=Date.now();f-i<=250&&u.preventDefault(),i=f},{passive:!1})}l.wheel&&document.addEventListener("wheel",i=>(i.ctrlKey||i.metaKey)&&i.preventDefault(),{passive:!1}),(o=l.buttons)!=null&&o.length&&document.addEventListener("keydown",i=>(i.ctrlKey||i.metaKey)&&l.buttons.includes(i.key)&&i.preventDefault())};Object.defineProperty(he,"useRoute",{enumerable:!0,get:()=>Te.useRoute}),Object.defineProperty(he,"useRouter",{enumerable:!0,get:()=>Te.useRouter}),he.BasketButton=Gm,he.BottomSheet=xo,he.ButtonDefault=an,he.CardMain=xa,he.CardProductPage=E0,he.CardReader=fa,he.CartBox=ua,he.CartPage=kh,he.DrumItem=M2,he.FallingHearts=Pm,he.GroupMain=N2,he.InitConnection=yn,he.ModalWindows=X2,he.NotificationWindow=Ei,he.OrderBox=bo,he.PopupWindowDefault=da,he.PricePrerender=hr,he.QrCameraScanner=bm,he.Recommendation=z2,he.RetryPage=Uh,he.TableOrderPage=f2,he.TagsMain=k2,he.VList=ig,he.Virtualizer=Xa,he.clearAllProductDB=kl,he.clearLocalStorage=mr,he.getCachedGroup=qi,he.getCachedProduct=rs,he.getWebSocketInstance=Lr,he.initPinia=dl,he.initRouter=fl,he.isNetworkError=dg,he.parseTheme=ia,he.preventZoom=fg,he.updateIndexedDB=Rm,he.useCachedMedia=Tn,he.useCardLibStore=Lt,he.useCartLibStore=Mt,he.useImageCacheStore=si,he.useMainLibStore=st,he.useModal=yo,he.useModalStore=bi,he.useModulesLibStore=Gr,he.usePdf=Un,he.useTableStore=Fn,he.useThemeStore=Rt,he.useVirtuaLoop=sg,he.vClickOutside=Am,he.vConfetti=Sm,he.vDragScroll=Wr,he.vMario=Im,he.vMuted=Xr,Object.defineProperty(he,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 dt extends x{}dt.kind="WriterException";class Be{constructor(){}static clearMatrix(e){e.clear(255)}static buildMatrix(e,t,n,o,c){Be.clearMatrix(c),Be.embedBasicPatterns(n,c),Be.embedTypeInfo(t,o,c),Be.maybeEmbedVersionInfo(n,c),Be.embedDataBits(e,o,c)}static embedBasicPatterns(e,t){Be.embedPositionDetectionPatternsAndSeparators(t),Be.embedDarkDotAtLeftBottomCorner(t),Be.maybeEmbedPositionAdjustmentPatterns(e,t),Be.embedTimingPatterns(t)}static embedTypeInfo(e,t,n){const o=new q;Be.makeTypeInfoBits(e,t,o);for(let c=0,d=o.getSize();c<d;++c){const h=o.get(o.getSize()-1-c),g=Be.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 q;Be.makeVersionInfoBits(e,n);let o=6*3-1;for(let c=0;c<6;++c)for(let d=0;d<3;++d){const h=n.get(o);o--,t.setBoolean(c,t.getHeight()-11+d,h),t.setBoolean(t.getHeight()-11+d,c,h)}}static embedDataBits(e,t,n){let o=0,c=-1,d=n.getWidth()-1,h=n.getHeight()-1;for(;d>0;){for(d===6&&(d-=1);h>=0&&h<n.getHeight();){for(let g=0;g<2;++g){const w=d-g;if(!Be.isEmpty(n.get(w,h)))continue;let E;o<e.getSize()?(E=e.get(o),++o):E=!1,t!==255&&Rt.getDataMaskBit(t,w,h)&&(E=!E),n.setBoolean(w,h,E)}h+=c}c=-c,h+=c,d-=2}if(o!==e.getSize())throw new dt("Not all bits consumed: "+o+"/"+e.getSize())}static findMSBSet(e){return 32-M.numberOfLeadingZeros(e)}static calculateBCHCode(e,t){if(t===0)throw new y("0 polynomial");const n=Be.findMSBSet(t);for(e<<=n-1;Be.findMSBSet(e)>=n;)e^=t<<Be.findMSBSet(e)-n;return e}static makeTypeInfoBits(e,t,n){if(!dr.isValidMaskPattern(t))throw new dt("Invalid mask pattern");const o=e.getBits()<<3|t;n.appendBits(o,5);const c=Be.calculateBCHCode(o,Be.TYPE_INFO_POLY);n.appendBits(c,10);const d=new q;if(d.appendBits(Be.TYPE_INFO_MASK_PATTERN,15),n.xor(d),n.getSize()!==15)throw new dt("should not happen but we got: "+n.getSize())}static makeVersionInfoBits(e,t){t.appendBits(e.getVersionNumber(),6);const n=Be.calculateBCHCode(e.getVersionNumber(),Be.VERSION_INFO_POLY);if(t.appendBits(n,12),t.getSize()!==18)throw new dt("should not happen but we got: "+t.getSize())}static isEmpty(e){return e===255}static embedTimingPatterns(e){for(let t=8;t<e.getWidth()-8;++t){const n=(t+1)%2;Be.isEmpty(e.get(t,6))&&e.setNumber(t,6,n),Be.isEmpty(e.get(6,t))&&e.setNumber(6,t,n)}}static embedDarkDotAtLeftBottomCorner(e){if(e.get(8,e.getHeight()-8)===0)throw new dt;e.setNumber(8,e.getHeight()-8,1)}static embedHorizontalSeparationPattern(e,t,n){for(let o=0;o<8;++o){if(!Be.isEmpty(n.get(e+o,t)))throw new dt;n.setNumber(e+o,t,0)}}static embedVerticalSeparationPattern(e,t,n){for(let o=0;o<7;++o){if(!Be.isEmpty(n.get(e,t+o)))throw new dt;n.setNumber(e,t+o,0)}}static embedPositionAdjustmentPattern(e,t,n){for(let o=0;o<5;++o){const c=Be.POSITION_ADJUSTMENT_PATTERN[o];for(let d=0;d<5;++d)n.setNumber(e+d,t+o,c[d])}}static embedPositionDetectionPattern(e,t,n){for(let o=0;o<7;++o){const c=Be.POSITION_DETECTION_PATTERN[o];for(let d=0;d<7;++d)n.setNumber(e+d,t+o,c[d])}}static embedPositionDetectionPatternsAndSeparators(e){const t=Be.POSITION_DETECTION_PATTERN[0].length;Be.embedPositionDetectionPattern(0,0,e),Be.embedPositionDetectionPattern(e.getWidth()-t,0,e),Be.embedPositionDetectionPattern(0,e.getWidth()-t,e);const n=8;Be.embedHorizontalSeparationPattern(0,n-1,e),Be.embedHorizontalSeparationPattern(e.getWidth()-n,n-1,e),Be.embedHorizontalSeparationPattern(0,e.getWidth()-n,e);const o=7;Be.embedVerticalSeparationPattern(o,0,e),Be.embedVerticalSeparationPattern(e.getHeight()-o-1,0,e),Be.embedVerticalSeparationPattern(o,e.getHeight()-o,e)}static maybeEmbedPositionAdjustmentPatterns(e,t){if(e.getVersionNumber()<2)return;const n=e.getVersionNumber()-1,o=Be.POSITION_ADJUSTMENT_PATTERN_COORDINATE_TABLE[n];for(let c=0,d=o.length;c!==d;c++){const h=o[c];if(h>=0)for(let g=0;g!==d;g++){const w=o[g];w>=0&&Be.isEmpty(t.get(w,h))&&Be.embedPositionAdjustmentPattern(w-2,h-2,t)}}}}Be.POSITION_DETECTION_PATTERN=Array.from([Int32Array.from([1,1,1,1,1,1,1]),Int32Array.from([1,0,0,0,0,0,1]),Int32Array.from([1,0,1,1,1,0,1]),Int32Array.from([1,0,1,1,1,0,1]),Int32Array.from([1,0,1,1,1,0,1]),Int32Array.from([1,0,0,0,0,0,1]),Int32Array.from([1,1,1,1,1,1,1])]),Be.POSITION_ADJUSTMENT_PATTERN=Array.from([Int32Array.from([1,1,1,1,1]),Int32Array.from([1,0,0,0,1]),Int32Array.from([1,0,1,0,1]),Int32Array.from([1,0,0,0,1]),Int32Array.from([1,1,1,1,1])]),Be.POSITION_ADJUSTMENT_PATTERN_COORDINATE_TABLE=Array.from([Int32Array.from([-1,-1,-1,-1,-1,-1,-1]),Int32Array.from([6,18,-1,-1,-1,-1,-1]),Int32Array.from([6,22,-1,-1,-1,-1,-1]),Int32Array.from([6,26,-1,-1,-1,-1,-1]),Int32Array.from([6,30,-1,-1,-1,-1,-1]),Int32Array.from([6,34,-1,-1,-1,-1,-1]),Int32Array.from([6,22,38,-1,-1,-1,-1]),Int32Array.from([6,24,42,-1,-1,-1,-1]),Int32Array.from([6,26,46,-1,-1,-1,-1]),Int32Array.from([6,28,50,-1,-1,-1,-1]),Int32Array.from([6,30,54,-1,-1,-1,-1]),Int32Array.from([6,32,58,-1,-1,-1,-1]),Int32Array.from([6,34,62,-1,-1,-1,-1]),Int32Array.from([6,26,46,66,-1,-1,-1]),Int32Array.from([6,26,48,70,-1,-1,-1]),Int32Array.from([6,26,50,74,-1,-1,-1]),Int32Array.from([6,30,54,78,-1,-1,-1]),Int32Array.from([6,30,56,82,-1,-1,-1]),Int32Array.from([6,30,58,86,-1,-1,-1]),Int32Array.from([6,34,62,90,-1,-1,-1]),Int32Array.from([6,28,50,72,94,-1,-1]),Int32Array.from([6,26,50,74,98,-1,-1]),Int32Array.from([6,30,54,78,102,-1,-1]),Int32Array.from([6,28,54,80,106,-1,-1]),Int32Array.from([6,32,58,84,110,-1,-1]),Int32Array.from([6,30,58,86,114,-1,-1]),Int32Array.from([6,34,62,90,118,-1,-1]),Int32Array.from([6,26,50,74,98,122,-1]),Int32Array.from([6,30,54,78,102,126,-1]),Int32Array.from([6,26,52,78,104,130,-1]),Int32Array.from([6,30,56,82,108,134,-1]),Int32Array.from([6,34,60,86,112,138,-1]),Int32Array.from([6,30,58,86,114,142,-1]),Int32Array.from([6,34,62,90,118,146,-1]),Int32Array.from([6,30,54,78,102,126,150]),Int32Array.from([6,24,50,76,102,128,154]),Int32Array.from([6,28,54,80,106,132,158]),Int32Array.from([6,32,58,84,110,136,162]),Int32Array.from([6,26,54,82,110,138,166]),Int32Array.from([6,30,58,86,114,142,170])]),Be.TYPE_INFO_COORDINATES=Array.from([Int32Array.from([8,0]),Int32Array.from([8,1]),Int32Array.from([8,2]),Int32Array.from([8,3]),Int32Array.from([8,4]),Int32Array.from([8,5]),Int32Array.from([8,7]),Int32Array.from([8,8]),Int32Array.from([7,8]),Int32Array.from([5,8]),Int32Array.from([4,8]),Int32Array.from([3,8]),Int32Array.from([2,8]),Int32Array.from([1,8]),Int32Array.from([0,8])]),Be.VERSION_INFO_POLY=7973,Be.TYPE_INFO_POLY=1335,Be.TYPE_INFO_MASK_PATTERN=21522;class Fg{constructor(e,t){this.dataBytes=e,this.errorCorrectionBytes=t}getDataBytes(){return this.dataBytes}getErrorCorrectionBytes(){return this.errorCorrectionBytes}}class xt{constructor(){}static calculateMaskPenalty(e){return Rt.applyMaskPenaltyRule1(e)+Rt.applyMaskPenaltyRule2(e)+Rt.applyMaskPenaltyRule3(e)+Rt.applyMaskPenaltyRule4(e)}static encode(e,t,n=null){let o=xt.DEFAULT_BYTE_MODE_ENCODING;const c=n!==null&&n.get(Pt.CHARACTER_SET)!==void 0;c&&(o=n.get(Pt.CHARACTER_SET).toString());const d=this.chooseMode(e,o),h=new q;if(d===ke.BYTE&&(c||xt.DEFAULT_BYTE_MODE_ENCODING!==o)){const fe=V.getCharacterSetECIByName(o);fe!==void 0&&this.appendECI(fe,h)}this.appendModeInfo(d,h);const g=new q;this.appendBytes(e,d,g,o);let w;if(n!==null&&n.get(Pt.QR_VERSION)!==void 0){const fe=Number.parseInt(n.get(Pt.QR_VERSION).toString(),10);w=Ne.getVersionForNumber(fe);const le=this.calculateBitsNeeded(d,h,g,w);if(!this.willFit(le,w,t))throw new dt("Data too big for requested version")}else w=this.recommendVersion(t,d,h,g);const E=new q;E.appendBitArray(h);const A=d===ke.BYTE?g.getSizeInBytes():e.length;this.appendLengthInfo(A,w,d,E),E.appendBitArray(g);const S=w.getECBlocksForLevel(t),B=w.getTotalCodewords()-S.getTotalECCodewords();this.terminateBits(B,E);const U=this.interleaveWithECBytes(E,w.getTotalCodewords(),B,S.getNumBlocks()),H=new dr;H.setECLevel(t),H.setMode(d),H.setVersion(w);const K=w.getDimensionForVersion(),oe=new Li(K,K),ue=this.chooseMaskPattern(U,t,w,oe);return H.setMaskPattern(ue),Be.buildMatrix(U,t,w,ue,oe),H.setMatrix(oe),H}static recommendVersion(e,t,n,o){const c=this.calculateBitsNeeded(t,n,o,Ne.getVersionForNumber(1)),d=this.chooseVersion(c,e),h=this.calculateBitsNeeded(t,n,o,d);return this.chooseVersion(h,e)}static calculateBitsNeeded(e,t,n,o){return t.getSize()+e.getCharacterCountBits(o)+n.getSize()}static getAlphanumericCode(e){return e<xt.ALPHANUMERIC_TABLE.length?xt.ALPHANUMERIC_TABLE[e]:-1}static chooseMode(e,t=null){if(V.SJIS.getName()===t&&this.isOnlyDoubleByteKanji(e))return ke.KANJI;let n=!1,o=!1;for(let c=0,d=e.length;c<d;++c){const h=e.charAt(c);if(xt.isDigit(h))n=!0;else if(this.getAlphanumericCode(h.charCodeAt(0))!==-1)o=!0;else return ke.BYTE}return o?ke.ALPHANUMERIC:n?ke.NUMERIC:ke.BYTE}static isOnlyDoubleByteKanji(e){let t;try{t=Q.encode(e,V.SJIS)}catch{return!1}const n=t.length;if(n%2!==0)return!1;for(let o=0;o<n;o+=2){const c=t[o]&255;if((c<129||c>159)&&(c<224||c>235))return!1}return!0}static chooseMaskPattern(e,t,n,o){let c=Number.MAX_SAFE_INTEGER,d=-1;for(let h=0;h<dr.NUM_MASK_PATTERNS;h++){Be.buildMatrix(e,t,n,h,o);let g=this.calculateMaskPenalty(o);g<c&&(c=g,d=h)}return d}static chooseVersion(e,t){for(let n=1;n<=40;n++){const o=Ne.getVersionForNumber(n);if(xt.willFit(e,o,t))return o}throw new dt("Data too big")}static willFit(e,t,n){const o=t.getTotalCodewords(),d=t.getECBlocksForLevel(n).getTotalECCodewords(),h=o-d,g=(e+7)/8;return h>=g}static terminateBits(e,t){const n=e*8;if(t.getSize()>n)throw new dt("data bits cannot fit in the QR Code"+t.getSize()+" > "+n);for(let d=0;d<4&&t.getSize()<n;++d)t.appendBit(!1);const o=t.getSize()&7;if(o>0)for(let d=o;d<8;d++)t.appendBit(!1);const c=e-t.getSizeInBytes();for(let d=0;d<c;++d)t.appendBits(d&1?17:236,8);if(t.getSize()!==n)throw new dt("Bits size does not equal capacity")}static getNumDataBytesAndNumECBytesForBlockID(e,t,n,o,c,d){if(o>=n)throw new dt("Block ID too large");const h=e%n,g=n-h,w=Math.floor(e/n),E=w+1,A=Math.floor(t/n),S=A+1,B=w-A,U=E-S;if(B!==U)throw new dt("EC bytes mismatch");if(n!==g+h)throw new dt("RS blocks mismatch");if(e!==(A+B)*g+(S+U)*h)throw new dt("Total bytes mismatch");o<g?(c[0]=A,d[0]=B):(c[0]=S,d[0]=U)}static interleaveWithECBytes(e,t,n,o){if(e.getSizeInBytes()!==n)throw new dt("Number of bits and data bytes does not match");let c=0,d=0,h=0;const g=new Array;for(let E=0;E<o;++E){const A=new Int32Array(1),S=new Int32Array(1);xt.getNumDataBytesAndNumECBytesForBlockID(t,n,o,E,A,S);const B=A[0],U=new Uint8Array(B);e.toBytes(8*c,U,0,B);const H=xt.generateECBytes(U,S[0]);g.push(new Fg(U,H)),d=Math.max(d,B),h=Math.max(h,H.length),c+=A[0]}if(n!==c)throw new dt("Data bytes does not match offset");const w=new q;for(let E=0;E<d;++E)for(const A of g){const S=A.getDataBytes();E<S.length&&w.appendBits(S[E],8)}for(let E=0;E<h;++E)for(const A of g){const S=A.getErrorCorrectionBytes();E<S.length&&w.appendBits(S[E],8)}if(t!==w.getSizeInBytes())throw new dt("Interleaving error: "+t+" and "+w.getSizeInBytes()+" differ.");return w}static generateECBytes(e,t){const n=e.length,o=new Int32Array(n+t);for(let d=0;d<n;d++)o[d]=e[d]&255;new Go(Me.QR_CODE_FIELD_256).encode(o,t);const c=new Uint8Array(t);for(let d=0;d<t;d++)c[d]=o[n+d];return c}static appendModeInfo(e,t){t.appendBits(e.getBits(),4)}static appendLengthInfo(e,t,n,o){const c=n.getCharacterCountBits(t);if(e>=1<<c)throw new dt(e+" is bigger than "+((1<<c)-1));o.appendBits(e,c)}static appendBytes(e,t,n,o){switch(t){case ke.NUMERIC:xt.appendNumericBytes(e,n);break;case ke.ALPHANUMERIC:xt.appendAlphanumericBytes(e,n);break;case ke.BYTE:xt.append8BitBytes(e,n,o);break;case ke.KANJI:xt.appendKanjiBytes(e,n);break;default:throw new dt("Invalid mode: "+t)}}static getDigit(e){return e.charCodeAt(0)-48}static isDigit(e){const t=xt.getDigit(e);return t>=0&&t<=9}static appendNumericBytes(e,t){const n=e.length;let o=0;for(;o<n;){const c=xt.getDigit(e.charAt(o));if(o+2<n){const d=xt.getDigit(e.charAt(o+1)),h=xt.getDigit(e.charAt(o+2));t.appendBits(c*100+d*10+h,10),o+=3}else if(o+1<n){const d=xt.getDigit(e.charAt(o+1));t.appendBits(c*10+d,7),o+=2}else t.appendBits(c,4),o++}}static appendAlphanumericBytes(e,t){const n=e.length;let o=0;for(;o<n;){const c=xt.getAlphanumericCode(e.charCodeAt(o));if(c===-1)throw new dt;if(o+1<n){const d=xt.getAlphanumericCode(e.charCodeAt(o+1));if(d===-1)throw new dt;t.appendBits(c*45+d,11),o+=2}else t.appendBits(c,6),o++}}static append8BitBytes(e,t,n){let o;try{o=Q.encode(e,n)}catch(c){throw new dt(c)}for(let c=0,d=o.length;c!==d;c++){const h=o[c];t.appendBits(h,8)}}static appendKanjiBytes(e,t){let n;try{n=Q.encode(e,V.SJIS)}catch(c){throw new dt(c)}const o=n.length;for(let c=0;c<o;c+=2){const d=n[c]&255,h=n[c+1]&255,g=d<<8&4294967295|h;let w=-1;if(g>=33088&&g<=40956?w=g-33088:g>=57408&&g<=60351&&(w=g-49472),w===-1)throw new dt("Invalid byte sequence");const E=(w>>8)*192+(w&255);t.appendBits(E,13)}}static appendECI(e,t){t.appendBits(ke.ECI.getBits(),4),t.appendBits(e.getValue(),8)}}xt.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]),xt.DEFAULT_BYTE_MODE_ENCODING=V.UTF8.getName();class ur{write(e,t,n,o=null){if(e.length===0)throw new y("Found empty contents");if(t<0||n<0)throw new y("Requested dimensions are too small: "+t+"x"+n);let c=mt.L,d=ur.QUIET_ZONE_SIZE;o!==null&&(o.get(Pt.ERROR_CORRECTION)!==void 0&&(c=mt.fromString(o.get(Pt.ERROR_CORRECTION).toString())),o.get(Pt.MARGIN)!==void 0&&(d=Number.parseInt(o.get(Pt.MARGIN).toString(),10)));const h=xt.encode(e,c,o);return this.renderResult(h,t,n,d)}writeToDom(e,t,n,o,c=null){typeof e=="string"&&(e=document.querySelector(e));const d=this.write(t,n,o,c);e&&e.appendChild(d)}renderResult(e,t,n,o){const c=e.getMatrix();if(c===null)throw new Ue;const d=c.getWidth(),h=c.getHeight(),g=d+o*2,w=h+o*2,E=Math.max(t,g),A=Math.max(n,w),S=Math.min(Math.floor(E/g),Math.floor(A/w)),B=Math.floor((E-d*S)/2),U=Math.floor((A-h*S)/2),H=this.createSVGElement(E,A);for(let K=0,oe=U;K<h;K++,oe+=S)for(let ue=0,fe=B;ue<d;ue++,fe+=S)if(c.get(ue,K)===1){const le=this.createSvgRectElement(fe,oe,S,S);H.appendChild(le)}return H}createSVGElement(e,t){const n=document.createElementNS(ur.SVG_NS,"svg");return n.setAttributeNS(null,"height",e.toString()),n.setAttributeNS(null,"width",t.toString()),n}createSvgRectElement(e,t,n,o){const c=document.createElementNS(ur.SVG_NS,"rect");return c.setAttributeNS(null,"x",e.toString()),c.setAttributeNS(null,"y",t.toString()),c.setAttributeNS(null,"height",n.toString()),c.setAttributeNS(null,"width",o.toString()),c.setAttributeNS(null,"fill","#000000"),c}}ur.QUIET_ZONE_SIZE=4,ur.SVG_NS="http://www.w3.org/2000/svg";class Rr{encode(e,t,n,o,c){if(e.length===0)throw new y("Found empty contents");if(t!==xe.QR_CODE)throw new y("Can only encode QR_CODE, but got "+t);if(n<0||o<0)throw new y(`Requested dimensions are too small: ${n}x${o}`);let d=mt.L,h=Rr.QUIET_ZONE_SIZE;c!==null&&(c.get(Pt.ERROR_CORRECTION)!==void 0&&(d=mt.fromString(c.get(Pt.ERROR_CORRECTION).toString())),c.get(Pt.MARGIN)!==void 0&&(h=Number.parseInt(c.get(Pt.MARGIN).toString(),10)));const g=xt.encode(e,d,c);return Rr.renderResult(g,n,o,h)}static renderResult(e,t,n,o){const c=e.getMatrix();if(c===null)throw new Ue;const d=c.getWidth(),h=c.getHeight(),g=d+o*2,w=h+o*2,E=Math.max(t,g),A=Math.max(n,w),S=Math.min(Math.floor(E/g),Math.floor(A/w)),B=Math.floor((E-d*S)/2),U=Math.floor((A-h*S)/2),H=new z(E,A);for(let K=0,oe=U;K<h;K++,oe+=S)for(let ue=0,fe=B;ue<d;ue++,fe+=S)c.get(ue,K)===1&&H.setRegion(fe,oe,S,S);return H}}Rr.QUIET_ZONE_SIZE=4;class Vg{encode(e,t,n,o,c){let d;switch(t){case xe.QR_CODE:d=new Rr;break;default:throw new y("No encoder available for format "+t)}return d.encode(e,t,n,o,c)}}class Mn extends j{constructor(e,t,n,o,c,d,h,g){if(super(d,h),this.yuvData=e,this.dataWidth=t,this.dataHeight=n,this.left=o,this.top=c,o+d>t||c+h>n)throw new y("Crop rectangle does not fit within image data.");g&&this.reverseHorizontal(d,h)}getRow(e,t){if(e<0||e>=this.getHeight())throw new y("Requested row is outside the image: "+e);const n=this.getWidth();(t==null||t.length<n)&&(t=new Uint8ClampedArray(n));const o=(e+this.top)*this.dataWidth+this.left;return v.arraycopy(this.yuvData,o,t,0,n),t}getMatrix(){const e=this.getWidth(),t=this.getHeight();if(e===this.dataWidth&&t===this.dataHeight)return this.yuvData;const n=e*t,o=new Uint8ClampedArray(n);let c=this.top*this.dataWidth+this.left;if(e===this.dataWidth)return v.arraycopy(this.yuvData,c,o,0,n),o;for(let d=0;d<t;d++){const h=d*e;v.arraycopy(this.yuvData,c,o,h,e),c+=this.dataWidth}return o}isCropSupported(){return!0}crop(e,t,n,o){return new Mn(this.yuvData,this.dataWidth,this.dataHeight,this.left+e,this.top+t,n,o,!1)}renderThumbnail(){const e=this.getWidth()/Mn.THUMBNAIL_SCALE_FACTOR,t=this.getHeight()/Mn.THUMBNAIL_SCALE_FACTOR,n=new Int32Array(e*t),o=this.yuvData;let c=this.top*this.dataWidth+this.left;for(let d=0;d<t;d++){const h=d*e;for(let g=0;g<e;g++){const w=o[c+g*Mn.THUMBNAIL_SCALE_FACTOR]&255;n[h+g]=4278190080|w*65793}c+=this.dataWidth*Mn.THUMBNAIL_SCALE_FACTOR}return n}getThumbnailWidth(){return this.getWidth()/Mn.THUMBNAIL_SCALE_FACTOR}getThumbnailHeight(){return this.getHeight()/Mn.THUMBNAIL_SCALE_FACTOR}reverseHorizontal(e,t){const n=this.yuvData;for(let o=0,c=this.top*this.dataWidth+this.left;o<t;o++,c+=this.dataWidth){const d=c+e/2;for(let h=c,g=c+e-1;h<d;h++,g--){const w=n[h];n[h]=n[g],n[g]=w}}}invert(){return new Z(this)}}Mn.THUMBNAIL_SCALE_FACTOR=2;class Wo extends j{constructor(e,t,n,o,c,d,h){if(super(t,n),this.dataWidth=o,this.dataHeight=c,this.left=d,this.top=h,e.BYTES_PER_ELEMENT===4){const g=t*n,w=new Uint8ClampedArray(g);for(let E=0;E<g;E++){const A=e[E],S=A>>16&255,B=A>>7&510,U=A&255;w[E]=(S+B+U)/4&255}this.luminances=w}else this.luminances=e;if(o===void 0&&(this.dataWidth=t),c===void 0&&(this.dataHeight=n),d===void 0&&(this.left=0),h===void 0&&(this.top=0),this.left+t>this.dataWidth||this.top+n>this.dataHeight)throw new y("Crop rectangle does not fit within image data.")}getRow(e,t){if(e<0||e>=this.getHeight())throw new y("Requested row is outside the image: "+e);const n=this.getWidth();(t==null||t.length<n)&&(t=new Uint8ClampedArray(n));const o=(e+this.top)*this.dataWidth+this.left;return v.arraycopy(this.luminances,o,t,0,n),t}getMatrix(){const e=this.getWidth(),t=this.getHeight();if(e===this.dataWidth&&t===this.dataHeight)return this.luminances;const n=e*t,o=new Uint8ClampedArray(n);let c=this.top*this.dataWidth+this.left;if(e===this.dataWidth)return v.arraycopy(this.luminances,c,o,0,n),o;for(let d=0;d<t;d++){const h=d*e;v.arraycopy(this.luminances,c,o,h,e),c+=this.dataWidth}return o}isCropSupported(){return!0}crop(e,t,n,o){return new Wo(this.luminances,n,o,this.dataWidth,this.dataHeight,this.left+e,this.top+t)}invert(){return new Z(this)}}class tl extends V{static forName(e){return this.getCharacterSetECIByName(e)}}class Xo{}Xo.ISO_8859_1=V.ISO8859_1;class nl{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 rl{static singletonList(e){return[e]}static min(e,t){return e.sort(t)[0]}}class Ug{constructor(e){this.previous=e}getPrevious(){return this.previous}}class Br extends Ug{constructor(e,t,n){super(e),this.value=t,this.bitCount=n}appendTo(e,t){e.appendBits(this.value,this.bitCount)}add(e,t){return new Br(this,e,t)}addBinaryShift(e,t){return console.warn("addBinaryShift on SimpleToken, this simply returns a copy of this token"),new Br(this,e,t)}toString(){let e=this.value&(1<<this.bitCount)-1;return e|=1<<this.bitCount,"<"+M.toBinaryString(e|1<<this.bitCount).substring(1)+">"}}class $o extends Br{constructor(e,t,n){super(e,0,0),this.binaryShiftStart=t,this.binaryShiftByteCount=n}appendTo(e,t){for(let n=0;n<this.binaryShiftByteCount;n++)(n===0||n===31&&this.binaryShiftByteCount<=62)&&(e.appendBits(31,5),this.binaryShiftByteCount>62?e.appendBits(this.binaryShiftByteCount-31,16):n===0?e.appendBits(Math.min(this.binaryShiftByteCount,31),5):e.appendBits(this.binaryShiftByteCount-31,5)),e.appendBits(t[this.binaryShiftStart+n],8)}addBinaryShift(e,t){return new $o(this,e,t)}toString(){return"<"+this.binaryShiftStart+"::"+(this.binaryShiftStart+this.binaryShiftByteCount-1)+">"}}function zg(b,e,t){return new $o(b,e,t)}function ti(b,e,t){return new Br(b,e,t)}const Hg=["UPPER","LOWER","DIGIT","MIXED","PUNCT"],Yn=0,Fi=1,xn=2,il=3,Dn=4,Gg=new Br(null,0,0),jo=[Int32Array.from([0,(5<<16)+28,(5<<16)+30,(5<<16)+29,656318]),Int32Array.from([(9<<16)+480+14,0,(5<<16)+30,(5<<16)+29,656318]),Int32Array.from([(4<<16)+14,(9<<16)+448+28,0,(9<<16)+448+29,932798]),Int32Array.from([(5<<16)+29,(5<<16)+28,656318,0,(5<<16)+30]),Int32Array.from([(5<<16)+31,656380,656382,656381,0])];function Wg(b){for(let e of b)D.fill(e,-1);return b[Yn][Dn]=0,b[Fi][Dn]=0,b[Fi][Yn]=28,b[il][Dn]=0,b[xn][Dn]=0,b[xn][Yn]=15,b}const ol=Wg(D.createInt32Array(6,6));class vn{constructor(e,t,n,o){this.token=e,this.mode=t,this.binaryShiftByteCount=n,this.bitCount=o}getMode(){return this.mode}getToken(){return this.token}getBinaryShiftByteCount(){return this.binaryShiftByteCount}getBitCount(){return this.bitCount}latchAndAppend(e,t){let n=this.bitCount,o=this.token;if(e!==this.mode){let d=jo[this.mode][e];o=ti(o,d&65535,d>>16),n+=d>>16}let c=e===xn?4:5;return o=ti(o,t,c),new vn(o,e,0,n+c)}shiftAndAppend(e,t){let n=this.token,o=this.mode===xn?4:5;return n=ti(n,ol[this.mode][e],o),n=ti(n,t,5),new vn(n,this.mode,0,this.bitCount+o+5)}addBinaryShiftChar(e){let t=this.token,n=this.mode,o=this.bitCount;if(this.mode===Dn||this.mode===xn){let h=jo[n][Yn];t=ti(t,h&65535,h>>16),o+=h>>16,n=Yn}let c=this.binaryShiftByteCount===0||this.binaryShiftByteCount===31?18:this.binaryShiftByteCount===62?9:8,d=new vn(t,n,this.binaryShiftByteCount+1,o+c);return d.binaryShiftByteCount===2078&&(d=d.endBinaryShift(e+1)),d}endBinaryShift(e){if(this.binaryShiftByteCount===0)return this;let t=this.token;return t=zg(t,e-this.binaryShiftByteCount,this.binaryShiftByteCount),new vn(t,this.mode,0,this.bitCount)}isBetterThanOrEqualTo(e){let t=this.bitCount+(jo[this.mode][e.mode]>>16);return this.binaryShiftByteCount<e.binaryShiftByteCount?t+=vn.calculateBinaryShiftCost(e)-vn.calculateBinaryShiftCost(this):this.binaryShiftByteCount>e.binaryShiftByteCount&&e.binaryShiftByteCount>0&&(t+=10),t<=e.bitCount}toBitArray(e){let t=[];for(let o=this.endBinaryShift(e.length).token;o!==null;o=o.getPrevious())t.unshift(o);let n=new q;for(const o of t)o.appendTo(n,e);return n}toString(){return te.format("%s bits=%d bytes=%d",Hg[this.mode],this.bitCount,this.binaryShiftByteCount)}static calculateBinaryShiftCost(e){return e.binaryShiftByteCount>62?21:e.binaryShiftByteCount>31?20:e.binaryShiftByteCount>0?10:0}}vn.INITIAL_STATE=new vn(Gg,Yn,0,0);function Xg(b){const e=te.getCharCode(" "),t=te.getCharCode("."),n=te.getCharCode(",");b[Yn][e]=1;const o=te.getCharCode("Z"),c=te.getCharCode("A");for(let S=c;S<=o;S++)b[Yn][S]=S-c+2;b[Fi][e]=1;const d=te.getCharCode("z"),h=te.getCharCode("a");for(let S=h;S<=d;S++)b[Fi][S]=S-h+2;b[xn][e]=1;const g=te.getCharCode("9"),w=te.getCharCode("0");for(let S=w;S<=g;S++)b[xn][S]=S-w+2;b[xn][n]=12,b[xn][t]=13;const E=["\0"," ","","","","","","","\x07","\b"," ",`
29
+ `,"\v","\f","\r","\x1B","","","","","@","\\","^","_","`","|","~",""];for(let S=0;S<E.length;S++)b[il][te.getCharCode(E[S])]=S;const A=["\0","\r","\0","\0","\0","\0","!","'","#","$","%","&","'","(",")","*","+",",","-",".","/",":",";","<","=",">","?","[","]","{","}"];for(let S=0;S<A.length;S++)te.getCharCode(A[S])>0&&(b[Dn][te.getCharCode(A[S])]=S);return b}const qo=Xg(D.createInt32Array(5,256));class ni{constructor(e){this.text=e}encode(){const e=te.getCharCode(" "),t=te.getCharCode(`
30
+ `);let n=rl.singletonList(vn.INITIAL_STATE);for(let c=0;c<this.text.length;c++){let d,h=c+1<this.text.length?this.text[c+1]:0;switch(this.text[c]){case te.getCharCode("\r"):d=h===t?2:0;break;case te.getCharCode("."):d=h===e?3:0;break;case te.getCharCode(","):d=h===e?4:0;break;case te.getCharCode(":"):d=h===e?5:0;break;default:d=0}d>0?(n=ni.updateStateListForPair(n,c,d),c++):n=this.updateStateListForChar(n,c)}return rl.min(n,(c,d)=>c.getBitCount()-d.getBitCount()).toBitArray(this.text)}updateStateListForChar(e,t){const n=[];for(let o of e)this.updateStateForChar(o,t,n);return ni.simplifyStates(n)}updateStateForChar(e,t,n){let o=this.text[t]&255,c=qo[e.getMode()][o]>0,d=null;for(let h=0;h<=Dn;h++){let g=qo[h][o];if(g>0){if(d==null&&(d=e.endBinaryShift(t)),!c||h===e.getMode()||h===xn){const w=d.latchAndAppend(h,g);n.push(w)}if(!c&&ol[e.getMode()][h]>=0){const w=d.shiftAndAppend(h,g);n.push(w)}}}if(e.getBinaryShiftByteCount()>0||qo[e.getMode()][o]===0){let h=e.addBinaryShiftChar(t);n.push(h)}}static updateStateListForPair(e,t,n){const o=[];for(let c of e)this.updateStateForPair(c,t,n,o);return this.simplifyStates(o)}static updateStateForPair(e,t,n,o){let c=e.endBinaryShift(t);if(o.push(c.latchAndAppend(Dn,n)),e.getMode()!==Dn&&o.push(c.shiftAndAppend(Dn,n)),n===3||n===4){let d=c.latchAndAppend(xn,16-n).latchAndAppend(xn,1);o.push(d)}if(e.getBinaryShiftByteCount()>0){let d=e.addBinaryShiftChar(t).addBinaryShiftChar(t+1);o.push(d)}}static simplifyStates(e){let t=[];for(const n of e){let o=!0;for(const c of t){if(c.isBetterThanOrEqualTo(n)){o=!1;break}n.isBetterThanOrEqualTo(c)&&(t=t.filter(d=>d!==c))}o&&t.push(n)}return t}}class Ke{constructor(){}static encodeBytes(e){return Ke.encode(e,Ke.DEFAULT_EC_PERCENT,Ke.DEFAULT_AZTEC_LAYERS)}static encode(e,t,n){let o=new ni(e).encode(),c=M.truncDivision(o.getSize()*t,100)+11,d=o.getSize()+c,h,g,w,E,A;if(n!==Ke.DEFAULT_AZTEC_LAYERS){if(h=n<0,g=Math.abs(n),g>(h?Ke.MAX_NB_BITS_COMPACT:Ke.MAX_NB_BITS))throw new y(te.format("Illegal value %s for layers",n));w=Ke.totalBitsInLayer(g,h),E=Ke.WORD_SIZE[g];let le=w-w%E;if(A=Ke.stuffBits(o,E),A.getSize()+c>le)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 le=0;;le++){if(le>Ke.MAX_NB_BITS)throw new y("Data too large for an Aztec code");if(h=le<=3,g=h?le+1:le,w=Ke.totalBitsInLayer(g,h),d>w)continue;(A==null||E!==Ke.WORD_SIZE[g])&&(E=Ke.WORD_SIZE[g],A=Ke.stuffBits(o,E));let je=w-w%E;if(!(h&&A.getSize()>E*64)&&A.getSize()+c<=je)break}}let S=Ke.generateCheckWords(A,w,E),B=A.getSize()/E,U=Ke.generateModeMessage(h,g,B),H=(h?11:14)+g*4,K=new Int32Array(H),oe;if(h){oe=H;for(let le=0;le<K.length;le++)K[le]=le}else{oe=H+1+2*M.truncDivision(M.truncDivision(H,2)-1,15);let le=M.truncDivision(H,2),je=M.truncDivision(oe,2);for(let Fe=0;Fe<le;Fe++){let rn=Fe+M.truncDivision(Fe,15);K[le-Fe-1]=je-rn-1,K[le+Fe]=je+rn+1}}let ue=new z(oe);for(let le=0,je=0;le<g;le++){let Fe=(g-le)*4+(h?9:12);for(let rn=0;rn<Fe;rn++){let Sn=rn*2;for(let on=0;on<2;on++)S.get(je+Sn+on)&&ue.set(K[le*2+on],K[le*2+rn]),S.get(je+Fe*2+Sn+on)&&ue.set(K[le*2+rn],K[H-1-le*2-on]),S.get(je+Fe*4+Sn+on)&&ue.set(K[H-1-le*2-on],K[H-1-le*2-rn]),S.get(je+Fe*6+Sn+on)&&ue.set(K[H-1-le*2-rn],K[le*2+on])}je+=Fe*8}if(Ke.drawModeMessage(ue,h,oe,U),h)Ke.drawBullsEye(ue,M.truncDivision(oe,2),5);else{Ke.drawBullsEye(ue,M.truncDivision(oe,2),7);for(let le=0,je=0;le<M.truncDivision(H,2)-1;le+=15,je+=16)for(let Fe=M.truncDivision(oe,2)&1;Fe<oe;Fe+=2)ue.set(M.truncDivision(oe,2)-je,Fe),ue.set(M.truncDivision(oe,2)+je,Fe),ue.set(Fe,M.truncDivision(oe,2)-je),ue.set(Fe,M.truncDivision(oe,2)+je)}let fe=new nl;return fe.setCompact(h),fe.setSize(oe),fe.setLayers(g),fe.setCodeWords(B),fe.setMatrix(ue),fe}static drawBullsEye(e,t,n){for(let o=0;o<n;o+=2)for(let c=t-o;c<=t+o;c++)e.set(c,t-o),e.set(c,t+o),e.set(t-o,c),e.set(t+o,c);e.set(t-n,t-n),e.set(t-n+1,t-n),e.set(t-n,t-n+1),e.set(t+n,t-n),e.set(t+n,t-n+1),e.set(t+n,t+n-1)}static generateModeMessage(e,t,n){let o=new q;return e?(o.appendBits(t-1,2),o.appendBits(n-1,6),o=Ke.generateCheckWords(o,28,4)):(o.appendBits(t-1,5),o.appendBits(n-1,11),o=Ke.generateCheckWords(o,40,4)),o}static drawModeMessage(e,t,n,o){let c=M.truncDivision(n,2);if(t)for(let d=0;d<7;d++){let h=c-3+d;o.get(d)&&e.set(h,c-5),o.get(d+7)&&e.set(c+5,h),o.get(20-d)&&e.set(h,c+5),o.get(27-d)&&e.set(c-5,h)}else for(let d=0;d<10;d++){let h=c-5+d+M.truncDivision(d,5);o.get(d)&&e.set(h,c-7),o.get(d+10)&&e.set(c+7,h),o.get(29-d)&&e.set(h,c+7),o.get(39-d)&&e.set(c-7,h)}}static generateCheckWords(e,t,n){let o=e.getSize()/n,c=new Go(Ke.getGF(n)),d=M.truncDivision(t,n),h=Ke.bitsToWords(e,n,d);c.encode(h,d-o);let g=t%n,w=new q;w.appendBits(0,g);for(const E of Array.from(h))w.appendBits(E,n);return w}static bitsToWords(e,t,n){let o=new Int32Array(n),c,d;for(c=0,d=e.getSize()/t;c<d;c++){let h=0;for(let g=0;g<t;g++)h|=e.get(c*t+g)?1<<t-g-1:0;o[c]=h}return o}static getGF(e){switch(e){case 4:return Me.AZTEC_PARAM;case 6:return Me.AZTEC_DATA_6;case 8:return Me.AZTEC_DATA_8;case 10:return Me.AZTEC_DATA_10;case 12:return Me.AZTEC_DATA_12;default:throw new y("Unsupported word size "+e)}}static stuffBits(e,t){let n=new q,o=e.getSize(),c=(1<<t)-2;for(let d=0;d<o;d+=t){let h=0;for(let g=0;g<t;g++)(d+g>=o||e.get(d+g))&&(h|=1<<t-1-g);(h&c)===c?(n.appendBits(h&c,t),d--):h&c?n.appendBits(h,t):(n.appendBits(h|1,t),d--)}return n}static totalBitsInLayer(e,t){return((t?88:112)+16*e)*e}}Ke.DEFAULT_EC_PERCENT=33,Ke.DEFAULT_AZTEC_LAYERS=0,Ke.MAX_NB_BITS=32,Ke.MAX_NB_BITS_COMPACT=4,Ke.WORD_SIZE=Int32Array.from([4,6,6,8,8,8,8,8,8,10,10,10,10,10,10,10,10,10,10,10,10,10,10,12,12,12,12,12,12,12,12,12,12]);class Vi{encode(e,t,n,o){return this.encodeWithHints(e,t,n,o,null)}encodeWithHints(e,t,n,o,c){let d=Xo.ISO_8859_1,h=Ke.DEFAULT_EC_PERCENT,g=Ke.DEFAULT_AZTEC_LAYERS;return c!=null&&(c.has(Pt.CHARACTER_SET)&&(d=tl.forName(c.get(Pt.CHARACTER_SET).toString())),c.has(Pt.ERROR_CORRECTION)&&(h=M.parseInt(c.get(Pt.ERROR_CORRECTION).toString())),c.has(Pt.AZTEC_LAYERS)&&(g=M.parseInt(c.get(Pt.AZTEC_LAYERS).toString()))),Vi.encodeLayers(e,t,n,o,d,h,g)}static encodeLayers(e,t,n,o,c,d,h){if(t!==xe.AZTEC)throw new y("Can only encode AZTEC, but got "+t);let g=Ke.encode(te.getBytes(e,c),d,h);return Vi.renderResult(g,n,o)}static renderResult(e,t,n){let o=e.getMatrix();if(o==null)throw new Ue;let c=o.getWidth(),d=o.getHeight(),h=Math.max(t,c),g=Math.max(n,d),w=Math.min(h/c,g/d),E=(h-c*w)/2,A=(g-d*w)/2,S=new z(h,g);for(let B=0,U=A;B<d;B++,U+=w)for(let H=0,K=E;H<c;H++,K+=w)o.get(H,B)&&S.setRegion(K,U,w,w);return S}}i.AbstractExpandedDecoder=Mo,i.ArgumentException=C,i.ArithmeticException=it,i.AztecCode=nl,i.AztecCodeReader=Sr,i.AztecCodeWriter=Vi,i.AztecDecoder=Qe,i.AztecDetector=Bi,i.AztecDetectorResult=qr,i.AztecEncoder=Ke,i.AztecHighLevelEncoder=ni,i.AztecPoint=Ut,i.BarcodeFormat=xe,i.Binarizer=N,i.BinaryBitmap=I,i.BitArray=q,i.BitMatrix=z,i.BitSource=Lo,i.BrowserAztecCodeReader=Oo,i.BrowserBarcodeReader=yg,i.BrowserCodeReader=Ce,i.BrowserDatamatrixCodeReader=Ag,i.BrowserMultiFormatReader=vg,i.BrowserPDF417Reader=Pg,i.BrowserQRCodeReader=Lg,i.BrowserQRCodeSvgWriter=ur,i.CharacterSetECI=V,i.ChecksumException=O,i.Code128Reader=me,i.Code39Reader=bt,i.DataMatrixDecodedBitStreamParser=$n,i.DataMatrixReader=jn,i.DecodeHintType=Y,i.DecoderResult=et,i.DefaultGridSampler=Ri,i.DetectorResult=br,i.EAN13Reader=zt,i.EncodeHintType=Pt,i.Exception=x,i.FormatException=F,i.GenericGF=Me,i.GenericGFPoly=Ve,i.GlobalHistogramBinarizer=X,i.GridSampler=Ar,i.GridSamplerInstance=Rn,i.HTMLCanvasElementLuminanceSource=ee,i.HybridBinarizer=$,i.ITFReader=tt,i.IllegalArgumentException=y,i.IllegalStateException=Ue,i.InvertedLuminanceSource=Z,i.LuminanceSource=j,i.MathUtils=ve,i.MultiFormatOneDReader=Tr,i.MultiFormatReader=el,i.MultiFormatWriter=Vg,i.NotFoundException=T,i.OneDReader=ht,i.PDF417DecodedBitStreamParser=re,i.PDF417DecoderErrorCorrection=qa,i.PDF417Reader=Gt,i.PDF417ResultMetadata=Ya,i.PerspectiveTransform=dn,i.PlanarYUVLuminanceSource=Mn,i.QRCodeByteMatrix=Li,i.QRCodeDataMask=gn,i.QRCodeDecodedBitStreamParser=At,i.QRCodeDecoderErrorCorrectionLevel=mt,i.QRCodeDecoderFormatInformation=$t,i.QRCodeEncoder=xt,i.QRCodeEncoderQRCode=dr,i.QRCodeMaskUtil=Rt,i.QRCodeMatrixUtil=Be,i.QRCodeMode=ke,i.QRCodeReader=qn,i.QRCodeVersion=Ne,i.QRCodeWriter=Rr,i.RGBLuminanceSource=Wo,i.RSS14Reader=kt,i.RSSExpandedReader=ae,i.ReaderException=Pi,i.ReedSolomonDecoder=Nt,i.ReedSolomonEncoder=Go,i.ReedSolomonException=Ie,i.Result=ge,i.ResultMetadataType=be,i.ResultPoint=ye,i.StringUtils=te,i.UnsupportedOperationException=ie,i.VideoInputDevice=de,i.WhiteRectangleDetector=Dt,i.WriterException=dt,i.ZXingArrays=D,i.ZXingCharset=tl,i.ZXingInteger=M,i.ZXingStandardCharsets=Xo,i.ZXingStringBuilder=G,i.ZXingStringEncoding=Q,i.ZXingSystem=v,i.createAbstractExpandedDecoder=$a,Object.defineProperty(i,"__esModule",{value:!0})})})(So,So.exports);var gt=So.exports;const nm=cl({__proto__:null,default:ta(gt)},[gt]);var ba=function(){function a(l,i,s){if(this.formatMap=new Map([[we.QR_CODE,gt.BarcodeFormat.QR_CODE],[we.AZTEC,gt.BarcodeFormat.AZTEC],[we.CODABAR,gt.BarcodeFormat.CODABAR],[we.CODE_39,gt.BarcodeFormat.CODE_39],[we.CODE_93,gt.BarcodeFormat.CODE_93],[we.CODE_128,gt.BarcodeFormat.CODE_128],[we.DATA_MATRIX,gt.BarcodeFormat.DATA_MATRIX],[we.MAXICODE,gt.BarcodeFormat.MAXICODE],[we.ITF,gt.BarcodeFormat.ITF],[we.EAN_13,gt.BarcodeFormat.EAN_13],[we.EAN_8,gt.BarcodeFormat.EAN_8],[we.PDF_417,gt.BarcodeFormat.PDF_417],[we.RSS_14,gt.BarcodeFormat.RSS_14],[we.RSS_EXPANDED,gt.BarcodeFormat.RSS_EXPANDED],[we.UPC_A,gt.BarcodeFormat.UPC_A],[we.UPC_E,gt.BarcodeFormat.UPC_E],[we.UPC_EAN_EXTENSION,gt.BarcodeFormat.UPC_EAN_EXTENSION]]),this.reverseFormatMap=this.createReverseFormatMap(),!nm)throw"Use html5qrcode.min.js without edit, ZXing not found.";this.verbose=i,this.logger=s;var u=this.createZXingFormats(l),f=new Map;f.set(gt.DecodeHintType.POSSIBLE_FORMATS,u),f.set(gt.DecodeHintType.TRY_HARDER,!1),this.hints=f}return a.prototype.decodeAsync=function(l){var i=this;return new Promise(function(s,u){try{s(i.decode(l))}catch(f){u(f)}})},a.prototype.decode=function(l){var i=new gt.MultiFormatReader(this.verbose,this.hints),s=new gt.HTMLCanvasElementLuminanceSource(l),u=new gt.BinaryBitmap(new gt.HybridBinarizer(s)),f=i.decode(u);return{text:f.text,format:Ca.create(this.toHtml5QrcodeSupportedFormats(f.format)),debugData:this.createDebugData()}},a.prototype.createReverseFormatMap=function(){var l=new Map;return this.formatMap.forEach(function(i,s,u){l.set(i,s)}),l},a.prototype.toHtml5QrcodeSupportedFormats=function(l){if(!this.reverseFormatMap.has(l))throw"reverseFormatMap doesn't have ".concat(l);return this.reverseFormatMap.get(l)},a.prototype.createZXingFormats=function(l){for(var i=[],s=0,u=l;s<u.length;s++){var f=u[s];this.formatMap.has(f)?i.push(this.formatMap.get(f)):this.logger.logError("".concat(f," is not supported by")+"ZXingHtml5QrcodeShim")}return i},a.prototype.createDebugData=function(){return{decoderName:"zxing-js"}},a}(),rm=function(a,l,i,s){function u(f){return f instanceof i?f:new i(function(m){m(f)})}return new(i||(i=Promise))(function(f,m){function p(C){try{x(s.next(C))}catch(y){m(y)}}function _(C){try{x(s.throw(C))}catch(y){m(y)}}function x(C){C.done?f(C.value):u(C.value).then(p,_)}x((s=s.apply(a,l||[])).next())})},im=function(a,l){var i={label:0,sent:function(){if(f[0]&1)throw f[1];return f[1]},trys:[],ops:[]},s,u,f,m;return m={next:p(0),throw:p(1),return:p(2)},typeof Symbol=="function"&&(m[Symbol.iterator]=function(){return this}),m;function p(x){return function(C){return _([x,C])}}function _(x){if(s)throw new TypeError("Generator is already executing.");for(;m&&(m=0,x[0]&&(i=0)),i;)try{if(s=1,u&&(f=x[0]&2?u.return:x[0]?u.throw||((f=u.return)&&f.call(u),0):u.next)&&!(f=f.call(u,x[1])).done)return f;switch(u=0,f&&(x=[x[0]&2,f.value]),x[0]){case 0:case 1:f=x;break;case 4:return i.label++,{value:x[1],done:!1};case 5:i.label++,u=x[1],x=[0];continue;case 7:x=i.ops.pop(),i.trys.pop();continue;default:if(f=i.trys,!(f=f.length>0&&f[f.length-1])&&(x[0]===6||x[0]===2)){i=0;continue}if(x[0]===3&&(!f||x[1]>f[0]&&x[1]<f[3])){i.label=x[1];break}if(x[0]===6&&i.label<f[1]){i.label=f[1],f=x;break}if(f&&i.label<f[2]){i.label=f[2],i.ops.push(x);break}f[2]&&i.ops.pop(),i.trys.pop();continue}x=l.call(a,i)}catch(C){x=[6,C],u=0}finally{s=f=0}if(x[0]&5)throw x[1];return{value:x[0]?x[1]:void 0,done:!0}}},Aa=function(){function a(l,i,s){if(this.formatMap=new Map([[we.QR_CODE,"qr_code"],[we.AZTEC,"aztec"],[we.CODABAR,"codabar"],[we.CODE_39,"code_39"],[we.CODE_93,"code_93"],[we.CODE_128,"code_128"],[we.DATA_MATRIX,"data_matrix"],[we.ITF,"itf"],[we.EAN_13,"ean_13"],[we.EAN_8,"ean_8"],[we.PDF_417,"pdf417"],[we.UPC_A,"upc_a"],[we.UPC_E,"upc_e"]]),this.reverseFormatMap=this.createReverseFormatMap(),!a.isSupported())throw"Use html5qrcode.min.js without edit, Use BarcodeDetectorDelegate only if it isSupported();";this.verbose=i,this.logger=s;var u=this.createBarcodeDetectorFormats(l);if(this.detector=new BarcodeDetector(u),!this.detector)throw"BarcodeDetector detector not supported"}return a.isSupported=function(){if(!("BarcodeDetector"in window))return!1;var l=new BarcodeDetector({formats:["qr_code"]});return typeof l<"u"},a.prototype.decodeAsync=function(l){return rm(this,void 0,void 0,function(){var i,s;return im(this,function(u){switch(u.label){case 0:return[4,this.detector.detect(l)];case 1:if(i=u.sent(),!i||i.length===0)throw"No barcode or QR code detected.";return s=this.selectLargestBarcode(i),[2,{text:s.rawValue,format:Ca.create(this.toHtml5QrcodeSupportedFormats(s.format)),debugData:this.createDebugData()}]}})})},a.prototype.selectLargestBarcode=function(l){for(var i=null,s=0,u=0,f=l;u<f.length;u++){var m=f[u],p=m.boundingBox.width*m.boundingBox.height;p>s&&(s=p,i=m)}if(!i)throw"No largest barcode found";return i},a.prototype.createBarcodeDetectorFormats=function(l){for(var i=[],s=0,u=l;s<u.length;s++){var f=u[s];this.formatMap.has(f)?i.push(this.formatMap.get(f)):this.logger.warn("".concat(f," is not supported by")+"BarcodeDetectorDelegate")}return{formats:i}},a.prototype.toHtml5QrcodeSupportedFormats=function(l){if(!this.reverseFormatMap.has(l))throw"reverseFormatMap doesn't have ".concat(l);return this.reverseFormatMap.get(l)},a.prototype.createReverseFormatMap=function(){var l=new Map;return this.formatMap.forEach(function(i,s,u){l.set(i,s)}),l},a.prototype.createDebugData=function(){return{decoderName:"BarcodeDetector"}},a}(),Sa=function(a,l,i,s){function u(f){return f instanceof i?f:new i(function(m){m(f)})}return new(i||(i=Promise))(function(f,m){function p(C){try{x(s.next(C))}catch(y){m(y)}}function _(C){try{x(s.throw(C))}catch(y){m(y)}}function x(C){C.done?f(C.value):u(C.value).then(p,_)}x((s=s.apply(a,l||[])).next())})},Ia=function(a,l){var i={label:0,sent:function(){if(f[0]&1)throw f[1];return f[1]},trys:[],ops:[]},s,u,f,m;return m={next:p(0),throw:p(1),return:p(2)},typeof Symbol=="function"&&(m[Symbol.iterator]=function(){return this}),m;function p(x){return function(C){return _([x,C])}}function _(x){if(s)throw new TypeError("Generator is already executing.");for(;m&&(m=0,x[0]&&(i=0)),i;)try{if(s=1,u&&(f=x[0]&2?u.return:x[0]?u.throw||((f=u.return)&&f.call(u),0):u.next)&&!(f=f.call(u,x[1])).done)return f;switch(u=0,f&&(x=[x[0]&2,f.value]),x[0]){case 0:case 1:f=x;break;case 4:return i.label++,{value:x[1],done:!1};case 5:i.label++,u=x[1],x=[0];continue;case 7:x=i.ops.pop(),i.trys.pop();continue;default:if(f=i.trys,!(f=f.length>0&&f[f.length-1])&&(x[0]===6||x[0]===2)){i=0;continue}if(x[0]===3&&(!f||x[1]>f[0]&&x[1]<f[3])){i.label=x[1];break}if(x[0]===6&&i.label<f[1]){i.label=f[1],f=x;break}if(f&&i.label<f[2]){i.label=f[2],i.ops.push(x);break}f[2]&&i.ops.pop(),i.trys.pop();continue}x=l.call(a,i)}catch(C){x=[6,C],u=0}finally{s=f=0}if(x[0]&5)throw x[1];return{value:x[0]?x[1]:void 0,done:!0}}},om=function(){function a(l,i,s,u){this.EXECUTIONS_TO_REPORT_PERFORMANCE=100,this.executions=0,this.executionResults=[],this.wasPrimaryDecoderUsedInLastDecode=!1,this.verbose=s,i&&Aa.isSupported()?(this.primaryDecoder=new Aa(l,s,u),this.secondaryDecoder=new ba(l,s,u)):this.primaryDecoder=new ba(l,s,u)}return a.prototype.decodeAsync=function(l){return Sa(this,void 0,void 0,function(){var i;return Ia(this,function(s){switch(s.label){case 0:i=performance.now(),s.label=1;case 1:return s.trys.push([1,,3,4]),[4,this.getDecoder().decodeAsync(l)];case 2:return[2,s.sent()];case 3:return this.possiblyLogPerformance(i),[7];case 4:return[2]}})})},a.prototype.decodeRobustlyAsync=function(l){return Sa(this,void 0,void 0,function(){var i,s;return Ia(this,function(u){switch(u.label){case 0:i=performance.now(),u.label=1;case 1:return u.trys.push([1,3,4,5]),[4,this.primaryDecoder.decodeAsync(l)];case 2:return[2,u.sent()];case 3:if(s=u.sent(),this.secondaryDecoder)return[2,this.secondaryDecoder.decodeAsync(l)];throw s;case 4:return this.possiblyLogPerformance(i),[7];case 5:return[2]}})})},a.prototype.getDecoder=function(){return this.secondaryDecoder?this.wasPrimaryDecoderUsedInLastDecode===!1?(this.wasPrimaryDecoderUsedInLastDecode=!0,this.primaryDecoder):(this.wasPrimaryDecoderUsedInLastDecode=!1,this.secondaryDecoder):this.primaryDecoder},a.prototype.possiblyLogPerformance=function(l){if(this.verbose){var i=performance.now()-l;this.executionResults.push(i),this.executions++,this.possiblyFlushPerformanceReport()}},a.prototype.possiblyFlushPerformanceReport=function(){if(!(this.executions<this.EXECUTIONS_TO_REPORT_PERFORMANCE)){for(var l=0,i=0,s=this.executionResults;i<s.length;i++){var u=s[i];l+=u}var f=l/this.executionResults.length;console.log("".concat(f," ms for ").concat(this.executionResults.length," last runs.")),this.executions=0,this.executionResults=[]}},a}(),Io=function(){var a=function(l,i){return a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(s,u){s.__proto__=u}||function(s,u){for(var f in u)Object.prototype.hasOwnProperty.call(u,f)&&(s[f]=u[f])},a(l,i)};return function(l,i){if(typeof i!="function"&&i!==null)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");a(l,i);function s(){this.constructor=l}l.prototype=i===null?Object.create(i):(s.prototype=i.prototype,new s)}}(),Si=function(a,l,i,s){function u(f){return f instanceof i?f:new i(function(m){m(f)})}return new(i||(i=Promise))(function(f,m){function p(C){try{x(s.next(C))}catch(y){m(y)}}function _(C){try{x(s.throw(C))}catch(y){m(y)}}function x(C){C.done?f(C.value):u(C.value).then(p,_)}x((s=s.apply(a,l||[])).next())})},Ii=function(a,l){var i={label:0,sent:function(){if(f[0]&1)throw f[1];return f[1]},trys:[],ops:[]},s,u,f,m;return m={next:p(0),throw:p(1),return:p(2)},typeof Symbol=="function"&&(m[Symbol.iterator]=function(){return this}),m;function p(x){return function(C){return _([x,C])}}function _(x){if(s)throw new TypeError("Generator is already executing.");for(;m&&(m=0,x[0]&&(i=0)),i;)try{if(s=1,u&&(f=x[0]&2?u.return:x[0]?u.throw||((f=u.return)&&f.call(u),0):u.next)&&!(f=f.call(u,x[1])).done)return f;switch(u=0,f&&(x=[x[0]&2,f.value]),x[0]){case 0:case 1:f=x;break;case 4:return i.label++,{value:x[1],done:!1};case 5:i.label++,u=x[1],x=[0];continue;case 7:x=i.ops.pop(),i.trys.pop();continue;default:if(f=i.trys,!(f=f.length>0&&f[f.length-1])&&(x[0]===6||x[0]===2)){i=0;continue}if(x[0]===3&&(!f||x[1]>f[0]&&x[1]<f[3])){i.label=x[1];break}if(x[0]===6&&i.label<f[1]){i.label=f[1],f=x;break}if(f&&i.label<f[2]){i.label=f[2],i.ops.push(x);break}f[2]&&i.ops.pop(),i.trys.pop();continue}x=l.call(a,i)}catch(C){x=[6,C],u=0}finally{s=f=0}if(x[0]&5)throw x[1];return{value:x[0]?x[1]:void 0,done:!0}}},Na=function(){function a(l,i){this.name=l,this.track=i}return a.prototype.isSupported=function(){return this.track.getCapabilities?this.name in this.track.getCapabilities():!1},a.prototype.apply=function(l){var i={};i[this.name]=l;var s={advanced:[i]};return this.track.applyConstraints(s)},a.prototype.value=function(){var l=this.track.getSettings();if(this.name in l){var i=l[this.name];return i}return null},a}(),sm=function(a){Io(l,a);function l(i,s){return a.call(this,i,s)||this}return l.prototype.min=function(){return this.getCapabilities().min},l.prototype.max=function(){return this.getCapabilities().max},l.prototype.step=function(){return this.getCapabilities().step},l.prototype.apply=function(i){var s={};s[this.name]=i;var u={advanced:[s]};return this.track.applyConstraints(u)},l.prototype.getCapabilities=function(){this.failIfNotSupported();var i=this.track.getCapabilities(),s=i[this.name];return{min:s.min,max:s.max,step:s.step}},l.prototype.failIfNotSupported=function(){if(!this.isSupported())throw new Error("".concat(this.name," capability not supported"))},l}(Na),am=function(a){Io(l,a);function l(i){return a.call(this,"zoom",i)||this}return l}(sm),lm=function(a){Io(l,a);function l(i){return a.call(this,"torch",i)||this}return l}(Na),cm=function(){function a(l){this.track=l}return a.prototype.zoomFeature=function(){return new am(this.track)},a.prototype.torchFeature=function(){return new lm(this.track)},a}(),dm=function(){function a(l,i,s){this.isClosed=!1,this.parentElement=l,this.mediaStream=i,this.callbacks=s,this.surface=this.createVideoElement(this.parentElement.clientWidth),l.append(this.surface)}return a.prototype.createVideoElement=function(l){var i=document.createElement("video");return i.style.width="".concat(l,"px"),i.style.display="block",i.muted=!0,i.setAttribute("muted","true"),i.playsInline=!0,i},a.prototype.setupSurface=function(){var l=this;this.surface.onabort=function(){throw"RenderedCameraImpl video surface onabort() called"},this.surface.onerror=function(){throw"RenderedCameraImpl video surface onerror() called"};var i=function(){var s=l.surface.clientWidth,u=l.surface.clientHeight;l.callbacks.onRenderSurfaceReady(s,u),l.surface.removeEventListener("playing",i)};this.surface.addEventListener("playing",i),this.surface.srcObject=this.mediaStream,this.surface.play()},a.create=function(l,i,s,u){return Si(this,void 0,void 0,function(){var f,m;return Ii(this,function(p){switch(p.label){case 0:return f=new a(l,i,u),s.aspectRatio?(m={aspectRatio:s.aspectRatio},[4,f.getFirstTrackOrFail().applyConstraints(m)]):[3,2];case 1:p.sent(),p.label=2;case 2:return f.setupSurface(),[2,f]}})})},a.prototype.failIfClosed=function(){if(this.isClosed)throw"The RenderedCamera has already been closed."},a.prototype.getFirstTrackOrFail=function(){if(this.failIfClosed(),this.mediaStream.getVideoTracks().length===0)throw"No video tracks found";return this.mediaStream.getVideoTracks()[0]},a.prototype.pause=function(){this.failIfClosed(),this.surface.pause()},a.prototype.resume=function(l){this.failIfClosed();var i=this,s=function(){setTimeout(l,200),i.surface.removeEventListener("playing",s)};this.surface.addEventListener("playing",s),this.surface.play()},a.prototype.isPaused=function(){return this.failIfClosed(),this.surface.paused},a.prototype.getSurface=function(){return this.failIfClosed(),this.surface},a.prototype.getRunningTrackCapabilities=function(){return this.getFirstTrackOrFail().getCapabilities()},a.prototype.getRunningTrackSettings=function(){return this.getFirstTrackOrFail().getSettings()},a.prototype.applyVideoConstraints=function(l){return Si(this,void 0,void 0,function(){return Ii(this,function(i){if("aspectRatio"in l)throw"Changing 'aspectRatio' in run-time is not yet supported.";return[2,this.getFirstTrackOrFail().applyConstraints(l)]})})},a.prototype.close=function(){if(this.isClosed)return Promise.resolve();var l=this;return new Promise(function(i,s){var u=l.mediaStream.getVideoTracks(),f=u.length,m=0;l.mediaStream.getVideoTracks().forEach(function(p){l.mediaStream.removeTrack(p),p.stop(),++m,m>=f&&(l.isClosed=!0,l.parentElement.removeChild(l.surface),i())})})},a.prototype.getCapabilities=function(){return new cm(this.getFirstTrackOrFail())},a}(),um=function(){function a(l){this.mediaStream=l}return a.prototype.render=function(l,i,s){return Si(this,void 0,void 0,function(){return Ii(this,function(u){return[2,dm.create(l,this.mediaStream,i,s)]})})},a.create=function(l){return Si(this,void 0,void 0,function(){var i,s;return Ii(this,function(u){switch(u.label){case 0:if(!navigator.mediaDevices)throw"navigator.mediaDevices not supported";return i={audio:!1,video:l},[4,navigator.mediaDevices.getUserMedia(i)];case 1:return s=u.sent(),[2,new a(s)]}})})},a}(),Ta=function(a,l,i,s){function u(f){return f instanceof i?f:new i(function(m){m(f)})}return new(i||(i=Promise))(function(f,m){function p(C){try{x(s.next(C))}catch(y){m(y)}}function _(C){try{x(s.throw(C))}catch(y){m(y)}}function x(C){C.done?f(C.value):u(C.value).then(p,_)}x((s=s.apply(a,l||[])).next())})},ka=function(a,l){var i={label:0,sent:function(){if(f[0]&1)throw f[1];return f[1]},trys:[],ops:[]},s,u,f,m;return m={next:p(0),throw:p(1),return:p(2)},typeof Symbol=="function"&&(m[Symbol.iterator]=function(){return this}),m;function p(x){return function(C){return _([x,C])}}function _(x){if(s)throw new TypeError("Generator is already executing.");for(;m&&(m=0,x[0]&&(i=0)),i;)try{if(s=1,u&&(f=x[0]&2?u.return:x[0]?u.throw||((f=u.return)&&f.call(u),0):u.next)&&!(f=f.call(u,x[1])).done)return f;switch(u=0,f&&(x=[x[0]&2,f.value]),x[0]){case 0:case 1:f=x;break;case 4:return i.label++,{value:x[1],done:!1};case 5:i.label++,u=x[1],x=[0];continue;case 7:x=i.ops.pop(),i.trys.pop();continue;default:if(f=i.trys,!(f=f.length>0&&f[f.length-1])&&(x[0]===6||x[0]===2)){i=0;continue}if(x[0]===3&&(!f||x[1]>f[0]&&x[1]<f[3])){i.label=x[1];break}if(x[0]===6&&i.label<f[1]){i.label=f[1],f=x;break}if(f&&i.label<f[2]){i.label=f[2],i.ops.push(x);break}f[2]&&i.ops.pop(),i.trys.pop();continue}x=l.call(a,i)}catch(C){x=[6,C],u=0}finally{s=f=0}if(x[0]&5)throw x[1];return{value:x[0]?x[1]:void 0,done:!0}}},fm=function(){function a(){}return a.failIfNotSupported=function(){return Ta(this,void 0,void 0,function(){return ka(this,function(l){if(!navigator.mediaDevices)throw"navigator.mediaDevices not supported";return[2,new a]})})},a.prototype.create=function(l){return Ta(this,void 0,void 0,function(){return ka(this,function(i){return[2,um.create(l)]})})},a}(),hm=function(a,l,i,s){function u(f){return f instanceof i?f:new i(function(m){m(f)})}return new(i||(i=Promise))(function(f,m){function p(C){try{x(s.next(C))}catch(y){m(y)}}function _(C){try{x(s.throw(C))}catch(y){m(y)}}function x(C){C.done?f(C.value):u(C.value).then(p,_)}x((s=s.apply(a,l||[])).next())})},mm=function(a,l){var i={label:0,sent:function(){if(f[0]&1)throw f[1];return f[1]},trys:[],ops:[]},s,u,f,m;return m={next:p(0),throw:p(1),return:p(2)},typeof Symbol=="function"&&(m[Symbol.iterator]=function(){return this}),m;function p(x){return function(C){return _([x,C])}}function _(x){if(s)throw new TypeError("Generator is already executing.");for(;m&&(m=0,x[0]&&(i=0)),i;)try{if(s=1,u&&(f=x[0]&2?u.return:x[0]?u.throw||((f=u.return)&&f.call(u),0):u.next)&&!(f=f.call(u,x[1])).done)return f;switch(u=0,f&&(x=[x[0]&2,f.value]),x[0]){case 0:case 1:f=x;break;case 4:return i.label++,{value:x[1],done:!1};case 5:i.label++,u=x[1],x=[0];continue;case 7:x=i.ops.pop(),i.trys.pop();continue;default:if(f=i.trys,!(f=f.length>0&&f[f.length-1])&&(x[0]===6||x[0]===2)){i=0;continue}if(x[0]===3&&(!f||x[1]>f[0]&&x[1]<f[3])){i.label=x[1];break}if(x[0]===6&&i.label<f[1]){i.label=f[1],f=x;break}if(f&&i.label<f[2]){i.label=f[2],i.ops.push(x);break}f[2]&&i.ops.pop(),i.trys.pop();continue}x=l.call(a,i)}catch(C){x=[6,C],u=0}finally{s=f=0}if(x[0]&5)throw x[1];return{value:x[0]?x[1]:void 0,done:!0}}},gm=function(){function a(){}return a.retrieve=function(){if(navigator.mediaDevices)return a.getCamerasFromMediaDevices();var l=MediaStreamTrack;return MediaStreamTrack&&l.getSources?a.getCamerasFromMediaStreamTrack():a.rejectWithError()},a.rejectWithError=function(){var l=Er.unableToQuerySupportedDevices();return a.isHttpsOrLocalhost()||(l=Er.insecureContextCameraQueryError()),Promise.reject(l)},a.isHttpsOrLocalhost=function(){if(location.protocol==="https:")return!0;var l=location.host.split(":")[0];return l==="127.0.0.1"||l==="localhost"},a.getCamerasFromMediaDevices=function(){return hm(this,void 0,void 0,function(){var l,i,s,u,f,m,p;return mm(this,function(_){switch(_.label){case 0:return l=function(x){for(var C=x.getVideoTracks(),y=0,I=C;y<I.length;y++){var O=I[y];O.enabled=!1,O.stop(),x.removeTrack(O)}},[4,navigator.mediaDevices.getUserMedia({audio:!1,video:!0})];case 1:return i=_.sent(),[4,navigator.mediaDevices.enumerateDevices()];case 2:for(s=_.sent(),u=[],f=0,m=s;f<m.length;f++)p=m[f],p.kind==="videoinput"&&u.push({id:p.deviceId,label:p.label});return l(i),[2,u]}})})},a.getCamerasFromMediaStreamTrack=function(){return new Promise(function(l,i){var s=function(f){for(var m=[],p=0,_=f;p<_.length;p++){var x=_[p];x.kind==="video"&&m.push({id:x.id,label:x.label})}l(m)},u=MediaStreamTrack;u.getSources(s)})},a}(),It;(function(a){a[a.UNKNOWN=0]="UNKNOWN",a[a.NOT_STARTED=1]="NOT_STARTED",a[a.SCANNING=2]="SCANNING",a[a.PAUSED=3]="PAUSED"})(It||(It={}));var pm=function(){function a(){this.state=It.NOT_STARTED,this.onGoingTransactionNewState=It.UNKNOWN}return a.prototype.directTransition=function(l){this.failIfTransitionOngoing(),this.validateTransition(l),this.state=l},a.prototype.startTransition=function(l){return this.failIfTransitionOngoing(),this.validateTransition(l),this.onGoingTransactionNewState=l,this},a.prototype.execute=function(){if(this.onGoingTransactionNewState===It.UNKNOWN)throw"Transaction is already cancelled, cannot execute().";var l=this.onGoingTransactionNewState;this.onGoingTransactionNewState=It.UNKNOWN,this.directTransition(l)},a.prototype.cancel=function(){if(this.onGoingTransactionNewState===It.UNKNOWN)throw"Transaction is already cancelled, cannot cancel().";this.onGoingTransactionNewState=It.UNKNOWN},a.prototype.getState=function(){return this.state},a.prototype.failIfTransitionOngoing=function(){if(this.onGoingTransactionNewState!==It.UNKNOWN)throw"Cannot transition to a new state, already under transition"},a.prototype.validateTransition=function(l){switch(this.state){case It.UNKNOWN:throw"Transition from unknown is not allowed";case It.NOT_STARTED:this.failIfNewStateIs(l,[It.PAUSED]);break;case It.SCANNING:break;case It.PAUSED:break}},a.prototype.failIfNewStateIs=function(l,i){for(var s=0,u=i;s<u.length;s++){var f=u[s];if(l===f)throw"Cannot transition from ".concat(this.state," to ").concat(l)}},a}(),xm=function(){function a(l){this.stateManager=l}return a.prototype.startTransition=function(l){return this.stateManager.startTransition(l)},a.prototype.directTransition=function(l){this.stateManager.directTransition(l)},a.prototype.getState=function(){return this.stateManager.getState()},a.prototype.canScanFile=function(){return this.stateManager.getState()===It.NOT_STARTED},a.prototype.isScanning=function(){return this.stateManager.getState()!==It.NOT_STARTED},a.prototype.isStrictlyScanning=function(){return this.stateManager.getState()===It.SCANNING},a.prototype.isPaused=function(){return this.stateManager.getState()===It.PAUSED},a}(),_m=function(){function a(){}return a.create=function(){return new xm(new pm)},a}(),wm=function(){var a=function(l,i){return a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(s,u){s.__proto__=u}||function(s,u){for(var f in u)Object.prototype.hasOwnProperty.call(u,f)&&(s[f]=u[f])},a(l,i)};return function(l,i){if(typeof i!="function"&&i!==null)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");a(l,i);function s(){this.constructor=l}l.prototype=i===null?Object.create(i):(s.prototype=i.prototype,new s)}}(),cn=function(a){wm(l,a);function l(){return a!==null&&a.apply(this,arguments)||this}return l.DEFAULT_WIDTH=300,l.DEFAULT_WIDTH_OFFSET=2,l.FILE_SCAN_MIN_HEIGHT=300,l.FILE_SCAN_HIDDEN_CANVAS_PADDING=100,l.MIN_QR_BOX_SIZE=50,l.SHADED_LEFT=1,l.SHADED_RIGHT=2,l.SHADED_TOP=3,l.SHADED_BOTTOM=4,l.SHADED_REGION_ELEMENT_ID="qr-shaded-region",l.VERBOSE=!1,l.BORDER_SHADER_DEFAULT_COLOR="#ffffff",l.BORDER_SHADER_MATCH_COLOR="rgb(90, 193, 56)",l}(J2),Cm=function(){function a(l,i){this.logger=i,this.fps=cn.SCAN_DEFAULT_FPS,l?(l.fps&&(this.fps=l.fps),this.disableFlip=l.disableFlip===!0,this.qrbox=l.qrbox,this.aspectRatio=l.aspectRatio,this.videoConstraints=l.videoConstraints):this.disableFlip=cn.DEFAULT_DISABLE_FLIP}return a.prototype.isMediaStreamConstraintsValid=function(){return this.videoConstraints?ya.isMediaStreamConstraintsValid(this.videoConstraints,this.logger):(this.logger.logError("Empty videoConstraints",!0),!1)},a.prototype.isShadedBoxEnabled=function(){return!Un(this.qrbox)},a.create=function(l,i){return new a(l,i)},a}(),Ra=function(){function a(l,i){if(this.element=null,this.canvasElement=null,this.scannerPausedUiElement=null,this.hasBorderShaders=null,this.borderShaders=null,this.qrMatch=null,this.renderedCamera=null,this.qrRegion=null,this.context=null,this.lastScanImageFile=null,this.isScanning=!1,!document.getElementById(l))throw"HTML Element with id=".concat(l," not found");this.elementId=l,this.verbose=!1;var s;typeof i=="boolean"?this.verbose=i===!0:i&&(s=i,this.verbose=s.verbose===!0,s.experimentalFeatures),this.logger=new tm(this.verbose),this.qrcode=new om(this.getSupportedFormats(i),this.getUseBarCodeDetectorIfSupported(s),this.verbose,this.logger),this.foreverScanTimeout,this.shouldScan=!0,this.stateManagerProxy=_m.create()}return a.prototype.start=function(l,i,s,u){var f=this;if(!l)throw"cameraIdOrConfig is required";if(!s||typeof s!="function")throw"qrCodeSuccessCallback is required and should be a function.";var m;u?m=u:m=this.verbose?this.logger.log:function(){};var p=Cm.create(i,this.logger);this.clearElement();var _=!1;p.videoConstraints&&(p.isMediaStreamConstraintsValid()?_=!0:this.logger.logError("'videoConstraints' is not valid 'MediaStreamConstraints, it will be ignored.'",!0));var x=_,C=document.getElementById(this.elementId);C.clientWidth?C.clientWidth:cn.DEFAULT_WIDTH,C.style.position="relative",this.shouldScan=!0,this.element=C;var y=this,I=this.stateManagerProxy.startTransition(It.SCANNING);return new Promise(function(O,N){var v=x?p.videoConstraints:y.createVideoConstraints(l);if(!v){I.cancel(),N("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,s,m)}};fm.failIfNotSupported().then(function(D){D.create(v).then(function(M){return M.render(f.element,k,P).then(function(q){y.renderedCamera=q,I.execute(),O(null)}).catch(function(q){I.cancel(),N(q)})}).catch(function(M){I.cancel(),N(Er.errorGettingUserMedia(M))})}).catch(function(D){I.cancel(),N(Er.cameraStreamingNotSupported())})})},a.prototype.pause=function(l){if(!this.stateManagerProxy.isStrictlyScanning())throw"Cannot pause, scanner is not scanning.";this.stateManagerProxy.directTransition(It.PAUSED),this.showPausedState(),(Un(l)||l!==!0)&&(l=!1),l&&this.renderedCamera&&this.renderedCamera.pause()},a.prototype.resume=function(){if(!this.stateManagerProxy.isPaused())throw"Cannot result, scanner is not paused.";if(!this.renderedCamera)throw"renderedCamera doesn't exist while trying resume()";var l=this,i=function(){l.stateManagerProxy.directTransition(It.SCANNING),l.hidePausedState()};if(!this.renderedCamera.isPaused()){i();return}this.renderedCamera.resume(function(){i()})},a.prototype.getState=function(){return this.stateManagerProxy.getState()},a.prototype.stop=function(){var l=this;if(!this.stateManagerProxy.isScanning())throw"Cannot stop, scanner is not running or paused.";var i=this.stateManagerProxy.startTransition(It.NOT_STARTED);this.shouldScan=!1,this.foreverScanTimeout&&clearTimeout(this.foreverScanTimeout);var s=function(){if(l.element){var f=document.getElementById(cn.SHADED_REGION_ELEMENT_ID);f&&l.element.removeChild(f)}},u=this;return this.renderedCamera.close().then(function(){return u.renderedCamera=null,u.element&&(u.element.removeChild(u.canvasElement),u.canvasElement=null),s(),u.qrRegion&&(u.qrRegion=null),u.context&&(u.context=null),i.execute(),u.hidePausedState(),u.isScanning=!1,Promise.resolve()})},a.prototype.scanFile=function(l,i){return this.scanFileV2(l,i).then(function(s){return s.decodedText})},a.prototype.scanFileV2=function(l,i){var s=this;if(!l||!(l instanceof File))throw"imageFile argument is mandatory and should be instance of File. Use 'event.target.files[0]'.";if(Un(i)&&(i=!0),!this.stateManagerProxy.canScanFile())throw"Cannot start file scan - ongoing camera scan";return new Promise(function(u,f){s.possiblyCloseLastScanImageFile(),s.clearElement(),s.lastScanImageFile=URL.createObjectURL(l);var m=new Image;m.onload=function(){var p=m.width,_=m.height,x=document.getElementById(s.elementId),C=x.clientWidth?x.clientWidth:cn.DEFAULT_WIDTH,y=Math.max(x.clientHeight?x.clientHeight:_,cn.FILE_SCAN_MIN_HEIGHT),I=s.computeCanvasDrawConfig(p,_,C,y);if(i){var O=s.createCanvasElement(C,y,"qr-canvas-visible");O.style.display="inline-block",x.appendChild(O);var N=O.getContext("2d");if(!N)throw"Unable to get 2d context from canvas";N.canvas.width=C,N.canvas.height=y,N.drawImage(m,0,0,p,_,I.x,I.y,I.width,I.height)}var v=cn.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,q=s.createCanvasElement(D,M);x.appendChild(q);var W=q.getContext("2d");if(!W)throw"Unable to get 2d context from canvas";W.canvas.width=D,W.canvas.height=M,W.drawImage(m,0,0,p,_,v,v,k,P);try{s.qrcode.decodeRobustlyAsync(q).then(function(Y){u(Ea.createFromQrcodeResult(Y))}).catch(f)}catch(Y){f("QR code parse error, error = ".concat(Y))}},m.onerror=f,m.onabort=f,m.onstalled=f,m.onsuspend=f,m.src=URL.createObjectURL(l)})},a.prototype.clear=function(){this.clearElement()},a.getCameras=function(){return gm.retrieve()},a.prototype.getRunningTrackCapabilities=function(){return this.getRenderedCameraOrFail().getRunningTrackCapabilities()},a.prototype.getRunningTrackSettings=function(){return this.getRenderedCameraOrFail().getRunningTrackSettings()},a.prototype.getRunningTrackCameraCapabilities=function(){return this.getRenderedCameraOrFail().getCapabilities()},a.prototype.applyVideoConstraints=function(l){if(l){if(!ya.isMediaStreamConstraintsValid(l,this.logger))throw"invalid videoConstaints passed, check logs for more details"}else throw"videoConstaints is required argument.";return this.getRenderedCameraOrFail().applyVideoConstraints(l)},a.prototype.getRenderedCameraOrFail=function(){if(this.renderedCamera==null)throw"Scanning is not in running state, call this API only when QR code scanning using camera is in running state.";return this.renderedCamera},a.prototype.getSupportedFormats=function(l){var i=[we.QR_CODE,we.AZTEC,we.CODABAR,we.CODE_39,we.CODE_93,we.CODE_128,we.DATA_MATRIX,we.MAXICODE,we.ITF,we.EAN_13,we.EAN_8,we.PDF_417,we.RSS_14,we.RSS_EXPANDED,we.UPC_A,we.UPC_E,we.UPC_EAN_EXTENSION];if(!l||typeof l=="boolean"||!l.formatsToSupport)return i;if(!Array.isArray(l.formatsToSupport))throw"configOrVerbosityFlag.formatsToSupport should be undefined or an array.";if(l.formatsToSupport.length===0)throw"Atleast 1 formatsToSupport is needed.";for(var s=[],u=0,f=l.formatsToSupport;u<f.length;u++){var m=f[u];Q2(m)?s.push(m):this.logger.warn("Invalid format: ".concat(m," passed in config, ignoring."))}if(s.length===0)throw"None of formatsToSupport match supported values.";return s},a.prototype.getUseBarCodeDetectorIfSupported=function(l){if(Un(l))return!0;if(!Un(l.useBarCodeDetectorIfSupported))return l.useBarCodeDetectorIfSupported!==!1;if(Un(l.experimentalFeatures))return!0;var i=l.experimentalFeatures;return Un(i.useBarCodeDetectorIfSupported)?!0:i.useBarCodeDetectorIfSupported!==!1},a.prototype.validateQrboxSize=function(l,i,s){var u=this,f=s.qrbox;this.validateQrboxConfig(f);var m=this.toQrdimensions(l,i,f),p=function(x){if(x<cn.MIN_QR_BOX_SIZE)throw"minimum size of 'config.qrbox' dimension value is"+" ".concat(cn.MIN_QR_BOX_SIZE,"px.")},_=function(x){return x>l&&(u.logger.warn("`qrbox.width` or `qrbox` is larger than the width of the root element. The width will be truncated to the width of root element."),x=l),x};p(m.width),p(m.height),m.width=_(m.width)},a.prototype.validateQrboxConfig=function(l){if(typeof l!="number"&&typeof l!="function"&&(l.width===void 0||l.height===void 0))throw"Invalid instance of QrDimensions passed for 'config.qrbox'. Both 'width' and 'height' should be set."},a.prototype.toQrdimensions=function(l,i,s){if(typeof s=="number")return{width:s,height:s};if(typeof s=="function")try{return s(l,i)}catch(u){throw new Error("qrbox config was passed as a function but it failed with unknown error"+u)}return s},a.prototype.setupUi=function(l,i,s){s.isShadedBoxEnabled()&&this.validateQrboxSize(l,i,s);var u=Un(s.qrbox)?{width:l,height:i}:s.qrbox;this.validateQrboxConfig(u);var f=this.toQrdimensions(l,i,u);f.height>i&&this.logger.warn("[Html5Qrcode] config.qrbox has height that isgreater than the height of the video stream. Shading will be ignored");var m=s.isShadedBoxEnabled()&&f.height<=i,p={x:0,y:0,width:l,height:i},_=m?this.getShadedRegionBounds(l,i,f):p,x=this.createCanvasElement(_.width,_.height),C={willReadFrequently:!0},y=x.getContext("2d",C);y.canvas.width=_.width,y.canvas.height=_.height,this.element.append(x),m&&this.possiblyInsertShadingElement(this.element,l,i,f),this.createScannerPausedUiElement(this.element),this.qrRegion=_,this.context=y,this.canvasElement=x},a.prototype.createScannerPausedUiElement=function(l){var i=document.createElement("div");i.innerText=Er.scannerPaused(),i.style.display="none",i.style.position="absolute",i.style.top="0px",i.style.zIndex="1",i.style.background="rgba(9, 9, 9, 0.46)",i.style.color="#FFECEC",i.style.textAlign="center",i.style.width="100%",l.appendChild(i),this.scannerPausedUiElement=i},a.prototype.scanContext=function(l,i){var s=this;return this.stateManagerProxy.isPaused()?Promise.resolve(!1):this.qrcode.decodeAsync(this.canvasElement).then(function(u){return l(u.text,Ea.createFromQrcodeResult(u)),s.possiblyUpdateShaders(!0),!0}).catch(function(u){s.possiblyUpdateShaders(!1);var f=Er.codeParseError(u);return i(f,em.createFrom(f)),!1})},a.prototype.foreverScan=function(l,i,s){var u=this;if(this.shouldScan&&this.renderedCamera){var f=this.renderedCamera.getSurface(),m=f.videoWidth/f.clientWidth,p=f.videoHeight/f.clientHeight;if(!this.qrRegion)throw"qrRegion undefined when localMediaStream is ready.";var _=this.qrRegion.width*m,x=this.qrRegion.height*p,C=this.qrRegion.x*m,y=this.qrRegion.y*p;this.context.drawImage(f,C,y,_,x,0,0,this.qrRegion.width,this.qrRegion.height);var I=function(){u.foreverScanTimeout=setTimeout(function(){u.foreverScan(l,i,s)},u.getTimeoutFps(l.fps))};this.scanContext(i,s).then(function(O){!O&&l.disableFlip!==!0?(u.context.translate(u.context.canvas.width,0),u.context.scale(-1,1),u.scanContext(i,s).finally(function(){I()})):I()}).catch(function(O){u.logger.logError("Error happend while scanning context",O),I()})}},a.prototype.createVideoConstraints=function(l){if(typeof l=="string")return{deviceId:{exact:l}};if(typeof l=="object"){var i="facingMode",s="deviceId",u={user:!0,environment:!0},f="exact",m=function(N){if(N in u)return!0;throw"config has invalid 'facingMode' value = "+"'".concat(N,"'")},p=Object.keys(l);if(p.length!==1)throw"'cameraIdOrConfig' object should have exactly 1 key,"+" if passed as an object, found ".concat(p.length," keys");var _=Object.keys(l)[0];if(_!==i&&_!==s)throw"Only '".concat(i,"' and '").concat(s,"' ")+" are supported for 'cameraIdOrConfig'";if(_===i){var x=l.facingMode;if(typeof x=="string"){if(m(x))return{facingMode:x}}else if(typeof x=="object")if(f in x){if(m(x["".concat(f)]))return{facingMode:{exact:x["".concat(f)]}}}else throw"'facingMode' should be string or object with"+" ".concat(f," as key.");else{var C=typeof x;throw"Invalid type of 'facingMode' = ".concat(C)}}else{var y=l.deviceId;if(typeof y=="string")return{deviceId:y};if(typeof y=="object"){if(f in y)return{deviceId:{exact:y["".concat(f)]}};throw"'deviceId' should be string or object with"+" ".concat(f," as key.")}else{var I=typeof y;throw"Invalid type of 'deviceId' = ".concat(I)}}}var O=typeof l;throw"Invalid type of 'cameraIdOrConfig' = ".concat(O)},a.prototype.computeCanvasDrawConfig=function(l,i,s,u){if(l<=s&&i<=u){var f=(s-l)/2,m=(u-i)/2;return{x:f,y:m,width:l,height:i}}else{var p=l,_=i;return l>s&&(i=s/l*i,l=s),i>u&&(l=u/i*l,i=u),this.logger.log("Image downsampled from "+"".concat(p,"X").concat(_)+" to ".concat(l,"X").concat(i,".")),this.computeCanvasDrawConfig(l,i,s,u)}},a.prototype.clearElement=function(){if(this.stateManagerProxy.isScanning())throw"Cannot clear while scan is ongoing, close it first.";var l=document.getElementById(this.elementId);l&&(l.innerHTML="")},a.prototype.possiblyUpdateShaders=function(l){this.qrMatch!==l&&(this.hasBorderShaders&&this.borderShaders&&this.borderShaders.length&&this.borderShaders.forEach(function(i){i.style.backgroundColor=l?cn.BORDER_SHADER_MATCH_COLOR:cn.BORDER_SHADER_DEFAULT_COLOR}),this.qrMatch=l)},a.prototype.possiblyCloseLastScanImageFile=function(){this.lastScanImageFile&&(URL.revokeObjectURL(this.lastScanImageFile),this.lastScanImageFile=null)},a.prototype.createCanvasElement=function(l,i,s){var u=l,f=i,m=document.createElement("canvas");return m.style.width="".concat(u,"px"),m.style.height="".concat(f,"px"),m.style.display="none",m.id=Un(s)?"qr-canvas":s,m},a.prototype.getShadedRegionBounds=function(l,i,s){if(s.width>l||s.height>i)throw"'config.qrbox' dimensions should not be greater than the dimensions of the root HTML element.";return{x:(l-s.width)/2,y:(i-s.height)/2,width:s.width,height:s.height}},a.prototype.possiblyInsertShadingElement=function(l,i,s,u){if(!(i-u.width<1||s-u.height<1)){var f=document.createElement("div");f.style.position="absolute";var m=(i-u.width)/2,p=(s-u.height)/2;if(f.style.borderLeft="".concat(m,"px solid rgba(0, 0, 0, 0.48)"),f.style.borderRight="".concat(m,"px solid rgba(0, 0, 0, 0.48)"),f.style.borderTop="".concat(p,"px solid rgba(0, 0, 0, 0.48)"),f.style.borderBottom="".concat(p,"px solid rgba(0, 0, 0, 0.48)"),f.style.boxSizing="border-box",f.style.top="0px",f.style.bottom="0px",f.style.left="0px",f.style.right="0px",f.id="".concat(cn.SHADED_REGION_ELEMENT_ID),i-u.width<11||s-u.height<11)this.hasBorderShaders=!1;else{var _=5,x=40;this.insertShaderBorders(f,x,_,-_,null,0,!0),this.insertShaderBorders(f,x,_,-_,null,0,!1),this.insertShaderBorders(f,x,_,null,-_,0,!0),this.insertShaderBorders(f,x,_,null,-_,0,!1),this.insertShaderBorders(f,_,x+_,-_,null,-_,!0),this.insertShaderBorders(f,_,x+_,null,-_,-_,!0),this.insertShaderBorders(f,_,x+_,-_,null,-_,!1),this.insertShaderBorders(f,_,x+_,null,-_,-_,!1),this.hasBorderShaders=!0}l.append(f)}},a.prototype.insertShaderBorders=function(l,i,s,u,f,m,p){var _=document.createElement("div");_.style.position="absolute",_.style.backgroundColor=cn.BORDER_SHADER_DEFAULT_COLOR,_.style.width="".concat(i,"px"),_.style.height="".concat(s,"px"),u!==null&&(_.style.top="".concat(u,"px")),f!==null&&(_.style.bottom="".concat(f,"px")),p?_.style.left="".concat(m,"px"):_.style.right="".concat(m,"px"),this.borderShaders||(this.borderShaders=[]),this.borderShaders.push(_),l.appendChild(_)},a.prototype.showPausedState=function(){if(!this.scannerPausedUiElement)throw"[internal error] scanner paused UI element not found";this.scannerPausedUiElement.style.display="block"},a.prototype.hidePausedState=function(){if(!this.scannerPausedUiElement)throw"[internal error] scanner paused UI element not found";this.scannerPausedUiElement.style.display="none"},a.prototype.getTimeoutFps=function(l){return 1e3/l},a}(),Ba;(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"})(Ba||(Ba={}));const Em={width:"38",height:"38",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"none"},ym=["stroke"],bm=["stroke"],Am=["stroke"],Sm=["stroke"],Im=["stroke"],Nm=r.defineComponent({__name:"QR",props:{color:{type:String,required:!1,default:"#FFFFFF"}},setup(a){return(l,i)=>(r.openBlock(),r.createElementBlock("svg",Em,[r.createElementVNode("path",{d:"M11 11H7V7h4ZM17 7h-2v2h2ZM13 17h4v-4h-4ZM7 17h2v-2H7Z",stroke:a.color,"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"1.5"},null,8,ym),r.createElementVNode("path",{d:"M8 3H4a1 1 0 0 0-1 1V8",stroke:a.color,"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"1.5"},null,8,bm),r.createElementVNode("path",{d:"M21 8V4a1 1 0 0 0-1-1H16",stroke:a.color,"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"1.5"},null,8,Am),r.createElementVNode("path",{d:"M3 16v4a1 1 0 0 0 1 1H8",stroke:a.color,"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"1.5"},null,8,Sm),r.createElementVNode("path",{d:"M16 21h4a1 1 0 0 0 1-1V16",stroke:a.color,"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"1.5"},null,8,Im)]))}}),No={back:["Задняя","Задней","Зад","e pasme","rear","back","atzekoa","задні","отзад","pozadi","cefn","hátulsó","traseira","achterkant","όπισθεν","bag","דערציען","cúil","aftan","trasero","posteriore","posterior","aizmugure","galinis","задниот дел","wara","hinteren","bak","tył","tyl","traseira","spate","задњи","zadný","zadaj","задній","takaosa","arrière","straga","zadní","bak","tagumine","environment","arxa","թիկունք","পিছনে","နောက်ဘက်","ở phía sau","უკანა","પાછળ","артқы","ಹಿಂದಿನ","後部","后部","뒤쪽","ខាងក្រោយ","ຫລັງ","പുറകിലുള്ള","मागील","арын","पछाडि","පසුපස","пушти","หลัง","பின்புறம்","వెనుక","arka","orqa","پیچھے","पिछला","qab","後方","مؤخرة","חלק אחורי","عقب","agter","ngemuva","azụ","leyin","kamorao","gadaale","nyuma","baya","kumbuyo","belakang","aoriana","belakang","muri","luyo","likuran","mburi","dèyè","tergo","malantaŭo"],front:["FaceTime","Передняя","përpara","front","aurrean","пярэдні","отпред","front","blaen","elülső","diante","voorkant","εμπρός","foran","פראָנט","tosaigh","framan","frente","davanti","davant","priekšā","priekyje","напред","quddiem","Vorderseite","front","przód","frente","față","фронт","vpredu","spredaj","перед","edessä","devant","ispred","přední","främre","ees","ön","ճակատ","সামনে","ရှေ့","đằng trước","წინა","આગળ","алдыңғы","ಮುಂಭಾಗ","正面","正面","앞쪽","ខាងមុខ","ດ້ານໜ້າ","മുന്നിൽ","समोर","урд","अगाडि","ඉදිරිපස","пеш","ด้านหน้า","முன்","ముందు","ön","old","سامنے","सामने","pem hauv ntej","フロント","أمام","חֲזִית","جلو","voor","ngaphambili","n'ihu","iwaju","ka pele","hore","mbele","gaba","kutsogolo","depan","anoloana","hadapan","mua","atubangan","harap","ngarep","devan","front","fronto"]},Tm={key:0,class:"qr_text"},km=r.defineComponent({__name:"QrCameraScanner",props:{axiosInstanceGet:{type:[Function,Object]},is_toggleAffiliation:{type:Boolean},is_notification:{type:Boolean},notificationData:{},isQr:{type:[Boolean,null]},takeDataTable:{type:Function}},emits:["update:notificationData","update:is_notification","update:is_toggleAffiliation"],setup(a,{emit:l}){const i=a;let s=null;const u=r.ref(!1),f=r.ref(!1),m=r.ref(!1),p=r.ref(!1);let _=null;const x=St(),{itemThemes:C}=_e.storeToRefs(x),y=l,I=P=>P.replace(/^[\s\S]*?((?:tel|sms|smsto|mailto|callto|facetime|viber|whatsapp):)?[\s\S]*?(%2B)?[\s\S]*?/i,(D,M,q)=>q?"+":""),O=async(P,D)=>{var Y,F,L;if(console.log(P,D),p.value)return;i.isQr||(p.value=!0),k();const M=/[?&]table_id=([a-zA-Z0-9-]+)/,q=P.match(M),W=P.match(/\/([a-f0-9\-]{36})\?/);if(i.isQr){if(q&&W)return(Y=i.takeDataTable)==null?void 0:Y.call(i,W[1],q[1],"qr");{const V=localStorage.getItem("orgID");if(V){const ie=await i.axiosInstanceGet.get(`org_unit/${V}/table`,{params:{external_link:P}}).then(Q=>{var te,G;return((te=Q.data)==null?void 0:te.length)>0?(G=Q.data[0])==null?void 0:G.id:null}).catch(()=>null);if(ie)return(F=i.takeDataTable)==null?void 0:F.call(i,V,ie)}}y("update:is_notification",!0),y("update:notificationData",{textNotification:"Стол не найден"}),y("update:is_toggleAffiliation",!0)}else{const V=new yn,ie=P||D.text,Q=I(ie);try{await V.authorizeByCard(Q);const te=await V.getProfile();y("update:is_notification",!0),y("update:notificationData",{textNotification:`Здравствуйте, ${te.first_name}
31
+ Баланс: ${te.balance}`})}catch(te){y("update:is_notification",!0),y("update:notificationData",{textNotification:((L=te.response)==null?void 0:L.user_friendly_message)||"Карта не найдена"})}finally{m.value=!0,_&&clearTimeout(_),_=setTimeout(()=>{m.value=!1},2e3),p.value=!1}}};window.debugScan=O;const N=()=>{},v=async()=>{if(!(u.value||s!=null&&s.isScanning||m.value))try{u.value=!0;try{(await navigator.mediaDevices.getUserMedia({video:!0})).getTracks().forEach(Y=>Y.stop())}catch{y("update:is_notification",!0),y("update:notificationData",{textNotification:"Разрешите доступ к камере"}),u.value=!1,y("update:is_toggleAffiliation",!0);return}s=new Ra("reader");const P=await Ra.getCameras();if(!P||P.length===0){console.error("Камеры не найдены"),u.value=!1;return}let D;if(i.isQr)D=P.find(W=>No.back.some(Y=>new RegExp(Y,"i").test(W.label))),D||(D=P.find(W=>No.front.some(Y=>new RegExp(Y,"i").test(W.label))));else if(D=P.find(W=>No.front.some(Y=>new RegExp(Y,"i").test(W.label))),D||(D=P.find(W=>new RegExp("amera","i").test(W.label))),!D){y("update:is_notification",!0),y("update:notificationData",{textNotification:"Не найдена фронтальная камера. Для сканирования карт нужна фронтальная камера."}),u.value=!1,y("update:is_toggleAffiliation",!0);return}const M=i.isQr?[we.QR_CODE]:[we.QR_CODE,we.PDF_417,we.EAN_13,we.EAN_8,we.CODE_128],q={fps:60,qrbox:{width:320,height:500}};await s.start(D.id,q,O,N,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(s&&s.isScanning)try{await s.stop(),u.value=!1,s=null}catch(P){console.error("Ошибка остановки камеры:",P)}else u.value=!1,s=null,y("update:is_toggleAffiliation",!0);f.value=!1};return r.onUnmounted(()=>{u.value&&k(),_&&(clearTimeout(_),_=null),p.value=!1,m.value=!1,f.value=!1}),(P,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",Tm,"Наведите QR на камеру")):r.createCommentVNode("",!0)],512),[[r.vShow,u.value]])])),r.createVNode(Nm,{color:a.isQr?void 0:"#FFFFFF",onClick:v},null,8,["color"])]))}}),Ni=Symbol("clickOutside"),Rm={mounted(a,l){a[Ni]=i=>{a.contains(i.target)||l.value(i)},document.addEventListener("click",a[Ni])},unmounted(a){a[Ni]&&document.removeEventListener("click",a[Ni])}};let ir=[],To;const Oa=["#FFD700","#FF6B8A","#7ECFC0","#C4B5FD","#FFA726","#EF5350","#AB47BC","#66BB6A","#42A5F5","#FFCA28"];class Ma{constructor(l){Re(this,"x");Re(this,"y");Re(this,"vx");Re(this,"vy");Re(this,"color");Re(this,"size");Re(this,"rotation");Re(this,"rotationSpeed");Re(this,"gravity");Re(this,"friction");Re(this,"opacity");Re(this,"fadeSpeed");Re(this,"shape");Re(this,"width");Re(this,"height");Re(this,"ctx");this.x=window.innerWidth/2,this.y=window.innerHeight/2;const i=Math.random()*Math.PI*2,s=4+Math.random()*8;this.vx=Math.cos(i)*s,this.vy=Math.sin(i)*s-4,this.color=Oa[Math.floor(Math.random()*Oa.length)],this.size=4+Math.random()*6,this.rotation=Math.random()*360,this.rotationSpeed=(Math.random()-.5)*12,this.gravity=.12+Math.random()*.05,this.friction=.98,this.opacity=1,this.fadeSpeed=.005+Math.random()*.008,this.shape=Math.random()>.5?"rect":"circle",this.width=this.shape==="rect"?this.size*(.4+Math.random()*.6):this.size,this.height=this.shape==="rect"?this.size*(.8+Math.random()*.4):this.size,this.ctx=l}update(){this.vy+=this.gravity,this.vx*=this.friction,this.vy*=this.friction,this.x+=this.vx,this.y+=this.vy,this.rotation+=this.rotationSpeed,this.opacity-=this.fadeSpeed}draw(){this.ctx&&(this.ctx.save(),this.ctx.translate(this.x,this.y),this.ctx.rotate(this.rotation*Math.PI/180),this.ctx.globalAlpha=Math.max(0,this.opacity),this.ctx.fillStyle=this.color,this.shape==="rect"?this.ctx.fillRect(-this.width/2,-this.height/2,this.width,this.height):(this.ctx.beginPath(),this.ctx.arc(0,0,this.size/2,0,Math.PI*2),this.ctx.fill()),this.ctx.restore())}}const Bm={mounted(a){const l=a.getContext("2d"),i=()=>{l.clearRect(0,0,window.innerWidth,window.innerHeight);for(let s of ir)s.update(),s.draw();ir=ir.filter(s=>s.opacity>0),ir.length>0&&(To=requestAnimationFrame(i))};a._resize=()=>{const s=window.devicePixelRatio||1;a.width=window.innerWidth*s,a.height=window.innerHeight*s,l.scale(s,s)},a._resize(),window.addEventListener("resize",a._resize),setTimeout(()=>{for(let s=0;s<90;s++)ir.push(new Ma(l));i()},400),setTimeout(()=>{for(let s=0;s<40;s++)ir.push(new Ma(l))},900)},unmounted(a){window.removeEventListener("resize",a._resize),To&&cancelAnimationFrame(To),ir=[]}},Om={mounted(a){const l=a.getContext("2d");a._resize=()=>{a.width=window.innerWidth,a.height=window.innerHeight},a._resize(),window.addEventListener("resize",a._resize);const i=4,s=null,u="#E52222",f="#fed1b0",m="#1a1aff",p="#222",_="#E8B84B",x=[[s,s,s,u,u,u,u,u,s,s,s,s,s,s,s,s],[s,s,u,u,u,u,u,u,u,u,u,s,s,s,s,s],[s,s,p,p,p,f,f,p,f,s,s,s,s,s,s,s],[s,p,f,p,f,f,f,p,f,f,f,s,s,s,s,s],[s,p,f,p,p,f,f,f,p,f,f,f,s,s,s,s],[s,p,p,f,f,f,f,p,p,p,p,s,s,s,s,s],[s,s,s,f,f,f,f,f,f,f,s,s,s,s,s,s],[s,s,m,m,u,m,m,m,s,s,s,s,s,s,s,s],[s,m,m,m,u,m,m,m,m,m,s,s,s,s,s,s],[m,m,m,m,u,u,m,m,m,m,m,s,s,s,s,s],[f,f,m,u,_,u,u,_,m,f,f,s,s,s,s,s],[f,f,f,u,u,u,u,u,f,f,f,s,s,s,s,s],[f,f,u,u,u,u,u,u,u,f,f,s,s,s,s,s],[s,s,u,u,u,s,s,u,u,u,s,s,s,s,s,s],[s,p,p,p,s,s,s,p,p,p,s,s,s,s,s,s],[p,p,p,p,s,s,p,p,p,p,s,s,s,s,s,s]],C=[[s,s,s,u,u,u,u,u,s,s,s,s,s,s,s,s],[s,s,u,u,u,u,u,u,u,u,u,s,s,s,s,s],[s,s,p,p,p,f,f,p,f,s,s,s,s,s,s,s],[s,p,f,p,f,f,f,p,f,f,f,s,s,s,s,s],[s,p,f,p,p,f,f,f,p,f,f,f,s,s,s,s],[s,p,p,f,f,f,f,p,p,p,p,s,s,s,s,s],[s,s,s,f,f,f,f,f,f,f,s,s,s,s,s,s],[s,s,m,m,u,m,m,m,s,s,s,s,s,s,s,s],[s,m,m,m,u,m,m,m,m,m,s,s,s,s,s,s],[m,m,m,m,u,u,m,m,m,m,m,s,s,s,s,s],[f,f,m,u,_,u,u,_,m,f,f,s,s,s,s,s],[f,f,f,u,u,u,u,u,f,f,f,s,s,s,s,s],[f,f,u,u,u,u,u,u,u,f,f,s,s,s,s,s],[s,u,u,u,s,s,s,s,u,u,u,s,s,s,s,s],[p,p,p,s,s,s,s,s,p,p,p,s,s,s,s,s],[p,p,s,s,s,s,s,s,s,p,p,s,s,s,s,s]],y=[[s,s,s,u,u,u,u,u,s,s,s,s,s,s,s,s],[s,s,u,u,u,u,u,u,u,u,u,s,s,s,s,s],[s,s,p,p,p,f,f,p,f,s,s,s,s,s,s,s],[s,p,f,p,f,f,f,p,f,f,f,s,s,s,s,s],[s,p,f,p,p,f,f,f,p,f,f,f,s,s,s,s],[s,p,p,f,f,f,f,p,p,p,p,s,s,s,s,s],[s,s,s,f,f,f,f,f,f,f,s,s,s,s,s,s],[s,s,m,m,u,m,m,m,s,s,s,s,s,s,s,s],[s,m,m,m,u,m,m,m,m,m,s,s,s,s,s,s],[m,m,m,m,u,u,m,m,m,m,m,s,s,s,s,s],[f,f,m,u,_,u,u,_,m,f,f,s,s,s,s,s],[f,f,f,u,u,u,u,u,f,f,f,s,s,s,s,s],[f,f,u,u,u,u,u,u,u,f,f,s,s,s,s,s],[s,s,s,s,u,u,u,u,s,s,s,s,s,s,s,s],[s,s,s,s,p,p,p,p,p,s,s,s,s,s,s,s],[s,s,s,s,s,p,p,p,p,p,s,s,s,s,s,s]],I=[[s,s,s,s,u,u,u,u,u,s,s,s,s,s,s,s],[s,s,s,u,u,u,u,u,u,u,u,u,s,s,s,s],[s,s,s,p,p,p,f,f,p,f,s,s,s,s,s,s],[s,s,p,f,p,f,f,f,p,f,f,f,s,s,s,s],[s,s,p,f,p,p,f,f,f,p,f,f,s,s,s,s],[s,s,p,p,f,f,f,f,p,p,p,p,s,s,s,s],[s,s,s,s,f,f,f,f,f,f,f,s,s,s,s,s],[s,m,s,s,m,m,u,m,m,m,s,s,m,s,s,s],[m,m,m,m,m,u,m,m,m,m,m,m,m,s,s,s],[m,m,m,m,u,u,m,m,m,m,m,s,s,s,s,s],[f,f,m,u,_,u,u,_,m,f,f,s,s,s,s,s],[f,f,f,u,u,u,u,u,f,f,f,s,s,s,s,s],[f,f,u,u,u,u,u,u,u,f,f,s,s,s,s,s],[s,s,u,u,u,s,s,u,u,u,s,s,s,s,s,s],[s,p,p,p,s,s,s,p,p,p,s,s,s,s,s,s],[p,p,p,p,s,s,p,p,p,p,s,s,s,s,s,s]],O=[[s,_,_,_,_,_,s,s],[_,_,p,_,_,_,_,s],[_,p,_,_,_,_,_,s],[_,p,_,_,_,_,_,s],[_,p,_,_,_,_,_,s],[_,_,p,_,_,_,_,s],[s,_,_,_,_,_,s,s],[s,s,s,s,s,s,s,s]];function N(z,T,X,$,j,Z){const ee=T.length,de=T[0].length;for(let ce=0;ce<ee;ce++)for(let Ce=0;Ce<de;Ce++){const ge=T[ce][Ce];if(!ge)continue;const De=Z?X+(de-1-Ce)*j:X+Ce*j,xe=$+ce*j;z.fillStyle=ge,z.fillRect(De,xe,j,j)}}let v,k,P,D,M,q,W,Y,F,L,V,ie=!1;function Q(){Y=a.height*.46,k=-20*i,P=Y,D=3.2,M=0,v="enter",q=0,W=0,V=!1,F=Y-32*i,L=0,ie=!0}function te(){return a.width/2-6*i}function G(){if(!ie)return;const z=a.width,T=a.height;l.clearRect(0,0,z,T),V&&(F+=L,L+=.4,N(l,O,a.width/2-3*i,F,i,!1),F>T+16*i&&(V=!1)),(v==="enter"||v==="exit")&&(W++,W>=6&&(W=0,q=(q+1)%3));const X=[x,C,y];if(v==="enter")k+=D,N(l,X[q],k,P,i,!1),k+5*i>=te()&&(v="bump_up",D=0,M=-7);else if(v==="bump_up")M+=.7,P+=M,N(l,I,k,P,i,!1),M>=0&&(v="bump_down",V=!0,L=-10,F=P-10*i);else if(v==="bump_down")M+=.7,P+=M,N(l,I,k,P,i,!1),P>=Y&&(P=Y,M=0,D=-3.2,v="exit");else if(v==="exit"&&(k+=D,N(l,X[q],k,P,i,!0),k<-20*i)){ie=!1,setTimeout(()=>{Q(),G()},2500);return}requestAnimationFrame(G)}setTimeout(()=>{Q(),G()},1200)},unmounted(a){window.removeEventListener("resize",a._resize)}};class Mm{constructor(l){Re(this,"value");Re(this,"next");this.value=l}}class Dm{constructor(){Ui(this,en);Ui(this,Gn);Ui(this,sr);this.clear()}enqueue(l){const i=new Mm(l);_n(this,en)?(_n(this,Gn).next=i,Pn(this,Gn,i)):(Pn(this,en,i),Pn(this,Gn,i)),Zo(this,sr)._++}dequeue(){const l=_n(this,en);if(l)return Pn(this,en,_n(this,en).next),Zo(this,sr)._--,_n(this,en)||Pn(this,Gn,void 0),l.value}peek(){if(_n(this,en))return _n(this,en).value}clear(){Pn(this,en,void 0),Pn(this,Gn,void 0),Pn(this,sr,0)}get size(){return _n(this,sr)}*[Symbol.iterator](){let l=_n(this,en);for(;l;)yield l.value,l=l.next}*drain(){for(;_n(this,en);)yield this.dequeue()}}en=new WeakMap,Gn=new WeakMap,sr=new WeakMap;function vm(a){Da(a);const l=new Dm;let i=0;const s=()=>{i<a&&l.size>0&&(i++,l.dequeue()())},u=()=>{i--,s()},f=async(_,x,C)=>{const y=(async()=>_(...C))();x(y);try{await y}catch{}u()},m=(_,x,C)=>{new Promise(y=>{l.enqueue(y)}).then(f.bind(void 0,_,x,C)),i<a&&s()},p=(_,...x)=>new Promise(C=>{m(_,C,x)});return Object.defineProperties(p,{activeCount:{get:()=>i},pendingCount:{get:()=>l.size},clearQueue:{value(){l.clear()}},concurrency:{get:()=>a,set(_){Da(_),a=_,queueMicrotask(()=>{for(;i<a&&l.size>0;)s()})}},map:{async value(_,x){const C=Array.from(_,(y,I)=>this(x,y,I));return Promise.all(C)}}}),p}function Da(a){if(!((Number.isInteger(a)||a===Number.POSITIVE_INFINITY)&&a>0))throw new TypeError("Expected `concurrency` to be a number from 1 and up")}let Jt=null;const va=vm(5),Pm=async(a,l)=>{Jt&&Um();const i=st(),s=St(),u=Gr(),f=Lt(),{itemThemes:m}=_e.storeToRefs(s),{displayCards:p}=_e.storeToRefs(i),{is_notification_lib:_,notificationData_lib:x}=_e.storeToRefs(u),{stateCard:C,openProduct:y}=_e.storeToRefs(f),I=yn.create();await Lm(a),Jt=Lr(`wss://${l}/ws/org-unit/${a}/`,{heartbeatTimeout:3e4}),Jt.on("open",()=>console.warn("Realtime WebSocket подключён (pointId:",a,")")),Jt.on("error",O=>console.warn("WebSocket ошибка:",O)),Jt.on("close",()=>console.warn("Realtime WebSocket закрыт")),Jt.on("message",async O=>{try{if(O.type)return;m.value.kiosk_hide_menu_update_notification||(x.value.textNotification="Мы обновили меню");const N=O.params||O,v=N.active_groups||[],k=N.updated_groups||[],P=N.updated_product_groups||[],D=await Qn(),M=new Set(v.map(Q=>Q)),q=new Map(p.value.map(Q=>[Q.id,Q])),W=[],Y=D.transaction("groups","readwrite");let L=await Y.objectStore("groups").openCursor();for(;L;){const Q=L.key;!M.has(Q)&&Q!==a&&(W.push(Q),await L.delete(),q.delete(Q)),L=await L.continue()}await Y.done,p.value=Array.from(q.values()),W.length>0&&await Fm(M);const V=[...k.map(Q=>va(async()=>{const[te,G]=await Promise.all([I.getGroupByID(Q),I.loadGroupProducts(Q)]);te.products=G,q.set(Q,te),await Dr(Q,te),await La(te,G,!0)})),...P.map(Q=>va(async()=>{const[te,G]=await Promise.all([I.getGroupByID(Q),I.loadGroupProducts(Q)]);te.products=G,q.set(Q,te),await Dr(Q,te),await La(te,G,!0),await Vm(G,Q)}))];await Promise.all(V),p.value=Array.from(q.values()),await Nl(a,p),x.value.textNotification.length>1&&(_.value=!0);const ie=C.value.openCard;if(ie!=null&&ie.id){const Q=new Set(ie.groups??[]),te=new Set;let G=!1;for(const T of q.values()){const X=T==null?void 0:T.products;if(!Array.isArray(X))continue;const $=X.find(j=>(j==null?void 0:j.id)===ie.id);if(($==null?void 0:$.adult)===!0){y.value={id:null,visible:!1},f.reset();return}$&&(T==null?void 0:T.id)!=null&&(te.add(T.id),(k.includes(T.id)||P.includes(T.id))&&(G=!0))}if(te.size===0){y.value={id:null,visible:!1},f.reset();return}(!(Q.size===te.size&&[...Q].every(T=>te.has(T)))||G)&&await I.getSingleProduct(ie==null?void 0:ie.id)}}catch(N){console.error("ошибка обновления indexedDB [updateIndexedDB]",N)}}),Jt.connect()},Lm=async a=>{try{const l=st(),i=await qi(a);i!=null&&i.data&&(l.displayCards=i.data)}catch(l){console.error("Ошибка загрузки кэша групп:",l)}},Pa=async a=>{const l=st(),i=Gr(),s=Lt(),{stateCard:u,openProduct:f}=_e.storeToRefs(s),{cartProducts_lib:m}=_e.storeToRefs(l),p=m.value,_=[],x=[],C=u.value.openCard;for(const y of p)a(y)?(_.push(y),(y.id===(C==null?void 0:C.id)||C!=null&&C.adult)&&(f.value={id:null,visible:!1})):x.push(y);if(_.length>0){const y=_.map(I=>I.name).slice(0,3).join(", ");i.notificationData_lib.textNotification=`Некоторые позиции стали недоступны и были убраны из заказа: ${y}${_.length>3?` и ещё ${_.length-3}`:""}`,m.value=x,l.updateCartInLocalStorage()}},Fm=async a=>{await Pa(l=>{var i;return(i=l.groups)!=null&&i.length?!l.groups.some(s=>a.has(s)):!0})},Vm=async(a,l)=>{const i=st(),s=new Set(a.filter(u=>!u.adult||i.is18Allowed).map(u=>u.id));await Pa(u=>{var f;return(f=u.groups)!=null&&f.includes(l)?!s.has(u.id):!1})},La=async(a,l,i=!0)=>{if(a.video_link&&Ti(a.video_link,`${a.id}_video`,i),a.image_link&&Ti(a.image_link,`${a.id}_image`,i),l!=null&&l.length)for(const s of l)s.video_link&&Ti(s.video_link,`${s.id}_video`,i),s.image_link&&Ti(s.image_link,`${s.id}_image`,i)},Ti=async(a,l,i=!1)=>{try{const s=si();if(!i){const m=await fr(l);if(m){s.updateCacheFromBlob(l,m),window.dispatchEvent(new CustomEvent("image-cached",{detail:{id:l,blob:m}}));return}}const u=await fetch(a);if(!u.ok)throw new Error("Network error");const f=await u.blob();if(f.size===0)throw new Error("Empty blob");await Zi(l,f),s.updateCacheFromBlob(l,f),window.dispatchEvent(new CustomEvent("image-cached",{detail:{id:l,blob:f}}))}catch(s){console.warn(`[MediaCache] Failed for ${l}:`,s)}},Um=()=>{Jt&&(Jt.off("open"),Jt.off("message"),Jt.off("error"),Jt.off("close"),Jt.close(!0),Jt=null)},zm={key:0,class:"valentine-hearts"},Hm=r.defineComponent({__name:"FallingHearts",props:{symbols:{default:()=>["❤","♥","💕"]},max:{default:15},interval:{default:1500}},setup(a){const l=a,i=_t.useDocumentVisibility(),s=_t.useMediaQuery("(prefers-reduced-motion: reduce)"),u=r.ref([]);let f=null;const m=(C,y)=>Math.random()*(y-C)+C,p=()=>{if(s.value||u.value.length>=l.max)return;const C=l.symbols[Math.floor(Math.random()*l.symbols.length)],y=m(18,26),I=m(5,95),O=m(10,18),N=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:`${O}s`,animationDelay:`${N}s`}};u.value.push(D);const q=setTimeout(()=>{u.value=u.value.filter(W=>W.id!==D.id),clearTimeout(q)},(N+O+1)*1e3)},_=()=>{if(!s.value){for(let C=0;C<3;C++){const y=setTimeout(()=>{p(),clearTimeout(y)},C*200)}f=setInterval(p,l.interval)}},x=()=>{f&&(clearInterval(f),f=null),u.value=[]};return r.onMounted(()=>{s.value||_()}),r.onUnmounted(()=>{x()}),r.watch(i,(C,y)=>{C==="visible"&&y==="hidden"&&_(),C==="hidden"&&y==="visible"&&x()}),(C,y)=>r.unref(s)?r.createCommentVNode("",!0):(r.openBlock(),r.createElementBlock("div",zm,[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(u.value,I=>(r.openBlock(),r.createElementBlock("span",{key:I.id,class:"heart",style:r.normalizeStyle(I.style)},r.toDisplayString(I.icon),5))),128))]))}}),Gm=["src"],Wm=r.defineComponent({__name:"BasketImage",props:{id:{},fallback:{}},setup(a){const l=a,{mediaUrl:i}=Tn(()=>l.id,()=>l.fallback);return(s,u)=>(r.openBlock(),r.createElementBlock("img",{src:r.unref(i)||""},null,8,Gm))}}),Xm={class:"button_price_bg"},$m={class:"wrapper_container_price_bg"},jm={class:"button_price"},qm={key:0,class:"image_product_container"},Zm=r.defineComponent({__name:"BasketButton",emits:["goToCart"],setup(a,{emit:l}){const i=l,s=Te.useRouter(),u=st(),f=Fn(),{totalPrice_lib:m,cartProducts_lib:p}=_e.storeToRefs(u),_=r.computed(()=>{var y;return m.value+(((y=f.order)==null?void 0:y.remaining_amount)||0)}),x=r.computed(()=>{var y;return(y=p.value)!=null&&y.length,p.value.slice(0,3).map(I=>({id:`${I.id}_image`,fallback:I.image_link}))}),C=()=>{var y;if(f.isTableService&&f.hasOrder&&!((y=p.value)!=null&&y.length))return s.push({name:"order-ts"});i("goToCart")};return(y,I)=>(r.openBlock(),r.createElementBlock("div",Xm,[r.createElementVNode("div",$m,[r.createElementVNode("div",jm,[r.unref(m)>0&&x.value.length>0?(r.openBlock(),r.createElementBlock("div",qm,[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(x.value,O=>(r.openBlock(),r.createElementBlock("div",{key:O.id,class:"filter_image_product"},[r.createVNode(Wm,{id:O.id,fallback:O.fallback,class:"img_product"},null,8,["id","fallback"])]))),128))])):r.createCommentVNode("",!0),r.createVNode(r.unref(Ot.motion).div,{class:"button_default_main",whilePress:{scale:.92},onClick:C},{default:r.withCtx(()=>[I[1]||(I[1]=r.createElementVNode("div",{class:"icont_cart"},null,-1)),r.createElementVNode("p",null,[r.createVNode(ft,{price:_.value,fixedFloat:2},null,8,["price"]),I[0]||(I[0]=r.createTextVNode(" ₽",-1))])]),_:1})])])]))}}),$r=null,{min:or,max:bn,abs:Fa,floor:Ym}=Math,Va=(a,l,i)=>or(i,bn(l,a)),Ua=a=>[...a].sort((l,i)=>l-i),Km=typeof queueMicrotask=="function"?queueMicrotask:a=>{Promise.resolve().then(a)},ko=()=>{let a;return[new Promise(l=>{a=l}),a]},za=a=>{let l;return()=>(a&&(l=a(),a=void 0),l)},jr=(a,l,i)=>{const s=i?"unshift":"push";for(let u=0;u<l;u++)a[s](-1);return a},Ha=(a,l)=>{const i=a.t[l];return i===-1?a.o:i},Qm=(a,l,i)=>{const s=a.t[l]===-1;return a.t[l]=i,a.i=or(l,a.i),s},ki=(a,l)=>{if(!a.l)return 0;if(a.i>=l)return a.u[l];a.i<0&&(a.u[0]=0,a.i=0);let i=a.i,s=a.u[i];for(;i<l;)s+=Ha(a,i),a.u[++i]=s;return a.i=l,s},yr=(a,l,i=0,s=a.l-1)=>{let u=i;for(;i<=s;){const f=Ym((i+s)/2);ki(a,f)<=l?(u=f,i=f+1):s=f-1}return Va(u,0,a.l-1)},Ga=(a,l,i)=>{const s=l-a.l;return a.i=i?-1:or(l-1,a.i),a.l=l,s>0?(jr(a.u,s),jr(a.t,s,i),a.o*s):(a.u.splice(s),(i?a.t.splice(0,-s):a.t.splice(s)).reduce((u,f)=>u-(f===-1?a.o:f),0))},Jm=a=>a.documentElement,eg=a=>a.ownerDocument,tg=a=>a.defaultView,Wa=za(()=>!!/iP(hone|od|ad)/.test(navigator.userAgent)||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>0),ng=za(()=>"scrollBehavior"in Jm(document).style),rg=(a,l=40,i=0,s,u=!1)=>{let f=!!i,m=1,p=0,_=0,x=0,C=0,y=0,I=0,O=0,N=0,v=$r,k=[0,f?bn(i-1,0):-1],P=0,D=!1;const M=((G,z,T)=>({o:z,t:T?jr(T.slice(0,or(G,T.length)),bn(0,G-T.length)):jr([],G),l:G,i:-1,u:jr([],G+1)}))(a,s?s[1]:l,s&&s[0]),q=new Set,W=()=>x-_,Y=()=>W()+y+C,F=(G,z)=>((T,X,$,j)=>{if(j=or(j,T.l-1),ki(T,j)<=X){const Z=yr(T,$,j);return[yr(T,X,j,Z),Z]}{const Z=yr(T,X,void 0,j);return[Z,yr(T,$,Z)]}})(M,G,z,k[0]),L=()=>ki(M,M.l),V=(G,z)=>{const T=ki(M,G)-y;return z?L()-T-ie(G):T},ie=G=>Ha(M,G),Q=(G,z=-1)=>M.t[G]===z,te=G=>{G&&(Wa()&&O!==0||v&&N===1?y+=G:C+=G)};return{p:()=>{q.clear()},h:()=>m,m:()=>(G=>[G.t.slice(),G.o])(M),v:(G=200)=>{if(!D||f)return k;let z,T;if(I)[z,T]=k;else{let X=bn(0,Y()),$=X+p;u||(G=bn(0,G),O!==1&&(X-=G),O!==2&&($+=G)),[z,T]=k=F(bn(0,X),bn(0,$)),v&&(z=or(z,v[0]),T=bn(T,v[1]))}return[bn(z,0),or(T,M.l-1)]},S:G=>yr(M,G-_),I:Q,O:V,k:ie,j:()=>M.l,N:()=>x,B:()=>O!==0,T:()=>p,q:()=>_,M:L,P:()=>(I=C,C=0,[I,N===2]),R:(G,z)=>{const T=[G,z];return q.add(T),()=>{q.delete(T)}},A:(G,z)=>{let T,X,$=0;switch(G){case 1:{if(z===x&&N===0)break;const j=I;I=0;const Z=z-x,ee=Fa(Z);j&&ee<Fa(j)+1||N!==0||(O=Z<0?2:1),f&&(f=!1),x=z,$=4;const de=W();de>=-p&&de<=L()&&($+=1,X=ee>p);break}case 2:$=8,O!==0&&(T=!0,$+=1),O=0,N=0,v=$r;break;case 3:{const j=z.filter(([Z,ee])=>!Q(Z,ee));if(!j.length)break;te(j.reduce((Z,[ee,de])=>((N===2||(v&&N===1?ee<v[0]:V(ee+(O===0&&N===0?1:0))<W()))&&(Z+=de-ie(ee)),Z),0));for(const[Z,ee]of j){const de=ie(Z),ce=Qm(M,Z,ee);u&&(P+=ce?ee:ee-de)}u&&p&&P>p&&(te(((Z,ee)=>{let de=0;const ce=[];Z.t.forEach((be,et)=>{be!==-1&&(ce.push(be),et<ee&&de++)}),Z.i=-1;const Ce=Ua(ce),ge=Ce.length,De=ge/2|0,xe=ge%2==0?(Ce[De-1]+Ce[De])/2:Ce[De],Ct=Z.o;return((Z.o=xe)-Ct)*bn(ee-de,0)})(M,yr(M,Y()))),u=!1),$=3,X=!0;break}case 4:p!==z&&(p||(D=X=!0),p=z,$=3);break;case 5:z[1]?(te(Ga(M,z[0],!0)),N=2,$=1):(Ga(M,z[0]),$=1);break;case 6:_=z;break;case 7:N=1;break;case 8:v=F(z,z+p),$=1}$&&(m=1+(2147483647&m),T&&y&&(C+=y,y=0),q.forEach(([j,Z])=>{$&j&&Z(X)}))}}},Ro=setTimeout,Bo=(a,l)=>l?-a:a,ig=(a,l,i,s,u,f)=>{const m=Date.now;let p=0,_=!1,x=!1,C=!1,y=!1;const I=(()=>{let P;const D=()=>{P!=$r&&clearTimeout(P)},M=()=>{D(),P=Ro(()=>{P=$r,(()=>{if(_||x)return _=!1,void I();C=!1,a.A(2)})()},150)};return M.C=D,M})(),O=()=>{p=m(),C&&(y=!0),a.A(1,s()),I()},N=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,Wa()&&(C=!0)};return l.addEventListener("scroll",O),l.addEventListener("wheel",N,{passive:!0}),l.addEventListener("touchstart",v,{passive:!0}),l.addEventListener("touchend",k,{passive:!0}),{H:()=>{l.removeEventListener("scroll",O),l.removeEventListener("wheel",N),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,s()))}}},og=(a,l,i)=>{let s;return[async(u,f)=>{if(!await l())return;s&&s();const m=()=>{const[p,_]=ko();return s=()=>{_(!1)},a.T()&&Ro(s,150),[p,a.R(2,()=>{_(!0)})]};if(f&&ng())a.A(8,u()),Km(async()=>{for(;;){let p=!0;for(let[C,y]=a.v();C<=y;C++)if(a.I(C)){p=!1;break}if(p)break;const[_,x]=m();try{if(!await _)return}finally{x()}}a.A(7),i(u(),f)});else for(;;){const[p,_]=m();try{if(a.A(7),i(u()),!await p)return}finally{_()}}},()=>{s&&s()}]},sg=a=>{let l;return{F(i){(l||(l=new(tg(eg(i))).ResizeObserver(a))).observe(i)},J(i){l.unobserve(i)},H(){l&&l.disconnect()}}},ag=r.defineComponent({props:{L:{type:Object,required:!0},W:{type:Object,required:!0},X:{type:Object,required:!0},Y:{type:Function,required:!0},D:{type:Number,required:!0},U:{type:Boolean},G:{type:Boolean},K:{type:Boolean},Z:{type:String,required:!0},ee:Object},setup(a){const l=r.ref(),i=r.computed(()=>a.L.value&&a.W.O(a.D,a.K)),s=r.computed(()=>a.L.value&&a.W.I(a.D));return r.watch(()=>l.value&&a.D,(u,f,m)=>{m(a.Y(l.value,a.D))},{flush:"post"}),()=>{var u;const{X:f,U:m,G:p,Z:_}=a,x=s.value,{style:C,...y}=(u=a.ee)!==null&&u!==void 0?u:{},I={contain:"layout style",position:x&&p?void 0:"absolute",[m?"height":"width"]:"100%",[m?"top":"left"]:"0px",[m?"left":"top"]:i.value+"px",visibility:!x||p?void 0:"hidden",...C};return m&&(I.display="inline-flex"),r.createVNode(_,r.mergeProps({ref:l,style:I},y),typeof(O=f)=="function"||Object.prototype.toString.call(O)==="[object Object]"&&!r.isVNode(O)?f:{default:()=>[f],_:2},16,["style"]);var O}}}),lg=(a,l)=>{const i=a.key;return i??"_"+l},cg=(a,l)=>a[0]===l[0]&&a[1]===l[1],Xa=r.defineComponent({props:{data:{type:Array,required:!0},bufferSize:Number,itemSize:Number,shift:Boolean,horizontal:Boolean,startMargin:{type:Number,default:0},ssrCount:Number,scrollRef:Object,as:{type:String,default:"div"},item:{type:String,default:"div"},itemProps:Function,keepMounted:Array,cache:Object},emits:["scroll","scrollEnd"],setup(a,{emit:l,expose:i,slots:s}){let u=!!a.ssrCount;const f=a.horizontal,m=r.ref(),p=rg(a.data.length,a.itemSize,a.ssrCount,a.cache,!a.itemSize),_=((N,v)=>{let k;const P=v?"width":"height",D=new WeakMap,M=sg(q=>{const W=[];for(const{target:Y,contentRect:F}of q)if(Y.offsetParent)if(Y===k)N.A(4,F[P]);else{const L=D.get(Y);L!=$r&&W.push([L,F[P]])}W.length&&N.A(3,W)});return{te(q){M.F(k=q)},re:(q,W)=>(D.set(q,W),M.F(q),()=>{D.delete(q),M.J(q)}),p:M.H}})(p,f),x=((N,v)=>{let k,P,D=ko(),M=!1;const q=v?"scrollLeft":"scrollTop",W=v?"overflowX":"overflowY",[Y,F]=og(N,()=>D[0],(L,V)=>{L=Bo(L,M),V?k.scrollTo({[v?"left":"top"]:L,behavior:"smooth"}):k[q]=L});return{oe(L){k=L,v&&(M=getComputedStyle(L).direction==="rtl"),P=ig(N,L,v,()=>Bo(L[q],M),(V,ie,Q)=>{if(Q){const te=L.style,G=te[W];te[W]="hidden",Ro(()=>{te[W]=G})}L[q]=Bo(N.N()+V,M),ie&&F()}),D[1](!0)},p(){P&&P.H(),D[1](!1),D=ko()},ne:()=>M,se(L){Y(()=>L)},ie(L){L+=N.N(),Y(()=>L)},le(L,{align:V,smooth:ie,offset:Q=0}={}){if(L=Va(L,0,N.j()-1),V==="nearest"){const te=N.O(L),G=N.N();if(te<G)V="start";else{if(!(te+N.k(L)>G+N.T()))return;V="end"}}Y(()=>Q+N.q()+N.O(L)+(V==="end"?N.k(L)-N.T():V==="center"?(N.k(L)-N.T())/2:0),ie)},ce:()=>{P&&P.V()}}})(p,f),C=r.ref(p.h());p.R(1,()=>{C.value=p.h()}),p.R(4,()=>{l("scroll",p.N())}),p.R(8,()=>{l("scrollEnd")});const y=r.computed(N=>{C.value;const v=p.v(a.bufferSize);return N&&cg(N,v)?N:v}),I=r.computed(()=>C.value&&p.B()),O=r.computed(()=>C.value&&p.M());return r.onMounted(()=>{u=!1;const N=requestAnimationFrame(()=>{const v=k=>{_.te(k),x.oe(k)};a.scrollRef?v(a.scrollRef):v(m.value.parentElement)});r.onUnmounted(()=>{cancelAnimationFrame(N)})}),r.onUnmounted(()=>{p.p(),_.p(),x.p()}),r.watch(()=>a.data.length,N=>{p.A(5,[N,a.shift])}),r.watch(()=>a.startMargin,N=>{p.A(6,N)},{immediate:!0}),r.watch([C],()=>{x.ce()},{flush:"post"}),i({get cache(){return p.m()},get scrollOffset(){return p.N()},get scrollSize(){return(N=>bn(N.M(),N.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 N=a.as,v=a.item,k=O.value,P=x.ne(),D=!f&&P?"unshift":"push",M=[],q=Y=>{var F;const L=s.default({item:a.data[Y],index:Y})[0];return r.createVNode(ag,{key:lg(L,Y),L:C,W:p,Y:_.re,D:Y,X:L,U:f,K:P,G:u,Z:v,ee:(F=a.itemProps)===null||F===void 0?void 0:F.call(a,{item:a.data[Y],index:Y})},null,8,["L","W","Y","D","X","U","K","G","Z","ee"])};if(a.keepMounted){const Y=new Set(a.keepMounted);for(let[F,L]=y.value;F<=L;F++)Y.add(F);Ua([...Y]).forEach(F=>{M[D](q(F))})}else for(let[Y,F]=y.value;Y<=F;Y++)M[D](q(Y));return r.createVNode(N,{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(W=M)=="function"||Object.prototype.toString.call(W)==="[object Object]"&&!r.isVNode(W)?M:{default:()=>[M],_:2},8,["style"]);var W}}}),dg=r.defineComponent({props:{data:{type:Array,required:!0},bufferSize:Number,itemSize:Number,shift:Boolean,horizontal:Boolean,ssrCount:Number,itemProps:Function,keepMounted:Array,cache:Object},emits:["scroll","scrollEnd"],setup(a,{emit:l,expose:i,slots:s}){const u=a.horizontal,f=_=>{l("scroll",_)},m=()=>{l("scrollEnd")},p=r.ref();return i({get cache(){return p.value.cache},get scrollOffset(){return p.value.scrollOffset},get scrollSize(){return p.value.scrollSize},get viewportSize(){return p.value.viewportSize},findItemIndex:(..._)=>p.value.findItemIndex(..._),getItemOffset:(..._)=>p.value.getItemOffset(..._),getItemSize:(..._)=>p.value.getItemSize(..._),scrollToIndex:(..._)=>p.value.scrollToIndex(..._),scrollTo:(..._)=>p.value.scrollTo(..._),scrollBy:(..._)=>p.value.scrollBy(..._)}),()=>{return r.createVNode("div",{style:{display:u?"inline-block":"block",[u?"overflowX":"overflowY"]:"auto",contain:"strict",width:"100%",height:"100%"}},[r.createVNode(Xa,{ref:p,data:a.data,bufferSize:a.bufferSize,itemSize:a.itemSize,itemProps:a.itemProps,shift:a.shift,ssrCount:a.ssrCount,horizontal:u,keepMounted:a.keepMounted,cache:a.cache,onScroll:f,onScrollEnd:m},(_=s,typeof _=="function"||Object.prototype.toString.call(_)==="[object Object]"&&!r.isVNode(_)?s:{default:()=>[s],_:2}),8,["data","bufferSize","itemSize","itemProps","shift","ssrCount","horizontal","keepMounted","cache","onScroll","onScrollEnd"])],4);var _}}}),ug=(a,l=10)=>new Promise(i=>{let s=0,u=0,f=0;const m=()=>{if(!a||a.scrollSize===void 0){i();return}const p=a.scrollSize;p===f&&p>0?s++:(s=0)&&(f=p),u++,s>=2||u>=l?i():requestAnimationFrame(m)};requestAnimationFrame(m)});function fg(a,l){const i=(l==null?void 0:l.align)??"start";let s=!1;const u=r.ref(null),f=r.ref(!1),m=r.ref("measure"),p=r.computed(()=>r.toValue(a).length),_=r.computed(()=>m.value==="measure"||m.value==="virtual"?1:5),x=r.computed(()=>Array.from({length:p.value*_.value},(k,P)=>P)),C=async()=>{if(u.value&&(m.value="measure",s=!1,f.value=!1,await r.nextTick(),!(!u.value||m.value!=="measure")&&(await ug(u.value),!!u.value))){if(f.value=u.value.scrollSize>u.value.viewportSize,!f.value){s=!1;return}s=!0,m.value=(l==null?void 0:l.mode)||"loop",await r.nextTick(),u.value&&u.value.scrollToIndex(p.value*3,{align:i})}},y=k=>m.value==="measure"?k:p.value===0?0:k%p.value,I=(k,P)=>{u.value&&u.value.scrollToIndex(k,P)},O=(k,P)=>!s||m.value!=="loop"?P:P+Math.round((k-P)/p.value)*p.value,N=k=>{if(!s||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||!s)return;const k=u.value.findItemIndex(u.value.scrollOffset);N(k)};return r.onMounted(C),r.onUnmounted(()=>u.value=null),r.watch(p,()=>r.nextTick(C)),{listRef:u,items:x,hasScroll:f,realIndex:y,findNearestIndex:O,scrollToIndex:I,init:C,onScroll:v}}const hg=Object.prototype.toString,mg=a=>hg.call(a)==="[object Error]",gg=new Set(["network error","NetworkError when attempting to fetch resource.","The Internet connection appears to be offline.","Network request failed","fetch failed","terminated"," A network error occurred.","Network connection lost"]),pg=a=>{if(!(a&&mg(a)&&a.name==="TypeError"&&typeof a.message=="string"))return!1;const{message:i,stack:s}=a;return i==="Load failed"?s===void 0||"__sentry_captured__"in a:i.startsWith("error sending request for url")||i==="Failed to fetch"||i.startsWith("Failed to fetch (")&&i.endsWith(")")?!0:gg.has(i)},xg={pinch:!0,doubleTap:!0,wheel:!0,buttons:["+","-","=","0"]},_g=a=>{var i;const l=Object.assign({},xg,a);if(l.pinch&&(document.addEventListener("touchstart",s=>s.touches.length>1&&s.preventDefault(),{passive:!1}),document.addEventListener("gesturestart",s=>s.preventDefault(),{passive:!1})),l.doubleTap){let s=0;document.addEventListener("touchend",u=>{const f=Date.now();f-s<=250&&u.preventDefault(),s=f},{passive:!1})}l.wheel&&document.addEventListener("wheel",s=>(s.ctrlKey||s.metaKey)&&s.preventDefault(),{passive:!1}),(i=l.buttons)!=null&&i.length&&document.addEventListener("keydown",s=>(s.ctrlKey||s.metaKey)&&l.buttons.includes(s.key)&&s.preventDefault())};Object.defineProperty(he,"useRoute",{enumerable:!0,get:()=>Te.useRoute}),Object.defineProperty(he,"useRouter",{enumerable:!0,get:()=>Te.useRouter}),he.BasketButton=Zm,he.BottomSheet=xo,he.ButtonDefault=an,he.CardMain=xa,he.CardProductPage=b0,he.CardReader=fa,he.CartBox=ua,he.CartPage=vh,he.DrumItem=V2,he.FallingHearts=Hm,he.GroupMain=M2,he.InitConnection=yn,he.ModalWindows=K2,he.NotificationWindow=Ei,he.OrderBox=bo,he.PopupWindowDefault=da,he.PricePrerender=hr,he.QrCameraScanner=km,he.Recommendation=j2,he.RetryPage=$h,he.TableOrderPage=_2,he.TagsMain=v2,he.VList=dg,he.Virtualizer=Xa,he.clearAllProductDB=kl,he.clearLocalStorage=mr,he.getCachedGroup=qi,he.getCachedProduct=rs,he.getWebSocketInstance=Lr,he.initPinia=dl,he.initRouter=fl,he.isNetworkError=pg,he.parseTheme=ia,he.preventZoom=_g,he.updateIndexedDB=Pm,he.useCachedMedia=Tn,he.useCardLibStore=Lt,he.useCartLibStore=Mt,he.useImageCacheStore=si,he.useMainLibStore=st,he.useModal=yo,he.useModalStore=bi,he.useModulesLibStore=Gr,he.usePdf=Hn,he.useTableStore=Fn,he.useThemeStore=St,he.useVirtuaLoop=fg,he.vClickOutside=Rm,he.vConfetti=Bm,he.vDragScroll=Wr,he.vMario=Om,he.vMuted=Xr,Object.defineProperty(he,Symbol.toStringTag,{value:"Module"})});