@inno_user/inno_clouds_lib 9.3.0 → 9.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/@inno_user/inno_clouds_lib.css +1 -1
- package/dist/@inno_user/inno_clouds_lib.es.js +6313 -6221
- package/dist/@inno_user/inno_clouds_lib.umd.js +19 -19
- package/dist/composables/usePdfMode.d.ts +6 -0
- package/dist/composables/useScroll.d.ts +0 -0
- package/dist/directives/vDragScroll.d.ts +1 -0
- package/dist/index.d.ts +4 -2
- package/dist/requests.d.ts +1 -0
- package/dist/semantics/cardProduct/NumberModifier.vue.d.ts +4 -1
- package/dist/store/main.d.ts +3 -3
- package/dist/store/modules.d.ts +4 -1
- package/dist/store/theme.d.ts +9 -0
- package/dist/types/iTheme.d.ts +1 -0
- package/package.json +1 -1
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
(function(he,Re){typeof exports=="object"&&typeof module<"u"?Re(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"],Re):(he=typeof globalThis<"u"?globalThis:he||self,Re(he.InnoCloudsLib={},he.VueRouter,he.Pinia,he.Vue,he.VueuseCore,he.motionV))})(this,function(he,Re,xe,l,Wt,At){"use strict";var Mg=Object.defineProperty;var $a=he=>{throw TypeError(he)};var vg=(he,Re,xe)=>Re in he?Mg(he,Re,{enumerable:!0,configurable:!0,writable:!0,value:xe}):he[Re]=xe;var We=(he,Re,xe)=>vg(he,typeof Re!="symbol"?Re+"":Re,xe),Ka=(he,Re,xe)=>Re.has(he)||$a("Cannot "+xe);var pn=(he,Re,xe)=>(Ka(he,Re,"read from private field"),xe?xe.call(he):Re.get(he)),Bi=(he,Re,xe)=>Re.has(he)?$a("Cannot add the same private member more than once"):Re instanceof WeakSet?Re.add(he):Re.set(he,xe),vn=(he,Re,xe,l)=>(Ka(he,Re,"write to private field"),l?l.call(he,xe):Re.set(he,xe),xe);var Uo=(he,Re,xe,l)=>({set _(Wt){vn(he,Re,Wt,xe)},get _(){return pn(he,Re,l)}});var Qt,Hn,tr;function Ja(o,a){for(var i=0;i<a.length;i++){const u=a[i];if(typeof u!="string"&&!Array.isArray(u)){for(const f in u)if(f!=="default"&&!(f in o)){const h=Object.getOwnPropertyDescriptor(u,f);h&&Object.defineProperty(o,f,h.get?h:{enumerable:!0,get:()=>u[f]})}}}return Object.freeze(Object.defineProperty(o,Symbol.toStringTag,{value:"Module"}))}function el(o){return o}const tl=[];function nl(){return Re.createRouter({history:Re.createWebHistory(),routes:tl})}const Mi=(o,a)=>a.some(i=>o instanceof i);let Ho,zo;function rl(){return Ho||(Ho=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function il(){return zo||(zo=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}const vi=new WeakMap,Di=new WeakMap,$r=new WeakMap;function ol(o){const a=new Promise((i,u)=>{const f=()=>{o.removeEventListener("success",h),o.removeEventListener("error",m)},h=()=>{i(Un(o.result)),f()},m=()=>{u(o.error),f()};o.addEventListener("success",h),o.addEventListener("error",m)});return $r.set(a,o),a}function sl(o){if(vi.has(o))return;const a=new Promise((i,u)=>{const f=()=>{o.removeEventListener("complete",h),o.removeEventListener("error",m),o.removeEventListener("abort",m)},h=()=>{i(),f()},m=()=>{u(o.error||new DOMException("AbortError","AbortError")),f()};o.addEventListener("complete",h),o.addEventListener("error",m),o.addEventListener("abort",m)});vi.set(o,a)}let Pi={get(o,a,i){if(o instanceof IDBTransaction){if(a==="done")return vi.get(o);if(a==="store")return i.objectStoreNames[1]?void 0:i.objectStore(i.objectStoreNames[0])}return Un(o[a])},set(o,a,i){return o[a]=i,!0},has(o,a){return o instanceof IDBTransaction&&(a==="done"||a==="store")?!0:a in o}};function Go(o){Pi=o(Pi)}function al(o){return il().includes(o)?function(...a){return o.apply(Li(this),a),Un(this.request)}:function(...a){return Un(o.apply(Li(this),a))}}function ll(o){return typeof o=="function"?al(o):(o instanceof IDBTransaction&&sl(o),Mi(o,rl())?new Proxy(o,Pi):o)}function Un(o){if(o instanceof IDBRequest)return ol(o);if(Di.has(o))return Di.get(o);const a=ll(o);return a!==o&&(Di.set(o,a),$r.set(a,o)),a}const Li=o=>$r.get(o);function cl(o,a,{blocked:i,upgrade:u,blocking:f,terminated:h}={}){const m=indexedDB.open(o,a),w=Un(m);return u&&m.addEventListener("upgradeneeded",_=>{u(Un(m.result),_.oldVersion,_.newVersion,Un(m.transaction),_)}),i&&m.addEventListener("blocked",_=>i(_.oldVersion,_.newVersion,_)),w.then(_=>{h&&_.addEventListener("close",()=>h()),f&&_.addEventListener("versionchange",p=>f(p.oldVersion,p.newVersion,p))}).catch(()=>{}),w}function ul(o,{blocked:a}={}){const i=indexedDB.deleteDatabase(o);return a&&i.addEventListener("blocked",u=>a(u.oldVersion,u)),Un(i).then(()=>{})}const dl=["get","getKey","getAll","getAllKeys","count"],fl=["put","add","delete","clear"],Fi=new Map;function Wo(o,a){if(!(o instanceof IDBDatabase&&!(a in o)&&typeof a=="string"))return;if(Fi.get(a))return Fi.get(a);const i=a.replace(/FromIndex$/,""),u=a!==i,f=fl.includes(i);if(!(i in(u?IDBIndex:IDBObjectStore).prototype)||!(f||dl.includes(i)))return;const h=async function(m,...w){const _=this.transaction(m,f?"readwrite":"readonly");let p=_.store;return u&&(p=p.index(w.shift())),(await Promise.all([p[i](...w),f&&_.done]))[0]};return Fi.set(a,h),h}Go(o=>({...o,get:(a,i,u)=>Wo(a,i)||o.get(a,i,u),has:(a,i)=>!!Wo(a,i)||o.has(a,i)}));const hl=["continue","continuePrimaryKey","advance"],Xo={},Vi=new WeakMap,jo=new WeakMap,gl={get(o,a){if(!hl.includes(a))return o[a];let i=Xo[a];return i||(i=Xo[a]=function(...u){Vi.set(this,jo.get(this)[a](...u))}),i}};async function*ml(...o){let a=this;if(a instanceof IDBCursor||(a=await a.openCursor(...o)),!a)return;a=a;const i=new Proxy(a,gl);for(jo.set(i,a),$r.set(i,Li(a));a;)yield i,a=await(Vi.get(i)||a.continue()),Vi.delete(i)}function Zo(o,a){return a===Symbol.asyncIterator&&Mi(o,[IDBIndex,IDBObjectStore,IDBCursor])||a==="iterate"&&Mi(o,[IDBIndex,IDBObjectStore])}Go(o=>({...o,get(a,i,u){return Zo(a,i)?ml:o.get(a,i,u)},has(a,i){return Zo(a,i)||o.has(a,i)}}));let lr;async function Yn(){return lr||(lr=cl("data",1,{upgrade(o){o.objectStoreNames.contains("groups")||o.createObjectStore("groups",{keyPath:"id"}),o.objectStoreNames.contains("media")||o.createObjectStore("media",{keyPath:"id"}),o.objectStoreNames.contains("products")||o.createObjectStore("products",{keyPath:"id"})}})),lr}async function Ui(o){return(await Yn()).transaction("groups","readonly").objectStore("groups").get(o)}async function kr(o,a){const u=(await Yn()).transaction("groups","readwrite");await u.objectStore("groups").put({id:o,data:a,timestamp:Date.now()}),await u.done}async function pl(o,a){const i=JSON.parse(JSON.stringify(l.toRaw(a.value)));await kr(o,i)}async function Hi(o,a){const u=(await Yn()).transaction("media","readwrite");await u.objectStore("media").put({id:o,blob:a,timestamp:Date.now()}),await u.done}async function cr(o){const f=await(await Yn()).transaction("media","readonly").objectStore("media").get(o);return f==null?void 0:f.blob}async function xl(o){const i=(await Yn()).transaction("products","readwrite"),u=i.objectStore("products"),f=o.id;await u.put({id:f,product:o,timestamp:Date.now()}),await i.done}async function qo(o){const f=await(await Yn()).transaction("products","readonly").objectStore("products").get(o);return f==null?void 0:f.product}async function wl(){if(lr){const o=await lr.catch(()=>null);o&&o.close(),lr=void 0}try{await ul("data",{blocked(){console.warn("Удаление заблокировано. открыты другие вкладки с сайтом.")}})}catch(o){console.error("Не удалось удалить базу: [lib, indexedDB]",o)}}function Kr(o){"@babel/helpers - typeof";return Kr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(a){return typeof a}:function(a){return a&&typeof Symbol=="function"&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},Kr(o)}var _l=/^\s+/,Cl=/\s+$/;function Ae(o,a){if(o=o||"",a=a||{},o instanceof Ae)return o;if(!(this instanceof Ae))return new Ae(o,a);var i=El(o);this._originalInput=o,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=a.format||i.format,this._gradientType=a.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}Ae.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 a=this.toRgb();return(a.r*299+a.g*587+a.b*114)/1e3},getLuminance:function(){var a=this.toRgb(),i,u,f,h,m,w;return i=a.r/255,u=a.g/255,f=a.b/255,i<=.03928?h=i/12.92:h=Math.pow((i+.055)/1.055,2.4),u<=.03928?m=u/12.92:m=Math.pow((u+.055)/1.055,2.4),f<=.03928?w=f/12.92:w=Math.pow((f+.055)/1.055,2.4),.2126*h+.7152*m+.0722*w},setAlpha:function(a){return this._a=es(a),this._roundA=Math.round(100*this._a)/100,this},toHsv:function(){var a=$o(this._r,this._g,this._b);return{h:a.h*360,s:a.s,v:a.v,a:this._a}},toHsvString:function(){var a=$o(this._r,this._g,this._b),i=Math.round(a.h*360),u=Math.round(a.s*100),f=Math.round(a.v*100);return this._a==1?"hsv("+i+", "+u+"%, "+f+"%)":"hsva("+i+", "+u+"%, "+f+"%, "+this._roundA+")"},toHsl:function(){var a=Yo(this._r,this._g,this._b);return{h:a.h*360,s:a.s,l:a.l,a:this._a}},toHslString:function(){var a=Yo(this._r,this._g,this._b),i=Math.round(a.h*360),u=Math.round(a.s*100),f=Math.round(a.l*100);return this._a==1?"hsl("+i+", "+u+"%, "+f+"%)":"hsla("+i+", "+u+"%, "+f+"%, "+this._roundA+")"},toHex:function(a){return Ko(this._r,this._g,this._b,a)},toHexString:function(a){return"#"+this.toHex(a)},toHex8:function(a){return Il(this._r,this._g,this._b,this._a,a)},toHex8String:function(a){return"#"+this.toHex8(a)},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(gt(this._r,255)*100)+"%",g:Math.round(gt(this._g,255)*100)+"%",b:Math.round(gt(this._b,255)*100)+"%",a:this._a}},toPercentageRgbString:function(){return this._a==1?"rgb("+Math.round(gt(this._r,255)*100)+"%, "+Math.round(gt(this._g,255)*100)+"%, "+Math.round(gt(this._b,255)*100)+"%)":"rgba("+Math.round(gt(this._r,255)*100)+"%, "+Math.round(gt(this._g,255)*100)+"%, "+Math.round(gt(this._b,255)*100)+"%, "+this._roundA+")"},toName:function(){return this._a===0?"transparent":this._a<1?!1:Ll[Ko(this._r,this._g,this._b,!0)]||!1},toFilter:function(a){var i="#"+Qo(this._r,this._g,this._b,this._a),u=i,f=this._gradientType?"GradientType = 1, ":"";if(a){var h=Ae(a);u="#"+Qo(h._r,h._g,h._b,h._a)}return"progid:DXImageTransform.Microsoft.gradient("+f+"startColorstr="+i+",endColorstr="+u+")"},toString:function(a){var i=!!a;a=a||this._format;var u=!1,f=this._a<1&&this._a>=0,h=!i&&f&&(a==="hex"||a==="hex6"||a==="hex3"||a==="hex4"||a==="hex8"||a==="name");return h?a==="name"&&this._a===0?this.toName():this.toRgbString():(a==="rgb"&&(u=this.toRgbString()),a==="prgb"&&(u=this.toPercentageRgbString()),(a==="hex"||a==="hex6")&&(u=this.toHexString()),a==="hex3"&&(u=this.toHexString(!0)),a==="hex4"&&(u=this.toHex8String(!0)),a==="hex8"&&(u=this.toHex8String()),a==="name"&&(u=this.toName()),a==="hsl"&&(u=this.toHslString()),a==="hsv"&&(u=this.toHsvString()),u||this.toHexString())},clone:function(){return Ae(this.toString())},_applyModification:function(a,i){var u=a.apply(null,[this].concat([].slice.call(i)));return this._r=u._r,this._g=u._g,this._b=u._b,this.setAlpha(u._a),this},lighten:function(){return this._applyModification(kl,arguments)},brighten:function(){return this._applyModification(Rl,arguments)},darken:function(){return this._applyModification(Ol,arguments)},desaturate:function(){return this._applyModification(Sl,arguments)},saturate:function(){return this._applyModification(Nl,arguments)},greyscale:function(){return this._applyModification(Tl,arguments)},spin:function(){return this._applyModification(Bl,arguments)},_applyCombination:function(a,i){return a.apply(null,[this].concat([].slice.call(i)))},analogous:function(){return this._applyCombination(Dl,arguments)},complement:function(){return this._applyCombination(Ml,arguments)},monochromatic:function(){return this._applyCombination(Pl,arguments)},splitcomplement:function(){return this._applyCombination(vl,arguments)},triad:function(){return this._applyCombination(Jo,[3])},tetrad:function(){return this._applyCombination(Jo,[4])}},Ae.fromRatio=function(o,a){if(Kr(o)=="object"){var i={};for(var u in o)o.hasOwnProperty(u)&&(u==="a"?i[u]=o[u]:i[u]=Rr(o[u]));o=i}return Ae(o,a)};function El(o){var a={r:0,g:0,b:0},i=1,u=null,f=null,h=null,m=!1,w=!1;return typeof o=="string"&&(o=Hl(o)),Kr(o)=="object"&&(Dn(o.r)&&Dn(o.g)&&Dn(o.b)?(a=yl(o.r,o.g,o.b),m=!0,w=String(o.r).substr(-1)==="%"?"prgb":"rgb"):Dn(o.h)&&Dn(o.s)&&Dn(o.v)?(u=Rr(o.s),f=Rr(o.v),a=Al(o.h,u,f),m=!0,w="hsv"):Dn(o.h)&&Dn(o.s)&&Dn(o.l)&&(u=Rr(o.s),h=Rr(o.l),a=bl(o.h,u,h),m=!0,w="hsl"),o.hasOwnProperty("a")&&(i=o.a)),i=es(i),{ok:m,format:o.format||w,r:Math.min(255,Math.max(a.r,0)),g:Math.min(255,Math.max(a.g,0)),b:Math.min(255,Math.max(a.b,0)),a:i}}function yl(o,a,i){return{r:gt(o,255)*255,g:gt(a,255)*255,b:gt(i,255)*255}}function Yo(o,a,i){o=gt(o,255),a=gt(a,255),i=gt(i,255);var u=Math.max(o,a,i),f=Math.min(o,a,i),h,m,w=(u+f)/2;if(u==f)h=m=0;else{var _=u-f;switch(m=w>.5?_/(2-u-f):_/(u+f),u){case o:h=(a-i)/_+(a<i?6:0);break;case a:h=(i-o)/_+2;break;case i:h=(o-a)/_+4;break}h/=6}return{h,s:m,l:w}}function bl(o,a,i){var u,f,h;o=gt(o,360),a=gt(a,100),i=gt(i,100);function m(p,C,y){return y<0&&(y+=1),y>1&&(y-=1),y<1/6?p+(C-p)*6*y:y<1/2?C:y<2/3?p+(C-p)*(2/3-y)*6:p}if(a===0)u=f=h=i;else{var w=i<.5?i*(1+a):i+a-i*a,_=2*i-w;u=m(_,w,o+1/3),f=m(_,w,o),h=m(_,w,o-1/3)}return{r:u*255,g:f*255,b:h*255}}function $o(o,a,i){o=gt(o,255),a=gt(a,255),i=gt(i,255);var u=Math.max(o,a,i),f=Math.min(o,a,i),h,m,w=u,_=u-f;if(m=u===0?0:_/u,u==f)h=0;else{switch(u){case o:h=(a-i)/_+(a<i?6:0);break;case a:h=(i-o)/_+2;break;case i:h=(o-a)/_+4;break}h/=6}return{h,s:m,v:w}}function Al(o,a,i){o=gt(o,360)*6,a=gt(a,100),i=gt(i,100);var u=Math.floor(o),f=o-u,h=i*(1-a),m=i*(1-f*a),w=i*(1-(1-f)*a),_=u%6,p=[i,m,h,h,w,i][_],C=[w,i,i,m,h,h][_],y=[h,h,w,i,i,m][_];return{r:p*255,g:C*255,b:y*255}}function Ko(o,a,i,u){var f=[xn(Math.round(o).toString(16)),xn(Math.round(a).toString(16)),xn(Math.round(i).toString(16))];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[0].charAt(0)+f[1].charAt(0)+f[2].charAt(0):f.join("")}function Il(o,a,i,u,f){var h=[xn(Math.round(o).toString(16)),xn(Math.round(a).toString(16)),xn(Math.round(i).toString(16)),xn(ts(u))];return f&&h[0].charAt(0)==h[0].charAt(1)&&h[1].charAt(0)==h[1].charAt(1)&&h[2].charAt(0)==h[2].charAt(1)&&h[3].charAt(0)==h[3].charAt(1)?h[0].charAt(0)+h[1].charAt(0)+h[2].charAt(0)+h[3].charAt(0):h.join("")}function Qo(o,a,i,u){var f=[xn(ts(u)),xn(Math.round(o).toString(16)),xn(Math.round(a).toString(16)),xn(Math.round(i).toString(16))];return f.join("")}Ae.equals=function(o,a){return!o||!a?!1:Ae(o).toRgbString()==Ae(a).toRgbString()},Ae.random=function(){return Ae.fromRatio({r:Math.random(),g:Math.random(),b:Math.random()})};function Sl(o,a){a=a===0?0:a||10;var i=Ae(o).toHsl();return i.s-=a/100,i.s=Qr(i.s),Ae(i)}function Nl(o,a){a=a===0?0:a||10;var i=Ae(o).toHsl();return i.s+=a/100,i.s=Qr(i.s),Ae(i)}function Tl(o){return Ae(o).desaturate(100)}function kl(o,a){a=a===0?0:a||10;var i=Ae(o).toHsl();return i.l+=a/100,i.l=Qr(i.l),Ae(i)}function Rl(o,a){a=a===0?0:a||10;var i=Ae(o).toRgb();return i.r=Math.max(0,Math.min(255,i.r-Math.round(255*-(a/100)))),i.g=Math.max(0,Math.min(255,i.g-Math.round(255*-(a/100)))),i.b=Math.max(0,Math.min(255,i.b-Math.round(255*-(a/100)))),Ae(i)}function Ol(o,a){a=a===0?0:a||10;var i=Ae(o).toHsl();return i.l-=a/100,i.l=Qr(i.l),Ae(i)}function Bl(o,a){var i=Ae(o).toHsl(),u=(i.h+a)%360;return i.h=u<0?360+u:u,Ae(i)}function Ml(o){var a=Ae(o).toHsl();return a.h=(a.h+180)%360,Ae(a)}function Jo(o,a){if(isNaN(a)||a<=0)throw new Error("Argument to polyad must be a positive number");for(var i=Ae(o).toHsl(),u=[Ae(o)],f=360/a,h=1;h<a;h++)u.push(Ae({h:(i.h+h*f)%360,s:i.s,l:i.l}));return u}function vl(o){var a=Ae(o).toHsl(),i=a.h;return[Ae(o),Ae({h:(i+72)%360,s:a.s,l:a.l}),Ae({h:(i+216)%360,s:a.s,l:a.l})]}function Dl(o,a,i){a=a||6,i=i||30;var u=Ae(o).toHsl(),f=360/i,h=[Ae(o)];for(u.h=(u.h-(f*a>>1)+720)%360;--a;)u.h=(u.h+f)%360,h.push(Ae(u));return h}function Pl(o,a){a=a||6;for(var i=Ae(o).toHsv(),u=i.h,f=i.s,h=i.v,m=[],w=1/a;a--;)m.push(Ae({h:u,s:f,v:h})),h=(h+w)%1;return m}Ae.mix=function(o,a,i){i=i===0?0:i||50;var u=Ae(o).toRgb(),f=Ae(a).toRgb(),h=i/100,m={r:(f.r-u.r)*h+u.r,g:(f.g-u.g)*h+u.g,b:(f.b-u.b)*h+u.b,a:(f.a-u.a)*h+u.a};return Ae(m)},Ae.readability=function(o,a){var i=Ae(o),u=Ae(a);return(Math.max(i.getLuminance(),u.getLuminance())+.05)/(Math.min(i.getLuminance(),u.getLuminance())+.05)},Ae.isReadable=function(o,a,i){var u=Ae.readability(o,a),f,h;switch(h=!1,f=zl(i),f.level+f.size){case"AAsmall":case"AAAlarge":h=u>=4.5;break;case"AAlarge":h=u>=3;break;case"AAAsmall":h=u>=7;break}return h},Ae.mostReadable=function(o,a,i){var u=null,f=0,h,m,w,_;i=i||{},m=i.includeFallbackColors,w=i.level,_=i.size;for(var p=0;p<a.length;p++)h=Ae.readability(o,a[p]),h>f&&(f=h,u=Ae(a[p]));return Ae.isReadable(o,u,{level:w,size:_})||!m?u:(i.includeFallbackColors=!1,Ae.mostReadable(o,["#fff","#000"],i))};var zi=Ae.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"},Ll=Ae.hexNames=Fl(zi);function Fl(o){var a={};for(var i in o)o.hasOwnProperty(i)&&(a[o[i]]=i);return a}function es(o){return o=parseFloat(o),(isNaN(o)||o<0||o>1)&&(o=1),o}function gt(o,a){Vl(o)&&(o="100%");var i=Ul(o);return o=Math.min(a,Math.max(0,parseFloat(o))),i&&(o=parseInt(o*a,10)/100),Math.abs(o-a)<1e-6?1:o%a/parseFloat(a)}function Qr(o){return Math.min(1,Math.max(0,o))}function on(o){return parseInt(o,16)}function Vl(o){return typeof o=="string"&&o.indexOf(".")!=-1&&parseFloat(o)===1}function Ul(o){return typeof o=="string"&&o.indexOf("%")!=-1}function xn(o){return o.length==1?"0"+o:""+o}function Rr(o){return o<=1&&(o=o*100+"%"),o}function ts(o){return Math.round(parseFloat(o)*255).toString(16)}function ns(o){return on(o)/255}var wn=function(){var o="[-\\+]?\\d+%?",a="[-\\+]?\\d*\\.\\d+%?",i="(?:"+a+")|(?:"+o+")",u="[\\s|\\(]+("+i+")[,|\\s]+("+i+")[,|\\s]+("+i+")\\s*\\)?",f="[\\s|\\(]+("+i+")[,|\\s]+("+i+")[,|\\s]+("+i+")[,|\\s]+("+i+")\\s*\\)?";return{CSS_UNIT:new RegExp(i),rgb:new RegExp("rgb"+u),rgba:new RegExp("rgba"+f),hsl:new RegExp("hsl"+u),hsla:new RegExp("hsla"+f),hsv:new RegExp("hsv"+u),hsva:new RegExp("hsva"+f),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 Dn(o){return!!wn.CSS_UNIT.exec(o)}function Hl(o){o=o.replace(_l,"").replace(Cl,"").toLowerCase();var a=!1;if(zi[o])o=zi[o],a=!0;else if(o=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var i;return(i=wn.rgb.exec(o))?{r:i[1],g:i[2],b:i[3]}:(i=wn.rgba.exec(o))?{r:i[1],g:i[2],b:i[3],a:i[4]}:(i=wn.hsl.exec(o))?{h:i[1],s:i[2],l:i[3]}:(i=wn.hsla.exec(o))?{h:i[1],s:i[2],l:i[3],a:i[4]}:(i=wn.hsv.exec(o))?{h:i[1],s:i[2],v:i[3]}:(i=wn.hsva.exec(o))?{h:i[1],s:i[2],v:i[3],a:i[4]}:(i=wn.hex8.exec(o))?{r:on(i[1]),g:on(i[2]),b:on(i[3]),a:ns(i[4]),format:a?"name":"hex8"}:(i=wn.hex6.exec(o))?{r:on(i[1]),g:on(i[2]),b:on(i[3]),format:a?"name":"hex"}:(i=wn.hex4.exec(o))?{r:on(i[1]+""+i[1]),g:on(i[2]+""+i[2]),b:on(i[3]+""+i[3]),a:ns(i[4]+""+i[4]),format:a?"name":"hex8"}:(i=wn.hex3.exec(o))?{r:on(i[1]+""+i[1]),g:on(i[2]+""+i[2]),b:on(i[3]+""+i[3]),format:a?"name":"hex"}:!1}function zl(o){var a,i;return o=o||{level:"AA",size:"small"},a=(o.level||"AA").toUpperCase(),i=(o.size||"small").toLowerCase(),a!=="AA"&&a!=="AAA"&&(a="AA"),i!=="small"&&i!=="large"&&(i="small"),{level:a,size:i}}const Jr=xe.defineStore("imageCache",()=>{const o=l.ref({});let a=!1;function i(_,p){const C=String(_);o.value[C]&&URL.revokeObjectURL(o.value[C]);const y=URL.createObjectURL(p);o.value[C]=y}async function u(_){if(!_){console.warn("initCacheSingle called with null/undefined id");return}const p=String(_);if(o.value[p])return;const C=await cr(p);C&&(await scheduler.yield(),i(p,C),window.dispatchEvent(new CustomEvent("image-cached",{detail:{id:p,blob:C}})))}function f(_){const{id:p,blob:C}=_.detail;p&&C&&i(p,C)}function h(){typeof window>"u"||a||(window.addEventListener("image-cached",f),a=!0)}function m(){typeof window>"u"||!a||(window.removeEventListener("image-cached",f),a=!1)}function w(){Object.values(o.value).forEach(URL.revokeObjectURL),o.value={}}return typeof window<"u"&&h(),{cache:o,initCacheSingle:u,updateCacheFromBlob:i,cleanup:w,setupEventListener:h,removeEventListener:m}}),It=xe.defineStore("themeLib",()=>{const o=Jr(),{initCacheSingle:a}=o,i=l.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_bypass_guest_auth:null,kiosk_bypass_guest_auth:null,kiosk_disable_lock_screen: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,kiosk_hide_manual_input_loyalty_card:null,kiosk_camera_scan_loyalty_card:null,kiosk_hide_menu_update_notification:null}),u=async h=>{if(!h)return;i.value={...h};const m=await cr("banner"),w=await cr("preloader"),_=await cr("defaultImage");m||f(h.kiosk_banner,"banner"),w||f(h.kiosk_preloader,"preloader"),_||f(h.fallback_image,"defaultImage"),document.documentElement.style.setProperty("--primaryColor",h.primary_color),document.documentElement.style.setProperty("--accentColor",h.accent_color),document.documentElement.style.setProperty("--accentLightColor",h.accent_light_color),document.documentElement.style.setProperty("--accentDarkColor",h.accent_dark_color),document.documentElement.style.setProperty("--bgButtonColor",h.bg_button_color),document.documentElement.style.setProperty("--inactiveButtonColor",h.inactive_button_color),document.documentElement.style.setProperty("--cardsColor",h.cards_color),document.documentElement.style.setProperty("--textColor",h.text_color),document.documentElement.style.setProperty("--nonworkingBgColor",h.nonworking_bg_color),h.apply_custom_size_picker_fonts&&h.size_picker_unselected_font_size&&h.size_picker_unselected_font_size>0&&document.documentElement.style.setProperty("--sizePickerUnselectedFontSize",`${h.size_picker_unselected_font_size}rem`),h.apply_custom_size_picker_fonts&&h.size_picker_selected_font_size&&h.size_picker_selected_font_size>0&&document.documentElement.style.setProperty("--sizePickerSelectedFontSize",`${h.size_picker_selected_font_size}rem`);const p=i.value.primary_color||"#F2F7FF",C=Ae(p).setAlpha(.7).toRgbString(),y=`linear-gradient(to bottom, transparent 10%, ${C} 50%, ${p} 85%)`,N=`-webkit-linear-gradient(to bottom, transparent 10%, ${C} 50%, ${p} 85%)`;return i.value.gradientStyle={background:y,backgroundColor:N},i.value},f=async(h,m)=>{if(h){const w=await fetch(h);if(!w.ok)throw new Error("Network error");const _=await w.blob();Hi(m,_),a(m)}};return{itemThemes:i,updateColor:u}}),ur=o=>{if(!o)return 0;if((o.price===0||o.price===null)&&o.sizes&&o.sizes.length>0){const a=o.sizes.find(i=>i.is_default===!0);return a?a.price:o.sizes.length>1&&o.sizes[1].price||o.sizes[0].price}return o.price};class Or extends Error{}Or.prototype.name="InvalidTokenError";function Gl(o){return decodeURIComponent(atob(o).replace(/(.)/g,(a,i)=>{let u=i.charCodeAt(0).toString(16).toUpperCase();return u.length<2&&(u="0"+u),"%"+u}))}function Wl(o){let a=o.replace(/-/g,"+").replace(/_/g,"/");switch(a.length%4){case 0:break;case 2:a+="==";break;case 3:a+="=";break;default:throw new Error("base64 string is not of the correct length")}try{return Gl(a)}catch{return atob(a)}}function rs(o,a){if(typeof o!="string")throw new Or("Invalid token specified: must be a string");a||(a={});const i=a.header===!0?0:1,u=o.split(".")[i];if(typeof u!="string")throw new Or(`Invalid token specified: missing part #${i+1}`);let f;try{f=Wl(u)}catch(h){throw new Or(`Invalid token specified: invalid base64 for part #${i+1} (${h.message})`)}try{return JSON.parse(f)}catch(h){throw new Or(`Invalid token specified: invalid json for part #${i+1} (${h.message})`)}}const Xl=(o,a)=>{if(typeof window<"u"){const i=localStorage.getItem(o);return i?JSON.parse(i):a}return a},jl=(o,a)=>{if(typeof window<"u"){const i=localStorage.getItem(o);if(i)try{return rs(JSON.parse(i))}catch(u){return console.error("Failed to decode JWT:",u),a}}return a},is=(o,a,i="normal")=>{const u=l.ref(i==="jwt"?jl(o,a):Xl(o,a));return l.watchEffect(()=>{u.value===null||u.value===void 0?localStorage.removeItem(o):i!=="jwt"&&localStorage.setItem(o,JSON.stringify(u.value))}),u},dr=o=>{o.forEach(a=>{try{localStorage.removeItem(a)}catch(i){console.error(`Ошибка при удалении ключа "${a}":`,i)}})};class Zl{constructor(a,i={}){We(this,"url");We(this,"options");We(this,"ws");We(this,"reconnectInterval");We(this,"listeners");We(this,"isConnected");We(this,"heartbeat");We(this,"heartbeatTimeout");We(this,"pingTimeout");We(this,"pingResponseTimeout");We(this,"signal");We(this,"_shouldReconnect",!0);this.url=a,this.options=i,this.ws=null,this.reconnectInterval=5e3,this.pingResponseTimeout=5e3,this.listeners=new Map,this.isConnected=l.ref(!1),this.heartbeatTimeout=i.heartbeatTimeout||3e5}connect(){var i,u;if(this.ws&&this.ws.readyState===WebSocket.OPEN){console.warn("WebSocket already open");return}if(!this._shouldReconnect){console.warn("Reconnection disabled");return}const a=`${this.url}`;this.ws=new WebSocket(a),(i=this.options.signal)!=null&&i.aborted&&this.ws.close(),(u=this.options.signal)==null||u.addEventListener("abort",()=>this.close()),this.ws.onopen=()=>{console.warn("WebSocket connected"),this.isConnected.value=!0,this.emit("open"),this.heartbeat=setInterval(()=>this.sendPing(),this.heartbeatTimeout)},this.ws.onmessage=f=>{try{const h=JSON.parse(f.data);this.emit("message",h),h!=null&&h.type&&h.type!=="ping"&&clearTimeout(this.pingTimeout)}catch(h){console.error("Error parsing WebSocket message:",h)}},this.ws.onerror=f=>{console.error("WebSocket error:",f),this.emit("error",f),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 a;this.isConnected.value&&((a=this.ws)==null?void 0:a.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(a){var i;this.isConnected.value&&((i=this.ws)==null?void 0:i.readyState)===WebSocket.OPEN?this.ws.send(JSON.stringify(a)):console.warn("WebSocket not connected")}close(a=!1){this.ws&&(this._shouldReconnect=!a,this.ws.close(),clearInterval(this.heartbeat),clearTimeout(this.pingTimeout),this.ws=null,this.listeners.clear())}on(a,i){this.listeners.has(a)||this.listeners.set(a,[]),this.listeners.get(a).push(i)}off(a,i){const u=this.listeners.get(a);u&&this.listeners.set(a,u.filter(f=>f!==i))}emit(a,i=null){const u=this.listeners.get(a);u&&u.forEach(f=>f(i))}getConnectionStatus(){return this.isConnected}}let ei=new Map;function ti(o,a={}){var u;if(ei.has(o)){const f=ei.get(o);if(f.isConnected.value&&((u=f.ws)==null?void 0:u.readyState)===WebSocket.OPEN)return f.listeners.clear(),f;f.close(!0),ei.delete(o)}const i=new Zl(o,a);return ei.set(o,i),i}const ot=xe.defineStore("mainLib",()=>{const o=l.ref(),a=l.ref(!1),i=l.ref(localStorage.getItem("kiosk_timeout")),u=l.ref(0),f=l.ref(!1),h=l.ref(sessionStorage.getItem("is_adult")==="true"),m=l.ref([]),w=l.ref([]),_=l.ref(!1),p=l.ref(),C=l.ref(""),y=l.ref(0),N=l.ref(!1),B=l.ref(!1),R=l.ref(!0),P=l.ref(localStorage.getItem("apiKey")===null),D=l.ref(!1),v=l.ref({textNotification:""}),M=l.ref([]);let k=null;const V=j=>{const re=`wss://${p.value.area}/ws/device/${j}/`;k=ti(re);function ge(){console.log("WebSocket connection opened")}function we(_e){if(_e.error)D.value=!0,v.value.textNotification=_e.error,k==null||k.close(!0);else{if(!(_e!=null&&_e.params))return;typeof _e.params.components.shift.is_ok!==null?R.value=_e.params.components.shift.is_ok:R.value=!0}}function Ne(_e){console.error("WebSocket error:",_e),k.close(!0)}k.on("open",ge),k.on("message",we),k.on("error",Ne),k.connect()},te=j=>{u.value=j,localStorage.setItem("kiosk_timeout",j)},ne=j=>{a.value=j},U=l.ref(null),ie=l.computed(()=>m.value.reduce((j,re)=>{let ge=0,we=0;return re.group_modifiers&&(ge=re.group_modifiers.reduce((Ne,_e)=>_e.modifiers?Ne+_e.modifiers.reduce((Me,fe)=>Me+fe.old_price*fe.amount,0):0,0)*re.amount),re.modifiers&&(we=re.modifiers.reduce((Ne,_e)=>Ne+_e.old_price*_e.amount,0)*re.amount),j+re.old_price*re.amount+ge+we},0)),z=l.computed({get:()=>m.value.length===0?0:U.value&&U.value!==0?U.value:m.value.reduce((j,re)=>{const ge=ur(re)*re.amount;let we=0,Ne=0;return re.group_modifiers&&(we=re.group_modifiers.reduce((_e,Me)=>Me.modifiers?_e+Me.modifiers.reduce((fe,dt)=>fe+dt.price*dt.amount,0):0,0)*re.amount),re.modifiers&&(Ne=re.modifiers.reduce((_e,Me)=>_e+Me.price*Me.amount,0)*re.amount),j+ge+we+Ne},0),set(j){U.value=j}}),oe=j=>{y.value=j,localStorage.removeItem("bonus"),is("bonus",y.value)},G=j=>{dr(j)},W=j=>{j={...j,idSystem:crypto.randomUUID()};const re=X(j);m.value.push(re),Z()},Z=()=>{try{if(!m.value||m.value.length===0){localStorage.removeItem("cart");return}localStorage.setItem("cart",JSON.stringify(l.toRaw(m.value)))}catch(j){console.error("Failed to update cart in localStorage:",j)}},X=j=>l.reactive({...j,amount:j.amount??1,price:j.old_price,new_price:null,total_new_price:null,discounts:[],modifiers:(j.modifiers||[]).map(re=>l.reactive({...re,price:re.old_price,new_price:null,total_new_price:null})),group_modifiers:(j.group_modifiers||[]).map(re=>l.reactive({...re,modifiers:(re.modifiers||[]).map(ge=>l.reactive({...ge,price:ge.old_price,new_price:null,total_new_price:null}))}))}),S=j=>{const re=m.value.find(ge=>ge.idSystem===j);re&&(re.amount+=1),Z()},$=j=>{const re=m.value.find(ge=>ge.idSystem===j);re&&(re.amount>=1&&(re.amount-=1),Z())},H=()=>{try{const j=localStorage.getItem("cart");if(j){const re=JSON.parse(j);m.value.splice(0,m.value.length,...re.map(X)),U.value=null}}catch(j){console.error("Failed to load cart from localStorage:",j)}};return H(),{cartProducts_lib:m,activeScrolling_lib:w,config_lib:p,totalPrice_lib:z,initialCartPrice_lib:ie,is_notification_lib:D,notificationData_lib:v,xApiKey_lib:C,countBonus:y,toggleDrum:a,is_showApiKey:P,openApiKey:N,kiosk_timeout:i,kiosk_FirstTimeout:u,is_OpenLoyal:B,profile:o,is_18_above_content:f,is18Allowed:h,healthState:R,displayCards:M,isOrderTypeSubmited:_,removeFromLocalStorage:G,setKioskTimeout:te,setBonus:oe,setStateDrum:ne,addToCart:W,plusAmount:S,minusAmount:$,loadCart:H,deleteItemFromCart:j=>{if(j){const re=m.value.findIndex(ge=>ge.idSystem===j);if(re===-1)return;m.value.splice(re,1),Z(),U.value=null}else m.value=[],Z()},updateCartInLocalStorage:Z,makeProductFullyReactive:X,checkHeartbeatApp:V}});function os(o,a){return function(){return o.apply(a,arguments)}}const{toString:ql}=Object.prototype,{getPrototypeOf:Gi}=Object,{iterator:ni,toStringTag:ss}=Symbol,ri=(o=>a=>{const i=ql.call(a);return o[i]||(o[i]=i.slice(8,-1).toLowerCase())})(Object.create(null)),_n=o=>(o=o.toLowerCase(),a=>ri(a)===o),ii=o=>a=>typeof a===o,{isArray:fr}=Array,hr=ii("undefined");function Br(o){return o!==null&&!hr(o)&&o.constructor!==null&&!hr(o.constructor)&&Yt(o.constructor.isBuffer)&&o.constructor.isBuffer(o)}const as=_n("ArrayBuffer");function Yl(o){let a;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?a=ArrayBuffer.isView(o):a=o&&o.buffer&&as(o.buffer),a}const $l=ii("string"),Yt=ii("function"),ls=ii("number"),Mr=o=>o!==null&&typeof o=="object",Kl=o=>o===!0||o===!1,oi=o=>{if(ri(o)!=="object")return!1;const a=Gi(o);return(a===null||a===Object.prototype||Object.getPrototypeOf(a)===null)&&!(ss in o)&&!(ni in o)},Ql=o=>{if(!Mr(o)||Br(o))return!1;try{return Object.keys(o).length===0&&Object.getPrototypeOf(o)===Object.prototype}catch{return!1}},Jl=_n("Date"),ec=_n("File"),tc=_n("Blob"),nc=_n("FileList"),rc=o=>Mr(o)&&Yt(o.pipe),ic=o=>{let a;return o&&(typeof FormData=="function"&&o instanceof FormData||Yt(o.append)&&((a=ri(o))==="formdata"||a==="object"&&Yt(o.toString)&&o.toString()==="[object FormData]"))},oc=_n("URLSearchParams"),[sc,ac,lc,cc]=["ReadableStream","Request","Response","Headers"].map(_n),uc=o=>o.trim?o.trim():o.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function vr(o,a,{allOwnKeys:i=!1}={}){if(o===null||typeof o>"u")return;let u,f;if(typeof o!="object"&&(o=[o]),fr(o))for(u=0,f=o.length;u<f;u++)a.call(null,o[u],u,o);else{if(Br(o))return;const h=i?Object.getOwnPropertyNames(o):Object.keys(o),m=h.length;let w;for(u=0;u<m;u++)w=h[u],a.call(null,o[w],w,o)}}function cs(o,a){if(Br(o))return null;a=a.toLowerCase();const i=Object.keys(o);let u=i.length,f;for(;u-- >0;)if(f=i[u],a===f.toLowerCase())return f;return null}const $n=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,us=o=>!hr(o)&&o!==$n;function Wi(){const{caseless:o,skipUndefined:a}=us(this)&&this||{},i={},u=(f,h)=>{const m=o&&cs(i,h)||h;oi(i[m])&&oi(f)?i[m]=Wi(i[m],f):oi(f)?i[m]=Wi({},f):fr(f)?i[m]=f.slice():(!a||!hr(f))&&(i[m]=f)};for(let f=0,h=arguments.length;f<h;f++)arguments[f]&&vr(arguments[f],u);return i}const dc=(o,a,i,{allOwnKeys:u}={})=>(vr(a,(f,h)=>{i&&Yt(f)?o[h]=os(f,i):o[h]=f},{allOwnKeys:u}),o),fc=o=>(o.charCodeAt(0)===65279&&(o=o.slice(1)),o),hc=(o,a,i,u)=>{o.prototype=Object.create(a.prototype,u),o.prototype.constructor=o,Object.defineProperty(o,"super",{value:a.prototype}),i&&Object.assign(o.prototype,i)},gc=(o,a,i,u)=>{let f,h,m;const w={};if(a=a||{},o==null)return a;do{for(f=Object.getOwnPropertyNames(o),h=f.length;h-- >0;)m=f[h],(!u||u(m,o,a))&&!w[m]&&(a[m]=o[m],w[m]=!0);o=i!==!1&&Gi(o)}while(o&&(!i||i(o,a))&&o!==Object.prototype);return a},mc=(o,a,i)=>{o=String(o),(i===void 0||i>o.length)&&(i=o.length),i-=a.length;const u=o.indexOf(a,i);return u!==-1&&u===i},pc=o=>{if(!o)return null;if(fr(o))return o;let a=o.length;if(!ls(a))return null;const i=new Array(a);for(;a-- >0;)i[a]=o[a];return i},xc=(o=>a=>o&&a instanceof o)(typeof Uint8Array<"u"&&Gi(Uint8Array)),wc=(o,a)=>{const u=(o&&o[ni]).call(o);let f;for(;(f=u.next())&&!f.done;){const h=f.value;a.call(o,h[0],h[1])}},_c=(o,a)=>{let i;const u=[];for(;(i=o.exec(a))!==null;)u.push(i);return u},Cc=_n("HTMLFormElement"),Ec=o=>o.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(i,u,f){return u.toUpperCase()+f}),ds=(({hasOwnProperty:o})=>(a,i)=>o.call(a,i))(Object.prototype),yc=_n("RegExp"),fs=(o,a)=>{const i=Object.getOwnPropertyDescriptors(o),u={};vr(i,(f,h)=>{let m;(m=a(f,h,o))!==!1&&(u[h]=m||f)}),Object.defineProperties(o,u)},bc=o=>{fs(o,(a,i)=>{if(Yt(o)&&["arguments","caller","callee"].indexOf(i)!==-1)return!1;const u=o[i];if(Yt(u)){if(a.enumerable=!1,"writable"in a){a.writable=!1;return}a.set||(a.set=()=>{throw Error("Can not rewrite read-only method '"+i+"'")})}})},Ac=(o,a)=>{const i={},u=f=>{f.forEach(h=>{i[h]=!0})};return fr(o)?u(o):u(String(o).split(a)),i},Ic=()=>{},Sc=(o,a)=>o!=null&&Number.isFinite(o=+o)?o:a;function Nc(o){return!!(o&&Yt(o.append)&&o[ss]==="FormData"&&o[ni])}const Tc=o=>{const a=new Array(10),i=(u,f)=>{if(Mr(u)){if(a.indexOf(u)>=0)return;if(Br(u))return u;if(!("toJSON"in u)){a[f]=u;const h=fr(u)?[]:{};return vr(u,(m,w)=>{const _=i(m,f+1);!hr(_)&&(h[w]=_)}),a[f]=void 0,h}}return u};return i(o,0)},kc=_n("AsyncFunction"),Rc=o=>o&&(Mr(o)||Yt(o))&&Yt(o.then)&&Yt(o.catch),hs=((o,a)=>o?setImmediate:a?((i,u)=>($n.addEventListener("message",({source:f,data:h})=>{f===$n&&h===i&&u.length&&u.shift()()},!1),f=>{u.push(f),$n.postMessage(i,"*")}))(`axios@${Math.random()}`,[]):i=>setTimeout(i))(typeof setImmediate=="function",Yt($n.postMessage)),Oc=typeof queueMicrotask<"u"?queueMicrotask.bind($n):typeof process<"u"&&process.nextTick||hs,K={isArray:fr,isArrayBuffer:as,isBuffer:Br,isFormData:ic,isArrayBufferView:Yl,isString:$l,isNumber:ls,isBoolean:Kl,isObject:Mr,isPlainObject:oi,isEmptyObject:Ql,isReadableStream:sc,isRequest:ac,isResponse:lc,isHeaders:cc,isUndefined:hr,isDate:Jl,isFile:ec,isBlob:tc,isRegExp:yc,isFunction:Yt,isStream:rc,isURLSearchParams:oc,isTypedArray:xc,isFileList:nc,forEach:vr,merge:Wi,extend:dc,trim:uc,stripBOM:fc,inherits:hc,toFlatObject:gc,kindOf:ri,kindOfTest:_n,endsWith:mc,toArray:pc,forEachEntry:wc,matchAll:_c,isHTMLForm:Cc,hasOwnProperty:ds,hasOwnProp:ds,reduceDescriptors:fs,freezeMethods:bc,toObjectSet:Ac,toCamelCase:Ec,noop:Ic,toFiniteNumber:Sc,findKey:cs,global:$n,isContextDefined:us,isSpecCompliantForm:Nc,toJSONObject:Tc,isAsyncFn:kc,isThenable:Rc,setImmediate:hs,asap:Oc,isIterable:o=>o!=null&&Yt(o[ni])};function Be(o,a,i,u,f){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=o,this.name="AxiosError",a&&(this.code=a),i&&(this.config=i),u&&(this.request=u),f&&(this.response=f,this.status=f.status?f.status:null)}K.inherits(Be,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:K.toJSONObject(this.config),code:this.code,status:this.status}}});const gs=Be.prototype,ms={};["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(o=>{ms[o]={value:o}}),Object.defineProperties(Be,ms),Object.defineProperty(gs,"isAxiosError",{value:!0}),Be.from=(o,a,i,u,f,h)=>{const m=Object.create(gs);K.toFlatObject(o,m,function(C){return C!==Error.prototype},p=>p!=="isAxiosError");const w=o&&o.message?o.message:"Error",_=a==null&&o?o.code:a;return Be.call(m,w,_,i,u,f),o&&m.cause==null&&Object.defineProperty(m,"cause",{value:o,configurable:!0}),m.name=o&&o.name||"Error",h&&Object.assign(m,h),m};const Bc=null;function Xi(o){return K.isPlainObject(o)||K.isArray(o)}function ps(o){return K.endsWith(o,"[]")?o.slice(0,-2):o}function xs(o,a,i){return o?o.concat(a).map(function(f,h){return f=ps(f),!i&&h?"["+f+"]":f}).join(i?".":""):a}function Mc(o){return K.isArray(o)&&!o.some(Xi)}const vc=K.toFlatObject(K,{},null,function(a){return/^is[A-Z]/.test(a)});function si(o,a,i){if(!K.isObject(o))throw new TypeError("target must be an object");a=a||new FormData,i=K.toFlatObject(i,{metaTokens:!0,dots:!1,indexes:!1},!1,function(P,D){return!K.isUndefined(D[P])});const u=i.metaTokens,f=i.visitor||C,h=i.dots,m=i.indexes,_=(i.Blob||typeof Blob<"u"&&Blob)&&K.isSpecCompliantForm(a);if(!K.isFunction(f))throw new TypeError("visitor must be a function");function p(R){if(R===null)return"";if(K.isDate(R))return R.toISOString();if(K.isBoolean(R))return R.toString();if(!_&&K.isBlob(R))throw new Be("Blob is not supported. Use a Buffer instead.");return K.isArrayBuffer(R)||K.isTypedArray(R)?_&&typeof Blob=="function"?new Blob([R]):Buffer.from(R):R}function C(R,P,D){let v=R;if(R&&!D&&typeof R=="object"){if(K.endsWith(P,"{}"))P=u?P:P.slice(0,-2),R=JSON.stringify(R);else if(K.isArray(R)&&Mc(R)||(K.isFileList(R)||K.endsWith(P,"[]"))&&(v=K.toArray(R)))return P=ps(P),v.forEach(function(k,V){!(K.isUndefined(k)||k===null)&&a.append(m===!0?xs([P],V,h):m===null?P:P+"[]",p(k))}),!1}return Xi(R)?!0:(a.append(xs(D,P,h),p(R)),!1)}const y=[],N=Object.assign(vc,{defaultVisitor:C,convertValue:p,isVisitable:Xi});function B(R,P){if(!K.isUndefined(R)){if(y.indexOf(R)!==-1)throw Error("Circular reference detected in "+P.join("."));y.push(R),K.forEach(R,function(v,M){(!(K.isUndefined(v)||v===null)&&f.call(a,v,K.isString(M)?M.trim():M,P,N))===!0&&B(v,P?P.concat(M):[M])}),y.pop()}}if(!K.isObject(o))throw new TypeError("data must be an object");return B(o),a}function ws(o){const a={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(o).replace(/[!'()~]|%20|%00/g,function(u){return a[u]})}function ji(o,a){this._pairs=[],o&&si(o,this,a)}const _s=ji.prototype;_s.append=function(a,i){this._pairs.push([a,i])},_s.toString=function(a){const i=a?function(u){return a.call(this,u,ws)}:ws;return this._pairs.map(function(f){return i(f[0])+"="+i(f[1])},"").join("&")};function Dc(o){return encodeURIComponent(o).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function Cs(o,a,i){if(!a)return o;const u=i&&i.encode||Dc;K.isFunction(i)&&(i={serialize:i});const f=i&&i.serialize;let h;if(f?h=f(a,i):h=K.isURLSearchParams(a)?a.toString():new ji(a,i).toString(u),h){const m=o.indexOf("#");m!==-1&&(o=o.slice(0,m)),o+=(o.indexOf("?")===-1?"?":"&")+h}return o}class Es{constructor(){this.handlers=[]}use(a,i,u){return this.handlers.push({fulfilled:a,rejected:i,synchronous:u?u.synchronous:!1,runWhen:u?u.runWhen:null}),this.handlers.length-1}eject(a){this.handlers[a]&&(this.handlers[a]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(a){K.forEach(this.handlers,function(u){u!==null&&a(u)})}}const ys={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Pc={isBrowser:!0,classes:{URLSearchParams:typeof URLSearchParams<"u"?URLSearchParams:ji,FormData:typeof FormData<"u"?FormData:null,Blob:typeof Blob<"u"?Blob:null},protocols:["http","https","file","blob","url","data"]},Zi=typeof window<"u"&&typeof document<"u",qi=typeof navigator=="object"&&navigator||void 0,Lc=Zi&&(!qi||["ReactNative","NativeScript","NS"].indexOf(qi.product)<0),Fc=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Vc=Zi&&window.location.href||"http://localhost",Ht={...Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:Zi,hasStandardBrowserEnv:Lc,hasStandardBrowserWebWorkerEnv:Fc,navigator:qi,origin:Vc},Symbol.toStringTag,{value:"Module"})),...Pc};function Uc(o,a){return si(o,new Ht.classes.URLSearchParams,{visitor:function(i,u,f,h){return Ht.isNode&&K.isBuffer(i)?(this.append(u,i.toString("base64")),!1):h.defaultVisitor.apply(this,arguments)},...a})}function Hc(o){return K.matchAll(/\w+|\[(\w*)]/g,o).map(a=>a[0]==="[]"?"":a[1]||a[0])}function zc(o){const a={},i=Object.keys(o);let u;const f=i.length;let h;for(u=0;u<f;u++)h=i[u],a[h]=o[h];return a}function bs(o){function a(i,u,f,h){let m=i[h++];if(m==="__proto__")return!0;const w=Number.isFinite(+m),_=h>=i.length;return m=!m&&K.isArray(f)?f.length:m,_?(K.hasOwnProp(f,m)?f[m]=[f[m],u]:f[m]=u,!w):((!f[m]||!K.isObject(f[m]))&&(f[m]=[]),a(i,u,f[m],h)&&K.isArray(f[m])&&(f[m]=zc(f[m])),!w)}if(K.isFormData(o)&&K.isFunction(o.entries)){const i={};return K.forEachEntry(o,(u,f)=>{a(Hc(u),f,i,0)}),i}return null}function Gc(o,a,i){if(K.isString(o))try{return(a||JSON.parse)(o),K.trim(o)}catch(u){if(u.name!=="SyntaxError")throw u}return(i||JSON.stringify)(o)}const Dr={transitional:ys,adapter:["xhr","http","fetch"],transformRequest:[function(a,i){const u=i.getContentType()||"",f=u.indexOf("application/json")>-1,h=K.isObject(a);if(h&&K.isHTMLForm(a)&&(a=new FormData(a)),K.isFormData(a))return f?JSON.stringify(bs(a)):a;if(K.isArrayBuffer(a)||K.isBuffer(a)||K.isStream(a)||K.isFile(a)||K.isBlob(a)||K.isReadableStream(a))return a;if(K.isArrayBufferView(a))return a.buffer;if(K.isURLSearchParams(a))return i.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),a.toString();let w;if(h){if(u.indexOf("application/x-www-form-urlencoded")>-1)return Uc(a,this.formSerializer).toString();if((w=K.isFileList(a))||u.indexOf("multipart/form-data")>-1){const _=this.env&&this.env.FormData;return si(w?{"files[]":a}:a,_&&new _,this.formSerializer)}}return h||f?(i.setContentType("application/json",!1),Gc(a)):a}],transformResponse:[function(a){const i=this.transitional||Dr.transitional,u=i&&i.forcedJSONParsing,f=this.responseType==="json";if(K.isResponse(a)||K.isReadableStream(a))return a;if(a&&K.isString(a)&&(u&&!this.responseType||f)){const m=!(i&&i.silentJSONParsing)&&f;try{return JSON.parse(a,this.parseReviver)}catch(w){if(m)throw w.name==="SyntaxError"?Be.from(w,Be.ERR_BAD_RESPONSE,this,null,this.response):w}}return a}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Ht.classes.FormData,Blob:Ht.classes.Blob},validateStatus:function(a){return a>=200&&a<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};K.forEach(["delete","get","head","post","put","patch"],o=>{Dr.headers[o]={}});const Wc=K.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"]),Xc=o=>{const a={};let i,u,f;return o&&o.split(`
|
|
2
|
-
`).forEach(function(m){f=m.indexOf(":"),i=m.substring(0,f).trim().toLowerCase(),u=m.substring(f+1).trim(),!(!i||
|
|
3
|
-
`)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(a){return a instanceof this?a:new this(a)}static concat(a,...i){const u=new this(a);return i.forEach(f=>u.set(f)),u}static accessor(a){const u=(this[As]=this[As]={accessors:{}}).accessors,f=this.prototype;function h(m){const w=Pr(m);u[w]||(Yc(f,m),u[w]=!0)}return K.isArray(a)?a.forEach(h):h(a),this}};$t.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),K.reduceDescriptors($t.prototype,({value:o},a)=>{let i=a[0].toUpperCase()+a.slice(1);return{get:()=>o,set(u){this[i]=u}}}),K.freezeMethods($t);function $i(o,a){const i=this||Dr,u=a||i,f=$t.from(u.headers);let h=u.data;return K.forEach(o,function(w){h=w.call(i,h,f.normalize(),a?a.status:void 0)}),f.normalize(),h}function Is(o){return!!(o&&o.__CANCEL__)}function gr(o,a,i){Be.call(this,o??"canceled",Be.ERR_CANCELED,a,i),this.name="CanceledError"}K.inherits(gr,Be,{__CANCEL__:!0});function Ss(o,a,i){const u=i.config.validateStatus;!i.status||!u||u(i.status)?o(i):a(new Be("Request failed with status code "+i.status,[Be.ERR_BAD_REQUEST,Be.ERR_BAD_RESPONSE][Math.floor(i.status/100)-4],i.config,i.request,i))}function $c(o){const a=/^([-+\w]{1,25})(:?\/\/|:)/.exec(o);return a&&a[1]||""}function Kc(o,a){o=o||10;const i=new Array(o),u=new Array(o);let f=0,h=0,m;return a=a!==void 0?a:1e3,function(_){const p=Date.now(),C=u[h];m||(m=p),i[f]=_,u[f]=p;let y=h,N=0;for(;y!==f;)N+=i[y++],y=y%o;if(f=(f+1)%o,f===h&&(h=(h+1)%o),p-m<a)return;const B=C&&p-C;return B?Math.round(N*1e3/B):void 0}}function Qc(o,a){let i=0,u=1e3/a,f,h;const m=(p,C=Date.now())=>{i=C,f=null,h&&(clearTimeout(h),h=null),o(...p)};return[(...p)=>{const C=Date.now(),y=C-i;y>=u?m(p,C):(f=p,h||(h=setTimeout(()=>{h=null,m(f)},u-y)))},()=>f&&m(f)]}const li=(o,a,i=3)=>{let u=0;const f=Kc(50,250);return Qc(h=>{const m=h.loaded,w=h.lengthComputable?h.total:void 0,_=m-u,p=f(_),C=m<=w;u=m;const y={loaded:m,total:w,progress:w?m/w:void 0,bytes:_,rate:p||void 0,estimated:p&&w&&C?(w-m)/p:void 0,event:h,lengthComputable:w!=null,[a?"download":"upload"]:!0};o(y)},i)},Ns=(o,a)=>{const i=o!=null;return[u=>a[0]({lengthComputable:i,total:o,loaded:u}),a[1]]},Ts=o=>(...a)=>K.asap(()=>o(...a)),Jc=Ht.hasStandardBrowserEnv?((o,a)=>i=>(i=new URL(i,Ht.origin),o.protocol===i.protocol&&o.host===i.host&&(a||o.port===i.port)))(new URL(Ht.origin),Ht.navigator&&/(msie|trident)/i.test(Ht.navigator.userAgent)):()=>!0,eu=Ht.hasStandardBrowserEnv?{write(o,a,i,u,f,h,m){if(typeof document>"u")return;const w=[`${o}=${encodeURIComponent(a)}`];K.isNumber(i)&&w.push(`expires=${new Date(i).toUTCString()}`),K.isString(u)&&w.push(`path=${u}`),K.isString(f)&&w.push(`domain=${f}`),h===!0&&w.push("secure"),K.isString(m)&&w.push(`SameSite=${m}`),document.cookie=w.join("; ")},read(o){if(typeof document>"u")return null;const a=document.cookie.match(new RegExp("(?:^|; )"+o+"=([^;]*)"));return a?decodeURIComponent(a[1]):null},remove(o){this.write(o,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function tu(o){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(o)}function nu(o,a){return a?o.replace(/\/?\/$/,"")+"/"+a.replace(/^\/+/,""):o}function ks(o,a,i){let u=!tu(a);return o&&(u||i==!1)?nu(o,a):a}const Rs=o=>o instanceof $t?{...o}:o;function Kn(o,a){a=a||{};const i={};function u(p,C,y,N){return K.isPlainObject(p)&&K.isPlainObject(C)?K.merge.call({caseless:N},p,C):K.isPlainObject(C)?K.merge({},C):K.isArray(C)?C.slice():C}function f(p,C,y,N){if(K.isUndefined(C)){if(!K.isUndefined(p))return u(void 0,p,y,N)}else return u(p,C,y,N)}function h(p,C){if(!K.isUndefined(C))return u(void 0,C)}function m(p,C){if(K.isUndefined(C)){if(!K.isUndefined(p))return u(void 0,p)}else return u(void 0,C)}function w(p,C,y){if(y in a)return u(p,C);if(y in o)return u(void 0,p)}const _={url:h,method:h,data:h,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:w,headers:(p,C,y)=>f(Rs(p),Rs(C),y,!0)};return K.forEach(Object.keys({...o,...a}),function(C){const y=_[C]||f,N=y(o[C],a[C],C);K.isUndefined(N)&&y!==w||(i[C]=N)}),i}const Os=o=>{const a=Kn({},o);let{data:i,withXSRFToken:u,xsrfHeaderName:f,xsrfCookieName:h,headers:m,auth:w}=a;if(a.headers=m=$t.from(m),a.url=Cs(ks(a.baseURL,a.url,a.allowAbsoluteUrls),o.params,o.paramsSerializer),w&&m.set("Authorization","Basic "+btoa((w.username||"")+":"+(w.password?unescape(encodeURIComponent(w.password)):""))),K.isFormData(i)){if(Ht.hasStandardBrowserEnv||Ht.hasStandardBrowserWebWorkerEnv)m.setContentType(void 0);else if(K.isFunction(i.getHeaders)){const _=i.getHeaders(),p=["content-type","content-length"];Object.entries(_).forEach(([C,y])=>{p.includes(C.toLowerCase())&&m.set(C,y)})}}if(Ht.hasStandardBrowserEnv&&(u&&K.isFunction(u)&&(u=u(a)),u||u!==!1&&Jc(a.url))){const _=f&&h&&eu.read(h);_&&m.set(f,_)}return a},ru=typeof XMLHttpRequest<"u"&&function(o){return new Promise(function(i,u){const f=Os(o);let h=f.data;const m=$t.from(f.headers).normalize();let{responseType:w,onUploadProgress:_,onDownloadProgress:p}=f,C,y,N,B,R;function P(){B&&B(),R&&R(),f.cancelToken&&f.cancelToken.unsubscribe(C),f.signal&&f.signal.removeEventListener("abort",C)}let D=new XMLHttpRequest;D.open(f.method.toUpperCase(),f.url,!0),D.timeout=f.timeout;function v(){if(!D)return;const k=$t.from("getAllResponseHeaders"in D&&D.getAllResponseHeaders()),te={data:!w||w==="text"||w==="json"?D.responseText:D.response,status:D.status,statusText:D.statusText,headers:k,config:o,request:D};Ss(function(U){i(U),P()},function(U){u(U),P()},te),D=null}"onloadend"in D?D.onloadend=v:D.onreadystatechange=function(){!D||D.readyState!==4||D.status===0&&!(D.responseURL&&D.responseURL.indexOf("file:")===0)||setTimeout(v)},D.onabort=function(){D&&(u(new Be("Request aborted",Be.ECONNABORTED,o,D)),D=null)},D.onerror=function(V){const te=V&&V.message?V.message:"Network Error",ne=new Be(te,Be.ERR_NETWORK,o,D);ne.event=V||null,u(ne),D=null},D.ontimeout=function(){let V=f.timeout?"timeout of "+f.timeout+"ms exceeded":"timeout exceeded";const te=f.transitional||ys;f.timeoutErrorMessage&&(V=f.timeoutErrorMessage),u(new Be(V,te.clarifyTimeoutError?Be.ETIMEDOUT:Be.ECONNABORTED,o,D)),D=null},h===void 0&&m.setContentType(null),"setRequestHeader"in D&&K.forEach(m.toJSON(),function(V,te){D.setRequestHeader(te,V)}),K.isUndefined(f.withCredentials)||(D.withCredentials=!!f.withCredentials),w&&w!=="json"&&(D.responseType=f.responseType),p&&([N,R]=li(p,!0),D.addEventListener("progress",N)),_&&D.upload&&([y,B]=li(_),D.upload.addEventListener("progress",y),D.upload.addEventListener("loadend",B)),(f.cancelToken||f.signal)&&(C=k=>{D&&(u(!k||k.type?new gr(null,o,D):k),D.abort(),D=null)},f.cancelToken&&f.cancelToken.subscribe(C),f.signal&&(f.signal.aborted?C():f.signal.addEventListener("abort",C)));const M=$c(f.url);if(M&&Ht.protocols.indexOf(M)===-1){u(new Be("Unsupported protocol "+M+":",Be.ERR_BAD_REQUEST,o));return}D.send(h||null)})},iu=(o,a)=>{const{length:i}=o=o?o.filter(Boolean):[];if(a||i){let u=new AbortController,f;const h=function(p){if(!f){f=!0,w();const C=p instanceof Error?p:this.reason;u.abort(C instanceof Be?C:new gr(C instanceof Error?C.message:C))}};let m=a&&setTimeout(()=>{m=null,h(new Be(`timeout ${a} of ms exceeded`,Be.ETIMEDOUT))},a);const w=()=>{o&&(m&&clearTimeout(m),m=null,o.forEach(p=>{p.unsubscribe?p.unsubscribe(h):p.removeEventListener("abort",h)}),o=null)};o.forEach(p=>p.addEventListener("abort",h));const{signal:_}=u;return _.unsubscribe=()=>K.asap(w),_}},ou=function*(o,a){let i=o.byteLength;if(i<a){yield o;return}let u=0,f;for(;u<i;)f=u+a,yield o.slice(u,f),u=f},su=async function*(o,a){for await(const i of au(o))yield*ou(i,a)},au=async function*(o){if(o[Symbol.asyncIterator]){yield*o;return}const a=o.getReader();try{for(;;){const{done:i,value:u}=await a.read();if(i)break;yield u}}finally{await a.cancel()}},Bs=(o,a,i,u)=>{const f=su(o,a);let h=0,m,w=_=>{m||(m=!0,u&&u(_))};return new ReadableStream({async pull(_){try{const{done:p,value:C}=await f.next();if(p){w(),_.close();return}let y=C.byteLength;if(i){let N=h+=y;i(N)}_.enqueue(new Uint8Array(C))}catch(p){throw w(p),p}},cancel(_){return w(_),f.return()}},{highWaterMark:2})},Ms=64*1024,{isFunction:ci}=K,lu=(({Request:o,Response:a})=>({Request:o,Response:a}))(K.global),{ReadableStream:vs,TextEncoder:Ds}=K.global,Ps=(o,...a)=>{try{return!!o(...a)}catch{return!1}},cu=o=>{o=K.merge.call({skipUndefined:!0},lu,o);const{fetch:a,Request:i,Response:u}=o,f=a?ci(a):typeof fetch=="function",h=ci(i),m=ci(u);if(!f)return!1;const w=f&&ci(vs),_=f&&(typeof Ds=="function"?(R=>P=>R.encode(P))(new Ds):async R=>new Uint8Array(await new i(R).arrayBuffer())),p=h&&w&&Ps(()=>{let R=!1;const P=new i(Ht.origin,{body:new vs,method:"POST",get duplex(){return R=!0,"half"}}).headers.has("Content-Type");return R&&!P}),C=m&&w&&Ps(()=>K.isReadableStream(new u("").body)),y={stream:C&&(R=>R.body)};f&&["text","arrayBuffer","blob","formData","stream"].forEach(R=>{!y[R]&&(y[R]=(P,D)=>{let v=P&&P[R];if(v)return v.call(P);throw new Be(`Response type '${R}' is not supported`,Be.ERR_NOT_SUPPORT,D)})});const N=async R=>{if(R==null)return 0;if(K.isBlob(R))return R.size;if(K.isSpecCompliantForm(R))return(await new i(Ht.origin,{method:"POST",body:R}).arrayBuffer()).byteLength;if(K.isArrayBufferView(R)||K.isArrayBuffer(R))return R.byteLength;if(K.isURLSearchParams(R)&&(R=R+""),K.isString(R))return(await _(R)).byteLength},B=async(R,P)=>{const D=K.toFiniteNumber(R.getContentLength());return D??N(P)};return async R=>{let{url:P,method:D,data:v,signal:M,cancelToken:k,timeout:V,onDownloadProgress:te,onUploadProgress:ne,responseType:U,headers:ie,withCredentials:z="same-origin",fetchOptions:oe}=Os(R),G=a||fetch;U=U?(U+"").toLowerCase():"text";let W=iu([M,k&&k.toAbortSignal()],V),Z=null;const X=W&&W.unsubscribe&&(()=>{W.unsubscribe()});let S;try{if(ne&&p&&D!=="get"&&D!=="head"&&(S=await B(ie,v))!==0){let ge=new i(P,{method:"POST",body:v,duplex:"half"}),we;if(K.isFormData(v)&&(we=ge.headers.get("content-type"))&&ie.setContentType(we),ge.body){const[Ne,_e]=Ns(S,li(Ts(ne)));v=Bs(ge.body,Ms,Ne,_e)}}K.isString(z)||(z=z?"include":"omit");const $=h&&"credentials"in i.prototype,H={...oe,signal:W,method:D.toUpperCase(),headers:ie.normalize().toJSON(),body:v,duplex:"half",credentials:$?z:void 0};Z=h&&new i(P,H);let ee=await(h?G(Z,oe):G(P,H));const j=C&&(U==="stream"||U==="response");if(C&&(te||j&&X)){const ge={};["status","statusText","headers"].forEach(Me=>{ge[Me]=ee[Me]});const we=K.toFiniteNumber(ee.headers.get("content-length")),[Ne,_e]=te&&Ns(we,li(Ts(te),!0))||[];ee=new u(Bs(ee.body,Ms,Ne,()=>{_e&&_e(),X&&X()}),ge)}U=U||"text";let re=await y[K.findKey(y,U)||"text"](ee,R);return!j&&X&&X(),await new Promise((ge,we)=>{Ss(ge,we,{data:re,headers:$t.from(ee.headers),status:ee.status,statusText:ee.statusText,config:R,request:Z})})}catch($){throw X&&X(),$&&$.name==="TypeError"&&/Load failed|fetch/i.test($.message)?Object.assign(new Be("Network Error",Be.ERR_NETWORK,R,Z),{cause:$.cause||$}):Be.from($,$&&$.code,R,Z)}}},uu=new Map,Ls=o=>{let a=o&&o.env||{};const{fetch:i,Request:u,Response:f}=a,h=[u,f,i];let m=h.length,w=m,_,p,C=uu;for(;w--;)_=h[w],p=C.get(_),p===void 0&&C.set(_,p=w?new Map:cu(a)),C=p;return p};Ls();const Ki={http:Bc,xhr:ru,fetch:{get:Ls}};K.forEach(Ki,(o,a)=>{if(o){try{Object.defineProperty(o,"name",{value:a})}catch{}Object.defineProperty(o,"adapterName",{value:a})}});const Fs=o=>`- ${o}`,du=o=>K.isFunction(o)||o===null||o===!1;function fu(o,a){o=K.isArray(o)?o:[o];const{length:i}=o;let u,f;const h={};for(let m=0;m<i;m++){u=o[m];let w;if(f=u,!du(u)&&(f=Ki[(w=String(u)).toLowerCase()],f===void 0))throw new Be(`Unknown adapter '${w}'`);if(f&&(K.isFunction(f)||(f=f.get(a))))break;h[w||"#"+m]=f}if(!f){const m=Object.entries(h).map(([_,p])=>`adapter ${_} `+(p===!1?"is not supported by the environment":"is not available in the build"));let w=i?m.length>1?`since :
|
|
4
|
-
`+m.map(
|
|
5
|
-
`):" "+
|
|
6
|
-
`+h):u.stack=h}catch{}}throw u}}_request(a,i){typeof a=="string"?(i=i||{},i.url=a):i=a||{},i=Kn(this.defaults,i);const{transitional:u,paramsSerializer:f,headers:h}=i;u!==void 0&&di.assertOptions(u,{silentJSONParsing:In.transitional(In.boolean),forcedJSONParsing:In.transitional(In.boolean),clarifyTimeoutError:In.transitional(In.boolean)},!1),f!=null&&(K.isFunction(f)?i.paramsSerializer={serialize:f}:di.assertOptions(f,{encode:In.function,serialize:In.function},!0)),i.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?i.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:i.allowAbsoluteUrls=!0),di.assertOptions(i,{baseUrl:In.spelling("baseURL"),withXsrfToken:In.spelling("withXSRFToken")},!0),i.method=(i.method||this.defaults.method||"get").toLowerCase();let m=h&&K.merge(h.common,h[i.method]);h&&K.forEach(["delete","get","head","post","put","patch","common"],R=>{delete h[R]}),i.headers=$t.concat(m,h);const w=[];let _=!0;this.interceptors.request.forEach(function(P){typeof P.runWhen=="function"&&P.runWhen(i)===!1||(_=_&&P.synchronous,w.unshift(P.fulfilled,P.rejected))});const p=[];this.interceptors.response.forEach(function(P){p.push(P.fulfilled,P.rejected)});let C,y=0,N;if(!_){const R=[Us.bind(this),void 0];for(R.unshift(...w),R.push(...p),N=R.length,C=Promise.resolve(i);y<N;)C=C.then(R[y++],R[y++]);return C}N=w.length;let B=i;for(;y<N;){const R=w[y++],P=w[y++];try{B=R(B)}catch(D){P.call(this,D);break}}try{C=Us.call(this,B)}catch(R){return Promise.reject(R)}for(y=0,N=p.length;y<N;)C=C.then(p[y++],p[y++]);return C}getUri(a){a=Kn(this.defaults,a);const i=ks(a.baseURL,a.url,a.allowAbsoluteUrls);return Cs(i,a.params,a.paramsSerializer)}};K.forEach(["delete","get","head","options"],function(a){Qn.prototype[a]=function(i,u){return this.request(Kn(u||{},{method:a,url:i,data:(u||{}).data}))}}),K.forEach(["post","put","patch"],function(a){function i(u){return function(h,m,w){return this.request(Kn(w||{},{method:a,headers:u?{"Content-Type":"multipart/form-data"}:{},url:h,data:m}))}}Qn.prototype[a]=i(),Qn.prototype[a+"Form"]=i(!0)});let gu=class Qa{constructor(a){if(typeof a!="function")throw new TypeError("executor must be a function.");let i;this.promise=new Promise(function(h){i=h});const u=this;this.promise.then(f=>{if(!u._listeners)return;let h=u._listeners.length;for(;h-- >0;)u._listeners[h](f);u._listeners=null}),this.promise.then=f=>{let h;const m=new Promise(w=>{u.subscribe(w),h=w}).then(f);return m.cancel=function(){u.unsubscribe(h)},m},a(function(h,m,w){u.reason||(u.reason=new gr(h,m,w),i(u.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(a){if(this.reason){a(this.reason);return}this._listeners?this._listeners.push(a):this._listeners=[a]}unsubscribe(a){if(!this._listeners)return;const i=this._listeners.indexOf(a);i!==-1&&this._listeners.splice(i,1)}toAbortSignal(){const a=new AbortController,i=u=>{a.abort(u)};return this.subscribe(i),a.signal.unsubscribe=()=>this.unsubscribe(i),a.signal}static source(){let a;return{token:new Qa(function(f){a=f}),cancel:a}}};function mu(o){return function(i){return o.apply(null,i)}}function pu(o){return K.isObject(o)&&o.isAxiosError===!0}const Ji={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(Ji).forEach(([o,a])=>{Ji[a]=o});function Gs(o){const a=new Qn(o),i=os(Qn.prototype.request,a);return K.extend(i,Qn.prototype,a,{allOwnKeys:!0}),K.extend(i,a,null,{allOwnKeys:!0}),i.create=function(f){return Gs(Kn(o,f))},i}const et=Gs(Dr);et.Axios=Qn,et.CanceledError=gr,et.CancelToken=gu,et.isCancel=Is,et.VERSION=Hs,et.toFormData=si,et.AxiosError=Be,et.Cancel=et.CanceledError,et.all=function(a){return Promise.all(a)},et.spread=mu,et.isAxiosError=pu,et.mergeConfig=Kn,et.AxiosHeaders=$t,et.formToJSON=o=>bs(K.isHTMLForm(o)?new FormData(o):o),et.getAdapter=Vs.getAdapter,et.HttpStatusCode=Ji,et.default=et;const{Axios:Hg,AxiosError:zg,CanceledError:Gg,isCancel:Wg,CancelToken:Xg,VERSION:jg,all:Zg,Cancel:qg,isAxiosError:Yg,spread:$g,toFormData:Kg,AxiosHeaders:Qg,HttpStatusCode:Jg,formToJSON:em,getAdapter:tm,mergeConfig:nm}=et;let Sn=null,zt=null;function Cn(o){o&&o.close(!0)}async function Lr(o,a){const i=St(),u=ot(),f=En.create();try{const h=await f.initPaymentLink(o,a);return i.paymentCostQR=u.totalPrice_lib-u.countBonus,i.linkQR=h.url,zt==null||zt.deleteCart(null,zt==null?void 0:zt.is_requestKiosk),h}catch(h){throw i.isButtonDisabled=!1,i.showNotification(h==null?void 0:h.response.data.user_friendly_message),h}}function xu(o,a,i){if(o!=null&&o.params){if(o.error){a.showNotification(o.error),cn(a,null),to(a);return}i(o,a)}}function eo(o,a){const i=St(),u=ot();return a.has_rms_discount?(o.params.new_discounts&&(i.extraDiscount=Number(o.params.new_total_cost)-a.initialCartPrice,u.totalPrice_lib=Number(o.params.new_total_cost),a.showNotification("К заказу были добавлены скидки")),!0):!1}const cn=(o,a)=>{o.updateOrderStatus&&o.updateOrderStatus(a)},wu=o=>{o.loadCart&&o.loadCart()},fi=o=>{o.resetBonuses&&o.resetBonuses()},to=o=>{o.closeWebSocket&&o.closeWebSocket()},Ws=(o,a)=>{o.is_tableservice&&(Cn(a),o.resetStores(),o.deleteCart(null,o.is_requestKiosk),o.cartCleanup?o.cartCleanup.cleanupAndNavigate("profile",o.is_requestKiosk):o.deleteCart("profile",o.is_requestKiosk))},Xs=(o,a,i,u)=>{const f=a.ws||i;En.create().orderPay(o.params.order_id||"").then(m=>{a.setOrderNumber&&a.setOrderNumber(m.data.order_number)}).catch(m=>{(a.errorHandler||u).handleOrderPayError(m,{...a,closeWebSocket:()=>Cn(f)})})},no=(o,a,i)=>{const u=o.ws||a;(o.errorHandler||i).handleOrderError({...o,closeWebSocket:()=>Cn(u)})},_u=(o,a,i)=>{const u=St(),f=u.getCurrentPaymentMethodId();if(!f||!Pn.getConfig(f)||!Pn.isMethodAvailable(f,o))return null;const m=Pn.createHandler(f);if(!m)return null;const w=u.createPaymentHandler(o,a,i,f);return w?{handler:m,config:w.config}:null},Cu=o=>{if(!zt)return;const a=zt.context,i=zt.is_requestKiosk,u=zt.is_tableservice,f=_u(a,i,u);if(!f){console.warn("handleWebSocketMessageWithDynamicHandler: не удалось получить handler");return}const{handler:h,config:m}=f,w={...m,...zt};xu(o,w,h.handleWebSocketStatus)};async function Eu(o,a,i,u){var C,y;const{is_requestKiosk:f,is_tableservice:h}=i,{comment:m,is_authorized:w,signal:_}=u;i.setButtonDisabled(!0);const p=En.create();try{const N=await p.createOrder(o,a,f,m,w,h,_);if((N==null?void 0:N.status)===201&&((C=N==null?void 0:N.data)!=null&&C.id)){const B=N.data.id,R={...i,signal:_};zt=R;const D=`wss://${R.area||""}/ws/order/${B}/`;Sn=ti(D,{signal:_});const v=()=>{console.warn("WebSocket connection opened (centralized mode)")},M=V=>{var te;console.error("WebSocket error (centralized mode):",V),Cn(Sn),Sn=null,zt=null,i.setButtonDisabled(!1),(te=i.errorHandler)==null||te.handlePaymentError(V,R)},k=V=>{Cu(V)};Sn.on("open",v),Sn.on("message",k),Sn.on("error",M),Sn.connect(),zt.ws=Sn,zt.closeWebSocket=()=>{Cn(Sn),Sn=null,zt=null}}return N}catch(N){throw et.isCancel(N)||((y=i.errorHandler)==null||y.handleCreateOrderError(N,i),i.setButtonDisabled(!1)),N}}const js=o=>{var a,i;return((i=(a=o==null?void 0:o.response)==null?void 0:a.data)==null?void 0:i.user_friendly_message)||null};function hi(){const o=St();return{handlePaymentError(a,i){var f,h,m,w,_,p;const u=js(a);cn(i,null),wu(i),u?(i.showNotification(u),to(i),i.is_requestKiosk&&((h=i.orderErrors)!=null&&h.includes((f=a.response)==null?void 0:f.status))&&(i.cartCleanup?i.cartCleanup.cleanupAndNavigate("retryPage",i.is_requestKiosk):i.deleteCart("retryPage",i.is_requestKiosk)),i.is_tableservice?i.resetStores():(fi(i),i.context==="qr"&&i.navigation?i.navigation.redirectToError():i.context==="qr"&&i.redirect&&(o.isButtonDisabled=!1,i.redirect(`/${((w=(m=i.route)==null?void 0:m.params)==null?void 0:w.orgId)||""}/errorPayment`)))):i.context==="qr"&&(fi(i),i.navigation?i.navigation.redirectToError():i.redirect&&i.redirect(`/${((p=(_=i.route)==null?void 0:_.params)==null?void 0:p.orgId)||""}/errorPayment`)),o.isButtonDisabled=!1},handleOrderPayError(a,i){var f,h,m,w;const u=js(a);u&&(i.showNotification(u),to(i),i.is_requestKiosk?((h=i.orderErrors)!=null&&h.includes((f=a.response)==null?void 0:f.status)&&(i.cartCleanup.cleanupAndNavigate("retryPage",i.is_requestKiosk),i.deleteCart("retryPage",i.is_requestKiosk)),cn(i,null)):(fi(i),i.navigation?i.navigation.redirectToError():i.redirect&&i.redirect(`/${((w=(m=i.route)==null?void 0:m.params)==null?void 0:w.orgId)||""}/errorPayment`),cn(i,null)))},handleOrderError(a){var i,u;a.is_requestKiosk?a.cartCleanup?a.cartCleanup.cleanupAndNavigate("retryPage",a.is_requestKiosk):a.deleteCart("retryPage",a.is_requestKiosk):a.is_tableservice?a.showNotification("Ошибка создания заказа. Пожалуйста, попробуйте еще раз"):(fi(a),a.navigation?a.navigation.redirectToError():a.redirect&&(o.isButtonDisabled=!1,a.redirect(`/${((u=(i=a.route)==null?void 0:i.params)==null?void 0:u.orgId)||""}/errorPayment`)))},handleCreateOrderError(a,i){var m,w,_,p,C,y;const{is_requestKiosk:u,is_tableservice:f}=i,h=i.route.params.orgId;u?(((m=a==null?void 0:a.response)==null?void 0:m.status)===403&&((w=i.on403Kiosk)==null||w.call(i),(_=i.redirect)==null||_.call(i,`/${h}/retryPage`)),i.deleteCart("retryPage",u)):f?i.showNotification(((C=(p=a==null?void 0:a.response)==null?void 0:p.data)==null?void 0:C.user_friendly_message)||"Ошибка создания заказа"):(y=i.redirect)==null||y.call(i,`/${h}/errorPayment`)}}}const yu=()=>{const o=St();let a=null;const i=hi(),u=(f,h)=>{var w,_;const m=(w=f.params)==null?void 0:w.status;if(m==="sent"){if(eo(f,h)){o.isButtonDisabled=!1;return}Lr(f.params.order_id||"",h.method).catch(p=>{const C=h.errorHandler||i,y=h.ws||a;C.handlePaymentError(p,{...h,closeWebSocket:()=>Cn(y)})})}else if(m==="waiting_for_fiscalization")cn(h,1);else if(m==="payment_initiation_retry"||m==="fiscalized")Xs(f,h,a,i);else if(m==="payment_initiation")cn(h,2);else if(m==="paid"){cn(h,3);const p=h.ws||a;Cn(p),localStorage.removeItem("cart")}else(_=h.orderErrors)!=null&&_.includes(m)&&no(h,a,i)};return{handleWebSocketStatus(f,h){u(f,h)}}};function bu(){const o=St();let a=null;const i=hi(),u=(f,h)=>{var w,_,p,C;const m=(w=f.params)==null?void 0:w.status;if((_=f.params)!=null&&_.number&&(o.orderNumber=(p=f.params)==null?void 0:p.number),m==="sent"){if(eo(f,h)){o.isButtonDisabled=!1;return}Lr(f.params.order_id||"",h.method).catch(y=>{const N=h.errorHandler||i,B=h.ws||a;N.handlePaymentError(y,{...h,closeWebSocket:()=>Cn(B)})})}else if(m==="sent_fiscalization")cn(h,1);else if(m==="waiting_payment")cn(h,4);else if(m==="paid"){cn(h,3);const y=h.ws||a;Cn(y),localStorage.removeItem("cart")}else(C=h.orderErrors)!=null&&C.includes(m)&&(o.isButtonDisabled=!1,no(h,a,i))};return{handleWebSocketStatus(f,h){u(f,h)}}}const Au=()=>{const o=St();let a=null;const i=hi(),u=(f,h)=>{var w,_;const m=(w=f.params)==null?void 0:w.status;if(m==="sent"){if(eo(f,h)){o.isButtonDisabled=!1;return}Lr(f.params.order_id||"",h.method).then(p=>{if(h.is_tableservice){const C=h.ws||a;Ws(h,C)}else p.url&&window.location.replace(p.url)}).catch(p=>{const C=h.errorHandler||i,y=h.ws||a;C.handlePaymentError(p,{...h,closeWebSocket:()=>Cn(y)})})}else if(m==="payment_initiation_retry"||m==="fiscalized")Xs(f,h,a,i);else if(m==="payment_initiation")cn(h,2);else if(m==="paid"){cn(h,3);const p=h.ws||a;Cn(p),localStorage.removeItem("cart")}else(_=h.orderErrors)!=null&&_.includes(m)&&(o.isButtonDisabled=!1,no(h,a,i))};return{handleWebSocketStatus(f,h){u(f,h)}}};class Pn{static initialize(){this.register({id:"TERMINAL_BASE",method:"TERMINAL",handlerFactory:yu,availableContexts:["kiosk"]}),this.register({id:"YOOKASSA_BASE",method:"YOOKASSA",handlerFactory:Au,availableContexts:["qr","tableservice"]}),this.register({id:"SBP",method:"YOOKASSA",handlerFactory:bu,availableContexts:["kiosk"]})}static register(a){this.methods.set(a.id,a)}static getConfig(a){return this.methods.get(a)??null}static getAvailableMethods(a){return Array.from(this.methods.entries()).filter(([i,u])=>u.availableContexts.includes(a)).map(([i])=>i)}static isMethodAvailable(a,i){const u=this.getConfig(a);return u?u.availableContexts.includes(i):!1}static createHandler(a){const i=this.getConfig(a);return i?i.handlerFactory():(console.warn(`PaymentMethodRegistry: метод оплаты ${a} не зарегистрирован`),null)}}We(Pn,"methods",new Map),Pn.initialize();function Iu(o){return{cleanupAndNavigate(a,i){o.deleteCart(a,i)},cleanup(a){o.deleteCart(null,a)},clearTokens(){o.deleteCart(null,!0)},resetStores(){o.resetStores()}}}function Su(o){var i,u;const a=((u=(i=o.route)==null?void 0:i.params)==null?void 0:u.orgId)||"";return{redirectToError(){const f=`/${a}/errorPayment`;o.redirect?o.redirect(f):o.router&&o.router.push(f)},redirectToSuccess(f){const h=f?`/${a}/${f}`:`/${a}/profile`;o.redirect?o.redirect(h):o.router&&o.router.push(h)},redirect(f){o.redirect?o.redirect(f):o.router&&o.router.push(f)},getErrorPath(){return`/${a}/errorPayment`},getSuccessPath(){return`/${a}/profile`}}}const St=xe.defineStore("cartLib",()=>{const o=Re.useRouter(),a=Re.useRoute(),i=It(),u=ot(),{config_lib:f,countBonus:h,totalPrice_lib:m,initialCartPrice_lib:w,is18Allowed:_}=xe.storeToRefs(u),{itemThemes:p}=xe.storeToRefs(i),C=l.ref(!1),y=l.ref(""),N=l.ref(null),B=l.ref("wait"),R=l.ref(!1),P=l.ref(0),D=l.ref(""),v=l.ref([]),M=l.ref([]),k=l.ref(),V=l.ref(0),te=l.ref(!1),ne=l.ref(),U=l.ref(null),ie=l.ref(["failed_payment","failed_after_paid","failed","failed_after_sent","failed_after_sent_fiscalization","payment_initiation_retry"]),z=l.ref("Оплатить"),oe=l.ref(),G=l.computed({get:()=>v.value||[],set:Oe=>{(Oe==null?void 0:Oe.length)===1&&(oe.value=Oe[0]),v.value=Oe}}),W=l.ref(!1),Z=l.ref(null),X=l.ref(0),S=l.ref(!1),$=l.ref({textNotification:""}),H=Oe=>{S.value=!0,$.value.textNotification=Oe},ee=()=>{var Oe,Ze;return(Oe=k.value)!=null&&Oe.front_type?k.value.front_type:((Ze=M.value[0])==null?void 0:Ze.front_type)||null},j=(Oe,Ze,me,qe)=>{var jt;const Ee=qe??((jt=M.value[0])==null?void 0:jt.front_type);if(!Ee)return console.warn("Не удалось определить метод оплаты"),null;const mt=Pn.getConfig(Ee);if(!mt||!Pn.isMethodAvailable(Ee,Oe))return console.warn(`Метод ${Ee} недоступен для контекста ${Oe}`),null;const nt=Pn.createHandler(Ee);return nt?(ne.value=re(mt.method,Oe,Ze,me),{handler:nt,config:ne.value}):(console.warn(`Не удалось создать обработчик для метода ${Ee}`),null)},re=(Oe,Ze,me,qe)=>{const Ee={method:Oe,context:Ze,is_requestKiosk:me,is_tableservice:qe,router:o,route:a,orderErrors:ie.value,area:f.value.area,has_rms_discount:f.value.has_rms_discount,totalPrice:m,initialCartPrice:w,showNotification:H,deleteCart:Xe,resetStores:dt,redirect:st=>o.push(st),updateOrderStatus:st=>{Z.value=st},setOrderNumber:st=>{U.value=st},loadCart:()=>u.loadCart(),resetBonuses:()=>{h.value=0}},mt=hi(),nt=Iu(Ee),jt=Su(Ee);return{...Ee,errorHandler:mt,cartCleanup:nt,navigation:jt}},ge=l.computed(()=>!!N.value),we=Oe=>{B.value=Oe},Ne=Oe=>{N.value=Oe},_e=()=>{p.value.kiosk_show_loyalty_card_button&&p.value.kiosk_show_loyalty_phone_input_button?C.value=!0:!p.value.kiosk_show_loyalty_card_button&&p.value.kiosk_show_loyalty_phone_input_button?u.is_OpenLoyal=!0:C.value=!0,B.value="wait",y.value=""},Me=()=>{C.value=!1,B.value="wait",y.value=""},fe=()=>{N.value=null,y.value="",B.value="wait",Me()},dt=()=>{W.value=!1,Z.value=null},Xe=(Oe=null,Ze=!1)=>{u.cartProducts_lib=[],dr(["cart"]),Ze&&(dr(["authTokensAccess","authTokensRefresh","user"]),u.profile=null,sessionStorage.removeItem("is_adult"),_.value=!1),Oe&&o.push(`/${a.params.orgId}/${Oe}`)};return{isButtonDisabled:W,orderCompleted_lib:Z,extraDiscount:P,orderNumber:U,is_notification_lib:S,notificationData_lib:$,textPaymentBtn_lib:z,count:X,guestInfo:N,error:y,isDrawerOpen:C,currentState:B,isAuthorized:ge,discountBtn:R,linkQR:D,orderTypes:G,providerTypes:M,is_paymentCart:te,selectedOrderType:oe,selectedProvider:k,configPayment:ne,paymentCostQR:V,deleteCart:Xe,setGuestInfo:Ne,setState:we,openDrawer:_e,closeDrawer:Me,clearCard:fe,showNotification:H,createPaymentHandler:j,getCurrentPaymentMethodId:ee,getAvailablePaymentMethods:Oe=>Pn.getAvailableMethods(Oe)}}),Rt=xe.defineStore("cardLib",()=>{var oe;const o=()=>({openCard:null,currentModifier:null,groupModifiers:[],groupModifiersSelected:[],groupCurrentOpen:null,isModifiedAmount:!1,selectedSize:{},productSizes:[],addedProducts:[],plusButtonsRefs:[],modalCount:1,isSectionModifier:!1,isAnimationFly:!0,textErrorRequaired:""}),a=It(),i=l.ref(o()),u=()=>i.value=o(),f=l.ref(!1),h=l.ref(!1),m=l.ref(!1),w=l.ref(),_=l.ref([]),p=l.ref({id:null,visible:!1}),C=l.ref(!((oe=a.itemThemes)!=null&&oe.kiosk_disable_lock_screen)),y=l.computed(()=>{const G=i.value.groupModifiersSelected.findIndex(W=>W.group===i.value.groupCurrentOpen.id);return N(G)}),N=G=>G===-1?0:(i.value.groupModifiersSelected[G].modifiers||[]).reduce((Z,X)=>Z+(X.amount||0),0),B=l.computed(()=>{var W;const G=(W=i.value.openCard)==null?void 0:W.group_modifiers.findIndex(Z=>Z.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((Z,X)=>Z+X.max_amount,0):i.value.groupModifiers[G].max_amount}),R=l.computed(()=>{var W;const G=(i.value.addedProducts??[]).reduce((Z,X)=>Z+X.price,0);if(i.value.openCard){const Z=i.value.openCard,X=ur(Z)||0,S=Z.amount||1;return(i.value.groupModifiersSelected.reduce((H,ee)=>(ee.modifiers.forEach(j=>{var re,ge;j.sizes&&(j.price=((ge=(re=j.sizes)==null?void 0:re.find(we=>we.id===i.value.selectedSize.id))==null?void 0:ge.price)??j.price),H+=j.price*j.amount}),H),0)+X)*S+G}return(W=i.value.addedProducts)!=null&&W.length?G:0}),P=l.computed(()=>{const G=i.value.groupModifiers,W=i.value.groupModifiersSelected;for(let Z=0;Z<G.length;Z++){const X=G[Z],S=W[Z];if(X.min_amount>0&&N(Z)<X.min_amount)return i.value.textErrorRequaired=`В группе "${X.name}" должно содержаться не меньше ${X.min_amount} модификатора(ов)`,{haveRequaire:!0,group:X};for(const $ of X.group_modifiers)if($.min_amount>0){const H=S.modifiers.find(ee=>ee.id===$.id);if(!H||H.amount<$.min_amount)return i.value.textErrorRequaired=`В группе "${X.name}" выберите все обязательные модификаторы`,{haveRequaire:!0,group:X}}}return{haveRequaire:!1,group:G[0]}}),D=()=>{i.value.groupModifiers.forEach((G,W)=>{i.value.groupCurrentOpen={...G,index:W},G.group_modifiers.forEach(Z=>{Z.default_amount>0&&(Z.amount=Z.default_amount,ie(Z,!0))})})},v=G=>{i.value.addedProducts.push(G)},M=G=>{i.value.openCard=G},k=G=>{_.value=[...G]},V=(G,W)=>{var X,S;const Z=G.id!==((X=i.value.groupCurrentOpen)==null?void 0:X.id);i.value.groupCurrentOpen={...G,index:W},Z?i.value.isSectionModifier=!0:i.value.isSectionModifier=!i.value.isSectionModifier,(S=i.value.plusButtonsRefs[W])==null||S.scrollIntoView({behavior:"smooth",block:"start"})},te=()=>{i.value.modalCount>i.value.currentModifier.min_amount&&i.value.modalCount>=2&&(i.value.modalCount-=1)},ne=()=>{i.value.groupCurrentOpen&&i.value.modalCount+y.value<B.value&&(i.value.currentModifier.max_amount===0||i.value.currentModifier.max_amount>i.value.modalCount)&&(i.value.modalCount+=1)},U=(G,W)=>{var X;const Z=(X=i.value.groupCurrentOpen)==null?void 0:X.id.toUpperCase();if(!G&&!i.value.isModifiedAmount&&W.max_amount!==1){if(Z==="Добавки2000"&&W.max_amount>1)return!0;if(Math.abs(B.value-y.value)>1&&Z!=="Добавки2000")return!0}return!1},ie=(G,W=!1)=>{i.value.modalCount=1,i.value.currentModifier=G;const Z=i.value.groupModifiersSelected.findIndex(X=>X.group===i.value.groupCurrentOpen.id);z(Z,G,W)},z=(G,W,Z)=>{var S,$;let X=i.value.groupModifiersSelected;if(W.sizes.length>0&&W.sizes.find(H=>{var ee;return H.id===((ee=i.value.selectedSize)==null?void 0:ee.id)}),G===-1)U(Z,W)?i.value.isModifiedAmount=!0:X[i.value.groupCurrentOpen.index]={group:i.value.groupCurrentOpen.id,is_fake:((S=i.value.groupCurrentOpen)==null?void 0:S.is_fake)||!1,is_product_determining:(($=i.value.groupCurrentOpen)==null?void 0:$.is_product_determining)||!1,modifier_count:0,modifiers:[{...W,amount:(W==null?void 0:W.amount)??1}]};else{const H=i.value.groupModifiers[G].group_modifiers.findIndex(j=>j.id===W.id);if(X[G].modifiers.findIndex(j=>j.id===W.id)===-1){if(B.value===1)X[G].modifiers=[];else if(y.value>=B.value)return;U(Z,W)?i.value.isModifiedAmount=!0:(X[G].modifiers.push({...W,amount:(W==null?void 0:W.amount)??1}),X[G].modifier_count=X[G].modifiers.reduce((j,re)=>j+=re.amount,0),i.value.isAnimationFly=!0)}else X[G].modifiers=X[G].modifiers.filter(j=>j.id!==W.id),X[G].modifier_count=X[G].modifiers.reduce((j,re)=>j+=re.amount,0),i.value.groupModifiers[G].group_modifiers[H].amount=1,i.value.groupModifiers[G].group_modifiers[H].default_amount=0,i.value.isAnimationFly=!1}i.value.groupModifiersSelected=X};return{stateCard:i,totalPrice_libCard:R,recountGroupTotalAmount:y,groupTotalAmount:B,isOpenWindow:f,isUpSale:h,checkedRequiredBtn:P,dataUpSale:w,productCards:_,isAddToCard:m,openProduct:p,is_startPage:C,setProduct:k,summModifierAmount:N,setAddedProducts:v,setCurrentCard:M,minusAmount:te,plusAmount:ne,toggleNotRequire:V,modifierSelect:ie,defaultAmountModifiers:D,reset:u}});var mr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Zs(o){return o&&o.__esModule&&Object.prototype.hasOwnProperty.call(o,"default")?o.default:o}var qs={exports:{}};(function(o,a){(function(i,u){o.exports=u()})(mr,function(){var i=1e3,u=6e4,f=36e5,h="millisecond",m="second",w="minute",_="hour",p="day",C="week",y="month",N="quarter",B="year",R="date",P="Invalid Date",D=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,v=/\[([^\]]+)]|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(X){var S=["th","st","nd","rd"],$=X%100;return"["+X+(S[($-20)%10]||S[$]||S[0])+"]"}},k=function(X,S,$){var H=String(X);return!H||H.length>=S?X:""+Array(S+1-H.length).join($)+X},V={s:k,z:function(X){var S=-X.utcOffset(),$=Math.abs(S),H=Math.floor($/60),ee=$%60;return(S<=0?"+":"-")+k(H,2,"0")+":"+k(ee,2,"0")},m:function X(S,$){if(S.date()<$.date())return-X($,S);var H=12*($.year()-S.year())+($.month()-S.month()),ee=S.clone().add(H,y),j=$-ee<0,re=S.clone().add(H+(j?-1:1),y);return+(-(H+($-ee)/(j?ee-re:re-ee))||0)},a:function(X){return X<0?Math.ceil(X)||0:Math.floor(X)},p:function(X){return{M:y,y:B,w:C,d:p,D:R,h:_,m:w,s:m,ms:h,Q:N}[X]||String(X||"").toLowerCase().replace(/s$/,"")},u:function(X){return X===void 0}},te="en",ne={};ne[te]=M;var U="$isDayjsObject",ie=function(X){return X instanceof W||!(!X||!X[U])},z=function X(S,$,H){var ee;if(!S)return te;if(typeof S=="string"){var j=S.toLowerCase();ne[j]&&(ee=j),$&&(ne[j]=$,ee=j);var re=S.split("-");if(!ee&&re.length>1)return X(re[0])}else{var ge=S.name;ne[ge]=S,ee=ge}return!H&&ee&&(te=ee),ee||!H&&te},oe=function(X,S){if(ie(X))return X.clone();var $=typeof S=="object"?S:{};return $.date=X,$.args=arguments,new W($)},G=V;G.l=z,G.i=ie,G.w=function(X,S){return oe(X,{locale:S.$L,utc:S.$u,x:S.$x,$offset:S.$offset})};var W=function(){function X($){this.$L=z($.locale,null,!0),this.parse($),this.$x=this.$x||$.x||{},this[U]=!0}var S=X.prototype;return S.parse=function($){this.$d=function(H){var ee=H.date,j=H.utc;if(ee===null)return new Date(NaN);if(G.u(ee))return new Date;if(ee instanceof Date)return new Date(ee);if(typeof ee=="string"&&!/Z$/i.test(ee)){var re=ee.match(D);if(re){var ge=re[2]-1||0,we=(re[7]||"0").substring(0,3);return j?new Date(Date.UTC(re[1],ge,re[3]||1,re[4]||0,re[5]||0,re[6]||0,we)):new Date(re[1],ge,re[3]||1,re[4]||0,re[5]||0,re[6]||0,we)}}return new Date(ee)}($),this.init()},S.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()},S.$utils=function(){return G},S.isValid=function(){return this.$d.toString()!==P},S.isSame=function($,H){var ee=oe($);return this.startOf(H)<=ee&&ee<=this.endOf(H)},S.isAfter=function($,H){return oe($)<this.startOf(H)},S.isBefore=function($,H){return this.endOf(H)<oe($)},S.$g=function($,H,ee){return G.u($)?this[H]:this.set(ee,$)},S.unix=function(){return Math.floor(this.valueOf()/1e3)},S.valueOf=function(){return this.$d.getTime()},S.startOf=function($,H){var ee=this,j=!!G.u(H)||H,re=G.p($),ge=function(Oe,Ze){var me=G.w(ee.$u?Date.UTC(ee.$y,Ze,Oe):new Date(ee.$y,Ze,Oe),ee);return j?me:me.endOf(p)},we=function(Oe,Ze){return G.w(ee.toDate()[Oe].apply(ee.toDate("s"),(j?[0,0,0,0]:[23,59,59,999]).slice(Ze)),ee)},Ne=this.$W,_e=this.$M,Me=this.$D,fe="set"+(this.$u?"UTC":"");switch(re){case B:return j?ge(1,0):ge(31,11);case y:return j?ge(1,_e):ge(0,_e+1);case C:var dt=this.$locale().weekStart||0,Xe=(Ne<dt?Ne+7:Ne)-dt;return ge(j?Me-Xe:Me+(6-Xe),_e);case p:case R:return we(fe+"Hours",0);case _:return we(fe+"Minutes",1);case w:return we(fe+"Seconds",2);case m:return we(fe+"Milliseconds",3);default:return this.clone()}},S.endOf=function($){return this.startOf($,!1)},S.$set=function($,H){var ee,j=G.p($),re="set"+(this.$u?"UTC":""),ge=(ee={},ee[p]=re+"Date",ee[R]=re+"Date",ee[y]=re+"Month",ee[B]=re+"FullYear",ee[_]=re+"Hours",ee[w]=re+"Minutes",ee[m]=re+"Seconds",ee[h]=re+"Milliseconds",ee)[j],we=j===p?this.$D+(H-this.$W):H;if(j===y||j===B){var Ne=this.clone().set(R,1);Ne.$d[ge](we),Ne.init(),this.$d=Ne.set(R,Math.min(this.$D,Ne.daysInMonth())).$d}else ge&&this.$d[ge](we);return this.init(),this},S.set=function($,H){return this.clone().$set($,H)},S.get=function($){return this[G.p($)]()},S.add=function($,H){var ee,j=this;$=Number($);var re=G.p(H),ge=function(_e){var Me=oe(j);return G.w(Me.date(Me.date()+Math.round(_e*$)),j)};if(re===y)return this.set(y,this.$M+$);if(re===B)return this.set(B,this.$y+$);if(re===p)return ge(1);if(re===C)return ge(7);var we=(ee={},ee[w]=u,ee[_]=f,ee[m]=i,ee)[re]||1,Ne=this.$d.getTime()+$*we;return G.w(Ne,this)},S.subtract=function($,H){return this.add(-1*$,H)},S.format=function($){var H=this,ee=this.$locale();if(!this.isValid())return ee.invalidDate||P;var j=$||"YYYY-MM-DDTHH:mm:ssZ",re=G.z(this),ge=this.$H,we=this.$m,Ne=this.$M,_e=ee.weekdays,Me=ee.months,fe=ee.meridiem,dt=function(Ze,me,qe,Ee){return Ze&&(Ze[me]||Ze(H,j))||qe[me].slice(0,Ee)},Xe=function(Ze){return G.s(ge%12||12,Ze,"0")},Oe=fe||function(Ze,me,qe){var Ee=Ze<12?"AM":"PM";return qe?Ee.toLowerCase():Ee};return j.replace(v,function(Ze,me){return me||function(qe){switch(qe){case"YY":return String(H.$y).slice(-2);case"YYYY":return G.s(H.$y,4,"0");case"M":return Ne+1;case"MM":return G.s(Ne+1,2,"0");case"MMM":return dt(ee.monthsShort,Ne,Me,3);case"MMMM":return dt(Me,Ne);case"D":return H.$D;case"DD":return G.s(H.$D,2,"0");case"d":return String(H.$W);case"dd":return dt(ee.weekdaysMin,H.$W,_e,2);case"ddd":return dt(ee.weekdaysShort,H.$W,_e,3);case"dddd":return _e[H.$W];case"H":return String(ge);case"HH":return G.s(ge,2,"0");case"h":return Xe(1);case"hh":return Xe(2);case"a":return Oe(ge,we,!0);case"A":return Oe(ge,we,!1);case"m":return String(we);case"mm":return G.s(we,2,"0");case"s":return String(H.$s);case"ss":return G.s(H.$s,2,"0");case"SSS":return G.s(H.$ms,3,"0");case"Z":return re}return null}(Ze)||re.replace(":","")})},S.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},S.diff=function($,H,ee){var j,re=this,ge=G.p(H),we=oe($),Ne=(we.utcOffset()-this.utcOffset())*u,_e=this-we,Me=function(){return G.m(re,we)};switch(ge){case B:j=Me()/12;break;case y:j=Me();break;case N:j=Me()/3;break;case C:j=(_e-Ne)/6048e5;break;case p:j=(_e-Ne)/864e5;break;case _:j=_e/f;break;case w:j=_e/u;break;case m:j=_e/i;break;default:j=_e}return ee?j:G.a(j)},S.daysInMonth=function(){return this.endOf(y).$D},S.$locale=function(){return ne[this.$L]},S.locale=function($,H){if(!$)return this.$L;var ee=this.clone(),j=z($,H,!0);return j&&(ee.$L=j),ee},S.clone=function(){return G.w(this.$d,this)},S.toDate=function(){return new Date(this.valueOf())},S.toJSON=function(){return this.isValid()?this.toISOString():null},S.toISOString=function(){return this.$d.toISOString()},S.toString=function(){return this.$d.toUTCString()},X}(),Z=W.prototype;return oe.prototype=Z,[["$ms",h],["$s",m],["$m",w],["$H",_],["$W",p],["$M",y],["$y",B],["$D",R]].forEach(function(X){Z[X[1]]=function(S){return this.$g(S,X[0],X[1])}}),oe.extend=function(X,S){return X.$i||(X(S,W,oe),X.$i=!0),oe},oe.locale=z,oe.isDayjs=ie,oe.unix=function(X){return oe(1e3*X)},oe.en=ne[te],oe.Ls=ne,oe.p={},oe})})(qs);var Nu=qs.exports;const Ys=Zs(Nu),Tu=o=>{const a=Re.useRouter(),i=`${o.domain}/api/`,u=et.create({baseURL:i}),f=et.create({baseURL:i}),h=et.create({baseURL:i}),m=et.create({baseURL:i}),w=et.create({baseURL:i}),_=et.create({baseURL:i}),p=et.create({baseURL:i}),C=M=>{try{const k=JSON.parse(localStorage.getItem("authTokensAccess")||"");k.length>0&&(M.headers.Authorization=`Bearer ${k}`)}catch{console.warn("accessToken is undefined [useAxios]")}return M},y=M=>{const k=localStorage.getItem("apiKey"),V=(k==null?void 0:k.replace(/^.(.*).$/,"$1"))||"";return M.headers={"Content-Type":"application/json","x-api-key":V},M},N=async M=>{if(!o.user)return M;const k=o.user.exp??0;if(!(Ys.unix(k).diff(Ys())<3e3))return M;const te=is("authTokensRefresh",null,"string");try{const ne=await et.post(`${i}user/token/refresh/`,{refresh:te.value});if(!ne.data.access)return v(),M;localStorage.setItem("authTokensAccess",JSON.stringify(ne.data.access)),P(ne.data),D(rs(ne.data.access)),M.headers={...M.headers,Authorization:`Bearer ${ne.data.access}`}}catch(ne){console.error("Failed to refresh token:",ne),v()}return M},B=M=>{M.interceptors.request.use(k=>N(C(k)),k=>Promise.reject(k))};B(h),B(w),B(p);const R=M=>{M.interceptors.request.use(k=>y(k))};R(_),R(f),R(p);const P=(M,k=!1)=>{localStorage.setItem("authTokensAccess",JSON.stringify(M.access)),k&&localStorage.setItem("authTokensRefresh",JSON.stringify(M.refresh))},D=M=>{o.user=M,localStorage.setItem("user",JSON.stringify(M))},v=()=>{o.user=null,dr(["authTokensAccess","authTokensRefresh","user","cart","bonus"]),sessionStorage.removeItem("is_adult"),a.replace({name:"home"}).then(()=>window.location.reload())};return{axiosInstanceAuthenticationGet:h,axiosInstanceAuthenticationPost:w,axiosInstanceAuthenticationPostApiKey:p,axiosInstancePost:m,axiosInstanceGet:u,axiosInstanceGetApiKey:f,axiosInstancePostApiKey:_}},$s=(o="themeConfig")=>{try{const a=localStorage.getItem(o);return a?JSON.parse(a):null}catch{return null}},Le=class Le{constructor(){We(this,"axiosInstanceGet");We(this,"axiosInstancePost");We(this,"axiosInstanceAuthenticationGet");We(this,"axiosInstanceAuthenticationPost");We(this,"axiosInstanceGetApiKey");We(this,"axiosInstancePostApiKey");We(this,"axiosInstanceAuthenticationPostApiKey");We(this,"currentUpsaleController",null);We(this,"controller",new AbortController);this.axiosInstanceGet=Le._axiosGet,this.axiosInstancePost=Le._axiosPost,this.axiosInstanceGetApiKey=Le._axiosPostApiKey,this.axiosInstancePostApiKey=Le._axiosPostApiKey,this.axiosInstanceAuthenticationPostApiKey=Le._axiosAuthPostApiKey,this.axiosInstanceAuthenticationGet=Le._axiosAuthGet,this.axiosInstanceAuthenticationPost=Le._axiosAuthPost}static create(a){return a&&!Le._config&&Le._initialize(a),Le._config||console.warn("InitConnection не инициализирован"),new Le}static _initialize(a,i=null){const u=ot(),f=Rt(),{config_lib:h}=xe.storeToRefs(u),{stateCard:m,recountGroupTotalAmount:w}=xe.storeToRefs(f);Le._config=a,Le._cardStore=f,Le._stateCard=m,Le._recountGroupTotalAmount=w,h.value=a;const _=Tu(a);Le._axiosPostApiKey=_.axiosInstanceGetApiKey,Le._axiosPostApiKey=_.axiosInstancePostApiKey,Le._axiosAuthPostApiKey=_.axiosInstanceAuthenticationPostApiKey,Le._axiosGet=_.axiosInstanceGet,Le._axiosPost=_.axiosInstancePost,Le._axiosAuthGet=_.axiosInstanceAuthenticationGet,Le._axiosAuthPost=_.axiosInstanceAuthenticationPost}get config(){return Le._config}get cardStore(){return Le._cardStore}get stateCard(){return Le._stateCard}get recountGroupTotalAmount(){return Le._recountGroupTotalAmount}async updateTheme(){var h,m;const a=$s(),i=It();if(a!==null){i.updateColor(a);return}const u=ot(),f=await((m=this.axiosInstanceGet)==null?void 0:m.get(`org/organizations/${(h=this.config)==null?void 0:h.orgId}/design/`));u.setStateDrum(f==null?void 0:f.data.hide_barban),u.setKioskTimeout(f==null?void 0:f.data.kiosk_timeout),localStorage.setItem("themeConfig",JSON.stringify(f.data)),i.updateColor(f.data)}async getGroupByID(a){var i,u;try{const f=await((u=this.axiosInstanceGet)==null?void 0:u.get(`${(i=this.config)==null?void 0:i.pointId}/group/${a}`));return f==null?void 0:f.data}catch(f){throw console.error("Ошибка в request.ts[getGroupByID]",f),f}}async loadGroupProducts(a){var i,u;try{const f=await((u=this.axiosInstanceGet)==null?void 0:u.get(`${(i=this.config)==null?void 0:i.pointId}/products/?group=${a}`)),h=(f==null?void 0:f.data)||[];for(const m of h)m&&await xl(m);return await this.cacheImagesInBackground(h),h}catch(f){return console.error("Ошибка загрузки группы:",f),[]}}async getGroup(){var a,i;try{const u=await((i=this.axiosInstanceGet)==null?void 0:i.get(`${(a=this.config)==null?void 0:a.pointId}/groups/`));return u==null?void 0:u.data}catch(u){return console.error("Error fetching products:",u),[]}}async fetchAndCacheAllPages(){var a,i;try{const u=((a=this.config)==null?void 0:a.pointId)||"",f=await Ui(u);if(f)return f.data;const h=await((i=this.axiosInstanceGet)==null?void 0:i.get(`${u}/group/`)),m=(h==null?void 0:h.data)||[],w=[];for(const _ of m){_.products=_.products||[],await kr(_.id,_),w.push(_);const p=await this.loadGroupProducts(_.id);_.products=p}return await this.cacheImagesInBackground(m),await kr(u,m),w}catch(u){return console.error("fetchAndCacheAllPages error:",u),[]}}cacheImagesInBackground(a){a.forEach(i=>{var u;i.video_link&&this.loadAndCacheMedia(i.video_link,i.id+"_video"),i.image_link&&this.loadAndCacheMedia(i.image_link,i.id+"_image"),(u=i.products)==null||u.forEach(f=>{f.video_link&&this.loadAndCacheMedia(f.video_link,f.id+"_video"),f.image_link&&this.loadAndCacheMedia(f.image_link,f.id+"_image")})})}async loadAndCacheMedia(a,i){const u=await cr(i);if(u){this.dispatchImageCachedEvent(i,u);return}try{const f=await fetch(a);if(!f.ok)throw new Error("Network error");const h=await f.blob();if(h.size===0)throw new Error("Empty blob");await Hi(i,h),this.dispatchImageCachedEvent(i,h)}catch(f){console.warn(`[ImageCache] Failed for ${i}:`,f)}}dispatchImageCachedEvent(a,i){window.dispatchEvent(new CustomEvent("image-cached",{detail:{id:a,blob:i}}))}async getProduct(a=null){var i,u;if(!a)return[];try{const f=await((u=this.axiosInstanceGet)==null?void 0:u.get(`${(i=this.config)==null?void 0:i.pointId}/products/${a}`));return f==null?void 0:f.data}catch(f){return console.error("Error fetching cardProducts:",f),[]}}async getSingleProduct(a){var f;const i=ot(),{config_lib:u}=xe.storeToRefs(i);try{let h=await qo(a);if(h)this._fullCardProduct(h);else{const m=await((f=this.axiosInstanceGet)==null?void 0:f.get(`${u.value.pointId}/products/${a}`));(m==null?void 0:m.status)===200&&this._fullCardProduct(m.data)}}catch(h){throw console.warn("store card[getFetchProducts]:",h),h}}_fullCardProduct(a){const i=Rt();i.stateCard.openCard={...a,amount:1},i.stateCard.groupModifiers=a.group_modifiers,a.modifiers.length>0&&i.stateCard.groupModifiers.unshift({default_amount:0,description:"",group_modifiers:a.modifiers,id:"Добавки2000",image_link:null,max_amount:1,min_amount:a.modifiers.reduce((u,f)=>u+=f.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=a.sizes,i.defaultAmountModifiers(),a.show_recommendations&&this.productUpsale(a.id)}async getTheme(){try{this.updateTheme()}catch(a){return console.error("Error fetching products:",a),[]}}async authorizeByCard(a){var i,u;try{const f=await((u=this.axiosInstanceAuthenticationPostApiKey)==null?void 0:u.post(`${(i=this.config)==null?void 0:i.domain}/api/user/validate-card/`,{card_number:a}));return localStorage.setItem("authTokensAccess",JSON.stringify(f==null?void 0:f.data.access)),localStorage.setItem("authTokensRefresh",JSON.stringify(f==null?void 0:f.data.refresh)),f==null?void 0:f.data}catch(f){throw console.error("Ошибка авторизации:",f),f}}async getLoyalSmsCode(a){var i,u;try{const f=await((u=this.axiosInstancePostApiKey)==null?void 0:u.post(`${(i=this.config)==null?void 0:i.domain}/api/device/auth/request-otp/`,{phone:a}));return f==null?void 0:f.data}catch(f){throw console.error("Ошибка получения sms-code:",f),f}}async sendSmsCodeForAuth(a,i){var u,f;try{const h=await((f=this.axiosInstanceAuthenticationPostApiKey)==null?void 0:f.post(`${(u=this.config)==null?void 0:u.domain}/api/device/auth/`,{code:a,phone:i}));return h==null?void 0:h.data}catch(h){throw console.error("Ошибка отправки sms-code:",h),h}}async callStaff(a,i,u){var f,h,m,w;try{const _=await((m=this.axiosInstancePost)==null?void 0:m.post(`${(f=this.config)==null?void 0:f.domain}/api/org_unit/${(h=this.config)==null?void 0:h.pointId}/table/${a}/call-staff/`,{...i},u));return(w=_==null?void 0:_.data)==null?void 0:w.response_text}catch(_){throw console.error("Ошибка[callStaff]",_),_}}async createOrder(a,i,u=!0,f,h=!1,m=!1,w){var P,D,v,M,k;const _=St(),p=h?this.axiosInstanceAuthenticationPostApiKey:this.axiosInstancePostApiKey,C=u?p:this.axiosInstanceAuthenticationPost,y=u?"/device/order/create":"/order/create",N=u?(P=this.config)==null?void 0:P.pointId:(D=this.config)==null?void 0:D.pointId,B={items:a,table:i||null,comment:f};return u&&((v=_.selectedOrderType)!=null&&v.id)&&(B.order_type_id=(M=_.selectedOrderType)==null?void 0:M.id),await(C==null?void 0:C.post(`${(k=this.config)==null?void 0:k.domain}/api/org_unit/${N}${y}`,B,{signal:w}))}async initPaymentLink(a,i){const u=this.axiosInstanceAuthenticationPost,f=ot(),h=await(u==null?void 0:u.post("payment/init",{by_bonuses:f.countBonus,order:a,provider_type:i}));return h==null?void 0:h.data}async orderPay(a){var i;return(i=this.axiosInstanceAuthenticationPostApiKey)==null?void 0:i.post(`order/${a}/pay/`,{order_id:a})}async getProfile(){var i,u;const a=await((u=this.axiosInstanceAuthenticationGet)==null?void 0:u.get(`user/current?organization=${(i=this.config)==null?void 0:i.orgId}`));if((a==null?void 0:a.status)===200){const f=ot();return f.profile=a.data,f.is18Allowed=sessionStorage.getItem("is_adult")==="true",a.data}else return a}async joinLoyalty(){var i;const a=await((i=this.axiosInstanceAuthenticationGet)==null?void 0:i.post("user/join-loyalty/"));return{success:(a==null?void 0:a.status)===200}}async isPhoneExist(a,i={}){var u,f;try{const h=await((f=this.axiosInstanceGet)==null?void 0:f.get("user/check-phone",{...i,params:{organization:(u=this.config)==null?void 0:u.orgId,phone:a}}));return(h==null?void 0:h.status)===200}catch{return!1}}async sendOTP(a,i={}){var f,h;const u=await((h=this.axiosInstancePost)==null?void 0:h.post("user/check-phone",{organization:(f=this.config)==null?void 0:f.orgId,phone:a},i));return u==null?void 0:u.data}async auth(a,i={}){var f,h;return await((h=this.axiosInstancePost)==null?void 0:h.post("user/auth",{organization:(f=this.config)==null?void 0:f.orgId,...a},i))}async signup(a,i={}){var f,h;return await((h=this.axiosInstancePost)==null?void 0:h.post("user/register",{organization:(f=this.config)==null?void 0:f.orgId,...a},i))}async calculateDiscount(a,i=!0,u=!1,f){var p,C;const h=u?this.axiosInstanceAuthenticationPostApiKey:this.axiosInstancePostApiKey,m=i?h:this.axiosInstanceAuthenticationPost,w=i?(p=this.config)==null?void 0:p.pointId:(C=this.config)==null?void 0:C.pointId,_=await(m==null?void 0:m.post(`/org_unit/${w}/cart/calculate-discount/`,a,{signal:f}));return(_==null?void 0:_.status)===200?_.data:_}async maxPayByBonuses(a,i=!0,u=!1,f){const h=ot(),m=u?this.axiosInstanceAuthenticationPostApiKey:this.axiosInstancePostApiKey,w=i?m:this.axiosInstanceAuthenticationPost,_=await(w==null?void 0:w.post("/cart/max-pay-by-bonuses/",{total_cart_price:a},{signal:f})),p=_==null?void 0:_.data;return h.profile&&p&&"balance"in p&&(h.profile.balance=p.balance),p}async getDeviceInfo(){var u;const a=St(),i=await((u=this.axiosInstanceGetApiKey)==null?void 0:u.get("/device/current/"));return(i==null?void 0:i.status)===200?(a.orderTypes=i.data.order_types,a.providerTypes=i.data.payment_provider_type,i.data):i}async productUpsale(a){var h,m,w;const i=Rt(),{dataUpSale:u}=xe.storeToRefs(i);(h=this.currentUpsaleController)==null||h.abort();const f=new AbortController;this.currentUpsaleController=f;try{const _=await((w=this.axiosInstanceGet)==null?void 0:w.get(`/${(m=this.config)==null?void 0:m.pointId}/products/${a}/recommendation/`,{signal:f.signal}));f.signal.aborted||(u.value=_==null?void 0:_.data)}catch(_){if(_.name==="AbortError"||_.name==="CanceledError"){console.warn("Upsale отменён — пришёл новый запрос");return}throw console.error("Ошибка upsale:",_),_}finally{this.currentUpsaleController===f&&(this.currentUpsaleController=null)}}};We(Le,"_config",null),We(Le,"_axiosGet"),We(Le,"_axiosGetApiKey"),We(Le,"_axiosPostApiKey"),We(Le,"_axiosAuthPostApiKey"),We(Le,"_axiosPost"),We(Le,"_axiosAuthGet"),We(Le,"_axiosAuthPost"),We(Le,"_cardStore",null),We(Le,"_stateCard",null),We(Le,"_recountGroupTotalAmount",null);let En=Le;const ku=l.defineComponent({__name:"UseScrollCenter",props:{axis:{},behavior:{},autoScroll:{type:Boolean},container:{},idActive:{},clearContainer:{type:Boolean}},setup(o,{expose:a}){const i=o,u=ot(),f=l.ref(null),h=async w=>{if(!f.value||!w)return;let _=window;i.container&&(_=typeof i.container=="string"?document.querySelector(i.container)||window:i.container);const p={behavior:i.behavior};if(i.axis==="x"){const C=_===window?window.innerWidth:_.clientWidth,y=w.offsetWidth;let N=w.offsetLeft;if(_!==window){const B=_.getBoundingClientRect();N=w.getBoundingClientRect().left-B.left+_.scrollLeft}N-=(C-y)/2,p.left=Math.max(0,N)}else{const C=_===window?window.innerHeight:_.clientHeight,y=w.offsetHeight;let N=w.offsetTop;if(_!==window){const B=_.getBoundingClientRect();N=w.getBoundingClientRect().top-B.top+_.scrollTop}N-=(C-y)/2,p.top=Math.max(0,N)}try{_===window?window.scrollTo(p):_.scrollTo(p)}catch(C){console.error("Scroll error:",C)}};l.onMounted(async()=>{if(i.autoScroll){let w=null;if(await l.nextTick(),u.activeScrolling_lib){const _=u.activeScrolling_lib.findIndex(p=>p.id===i.idActive);i.idActive?(w=document.getElementById(`scrolling${i.idActive}`),w&&_!==-1&&(u.activeScrolling_lib[_]=w)):u.activeScrolling_lib[_]&&(w=u.activeScrolling_lib[_]),h(w)}}});const m=async w=>{i.clearContainer&&(u.activeScrolling_lib=[]);const _=w.currentTarget;await l.nextTick(),u.activeScrolling_lib.includes(_)||u.activeScrolling_lib.push(_),h(_)};return a({scrollToElement:h}),(w,_)=>(l.openBlock(),l.createElementBlock("div",{ref_key:"wrapperRef",ref:f,class:"scroll-to-wrapper"},[l.renderSlot(w.$slots,"default",{handleTargetClick:m},void 0,!0)],512))}}),Ue=(o,a)=>{const i=o.__vccOpts||o;for(const[u,f]of a)i[u]=f;return i},ro=Ue(ku,[["__scopeId","data-v-b510c3f1"]]),Ru={},Ou={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 Bu(o,a){return l.openBlock(),l.createElementBlock("svg",Ou,[...a[0]||(a[0]=[l.createElementVNode("defs",null,null,-1),l.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 io=Ue(Ru,[["render",Bu]]),Mu=["id","onClick"],vu={class:"modified_plus_btn"},Du=["src"],Pu={key:2,class:"wrapper_modifier_item"},Lu={key:0,class:"modifier_item_n_wrapper"},Fu=["src"],Vu={key:1,class:"modifier_plus_item"},Uu=["src"],Hu=["src"],Ks=Ue(l.defineComponent({__name:"PlusModifier",props:{isSectionModifier:{type:Boolean},toggleNotRequire:{type:Function}},setup(o){const a=Rt(),i=It(),{stateCard:u}=xe.storeToRefs(a),{itemThemes:f}=xe.storeToRefs(i),h=l.ref([]),m=l.ref([]),w=l.ref(null),_=l.ref(null),p=y=>{y instanceof HTMLElement&&!h.value.includes(y)&&h.value.push(y)},C=y=>{_.value=y};return l.onMounted(async()=>{await l.nextTick(),u.value.plusButtonsRefs=h.value}),l.watchEffect(()=>{m.value=u.value.groupModifiersSelected,document.body.style.overflow=""}),l.onBeforeUnmount(()=>{h.value=[],u.value.plusButtonsRefs=[]}),(y,N)=>(l.openBlock(),l.createElementBlock("div",{class:l.normalizeClass({card_modified_wrapper_many:l.unref(u).groupModifiers.length>=5})},[l.unref(u).groupModifiersSelected?(l.openBlock(),l.createElementBlock("div",{key:0,class:l.normalizeClass(["card_modified_wrapper",[l.unref(u).groupModifiers.length<=4?"card_modified_wrapper_center":""]]),ref_key:"scrollPlusContainer",ref:w},[l.createVNode(ro,{axis:"x",behavior:"smooth",container:w.value,autoScroll:!0,idActive:_.value,clearContainer:!0},{default:l.withCtx(({handleTargetClick:B})=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(u).groupModifiers,(R,P)=>{var D,v;return l.openBlock(),l.createElementBlock("div",{class:"button_modified",key:R.id,ref_for:!0,ref:p,id:"scrolling"+R.id,"data-clickable":"true",onClick:M=>{o.toggleNotRequire&&o.toggleNotRequire(R,P),C(R.id),B(M)}},[l.createElementVNode("div",vu,[m.value[P].modifiers.length===0?(l.openBlock(),l.createElementBlock("div",{key:0,class:l.normalizeClass([{modified_plus_btn_active:R.id===((D=l.unref(u).groupCurrentOpen)==null?void 0:D.id)&&o.isSectionModifier},"modified_plus_active"])},[l.createVNode(io,{"aria-label":`Открыть группу модификаторов ${R.name}`},null,8,["aria-label"])],2)):m.value[P].modifiers.length===1?(l.openBlock(),l.createElementBlock("div",{key:1,class:l.normalizeClass(["modified_plus_btn modified_plus_btn_solo",{modified_plus_btn_active:R.id===((v=l.unref(u).groupCurrentOpen)==null?void 0:v.id)&&o.isSectionModifier}])},[l.createElementVNode("img",{src:m.value[P].modifiers[0].image_link||l.unref(f).fallback_image||"",alt:"Модификатор"},null,8,Du)],2)):(l.openBlock(),l.createElementBlock("div",Pu,[m.value[P].modifiers.length>2?(l.openBlock(),l.createElementBlock("div",Lu,[m.value[P].modifiers.length===3?(l.openBlock(),l.createElementBlock("img",{key:0,class:"modifier_plus_item modifier_item_three",src:m.value[P].modifiers[2].image_link||l.unref(f).fallback_image||""},null,8,Fu)):(l.openBlock(),l.createElementBlock("p",Vu," + "+l.toDisplayString(m.value[P].modifiers.length-2),1))])):l.createCommentVNode("",!0),l.createElementVNode("div",null,[m.value[P].modifiers.length>0?(l.openBlock(),l.createElementBlock("img",{key:0,src:m.value[P].modifiers[0].image_link||l.unref(f).fallback_image||"",class:"modifier_plus_item modifier_item_first"},null,8,Uu)):l.createCommentVNode("",!0),m.value[P].modifiers.length>1?(l.openBlock(),l.createElementBlock("img",{key:1,src:m.value[P].modifiers[1].image_link||l.unref(f).fallback_image||"",class:"modifier_plus_item modifier_item_second"},null,8,Hu)):l.createCommentVNode("",!0)])]))]),l.createElementVNode("p",null,l.toDisplayString(R.name),1)],8,Mu)}),128))]),_:1},8,["container","idActive"])],2)):l.createCommentVNode("",!0)],2))}}),[["__scopeId","data-v-589e71ca"]]),zu={},Gu={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 Wu(o,a){return l.openBlock(),l.createElementBlock("svg",Gu,[...a[0]||(a[0]=[l.createElementVNode("desc",null," Created with Pixso. ",-1),l.createElementVNode("defs",null,null,-1),l.createElementVNode("circle",{id:"Ellipse 1",cx:"10.923828",cy:"10.923462",r:"10.923489",fill:"#FF6D2E","fill-opacity":"1.000000"},null,-1),l.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 Fr=Ue(zu,[["render",Wu]]),Vr={mounted(o){o.muted=!0,o.setAttribute("muted","")}},Xu={class:"wrapper_modifiers"},ju={class:"wrapper_nutritional_value"},Zu={class:"nutritional_scheme"},qu={key:0,class:"nutritional_parameters"},Yu={key:1,class:"nutritional_parameters"},$u={key:2,class:"nutritional_parameters"},Ku={key:3,class:"nutritional_parameters"},Qu={ref:"modifierBody",class:"modifier_shadow"},Ju={class:"wrapper_modifiers_title"},e0={class:"wrapper_text_count_modifiers"},t0=["id","aria-label","onClick","onKeydown"],n0={key:0,class:"counter_modifier"},r0={class:"hide_image_corners"},i0=["src","alt"],o0={key:1,loop:"",autoplay:"",muted:"",playsinline:"",class:"card__video"},s0=["src"],a0={class:"modifier_title"},l0=Ue(l.defineComponent({__name:"SectionModifiers",emits:["close"],setup(o,{emit:a}){const i=a,u=It(),f=Rt(),{itemThemes:h}=xe.storeToRefs(u),{stateCard:m,recountGroupTotalAmount:w,groupTotalAmount:_}=xe.storeToRefs(f),p=l.ref(null),C=Wt.useTemplateRefsList(),y=N=>{if(!N)return;const B=m.value.groupModifiers.findIndex(M=>M.id===m.value.groupCurrentOpen.id),R=m.value.plusButtonsRefs[B]||m.value.plusButtonsRefs[0];if(!R)return;const P=N.getBoundingClientRect(),D=R.getBoundingClientRect(),v=N.cloneNode(!0);v.classList.add("flyer"),Object.assign(v.style,{width:`${P.width}px`,height:`${P.height}px`,left:`${P.left}px`,top:`${P.top}px`,position:"fixed",zIndex:"1000"}),document.body.appendChild(v),p.value=v,requestAnimationFrame(()=>{const M=D.left+D.width/3-(P.left+P.width/2),k=D.top+D.height/4-(P.top+P.height/2),V=D.width/P.width*.2;v.style.transform=`translate(${M}px, ${k}px) scale(${V})`,v.style.opacity="0.4",v.style.transition="transform 0.5s ease, opacity 0.5s ease"}),v.addEventListener("transitionend",()=>{v.remove(),p.value=null,R.classList.add("bump"),setTimeout(()=>R.classList.remove("bump"),300)},{once:!0})};return l.watch(()=>m.value.isAnimationFly,N=>{N===!0&&m.value.currentModifier&&(y(C.value.find(B=>B.id===m.value.currentModifier.id)),m.value.isAnimationFly=!1)}),(N,B)=>{var R,P,D,v,M,k,V,te,ne,U,ie,z;return l.openBlock(),l.createElementBlock("div",Xu,[l.createElementVNode("div",ju,[l.createElementVNode("div",{class:l.normalizeClass(["card_header_inner_back",[(R=l.unref(m).openCard)!=null&&R.proteins_amount?"card_header_inner_back_nutrients":""]]),"aria-label":"Закрыть выбор модификаторов",onClick:B[0]||(B[0]=oe=>i("close"))},[l.createVNode(Fr,{class:"arrow_bottom"})],2),l.createElementVNode("div",Zu,[(P=l.unref(m).openCard)!=null&&P.energy_amount?(l.openBlock(),l.createElementBlock("div",qu,[l.createElementVNode("b",null,l.toDisplayString((D=l.unref(m).openCard)==null?void 0:D.energy_amount),1),B[1]||(B[1]=l.createElementVNode("p",null,"Килокалории",-1))])):l.createCommentVNode("",!0),(v=l.unref(m).openCard)!=null&&v.proteins_amount?(l.openBlock(),l.createElementBlock("div",Yu,[l.createElementVNode("b",null,l.toDisplayString((M=l.unref(m).openCard)==null?void 0:M.proteins_amount),1),B[2]||(B[2]=l.createElementVNode("p",null,"Белки",-1))])):l.createCommentVNode("",!0),(k=l.unref(m).openCard)!=null&&k.fat_amount?(l.openBlock(),l.createElementBlock("div",$u,[l.createElementVNode("b",null,l.toDisplayString((V=l.unref(m).openCard)==null?void 0:V.fat_amount),1),B[3]||(B[3]=l.createElementVNode("p",null,"Жиры",-1))])):l.createCommentVNode("",!0),(te=l.unref(m).openCard)!=null&&te.carbohydrates_amount?(l.openBlock(),l.createElementBlock("div",Ku,[l.createElementVNode("b",null,l.toDisplayString((ne=l.unref(m).openCard)==null?void 0:ne.carbohydrates_amount),1),B[4]||(B[4]=l.createElementVNode("p",null,"Углеводы",-1))])):l.createCommentVNode("",!0)])]),l.createElementVNode("div",Qu,[l.createElementVNode("p",Ju,l.toDisplayString((U=l.unref(m).groupCurrentOpen)==null?void 0:U.name),1),l.createElementVNode("p",e0,"Выбрано "+l.toDisplayString(l.unref(w))+" из "+l.toDisplayString(l.unref(_)),1),l.createElementVNode("div",{class:l.normalizeClass((ie=l.unref(m).groupModifiers.find(oe=>{var G;return oe.id===((G=l.unref(m).groupCurrentOpen)==null?void 0:G.id)}))!=null&&ie.group_modifiers.length?"wrapper_modifiers_card":"wrapper_modifiers_card_column")},[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(((z=l.unref(m).groupCurrentOpen)==null?void 0:z.group_modifiers)||[],oe=>{var G,W,Z;return l.openBlock(),l.createElementBlock("div",{key:oe.id,ref_for:!0,ref:l.unref(C).set,id:oe.id,class:l.normalizeClass(["modifier_card",{hidden_modifier_card:oe.default_amount===0&&((G=l.unref(m).groupCurrentOpen)==null?void 0:G.id)==="Добавки2000"&&oe.min_amount===0&&oe.max_amount===0}]),tabindex:"0",role:"button","data-clickable":"true","aria-label":`Выбрать модификатор группы ${oe.name}`,onClick:X=>l.unref(f).modifierSelect(oe),onKeydown:l.withKeys(X=>l.unref(f).modifierSelect(oe),["enter"])},[l.createElementVNode("div",{class:l.normalizeClass([{modifier_card_active:l.unref(m).groupModifiersSelected.some(X=>{var S;return X.group===((S=l.unref(m).groupCurrentOpen)==null?void 0:S.id)&&X.modifiers.some($=>$.id===oe.id)})},"wrapper_image_corners"])},[oe.amount>1?(l.openBlock(),l.createElementBlock("div",n0,l.toDisplayString(oe.amount),1)):l.createCommentVNode("",!0),l.createElementVNode("div",r0,[oe.video_link?l.withDirectives((l.openBlock(),l.createElementBlock("video",o0,[l.createElementVNode("source",{src:oe.video_link||"",type:"video/webm"},null,8,s0)])),[[l.unref(Vr)]]):(l.openBlock(),l.createElementBlock("img",{key:0,class:"modifier_image",src:oe.image_link||l.unref(h).fallback_image||"",alt:oe.name},null,8,i0)),l.createElementVNode("div",{class:l.normalizeClass(["wrapper_modifier_title",{wrapper_modifier_title_required:oe.min_amount>0||oe.required}])},[l.createElementVNode("h3",a0,l.toDisplayString(oe.name),1),l.createElementVNode("p",null,"+"+l.toDisplayString(((Z=(W=oe.sizes)==null?void 0:W.find(X=>X.id===l.unref(m).selectedSize.id))==null?void 0:Z.price)||oe.price||0)+"₽",1)],2)])],2)],42,t0)}),128))],2)],512)])}}}),[["__scopeId","data-v-b4140cab"]]),c0={key:0,class:"card_size_place"},u0=["onClick","onKeydown","aria-label"],d0={key:1,class:"card_size static"},f0=["onClick","onKeydown","aria-label"],oo=3,h0=Ue(l.defineComponent({__name:"SizeModifier",setup(o){const a=Rt(),{stateCard:i}=xe.storeToRefs(a),u=l.ref(null),f=l.ref(50),h=l.ref(),m=l.ref(0),w=l.ref(0),_=l.ref(null),p=l.computed(()=>{var k;if(i.value.productSizes.length<=3)return i.value.productSizes[h.value.index]||i.value.productSizes[0];const v=m.value+1,M=((k=y.value[v])==null?void 0:k.originalIndex)??1;return i.value.productSizes[M]}),C=()=>{_.value&&i.value.productSizes.length>=3&&(w.value=_.value.offsetWidth/oo)},y=l.computed(()=>{if(i.value.productSizes.length<=3)return i.value.productSizes;const v=i.value.productSizes;return[...v.map((M,k)=>({...M,originalIndex:k})),...v.map((M,k)=>({...M,originalIndex:k})),...v.map((M,k)=>({...M,originalIndex:k}))]}),N=(v,M)=>{if(h.value={id:v.id,title:v.name,index:M,is_default:v.is_default},v.price!==null&&i.value.openCard&&(i.value.openCard={...i.value.openCard,price:v.price}),i.value.selectedSize=v,i.value.productSizes.length>3){C();const k=m.value+1;M<k?B():M>k&&R()}else{const k=i.value.productSizes.length,V=(M+.5)*(100/k);f.value=V}},B=()=>{var v;if(!(i.value.productSizes.length<=3)){if(m.value--,m.value<i.value.productSizes.length-oo+1){m.value+=i.value.productSizes.length;const M=(v=_.value)==null?void 0:v.querySelector(".card_size");M&&(M.style.transition="none",M.style.transform=`translateX(-${m.value*w.value}px)`,M.offsetHeight,M.style.transition="transform 0.2s ease-in-out")}P()}},R=()=>{var v;if(!(i.value.productSizes.length<=3)){if(m.value++,m.value>=i.value.productSizes.length*2){m.value-=i.value.productSizes.length;const M=(v=_.value)==null?void 0:v.querySelector(".card_size");M&&(M.style.transition="none",M.style.transform=`translateX(-${m.value*w.value}px)`,M.offsetHeight,M.style.transition="transform 0.2s ease-in-out")}P()}},P=()=>{var V;if(i.value.productSizes.length<=3)return;const v=m.value+1,M=((V=y.value[v])==null?void 0:V.originalIndex)??0,k=i.value.productSizes[M];h.value={id:k.id,title:k.name,index:M,is_default:k.is_default}};l.watch(()=>[i.value.productSizes,_.value],([v=[],M])=>{if(Array.isArray(v)&&v.length>0&&M!==null){let k=v.findIndex(V=>V.is_default===!0);v.length<3&&u.value&&parseInt(u.value.style.minWidth)<767&&(u.value.style.width="100px"),k>-1?(m.value=k,N(v[k],k),w.value=120/oo):v.length===2||v.length===1?(N(v[0],0),f.value=(0+.5)*(100/2)):(N(v[1],1),f.value=(1+.5)*(100/3))}}),l.watch(()=>{var v;return[(v=i.value.selectedSize)==null?void 0:v.id,i.value.groupModifiersSelected]},([v,M])=>{if(!v||!Array.isArray(M))return;const k=M.map(V=>({...V,modifiers:V.modifiers.map(te=>{if(!te.sizes||te.sizes.length===0)return te;const ne=te.sizes.find(U=>U.id===v);return ne?{...te,size:ne,price:ne.price??te.price}:te})}));JSON.stringify(k)!==JSON.stringify(i.value.groupModifiersSelected)&&(i.value.groupModifiersSelected=k)},{deep:!0});const D={mounted:C};return l.onBeforeUnmount(()=>{window.removeEventListener("resize",C)}),(v,M)=>l.withDirectives((l.openBlock(),l.createElementBlock("div",{class:"slider_container",ref_key:"slider_container",ref:u},[l.createElementVNode("div",{class:"card_size_place_wrapper",ref_key:"sliderWrapper",ref:_},[l.unref(i).productSizes.length>1&&h.value?(l.openBlock(),l.createElementBlock("div",c0,[l.unref(i).productSizes.length>3?(l.openBlock(),l.createElementBlock("ul",{key:0,class:"card_size",style:l.normalizeStyle({transform:`translateX(-${m.value*w.value}px)`})},[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(y.value,(k,V)=>(l.openBlock(),l.createElementBlock("li",{key:`${k.id}-${V}`,onClick:te=>N(k,V),onKeydown:l.withKeys(te=>N(k,V),["enter"]),class:l.normalizeClass({active:h.value.id===k.id&&h.value.index===k.originalIndex}),tabindex:"0",role:"button","aria-label":`Выбрать размер ${k.name}`},l.toDisplayString(k.alt_name?k.alt_name:k.name),43,u0))),128))],4)):(l.openBlock(),l.createElementBlock("ul",d0,[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(i).productSizes,(k,V)=>(l.openBlock(),l.createElementBlock("li",{key:`${k.id}-${V}`,onClick:te=>N(k,V),onKeydown:l.withKeys(te=>N(k,V),["enter"]),class:l.normalizeClass({active:h.value.id===k.id&&h.value.index===V}),tabindex:"0",role:"button","aria-label":`Выбрать размер ${k.name}`},l.toDisplayString(k.alt_name?k.alt_name:k.name),43,f0))),128))])),p.value?l.withDirectives((l.openBlock(),l.createElementBlock("div",{key:2,class:"size_active",style:l.normalizeStyle(l.unref(i).productSizes.length<=3?{left:`${f.value}%`}:{})},[l.createElementVNode("p",null,l.toDisplayString(p.value.alt_name?p.value.alt_name:p.value.name),1)],4)),[[D]]):l.createCommentVNode("",!0)])):l.createCommentVNode("",!0)],512)],512)),[[l.vShow,l.unref(i).productSizes.length>1&&h.value]])}}),[["__scopeId","data-v-bc00f0e8"]]),g0="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",m0={class:"counter_container"},p0={class:"card_size_place_wrapper",ref:"sliderWrapper"},x0={class:"cart_amount_counter"},w0={class:"button_circle_number"},_0=Ue(l.defineComponent({__name:"NumberModifier",setup(o){const a=Rt(),{stateCard:i}=xe.storeToRefs(a),u=()=>{var h,m;(h=i.value.openCard)!=null&&h.amount&&((m=i.value.openCard)==null?void 0:m.amount)>1&&(i.value.openCard.amount-=1)},f=()=>{var h;(h=i.value.openCard)!=null&&h.amount&&(i.value.openCard.amount+=1)};return(h,m)=>{var w,_;return l.openBlock(),l.createElementBlock("div",m0,[l.createElementVNode("div",p0,[l.createElementVNode("div",x0,[l.createElementVNode("p",{class:l.normalizeClass(["cart_circle_minus",[((w=l.unref(i).openCard)==null?void 0:w.amount)===1?"card_circle_minus_alone":""]]),"aria-label":"Уменьшить количество продукта","data-clickable":"true",onClick:l.withModifiers(u,["stop","prevent"])},[...m[0]||(m[0]=[l.createElementVNode("span",null,null,-1)])],2),l.createElementVNode("p",w0,l.toDisplayString((_=l.unref(i).openCard)==null?void 0:_.amount),1),l.createElementVNode("p",{class:"cart_circle_plus","aria-label":"Увеличить количество продукта","data-clickable":"true",onClick:l.withModifiers(f,["stop","prevent"])},"+")])],512)])}}}),[["__scopeId","data-v-c3d45434"]]);function Qs(o,a=800){const i=l.ref(o),u=l.ref(o);let f=null,h=null,m=o;const w=_=>{h||(h=_);const p=_-h,C=Math.min(p/a,1),y=C<.5?4*C*C*C:1-Math.pow(-2*C+2,3)/2;i.value=Math.round(m+(u.value-m)*y),C<1?f=requestAnimationFrame(w):(i.value=u.value,f=null)};return l.watch(u,()=>{f&&cancelAnimationFrame(f),m=i.value,h=null,f=requestAnimationFrame(w)},{immediate:!0}),l.onUnmounted(()=>{f&&cancelAnimationFrame(f)}),{displayNumber:i,targetNumber:u,update:_=>{u.value=_}}}const Xt=l.defineComponent({__name:"RecountNumber",props:{price:{type:Number,required:!0},duration:{type:Number},fixedFloat:{type:Number,require:!1}},setup(o){const a=o,{displayNumber:i,update:u}=Qs(a.price||0,a.duration||800);return l.watchEffect(()=>{u(a.price)}),(f,h)=>(l.openBlock(),l.createElementBlock("span",null,l.toDisplayString(l.unref(i).toFixed(o.fixedFloat)),1))}}),C0=["disabled","id"],un=l.defineComponent({__name:"ButtonDefault",props:{textButtonDefault:{type:String,required:!0},disabled:{type:Boolean,default:!1},onClick:{type:Function,required:!0}},setup(o){const a=o,i=()=>{a.onClick()};return(u,f)=>(l.openBlock(),l.createElementBlock("button",{class:"buttonDefaultWrapper",disabled:o.disabled,onClick:i,id:o.disabled?"buttonDefaultDisabled":""},l.toDisplayString(o.textButtonDefault),9,C0))}}),E0={class:"notification_info"},y0={key:0,class:"notification_18plus"},b0={class:"notification_18plus_image"},A0=["src"],I0={class:"notification_18plus_text"},S0={class:"notification_18plus_accept"},N0={key:1,class:"notification_text"},T0={key:0,class:"wrapper_button_accept"},so=l.defineComponent({__name:"NotificationWindow",props:l.mergeModels({textNotificationDefault:{},backgroundColor:{},buttonAccept:{},type:{type:Boolean},is_qr:{type:Boolean}},{visible:{default:!1},visibleModifiers:{}}),emits:["update:visible"],setup(o){const a=o,i=It(),u=ot(),{is18Allowed:f,notificationData_lib:h}=xe.storeToRefs(u),{itemThemes:m}=xe.storeToRefs(i),w=l.computed(()=>a.backgroundColor||"rgba(50, 50, 50, 0.9)"),_=l.computed(()=>{var R;return!!((R=m.value)!=null&&R.kiosk_hide_menu_update_notification)});let p;const C=l.useModel(o,"visible"),y=()=>{h.value.fastAdd&&(u.addToCart(h.value.fastAdd),h.value.fastAdd=null),sessionStorage.setItem("is_adult","true"),f.value=!0,C.value=!1,h.value.callback&&(h.value.callback(),h.value.callback=null)},N=()=>{C.value=!1},B=()=>{C.value=!1,clearTimeout(p)};return l.watch(()=>[C.value,a.textNotificationDefault],(R,P)=>{P&&clearTimeout(p),_.value&&R&&(p=setTimeout(()=>{B()},4e3))}),l.onUnmounted(()=>{p&&B()}),(R,P)=>(l.openBlock(),l.createElementBlock(l.Fragment,null,[!_.value&&C.value?(l.openBlock(),l.createBlock(l.Transition,{key:0,name:"notificationBlack",appear:""},{default:l.withCtx(()=>[l.createElementVNode("div",{class:"notification_background_black",onClick:N})]),_:1})):l.createCommentVNode("",!0),l.createVNode(l.Transition,{name:"notification",appear:""},{default:l.withCtx(()=>{var D;return[C.value?(l.openBlock(),l.createElementBlock("div",{key:0,class:"notification_overlay",onClick:N},[l.createElementVNode("div",{class:"notification_wrapper",style:l.normalizeStyle({"background-color":w.value,border:`2px solid ${w.value}`})},[l.createElementVNode("div",E0,[o.type?(l.openBlock(),l.createElementBlock("div",y0,[l.createElementVNode("div",b0,[l.createElementVNode("img",{src:l.unref(m).adult_disclaimer_image||l.unref(m).fallback_image,alt:"Дисклеймер"},null,8,A0)]),l.createElementVNode("div",I0,l.toDisplayString(l.unref(m).adult_disclaimer_text),1),l.createElementVNode("div",S0,[P[0]||(P[0]=l.createElementVNode("label",{for:"plus18"},"Содержащиеся в настоящем разделе материалы предназначены для лиц старше 18 лет, носят информационный характер об ассортименте товаров и не являются рекламой. ",-1)),l.createVNode(un,{textButtonDefault:"Мне есть 18",onClick:y,style:{fontSize:"1rem",padding:"6px 24px",marginLeft:"10px"}})])])):(l.openBlock(),l.createElementBlock("div",N0,[l.createTextVNode(l.toDisplayString(o.textNotificationDefault)+" ",1),(D=o.buttonAccept)!=null&&D.state?(l.openBlock(),l.createElementBlock("div",T0,[l.createVNode(un,{class:"button_accept",textButtonDefault:o.buttonAccept.text,onClick:o.buttonAccept.acceptBtn,disabled:o.buttonAccept.disabled},null,8,["textButtonDefault","onClick","disabled"])])):l.createCommentVNode("",!0)]))])],4)])):l.createCommentVNode("",!0)]}),_:1})],64))}}),k0={class:"button_price button_price_modifiers"},R0=["src"],O0={class:"button_text_container"},B0={class:"button_text_price"},M0=Ue(l.defineComponent({__name:"ButtonPriceCount",props:{qr_menu:{type:Boolean,default:!1},closeProduct:{}},setup(o){const a=Re.useRouter(),i=Re.useRoute(),u=Rt(),f=ot(),h=It(),m=l.ref([]),w=l.ref([]),_=o,{stateCard:p,totalPrice_libCard:C,isOpenWindow:y,isAddToCard:N}=xe.storeToRefs(u),{itemThemes:B}=xe.storeToRefs(h),R=l.ref(!0),P=l.ref(!1),D=()=>{var M,k,V;if(R.value){u.setCurrentCard(p.value.openCard),P.value=!0;const te=p.value.groupModifiers.findIndex(ne=>u.checkedRequiredBtn.group.id===ne.id);u.checkedRequiredBtn.haveRequaire&&u.toggleNotRequire(u.checkedRequiredBtn.group,te);return}const v=p.value.groupModifiersSelected||[];if(m.value=[],w.value=[],Array.isArray(v)&&v.length>0&&v.forEach(te=>{const ne=te.group,U=te.modifiers||[];ne==="Добавки2000"?m.value=U.map(ie=>{var z;return{...ie,old_price:ie.price,size:Array.isArray(ie.size)?ie.size.map(oe=>oe.id).filter(Boolean):(z=ie.size)!=null&&z.id?ie.size.id:void 0}}):U.length>0&&w.value.push({group:ne,is_fake:te.is_fake||!1,is_product_determining:te.is_product_determining||!1,modifiers:U.map(ie=>{var z;return{...ie,old_price:ie.price,size:Array.isArray(ie.size)?ie.size.map(oe=>oe.id).filter(Boolean):(z=ie.size)!=null&&z.id?ie.size.id:void 0}})})}),document.body.style.overflow="",p.value.openCard){const te={id:p.value.openCard.id,is_fake:p.value.openCard.is_fake||!1,is_od_united_product:p.value.openCard.is_od_united_product||!1,amount:p.value.openCard.amount,name:p.value.openCard.name,image_link:p.value.openCard.image_link,price:p.value.openCard.price,old_price:p.value.openCard.price,size:((M=p.value.selectedSize)==null?void 0:M.id)??((V=(k=p.value.openCard.sizes)==null?void 0:k.find(ne=>ne.is_default))==null?void 0:V.id),sizes:p.value.openCard.sizes||[],modifiers:m.value,groups:p.value.openCard.groups,group_modifiers:w.value,energy_amount:p.value.openCard.energy_amount??0,proteins_amount:p.value.openCard.proteins_amount??0,fat_amount:p.value.openCard.fat_amount??0,carbohydrates_amount:p.value.openCard.carbohydrates_amount??0};_.closeProduct&&_.closeProduct(),f.addToCart(te),N.value=!0}y.value=!1,_.qr_menu&&a.push(`/${i.params.orgId}/`)};return l.watch(()=>p.value.productSizes,v=>{!v||v.length===0||!p.value.selectedSize||(p.value.selectedSize={...p.value.selectedSize})},{immediate:!0}),l.watchEffect(()=>{u.checkedRequiredBtn.haveRequaire?R.value=!0:R.value=!1}),l.onMounted(()=>{N.value=!1}),(v,M)=>(l.openBlock(),l.createElementBlock(l.Fragment,null,[(l.openBlock(),l.createBlock(l.Teleport,{to:"body"},[l.createVNode(so,{visible:P.value,textNotificationDefault:l.unref(p).textErrorRequaired,backgroundColor:l.unref(B).accent_color?l.unref(B).accent_color:"#FF6D2E",buttonAccept:null,"onUpdate:visible":M[0]||(M[0]=k=>P.value=k)},null,8,["visible","textNotificationDefault","backgroundColor"])])),l.createElementVNode("div",{class:"button_price_bg_product",onTouchstart:M[3]||(M[3]=l.withModifiers(()=>{},["stop"])),onPointerdown:M[4]||(M[4]=l.withModifiers(()=>{},["stop"]))},[l.createElementVNode("div",k0,[l.createVNode(_0),l.createElementVNode("div",{class:l.normalizeClass(["card_product_button_buy",{buy_active:!R.value}]),"data-clickable":"true",onClick:D,onTouchstart:M[1]||(M[1]=l.withModifiers(()=>{},["stop"])),onPointerdown:M[2]||(M[2]=l.withModifiers(()=>{},["stop"]))},[l.createElementVNode("img",{src:l.unref(g0),class:"card_product_button_icon"},null,8,R0),l.createElementVNode("div",O0,[l.createElementVNode("p",B0,[l.createVNode(Xt,{price:+l.unref(C),fixedFloat:2},null,8,["price"]),M[5]||(M[5]=l.createTextVNode(" ₽ ",-1))])])],34)])],32)],64))}}),[["__scopeId","data-v-e1f3547f"]]),v0={class:"modified_amount"},D0={class:"hide_image_corners"},P0=["src"],L0={class:"wrapper_modifier_title"},F0={class:"amount_title"},V0={class:"wrapper_amount_counter"},U0={class:"amount_count"},H0={class:"amount_wrapper"},z0={class:"add_counter_amount"},G0=Ue(l.defineComponent({__name:"ModalAmount",setup(o){const a=Rt(),i=It(),{itemThemes:u}=xe.storeToRefs(i),{stateCard:f}=xe.storeToRefs(a),h=l.computed(()=>{var _,p,C;return((C=(p=(_=f.value.currentModifier)==null?void 0:_.sizes)==null?void 0:p.find(y=>y.id===f.value.selectedSize.id))==null?void 0:C.price)??ur(f.value.currentModifier)}),m=()=>{f.value.currentModifier&&(f.value.currentModifier.amount=f.value.modalCount),a.modifierSelect(f.value.currentModifier),f.value.isModifiedAmount=!1},w=()=>{f.value.modalCount=1,f.value.currentModifier.amount=1};return(_,p)=>{var C,y;return l.openBlock(),l.createElementBlock(l.Fragment,null,[l.createElementVNode("div",v0,[l.createElementVNode("div",D0,[l.createElementVNode("img",{class:"modifier_image",src:((C=l.unref(f).currentModifier)==null?void 0:C.image_link)||l.unref(u).fallback_image||""},null,8,P0),l.createElementVNode("div",L0,[l.createElementVNode("p",F0,l.toDisplayString((y=l.unref(f).currentModifier)==null?void 0:y.name),1),l.createElementVNode("p",null,"+ "+l.toDisplayString(h.value)+"₽",1)])])]),l.createElementVNode("div",V0,[l.createElementVNode("div",{class:"amount_mines",onClick:p[0]||(p[0]=l.withModifiers((...N)=>l.unref(a).minusAmount&&l.unref(a).minusAmount(...N),["stop"]))},[...p[1]||(p[1]=[l.createElementVNode("div",null,null,-1)])]),l.createElementVNode("p",U0,l.toDisplayString(l.unref(f).modalCount),1),l.createElementVNode("div",H0,[l.createVNode(io,{onClick:l.withModifiers(l.unref(a).plusAmount,["stop"])},null,8,["onClick"])])]),l.createElementVNode("p",{class:"clear_count",onClick:l.withModifiers(w,["stop"])},"Убрать все"),l.createElementVNode("div",z0,[l.createVNode(un,{textButtonDefault:"Добавить",onClick:m,class:"button_add_group_modifiers"})])],64)}}}),[["__scopeId","data-v-84debd5d"]]),W0=(o,a,i)=>Math.max(a,Math.min(o,i)),X0=(o,a)=>Math.pow(o,a*5),Js=(o,a,i)=>a===0||Math.abs(a)===1/0?X0(o,i):o*a*i/(a+i*o),gi=(o,a)=>a*parseFloat(o)/100,ao=(o,a,i,u=.15)=>u===0?W0(o,a,i):o<a?-Js(a-o,i-a,u)+a:o>i?+Js(o-i,i-a,u)+i:o,sn=(o,{min:a,max:i})=>a!==void 0&&o<a?a:i!==void 0&&o>i?i:o;function j0(o,a,i){const u=l.ref(0),f=l.computed(()=>o.value.map(_=>typeof _=="string"?gi(_,i.value):_)),h=l.computed(()=>Math.min(...f.value)),m=l.computed(()=>Math.max(...f.value)),w=l.computed(()=>{const _=f.value.reduce((p,C)=>Math.abs(C-a.value)<Math.abs(p-a.value)?C:p);return f.value.indexOf(_)});return{currentSnapPointIndex:u,flattenedSnapPoints:f,minSnapPoint:h,maxSnapPoint:m,closestSnapPointIndex:w}}const lo=Ue(l.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(o,{expose:a,emit:i}){const u=o,f=i,h=Wt.useVModel(u,"modelValue",f,{passive:!0});l.watch(h,me=>{me&&j()}),l.onMounted(()=>{h.value&&j()});const m=l.ref(),w=l.ref(null),_=l.ref(null),p=l.ref(null),C=l.ref(null),y=l.ref(u.expandOnContentDrag),{height:N}=Wt.useWindowSize(),{height:B}=Wt.useElementBounding(m),{height:R}=Wt.useElementBounding(w),{height:P}=Wt.useElementBounding(C),{height:D}=Wt.useElementBounding(_),v=l.computed({get(){return sn(Math.ceil(P.value+R.value+D.value),{max:N.value})},set(me){[R.value,P.value,D.value]=me}}),M=l.ref(0),k=l.ref(0),V=At.useMotionValue(0),te=At.useMotionValue(0),{snapPoints:ne}=l.toRefs(u),U=l.computed(()=>ne.value??[v.value]),{flattenedSnapPoints:ie,currentSnapPointIndex:z,closestSnapPointIndex:oe,minSnapPoint:G,maxSnapPoint:W}=j0(U,M,N);let Z;function X(me){y.value=!0,S(me)}function S(me){y.value&&me.preventDefault()}const $=me=>{me.key==="Escape"&&ge()},H=()=>{u.canBackdropClose&&ge()};let ee=!1;const j=async()=>{if(ee)return;h.value=!0,ee=!0,f("opening-started"),await l.nextTick();const me=m.value.$el;B.value=me.getBoundingClientRect().height;const qe=me.querySelector("[data-vsbs-content]"),Ee=me.querySelector("[data-vsbs-header]"),mt=me.querySelector("[data-vsbs-footer]");if(v.value=[Ee.getBoundingClientRect().height,qe.getBoundingClientRect().height,mt.getBoundingClientRect().height],await l.nextTick(),z.value=ie.value.findIndex(nt=>nt===G.value),u.initialSnapPoint){const nt=u.initialSnapPoint;if(nt<0||nt>=U.value.length)return console.warn("Index out of bounds");M.value=typeof U.value[nt]=="number"?sn(U.value[nt],{max:N.value}):gi(U.value[nt],N.value)}else M.value=sn(G.value,{max:N.value});k.value=M.value,V.jump(M.value),te.jump(M.value),requestAnimationFrame(()=>{Z=At.animate(V,M.value,{duration:u.duration/1e3,ease:"easeInOut"}),Z=At.animate(te,0,{duration:u.duration/1e3,ease:"easeInOut",onComplete:()=>{u.blocking&&f("opened")}})}),window.addEventListener("keydown",$),ee=!1};let re=!1;const ge=()=>{re||(h.value=!1,re=!0,f("closing-started"),window.removeEventListener("keydown",$),setTimeout(()=>{f("closed"),re=!1},u.duration))},we=me=>{if(U.value){if(me<0||me>=U.value.length){console.warn("Index out of bounds");return}z.value=me,M.value=typeof U.value[me]=="number"?sn(U.value[me],{max:N.value}):gi(U.value[me],N.value),Z=At.animate(V,M.value,{duration:u.duration/1e3,ease:"easeInOut",onComplete:()=>f("snapped",U.value.indexOf(U.value[me]))})}};function Ne(me){me>0?f("dragging-down"):me<0&&f("dragging-up")}const _e=()=>{M.value=B.value,k.value=te.get(),V.jump(M.value),te.jump(k.value)},Me=async(me,qe)=>{await l.nextTick(),m.value&&(k.value<=0&&(M.value-=qe.delta.y),M.value<=G.value&&(M.value=G.value,k.value+=qe.delta.y,te.set(u.canSwipeClose?sn(k.value,{min:0}):sn(ao(k.value,-B.value,0,.5),{min:0}))),V.set(sn(ao(M.value,0,W.value,.25),{min:0,max:N.value})),Ne(qe.delta.y))},fe=()=>{if(u.canSwipeClose){let me=M.value/2;u.swipeCloseThreshold&&typeof u.swipeCloseThreshold=="number"&&(me=u.swipeCloseThreshold),u.swipeCloseThreshold&&typeof u.swipeCloseThreshold=="string"&&u.swipeCloseThreshold.includes("%")&&(me=M.value*(Number(u.swipeCloseThreshold.replace("%",""))/100)),Math.abs(k.value)>me&&(k.value=M.value)}else k.value=0;Z=At.animate(te,k.value,{duration:u.duration/1e3,ease:"easeInOut"}),k.value===M.value&&(k.value=0,ge()),z.value=oe.value,M.value=typeof U.value[oe.value]=="number"?sn(U.value[oe.value],{max:N.value}):gi(U.value[oe.value],N.value),Z=At.animate(V,M.value,{duration:u.duration/1e3,ease:"easeInOut",onComplete:()=>f("snapped",U.value.indexOf(U.value[oe.value]))}),Z=At.animate(te,0,{duration:u.duration/1e3,ease:"easeInOut"})},dt=(me,qe)=>{if(M.value=B.value,k.value=te.get(),Z&&Z.stop(),!p.value)return;const Ee=p.value.scrollTop===0,mt=qe.delta.y>0,nt=ie.value.length===1,jt=.5>Math.abs(M.value-W.value);if(nt){if(!u.expandOnContentDrag)return y.value=!1;te.get()===0&&Ee&&mt&&(y.value=!0),te.get()===0&&Ee&&!mt&&(y.value=!1)}else{if(!u.expandOnContentDrag)return y.value=!1;y.value=!0,jt&&(mt&&Ee&&(y.value=!0),!mt&&Ee&&(y.value=!1),Ee||(y.value=!1))}},Xe=async(me,qe)=>{if(await l.nextTick(),!u.expandOnContentDrag)return y.value=!1;if(!m.value)return;k.value===0&&y.value&&u.expandOnContentDrag&&(M.value-=qe.delta.y),M.value<=G.value&&(M.value=G.value,y.value&&u.expandOnContentDrag&&(k.value+=qe.delta.y),k.value=sn(k.value,{min:0,max:G.value}),te.set(u.canSwipeClose?sn(k.value,{min:0}):sn(ao(k.value,-B.value,0,.5),{min:0}))),M.value>W.value&&(M.value=W.value),M.value=sn(M.value,{max:N.value}),!(ie.value.length===1)&&M.value===W.value&&(y.value=!1),V.set(M.value),Ne(qe.delta.y)},Oe=()=>{if(!p.value)return;const me=p.value.scrollTop===0;y.value=me},Ze=Wt.useDebounceFn(me=>we(me),u.duration);return l.watch(U,(me,qe)=>{if(h.value===!1||!me||!qe)return;const Ee=me[z.value],mt=qe[z.value];typeof Ee!="string"&&typeof mt!="string"&&(M.value=sn(Ee,{max:N.value}),Ee!==mt&&(Z=At.animate(V,M.value,{duration:u.duration/1e3,ease:"easeInOut"})))}),l.watch(N,()=>Ze(z.value)),l.watch(v,me=>f("instinctHeight",me)),a({open:j,close:ge,snapToPoint:we}),(me,qe)=>(l.openBlock(),l.createBlock(l.Teleport,{to:o.teleportTo,defer:o.teleportDefer},[l.createElementVNode("div",l.mergeProps(me.$attrs,{"data-vsbs-container":""}),[l.createVNode(l.unref(At.AnimatePresence),null,{default:l.withCtx(()=>[l.unref(h)&&o.blocking?(l.openBlock(),l.createBlock(l.unref(At.Motion),{key:0,ref:"backdrop","data-vsbs-backdrop":"",onClick:qe[0]||(qe[0]=Ee=>H()),transition:{ease:"easeInOut",duration:o.duration/1e3},initial:{opacity:0},animate:{opacity:1},exit:{opacity:0}},null,8,["transition"])):l.createCommentVNode("",!0)]),_:1}),l.createVNode(l.unref(At.AnimatePresence),null,{default:l.withCtx(()=>[l.unref(h)?(l.openBlock(),l.createBlock(l.unref(At.Motion),{key:0,ref_key:"sheet",ref:m,exit:{y:"100%",height:l.unref(B),opacity:0},initial:!1,style:l.normalizeStyle({y:l.unref(te),z:1,height:l.unref(V)}),"data-vsbs-shadow":!o.blocking,"data-vsbs-sheet-show":l.unref(h),"aria-modal":"true","data-vsbs-sheet":"",tabindex:"-1"},{default:l.withCtx(()=>[l.createVNode(l.unref(At.Motion),{ref_key:"sheetHeader",ref:w,"data-vsbs-header":"",onPanStart:_e,onPan:Me,onPanEnd:fe,onTouchmove:X,class:l.normalizeClass(o.headerClass)},{default:l.withCtx(()=>[l.renderSlot(me.$slots,"header",{},void 0,!0)]),_:3},8,["class"]),l.createElementVNode("div",{ref_key:"sheetScroll",ref:p,"data-vsbs-scroll":"",onScrollend:Oe},[l.createVNode(l.unref(At.Motion),{ref:"sheetContentWrapper","data-vsbs-content-wrapper":"",onPanStart:dt,onPan:Xe,onPanEnd:fe,onTouchmove:S},{default:l.withCtx(()=>[l.createElementVNode("div",{ref_key:"sheetContent",ref:C,"data-vsbs-content":"",class:l.normalizeClass(o.contentClass)},[l.renderSlot(me.$slots,"default",{},void 0,!0)],2)]),_:3},512)],544),l.createVNode(l.unref(At.Motion),{ref_key:"sheetFooter",ref:_,"data-vsbs-footer":"",onPanStart:_e,onPan:Me,onPanEnd:fe,onTouchmove:X,class:l.normalizeClass(o.footerClass)},{default:l.withCtx(()=>[l.renderSlot(me.$slots,"footer",{},void 0,!0)]),_:3},8,["class"])]),_:3},8,["exit","style","data-vsbs-shadow","data-vsbs-sheet-show"])):l.createCommentVNode("",!0)]),_:3})],16)],8,["to","defer"]))}}),[["__scopeId","data-v-8bf4388d"]]);function Ln(o,a=null){const i=Jr();i.initCacheSingle("defaultImage");const u=l.computed(()=>i.cache.defaultImage||null),f=l.shallowRef(!1),h=l.computed(()=>{var p;return((p=l.toValue(o))==null?void 0:p.toString())||null}),m=Wt.computedAsync(async()=>{const p=h.value;return p?(await i.initCacheSingle(p),i.cache[p]||null):null},null,{evaluating:f}),w=l.computed(()=>f.value&&h.value!==null);return{mediaUrl:l.computed(()=>m.value||l.toValue(a)||u.value||null),isLoading:w}}const Z0={class:"card_product_wrapper"},q0={class:"card_product_modifiers_sheet_body"},Y0={class:"card__pictures"},$0=["src"],K0=["src"],Q0={class:"card_header_wrapper"},J0={key:0,class:"card_fire_kkal_wrapper"},e1={class:"card_content"},t1={class:"wrapper_size"},n1={key:0,class:"description"},r1={key:1},i1=Ue(l.defineComponent({__name:"CardProductPage",props:{configPage:{}},setup(o){const a=It(),i=Rt(),{stateCard:u,isOpenWindow:f}=xe.storeToRefs(i),{itemThemes:h}=xe.storeToRefs(a),m=Re.useRouter(),w=Re.useRoute(),_=o,{mediaUrl:p}=Ln(()=>{var N,B;return(N=u.value.openCard)!=null&&N.video_link?`${u.value.openCard.id}_video`:(B=u.value.openCard)!=null&&B.image_link?`${u.value.openCard.id}_image`:null},()=>{var N,B;return((N=u.value.openCard)==null?void 0:N.video_link)||((B=u.value.openCard)==null?void 0:B.image_link)||null}),C=()=>{_.configPage.qr_menu?m.push(`/${w.params.orgId}`):_.configPage.closeProduct()},y=()=>{u.value.isModifiedAmount=!1};return l.watch(()=>_.configPage.data,i.setCurrentCard),l.watchEffect(()=>{f.value||(f.value=_.configPage.is_closeProduct)}),l.onBeforeUnmount(()=>i.reset()),(N,B)=>{var R,P,D,v,M,k;return l.openBlock(),l.createElementBlock("div",Z0,[l.createVNode(l.unref(lo),{modelValue:l.unref(u).isSectionModifier,"onUpdate:modelValue":B[1]||(B[1]=V=>l.unref(u).isSectionModifier=V),class:"card_product_modifiers_sheet"},{default:l.withCtx(()=>[l.createElementVNode("div",q0,[l.createVNode(l0,{onClose:B[0]||(B[0]=V=>l.unref(u).isSectionModifier=!1)}),l.createVNode(Ks,{isSectionModifier:l.unref(u).isSectionModifier,toggleNotRequire:l.unref(i).toggleNotRequire},null,8,["isSectionModifier","toggleNotRequire"])])]),_:1},8,["modelValue"]),(l.openBlock(),l.createBlock(l.Teleport,{to:"body"},[l.unref(u).isModifiedAmount?(l.openBlock(),l.createElementBlock("div",{key:0,class:"wrapper_modified_amount",onClick:l.withModifiers(y,["stop"])},[l.createVNode(G0)])):l.createCommentVNode("",!0)])),l.createElementVNode("div",Y0,[(R=l.unref(u).openCard)!=null&&R.video_link&&l.unref(p)?l.withDirectives((l.openBlock(),l.createElementBlock("video",{key:l.unref(p),loop:"",autoplay:"",muted:"",playsinline:"",class:"card__video"},[l.createElementVNode("source",{src:l.unref(p)||"",type:"video/webm"},null,8,$0)])),[[l.unref(Vr)]]):(l.openBlock(),l.createElementBlock("img",{key:1,class:"card__pictures_images",src:l.unref(p)||"",alt:"Product image"},null,8,K0)),l.createElementVNode("div",Q0,[l.createVNode(Fr,{class:"card_header_back",onClick:C,"aria-label":"Вернуться назад"}),(P=l.unref(u).openCard)!=null&&P.energy_amount?(l.openBlock(),l.createElementBlock("div",J0,[B[3]||(B[3]=l.createElementVNode("div",{class:"card_fire_kkal"},null,-1)),l.createElementVNode("p",null,[l.createElementVNode("b",null,l.toDisplayString((D=l.unref(u).openCard)==null?void 0:D.energy_amount),1),B[2]||(B[2]=l.createTextVNode(" Ккал ",-1))])])):l.createCommentVNode("",!0)]),l.createElementVNode("h4",null,l.toDisplayString((v=l.unref(u).openCard)==null?void 0:v.name),1),l.createElementVNode("div",{class:"card__pictures__gradient",style:l.normalizeStyle(l.unref(h).gradientStyle)},null,4)]),l.createElementVNode("div",e1,[l.createElementVNode("div",t1,[l.createVNode(h0)]),(M=l.unref(u).openCard)!=null&&M.description?(l.openBlock(),l.createElementBlock("p",n1,l.toDisplayString((k=l.unref(u).openCard)==null?void 0:k.description),1)):l.createCommentVNode("",!0),l.unref(u).groupModifiers.length?(l.openBlock(),l.createElementBlock("div",r1,[B[4]||(B[4]=l.createElementVNode("p",{class:"title_info_modifiers"},"Настрой, как ты любишь",-1)),l.createVNode(Ks,{isSectionModifier:l.unref(u).isSectionModifier,toggleNotRequire:l.unref(i).toggleNotRequire},null,8,["isSectionModifier","toggleNotRequire"])])):l.createCommentVNode("",!0),l.createVNode(M0,{qr_menu:o.configPage.qr_menu,closeProduct:o.configPage.closeProduct},null,8,["qr_menu","closeProduct"])])])}}}),[["__scopeId","data-v-a9fa8db1"]]),o1={key:0,class:"popupWindowDefault_overlay"},ea=Ue(l.defineComponent({__name:"PopupWindowDefault",props:{visible:{type:Boolean}},emits:["update:visible"],setup(o,{emit:a}){const i=o,u=a,f=()=>{u("update:visible",!1)};return l.watch(()=>i.visible,async h=>{h&&await l.nextTick(),i.isVisible=h}),(h,m)=>(l.openBlock(),l.createElementBlock(l.Fragment,null,[l.createVNode(l.Transition,{name:"popupWindowDefaultBlack",appear:"",onAfterLeave:m[0]||(m[0]=()=>{u("update:visible",!1)})},{default:l.withCtx(()=>[i.visible?(l.openBlock(),l.createElementBlock("div",{key:0,class:"background_black",onClick:f})):l.createCommentVNode("",!0)]),_:1}),l.createVNode(l.Transition,{name:"popupWindowDefault",appear:"",onAfterLeave:m[1]||(m[1]=()=>{u("update:visible",!1)})},{default:l.withCtx(()=>[i.visible?(l.openBlock(),l.createElementBlock("div",o1,[l.renderSlot(h.$slots,"default",{},void 0,!0)])):l.createCommentVNode("",!0)]),_:3})],64))}}),[["__scopeId","data-v-08e0e008"]]),s1={},a1={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function l1(o,a){return l.openBlock(),l.createElementBlock("svg",a1,[...a[0]||(a[0]=[l.createElementVNode("path",{d:"M18 18L12 12M12 12L6 6M12 12L18 6M12 12L6 18",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)])])}const c1=Ue(s1,[["render",l1]]),co=xe.defineStore("modals",()=>{const o=new Map,a=(f,h)=>{const m=u(f).value;m.visible=!0,m.context=h},i=f=>{const h=u(f).value;h.visible=!1},u=f=>(o.has(f)||o.set(f,l.ref({visible:!1})),o.get(f));return{state:u,open:a,close:i}}),u1=["src"],d1={class:"cart_box_content_wrapper"},f1={class:"cart_box_content_info"},h1={class:"cart_amount"},g1={class:"cart_amount_count"},m1={class:"cart_box_info_more"},p1={key:1,class:"cart_modifier_info"},x1={class:"cart_modifier_content"},w1={class:"wrapper_price_count_cart"},_1={class:"count_cart_box"},C1={class:"wrapper_modifiers_discount"},ta=Ue(l.defineComponent({__name:"CartBox",props:{index:Number,cardItem:Object},emits:["delete"],setup(o,{emit:a}){const i=o,u=ot(),f=It(),h=co(),{itemThemes:m}=xe.storeToRefs(f),w=l.ref(0),_=l.ref(0),p=l.ref(!1),C=l.ref(!1),y=l.ref(!1),{displayNumber:N,update:B}=Qs(0,800),R=l.computed(()=>{var G,W;const z=((G=i.cardItem)==null?void 0:G.modifiers)??[],oe=(((W=i.cardItem)==null?void 0:W.group_modifiers)??[]).flatMap(Z=>Z.modifiers??[]);return[...z,...oe]}),{mediaUrl:P}=Ln(()=>{var z;return((z=i.cardItem)==null?void 0:z.id)+"_image"},()=>{var z;return(z=i.cardItem)==null?void 0:z.image_link}),D=l.computed(()=>{var z,oe;return((z=i.cardItem)==null?void 0:z.total_new_price)||ur(i.cardItem)*((oe=i.cardItem)==null?void 0:oe.amount)}),v=()=>h.open("cart-delete-confirm",i.cardItem),M=()=>{y.value=!y.value},k=()=>{u.plusAmount(i.cardItem.idSystem)},V=()=>{i.cardItem.amount>1?u.minusAmount(i.cardItem.idSystem):v()},te=z=>{w.value=z.touches[0].clientX,p.value=!0},ne=z=>{p.value&&(_.value=z.touches[0].clientX-w.value,_.value>0&&(_.value=0))},U=()=>{p.value=!1,_.value<-115&&v(),_.value=0};l.onMounted(()=>{i.index===0&&(C.value=!0,setTimeout(()=>{_.value=-90,setTimeout(()=>{_.value=0,C.value=!1},700)},0))});const ie=l.computed(()=>{const z=i.index===0&&C.value?1:`${1-Math.abs(_.value)/200}`;return{transform:`translateX(${_.value}px)`,opacity:z,transition:p.value?"none":"transform 0.7s, opacity 0.7s"}});return l.watch(D,B,{immediate:!0}),(z,oe)=>{var G,W,Z,X;return l.openBlock(),l.createElementBlock("div",{class:"cart_box_wrapper",onTouchstart:te,onTouchmove:ne,onTouchend:U,style:l.normalizeStyle(ie.value)},[oe[2]||(oe[2]=l.createElementVNode("div",{class:"wrapper_cart_delete"},[l.createElementVNode("div",{class:"cart_delete"})],-1)),l.createElementVNode("img",{src:l.unref(P)||"",class:"cart_box_image"},null,8,u1),l.createElementVNode("div",d1,[l.createElementVNode("div",f1,[l.createElementVNode("p",null,l.toDisplayString((G=o.cardItem)==null?void 0:G.name),1),(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(((W=i.cardItem)==null?void 0:W.discounts)||[],(S,$)=>(l.openBlock(),l.createElementBlock("div",{key:$,class:"discount_banner"},[l.createElementVNode("p",null,l.toDisplayString(S.name),1),l.createElementVNode("p",null,l.toDisplayString(S.discount)+"₽",1)]))),128)),l.createElementVNode("div",h1,[l.createElementVNode("button",{onClick:V},"-"),l.createElementVNode("p",g1,l.toDisplayString(i.cardItem.amount),1),l.createElementVNode("button",{onClick:k},"+")])]),l.createElementVNode("div",m1,[l.createElementVNode("div",{class:"cart_box_remove_item",onClick:v},[l.createVNode(c1)]),(Z=i.cardItem)!=null&&Z.new_price?(l.openBlock(),l.createElementBlock("p",{key:0,class:l.normalizeClass({discount_new_price:(X=i.cardItem)==null?void 0:X.new_price})},l.toDisplayString((i.cardItem.new_price*i.cardItem.amount).toFixed(2)+"₽"),3)):l.createCommentVNode("",!0),l.createElementVNode("p",null,l.toDisplayString(l.unref(N).toFixed(2)+"₽"),1)])]),!y.value&&R.value.length>0?(l.openBlock(),l.createElementBlock("div",{key:0,class:"cart_modifier_toggle",onTouchstart:l.withModifiers(M,["stop"])},[...oe[0]||(oe[0]=[l.createElementVNode("p",{class:"cart_info_more"},"Посмотреть модификаторы",-1),l.createElementVNode("p",{class:"cart_arrow"},null,-1)])],32)):l.createCommentVNode("",!0),y.value?(l.openBlock(),l.createElementBlock("div",p1,[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(R.value,S=>{var $;return l.openBlock(),l.createElementBlock("div",{class:"cart_modifier_item",key:S.id},[l.createElementVNode("div",x1,[l.createVNode(io,{id:"plus_orange"}),l.createElementVNode("p",null,l.toDisplayString(S.name),1)]),l.createElementVNode("div",w1,[l.createElementVNode("p",_1,l.toDisplayString(`x${S.amount}`),1),l.createElementVNode("div",C1,[S!=null&&S.new_price?(l.openBlock(),l.createElementBlock("p",{key:0,class:l.normalizeClass({discount_new_price:($=S==null?void 0:S.new_price)==null?void 0:$.toFixed(2)})},l.toDisplayString((S.new_price*S.amount).toFixed(2)+"₽"),3)):l.createCommentVNode("",!0),l.createElementVNode("p",null,l.toDisplayString((S.total_new_price||S.price*S.amount).toFixed(2)+"₽"),1)])])])}),128)),l.createElementVNode("div",{class:"cart_modifier_arrow",onTouchstart:l.withModifiers(M,["stop"])},[...oe[1]||(oe[1]=[l.createElementVNode("p",{class:"cart_info_more"},"Скрыть",-1),l.createElementVNode("p",{class:"cart_arrow_top"},null,-1)])],32)])):l.createCommentVNode("",!0)],36)}}}),[["__scopeId","data-v-868411fd"]]),E1={},y1={class:"nfc_x",viewBox:"0 0 48 48"};function b1(o,a){return l.openBlock(),l.createElementBlock("svg",y1,[...a[0]||(a[0]=[l.createElementVNode("rect",{x:"8",y:"12",width:"32",height:"24",rx:"4",ry:"4",stroke:"#B00020","stroke-width":"2.4",fill:"none"},null,-1),l.createElementVNode("path",{d:"M14 16L34 30M34 16L14 30",stroke:"#B00020","stroke-width":"3","stroke-linecap":"round"},null,-1)])])}const A1=Ue(E1,[["render",b1]]),I1={},S1={style:{},"aria-hidden":"true",viewBox:"0 0 48 48",class:"nfc_ok"};function N1(o,a){return l.openBlock(),l.createElementBlock("svg",S1,[...a[0]||(a[0]=[l.createElementVNode("rect",{x:"8",y:"12",width:"32",height:"24",rx:"4",ry:"4",stroke:"#5D534B","stroke-width":"none",fill:"none"},null,-1),l.createElementVNode("path",{d:"M16 22h16m-10 6h6",stroke:"#5D534B","stroke-width":"2.4","stroke-linecap":"round"},null,-1),l.createElementVNode("path",{d:"M14 28l6 6l14-14",fill:"none",stroke:"#2ECC71","stroke-width":"3","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)])])}const T1=Ue(I1,[["render",N1]]),k1={key:0,class:"nfc_ok",viewBox:"0 0 48 48","aria-hidden":"true"},R1=l.defineComponent({__name:"CardReaderRetry",props:{styleRetry:{type:Boolean}},setup(o){return(a,i)=>o.styleRetry?l.createCommentVNode("",!0):(l.openBlock(),l.createElementBlock("svg",k1,[...i[0]||(i[0]=[l.createElementVNode("rect",{x:"8",y:"12",width:"32",height:"24",rx:"4",ry:"4"},null,-1),l.createElementVNode("path",{d:"M16 22h16m-10 6h6"},null,-1)])]))}}),O1={class:"sheet_header"},B1={class:"sheet_title",id:"sheetTitle"},M1={class:"sheet_body"},v1={class:"sheet_card"},D1={class:"nfc_title"},P1={class:"lead"},L1={class:"wrapper_input_accept"},F1={key:1},V1={key:0,class:"card_phone_auth_wrapper"},U1={class:"sr_only","aria-live":"polite"},na=l.defineComponent({__name:"CardReader",setup(o){const a=ot(),i=It(),{is_OpenLoyal:u}=xe.storeToRefs(a),{itemThemes:f}=xe.storeToRefs(i),h=St(),m=l.ref(),w=l.ref(null),_=l.ref(""),p={wait:{text:"Лояльность",title:""},success:{text:"Стикер распознан",title:"Стикер распознан"},not_found:{text:"Стикер не распознан",title:"Стикер не распознали"}},C=l.computed({get:()=>_.value,set:H=>{_.value=H.replace(/\s/g,"")}}),y=l.computed(()=>h.currentState),N=l.computed(()=>h.isDrawerOpen),B=l.computed(()=>{var H;return((H=p[y.value])==null?void 0:H.text)||""}),R=l.computed(()=>{var H;(H=p[y.value])!=null&&H.title}),P=l.computed(()=>y.value==="success"?"Добро пожаловать!":f.value.kiosk_show_loyalty_phone_input_button?"Поднесите стикер к считывателю или войдите по номеру телефона":"Поднесите стикер к считывателю или введите номер карты вручную"),D=l.computed(()=>({ok:y.value==="success",warn:y.value==="not_found"})),v=l.computed(()=>{const H=[];return y.value==="wait"&&H.push("pulse","show-x"),y.value==="not_found"&&H.push("pulse","show-x"),y.value==="success"&&H.push("pulse","show-ok"),H}),M=l.computed(()=>y.value==="not_found"),k=l.computed(()=>y.value==="success"),V=l.computed(()=>y.value==="not_found"),te=l.computed(()=>["not_found"].includes(y.value)),ne=l.computed(()=>({wait:"Стикер не распознан. Нажмите «Повторить».",success:"Стикер распознан. Нажмите «Продолжить».",not_found:"Стикер не распознан. Нажмите «Повторить»."})[y.value]||""),U=()=>{h.closeDrawer(),u.value=!0},ie=async H=>{var ee,j;h.error="",w.value=null;try{const re=new En;await re.authorizeByCard(H.trim()),await re.getProfile(),a.loadCart(),h.setState("success"),h.isDrawerOpen=!1,h.showNotification("Вы успешно авторизовались в программе лояльности!")}catch(re){h.error=((j=(ee=re.response)==null?void 0:ee.data)==null?void 0:j.user_friendly_message)||"Ошибка",h.setState("not_found"),w.value=C.value,C.value=""}},z=l.computed(()=>{var ee;const H=(ee=f.value)==null?void 0:ee.kiosk_hide_manual_input_loyalty_card;return H??!1}),oe=()=>{h.setState("wait"),h.error="",C.value="",w.value=null},G=()=>{h.closeDrawer(),w.value=null,C.value=""},W=()=>{var H,ee;h.setState("wait"),(ee=(H=C.value)==null?void 0:H.trim())!=null&&ee.length&&ie(C.value.trim())},Z=H=>{H.stopPropagation(),document.activeElement!==m.value&&X()},X=()=>{l.nextTick(()=>{m.value&&(m.value.focus(),_.value&&m.value.select())})},S=H=>{const ee=document.activeElement===m.value;if(!N.value||ee)return;const j=H.key.toLowerCase();if(j==="backspace")return C.value=C.value.slice(0,-1);if(j==="escape")return G();if(j==="r"&&V.value)return oe();if(j==="c"&&y.value==="success")return G();if(j==="enter")return W();C.value+=j},$={mounted(H){H==null||H.focus()}};return l.onMounted(()=>{document==null||document.addEventListener("keydown",S)}),l.onBeforeUnmount(()=>{document==null||document.removeEventListener("keydown",S)}),l.watchEffect(()=>{N.value&&(h.error="")}),(H,ee)=>(l.openBlock(),l.createElementBlock(l.Fragment,null,[N.value?(l.openBlock(),l.createElementBlock("div",{key:0,class:"backdrop show",onClick:G,"aria-hidden":"true"})):l.createCommentVNode("",!0),N.value?(l.openBlock(),l.createElementBlock("section",{key:1,class:l.normalizeClass(["sheet show",{sheet_retry:V.value}]),"aria-modal":"true","aria-labelledby":"sheetTitle",onClick:Z},[l.createElementVNode("header",O1,[l.createElementVNode("div",B1,l.toDisplayString(B.value),1),V.value?(l.openBlock(),l.createElementBlock("div",{key:0,class:l.normalizeClass(["sheet_status",D.value])},l.toDisplayString(w.value),3)):l.createCommentVNode("",!0),l.createElementVNode("button",{class:"sheet_close",onClick:G,"aria-label":"Закрыть"}," Закрыть ")]),l.createElementVNode("div",M1,[l.createElementVNode("div",v1,[l.createElementVNode("div",{class:l.normalizeClass(["nfc",v.value])},[l.createVNode(R1,{styleRetry:te.value},null,8,["styleRetry"]),M.value?(l.openBlock(),l.createBlock(A1,{key:0})):l.createCommentVNode("",!0),l.createElementVNode("div",{class:"overlay check",style:l.normalizeStyle({display:k.value?"grid":"none"}),"aria-hidden":"true"},[l.createVNode(T1)],4)],2),l.createElementVNode("h2",D1,l.toDisplayString(R.value),1),l.createElementVNode("p",P1,l.toDisplayString(P.value),1),l.createElementVNode("div",L1,[l.withDirectives(l.createElementVNode("input",{style:l.normalizeStyle(z.value?{position:"absolute",left:"-9999px"}:{}),ref_key:"cardInputManualRef",ref:m,"onUpdate:modelValue":ee[0]||(ee[0]=j=>C.value=j),class:"nfc_title_read_input",type:"text",placeholder:"Введите трек карты","aria-live":"polite",onKeydown:l.withKeys(W,["enter"])},null,36),[[l.vModelText,C.value],[$]]),V.value?(l.openBlock(),l.createElementBlock("button",{key:0,class:"btn btn_ghost",onClick:oe},"Повторить")):(l.openBlock(),l.createElementBlock("div",F1,[z.value?l.createCommentVNode("",!0):(l.openBlock(),l.createElementBlock("button",{key:0,class:"btn btn_ghost",onClick:ee[1]||(ee[1]=j=>V.value?G:W())},"Отправить"))]))]),y.value==="wait"&&l.unref(f).kiosk_show_loyalty_phone_input_button?(l.openBlock(),l.createElementBlock("div",V1,[l.createElementVNode("button",{class:"card_phone_auth_button",onClick:U},"Войти по номеру телефона")])):l.createCommentVNode("",!0)])]),l.createElementVNode("div",U1,l.toDisplayString(ne.value),1)],2)):l.createCommentVNode("",!0)],64))}});function ra(){const o=Re.useRoute(),a=St(),i=ot(),{isButtonDisabled:u}=xe.storeToRefs(a),f=(m,w)=>{const _=m.is_tableservice?"tableservice":m.kiosk_menu?"kiosk":"qr",p=a.createPaymentHandler(_,m.kiosk_menu,m.is_tableservice,w);return p?{...p.config,route:{params:{orgId:String(o.params.orgId)}},handler:p.handler,setButtonDisabled:C=>{u.value=C},on403Kiosk:()=>{localStorage.removeItem("apiKey"),i.is_showApiKey=!0}}:null};return{getCreateOrderConfig:f,makeCreateOrderRequest:async(m,w)=>{const _=f(m,w.paymentMethodId);if(_)return Eu(w.items,w.tableDataId,_,{comment:w.comment,is_authorized:w.isAuthorized,signal:w.signal})}}}const H1="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxMDAiIGhlaWdodD0iMTAwIiB2aWV3Qm94PSIwIDAgMTAwIDEwMCIgcm9sZT0iaW1nIiBhcmlhLWxhYmVsPSJJTk5PIGJhbmsgY2FyZCBpY29uIj4NCiAgPGRlZnM+DQogICAgPGxpbmVhckdyYWRpZW50IGlkPSJibGFja0dyYWQiIHgxPSIwIiB5MT0iMCIgeDI9IjEiIHkyPSIxIj4NCiAgICAgIDxzdG9wIG9mZnNldD0iMCUiIHN0b3AtY29sb3I9IiMxQTFBMUEiLz4NCiAgICAgIDxzdG9wIG9mZnNldD0iMTAwJSIgc3RvcC1jb2xvcj0iIzAwMDAwMCIvPg0KICAgIDwvbGluZWFyR3JhZGllbnQ+DQoNCiAgICA8bGluZWFyR3JhZGllbnQgaWQ9InNoaW5lIiB4MT0iMCIgeTE9IjAiIHgyPSIxIiB5Mj0iMCI+DQogICAgICA8c3RvcCBvZmZzZXQ9IjAlIiBzdG9wLWNvbG9yPSIjRkZGRkZGIiBzdG9wLW9wYWNpdHk9IjAiLz4NCiAgICAgIDxzdG9wIG9mZnNldD0iNTAlIiBzdG9wLWNvbG9yPSIjRkZGRkZGIiBzdG9wLW9wYWNpdHk9IjAuMTgiLz4NCiAgICAgIDxzdG9wIG9mZnNldD0iMTAwJSIgc3RvcC1jb2xvcj0iI0ZGRkZGRiIgc3RvcC1vcGFjaXR5PSIwIi8+DQogICAgPC9saW5lYXJHcmFkaWVudD4NCg0KICAgIDxmaWx0ZXIgaWQ9InNoYWRvdyIgeD0iLTMwJSIgeT0iLTMwJSIgd2lkdGg9IjE2MCUiIGhlaWdodD0iMTYwJSI+DQogICAgICA8ZmVEcm9wU2hhZG93IGR4PSIwIiBkeT0iNiIgc3RkRGV2aWF0aW9uPSI2IiBmbG9vZC1jb2xvcj0iIzAwMCIgZmxvb2Qtb3BhY2l0eT0iMC4yNSIvPg0KICAgIDwvZmlsdGVyPg0KICA8L2RlZnM+DQoNCiAgPCEtLSBDZW50ZXJlZCBjYXJkIC0tPg0KICA8ZyB0cmFuc2Zvcm09InRyYW5zbGF0ZSg3LjUgMjMpIHJvdGF0ZSgtMTIpIiBmaWx0ZXI9InVybCgjc2hhZG93KSI+DQogICAgPCEtLSBjYXJkIGJvZHkgLS0+DQogICAgPHJlY3QgeD0iMCIgeT0iMCIgd2lkdGg9Ijg1IiBoZWlnaHQ9IjU0IiByeD0iMTAiIGZpbGw9InVybCgjYmxhY2tHcmFkKSIvPg0KDQogICAgPCEtLSB0b3Agc3RyaXBlIC0tPg0KICAgIDxyZWN0IHg9IjAiIHk9IjgiIHdpZHRoPSI4NSIgaGVpZ2h0PSI4IiByeD0iNCIgZmlsbD0iI0ZGRkZGRiIgb3BhY2l0eT0iMC4wNSIvPg0KDQogICAgPCEtLSBjaGlwIC0tPg0KICAgIDxnIHRyYW5zZm9ybT0idHJhbnNsYXRlKDEwIDI3KSI+DQogICAgICA8cmVjdCB3aWR0aD0iMTgiIGhlaWdodD0iMTUiIHJ4PSIzIiBmaWxsPSIjQ0ZBRTcwIi8+DQogICAgICA8cmVjdCB4PSIyLjUiIHk9IjMuNSIgd2lkdGg9IjEzIiBoZWlnaHQ9IjEuMiIgZmlsbD0iIzlFODM0RSIvPg0KICAgICAgPHJlY3QgeD0iMi41IiB5PSI2LjUiIHdpZHRoPSIxMyIgaGVpZ2h0PSIxLjIiIGZpbGw9IiM5RTgzNEUiLz4NCiAgICAgIDxyZWN0IHg9IjIuNSIgeT0iOS41IiB3aWR0aD0iMTMiIGhlaWdodD0iMS4yIiBmaWxsPSIjOUU4MzRFIi8+DQogICAgICA8cmVjdCB4PSI4LjUiIHk9IjAiIHdpZHRoPSIxLjUiIGhlaWdodD0iMTUiIGZpbGw9IiM5RTgzNEUiIG9wYWNpdHk9IjAuNiIvPg0KICAgIDwvZz4NCg0KICAgIDwhLS0gSU5OTyBsb2dvIC0tPg0KICAgIDx0ZXh0IHg9IjYxIiB5PSIzOSINCiAgICAgICAgICBmb250LWZhbWlseT0ic3lzdGVtLXVpLCAtYXBwbGUtc3lzdGVtLCBTZWdvZSBVSSwgUm9ib3RvLCBBcmlhbCwgc2Fucy1zZXJpZiINCiAgICAgICAgICBmb250LXNpemU9IjEzIg0KICAgICAgICAgIGZvbnQtd2VpZ2h0PSI4MDAiDQogICAgICAgICAgbGV0dGVyLXNwYWNpbmc9IjEuMiINCiAgICAgICAgICBmaWxsPSIjRkZGRkZGIg0KICAgICAgICAgIG9wYWNpdHk9IjAuOTUiDQogICAgICAgICAgdGV4dC1hbmNob3I9Im1pZGRsZSI+DQogICAgICBpbm5vDQogICAgPC90ZXh0Pg0KDQogICAgPCEtLSBzaGluZSAtLT4NCiAgICA8cGF0aCBkPSJNLTggNiBMMjUgLTMgTDk0IDQ3IEw2MCA2MiBMLTggMjUgWiIgZmlsbD0idXJsKCNzaGluZSkiLz4NCiAgPC9nPg0KPC9zdmc+",ia="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",z1=["src"],G1={class:"header_description"},W1=Ue(l.defineComponent({__name:"PaymentBoxes",props:{configPage:{},comment:{},cartItems:{},isAuthorized:{type:Boolean},hasRmsDiscount:{type:Boolean,default:!1},hideDiscountsButton:{type:Boolean,default:!1},orderId:{default:null},signal:{},provider:{}},emits:["select"],setup(o,{emit:a}){const i=o,u=a,f=St(),h=Rt(),{selectedProvider:m,isButtonDisabled:w}=xe.storeToRefs(f),{isAddToCard:_}=xe.storeToRefs(h),{makeCreateOrderRequest:p}=ra(),C={default:H1,SBP:ia},y=async()=>{m.value=i.provider;const B=i.provider.front_type;B&&(_.value=!1,w.value=!0,u("select",B),i.hasRmsDiscount&&!i.hideDiscountsButton&&i.orderId!=null?Lr(i.orderId,i.provider.type):await p(i.configPage,{paymentMethodId:B,items:i.cartItems,tableDataId:i.configPage.tableDataId,comment:i.comment,isAuthorized:i.isAuthorized,signal:i.signal}))},N=l.computed(()=>C[i.provider.front_type]||C.default);return(B,R)=>(l.openBlock(),l.createElementBlock("div",{class:"payment_boxes_wrapper",onClick:y},[l.createElementVNode("img",{class:"picture",src:N.value},null,8,z1),l.createElementVNode("div",G1,[l.createElementVNode("b",null,l.toDisplayString(o.provider.name),1),l.createElementVNode("p",null,l.toDisplayString(o.provider.description),1)]),l.createVNode(Fr)]))}}),[["__scopeId","data-v-7e25de77"]]),X1={key:0,class:"wrapper_cart_payment"},j1={class:"wrapper_paid"},Z1={class:"to_be_paid"},q1=Ue(l.defineComponent({__name:"CartPayment",props:{configPage:{},comment:{},cartItems:{},isAuthorized:{type:Boolean},hasRmsDiscount:{type:Boolean},hideDiscountsButton:{type:Boolean},orderId:{},signal:{}},emits:["selectPayment"],setup(o,{emit:a}){const i=St(),u=ot(),f=o,{totalPrice_lib:h,countBonus:m}=xe.storeToRefs(u),w=a,_=C=>{w("selectPayment",C)},p=()=>{w("selectPayment","")};return(C,y)=>l.unref(i).providerTypes.length>1?(l.openBlock(),l.createElementBlock("div",X1,[y[2]||(y[2]=l.createElementVNode("h2",null,"Выберите способ оплаты",-1)),y[3]||(y[3]=l.createElementVNode("p",{class:"description_payment"},"Можно изменить позже до оплаты",-1)),(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(i).providerTypes,(N,B)=>(l.openBlock(),l.createElementBlock("div",{key:B},[l.createVNode(W1,{provider:N,"config-page":f.configPage,comment:f.comment,"cart-items":f.cartItems,"is-authorized":f.isAuthorized,"has-rms-discount":f.hasRmsDiscount,"hide-discounts-button":f.hideDiscountsButton,"order-id":f.orderId,signal:f.signal,onSelect:_},null,8,["provider","config-page","comment","cart-items","is-authorized","has-rms-discount","hide-discounts-button","order-id","signal"])]))),128)),l.createElementVNode("div",j1,[l.createElementVNode("p",Z1,[y[0]||(y[0]=l.createTextVNode("К оплате ",-1)),l.createVNode(Xt,{price:l.unref(h)-l.unref(m),fixedFloat:2},null,8,["price"]),y[1]||(y[1]=l.createTextVNode(" ₽",-1))]),l.createVNode(un,{textButtonDefault:"Назад",onClick:p,class:"btn_payment"})])])):l.createCommentVNode("",!0)}}),[["__scopeId","data-v-93970a62"]]),Y1={class:"start_page"},$1=["src"],K1={class:"wrap"},Q1={class:"wrap_box"},J1={class:"title_fiscal_order"},ed={class:"wrapper_accept"},td={ref:"barRef",class:"bar_complete","aria-hidden":"true"},nd=Ue(l.defineComponent({__name:"CartCompleteKioskSuccess",props:{mediaUrl:{},orderNumber:{}},setup(o){const a=ot(),i=St(),u=Rt(),f=It(),{cartProducts_lib:h}=xe.storeToRefs(a),{orderNumber:m,orderCompleted_lib:w,selectedOrderType:_}=xe.storeToRefs(i),{is_startPage:p}=xe.storeToRefs(u),{mediaUrl:C}=Ln(()=>f.itemThemes.kiosk_preloader?"preloader":null),y=Re.useRouter(),N=Re.useRoute();let B=null;l.onMounted(()=>{B=setTimeout(()=>{p.value=!f.itemThemes.kiosk_disable_lock_screen,_.value=null,a.isOrderTypeSubmited=!1,y.replace(`/${N.params.orgId}`)},1e4)});const R=()=>{dr(["cart","authTokensAccess","authTokensRefresh"]),h.value=[],w.value=null,_.value=null,a.isOrderTypeSubmited=!1,i.clearCard(),a.profile=null,y.replace(`/${N.params.orgId}`)};return l.onUnmounted(()=>{B&&clearInterval(B)}),(P,D)=>(l.openBlock(),l.createElementBlock("div",Y1,[l.withDirectives((l.openBlock(),l.createElementBlock("video",{loop:"",autoplay:"",muted:"",playsinline:"",key:l.unref(C)},[l.createElementVNode("source",{src:l.unref(C)||"",type:"video/webm"},null,8,$1)])),[[l.unref(Vr)]]),D[4]||(D[4]=l.createElementVNode("div",{class:"start_img_black"},null,-1)),l.createElementVNode("div",K1,[l.createElementVNode("div",Q1,[D[1]||(D[1]=l.createElementVNode("div",{class:"icon","aria-hidden":"true"},[l.createElementVNode("svg",{viewBox:"0 0 24 24"},[l.createElementVNode("path",{d:"M20 6L9 17l-5-5"})])],-1)),D[2]||(D[2]=l.createElementVNode("h1",null," Заказ успешно оплачен ",-1)),l.createElementVNode("p",J1,"№ "+l.toDisplayString(l.unref(m)),1),D[3]||(D[3]=l.createElementVNode("p",{class:"title_fiscal_completed"},"Спасибо! Заказ передан в работу.",-1)),l.createElementVNode("div",ed,[l.createElementVNode("button",{class:"btn","aria-label":"Новый заказ",onClick:R},[D[0]||(D[0]=l.createElementVNode("span",{class:"label"},"Новый заказ",-1)),l.createElementVNode("span",td,null,512)])])])])]))}}),[["__scopeId","data-v-79c00acf"]]),rd={};function id(o,a){return a[0]||(a[0]=l.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 od=Ue(rd,[["render",id],["__scopeId","data-v-3e03a6dc"]]),sd={},ad={class:"center"};function ld(o,a){return l.openBlock(),l.createElementBlock("div",ad,[...a[0]||(a[0]=[l.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 cd=Ue(sd,[["render",ld],["__scopeId","data-v-f0859fd1"]]);/*!
|
|
1
|
+
(function(fe,Re){typeof exports=="object"&&typeof module<"u"?Re(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"],Re):(fe=typeof globalThis<"u"?globalThis:fe||self,Re(fe.InnoCloudsLib={},fe.VueRouter,fe.Pinia,fe.Vue,fe.VueuseCore,fe.motionV))})(this,function(fe,Re,xe,l,Wt,At){"use strict";var Pg=Object.defineProperty;var el=fe=>{throw TypeError(fe)};var Lg=(fe,Re,xe)=>Re in fe?Pg(fe,Re,{enumerable:!0,configurable:!0,writable:!0,value:xe}):fe[Re]=xe;var We=(fe,Re,xe)=>Lg(fe,typeof Re!="symbol"?Re+"":Re,xe),tl=(fe,Re,xe)=>Re.has(fe)||el("Cannot "+xe);var pn=(fe,Re,xe)=>(tl(fe,Re,"read from private field"),xe?xe.call(fe):Re.get(fe)),vi=(fe,Re,xe)=>Re.has(fe)?el("Cannot add the same private member more than once"):Re instanceof WeakSet?Re.add(fe):Re.set(fe,xe),Dn=(fe,Re,xe,l)=>(tl(fe,Re,"write to private field"),l?l.call(fe,xe):Re.set(fe,xe),xe);var Ho=(fe,Re,xe,l)=>({set _(Wt){Dn(fe,Re,Wt,xe)},get _(){return pn(fe,Re,l)}});var Qt,Hn,nr;function rl(o,s){for(var i=0;i<s.length;i++){const u=s[i];if(typeof u!="string"&&!Array.isArray(u)){for(const f in u)if(f!=="default"&&!(f in o)){const h=Object.getOwnPropertyDescriptor(u,f);h&&Object.defineProperty(o,f,h.get?h:{enumerable:!0,get:()=>u[f]})}}}return Object.freeze(Object.defineProperty(o,Symbol.toStringTag,{value:"Module"}))}function il(o){return o}const ol=[];function sl(){return Re.createRouter({history:Re.createWebHistory(),routes:ol})}const Di=(o,s)=>s.some(i=>o instanceof i);let Go,Wo;function al(){return Go||(Go=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function ll(){return Wo||(Wo=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}const Pi=new WeakMap,Li=new WeakMap,Qr=new WeakMap;function cl(o){const s=new Promise((i,u)=>{const f=()=>{o.removeEventListener("success",h),o.removeEventListener("error",m)},h=()=>{i(zn(o.result)),f()},m=()=>{u(o.error),f()};o.addEventListener("success",h),o.addEventListener("error",m)});return Qr.set(s,o),s}function ul(o){if(Pi.has(o))return;const s=new Promise((i,u)=>{const f=()=>{o.removeEventListener("complete",h),o.removeEventListener("error",m),o.removeEventListener("abort",m)},h=()=>{i(),f()},m=()=>{u(o.error||new DOMException("AbortError","AbortError")),f()};o.addEventListener("complete",h),o.addEventListener("error",m),o.addEventListener("abort",m)});Pi.set(o,s)}let Fi={get(o,s,i){if(o instanceof IDBTransaction){if(s==="done")return Pi.get(o);if(s==="store")return i.objectStoreNames[1]?void 0:i.objectStore(i.objectStoreNames[0])}return zn(o[s])},set(o,s,i){return o[s]=i,!0},has(o,s){return o instanceof IDBTransaction&&(s==="done"||s==="store")?!0:s in o}};function Xo(o){Fi=o(Fi)}function dl(o){return ll().includes(o)?function(...s){return o.apply(Vi(this),s),zn(this.request)}:function(...s){return zn(o.apply(Vi(this),s))}}function fl(o){return typeof o=="function"?dl(o):(o instanceof IDBTransaction&&ul(o),Di(o,al())?new Proxy(o,Fi):o)}function zn(o){if(o instanceof IDBRequest)return cl(o);if(Li.has(o))return Li.get(o);const s=fl(o);return s!==o&&(Li.set(o,s),Qr.set(s,o)),s}const Vi=o=>Qr.get(o);function hl(o,s,{blocked:i,upgrade:u,blocking:f,terminated:h}={}){const m=indexedDB.open(o,s),x=zn(m);return u&&m.addEventListener("upgradeneeded",_=>{u(zn(m.result),_.oldVersion,_.newVersion,zn(m.transaction),_)}),i&&m.addEventListener("blocked",_=>i(_.oldVersion,_.newVersion,_)),x.then(_=>{h&&_.addEventListener("close",()=>h()),f&&_.addEventListener("versionchange",p=>f(p.oldVersion,p.newVersion,p))}).catch(()=>{}),x}function gl(o,{blocked:s}={}){const i=indexedDB.deleteDatabase(o);return s&&i.addEventListener("blocked",u=>s(u.oldVersion,u)),zn(i).then(()=>{})}const ml=["get","getKey","getAll","getAllKeys","count"],pl=["put","add","delete","clear"],Ui=new Map;function jo(o,s){if(!(o instanceof IDBDatabase&&!(s in o)&&typeof s=="string"))return;if(Ui.get(s))return Ui.get(s);const i=s.replace(/FromIndex$/,""),u=s!==i,f=pl.includes(i);if(!(i in(u?IDBIndex:IDBObjectStore).prototype)||!(f||ml.includes(i)))return;const h=async function(m,...x){const _=this.transaction(m,f?"readwrite":"readonly");let p=_.store;return u&&(p=p.index(x.shift())),(await Promise.all([p[i](...x),f&&_.done]))[0]};return Ui.set(s,h),h}Xo(o=>({...o,get:(s,i,u)=>jo(s,i)||o.get(s,i,u),has:(s,i)=>!!jo(s,i)||o.has(s,i)}));const xl=["continue","continuePrimaryKey","advance"],qo={},zi=new WeakMap,Zo=new WeakMap,wl={get(o,s){if(!xl.includes(s))return o[s];let i=qo[s];return i||(i=qo[s]=function(...u){zi.set(this,Zo.get(this)[s](...u))}),i}};async function*_l(...o){let s=this;if(s instanceof IDBCursor||(s=await s.openCursor(...o)),!s)return;s=s;const i=new Proxy(s,wl);for(Zo.set(i,s),Qr.set(i,Vi(s));s;)yield i,s=await(zi.get(i)||s.continue()),zi.delete(i)}function Yo(o,s){return s===Symbol.asyncIterator&&Di(o,[IDBIndex,IDBObjectStore,IDBCursor])||s==="iterate"&&Di(o,[IDBIndex,IDBObjectStore])}Xo(o=>({...o,get(s,i,u){return Yo(s,i)?_l:o.get(s,i,u)},has(s,i){return Yo(s,i)||o.has(s,i)}}));let cr;async function $n(){return cr||(cr=hl("data",1,{upgrade(o){o.objectStoreNames.contains("groups")||o.createObjectStore("groups",{keyPath:"id"}),o.objectStoreNames.contains("media")||o.createObjectStore("media",{keyPath:"id"}),o.objectStoreNames.contains("products")||o.createObjectStore("products",{keyPath:"id"})}})),cr}async function Hi(o){return(await $n()).transaction("groups","readonly").objectStore("groups").get(o)}async function Rr(o,s){const u=(await $n()).transaction("groups","readwrite");await u.objectStore("groups").put({id:o,data:s,timestamp:Date.now()}),await u.done}async function Cl(o,s){const i=JSON.parse(JSON.stringify(l.toRaw(s.value)));await Rr(o,i)}async function Gi(o,s){const u=(await $n()).transaction("media","readwrite");await u.objectStore("media").put({id:o,blob:s,timestamp:Date.now()}),await u.done}async function ur(o){const f=await(await $n()).transaction("media","readonly").objectStore("media").get(o);return f==null?void 0:f.blob}async function El(o){const i=(await $n()).transaction("products","readwrite"),u=i.objectStore("products"),f=o.id;await u.put({id:f,product:o,timestamp:Date.now()}),await i.done}async function $o(o){const f=await(await $n()).transaction("products","readonly").objectStore("products").get(o);return f==null?void 0:f.product}async function yl(){if(cr){const o=await cr.catch(()=>null);o&&o.close(),cr=void 0}try{await gl("data",{blocked(){console.warn("Удаление заблокировано. открыты другие вкладки с сайтом.")}})}catch(o){console.error("Не удалось удалить базу: [lib, indexedDB]",o)}}function Jr(o){"@babel/helpers - typeof";return Jr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(s){return typeof s}:function(s){return s&&typeof Symbol=="function"&&s.constructor===Symbol&&s!==Symbol.prototype?"symbol":typeof s},Jr(o)}var bl=/^\s+/,Al=/\s+$/;function Ae(o,s){if(o=o||"",s=s||{},o instanceof Ae)return o;if(!(this instanceof Ae))return new Ae(o,s);var i=Il(o);this._originalInput=o,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=s.format||i.format,this._gradientType=s.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}Ae.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 s=this.toRgb();return(s.r*299+s.g*587+s.b*114)/1e3},getLuminance:function(){var s=this.toRgb(),i,u,f,h,m,x;return i=s.r/255,u=s.g/255,f=s.b/255,i<=.03928?h=i/12.92:h=Math.pow((i+.055)/1.055,2.4),u<=.03928?m=u/12.92:m=Math.pow((u+.055)/1.055,2.4),f<=.03928?x=f/12.92:x=Math.pow((f+.055)/1.055,2.4),.2126*h+.7152*m+.0722*x},setAlpha:function(s){return this._a=ns(s),this._roundA=Math.round(100*this._a)/100,this},toHsv:function(){var s=Qo(this._r,this._g,this._b);return{h:s.h*360,s:s.s,v:s.v,a:this._a}},toHsvString:function(){var s=Qo(this._r,this._g,this._b),i=Math.round(s.h*360),u=Math.round(s.s*100),f=Math.round(s.v*100);return this._a==1?"hsv("+i+", "+u+"%, "+f+"%)":"hsva("+i+", "+u+"%, "+f+"%, "+this._roundA+")"},toHsl:function(){var s=Ko(this._r,this._g,this._b);return{h:s.h*360,s:s.s,l:s.l,a:this._a}},toHslString:function(){var s=Ko(this._r,this._g,this._b),i=Math.round(s.h*360),u=Math.round(s.s*100),f=Math.round(s.l*100);return this._a==1?"hsl("+i+", "+u+"%, "+f+"%)":"hsla("+i+", "+u+"%, "+f+"%, "+this._roundA+")"},toHex:function(s){return Jo(this._r,this._g,this._b,s)},toHexString:function(s){return"#"+this.toHex(s)},toHex8:function(s){return kl(this._r,this._g,this._b,this._a,s)},toHex8String:function(s){return"#"+this.toHex8(s)},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(gt(this._r,255)*100)+"%",g:Math.round(gt(this._g,255)*100)+"%",b:Math.round(gt(this._b,255)*100)+"%",a:this._a}},toPercentageRgbString:function(){return this._a==1?"rgb("+Math.round(gt(this._r,255)*100)+"%, "+Math.round(gt(this._g,255)*100)+"%, "+Math.round(gt(this._b,255)*100)+"%)":"rgba("+Math.round(gt(this._r,255)*100)+"%, "+Math.round(gt(this._g,255)*100)+"%, "+Math.round(gt(this._b,255)*100)+"%, "+this._roundA+")"},toName:function(){return this._a===0?"transparent":this._a<1?!1:zl[Jo(this._r,this._g,this._b,!0)]||!1},toFilter:function(s){var i="#"+es(this._r,this._g,this._b,this._a),u=i,f=this._gradientType?"GradientType = 1, ":"";if(s){var h=Ae(s);u="#"+es(h._r,h._g,h._b,h._a)}return"progid:DXImageTransform.Microsoft.gradient("+f+"startColorstr="+i+",endColorstr="+u+")"},toString:function(s){var i=!!s;s=s||this._format;var u=!1,f=this._a<1&&this._a>=0,h=!i&&f&&(s==="hex"||s==="hex6"||s==="hex3"||s==="hex4"||s==="hex8"||s==="name");return h?s==="name"&&this._a===0?this.toName():this.toRgbString():(s==="rgb"&&(u=this.toRgbString()),s==="prgb"&&(u=this.toPercentageRgbString()),(s==="hex"||s==="hex6")&&(u=this.toHexString()),s==="hex3"&&(u=this.toHexString(!0)),s==="hex4"&&(u=this.toHex8String(!0)),s==="hex8"&&(u=this.toHex8String()),s==="name"&&(u=this.toName()),s==="hsl"&&(u=this.toHslString()),s==="hsv"&&(u=this.toHsvString()),u||this.toHexString())},clone:function(){return Ae(this.toString())},_applyModification:function(s,i){var u=s.apply(null,[this].concat([].slice.call(i)));return this._r=u._r,this._g=u._g,this._b=u._b,this.setAlpha(u._a),this},lighten:function(){return this._applyModification(Ml,arguments)},brighten:function(){return this._applyModification(vl,arguments)},darken:function(){return this._applyModification(Dl,arguments)},desaturate:function(){return this._applyModification(Rl,arguments)},saturate:function(){return this._applyModification(Ol,arguments)},greyscale:function(){return this._applyModification(Bl,arguments)},spin:function(){return this._applyModification(Pl,arguments)},_applyCombination:function(s,i){return s.apply(null,[this].concat([].slice.call(i)))},analogous:function(){return this._applyCombination(Vl,arguments)},complement:function(){return this._applyCombination(Ll,arguments)},monochromatic:function(){return this._applyCombination(Ul,arguments)},splitcomplement:function(){return this._applyCombination(Fl,arguments)},triad:function(){return this._applyCombination(ts,[3])},tetrad:function(){return this._applyCombination(ts,[4])}},Ae.fromRatio=function(o,s){if(Jr(o)=="object"){var i={};for(var u in o)o.hasOwnProperty(u)&&(u==="a"?i[u]=o[u]:i[u]=Or(o[u]));o=i}return Ae(o,s)};function Il(o){var s={r:0,g:0,b:0},i=1,u=null,f=null,h=null,m=!1,x=!1;return typeof o=="string"&&(o=Xl(o)),Jr(o)=="object"&&(Pn(o.r)&&Pn(o.g)&&Pn(o.b)?(s=Sl(o.r,o.g,o.b),m=!0,x=String(o.r).substr(-1)==="%"?"prgb":"rgb"):Pn(o.h)&&Pn(o.s)&&Pn(o.v)?(u=Or(o.s),f=Or(o.v),s=Tl(o.h,u,f),m=!0,x="hsv"):Pn(o.h)&&Pn(o.s)&&Pn(o.l)&&(u=Or(o.s),h=Or(o.l),s=Nl(o.h,u,h),m=!0,x="hsl"),o.hasOwnProperty("a")&&(i=o.a)),i=ns(i),{ok:m,format:o.format||x,r:Math.min(255,Math.max(s.r,0)),g:Math.min(255,Math.max(s.g,0)),b:Math.min(255,Math.max(s.b,0)),a:i}}function Sl(o,s,i){return{r:gt(o,255)*255,g:gt(s,255)*255,b:gt(i,255)*255}}function Ko(o,s,i){o=gt(o,255),s=gt(s,255),i=gt(i,255);var u=Math.max(o,s,i),f=Math.min(o,s,i),h,m,x=(u+f)/2;if(u==f)h=m=0;else{var _=u-f;switch(m=x>.5?_/(2-u-f):_/(u+f),u){case o:h=(s-i)/_+(s<i?6:0);break;case s:h=(i-o)/_+2;break;case i:h=(o-s)/_+4;break}h/=6}return{h,s:m,l:x}}function Nl(o,s,i){var u,f,h;o=gt(o,360),s=gt(s,100),i=gt(i,100);function m(p,C,y){return y<0&&(y+=1),y>1&&(y-=1),y<1/6?p+(C-p)*6*y:y<1/2?C:y<2/3?p+(C-p)*(2/3-y)*6:p}if(s===0)u=f=h=i;else{var x=i<.5?i*(1+s):i+s-i*s,_=2*i-x;u=m(_,x,o+1/3),f=m(_,x,o),h=m(_,x,o-1/3)}return{r:u*255,g:f*255,b:h*255}}function Qo(o,s,i){o=gt(o,255),s=gt(s,255),i=gt(i,255);var u=Math.max(o,s,i),f=Math.min(o,s,i),h,m,x=u,_=u-f;if(m=u===0?0:_/u,u==f)h=0;else{switch(u){case o:h=(s-i)/_+(s<i?6:0);break;case s:h=(i-o)/_+2;break;case i:h=(o-s)/_+4;break}h/=6}return{h,s:m,v:x}}function Tl(o,s,i){o=gt(o,360)*6,s=gt(s,100),i=gt(i,100);var u=Math.floor(o),f=o-u,h=i*(1-s),m=i*(1-f*s),x=i*(1-(1-f)*s),_=u%6,p=[i,m,h,h,x,i][_],C=[x,i,i,m,h,h][_],y=[h,h,x,i,i,m][_];return{r:p*255,g:C*255,b:y*255}}function Jo(o,s,i,u){var f=[xn(Math.round(o).toString(16)),xn(Math.round(s).toString(16)),xn(Math.round(i).toString(16))];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[0].charAt(0)+f[1].charAt(0)+f[2].charAt(0):f.join("")}function kl(o,s,i,u,f){var h=[xn(Math.round(o).toString(16)),xn(Math.round(s).toString(16)),xn(Math.round(i).toString(16)),xn(rs(u))];return f&&h[0].charAt(0)==h[0].charAt(1)&&h[1].charAt(0)==h[1].charAt(1)&&h[2].charAt(0)==h[2].charAt(1)&&h[3].charAt(0)==h[3].charAt(1)?h[0].charAt(0)+h[1].charAt(0)+h[2].charAt(0)+h[3].charAt(0):h.join("")}function es(o,s,i,u){var f=[xn(rs(u)),xn(Math.round(o).toString(16)),xn(Math.round(s).toString(16)),xn(Math.round(i).toString(16))];return f.join("")}Ae.equals=function(o,s){return!o||!s?!1:Ae(o).toRgbString()==Ae(s).toRgbString()},Ae.random=function(){return Ae.fromRatio({r:Math.random(),g:Math.random(),b:Math.random()})};function Rl(o,s){s=s===0?0:s||10;var i=Ae(o).toHsl();return i.s-=s/100,i.s=ei(i.s),Ae(i)}function Ol(o,s){s=s===0?0:s||10;var i=Ae(o).toHsl();return i.s+=s/100,i.s=ei(i.s),Ae(i)}function Bl(o){return Ae(o).desaturate(100)}function Ml(o,s){s=s===0?0:s||10;var i=Ae(o).toHsl();return i.l+=s/100,i.l=ei(i.l),Ae(i)}function vl(o,s){s=s===0?0:s||10;var i=Ae(o).toRgb();return i.r=Math.max(0,Math.min(255,i.r-Math.round(255*-(s/100)))),i.g=Math.max(0,Math.min(255,i.g-Math.round(255*-(s/100)))),i.b=Math.max(0,Math.min(255,i.b-Math.round(255*-(s/100)))),Ae(i)}function Dl(o,s){s=s===0?0:s||10;var i=Ae(o).toHsl();return i.l-=s/100,i.l=ei(i.l),Ae(i)}function Pl(o,s){var i=Ae(o).toHsl(),u=(i.h+s)%360;return i.h=u<0?360+u:u,Ae(i)}function Ll(o){var s=Ae(o).toHsl();return s.h=(s.h+180)%360,Ae(s)}function ts(o,s){if(isNaN(s)||s<=0)throw new Error("Argument to polyad must be a positive number");for(var i=Ae(o).toHsl(),u=[Ae(o)],f=360/s,h=1;h<s;h++)u.push(Ae({h:(i.h+h*f)%360,s:i.s,l:i.l}));return u}function Fl(o){var s=Ae(o).toHsl(),i=s.h;return[Ae(o),Ae({h:(i+72)%360,s:s.s,l:s.l}),Ae({h:(i+216)%360,s:s.s,l:s.l})]}function Vl(o,s,i){s=s||6,i=i||30;var u=Ae(o).toHsl(),f=360/i,h=[Ae(o)];for(u.h=(u.h-(f*s>>1)+720)%360;--s;)u.h=(u.h+f)%360,h.push(Ae(u));return h}function Ul(o,s){s=s||6;for(var i=Ae(o).toHsv(),u=i.h,f=i.s,h=i.v,m=[],x=1/s;s--;)m.push(Ae({h:u,s:f,v:h})),h=(h+x)%1;return m}Ae.mix=function(o,s,i){i=i===0?0:i||50;var u=Ae(o).toRgb(),f=Ae(s).toRgb(),h=i/100,m={r:(f.r-u.r)*h+u.r,g:(f.g-u.g)*h+u.g,b:(f.b-u.b)*h+u.b,a:(f.a-u.a)*h+u.a};return Ae(m)},Ae.readability=function(o,s){var i=Ae(o),u=Ae(s);return(Math.max(i.getLuminance(),u.getLuminance())+.05)/(Math.min(i.getLuminance(),u.getLuminance())+.05)},Ae.isReadable=function(o,s,i){var u=Ae.readability(o,s),f,h;switch(h=!1,f=jl(i),f.level+f.size){case"AAsmall":case"AAAlarge":h=u>=4.5;break;case"AAlarge":h=u>=3;break;case"AAAsmall":h=u>=7;break}return h},Ae.mostReadable=function(o,s,i){var u=null,f=0,h,m,x,_;i=i||{},m=i.includeFallbackColors,x=i.level,_=i.size;for(var p=0;p<s.length;p++)h=Ae.readability(o,s[p]),h>f&&(f=h,u=Ae(s[p]));return Ae.isReadable(o,u,{level:x,size:_})||!m?u:(i.includeFallbackColors=!1,Ae.mostReadable(o,["#fff","#000"],i))};var Wi=Ae.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},zl=Ae.hexNames=Hl(Wi);function Hl(o){var s={};for(var i in o)o.hasOwnProperty(i)&&(s[o[i]]=i);return s}function ns(o){return o=parseFloat(o),(isNaN(o)||o<0||o>1)&&(o=1),o}function gt(o,s){Gl(o)&&(o="100%");var i=Wl(o);return o=Math.min(s,Math.max(0,parseFloat(o))),i&&(o=parseInt(o*s,10)/100),Math.abs(o-s)<1e-6?1:o%s/parseFloat(s)}function ei(o){return Math.min(1,Math.max(0,o))}function on(o){return parseInt(o,16)}function Gl(o){return typeof o=="string"&&o.indexOf(".")!=-1&&parseFloat(o)===1}function Wl(o){return typeof o=="string"&&o.indexOf("%")!=-1}function xn(o){return o.length==1?"0"+o:""+o}function Or(o){return o<=1&&(o=o*100+"%"),o}function rs(o){return Math.round(parseFloat(o)*255).toString(16)}function is(o){return on(o)/255}var wn=function(){var o="[-\\+]?\\d+%?",s="[-\\+]?\\d*\\.\\d+%?",i="(?:"+s+")|(?:"+o+")",u="[\\s|\\(]+("+i+")[,|\\s]+("+i+")[,|\\s]+("+i+")\\s*\\)?",f="[\\s|\\(]+("+i+")[,|\\s]+("+i+")[,|\\s]+("+i+")[,|\\s]+("+i+")\\s*\\)?";return{CSS_UNIT:new RegExp(i),rgb:new RegExp("rgb"+u),rgba:new RegExp("rgba"+f),hsl:new RegExp("hsl"+u),hsla:new RegExp("hsla"+f),hsv:new RegExp("hsv"+u),hsva:new RegExp("hsva"+f),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}}();function Pn(o){return!!wn.CSS_UNIT.exec(o)}function Xl(o){o=o.replace(bl,"").replace(Al,"").toLowerCase();var s=!1;if(Wi[o])o=Wi[o],s=!0;else if(o=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var i;return(i=wn.rgb.exec(o))?{r:i[1],g:i[2],b:i[3]}:(i=wn.rgba.exec(o))?{r:i[1],g:i[2],b:i[3],a:i[4]}:(i=wn.hsl.exec(o))?{h:i[1],s:i[2],l:i[3]}:(i=wn.hsla.exec(o))?{h:i[1],s:i[2],l:i[3],a:i[4]}:(i=wn.hsv.exec(o))?{h:i[1],s:i[2],v:i[3]}:(i=wn.hsva.exec(o))?{h:i[1],s:i[2],v:i[3],a:i[4]}:(i=wn.hex8.exec(o))?{r:on(i[1]),g:on(i[2]),b:on(i[3]),a:is(i[4]),format:s?"name":"hex8"}:(i=wn.hex6.exec(o))?{r:on(i[1]),g:on(i[2]),b:on(i[3]),format:s?"name":"hex"}:(i=wn.hex4.exec(o))?{r:on(i[1]+""+i[1]),g:on(i[2]+""+i[2]),b:on(i[3]+""+i[3]),a:is(i[4]+""+i[4]),format:s?"name":"hex8"}:(i=wn.hex3.exec(o))?{r:on(i[1]+""+i[1]),g:on(i[2]+""+i[2]),b:on(i[3]+""+i[3]),format:s?"name":"hex"}:!1}function jl(o){var s,i;return o=o||{level:"AA",size:"small"},s=(o.level||"AA").toUpperCase(),i=(o.size||"small").toLowerCase(),s!=="AA"&&s!=="AAA"&&(s="AA"),i!=="small"&&i!=="large"&&(i="small"),{level:s,size:i}}const ti=xe.defineStore("imageCache",()=>{const o=l.ref({});let s=!1;function i(_,p){const C=String(_);o.value[C]&&URL.revokeObjectURL(o.value[C]);const y=URL.createObjectURL(p);o.value[C]=y}async function u(_){if(!_){console.warn("initCacheSingle called with null/undefined id");return}const p=String(_);if(o.value[p])return;const C=await ur(p);C&&(await scheduler.yield(),i(p,C),window.dispatchEvent(new CustomEvent("image-cached",{detail:{id:p,blob:C}})))}function f(_){const{id:p,blob:C}=_.detail;p&&C&&i(p,C)}function h(){typeof window>"u"||s||(window.addEventListener("image-cached",f),s=!0)}function m(){typeof window>"u"||!s||(window.removeEventListener("image-cached",f),s=!1)}function x(){Object.values(o.value).forEach(URL.revokeObjectURL),o.value={}}return typeof window<"u"&&h(),{cache:o,initCacheSingle:u,updateCacheFromBlob:i,cleanup:x,setupEventListener:h,removeEventListener:m}}),It=xe.defineStore("themeLib",()=>{const o=ti(),{initCacheSingle:s}=o,i=l.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_bypass_guest_auth:null,kiosk_bypass_guest_auth:null,kiosk_disable_lock_screen: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,pdf_return_url:null,kiosk_hide_manual_input_loyalty_card:null,kiosk_camera_scan_loyalty_card:null,kiosk_hide_menu_update_notification:null}),u=async h=>{if(!h)return;i.value={...h};const m=await ur("banner"),x=await ur("preloader"),_=await ur("defaultImage");m||f(h.kiosk_banner,"banner"),x||f(h.kiosk_preloader,"preloader"),_||f(h.fallback_image,"defaultImage"),document.documentElement.style.setProperty("--primaryColor",h.primary_color),document.documentElement.style.setProperty("--accentColor",h.accent_color),document.documentElement.style.setProperty("--accentLightColor",h.accent_light_color),document.documentElement.style.setProperty("--accentDarkColor",h.accent_dark_color),document.documentElement.style.setProperty("--bgButtonColor",h.bg_button_color),document.documentElement.style.setProperty("--inactiveButtonColor",h.inactive_button_color),document.documentElement.style.setProperty("--cardsColor",h.cards_color),document.documentElement.style.setProperty("--textColor",h.text_color),document.documentElement.style.setProperty("--nonworkingBgColor",h.nonworking_bg_color),h.apply_custom_size_picker_fonts&&h.size_picker_unselected_font_size&&h.size_picker_unselected_font_size>0&&document.documentElement.style.setProperty("--sizePickerUnselectedFontSize",`${h.size_picker_unselected_font_size}rem`),h.apply_custom_size_picker_fonts&&h.size_picker_selected_font_size&&h.size_picker_selected_font_size>0&&document.documentElement.style.setProperty("--sizePickerSelectedFontSize",`${h.size_picker_selected_font_size}rem`);const p=i.value.primary_color||"#F2F7FF",C=Ae(p).setAlpha(.7).toRgbString(),y=`linear-gradient(to bottom, transparent 10%, ${C} 50%, ${p} 85%)`,S=`-webkit-linear-gradient(to bottom, transparent 10%, ${C} 50%, ${p} 85%)`;return i.value.gradientStyle={background:y,backgroundColor:S},i.value},f=async(h,m)=>{if(h){const x=await fetch(h);if(!x.ok)throw new Error("Network error");const _=await x.blob();Gi(m,_),s(m)}};return{itemThemes:i,updateColor:u}}),dr=o=>{if(!o)return 0;if((o.price===0||o.price===null)&&o.sizes&&o.sizes.length>0){const s=o.sizes.find(i=>i.is_default===!0);return s?s.price:o.sizes.length>1&&o.sizes[1].price||o.sizes[0].price}return o.price};class Br extends Error{}Br.prototype.name="InvalidTokenError";function ql(o){return decodeURIComponent(atob(o).replace(/(.)/g,(s,i)=>{let u=i.charCodeAt(0).toString(16).toUpperCase();return u.length<2&&(u="0"+u),"%"+u}))}function Zl(o){let s=o.replace(/-/g,"+").replace(/_/g,"/");switch(s.length%4){case 0:break;case 2:s+="==";break;case 3:s+="=";break;default:throw new Error("base64 string is not of the correct length")}try{return ql(s)}catch{return atob(s)}}function os(o,s){if(typeof o!="string")throw new Br("Invalid token specified: must be a string");s||(s={});const i=s.header===!0?0:1,u=o.split(".")[i];if(typeof u!="string")throw new Br(`Invalid token specified: missing part #${i+1}`);let f;try{f=Zl(u)}catch(h){throw new Br(`Invalid token specified: invalid base64 for part #${i+1} (${h.message})`)}try{return JSON.parse(f)}catch(h){throw new Br(`Invalid token specified: invalid json for part #${i+1} (${h.message})`)}}const Yl=(o,s)=>{if(typeof window<"u"){const i=localStorage.getItem(o);return i?JSON.parse(i):s}return s},$l=(o,s)=>{if(typeof window<"u"){const i=localStorage.getItem(o);if(i)try{return os(JSON.parse(i))}catch(u){return console.error("Failed to decode JWT:",u),s}}return s},ss=(o,s,i="normal")=>{const u=l.ref(i==="jwt"?$l(o,s):Yl(o,s));return l.watchEffect(()=>{u.value===null||u.value===void 0?localStorage.removeItem(o):i!=="jwt"&&localStorage.setItem(o,JSON.stringify(u.value))}),u},fr=o=>{o.forEach(s=>{try{localStorage.removeItem(s)}catch(i){console.error(`Ошибка при удалении ключа "${s}":`,i)}})};class Kl{constructor(s,i={}){We(this,"url");We(this,"options");We(this,"ws");We(this,"reconnectInterval");We(this,"listeners");We(this,"isConnected");We(this,"heartbeat");We(this,"heartbeatTimeout");We(this,"pingTimeout");We(this,"pingResponseTimeout");We(this,"signal");We(this,"_shouldReconnect",!0);this.url=s,this.options=i,this.ws=null,this.reconnectInterval=5e3,this.pingResponseTimeout=5e3,this.listeners=new Map,this.isConnected=l.ref(!1),this.heartbeatTimeout=i.heartbeatTimeout||3e5}connect(){var i,u;if(this.ws&&this.ws.readyState===WebSocket.OPEN){console.warn("WebSocket already open");return}if(!this._shouldReconnect){console.warn("Reconnection disabled");return}const s=`${this.url}`;this.ws=new WebSocket(s),(i=this.options.signal)!=null&&i.aborted&&this.ws.close(),(u=this.options.signal)==null||u.addEventListener("abort",()=>this.close()),this.ws.onopen=()=>{console.warn("WebSocket connected"),this.isConnected.value=!0,this.emit("open"),this.heartbeat=setInterval(()=>this.sendPing(),this.heartbeatTimeout)},this.ws.onmessage=f=>{try{const h=JSON.parse(f.data);this.emit("message",h),h!=null&&h.type&&h.type!=="ping"&&clearTimeout(this.pingTimeout)}catch(h){console.error("Error parsing WebSocket message:",h)}},this.ws.onerror=f=>{console.error("WebSocket error:",f),this.emit("error",f),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 s;this.isConnected.value&&((s=this.ws)==null?void 0:s.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(s){var i;this.isConnected.value&&((i=this.ws)==null?void 0:i.readyState)===WebSocket.OPEN?this.ws.send(JSON.stringify(s)):console.warn("WebSocket not connected")}close(s=!1){this.ws&&(this._shouldReconnect=!s,this.ws.close(),clearInterval(this.heartbeat),clearTimeout(this.pingTimeout),this.ws=null,this.listeners.clear())}on(s,i){this.listeners.has(s)||this.listeners.set(s,[]),this.listeners.get(s).push(i)}off(s,i){const u=this.listeners.get(s);u&&this.listeners.set(s,u.filter(f=>f!==i))}emit(s,i=null){const u=this.listeners.get(s);u&&u.forEach(f=>f(i))}getConnectionStatus(){return this.isConnected}}let ni=new Map;function ri(o,s={}){var u;if(ni.has(o)){const f=ni.get(o);if(f.isConnected.value&&((u=f.ws)==null?void 0:u.readyState)===WebSocket.OPEN)return f.listeners.clear(),f;f.close(!0),ni.delete(o)}const i=new Kl(o,s);return ni.set(o,i),i}const lt=xe.defineStore("mainLib",()=>{const o=l.ref(),s=l.ref(!1),i=l.ref(localStorage.getItem("kiosk_timeout")),u=l.ref(0),f=l.ref(!1),h=l.ref(sessionStorage.getItem("is_adult")==="true"),m=l.ref([]),x=l.ref([]),_=l.ref(!1),p=l.ref(),C=l.ref(""),y=l.ref(0),S=l.ref(!1),M=l.ref(!1),k=l.ref(!0),P=l.ref(!localStorage.getItem("apiKey")),v=l.ref(!1),U=l.ref({textNotification:""}),B=l.ref([]);let R=null;const D=q=>{const re=`wss://${p.value.area}/ws/device/${q}/`;R=ri(re);function ge(){console.log("WebSocket connection opened")}function we(_e){if(_e.error)v.value=!0,U.value.textNotification=_e.error,R==null||R.close(!0);else{if(!(_e!=null&&_e.params))return;typeof _e.params.components.shift.is_ok!==null?k.value=_e.params.components.shift.is_ok:k.value=!0}}function Ne(_e){console.error("WebSocket error:",_e),R.close(!0)}R.on("open",ge),R.on("message",we),R.on("error",Ne),R.connect()},K=q=>{u.value=q,localStorage.setItem("kiosk_timeout",q)},te=q=>{s.value=q},z=l.ref(null),ie=l.computed(()=>m.value.reduce((q,re)=>{let ge=0,we=0;return re.group_modifiers&&(ge=re.group_modifiers.reduce((Ne,_e)=>_e.modifiers?Ne+_e.modifiers.reduce((Me,he)=>Me+he.old_price*he.amount,0):0,0)*re.amount),re.modifiers&&(we=re.modifiers.reduce((Ne,_e)=>Ne+_e.old_price*_e.amount,0)*re.amount),q+re.old_price*re.amount+ge+we},0)),W=l.computed({get:()=>m.value.length===0?0:z.value&&z.value!==0?z.value:m.value.reduce((q,re)=>{const ge=dr(re)*re.amount;let we=0,Ne=0;return re.group_modifiers&&(we=re.group_modifiers.reduce((_e,Me)=>Me.modifiers?_e+Me.modifiers.reduce((he,dt)=>he+dt.price*dt.amount,0):0,0)*re.amount),re.modifiers&&(Ne=re.modifiers.reduce((_e,Me)=>_e+Me.price*Me.amount,0)*re.amount),q+ge+we+Ne},0),set(q){z.value=q}}),se=q=>{y.value=q,localStorage.removeItem("bonus"),ss("bonus",y.value)},j=q=>{fr(q)},G=q=>{q={...q,idSystem:crypto.randomUUID()};const re=X(q);m.value.push(re),V()},V=()=>{try{if(!m.value||m.value.length===0){localStorage.removeItem("cart");return}localStorage.setItem("cart",JSON.stringify(l.toRaw(m.value)))}catch(q){console.error("Failed to update cart in localStorage:",q)}},X=q=>l.reactive({...q,amount:q.amount??1,price:q.old_price,new_price:null,total_new_price:null,discounts:[],modifiers:(q.modifiers||[]).map(re=>l.reactive({...re,price:re.old_price,new_price:null,total_new_price:null})),group_modifiers:(q.group_modifiers||[]).map(re=>l.reactive({...re,modifiers:(re.modifiers||[]).map(ge=>l.reactive({...ge,price:ge.old_price,new_price:null,total_new_price:null}))}))}),N=q=>{const re=m.value.find(ge=>ge.idSystem===q);re&&(re.amount+=1),V()},$=q=>{const re=m.value.find(ge=>ge.idSystem===q);re&&(re.amount>=1&&(re.amount-=1),V())},H=()=>{try{const q=localStorage.getItem("cart");if(q){const re=JSON.parse(q);m.value.splice(0,m.value.length,...re.map(X)),z.value=null}}catch(q){console.error("Failed to load cart from localStorage:",q)}};return H(),{cartProducts_lib:m,activeScrolling_lib:x,config_lib:p,totalPrice_lib:W,initialCartPrice_lib:ie,is_notification_lib:v,notificationData_lib:U,xApiKey_lib:C,countBonus:y,toggleDrum:s,is_showApiKey:P,openApiKey:S,kiosk_timeout:i,kiosk_FirstTimeout:u,is_OpenLoyal:M,profile:o,is_18_above_content:f,is18Allowed:h,healthState:k,displayCards:B,isOrderTypeSubmited:_,removeFromLocalStorage:j,setKioskTimeout:K,setBonus:se,setStateDrum:te,addToCart:G,plusAmount:N,minusAmount:$,loadCart:H,deleteItemFromCart:q=>{if(q){const re=m.value.findIndex(ge=>ge.idSystem===q);if(re===-1)return;m.value.splice(re,1),V(),z.value=null}else m.value=[],V()},updateCartInLocalStorage:V,makeProductFullyReactive:X,checkHeartbeatApp:D}});function as(o,s){return function(){return o.apply(s,arguments)}}const{toString:Ql}=Object.prototype,{getPrototypeOf:Xi}=Object,{iterator:ii,toStringTag:ls}=Symbol,oi=(o=>s=>{const i=Ql.call(s);return o[i]||(o[i]=i.slice(8,-1).toLowerCase())})(Object.create(null)),_n=o=>(o=o.toLowerCase(),s=>oi(s)===o),si=o=>s=>typeof s===o,{isArray:hr}=Array,gr=si("undefined");function Mr(o){return o!==null&&!gr(o)&&o.constructor!==null&&!gr(o.constructor)&&Yt(o.constructor.isBuffer)&&o.constructor.isBuffer(o)}const cs=_n("ArrayBuffer");function Jl(o){let s;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?s=ArrayBuffer.isView(o):s=o&&o.buffer&&cs(o.buffer),s}const ec=si("string"),Yt=si("function"),us=si("number"),vr=o=>o!==null&&typeof o=="object",tc=o=>o===!0||o===!1,ai=o=>{if(oi(o)!=="object")return!1;const s=Xi(o);return(s===null||s===Object.prototype||Object.getPrototypeOf(s)===null)&&!(ls in o)&&!(ii in o)},nc=o=>{if(!vr(o)||Mr(o))return!1;try{return Object.keys(o).length===0&&Object.getPrototypeOf(o)===Object.prototype}catch{return!1}},rc=_n("Date"),ic=_n("File"),oc=_n("Blob"),sc=_n("FileList"),ac=o=>vr(o)&&Yt(o.pipe),lc=o=>{let s;return o&&(typeof FormData=="function"&&o instanceof FormData||Yt(o.append)&&((s=oi(o))==="formdata"||s==="object"&&Yt(o.toString)&&o.toString()==="[object FormData]"))},cc=_n("URLSearchParams"),[uc,dc,fc,hc]=["ReadableStream","Request","Response","Headers"].map(_n),gc=o=>o.trim?o.trim():o.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Dr(o,s,{allOwnKeys:i=!1}={}){if(o===null||typeof o>"u")return;let u,f;if(typeof o!="object"&&(o=[o]),hr(o))for(u=0,f=o.length;u<f;u++)s.call(null,o[u],u,o);else{if(Mr(o))return;const h=i?Object.getOwnPropertyNames(o):Object.keys(o),m=h.length;let x;for(u=0;u<m;u++)x=h[u],s.call(null,o[x],x,o)}}function ds(o,s){if(Mr(o))return null;s=s.toLowerCase();const i=Object.keys(o);let u=i.length,f;for(;u-- >0;)if(f=i[u],s===f.toLowerCase())return f;return null}const Kn=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,fs=o=>!gr(o)&&o!==Kn;function ji(){const{caseless:o,skipUndefined:s}=fs(this)&&this||{},i={},u=(f,h)=>{const m=o&&ds(i,h)||h;ai(i[m])&&ai(f)?i[m]=ji(i[m],f):ai(f)?i[m]=ji({},f):hr(f)?i[m]=f.slice():(!s||!gr(f))&&(i[m]=f)};for(let f=0,h=arguments.length;f<h;f++)arguments[f]&&Dr(arguments[f],u);return i}const mc=(o,s,i,{allOwnKeys:u}={})=>(Dr(s,(f,h)=>{i&&Yt(f)?o[h]=as(f,i):o[h]=f},{allOwnKeys:u}),o),pc=o=>(o.charCodeAt(0)===65279&&(o=o.slice(1)),o),xc=(o,s,i,u)=>{o.prototype=Object.create(s.prototype,u),o.prototype.constructor=o,Object.defineProperty(o,"super",{value:s.prototype}),i&&Object.assign(o.prototype,i)},wc=(o,s,i,u)=>{let f,h,m;const x={};if(s=s||{},o==null)return s;do{for(f=Object.getOwnPropertyNames(o),h=f.length;h-- >0;)m=f[h],(!u||u(m,o,s))&&!x[m]&&(s[m]=o[m],x[m]=!0);o=i!==!1&&Xi(o)}while(o&&(!i||i(o,s))&&o!==Object.prototype);return s},_c=(o,s,i)=>{o=String(o),(i===void 0||i>o.length)&&(i=o.length),i-=s.length;const u=o.indexOf(s,i);return u!==-1&&u===i},Cc=o=>{if(!o)return null;if(hr(o))return o;let s=o.length;if(!us(s))return null;const i=new Array(s);for(;s-- >0;)i[s]=o[s];return i},Ec=(o=>s=>o&&s instanceof o)(typeof Uint8Array<"u"&&Xi(Uint8Array)),yc=(o,s)=>{const u=(o&&o[ii]).call(o);let f;for(;(f=u.next())&&!f.done;){const h=f.value;s.call(o,h[0],h[1])}},bc=(o,s)=>{let i;const u=[];for(;(i=o.exec(s))!==null;)u.push(i);return u},Ac=_n("HTMLFormElement"),Ic=o=>o.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(i,u,f){return u.toUpperCase()+f}),hs=(({hasOwnProperty:o})=>(s,i)=>o.call(s,i))(Object.prototype),Sc=_n("RegExp"),gs=(o,s)=>{const i=Object.getOwnPropertyDescriptors(o),u={};Dr(i,(f,h)=>{let m;(m=s(f,h,o))!==!1&&(u[h]=m||f)}),Object.defineProperties(o,u)},Nc=o=>{gs(o,(s,i)=>{if(Yt(o)&&["arguments","caller","callee"].indexOf(i)!==-1)return!1;const u=o[i];if(Yt(u)){if(s.enumerable=!1,"writable"in s){s.writable=!1;return}s.set||(s.set=()=>{throw Error("Can not rewrite read-only method '"+i+"'")})}})},Tc=(o,s)=>{const i={},u=f=>{f.forEach(h=>{i[h]=!0})};return hr(o)?u(o):u(String(o).split(s)),i},kc=()=>{},Rc=(o,s)=>o!=null&&Number.isFinite(o=+o)?o:s;function Oc(o){return!!(o&&Yt(o.append)&&o[ls]==="FormData"&&o[ii])}const Bc=o=>{const s=new Array(10),i=(u,f)=>{if(vr(u)){if(s.indexOf(u)>=0)return;if(Mr(u))return u;if(!("toJSON"in u)){s[f]=u;const h=hr(u)?[]:{};return Dr(u,(m,x)=>{const _=i(m,f+1);!gr(_)&&(h[x]=_)}),s[f]=void 0,h}}return u};return i(o,0)},Mc=_n("AsyncFunction"),vc=o=>o&&(vr(o)||Yt(o))&&Yt(o.then)&&Yt(o.catch),ms=((o,s)=>o?setImmediate:s?((i,u)=>(Kn.addEventListener("message",({source:f,data:h})=>{f===Kn&&h===i&&u.length&&u.shift()()},!1),f=>{u.push(f),Kn.postMessage(i,"*")}))(`axios@${Math.random()}`,[]):i=>setTimeout(i))(typeof setImmediate=="function",Yt(Kn.postMessage)),Dc=typeof queueMicrotask<"u"?queueMicrotask.bind(Kn):typeof process<"u"&&process.nextTick||ms,Q={isArray:hr,isArrayBuffer:cs,isBuffer:Mr,isFormData:lc,isArrayBufferView:Jl,isString:ec,isNumber:us,isBoolean:tc,isObject:vr,isPlainObject:ai,isEmptyObject:nc,isReadableStream:uc,isRequest:dc,isResponse:fc,isHeaders:hc,isUndefined:gr,isDate:rc,isFile:ic,isBlob:oc,isRegExp:Sc,isFunction:Yt,isStream:ac,isURLSearchParams:cc,isTypedArray:Ec,isFileList:sc,forEach:Dr,merge:ji,extend:mc,trim:gc,stripBOM:pc,inherits:xc,toFlatObject:wc,kindOf:oi,kindOfTest:_n,endsWith:_c,toArray:Cc,forEachEntry:yc,matchAll:bc,isHTMLForm:Ac,hasOwnProperty:hs,hasOwnProp:hs,reduceDescriptors:gs,freezeMethods:Nc,toObjectSet:Tc,toCamelCase:Ic,noop:kc,toFiniteNumber:Rc,findKey:ds,global:Kn,isContextDefined:fs,isSpecCompliantForm:Oc,toJSONObject:Bc,isAsyncFn:Mc,isThenable:vc,setImmediate:ms,asap:Dc,isIterable:o=>o!=null&&Yt(o[ii])};function Be(o,s,i,u,f){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=o,this.name="AxiosError",s&&(this.code=s),i&&(this.config=i),u&&(this.request=u),f&&(this.response=f,this.status=f.status?f.status:null)}Q.inherits(Be,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:Q.toJSONObject(this.config),code:this.code,status:this.status}}});const ps=Be.prototype,xs={};["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(o=>{xs[o]={value:o}}),Object.defineProperties(Be,xs),Object.defineProperty(ps,"isAxiosError",{value:!0}),Be.from=(o,s,i,u,f,h)=>{const m=Object.create(ps);Q.toFlatObject(o,m,function(C){return C!==Error.prototype},p=>p!=="isAxiosError");const x=o&&o.message?o.message:"Error",_=s==null&&o?o.code:s;return Be.call(m,x,_,i,u,f),o&&m.cause==null&&Object.defineProperty(m,"cause",{value:o,configurable:!0}),m.name=o&&o.name||"Error",h&&Object.assign(m,h),m};const Pc=null;function qi(o){return Q.isPlainObject(o)||Q.isArray(o)}function ws(o){return Q.endsWith(o,"[]")?o.slice(0,-2):o}function _s(o,s,i){return o?o.concat(s).map(function(f,h){return f=ws(f),!i&&h?"["+f+"]":f}).join(i?".":""):s}function Lc(o){return Q.isArray(o)&&!o.some(qi)}const Fc=Q.toFlatObject(Q,{},null,function(s){return/^is[A-Z]/.test(s)});function li(o,s,i){if(!Q.isObject(o))throw new TypeError("target must be an object");s=s||new FormData,i=Q.toFlatObject(i,{metaTokens:!0,dots:!1,indexes:!1},!1,function(P,v){return!Q.isUndefined(v[P])});const u=i.metaTokens,f=i.visitor||C,h=i.dots,m=i.indexes,_=(i.Blob||typeof Blob<"u"&&Blob)&&Q.isSpecCompliantForm(s);if(!Q.isFunction(f))throw new TypeError("visitor must be a function");function p(k){if(k===null)return"";if(Q.isDate(k))return k.toISOString();if(Q.isBoolean(k))return k.toString();if(!_&&Q.isBlob(k))throw new Be("Blob is not supported. Use a Buffer instead.");return Q.isArrayBuffer(k)||Q.isTypedArray(k)?_&&typeof Blob=="function"?new Blob([k]):Buffer.from(k):k}function C(k,P,v){let U=k;if(k&&!v&&typeof k=="object"){if(Q.endsWith(P,"{}"))P=u?P:P.slice(0,-2),k=JSON.stringify(k);else if(Q.isArray(k)&&Lc(k)||(Q.isFileList(k)||Q.endsWith(P,"[]"))&&(U=Q.toArray(k)))return P=ws(P),U.forEach(function(R,D){!(Q.isUndefined(R)||R===null)&&s.append(m===!0?_s([P],D,h):m===null?P:P+"[]",p(R))}),!1}return qi(k)?!0:(s.append(_s(v,P,h),p(k)),!1)}const y=[],S=Object.assign(Fc,{defaultVisitor:C,convertValue:p,isVisitable:qi});function M(k,P){if(!Q.isUndefined(k)){if(y.indexOf(k)!==-1)throw Error("Circular reference detected in "+P.join("."));y.push(k),Q.forEach(k,function(U,B){(!(Q.isUndefined(U)||U===null)&&f.call(s,U,Q.isString(B)?B.trim():B,P,S))===!0&&M(U,P?P.concat(B):[B])}),y.pop()}}if(!Q.isObject(o))throw new TypeError("data must be an object");return M(o),s}function Cs(o){const s={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(o).replace(/[!'()~]|%20|%00/g,function(u){return s[u]})}function Zi(o,s){this._pairs=[],o&&li(o,this,s)}const Es=Zi.prototype;Es.append=function(s,i){this._pairs.push([s,i])},Es.toString=function(s){const i=s?function(u){return s.call(this,u,Cs)}:Cs;return this._pairs.map(function(f){return i(f[0])+"="+i(f[1])},"").join("&")};function Vc(o){return encodeURIComponent(o).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function ys(o,s,i){if(!s)return o;const u=i&&i.encode||Vc;Q.isFunction(i)&&(i={serialize:i});const f=i&&i.serialize;let h;if(f?h=f(s,i):h=Q.isURLSearchParams(s)?s.toString():new Zi(s,i).toString(u),h){const m=o.indexOf("#");m!==-1&&(o=o.slice(0,m)),o+=(o.indexOf("?")===-1?"?":"&")+h}return o}class bs{constructor(){this.handlers=[]}use(s,i,u){return this.handlers.push({fulfilled:s,rejected:i,synchronous:u?u.synchronous:!1,runWhen:u?u.runWhen:null}),this.handlers.length-1}eject(s){this.handlers[s]&&(this.handlers[s]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(s){Q.forEach(this.handlers,function(u){u!==null&&s(u)})}}const As={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Uc={isBrowser:!0,classes:{URLSearchParams:typeof URLSearchParams<"u"?URLSearchParams:Zi,FormData:typeof FormData<"u"?FormData:null,Blob:typeof Blob<"u"?Blob:null},protocols:["http","https","file","blob","url","data"]},Yi=typeof window<"u"&&typeof document<"u",$i=typeof navigator=="object"&&navigator||void 0,zc=Yi&&(!$i||["ReactNative","NativeScript","NS"].indexOf($i.product)<0),Hc=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Gc=Yi&&window.location.href||"http://localhost",zt={...Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:Yi,hasStandardBrowserEnv:zc,hasStandardBrowserWebWorkerEnv:Hc,navigator:$i,origin:Gc},Symbol.toStringTag,{value:"Module"})),...Uc};function Wc(o,s){return li(o,new zt.classes.URLSearchParams,{visitor:function(i,u,f,h){return zt.isNode&&Q.isBuffer(i)?(this.append(u,i.toString("base64")),!1):h.defaultVisitor.apply(this,arguments)},...s})}function Xc(o){return Q.matchAll(/\w+|\[(\w*)]/g,o).map(s=>s[0]==="[]"?"":s[1]||s[0])}function jc(o){const s={},i=Object.keys(o);let u;const f=i.length;let h;for(u=0;u<f;u++)h=i[u],s[h]=o[h];return s}function Is(o){function s(i,u,f,h){let m=i[h++];if(m==="__proto__")return!0;const x=Number.isFinite(+m),_=h>=i.length;return m=!m&&Q.isArray(f)?f.length:m,_?(Q.hasOwnProp(f,m)?f[m]=[f[m],u]:f[m]=u,!x):((!f[m]||!Q.isObject(f[m]))&&(f[m]=[]),s(i,u,f[m],h)&&Q.isArray(f[m])&&(f[m]=jc(f[m])),!x)}if(Q.isFormData(o)&&Q.isFunction(o.entries)){const i={};return Q.forEachEntry(o,(u,f)=>{s(Xc(u),f,i,0)}),i}return null}function qc(o,s,i){if(Q.isString(o))try{return(s||JSON.parse)(o),Q.trim(o)}catch(u){if(u.name!=="SyntaxError")throw u}return(i||JSON.stringify)(o)}const Pr={transitional:As,adapter:["xhr","http","fetch"],transformRequest:[function(s,i){const u=i.getContentType()||"",f=u.indexOf("application/json")>-1,h=Q.isObject(s);if(h&&Q.isHTMLForm(s)&&(s=new FormData(s)),Q.isFormData(s))return f?JSON.stringify(Is(s)):s;if(Q.isArrayBuffer(s)||Q.isBuffer(s)||Q.isStream(s)||Q.isFile(s)||Q.isBlob(s)||Q.isReadableStream(s))return s;if(Q.isArrayBufferView(s))return s.buffer;if(Q.isURLSearchParams(s))return i.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),s.toString();let x;if(h){if(u.indexOf("application/x-www-form-urlencoded")>-1)return Wc(s,this.formSerializer).toString();if((x=Q.isFileList(s))||u.indexOf("multipart/form-data")>-1){const _=this.env&&this.env.FormData;return li(x?{"files[]":s}:s,_&&new _,this.formSerializer)}}return h||f?(i.setContentType("application/json",!1),qc(s)):s}],transformResponse:[function(s){const i=this.transitional||Pr.transitional,u=i&&i.forcedJSONParsing,f=this.responseType==="json";if(Q.isResponse(s)||Q.isReadableStream(s))return s;if(s&&Q.isString(s)&&(u&&!this.responseType||f)){const m=!(i&&i.silentJSONParsing)&&f;try{return JSON.parse(s,this.parseReviver)}catch(x){if(m)throw x.name==="SyntaxError"?Be.from(x,Be.ERR_BAD_RESPONSE,this,null,this.response):x}}return s}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:zt.classes.FormData,Blob:zt.classes.Blob},validateStatus:function(s){return s>=200&&s<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};Q.forEach(["delete","get","head","post","put","patch"],o=>{Pr.headers[o]={}});const Zc=Q.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"]),Yc=o=>{const s={};let i,u,f;return o&&o.split(`
|
|
2
|
+
`).forEach(function(m){f=m.indexOf(":"),i=m.substring(0,f).trim().toLowerCase(),u=m.substring(f+1).trim(),!(!i||s[i]&&Zc[i])&&(i==="set-cookie"?s[i]?s[i].push(u):s[i]=[u]:s[i]=s[i]?s[i]+", "+u:u)}),s},Ss=Symbol("internals");function Lr(o){return o&&String(o).trim().toLowerCase()}function ci(o){return o===!1||o==null?o:Q.isArray(o)?o.map(ci):String(o)}function $c(o){const s=Object.create(null),i=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let u;for(;u=i.exec(o);)s[u[1]]=u[2];return s}const Kc=o=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(o.trim());function Ki(o,s,i,u,f){if(Q.isFunction(u))return u.call(this,s,i);if(f&&(s=i),!!Q.isString(s)){if(Q.isString(u))return s.indexOf(u)!==-1;if(Q.isRegExp(u))return u.test(s)}}function Qc(o){return o.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(s,i,u)=>i.toUpperCase()+u)}function Jc(o,s){const i=Q.toCamelCase(" "+s);["get","set","has"].forEach(u=>{Object.defineProperty(o,u+i,{value:function(f,h,m){return this[u].call(this,s,f,h,m)},configurable:!0})})}let $t=class{constructor(s){s&&this.set(s)}set(s,i,u){const f=this;function h(x,_,p){const C=Lr(_);if(!C)throw new Error("header name must be a non-empty string");const y=Q.findKey(f,C);(!y||f[y]===void 0||p===!0||p===void 0&&f[y]!==!1)&&(f[y||_]=ci(x))}const m=(x,_)=>Q.forEach(x,(p,C)=>h(p,C,_));if(Q.isPlainObject(s)||s instanceof this.constructor)m(s,i);else if(Q.isString(s)&&(s=s.trim())&&!Kc(s))m(Yc(s),i);else if(Q.isObject(s)&&Q.isIterable(s)){let x={},_,p;for(const C of s){if(!Q.isArray(C))throw TypeError("Object iterator must return a key-value pair");x[p=C[0]]=(_=x[p])?Q.isArray(_)?[..._,C[1]]:[_,C[1]]:C[1]}m(x,i)}else s!=null&&h(i,s,u);return this}get(s,i){if(s=Lr(s),s){const u=Q.findKey(this,s);if(u){const f=this[u];if(!i)return f;if(i===!0)return $c(f);if(Q.isFunction(i))return i.call(this,f,u);if(Q.isRegExp(i))return i.exec(f);throw new TypeError("parser must be boolean|regexp|function")}}}has(s,i){if(s=Lr(s),s){const u=Q.findKey(this,s);return!!(u&&this[u]!==void 0&&(!i||Ki(this,this[u],u,i)))}return!1}delete(s,i){const u=this;let f=!1;function h(m){if(m=Lr(m),m){const x=Q.findKey(u,m);x&&(!i||Ki(u,u[x],x,i))&&(delete u[x],f=!0)}}return Q.isArray(s)?s.forEach(h):h(s),f}clear(s){const i=Object.keys(this);let u=i.length,f=!1;for(;u--;){const h=i[u];(!s||Ki(this,this[h],h,s,!0))&&(delete this[h],f=!0)}return f}normalize(s){const i=this,u={};return Q.forEach(this,(f,h)=>{const m=Q.findKey(u,h);if(m){i[m]=ci(f),delete i[h];return}const x=s?Qc(h):String(h).trim();x!==h&&delete i[h],i[x]=ci(f),u[x]=!0}),this}concat(...s){return this.constructor.concat(this,...s)}toJSON(s){const i=Object.create(null);return Q.forEach(this,(u,f)=>{u!=null&&u!==!1&&(i[f]=s&&Q.isArray(u)?u.join(", "):u)}),i}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([s,i])=>s+": "+i).join(`
|
|
3
|
+
`)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(s){return s instanceof this?s:new this(s)}static concat(s,...i){const u=new this(s);return i.forEach(f=>u.set(f)),u}static accessor(s){const u=(this[Ss]=this[Ss]={accessors:{}}).accessors,f=this.prototype;function h(m){const x=Lr(m);u[x]||(Jc(f,m),u[x]=!0)}return Q.isArray(s)?s.forEach(h):h(s),this}};$t.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),Q.reduceDescriptors($t.prototype,({value:o},s)=>{let i=s[0].toUpperCase()+s.slice(1);return{get:()=>o,set(u){this[i]=u}}}),Q.freezeMethods($t);function Qi(o,s){const i=this||Pr,u=s||i,f=$t.from(u.headers);let h=u.data;return Q.forEach(o,function(x){h=x.call(i,h,f.normalize(),s?s.status:void 0)}),f.normalize(),h}function Ns(o){return!!(o&&o.__CANCEL__)}function mr(o,s,i){Be.call(this,o??"canceled",Be.ERR_CANCELED,s,i),this.name="CanceledError"}Q.inherits(mr,Be,{__CANCEL__:!0});function Ts(o,s,i){const u=i.config.validateStatus;!i.status||!u||u(i.status)?o(i):s(new Be("Request failed with status code "+i.status,[Be.ERR_BAD_REQUEST,Be.ERR_BAD_RESPONSE][Math.floor(i.status/100)-4],i.config,i.request,i))}function eu(o){const s=/^([-+\w]{1,25})(:?\/\/|:)/.exec(o);return s&&s[1]||""}function tu(o,s){o=o||10;const i=new Array(o),u=new Array(o);let f=0,h=0,m;return s=s!==void 0?s:1e3,function(_){const p=Date.now(),C=u[h];m||(m=p),i[f]=_,u[f]=p;let y=h,S=0;for(;y!==f;)S+=i[y++],y=y%o;if(f=(f+1)%o,f===h&&(h=(h+1)%o),p-m<s)return;const M=C&&p-C;return M?Math.round(S*1e3/M):void 0}}function nu(o,s){let i=0,u=1e3/s,f,h;const m=(p,C=Date.now())=>{i=C,f=null,h&&(clearTimeout(h),h=null),o(...p)};return[(...p)=>{const C=Date.now(),y=C-i;y>=u?m(p,C):(f=p,h||(h=setTimeout(()=>{h=null,m(f)},u-y)))},()=>f&&m(f)]}const ui=(o,s,i=3)=>{let u=0;const f=tu(50,250);return nu(h=>{const m=h.loaded,x=h.lengthComputable?h.total:void 0,_=m-u,p=f(_),C=m<=x;u=m;const y={loaded:m,total:x,progress:x?m/x:void 0,bytes:_,rate:p||void 0,estimated:p&&x&&C?(x-m)/p:void 0,event:h,lengthComputable:x!=null,[s?"download":"upload"]:!0};o(y)},i)},ks=(o,s)=>{const i=o!=null;return[u=>s[0]({lengthComputable:i,total:o,loaded:u}),s[1]]},Rs=o=>(...s)=>Q.asap(()=>o(...s)),ru=zt.hasStandardBrowserEnv?((o,s)=>i=>(i=new URL(i,zt.origin),o.protocol===i.protocol&&o.host===i.host&&(s||o.port===i.port)))(new URL(zt.origin),zt.navigator&&/(msie|trident)/i.test(zt.navigator.userAgent)):()=>!0,iu=zt.hasStandardBrowserEnv?{write(o,s,i,u,f,h,m){if(typeof document>"u")return;const x=[`${o}=${encodeURIComponent(s)}`];Q.isNumber(i)&&x.push(`expires=${new Date(i).toUTCString()}`),Q.isString(u)&&x.push(`path=${u}`),Q.isString(f)&&x.push(`domain=${f}`),h===!0&&x.push("secure"),Q.isString(m)&&x.push(`SameSite=${m}`),document.cookie=x.join("; ")},read(o){if(typeof document>"u")return null;const s=document.cookie.match(new RegExp("(?:^|; )"+o+"=([^;]*)"));return s?decodeURIComponent(s[1]):null},remove(o){this.write(o,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function ou(o){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(o)}function su(o,s){return s?o.replace(/\/?\/$/,"")+"/"+s.replace(/^\/+/,""):o}function Os(o,s,i){let u=!ou(s);return o&&(u||i==!1)?su(o,s):s}const Bs=o=>o instanceof $t?{...o}:o;function Qn(o,s){s=s||{};const i={};function u(p,C,y,S){return Q.isPlainObject(p)&&Q.isPlainObject(C)?Q.merge.call({caseless:S},p,C):Q.isPlainObject(C)?Q.merge({},C):Q.isArray(C)?C.slice():C}function f(p,C,y,S){if(Q.isUndefined(C)){if(!Q.isUndefined(p))return u(void 0,p,y,S)}else return u(p,C,y,S)}function h(p,C){if(!Q.isUndefined(C))return u(void 0,C)}function m(p,C){if(Q.isUndefined(C)){if(!Q.isUndefined(p))return u(void 0,p)}else return u(void 0,C)}function x(p,C,y){if(y in s)return u(p,C);if(y in o)return u(void 0,p)}const _={url:h,method:h,data:h,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:x,headers:(p,C,y)=>f(Bs(p),Bs(C),y,!0)};return Q.forEach(Object.keys({...o,...s}),function(C){const y=_[C]||f,S=y(o[C],s[C],C);Q.isUndefined(S)&&y!==x||(i[C]=S)}),i}const Ms=o=>{const s=Qn({},o);let{data:i,withXSRFToken:u,xsrfHeaderName:f,xsrfCookieName:h,headers:m,auth:x}=s;if(s.headers=m=$t.from(m),s.url=ys(Os(s.baseURL,s.url,s.allowAbsoluteUrls),o.params,o.paramsSerializer),x&&m.set("Authorization","Basic "+btoa((x.username||"")+":"+(x.password?unescape(encodeURIComponent(x.password)):""))),Q.isFormData(i)){if(zt.hasStandardBrowserEnv||zt.hasStandardBrowserWebWorkerEnv)m.setContentType(void 0);else if(Q.isFunction(i.getHeaders)){const _=i.getHeaders(),p=["content-type","content-length"];Object.entries(_).forEach(([C,y])=>{p.includes(C.toLowerCase())&&m.set(C,y)})}}if(zt.hasStandardBrowserEnv&&(u&&Q.isFunction(u)&&(u=u(s)),u||u!==!1&&ru(s.url))){const _=f&&h&&iu.read(h);_&&m.set(f,_)}return s},au=typeof XMLHttpRequest<"u"&&function(o){return new Promise(function(i,u){const f=Ms(o);let h=f.data;const m=$t.from(f.headers).normalize();let{responseType:x,onUploadProgress:_,onDownloadProgress:p}=f,C,y,S,M,k;function P(){M&&M(),k&&k(),f.cancelToken&&f.cancelToken.unsubscribe(C),f.signal&&f.signal.removeEventListener("abort",C)}let v=new XMLHttpRequest;v.open(f.method.toUpperCase(),f.url,!0),v.timeout=f.timeout;function U(){if(!v)return;const R=$t.from("getAllResponseHeaders"in v&&v.getAllResponseHeaders()),K={data:!x||x==="text"||x==="json"?v.responseText:v.response,status:v.status,statusText:v.statusText,headers:R,config:o,request:v};Ts(function(z){i(z),P()},function(z){u(z),P()},K),v=null}"onloadend"in v?v.onloadend=U:v.onreadystatechange=function(){!v||v.readyState!==4||v.status===0&&!(v.responseURL&&v.responseURL.indexOf("file:")===0)||setTimeout(U)},v.onabort=function(){v&&(u(new Be("Request aborted",Be.ECONNABORTED,o,v)),v=null)},v.onerror=function(D){const K=D&&D.message?D.message:"Network Error",te=new Be(K,Be.ERR_NETWORK,o,v);te.event=D||null,u(te),v=null},v.ontimeout=function(){let D=f.timeout?"timeout of "+f.timeout+"ms exceeded":"timeout exceeded";const K=f.transitional||As;f.timeoutErrorMessage&&(D=f.timeoutErrorMessage),u(new Be(D,K.clarifyTimeoutError?Be.ETIMEDOUT:Be.ECONNABORTED,o,v)),v=null},h===void 0&&m.setContentType(null),"setRequestHeader"in v&&Q.forEach(m.toJSON(),function(D,K){v.setRequestHeader(K,D)}),Q.isUndefined(f.withCredentials)||(v.withCredentials=!!f.withCredentials),x&&x!=="json"&&(v.responseType=f.responseType),p&&([S,k]=ui(p,!0),v.addEventListener("progress",S)),_&&v.upload&&([y,M]=ui(_),v.upload.addEventListener("progress",y),v.upload.addEventListener("loadend",M)),(f.cancelToken||f.signal)&&(C=R=>{v&&(u(!R||R.type?new mr(null,o,v):R),v.abort(),v=null)},f.cancelToken&&f.cancelToken.subscribe(C),f.signal&&(f.signal.aborted?C():f.signal.addEventListener("abort",C)));const B=eu(f.url);if(B&&zt.protocols.indexOf(B)===-1){u(new Be("Unsupported protocol "+B+":",Be.ERR_BAD_REQUEST,o));return}v.send(h||null)})},lu=(o,s)=>{const{length:i}=o=o?o.filter(Boolean):[];if(s||i){let u=new AbortController,f;const h=function(p){if(!f){f=!0,x();const C=p instanceof Error?p:this.reason;u.abort(C instanceof Be?C:new mr(C instanceof Error?C.message:C))}};let m=s&&setTimeout(()=>{m=null,h(new Be(`timeout ${s} of ms exceeded`,Be.ETIMEDOUT))},s);const x=()=>{o&&(m&&clearTimeout(m),m=null,o.forEach(p=>{p.unsubscribe?p.unsubscribe(h):p.removeEventListener("abort",h)}),o=null)};o.forEach(p=>p.addEventListener("abort",h));const{signal:_}=u;return _.unsubscribe=()=>Q.asap(x),_}},cu=function*(o,s){let i=o.byteLength;if(i<s){yield o;return}let u=0,f;for(;u<i;)f=u+s,yield o.slice(u,f),u=f},uu=async function*(o,s){for await(const i of du(o))yield*cu(i,s)},du=async function*(o){if(o[Symbol.asyncIterator]){yield*o;return}const s=o.getReader();try{for(;;){const{done:i,value:u}=await s.read();if(i)break;yield u}}finally{await s.cancel()}},vs=(o,s,i,u)=>{const f=uu(o,s);let h=0,m,x=_=>{m||(m=!0,u&&u(_))};return new ReadableStream({async pull(_){try{const{done:p,value:C}=await f.next();if(p){x(),_.close();return}let y=C.byteLength;if(i){let S=h+=y;i(S)}_.enqueue(new Uint8Array(C))}catch(p){throw x(p),p}},cancel(_){return x(_),f.return()}},{highWaterMark:2})},Ds=64*1024,{isFunction:di}=Q,fu=(({Request:o,Response:s})=>({Request:o,Response:s}))(Q.global),{ReadableStream:Ps,TextEncoder:Ls}=Q.global,Fs=(o,...s)=>{try{return!!o(...s)}catch{return!1}},hu=o=>{o=Q.merge.call({skipUndefined:!0},fu,o);const{fetch:s,Request:i,Response:u}=o,f=s?di(s):typeof fetch=="function",h=di(i),m=di(u);if(!f)return!1;const x=f&&di(Ps),_=f&&(typeof Ls=="function"?(k=>P=>k.encode(P))(new Ls):async k=>new Uint8Array(await new i(k).arrayBuffer())),p=h&&x&&Fs(()=>{let k=!1;const P=new i(zt.origin,{body:new Ps,method:"POST",get duplex(){return k=!0,"half"}}).headers.has("Content-Type");return k&&!P}),C=m&&x&&Fs(()=>Q.isReadableStream(new u("").body)),y={stream:C&&(k=>k.body)};f&&["text","arrayBuffer","blob","formData","stream"].forEach(k=>{!y[k]&&(y[k]=(P,v)=>{let U=P&&P[k];if(U)return U.call(P);throw new Be(`Response type '${k}' is not supported`,Be.ERR_NOT_SUPPORT,v)})});const S=async k=>{if(k==null)return 0;if(Q.isBlob(k))return k.size;if(Q.isSpecCompliantForm(k))return(await new i(zt.origin,{method:"POST",body:k}).arrayBuffer()).byteLength;if(Q.isArrayBufferView(k)||Q.isArrayBuffer(k))return k.byteLength;if(Q.isURLSearchParams(k)&&(k=k+""),Q.isString(k))return(await _(k)).byteLength},M=async(k,P)=>{const v=Q.toFiniteNumber(k.getContentLength());return v??S(P)};return async k=>{let{url:P,method:v,data:U,signal:B,cancelToken:R,timeout:D,onDownloadProgress:K,onUploadProgress:te,responseType:z,headers:ie,withCredentials:W="same-origin",fetchOptions:se}=Ms(k),j=s||fetch;z=z?(z+"").toLowerCase():"text";let G=lu([B,R&&R.toAbortSignal()],D),V=null;const X=G&&G.unsubscribe&&(()=>{G.unsubscribe()});let N;try{if(te&&p&&v!=="get"&&v!=="head"&&(N=await M(ie,U))!==0){let ge=new i(P,{method:"POST",body:U,duplex:"half"}),we;if(Q.isFormData(U)&&(we=ge.headers.get("content-type"))&&ie.setContentType(we),ge.body){const[Ne,_e]=ks(N,ui(Rs(te)));U=vs(ge.body,Ds,Ne,_e)}}Q.isString(W)||(W=W?"include":"omit");const $=h&&"credentials"in i.prototype,H={...se,signal:G,method:v.toUpperCase(),headers:ie.normalize().toJSON(),body:U,duplex:"half",credentials:$?W:void 0};V=h&&new i(P,H);let J=await(h?j(V,se):j(P,H));const q=C&&(z==="stream"||z==="response");if(C&&(K||q&&X)){const ge={};["status","statusText","headers"].forEach(Me=>{ge[Me]=J[Me]});const we=Q.toFiniteNumber(J.headers.get("content-length")),[Ne,_e]=K&&ks(we,ui(Rs(K),!0))||[];J=new u(vs(J.body,Ds,Ne,()=>{_e&&_e(),X&&X()}),ge)}z=z||"text";let re=await y[Q.findKey(y,z)||"text"](J,k);return!q&&X&&X(),await new Promise((ge,we)=>{Ts(ge,we,{data:re,headers:$t.from(J.headers),status:J.status,statusText:J.statusText,config:k,request:V})})}catch($){throw X&&X(),$&&$.name==="TypeError"&&/Load failed|fetch/i.test($.message)?Object.assign(new Be("Network Error",Be.ERR_NETWORK,k,V),{cause:$.cause||$}):Be.from($,$&&$.code,k,V)}}},gu=new Map,Vs=o=>{let s=o&&o.env||{};const{fetch:i,Request:u,Response:f}=s,h=[u,f,i];let m=h.length,x=m,_,p,C=gu;for(;x--;)_=h[x],p=C.get(_),p===void 0&&C.set(_,p=x?new Map:hu(s)),C=p;return p};Vs();const Ji={http:Pc,xhr:au,fetch:{get:Vs}};Q.forEach(Ji,(o,s)=>{if(o){try{Object.defineProperty(o,"name",{value:s})}catch{}Object.defineProperty(o,"adapterName",{value:s})}});const Us=o=>`- ${o}`,mu=o=>Q.isFunction(o)||o===null||o===!1;function pu(o,s){o=Q.isArray(o)?o:[o];const{length:i}=o;let u,f;const h={};for(let m=0;m<i;m++){u=o[m];let x;if(f=u,!mu(u)&&(f=Ji[(x=String(u)).toLowerCase()],f===void 0))throw new Be(`Unknown adapter '${x}'`);if(f&&(Q.isFunction(f)||(f=f.get(s))))break;h[x||"#"+m]=f}if(!f){const m=Object.entries(h).map(([_,p])=>`adapter ${_} `+(p===!1?"is not supported by the environment":"is not available in the build"));let x=i?m.length>1?`since :
|
|
4
|
+
`+m.map(Us).join(`
|
|
5
|
+
`):" "+Us(m[0]):"as no adapter specified";throw new Be("There is no suitable adapter to dispatch the request "+x,"ERR_NOT_SUPPORT")}return f}const zs={getAdapter:pu,adapters:Ji};function eo(o){if(o.cancelToken&&o.cancelToken.throwIfRequested(),o.signal&&o.signal.aborted)throw new mr(null,o)}function Hs(o){return eo(o),o.headers=$t.from(o.headers),o.data=Qi.call(o,o.transformRequest),["post","put","patch"].indexOf(o.method)!==-1&&o.headers.setContentType("application/x-www-form-urlencoded",!1),zs.getAdapter(o.adapter||Pr.adapter,o)(o).then(function(u){return eo(o),u.data=Qi.call(o,o.transformResponse,u),u.headers=$t.from(u.headers),u},function(u){return Ns(u)||(eo(o),u&&u.response&&(u.response.data=Qi.call(o,o.transformResponse,u.response),u.response.headers=$t.from(u.response.headers))),Promise.reject(u)})}const Gs="1.13.2",fi={};["object","boolean","number","function","string","symbol"].forEach((o,s)=>{fi[o]=function(u){return typeof u===o||"a"+(s<1?"n ":" ")+o}});const Ws={};fi.transitional=function(s,i,u){function f(h,m){return"[Axios v"+Gs+"] Transitional option '"+h+"'"+m+(u?". "+u:"")}return(h,m,x)=>{if(s===!1)throw new Be(f(m," has been removed"+(i?" in "+i:"")),Be.ERR_DEPRECATED);return i&&!Ws[m]&&(Ws[m]=!0,console.warn(f(m," has been deprecated since v"+i+" and will be removed in the near future"))),s?s(h,m,x):!0}},fi.spelling=function(s){return(i,u)=>(console.warn(`${u} is likely a misspelling of ${s}`),!0)};function xu(o,s,i){if(typeof o!="object")throw new Be("options must be an object",Be.ERR_BAD_OPTION_VALUE);const u=Object.keys(o);let f=u.length;for(;f-- >0;){const h=u[f],m=s[h];if(m){const x=o[h],_=x===void 0||m(x,h,o);if(_!==!0)throw new Be("option "+h+" must be "+_,Be.ERR_BAD_OPTION_VALUE);continue}if(i!==!0)throw new Be("Unknown option "+h,Be.ERR_BAD_OPTION)}}const hi={assertOptions:xu,validators:fi},In=hi.validators;let Jn=class{constructor(s){this.defaults=s||{},this.interceptors={request:new bs,response:new bs}}async request(s,i){try{return await this._request(s,i)}catch(u){if(u instanceof Error){let f={};Error.captureStackTrace?Error.captureStackTrace(f):f=new Error;const h=f.stack?f.stack.replace(/^.+\n/,""):"";try{u.stack?h&&!String(u.stack).endsWith(h.replace(/^.+\n.+\n/,""))&&(u.stack+=`
|
|
6
|
+
`+h):u.stack=h}catch{}}throw u}}_request(s,i){typeof s=="string"?(i=i||{},i.url=s):i=s||{},i=Qn(this.defaults,i);const{transitional:u,paramsSerializer:f,headers:h}=i;u!==void 0&&hi.assertOptions(u,{silentJSONParsing:In.transitional(In.boolean),forcedJSONParsing:In.transitional(In.boolean),clarifyTimeoutError:In.transitional(In.boolean)},!1),f!=null&&(Q.isFunction(f)?i.paramsSerializer={serialize:f}:hi.assertOptions(f,{encode:In.function,serialize:In.function},!0)),i.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?i.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:i.allowAbsoluteUrls=!0),hi.assertOptions(i,{baseUrl:In.spelling("baseURL"),withXsrfToken:In.spelling("withXSRFToken")},!0),i.method=(i.method||this.defaults.method||"get").toLowerCase();let m=h&&Q.merge(h.common,h[i.method]);h&&Q.forEach(["delete","get","head","post","put","patch","common"],k=>{delete h[k]}),i.headers=$t.concat(m,h);const x=[];let _=!0;this.interceptors.request.forEach(function(P){typeof P.runWhen=="function"&&P.runWhen(i)===!1||(_=_&&P.synchronous,x.unshift(P.fulfilled,P.rejected))});const p=[];this.interceptors.response.forEach(function(P){p.push(P.fulfilled,P.rejected)});let C,y=0,S;if(!_){const k=[Hs.bind(this),void 0];for(k.unshift(...x),k.push(...p),S=k.length,C=Promise.resolve(i);y<S;)C=C.then(k[y++],k[y++]);return C}S=x.length;let M=i;for(;y<S;){const k=x[y++],P=x[y++];try{M=k(M)}catch(v){P.call(this,v);break}}try{C=Hs.call(this,M)}catch(k){return Promise.reject(k)}for(y=0,S=p.length;y<S;)C=C.then(p[y++],p[y++]);return C}getUri(s){s=Qn(this.defaults,s);const i=Os(s.baseURL,s.url,s.allowAbsoluteUrls);return ys(i,s.params,s.paramsSerializer)}};Q.forEach(["delete","get","head","options"],function(s){Jn.prototype[s]=function(i,u){return this.request(Qn(u||{},{method:s,url:i,data:(u||{}).data}))}}),Q.forEach(["post","put","patch"],function(s){function i(u){return function(h,m,x){return this.request(Qn(x||{},{method:s,headers:u?{"Content-Type":"multipart/form-data"}:{},url:h,data:m}))}}Jn.prototype[s]=i(),Jn.prototype[s+"Form"]=i(!0)});let wu=class nl{constructor(s){if(typeof s!="function")throw new TypeError("executor must be a function.");let i;this.promise=new Promise(function(h){i=h});const u=this;this.promise.then(f=>{if(!u._listeners)return;let h=u._listeners.length;for(;h-- >0;)u._listeners[h](f);u._listeners=null}),this.promise.then=f=>{let h;const m=new Promise(x=>{u.subscribe(x),h=x}).then(f);return m.cancel=function(){u.unsubscribe(h)},m},s(function(h,m,x){u.reason||(u.reason=new mr(h,m,x),i(u.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(s){if(this.reason){s(this.reason);return}this._listeners?this._listeners.push(s):this._listeners=[s]}unsubscribe(s){if(!this._listeners)return;const i=this._listeners.indexOf(s);i!==-1&&this._listeners.splice(i,1)}toAbortSignal(){const s=new AbortController,i=u=>{s.abort(u)};return this.subscribe(i),s.signal.unsubscribe=()=>this.unsubscribe(i),s.signal}static source(){let s;return{token:new nl(function(f){s=f}),cancel:s}}};function _u(o){return function(i){return o.apply(null,i)}}function Cu(o){return Q.isObject(o)&&o.isAxiosError===!0}const to={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(to).forEach(([o,s])=>{to[s]=o});function Xs(o){const s=new Jn(o),i=as(Jn.prototype.request,s);return Q.extend(i,Jn.prototype,s,{allOwnKeys:!0}),Q.extend(i,s,null,{allOwnKeys:!0}),i.create=function(f){return Xs(Qn(o,f))},i}const et=Xs(Pr);et.Axios=Jn,et.CanceledError=mr,et.CancelToken=wu,et.isCancel=Ns,et.VERSION=Gs,et.toFormData=li,et.AxiosError=Be,et.Cancel=et.CanceledError,et.all=function(s){return Promise.all(s)},et.spread=_u,et.isAxiosError=Cu,et.mergeConfig=Qn,et.AxiosHeaders=$t,et.formToJSON=o=>Is(Q.isHTMLForm(o)?new FormData(o):o),et.getAdapter=zs.getAdapter,et.HttpStatusCode=to,et.default=et;const{Axios:Wg,AxiosError:Xg,CanceledError:jg,isCancel:qg,CancelToken:Zg,VERSION:Yg,all:$g,Cancel:Kg,isAxiosError:Qg,spread:Jg,toFormData:em,AxiosHeaders:tm,HttpStatusCode:nm,formToJSON:rm,getAdapter:im,mergeConfig:om}=et;let Sn=null,Ht=null;function Cn(o){o&&o.close(!0)}async function Fr(o,s){const i=St(),u=lt(),f=En.create();try{const h=await f.initPaymentLink(o,s);return i.paymentCostQR=u.totalPrice_lib-u.countBonus,i.linkQR=h.url,Ht==null||Ht.deleteCart(null,Ht==null?void 0:Ht.is_requestKiosk),h}catch(h){throw i.isButtonDisabled=!1,i.showNotification(h==null?void 0:h.response.data.user_friendly_message),h}}function Eu(o,s,i){if(o!=null&&o.params){if(o.error){s.showNotification(o.error),cn(s,null),ro(s);return}i(o,s)}}function no(o,s){const i=St(),u=lt();return s.has_rms_discount?(o.params.new_discounts&&(i.extraDiscount=Number(o.params.new_total_cost)-s.initialCartPrice,u.totalPrice_lib=Number(o.params.new_total_cost),s.showNotification("К заказу были добавлены скидки")),!0):!1}const cn=(o,s)=>{o.updateOrderStatus&&o.updateOrderStatus(s)},yu=o=>{o.loadCart&&o.loadCart()},gi=o=>{o.resetBonuses&&o.resetBonuses()},ro=o=>{o.closeWebSocket&&o.closeWebSocket()},js=(o,s)=>{o.is_tableservice&&(Cn(s),o.resetStores(),o.deleteCart(null,o.is_requestKiosk),o.cartCleanup?o.cartCleanup.cleanupAndNavigate("profile",o.is_requestKiosk):o.deleteCart("profile",o.is_requestKiosk))},qs=(o,s,i,u)=>{const f=s.ws||i;En.create().orderPay(o.params.order_id||"").then(m=>{s.setOrderNumber&&s.setOrderNumber(m.data.order_number)}).catch(m=>{(s.errorHandler||u).handleOrderPayError(m,{...s,closeWebSocket:()=>Cn(f)})})},io=(o,s,i)=>{const u=o.ws||s;(o.errorHandler||i).handleOrderError({...o,closeWebSocket:()=>Cn(u)})},bu=(o,s,i)=>{const u=St(),f=u.getCurrentPaymentMethodId();if(!f||!Ln.getConfig(f)||!Ln.isMethodAvailable(f,o))return null;const m=Ln.createHandler(f);if(!m)return null;const x=u.createPaymentHandler(o,s,i,f);return x?{handler:m,config:x.config}:null},Au=o=>{if(!Ht)return;const s=Ht.context,i=Ht.is_requestKiosk,u=Ht.is_tableservice,f=bu(s,i,u);if(!f){console.warn("handleWebSocketMessageWithDynamicHandler: не удалось получить handler");return}const{handler:h,config:m}=f,x={...m,...Ht};Eu(o,x,h.handleWebSocketStatus)};async function Iu(o,s,i,u){var C,y;const{is_requestKiosk:f,is_tableservice:h}=i,{comment:m,is_authorized:x,signal:_}=u;i.setButtonDisabled(!0);const p=En.create();try{const S=await p.createOrder(o,s,f,m,x,h,_);if((S==null?void 0:S.status)===201&&((C=S==null?void 0:S.data)!=null&&C.id)){const M=S.data.id,k={...i,signal:_};Ht=k;const v=`wss://${k.area||""}/ws/order/${M}/`;Sn=ri(v,{signal:_});const U=()=>{console.warn("WebSocket connection opened (centralized mode)")},B=D=>{var K;console.error("WebSocket error (centralized mode):",D),Cn(Sn),Sn=null,Ht=null,i.setButtonDisabled(!1),(K=i.errorHandler)==null||K.handlePaymentError(D,k)},R=D=>{Au(D)};Sn.on("open",U),Sn.on("message",R),Sn.on("error",B),Sn.connect(),Ht.ws=Sn,Ht.closeWebSocket=()=>{Cn(Sn),Sn=null,Ht=null}}return S}catch(S){throw et.isCancel(S)||((y=i.errorHandler)==null||y.handleCreateOrderError(S,i),i.setButtonDisabled(!1)),S}}const Zs=o=>{var s,i;return((i=(s=o==null?void 0:o.response)==null?void 0:s.data)==null?void 0:i.user_friendly_message)||null};function mi(){const o=St();return{handlePaymentError(s,i){var f,h,m,x,_,p;const u=Zs(s);cn(i,null),yu(i),u?(i.showNotification(u),ro(i),i.is_requestKiosk&&((h=i.orderErrors)!=null&&h.includes((f=s.response)==null?void 0:f.status))&&(i.cartCleanup?i.cartCleanup.cleanupAndNavigate("retryPage",i.is_requestKiosk):i.deleteCart("retryPage",i.is_requestKiosk)),i.is_tableservice?i.resetStores():(gi(i),i.context==="qr"&&i.navigation?i.navigation.redirectToError():i.context==="qr"&&i.redirect&&(o.isButtonDisabled=!1,i.redirect(`/${((x=(m=i.route)==null?void 0:m.params)==null?void 0:x.orgId)||""}/errorPayment`)))):i.context==="qr"&&(gi(i),i.navigation?i.navigation.redirectToError():i.redirect&&i.redirect(`/${((p=(_=i.route)==null?void 0:_.params)==null?void 0:p.orgId)||""}/errorPayment`)),o.isButtonDisabled=!1},handleOrderPayError(s,i){var f,h,m,x;const u=Zs(s);u&&(i.showNotification(u),ro(i),i.is_requestKiosk?((h=i.orderErrors)!=null&&h.includes((f=s.response)==null?void 0:f.status)&&(i.cartCleanup.cleanupAndNavigate("retryPage",i.is_requestKiosk),i.deleteCart("retryPage",i.is_requestKiosk)),cn(i,null)):(gi(i),i.navigation?i.navigation.redirectToError():i.redirect&&i.redirect(`/${((x=(m=i.route)==null?void 0:m.params)==null?void 0:x.orgId)||""}/errorPayment`),cn(i,null)))},handleOrderError(s){var i,u;s.is_requestKiosk?s.cartCleanup?s.cartCleanup.cleanupAndNavigate("retryPage",s.is_requestKiosk):s.deleteCart("retryPage",s.is_requestKiosk):s.is_tableservice?s.showNotification("Ошибка создания заказа. Пожалуйста, попробуйте еще раз"):(gi(s),s.navigation?s.navigation.redirectToError():s.redirect&&(o.isButtonDisabled=!1,s.redirect(`/${((u=(i=s.route)==null?void 0:i.params)==null?void 0:u.orgId)||""}/errorPayment`)))},handleCreateOrderError(s,i){var m,x,_,p,C,y;const{is_requestKiosk:u,is_tableservice:f}=i,h=i.route.params.orgId;u?(((m=s==null?void 0:s.response)==null?void 0:m.status)===403&&((x=i.on403Kiosk)==null||x.call(i),(_=i.redirect)==null||_.call(i,`/${h}/retryPage`)),i.deleteCart("retryPage",u)):f?i.showNotification(((C=(p=s==null?void 0:s.response)==null?void 0:p.data)==null?void 0:C.user_friendly_message)||"Ошибка создания заказа"):(y=i.redirect)==null||y.call(i,`/${h}/errorPayment`)}}}const Su=()=>{const o=St();let s=null;const i=mi(),u=(f,h)=>{var x,_;const m=(x=f.params)==null?void 0:x.status;if(m==="sent"){if(no(f,h)){o.isButtonDisabled=!1;return}Fr(f.params.order_id||"",h.method).catch(p=>{const C=h.errorHandler||i,y=h.ws||s;C.handlePaymentError(p,{...h,closeWebSocket:()=>Cn(y)})})}else if(m==="waiting_for_fiscalization")cn(h,1);else if(m==="payment_initiation_retry"||m==="fiscalized")qs(f,h,s,i);else if(m==="payment_initiation")cn(h,2);else if(m==="paid"){cn(h,3);const p=h.ws||s;Cn(p),localStorage.removeItem("cart")}else(_=h.orderErrors)!=null&&_.includes(m)&&io(h,s,i)};return{handleWebSocketStatus(f,h){u(f,h)}}};function Nu(){const o=St();let s=null;const i=mi(),u=(f,h)=>{var x,_,p,C;const m=(x=f.params)==null?void 0:x.status;if((_=f.params)!=null&&_.number&&(o.orderNumber=(p=f.params)==null?void 0:p.number),m==="sent"){if(no(f,h)){o.isButtonDisabled=!1;return}Fr(f.params.order_id||"",h.method).catch(y=>{const S=h.errorHandler||i,M=h.ws||s;S.handlePaymentError(y,{...h,closeWebSocket:()=>Cn(M)})})}else if(m==="sent_fiscalization")cn(h,1);else if(m==="waiting_payment")cn(h,4);else if(m==="paid"){cn(h,3);const y=h.ws||s;Cn(y),localStorage.removeItem("cart")}else(C=h.orderErrors)!=null&&C.includes(m)&&(o.isButtonDisabled=!1,io(h,s,i))};return{handleWebSocketStatus(f,h){u(f,h)}}}const Tu=()=>{const o=St();let s=null;const i=mi(),u=(f,h)=>{var x,_;const m=(x=f.params)==null?void 0:x.status;if(m==="sent"){if(no(f,h)){o.isButtonDisabled=!1;return}Fr(f.params.order_id||"",h.method).then(p=>{if(h.is_tableservice){const C=h.ws||s;js(h,C)}else p.url&&window.location.replace(p.url)}).catch(p=>{const C=h.errorHandler||i,y=h.ws||s;C.handlePaymentError(p,{...h,closeWebSocket:()=>Cn(y)})})}else if(m==="payment_initiation_retry"||m==="fiscalized")qs(f,h,s,i);else if(m==="payment_initiation")cn(h,2);else if(m==="paid"){cn(h,3);const p=h.ws||s;Cn(p),localStorage.removeItem("cart")}else(_=h.orderErrors)!=null&&_.includes(m)&&(o.isButtonDisabled=!1,io(h,s,i))};return{handleWebSocketStatus(f,h){u(f,h)}}};class Ln{static initialize(){this.register({id:"TERMINAL_BASE",method:"TERMINAL",handlerFactory:Su,availableContexts:["kiosk"]}),this.register({id:"YOOKASSA_BASE",method:"YOOKASSA",handlerFactory:Tu,availableContexts:["qr","tableservice"]}),this.register({id:"SBP",method:"YOOKASSA",handlerFactory:Nu,availableContexts:["kiosk"]})}static register(s){this.methods.set(s.id,s)}static getConfig(s){return this.methods.get(s)??null}static getAvailableMethods(s){return Array.from(this.methods.entries()).filter(([i,u])=>u.availableContexts.includes(s)).map(([i])=>i)}static isMethodAvailable(s,i){const u=this.getConfig(s);return u?u.availableContexts.includes(i):!1}static createHandler(s){const i=this.getConfig(s);return i?i.handlerFactory():(console.warn(`PaymentMethodRegistry: метод оплаты ${s} не зарегистрирован`),null)}}We(Ln,"methods",new Map),Ln.initialize();function ku(o){return{cleanupAndNavigate(s,i){o.deleteCart(s,i)},cleanup(s){o.deleteCart(null,s)},clearTokens(){o.deleteCart(null,!0)},resetStores(){o.resetStores()}}}function Ru(o){var i,u;const s=((u=(i=o.route)==null?void 0:i.params)==null?void 0:u.orgId)||"";return{redirectToError(){const f=`/${s}/errorPayment`;o.redirect?o.redirect(f):o.router&&o.router.push(f)},redirectToSuccess(f){const h=f?`/${s}/${f}`:`/${s}/profile`;o.redirect?o.redirect(h):o.router&&o.router.push(h)},redirect(f){o.redirect?o.redirect(f):o.router&&o.router.push(f)},getErrorPath(){return`/${s}/errorPayment`},getSuccessPath(){return`/${s}/profile`}}}const St=xe.defineStore("cartLib",()=>{const o=Re.useRouter(),s=Re.useRoute(),i=It(),u=lt(),{config_lib:f,countBonus:h,totalPrice_lib:m,initialCartPrice_lib:x,is18Allowed:_}=xe.storeToRefs(u),{itemThemes:p}=xe.storeToRefs(i),C=l.ref(!1),y=l.ref(""),S=l.ref(null),M=l.ref("wait"),k=l.ref(!1),P=l.ref(0),v=l.ref(""),U=l.ref([]),B=l.ref([]),R=l.ref(),D=l.ref(0),K=l.ref(!1),te=l.ref(),z=l.ref(null),ie=l.ref(["failed_payment","failed_after_paid","failed","failed_after_sent","failed_after_sent_fiscalization","payment_initiation_retry"]),W=l.ref("Оплатить"),se=l.ref(),j=l.computed({get:()=>U.value||[],set:Oe=>{(Oe==null?void 0:Oe.length)===1&&(se.value=Oe[0]),U.value=Oe}}),G=l.ref(!1),V=l.ref(null),X=l.ref(0),N=l.ref(!1),$=l.ref({textNotification:""}),H=Oe=>{N.value=!0,$.value.textNotification=Oe},J=()=>{var Oe,qe;return(Oe=R.value)!=null&&Oe.front_type?R.value.front_type:((qe=B.value[0])==null?void 0:qe.front_type)||null},q=(Oe,qe,me,Ze)=>{var jt;const Ee=Ze??((jt=B.value[0])==null?void 0:jt.front_type);if(!Ee)return console.warn("Не удалось определить метод оплаты"),null;const mt=Ln.getConfig(Ee);if(!mt||!Ln.isMethodAvailable(Ee,Oe))return console.warn(`Метод ${Ee} недоступен для контекста ${Oe}`),null;const nt=Ln.createHandler(Ee);return nt?(te.value=re(mt.method,Oe,qe,me),{handler:nt,config:te.value}):(console.warn(`Не удалось создать обработчик для метода ${Ee}`),null)},re=(Oe,qe,me,Ze)=>{const Ee={method:Oe,context:qe,is_requestKiosk:me,is_tableservice:Ze,router:o,route:s,orderErrors:ie.value,area:f.value.area,has_rms_discount:f.value.has_rms_discount,totalPrice:m,initialCartPrice:x,showNotification:H,deleteCart:Xe,resetStores:dt,redirect:ot=>o.push(ot),updateOrderStatus:ot=>{V.value=ot},setOrderNumber:ot=>{z.value=ot},loadCart:()=>u.loadCart(),resetBonuses:()=>{h.value=0}},mt=mi(),nt=ku(Ee),jt=Ru(Ee);return{...Ee,errorHandler:mt,cartCleanup:nt,navigation:jt}},ge=l.computed(()=>!!S.value),we=Oe=>{M.value=Oe},Ne=Oe=>{S.value=Oe},_e=()=>{p.value.kiosk_show_loyalty_card_button&&p.value.kiosk_show_loyalty_phone_input_button?C.value=!0:!p.value.kiosk_show_loyalty_card_button&&p.value.kiosk_show_loyalty_phone_input_button?u.is_OpenLoyal=!0:C.value=!0,M.value="wait",y.value=""},Me=()=>{C.value=!1,M.value="wait",y.value=""},he=()=>{S.value=null,y.value="",M.value="wait",Me()},dt=()=>{G.value=!1,V.value=null},Xe=(Oe=null,qe=!1)=>{u.cartProducts_lib=[],fr(["cart"]),qe&&(fr(["authTokensAccess","authTokensRefresh","user"]),u.profile=null,sessionStorage.removeItem("is_adult"),_.value=!1),Oe&&o.push(`/${s.params.orgId}/${Oe}`)};return{isButtonDisabled:G,orderCompleted_lib:V,extraDiscount:P,orderNumber:z,is_notification_lib:N,notificationData_lib:$,textPaymentBtn_lib:W,count:X,guestInfo:S,error:y,isDrawerOpen:C,currentState:M,isAuthorized:ge,discountBtn:k,linkQR:v,orderTypes:j,providerTypes:B,is_paymentCart:K,selectedOrderType:se,selectedProvider:R,configPayment:te,paymentCostQR:D,deleteCart:Xe,setGuestInfo:Ne,setState:we,openDrawer:_e,closeDrawer:Me,clearCard:he,showNotification:H,createPaymentHandler:q,getCurrentPaymentMethodId:J,getAvailablePaymentMethods:Oe=>Ln.getAvailableMethods(Oe)}}),Rt=xe.defineStore("cardLib",()=>{var se;const o=()=>({openCard:null,currentModifier:null,groupModifiers:[],groupModifiersSelected:[],groupCurrentOpen:null,isModifiedAmount:!1,selectedSize:{},productSizes:[],addedProducts:[],plusButtonsRefs:[],modalCount:1,isSectionModifier:!1,isAnimationFly:!0,textErrorRequaired:""}),s=It(),i=l.ref(o()),u=()=>i.value=o(),f=l.ref(!1),h=l.ref(!1),m=l.ref(!1),x=l.ref(),_=l.ref([]),p=l.ref({id:null,visible:!1}),C=l.ref(!((se=s.itemThemes)!=null&&se.kiosk_disable_lock_screen)),y=l.computed(()=>{const j=i.value.groupModifiersSelected.findIndex(G=>G.group===i.value.groupCurrentOpen.id);return S(j)}),S=j=>j===-1?0:(i.value.groupModifiersSelected[j].modifiers||[]).reduce((V,X)=>V+(X.amount||0),0),M=l.computed(()=>{var G;const j=(G=i.value.openCard)==null?void 0:G.group_modifiers.findIndex(V=>V.id===i.value.groupCurrentOpen.id);return j===-1||!i.value.openCard?0:i.value.openCard.modifiers.length>0&&j===0?i.value.openCard.modifiers.reduce((V,X)=>V+X.max_amount,0):i.value.groupModifiers[j].max_amount}),k=l.computed(()=>{var G;const j=(i.value.addedProducts??[]).reduce((V,X)=>V+X.price,0);if(i.value.openCard){const V=i.value.openCard,X=dr(V)||0,N=V.amount||1;return(i.value.groupModifiersSelected.reduce((H,J)=>(J.modifiers.forEach(q=>{var re,ge;q.sizes&&(q.price=((ge=(re=q.sizes)==null?void 0:re.find(we=>we.id===i.value.selectedSize.id))==null?void 0:ge.price)??q.price),H+=q.price*q.amount}),H),0)+X)*N+j}return(G=i.value.addedProducts)!=null&&G.length?j:0}),P=l.computed(()=>{const j=i.value.groupModifiers,G=i.value.groupModifiersSelected;for(let V=0;V<j.length;V++){const X=j[V],N=G[V];if(X.min_amount>0&&S(V)<X.min_amount)return i.value.textErrorRequaired=`В группе "${X.name}" должно содержаться не меньше ${X.min_amount} модификатора(ов)`,{haveRequaire:!0,group:X};for(const $ of X.group_modifiers)if($.min_amount>0){const H=N.modifiers.find(J=>J.id===$.id);if(!H||H.amount<$.min_amount)return i.value.textErrorRequaired=`В группе "${X.name}" выберите все обязательные модификаторы`,{haveRequaire:!0,group:X}}}return{haveRequaire:!1,group:j[0]}}),v=()=>{i.value.groupModifiers.forEach((j,G)=>{i.value.groupCurrentOpen={...j,index:G},j.group_modifiers.forEach(V=>{V.default_amount>0&&(V.amount=V.default_amount,ie(V,!0))})})},U=j=>{i.value.addedProducts.push(j)},B=j=>{i.value.openCard=j},R=j=>{_.value=[...j]},D=(j,G)=>{var X,N;const V=j.id!==((X=i.value.groupCurrentOpen)==null?void 0:X.id);i.value.groupCurrentOpen={...j,index:G},V?i.value.isSectionModifier=!0:i.value.isSectionModifier=!i.value.isSectionModifier,(N=i.value.plusButtonsRefs[G])==null||N.scrollIntoView({behavior:"smooth",block:"start"})},K=()=>{i.value.modalCount>i.value.currentModifier.min_amount&&i.value.modalCount>=2&&(i.value.modalCount-=1)},te=()=>{i.value.groupCurrentOpen&&i.value.modalCount+y.value<M.value&&(i.value.currentModifier.max_amount===0||i.value.currentModifier.max_amount>i.value.modalCount)&&(i.value.modalCount+=1)},z=(j,G)=>{var X;const V=(X=i.value.groupCurrentOpen)==null?void 0:X.id.toUpperCase();if(!j&&!i.value.isModifiedAmount&&G.max_amount!==1){if(V==="Добавки2000"&&G.max_amount>1)return!0;if(Math.abs(M.value-y.value)>1&&V!=="Добавки2000")return!0}return!1},ie=(j,G=!1)=>{i.value.modalCount=1,i.value.currentModifier=j;const V=i.value.groupModifiersSelected.findIndex(X=>X.group===i.value.groupCurrentOpen.id);W(V,j,G)},W=(j,G,V)=>{var N,$;let X=i.value.groupModifiersSelected;if(G.sizes.length>0&&G.sizes.find(H=>{var J;return H.id===((J=i.value.selectedSize)==null?void 0:J.id)}),j===-1)z(V,G)?i.value.isModifiedAmount=!0:X[i.value.groupCurrentOpen.index]={group:i.value.groupCurrentOpen.id,is_fake:((N=i.value.groupCurrentOpen)==null?void 0:N.is_fake)||!1,is_product_determining:(($=i.value.groupCurrentOpen)==null?void 0:$.is_product_determining)||!1,modifier_count:0,modifiers:[{...G,amount:(G==null?void 0:G.amount)??1}]};else{const H=i.value.groupModifiers[j].group_modifiers.findIndex(q=>q.id===G.id);if(X[j].modifiers.findIndex(q=>q.id===G.id)===-1){if(M.value===1)X[j].modifiers=[];else if(y.value>=M.value)return;z(V,G)?i.value.isModifiedAmount=!0:(X[j].modifiers.push({...G,amount:(G==null?void 0:G.amount)??1}),X[j].modifier_count=X[j].modifiers.reduce((q,re)=>q+=re.amount,0),i.value.isAnimationFly=!0)}else X[j].modifiers=X[j].modifiers.filter(q=>q.id!==G.id),X[j].modifier_count=X[j].modifiers.reduce((q,re)=>q+=re.amount,0),i.value.groupModifiers[j].group_modifiers[H].amount=1,i.value.groupModifiers[j].group_modifiers[H].default_amount=0,i.value.isAnimationFly=!1}i.value.groupModifiersSelected=X};return{stateCard:i,totalPrice_libCard:k,recountGroupTotalAmount:y,groupTotalAmount:M,isOpenWindow:f,isUpSale:h,checkedRequiredBtn:P,dataUpSale:x,productCards:_,isAddToCard:m,openProduct:p,is_startPage:C,setProduct:R,summModifierAmount:S,setAddedProducts:U,setCurrentCard:B,minusAmount:K,plusAmount:te,toggleNotRequire:D,modifierSelect:ie,defaultAmountModifiers:v,reset:u}});var pr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Ys(o){return o&&o.__esModule&&Object.prototype.hasOwnProperty.call(o,"default")?o.default:o}var $s={exports:{}};(function(o,s){(function(i,u){o.exports=u()})(pr,function(){var i=1e3,u=6e4,f=36e5,h="millisecond",m="second",x="minute",_="hour",p="day",C="week",y="month",S="quarter",M="year",k="date",P="Invalid Date",v=/^(\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,B={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(X){var N=["th","st","nd","rd"],$=X%100;return"["+X+(N[($-20)%10]||N[$]||N[0])+"]"}},R=function(X,N,$){var H=String(X);return!H||H.length>=N?X:""+Array(N+1-H.length).join($)+X},D={s:R,z:function(X){var N=-X.utcOffset(),$=Math.abs(N),H=Math.floor($/60),J=$%60;return(N<=0?"+":"-")+R(H,2,"0")+":"+R(J,2,"0")},m:function X(N,$){if(N.date()<$.date())return-X($,N);var H=12*($.year()-N.year())+($.month()-N.month()),J=N.clone().add(H,y),q=$-J<0,re=N.clone().add(H+(q?-1:1),y);return+(-(H+($-J)/(q?J-re:re-J))||0)},a:function(X){return X<0?Math.ceil(X)||0:Math.floor(X)},p:function(X){return{M:y,y:M,w:C,d:p,D:k,h:_,m:x,s:m,ms:h,Q:S}[X]||String(X||"").toLowerCase().replace(/s$/,"")},u:function(X){return X===void 0}},K="en",te={};te[K]=B;var z="$isDayjsObject",ie=function(X){return X instanceof G||!(!X||!X[z])},W=function X(N,$,H){var J;if(!N)return K;if(typeof N=="string"){var q=N.toLowerCase();te[q]&&(J=q),$&&(te[q]=$,J=q);var re=N.split("-");if(!J&&re.length>1)return X(re[0])}else{var ge=N.name;te[ge]=N,J=ge}return!H&&J&&(K=J),J||!H&&K},se=function(X,N){if(ie(X))return X.clone();var $=typeof N=="object"?N:{};return $.date=X,$.args=arguments,new G($)},j=D;j.l=W,j.i=ie,j.w=function(X,N){return se(X,{locale:N.$L,utc:N.$u,x:N.$x,$offset:N.$offset})};var G=function(){function X($){this.$L=W($.locale,null,!0),this.parse($),this.$x=this.$x||$.x||{},this[z]=!0}var N=X.prototype;return N.parse=function($){this.$d=function(H){var J=H.date,q=H.utc;if(J===null)return new Date(NaN);if(j.u(J))return new Date;if(J instanceof Date)return new Date(J);if(typeof J=="string"&&!/Z$/i.test(J)){var re=J.match(v);if(re){var ge=re[2]-1||0,we=(re[7]||"0").substring(0,3);return q?new Date(Date.UTC(re[1],ge,re[3]||1,re[4]||0,re[5]||0,re[6]||0,we)):new Date(re[1],ge,re[3]||1,re[4]||0,re[5]||0,re[6]||0,we)}}return new Date(J)}($),this.init()},N.init=function(){var $=this.$d;this.$y=$.getFullYear(),this.$M=$.getMonth(),this.$D=$.getDate(),this.$W=$.getDay(),this.$H=$.getHours(),this.$m=$.getMinutes(),this.$s=$.getSeconds(),this.$ms=$.getMilliseconds()},N.$utils=function(){return j},N.isValid=function(){return this.$d.toString()!==P},N.isSame=function($,H){var J=se($);return this.startOf(H)<=J&&J<=this.endOf(H)},N.isAfter=function($,H){return se($)<this.startOf(H)},N.isBefore=function($,H){return this.endOf(H)<se($)},N.$g=function($,H,J){return j.u($)?this[H]:this.set(J,$)},N.unix=function(){return Math.floor(this.valueOf()/1e3)},N.valueOf=function(){return this.$d.getTime()},N.startOf=function($,H){var J=this,q=!!j.u(H)||H,re=j.p($),ge=function(Oe,qe){var me=j.w(J.$u?Date.UTC(J.$y,qe,Oe):new Date(J.$y,qe,Oe),J);return q?me:me.endOf(p)},we=function(Oe,qe){return j.w(J.toDate()[Oe].apply(J.toDate("s"),(q?[0,0,0,0]:[23,59,59,999]).slice(qe)),J)},Ne=this.$W,_e=this.$M,Me=this.$D,he="set"+(this.$u?"UTC":"");switch(re){case M:return q?ge(1,0):ge(31,11);case y:return q?ge(1,_e):ge(0,_e+1);case C:var dt=this.$locale().weekStart||0,Xe=(Ne<dt?Ne+7:Ne)-dt;return ge(q?Me-Xe:Me+(6-Xe),_e);case p:case k:return we(he+"Hours",0);case _:return we(he+"Minutes",1);case x:return we(he+"Seconds",2);case m:return we(he+"Milliseconds",3);default:return this.clone()}},N.endOf=function($){return this.startOf($,!1)},N.$set=function($,H){var J,q=j.p($),re="set"+(this.$u?"UTC":""),ge=(J={},J[p]=re+"Date",J[k]=re+"Date",J[y]=re+"Month",J[M]=re+"FullYear",J[_]=re+"Hours",J[x]=re+"Minutes",J[m]=re+"Seconds",J[h]=re+"Milliseconds",J)[q],we=q===p?this.$D+(H-this.$W):H;if(q===y||q===M){var Ne=this.clone().set(k,1);Ne.$d[ge](we),Ne.init(),this.$d=Ne.set(k,Math.min(this.$D,Ne.daysInMonth())).$d}else ge&&this.$d[ge](we);return this.init(),this},N.set=function($,H){return this.clone().$set($,H)},N.get=function($){return this[j.p($)]()},N.add=function($,H){var J,q=this;$=Number($);var re=j.p(H),ge=function(_e){var Me=se(q);return j.w(Me.date(Me.date()+Math.round(_e*$)),q)};if(re===y)return this.set(y,this.$M+$);if(re===M)return this.set(M,this.$y+$);if(re===p)return ge(1);if(re===C)return ge(7);var we=(J={},J[x]=u,J[_]=f,J[m]=i,J)[re]||1,Ne=this.$d.getTime()+$*we;return j.w(Ne,this)},N.subtract=function($,H){return this.add(-1*$,H)},N.format=function($){var H=this,J=this.$locale();if(!this.isValid())return J.invalidDate||P;var q=$||"YYYY-MM-DDTHH:mm:ssZ",re=j.z(this),ge=this.$H,we=this.$m,Ne=this.$M,_e=J.weekdays,Me=J.months,he=J.meridiem,dt=function(qe,me,Ze,Ee){return qe&&(qe[me]||qe(H,q))||Ze[me].slice(0,Ee)},Xe=function(qe){return j.s(ge%12||12,qe,"0")},Oe=he||function(qe,me,Ze){var Ee=qe<12?"AM":"PM";return Ze?Ee.toLowerCase():Ee};return q.replace(U,function(qe,me){return me||function(Ze){switch(Ze){case"YY":return String(H.$y).slice(-2);case"YYYY":return j.s(H.$y,4,"0");case"M":return Ne+1;case"MM":return j.s(Ne+1,2,"0");case"MMM":return dt(J.monthsShort,Ne,Me,3);case"MMMM":return dt(Me,Ne);case"D":return H.$D;case"DD":return j.s(H.$D,2,"0");case"d":return String(H.$W);case"dd":return dt(J.weekdaysMin,H.$W,_e,2);case"ddd":return dt(J.weekdaysShort,H.$W,_e,3);case"dddd":return _e[H.$W];case"H":return String(ge);case"HH":return j.s(ge,2,"0");case"h":return Xe(1);case"hh":return Xe(2);case"a":return Oe(ge,we,!0);case"A":return Oe(ge,we,!1);case"m":return String(we);case"mm":return j.s(we,2,"0");case"s":return String(H.$s);case"ss":return j.s(H.$s,2,"0");case"SSS":return j.s(H.$ms,3,"0");case"Z":return re}return null}(qe)||re.replace(":","")})},N.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},N.diff=function($,H,J){var q,re=this,ge=j.p(H),we=se($),Ne=(we.utcOffset()-this.utcOffset())*u,_e=this-we,Me=function(){return j.m(re,we)};switch(ge){case M:q=Me()/12;break;case y:q=Me();break;case S:q=Me()/3;break;case C:q=(_e-Ne)/6048e5;break;case p:q=(_e-Ne)/864e5;break;case _:q=_e/f;break;case x:q=_e/u;break;case m:q=_e/i;break;default:q=_e}return J?q:j.a(q)},N.daysInMonth=function(){return this.endOf(y).$D},N.$locale=function(){return te[this.$L]},N.locale=function($,H){if(!$)return this.$L;var J=this.clone(),q=W($,H,!0);return q&&(J.$L=q),J},N.clone=function(){return j.w(this.$d,this)},N.toDate=function(){return new Date(this.valueOf())},N.toJSON=function(){return this.isValid()?this.toISOString():null},N.toISOString=function(){return this.$d.toISOString()},N.toString=function(){return this.$d.toUTCString()},X}(),V=G.prototype;return se.prototype=V,[["$ms",h],["$s",m],["$m",x],["$H",_],["$W",p],["$M",y],["$y",M],["$D",k]].forEach(function(X){V[X[1]]=function(N){return this.$g(N,X[0],X[1])}}),se.extend=function(X,N){return X.$i||(X(N,G,se),X.$i=!0),se},se.locale=W,se.isDayjs=ie,se.unix=function(X){return se(1e3*X)},se.en=te[K],se.Ls=te,se.p={},se})})($s);var Ou=$s.exports;const Ks=Ys(Ou),Bu=o=>{const s=Re.useRouter(),i=`${o.domain}/api/`,u=et.create({baseURL:i}),f=et.create({baseURL:i}),h=et.create({baseURL:i}),m=et.create({baseURL:i}),x=et.create({baseURL:i}),_=et.create({baseURL:i}),p=et.create({baseURL:i}),C=B=>{try{const R=JSON.parse(localStorage.getItem("authTokensAccess")||"");R.length>0&&(B.headers.Authorization=`Bearer ${R}`)}catch{console.warn("accessToken is undefined [useAxios]")}return B},y=B=>{const R=localStorage.getItem("apiKey");return B.headers={"Content-Type":"application/json","x-api-key":R},B},S=async B=>{if(!o.user)return B;const R=o.user.exp??0;if(!(Ks.unix(R).diff(Ks())<3e3))return B;const K=ss("authTokensRefresh",null,"string");try{const te=await et.post(`${i}user/token/refresh/`,{refresh:K.value});if(!te.data.access)return U(),B;localStorage.setItem("authTokensAccess",JSON.stringify(te.data.access)),P(te.data),v(os(te.data.access)),B.headers={...B.headers,Authorization:`Bearer ${te.data.access}`}}catch(te){console.error("Failed to refresh token:",te),U()}return B},M=B=>{B.interceptors.request.use(R=>S(C(R)),R=>Promise.reject(R))};M(h),M(x),M(p);const k=B=>{B.interceptors.request.use(R=>y(R))};k(_),k(f),k(p);const P=(B,R=!1)=>{localStorage.setItem("authTokensAccess",JSON.stringify(B.access)),R&&localStorage.setItem("authTokensRefresh",JSON.stringify(B.refresh))},v=B=>{o.user=B,localStorage.setItem("user",JSON.stringify(B))},U=()=>{o.user=null,fr(["authTokensAccess","authTokensRefresh","user","cart","bonus"]),sessionStorage.removeItem("is_adult"),s.replace({name:"home"}).then(()=>window.location.reload())};return{axiosInstanceAuthenticationGet:h,axiosInstanceAuthenticationPost:x,axiosInstanceAuthenticationPostApiKey:p,axiosInstancePost:m,axiosInstanceGet:u,axiosInstanceGetApiKey:f,axiosInstancePostApiKey:_}},Qs=(o="themeConfig")=>{try{const s=localStorage.getItem(o);return s?JSON.parse(s):null}catch{return null}},Le=class Le{constructor(){We(this,"axiosInstanceGet");We(this,"axiosInstancePost");We(this,"axiosInstanceAuthenticationGet");We(this,"axiosInstanceAuthenticationPost");We(this,"axiosInstanceGetApiKey");We(this,"axiosInstancePostApiKey");We(this,"axiosInstanceAuthenticationPostApiKey");We(this,"currentUpsaleController",null);We(this,"controller",new AbortController);this.axiosInstanceGet=Le._axiosGet,this.axiosInstancePost=Le._axiosPost,this.axiosInstanceGetApiKey=Le._axiosPostApiKey,this.axiosInstancePostApiKey=Le._axiosPostApiKey,this.axiosInstanceAuthenticationPostApiKey=Le._axiosAuthPostApiKey,this.axiosInstanceAuthenticationGet=Le._axiosAuthGet,this.axiosInstanceAuthenticationPost=Le._axiosAuthPost}static create(s){return s&&!Le._config&&Le._initialize(s),Le._config||console.warn("InitConnection не инициализирован"),new Le}static _initialize(s,i=null){const u=lt(),f=Rt(),{config_lib:h}=xe.storeToRefs(u),{stateCard:m,recountGroupTotalAmount:x}=xe.storeToRefs(f);Le._config=s,Le._cardStore=f,Le._stateCard=m,Le._recountGroupTotalAmount=x,h.value=s;const _=Bu(s);Le._axiosPostApiKey=_.axiosInstanceGetApiKey,Le._axiosPostApiKey=_.axiosInstancePostApiKey,Le._axiosAuthPostApiKey=_.axiosInstanceAuthenticationPostApiKey,Le._axiosGet=_.axiosInstanceGet,Le._axiosPost=_.axiosInstancePost,Le._axiosAuthGet=_.axiosInstanceAuthenticationGet,Le._axiosAuthPost=_.axiosInstanceAuthenticationPost}get config(){return Le._config}get cardStore(){return Le._cardStore}get stateCard(){return Le._stateCard}get recountGroupTotalAmount(){return Le._recountGroupTotalAmount}async updateTheme(){var h,m;const s=Qs(),i=It();if(s!==null){i.updateColor(s);return}const u=lt(),f=await((m=this.axiosInstanceGet)==null?void 0:m.get(`org/organizations/${(h=this.config)==null?void 0:h.orgId}/design/`));u.setStateDrum(f==null?void 0:f.data.hide_barban),u.setKioskTimeout(f==null?void 0:f.data.kiosk_timeout),localStorage.setItem("themeConfig",JSON.stringify(f.data)),i.updateColor(f.data)}async getGroupByID(s){var i,u;try{const f=await((u=this.axiosInstanceGet)==null?void 0:u.get(`${(i=this.config)==null?void 0:i.pointId}/group/${s}`));return f==null?void 0:f.data}catch(f){throw console.error("Ошибка в request.ts[getGroupByID]",f),f}}async loadGroupProducts(s){var i,u;try{const f=await((u=this.axiosInstanceGet)==null?void 0:u.get(`${(i=this.config)==null?void 0:i.pointId}/products/?group=${s}`)),h=(f==null?void 0:f.data)||[];for(const m of h)m&&await El(m);return await this.cacheImagesInBackground(h),h}catch(f){return console.error("Ошибка загрузки группы:",f),[]}}async getGroup(){var s,i;try{const u=await((i=this.axiosInstanceGet)==null?void 0:i.get(`${(s=this.config)==null?void 0:s.pointId}/groups/`));return u==null?void 0:u.data}catch(u){return console.error("Error fetching products:",u),[]}}async fetchAndCacheAllPages(){var s,i;try{const u=((s=this.config)==null?void 0:s.pointId)||"",f=await Hi(u);if(f)return f.data;const h=await((i=this.axiosInstanceGet)==null?void 0:i.get(`${u}/group/`)),m=(h==null?void 0:h.data)||[],x=[];for(const _ of m){_.products=_.products||[],await Rr(_.id,_),x.push(_);const p=await this.loadGroupProducts(_.id);_.products=p}return await this.cacheImagesInBackground(m),await Rr(u,m),x}catch(u){return console.error("fetchAndCacheAllPages error:",u),[]}}cacheImagesInBackground(s){s.forEach(i=>{var u;i.video_link&&this.loadAndCacheMedia(i.video_link,i.id+"_video"),i.image_link&&this.loadAndCacheMedia(i.image_link,i.id+"_image"),(u=i.products)==null||u.forEach(f=>{f.video_link&&this.loadAndCacheMedia(f.video_link,f.id+"_video"),f.image_link&&this.loadAndCacheMedia(f.image_link,f.id+"_image")})})}async loadAndCacheMedia(s,i){const u=await ur(i);if(u){this.dispatchImageCachedEvent(i,u);return}try{const f=await fetch(s);if(!f.ok)throw new Error("Network error");const h=await f.blob();if(h.size===0)throw new Error("Empty blob");await Gi(i,h),this.dispatchImageCachedEvent(i,h)}catch(f){console.warn(`[ImageCache] Failed for ${i}:`,f)}}dispatchImageCachedEvent(s,i){window.dispatchEvent(new CustomEvent("image-cached",{detail:{id:s,blob:i}}))}async getProduct(s=null){var i,u;if(!s)return[];try{const f=await((u=this.axiosInstanceGet)==null?void 0:u.get(`${(i=this.config)==null?void 0:i.pointId}/products/${s}`));return f==null?void 0:f.data}catch(f){return console.error("Error fetching cardProducts:",f),[]}}async getSingleProduct(s){var f;const i=lt(),{config_lib:u}=xe.storeToRefs(i);try{let h=await $o(s);if(h)this._fullCardProduct(h);else{const m=await((f=this.axiosInstanceGet)==null?void 0:f.get(`${u.value.pointId}/products/${s}`));(m==null?void 0:m.status)===200&&this._fullCardProduct(m.data)}}catch(h){throw console.warn("store card[getFetchProducts]:",h),h}}_fullCardProduct(s){const i=Rt();i.stateCard.openCard={...s,amount:1},i.stateCard.groupModifiers=s.group_modifiers,s.modifiers.length>0&&i.stateCard.groupModifiers.unshift({default_amount:0,description:"",group_modifiers:s.modifiers,id:"Добавки2000",image_link:null,max_amount:1,min_amount:s.modifiers.reduce((u,f)=>u+=f.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=s.sizes,i.defaultAmountModifiers(),s.show_recommendations&&this.productUpsale(s.id)}async getTheme(){try{this.updateTheme()}catch(s){return console.error("Error fetching products:",s),[]}}async authorizeByCard(s){var i,u;try{const f=await((u=this.axiosInstanceAuthenticationPostApiKey)==null?void 0:u.post(`${(i=this.config)==null?void 0:i.domain}/api/user/validate-card/`,{card_number:s}));return localStorage.setItem("authTokensAccess",JSON.stringify(f==null?void 0:f.data.access)),localStorage.setItem("authTokensRefresh",JSON.stringify(f==null?void 0:f.data.refresh)),f==null?void 0:f.data}catch(f){throw console.error("Ошибка авторизации:",f),f}}async getLoyalSmsCode(s){var i,u;try{const f=await((u=this.axiosInstancePostApiKey)==null?void 0:u.post(`${(i=this.config)==null?void 0:i.domain}/api/device/auth/request-otp/`,{phone:s}));return f==null?void 0:f.data}catch(f){throw console.error("Ошибка получения sms-code:",f),f}}async sendSmsCodeForAuth(s,i){var u,f;try{const h=await((f=this.axiosInstanceAuthenticationPostApiKey)==null?void 0:f.post(`${(u=this.config)==null?void 0:u.domain}/api/device/auth/`,{code:s,phone:i}));return h==null?void 0:h.data}catch(h){throw console.error("Ошибка отправки sms-code:",h),h}}async callStaff(s,i,u){var f,h,m,x;try{const _=await((m=this.axiosInstancePost)==null?void 0:m.post(`${(f=this.config)==null?void 0:f.domain}/api/org_unit/${(h=this.config)==null?void 0:h.pointId}/table/${s}/call-staff/`,{...i},u));return(x=_==null?void 0:_.data)==null?void 0:x.response_text}catch(_){throw console.error("Ошибка[callStaff]",_),_}}async createOrder(s,i,u=!0,f,h=!1,m=!1,x){var P,v,U,B,R;const _=St(),p=h?this.axiosInstanceAuthenticationPostApiKey:this.axiosInstancePostApiKey,C=u?p:this.axiosInstanceAuthenticationPost,y=u?"/device/order/create":"/order/create",S=u?(P=this.config)==null?void 0:P.pointId:(v=this.config)==null?void 0:v.pointId,M={items:s,table:i||null,comment:f};return u&&((U=_.selectedOrderType)!=null&&U.id)&&(M.order_type_id=(B=_.selectedOrderType)==null?void 0:B.id),await(C==null?void 0:C.post(`${(R=this.config)==null?void 0:R.domain}/api/org_unit/${S}${y}`,M,{signal:x}))}async initPaymentLink(s,i){const u=this.axiosInstanceAuthenticationPost,f=lt(),h=await(u==null?void 0:u.post("payment/init",{by_bonuses:f.countBonus,order:s,provider_type:i}));return h==null?void 0:h.data}async orderPay(s){var i;return(i=this.axiosInstanceAuthenticationPostApiKey)==null?void 0:i.post(`order/${s}/pay/`,{order_id:s})}async getProfile(){var i,u;const s=await((u=this.axiosInstanceAuthenticationGet)==null?void 0:u.get(`user/current?organization=${(i=this.config)==null?void 0:i.orgId}`));if((s==null?void 0:s.status)===200){const f=lt();return f.profile=s.data,f.is18Allowed=sessionStorage.getItem("is_adult")==="true",s.data}else return s}async joinLoyalty(){var i;const s=await((i=this.axiosInstanceAuthenticationGet)==null?void 0:i.post("user/join-loyalty/"));return{success:(s==null?void 0:s.status)===200}}async isPhoneExist(s,i={}){var u,f;try{const h=await((f=this.axiosInstanceGet)==null?void 0:f.get("user/check-phone",{...i,params:{organization:(u=this.config)==null?void 0:u.orgId,phone:s}}));return(h==null?void 0:h.status)===200}catch{return!1}}async sendOTP(s,i={}){var f,h;const u=await((h=this.axiosInstancePost)==null?void 0:h.post("user/check-phone",{organization:(f=this.config)==null?void 0:f.orgId,phone:s},i));return u==null?void 0:u.data}async auth(s,i={}){var f,h;return await((h=this.axiosInstancePost)==null?void 0:h.post("user/auth",{organization:(f=this.config)==null?void 0:f.orgId,...s},i))}async signup(s,i={}){var f,h;return await((h=this.axiosInstancePost)==null?void 0:h.post("user/register",{organization:(f=this.config)==null?void 0:f.orgId,...s},i))}async calculateDiscount(s,i=!0,u=!1,f){var p,C;const h=u?this.axiosInstanceAuthenticationPostApiKey:this.axiosInstancePostApiKey,m=i?h:this.axiosInstanceAuthenticationPost,x=i?(p=this.config)==null?void 0:p.pointId:(C=this.config)==null?void 0:C.pointId,_=await(m==null?void 0:m.post(`/org_unit/${x}/cart/calculate-discount/`,s,{signal:f}));return(_==null?void 0:_.status)===200?_.data:_}async maxPayByBonuses(s,i=!0,u=!1,f){const h=lt(),m=u?this.axiosInstanceAuthenticationPostApiKey:this.axiosInstancePostApiKey,x=i?m:this.axiosInstanceAuthenticationPost,_=await(x==null?void 0:x.post("/cart/max-pay-by-bonuses/",{total_cart_price:s},{signal:f})),p=_==null?void 0:_.data;return h.profile&&p&&"balance"in p&&(h.profile.balance=p.balance),p}async getDeviceInfo(){var u;const s=St(),i=await((u=this.axiosInstanceGetApiKey)==null?void 0:u.get("/device/current/"));return(i==null?void 0:i.status)===200?(s.orderTypes=i.data.order_types,s.providerTypes=i.data.payment_provider_type,i.data):i}async validateApiKey(s,i){var f,h;const u=await((h=this.axiosInstancePost)==null?void 0:h.post(`/device/org_unit/${(f=this.config)==null?void 0:f.pointId}/validate-api-key/`,{api_key:s},i));return(u==null?void 0:u.status)===200}async productUpsale(s){var h,m,x;const i=Rt(),{dataUpSale:u}=xe.storeToRefs(i);(h=this.currentUpsaleController)==null||h.abort();const f=new AbortController;this.currentUpsaleController=f;try{const _=await((x=this.axiosInstanceGet)==null?void 0:x.get(`/${(m=this.config)==null?void 0:m.pointId}/products/${s}/recommendation/`,{signal:f.signal}));f.signal.aborted||(u.value=_==null?void 0:_.data)}catch(_){if(_.name==="AbortError"||_.name==="CanceledError"){console.warn("Upsale отменён — пришёл новый запрос");return}throw console.error("Ошибка upsale:",_),_}finally{this.currentUpsaleController===f&&(this.currentUpsaleController=null)}}};We(Le,"_config",null),We(Le,"_axiosGet"),We(Le,"_axiosGetApiKey"),We(Le,"_axiosPostApiKey"),We(Le,"_axiosAuthPostApiKey"),We(Le,"_axiosPost"),We(Le,"_axiosAuthGet"),We(Le,"_axiosAuthPost"),We(Le,"_cardStore",null),We(Le,"_stateCard",null),We(Le,"_recountGroupTotalAmount",null);let En=Le;const Js=l.ref(!1),ea=l.ref(window.innerWidth),Nn=()=>{const o=l.computed({get:()=>Js.value,set:f=>{Js.value=f}}),s=l.computed(()=>o.value&&ea.value>1024),i=()=>ea.value=window.innerWidth;return l.onMounted(()=>{window.addEventListener("resize",i)}),l.onUnmounted(()=>{window.removeEventListener("resize",i)}),{isDesktop:o,shouldUseDragScroll:s,syncWithRoute:f=>{o.value=f.query.mode==="pdf"}}},Mu=l.defineComponent({__name:"UseScrollCenter",props:{axis:{},behavior:{},autoScroll:{type:Boolean},container:{},idActive:{},clearContainer:{type:Boolean}},setup(o,{expose:s}){const i=o,u=lt(),f=l.ref(null),{isDesktop:h}=Nn(),m=async _=>{if(!f.value||!_)return;let p=window;i.container&&(p=typeof i.container=="string"?document.querySelector(i.container)||window:i.container);const C={behavior:i.behavior};if(i.axis==="x"){const y=p===window?window.innerWidth:p.clientWidth,S=_.offsetWidth;let M=_.offsetLeft;if(p!==window){const k=p.getBoundingClientRect();M=_.getBoundingClientRect().left-k.left+p.scrollLeft}M-=(y-S)/2,C.left=Math.max(0,M)}else{const y=p===window?window.innerHeight:p.clientHeight,S=_.offsetHeight;let M=_.offsetTop;if(p!==window){const k=p.getBoundingClientRect();M=_.getBoundingClientRect().top-k.top+p.scrollTop}M-=(y-S)/2,C.top=Math.max(0,M)}try{p===window?window.scrollTo(C):p.scrollTo(C)}catch(y){console.error("Scroll error:",y)}};l.onMounted(async()=>{if(i.autoScroll){let _=null;if(await l.nextTick(),u.activeScrolling_lib){const p=u.activeScrolling_lib.findIndex(C=>C.id===i.idActive);i.idActive?(_=document.getElementById(`scrolling${i.idActive}`),_&&p!==-1&&(u.activeScrolling_lib[p]=_)):u.activeScrolling_lib[p]&&(_=u.activeScrolling_lib[p]),m(_)}}});const x=async _=>{i.clearContainer&&(u.activeScrolling_lib=[]);const p=_.currentTarget;await l.nextTick(),u.activeScrolling_lib.includes(p)||u.activeScrolling_lib.push(p),m(p)};return s({scrollToElement:m}),(_,p)=>(l.openBlock(),l.createElementBlock("div",{ref_key:"wrapperRef",ref:f,class:l.normalizeClass(["scroll-to-wrapper",{scroll_pdf:l.unref(h)}])},[l.renderSlot(_.$slots,"default",{handleTargetClick:x},void 0,!0)],2))}}),Ue=(o,s)=>{const i=o.__vccOpts||o;for(const[u,f]of s)i[u]=f;return i},oo=Ue(Mu,[["__scopeId","data-v-e47a167d"]]),Vr={mounted(o){let s=!1,i,u,f,h,m,x=0,_=0,p=0,C=0,y=0,S=!1;const M=5;o.style.cursor="grab";const k=U=>{U.button===0&&(m&&(cancelAnimationFrame(m),m=0),s=!0,S=!1,i=U.pageX-o.offsetLeft,u=U.pageY-o.offsetTop,f=o.scrollLeft,h=o.scrollTop,p=U.pageX,C=U.pageY,y=Date.now(),x=0,_=0)},P=U=>{if(!s)return;const B=U.pageX,R=U.pageY,D=Math.abs(B-p),K=Math.abs(R-C);if(!S&&(D>M||K>M)&&(S=!0,o.style.pointerEvents="none"),S){U.stopPropagation(),U.preventDefault();const te=Date.now(),z=te-y;z>0&&(x=(B-p)/z*16,_=(R-C)/z*16),p=B,C=R,y=te;const ie=B-o.offsetLeft,W=R-o.offsetTop,se=ie-i,j=W-u;o.scrollLeft=f-se,o.scrollTop=h-j}else p=B,C=R,y=Date.now()},v=U=>{if(s){if(S){if(U.stopPropagation(),U.preventDefault(),o.style.pointerEvents="",Math.abs(x)>.1||Math.abs(_)>.1){const B=()=>{o.scrollLeft-=x,o.scrollTop-=_,x*=.95,_*=.95,Math.abs(x)>.1||Math.abs(_)>.1?m=requestAnimationFrame(B):m=0};m=requestAnimationFrame(B)}}else o.style.pointerEvents="";s=!1,S=!1}};o.addEventListener("mousedown",k),window.addEventListener("mousemove",P),window.addEventListener("mouseup",v),o._dragScrollCleanup=()=>{m&&cancelAnimationFrame(m),o.removeEventListener("mousedown",k),window.removeEventListener("mousemove",P),window.removeEventListener("mouseup",v),o.style.pointerEvents=""}},unmounted(o){o._dragScrollCleanup&&o._dragScrollCleanup()}},vu={},Du={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 Pu(o,s){return l.openBlock(),l.createElementBlock("svg",Du,[...s[0]||(s[0]=[l.createElementVNode("defs",null,null,-1),l.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 so=Ue(vu,[["render",Pu]]),Lu=["id","onClick"],Fu={class:"modified_plus_btn"},Vu=["src"],Uu={key:2,class:"wrapper_modifier_item"},zu={key:0,class:"modifier_item_n_wrapper"},Hu=["src"],Gu={key:1,class:"modifier_plus_item"},Wu=["src"],Xu=["src"],ta=Ue(l.defineComponent({__name:"PlusModifier",props:{isSectionModifier:{type:Boolean},toggleNotRequire:{type:Function}},setup(o){const s=Rt(),i=It(),{stateCard:u}=xe.storeToRefs(s),{itemThemes:f}=xe.storeToRefs(i),{shouldUseDragScroll:h}=Nn(),m=l.ref([]),x=l.ref([]),_=l.ref(null),p=l.ref(null),C=S=>{S instanceof HTMLElement&&!m.value.includes(S)&&m.value.push(S)},y=S=>{p.value=S};return l.onMounted(async()=>{await l.nextTick(),u.value.plusButtonsRefs=m.value}),l.watchEffect(()=>{x.value=u.value.groupModifiersSelected,document.body.style.overflow=""}),l.onBeforeUnmount(()=>{m.value=[],u.value.plusButtonsRefs=[]}),(S,M)=>(l.openBlock(),l.createElementBlock("div",{class:l.normalizeClass({card_modified_wrapper_many:l.unref(u).groupModifiers.length>=5})},[l.unref(u).groupModifiersSelected?l.withDirectives((l.openBlock(),l.createElementBlock("div",{key:0,class:l.normalizeClass(["card_modified_wrapper",[l.unref(u).groupModifiers.length<=4?"card_modified_wrapper_center":""]]),ref_key:"scrollPlusContainer",ref:_},[l.createVNode(oo,{axis:"x",behavior:"smooth",container:_.value,autoScroll:!0,idActive:p.value,clearContainer:!0},{default:l.withCtx(({handleTargetClick:k})=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(u).groupModifiers,(P,v)=>{var U,B;return l.openBlock(),l.createElementBlock("div",{class:"button_modified",key:P.id,ref_for:!0,ref:C,id:"scrolling"+P.id,"data-clickable":"true",onClick:R=>{o.toggleNotRequire&&o.toggleNotRequire(P,v),y(P.id),k(R)}},[l.createElementVNode("div",Fu,[x.value[v].modifiers.length===0?(l.openBlock(),l.createElementBlock("div",{key:0,class:l.normalizeClass([{modified_plus_btn_active:P.id===((U=l.unref(u).groupCurrentOpen)==null?void 0:U.id)&&o.isSectionModifier},"modified_plus_active"])},[l.createVNode(so,{"aria-label":`Открыть группу модификаторов ${P.name}`},null,8,["aria-label"])],2)):x.value[v].modifiers.length===1?(l.openBlock(),l.createElementBlock("div",{key:1,class:l.normalizeClass(["modified_plus_btn modified_plus_btn_solo",{modified_plus_btn_active:P.id===((B=l.unref(u).groupCurrentOpen)==null?void 0:B.id)&&o.isSectionModifier}])},[l.createElementVNode("img",{src:x.value[v].modifiers[0].image_link||l.unref(f).fallback_image||"",alt:"Модификатор"},null,8,Vu)],2)):(l.openBlock(),l.createElementBlock("div",Uu,[x.value[v].modifiers.length>2?(l.openBlock(),l.createElementBlock("div",zu,[x.value[v].modifiers.length===3?(l.openBlock(),l.createElementBlock("img",{key:0,class:"modifier_plus_item modifier_item_three",src:x.value[v].modifiers[2].image_link||l.unref(f).fallback_image||""},null,8,Hu)):(l.openBlock(),l.createElementBlock("p",Gu," + "+l.toDisplayString(x.value[v].modifiers.length-2),1))])):l.createCommentVNode("",!0),l.createElementVNode("div",null,[x.value[v].modifiers.length>0?(l.openBlock(),l.createElementBlock("img",{key:0,src:x.value[v].modifiers[0].image_link||l.unref(f).fallback_image||"",class:"modifier_plus_item modifier_item_first"},null,8,Wu)):l.createCommentVNode("",!0),x.value[v].modifiers.length>1?(l.openBlock(),l.createElementBlock("img",{key:1,src:x.value[v].modifiers[1].image_link||l.unref(f).fallback_image||"",class:"modifier_plus_item modifier_item_second"},null,8,Xu)):l.createCommentVNode("",!0)])]))]),l.createElementVNode("p",null,l.toDisplayString(P.name),1)],8,Lu)}),128))]),_:1},8,["container","idActive"])],2)),[[l.unref(Vr),l.unref(h)?{}:!1]]):l.createCommentVNode("",!0)],2))}}),[["__scopeId","data-v-c850b1ab"]]),ju={},qu={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 Zu(o,s){return l.openBlock(),l.createElementBlock("svg",qu,[...s[0]||(s[0]=[l.createElementVNode("desc",null," Created with Pixso. ",-1),l.createElementVNode("defs",null,null,-1),l.createElementVNode("circle",{id:"Ellipse 1",cx:"10.923828",cy:"10.923462",r:"10.923489",fill:"#FF6D2E","fill-opacity":"1.000000"},null,-1),l.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 Ur=Ue(ju,[["render",Zu]]),zr={mounted(o){o.muted=!0,o.setAttribute("muted","")}},Yu={class:"wrapper_modifiers"},$u={class:"wrapper_nutritional_value"},Ku={class:"nutritional_scheme"},Qu={key:0,class:"nutritional_parameters"},Ju={key:1,class:"nutritional_parameters"},ed={key:2,class:"nutritional_parameters"},td={key:3,class:"nutritional_parameters"},nd={ref:"modifierBody",class:"modifier_shadow"},rd={class:"wrapper_modifiers_title"},id={class:"wrapper_text_count_modifiers"},od=["id","aria-label","onClick","onKeydown"],sd={key:0,class:"counter_modifier"},ad={class:"hide_image_corners"},ld=["src","alt"],cd={key:1,loop:"",autoplay:"",muted:"",playsinline:"",class:"card__video"},ud=["src"],dd={class:"modifier_title"},fd=Ue(l.defineComponent({__name:"SectionModifiers",emits:["close"],setup(o,{emit:s}){const i=s,u=It(),f=Rt(),{itemThemes:h}=xe.storeToRefs(u),{stateCard:m,recountGroupTotalAmount:x,groupTotalAmount:_}=xe.storeToRefs(f),{isDesktop:p,shouldUseDragScroll:C}=Nn(),y=l.ref(null),S=Wt.useTemplateRefsList(),M=k=>{if(!k)return;const P=m.value.groupModifiers.findIndex(D=>D.id===m.value.groupCurrentOpen.id),v=m.value.plusButtonsRefs[P]||m.value.plusButtonsRefs[0];if(!v)return;const U=k.getBoundingClientRect(),B=v.getBoundingClientRect(),R=k.cloneNode(!0);R.classList.add("flyer"),Object.assign(R.style,{width:`${U.width}px`,height:`${U.height}px`,left:`${U.left}px`,top:`${U.top}px`,position:"fixed",zIndex:"1000"}),document.body.appendChild(R),y.value=R,requestAnimationFrame(()=>{const D=B.left+B.width/3-(U.left+U.width/2),K=B.top+B.height/4-(U.top+U.height/2),te=B.width/U.width*.2;R.style.transform=`translate(${D}px, ${K}px) scale(${te})`,R.style.opacity="0.4",R.style.transition="transform 0.5s ease, opacity 0.5s ease"}),R.addEventListener("transitionend",()=>{R.remove(),y.value=null,v.classList.add("bump"),setTimeout(()=>v.classList.remove("bump"),300)},{once:!0})};return l.watch(()=>m.value.isAnimationFly,k=>{k===!0&&m.value.currentModifier&&(M(S.value.find(P=>P.id===m.value.currentModifier.id)),m.value.isAnimationFly=!1)}),(k,P)=>{var v,U,B,R,D,K,te,z,ie,W,se,j,G;return l.openBlock(),l.createElementBlock("div",Yu,[l.createElementVNode("div",$u,[l.createElementVNode("div",{class:l.normalizeClass(["card_header_inner_back",[(v=l.unref(m).openCard)!=null&&v.proteins_amount?"card_header_inner_back_nutrients":""]]),"aria-label":"Закрыть выбор модификаторов",onClick:P[0]||(P[0]=V=>i("close"))},[l.createVNode(Ur,{class:"arrow_bottom"})],2),l.createElementVNode("div",Ku,[(U=l.unref(m).openCard)!=null&&U.energy_amount?(l.openBlock(),l.createElementBlock("div",Qu,[l.createElementVNode("b",null,l.toDisplayString((B=l.unref(m).openCard)==null?void 0:B.energy_amount),1),P[1]||(P[1]=l.createElementVNode("p",null,"Килокалории",-1))])):l.createCommentVNode("",!0),(R=l.unref(m).openCard)!=null&&R.proteins_amount?(l.openBlock(),l.createElementBlock("div",Ju,[l.createElementVNode("b",null,l.toDisplayString((D=l.unref(m).openCard)==null?void 0:D.proteins_amount),1),P[2]||(P[2]=l.createElementVNode("p",null,"Белки",-1))])):l.createCommentVNode("",!0),(K=l.unref(m).openCard)!=null&&K.fat_amount?(l.openBlock(),l.createElementBlock("div",ed,[l.createElementVNode("b",null,l.toDisplayString((te=l.unref(m).openCard)==null?void 0:te.fat_amount),1),P[3]||(P[3]=l.createElementVNode("p",null,"Жиры",-1))])):l.createCommentVNode("",!0),(z=l.unref(m).openCard)!=null&&z.carbohydrates_amount?(l.openBlock(),l.createElementBlock("div",td,[l.createElementVNode("b",null,l.toDisplayString((ie=l.unref(m).openCard)==null?void 0:ie.carbohydrates_amount),1),P[4]||(P[4]=l.createElementVNode("p",null,"Углеводы",-1))])):l.createCommentVNode("",!0)])]),l.createElementVNode("div",nd,[l.createElementVNode("p",rd,l.toDisplayString((W=l.unref(m).groupCurrentOpen)==null?void 0:W.name),1),l.createElementVNode("p",id,"Выбрано "+l.toDisplayString(l.unref(x))+" из "+l.toDisplayString(l.unref(_)),1),l.withDirectives((l.openBlock(),l.createElementBlock("div",{class:l.normalizeClass((se=l.unref(m).groupModifiers.find(V=>{var X;return V.id===((X=l.unref(m).groupCurrentOpen)==null?void 0:X.id)}))!=null&&se.group_modifiers.length?"wrapper_modifiers_card":"wrapper_modifiers_card_column")},[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(((j=l.unref(m).groupCurrentOpen)==null?void 0:j.group_modifiers)||[],V=>{var X,N,$;return l.openBlock(),l.createElementBlock("div",{key:V.id,ref_for:!0,ref:l.unref(S).set,id:V.id,style:l.normalizeStyle({pointerEvents:l.unref(p)?"none":"auto"}),class:l.normalizeClass(["modifier_card",{hidden_modifier_card:V.default_amount===0&&((X=l.unref(m).groupCurrentOpen)==null?void 0:X.id)==="Добавки2000"&&V.min_amount===0&&V.max_amount===0}]),tabindex:"0",role:"button","data-clickable":"true","aria-label":`Выбрать модификатор группы ${V.name}`,onClick:H=>l.unref(f).modifierSelect(V),onKeydown:l.withKeys(H=>l.unref(f).modifierSelect(V),["enter"])},[l.createElementVNode("div",{class:l.normalizeClass([{modifier_card_active:l.unref(m).groupModifiersSelected.some(H=>{var J;return H.group===((J=l.unref(m).groupCurrentOpen)==null?void 0:J.id)&&H.modifiers.some(q=>q.id===V.id)})},"wrapper_image_corners"])},[V.amount>1?(l.openBlock(),l.createElementBlock("div",sd,l.toDisplayString(V.amount),1)):l.createCommentVNode("",!0),l.createElementVNode("div",ad,[V.video_link?l.withDirectives((l.openBlock(),l.createElementBlock("video",cd,[l.createElementVNode("source",{src:V.video_link||"",type:"video/webm"},null,8,ud)])),[[l.unref(zr)]]):(l.openBlock(),l.createElementBlock("img",{key:0,class:"modifier_image",src:V.image_link||l.unref(h).fallback_image||"",alt:V.name},null,8,ld)),l.createElementVNode("div",{class:l.normalizeClass(["wrapper_modifier_title",{wrapper_modifier_title_required:V.min_amount>0||V.required}])},[l.createElementVNode("h3",dd,l.toDisplayString(V.name),1),l.createElementVNode("p",null,"+"+l.toDisplayString((($=(N=V.sizes)==null?void 0:N.find(H=>H.id===l.unref(m).selectedSize.id))==null?void 0:$.price)||V.price||0)+"₽",1)],2)])],2)],46,od)}),128))],2)),[[l.unref(Vr),(G=l.unref(m).groupModifiers.find(V=>{var X;return V.id===((X=l.unref(m).groupCurrentOpen)==null?void 0:X.id)}))!=null&&G.group_modifiers.length?{}:!1]])],512)])}}}),[["__scopeId","data-v-2ce24a7a"]]),hd={key:0,class:"card_size_place"},gd=["onClick","onKeydown","aria-label"],md={key:1,class:"card_size static"},pd=["onClick","onKeydown","aria-label"],ao=3,xd=Ue(l.defineComponent({__name:"SizeModifier",setup(o){const s=Rt(),{stateCard:i}=xe.storeToRefs(s),u=l.ref(null),{isDesktop:f}=Nn(),h=l.ref(50),m=l.ref(),x=l.ref(0),_=l.ref(0),p=l.ref(null),C=l.computed(()=>{var D;if(i.value.productSizes.length<=3)return i.value.productSizes[m.value.index]||i.value.productSizes[0];const B=x.value+1,R=((D=S.value[B])==null?void 0:D.originalIndex)??1;return i.value.productSizes[R]}),y=()=>{p.value&&i.value.productSizes.length>=3&&(_.value=p.value.offsetWidth/ao)},S=l.computed(()=>{if(i.value.productSizes.length<=3)return i.value.productSizes;const B=i.value.productSizes;return[...B.map((R,D)=>({...R,originalIndex:D})),...B.map((R,D)=>({...R,originalIndex:D})),...B.map((R,D)=>({...R,originalIndex:D}))]}),M=(B,R)=>{if(m.value={id:B.id,title:B.name,index:R,is_default:B.is_default},B.price!==null&&i.value.openCard&&(i.value.openCard={...i.value.openCard,price:B.price}),i.value.selectedSize=B,i.value.productSizes.length>3){y();const D=x.value+1;R<D?k():R>D&&P()}else{const D=i.value.productSizes.length,K=(R+.5)*(100/D);h.value=K}},k=()=>{var B;if(!(i.value.productSizes.length<=3)){if(x.value--,x.value<i.value.productSizes.length-ao+1){x.value+=i.value.productSizes.length;const R=(B=p.value)==null?void 0:B.querySelector(".card_size");R&&(R.style.transition="none",R.style.transform=`translateX(-${x.value*_.value}px)`,R.offsetHeight,R.style.transition="transform 0.2s ease-in-out")}v()}},P=()=>{var B;if(!(i.value.productSizes.length<=3)){if(x.value++,x.value>=i.value.productSizes.length*2){x.value-=i.value.productSizes.length;const R=(B=p.value)==null?void 0:B.querySelector(".card_size");R&&(R.style.transition="none",R.style.transform=`translateX(-${x.value*_.value}px)`,R.offsetHeight,R.style.transition="transform 0.2s ease-in-out")}v()}},v=()=>{var K;if(i.value.productSizes.length<=3)return;const B=x.value+1,R=((K=S.value[B])==null?void 0:K.originalIndex)??0,D=i.value.productSizes[R];m.value={id:D.id,title:D.name,index:R,is_default:D.is_default}};l.watch(()=>[i.value.productSizes,p.value],([B=[],R])=>{if(Array.isArray(B)&&B.length>0&&R!==null){let D=B.findIndex(K=>K.is_default===!0);B.length<3&&u.value&&parseInt(u.value.style.minWidth)<767&&(u.value.style.width="100px"),D>-1?(x.value=D,M(B[D],D),_.value=120/ao):B.length===2||B.length===1?(M(B[0],0),h.value=(0+.5)*(100/2)):(M(B[1],1),h.value=(1+.5)*(100/3))}}),l.watch(()=>{var B;return[(B=i.value.selectedSize)==null?void 0:B.id,i.value.groupModifiersSelected]},([B,R])=>{if(!B||!Array.isArray(R))return;const D=R.map(K=>({...K,modifiers:K.modifiers.map(te=>{if(!te.sizes||te.sizes.length===0)return te;const z=te.sizes.find(ie=>ie.id===B);return z?{...te,size:z,price:z.price??te.price}:te})}));JSON.stringify(D)!==JSON.stringify(i.value.groupModifiersSelected)&&(i.value.groupModifiersSelected=D)},{deep:!0});const U={mounted:y};return l.onBeforeUnmount(()=>{window.removeEventListener("resize",y)}),(B,R)=>l.withDirectives((l.openBlock(),l.createElementBlock("div",{class:"slider_container",ref_key:"slider_container",ref:u},[l.createElementVNode("div",{class:"card_size_place_wrapper",ref_key:"sliderWrapper",ref:p},[l.unref(i).productSizes.length>1&&m.value?(l.openBlock(),l.createElementBlock("div",hd,[l.unref(i).productSizes.length>3?(l.openBlock(),l.createElementBlock("ul",{key:0,class:"card_size",style:l.normalizeStyle({transform:`translateX(-${x.value*_.value}px)`})},[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(S.value,(D,K)=>(l.openBlock(),l.createElementBlock("li",{key:`${D.id}-${K}`,onClick:te=>M(D,K),onKeydown:l.withKeys(te=>M(D,K),["enter"]),class:l.normalizeClass({active:m.value.id===D.id&&m.value.index===D.originalIndex}),tabindex:"0",role:"button","aria-label":`Выбрать размер ${D.name}`},l.toDisplayString(D.alt_name?D.alt_name:D.name),43,gd))),128))],4)):(l.openBlock(),l.createElementBlock("ul",md,[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(i).productSizes,(D,K)=>(l.openBlock(),l.createElementBlock("li",{key:`${D.id}-${K}`,onClick:te=>M(D,K),onKeydown:l.withKeys(te=>M(D,K),["enter"]),class:l.normalizeClass({active:m.value.id===D.id&&m.value.index===K}),tabindex:"0",role:"button","aria-label":`Выбрать размер ${D.name}`},l.toDisplayString(D.alt_name?D.alt_name:D.name),43,pd))),128))])),C.value?l.withDirectives((l.openBlock(),l.createElementBlock("div",{key:2,class:"size_active",style:l.normalizeStyle(l.unref(i).productSizes.length<=3?{left:`${h.value}%`}:{})},[l.createElementVNode("p",null,l.toDisplayString(C.value.alt_name?C.value.alt_name:C.value.name),1)],4)),[[U]]):l.createCommentVNode("",!0)])):l.createCommentVNode("",!0)],512)],512)),[[l.vShow,l.unref(i).productSizes.length>1&&m.value]])}}),[["__scopeId","data-v-2fab37e4"]]),wd="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",_d={class:"counter_container"},Cd={class:"card_size_place_wrapper",ref:"sliderWrapper"},Ed={class:"cart_amount_counter"},yd={class:"button_circle_number"},bd=Ue(l.defineComponent({__name:"NumberModifier",props:{qr_menu:{type:Boolean}},setup(o){const s=Rt(),{stateCard:i}=xe.storeToRefs(s),u=Re.useRouter(),f=o,h=()=>{var x,_,p,C;(_=(x=u.options.history.state)==null?void 0:x.back)!=null&&_.includes("mode=pdf")&&f.qr_menu||(p=i.value.openCard)!=null&&p.amount&&((C=i.value.openCard)==null?void 0:C.amount)>1&&(i.value.openCard.amount-=1)},m=()=>{var x,_,p;(_=(x=u.options.history.state)==null?void 0:x.back)!=null&&_.includes("mode=pdf")&&f.qr_menu||(p=i.value.openCard)!=null&&p.amount&&(i.value.openCard.amount+=1)};return(x,_)=>{var p,C;return l.openBlock(),l.createElementBlock("div",_d,[l.createElementVNode("div",Cd,[l.createElementVNode("div",Ed,[l.createElementVNode("p",{class:l.normalizeClass(["cart_circle_minus",[((p=l.unref(i).openCard)==null?void 0:p.amount)===1?"card_circle_minus_alone":""]]),"aria-label":"Уменьшить количество продукта","data-clickable":"true",onClick:l.withModifiers(h,["stop","prevent"])},[..._[0]||(_[0]=[l.createElementVNode("span",null,null,-1)])],2),l.createElementVNode("p",yd,l.toDisplayString((C=l.unref(i).openCard)==null?void 0:C.amount),1),l.createElementVNode("p",{class:"cart_circle_plus","aria-label":"Увеличить количество продукта","data-clickable":"true",onClick:l.withModifiers(m,["stop","prevent"])},"+")])],512)])}}}),[["__scopeId","data-v-50b09b8c"]]);function na(o,s=800){const i=l.ref(o),u=l.ref(o);let f=null,h=null,m=o;const x=_=>{h||(h=_);const p=_-h,C=Math.min(p/s,1),y=C<.5?4*C*C*C:1-Math.pow(-2*C+2,3)/2;i.value=Math.round(m+(u.value-m)*y),C<1?f=requestAnimationFrame(x):(i.value=u.value,f=null)};return l.watch(u,()=>{f&&cancelAnimationFrame(f),m=i.value,h=null,f=requestAnimationFrame(x)},{immediate:!0}),l.onUnmounted(()=>{f&&cancelAnimationFrame(f)}),{displayNumber:i,targetNumber:u,update:_=>{u.value=_}}}const Xt=l.defineComponent({__name:"RecountNumber",props:{price:{type:Number,required:!0},duration:{type:Number},fixedFloat:{type:Number,require:!1}},setup(o){const s=o,{displayNumber:i,update:u}=na(s.price||0,s.duration||800);return l.watchEffect(()=>{u(s.price)}),(f,h)=>(l.openBlock(),l.createElementBlock("span",null,l.toDisplayString(l.unref(i).toFixed(o.fixedFloat)),1))}}),Ad=["disabled","id"],un=l.defineComponent({__name:"ButtonDefault",props:{textButtonDefault:{type:String,required:!0},disabled:{type:Boolean,default:!1},onClick:{type:Function,required:!0}},setup(o){const s=o,i=()=>{s.onClick()};return(u,f)=>(l.openBlock(),l.createElementBlock("button",{class:"buttonDefaultWrapper",disabled:o.disabled,onClick:i,id:o.disabled?"buttonDefaultDisabled":""},l.toDisplayString(o.textButtonDefault),9,Ad))}}),Id={class:"notification_info"},Sd={key:0,class:"notification_18plus"},Nd={class:"notification_18plus_image"},Td=["src"],kd={class:"notification_18plus_text"},Rd={class:"notification_18plus_accept"},Od={key:1,class:"notification_text"},Bd={key:0,class:"wrapper_button_accept"},lo=l.defineComponent({__name:"NotificationWindow",props:l.mergeModels({textNotificationDefault:{},backgroundColor:{},buttonAccept:{},type:{type:Boolean},is_qr:{type:Boolean}},{visible:{default:!1},visibleModifiers:{}}),emits:["update:visible"],setup(o){const s=o,i=It(),u=lt(),{is18Allowed:f,notificationData_lib:h}=xe.storeToRefs(u),{itemThemes:m}=xe.storeToRefs(i),x=l.computed(()=>s.backgroundColor||"rgba(50, 50, 50, 0.9)"),_=l.computed(()=>{var k;return!!((k=m.value)!=null&&k.kiosk_hide_menu_update_notification)});let p;const C=l.useModel(o,"visible"),y=()=>{h.value.fastAdd&&(u.addToCart(h.value.fastAdd),h.value.fastAdd=null),sessionStorage.setItem("is_adult","true"),f.value=!0,C.value=!1,h.value.callback&&(h.value.callback(),h.value.callback=null)},S=()=>{C.value=!1},M=()=>{C.value=!1,clearTimeout(p)};return l.watch([C,()=>s.textNotificationDefault,_],([k,P,v],[U,B])=>{p&&(!k||k!==U||P!==B)&&clearTimeout(p),v&&k&&(p=setTimeout(M,4e3))},{immediate:!0}),l.onUnmounted(()=>{p&&M()}),(k,P)=>(l.openBlock(),l.createElementBlock(l.Fragment,null,[!_.value&&C.value?(l.openBlock(),l.createBlock(l.Transition,{key:0,name:"notificationBlack",appear:""},{default:l.withCtx(()=>[l.createElementVNode("div",{class:"notification_background_black",onClick:S})]),_:1})):l.createCommentVNode("",!0),l.createVNode(l.Transition,{name:"notification"},{default:l.withCtx(()=>{var v;return[C.value?(l.openBlock(),l.createElementBlock("div",{key:0,class:"notification_overlay",onClick:S},[l.createElementVNode("div",{class:"notification_wrapper",style:l.normalizeStyle({"background-color":x.value,border:`2px solid ${x.value}`})},[l.createElementVNode("div",Id,[o.type?(l.openBlock(),l.createElementBlock("div",Sd,[l.createElementVNode("div",Nd,[l.createElementVNode("img",{src:l.unref(m).adult_disclaimer_image||l.unref(m).fallback_image,alt:"Дисклеймер"},null,8,Td)]),l.createElementVNode("div",kd,l.toDisplayString(l.unref(m).adult_disclaimer_text),1),l.createElementVNode("div",Rd,[P[0]||(P[0]=l.createElementVNode("label",{for:"plus18"},"Содержащиеся в настоящем разделе материалы предназначены для лиц старше 18 лет, носят информационный характер об ассортименте товаров и не являются рекламой. ",-1)),l.createVNode(un,{textButtonDefault:"Мне есть 18",onClick:y,style:{fontSize:"1rem",padding:"6px 24px",marginLeft:"10px"}})])])):(l.openBlock(),l.createElementBlock("div",Od,[l.createTextVNode(l.toDisplayString(o.textNotificationDefault)+" ",1),(v=o.buttonAccept)!=null&&v.state?(l.openBlock(),l.createElementBlock("div",Bd,[l.createVNode(un,{class:"button_accept",textButtonDefault:o.buttonAccept.text,onClick:o.buttonAccept.acceptBtn,disabled:o.buttonAccept.disabled},null,8,["textButtonDefault","onClick","disabled"])])):l.createCommentVNode("",!0)]))])],4)])):l.createCommentVNode("",!0)]}),_:1})],64))}}),Md={class:"button_price button_price_modifiers"},vd=["src"],Dd={class:"button_text_container"},Pd={class:"button_text_price"},Ld=Ue(l.defineComponent({__name:"ButtonPriceCount",props:{qr_menu:{type:Boolean,default:!1},closeProduct:{}},setup(o){const s=Re.useRouter(),i=Re.useRoute(),u=Rt(),f=lt(),h=It(),m=l.ref([]),x=l.ref([]),_=o,{stateCard:p,totalPrice_libCard:C,isOpenWindow:y,isAddToCard:S}=xe.storeToRefs(u),{isDesktop:M}=Nn(),{itemThemes:k}=xe.storeToRefs(h),P=l.ref(!0),v=l.ref(!1),U=l.computed(()=>M.value?!1:P.value),B=()=>{var D,K,te,z,ie;if((K=(D=s.options.history.state)==null?void 0:D.back)!=null&&K.includes("mode=pdf")&&_.qr_menu)return;if(P.value){u.setCurrentCard(p.value.openCard),v.value=!0;const W=p.value.groupModifiers.findIndex(se=>u.checkedRequiredBtn.group.id===se.id);u.checkedRequiredBtn.haveRequaire&&u.toggleNotRequire(u.checkedRequiredBtn.group,W);return}const R=p.value.groupModifiersSelected||[];if(m.value=[],x.value=[],Array.isArray(R)&&R.length>0&&R.forEach(W=>{const se=W.group,j=W.modifiers||[];se==="Добавки2000"?m.value=j.map(G=>{var V;return{...G,old_price:G.price,size:Array.isArray(G.size)?G.size.map(X=>X.id).filter(Boolean):(V=G.size)!=null&&V.id?G.size.id:void 0}}):j.length>0&&x.value.push({group:se,is_fake:W.is_fake||!1,is_product_determining:W.is_product_determining||!1,modifiers:j.map(G=>{var V;return{...G,old_price:G.price,size:Array.isArray(G.size)?G.size.map(X=>X.id).filter(Boolean):(V=G.size)!=null&&V.id?G.size.id:void 0}})})}),document.body.style.overflow="",p.value.openCard){const W={id:p.value.openCard.id,is_fake:p.value.openCard.is_fake||!1,is_od_united_product:p.value.openCard.is_od_united_product||!1,amount:p.value.openCard.amount,name:p.value.openCard.name,image_link:p.value.openCard.image_link,price:p.value.openCard.price,old_price:p.value.openCard.price,size:((te=p.value.selectedSize)==null?void 0:te.id)??((ie=(z=p.value.openCard.sizes)==null?void 0:z.find(se=>se.is_default))==null?void 0:ie.id),sizes:p.value.openCard.sizes||[],modifiers:m.value,groups:p.value.openCard.groups,group_modifiers:x.value,energy_amount:p.value.openCard.energy_amount??0,proteins_amount:p.value.openCard.proteins_amount??0,fat_amount:p.value.openCard.fat_amount??0,carbohydrates_amount:p.value.openCard.carbohydrates_amount??0};_.closeProduct&&_.closeProduct(),f.addToCart(W),S.value=!0}y.value=!1,_.qr_menu&&s.push(`/${i.params.orgId}/`)};return l.watch(()=>p.value.productSizes,R=>{!R||R.length===0||!p.value.selectedSize||(p.value.selectedSize={...p.value.selectedSize})},{immediate:!0}),l.watchEffect(()=>{u.checkedRequiredBtn.haveRequaire?P.value=!0:P.value=!1}),l.onMounted(()=>{S.value=!1}),(R,D)=>(l.openBlock(),l.createElementBlock(l.Fragment,null,[(l.openBlock(),l.createBlock(l.Teleport,{to:"body"},[l.createVNode(lo,{visible:v.value,textNotificationDefault:l.unref(p).textErrorRequaired,backgroundColor:l.unref(k).accent_color?l.unref(k).accent_color:"#FF6D2E",buttonAccept:null,"onUpdate:visible":D[0]||(D[0]=K=>v.value=K)},null,8,["visible","textNotificationDefault","backgroundColor"])])),l.createElementVNode("div",{class:"button_price_bg_product",onTouchstart:D[3]||(D[3]=l.withModifiers(()=>{},["stop"])),onPointerdown:D[4]||(D[4]=l.withModifiers(()=>{},["stop"]))},[l.createElementVNode("div",Md,[l.unref(M)?l.createCommentVNode("",!0):(l.openBlock(),l.createBlock(bd,{key:0,qr_menu:o.qr_menu},null,8,["qr_menu"])),l.createElementVNode("div",{class:l.normalizeClass(["card_product_button_buy",{buy_active:!U.value}]),"data-clickable":"true",onClick:B,onTouchstart:D[1]||(D[1]=l.withModifiers(()=>{},["stop"])),onPointerdown:D[2]||(D[2]=l.withModifiers(()=>{},["stop"]))},[l.unref(M)?l.createCommentVNode("",!0):(l.openBlock(),l.createElementBlock("img",{key:0,src:l.unref(wd),class:"card_product_button_icon"},null,8,vd)),l.createElementVNode("div",Dd,[l.createElementVNode("p",Pd,[l.createVNode(Xt,{price:+l.unref(C),fixedFloat:2},null,8,["price"]),D[5]||(D[5]=l.createTextVNode(" ₽ ",-1))])])],34)])],32)],64))}}),[["__scopeId","data-v-4ebdaed7"]]),Fd={class:"modified_amount"},Vd={class:"hide_image_corners"},Ud=["src"],zd={class:"wrapper_modifier_title"},Hd={class:"amount_title"},Gd={class:"wrapper_amount_counter"},Wd={class:"amount_count"},Xd={class:"amount_wrapper"},jd={class:"add_counter_amount"},qd=Ue(l.defineComponent({__name:"ModalAmount",setup(o){const s=Rt(),i=It(),{itemThemes:u}=xe.storeToRefs(i),{stateCard:f}=xe.storeToRefs(s),h=l.computed(()=>{var _,p,C;return((C=(p=(_=f.value.currentModifier)==null?void 0:_.sizes)==null?void 0:p.find(y=>y.id===f.value.selectedSize.id))==null?void 0:C.price)??dr(f.value.currentModifier)}),m=()=>{f.value.currentModifier&&(f.value.currentModifier.amount=f.value.modalCount),s.modifierSelect(f.value.currentModifier),f.value.isModifiedAmount=!1},x=()=>{f.value.modalCount=1,f.value.currentModifier.amount=1};return(_,p)=>{var C,y;return l.openBlock(),l.createElementBlock(l.Fragment,null,[l.createElementVNode("div",Fd,[l.createElementVNode("div",Vd,[l.createElementVNode("img",{class:"modifier_image",src:((C=l.unref(f).currentModifier)==null?void 0:C.image_link)||l.unref(u).fallback_image||""},null,8,Ud),l.createElementVNode("div",zd,[l.createElementVNode("p",Hd,l.toDisplayString((y=l.unref(f).currentModifier)==null?void 0:y.name),1),l.createElementVNode("p",null,"+ "+l.toDisplayString(h.value)+"₽",1)])])]),l.createElementVNode("div",Gd,[l.createElementVNode("div",{class:"amount_mines",onClick:p[0]||(p[0]=l.withModifiers((...S)=>l.unref(s).minusAmount&&l.unref(s).minusAmount(...S),["stop"]))},[...p[1]||(p[1]=[l.createElementVNode("div",null,null,-1)])]),l.createElementVNode("p",Wd,l.toDisplayString(l.unref(f).modalCount),1),l.createElementVNode("div",Xd,[l.createVNode(so,{onClick:l.withModifiers(l.unref(s).plusAmount,["stop"])},null,8,["onClick"])])]),l.createElementVNode("p",{class:"clear_count",onClick:l.withModifiers(x,["stop"])},"Убрать все"),l.createElementVNode("div",jd,[l.createVNode(un,{textButtonDefault:"Добавить",onClick:m,class:"button_add_group_modifiers"})])],64)}}}),[["__scopeId","data-v-84debd5d"]]),Zd=(o,s,i)=>Math.max(s,Math.min(o,i)),Yd=(o,s)=>Math.pow(o,s*5),ra=(o,s,i)=>s===0||Math.abs(s)===1/0?Yd(o,i):o*s*i/(s+i*o),pi=(o,s)=>s*parseFloat(o)/100,co=(o,s,i,u=.15)=>u===0?Zd(o,s,i):o<s?-ra(s-o,i-s,u)+s:o>i?+ra(o-i,i-s,u)+i:o,sn=(o,{min:s,max:i})=>s!==void 0&&o<s?s:i!==void 0&&o>i?i:o;function $d(o,s,i){const u=l.ref(0),f=l.computed(()=>o.value.map(_=>typeof _=="string"?pi(_,i.value):_)),h=l.computed(()=>Math.min(...f.value)),m=l.computed(()=>Math.max(...f.value)),x=l.computed(()=>{const _=f.value.reduce((p,C)=>Math.abs(C-s.value)<Math.abs(p-s.value)?C:p);return f.value.indexOf(_)});return{currentSnapPointIndex:u,flattenedSnapPoints:f,minSnapPoint:h,maxSnapPoint:m,closestSnapPointIndex:x}}const uo=Ue(l.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(o,{expose:s,emit:i}){const u=o,f=i,h=Wt.useVModel(u,"modelValue",f,{passive:!0});l.watch(h,me=>{me&&q()}),l.onMounted(()=>{h.value&&q()});const m=l.ref(),x=l.ref(null),_=l.ref(null),p=l.ref(null),C=l.ref(null),y=l.ref(u.expandOnContentDrag),{height:S}=Wt.useWindowSize(),{height:M}=Wt.useElementBounding(m),{height:k}=Wt.useElementBounding(x),{height:P}=Wt.useElementBounding(C),{height:v}=Wt.useElementBounding(_),U=l.computed({get(){return sn(Math.ceil(P.value+k.value+v.value),{max:S.value})},set(me){[k.value,P.value,v.value]=me}}),B=l.ref(0),R=l.ref(0),D=At.useMotionValue(0),K=At.useMotionValue(0),{snapPoints:te}=l.toRefs(u),z=l.computed(()=>te.value??[U.value]),{flattenedSnapPoints:ie,currentSnapPointIndex:W,closestSnapPointIndex:se,minSnapPoint:j,maxSnapPoint:G}=$d(z,B,S);let V;function X(me){y.value=!0,N(me)}function N(me){y.value&&me.preventDefault()}const $=me=>{me.key==="Escape"&&ge()},H=()=>{u.canBackdropClose&&ge()};let J=!1;const q=async()=>{if(J)return;h.value=!0,J=!0,f("opening-started"),await l.nextTick();const me=m.value.$el;M.value=me.getBoundingClientRect().height;const Ze=me.querySelector("[data-vsbs-content]"),Ee=me.querySelector("[data-vsbs-header]"),mt=me.querySelector("[data-vsbs-footer]");if(U.value=[Ee.getBoundingClientRect().height,Ze.getBoundingClientRect().height,mt.getBoundingClientRect().height],await l.nextTick(),W.value=ie.value.findIndex(nt=>nt===j.value),u.initialSnapPoint){const nt=u.initialSnapPoint;if(nt<0||nt>=z.value.length)return console.warn("Index out of bounds");B.value=typeof z.value[nt]=="number"?sn(z.value[nt],{max:S.value}):pi(z.value[nt],S.value)}else B.value=sn(j.value,{max:S.value});R.value=B.value,D.jump(B.value),K.jump(B.value),requestAnimationFrame(()=>{V=At.animate(D,B.value,{duration:u.duration/1e3,ease:"easeInOut"}),V=At.animate(K,0,{duration:u.duration/1e3,ease:"easeInOut",onComplete:()=>{u.blocking&&f("opened")}})}),window.addEventListener("keydown",$),J=!1};let re=!1;const ge=()=>{re||(h.value=!1,re=!0,f("closing-started"),window.removeEventListener("keydown",$),setTimeout(()=>{f("closed"),re=!1},u.duration))},we=me=>{if(z.value){if(me<0||me>=z.value.length){console.warn("Index out of bounds");return}W.value=me,B.value=typeof z.value[me]=="number"?sn(z.value[me],{max:S.value}):pi(z.value[me],S.value),V=At.animate(D,B.value,{duration:u.duration/1e3,ease:"easeInOut",onComplete:()=>f("snapped",z.value.indexOf(z.value[me]))})}};function Ne(me){me>0?f("dragging-down"):me<0&&f("dragging-up")}const _e=()=>{B.value=M.value,R.value=K.get(),D.jump(B.value),K.jump(R.value)},Me=async(me,Ze)=>{await l.nextTick(),m.value&&(R.value<=0&&(B.value-=Ze.delta.y),B.value<=j.value&&(B.value=j.value,R.value+=Ze.delta.y,K.set(u.canSwipeClose?sn(R.value,{min:0}):sn(co(R.value,-M.value,0,.5),{min:0}))),D.set(sn(co(B.value,0,G.value,.25),{min:0,max:S.value})),Ne(Ze.delta.y))},he=()=>{if(u.canSwipeClose){let me=B.value/2;u.swipeCloseThreshold&&typeof u.swipeCloseThreshold=="number"&&(me=u.swipeCloseThreshold),u.swipeCloseThreshold&&typeof u.swipeCloseThreshold=="string"&&u.swipeCloseThreshold.includes("%")&&(me=B.value*(Number(u.swipeCloseThreshold.replace("%",""))/100)),Math.abs(R.value)>me&&(R.value=B.value)}else R.value=0;V=At.animate(K,R.value,{duration:u.duration/1e3,ease:"easeInOut"}),R.value===B.value&&(R.value=0,ge()),W.value=se.value,B.value=typeof z.value[se.value]=="number"?sn(z.value[se.value],{max:S.value}):pi(z.value[se.value],S.value),V=At.animate(D,B.value,{duration:u.duration/1e3,ease:"easeInOut",onComplete:()=>f("snapped",z.value.indexOf(z.value[se.value]))}),V=At.animate(K,0,{duration:u.duration/1e3,ease:"easeInOut"})},dt=(me,Ze)=>{if(B.value=M.value,R.value=K.get(),V&&V.stop(),!p.value)return;const Ee=p.value.scrollTop===0,mt=Ze.delta.y>0,nt=ie.value.length===1,jt=.5>Math.abs(B.value-G.value);if(nt){if(!u.expandOnContentDrag)return y.value=!1;K.get()===0&&Ee&&mt&&(y.value=!0),K.get()===0&&Ee&&!mt&&(y.value=!1)}else{if(!u.expandOnContentDrag)return y.value=!1;y.value=!0,jt&&(mt&&Ee&&(y.value=!0),!mt&&Ee&&(y.value=!1),Ee||(y.value=!1))}},Xe=async(me,Ze)=>{if(await l.nextTick(),!u.expandOnContentDrag)return y.value=!1;if(!m.value)return;R.value===0&&y.value&&u.expandOnContentDrag&&(B.value-=Ze.delta.y),B.value<=j.value&&(B.value=j.value,y.value&&u.expandOnContentDrag&&(R.value+=Ze.delta.y),R.value=sn(R.value,{min:0,max:j.value}),K.set(u.canSwipeClose?sn(R.value,{min:0}):sn(co(R.value,-M.value,0,.5),{min:0}))),B.value>G.value&&(B.value=G.value),B.value=sn(B.value,{max:S.value}),!(ie.value.length===1)&&B.value===G.value&&(y.value=!1),D.set(B.value),Ne(Ze.delta.y)},Oe=()=>{if(!p.value)return;const me=p.value.scrollTop===0;y.value=me},qe=Wt.useDebounceFn(me=>we(me),u.duration);return l.watch(z,(me,Ze)=>{if(h.value===!1||!me||!Ze)return;const Ee=me[W.value],mt=Ze[W.value];typeof Ee!="string"&&typeof mt!="string"&&(B.value=sn(Ee,{max:S.value}),Ee!==mt&&(V=At.animate(D,B.value,{duration:u.duration/1e3,ease:"easeInOut"})))}),l.watch(S,()=>qe(W.value)),s({open:q,close:ge,snapToPoint:we}),(me,Ze)=>(l.openBlock(),l.createBlock(l.Teleport,{to:o.teleportTo,defer:o.teleportDefer},[l.createElementVNode("div",l.mergeProps(me.$attrs,{"data-vsbs-container":""}),[l.createVNode(l.unref(At.AnimatePresence),null,{default:l.withCtx(()=>[l.unref(h)&&o.blocking?(l.openBlock(),l.createBlock(l.unref(At.Motion),{key:0,ref:"backdrop","data-vsbs-backdrop":"",onClick:Ze[0]||(Ze[0]=Ee=>H()),transition:{ease:"easeInOut",duration:o.duration/1e3},initial:{opacity:0},animate:{opacity:1},exit:{opacity:0}},null,8,["transition"])):l.createCommentVNode("",!0)]),_:1}),l.createVNode(l.unref(At.AnimatePresence),null,{default:l.withCtx(()=>[l.unref(h)?(l.openBlock(),l.createBlock(l.unref(At.Motion),{key:0,ref_key:"sheet",ref:m,exit:{y:"100%",height:l.unref(M),opacity:0},initial:!1,style:l.normalizeStyle({y:l.unref(K),z:1,height:l.unref(D)}),"data-vsbs-shadow":!o.blocking,"data-vsbs-sheet-show":l.unref(h),"aria-modal":"true","data-vsbs-sheet":"",tabindex:"-1"},{default:l.withCtx(()=>[l.createVNode(l.unref(At.Motion),{ref_key:"sheetHeader",ref:x,"data-vsbs-header":"",onPanStart:_e,onPan:Me,onPanEnd:he,onTouchmove:X,class:l.normalizeClass(o.headerClass)},{default:l.withCtx(()=>[l.renderSlot(me.$slots,"header",{},void 0,!0)]),_:3},8,["class"]),l.createElementVNode("div",{ref_key:"sheetScroll",ref:p,"data-vsbs-scroll":"",onScrollend:Oe},[l.createVNode(l.unref(At.Motion),{ref:"sheetContentWrapper","data-vsbs-content-wrapper":"",onPanStart:dt,onPan:Xe,onPanEnd:he,onTouchmove:N},{default:l.withCtx(()=>[l.createElementVNode("div",{ref_key:"sheetContent",ref:C,"data-vsbs-content":"",class:l.normalizeClass(o.contentClass)},[l.renderSlot(me.$slots,"default",{},void 0,!0)],2)]),_:3},512)],544),l.createVNode(l.unref(At.Motion),{ref_key:"sheetFooter",ref:_,"data-vsbs-footer":"",onPanStart:_e,onPan:Me,onPanEnd:he,onTouchmove:X,class:l.normalizeClass(o.footerClass)},{default:l.withCtx(()=>[l.renderSlot(me.$slots,"footer",{},void 0,!0)]),_:3},8,["class"])]),_:3},8,["exit","style","data-vsbs-shadow","data-vsbs-sheet-show"])):l.createCommentVNode("",!0)]),_:3})],16)],8,["to","defer"]))}}),[["__scopeId","data-v-e35f48f7"]]);function Fn(o,s=null){const i=ti();i.initCacheSingle("defaultImage");const u=l.computed(()=>i.cache.defaultImage||null),f=l.shallowRef(!1),h=l.computed(()=>{var p;return((p=l.toValue(o))==null?void 0:p.toString())||null}),m=Wt.computedAsync(async()=>{const p=h.value;return p?(await i.initCacheSingle(p),i.cache[p]||null):null},null,{evaluating:f}),x=l.computed(()=>f.value&&h.value!==null);return{mediaUrl:l.computed(()=>m.value||l.toValue(s)||u.value||null),isLoading:x}}const Kd={class:"card_product_modifiers_sheet_body"},Qd={class:"card__pictures"},Jd=["src"],e0=["src"],t0={class:"card_header_wrapper"},n0={key:0,class:"card_fire_kkal_wrapper"},r0={class:"card_content"},i0={class:"wrapper_size"},o0={key:0,class:"description"},s0={key:1},a0=Ue(l.defineComponent({__name:"CardProductPage",props:{configPage:{}},setup(o){const s=It(),i=Rt(),{stateCard:u,isOpenWindow:f}=xe.storeToRefs(i),{itemThemes:h}=xe.storeToRefs(s),m=Re.useRouter(),x=Re.useRoute(),_=o,p=l.computed(()=>!!(x.query.mode==="pdf"&&_.configPage.qr_menu)),{mediaUrl:C}=Fn(()=>{var M,k;return(M=u.value.openCard)!=null&&M.video_link?`${u.value.openCard.id}_video`:(k=u.value.openCard)!=null&&k.image_link?`${u.value.openCard.id}_image`:null},()=>{var M,k;return((M=u.value.openCard)==null?void 0:M.video_link)||((k=u.value.openCard)==null?void 0:k.image_link)||null}),y=()=>{_.configPage.qr_menu?p.value?m.push(`/${x.params.orgId}?mode=pdf`):m.push(`/${x.params.orgId}`):_.configPage.closeProduct()},S=()=>{u.value.isModifiedAmount=!1};return l.watch(()=>_.configPage.data,i.setCurrentCard),l.watch(()=>u.value.isSectionModifier,M=>{p.value&&document.body.classList.toggle("pdf_hidden",M)},{immediate:!0}),l.watchEffect(()=>{f.value||(f.value=_.configPage.is_closeProduct)}),l.onBeforeUnmount(()=>i.reset()),(M,k)=>{var P,v,U,B,R,D;return l.openBlock(),l.createElementBlock("div",{class:"card_product_wrapper",style:l.normalizeStyle(p.value?"user-select: none;":"")},[l.createVNode(l.unref(uo),{modelValue:l.unref(u).isSectionModifier,"onUpdate:modelValue":k[1]||(k[1]=K=>l.unref(u).isSectionModifier=K),class:"card_product_modifiers_sheet",teleportTo:p.value?"#app":"body"},{default:l.withCtx(()=>[l.createElementVNode("div",Kd,[l.createVNode(fd,{onClose:k[0]||(k[0]=K=>l.unref(u).isSectionModifier=!1)}),l.createVNode(ta,{isSectionModifier:l.unref(u).isSectionModifier,toggleNotRequire:l.unref(i).toggleNotRequire},null,8,["isSectionModifier","toggleNotRequire"])])]),_:1},8,["modelValue","teleportTo"]),(l.openBlock(),l.createBlock(l.Teleport,{to:"body"},[l.unref(u).isModifiedAmount?(l.openBlock(),l.createElementBlock("div",{key:0,class:"wrapper_modified_amount",onClick:l.withModifiers(S,["stop"])},[l.createVNode(qd)])):l.createCommentVNode("",!0)])),l.createElementVNode("div",Qd,[(P=l.unref(u).openCard)!=null&&P.video_link&&l.unref(C)?l.withDirectives((l.openBlock(),l.createElementBlock("video",{key:l.unref(C),loop:"",autoplay:"",muted:"",playsinline:"",class:"card__video"},[l.createElementVNode("source",{src:l.unref(C)||"",type:"video/webm"},null,8,Jd)])),[[l.unref(zr)]]):(l.openBlock(),l.createElementBlock("img",{key:1,class:"card__pictures_images",src:l.unref(C)||"",alt:"Product image"},null,8,e0)),l.createElementVNode("div",t0,[l.createVNode(Ur,{class:"card_header_back",onClick:y,"aria-label":"Вернуться назад"}),(v=l.unref(u).openCard)!=null&&v.energy_amount?(l.openBlock(),l.createElementBlock("div",n0,[k[3]||(k[3]=l.createElementVNode("div",{class:"card_fire_kkal"},null,-1)),l.createElementVNode("p",null,[l.createElementVNode("b",null,l.toDisplayString((U=l.unref(u).openCard)==null?void 0:U.energy_amount),1),k[2]||(k[2]=l.createTextVNode(" Ккал ",-1))])])):l.createCommentVNode("",!0)]),l.createElementVNode("h4",null,l.toDisplayString((B=l.unref(u).openCard)==null?void 0:B.name),1),l.createElementVNode("div",{class:"card__pictures__gradient",style:l.normalizeStyle(l.unref(h).gradientStyle)},null,4)]),l.createElementVNode("div",r0,[l.createElementVNode("div",i0,[l.createVNode(xd)]),(R=l.unref(u).openCard)!=null&&R.description?(l.openBlock(),l.createElementBlock("p",o0,l.toDisplayString((D=l.unref(u).openCard)==null?void 0:D.description),1)):l.createCommentVNode("",!0),l.unref(u).groupModifiers.length?(l.openBlock(),l.createElementBlock("div",s0,[k[4]||(k[4]=l.createElementVNode("p",{class:"title_info_modifiers"},"Настрой, как ты любишь",-1)),l.createVNode(ta,{isSectionModifier:l.unref(u).isSectionModifier,toggleNotRequire:l.unref(i).toggleNotRequire},null,8,["isSectionModifier","toggleNotRequire"])])):l.createCommentVNode("",!0),l.createVNode(Ld,{qr_menu:o.configPage.qr_menu,closeProduct:o.configPage.closeProduct},null,8,["qr_menu","closeProduct"])])],4)}}}),[["__scopeId","data-v-a92cd973"]]),l0={key:0,class:"popupWindowDefault_overlay"},ia=Ue(l.defineComponent({__name:"PopupWindowDefault",props:{visible:{type:Boolean}},emits:["update:visible"],setup(o,{emit:s}){const i=o,u=s,f=()=>{u("update:visible",!1)};return l.watch(()=>i.visible,async h=>{h&&await l.nextTick(),i.isVisible=h}),(h,m)=>(l.openBlock(),l.createElementBlock(l.Fragment,null,[l.createVNode(l.Transition,{name:"popupWindowDefaultBlack",appear:"",onAfterLeave:m[0]||(m[0]=()=>{u("update:visible",!1)})},{default:l.withCtx(()=>[i.visible?(l.openBlock(),l.createElementBlock("div",{key:0,class:"background_black",onClick:f})):l.createCommentVNode("",!0)]),_:1}),l.createVNode(l.Transition,{name:"popupWindowDefault",appear:"",onAfterLeave:m[1]||(m[1]=()=>{u("update:visible",!1)})},{default:l.withCtx(()=>[i.visible?(l.openBlock(),l.createElementBlock("div",l0,[l.renderSlot(h.$slots,"default",{},void 0,!0)])):l.createCommentVNode("",!0)]),_:3})],64))}}),[["__scopeId","data-v-08e0e008"]]),c0={},u0={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function d0(o,s){return l.openBlock(),l.createElementBlock("svg",u0,[...s[0]||(s[0]=[l.createElementVNode("path",{d:"M18 18L12 12M12 12L6 6M12 12L18 6M12 12L6 18",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)])])}const f0=Ue(c0,[["render",d0]]),fo=xe.defineStore("modals",()=>{const o=new Map,s=(f,h)=>{const m=u(f).value;m.visible=!0,m.context=h},i=f=>{const h=u(f).value;h.visible=!1},u=f=>(o.has(f)||o.set(f,l.ref({visible:!1})),o.get(f));return{state:u,open:s,close:i}}),h0=["src"],g0={class:"cart_box_content_wrapper"},m0={class:"cart_box_content_info"},p0={class:"cart_amount"},x0={class:"cart_amount_count"},w0={class:"cart_box_info_more"},_0={key:1,class:"cart_modifier_info"},C0={class:"cart_modifier_content"},E0={class:"wrapper_price_count_cart"},y0={class:"count_cart_box"},b0={class:"wrapper_modifiers_discount"},oa=Ue(l.defineComponent({__name:"CartBox",props:{index:Number,cardItem:Object},emits:["delete"],setup(o,{emit:s}){const i=o,u=lt(),f=It(),h=fo(),{itemThemes:m}=xe.storeToRefs(f),x=l.ref(0),_=l.ref(0),p=l.ref(!1),C=l.ref(!1),y=l.ref(!1),{displayNumber:S,update:M}=na(0,800),k=l.computed(()=>{var j,G;const W=((j=i.cardItem)==null?void 0:j.modifiers)??[],se=(((G=i.cardItem)==null?void 0:G.group_modifiers)??[]).flatMap(V=>V.modifiers??[]);return[...W,...se]}),{mediaUrl:P}=Fn(()=>{var W;return((W=i.cardItem)==null?void 0:W.id)+"_image"},()=>{var W;return(W=i.cardItem)==null?void 0:W.image_link}),v=l.computed(()=>{var W,se;return((W=i.cardItem)==null?void 0:W.total_new_price)||dr(i.cardItem)*((se=i.cardItem)==null?void 0:se.amount)}),U=()=>h.open("cart-delete-confirm",i.cardItem),B=()=>{y.value=!y.value},R=()=>{u.plusAmount(i.cardItem.idSystem)},D=()=>{i.cardItem.amount>1?u.minusAmount(i.cardItem.idSystem):U()},K=W=>{x.value=W.touches[0].clientX,p.value=!0},te=W=>{p.value&&(_.value=W.touches[0].clientX-x.value,_.value>0&&(_.value=0))},z=()=>{p.value=!1,_.value<-115&&U(),_.value=0};l.onMounted(()=>{i.index===0&&(C.value=!0,setTimeout(()=>{_.value=-90,setTimeout(()=>{_.value=0,C.value=!1},700)},0))});const ie=l.computed(()=>{const W=i.index===0&&C.value?1:`${1-Math.abs(_.value)/200}`;return{transform:`translateX(${_.value}px)`,opacity:W,transition:p.value?"none":"transform 0.7s, opacity 0.7s"}});return l.watch(v,M,{immediate:!0}),(W,se)=>{var j,G,V,X;return l.openBlock(),l.createElementBlock("div",{class:"cart_box_wrapper",onTouchstart:K,onTouchmove:te,onTouchend:z,style:l.normalizeStyle(ie.value)},[se[2]||(se[2]=l.createElementVNode("div",{class:"wrapper_cart_delete"},[l.createElementVNode("div",{class:"cart_delete"})],-1)),l.createElementVNode("img",{src:l.unref(P)||"",class:"cart_box_image"},null,8,h0),l.createElementVNode("div",g0,[l.createElementVNode("div",m0,[l.createElementVNode("p",null,l.toDisplayString((j=o.cardItem)==null?void 0:j.name),1),(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(((G=i.cardItem)==null?void 0:G.discounts)||[],(N,$)=>(l.openBlock(),l.createElementBlock("div",{key:$,class:"discount_banner"},[l.createElementVNode("p",null,l.toDisplayString(N.name),1),l.createElementVNode("p",null,l.toDisplayString(N.discount)+"₽",1)]))),128)),l.createElementVNode("div",p0,[l.createElementVNode("button",{onClick:D},"-"),l.createElementVNode("p",x0,l.toDisplayString(i.cardItem.amount),1),l.createElementVNode("button",{onClick:R},"+")])]),l.createElementVNode("div",w0,[l.createElementVNode("div",{class:"cart_box_remove_item",onClick:U},[l.createVNode(f0)]),(V=i.cardItem)!=null&&V.new_price?(l.openBlock(),l.createElementBlock("p",{key:0,class:l.normalizeClass({discount_new_price:(X=i.cardItem)==null?void 0:X.new_price})},l.toDisplayString((i.cardItem.new_price*i.cardItem.amount).toFixed(2)+"₽"),3)):l.createCommentVNode("",!0),l.createElementVNode("p",null,l.toDisplayString(l.unref(S).toFixed(2)+"₽"),1)])]),!y.value&&k.value.length>0?(l.openBlock(),l.createElementBlock("div",{key:0,class:"cart_modifier_toggle",onTouchstart:l.withModifiers(B,["stop"])},[...se[0]||(se[0]=[l.createElementVNode("p",{class:"cart_info_more"},"Посмотреть модификаторы",-1),l.createElementVNode("p",{class:"cart_arrow"},null,-1)])],32)):l.createCommentVNode("",!0),y.value?(l.openBlock(),l.createElementBlock("div",_0,[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(k.value,N=>{var $;return l.openBlock(),l.createElementBlock("div",{class:"cart_modifier_item",key:N.id},[l.createElementVNode("div",C0,[l.createVNode(so,{id:"plus_orange"}),l.createElementVNode("p",null,l.toDisplayString(N.name),1)]),l.createElementVNode("div",E0,[l.createElementVNode("p",y0,l.toDisplayString(`x${N.amount}`),1),l.createElementVNode("div",b0,[N!=null&&N.new_price?(l.openBlock(),l.createElementBlock("p",{key:0,class:l.normalizeClass({discount_new_price:($=N==null?void 0:N.new_price)==null?void 0:$.toFixed(2)})},l.toDisplayString((N.new_price*N.amount).toFixed(2)+"₽"),3)):l.createCommentVNode("",!0),l.createElementVNode("p",null,l.toDisplayString((N.total_new_price||N.price*N.amount).toFixed(2)+"₽"),1)])])])}),128)),l.createElementVNode("div",{class:"cart_modifier_arrow",onTouchstart:l.withModifiers(B,["stop"])},[...se[1]||(se[1]=[l.createElementVNode("p",{class:"cart_info_more"},"Скрыть",-1),l.createElementVNode("p",{class:"cart_arrow_top"},null,-1)])],32)])):l.createCommentVNode("",!0)],36)}}}),[["__scopeId","data-v-868411fd"]]),A0={},I0={class:"nfc_x",viewBox:"0 0 48 48"};function S0(o,s){return l.openBlock(),l.createElementBlock("svg",I0,[...s[0]||(s[0]=[l.createElementVNode("rect",{x:"8",y:"12",width:"32",height:"24",rx:"4",ry:"4",stroke:"#B00020","stroke-width":"2.4",fill:"none"},null,-1),l.createElementVNode("path",{d:"M14 16L34 30M34 16L14 30",stroke:"#B00020","stroke-width":"3","stroke-linecap":"round"},null,-1)])])}const N0=Ue(A0,[["render",S0]]),T0={},k0={style:{},"aria-hidden":"true",viewBox:"0 0 48 48",class:"nfc_ok"};function R0(o,s){return l.openBlock(),l.createElementBlock("svg",k0,[...s[0]||(s[0]=[l.createElementVNode("rect",{x:"8",y:"12",width:"32",height:"24",rx:"4",ry:"4",stroke:"#5D534B","stroke-width":"none",fill:"none"},null,-1),l.createElementVNode("path",{d:"M16 22h16m-10 6h6",stroke:"#5D534B","stroke-width":"2.4","stroke-linecap":"round"},null,-1),l.createElementVNode("path",{d:"M14 28l6 6l14-14",fill:"none",stroke:"#2ECC71","stroke-width":"3","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)])])}const O0=Ue(T0,[["render",R0]]),B0={key:0,class:"nfc_ok",viewBox:"0 0 48 48","aria-hidden":"true"},M0=l.defineComponent({__name:"CardReaderRetry",props:{styleRetry:{type:Boolean}},setup(o){return(s,i)=>o.styleRetry?l.createCommentVNode("",!0):(l.openBlock(),l.createElementBlock("svg",B0,[...i[0]||(i[0]=[l.createElementVNode("rect",{x:"8",y:"12",width:"32",height:"24",rx:"4",ry:"4"},null,-1),l.createElementVNode("path",{d:"M16 22h16m-10 6h6"},null,-1)])]))}}),v0={class:"sheet_header"},D0={class:"sheet_title",id:"sheetTitle"},P0={class:"sheet_body"},L0={class:"sheet_card"},F0={class:"nfc_title"},V0={class:"lead"},U0={class:"wrapper_input_accept"},z0={key:1},H0={key:0,class:"card_phone_auth_wrapper"},G0={class:"sr_only","aria-live":"polite"},sa=l.defineComponent({__name:"CardReader",setup(o){const s=lt(),i=It(),{is_OpenLoyal:u}=xe.storeToRefs(s),{itemThemes:f}=xe.storeToRefs(i),h=St(),m=l.ref(),x=l.ref(null),_=l.ref(""),p={wait:{text:"Лояльность",title:""},success:{text:"Стикер распознан",title:"Стикер распознан"},not_found:{text:"Стикер не распознан",title:"Стикер не распознали"}},C=l.computed({get:()=>_.value,set:H=>{_.value=H.replace(/\s/g,"")}}),y=l.computed(()=>h.currentState),S=l.computed(()=>h.isDrawerOpen),M=l.computed(()=>{var H;return((H=p[y.value])==null?void 0:H.text)||""}),k=l.computed(()=>{var H;(H=p[y.value])!=null&&H.title}),P=l.computed(()=>y.value==="success"?"Добро пожаловать!":f.value.kiosk_show_loyalty_phone_input_button?"Поднесите стикер к считывателю или войдите по номеру телефона":"Поднесите стикер к считывателю или введите номер карты вручную"),v=l.computed(()=>({ok:y.value==="success",warn:y.value==="not_found"})),U=l.computed(()=>{const H=[];return y.value==="wait"&&H.push("pulse","show-x"),y.value==="not_found"&&H.push("pulse","show-x"),y.value==="success"&&H.push("pulse","show-ok"),H}),B=l.computed(()=>y.value==="not_found"),R=l.computed(()=>y.value==="success"),D=l.computed(()=>y.value==="not_found"),K=l.computed(()=>["not_found"].includes(y.value)),te=l.computed(()=>({wait:"Стикер не распознан. Нажмите «Повторить».",success:"Стикер распознан. Нажмите «Продолжить».",not_found:"Стикер не распознан. Нажмите «Повторить»."})[y.value]||""),z=()=>{h.closeDrawer(),u.value=!0},ie=async H=>{var J,q;h.error="",x.value=null;try{const re=new En;await re.authorizeByCard(H.trim()),await re.getProfile(),s.loadCart(),h.setState("success"),h.isDrawerOpen=!1,h.showNotification("Вы успешно авторизовались в программе лояльности!")}catch(re){h.error=((q=(J=re.response)==null?void 0:J.data)==null?void 0:q.user_friendly_message)||"Ошибка",h.setState("not_found"),x.value=C.value,C.value=""}},W=l.computed(()=>{var J;const H=(J=f.value)==null?void 0:J.kiosk_hide_manual_input_loyalty_card;return H??!1}),se=()=>{h.setState("wait"),h.error="",C.value="",x.value=null},j=()=>{h.closeDrawer(),x.value=null,C.value=""},G=()=>{var H,J;h.setState("wait"),(J=(H=C.value)==null?void 0:H.trim())!=null&&J.length&&ie(C.value.trim())},V=H=>{H.stopPropagation(),document.activeElement!==m.value&&X()},X=()=>{l.nextTick(()=>{m.value&&(m.value.focus(),_.value&&m.value.select())})},N=H=>{const J=document.activeElement===m.value;if(!S.value||J)return;const q=H.key.toLowerCase();if(q==="backspace")return C.value=C.value.slice(0,-1);if(q==="escape")return j();if(q==="r"&&D.value)return se();if(q==="c"&&y.value==="success")return j();if(q==="enter")return G();C.value+=q},$={mounted(H){H==null||H.focus()}};return l.onMounted(()=>{document==null||document.addEventListener("keydown",N)}),l.onBeforeUnmount(()=>{document==null||document.removeEventListener("keydown",N)}),l.watchEffect(()=>{S.value&&(h.error="")}),(H,J)=>(l.openBlock(),l.createElementBlock(l.Fragment,null,[S.value?(l.openBlock(),l.createElementBlock("div",{key:0,class:"backdrop show",onClick:j,"aria-hidden":"true"})):l.createCommentVNode("",!0),S.value?(l.openBlock(),l.createElementBlock("section",{key:1,class:l.normalizeClass(["sheet show",{sheet_retry:D.value}]),"aria-modal":"true","aria-labelledby":"sheetTitle",onClick:V},[l.createElementVNode("header",v0,[l.createElementVNode("div",D0,l.toDisplayString(M.value),1),D.value?(l.openBlock(),l.createElementBlock("div",{key:0,class:l.normalizeClass(["sheet_status",v.value])},l.toDisplayString(x.value),3)):l.createCommentVNode("",!0),l.createElementVNode("button",{class:"sheet_close",onClick:j,"aria-label":"Закрыть"}," Закрыть ")]),l.createElementVNode("div",P0,[l.createElementVNode("div",L0,[l.createElementVNode("div",{class:l.normalizeClass(["nfc",U.value])},[l.createVNode(M0,{styleRetry:K.value},null,8,["styleRetry"]),B.value?(l.openBlock(),l.createBlock(N0,{key:0})):l.createCommentVNode("",!0),l.createElementVNode("div",{class:"overlay check",style:l.normalizeStyle({display:R.value?"grid":"none"}),"aria-hidden":"true"},[l.createVNode(O0)],4)],2),l.createElementVNode("h2",F0,l.toDisplayString(k.value),1),l.createElementVNode("p",V0,l.toDisplayString(P.value),1),l.createElementVNode("div",U0,[l.withDirectives(l.createElementVNode("input",{style:l.normalizeStyle(W.value?{position:"absolute",left:"-9999px"}:{}),ref_key:"cardInputManualRef",ref:m,"onUpdate:modelValue":J[0]||(J[0]=q=>C.value=q),class:"nfc_title_read_input",type:"text",placeholder:"Введите трек карты","aria-live":"polite",onKeydown:l.withKeys(G,["enter"])},null,36),[[l.vModelText,C.value],[$]]),D.value?(l.openBlock(),l.createElementBlock("button",{key:0,class:"btn btn_ghost",onClick:se},"Повторить")):(l.openBlock(),l.createElementBlock("div",z0,[W.value?l.createCommentVNode("",!0):(l.openBlock(),l.createElementBlock("button",{key:0,class:"btn btn_ghost",onClick:J[1]||(J[1]=q=>D.value?j:G())},"Отправить"))]))]),y.value==="wait"&&l.unref(f).kiosk_show_loyalty_phone_input_button?(l.openBlock(),l.createElementBlock("div",H0,[l.createElementVNode("button",{class:"card_phone_auth_button",onClick:z},"Войти по номеру телефона")])):l.createCommentVNode("",!0)])]),l.createElementVNode("div",G0,l.toDisplayString(te.value),1)],2)):l.createCommentVNode("",!0)],64))}});function aa(){const o=Re.useRoute(),s=St(),i=lt(),{isButtonDisabled:u}=xe.storeToRefs(s),f=(m,x)=>{const _=m.is_tableservice?"tableservice":m.kiosk_menu?"kiosk":"qr",p=s.createPaymentHandler(_,m.kiosk_menu,m.is_tableservice,x);return p?{...p.config,route:{params:{orgId:String(o.params.orgId)}},handler:p.handler,setButtonDisabled:C=>{u.value=C},on403Kiosk:()=>{localStorage.removeItem("apiKey"),i.is_showApiKey=!0}}:null};return{getCreateOrderConfig:f,makeCreateOrderRequest:async(m,x)=>{const _=f(m,x.paymentMethodId);if(_)return Iu(x.items,x.tableDataId,_,{comment:x.comment,is_authorized:x.isAuthorized,signal:x.signal})}}}const W0="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxMDAiIGhlaWdodD0iMTAwIiB2aWV3Qm94PSIwIDAgMTAwIDEwMCIgcm9sZT0iaW1nIiBhcmlhLWxhYmVsPSJJTk5PIGJhbmsgY2FyZCBpY29uIj4NCiAgPGRlZnM+DQogICAgPGxpbmVhckdyYWRpZW50IGlkPSJibGFja0dyYWQiIHgxPSIwIiB5MT0iMCIgeDI9IjEiIHkyPSIxIj4NCiAgICAgIDxzdG9wIG9mZnNldD0iMCUiIHN0b3AtY29sb3I9IiMxQTFBMUEiLz4NCiAgICAgIDxzdG9wIG9mZnNldD0iMTAwJSIgc3RvcC1jb2xvcj0iIzAwMDAwMCIvPg0KICAgIDwvbGluZWFyR3JhZGllbnQ+DQoNCiAgICA8bGluZWFyR3JhZGllbnQgaWQ9InNoaW5lIiB4MT0iMCIgeTE9IjAiIHgyPSIxIiB5Mj0iMCI+DQogICAgICA8c3RvcCBvZmZzZXQ9IjAlIiBzdG9wLWNvbG9yPSIjRkZGRkZGIiBzdG9wLW9wYWNpdHk9IjAiLz4NCiAgICAgIDxzdG9wIG9mZnNldD0iNTAlIiBzdG9wLWNvbG9yPSIjRkZGRkZGIiBzdG9wLW9wYWNpdHk9IjAuMTgiLz4NCiAgICAgIDxzdG9wIG9mZnNldD0iMTAwJSIgc3RvcC1jb2xvcj0iI0ZGRkZGRiIgc3RvcC1vcGFjaXR5PSIwIi8+DQogICAgPC9saW5lYXJHcmFkaWVudD4NCg0KICAgIDxmaWx0ZXIgaWQ9InNoYWRvdyIgeD0iLTMwJSIgeT0iLTMwJSIgd2lkdGg9IjE2MCUiIGhlaWdodD0iMTYwJSI+DQogICAgICA8ZmVEcm9wU2hhZG93IGR4PSIwIiBkeT0iNiIgc3RkRGV2aWF0aW9uPSI2IiBmbG9vZC1jb2xvcj0iIzAwMCIgZmxvb2Qtb3BhY2l0eT0iMC4yNSIvPg0KICAgIDwvZmlsdGVyPg0KICA8L2RlZnM+DQoNCiAgPCEtLSBDZW50ZXJlZCBjYXJkIC0tPg0KICA8ZyB0cmFuc2Zvcm09InRyYW5zbGF0ZSg3LjUgMjMpIHJvdGF0ZSgtMTIpIiBmaWx0ZXI9InVybCgjc2hhZG93KSI+DQogICAgPCEtLSBjYXJkIGJvZHkgLS0+DQogICAgPHJlY3QgeD0iMCIgeT0iMCIgd2lkdGg9Ijg1IiBoZWlnaHQ9IjU0IiByeD0iMTAiIGZpbGw9InVybCgjYmxhY2tHcmFkKSIvPg0KDQogICAgPCEtLSB0b3Agc3RyaXBlIC0tPg0KICAgIDxyZWN0IHg9IjAiIHk9IjgiIHdpZHRoPSI4NSIgaGVpZ2h0PSI4IiByeD0iNCIgZmlsbD0iI0ZGRkZGRiIgb3BhY2l0eT0iMC4wNSIvPg0KDQogICAgPCEtLSBjaGlwIC0tPg0KICAgIDxnIHRyYW5zZm9ybT0idHJhbnNsYXRlKDEwIDI3KSI+DQogICAgICA8cmVjdCB3aWR0aD0iMTgiIGhlaWdodD0iMTUiIHJ4PSIzIiBmaWxsPSIjQ0ZBRTcwIi8+DQogICAgICA8cmVjdCB4PSIyLjUiIHk9IjMuNSIgd2lkdGg9IjEzIiBoZWlnaHQ9IjEuMiIgZmlsbD0iIzlFODM0RSIvPg0KICAgICAgPHJlY3QgeD0iMi41IiB5PSI2LjUiIHdpZHRoPSIxMyIgaGVpZ2h0PSIxLjIiIGZpbGw9IiM5RTgzNEUiLz4NCiAgICAgIDxyZWN0IHg9IjIuNSIgeT0iOS41IiB3aWR0aD0iMTMiIGhlaWdodD0iMS4yIiBmaWxsPSIjOUU4MzRFIi8+DQogICAgICA8cmVjdCB4PSI4LjUiIHk9IjAiIHdpZHRoPSIxLjUiIGhlaWdodD0iMTUiIGZpbGw9IiM5RTgzNEUiIG9wYWNpdHk9IjAuNiIvPg0KICAgIDwvZz4NCg0KICAgIDwhLS0gSU5OTyBsb2dvIC0tPg0KICAgIDx0ZXh0IHg9IjYxIiB5PSIzOSINCiAgICAgICAgICBmb250LWZhbWlseT0ic3lzdGVtLXVpLCAtYXBwbGUtc3lzdGVtLCBTZWdvZSBVSSwgUm9ib3RvLCBBcmlhbCwgc2Fucy1zZXJpZiINCiAgICAgICAgICBmb250LXNpemU9IjEzIg0KICAgICAgICAgIGZvbnQtd2VpZ2h0PSI4MDAiDQogICAgICAgICAgbGV0dGVyLXNwYWNpbmc9IjEuMiINCiAgICAgICAgICBmaWxsPSIjRkZGRkZGIg0KICAgICAgICAgIG9wYWNpdHk9IjAuOTUiDQogICAgICAgICAgdGV4dC1hbmNob3I9Im1pZGRsZSI+DQogICAgICBpbm5vDQogICAgPC90ZXh0Pg0KDQogICAgPCEtLSBzaGluZSAtLT4NCiAgICA8cGF0aCBkPSJNLTggNiBMMjUgLTMgTDk0IDQ3IEw2MCA2MiBMLTggMjUgWiIgZmlsbD0idXJsKCNzaGluZSkiLz4NCiAgPC9nPg0KPC9zdmc+",la="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",X0=["src"],j0={class:"header_description"},q0=Ue(l.defineComponent({__name:"PaymentBoxes",props:{configPage:{},comment:{},cartItems:{},isAuthorized:{type:Boolean},hasRmsDiscount:{type:Boolean,default:!1},hideDiscountsButton:{type:Boolean,default:!1},orderId:{default:null},signal:{},provider:{}},emits:["select"],setup(o,{emit:s}){const i=o,u=s,f=St(),h=Rt(),{selectedProvider:m,isButtonDisabled:x}=xe.storeToRefs(f),{isAddToCard:_}=xe.storeToRefs(h),{makeCreateOrderRequest:p}=aa(),C={default:W0,SBP:la},y=async()=>{m.value=i.provider;const M=i.provider.front_type;M&&(_.value=!1,x.value=!0,u("select",M),i.hasRmsDiscount&&!i.hideDiscountsButton&&i.orderId!=null?Fr(i.orderId,i.provider.type):await p(i.configPage,{paymentMethodId:M,items:i.cartItems,tableDataId:i.configPage.tableDataId,comment:i.comment,isAuthorized:i.isAuthorized,signal:i.signal}))},S=l.computed(()=>C[i.provider.front_type]||C.default);return(M,k)=>(l.openBlock(),l.createElementBlock("div",{class:"payment_boxes_wrapper",onClick:y},[l.createElementVNode("img",{class:"picture",src:S.value},null,8,X0),l.createElementVNode("div",j0,[l.createElementVNode("b",null,l.toDisplayString(o.provider.name),1),l.createElementVNode("p",null,l.toDisplayString(o.provider.description),1)]),l.createVNode(Ur)]))}}),[["__scopeId","data-v-7e25de77"]]),Z0={key:0,class:"wrapper_cart_payment"},Y0={class:"wrapper_paid"},$0={class:"to_be_paid"},K0=Ue(l.defineComponent({__name:"CartPayment",props:{configPage:{},comment:{},cartItems:{},isAuthorized:{type:Boolean},hasRmsDiscount:{type:Boolean},hideDiscountsButton:{type:Boolean},orderId:{},signal:{}},emits:["selectPayment"],setup(o,{emit:s}){const i=St(),u=lt(),f=o,{totalPrice_lib:h,countBonus:m}=xe.storeToRefs(u),x=s,_=C=>{x("selectPayment",C)},p=()=>{x("selectPayment","")};return(C,y)=>l.unref(i).providerTypes.length>1?(l.openBlock(),l.createElementBlock("div",Z0,[y[2]||(y[2]=l.createElementVNode("h2",null,"Выберите способ оплаты",-1)),y[3]||(y[3]=l.createElementVNode("p",{class:"description_payment"},"Можно изменить позже до оплаты",-1)),(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(i).providerTypes,(S,M)=>(l.openBlock(),l.createElementBlock("div",{key:M},[l.createVNode(q0,{provider:S,"config-page":f.configPage,comment:f.comment,"cart-items":f.cartItems,"is-authorized":f.isAuthorized,"has-rms-discount":f.hasRmsDiscount,"hide-discounts-button":f.hideDiscountsButton,"order-id":f.orderId,signal:f.signal,onSelect:_},null,8,["provider","config-page","comment","cart-items","is-authorized","has-rms-discount","hide-discounts-button","order-id","signal"])]))),128)),l.createElementVNode("div",Y0,[l.createElementVNode("p",$0,[y[0]||(y[0]=l.createTextVNode("К оплате ",-1)),l.createVNode(Xt,{price:l.unref(h)-l.unref(m),fixedFloat:2},null,8,["price"]),y[1]||(y[1]=l.createTextVNode(" ₽",-1))]),l.createVNode(un,{textButtonDefault:"Назад",onClick:p,class:"btn_payment"})])])):l.createCommentVNode("",!0)}}),[["__scopeId","data-v-93970a62"]]),Q0={class:"start_page"},J0=["src"],e1={class:"wrap"},t1={class:"wrap_box"},n1={class:"title_fiscal_order"},r1={class:"wrapper_accept"},i1={ref:"barRef",class:"bar_complete","aria-hidden":"true"},o1=Ue(l.defineComponent({__name:"CartCompleteKioskSuccess",props:{mediaUrl:{},orderNumber:{}},setup(o){const s=lt(),i=St(),u=Rt(),f=It(),{cartProducts_lib:h}=xe.storeToRefs(s),{orderNumber:m,orderCompleted_lib:x,selectedOrderType:_}=xe.storeToRefs(i),{is_startPage:p}=xe.storeToRefs(u),{mediaUrl:C}=Fn(()=>f.itemThemes.kiosk_preloader?"preloader":null),y=Re.useRouter(),S=Re.useRoute();let M=null;l.onMounted(()=>{M=setTimeout(()=>{p.value=!f.itemThemes.kiosk_disable_lock_screen,_.value=null,s.isOrderTypeSubmited=!1,y.replace(`/${S.params.orgId}`)},1e4)});const k=()=>{fr(["cart","authTokensAccess","authTokensRefresh"]),h.value=[],x.value=null,_.value=null,s.isOrderTypeSubmited=!1,i.clearCard(),s.profile=null,y.replace(`/${S.params.orgId}`)};return l.onUnmounted(()=>{M&&clearInterval(M)}),(P,v)=>(l.openBlock(),l.createElementBlock("div",Q0,[l.withDirectives((l.openBlock(),l.createElementBlock("video",{loop:"",autoplay:"",muted:"",playsinline:"",key:l.unref(C)},[l.createElementVNode("source",{src:l.unref(C)||"",type:"video/webm"},null,8,J0)])),[[l.unref(zr)]]),v[4]||(v[4]=l.createElementVNode("div",{class:"start_img_black"},null,-1)),l.createElementVNode("div",e1,[l.createElementVNode("div",t1,[v[1]||(v[1]=l.createElementVNode("div",{class:"icon","aria-hidden":"true"},[l.createElementVNode("svg",{viewBox:"0 0 24 24"},[l.createElementVNode("path",{d:"M20 6L9 17l-5-5"})])],-1)),v[2]||(v[2]=l.createElementVNode("h1",null," Заказ успешно оплачен ",-1)),l.createElementVNode("p",n1,"№ "+l.toDisplayString(l.unref(m)),1),v[3]||(v[3]=l.createElementVNode("p",{class:"title_fiscal_completed"},"Спасибо! Заказ передан в работу.",-1)),l.createElementVNode("div",r1,[l.createElementVNode("button",{class:"btn","aria-label":"Новый заказ",onClick:k},[v[0]||(v[0]=l.createElementVNode("span",{class:"label"},"Новый заказ",-1)),l.createElementVNode("span",i1,null,512)])])])])]))}}),[["__scopeId","data-v-79c00acf"]]),s1={};function a1(o,s){return s[0]||(s[0]=l.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 l1=Ue(s1,[["render",a1],["__scopeId","data-v-3e03a6dc"]]),c1={},u1={class:"center"};function d1(o,s){return l.openBlock(),l.createElementBlock("div",u1,[...s[0]||(s[0]=[l.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 f1=Ue(c1,[["render",d1],["__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 Nn=function(){return Nn=Object.assign||function(a){for(var i,u=1,f=arguments.length;u<f;u++){i=arguments[u];for(var h in i)Object.prototype.hasOwnProperty.call(i,h)&&(a[h]=i[h])}return a},Nn.apply(this,arguments)};typeof SuppressedError=="function"&&SuppressedError;var Jn;(function(o){var a=function(){function m(w,_,p,C){if(this.version=w,this.errorCorrectionLevel=_,this.modules=[],this.isFunction=[],w<m.MIN_VERSION||w>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=w*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 B=this.addEccAndInterleave(p);if(this.drawCodewords(B),C==-1)for(var R=1e9,N=0;N<8;N++){this.applyMask(N),this.drawFormatBits(N);var P=this.getPenaltyScore();P<R&&(C=N,R=P),this.applyMask(N)}f(0<=C&&C<=7),this.mask=C,this.applyMask(C),this.drawFormatBits(C),this.isFunction=[]}return m.encodeText=function(w,_){var p=o.QrSegment.makeSegments(w);return m.encodeSegments(p,_)},m.encodeBinary=function(w,_){var p=o.QrSegment.makeBytes(w);return m.encodeSegments([p],_)},m.encodeSegments=function(w,_,p,C,y,N){if(p===void 0&&(p=1),C===void 0&&(C=40),y===void 0&&(y=-1),N===void 0&&(N=!0),!(m.MIN_VERSION<=p&&p<=C&&C<=m.MAX_VERSION)||y<-1||y>7)throw new RangeError("Invalid value");var B,R;for(B=p;;B++){var P=m.getNumDataCodewords(B,_)*8,D=h.getTotalBits(w,B);if(D<=P){R=D;break}if(B>=C)throw new RangeError("Data too long")}for(var v=0,M=[m.Ecc.MEDIUM,m.Ecc.QUARTILE,m.Ecc.HIGH];v<M.length;v++){var k=M[v];N&&R<=m.getNumDataCodewords(B,k)*8&&(_=k)}for(var V=[],te=0,ne=w;te<ne.length;te++){var U=ne[te];i(U.mode.modeBits,4,V),i(U.numChars,U.mode.numCharCountBits(B),V);for(var ie=0,z=U.getData();ie<z.length;ie++){var oe=z[ie];V.push(oe)}}f(V.length==R);var G=m.getNumDataCodewords(B,_)*8;f(V.length<=G),i(0,Math.min(4,G-V.length),V),i(0,(8-V.length%8)%8,V),f(V.length%8==0);for(var W=236;V.length<G;W^=253)i(W,8,V);for(var Z=[];Z.length*8<V.length;)Z.push(0);return V.forEach(function(X,S){return Z[S>>>3]|=X<<7-(S&7)}),new m(B,_,Z,y)},m.prototype.getModule=function(w,_){return 0<=w&&w<this.size&&0<=_&&_<this.size&&this.modules[_][w]},m.prototype.getModules=function(){return this.modules},m.prototype.drawFunctionPatterns=function(){for(var w=0;w<this.size;w++)this.setFunctionModule(6,w,w%2==0),this.setFunctionModule(w,6,w%2==0);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);for(var _=this.getAlignmentPatternPositions(),p=_.length,w=0;w<p;w++)for(var C=0;C<p;C++)w==0&&C==0||w==0&&C==p-1||w==p-1&&C==0||this.drawAlignmentPattern(_[w],_[C]);this.drawFormatBits(0),this.drawVersion()},m.prototype.drawFormatBits=function(w){for(var _=this.errorCorrectionLevel.formatBits<<3|w,p=_,C=0;C<10;C++)p=p<<1^(p>>>9)*1335;var y=(_<<10|p)^21522;f(y>>>15==0);for(var C=0;C<=5;C++)this.setFunctionModule(8,C,u(y,C));this.setFunctionModule(8,7,u(y,6)),this.setFunctionModule(8,8,u(y,7)),this.setFunctionModule(7,8,u(y,8));for(var C=9;C<15;C++)this.setFunctionModule(14-C,8,u(y,C));for(var C=0;C<8;C++)this.setFunctionModule(this.size-1-C,8,u(y,C));for(var C=8;C<15;C++)this.setFunctionModule(8,this.size-15+C,u(y,C));this.setFunctionModule(8,this.size-8,!0)},m.prototype.drawVersion=function(){if(!(this.version<7)){for(var w=this.version,_=0;_<12;_++)w=w<<1^(w>>>11)*7973;var p=this.version<<12|w;f(p>>>18==0);for(var _=0;_<18;_++){var C=u(p,_),y=this.size-11+_%3,N=Math.floor(_/3);this.setFunctionModule(y,N,C),this.setFunctionModule(N,y,C)}}},m.prototype.drawFinderPattern=function(w,_){for(var p=-4;p<=4;p++)for(var C=-4;C<=4;C++){var y=Math.max(Math.abs(C),Math.abs(p)),N=w+C,B=_+p;0<=N&&N<this.size&&0<=B&&B<this.size&&this.setFunctionModule(N,B,y!=2&&y!=4)}},m.prototype.drawAlignmentPattern=function(w,_){for(var p=-2;p<=2;p++)for(var C=-2;C<=2;C++)this.setFunctionModule(w+C,_+p,Math.max(Math.abs(C),Math.abs(p))!=1)},m.prototype.setFunctionModule=function(w,_,p){this.modules[_][w]=p,this.isFunction[_][w]=!0},m.prototype.addEccAndInterleave=function(w){var _=this.version,p=this.errorCorrectionLevel;if(w.length!=m.getNumDataCodewords(_,p))throw new RangeError("Invalid argument");for(var C=m.NUM_ERROR_CORRECTION_BLOCKS[p.ordinal][_],y=m.ECC_CODEWORDS_PER_BLOCK[p.ordinal][_],N=Math.floor(m.getNumRawDataModules(_)/8),B=C-N%C,R=Math.floor(N/C),P=[],D=m.reedSolomonComputeDivisor(y),v=0,M=0;v<C;v++){var k=w.slice(M,M+R-y+(v<B?0:1));M+=k.length;var V=m.reedSolomonComputeRemainder(k,D);v<B&&k.push(0),P.push(k.concat(V))}for(var te=[],ne=function(U){P.forEach(function(ie,z){(U!=R-y||z>=B)&&te.push(ie[U])})},v=0;v<P[0].length;v++)ne(v);return f(te.length==N),te},m.prototype.drawCodewords=function(w){if(w.length!=Math.floor(m.getNumRawDataModules(this.version)/8))throw new RangeError("Invalid argument");for(var _=0,p=this.size-1;p>=1;p-=2){p==6&&(p=5);for(var C=0;C<this.size;C++)for(var y=0;y<2;y++){var N=p-y,B=(p+1&2)==0,R=B?this.size-1-C:C;!this.isFunction[R][N]&&_<w.length*8&&(this.modules[R][N]=u(w[_>>>3],7-(_&7)),_++)}}f(_==w.length*8)},m.prototype.applyMask=function(w){if(w<0||w>7)throw new RangeError("Mask value out of range");for(var _=0;_<this.size;_++)for(var p=0;p<this.size;p++){var C=void 0;switch(w){case 0:C=(p+_)%2==0;break;case 1:C=_%2==0;break;case 2:C=p%3==0;break;case 3:C=(p+_)%3==0;break;case 4:C=(Math.floor(p/3)+Math.floor(_/2))%2==0;break;case 5:C=p*_%2+p*_%3==0;break;case 6:C=(p*_%2+p*_%3)%2==0;break;case 7:C=((p+_)%2+p*_%3)%2==0;break;default:throw new Error("Unreachable")}!this.isFunction[_][p]&&C&&(this.modules[_][p]=!this.modules[_][p])}},m.prototype.getPenaltyScore=function(){for(var w=0,_=0;_<this.size;_++){for(var p=!1,C=0,y=[0,0,0,0,0,0,0],N=0;N<this.size;N++)this.modules[_][N]==p?(C++,C==5?w+=m.PENALTY_N1:C>5&&w++):(this.finderPenaltyAddHistory(C,y),p||(w+=this.finderPenaltyCountPatterns(y)*m.PENALTY_N3),p=this.modules[_][N],C=1);w+=this.finderPenaltyTerminateAndCount(p,C,y)*m.PENALTY_N3}for(var N=0;N<this.size;N++){for(var p=!1,B=0,y=[0,0,0,0,0,0,0],_=0;_<this.size;_++)this.modules[_][N]==p?(B++,B==5?w+=m.PENALTY_N1:B>5&&w++):(this.finderPenaltyAddHistory(B,y),p||(w+=this.finderPenaltyCountPatterns(y)*m.PENALTY_N3),p=this.modules[_][N],B=1);w+=this.finderPenaltyTerminateAndCount(p,B,y)*m.PENALTY_N3}for(var _=0;_<this.size-1;_++)for(var N=0;N<this.size-1;N++){var R=this.modules[_][N];R==this.modules[_][N+1]&&R==this.modules[_+1][N]&&R==this.modules[_+1][N+1]&&(w+=m.PENALTY_N2)}for(var P=0,D=0,v=this.modules;D<v.length;D++){var M=v[D];P=M.reduce(function(te,ne){return te+(ne?1:0)},P)}var k=this.size*this.size,V=Math.ceil(Math.abs(P*20-k*10)/k)-1;return f(0<=V&&V<=9),w+=V*m.PENALTY_N4,f(0<=w&&w<=2568888),w},m.prototype.getAlignmentPatternPositions=function(){if(this.version==1)return[];for(var w=Math.floor(this.version/7)+2,_=Math.floor((this.version*8+w*3+5)/(w*4-4))*2,p=[6],C=this.size-7;p.length<w;C-=_)p.splice(1,0,C);return p},m.getNumRawDataModules=function(w){if(w<m.MIN_VERSION||w>m.MAX_VERSION)throw new RangeError("Version number out of range");var _=(16*w+128)*w+64;if(w>=2){var p=Math.floor(w/7)+2;_-=(25*p-10)*p-55,w>=7&&(_-=36)}return f(208<=_&&_<=29648),_},m.getNumDataCodewords=function(w,_){return Math.floor(m.getNumRawDataModules(w)/8)-m.ECC_CODEWORDS_PER_BLOCK[_.ordinal][w]*m.NUM_ERROR_CORRECTION_BLOCKS[_.ordinal][w]},m.reedSolomonComputeDivisor=function(w){if(w<1||w>255)throw new RangeError("Degree out of range");for(var _=[],p=0;p<w-1;p++)_.push(0);_.push(1);for(var C=1,p=0;p<w;p++){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(w,_){for(var p=_.map(function(R){return 0}),C=function(R){var P=R^p.shift();p.push(0),_.forEach(function(D,v){return p[v]^=m.reedSolomonMultiply(D,P)})},y=0,N=w;y<N.length;y++){var B=N[y];C(B)}return p},m.reedSolomonMultiply=function(w,_){if(w>>>8||_>>>8)throw new RangeError("Byte out of range");for(var p=0,C=7;C>=0;C--)p=p<<1^(p>>>7)*285,p^=(_>>>C&1)*w;return f(p>>>8==0),p},m.prototype.finderPenaltyCountPatterns=function(w){var _=w[1];f(_<=this.size*3);var p=_>0&&w[2]==_&&w[3]==_*3&&w[4]==_&&w[5]==_;return(p&&w[0]>=_*4&&w[6]>=_?1:0)+(p&&w[6]>=_*4&&w[0]>=_?1:0)},m.prototype.finderPenaltyTerminateAndCount=function(w,_,p){return w&&(this.finderPenaltyAddHistory(_,p),_=0),_+=this.size,this.finderPenaltyAddHistory(_,p),this.finderPenaltyCountPatterns(p)},m.prototype.finderPenaltyAddHistory=function(w,_){_[0]==0&&(w+=this.size),_.pop(),_.unshift(w)},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}();o.QrCode=a;function i(m,w,_){if(w<0||w>31||m>>>w)throw new RangeError("Value out of range");for(var p=w-1;p>=0;p--)_.push(m>>>p&1)}function u(m,w){return(m>>>w&1)!=0}function f(m){if(!m)throw new Error("Assertion error")}var h=function(){function m(w,_,p){if(this.mode=w,this.numChars=_,this.bitData=p,_<0)throw new RangeError("Invalid argument");this.bitData=p.slice()}return m.makeBytes=function(w){for(var _=[],p=0,C=w;p<C.length;p++){var y=C[p];i(y,8,_)}return new m(m.Mode.BYTE,w.length,_)},m.makeNumeric=function(w){if(!m.isNumeric(w))throw new RangeError("String contains non-numeric characters");for(var _=[],p=0;p<w.length;){var C=Math.min(w.length-p,3);i(parseInt(w.substring(p,p+C),10),C*3+1,_),p+=C}return new m(m.Mode.NUMERIC,w.length,_)},m.makeAlphanumeric=function(w){if(!m.isAlphanumeric(w))throw new RangeError("String contains unencodable characters in alphanumeric mode");var _=[],p;for(p=0;p+2<=w.length;p+=2){var C=m.ALPHANUMERIC_CHARSET.indexOf(w.charAt(p))*45;C+=m.ALPHANUMERIC_CHARSET.indexOf(w.charAt(p+1)),i(C,11,_)}return p<w.length&&i(m.ALPHANUMERIC_CHARSET.indexOf(w.charAt(p)),6,_),new m(m.Mode.ALPHANUMERIC,w.length,_)},m.makeSegments=function(w){return w==""?[]:m.isNumeric(w)?[m.makeNumeric(w)]:m.isAlphanumeric(w)?[m.makeAlphanumeric(w)]:[m.makeBytes(m.toUtf8ByteArray(w))]},m.makeEci=function(w){var _=[];if(w<0)throw new RangeError("ECI assignment value out of range");if(w<128)i(w,8,_);else if(w<16384)i(2,2,_),i(w,14,_);else if(w<1e6)i(6,3,_),i(w,21,_);else throw new RangeError("ECI assignment value out of range");return new m(m.Mode.ECI,0,_)},m.isNumeric=function(w){return m.NUMERIC_REGEX.test(w)},m.isAlphanumeric=function(w){return m.ALPHANUMERIC_REGEX.test(w)},m.prototype.getData=function(){return this.bitData.slice()},m.getTotalBits=function(w,_){for(var p=0,C=0,y=w;C<y.length;C++){var N=y[C],B=N.mode.numCharCountBits(_);if(N.numChars>=1<<B)return 1/0;p+=4+B+N.bitData.length}return p},m.toUtf8ByteArray=function(w){w=encodeURI(w);for(var _=[],p=0;p<w.length;p++)w.charAt(p)!="%"?_.push(w.charCodeAt(p)):(_.push(parseInt(w.substring(p+1,p+3),16)),p+=2);return _},m.NUMERIC_REGEX=/^[0-9]*$/,m.ALPHANUMERIC_REGEX=/^[A-Z0-9 $%*+.\/:-]*$/,m.ALPHANUMERIC_CHARSET="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:",m}();o.QrSegment=h})(Jn||(Jn={})),function(o){(function(a){var i=function(){function u(f,h){this.ordinal=f,this.formatBits=h}return u.LOW=new u(0,1),u.MEDIUM=new u(1,0),u.QUARTILE=new u(2,3),u.HIGH=new u(3,2),u}();a.Ecc=i})(o.QrCode||(o.QrCode={}))}(Jn||(Jn={})),function(o){(function(a){var i=function(){function u(f,h){this.modeBits=f,this.numBitsCharCount=h}return u.prototype.numCharCountBits=function(f){return this.numBitsCharCount[Math.floor((f+7)/17)]},u.NUMERIC=new u(1,[10,12,14]),u.ALPHANUMERIC=new u(2,[9,11,13]),u.BYTE=new u(4,[8,16,16]),u.KANJI=new u(8,[8,10,12]),u.ECI=new u(7,[0,0,0]),u}();a.Mode=i})(o.QrSegment||(o.QrSegment={}))}(Jn||(Jn={}));var pr=Jn,uo="L",fo={L:pr.QrCode.Ecc.LOW,M:pr.QrCode.Ecc.MEDIUM,Q:pr.QrCode.Ecc.QUARTILE,H:pr.QrCode.Ecc.HIGH},ud=function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0}();function ho(o){return o in fo}function oa(o,a){a===void 0&&(a=0);var i=[];return o.forEach(function(u,f){var h=null;u.forEach(function(m,w){if(!m&&h!==null){i.push("M".concat(h+a," ").concat(f+a,"h").concat(w-h,"v1H").concat(h+a,"z")),h=null;return}if(w===u.length-1){if(!m)return;h===null?i.push("M".concat(w+a,",").concat(f+a," h1v1H").concat(w+a,"z")):i.push("M".concat(h+a,",").concat(f+a," h").concat(w+1-h,"v1H").concat(h+a,"z"));return}m&&h===null&&(h=w)})}),i.join("")}function sa(o,a,i,u){var f=u.width,h=u.height,m=u.x,w=u.y,_=o.length+i*2,p=Math.floor(a*.1),C=_/a,y=(f||p)*C,N=(h||p)*C,B=m==null?o.length/2-y/2:m*C,R=w==null?o.length/2-N/2:w*C,P=null;if(u.excavate){var D=Math.floor(B),v=Math.floor(R),M=Math.ceil(y+B-D),k=Math.ceil(N+R-v);P={x:D,y:v,w:M,h:k}}return{x:B,y:R,h:N,w:y,excavation:P}}function aa(o,a){return o.slice().map(function(i,u){return u<a.y||u>=a.y+a.h?i:i.map(function(f,h){return h<a.x||h>=a.x+a.w?f:!1})})}var go={value:{type:String,required:!0,default:""},size:{type:Number,default:100},level:{type:String,default:uo,validator:function(o){return ho(o)}},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(o){return["linear","radial"].indexOf(o)>-1}},gradientStartColor:{type:String,required:!1,default:"#000"},gradientEndColor:{type:String,required:!1,default:"#fff"}},dd=Nn(Nn({},go),{renderAs:{type:String,required:!1,default:"canvas",validator:function(o){return["canvas","svg"].indexOf(o)>-1}}}),fd=l.defineComponent({name:"QRCodeSvg",props:go,setup:function(o){var a=l.ref(0),i=l.ref(""),u,f=function(){var m=o.value,w=o.level,_=o.margin,p=_>>>0,C=ho(w)?w:uo,y=pr.QrCode.encodeText(m,fo[C]).getModules();if(a.value=y.length+p*2,o.imageSettings.src){var N=sa(y,o.size,p,o.imageSettings);u={x:N.x+p,y:N.y+p,width:N.w,height:N.h},N.excavation&&(y=aa(y,N.excavation))}i.value=oa(y,p)},h=function(){if(!o.gradient)return null;var m=o.gradientType==="linear"?{x1:"0%",y1:"0%",x2:"100%",y2:"100%"}:{cx:"50%",cy:"50%",r:"50%",fx:"50%",fy:"50%"};return l.h(o.gradientType==="linear"?"linearGradient":"radialGradient",Nn({id:"qr-gradient"},m),[l.h("stop",{offset:"0%",style:{stopColor:o.gradientStartColor}}),l.h("stop",{offset:"100%",style:{stopColor:o.gradientEndColor}})])};return f(),l.onUpdated(f),function(){return l.h("svg",{width:o.size,height:o.size,"shape-rendering":"crispEdges",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 ".concat(a.value," ").concat(a.value)},[l.h("defs",{},[h()]),l.h("rect",{width:"100%",height:"100%",fill:o.background}),l.h("path",{fill:o.gradient?"url(#qr-gradient)":o.foreground,d:i.value}),o.imageSettings.src&&l.h("image",Nn({href:o.imageSettings.src},u))])}}}),hd=l.defineComponent({name:"QRCodeCanvas",props:go,setup:function(o,a){var i=l.ref(null),u=l.ref(null),f=function(){var m=o.value,w=o.level,_=o.size,p=o.margin,C=o.background,y=o.foreground,N=o.gradient,B=o.gradientType,R=o.gradientStartColor,P=o.gradientEndColor,D=p>>>0,v=ho(w)?w:uo,M=i.value;if(M){var k=M.getContext("2d");if(k){var V=pr.QrCode.encodeText(m,fo[v]).getModules(),te=V.length+D*2,ne=u.value,U={x:0,y:0,width:0,height:0},ie=o.imageSettings.src&&ne!=null&&ne.naturalWidth!==0&&ne.naturalHeight!==0;if(ie){var z=sa(V,o.size,D,o.imageSettings);U={x:z.x+D,y:z.y+D,width:z.w,height:z.h},z.excavation&&(V=aa(V,z.excavation))}var oe=window.devicePixelRatio||1,G=_/te*oe;if(M.height=M.width=_*oe,k.scale(G,G),k.fillStyle=C,k.fillRect(0,0,te,te),N){var W=void 0;B==="linear"?W=k.createLinearGradient(0,0,te,te):W=k.createRadialGradient(te/2,te/2,0,te/2,te/2,te/2),W.addColorStop(0,R),W.addColorStop(1,P),k.fillStyle=W}else k.fillStyle=y;ud?k.fill(new Path2D(oa(V,D))):V.forEach(function(Z,X){Z.forEach(function(S,$){S&&k.fillRect($+D,X+D,1,1)})}),ie&&k.drawImage(ne,U.x,U.y,U.width,U.height)}}};l.onMounted(f),l.onUpdated(f);var h=a.attrs.style;return function(){return l.h(l.Fragment,[l.h("canvas",Nn(Nn({},a.attrs),{ref:i,style:Nn(Nn({},h),{width:"".concat(o.size,"px"),height:"".concat(o.size,"px")})})),o.imageSettings.src&&l.h("img",{ref:u,src:o.imageSettings.src,style:{display:"none"},onLoad:f})])}}}),gd=l.defineComponent({name:"Qrcode",render:function(){var o=this.$props,a=o.renderAs,i=o.value,u=o.size,f=o.margin,h=o.level,m=o.background,w=o.foreground,_=o.imageSettings,p=o.gradient,C=o.gradientType,y=o.gradientStartColor,N=o.gradientEndColor;return l.h(a==="svg"?fd:hd,{value:i,size:u,margin:f,level:h,background:m,foreground:w,imageSettings:_,gradient:p,gradientType:C,gradientStartColor:y,gradientEndColor:N})},props:dd});const md={},pd={viewBox:"0 0 24 24","aria-hidden":"true"};function xd(o,a){return l.openBlock(),l.createElementBlock("svg",pd,[...a[0]||(a[0]=[l.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),l.createElementVNode("path",{d:"M9 7h6"},null,-1),l.createElementVNode("path",{d:"M10 18h4"},null,-1)])])}const wd=Ue(md,[["render",xd]]),_d={},Cd={viewBox:"0 0 24 24","aria-hidden":"true"};function Ed(o,a){return l.openBlock(),l.createElementBlock("svg",Cd,[...a[0]||(a[0]=[l.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 yd=Ue(_d,[["render",Ed]]),bd="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",Ad={class:"wrapper_qr_page"},Id=["src"],Sd={class:"modal_qr"},Nd={class:"modal_qr_content"},Td={class:"wrapper_icon_qr"},kd=["src"],Rd={class:"total_order_price"},Od={class:"ttl_wrapper"},Bd={class:"ttl_head"},Md={class:"ttl_bar"},vd={class:"hint hint-anim","aria-label":"Инструкция по оплате"},Dd={class:"steps","aria-hidden":"true"},Pd={class:"step is-active","data-i":"0"},Ld={class:"ico"},Fd={class:"step","data-i":"1"},Vd={class:"ico"},Ud={class:"step","data-i":"2"},Hd={class:"ico"},zd=["src"],Gd={class:"qr_border"},Wd=Ue(l.defineComponent({__name:"CompletedQRCode",setup(o){const a=It(),i=St(),u=ot(),f=Re.useRouter(),h={src:a.itemThemes.logo||"",width:60,height:60,excavate:!0},m=l.computed(()=>a.itemThemes.kiosk_qr_payment_timeout||60).value,w=l.ref(m);let _=0;const p=l.computed(()=>{const P=Math.floor(w.value/60),D=w.value%60;return`${P}:${D.toString().padStart(2,"0")}`}),C=l.computed(()=>w.value/m*100),y=l.computed(()=>i.paymentCostQR),N=()=>{w.value--,w.value<=0&&(clearInterval(_),B())},B=()=>{u.removeFromLocalStorage(["cart","authTokensAccess","authTokensRefresh","user"]),sessionStorage.removeItem("is_adult"),f.replace({name:"home"}).then(()=>f.go(0))};l.onMounted(()=>{_=setInterval(N,1e3)}),l.onBeforeUnmount(()=>{clearInterval(_)});const{mediaUrl:R}=Ln(()=>a.itemThemes.kiosk_preloader?"preloader":null);return(P,D)=>(l.openBlock(),l.createElementBlock("div",Ad,[(l.openBlock(),l.createElementBlock("video",{loop:"",autoplay:"",muted:"",playsinline:"",key:l.unref(R)},[l.createElementVNode("source",{src:l.unref(R)||"",type:"video/webm"},null,8,Id)])),D[7]||(D[7]=l.createElementVNode("div",{class:"start_img_black"},null,-1)),l.createElementVNode("div",Sd,[l.createElementVNode("div",Nd,[l.createElementVNode("div",Td,[l.createElementVNode("img",{src:l.unref(ia),width:"100",height:"100"},null,8,kd)]),D[6]||(D[6]=l.createElementVNode("h1",null,"Оплата по QR",-1)),l.createElementVNode("p",Rd,[l.createVNode(Xt,{price:y.value,fixedFloat:2},null,8,["price"]),l.createTextVNode(" "+l.toDisplayString(l.unref(u).config_lib.currency_symbol),1)]),l.createElementVNode("div",Od,[l.createElementVNode("div",Bd,[D[0]||(D[0]=l.createElementVNode("span",null,"Срок жизни QR-кода",-1)),l.createElementVNode("b",null,l.toDisplayString(p.value),1)]),l.createElementVNode("div",Md,[l.createElementVNode("div",{class:"ttl_fill",style:l.normalizeStyle({width:`${C.value}%`})},null,4)])]),l.createElementVNode("p",vd,[l.createElementVNode("div",Dd,[l.createElementVNode("div",Pd,[l.createElementVNode("div",Ld,[l.createVNode(wd)]),D[1]||(D[1]=l.createElementVNode("div",{class:"txt"},"Возьмите телефон →",-1))]),D[4]||(D[4]=l.createElementVNode("div",{class:"sep"},null,-1)),l.createElementVNode("div",Fd,[l.createElementVNode("div",Vd,[l.createVNode(yd)]),D[2]||(D[2]=l.createElementVNode("span",{class:"txt"},"Отсканируйте QR-код",-1))]),D[5]||(D[5]=l.createElementVNode("span",{class:"sep"},"→",-1)),l.createElementVNode("div",Ud,[l.createElementVNode("div",Hd,[l.createElementVNode("img",{src:l.unref(bd),width:"30",height:"30"},null,8,zd)]),D[3]||(D[3]=l.createElementVNode("span",{class:"txt"},"Оплатите заказ",-1))])])]),l.createElementVNode("div",Gd,[l.createVNode(gd,{value:l.unref(i).linkQR,size:200,level:"Q","render-as":"svg","image-settings":h},null,8,["value"])]),l.createVNode(un,{textButtonDefault:"Отменить заказ",onClick:B,class:"cancel_order_btn"})])])]))}}),[["__scopeId","data-v-bd3b4b16"]]),Xd={key:0,class:"wrapper_qr"},jd={key:1,class:"wrapper_qr"},Zd={key:2,class:"wrapper_qr"},qd={key:3,class:"wrapper_qr"},Yd=Ue(l.defineComponent({__name:"CartCompletedOrder",props:{orderNumber:{}},setup(o){const a=St(),i=It(),{orderNumber:u,orderCompleted_lib:f}=xe.storeToRefs(a),{mediaUrl:h}=Ln(()=>i.itemThemes.kiosk_preloader?"preloader":null);return(m,w)=>(l.openBlock(),l.createElementBlock(l.Fragment,null,[l.unref(f)&&l.unref(f)===1?(l.openBlock(),l.createElementBlock("section",Xd,[l.createVNode(od)])):l.unref(f)&&l.unref(f)===2?(l.openBlock(),l.createElementBlock("section",jd,[l.createVNode(cd)])):l.createCommentVNode("",!0),l.unref(f)&&l.unref(f)===3?(l.openBlock(),l.createElementBlock("section",Zd,[l.createVNode(nd,{orderNumber:l.unref(u),mediaUrl:l.unref(h)},null,8,["orderNumber","mediaUrl"])])):l.createCommentVNode("",!0),l.unref(f)&&l.unref(f)===4?(l.openBlock(),l.createElementBlock("section",qd,[l.createVNode(Wd)])):l.createCommentVNode("",!0)],64))}}),[["__scopeId","data-v-3779e8ee"]]),$d={},Kd={class:"cart_loyal_qr",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none"};function Qd(o,a){return l.openBlock(),l.createElementBlock("svg",Kd,[...a[0]||(a[0]=[l.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 Jd=Ue($d,[["render",Qd]]),la=o=>{const a=co(),i=w=>a.open(o,w),u=()=>a.close(o),f=a.state(o),h=l.computed({get:()=>f.value.visible,set:w=>w&&i()||u()}),m=l.computed(()=>f.value.context);return{visible:h,context:m,open:i,close:u}},ef={class:"cart_deletion_modal_content"},tf={class:"cart_deletion_modal_title"},nf={class:"cart_deletion_modal_footer"},rf=Ue(l.defineComponent({__name:"CartDeleteConfirm",emits:["confirm"],setup(o,{emit:a}){const i=a,{visible:u,context:f,close:h}=la("cart-delete-confirm"),m=()=>{i("confirm",f.value.idSystem),h()};return(w,_)=>(l.openBlock(),l.createBlock(l.Transition,{name:"fade"},{default:l.withCtx(()=>[l.unref(u)?(l.openBlock(),l.createElementBlock("div",{key:0,class:"cart_deletion_modal_overlay",onClick:_[1]||(_[1]=l.withModifiers((...p)=>l.unref(h)&&l.unref(h)(...p),["self"]))},[l.createElementVNode("div",ef,[l.createElementVNode("div",tf,"Удалить "+l.toDisplayString(l.unref(f).name)+"?",1),_[2]||(_[2]=l.createElementVNode("div",{class:"cart_deletion_modal_body"},"Эта позиция будет полностью удалена из заказа.",-1)),l.createElementVNode("div",nf,[l.createElementVNode("button",{class:"primary",onClick:m}," Удалить "),l.createElementVNode("button",{onClick:_[0]||(_[0]=(...p)=>l.unref(h)&&l.unref(h)(...p))},"Отмена")])])])):l.createCommentVNode("",!0)]),_:1}))}}),[["__scopeId","data-v-018f66f3"]]),of={class:"cart_wrapper"},sf={class:"cart_header_content"},af={key:0,class:"cart_header_subwrapper"},lf={class:"cart_kso_button_wrapper"},cf={key:0},uf={key:0,class:"kso_btn_wrapper"},df=["src"],ff={key:0,class:"cart_qr_button_wrapper"},hf={class:"cart_header_info"},gf={class:"cart_header_info"},mf={class:"cart_header_info"},pf={class:"cart_header_info"},xf={key:1,class:"cart-tabs-wrapper"},wf={class:"cart-tabs-container"},_f=["data-active","onClick"],Cf={key:0,class:"wrapper_comment"},Ef={class:"wrapper_limit_in_area"},yf=["placeholder","aria-invalid"],bf={class:"limit_comment"},Af={key:1,class:"wrapper_comment"},If={class:"wrapper_limit_in_area"},Sf=["placeholder","aria-invalid"],Nf={class:"limit_comment"},Tf={key:2},kf={class:"cart_cards"},Rf={class:"cart_footer_wrapper"},Of={key:0,class:"footer_title"},Bf=["disabled","max"],Mf={key:1,class:"footer_sales"},vf=["max"],Df={class:"list_price"},Pf={key:0},Lf={key:1},Ff={key:2},Vf={class:"accept_field"},Uf={class:"accept_field"},Hf={key:3},zf={class:"accept_field"},Gf={class:"accept_field"},Wf={class:"accept_field"},Xf={key:3,class:"cart_min_order_notice"},jf={class:"wrapper_footer_cart_btn"},Zf=l.defineComponent({__name:"CartPage",props:{configPage:{},textPaymentBtn:{},config_qr:{type:Boolean}},setup(o){const a=En.create();let i;const u=ot(),f=St(),h=It(),m=o,{totalPrice_lib:w,countBonus:_,config_lib:p,cartProducts_lib:C,profile:y}=xe.storeToRefs(u),{itemThemes:N}=xe.storeToRefs(h),{textPaymentBtn_lib:B,isButtonDisabled:R,orderCompleted_lib:P,orderNumber:D,extraDiscount:v,is_notification_lib:M,discountBtn:k,is_paymentCart:V,providerTypes:te,notificationData_lib:ne,selectedProvider:U,configPayment:ie}=xe.storeToRefs(f),z=Re.useRouter(),oe=Re.useRoute(),G=l.useTemplateRef("stickerLoyality"),W=l.ref(!1),Z=l.ref(!1),X=l.useTemplateRef("commentEl"),S=l.ref(""),$=l.ref(!1),H=l.ref(!1),ee=l.ref(!1),j=l.ref(0),re=l.ref(0),ge=l.ref(),we=l.computed(()=>m.configPage.qr_menu?"YOOKASSA_BASE":te.value[0].front_type),Ne=l.computed(()=>m.configPage.qr_menu?"YOOKASSA":te.value[0].type),{width:_e}=Wt.useElementSize(G,{width:0,height:0},{box:"border-box"}),Me=l.computed(()=>{const be={energy_amount:0,proteins_amount:0,fat_amount:0,carbohydrates_amount:0};return C.value.reduce((le,Qe)=>(le.energy_amount+=(Qe.energy_amount||0)*(Qe.amount||0),le.proteins_amount+=(Qe.proteins_amount||0)*(Qe.amount||0),le.fat_amount+=(Qe.fat_amount||0)*(Qe.amount||0),le.carbohydrates_amount+=(Qe.carbohydrates_amount||0)*(Qe.amount||0),le),be)}),fe=l.computed(()=>{var be;if((be=N.value)!=null&&be.comments){const le=N.value.comments;return{fieldName:m.configPage.kiosk_menu?le.kiosk_comment_field_name:le.qr_comment_field_name,placeholder:m.configPage.kiosk_menu?le.kiosk_comment_field_placeholder:le.qr_comment_field_placeholder,show:m.configPage.kiosk_menu?le.kiosk_show_order_comment:le.qr_show_order_comment}}}),dt=Wt.computedAsync(async be=>{var Ke;const le=new AbortController;if(be(()=>le.abort()),!W.value||!((Ke=y.value)!=null&&Ke.balance))return 0;const Qe=await a.maxPayByBonuses(w.value,m.configPage.kiosk_menu,!!m.configPage.userData||!!y.value,le.signal);return Qe!=null&&Qe.by_bonuses?y.value.balance>Qe.by_bonuses?Qe.by_bonuses:y.value.balance:0},0,{shallow:!0}),Xe=()=>z.push(`/${oe.params.orgId}/`),Oe=be=>{["a","A","+","-",".",","].includes(be.key)&&be.preventDefault()},Ze=be=>{u.deleteItemFromCart(be),C.value.length===0&&(H.value=!1,ee.value=!1)},me=()=>{H.value=!H.value,S.value.length},qe=l.computed(()=>{var le;return(((le=N.value.cart_loyalty_button)==null?void 0:le.cart_loyalty_button_text)||"Программа лояльности").replace(/\S+/g,Qe=>Qe.length>15?Qe.slice(0,15)+"...":Qe)}),Ee=()=>{ee.value=!ee.value,S.value.length},mt=()=>{let be=Math.floor(_.value)||0;be>dt.value&&(be=dt.value),be!==_.value&&u.setBonus(be)};l.watchEffect(()=>{mt(),u.setBonus(w.value===0?0:Math.floor(_.value))});const nt=()=>C.value.map(be=>({id:be.id,front_item_id:be.idSystem,is_fake:!!be.is_fake,is_od_united_product:!!be.is_od_united_product,removals:be.removals??null,amount:be.amount,size:be.size,modifiers:be.modifiers??[],group_modifiers:be.group_modifiers??[]})),{makeCreateOrderRequest:jt}=ra(),st=l.computed(()=>nt()),He=l.computed(()=>{var be,le,Qe,Ke;return m.configPage.qr_menu&&((le=(be=N.value)==null?void 0:be.comments)==null?void 0:le.qr_is_order_comment_required)||m.configPage.kiosk_menu&&((Ke=(Qe=N.value)==null?void 0:Qe.comments)==null?void 0:Ke.kiosk_is_order_comment_required)}),ze=()=>{var be,le;return He.value&&((le=(be=S.value)==null?void 0:be.trim())==null?void 0:le.length)<1&&X.value?(f.showNotification("Обязательно перед созданием заказа укажите комментарий к заказу"),X.value.focus(),$.value=!0,At.animate(X.value.parentElement,{x:[0,-10,0,10,0]},{duration:.1,repeat:2}),!0):!1},_r=async()=>{if(!y.value&&m.configPage.qr_menu){z.push(`/${oe.params.orgId}/register`);return}if(!(He.value&&ze())){if(m.configPage.qr_menu||te.value.length<=1){p.value.has_rms_discount&&!N.value.hide_discounts_calculate_button&&ge!=null?(R.value=!0,await Lr(ge.value,Ne.value).then(be=>{const le=ie.value;le&&(le.is_tableservice?Ws(le,null):be.url&&m.configPage.qr_menu&&window.location.replace(be.url))})):(U.value={front_type:we},await jt(m.configPage,{paymentMethodId:we.value,items:st.value,tableDataId:m.configPage.tableDataId,comment:S.value,isAuthorized:!!m.configPage.userData||!!y,signal:i==null?void 0:i.signal}));return}return V.value=!V.value}},ye=()=>{V.value=!1},Cr=async()=>{var Qe,Ke,de,ft,Ye,rt,Ve;if(p.value.has_rms_discount&&He.value&&ze())return;v.value=0,R.value=!0;const be={items:[...nt()],table:((Qe=m.configPage)==null?void 0:Qe.tableDataId)||null,combos:[]};(Ke=m.configPage)!=null&&Ke.kiosk_menu&&((de=f.selectedOrderType)!=null&&de.id)&&(be.order_type_id=(ft=f.selectedOrderType)==null?void 0:ft.id);const le=En.create();i=new AbortController;try{Z.value=!0;const Zt=await le.calculateDiscount(be,m.configPage.kiosk_menu,!!m.configPage.userData||!!y.value,i.signal);if(!C.value)return;if(C.value.forEach(Nt=>{const De=Zt.items.find(yt=>yt.front_item_id===Nt.idSystem);if(De&&(Nt.group_modifiers.forEach(yt=>{const Pt=De.group_modifiers.find(Lt=>Lt.group===yt.group);Pt&&yt.modifiers.forEach(Lt=>{const xt=Pt.modifiers.find(Vn=>Vn.id===Lt.id);if(xt&&Number(Lt.price)!==Number(xt==null?void 0:xt.new_price)){const Vn=(xt.discounts||[]).reduce((Bt,zn)=>Bt+=+zn.discount,0);j.value+=Vn,Lt.new_price=Lt.price,Lt.price=Number(xt==null?void 0:xt.new_price),Lt.total_new_price=Number(xt.total_new_price)}})}),Nt.modifiers.forEach(yt=>{const Pt=De.modifiers.find(Lt=>Lt.id===yt.id);if(Pt&&Number(yt.price)!==Number(Pt==null?void 0:Pt.new_price)){const Lt=(Pt.discounts||[]).reduce((xt,Vn)=>xt+=+Vn.discount,0);j.value+=Lt,yt.new_price=yt.price,yt.price=Number(Pt==null?void 0:Pt.new_price),yt.total_new_price=Number(Pt.total_new_price)}}),Nt.price!==Number(De.new_price))){const yt=(De.discounts||[]).reduce((Pt,Lt)=>Pt+=+Lt.discount,0);j.value=j.value+yt,Nt.new_price=Nt.price,Nt.price=De.new_price,Nt.discounts=De.discounts,Nt.total_new_price=Number(De.total_new_price)}}),C.value=[...C.value],j.value!==0&&(w.value=Zt.total_cart_price),p.value.has_rms_discount){U.value={front_type:we};const Nt=await jt(m.configPage,{paymentMethodId:we.value,items:st.value,tableDataId:m.configPage.tableDataId,comment:S.value,isAuthorized:!!m.configPage.userData||!!y,signal:i==null?void 0:i.signal});ge.value=(Ye=Nt==null?void 0:Nt.data)==null?void 0:Ye.id}else R.value=!1;k.value=!1}catch(Zt){et.isCancel(Zt)||f.showNotification(((Ve=(rt=Zt==null?void 0:Zt.response)==null?void 0:rt.data)==null?void 0:Ve.user_friendly_message)||"Скидки временно недоступны"),k.value=!0,Z.value=!1,R.value=!1}},Ei=()=>{var be;(be=y.value)!=null&&be.balance?y.value.balance>=1&&(W.value=!W.value):f.showNotification("У Вас пока нет бонусов")},bn=()=>{var be,le;if(N.value.hide_discounts_calculate_button){k.value=!1;return}p.value.has_rms_discount&&(m.configPage.kiosk_menu||m.configPage.qr_menu&&y.value)?(ge.value=null,k.value=!0):((be=p.value)==null?void 0:be.loyalty)==="IIKO"&&(p.value.has_loyalty_default_user||y.value)&&m.configPage.kiosk_menu||((le=p.value)==null?void 0:le.loyalty)==="IIKO"&&m.configPage.qr_menu&&y.value?k.value=!0:k.value=!1};l.onMounted(async()=>{B.value=m.textPaymentBtn,u.loadCart(),P.value=null,w.value=null,v.value=0,C.value.splice(0,C.value.length,...C.value.map(u.makeProductFullyReactive))}),l.onUnmounted(()=>{ge.value=null,P.value=null,w.value=null,v.value=0,C.value.splice(0,C.value.length,...C.value.map(u.makeProductFullyReactive))});const nr=l.computed(()=>w.value-v.value-j.value),Dt=l.computed(()=>m.configPage.qr_menu?p.value.qr_order_minimum_price||0:m.configPage.kiosk_menu&&p.value.kiosk_order_minimum_price||0),yi=l.computed(()=>Dt.value>nr.value||Z.value||R.value?!0:["АВТОРИЗОВАТЬСЯ ДЛЯ ЗАКАЗА"].includes(B.value.toUpperCase())?!1:C.value.length===0||w.value===0?!0:(P.value=null,R.value)),dn=l.computed(()=>{var be;return((be=C.value)==null?void 0:be.reduce((le,Qe)=>le+Qe.amount,0))||0}),Ot=l.computed(()=>{var be;return(be=y.value)==null?void 0:be.phone});return l.watch(S,be=>{var le;return((le=be==null?void 0:be.trim())==null?void 0:le.length)&&($.value=!1)}),l.watch([dn,Ot],()=>{dn.value===0&&(i=null),i==null||i.abort(),R.value=!1}),l.watch([()=>u.cartProducts_lib,Ot,dn,()=>f.selectedOrderType],be=>{if(re.value>0){re.value--;return}be&&!Z.value&&(bn(),C.value.splice(0,C.value.length,...C.value.map(u.makeProductFullyReactive)),j.value=0,w.value=null,v.value=0,re.value=1),Z.value=!1},{deep:!0}),(be,le)=>{var Qe,Ke,de,ft,Ye,rt;return l.openBlock(),l.createElementBlock(l.Fragment,null,[l.createElementVNode("div",of,[l.createVNode(rf,{onConfirm:Ze}),l.createVNode(ea,{visible:l.unref(f).isDrawerOpen,"onUpdate:visible":le[0]||(le[0]=Ve=>l.unref(f).isDrawerOpen=Ve)},{default:l.withCtx(()=>[l.createVNode(na)]),_:1},8,["visible"]),l.createElementVNode("header",sf,[m.configPage.kiosk_menu?(l.openBlock(),l.createElementBlock("div",af,[l.createElementVNode("div",lf,[l.createElementVNode("div",{class:l.normalizeClass(["arrow_wrapper",{arrow_wrapper_kso:m.configPage.kiosk_menu}]),onClick:Xe},[l.createVNode(Fr,{class:"cart_header_back_button"}),m.configPage.kiosk_menu?(l.openBlock(),l.createElementBlock("span",cf,"Назад")):l.createCommentVNode("",!0)],2)]),fe.value&&fe.value.show?(l.openBlock(),l.createElementBlock("div",uf,[He.value?l.createCommentVNode("",!0):(l.openBlock(),l.createBlock(un,{key:0,style:l.normalizeStyle({visibility:!H.value&&l.unref(C).length>0?"visible":"hidden"}),class:l.normalizeClass({button_kso_comment:o.configPage.kiosk_menu}),textButtonDefault:S.value.length>0?"Редактировать":fe.value&&fe.value.fieldName||"",onClick:()=>H.value=!H.value,id:"button_kso_comment"},null,8,["style","class","textButtonDefault","onClick"]))])):l.createCommentVNode("",!0),l.createElementVNode("div",{class:l.normalizeClass({cart_header_wrapper:m.configPage.kiosk_menu})},[(l.unref(N).kiosk_show_loyalty_card_button||l.unref(N).kiosk_show_loyalty_phone_input_button)&&!m.config_qr?(l.openBlock(),l.createElementBlock("button",{key:0,class:"buttonDefaultWrapper button_payment_cart button_payment_cart_loyal",style:l.normalizeStyle({marginRight:(Qe=l.unref(N).cart_loyalty_button)!=null&&Qe.cart_loyalty_button_sticker?`${Math.ceil(l.unref(_e)/2+10)}px`:"",paddingRight:(Ke=l.unref(N).cart_loyalty_button)!=null&&Ke.cart_loyalty_button_sticker?0:""}),onClick:le[1]||(le[1]=(...Ve)=>l.unref(f).openDrawer&&l.unref(f).openDrawer(...Ve))},[l.createElementVNode("p",{class:"cart_loyal_program",style:l.normalizeStyle({marginRight:`${Math.ceil(l.unref(_e)/2)}px`})},l.toDisplayString(qe.value),5),(de=l.unref(N).cart_loyalty_button)!=null&&de.cart_loyalty_button_sticker?(l.openBlock(),l.createElementBlock("div",{key:0,ref_key:"stickerLoyality",ref:G,class:"cart_loyal_program_icon",style:l.normalizeStyle({"--sticker-mask":`url(${l.unref(N).cart_loyalty_button.cart_loyalty_button_sticker})`})},[l.createElementVNode("img",{src:l.unref(N).cart_loyalty_button.cart_loyalty_button_sticker},null,8,df)],4)):(l.openBlock(),l.createBlock(Jd,{key:1,class:"cart_loyal_qr"}))],4)):l.createCommentVNode("",!0)],2)])):l.createCommentVNode("",!0),l.createElementVNode("div",{class:l.normalizeClass([o.config_qr?"cart_kbju_qr_wrapper":"cart_kbju_kso_wrapper"])},[o.config_qr?(l.openBlock(),l.createElementBlock("div",ff,[l.createElementVNode("div",{class:"arrow_wrapper",onClick:Xe},[l.createVNode(Fr,{class:"cart_header_back_button"})])])):l.createCommentVNode("",!0),l.unref(N).show_nutrition_in_cart?(l.openBlock(),l.createElementBlock("div",{key:1,class:"cart_header",style:l.normalizeStyle({paddingTop:m.config_qr?0:"10px",paddingRight:m.config_qr?"10px":0})},[l.createElementVNode("div",hf,[l.createElementVNode("p",null,[l.createVNode(Xt,{price:Me.value.energy_amount,duration:800},null,8,["price"]),le[8]||(le[8]=l.createTextVNode(" г",-1))]),le[9]||(le[9]=l.createElementVNode("p",{class:"cart_info_name"},"Килокалории",-1))]),l.createElementVNode("div",gf,[l.createElementVNode("p",null,[l.createVNode(Xt,{price:Me.value.proteins_amount,duration:900},null,8,["price"]),le[10]||(le[10]=l.createTextVNode(" г",-1))]),le[11]||(le[11]=l.createElementVNode("p",{class:"cart_info_name"},"Белки",-1))]),l.createElementVNode("div",mf,[l.createElementVNode("p",null,[l.createVNode(Xt,{price:Me.value.fat_amount,duration:1e3},null,8,["price"]),le[12]||(le[12]=l.createTextVNode(" г",-1))]),le[13]||(le[13]=l.createElementVNode("p",{class:"cart_info_name"},"Жиры",-1))]),l.createElementVNode("div",pf,[l.createElementVNode("p",null,[l.createVNode(Xt,{price:Me.value.carbohydrates_amount,duration:1100},null,8,["price"]),le[14]||(le[14]=l.createTextVNode(" г",-1))]),le[15]||(le[15]=l.createElementVNode("p",{class:"cart_info_name"},"Углеводы",-1))])],4)):l.createCommentVNode("",!0)],2),o.configPage.kiosk_menu&&l.unref(f).orderTypes.length>1?(l.openBlock(),l.createElementBlock("div",xf,[l.createElementVNode("ul",wf,[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(f).orderTypes,Ve=>{var Zt,Nt;return l.openBlock(),l.createElementBlock("li",{key:Ve.id,class:"cart-tab","data-active":Ve.id===((Zt=l.unref(f).selectedOrderType)==null?void 0:Zt.id),onClick:De=>l.unref(f).selectedOrderType=Ve},[Ve.id===((Nt=l.unref(f).selectedOrderType)==null?void 0:Nt.id)?(l.openBlock(),l.createBlock(l.unref(At.motion).div,{key:0,class:"cart-underline","layout-id":"cart-underline",id:"cart-underline"})):l.createCommentVNode("",!0),l.createElementVNode("span",null,l.toDisplayString(Ve.name),1)],8,_f)}),128))])])):l.createCommentVNode("",!0)]),(He.value||H.value)&&o.configPage.kiosk_menu&&((ft=l.unref(C))!=null&&ft.length)?(l.openBlock(),l.createElementBlock("div",Cf,[l.createElementVNode("div",Ef,[l.withDirectives(l.createElementVNode("textarea",{ref_key:"commentEl",ref:X,class:"comment_order",placeholder:fe.value&&fe.value.placeholder||"Ваш комментарий к заказу...",name:"commentKso",maxlength:"50","aria-invalid":$.value,"onUpdate:modelValue":le[2]||(le[2]=Ve=>S.value=Ve)},null,8,yf),[[l.vModelText,S.value]]),l.createElementVNode("p",bf,l.toDisplayString(S.value.length+" / 50"),1)]),He.value?l.createCommentVNode("",!0):(l.openBlock(),l.createBlock(un,{key:0,textButtonDefault:"Сохранить",onClick:me,class:"button_bonus_cart"}))])):l.createCommentVNode("",!0),(He.value||ee.value)&&o.config_qr&&((Ye=l.unref(C))!=null&&Ye.length)?(l.openBlock(),l.createElementBlock("div",Af,[l.createElementVNode("div",If,[l.withDirectives(l.createElementVNode("textarea",{ref_key:"commentEl",ref:X,class:"comment_order",placeholder:fe.value&&fe.value.placeholder||"Ваш комментарий к заказу...",name:"commentQr",maxlength:"50","aria-invalid":$.value,"onUpdate:modelValue":le[3]||(le[3]=Ve=>S.value=Ve)},null,8,Sf),[[l.vModelText,S.value]]),l.createElementVNode("p",Nf,l.toDisplayString(S.value.length+" / 50"),1)]),He.value?l.createCommentVNode("",!0):(l.openBlock(),l.createBlock(un,{key:0,textButtonDefault:"Сохранить",onClick:Ee,class:"button_bonus_cart"}))])):l.createCommentVNode("",!0),o.config_qr&&fe.value&&fe.value.show?(l.openBlock(),l.createElementBlock("div",Tf,[!He.value&&!ee.value&&l.unref(C).length>0?(l.openBlock(),l.createBlock(un,{key:0,textButtonDefault:S.value.length>0?"Редактировать":fe.value.fieldName||"",onClick:()=>ee.value=!ee.value,id:"button_comments"},null,8,["textButtonDefault","onClick"])):l.createCommentVNode("",!0)])):l.createCommentVNode("",!0),l.createElementVNode("div",kf,[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(C),Ve=>(l.openBlock(),l.createBlock(ta,{key:Ve.idSystem,cardItem:Ve,onDelete:Zt=>Ze(Ve.idSystem)},null,8,["cardItem","onDelete"]))),128))]),l.createElementVNode("div",Rf,[W.value?(l.openBlock(),l.createElementBlock("p",Of,[le[16]||(le[16]=l.createTextVNode(" Списать ",-1)),l.withDirectives(l.createElementVNode("input",{type:"number",placeholder:"0",style:l.normalizeStyle({maxWidth:`${l.unref(_).toString().length||1}em`}),disabled:l.unref(y)===null||((rt=l.unref(y))==null?void 0:rt.balance)===0,"onUpdate:modelValue":le[4]||(le[4]=Ve=>l.isRef(_)?_.value=Ve:null),onInput:mt,min:"0",max:l.unref(dt),onKeypress:Oe},null,44,Bf),[[l.vModelText,l.unref(_),void 0,{number:!0}]]),le[17]||(le[17]=l.createTextVNode(" бонусов ",-1))])):l.createCommentVNode("",!0),W.value?(l.openBlock(),l.createElementBlock("p",Mf,"У вас есть "+l.toDisplayString(l.unref(y)?l.unref(y).balance:0)+" B",1)):l.createCommentVNode("",!0),W.value?l.withDirectives((l.openBlock(),l.createElementBlock("input",{key:2,type:"range",class:"footer_range","onUpdate:modelValue":le[5]||(le[5]=Ve=>l.isRef(_)?_.value=Ve:null),min:0,max:l.unref(dt)},null,8,vf)),[[l.vModelText,l.unref(_),void 0,{number:!0}]]):l.createCommentVNode("",!0),l.createElementVNode("ul",Df,[W.value?(l.openBlock(),l.createElementBlock("li",Pf,[le[19]||(le[19]=l.createElementVNode("p",null,"Сумма заказа:",-1)),l.createElementVNode("p",null,[l.createVNode(Xt,{price:l.unref(w),fixedFloat:2},null,8,["price"]),le[18]||(le[18]=l.createTextVNode(" ₽",-1))])])):l.createCommentVNode("",!0),W.value?(l.openBlock(),l.createElementBlock("li",Lf,[le[21]||(le[21]=l.createElementVNode("p",null,"Будет оплачено бонусами:",-1)),l.createElementVNode("p",null,[l.createVNode(Xt,{price:l.unref(_),fixedFloat:2},null,8,["price"]),le[20]||(le[20]=l.createTextVNode(" Б",-1))])])):l.createCommentVNode("",!0),l.unref(v)!==0?(l.openBlock(),l.createElementBlock("li",Ff,[l.createElementVNode("p",Vf,l.toDisplayString(l.unref(v)>0?"Надбавка":"Скидка")+": ",1),l.createElementVNode("p",Uf,[l.createVNode(Xt,{price:Math.abs(l.unref(v)),fixedFloat:2},null,8,["price"]),le[22]||(le[22]=l.createTextVNode(" ₽",-1))])])):j.value!==0?(l.openBlock(),l.createElementBlock("li",Hf,[l.createElementVNode("p",zf,l.toDisplayString(j.value>0?"Надбавка":"Скидка")+": ",1),l.createElementVNode("p",Gf,[l.createVNode(Xt,{price:Math.abs(j.value),fixedFloat:2},null,8,["price"]),le[23]||(le[23]=l.createTextVNode(" ₽",-1))])])):l.createCommentVNode("",!0),l.createElementVNode("li",null,[le[25]||(le[25]=l.createElementVNode("p",{class:"accept_field"},"Итого к оплате:",-1)),l.createElementVNode("p",Wf,[l.createVNode(Xt,{price:l.unref(w)-l.unref(_),fixedFloat:2},null,8,["price"]),le[24]||(le[24]=l.createTextVNode(" ₽",-1))])])]),Dt.value&&nr.value<Dt.value?(l.openBlock(),l.createElementBlock("div",Xf,[le[26]||(le[26]=l.createTextVNode(" Минимальная сумма заказа ",-1)),l.createVNode(Xt,{price:Dt.value,fixedFloat:2},null,8,["price"]),l.createTextVNode(" "+l.toDisplayString(l.unref(p).currency_symbol)+". Для оформления заказа необходимо добавить товаров на сумму ",1),l.createVNode(Xt,{price:Dt.value-nr.value,fixedFloat:2},null,8,["price"]),l.createTextVNode(" "+l.toDisplayString(l.unref(p).currency_symbol),1)])):l.createCommentVNode("",!0),l.createElementVNode("div",jf,[l.unref(y)?(l.openBlock(),l.createBlock(un,{key:0,textButtonDefault:l.unref(N).bonuses_button_name||"Бонусы",onClick:Ei,class:"button_bonus_cart"},null,8,["textButtonDefault"])):l.createCommentVNode("",!0),l.createVNode(un,{textButtonDefault:l.unref(k)?"Рассчитать скидки":l.unref(B),onClick:l.unref(k)?Cr:_r,class:"button_payment_cart",disabled:yi.value},null,8,["textButtonDefault","onClick","disabled"])])])]),l.createVNode(Yd,{orderNumber:l.unref(D),pageNumber:1},null,8,["orderNumber"]),l.createVNode(so,{visible:l.unref(M),"onUpdate:visible":le[6]||(le[6]=Ve=>l.isRef(M)?M.value=Ve:null),textNotificationDefault:l.unref(ne).textNotification,backgroundColor:l.unref(N).accent_color?l.unref(N).accent_color:"#FF6D2E",buttonAccept:null},null,8,["visible","textNotificationDefault","backgroundColor"]),l.createVNode(lo,{modelValue:l.unref(V),"onUpdate:modelValue":le[7]||(le[7]=Ve=>l.isRef(V)?V.value=Ve:null),class:"product_card_sheet","snap-points":["80%"]},{default:l.withCtx(()=>{var Ve;return[l.createVNode(q1,{"config-page":o.configPage,comment:S.value,"cart-items":st.value,"is-authorized":!!m.configPage.userData||!!l.unref(y),"has-rms-discount":l.unref(p).has_rms_discount,"hide-discounts-button":l.unref(N).hide_discounts_calculate_button,"order-id":ge.value,signal:(Ve=l.unref(i))==null?void 0:Ve.signal,onSelectPayment:ye},null,8,["config-page","comment","cart-items","is-authorized","has-rms-discount","hide-discounts-button","order-id","signal"])]}),_:1},8,["modelValue"])],64)}}}),qf={},Yf={viewBox:"0 0 24 24"};function $f(o,a){return l.openBlock(),l.createElementBlock("svg",Yf,[...a[0]||(a[0]=[l.createElementVNode("path",{d:"M18 6L6 18M6 6l12 12"},null,-1)])])}const Kf=Ue(qf,[["render",$f]]),Qf={class:"retry_screen"},Jf={class:"retry_all_in_screen"},eh={class:"retry_content"},th={class:"retry_icon_wrap"},nh={class:"retry_icon_circle"},rh={class:"retry_error_x"},ih=l.defineComponent({__name:"RetryPage",setup(o){const a=St(),i=Re.useRouter(),u=Re.useRoute(),f=ot(),h=()=>{a.notificationData_lib.textNotification="",a.is_notification_lib=!1,f.openApiKey=!0,i.replace(`/${u.params.orgId}/`)};return(m,w)=>(l.openBlock(),l.createElementBlock("section",Qf,[l.createElementVNode("div",Jf,[l.createElementVNode("main",eh,[l.createElementVNode("div",th,[l.createElementVNode("div",nh,[w[0]||(w[0]=l.createElementVNode("div",{class:"retry_loader_mini"},null,-1)),l.createElementVNode("div",rh,[l.createVNode(Kf)])])]),w[1]||(w[1]=l.createElementVNode("div",{class:"retry_oops"},"OOPS",-1)),w[2]||(w[2]=l.createElementVNode("h1",{class:"retry_title"},"Что-то пошло не так",-1)),w[3]||(w[3]=l.createElementVNode("div",{class:"retry_hint"},[l.createElementVNode("p",null,"Похоже, произошёл технический сбой."),l.createElementVNode("p",null,"Мы уже знаем о проблеме и сейчас разбираемся."),l.createElementVNode("p",null,"Приносим извинения за доставленные неудобства."),l.createElementVNode("p",null,"Попробуйте начать новый заказ.")],-1))]),l.createElementVNode("div",{class:"retry_footer"},[l.createElementVNode("button",{onClick:h,class:"retry_new_order_btn"},"Новый заказ")]),w[4]||(w[4]=l.createElementVNode("p",{class:"retry_bottom_note"},"Если ошибка повторяется — обратитесь к сотруднику зала.",-1))])]))}}),oh={class:"wrapper_loader"},sh=l.defineComponent({__name:"Loader",props:{size:{type:String,default:"40px"}},setup(o){return(a,i)=>(l.openBlock(),l.createElementBlock("div",oh,[l.createElementVNode("div",{class:"loader",style:l.normalizeStyle({width:o.size})},null,4)]))}}),ah=Ue(l.defineComponent({__name:"AnimationLoader",props:{id:{}},setup(o){const a=l.ref(!0);return l.watch(()=>a.value,()=>{a.value=!1,setTimeout(()=>{a.value=!0},0)}),(i,u)=>(l.openBlock(),l.createElementBlock("div",{class:"opacity-animation",key:o.id},[l.renderSlot(i.$slots,"opacityLoader",{},void 0,!0)]))}}),[["__scopeId","data-v-c6b97942"]]),lh={key:0},ch={class:"card__main__wrapper"},uh={key:0,class:"folder_content_top"},dh={key:0,class:"loader_card_main"},fh={key:1,class:"card__main_content"},hh=["src","alt"],gh={class:"card_title_price_wrapper"},mh={class:"title"},ph={key:0,class:"price"},xh={key:1,class:"card_button_add_wrapper"},ca=Ue(l.defineComponent({__name:"CardMain",props:{data:{},activeTags:{},is_group:{type:Boolean},parent:{},isLoading:{type:Boolean},selectGroupChild:{type:Function},takeCurrentCard:{type:Function}},setup(o){const a=It(),i=ot(),u=Rt(),{itemThemes:f}=xe.storeToRefs(a),{is_18_above_content:h,is18Allowed:m,notificationData_lib:w}=xe.storeToRefs(i),_=o,p=(B,R)=>{var v,M,k;const P={id:B.id,is_fake:B.is_fake||!1,is_od_united_product:B.is_od_united_product||!1,amount:B.amount||1,name:B.name,image_link:B.image_link,price:B.price,old_price:B.price,size:void 0,sizes:[],modifiers:[],groups:B.groups,group_modifiers:[],energy_amount:B.energy_amount??0,proteins_amount:B.proteins_amount??0,fat_amount:B.fat_amount??0,carbohydrates_amount:B.carbohydrates_amount??0},D=!((v=B.modifiers)!=null&&v.length)&&!((M=B.group_modifiers)!=null&&M.length)&&!((k=B.sizes)!=null&&k.length);if(u.isUpSale=!1,B.adult&&!m.value){h.value=!0,D&&(w.value.fastAdd=P);return}if(D){i.addToCart(P);return}if(B.amount||(B.amount=1),_.is_group&&_.selectGroupChild){_.selectGroupChild({...B,parent:_.parent,child:R.child_groups});return}_.takeCurrentCard&&_.takeCurrentCard(R.id)},C=B=>{if(_.is_group&&_.selectGroupChild){B={...B,parent:_.parent,child:B.child_groups},_.selectGroupChild(B);return}if(B.adult&&!m.value){h.value=!0;return}_.takeCurrentCard&&_.takeCurrentCard(B.id)},y=l.computed(()=>_.activeTags.every(B=>_.data.tags.includes(B))),{mediaUrl:N}=Ln(()=>_.data.id+"_image",()=>_.data.image_link);return(B,R)=>{var P;return((P=_.activeTags)==null?void 0:P.length)===0||y.value||_.is_group?(l.openBlock(),l.createElementBlock("div",lh,[l.createVNode(ah,{id:_.data.id},{opacityLoader:l.withCtx(()=>[l.createElementVNode("div",ch,[o.is_group?(l.openBlock(),l.createElementBlock("div",uh)):l.createCommentVNode("",!0),l.createElementVNode("div",{onClick:R[0]||(R[0]=D=>C(_.data)),class:l.normalizeClass(["card__main",{card__main_folder:o.is_group}])},[o.isLoading?(l.openBlock(),l.createElementBlock("div",dh,[l.createVNode(sh)])):(l.openBlock(),l.createElementBlock("div",fh,[l.createElementVNode("img",{src:l.unref(N)||"",class:l.normalizeClass(["img",{card_blur_image:_.data.adult&&!l.unref(m)}]),loading:"lazy",alt:o.data.name},null,10,hh),l.createElementVNode("div",gh,[l.createElementVNode("p",mh,l.toDisplayString(o.data.name),1),o.is_group?l.createCommentVNode("",!0):(l.openBlock(),l.createElementBlock("p",ph,l.toDisplayString(l.unref(ur)(o.data))+" ₽",1))])]))],2),o.is_group?l.createCommentVNode("",!0):(l.openBlock(),l.createElementBlock("div",xh,[l.createElementVNode("div",{onClick:R[1]||(R[1]=D=>p(o.data,_.data)),class:"add_button"},[...R[2]||(R[2]=[l.createElementVNode("div",{class:"image_add_button"},null,-1)])])]))])]),_:1},8,["id"])])):l.createCommentVNode("",!0)}}}),[["__scopeId","data-v-fe2b6c42"]]),wh=["id","onClick"],_h=Ue(l.defineComponent({__name:"GroupMain",props:{menuGroup:{},idActiveGroup:{},activeTakeGroup:{type:Function}},setup(o){const a=l.ref(null);return(i,u)=>o.menuGroup.length?(l.openBlock(),l.createElementBlock("ul",{key:0,class:"main__menu",ref_key:"scrollGroup",ref:a},[l.createVNode(ro,{axis:"x",behavior:"smooth",container:a.value,autoScroll:!0,idActive:o.idActiveGroup,clearContainer:!0},{default:l.withCtx(({handleTargetClick:f})=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(o.menuGroup,(h,m)=>(l.openBlock(),l.createElementBlock("li",{key:h.id,id:"scrolling"+h.id,onClick:w=>{o.activeTakeGroup&&o.activeTakeGroup(h.id,m),f(w)},style:l.normalizeStyle(o.idActiveGroup==h.id?{fontFamily:"Bounded"}:{})},l.toDisplayString(h.name),13,wh))),128))]),_:1},8,["container","idActive"])],512)):l.createCommentVNode("",!0)}}),[["__scopeId","data-v-33006a7e"]]),Ch=["id","onClick"],Eh=Ue(l.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(o){const a=o,i=l.ref(null),u=l.computed(()=>{if(a.isSolo&&!a.groupIndex)return Array.isArray(a.currentActiveTag)?a.currentActiveTag:[];if(a.groupIndex!==null&&a.groupIndex!==void 0){const f=a.currentActiveTag[a.groupIndex];return Array.isArray(f)?f:[]}return[]});return(f,h)=>o.menuTags.length>0?(l.openBlock(),l.createElementBlock("ul",{key:0,class:"main__filters",ref_key:"scrollTagContainer",ref:i},[l.createVNode(ro,{axis:"x",behavior:"smooth",container:i.value,autoScroll:!0,idActive:u.value?u.value[o.currentActiveTag.length-1]:null,clearContainer:!1},{default:l.withCtx(({handleTargetClick:m})=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(o.menuTags,(w,_)=>(l.openBlock(),l.createElementBlock("li",{key:_,id:`scrolling${w}`,onClick:p=>{o.activeTakeTags&&(o.groupIndex||o.groupIndex===0)?o.activeTakeTags(w,o.groupIndex):o.activeTakeTagsSolo&&o.activeTakeTagsSolo(w),m(p)},class:l.normalizeClass({main__filter_active:(u.value??[]).includes(w)})},l.toDisplayString(w),11,Ch))),128))]),_:1},8,["container","idActive"])],512)):l.createCommentVNode("",!0)}}),[["__scopeId","data-v-818940a4"]]),yh=["data-id"],bh=["src"],Ah=["src"],Ih=Ue(l.defineComponent({__name:"DrumItem",props:{group:{},index:{},active:{type:Boolean}},setup(o){const a=o,{mediaUrl:i}=Ln(()=>{var u,f;return(u=a.group)!=null&&u.video_link?`${a.group.id}_video`:(f=a.group)!=null&&f.image_link?`${a.group.id}_image`:null});return(u,f)=>o.group?(l.openBlock(),l.createElementBlock("div",{key:0,class:l.normalizeClass(["drum_item",{active:a.active}]),"data-id":o.group.id},[o.group.video_link?l.withDirectives((l.openBlock(),l.createElementBlock("video",{key:l.unref(i),loop:"",autoplay:"",muted:"",playsinline:"",class:"drum_img"},[l.createElementVNode("source",{src:l.unref(i)||"",type:"video/webm"},null,8,bh)])),[[l.unref(Vr)]]):(l.openBlock(),l.createElementBlock("img",{key:1,class:"drum_img",src:l.unref(i)||""},null,8,Ah)),l.createElementVNode("p",null,l.toDisplayString(o.group.name),1)],10,yh)):l.createCommentVNode("",!0)}}),[["__scopeId","data-v-2b994529"]]),Sh={},Nh={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 Th(o,a){return l.openBlock(),l.createElementBlock("svg",Nh,[...a[0]||(a[0]=[l.createElementVNode("desc",null," Created with Pixso. ",-1),l.createElementVNode("defs",null,null,-1),l.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 kh=Ue(Sh,[["render",Th]]),Rh={class:"recommendation_wrapper"},Oh={class:"recommendation_header"},Bh={class:"recommendation_info"},Mh=Ue(l.defineComponent({__name:"Recommendation",props:{closeCurrentCard:{},openCurrentCard:{}},setup(o){const a=Rt(),{isUpSale:i,dataUpSale:u}=xe.storeToRefs(a),f=()=>{i.value=!1};return l.onUnmounted(()=>{u.value=null}),(h,m)=>(l.openBlock(),l.createElementBlock("div",Rh,[l.createElementVNode("div",Oh,[m[0]||(m[0]=l.createElementVNode("p",{class:"header_title"},"Часто берут вместе",-1)),l.createElementVNode("div",{class:"header_close",onClick:f},[l.createVNode(kh,{class:"close_icon"})])]),l.createElementVNode("div",Bh,[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(u),w=>(l.openBlock(),l.createBlock(ca,{data:w,key:w.id,parent:w.id,is_group:!1,is_product:!0,class:"card",activeTags:[],isLoading:!1,closeCurrentCard:o.closeCurrentCard,takeCurrentCard:()=>o.openCurrentCard(w.id,!0)},null,8,["data","parent","closeCurrentCard","takeCurrentCard"]))),128))])]))}}),[["__scopeId","data-v-d545ec45"]]),vh=l.defineComponent({__name:"Blackout",props:{data:{type:Boolean}},setup(o){const a=o;return l.watch(()=>a.data,i=>{document.body.style.overflow=i?"hidden":""}),()=>{}}}),Dh={class:"wrapper_modal"},Ph={class:"card_modal"},Lh=Ue(l.defineComponent({__name:"ModalWindows",props:{visible:{type:Boolean}},setup(o){const a=o,i=Rt(),{isUpSale:u}=xe.storeToRefs(i),f=()=>{u.value=!1};return(h,m)=>(l.openBlock(),l.createElementBlock(l.Fragment,null,[l.createVNode(vh,{data:a.visible},null,8,["data"]),l.createElementVNode("div",{class:"black_modal",onClick:f}),l.createElementVNode("div",Dh,[l.createElementVNode("div",Ph,[l.renderSlot(h.$slots,"default",{},void 0,!0)])])],64))}}),[["__scopeId","data-v-ec2b2c4d"]]);var pe;(function(o){o[o.QR_CODE=0]="QR_CODE",o[o.AZTEC=1]="AZTEC",o[o.CODABAR=2]="CODABAR",o[o.CODE_39=3]="CODE_39",o[o.CODE_93=4]="CODE_93",o[o.CODE_128=5]="CODE_128",o[o.DATA_MATRIX=6]="DATA_MATRIX",o[o.MAXICODE=7]="MAXICODE",o[o.ITF=8]="ITF",o[o.EAN_13=9]="EAN_13",o[o.EAN_8=10]="EAN_8",o[o.PDF_417=11]="PDF_417",o[o.RSS_14=12]="RSS_14",o[o.RSS_EXPANDED=13]="RSS_EXPANDED",o[o.UPC_A=14]="UPC_A",o[o.UPC_E=15]="UPC_E",o[o.UPC_EAN_EXTENSION=16]="UPC_EAN_EXTENSION"})(pe||(pe={}));var ua=new Map([[pe.QR_CODE,"QR_CODE"],[pe.AZTEC,"AZTEC"],[pe.CODABAR,"CODABAR"],[pe.CODE_39,"CODE_39"],[pe.CODE_93,"CODE_93"],[pe.CODE_128,"CODE_128"],[pe.DATA_MATRIX,"DATA_MATRIX"],[pe.MAXICODE,"MAXICODE"],[pe.ITF,"ITF"],[pe.EAN_13,"EAN_13"],[pe.EAN_8,"EAN_8"],[pe.PDF_417,"PDF_417"],[pe.RSS_14,"RSS_14"],[pe.RSS_EXPANDED,"RSS_EXPANDED"],[pe.UPC_A,"UPC_A"],[pe.UPC_E,"UPC_E"],[pe.UPC_EAN_EXTENSION,"UPC_EAN_EXTENSION"]]),da;(function(o){o[o.UNKNOWN=0]="UNKNOWN",o[o.URL=1]="URL"})(da||(da={}));function Fh(o){return Object.values(pe).includes(o)}var mi;(function(o){o[o.SCAN_TYPE_CAMERA=0]="SCAN_TYPE_CAMERA",o[o.SCAN_TYPE_FILE=1]="SCAN_TYPE_FILE"})(mi||(mi={}));var Vh=function(){function o(){}return o.GITHUB_PROJECT_URL="https://github.com/mebjas/html5-qrcode",o.SCAN_DEFAULT_FPS=2,o.DEFAULT_DISABLE_FLIP=!1,o.DEFAULT_REMEMBER_LAST_CAMERA_USED=!0,o.DEFAULT_SUPPORTED_SCAN_TYPE=[mi.SCAN_TYPE_CAMERA,mi.SCAN_TYPE_FILE],o}(),fa=function(){function o(a,i){this.format=a,this.formatName=i}return o.prototype.toString=function(){return this.formatName},o.create=function(a){if(!ua.has(a))throw"".concat(a," not in html5QrcodeSupportedFormatsTextMap");return new o(a,ua.get(a))},o}(),ha=function(){function o(){}return o.createFromText=function(a){var i={text:a};return{decodedText:a,result:i}},o.createFromQrcodeResult=function(a){return{decodedText:a.text,result:a}},o}(),mo;(function(o){o[o.UNKWOWN_ERROR=0]="UNKWOWN_ERROR",o[o.IMPLEMENTATION_ERROR=1]="IMPLEMENTATION_ERROR",o[o.NO_CODE_FOUND_ERROR=2]="NO_CODE_FOUND_ERROR"})(mo||(mo={}));var Uh=function(){function o(){}return o.createFrom=function(a){return{errorMessage:a,type:mo.UNKWOWN_ERROR}},o}(),Hh=function(){function o(a){this.verbose=a}return o.prototype.log=function(a){this.verbose&&console.log(a)},o.prototype.warn=function(a){this.verbose&&console.warn(a)},o.prototype.logError=function(a,i){(this.verbose||i===!0)&&console.error(a)},o.prototype.logErrors=function(a){if(a.length===0)throw"Logger#logError called without arguments";this.verbose&&console.error(a)},o}();function Fn(o){return typeof o>"u"||o===null}var xr=function(){function o(){}return o.codeParseError=function(a){return"QR code parse error, error = ".concat(a)},o.errorGettingUserMedia=function(a){return"Error getting userMedia, error = ".concat(a)},o.onlyDeviceSupportedError=function(){return"The device doesn't support navigator.mediaDevices , only supported cameraIdOrConfig in this case is deviceId parameter (string)."},o.cameraStreamingNotSupported=function(){return"Camera streaming not supported by the browser."},o.unableToQuerySupportedDevices=function(){return"Unable to query supported devices, unknown error."},o.insecureContextCameraQueryError=function(){return"Camera access is only supported in secure context like https or localhost."},o.scannerPaused=function(){return"Scanner paused"},o}(),ga=function(){function o(){}return o.isMediaStreamConstraintsValid=function(a,i){if(typeof a!="object"){var u=typeof a;return i.logError("videoConstraints should be of type object, the "+"object passed is of type ".concat(u,"."),!0),!1}for(var f=["autoGainControl","channelCount","echoCancellation","latency","noiseSuppression","sampleRate","sampleSize","volume"],h=new Set(f),m=Object.keys(a),w=0,_=m;w<_.length;w++){var p=_[w];if(h.has(p))return i.logError("".concat(p," is not supported videoConstaints."),!0),!1}return!0},o}(),po={exports:{}};(function(o,a){(function(i,u){u(a)})(mr,function(i){function u(b){return b==null}var f=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 h(b,e){f(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 w(b,e){e===void 0&&(e=b.constructor);var t=Error.captureStackTrace;t&&t(b,e)}var _=function(b){h(e,b);function e(t){var n=this.constructor,r=b.call(this,t)||this;return Object.defineProperty(r,"name",{value:n.name,enumerable:!1}),m(r,n.prototype),w(r),r}return e}(Error);class p extends _{constructor(e=void 0){super(e),this.message=e}getKind(){return this.constructor.kind}}p.kind="Exception";class C extends p{}C.kind="ArgumentException";class y extends p{}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,r){const s=this.binarizer.getLuminanceSource().crop(e,t,n,r);return new N(this.binarizer.createBinarizer(s))}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 B extends p{static getChecksumInstance(){return new B}}B.kind="ChecksumException";class R{constructor(e){this.source=e}getLuminanceSource(){return this.source}getWidth(){return this.source.getWidth()}getHeight(){return this.source.getHeight()}}class P{static arraycopy(e,t,n,r,s){for(;s--;)n[r++]=e[t++]}static currentTimeMillis(){return Date.now()}}class D extends p{}D.kind="IndexOutOfBoundsException";class v extends D{constructor(e=void 0,t=void 0){super(t),this.index=e,this.message=t}}v.kind="ArrayIndexOutOfBoundsException";class M{static fill(e,t){for(let n=0,r=e.length;n<r;n++)e[n]=t}static fillWithin(e,t,n,r){M.rangeCheck(e.length,t,n);for(let s=t;s<n;s++)e[s]=r}static rangeCheck(e,t,n){if(t>n)throw new y("fromIndex("+t+") > toIndex("+n+")");if(t<0)throw new v(t);if(n>e)throw new v(n)}static asList(...e){return e}static create(e,t,n){return Array.from({length:e}).map(s=>Array.from({length:t}).fill(n))}static createInt32Array(e,t,n){return Array.from({length:e}).map(s=>Int32Array.from({length:t}).fill(n))}static equals(e,t){if(!e||!t||!e.length||!t.length||e.length!==t.length)return!1;for(let n=0,r=e.length;n<r;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 r=n-t,s=new Int32Array(r);return P.arraycopy(e,t,s,0,r),s}static binarySearch(e,t,n){n===void 0&&(n=M.numberComparator);let r=0,s=e.length-1;for(;r<=s;){const c=s+r>>1,d=n(t,e[c]);if(d>0)r=c+1;else if(d<0)s=c-1;else return c}return-r-1}static numberComparator(e,t){return e-t}}class k{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)}}k.MIN_VALUE_32_BITS=-2147483648,k.MAX_VALUE=Number.MAX_SAFE_INTEGER;class V{constructor(e,t){e===void 0?(this.size=0,this.bits=new Int32Array(1)):(this.size=e,t==null?this.bits=V.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=V.makeArray(e);P.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 r=Math.floor(e/32),s=n[r];s&=~((1<<(e&31))-1);const c=n.length;for(;s===0;){if(++r===c)return t;s=n[r]}const d=r*32+k.numberOfTrailingZeros(s);return d>t?t:d}getNextUnset(e){const t=this.size;if(e>=t)return t;const n=this.bits;let r=Math.floor(e/32),s=~n[r];s&=~((1<<(e&31))-1);const c=n.length;for(;s===0;){if(++r===c)return t;s=~n[r]}const d=r*32+k.numberOfTrailingZeros(s);return d>t?t:d}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),r=Math.floor(t/32),s=this.bits;for(let c=n;c<=r;c++){const d=c>n?0:e&31,x=(2<<(c<r?31:t&31))-(1<<d);s[c]|=x}}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 r=Math.floor(e/32),s=Math.floor(t/32),c=this.bits;for(let d=r;d<=s;d++){const g=d>r?0:e&31,E=(2<<(d<s?31:t&31))-(1<<g)&4294967295;if((c[d]&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,r=t.length;n<r;n++)t[n]^=e.bits[n]}toBytes(e,t,n,r){for(let s=0;s<r;s++){let c=0;for(let d=0;d<8;d++)this.get(e)&&(c|=1<<7-d),e++;t[n+s]=c}}getBitArray(){return this.bits}reverse(){const e=new Int32Array(this.bits.length),t=Math.floor((this.size-1)/32),n=t+1,r=this.bits;for(let s=0;s<n;s++){let c=r[s];c=c>>1&1431655765|(c&1431655765)<<1,c=c>>2&858993459|(c&858993459)<<2,c=c>>4&252645135|(c&252645135)<<4,c=c>>8&16711935|(c&16711935)<<8,c=c>>16&65535|(c&65535)<<16,e[t-s]=c}if(this.size!==n*32){const s=n*32-this.size;let c=e[0]>>>s;for(let d=1;d<n;d++){const g=e[d];c|=g<<32-s,e[d-1]=c,c=g>>>s}e[n-1]=c}this.bits=e}static makeArray(e){return new Int32Array(Math.floor((e+31)/32))}equals(e){if(!(e instanceof V))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 V(this.size,this.bits.slice())}}var te;(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"})(te||(te={}));var ne=te;class U extends p{static getFormatInstance(){return new U}}U.kind="FormatException";var ie;(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"})(ie||(ie={}));class z{constructor(e,t,n,...r){this.valueIdentifier=e,this.name=n,typeof t=="number"?this.values=Int32Array.from([t]):this.values=t,this.otherEncodingNames=r,z.VALUE_IDENTIFIER_TO_ECI.set(e,this),z.NAME_TO_ECI.set(n,this);const s=this.values;for(let c=0,d=s.length;c!==d;c++){const g=s[c];z.VALUES_TO_ECI.set(g,this)}for(const c of r)z.NAME_TO_ECI.set(c,this)}getValueIdentifier(){return this.valueIdentifier}getName(){return this.name}getValue(){return this.values[0]}static getCharacterSetECIByValue(e){if(e<0||e>=900)throw new U("incorect value");const t=z.VALUES_TO_ECI.get(e);if(t===void 0)throw new U("incorect value");return t}static getCharacterSetECIByName(e){const t=z.NAME_TO_ECI.get(e);if(t===void 0)throw new U("incorect value");return t}equals(e){if(!(e instanceof z))return!1;const t=e;return this.getName()===t.getName()}}z.VALUE_IDENTIFIER_TO_ECI=new Map,z.VALUES_TO_ECI=new Map,z.NAME_TO_ECI=new Map,z.Cp437=new z(ie.Cp437,Int32Array.from([0,2]),"Cp437"),z.ISO8859_1=new z(ie.ISO8859_1,Int32Array.from([1,3]),"ISO-8859-1","ISO88591","ISO8859_1"),z.ISO8859_2=new z(ie.ISO8859_2,4,"ISO-8859-2","ISO88592","ISO8859_2"),z.ISO8859_3=new z(ie.ISO8859_3,5,"ISO-8859-3","ISO88593","ISO8859_3"),z.ISO8859_4=new z(ie.ISO8859_4,6,"ISO-8859-4","ISO88594","ISO8859_4"),z.ISO8859_5=new z(ie.ISO8859_5,7,"ISO-8859-5","ISO88595","ISO8859_5"),z.ISO8859_6=new z(ie.ISO8859_6,8,"ISO-8859-6","ISO88596","ISO8859_6"),z.ISO8859_7=new z(ie.ISO8859_7,9,"ISO-8859-7","ISO88597","ISO8859_7"),z.ISO8859_8=new z(ie.ISO8859_8,10,"ISO-8859-8","ISO88598","ISO8859_8"),z.ISO8859_9=new z(ie.ISO8859_9,11,"ISO-8859-9","ISO88599","ISO8859_9"),z.ISO8859_10=new z(ie.ISO8859_10,12,"ISO-8859-10","ISO885910","ISO8859_10"),z.ISO8859_11=new z(ie.ISO8859_11,13,"ISO-8859-11","ISO885911","ISO8859_11"),z.ISO8859_13=new z(ie.ISO8859_13,15,"ISO-8859-13","ISO885913","ISO8859_13"),z.ISO8859_14=new z(ie.ISO8859_14,16,"ISO-8859-14","ISO885914","ISO8859_14"),z.ISO8859_15=new z(ie.ISO8859_15,17,"ISO-8859-15","ISO885915","ISO8859_15"),z.ISO8859_16=new z(ie.ISO8859_16,18,"ISO-8859-16","ISO885916","ISO8859_16"),z.SJIS=new z(ie.SJIS,20,"SJIS","Shift_JIS"),z.Cp1250=new z(ie.Cp1250,21,"Cp1250","windows-1250"),z.Cp1251=new z(ie.Cp1251,22,"Cp1251","windows-1251"),z.Cp1252=new z(ie.Cp1252,23,"Cp1252","windows-1252"),z.Cp1256=new z(ie.Cp1256,24,"Cp1256","windows-1256"),z.UnicodeBigUnmarked=new z(ie.UnicodeBigUnmarked,25,"UnicodeBigUnmarked","UTF-16BE","UnicodeBig"),z.UTF8=new z(ie.UTF8,26,"UTF8","UTF-8"),z.ASCII=new z(ie.ASCII,Int32Array.from([27,170]),"ASCII","US-ASCII"),z.Big5=new z(ie.Big5,28,"Big5"),z.GB18030=new z(ie.GB18030,29,"GB18030","GB2312","EUC_CN","GBK"),z.EUC_KR=new z(ie.EUC_KR,30,"EUC_KR","EUC-KR");class oe extends p{}oe.kind="UnsupportedOperationException";class G{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!G.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 z?e:z.getCharacterSetECIByName(e)}static decodeFallback(e,t){const n=this.encodingCharacterSet(t);if(G.isDecodeFallbackSupported(n)){let r="";for(let s=0,c=e.length;s<c;s++){let d=e[s].toString(16);d.length<2&&(d="0"+d),r+="%"+d}return decodeURIComponent(r)}if(n.equals(z.UnicodeBigUnmarked))return String.fromCharCode.apply(null,new Uint16Array(e.buffer));throw new oe(`Encoding ${this.encodingName(t)} not supported by fallback.`)}static isDecodeFallbackSupported(e){return e.equals(z.UTF8)||e.equals(z.ISO8859_1)||e.equals(z.ASCII)}static encodeFallback(e){const n=btoa(unescape(encodeURIComponent(e))).split(""),r=[];for(let s=0;s<n.length;s++)r.push(n[s].charCodeAt(0));return new Uint8Array(r)}}class W{static castAsNonUtf8Char(e,t=null){const n=t?t.getName():this.ISO88591;return G.decode(new Uint8Array([e]),n)}static guessEncoding(e,t){if(t!=null&&t.get(ne.CHARACTER_SET)!==void 0)return t.get(ne.CHARACTER_SET).toString();const n=e.length;let r=!0,s=!0,c=!0,d=0,g=0,x=0,E=0,A=0,I=0,O=0,L=0,F=0,q=0,J=0;const ce=e.length>3&&e[0]===239&&e[1]===187&&e[2]===191;for(let ue=0;ue<n&&(r||s||c);ue++){const ae=e[ue]&255;c&&(d>0?ae&128?d--:c=!1:ae&128&&(ae&64?(d++,ae&32?(d++,ae&16?(d++,ae&8?c=!1:E++):x++):g++):c=!1)),r&&(ae>127&&ae<160?r=!1:ae>159&&(ae<192||ae===215||ae===247)&&J++),s&&(A>0?ae<64||ae===127||ae>252?s=!1:A--:ae===128||ae===160||ae>239?s=!1:ae>160&&ae<224?(I++,L=0,O++,O>F&&(F=O)):ae>127?(A++,O=0,L++,L>q&&(q=L)):(O=0,L=0))}return c&&d>0&&(c=!1),s&&A>0&&(s=!1),c&&(ce||g+x+E>0)?W.UTF8:s&&(W.ASSUME_SHIFT_JIS||F>=3||q>=3)?W.SHIFT_JIS:r&&s?F===2&&I===2||J*10>=n?W.SHIFT_JIS:W.ISO88591:r?W.ISO88591:s?W.SHIFT_JIS:c?W.UTF8:W.PLATFORM_DEFAULT_ENCODING}static format(e,...t){let n=-1;function r(c,d,g,x,E,A){if(c==="%%")return"%";if(t[++n]===void 0)return;c=x?parseInt(x.substr(1)):void 0;let I=E?parseInt(E.substr(1)):void 0,O;switch(A){case"s":O=t[n];break;case"c":O=t[n][0];break;case"f":O=parseFloat(t[n]).toFixed(c);break;case"p":O=parseFloat(t[n]).toPrecision(c);break;case"e":O=parseFloat(t[n]).toExponential(c);break;case"x":O=parseInt(t[n]).toString(I||16);break;case"d":O=parseFloat(parseInt(t[n],I||10).toPrecision(c)).toFixed(0);break}O=typeof O=="object"?JSON.stringify(O):(+O).toString(I);let L=parseInt(g),F=g&&g[0]+""=="0"?"0":" ";for(;O.length<L;)O=d!==void 0?O+F:F+O;return O}let s=/%(-)?(0?[0-9]+)?([.][0-9]+)?([#][0-9]+)?([scfpexd%])/g;return e.replace(s,r)}static getBytes(e,t){return G.encode(e,t)}static getCharCode(e,t=0){return e.charCodeAt(t)}static getCharAt(e){return String.fromCharCode(e)}}W.SHIFT_JIS=z.SJIS.getName(),W.GB2312="GB2312",W.ISO88591=z.ISO8859_1.getName(),W.EUC_JP="EUC_JP",W.UTF8=z.UTF8.getName(),W.PLATFORM_DEFAULT_ENCODING=W.UTF8,W.ASSUME_SHIFT_JIS=!1;class Z{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+=W.castAsNonUtf8Char(e,this.encoding):this.value+=String.fromCharCode(e),this}appendChars(e,t,n){for(let r=t;t<t+n;r++)this.append(e[r]);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 X{constructor(e,t,n,r){if(this.width=e,this.height=t,this.rowSize=n,this.bits=r,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,r==null&&(this.bits=new Int32Array(this.rowSize*this.height))}static parseFromBooleanArray(e){const t=e.length,n=e[0].length,r=new X(n,t);for(let s=0;s<t;s++){const c=e[s];for(let d=0;d<n;d++)c[d]&&r.set(d,s)}return r}static parseFromString(e,t,n){if(e===null)throw new y("stringRepresentation cannot be null");const r=new Array(e.length);let s=0,c=0,d=-1,g=0,x=0;for(;x<e.length;)if(e.charAt(x)===`
|
|
12
|
-
`||e.charAt(
|
|
13
|
-
`){return this.buildToString(e,t,n)}buildToString(e,t,n){let r=new
|
|
14
|
-
`)}return t.toString()}}class j extends ee{constructor(e){super(e.getWidth(),e.getHeight()),this.delegate=e}getRow(e,t){const n=this.delegate.getRow(e,t),r=this.getWidth();for(let s=0;s<r;s++)n[s]=255-(n[s]&255);return n}getMatrix(){const e=this.delegate.getMatrix(),t=this.getWidth()*this.getHeight(),n=new Uint8ClampedArray(t);for(let r=0;r<t;r++)n[r]=255-(e[r]&255);return n}isCropSupported(){return this.delegate.isCropSupported()}crop(e,t,n,r){return new j(this.delegate.crop(e,t,n,r))}isRotateSupported(){return this.delegate.isRotateSupported()}invert(){return this.delegate}rotateCounterClockwise(){return new j(this.delegate.rotateCounterClockwise())}rotateCounterClockwise45(){return new j(this.delegate.rotateCounterClockwise45())}}class re extends ee{constructor(e){super(e.width,e.height),this.canvas=e,this.tempCanvasElement=null,this.buffer=re.makeBufferFromCanvasImageData(e)}static makeBufferFromCanvasImageData(e){const t=e.getContext("2d").getImageData(0,0,e.width,e.height);return re.toGrayscaleBuffer(t.data,e.width,e.height)}static toGrayscaleBuffer(e,t,n){const r=new Uint8ClampedArray(t*n);for(let s=0,c=0,d=e.length;s<d;s+=4,c++){let g;if(e[s+3]===0)g=255;else{const E=e[s],A=e[s+1],I=e[s+2];g=306*E+601*A+117*I+512>>10}r[c]=g}return r}getRow(e,t){if(e<0||e>=this.getHeight())throw new y("Requested row is outside the image: "+e);const n=this.getWidth(),r=e*n;return t===null?t=this.buffer.slice(r,r+n):(t.length<n&&(t=new Uint8ClampedArray(n)),t.set(this.buffer.slice(r,r+n))),t}getMatrix(){return this.buffer}isCropSupported(){return!0}crop(e,t,n,r){return super.crop(e,t,n,r),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"),r=e*re.DEGREE_TO_RADIANS,s=this.canvas.width,c=this.canvas.height,d=Math.ceil(Math.abs(Math.cos(r))*s+Math.abs(Math.sin(r))*c),g=Math.ceil(Math.abs(Math.sin(r))*s+Math.abs(Math.cos(r))*c);return t.width=d,t.height=g,n.translate(d/2,g/2),n.rotate(r),n.drawImage(this.canvas,s/-2,c/-2),this.buffer=re.makeBufferFromCanvasImageData(t),this}invert(){return new j(this)}}re.DEGREE_TO_RADIANS=Math.PI/180;class ge{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 we=(globalThis||mr||self||window||void 0)&&(globalThis||mr||self||window||void 0).__awaiter||function(b,e,t,n){function r(s){return s instanceof t?s:new t(function(c){c(s)})}return new(t||(t=Promise))(function(s,c){function d(E){try{x(n.next(E))}catch(A){c(A)}}function g(E){try{x(n.throw(E))}catch(A){c(A)}}function x(E){E.done?s(E.value):r(E.value).then(d,g)}x((n=n.apply(b,e||[])).next())})};class Ne{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 we(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 r=n.kind==="video"?"videoinput":n.kind;if(r!=="videoinput")continue;const s=n.deviceId||n.id,c=n.label||`Video device ${t.length+1}`,d=n.groupId,g={deviceId:s,label:c,kind:r,groupId:d};t.push(g)}return t})}getVideoInputDevices(){return we(this,void 0,void 0,function*(){return(yield this.listVideoInputDevices()).map(t=>new ge(t.deviceId,t.label))})}findDeviceById(e){return we(this,void 0,void 0,function*(){const t=yield this.listVideoInputDevices();return t?t.find(n=>n.deviceId===e):null})}decodeFromInputVideoDevice(e,t){return we(this,void 0,void 0,function*(){return yield this.decodeOnceFromVideoDevice(e,t)})}decodeOnceFromVideoDevice(e,t){return we(this,void 0,void 0,function*(){this.reset();let n;e?n={deviceId:{exact:e}}:n={facingMode:"environment"};const r={video:n};return yield this.decodeOnceFromConstraints(r,t)})}decodeOnceFromConstraints(e,t){return we(this,void 0,void 0,function*(){const n=yield navigator.mediaDevices.getUserMedia(e);return yield this.decodeOnceFromStream(n,t)})}decodeOnceFromStream(e,t){return we(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 we(this,void 0,void 0,function*(){return yield this.decodeFromVideoDevice(e,t,n)})}decodeFromVideoDevice(e,t,n){return we(this,void 0,void 0,function*(){let r;e?r={deviceId:{exact:e}}:r={facingMode:"environment"};const s={video:r};return yield this.decodeFromConstraints(s,t,n)})}decodeFromConstraints(e,t,n){return we(this,void 0,void 0,function*(){const r=yield navigator.mediaDevices.getUserMedia(e);return yield this.decodeFromStream(r,t,n)})}decodeFromStream(e,t,n){return we(this,void 0,void 0,function*(){this.reset();const r=yield this.attachStreamToVideo(e,t);return yield this.decodeContinuously(r,n)})}stopAsyncDecode(){this._stopAsyncDecode=!0}stopContinuousDecode(){this._stopContinuousDecode=!0}attachStreamToVideo(e,t){return we(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 we(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(),r=this.decodeFromVideoElementContinuously(n,t);return n.src=e,r}_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 we(this,void 0,void 0,function*(){return yield this.playVideoOnLoadAsync(e),yield this.decodeOnce(e)})}_decodeOnLoadVideoContinuously(e,t){return we(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 r=(s,c)=>{if(this._stopAsyncDecode){c(new S("Video stream has ended before any code could be detected.")),this._stopAsyncDecode=void 0;return}try{const d=this.decode(e);s(d)}catch(d){const g=t&&d instanceof S,E=(d instanceof B||d instanceof U)&&n;if(g||E)return setTimeout(r,this._timeBetweenDecodingAttempts,s,c);c(d)}};return new Promise((s,c)=>r(s,c))}decodeContinuously(e,t){this._stopContinuousDecode=!1;const n=()=>{if(this._stopContinuousDecode){this._stopContinuousDecode=void 0;return}try{const r=this.decode(e);t(r,null),setTimeout(n,this.timeBetweenScansMillis)}catch(r){t(null,r);const s=r instanceof B||r instanceof U,c=r instanceof S;(s||c)&&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 re(t),r=new H(n);return new N(r)}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,r;return typeof e<"u"&&(e instanceof HTMLVideoElement?(n=e.videoWidth,r=e.videoHeight):e instanceof HTMLImageElement&&(n=e.naturalWidth||e.width,r=e.naturalHeight||e.height)),t.style.width=n+"px",t.style.height=r+"px",t.width=n,t.height=r,t}stopStreams(){this.stream&&(this.stream.getVideoTracks().forEach(e=>e.stop()),this.stream=void 0),this._stopAsyncDecode===!1&&this.stopAsyncDecode(),this._stopContinuousDecode===!1&&this.stopContinuousDecode()}reset(){this.stopStreams(),this._destroyVideoElement(),this._destroyImageElement(),this._destroyCaptureCanvas()}_destroyVideoElement(){this.videoElement&&(typeof this.videoEndedListener<"u"&&this.videoElement.removeEventListener("ended",this.videoEndedListener),typeof this.videoPlayingEventListener<"u"&&this.videoElement.removeEventListener("playing",this.videoPlayingEventListener),typeof this.videoCanPlayListener<"u"&&this.videoElement.removeEventListener("loadedmetadata",this.videoCanPlayListener),this.cleanVideoSource(this.videoElement),this.videoElement=void 0)}_destroyImageElement(){this.imageElement&&(this.imageLoadedListener!==void 0&&this.imageElement.removeEventListener("load",this.imageLoadedListener),this.imageElement.src=void 0,this.imageElement.removeAttribute("src"),this.imageElement=void 0)}_destroyCaptureCanvas(){this.captureCanvasContext=void 0,this.captureCanvas=void 0}addVideoSource(e,t){try{e.srcObject=t}catch{e.src=URL.createObjectURL(t)}}cleanVideoSource(e){try{e.srcObject=null}catch{e.src=""}this.videoElement.removeAttribute("src")}}class _e{constructor(e,t,n=t==null?0:8*t.length,r,s,c=P.currentTimeMillis()){this.text=e,this.rawBytes=t,this.numBits=n,this.resultPoints=r,this.format=s,this.timestamp=c,this.text=e,this.rawBytes=t,n==null?this.numBits=t==null?0:8*t.length:this.numBits=n,this.resultPoints=r,this.format=s,this.resultMetadata=null,c==null?this.timestamp=P.currentTimeMillis():this.timestamp=c}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);P.arraycopy(t,0,n,0,t.length),P.arraycopy(e,0,n,t.length,e.length),this.resultPoints=n}}getTimestamp(){return this.timestamp}toString(){return this.text}}var Me;(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"})(Me||(Me={}));var fe=Me,dt;(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"})(dt||(dt={}));var Xe=dt;class Oe{constructor(e,t,n,r,s=-1,c=-1){this.rawBytes=e,this.text=t,this.byteSegments=n,this.ecLevel=r,this.structuredAppendSequenceNumber=s,this.structuredAppendParity=c,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 Ze{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 me{constructor(e,t){if(t.length===0)throw new y;this.field=e;const n=t.length;if(n>1&&t[0]===0){let r=1;for(;r<n&&t[r]===0;)r++;r===n?this.coefficients=Int32Array.from([0]):(this.coefficients=new Int32Array(n-r),P.arraycopy(t,r,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 c=0,d=t.length;c!==d;c++){const g=t[c];n=Ze.addOrSubtract(n,g)}return n}n=t[0];const r=t.length,s=this.field;for(let c=1;c<r;c++)n=Ze.addOrSubtract(s.multiply(e,n),t[c]);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 c=t;t=n,n=c}let r=new Int32Array(n.length);const s=n.length-t.length;P.arraycopy(n,0,r,0,s);for(let c=s;c<n.length;c++)r[c]=Ze.addOrSubtract(t[c-s],n[c]);return new me(this.field,r)}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,r=e.coefficients,s=r.length,c=new Int32Array(n+s-1),d=this.field;for(let g=0;g<n;g++){const x=t[g];for(let E=0;E<s;E++)c[g+E]=Ze.addOrSubtract(c[g+E],d.multiply(x,r[E]))}return new me(d,c)}multiplyScalar(e){if(e===0)return this.field.getZero();if(e===1)return this;const t=this.coefficients.length,n=this.field,r=new Int32Array(t),s=this.coefficients;for(let c=0;c<t;c++)r[c]=n.multiply(s[c],e);return new me(n,r)}multiplyByMonomial(e,t){if(e<0)throw new y;if(t===0)return this.field.getZero();const n=this.coefficients,r=n.length,s=new Int32Array(r+e),c=this.field;for(let d=0;d<r;d++)s[d]=c.multiply(n[d],t);return new me(c,s)}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(),r=this;const s=e.getCoefficient(e.getDegree()),c=t.inverse(s);for(;r.getDegree()>=e.getDegree()&&!r.isZero();){const d=r.getDegree()-e.getDegree(),g=t.multiply(r.getCoefficient(r.getDegree()),c),x=e.multiplyByMonomial(d,g),E=t.buildMonomial(d,g);n=n.addOrSubtract(E),r=r.addOrSubtract(x)}return[n,r]}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 r=this.field.log(n);r===0?e+="1":r===1?e+="a":(e+="a^",e+=r)}t!==0&&(t===1?e+="x":(e+="x^",e+=t))}}return e}}class qe extends p{}qe.kind="ArithmeticException";class Ee extends Ze{constructor(e,t,n){super(),this.primitive=e,this.size=t,this.generatorBase=n;const r=new Int32Array(t);let s=1;for(let d=0;d<t;d++)r[d]=s,s*=2,s>=t&&(s^=e,s&=t-1);this.expTable=r;const c=new Int32Array(t);for(let d=0;d<t-1;d++)c[r[d]]=d;this.logTable=c,this.zero=new me(this,Int32Array.from([0])),this.one=new me(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 me(this,n)}inverse(e){if(e===0)throw new qe;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"+k.toHexString(this.primitive)+","+this.size+")"}equals(e){return e===this}}Ee.AZTEC_DATA_12=new Ee(4201,4096,1),Ee.AZTEC_DATA_10=new Ee(1033,1024,1),Ee.AZTEC_DATA_6=new Ee(67,64,1),Ee.AZTEC_PARAM=new Ee(19,16,1),Ee.QR_CODE_FIELD_256=new Ee(285,256,0),Ee.DATA_MATRIX_FIELD_256=new Ee(301,256,1),Ee.AZTEC_DATA_8=Ee.DATA_MATRIX_FIELD_256,Ee.MAXICODE_FIELD_64=Ee.AZTEC_DATA_6;class mt extends p{}mt.kind="ReedSolomonException";class nt extends p{}nt.kind="IllegalStateException";class jt{constructor(e){this.field=e}decode(e,t){const n=this.field,r=new me(n,e),s=new Int32Array(t);let c=!0;for(let O=0;O<t;O++){const L=r.evaluateAt(n.exp(O+n.getGeneratorBase()));s[s.length-1-O]=L,L!==0&&(c=!1)}if(c)return;const d=new me(n,s),g=this.runEuclideanAlgorithm(n.buildMonomial(t,1),d,t),x=g[0],E=g[1],A=this.findErrorLocations(x),I=this.findErrorMagnitudes(E,A);for(let O=0;O<A.length;O++){const L=e.length-1-n.log(A[O]);if(L<0)throw new mt("Bad error location");e[L]=Ee.addOrSubtract(e[L],I[O])}}runEuclideanAlgorithm(e,t,n){if(e.getDegree()<t.getDegree()){const O=e;e=t,t=O}const r=this.field;let s=e,c=t,d=r.getZero(),g=r.getOne();for(;c.getDegree()>=(n/2|0);){let O=s,L=d;if(s=c,d=g,s.isZero())throw new mt("r_{i-1} was zero");c=O;let F=r.getZero();const q=s.getCoefficient(s.getDegree()),J=r.inverse(q);for(;c.getDegree()>=s.getDegree()&&!c.isZero();){const ce=c.getDegree()-s.getDegree(),ue=r.multiply(c.getCoefficient(c.getDegree()),J);F=F.addOrSubtract(r.buildMonomial(ce,ue)),c=c.addOrSubtract(s.multiplyByMonomial(ce,ue))}if(g=F.multiply(d).addOrSubtract(L),c.getDegree()>=s.getDegree())throw new nt("Division algorithm failed to reduce polynomial?")}const x=g.getCoefficient(0);if(x===0)throw new mt("sigmaTilde(0) was zero");const E=r.inverse(x),A=g.multiplyScalar(E),I=c.multiplyScalar(E);return[A,I]}findErrorLocations(e){const t=e.getDegree();if(t===1)return Int32Array.from([e.getCoefficient(1)]);const n=new Int32Array(t);let r=0;const s=this.field;for(let c=1;c<s.getSize()&&r<t;c++)e.evaluateAt(c)===0&&(n[r]=s.inverse(c),r++);if(r!==t)throw new mt("Error locator degree does not match number of roots");return n}findErrorMagnitudes(e,t){const n=t.length,r=new Int32Array(n),s=this.field;for(let c=0;c<n;c++){const d=s.inverse(t[c]);let g=1;for(let x=0;x<n;x++)if(c!==x){const E=s.multiply(t[x],d),A=E&1?E&-2:E|1;g=s.multiply(g,A)}r[c]=s.multiply(e.evaluateAt(d),s.inverse(g)),s.getGeneratorBase()!==0&&(r[c]=s.multiply(r[c],d))}return r}}var st;(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"})(st||(st={}));class He{decode(e){this.ddata=e;let t=e.getBits(),n=this.extractBits(t),r=this.correctBits(n),s=He.convertBoolArrayToByteArray(r),c=He.getEncodedData(r),d=new Oe(s,c,null,null);return d.setNumBits(r.length),d}static highLevelDecode(e){return this.getEncodedData(e)}static getEncodedData(e){let t=e.length,n=st.UPPER,r=st.UPPER,s="",c=0;for(;c<t;)if(r===st.BINARY){if(t-c<5)break;let d=He.readCode(e,c,5);if(c+=5,d===0){if(t-c<11)break;d=He.readCode(e,c,11)+31,c+=11}for(let g=0;g<d;g++){if(t-c<8){c=t;break}const x=He.readCode(e,c,8);s+=W.castAsNonUtf8Char(x),c+=8}r=n}else{let d=r===st.DIGIT?4:5;if(t-c<d)break;let g=He.readCode(e,c,d);c+=d;let x=He.getCharacter(r,g);x.startsWith("CTRL_")?(n=r,r=He.getTable(x.charAt(5)),x.charAt(6)==="L"&&(n=r)):(s+=x,r=n)}return s}static getTable(e){switch(e){case"L":return st.LOWER;case"P":return st.PUNCT;case"M":return st.MIXED;case"D":return st.DIGIT;case"B":return st.BINARY;case"U":default:return st.UPPER}}static getCharacter(e,t){switch(e){case st.UPPER:return He.UPPER_TABLE[t];case st.LOWER:return He.LOWER_TABLE[t];case st.MIXED:return He.MIXED_TABLE[t];case st.PUNCT:return He.PUNCT_TABLE[t];case st.DIGIT:return He.DIGIT_TABLE[t];default:throw new nt("Bad table")}}correctBits(e){let t,n;this.ddata.getNbLayers()<=2?(n=6,t=Ee.AZTEC_DATA_6):this.ddata.getNbLayers()<=8?(n=8,t=Ee.AZTEC_DATA_8):this.ddata.getNbLayers()<=22?(n=10,t=Ee.AZTEC_DATA_10):(n=12,t=Ee.AZTEC_DATA_12);let r=this.ddata.getNbDatablocks(),s=e.length/n;if(s<r)throw new U;let c=e.length%n,d=new Int32Array(s);for(let I=0;I<s;I++,c+=n)d[I]=He.readCode(e,c,n);try{new jt(t).decode(d,s-r)}catch(I){throw new U(I)}let g=(1<<n)-1,x=0;for(let I=0;I<r;I++){let O=d[I];if(O===0||O===g)throw new U;(O===1||O===g-1)&&x++}let E=new Array(r*n-x),A=0;for(let I=0;I<r;I++){let O=d[I];if(O===1||O===g-1)E.fill(O>1,A,A+n-1),A+=n-1;else for(let L=n-1;L>=0;--L)E[A++]=(O&1<<L)!==0}return E}extractBits(e){let t=this.ddata.isCompact(),n=this.ddata.getNbLayers(),r=(t?11:14)+n*4,s=new Int32Array(r),c=new Array(this.totalBitsInLayer(n,t));if(t)for(let d=0;d<s.length;d++)s[d]=d;else{let d=r+1+2*k.truncDivision(k.truncDivision(r,2)-1,15),g=r/2,x=k.truncDivision(d,2);for(let E=0;E<g;E++){let A=E+k.truncDivision(E,15);s[g-E-1]=x-A-1,s[g+E]=x+A+1}}for(let d=0,g=0;d<n;d++){let x=(n-d)*4+(t?9:12),E=d*2,A=r-1-E;for(let I=0;I<x;I++){let O=I*2;for(let L=0;L<2;L++)c[g+O+L]=e.get(s[E+L],s[E+I]),c[g+2*x+O+L]=e.get(s[E+I],s[A-L]),c[g+4*x+O+L]=e.get(s[A-L],s[A-I]),c[g+6*x+O+L]=e.get(s[A-I],s[E+L])}g+=x*8}return c}static readCode(e,t,n){let r=0;for(let s=t;s<t+n;s++)r<<=1,e[s]&&(r|=1);return r}static readByte(e,t){let n=e.length-t;return n>=8?He.readCode(e,t,8):He.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]=He.readByte(e,8*n);return t}totalBitsInLayer(e,t){return((t?88:112)+16*e)*e}}He.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"],He.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"],He.MIXED_TABLE=["CTRL_PS"," ","\\1","\\2","\\3","\\4","\\5","\\6","\\7","\b"," ",`
|
|
15
|
-
`,"\\13","\f","\r","\\33","\\34","\\35","\\36","\\37","@","\\","^","_","`","|","~","\\177","CTRL_LL","CTRL_UL","CTRL_PL","CTRL_BS"],
|
|
16
|
-
`,". ",", ",": ","!",'"',"#","$","%","&","'","(",")","*","+",",","-",".","/",":",";","<","=",">","?","[","]","{","}","CTRL_UL"],He.DIGIT_TABLE=["CTRL_PS"," ","0","1","2","3","4","5","6","7","8","9",",",".","CTRL_UL","CTRL_US"];class ze{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,r){const s=e-n,c=t-r;return Math.sqrt(s*s+c*c)}static sum(e){let t=0;for(let n=0,r=e.length;n!==r;n++){const s=e[n];t+=s}return t}}class _r{static floatToIntBits(e){return e}}_r.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*_r.floatToIntBits(this.x)+_r.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]),r=this.distance(e[0],e[2]);let s,c,d;if(n>=t&&n>=r?(c=e[0],s=e[1],d=e[2]):r>=n&&r>=t?(c=e[1],s=e[0],d=e[2]):(c=e[2],s=e[0],d=e[1]),this.crossProductZ(s,c,d)<0){const g=s;s=d,d=g}e[0]=s,e[1]=c,e[2]=d}static distance(e,t){return ze.distance(e.x,e.y,t.x,t.y)}static crossProductZ(e,t,n){const r=t.x,s=t.y;return(n.x-r)*(e.y-s)-(n.y-s)*(e.x-r)}}class Cr{constructor(e,t){this.bits=e,this.points=t}getBits(){return this.bits}getPoints(){return this.points}}class Ei extends Cr{constructor(e,t,n,r,s){super(e,t),this.compact=n,this.nbDatablocks=r,this.nbLayers=s}getNbLayers(){return this.nbLayers}getNbDatablocks(){return this.nbDatablocks}isCompact(){return this.compact}}class bn{constructor(e,t,n,r){this.image=e,this.height=e.getHeight(),this.width=e.getWidth(),t==null&&(t=bn.INIT_SIZE),n==null&&(n=e.getWidth()/2|0),r==null&&(r=e.getHeight()/2|0);const s=t/2|0;if(this.leftInit=n-s,this.rightInit=n+s,this.upInit=r-s,this.downInit=r+s,this.upInit<0||this.leftInit<0||this.downInit>=this.height||this.rightInit>=this.width)throw new S}detect(){let e=this.leftInit,t=this.rightInit,n=this.upInit,r=this.downInit,s=!1,c=!0,d=!1,g=!1,x=!1,E=!1,A=!1;const I=this.width,O=this.height;for(;c;){c=!1;let L=!0;for(;(L||!g)&&t<I;)L=this.containsBlackPoint(n,r,t,!1),L?(t++,c=!0,g=!0):g||t++;if(t>=I){s=!0;break}let F=!0;for(;(F||!x)&&r<O;)F=this.containsBlackPoint(e,t,r,!0),F?(r++,c=!0,x=!0):x||r++;if(r>=O){s=!0;break}let q=!0;for(;(q||!E)&&e>=0;)q=this.containsBlackPoint(n,r,e,!1),q?(e--,c=!0,E=!0):E||e--;if(e<0){s=!0;break}let J=!0;for(;(J||!A)&&n>=0;)J=this.containsBlackPoint(e,t,n,!0),J?(n--,c=!0,A=!0):A||n--;if(n<0){s=!0;break}c&&(d=!0)}if(!s&&d){const L=t-e;let F=null;for(let ue=1;F===null&&ue<L;ue++)F=this.getBlackPointOnSegment(e,r-ue,e+ue,r);if(F==null)throw new S;let q=null;for(let ue=1;q===null&&ue<L;ue++)q=this.getBlackPointOnSegment(e,n+ue,e+ue,n);if(q==null)throw new S;let J=null;for(let ue=1;J===null&&ue<L;ue++)J=this.getBlackPointOnSegment(t,n+ue,t-ue,n);if(J==null)throw new S;let ce=null;for(let ue=1;ce===null&&ue<L;ue++)ce=this.getBlackPointOnSegment(t,r-ue,t-ue,r);if(ce==null)throw new S;return this.centerEdges(ce,F,J,q)}else throw new S}getBlackPointOnSegment(e,t,n,r){const s=ze.round(ze.distance(e,t,n,r)),c=(n-e)/s,d=(r-t)/s,g=this.image;for(let x=0;x<s;x++){const E=ze.round(e+x*c),A=ze.round(t+x*d);if(g.get(E,A))return new ye(E,A)}return null}centerEdges(e,t,n,r){const s=e.getX(),c=e.getY(),d=t.getX(),g=t.getY(),x=n.getX(),E=n.getY(),A=r.getX(),I=r.getY(),O=bn.CORR;return s<this.width/2?[new ye(A-O,I+O),new ye(d+O,g+O),new ye(x-O,E-O),new ye(s+O,c-O)]:[new ye(A+O,I+O),new ye(d+O,g-O),new ye(x-O,E+O),new ye(s-O,c-O)]}containsBlackPoint(e,t,n,r){const s=this.image;if(r){for(let c=e;c<=t;c++)if(s.get(c,n))return!0}else for(let c=e;c<=t;c++)if(s.get(n,c))return!0;return!1}}bn.INIT_SIZE=10,bn.CORR=1;class nr{static checkAndNudgePoints(e,t){const n=e.getWidth(),r=e.getHeight();let s=!0;for(let c=0;c<t.length&&s;c+=2){const d=Math.floor(t[c]),g=Math.floor(t[c+1]);if(d<-1||d>n||g<-1||g>r)throw new S;s=!1,d===-1?(t[c]=0,s=!0):d===n&&(t[c]=n-1,s=!0),g===-1?(t[c+1]=0,s=!0):g===r&&(t[c+1]=r-1,s=!0)}s=!0;for(let c=t.length-2;c>=0&&s;c-=2){const d=Math.floor(t[c]),g=Math.floor(t[c+1]);if(d<-1||d>n||g<-1||g>r)throw new S;s=!1,d===-1?(t[c]=0,s=!0):d===n&&(t[c]=n-1,s=!0),g===-1?(t[c+1]=0,s=!0):g===r&&(t[c+1]=r-1,s=!0)}}}class Dt{constructor(e,t,n,r,s,c,d,g,x){this.a11=e,this.a21=t,this.a31=n,this.a12=r,this.a22=s,this.a32=c,this.a13=d,this.a23=g,this.a33=x}static quadrilateralToQuadrilateral(e,t,n,r,s,c,d,g,x,E,A,I,O,L,F,q){const J=Dt.quadrilateralToSquare(e,t,n,r,s,c,d,g);return Dt.squareToQuadrilateral(x,E,A,I,O,L,F,q).times(J)}transformPoints(e){const t=e.length,n=this.a11,r=this.a12,s=this.a13,c=this.a21,d=this.a22,g=this.a23,x=this.a31,E=this.a32,A=this.a33;for(let I=0;I<t;I+=2){const O=e[I],L=e[I+1],F=s*O+g*L+A;e[I]=(n*O+c*L+x)/F,e[I+1]=(r*O+d*L+E)/F}}transformPointsWithValues(e,t){const n=this.a11,r=this.a12,s=this.a13,c=this.a21,d=this.a22,g=this.a23,x=this.a31,E=this.a32,A=this.a33,I=e.length;for(let O=0;O<I;O++){const L=e[O],F=t[O],q=s*L+g*F+A;e[O]=(n*L+c*F+x)/q,t[O]=(r*L+d*F+E)/q}}static squareToQuadrilateral(e,t,n,r,s,c,d,g){const x=e-n+s-d,E=t-r+c-g;if(x===0&&E===0)return new Dt(n-e,s-n,e,r-t,c-r,t,0,0,1);{const A=n-s,I=d-s,O=r-c,L=g-c,F=A*L-I*O,q=(x*L-I*E)/F,J=(A*E-x*O)/F;return new Dt(n-e+q*n,d-e+J*d,e,r-t+q*r,g-t+J*g,t,q,J,1)}}static quadrilateralToSquare(e,t,n,r,s,c,d,g){return Dt.squareToQuadrilateral(e,t,n,r,s,c,d,g).buildAdjoint()}buildAdjoint(){return new Dt(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 Dt(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 yi extends nr{sampleGrid(e,t,n,r,s,c,d,g,x,E,A,I,O,L,F,q,J,ce,ue){const ae=Dt.quadrilateralToQuadrilateral(r,s,c,d,g,x,E,A,I,O,L,F,q,J,ce,ue);return this.sampleGridWithTransform(e,t,n,ae)}sampleGridWithTransform(e,t,n,r){if(t<=0||n<=0)throw new S;const s=new X(t,n),c=new Float32Array(2*t);for(let d=0;d<n;d++){const g=c.length,x=d+.5;for(let E=0;E<g;E+=2)c[E]=E/2+.5,c[E+1]=x;r.transformPoints(c),nr.checkAndNudgePoints(e,c);try{for(let E=0;E<g;E+=2)e.get(Math.floor(c[E]),Math.floor(c[E+1]))&&s.set(E/2,d)}catch{throw new S}}return s}}class dn{static setGridSampler(e){dn.gridSampler=e}static getInstance(){return dn.gridSampler}}dn.gridSampler=new yi;class Ot{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 be{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 c=n[0];n[0]=n[2],n[2]=c}this.extractParameters(n);let r=this.sampleGrid(this.image,n[this.shift%4],n[(this.shift+1)%4],n[(this.shift+2)%4],n[(this.shift+3)%4]),s=this.getMatrixCornerPoints(n);return new Ei(r,s,this.compact,this.nbDataBlocks,this.nbLayers)}extractParameters(e){if(!this.isValidPoint(e[0])||!this.isValidPoint(e[1])||!this.isValidPoint(e[2])||!this.isValidPoint(e[3]))throw new S;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 r=0;for(let c=0;c<4;c++){let d=n[(this.shift+c)%4];this.compact?(r<<=7,r+=d>>1&127):(r<<=10,r+=(d>>2&992)+(d>>1&31))}let s=this.getCorrectedParameterData(r,this.compact);this.compact?(this.nbLayers=(s>>6)+1,this.nbDataBlocks=(s&63)+1):(this.nbLayers=(s>>11)+1,this.nbDataBlocks=(s&2047)+1)}getRotation(e,t){let n=0;e.forEach((r,s,c)=>{let d=(r>>t-2<<1)+(r&1);n=(n<<3)+d}),n=((n&1)<<11)+(n>>1);for(let r=0;r<4;r++)if(k.bitCount(n^this.EXPECTED_CORNER_BITS[r])<=2)return r;throw new S}getCorrectedParameterData(e,t){let n,r;t?(n=7,r=2):(n=10,r=4);let s=n-r,c=new Int32Array(n);for(let g=n-1;g>=0;--g)c[g]=e&15,e>>=4;try{new jt(Ee.AZTEC_PARAM).decode(c,s)}catch{throw new S}let d=0;for(let g=0;g<r;g++)d=(d<<4)+c[g];return d}getBullsEyeCorners(e){let t=e,n=e,r=e,s=e,c=!0;for(this.nbCenterLayers=1;this.nbCenterLayers<9;this.nbCenterLayers++){let A=this.getFirstDifferent(t,c,1,-1),I=this.getFirstDifferent(n,c,1,1),O=this.getFirstDifferent(r,c,-1,1),L=this.getFirstDifferent(s,c,-1,-1);if(this.nbCenterLayers>2){let F=this.distancePoint(L,A)*this.nbCenterLayers/(this.distancePoint(s,t)*(this.nbCenterLayers+2));if(F<.75||F>1.25||!this.isWhiteOrBlackRectangle(A,I,O,L))break}t=A,n=I,r=O,s=L,c=!c}if(this.nbCenterLayers!==5&&this.nbCenterLayers!==7)throw new S;this.compact=this.nbCenterLayers===5;let d=new ye(t.getX()+.5,t.getY()-.5),g=new ye(n.getX()+.5,n.getY()+.5),x=new ye(r.getX()-.5,r.getY()+.5),E=new ye(s.getX()-.5,s.getY()-.5);return this.expandSquare([d,g,x,E],2*this.nbCenterLayers-3,2*this.nbCenterLayers)}getMatrixCenter(){let e,t,n,r;try{let d=new bn(this.image).detect();e=d[0],t=d[1],n=d[2],r=d[3]}catch{let g=this.image.getWidth()/2,x=this.image.getHeight()/2;e=this.getFirstDifferent(new Ot(g+7,x-7),!1,1,-1).toResultPoint(),t=this.getFirstDifferent(new Ot(g+7,x+7),!1,1,1).toResultPoint(),n=this.getFirstDifferent(new Ot(g-7,x+7),!1,-1,1).toResultPoint(),r=this.getFirstDifferent(new Ot(g-7,x-7),!1,-1,-1).toResultPoint()}let s=ze.round((e.getX()+r.getX()+t.getX()+n.getX())/4),c=ze.round((e.getY()+r.getY()+t.getY()+n.getY())/4);try{let d=new bn(this.image,15,s,c).detect();e=d[0],t=d[1],n=d[2],r=d[3]}catch{e=this.getFirstDifferent(new Ot(s+7,c-7),!1,1,-1).toResultPoint(),t=this.getFirstDifferent(new Ot(s+7,c+7),!1,1,1).toResultPoint(),n=this.getFirstDifferent(new Ot(s-7,c+7),!1,-1,1).toResultPoint(),r=this.getFirstDifferent(new Ot(s-7,c-7),!1,-1,-1).toResultPoint()}return s=ze.round((e.getX()+r.getX()+t.getX()+n.getX())/4),c=ze.round((e.getY()+r.getY()+t.getY()+n.getY())/4),new Ot(s,c)}getMatrixCornerPoints(e){return this.expandSquare(e,2*this.nbCenterLayers,this.getDimension())}sampleGrid(e,t,n,r,s){let c=dn.getInstance(),d=this.getDimension(),g=d/2-this.nbCenterLayers,x=d/2+this.nbCenterLayers;return c.sampleGrid(e,d,d,g,g,x,g,x,x,g,x,t.getX(),t.getY(),n.getX(),n.getY(),r.getX(),r.getY(),s.getX(),s.getY())}sampleLine(e,t,n){let r=0,s=this.distanceResultPoint(e,t),c=s/n,d=e.getX(),g=e.getY(),x=c*(t.getX()-e.getX())/s,E=c*(t.getY()-e.getY())/s;for(let A=0;A<n;A++)this.image.get(ze.round(d+A*x),ze.round(g+A*E))&&(r|=1<<n-A-1);return r}isWhiteOrBlackRectangle(e,t,n,r){let s=3;e=new Ot(e.getX()-s,e.getY()+s),t=new Ot(t.getX()-s,t.getY()-s),n=new Ot(n.getX()+s,n.getY()-s),r=new Ot(r.getX()+s,r.getY()+s);let c=this.getColor(r,e);if(c===0)return!1;let d=this.getColor(e,t);return d!==c||(d=this.getColor(t,n),d!==c)?!1:(d=this.getColor(n,r),d===c)}getColor(e,t){let n=this.distancePoint(e,t),r=(t.getX()-e.getX())/n,s=(t.getY()-e.getY())/n,c=0,d=e.getX(),g=e.getY(),x=this.image.get(e.getX(),e.getY()),E=Math.ceil(n);for(let I=0;I<E;I++)d+=r,g+=s,this.image.get(ze.round(d),ze.round(g))!==x&&c++;let A=c/n;return A>.1&&A<.9?0:A<=.1===x?1:-1}getFirstDifferent(e,t,n,r){let s=e.getX()+n,c=e.getY()+r;for(;this.isValid(s,c)&&this.image.get(s,c)===t;)s+=n,c+=r;for(s-=n,c-=r;this.isValid(s,c)&&this.image.get(s,c)===t;)s+=n;for(s-=n;this.isValid(s,c)&&this.image.get(s,c)===t;)c+=r;return c-=r,new Ot(s,c)}expandSquare(e,t,n){let r=n/(2*t),s=e[0].getX()-e[2].getX(),c=e[0].getY()-e[2].getY(),d=(e[0].getX()+e[2].getX())/2,g=(e[0].getY()+e[2].getY())/2,x=new ye(d+r*s,g+r*c),E=new ye(d-r*s,g-r*c);s=e[1].getX()-e[3].getX(),c=e[1].getY()-e[3].getY(),d=(e[1].getX()+e[3].getX())/2,g=(e[1].getY()+e[3].getY())/2;let A=new ye(d+r*s,g+r*c),I=new ye(d-r*s,g-r*c);return[x,A,E,I]}isValid(e,t){return e>=0&&e<this.image.getWidth()&&t>0&&t<this.image.getHeight()}isValidPoint(e){let t=ze.round(e.getX()),n=ze.round(e.getY());return this.isValid(t,n)}distancePoint(e,t){return ze.distance(e.getX(),e.getY(),t.getX(),t.getY())}distanceResultPoint(e,t){return ze.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*(k.truncDivision(this.nbLayers-4,8)+1)+15}}class le{decode(e,t=null){let n=null,r=new be(e.getBlackMatrix()),s=null,c=null;try{let E=r.detectMirror(!1);s=E.getPoints(),this.reportFoundResultPoints(t,s),c=new He().decode(E)}catch(E){n=E}if(c==null)try{let E=r.detectMirror(!0);s=E.getPoints(),this.reportFoundResultPoints(t,s),c=new He().decode(E)}catch(E){throw n??E}let d=new _e(c.getText(),c.getRawBytes(),c.getNumBits(),s,fe.AZTEC,P.currentTimeMillis()),g=c.getByteSegments();g!=null&&d.putMetadata(Xe.BYTE_SEGMENTS,g);let x=c.getECLevel();return x!=null&&d.putMetadata(Xe.ERROR_CORRECTION_LEVEL,x),d}reportFoundResultPoints(e,t){if(e!=null){let n=e.get(ne.NEED_RESULT_POINT_CALLBACK);n!=null&&t.forEach((r,s,c)=>{n.foundPossibleResultPoint(r)})}}reset(){}}class Qe extends Ne{constructor(e=500){super(new le,e)}}class Ke{decode(e,t){try{return this.doDecode(e,t)}catch{if(t&&t.get(ne.TRY_HARDER)===!0&&e.isRotateSupported()){const s=e.rotateCounterClockwise(),c=this.doDecode(s,t),d=c.getResultMetadata();let g=270;d!==null&&d.get(Xe.ORIENTATION)===!0&&(g=g+d.get(Xe.ORIENTATION)%360),c.putMetadata(Xe.ORIENTATION,g);const x=c.getResultPoints();if(x!==null){const E=s.getHeight();for(let A=0;A<x.length;A++)x[A]=new ye(E-x[A].getY()-1,x[A].getX())}return c}else throw new S}}reset(){}doDecode(e,t){const n=e.getWidth(),r=e.getHeight();let s=new V(n);const c=t&&t.get(ne.TRY_HARDER)===!0,d=Math.max(1,r>>(c?8:5));let g;c?g=r:g=15;const x=Math.trunc(r/2);for(let E=0;E<g;E++){const A=Math.trunc((E+1)/2),I=(E&1)===0,O=x+d*(I?A:-A);if(O<0||O>=r)break;try{s=e.getBlackRow(O,s)}catch{continue}for(let L=0;L<2;L++){if(L===1&&(s.reverse(),t&&t.get(ne.NEED_RESULT_POINT_CALLBACK)===!0)){const F=new Map;t.forEach((q,J)=>F.set(J,q)),F.delete(ne.NEED_RESULT_POINT_CALLBACK),t=F}try{const F=this.decodeRow(O,s,t);if(L===1){F.putMetadata(Xe.ORIENTATION,180);const q=F.getResultPoints();q!==null&&(q[0]=new ye(n-q[0].getX()-1,q[0].getY()),q[1]=new ye(n-q[1].getX()-1,q[1].getY()))}return F}catch{}}}throw new S}static recordPattern(e,t,n){const r=n.length;for(let x=0;x<r;x++)n[x]=0;const s=e.getSize();if(t>=s)throw new S;let c=!e.get(t),d=0,g=t;for(;g<s;){if(e.get(g)!==c)n[d]++;else{if(++d===r)break;n[d]=1,c=!c}g++}if(!(d===r||d===r-1&&g===s))throw new S}static recordPatternInReverse(e,t,n){let r=n.length,s=e.get(t);for(;t>0&&r>=0;)e.get(--t)!==s&&(r--,s=!s);if(r>=0)throw new S;Ke.recordPattern(e,t+1,n)}static patternMatchVariance(e,t,n){const r=e.length;let s=0,c=0;for(let x=0;x<r;x++)s+=e[x],c+=t[x];if(s<c)return Number.POSITIVE_INFINITY;const d=s/c;n*=d;let g=0;for(let x=0;x<r;x++){const E=e[x],A=t[x]*d,I=E>A?E-A:A-E;if(I>n)return Number.POSITIVE_INFINITY;g+=I}return g/s}}class de extends Ke{static findStartPattern(e){const t=e.getSize(),n=e.getNextSet(0);let r=0,s=Int32Array.from([0,0,0,0,0,0]),c=n,d=!1;const g=6;for(let x=n;x<t;x++)if(e.get(x)!==d)s[r]++;else{if(r===g-1){let E=de.MAX_AVG_VARIANCE,A=-1;for(let I=de.CODE_START_A;I<=de.CODE_START_C;I++){const O=Ke.patternMatchVariance(s,de.CODE_PATTERNS[I],de.MAX_INDIVIDUAL_VARIANCE);O<E&&(E=O,A=I)}if(A>=0&&e.isRange(Math.max(0,c-(x-c)/2),c,!1))return Int32Array.from([c,x,A]);c+=s[0]+s[1],s=s.slice(2,s.length-1),s[r-1]=0,s[r]=0,r--}else r++;s[r]=1,d=!d}throw new S}static decodeCode(e,t,n){Ke.recordPattern(e,n,t);let r=de.MAX_AVG_VARIANCE,s=-1;for(let c=0;c<de.CODE_PATTERNS.length;c++){const d=de.CODE_PATTERNS[c],g=this.patternMatchVariance(t,d,de.MAX_INDIVIDUAL_VARIANCE);g<r&&(r=g,s=c)}if(s>=0)return s;throw new S}decodeRow(e,t,n){const r=n&&n.get(ne.ASSUME_GS1)===!0,s=de.findStartPattern(t),c=s[2];let d=0;const g=new Uint8Array(20);g[d++]=c;let x;switch(c){case de.CODE_START_A:x=de.CODE_CODE_A;break;case de.CODE_START_B:x=de.CODE_CODE_B;break;case de.CODE_START_C:x=de.CODE_CODE_C;break;default:throw new U}let E=!1,A=!1,I="",O=s[0],L=s[1];const F=Int32Array.from([0,0,0,0,0,0]);let q=0,J=0,ce=c,ue=0,ae=!0,Ge=!1,ve=!1;for(;!E;){const Tr=A;switch(A=!1,q=J,J=de.decodeCode(t,F,L),g[d++]=J,J!==de.CODE_STOP&&(ae=!0),J!==de.CODE_STOP&&(ue++,ce+=ue*J),O=L,L+=F.reduce((Og,Bg)=>Og+Bg,0),J){case de.CODE_START_A:case de.CODE_START_B:case de.CODE_START_C:throw new U}switch(x){case de.CODE_CODE_A:if(J<64)ve===Ge?I+=String.fromCharCode(32+J):I+=String.fromCharCode(32+J+128),ve=!1;else if(J<96)ve===Ge?I+=String.fromCharCode(J-64):I+=String.fromCharCode(J+64),ve=!1;else switch(J!==de.CODE_STOP&&(ae=!1),J){case de.CODE_FNC_1:r&&(I.length===0?I+="]C1":I+="");break;case de.CODE_FNC_2:case de.CODE_FNC_3:break;case de.CODE_FNC_4_A:!Ge&&ve?(Ge=!0,ve=!1):Ge&&ve?(Ge=!1,ve=!1):ve=!0;break;case de.CODE_SHIFT:A=!0,x=de.CODE_CODE_B;break;case de.CODE_CODE_B:x=de.CODE_CODE_B;break;case de.CODE_CODE_C:x=de.CODE_CODE_C;break;case de.CODE_STOP:E=!0;break}break;case de.CODE_CODE_B:if(J<96)ve===Ge?I+=String.fromCharCode(32+J):I+=String.fromCharCode(32+J+128),ve=!1;else switch(J!==de.CODE_STOP&&(ae=!1),J){case de.CODE_FNC_1:r&&(I.length===0?I+="]C1":I+="");break;case de.CODE_FNC_2:case de.CODE_FNC_3:break;case de.CODE_FNC_4_B:!Ge&&ve?(Ge=!0,ve=!1):Ge&&ve?(Ge=!1,ve=!1):ve=!0;break;case de.CODE_SHIFT:A=!0,x=de.CODE_CODE_A;break;case de.CODE_CODE_A:x=de.CODE_CODE_A;break;case de.CODE_CODE_C:x=de.CODE_CODE_C;break;case de.CODE_STOP:E=!0;break}break;case de.CODE_CODE_C:if(J<100)J<10&&(I+="0"),I+=J;else switch(J!==de.CODE_STOP&&(ae=!1),J){case de.CODE_FNC_1:r&&(I.length===0?I+="]C1":I+="");break;case de.CODE_CODE_A:x=de.CODE_CODE_A;break;case de.CODE_CODE_B:x=de.CODE_CODE_B;break;case de.CODE_STOP:E=!0;break}break}Tr&&(x=x===de.CODE_CODE_A?de.CODE_CODE_B:de.CODE_CODE_A)}const nn=L-O;if(L=t.getNextUnset(L),!t.isRange(L,Math.min(t.getSize(),L+(L-O)/2),!1))throw new S;if(ce-=ue*q,ce%103!==q)throw new B;const An=I.length;if(An===0)throw new S;An>0&&ae&&(x===de.CODE_CODE_C?I=I.substring(0,An-2):I=I.substring(0,An-1));const rn=(s[1]+s[0])/2,lt=O+nn/2,Ut=g.length,ln=new Uint8Array(Ut);for(let Tr=0;Tr<Ut;Tr++)ln[Tr]=g[Tr];const Nr=[new ye(rn,e),new ye(lt,e)];return new _e(I,ln,0,Nr,fe.CODE_128,new Date().getTime())}}de.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])],de.MAX_AVG_VARIANCE=.25,de.MAX_INDIVIDUAL_VARIANCE=.7,de.CODE_SHIFT=98,de.CODE_CODE_C=99,de.CODE_CODE_B=100,de.CODE_CODE_A=101,de.CODE_FNC_1=102,de.CODE_FNC_2=97,de.CODE_FNC_3=96,de.CODE_FNC_4_A=101,de.CODE_FNC_4_B=100,de.CODE_START_A=103,de.CODE_START_B=104,de.CODE_START_C=105,de.CODE_STOP=106;class ft extends Ke{constructor(e=!1,t=!1){super(),this.usingCheckDigit=e,this.extendedMode=t,this.decodeRowResult="",this.counters=new Int32Array(9)}decodeRow(e,t,n){let r=this.counters;r.fill(0),this.decodeRowResult="";let s=ft.findAsteriskPattern(t,r),c=t.getNextSet(s[1]),d=t.getSize(),g,x;do{ft.recordPattern(t,c,r);let F=ft.toNarrowWidePattern(r);if(F<0)throw new S;g=ft.patternToChar(F),this.decodeRowResult+=g,x=c;for(let q of r)c+=q;c=t.getNextSet(c)}while(g!=="*");this.decodeRowResult=this.decodeRowResult.substring(0,this.decodeRowResult.length-1);let E=0;for(let F of r)E+=F;let A=c-x-E;if(c!==d&&A*2<E)throw new S;if(this.usingCheckDigit){let F=this.decodeRowResult.length-1,q=0;for(let J=0;J<F;J++)q+=ft.ALPHABET_STRING.indexOf(this.decodeRowResult.charAt(J));if(this.decodeRowResult.charAt(F)!==ft.ALPHABET_STRING.charAt(q%43))throw new B;this.decodeRowResult=this.decodeRowResult.substring(0,F)}if(this.decodeRowResult.length===0)throw new S;let I;this.extendedMode?I=ft.decodeExtended(this.decodeRowResult):I=this.decodeRowResult;let O=(s[1]+s[0])/2,L=x+E/2;return new _e(I,null,0,[new ye(O,e),new ye(L,e)],fe.CODE_39,new Date().getTime())}static findAsteriskPattern(e,t){let n=e.getSize(),r=e.getNextSet(0),s=0,c=r,d=!1,g=t.length;for(let x=r;x<n;x++)if(e.get(x)!==d)t[s]++;else{if(s===g-1){if(this.toNarrowWidePattern(t)===ft.ASTERISK_ENCODING&&e.isRange(Math.max(0,c-Math.floor((x-c)/2)),c,!1))return[c,x];c+=t[0]+t[1],t.copyWithin(0,2,2+s-1),t[s-1]=0,t[s]=0,s--}else s++;t[s]=1,d=!d}throw new S}static toNarrowWidePattern(e){let t=e.length,n=0,r;do{let s=2147483647;for(let g of e)g<s&&g>n&&(s=g);n=s,r=0;let c=0,d=0;for(let g=0;g<t;g++){let x=e[g];x>n&&(d|=1<<t-1-g,r++,c+=x)}if(r===3){for(let g=0;g<t&&r>0;g++){let x=e[g];if(x>n&&(r--,x*2>=c))return-1}return d}}while(r>3);return-1}static patternToChar(e){for(let t=0;t<ft.CHARACTER_ENCODINGS.length;t++)if(ft.CHARACTER_ENCODINGS[t]===e)return ft.ALPHABET_STRING.charAt(t);if(e===ft.ASTERISK_ENCODING)return"*";throw new S}static decodeExtended(e){let t=e.length,n="";for(let r=0;r<t;r++){let s=e.charAt(r);if(s==="+"||s==="$"||s==="%"||s==="/"){let c=e.charAt(r+1),d="\0";switch(s){case"+":if(c>="A"&&c<="Z")d=String.fromCharCode(c.charCodeAt(0)+32);else throw new U;break;case"$":if(c>="A"&&c<="Z")d=String.fromCharCode(c.charCodeAt(0)-64);else throw new U;break;case"%":if(c>="A"&&c<="E")d=String.fromCharCode(c.charCodeAt(0)-38);else if(c>="F"&&c<="J")d=String.fromCharCode(c.charCodeAt(0)-11);else if(c>="K"&&c<="O")d=String.fromCharCode(c.charCodeAt(0)+16);else if(c>="P"&&c<="T")d=String.fromCharCode(c.charCodeAt(0)+43);else if(c==="U")d="\0";else if(c==="V")d="@";else if(c==="W")d="`";else if(c==="X"||c==="Y"||c==="Z")d="";else throw new U;break;case"/":if(c>="A"&&c<="O")d=String.fromCharCode(c.charCodeAt(0)-32);else if(c==="Z")d=":";else throw new U;break}n+=d,r++}else n+=s}return n}}ft.ALPHABET_STRING="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%",ft.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],ft.ASTERISK_ENCODING=148;class Ye extends Ke{constructor(){super(...arguments),this.narrowLineWidth=-1}decodeRow(e,t,n){let r=this.decodeStart(t),s=this.decodeEnd(t),c=new Z;Ye.decodeMiddle(t,r[1],s[0],c);let d=c.toString(),g=null;n!=null&&(g=n.get(ne.ALLOWED_LENGTHS)),g==null&&(g=Ye.DEFAULT_ALLOWED_LENGTHS);let x=d.length,E=!1,A=0;for(let L of g){if(x===L){E=!0;break}L>A&&(A=L)}if(!E&&x>A&&(E=!0),!E)throw new U;const I=[new ye(r[1],e),new ye(s[0],e)];return new _e(d,null,0,I,fe.ITF,new Date().getTime())}static decodeMiddle(e,t,n,r){let s=new Int32Array(10),c=new Int32Array(5),d=new Int32Array(5);for(s.fill(0),c.fill(0),d.fill(0);t<n;){Ke.recordPattern(e,t,s);for(let x=0;x<5;x++){let E=2*x;c[x]=s[E],d[x]=s[E+1]}let g=Ye.decodeDigit(c);r.append(g.toString()),g=this.decodeDigit(d),r.append(g.toString()),s.forEach(function(x){t+=x})}}decodeStart(e){let t=Ye.skipWhiteSpace(e),n=Ye.findGuardPattern(e,t,Ye.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 r=t-1;n>0&&r>=0&&!e.get(r);r--)n--;if(n!==0)throw new S}static skipWhiteSpace(e){const t=e.getSize(),n=e.getNextSet(0);if(n===t)throw new S;return n}decodeEnd(e){e.reverse();try{let t=Ye.skipWhiteSpace(e),n;try{n=Ye.findGuardPattern(e,t,Ye.END_PATTERN_REVERSED[0])}catch(s){s instanceof S&&(n=Ye.findGuardPattern(e,t,Ye.END_PATTERN_REVERSED[1]))}this.validateQuietZone(e,n[0]);let r=n[0];return n[0]=e.getSize()-n[1],n[1]=e.getSize()-r,n}finally{e.reverse()}}static findGuardPattern(e,t,n){let r=n.length,s=new Int32Array(r),c=e.getSize(),d=!1,g=0,x=t;s.fill(0);for(let E=t;E<c;E++)if(e.get(E)!==d)s[g]++;else{if(g===r-1){if(Ke.patternMatchVariance(s,n,Ye.MAX_INDIVIDUAL_VARIANCE)<Ye.MAX_AVG_VARIANCE)return[x,E];x+=s[0]+s[1],P.arraycopy(s,2,s,0,g-1),s[g-1]=0,s[g]=0,g--}else g++;s[g]=1,d=!d}throw new S}static decodeDigit(e){let t=Ye.MAX_AVG_VARIANCE,n=-1,r=Ye.PATTERNS.length;for(let s=0;s<r;s++){let c=Ye.PATTERNS[s],d=Ke.patternMatchVariance(e,c,Ye.MAX_INDIVIDUAL_VARIANCE);d<t?(t=d,n=s):d===t&&(n=-1)}if(n>=0)return n%10;throw new S}}Ye.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])],Ye.MAX_AVG_VARIANCE=.38,Ye.MAX_INDIVIDUAL_VARIANCE=.5,Ye.DEFAULT_ALLOWED_LENGTHS=[6,8,10,12,14],Ye.START_PATTERN=Int32Array.from([1,1,1,1]),Ye.END_PATTERN_REVERSED=[Int32Array.from([1,1,2]),Int32Array.from([1,1,3])];class rt extends Ke{constructor(){super(...arguments),this.decodeRowStringBuffer=""}static findStartGuardPattern(e){let t=!1,n,r=0,s=Int32Array.from([0,0,0]);for(;!t;){s=Int32Array.from([0,0,0]),n=rt.findGuardPattern(e,r,!1,this.START_END_PATTERN,s);let c=n[0];r=n[1];let d=c-(r-c);d>=0&&(t=e.isRange(d,c,!1))}return n}static checkChecksum(e){return rt.checkStandardUPCEANChecksum(e)}static checkStandardUPCEANChecksum(e){let t=e.length;if(t===0)return!1;let n=parseInt(e.charAt(t-1),10);return rt.getStandardUPCEANChecksum(e.substring(0,t-1))===n}static getStandardUPCEANChecksum(e){let t=e.length,n=0;for(let r=t-1;r>=0;r-=2){let s=e.charAt(r).charCodeAt(0)-48;if(s<0||s>9)throw new U;n+=s}n*=3;for(let r=t-2;r>=0;r-=2){let s=e.charAt(r).charCodeAt(0)-48;if(s<0||s>9)throw new U;n+=s}return(1e3-n)%10}static decodeEnd(e,t){return rt.findGuardPattern(e,t,!1,rt.START_END_PATTERN,new Int32Array(rt.START_END_PATTERN.length).fill(0))}static findGuardPatternWithoutCounters(e,t,n,r){return this.findGuardPattern(e,t,n,r,new Int32Array(r.length))}static findGuardPattern(e,t,n,r,s){let c=e.getSize();t=n?e.getNextUnset(t):e.getNextSet(t);let d=0,g=t,x=r.length,E=n;for(let A=t;A<c;A++)if(e.get(A)!==E)s[d]++;else{if(d===x-1){if(Ke.patternMatchVariance(s,r,rt.MAX_INDIVIDUAL_VARIANCE)<rt.MAX_AVG_VARIANCE)return Int32Array.from([g,A]);g+=s[0]+s[1];let I=s.slice(2,s.length-1);for(let O=0;O<d-1;O++)s[O]=I[O];s[d-1]=0,s[d]=0,d--}else d++;s[d]=1,E=!E}throw new S}static decodeDigit(e,t,n,r){this.recordPattern(e,n,t);let s=this.MAX_AVG_VARIANCE,c=-1,d=r.length;for(let g=0;g<d;g++){let x=r[g],E=Ke.patternMatchVariance(t,x,rt.MAX_INDIVIDUAL_VARIANCE);E<s&&(s=E,c=g)}if(c>=0)return c;throw new S}}rt.MAX_AVG_VARIANCE=.48,rt.MAX_INDIVIDUAL_VARIANCE=.7,rt.START_END_PATTERN=Int32Array.from([1,1,1]),rt.MIDDLE_PATTERN=Int32Array.from([1,1,1,1,1]),rt.END_PATTERN=Int32Array.from([1,1,1,1,1,1]),rt.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 Ve{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 r=this.decodeRowStringBuffer,s=this.decodeMiddle(t,n,r),c=r.toString(),d=Ve.parseExtensionString(c),g=[new ye((n[0]+n[1])/2,e),new ye(s,e)],x=new _e(c,null,0,g,fe.UPC_EAN_EXTENSION,new Date().getTime());return d!=null&&x.putAllMetadata(d),x}decodeMiddle(e,t,n){let r=this.decodeMiddleCounters;r[0]=0,r[1]=0,r[2]=0,r[3]=0;let s=e.getSize(),c=t[1],d=0;for(let x=0;x<5&&c<s;x++){let E=rt.decodeDigit(e,r,c,rt.L_AND_G_PATTERNS);n+=String.fromCharCode(48+E%10);for(let A of r)c+=A;E>=10&&(d|=1<<4-x),x!==4&&(c=e.getNextSet(c),c=e.getNextUnset(c))}if(n.length!==5)throw new S;let g=this.determineCheckDigit(d);if(Ve.extensionChecksum(n.toString())!==g)throw new S;return c}static extensionChecksum(e){let t=e.length,n=0;for(let r=t-2;r>=0;r-=2)n+=e.charAt(r).charCodeAt(0)-48;n*=3;for(let r=t-1;r>=0;r-=2)n+=e.charAt(r).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 S}static parseExtensionString(e){if(e.length!==5)return null;let t=Ve.parseExtension5String(e);return t==null?null:new Map([[Xe.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)),r=(n/100).toString(),s=n%100,c=s<10?"0"+s:s.toString();return t+r+"."+c}}class Zt{constructor(){this.decodeMiddleCounters=Int32Array.from([0,0,0,0]),this.decodeRowStringBuffer=""}decodeRow(e,t,n){let r=this.decodeRowStringBuffer,s=this.decodeMiddle(t,n,r),c=r.toString(),d=Zt.parseExtensionString(c),g=[new ye((n[0]+n[1])/2,e),new ye(s,e)],x=new _e(c,null,0,g,fe.UPC_EAN_EXTENSION,new Date().getTime());return d!=null&&x.putAllMetadata(d),x}decodeMiddle(e,t,n){let r=this.decodeMiddleCounters;r[0]=0,r[1]=0,r[2]=0,r[3]=0;let s=e.getSize(),c=t[1],d=0;for(let g=0;g<2&&c<s;g++){let x=rt.decodeDigit(e,r,c,rt.L_AND_G_PATTERNS);n+=String.fromCharCode(48+x%10);for(let E of r)c+=E;x>=10&&(d|=1<<1-g),g!==1&&(c=e.getNextSet(c),c=e.getNextUnset(c))}if(n.length!==2)throw new S;if(parseInt(n.toString())%4!==d)throw new S;return c}static parseExtensionString(e){return e.length!==2?null:new Map([[Xe.ISSUE_NUMBER,parseInt(e)]])}}class Nt{static decodeRow(e,t,n){let r=rt.findGuardPattern(t,n,!1,this.EXTENSION_START_PATTERN,new Int32Array(this.EXTENSION_START_PATTERN.length).fill(0));try{return new Ve().decodeRow(e,t,r)}catch{return new Zt().decodeRow(e,t,r)}}}Nt.EXTENSION_START_PATTERN=Int32Array.from([1,1,2]);class De extends rt{constructor(){super(),this.decodeRowStringBuffer="",De.L_AND_G_PATTERNS=De.L_PATTERNS.map(e=>Int32Array.from(e));for(let e=10;e<20;e++){let t=De.L_PATTERNS[e-10],n=new Int32Array(t.length);for(let r=0;r<t.length;r++)n[r]=t[t.length-r-1];De.L_AND_G_PATTERNS[e]=n}}decodeRow(e,t,n){let r=De.findStartGuardPattern(t),s=n==null?null:n.get(ne.NEED_RESULT_POINT_CALLBACK);if(s!=null){const ae=new ye((r[0]+r[1])/2,e);s.foundPossibleResultPoint(ae)}let c=this.decodeMiddle(t,r,this.decodeRowStringBuffer),d=c.rowOffset,g=c.resultString;if(s!=null){const ae=new ye(d,e);s.foundPossibleResultPoint(ae)}let x=this.decodeEnd(t,d);if(s!=null){const ae=new ye((x[0]+x[1])/2,e);s.foundPossibleResultPoint(ae)}let E=x[1],A=E+(E-x[0]);if(A>=t.getSize()||!t.isRange(E,A,!1))throw new S;let I=g.toString();if(I.length<8)throw new U;if(!De.checkChecksum(I))throw new B;let O=(r[1]+r[0])/2,L=(x[1]+x[0])/2,F=this.getBarcodeFormat(),q=[new ye(O,e),new ye(L,e)],J=new _e(I,null,0,q,F,new Date().getTime()),ce=0;try{let ae=Nt.decodeRow(e,t,x[1]);J.putMetadata(Xe.UPC_EAN_EXTENSION,ae.getText()),J.putAllMetadata(ae.getResultMetadata()),J.addResultPoints(ae.getResultPoints()),ce=ae.getText().length}catch{}let ue=n==null?null:n.get(ne.ALLOWED_EAN_EXTENSIONS);if(ue!=null){let ae=!1;for(let Ge in ue)if(ce.toString()===Ge){ae=!0;break}if(!ae)throw new S}return J}decodeEnd(e,t){return De.findGuardPattern(e,t,!1,De.START_END_PATTERN,new Int32Array(De.START_END_PATTERN.length).fill(0))}static checkChecksum(e){return De.checkStandardUPCEANChecksum(e)}static checkStandardUPCEANChecksum(e){let t=e.length;if(t===0)return!1;let n=parseInt(e.charAt(t-1),10);return De.getStandardUPCEANChecksum(e.substring(0,t-1))===n}static getStandardUPCEANChecksum(e){let t=e.length,n=0;for(let r=t-1;r>=0;r-=2){let s=e.charAt(r).charCodeAt(0)-48;if(s<0||s>9)throw new U;n+=s}n*=3;for(let r=t-2;r>=0;r-=2){let s=e.charAt(r).charCodeAt(0)-48;if(s<0||s>9)throw new U;n+=s}return(1e3-n)%10}}class yt extends De{constructor(){super(),this.decodeMiddleCounters=Int32Array.from([0,0,0,0])}decodeMiddle(e,t,n){let r=this.decodeMiddleCounters;r[0]=0,r[1]=0,r[2]=0,r[3]=0;let s=e.getSize(),c=t[1],d=0;for(let x=0;x<6&&c<s;x++){let E=De.decodeDigit(e,r,c,De.L_AND_G_PATTERNS);n+=String.fromCharCode(48+E%10);for(let A of r)c+=A;E>=10&&(d|=1<<5-x)}n=yt.determineFirstDigit(n,d),c=De.findGuardPattern(e,c,!0,De.MIDDLE_PATTERN,new Int32Array(De.MIDDLE_PATTERN.length).fill(0))[1];for(let x=0;x<6&&c<s;x++){let E=De.decodeDigit(e,r,c,De.L_PATTERNS);n+=String.fromCharCode(48+E);for(let A of r)c+=A}return{rowOffset:c,resultString:n}}getBarcodeFormat(){return fe.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 S}}yt.FIRST_DIGIT_ENCODINGS=[0,11,13,14,19,25,28,21,22,26];class Pt extends De{constructor(){super(),this.decodeMiddleCounters=Int32Array.from([0,0,0,0])}decodeMiddle(e,t,n){const r=this.decodeMiddleCounters;r[0]=0,r[1]=0,r[2]=0,r[3]=0;let s=e.getSize(),c=t[1];for(let g=0;g<4&&c<s;g++){let x=De.decodeDigit(e,r,c,De.L_PATTERNS);n+=String.fromCharCode(48+x);for(let E of r)c+=E}c=De.findGuardPattern(e,c,!0,De.MIDDLE_PATTERN,new Int32Array(De.MIDDLE_PATTERN.length).fill(0))[1];for(let g=0;g<4&&c<s;g++){let x=De.decodeDigit(e,r,c,De.L_PATTERNS);n+=String.fromCharCode(48+x);for(let E of r)c+=E}return{rowOffset:c,resultString:n}}getBarcodeFormat(){return fe.EAN_8}}class Lt extends De{constructor(){super(...arguments),this.ean13Reader=new yt}getBarcodeFormat(){return fe.UPC_A}decode(e,t){return this.maybeReturnResult(this.ean13Reader.decode(e))}decodeRow(e,t,n){return this.maybeReturnResult(this.ean13Reader.decodeRow(e,t,n))}decodeMiddle(e,t,n){return this.ean13Reader.decodeMiddle(e,t,n)}maybeReturnResult(e){let t=e.getText();if(t.charAt(0)==="0"){let n=new _e(t.substring(1),null,null,e.getResultPoints(),fe.UPC_A);return e.getResultMetadata()!=null&&n.putAllMetadata(e.getResultMetadata()),n}else throw new S}reset(){this.ean13Reader.reset()}}class xt extends De{constructor(){super(),this.decodeMiddleCounters=new Int32Array(4)}decodeMiddle(e,t,n){const r=this.decodeMiddleCounters.map(x=>x);r[0]=0,r[1]=0,r[2]=0,r[3]=0;const s=e.getSize();let c=t[1],d=0;for(let x=0;x<6&&c<s;x++){const E=xt.decodeDigit(e,r,c,xt.L_AND_G_PATTERNS);n+=String.fromCharCode(48+E%10);for(let A of r)c+=A;E>=10&&(d|=1<<5-x)}let g=xt.determineNumSysAndCheckDigit(n,d);return{rowOffset:c,resultString:g}}decodeEnd(e,t){return xt.findGuardPatternWithoutCounters(e,t,!0,xt.MIDDLE_END_PATTERN)}checkChecksum(e){return De.checkChecksum(xt.convertUPCEtoUPCA(e))}static determineNumSysAndCheckDigit(e,t){for(let n=0;n<=1;n++)for(let r=0;r<10;r++)if(t===this.NUMSYS_AND_CHECK_DIGIT_PATTERNS[n][r]){let s=String.fromCharCode(48+n),c=String.fromCharCode(48+r);return s+e+c}throw S.getNotFoundInstance()}getBarcodeFormat(){return fe.UPC_E}static convertUPCEtoUPCA(e){const t=e.slice(1,7).split("").map(s=>s.charCodeAt(0)),n=new Z;n.append(e.charAt(0));let r=t[5];switch(r){case 0:case 1:case 2:n.appendChars(t,0,2),n.append(r),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(r);break}return e.length>=8&&n.append(e.charAt(7)),n.toString()}}xt.MIDDLE_END_PATTERN=Int32Array.from([1,1,1,1,1,1]),xt.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 Vn extends Ke{constructor(e){super();let t=e==null?null:e.get(ne.POSSIBLE_FORMATS),n=[];u(t)?(n.push(new yt),n.push(new Lt),n.push(new Pt),n.push(new xt)):(t.indexOf(fe.EAN_13)>-1&&n.push(new yt),t.indexOf(fe.UPC_A)>-1&&n.push(new Lt),t.indexOf(fe.EAN_8)>-1&&n.push(new Pt),t.indexOf(fe.UPC_E)>-1&&n.push(new xt)),this.readers=n}decodeRow(e,t,n){for(let r of this.readers)try{const s=r.decodeRow(e,t,n),c=s.getBarcodeFormat()===fe.EAN_13&&s.getText().charAt(0)==="0",d=n==null?null:n.get(ne.POSSIBLE_FORMATS),g=d==null||d.includes(fe.UPC_A);if(c&&g){const x=s.getRawBytes(),E=new _e(s.getText().substring(1),x,x?x.length:null,s.getResultPoints(),fe.UPC_A);return E.putAllMetadata(s.getResultMetadata()),E}return s}catch{}throw new S}reset(){for(let e of this.readers)e.reset()}}class Bt extends Ke{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(Ke.patternMatchVariance(e,t[n],Bt.MAX_INDIVIDUAL_VARIANCE)<Bt.MAX_AVG_VARIANCE)return n;throw new S}static count(e){return ze.sum(new Int32Array(e))}static increment(e,t){let n=0,r=t[0];for(let s=1;s<e.length;s++)t[s]>r&&(r=t[s],n=s);e[n]++}static decrement(e,t){let n=0,r=t[0];for(let s=1;s<e.length;s++)t[s]<r&&(r=t[s],n=s);e[n]--}static isFinderPattern(e){let t=e[0]+e[1],n=t+e[2]+e[3],r=t/n;if(r>=Bt.MIN_FINDER_PATTERN_RATIO&&r<=Bt.MAX_FINDER_PATTERN_RATIO){let s=Number.MAX_SAFE_INTEGER,c=Number.MIN_SAFE_INTEGER;for(let d of e)d>c&&(c=d),d<s&&(s=d);return c<10*s}return!1}}Bt.MAX_AVG_VARIANCE=.2,Bt.MAX_INDIVIDUAL_VARIANCE=.45,Bt.MIN_FINDER_PATTERN_RATIO=9.5/12,Bt.MAX_FINDER_PATTERN_RATIO=12.5/14;class zn{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 zn))return!1;const t=e;return this.value===t.value&&this.checksumPortion===t.checksumPortion}hashCode(){return this.value^this.checksumPortion}}class bi{constructor(e,t,n,r,s){this.value=e,this.startEnd=t,this.value=e,this.startEnd=t,this.resultPoints=new Array,this.resultPoints.push(new ye(n,s)),this.resultPoints.push(new ye(r,s))}getValue(){return this.value}getStartEnd(){return this.startEnd}getResultPoints(){return this.resultPoints}equals(e){if(!(e instanceof bi))return!1;const t=e;return this.value===t.value}hashCode(){return this.value}}class Tn{constructor(){}static getRSSvalue(e,t,n){let r=0;for(let g of e)r+=g;let s=0,c=0,d=e.length;for(let g=0;g<d-1;g++){let x;for(x=1,c|=1<<g;x<e[g];x++,c&=~(1<<g)){let E=Tn.combins(r-x-1,d-g-2);if(n&&c===0&&r-x-(d-g-1)>=d-g-1&&(E-=Tn.combins(r-x-(d-g),d-g-2)),d-g-1>1){let A=0;for(let I=r-x-(d-g-2);I>t;I--)A+=Tn.combins(r-x-I-1,d-g-3);E-=A*(d-1-g)}else r-x>t&&E--;s+=E}r-=x}return s}static combins(e,t){let n,r;e-t>t?(r=t,n=e-t):(r=e-t,n=t);let s=1,c=1;for(let d=e;d>n;d--)s*=d,c<=r&&(s/=c,c++);for(;c<=r;)s/=c,c++;return s}}class rg{static buildBitArray(e){let t=e.length*2-1;e[e.length-1].getRightChar()==null&&(t-=1);let n=12*t,r=new V(n),s=0,d=e[0].getRightChar().getValue();for(let g=11;g>=0;--g)d&1<<g&&r.set(s),s++;for(let g=1;g<e.length;++g){let x=e[g],E=x.getLeftChar().getValue();for(let A=11;A>=0;--A)E&1<<A&&r.set(s),s++;if(x.getRightChar()!=null){let A=x.getRightChar().getValue();for(let I=11;I>=0;--I)A&1<<I&&r.set(s),s++}}return r}}class rr{constructor(e,t){t?this.decodedInformation=null:(this.finished=e,this.decodedInformation=t)}getDecodedInformation(){return this.decodedInformation}isFinished(){return this.finished}}class bo{constructor(e){this.newPosition=e}getNewPosition(){return this.newPosition}}class Jt extends bo{constructor(e,t){super(e),this.value=t}getValue(){return this.value}isFNC1(){return this.value===Jt.FNC1}}Jt.FNC1="$";class ir extends bo{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 fn extends bo{constructor(e,t,n){if(super(e),t<0||t>10||n<0||n>10)throw new U;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===fn.FNC1}isSecondDigitFNC1(){return this.secondDigit===fn.FNC1}isAnyFNC1(){return this.firstDigit===fn.FNC1||this.secondDigit===fn.FNC1}}fn.FNC1=10;class Ce{constructor(){}static parseFieldsInGeneralPurpose(e){if(!e)return null;if(e.length<2)throw new S;let t=e.substring(0,2);for(let s of Ce.TWO_DIGIT_DATA_LENGTH)if(s[0]===t)return s[1]===Ce.VARIABLE_LENGTH?Ce.processVariableAI(2,s[2],e):Ce.processFixedAI(2,s[1],e);if(e.length<3)throw new S;let n=e.substring(0,3);for(let s of Ce.THREE_DIGIT_DATA_LENGTH)if(s[0]===n)return s[1]===Ce.VARIABLE_LENGTH?Ce.processVariableAI(3,s[2],e):Ce.processFixedAI(3,s[1],e);for(let s of Ce.THREE_DIGIT_PLUS_DIGIT_DATA_LENGTH)if(s[0]===n)return s[1]===Ce.VARIABLE_LENGTH?Ce.processVariableAI(4,s[2],e):Ce.processFixedAI(4,s[1],e);if(e.length<4)throw new S;let r=e.substring(0,4);for(let s of Ce.FOUR_DIGIT_DATA_LENGTH)if(s[0]===r)return s[1]===Ce.VARIABLE_LENGTH?Ce.processVariableAI(4,s[2],e):Ce.processFixedAI(4,s[1],e);throw new S}static processFixedAI(e,t,n){if(n.length<e)throw new S;let r=n.substring(0,e);if(n.length<e+t)throw new S;let s=n.substring(e,e+t),c=n.substring(e+t),d="("+r+")"+s,g=Ce.parseFieldsInGeneralPurpose(c);return g==null?d:d+g}static processVariableAI(e,t,n){let r=n.substring(0,e),s;n.length<e+t?s=n.length:s=e+t;let c=n.substring(e,s),d=n.substring(s),g="("+r+")"+c,x=Ce.parseFieldsInGeneralPurpose(d);return x==null?g:g+x}}Ce.VARIABLE_LENGTH=[],Ce.TWO_DIGIT_DATA_LENGTH=[["00",18],["01",14],["02",14],["10",Ce.VARIABLE_LENGTH,20],["11",6],["12",6],["13",6],["15",6],["17",6],["20",2],["21",Ce.VARIABLE_LENGTH,20],["22",Ce.VARIABLE_LENGTH,29],["30",Ce.VARIABLE_LENGTH,8],["37",Ce.VARIABLE_LENGTH,8],["90",Ce.VARIABLE_LENGTH,30],["91",Ce.VARIABLE_LENGTH,30],["92",Ce.VARIABLE_LENGTH,30],["93",Ce.VARIABLE_LENGTH,30],["94",Ce.VARIABLE_LENGTH,30],["95",Ce.VARIABLE_LENGTH,30],["96",Ce.VARIABLE_LENGTH,30],["97",Ce.VARIABLE_LENGTH,3],["98",Ce.VARIABLE_LENGTH,30],["99",Ce.VARIABLE_LENGTH,30]],Ce.THREE_DIGIT_DATA_LENGTH=[["240",Ce.VARIABLE_LENGTH,30],["241",Ce.VARIABLE_LENGTH,30],["242",Ce.VARIABLE_LENGTH,6],["250",Ce.VARIABLE_LENGTH,30],["251",Ce.VARIABLE_LENGTH,30],["253",Ce.VARIABLE_LENGTH,17],["254",Ce.VARIABLE_LENGTH,20],["400",Ce.VARIABLE_LENGTH,30],["401",Ce.VARIABLE_LENGTH,30],["402",17],["403",Ce.VARIABLE_LENGTH,30],["410",13],["411",13],["412",13],["413",13],["414",13],["420",Ce.VARIABLE_LENGTH,20],["421",Ce.VARIABLE_LENGTH,15],["422",3],["423",Ce.VARIABLE_LENGTH,15],["424",3],["425",3],["426",3]],Ce.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",Ce.VARIABLE_LENGTH,15],["391",Ce.VARIABLE_LENGTH,18],["392",Ce.VARIABLE_LENGTH,15],["393",Ce.VARIABLE_LENGTH,18],["703",Ce.VARIABLE_LENGTH,30]],Ce.FOUR_DIGIT_DATA_LENGTH=[["7001",13],["7002",Ce.VARIABLE_LENGTH,30],["7003",10],["8001",14],["8002",Ce.VARIABLE_LENGTH,20],["8003",Ce.VARIABLE_LENGTH,30],["8004",Ce.VARIABLE_LENGTH,30],["8005",6],["8006",18],["8007",Ce.VARIABLE_LENGTH,30],["8008",Ce.VARIABLE_LENGTH,12],["8018",18],["8020",Ce.VARIABLE_LENGTH,25],["8100",6],["8101",10],["8102",2],["8110",Ce.VARIABLE_LENGTH,70],["8200",Ce.VARIABLE_LENGTH,70]];class Er{constructor(e){this.buffer=new Z,this.information=e}decodeAllCodes(e,t){let n=t,r=null;do{let s=this.decodeGeneralPurposeField(n,r),c=Ce.parseFieldsInGeneralPurpose(s.getNewString());if(c!=null&&e.append(c),s.isRemaining()?r=""+s.getRemainingValue():r=null,n===s.getNewPosition())break;n=s.getNewPosition()}while(!0);return e.toString()}isStillNumeric(e){if(e+7>this.information.getSize())return e+4<=this.information.getSize();for(let t=e;t<e+3;++t)if(this.information.get(t))return!0;return this.information.get(e+3)}decodeNumeric(e){if(e+7>this.information.getSize()){let s=this.extractNumericValueFromBitArray(e,4);return s===0?new fn(this.information.getSize(),fn.FNC1,fn.FNC1):new fn(this.information.getSize(),s-1,fn.FNC1)}let t=this.extractNumericValueFromBitArray(e,7),n=(t-8)/11,r=(t-8)%11;return new fn(e+7,n,r)}extractNumericValueFromBitArray(e,t){return Er.extractNumericValueFromBitArray(this.information,e,t)}static extractNumericValueFromBitArray(e,t,n){let r=0;for(let s=0;s<n;++s)e.get(t+s)&&(r|=1<<n-s-1);return r}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 ir(this.current.getPosition(),this.buffer.toString(),n.getRemainingValue()):new ir(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 ir(this.current.getPosition(),this.buffer.toString()):t=new ir(this.current.getPosition(),this.buffer.toString(),e.getSecondDigit()),new rr(!0,t)}if(this.buffer.append(e.getFirstDigit()),e.isSecondDigitFNC1()){let t=new ir(this.current.getPosition(),this.buffer.toString());return new rr(!0,t)}this.buffer.append(e.getSecondDigit())}return this.isNumericToAlphaNumericLatch(this.current.getPosition())&&(this.current.setAlpha(),this.current.incrementPosition(4)),new rr(!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 ir(this.current.getPosition(),this.buffer.toString());return new rr(!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 rr(!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 ir(this.current.getPosition(),this.buffer.toString());return new rr(!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 rr(!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 r=this.extractNumericValueFromBitArray(e,8);return r>=232&&r<253}decodeIsoIec646(e){let t=this.extractNumericValueFromBitArray(e,5);if(t===15)return new Jt(e+5,Jt.FNC1);if(t>=5&&t<15)return new Jt(e+5,"0"+(t-5));let n=this.extractNumericValueFromBitArray(e,7);if(n>=64&&n<90)return new Jt(e+7,""+(n+1));if(n>=90&&n<116)return new Jt(e+7,""+(n+7));let r=this.extractNumericValueFromBitArray(e,8),s;switch(r){case 232:s="!";break;case 233:s='"';break;case 234:s="%";break;case 235:s="&";break;case 236:s="'";break;case 237:s="(";break;case 238:s=")";break;case 239:s="*";break;case 240:s="+";break;case 241:s=",";break;case 242:s="-";break;case 243:s=".";break;case 244:s="/";break;case 245:s=":";break;case 246:s=";";break;case 247:s="<";break;case 248:s="=";break;case 249:s=">";break;case 250:s="?";break;case 251:s="_";break;case 252:s=" ";break;default:throw new U}return new Jt(e+8,s)}isStillAlpha(e){if(e+5>this.information.getSize())return!1;let t=this.extractNumericValueFromBitArray(e,5);if(t>=5&&t<16)return!0;if(e+6>this.information.getSize())return!1;let n=this.extractNumericValueFromBitArray(e,6);return n>=16&&n<63}decodeAlphanumeric(e){let t=this.extractNumericValueFromBitArray(e,5);if(t===15)return new Jt(e+5,Jt.FNC1);if(t>=5&&t<15)return new Jt(e+5,"0"+(t-5));let n=this.extractNumericValueFromBitArray(e,6);if(n>=32&&n<58)return new Jt(e+6,""+(n+33));let r;switch(n){case 58:r="*";break;case 59:r=",";break;case 60:r="-";break;case 61:r=".";break;case 62:r="/";break;default:throw new nt("Decoding invalid alphanumeric value: "+n)}return new Jt(e+6,r)}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 Ao{constructor(e){this.information=e,this.generalDecoder=new Er(e)}getInformation(){return this.information}getGeneralDecoder(){return this.generalDecoder}}class en extends Ao{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 r=0;r<4;++r){let s=this.getGeneralDecoder().extractNumericValueFromBitArray(t+10*r,10);s/100===0&&e.append("0"),s/10===0&&e.append("0"),e.append(s)}en.appendCheckDigit(e,n)}static appendCheckDigit(e,t){let n=0;for(let r=0;r<13;r++){let s=e.charAt(r+t).charCodeAt(0)-48;n+=r&1?s:3*s}n=10-n%10,n===10&&(n=0),e.append(n)}}en.GTIN_SIZE=40;class yr extends en{constructor(e){super(e)}parseInformation(){let e=new Z;e.append("(01)");let t=e.length(),n=this.getGeneralDecoder().extractNumericValueFromBitArray(yr.HEADER_SIZE,4);return e.append(n),this.encodeCompressedGtinWithoutAI(e,yr.HEADER_SIZE+4,t),this.getGeneralDecoder().decodeAllCodes(e,yr.HEADER_SIZE+44)}}yr.HEADER_SIZE=4;class Ai extends Ao{constructor(e){super(e)}parseInformation(){let e=new Z;return this.getGeneralDecoder().decodeAllCodes(e,Ai.HEADER_SIZE)}}Ai.HEADER_SIZE=5;class Ii extends en{constructor(e){super(e)}encodeCompressedWeight(e,t,n){let r=this.getGeneralDecoder().extractNumericValueFromBitArray(t,n);this.addWeightCode(e,r);let s=this.checkWeight(r),c=1e5;for(let d=0;d<5;++d)s/c===0&&e.append("0"),c/=10;e.append(s)}}class kn extends Ii{constructor(e){super(e)}parseInformation(){if(this.getInformation().getSize()!=kn.HEADER_SIZE+Ii.GTIN_SIZE+kn.WEIGHT_SIZE)throw new S;let e=new Z;return this.encodeCompressedGtin(e,kn.HEADER_SIZE),this.encodeCompressedWeight(e,kn.HEADER_SIZE+Ii.GTIN_SIZE,kn.WEIGHT_SIZE),e.toString()}}kn.HEADER_SIZE=5,kn.WEIGHT_SIZE=15;class ig extends kn{constructor(e){super(e)}addWeightCode(e,t){e.append("(3103)")}checkWeight(e){return e}}class og extends kn{constructor(e){super(e)}addWeightCode(e,t){t<1e4?e.append("(3202)"):e.append("(3203)")}checkWeight(e){return e<1e4?e:e-1e4}}class Rn extends en{constructor(e){super(e)}parseInformation(){if(this.getInformation().getSize()<Rn.HEADER_SIZE+en.GTIN_SIZE)throw new S;let e=new Z;this.encodeCompressedGtin(e,Rn.HEADER_SIZE);let t=this.getGeneralDecoder().extractNumericValueFromBitArray(Rn.HEADER_SIZE+en.GTIN_SIZE,Rn.LAST_DIGIT_SIZE);e.append("(392"),e.append(t),e.append(")");let n=this.getGeneralDecoder().decodeGeneralPurposeField(Rn.HEADER_SIZE+en.GTIN_SIZE+Rn.LAST_DIGIT_SIZE,null);return e.append(n.getNewString()),e.toString()}}Rn.HEADER_SIZE=8,Rn.LAST_DIGIT_SIZE=2;class qt extends en{constructor(e){super(e)}parseInformation(){if(this.getInformation().getSize()<qt.HEADER_SIZE+en.GTIN_SIZE)throw new S;let e=new Z;this.encodeCompressedGtin(e,qt.HEADER_SIZE);let t=this.getGeneralDecoder().extractNumericValueFromBitArray(qt.HEADER_SIZE+en.GTIN_SIZE,qt.LAST_DIGIT_SIZE);e.append("(393"),e.append(t),e.append(")");let n=this.getGeneralDecoder().extractNumericValueFromBitArray(qt.HEADER_SIZE+en.GTIN_SIZE+qt.LAST_DIGIT_SIZE,qt.FIRST_THREE_DIGITS_SIZE);n/100==0&&e.append("0"),n/10==0&&e.append("0"),e.append(n);let r=this.getGeneralDecoder().decodeGeneralPurposeField(qt.HEADER_SIZE+en.GTIN_SIZE+qt.LAST_DIGIT_SIZE+qt.FIRST_THREE_DIGITS_SIZE,null);return e.append(r.getNewString()),e.toString()}}qt.HEADER_SIZE=8,qt.LAST_DIGIT_SIZE=2,qt.FIRST_THREE_DIGITS_SIZE=10;class pt extends Ii{constructor(e,t,n){super(e),this.dateCode=n,this.firstAIdigits=t}parseInformation(){if(this.getInformation().getSize()!=pt.HEADER_SIZE+pt.GTIN_SIZE+pt.WEIGHT_SIZE+pt.DATE_SIZE)throw new S;let e=new Z;return this.encodeCompressedGtin(e,pt.HEADER_SIZE),this.encodeCompressedWeight(e,pt.HEADER_SIZE+pt.GTIN_SIZE,pt.WEIGHT_SIZE),this.encodeCompressedDate(e,pt.HEADER_SIZE+pt.GTIN_SIZE+pt.WEIGHT_SIZE),e.toString()}encodeCompressedDate(e,t){let n=this.getGeneralDecoder().extractNumericValueFromBitArray(t,pt.DATE_SIZE);if(n==38400)return;e.append("("),e.append(this.dateCode),e.append(")");let r=n%32;n/=32;let s=n%12+1;n/=12;let c=n;c/10==0&&e.append("0"),e.append(c),s/10==0&&e.append("0"),e.append(s),r/10==0&&e.append("0"),e.append(r)}addWeightCode(e,t){e.append("("),e.append(this.firstAIdigits),e.append(t/1e5),e.append(")")}checkWeight(e){return e%1e5}}pt.HEADER_SIZE=8,pt.WEIGHT_SIZE=20,pt.DATE_SIZE=16;function Pa(b){try{if(b.get(1))return new yr(b);if(!b.get(2))return new Ai(b);switch(Er.extractNumericValueFromBitArray(b,1,4)){case 4:return new ig(b);case 5:return new og(b)}switch(Er.extractNumericValueFromBitArray(b,1,5)){case 12:return new Rn(b);case 13:return new qt(b)}switch(Er.extractNumericValueFromBitArray(b,1,7)){case 56:return new pt(b,"310","11");case 57:return new pt(b,"320","11");case 58:return new pt(b,"310","13");case 59:return new pt(b,"320","13");case 60:return new pt(b,"310","15");case 61:return new pt(b,"320","15");case 62:return new pt(b,"310","17");case 63:return new pt(b,"320","17")}}catch(e){throw console.log(e),new nt("unknown decoder: "+b)}}class Gn{constructor(e,t,n,r){this.leftchar=e,this.rightchar=t,this.finderpattern=n,this.maybeLast=r}mayBeLast(){return this.maybeLast}getLeftChar(){return this.leftchar}getRightChar(){return this.rightchar}getFinderPattern(){return this.finderpattern}mustBeLast(){return this.rightchar==null}toString(){return"[ "+this.leftchar+", "+this.rightchar+" : "+(this.finderpattern==null?"null":this.finderpattern.getValue())+" ]"}static equals(e,t){return e instanceof Gn?Gn.equalsOrNull(e.leftchar,t.leftchar)&&Gn.equalsOrNull(e.rightchar,t.rightchar)&&Gn.equalsOrNull(e.finderpattern,t.finderpattern):!1}static equalsOrNull(e,t){return e===null?t===null:Gn.equals(e,t)}hashCode(){return this.leftchar.getValue()^this.rightchar.getValue()^this.finderpattern.getValue()}}class Io{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 Io?this.checkEqualitity(e,t)&&e.wasReversed===t.wasReversed:!1}checkEqualitity(e,t){if(!e||!t)return;let n;return e.forEach((r,s)=>{t.forEach(c=>{r.getLeftChar().getValue()===c.getLeftChar().getValue()&&r.getRightChar().getValue()===c.getRightChar().getValue()&&r.getFinderPatter().getValue()===c.getFinderPatter().getValue()&&(n=!0)})}),n}}class se extends Bt{constructor(e){super(...arguments),this.pairs=new Array(se.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 se.constructResult(this.decodeRow2pairs(e,t))}catch(r){this.verbose&&console.log(r)}return this.pairs.length=0,this.startFromEven=!0,se.constructResult(this.decodeRow2pairs(e,t))}reset(){this.pairs.length=0,this.rows.length=0}decodeRow2pairs(e,t){let n=!1;for(;!n;)try{this.pairs.push(this.retrieveNextPair(t,this.pairs,e))}catch(s){if(s instanceof S){if(!this.pairs.length)throw new S;n=!0}}if(this.checkChecksum())return this.pairs;let r;if(this.rows.length?r=!0:r=!1,this.storeRow(e,!1),r){let s=this.checkRowsBoolean(!1);if(s!=null||(s=this.checkRowsBoolean(!0),s!=null))return s}throw new S}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 r=this.rows[n];this.pairs.length=0;for(let c of e)this.pairs.push(c.getPairs());if(this.pairs.push(r.getPairs()),!se.isValidSequence(this.pairs))continue;if(this.checkChecksum())return this.pairs;let s=new Array(e);s.push(r);try{return this.checkRows(s,n+1)}catch(c){this.verbose&&console.log(c)}}throw new S}static isValidSequence(e){for(let t of se.FINDER_PATTERN_SEQUENCES){if(e.length>t.length)continue;let n=!0;for(let r=0;r<e.length;r++)if(e[r].getFinderPattern().getValue()!=t[r]){n=!1;break}if(n)return!0}return!1}storeRow(e,t){let n=0,r=!1,s=!1;for(;n<this.rows.length;){let c=this.rows[n];if(c.getRowNumber()>e){s=c.isEquivalent(this.pairs);break}r=c.isEquivalent(this.pairs),n++}s||r||se.isPartialRow(this.pairs,this.rows)||(this.rows.push(n,new Io(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 r of n.getPairs())for(let s of e)if(Gn.equals(r,s))break}}static isPartialRow(e,t){for(let n of t){let r=!0;for(let s of e){let c=!1;for(let d of n.getPairs())if(s.equals(d)){c=!0;break}if(!c){r=!1;break}}if(r)return!0}return!1}getRows(){return this.rows}static constructResult(e){let t=rg.buildBitArray(e),r=Pa(t).parseInformation(),s=e[0].getFinderPattern().getResultPoints(),c=e[e.length-1].getFinderPattern().getResultPoints(),d=[s[0],s[1],c[0],c[1]];return new _e(r,null,null,d,fe.RSS_EXPANDED,null)}checkChecksum(){let e=this.pairs.get(0),t=e.getLeftChar(),n=e.getRightChar();if(n==null)return!1;let r=n.getChecksumPortion(),s=2;for(let d=1;d<this.pairs.size();++d){let g=this.pairs.get(d);r+=g.getLeftChar().getChecksumPortion(),s++;let x=g.getRightChar();x!=null&&(r+=x.getChecksumPortion(),s++)}return r%=211,211*(s-4)+r==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 r=t.length%2==0;this.startFromEven&&(r=!r);let s,c=!0,d=-1;do this.findNextPair(e,t,d),s=this.parseFoundFinderPattern(e,n,r),s==null?d=se.getNextSecondBar(e,this.startEnd[0]):c=!1;while(c);let g=this.decodeDataCharacter(e,s,r,!0);if(!this.isEmptyPair(t)&&t[t.length-1].mustBeLast())throw new S;let x;try{x=this.decodeDataCharacter(e,s,r,!1)}catch(E){x=null,this.verbose&&console.log(E)}return new Gn(g,x,s,!0)}isEmptyPair(e){return e.length===0}findNextPair(e,t,n){let r=this.getDecodeFinderCounters();r[0]=0,r[1]=0,r[2]=0,r[3]=0;let s=e.getSize(),c;n>=0?c=n:this.isEmptyPair(t)?c=0:c=t[t.length-1].getFinderPattern().getStartEnd()[1];let d=t.length%2!=0;this.startFromEven&&(d=!d);let g=!1;for(;c<s&&(g=!e.get(c),!!g);)c++;let x=0,E=c;for(let A=c;A<s;A++)if(e.get(A)!=g)r[x]++;else{if(x==3){if(d&&se.reverseCounters(r),se.isFinderPattern(r)){this.startEnd[0]=E,this.startEnd[1]=A;return}d&&se.reverseCounters(r),E+=r[0]+r[1],r[0]=r[2],r[1]=r[3],r[2]=0,r[3]=0,x--}else x++;r[x]=1,g=!g}throw new S}static reverseCounters(e){let t=e.length;for(let n=0;n<t/2;++n){let r=e[n];e[n]=e[t-n-1],e[t-n-1]=r}}parseFoundFinderPattern(e,t,n){let r,s,c;if(n){let x=this.startEnd[0]-1;for(;x>=0&&!e.get(x);)x--;x++,r=this.startEnd[0]-x,s=x,c=this.startEnd[1]}else s=this.startEnd[0],c=e.getNextUnset(this.startEnd[1]+1),r=c-this.startEnd[1];let d=this.getDecodeFinderCounters();P.arraycopy(d,0,d,1,d.length-1),d[0]=r;let g;try{g=this.parseFinderValue(d,se.FINDER_PATTERNS)}catch{return null}return new bi(g,[s,c],s,c,t)}decodeDataCharacter(e,t,n,r){let s=this.getDataCharacterCounters();for(let lt=0;lt<s.length;lt++)s[lt]=0;if(r)se.recordPatternInReverse(e,t.getStartEnd()[0],s);else{se.recordPattern(e,t.getStartEnd()[1],s);for(let lt=0,Ut=s.length-1;lt<Ut;lt++,Ut--){let ln=s[lt];s[lt]=s[Ut],s[Ut]=ln}}let c=17,d=ze.sum(new Int32Array(s))/c,g=(t.getStartEnd()[1]-t.getStartEnd()[0])/15;if(Math.abs(d-g)/g>.3)throw new S;let x=this.getOddCounts(),E=this.getEvenCounts(),A=this.getOddRoundingErrors(),I=this.getEvenRoundingErrors();for(let lt=0;lt<s.length;lt++){let Ut=1*s[lt]/d,ln=Ut+.5;if(ln<1){if(Ut<.3)throw new S;ln=1}else if(ln>8){if(Ut>8.7)throw new S;ln=8}let Nr=lt/2;lt&1?(E[Nr]=ln,I[Nr]=Ut-ln):(x[Nr]=ln,A[Nr]=Ut-ln)}this.adjustOddEvenCounts(c);let O=4*t.getValue()+(n?0:2)+(r?0:1)-1,L=0,F=0;for(let lt=x.length-1;lt>=0;lt--){if(se.isNotA1left(t,n,r)){let Ut=se.WEIGHTS[O][2*lt];F+=x[lt]*Ut}L+=x[lt]}let q=0;for(let lt=E.length-1;lt>=0;lt--)if(se.isNotA1left(t,n,r)){let Ut=se.WEIGHTS[O][2*lt+1];q+=E[lt]*Ut}let J=F+q;if(L&1||L>13||L<4)throw new S;let ce=(13-L)/2,ue=se.SYMBOL_WIDEST[ce],ae=9-ue,Ge=Tn.getRSSvalue(x,ue,!0),ve=Tn.getRSSvalue(E,ae,!1),nn=se.EVEN_TOTAL_SUBSET[ce],An=se.GSUM[ce],rn=Ge*nn+ve+An;return new zn(rn,J)}static isNotA1left(e,t,n){return!(e.getValue()==0&&t&&n)}adjustOddEvenCounts(e){let t=ze.sum(new Int32Array(this.getOddCounts())),n=ze.sum(new Int32Array(this.getEvenCounts())),r=!1,s=!1;t>13?s=!0:t<4&&(r=!0);let c=!1,d=!1;n>13?d=!0:n<4&&(c=!0);let g=t+n-e,x=(t&1)==1,E=(n&1)==0;if(g==1)if(x){if(E)throw new S;s=!0}else{if(!E)throw new S;d=!0}else if(g==-1)if(x){if(E)throw new S;r=!0}else{if(!E)throw new S;c=!0}else if(g==0){if(x){if(!E)throw new S;t<n?(r=!0,d=!0):(s=!0,c=!0)}else if(E)throw new S}else throw new S;if(r){if(s)throw new S;se.increment(this.getOddCounts(),this.getOddRoundingErrors())}if(s&&se.decrement(this.getOddCounts(),this.getOddRoundingErrors()),c){if(d)throw new S;se.increment(this.getEvenCounts(),this.getOddRoundingErrors())}d&&se.decrement(this.getEvenCounts(),this.getEvenRoundingErrors())}}se.SYMBOL_WIDEST=[7,5,4,3,1],se.EVEN_TOTAL_SUBSET=[4,20,52,104,204],se.GSUM=[0,348,1388,2948,3988],se.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])],se.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]],se.FINDER_PAT_A=0,se.FINDER_PAT_B=1,se.FINDER_PAT_C=2,se.FINDER_PAT_D=3,se.FINDER_PAT_E=4,se.FINDER_PAT_F=5,se.FINDER_PATTERN_SEQUENCES=[[se.FINDER_PAT_A,se.FINDER_PAT_A],[se.FINDER_PAT_A,se.FINDER_PAT_B,se.FINDER_PAT_B],[se.FINDER_PAT_A,se.FINDER_PAT_C,se.FINDER_PAT_B,se.FINDER_PAT_D],[se.FINDER_PAT_A,se.FINDER_PAT_E,se.FINDER_PAT_B,se.FINDER_PAT_D,se.FINDER_PAT_C],[se.FINDER_PAT_A,se.FINDER_PAT_E,se.FINDER_PAT_B,se.FINDER_PAT_D,se.FINDER_PAT_D,se.FINDER_PAT_F],[se.FINDER_PAT_A,se.FINDER_PAT_E,se.FINDER_PAT_B,se.FINDER_PAT_D,se.FINDER_PAT_E,se.FINDER_PAT_F,se.FINDER_PAT_F],[se.FINDER_PAT_A,se.FINDER_PAT_A,se.FINDER_PAT_B,se.FINDER_PAT_B,se.FINDER_PAT_C,se.FINDER_PAT_C,se.FINDER_PAT_D,se.FINDER_PAT_D],[se.FINDER_PAT_A,se.FINDER_PAT_A,se.FINDER_PAT_B,se.FINDER_PAT_B,se.FINDER_PAT_C,se.FINDER_PAT_C,se.FINDER_PAT_D,se.FINDER_PAT_E,se.FINDER_PAT_E],[se.FINDER_PAT_A,se.FINDER_PAT_A,se.FINDER_PAT_B,se.FINDER_PAT_B,se.FINDER_PAT_C,se.FINDER_PAT_C,se.FINDER_PAT_D,se.FINDER_PAT_E,se.FINDER_PAT_F,se.FINDER_PAT_F],[se.FINDER_PAT_A,se.FINDER_PAT_A,se.FINDER_PAT_B,se.FINDER_PAT_B,se.FINDER_PAT_C,se.FINDER_PAT_D,se.FINDER_PAT_D,se.FINDER_PAT_E,se.FINDER_PAT_E,se.FINDER_PAT_F,se.FINDER_PAT_F]],se.MAX_PAIRS=11;class sg extends zn{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 Ct extends Bt{constructor(){super(...arguments),this.possibleLeftPairs=[],this.possibleRightPairs=[]}decodeRow(e,t,n){const r=this.decodePair(t,!1,e,n);Ct.addOrTally(this.possibleLeftPairs,r),t.reverse();let s=this.decodePair(t,!0,e,n);Ct.addOrTally(this.possibleRightPairs,s),t.reverse();for(let c of this.possibleLeftPairs)if(c.getCount()>1){for(let d of this.possibleRightPairs)if(d.getCount()>1&&Ct.checkChecksum(c,d))return Ct.constructResult(c,d)}throw new S}static addOrTally(e,t){if(t==null)return;let n=!1;for(let r of e)if(r.getValue()===t.getValue()){r.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(),r=new String(n).toString(),s=new Z;for(let x=13-r.length;x>0;x--)s.append("0");s.append(r);let c=0;for(let x=0;x<13;x++){let E=s.charAt(x).charCodeAt(0)-48;c+=x&1?E:3*E}c=10-c%10,c===10&&(c=0),s.append(c.toString());let d=e.getFinderPattern().getResultPoints(),g=t.getFinderPattern().getResultPoints();return new _e(s.toString(),null,0,[d[0],d[1],g[0],g[1]],fe.RSS_14,new Date().getTime())}static checkChecksum(e,t){let n=(e.getChecksumPortion()+16*t.getChecksumPortion())%79,r=9*e.getFinderPattern().getValue()+t.getFinderPattern().getValue();return r>72&&r--,r>8&&r--,n===r}decodePair(e,t,n,r){try{let s=this.findFinderPattern(e,t),c=this.parseFoundFinderPattern(e,n,t,s),d=r==null?null:r.get(ne.NEED_RESULT_POINT_CALLBACK);if(d!=null){let E=(s[0]+s[1])/2;t&&(E=e.getSize()-1-E),d.foundPossibleResultPoint(new ye(E,n))}let g=this.decodeDataCharacter(e,c,!0),x=this.decodeDataCharacter(e,c,!1);return new sg(1597*g.getValue()+x.getValue(),g.getChecksumPortion()+4*x.getChecksumPortion(),c)}catch{return null}}decodeDataCharacter(e,t,n){let r=this.getDataCharacterCounters();for(let q=0;q<r.length;q++)r[q]=0;if(n)Ke.recordPatternInReverse(e,t.getStartEnd()[0],r);else{Ke.recordPattern(e,t.getStartEnd()[1]+1,r);for(let q=0,J=r.length-1;q<J;q++,J--){let ce=r[q];r[q]=r[J],r[J]=ce}}let s=n?16:15,c=ze.sum(new Int32Array(r))/s,d=this.getOddCounts(),g=this.getEvenCounts(),x=this.getOddRoundingErrors(),E=this.getEvenRoundingErrors();for(let q=0;q<r.length;q++){let J=r[q]/c,ce=Math.floor(J+.5);ce<1?ce=1:ce>8&&(ce=8);let ue=Math.floor(q/2);q&1?(g[ue]=ce,E[ue]=J-ce):(d[ue]=ce,x[ue]=J-ce)}this.adjustOddEvenCounts(n,s);let A=0,I=0;for(let q=d.length-1;q>=0;q--)I*=9,I+=d[q],A+=d[q];let O=0,L=0;for(let q=g.length-1;q>=0;q--)O*=9,O+=g[q],L+=g[q];let F=I+3*O;if(n){if(A&1||A>12||A<4)throw new S;let q=(12-A)/2,J=Ct.OUTSIDE_ODD_WIDEST[q],ce=9-J,ue=Tn.getRSSvalue(d,J,!1),ae=Tn.getRSSvalue(g,ce,!0),Ge=Ct.OUTSIDE_EVEN_TOTAL_SUBSET[q],ve=Ct.OUTSIDE_GSUM[q];return new zn(ue*Ge+ae+ve,F)}else{if(L&1||L>10||L<4)throw new S;let q=(10-L)/2,J=Ct.INSIDE_ODD_WIDEST[q],ce=9-J,ue=Tn.getRSSvalue(d,J,!0),ae=Tn.getRSSvalue(g,ce,!1),Ge=Ct.INSIDE_ODD_TOTAL_SUBSET[q],ve=Ct.INSIDE_GSUM[q];return new zn(ae*Ge+ue+ve,F)}}findFinderPattern(e,t){let n=this.getDecodeFinderCounters();n[0]=0,n[1]=0,n[2]=0,n[3]=0;let r=e.getSize(),s=!1,c=0;for(;c<r&&(s=!e.get(c),t!==s);)c++;let d=0,g=c;for(let x=c;x<r;x++)if(e.get(x)!==s)n[d]++;else{if(d===3){if(Bt.isFinderPattern(n))return[g,x];g+=n[0]+n[1],n[0]=n[2],n[1]=n[3],n[2]=0,n[3]=0,d--}else d++;n[d]=1,s=!s}throw new S}parseFoundFinderPattern(e,t,n,r){let s=e.get(r[0]),c=r[0]-1;for(;c>=0&&s!==e.get(c);)c--;c++;const d=r[0]-c,g=this.getDecodeFinderCounters(),x=new Int32Array(g.length);P.arraycopy(g,0,x,1,g.length-1),x[0]=d;const E=this.parseFinderValue(x,Ct.FINDER_PATTERNS);let A=c,I=r[1];return n&&(A=e.getSize()-1-A,I=e.getSize()-1-I),new bi(E,[c,r[1]],A,I,t)}adjustOddEvenCounts(e,t){let n=ze.sum(new Int32Array(this.getOddCounts())),r=ze.sum(new Int32Array(this.getEvenCounts())),s=!1,c=!1,d=!1,g=!1;e?(n>12?c=!0:n<4&&(s=!0),r>12?g=!0:r<4&&(d=!0)):(n>11?c=!0:n<5&&(s=!0),r>10?g=!0:r<4&&(d=!0));let x=n+r-t,E=(n&1)===(e?1:0),A=(r&1)===1;if(x===1)if(E){if(A)throw new S;c=!0}else{if(!A)throw new S;g=!0}else if(x===-1)if(E){if(A)throw new S;s=!0}else{if(!A)throw new S;d=!0}else if(x===0){if(E){if(!A)throw new S;n<r?(s=!0,g=!0):(c=!0,d=!0)}else if(A)throw new S}else throw new S;if(s){if(c)throw new S;Bt.increment(this.getOddCounts(),this.getOddRoundingErrors())}if(c&&Bt.decrement(this.getOddCounts(),this.getOddRoundingErrors()),d){if(g)throw new S;Bt.increment(this.getEvenCounts(),this.getOddRoundingErrors())}g&&Bt.decrement(this.getEvenCounts(),this.getEvenRoundingErrors())}}Ct.OUTSIDE_EVEN_TOTAL_SUBSET=[1,10,34,70,126],Ct.INSIDE_ODD_TOTAL_SUBSET=[4,20,48,81],Ct.OUTSIDE_GSUM=[0,161,961,2015,2715],Ct.INSIDE_GSUM=[0,336,1036,1516],Ct.OUTSIDE_ODD_WIDEST=[8,6,4,3,1],Ct.INSIDE_ODD_WIDEST=[2,4,6,8],Ct.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 br extends Ke{constructor(e,t){super(),this.readers=[],this.verbose=t===!0;const n=e?e.get(ne.POSSIBLE_FORMATS):null,r=e&&e.get(ne.ASSUME_CODE_39_CHECK_DIGIT)!==void 0;n?((n.includes(fe.EAN_13)||n.includes(fe.UPC_A)||n.includes(fe.EAN_8)||n.includes(fe.UPC_E))&&this.readers.push(new Vn(e)),n.includes(fe.CODE_39)&&this.readers.push(new ft(r)),n.includes(fe.CODE_128)&&this.readers.push(new de),n.includes(fe.ITF)&&this.readers.push(new Ye),n.includes(fe.RSS_14)&&this.readers.push(new Ct),n.includes(fe.RSS_EXPANDED)&&this.readers.push(new se(this.verbose))):(this.readers.push(new Vn(e)),this.readers.push(new ft),this.readers.push(new Vn(e)),this.readers.push(new de),this.readers.push(new Ye),this.readers.push(new Ct),this.readers.push(new se(this.verbose)))}decodeRow(e,t,n){for(let r=0;r<this.readers.length;r++)try{return this.readers[r].decodeRow(e,t,n)}catch{}throw new S}reset(){this.readers.forEach(e=>e.reset())}}class ag extends Ne{constructor(e=500,t){super(new br(t),e,t)}}class tt{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 je{constructor(e,t,n,r,s,c){this.versionNumber=e,this.symbolSizeRows=t,this.symbolSizeColumns=n,this.dataRegionSizeRows=r,this.dataRegionSizeColumns=s,this.ecBlocks=c;let d=0;const g=c.getECCodewords(),x=c.getECBlocks();for(let E of x)d+=E.getCount()*(E.getDataCodewords()+g);this.totalCodewords=d}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 U;for(let n of je.VERSIONS)if(n.symbolSizeRows===e&&n.symbolSizeColumns===t)return n;throw new U}toString(){return""+this.versionNumber}static buildVersions(){return[new je(1,10,10,8,8,new tt(5,new Je(1,3))),new je(2,12,12,10,10,new tt(7,new Je(1,5))),new je(3,14,14,12,12,new tt(10,new Je(1,8))),new je(4,16,16,14,14,new tt(12,new Je(1,12))),new je(5,18,18,16,16,new tt(14,new Je(1,18))),new je(6,20,20,18,18,new tt(18,new Je(1,22))),new je(7,22,22,20,20,new tt(20,new Je(1,30))),new je(8,24,24,22,22,new tt(24,new Je(1,36))),new je(9,26,26,24,24,new tt(28,new Je(1,44))),new je(10,32,32,14,14,new tt(36,new Je(1,62))),new je(11,36,36,16,16,new tt(42,new Je(1,86))),new je(12,40,40,18,18,new tt(48,new Je(1,114))),new je(13,44,44,20,20,new tt(56,new Je(1,144))),new je(14,48,48,22,22,new tt(68,new Je(1,174))),new je(15,52,52,24,24,new tt(42,new Je(2,102))),new je(16,64,64,14,14,new tt(56,new Je(2,140))),new je(17,72,72,16,16,new tt(36,new Je(4,92))),new je(18,80,80,18,18,new tt(48,new Je(4,114))),new je(19,88,88,20,20,new tt(56,new Je(4,144))),new je(20,96,96,22,22,new tt(68,new Je(4,174))),new je(21,104,104,24,24,new tt(56,new Je(6,136))),new je(22,120,120,18,18,new tt(68,new Je(6,175))),new je(23,132,132,20,20,new tt(62,new Je(8,163))),new je(24,144,144,22,22,new tt(62,new Je(8,156),new Je(2,155))),new je(25,8,18,6,16,new tt(7,new Je(1,5))),new je(26,8,32,6,14,new tt(11,new Je(1,10))),new je(27,12,26,10,24,new tt(14,new Je(1,16))),new je(28,12,36,10,16,new tt(18,new Je(1,22))),new je(29,16,36,14,16,new tt(24,new Je(1,32))),new je(30,16,48,14,22,new tt(28,new Je(1,49)))]}}je.VERSIONS=je.buildVersions();class So{constructor(e){const t=e.getHeight();if(t<8||t>144||t&1)throw new U;this.version=So.readVersion(e),this.mappingBitMatrix=this.extractDataRegion(e),this.readMappingMatrix=new X(this.mappingBitMatrix.getWidth(),this.mappingBitMatrix.getHeight())}getVersion(){return this.version}static readVersion(e){const t=e.getHeight(),n=e.getWidth();return je.getVersionForDimensions(t,n)}readCodewords(){const e=new Int8Array(this.version.getTotalCodewords());let t=0,n=4,r=0;const s=this.mappingBitMatrix.getHeight(),c=this.mappingBitMatrix.getWidth();let d=!1,g=!1,x=!1,E=!1;do if(n===s&&r===0&&!d)e[t++]=this.readCorner1(s,c)&255,n-=2,r+=2,d=!0;else if(n===s-2&&r===0&&c&3&&!g)e[t++]=this.readCorner2(s,c)&255,n-=2,r+=2,g=!0;else if(n===s+4&&r===2&&!(c&7)&&!x)e[t++]=this.readCorner3(s,c)&255,n-=2,r+=2,x=!0;else if(n===s-2&&r===0&&(c&7)===4&&!E)e[t++]=this.readCorner4(s,c)&255,n-=2,r+=2,E=!0;else{do n<s&&r>=0&&!this.readMappingMatrix.get(r,n)&&(e[t++]=this.readUtah(n,r,s,c)&255),n-=2,r+=2;while(n>=0&&r<c);n+=1,r+=3;do n>=0&&r<c&&!this.readMappingMatrix.get(r,n)&&(e[t++]=this.readUtah(n,r,s,c)&255),n+=2,r-=2;while(n<s&&r>=0);n+=3,r+=1}while(n<s||r<c);if(t!==this.version.getTotalCodewords())throw new U;return e}readModule(e,t,n,r){return e<0&&(e+=n,t+=4-(n+4&7)),t<0&&(t+=r,e+=4-(r+4&7)),this.readMappingMatrix.set(t,e),this.mappingBitMatrix.get(t,e)}readUtah(e,t,n,r){let s=0;return this.readModule(e-2,t-2,n,r)&&(s|=1),s<<=1,this.readModule(e-2,t-1,n,r)&&(s|=1),s<<=1,this.readModule(e-1,t-2,n,r)&&(s|=1),s<<=1,this.readModule(e-1,t-1,n,r)&&(s|=1),s<<=1,this.readModule(e-1,t,n,r)&&(s|=1),s<<=1,this.readModule(e,t-2,n,r)&&(s|=1),s<<=1,this.readModule(e,t-1,n,r)&&(s|=1),s<<=1,this.readModule(e,t,n,r)&&(s|=1),s}readCorner1(e,t){let n=0;return this.readModule(e-1,0,e,t)&&(n|=1),n<<=1,this.readModule(e-1,1,e,t)&&(n|=1),n<<=1,this.readModule(e-1,2,e,t)&&(n|=1),n<<=1,this.readModule(0,t-2,e,t)&&(n|=1),n<<=1,this.readModule(0,t-1,e,t)&&(n|=1),n<<=1,this.readModule(1,t-1,e,t)&&(n|=1),n<<=1,this.readModule(2,t-1,e,t)&&(n|=1),n<<=1,this.readModule(3,t-1,e,t)&&(n|=1),n}readCorner2(e,t){let n=0;return this.readModule(e-3,0,e,t)&&(n|=1),n<<=1,this.readModule(e-2,0,e,t)&&(n|=1),n<<=1,this.readModule(e-1,0,e,t)&&(n|=1),n<<=1,this.readModule(0,t-4,e,t)&&(n|=1),n<<=1,this.readModule(0,t-3,e,t)&&(n|=1),n<<=1,this.readModule(0,t-2,e,t)&&(n|=1),n<<=1,this.readModule(0,t-1,e,t)&&(n|=1),n<<=1,this.readModule(1,t-1,e,t)&&(n|=1),n}readCorner3(e,t){let n=0;return this.readModule(e-1,0,e,t)&&(n|=1),n<<=1,this.readModule(e-1,t-1,e,t)&&(n|=1),n<<=1,this.readModule(0,t-3,e,t)&&(n|=1),n<<=1,this.readModule(0,t-2,e,t)&&(n|=1),n<<=1,this.readModule(0,t-1,e,t)&&(n|=1),n<<=1,this.readModule(1,t-3,e,t)&&(n|=1),n<<=1,this.readModule(1,t-2,e,t)&&(n|=1),n<<=1,this.readModule(1,t-1,e,t)&&(n|=1),n}readCorner4(e,t){let n=0;return this.readModule(e-3,0,e,t)&&(n|=1),n<<=1,this.readModule(e-2,0,e,t)&&(n|=1),n<<=1,this.readModule(e-1,0,e,t)&&(n|=1),n<<=1,this.readModule(0,t-2,e,t)&&(n|=1),n<<=1,this.readModule(0,t-1,e,t)&&(n|=1),n<<=1,this.readModule(1,t-1,e,t)&&(n|=1),n<<=1,this.readModule(2,t-1,e,t)&&(n|=1),n<<=1,this.readModule(3,t-1,e,t)&&(n|=1),n}extractDataRegion(e){const t=this.version.getSymbolSizeRows(),n=this.version.getSymbolSizeColumns();if(e.getHeight()!==t)throw new y("Dimension of bitMatrix must match the version size");const r=this.version.getDataRegionSizeRows(),s=this.version.getDataRegionSizeColumns(),c=t/r|0,d=n/s|0,g=c*r,x=d*s,E=new X(x,g);for(let A=0;A<c;++A){const I=A*r;for(let O=0;O<d;++O){const L=O*s;for(let F=0;F<r;++F){const q=A*(r+2)+1+F,J=I+F;for(let ce=0;ce<s;++ce){const ue=O*(s+2)+1+ce;if(e.get(ue,q)){const ae=L+ce;E.set(ae,J)}}}}}return E}}class No{constructor(e,t){this.numDataCodewords=e,this.codewords=t}static getDataBlocks(e,t){const n=t.getECBlocks();let r=0;const s=n.getECBlocks();for(let F of s)r+=F.getCount();const c=new Array(r);let d=0;for(let F of s)for(let q=0;q<F.getCount();q++){const J=F.getDataCodewords(),ce=n.getECCodewords()+J;c[d++]=new No(J,new Uint8Array(ce))}const x=c[0].codewords.length-n.getECCodewords(),E=x-1;let A=0;for(let F=0;F<E;F++)for(let q=0;q<d;q++)c[q].codewords[F]=e[A++];const I=t.getVersionNumber()===24,O=I?8:d;for(let F=0;F<O;F++)c[F].codewords[x-1]=e[A++];const L=c[0].codewords.length;for(let F=x;F<L;F++)for(let q=0;q<d;q++){const J=I?(q+8)%d:q,ce=I&&J>7?F-1:F;c[J].codewords[ce]=e[A++]}if(A!==e.length)throw new y;return c}getNumDataCodewords(){return this.numDataCodewords}getCodewords(){return this.codewords}}class To{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,r=this.byteOffset;const s=this.bytes;if(n>0){const c=8-n,d=e<c?e:c,g=c-d,x=255>>8-d<<g;t=(s[r]&x)>>g,e-=d,n+=d,n===8&&(n=0,r++)}if(e>0){for(;e>=8;)t=t<<8|s[r]&255,r++,e-=8;if(e>0){const c=8-e,d=255>>c<<c;t=t<<e|(s[r]&d)>>c,n+=e}}return this.bitOffset=n,this.byteOffset=r,t}available(){return 8*(this.bytes.length-this.byteOffset)-this.bitOffset}}var Tt;(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"})(Tt||(Tt={}));class Wn{static decode(e){const t=new To(e),n=new Z,r=new Z,s=new Array;let c=Tt.ASCII_ENCODE;do if(c===Tt.ASCII_ENCODE)c=this.decodeAsciiSegment(t,n,r);else{switch(c){case Tt.C40_ENCODE:this.decodeC40Segment(t,n);break;case Tt.TEXT_ENCODE:this.decodeTextSegment(t,n);break;case Tt.ANSIX12_ENCODE:this.decodeAnsiX12Segment(t,n);break;case Tt.EDIFACT_ENCODE:this.decodeEdifactSegment(t,n);break;case Tt.BASE256_ENCODE:this.decodeBase256Segment(t,n,s);break;default:throw new U}c=Tt.ASCII_ENCODE}while(c!==Tt.PAD_ENCODE&&t.available()>0);return r.length()>0&&n.append(r.toString()),new Oe(e,n.toString(),s.length===0?null:s,null)}static decodeAsciiSegment(e,t,n){let r=!1;do{let s=e.readBits(8);if(s===0)throw new U;if(s<=128)return r&&(s+=128),t.append(String.fromCharCode(s-1)),Tt.ASCII_ENCODE;if(s===129)return Tt.PAD_ENCODE;if(s<=229){const c=s-130;c<10&&t.append("0"),t.append(""+c)}else switch(s){case 230:return Tt.C40_ENCODE;case 231:return Tt.BASE256_ENCODE;case 232:t.append("");break;case 233:case 234:break;case 235:r=!0;break;case 236:t.append("[)>05"),n.insert(0,"");break;case 237:t.append("[)>06"),n.insert(0,"");break;case 238:return Tt.ANSIX12_ENCODE;case 239:return Tt.TEXT_ENCODE;case 240:return Tt.EDIFACT_ENCODE;case 241:break;default:if(s!==254||e.available()!==0)throw new U;break}}while(e.available()>0);return Tt.ASCII_ENCODE}static decodeC40Segment(e,t){let n=!1;const r=[];let s=0;do{if(e.available()===8)return;const c=e.readBits(8);if(c===254)return;this.parseTwoBytes(c,e.readBits(8),r);for(let d=0;d<3;d++){const g=r[d];switch(s){case 0:if(g<3)s=g+1;else if(g<this.C40_BASIC_SET_CHARS.length){const x=this.C40_BASIC_SET_CHARS[g];n?(t.append(String.fromCharCode(x.charCodeAt(0)+128)),n=!1):t.append(x)}else throw new U;break;case 1:n?(t.append(String.fromCharCode(g+128)),n=!1):t.append(String.fromCharCode(g)),s=0;break;case 2:if(g<this.C40_SHIFT2_SET_CHARS.length){const x=this.C40_SHIFT2_SET_CHARS[g];n?(t.append(String.fromCharCode(x.charCodeAt(0)+128)),n=!1):t.append(x)}else switch(g){case 27:t.append("");break;case 30:n=!0;break;default:throw new U}s=0;break;case 3:n?(t.append(String.fromCharCode(g+224)),n=!1):t.append(String.fromCharCode(g+96)),s=0;break;default:throw new U}}}while(e.available()>0)}static decodeTextSegment(e,t){let n=!1,r=[],s=0;do{if(e.available()===8)return;const c=e.readBits(8);if(c===254)return;this.parseTwoBytes(c,e.readBits(8),r);for(let d=0;d<3;d++){const g=r[d];switch(s){case 0:if(g<3)s=g+1;else if(g<this.TEXT_BASIC_SET_CHARS.length){const x=this.TEXT_BASIC_SET_CHARS[g];n?(t.append(String.fromCharCode(x.charCodeAt(0)+128)),n=!1):t.append(x)}else throw new U;break;case 1:n?(t.append(String.fromCharCode(g+128)),n=!1):t.append(String.fromCharCode(g)),s=0;break;case 2:if(g<this.TEXT_SHIFT2_SET_CHARS.length){const x=this.TEXT_SHIFT2_SET_CHARS[g];n?(t.append(String.fromCharCode(x.charCodeAt(0)+128)),n=!1):t.append(x)}else switch(g){case 27:t.append("");break;case 30:n=!0;break;default:throw new U}s=0;break;case 3:if(g<this.TEXT_SHIFT3_SET_CHARS.length){const x=this.TEXT_SHIFT3_SET_CHARS[g];n?(t.append(String.fromCharCode(x.charCodeAt(0)+128)),n=!1):t.append(x),s=0}else throw new U;break;default:throw new U}}}while(e.available()>0)}static decodeAnsiX12Segment(e,t){const n=[];do{if(e.available()===8)return;const r=e.readBits(8);if(r===254)return;this.parseTwoBytes(r,e.readBits(8),n);for(let s=0;s<3;s++){const c=n[s];switch(c){case 0:t.append("\r");break;case 1:t.append("*");break;case 2:t.append(">");break;case 3:t.append(" ");break;default:if(c<14)t.append(String.fromCharCode(c+44));else if(c<40)t.append(String.fromCharCode(c+51));else throw new U;break}}}while(e.available()>0)}static parseTwoBytes(e,t,n){let r=(e<<8)+t-1,s=Math.floor(r/1600);n[0]=s,r-=s*1600,s=Math.floor(r/40),n[1]=s,n[2]=r-s*40}static decodeEdifactSegment(e,t){do{if(e.available()<=16)return;for(let n=0;n<4;n++){let r=e.readBits(6);if(r===31){const s=8-e.getBitOffset();s!==8&&e.readBits(s);return}r&32||(r|=64),t.append(String.fromCharCode(r))}}while(e.available()>0)}static decodeBase256Segment(e,t,n){let r=1+e.getByteOffset();const s=this.unrandomize255State(e.readBits(8),r++);let c;if(s===0?c=e.available()/8|0:s<250?c=s:c=250*(s-249)+this.unrandomize255State(e.readBits(8),r++),c<0)throw new U;const d=new Uint8Array(c);for(let g=0;g<c;g++){if(e.available()<8)throw new U;d[g]=this.unrandomize255State(e.readBits(8),r++)}n.push(d);try{t.append(G.decode(d,W.ISO88591))}catch(g){throw new nt("Platform does not support required encoding: "+g.message)}}static unrandomize255State(e,t){const n=149*t%255+1,r=e-n;return r>=0?r:r+256}}Wn.C40_BASIC_SET_CHARS=["*","*","*"," ","0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],Wn.C40_SHIFT2_SET_CHARS=["!",'"',"#","$","%","&","'","(",")","*","+",",","-",".","/",":",";","<","=",">","?","@","[","\\","]","^","_"],Wn.TEXT_BASIC_SET_CHARS=["*","*","*"," ","0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"],Wn.TEXT_SHIFT2_SET_CHARS=Wn.C40_SHIFT2_SET_CHARS,Wn.TEXT_SHIFT3_SET_CHARS=["`","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","{","|","}","~",""];class lg{constructor(){this.rsDecoder=new jt(Ee.DATA_MATRIX_FIELD_256)}decode(e){const t=new So(e),n=t.getVersion(),r=t.readCodewords(),s=No.getDataBlocks(r,n);let c=0;for(let x of s)c+=x.getNumDataCodewords();const d=new Uint8Array(c),g=s.length;for(let x=0;x<g;x++){const E=s[x],A=E.getCodewords(),I=E.getNumDataCodewords();this.correctErrors(A,I);for(let O=0;O<I;O++)d[O*g+x]=A[O]}return Wn.decode(d)}correctErrors(e,t){const n=new Int32Array(e);try{this.rsDecoder.decode(n,e.length-t)}catch{throw new B}for(let r=0;r<t;r++)e[r]=n[r]}}class bt{constructor(e){this.image=e,this.rectangleDetector=new bn(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 S;t=this.shiftToModuleCenter(t);const n=t[0],r=t[1],s=t[2],c=t[3];let d=this.transitionsBetween(n,c)+1,g=this.transitionsBetween(s,c)+1;(d&1)===1&&(d+=1),(g&1)===1&&(g+=1),4*d<7*g&&4*g<7*d&&(d=g=Math.max(d,g));let x=bt.sampleGrid(this.image,n,r,s,c,d,g);return new Cr(x,[n,r,s,c])}static shiftPoint(e,t,n){let r=(t.getX()-e.getX())/(n+1),s=(t.getY()-e.getY())/(n+1);return new ye(e.getX()+r,e.getY()+s)}static moveAway(e,t,n){let r=e.getX(),s=e.getY();return r<t?r-=1:r+=1,s<n?s-=1:s+=1,new ye(r,s)}detectSolid1(e){let t=e[0],n=e[1],r=e[3],s=e[2],c=this.transitionsBetween(t,n),d=this.transitionsBetween(n,r),g=this.transitionsBetween(r,s),x=this.transitionsBetween(s,t),E=c,A=[s,t,n,r];return E>d&&(E=d,A[0]=t,A[1]=n,A[2]=r,A[3]=s),E>g&&(E=g,A[0]=n,A[1]=r,A[2]=s,A[3]=t),E>x&&(A[0]=r,A[1]=s,A[2]=t,A[3]=n),A}detectSolid2(e){let t=e[0],n=e[1],r=e[2],s=e[3],c=this.transitionsBetween(t,s),d=bt.shiftPoint(n,r,(c+1)*4),g=bt.shiftPoint(r,n,(c+1)*4),x=this.transitionsBetween(d,t),E=this.transitionsBetween(g,s);return x<E?(e[0]=t,e[1]=n,e[2]=r,e[3]=s):(e[0]=n,e[1]=r,e[2]=s,e[3]=t),e}correctTopRight(e){let t=e[0],n=e[1],r=e[2],s=e[3],c=this.transitionsBetween(t,s),d=this.transitionsBetween(n,s),g=bt.shiftPoint(t,n,(d+1)*4),x=bt.shiftPoint(r,n,(c+1)*4);c=this.transitionsBetween(g,s),d=this.transitionsBetween(x,s);let E=new ye(s.getX()+(r.getX()-n.getX())/(c+1),s.getY()+(r.getY()-n.getY())/(c+1)),A=new ye(s.getX()+(t.getX()-n.getX())/(d+1),s.getY()+(t.getY()-n.getY())/(d+1));if(!this.isValid(E))return this.isValid(A)?A:null;if(!this.isValid(A))return E;let I=this.transitionsBetween(g,E)+this.transitionsBetween(x,E),O=this.transitionsBetween(g,A)+this.transitionsBetween(x,A);return I>O?E:A}shiftToModuleCenter(e){let t=e[0],n=e[1],r=e[2],s=e[3],c=this.transitionsBetween(t,s)+1,d=this.transitionsBetween(r,s)+1,g=bt.shiftPoint(t,n,d*4),x=bt.shiftPoint(r,n,c*4);c=this.transitionsBetween(g,s)+1,d=this.transitionsBetween(x,s)+1,(c&1)===1&&(c+=1),(d&1)===1&&(d+=1);let E=(t.getX()+n.getX()+r.getX()+s.getX())/4,A=(t.getY()+n.getY()+r.getY()+s.getY())/4;t=bt.moveAway(t,E,A),n=bt.moveAway(n,E,A),r=bt.moveAway(r,E,A),s=bt.moveAway(s,E,A);let I,O;return g=bt.shiftPoint(t,n,d*4),g=bt.shiftPoint(g,s,c*4),I=bt.shiftPoint(n,t,d*4),I=bt.shiftPoint(I,r,c*4),x=bt.shiftPoint(r,s,d*4),x=bt.shiftPoint(x,n,c*4),O=bt.shiftPoint(s,r,d*4),O=bt.shiftPoint(O,t,c*4),[g,I,x,O]}isValid(e){return e.getX()>=0&&e.getX()<this.image.getWidth()&&e.getY()>0&&e.getY()<this.image.getHeight()}static sampleGrid(e,t,n,r,s,c,d){return dn.getInstance().sampleGrid(e,c,d,.5,.5,c-.5,.5,c-.5,d-.5,.5,d-.5,t.getX(),t.getY(),s.getX(),s.getY(),r.getX(),r.getY(),n.getX(),n.getY())}transitionsBetween(e,t){let n=Math.trunc(e.getX()),r=Math.trunc(e.getY()),s=Math.trunc(t.getX()),c=Math.trunc(t.getY()),d=Math.abs(c-r)>Math.abs(s-n);if(d){let F=n;n=r,r=F,F=s,s=c,c=F}let g=Math.abs(s-n),x=Math.abs(c-r),E=-g/2,A=r<c?1:-1,I=n<s?1:-1,O=0,L=this.image.get(d?r:n,d?n:r);for(let F=n,q=r;F!==s;F+=I){let J=this.image.get(d?q:F,d?F:q);if(J!==L&&(O++,L=J),E+=x,E>0){if(q===c)break;q+=A,E-=g}}return O}}class Xn{constructor(){this.decoder=new lg}decode(e,t=null){let n,r;if(t!=null&&t.has(ne.PURE_BARCODE)){const x=Xn.extractPureBits(e.getBlackMatrix());n=this.decoder.decode(x),r=Xn.NO_POINTS}else{const x=new bt(e.getBlackMatrix()).detect();n=this.decoder.decode(x.getBits()),r=x.getPoints()}const s=n.getRawBytes(),c=new _e(n.getText(),s,8*s.length,r,fe.DATA_MATRIX,P.currentTimeMillis()),d=n.getByteSegments();d!=null&&c.putMetadata(Xe.BYTE_SEGMENTS,d);const g=n.getECLevel();return g!=null&&c.putMetadata(Xe.ERROR_CORRECTION_LEVEL,g),c}reset(){}static extractPureBits(e){const t=e.getTopLeftOnBit(),n=e.getBottomRightOnBit();if(t==null||n==null)throw new S;const r=this.moduleSize(t,e);let s=t[1];const c=n[1];let d=t[0];const x=(n[0]-d+1)/r,E=(c-s+1)/r;if(x<=0||E<=0)throw new S;const A=r/2;s+=A,d+=A;const I=new X(x,E);for(let O=0;O<E;O++){const L=s+O*r;for(let F=0;F<x;F++)e.get(d+F*r,L)&&I.set(F,O)}return I}static moduleSize(e,t){const n=t.getWidth();let r=e[0];const s=e[1];for(;r<n&&t.get(r,s);)r++;if(r===n)throw new S;const c=r-e[0];if(c===0)throw new S;return c}}Xn.NO_POINTS=[];class cg extends Ne{constructor(e=500){super(new Xn,e)}}var Ar;(function(b){b[b.L=0]="L",b[b.M=1]="M",b[b.Q=2]="Q",b[b.H=3]="H"})(Ar||(Ar={}));class ct{constructor(e,t,n){this.value=e,this.stringValue=t,this.bits=n,ct.FOR_BITS.set(n,this),ct.FOR_VALUE.set(e,this)}getValue(){return this.value}getBits(){return this.bits}static fromString(e){switch(e){case"L":return ct.L;case"M":return ct.M;case"Q":return ct.Q;case"H":return ct.H;default:throw new C(e+"not available")}}toString(){return this.stringValue}equals(e){if(!(e instanceof ct))return!1;const t=e;return this.value===t.value}static forBits(e){if(e<0||e>=ct.FOR_BITS.size)throw new y;return ct.FOR_BITS.get(e)}}ct.FOR_BITS=new Map,ct.FOR_VALUE=new Map,ct.L=new ct(Ar.L,"L",1),ct.M=new ct(Ar.M,"M",0),ct.Q=new ct(Ar.Q,"Q",3),ct.H=new ct(Ar.H,"H",2);class Gt{constructor(e){this.errorCorrectionLevel=ct.forBits(e>>3&3),this.dataMask=e&7}static numBitsDiffering(e,t){return k.bitCount(e^t)}static decodeFormatInformation(e,t){const n=Gt.doDecodeFormatInformation(e,t);return n!==null?n:Gt.doDecodeFormatInformation(e^Gt.FORMAT_INFO_MASK_QR,t^Gt.FORMAT_INFO_MASK_QR)}static doDecodeFormatInformation(e,t){let n=Number.MAX_SAFE_INTEGER,r=0;for(const s of Gt.FORMAT_INFO_DECODE_LOOKUP){const c=s[0];if(c===e||c===t)return new Gt(s[1]);let d=Gt.numBitsDiffering(e,c);d<n&&(r=s[1],n=d),e!==t&&(d=Gt.numBitsDiffering(t,c),d<n&&(r=s[1],n=d))}return n<=3?new Gt(r):null}getErrorCorrectionLevel(){return this.errorCorrectionLevel}getDataMask(){return this.dataMask}hashCode(){return this.errorCorrectionLevel.getBits()<<3|this.dataMask}equals(e){if(!(e instanceof Gt))return!1;const t=e;return this.errorCorrectionLevel===t.errorCorrectionLevel&&this.dataMask===t.dataMask}}Gt.FORMAT_INFO_MASK_QR=21522,Gt.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 Y{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 T{constructor(e,t){this.count=e,this.dataCodewords=t}getCount(){return this.count}getDataCodewords(){return this.dataCodewords}}class Ie{constructor(e,t,...n){this.versionNumber=e,this.alignmentPatternCenters=t,this.ecBlocks=n;let r=0;const s=n[0].getECCodewordsPerBlock(),c=n[0].getECBlocks();for(const d of c)r+=d.getCount()*(d.getDataCodewords()+s);this.totalCodewords=r}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 U;try{return this.getVersionForNumber((e-17)/4)}catch{throw new U}}static getVersionForNumber(e){if(e<1||e>40)throw new y;return Ie.VERSIONS[e-1]}static decodeVersionInformation(e){let t=Number.MAX_SAFE_INTEGER,n=0;for(let r=0;r<Ie.VERSION_DECODE_INFO.length;r++){const s=Ie.VERSION_DECODE_INFO[r];if(s===e)return Ie.getVersionForNumber(r+7);const c=Gt.numBitsDiffering(e,s);c<t&&(n=r+7,t=c)}return t<=3?Ie.getVersionForNumber(n):null}buildFunctionPattern(){const e=this.getDimensionForVersion(),t=new X(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 r=0;r<n;r++){const s=this.alignmentPatternCenters[r]-2;for(let c=0;c<n;c++)r===0&&(c===0||c===n-1)||r===n-1&&c===0||t.setRegion(this.alignmentPatternCenters[c]-2,s,5,5)}return t.setRegion(6,9,1,e-17),t.setRegion(9,6,e-17,1),this.versionNumber>6&&(t.setRegion(e-11,0,3,6),t.setRegion(0,e-11,6,3)),t}toString(){return""+this.versionNumber}}Ie.VERSION_DECODE_INFO=Int32Array.from([31892,34236,39577,42195,48118,51042,55367,58893,63784,68472,70749,76311,79154,84390,87683,92361,96236,102084,102881,110507,110734,117786,119615,126325,127568,133589,136944,141498,145311,150283,152622,158308,161089,167017]),Ie.VERSIONS=[new Ie(1,new Int32Array(0),new Y(7,new T(1,19)),new Y(10,new T(1,16)),new Y(13,new T(1,13)),new Y(17,new T(1,9))),new Ie(2,Int32Array.from([6,18]),new Y(10,new T(1,34)),new Y(16,new T(1,28)),new Y(22,new T(1,22)),new Y(28,new T(1,16))),new Ie(3,Int32Array.from([6,22]),new Y(15,new T(1,55)),new Y(26,new T(1,44)),new Y(18,new T(2,17)),new Y(22,new T(2,13))),new Ie(4,Int32Array.from([6,26]),new Y(20,new T(1,80)),new Y(18,new T(2,32)),new Y(26,new T(2,24)),new Y(16,new T(4,9))),new Ie(5,Int32Array.from([6,30]),new Y(26,new T(1,108)),new Y(24,new T(2,43)),new Y(18,new T(2,15),new T(2,16)),new Y(22,new T(2,11),new T(2,12))),new Ie(6,Int32Array.from([6,34]),new Y(18,new T(2,68)),new Y(16,new T(4,27)),new Y(24,new T(4,19)),new Y(28,new T(4,15))),new Ie(7,Int32Array.from([6,22,38]),new Y(20,new T(2,78)),new Y(18,new T(4,31)),new Y(18,new T(2,14),new T(4,15)),new Y(26,new T(4,13),new T(1,14))),new Ie(8,Int32Array.from([6,24,42]),new Y(24,new T(2,97)),new Y(22,new T(2,38),new T(2,39)),new Y(22,new T(4,18),new T(2,19)),new Y(26,new T(4,14),new T(2,15))),new Ie(9,Int32Array.from([6,26,46]),new Y(30,new T(2,116)),new Y(22,new T(3,36),new T(2,37)),new Y(20,new T(4,16),new T(4,17)),new Y(24,new T(4,12),new T(4,13))),new Ie(10,Int32Array.from([6,28,50]),new Y(18,new T(2,68),new T(2,69)),new Y(26,new T(4,43),new T(1,44)),new Y(24,new T(6,19),new T(2,20)),new Y(28,new T(6,15),new T(2,16))),new Ie(11,Int32Array.from([6,30,54]),new Y(20,new T(4,81)),new Y(30,new T(1,50),new T(4,51)),new Y(28,new T(4,22),new T(4,23)),new Y(24,new T(3,12),new T(8,13))),new Ie(12,Int32Array.from([6,32,58]),new Y(24,new T(2,92),new T(2,93)),new Y(22,new T(6,36),new T(2,37)),new Y(26,new T(4,20),new T(6,21)),new Y(28,new T(7,14),new T(4,15))),new Ie(13,Int32Array.from([6,34,62]),new Y(26,new T(4,107)),new Y(22,new T(8,37),new T(1,38)),new Y(24,new T(8,20),new T(4,21)),new Y(22,new T(12,11),new T(4,12))),new Ie(14,Int32Array.from([6,26,46,66]),new Y(30,new T(3,115),new T(1,116)),new Y(24,new T(4,40),new T(5,41)),new Y(20,new T(11,16),new T(5,17)),new Y(24,new T(11,12),new T(5,13))),new Ie(15,Int32Array.from([6,26,48,70]),new Y(22,new T(5,87),new T(1,88)),new Y(24,new T(5,41),new T(5,42)),new Y(30,new T(5,24),new T(7,25)),new Y(24,new T(11,12),new T(7,13))),new Ie(16,Int32Array.from([6,26,50,74]),new Y(24,new T(5,98),new T(1,99)),new Y(28,new T(7,45),new T(3,46)),new Y(24,new T(15,19),new T(2,20)),new Y(30,new T(3,15),new T(13,16))),new Ie(17,Int32Array.from([6,30,54,78]),new Y(28,new T(1,107),new T(5,108)),new Y(28,new T(10,46),new T(1,47)),new Y(28,new T(1,22),new T(15,23)),new Y(28,new T(2,14),new T(17,15))),new Ie(18,Int32Array.from([6,30,56,82]),new Y(30,new T(5,120),new T(1,121)),new Y(26,new T(9,43),new T(4,44)),new Y(28,new T(17,22),new T(1,23)),new Y(28,new T(2,14),new T(19,15))),new Ie(19,Int32Array.from([6,30,58,86]),new Y(28,new T(3,113),new T(4,114)),new Y(26,new T(3,44),new T(11,45)),new Y(26,new T(17,21),new T(4,22)),new Y(26,new T(9,13),new T(16,14))),new Ie(20,Int32Array.from([6,34,62,90]),new Y(28,new T(3,107),new T(5,108)),new Y(26,new T(3,41),new T(13,42)),new Y(30,new T(15,24),new T(5,25)),new Y(28,new T(15,15),new T(10,16))),new Ie(21,Int32Array.from([6,28,50,72,94]),new Y(28,new T(4,116),new T(4,117)),new Y(26,new T(17,42)),new Y(28,new T(17,22),new T(6,23)),new Y(30,new T(19,16),new T(6,17))),new Ie(22,Int32Array.from([6,26,50,74,98]),new Y(28,new T(2,111),new T(7,112)),new Y(28,new T(17,46)),new Y(30,new T(7,24),new T(16,25)),new Y(24,new T(34,13))),new Ie(23,Int32Array.from([6,30,54,78,102]),new Y(30,new T(4,121),new T(5,122)),new Y(28,new T(4,47),new T(14,48)),new Y(30,new T(11,24),new T(14,25)),new Y(30,new T(16,15),new T(14,16))),new Ie(24,Int32Array.from([6,28,54,80,106]),new Y(30,new T(6,117),new T(4,118)),new Y(28,new T(6,45),new T(14,46)),new Y(30,new T(11,24),new T(16,25)),new Y(30,new T(30,16),new T(2,17))),new Ie(25,Int32Array.from([6,32,58,84,110]),new Y(26,new T(8,106),new T(4,107)),new Y(28,new T(8,47),new T(13,48)),new Y(30,new T(7,24),new T(22,25)),new Y(30,new T(22,15),new T(13,16))),new Ie(26,Int32Array.from([6,30,58,86,114]),new Y(28,new T(10,114),new T(2,115)),new Y(28,new T(19,46),new T(4,47)),new Y(28,new T(28,22),new T(6,23)),new Y(30,new T(33,16),new T(4,17))),new Ie(27,Int32Array.from([6,34,62,90,118]),new Y(30,new T(8,122),new T(4,123)),new Y(28,new T(22,45),new T(3,46)),new Y(30,new T(8,23),new T(26,24)),new Y(30,new T(12,15),new T(28,16))),new Ie(28,Int32Array.from([6,26,50,74,98,122]),new Y(30,new T(3,117),new T(10,118)),new Y(28,new T(3,45),new T(23,46)),new Y(30,new T(4,24),new T(31,25)),new Y(30,new T(11,15),new T(31,16))),new Ie(29,Int32Array.from([6,30,54,78,102,126]),new Y(30,new T(7,116),new T(7,117)),new Y(28,new T(21,45),new T(7,46)),new Y(30,new T(1,23),new T(37,24)),new Y(30,new T(19,15),new T(26,16))),new Ie(30,Int32Array.from([6,26,52,78,104,130]),new Y(30,new T(5,115),new T(10,116)),new Y(28,new T(19,47),new T(10,48)),new Y(30,new T(15,24),new T(25,25)),new Y(30,new T(23,15),new T(25,16))),new Ie(31,Int32Array.from([6,30,56,82,108,134]),new Y(30,new T(13,115),new T(3,116)),new Y(28,new T(2,46),new T(29,47)),new Y(30,new T(42,24),new T(1,25)),new Y(30,new T(23,15),new T(28,16))),new Ie(32,Int32Array.from([6,34,60,86,112,138]),new Y(30,new T(17,115)),new Y(28,new T(10,46),new T(23,47)),new Y(30,new T(10,24),new T(35,25)),new Y(30,new T(19,15),new T(35,16))),new Ie(33,Int32Array.from([6,30,58,86,114,142]),new Y(30,new T(17,115),new T(1,116)),new Y(28,new T(14,46),new T(21,47)),new Y(30,new T(29,24),new T(19,25)),new Y(30,new T(11,15),new T(46,16))),new Ie(34,Int32Array.from([6,34,62,90,118,146]),new Y(30,new T(13,115),new T(6,116)),new Y(28,new T(14,46),new T(23,47)),new Y(30,new T(44,24),new T(7,25)),new Y(30,new T(59,16),new T(1,17))),new Ie(35,Int32Array.from([6,30,54,78,102,126,150]),new Y(30,new T(12,121),new T(7,122)),new Y(28,new T(12,47),new T(26,48)),new Y(30,new T(39,24),new T(14,25)),new Y(30,new T(22,15),new T(41,16))),new Ie(36,Int32Array.from([6,24,50,76,102,128,154]),new Y(30,new T(6,121),new T(14,122)),new Y(28,new T(6,47),new T(34,48)),new Y(30,new T(46,24),new T(10,25)),new Y(30,new T(2,15),new T(64,16))),new Ie(37,Int32Array.from([6,28,54,80,106,132,158]),new Y(30,new T(17,122),new T(4,123)),new Y(28,new T(29,46),new T(14,47)),new Y(30,new T(49,24),new T(10,25)),new Y(30,new T(24,15),new T(46,16))),new Ie(38,Int32Array.from([6,32,58,84,110,136,162]),new Y(30,new T(4,122),new T(18,123)),new Y(28,new T(13,46),new T(32,47)),new Y(30,new T(48,24),new T(14,25)),new Y(30,new T(42,15),new T(32,16))),new Ie(39,Int32Array.from([6,26,54,82,110,138,166]),new Y(30,new T(20,117),new T(4,118)),new Y(28,new T(40,47),new T(7,48)),new Y(30,new T(43,24),new T(22,25)),new Y(30,new T(10,15),new T(67,16))),new Ie(40,Int32Array.from([6,30,58,86,114,142,170]),new Y(30,new T(19,118),new T(6,119)),new Y(28,new T(18,47),new T(31,48)),new Y(30,new T(34,24),new T(34,25)),new Y(30,new T(20,15),new T(61,16)))];var Mt;(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"})(Mt||(Mt={}));class hn{constructor(e,t){this.value=e,this.isMasked=t}unmaskBitMatrix(e,t){for(let n=0;n<t;n++)for(let r=0;r<t;r++)this.isMasked(n,r)&&e.flip(r,n)}}hn.values=new Map([[Mt.DATA_MASK_000,new hn(Mt.DATA_MASK_000,(b,e)=>(b+e&1)===0)],[Mt.DATA_MASK_001,new hn(Mt.DATA_MASK_001,(b,e)=>(b&1)===0)],[Mt.DATA_MASK_010,new hn(Mt.DATA_MASK_010,(b,e)=>e%3===0)],[Mt.DATA_MASK_011,new hn(Mt.DATA_MASK_011,(b,e)=>(b+e)%3===0)],[Mt.DATA_MASK_100,new hn(Mt.DATA_MASK_100,(b,e)=>(Math.floor(b/2)+Math.floor(e/3)&1)===0)],[Mt.DATA_MASK_101,new hn(Mt.DATA_MASK_101,(b,e)=>b*e%6===0)],[Mt.DATA_MASK_110,new hn(Mt.DATA_MASK_110,(b,e)=>b*e%6<3)],[Mt.DATA_MASK_111,new hn(Mt.DATA_MASK_111,(b,e)=>(b+e+b*e%3&1)===0)]]);class ug{constructor(e){const t=e.getHeight();if(t<21||(t&3)!==1)throw new U;this.bitMatrix=e}readFormatInformation(){if(this.parsedFormatInfo!==null&&this.parsedFormatInfo!==void 0)return this.parsedFormatInfo;let e=0;for(let s=0;s<6;s++)e=this.copyBit(s,8,e);e=this.copyBit(7,8,e),e=this.copyBit(8,8,e),e=this.copyBit(8,7,e);for(let s=5;s>=0;s--)e=this.copyBit(8,s,e);const t=this.bitMatrix.getHeight();let n=0;const r=t-7;for(let s=t-1;s>=r;s--)n=this.copyBit(8,s,n);for(let s=t-8;s<t;s++)n=this.copyBit(s,8,n);if(this.parsedFormatInfo=Gt.decodeFormatInformation(e,n),this.parsedFormatInfo!==null)return this.parsedFormatInfo;throw new U}readVersion(){if(this.parsedVersion!==null&&this.parsedVersion!==void 0)return this.parsedVersion;const e=this.bitMatrix.getHeight(),t=Math.floor((e-17)/4);if(t<=6)return Ie.getVersionForNumber(t);let n=0;const r=e-11;for(let c=5;c>=0;c--)for(let d=e-9;d>=r;d--)n=this.copyBit(d,c,n);let s=Ie.decodeVersionInformation(n);if(s!==null&&s.getDimensionForVersion()===e)return this.parsedVersion=s,s;n=0;for(let c=5;c>=0;c--)for(let d=e-9;d>=r;d--)n=this.copyBit(c,d,n);if(s=Ie.decodeVersionInformation(n),s!==null&&s.getDimensionForVersion()===e)return this.parsedVersion=s,s;throw new U}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=hn.values.get(e.getDataMask()),r=this.bitMatrix.getHeight();n.unmaskBitMatrix(this.bitMatrix,r);const s=t.buildFunctionPattern();let c=!0;const d=new Uint8Array(t.getTotalCodewords());let g=0,x=0,E=0;for(let A=r-1;A>0;A-=2){A===6&&A--;for(let I=0;I<r;I++){const O=c?r-1-I:I;for(let L=0;L<2;L++)s.get(A-L,O)||(E++,x<<=1,this.bitMatrix.get(A-L,O)&&(x|=1),E===8&&(d[g++]=x,E=0,x=0))}c=!c}if(g!==t.getTotalCodewords())throw new U;return d}remask(){if(this.parsedFormatInfo===null)return;const e=hn.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 r=t+1,s=e.getHeight();r<s;r++)e.get(t,r)!==e.get(r,t)&&(e.flip(r,t),e.flip(t,r))}}class ko{constructor(e,t){this.numDataCodewords=e,this.codewords=t}static getDataBlocks(e,t,n){if(e.length!==t.getTotalCodewords())throw new y;const r=t.getECBlocksForLevel(n);let s=0;const c=r.getECBlocks();for(const L of c)s+=L.getCount();const d=new Array(s);let g=0;for(const L of c)for(let F=0;F<L.getCount();F++){const q=L.getDataCodewords(),J=r.getECCodewordsPerBlock()+q;d[g++]=new ko(q,new Uint8Array(J))}const x=d[0].codewords.length;let E=d.length-1;for(;E>=0&&d[E].codewords.length!==x;)E--;E++;const A=x-r.getECCodewordsPerBlock();let I=0;for(let L=0;L<A;L++)for(let F=0;F<g;F++)d[F].codewords[L]=e[I++];for(let L=E;L<g;L++)d[L].codewords[A]=e[I++];const O=d[0].codewords.length;for(let L=A;L<O;L++)for(let F=0;F<g;F++){const q=F<E?L:L+1;d[F].codewords[q]=e[I++]}return d}getNumDataCodewords(){return this.numDataCodewords}getCodewords(){return this.codewords}}var gn;(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"})(gn||(gn={}));class Se{constructor(e,t,n,r){this.value=e,this.stringValue=t,this.characterCountBitsForVersions=n,this.bits=r,Se.FOR_BITS.set(r,this),Se.FOR_VALUE.set(e,this)}static forBits(e){const t=Se.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 Se))return!1;const t=e;return this.value===t.value}toString(){return this.stringValue}}Se.FOR_BITS=new Map,Se.FOR_VALUE=new Map,Se.TERMINATOR=new Se(gn.TERMINATOR,"TERMINATOR",Int32Array.from([0,0,0]),0),Se.NUMERIC=new Se(gn.NUMERIC,"NUMERIC",Int32Array.from([10,12,14]),1),Se.ALPHANUMERIC=new Se(gn.ALPHANUMERIC,"ALPHANUMERIC",Int32Array.from([9,11,13]),2),Se.STRUCTURED_APPEND=new Se(gn.STRUCTURED_APPEND,"STRUCTURED_APPEND",Int32Array.from([0,0,0]),3),Se.BYTE=new Se(gn.BYTE,"BYTE",Int32Array.from([8,16,16]),4),Se.ECI=new Se(gn.ECI,"ECI",Int32Array.from([0,0,0]),7),Se.KANJI=new Se(gn.KANJI,"KANJI",Int32Array.from([8,10,12]),8),Se.FNC1_FIRST_POSITION=new Se(gn.FNC1_FIRST_POSITION,"FNC1_FIRST_POSITION",Int32Array.from([0,0,0]),5),Se.FNC1_SECOND_POSITION=new Se(gn.FNC1_SECOND_POSITION,"FNC1_SECOND_POSITION",Int32Array.from([0,0,0]),9),Se.HANZI=new Se(gn.HANZI,"HANZI",Int32Array.from([8,10,12]),13);class wt{static decode(e,t,n,r){const s=new To(e);let c=new Z;const d=new Array;let g=-1,x=-1;try{let E=null,A=!1,I;do{if(s.available()<4)I=Se.TERMINATOR;else{const O=s.readBits(4);I=Se.forBits(O)}switch(I){case Se.TERMINATOR:break;case Se.FNC1_FIRST_POSITION:case Se.FNC1_SECOND_POSITION:A=!0;break;case Se.STRUCTURED_APPEND:if(s.available()<16)throw new U;g=s.readBits(8),x=s.readBits(8);break;case Se.ECI:const O=wt.parseECIValue(s);if(E=z.getCharacterSetECIByValue(O),E===null)throw new U;break;case Se.HANZI:const L=s.readBits(4),F=s.readBits(I.getCharacterCountBits(t));L===wt.GB2312_SUBSET&&wt.decodeHanziSegment(s,c,F);break;default:const q=s.readBits(I.getCharacterCountBits(t));switch(I){case Se.NUMERIC:wt.decodeNumericSegment(s,c,q);break;case Se.ALPHANUMERIC:wt.decodeAlphanumericSegment(s,c,q,A);break;case Se.BYTE:wt.decodeByteSegment(s,c,q,E,d,r);break;case Se.KANJI:wt.decodeKanjiSegment(s,c,q);break;default:throw new U}break}}while(I!==Se.TERMINATOR)}catch{throw new U}return new Oe(e,c.toString(),d.length===0?null:d,n===null?null:n.toString(),g,x)}static decodeHanziSegment(e,t,n){if(n*13>e.available())throw new U;const r=new Uint8Array(2*n);let s=0;for(;n>0;){const c=e.readBits(13);let d=c/96<<8&4294967295|c%96;d<959?d+=41377:d+=42657,r[s]=d>>8&255,r[s+1]=d&255,s+=2,n--}try{t.append(G.decode(r,W.GB2312))}catch(c){throw new U(c)}}static decodeKanjiSegment(e,t,n){if(n*13>e.available())throw new U;const r=new Uint8Array(2*n);let s=0;for(;n>0;){const c=e.readBits(13);let d=c/192<<8&4294967295|c%192;d<7936?d+=33088:d+=49472,r[s]=d>>8,r[s+1]=d,s+=2,n--}try{t.append(G.decode(r,W.SHIFT_JIS))}catch(c){throw new U(c)}}static decodeByteSegment(e,t,n,r,s,c){if(8*n>e.available())throw new U;const d=new Uint8Array(n);for(let x=0;x<n;x++)d[x]=e.readBits(8);let g;r===null?g=W.guessEncoding(d,c):g=r.getName();try{t.append(G.decode(d,g))}catch(x){throw new U(x)}s.push(d)}static toAlphaNumericChar(e){if(e>=wt.ALPHANUMERIC_CHARS.length)throw new U;return wt.ALPHANUMERIC_CHARS[e]}static decodeAlphanumericSegment(e,t,n,r){const s=t.length();for(;n>1;){if(e.available()<11)throw new U;const c=e.readBits(11);t.append(wt.toAlphaNumericChar(Math.floor(c/45))),t.append(wt.toAlphaNumericChar(c%45)),n-=2}if(n===1){if(e.available()<6)throw new U;t.append(wt.toAlphaNumericChar(e.readBits(6)))}if(r)for(let c=s;c<t.length();c++)t.charAt(c)==="%"&&(c<t.length()-1&&t.charAt(c+1)==="%"?t.deleteCharAt(c+1):t.setCharAt(c,""))}static decodeNumericSegment(e,t,n){for(;n>=3;){if(e.available()<10)throw new U;const r=e.readBits(10);if(r>=1e3)throw new U;t.append(wt.toAlphaNumericChar(Math.floor(r/100))),t.append(wt.toAlphaNumericChar(Math.floor(r/10)%10)),t.append(wt.toAlphaNumericChar(r%10)),n-=3}if(n===2){if(e.available()<7)throw new U;const r=e.readBits(7);if(r>=100)throw new U;t.append(wt.toAlphaNumericChar(Math.floor(r/10))),t.append(wt.toAlphaNumericChar(r%10))}else if(n===1){if(e.available()<4)throw new U;const r=e.readBits(4);if(r>=10)throw new U;t.append(wt.toAlphaNumericChar(r))}}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 U}}wt.ALPHANUMERIC_CHARS="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:",wt.GB2312_SUBSET=1;class La{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 dg{constructor(){this.rsDecoder=new jt(Ee.QR_CODE_FIELD_256)}decodeBooleanArray(e,t){return this.decodeBitMatrix(X.parseFromBooleanArray(e),t)}decodeBitMatrix(e,t){const n=new ug(e);let r=null;try{return this.decodeBitMatrixParser(n,t)}catch(s){r=s}try{n.remask(),n.setMirror(!0),n.readVersion(),n.readFormatInformation(),n.mirror();const s=this.decodeBitMatrixParser(n,t);return s.setOther(new La(!0)),s}catch(s){throw r!==null?r:s}}decodeBitMatrixParser(e,t){const n=e.readVersion(),r=e.readFormatInformation().getErrorCorrectionLevel(),s=e.readCodewords(),c=ko.getDataBlocks(s,n,r);let d=0;for(const E of c)d+=E.getNumDataCodewords();const g=new Uint8Array(d);let x=0;for(const E of c){const A=E.getCodewords(),I=E.getNumDataCodewords();this.correctErrors(A,I);for(let O=0;O<I;O++)g[x++]=A[O]}return wt.decode(g,n,r,t)}correctErrors(e,t){const n=new Int32Array(e);try{this.rsDecoder.decode(n,e.length-t)}catch{throw new B}for(let r=0;r<t;r++)e[r]=n[r]}}class Ro 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 r=Math.abs(e-this.estimatedModuleSize);return r<=1||r<=this.estimatedModuleSize}return!1}combineEstimate(e,t,n){const r=(this.getX()+t)/2,s=(this.getY()+e)/2,c=(this.estimatedModuleSize+n)/2;return new Ro(r,s,c)}}class Si{constructor(e,t,n,r,s,c,d){this.image=e,this.startX=t,this.startY=n,this.width=r,this.height=s,this.moduleSize=c,this.resultPointCallback=d,this.possibleCenters=[],this.crossCheckStateCount=new Int32Array(3)}find(){const e=this.startX,t=this.height,n=this.width,r=e+n,s=this.startY+t/2,c=new Int32Array(3),d=this.image;for(let g=0;g<t;g++){const x=s+(g&1?-Math.floor((g+1)/2):Math.floor((g+1)/2));c[0]=0,c[1]=0,c[2]=0;let E=e;for(;E<r&&!d.get(E,x);)E++;let A=0;for(;E<r;){if(d.get(E,x))if(A===1)c[1]++;else if(A===2){if(this.foundPatternCross(c)){const I=this.handlePossibleCenter(c,x,E);if(I!==null)return I}c[0]=c[2],c[1]=1,c[2]=0,A=1}else c[++A]++;else A===1&&A++,c[A]++;E++}if(this.foundPatternCross(c)){const I=this.handlePossibleCenter(c,x,r);if(I!==null)return I}}if(this.possibleCenters.length!==0)return this.possibleCenters[0];throw new S}static centerFromEnd(e,t){return t-e[2]-e[1]/2}foundPatternCross(e){const t=this.moduleSize,n=t/2;for(let r=0;r<3;r++)if(Math.abs(t-e[r])>=n)return!1;return!0}crossCheckVertical(e,t,n,r){const s=this.image,c=s.getHeight(),d=this.crossCheckStateCount;d[0]=0,d[1]=0,d[2]=0;let g=e;for(;g>=0&&s.get(t,g)&&d[1]<=n;)d[1]++,g--;if(g<0||d[1]>n)return NaN;for(;g>=0&&!s.get(t,g)&&d[0]<=n;)d[0]++,g--;if(d[0]>n)return NaN;for(g=e+1;g<c&&s.get(t,g)&&d[1]<=n;)d[1]++,g++;if(g===c||d[1]>n)return NaN;for(;g<c&&!s.get(t,g)&&d[2]<=n;)d[2]++,g++;if(d[2]>n)return NaN;const x=d[0]+d[1]+d[2];return 5*Math.abs(x-r)>=2*r?NaN:this.foundPatternCross(d)?Si.centerFromEnd(d,g):NaN}handlePossibleCenter(e,t,n){const r=e[0]+e[1]+e[2],s=Si.centerFromEnd(e,n),c=this.crossCheckVertical(t,s,2*e[1],r);if(!isNaN(c)){const d=(e[0]+e[1]+e[2])/3;for(const x of this.possibleCenters)if(x.aboutEquals(d,c,s))return x.combineEstimate(c,s,d);const g=new Ro(s,c,d);this.possibleCenters.push(g),this.resultPointCallback!==null&&this.resultPointCallback!==void 0&&this.resultPointCallback.foundPossibleResultPoint(g)}return null}}class Oo extends ye{constructor(e,t,n,r){super(e,t),this.estimatedModuleSize=n,this.count=r,r===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 r=Math.abs(e-this.estimatedModuleSize);return r<=1||r<=this.estimatedModuleSize}return!1}combineEstimate(e,t,n){const r=this.count+1,s=(this.count*this.getX()+t)/r,c=(this.count*this.getY()+e)/r,d=(this.count*this.estimatedModuleSize+n)/r;return new Oo(s,c,d,r)}}class fg{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(ne.TRY_HARDER)!==void 0,n=e!=null&&e.get(ne.PURE_BARCODE)!==void 0,r=this.image,s=r.getHeight(),c=r.getWidth();let d=Math.floor(3*s/(4*vt.MAX_MODULES));(d<vt.MIN_SKIP||t)&&(d=vt.MIN_SKIP);let g=!1;const x=new Int32Array(5);for(let A=d-1;A<s&&!g;A+=d){x[0]=0,x[1]=0,x[2]=0,x[3]=0,x[4]=0;let I=0;for(let O=0;O<c;O++)if(r.get(O,A))(I&1)===1&&I++,x[I]++;else if(I&1)x[I]++;else if(I===4)if(vt.foundPatternCross(x)){if(this.handlePossibleCenter(x,A,O,n)===!0)if(d=2,this.hasSkipped===!0)g=this.haveMultiplyConfirmedCenters();else{const F=this.findRowSkip();F>x[2]&&(A+=F-x[2]-d,O=c-1)}else{x[0]=x[2],x[1]=x[3],x[2]=x[4],x[3]=1,x[4]=0,I=3;continue}I=0,x[0]=0,x[1]=0,x[2]=0,x[3]=0,x[4]=0}else x[0]=x[2],x[1]=x[3],x[2]=x[4],x[3]=1,x[4]=0,I=3;else x[++I]++;vt.foundPatternCross(x)&&this.handlePossibleCenter(x,A,c,n)===!0&&(d=x[0],this.hasSkipped&&(g=this.haveMultiplyConfirmedCenters()))}const E=this.selectBestPatterns();return ye.orderBestPatterns(E),new fg(E)}static centerFromEnd(e,t){return t-e[4]-e[3]-e[2]/2}static foundPatternCross(e){let t=0;for(let s=0;s<5;s++){const c=e[s];if(c===0)return!1;t+=c}if(t<7)return!1;const n=t/7,r=n/2;return Math.abs(n-e[0])<r&&Math.abs(n-e[1])<r&&Math.abs(3*n-e[2])<3*r&&Math.abs(n-e[3])<r&&Math.abs(n-e[4])<r}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,r){const s=this.getCrossCheckStateCount();let c=0;const d=this.image;for(;e>=c&&t>=c&&d.get(t-c,e-c);)s[2]++,c++;if(e<c||t<c)return!1;for(;e>=c&&t>=c&&!d.get(t-c,e-c)&&s[1]<=n;)s[1]++,c++;if(e<c||t<c||s[1]>n)return!1;for(;e>=c&&t>=c&&d.get(t-c,e-c)&&s[0]<=n;)s[0]++,c++;if(s[0]>n)return!1;const g=d.getHeight(),x=d.getWidth();for(c=1;e+c<g&&t+c<x&&d.get(t+c,e+c);)s[2]++,c++;if(e+c>=g||t+c>=x)return!1;for(;e+c<g&&t+c<x&&!d.get(t+c,e+c)&&s[3]<n;)s[3]++,c++;if(e+c>=g||t+c>=x||s[3]>=n)return!1;for(;e+c<g&&t+c<x&&d.get(t+c,e+c)&&s[4]<n;)s[4]++,c++;if(s[4]>=n)return!1;const E=s[0]+s[1]+s[2]+s[3]+s[4];return Math.abs(E-r)<2*r&&vt.foundPatternCross(s)}crossCheckVertical(e,t,n,r){const s=this.image,c=s.getHeight(),d=this.getCrossCheckStateCount();let g=e;for(;g>=0&&s.get(t,g);)d[2]++,g--;if(g<0)return NaN;for(;g>=0&&!s.get(t,g)&&d[1]<=n;)d[1]++,g--;if(g<0||d[1]>n)return NaN;for(;g>=0&&s.get(t,g)&&d[0]<=n;)d[0]++,g--;if(d[0]>n)return NaN;for(g=e+1;g<c&&s.get(t,g);)d[2]++,g++;if(g===c)return NaN;for(;g<c&&!s.get(t,g)&&d[3]<n;)d[3]++,g++;if(g===c||d[3]>=n)return NaN;for(;g<c&&s.get(t,g)&&d[4]<n;)d[4]++,g++;if(d[4]>=n)return NaN;const x=d[0]+d[1]+d[2]+d[3]+d[4];return 5*Math.abs(x-r)>=2*r?NaN:vt.foundPatternCross(d)?vt.centerFromEnd(d,g):NaN}crossCheckHorizontal(e,t,n,r){const s=this.image,c=s.getWidth(),d=this.getCrossCheckStateCount();let g=e;for(;g>=0&&s.get(g,t);)d[2]++,g--;if(g<0)return NaN;for(;g>=0&&!s.get(g,t)&&d[1]<=n;)d[1]++,g--;if(g<0||d[1]>n)return NaN;for(;g>=0&&s.get(g,t)&&d[0]<=n;)d[0]++,g--;if(d[0]>n)return NaN;for(g=e+1;g<c&&s.get(g,t);)d[2]++,g++;if(g===c)return NaN;for(;g<c&&!s.get(g,t)&&d[3]<n;)d[3]++,g++;if(g===c||d[3]>=n)return NaN;for(;g<c&&s.get(g,t)&&d[4]<n;)d[4]++,g++;if(d[4]>=n)return NaN;const x=d[0]+d[1]+d[2]+d[3]+d[4];return 5*Math.abs(x-r)>=r?NaN:vt.foundPatternCross(d)?vt.centerFromEnd(d,g):NaN}handlePossibleCenter(e,t,n,r){const s=e[0]+e[1]+e[2]+e[3]+e[4];let c=vt.centerFromEnd(e,n),d=this.crossCheckVertical(t,Math.floor(c),e[2],s);if(!isNaN(d)&&(c=this.crossCheckHorizontal(Math.floor(c),Math.floor(d),e[2],s),!isNaN(c)&&(!r||this.crossCheckDiagonal(Math.floor(d),Math.floor(c),e[2],s)))){const g=s/7;let x=!1;const E=this.possibleCenters;for(let A=0,I=E.length;A<I;A++){const O=E[A];if(O.aboutEquals(g,d,c)){E[A]=O.combineEstimate(d,c,g),x=!0;break}}if(!x){const A=new Oo(c,d,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 c of this.possibleCenters)c.getCount()>=vt.CENTER_QUORUM&&(e++,t+=c.getEstimatedModuleSize());if(e<3)return!1;const r=t/n;let s=0;for(const c of this.possibleCenters)s+=Math.abs(c.getEstimatedModuleSize()-r);return s<=.05*t}selectBestPatterns(){const e=this.possibleCenters.length;if(e<3)throw new S;const t=this.possibleCenters;let n;if(e>3){let r=0,s=0;for(const g of this.possibleCenters){const x=g.getEstimatedModuleSize();r+=x,s+=x*x}n=r/e;let c=Math.sqrt(s/e-n*n);t.sort((g,x)=>{const E=Math.abs(x.getEstimatedModuleSize()-n),A=Math.abs(g.getEstimatedModuleSize()-n);return E<A?-1:E>A?1:0});const d=Math.max(.2*n,c);for(let g=0;g<t.length&&t.length>3;g++){const x=t[g];Math.abs(x.getEstimatedModuleSize()-n)>d&&(t.splice(g,1),g--)}}if(t.length>3){let r=0;for(const s of t)r+=s.getEstimatedModuleSize();n=r/t.length,t.sort((s,c)=>{if(c.getCount()===s.getCount()){const d=Math.abs(c.getEstimatedModuleSize()-n),g=Math.abs(s.getEstimatedModuleSize()-n);return d<g?1:d>g?-1:0}else return c.getCount()-s.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(ne.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(),r=e.getBottomLeft(),s=this.calculateModuleSize(t,n,r);if(s<1)throw new S("No pattern found in proccess finder.");const c=zr.computeDimension(t,n,r,s),d=Ie.getProvisionalVersionForDimension(c),g=d.getDimensionForVersion()-7;let x=null;if(d.getAlignmentPatternCenters().length>0){const O=n.getX()-t.getX()+r.getX(),L=n.getY()-t.getY()+r.getY(),F=1-3/g,q=Math.floor(t.getX()+F*(O-t.getX())),J=Math.floor(t.getY()+F*(L-t.getY()));for(let ce=4;ce<=16;ce<<=1)try{x=this.findAlignmentInRegion(s,q,J,ce);break}catch(ue){if(!(ue instanceof S))throw ue}}const E=zr.createTransform(t,n,r,x,c),A=zr.sampleGrid(this.image,E,c);let I;return x===null?I=[r,t,n]:I=[r,t,n,x],new Cr(A,I)}static createTransform(e,t,n,r,s){const c=s-3.5;let d,g,x,E;return r!==null?(d=r.getX(),g=r.getY(),x=c-3,E=x):(d=t.getX()-e.getX()+n.getX(),g=t.getY()-e.getY()+n.getY(),x=c,E=c),Dt.quadrilateralToQuadrilateral(3.5,3.5,c,3.5,x,E,3.5,c,e.getX(),e.getY(),t.getX(),t.getY(),d,g,n.getX(),n.getY())}static sampleGrid(e,t,n){return dn.getInstance().sampleGridWithTransform(e,n,n,t)}static computeDimension(e,t,n,r){const s=ze.round(ye.distance(e,t)/r),c=ze.round(ye.distance(e,n)/r);let d=Math.floor((s+c)/2)+7;switch(d&3){case 0:d++;break;case 2:d--;break;case 3:throw new S("Dimensions could be not found.")}return d}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())),r=this.sizeOfBlackWhiteBlackRunBothWays(Math.floor(t.getX()),Math.floor(t.getY()),Math.floor(e.getX()),Math.floor(e.getY()));return isNaN(n)?r/7:isNaN(r)?n/7:(n+r)/14}sizeOfBlackWhiteBlackRunBothWays(e,t,n,r){let s=this.sizeOfBlackWhiteBlackRun(e,t,n,r),c=1,d=e-(n-e);d<0?(c=e/(e-d),d=0):d>=this.image.getWidth()&&(c=(this.image.getWidth()-1-e)/(d-e),d=this.image.getWidth()-1);let g=Math.floor(t-(r-t)*c);return c=1,g<0?(c=t/(t-g),g=0):g>=this.image.getHeight()&&(c=(this.image.getHeight()-1-t)/(g-t),g=this.image.getHeight()-1),d=Math.floor(e+(d-e)*c),s+=this.sizeOfBlackWhiteBlackRun(e,t,d,g),s-1}sizeOfBlackWhiteBlackRun(e,t,n,r){const s=Math.abs(r-t)>Math.abs(n-e);if(s){let O=e;e=t,t=O,O=n,n=r,r=O}const c=Math.abs(n-e),d=Math.abs(r-t);let g=-c/2;const x=e<n?1:-1,E=t<r?1:-1;let A=0;const I=n+x;for(let O=e,L=t;O!==I;O+=x){const F=s?L:O,q=s?O:L;if(A===1===this.image.get(F,q)){if(A===2)return ze.distance(O,L,e,t);A++}if(g+=d,g>0){if(L===r)break;L+=E,g-=c}}return A===2?ze.distance(n+x,r,e,t):NaN}findAlignmentInRegion(e,t,n,r){const s=Math.floor(r*e),c=Math.max(0,t-s),d=Math.min(this.image.getWidth()-1,t+s);if(d-c<e*3)throw new S("Alignment top exceeds estimated module size.");const g=Math.max(0,n-s),x=Math.min(this.image.getHeight()-1,n+s);if(x-g<e*3)throw new S("Alignment bottom exceeds estimated module size.");return new Si(this.image,c,g,d-c,x-g,e,this.resultPointCallback).find()}}class jn{constructor(){this.decoder=new dg}getDecoder(){return this.decoder}decode(e,t){let n,r;if(t!=null&&t.get(ne.PURE_BARCODE)!==void 0){const g=jn.extractPureBits(e.getBlackMatrix());n=this.decoder.decodeBitMatrix(g,t),r=jn.NO_POINTS}else{const g=new zr(e.getBlackMatrix()).detect(t);n=this.decoder.decodeBitMatrix(g.getBits(),t),r=g.getPoints()}n.getOther()instanceof La&&n.getOther().applyMirroredCorrection(r);const s=new _e(n.getText(),n.getRawBytes(),void 0,r,fe.QR_CODE,void 0),c=n.getByteSegments();c!==null&&s.putMetadata(Xe.BYTE_SEGMENTS,c);const d=n.getECLevel();return d!==null&&s.putMetadata(Xe.ERROR_CORRECTION_LEVEL,d),n.hasStructuredAppend()&&(s.putMetadata(Xe.STRUCTURED_APPEND_SEQUENCE,n.getStructuredAppendSequenceNumber()),s.putMetadata(Xe.STRUCTURED_APPEND_PARITY,n.getStructuredAppendParity())),s}reset(){}static extractPureBits(e){const t=e.getTopLeftOnBit(),n=e.getBottomRightOnBit();if(t===null||n===null)throw new S;const r=this.moduleSize(t,e);let s=t[1],c=n[1],d=t[0],g=n[0];if(d>=g||s>=c)throw new S;if(c-s!==g-d&&(g=d+(c-s),g>=e.getWidth()))throw new S;const x=Math.round((g-d+1)/r),E=Math.round((c-s+1)/r);if(x<=0||E<=0)throw new S;if(E!==x)throw new S;const A=Math.floor(r/2);s+=A,d+=A;const I=d+Math.floor((x-1)*r)-g;if(I>0){if(I>A)throw new S;d-=I}const O=s+Math.floor((E-1)*r)-c;if(O>0){if(O>A)throw new S;s-=O}const L=new X(x,E);for(let F=0;F<E;F++){const q=s+Math.floor(F*r);for(let J=0;J<x;J++)e.get(d+Math.floor(J*r),q)&&L.set(J,F)}return L}static moduleSize(e,t){const n=t.getHeight(),r=t.getWidth();let s=e[0],c=e[1],d=!0,g=0;for(;s<r&&c<n;){if(d!==t.get(s,c)){if(++g===5)break;d=!d}s++,c++}if(s===r||c===n)throw new S;return(s-e[0])/7}}jn.NO_POINTS=new Array;class ke{PDF417Common(){}static getBitCountSum(e){return ze.sum(e)}static toIntArray(e){if(e==null||!e.length)return ke.EMPTY_INT_ARRAY;const t=new Int32Array(e.length);let n=0;for(const r of e)t[n++]=r;return t}static getCodeword(e){const t=M.binarySearch(ke.SYMBOL_TABLE,e&262143);return t<0?-1:(ke.CODEWORD_TABLE[t]-1)%ke.NUMBER_OF_CODEWORDS}}ke.NUMBER_OF_CODEWORDS=929,ke.MAX_CODEWORDS_IN_BARCODE=ke.NUMBER_OF_CODEWORDS-1,ke.MIN_ROWS_IN_BARCODE=3,ke.MAX_ROWS_IN_BARCODE=90,ke.MODULES_IN_CODEWORD=17,ke.MODULES_IN_STOP_PATTERN=18,ke.BARS_IN_MODULE=8,ke.EMPTY_INT_ARRAY=new Int32Array([]),ke.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]),ke.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 hg{constructor(e,t){this.bits=e,this.points=t}getBits(){return this.bits}getPoints(){return this.points}}class Pe{static detectMultiple(e,t,n){let r=e.getBlackMatrix(),s=Pe.detect(n,r);return s.length||(r=r.clone(),r.rotate180(),s=Pe.detect(n,r)),new hg(r,s)}static detect(e,t){const n=new Array;let r=0,s=0,c=!1;for(;r<t.getHeight();){const d=Pe.findVertices(t,r,s);if(d[0]==null&&d[3]==null){if(!c)break;c=!1,s=0;for(const g of n)g[1]!=null&&(r=Math.trunc(Math.max(r,g[1].getY()))),g[3]!=null&&(r=Math.max(r,Math.trunc(g[3].getY())));r+=Pe.ROW_STEP;continue}if(c=!0,n.push(d),!e)break;d[2]!=null?(s=Math.trunc(d[2].getX()),r=Math.trunc(d[2].getY())):(s=Math.trunc(d[4].getX()),r=Math.trunc(d[4].getY()))}return n}static findVertices(e,t,n){const r=e.getHeight(),s=e.getWidth(),c=new Array(8);return Pe.copyToResult(c,Pe.findRowsWithPattern(e,r,s,t,n,Pe.START_PATTERN),Pe.INDEXES_START_PATTERN),c[4]!=null&&(n=Math.trunc(c[4].getX()),t=Math.trunc(c[4].getY())),Pe.copyToResult(c,Pe.findRowsWithPattern(e,r,s,t,n,Pe.STOP_PATTERN),Pe.INDEXES_STOP_PATTERN),c}static copyToResult(e,t,n){for(let r=0;r<n.length;r++)e[n[r]]=t[r]}static findRowsWithPattern(e,t,n,r,s,c){const d=new Array(4);let g=!1;const x=new Int32Array(c.length);for(;r<t;r+=Pe.ROW_STEP){let A=Pe.findGuardPattern(e,s,r,n,!1,c,x);if(A!=null){for(;r>0;){const I=Pe.findGuardPattern(e,s,--r,n,!1,c,x);if(I!=null)A=I;else{r++;break}}d[0]=new ye(A[0],r),d[1]=new ye(A[1],r),g=!0;break}}let E=r+1;if(g){let A=0,I=Int32Array.from([Math.trunc(d[0].getX()),Math.trunc(d[1].getX())]);for(;E<t;E++){const O=Pe.findGuardPattern(e,I[0],E,n,!1,c,x);if(O!=null&&Math.abs(I[0]-O[0])<Pe.MAX_PATTERN_DRIFT&&Math.abs(I[1]-O[1])<Pe.MAX_PATTERN_DRIFT)I=O,A=0;else{if(A>Pe.SKIPPED_ROW_COUNT_MAX)break;A++}}E-=A+1,d[2]=new ye(I[0],E),d[3]=new ye(I[1],E)}return E-r<Pe.BARCODE_MIN_HEIGHT&&M.fill(d,null),d}static findGuardPattern(e,t,n,r,s,c,d){M.fillWithin(d,0,d.length,0);let g=t,x=0;for(;e.get(g,n)&&g>0&&x++<Pe.MAX_PIXEL_DRIFT;)g--;let E=g,A=0,I=c.length;for(let O=s;E<r;E++)if(e.get(E,n)!==O)d[A]++;else{if(A===I-1){if(Pe.patternMatchVariance(d,c,Pe.MAX_INDIVIDUAL_VARIANCE)<Pe.MAX_AVG_VARIANCE)return new Int32Array([g,E]);g+=d[0]+d[1],P.arraycopy(d,2,d,0,A-1),d[A-1]=0,d[A]=0,A--}else A++;d[A]=1,O=!O}return A===I-1&&Pe.patternMatchVariance(d,c,Pe.MAX_INDIVIDUAL_VARIANCE)<Pe.MAX_AVG_VARIANCE?new Int32Array([g,E-1]):null}static patternMatchVariance(e,t,n){let r=e.length,s=0,c=0;for(let x=0;x<r;x++)s+=e[x],c+=t[x];if(s<c)return 1/0;let d=s/c;n*=d;let g=0;for(let x=0;x<r;x++){let E=e[x],A=t[x]*d,I=E>A?E-A:A-E;if(I>n)return 1/0;g+=I}return g/s}}Pe.INDEXES_START_PATTERN=Int32Array.from([0,4,1,5]),Pe.INDEXES_STOP_PATTERN=Int32Array.from([6,2,7,3]),Pe.MAX_AVG_VARIANCE=.42,Pe.MAX_INDIVIDUAL_VARIANCE=.8,Pe.START_PATTERN=Int32Array.from([8,1,1,1,1,1,1,3]),Pe.STOP_PATTERN=Int32Array.from([7,1,1,3,1,1,1,2,1]),Pe.MAX_PIXEL_DRIFT=3,Pe.MAX_PATTERN_DRIFT=5,Pe.SKIPPED_ROW_COUNT_MAX=25,Pe.ROW_STEP=5,Pe.BARCODE_MIN_HEIGHT=10;class Ft{constructor(e,t){if(t.length===0)throw new y;this.field=e;let n=t.length;if(n>1&&t[0]===0){let r=1;for(;r<n&&t[r]===0;)r++;r===n?this.coefficients=new Int32Array([0]):(this.coefficients=new Int32Array(n-r),P.arraycopy(t,r,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 r=0;for(let s of this.coefficients)r=this.field.add(r,s);return r}let t=this.coefficients[0],n=this.coefficients.length;for(let r=1;r<n;r++)t=this.field.add(this.field.multiply(e,t),this.coefficients[r]);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 c=t;t=n,n=c}let r=new Int32Array(n.length),s=n.length-t.length;P.arraycopy(n,0,r,0,s);for(let c=s;c<n.length;c++)r[c]=this.field.add(t[c-s],n[c]);return new Ft(this.field,r)}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 Ft?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 Ft(this.field,new Int32Array([0]));let t=this.coefficients,n=t.length,r=e.coefficients,s=r.length,c=new Int32Array(n+s-1);for(let d=0;d<n;d++){let g=t[d];for(let x=0;x<s;x++)c[d+x]=this.field.add(c[d+x],this.field.multiply(g,r[x]))}return new Ft(this.field,c)}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 Ft(this.field,t)}multiplyScalar(e){if(e===0)return new Ft(this.field,new Int32Array([0]));if(e===1)return this;let t=this.coefficients.length,n=new Int32Array(t);for(let r=0;r<t;r++)n[r]=this.field.multiply(this.coefficients[r],e);return new Ft(this.field,n)}multiplyByMonomial(e,t){if(e<0)throw new y;if(t===0)return new Ft(this.field,new Int32Array([0]));let n=this.coefficients.length,r=new Int32Array(n+e);for(let s=0;s<n;s++)r[s]=this.field.multiply(this.coefficients[s],t);return new Ft(this.field,r)}toString(){let e=new Z;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 gg{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 qe;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 Bo extends gg{constructor(e,t){super(),this.modulus=e,this.expTable=new Int32Array(e),this.logTable=new Int32Array(e);let n=1;for(let r=0;r<e;r++)this.expTable[r]=n,n=n*t%e;for(let r=0;r<e-1;r++)this.logTable[this.expTable[r]]=r;this.zero=new Ft(this,new Int32Array([0])),this.one=new Ft(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 Ft(this,n)}}Bo.PDF417_GF=new Bo(ke.NUMBER_OF_CODEWORDS,3);class Fa{constructor(){this.field=Bo.PDF417_GF}decode(e,t,n){let r=new Ft(this.field,e),s=new Int32Array(t),c=!1;for(let L=t;L>0;L--){let F=r.evaluateAt(this.field.exp(L));s[t-L]=F,F!==0&&(c=!0)}if(!c)return 0;let d=this.field.getOne();if(n!=null)for(const L of n){let F=this.field.exp(e.length-1-L),q=new Ft(this.field,new Int32Array([this.field.subtract(0,F),1]));d=d.multiply(q)}let g=new Ft(this.field,s),x=this.runEuclideanAlgorithm(this.field.buildMonomial(t,1),g,t),E=x[0],A=x[1],I=this.findErrorLocations(E),O=this.findErrorMagnitudes(A,E,I);for(let L=0;L<I.length;L++){let F=e.length-1-this.field.log(I[L]);if(F<0)throw B.getChecksumInstance();e[F]=this.field.subtract(e[F],O[L])}return I.length}runEuclideanAlgorithm(e,t,n){if(e.getDegree()<t.getDegree()){let I=e;e=t,t=I}let r=e,s=t,c=this.field.getZero(),d=this.field.getOne();for(;s.getDegree()>=Math.round(n/2);){let I=r,O=c;if(r=s,c=d,r.isZero())throw B.getChecksumInstance();s=I;let L=this.field.getZero(),F=r.getCoefficient(r.getDegree()),q=this.field.inverse(F);for(;s.getDegree()>=r.getDegree()&&!s.isZero();){let J=s.getDegree()-r.getDegree(),ce=this.field.multiply(s.getCoefficient(s.getDegree()),q);L=L.add(this.field.buildMonomial(J,ce)),s=s.subtract(r.multiplyByMonomial(J,ce))}d=L.multiply(c).subtract(O).negative()}let g=d.getCoefficient(0);if(g===0)throw B.getChecksumInstance();let x=this.field.inverse(g),E=d.multiply(x),A=s.multiply(x);return[E,A]}findErrorLocations(e){let t=e.getDegree(),n=new Int32Array(t),r=0;for(let s=1;s<this.field.getSize()&&r<t;s++)e.evaluateAt(s)===0&&(n[r]=this.field.inverse(s),r++);if(r!==t)throw B.getChecksumInstance();return n}findErrorMagnitudes(e,t,n){let r=t.getDegree(),s=new Int32Array(r);for(let x=1;x<=r;x++)s[r-x]=this.field.multiply(x,t.getCoefficient(x));let c=new Ft(this.field,s),d=n.length,g=new Int32Array(d);for(let x=0;x<d;x++){let E=this.field.inverse(n[x]),A=this.field.subtract(0,e.evaluateAt(E)),I=this.field.inverse(c.evaluateAt(E));g[x]=this.field.multiply(A,I)}return g}}class or{constructor(e,t,n,r,s){e instanceof or?this.constructor_2(e):this.constructor_1(e,t,n,r,s)}constructor_1(e,t,n,r,s){const c=t==null||n==null,d=r==null||s==null;if(c&&d)throw new S;c?(t=new ye(0,r.getY()),n=new ye(0,s.getY())):d&&(r=new ye(e.getWidth()-1,t.getY()),s=new ye(e.getWidth()-1,n.getY())),this.image=e,this.topLeft=t,this.bottomLeft=n,this.topRight=r,this.bottomRight=s,this.minX=Math.trunc(Math.min(t.getX(),n.getX())),this.maxX=Math.trunc(Math.max(r.getX(),s.getX())),this.minY=Math.trunc(Math.min(t.getY(),r.getY())),this.maxY=Math.trunc(Math.max(n.getY(),s.getY()))}constructor_2(e){this.image=e.image,this.topLeft=e.getTopLeft(),this.bottomLeft=e.getBottomLeft(),this.topRight=e.getTopRight(),this.bottomRight=e.getBottomRight(),this.minX=e.getMinX(),this.maxX=e.getMaxX(),this.minY=e.getMinY(),this.maxY=e.getMaxY()}static merge(e,t){return e==null?t:t==null?e:new or(e.image,e.topLeft,e.bottomLeft,t.topRight,t.bottomRight)}addMissingRows(e,t,n){let r=this.topLeft,s=this.bottomLeft,c=this.topRight,d=this.bottomRight;if(e>0){let g=n?this.topLeft:this.topRight,x=Math.trunc(g.getY()-e);x<0&&(x=0);let E=new ye(g.getX(),x);n?r=E:c=E}if(t>0){let g=n?this.bottomLeft:this.bottomRight,x=Math.trunc(g.getY()+t);x>=this.image.getHeight()&&(x=this.image.getHeight()-1);let E=new ye(g.getX(),x);n?s=E:d=E}return new or(this.image,r,s,c,d)}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 mg{constructor(e,t,n,r){this.columnCount=e,this.errorCorrectionLevel=r,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 Gr{constructor(){this.buffer=""}static form(e,t){let n=-1;function r(c,d,g,x,E,A){if(c==="%%")return"%";if(t[++n]===void 0)return;c=x?parseInt(x.substr(1)):void 0;let I=E?parseInt(E.substr(1)):void 0,O;switch(A){case"s":O=t[n];break;case"c":O=t[n][0];break;case"f":O=parseFloat(t[n]).toFixed(c);break;case"p":O=parseFloat(t[n]).toPrecision(c);break;case"e":O=parseFloat(t[n]).toExponential(c);break;case"x":O=parseInt(t[n]).toString(I||16);break;case"d":O=parseFloat(parseInt(t[n],I||10).toPrecision(c)).toFixed(0);break}O=typeof O=="object"?JSON.stringify(O):(+O).toString(I);let L=parseInt(g),F=g&&g[0]+""=="0"?"0":" ";for(;O.length<L;)O=d!==void 0?O+F:F+O;return O}let s=/%(-)?(0?[0-9]+)?([.][0-9]+)?([#][0-9]+)?([scfpexd%])/g;return e.replace(s,r)}format(e,...t){this.buffer+=Gr.form(e,t)}toString(){return this.buffer}}class Wr{constructor(e){this.boundingBox=new or(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<Wr.MAX_NEARBY_DISTANCE;n++){let r=this.imageRowToCodewordIndex(e)-n;if(r>=0&&(t=this.codewords[r],t!=null)||(r=this.imageRowToCodewordIndex(e)+n,r<this.codewords.length&&(t=this.codewords[r],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 Gr;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()}}Wr.MAX_NEARBY_DISTANCE=5;class Xr{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,r]of this.values.entries()){const s={getKey:()=>n,getValue:()=>r};s.getValue()>e?(e=s.getValue(),t=[],t.push(s.getKey())):s.getValue()===e&&t.push(s.getKey())}return ke.toIntArray(t)}getConfidence(e){return this.values.get(e)}}class Va extends Wr{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(),r=this._isLeft?n.getTopLeft():n.getTopRight(),s=this._isLeft?n.getBottomLeft():n.getBottomRight(),c=this.imageRowToCodewordIndex(Math.trunc(r.getY())),d=this.imageRowToCodewordIndex(Math.trunc(s.getY())),g=-1,x=1,E=0;for(let A=c;A<d;A++){if(t[A]==null)continue;let I=t[A],O=I.getRowNumber()-g;if(O===0)E++;else if(O===1)x=Math.max(x,E),E=1,g=I.getRowNumber();else if(O<0||I.getRowNumber()>=e.getRowCount()||O>A)t[A]=null;else{let L;x>2?L=(x-2)*O:L=O;let F=L>=A;for(let q=1;q<=L&&!F;q++)F=t[A-q]!=null;F?t[A]=null:(g=I.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 r=n.getRowNumber();if(r>=t.length)continue;t[r]++}return t}adjustIncompleteIndicatorColumnRowNumbers(e){let t=this.getBoundingBox(),n=this._isLeft?t.getTopLeft():t.getTopRight(),r=this._isLeft?t.getBottomLeft():t.getBottomRight(),s=this.imageRowToCodewordIndex(Math.trunc(n.getY())),c=this.imageRowToCodewordIndex(Math.trunc(r.getY())),d=this.getCodewords(),g=-1;for(let x=s;x<c;x++){if(d[x]==null)continue;let E=d[x];E.setRowNumberAsRowIndicatorColumn();let A=E.getRowNumber()-g;A===0||(A===1?g=E.getRowNumber():E.getRowNumber()>=e.getRowCount()?d[x]=null:g=E.getRowNumber())}}getBarcodeMetadata(){let e=this.getCodewords(),t=new Xr,n=new Xr,r=new Xr,s=new Xr;for(let d of e){if(d==null)continue;d.setRowNumberAsRowIndicatorColumn();let g=d.getValue()%30,x=d.getRowNumber();switch(this._isLeft||(x+=2),x%3){case 0:n.setValue(g*3+1);break;case 1:s.setValue(g/3),r.setValue(g%3);break;case 2:t.setValue(g+1);break}}if(t.getValue().length===0||n.getValue().length===0||r.getValue().length===0||s.getValue().length===0||t.getValue()[0]<1||n.getValue()[0]+r.getValue()[0]<ke.MIN_ROWS_IN_BARCODE||n.getValue()[0]+r.getValue()[0]>ke.MAX_ROWS_IN_BARCODE)return null;let c=new mg(t.getValue()[0],n.getValue()[0],r.getValue()[0],s.getValue()[0]);return this.removeIncorrectCodewords(e,c),c}removeIncorrectCodewords(e,t){for(let n=0;n<e.length;n++){let r=e[n];if(e[n]==null)continue;let s=r.getValue()%30,c=r.getRowNumber();if(c>t.getRowCount()){e[n]=null;continue}switch(this._isLeft||(c+=2),c%3){case 0:s*3+1!==t.getRowCountUpperPart()&&(e[n]=null);break;case 1:(Math.trunc(s/3)!==t.getErrorCorrectionLevel()||s%3!==t.getRowCountLowerPart())&&(e[n]=null);break;case 2:s+1!==t.getColumnCount()&&(e[n]=null);break}}}isLeft(){return this._isLeft}toString(){return"IsLeft: "+this._isLeft+`
|
|
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=ke.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 r=0;r<n.length;r++)n[r]!=null&&(n[r].hasValidRowNumber()||this.adjustRowNumbers(t,r,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 r=1;r<=this.barcodeColumnCount;r++){let s=this.detectionResultColumns[r].getCodewords()[n];s!=null&&(s.setRowNumber(e[n].getRowNumber()),s.hasValidRowNumber()||(this.detectionResultColumns[r].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 r=t[n].getRowNumber(),s=0;for(let c=this.barcodeColumnCount+1;c>0&&s<this.ADJUST_ROW_NUMBER_SKIP;c--){let d=this.detectionResultColumns[c].getCodewords()[n];d!=null&&(s=jr.adjustRowNumberIfValid(r,s,d),d.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 r=t[n].getRowNumber(),s=0;for(let c=1;c<this.barcodeColumnCount+1&&s<this.ADJUST_ROW_NUMBER_SKIP;c++){let d=this.detectionResultColumns[c].getCodewords()[n];d!=null&&(s=jr.adjustRowNumberIfValid(r,s,d),d.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 r=n[t],s=this.detectionResultColumns[e-1].getCodewords(),c=s;this.detectionResultColumns[e+1]!=null&&(c=this.detectionResultColumns[e+1].getCodewords());let d=new Array(14);d[2]=s[t],d[3]=c[t],t>0&&(d[0]=n[t-1],d[4]=s[t-1],d[5]=c[t-1]),t>1&&(d[8]=n[t-2],d[10]=s[t-2],d[11]=c[t-2]),t<n.length-1&&(d[1]=n[t+1],d[6]=s[t+1],d[7]=c[t+1]),t<n.length-2&&(d[9]=n[t+2],d[12]=s[t+2],d[13]=c[t+2]);for(let g of d)if(jr.adjustRowNumber(r,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 Gr;for(let n=0;n<e.getCodewords().length;n++){t.format("CW %3d:",n);for(let r=0;r<this.barcodeColumnCount+2;r++){if(this.detectionResultColumns[r]==null){t.format(" | ");continue}let s=this.detectionResultColumns[r].getCodewords()[n];if(s==null){t.format(" | ");continue}t.format(" %3d|%3d",s.getRowNumber(),s.getValue())}t.format("%n")}return t.toString()}}class Zr{constructor(e,t,n,r){this.rowNumber=Zr.BARCODE_ROW_UNKNOWN,this.startX=Math.trunc(e),this.endX=Math.trunc(t),this.bucket=Math.trunc(n),this.value=Math.trunc(r)}hasValidRowNumber(){return this.isValidRowNumber(this.rowNumber)}isValidRowNumber(e){return e!==Zr.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}}Zr.BARCODE_ROW_UNKNOWN=-1;class tn{static initialize(){for(let e=0;e<ke.SYMBOL_TABLE.length;e++){let t=ke.SYMBOL_TABLE[e],n=t&1;for(let r=0;r<ke.BARS_IN_MODULE;r++){let s=0;for(;(t&1)===n;)s+=1,t>>=1;n=t&1,tn.RATIOS_TABLE[e]||(tn.RATIOS_TABLE[e]=new Array(ke.BARS_IN_MODULE)),tn.RATIOS_TABLE[e][ke.BARS_IN_MODULE-r-1]=Math.fround(s/ke.MODULES_IN_CODEWORD)}}this.bSymbolTableReady=!0}static getDecodedValue(e){let t=tn.getDecodedCodewordValue(tn.sampleBitCounts(e));return t!==-1?t:tn.getClosestDecodedValue(e)}static sampleBitCounts(e){let t=ze.sum(e),n=new Int32Array(ke.BARS_IN_MODULE),r=0,s=0;for(let c=0;c<ke.MODULES_IN_CODEWORD;c++){let d=t/(2*ke.MODULES_IN_CODEWORD)+c*t/ke.MODULES_IN_CODEWORD;s+e[r]<=d&&(s+=e[r],r++),n[r]++}return n}static getDecodedCodewordValue(e){let t=tn.getBitValue(e);return ke.getCodeword(t)===-1?-1:t}static getBitValue(e){let t=0;for(let n=0;n<e.length;n++)for(let r=0;r<e[n];r++)t=t<<1|(n%2===0?1:0);return Math.trunc(t)}static getClosestDecodedValue(e){let t=ze.sum(e),n=new Array(ke.BARS_IN_MODULE);if(t>1)for(let c=0;c<n.length;c++)n[c]=Math.fround(e[c]/t);let r=_r.MAX_VALUE,s=-1;this.bSymbolTableReady||tn.initialize();for(let c=0;c<tn.RATIOS_TABLE.length;c++){let d=0,g=tn.RATIOS_TABLE[c];for(let x=0;x<ke.BARS_IN_MODULE;x++){let E=Math.fround(g[x]-n[x]);if(d+=Math.fround(E*E),d>=r)break}d<r&&(r=d,s=ke.SYMBOL_TABLE[c])}return s}}tn.bSymbolTableReady=!1,tn.RATIOS_TABLE=new Array(ke.SYMBOL_TABLE.length).map(b=>new Array(ke.BARS_IN_MODULE));class Ua{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 Ha{static parseLong(e,t=void 0){return parseInt(e,t)}}class za extends p{}za.kind="NullPointerException";class pg{writeBytes(e){this.writeBytesOffset(e,0,e.length)}writeBytesOffset(e,t,n){if(e==null)throw new za;if(t<0||t>e.length||n<0||t+n>e.length||t+n<0)throw new D;if(n===0)return;for(let r=0;r<n;r++)this.write(e[t+r])}flush(){}close(){}}class xg extends p{}class wg extends pg{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 xg;n=k.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),P.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 it;(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"})(it||(it={}));function Ga(){if(typeof window<"u")return window.BigInt||null;if(typeof mr<"u")return mr.BigInt||null;if(typeof self<"u")return self.BigInt||null;throw new Error("Can't search globals for BigInt!")}let Ni;function Zn(b){if(typeof Ni>"u"&&(Ni=Ga()),Ni===null)throw new Error("BigInt is not supported!");return Ni(b)}function _g(){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 Q{static decode(e,t){let n=new Z(""),r=z.ISO8859_1;n.enableDecoding(r);let s=1,c=e[s++],d=new Ua;for(;s<e[0];){switch(c){case Q.TEXT_COMPACTION_MODE_LATCH:s=Q.textCompaction(e,s,n);break;case Q.BYTE_COMPACTION_MODE_LATCH:case Q.BYTE_COMPACTION_MODE_LATCH_6:s=Q.byteCompaction(c,e,r,s,n);break;case Q.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:n.append(e[s++]);break;case Q.NUMERIC_COMPACTION_MODE_LATCH:s=Q.numericCompaction(e,s,n);break;case Q.ECI_CHARSET:z.getCharacterSetECIByValue(e[s++]);break;case Q.ECI_GENERAL_PURPOSE:s+=2;break;case Q.ECI_USER_DEFINED:s++;break;case Q.BEGIN_MACRO_PDF417_CONTROL_BLOCK:s=Q.decodeMacroBlock(e,s,d);break;case Q.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case Q.MACRO_PDF417_TERMINATOR:throw new U;default:s--,s=Q.textCompaction(e,s,n);break}if(s<e.length)c=e[s++];else throw U.getFormatInstance()}if(n.length()===0)throw U.getFormatInstance();let g=new Oe(null,n.toString(),null,t);return g.setOther(d),g}static decodeMacroBlock(e,t,n){if(t+Q.NUMBER_OF_SEQUENCE_CODEWORDS>e[0])throw U.getFormatInstance();let r=new Int32Array(Q.NUMBER_OF_SEQUENCE_CODEWORDS);for(let d=0;d<Q.NUMBER_OF_SEQUENCE_CODEWORDS;d++,t++)r[d]=e[t];n.setSegmentIndex(k.parseInt(Q.decodeBase900toBase10(r,Q.NUMBER_OF_SEQUENCE_CODEWORDS)));let s=new Z;t=Q.textCompaction(e,t,s),n.setFileId(s.toString());let c=-1;for(e[t]===Q.BEGIN_MACRO_PDF417_OPTIONAL_FIELD&&(c=t+1);t<e[0];)switch(e[t]){case Q.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:switch(t++,e[t]){case Q.MACRO_PDF417_OPTIONAL_FIELD_FILE_NAME:let d=new Z;t=Q.textCompaction(e,t+1,d),n.setFileName(d.toString());break;case Q.MACRO_PDF417_OPTIONAL_FIELD_SENDER:let g=new Z;t=Q.textCompaction(e,t+1,g),n.setSender(g.toString());break;case Q.MACRO_PDF417_OPTIONAL_FIELD_ADDRESSEE:let x=new Z;t=Q.textCompaction(e,t+1,x),n.setAddressee(x.toString());break;case Q.MACRO_PDF417_OPTIONAL_FIELD_SEGMENT_COUNT:let E=new Z;t=Q.numericCompaction(e,t+1,E),n.setSegmentCount(k.parseInt(E.toString()));break;case Q.MACRO_PDF417_OPTIONAL_FIELD_TIME_STAMP:let A=new Z;t=Q.numericCompaction(e,t+1,A),n.setTimestamp(Ha.parseLong(A.toString()));break;case Q.MACRO_PDF417_OPTIONAL_FIELD_CHECKSUM:let I=new Z;t=Q.numericCompaction(e,t+1,I),n.setChecksum(k.parseInt(I.toString()));break;case Q.MACRO_PDF417_OPTIONAL_FIELD_FILE_SIZE:let O=new Z;t=Q.numericCompaction(e,t+1,O),n.setFileSize(Ha.parseLong(O.toString()));break;default:throw U.getFormatInstance()}break;case Q.MACRO_PDF417_TERMINATOR:t++,n.setLastSegment(!0);break;default:throw U.getFormatInstance()}if(c!==-1){let d=t-c;n.isLastSegment()&&d--,n.setOptionalData(M.copyOfRange(e,c,c+d))}return t}static textCompaction(e,t,n){let r=new Int32Array((e[0]-t)*2),s=new Int32Array((e[0]-t)*2),c=0,d=!1;for(;t<e[0]&&!d;){let g=e[t++];if(g<Q.TEXT_COMPACTION_MODE_LATCH)r[c]=g/30,r[c+1]=g%30,c+=2;else switch(g){case Q.TEXT_COMPACTION_MODE_LATCH:r[c++]=Q.TEXT_COMPACTION_MODE_LATCH;break;case Q.BYTE_COMPACTION_MODE_LATCH:case Q.BYTE_COMPACTION_MODE_LATCH_6:case Q.NUMERIC_COMPACTION_MODE_LATCH:case Q.BEGIN_MACRO_PDF417_CONTROL_BLOCK:case Q.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case Q.MACRO_PDF417_TERMINATOR:t--,d=!0;break;case Q.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:r[c]=Q.MODE_SHIFT_TO_BYTE_COMPACTION_MODE,g=e[t++],s[c]=g,c++;break}}return Q.decodeTextCompaction(r,s,c,n),t}static decodeTextCompaction(e,t,n,r){let s=it.ALPHA,c=it.ALPHA,d=0;for(;d<n;){let g=e[d],x="";switch(s){case it.ALPHA:if(g<26)x=String.fromCharCode(65+g);else switch(g){case 26:x=" ";break;case Q.LL:s=it.LOWER;break;case Q.ML:s=it.MIXED;break;case Q.PS:c=s,s=it.PUNCT_SHIFT;break;case Q.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:r.append(t[d]);break;case Q.TEXT_COMPACTION_MODE_LATCH:s=it.ALPHA;break}break;case it.LOWER:if(g<26)x=String.fromCharCode(97+g);else switch(g){case 26:x=" ";break;case Q.AS:c=s,s=it.ALPHA_SHIFT;break;case Q.ML:s=it.MIXED;break;case Q.PS:c=s,s=it.PUNCT_SHIFT;break;case Q.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:r.append(t[d]);break;case Q.TEXT_COMPACTION_MODE_LATCH:s=it.ALPHA;break}break;case it.MIXED:if(g<Q.PL)x=Q.MIXED_CHARS[g];else switch(g){case Q.PL:s=it.PUNCT;break;case 26:x=" ";break;case Q.LL:s=it.LOWER;break;case Q.AL:s=it.ALPHA;break;case Q.PS:c=s,s=it.PUNCT_SHIFT;break;case Q.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:r.append(t[d]);break;case Q.TEXT_COMPACTION_MODE_LATCH:s=it.ALPHA;break}break;case it.PUNCT:if(g<Q.PAL)x=Q.PUNCT_CHARS[g];else switch(g){case Q.PAL:s=it.ALPHA;break;case Q.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:r.append(t[d]);break;case Q.TEXT_COMPACTION_MODE_LATCH:s=it.ALPHA;break}break;case it.ALPHA_SHIFT:if(s=c,g<26)x=String.fromCharCode(65+g);else switch(g){case 26:x=" ";break;case Q.TEXT_COMPACTION_MODE_LATCH:s=it.ALPHA;break}break;case it.PUNCT_SHIFT:if(s=c,g<Q.PAL)x=Q.PUNCT_CHARS[g];else switch(g){case Q.PAL:s=it.ALPHA;break;case Q.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:r.append(t[d]);break;case Q.TEXT_COMPACTION_MODE_LATCH:s=it.ALPHA;break}break}x!==""&&r.append(x),d++}}static byteCompaction(e,t,n,r,s){let c=new wg,d=0,g=0,x=!1;switch(e){case Q.BYTE_COMPACTION_MODE_LATCH:let E=new Int32Array(6),A=t[r++];for(;r<t[0]&&!x;)switch(E[d++]=A,g=900*g+A,A=t[r++],A){case Q.TEXT_COMPACTION_MODE_LATCH:case Q.BYTE_COMPACTION_MODE_LATCH:case Q.NUMERIC_COMPACTION_MODE_LATCH:case Q.BYTE_COMPACTION_MODE_LATCH_6:case Q.BEGIN_MACRO_PDF417_CONTROL_BLOCK:case Q.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case Q.MACRO_PDF417_TERMINATOR:r--,x=!0;break;default:if(d%5===0&&d>0){for(let I=0;I<6;++I)c.write(Number(Zn(g)>>Zn(8*(5-I))));g=0,d=0}break}r===t[0]&&A<Q.TEXT_COMPACTION_MODE_LATCH&&(E[d++]=A);for(let I=0;I<d;I++)c.write(E[I]);break;case Q.BYTE_COMPACTION_MODE_LATCH_6:for(;r<t[0]&&!x;){let I=t[r++];if(I<Q.TEXT_COMPACTION_MODE_LATCH)d++,g=900*g+I;else switch(I){case Q.TEXT_COMPACTION_MODE_LATCH:case Q.BYTE_COMPACTION_MODE_LATCH:case Q.NUMERIC_COMPACTION_MODE_LATCH:case Q.BYTE_COMPACTION_MODE_LATCH_6:case Q.BEGIN_MACRO_PDF417_CONTROL_BLOCK:case Q.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case Q.MACRO_PDF417_TERMINATOR:r--,x=!0;break}if(d%5===0&&d>0){for(let O=0;O<6;++O)c.write(Number(Zn(g)>>Zn(8*(5-O))));g=0,d=0}}break}return s.append(G.decode(c.toByteArray(),n)),r}static numericCompaction(e,t,n){let r=0,s=!1,c=new Int32Array(Q.MAX_NUMERIC_CODEWORDS);for(;t<e[0]&&!s;){let d=e[t++];if(t===e[0]&&(s=!0),d<Q.TEXT_COMPACTION_MODE_LATCH)c[r]=d,r++;else switch(d){case Q.TEXT_COMPACTION_MODE_LATCH:case Q.BYTE_COMPACTION_MODE_LATCH:case Q.BYTE_COMPACTION_MODE_LATCH_6:case Q.BEGIN_MACRO_PDF417_CONTROL_BLOCK:case Q.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case Q.MACRO_PDF417_TERMINATOR:t--,s=!0;break}(r%Q.MAX_NUMERIC_CODEWORDS===0||d===Q.NUMERIC_COMPACTION_MODE_LATCH||s)&&r>0&&(n.append(Q.decodeBase900toBase10(c,r)),r=0)}return t}static decodeBase900toBase10(e,t){let n=Zn(0);for(let s=0;s<t;s++)n+=Q.EXP900[t-s-1]*Zn(e[s]);let r=n.toString();if(r.charAt(0)!=="1")throw new U;return r.substring(1)}}Q.TEXT_COMPACTION_MODE_LATCH=900,Q.BYTE_COMPACTION_MODE_LATCH=901,Q.NUMERIC_COMPACTION_MODE_LATCH=902,Q.BYTE_COMPACTION_MODE_LATCH_6=924,Q.ECI_USER_DEFINED=925,Q.ECI_GENERAL_PURPOSE=926,Q.ECI_CHARSET=927,Q.BEGIN_MACRO_PDF417_CONTROL_BLOCK=928,Q.BEGIN_MACRO_PDF417_OPTIONAL_FIELD=923,Q.MACRO_PDF417_TERMINATOR=922,Q.MODE_SHIFT_TO_BYTE_COMPACTION_MODE=913,Q.MAX_NUMERIC_CODEWORDS=15,Q.MACRO_PDF417_OPTIONAL_FIELD_FILE_NAME=0,Q.MACRO_PDF417_OPTIONAL_FIELD_SEGMENT_COUNT=1,Q.MACRO_PDF417_OPTIONAL_FIELD_TIME_STAMP=2,Q.MACRO_PDF417_OPTIONAL_FIELD_SENDER=3,Q.MACRO_PDF417_OPTIONAL_FIELD_ADDRESSEE=4,Q.MACRO_PDF417_OPTIONAL_FIELD_FILE_SIZE=5,Q.MACRO_PDF417_OPTIONAL_FIELD_CHECKSUM=6,Q.PL=25,Q.LL=27,Q.AS=27,Q.ML=28,Q.AL=28,Q.PS=29,Q.PAL=29,Q.PUNCT_CHARS=`;<>@[\\]_\`~!\r ,:
|
|
18
|
-
-.$/"|*()?{}'`,Q.MIXED_CHARS="0123456789&\r ,:#-.$/+%*=^",Q.EXP900=Ga()?_g():[],Q.NUMBER_OF_SEQUENCE_CODEWORDS=2;class Fe{constructor(){}static decode(e,t,n,r,s,c,d){let g=new or(e,t,n,r,s),x=null,E=null,A;for(let L=!0;;L=!1){if(t!=null&&(x=Fe.getRowIndicatorColumn(e,g,t,!0,c,d)),r!=null&&(E=Fe.getRowIndicatorColumn(e,g,r,!1,c,d)),A=Fe.merge(x,E),A==null)throw S.getNotFoundInstance();let F=A.getBoundingBox();if(L&&F!=null&&(F.getMinY()<g.getMinY()||F.getMaxY()>g.getMaxY()))g=F;else break}A.setBoundingBox(g);let I=A.getBarcodeColumnCount()+1;A.setDetectionResultColumn(0,x),A.setDetectionResultColumn(I,E);let O=x!=null;for(let L=1;L<=I;L++){let F=O?L:I-L;if(A.getDetectionResultColumn(F)!==void 0)continue;let q;F===0||F===I?q=new Va(g,F===0):q=new Wr(g),A.setDetectionResultColumn(F,q);let J=-1,ce=J;for(let ue=g.getMinY();ue<=g.getMaxY();ue++){if(J=Fe.getStartColumn(A,F,ue,O),J<0||J>g.getMaxX()){if(ce===-1)continue;J=ce}let ae=Fe.detectCodeword(e,g.getMinX(),g.getMaxX(),O,J,ue,c,d);ae!=null&&(q.setCodeword(ue,ae),ce=J,c=Math.min(c,ae.getWidth()),d=Math.max(d,ae.getWidth()))}}return Fe.createDecoderResult(A)}static merge(e,t){if(e==null&&t==null)return null;let n=Fe.getBarcodeMetadata(e,t);if(n==null)return null;let r=or.merge(Fe.adjustBoundingBox(e),Fe.adjustBoundingBox(t));return new jr(n,r)}static adjustBoundingBox(e){if(e==null)return null;let t=e.getRowHeights();if(t==null)return null;let n=Fe.getMax(t),r=0;for(let d of t)if(r+=n-d,d>0)break;let s=e.getCodewords();for(let d=0;r>0&&s[d]==null;d++)r--;let c=0;for(let d=t.length-1;d>=0&&(c+=n-t[d],!(t[d]>0));d--);for(let d=s.length-1;c>0&&s[d]==null;d--)c--;return e.getBoundingBox().addMissingRows(r,c,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 r;return t==null||(r=t.getBarcodeMetadata())==null?n:n.getColumnCount()!==r.getColumnCount()&&n.getErrorCorrectionLevel()!==r.getErrorCorrectionLevel()&&n.getRowCount()!==r.getRowCount()?null:n}static getRowIndicatorColumn(e,t,n,r,s,c){let d=new Va(t,r);for(let g=0;g<2;g++){let x=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+=x){let I=Fe.detectCodeword(e,0,e.getWidth(),r,E,A,s,c);I!=null&&(d.setCodeword(A,I),r?E=I.getStartX():E=I.getEndX())}}return d}static adjustCodewordCount(e,t){let n=t[0][1],r=n.getValue(),s=e.getBarcodeColumnCount()*e.getBarcodeRowCount()-Fe.getNumberOfECCodeWords(e.getBarcodeECLevel());if(r.length===0){if(s<1||s>ke.MAX_CODEWORDS_IN_BARCODE)throw S.getNotFoundInstance();n.setValue(s)}else r[0]!==s&&n.setValue(s)}static createDecoderResult(e){let t=Fe.createBarcodeMatrix(e);Fe.adjustCodewordCount(e,t);let n=new Array,r=new Int32Array(e.getBarcodeRowCount()*e.getBarcodeColumnCount()),s=[],c=new Array;for(let g=0;g<e.getBarcodeRowCount();g++)for(let x=0;x<e.getBarcodeColumnCount();x++){let E=t[g][x+1].getValue(),A=g*e.getBarcodeColumnCount()+x;E.length===0?n.push(A):E.length===1?r[A]=E[0]:(c.push(A),s.push(E))}let d=new Array(s.length);for(let g=0;g<d.length;g++)d[g]=s[g];return Fe.createDecoderResultFromAmbiguousValues(e.getBarcodeECLevel(),r,ke.toIntArray(n),ke.toIntArray(c),d)}static createDecoderResultFromAmbiguousValues(e,t,n,r,s){let c=new Int32Array(r.length),d=100;for(;d-- >0;){for(let g=0;g<c.length;g++)t[r[g]]=s[g][c[g]];try{return Fe.decodeCodewords(t,e,n)}catch(g){if(!(g instanceof B))throw g}if(c.length===0)throw B.getChecksumInstance();for(let g=0;g<c.length;g++)if(c[g]<s[g].length-1){c[g]++;break}else if(c[g]=0,g===c.length-1)throw B.getChecksumInstance()}throw B.getChecksumInstance()}static createBarcodeMatrix(e){let t=Array.from({length:e.getBarcodeRowCount()},()=>new Array(e.getBarcodeColumnCount()+2));for(let r=0;r<t.length;r++)for(let s=0;s<t[r].length;s++)t[r][s]=new Xr;let n=0;for(let r of e.getDetectionResultColumns()){if(r!=null){for(let s of r.getCodewords())if(s!=null){let c=s.getRowNumber();if(c>=0){if(c>=t.length)continue;t[c][n].setValue(s.getValue())}}}n++}return t}static isValidBarcodeColumn(e,t){return t>=0&&t<=e.getBarcodeColumnCount()+1}static getStartColumn(e,t,n,r){let s=r?1:-1,c=null;if(Fe.isValidBarcodeColumn(e,t-s)&&(c=e.getDetectionResultColumn(t-s).getCodeword(n)),c!=null)return r?c.getEndX():c.getStartX();if(c=e.getDetectionResultColumn(t).getCodewordNearby(n),c!=null)return r?c.getStartX():c.getEndX();if(Fe.isValidBarcodeColumn(e,t-s)&&(c=e.getDetectionResultColumn(t-s).getCodewordNearby(n)),c!=null)return r?c.getEndX():c.getStartX();let d=0;for(;Fe.isValidBarcodeColumn(e,t-s);){t-=s;for(let g of e.getDetectionResultColumn(t).getCodewords())if(g!=null)return(r?g.getEndX():g.getStartX())+s*d*(g.getEndX()-g.getStartX());d++}return r?e.getBoundingBox().getMinX():e.getBoundingBox().getMaxX()}static detectCodeword(e,t,n,r,s,c,d,g){s=Fe.adjustCodewordStartColumn(e,t,n,r,s,c);let x=Fe.getModuleBitCount(e,t,n,r,s,c);if(x==null)return null;let E,A=ze.sum(x);if(r)E=s+A;else{for(let L=0;L<x.length/2;L++){let F=x[L];x[L]=x[x.length-1-L],x[x.length-1-L]=F}E=s,s=E-A}if(!Fe.checkCodewordSkew(A,d,g))return null;let I=tn.getDecodedValue(x),O=ke.getCodeword(I);return O===-1?null:new Zr(s,E,Fe.getCodewordBucketNumber(I),O)}static getModuleBitCount(e,t,n,r,s,c){let d=s,g=new Int32Array(8),x=0,E=r?1:-1,A=r;for(;(r?d<n:d>=t)&&x<g.length;)e.get(d,c)===A?(g[x]++,d+=E):(x++,A=!A);return x===g.length||d===(r?n:t)&&x===g.length-1?g:null}static getNumberOfECCodeWords(e){return 2<<e}static adjustCodewordStartColumn(e,t,n,r,s,c){let d=s,g=r?-1:1;for(let x=0;x<2;x++){for(;(r?d>=t:d<n)&&r===e.get(d,c);){if(Math.abs(s-d)>Fe.CODEWORD_SKEW_SIZE)return s;d+=g}g=-g,r=!r}return d}static checkCodewordSkew(e,t,n){return t-Fe.CODEWORD_SKEW_SIZE<=e&&e<=n+Fe.CODEWORD_SKEW_SIZE}static decodeCodewords(e,t,n){if(e.length===0)throw U.getFormatInstance();let r=1<<t+1,s=Fe.correctErrors(e,n,r);Fe.verifyCodewordCount(e,r);let c=Q.decode(e,""+t);return c.setErrorsCorrected(s),c.setErasures(n.length),c}static correctErrors(e,t,n){if(t!=null&&t.length>n/2+Fe.MAX_ERRORS||n<0||n>Fe.MAX_EC_CODEWORDS)throw B.getChecksumInstance();return Fe.errorCorrection.decode(e,n,t)}static verifyCodewordCount(e,t){if(e.length<4)throw U.getFormatInstance();let n=e[0];if(n>e.length)throw U.getFormatInstance();if(n===0)if(t<e.length)e[0]=e.length-t;else throw U.getFormatInstance()}static getBitCountForCodeword(e){let t=new Int32Array(8),n=0,r=t.length-1;for(;!((e&1)!==n&&(n=e&1,r--,r<0));)t[r]++,e>>=1;return t}static getCodewordBucketNumber(e){return e instanceof Int32Array?this.getCodewordBucketNumber_Int32Array(e):this.getCodewordBucketNumber_number(e)}static getCodewordBucketNumber_number(e){return Fe.getCodewordBucketNumber(Fe.getBitCountForCodeword(e))}static getCodewordBucketNumber_Int32Array(e){return(e[0]-e[2]+e[4]-e[6]+9)%9}static toString(e){let t=new Gr;for(let n=0;n<e.length;n++){t.format("Row %2d: ",n);for(let r=0;r<e[n].length;r++){let s=e[n][r];s.getValue().length===0?t.format(" ",null):t.format("%4d(%2d)",s.getValue()[0],s.getConfidence(s.getValue()[0]))}t.format("%n")}return t.toString()}}Fe.CODEWORD_SKEW_SIZE=2,Fe.MAX_ERRORS=3,Fe.MAX_EC_CODEWORDS=512,Fe.errorCorrection=new Fa;class Vt{decode(e,t=null){let n=Vt.decode(e,t,!1);if(n==null||n.length===0||n[0]==null)throw S.getNotFoundInstance();return n[0]}decodeMultiple(e,t=null){try{return Vt.decode(e,t,!0)}catch(n){throw n instanceof U||n instanceof B?S.getNotFoundInstance():n}}static decode(e,t,n){const r=new Array,s=Pe.detectMultiple(e,t,n);for(const c of s.getPoints()){const d=Fe.decode(s.getBits(),c[4],c[5],c[6],c[7],Vt.getMinCodewordWidth(c),Vt.getMaxCodewordWidth(c)),g=new _e(d.getText(),d.getRawBytes(),void 0,c,fe.PDF_417);g.putMetadata(Xe.ERROR_CORRECTION_LEVEL,d.getECLevel());const x=d.getOther();x!=null&&g.putMetadata(Xe.PDF417_EXTRA_METADATA,x),r.push(g)}return r.map(c=>c)}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?k.MAX_VALUE:Math.trunc(Math.abs(e.getX()-t.getX()))}static getMaxCodewordWidth(e){return Math.floor(Math.max(Math.max(Vt.getMaxWidth(e[0],e[4]),Vt.getMaxWidth(e[6],e[2])*ke.MODULES_IN_CODEWORD/ke.MODULES_IN_STOP_PATTERN),Math.max(Vt.getMaxWidth(e[1],e[5]),Vt.getMaxWidth(e[7],e[3])*ke.MODULES_IN_CODEWORD/ke.MODULES_IN_STOP_PATTERN)))}static getMinCodewordWidth(e){return Math.floor(Math.min(Math.min(Vt.getMinWidth(e[0],e[4]),Vt.getMinWidth(e[6],e[2])*ke.MODULES_IN_CODEWORD/ke.MODULES_IN_STOP_PATTERN),Math.min(Vt.getMinWidth(e[1],e[5]),Vt.getMinWidth(e[7],e[3])*ke.MODULES_IN_CODEWORD/ke.MODULES_IN_STOP_PATTERN)))}reset(){}}class Ti extends p{}Ti.kind="ReaderException";class Wa{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=!u(e)&&e.get(ne.TRY_HARDER)===!0,n=u(e)?null:e.get(ne.POSSIBLE_FORMATS),r=new Array;if(!u(n)){const s=n.some(c=>c===fe.UPC_A||c===fe.UPC_E||c===fe.EAN_13||c===fe.EAN_8||c===fe.CODABAR||c===fe.CODE_39||c===fe.CODE_93||c===fe.CODE_128||c===fe.ITF||c===fe.RSS_14||c===fe.RSS_EXPANDED);s&&!t&&r.push(new br(e,this.verbose)),n.includes(fe.QR_CODE)&&r.push(new jn),n.includes(fe.DATA_MATRIX)&&r.push(new Xn),n.includes(fe.AZTEC)&&r.push(new le),n.includes(fe.PDF_417)&&r.push(new Vt),s&&t&&r.push(new br(e,this.verbose))}r.length===0&&(t||r.push(new br(e,this.verbose)),r.push(new jn),r.push(new Xn),r.push(new le),r.push(new Vt),t&&r.push(new br(e,this.verbose))),this.readers=r}reset(){if(this.readers!==null)for(const e of this.readers)e.reset()}decodeInternal(e){if(this.readers===null)throw new Ti("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 Ti)continue}throw new S("No MultiFormat Readers were able to detect the code.")}}class Cg extends Ne{constructor(e=null,t=500){const n=new Wa;n.setHints(e),super(n,t)}decodeBitmap(e){return this.reader.decodeWithState(e)}}class Eg extends Ne{constructor(e=500){super(new Vt,e)}}class yg extends Ne{constructor(e=500){super(new jn,e)}}var Mo;(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"})(Mo||(Mo={}));var kt=Mo;class vo{constructor(e){this.field=e,this.cachedGenerators=[],this.cachedGenerators.push(new me(e,Int32Array.from([1])))}buildGenerator(e){const t=this.cachedGenerators;if(e>=t.length){let n=t[t.length-1];const r=this.field;for(let s=t.length;s<=e;s++){const c=n.multiply(new me(r,Int32Array.from([1,r.exp(s-1+r.getGeneratorBase())])));t.push(c),n=c}}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 r=this.buildGenerator(t),s=new Int32Array(n);P.arraycopy(e,0,s,0,n);let c=new me(this.field,s);c=c.multiplyByMonomial(t,1);const g=c.divide(r)[1].getCoefficients(),x=t-g.length;for(let E=0;E<x;E++)e[n+E]=0;P.arraycopy(g,0,e,n+x,g.length)}}class Et{constructor(){}static applyMaskPenaltyRule1(e){return Et.applyMaskPenaltyRule1Internal(e,!0)+Et.applyMaskPenaltyRule1Internal(e,!1)}static applyMaskPenaltyRule2(e){let t=0;const n=e.getArray(),r=e.getWidth(),s=e.getHeight();for(let c=0;c<s-1;c++){const d=n[c];for(let g=0;g<r-1;g++){const x=d[g];x===d[g+1]&&x===n[c+1][g]&&x===n[c+1][g+1]&&t++}}return Et.N2*t}static applyMaskPenaltyRule3(e){let t=0;const n=e.getArray(),r=e.getWidth(),s=e.getHeight();for(let c=0;c<s;c++)for(let d=0;d<r;d++){const g=n[c];d+6<r&&g[d]===1&&g[d+1]===0&&g[d+2]===1&&g[d+3]===1&&g[d+4]===1&&g[d+5]===0&&g[d+6]===1&&(Et.isWhiteHorizontal(g,d-4,d)||Et.isWhiteHorizontal(g,d+7,d+11))&&t++,c+6<s&&n[c][d]===1&&n[c+1][d]===0&&n[c+2][d]===1&&n[c+3][d]===1&&n[c+4][d]===1&&n[c+5][d]===0&&n[c+6][d]===1&&(Et.isWhiteVertical(n,d,c-4,c)||Et.isWhiteVertical(n,d,c+7,c+11))&&t++}return t*Et.N3}static isWhiteHorizontal(e,t,n){t=Math.max(t,0),n=Math.min(n,e.length);for(let r=t;r<n;r++)if(e[r]===1)return!1;return!0}static isWhiteVertical(e,t,n,r){n=Math.max(n,0),r=Math.min(r,e.length);for(let s=n;s<r;s++)if(e[s][t]===1)return!1;return!0}static applyMaskPenaltyRule4(e){let t=0;const n=e.getArray(),r=e.getWidth(),s=e.getHeight();for(let g=0;g<s;g++){const x=n[g];for(let E=0;E<r;E++)x[E]===1&&t++}const c=e.getHeight()*e.getWidth();return Math.floor(Math.abs(t*2-c)*10/c)*Et.N4}static getDataMaskBit(e,t,n){let r,s;switch(e){case 0:r=n+t&1;break;case 1:r=n&1;break;case 2:r=t%3;break;case 3:r=(n+t)%3;break;case 4:r=Math.floor(n/2)+Math.floor(t/3)&1;break;case 5:s=n*t,r=(s&1)+s%3;break;case 6:s=n*t,r=(s&1)+s%3&1;break;case 7:s=n*t,r=s%3+(n+t&1)&1;break;default:throw new y("Invalid mask pattern: "+e)}return r===0}static applyMaskPenaltyRule1Internal(e,t){let n=0;const r=t?e.getHeight():e.getWidth(),s=t?e.getWidth():e.getHeight(),c=e.getArray();for(let d=0;d<r;d++){let g=0,x=-1;for(let E=0;E<s;E++){const A=t?c[d][E]:c[E][d];A===x?g++:(g>=5&&(n+=Et.N1+(g-5)),g=1,x=A)}g>=5&&(n+=Et.N1+(g-5))}return n}}Et.N1=3,Et.N2=3,Et.N3=40,Et.N4=10;class ki{constructor(e,t){this.width=e,this.height=t;const n=new Array(t);for(let r=0;r!==t;r++)n[r]=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 ki))return!1;const t=e;if(this.width!==t.width||this.height!==t.height)return!1;for(let n=0,r=this.height;n<r;++n){const s=this.bytes[n],c=t.bytes[n];for(let d=0,g=this.width;d<g;++d)if(s[d]!==c[d])return!1}return!0}toString(){const e=new Z;for(let t=0,n=this.height;t<n;++t){const r=this.bytes[t];for(let s=0,c=this.width;s<c;++s)switch(r[s]){case 0:e.append(" 0");break;case 1:e.append(" 1");break;default:e.append(" ");break}e.append(`
|
|
19
|
-
`)}return e.toString()}}class
|
|
11
|
+
*/var Tn=function(){return Tn=Object.assign||function(s){for(var i,u=1,f=arguments.length;u<f;u++){i=arguments[u];for(var h in i)Object.prototype.hasOwnProperty.call(i,h)&&(s[h]=i[h])}return s},Tn.apply(this,arguments)};typeof SuppressedError=="function"&&SuppressedError;var er;(function(o){var s=function(){function m(x,_,p,C){if(this.version=x,this.errorCorrectionLevel=_,this.modules=[],this.isFunction=[],x<m.MIN_VERSION||x>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=x*4+17;for(var y=[],S=0;S<this.size;S++)y.push(!1);for(var S=0;S<this.size;S++)this.modules.push(y.slice()),this.isFunction.push(y.slice());this.drawFunctionPatterns();var M=this.addEccAndInterleave(p);if(this.drawCodewords(M),C==-1)for(var k=1e9,S=0;S<8;S++){this.applyMask(S),this.drawFormatBits(S);var P=this.getPenaltyScore();P<k&&(C=S,k=P),this.applyMask(S)}f(0<=C&&C<=7),this.mask=C,this.applyMask(C),this.drawFormatBits(C),this.isFunction=[]}return m.encodeText=function(x,_){var p=o.QrSegment.makeSegments(x);return m.encodeSegments(p,_)},m.encodeBinary=function(x,_){var p=o.QrSegment.makeBytes(x);return m.encodeSegments([p],_)},m.encodeSegments=function(x,_,p,C,y,S){if(p===void 0&&(p=1),C===void 0&&(C=40),y===void 0&&(y=-1),S===void 0&&(S=!0),!(m.MIN_VERSION<=p&&p<=C&&C<=m.MAX_VERSION)||y<-1||y>7)throw new RangeError("Invalid value");var M,k;for(M=p;;M++){var P=m.getNumDataCodewords(M,_)*8,v=h.getTotalBits(x,M);if(v<=P){k=v;break}if(M>=C)throw new RangeError("Data too long")}for(var U=0,B=[m.Ecc.MEDIUM,m.Ecc.QUARTILE,m.Ecc.HIGH];U<B.length;U++){var R=B[U];S&&k<=m.getNumDataCodewords(M,R)*8&&(_=R)}for(var D=[],K=0,te=x;K<te.length;K++){var z=te[K];i(z.mode.modeBits,4,D),i(z.numChars,z.mode.numCharCountBits(M),D);for(var ie=0,W=z.getData();ie<W.length;ie++){var se=W[ie];D.push(se)}}f(D.length==k);var j=m.getNumDataCodewords(M,_)*8;f(D.length<=j),i(0,Math.min(4,j-D.length),D),i(0,(8-D.length%8)%8,D),f(D.length%8==0);for(var G=236;D.length<j;G^=253)i(G,8,D);for(var V=[];V.length*8<D.length;)V.push(0);return D.forEach(function(X,N){return V[N>>>3]|=X<<7-(N&7)}),new m(M,_,V,y)},m.prototype.getModule=function(x,_){return 0<=x&&x<this.size&&0<=_&&_<this.size&&this.modules[_][x]},m.prototype.getModules=function(){return this.modules},m.prototype.drawFunctionPatterns=function(){for(var x=0;x<this.size;x++)this.setFunctionModule(6,x,x%2==0),this.setFunctionModule(x,6,x%2==0);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);for(var _=this.getAlignmentPatternPositions(),p=_.length,x=0;x<p;x++)for(var C=0;C<p;C++)x==0&&C==0||x==0&&C==p-1||x==p-1&&C==0||this.drawAlignmentPattern(_[x],_[C]);this.drawFormatBits(0),this.drawVersion()},m.prototype.drawFormatBits=function(x){for(var _=this.errorCorrectionLevel.formatBits<<3|x,p=_,C=0;C<10;C++)p=p<<1^(p>>>9)*1335;var y=(_<<10|p)^21522;f(y>>>15==0);for(var C=0;C<=5;C++)this.setFunctionModule(8,C,u(y,C));this.setFunctionModule(8,7,u(y,6)),this.setFunctionModule(8,8,u(y,7)),this.setFunctionModule(7,8,u(y,8));for(var C=9;C<15;C++)this.setFunctionModule(14-C,8,u(y,C));for(var C=0;C<8;C++)this.setFunctionModule(this.size-1-C,8,u(y,C));for(var C=8;C<15;C++)this.setFunctionModule(8,this.size-15+C,u(y,C));this.setFunctionModule(8,this.size-8,!0)},m.prototype.drawVersion=function(){if(!(this.version<7)){for(var x=this.version,_=0;_<12;_++)x=x<<1^(x>>>11)*7973;var p=this.version<<12|x;f(p>>>18==0);for(var _=0;_<18;_++){var C=u(p,_),y=this.size-11+_%3,S=Math.floor(_/3);this.setFunctionModule(y,S,C),this.setFunctionModule(S,y,C)}}},m.prototype.drawFinderPattern=function(x,_){for(var p=-4;p<=4;p++)for(var C=-4;C<=4;C++){var y=Math.max(Math.abs(C),Math.abs(p)),S=x+C,M=_+p;0<=S&&S<this.size&&0<=M&&M<this.size&&this.setFunctionModule(S,M,y!=2&&y!=4)}},m.prototype.drawAlignmentPattern=function(x,_){for(var p=-2;p<=2;p++)for(var C=-2;C<=2;C++)this.setFunctionModule(x+C,_+p,Math.max(Math.abs(C),Math.abs(p))!=1)},m.prototype.setFunctionModule=function(x,_,p){this.modules[_][x]=p,this.isFunction[_][x]=!0},m.prototype.addEccAndInterleave=function(x){var _=this.version,p=this.errorCorrectionLevel;if(x.length!=m.getNumDataCodewords(_,p))throw new RangeError("Invalid argument");for(var C=m.NUM_ERROR_CORRECTION_BLOCKS[p.ordinal][_],y=m.ECC_CODEWORDS_PER_BLOCK[p.ordinal][_],S=Math.floor(m.getNumRawDataModules(_)/8),M=C-S%C,k=Math.floor(S/C),P=[],v=m.reedSolomonComputeDivisor(y),U=0,B=0;U<C;U++){var R=x.slice(B,B+k-y+(U<M?0:1));B+=R.length;var D=m.reedSolomonComputeRemainder(R,v);U<M&&R.push(0),P.push(R.concat(D))}for(var K=[],te=function(z){P.forEach(function(ie,W){(z!=k-y||W>=M)&&K.push(ie[z])})},U=0;U<P[0].length;U++)te(U);return f(K.length==S),K},m.prototype.drawCodewords=function(x){if(x.length!=Math.floor(m.getNumRawDataModules(this.version)/8))throw new RangeError("Invalid argument");for(var _=0,p=this.size-1;p>=1;p-=2){p==6&&(p=5);for(var C=0;C<this.size;C++)for(var y=0;y<2;y++){var S=p-y,M=(p+1&2)==0,k=M?this.size-1-C:C;!this.isFunction[k][S]&&_<x.length*8&&(this.modules[k][S]=u(x[_>>>3],7-(_&7)),_++)}}f(_==x.length*8)},m.prototype.applyMask=function(x){if(x<0||x>7)throw new RangeError("Mask value out of range");for(var _=0;_<this.size;_++)for(var p=0;p<this.size;p++){var C=void 0;switch(x){case 0:C=(p+_)%2==0;break;case 1:C=_%2==0;break;case 2:C=p%3==0;break;case 3:C=(p+_)%3==0;break;case 4:C=(Math.floor(p/3)+Math.floor(_/2))%2==0;break;case 5:C=p*_%2+p*_%3==0;break;case 6:C=(p*_%2+p*_%3)%2==0;break;case 7:C=((p+_)%2+p*_%3)%2==0;break;default:throw new Error("Unreachable")}!this.isFunction[_][p]&&C&&(this.modules[_][p]=!this.modules[_][p])}},m.prototype.getPenaltyScore=function(){for(var x=0,_=0;_<this.size;_++){for(var p=!1,C=0,y=[0,0,0,0,0,0,0],S=0;S<this.size;S++)this.modules[_][S]==p?(C++,C==5?x+=m.PENALTY_N1:C>5&&x++):(this.finderPenaltyAddHistory(C,y),p||(x+=this.finderPenaltyCountPatterns(y)*m.PENALTY_N3),p=this.modules[_][S],C=1);x+=this.finderPenaltyTerminateAndCount(p,C,y)*m.PENALTY_N3}for(var S=0;S<this.size;S++){for(var p=!1,M=0,y=[0,0,0,0,0,0,0],_=0;_<this.size;_++)this.modules[_][S]==p?(M++,M==5?x+=m.PENALTY_N1:M>5&&x++):(this.finderPenaltyAddHistory(M,y),p||(x+=this.finderPenaltyCountPatterns(y)*m.PENALTY_N3),p=this.modules[_][S],M=1);x+=this.finderPenaltyTerminateAndCount(p,M,y)*m.PENALTY_N3}for(var _=0;_<this.size-1;_++)for(var S=0;S<this.size-1;S++){var k=this.modules[_][S];k==this.modules[_][S+1]&&k==this.modules[_+1][S]&&k==this.modules[_+1][S+1]&&(x+=m.PENALTY_N2)}for(var P=0,v=0,U=this.modules;v<U.length;v++){var B=U[v];P=B.reduce(function(K,te){return K+(te?1:0)},P)}var R=this.size*this.size,D=Math.ceil(Math.abs(P*20-R*10)/R)-1;return f(0<=D&&D<=9),x+=D*m.PENALTY_N4,f(0<=x&&x<=2568888),x},m.prototype.getAlignmentPatternPositions=function(){if(this.version==1)return[];for(var x=Math.floor(this.version/7)+2,_=Math.floor((this.version*8+x*3+5)/(x*4-4))*2,p=[6],C=this.size-7;p.length<x;C-=_)p.splice(1,0,C);return p},m.getNumRawDataModules=function(x){if(x<m.MIN_VERSION||x>m.MAX_VERSION)throw new RangeError("Version number out of range");var _=(16*x+128)*x+64;if(x>=2){var p=Math.floor(x/7)+2;_-=(25*p-10)*p-55,x>=7&&(_-=36)}return f(208<=_&&_<=29648),_},m.getNumDataCodewords=function(x,_){return Math.floor(m.getNumRawDataModules(x)/8)-m.ECC_CODEWORDS_PER_BLOCK[_.ordinal][x]*m.NUM_ERROR_CORRECTION_BLOCKS[_.ordinal][x]},m.reedSolomonComputeDivisor=function(x){if(x<1||x>255)throw new RangeError("Degree out of range");for(var _=[],p=0;p<x-1;p++)_.push(0);_.push(1);for(var C=1,p=0;p<x;p++){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(x,_){for(var p=_.map(function(k){return 0}),C=function(k){var P=k^p.shift();p.push(0),_.forEach(function(v,U){return p[U]^=m.reedSolomonMultiply(v,P)})},y=0,S=x;y<S.length;y++){var M=S[y];C(M)}return p},m.reedSolomonMultiply=function(x,_){if(x>>>8||_>>>8)throw new RangeError("Byte out of range");for(var p=0,C=7;C>=0;C--)p=p<<1^(p>>>7)*285,p^=(_>>>C&1)*x;return f(p>>>8==0),p},m.prototype.finderPenaltyCountPatterns=function(x){var _=x[1];f(_<=this.size*3);var p=_>0&&x[2]==_&&x[3]==_*3&&x[4]==_&&x[5]==_;return(p&&x[0]>=_*4&&x[6]>=_?1:0)+(p&&x[6]>=_*4&&x[0]>=_?1:0)},m.prototype.finderPenaltyTerminateAndCount=function(x,_,p){return x&&(this.finderPenaltyAddHistory(_,p),_=0),_+=this.size,this.finderPenaltyAddHistory(_,p),this.finderPenaltyCountPatterns(p)},m.prototype.finderPenaltyAddHistory=function(x,_){_[0]==0&&(x+=this.size),_.pop(),_.unshift(x)},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}();o.QrCode=s;function i(m,x,_){if(x<0||x>31||m>>>x)throw new RangeError("Value out of range");for(var p=x-1;p>=0;p--)_.push(m>>>p&1)}function u(m,x){return(m>>>x&1)!=0}function f(m){if(!m)throw new Error("Assertion error")}var h=function(){function m(x,_,p){if(this.mode=x,this.numChars=_,this.bitData=p,_<0)throw new RangeError("Invalid argument");this.bitData=p.slice()}return m.makeBytes=function(x){for(var _=[],p=0,C=x;p<C.length;p++){var y=C[p];i(y,8,_)}return new m(m.Mode.BYTE,x.length,_)},m.makeNumeric=function(x){if(!m.isNumeric(x))throw new RangeError("String contains non-numeric characters");for(var _=[],p=0;p<x.length;){var C=Math.min(x.length-p,3);i(parseInt(x.substring(p,p+C),10),C*3+1,_),p+=C}return new m(m.Mode.NUMERIC,x.length,_)},m.makeAlphanumeric=function(x){if(!m.isAlphanumeric(x))throw new RangeError("String contains unencodable characters in alphanumeric mode");var _=[],p;for(p=0;p+2<=x.length;p+=2){var C=m.ALPHANUMERIC_CHARSET.indexOf(x.charAt(p))*45;C+=m.ALPHANUMERIC_CHARSET.indexOf(x.charAt(p+1)),i(C,11,_)}return p<x.length&&i(m.ALPHANUMERIC_CHARSET.indexOf(x.charAt(p)),6,_),new m(m.Mode.ALPHANUMERIC,x.length,_)},m.makeSegments=function(x){return x==""?[]:m.isNumeric(x)?[m.makeNumeric(x)]:m.isAlphanumeric(x)?[m.makeAlphanumeric(x)]:[m.makeBytes(m.toUtf8ByteArray(x))]},m.makeEci=function(x){var _=[];if(x<0)throw new RangeError("ECI assignment value out of range");if(x<128)i(x,8,_);else if(x<16384)i(2,2,_),i(x,14,_);else if(x<1e6)i(6,3,_),i(x,21,_);else throw new RangeError("ECI assignment value out of range");return new m(m.Mode.ECI,0,_)},m.isNumeric=function(x){return m.NUMERIC_REGEX.test(x)},m.isAlphanumeric=function(x){return m.ALPHANUMERIC_REGEX.test(x)},m.prototype.getData=function(){return this.bitData.slice()},m.getTotalBits=function(x,_){for(var p=0,C=0,y=x;C<y.length;C++){var S=y[C],M=S.mode.numCharCountBits(_);if(S.numChars>=1<<M)return 1/0;p+=4+M+S.bitData.length}return p},m.toUtf8ByteArray=function(x){x=encodeURI(x);for(var _=[],p=0;p<x.length;p++)x.charAt(p)!="%"?_.push(x.charCodeAt(p)):(_.push(parseInt(x.substring(p+1,p+3),16)),p+=2);return _},m.NUMERIC_REGEX=/^[0-9]*$/,m.ALPHANUMERIC_REGEX=/^[A-Z0-9 $%*+.\/:-]*$/,m.ALPHANUMERIC_CHARSET="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:",m}();o.QrSegment=h})(er||(er={})),function(o){(function(s){var i=function(){function u(f,h){this.ordinal=f,this.formatBits=h}return u.LOW=new u(0,1),u.MEDIUM=new u(1,0),u.QUARTILE=new u(2,3),u.HIGH=new u(3,2),u}();s.Ecc=i})(o.QrCode||(o.QrCode={}))}(er||(er={})),function(o){(function(s){var i=function(){function u(f,h){this.modeBits=f,this.numBitsCharCount=h}return u.prototype.numCharCountBits=function(f){return this.numBitsCharCount[Math.floor((f+7)/17)]},u.NUMERIC=new u(1,[10,12,14]),u.ALPHANUMERIC=new u(2,[9,11,13]),u.BYTE=new u(4,[8,16,16]),u.KANJI=new u(8,[8,10,12]),u.ECI=new u(7,[0,0,0]),u}();s.Mode=i})(o.QrSegment||(o.QrSegment={}))}(er||(er={}));var xr=er,ho="L",go={L:xr.QrCode.Ecc.LOW,M:xr.QrCode.Ecc.MEDIUM,Q:xr.QrCode.Ecc.QUARTILE,H:xr.QrCode.Ecc.HIGH},h1=function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0}();function mo(o){return o in go}function ca(o,s){s===void 0&&(s=0);var i=[];return o.forEach(function(u,f){var h=null;u.forEach(function(m,x){if(!m&&h!==null){i.push("M".concat(h+s," ").concat(f+s,"h").concat(x-h,"v1H").concat(h+s,"z")),h=null;return}if(x===u.length-1){if(!m)return;h===null?i.push("M".concat(x+s,",").concat(f+s," h1v1H").concat(x+s,"z")):i.push("M".concat(h+s,",").concat(f+s," h").concat(x+1-h,"v1H").concat(h+s,"z"));return}m&&h===null&&(h=x)})}),i.join("")}function ua(o,s,i,u){var f=u.width,h=u.height,m=u.x,x=u.y,_=o.length+i*2,p=Math.floor(s*.1),C=_/s,y=(f||p)*C,S=(h||p)*C,M=m==null?o.length/2-y/2:m*C,k=x==null?o.length/2-S/2:x*C,P=null;if(u.excavate){var v=Math.floor(M),U=Math.floor(k),B=Math.ceil(y+M-v),R=Math.ceil(S+k-U);P={x:v,y:U,w:B,h:R}}return{x:M,y:k,h:S,w:y,excavation:P}}function da(o,s){return o.slice().map(function(i,u){return u<s.y||u>=s.y+s.h?i:i.map(function(f,h){return h<s.x||h>=s.x+s.w?f:!1})})}var po={value:{type:String,required:!0,default:""},size:{type:Number,default:100},level:{type:String,default:ho,validator:function(o){return mo(o)}},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(o){return["linear","radial"].indexOf(o)>-1}},gradientStartColor:{type:String,required:!1,default:"#000"},gradientEndColor:{type:String,required:!1,default:"#fff"}},g1=Tn(Tn({},po),{renderAs:{type:String,required:!1,default:"canvas",validator:function(o){return["canvas","svg"].indexOf(o)>-1}}}),m1=l.defineComponent({name:"QRCodeSvg",props:po,setup:function(o){var s=l.ref(0),i=l.ref(""),u,f=function(){var m=o.value,x=o.level,_=o.margin,p=_>>>0,C=mo(x)?x:ho,y=xr.QrCode.encodeText(m,go[C]).getModules();if(s.value=y.length+p*2,o.imageSettings.src){var S=ua(y,o.size,p,o.imageSettings);u={x:S.x+p,y:S.y+p,width:S.w,height:S.h},S.excavation&&(y=da(y,S.excavation))}i.value=ca(y,p)},h=function(){if(!o.gradient)return null;var m=o.gradientType==="linear"?{x1:"0%",y1:"0%",x2:"100%",y2:"100%"}:{cx:"50%",cy:"50%",r:"50%",fx:"50%",fy:"50%"};return l.h(o.gradientType==="linear"?"linearGradient":"radialGradient",Tn({id:"qr-gradient"},m),[l.h("stop",{offset:"0%",style:{stopColor:o.gradientStartColor}}),l.h("stop",{offset:"100%",style:{stopColor:o.gradientEndColor}})])};return f(),l.onUpdated(f),function(){return l.h("svg",{width:o.size,height:o.size,"shape-rendering":"crispEdges",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 ".concat(s.value," ").concat(s.value)},[l.h("defs",{},[h()]),l.h("rect",{width:"100%",height:"100%",fill:o.background}),l.h("path",{fill:o.gradient?"url(#qr-gradient)":o.foreground,d:i.value}),o.imageSettings.src&&l.h("image",Tn({href:o.imageSettings.src},u))])}}}),p1=l.defineComponent({name:"QRCodeCanvas",props:po,setup:function(o,s){var i=l.ref(null),u=l.ref(null),f=function(){var m=o.value,x=o.level,_=o.size,p=o.margin,C=o.background,y=o.foreground,S=o.gradient,M=o.gradientType,k=o.gradientStartColor,P=o.gradientEndColor,v=p>>>0,U=mo(x)?x:ho,B=i.value;if(B){var R=B.getContext("2d");if(R){var D=xr.QrCode.encodeText(m,go[U]).getModules(),K=D.length+v*2,te=u.value,z={x:0,y:0,width:0,height:0},ie=o.imageSettings.src&&te!=null&&te.naturalWidth!==0&&te.naturalHeight!==0;if(ie){var W=ua(D,o.size,v,o.imageSettings);z={x:W.x+v,y:W.y+v,width:W.w,height:W.h},W.excavation&&(D=da(D,W.excavation))}var se=window.devicePixelRatio||1,j=_/K*se;if(B.height=B.width=_*se,R.scale(j,j),R.fillStyle=C,R.fillRect(0,0,K,K),S){var G=void 0;M==="linear"?G=R.createLinearGradient(0,0,K,K):G=R.createRadialGradient(K/2,K/2,0,K/2,K/2,K/2),G.addColorStop(0,k),G.addColorStop(1,P),R.fillStyle=G}else R.fillStyle=y;h1?R.fill(new Path2D(ca(D,v))):D.forEach(function(V,X){V.forEach(function(N,$){N&&R.fillRect($+v,X+v,1,1)})}),ie&&R.drawImage(te,z.x,z.y,z.width,z.height)}}};l.onMounted(f),l.onUpdated(f);var h=s.attrs.style;return function(){return l.h(l.Fragment,[l.h("canvas",Tn(Tn({},s.attrs),{ref:i,style:Tn(Tn({},h),{width:"".concat(o.size,"px"),height:"".concat(o.size,"px")})})),o.imageSettings.src&&l.h("img",{ref:u,src:o.imageSettings.src,style:{display:"none"},onLoad:f})])}}}),x1=l.defineComponent({name:"Qrcode",render:function(){var o=this.$props,s=o.renderAs,i=o.value,u=o.size,f=o.margin,h=o.level,m=o.background,x=o.foreground,_=o.imageSettings,p=o.gradient,C=o.gradientType,y=o.gradientStartColor,S=o.gradientEndColor;return l.h(s==="svg"?m1:p1,{value:i,size:u,margin:f,level:h,background:m,foreground:x,imageSettings:_,gradient:p,gradientType:C,gradientStartColor:y,gradientEndColor:S})},props:g1});const w1={},_1={viewBox:"0 0 24 24","aria-hidden":"true"};function C1(o,s){return l.openBlock(),l.createElementBlock("svg",_1,[...s[0]||(s[0]=[l.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),l.createElementVNode("path",{d:"M9 7h6"},null,-1),l.createElementVNode("path",{d:"M10 18h4"},null,-1)])])}const E1=Ue(w1,[["render",C1]]),y1={},b1={viewBox:"0 0 24 24","aria-hidden":"true"};function A1(o,s){return l.openBlock(),l.createElementBlock("svg",b1,[...s[0]||(s[0]=[l.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 I1=Ue(y1,[["render",A1]]),S1="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",N1={class:"wrapper_qr_page"},T1=["src"],k1={class:"modal_qr"},R1={class:"modal_qr_content"},O1={class:"wrapper_icon_qr"},B1=["src"],M1={class:"total_order_price"},v1={class:"ttl_wrapper"},D1={class:"ttl_head"},P1={class:"ttl_bar"},L1={class:"hint hint-anim","aria-label":"Инструкция по оплате"},F1={class:"steps","aria-hidden":"true"},V1={class:"step is-active","data-i":"0"},U1={class:"ico"},z1={class:"step","data-i":"1"},H1={class:"ico"},G1={class:"step","data-i":"2"},W1={class:"ico"},X1=["src"],j1={class:"qr_border"},q1=Ue(l.defineComponent({__name:"CompletedQRCode",setup(o){const s=It(),i=St(),u=lt(),f=Re.useRouter(),h={src:s.itemThemes.logo||"",width:60,height:60,excavate:!0},m=l.computed(()=>s.itemThemes.kiosk_qr_payment_timeout||60).value,x=l.ref(m);let _=0;const p=l.computed(()=>{const P=Math.floor(x.value/60),v=x.value%60;return`${P}:${v.toString().padStart(2,"0")}`}),C=l.computed(()=>x.value/m*100),y=l.computed(()=>i.paymentCostQR),S=()=>{x.value--,x.value<=0&&(clearInterval(_),M())},M=()=>{u.removeFromLocalStorage(["cart","authTokensAccess","authTokensRefresh","user"]),sessionStorage.removeItem("is_adult"),f.replace({name:"home"}).then(()=>f.go(0))};l.onMounted(()=>{_=setInterval(S,1e3)}),l.onBeforeUnmount(()=>{clearInterval(_)});const{mediaUrl:k}=Fn(()=>s.itemThemes.kiosk_preloader?"preloader":null);return(P,v)=>(l.openBlock(),l.createElementBlock("div",N1,[(l.openBlock(),l.createElementBlock("video",{loop:"",autoplay:"",muted:"",playsinline:"",key:l.unref(k)},[l.createElementVNode("source",{src:l.unref(k)||"",type:"video/webm"},null,8,T1)])),v[7]||(v[7]=l.createElementVNode("div",{class:"start_img_black"},null,-1)),l.createElementVNode("div",k1,[l.createElementVNode("div",R1,[l.createElementVNode("div",O1,[l.createElementVNode("img",{src:l.unref(la),width:"100",height:"100"},null,8,B1)]),v[6]||(v[6]=l.createElementVNode("h1",null,"Оплата по QR",-1)),l.createElementVNode("p",M1,[l.createVNode(Xt,{price:y.value,fixedFloat:2},null,8,["price"]),l.createTextVNode(" "+l.toDisplayString(l.unref(u).config_lib.currency_symbol),1)]),l.createElementVNode("div",v1,[l.createElementVNode("div",D1,[v[0]||(v[0]=l.createElementVNode("span",null,"Срок жизни QR-кода",-1)),l.createElementVNode("b",null,l.toDisplayString(p.value),1)]),l.createElementVNode("div",P1,[l.createElementVNode("div",{class:"ttl_fill",style:l.normalizeStyle({width:`${C.value}%`})},null,4)])]),l.createElementVNode("p",L1,[l.createElementVNode("div",F1,[l.createElementVNode("div",V1,[l.createElementVNode("div",U1,[l.createVNode(E1)]),v[1]||(v[1]=l.createElementVNode("div",{class:"txt"},"Возьмите телефон →",-1))]),v[4]||(v[4]=l.createElementVNode("div",{class:"sep"},null,-1)),l.createElementVNode("div",z1,[l.createElementVNode("div",H1,[l.createVNode(I1)]),v[2]||(v[2]=l.createElementVNode("span",{class:"txt"},"Отсканируйте QR-код",-1))]),v[5]||(v[5]=l.createElementVNode("span",{class:"sep"},"→",-1)),l.createElementVNode("div",G1,[l.createElementVNode("div",W1,[l.createElementVNode("img",{src:l.unref(S1),width:"30",height:"30"},null,8,X1)]),v[3]||(v[3]=l.createElementVNode("span",{class:"txt"},"Оплатите заказ",-1))])])]),l.createElementVNode("div",j1,[l.createVNode(x1,{value:l.unref(i).linkQR,size:200,level:"Q","render-as":"svg","image-settings":h},null,8,["value"])]),l.createVNode(un,{textButtonDefault:"Отменить заказ",onClick:M,class:"cancel_order_btn"})])])]))}}),[["__scopeId","data-v-bd3b4b16"]]),Z1={key:0,class:"wrapper_qr"},Y1={key:1,class:"wrapper_qr"},$1={key:2,class:"wrapper_qr"},K1={key:3,class:"wrapper_qr"},Q1=Ue(l.defineComponent({__name:"CartCompletedOrder",props:{orderNumber:{}},setup(o){const s=St(),i=It(),{orderNumber:u,orderCompleted_lib:f}=xe.storeToRefs(s),{mediaUrl:h}=Fn(()=>i.itemThemes.kiosk_preloader?"preloader":null);return(m,x)=>(l.openBlock(),l.createElementBlock(l.Fragment,null,[l.unref(f)&&l.unref(f)===1?(l.openBlock(),l.createElementBlock("section",Z1,[l.createVNode(l1)])):l.unref(f)&&l.unref(f)===2?(l.openBlock(),l.createElementBlock("section",Y1,[l.createVNode(f1)])):l.createCommentVNode("",!0),l.unref(f)&&l.unref(f)===3?(l.openBlock(),l.createElementBlock("section",$1,[l.createVNode(o1,{orderNumber:l.unref(u),mediaUrl:l.unref(h)},null,8,["orderNumber","mediaUrl"])])):l.createCommentVNode("",!0),l.unref(f)&&l.unref(f)===4?(l.openBlock(),l.createElementBlock("section",K1,[l.createVNode(q1)])):l.createCommentVNode("",!0)],64))}}),[["__scopeId","data-v-3779e8ee"]]),J1={},ef={class:"cart_loyal_qr",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none"};function tf(o,s){return l.openBlock(),l.createElementBlock("svg",ef,[...s[0]||(s[0]=[l.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 nf=Ue(J1,[["render",tf]]),fa=o=>{const s=fo(),i=x=>s.open(o,x),u=()=>s.close(o),f=s.state(o),h=l.computed({get:()=>f.value.visible,set:x=>x&&i()||u()}),m=l.computed(()=>f.value.context);return{visible:h,context:m,open:i,close:u}},rf={class:"cart_deletion_modal_content"},of={class:"cart_deletion_modal_title"},sf={class:"cart_deletion_modal_footer"},af=Ue(l.defineComponent({__name:"CartDeleteConfirm",emits:["confirm"],setup(o,{emit:s}){const i=s,{visible:u,context:f,close:h}=fa("cart-delete-confirm"),m=()=>{i("confirm",f.value.idSystem),h()};return(x,_)=>(l.openBlock(),l.createBlock(l.Transition,{name:"fade"},{default:l.withCtx(()=>[l.unref(u)?(l.openBlock(),l.createElementBlock("div",{key:0,class:"cart_deletion_modal_overlay",onClick:_[1]||(_[1]=l.withModifiers((...p)=>l.unref(h)&&l.unref(h)(...p),["self"]))},[l.createElementVNode("div",rf,[l.createElementVNode("div",of,"Удалить "+l.toDisplayString(l.unref(f).name)+"?",1),_[2]||(_[2]=l.createElementVNode("div",{class:"cart_deletion_modal_body"},"Эта позиция будет полностью удалена из заказа.",-1)),l.createElementVNode("div",sf,[l.createElementVNode("button",{class:"primary",onClick:m}," Удалить "),l.createElementVNode("button",{onClick:_[0]||(_[0]=(...p)=>l.unref(h)&&l.unref(h)(...p))},"Отмена")])])])):l.createCommentVNode("",!0)]),_:1}))}}),[["__scopeId","data-v-018f66f3"]]),lf={class:"cart_wrapper"},cf={class:"cart_header_content"},uf={key:0,class:"cart_header_subwrapper"},df={class:"cart_kso_button_wrapper"},ff={key:0},hf={key:0,class:"kso_btn_wrapper"},gf=["src"],mf={key:0,class:"cart_qr_button_wrapper"},pf={class:"cart_header_info"},xf={class:"cart_header_info"},wf={class:"cart_header_info"},_f={class:"cart_header_info"},Cf={key:1,class:"cart-tabs-wrapper"},Ef={class:"cart-tabs-container"},yf=["data-active","onClick"],bf={key:0,class:"wrapper_comment"},Af={class:"wrapper_limit_in_area"},If=["placeholder","aria-invalid"],Sf={class:"limit_comment"},Nf={key:1,class:"wrapper_comment"},Tf={class:"wrapper_limit_in_area"},kf=["placeholder","aria-invalid"],Rf={class:"limit_comment"},Of={key:2},Bf={class:"cart_cards"},Mf={class:"cart_footer_wrapper"},vf={key:0,class:"footer_title"},Df=["disabled","max"],Pf={key:1,class:"footer_sales"},Lf=["max"],Ff={class:"list_price"},Vf={key:0},Uf={key:1},zf={key:2},Hf={class:"accept_field"},Gf={class:"accept_field"},Wf={key:3},Xf={class:"accept_field"},jf={class:"accept_field"},qf={class:"accept_field"},Zf={key:3,class:"cart_min_order_notice"},Yf={class:"wrapper_footer_cart_btn"},$f=l.defineComponent({__name:"CartPage",props:{configPage:{},textPaymentBtn:{},config_qr:{type:Boolean}},setup(o){const s=En.create();let i;const u=lt(),f=St(),h=It(),m=o,{totalPrice_lib:x,countBonus:_,config_lib:p,cartProducts_lib:C,profile:y}=xe.storeToRefs(u),{itemThemes:S}=xe.storeToRefs(h),{textPaymentBtn_lib:M,isButtonDisabled:k,orderCompleted_lib:P,orderNumber:v,extraDiscount:U,is_notification_lib:B,discountBtn:R,is_paymentCart:D,providerTypes:K,notificationData_lib:te,selectedProvider:z,configPayment:ie}=xe.storeToRefs(f),W=Re.useRouter(),se=Re.useRoute(),j=l.useTemplateRef("stickerLoyality"),G=l.ref(!1),V=l.ref(!1),X=l.useTemplateRef("commentEl"),N=l.ref(""),$=l.ref(!1),H=l.ref(!1),J=l.ref(!1),q=l.ref(0),re=l.ref(0),ge=l.ref(),we=l.computed(()=>m.configPage.qr_menu?"YOOKASSA_BASE":K.value[0].front_type),Ne=l.computed(()=>m.configPage.qr_menu?"YOOKASSA":K.value[0].type),{width:_e}=Wt.useElementSize(j,{width:0,height:0},{box:"border-box"}),Me=l.computed(()=>{const be={energy_amount:0,proteins_amount:0,fat_amount:0,carbohydrates_amount:0};return C.value.reduce((le,Qe)=>(le.energy_amount+=(Qe.energy_amount||0)*(Qe.amount||0),le.proteins_amount+=(Qe.proteins_amount||0)*(Qe.amount||0),le.fat_amount+=(Qe.fat_amount||0)*(Qe.amount||0),le.carbohydrates_amount+=(Qe.carbohydrates_amount||0)*(Qe.amount||0),le),be)}),he=l.computed(()=>{var be;if((be=S.value)!=null&&be.comments){const le=S.value.comments;return{fieldName:m.configPage.kiosk_menu?le.kiosk_comment_field_name:le.qr_comment_field_name,placeholder:m.configPage.kiosk_menu?le.kiosk_comment_field_placeholder:le.qr_comment_field_placeholder,show:m.configPage.kiosk_menu?le.kiosk_show_order_comment:le.qr_show_order_comment}}}),dt=Wt.computedAsync(async be=>{var Ke;const le=new AbortController;if(be(()=>le.abort()),!G.value||!((Ke=y.value)!=null&&Ke.balance))return 0;const Qe=await s.maxPayByBonuses(x.value,m.configPage.kiosk_menu,!!m.configPage.userData||!!y.value,le.signal);return Qe!=null&&Qe.by_bonuses?y.value.balance>Qe.by_bonuses?Qe.by_bonuses:y.value.balance:0},0,{shallow:!0}),Xe=()=>W.push(`/${se.params.orgId}/`),Oe=be=>{["a","A","+","-",".",","].includes(be.key)&&be.preventDefault()},qe=be=>{u.deleteItemFromCart(be),C.value.length===0&&(H.value=!1,J.value=!1)},me=()=>{H.value=!H.value,N.value.length},Ze=l.computed(()=>{var le;return(((le=S.value.cart_loyalty_button)==null?void 0:le.cart_loyalty_button_text)||"Программа лояльности").replace(/\S+/g,Qe=>Qe.length>15?Qe.slice(0,15)+"...":Qe)}),Ee=()=>{J.value=!J.value,N.value.length},mt=()=>{let be=Math.floor(_.value)||0;be>dt.value&&(be=dt.value),be!==_.value&&u.setBonus(be)};l.watchEffect(()=>{mt(),u.setBonus(x.value===0?0:Math.floor(_.value))});const nt=()=>C.value.map(be=>({id:be.id,front_item_id:be.idSystem,is_fake:!!be.is_fake,is_od_united_product:!!be.is_od_united_product,removals:be.removals??null,amount:be.amount,size:be.size,modifiers:be.modifiers??[],group_modifiers:be.group_modifiers??[]})),{makeCreateOrderRequest:jt}=aa(),ot=l.computed(()=>nt()),ze=l.computed(()=>{var be,le,Qe,Ke;return m.configPage.qr_menu&&((le=(be=S.value)==null?void 0:be.comments)==null?void 0:le.qr_is_order_comment_required)||m.configPage.kiosk_menu&&((Ke=(Qe=S.value)==null?void 0:Qe.comments)==null?void 0:Ke.kiosk_is_order_comment_required)}),He=()=>{var be,le;return ze.value&&((le=(be=N.value)==null?void 0:be.trim())==null?void 0:le.length)<1&&X.value?(f.showNotification("Обязательно перед созданием заказа укажите комментарий к заказу"),X.value.focus(),$.value=!0,At.animate(X.value.parentElement,{x:[0,-10,0,10,0]},{duration:.1,repeat:2}),!0):!1},Cr=async()=>{if(!y.value&&m.configPage.qr_menu){W.push(`/${se.params.orgId}/register`);return}if(!(ze.value&&He())){if(m.configPage.qr_menu||K.value.length<=1){p.value.has_rms_discount&&!S.value.hide_discounts_calculate_button&&ge!=null?(k.value=!0,await Fr(ge.value,Ne.value).then(be=>{const le=ie.value;le&&(le.is_tableservice?js(le,null):be.url&&m.configPage.qr_menu&&window.location.replace(be.url))})):(z.value={front_type:we},await jt(m.configPage,{paymentMethodId:we.value,items:ot.value,tableDataId:m.configPage.tableDataId,comment:N.value,isAuthorized:!!m.configPage.userData||!!y,signal:i==null?void 0:i.signal}));return}return D.value=!D.value}},ye=()=>{D.value=!1},Er=async()=>{var Qe,Ke,de,ft,Ye,rt,Ve;if(p.value.has_rms_discount&&ze.value&&He())return;U.value=0,k.value=!0;const be={items:[...nt()],table:((Qe=m.configPage)==null?void 0:Qe.tableDataId)||null,combos:[]};(Ke=m.configPage)!=null&&Ke.kiosk_menu&&((de=f.selectedOrderType)!=null&&de.id)&&(be.order_type_id=(ft=f.selectedOrderType)==null?void 0:ft.id);const le=En.create();i=new AbortController;try{V.value=!0;const qt=await le.calculateDiscount(be,m.configPage.kiosk_menu,!!m.configPage.userData||!!y.value,i.signal);if(!C.value)return;if(C.value.forEach(Nt=>{const De=qt.items.find(yt=>yt.front_item_id===Nt.idSystem);if(De&&(Nt.group_modifiers.forEach(yt=>{const Pt=De.group_modifiers.find(Lt=>Lt.group===yt.group);Pt&&yt.modifiers.forEach(Lt=>{const xt=Pt.modifiers.find(Un=>Un.id===Lt.id);if(xt&&Number(Lt.price)!==Number(xt==null?void 0:xt.new_price)){const Un=(xt.discounts||[]).reduce((Bt,Gn)=>Bt+=+Gn.discount,0);q.value+=Un,Lt.new_price=Lt.price,Lt.price=Number(xt==null?void 0:xt.new_price),Lt.total_new_price=Number(xt.total_new_price)}})}),Nt.modifiers.forEach(yt=>{const Pt=De.modifiers.find(Lt=>Lt.id===yt.id);if(Pt&&Number(yt.price)!==Number(Pt==null?void 0:Pt.new_price)){const Lt=(Pt.discounts||[]).reduce((xt,Un)=>xt+=+Un.discount,0);q.value+=Lt,yt.new_price=yt.price,yt.price=Number(Pt==null?void 0:Pt.new_price),yt.total_new_price=Number(Pt.total_new_price)}}),Nt.price!==Number(De.new_price))){const yt=(De.discounts||[]).reduce((Pt,Lt)=>Pt+=+Lt.discount,0);q.value=q.value+yt,Nt.new_price=Nt.price,Nt.price=De.new_price,Nt.discounts=De.discounts,Nt.total_new_price=Number(De.total_new_price)}}),C.value=[...C.value],q.value!==0&&(x.value=qt.total_cart_price),p.value.has_rms_discount){z.value={front_type:we};const Nt=await jt(m.configPage,{paymentMethodId:we.value,items:ot.value,tableDataId:m.configPage.tableDataId,comment:N.value,isAuthorized:!!m.configPage.userData||!!y,signal:i==null?void 0:i.signal});ge.value=(Ye=Nt==null?void 0:Nt.data)==null?void 0:Ye.id}else k.value=!1;R.value=!1}catch(qt){et.isCancel(qt)||f.showNotification(((Ve=(rt=qt==null?void 0:qt.response)==null?void 0:rt.data)==null?void 0:Ve.user_friendly_message)||"Скидки временно недоступны"),R.value=!0,V.value=!1,k.value=!1}},bi=()=>{var be;(be=y.value)!=null&&be.balance?y.value.balance>=1&&(G.value=!G.value):f.showNotification("У Вас пока нет бонусов")},bn=()=>{var be,le;if(S.value.hide_discounts_calculate_button){R.value=!1;return}p.value.has_rms_discount&&(m.configPage.kiosk_menu||m.configPage.qr_menu&&y.value)?(ge.value=null,R.value=!0):((be=p.value)==null?void 0:be.loyalty)==="IIKO"&&(p.value.has_loyalty_default_user||y.value)&&m.configPage.kiosk_menu||((le=p.value)==null?void 0:le.loyalty)==="IIKO"&&m.configPage.qr_menu&&y.value?R.value=!0:R.value=!1};l.onMounted(async()=>{M.value=m.textPaymentBtn,u.loadCart(),P.value=null,x.value=null,U.value=0,C.value.splice(0,C.value.length,...C.value.map(u.makeProductFullyReactive))}),l.onUnmounted(()=>{ge.value=null,P.value=null,x.value=null,U.value=0,C.value.splice(0,C.value.length,...C.value.map(u.makeProductFullyReactive))});const rr=l.computed(()=>x.value-U.value-q.value),Dt=l.computed(()=>m.configPage.qr_menu?p.value.qr_order_minimum_price||0:m.configPage.kiosk_menu&&p.value.kiosk_order_minimum_price||0),Ai=l.computed(()=>Dt.value>rr.value||V.value||k.value?!0:["АВТОРИЗОВАТЬСЯ ДЛЯ ЗАКАЗА"].includes(M.value.toUpperCase())?!1:C.value.length===0||x.value===0?!0:(P.value=null,k.value)),dn=l.computed(()=>{var be;return((be=C.value)==null?void 0:be.reduce((le,Qe)=>le+Qe.amount,0))||0}),Ot=l.computed(()=>{var be;return(be=y.value)==null?void 0:be.phone});return l.watch(N,be=>{var le;return((le=be==null?void 0:be.trim())==null?void 0:le.length)&&($.value=!1)}),l.watch([dn,Ot],()=>{dn.value===0&&(i=null),i==null||i.abort(),k.value=!1}),l.watch([()=>u.cartProducts_lib,Ot,dn,()=>f.selectedOrderType],be=>{if(re.value>0){re.value--;return}be&&!V.value&&(bn(),C.value.splice(0,C.value.length,...C.value.map(u.makeProductFullyReactive)),q.value=0,x.value=null,U.value=0,re.value=1),V.value=!1},{deep:!0}),(be,le)=>{var Qe,Ke,de,ft,Ye,rt;return l.openBlock(),l.createElementBlock(l.Fragment,null,[l.createElementVNode("div",lf,[l.createVNode(af,{onConfirm:qe}),l.createVNode(ia,{visible:l.unref(f).isDrawerOpen,"onUpdate:visible":le[0]||(le[0]=Ve=>l.unref(f).isDrawerOpen=Ve)},{default:l.withCtx(()=>[l.createVNode(sa)]),_:1},8,["visible"]),l.createElementVNode("header",cf,[m.configPage.kiosk_menu?(l.openBlock(),l.createElementBlock("div",uf,[l.createElementVNode("div",df,[l.createElementVNode("div",{class:l.normalizeClass(["arrow_wrapper",{arrow_wrapper_kso:m.configPage.kiosk_menu}]),onClick:Xe},[l.createVNode(Ur,{class:"cart_header_back_button"}),m.configPage.kiosk_menu?(l.openBlock(),l.createElementBlock("span",ff,"Назад")):l.createCommentVNode("",!0)],2)]),he.value&&he.value.show?(l.openBlock(),l.createElementBlock("div",hf,[ze.value?l.createCommentVNode("",!0):(l.openBlock(),l.createBlock(un,{key:0,style:l.normalizeStyle({visibility:!H.value&&l.unref(C).length>0?"visible":"hidden"}),class:l.normalizeClass({button_kso_comment:o.configPage.kiosk_menu}),textButtonDefault:N.value.length>0?"Редактировать":he.value&&he.value.fieldName||"",onClick:()=>H.value=!H.value,id:"button_kso_comment"},null,8,["style","class","textButtonDefault","onClick"]))])):l.createCommentVNode("",!0),l.createElementVNode("div",{class:l.normalizeClass({cart_header_wrapper:m.configPage.kiosk_menu})},[(l.unref(S).kiosk_show_loyalty_card_button||l.unref(S).kiosk_show_loyalty_phone_input_button)&&!m.config_qr?(l.openBlock(),l.createElementBlock("button",{key:0,class:"buttonDefaultWrapper button_payment_cart button_payment_cart_loyal",style:l.normalizeStyle({marginRight:(Qe=l.unref(S).cart_loyalty_button)!=null&&Qe.cart_loyalty_button_sticker?`${Math.ceil(l.unref(_e)/2+10)}px`:"",paddingRight:(Ke=l.unref(S).cart_loyalty_button)!=null&&Ke.cart_loyalty_button_sticker?0:""}),onClick:le[1]||(le[1]=(...Ve)=>l.unref(f).openDrawer&&l.unref(f).openDrawer(...Ve))},[l.createElementVNode("p",{class:"cart_loyal_program",style:l.normalizeStyle({marginRight:`${Math.ceil(l.unref(_e)/2)}px`})},l.toDisplayString(Ze.value),5),(de=l.unref(S).cart_loyalty_button)!=null&&de.cart_loyalty_button_sticker?(l.openBlock(),l.createElementBlock("div",{key:0,ref_key:"stickerLoyality",ref:j,class:"cart_loyal_program_icon",style:l.normalizeStyle({"--sticker-mask":`url(${l.unref(S).cart_loyalty_button.cart_loyalty_button_sticker})`})},[l.createElementVNode("img",{src:l.unref(S).cart_loyalty_button.cart_loyalty_button_sticker},null,8,gf)],4)):(l.openBlock(),l.createBlock(nf,{key:1,class:"cart_loyal_qr"}))],4)):l.createCommentVNode("",!0)],2)])):l.createCommentVNode("",!0),l.createElementVNode("div",{class:l.normalizeClass([o.config_qr?"cart_kbju_qr_wrapper":"cart_kbju_kso_wrapper"])},[o.config_qr?(l.openBlock(),l.createElementBlock("div",mf,[l.createElementVNode("div",{class:"arrow_wrapper",onClick:Xe},[l.createVNode(Ur,{class:"cart_header_back_button"})])])):l.createCommentVNode("",!0),l.unref(S).show_nutrition_in_cart?(l.openBlock(),l.createElementBlock("div",{key:1,class:"cart_header",style:l.normalizeStyle({paddingTop:m.config_qr?0:"10px",paddingRight:m.config_qr?"10px":0})},[l.createElementVNode("div",pf,[l.createElementVNode("p",null,[l.createVNode(Xt,{price:Me.value.energy_amount,duration:800},null,8,["price"]),le[8]||(le[8]=l.createTextVNode(" г",-1))]),le[9]||(le[9]=l.createElementVNode("p",{class:"cart_info_name"},"Килокалории",-1))]),l.createElementVNode("div",xf,[l.createElementVNode("p",null,[l.createVNode(Xt,{price:Me.value.proteins_amount,duration:900},null,8,["price"]),le[10]||(le[10]=l.createTextVNode(" г",-1))]),le[11]||(le[11]=l.createElementVNode("p",{class:"cart_info_name"},"Белки",-1))]),l.createElementVNode("div",wf,[l.createElementVNode("p",null,[l.createVNode(Xt,{price:Me.value.fat_amount,duration:1e3},null,8,["price"]),le[12]||(le[12]=l.createTextVNode(" г",-1))]),le[13]||(le[13]=l.createElementVNode("p",{class:"cart_info_name"},"Жиры",-1))]),l.createElementVNode("div",_f,[l.createElementVNode("p",null,[l.createVNode(Xt,{price:Me.value.carbohydrates_amount,duration:1100},null,8,["price"]),le[14]||(le[14]=l.createTextVNode(" г",-1))]),le[15]||(le[15]=l.createElementVNode("p",{class:"cart_info_name"},"Углеводы",-1))])],4)):l.createCommentVNode("",!0)],2),o.configPage.kiosk_menu&&l.unref(f).orderTypes.length>1?(l.openBlock(),l.createElementBlock("div",Cf,[l.createElementVNode("ul",Ef,[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(f).orderTypes,Ve=>{var qt,Nt;return l.openBlock(),l.createElementBlock("li",{key:Ve.id,class:"cart-tab","data-active":Ve.id===((qt=l.unref(f).selectedOrderType)==null?void 0:qt.id),onClick:De=>l.unref(f).selectedOrderType=Ve},[Ve.id===((Nt=l.unref(f).selectedOrderType)==null?void 0:Nt.id)?(l.openBlock(),l.createBlock(l.unref(At.motion).div,{key:0,class:"cart-underline","layout-id":"cart-underline",id:"cart-underline"})):l.createCommentVNode("",!0),l.createElementVNode("span",null,l.toDisplayString(Ve.name),1)],8,yf)}),128))])])):l.createCommentVNode("",!0)]),(ze.value||H.value)&&o.configPage.kiosk_menu&&((ft=l.unref(C))!=null&&ft.length)?(l.openBlock(),l.createElementBlock("div",bf,[l.createElementVNode("div",Af,[l.withDirectives(l.createElementVNode("textarea",{ref_key:"commentEl",ref:X,class:"comment_order",placeholder:he.value&&he.value.placeholder||"Ваш комментарий к заказу...",name:"commentKso",maxlength:"50","aria-invalid":$.value,"onUpdate:modelValue":le[2]||(le[2]=Ve=>N.value=Ve)},null,8,If),[[l.vModelText,N.value]]),l.createElementVNode("p",Sf,l.toDisplayString(N.value.length+" / 50"),1)]),ze.value?l.createCommentVNode("",!0):(l.openBlock(),l.createBlock(un,{key:0,textButtonDefault:"Сохранить",onClick:me,class:"button_bonus_cart"}))])):l.createCommentVNode("",!0),(ze.value||J.value)&&o.config_qr&&((Ye=l.unref(C))!=null&&Ye.length)?(l.openBlock(),l.createElementBlock("div",Nf,[l.createElementVNode("div",Tf,[l.withDirectives(l.createElementVNode("textarea",{ref_key:"commentEl",ref:X,class:"comment_order",placeholder:he.value&&he.value.placeholder||"Ваш комментарий к заказу...",name:"commentQr",maxlength:"50","aria-invalid":$.value,"onUpdate:modelValue":le[3]||(le[3]=Ve=>N.value=Ve)},null,8,kf),[[l.vModelText,N.value]]),l.createElementVNode("p",Rf,l.toDisplayString(N.value.length+" / 50"),1)]),ze.value?l.createCommentVNode("",!0):(l.openBlock(),l.createBlock(un,{key:0,textButtonDefault:"Сохранить",onClick:Ee,class:"button_bonus_cart"}))])):l.createCommentVNode("",!0),o.config_qr&&he.value&&he.value.show?(l.openBlock(),l.createElementBlock("div",Of,[!ze.value&&!J.value&&l.unref(C).length>0?(l.openBlock(),l.createBlock(un,{key:0,textButtonDefault:N.value.length>0?"Редактировать":he.value.fieldName||"",onClick:()=>J.value=!J.value,id:"button_comments"},null,8,["textButtonDefault","onClick"])):l.createCommentVNode("",!0)])):l.createCommentVNode("",!0),l.createElementVNode("div",Bf,[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(C),Ve=>(l.openBlock(),l.createBlock(oa,{key:Ve.idSystem,cardItem:Ve,onDelete:qt=>qe(Ve.idSystem)},null,8,["cardItem","onDelete"]))),128))]),l.createElementVNode("div",Mf,[G.value?(l.openBlock(),l.createElementBlock("p",vf,[le[16]||(le[16]=l.createTextVNode(" Списать ",-1)),l.withDirectives(l.createElementVNode("input",{type:"number",placeholder:"0",style:l.normalizeStyle({maxWidth:`${l.unref(_).toString().length||1}em`}),disabled:l.unref(y)===null||((rt=l.unref(y))==null?void 0:rt.balance)===0,"onUpdate:modelValue":le[4]||(le[4]=Ve=>l.isRef(_)?_.value=Ve:null),onInput:mt,min:"0",max:l.unref(dt),onKeypress:Oe},null,44,Df),[[l.vModelText,l.unref(_),void 0,{number:!0}]]),le[17]||(le[17]=l.createTextVNode(" бонусов ",-1))])):l.createCommentVNode("",!0),G.value?(l.openBlock(),l.createElementBlock("p",Pf,"У вас есть "+l.toDisplayString(l.unref(y)?l.unref(y).balance:0)+" B",1)):l.createCommentVNode("",!0),G.value?l.withDirectives((l.openBlock(),l.createElementBlock("input",{key:2,type:"range",class:"footer_range","onUpdate:modelValue":le[5]||(le[5]=Ve=>l.isRef(_)?_.value=Ve:null),min:0,max:l.unref(dt)},null,8,Lf)),[[l.vModelText,l.unref(_),void 0,{number:!0}]]):l.createCommentVNode("",!0),l.createElementVNode("ul",Ff,[G.value?(l.openBlock(),l.createElementBlock("li",Vf,[le[19]||(le[19]=l.createElementVNode("p",null,"Сумма заказа:",-1)),l.createElementVNode("p",null,[l.createVNode(Xt,{price:l.unref(x),fixedFloat:2},null,8,["price"]),le[18]||(le[18]=l.createTextVNode(" ₽",-1))])])):l.createCommentVNode("",!0),G.value?(l.openBlock(),l.createElementBlock("li",Uf,[le[21]||(le[21]=l.createElementVNode("p",null,"Будет оплачено бонусами:",-1)),l.createElementVNode("p",null,[l.createVNode(Xt,{price:l.unref(_),fixedFloat:2},null,8,["price"]),le[20]||(le[20]=l.createTextVNode(" Б",-1))])])):l.createCommentVNode("",!0),l.unref(U)!==0?(l.openBlock(),l.createElementBlock("li",zf,[l.createElementVNode("p",Hf,l.toDisplayString(l.unref(U)>0?"Надбавка":"Скидка")+": ",1),l.createElementVNode("p",Gf,[l.createVNode(Xt,{price:Math.abs(l.unref(U)),fixedFloat:2},null,8,["price"]),le[22]||(le[22]=l.createTextVNode(" ₽",-1))])])):q.value!==0?(l.openBlock(),l.createElementBlock("li",Wf,[l.createElementVNode("p",Xf,l.toDisplayString(q.value>0?"Надбавка":"Скидка")+": ",1),l.createElementVNode("p",jf,[l.createVNode(Xt,{price:Math.abs(q.value),fixedFloat:2},null,8,["price"]),le[23]||(le[23]=l.createTextVNode(" ₽",-1))])])):l.createCommentVNode("",!0),l.createElementVNode("li",null,[le[25]||(le[25]=l.createElementVNode("p",{class:"accept_field"},"Итого к оплате:",-1)),l.createElementVNode("p",qf,[l.createVNode(Xt,{price:l.unref(x)-l.unref(_),fixedFloat:2},null,8,["price"]),le[24]||(le[24]=l.createTextVNode(" ₽",-1))])])]),Dt.value&&rr.value<Dt.value?(l.openBlock(),l.createElementBlock("div",Zf,[le[26]||(le[26]=l.createTextVNode(" Минимальная сумма заказа ",-1)),l.createVNode(Xt,{price:Dt.value,fixedFloat:2},null,8,["price"]),l.createTextVNode(" "+l.toDisplayString(l.unref(p).currency_symbol)+". Для оформления заказа необходимо добавить товаров на сумму ",1),l.createVNode(Xt,{price:Dt.value-rr.value,fixedFloat:2},null,8,["price"]),l.createTextVNode(" "+l.toDisplayString(l.unref(p).currency_symbol),1)])):l.createCommentVNode("",!0),l.createElementVNode("div",Yf,[l.unref(y)?(l.openBlock(),l.createBlock(un,{key:0,textButtonDefault:l.unref(S).bonuses_button_name||"Бонусы",onClick:bi,class:"button_bonus_cart"},null,8,["textButtonDefault"])):l.createCommentVNode("",!0),l.createVNode(un,{textButtonDefault:l.unref(R)?"Рассчитать скидки":l.unref(M),onClick:l.unref(R)?Er:Cr,class:"button_payment_cart",disabled:Ai.value},null,8,["textButtonDefault","onClick","disabled"])])])]),l.createVNode(Q1,{orderNumber:l.unref(v),pageNumber:1},null,8,["orderNumber"]),l.createVNode(lo,{visible:l.unref(B),"onUpdate:visible":le[6]||(le[6]=Ve=>l.isRef(B)?B.value=Ve:null),textNotificationDefault:l.unref(te).textNotification,backgroundColor:l.unref(S).accent_color?l.unref(S).accent_color:"#FF6D2E",buttonAccept:null},null,8,["visible","textNotificationDefault","backgroundColor"]),l.createVNode(uo,{modelValue:l.unref(D),"onUpdate:modelValue":le[7]||(le[7]=Ve=>l.isRef(D)?D.value=Ve:null),class:"product_card_sheet","snap-points":["80%"]},{default:l.withCtx(()=>{var Ve;return[l.createVNode(K0,{"config-page":o.configPage,comment:N.value,"cart-items":ot.value,"is-authorized":!!m.configPage.userData||!!l.unref(y),"has-rms-discount":l.unref(p).has_rms_discount,"hide-discounts-button":l.unref(S).hide_discounts_calculate_button,"order-id":ge.value,signal:(Ve=l.unref(i))==null?void 0:Ve.signal,onSelectPayment:ye},null,8,["config-page","comment","cart-items","is-authorized","has-rms-discount","hide-discounts-button","order-id","signal"])]}),_:1},8,["modelValue"])],64)}}}),Kf={},Qf={viewBox:"0 0 24 24"};function Jf(o,s){return l.openBlock(),l.createElementBlock("svg",Qf,[...s[0]||(s[0]=[l.createElementVNode("path",{d:"M18 6L6 18M6 6l12 12"},null,-1)])])}const eh=Ue(Kf,[["render",Jf]]),th={class:"retry_screen"},nh={class:"retry_all_in_screen"},rh={class:"retry_content"},ih={class:"retry_icon_wrap"},oh={class:"retry_icon_circle"},sh={class:"retry_error_x"},ah=l.defineComponent({__name:"RetryPage",setup(o){const s=St(),i=Re.useRouter(),u=Re.useRoute(),f=()=>{s.notificationData_lib.textNotification="",s.is_notification_lib=!1,i.replace(`/${u.params.orgId}/`)};return(h,m)=>(l.openBlock(),l.createElementBlock("section",th,[l.createElementVNode("div",nh,[l.createElementVNode("main",rh,[l.createElementVNode("div",ih,[l.createElementVNode("div",oh,[m[0]||(m[0]=l.createElementVNode("div",{class:"retry_loader_mini"},null,-1)),l.createElementVNode("div",sh,[l.createVNode(eh)])])]),m[1]||(m[1]=l.createElementVNode("div",{class:"retry_oops"},"OOPS",-1)),m[2]||(m[2]=l.createElementVNode("h1",{class:"retry_title"},"Что-то пошло не так",-1)),m[3]||(m[3]=l.createElementVNode("div",{class:"retry_hint"},[l.createElementVNode("p",null,"Похоже, произошёл технический сбой."),l.createElementVNode("p",null,"Мы уже знаем о проблеме и сейчас разбираемся."),l.createElementVNode("p",null,"Приносим извинения за доставленные неудобства."),l.createElementVNode("p",null,"Попробуйте начать новый заказ.")],-1))]),l.createElementVNode("div",{class:"retry_footer"},[l.createElementVNode("button",{onClick:f,class:"retry_new_order_btn"},"Новый заказ")]),m[4]||(m[4]=l.createElementVNode("p",{class:"retry_bottom_note"},"Если ошибка повторяется — обратитесь к сотруднику зала.",-1))])]))}}),lh={class:"wrapper_loader"},ch=l.defineComponent({__name:"Loader",props:{size:{type:String,default:"40px"}},setup(o){return(s,i)=>(l.openBlock(),l.createElementBlock("div",lh,[l.createElementVNode("div",{class:"loader",style:l.normalizeStyle({width:o.size})},null,4)]))}}),uh=Ue(l.defineComponent({__name:"AnimationLoader",props:{id:{}},setup(o){const s=l.ref(!0);return l.watch(()=>s.value,()=>{s.value=!1,setTimeout(()=>{s.value=!0},0)}),(i,u)=>(l.openBlock(),l.createElementBlock("div",{class:"opacity-animation",key:o.id},[l.renderSlot(i.$slots,"opacityLoader",{},void 0,!0)]))}}),[["__scopeId","data-v-c6b97942"]]),dh={key:0},fh={class:"card__main__wrapper"},hh={key:0,class:"folder_content_top"},gh={key:0,class:"loader_card_main"},mh=["src","alt"],ph={class:"card_title_price_wrapper"},xh={class:"title"},wh={key:0,class:"price"},_h={key:1},Ch={key:0,class:"card_button_add_wrapper"},ha=Ue(l.defineComponent({__name:"CardMain",props:{data:{},activeTags:{},is_group:{type:Boolean},parent:{},isLoading:{type:Boolean},selectGroupChild:{type:Function},takeCurrentCard:{type:Function}},setup(o){It();const s=lt(),i=Rt(),{is_18_above_content:u,is18Allowed:f,notificationData_lib:h}=xe.storeToRefs(s),{isDesktop:m}=Nn(),x=o,_=(S,M)=>{var v,U,B;const k={id:S.id,is_fake:S.is_fake||!1,is_od_united_product:S.is_od_united_product||!1,amount:S.amount||1,name:S.name,image_link:S.image_link,price:S.price,old_price:S.price,size:void 0,sizes:[],modifiers:[],groups:S.groups,group_modifiers:[],energy_amount:S.energy_amount??0,proteins_amount:S.proteins_amount??0,fat_amount:S.fat_amount??0,carbohydrates_amount:S.carbohydrates_amount??0},P=!((v=S.modifiers)!=null&&v.length)&&!((U=S.group_modifiers)!=null&&U.length)&&!((B=S.sizes)!=null&&B.length);if(i.isUpSale=!1,S.adult&&!f.value){u.value=!0,P&&(h.value.fastAdd=k);return}if(P){s.addToCart(k);return}if(S.amount||(S.amount=1),x.is_group&&x.selectGroupChild){x.selectGroupChild({...S,parent:x.parent,child:M.child_groups});return}x.takeCurrentCard&&x.takeCurrentCard(M.id)},p=S=>{if(x.is_group&&x.selectGroupChild){S={...S,parent:x.parent,child:S.child_groups},x.selectGroupChild(S);return}if(S.adult&&!f.value){u.value=!0;return}x.takeCurrentCard&&x.takeCurrentCard(S.id)},C=l.computed(()=>x.activeTags.every(S=>x.data.tags.includes(S))),{mediaUrl:y}=Fn(()=>x.data.id+"_image",()=>x.data.image_link);return(S,M)=>{var k;return((k=x.activeTags)==null?void 0:k.length)===0||C.value||x.is_group?(l.openBlock(),l.createElementBlock("div",dh,[l.createVNode(uh,{id:x.data.id},{opacityLoader:l.withCtx(()=>[l.createElementVNode("div",fh,[o.is_group?(l.openBlock(),l.createElementBlock("div",hh)):l.createCommentVNode("",!0),l.createElementVNode("div",{onClick:M[0]||(M[0]=P=>p(x.data)),class:l.normalizeClass(["card__main",{card__main_folder:o.is_group}])},[o.isLoading?(l.openBlock(),l.createElementBlock("div",gh,[l.createVNode(ch)])):(l.openBlock(),l.createElementBlock("div",{key:1,class:l.normalizeClass(["card__main_content",{card_main_desktop_qr:l.unref(m)}])},[l.createElementVNode("img",{src:l.unref(y)||"",class:l.normalizeClass(["img",{card_blur_image:x.data.adult&&!l.unref(f)}]),loading:"lazy",alt:o.data.name},null,10,mh),l.createElementVNode("div",ph,[l.createElementVNode("p",xh,l.toDisplayString(o.data.name),1),o.is_group?l.createCommentVNode("",!0):(l.openBlock(),l.createElementBlock("p",wh,l.toDisplayString(l.unref(dr)(o.data))+" ₽",1))])],2))],2),l.unref(m)?l.createCommentVNode("",!0):(l.openBlock(),l.createElementBlock("div",_h,[o.is_group?l.createCommentVNode("",!0):(l.openBlock(),l.createElementBlock("div",Ch,[l.createElementVNode("div",{onClick:M[1]||(M[1]=P=>_(o.data,x.data)),class:"add_button"},[...M[2]||(M[2]=[l.createElementVNode("div",{class:"image_add_button"},null,-1)])])]))]))])]),_:1},8,["id"])])):l.createCommentVNode("",!0)}}}),[["__scopeId","data-v-bfc53e47"]]),Eh=["id","onClick"],yh=Ue(l.defineComponent({__name:"GroupMain",props:{menuGroup:{},idActiveGroup:{},activeTakeGroup:{type:Function}},setup(o){const{shouldUseDragScroll:s}=Nn(),i=l.ref(null);return(u,f)=>o.menuGroup.length?l.withDirectives((l.openBlock(),l.createElementBlock("ul",{key:0,class:"main__menu",ref_key:"scrollGroup",ref:i},[l.createVNode(oo,{axis:"x",behavior:"smooth",container:i.value,autoScroll:!0,idActive:o.idActiveGroup,clearContainer:!0},{default:l.withCtx(({handleTargetClick:h})=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(o.menuGroup,(m,x)=>(l.openBlock(),l.createElementBlock("li",{key:m.id,id:"scrolling"+m.id,onClick:_=>{o.activeTakeGroup&&o.activeTakeGroup(m.id,x),h(_)},style:l.normalizeStyle(o.idActiveGroup==m.id?{fontFamily:"Bounded"}:{})},l.toDisplayString(m.name),13,Eh))),128))]),_:1},8,["container","idActive"])])),[[l.unref(Vr),l.unref(s)?{}:!1]]):l.createCommentVNode("",!0)}}),[["__scopeId","data-v-aa0ca388"]]),bh=["id","onClick"],Ah=Ue(l.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(o){const s=o,{shouldUseDragScroll:i}=Nn(),u=l.ref(null),f=l.computed(()=>{if(s.isSolo&&!s.groupIndex)return Array.isArray(s.currentActiveTag)?s.currentActiveTag:[];if(s.groupIndex!==null&&s.groupIndex!==void 0){const h=s.currentActiveTag[s.groupIndex];return Array.isArray(h)?h:[]}return[]});return(h,m)=>o.menuTags.length>0?l.withDirectives((l.openBlock(),l.createElementBlock("ul",{key:0,class:"main__filters",ref_key:"scrollTagContainer",ref:u},[l.createVNode(oo,{axis:"x",behavior:"smooth",container:u.value,autoScroll:!0,idActive:f.value?f.value[o.currentActiveTag.length-1]:null,clearContainer:!1},{default:l.withCtx(({handleTargetClick:x})=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(o.menuTags,(_,p)=>(l.openBlock(),l.createElementBlock("li",{key:p,id:`scrolling${_}`,onClick:C=>{o.activeTakeTags&&(o.groupIndex||o.groupIndex===0)?o.activeTakeTags(_,o.groupIndex):o.activeTakeTagsSolo&&o.activeTakeTagsSolo(_),x(C)},class:l.normalizeClass({main__filter_active:(f.value??[]).includes(_)})},l.toDisplayString(_),11,bh))),128))]),_:1},8,["container","idActive"])])),[[l.unref(Vr),l.unref(i)?{}:!1]]):l.createCommentVNode("",!0)}}),[["__scopeId","data-v-afba730a"]]),Ih=["data-id"],Sh=["src"],Nh=["src"],Th=Ue(l.defineComponent({__name:"DrumItem",props:{group:{},index:{},active:{type:Boolean}},setup(o){const s=o,{mediaUrl:i}=Fn(()=>{var u,f;return(u=s.group)!=null&&u.video_link?`${s.group.id}_video`:(f=s.group)!=null&&f.image_link?`${s.group.id}_image`:null});return(u,f)=>o.group?(l.openBlock(),l.createElementBlock("div",{key:0,class:l.normalizeClass(["drum_item",{active:s.active}]),"data-id":o.group.id},[o.group.video_link?l.withDirectives((l.openBlock(),l.createElementBlock("video",{key:l.unref(i),loop:"",autoplay:"",muted:"",playsinline:"",class:"drum_img"},[l.createElementVNode("source",{src:l.unref(i)||"",type:"video/webm"},null,8,Sh)])),[[l.unref(zr)]]):(l.openBlock(),l.createElementBlock("img",{key:1,class:"drum_img",src:l.unref(i)||""},null,8,Nh)),l.createElementVNode("p",null,l.toDisplayString(o.group.name),1)],10,Ih)):l.createCommentVNode("",!0)}}),[["__scopeId","data-v-2b994529"]]),kh={},Rh={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 Oh(o,s){return l.openBlock(),l.createElementBlock("svg",Rh,[...s[0]||(s[0]=[l.createElementVNode("desc",null," Created with Pixso. ",-1),l.createElementVNode("defs",null,null,-1),l.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 Bh=Ue(kh,[["render",Oh]]),Mh={class:"recommendation_wrapper"},vh={class:"recommendation_header"},Dh={class:"recommendation_info"},Ph=Ue(l.defineComponent({__name:"Recommendation",props:{closeCurrentCard:{},openCurrentCard:{}},setup(o){const s=Rt(),{isUpSale:i,dataUpSale:u}=xe.storeToRefs(s),f=()=>{i.value=!1};return l.onUnmounted(()=>{u.value=null}),(h,m)=>(l.openBlock(),l.createElementBlock("div",Mh,[l.createElementVNode("div",vh,[m[0]||(m[0]=l.createElementVNode("p",{class:"header_title"},"Часто берут вместе",-1)),l.createElementVNode("div",{class:"header_close",onClick:f},[l.createVNode(Bh,{class:"close_icon"})])]),l.createElementVNode("div",Dh,[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(u),x=>(l.openBlock(),l.createBlock(ha,{data:x,key:x.id,parent:x.id,is_group:!1,is_product:!0,class:"card",activeTags:[],isLoading:!1,closeCurrentCard:o.closeCurrentCard,takeCurrentCard:()=>o.openCurrentCard(x.id,!0)},null,8,["data","parent","closeCurrentCard","takeCurrentCard"]))),128))])]))}}),[["__scopeId","data-v-d545ec45"]]),Lh=l.defineComponent({__name:"Blackout",props:{data:{type:Boolean}},setup(o){const s=o;return l.watch(()=>s.data,i=>{document.body.style.overflow=i?"hidden":""}),()=>{}}}),Fh={class:"wrapper_modal"},Vh={class:"card_modal"},Uh=Ue(l.defineComponent({__name:"ModalWindows",props:{visible:{type:Boolean}},setup(o){const s=o,i=Rt(),{isUpSale:u}=xe.storeToRefs(i),f=()=>{u.value=!1};return(h,m)=>(l.openBlock(),l.createElementBlock(l.Fragment,null,[l.createVNode(Lh,{data:s.visible},null,8,["data"]),l.createElementVNode("div",{class:"black_modal",onClick:f}),l.createElementVNode("div",Fh,[l.createElementVNode("div",Vh,[l.renderSlot(h.$slots,"default",{},void 0,!0)])])],64))}}),[["__scopeId","data-v-ec2b2c4d"]]);var pe;(function(o){o[o.QR_CODE=0]="QR_CODE",o[o.AZTEC=1]="AZTEC",o[o.CODABAR=2]="CODABAR",o[o.CODE_39=3]="CODE_39",o[o.CODE_93=4]="CODE_93",o[o.CODE_128=5]="CODE_128",o[o.DATA_MATRIX=6]="DATA_MATRIX",o[o.MAXICODE=7]="MAXICODE",o[o.ITF=8]="ITF",o[o.EAN_13=9]="EAN_13",o[o.EAN_8=10]="EAN_8",o[o.PDF_417=11]="PDF_417",o[o.RSS_14=12]="RSS_14",o[o.RSS_EXPANDED=13]="RSS_EXPANDED",o[o.UPC_A=14]="UPC_A",o[o.UPC_E=15]="UPC_E",o[o.UPC_EAN_EXTENSION=16]="UPC_EAN_EXTENSION"})(pe||(pe={}));var ga=new Map([[pe.QR_CODE,"QR_CODE"],[pe.AZTEC,"AZTEC"],[pe.CODABAR,"CODABAR"],[pe.CODE_39,"CODE_39"],[pe.CODE_93,"CODE_93"],[pe.CODE_128,"CODE_128"],[pe.DATA_MATRIX,"DATA_MATRIX"],[pe.MAXICODE,"MAXICODE"],[pe.ITF,"ITF"],[pe.EAN_13,"EAN_13"],[pe.EAN_8,"EAN_8"],[pe.PDF_417,"PDF_417"],[pe.RSS_14,"RSS_14"],[pe.RSS_EXPANDED,"RSS_EXPANDED"],[pe.UPC_A,"UPC_A"],[pe.UPC_E,"UPC_E"],[pe.UPC_EAN_EXTENSION,"UPC_EAN_EXTENSION"]]),ma;(function(o){o[o.UNKNOWN=0]="UNKNOWN",o[o.URL=1]="URL"})(ma||(ma={}));function zh(o){return Object.values(pe).includes(o)}var xi;(function(o){o[o.SCAN_TYPE_CAMERA=0]="SCAN_TYPE_CAMERA",o[o.SCAN_TYPE_FILE=1]="SCAN_TYPE_FILE"})(xi||(xi={}));var Hh=function(){function o(){}return o.GITHUB_PROJECT_URL="https://github.com/mebjas/html5-qrcode",o.SCAN_DEFAULT_FPS=2,o.DEFAULT_DISABLE_FLIP=!1,o.DEFAULT_REMEMBER_LAST_CAMERA_USED=!0,o.DEFAULT_SUPPORTED_SCAN_TYPE=[xi.SCAN_TYPE_CAMERA,xi.SCAN_TYPE_FILE],o}(),pa=function(){function o(s,i){this.format=s,this.formatName=i}return o.prototype.toString=function(){return this.formatName},o.create=function(s){if(!ga.has(s))throw"".concat(s," not in html5QrcodeSupportedFormatsTextMap");return new o(s,ga.get(s))},o}(),xa=function(){function o(){}return o.createFromText=function(s){var i={text:s};return{decodedText:s,result:i}},o.createFromQrcodeResult=function(s){return{decodedText:s.text,result:s}},o}(),xo;(function(o){o[o.UNKWOWN_ERROR=0]="UNKWOWN_ERROR",o[o.IMPLEMENTATION_ERROR=1]="IMPLEMENTATION_ERROR",o[o.NO_CODE_FOUND_ERROR=2]="NO_CODE_FOUND_ERROR"})(xo||(xo={}));var Gh=function(){function o(){}return o.createFrom=function(s){return{errorMessage:s,type:xo.UNKWOWN_ERROR}},o}(),Wh=function(){function o(s){this.verbose=s}return o.prototype.log=function(s){this.verbose&&console.log(s)},o.prototype.warn=function(s){this.verbose&&console.warn(s)},o.prototype.logError=function(s,i){(this.verbose||i===!0)&&console.error(s)},o.prototype.logErrors=function(s){if(s.length===0)throw"Logger#logError called without arguments";this.verbose&&console.error(s)},o}();function Vn(o){return typeof o>"u"||o===null}var wr=function(){function o(){}return o.codeParseError=function(s){return"QR code parse error, error = ".concat(s)},o.errorGettingUserMedia=function(s){return"Error getting userMedia, error = ".concat(s)},o.onlyDeviceSupportedError=function(){return"The device doesn't support navigator.mediaDevices , only supported cameraIdOrConfig in this case is deviceId parameter (string)."},o.cameraStreamingNotSupported=function(){return"Camera streaming not supported by the browser."},o.unableToQuerySupportedDevices=function(){return"Unable to query supported devices, unknown error."},o.insecureContextCameraQueryError=function(){return"Camera access is only supported in secure context like https or localhost."},o.scannerPaused=function(){return"Scanner paused"},o}(),wa=function(){function o(){}return o.isMediaStreamConstraintsValid=function(s,i){if(typeof s!="object"){var u=typeof s;return i.logError("videoConstraints should be of type object, the "+"object passed is of type ".concat(u,"."),!0),!1}for(var f=["autoGainControl","channelCount","echoCancellation","latency","noiseSuppression","sampleRate","sampleSize","volume"],h=new Set(f),m=Object.keys(s),x=0,_=m;x<_.length;x++){var p=_[x];if(h.has(p))return i.logError("".concat(p," is not supported videoConstaints."),!0),!1}return!0},o}(),wo={exports:{}};(function(o,s){(function(i,u){u(s)})(pr,function(i){function u(b){return b==null}var f=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 h(b,e){f(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 x(b,e){e===void 0&&(e=b.constructor);var t=Error.captureStackTrace;t&&t(b,e)}var _=function(b){h(e,b);function e(t){var n=this.constructor,r=b.call(this,t)||this;return Object.defineProperty(r,"name",{value:n.name,enumerable:!1}),m(r,n.prototype),x(r),r}return e}(Error);class p extends _{constructor(e=void 0){super(e),this.message=e}getKind(){return this.constructor.kind}}p.kind="Exception";class C extends p{}C.kind="ArgumentException";class y extends p{}y.kind="IllegalArgumentException";class S{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,r){const a=this.binarizer.getLuminanceSource().crop(e,t,n,r);return new S(this.binarizer.createBinarizer(a))}isRotateSupported(){return this.binarizer.getLuminanceSource().isRotateSupported()}rotateCounterClockwise(){const e=this.binarizer.getLuminanceSource().rotateCounterClockwise();return new S(this.binarizer.createBinarizer(e))}rotateCounterClockwise45(){const e=this.binarizer.getLuminanceSource().rotateCounterClockwise45();return new S(this.binarizer.createBinarizer(e))}toString(){try{return this.getBlackMatrix().toString()}catch{return""}}}class M extends p{static getChecksumInstance(){return new M}}M.kind="ChecksumException";class k{constructor(e){this.source=e}getLuminanceSource(){return this.source}getWidth(){return this.source.getWidth()}getHeight(){return this.source.getHeight()}}class P{static arraycopy(e,t,n,r,a){for(;a--;)n[r++]=e[t++]}static currentTimeMillis(){return Date.now()}}class v extends p{}v.kind="IndexOutOfBoundsException";class U extends v{constructor(e=void 0,t=void 0){super(t),this.index=e,this.message=t}}U.kind="ArrayIndexOutOfBoundsException";class B{static fill(e,t){for(let n=0,r=e.length;n<r;n++)e[n]=t}static fillWithin(e,t,n,r){B.rangeCheck(e.length,t,n);for(let a=t;a<n;a++)e[a]=r}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(a=>Array.from({length:t}).fill(n))}static createInt32Array(e,t,n){return Array.from({length:e}).map(a=>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,r=e.length;n<r;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 r=n-t,a=new Int32Array(r);return P.arraycopy(e,t,a,0,r),a}static binarySearch(e,t,n){n===void 0&&(n=B.numberComparator);let r=0,a=e.length-1;for(;r<=a;){const c=a+r>>1,d=n(t,e[c]);if(d>0)r=c+1;else if(d<0)a=c-1;else return c}return-r-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 D{constructor(e,t){e===void 0?(this.size=0,this.bits=new Int32Array(1)):(this.size=e,t==null?this.bits=D.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=D.makeArray(e);P.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 r=Math.floor(e/32),a=n[r];a&=~((1<<(e&31))-1);const c=n.length;for(;a===0;){if(++r===c)return t;a=n[r]}const d=r*32+R.numberOfTrailingZeros(a);return d>t?t:d}getNextUnset(e){const t=this.size;if(e>=t)return t;const n=this.bits;let r=Math.floor(e/32),a=~n[r];a&=~((1<<(e&31))-1);const c=n.length;for(;a===0;){if(++r===c)return t;a=~n[r]}const d=r*32+R.numberOfTrailingZeros(a);return d>t?t:d}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),r=Math.floor(t/32),a=this.bits;for(let c=n;c<=r;c++){const d=c>n?0:e&31,w=(2<<(c<r?31:t&31))-(1<<d);a[c]|=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 r=Math.floor(e/32),a=Math.floor(t/32),c=this.bits;for(let d=r;d<=a;d++){const g=d>r?0:e&31,E=(2<<(d<a?31:t&31))-(1<<g)&4294967295;if((c[d]&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,r=t.length;n<r;n++)t[n]^=e.bits[n]}toBytes(e,t,n,r){for(let a=0;a<r;a++){let c=0;for(let d=0;d<8;d++)this.get(e)&&(c|=1<<7-d),e++;t[n+a]=c}}getBitArray(){return this.bits}reverse(){const e=new Int32Array(this.bits.length),t=Math.floor((this.size-1)/32),n=t+1,r=this.bits;for(let a=0;a<n;a++){let c=r[a];c=c>>1&1431655765|(c&1431655765)<<1,c=c>>2&858993459|(c&858993459)<<2,c=c>>4&252645135|(c&252645135)<<4,c=c>>8&16711935|(c&16711935)<<8,c=c>>16&65535|(c&65535)<<16,e[t-a]=c}if(this.size!==n*32){const a=n*32-this.size;let c=e[0]>>>a;for(let d=1;d<n;d++){const g=e[d];c|=g<<32-a,e[d-1]=c,c=g>>>a}e[n-1]=c}this.bits=e}static makeArray(e){return new Int32Array(Math.floor((e+31)/32))}equals(e){if(!(e instanceof D))return!1;const t=e;return this.size===t.size&&B.equals(this.bits,t.bits)}hashCode(){return 31*this.size+B.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 D(this.size,this.bits.slice())}}var K;(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"})(K||(K={}));var te=K;class z extends p{static getFormatInstance(){return new z}}z.kind="FormatException";var ie;(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"})(ie||(ie={}));class W{constructor(e,t,n,...r){this.valueIdentifier=e,this.name=n,typeof t=="number"?this.values=Int32Array.from([t]):this.values=t,this.otherEncodingNames=r,W.VALUE_IDENTIFIER_TO_ECI.set(e,this),W.NAME_TO_ECI.set(n,this);const a=this.values;for(let c=0,d=a.length;c!==d;c++){const g=a[c];W.VALUES_TO_ECI.set(g,this)}for(const c of r)W.NAME_TO_ECI.set(c,this)}getValueIdentifier(){return this.valueIdentifier}getName(){return this.name}getValue(){return this.values[0]}static getCharacterSetECIByValue(e){if(e<0||e>=900)throw new z("incorect value");const t=W.VALUES_TO_ECI.get(e);if(t===void 0)throw new z("incorect value");return t}static getCharacterSetECIByName(e){const t=W.NAME_TO_ECI.get(e);if(t===void 0)throw new z("incorect value");return t}equals(e){if(!(e instanceof W))return!1;const t=e;return this.getName()===t.getName()}}W.VALUE_IDENTIFIER_TO_ECI=new Map,W.VALUES_TO_ECI=new Map,W.NAME_TO_ECI=new Map,W.Cp437=new W(ie.Cp437,Int32Array.from([0,2]),"Cp437"),W.ISO8859_1=new W(ie.ISO8859_1,Int32Array.from([1,3]),"ISO-8859-1","ISO88591","ISO8859_1"),W.ISO8859_2=new W(ie.ISO8859_2,4,"ISO-8859-2","ISO88592","ISO8859_2"),W.ISO8859_3=new W(ie.ISO8859_3,5,"ISO-8859-3","ISO88593","ISO8859_3"),W.ISO8859_4=new W(ie.ISO8859_4,6,"ISO-8859-4","ISO88594","ISO8859_4"),W.ISO8859_5=new W(ie.ISO8859_5,7,"ISO-8859-5","ISO88595","ISO8859_5"),W.ISO8859_6=new W(ie.ISO8859_6,8,"ISO-8859-6","ISO88596","ISO8859_6"),W.ISO8859_7=new W(ie.ISO8859_7,9,"ISO-8859-7","ISO88597","ISO8859_7"),W.ISO8859_8=new W(ie.ISO8859_8,10,"ISO-8859-8","ISO88598","ISO8859_8"),W.ISO8859_9=new W(ie.ISO8859_9,11,"ISO-8859-9","ISO88599","ISO8859_9"),W.ISO8859_10=new W(ie.ISO8859_10,12,"ISO-8859-10","ISO885910","ISO8859_10"),W.ISO8859_11=new W(ie.ISO8859_11,13,"ISO-8859-11","ISO885911","ISO8859_11"),W.ISO8859_13=new W(ie.ISO8859_13,15,"ISO-8859-13","ISO885913","ISO8859_13"),W.ISO8859_14=new W(ie.ISO8859_14,16,"ISO-8859-14","ISO885914","ISO8859_14"),W.ISO8859_15=new W(ie.ISO8859_15,17,"ISO-8859-15","ISO885915","ISO8859_15"),W.ISO8859_16=new W(ie.ISO8859_16,18,"ISO-8859-16","ISO885916","ISO8859_16"),W.SJIS=new W(ie.SJIS,20,"SJIS","Shift_JIS"),W.Cp1250=new W(ie.Cp1250,21,"Cp1250","windows-1250"),W.Cp1251=new W(ie.Cp1251,22,"Cp1251","windows-1251"),W.Cp1252=new W(ie.Cp1252,23,"Cp1252","windows-1252"),W.Cp1256=new W(ie.Cp1256,24,"Cp1256","windows-1256"),W.UnicodeBigUnmarked=new W(ie.UnicodeBigUnmarked,25,"UnicodeBigUnmarked","UTF-16BE","UnicodeBig"),W.UTF8=new W(ie.UTF8,26,"UTF8","UTF-8"),W.ASCII=new W(ie.ASCII,Int32Array.from([27,170]),"ASCII","US-ASCII"),W.Big5=new W(ie.Big5,28,"Big5"),W.GB18030=new W(ie.GB18030,29,"GB18030","GB2312","EUC_CN","GBK"),W.EUC_KR=new W(ie.EUC_KR,30,"EUC_KR","EUC-KR");class se extends p{}se.kind="UnsupportedOperationException";class j{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!j.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 W?e:W.getCharacterSetECIByName(e)}static decodeFallback(e,t){const n=this.encodingCharacterSet(t);if(j.isDecodeFallbackSupported(n)){let r="";for(let a=0,c=e.length;a<c;a++){let d=e[a].toString(16);d.length<2&&(d="0"+d),r+="%"+d}return decodeURIComponent(r)}if(n.equals(W.UnicodeBigUnmarked))return String.fromCharCode.apply(null,new Uint16Array(e.buffer));throw new se(`Encoding ${this.encodingName(t)} not supported by fallback.`)}static isDecodeFallbackSupported(e){return e.equals(W.UTF8)||e.equals(W.ISO8859_1)||e.equals(W.ASCII)}static encodeFallback(e){const n=btoa(unescape(encodeURIComponent(e))).split(""),r=[];for(let a=0;a<n.length;a++)r.push(n[a].charCodeAt(0));return new Uint8Array(r)}}class G{static castAsNonUtf8Char(e,t=null){const n=t?t.getName():this.ISO88591;return j.decode(new Uint8Array([e]),n)}static guessEncoding(e,t){if(t!=null&&t.get(te.CHARACTER_SET)!==void 0)return t.get(te.CHARACTER_SET).toString();const n=e.length;let r=!0,a=!0,c=!0,d=0,g=0,w=0,E=0,A=0,I=0,O=0,L=0,F=0,Z=0,ne=0;const ce=e.length>3&&e[0]===239&&e[1]===187&&e[2]===191;for(let ue=0;ue<n&&(r||a||c);ue++){const ae=e[ue]&255;c&&(d>0?ae&128?d--:c=!1:ae&128&&(ae&64?(d++,ae&32?(d++,ae&16?(d++,ae&8?c=!1:E++):w++):g++):c=!1)),r&&(ae>127&&ae<160?r=!1:ae>159&&(ae<192||ae===215||ae===247)&&ne++),a&&(A>0?ae<64||ae===127||ae>252?a=!1:A--:ae===128||ae===160||ae>239?a=!1:ae>160&&ae<224?(I++,L=0,O++,O>F&&(F=O)):ae>127?(A++,O=0,L++,L>Z&&(Z=L)):(O=0,L=0))}return c&&d>0&&(c=!1),a&&A>0&&(a=!1),c&&(ce||g+w+E>0)?G.UTF8:a&&(G.ASSUME_SHIFT_JIS||F>=3||Z>=3)?G.SHIFT_JIS:r&&a?F===2&&I===2||ne*10>=n?G.SHIFT_JIS:G.ISO88591:r?G.ISO88591:a?G.SHIFT_JIS:c?G.UTF8:G.PLATFORM_DEFAULT_ENCODING}static format(e,...t){let n=-1;function r(c,d,g,w,E,A){if(c==="%%")return"%";if(t[++n]===void 0)return;c=w?parseInt(w.substr(1)):void 0;let I=E?parseInt(E.substr(1)):void 0,O;switch(A){case"s":O=t[n];break;case"c":O=t[n][0];break;case"f":O=parseFloat(t[n]).toFixed(c);break;case"p":O=parseFloat(t[n]).toPrecision(c);break;case"e":O=parseFloat(t[n]).toExponential(c);break;case"x":O=parseInt(t[n]).toString(I||16);break;case"d":O=parseFloat(parseInt(t[n],I||10).toPrecision(c)).toFixed(0);break}O=typeof O=="object"?JSON.stringify(O):(+O).toString(I);let L=parseInt(g),F=g&&g[0]+""=="0"?"0":" ";for(;O.length<L;)O=d!==void 0?O+F:F+O;return O}let a=/%(-)?(0?[0-9]+)?([.][0-9]+)?([#][0-9]+)?([scfpexd%])/g;return e.replace(a,r)}static getBytes(e,t){return j.encode(e,t)}static getCharCode(e,t=0){return e.charCodeAt(t)}static getCharAt(e){return String.fromCharCode(e)}}G.SHIFT_JIS=W.SJIS.getName(),G.GB2312="GB2312",G.ISO88591=W.ISO8859_1.getName(),G.EUC_JP="EUC_JP",G.UTF8=W.UTF8.getName(),G.PLATFORM_DEFAULT_ENCODING=G.UTF8,G.ASSUME_SHIFT_JIS=!1;class V{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+=G.castAsNonUtf8Char(e,this.encoding):this.value+=String.fromCharCode(e),this}appendChars(e,t,n){for(let r=t;t<t+n;r++)this.append(e[r]);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 X{constructor(e,t,n,r){if(this.width=e,this.height=t,this.rowSize=n,this.bits=r,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,r==null&&(this.bits=new Int32Array(this.rowSize*this.height))}static parseFromBooleanArray(e){const t=e.length,n=e[0].length,r=new X(n,t);for(let a=0;a<t;a++){const c=e[a];for(let d=0;d<n;d++)c[d]&&r.set(d,a)}return r}static parseFromString(e,t,n){if(e===null)throw new y("stringRepresentation cannot be null");const r=new Array(e.length);let a=0,c=0,d=-1,g=0,w=0;for(;w<e.length;)if(e.charAt(w)===`
|
|
12
|
+
`||e.charAt(w)==="\r"){if(a>c){if(d===-1)d=a-c;else if(a-c!==d)throw new y("row lengths do not match");c=a,g++}w++}else if(e.substring(w,w+t.length)===t)w+=t.length,r[a]=!0,a++;else if(e.substring(w,w+n.length)===n)w+=n.length,r[a]=!1,a++;else throw new y("illegal character encountered: "+e.substring(w));if(a>c){if(d===-1)d=a-c;else if(a-c!==d)throw new y("row lengths do not match");g++}const E=new X(d,g);for(let A=0;A<a;A++)r[A]&&E.set(Math.floor(A%d),Math.floor(A/d));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 D(Math.floor(this.width/32)+1),n=this.rowSize,r=this.bits;for(let a=0,c=this.height;a<c;a++){const d=a*n,g=e.getRow(a,t).getBitArray();for(let w=0;w<n;w++)r[d+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,r){if(t<0||e<0)throw new y("Left and top must be nonnegative");if(r<1||n<1)throw new y("Height and width must be at least 1");const a=e+n,c=t+r;if(c>this.height||a>this.width)throw new y("The region must fit inside the matrix");const d=this.rowSize,g=this.bits;for(let w=t;w<c;w++){const E=w*d;for(let A=e;A<a;A++)g[E+Math.floor(A/32)]|=1<<(A&31)&4294967295}}getRow(e,t){t==null||t.getSize()<this.width?t=new D(this.width):t.clear();const n=this.rowSize,r=this.bits,a=e*n;for(let c=0;c<n;c++)t.setBulk(c*32,r[a+c]);return t}setRow(e,t){P.arraycopy(t.getBitArray(),0,this.bits,e*this.rowSize,this.rowSize)}rotate180(){const e=this.getWidth(),t=this.getHeight();let n=new D(e),r=new D(e);for(let a=0,c=Math.floor((t+1)/2);a<c;a++)n=this.getRow(a,n),r=this.getRow(t-1-a,r),n.reverse(),r.reverse(),this.setRow(a,r),this.setRow(t-1-a,n)}getEnclosingRectangle(){const e=this.width,t=this.height,n=this.rowSize,r=this.bits;let a=e,c=t,d=-1,g=-1;for(let w=0;w<t;w++)for(let E=0;E<n;E++){const A=r[w*n+E];if(A!==0){if(w<c&&(c=w),w>g&&(g=w),E*32<a){let I=0;for(;!(A<<31-I&4294967295);)I++;E*32+I<a&&(a=E*32+I)}if(E*32+31>d){let I=31;for(;!(A>>>I);)I--;E*32+I>d&&(d=E*32+I)}}}return d<a||g<c?null:Int32Array.from([a,c,d-a+1,g-c+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 r=n/e;let a=n%e*32;const c=t[n];let d=0;for(;!(c<<31-d&4294967295);)d++;return a+=d,Int32Array.from([a,r])}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 r=Math.floor(n/e);let a=Math.floor(n%e)*32;const c=t[n];let d=31;for(;!(c>>>d);)d--;return a+=d,Int32Array.from([a,r])}getWidth(){return this.width}getHeight(){return this.height}getRowSize(){return this.rowSize}equals(e){if(!(e instanceof X))return!1;const t=e;return this.width===t.width&&this.height===t.height&&this.rowSize===t.rowSize&&B.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+B.hashCode(this.bits),e}toString(e="X ",t=" ",n=`
|
|
13
|
+
`){return this.buildToString(e,t,n)}buildToString(e,t,n){let r=new V;for(let a=0,c=this.height;a<c;a++){for(let d=0,g=this.width;d<g;d++)r.append(this.get(d,a)?e:t);r.append(n)}return r.toString()}clone(){return new X(this.width,this.height,this.rowSize,this.bits.slice())}}class N extends p{static getNotFoundInstance(){return new N}}N.kind="NotFoundException";class $ extends k{constructor(e){super(e),this.luminances=$.EMPTY,this.buckets=new Int32Array($.LUMINANCE_BUCKETS)}getBlackRow(e,t){const n=this.getLuminanceSource(),r=n.getWidth();t==null||t.getSize()<r?t=new D(r):t.clear(),this.initArrays(r);const a=n.getRow(e,this.luminances),c=this.buckets;for(let g=0;g<r;g++)c[(a[g]&255)>>$.LUMINANCE_SHIFT]++;const d=$.estimateBlackPoint(c);if(r<3)for(let g=0;g<r;g++)(a[g]&255)<d&&t.set(g);else{let g=a[0]&255,w=a[1]&255;for(let E=1;E<r-1;E++){const A=a[E+1]&255;(w*4-g-A)/2<d&&t.set(E),g=w,w=A}}return t}getBlackMatrix(){const e=this.getLuminanceSource(),t=e.getWidth(),n=e.getHeight(),r=new X(t,n);this.initArrays(t);const a=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 I=Math.floor(t/5);I<A;I++){const O=E[I]&255;a[O>>$.LUMINANCE_SHIFT]++}}const c=$.estimateBlackPoint(a),d=e.getMatrix();for(let g=0;g<n;g++){const w=g*t;for(let E=0;E<t;E++)(d[w+E]&255)<c&&r.set(E,g)}return r}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,r=0,a=0;for(let E=0;E<t;E++)e[E]>a&&(r=E,a=e[E]),e[E]>n&&(n=e[E]);let c=0,d=0;for(let E=0;E<t;E++){const A=E-r,I=e[E]*A*A;I>d&&(c=E,d=I)}if(r>c){const E=r;r=c,c=E}if(c-r<=t/16)throw new N;let g=c-1,w=-1;for(let E=c-1;E>r;E--){const A=E-r,I=A*A*(c-E)*(n-e[E]);I>w&&(g=E,w=I)}return g<<$.LUMINANCE_SHIFT}}$.LUMINANCE_BITS=5,$.LUMINANCE_SHIFT=8-$.LUMINANCE_BITS,$.LUMINANCE_BUCKETS=1<<$.LUMINANCE_BITS,$.EMPTY=Uint8ClampedArray.from([0]);class H 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>=H.MINIMUM_DIMENSION&&n>=H.MINIMUM_DIMENSION){const r=e.getMatrix();let a=t>>H.BLOCK_SIZE_POWER;t&H.BLOCK_SIZE_MASK&&a++;let c=n>>H.BLOCK_SIZE_POWER;n&H.BLOCK_SIZE_MASK&&c++;const d=H.calculateBlackPoints(r,a,c,t,n),g=new X(t,n);H.calculateThresholdForBlock(r,a,c,t,n,d,g),this.matrix=g}else this.matrix=super.getBlackMatrix();return this.matrix}createBinarizer(e){return new H(e)}static calculateThresholdForBlock(e,t,n,r,a,c,d){const g=a-H.BLOCK_SIZE,w=r-H.BLOCK_SIZE;for(let E=0;E<n;E++){let A=E<<H.BLOCK_SIZE_POWER;A>g&&(A=g);const I=H.cap(E,2,n-3);for(let O=0;O<t;O++){let L=O<<H.BLOCK_SIZE_POWER;L>w&&(L=w);const F=H.cap(O,2,t-3);let Z=0;for(let ce=-2;ce<=2;ce++){const ue=c[I+ce];Z+=ue[F-2]+ue[F-1]+ue[F]+ue[F+1]+ue[F+2]}const ne=Z/25;H.thresholdBlock(e,L,A,ne,r,d)}}}static cap(e,t,n){return e<t?t:e>n?n:e}static thresholdBlock(e,t,n,r,a,c){for(let d=0,g=n*a+t;d<H.BLOCK_SIZE;d++,g+=a)for(let w=0;w<H.BLOCK_SIZE;w++)(e[g+w]&255)<=r&&c.set(t+w,n+d)}static calculateBlackPoints(e,t,n,r,a){const c=a-H.BLOCK_SIZE,d=r-H.BLOCK_SIZE,g=new Array(n);for(let w=0;w<n;w++){g[w]=new Int32Array(t);let E=w<<H.BLOCK_SIZE_POWER;E>c&&(E=c);for(let A=0;A<t;A++){let I=A<<H.BLOCK_SIZE_POWER;I>d&&(I=d);let O=0,L=255,F=0;for(let ne=0,ce=E*r+I;ne<H.BLOCK_SIZE;ne++,ce+=r){for(let ue=0;ue<H.BLOCK_SIZE;ue++){const ae=e[ce+ue]&255;O+=ae,ae<L&&(L=ae),ae>F&&(F=ae)}if(F-L>H.MIN_DYNAMIC_RANGE)for(ne++,ce+=r;ne<H.BLOCK_SIZE;ne++,ce+=r)for(let ue=0;ue<H.BLOCK_SIZE;ue++)O+=e[ce+ue]&255}let Z=O>>H.BLOCK_SIZE_POWER*2;if(F-L<=H.MIN_DYNAMIC_RANGE&&(Z=L/2,w>0&&A>0)){const ne=(g[w-1][A]+2*g[w][A-1]+g[w-1][A-1])/4;L<ne&&(Z=ne)}g[w][A]=Z}}return g}}H.BLOCK_SIZE_POWER=3,H.BLOCK_SIZE=1<<H.BLOCK_SIZE_POWER,H.BLOCK_SIZE_MASK=H.BLOCK_SIZE-1,H.MINIMUM_DIMENSION=H.BLOCK_SIZE*5,H.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,r){throw new se("This luminance source does not support cropping.")}isRotateSupported(){return!1}rotateCounterClockwise(){throw new se("This luminance source does not support rotation by 90 degrees.")}rotateCounterClockwise45(){throw new se("This luminance source does not support rotation by 45 degrees.")}toString(){const e=new Uint8ClampedArray(this.width);let t=new V;for(let n=0;n<this.height;n++){const r=this.getRow(n,e);for(let a=0;a<this.width;a++){const c=r[a]&255;let d;c<64?d="#":c<128?d="+":c<192?d=".":d=" ",t.append(d)}t.append(`
|
|
14
|
+
`)}return t.toString()}}class q extends J{constructor(e){super(e.getWidth(),e.getHeight()),this.delegate=e}getRow(e,t){const n=this.delegate.getRow(e,t),r=this.getWidth();for(let a=0;a<r;a++)n[a]=255-(n[a]&255);return n}getMatrix(){const e=this.delegate.getMatrix(),t=this.getWidth()*this.getHeight(),n=new Uint8ClampedArray(t);for(let r=0;r<t;r++)n[r]=255-(e[r]&255);return n}isCropSupported(){return this.delegate.isCropSupported()}crop(e,t,n,r){return new q(this.delegate.crop(e,t,n,r))}isRotateSupported(){return this.delegate.isRotateSupported()}invert(){return this.delegate}rotateCounterClockwise(){return new q(this.delegate.rotateCounterClockwise())}rotateCounterClockwise45(){return new q(this.delegate.rotateCounterClockwise45())}}class re extends J{constructor(e){super(e.width,e.height),this.canvas=e,this.tempCanvasElement=null,this.buffer=re.makeBufferFromCanvasImageData(e)}static makeBufferFromCanvasImageData(e){const t=e.getContext("2d").getImageData(0,0,e.width,e.height);return re.toGrayscaleBuffer(t.data,e.width,e.height)}static toGrayscaleBuffer(e,t,n){const r=new Uint8ClampedArray(t*n);for(let a=0,c=0,d=e.length;a<d;a+=4,c++){let g;if(e[a+3]===0)g=255;else{const E=e[a],A=e[a+1],I=e[a+2];g=306*E+601*A+117*I+512>>10}r[c]=g}return r}getRow(e,t){if(e<0||e>=this.getHeight())throw new y("Requested row is outside the image: "+e);const n=this.getWidth(),r=e*n;return t===null?t=this.buffer.slice(r,r+n):(t.length<n&&(t=new Uint8ClampedArray(n)),t.set(this.buffer.slice(r,r+n))),t}getMatrix(){return this.buffer}isCropSupported(){return!0}crop(e,t,n,r){return super.crop(e,t,n,r),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"),r=e*re.DEGREE_TO_RADIANS,a=this.canvas.width,c=this.canvas.height,d=Math.ceil(Math.abs(Math.cos(r))*a+Math.abs(Math.sin(r))*c),g=Math.ceil(Math.abs(Math.sin(r))*a+Math.abs(Math.cos(r))*c);return t.width=d,t.height=g,n.translate(d/2,g/2),n.rotate(r),n.drawImage(this.canvas,a/-2,c/-2),this.buffer=re.makeBufferFromCanvasImageData(t),this}invert(){return new q(this)}}re.DEGREE_TO_RADIANS=Math.PI/180;class ge{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 we=(globalThis||pr||self||window||void 0)&&(globalThis||pr||self||window||void 0).__awaiter||function(b,e,t,n){function r(a){return a instanceof t?a:new t(function(c){c(a)})}return new(t||(t=Promise))(function(a,c){function d(E){try{w(n.next(E))}catch(A){c(A)}}function g(E){try{w(n.throw(E))}catch(A){c(A)}}function w(E){E.done?a(E.value):r(E.value).then(d,g)}w((n=n.apply(b,e||[])).next())})};class Ne{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 we(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 r=n.kind==="video"?"videoinput":n.kind;if(r!=="videoinput")continue;const a=n.deviceId||n.id,c=n.label||`Video device ${t.length+1}`,d=n.groupId,g={deviceId:a,label:c,kind:r,groupId:d};t.push(g)}return t})}getVideoInputDevices(){return we(this,void 0,void 0,function*(){return(yield this.listVideoInputDevices()).map(t=>new ge(t.deviceId,t.label))})}findDeviceById(e){return we(this,void 0,void 0,function*(){const t=yield this.listVideoInputDevices();return t?t.find(n=>n.deviceId===e):null})}decodeFromInputVideoDevice(e,t){return we(this,void 0,void 0,function*(){return yield this.decodeOnceFromVideoDevice(e,t)})}decodeOnceFromVideoDevice(e,t){return we(this,void 0,void 0,function*(){this.reset();let n;e?n={deviceId:{exact:e}}:n={facingMode:"environment"};const r={video:n};return yield this.decodeOnceFromConstraints(r,t)})}decodeOnceFromConstraints(e,t){return we(this,void 0,void 0,function*(){const n=yield navigator.mediaDevices.getUserMedia(e);return yield this.decodeOnceFromStream(n,t)})}decodeOnceFromStream(e,t){return we(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 we(this,void 0,void 0,function*(){return yield this.decodeFromVideoDevice(e,t,n)})}decodeFromVideoDevice(e,t,n){return we(this,void 0,void 0,function*(){let r;e?r={deviceId:{exact:e}}:r={facingMode:"environment"};const a={video:r};return yield this.decodeFromConstraints(a,t,n)})}decodeFromConstraints(e,t,n){return we(this,void 0,void 0,function*(){const r=yield navigator.mediaDevices.getUserMedia(e);return yield this.decodeFromStream(r,t,n)})}decodeFromStream(e,t,n){return we(this,void 0,void 0,function*(){this.reset();const r=yield this.attachStreamToVideo(e,t);return yield this.decodeContinuously(r,n)})}stopAsyncDecode(){this._stopAsyncDecode=!0}stopContinuousDecode(){this._stopContinuousDecode=!0}attachStreamToVideo(e,t){return we(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 we(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(),r=this.decodeFromVideoElementContinuously(n,t);return n.src=e,r}_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 we(this,void 0,void 0,function*(){return yield this.playVideoOnLoadAsync(e),yield this.decodeOnce(e)})}_decodeOnLoadVideoContinuously(e,t){return we(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 r=(a,c)=>{if(this._stopAsyncDecode){c(new N("Video stream has ended before any code could be detected.")),this._stopAsyncDecode=void 0;return}try{const d=this.decode(e);a(d)}catch(d){const g=t&&d instanceof N,E=(d instanceof M||d instanceof z)&&n;if(g||E)return setTimeout(r,this._timeBetweenDecodingAttempts,a,c);c(d)}};return new Promise((a,c)=>r(a,c))}decodeContinuously(e,t){this._stopContinuousDecode=!1;const n=()=>{if(this._stopContinuousDecode){this._stopContinuousDecode=void 0;return}try{const r=this.decode(e);t(r,null),setTimeout(n,this.timeBetweenScansMillis)}catch(r){t(null,r);const a=r instanceof M||r instanceof z,c=r instanceof N;(a||c)&&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 re(t),r=new H(n);return new S(r)}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,r;return typeof e<"u"&&(e instanceof HTMLVideoElement?(n=e.videoWidth,r=e.videoHeight):e instanceof HTMLImageElement&&(n=e.naturalWidth||e.width,r=e.naturalHeight||e.height)),t.style.width=n+"px",t.style.height=r+"px",t.width=n,t.height=r,t}stopStreams(){this.stream&&(this.stream.getVideoTracks().forEach(e=>e.stop()),this.stream=void 0),this._stopAsyncDecode===!1&&this.stopAsyncDecode(),this._stopContinuousDecode===!1&&this.stopContinuousDecode()}reset(){this.stopStreams(),this._destroyVideoElement(),this._destroyImageElement(),this._destroyCaptureCanvas()}_destroyVideoElement(){this.videoElement&&(typeof this.videoEndedListener<"u"&&this.videoElement.removeEventListener("ended",this.videoEndedListener),typeof this.videoPlayingEventListener<"u"&&this.videoElement.removeEventListener("playing",this.videoPlayingEventListener),typeof this.videoCanPlayListener<"u"&&this.videoElement.removeEventListener("loadedmetadata",this.videoCanPlayListener),this.cleanVideoSource(this.videoElement),this.videoElement=void 0)}_destroyImageElement(){this.imageElement&&(this.imageLoadedListener!==void 0&&this.imageElement.removeEventListener("load",this.imageLoadedListener),this.imageElement.src=void 0,this.imageElement.removeAttribute("src"),this.imageElement=void 0)}_destroyCaptureCanvas(){this.captureCanvasContext=void 0,this.captureCanvas=void 0}addVideoSource(e,t){try{e.srcObject=t}catch{e.src=URL.createObjectURL(t)}}cleanVideoSource(e){try{e.srcObject=null}catch{e.src=""}this.videoElement.removeAttribute("src")}}class _e{constructor(e,t,n=t==null?0:8*t.length,r,a,c=P.currentTimeMillis()){this.text=e,this.rawBytes=t,this.numBits=n,this.resultPoints=r,this.format=a,this.timestamp=c,this.text=e,this.rawBytes=t,n==null?this.numBits=t==null?0:8*t.length:this.numBits=n,this.resultPoints=r,this.format=a,this.resultMetadata=null,c==null?this.timestamp=P.currentTimeMillis():this.timestamp=c}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);P.arraycopy(t,0,n,0,t.length),P.arraycopy(e,0,n,t.length,e.length),this.resultPoints=n}}getTimestamp(){return this.timestamp}toString(){return this.text}}var Me;(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"})(Me||(Me={}));var he=Me,dt;(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"})(dt||(dt={}));var Xe=dt;class Oe{constructor(e,t,n,r,a=-1,c=-1){this.rawBytes=e,this.text=t,this.byteSegments=n,this.ecLevel=r,this.structuredAppendSequenceNumber=a,this.structuredAppendParity=c,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 qe{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 me{constructor(e,t){if(t.length===0)throw new y;this.field=e;const n=t.length;if(n>1&&t[0]===0){let r=1;for(;r<n&&t[r]===0;)r++;r===n?this.coefficients=Int32Array.from([0]):(this.coefficients=new Int32Array(n-r),P.arraycopy(t,r,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 c=0,d=t.length;c!==d;c++){const g=t[c];n=qe.addOrSubtract(n,g)}return n}n=t[0];const r=t.length,a=this.field;for(let c=1;c<r;c++)n=qe.addOrSubtract(a.multiply(e,n),t[c]);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 c=t;t=n,n=c}let r=new Int32Array(n.length);const a=n.length-t.length;P.arraycopy(n,0,r,0,a);for(let c=a;c<n.length;c++)r[c]=qe.addOrSubtract(t[c-a],n[c]);return new me(this.field,r)}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,r=e.coefficients,a=r.length,c=new Int32Array(n+a-1),d=this.field;for(let g=0;g<n;g++){const w=t[g];for(let E=0;E<a;E++)c[g+E]=qe.addOrSubtract(c[g+E],d.multiply(w,r[E]))}return new me(d,c)}multiplyScalar(e){if(e===0)return this.field.getZero();if(e===1)return this;const t=this.coefficients.length,n=this.field,r=new Int32Array(t),a=this.coefficients;for(let c=0;c<t;c++)r[c]=n.multiply(a[c],e);return new me(n,r)}multiplyByMonomial(e,t){if(e<0)throw new y;if(t===0)return this.field.getZero();const n=this.coefficients,r=n.length,a=new Int32Array(r+e),c=this.field;for(let d=0;d<r;d++)a[d]=c.multiply(n[d],t);return new me(c,a)}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(),r=this;const a=e.getCoefficient(e.getDegree()),c=t.inverse(a);for(;r.getDegree()>=e.getDegree()&&!r.isZero();){const d=r.getDegree()-e.getDegree(),g=t.multiply(r.getCoefficient(r.getDegree()),c),w=e.multiplyByMonomial(d,g),E=t.buildMonomial(d,g);n=n.addOrSubtract(E),r=r.addOrSubtract(w)}return[n,r]}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 r=this.field.log(n);r===0?e+="1":r===1?e+="a":(e+="a^",e+=r)}t!==0&&(t===1?e+="x":(e+="x^",e+=t))}}return e}}class Ze extends p{}Ze.kind="ArithmeticException";class Ee extends qe{constructor(e,t,n){super(),this.primitive=e,this.size=t,this.generatorBase=n;const r=new Int32Array(t);let a=1;for(let d=0;d<t;d++)r[d]=a,a*=2,a>=t&&(a^=e,a&=t-1);this.expTable=r;const c=new Int32Array(t);for(let d=0;d<t-1;d++)c[r[d]]=d;this.logTable=c,this.zero=new me(this,Int32Array.from([0])),this.one=new me(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 me(this,n)}inverse(e){if(e===0)throw new Ze;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}}Ee.AZTEC_DATA_12=new Ee(4201,4096,1),Ee.AZTEC_DATA_10=new Ee(1033,1024,1),Ee.AZTEC_DATA_6=new Ee(67,64,1),Ee.AZTEC_PARAM=new Ee(19,16,1),Ee.QR_CODE_FIELD_256=new Ee(285,256,0),Ee.DATA_MATRIX_FIELD_256=new Ee(301,256,1),Ee.AZTEC_DATA_8=Ee.DATA_MATRIX_FIELD_256,Ee.MAXICODE_FIELD_64=Ee.AZTEC_DATA_6;class mt extends p{}mt.kind="ReedSolomonException";class nt extends p{}nt.kind="IllegalStateException";class jt{constructor(e){this.field=e}decode(e,t){const n=this.field,r=new me(n,e),a=new Int32Array(t);let c=!0;for(let O=0;O<t;O++){const L=r.evaluateAt(n.exp(O+n.getGeneratorBase()));a[a.length-1-O]=L,L!==0&&(c=!1)}if(c)return;const d=new me(n,a),g=this.runEuclideanAlgorithm(n.buildMonomial(t,1),d,t),w=g[0],E=g[1],A=this.findErrorLocations(w),I=this.findErrorMagnitudes(E,A);for(let O=0;O<A.length;O++){const L=e.length-1-n.log(A[O]);if(L<0)throw new mt("Bad error location");e[L]=Ee.addOrSubtract(e[L],I[O])}}runEuclideanAlgorithm(e,t,n){if(e.getDegree()<t.getDegree()){const O=e;e=t,t=O}const r=this.field;let a=e,c=t,d=r.getZero(),g=r.getOne();for(;c.getDegree()>=(n/2|0);){let O=a,L=d;if(a=c,d=g,a.isZero())throw new mt("r_{i-1} was zero");c=O;let F=r.getZero();const Z=a.getCoefficient(a.getDegree()),ne=r.inverse(Z);for(;c.getDegree()>=a.getDegree()&&!c.isZero();){const ce=c.getDegree()-a.getDegree(),ue=r.multiply(c.getCoefficient(c.getDegree()),ne);F=F.addOrSubtract(r.buildMonomial(ce,ue)),c=c.addOrSubtract(a.multiplyByMonomial(ce,ue))}if(g=F.multiply(d).addOrSubtract(L),c.getDegree()>=a.getDegree())throw new nt("Division algorithm failed to reduce polynomial?")}const w=g.getCoefficient(0);if(w===0)throw new mt("sigmaTilde(0) was zero");const E=r.inverse(w),A=g.multiplyScalar(E),I=c.multiplyScalar(E);return[A,I]}findErrorLocations(e){const t=e.getDegree();if(t===1)return Int32Array.from([e.getCoefficient(1)]);const n=new Int32Array(t);let r=0;const a=this.field;for(let c=1;c<a.getSize()&&r<t;c++)e.evaluateAt(c)===0&&(n[r]=a.inverse(c),r++);if(r!==t)throw new mt("Error locator degree does not match number of roots");return n}findErrorMagnitudes(e,t){const n=t.length,r=new Int32Array(n),a=this.field;for(let c=0;c<n;c++){const d=a.inverse(t[c]);let g=1;for(let w=0;w<n;w++)if(c!==w){const E=a.multiply(t[w],d),A=E&1?E&-2:E|1;g=a.multiply(g,A)}r[c]=a.multiply(e.evaluateAt(d),a.inverse(g)),a.getGeneratorBase()!==0&&(r[c]=a.multiply(r[c],d))}return r}}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 ze{decode(e){this.ddata=e;let t=e.getBits(),n=this.extractBits(t),r=this.correctBits(n),a=ze.convertBoolArrayToByteArray(r),c=ze.getEncodedData(r),d=new Oe(a,c,null,null);return d.setNumBits(r.length),d}static highLevelDecode(e){return this.getEncodedData(e)}static getEncodedData(e){let t=e.length,n=ot.UPPER,r=ot.UPPER,a="",c=0;for(;c<t;)if(r===ot.BINARY){if(t-c<5)break;let d=ze.readCode(e,c,5);if(c+=5,d===0){if(t-c<11)break;d=ze.readCode(e,c,11)+31,c+=11}for(let g=0;g<d;g++){if(t-c<8){c=t;break}const w=ze.readCode(e,c,8);a+=G.castAsNonUtf8Char(w),c+=8}r=n}else{let d=r===ot.DIGIT?4:5;if(t-c<d)break;let g=ze.readCode(e,c,d);c+=d;let w=ze.getCharacter(r,g);w.startsWith("CTRL_")?(n=r,r=ze.getTable(w.charAt(5)),w.charAt(6)==="L"&&(n=r)):(a+=w,r=n)}return a}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 ze.UPPER_TABLE[t];case ot.LOWER:return ze.LOWER_TABLE[t];case ot.MIXED:return ze.MIXED_TABLE[t];case ot.PUNCT:return ze.PUNCT_TABLE[t];case ot.DIGIT:return ze.DIGIT_TABLE[t];default:throw new nt("Bad table")}}correctBits(e){let t,n;this.ddata.getNbLayers()<=2?(n=6,t=Ee.AZTEC_DATA_6):this.ddata.getNbLayers()<=8?(n=8,t=Ee.AZTEC_DATA_8):this.ddata.getNbLayers()<=22?(n=10,t=Ee.AZTEC_DATA_10):(n=12,t=Ee.AZTEC_DATA_12);let r=this.ddata.getNbDatablocks(),a=e.length/n;if(a<r)throw new z;let c=e.length%n,d=new Int32Array(a);for(let I=0;I<a;I++,c+=n)d[I]=ze.readCode(e,c,n);try{new jt(t).decode(d,a-r)}catch(I){throw new z(I)}let g=(1<<n)-1,w=0;for(let I=0;I<r;I++){let O=d[I];if(O===0||O===g)throw new z;(O===1||O===g-1)&&w++}let E=new Array(r*n-w),A=0;for(let I=0;I<r;I++){let O=d[I];if(O===1||O===g-1)E.fill(O>1,A,A+n-1),A+=n-1;else for(let L=n-1;L>=0;--L)E[A++]=(O&1<<L)!==0}return E}extractBits(e){let t=this.ddata.isCompact(),n=this.ddata.getNbLayers(),r=(t?11:14)+n*4,a=new Int32Array(r),c=new Array(this.totalBitsInLayer(n,t));if(t)for(let d=0;d<a.length;d++)a[d]=d;else{let d=r+1+2*R.truncDivision(R.truncDivision(r,2)-1,15),g=r/2,w=R.truncDivision(d,2);for(let E=0;E<g;E++){let A=E+R.truncDivision(E,15);a[g-E-1]=w-A-1,a[g+E]=w+A+1}}for(let d=0,g=0;d<n;d++){let w=(n-d)*4+(t?9:12),E=d*2,A=r-1-E;for(let I=0;I<w;I++){let O=I*2;for(let L=0;L<2;L++)c[g+O+L]=e.get(a[E+L],a[E+I]),c[g+2*w+O+L]=e.get(a[E+I],a[A-L]),c[g+4*w+O+L]=e.get(a[A-L],a[A-I]),c[g+6*w+O+L]=e.get(a[A-I],a[E+L])}g+=w*8}return c}static readCode(e,t,n){let r=0;for(let a=t;a<t+n;a++)r<<=1,e[a]&&(r|=1);return r}static readByte(e,t){let n=e.length-t;return n>=8?ze.readCode(e,t,8):ze.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]=ze.readByte(e,8*n);return t}totalBitsInLayer(e,t){return((t?88:112)+16*e)*e}}ze.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"],ze.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"],ze.MIXED_TABLE=["CTRL_PS"," ","\\1","\\2","\\3","\\4","\\5","\\6","\\7","\b"," ",`
|
|
15
|
+
`,"\\13","\f","\r","\\33","\\34","\\35","\\36","\\37","@","\\","^","_","`","|","~","\\177","CTRL_LL","CTRL_UL","CTRL_PL","CTRL_BS"],ze.PUNCT_TABLE=["","\r",`\r
|
|
16
|
+
`,". ",", ",": ","!",'"',"#","$","%","&","'","(",")","*","+",",","-",".","/",":",";","<","=",">","?","[","]","{","}","CTRL_UL"],ze.DIGIT_TABLE=["CTRL_PS"," ","0","1","2","3","4","5","6","7","8","9",",",".","CTRL_UL","CTRL_US"];class He{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,r){const a=e-n,c=t-r;return Math.sqrt(a*a+c*c)}static sum(e){let t=0;for(let n=0,r=e.length;n!==r;n++){const a=e[n];t+=a}return t}}class Cr{static floatToIntBits(e){return e}}Cr.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*Cr.floatToIntBits(this.x)+Cr.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]),r=this.distance(e[0],e[2]);let a,c,d;if(n>=t&&n>=r?(c=e[0],a=e[1],d=e[2]):r>=n&&r>=t?(c=e[1],a=e[0],d=e[2]):(c=e[2],a=e[0],d=e[1]),this.crossProductZ(a,c,d)<0){const g=a;a=d,d=g}e[0]=a,e[1]=c,e[2]=d}static distance(e,t){return He.distance(e.x,e.y,t.x,t.y)}static crossProductZ(e,t,n){const r=t.x,a=t.y;return(n.x-r)*(e.y-a)-(n.y-a)*(e.x-r)}}class Er{constructor(e,t){this.bits=e,this.points=t}getBits(){return this.bits}getPoints(){return this.points}}class bi extends Er{constructor(e,t,n,r,a){super(e,t),this.compact=n,this.nbDatablocks=r,this.nbLayers=a}getNbLayers(){return this.nbLayers}getNbDatablocks(){return this.nbDatablocks}isCompact(){return this.compact}}class bn{constructor(e,t,n,r){this.image=e,this.height=e.getHeight(),this.width=e.getWidth(),t==null&&(t=bn.INIT_SIZE),n==null&&(n=e.getWidth()/2|0),r==null&&(r=e.getHeight()/2|0);const a=t/2|0;if(this.leftInit=n-a,this.rightInit=n+a,this.upInit=r-a,this.downInit=r+a,this.upInit<0||this.leftInit<0||this.downInit>=this.height||this.rightInit>=this.width)throw new N}detect(){let e=this.leftInit,t=this.rightInit,n=this.upInit,r=this.downInit,a=!1,c=!0,d=!1,g=!1,w=!1,E=!1,A=!1;const I=this.width,O=this.height;for(;c;){c=!1;let L=!0;for(;(L||!g)&&t<I;)L=this.containsBlackPoint(n,r,t,!1),L?(t++,c=!0,g=!0):g||t++;if(t>=I){a=!0;break}let F=!0;for(;(F||!w)&&r<O;)F=this.containsBlackPoint(e,t,r,!0),F?(r++,c=!0,w=!0):w||r++;if(r>=O){a=!0;break}let Z=!0;for(;(Z||!E)&&e>=0;)Z=this.containsBlackPoint(n,r,e,!1),Z?(e--,c=!0,E=!0):E||e--;if(e<0){a=!0;break}let ne=!0;for(;(ne||!A)&&n>=0;)ne=this.containsBlackPoint(e,t,n,!0),ne?(n--,c=!0,A=!0):A||n--;if(n<0){a=!0;break}c&&(d=!0)}if(!a&&d){const L=t-e;let F=null;for(let ue=1;F===null&&ue<L;ue++)F=this.getBlackPointOnSegment(e,r-ue,e+ue,r);if(F==null)throw new N;let Z=null;for(let ue=1;Z===null&&ue<L;ue++)Z=this.getBlackPointOnSegment(e,n+ue,e+ue,n);if(Z==null)throw new N;let ne=null;for(let ue=1;ne===null&&ue<L;ue++)ne=this.getBlackPointOnSegment(t,n+ue,t-ue,n);if(ne==null)throw new N;let ce=null;for(let ue=1;ce===null&&ue<L;ue++)ce=this.getBlackPointOnSegment(t,r-ue,t-ue,r);if(ce==null)throw new N;return this.centerEdges(ce,F,ne,Z)}else throw new N}getBlackPointOnSegment(e,t,n,r){const a=He.round(He.distance(e,t,n,r)),c=(n-e)/a,d=(r-t)/a,g=this.image;for(let w=0;w<a;w++){const E=He.round(e+w*c),A=He.round(t+w*d);if(g.get(E,A))return new ye(E,A)}return null}centerEdges(e,t,n,r){const a=e.getX(),c=e.getY(),d=t.getX(),g=t.getY(),w=n.getX(),E=n.getY(),A=r.getX(),I=r.getY(),O=bn.CORR;return a<this.width/2?[new ye(A-O,I+O),new ye(d+O,g+O),new ye(w-O,E-O),new ye(a+O,c-O)]:[new ye(A+O,I+O),new ye(d+O,g-O),new ye(w-O,E+O),new ye(a-O,c-O)]}containsBlackPoint(e,t,n,r){const a=this.image;if(r){for(let c=e;c<=t;c++)if(a.get(c,n))return!0}else for(let c=e;c<=t;c++)if(a.get(n,c))return!0;return!1}}bn.INIT_SIZE=10,bn.CORR=1;class rr{static checkAndNudgePoints(e,t){const n=e.getWidth(),r=e.getHeight();let a=!0;for(let c=0;c<t.length&&a;c+=2){const d=Math.floor(t[c]),g=Math.floor(t[c+1]);if(d<-1||d>n||g<-1||g>r)throw new N;a=!1,d===-1?(t[c]=0,a=!0):d===n&&(t[c]=n-1,a=!0),g===-1?(t[c+1]=0,a=!0):g===r&&(t[c+1]=r-1,a=!0)}a=!0;for(let c=t.length-2;c>=0&&a;c-=2){const d=Math.floor(t[c]),g=Math.floor(t[c+1]);if(d<-1||d>n||g<-1||g>r)throw new N;a=!1,d===-1?(t[c]=0,a=!0):d===n&&(t[c]=n-1,a=!0),g===-1?(t[c+1]=0,a=!0):g===r&&(t[c+1]=r-1,a=!0)}}}class Dt{constructor(e,t,n,r,a,c,d,g,w){this.a11=e,this.a21=t,this.a31=n,this.a12=r,this.a22=a,this.a32=c,this.a13=d,this.a23=g,this.a33=w}static quadrilateralToQuadrilateral(e,t,n,r,a,c,d,g,w,E,A,I,O,L,F,Z){const ne=Dt.quadrilateralToSquare(e,t,n,r,a,c,d,g);return Dt.squareToQuadrilateral(w,E,A,I,O,L,F,Z).times(ne)}transformPoints(e){const t=e.length,n=this.a11,r=this.a12,a=this.a13,c=this.a21,d=this.a22,g=this.a23,w=this.a31,E=this.a32,A=this.a33;for(let I=0;I<t;I+=2){const O=e[I],L=e[I+1],F=a*O+g*L+A;e[I]=(n*O+c*L+w)/F,e[I+1]=(r*O+d*L+E)/F}}transformPointsWithValues(e,t){const n=this.a11,r=this.a12,a=this.a13,c=this.a21,d=this.a22,g=this.a23,w=this.a31,E=this.a32,A=this.a33,I=e.length;for(let O=0;O<I;O++){const L=e[O],F=t[O],Z=a*L+g*F+A;e[O]=(n*L+c*F+w)/Z,t[O]=(r*L+d*F+E)/Z}}static squareToQuadrilateral(e,t,n,r,a,c,d,g){const w=e-n+a-d,E=t-r+c-g;if(w===0&&E===0)return new Dt(n-e,a-n,e,r-t,c-r,t,0,0,1);{const A=n-a,I=d-a,O=r-c,L=g-c,F=A*L-I*O,Z=(w*L-I*E)/F,ne=(A*E-w*O)/F;return new Dt(n-e+Z*n,d-e+ne*d,e,r-t+Z*r,g-t+ne*g,t,Z,ne,1)}}static quadrilateralToSquare(e,t,n,r,a,c,d,g){return Dt.squareToQuadrilateral(e,t,n,r,a,c,d,g).buildAdjoint()}buildAdjoint(){return new Dt(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 Dt(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 Ai extends rr{sampleGrid(e,t,n,r,a,c,d,g,w,E,A,I,O,L,F,Z,ne,ce,ue){const ae=Dt.quadrilateralToQuadrilateral(r,a,c,d,g,w,E,A,I,O,L,F,Z,ne,ce,ue);return this.sampleGridWithTransform(e,t,n,ae)}sampleGridWithTransform(e,t,n,r){if(t<=0||n<=0)throw new N;const a=new X(t,n),c=new Float32Array(2*t);for(let d=0;d<n;d++){const g=c.length,w=d+.5;for(let E=0;E<g;E+=2)c[E]=E/2+.5,c[E+1]=w;r.transformPoints(c),rr.checkAndNudgePoints(e,c);try{for(let E=0;E<g;E+=2)e.get(Math.floor(c[E]),Math.floor(c[E+1]))&&a.set(E/2,d)}catch{throw new N}}return a}}class dn{static setGridSampler(e){dn.gridSampler=e}static getInstance(){return dn.gridSampler}}dn.gridSampler=new Ai;class Ot{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 be{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 c=n[0];n[0]=n[2],n[2]=c}this.extractParameters(n);let r=this.sampleGrid(this.image,n[this.shift%4],n[(this.shift+1)%4],n[(this.shift+2)%4],n[(this.shift+3)%4]),a=this.getMatrixCornerPoints(n);return new bi(r,a,this.compact,this.nbDataBlocks,this.nbLayers)}extractParameters(e){if(!this.isValidPoint(e[0])||!this.isValidPoint(e[1])||!this.isValidPoint(e[2])||!this.isValidPoint(e[3]))throw new N;let t=2*this.nbCenterLayers,n=new Int32Array([this.sampleLine(e[0],e[1],t),this.sampleLine(e[1],e[2],t),this.sampleLine(e[2],e[3],t),this.sampleLine(e[3],e[0],t)]);this.shift=this.getRotation(n,t);let r=0;for(let c=0;c<4;c++){let d=n[(this.shift+c)%4];this.compact?(r<<=7,r+=d>>1&127):(r<<=10,r+=(d>>2&992)+(d>>1&31))}let a=this.getCorrectedParameterData(r,this.compact);this.compact?(this.nbLayers=(a>>6)+1,this.nbDataBlocks=(a&63)+1):(this.nbLayers=(a>>11)+1,this.nbDataBlocks=(a&2047)+1)}getRotation(e,t){let n=0;e.forEach((r,a,c)=>{let d=(r>>t-2<<1)+(r&1);n=(n<<3)+d}),n=((n&1)<<11)+(n>>1);for(let r=0;r<4;r++)if(R.bitCount(n^this.EXPECTED_CORNER_BITS[r])<=2)return r;throw new N}getCorrectedParameterData(e,t){let n,r;t?(n=7,r=2):(n=10,r=4);let a=n-r,c=new Int32Array(n);for(let g=n-1;g>=0;--g)c[g]=e&15,e>>=4;try{new jt(Ee.AZTEC_PARAM).decode(c,a)}catch{throw new N}let d=0;for(let g=0;g<r;g++)d=(d<<4)+c[g];return d}getBullsEyeCorners(e){let t=e,n=e,r=e,a=e,c=!0;for(this.nbCenterLayers=1;this.nbCenterLayers<9;this.nbCenterLayers++){let A=this.getFirstDifferent(t,c,1,-1),I=this.getFirstDifferent(n,c,1,1),O=this.getFirstDifferent(r,c,-1,1),L=this.getFirstDifferent(a,c,-1,-1);if(this.nbCenterLayers>2){let F=this.distancePoint(L,A)*this.nbCenterLayers/(this.distancePoint(a,t)*(this.nbCenterLayers+2));if(F<.75||F>1.25||!this.isWhiteOrBlackRectangle(A,I,O,L))break}t=A,n=I,r=O,a=L,c=!c}if(this.nbCenterLayers!==5&&this.nbCenterLayers!==7)throw new N;this.compact=this.nbCenterLayers===5;let d=new ye(t.getX()+.5,t.getY()-.5),g=new ye(n.getX()+.5,n.getY()+.5),w=new ye(r.getX()-.5,r.getY()+.5),E=new ye(a.getX()-.5,a.getY()-.5);return this.expandSquare([d,g,w,E],2*this.nbCenterLayers-3,2*this.nbCenterLayers)}getMatrixCenter(){let e,t,n,r;try{let d=new bn(this.image).detect();e=d[0],t=d[1],n=d[2],r=d[3]}catch{let g=this.image.getWidth()/2,w=this.image.getHeight()/2;e=this.getFirstDifferent(new Ot(g+7,w-7),!1,1,-1).toResultPoint(),t=this.getFirstDifferent(new Ot(g+7,w+7),!1,1,1).toResultPoint(),n=this.getFirstDifferent(new Ot(g-7,w+7),!1,-1,1).toResultPoint(),r=this.getFirstDifferent(new Ot(g-7,w-7),!1,-1,-1).toResultPoint()}let a=He.round((e.getX()+r.getX()+t.getX()+n.getX())/4),c=He.round((e.getY()+r.getY()+t.getY()+n.getY())/4);try{let d=new bn(this.image,15,a,c).detect();e=d[0],t=d[1],n=d[2],r=d[3]}catch{e=this.getFirstDifferent(new Ot(a+7,c-7),!1,1,-1).toResultPoint(),t=this.getFirstDifferent(new Ot(a+7,c+7),!1,1,1).toResultPoint(),n=this.getFirstDifferent(new Ot(a-7,c+7),!1,-1,1).toResultPoint(),r=this.getFirstDifferent(new Ot(a-7,c-7),!1,-1,-1).toResultPoint()}return a=He.round((e.getX()+r.getX()+t.getX()+n.getX())/4),c=He.round((e.getY()+r.getY()+t.getY()+n.getY())/4),new Ot(a,c)}getMatrixCornerPoints(e){return this.expandSquare(e,2*this.nbCenterLayers,this.getDimension())}sampleGrid(e,t,n,r,a){let c=dn.getInstance(),d=this.getDimension(),g=d/2-this.nbCenterLayers,w=d/2+this.nbCenterLayers;return c.sampleGrid(e,d,d,g,g,w,g,w,w,g,w,t.getX(),t.getY(),n.getX(),n.getY(),r.getX(),r.getY(),a.getX(),a.getY())}sampleLine(e,t,n){let r=0,a=this.distanceResultPoint(e,t),c=a/n,d=e.getX(),g=e.getY(),w=c*(t.getX()-e.getX())/a,E=c*(t.getY()-e.getY())/a;for(let A=0;A<n;A++)this.image.get(He.round(d+A*w),He.round(g+A*E))&&(r|=1<<n-A-1);return r}isWhiteOrBlackRectangle(e,t,n,r){let a=3;e=new Ot(e.getX()-a,e.getY()+a),t=new Ot(t.getX()-a,t.getY()-a),n=new Ot(n.getX()+a,n.getY()-a),r=new Ot(r.getX()+a,r.getY()+a);let c=this.getColor(r,e);if(c===0)return!1;let d=this.getColor(e,t);return d!==c||(d=this.getColor(t,n),d!==c)?!1:(d=this.getColor(n,r),d===c)}getColor(e,t){let n=this.distancePoint(e,t),r=(t.getX()-e.getX())/n,a=(t.getY()-e.getY())/n,c=0,d=e.getX(),g=e.getY(),w=this.image.get(e.getX(),e.getY()),E=Math.ceil(n);for(let I=0;I<E;I++)d+=r,g+=a,this.image.get(He.round(d),He.round(g))!==w&&c++;let A=c/n;return A>.1&&A<.9?0:A<=.1===w?1:-1}getFirstDifferent(e,t,n,r){let a=e.getX()+n,c=e.getY()+r;for(;this.isValid(a,c)&&this.image.get(a,c)===t;)a+=n,c+=r;for(a-=n,c-=r;this.isValid(a,c)&&this.image.get(a,c)===t;)a+=n;for(a-=n;this.isValid(a,c)&&this.image.get(a,c)===t;)c+=r;return c-=r,new Ot(a,c)}expandSquare(e,t,n){let r=n/(2*t),a=e[0].getX()-e[2].getX(),c=e[0].getY()-e[2].getY(),d=(e[0].getX()+e[2].getX())/2,g=(e[0].getY()+e[2].getY())/2,w=new ye(d+r*a,g+r*c),E=new ye(d-r*a,g-r*c);a=e[1].getX()-e[3].getX(),c=e[1].getY()-e[3].getY(),d=(e[1].getX()+e[3].getX())/2,g=(e[1].getY()+e[3].getY())/2;let A=new ye(d+r*a,g+r*c),I=new ye(d-r*a,g-r*c);return[w,A,E,I]}isValid(e,t){return e>=0&&e<this.image.getWidth()&&t>0&&t<this.image.getHeight()}isValidPoint(e){let t=He.round(e.getX()),n=He.round(e.getY());return this.isValid(t,n)}distancePoint(e,t){return He.distance(e.getX(),e.getY(),t.getX(),t.getY())}distanceResultPoint(e,t){return He.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 le{decode(e,t=null){let n=null,r=new be(e.getBlackMatrix()),a=null,c=null;try{let E=r.detectMirror(!1);a=E.getPoints(),this.reportFoundResultPoints(t,a),c=new ze().decode(E)}catch(E){n=E}if(c==null)try{let E=r.detectMirror(!0);a=E.getPoints(),this.reportFoundResultPoints(t,a),c=new ze().decode(E)}catch(E){throw n??E}let d=new _e(c.getText(),c.getRawBytes(),c.getNumBits(),a,he.AZTEC,P.currentTimeMillis()),g=c.getByteSegments();g!=null&&d.putMetadata(Xe.BYTE_SEGMENTS,g);let w=c.getECLevel();return w!=null&&d.putMetadata(Xe.ERROR_CORRECTION_LEVEL,w),d}reportFoundResultPoints(e,t){if(e!=null){let n=e.get(te.NEED_RESULT_POINT_CALLBACK);n!=null&&t.forEach((r,a,c)=>{n.foundPossibleResultPoint(r)})}}reset(){}}class Qe extends Ne{constructor(e=500){super(new le,e)}}class Ke{decode(e,t){try{return this.doDecode(e,t)}catch{if(t&&t.get(te.TRY_HARDER)===!0&&e.isRotateSupported()){const a=e.rotateCounterClockwise(),c=this.doDecode(a,t),d=c.getResultMetadata();let g=270;d!==null&&d.get(Xe.ORIENTATION)===!0&&(g=g+d.get(Xe.ORIENTATION)%360),c.putMetadata(Xe.ORIENTATION,g);const w=c.getResultPoints();if(w!==null){const E=a.getHeight();for(let A=0;A<w.length;A++)w[A]=new ye(E-w[A].getY()-1,w[A].getX())}return c}else throw new N}}reset(){}doDecode(e,t){const n=e.getWidth(),r=e.getHeight();let a=new D(n);const c=t&&t.get(te.TRY_HARDER)===!0,d=Math.max(1,r>>(c?8:5));let g;c?g=r:g=15;const w=Math.trunc(r/2);for(let E=0;E<g;E++){const A=Math.trunc((E+1)/2),I=(E&1)===0,O=w+d*(I?A:-A);if(O<0||O>=r)break;try{a=e.getBlackRow(O,a)}catch{continue}for(let L=0;L<2;L++){if(L===1&&(a.reverse(),t&&t.get(te.NEED_RESULT_POINT_CALLBACK)===!0)){const F=new Map;t.forEach((Z,ne)=>F.set(ne,Z)),F.delete(te.NEED_RESULT_POINT_CALLBACK),t=F}try{const F=this.decodeRow(O,a,t);if(L===1){F.putMetadata(Xe.ORIENTATION,180);const Z=F.getResultPoints();Z!==null&&(Z[0]=new ye(n-Z[0].getX()-1,Z[0].getY()),Z[1]=new ye(n-Z[1].getX()-1,Z[1].getY()))}return F}catch{}}}throw new N}static recordPattern(e,t,n){const r=n.length;for(let w=0;w<r;w++)n[w]=0;const a=e.getSize();if(t>=a)throw new N;let c=!e.get(t),d=0,g=t;for(;g<a;){if(e.get(g)!==c)n[d]++;else{if(++d===r)break;n[d]=1,c=!c}g++}if(!(d===r||d===r-1&&g===a))throw new N}static recordPatternInReverse(e,t,n){let r=n.length,a=e.get(t);for(;t>0&&r>=0;)e.get(--t)!==a&&(r--,a=!a);if(r>=0)throw new N;Ke.recordPattern(e,t+1,n)}static patternMatchVariance(e,t,n){const r=e.length;let a=0,c=0;for(let w=0;w<r;w++)a+=e[w],c+=t[w];if(a<c)return Number.POSITIVE_INFINITY;const d=a/c;n*=d;let g=0;for(let w=0;w<r;w++){const E=e[w],A=t[w]*d,I=E>A?E-A:A-E;if(I>n)return Number.POSITIVE_INFINITY;g+=I}return g/a}}class de extends Ke{static findStartPattern(e){const t=e.getSize(),n=e.getNextSet(0);let r=0,a=Int32Array.from([0,0,0,0,0,0]),c=n,d=!1;const g=6;for(let w=n;w<t;w++)if(e.get(w)!==d)a[r]++;else{if(r===g-1){let E=de.MAX_AVG_VARIANCE,A=-1;for(let I=de.CODE_START_A;I<=de.CODE_START_C;I++){const O=Ke.patternMatchVariance(a,de.CODE_PATTERNS[I],de.MAX_INDIVIDUAL_VARIANCE);O<E&&(E=O,A=I)}if(A>=0&&e.isRange(Math.max(0,c-(w-c)/2),c,!1))return Int32Array.from([c,w,A]);c+=a[0]+a[1],a=a.slice(2,a.length-1),a[r-1]=0,a[r]=0,r--}else r++;a[r]=1,d=!d}throw new N}static decodeCode(e,t,n){Ke.recordPattern(e,n,t);let r=de.MAX_AVG_VARIANCE,a=-1;for(let c=0;c<de.CODE_PATTERNS.length;c++){const d=de.CODE_PATTERNS[c],g=this.patternMatchVariance(t,d,de.MAX_INDIVIDUAL_VARIANCE);g<r&&(r=g,a=c)}if(a>=0)return a;throw new N}decodeRow(e,t,n){const r=n&&n.get(te.ASSUME_GS1)===!0,a=de.findStartPattern(t),c=a[2];let d=0;const g=new Uint8Array(20);g[d++]=c;let w;switch(c){case de.CODE_START_A:w=de.CODE_CODE_A;break;case de.CODE_START_B:w=de.CODE_CODE_B;break;case de.CODE_START_C:w=de.CODE_CODE_C;break;default:throw new z}let E=!1,A=!1,I="",O=a[0],L=a[1];const F=Int32Array.from([0,0,0,0,0,0]);let Z=0,ne=0,ce=c,ue=0,ae=!0,Ge=!1,ve=!1;for(;!E;){const kr=A;switch(A=!1,Z=ne,ne=de.decodeCode(t,F,L),g[d++]=ne,ne!==de.CODE_STOP&&(ae=!0),ne!==de.CODE_STOP&&(ue++,ce+=ue*ne),O=L,L+=F.reduce((vg,Dg)=>vg+Dg,0),ne){case de.CODE_START_A:case de.CODE_START_B:case de.CODE_START_C:throw new z}switch(w){case de.CODE_CODE_A:if(ne<64)ve===Ge?I+=String.fromCharCode(32+ne):I+=String.fromCharCode(32+ne+128),ve=!1;else if(ne<96)ve===Ge?I+=String.fromCharCode(ne-64):I+=String.fromCharCode(ne+64),ve=!1;else switch(ne!==de.CODE_STOP&&(ae=!1),ne){case de.CODE_FNC_1:r&&(I.length===0?I+="]C1":I+="");break;case de.CODE_FNC_2:case de.CODE_FNC_3:break;case de.CODE_FNC_4_A:!Ge&&ve?(Ge=!0,ve=!1):Ge&&ve?(Ge=!1,ve=!1):ve=!0;break;case de.CODE_SHIFT:A=!0,w=de.CODE_CODE_B;break;case de.CODE_CODE_B:w=de.CODE_CODE_B;break;case de.CODE_CODE_C:w=de.CODE_CODE_C;break;case de.CODE_STOP:E=!0;break}break;case de.CODE_CODE_B:if(ne<96)ve===Ge?I+=String.fromCharCode(32+ne):I+=String.fromCharCode(32+ne+128),ve=!1;else switch(ne!==de.CODE_STOP&&(ae=!1),ne){case de.CODE_FNC_1:r&&(I.length===0?I+="]C1":I+="");break;case de.CODE_FNC_2:case de.CODE_FNC_3:break;case de.CODE_FNC_4_B:!Ge&&ve?(Ge=!0,ve=!1):Ge&&ve?(Ge=!1,ve=!1):ve=!0;break;case de.CODE_SHIFT:A=!0,w=de.CODE_CODE_A;break;case de.CODE_CODE_A:w=de.CODE_CODE_A;break;case de.CODE_CODE_C:w=de.CODE_CODE_C;break;case de.CODE_STOP:E=!0;break}break;case de.CODE_CODE_C:if(ne<100)ne<10&&(I+="0"),I+=ne;else switch(ne!==de.CODE_STOP&&(ae=!1),ne){case de.CODE_FNC_1:r&&(I.length===0?I+="]C1":I+="");break;case de.CODE_CODE_A:w=de.CODE_CODE_A;break;case de.CODE_CODE_B:w=de.CODE_CODE_B;break;case de.CODE_STOP:E=!0;break}break}kr&&(w=w===de.CODE_CODE_A?de.CODE_CODE_B:de.CODE_CODE_A)}const nn=L-O;if(L=t.getNextUnset(L),!t.isRange(L,Math.min(t.getSize(),L+(L-O)/2),!1))throw new N;if(ce-=ue*Z,ce%103!==Z)throw new M;const An=I.length;if(An===0)throw new N;An>0&&ae&&(w===de.CODE_CODE_C?I=I.substring(0,An-2):I=I.substring(0,An-1));const rn=(a[1]+a[0])/2,at=O+nn/2,Ut=g.length,ln=new Uint8Array(Ut);for(let kr=0;kr<Ut;kr++)ln[kr]=g[kr];const Tr=[new ye(rn,e),new ye(at,e)];return new _e(I,ln,0,Tr,he.CODE_128,new Date().getTime())}}de.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])],de.MAX_AVG_VARIANCE=.25,de.MAX_INDIVIDUAL_VARIANCE=.7,de.CODE_SHIFT=98,de.CODE_CODE_C=99,de.CODE_CODE_B=100,de.CODE_CODE_A=101,de.CODE_FNC_1=102,de.CODE_FNC_2=97,de.CODE_FNC_3=96,de.CODE_FNC_4_A=101,de.CODE_FNC_4_B=100,de.CODE_START_A=103,de.CODE_START_B=104,de.CODE_START_C=105,de.CODE_STOP=106;class ft extends Ke{constructor(e=!1,t=!1){super(),this.usingCheckDigit=e,this.extendedMode=t,this.decodeRowResult="",this.counters=new Int32Array(9)}decodeRow(e,t,n){let r=this.counters;r.fill(0),this.decodeRowResult="";let a=ft.findAsteriskPattern(t,r),c=t.getNextSet(a[1]),d=t.getSize(),g,w;do{ft.recordPattern(t,c,r);let F=ft.toNarrowWidePattern(r);if(F<0)throw new N;g=ft.patternToChar(F),this.decodeRowResult+=g,w=c;for(let Z of r)c+=Z;c=t.getNextSet(c)}while(g!=="*");this.decodeRowResult=this.decodeRowResult.substring(0,this.decodeRowResult.length-1);let E=0;for(let F of r)E+=F;let A=c-w-E;if(c!==d&&A*2<E)throw new N;if(this.usingCheckDigit){let F=this.decodeRowResult.length-1,Z=0;for(let ne=0;ne<F;ne++)Z+=ft.ALPHABET_STRING.indexOf(this.decodeRowResult.charAt(ne));if(this.decodeRowResult.charAt(F)!==ft.ALPHABET_STRING.charAt(Z%43))throw new M;this.decodeRowResult=this.decodeRowResult.substring(0,F)}if(this.decodeRowResult.length===0)throw new N;let I;this.extendedMode?I=ft.decodeExtended(this.decodeRowResult):I=this.decodeRowResult;let O=(a[1]+a[0])/2,L=w+E/2;return new _e(I,null,0,[new ye(O,e),new ye(L,e)],he.CODE_39,new Date().getTime())}static findAsteriskPattern(e,t){let n=e.getSize(),r=e.getNextSet(0),a=0,c=r,d=!1,g=t.length;for(let w=r;w<n;w++)if(e.get(w)!==d)t[a]++;else{if(a===g-1){if(this.toNarrowWidePattern(t)===ft.ASTERISK_ENCODING&&e.isRange(Math.max(0,c-Math.floor((w-c)/2)),c,!1))return[c,w];c+=t[0]+t[1],t.copyWithin(0,2,2+a-1),t[a-1]=0,t[a]=0,a--}else a++;t[a]=1,d=!d}throw new N}static toNarrowWidePattern(e){let t=e.length,n=0,r;do{let a=2147483647;for(let g of e)g<a&&g>n&&(a=g);n=a,r=0;let c=0,d=0;for(let g=0;g<t;g++){let w=e[g];w>n&&(d|=1<<t-1-g,r++,c+=w)}if(r===3){for(let g=0;g<t&&r>0;g++){let w=e[g];if(w>n&&(r--,w*2>=c))return-1}return d}}while(r>3);return-1}static patternToChar(e){for(let t=0;t<ft.CHARACTER_ENCODINGS.length;t++)if(ft.CHARACTER_ENCODINGS[t]===e)return ft.ALPHABET_STRING.charAt(t);if(e===ft.ASTERISK_ENCODING)return"*";throw new N}static decodeExtended(e){let t=e.length,n="";for(let r=0;r<t;r++){let a=e.charAt(r);if(a==="+"||a==="$"||a==="%"||a==="/"){let c=e.charAt(r+1),d="\0";switch(a){case"+":if(c>="A"&&c<="Z")d=String.fromCharCode(c.charCodeAt(0)+32);else throw new z;break;case"$":if(c>="A"&&c<="Z")d=String.fromCharCode(c.charCodeAt(0)-64);else throw new z;break;case"%":if(c>="A"&&c<="E")d=String.fromCharCode(c.charCodeAt(0)-38);else if(c>="F"&&c<="J")d=String.fromCharCode(c.charCodeAt(0)-11);else if(c>="K"&&c<="O")d=String.fromCharCode(c.charCodeAt(0)+16);else if(c>="P"&&c<="T")d=String.fromCharCode(c.charCodeAt(0)+43);else if(c==="U")d="\0";else if(c==="V")d="@";else if(c==="W")d="`";else if(c==="X"||c==="Y"||c==="Z")d="";else throw new z;break;case"/":if(c>="A"&&c<="O")d=String.fromCharCode(c.charCodeAt(0)-32);else if(c==="Z")d=":";else throw new z;break}n+=d,r++}else n+=a}return n}}ft.ALPHABET_STRING="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%",ft.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],ft.ASTERISK_ENCODING=148;class Ye extends Ke{constructor(){super(...arguments),this.narrowLineWidth=-1}decodeRow(e,t,n){let r=this.decodeStart(t),a=this.decodeEnd(t),c=new V;Ye.decodeMiddle(t,r[1],a[0],c);let d=c.toString(),g=null;n!=null&&(g=n.get(te.ALLOWED_LENGTHS)),g==null&&(g=Ye.DEFAULT_ALLOWED_LENGTHS);let w=d.length,E=!1,A=0;for(let L of g){if(w===L){E=!0;break}L>A&&(A=L)}if(!E&&w>A&&(E=!0),!E)throw new z;const I=[new ye(r[1],e),new ye(a[0],e)];return new _e(d,null,0,I,he.ITF,new Date().getTime())}static decodeMiddle(e,t,n,r){let a=new Int32Array(10),c=new Int32Array(5),d=new Int32Array(5);for(a.fill(0),c.fill(0),d.fill(0);t<n;){Ke.recordPattern(e,t,a);for(let w=0;w<5;w++){let E=2*w;c[w]=a[E],d[w]=a[E+1]}let g=Ye.decodeDigit(c);r.append(g.toString()),g=this.decodeDigit(d),r.append(g.toString()),a.forEach(function(w){t+=w})}}decodeStart(e){let t=Ye.skipWhiteSpace(e),n=Ye.findGuardPattern(e,t,Ye.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 r=t-1;n>0&&r>=0&&!e.get(r);r--)n--;if(n!==0)throw new N}static skipWhiteSpace(e){const t=e.getSize(),n=e.getNextSet(0);if(n===t)throw new N;return n}decodeEnd(e){e.reverse();try{let t=Ye.skipWhiteSpace(e),n;try{n=Ye.findGuardPattern(e,t,Ye.END_PATTERN_REVERSED[0])}catch(a){a instanceof N&&(n=Ye.findGuardPattern(e,t,Ye.END_PATTERN_REVERSED[1]))}this.validateQuietZone(e,n[0]);let r=n[0];return n[0]=e.getSize()-n[1],n[1]=e.getSize()-r,n}finally{e.reverse()}}static findGuardPattern(e,t,n){let r=n.length,a=new Int32Array(r),c=e.getSize(),d=!1,g=0,w=t;a.fill(0);for(let E=t;E<c;E++)if(e.get(E)!==d)a[g]++;else{if(g===r-1){if(Ke.patternMatchVariance(a,n,Ye.MAX_INDIVIDUAL_VARIANCE)<Ye.MAX_AVG_VARIANCE)return[w,E];w+=a[0]+a[1],P.arraycopy(a,2,a,0,g-1),a[g-1]=0,a[g]=0,g--}else g++;a[g]=1,d=!d}throw new N}static decodeDigit(e){let t=Ye.MAX_AVG_VARIANCE,n=-1,r=Ye.PATTERNS.length;for(let a=0;a<r;a++){let c=Ye.PATTERNS[a],d=Ke.patternMatchVariance(e,c,Ye.MAX_INDIVIDUAL_VARIANCE);d<t?(t=d,n=a):d===t&&(n=-1)}if(n>=0)return n%10;throw new N}}Ye.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])],Ye.MAX_AVG_VARIANCE=.38,Ye.MAX_INDIVIDUAL_VARIANCE=.5,Ye.DEFAULT_ALLOWED_LENGTHS=[6,8,10,12,14],Ye.START_PATTERN=Int32Array.from([1,1,1,1]),Ye.END_PATTERN_REVERSED=[Int32Array.from([1,1,2]),Int32Array.from([1,1,3])];class rt extends Ke{constructor(){super(...arguments),this.decodeRowStringBuffer=""}static findStartGuardPattern(e){let t=!1,n,r=0,a=Int32Array.from([0,0,0]);for(;!t;){a=Int32Array.from([0,0,0]),n=rt.findGuardPattern(e,r,!1,this.START_END_PATTERN,a);let c=n[0];r=n[1];let d=c-(r-c);d>=0&&(t=e.isRange(d,c,!1))}return n}static checkChecksum(e){return rt.checkStandardUPCEANChecksum(e)}static checkStandardUPCEANChecksum(e){let t=e.length;if(t===0)return!1;let n=parseInt(e.charAt(t-1),10);return rt.getStandardUPCEANChecksum(e.substring(0,t-1))===n}static getStandardUPCEANChecksum(e){let t=e.length,n=0;for(let r=t-1;r>=0;r-=2){let a=e.charAt(r).charCodeAt(0)-48;if(a<0||a>9)throw new z;n+=a}n*=3;for(let r=t-2;r>=0;r-=2){let a=e.charAt(r).charCodeAt(0)-48;if(a<0||a>9)throw new z;n+=a}return(1e3-n)%10}static decodeEnd(e,t){return rt.findGuardPattern(e,t,!1,rt.START_END_PATTERN,new Int32Array(rt.START_END_PATTERN.length).fill(0))}static findGuardPatternWithoutCounters(e,t,n,r){return this.findGuardPattern(e,t,n,r,new Int32Array(r.length))}static findGuardPattern(e,t,n,r,a){let c=e.getSize();t=n?e.getNextUnset(t):e.getNextSet(t);let d=0,g=t,w=r.length,E=n;for(let A=t;A<c;A++)if(e.get(A)!==E)a[d]++;else{if(d===w-1){if(Ke.patternMatchVariance(a,r,rt.MAX_INDIVIDUAL_VARIANCE)<rt.MAX_AVG_VARIANCE)return Int32Array.from([g,A]);g+=a[0]+a[1];let I=a.slice(2,a.length-1);for(let O=0;O<d-1;O++)a[O]=I[O];a[d-1]=0,a[d]=0,d--}else d++;a[d]=1,E=!E}throw new N}static decodeDigit(e,t,n,r){this.recordPattern(e,n,t);let a=this.MAX_AVG_VARIANCE,c=-1,d=r.length;for(let g=0;g<d;g++){let w=r[g],E=Ke.patternMatchVariance(t,w,rt.MAX_INDIVIDUAL_VARIANCE);E<a&&(a=E,c=g)}if(c>=0)return c;throw new N}}rt.MAX_AVG_VARIANCE=.48,rt.MAX_INDIVIDUAL_VARIANCE=.7,rt.START_END_PATTERN=Int32Array.from([1,1,1]),rt.MIDDLE_PATTERN=Int32Array.from([1,1,1,1,1]),rt.END_PATTERN=Int32Array.from([1,1,1,1,1,1]),rt.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 Ve{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 r=this.decodeRowStringBuffer,a=this.decodeMiddle(t,n,r),c=r.toString(),d=Ve.parseExtensionString(c),g=[new ye((n[0]+n[1])/2,e),new ye(a,e)],w=new _e(c,null,0,g,he.UPC_EAN_EXTENSION,new Date().getTime());return d!=null&&w.putAllMetadata(d),w}decodeMiddle(e,t,n){let r=this.decodeMiddleCounters;r[0]=0,r[1]=0,r[2]=0,r[3]=0;let a=e.getSize(),c=t[1],d=0;for(let w=0;w<5&&c<a;w++){let E=rt.decodeDigit(e,r,c,rt.L_AND_G_PATTERNS);n+=String.fromCharCode(48+E%10);for(let A of r)c+=A;E>=10&&(d|=1<<4-w),w!==4&&(c=e.getNextSet(c),c=e.getNextUnset(c))}if(n.length!==5)throw new N;let g=this.determineCheckDigit(d);if(Ve.extensionChecksum(n.toString())!==g)throw new N;return c}static extensionChecksum(e){let t=e.length,n=0;for(let r=t-2;r>=0;r-=2)n+=e.charAt(r).charCodeAt(0)-48;n*=3;for(let r=t-1;r>=0;r-=2)n+=e.charAt(r).charCodeAt(0)-48;return n*=3,n%10}determineCheckDigit(e){for(let t=0;t<10;t++)if(e===this.CHECK_DIGIT_ENCODINGS[t])return t;throw new N}static parseExtensionString(e){if(e.length!==5)return null;let t=Ve.parseExtension5String(e);return t==null?null:new Map([[Xe.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)),r=(n/100).toString(),a=n%100,c=a<10?"0"+a:a.toString();return t+r+"."+c}}class qt{constructor(){this.decodeMiddleCounters=Int32Array.from([0,0,0,0]),this.decodeRowStringBuffer=""}decodeRow(e,t,n){let r=this.decodeRowStringBuffer,a=this.decodeMiddle(t,n,r),c=r.toString(),d=qt.parseExtensionString(c),g=[new ye((n[0]+n[1])/2,e),new ye(a,e)],w=new _e(c,null,0,g,he.UPC_EAN_EXTENSION,new Date().getTime());return d!=null&&w.putAllMetadata(d),w}decodeMiddle(e,t,n){let r=this.decodeMiddleCounters;r[0]=0,r[1]=0,r[2]=0,r[3]=0;let a=e.getSize(),c=t[1],d=0;for(let g=0;g<2&&c<a;g++){let w=rt.decodeDigit(e,r,c,rt.L_AND_G_PATTERNS);n+=String.fromCharCode(48+w%10);for(let E of r)c+=E;w>=10&&(d|=1<<1-g),g!==1&&(c=e.getNextSet(c),c=e.getNextUnset(c))}if(n.length!==2)throw new N;if(parseInt(n.toString())%4!==d)throw new N;return c}static parseExtensionString(e){return e.length!==2?null:new Map([[Xe.ISSUE_NUMBER,parseInt(e)]])}}class Nt{static decodeRow(e,t,n){let r=rt.findGuardPattern(t,n,!1,this.EXTENSION_START_PATTERN,new Int32Array(this.EXTENSION_START_PATTERN.length).fill(0));try{return new Ve().decodeRow(e,t,r)}catch{return new qt().decodeRow(e,t,r)}}}Nt.EXTENSION_START_PATTERN=Int32Array.from([1,1,2]);class De extends rt{constructor(){super(),this.decodeRowStringBuffer="",De.L_AND_G_PATTERNS=De.L_PATTERNS.map(e=>Int32Array.from(e));for(let e=10;e<20;e++){let t=De.L_PATTERNS[e-10],n=new Int32Array(t.length);for(let r=0;r<t.length;r++)n[r]=t[t.length-r-1];De.L_AND_G_PATTERNS[e]=n}}decodeRow(e,t,n){let r=De.findStartGuardPattern(t),a=n==null?null:n.get(te.NEED_RESULT_POINT_CALLBACK);if(a!=null){const ae=new ye((r[0]+r[1])/2,e);a.foundPossibleResultPoint(ae)}let c=this.decodeMiddle(t,r,this.decodeRowStringBuffer),d=c.rowOffset,g=c.resultString;if(a!=null){const ae=new ye(d,e);a.foundPossibleResultPoint(ae)}let w=this.decodeEnd(t,d);if(a!=null){const ae=new ye((w[0]+w[1])/2,e);a.foundPossibleResultPoint(ae)}let E=w[1],A=E+(E-w[0]);if(A>=t.getSize()||!t.isRange(E,A,!1))throw new N;let I=g.toString();if(I.length<8)throw new z;if(!De.checkChecksum(I))throw new M;let O=(r[1]+r[0])/2,L=(w[1]+w[0])/2,F=this.getBarcodeFormat(),Z=[new ye(O,e),new ye(L,e)],ne=new _e(I,null,0,Z,F,new Date().getTime()),ce=0;try{let ae=Nt.decodeRow(e,t,w[1]);ne.putMetadata(Xe.UPC_EAN_EXTENSION,ae.getText()),ne.putAllMetadata(ae.getResultMetadata()),ne.addResultPoints(ae.getResultPoints()),ce=ae.getText().length}catch{}let ue=n==null?null:n.get(te.ALLOWED_EAN_EXTENSIONS);if(ue!=null){let ae=!1;for(let Ge in ue)if(ce.toString()===Ge){ae=!0;break}if(!ae)throw new N}return ne}decodeEnd(e,t){return De.findGuardPattern(e,t,!1,De.START_END_PATTERN,new Int32Array(De.START_END_PATTERN.length).fill(0))}static checkChecksum(e){return De.checkStandardUPCEANChecksum(e)}static checkStandardUPCEANChecksum(e){let t=e.length;if(t===0)return!1;let n=parseInt(e.charAt(t-1),10);return De.getStandardUPCEANChecksum(e.substring(0,t-1))===n}static getStandardUPCEANChecksum(e){let t=e.length,n=0;for(let r=t-1;r>=0;r-=2){let a=e.charAt(r).charCodeAt(0)-48;if(a<0||a>9)throw new z;n+=a}n*=3;for(let r=t-2;r>=0;r-=2){let a=e.charAt(r).charCodeAt(0)-48;if(a<0||a>9)throw new z;n+=a}return(1e3-n)%10}}class yt extends De{constructor(){super(),this.decodeMiddleCounters=Int32Array.from([0,0,0,0])}decodeMiddle(e,t,n){let r=this.decodeMiddleCounters;r[0]=0,r[1]=0,r[2]=0,r[3]=0;let a=e.getSize(),c=t[1],d=0;for(let w=0;w<6&&c<a;w++){let E=De.decodeDigit(e,r,c,De.L_AND_G_PATTERNS);n+=String.fromCharCode(48+E%10);for(let A of r)c+=A;E>=10&&(d|=1<<5-w)}n=yt.determineFirstDigit(n,d),c=De.findGuardPattern(e,c,!0,De.MIDDLE_PATTERN,new Int32Array(De.MIDDLE_PATTERN.length).fill(0))[1];for(let w=0;w<6&&c<a;w++){let E=De.decodeDigit(e,r,c,De.L_PATTERNS);n+=String.fromCharCode(48+E);for(let A of r)c+=A}return{rowOffset:c,resultString:n}}getBarcodeFormat(){return he.EAN_13}static determineFirstDigit(e,t){for(let n=0;n<10;n++)if(t===this.FIRST_DIGIT_ENCODINGS[n])return e=String.fromCharCode(48+n)+e,e;throw new N}}yt.FIRST_DIGIT_ENCODINGS=[0,11,13,14,19,25,28,21,22,26];class Pt extends De{constructor(){super(),this.decodeMiddleCounters=Int32Array.from([0,0,0,0])}decodeMiddle(e,t,n){const r=this.decodeMiddleCounters;r[0]=0,r[1]=0,r[2]=0,r[3]=0;let a=e.getSize(),c=t[1];for(let g=0;g<4&&c<a;g++){let w=De.decodeDigit(e,r,c,De.L_PATTERNS);n+=String.fromCharCode(48+w);for(let E of r)c+=E}c=De.findGuardPattern(e,c,!0,De.MIDDLE_PATTERN,new Int32Array(De.MIDDLE_PATTERN.length).fill(0))[1];for(let g=0;g<4&&c<a;g++){let w=De.decodeDigit(e,r,c,De.L_PATTERNS);n+=String.fromCharCode(48+w);for(let E of r)c+=E}return{rowOffset:c,resultString:n}}getBarcodeFormat(){return he.EAN_8}}class Lt extends De{constructor(){super(...arguments),this.ean13Reader=new yt}getBarcodeFormat(){return he.UPC_A}decode(e,t){return this.maybeReturnResult(this.ean13Reader.decode(e))}decodeRow(e,t,n){return this.maybeReturnResult(this.ean13Reader.decodeRow(e,t,n))}decodeMiddle(e,t,n){return this.ean13Reader.decodeMiddle(e,t,n)}maybeReturnResult(e){let t=e.getText();if(t.charAt(0)==="0"){let n=new _e(t.substring(1),null,null,e.getResultPoints(),he.UPC_A);return e.getResultMetadata()!=null&&n.putAllMetadata(e.getResultMetadata()),n}else throw new N}reset(){this.ean13Reader.reset()}}class xt extends De{constructor(){super(),this.decodeMiddleCounters=new Int32Array(4)}decodeMiddle(e,t,n){const r=this.decodeMiddleCounters.map(w=>w);r[0]=0,r[1]=0,r[2]=0,r[3]=0;const a=e.getSize();let c=t[1],d=0;for(let w=0;w<6&&c<a;w++){const E=xt.decodeDigit(e,r,c,xt.L_AND_G_PATTERNS);n+=String.fromCharCode(48+E%10);for(let A of r)c+=A;E>=10&&(d|=1<<5-w)}let g=xt.determineNumSysAndCheckDigit(n,d);return{rowOffset:c,resultString:g}}decodeEnd(e,t){return xt.findGuardPatternWithoutCounters(e,t,!0,xt.MIDDLE_END_PATTERN)}checkChecksum(e){return De.checkChecksum(xt.convertUPCEtoUPCA(e))}static determineNumSysAndCheckDigit(e,t){for(let n=0;n<=1;n++)for(let r=0;r<10;r++)if(t===this.NUMSYS_AND_CHECK_DIGIT_PATTERNS[n][r]){let a=String.fromCharCode(48+n),c=String.fromCharCode(48+r);return a+e+c}throw N.getNotFoundInstance()}getBarcodeFormat(){return he.UPC_E}static convertUPCEtoUPCA(e){const t=e.slice(1,7).split("").map(a=>a.charCodeAt(0)),n=new V;n.append(e.charAt(0));let r=t[5];switch(r){case 0:case 1:case 2:n.appendChars(t,0,2),n.append(r),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(r);break}return e.length>=8&&n.append(e.charAt(7)),n.toString()}}xt.MIDDLE_END_PATTERN=Int32Array.from([1,1,1,1,1,1]),xt.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 Un extends Ke{constructor(e){super();let t=e==null?null:e.get(te.POSSIBLE_FORMATS),n=[];u(t)?(n.push(new yt),n.push(new Lt),n.push(new Pt),n.push(new xt)):(t.indexOf(he.EAN_13)>-1&&n.push(new yt),t.indexOf(he.UPC_A)>-1&&n.push(new Lt),t.indexOf(he.EAN_8)>-1&&n.push(new Pt),t.indexOf(he.UPC_E)>-1&&n.push(new xt)),this.readers=n}decodeRow(e,t,n){for(let r of this.readers)try{const a=r.decodeRow(e,t,n),c=a.getBarcodeFormat()===he.EAN_13&&a.getText().charAt(0)==="0",d=n==null?null:n.get(te.POSSIBLE_FORMATS),g=d==null||d.includes(he.UPC_A);if(c&&g){const w=a.getRawBytes(),E=new _e(a.getText().substring(1),w,w?w.length:null,a.getResultPoints(),he.UPC_A);return E.putAllMetadata(a.getResultMetadata()),E}return a}catch{}throw new N}reset(){for(let e of this.readers)e.reset()}}class Bt extends Ke{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(Ke.patternMatchVariance(e,t[n],Bt.MAX_INDIVIDUAL_VARIANCE)<Bt.MAX_AVG_VARIANCE)return n;throw new N}static count(e){return He.sum(new Int32Array(e))}static increment(e,t){let n=0,r=t[0];for(let a=1;a<e.length;a++)t[a]>r&&(r=t[a],n=a);e[n]++}static decrement(e,t){let n=0,r=t[0];for(let a=1;a<e.length;a++)t[a]<r&&(r=t[a],n=a);e[n]--}static isFinderPattern(e){let t=e[0]+e[1],n=t+e[2]+e[3],r=t/n;if(r>=Bt.MIN_FINDER_PATTERN_RATIO&&r<=Bt.MAX_FINDER_PATTERN_RATIO){let a=Number.MAX_SAFE_INTEGER,c=Number.MIN_SAFE_INTEGER;for(let d of e)d>c&&(c=d),d<a&&(a=d);return c<10*a}return!1}}Bt.MAX_AVG_VARIANCE=.2,Bt.MAX_INDIVIDUAL_VARIANCE=.45,Bt.MIN_FINDER_PATTERN_RATIO=9.5/12,Bt.MAX_FINDER_PATTERN_RATIO=12.5/14;class Gn{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 Gn))return!1;const t=e;return this.value===t.value&&this.checksumPortion===t.checksumPortion}hashCode(){return this.value^this.checksumPortion}}class Ii{constructor(e,t,n,r,a){this.value=e,this.startEnd=t,this.value=e,this.startEnd=t,this.resultPoints=new Array,this.resultPoints.push(new ye(n,a)),this.resultPoints.push(new ye(r,a))}getValue(){return this.value}getStartEnd(){return this.startEnd}getResultPoints(){return this.resultPoints}equals(e){if(!(e instanceof Ii))return!1;const t=e;return this.value===t.value}hashCode(){return this.value}}class kn{constructor(){}static getRSSvalue(e,t,n){let r=0;for(let g of e)r+=g;let a=0,c=0,d=e.length;for(let g=0;g<d-1;g++){let w;for(w=1,c|=1<<g;w<e[g];w++,c&=~(1<<g)){let E=kn.combins(r-w-1,d-g-2);if(n&&c===0&&r-w-(d-g-1)>=d-g-1&&(E-=kn.combins(r-w-(d-g),d-g-2)),d-g-1>1){let A=0;for(let I=r-w-(d-g-2);I>t;I--)A+=kn.combins(r-w-I-1,d-g-3);E-=A*(d-1-g)}else r-w>t&&E--;a+=E}r-=w}return a}static combins(e,t){let n,r;e-t>t?(r=t,n=e-t):(r=e-t,n=t);let a=1,c=1;for(let d=e;d>n;d--)a*=d,c<=r&&(a/=c,c++);for(;c<=r;)a/=c,c++;return a}}class sg{static buildBitArray(e){let t=e.length*2-1;e[e.length-1].getRightChar()==null&&(t-=1);let n=12*t,r=new D(n),a=0,d=e[0].getRightChar().getValue();for(let g=11;g>=0;--g)d&1<<g&&r.set(a),a++;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&&r.set(a),a++;if(w.getRightChar()!=null){let A=w.getRightChar().getValue();for(let I=11;I>=0;--I)A&1<<I&&r.set(a),a++}}return r}}class ir{constructor(e,t){t?this.decodedInformation=null:(this.finished=e,this.decodedInformation=t)}getDecodedInformation(){return this.decodedInformation}isFinished(){return this.finished}}class Io{constructor(e){this.newPosition=e}getNewPosition(){return this.newPosition}}class Jt extends Io{constructor(e,t){super(e),this.value=t}getValue(){return this.value}isFNC1(){return this.value===Jt.FNC1}}Jt.FNC1="$";class or extends Io{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 fn extends Io{constructor(e,t,n){if(super(e),t<0||t>10||n<0||n>10)throw new z;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===fn.FNC1}isSecondDigitFNC1(){return this.secondDigit===fn.FNC1}isAnyFNC1(){return this.firstDigit===fn.FNC1||this.secondDigit===fn.FNC1}}fn.FNC1=10;class Ce{constructor(){}static parseFieldsInGeneralPurpose(e){if(!e)return null;if(e.length<2)throw new N;let t=e.substring(0,2);for(let a of Ce.TWO_DIGIT_DATA_LENGTH)if(a[0]===t)return a[1]===Ce.VARIABLE_LENGTH?Ce.processVariableAI(2,a[2],e):Ce.processFixedAI(2,a[1],e);if(e.length<3)throw new N;let n=e.substring(0,3);for(let a of Ce.THREE_DIGIT_DATA_LENGTH)if(a[0]===n)return a[1]===Ce.VARIABLE_LENGTH?Ce.processVariableAI(3,a[2],e):Ce.processFixedAI(3,a[1],e);for(let a of Ce.THREE_DIGIT_PLUS_DIGIT_DATA_LENGTH)if(a[0]===n)return a[1]===Ce.VARIABLE_LENGTH?Ce.processVariableAI(4,a[2],e):Ce.processFixedAI(4,a[1],e);if(e.length<4)throw new N;let r=e.substring(0,4);for(let a of Ce.FOUR_DIGIT_DATA_LENGTH)if(a[0]===r)return a[1]===Ce.VARIABLE_LENGTH?Ce.processVariableAI(4,a[2],e):Ce.processFixedAI(4,a[1],e);throw new N}static processFixedAI(e,t,n){if(n.length<e)throw new N;let r=n.substring(0,e);if(n.length<e+t)throw new N;let a=n.substring(e,e+t),c=n.substring(e+t),d="("+r+")"+a,g=Ce.parseFieldsInGeneralPurpose(c);return g==null?d:d+g}static processVariableAI(e,t,n){let r=n.substring(0,e),a;n.length<e+t?a=n.length:a=e+t;let c=n.substring(e,a),d=n.substring(a),g="("+r+")"+c,w=Ce.parseFieldsInGeneralPurpose(d);return w==null?g:g+w}}Ce.VARIABLE_LENGTH=[],Ce.TWO_DIGIT_DATA_LENGTH=[["00",18],["01",14],["02",14],["10",Ce.VARIABLE_LENGTH,20],["11",6],["12",6],["13",6],["15",6],["17",6],["20",2],["21",Ce.VARIABLE_LENGTH,20],["22",Ce.VARIABLE_LENGTH,29],["30",Ce.VARIABLE_LENGTH,8],["37",Ce.VARIABLE_LENGTH,8],["90",Ce.VARIABLE_LENGTH,30],["91",Ce.VARIABLE_LENGTH,30],["92",Ce.VARIABLE_LENGTH,30],["93",Ce.VARIABLE_LENGTH,30],["94",Ce.VARIABLE_LENGTH,30],["95",Ce.VARIABLE_LENGTH,30],["96",Ce.VARIABLE_LENGTH,30],["97",Ce.VARIABLE_LENGTH,3],["98",Ce.VARIABLE_LENGTH,30],["99",Ce.VARIABLE_LENGTH,30]],Ce.THREE_DIGIT_DATA_LENGTH=[["240",Ce.VARIABLE_LENGTH,30],["241",Ce.VARIABLE_LENGTH,30],["242",Ce.VARIABLE_LENGTH,6],["250",Ce.VARIABLE_LENGTH,30],["251",Ce.VARIABLE_LENGTH,30],["253",Ce.VARIABLE_LENGTH,17],["254",Ce.VARIABLE_LENGTH,20],["400",Ce.VARIABLE_LENGTH,30],["401",Ce.VARIABLE_LENGTH,30],["402",17],["403",Ce.VARIABLE_LENGTH,30],["410",13],["411",13],["412",13],["413",13],["414",13],["420",Ce.VARIABLE_LENGTH,20],["421",Ce.VARIABLE_LENGTH,15],["422",3],["423",Ce.VARIABLE_LENGTH,15],["424",3],["425",3],["426",3]],Ce.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",Ce.VARIABLE_LENGTH,15],["391",Ce.VARIABLE_LENGTH,18],["392",Ce.VARIABLE_LENGTH,15],["393",Ce.VARIABLE_LENGTH,18],["703",Ce.VARIABLE_LENGTH,30]],Ce.FOUR_DIGIT_DATA_LENGTH=[["7001",13],["7002",Ce.VARIABLE_LENGTH,30],["7003",10],["8001",14],["8002",Ce.VARIABLE_LENGTH,20],["8003",Ce.VARIABLE_LENGTH,30],["8004",Ce.VARIABLE_LENGTH,30],["8005",6],["8006",18],["8007",Ce.VARIABLE_LENGTH,30],["8008",Ce.VARIABLE_LENGTH,12],["8018",18],["8020",Ce.VARIABLE_LENGTH,25],["8100",6],["8101",10],["8102",2],["8110",Ce.VARIABLE_LENGTH,70],["8200",Ce.VARIABLE_LENGTH,70]];class yr{constructor(e){this.buffer=new V,this.information=e}decodeAllCodes(e,t){let n=t,r=null;do{let a=this.decodeGeneralPurposeField(n,r),c=Ce.parseFieldsInGeneralPurpose(a.getNewString());if(c!=null&&e.append(c),a.isRemaining()?r=""+a.getRemainingValue():r=null,n===a.getNewPosition())break;n=a.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 a=this.extractNumericValueFromBitArray(e,4);return a===0?new fn(this.information.getSize(),fn.FNC1,fn.FNC1):new fn(this.information.getSize(),a-1,fn.FNC1)}let t=this.extractNumericValueFromBitArray(e,7),n=(t-8)/11,r=(t-8)%11;return new fn(e+7,n,r)}extractNumericValueFromBitArray(e,t){return yr.extractNumericValueFromBitArray(this.information,e,t)}static extractNumericValueFromBitArray(e,t,n){let r=0;for(let a=0;a<n;++a)e.get(t+a)&&(r|=1<<n-a-1);return r}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 or(this.current.getPosition(),this.buffer.toString(),n.getRemainingValue()):new or(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 or(this.current.getPosition(),this.buffer.toString()):t=new or(this.current.getPosition(),this.buffer.toString(),e.getSecondDigit()),new ir(!0,t)}if(this.buffer.append(e.getFirstDigit()),e.isSecondDigitFNC1()){let t=new or(this.current.getPosition(),this.buffer.toString());return new ir(!0,t)}this.buffer.append(e.getSecondDigit())}return this.isNumericToAlphaNumericLatch(this.current.getPosition())&&(this.current.setAlpha(),this.current.incrementPosition(4)),new ir(!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 or(this.current.getPosition(),this.buffer.toString());return new ir(!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 ir(!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 or(this.current.getPosition(),this.buffer.toString());return new ir(!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 ir(!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 r=this.extractNumericValueFromBitArray(e,8);return r>=232&&r<253}decodeIsoIec646(e){let t=this.extractNumericValueFromBitArray(e,5);if(t===15)return new Jt(e+5,Jt.FNC1);if(t>=5&&t<15)return new Jt(e+5,"0"+(t-5));let n=this.extractNumericValueFromBitArray(e,7);if(n>=64&&n<90)return new Jt(e+7,""+(n+1));if(n>=90&&n<116)return new Jt(e+7,""+(n+7));let r=this.extractNumericValueFromBitArray(e,8),a;switch(r){case 232:a="!";break;case 233:a='"';break;case 234:a="%";break;case 235:a="&";break;case 236:a="'";break;case 237:a="(";break;case 238:a=")";break;case 239:a="*";break;case 240:a="+";break;case 241:a=",";break;case 242:a="-";break;case 243:a=".";break;case 244:a="/";break;case 245:a=":";break;case 246:a=";";break;case 247:a="<";break;case 248:a="=";break;case 249:a=">";break;case 250:a="?";break;case 251:a="_";break;case 252:a=" ";break;default:throw new z}return new Jt(e+8,a)}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 Jt(e+5,Jt.FNC1);if(t>=5&&t<15)return new Jt(e+5,"0"+(t-5));let n=this.extractNumericValueFromBitArray(e,6);if(n>=32&&n<58)return new Jt(e+6,""+(n+33));let r;switch(n){case 58:r="*";break;case 59:r=",";break;case 60:r="-";break;case 61:r=".";break;case 62:r="/";break;default:throw new nt("Decoding invalid alphanumeric value: "+n)}return new Jt(e+6,r)}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 So{constructor(e){this.information=e,this.generalDecoder=new yr(e)}getInformation(){return this.information}getGeneralDecoder(){return this.generalDecoder}}class en extends So{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 r=0;r<4;++r){let a=this.getGeneralDecoder().extractNumericValueFromBitArray(t+10*r,10);a/100===0&&e.append("0"),a/10===0&&e.append("0"),e.append(a)}en.appendCheckDigit(e,n)}static appendCheckDigit(e,t){let n=0;for(let r=0;r<13;r++){let a=e.charAt(r+t).charCodeAt(0)-48;n+=r&1?a:3*a}n=10-n%10,n===10&&(n=0),e.append(n)}}en.GTIN_SIZE=40;class br extends en{constructor(e){super(e)}parseInformation(){let e=new V;e.append("(01)");let t=e.length(),n=this.getGeneralDecoder().extractNumericValueFromBitArray(br.HEADER_SIZE,4);return e.append(n),this.encodeCompressedGtinWithoutAI(e,br.HEADER_SIZE+4,t),this.getGeneralDecoder().decodeAllCodes(e,br.HEADER_SIZE+44)}}br.HEADER_SIZE=4;class Si extends So{constructor(e){super(e)}parseInformation(){let e=new V;return this.getGeneralDecoder().decodeAllCodes(e,Si.HEADER_SIZE)}}Si.HEADER_SIZE=5;class Ni extends en{constructor(e){super(e)}encodeCompressedWeight(e,t,n){let r=this.getGeneralDecoder().extractNumericValueFromBitArray(t,n);this.addWeightCode(e,r);let a=this.checkWeight(r),c=1e5;for(let d=0;d<5;++d)a/c===0&&e.append("0"),c/=10;e.append(a)}}class Rn extends Ni{constructor(e){super(e)}parseInformation(){if(this.getInformation().getSize()!=Rn.HEADER_SIZE+Ni.GTIN_SIZE+Rn.WEIGHT_SIZE)throw new N;let e=new V;return this.encodeCompressedGtin(e,Rn.HEADER_SIZE),this.encodeCompressedWeight(e,Rn.HEADER_SIZE+Ni.GTIN_SIZE,Rn.WEIGHT_SIZE),e.toString()}}Rn.HEADER_SIZE=5,Rn.WEIGHT_SIZE=15;class ag extends Rn{constructor(e){super(e)}addWeightCode(e,t){e.append("(3103)")}checkWeight(e){return e}}class lg extends Rn{constructor(e){super(e)}addWeightCode(e,t){t<1e4?e.append("(3202)"):e.append("(3203)")}checkWeight(e){return e<1e4?e:e-1e4}}class On extends en{constructor(e){super(e)}parseInformation(){if(this.getInformation().getSize()<On.HEADER_SIZE+en.GTIN_SIZE)throw new N;let e=new V;this.encodeCompressedGtin(e,On.HEADER_SIZE);let t=this.getGeneralDecoder().extractNumericValueFromBitArray(On.HEADER_SIZE+en.GTIN_SIZE,On.LAST_DIGIT_SIZE);e.append("(392"),e.append(t),e.append(")");let n=this.getGeneralDecoder().decodeGeneralPurposeField(On.HEADER_SIZE+en.GTIN_SIZE+On.LAST_DIGIT_SIZE,null);return e.append(n.getNewString()),e.toString()}}On.HEADER_SIZE=8,On.LAST_DIGIT_SIZE=2;class Zt extends en{constructor(e){super(e)}parseInformation(){if(this.getInformation().getSize()<Zt.HEADER_SIZE+en.GTIN_SIZE)throw new N;let e=new V;this.encodeCompressedGtin(e,Zt.HEADER_SIZE);let t=this.getGeneralDecoder().extractNumericValueFromBitArray(Zt.HEADER_SIZE+en.GTIN_SIZE,Zt.LAST_DIGIT_SIZE);e.append("(393"),e.append(t),e.append(")");let n=this.getGeneralDecoder().extractNumericValueFromBitArray(Zt.HEADER_SIZE+en.GTIN_SIZE+Zt.LAST_DIGIT_SIZE,Zt.FIRST_THREE_DIGITS_SIZE);n/100==0&&e.append("0"),n/10==0&&e.append("0"),e.append(n);let r=this.getGeneralDecoder().decodeGeneralPurposeField(Zt.HEADER_SIZE+en.GTIN_SIZE+Zt.LAST_DIGIT_SIZE+Zt.FIRST_THREE_DIGITS_SIZE,null);return e.append(r.getNewString()),e.toString()}}Zt.HEADER_SIZE=8,Zt.LAST_DIGIT_SIZE=2,Zt.FIRST_THREE_DIGITS_SIZE=10;class pt extends Ni{constructor(e,t,n){super(e),this.dateCode=n,this.firstAIdigits=t}parseInformation(){if(this.getInformation().getSize()!=pt.HEADER_SIZE+pt.GTIN_SIZE+pt.WEIGHT_SIZE+pt.DATE_SIZE)throw new N;let e=new V;return this.encodeCompressedGtin(e,pt.HEADER_SIZE),this.encodeCompressedWeight(e,pt.HEADER_SIZE+pt.GTIN_SIZE,pt.WEIGHT_SIZE),this.encodeCompressedDate(e,pt.HEADER_SIZE+pt.GTIN_SIZE+pt.WEIGHT_SIZE),e.toString()}encodeCompressedDate(e,t){let n=this.getGeneralDecoder().extractNumericValueFromBitArray(t,pt.DATE_SIZE);if(n==38400)return;e.append("("),e.append(this.dateCode),e.append(")");let r=n%32;n/=32;let a=n%12+1;n/=12;let c=n;c/10==0&&e.append("0"),e.append(c),a/10==0&&e.append("0"),e.append(a),r/10==0&&e.append("0"),e.append(r)}addWeightCode(e,t){e.append("("),e.append(this.firstAIdigits),e.append(t/1e5),e.append(")")}checkWeight(e){return e%1e5}}pt.HEADER_SIZE=8,pt.WEIGHT_SIZE=20,pt.DATE_SIZE=16;function Ua(b){try{if(b.get(1))return new br(b);if(!b.get(2))return new Si(b);switch(yr.extractNumericValueFromBitArray(b,1,4)){case 4:return new ag(b);case 5:return new lg(b)}switch(yr.extractNumericValueFromBitArray(b,1,5)){case 12:return new On(b);case 13:return new Zt(b)}switch(yr.extractNumericValueFromBitArray(b,1,7)){case 56:return new pt(b,"310","11");case 57:return new pt(b,"320","11");case 58:return new pt(b,"310","13");case 59:return new pt(b,"320","13");case 60:return new pt(b,"310","15");case 61:return new pt(b,"320","15");case 62:return new pt(b,"310","17");case 63:return new pt(b,"320","17")}}catch(e){throw console.log(e),new nt("unknown decoder: "+b)}}class Wn{constructor(e,t,n,r){this.leftchar=e,this.rightchar=t,this.finderpattern=n,this.maybeLast=r}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 Wn?Wn.equalsOrNull(e.leftchar,t.leftchar)&&Wn.equalsOrNull(e.rightchar,t.rightchar)&&Wn.equalsOrNull(e.finderpattern,t.finderpattern):!1}static equalsOrNull(e,t){return e===null?t===null:Wn.equals(e,t)}hashCode(){return this.leftchar.getValue()^this.rightchar.getValue()^this.finderpattern.getValue()}}class No{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 No?this.checkEqualitity(e,t)&&e.wasReversed===t.wasReversed:!1}checkEqualitity(e,t){if(!e||!t)return;let n;return e.forEach((r,a)=>{t.forEach(c=>{r.getLeftChar().getValue()===c.getLeftChar().getValue()&&r.getRightChar().getValue()===c.getRightChar().getValue()&&r.getFinderPatter().getValue()===c.getFinderPatter().getValue()&&(n=!0)})}),n}}class oe extends Bt{constructor(e){super(...arguments),this.pairs=new Array(oe.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 oe.constructResult(this.decodeRow2pairs(e,t))}catch(r){this.verbose&&console.log(r)}return this.pairs.length=0,this.startFromEven=!0,oe.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(a){if(a instanceof N){if(!this.pairs.length)throw new N;n=!0}}if(this.checkChecksum())return this.pairs;let r;if(this.rows.length?r=!0:r=!1,this.storeRow(e,!1),r){let a=this.checkRowsBoolean(!1);if(a!=null||(a=this.checkRowsBoolean(!0),a!=null))return a}throw new N}checkRowsBoolean(e){if(this.rows.length>25)return this.rows.length=0,null;this.pairs.length=0,e&&(this.rows=this.rows.reverse());let t=null;try{t=this.checkRows(new Array,0)}catch(n){this.verbose&&console.log(n)}return e&&(this.rows=this.rows.reverse()),t}checkRows(e,t){for(let n=t;n<this.rows.length;n++){let r=this.rows[n];this.pairs.length=0;for(let c of e)this.pairs.push(c.getPairs());if(this.pairs.push(r.getPairs()),!oe.isValidSequence(this.pairs))continue;if(this.checkChecksum())return this.pairs;let a=new Array(e);a.push(r);try{return this.checkRows(a,n+1)}catch(c){this.verbose&&console.log(c)}}throw new N}static isValidSequence(e){for(let t of oe.FINDER_PATTERN_SEQUENCES){if(e.length>t.length)continue;let n=!0;for(let r=0;r<e.length;r++)if(e[r].getFinderPattern().getValue()!=t[r]){n=!1;break}if(n)return!0}return!1}storeRow(e,t){let n=0,r=!1,a=!1;for(;n<this.rows.length;){let c=this.rows[n];if(c.getRowNumber()>e){a=c.isEquivalent(this.pairs);break}r=c.isEquivalent(this.pairs),n++}a||r||oe.isPartialRow(this.pairs,this.rows)||(this.rows.push(n,new No(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 r of n.getPairs())for(let a of e)if(Wn.equals(r,a))break}}static isPartialRow(e,t){for(let n of t){let r=!0;for(let a of e){let c=!1;for(let d of n.getPairs())if(a.equals(d)){c=!0;break}if(!c){r=!1;break}}if(r)return!0}return!1}getRows(){return this.rows}static constructResult(e){let t=sg.buildBitArray(e),r=Ua(t).parseInformation(),a=e[0].getFinderPattern().getResultPoints(),c=e[e.length-1].getFinderPattern().getResultPoints(),d=[a[0],a[1],c[0],c[1]];return new _e(r,null,null,d,he.RSS_EXPANDED,null)}checkChecksum(){let e=this.pairs.get(0),t=e.getLeftChar(),n=e.getRightChar();if(n==null)return!1;let r=n.getChecksumPortion(),a=2;for(let d=1;d<this.pairs.size();++d){let g=this.pairs.get(d);r+=g.getLeftChar().getChecksumPortion(),a++;let w=g.getRightChar();w!=null&&(r+=w.getChecksumPortion(),a++)}return r%=211,211*(a-4)+r==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 r=t.length%2==0;this.startFromEven&&(r=!r);let a,c=!0,d=-1;do this.findNextPair(e,t,d),a=this.parseFoundFinderPattern(e,n,r),a==null?d=oe.getNextSecondBar(e,this.startEnd[0]):c=!1;while(c);let g=this.decodeDataCharacter(e,a,r,!0);if(!this.isEmptyPair(t)&&t[t.length-1].mustBeLast())throw new N;let w;try{w=this.decodeDataCharacter(e,a,r,!1)}catch(E){w=null,this.verbose&&console.log(E)}return new Wn(g,w,a,!0)}isEmptyPair(e){return e.length===0}findNextPair(e,t,n){let r=this.getDecodeFinderCounters();r[0]=0,r[1]=0,r[2]=0,r[3]=0;let a=e.getSize(),c;n>=0?c=n:this.isEmptyPair(t)?c=0:c=t[t.length-1].getFinderPattern().getStartEnd()[1];let d=t.length%2!=0;this.startFromEven&&(d=!d);let g=!1;for(;c<a&&(g=!e.get(c),!!g);)c++;let w=0,E=c;for(let A=c;A<a;A++)if(e.get(A)!=g)r[w]++;else{if(w==3){if(d&&oe.reverseCounters(r),oe.isFinderPattern(r)){this.startEnd[0]=E,this.startEnd[1]=A;return}d&&oe.reverseCounters(r),E+=r[0]+r[1],r[0]=r[2],r[1]=r[3],r[2]=0,r[3]=0,w--}else w++;r[w]=1,g=!g}throw new N}static reverseCounters(e){let t=e.length;for(let n=0;n<t/2;++n){let r=e[n];e[n]=e[t-n-1],e[t-n-1]=r}}parseFoundFinderPattern(e,t,n){let r,a,c;if(n){let w=this.startEnd[0]-1;for(;w>=0&&!e.get(w);)w--;w++,r=this.startEnd[0]-w,a=w,c=this.startEnd[1]}else a=this.startEnd[0],c=e.getNextUnset(this.startEnd[1]+1),r=c-this.startEnd[1];let d=this.getDecodeFinderCounters();P.arraycopy(d,0,d,1,d.length-1),d[0]=r;let g;try{g=this.parseFinderValue(d,oe.FINDER_PATTERNS)}catch{return null}return new Ii(g,[a,c],a,c,t)}decodeDataCharacter(e,t,n,r){let a=this.getDataCharacterCounters();for(let at=0;at<a.length;at++)a[at]=0;if(r)oe.recordPatternInReverse(e,t.getStartEnd()[0],a);else{oe.recordPattern(e,t.getStartEnd()[1],a);for(let at=0,Ut=a.length-1;at<Ut;at++,Ut--){let ln=a[at];a[at]=a[Ut],a[Ut]=ln}}let c=17,d=He.sum(new Int32Array(a))/c,g=(t.getStartEnd()[1]-t.getStartEnd()[0])/15;if(Math.abs(d-g)/g>.3)throw new N;let w=this.getOddCounts(),E=this.getEvenCounts(),A=this.getOddRoundingErrors(),I=this.getEvenRoundingErrors();for(let at=0;at<a.length;at++){let Ut=1*a[at]/d,ln=Ut+.5;if(ln<1){if(Ut<.3)throw new N;ln=1}else if(ln>8){if(Ut>8.7)throw new N;ln=8}let Tr=at/2;at&1?(E[Tr]=ln,I[Tr]=Ut-ln):(w[Tr]=ln,A[Tr]=Ut-ln)}this.adjustOddEvenCounts(c);let O=4*t.getValue()+(n?0:2)+(r?0:1)-1,L=0,F=0;for(let at=w.length-1;at>=0;at--){if(oe.isNotA1left(t,n,r)){let Ut=oe.WEIGHTS[O][2*at];F+=w[at]*Ut}L+=w[at]}let Z=0;for(let at=E.length-1;at>=0;at--)if(oe.isNotA1left(t,n,r)){let Ut=oe.WEIGHTS[O][2*at+1];Z+=E[at]*Ut}let ne=F+Z;if(L&1||L>13||L<4)throw new N;let ce=(13-L)/2,ue=oe.SYMBOL_WIDEST[ce],ae=9-ue,Ge=kn.getRSSvalue(w,ue,!0),ve=kn.getRSSvalue(E,ae,!1),nn=oe.EVEN_TOTAL_SUBSET[ce],An=oe.GSUM[ce],rn=Ge*nn+ve+An;return new Gn(rn,ne)}static isNotA1left(e,t,n){return!(e.getValue()==0&&t&&n)}adjustOddEvenCounts(e){let t=He.sum(new Int32Array(this.getOddCounts())),n=He.sum(new Int32Array(this.getEvenCounts())),r=!1,a=!1;t>13?a=!0:t<4&&(r=!0);let c=!1,d=!1;n>13?d=!0:n<4&&(c=!0);let g=t+n-e,w=(t&1)==1,E=(n&1)==0;if(g==1)if(w){if(E)throw new N;a=!0}else{if(!E)throw new N;d=!0}else if(g==-1)if(w){if(E)throw new N;r=!0}else{if(!E)throw new N;c=!0}else if(g==0){if(w){if(!E)throw new N;t<n?(r=!0,d=!0):(a=!0,c=!0)}else if(E)throw new N}else throw new N;if(r){if(a)throw new N;oe.increment(this.getOddCounts(),this.getOddRoundingErrors())}if(a&&oe.decrement(this.getOddCounts(),this.getOddRoundingErrors()),c){if(d)throw new N;oe.increment(this.getEvenCounts(),this.getOddRoundingErrors())}d&&oe.decrement(this.getEvenCounts(),this.getEvenRoundingErrors())}}oe.SYMBOL_WIDEST=[7,5,4,3,1],oe.EVEN_TOTAL_SUBSET=[4,20,52,104,204],oe.GSUM=[0,348,1388,2948,3988],oe.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])],oe.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]],oe.FINDER_PAT_A=0,oe.FINDER_PAT_B=1,oe.FINDER_PAT_C=2,oe.FINDER_PAT_D=3,oe.FINDER_PAT_E=4,oe.FINDER_PAT_F=5,oe.FINDER_PATTERN_SEQUENCES=[[oe.FINDER_PAT_A,oe.FINDER_PAT_A],[oe.FINDER_PAT_A,oe.FINDER_PAT_B,oe.FINDER_PAT_B],[oe.FINDER_PAT_A,oe.FINDER_PAT_C,oe.FINDER_PAT_B,oe.FINDER_PAT_D],[oe.FINDER_PAT_A,oe.FINDER_PAT_E,oe.FINDER_PAT_B,oe.FINDER_PAT_D,oe.FINDER_PAT_C],[oe.FINDER_PAT_A,oe.FINDER_PAT_E,oe.FINDER_PAT_B,oe.FINDER_PAT_D,oe.FINDER_PAT_D,oe.FINDER_PAT_F],[oe.FINDER_PAT_A,oe.FINDER_PAT_E,oe.FINDER_PAT_B,oe.FINDER_PAT_D,oe.FINDER_PAT_E,oe.FINDER_PAT_F,oe.FINDER_PAT_F],[oe.FINDER_PAT_A,oe.FINDER_PAT_A,oe.FINDER_PAT_B,oe.FINDER_PAT_B,oe.FINDER_PAT_C,oe.FINDER_PAT_C,oe.FINDER_PAT_D,oe.FINDER_PAT_D],[oe.FINDER_PAT_A,oe.FINDER_PAT_A,oe.FINDER_PAT_B,oe.FINDER_PAT_B,oe.FINDER_PAT_C,oe.FINDER_PAT_C,oe.FINDER_PAT_D,oe.FINDER_PAT_E,oe.FINDER_PAT_E],[oe.FINDER_PAT_A,oe.FINDER_PAT_A,oe.FINDER_PAT_B,oe.FINDER_PAT_B,oe.FINDER_PAT_C,oe.FINDER_PAT_C,oe.FINDER_PAT_D,oe.FINDER_PAT_E,oe.FINDER_PAT_F,oe.FINDER_PAT_F],[oe.FINDER_PAT_A,oe.FINDER_PAT_A,oe.FINDER_PAT_B,oe.FINDER_PAT_B,oe.FINDER_PAT_C,oe.FINDER_PAT_D,oe.FINDER_PAT_D,oe.FINDER_PAT_E,oe.FINDER_PAT_E,oe.FINDER_PAT_F,oe.FINDER_PAT_F]],oe.MAX_PAIRS=11;class cg extends Gn{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 Ct extends Bt{constructor(){super(...arguments),this.possibleLeftPairs=[],this.possibleRightPairs=[]}decodeRow(e,t,n){const r=this.decodePair(t,!1,e,n);Ct.addOrTally(this.possibleLeftPairs,r),t.reverse();let a=this.decodePair(t,!0,e,n);Ct.addOrTally(this.possibleRightPairs,a),t.reverse();for(let c of this.possibleLeftPairs)if(c.getCount()>1){for(let d of this.possibleRightPairs)if(d.getCount()>1&&Ct.checkChecksum(c,d))return Ct.constructResult(c,d)}throw new N}static addOrTally(e,t){if(t==null)return;let n=!1;for(let r of e)if(r.getValue()===t.getValue()){r.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(),r=new String(n).toString(),a=new V;for(let w=13-r.length;w>0;w--)a.append("0");a.append(r);let c=0;for(let w=0;w<13;w++){let E=a.charAt(w).charCodeAt(0)-48;c+=w&1?E:3*E}c=10-c%10,c===10&&(c=0),a.append(c.toString());let d=e.getFinderPattern().getResultPoints(),g=t.getFinderPattern().getResultPoints();return new _e(a.toString(),null,0,[d[0],d[1],g[0],g[1]],he.RSS_14,new Date().getTime())}static checkChecksum(e,t){let n=(e.getChecksumPortion()+16*t.getChecksumPortion())%79,r=9*e.getFinderPattern().getValue()+t.getFinderPattern().getValue();return r>72&&r--,r>8&&r--,n===r}decodePair(e,t,n,r){try{let a=this.findFinderPattern(e,t),c=this.parseFoundFinderPattern(e,n,t,a),d=r==null?null:r.get(te.NEED_RESULT_POINT_CALLBACK);if(d!=null){let E=(a[0]+a[1])/2;t&&(E=e.getSize()-1-E),d.foundPossibleResultPoint(new ye(E,n))}let g=this.decodeDataCharacter(e,c,!0),w=this.decodeDataCharacter(e,c,!1);return new cg(1597*g.getValue()+w.getValue(),g.getChecksumPortion()+4*w.getChecksumPortion(),c)}catch{return null}}decodeDataCharacter(e,t,n){let r=this.getDataCharacterCounters();for(let Z=0;Z<r.length;Z++)r[Z]=0;if(n)Ke.recordPatternInReverse(e,t.getStartEnd()[0],r);else{Ke.recordPattern(e,t.getStartEnd()[1]+1,r);for(let Z=0,ne=r.length-1;Z<ne;Z++,ne--){let ce=r[Z];r[Z]=r[ne],r[ne]=ce}}let a=n?16:15,c=He.sum(new Int32Array(r))/a,d=this.getOddCounts(),g=this.getEvenCounts(),w=this.getOddRoundingErrors(),E=this.getEvenRoundingErrors();for(let Z=0;Z<r.length;Z++){let ne=r[Z]/c,ce=Math.floor(ne+.5);ce<1?ce=1:ce>8&&(ce=8);let ue=Math.floor(Z/2);Z&1?(g[ue]=ce,E[ue]=ne-ce):(d[ue]=ce,w[ue]=ne-ce)}this.adjustOddEvenCounts(n,a);let A=0,I=0;for(let Z=d.length-1;Z>=0;Z--)I*=9,I+=d[Z],A+=d[Z];let O=0,L=0;for(let Z=g.length-1;Z>=0;Z--)O*=9,O+=g[Z],L+=g[Z];let F=I+3*O;if(n){if(A&1||A>12||A<4)throw new N;let Z=(12-A)/2,ne=Ct.OUTSIDE_ODD_WIDEST[Z],ce=9-ne,ue=kn.getRSSvalue(d,ne,!1),ae=kn.getRSSvalue(g,ce,!0),Ge=Ct.OUTSIDE_EVEN_TOTAL_SUBSET[Z],ve=Ct.OUTSIDE_GSUM[Z];return new Gn(ue*Ge+ae+ve,F)}else{if(L&1||L>10||L<4)throw new N;let Z=(10-L)/2,ne=Ct.INSIDE_ODD_WIDEST[Z],ce=9-ne,ue=kn.getRSSvalue(d,ne,!0),ae=kn.getRSSvalue(g,ce,!1),Ge=Ct.INSIDE_ODD_TOTAL_SUBSET[Z],ve=Ct.INSIDE_GSUM[Z];return new Gn(ae*Ge+ue+ve,F)}}findFinderPattern(e,t){let n=this.getDecodeFinderCounters();n[0]=0,n[1]=0,n[2]=0,n[3]=0;let r=e.getSize(),a=!1,c=0;for(;c<r&&(a=!e.get(c),t!==a);)c++;let d=0,g=c;for(let w=c;w<r;w++)if(e.get(w)!==a)n[d]++;else{if(d===3){if(Bt.isFinderPattern(n))return[g,w];g+=n[0]+n[1],n[0]=n[2],n[1]=n[3],n[2]=0,n[3]=0,d--}else d++;n[d]=1,a=!a}throw new N}parseFoundFinderPattern(e,t,n,r){let a=e.get(r[0]),c=r[0]-1;for(;c>=0&&a!==e.get(c);)c--;c++;const d=r[0]-c,g=this.getDecodeFinderCounters(),w=new Int32Array(g.length);P.arraycopy(g,0,w,1,g.length-1),w[0]=d;const E=this.parseFinderValue(w,Ct.FINDER_PATTERNS);let A=c,I=r[1];return n&&(A=e.getSize()-1-A,I=e.getSize()-1-I),new Ii(E,[c,r[1]],A,I,t)}adjustOddEvenCounts(e,t){let n=He.sum(new Int32Array(this.getOddCounts())),r=He.sum(new Int32Array(this.getEvenCounts())),a=!1,c=!1,d=!1,g=!1;e?(n>12?c=!0:n<4&&(a=!0),r>12?g=!0:r<4&&(d=!0)):(n>11?c=!0:n<5&&(a=!0),r>10?g=!0:r<4&&(d=!0));let w=n+r-t,E=(n&1)===(e?1:0),A=(r&1)===1;if(w===1)if(E){if(A)throw new N;c=!0}else{if(!A)throw new N;g=!0}else if(w===-1)if(E){if(A)throw new N;a=!0}else{if(!A)throw new N;d=!0}else if(w===0){if(E){if(!A)throw new N;n<r?(a=!0,g=!0):(c=!0,d=!0)}else if(A)throw new N}else throw new N;if(a){if(c)throw new N;Bt.increment(this.getOddCounts(),this.getOddRoundingErrors())}if(c&&Bt.decrement(this.getOddCounts(),this.getOddRoundingErrors()),d){if(g)throw new N;Bt.increment(this.getEvenCounts(),this.getOddRoundingErrors())}g&&Bt.decrement(this.getEvenCounts(),this.getEvenRoundingErrors())}}Ct.OUTSIDE_EVEN_TOTAL_SUBSET=[1,10,34,70,126],Ct.INSIDE_ODD_TOTAL_SUBSET=[4,20,48,81],Ct.OUTSIDE_GSUM=[0,161,961,2015,2715],Ct.INSIDE_GSUM=[0,336,1036,1516],Ct.OUTSIDE_ODD_WIDEST=[8,6,4,3,1],Ct.INSIDE_ODD_WIDEST=[2,4,6,8],Ct.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 Ar extends Ke{constructor(e,t){super(),this.readers=[],this.verbose=t===!0;const n=e?e.get(te.POSSIBLE_FORMATS):null,r=e&&e.get(te.ASSUME_CODE_39_CHECK_DIGIT)!==void 0;n?((n.includes(he.EAN_13)||n.includes(he.UPC_A)||n.includes(he.EAN_8)||n.includes(he.UPC_E))&&this.readers.push(new Un(e)),n.includes(he.CODE_39)&&this.readers.push(new ft(r)),n.includes(he.CODE_128)&&this.readers.push(new de),n.includes(he.ITF)&&this.readers.push(new Ye),n.includes(he.RSS_14)&&this.readers.push(new Ct),n.includes(he.RSS_EXPANDED)&&this.readers.push(new oe(this.verbose))):(this.readers.push(new Un(e)),this.readers.push(new ft),this.readers.push(new Un(e)),this.readers.push(new de),this.readers.push(new Ye),this.readers.push(new Ct),this.readers.push(new oe(this.verbose)))}decodeRow(e,t,n){for(let r=0;r<this.readers.length;r++)try{return this.readers[r].decodeRow(e,t,n)}catch{}throw new N}reset(){this.readers.forEach(e=>e.reset())}}class ug extends Ne{constructor(e=500,t){super(new Ar(t),e,t)}}class tt{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 je{constructor(e,t,n,r,a,c){this.versionNumber=e,this.symbolSizeRows=t,this.symbolSizeColumns=n,this.dataRegionSizeRows=r,this.dataRegionSizeColumns=a,this.ecBlocks=c;let d=0;const g=c.getECCodewords(),w=c.getECBlocks();for(let E of w)d+=E.getCount()*(E.getDataCodewords()+g);this.totalCodewords=d}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 z;for(let n of je.VERSIONS)if(n.symbolSizeRows===e&&n.symbolSizeColumns===t)return n;throw new z}toString(){return""+this.versionNumber}static buildVersions(){return[new je(1,10,10,8,8,new tt(5,new Je(1,3))),new je(2,12,12,10,10,new tt(7,new Je(1,5))),new je(3,14,14,12,12,new tt(10,new Je(1,8))),new je(4,16,16,14,14,new tt(12,new Je(1,12))),new je(5,18,18,16,16,new tt(14,new Je(1,18))),new je(6,20,20,18,18,new tt(18,new Je(1,22))),new je(7,22,22,20,20,new tt(20,new Je(1,30))),new je(8,24,24,22,22,new tt(24,new Je(1,36))),new je(9,26,26,24,24,new tt(28,new Je(1,44))),new je(10,32,32,14,14,new tt(36,new Je(1,62))),new je(11,36,36,16,16,new tt(42,new Je(1,86))),new je(12,40,40,18,18,new tt(48,new Je(1,114))),new je(13,44,44,20,20,new tt(56,new Je(1,144))),new je(14,48,48,22,22,new tt(68,new Je(1,174))),new je(15,52,52,24,24,new tt(42,new Je(2,102))),new je(16,64,64,14,14,new tt(56,new Je(2,140))),new je(17,72,72,16,16,new tt(36,new Je(4,92))),new je(18,80,80,18,18,new tt(48,new Je(4,114))),new je(19,88,88,20,20,new tt(56,new Je(4,144))),new je(20,96,96,22,22,new tt(68,new Je(4,174))),new je(21,104,104,24,24,new tt(56,new Je(6,136))),new je(22,120,120,18,18,new tt(68,new Je(6,175))),new je(23,132,132,20,20,new tt(62,new Je(8,163))),new je(24,144,144,22,22,new tt(62,new Je(8,156),new Je(2,155))),new je(25,8,18,6,16,new tt(7,new Je(1,5))),new je(26,8,32,6,14,new tt(11,new Je(1,10))),new je(27,12,26,10,24,new tt(14,new Je(1,16))),new je(28,12,36,10,16,new tt(18,new Je(1,22))),new je(29,16,36,14,16,new tt(24,new Je(1,32))),new je(30,16,48,14,22,new tt(28,new Je(1,49)))]}}je.VERSIONS=je.buildVersions();class To{constructor(e){const t=e.getHeight();if(t<8||t>144||t&1)throw new z;this.version=To.readVersion(e),this.mappingBitMatrix=this.extractDataRegion(e),this.readMappingMatrix=new X(this.mappingBitMatrix.getWidth(),this.mappingBitMatrix.getHeight())}getVersion(){return this.version}static readVersion(e){const t=e.getHeight(),n=e.getWidth();return je.getVersionForDimensions(t,n)}readCodewords(){const e=new Int8Array(this.version.getTotalCodewords());let t=0,n=4,r=0;const a=this.mappingBitMatrix.getHeight(),c=this.mappingBitMatrix.getWidth();let d=!1,g=!1,w=!1,E=!1;do if(n===a&&r===0&&!d)e[t++]=this.readCorner1(a,c)&255,n-=2,r+=2,d=!0;else if(n===a-2&&r===0&&c&3&&!g)e[t++]=this.readCorner2(a,c)&255,n-=2,r+=2,g=!0;else if(n===a+4&&r===2&&!(c&7)&&!w)e[t++]=this.readCorner3(a,c)&255,n-=2,r+=2,w=!0;else if(n===a-2&&r===0&&(c&7)===4&&!E)e[t++]=this.readCorner4(a,c)&255,n-=2,r+=2,E=!0;else{do n<a&&r>=0&&!this.readMappingMatrix.get(r,n)&&(e[t++]=this.readUtah(n,r,a,c)&255),n-=2,r+=2;while(n>=0&&r<c);n+=1,r+=3;do n>=0&&r<c&&!this.readMappingMatrix.get(r,n)&&(e[t++]=this.readUtah(n,r,a,c)&255),n+=2,r-=2;while(n<a&&r>=0);n+=3,r+=1}while(n<a||r<c);if(t!==this.version.getTotalCodewords())throw new z;return e}readModule(e,t,n,r){return e<0&&(e+=n,t+=4-(n+4&7)),t<0&&(t+=r,e+=4-(r+4&7)),this.readMappingMatrix.set(t,e),this.mappingBitMatrix.get(t,e)}readUtah(e,t,n,r){let a=0;return this.readModule(e-2,t-2,n,r)&&(a|=1),a<<=1,this.readModule(e-2,t-1,n,r)&&(a|=1),a<<=1,this.readModule(e-1,t-2,n,r)&&(a|=1),a<<=1,this.readModule(e-1,t-1,n,r)&&(a|=1),a<<=1,this.readModule(e-1,t,n,r)&&(a|=1),a<<=1,this.readModule(e,t-2,n,r)&&(a|=1),a<<=1,this.readModule(e,t-1,n,r)&&(a|=1),a<<=1,this.readModule(e,t,n,r)&&(a|=1),a}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 r=this.version.getDataRegionSizeRows(),a=this.version.getDataRegionSizeColumns(),c=t/r|0,d=n/a|0,g=c*r,w=d*a,E=new X(w,g);for(let A=0;A<c;++A){const I=A*r;for(let O=0;O<d;++O){const L=O*a;for(let F=0;F<r;++F){const Z=A*(r+2)+1+F,ne=I+F;for(let ce=0;ce<a;++ce){const ue=O*(a+2)+1+ce;if(e.get(ue,Z)){const ae=L+ce;E.set(ae,ne)}}}}}return E}}class ko{constructor(e,t){this.numDataCodewords=e,this.codewords=t}static getDataBlocks(e,t){const n=t.getECBlocks();let r=0;const a=n.getECBlocks();for(let F of a)r+=F.getCount();const c=new Array(r);let d=0;for(let F of a)for(let Z=0;Z<F.getCount();Z++){const ne=F.getDataCodewords(),ce=n.getECCodewords()+ne;c[d++]=new ko(ne,new Uint8Array(ce))}const w=c[0].codewords.length-n.getECCodewords(),E=w-1;let A=0;for(let F=0;F<E;F++)for(let Z=0;Z<d;Z++)c[Z].codewords[F]=e[A++];const I=t.getVersionNumber()===24,O=I?8:d;for(let F=0;F<O;F++)c[F].codewords[w-1]=e[A++];const L=c[0].codewords.length;for(let F=w;F<L;F++)for(let Z=0;Z<d;Z++){const ne=I?(Z+8)%d:Z,ce=I&&ne>7?F-1:F;c[ne].codewords[ce]=e[A++]}if(A!==e.length)throw new y;return c}getNumDataCodewords(){return this.numDataCodewords}getCodewords(){return this.codewords}}class Ro{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,r=this.byteOffset;const a=this.bytes;if(n>0){const c=8-n,d=e<c?e:c,g=c-d,w=255>>8-d<<g;t=(a[r]&w)>>g,e-=d,n+=d,n===8&&(n=0,r++)}if(e>0){for(;e>=8;)t=t<<8|a[r]&255,r++,e-=8;if(e>0){const c=8-e,d=255>>c<<c;t=t<<e|(a[r]&d)>>c,n+=e}}return this.bitOffset=n,this.byteOffset=r,t}available(){return 8*(this.bytes.length-this.byteOffset)-this.bitOffset}}var Tt;(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"})(Tt||(Tt={}));class Xn{static decode(e){const t=new Ro(e),n=new V,r=new V,a=new Array;let c=Tt.ASCII_ENCODE;do if(c===Tt.ASCII_ENCODE)c=this.decodeAsciiSegment(t,n,r);else{switch(c){case Tt.C40_ENCODE:this.decodeC40Segment(t,n);break;case Tt.TEXT_ENCODE:this.decodeTextSegment(t,n);break;case Tt.ANSIX12_ENCODE:this.decodeAnsiX12Segment(t,n);break;case Tt.EDIFACT_ENCODE:this.decodeEdifactSegment(t,n);break;case Tt.BASE256_ENCODE:this.decodeBase256Segment(t,n,a);break;default:throw new z}c=Tt.ASCII_ENCODE}while(c!==Tt.PAD_ENCODE&&t.available()>0);return r.length()>0&&n.append(r.toString()),new Oe(e,n.toString(),a.length===0?null:a,null)}static decodeAsciiSegment(e,t,n){let r=!1;do{let a=e.readBits(8);if(a===0)throw new z;if(a<=128)return r&&(a+=128),t.append(String.fromCharCode(a-1)),Tt.ASCII_ENCODE;if(a===129)return Tt.PAD_ENCODE;if(a<=229){const c=a-130;c<10&&t.append("0"),t.append(""+c)}else switch(a){case 230:return Tt.C40_ENCODE;case 231:return Tt.BASE256_ENCODE;case 232:t.append("");break;case 233:case 234:break;case 235:r=!0;break;case 236:t.append("[)>05"),n.insert(0,"");break;case 237:t.append("[)>06"),n.insert(0,"");break;case 238:return Tt.ANSIX12_ENCODE;case 239:return Tt.TEXT_ENCODE;case 240:return Tt.EDIFACT_ENCODE;case 241:break;default:if(a!==254||e.available()!==0)throw new z;break}}while(e.available()>0);return Tt.ASCII_ENCODE}static decodeC40Segment(e,t){let n=!1;const r=[];let a=0;do{if(e.available()===8)return;const c=e.readBits(8);if(c===254)return;this.parseTwoBytes(c,e.readBits(8),r);for(let d=0;d<3;d++){const g=r[d];switch(a){case 0:if(g<3)a=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 z;break;case 1:n?(t.append(String.fromCharCode(g+128)),n=!1):t.append(String.fromCharCode(g)),a=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 z}a=0;break;case 3:n?(t.append(String.fromCharCode(g+224)),n=!1):t.append(String.fromCharCode(g+96)),a=0;break;default:throw new z}}}while(e.available()>0)}static decodeTextSegment(e,t){let n=!1,r=[],a=0;do{if(e.available()===8)return;const c=e.readBits(8);if(c===254)return;this.parseTwoBytes(c,e.readBits(8),r);for(let d=0;d<3;d++){const g=r[d];switch(a){case 0:if(g<3)a=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 z;break;case 1:n?(t.append(String.fromCharCode(g+128)),n=!1):t.append(String.fromCharCode(g)),a=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 z}a=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),a=0}else throw new z;break;default:throw new z}}}while(e.available()>0)}static decodeAnsiX12Segment(e,t){const n=[];do{if(e.available()===8)return;const r=e.readBits(8);if(r===254)return;this.parseTwoBytes(r,e.readBits(8),n);for(let a=0;a<3;a++){const c=n[a];switch(c){case 0:t.append("\r");break;case 1:t.append("*");break;case 2:t.append(">");break;case 3:t.append(" ");break;default:if(c<14)t.append(String.fromCharCode(c+44));else if(c<40)t.append(String.fromCharCode(c+51));else throw new z;break}}}while(e.available()>0)}static parseTwoBytes(e,t,n){let r=(e<<8)+t-1,a=Math.floor(r/1600);n[0]=a,r-=a*1600,a=Math.floor(r/40),n[1]=a,n[2]=r-a*40}static decodeEdifactSegment(e,t){do{if(e.available()<=16)return;for(let n=0;n<4;n++){let r=e.readBits(6);if(r===31){const a=8-e.getBitOffset();a!==8&&e.readBits(a);return}r&32||(r|=64),t.append(String.fromCharCode(r))}}while(e.available()>0)}static decodeBase256Segment(e,t,n){let r=1+e.getByteOffset();const a=this.unrandomize255State(e.readBits(8),r++);let c;if(a===0?c=e.available()/8|0:a<250?c=a:c=250*(a-249)+this.unrandomize255State(e.readBits(8),r++),c<0)throw new z;const d=new Uint8Array(c);for(let g=0;g<c;g++){if(e.available()<8)throw new z;d[g]=this.unrandomize255State(e.readBits(8),r++)}n.push(d);try{t.append(j.decode(d,G.ISO88591))}catch(g){throw new nt("Platform does not support required encoding: "+g.message)}}static unrandomize255State(e,t){const n=149*t%255+1,r=e-n;return r>=0?r:r+256}}Xn.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"],Xn.C40_SHIFT2_SET_CHARS=["!",'"',"#","$","%","&","'","(",")","*","+",",","-",".","/",":",";","<","=",">","?","@","[","\\","]","^","_"],Xn.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"],Xn.TEXT_SHIFT2_SET_CHARS=Xn.C40_SHIFT2_SET_CHARS,Xn.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 dg{constructor(){this.rsDecoder=new jt(Ee.DATA_MATRIX_FIELD_256)}decode(e){const t=new To(e),n=t.getVersion(),r=t.readCodewords(),a=ko.getDataBlocks(r,n);let c=0;for(let w of a)c+=w.getNumDataCodewords();const d=new Uint8Array(c),g=a.length;for(let w=0;w<g;w++){const E=a[w],A=E.getCodewords(),I=E.getNumDataCodewords();this.correctErrors(A,I);for(let O=0;O<I;O++)d[O*g+w]=A[O]}return Xn.decode(d)}correctErrors(e,t){const n=new Int32Array(e);try{this.rsDecoder.decode(n,e.length-t)}catch{throw new M}for(let r=0;r<t;r++)e[r]=n[r]}}class bt{constructor(e){this.image=e,this.rectangleDetector=new bn(this.image)}detect(){const e=this.rectangleDetector.detect();let t=this.detectSolid1(e);if(t=this.detectSolid2(t),t[3]=this.correctTopRight(t),!t[3])throw new N;t=this.shiftToModuleCenter(t);const n=t[0],r=t[1],a=t[2],c=t[3];let d=this.transitionsBetween(n,c)+1,g=this.transitionsBetween(a,c)+1;(d&1)===1&&(d+=1),(g&1)===1&&(g+=1),4*d<7*g&&4*g<7*d&&(d=g=Math.max(d,g));let w=bt.sampleGrid(this.image,n,r,a,c,d,g);return new Er(w,[n,r,a,c])}static shiftPoint(e,t,n){let r=(t.getX()-e.getX())/(n+1),a=(t.getY()-e.getY())/(n+1);return new ye(e.getX()+r,e.getY()+a)}static moveAway(e,t,n){let r=e.getX(),a=e.getY();return r<t?r-=1:r+=1,a<n?a-=1:a+=1,new ye(r,a)}detectSolid1(e){let t=e[0],n=e[1],r=e[3],a=e[2],c=this.transitionsBetween(t,n),d=this.transitionsBetween(n,r),g=this.transitionsBetween(r,a),w=this.transitionsBetween(a,t),E=c,A=[a,t,n,r];return E>d&&(E=d,A[0]=t,A[1]=n,A[2]=r,A[3]=a),E>g&&(E=g,A[0]=n,A[1]=r,A[2]=a,A[3]=t),E>w&&(A[0]=r,A[1]=a,A[2]=t,A[3]=n),A}detectSolid2(e){let t=e[0],n=e[1],r=e[2],a=e[3],c=this.transitionsBetween(t,a),d=bt.shiftPoint(n,r,(c+1)*4),g=bt.shiftPoint(r,n,(c+1)*4),w=this.transitionsBetween(d,t),E=this.transitionsBetween(g,a);return w<E?(e[0]=t,e[1]=n,e[2]=r,e[3]=a):(e[0]=n,e[1]=r,e[2]=a,e[3]=t),e}correctTopRight(e){let t=e[0],n=e[1],r=e[2],a=e[3],c=this.transitionsBetween(t,a),d=this.transitionsBetween(n,a),g=bt.shiftPoint(t,n,(d+1)*4),w=bt.shiftPoint(r,n,(c+1)*4);c=this.transitionsBetween(g,a),d=this.transitionsBetween(w,a);let E=new ye(a.getX()+(r.getX()-n.getX())/(c+1),a.getY()+(r.getY()-n.getY())/(c+1)),A=new ye(a.getX()+(t.getX()-n.getX())/(d+1),a.getY()+(t.getY()-n.getY())/(d+1));if(!this.isValid(E))return this.isValid(A)?A:null;if(!this.isValid(A))return E;let I=this.transitionsBetween(g,E)+this.transitionsBetween(w,E),O=this.transitionsBetween(g,A)+this.transitionsBetween(w,A);return I>O?E:A}shiftToModuleCenter(e){let t=e[0],n=e[1],r=e[2],a=e[3],c=this.transitionsBetween(t,a)+1,d=this.transitionsBetween(r,a)+1,g=bt.shiftPoint(t,n,d*4),w=bt.shiftPoint(r,n,c*4);c=this.transitionsBetween(g,a)+1,d=this.transitionsBetween(w,a)+1,(c&1)===1&&(c+=1),(d&1)===1&&(d+=1);let E=(t.getX()+n.getX()+r.getX()+a.getX())/4,A=(t.getY()+n.getY()+r.getY()+a.getY())/4;t=bt.moveAway(t,E,A),n=bt.moveAway(n,E,A),r=bt.moveAway(r,E,A),a=bt.moveAway(a,E,A);let I,O;return g=bt.shiftPoint(t,n,d*4),g=bt.shiftPoint(g,a,c*4),I=bt.shiftPoint(n,t,d*4),I=bt.shiftPoint(I,r,c*4),w=bt.shiftPoint(r,a,d*4),w=bt.shiftPoint(w,n,c*4),O=bt.shiftPoint(a,r,d*4),O=bt.shiftPoint(O,t,c*4),[g,I,w,O]}isValid(e){return e.getX()>=0&&e.getX()<this.image.getWidth()&&e.getY()>0&&e.getY()<this.image.getHeight()}static sampleGrid(e,t,n,r,a,c,d){return dn.getInstance().sampleGrid(e,c,d,.5,.5,c-.5,.5,c-.5,d-.5,.5,d-.5,t.getX(),t.getY(),a.getX(),a.getY(),r.getX(),r.getY(),n.getX(),n.getY())}transitionsBetween(e,t){let n=Math.trunc(e.getX()),r=Math.trunc(e.getY()),a=Math.trunc(t.getX()),c=Math.trunc(t.getY()),d=Math.abs(c-r)>Math.abs(a-n);if(d){let F=n;n=r,r=F,F=a,a=c,c=F}let g=Math.abs(a-n),w=Math.abs(c-r),E=-g/2,A=r<c?1:-1,I=n<a?1:-1,O=0,L=this.image.get(d?r:n,d?n:r);for(let F=n,Z=r;F!==a;F+=I){let ne=this.image.get(d?Z:F,d?F:Z);if(ne!==L&&(O++,L=ne),E+=w,E>0){if(Z===c)break;Z+=A,E-=g}}return O}}class jn{constructor(){this.decoder=new dg}decode(e,t=null){let n,r;if(t!=null&&t.has(te.PURE_BARCODE)){const w=jn.extractPureBits(e.getBlackMatrix());n=this.decoder.decode(w),r=jn.NO_POINTS}else{const w=new bt(e.getBlackMatrix()).detect();n=this.decoder.decode(w.getBits()),r=w.getPoints()}const a=n.getRawBytes(),c=new _e(n.getText(),a,8*a.length,r,he.DATA_MATRIX,P.currentTimeMillis()),d=n.getByteSegments();d!=null&&c.putMetadata(Xe.BYTE_SEGMENTS,d);const g=n.getECLevel();return g!=null&&c.putMetadata(Xe.ERROR_CORRECTION_LEVEL,g),c}reset(){}static extractPureBits(e){const t=e.getTopLeftOnBit(),n=e.getBottomRightOnBit();if(t==null||n==null)throw new N;const r=this.moduleSize(t,e);let a=t[1];const c=n[1];let d=t[0];const w=(n[0]-d+1)/r,E=(c-a+1)/r;if(w<=0||E<=0)throw new N;const A=r/2;a+=A,d+=A;const I=new X(w,E);for(let O=0;O<E;O++){const L=a+O*r;for(let F=0;F<w;F++)e.get(d+F*r,L)&&I.set(F,O)}return I}static moduleSize(e,t){const n=t.getWidth();let r=e[0];const a=e[1];for(;r<n&&t.get(r,a);)r++;if(r===n)throw new N;const c=r-e[0];if(c===0)throw new N;return c}}jn.NO_POINTS=[];class fg extends Ne{constructor(e=500){super(new jn,e)}}var Ir;(function(b){b[b.L=0]="L",b[b.M=1]="M",b[b.Q=2]="Q",b[b.H=3]="H"})(Ir||(Ir={}));class ct{constructor(e,t,n){this.value=e,this.stringValue=t,this.bits=n,ct.FOR_BITS.set(n,this),ct.FOR_VALUE.set(e,this)}getValue(){return this.value}getBits(){return this.bits}static fromString(e){switch(e){case"L":return ct.L;case"M":return ct.M;case"Q":return ct.Q;case"H":return ct.H;default:throw new C(e+"not available")}}toString(){return this.stringValue}equals(e){if(!(e instanceof ct))return!1;const t=e;return this.value===t.value}static forBits(e){if(e<0||e>=ct.FOR_BITS.size)throw new y;return ct.FOR_BITS.get(e)}}ct.FOR_BITS=new Map,ct.FOR_VALUE=new Map,ct.L=new ct(Ir.L,"L",1),ct.M=new ct(Ir.M,"M",0),ct.Q=new ct(Ir.Q,"Q",3),ct.H=new ct(Ir.H,"H",2);class Gt{constructor(e){this.errorCorrectionLevel=ct.forBits(e>>3&3),this.dataMask=e&7}static numBitsDiffering(e,t){return R.bitCount(e^t)}static decodeFormatInformation(e,t){const n=Gt.doDecodeFormatInformation(e,t);return n!==null?n:Gt.doDecodeFormatInformation(e^Gt.FORMAT_INFO_MASK_QR,t^Gt.FORMAT_INFO_MASK_QR)}static doDecodeFormatInformation(e,t){let n=Number.MAX_SAFE_INTEGER,r=0;for(const a of Gt.FORMAT_INFO_DECODE_LOOKUP){const c=a[0];if(c===e||c===t)return new Gt(a[1]);let d=Gt.numBitsDiffering(e,c);d<n&&(r=a[1],n=d),e!==t&&(d=Gt.numBitsDiffering(t,c),d<n&&(r=a[1],n=d))}return n<=3?new Gt(r):null}getErrorCorrectionLevel(){return this.errorCorrectionLevel}getDataMask(){return this.dataMask}hashCode(){return this.errorCorrectionLevel.getBits()<<3|this.dataMask}equals(e){if(!(e instanceof Gt))return!1;const t=e;return this.errorCorrectionLevel===t.errorCorrectionLevel&&this.dataMask===t.dataMask}}Gt.FORMAT_INFO_MASK_QR=21522,Gt.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 Y{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 T{constructor(e,t){this.count=e,this.dataCodewords=t}getCount(){return this.count}getDataCodewords(){return this.dataCodewords}}class Ie{constructor(e,t,...n){this.versionNumber=e,this.alignmentPatternCenters=t,this.ecBlocks=n;let r=0;const a=n[0].getECCodewordsPerBlock(),c=n[0].getECBlocks();for(const d of c)r+=d.getCount()*(d.getDataCodewords()+a);this.totalCodewords=r}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 z;try{return this.getVersionForNumber((e-17)/4)}catch{throw new z}}static getVersionForNumber(e){if(e<1||e>40)throw new y;return Ie.VERSIONS[e-1]}static decodeVersionInformation(e){let t=Number.MAX_SAFE_INTEGER,n=0;for(let r=0;r<Ie.VERSION_DECODE_INFO.length;r++){const a=Ie.VERSION_DECODE_INFO[r];if(a===e)return Ie.getVersionForNumber(r+7);const c=Gt.numBitsDiffering(e,a);c<t&&(n=r+7,t=c)}return t<=3?Ie.getVersionForNumber(n):null}buildFunctionPattern(){const e=this.getDimensionForVersion(),t=new X(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 r=0;r<n;r++){const a=this.alignmentPatternCenters[r]-2;for(let c=0;c<n;c++)r===0&&(c===0||c===n-1)||r===n-1&&c===0||t.setRegion(this.alignmentPatternCenters[c]-2,a,5,5)}return t.setRegion(6,9,1,e-17),t.setRegion(9,6,e-17,1),this.versionNumber>6&&(t.setRegion(e-11,0,3,6),t.setRegion(0,e-11,6,3)),t}toString(){return""+this.versionNumber}}Ie.VERSION_DECODE_INFO=Int32Array.from([31892,34236,39577,42195,48118,51042,55367,58893,63784,68472,70749,76311,79154,84390,87683,92361,96236,102084,102881,110507,110734,117786,119615,126325,127568,133589,136944,141498,145311,150283,152622,158308,161089,167017]),Ie.VERSIONS=[new Ie(1,new Int32Array(0),new Y(7,new T(1,19)),new Y(10,new T(1,16)),new Y(13,new T(1,13)),new Y(17,new T(1,9))),new Ie(2,Int32Array.from([6,18]),new Y(10,new T(1,34)),new Y(16,new T(1,28)),new Y(22,new T(1,22)),new Y(28,new T(1,16))),new Ie(3,Int32Array.from([6,22]),new Y(15,new T(1,55)),new Y(26,new T(1,44)),new Y(18,new T(2,17)),new Y(22,new T(2,13))),new Ie(4,Int32Array.from([6,26]),new Y(20,new T(1,80)),new Y(18,new T(2,32)),new Y(26,new T(2,24)),new Y(16,new T(4,9))),new Ie(5,Int32Array.from([6,30]),new Y(26,new T(1,108)),new Y(24,new T(2,43)),new Y(18,new T(2,15),new T(2,16)),new Y(22,new T(2,11),new T(2,12))),new Ie(6,Int32Array.from([6,34]),new Y(18,new T(2,68)),new Y(16,new T(4,27)),new Y(24,new T(4,19)),new Y(28,new T(4,15))),new Ie(7,Int32Array.from([6,22,38]),new Y(20,new T(2,78)),new Y(18,new T(4,31)),new Y(18,new T(2,14),new T(4,15)),new Y(26,new T(4,13),new T(1,14))),new Ie(8,Int32Array.from([6,24,42]),new Y(24,new T(2,97)),new Y(22,new T(2,38),new T(2,39)),new Y(22,new T(4,18),new T(2,19)),new Y(26,new T(4,14),new T(2,15))),new Ie(9,Int32Array.from([6,26,46]),new Y(30,new T(2,116)),new Y(22,new T(3,36),new T(2,37)),new Y(20,new T(4,16),new T(4,17)),new Y(24,new T(4,12),new T(4,13))),new Ie(10,Int32Array.from([6,28,50]),new Y(18,new T(2,68),new T(2,69)),new Y(26,new T(4,43),new T(1,44)),new Y(24,new T(6,19),new T(2,20)),new Y(28,new T(6,15),new T(2,16))),new Ie(11,Int32Array.from([6,30,54]),new Y(20,new T(4,81)),new Y(30,new T(1,50),new T(4,51)),new Y(28,new T(4,22),new T(4,23)),new Y(24,new T(3,12),new T(8,13))),new Ie(12,Int32Array.from([6,32,58]),new Y(24,new T(2,92),new T(2,93)),new Y(22,new T(6,36),new T(2,37)),new Y(26,new T(4,20),new T(6,21)),new Y(28,new T(7,14),new T(4,15))),new Ie(13,Int32Array.from([6,34,62]),new Y(26,new T(4,107)),new Y(22,new T(8,37),new T(1,38)),new Y(24,new T(8,20),new T(4,21)),new Y(22,new T(12,11),new T(4,12))),new Ie(14,Int32Array.from([6,26,46,66]),new Y(30,new T(3,115),new T(1,116)),new Y(24,new T(4,40),new T(5,41)),new Y(20,new T(11,16),new T(5,17)),new Y(24,new T(11,12),new T(5,13))),new Ie(15,Int32Array.from([6,26,48,70]),new Y(22,new T(5,87),new T(1,88)),new Y(24,new T(5,41),new T(5,42)),new Y(30,new T(5,24),new T(7,25)),new Y(24,new T(11,12),new T(7,13))),new Ie(16,Int32Array.from([6,26,50,74]),new Y(24,new T(5,98),new T(1,99)),new Y(28,new T(7,45),new T(3,46)),new Y(24,new T(15,19),new T(2,20)),new Y(30,new T(3,15),new T(13,16))),new Ie(17,Int32Array.from([6,30,54,78]),new Y(28,new T(1,107),new T(5,108)),new Y(28,new T(10,46),new T(1,47)),new Y(28,new T(1,22),new T(15,23)),new Y(28,new T(2,14),new T(17,15))),new Ie(18,Int32Array.from([6,30,56,82]),new Y(30,new T(5,120),new T(1,121)),new Y(26,new T(9,43),new T(4,44)),new Y(28,new T(17,22),new T(1,23)),new Y(28,new T(2,14),new T(19,15))),new Ie(19,Int32Array.from([6,30,58,86]),new Y(28,new T(3,113),new T(4,114)),new Y(26,new T(3,44),new T(11,45)),new Y(26,new T(17,21),new T(4,22)),new Y(26,new T(9,13),new T(16,14))),new Ie(20,Int32Array.from([6,34,62,90]),new Y(28,new T(3,107),new T(5,108)),new Y(26,new T(3,41),new T(13,42)),new Y(30,new T(15,24),new T(5,25)),new Y(28,new T(15,15),new T(10,16))),new Ie(21,Int32Array.from([6,28,50,72,94]),new Y(28,new T(4,116),new T(4,117)),new Y(26,new T(17,42)),new Y(28,new T(17,22),new T(6,23)),new Y(30,new T(19,16),new T(6,17))),new Ie(22,Int32Array.from([6,26,50,74,98]),new Y(28,new T(2,111),new T(7,112)),new Y(28,new T(17,46)),new Y(30,new T(7,24),new T(16,25)),new Y(24,new T(34,13))),new Ie(23,Int32Array.from([6,30,54,78,102]),new Y(30,new T(4,121),new T(5,122)),new Y(28,new T(4,47),new T(14,48)),new Y(30,new T(11,24),new T(14,25)),new Y(30,new T(16,15),new T(14,16))),new Ie(24,Int32Array.from([6,28,54,80,106]),new Y(30,new T(6,117),new T(4,118)),new Y(28,new T(6,45),new T(14,46)),new Y(30,new T(11,24),new T(16,25)),new Y(30,new T(30,16),new T(2,17))),new Ie(25,Int32Array.from([6,32,58,84,110]),new Y(26,new T(8,106),new T(4,107)),new Y(28,new T(8,47),new T(13,48)),new Y(30,new T(7,24),new T(22,25)),new Y(30,new T(22,15),new T(13,16))),new Ie(26,Int32Array.from([6,30,58,86,114]),new Y(28,new T(10,114),new T(2,115)),new Y(28,new T(19,46),new T(4,47)),new Y(28,new T(28,22),new T(6,23)),new Y(30,new T(33,16),new T(4,17))),new Ie(27,Int32Array.from([6,34,62,90,118]),new Y(30,new T(8,122),new T(4,123)),new Y(28,new T(22,45),new T(3,46)),new Y(30,new T(8,23),new T(26,24)),new Y(30,new T(12,15),new T(28,16))),new Ie(28,Int32Array.from([6,26,50,74,98,122]),new Y(30,new T(3,117),new T(10,118)),new Y(28,new T(3,45),new T(23,46)),new Y(30,new T(4,24),new T(31,25)),new Y(30,new T(11,15),new T(31,16))),new Ie(29,Int32Array.from([6,30,54,78,102,126]),new Y(30,new T(7,116),new T(7,117)),new Y(28,new T(21,45),new T(7,46)),new Y(30,new T(1,23),new T(37,24)),new Y(30,new T(19,15),new T(26,16))),new Ie(30,Int32Array.from([6,26,52,78,104,130]),new Y(30,new T(5,115),new T(10,116)),new Y(28,new T(19,47),new T(10,48)),new Y(30,new T(15,24),new T(25,25)),new Y(30,new T(23,15),new T(25,16))),new Ie(31,Int32Array.from([6,30,56,82,108,134]),new Y(30,new T(13,115),new T(3,116)),new Y(28,new T(2,46),new T(29,47)),new Y(30,new T(42,24),new T(1,25)),new Y(30,new T(23,15),new T(28,16))),new Ie(32,Int32Array.from([6,34,60,86,112,138]),new Y(30,new T(17,115)),new Y(28,new T(10,46),new T(23,47)),new Y(30,new T(10,24),new T(35,25)),new Y(30,new T(19,15),new T(35,16))),new Ie(33,Int32Array.from([6,30,58,86,114,142]),new Y(30,new T(17,115),new T(1,116)),new Y(28,new T(14,46),new T(21,47)),new Y(30,new T(29,24),new T(19,25)),new Y(30,new T(11,15),new T(46,16))),new Ie(34,Int32Array.from([6,34,62,90,118,146]),new Y(30,new T(13,115),new T(6,116)),new Y(28,new T(14,46),new T(23,47)),new Y(30,new T(44,24),new T(7,25)),new Y(30,new T(59,16),new T(1,17))),new Ie(35,Int32Array.from([6,30,54,78,102,126,150]),new Y(30,new T(12,121),new T(7,122)),new Y(28,new T(12,47),new T(26,48)),new Y(30,new T(39,24),new T(14,25)),new Y(30,new T(22,15),new T(41,16))),new Ie(36,Int32Array.from([6,24,50,76,102,128,154]),new Y(30,new T(6,121),new T(14,122)),new Y(28,new T(6,47),new T(34,48)),new Y(30,new T(46,24),new T(10,25)),new Y(30,new T(2,15),new T(64,16))),new Ie(37,Int32Array.from([6,28,54,80,106,132,158]),new Y(30,new T(17,122),new T(4,123)),new Y(28,new T(29,46),new T(14,47)),new Y(30,new T(49,24),new T(10,25)),new Y(30,new T(24,15),new T(46,16))),new Ie(38,Int32Array.from([6,32,58,84,110,136,162]),new Y(30,new T(4,122),new T(18,123)),new Y(28,new T(13,46),new T(32,47)),new Y(30,new T(48,24),new T(14,25)),new Y(30,new T(42,15),new T(32,16))),new Ie(39,Int32Array.from([6,26,54,82,110,138,166]),new Y(30,new T(20,117),new T(4,118)),new Y(28,new T(40,47),new T(7,48)),new Y(30,new T(43,24),new T(22,25)),new Y(30,new T(10,15),new T(67,16))),new Ie(40,Int32Array.from([6,30,58,86,114,142,170]),new Y(30,new T(19,118),new T(6,119)),new Y(28,new T(18,47),new T(31,48)),new Y(30,new T(34,24),new T(34,25)),new Y(30,new T(20,15),new T(61,16)))];var Mt;(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"})(Mt||(Mt={}));class hn{constructor(e,t){this.value=e,this.isMasked=t}unmaskBitMatrix(e,t){for(let n=0;n<t;n++)for(let r=0;r<t;r++)this.isMasked(n,r)&&e.flip(r,n)}}hn.values=new Map([[Mt.DATA_MASK_000,new hn(Mt.DATA_MASK_000,(b,e)=>(b+e&1)===0)],[Mt.DATA_MASK_001,new hn(Mt.DATA_MASK_001,(b,e)=>(b&1)===0)],[Mt.DATA_MASK_010,new hn(Mt.DATA_MASK_010,(b,e)=>e%3===0)],[Mt.DATA_MASK_011,new hn(Mt.DATA_MASK_011,(b,e)=>(b+e)%3===0)],[Mt.DATA_MASK_100,new hn(Mt.DATA_MASK_100,(b,e)=>(Math.floor(b/2)+Math.floor(e/3)&1)===0)],[Mt.DATA_MASK_101,new hn(Mt.DATA_MASK_101,(b,e)=>b*e%6===0)],[Mt.DATA_MASK_110,new hn(Mt.DATA_MASK_110,(b,e)=>b*e%6<3)],[Mt.DATA_MASK_111,new hn(Mt.DATA_MASK_111,(b,e)=>(b+e+b*e%3&1)===0)]]);class hg{constructor(e){const t=e.getHeight();if(t<21||(t&3)!==1)throw new z;this.bitMatrix=e}readFormatInformation(){if(this.parsedFormatInfo!==null&&this.parsedFormatInfo!==void 0)return this.parsedFormatInfo;let e=0;for(let a=0;a<6;a++)e=this.copyBit(a,8,e);e=this.copyBit(7,8,e),e=this.copyBit(8,8,e),e=this.copyBit(8,7,e);for(let a=5;a>=0;a--)e=this.copyBit(8,a,e);const t=this.bitMatrix.getHeight();let n=0;const r=t-7;for(let a=t-1;a>=r;a--)n=this.copyBit(8,a,n);for(let a=t-8;a<t;a++)n=this.copyBit(a,8,n);if(this.parsedFormatInfo=Gt.decodeFormatInformation(e,n),this.parsedFormatInfo!==null)return this.parsedFormatInfo;throw new z}readVersion(){if(this.parsedVersion!==null&&this.parsedVersion!==void 0)return this.parsedVersion;const e=this.bitMatrix.getHeight(),t=Math.floor((e-17)/4);if(t<=6)return Ie.getVersionForNumber(t);let n=0;const r=e-11;for(let c=5;c>=0;c--)for(let d=e-9;d>=r;d--)n=this.copyBit(d,c,n);let a=Ie.decodeVersionInformation(n);if(a!==null&&a.getDimensionForVersion()===e)return this.parsedVersion=a,a;n=0;for(let c=5;c>=0;c--)for(let d=e-9;d>=r;d--)n=this.copyBit(c,d,n);if(a=Ie.decodeVersionInformation(n),a!==null&&a.getDimensionForVersion()===e)return this.parsedVersion=a,a;throw new z}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=hn.values.get(e.getDataMask()),r=this.bitMatrix.getHeight();n.unmaskBitMatrix(this.bitMatrix,r);const a=t.buildFunctionPattern();let c=!0;const d=new Uint8Array(t.getTotalCodewords());let g=0,w=0,E=0;for(let A=r-1;A>0;A-=2){A===6&&A--;for(let I=0;I<r;I++){const O=c?r-1-I:I;for(let L=0;L<2;L++)a.get(A-L,O)||(E++,w<<=1,this.bitMatrix.get(A-L,O)&&(w|=1),E===8&&(d[g++]=w,E=0,w=0))}c=!c}if(g!==t.getTotalCodewords())throw new z;return d}remask(){if(this.parsedFormatInfo===null)return;const e=hn.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 r=t+1,a=e.getHeight();r<a;r++)e.get(t,r)!==e.get(r,t)&&(e.flip(r,t),e.flip(t,r))}}class Oo{constructor(e,t){this.numDataCodewords=e,this.codewords=t}static getDataBlocks(e,t,n){if(e.length!==t.getTotalCodewords())throw new y;const r=t.getECBlocksForLevel(n);let a=0;const c=r.getECBlocks();for(const L of c)a+=L.getCount();const d=new Array(a);let g=0;for(const L of c)for(let F=0;F<L.getCount();F++){const Z=L.getDataCodewords(),ne=r.getECCodewordsPerBlock()+Z;d[g++]=new Oo(Z,new Uint8Array(ne))}const w=d[0].codewords.length;let E=d.length-1;for(;E>=0&&d[E].codewords.length!==w;)E--;E++;const A=w-r.getECCodewordsPerBlock();let I=0;for(let L=0;L<A;L++)for(let F=0;F<g;F++)d[F].codewords[L]=e[I++];for(let L=E;L<g;L++)d[L].codewords[A]=e[I++];const O=d[0].codewords.length;for(let L=A;L<O;L++)for(let F=0;F<g;F++){const Z=F<E?L:L+1;d[F].codewords[Z]=e[I++]}return d}getNumDataCodewords(){return this.numDataCodewords}getCodewords(){return this.codewords}}var gn;(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"})(gn||(gn={}));class Se{constructor(e,t,n,r){this.value=e,this.stringValue=t,this.characterCountBitsForVersions=n,this.bits=r,Se.FOR_BITS.set(r,this),Se.FOR_VALUE.set(e,this)}static forBits(e){const t=Se.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 Se))return!1;const t=e;return this.value===t.value}toString(){return this.stringValue}}Se.FOR_BITS=new Map,Se.FOR_VALUE=new Map,Se.TERMINATOR=new Se(gn.TERMINATOR,"TERMINATOR",Int32Array.from([0,0,0]),0),Se.NUMERIC=new Se(gn.NUMERIC,"NUMERIC",Int32Array.from([10,12,14]),1),Se.ALPHANUMERIC=new Se(gn.ALPHANUMERIC,"ALPHANUMERIC",Int32Array.from([9,11,13]),2),Se.STRUCTURED_APPEND=new Se(gn.STRUCTURED_APPEND,"STRUCTURED_APPEND",Int32Array.from([0,0,0]),3),Se.BYTE=new Se(gn.BYTE,"BYTE",Int32Array.from([8,16,16]),4),Se.ECI=new Se(gn.ECI,"ECI",Int32Array.from([0,0,0]),7),Se.KANJI=new Se(gn.KANJI,"KANJI",Int32Array.from([8,10,12]),8),Se.FNC1_FIRST_POSITION=new Se(gn.FNC1_FIRST_POSITION,"FNC1_FIRST_POSITION",Int32Array.from([0,0,0]),5),Se.FNC1_SECOND_POSITION=new Se(gn.FNC1_SECOND_POSITION,"FNC1_SECOND_POSITION",Int32Array.from([0,0,0]),9),Se.HANZI=new Se(gn.HANZI,"HANZI",Int32Array.from([8,10,12]),13);class wt{static decode(e,t,n,r){const a=new Ro(e);let c=new V;const d=new Array;let g=-1,w=-1;try{let E=null,A=!1,I;do{if(a.available()<4)I=Se.TERMINATOR;else{const O=a.readBits(4);I=Se.forBits(O)}switch(I){case Se.TERMINATOR:break;case Se.FNC1_FIRST_POSITION:case Se.FNC1_SECOND_POSITION:A=!0;break;case Se.STRUCTURED_APPEND:if(a.available()<16)throw new z;g=a.readBits(8),w=a.readBits(8);break;case Se.ECI:const O=wt.parseECIValue(a);if(E=W.getCharacterSetECIByValue(O),E===null)throw new z;break;case Se.HANZI:const L=a.readBits(4),F=a.readBits(I.getCharacterCountBits(t));L===wt.GB2312_SUBSET&&wt.decodeHanziSegment(a,c,F);break;default:const Z=a.readBits(I.getCharacterCountBits(t));switch(I){case Se.NUMERIC:wt.decodeNumericSegment(a,c,Z);break;case Se.ALPHANUMERIC:wt.decodeAlphanumericSegment(a,c,Z,A);break;case Se.BYTE:wt.decodeByteSegment(a,c,Z,E,d,r);break;case Se.KANJI:wt.decodeKanjiSegment(a,c,Z);break;default:throw new z}break}}while(I!==Se.TERMINATOR)}catch{throw new z}return new Oe(e,c.toString(),d.length===0?null:d,n===null?null:n.toString(),g,w)}static decodeHanziSegment(e,t,n){if(n*13>e.available())throw new z;const r=new Uint8Array(2*n);let a=0;for(;n>0;){const c=e.readBits(13);let d=c/96<<8&4294967295|c%96;d<959?d+=41377:d+=42657,r[a]=d>>8&255,r[a+1]=d&255,a+=2,n--}try{t.append(j.decode(r,G.GB2312))}catch(c){throw new z(c)}}static decodeKanjiSegment(e,t,n){if(n*13>e.available())throw new z;const r=new Uint8Array(2*n);let a=0;for(;n>0;){const c=e.readBits(13);let d=c/192<<8&4294967295|c%192;d<7936?d+=33088:d+=49472,r[a]=d>>8,r[a+1]=d,a+=2,n--}try{t.append(j.decode(r,G.SHIFT_JIS))}catch(c){throw new z(c)}}static decodeByteSegment(e,t,n,r,a,c){if(8*n>e.available())throw new z;const d=new Uint8Array(n);for(let w=0;w<n;w++)d[w]=e.readBits(8);let g;r===null?g=G.guessEncoding(d,c):g=r.getName();try{t.append(j.decode(d,g))}catch(w){throw new z(w)}a.push(d)}static toAlphaNumericChar(e){if(e>=wt.ALPHANUMERIC_CHARS.length)throw new z;return wt.ALPHANUMERIC_CHARS[e]}static decodeAlphanumericSegment(e,t,n,r){const a=t.length();for(;n>1;){if(e.available()<11)throw new z;const c=e.readBits(11);t.append(wt.toAlphaNumericChar(Math.floor(c/45))),t.append(wt.toAlphaNumericChar(c%45)),n-=2}if(n===1){if(e.available()<6)throw new z;t.append(wt.toAlphaNumericChar(e.readBits(6)))}if(r)for(let c=a;c<t.length();c++)t.charAt(c)==="%"&&(c<t.length()-1&&t.charAt(c+1)==="%"?t.deleteCharAt(c+1):t.setCharAt(c,""))}static decodeNumericSegment(e,t,n){for(;n>=3;){if(e.available()<10)throw new z;const r=e.readBits(10);if(r>=1e3)throw new z;t.append(wt.toAlphaNumericChar(Math.floor(r/100))),t.append(wt.toAlphaNumericChar(Math.floor(r/10)%10)),t.append(wt.toAlphaNumericChar(r%10)),n-=3}if(n===2){if(e.available()<7)throw new z;const r=e.readBits(7);if(r>=100)throw new z;t.append(wt.toAlphaNumericChar(Math.floor(r/10))),t.append(wt.toAlphaNumericChar(r%10))}else if(n===1){if(e.available()<4)throw new z;const r=e.readBits(4);if(r>=10)throw new z;t.append(wt.toAlphaNumericChar(r))}}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 z}}wt.ALPHANUMERIC_CHARS="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:",wt.GB2312_SUBSET=1;class za{constructor(e){this.mirrored=e}isMirrored(){return this.mirrored}applyMirroredCorrection(e){if(!this.mirrored||e===null||e.length<3)return;const t=e[0];e[0]=e[2],e[2]=t}}class gg{constructor(){this.rsDecoder=new jt(Ee.QR_CODE_FIELD_256)}decodeBooleanArray(e,t){return this.decodeBitMatrix(X.parseFromBooleanArray(e),t)}decodeBitMatrix(e,t){const n=new hg(e);let r=null;try{return this.decodeBitMatrixParser(n,t)}catch(a){r=a}try{n.remask(),n.setMirror(!0),n.readVersion(),n.readFormatInformation(),n.mirror();const a=this.decodeBitMatrixParser(n,t);return a.setOther(new za(!0)),a}catch(a){throw r!==null?r:a}}decodeBitMatrixParser(e,t){const n=e.readVersion(),r=e.readFormatInformation().getErrorCorrectionLevel(),a=e.readCodewords(),c=Oo.getDataBlocks(a,n,r);let d=0;for(const E of c)d+=E.getNumDataCodewords();const g=new Uint8Array(d);let w=0;for(const E of c){const A=E.getCodewords(),I=E.getNumDataCodewords();this.correctErrors(A,I);for(let O=0;O<I;O++)g[w++]=A[O]}return wt.decode(g,n,r,t)}correctErrors(e,t){const n=new Int32Array(e);try{this.rsDecoder.decode(n,e.length-t)}catch{throw new M}for(let r=0;r<t;r++)e[r]=n[r]}}class Bo 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 r=Math.abs(e-this.estimatedModuleSize);return r<=1||r<=this.estimatedModuleSize}return!1}combineEstimate(e,t,n){const r=(this.getX()+t)/2,a=(this.getY()+e)/2,c=(this.estimatedModuleSize+n)/2;return new Bo(r,a,c)}}class Ti{constructor(e,t,n,r,a,c,d){this.image=e,this.startX=t,this.startY=n,this.width=r,this.height=a,this.moduleSize=c,this.resultPointCallback=d,this.possibleCenters=[],this.crossCheckStateCount=new Int32Array(3)}find(){const e=this.startX,t=this.height,n=this.width,r=e+n,a=this.startY+t/2,c=new Int32Array(3),d=this.image;for(let g=0;g<t;g++){const w=a+(g&1?-Math.floor((g+1)/2):Math.floor((g+1)/2));c[0]=0,c[1]=0,c[2]=0;let E=e;for(;E<r&&!d.get(E,w);)E++;let A=0;for(;E<r;){if(d.get(E,w))if(A===1)c[1]++;else if(A===2){if(this.foundPatternCross(c)){const I=this.handlePossibleCenter(c,w,E);if(I!==null)return I}c[0]=c[2],c[1]=1,c[2]=0,A=1}else c[++A]++;else A===1&&A++,c[A]++;E++}if(this.foundPatternCross(c)){const I=this.handlePossibleCenter(c,w,r);if(I!==null)return I}}if(this.possibleCenters.length!==0)return this.possibleCenters[0];throw new N}static centerFromEnd(e,t){return t-e[2]-e[1]/2}foundPatternCross(e){const t=this.moduleSize,n=t/2;for(let r=0;r<3;r++)if(Math.abs(t-e[r])>=n)return!1;return!0}crossCheckVertical(e,t,n,r){const a=this.image,c=a.getHeight(),d=this.crossCheckStateCount;d[0]=0,d[1]=0,d[2]=0;let g=e;for(;g>=0&&a.get(t,g)&&d[1]<=n;)d[1]++,g--;if(g<0||d[1]>n)return NaN;for(;g>=0&&!a.get(t,g)&&d[0]<=n;)d[0]++,g--;if(d[0]>n)return NaN;for(g=e+1;g<c&&a.get(t,g)&&d[1]<=n;)d[1]++,g++;if(g===c||d[1]>n)return NaN;for(;g<c&&!a.get(t,g)&&d[2]<=n;)d[2]++,g++;if(d[2]>n)return NaN;const w=d[0]+d[1]+d[2];return 5*Math.abs(w-r)>=2*r?NaN:this.foundPatternCross(d)?Ti.centerFromEnd(d,g):NaN}handlePossibleCenter(e,t,n){const r=e[0]+e[1]+e[2],a=Ti.centerFromEnd(e,n),c=this.crossCheckVertical(t,a,2*e[1],r);if(!isNaN(c)){const d=(e[0]+e[1]+e[2])/3;for(const w of this.possibleCenters)if(w.aboutEquals(d,c,a))return w.combineEstimate(c,a,d);const g=new Bo(a,c,d);this.possibleCenters.push(g),this.resultPointCallback!==null&&this.resultPointCallback!==void 0&&this.resultPointCallback.foundPossibleResultPoint(g)}return null}}class Mo extends ye{constructor(e,t,n,r){super(e,t),this.estimatedModuleSize=n,this.count=r,r===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 r=Math.abs(e-this.estimatedModuleSize);return r<=1||r<=this.estimatedModuleSize}return!1}combineEstimate(e,t,n){const r=this.count+1,a=(this.count*this.getX()+t)/r,c=(this.count*this.getY()+e)/r,d=(this.count*this.estimatedModuleSize+n)/r;return new Mo(a,c,d,r)}}class mg{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(te.TRY_HARDER)!==void 0,n=e!=null&&e.get(te.PURE_BARCODE)!==void 0,r=this.image,a=r.getHeight(),c=r.getWidth();let d=Math.floor(3*a/(4*vt.MAX_MODULES));(d<vt.MIN_SKIP||t)&&(d=vt.MIN_SKIP);let g=!1;const w=new Int32Array(5);for(let A=d-1;A<a&&!g;A+=d){w[0]=0,w[1]=0,w[2]=0,w[3]=0,w[4]=0;let I=0;for(let O=0;O<c;O++)if(r.get(O,A))(I&1)===1&&I++,w[I]++;else if(I&1)w[I]++;else if(I===4)if(vt.foundPatternCross(w)){if(this.handlePossibleCenter(w,A,O,n)===!0)if(d=2,this.hasSkipped===!0)g=this.haveMultiplyConfirmedCenters();else{const F=this.findRowSkip();F>w[2]&&(A+=F-w[2]-d,O=c-1)}else{w[0]=w[2],w[1]=w[3],w[2]=w[4],w[3]=1,w[4]=0,I=3;continue}I=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,I=3;else w[++I]++;vt.foundPatternCross(w)&&this.handlePossibleCenter(w,A,c,n)===!0&&(d=w[0],this.hasSkipped&&(g=this.haveMultiplyConfirmedCenters()))}const E=this.selectBestPatterns();return ye.orderBestPatterns(E),new mg(E)}static centerFromEnd(e,t){return t-e[4]-e[3]-e[2]/2}static foundPatternCross(e){let t=0;for(let a=0;a<5;a++){const c=e[a];if(c===0)return!1;t+=c}if(t<7)return!1;const n=t/7,r=n/2;return Math.abs(n-e[0])<r&&Math.abs(n-e[1])<r&&Math.abs(3*n-e[2])<3*r&&Math.abs(n-e[3])<r&&Math.abs(n-e[4])<r}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,r){const a=this.getCrossCheckStateCount();let c=0;const d=this.image;for(;e>=c&&t>=c&&d.get(t-c,e-c);)a[2]++,c++;if(e<c||t<c)return!1;for(;e>=c&&t>=c&&!d.get(t-c,e-c)&&a[1]<=n;)a[1]++,c++;if(e<c||t<c||a[1]>n)return!1;for(;e>=c&&t>=c&&d.get(t-c,e-c)&&a[0]<=n;)a[0]++,c++;if(a[0]>n)return!1;const g=d.getHeight(),w=d.getWidth();for(c=1;e+c<g&&t+c<w&&d.get(t+c,e+c);)a[2]++,c++;if(e+c>=g||t+c>=w)return!1;for(;e+c<g&&t+c<w&&!d.get(t+c,e+c)&&a[3]<n;)a[3]++,c++;if(e+c>=g||t+c>=w||a[3]>=n)return!1;for(;e+c<g&&t+c<w&&d.get(t+c,e+c)&&a[4]<n;)a[4]++,c++;if(a[4]>=n)return!1;const E=a[0]+a[1]+a[2]+a[3]+a[4];return Math.abs(E-r)<2*r&&vt.foundPatternCross(a)}crossCheckVertical(e,t,n,r){const a=this.image,c=a.getHeight(),d=this.getCrossCheckStateCount();let g=e;for(;g>=0&&a.get(t,g);)d[2]++,g--;if(g<0)return NaN;for(;g>=0&&!a.get(t,g)&&d[1]<=n;)d[1]++,g--;if(g<0||d[1]>n)return NaN;for(;g>=0&&a.get(t,g)&&d[0]<=n;)d[0]++,g--;if(d[0]>n)return NaN;for(g=e+1;g<c&&a.get(t,g);)d[2]++,g++;if(g===c)return NaN;for(;g<c&&!a.get(t,g)&&d[3]<n;)d[3]++,g++;if(g===c||d[3]>=n)return NaN;for(;g<c&&a.get(t,g)&&d[4]<n;)d[4]++,g++;if(d[4]>=n)return NaN;const w=d[0]+d[1]+d[2]+d[3]+d[4];return 5*Math.abs(w-r)>=2*r?NaN:vt.foundPatternCross(d)?vt.centerFromEnd(d,g):NaN}crossCheckHorizontal(e,t,n,r){const a=this.image,c=a.getWidth(),d=this.getCrossCheckStateCount();let g=e;for(;g>=0&&a.get(g,t);)d[2]++,g--;if(g<0)return NaN;for(;g>=0&&!a.get(g,t)&&d[1]<=n;)d[1]++,g--;if(g<0||d[1]>n)return NaN;for(;g>=0&&a.get(g,t)&&d[0]<=n;)d[0]++,g--;if(d[0]>n)return NaN;for(g=e+1;g<c&&a.get(g,t);)d[2]++,g++;if(g===c)return NaN;for(;g<c&&!a.get(g,t)&&d[3]<n;)d[3]++,g++;if(g===c||d[3]>=n)return NaN;for(;g<c&&a.get(g,t)&&d[4]<n;)d[4]++,g++;if(d[4]>=n)return NaN;const w=d[0]+d[1]+d[2]+d[3]+d[4];return 5*Math.abs(w-r)>=r?NaN:vt.foundPatternCross(d)?vt.centerFromEnd(d,g):NaN}handlePossibleCenter(e,t,n,r){const a=e[0]+e[1]+e[2]+e[3]+e[4];let c=vt.centerFromEnd(e,n),d=this.crossCheckVertical(t,Math.floor(c),e[2],a);if(!isNaN(d)&&(c=this.crossCheckHorizontal(Math.floor(c),Math.floor(d),e[2],a),!isNaN(c)&&(!r||this.crossCheckDiagonal(Math.floor(d),Math.floor(c),e[2],a)))){const g=a/7;let w=!1;const E=this.possibleCenters;for(let A=0,I=E.length;A<I;A++){const O=E[A];if(O.aboutEquals(g,d,c)){E[A]=O.combineEstimate(d,c,g),w=!0;break}}if(!w){const A=new Mo(c,d,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 c of this.possibleCenters)c.getCount()>=vt.CENTER_QUORUM&&(e++,t+=c.getEstimatedModuleSize());if(e<3)return!1;const r=t/n;let a=0;for(const c of this.possibleCenters)a+=Math.abs(c.getEstimatedModuleSize()-r);return a<=.05*t}selectBestPatterns(){const e=this.possibleCenters.length;if(e<3)throw new N;const t=this.possibleCenters;let n;if(e>3){let r=0,a=0;for(const g of this.possibleCenters){const w=g.getEstimatedModuleSize();r+=w,a+=w*w}n=r/e;let c=Math.sqrt(a/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 d=Math.max(.2*n,c);for(let g=0;g<t.length&&t.length>3;g++){const w=t[g];Math.abs(w.getEstimatedModuleSize()-n)>d&&(t.splice(g,1),g--)}}if(t.length>3){let r=0;for(const a of t)r+=a.getEstimatedModuleSize();n=r/t.length,t.sort((a,c)=>{if(c.getCount()===a.getCount()){const d=Math.abs(c.getEstimatedModuleSize()-n),g=Math.abs(a.getEstimatedModuleSize()-n);return d<g?1:d>g?-1:0}else return c.getCount()-a.getCount()}),t.splice(3)}return[t[0],t[1],t[2]]}}vt.CENTER_QUORUM=2,vt.MIN_SKIP=3,vt.MAX_MODULES=57;class Wr{constructor(e){this.image=e}getImage(){return this.image}getResultPointCallback(){return this.resultPointCallback}detect(e){this.resultPointCallback=e==null?null:e.get(te.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(),r=e.getBottomLeft(),a=this.calculateModuleSize(t,n,r);if(a<1)throw new N("No pattern found in proccess finder.");const c=Wr.computeDimension(t,n,r,a),d=Ie.getProvisionalVersionForDimension(c),g=d.getDimensionForVersion()-7;let w=null;if(d.getAlignmentPatternCenters().length>0){const O=n.getX()-t.getX()+r.getX(),L=n.getY()-t.getY()+r.getY(),F=1-3/g,Z=Math.floor(t.getX()+F*(O-t.getX())),ne=Math.floor(t.getY()+F*(L-t.getY()));for(let ce=4;ce<=16;ce<<=1)try{w=this.findAlignmentInRegion(a,Z,ne,ce);break}catch(ue){if(!(ue instanceof N))throw ue}}const E=Wr.createTransform(t,n,r,w,c),A=Wr.sampleGrid(this.image,E,c);let I;return w===null?I=[r,t,n]:I=[r,t,n,w],new Er(A,I)}static createTransform(e,t,n,r,a){const c=a-3.5;let d,g,w,E;return r!==null?(d=r.getX(),g=r.getY(),w=c-3,E=w):(d=t.getX()-e.getX()+n.getX(),g=t.getY()-e.getY()+n.getY(),w=c,E=c),Dt.quadrilateralToQuadrilateral(3.5,3.5,c,3.5,w,E,3.5,c,e.getX(),e.getY(),t.getX(),t.getY(),d,g,n.getX(),n.getY())}static sampleGrid(e,t,n){return dn.getInstance().sampleGridWithTransform(e,n,n,t)}static computeDimension(e,t,n,r){const a=He.round(ye.distance(e,t)/r),c=He.round(ye.distance(e,n)/r);let d=Math.floor((a+c)/2)+7;switch(d&3){case 0:d++;break;case 2:d--;break;case 3:throw new N("Dimensions could be not found.")}return d}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())),r=this.sizeOfBlackWhiteBlackRunBothWays(Math.floor(t.getX()),Math.floor(t.getY()),Math.floor(e.getX()),Math.floor(e.getY()));return isNaN(n)?r/7:isNaN(r)?n/7:(n+r)/14}sizeOfBlackWhiteBlackRunBothWays(e,t,n,r){let a=this.sizeOfBlackWhiteBlackRun(e,t,n,r),c=1,d=e-(n-e);d<0?(c=e/(e-d),d=0):d>=this.image.getWidth()&&(c=(this.image.getWidth()-1-e)/(d-e),d=this.image.getWidth()-1);let g=Math.floor(t-(r-t)*c);return c=1,g<0?(c=t/(t-g),g=0):g>=this.image.getHeight()&&(c=(this.image.getHeight()-1-t)/(g-t),g=this.image.getHeight()-1),d=Math.floor(e+(d-e)*c),a+=this.sizeOfBlackWhiteBlackRun(e,t,d,g),a-1}sizeOfBlackWhiteBlackRun(e,t,n,r){const a=Math.abs(r-t)>Math.abs(n-e);if(a){let O=e;e=t,t=O,O=n,n=r,r=O}const c=Math.abs(n-e),d=Math.abs(r-t);let g=-c/2;const w=e<n?1:-1,E=t<r?1:-1;let A=0;const I=n+w;for(let O=e,L=t;O!==I;O+=w){const F=a?L:O,Z=a?O:L;if(A===1===this.image.get(F,Z)){if(A===2)return He.distance(O,L,e,t);A++}if(g+=d,g>0){if(L===r)break;L+=E,g-=c}}return A===2?He.distance(n+w,r,e,t):NaN}findAlignmentInRegion(e,t,n,r){const a=Math.floor(r*e),c=Math.max(0,t-a),d=Math.min(this.image.getWidth()-1,t+a);if(d-c<e*3)throw new N("Alignment top exceeds estimated module size.");const g=Math.max(0,n-a),w=Math.min(this.image.getHeight()-1,n+a);if(w-g<e*3)throw new N("Alignment bottom exceeds estimated module size.");return new Ti(this.image,c,g,d-c,w-g,e,this.resultPointCallback).find()}}class qn{constructor(){this.decoder=new gg}getDecoder(){return this.decoder}decode(e,t){let n,r;if(t!=null&&t.get(te.PURE_BARCODE)!==void 0){const g=qn.extractPureBits(e.getBlackMatrix());n=this.decoder.decodeBitMatrix(g,t),r=qn.NO_POINTS}else{const g=new Wr(e.getBlackMatrix()).detect(t);n=this.decoder.decodeBitMatrix(g.getBits(),t),r=g.getPoints()}n.getOther()instanceof za&&n.getOther().applyMirroredCorrection(r);const a=new _e(n.getText(),n.getRawBytes(),void 0,r,he.QR_CODE,void 0),c=n.getByteSegments();c!==null&&a.putMetadata(Xe.BYTE_SEGMENTS,c);const d=n.getECLevel();return d!==null&&a.putMetadata(Xe.ERROR_CORRECTION_LEVEL,d),n.hasStructuredAppend()&&(a.putMetadata(Xe.STRUCTURED_APPEND_SEQUENCE,n.getStructuredAppendSequenceNumber()),a.putMetadata(Xe.STRUCTURED_APPEND_PARITY,n.getStructuredAppendParity())),a}reset(){}static extractPureBits(e){const t=e.getTopLeftOnBit(),n=e.getBottomRightOnBit();if(t===null||n===null)throw new N;const r=this.moduleSize(t,e);let a=t[1],c=n[1],d=t[0],g=n[0];if(d>=g||a>=c)throw new N;if(c-a!==g-d&&(g=d+(c-a),g>=e.getWidth()))throw new N;const w=Math.round((g-d+1)/r),E=Math.round((c-a+1)/r);if(w<=0||E<=0)throw new N;if(E!==w)throw new N;const A=Math.floor(r/2);a+=A,d+=A;const I=d+Math.floor((w-1)*r)-g;if(I>0){if(I>A)throw new N;d-=I}const O=a+Math.floor((E-1)*r)-c;if(O>0){if(O>A)throw new N;a-=O}const L=new X(w,E);for(let F=0;F<E;F++){const Z=a+Math.floor(F*r);for(let ne=0;ne<w;ne++)e.get(d+Math.floor(ne*r),Z)&&L.set(ne,F)}return L}static moduleSize(e,t){const n=t.getHeight(),r=t.getWidth();let a=e[0],c=e[1],d=!0,g=0;for(;a<r&&c<n;){if(d!==t.get(a,c)){if(++g===5)break;d=!d}a++,c++}if(a===r||c===n)throw new N;return(a-e[0])/7}}qn.NO_POINTS=new Array;class ke{PDF417Common(){}static getBitCountSum(e){return He.sum(e)}static toIntArray(e){if(e==null||!e.length)return ke.EMPTY_INT_ARRAY;const t=new Int32Array(e.length);let n=0;for(const r of e)t[n++]=r;return t}static getCodeword(e){const t=B.binarySearch(ke.SYMBOL_TABLE,e&262143);return t<0?-1:(ke.CODEWORD_TABLE[t]-1)%ke.NUMBER_OF_CODEWORDS}}ke.NUMBER_OF_CODEWORDS=929,ke.MAX_CODEWORDS_IN_BARCODE=ke.NUMBER_OF_CODEWORDS-1,ke.MIN_ROWS_IN_BARCODE=3,ke.MAX_ROWS_IN_BARCODE=90,ke.MODULES_IN_CODEWORD=17,ke.MODULES_IN_STOP_PATTERN=18,ke.BARS_IN_MODULE=8,ke.EMPTY_INT_ARRAY=new Int32Array([]),ke.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]),ke.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 pg{constructor(e,t){this.bits=e,this.points=t}getBits(){return this.bits}getPoints(){return this.points}}class Pe{static detectMultiple(e,t,n){let r=e.getBlackMatrix(),a=Pe.detect(n,r);return a.length||(r=r.clone(),r.rotate180(),a=Pe.detect(n,r)),new pg(r,a)}static detect(e,t){const n=new Array;let r=0,a=0,c=!1;for(;r<t.getHeight();){const d=Pe.findVertices(t,r,a);if(d[0]==null&&d[3]==null){if(!c)break;c=!1,a=0;for(const g of n)g[1]!=null&&(r=Math.trunc(Math.max(r,g[1].getY()))),g[3]!=null&&(r=Math.max(r,Math.trunc(g[3].getY())));r+=Pe.ROW_STEP;continue}if(c=!0,n.push(d),!e)break;d[2]!=null?(a=Math.trunc(d[2].getX()),r=Math.trunc(d[2].getY())):(a=Math.trunc(d[4].getX()),r=Math.trunc(d[4].getY()))}return n}static findVertices(e,t,n){const r=e.getHeight(),a=e.getWidth(),c=new Array(8);return Pe.copyToResult(c,Pe.findRowsWithPattern(e,r,a,t,n,Pe.START_PATTERN),Pe.INDEXES_START_PATTERN),c[4]!=null&&(n=Math.trunc(c[4].getX()),t=Math.trunc(c[4].getY())),Pe.copyToResult(c,Pe.findRowsWithPattern(e,r,a,t,n,Pe.STOP_PATTERN),Pe.INDEXES_STOP_PATTERN),c}static copyToResult(e,t,n){for(let r=0;r<n.length;r++)e[n[r]]=t[r]}static findRowsWithPattern(e,t,n,r,a,c){const d=new Array(4);let g=!1;const w=new Int32Array(c.length);for(;r<t;r+=Pe.ROW_STEP){let A=Pe.findGuardPattern(e,a,r,n,!1,c,w);if(A!=null){for(;r>0;){const I=Pe.findGuardPattern(e,a,--r,n,!1,c,w);if(I!=null)A=I;else{r++;break}}d[0]=new ye(A[0],r),d[1]=new ye(A[1],r),g=!0;break}}let E=r+1;if(g){let A=0,I=Int32Array.from([Math.trunc(d[0].getX()),Math.trunc(d[1].getX())]);for(;E<t;E++){const O=Pe.findGuardPattern(e,I[0],E,n,!1,c,w);if(O!=null&&Math.abs(I[0]-O[0])<Pe.MAX_PATTERN_DRIFT&&Math.abs(I[1]-O[1])<Pe.MAX_PATTERN_DRIFT)I=O,A=0;else{if(A>Pe.SKIPPED_ROW_COUNT_MAX)break;A++}}E-=A+1,d[2]=new ye(I[0],E),d[3]=new ye(I[1],E)}return E-r<Pe.BARCODE_MIN_HEIGHT&&B.fill(d,null),d}static findGuardPattern(e,t,n,r,a,c,d){B.fillWithin(d,0,d.length,0);let g=t,w=0;for(;e.get(g,n)&&g>0&&w++<Pe.MAX_PIXEL_DRIFT;)g--;let E=g,A=0,I=c.length;for(let O=a;E<r;E++)if(e.get(E,n)!==O)d[A]++;else{if(A===I-1){if(Pe.patternMatchVariance(d,c,Pe.MAX_INDIVIDUAL_VARIANCE)<Pe.MAX_AVG_VARIANCE)return new Int32Array([g,E]);g+=d[0]+d[1],P.arraycopy(d,2,d,0,A-1),d[A-1]=0,d[A]=0,A--}else A++;d[A]=1,O=!O}return A===I-1&&Pe.patternMatchVariance(d,c,Pe.MAX_INDIVIDUAL_VARIANCE)<Pe.MAX_AVG_VARIANCE?new Int32Array([g,E-1]):null}static patternMatchVariance(e,t,n){let r=e.length,a=0,c=0;for(let w=0;w<r;w++)a+=e[w],c+=t[w];if(a<c)return 1/0;let d=a/c;n*=d;let g=0;for(let w=0;w<r;w++){let E=e[w],A=t[w]*d,I=E>A?E-A:A-E;if(I>n)return 1/0;g+=I}return g/a}}Pe.INDEXES_START_PATTERN=Int32Array.from([0,4,1,5]),Pe.INDEXES_STOP_PATTERN=Int32Array.from([6,2,7,3]),Pe.MAX_AVG_VARIANCE=.42,Pe.MAX_INDIVIDUAL_VARIANCE=.8,Pe.START_PATTERN=Int32Array.from([8,1,1,1,1,1,1,3]),Pe.STOP_PATTERN=Int32Array.from([7,1,1,3,1,1,1,2,1]),Pe.MAX_PIXEL_DRIFT=3,Pe.MAX_PATTERN_DRIFT=5,Pe.SKIPPED_ROW_COUNT_MAX=25,Pe.ROW_STEP=5,Pe.BARCODE_MIN_HEIGHT=10;class Ft{constructor(e,t){if(t.length===0)throw new y;this.field=e;let n=t.length;if(n>1&&t[0]===0){let r=1;for(;r<n&&t[r]===0;)r++;r===n?this.coefficients=new Int32Array([0]):(this.coefficients=new Int32Array(n-r),P.arraycopy(t,r,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 r=0;for(let a of this.coefficients)r=this.field.add(r,a);return r}let t=this.coefficients[0],n=this.coefficients.length;for(let r=1;r<n;r++)t=this.field.add(this.field.multiply(e,t),this.coefficients[r]);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 c=t;t=n,n=c}let r=new Int32Array(n.length),a=n.length-t.length;P.arraycopy(n,0,r,0,a);for(let c=a;c<n.length;c++)r[c]=this.field.add(t[c-a],n[c]);return new Ft(this.field,r)}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 Ft?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 Ft(this.field,new Int32Array([0]));let t=this.coefficients,n=t.length,r=e.coefficients,a=r.length,c=new Int32Array(n+a-1);for(let d=0;d<n;d++){let g=t[d];for(let w=0;w<a;w++)c[d+w]=this.field.add(c[d+w],this.field.multiply(g,r[w]))}return new Ft(this.field,c)}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 Ft(this.field,t)}multiplyScalar(e){if(e===0)return new Ft(this.field,new Int32Array([0]));if(e===1)return this;let t=this.coefficients.length,n=new Int32Array(t);for(let r=0;r<t;r++)n[r]=this.field.multiply(this.coefficients[r],e);return new Ft(this.field,n)}multiplyByMonomial(e,t){if(e<0)throw new y;if(t===0)return new Ft(this.field,new Int32Array([0]));let n=this.coefficients.length,r=new Int32Array(n+e);for(let a=0;a<n;a++)r[a]=this.field.multiply(this.coefficients[a],t);return new Ft(this.field,r)}toString(){let e=new V;for(let t=this.getDegree();t>=0;t--){let n=this.getCoefficient(t);n!==0&&(n<0?(e.append(" - "),n=-n):e.length()>0&&e.append(" + "),(t===0||n!==1)&&e.append(n),t!==0&&(t===1?e.append("x"):(e.append("x^"),e.append(t))))}return e.toString()}}class xg{add(e,t){return(e+t)%this.modulus}subtract(e,t){return(this.modulus+e-t)%this.modulus}exp(e){return this.expTable[e]}log(e){if(e===0)throw new y;return this.logTable[e]}inverse(e){if(e===0)throw new Ze;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 vo extends xg{constructor(e,t){super(),this.modulus=e,this.expTable=new Int32Array(e),this.logTable=new Int32Array(e);let n=1;for(let r=0;r<e;r++)this.expTable[r]=n,n=n*t%e;for(let r=0;r<e-1;r++)this.logTable[this.expTable[r]]=r;this.zero=new Ft(this,new Int32Array([0])),this.one=new Ft(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 Ft(this,n)}}vo.PDF417_GF=new vo(ke.NUMBER_OF_CODEWORDS,3);class Ha{constructor(){this.field=vo.PDF417_GF}decode(e,t,n){let r=new Ft(this.field,e),a=new Int32Array(t),c=!1;for(let L=t;L>0;L--){let F=r.evaluateAt(this.field.exp(L));a[t-L]=F,F!==0&&(c=!0)}if(!c)return 0;let d=this.field.getOne();if(n!=null)for(const L of n){let F=this.field.exp(e.length-1-L),Z=new Ft(this.field,new Int32Array([this.field.subtract(0,F),1]));d=d.multiply(Z)}let g=new Ft(this.field,a),w=this.runEuclideanAlgorithm(this.field.buildMonomial(t,1),g,t),E=w[0],A=w[1],I=this.findErrorLocations(E),O=this.findErrorMagnitudes(A,E,I);for(let L=0;L<I.length;L++){let F=e.length-1-this.field.log(I[L]);if(F<0)throw M.getChecksumInstance();e[F]=this.field.subtract(e[F],O[L])}return I.length}runEuclideanAlgorithm(e,t,n){if(e.getDegree()<t.getDegree()){let I=e;e=t,t=I}let r=e,a=t,c=this.field.getZero(),d=this.field.getOne();for(;a.getDegree()>=Math.round(n/2);){let I=r,O=c;if(r=a,c=d,r.isZero())throw M.getChecksumInstance();a=I;let L=this.field.getZero(),F=r.getCoefficient(r.getDegree()),Z=this.field.inverse(F);for(;a.getDegree()>=r.getDegree()&&!a.isZero();){let ne=a.getDegree()-r.getDegree(),ce=this.field.multiply(a.getCoefficient(a.getDegree()),Z);L=L.add(this.field.buildMonomial(ne,ce)),a=a.subtract(r.multiplyByMonomial(ne,ce))}d=L.multiply(c).subtract(O).negative()}let g=d.getCoefficient(0);if(g===0)throw M.getChecksumInstance();let w=this.field.inverse(g),E=d.multiply(w),A=a.multiply(w);return[E,A]}findErrorLocations(e){let t=e.getDegree(),n=new Int32Array(t),r=0;for(let a=1;a<this.field.getSize()&&r<t;a++)e.evaluateAt(a)===0&&(n[r]=this.field.inverse(a),r++);if(r!==t)throw M.getChecksumInstance();return n}findErrorMagnitudes(e,t,n){let r=t.getDegree(),a=new Int32Array(r);for(let w=1;w<=r;w++)a[r-w]=this.field.multiply(w,t.getCoefficient(w));let c=new Ft(this.field,a),d=n.length,g=new Int32Array(d);for(let w=0;w<d;w++){let E=this.field.inverse(n[w]),A=this.field.subtract(0,e.evaluateAt(E)),I=this.field.inverse(c.evaluateAt(E));g[w]=this.field.multiply(A,I)}return g}}class sr{constructor(e,t,n,r,a){e instanceof sr?this.constructor_2(e):this.constructor_1(e,t,n,r,a)}constructor_1(e,t,n,r,a){const c=t==null||n==null,d=r==null||a==null;if(c&&d)throw new N;c?(t=new ye(0,r.getY()),n=new ye(0,a.getY())):d&&(r=new ye(e.getWidth()-1,t.getY()),a=new ye(e.getWidth()-1,n.getY())),this.image=e,this.topLeft=t,this.bottomLeft=n,this.topRight=r,this.bottomRight=a,this.minX=Math.trunc(Math.min(t.getX(),n.getX())),this.maxX=Math.trunc(Math.max(r.getX(),a.getX())),this.minY=Math.trunc(Math.min(t.getY(),r.getY())),this.maxY=Math.trunc(Math.max(n.getY(),a.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 sr(e.image,e.topLeft,e.bottomLeft,t.topRight,t.bottomRight)}addMissingRows(e,t,n){let r=this.topLeft,a=this.bottomLeft,c=this.topRight,d=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?r=E:c=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?a=E:d=E}return new sr(this.image,r,a,c,d)}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 wg{constructor(e,t,n,r){this.columnCount=e,this.errorCorrectionLevel=r,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 Xr{constructor(){this.buffer=""}static form(e,t){let n=-1;function r(c,d,g,w,E,A){if(c==="%%")return"%";if(t[++n]===void 0)return;c=w?parseInt(w.substr(1)):void 0;let I=E?parseInt(E.substr(1)):void 0,O;switch(A){case"s":O=t[n];break;case"c":O=t[n][0];break;case"f":O=parseFloat(t[n]).toFixed(c);break;case"p":O=parseFloat(t[n]).toPrecision(c);break;case"e":O=parseFloat(t[n]).toExponential(c);break;case"x":O=parseInt(t[n]).toString(I||16);break;case"d":O=parseFloat(parseInt(t[n],I||10).toPrecision(c)).toFixed(0);break}O=typeof O=="object"?JSON.stringify(O):(+O).toString(I);let L=parseInt(g),F=g&&g[0]+""=="0"?"0":" ";for(;O.length<L;)O=d!==void 0?O+F:F+O;return O}let a=/%(-)?(0?[0-9]+)?([.][0-9]+)?([#][0-9]+)?([scfpexd%])/g;return e.replace(a,r)}format(e,...t){this.buffer+=Xr.form(e,t)}toString(){return this.buffer}}class jr{constructor(e){this.boundingBox=new sr(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<jr.MAX_NEARBY_DISTANCE;n++){let r=this.imageRowToCodewordIndex(e)-n;if(r>=0&&(t=this.codewords[r],t!=null)||(r=this.imageRowToCodewordIndex(e)+n,r<this.codewords.length&&(t=this.codewords[r],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 Xr;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()}}jr.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,r]of this.values.entries()){const a={getKey:()=>n,getValue:()=>r};a.getValue()>e?(e=a.getValue(),t=[],t.push(a.getKey())):a.getValue()===e&&t.push(a.getKey())}return ke.toIntArray(t)}getConfidence(e){return this.values.get(e)}}class Ga extends jr{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(),r=this._isLeft?n.getTopLeft():n.getTopRight(),a=this._isLeft?n.getBottomLeft():n.getBottomRight(),c=this.imageRowToCodewordIndex(Math.trunc(r.getY())),d=this.imageRowToCodewordIndex(Math.trunc(a.getY())),g=-1,w=1,E=0;for(let A=c;A<d;A++){if(t[A]==null)continue;let I=t[A],O=I.getRowNumber()-g;if(O===0)E++;else if(O===1)w=Math.max(w,E),E=1,g=I.getRowNumber();else if(O<0||I.getRowNumber()>=e.getRowCount()||O>A)t[A]=null;else{let L;w>2?L=(w-2)*O:L=O;let F=L>=A;for(let Z=1;Z<=L&&!F;Z++)F=t[A-Z]!=null;F?t[A]=null:(g=I.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 r=n.getRowNumber();if(r>=t.length)continue;t[r]++}return t}adjustIncompleteIndicatorColumnRowNumbers(e){let t=this.getBoundingBox(),n=this._isLeft?t.getTopLeft():t.getTopRight(),r=this._isLeft?t.getBottomLeft():t.getBottomRight(),a=this.imageRowToCodewordIndex(Math.trunc(n.getY())),c=this.imageRowToCodewordIndex(Math.trunc(r.getY())),d=this.getCodewords(),g=-1;for(let w=a;w<c;w++){if(d[w]==null)continue;let E=d[w];E.setRowNumberAsRowIndicatorColumn();let A=E.getRowNumber()-g;A===0||(A===1?g=E.getRowNumber():E.getRowNumber()>=e.getRowCount()?d[w]=null:g=E.getRowNumber())}}getBarcodeMetadata(){let e=this.getCodewords(),t=new qr,n=new qr,r=new qr,a=new qr;for(let d of e){if(d==null)continue;d.setRowNumberAsRowIndicatorColumn();let g=d.getValue()%30,w=d.getRowNumber();switch(this._isLeft||(w+=2),w%3){case 0:n.setValue(g*3+1);break;case 1:a.setValue(g/3),r.setValue(g%3);break;case 2:t.setValue(g+1);break}}if(t.getValue().length===0||n.getValue().length===0||r.getValue().length===0||a.getValue().length===0||t.getValue()[0]<1||n.getValue()[0]+r.getValue()[0]<ke.MIN_ROWS_IN_BARCODE||n.getValue()[0]+r.getValue()[0]>ke.MAX_ROWS_IN_BARCODE)return null;let c=new wg(t.getValue()[0],n.getValue()[0],r.getValue()[0],a.getValue()[0]);return this.removeIncorrectCodewords(e,c),c}removeIncorrectCodewords(e,t){for(let n=0;n<e.length;n++){let r=e[n];if(e[n]==null)continue;let a=r.getValue()%30,c=r.getRowNumber();if(c>t.getRowCount()){e[n]=null;continue}switch(this._isLeft||(c+=2),c%3){case 0:a*3+1!==t.getRowCountUpperPart()&&(e[n]=null);break;case 1:(Math.trunc(a/3)!==t.getErrorCorrectionLevel()||a%3!==t.getRowCountLowerPart())&&(e[n]=null);break;case 2:a+1!==t.getColumnCount()&&(e[n]=null);break}}}isLeft(){return this._isLeft}toString(){return"IsLeft: "+this._isLeft+`
|
|
17
|
+
`+super.toString()}}class Zr{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=ke.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 r=0;r<n.length;r++)n[r]!=null&&(n[r].hasValidRowNumber()||this.adjustRowNumbers(t,r,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 r=1;r<=this.barcodeColumnCount;r++){let a=this.detectionResultColumns[r].getCodewords()[n];a!=null&&(a.setRowNumber(e[n].getRowNumber()),a.hasValidRowNumber()||(this.detectionResultColumns[r].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 r=t[n].getRowNumber(),a=0;for(let c=this.barcodeColumnCount+1;c>0&&a<this.ADJUST_ROW_NUMBER_SKIP;c--){let d=this.detectionResultColumns[c].getCodewords()[n];d!=null&&(a=Zr.adjustRowNumberIfValid(r,a,d),d.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 r=t[n].getRowNumber(),a=0;for(let c=1;c<this.barcodeColumnCount+1&&a<this.ADJUST_ROW_NUMBER_SKIP;c++){let d=this.detectionResultColumns[c].getCodewords()[n];d!=null&&(a=Zr.adjustRowNumberIfValid(r,a,d),d.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 r=n[t],a=this.detectionResultColumns[e-1].getCodewords(),c=a;this.detectionResultColumns[e+1]!=null&&(c=this.detectionResultColumns[e+1].getCodewords());let d=new Array(14);d[2]=a[t],d[3]=c[t],t>0&&(d[0]=n[t-1],d[4]=a[t-1],d[5]=c[t-1]),t>1&&(d[8]=n[t-2],d[10]=a[t-2],d[11]=c[t-2]),t<n.length-1&&(d[1]=n[t+1],d[6]=a[t+1],d[7]=c[t+1]),t<n.length-2&&(d[9]=n[t+2],d[12]=a[t+2],d[13]=c[t+2]);for(let g of d)if(Zr.adjustRowNumber(r,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 Xr;for(let n=0;n<e.getCodewords().length;n++){t.format("CW %3d:",n);for(let r=0;r<this.barcodeColumnCount+2;r++){if(this.detectionResultColumns[r]==null){t.format(" | ");continue}let a=this.detectionResultColumns[r].getCodewords()[n];if(a==null){t.format(" | ");continue}t.format(" %3d|%3d",a.getRowNumber(),a.getValue())}t.format("%n")}return t.toString()}}class Yr{constructor(e,t,n,r){this.rowNumber=Yr.BARCODE_ROW_UNKNOWN,this.startX=Math.trunc(e),this.endX=Math.trunc(t),this.bucket=Math.trunc(n),this.value=Math.trunc(r)}hasValidRowNumber(){return this.isValidRowNumber(this.rowNumber)}isValidRowNumber(e){return e!==Yr.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}}Yr.BARCODE_ROW_UNKNOWN=-1;class tn{static initialize(){for(let e=0;e<ke.SYMBOL_TABLE.length;e++){let t=ke.SYMBOL_TABLE[e],n=t&1;for(let r=0;r<ke.BARS_IN_MODULE;r++){let a=0;for(;(t&1)===n;)a+=1,t>>=1;n=t&1,tn.RATIOS_TABLE[e]||(tn.RATIOS_TABLE[e]=new Array(ke.BARS_IN_MODULE)),tn.RATIOS_TABLE[e][ke.BARS_IN_MODULE-r-1]=Math.fround(a/ke.MODULES_IN_CODEWORD)}}this.bSymbolTableReady=!0}static getDecodedValue(e){let t=tn.getDecodedCodewordValue(tn.sampleBitCounts(e));return t!==-1?t:tn.getClosestDecodedValue(e)}static sampleBitCounts(e){let t=He.sum(e),n=new Int32Array(ke.BARS_IN_MODULE),r=0,a=0;for(let c=0;c<ke.MODULES_IN_CODEWORD;c++){let d=t/(2*ke.MODULES_IN_CODEWORD)+c*t/ke.MODULES_IN_CODEWORD;a+e[r]<=d&&(a+=e[r],r++),n[r]++}return n}static getDecodedCodewordValue(e){let t=tn.getBitValue(e);return ke.getCodeword(t)===-1?-1:t}static getBitValue(e){let t=0;for(let n=0;n<e.length;n++)for(let r=0;r<e[n];r++)t=t<<1|(n%2===0?1:0);return Math.trunc(t)}static getClosestDecodedValue(e){let t=He.sum(e),n=new Array(ke.BARS_IN_MODULE);if(t>1)for(let c=0;c<n.length;c++)n[c]=Math.fround(e[c]/t);let r=Cr.MAX_VALUE,a=-1;this.bSymbolTableReady||tn.initialize();for(let c=0;c<tn.RATIOS_TABLE.length;c++){let d=0,g=tn.RATIOS_TABLE[c];for(let w=0;w<ke.BARS_IN_MODULE;w++){let E=Math.fround(g[w]-n[w]);if(d+=Math.fround(E*E),d>=r)break}d<r&&(r=d,a=ke.SYMBOL_TABLE[c])}return a}}tn.bSymbolTableReady=!1,tn.RATIOS_TABLE=new Array(ke.SYMBOL_TABLE.length).map(b=>new Array(ke.BARS_IN_MODULE));class Wa{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 Xa{static parseLong(e,t=void 0){return parseInt(e,t)}}class ja extends p{}ja.kind="NullPointerException";class _g{writeBytes(e){this.writeBytesOffset(e,0,e.length)}writeBytesOffset(e,t,n){if(e==null)throw new ja;if(t<0||t>e.length||n<0||t+n>e.length||t+n<0)throw new v;if(n===0)return;for(let r=0;r<n;r++)this.write(e[t+r])}flush(){}close(){}}class Cg extends p{}class Eg extends _g{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 Cg;n=R.MAX_VALUE}this.buf=B.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 v;this.ensureCapacity(this.count+n),P.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 B.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 it;(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"})(it||(it={}));function qa(){if(typeof window<"u")return window.BigInt||null;if(typeof pr<"u")return pr.BigInt||null;if(typeof self<"u")return self.BigInt||null;throw new Error("Can't search globals for BigInt!")}let ki;function Zn(b){if(typeof ki>"u"&&(ki=qa()),ki===null)throw new Error("BigInt is not supported!");return ki(b)}function yg(){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 ee{static decode(e,t){let n=new V(""),r=W.ISO8859_1;n.enableDecoding(r);let a=1,c=e[a++],d=new Wa;for(;a<e[0];){switch(c){case ee.TEXT_COMPACTION_MODE_LATCH:a=ee.textCompaction(e,a,n);break;case ee.BYTE_COMPACTION_MODE_LATCH:case ee.BYTE_COMPACTION_MODE_LATCH_6:a=ee.byteCompaction(c,e,r,a,n);break;case ee.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:n.append(e[a++]);break;case ee.NUMERIC_COMPACTION_MODE_LATCH:a=ee.numericCompaction(e,a,n);break;case ee.ECI_CHARSET:W.getCharacterSetECIByValue(e[a++]);break;case ee.ECI_GENERAL_PURPOSE:a+=2;break;case ee.ECI_USER_DEFINED:a++;break;case ee.BEGIN_MACRO_PDF417_CONTROL_BLOCK:a=ee.decodeMacroBlock(e,a,d);break;case ee.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case ee.MACRO_PDF417_TERMINATOR:throw new z;default:a--,a=ee.textCompaction(e,a,n);break}if(a<e.length)c=e[a++];else throw z.getFormatInstance()}if(n.length()===0)throw z.getFormatInstance();let g=new Oe(null,n.toString(),null,t);return g.setOther(d),g}static decodeMacroBlock(e,t,n){if(t+ee.NUMBER_OF_SEQUENCE_CODEWORDS>e[0])throw z.getFormatInstance();let r=new Int32Array(ee.NUMBER_OF_SEQUENCE_CODEWORDS);for(let d=0;d<ee.NUMBER_OF_SEQUENCE_CODEWORDS;d++,t++)r[d]=e[t];n.setSegmentIndex(R.parseInt(ee.decodeBase900toBase10(r,ee.NUMBER_OF_SEQUENCE_CODEWORDS)));let a=new V;t=ee.textCompaction(e,t,a),n.setFileId(a.toString());let c=-1;for(e[t]===ee.BEGIN_MACRO_PDF417_OPTIONAL_FIELD&&(c=t+1);t<e[0];)switch(e[t]){case ee.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:switch(t++,e[t]){case ee.MACRO_PDF417_OPTIONAL_FIELD_FILE_NAME:let d=new V;t=ee.textCompaction(e,t+1,d),n.setFileName(d.toString());break;case ee.MACRO_PDF417_OPTIONAL_FIELD_SENDER:let g=new V;t=ee.textCompaction(e,t+1,g),n.setSender(g.toString());break;case ee.MACRO_PDF417_OPTIONAL_FIELD_ADDRESSEE:let w=new V;t=ee.textCompaction(e,t+1,w),n.setAddressee(w.toString());break;case ee.MACRO_PDF417_OPTIONAL_FIELD_SEGMENT_COUNT:let E=new V;t=ee.numericCompaction(e,t+1,E),n.setSegmentCount(R.parseInt(E.toString()));break;case ee.MACRO_PDF417_OPTIONAL_FIELD_TIME_STAMP:let A=new V;t=ee.numericCompaction(e,t+1,A),n.setTimestamp(Xa.parseLong(A.toString()));break;case ee.MACRO_PDF417_OPTIONAL_FIELD_CHECKSUM:let I=new V;t=ee.numericCompaction(e,t+1,I),n.setChecksum(R.parseInt(I.toString()));break;case ee.MACRO_PDF417_OPTIONAL_FIELD_FILE_SIZE:let O=new V;t=ee.numericCompaction(e,t+1,O),n.setFileSize(Xa.parseLong(O.toString()));break;default:throw z.getFormatInstance()}break;case ee.MACRO_PDF417_TERMINATOR:t++,n.setLastSegment(!0);break;default:throw z.getFormatInstance()}if(c!==-1){let d=t-c;n.isLastSegment()&&d--,n.setOptionalData(B.copyOfRange(e,c,c+d))}return t}static textCompaction(e,t,n){let r=new Int32Array((e[0]-t)*2),a=new Int32Array((e[0]-t)*2),c=0,d=!1;for(;t<e[0]&&!d;){let g=e[t++];if(g<ee.TEXT_COMPACTION_MODE_LATCH)r[c]=g/30,r[c+1]=g%30,c+=2;else switch(g){case ee.TEXT_COMPACTION_MODE_LATCH:r[c++]=ee.TEXT_COMPACTION_MODE_LATCH;break;case ee.BYTE_COMPACTION_MODE_LATCH:case ee.BYTE_COMPACTION_MODE_LATCH_6:case ee.NUMERIC_COMPACTION_MODE_LATCH:case ee.BEGIN_MACRO_PDF417_CONTROL_BLOCK:case ee.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case ee.MACRO_PDF417_TERMINATOR:t--,d=!0;break;case ee.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:r[c]=ee.MODE_SHIFT_TO_BYTE_COMPACTION_MODE,g=e[t++],a[c]=g,c++;break}}return ee.decodeTextCompaction(r,a,c,n),t}static decodeTextCompaction(e,t,n,r){let a=it.ALPHA,c=it.ALPHA,d=0;for(;d<n;){let g=e[d],w="";switch(a){case it.ALPHA:if(g<26)w=String.fromCharCode(65+g);else switch(g){case 26:w=" ";break;case ee.LL:a=it.LOWER;break;case ee.ML:a=it.MIXED;break;case ee.PS:c=a,a=it.PUNCT_SHIFT;break;case ee.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:r.append(t[d]);break;case ee.TEXT_COMPACTION_MODE_LATCH:a=it.ALPHA;break}break;case it.LOWER:if(g<26)w=String.fromCharCode(97+g);else switch(g){case 26:w=" ";break;case ee.AS:c=a,a=it.ALPHA_SHIFT;break;case ee.ML:a=it.MIXED;break;case ee.PS:c=a,a=it.PUNCT_SHIFT;break;case ee.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:r.append(t[d]);break;case ee.TEXT_COMPACTION_MODE_LATCH:a=it.ALPHA;break}break;case it.MIXED:if(g<ee.PL)w=ee.MIXED_CHARS[g];else switch(g){case ee.PL:a=it.PUNCT;break;case 26:w=" ";break;case ee.LL:a=it.LOWER;break;case ee.AL:a=it.ALPHA;break;case ee.PS:c=a,a=it.PUNCT_SHIFT;break;case ee.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:r.append(t[d]);break;case ee.TEXT_COMPACTION_MODE_LATCH:a=it.ALPHA;break}break;case it.PUNCT:if(g<ee.PAL)w=ee.PUNCT_CHARS[g];else switch(g){case ee.PAL:a=it.ALPHA;break;case ee.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:r.append(t[d]);break;case ee.TEXT_COMPACTION_MODE_LATCH:a=it.ALPHA;break}break;case it.ALPHA_SHIFT:if(a=c,g<26)w=String.fromCharCode(65+g);else switch(g){case 26:w=" ";break;case ee.TEXT_COMPACTION_MODE_LATCH:a=it.ALPHA;break}break;case it.PUNCT_SHIFT:if(a=c,g<ee.PAL)w=ee.PUNCT_CHARS[g];else switch(g){case ee.PAL:a=it.ALPHA;break;case ee.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:r.append(t[d]);break;case ee.TEXT_COMPACTION_MODE_LATCH:a=it.ALPHA;break}break}w!==""&&r.append(w),d++}}static byteCompaction(e,t,n,r,a){let c=new Eg,d=0,g=0,w=!1;switch(e){case ee.BYTE_COMPACTION_MODE_LATCH:let E=new Int32Array(6),A=t[r++];for(;r<t[0]&&!w;)switch(E[d++]=A,g=900*g+A,A=t[r++],A){case ee.TEXT_COMPACTION_MODE_LATCH:case ee.BYTE_COMPACTION_MODE_LATCH:case ee.NUMERIC_COMPACTION_MODE_LATCH:case ee.BYTE_COMPACTION_MODE_LATCH_6:case ee.BEGIN_MACRO_PDF417_CONTROL_BLOCK:case ee.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case ee.MACRO_PDF417_TERMINATOR:r--,w=!0;break;default:if(d%5===0&&d>0){for(let I=0;I<6;++I)c.write(Number(Zn(g)>>Zn(8*(5-I))));g=0,d=0}break}r===t[0]&&A<ee.TEXT_COMPACTION_MODE_LATCH&&(E[d++]=A);for(let I=0;I<d;I++)c.write(E[I]);break;case ee.BYTE_COMPACTION_MODE_LATCH_6:for(;r<t[0]&&!w;){let I=t[r++];if(I<ee.TEXT_COMPACTION_MODE_LATCH)d++,g=900*g+I;else switch(I){case ee.TEXT_COMPACTION_MODE_LATCH:case ee.BYTE_COMPACTION_MODE_LATCH:case ee.NUMERIC_COMPACTION_MODE_LATCH:case ee.BYTE_COMPACTION_MODE_LATCH_6:case ee.BEGIN_MACRO_PDF417_CONTROL_BLOCK:case ee.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case ee.MACRO_PDF417_TERMINATOR:r--,w=!0;break}if(d%5===0&&d>0){for(let O=0;O<6;++O)c.write(Number(Zn(g)>>Zn(8*(5-O))));g=0,d=0}}break}return a.append(j.decode(c.toByteArray(),n)),r}static numericCompaction(e,t,n){let r=0,a=!1,c=new Int32Array(ee.MAX_NUMERIC_CODEWORDS);for(;t<e[0]&&!a;){let d=e[t++];if(t===e[0]&&(a=!0),d<ee.TEXT_COMPACTION_MODE_LATCH)c[r]=d,r++;else switch(d){case ee.TEXT_COMPACTION_MODE_LATCH:case ee.BYTE_COMPACTION_MODE_LATCH:case ee.BYTE_COMPACTION_MODE_LATCH_6:case ee.BEGIN_MACRO_PDF417_CONTROL_BLOCK:case ee.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case ee.MACRO_PDF417_TERMINATOR:t--,a=!0;break}(r%ee.MAX_NUMERIC_CODEWORDS===0||d===ee.NUMERIC_COMPACTION_MODE_LATCH||a)&&r>0&&(n.append(ee.decodeBase900toBase10(c,r)),r=0)}return t}static decodeBase900toBase10(e,t){let n=Zn(0);for(let a=0;a<t;a++)n+=ee.EXP900[t-a-1]*Zn(e[a]);let r=n.toString();if(r.charAt(0)!=="1")throw new z;return r.substring(1)}}ee.TEXT_COMPACTION_MODE_LATCH=900,ee.BYTE_COMPACTION_MODE_LATCH=901,ee.NUMERIC_COMPACTION_MODE_LATCH=902,ee.BYTE_COMPACTION_MODE_LATCH_6=924,ee.ECI_USER_DEFINED=925,ee.ECI_GENERAL_PURPOSE=926,ee.ECI_CHARSET=927,ee.BEGIN_MACRO_PDF417_CONTROL_BLOCK=928,ee.BEGIN_MACRO_PDF417_OPTIONAL_FIELD=923,ee.MACRO_PDF417_TERMINATOR=922,ee.MODE_SHIFT_TO_BYTE_COMPACTION_MODE=913,ee.MAX_NUMERIC_CODEWORDS=15,ee.MACRO_PDF417_OPTIONAL_FIELD_FILE_NAME=0,ee.MACRO_PDF417_OPTIONAL_FIELD_SEGMENT_COUNT=1,ee.MACRO_PDF417_OPTIONAL_FIELD_TIME_STAMP=2,ee.MACRO_PDF417_OPTIONAL_FIELD_SENDER=3,ee.MACRO_PDF417_OPTIONAL_FIELD_ADDRESSEE=4,ee.MACRO_PDF417_OPTIONAL_FIELD_FILE_SIZE=5,ee.MACRO_PDF417_OPTIONAL_FIELD_CHECKSUM=6,ee.PL=25,ee.LL=27,ee.AS=27,ee.ML=28,ee.AL=28,ee.PS=29,ee.PAL=29,ee.PUNCT_CHARS=`;<>@[\\]_\`~!\r ,:
|
|
18
|
+
-.$/"|*()?{}'`,ee.MIXED_CHARS="0123456789&\r ,:#-.$/+%*=^",ee.EXP900=qa()?yg():[],ee.NUMBER_OF_SEQUENCE_CODEWORDS=2;class Fe{constructor(){}static decode(e,t,n,r,a,c,d){let g=new sr(e,t,n,r,a),w=null,E=null,A;for(let L=!0;;L=!1){if(t!=null&&(w=Fe.getRowIndicatorColumn(e,g,t,!0,c,d)),r!=null&&(E=Fe.getRowIndicatorColumn(e,g,r,!1,c,d)),A=Fe.merge(w,E),A==null)throw N.getNotFoundInstance();let F=A.getBoundingBox();if(L&&F!=null&&(F.getMinY()<g.getMinY()||F.getMaxY()>g.getMaxY()))g=F;else break}A.setBoundingBox(g);let I=A.getBarcodeColumnCount()+1;A.setDetectionResultColumn(0,w),A.setDetectionResultColumn(I,E);let O=w!=null;for(let L=1;L<=I;L++){let F=O?L:I-L;if(A.getDetectionResultColumn(F)!==void 0)continue;let Z;F===0||F===I?Z=new Ga(g,F===0):Z=new jr(g),A.setDetectionResultColumn(F,Z);let ne=-1,ce=ne;for(let ue=g.getMinY();ue<=g.getMaxY();ue++){if(ne=Fe.getStartColumn(A,F,ue,O),ne<0||ne>g.getMaxX()){if(ce===-1)continue;ne=ce}let ae=Fe.detectCodeword(e,g.getMinX(),g.getMaxX(),O,ne,ue,c,d);ae!=null&&(Z.setCodeword(ue,ae),ce=ne,c=Math.min(c,ae.getWidth()),d=Math.max(d,ae.getWidth()))}}return Fe.createDecoderResult(A)}static merge(e,t){if(e==null&&t==null)return null;let n=Fe.getBarcodeMetadata(e,t);if(n==null)return null;let r=sr.merge(Fe.adjustBoundingBox(e),Fe.adjustBoundingBox(t));return new Zr(n,r)}static adjustBoundingBox(e){if(e==null)return null;let t=e.getRowHeights();if(t==null)return null;let n=Fe.getMax(t),r=0;for(let d of t)if(r+=n-d,d>0)break;let a=e.getCodewords();for(let d=0;r>0&&a[d]==null;d++)r--;let c=0;for(let d=t.length-1;d>=0&&(c+=n-t[d],!(t[d]>0));d--);for(let d=a.length-1;c>0&&a[d]==null;d--)c--;return e.getBoundingBox().addMissingRows(r,c,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 r;return t==null||(r=t.getBarcodeMetadata())==null?n:n.getColumnCount()!==r.getColumnCount()&&n.getErrorCorrectionLevel()!==r.getErrorCorrectionLevel()&&n.getRowCount()!==r.getRowCount()?null:n}static getRowIndicatorColumn(e,t,n,r,a,c){let d=new Ga(t,r);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 I=Fe.detectCodeword(e,0,e.getWidth(),r,E,A,a,c);I!=null&&(d.setCodeword(A,I),r?E=I.getStartX():E=I.getEndX())}}return d}static adjustCodewordCount(e,t){let n=t[0][1],r=n.getValue(),a=e.getBarcodeColumnCount()*e.getBarcodeRowCount()-Fe.getNumberOfECCodeWords(e.getBarcodeECLevel());if(r.length===0){if(a<1||a>ke.MAX_CODEWORDS_IN_BARCODE)throw N.getNotFoundInstance();n.setValue(a)}else r[0]!==a&&n.setValue(a)}static createDecoderResult(e){let t=Fe.createBarcodeMatrix(e);Fe.adjustCodewordCount(e,t);let n=new Array,r=new Int32Array(e.getBarcodeRowCount()*e.getBarcodeColumnCount()),a=[],c=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?r[A]=E[0]:(c.push(A),a.push(E))}let d=new Array(a.length);for(let g=0;g<d.length;g++)d[g]=a[g];return Fe.createDecoderResultFromAmbiguousValues(e.getBarcodeECLevel(),r,ke.toIntArray(n),ke.toIntArray(c),d)}static createDecoderResultFromAmbiguousValues(e,t,n,r,a){let c=new Int32Array(r.length),d=100;for(;d-- >0;){for(let g=0;g<c.length;g++)t[r[g]]=a[g][c[g]];try{return Fe.decodeCodewords(t,e,n)}catch(g){if(!(g instanceof M))throw g}if(c.length===0)throw M.getChecksumInstance();for(let g=0;g<c.length;g++)if(c[g]<a[g].length-1){c[g]++;break}else if(c[g]=0,g===c.length-1)throw M.getChecksumInstance()}throw M.getChecksumInstance()}static createBarcodeMatrix(e){let t=Array.from({length:e.getBarcodeRowCount()},()=>new Array(e.getBarcodeColumnCount()+2));for(let r=0;r<t.length;r++)for(let a=0;a<t[r].length;a++)t[r][a]=new qr;let n=0;for(let r of e.getDetectionResultColumns()){if(r!=null){for(let a of r.getCodewords())if(a!=null){let c=a.getRowNumber();if(c>=0){if(c>=t.length)continue;t[c][n].setValue(a.getValue())}}}n++}return t}static isValidBarcodeColumn(e,t){return t>=0&&t<=e.getBarcodeColumnCount()+1}static getStartColumn(e,t,n,r){let a=r?1:-1,c=null;if(Fe.isValidBarcodeColumn(e,t-a)&&(c=e.getDetectionResultColumn(t-a).getCodeword(n)),c!=null)return r?c.getEndX():c.getStartX();if(c=e.getDetectionResultColumn(t).getCodewordNearby(n),c!=null)return r?c.getStartX():c.getEndX();if(Fe.isValidBarcodeColumn(e,t-a)&&(c=e.getDetectionResultColumn(t-a).getCodewordNearby(n)),c!=null)return r?c.getEndX():c.getStartX();let d=0;for(;Fe.isValidBarcodeColumn(e,t-a);){t-=a;for(let g of e.getDetectionResultColumn(t).getCodewords())if(g!=null)return(r?g.getEndX():g.getStartX())+a*d*(g.getEndX()-g.getStartX());d++}return r?e.getBoundingBox().getMinX():e.getBoundingBox().getMaxX()}static detectCodeword(e,t,n,r,a,c,d,g){a=Fe.adjustCodewordStartColumn(e,t,n,r,a,c);let w=Fe.getModuleBitCount(e,t,n,r,a,c);if(w==null)return null;let E,A=He.sum(w);if(r)E=a+A;else{for(let L=0;L<w.length/2;L++){let F=w[L];w[L]=w[w.length-1-L],w[w.length-1-L]=F}E=a,a=E-A}if(!Fe.checkCodewordSkew(A,d,g))return null;let I=tn.getDecodedValue(w),O=ke.getCodeword(I);return O===-1?null:new Yr(a,E,Fe.getCodewordBucketNumber(I),O)}static getModuleBitCount(e,t,n,r,a,c){let d=a,g=new Int32Array(8),w=0,E=r?1:-1,A=r;for(;(r?d<n:d>=t)&&w<g.length;)e.get(d,c)===A?(g[w]++,d+=E):(w++,A=!A);return w===g.length||d===(r?n:t)&&w===g.length-1?g:null}static getNumberOfECCodeWords(e){return 2<<e}static adjustCodewordStartColumn(e,t,n,r,a,c){let d=a,g=r?-1:1;for(let w=0;w<2;w++){for(;(r?d>=t:d<n)&&r===e.get(d,c);){if(Math.abs(a-d)>Fe.CODEWORD_SKEW_SIZE)return a;d+=g}g=-g,r=!r}return d}static checkCodewordSkew(e,t,n){return t-Fe.CODEWORD_SKEW_SIZE<=e&&e<=n+Fe.CODEWORD_SKEW_SIZE}static decodeCodewords(e,t,n){if(e.length===0)throw z.getFormatInstance();let r=1<<t+1,a=Fe.correctErrors(e,n,r);Fe.verifyCodewordCount(e,r);let c=ee.decode(e,""+t);return c.setErrorsCorrected(a),c.setErasures(n.length),c}static correctErrors(e,t,n){if(t!=null&&t.length>n/2+Fe.MAX_ERRORS||n<0||n>Fe.MAX_EC_CODEWORDS)throw M.getChecksumInstance();return Fe.errorCorrection.decode(e,n,t)}static verifyCodewordCount(e,t){if(e.length<4)throw z.getFormatInstance();let n=e[0];if(n>e.length)throw z.getFormatInstance();if(n===0)if(t<e.length)e[0]=e.length-t;else throw z.getFormatInstance()}static getBitCountForCodeword(e){let t=new Int32Array(8),n=0,r=t.length-1;for(;!((e&1)!==n&&(n=e&1,r--,r<0));)t[r]++,e>>=1;return t}static getCodewordBucketNumber(e){return e instanceof Int32Array?this.getCodewordBucketNumber_Int32Array(e):this.getCodewordBucketNumber_number(e)}static getCodewordBucketNumber_number(e){return Fe.getCodewordBucketNumber(Fe.getBitCountForCodeword(e))}static getCodewordBucketNumber_Int32Array(e){return(e[0]-e[2]+e[4]-e[6]+9)%9}static toString(e){let t=new Xr;for(let n=0;n<e.length;n++){t.format("Row %2d: ",n);for(let r=0;r<e[n].length;r++){let a=e[n][r];a.getValue().length===0?t.format(" ",null):t.format("%4d(%2d)",a.getValue()[0],a.getConfidence(a.getValue()[0]))}t.format("%n")}return t.toString()}}Fe.CODEWORD_SKEW_SIZE=2,Fe.MAX_ERRORS=3,Fe.MAX_EC_CODEWORDS=512,Fe.errorCorrection=new Ha;class Vt{decode(e,t=null){let n=Vt.decode(e,t,!1);if(n==null||n.length===0||n[0]==null)throw N.getNotFoundInstance();return n[0]}decodeMultiple(e,t=null){try{return Vt.decode(e,t,!0)}catch(n){throw n instanceof z||n instanceof M?N.getNotFoundInstance():n}}static decode(e,t,n){const r=new Array,a=Pe.detectMultiple(e,t,n);for(const c of a.getPoints()){const d=Fe.decode(a.getBits(),c[4],c[5],c[6],c[7],Vt.getMinCodewordWidth(c),Vt.getMaxCodewordWidth(c)),g=new _e(d.getText(),d.getRawBytes(),void 0,c,he.PDF_417);g.putMetadata(Xe.ERROR_CORRECTION_LEVEL,d.getECLevel());const w=d.getOther();w!=null&&g.putMetadata(Xe.PDF417_EXTRA_METADATA,w),r.push(g)}return r.map(c=>c)}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(Vt.getMaxWidth(e[0],e[4]),Vt.getMaxWidth(e[6],e[2])*ke.MODULES_IN_CODEWORD/ke.MODULES_IN_STOP_PATTERN),Math.max(Vt.getMaxWidth(e[1],e[5]),Vt.getMaxWidth(e[7],e[3])*ke.MODULES_IN_CODEWORD/ke.MODULES_IN_STOP_PATTERN)))}static getMinCodewordWidth(e){return Math.floor(Math.min(Math.min(Vt.getMinWidth(e[0],e[4]),Vt.getMinWidth(e[6],e[2])*ke.MODULES_IN_CODEWORD/ke.MODULES_IN_STOP_PATTERN),Math.min(Vt.getMinWidth(e[1],e[5]),Vt.getMinWidth(e[7],e[3])*ke.MODULES_IN_CODEWORD/ke.MODULES_IN_STOP_PATTERN)))}reset(){}}class Ri extends p{}Ri.kind="ReaderException";class Za{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=!u(e)&&e.get(te.TRY_HARDER)===!0,n=u(e)?null:e.get(te.POSSIBLE_FORMATS),r=new Array;if(!u(n)){const a=n.some(c=>c===he.UPC_A||c===he.UPC_E||c===he.EAN_13||c===he.EAN_8||c===he.CODABAR||c===he.CODE_39||c===he.CODE_93||c===he.CODE_128||c===he.ITF||c===he.RSS_14||c===he.RSS_EXPANDED);a&&!t&&r.push(new Ar(e,this.verbose)),n.includes(he.QR_CODE)&&r.push(new qn),n.includes(he.DATA_MATRIX)&&r.push(new jn),n.includes(he.AZTEC)&&r.push(new le),n.includes(he.PDF_417)&&r.push(new Vt),a&&t&&r.push(new Ar(e,this.verbose))}r.length===0&&(t||r.push(new Ar(e,this.verbose)),r.push(new qn),r.push(new jn),r.push(new le),r.push(new Vt),t&&r.push(new Ar(e,this.verbose))),this.readers=r}reset(){if(this.readers!==null)for(const e of this.readers)e.reset()}decodeInternal(e){if(this.readers===null)throw new Ri("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 Ri)continue}throw new N("No MultiFormat Readers were able to detect the code.")}}class bg extends Ne{constructor(e=null,t=500){const n=new Za;n.setHints(e),super(n,t)}decodeBitmap(e){return this.reader.decodeWithState(e)}}class Ag extends Ne{constructor(e=500){super(new Vt,e)}}class Ig extends Ne{constructor(e=500){super(new qn,e)}}var Do;(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"})(Do||(Do={}));var kt=Do;class Po{constructor(e){this.field=e,this.cachedGenerators=[],this.cachedGenerators.push(new me(e,Int32Array.from([1])))}buildGenerator(e){const t=this.cachedGenerators;if(e>=t.length){let n=t[t.length-1];const r=this.field;for(let a=t.length;a<=e;a++){const c=n.multiply(new me(r,Int32Array.from([1,r.exp(a-1+r.getGeneratorBase())])));t.push(c),n=c}}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 r=this.buildGenerator(t),a=new Int32Array(n);P.arraycopy(e,0,a,0,n);let c=new me(this.field,a);c=c.multiplyByMonomial(t,1);const g=c.divide(r)[1].getCoefficients(),w=t-g.length;for(let E=0;E<w;E++)e[n+E]=0;P.arraycopy(g,0,e,n+w,g.length)}}class Et{constructor(){}static applyMaskPenaltyRule1(e){return Et.applyMaskPenaltyRule1Internal(e,!0)+Et.applyMaskPenaltyRule1Internal(e,!1)}static applyMaskPenaltyRule2(e){let t=0;const n=e.getArray(),r=e.getWidth(),a=e.getHeight();for(let c=0;c<a-1;c++){const d=n[c];for(let g=0;g<r-1;g++){const w=d[g];w===d[g+1]&&w===n[c+1][g]&&w===n[c+1][g+1]&&t++}}return Et.N2*t}static applyMaskPenaltyRule3(e){let t=0;const n=e.getArray(),r=e.getWidth(),a=e.getHeight();for(let c=0;c<a;c++)for(let d=0;d<r;d++){const g=n[c];d+6<r&&g[d]===1&&g[d+1]===0&&g[d+2]===1&&g[d+3]===1&&g[d+4]===1&&g[d+5]===0&&g[d+6]===1&&(Et.isWhiteHorizontal(g,d-4,d)||Et.isWhiteHorizontal(g,d+7,d+11))&&t++,c+6<a&&n[c][d]===1&&n[c+1][d]===0&&n[c+2][d]===1&&n[c+3][d]===1&&n[c+4][d]===1&&n[c+5][d]===0&&n[c+6][d]===1&&(Et.isWhiteVertical(n,d,c-4,c)||Et.isWhiteVertical(n,d,c+7,c+11))&&t++}return t*Et.N3}static isWhiteHorizontal(e,t,n){t=Math.max(t,0),n=Math.min(n,e.length);for(let r=t;r<n;r++)if(e[r]===1)return!1;return!0}static isWhiteVertical(e,t,n,r){n=Math.max(n,0),r=Math.min(r,e.length);for(let a=n;a<r;a++)if(e[a][t]===1)return!1;return!0}static applyMaskPenaltyRule4(e){let t=0;const n=e.getArray(),r=e.getWidth(),a=e.getHeight();for(let g=0;g<a;g++){const w=n[g];for(let E=0;E<r;E++)w[E]===1&&t++}const c=e.getHeight()*e.getWidth();return Math.floor(Math.abs(t*2-c)*10/c)*Et.N4}static getDataMaskBit(e,t,n){let r,a;switch(e){case 0:r=n+t&1;break;case 1:r=n&1;break;case 2:r=t%3;break;case 3:r=(n+t)%3;break;case 4:r=Math.floor(n/2)+Math.floor(t/3)&1;break;case 5:a=n*t,r=(a&1)+a%3;break;case 6:a=n*t,r=(a&1)+a%3&1;break;case 7:a=n*t,r=a%3+(n+t&1)&1;break;default:throw new y("Invalid mask pattern: "+e)}return r===0}static applyMaskPenaltyRule1Internal(e,t){let n=0;const r=t?e.getHeight():e.getWidth(),a=t?e.getWidth():e.getHeight(),c=e.getArray();for(let d=0;d<r;d++){let g=0,w=-1;for(let E=0;E<a;E++){const A=t?c[d][E]:c[E][d];A===w?g++:(g>=5&&(n+=Et.N1+(g-5)),g=1,w=A)}g>=5&&(n+=Et.N1+(g-5))}return n}}Et.N1=3,Et.N2=3,Et.N3=40,Et.N4=10;class Oi{constructor(e,t){this.width=e,this.height=t;const n=new Array(t);for(let r=0;r!==t;r++)n[r]=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)B.fill(t,e)}equals(e){if(!(e instanceof Oi))return!1;const t=e;if(this.width!==t.width||this.height!==t.height)return!1;for(let n=0,r=this.height;n<r;++n){const a=this.bytes[n],c=t.bytes[n];for(let d=0,g=this.width;d<g;++d)if(a[d]!==c[d])return!1}return!0}toString(){const e=new V;for(let t=0,n=this.height;t<n;++t){const r=this.bytes[t];for(let a=0,c=this.width;a<c;++a)switch(r[a]){case 0:e.append(" 0");break;case 1:e.append(" 1");break;default:e.append(" ");break}e.append(`
|
|
19
|
+
`)}return e.toString()}}class ar{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 V;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<sr.NUM_MASK_PATTERNS}}sr.NUM_MASK_PATTERNS=8;class at extends p{}at.kind="WriterException";class Te{constructor(){}static clearMatrix(e){e.clear(255)}static buildMatrix(e,t,n,r,s){Te.clearMatrix(s),Te.embedBasicPatterns(n,s),Te.embedTypeInfo(t,r,s),Te.maybeEmbedVersionInfo(n,s),Te.embedDataBits(e,r,s)}static embedBasicPatterns(e,t){Te.embedPositionDetectionPatternsAndSeparators(t),Te.embedDarkDotAtLeftBottomCorner(t),Te.maybeEmbedPositionAdjustmentPatterns(e,t),Te.embedTimingPatterns(t)}static embedTypeInfo(e,t,n){const r=new V;Te.makeTypeInfoBits(e,t,r);for(let s=0,c=r.getSize();s<c;++s){const d=r.get(r.getSize()-1-s),g=Te.TYPE_INFO_COORDINATES[s],x=g[0],E=g[1];if(n.setBoolean(x,E,d),s<8){const A=n.getWidth()-s-1;n.setBoolean(A,8,d)}else{const I=n.getHeight()-7+(s-8);n.setBoolean(8,I,d)}}}static maybeEmbedVersionInfo(e,t){if(e.getVersionNumber()<7)return;const n=new V;Te.makeVersionInfoBits(e,n);let r=6*3-1;for(let s=0;s<6;++s)for(let c=0;c<3;++c){const d=n.get(r);r--,t.setBoolean(s,t.getHeight()-11+c,d),t.setBoolean(t.getHeight()-11+c,s,d)}}static embedDataBits(e,t,n){let r=0,s=-1,c=n.getWidth()-1,d=n.getHeight()-1;for(;c>0;){for(c===6&&(c-=1);d>=0&&d<n.getHeight();){for(let g=0;g<2;++g){const x=c-g;if(!Te.isEmpty(n.get(x,d)))continue;let E;r<e.getSize()?(E=e.get(r),++r):E=!1,t!==255&&Et.getDataMaskBit(t,x,d)&&(E=!E),n.setBoolean(x,d,E)}d+=s}s=-s,d+=s,c-=2}if(r!==e.getSize())throw new at("Not all bits consumed: "+r+"/"+e.getSize())}static findMSBSet(e){return 32-k.numberOfLeadingZeros(e)}static calculateBCHCode(e,t){if(t===0)throw new y("0 polynomial");const n=Te.findMSBSet(t);for(e<<=n-1;Te.findMSBSet(e)>=n;)e^=t<<Te.findMSBSet(e)-n;return e}static makeTypeInfoBits(e,t,n){if(!sr.isValidMaskPattern(t))throw new at("Invalid mask pattern");const r=e.getBits()<<3|t;n.appendBits(r,5);const s=Te.calculateBCHCode(r,Te.TYPE_INFO_POLY);n.appendBits(s,10);const c=new V;if(c.appendBits(Te.TYPE_INFO_MASK_PATTERN,15),n.xor(c),n.getSize()!==15)throw new at("should not happen but we got: "+n.getSize())}static makeVersionInfoBits(e,t){t.appendBits(e.getVersionNumber(),6);const n=Te.calculateBCHCode(e.getVersionNumber(),Te.VERSION_INFO_POLY);if(t.appendBits(n,12),t.getSize()!==18)throw new at("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;Te.isEmpty(e.get(t,6))&&e.setNumber(t,6,n),Te.isEmpty(e.get(6,t))&&e.setNumber(6,t,n)}}static embedDarkDotAtLeftBottomCorner(e){if(e.get(8,e.getHeight()-8)===0)throw new at;e.setNumber(8,e.getHeight()-8,1)}static embedHorizontalSeparationPattern(e,t,n){for(let r=0;r<8;++r){if(!Te.isEmpty(n.get(e+r,t)))throw new at;n.setNumber(e+r,t,0)}}static embedVerticalSeparationPattern(e,t,n){for(let r=0;r<7;++r){if(!Te.isEmpty(n.get(e,t+r)))throw new at;n.setNumber(e,t+r,0)}}static embedPositionAdjustmentPattern(e,t,n){for(let r=0;r<5;++r){const s=Te.POSITION_ADJUSTMENT_PATTERN[r];for(let c=0;c<5;++c)n.setNumber(e+c,t+r,s[c])}}static embedPositionDetectionPattern(e,t,n){for(let r=0;r<7;++r){const s=Te.POSITION_DETECTION_PATTERN[r];for(let c=0;c<7;++c)n.setNumber(e+c,t+r,s[c])}}static embedPositionDetectionPatternsAndSeparators(e){const t=Te.POSITION_DETECTION_PATTERN[0].length;Te.embedPositionDetectionPattern(0,0,e),Te.embedPositionDetectionPattern(e.getWidth()-t,0,e),Te.embedPositionDetectionPattern(0,e.getWidth()-t,e);const n=8;Te.embedHorizontalSeparationPattern(0,n-1,e),Te.embedHorizontalSeparationPattern(e.getWidth()-n,n-1,e),Te.embedHorizontalSeparationPattern(0,e.getWidth()-n,e);const r=7;Te.embedVerticalSeparationPattern(r,0,e),Te.embedVerticalSeparationPattern(e.getHeight()-r-1,0,e),Te.embedVerticalSeparationPattern(r,e.getHeight()-r,e)}static maybeEmbedPositionAdjustmentPatterns(e,t){if(e.getVersionNumber()<2)return;const n=e.getVersionNumber()-1,r=Te.POSITION_ADJUSTMENT_PATTERN_COORDINATE_TABLE[n];for(let s=0,c=r.length;s!==c;s++){const d=r[s];if(d>=0)for(let g=0;g!==c;g++){const x=r[g];x>=0&&Te.isEmpty(t.get(x,d))&&Te.embedPositionAdjustmentPattern(x-2,d-2,t)}}}}Te.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])]),Te.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])]),Te.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])]),Te.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])]),Te.VERSION_INFO_POLY=7973,Te.TYPE_INFO_POLY=1335,Te.TYPE_INFO_MASK_PATTERN=21522;class bg{constructor(e,t){this.dataBytes=e,this.errorCorrectionBytes=t}getDataBytes(){return this.dataBytes}getErrorCorrectionBytes(){return this.errorCorrectionBytes}}class ht{constructor(){}static calculateMaskPenalty(e){return Et.applyMaskPenaltyRule1(e)+Et.applyMaskPenaltyRule2(e)+Et.applyMaskPenaltyRule3(e)+Et.applyMaskPenaltyRule4(e)}static encode(e,t,n=null){let r=ht.DEFAULT_BYTE_MODE_ENCODING;const s=n!==null&&n.get(kt.CHARACTER_SET)!==void 0;s&&(r=n.get(kt.CHARACTER_SET).toString());const c=this.chooseMode(e,r),d=new V;if(c===Se.BYTE&&(s||ht.DEFAULT_BYTE_MODE_ENCODING!==r)){const ue=z.getCharacterSetECIByName(r);ue!==void 0&&this.appendECI(ue,d)}this.appendModeInfo(c,d);const g=new V;this.appendBytes(e,c,g,r);let x;if(n!==null&&n.get(kt.QR_VERSION)!==void 0){const ue=Number.parseInt(n.get(kt.QR_VERSION).toString(),10);x=Ie.getVersionForNumber(ue);const ae=this.calculateBitsNeeded(c,d,g,x);if(!this.willFit(ae,x,t))throw new at("Data too big for requested version")}else x=this.recommendVersion(t,c,d,g);const E=new V;E.appendBitArray(d);const A=c===Se.BYTE?g.getSizeInBytes():e.length;this.appendLengthInfo(A,x,c,E),E.appendBitArray(g);const I=x.getECBlocksForLevel(t),O=x.getTotalCodewords()-I.getTotalECCodewords();this.terminateBits(O,E);const L=this.interleaveWithECBytes(E,x.getTotalCodewords(),O,I.getNumBlocks()),F=new sr;F.setECLevel(t),F.setMode(c),F.setVersion(x);const q=x.getDimensionForVersion(),J=new ki(q,q),ce=this.chooseMaskPattern(L,t,x,J);return F.setMaskPattern(ce),Te.buildMatrix(L,t,x,ce,J),F.setMatrix(J),F}static recommendVersion(e,t,n,r){const s=this.calculateBitsNeeded(t,n,r,Ie.getVersionForNumber(1)),c=this.chooseVersion(s,e),d=this.calculateBitsNeeded(t,n,r,c);return this.chooseVersion(d,e)}static calculateBitsNeeded(e,t,n,r){return t.getSize()+e.getCharacterCountBits(r)+n.getSize()}static getAlphanumericCode(e){return e<ht.ALPHANUMERIC_TABLE.length?ht.ALPHANUMERIC_TABLE[e]:-1}static chooseMode(e,t=null){if(z.SJIS.getName()===t&&this.isOnlyDoubleByteKanji(e))return Se.KANJI;let n=!1,r=!1;for(let s=0,c=e.length;s<c;++s){const d=e.charAt(s);if(ht.isDigit(d))n=!0;else if(this.getAlphanumericCode(d.charCodeAt(0))!==-1)r=!0;else return Se.BYTE}return r?Se.ALPHANUMERIC:n?Se.NUMERIC:Se.BYTE}static isOnlyDoubleByteKanji(e){let t;try{t=G.encode(e,z.SJIS)}catch{return!1}const n=t.length;if(n%2!==0)return!1;for(let r=0;r<n;r+=2){const s=t[r]&255;if((s<129||s>159)&&(s<224||s>235))return!1}return!0}static chooseMaskPattern(e,t,n,r){let s=Number.MAX_SAFE_INTEGER,c=-1;for(let d=0;d<sr.NUM_MASK_PATTERNS;d++){Te.buildMatrix(e,t,n,d,r);let g=this.calculateMaskPenalty(r);g<s&&(s=g,c=d)}return c}static chooseVersion(e,t){for(let n=1;n<=40;n++){const r=Ie.getVersionForNumber(n);if(ht.willFit(e,r,t))return r}throw new at("Data too big")}static willFit(e,t,n){const r=t.getTotalCodewords(),c=t.getECBlocksForLevel(n).getTotalECCodewords(),d=r-c,g=(e+7)/8;return d>=g}static terminateBits(e,t){const n=e*8;if(t.getSize()>n)throw new at("data bits cannot fit in the QR Code"+t.getSize()+" > "+n);for(let c=0;c<4&&t.getSize()<n;++c)t.appendBit(!1);const r=t.getSize()&7;if(r>0)for(let c=r;c<8;c++)t.appendBit(!1);const s=e-t.getSizeInBytes();for(let c=0;c<s;++c)t.appendBits(c&1?17:236,8);if(t.getSize()!==n)throw new at("Bits size does not equal capacity")}static getNumDataBytesAndNumECBytesForBlockID(e,t,n,r,s,c){if(r>=n)throw new at("Block ID too large");const d=e%n,g=n-d,x=Math.floor(e/n),E=x+1,A=Math.floor(t/n),I=A+1,O=x-A,L=E-I;if(O!==L)throw new at("EC bytes mismatch");if(n!==g+d)throw new at("RS blocks mismatch");if(e!==(A+O)*g+(I+L)*d)throw new at("Total bytes mismatch");r<g?(s[0]=A,c[0]=O):(s[0]=I,c[0]=L)}static interleaveWithECBytes(e,t,n,r){if(e.getSizeInBytes()!==n)throw new at("Number of bits and data bytes does not match");let s=0,c=0,d=0;const g=new Array;for(let E=0;E<r;++E){const A=new Int32Array(1),I=new Int32Array(1);ht.getNumDataBytesAndNumECBytesForBlockID(t,n,r,E,A,I);const O=A[0],L=new Uint8Array(O);e.toBytes(8*s,L,0,O);const F=ht.generateECBytes(L,I[0]);g.push(new bg(L,F)),c=Math.max(c,O),d=Math.max(d,F.length),s+=A[0]}if(n!==s)throw new at("Data bytes does not match offset");const x=new V;for(let E=0;E<c;++E)for(const A of g){const I=A.getDataBytes();E<I.length&&x.appendBits(I[E],8)}for(let E=0;E<d;++E)for(const A of g){const I=A.getErrorCorrectionBytes();E<I.length&&x.appendBits(I[E],8)}if(t!==x.getSizeInBytes())throw new at("Interleaving error: "+t+" and "+x.getSizeInBytes()+" differ.");return x}static generateECBytes(e,t){const n=e.length,r=new Int32Array(n+t);for(let c=0;c<n;c++)r[c]=e[c]&255;new vo(Ee.QR_CODE_FIELD_256).encode(r,t);const s=new Uint8Array(t);for(let c=0;c<t;c++)s[c]=r[n+c];return s}static appendModeInfo(e,t){t.appendBits(e.getBits(),4)}static appendLengthInfo(e,t,n,r){const s=n.getCharacterCountBits(t);if(e>=1<<s)throw new at(e+" is bigger than "+((1<<s)-1));r.appendBits(e,s)}static appendBytes(e,t,n,r){switch(t){case Se.NUMERIC:ht.appendNumericBytes(e,n);break;case Se.ALPHANUMERIC:ht.appendAlphanumericBytes(e,n);break;case Se.BYTE:ht.append8BitBytes(e,n,r);break;case Se.KANJI:ht.appendKanjiBytes(e,n);break;default:throw new at("Invalid mode: "+t)}}static getDigit(e){return e.charCodeAt(0)-48}static isDigit(e){const t=ht.getDigit(e);return t>=0&&t<=9}static appendNumericBytes(e,t){const n=e.length;let r=0;for(;r<n;){const s=ht.getDigit(e.charAt(r));if(r+2<n){const c=ht.getDigit(e.charAt(r+1)),d=ht.getDigit(e.charAt(r+2));t.appendBits(s*100+c*10+d,10),r+=3}else if(r+1<n){const c=ht.getDigit(e.charAt(r+1));t.appendBits(s*10+c,7),r+=2}else t.appendBits(s,4),r++}}static appendAlphanumericBytes(e,t){const n=e.length;let r=0;for(;r<n;){const s=ht.getAlphanumericCode(e.charCodeAt(r));if(s===-1)throw new at;if(r+1<n){const c=ht.getAlphanumericCode(e.charCodeAt(r+1));if(c===-1)throw new at;t.appendBits(s*45+c,11),r+=2}else t.appendBits(s,6),r++}}static append8BitBytes(e,t,n){let r;try{r=G.encode(e,n)}catch(s){throw new at(s)}for(let s=0,c=r.length;s!==c;s++){const d=r[s];t.appendBits(d,8)}}static appendKanjiBytes(e,t){let n;try{n=G.encode(e,z.SJIS)}catch(s){throw new at(s)}const r=n.length;for(let s=0;s<r;s+=2){const c=n[s]&255,d=n[s+1]&255,g=c<<8&4294967295|d;let x=-1;if(g>=33088&&g<=40956?x=g-33088:g>=57408&&g<=60351&&(x=g-49472),x===-1)throw new at("Invalid byte sequence");const E=(x>>8)*192+(x&255);t.appendBits(E,13)}}static appendECI(e,t){t.appendBits(Se.ECI.getBits(),4),t.appendBits(e.getValue(),8)}}ht.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]),ht.DEFAULT_BYTE_MODE_ENCODING=z.UTF8.getName();class ar{write(e,t,n,r=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 s=ct.L,c=ar.QUIET_ZONE_SIZE;r!==null&&(r.get(kt.ERROR_CORRECTION)!==void 0&&(s=ct.fromString(r.get(kt.ERROR_CORRECTION).toString())),r.get(kt.MARGIN)!==void 0&&(c=Number.parseInt(r.get(kt.MARGIN).toString(),10)));const d=ht.encode(e,s,r);return this.renderResult(d,t,n,c)}writeToDom(e,t,n,r,s=null){typeof e=="string"&&(e=document.querySelector(e));const c=this.write(t,n,r,s);e&&e.appendChild(c)}renderResult(e,t,n,r){const s=e.getMatrix();if(s===null)throw new nt;const c=s.getWidth(),d=s.getHeight(),g=c+r*2,x=d+r*2,E=Math.max(t,g),A=Math.max(n,x),I=Math.min(Math.floor(E/g),Math.floor(A/x)),O=Math.floor((E-c*I)/2),L=Math.floor((A-d*I)/2),F=this.createSVGElement(E,A);for(let q=0,J=L;q<d;q++,J+=I)for(let ce=0,ue=O;ce<c;ce++,ue+=I)if(s.get(ce,q)===1){const ae=this.createSvgRectElement(ue,J,I,I);F.appendChild(ae)}return F}createSVGElement(e,t){const n=document.createElementNS(ar.SVG_NS,"svg");return n.setAttributeNS(null,"height",e.toString()),n.setAttributeNS(null,"width",t.toString()),n}createSvgRectElement(e,t,n,r){const s=document.createElementNS(ar.SVG_NS,"rect");return s.setAttributeNS(null,"x",e.toString()),s.setAttributeNS(null,"y",t.toString()),s.setAttributeNS(null,"height",n.toString()),s.setAttributeNS(null,"width",r.toString()),s.setAttributeNS(null,"fill","#000000"),s}}ar.QUIET_ZONE_SIZE=4,ar.SVG_NS="http://www.w3.org/2000/svg";class Ir{encode(e,t,n,r,s){if(e.length===0)throw new y("Found empty contents");if(t!==fe.QR_CODE)throw new y("Can only encode QR_CODE, but got "+t);if(n<0||r<0)throw new y(`Requested dimensions are too small: ${n}x${r}`);let c=ct.L,d=Ir.QUIET_ZONE_SIZE;s!==null&&(s.get(kt.ERROR_CORRECTION)!==void 0&&(c=ct.fromString(s.get(kt.ERROR_CORRECTION).toString())),s.get(kt.MARGIN)!==void 0&&(d=Number.parseInt(s.get(kt.MARGIN).toString(),10)));const g=ht.encode(e,c,s);return Ir.renderResult(g,n,r,d)}static renderResult(e,t,n,r){const s=e.getMatrix();if(s===null)throw new nt;const c=s.getWidth(),d=s.getHeight(),g=c+r*2,x=d+r*2,E=Math.max(t,g),A=Math.max(n,x),I=Math.min(Math.floor(E/g),Math.floor(A/x)),O=Math.floor((E-c*I)/2),L=Math.floor((A-d*I)/2),F=new X(E,A);for(let q=0,J=L;q<d;q++,J+=I)for(let ce=0,ue=O;ce<c;ce++,ue+=I)s.get(ce,q)===1&&F.setRegion(ue,J,I,I);return F}}Ir.QUIET_ZONE_SIZE=4;class Ag{encode(e,t,n,r,s){let c;switch(t){case fe.QR_CODE:c=new Ir;break;default:throw new y("No encoder available for format "+t)}return c.encode(e,t,n,r,s)}}class On extends ee{constructor(e,t,n,r,s,c,d,g){if(super(c,d),this.yuvData=e,this.dataWidth=t,this.dataHeight=n,this.left=r,this.top=s,r+c>t||s+d>n)throw new y("Crop rectangle does not fit within image data.");g&&this.reverseHorizontal(c,d)}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 r=(e+this.top)*this.dataWidth+this.left;return P.arraycopy(this.yuvData,r,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,r=new Uint8ClampedArray(n);let s=this.top*this.dataWidth+this.left;if(e===this.dataWidth)return P.arraycopy(this.yuvData,s,r,0,n),r;for(let c=0;c<t;c++){const d=c*e;P.arraycopy(this.yuvData,s,r,d,e),s+=this.dataWidth}return r}isCropSupported(){return!0}crop(e,t,n,r){return new On(this.yuvData,this.dataWidth,this.dataHeight,this.left+e,this.top+t,n,r,!1)}renderThumbnail(){const e=this.getWidth()/On.THUMBNAIL_SCALE_FACTOR,t=this.getHeight()/On.THUMBNAIL_SCALE_FACTOR,n=new Int32Array(e*t),r=this.yuvData;let s=this.top*this.dataWidth+this.left;for(let c=0;c<t;c++){const d=c*e;for(let g=0;g<e;g++){const x=r[s+g*On.THUMBNAIL_SCALE_FACTOR]&255;n[d+g]=4278190080|x*65793}s+=this.dataWidth*On.THUMBNAIL_SCALE_FACTOR}return n}getThumbnailWidth(){return this.getWidth()/On.THUMBNAIL_SCALE_FACTOR}getThumbnailHeight(){return this.getHeight()/On.THUMBNAIL_SCALE_FACTOR}reverseHorizontal(e,t){const n=this.yuvData;for(let r=0,s=this.top*this.dataWidth+this.left;r<t;r++,s+=this.dataWidth){const c=s+e/2;for(let d=s,g=s+e-1;d<c;d++,g--){const x=n[d];n[d]=n[g],n[g]=x}}}invert(){return new j(this)}}On.THUMBNAIL_SCALE_FACTOR=2;class Do extends ee{constructor(e,t,n,r,s,c,d){if(super(t,n),this.dataWidth=r,this.dataHeight=s,this.left=c,this.top=d,e.BYTES_PER_ELEMENT===4){const g=t*n,x=new Uint8ClampedArray(g);for(let E=0;E<g;E++){const A=e[E],I=A>>16&255,O=A>>7&510,L=A&255;x[E]=(I+O+L)/4&255}this.luminances=x}else this.luminances=e;if(r===void 0&&(this.dataWidth=t),s===void 0&&(this.dataHeight=n),c===void 0&&(this.left=0),d===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 r=(e+this.top)*this.dataWidth+this.left;return P.arraycopy(this.luminances,r,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,r=new Uint8ClampedArray(n);let s=this.top*this.dataWidth+this.left;if(e===this.dataWidth)return P.arraycopy(this.luminances,s,r,0,n),r;for(let c=0;c<t;c++){const d=c*e;P.arraycopy(this.luminances,s,r,d,e),s+=this.dataWidth}return r}isCropSupported(){return!0}crop(e,t,n,r){return new Do(this.luminances,n,r,this.dataWidth,this.dataHeight,this.left+e,this.top+t)}invert(){return new j(this)}}class Xa extends z{static forName(e){return this.getCharacterSetECIByName(e)}}class Po{}Po.ISO_8859_1=z.ISO8859_1;class ja{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 Za{static singletonList(e){return[e]}static min(e,t){return e.sort(t)[0]}}class Ig{constructor(e){this.previous=e}getPrevious(){return this.previous}}class Sr extends Ig{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 Sr(this,e,t)}addBinaryShift(e,t){return console.warn("addBinaryShift on SimpleToken, this simply returns a copy of this token"),new Sr(this,e,t)}toString(){let e=this.value&(1<<this.bitCount)-1;return e|=1<<this.bitCount,"<"+k.toBinaryString(e|1<<this.bitCount).substring(1)+">"}}class Lo extends Sr{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 Lo(this,e,t)}toString(){return"<"+this.binaryShiftStart+"::"+(this.binaryShiftStart+this.binaryShiftByteCount-1)+">"}}function Sg(b,e,t){return new Lo(b,e,t)}function qr(b,e,t){return new Sr(b,e,t)}const Ng=["UPPER","LOWER","DIGIT","MIXED","PUNCT"],qn=0,Ri=1,mn=2,qa=3,Bn=4,Tg=new Sr(null,0,0),Fo=[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 kg(b){for(let e of b)M.fill(e,-1);return b[qn][Bn]=0,b[Ri][Bn]=0,b[Ri][qn]=28,b[qa][Bn]=0,b[mn][Bn]=0,b[mn][qn]=15,b}const Ya=kg(M.createInt32Array(6,6));class Mn{constructor(e,t,n,r){this.token=e,this.mode=t,this.binaryShiftByteCount=n,this.bitCount=r}getMode(){return this.mode}getToken(){return this.token}getBinaryShiftByteCount(){return this.binaryShiftByteCount}getBitCount(){return this.bitCount}latchAndAppend(e,t){let n=this.bitCount,r=this.token;if(e!==this.mode){let c=Fo[this.mode][e];r=qr(r,c&65535,c>>16),n+=c>>16}let s=e===mn?4:5;return r=qr(r,t,s),new Mn(r,e,0,n+s)}shiftAndAppend(e,t){let n=this.token,r=this.mode===mn?4:5;return n=qr(n,Ya[this.mode][e],r),n=qr(n,t,5),new Mn(n,this.mode,0,this.bitCount+r+5)}addBinaryShiftChar(e){let t=this.token,n=this.mode,r=this.bitCount;if(this.mode===Bn||this.mode===mn){let d=Fo[n][qn];t=qr(t,d&65535,d>>16),r+=d>>16,n=qn}let s=this.binaryShiftByteCount===0||this.binaryShiftByteCount===31?18:this.binaryShiftByteCount===62?9:8,c=new Mn(t,n,this.binaryShiftByteCount+1,r+s);return c.binaryShiftByteCount===2078&&(c=c.endBinaryShift(e+1)),c}endBinaryShift(e){if(this.binaryShiftByteCount===0)return this;let t=this.token;return t=Sg(t,e-this.binaryShiftByteCount,this.binaryShiftByteCount),new Mn(t,this.mode,0,this.bitCount)}isBetterThanOrEqualTo(e){let t=this.bitCount+(Fo[this.mode][e.mode]>>16);return this.binaryShiftByteCount<e.binaryShiftByteCount?t+=Mn.calculateBinaryShiftCost(e)-Mn.calculateBinaryShiftCost(this):this.binaryShiftByteCount>e.binaryShiftByteCount&&e.binaryShiftByteCount>0&&(t+=10),t<=e.bitCount}toBitArray(e){let t=[];for(let r=this.endBinaryShift(e.length).token;r!==null;r=r.getPrevious())t.unshift(r);let n=new V;for(const r of t)r.appendTo(n,e);return n}toString(){return W.format("%s bits=%d bytes=%d",Ng[this.mode],this.bitCount,this.binaryShiftByteCount)}static calculateBinaryShiftCost(e){return e.binaryShiftByteCount>62?21:e.binaryShiftByteCount>31?20:e.binaryShiftByteCount>0?10:0}}Mn.INITIAL_STATE=new Mn(Tg,qn,0,0);function Rg(b){const e=W.getCharCode(" "),t=W.getCharCode("."),n=W.getCharCode(",");b[qn][e]=1;const r=W.getCharCode("Z"),s=W.getCharCode("A");for(let I=s;I<=r;I++)b[qn][I]=I-s+2;b[Ri][e]=1;const c=W.getCharCode("z"),d=W.getCharCode("a");for(let I=d;I<=c;I++)b[Ri][I]=I-d+2;b[mn][e]=1;const g=W.getCharCode("9"),x=W.getCharCode("0");for(let I=x;I<=g;I++)b[mn][I]=I-x+2;b[mn][n]=12,b[mn][t]=13;const E=["\0"," ","","","","","","","\x07","\b"," ",`
|
|
29
|
-
`,"\v","\f","\r","\x1B","","","","","@","\\","^","_","`","|","~",""];for(let I=0;I<E.length;I++)b[
|
|
30
|
-
`);let n=Za.singletonList(Mn.INITIAL_STATE);for(let s=0;s<this.text.length;s++){let c,d=s+1<this.text.length?this.text[s+1]:0;switch(this.text[s]){case W.getCharCode("\r"):c=d===t?2:0;break;case W.getCharCode("."):c=d===e?3:0;break;case W.getCharCode(","):c=d===e?4:0;break;case W.getCharCode(":"):c=d===e?5:0;break;default:c=0}c>0?(n=Yr.updateStateListForPair(n,s,c),s++):n=this.updateStateListForChar(n,s)}return Za.min(n,(s,c)=>s.getBitCount()-c.getBitCount()).toBitArray(this.text)}updateStateListForChar(e,t){const n=[];for(let r of e)this.updateStateForChar(r,t,n);return Yr.simplifyStates(n)}updateStateForChar(e,t,n){let r=this.text[t]&255,s=Vo[e.getMode()][r]>0,c=null;for(let d=0;d<=Bn;d++){let g=Vo[d][r];if(g>0){if(c==null&&(c=e.endBinaryShift(t)),!s||d===e.getMode()||d===mn){const x=c.latchAndAppend(d,g);n.push(x)}if(!s&&Ya[e.getMode()][d]>=0){const x=c.shiftAndAppend(d,g);n.push(x)}}}if(e.getBinaryShiftByteCount()>0||Vo[e.getMode()][r]===0){let d=e.addBinaryShiftChar(t);n.push(d)}}static updateStateListForPair(e,t,n){const r=[];for(let s of e)this.updateStateForPair(s,t,n,r);return this.simplifyStates(r)}static updateStateForPair(e,t,n,r){let s=e.endBinaryShift(t);if(r.push(s.latchAndAppend(Bn,n)),e.getMode()!==Bn&&r.push(s.shiftAndAppend(Bn,n)),n===3||n===4){let c=s.latchAndAppend(mn,16-n).latchAndAppend(mn,1);r.push(c)}if(e.getBinaryShiftByteCount()>0){let c=e.addBinaryShiftChar(t).addBinaryShiftChar(t+1);r.push(c)}}static simplifyStates(e){let t=[];for(const n of e){let r=!0;for(const s of t){if(s.isBetterThanOrEqualTo(n)){r=!1;break}n.isBetterThanOrEqualTo(s)&&(t=t.filter(c=>c!==s))}r&&t.push(n)}return t}}class $e{constructor(){}static encodeBytes(e){return $e.encode(e,$e.DEFAULT_EC_PERCENT,$e.DEFAULT_AZTEC_LAYERS)}static encode(e,t,n){let r=new Yr(e).encode(),s=k.truncDivision(r.getSize()*t,100)+11,c=r.getSize()+s,d,g,x,E,A;if(n!==$e.DEFAULT_AZTEC_LAYERS){if(d=n<0,g=Math.abs(n),g>(d?$e.MAX_NB_BITS_COMPACT:$e.MAX_NB_BITS))throw new y(W.format("Illegal value %s for layers",n));x=$e.totalBitsInLayer(g,d),E=$e.WORD_SIZE[g];let ae=x-x%E;if(A=$e.stuffBits(r,E),A.getSize()+s>ae)throw new y("Data to large for user specified layer");if(d&&A.getSize()>E*64)throw new y("Data to large for user specified layer")}else{E=0,A=null;for(let ae=0;;ae++){if(ae>$e.MAX_NB_BITS)throw new y("Data too large for an Aztec code");if(d=ae<=3,g=d?ae+1:ae,x=$e.totalBitsInLayer(g,d),c>x)continue;(A==null||E!==$e.WORD_SIZE[g])&&(E=$e.WORD_SIZE[g],A=$e.stuffBits(r,E));let Ge=x-x%E;if(!(d&&A.getSize()>E*64)&&A.getSize()+s<=Ge)break}}let I=$e.generateCheckWords(A,x,E),O=A.getSize()/E,L=$e.generateModeMessage(d,g,O),F=(d?11:14)+g*4,q=new Int32Array(F),J;if(d){J=F;for(let ae=0;ae<q.length;ae++)q[ae]=ae}else{J=F+1+2*k.truncDivision(k.truncDivision(F,2)-1,15);let ae=k.truncDivision(F,2),Ge=k.truncDivision(J,2);for(let ve=0;ve<ae;ve++){let nn=ve+k.truncDivision(ve,15);q[ae-ve-1]=Ge-nn-1,q[ae+ve]=Ge+nn+1}}let ce=new X(J);for(let ae=0,Ge=0;ae<g;ae++){let ve=(g-ae)*4+(d?9:12);for(let nn=0;nn<ve;nn++){let An=nn*2;for(let rn=0;rn<2;rn++)I.get(Ge+An+rn)&&ce.set(q[ae*2+rn],q[ae*2+nn]),I.get(Ge+ve*2+An+rn)&&ce.set(q[ae*2+nn],q[F-1-ae*2-rn]),I.get(Ge+ve*4+An+rn)&&ce.set(q[F-1-ae*2-rn],q[F-1-ae*2-nn]),I.get(Ge+ve*6+An+rn)&&ce.set(q[F-1-ae*2-nn],q[ae*2+rn])}Ge+=ve*8}if($e.drawModeMessage(ce,d,J,L),d)$e.drawBullsEye(ce,k.truncDivision(J,2),5);else{$e.drawBullsEye(ce,k.truncDivision(J,2),7);for(let ae=0,Ge=0;ae<k.truncDivision(F,2)-1;ae+=15,Ge+=16)for(let ve=k.truncDivision(J,2)&1;ve<J;ve+=2)ce.set(k.truncDivision(J,2)-Ge,ve),ce.set(k.truncDivision(J,2)+Ge,ve),ce.set(ve,k.truncDivision(J,2)-Ge),ce.set(ve,k.truncDivision(J,2)+Ge)}let ue=new ja;return ue.setCompact(d),ue.setSize(J),ue.setLayers(g),ue.setCodeWords(O),ue.setMatrix(ce),ue}static drawBullsEye(e,t,n){for(let r=0;r<n;r+=2)for(let s=t-r;s<=t+r;s++)e.set(s,t-r),e.set(s,t+r),e.set(t-r,s),e.set(t+r,s);e.set(t-n,t-n),e.set(t-n+1,t-n),e.set(t-n,t-n+1),e.set(t+n,t-n),e.set(t+n,t-n+1),e.set(t+n,t+n-1)}static generateModeMessage(e,t,n){let r=new V;return e?(r.appendBits(t-1,2),r.appendBits(n-1,6),r=$e.generateCheckWords(r,28,4)):(r.appendBits(t-1,5),r.appendBits(n-1,11),r=$e.generateCheckWords(r,40,4)),r}static drawModeMessage(e,t,n,r){let s=k.truncDivision(n,2);if(t)for(let c=0;c<7;c++){let d=s-3+c;r.get(c)&&e.set(d,s-5),r.get(c+7)&&e.set(s+5,d),r.get(20-c)&&e.set(d,s+5),r.get(27-c)&&e.set(s-5,d)}else for(let c=0;c<10;c++){let d=s-5+c+k.truncDivision(c,5);r.get(c)&&e.set(d,s-7),r.get(c+10)&&e.set(s+7,d),r.get(29-c)&&e.set(d,s+7),r.get(39-c)&&e.set(s-7,d)}}static generateCheckWords(e,t,n){let r=e.getSize()/n,s=new vo($e.getGF(n)),c=k.truncDivision(t,n),d=$e.bitsToWords(e,n,c);s.encode(d,c-r);let g=t%n,x=new V;x.appendBits(0,g);for(const E of Array.from(d))x.appendBits(E,n);return x}static bitsToWords(e,t,n){let r=new Int32Array(n),s,c;for(s=0,c=e.getSize()/t;s<c;s++){let d=0;for(let g=0;g<t;g++)d|=e.get(s*t+g)?1<<t-g-1:0;r[s]=d}return r}static getGF(e){switch(e){case 4:return Ee.AZTEC_PARAM;case 6:return Ee.AZTEC_DATA_6;case 8:return Ee.AZTEC_DATA_8;case 10:return Ee.AZTEC_DATA_10;case 12:return Ee.AZTEC_DATA_12;default:throw new y("Unsupported word size "+e)}}static stuffBits(e,t){let n=new V,r=e.getSize(),s=(1<<t)-2;for(let c=0;c<r;c+=t){let d=0;for(let g=0;g<t;g++)(c+g>=r||e.get(c+g))&&(d|=1<<t-1-g);(d&s)===s?(n.appendBits(d&s,t),c--):d&s?n.appendBits(d,t):(n.appendBits(d|1,t),c--)}return n}static totalBitsInLayer(e,t){return((t?88:112)+16*e)*e}}$e.DEFAULT_EC_PERCENT=33,$e.DEFAULT_AZTEC_LAYERS=0,$e.MAX_NB_BITS=32,$e.MAX_NB_BITS_COMPACT=4,$e.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 Oi{encode(e,t,n,r){return this.encodeWithHints(e,t,n,r,null)}encodeWithHints(e,t,n,r,s){let c=Po.ISO_8859_1,d=$e.DEFAULT_EC_PERCENT,g=$e.DEFAULT_AZTEC_LAYERS;return s!=null&&(s.has(kt.CHARACTER_SET)&&(c=Xa.forName(s.get(kt.CHARACTER_SET).toString())),s.has(kt.ERROR_CORRECTION)&&(d=k.parseInt(s.get(kt.ERROR_CORRECTION).toString())),s.has(kt.AZTEC_LAYERS)&&(g=k.parseInt(s.get(kt.AZTEC_LAYERS).toString()))),Oi.encodeLayers(e,t,n,r,c,d,g)}static encodeLayers(e,t,n,r,s,c,d){if(t!==fe.AZTEC)throw new y("Can only encode AZTEC, but got "+t);let g=$e.encode(W.getBytes(e,s),c,d);return Oi.renderResult(g,n,r)}static renderResult(e,t,n){let r=e.getMatrix();if(r==null)throw new nt;let s=r.getWidth(),c=r.getHeight(),d=Math.max(t,s),g=Math.max(n,c),x=Math.min(d/s,g/c),E=(d-s*x)/2,A=(g-c*x)/2,I=new X(d,g);for(let O=0,L=A;O<c;O++,L+=x)for(let F=0,q=E;F<s;F++,q+=x)r.get(F,O)&&I.setRegion(q,L,x,x);return I}}i.AbstractExpandedDecoder=Ao,i.ArgumentException=C,i.ArithmeticException=qe,i.AztecCode=ja,i.AztecCodeReader=le,i.AztecCodeWriter=Oi,i.AztecDecoder=He,i.AztecDetector=be,i.AztecDetectorResult=Ei,i.AztecEncoder=$e,i.AztecHighLevelEncoder=Yr,i.AztecPoint=Ot,i.BarcodeFormat=fe,i.Binarizer=R,i.BinaryBitmap=N,i.BitArray=V,i.BitMatrix=X,i.BitSource=To,i.BrowserAztecCodeReader=Qe,i.BrowserBarcodeReader=ag,i.BrowserCodeReader=Ne,i.BrowserDatamatrixCodeReader=cg,i.BrowserMultiFormatReader=Cg,i.BrowserPDF417Reader=Eg,i.BrowserQRCodeReader=yg,i.BrowserQRCodeSvgWriter=ar,i.CharacterSetECI=z,i.ChecksumException=B,i.Code128Reader=de,i.Code39Reader=ft,i.DataMatrixDecodedBitStreamParser=Wn,i.DataMatrixReader=Xn,i.DecodeHintType=ne,i.DecoderResult=Oe,i.DefaultGridSampler=yi,i.DetectorResult=Cr,i.EAN13Reader=yt,i.EncodeHintType=kt,i.Exception=p,i.FormatException=U,i.GenericGF=Ee,i.GenericGFPoly=me,i.GlobalHistogramBinarizer=$,i.GridSampler=nr,i.GridSamplerInstance=dn,i.HTMLCanvasElementLuminanceSource=re,i.HybridBinarizer=H,i.ITFReader=Ye,i.IllegalArgumentException=y,i.IllegalStateException=nt,i.InvertedLuminanceSource=j,i.LuminanceSource=ee,i.MathUtils=ze,i.MultiFormatOneDReader=br,i.MultiFormatReader=Wa,i.MultiFormatWriter=Ag,i.NotFoundException=S,i.OneDReader=Ke,i.PDF417DecodedBitStreamParser=Q,i.PDF417DecoderErrorCorrection=Fa,i.PDF417Reader=Vt,i.PDF417ResultMetadata=Ua,i.PerspectiveTransform=Dt,i.PlanarYUVLuminanceSource=On,i.QRCodeByteMatrix=ki,i.QRCodeDataMask=hn,i.QRCodeDecodedBitStreamParser=wt,i.QRCodeDecoderErrorCorrectionLevel=ct,i.QRCodeDecoderFormatInformation=Gt,i.QRCodeEncoder=ht,i.QRCodeEncoderQRCode=sr,i.QRCodeMaskUtil=Et,i.QRCodeMatrixUtil=Te,i.QRCodeMode=Se,i.QRCodeReader=jn,i.QRCodeVersion=Ie,i.QRCodeWriter=Ir,i.RGBLuminanceSource=Do,i.RSS14Reader=Ct,i.RSSExpandedReader=se,i.ReaderException=Ti,i.ReedSolomonDecoder=jt,i.ReedSolomonEncoder=vo,i.ReedSolomonException=mt,i.Result=_e,i.ResultMetadataType=Xe,i.ResultPoint=ye,i.StringUtils=W,i.UnsupportedOperationException=oe,i.VideoInputDevice=ge,i.WhiteRectangleDetector=bn,i.WriterException=at,i.ZXingArrays=M,i.ZXingCharset=Xa,i.ZXingInteger=k,i.ZXingStandardCharsets=Po,i.ZXingStringBuilder=Z,i.ZXingStringEncoding=G,i.ZXingSystem=P,i.createAbstractExpandedDecoder=Pa,Object.defineProperty(i,"__esModule",{value:!0})})})(po,po.exports);var ut=po.exports;const zh=Ja({__proto__:null,default:Zs(ut)},[ut]);var ma=function(){function o(a,i,u){if(this.formatMap=new Map([[pe.QR_CODE,ut.BarcodeFormat.QR_CODE],[pe.AZTEC,ut.BarcodeFormat.AZTEC],[pe.CODABAR,ut.BarcodeFormat.CODABAR],[pe.CODE_39,ut.BarcodeFormat.CODE_39],[pe.CODE_93,ut.BarcodeFormat.CODE_93],[pe.CODE_128,ut.BarcodeFormat.CODE_128],[pe.DATA_MATRIX,ut.BarcodeFormat.DATA_MATRIX],[pe.MAXICODE,ut.BarcodeFormat.MAXICODE],[pe.ITF,ut.BarcodeFormat.ITF],[pe.EAN_13,ut.BarcodeFormat.EAN_13],[pe.EAN_8,ut.BarcodeFormat.EAN_8],[pe.PDF_417,ut.BarcodeFormat.PDF_417],[pe.RSS_14,ut.BarcodeFormat.RSS_14],[pe.RSS_EXPANDED,ut.BarcodeFormat.RSS_EXPANDED],[pe.UPC_A,ut.BarcodeFormat.UPC_A],[pe.UPC_E,ut.BarcodeFormat.UPC_E],[pe.UPC_EAN_EXTENSION,ut.BarcodeFormat.UPC_EAN_EXTENSION]]),this.reverseFormatMap=this.createReverseFormatMap(),!zh)throw"Use html5qrcode.min.js without edit, ZXing not found.";this.verbose=i,this.logger=u;var f=this.createZXingFormats(a),h=new Map;h.set(ut.DecodeHintType.POSSIBLE_FORMATS,f),h.set(ut.DecodeHintType.TRY_HARDER,!1),this.hints=h}return o.prototype.decodeAsync=function(a){var i=this;return new Promise(function(u,f){try{u(i.decode(a))}catch(h){f(h)}})},o.prototype.decode=function(a){var i=new ut.MultiFormatReader(this.verbose,this.hints),u=new ut.HTMLCanvasElementLuminanceSource(a),f=new ut.BinaryBitmap(new ut.HybridBinarizer(u)),h=i.decode(f);return{text:h.text,format:fa.create(this.toHtml5QrcodeSupportedFormats(h.format)),debugData:this.createDebugData()}},o.prototype.createReverseFormatMap=function(){var a=new Map;return this.formatMap.forEach(function(i,u,f){a.set(i,u)}),a},o.prototype.toHtml5QrcodeSupportedFormats=function(a){if(!this.reverseFormatMap.has(a))throw"reverseFormatMap doesn't have ".concat(a);return this.reverseFormatMap.get(a)},o.prototype.createZXingFormats=function(a){for(var i=[],u=0,f=a;u<f.length;u++){var h=f[u];this.formatMap.has(h)?i.push(this.formatMap.get(h)):this.logger.logError("".concat(h," is not supported by")+"ZXingHtml5QrcodeShim")}return i},o.prototype.createDebugData=function(){return{decoderName:"zxing-js"}},o}(),Gh=function(o,a,i,u){function f(h){return h instanceof i?h:new i(function(m){m(h)})}return new(i||(i=Promise))(function(h,m){function w(C){try{p(u.next(C))}catch(y){m(y)}}function _(C){try{p(u.throw(C))}catch(y){m(y)}}function p(C){C.done?h(C.value):f(C.value).then(w,_)}p((u=u.apply(o,a||[])).next())})},Wh=function(o,a){var i={label:0,sent:function(){if(h[0]&1)throw h[1];return h[1]},trys:[],ops:[]},u,f,h,m;return m={next:w(0),throw:w(1),return:w(2)},typeof Symbol=="function"&&(m[Symbol.iterator]=function(){return this}),m;function w(p){return function(C){return _([p,C])}}function _(p){if(u)throw new TypeError("Generator is already executing.");for(;m&&(m=0,p[0]&&(i=0)),i;)try{if(u=1,f&&(h=p[0]&2?f.return:p[0]?f.throw||((h=f.return)&&h.call(f),0):f.next)&&!(h=h.call(f,p[1])).done)return h;switch(f=0,h&&(p=[p[0]&2,h.value]),p[0]){case 0:case 1:h=p;break;case 4:return i.label++,{value:p[1],done:!1};case 5:i.label++,f=p[1],p=[0];continue;case 7:p=i.ops.pop(),i.trys.pop();continue;default:if(h=i.trys,!(h=h.length>0&&h[h.length-1])&&(p[0]===6||p[0]===2)){i=0;continue}if(p[0]===3&&(!h||p[1]>h[0]&&p[1]<h[3])){i.label=p[1];break}if(p[0]===6&&i.label<h[1]){i.label=h[1],h=p;break}if(h&&i.label<h[2]){i.label=h[2],i.ops.push(p);break}h[2]&&i.ops.pop(),i.trys.pop();continue}p=a.call(o,i)}catch(C){p=[6,C],f=0}finally{u=h=0}if(p[0]&5)throw p[1];return{value:p[0]?p[1]:void 0,done:!0}}},pa=function(){function o(a,i,u){if(this.formatMap=new Map([[pe.QR_CODE,"qr_code"],[pe.AZTEC,"aztec"],[pe.CODABAR,"codabar"],[pe.CODE_39,"code_39"],[pe.CODE_93,"code_93"],[pe.CODE_128,"code_128"],[pe.DATA_MATRIX,"data_matrix"],[pe.ITF,"itf"],[pe.EAN_13,"ean_13"],[pe.EAN_8,"ean_8"],[pe.PDF_417,"pdf417"],[pe.UPC_A,"upc_a"],[pe.UPC_E,"upc_e"]]),this.reverseFormatMap=this.createReverseFormatMap(),!o.isSupported())throw"Use html5qrcode.min.js without edit, Use BarcodeDetectorDelegate only if it isSupported();";this.verbose=i,this.logger=u;var f=this.createBarcodeDetectorFormats(a);if(this.detector=new BarcodeDetector(f),!this.detector)throw"BarcodeDetector detector not supported"}return o.isSupported=function(){if(!("BarcodeDetector"in window))return!1;var a=new BarcodeDetector({formats:["qr_code"]});return typeof a<"u"},o.prototype.decodeAsync=function(a){return Gh(this,void 0,void 0,function(){var i,u;return Wh(this,function(f){switch(f.label){case 0:return[4,this.detector.detect(a)];case 1:if(i=f.sent(),!i||i.length===0)throw"No barcode or QR code detected.";return u=this.selectLargestBarcode(i),[2,{text:u.rawValue,format:fa.create(this.toHtml5QrcodeSupportedFormats(u.format)),debugData:this.createDebugData()}]}})})},o.prototype.selectLargestBarcode=function(a){for(var i=null,u=0,f=0,h=a;f<h.length;f++){var m=h[f],w=m.boundingBox.width*m.boundingBox.height;w>u&&(u=w,i=m)}if(!i)throw"No largest barcode found";return i},o.prototype.createBarcodeDetectorFormats=function(a){for(var i=[],u=0,f=a;u<f.length;u++){var h=f[u];this.formatMap.has(h)?i.push(this.formatMap.get(h)):this.logger.warn("".concat(h," is not supported by")+"BarcodeDetectorDelegate")}return{formats:i}},o.prototype.toHtml5QrcodeSupportedFormats=function(a){if(!this.reverseFormatMap.has(a))throw"reverseFormatMap doesn't have ".concat(a);return this.reverseFormatMap.get(a)},o.prototype.createReverseFormatMap=function(){var a=new Map;return this.formatMap.forEach(function(i,u,f){a.set(i,u)}),a},o.prototype.createDebugData=function(){return{decoderName:"BarcodeDetector"}},o}(),xa=function(o,a,i,u){function f(h){return h instanceof i?h:new i(function(m){m(h)})}return new(i||(i=Promise))(function(h,m){function w(C){try{p(u.next(C))}catch(y){m(y)}}function _(C){try{p(u.throw(C))}catch(y){m(y)}}function p(C){C.done?h(C.value):f(C.value).then(w,_)}p((u=u.apply(o,a||[])).next())})},wa=function(o,a){var i={label:0,sent:function(){if(h[0]&1)throw h[1];return h[1]},trys:[],ops:[]},u,f,h,m;return m={next:w(0),throw:w(1),return:w(2)},typeof Symbol=="function"&&(m[Symbol.iterator]=function(){return this}),m;function w(p){return function(C){return _([p,C])}}function _(p){if(u)throw new TypeError("Generator is already executing.");for(;m&&(m=0,p[0]&&(i=0)),i;)try{if(u=1,f&&(h=p[0]&2?f.return:p[0]?f.throw||((h=f.return)&&h.call(f),0):f.next)&&!(h=h.call(f,p[1])).done)return h;switch(f=0,h&&(p=[p[0]&2,h.value]),p[0]){case 0:case 1:h=p;break;case 4:return i.label++,{value:p[1],done:!1};case 5:i.label++,f=p[1],p=[0];continue;case 7:p=i.ops.pop(),i.trys.pop();continue;default:if(h=i.trys,!(h=h.length>0&&h[h.length-1])&&(p[0]===6||p[0]===2)){i=0;continue}if(p[0]===3&&(!h||p[1]>h[0]&&p[1]<h[3])){i.label=p[1];break}if(p[0]===6&&i.label<h[1]){i.label=h[1],h=p;break}if(h&&i.label<h[2]){i.label=h[2],i.ops.push(p);break}h[2]&&i.ops.pop(),i.trys.pop();continue}p=a.call(o,i)}catch(C){p=[6,C],f=0}finally{u=h=0}if(p[0]&5)throw p[1];return{value:p[0]?p[1]:void 0,done:!0}}},Xh=function(){function o(a,i,u,f){this.EXECUTIONS_TO_REPORT_PERFORMANCE=100,this.executions=0,this.executionResults=[],this.wasPrimaryDecoderUsedInLastDecode=!1,this.verbose=u,i&&pa.isSupported()?(this.primaryDecoder=new pa(a,u,f),this.secondaryDecoder=new ma(a,u,f)):this.primaryDecoder=new ma(a,u,f)}return o.prototype.decodeAsync=function(a){return xa(this,void 0,void 0,function(){var i;return wa(this,function(u){switch(u.label){case 0:i=performance.now(),u.label=1;case 1:return u.trys.push([1,,3,4]),[4,this.getDecoder().decodeAsync(a)];case 2:return[2,u.sent()];case 3:return this.possiblyLogPerformance(i),[7];case 4:return[2]}})})},o.prototype.decodeRobustlyAsync=function(a){return xa(this,void 0,void 0,function(){var i,u;return wa(this,function(f){switch(f.label){case 0:i=performance.now(),f.label=1;case 1:return f.trys.push([1,3,4,5]),[4,this.primaryDecoder.decodeAsync(a)];case 2:return[2,f.sent()];case 3:if(u=f.sent(),this.secondaryDecoder)return[2,this.secondaryDecoder.decodeAsync(a)];throw u;case 4:return this.possiblyLogPerformance(i),[7];case 5:return[2]}})})},o.prototype.getDecoder=function(){return this.secondaryDecoder?this.wasPrimaryDecoderUsedInLastDecode===!1?(this.wasPrimaryDecoderUsedInLastDecode=!0,this.primaryDecoder):(this.wasPrimaryDecoderUsedInLastDecode=!1,this.secondaryDecoder):this.primaryDecoder},o.prototype.possiblyLogPerformance=function(a){if(this.verbose){var i=performance.now()-a;this.executionResults.push(i),this.executions++,this.possiblyFlushPerformanceReport()}},o.prototype.possiblyFlushPerformanceReport=function(){if(!(this.executions<this.EXECUTIONS_TO_REPORT_PERFORMANCE)){for(var a=0,i=0,u=this.executionResults;i<u.length;i++){var f=u[i];a+=f}var h=a/this.executionResults.length;console.log("".concat(h," ms for ").concat(this.executionResults.length," last runs.")),this.executions=0,this.executionResults=[]}},o}(),xo=function(){var o=function(a,i){return o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,f){u.__proto__=f}||function(u,f){for(var h in f)Object.prototype.hasOwnProperty.call(f,h)&&(u[h]=f[h])},o(a,i)};return function(a,i){if(typeof i!="function"&&i!==null)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");o(a,i);function u(){this.constructor=a}a.prototype=i===null?Object.create(i):(u.prototype=i.prototype,new u)}}(),pi=function(o,a,i,u){function f(h){return h instanceof i?h:new i(function(m){m(h)})}return new(i||(i=Promise))(function(h,m){function w(C){try{p(u.next(C))}catch(y){m(y)}}function _(C){try{p(u.throw(C))}catch(y){m(y)}}function p(C){C.done?h(C.value):f(C.value).then(w,_)}p((u=u.apply(o,a||[])).next())})},xi=function(o,a){var i={label:0,sent:function(){if(h[0]&1)throw h[1];return h[1]},trys:[],ops:[]},u,f,h,m;return m={next:w(0),throw:w(1),return:w(2)},typeof Symbol=="function"&&(m[Symbol.iterator]=function(){return this}),m;function w(p){return function(C){return _([p,C])}}function _(p){if(u)throw new TypeError("Generator is already executing.");for(;m&&(m=0,p[0]&&(i=0)),i;)try{if(u=1,f&&(h=p[0]&2?f.return:p[0]?f.throw||((h=f.return)&&h.call(f),0):f.next)&&!(h=h.call(f,p[1])).done)return h;switch(f=0,h&&(p=[p[0]&2,h.value]),p[0]){case 0:case 1:h=p;break;case 4:return i.label++,{value:p[1],done:!1};case 5:i.label++,f=p[1],p=[0];continue;case 7:p=i.ops.pop(),i.trys.pop();continue;default:if(h=i.trys,!(h=h.length>0&&h[h.length-1])&&(p[0]===6||p[0]===2)){i=0;continue}if(p[0]===3&&(!h||p[1]>h[0]&&p[1]<h[3])){i.label=p[1];break}if(p[0]===6&&i.label<h[1]){i.label=h[1],h=p;break}if(h&&i.label<h[2]){i.label=h[2],i.ops.push(p);break}h[2]&&i.ops.pop(),i.trys.pop();continue}p=a.call(o,i)}catch(C){p=[6,C],f=0}finally{u=h=0}if(p[0]&5)throw p[1];return{value:p[0]?p[1]:void 0,done:!0}}},_a=function(){function o(a,i){this.name=a,this.track=i}return o.prototype.isSupported=function(){return this.track.getCapabilities?this.name in this.track.getCapabilities():!1},o.prototype.apply=function(a){var i={};i[this.name]=a;var u={advanced:[i]};return this.track.applyConstraints(u)},o.prototype.value=function(){var a=this.track.getSettings();if(this.name in a){var i=a[this.name];return i}return null},o}(),jh=function(o){xo(a,o);function a(i,u){return o.call(this,i,u)||this}return a.prototype.min=function(){return this.getCapabilities().min},a.prototype.max=function(){return this.getCapabilities().max},a.prototype.step=function(){return this.getCapabilities().step},a.prototype.apply=function(i){var u={};u[this.name]=i;var f={advanced:[u]};return this.track.applyConstraints(f)},a.prototype.getCapabilities=function(){this.failIfNotSupported();var i=this.track.getCapabilities(),u=i[this.name];return{min:u.min,max:u.max,step:u.step}},a.prototype.failIfNotSupported=function(){if(!this.isSupported())throw new Error("".concat(this.name," capability not supported"))},a}(_a),Zh=function(o){xo(a,o);function a(i){return o.call(this,"zoom",i)||this}return a}(jh),qh=function(o){xo(a,o);function a(i){return o.call(this,"torch",i)||this}return a}(_a),Yh=function(){function o(a){this.track=a}return o.prototype.zoomFeature=function(){return new Zh(this.track)},o.prototype.torchFeature=function(){return new qh(this.track)},o}(),$h=function(){function o(a,i,u){this.isClosed=!1,this.parentElement=a,this.mediaStream=i,this.callbacks=u,this.surface=this.createVideoElement(this.parentElement.clientWidth),a.append(this.surface)}return o.prototype.createVideoElement=function(a){var i=document.createElement("video");return i.style.width="".concat(a,"px"),i.style.display="block",i.muted=!0,i.setAttribute("muted","true"),i.playsInline=!0,i},o.prototype.setupSurface=function(){var a=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 u=a.surface.clientWidth,f=a.surface.clientHeight;a.callbacks.onRenderSurfaceReady(u,f),a.surface.removeEventListener("playing",i)};this.surface.addEventListener("playing",i),this.surface.srcObject=this.mediaStream,this.surface.play()},o.create=function(a,i,u,f){return pi(this,void 0,void 0,function(){var h,m;return xi(this,function(w){switch(w.label){case 0:return h=new o(a,i,f),u.aspectRatio?(m={aspectRatio:u.aspectRatio},[4,h.getFirstTrackOrFail().applyConstraints(m)]):[3,2];case 1:w.sent(),w.label=2;case 2:return h.setupSurface(),[2,h]}})})},o.prototype.failIfClosed=function(){if(this.isClosed)throw"The RenderedCamera has already been closed."},o.prototype.getFirstTrackOrFail=function(){if(this.failIfClosed(),this.mediaStream.getVideoTracks().length===0)throw"No video tracks found";return this.mediaStream.getVideoTracks()[0]},o.prototype.pause=function(){this.failIfClosed(),this.surface.pause()},o.prototype.resume=function(a){this.failIfClosed();var i=this,u=function(){setTimeout(a,200),i.surface.removeEventListener("playing",u)};this.surface.addEventListener("playing",u),this.surface.play()},o.prototype.isPaused=function(){return this.failIfClosed(),this.surface.paused},o.prototype.getSurface=function(){return this.failIfClosed(),this.surface},o.prototype.getRunningTrackCapabilities=function(){return this.getFirstTrackOrFail().getCapabilities()},o.prototype.getRunningTrackSettings=function(){return this.getFirstTrackOrFail().getSettings()},o.prototype.applyVideoConstraints=function(a){return pi(this,void 0,void 0,function(){return xi(this,function(i){if("aspectRatio"in a)throw"Changing 'aspectRatio' in run-time is not yet supported.";return[2,this.getFirstTrackOrFail().applyConstraints(a)]})})},o.prototype.close=function(){if(this.isClosed)return Promise.resolve();var a=this;return new Promise(function(i,u){var f=a.mediaStream.getVideoTracks(),h=f.length,m=0;a.mediaStream.getVideoTracks().forEach(function(w){a.mediaStream.removeTrack(w),w.stop(),++m,m>=h&&(a.isClosed=!0,a.parentElement.removeChild(a.surface),i())})})},o.prototype.getCapabilities=function(){return new Yh(this.getFirstTrackOrFail())},o}(),Kh=function(){function o(a){this.mediaStream=a}return o.prototype.render=function(a,i,u){return pi(this,void 0,void 0,function(){return xi(this,function(f){return[2,$h.create(a,this.mediaStream,i,u)]})})},o.create=function(a){return pi(this,void 0,void 0,function(){var i,u;return xi(this,function(f){switch(f.label){case 0:if(!navigator.mediaDevices)throw"navigator.mediaDevices not supported";return i={audio:!1,video:a},[4,navigator.mediaDevices.getUserMedia(i)];case 1:return u=f.sent(),[2,new o(u)]}})})},o}(),Ca=function(o,a,i,u){function f(h){return h instanceof i?h:new i(function(m){m(h)})}return new(i||(i=Promise))(function(h,m){function w(C){try{p(u.next(C))}catch(y){m(y)}}function _(C){try{p(u.throw(C))}catch(y){m(y)}}function p(C){C.done?h(C.value):f(C.value).then(w,_)}p((u=u.apply(o,a||[])).next())})},Ea=function(o,a){var i={label:0,sent:function(){if(h[0]&1)throw h[1];return h[1]},trys:[],ops:[]},u,f,h,m;return m={next:w(0),throw:w(1),return:w(2)},typeof Symbol=="function"&&(m[Symbol.iterator]=function(){return this}),m;function w(p){return function(C){return _([p,C])}}function _(p){if(u)throw new TypeError("Generator is already executing.");for(;m&&(m=0,p[0]&&(i=0)),i;)try{if(u=1,f&&(h=p[0]&2?f.return:p[0]?f.throw||((h=f.return)&&h.call(f),0):f.next)&&!(h=h.call(f,p[1])).done)return h;switch(f=0,h&&(p=[p[0]&2,h.value]),p[0]){case 0:case 1:h=p;break;case 4:return i.label++,{value:p[1],done:!1};case 5:i.label++,f=p[1],p=[0];continue;case 7:p=i.ops.pop(),i.trys.pop();continue;default:if(h=i.trys,!(h=h.length>0&&h[h.length-1])&&(p[0]===6||p[0]===2)){i=0;continue}if(p[0]===3&&(!h||p[1]>h[0]&&p[1]<h[3])){i.label=p[1];break}if(p[0]===6&&i.label<h[1]){i.label=h[1],h=p;break}if(h&&i.label<h[2]){i.label=h[2],i.ops.push(p);break}h[2]&&i.ops.pop(),i.trys.pop();continue}p=a.call(o,i)}catch(C){p=[6,C],f=0}finally{u=h=0}if(p[0]&5)throw p[1];return{value:p[0]?p[1]:void 0,done:!0}}},Qh=function(){function o(){}return o.failIfNotSupported=function(){return Ca(this,void 0,void 0,function(){return Ea(this,function(a){if(!navigator.mediaDevices)throw"navigator.mediaDevices not supported";return[2,new o]})})},o.prototype.create=function(a){return Ca(this,void 0,void 0,function(){return Ea(this,function(i){return[2,Kh.create(a)]})})},o}(),Jh=function(o,a,i,u){function f(h){return h instanceof i?h:new i(function(m){m(h)})}return new(i||(i=Promise))(function(h,m){function w(C){try{p(u.next(C))}catch(y){m(y)}}function _(C){try{p(u.throw(C))}catch(y){m(y)}}function p(C){C.done?h(C.value):f(C.value).then(w,_)}p((u=u.apply(o,a||[])).next())})},e2=function(o,a){var i={label:0,sent:function(){if(h[0]&1)throw h[1];return h[1]},trys:[],ops:[]},u,f,h,m;return m={next:w(0),throw:w(1),return:w(2)},typeof Symbol=="function"&&(m[Symbol.iterator]=function(){return this}),m;function w(p){return function(C){return _([p,C])}}function _(p){if(u)throw new TypeError("Generator is already executing.");for(;m&&(m=0,p[0]&&(i=0)),i;)try{if(u=1,f&&(h=p[0]&2?f.return:p[0]?f.throw||((h=f.return)&&h.call(f),0):f.next)&&!(h=h.call(f,p[1])).done)return h;switch(f=0,h&&(p=[p[0]&2,h.value]),p[0]){case 0:case 1:h=p;break;case 4:return i.label++,{value:p[1],done:!1};case 5:i.label++,f=p[1],p=[0];continue;case 7:p=i.ops.pop(),i.trys.pop();continue;default:if(h=i.trys,!(h=h.length>0&&h[h.length-1])&&(p[0]===6||p[0]===2)){i=0;continue}if(p[0]===3&&(!h||p[1]>h[0]&&p[1]<h[3])){i.label=p[1];break}if(p[0]===6&&i.label<h[1]){i.label=h[1],h=p;break}if(h&&i.label<h[2]){i.label=h[2],i.ops.push(p);break}h[2]&&i.ops.pop(),i.trys.pop();continue}p=a.call(o,i)}catch(C){p=[6,C],f=0}finally{u=h=0}if(p[0]&5)throw p[1];return{value:p[0]?p[1]:void 0,done:!0}}},t2=function(){function o(){}return o.retrieve=function(){if(navigator.mediaDevices)return o.getCamerasFromMediaDevices();var a=MediaStreamTrack;return MediaStreamTrack&&a.getSources?o.getCamerasFromMediaStreamTrack():o.rejectWithError()},o.rejectWithError=function(){var a=xr.unableToQuerySupportedDevices();return o.isHttpsOrLocalhost()||(a=xr.insecureContextCameraQueryError()),Promise.reject(a)},o.isHttpsOrLocalhost=function(){if(location.protocol==="https:")return!0;var a=location.host.split(":")[0];return a==="127.0.0.1"||a==="localhost"},o.getCamerasFromMediaDevices=function(){return Jh(this,void 0,void 0,function(){var a,i,u,f,h,m,w;return e2(this,function(_){switch(_.label){case 0:return a=function(p){for(var C=p.getVideoTracks(),y=0,N=C;y<N.length;y++){var B=N[y];B.enabled=!1,B.stop(),p.removeTrack(B)}},[4,navigator.mediaDevices.getUserMedia({audio:!1,video:!0})];case 1:return i=_.sent(),[4,navigator.mediaDevices.enumerateDevices()];case 2:for(u=_.sent(),f=[],h=0,m=u;h<m.length;h++)w=m[h],w.kind==="videoinput"&&f.push({id:w.deviceId,label:w.label});return a(i),[2,f]}})})},o.getCamerasFromMediaStreamTrack=function(){return new Promise(function(a,i){var u=function(h){for(var m=[],w=0,_=h;w<_.length;w++){var p=_[w];p.kind==="video"&&m.push({id:p.id,label:p.label})}a(m)},f=MediaStreamTrack;f.getSources(u)})},o}(),_t;(function(o){o[o.UNKNOWN=0]="UNKNOWN",o[o.NOT_STARTED=1]="NOT_STARTED",o[o.SCANNING=2]="SCANNING",o[o.PAUSED=3]="PAUSED"})(_t||(_t={}));var n2=function(){function o(){this.state=_t.NOT_STARTED,this.onGoingTransactionNewState=_t.UNKNOWN}return o.prototype.directTransition=function(a){this.failIfTransitionOngoing(),this.validateTransition(a),this.state=a},o.prototype.startTransition=function(a){return this.failIfTransitionOngoing(),this.validateTransition(a),this.onGoingTransactionNewState=a,this},o.prototype.execute=function(){if(this.onGoingTransactionNewState===_t.UNKNOWN)throw"Transaction is already cancelled, cannot execute().";var a=this.onGoingTransactionNewState;this.onGoingTransactionNewState=_t.UNKNOWN,this.directTransition(a)},o.prototype.cancel=function(){if(this.onGoingTransactionNewState===_t.UNKNOWN)throw"Transaction is already cancelled, cannot cancel().";this.onGoingTransactionNewState=_t.UNKNOWN},o.prototype.getState=function(){return this.state},o.prototype.failIfTransitionOngoing=function(){if(this.onGoingTransactionNewState!==_t.UNKNOWN)throw"Cannot transition to a new state, already under transition"},o.prototype.validateTransition=function(a){switch(this.state){case _t.UNKNOWN:throw"Transition from unknown is not allowed";case _t.NOT_STARTED:this.failIfNewStateIs(a,[_t.PAUSED]);break;case _t.SCANNING:break;case _t.PAUSED:break}},o.prototype.failIfNewStateIs=function(a,i){for(var u=0,f=i;u<f.length;u++){var h=f[u];if(a===h)throw"Cannot transition from ".concat(this.state," to ").concat(a)}},o}(),r2=function(){function o(a){this.stateManager=a}return o.prototype.startTransition=function(a){return this.stateManager.startTransition(a)},o.prototype.directTransition=function(a){this.stateManager.directTransition(a)},o.prototype.getState=function(){return this.stateManager.getState()},o.prototype.canScanFile=function(){return this.stateManager.getState()===_t.NOT_STARTED},o.prototype.isScanning=function(){return this.stateManager.getState()!==_t.NOT_STARTED},o.prototype.isStrictlyScanning=function(){return this.stateManager.getState()===_t.SCANNING},o.prototype.isPaused=function(){return this.stateManager.getState()===_t.PAUSED},o}(),i2=function(){function o(){}return o.create=function(){return new r2(new n2)},o}(),o2=function(){var o=function(a,i){return o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,f){u.__proto__=f}||function(u,f){for(var h in f)Object.prototype.hasOwnProperty.call(f,h)&&(u[h]=f[h])},o(a,i)};return function(a,i){if(typeof i!="function"&&i!==null)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");o(a,i);function u(){this.constructor=a}a.prototype=i===null?Object.create(i):(u.prototype=i.prototype,new u)}}(),an=function(o){o2(a,o);function a(){return o!==null&&o.apply(this,arguments)||this}return a.DEFAULT_WIDTH=300,a.DEFAULT_WIDTH_OFFSET=2,a.FILE_SCAN_MIN_HEIGHT=300,a.FILE_SCAN_HIDDEN_CANVAS_PADDING=100,a.MIN_QR_BOX_SIZE=50,a.SHADED_LEFT=1,a.SHADED_RIGHT=2,a.SHADED_TOP=3,a.SHADED_BOTTOM=4,a.SHADED_REGION_ELEMENT_ID="qr-shaded-region",a.VERBOSE=!1,a.BORDER_SHADER_DEFAULT_COLOR="#ffffff",a.BORDER_SHADER_MATCH_COLOR="rgb(90, 193, 56)",a}(Vh),s2=function(){function o(a,i){this.logger=i,this.fps=an.SCAN_DEFAULT_FPS,a?(a.fps&&(this.fps=a.fps),this.disableFlip=a.disableFlip===!0,this.qrbox=a.qrbox,this.aspectRatio=a.aspectRatio,this.videoConstraints=a.videoConstraints):this.disableFlip=an.DEFAULT_DISABLE_FLIP}return o.prototype.isMediaStreamConstraintsValid=function(){return this.videoConstraints?ga.isMediaStreamConstraintsValid(this.videoConstraints,this.logger):(this.logger.logError("Empty videoConstraints",!0),!1)},o.prototype.isShadedBoxEnabled=function(){return!Fn(this.qrbox)},o.create=function(a,i){return new o(a,i)},o}(),ya=function(){function o(a,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(a))throw"HTML Element with id=".concat(a," not found");this.elementId=a,this.verbose=!1;var u;typeof i=="boolean"?this.verbose=i===!0:i&&(u=i,this.verbose=u.verbose===!0,u.experimentalFeatures),this.logger=new Hh(this.verbose),this.qrcode=new Xh(this.getSupportedFormats(i),this.getUseBarCodeDetectorIfSupported(u),this.verbose,this.logger),this.foreverScanTimeout,this.shouldScan=!0,this.stateManagerProxy=i2.create()}return o.prototype.start=function(a,i,u,f){var h=this;if(!a)throw"cameraIdOrConfig is required";if(!u||typeof u!="function")throw"qrCodeSuccessCallback is required and should be a function.";var m;f?m=f:m=this.verbose?this.logger.log:function(){};var w=s2.create(i,this.logger);this.clearElement();var _=!1;w.videoConstraints&&(w.isMediaStreamConstraintsValid()?_=!0:this.logger.logError("'videoConstraints' is not valid 'MediaStreamConstraints, it will be ignored.'",!0));var p=_,C=document.getElementById(this.elementId);C.clientWidth?C.clientWidth:an.DEFAULT_WIDTH,C.style.position="relative",this.shouldScan=!0,this.element=C;var y=this,N=this.stateManagerProxy.startTransition(_t.SCANNING);return new Promise(function(B,R){var P=p?w.videoConstraints:y.createVideoConstraints(a);if(!P){N.cancel(),R("videoConstraints should be defined");return}var D={};(!p||w.aspectRatio)&&(D.aspectRatio=w.aspectRatio);var v={onRenderSurfaceReady:function(M,k){y.setupUi(M,k,w),y.isScanning=!0,y.foreverScan(w,u,m)}};Qh.failIfNotSupported().then(function(M){M.create(P).then(function(k){return k.render(h.element,D,v).then(function(V){y.renderedCamera=V,N.execute(),B(null)}).catch(function(V){N.cancel(),R(V)})}).catch(function(k){N.cancel(),R(xr.errorGettingUserMedia(k))})}).catch(function(M){N.cancel(),R(xr.cameraStreamingNotSupported())})})},o.prototype.pause=function(a){if(!this.stateManagerProxy.isStrictlyScanning())throw"Cannot pause, scanner is not scanning.";this.stateManagerProxy.directTransition(_t.PAUSED),this.showPausedState(),(Fn(a)||a!==!0)&&(a=!1),a&&this.renderedCamera&&this.renderedCamera.pause()},o.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 a=this,i=function(){a.stateManagerProxy.directTransition(_t.SCANNING),a.hidePausedState()};if(!this.renderedCamera.isPaused()){i();return}this.renderedCamera.resume(function(){i()})},o.prototype.getState=function(){return this.stateManagerProxy.getState()},o.prototype.stop=function(){var a=this;if(!this.stateManagerProxy.isScanning())throw"Cannot stop, scanner is not running or paused.";var i=this.stateManagerProxy.startTransition(_t.NOT_STARTED);this.shouldScan=!1,this.foreverScanTimeout&&clearTimeout(this.foreverScanTimeout);var u=function(){if(a.element){var h=document.getElementById(an.SHADED_REGION_ELEMENT_ID);h&&a.element.removeChild(h)}},f=this;return this.renderedCamera.close().then(function(){return f.renderedCamera=null,f.element&&(f.element.removeChild(f.canvasElement),f.canvasElement=null),u(),f.qrRegion&&(f.qrRegion=null),f.context&&(f.context=null),i.execute(),f.hidePausedState(),f.isScanning=!1,Promise.resolve()})},o.prototype.scanFile=function(a,i){return this.scanFileV2(a,i).then(function(u){return u.decodedText})},o.prototype.scanFileV2=function(a,i){var u=this;if(!a||!(a instanceof File))throw"imageFile argument is mandatory and should be instance of File. Use 'event.target.files[0]'.";if(Fn(i)&&(i=!0),!this.stateManagerProxy.canScanFile())throw"Cannot start file scan - ongoing camera scan";return new Promise(function(f,h){u.possiblyCloseLastScanImageFile(),u.clearElement(),u.lastScanImageFile=URL.createObjectURL(a);var m=new Image;m.onload=function(){var w=m.width,_=m.height,p=document.getElementById(u.elementId),C=p.clientWidth?p.clientWidth:an.DEFAULT_WIDTH,y=Math.max(p.clientHeight?p.clientHeight:_,an.FILE_SCAN_MIN_HEIGHT),N=u.computeCanvasDrawConfig(w,_,C,y);if(i){var B=u.createCanvasElement(C,y,"qr-canvas-visible");B.style.display="inline-block",p.appendChild(B);var R=B.getContext("2d");if(!R)throw"Unable to get 2d context from canvas";R.canvas.width=C,R.canvas.height=y,R.drawImage(m,0,0,w,_,N.x,N.y,N.width,N.height)}var P=an.FILE_SCAN_HIDDEN_CANVAS_PADDING,D=Math.max(m.width,N.width),v=Math.max(m.height,N.height),M=D+2*P,k=v+2*P,V=u.createCanvasElement(M,k);p.appendChild(V);var te=V.getContext("2d");if(!te)throw"Unable to get 2d context from canvas";te.canvas.width=M,te.canvas.height=k,te.drawImage(m,0,0,w,_,P,P,D,v);try{u.qrcode.decodeRobustlyAsync(V).then(function(ne){f(ha.createFromQrcodeResult(ne))}).catch(h)}catch(ne){h("QR code parse error, error = ".concat(ne))}},m.onerror=h,m.onabort=h,m.onstalled=h,m.onsuspend=h,m.src=URL.createObjectURL(a)})},o.prototype.clear=function(){this.clearElement()},o.getCameras=function(){return t2.retrieve()},o.prototype.getRunningTrackCapabilities=function(){return this.getRenderedCameraOrFail().getRunningTrackCapabilities()},o.prototype.getRunningTrackSettings=function(){return this.getRenderedCameraOrFail().getRunningTrackSettings()},o.prototype.getRunningTrackCameraCapabilities=function(){return this.getRenderedCameraOrFail().getCapabilities()},o.prototype.applyVideoConstraints=function(a){if(a){if(!ga.isMediaStreamConstraintsValid(a,this.logger))throw"invalid videoConstaints passed, check logs for more details"}else throw"videoConstaints is required argument.";return this.getRenderedCameraOrFail().applyVideoConstraints(a)},o.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},o.prototype.getSupportedFormats=function(a){var i=[pe.QR_CODE,pe.AZTEC,pe.CODABAR,pe.CODE_39,pe.CODE_93,pe.CODE_128,pe.DATA_MATRIX,pe.MAXICODE,pe.ITF,pe.EAN_13,pe.EAN_8,pe.PDF_417,pe.RSS_14,pe.RSS_EXPANDED,pe.UPC_A,pe.UPC_E,pe.UPC_EAN_EXTENSION];if(!a||typeof a=="boolean"||!a.formatsToSupport)return i;if(!Array.isArray(a.formatsToSupport))throw"configOrVerbosityFlag.formatsToSupport should be undefined or an array.";if(a.formatsToSupport.length===0)throw"Atleast 1 formatsToSupport is needed.";for(var u=[],f=0,h=a.formatsToSupport;f<h.length;f++){var m=h[f];Fh(m)?u.push(m):this.logger.warn("Invalid format: ".concat(m," passed in config, ignoring."))}if(u.length===0)throw"None of formatsToSupport match supported values.";return u},o.prototype.getUseBarCodeDetectorIfSupported=function(a){if(Fn(a))return!0;if(!Fn(a.useBarCodeDetectorIfSupported))return a.useBarCodeDetectorIfSupported!==!1;if(Fn(a.experimentalFeatures))return!0;var i=a.experimentalFeatures;return Fn(i.useBarCodeDetectorIfSupported)?!0:i.useBarCodeDetectorIfSupported!==!1},o.prototype.validateQrboxSize=function(a,i,u){var f=this,h=u.qrbox;this.validateQrboxConfig(h);var m=this.toQrdimensions(a,i,h),w=function(p){if(p<an.MIN_QR_BOX_SIZE)throw"minimum size of 'config.qrbox' dimension value is"+" ".concat(an.MIN_QR_BOX_SIZE,"px.")},_=function(p){return p>a&&(f.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."),p=a),p};w(m.width),w(m.height),m.width=_(m.width)},o.prototype.validateQrboxConfig=function(a){if(typeof a!="number"&&typeof a!="function"&&(a.width===void 0||a.height===void 0))throw"Invalid instance of QrDimensions passed for 'config.qrbox'. Both 'width' and 'height' should be set."},o.prototype.toQrdimensions=function(a,i,u){if(typeof u=="number")return{width:u,height:u};if(typeof u=="function")try{return u(a,i)}catch(f){throw new Error("qrbox config was passed as a function but it failed with unknown error"+f)}return u},o.prototype.setupUi=function(a,i,u){u.isShadedBoxEnabled()&&this.validateQrboxSize(a,i,u);var f=Fn(u.qrbox)?{width:a,height:i}:u.qrbox;this.validateQrboxConfig(f);var h=this.toQrdimensions(a,i,f);h.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=u.isShadedBoxEnabled()&&h.height<=i,w={x:0,y:0,width:a,height:i},_=m?this.getShadedRegionBounds(a,i,h):w,p=this.createCanvasElement(_.width,_.height),C={willReadFrequently:!0},y=p.getContext("2d",C);y.canvas.width=_.width,y.canvas.height=_.height,this.element.append(p),m&&this.possiblyInsertShadingElement(this.element,a,i,h),this.createScannerPausedUiElement(this.element),this.qrRegion=_,this.context=y,this.canvasElement=p},o.prototype.createScannerPausedUiElement=function(a){var i=document.createElement("div");i.innerText=xr.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%",a.appendChild(i),this.scannerPausedUiElement=i},o.prototype.scanContext=function(a,i){var u=this;return this.stateManagerProxy.isPaused()?Promise.resolve(!1):this.qrcode.decodeAsync(this.canvasElement).then(function(f){return a(f.text,ha.createFromQrcodeResult(f)),u.possiblyUpdateShaders(!0),!0}).catch(function(f){u.possiblyUpdateShaders(!1);var h=xr.codeParseError(f);return i(h,Uh.createFrom(h)),!1})},o.prototype.foreverScan=function(a,i,u){var f=this;if(this.shouldScan&&this.renderedCamera){var h=this.renderedCamera.getSurface(),m=h.videoWidth/h.clientWidth,w=h.videoHeight/h.clientHeight;if(!this.qrRegion)throw"qrRegion undefined when localMediaStream is ready.";var _=this.qrRegion.width*m,p=this.qrRegion.height*w,C=this.qrRegion.x*m,y=this.qrRegion.y*w;this.context.drawImage(h,C,y,_,p,0,0,this.qrRegion.width,this.qrRegion.height);var N=function(){f.foreverScanTimeout=setTimeout(function(){f.foreverScan(a,i,u)},f.getTimeoutFps(a.fps))};this.scanContext(i,u).then(function(B){!B&&a.disableFlip!==!0?(f.context.translate(f.context.canvas.width,0),f.context.scale(-1,1),f.scanContext(i,u).finally(function(){N()})):N()}).catch(function(B){f.logger.logError("Error happend while scanning context",B),N()})}},o.prototype.createVideoConstraints=function(a){if(typeof a=="string")return{deviceId:{exact:a}};if(typeof a=="object"){var i="facingMode",u="deviceId",f={user:!0,environment:!0},h="exact",m=function(R){if(R in f)return!0;throw"config has invalid 'facingMode' value = "+"'".concat(R,"'")},w=Object.keys(a);if(w.length!==1)throw"'cameraIdOrConfig' object should have exactly 1 key,"+" if passed as an object, found ".concat(w.length," keys");var _=Object.keys(a)[0];if(_!==i&&_!==u)throw"Only '".concat(i,"' and '").concat(u,"' ")+" are supported for 'cameraIdOrConfig'";if(_===i){var p=a.facingMode;if(typeof p=="string"){if(m(p))return{facingMode:p}}else if(typeof p=="object")if(h in p){if(m(p["".concat(h)]))return{facingMode:{exact:p["".concat(h)]}}}else throw"'facingMode' should be string or object with"+" ".concat(h," as key.");else{var C=typeof p;throw"Invalid type of 'facingMode' = ".concat(C)}}else{var y=a.deviceId;if(typeof y=="string")return{deviceId:y};if(typeof y=="object"){if(h in y)return{deviceId:{exact:y["".concat(h)]}};throw"'deviceId' should be string or object with"+" ".concat(h," as key.")}else{var N=typeof y;throw"Invalid type of 'deviceId' = ".concat(N)}}}var B=typeof a;throw"Invalid type of 'cameraIdOrConfig' = ".concat(B)},o.prototype.computeCanvasDrawConfig=function(a,i,u,f){if(a<=u&&i<=f){var h=(u-a)/2,m=(f-i)/2;return{x:h,y:m,width:a,height:i}}else{var w=a,_=i;return a>u&&(i=u/a*i,a=u),i>f&&(a=f/i*a,i=f),this.logger.log("Image downsampled from "+"".concat(w,"X").concat(_)+" to ".concat(a,"X").concat(i,".")),this.computeCanvasDrawConfig(a,i,u,f)}},o.prototype.clearElement=function(){if(this.stateManagerProxy.isScanning())throw"Cannot clear while scan is ongoing, close it first.";var a=document.getElementById(this.elementId);a&&(a.innerHTML="")},o.prototype.possiblyUpdateShaders=function(a){this.qrMatch!==a&&(this.hasBorderShaders&&this.borderShaders&&this.borderShaders.length&&this.borderShaders.forEach(function(i){i.style.backgroundColor=a?an.BORDER_SHADER_MATCH_COLOR:an.BORDER_SHADER_DEFAULT_COLOR}),this.qrMatch=a)},o.prototype.possiblyCloseLastScanImageFile=function(){this.lastScanImageFile&&(URL.revokeObjectURL(this.lastScanImageFile),this.lastScanImageFile=null)},o.prototype.createCanvasElement=function(a,i,u){var f=a,h=i,m=document.createElement("canvas");return m.style.width="".concat(f,"px"),m.style.height="".concat(h,"px"),m.style.display="none",m.id=Fn(u)?"qr-canvas":u,m},o.prototype.getShadedRegionBounds=function(a,i,u){if(u.width>a||u.height>i)throw"'config.qrbox' dimensions should not be greater than the dimensions of the root HTML element.";return{x:(a-u.width)/2,y:(i-u.height)/2,width:u.width,height:u.height}},o.prototype.possiblyInsertShadingElement=function(a,i,u,f){if(!(i-f.width<1||u-f.height<1)){var h=document.createElement("div");h.style.position="absolute";var m=(i-f.width)/2,w=(u-f.height)/2;if(h.style.borderLeft="".concat(m,"px solid rgba(0, 0, 0, 0.48)"),h.style.borderRight="".concat(m,"px solid rgba(0, 0, 0, 0.48)"),h.style.borderTop="".concat(w,"px solid rgba(0, 0, 0, 0.48)"),h.style.borderBottom="".concat(w,"px solid rgba(0, 0, 0, 0.48)"),h.style.boxSizing="border-box",h.style.top="0px",h.style.bottom="0px",h.style.left="0px",h.style.right="0px",h.id="".concat(an.SHADED_REGION_ELEMENT_ID),i-f.width<11||u-f.height<11)this.hasBorderShaders=!1;else{var _=5,p=40;this.insertShaderBorders(h,p,_,-_,null,0,!0),this.insertShaderBorders(h,p,_,-_,null,0,!1),this.insertShaderBorders(h,p,_,null,-_,0,!0),this.insertShaderBorders(h,p,_,null,-_,0,!1),this.insertShaderBorders(h,_,p+_,-_,null,-_,!0),this.insertShaderBorders(h,_,p+_,null,-_,-_,!0),this.insertShaderBorders(h,_,p+_,-_,null,-_,!1),this.insertShaderBorders(h,_,p+_,null,-_,-_,!1),this.hasBorderShaders=!0}a.append(h)}},o.prototype.insertShaderBorders=function(a,i,u,f,h,m,w){var _=document.createElement("div");_.style.position="absolute",_.style.backgroundColor=an.BORDER_SHADER_DEFAULT_COLOR,_.style.width="".concat(i,"px"),_.style.height="".concat(u,"px"),f!==null&&(_.style.top="".concat(f,"px")),h!==null&&(_.style.bottom="".concat(h,"px")),w?_.style.left="".concat(m,"px"):_.style.right="".concat(m,"px"),this.borderShaders||(this.borderShaders=[]),this.borderShaders.push(_),a.appendChild(_)},o.prototype.showPausedState=function(){if(!this.scannerPausedUiElement)throw"[internal error] scanner paused UI element not found";this.scannerPausedUiElement.style.display="block"},o.prototype.hidePausedState=function(){if(!this.scannerPausedUiElement)throw"[internal error] scanner paused UI element not found";this.scannerPausedUiElement.style.display="none"},o.prototype.getTimeoutFps=function(a){return 1e3/a},o}(),ba;(function(o){o[o.STATUS_DEFAULT=0]="STATUS_DEFAULT",o[o.STATUS_SUCCESS=1]="STATUS_SUCCESS",o[o.STATUS_WARNING=2]="STATUS_WARNING",o[o.STATUS_REQUESTING_PERMISSION=3]="STATUS_REQUESTING_PERMISSION"})(ba||(ba={}));const a2={width:"38",height:"38",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"none"},l2=["stroke"],c2=["stroke"],u2=["stroke"],d2=["stroke"],f2=["stroke"],h2=l.defineComponent({__name:"QR",props:{color:{type:String,required:!1,default:"#FFFFFF"}},setup(o){return(a,i)=>(l.openBlock(),l.createElementBlock("svg",a2,[l.createElementVNode("path",{d:"M11 11H7V7h4ZM17 7h-2v2h2ZM13 17h4v-4h-4ZM7 17h2v-2H7Z",stroke:o.color,"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"1.5"},null,8,l2),l.createElementVNode("path",{d:"M8 3H4a1 1 0 0 0-1 1V8",stroke:o.color,"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"1.5"},null,8,c2),l.createElementVNode("path",{d:"M21 8V4a1 1 0 0 0-1-1H16",stroke:o.color,"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"1.5"},null,8,u2),l.createElementVNode("path",{d:"M3 16v4a1 1 0 0 0 1 1H8",stroke:o.color,"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"1.5"},null,8,d2),l.createElementVNode("path",{d:"M16 21h4a1 1 0 0 0 1-1V16",stroke:o.color,"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"1.5"},null,8,f2)]))}}),wo={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"]},g2={key:0,class:"qr_text"},m2=l.defineComponent({__name:"QrCameraScanner",props:{axiosInstanceGet:{type:[Function,Object]},is_toggleAffiliation:{type:Boolean},is_notification:{type:Boolean},notificationData:{},tableData:{},isQr:{type:[Boolean,null]},takeDataTable:{type:Function}},emits:["update:tableData","update:notificationData","update:is_notification","update:is_toggleAffiliation"],setup(o,{emit:a}){const i=o;let u=null;const f=l.ref(!1),h=l.ref(!1),m=l.ref(!1),w=l.ref(!1);let _=null;const p=It(),{itemThemes:C}=xe.storeToRefs(p),y=a,N=v=>v.replace(/^[\s\S]*?((?:tel|sms|smsto|mailto|callto|facetime|viber|whatsapp):)?[\s\S]*?(%2B)?[\s\S]*?/i,(M,k,V)=>V?"+":""),B=async(v,M)=>{var ne,U,ie;if(console.log(v,M),w.value)return;i.isQr||(w.value=!0),D();const k=/[?&]table_id=([a-zA-Z0-9-]+)/,V=v.match(k),te=v.match(/\/([a-f0-9\-]{36})\?/);if(i.isQr){if(V&&te)return(ne=i.takeDataTable)==null?void 0:ne.call(i,te[1],V[1],"qr");{const z=localStorage.getItem("orgID");if(z){const oe=await i.axiosInstanceGet.get(`org_unit/${z}/table`,{params:{external_link:v}}).then(G=>{var W,Z;return((W=G.data)==null?void 0:W.length)>0?(Z=G.data[0])==null?void 0:Z.id:null}).catch(()=>null);if(oe)return(U=i.takeDataTable)==null?void 0:U.call(i,z,oe)}}y("update:is_notification",!0),y("update:notificationData",{textNotification:"Стол не найден"}),y("update:tableData",null),y("update:is_toggleAffiliation",!0)}else{const z=new En,oe=v||M.text,G=N(oe);try{await z.authorizeByCard(G);const W=await z.getProfile();y("update:is_notification",!0),y("update:notificationData",{textNotification:`Здравствуйте, ${W.first_name}
|
|
31
|
-
Баланс: ${W.balance}`})}catch(W){y("update:is_notification",!0),y("update:notificationData",{textNotification:((ie=W.response)==null?void 0:ie.user_friendly_message)||"Карта не найдена"})}finally{m.value=!0,_&&clearTimeout(_),_=setTimeout(()=>{m.value=!1},2e3),w.value=!1}}};window.debugScan=B;const R=()=>{},P=async()=>{if(!(f.value||u!=null&&u.isScanning||m.value))try{f.value=!0;try{(await navigator.mediaDevices.getUserMedia({video:!0})).getTracks().forEach(ne=>ne.stop())}catch{y("update:is_notification",!0),y("update:notificationData",{textNotification:"Разрешите доступ к камере"}),f.value=!1,y("update:is_toggleAffiliation",!0);return}u=new ya("reader");const v=await ya.getCameras();if(!v||v.length===0){console.error("Камеры не найдены"),f.value=!1;return}let M;if(i.isQr)M=v.find(te=>wo.back.some(ne=>new RegExp(ne,"i").test(te.label))),M||(M=v.find(te=>wo.front.some(ne=>new RegExp(ne,"i").test(te.label))));else if(M=v.find(te=>wo.front.some(ne=>new RegExp(ne,"i").test(te.label))),M||(M=v.find(te=>new RegExp("amera","i").test(te.label))),!M){y("update:is_notification",!0),y("update:notificationData",{textNotification:"Не найдена фронтальная камера. Для сканирования карт нужна фронтальная камера."}),f.value=!1,y("update:is_toggleAffiliation",!0);return}const k=i.isQr?[pe.QR_CODE]:[pe.QR_CODE,pe.PDF_417,pe.EAN_13,pe.EAN_8,pe.CODE_128],V={fps:60,qrbox:{width:320,height:500}};await u.start(M.id,V,B,R,void 0,k),h.value=!0}catch(v){y("update:is_notification",!0),y("update:notificationData",{textNotification:"Разрешите доступ к камере для сканирования"}),console.error("Ошибка доступа к камере:",v),f.value=!1,h.value=!1,y("update:is_toggleAffiliation",!0)}},D=async()=>{if(u&&u.isScanning)try{await u.stop(),f.value=!1,u=null}catch(v){console.error("Ошибка остановки камеры:",v)}else f.value=!1,u=null,y("update:is_toggleAffiliation",!0);h.value=!1};return l.onUnmounted(()=>{f.value&&D(),_&&(clearTimeout(_),_=null),w.value=!1,m.value=!1,h.value=!1}),(v,M)=>(l.openBlock(),l.createElementBlock("div",null,[(l.openBlock(),l.createBlock(l.Teleport,{to:"body"},[l.withDirectives(l.createElementVNode("div",{class:"blackWindow",onClick:D},[M[0]||(M[0]=l.createElementVNode("div",{id:"reader"},null,-1)),h.value&&!o.isQr?(l.openBlock(),l.createElementBlock("p",g2,"Наведите QR на камеру")):l.createCommentVNode("",!0)],512),[[l.vShow,f.value]])])),l.createVNode(h2,{color:o.isQr?void 0:"#FFFFFF",onClick:P},null,8,["color"])]))}}),_o=xe.defineStore("modulesLib",()=>{const o=l.ref(!1),a=l.ref({textNotification:""});return{is_notification_lib:o,notificationData_lib:a}}),wi=Symbol("clickOutside"),p2={mounted(o,a){o[wi]=i=>{o.contains(i.target)||a.value(i)},document.addEventListener("click",o[wi])},unmounted(o){o[wi]&&document.removeEventListener("click",o[wi])}};class x2{constructor(a){We(this,"value");We(this,"next");this.value=a}}class w2{constructor(){Bi(this,Qt);Bi(this,Hn);Bi(this,tr);this.clear()}enqueue(a){const i=new x2(a);pn(this,Qt)?(pn(this,Hn).next=i,vn(this,Hn,i)):(vn(this,Qt,i),vn(this,Hn,i)),Uo(this,tr)._++}dequeue(){const a=pn(this,Qt);if(a)return vn(this,Qt,pn(this,Qt).next),Uo(this,tr)._--,pn(this,Qt)||vn(this,Hn,void 0),a.value}peek(){if(pn(this,Qt))return pn(this,Qt).value}clear(){vn(this,Qt,void 0),vn(this,Hn,void 0),vn(this,tr,0)}get size(){return pn(this,tr)}*[Symbol.iterator](){let a=pn(this,Qt);for(;a;)yield a.value,a=a.next}*drain(){for(;pn(this,Qt);)yield this.dequeue()}}Qt=new WeakMap,Hn=new WeakMap,tr=new WeakMap;function _2(o){Aa(o);const a=new w2;let i=0;const u=()=>{i<o&&a.size>0&&(i++,a.dequeue()())},f=()=>{i--,u()},h=async(_,p,C)=>{const y=(async()=>_(...C))();p(y);try{await y}catch{}f()},m=(_,p,C)=>{new Promise(y=>{a.enqueue(y)}).then(h.bind(void 0,_,p,C)),i<o&&u()},w=(_,...p)=>new Promise(C=>{m(_,C,p)});return Object.defineProperties(w,{activeCount:{get:()=>i},pendingCount:{get:()=>a.size},clearQueue:{value(){a.clear()}},concurrency:{get:()=>o,set(_){Aa(_),o=_,queueMicrotask(()=>{for(;i<o&&a.size>0;)u()})}},map:{async value(_,p){const C=Array.from(_,(y,N)=>this(p,y,N));return Promise.all(C)}}}),w}function Aa(o){if(!((Number.isInteger(o)||o===Number.POSITIVE_INFINITY)&&o>0))throw new TypeError("Expected `concurrency` to be a number from 1 and up")}let Kt=null;const Ia=_2(5),C2=async(o,a)=>{Kt&&A2();const i=ot(),u=It(),f=_o(),h=Rt(),{itemThemes:m}=xe.storeToRefs(u),{displayCards:w}=xe.storeToRefs(i),{is_notification_lib:_,notificationData_lib:p}=xe.storeToRefs(f),{stateCard:C,openProduct:y}=xe.storeToRefs(h),N=En.create();await E2(o),Kt=ti(`wss://${a}/ws/org-unit/${o}/`,{heartbeatTimeout:3e4}),Kt.on("open",()=>console.warn("Realtime WebSocket подключён (pointId:",o,")")),Kt.on("error",B=>console.warn("WebSocket ошибка:",B)),Kt.on("close",()=>console.warn("Realtime WebSocket закрыт")),Kt.on("message",async B=>{if(B.type)return;m.value.kiosk_hide_menu_update_notification||(p.value.textNotification="Мы обновили меню");const R=B.params||B,P=R.active_groups||[],D=R.updated_groups||[],v=R.updated_product_groups||[],M=await Yn(),k=new Set(P.map(G=>G)),V=new Map(w.value.map(G=>[G.id,G])),te=[],ne=M.transaction("groups","readwrite");let ie=await ne.objectStore("groups").openCursor();for(;ie;){const G=ie.key;!k.has(G)&&G!==o&&(te.push(G),await ie.delete(),V.delete(G)),ie=await ie.continue()}await ne.done,w.value=Array.from(V.values()),te.length>0&&await y2(k);const z=[...D.map(G=>Ia(async()=>{const[W,Z]=await Promise.all([N.getGroupByID(G),N.loadGroupProducts(G)]);W.products=Z,V.set(G,W),await kr(G,W),await Na(W,Z,!0)})),...v.map(G=>Ia(async()=>{const[W,Z]=await Promise.all([N.getGroupByID(G),N.loadGroupProducts(G)]);W.products=Z,V.set(G,W),await kr(G,W),await Na(W,Z,!0),await b2(Z,G)}))];await Promise.all(z),w.value=Array.from(V.values()),await pl(o,w),p.value.textNotification.length>1&&(_.value=!0);const oe=C.value.openCard;if(oe!=null&&oe.id){const G=new Set(oe.groups??[]),W=new Set;let Z=!1;for(const S of V.values()){const $=S==null?void 0:S.products;if(!Array.isArray($))continue;const H=$.find(ee=>(ee==null?void 0:ee.id)===oe.id);if((H==null?void 0:H.adult)===!0){y.value={id:null,visible:!1},h.reset();return}H&&(S==null?void 0:S.id)!=null&&(W.add(S.id),(D.includes(S.id)||v.includes(S.id))&&(Z=!0))}if(W.size===0){y.value={id:null,visible:!1},h.reset();return}(!(G.size===W.size&&[...G].every(S=>W.has(S)))||Z)&&await N.getSingleProduct(oe==null?void 0:oe.id)}}),Kt.connect()},E2=async o=>{try{const a=ot(),i=await Ui(o);i!=null&&i.data&&(a.displayCards=i.data)}catch(a){console.error("Ошибка загрузки кэша групп:",a)}},Sa=async o=>{const a=ot(),i=_o(),u=Rt(),{stateCard:f,openProduct:h}=xe.storeToRefs(u),{cartProducts_lib:m}=xe.storeToRefs(a),w=m.value,_=[],p=[],C=f.value.openCard;for(const y of w)o(y)?(_.push(y),(y.id===(C==null?void 0:C.id)||C!=null&&C.adult)&&(h.value={id:null,visible:!1})):p.push(y);if(_.length>0){const y=_.map(N=>N.name).slice(0,3).join(", ");i.notificationData_lib.textNotification=`Некоторые позиции стали недоступны и были убраны из заказа: ${y}${_.length>3?` и ещё ${_.length-3}`:""}`,m.value=p,a.updateCartInLocalStorage()}},y2=async o=>{await Sa(a=>{var i;return(i=a.groups)!=null&&i.length?!a.groups.some(u=>o.has(u)):!0})},b2=async(o,a)=>{const i=ot(),u=new Set(o.filter(f=>!f.adult||i.is18Allowed).map(f=>f.id));await Sa(f=>{var h;return(h=f.groups)!=null&&h.includes(a)?!u.has(f.id):!1})},Na=async(o,a,i=!0)=>{if(o.video_link&&_i(o.video_link,`${o.id}_video`,i),o.image_link&&_i(o.image_link,`${o.id}_image`,i),a!=null&&a.length)for(const u of a)u.video_link&&_i(u.video_link,`${u.id}_video`,i),u.image_link&&_i(u.image_link,`${u.id}_image`,i)},_i=async(o,a,i=!1)=>{try{const u=Jr();if(!i){const m=await cr(a);if(m){u.updateCacheFromBlob(a,m),window.dispatchEvent(new CustomEvent("image-cached",{detail:{id:a,blob:m}}));return}}const f=await fetch(o);if(!f.ok)throw new Error("Network error");const h=await f.blob();if(h.size===0)throw new Error("Empty blob");await Hi(a,h),u.updateCacheFromBlob(a,h),window.dispatchEvent(new CustomEvent("image-cached",{detail:{id:a,blob:h}}))}catch(u){console.warn(`[MediaCache] Failed for ${a}:`,u)}},A2=()=>{Kt&&(Kt.off("open"),Kt.off("message"),Kt.off("error"),Kt.off("close"),Kt.close(!0),Kt=null)},I2={key:0,class:"valentine-hearts"},S2=l.defineComponent({__name:"FallingHearts",props:{symbols:{default:()=>["❤","♥","💕"]},max:{default:15},interval:{default:1500}},setup(o){const a=o,i=Wt.useDocumentVisibility(),u=Wt.useMediaQuery("(prefers-reduced-motion: reduce)"),f=l.ref([]);let h=null;const m=(C,y)=>Math.random()*(y-C)+C,w=()=>{if(u.value||f.value.length>=a.max)return;const C=a.symbols[Math.floor(Math.random()*a.symbols.length)],y=m(18,26),N=m(5,95),B=m(10,18),R=m(0,.3),P=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, ${P})`,animationName:`heartFall${D}`,animationDuration:`${B}s`,animationDelay:`${R}s`}};f.value.push(M);const V=setTimeout(()=>{f.value=f.value.filter(te=>te.id!==M.id),clearTimeout(V)},(R+B+1)*1e3)},_=()=>{if(!u.value){for(let C=0;C<3;C++){const y=setTimeout(()=>{w(),clearTimeout(y)},C*200)}h=setInterval(w,a.interval)}},p=()=>{h&&(clearInterval(h),h=null),f.value=[]};return l.onMounted(()=>{u.value||_()}),l.onUnmounted(()=>{p()}),l.watch(i,(C,y)=>{C==="visible"&&y==="hidden"&&_(),C==="hidden"&&y==="visible"&&p()}),(C,y)=>l.unref(u)?l.createCommentVNode("",!0):(l.openBlock(),l.createElementBlock("div",I2,[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(f.value,N=>(l.openBlock(),l.createElementBlock("span",{key:N.id,class:"heart",style:l.normalizeStyle(N.style)},l.toDisplayString(N.icon),5))),128))]))}}),N2=["src"],T2=l.defineComponent({__name:"BasketImage",props:{id:{},fallback:{}},setup(o){const a=o,{mediaUrl:i}=Ln(()=>a.id,()=>a.fallback);return(u,f)=>(l.openBlock(),l.createElementBlock("img",{src:l.unref(i)||""},null,8,N2))}}),k2={class:"button_price_bg"},R2={class:"wrapper_container_price_bg"},O2={class:"button_price"},B2={key:0,class:"image_product_container"},M2=l.defineComponent({__name:"BasketButton",emits:["goToCart"],setup(o){const a=ot(),{totalPrice_lib:i,cartProducts_lib:u}=xe.storeToRefs(a),f=l.computed(()=>{var h;return(h=u.value)!=null&&h.length,u.value.slice(0,3).map(m=>({id:`${m.id}_image`,fallback:m.image_link}))});return(h,m)=>(l.openBlock(),l.createElementBlock("div",k2,[l.createElementVNode("div",R2,[l.createElementVNode("div",O2,[l.unref(i)>0&&f.value.length>0?(l.openBlock(),l.createElementBlock("div",B2,[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(f.value,w=>(l.openBlock(),l.createElementBlock("div",{key:w.id,class:"filter_image_product"},[l.createVNode(T2,{id:w.id,fallback:w.fallback,class:"img_product"},null,8,["id","fallback"])]))),128))])):l.createCommentVNode("",!0),l.createVNode(l.unref(At.motion).div,{class:"button_default_main",whilePress:{scale:.92},onClick:m[0]||(m[0]=w=>h.$emit("goToCart"))},{default:l.withCtx(()=>[m[2]||(m[2]=l.createElementVNode("div",{class:"icont_cart"},null,-1)),l.createElementVNode("p",null,[l.createVNode(Xt,{price:l.unref(i),fixedFloat:2},null,8,["price"]),m[1]||(m[1]=l.createTextVNode(" ₽",-1))])]),_:1})])])]))}}),Ur=null,{min:er,max:yn,abs:Ta,floor:v2}=Math,ka=(o,a,i)=>er(i,yn(a,o)),Ra=o=>[...o].sort((a,i)=>a-i),D2=typeof queueMicrotask=="function"?queueMicrotask:o=>{Promise.resolve().then(o)},Co=()=>{let o;return[new Promise(a=>{o=a}),o]},Oa=o=>{let a;return()=>(o&&(a=o(),o=void 0),a)},Hr=(o,a,i)=>{const u=i?"unshift":"push";for(let f=0;f<a;f++)o[u](-1);return o},Ba=(o,a)=>{const i=o.t[a];return i===-1?o.o:i},P2=(o,a,i)=>{const u=o.t[a]===-1;return o.t[a]=i,o.i=er(a,o.i),u},Ci=(o,a)=>{if(!o.l)return 0;if(o.i>=a)return o.u[a];o.i<0&&(o.u[0]=0,o.i=0);let i=o.i,u=o.u[i];for(;i<a;)u+=Ba(o,i),o.u[++i]=u;return o.i=a,u},wr=(o,a,i=0,u=o.l-1)=>{let f=i;for(;i<=u;){const h=v2((i+u)/2);Ci(o,h)<=a?(f=h,i=h+1):u=h-1}return ka(f,0,o.l-1)},Ma=(o,a,i)=>{const u=a-o.l;return o.i=i?-1:er(a-1,o.i),o.l=a,u>0?(Hr(o.u,u),Hr(o.t,u,i),o.o*u):(o.u.splice(u),(i?o.t.splice(0,-u):o.t.splice(u)).reduce((f,h)=>f-(h===-1?o.o:h),0))},L2=o=>o.documentElement,F2=o=>o.ownerDocument,V2=o=>o.defaultView,va=Oa(()=>!!/iP(hone|od|ad)/.test(navigator.userAgent)||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>0),U2=Oa(()=>"scrollBehavior"in L2(document).style),H2=(o,a=40,i=0,u,f=!1)=>{let h=!!i,m=1,w=0,_=0,p=0,C=0,y=0,N=0,B=0,R=0,P=Ur,D=[0,h?yn(i-1,0):-1],v=0,M=!1;const k=((Z,X,S)=>({o:X,t:S?Hr(S.slice(0,er(Z,S.length)),yn(0,Z-S.length)):Hr([],Z),l:Z,i:-1,u:Hr([],Z+1)}))(o,u?u[1]:a,u&&u[0]),V=new Set,te=()=>p-_,ne=()=>te()+y+C,U=(Z,X)=>((S,$,H,ee)=>{if(ee=er(ee,S.l-1),Ci(S,ee)<=$){const j=wr(S,H,ee);return[wr(S,$,ee,j),j]}{const j=wr(S,$,void 0,ee);return[j,wr(S,H,j)]}})(k,Z,X,D[0]),ie=()=>Ci(k,k.l),z=(Z,X)=>{const S=Ci(k,Z)-y;return X?ie()-S-oe(Z):S},oe=Z=>Ba(k,Z),G=(Z,X=-1)=>k.t[Z]===X,W=Z=>{Z&&(va()&&B!==0||P&&R===1?y+=Z:C+=Z)};return{p:()=>{V.clear()},h:()=>m,m:()=>(Z=>[Z.t.slice(),Z.o])(k),v:(Z=200)=>{if(!M||h)return D;let X,S;if(N)[X,S]=D;else{let $=yn(0,ne()),H=$+w;f||(Z=yn(0,Z),B!==1&&($-=Z),B!==2&&(H+=Z)),[X,S]=D=U(yn(0,$),yn(0,H)),P&&(X=er(X,P[0]),S=yn(S,P[1]))}return[yn(X,0),er(S,k.l-1)]},S:Z=>wr(k,Z-_),I:G,O:z,k:oe,j:()=>k.l,N:()=>p,B:()=>B!==0,T:()=>w,q:()=>_,M:ie,P:()=>(N=C,C=0,[N,R===2]),R:(Z,X)=>{const S=[Z,X];return V.add(S),()=>{V.delete(S)}},A:(Z,X)=>{let S,$,H=0;switch(Z){case 1:{if(X===p&&R===0)break;const ee=N;N=0;const j=X-p,re=Ta(j);ee&&re<Ta(ee)+1||R!==0||(B=j<0?2:1),h&&(h=!1),p=X,H=4;const ge=te();ge>=-w&&ge<=ie()&&(H+=1,$=re>w);break}case 2:H=8,B!==0&&(S=!0,H+=1),B=0,R=0,P=Ur;break;case 3:{const ee=X.filter(([j,re])=>!G(j,re));if(!ee.length)break;W(ee.reduce((j,[re,ge])=>((R===2||(P&&R===1?re<P[0]:z(re+(B===0&&R===0?1:0))<te()))&&(j+=ge-oe(re)),j),0));for(const[j,re]of ee){const ge=oe(j),we=P2(k,j,re);f&&(v+=we?re:re-ge)}f&&w&&v>w&&(W(((j,re)=>{let ge=0;const we=[];j.t.forEach((Xe,Oe)=>{Xe!==-1&&(we.push(Xe),Oe<re&&ge++)}),j.i=-1;const Ne=Ra(we),_e=Ne.length,Me=_e/2|0,fe=_e%2==0?(Ne[Me-1]+Ne[Me])/2:Ne[Me],dt=j.o;return((j.o=fe)-dt)*yn(re-ge,0)})(k,wr(k,ne()))),f=!1),H=3,$=!0;break}case 4:w!==X&&(w||(M=$=!0),w=X,H=3);break;case 5:X[1]?(W(Ma(k,X[0],!0)),R=2,H=1):(Ma(k,X[0]),H=1);break;case 6:_=X;break;case 7:R=1;break;case 8:P=U(X,X+w),H=1}H&&(m=1+(2147483647&m),S&&y&&(C+=y,y=0),V.forEach(([ee,j])=>{H&ee&&j($)}))}}},Eo=setTimeout,yo=(o,a)=>a?-o:o,z2=(o,a,i,u,f,h)=>{const m=Date.now;let w=0,_=!1,p=!1,C=!1,y=!1;const N=(()=>{let v;const M=()=>{v!=Ur&&clearTimeout(v)},k=()=>{M(),v=Eo(()=>{v=Ur,(()=>{if(_||p)return _=!1,void N();C=!1,o.A(2)})()},150)};return k.C=M,k})(),B=()=>{w=m(),C&&(y=!0),o.A(1,u()),N()},R=v=>{if(_||!o.B()||v.ctrlKey)return;const M=m()-w;150>M&&50<M&&(i?v.deltaX:v.deltaY)&&(_=!0)},P=()=>{p=!0,C=y=!1},D=()=>{p=!1,va()&&(C=!0)};return a.addEventListener("scroll",B),a.addEventListener("wheel",R,{passive:!0}),a.addEventListener("touchstart",P,{passive:!0}),a.addEventListener("touchend",D,{passive:!0}),{H:()=>{a.removeEventListener("scroll",B),a.removeEventListener("wheel",R),a.removeEventListener("touchstart",P),a.removeEventListener("touchend",D),N.C()},V:()=>{const[v,M]=o.P();v&&(f(v,M,y),y=!1,M&&o.T()>o.M()&&o.A(1,u()))}}},G2=(o,a,i)=>{let u;return[async(f,h)=>{if(!await a())return;u&&u();const m=()=>{const[w,_]=Co();return u=()=>{_(!1)},o.T()&&Eo(u,150),[w,o.R(2,()=>{_(!0)})]};if(h&&U2())o.A(8,f()),D2(async()=>{for(;;){let w=!0;for(let[C,y]=o.v();C<=y;C++)if(o.I(C)){w=!1;break}if(w)break;const[_,p]=m();try{if(!await _)return}finally{p()}}o.A(7),i(f(),h)});else for(;;){const[w,_]=m();try{if(o.A(7),i(f()),!await w)return}finally{_()}}},()=>{u&&u()}]},W2=o=>{let a;return{F(i){(a||(a=new(V2(F2(i))).ResizeObserver(o))).observe(i)},J(i){a.unobserve(i)},H(){a&&a.disconnect()}}},X2=l.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(o){const a=l.ref(),i=l.computed(()=>o.L.value&&o.W.O(o.D,o.K)),u=l.computed(()=>o.L.value&&o.W.I(o.D));return l.watch(()=>a.value&&o.D,(f,h,m)=>{m(o.Y(a.value,o.D))},{flush:"post"}),()=>{var f;const{X:h,U:m,G:w,Z:_}=o,p=u.value,{style:C,...y}=(f=o.ee)!==null&&f!==void 0?f:{},N={contain:"layout style",position:p&&w?void 0:"absolute",[m?"height":"width"]:"100%",[m?"top":"left"]:"0px",[m?"left":"top"]:i.value+"px",visibility:!p||w?void 0:"hidden",...C};return m&&(N.display="inline-flex"),l.createVNode(_,l.mergeProps({ref:a,style:N},y),typeof(B=h)=="function"||Object.prototype.toString.call(B)==="[object Object]"&&!l.isVNode(B)?h:{default:()=>[h],_:2},16,["style"]);var B}}}),j2=(o,a)=>{const i=o.key;return i??"_"+a},Z2=(o,a)=>o[0]===a[0]&&o[1]===a[1],Da=l.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(o,{emit:a,expose:i,slots:u}){let f=!!o.ssrCount;const h=o.horizontal,m=l.ref(),w=H2(o.data.length,o.itemSize,o.ssrCount,o.cache,!o.itemSize),_=((R,P)=>{let D;const v=P?"width":"height",M=new WeakMap,k=W2(V=>{const te=[];for(const{target:ne,contentRect:U}of V)if(ne.offsetParent)if(ne===D)R.A(4,U[v]);else{const ie=M.get(ne);ie!=Ur&&te.push([ie,U[v]])}te.length&&R.A(3,te)});return{te(V){k.F(D=V)},re:(V,te)=>(M.set(V,te),k.F(V),()=>{M.delete(V),k.J(V)}),p:k.H}})(w,h),p=((R,P)=>{let D,v,M=Co(),k=!1;const V=P?"scrollLeft":"scrollTop",te=P?"overflowX":"overflowY",[ne,U]=G2(R,()=>M[0],(ie,z)=>{ie=yo(ie,k),z?D.scrollTo({[P?"left":"top"]:ie,behavior:"smooth"}):D[V]=ie});return{oe(ie){D=ie,P&&(k=getComputedStyle(ie).direction==="rtl"),v=z2(R,ie,P,()=>yo(ie[V],k),(z,oe,G)=>{if(G){const W=ie.style,Z=W[te];W[te]="hidden",Eo(()=>{W[te]=Z})}ie[V]=yo(R.N()+z,k),oe&&U()}),M[1](!0)},p(){v&&v.H(),M[1](!1),M=Co()},ne:()=>k,se(ie){ne(()=>ie)},ie(ie){ie+=R.N(),ne(()=>ie)},le(ie,{align:z,smooth:oe,offset:G=0}={}){if(ie=ka(ie,0,R.j()-1),z==="nearest"){const W=R.O(ie),Z=R.N();if(W<Z)z="start";else{if(!(W+R.k(ie)>Z+R.T()))return;z="end"}}ne(()=>G+R.q()+R.O(ie)+(z==="end"?R.k(ie)-R.T():z==="center"?(R.k(ie)-R.T())/2:0),oe)},ce:()=>{v&&v.V()}}})(w,h),C=l.ref(w.h());w.R(1,()=>{C.value=w.h()}),w.R(4,()=>{a("scroll",w.N())}),w.R(8,()=>{a("scrollEnd")});const y=l.computed(R=>{C.value;const P=w.v(o.bufferSize);return R&&Z2(R,P)?R:P}),N=l.computed(()=>C.value&&w.B()),B=l.computed(()=>C.value&&w.M());return l.onMounted(()=>{f=!1;const R=requestAnimationFrame(()=>{const P=D=>{_.te(D),p.oe(D)};o.scrollRef?P(o.scrollRef):P(m.value.parentElement)});l.onUnmounted(()=>{cancelAnimationFrame(R)})}),l.onUnmounted(()=>{w.p(),_.p(),p.p()}),l.watch(()=>o.data.length,R=>{w.A(5,[R,o.shift])}),l.watch(()=>o.startMargin,R=>{w.A(6,R)},{immediate:!0}),l.watch([C],()=>{p.ce()},{flush:"post"}),i({get cache(){return w.m()},get scrollOffset(){return w.N()},get scrollSize(){return(R=>yn(R.M(),R.T()))(w)},get viewportSize(){return w.T()},findItemIndex:w.S,getItemOffset:w.O,getItemSize:w.k,scrollToIndex:p.le,scrollTo:p.se,scrollBy:p.ie}),()=>{const R=o.as,P=o.item,D=B.value,v=p.ne(),M=!h&&v?"unshift":"push",k=[],V=ne=>{var U;const ie=u.default({item:o.data[ne],index:ne})[0];return l.createVNode(X2,{key:j2(ie,ne),L:C,W:w,Y:_.re,D:ne,X:ie,U:h,K:v,G:f,Z:P,ee:(U=o.itemProps)===null||U===void 0?void 0:U.call(o,{item:o.data[ne],index:ne})},null,8,["L","W","Y","D","X","U","K","G","Z","ee"])};if(o.keepMounted){const ne=new Set(o.keepMounted);for(let[U,ie]=y.value;U<=ie;U++)ne.add(U);Ra([...ne]).forEach(U=>{k[M](V(U))})}else for(let[ne,U]=y.value;ne<=U;ne++)k[M](V(ne));return l.createVNode(R,{ref:m,style:{contain:"size style",overflowAnchor:"none",flex:"none",position:"relative",width:h?D+"px":"100%",height:h?"100%":D+"px",pointerEvents:N.value?"none":void 0}},typeof(te=k)=="function"||Object.prototype.toString.call(te)==="[object Object]"&&!l.isVNode(te)?k:{default:()=>[k],_:2},8,["style"]);var te}}}),q2=l.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(o,{emit:a,expose:i,slots:u}){const f=o.horizontal,h=_=>{a("scroll",_)},m=()=>{a("scrollEnd")},w=l.ref();return i({get cache(){return w.value.cache},get scrollOffset(){return w.value.scrollOffset},get scrollSize(){return w.value.scrollSize},get viewportSize(){return w.value.viewportSize},findItemIndex:(..._)=>w.value.findItemIndex(..._),getItemOffset:(..._)=>w.value.getItemOffset(..._),getItemSize:(..._)=>w.value.getItemSize(..._),scrollToIndex:(..._)=>w.value.scrollToIndex(..._),scrollTo:(..._)=>w.value.scrollTo(..._),scrollBy:(..._)=>w.value.scrollBy(..._)}),()=>{return l.createVNode("div",{style:{display:f?"inline-block":"block",[f?"overflowX":"overflowY"]:"auto",contain:"strict",width:"100%",height:"100%"}},[l.createVNode(Da,{ref:w,data:o.data,bufferSize:o.bufferSize,itemSize:o.itemSize,itemProps:o.itemProps,shift:o.shift,ssrCount:o.ssrCount,horizontal:f,keepMounted:o.keepMounted,cache:o.cache,onScroll:h,onScrollEnd:m},(_=u,typeof _=="function"||Object.prototype.toString.call(_)==="[object Object]"&&!l.isVNode(_)?u:{default:()=>[u],_:2}),8,["data","bufferSize","itemSize","itemProps","shift","ssrCount","horizontal","keepMounted","cache","onScroll","onScrollEnd"])],4);var _}}}),Y2=(o,a=10)=>new Promise(i=>{let u=0,f=0,h=0;const m=()=>{const w=o.scrollSize;w===h&&w>0?u++:(u=0)&&(h=w),f++,u>=2||f>=a?i():requestAnimationFrame(m)};requestAnimationFrame(m)});function $2(o,a){const i=(a==null?void 0:a.align)??"start";let u=!1;const f=l.ref(null),h=l.ref(!1),m=l.ref("measure"),w=l.computed(()=>l.toValue(o).length),_=l.computed(()=>m.value==="measure"||m.value==="virtual"?1:5),p=l.computed(()=>Array.from({length:w.value*_.value},(D,v)=>v)),C=async()=>{if(f.value&&(m.value="measure",u=!1,h.value=!1,await l.nextTick(),m.value==="measure")){if(await Y2(f.value),h.value=f.value.scrollSize>f.value.viewportSize,!h.value){u=!1;return}u=!0,m.value=(a==null?void 0:a.mode)||"loop",await l.nextTick(),f.value.scrollToIndex(w.value*3,{align:i})}},y=D=>m.value==="measure"?D:w.value===0?0:D%w.value,N=(D,v)=>{f.value&&f.value.scrollToIndex(D,v)},B=(D,v)=>!u||m.value!=="loop"?v:v+Math.round((D-v)/w.value)*w.value,R=D=>{if(!u||m.value!=="loop"||!f.value)return;const v=w.value-1,M=w.value*4;if(D<v)return N(w.value*3-1,{align:"start"});if(D>=M)return N(w.value*3,{align:"start"})},P=()=>{if(!f.value||!u)return;const D=f.value.findItemIndex(f.value.scrollOffset);R(D)};return l.onMounted(C),l.onUnmounted(()=>f.value=null),l.watch(w,()=>l.nextTick(C)),{listRef:f,items:p,hasScroll:h,realIndex:y,findNearestIndex:B,scrollToIndex:N,init:C,onScroll:P}}const K2=Object.prototype.toString,Q2=o=>K2.call(o)==="[object Error]",J2=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"]),eg=o=>{if(!(o&&Q2(o)&&o.name==="TypeError"&&typeof o.message=="string"))return!1;const{message:i,stack:u}=o;return i==="Load failed"?u===void 0||"__sentry_captured__"in o:i.startsWith("error sending request for url")||i==="Failed to fetch"||i.startsWith("Failed to fetch (")&&i.endsWith(")")?!0:J2.has(i)},tg={pinch:!0,doubleTap:!0,wheel:!0,buttons:["+","-","=","0"]},ng=o=>{var i;const a=Object.assign({},tg,o);if(a.pinch&&(document.addEventListener("touchstart",u=>u.touches.length>1&&u.preventDefault(),{passive:!1}),document.addEventListener("gesturestart",u=>u.preventDefault(),{passive:!1})),a.doubleTap){let u=0;document.addEventListener("touchend",f=>{const h=Date.now();h-u<=250&&f.preventDefault(),u=h},{passive:!1})}a.wheel&&document.addEventListener("wheel",u=>(u.ctrlKey||u.metaKey)&&u.preventDefault(),{passive:!1}),(i=a.buttons)!=null&&i.length&&document.addEventListener("keydown",u=>(u.ctrlKey||u.metaKey)&&a.buttons.includes(u.key)&&u.preventDefault())};Object.defineProperty(he,"useRoute",{enumerable:!0,get:()=>Re.useRoute}),Object.defineProperty(he,"useRouter",{enumerable:!0,get:()=>Re.useRouter}),he.BasketButton=M2,he.BottomSheet=lo,he.ButtonDefault=un,he.CardMain=ca,he.CardProductPage=i1,he.CardReader=na,he.CartBox=ta,he.CartPage=Zf,he.DrumItem=Ih,he.FallingHearts=S2,he.GroupMain=_h,he.InitConnection=En,he.ModalWindows=Lh,he.NotificationWindow=so,he.PopupWindowDefault=ea,he.PricePrerender=ur,he.QrCameraScanner=m2,he.Recommendation=Mh,he.RetryPage=ih,he.TagsMain=Eh,he.VList=q2,he.Virtualizer=Da,he.clearAllProductDB=wl,he.clearLocalStorage=dr,he.getCachedGroup=Ui,he.getCachedProduct=qo,he.getWebSocketInstance=ti,he.initPinia=el,he.initRouter=nl,he.isNetworkError=eg,he.parseTheme=$s,he.preventZoom=ng,he.updateIndexedDB=C2,he.useCachedMedia=Ln,he.useCardLibStore=Rt,he.useCartLibStore=St,he.useImageCacheStore=Jr,he.useMainLibStore=ot,he.useModal=la,he.useModalStore=co,he.useModulesLibStore=_o,he.useThemeStore=It,he.useVirtuaLoop=$2,he.vClickOutside=p2,he.vMuted=Vr,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<ar.NUM_MASK_PATTERNS}}ar.NUM_MASK_PATTERNS=8;class st extends p{}st.kind="WriterException";class Te{constructor(){}static clearMatrix(e){e.clear(255)}static buildMatrix(e,t,n,r,a){Te.clearMatrix(a),Te.embedBasicPatterns(n,a),Te.embedTypeInfo(t,r,a),Te.maybeEmbedVersionInfo(n,a),Te.embedDataBits(e,r,a)}static embedBasicPatterns(e,t){Te.embedPositionDetectionPatternsAndSeparators(t),Te.embedDarkDotAtLeftBottomCorner(t),Te.maybeEmbedPositionAdjustmentPatterns(e,t),Te.embedTimingPatterns(t)}static embedTypeInfo(e,t,n){const r=new D;Te.makeTypeInfoBits(e,t,r);for(let a=0,c=r.getSize();a<c;++a){const d=r.get(r.getSize()-1-a),g=Te.TYPE_INFO_COORDINATES[a],w=g[0],E=g[1];if(n.setBoolean(w,E,d),a<8){const A=n.getWidth()-a-1;n.setBoolean(A,8,d)}else{const I=n.getHeight()-7+(a-8);n.setBoolean(8,I,d)}}}static maybeEmbedVersionInfo(e,t){if(e.getVersionNumber()<7)return;const n=new D;Te.makeVersionInfoBits(e,n);let r=6*3-1;for(let a=0;a<6;++a)for(let c=0;c<3;++c){const d=n.get(r);r--,t.setBoolean(a,t.getHeight()-11+c,d),t.setBoolean(t.getHeight()-11+c,a,d)}}static embedDataBits(e,t,n){let r=0,a=-1,c=n.getWidth()-1,d=n.getHeight()-1;for(;c>0;){for(c===6&&(c-=1);d>=0&&d<n.getHeight();){for(let g=0;g<2;++g){const w=c-g;if(!Te.isEmpty(n.get(w,d)))continue;let E;r<e.getSize()?(E=e.get(r),++r):E=!1,t!==255&&Et.getDataMaskBit(t,w,d)&&(E=!E),n.setBoolean(w,d,E)}d+=a}a=-a,d+=a,c-=2}if(r!==e.getSize())throw new st("Not all bits consumed: "+r+"/"+e.getSize())}static findMSBSet(e){return 32-R.numberOfLeadingZeros(e)}static calculateBCHCode(e,t){if(t===0)throw new y("0 polynomial");const n=Te.findMSBSet(t);for(e<<=n-1;Te.findMSBSet(e)>=n;)e^=t<<Te.findMSBSet(e)-n;return e}static makeTypeInfoBits(e,t,n){if(!ar.isValidMaskPattern(t))throw new st("Invalid mask pattern");const r=e.getBits()<<3|t;n.appendBits(r,5);const a=Te.calculateBCHCode(r,Te.TYPE_INFO_POLY);n.appendBits(a,10);const c=new D;if(c.appendBits(Te.TYPE_INFO_MASK_PATTERN,15),n.xor(c),n.getSize()!==15)throw new st("should not happen but we got: "+n.getSize())}static makeVersionInfoBits(e,t){t.appendBits(e.getVersionNumber(),6);const n=Te.calculateBCHCode(e.getVersionNumber(),Te.VERSION_INFO_POLY);if(t.appendBits(n,12),t.getSize()!==18)throw new st("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;Te.isEmpty(e.get(t,6))&&e.setNumber(t,6,n),Te.isEmpty(e.get(6,t))&&e.setNumber(6,t,n)}}static embedDarkDotAtLeftBottomCorner(e){if(e.get(8,e.getHeight()-8)===0)throw new st;e.setNumber(8,e.getHeight()-8,1)}static embedHorizontalSeparationPattern(e,t,n){for(let r=0;r<8;++r){if(!Te.isEmpty(n.get(e+r,t)))throw new st;n.setNumber(e+r,t,0)}}static embedVerticalSeparationPattern(e,t,n){for(let r=0;r<7;++r){if(!Te.isEmpty(n.get(e,t+r)))throw new st;n.setNumber(e,t+r,0)}}static embedPositionAdjustmentPattern(e,t,n){for(let r=0;r<5;++r){const a=Te.POSITION_ADJUSTMENT_PATTERN[r];for(let c=0;c<5;++c)n.setNumber(e+c,t+r,a[c])}}static embedPositionDetectionPattern(e,t,n){for(let r=0;r<7;++r){const a=Te.POSITION_DETECTION_PATTERN[r];for(let c=0;c<7;++c)n.setNumber(e+c,t+r,a[c])}}static embedPositionDetectionPatternsAndSeparators(e){const t=Te.POSITION_DETECTION_PATTERN[0].length;Te.embedPositionDetectionPattern(0,0,e),Te.embedPositionDetectionPattern(e.getWidth()-t,0,e),Te.embedPositionDetectionPattern(0,e.getWidth()-t,e);const n=8;Te.embedHorizontalSeparationPattern(0,n-1,e),Te.embedHorizontalSeparationPattern(e.getWidth()-n,n-1,e),Te.embedHorizontalSeparationPattern(0,e.getWidth()-n,e);const r=7;Te.embedVerticalSeparationPattern(r,0,e),Te.embedVerticalSeparationPattern(e.getHeight()-r-1,0,e),Te.embedVerticalSeparationPattern(r,e.getHeight()-r,e)}static maybeEmbedPositionAdjustmentPatterns(e,t){if(e.getVersionNumber()<2)return;const n=e.getVersionNumber()-1,r=Te.POSITION_ADJUSTMENT_PATTERN_COORDINATE_TABLE[n];for(let a=0,c=r.length;a!==c;a++){const d=r[a];if(d>=0)for(let g=0;g!==c;g++){const w=r[g];w>=0&&Te.isEmpty(t.get(w,d))&&Te.embedPositionAdjustmentPattern(w-2,d-2,t)}}}}Te.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])]),Te.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])]),Te.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])]),Te.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])]),Te.VERSION_INFO_POLY=7973,Te.TYPE_INFO_POLY=1335,Te.TYPE_INFO_MASK_PATTERN=21522;class Sg{constructor(e,t){this.dataBytes=e,this.errorCorrectionBytes=t}getDataBytes(){return this.dataBytes}getErrorCorrectionBytes(){return this.errorCorrectionBytes}}class ht{constructor(){}static calculateMaskPenalty(e){return Et.applyMaskPenaltyRule1(e)+Et.applyMaskPenaltyRule2(e)+Et.applyMaskPenaltyRule3(e)+Et.applyMaskPenaltyRule4(e)}static encode(e,t,n=null){let r=ht.DEFAULT_BYTE_MODE_ENCODING;const a=n!==null&&n.get(kt.CHARACTER_SET)!==void 0;a&&(r=n.get(kt.CHARACTER_SET).toString());const c=this.chooseMode(e,r),d=new D;if(c===Se.BYTE&&(a||ht.DEFAULT_BYTE_MODE_ENCODING!==r)){const ue=W.getCharacterSetECIByName(r);ue!==void 0&&this.appendECI(ue,d)}this.appendModeInfo(c,d);const g=new D;this.appendBytes(e,c,g,r);let w;if(n!==null&&n.get(kt.QR_VERSION)!==void 0){const ue=Number.parseInt(n.get(kt.QR_VERSION).toString(),10);w=Ie.getVersionForNumber(ue);const ae=this.calculateBitsNeeded(c,d,g,w);if(!this.willFit(ae,w,t))throw new st("Data too big for requested version")}else w=this.recommendVersion(t,c,d,g);const E=new D;E.appendBitArray(d);const A=c===Se.BYTE?g.getSizeInBytes():e.length;this.appendLengthInfo(A,w,c,E),E.appendBitArray(g);const I=w.getECBlocksForLevel(t),O=w.getTotalCodewords()-I.getTotalECCodewords();this.terminateBits(O,E);const L=this.interleaveWithECBytes(E,w.getTotalCodewords(),O,I.getNumBlocks()),F=new ar;F.setECLevel(t),F.setMode(c),F.setVersion(w);const Z=w.getDimensionForVersion(),ne=new Oi(Z,Z),ce=this.chooseMaskPattern(L,t,w,ne);return F.setMaskPattern(ce),Te.buildMatrix(L,t,w,ce,ne),F.setMatrix(ne),F}static recommendVersion(e,t,n,r){const a=this.calculateBitsNeeded(t,n,r,Ie.getVersionForNumber(1)),c=this.chooseVersion(a,e),d=this.calculateBitsNeeded(t,n,r,c);return this.chooseVersion(d,e)}static calculateBitsNeeded(e,t,n,r){return t.getSize()+e.getCharacterCountBits(r)+n.getSize()}static getAlphanumericCode(e){return e<ht.ALPHANUMERIC_TABLE.length?ht.ALPHANUMERIC_TABLE[e]:-1}static chooseMode(e,t=null){if(W.SJIS.getName()===t&&this.isOnlyDoubleByteKanji(e))return Se.KANJI;let n=!1,r=!1;for(let a=0,c=e.length;a<c;++a){const d=e.charAt(a);if(ht.isDigit(d))n=!0;else if(this.getAlphanumericCode(d.charCodeAt(0))!==-1)r=!0;else return Se.BYTE}return r?Se.ALPHANUMERIC:n?Se.NUMERIC:Se.BYTE}static isOnlyDoubleByteKanji(e){let t;try{t=j.encode(e,W.SJIS)}catch{return!1}const n=t.length;if(n%2!==0)return!1;for(let r=0;r<n;r+=2){const a=t[r]&255;if((a<129||a>159)&&(a<224||a>235))return!1}return!0}static chooseMaskPattern(e,t,n,r){let a=Number.MAX_SAFE_INTEGER,c=-1;for(let d=0;d<ar.NUM_MASK_PATTERNS;d++){Te.buildMatrix(e,t,n,d,r);let g=this.calculateMaskPenalty(r);g<a&&(a=g,c=d)}return c}static chooseVersion(e,t){for(let n=1;n<=40;n++){const r=Ie.getVersionForNumber(n);if(ht.willFit(e,r,t))return r}throw new st("Data too big")}static willFit(e,t,n){const r=t.getTotalCodewords(),c=t.getECBlocksForLevel(n).getTotalECCodewords(),d=r-c,g=(e+7)/8;return d>=g}static terminateBits(e,t){const n=e*8;if(t.getSize()>n)throw new st("data bits cannot fit in the QR Code"+t.getSize()+" > "+n);for(let c=0;c<4&&t.getSize()<n;++c)t.appendBit(!1);const r=t.getSize()&7;if(r>0)for(let c=r;c<8;c++)t.appendBit(!1);const a=e-t.getSizeInBytes();for(let c=0;c<a;++c)t.appendBits(c&1?17:236,8);if(t.getSize()!==n)throw new st("Bits size does not equal capacity")}static getNumDataBytesAndNumECBytesForBlockID(e,t,n,r,a,c){if(r>=n)throw new st("Block ID too large");const d=e%n,g=n-d,w=Math.floor(e/n),E=w+1,A=Math.floor(t/n),I=A+1,O=w-A,L=E-I;if(O!==L)throw new st("EC bytes mismatch");if(n!==g+d)throw new st("RS blocks mismatch");if(e!==(A+O)*g+(I+L)*d)throw new st("Total bytes mismatch");r<g?(a[0]=A,c[0]=O):(a[0]=I,c[0]=L)}static interleaveWithECBytes(e,t,n,r){if(e.getSizeInBytes()!==n)throw new st("Number of bits and data bytes does not match");let a=0,c=0,d=0;const g=new Array;for(let E=0;E<r;++E){const A=new Int32Array(1),I=new Int32Array(1);ht.getNumDataBytesAndNumECBytesForBlockID(t,n,r,E,A,I);const O=A[0],L=new Uint8Array(O);e.toBytes(8*a,L,0,O);const F=ht.generateECBytes(L,I[0]);g.push(new Sg(L,F)),c=Math.max(c,O),d=Math.max(d,F.length),a+=A[0]}if(n!==a)throw new st("Data bytes does not match offset");const w=new D;for(let E=0;E<c;++E)for(const A of g){const I=A.getDataBytes();E<I.length&&w.appendBits(I[E],8)}for(let E=0;E<d;++E)for(const A of g){const I=A.getErrorCorrectionBytes();E<I.length&&w.appendBits(I[E],8)}if(t!==w.getSizeInBytes())throw new st("Interleaving error: "+t+" and "+w.getSizeInBytes()+" differ.");return w}static generateECBytes(e,t){const n=e.length,r=new Int32Array(n+t);for(let c=0;c<n;c++)r[c]=e[c]&255;new Po(Ee.QR_CODE_FIELD_256).encode(r,t);const a=new Uint8Array(t);for(let c=0;c<t;c++)a[c]=r[n+c];return a}static appendModeInfo(e,t){t.appendBits(e.getBits(),4)}static appendLengthInfo(e,t,n,r){const a=n.getCharacterCountBits(t);if(e>=1<<a)throw new st(e+" is bigger than "+((1<<a)-1));r.appendBits(e,a)}static appendBytes(e,t,n,r){switch(t){case Se.NUMERIC:ht.appendNumericBytes(e,n);break;case Se.ALPHANUMERIC:ht.appendAlphanumericBytes(e,n);break;case Se.BYTE:ht.append8BitBytes(e,n,r);break;case Se.KANJI:ht.appendKanjiBytes(e,n);break;default:throw new st("Invalid mode: "+t)}}static getDigit(e){return e.charCodeAt(0)-48}static isDigit(e){const t=ht.getDigit(e);return t>=0&&t<=9}static appendNumericBytes(e,t){const n=e.length;let r=0;for(;r<n;){const a=ht.getDigit(e.charAt(r));if(r+2<n){const c=ht.getDigit(e.charAt(r+1)),d=ht.getDigit(e.charAt(r+2));t.appendBits(a*100+c*10+d,10),r+=3}else if(r+1<n){const c=ht.getDigit(e.charAt(r+1));t.appendBits(a*10+c,7),r+=2}else t.appendBits(a,4),r++}}static appendAlphanumericBytes(e,t){const n=e.length;let r=0;for(;r<n;){const a=ht.getAlphanumericCode(e.charCodeAt(r));if(a===-1)throw new st;if(r+1<n){const c=ht.getAlphanumericCode(e.charCodeAt(r+1));if(c===-1)throw new st;t.appendBits(a*45+c,11),r+=2}else t.appendBits(a,6),r++}}static append8BitBytes(e,t,n){let r;try{r=j.encode(e,n)}catch(a){throw new st(a)}for(let a=0,c=r.length;a!==c;a++){const d=r[a];t.appendBits(d,8)}}static appendKanjiBytes(e,t){let n;try{n=j.encode(e,W.SJIS)}catch(a){throw new st(a)}const r=n.length;for(let a=0;a<r;a+=2){const c=n[a]&255,d=n[a+1]&255,g=c<<8&4294967295|d;let w=-1;if(g>=33088&&g<=40956?w=g-33088:g>=57408&&g<=60351&&(w=g-49472),w===-1)throw new st("Invalid byte sequence");const E=(w>>8)*192+(w&255);t.appendBits(E,13)}}static appendECI(e,t){t.appendBits(Se.ECI.getBits(),4),t.appendBits(e.getValue(),8)}}ht.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]),ht.DEFAULT_BYTE_MODE_ENCODING=W.UTF8.getName();class lr{write(e,t,n,r=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 a=ct.L,c=lr.QUIET_ZONE_SIZE;r!==null&&(r.get(kt.ERROR_CORRECTION)!==void 0&&(a=ct.fromString(r.get(kt.ERROR_CORRECTION).toString())),r.get(kt.MARGIN)!==void 0&&(c=Number.parseInt(r.get(kt.MARGIN).toString(),10)));const d=ht.encode(e,a,r);return this.renderResult(d,t,n,c)}writeToDom(e,t,n,r,a=null){typeof e=="string"&&(e=document.querySelector(e));const c=this.write(t,n,r,a);e&&e.appendChild(c)}renderResult(e,t,n,r){const a=e.getMatrix();if(a===null)throw new nt;const c=a.getWidth(),d=a.getHeight(),g=c+r*2,w=d+r*2,E=Math.max(t,g),A=Math.max(n,w),I=Math.min(Math.floor(E/g),Math.floor(A/w)),O=Math.floor((E-c*I)/2),L=Math.floor((A-d*I)/2),F=this.createSVGElement(E,A);for(let Z=0,ne=L;Z<d;Z++,ne+=I)for(let ce=0,ue=O;ce<c;ce++,ue+=I)if(a.get(ce,Z)===1){const ae=this.createSvgRectElement(ue,ne,I,I);F.appendChild(ae)}return F}createSVGElement(e,t){const n=document.createElementNS(lr.SVG_NS,"svg");return n.setAttributeNS(null,"height",e.toString()),n.setAttributeNS(null,"width",t.toString()),n}createSvgRectElement(e,t,n,r){const a=document.createElementNS(lr.SVG_NS,"rect");return a.setAttributeNS(null,"x",e.toString()),a.setAttributeNS(null,"y",t.toString()),a.setAttributeNS(null,"height",n.toString()),a.setAttributeNS(null,"width",r.toString()),a.setAttributeNS(null,"fill","#000000"),a}}lr.QUIET_ZONE_SIZE=4,lr.SVG_NS="http://www.w3.org/2000/svg";class Sr{encode(e,t,n,r,a){if(e.length===0)throw new y("Found empty contents");if(t!==he.QR_CODE)throw new y("Can only encode QR_CODE, but got "+t);if(n<0||r<0)throw new y(`Requested dimensions are too small: ${n}x${r}`);let c=ct.L,d=Sr.QUIET_ZONE_SIZE;a!==null&&(a.get(kt.ERROR_CORRECTION)!==void 0&&(c=ct.fromString(a.get(kt.ERROR_CORRECTION).toString())),a.get(kt.MARGIN)!==void 0&&(d=Number.parseInt(a.get(kt.MARGIN).toString(),10)));const g=ht.encode(e,c,a);return Sr.renderResult(g,n,r,d)}static renderResult(e,t,n,r){const a=e.getMatrix();if(a===null)throw new nt;const c=a.getWidth(),d=a.getHeight(),g=c+r*2,w=d+r*2,E=Math.max(t,g),A=Math.max(n,w),I=Math.min(Math.floor(E/g),Math.floor(A/w)),O=Math.floor((E-c*I)/2),L=Math.floor((A-d*I)/2),F=new X(E,A);for(let Z=0,ne=L;Z<d;Z++,ne+=I)for(let ce=0,ue=O;ce<c;ce++,ue+=I)a.get(ce,Z)===1&&F.setRegion(ue,ne,I,I);return F}}Sr.QUIET_ZONE_SIZE=4;class Ng{encode(e,t,n,r,a){let c;switch(t){case he.QR_CODE:c=new Sr;break;default:throw new y("No encoder available for format "+t)}return c.encode(e,t,n,r,a)}}class Bn extends J{constructor(e,t,n,r,a,c,d,g){if(super(c,d),this.yuvData=e,this.dataWidth=t,this.dataHeight=n,this.left=r,this.top=a,r+c>t||a+d>n)throw new y("Crop rectangle does not fit within image data.");g&&this.reverseHorizontal(c,d)}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 r=(e+this.top)*this.dataWidth+this.left;return P.arraycopy(this.yuvData,r,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,r=new Uint8ClampedArray(n);let a=this.top*this.dataWidth+this.left;if(e===this.dataWidth)return P.arraycopy(this.yuvData,a,r,0,n),r;for(let c=0;c<t;c++){const d=c*e;P.arraycopy(this.yuvData,a,r,d,e),a+=this.dataWidth}return r}isCropSupported(){return!0}crop(e,t,n,r){return new Bn(this.yuvData,this.dataWidth,this.dataHeight,this.left+e,this.top+t,n,r,!1)}renderThumbnail(){const e=this.getWidth()/Bn.THUMBNAIL_SCALE_FACTOR,t=this.getHeight()/Bn.THUMBNAIL_SCALE_FACTOR,n=new Int32Array(e*t),r=this.yuvData;let a=this.top*this.dataWidth+this.left;for(let c=0;c<t;c++){const d=c*e;for(let g=0;g<e;g++){const w=r[a+g*Bn.THUMBNAIL_SCALE_FACTOR]&255;n[d+g]=4278190080|w*65793}a+=this.dataWidth*Bn.THUMBNAIL_SCALE_FACTOR}return n}getThumbnailWidth(){return this.getWidth()/Bn.THUMBNAIL_SCALE_FACTOR}getThumbnailHeight(){return this.getHeight()/Bn.THUMBNAIL_SCALE_FACTOR}reverseHorizontal(e,t){const n=this.yuvData;for(let r=0,a=this.top*this.dataWidth+this.left;r<t;r++,a+=this.dataWidth){const c=a+e/2;for(let d=a,g=a+e-1;d<c;d++,g--){const w=n[d];n[d]=n[g],n[g]=w}}}invert(){return new q(this)}}Bn.THUMBNAIL_SCALE_FACTOR=2;class Lo extends J{constructor(e,t,n,r,a,c,d){if(super(t,n),this.dataWidth=r,this.dataHeight=a,this.left=c,this.top=d,e.BYTES_PER_ELEMENT===4){const g=t*n,w=new Uint8ClampedArray(g);for(let E=0;E<g;E++){const A=e[E],I=A>>16&255,O=A>>7&510,L=A&255;w[E]=(I+O+L)/4&255}this.luminances=w}else this.luminances=e;if(r===void 0&&(this.dataWidth=t),a===void 0&&(this.dataHeight=n),c===void 0&&(this.left=0),d===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 r=(e+this.top)*this.dataWidth+this.left;return P.arraycopy(this.luminances,r,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,r=new Uint8ClampedArray(n);let a=this.top*this.dataWidth+this.left;if(e===this.dataWidth)return P.arraycopy(this.luminances,a,r,0,n),r;for(let c=0;c<t;c++){const d=c*e;P.arraycopy(this.luminances,a,r,d,e),a+=this.dataWidth}return r}isCropSupported(){return!0}crop(e,t,n,r){return new Lo(this.luminances,n,r,this.dataWidth,this.dataHeight,this.left+e,this.top+t)}invert(){return new q(this)}}class Ya extends W{static forName(e){return this.getCharacterSetECIByName(e)}}class Fo{}Fo.ISO_8859_1=W.ISO8859_1;class $a{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 Ka{static singletonList(e){return[e]}static min(e,t){return e.sort(t)[0]}}class Tg{constructor(e){this.previous=e}getPrevious(){return this.previous}}class Nr extends Tg{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 Nr(this,e,t)}addBinaryShift(e,t){return console.warn("addBinaryShift on SimpleToken, this simply returns a copy of this token"),new Nr(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 Vo extends Nr{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 Vo(this,e,t)}toString(){return"<"+this.binaryShiftStart+"::"+(this.binaryShiftStart+this.binaryShiftByteCount-1)+">"}}function kg(b,e,t){return new Vo(b,e,t)}function $r(b,e,t){return new Nr(b,e,t)}const Rg=["UPPER","LOWER","DIGIT","MIXED","PUNCT"],Yn=0,Bi=1,mn=2,Qa=3,Mn=4,Og=new Nr(null,0,0),Uo=[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 Bg(b){for(let e of b)B.fill(e,-1);return b[Yn][Mn]=0,b[Bi][Mn]=0,b[Bi][Yn]=28,b[Qa][Mn]=0,b[mn][Mn]=0,b[mn][Yn]=15,b}const Ja=Bg(B.createInt32Array(6,6));class vn{constructor(e,t,n,r){this.token=e,this.mode=t,this.binaryShiftByteCount=n,this.bitCount=r}getMode(){return this.mode}getToken(){return this.token}getBinaryShiftByteCount(){return this.binaryShiftByteCount}getBitCount(){return this.bitCount}latchAndAppend(e,t){let n=this.bitCount,r=this.token;if(e!==this.mode){let c=Uo[this.mode][e];r=$r(r,c&65535,c>>16),n+=c>>16}let a=e===mn?4:5;return r=$r(r,t,a),new vn(r,e,0,n+a)}shiftAndAppend(e,t){let n=this.token,r=this.mode===mn?4:5;return n=$r(n,Ja[this.mode][e],r),n=$r(n,t,5),new vn(n,this.mode,0,this.bitCount+r+5)}addBinaryShiftChar(e){let t=this.token,n=this.mode,r=this.bitCount;if(this.mode===Mn||this.mode===mn){let d=Uo[n][Yn];t=$r(t,d&65535,d>>16),r+=d>>16,n=Yn}let a=this.binaryShiftByteCount===0||this.binaryShiftByteCount===31?18:this.binaryShiftByteCount===62?9:8,c=new vn(t,n,this.binaryShiftByteCount+1,r+a);return c.binaryShiftByteCount===2078&&(c=c.endBinaryShift(e+1)),c}endBinaryShift(e){if(this.binaryShiftByteCount===0)return this;let t=this.token;return t=kg(t,e-this.binaryShiftByteCount,this.binaryShiftByteCount),new vn(t,this.mode,0,this.bitCount)}isBetterThanOrEqualTo(e){let t=this.bitCount+(Uo[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 r=this.endBinaryShift(e.length).token;r!==null;r=r.getPrevious())t.unshift(r);let n=new D;for(const r of t)r.appendTo(n,e);return n}toString(){return G.format("%s bits=%d bytes=%d",Rg[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(Og,Yn,0,0);function Mg(b){const e=G.getCharCode(" "),t=G.getCharCode("."),n=G.getCharCode(",");b[Yn][e]=1;const r=G.getCharCode("Z"),a=G.getCharCode("A");for(let I=a;I<=r;I++)b[Yn][I]=I-a+2;b[Bi][e]=1;const c=G.getCharCode("z"),d=G.getCharCode("a");for(let I=d;I<=c;I++)b[Bi][I]=I-d+2;b[mn][e]=1;const g=G.getCharCode("9"),w=G.getCharCode("0");for(let I=w;I<=g;I++)b[mn][I]=I-w+2;b[mn][n]=12,b[mn][t]=13;const E=["\0"," ","","","","","","","\x07","\b"," ",`
|
|
29
|
+
`,"\v","\f","\r","\x1B","","","","","@","\\","^","_","`","|","~",""];for(let I=0;I<E.length;I++)b[Qa][G.getCharCode(E[I])]=I;const A=["\0","\r","\0","\0","\0","\0","!","'","#","$","%","&","'","(",")","*","+",",","-",".","/",":",";","<","=",">","?","[","]","{","}"];for(let I=0;I<A.length;I++)G.getCharCode(A[I])>0&&(b[Mn][G.getCharCode(A[I])]=I);return b}const zo=Mg(B.createInt32Array(5,256));class Kr{constructor(e){this.text=e}encode(){const e=G.getCharCode(" "),t=G.getCharCode(`
|
|
30
|
+
`);let n=Ka.singletonList(vn.INITIAL_STATE);for(let a=0;a<this.text.length;a++){let c,d=a+1<this.text.length?this.text[a+1]:0;switch(this.text[a]){case G.getCharCode("\r"):c=d===t?2:0;break;case G.getCharCode("."):c=d===e?3:0;break;case G.getCharCode(","):c=d===e?4:0;break;case G.getCharCode(":"):c=d===e?5:0;break;default:c=0}c>0?(n=Kr.updateStateListForPair(n,a,c),a++):n=this.updateStateListForChar(n,a)}return Ka.min(n,(a,c)=>a.getBitCount()-c.getBitCount()).toBitArray(this.text)}updateStateListForChar(e,t){const n=[];for(let r of e)this.updateStateForChar(r,t,n);return Kr.simplifyStates(n)}updateStateForChar(e,t,n){let r=this.text[t]&255,a=zo[e.getMode()][r]>0,c=null;for(let d=0;d<=Mn;d++){let g=zo[d][r];if(g>0){if(c==null&&(c=e.endBinaryShift(t)),!a||d===e.getMode()||d===mn){const w=c.latchAndAppend(d,g);n.push(w)}if(!a&&Ja[e.getMode()][d]>=0){const w=c.shiftAndAppend(d,g);n.push(w)}}}if(e.getBinaryShiftByteCount()>0||zo[e.getMode()][r]===0){let d=e.addBinaryShiftChar(t);n.push(d)}}static updateStateListForPair(e,t,n){const r=[];for(let a of e)this.updateStateForPair(a,t,n,r);return this.simplifyStates(r)}static updateStateForPair(e,t,n,r){let a=e.endBinaryShift(t);if(r.push(a.latchAndAppend(Mn,n)),e.getMode()!==Mn&&r.push(a.shiftAndAppend(Mn,n)),n===3||n===4){let c=a.latchAndAppend(mn,16-n).latchAndAppend(mn,1);r.push(c)}if(e.getBinaryShiftByteCount()>0){let c=e.addBinaryShiftChar(t).addBinaryShiftChar(t+1);r.push(c)}}static simplifyStates(e){let t=[];for(const n of e){let r=!0;for(const a of t){if(a.isBetterThanOrEqualTo(n)){r=!1;break}n.isBetterThanOrEqualTo(a)&&(t=t.filter(c=>c!==a))}r&&t.push(n)}return t}}class $e{constructor(){}static encodeBytes(e){return $e.encode(e,$e.DEFAULT_EC_PERCENT,$e.DEFAULT_AZTEC_LAYERS)}static encode(e,t,n){let r=new Kr(e).encode(),a=R.truncDivision(r.getSize()*t,100)+11,c=r.getSize()+a,d,g,w,E,A;if(n!==$e.DEFAULT_AZTEC_LAYERS){if(d=n<0,g=Math.abs(n),g>(d?$e.MAX_NB_BITS_COMPACT:$e.MAX_NB_BITS))throw new y(G.format("Illegal value %s for layers",n));w=$e.totalBitsInLayer(g,d),E=$e.WORD_SIZE[g];let ae=w-w%E;if(A=$e.stuffBits(r,E),A.getSize()+a>ae)throw new y("Data to large for user specified layer");if(d&&A.getSize()>E*64)throw new y("Data to large for user specified layer")}else{E=0,A=null;for(let ae=0;;ae++){if(ae>$e.MAX_NB_BITS)throw new y("Data too large for an Aztec code");if(d=ae<=3,g=d?ae+1:ae,w=$e.totalBitsInLayer(g,d),c>w)continue;(A==null||E!==$e.WORD_SIZE[g])&&(E=$e.WORD_SIZE[g],A=$e.stuffBits(r,E));let Ge=w-w%E;if(!(d&&A.getSize()>E*64)&&A.getSize()+a<=Ge)break}}let I=$e.generateCheckWords(A,w,E),O=A.getSize()/E,L=$e.generateModeMessage(d,g,O),F=(d?11:14)+g*4,Z=new Int32Array(F),ne;if(d){ne=F;for(let ae=0;ae<Z.length;ae++)Z[ae]=ae}else{ne=F+1+2*R.truncDivision(R.truncDivision(F,2)-1,15);let ae=R.truncDivision(F,2),Ge=R.truncDivision(ne,2);for(let ve=0;ve<ae;ve++){let nn=ve+R.truncDivision(ve,15);Z[ae-ve-1]=Ge-nn-1,Z[ae+ve]=Ge+nn+1}}let ce=new X(ne);for(let ae=0,Ge=0;ae<g;ae++){let ve=(g-ae)*4+(d?9:12);for(let nn=0;nn<ve;nn++){let An=nn*2;for(let rn=0;rn<2;rn++)I.get(Ge+An+rn)&&ce.set(Z[ae*2+rn],Z[ae*2+nn]),I.get(Ge+ve*2+An+rn)&&ce.set(Z[ae*2+nn],Z[F-1-ae*2-rn]),I.get(Ge+ve*4+An+rn)&&ce.set(Z[F-1-ae*2-rn],Z[F-1-ae*2-nn]),I.get(Ge+ve*6+An+rn)&&ce.set(Z[F-1-ae*2-nn],Z[ae*2+rn])}Ge+=ve*8}if($e.drawModeMessage(ce,d,ne,L),d)$e.drawBullsEye(ce,R.truncDivision(ne,2),5);else{$e.drawBullsEye(ce,R.truncDivision(ne,2),7);for(let ae=0,Ge=0;ae<R.truncDivision(F,2)-1;ae+=15,Ge+=16)for(let ve=R.truncDivision(ne,2)&1;ve<ne;ve+=2)ce.set(R.truncDivision(ne,2)-Ge,ve),ce.set(R.truncDivision(ne,2)+Ge,ve),ce.set(ve,R.truncDivision(ne,2)-Ge),ce.set(ve,R.truncDivision(ne,2)+Ge)}let ue=new $a;return ue.setCompact(d),ue.setSize(ne),ue.setLayers(g),ue.setCodeWords(O),ue.setMatrix(ce),ue}static drawBullsEye(e,t,n){for(let r=0;r<n;r+=2)for(let a=t-r;a<=t+r;a++)e.set(a,t-r),e.set(a,t+r),e.set(t-r,a),e.set(t+r,a);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 r=new D;return e?(r.appendBits(t-1,2),r.appendBits(n-1,6),r=$e.generateCheckWords(r,28,4)):(r.appendBits(t-1,5),r.appendBits(n-1,11),r=$e.generateCheckWords(r,40,4)),r}static drawModeMessage(e,t,n,r){let a=R.truncDivision(n,2);if(t)for(let c=0;c<7;c++){let d=a-3+c;r.get(c)&&e.set(d,a-5),r.get(c+7)&&e.set(a+5,d),r.get(20-c)&&e.set(d,a+5),r.get(27-c)&&e.set(a-5,d)}else for(let c=0;c<10;c++){let d=a-5+c+R.truncDivision(c,5);r.get(c)&&e.set(d,a-7),r.get(c+10)&&e.set(a+7,d),r.get(29-c)&&e.set(d,a+7),r.get(39-c)&&e.set(a-7,d)}}static generateCheckWords(e,t,n){let r=e.getSize()/n,a=new Po($e.getGF(n)),c=R.truncDivision(t,n),d=$e.bitsToWords(e,n,c);a.encode(d,c-r);let g=t%n,w=new D;w.appendBits(0,g);for(const E of Array.from(d))w.appendBits(E,n);return w}static bitsToWords(e,t,n){let r=new Int32Array(n),a,c;for(a=0,c=e.getSize()/t;a<c;a++){let d=0;for(let g=0;g<t;g++)d|=e.get(a*t+g)?1<<t-g-1:0;r[a]=d}return r}static getGF(e){switch(e){case 4:return Ee.AZTEC_PARAM;case 6:return Ee.AZTEC_DATA_6;case 8:return Ee.AZTEC_DATA_8;case 10:return Ee.AZTEC_DATA_10;case 12:return Ee.AZTEC_DATA_12;default:throw new y("Unsupported word size "+e)}}static stuffBits(e,t){let n=new D,r=e.getSize(),a=(1<<t)-2;for(let c=0;c<r;c+=t){let d=0;for(let g=0;g<t;g++)(c+g>=r||e.get(c+g))&&(d|=1<<t-1-g);(d&a)===a?(n.appendBits(d&a,t),c--):d&a?n.appendBits(d,t):(n.appendBits(d|1,t),c--)}return n}static totalBitsInLayer(e,t){return((t?88:112)+16*e)*e}}$e.DEFAULT_EC_PERCENT=33,$e.DEFAULT_AZTEC_LAYERS=0,$e.MAX_NB_BITS=32,$e.MAX_NB_BITS_COMPACT=4,$e.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 Mi{encode(e,t,n,r){return this.encodeWithHints(e,t,n,r,null)}encodeWithHints(e,t,n,r,a){let c=Fo.ISO_8859_1,d=$e.DEFAULT_EC_PERCENT,g=$e.DEFAULT_AZTEC_LAYERS;return a!=null&&(a.has(kt.CHARACTER_SET)&&(c=Ya.forName(a.get(kt.CHARACTER_SET).toString())),a.has(kt.ERROR_CORRECTION)&&(d=R.parseInt(a.get(kt.ERROR_CORRECTION).toString())),a.has(kt.AZTEC_LAYERS)&&(g=R.parseInt(a.get(kt.AZTEC_LAYERS).toString()))),Mi.encodeLayers(e,t,n,r,c,d,g)}static encodeLayers(e,t,n,r,a,c,d){if(t!==he.AZTEC)throw new y("Can only encode AZTEC, but got "+t);let g=$e.encode(G.getBytes(e,a),c,d);return Mi.renderResult(g,n,r)}static renderResult(e,t,n){let r=e.getMatrix();if(r==null)throw new nt;let a=r.getWidth(),c=r.getHeight(),d=Math.max(t,a),g=Math.max(n,c),w=Math.min(d/a,g/c),E=(d-a*w)/2,A=(g-c*w)/2,I=new X(d,g);for(let O=0,L=A;O<c;O++,L+=w)for(let F=0,Z=E;F<a;F++,Z+=w)r.get(F,O)&&I.setRegion(Z,L,w,w);return I}}i.AbstractExpandedDecoder=So,i.ArgumentException=C,i.ArithmeticException=Ze,i.AztecCode=$a,i.AztecCodeReader=le,i.AztecCodeWriter=Mi,i.AztecDecoder=ze,i.AztecDetector=be,i.AztecDetectorResult=bi,i.AztecEncoder=$e,i.AztecHighLevelEncoder=Kr,i.AztecPoint=Ot,i.BarcodeFormat=he,i.Binarizer=k,i.BinaryBitmap=S,i.BitArray=D,i.BitMatrix=X,i.BitSource=Ro,i.BrowserAztecCodeReader=Qe,i.BrowserBarcodeReader=ug,i.BrowserCodeReader=Ne,i.BrowserDatamatrixCodeReader=fg,i.BrowserMultiFormatReader=bg,i.BrowserPDF417Reader=Ag,i.BrowserQRCodeReader=Ig,i.BrowserQRCodeSvgWriter=lr,i.CharacterSetECI=W,i.ChecksumException=M,i.Code128Reader=de,i.Code39Reader=ft,i.DataMatrixDecodedBitStreamParser=Xn,i.DataMatrixReader=jn,i.DecodeHintType=te,i.DecoderResult=Oe,i.DefaultGridSampler=Ai,i.DetectorResult=Er,i.EAN13Reader=yt,i.EncodeHintType=kt,i.Exception=p,i.FormatException=z,i.GenericGF=Ee,i.GenericGFPoly=me,i.GlobalHistogramBinarizer=$,i.GridSampler=rr,i.GridSamplerInstance=dn,i.HTMLCanvasElementLuminanceSource=re,i.HybridBinarizer=H,i.ITFReader=Ye,i.IllegalArgumentException=y,i.IllegalStateException=nt,i.InvertedLuminanceSource=q,i.LuminanceSource=J,i.MathUtils=He,i.MultiFormatOneDReader=Ar,i.MultiFormatReader=Za,i.MultiFormatWriter=Ng,i.NotFoundException=N,i.OneDReader=Ke,i.PDF417DecodedBitStreamParser=ee,i.PDF417DecoderErrorCorrection=Ha,i.PDF417Reader=Vt,i.PDF417ResultMetadata=Wa,i.PerspectiveTransform=Dt,i.PlanarYUVLuminanceSource=Bn,i.QRCodeByteMatrix=Oi,i.QRCodeDataMask=hn,i.QRCodeDecodedBitStreamParser=wt,i.QRCodeDecoderErrorCorrectionLevel=ct,i.QRCodeDecoderFormatInformation=Gt,i.QRCodeEncoder=ht,i.QRCodeEncoderQRCode=ar,i.QRCodeMaskUtil=Et,i.QRCodeMatrixUtil=Te,i.QRCodeMode=Se,i.QRCodeReader=qn,i.QRCodeVersion=Ie,i.QRCodeWriter=Sr,i.RGBLuminanceSource=Lo,i.RSS14Reader=Ct,i.RSSExpandedReader=oe,i.ReaderException=Ri,i.ReedSolomonDecoder=jt,i.ReedSolomonEncoder=Po,i.ReedSolomonException=mt,i.Result=_e,i.ResultMetadataType=Xe,i.ResultPoint=ye,i.StringUtils=G,i.UnsupportedOperationException=se,i.VideoInputDevice=ge,i.WhiteRectangleDetector=bn,i.WriterException=st,i.ZXingArrays=B,i.ZXingCharset=Ya,i.ZXingInteger=R,i.ZXingStandardCharsets=Fo,i.ZXingStringBuilder=V,i.ZXingStringEncoding=j,i.ZXingSystem=P,i.createAbstractExpandedDecoder=Ua,Object.defineProperty(i,"__esModule",{value:!0})})})(wo,wo.exports);var ut=wo.exports;const Xh=rl({__proto__:null,default:Ys(ut)},[ut]);var _a=function(){function o(s,i,u){if(this.formatMap=new Map([[pe.QR_CODE,ut.BarcodeFormat.QR_CODE],[pe.AZTEC,ut.BarcodeFormat.AZTEC],[pe.CODABAR,ut.BarcodeFormat.CODABAR],[pe.CODE_39,ut.BarcodeFormat.CODE_39],[pe.CODE_93,ut.BarcodeFormat.CODE_93],[pe.CODE_128,ut.BarcodeFormat.CODE_128],[pe.DATA_MATRIX,ut.BarcodeFormat.DATA_MATRIX],[pe.MAXICODE,ut.BarcodeFormat.MAXICODE],[pe.ITF,ut.BarcodeFormat.ITF],[pe.EAN_13,ut.BarcodeFormat.EAN_13],[pe.EAN_8,ut.BarcodeFormat.EAN_8],[pe.PDF_417,ut.BarcodeFormat.PDF_417],[pe.RSS_14,ut.BarcodeFormat.RSS_14],[pe.RSS_EXPANDED,ut.BarcodeFormat.RSS_EXPANDED],[pe.UPC_A,ut.BarcodeFormat.UPC_A],[pe.UPC_E,ut.BarcodeFormat.UPC_E],[pe.UPC_EAN_EXTENSION,ut.BarcodeFormat.UPC_EAN_EXTENSION]]),this.reverseFormatMap=this.createReverseFormatMap(),!Xh)throw"Use html5qrcode.min.js without edit, ZXing not found.";this.verbose=i,this.logger=u;var f=this.createZXingFormats(s),h=new Map;h.set(ut.DecodeHintType.POSSIBLE_FORMATS,f),h.set(ut.DecodeHintType.TRY_HARDER,!1),this.hints=h}return o.prototype.decodeAsync=function(s){var i=this;return new Promise(function(u,f){try{u(i.decode(s))}catch(h){f(h)}})},o.prototype.decode=function(s){var i=new ut.MultiFormatReader(this.verbose,this.hints),u=new ut.HTMLCanvasElementLuminanceSource(s),f=new ut.BinaryBitmap(new ut.HybridBinarizer(u)),h=i.decode(f);return{text:h.text,format:pa.create(this.toHtml5QrcodeSupportedFormats(h.format)),debugData:this.createDebugData()}},o.prototype.createReverseFormatMap=function(){var s=new Map;return this.formatMap.forEach(function(i,u,f){s.set(i,u)}),s},o.prototype.toHtml5QrcodeSupportedFormats=function(s){if(!this.reverseFormatMap.has(s))throw"reverseFormatMap doesn't have ".concat(s);return this.reverseFormatMap.get(s)},o.prototype.createZXingFormats=function(s){for(var i=[],u=0,f=s;u<f.length;u++){var h=f[u];this.formatMap.has(h)?i.push(this.formatMap.get(h)):this.logger.logError("".concat(h," is not supported by")+"ZXingHtml5QrcodeShim")}return i},o.prototype.createDebugData=function(){return{decoderName:"zxing-js"}},o}(),jh=function(o,s,i,u){function f(h){return h instanceof i?h:new i(function(m){m(h)})}return new(i||(i=Promise))(function(h,m){function x(C){try{p(u.next(C))}catch(y){m(y)}}function _(C){try{p(u.throw(C))}catch(y){m(y)}}function p(C){C.done?h(C.value):f(C.value).then(x,_)}p((u=u.apply(o,s||[])).next())})},qh=function(o,s){var i={label:0,sent:function(){if(h[0]&1)throw h[1];return h[1]},trys:[],ops:[]},u,f,h,m;return m={next:x(0),throw:x(1),return:x(2)},typeof Symbol=="function"&&(m[Symbol.iterator]=function(){return this}),m;function x(p){return function(C){return _([p,C])}}function _(p){if(u)throw new TypeError("Generator is already executing.");for(;m&&(m=0,p[0]&&(i=0)),i;)try{if(u=1,f&&(h=p[0]&2?f.return:p[0]?f.throw||((h=f.return)&&h.call(f),0):f.next)&&!(h=h.call(f,p[1])).done)return h;switch(f=0,h&&(p=[p[0]&2,h.value]),p[0]){case 0:case 1:h=p;break;case 4:return i.label++,{value:p[1],done:!1};case 5:i.label++,f=p[1],p=[0];continue;case 7:p=i.ops.pop(),i.trys.pop();continue;default:if(h=i.trys,!(h=h.length>0&&h[h.length-1])&&(p[0]===6||p[0]===2)){i=0;continue}if(p[0]===3&&(!h||p[1]>h[0]&&p[1]<h[3])){i.label=p[1];break}if(p[0]===6&&i.label<h[1]){i.label=h[1],h=p;break}if(h&&i.label<h[2]){i.label=h[2],i.ops.push(p);break}h[2]&&i.ops.pop(),i.trys.pop();continue}p=s.call(o,i)}catch(C){p=[6,C],f=0}finally{u=h=0}if(p[0]&5)throw p[1];return{value:p[0]?p[1]:void 0,done:!0}}},Ca=function(){function o(s,i,u){if(this.formatMap=new Map([[pe.QR_CODE,"qr_code"],[pe.AZTEC,"aztec"],[pe.CODABAR,"codabar"],[pe.CODE_39,"code_39"],[pe.CODE_93,"code_93"],[pe.CODE_128,"code_128"],[pe.DATA_MATRIX,"data_matrix"],[pe.ITF,"itf"],[pe.EAN_13,"ean_13"],[pe.EAN_8,"ean_8"],[pe.PDF_417,"pdf417"],[pe.UPC_A,"upc_a"],[pe.UPC_E,"upc_e"]]),this.reverseFormatMap=this.createReverseFormatMap(),!o.isSupported())throw"Use html5qrcode.min.js without edit, Use BarcodeDetectorDelegate only if it isSupported();";this.verbose=i,this.logger=u;var f=this.createBarcodeDetectorFormats(s);if(this.detector=new BarcodeDetector(f),!this.detector)throw"BarcodeDetector detector not supported"}return o.isSupported=function(){if(!("BarcodeDetector"in window))return!1;var s=new BarcodeDetector({formats:["qr_code"]});return typeof s<"u"},o.prototype.decodeAsync=function(s){return jh(this,void 0,void 0,function(){var i,u;return qh(this,function(f){switch(f.label){case 0:return[4,this.detector.detect(s)];case 1:if(i=f.sent(),!i||i.length===0)throw"No barcode or QR code detected.";return u=this.selectLargestBarcode(i),[2,{text:u.rawValue,format:pa.create(this.toHtml5QrcodeSupportedFormats(u.format)),debugData:this.createDebugData()}]}})})},o.prototype.selectLargestBarcode=function(s){for(var i=null,u=0,f=0,h=s;f<h.length;f++){var m=h[f],x=m.boundingBox.width*m.boundingBox.height;x>u&&(u=x,i=m)}if(!i)throw"No largest barcode found";return i},o.prototype.createBarcodeDetectorFormats=function(s){for(var i=[],u=0,f=s;u<f.length;u++){var h=f[u];this.formatMap.has(h)?i.push(this.formatMap.get(h)):this.logger.warn("".concat(h," is not supported by")+"BarcodeDetectorDelegate")}return{formats:i}},o.prototype.toHtml5QrcodeSupportedFormats=function(s){if(!this.reverseFormatMap.has(s))throw"reverseFormatMap doesn't have ".concat(s);return this.reverseFormatMap.get(s)},o.prototype.createReverseFormatMap=function(){var s=new Map;return this.formatMap.forEach(function(i,u,f){s.set(i,u)}),s},o.prototype.createDebugData=function(){return{decoderName:"BarcodeDetector"}},o}(),Ea=function(o,s,i,u){function f(h){return h instanceof i?h:new i(function(m){m(h)})}return new(i||(i=Promise))(function(h,m){function x(C){try{p(u.next(C))}catch(y){m(y)}}function _(C){try{p(u.throw(C))}catch(y){m(y)}}function p(C){C.done?h(C.value):f(C.value).then(x,_)}p((u=u.apply(o,s||[])).next())})},ya=function(o,s){var i={label:0,sent:function(){if(h[0]&1)throw h[1];return h[1]},trys:[],ops:[]},u,f,h,m;return m={next:x(0),throw:x(1),return:x(2)},typeof Symbol=="function"&&(m[Symbol.iterator]=function(){return this}),m;function x(p){return function(C){return _([p,C])}}function _(p){if(u)throw new TypeError("Generator is already executing.");for(;m&&(m=0,p[0]&&(i=0)),i;)try{if(u=1,f&&(h=p[0]&2?f.return:p[0]?f.throw||((h=f.return)&&h.call(f),0):f.next)&&!(h=h.call(f,p[1])).done)return h;switch(f=0,h&&(p=[p[0]&2,h.value]),p[0]){case 0:case 1:h=p;break;case 4:return i.label++,{value:p[1],done:!1};case 5:i.label++,f=p[1],p=[0];continue;case 7:p=i.ops.pop(),i.trys.pop();continue;default:if(h=i.trys,!(h=h.length>0&&h[h.length-1])&&(p[0]===6||p[0]===2)){i=0;continue}if(p[0]===3&&(!h||p[1]>h[0]&&p[1]<h[3])){i.label=p[1];break}if(p[0]===6&&i.label<h[1]){i.label=h[1],h=p;break}if(h&&i.label<h[2]){i.label=h[2],i.ops.push(p);break}h[2]&&i.ops.pop(),i.trys.pop();continue}p=s.call(o,i)}catch(C){p=[6,C],f=0}finally{u=h=0}if(p[0]&5)throw p[1];return{value:p[0]?p[1]:void 0,done:!0}}},Zh=function(){function o(s,i,u,f){this.EXECUTIONS_TO_REPORT_PERFORMANCE=100,this.executions=0,this.executionResults=[],this.wasPrimaryDecoderUsedInLastDecode=!1,this.verbose=u,i&&Ca.isSupported()?(this.primaryDecoder=new Ca(s,u,f),this.secondaryDecoder=new _a(s,u,f)):this.primaryDecoder=new _a(s,u,f)}return o.prototype.decodeAsync=function(s){return Ea(this,void 0,void 0,function(){var i;return ya(this,function(u){switch(u.label){case 0:i=performance.now(),u.label=1;case 1:return u.trys.push([1,,3,4]),[4,this.getDecoder().decodeAsync(s)];case 2:return[2,u.sent()];case 3:return this.possiblyLogPerformance(i),[7];case 4:return[2]}})})},o.prototype.decodeRobustlyAsync=function(s){return Ea(this,void 0,void 0,function(){var i,u;return ya(this,function(f){switch(f.label){case 0:i=performance.now(),f.label=1;case 1:return f.trys.push([1,3,4,5]),[4,this.primaryDecoder.decodeAsync(s)];case 2:return[2,f.sent()];case 3:if(u=f.sent(),this.secondaryDecoder)return[2,this.secondaryDecoder.decodeAsync(s)];throw u;case 4:return this.possiblyLogPerformance(i),[7];case 5:return[2]}})})},o.prototype.getDecoder=function(){return this.secondaryDecoder?this.wasPrimaryDecoderUsedInLastDecode===!1?(this.wasPrimaryDecoderUsedInLastDecode=!0,this.primaryDecoder):(this.wasPrimaryDecoderUsedInLastDecode=!1,this.secondaryDecoder):this.primaryDecoder},o.prototype.possiblyLogPerformance=function(s){if(this.verbose){var i=performance.now()-s;this.executionResults.push(i),this.executions++,this.possiblyFlushPerformanceReport()}},o.prototype.possiblyFlushPerformanceReport=function(){if(!(this.executions<this.EXECUTIONS_TO_REPORT_PERFORMANCE)){for(var s=0,i=0,u=this.executionResults;i<u.length;i++){var f=u[i];s+=f}var h=s/this.executionResults.length;console.log("".concat(h," ms for ").concat(this.executionResults.length," last runs.")),this.executions=0,this.executionResults=[]}},o}(),_o=function(){var o=function(s,i){return o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,f){u.__proto__=f}||function(u,f){for(var h in f)Object.prototype.hasOwnProperty.call(f,h)&&(u[h]=f[h])},o(s,i)};return function(s,i){if(typeof i!="function"&&i!==null)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");o(s,i);function u(){this.constructor=s}s.prototype=i===null?Object.create(i):(u.prototype=i.prototype,new u)}}(),wi=function(o,s,i,u){function f(h){return h instanceof i?h:new i(function(m){m(h)})}return new(i||(i=Promise))(function(h,m){function x(C){try{p(u.next(C))}catch(y){m(y)}}function _(C){try{p(u.throw(C))}catch(y){m(y)}}function p(C){C.done?h(C.value):f(C.value).then(x,_)}p((u=u.apply(o,s||[])).next())})},_i=function(o,s){var i={label:0,sent:function(){if(h[0]&1)throw h[1];return h[1]},trys:[],ops:[]},u,f,h,m;return m={next:x(0),throw:x(1),return:x(2)},typeof Symbol=="function"&&(m[Symbol.iterator]=function(){return this}),m;function x(p){return function(C){return _([p,C])}}function _(p){if(u)throw new TypeError("Generator is already executing.");for(;m&&(m=0,p[0]&&(i=0)),i;)try{if(u=1,f&&(h=p[0]&2?f.return:p[0]?f.throw||((h=f.return)&&h.call(f),0):f.next)&&!(h=h.call(f,p[1])).done)return h;switch(f=0,h&&(p=[p[0]&2,h.value]),p[0]){case 0:case 1:h=p;break;case 4:return i.label++,{value:p[1],done:!1};case 5:i.label++,f=p[1],p=[0];continue;case 7:p=i.ops.pop(),i.trys.pop();continue;default:if(h=i.trys,!(h=h.length>0&&h[h.length-1])&&(p[0]===6||p[0]===2)){i=0;continue}if(p[0]===3&&(!h||p[1]>h[0]&&p[1]<h[3])){i.label=p[1];break}if(p[0]===6&&i.label<h[1]){i.label=h[1],h=p;break}if(h&&i.label<h[2]){i.label=h[2],i.ops.push(p);break}h[2]&&i.ops.pop(),i.trys.pop();continue}p=s.call(o,i)}catch(C){p=[6,C],f=0}finally{u=h=0}if(p[0]&5)throw p[1];return{value:p[0]?p[1]:void 0,done:!0}}},ba=function(){function o(s,i){this.name=s,this.track=i}return o.prototype.isSupported=function(){return this.track.getCapabilities?this.name in this.track.getCapabilities():!1},o.prototype.apply=function(s){var i={};i[this.name]=s;var u={advanced:[i]};return this.track.applyConstraints(u)},o.prototype.value=function(){var s=this.track.getSettings();if(this.name in s){var i=s[this.name];return i}return null},o}(),Yh=function(o){_o(s,o);function s(i,u){return o.call(this,i,u)||this}return s.prototype.min=function(){return this.getCapabilities().min},s.prototype.max=function(){return this.getCapabilities().max},s.prototype.step=function(){return this.getCapabilities().step},s.prototype.apply=function(i){var u={};u[this.name]=i;var f={advanced:[u]};return this.track.applyConstraints(f)},s.prototype.getCapabilities=function(){this.failIfNotSupported();var i=this.track.getCapabilities(),u=i[this.name];return{min:u.min,max:u.max,step:u.step}},s.prototype.failIfNotSupported=function(){if(!this.isSupported())throw new Error("".concat(this.name," capability not supported"))},s}(ba),$h=function(o){_o(s,o);function s(i){return o.call(this,"zoom",i)||this}return s}(Yh),Kh=function(o){_o(s,o);function s(i){return o.call(this,"torch",i)||this}return s}(ba),Qh=function(){function o(s){this.track=s}return o.prototype.zoomFeature=function(){return new $h(this.track)},o.prototype.torchFeature=function(){return new Kh(this.track)},o}(),Jh=function(){function o(s,i,u){this.isClosed=!1,this.parentElement=s,this.mediaStream=i,this.callbacks=u,this.surface=this.createVideoElement(this.parentElement.clientWidth),s.append(this.surface)}return o.prototype.createVideoElement=function(s){var i=document.createElement("video");return i.style.width="".concat(s,"px"),i.style.display="block",i.muted=!0,i.setAttribute("muted","true"),i.playsInline=!0,i},o.prototype.setupSurface=function(){var s=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 u=s.surface.clientWidth,f=s.surface.clientHeight;s.callbacks.onRenderSurfaceReady(u,f),s.surface.removeEventListener("playing",i)};this.surface.addEventListener("playing",i),this.surface.srcObject=this.mediaStream,this.surface.play()},o.create=function(s,i,u,f){return wi(this,void 0,void 0,function(){var h,m;return _i(this,function(x){switch(x.label){case 0:return h=new o(s,i,f),u.aspectRatio?(m={aspectRatio:u.aspectRatio},[4,h.getFirstTrackOrFail().applyConstraints(m)]):[3,2];case 1:x.sent(),x.label=2;case 2:return h.setupSurface(),[2,h]}})})},o.prototype.failIfClosed=function(){if(this.isClosed)throw"The RenderedCamera has already been closed."},o.prototype.getFirstTrackOrFail=function(){if(this.failIfClosed(),this.mediaStream.getVideoTracks().length===0)throw"No video tracks found";return this.mediaStream.getVideoTracks()[0]},o.prototype.pause=function(){this.failIfClosed(),this.surface.pause()},o.prototype.resume=function(s){this.failIfClosed();var i=this,u=function(){setTimeout(s,200),i.surface.removeEventListener("playing",u)};this.surface.addEventListener("playing",u),this.surface.play()},o.prototype.isPaused=function(){return this.failIfClosed(),this.surface.paused},o.prototype.getSurface=function(){return this.failIfClosed(),this.surface},o.prototype.getRunningTrackCapabilities=function(){return this.getFirstTrackOrFail().getCapabilities()},o.prototype.getRunningTrackSettings=function(){return this.getFirstTrackOrFail().getSettings()},o.prototype.applyVideoConstraints=function(s){return wi(this,void 0,void 0,function(){return _i(this,function(i){if("aspectRatio"in s)throw"Changing 'aspectRatio' in run-time is not yet supported.";return[2,this.getFirstTrackOrFail().applyConstraints(s)]})})},o.prototype.close=function(){if(this.isClosed)return Promise.resolve();var s=this;return new Promise(function(i,u){var f=s.mediaStream.getVideoTracks(),h=f.length,m=0;s.mediaStream.getVideoTracks().forEach(function(x){s.mediaStream.removeTrack(x),x.stop(),++m,m>=h&&(s.isClosed=!0,s.parentElement.removeChild(s.surface),i())})})},o.prototype.getCapabilities=function(){return new Qh(this.getFirstTrackOrFail())},o}(),e2=function(){function o(s){this.mediaStream=s}return o.prototype.render=function(s,i,u){return wi(this,void 0,void 0,function(){return _i(this,function(f){return[2,Jh.create(s,this.mediaStream,i,u)]})})},o.create=function(s){return wi(this,void 0,void 0,function(){var i,u;return _i(this,function(f){switch(f.label){case 0:if(!navigator.mediaDevices)throw"navigator.mediaDevices not supported";return i={audio:!1,video:s},[4,navigator.mediaDevices.getUserMedia(i)];case 1:return u=f.sent(),[2,new o(u)]}})})},o}(),Aa=function(o,s,i,u){function f(h){return h instanceof i?h:new i(function(m){m(h)})}return new(i||(i=Promise))(function(h,m){function x(C){try{p(u.next(C))}catch(y){m(y)}}function _(C){try{p(u.throw(C))}catch(y){m(y)}}function p(C){C.done?h(C.value):f(C.value).then(x,_)}p((u=u.apply(o,s||[])).next())})},Ia=function(o,s){var i={label:0,sent:function(){if(h[0]&1)throw h[1];return h[1]},trys:[],ops:[]},u,f,h,m;return m={next:x(0),throw:x(1),return:x(2)},typeof Symbol=="function"&&(m[Symbol.iterator]=function(){return this}),m;function x(p){return function(C){return _([p,C])}}function _(p){if(u)throw new TypeError("Generator is already executing.");for(;m&&(m=0,p[0]&&(i=0)),i;)try{if(u=1,f&&(h=p[0]&2?f.return:p[0]?f.throw||((h=f.return)&&h.call(f),0):f.next)&&!(h=h.call(f,p[1])).done)return h;switch(f=0,h&&(p=[p[0]&2,h.value]),p[0]){case 0:case 1:h=p;break;case 4:return i.label++,{value:p[1],done:!1};case 5:i.label++,f=p[1],p=[0];continue;case 7:p=i.ops.pop(),i.trys.pop();continue;default:if(h=i.trys,!(h=h.length>0&&h[h.length-1])&&(p[0]===6||p[0]===2)){i=0;continue}if(p[0]===3&&(!h||p[1]>h[0]&&p[1]<h[3])){i.label=p[1];break}if(p[0]===6&&i.label<h[1]){i.label=h[1],h=p;break}if(h&&i.label<h[2]){i.label=h[2],i.ops.push(p);break}h[2]&&i.ops.pop(),i.trys.pop();continue}p=s.call(o,i)}catch(C){p=[6,C],f=0}finally{u=h=0}if(p[0]&5)throw p[1];return{value:p[0]?p[1]:void 0,done:!0}}},t2=function(){function o(){}return o.failIfNotSupported=function(){return Aa(this,void 0,void 0,function(){return Ia(this,function(s){if(!navigator.mediaDevices)throw"navigator.mediaDevices not supported";return[2,new o]})})},o.prototype.create=function(s){return Aa(this,void 0,void 0,function(){return Ia(this,function(i){return[2,e2.create(s)]})})},o}(),n2=function(o,s,i,u){function f(h){return h instanceof i?h:new i(function(m){m(h)})}return new(i||(i=Promise))(function(h,m){function x(C){try{p(u.next(C))}catch(y){m(y)}}function _(C){try{p(u.throw(C))}catch(y){m(y)}}function p(C){C.done?h(C.value):f(C.value).then(x,_)}p((u=u.apply(o,s||[])).next())})},r2=function(o,s){var i={label:0,sent:function(){if(h[0]&1)throw h[1];return h[1]},trys:[],ops:[]},u,f,h,m;return m={next:x(0),throw:x(1),return:x(2)},typeof Symbol=="function"&&(m[Symbol.iterator]=function(){return this}),m;function x(p){return function(C){return _([p,C])}}function _(p){if(u)throw new TypeError("Generator is already executing.");for(;m&&(m=0,p[0]&&(i=0)),i;)try{if(u=1,f&&(h=p[0]&2?f.return:p[0]?f.throw||((h=f.return)&&h.call(f),0):f.next)&&!(h=h.call(f,p[1])).done)return h;switch(f=0,h&&(p=[p[0]&2,h.value]),p[0]){case 0:case 1:h=p;break;case 4:return i.label++,{value:p[1],done:!1};case 5:i.label++,f=p[1],p=[0];continue;case 7:p=i.ops.pop(),i.trys.pop();continue;default:if(h=i.trys,!(h=h.length>0&&h[h.length-1])&&(p[0]===6||p[0]===2)){i=0;continue}if(p[0]===3&&(!h||p[1]>h[0]&&p[1]<h[3])){i.label=p[1];break}if(p[0]===6&&i.label<h[1]){i.label=h[1],h=p;break}if(h&&i.label<h[2]){i.label=h[2],i.ops.push(p);break}h[2]&&i.ops.pop(),i.trys.pop();continue}p=s.call(o,i)}catch(C){p=[6,C],f=0}finally{u=h=0}if(p[0]&5)throw p[1];return{value:p[0]?p[1]:void 0,done:!0}}},i2=function(){function o(){}return o.retrieve=function(){if(navigator.mediaDevices)return o.getCamerasFromMediaDevices();var s=MediaStreamTrack;return MediaStreamTrack&&s.getSources?o.getCamerasFromMediaStreamTrack():o.rejectWithError()},o.rejectWithError=function(){var s=wr.unableToQuerySupportedDevices();return o.isHttpsOrLocalhost()||(s=wr.insecureContextCameraQueryError()),Promise.reject(s)},o.isHttpsOrLocalhost=function(){if(location.protocol==="https:")return!0;var s=location.host.split(":")[0];return s==="127.0.0.1"||s==="localhost"},o.getCamerasFromMediaDevices=function(){return n2(this,void 0,void 0,function(){var s,i,u,f,h,m,x;return r2(this,function(_){switch(_.label){case 0:return s=function(p){for(var C=p.getVideoTracks(),y=0,S=C;y<S.length;y++){var M=S[y];M.enabled=!1,M.stop(),p.removeTrack(M)}},[4,navigator.mediaDevices.getUserMedia({audio:!1,video:!0})];case 1:return i=_.sent(),[4,navigator.mediaDevices.enumerateDevices()];case 2:for(u=_.sent(),f=[],h=0,m=u;h<m.length;h++)x=m[h],x.kind==="videoinput"&&f.push({id:x.deviceId,label:x.label});return s(i),[2,f]}})})},o.getCamerasFromMediaStreamTrack=function(){return new Promise(function(s,i){var u=function(h){for(var m=[],x=0,_=h;x<_.length;x++){var p=_[x];p.kind==="video"&&m.push({id:p.id,label:p.label})}s(m)},f=MediaStreamTrack;f.getSources(u)})},o}(),_t;(function(o){o[o.UNKNOWN=0]="UNKNOWN",o[o.NOT_STARTED=1]="NOT_STARTED",o[o.SCANNING=2]="SCANNING",o[o.PAUSED=3]="PAUSED"})(_t||(_t={}));var o2=function(){function o(){this.state=_t.NOT_STARTED,this.onGoingTransactionNewState=_t.UNKNOWN}return o.prototype.directTransition=function(s){this.failIfTransitionOngoing(),this.validateTransition(s),this.state=s},o.prototype.startTransition=function(s){return this.failIfTransitionOngoing(),this.validateTransition(s),this.onGoingTransactionNewState=s,this},o.prototype.execute=function(){if(this.onGoingTransactionNewState===_t.UNKNOWN)throw"Transaction is already cancelled, cannot execute().";var s=this.onGoingTransactionNewState;this.onGoingTransactionNewState=_t.UNKNOWN,this.directTransition(s)},o.prototype.cancel=function(){if(this.onGoingTransactionNewState===_t.UNKNOWN)throw"Transaction is already cancelled, cannot cancel().";this.onGoingTransactionNewState=_t.UNKNOWN},o.prototype.getState=function(){return this.state},o.prototype.failIfTransitionOngoing=function(){if(this.onGoingTransactionNewState!==_t.UNKNOWN)throw"Cannot transition to a new state, already under transition"},o.prototype.validateTransition=function(s){switch(this.state){case _t.UNKNOWN:throw"Transition from unknown is not allowed";case _t.NOT_STARTED:this.failIfNewStateIs(s,[_t.PAUSED]);break;case _t.SCANNING:break;case _t.PAUSED:break}},o.prototype.failIfNewStateIs=function(s,i){for(var u=0,f=i;u<f.length;u++){var h=f[u];if(s===h)throw"Cannot transition from ".concat(this.state," to ").concat(s)}},o}(),s2=function(){function o(s){this.stateManager=s}return o.prototype.startTransition=function(s){return this.stateManager.startTransition(s)},o.prototype.directTransition=function(s){this.stateManager.directTransition(s)},o.prototype.getState=function(){return this.stateManager.getState()},o.prototype.canScanFile=function(){return this.stateManager.getState()===_t.NOT_STARTED},o.prototype.isScanning=function(){return this.stateManager.getState()!==_t.NOT_STARTED},o.prototype.isStrictlyScanning=function(){return this.stateManager.getState()===_t.SCANNING},o.prototype.isPaused=function(){return this.stateManager.getState()===_t.PAUSED},o}(),a2=function(){function o(){}return o.create=function(){return new s2(new o2)},o}(),l2=function(){var o=function(s,i){return o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,f){u.__proto__=f}||function(u,f){for(var h in f)Object.prototype.hasOwnProperty.call(f,h)&&(u[h]=f[h])},o(s,i)};return function(s,i){if(typeof i!="function"&&i!==null)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");o(s,i);function u(){this.constructor=s}s.prototype=i===null?Object.create(i):(u.prototype=i.prototype,new u)}}(),an=function(o){l2(s,o);function s(){return o!==null&&o.apply(this,arguments)||this}return s.DEFAULT_WIDTH=300,s.DEFAULT_WIDTH_OFFSET=2,s.FILE_SCAN_MIN_HEIGHT=300,s.FILE_SCAN_HIDDEN_CANVAS_PADDING=100,s.MIN_QR_BOX_SIZE=50,s.SHADED_LEFT=1,s.SHADED_RIGHT=2,s.SHADED_TOP=3,s.SHADED_BOTTOM=4,s.SHADED_REGION_ELEMENT_ID="qr-shaded-region",s.VERBOSE=!1,s.BORDER_SHADER_DEFAULT_COLOR="#ffffff",s.BORDER_SHADER_MATCH_COLOR="rgb(90, 193, 56)",s}(Hh),c2=function(){function o(s,i){this.logger=i,this.fps=an.SCAN_DEFAULT_FPS,s?(s.fps&&(this.fps=s.fps),this.disableFlip=s.disableFlip===!0,this.qrbox=s.qrbox,this.aspectRatio=s.aspectRatio,this.videoConstraints=s.videoConstraints):this.disableFlip=an.DEFAULT_DISABLE_FLIP}return o.prototype.isMediaStreamConstraintsValid=function(){return this.videoConstraints?wa.isMediaStreamConstraintsValid(this.videoConstraints,this.logger):(this.logger.logError("Empty videoConstraints",!0),!1)},o.prototype.isShadedBoxEnabled=function(){return!Vn(this.qrbox)},o.create=function(s,i){return new o(s,i)},o}(),Sa=function(){function o(s,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(s))throw"HTML Element with id=".concat(s," not found");this.elementId=s,this.verbose=!1;var u;typeof i=="boolean"?this.verbose=i===!0:i&&(u=i,this.verbose=u.verbose===!0,u.experimentalFeatures),this.logger=new Wh(this.verbose),this.qrcode=new Zh(this.getSupportedFormats(i),this.getUseBarCodeDetectorIfSupported(u),this.verbose,this.logger),this.foreverScanTimeout,this.shouldScan=!0,this.stateManagerProxy=a2.create()}return o.prototype.start=function(s,i,u,f){var h=this;if(!s)throw"cameraIdOrConfig is required";if(!u||typeof u!="function")throw"qrCodeSuccessCallback is required and should be a function.";var m;f?m=f:m=this.verbose?this.logger.log:function(){};var x=c2.create(i,this.logger);this.clearElement();var _=!1;x.videoConstraints&&(x.isMediaStreamConstraintsValid()?_=!0:this.logger.logError("'videoConstraints' is not valid 'MediaStreamConstraints, it will be ignored.'",!0));var p=_,C=document.getElementById(this.elementId);C.clientWidth?C.clientWidth:an.DEFAULT_WIDTH,C.style.position="relative",this.shouldScan=!0,this.element=C;var y=this,S=this.stateManagerProxy.startTransition(_t.SCANNING);return new Promise(function(M,k){var P=p?x.videoConstraints:y.createVideoConstraints(s);if(!P){S.cancel(),k("videoConstraints should be defined");return}var v={};(!p||x.aspectRatio)&&(v.aspectRatio=x.aspectRatio);var U={onRenderSurfaceReady:function(B,R){y.setupUi(B,R,x),y.isScanning=!0,y.foreverScan(x,u,m)}};t2.failIfNotSupported().then(function(B){B.create(P).then(function(R){return R.render(h.element,v,U).then(function(D){y.renderedCamera=D,S.execute(),M(null)}).catch(function(D){S.cancel(),k(D)})}).catch(function(R){S.cancel(),k(wr.errorGettingUserMedia(R))})}).catch(function(B){S.cancel(),k(wr.cameraStreamingNotSupported())})})},o.prototype.pause=function(s){if(!this.stateManagerProxy.isStrictlyScanning())throw"Cannot pause, scanner is not scanning.";this.stateManagerProxy.directTransition(_t.PAUSED),this.showPausedState(),(Vn(s)||s!==!0)&&(s=!1),s&&this.renderedCamera&&this.renderedCamera.pause()},o.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 s=this,i=function(){s.stateManagerProxy.directTransition(_t.SCANNING),s.hidePausedState()};if(!this.renderedCamera.isPaused()){i();return}this.renderedCamera.resume(function(){i()})},o.prototype.getState=function(){return this.stateManagerProxy.getState()},o.prototype.stop=function(){var s=this;if(!this.stateManagerProxy.isScanning())throw"Cannot stop, scanner is not running or paused.";var i=this.stateManagerProxy.startTransition(_t.NOT_STARTED);this.shouldScan=!1,this.foreverScanTimeout&&clearTimeout(this.foreverScanTimeout);var u=function(){if(s.element){var h=document.getElementById(an.SHADED_REGION_ELEMENT_ID);h&&s.element.removeChild(h)}},f=this;return this.renderedCamera.close().then(function(){return f.renderedCamera=null,f.element&&(f.element.removeChild(f.canvasElement),f.canvasElement=null),u(),f.qrRegion&&(f.qrRegion=null),f.context&&(f.context=null),i.execute(),f.hidePausedState(),f.isScanning=!1,Promise.resolve()})},o.prototype.scanFile=function(s,i){return this.scanFileV2(s,i).then(function(u){return u.decodedText})},o.prototype.scanFileV2=function(s,i){var u=this;if(!s||!(s instanceof File))throw"imageFile argument is mandatory and should be instance of File. Use 'event.target.files[0]'.";if(Vn(i)&&(i=!0),!this.stateManagerProxy.canScanFile())throw"Cannot start file scan - ongoing camera scan";return new Promise(function(f,h){u.possiblyCloseLastScanImageFile(),u.clearElement(),u.lastScanImageFile=URL.createObjectURL(s);var m=new Image;m.onload=function(){var x=m.width,_=m.height,p=document.getElementById(u.elementId),C=p.clientWidth?p.clientWidth:an.DEFAULT_WIDTH,y=Math.max(p.clientHeight?p.clientHeight:_,an.FILE_SCAN_MIN_HEIGHT),S=u.computeCanvasDrawConfig(x,_,C,y);if(i){var M=u.createCanvasElement(C,y,"qr-canvas-visible");M.style.display="inline-block",p.appendChild(M);var k=M.getContext("2d");if(!k)throw"Unable to get 2d context from canvas";k.canvas.width=C,k.canvas.height=y,k.drawImage(m,0,0,x,_,S.x,S.y,S.width,S.height)}var P=an.FILE_SCAN_HIDDEN_CANVAS_PADDING,v=Math.max(m.width,S.width),U=Math.max(m.height,S.height),B=v+2*P,R=U+2*P,D=u.createCanvasElement(B,R);p.appendChild(D);var K=D.getContext("2d");if(!K)throw"Unable to get 2d context from canvas";K.canvas.width=B,K.canvas.height=R,K.drawImage(m,0,0,x,_,P,P,v,U);try{u.qrcode.decodeRobustlyAsync(D).then(function(te){f(xa.createFromQrcodeResult(te))}).catch(h)}catch(te){h("QR code parse error, error = ".concat(te))}},m.onerror=h,m.onabort=h,m.onstalled=h,m.onsuspend=h,m.src=URL.createObjectURL(s)})},o.prototype.clear=function(){this.clearElement()},o.getCameras=function(){return i2.retrieve()},o.prototype.getRunningTrackCapabilities=function(){return this.getRenderedCameraOrFail().getRunningTrackCapabilities()},o.prototype.getRunningTrackSettings=function(){return this.getRenderedCameraOrFail().getRunningTrackSettings()},o.prototype.getRunningTrackCameraCapabilities=function(){return this.getRenderedCameraOrFail().getCapabilities()},o.prototype.applyVideoConstraints=function(s){if(s){if(!wa.isMediaStreamConstraintsValid(s,this.logger))throw"invalid videoConstaints passed, check logs for more details"}else throw"videoConstaints is required argument.";return this.getRenderedCameraOrFail().applyVideoConstraints(s)},o.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},o.prototype.getSupportedFormats=function(s){var i=[pe.QR_CODE,pe.AZTEC,pe.CODABAR,pe.CODE_39,pe.CODE_93,pe.CODE_128,pe.DATA_MATRIX,pe.MAXICODE,pe.ITF,pe.EAN_13,pe.EAN_8,pe.PDF_417,pe.RSS_14,pe.RSS_EXPANDED,pe.UPC_A,pe.UPC_E,pe.UPC_EAN_EXTENSION];if(!s||typeof s=="boolean"||!s.formatsToSupport)return i;if(!Array.isArray(s.formatsToSupport))throw"configOrVerbosityFlag.formatsToSupport should be undefined or an array.";if(s.formatsToSupport.length===0)throw"Atleast 1 formatsToSupport is needed.";for(var u=[],f=0,h=s.formatsToSupport;f<h.length;f++){var m=h[f];zh(m)?u.push(m):this.logger.warn("Invalid format: ".concat(m," passed in config, ignoring."))}if(u.length===0)throw"None of formatsToSupport match supported values.";return u},o.prototype.getUseBarCodeDetectorIfSupported=function(s){if(Vn(s))return!0;if(!Vn(s.useBarCodeDetectorIfSupported))return s.useBarCodeDetectorIfSupported!==!1;if(Vn(s.experimentalFeatures))return!0;var i=s.experimentalFeatures;return Vn(i.useBarCodeDetectorIfSupported)?!0:i.useBarCodeDetectorIfSupported!==!1},o.prototype.validateQrboxSize=function(s,i,u){var f=this,h=u.qrbox;this.validateQrboxConfig(h);var m=this.toQrdimensions(s,i,h),x=function(p){if(p<an.MIN_QR_BOX_SIZE)throw"minimum size of 'config.qrbox' dimension value is"+" ".concat(an.MIN_QR_BOX_SIZE,"px.")},_=function(p){return p>s&&(f.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."),p=s),p};x(m.width),x(m.height),m.width=_(m.width)},o.prototype.validateQrboxConfig=function(s){if(typeof s!="number"&&typeof s!="function"&&(s.width===void 0||s.height===void 0))throw"Invalid instance of QrDimensions passed for 'config.qrbox'. Both 'width' and 'height' should be set."},o.prototype.toQrdimensions=function(s,i,u){if(typeof u=="number")return{width:u,height:u};if(typeof u=="function")try{return u(s,i)}catch(f){throw new Error("qrbox config was passed as a function but it failed with unknown error"+f)}return u},o.prototype.setupUi=function(s,i,u){u.isShadedBoxEnabled()&&this.validateQrboxSize(s,i,u);var f=Vn(u.qrbox)?{width:s,height:i}:u.qrbox;this.validateQrboxConfig(f);var h=this.toQrdimensions(s,i,f);h.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=u.isShadedBoxEnabled()&&h.height<=i,x={x:0,y:0,width:s,height:i},_=m?this.getShadedRegionBounds(s,i,h):x,p=this.createCanvasElement(_.width,_.height),C={willReadFrequently:!0},y=p.getContext("2d",C);y.canvas.width=_.width,y.canvas.height=_.height,this.element.append(p),m&&this.possiblyInsertShadingElement(this.element,s,i,h),this.createScannerPausedUiElement(this.element),this.qrRegion=_,this.context=y,this.canvasElement=p},o.prototype.createScannerPausedUiElement=function(s){var i=document.createElement("div");i.innerText=wr.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%",s.appendChild(i),this.scannerPausedUiElement=i},o.prototype.scanContext=function(s,i){var u=this;return this.stateManagerProxy.isPaused()?Promise.resolve(!1):this.qrcode.decodeAsync(this.canvasElement).then(function(f){return s(f.text,xa.createFromQrcodeResult(f)),u.possiblyUpdateShaders(!0),!0}).catch(function(f){u.possiblyUpdateShaders(!1);var h=wr.codeParseError(f);return i(h,Gh.createFrom(h)),!1})},o.prototype.foreverScan=function(s,i,u){var f=this;if(this.shouldScan&&this.renderedCamera){var h=this.renderedCamera.getSurface(),m=h.videoWidth/h.clientWidth,x=h.videoHeight/h.clientHeight;if(!this.qrRegion)throw"qrRegion undefined when localMediaStream is ready.";var _=this.qrRegion.width*m,p=this.qrRegion.height*x,C=this.qrRegion.x*m,y=this.qrRegion.y*x;this.context.drawImage(h,C,y,_,p,0,0,this.qrRegion.width,this.qrRegion.height);var S=function(){f.foreverScanTimeout=setTimeout(function(){f.foreverScan(s,i,u)},f.getTimeoutFps(s.fps))};this.scanContext(i,u).then(function(M){!M&&s.disableFlip!==!0?(f.context.translate(f.context.canvas.width,0),f.context.scale(-1,1),f.scanContext(i,u).finally(function(){S()})):S()}).catch(function(M){f.logger.logError("Error happend while scanning context",M),S()})}},o.prototype.createVideoConstraints=function(s){if(typeof s=="string")return{deviceId:{exact:s}};if(typeof s=="object"){var i="facingMode",u="deviceId",f={user:!0,environment:!0},h="exact",m=function(k){if(k in f)return!0;throw"config has invalid 'facingMode' value = "+"'".concat(k,"'")},x=Object.keys(s);if(x.length!==1)throw"'cameraIdOrConfig' object should have exactly 1 key,"+" if passed as an object, found ".concat(x.length," keys");var _=Object.keys(s)[0];if(_!==i&&_!==u)throw"Only '".concat(i,"' and '").concat(u,"' ")+" are supported for 'cameraIdOrConfig'";if(_===i){var p=s.facingMode;if(typeof p=="string"){if(m(p))return{facingMode:p}}else if(typeof p=="object")if(h in p){if(m(p["".concat(h)]))return{facingMode:{exact:p["".concat(h)]}}}else throw"'facingMode' should be string or object with"+" ".concat(h," as key.");else{var C=typeof p;throw"Invalid type of 'facingMode' = ".concat(C)}}else{var y=s.deviceId;if(typeof y=="string")return{deviceId:y};if(typeof y=="object"){if(h in y)return{deviceId:{exact:y["".concat(h)]}};throw"'deviceId' should be string or object with"+" ".concat(h," as key.")}else{var S=typeof y;throw"Invalid type of 'deviceId' = ".concat(S)}}}var M=typeof s;throw"Invalid type of 'cameraIdOrConfig' = ".concat(M)},o.prototype.computeCanvasDrawConfig=function(s,i,u,f){if(s<=u&&i<=f){var h=(u-s)/2,m=(f-i)/2;return{x:h,y:m,width:s,height:i}}else{var x=s,_=i;return s>u&&(i=u/s*i,s=u),i>f&&(s=f/i*s,i=f),this.logger.log("Image downsampled from "+"".concat(x,"X").concat(_)+" to ".concat(s,"X").concat(i,".")),this.computeCanvasDrawConfig(s,i,u,f)}},o.prototype.clearElement=function(){if(this.stateManagerProxy.isScanning())throw"Cannot clear while scan is ongoing, close it first.";var s=document.getElementById(this.elementId);s&&(s.innerHTML="")},o.prototype.possiblyUpdateShaders=function(s){this.qrMatch!==s&&(this.hasBorderShaders&&this.borderShaders&&this.borderShaders.length&&this.borderShaders.forEach(function(i){i.style.backgroundColor=s?an.BORDER_SHADER_MATCH_COLOR:an.BORDER_SHADER_DEFAULT_COLOR}),this.qrMatch=s)},o.prototype.possiblyCloseLastScanImageFile=function(){this.lastScanImageFile&&(URL.revokeObjectURL(this.lastScanImageFile),this.lastScanImageFile=null)},o.prototype.createCanvasElement=function(s,i,u){var f=s,h=i,m=document.createElement("canvas");return m.style.width="".concat(f,"px"),m.style.height="".concat(h,"px"),m.style.display="none",m.id=Vn(u)?"qr-canvas":u,m},o.prototype.getShadedRegionBounds=function(s,i,u){if(u.width>s||u.height>i)throw"'config.qrbox' dimensions should not be greater than the dimensions of the root HTML element.";return{x:(s-u.width)/2,y:(i-u.height)/2,width:u.width,height:u.height}},o.prototype.possiblyInsertShadingElement=function(s,i,u,f){if(!(i-f.width<1||u-f.height<1)){var h=document.createElement("div");h.style.position="absolute";var m=(i-f.width)/2,x=(u-f.height)/2;if(h.style.borderLeft="".concat(m,"px solid rgba(0, 0, 0, 0.48)"),h.style.borderRight="".concat(m,"px solid rgba(0, 0, 0, 0.48)"),h.style.borderTop="".concat(x,"px solid rgba(0, 0, 0, 0.48)"),h.style.borderBottom="".concat(x,"px solid rgba(0, 0, 0, 0.48)"),h.style.boxSizing="border-box",h.style.top="0px",h.style.bottom="0px",h.style.left="0px",h.style.right="0px",h.id="".concat(an.SHADED_REGION_ELEMENT_ID),i-f.width<11||u-f.height<11)this.hasBorderShaders=!1;else{var _=5,p=40;this.insertShaderBorders(h,p,_,-_,null,0,!0),this.insertShaderBorders(h,p,_,-_,null,0,!1),this.insertShaderBorders(h,p,_,null,-_,0,!0),this.insertShaderBorders(h,p,_,null,-_,0,!1),this.insertShaderBorders(h,_,p+_,-_,null,-_,!0),this.insertShaderBorders(h,_,p+_,null,-_,-_,!0),this.insertShaderBorders(h,_,p+_,-_,null,-_,!1),this.insertShaderBorders(h,_,p+_,null,-_,-_,!1),this.hasBorderShaders=!0}s.append(h)}},o.prototype.insertShaderBorders=function(s,i,u,f,h,m,x){var _=document.createElement("div");_.style.position="absolute",_.style.backgroundColor=an.BORDER_SHADER_DEFAULT_COLOR,_.style.width="".concat(i,"px"),_.style.height="".concat(u,"px"),f!==null&&(_.style.top="".concat(f,"px")),h!==null&&(_.style.bottom="".concat(h,"px")),x?_.style.left="".concat(m,"px"):_.style.right="".concat(m,"px"),this.borderShaders||(this.borderShaders=[]),this.borderShaders.push(_),s.appendChild(_)},o.prototype.showPausedState=function(){if(!this.scannerPausedUiElement)throw"[internal error] scanner paused UI element not found";this.scannerPausedUiElement.style.display="block"},o.prototype.hidePausedState=function(){if(!this.scannerPausedUiElement)throw"[internal error] scanner paused UI element not found";this.scannerPausedUiElement.style.display="none"},o.prototype.getTimeoutFps=function(s){return 1e3/s},o}(),Na;(function(o){o[o.STATUS_DEFAULT=0]="STATUS_DEFAULT",o[o.STATUS_SUCCESS=1]="STATUS_SUCCESS",o[o.STATUS_WARNING=2]="STATUS_WARNING",o[o.STATUS_REQUESTING_PERMISSION=3]="STATUS_REQUESTING_PERMISSION"})(Na||(Na={}));const u2={width:"38",height:"38",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"none"},d2=["stroke"],f2=["stroke"],h2=["stroke"],g2=["stroke"],m2=["stroke"],p2=l.defineComponent({__name:"QR",props:{color:{type:String,required:!1,default:"#FFFFFF"}},setup(o){return(s,i)=>(l.openBlock(),l.createElementBlock("svg",u2,[l.createElementVNode("path",{d:"M11 11H7V7h4ZM17 7h-2v2h2ZM13 17h4v-4h-4ZM7 17h2v-2H7Z",stroke:o.color,"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"1.5"},null,8,d2),l.createElementVNode("path",{d:"M8 3H4a1 1 0 0 0-1 1V8",stroke:o.color,"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"1.5"},null,8,f2),l.createElementVNode("path",{d:"M21 8V4a1 1 0 0 0-1-1H16",stroke:o.color,"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"1.5"},null,8,h2),l.createElementVNode("path",{d:"M3 16v4a1 1 0 0 0 1 1H8",stroke:o.color,"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"1.5"},null,8,g2),l.createElementVNode("path",{d:"M16 21h4a1 1 0 0 0 1-1V16",stroke:o.color,"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"1.5"},null,8,m2)]))}}),Co={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"]},x2={key:0,class:"qr_text"},w2=l.defineComponent({__name:"QrCameraScanner",props:{axiosInstanceGet:{type:[Function,Object]},is_toggleAffiliation:{type:Boolean},is_notification:{type:Boolean},notificationData:{},tableData:{},isQr:{type:[Boolean,null]},takeDataTable:{type:Function}},emits:["update:tableData","update:notificationData","update:is_notification","update:is_toggleAffiliation"],setup(o,{emit:s}){const i=o;let u=null;const f=l.ref(!1),h=l.ref(!1),m=l.ref(!1),x=l.ref(!1);let _=null;const p=It(),{itemThemes:C}=xe.storeToRefs(p),y=s,S=U=>U.replace(/^[\s\S]*?((?:tel|sms|smsto|mailto|callto|facetime|viber|whatsapp):)?[\s\S]*?(%2B)?[\s\S]*?/i,(B,R,D)=>D?"+":""),M=async(U,B)=>{var te,z,ie;if(console.log(U,B),x.value)return;i.isQr||(x.value=!0),v();const R=/[?&]table_id=([a-zA-Z0-9-]+)/,D=U.match(R),K=U.match(/\/([a-f0-9\-]{36})\?/);if(i.isQr){if(D&&K)return(te=i.takeDataTable)==null?void 0:te.call(i,K[1],D[1],"qr");{const W=localStorage.getItem("orgID");if(W){const se=await i.axiosInstanceGet.get(`org_unit/${W}/table`,{params:{external_link:U}}).then(j=>{var G,V;return((G=j.data)==null?void 0:G.length)>0?(V=j.data[0])==null?void 0:V.id:null}).catch(()=>null);if(se)return(z=i.takeDataTable)==null?void 0:z.call(i,W,se)}}y("update:is_notification",!0),y("update:notificationData",{textNotification:"Стол не найден"}),y("update:tableData",null),y("update:is_toggleAffiliation",!0)}else{const W=new En,se=U||B.text,j=S(se);try{await W.authorizeByCard(j);const G=await W.getProfile();y("update:is_notification",!0),y("update:notificationData",{textNotification:`Здравствуйте, ${G.first_name}
|
|
31
|
+
Баланс: ${G.balance}`})}catch(G){y("update:is_notification",!0),y("update:notificationData",{textNotification:((ie=G.response)==null?void 0:ie.user_friendly_message)||"Карта не найдена"})}finally{m.value=!0,_&&clearTimeout(_),_=setTimeout(()=>{m.value=!1},2e3),x.value=!1}}};window.debugScan=M;const k=()=>{},P=async()=>{if(!(f.value||u!=null&&u.isScanning||m.value))try{f.value=!0;try{(await navigator.mediaDevices.getUserMedia({video:!0})).getTracks().forEach(te=>te.stop())}catch{y("update:is_notification",!0),y("update:notificationData",{textNotification:"Разрешите доступ к камере"}),f.value=!1,y("update:is_toggleAffiliation",!0);return}u=new Sa("reader");const U=await Sa.getCameras();if(!U||U.length===0){console.error("Камеры не найдены"),f.value=!1;return}let B;if(i.isQr)B=U.find(K=>Co.back.some(te=>new RegExp(te,"i").test(K.label))),B||(B=U.find(K=>Co.front.some(te=>new RegExp(te,"i").test(K.label))));else if(B=U.find(K=>Co.front.some(te=>new RegExp(te,"i").test(K.label))),B||(B=U.find(K=>new RegExp("amera","i").test(K.label))),!B){y("update:is_notification",!0),y("update:notificationData",{textNotification:"Не найдена фронтальная камера. Для сканирования карт нужна фронтальная камера."}),f.value=!1,y("update:is_toggleAffiliation",!0);return}const R=i.isQr?[pe.QR_CODE]:[pe.QR_CODE,pe.PDF_417,pe.EAN_13,pe.EAN_8,pe.CODE_128],D={fps:60,qrbox:{width:320,height:500}};await u.start(B.id,D,M,k,void 0,R),h.value=!0}catch(U){y("update:is_notification",!0),y("update:notificationData",{textNotification:"Разрешите доступ к камере для сканирования"}),console.error("Ошибка доступа к камере:",U),f.value=!1,h.value=!1,y("update:is_toggleAffiliation",!0)}},v=async()=>{if(u&&u.isScanning)try{await u.stop(),f.value=!1,u=null}catch(U){console.error("Ошибка остановки камеры:",U)}else f.value=!1,u=null,y("update:is_toggleAffiliation",!0);h.value=!1};return l.onUnmounted(()=>{f.value&&v(),_&&(clearTimeout(_),_=null),x.value=!1,m.value=!1,h.value=!1}),(U,B)=>(l.openBlock(),l.createElementBlock("div",null,[(l.openBlock(),l.createBlock(l.Teleport,{to:"body"},[l.withDirectives(l.createElementVNode("div",{class:"blackWindow",onClick:v},[B[0]||(B[0]=l.createElementVNode("div",{id:"reader"},null,-1)),h.value&&!o.isQr?(l.openBlock(),l.createElementBlock("p",x2,"Наведите QR на камеру")):l.createCommentVNode("",!0)],512),[[l.vShow,f.value]])])),l.createVNode(p2,{color:o.isQr?void 0:"#FFFFFF",onClick:P},null,8,["color"])]))}}),Eo=xe.defineStore("modulesLib",()=>{const o=l.ref(!1),s=l.ref({textNotification:""});return{is_notification_lib:o,notificationData_lib:s,showNotification:u=>{o.value=!0,s.value.textNotification=u}}}),Ci=Symbol("clickOutside"),_2={mounted(o,s){o[Ci]=i=>{o.contains(i.target)||s.value(i)},document.addEventListener("click",o[Ci])},unmounted(o){o[Ci]&&document.removeEventListener("click",o[Ci])}};class C2{constructor(s){We(this,"value");We(this,"next");this.value=s}}class E2{constructor(){vi(this,Qt);vi(this,Hn);vi(this,nr);this.clear()}enqueue(s){const i=new C2(s);pn(this,Qt)?(pn(this,Hn).next=i,Dn(this,Hn,i)):(Dn(this,Qt,i),Dn(this,Hn,i)),Ho(this,nr)._++}dequeue(){const s=pn(this,Qt);if(s)return Dn(this,Qt,pn(this,Qt).next),Ho(this,nr)._--,pn(this,Qt)||Dn(this,Hn,void 0),s.value}peek(){if(pn(this,Qt))return pn(this,Qt).value}clear(){Dn(this,Qt,void 0),Dn(this,Hn,void 0),Dn(this,nr,0)}get size(){return pn(this,nr)}*[Symbol.iterator](){let s=pn(this,Qt);for(;s;)yield s.value,s=s.next}*drain(){for(;pn(this,Qt);)yield this.dequeue()}}Qt=new WeakMap,Hn=new WeakMap,nr=new WeakMap;function y2(o){Ta(o);const s=new E2;let i=0;const u=()=>{i<o&&s.size>0&&(i++,s.dequeue()())},f=()=>{i--,u()},h=async(_,p,C)=>{const y=(async()=>_(...C))();p(y);try{await y}catch{}f()},m=(_,p,C)=>{new Promise(y=>{s.enqueue(y)}).then(h.bind(void 0,_,p,C)),i<o&&u()},x=(_,...p)=>new Promise(C=>{m(_,C,p)});return Object.defineProperties(x,{activeCount:{get:()=>i},pendingCount:{get:()=>s.size},clearQueue:{value(){s.clear()}},concurrency:{get:()=>o,set(_){Ta(_),o=_,queueMicrotask(()=>{for(;i<o&&s.size>0;)u()})}},map:{async value(_,p){const C=Array.from(_,(y,S)=>this(p,y,S));return Promise.all(C)}}}),x}function Ta(o){if(!((Number.isInteger(o)||o===Number.POSITIVE_INFINITY)&&o>0))throw new TypeError("Expected `concurrency` to be a number from 1 and up")}let Kt=null;const ka=y2(5),b2=async(o,s)=>{Kt&&N2();const i=lt(),u=It(),f=Eo(),h=Rt(),{itemThemes:m}=xe.storeToRefs(u),{displayCards:x}=xe.storeToRefs(i),{is_notification_lib:_,notificationData_lib:p}=xe.storeToRefs(f),{stateCard:C,openProduct:y}=xe.storeToRefs(h),S=En.create();await A2(o),Kt=ri(`wss://${s}/ws/org-unit/${o}/`,{heartbeatTimeout:3e4}),Kt.on("open",()=>console.warn("Realtime WebSocket подключён (pointId:",o,")")),Kt.on("error",M=>console.warn("WebSocket ошибка:",M)),Kt.on("close",()=>console.warn("Realtime WebSocket закрыт")),Kt.on("message",async M=>{if(M.type)return;m.value.kiosk_hide_menu_update_notification||(p.value.textNotification="Мы обновили меню");const k=M.params||M,P=k.active_groups||[],v=k.updated_groups||[],U=k.updated_product_groups||[],B=await $n(),R=new Set(P.map(j=>j)),D=new Map(x.value.map(j=>[j.id,j])),K=[],te=B.transaction("groups","readwrite");let ie=await te.objectStore("groups").openCursor();for(;ie;){const j=ie.key;!R.has(j)&&j!==o&&(K.push(j),await ie.delete(),D.delete(j)),ie=await ie.continue()}await te.done,x.value=Array.from(D.values()),K.length>0&&await I2(R);const W=[...v.map(j=>ka(async()=>{const[G,V]=await Promise.all([S.getGroupByID(j),S.loadGroupProducts(j)]);G.products=V,D.set(j,G),await Rr(j,G),await Oa(G,V,!0)})),...U.map(j=>ka(async()=>{const[G,V]=await Promise.all([S.getGroupByID(j),S.loadGroupProducts(j)]);G.products=V,D.set(j,G),await Rr(j,G),await Oa(G,V,!0),await S2(V,j)}))];await Promise.all(W),x.value=Array.from(D.values()),await Cl(o,x),p.value.textNotification.length>1&&(_.value=!0);const se=C.value.openCard;if(se!=null&&se.id){const j=new Set(se.groups??[]),G=new Set;let V=!1;for(const N of D.values()){const $=N==null?void 0:N.products;if(!Array.isArray($))continue;const H=$.find(J=>(J==null?void 0:J.id)===se.id);if((H==null?void 0:H.adult)===!0){y.value={id:null,visible:!1},h.reset();return}H&&(N==null?void 0:N.id)!=null&&(G.add(N.id),(v.includes(N.id)||U.includes(N.id))&&(V=!0))}if(G.size===0){y.value={id:null,visible:!1},h.reset();return}(!(j.size===G.size&&[...j].every(N=>G.has(N)))||V)&&await S.getSingleProduct(se==null?void 0:se.id)}}),Kt.connect()},A2=async o=>{try{const s=lt(),i=await Hi(o);i!=null&&i.data&&(s.displayCards=i.data)}catch(s){console.error("Ошибка загрузки кэша групп:",s)}},Ra=async o=>{const s=lt(),i=Eo(),u=Rt(),{stateCard:f,openProduct:h}=xe.storeToRefs(u),{cartProducts_lib:m}=xe.storeToRefs(s),x=m.value,_=[],p=[],C=f.value.openCard;for(const y of x)o(y)?(_.push(y),(y.id===(C==null?void 0:C.id)||C!=null&&C.adult)&&(h.value={id:null,visible:!1})):p.push(y);if(_.length>0){const y=_.map(S=>S.name).slice(0,3).join(", ");i.notificationData_lib.textNotification=`Некоторые позиции стали недоступны и были убраны из заказа: ${y}${_.length>3?` и ещё ${_.length-3}`:""}`,m.value=p,s.updateCartInLocalStorage()}},I2=async o=>{await Ra(s=>{var i;return(i=s.groups)!=null&&i.length?!s.groups.some(u=>o.has(u)):!0})},S2=async(o,s)=>{const i=lt(),u=new Set(o.filter(f=>!f.adult||i.is18Allowed).map(f=>f.id));await Ra(f=>{var h;return(h=f.groups)!=null&&h.includes(s)?!u.has(f.id):!1})},Oa=async(o,s,i=!0)=>{if(o.video_link&&Ei(o.video_link,`${o.id}_video`,i),o.image_link&&Ei(o.image_link,`${o.id}_image`,i),s!=null&&s.length)for(const u of s)u.video_link&&Ei(u.video_link,`${u.id}_video`,i),u.image_link&&Ei(u.image_link,`${u.id}_image`,i)},Ei=async(o,s,i=!1)=>{try{const u=ti();if(!i){const m=await ur(s);if(m){u.updateCacheFromBlob(s,m),window.dispatchEvent(new CustomEvent("image-cached",{detail:{id:s,blob:m}}));return}}const f=await fetch(o);if(!f.ok)throw new Error("Network error");const h=await f.blob();if(h.size===0)throw new Error("Empty blob");await Gi(s,h),u.updateCacheFromBlob(s,h),window.dispatchEvent(new CustomEvent("image-cached",{detail:{id:s,blob:h}}))}catch(u){console.warn(`[MediaCache] Failed for ${s}:`,u)}},N2=()=>{Kt&&(Kt.off("open"),Kt.off("message"),Kt.off("error"),Kt.off("close"),Kt.close(!0),Kt=null)},T2={key:0,class:"valentine-hearts"},k2=l.defineComponent({__name:"FallingHearts",props:{symbols:{default:()=>["❤","♥","💕"]},max:{default:15},interval:{default:1500}},setup(o){const s=o,i=Wt.useDocumentVisibility(),u=Wt.useMediaQuery("(prefers-reduced-motion: reduce)"),f=l.ref([]);let h=null;const m=(C,y)=>Math.random()*(y-C)+C,x=()=>{if(u.value||f.value.length>=s.max)return;const C=s.symbols[Math.floor(Math.random()*s.symbols.length)],y=m(18,26),S=m(5,95),M=m(10,18),k=m(0,.3),P=m(.6,.9),v=Math.floor(m(1,6)),B={id:crypto.randomUUID(),icon:C,style:{left:`${S}%`,fontSize:`${y}px`,color:`rgba(255, 105, 180, ${P})`,animationName:`heartFall${v}`,animationDuration:`${M}s`,animationDelay:`${k}s`}};f.value.push(B);const D=setTimeout(()=>{f.value=f.value.filter(K=>K.id!==B.id),clearTimeout(D)},(k+M+1)*1e3)},_=()=>{if(!u.value){for(let C=0;C<3;C++){const y=setTimeout(()=>{x(),clearTimeout(y)},C*200)}h=setInterval(x,s.interval)}},p=()=>{h&&(clearInterval(h),h=null),f.value=[]};return l.onMounted(()=>{u.value||_()}),l.onUnmounted(()=>{p()}),l.watch(i,(C,y)=>{C==="visible"&&y==="hidden"&&_(),C==="hidden"&&y==="visible"&&p()}),(C,y)=>l.unref(u)?l.createCommentVNode("",!0):(l.openBlock(),l.createElementBlock("div",T2,[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(f.value,S=>(l.openBlock(),l.createElementBlock("span",{key:S.id,class:"heart",style:l.normalizeStyle(S.style)},l.toDisplayString(S.icon),5))),128))]))}}),R2=["src"],O2=l.defineComponent({__name:"BasketImage",props:{id:{},fallback:{}},setup(o){const s=o,{mediaUrl:i}=Fn(()=>s.id,()=>s.fallback);return(u,f)=>(l.openBlock(),l.createElementBlock("img",{src:l.unref(i)||""},null,8,R2))}}),B2={class:"button_price_bg"},M2={class:"wrapper_container_price_bg"},v2={class:"button_price"},D2={key:0,class:"image_product_container"},P2=l.defineComponent({__name:"BasketButton",emits:["goToCart"],setup(o){const s=lt(),{isDesktop:i}=Nn(),{totalPrice_lib:u,cartProducts_lib:f}=xe.storeToRefs(s),h=l.computed(()=>{var m;return(m=f.value)!=null&&m.length,f.value.slice(0,3).map(x=>({id:`${x.id}_image`,fallback:x.image_link}))});return(m,x)=>(l.openBlock(),l.createElementBlock("div",B2,[l.createElementVNode("div",M2,[l.createElementVNode("div",v2,[l.unref(u)>0&&h.value.length>0?(l.openBlock(),l.createElementBlock("div",D2,[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(h.value,_=>(l.openBlock(),l.createElementBlock("div",{key:_.id,class:"filter_image_product"},[l.createVNode(O2,{id:_.id,fallback:_.fallback,class:"img_product"},null,8,["id","fallback"])]))),128))])):l.createCommentVNode("",!0),l.createVNode(l.unref(At.motion).div,{class:"button_default_main",whilePress:l.unref(i)?{}:{scale:.92},onClick:x[0]||(x[0]=_=>m.$emit("goToCart"))},{default:l.withCtx(()=>[x[2]||(x[2]=l.createElementVNode("div",{class:"icont_cart"},null,-1)),l.createElementVNode("p",null,[l.createVNode(Xt,{price:l.unref(u),fixedFloat:2},null,8,["price"]),x[1]||(x[1]=l.createTextVNode(" ₽",-1))])]),_:1},8,["whilePress"])])])]))}}),Hr=null,{min:tr,max:yn,abs:Ba,floor:L2}=Math,Ma=(o,s,i)=>tr(i,yn(s,o)),va=o=>[...o].sort((s,i)=>s-i),F2=typeof queueMicrotask=="function"?queueMicrotask:o=>{Promise.resolve().then(o)},yo=()=>{let o;return[new Promise(s=>{o=s}),o]},Da=o=>{let s;return()=>(o&&(s=o(),o=void 0),s)},Gr=(o,s,i)=>{const u=i?"unshift":"push";for(let f=0;f<s;f++)o[u](-1);return o},Pa=(o,s)=>{const i=o.t[s];return i===-1?o.o:i},V2=(o,s,i)=>{const u=o.t[s]===-1;return o.t[s]=i,o.i=tr(s,o.i),u},yi=(o,s)=>{if(!o.l)return 0;if(o.i>=s)return o.u[s];o.i<0&&(o.u[0]=0,o.i=0);let i=o.i,u=o.u[i];for(;i<s;)u+=Pa(o,i),o.u[++i]=u;return o.i=s,u},_r=(o,s,i=0,u=o.l-1)=>{let f=i;for(;i<=u;){const h=L2((i+u)/2);yi(o,h)<=s?(f=h,i=h+1):u=h-1}return Ma(f,0,o.l-1)},La=(o,s,i)=>{const u=s-o.l;return o.i=i?-1:tr(s-1,o.i),o.l=s,u>0?(Gr(o.u,u),Gr(o.t,u,i),o.o*u):(o.u.splice(u),(i?o.t.splice(0,-u):o.t.splice(u)).reduce((f,h)=>f-(h===-1?o.o:h),0))},U2=o=>o.documentElement,z2=o=>o.ownerDocument,H2=o=>o.defaultView,Fa=Da(()=>!!/iP(hone|od|ad)/.test(navigator.userAgent)||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>0),G2=Da(()=>"scrollBehavior"in U2(document).style),W2=(o,s=40,i=0,u,f=!1)=>{let h=!!i,m=1,x=0,_=0,p=0,C=0,y=0,S=0,M=0,k=0,P=Hr,v=[0,h?yn(i-1,0):-1],U=0,B=!1;const R=((V,X,N)=>({o:X,t:N?Gr(N.slice(0,tr(V,N.length)),yn(0,V-N.length)):Gr([],V),l:V,i:-1,u:Gr([],V+1)}))(o,u?u[1]:s,u&&u[0]),D=new Set,K=()=>p-_,te=()=>K()+y+C,z=(V,X)=>((N,$,H,J)=>{if(J=tr(J,N.l-1),yi(N,J)<=$){const q=_r(N,H,J);return[_r(N,$,J,q),q]}{const q=_r(N,$,void 0,J);return[q,_r(N,H,q)]}})(R,V,X,v[0]),ie=()=>yi(R,R.l),W=(V,X)=>{const N=yi(R,V)-y;return X?ie()-N-se(V):N},se=V=>Pa(R,V),j=(V,X=-1)=>R.t[V]===X,G=V=>{V&&(Fa()&&M!==0||P&&k===1?y+=V:C+=V)};return{p:()=>{D.clear()},h:()=>m,m:()=>(V=>[V.t.slice(),V.o])(R),v:(V=200)=>{if(!B||h)return v;let X,N;if(S)[X,N]=v;else{let $=yn(0,te()),H=$+x;f||(V=yn(0,V),M!==1&&($-=V),M!==2&&(H+=V)),[X,N]=v=z(yn(0,$),yn(0,H)),P&&(X=tr(X,P[0]),N=yn(N,P[1]))}return[yn(X,0),tr(N,R.l-1)]},S:V=>_r(R,V-_),I:j,O:W,k:se,j:()=>R.l,N:()=>p,B:()=>M!==0,T:()=>x,q:()=>_,M:ie,P:()=>(S=C,C=0,[S,k===2]),R:(V,X)=>{const N=[V,X];return D.add(N),()=>{D.delete(N)}},A:(V,X)=>{let N,$,H=0;switch(V){case 1:{if(X===p&&k===0)break;const J=S;S=0;const q=X-p,re=Ba(q);J&&re<Ba(J)+1||k!==0||(M=q<0?2:1),h&&(h=!1),p=X,H=4;const ge=K();ge>=-x&&ge<=ie()&&(H+=1,$=re>x);break}case 2:H=8,M!==0&&(N=!0,H+=1),M=0,k=0,P=Hr;break;case 3:{const J=X.filter(([q,re])=>!j(q,re));if(!J.length)break;G(J.reduce((q,[re,ge])=>((k===2||(P&&k===1?re<P[0]:W(re+(M===0&&k===0?1:0))<K()))&&(q+=ge-se(re)),q),0));for(const[q,re]of J){const ge=se(q),we=V2(R,q,re);f&&(U+=we?re:re-ge)}f&&x&&U>x&&(G(((q,re)=>{let ge=0;const we=[];q.t.forEach((Xe,Oe)=>{Xe!==-1&&(we.push(Xe),Oe<re&&ge++)}),q.i=-1;const Ne=va(we),_e=Ne.length,Me=_e/2|0,he=_e%2==0?(Ne[Me-1]+Ne[Me])/2:Ne[Me],dt=q.o;return((q.o=he)-dt)*yn(re-ge,0)})(R,_r(R,te()))),f=!1),H=3,$=!0;break}case 4:x!==X&&(x||(B=$=!0),x=X,H=3);break;case 5:X[1]?(G(La(R,X[0],!0)),k=2,H=1):(La(R,X[0]),H=1);break;case 6:_=X;break;case 7:k=1;break;case 8:P=z(X,X+x),H=1}H&&(m=1+(2147483647&m),N&&y&&(C+=y,y=0),D.forEach(([J,q])=>{H&J&&q($)}))}}},bo=setTimeout,Ao=(o,s)=>s?-o:o,X2=(o,s,i,u,f,h)=>{const m=Date.now;let x=0,_=!1,p=!1,C=!1,y=!1;const S=(()=>{let U;const B=()=>{U!=Hr&&clearTimeout(U)},R=()=>{B(),U=bo(()=>{U=Hr,(()=>{if(_||p)return _=!1,void S();C=!1,o.A(2)})()},150)};return R.C=B,R})(),M=()=>{x=m(),C&&(y=!0),o.A(1,u()),S()},k=U=>{if(_||!o.B()||U.ctrlKey)return;const B=m()-x;150>B&&50<B&&(i?U.deltaX:U.deltaY)&&(_=!0)},P=()=>{p=!0,C=y=!1},v=()=>{p=!1,Fa()&&(C=!0)};return s.addEventListener("scroll",M),s.addEventListener("wheel",k,{passive:!0}),s.addEventListener("touchstart",P,{passive:!0}),s.addEventListener("touchend",v,{passive:!0}),{H:()=>{s.removeEventListener("scroll",M),s.removeEventListener("wheel",k),s.removeEventListener("touchstart",P),s.removeEventListener("touchend",v),S.C()},V:()=>{const[U,B]=o.P();U&&(f(U,B,y),y=!1,B&&o.T()>o.M()&&o.A(1,u()))}}},j2=(o,s,i)=>{let u;return[async(f,h)=>{if(!await s())return;u&&u();const m=()=>{const[x,_]=yo();return u=()=>{_(!1)},o.T()&&bo(u,150),[x,o.R(2,()=>{_(!0)})]};if(h&&G2())o.A(8,f()),F2(async()=>{for(;;){let x=!0;for(let[C,y]=o.v();C<=y;C++)if(o.I(C)){x=!1;break}if(x)break;const[_,p]=m();try{if(!await _)return}finally{p()}}o.A(7),i(f(),h)});else for(;;){const[x,_]=m();try{if(o.A(7),i(f()),!await x)return}finally{_()}}},()=>{u&&u()}]},q2=o=>{let s;return{F(i){(s||(s=new(H2(z2(i))).ResizeObserver(o))).observe(i)},J(i){s.unobserve(i)},H(){s&&s.disconnect()}}},Z2=l.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(o){const s=l.ref(),i=l.computed(()=>o.L.value&&o.W.O(o.D,o.K)),u=l.computed(()=>o.L.value&&o.W.I(o.D));return l.watch(()=>s.value&&o.D,(f,h,m)=>{m(o.Y(s.value,o.D))},{flush:"post"}),()=>{var f;const{X:h,U:m,G:x,Z:_}=o,p=u.value,{style:C,...y}=(f=o.ee)!==null&&f!==void 0?f:{},S={contain:"layout style",position:p&&x?void 0:"absolute",[m?"height":"width"]:"100%",[m?"top":"left"]:"0px",[m?"left":"top"]:i.value+"px",visibility:!p||x?void 0:"hidden",...C};return m&&(S.display="inline-flex"),l.createVNode(_,l.mergeProps({ref:s,style:S},y),typeof(M=h)=="function"||Object.prototype.toString.call(M)==="[object Object]"&&!l.isVNode(M)?h:{default:()=>[h],_:2},16,["style"]);var M}}}),Y2=(o,s)=>{const i=o.key;return i??"_"+s},$2=(o,s)=>o[0]===s[0]&&o[1]===s[1],Va=l.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(o,{emit:s,expose:i,slots:u}){let f=!!o.ssrCount;const h=o.horizontal,m=l.ref(),x=W2(o.data.length,o.itemSize,o.ssrCount,o.cache,!o.itemSize),_=((k,P)=>{let v;const U=P?"width":"height",B=new WeakMap,R=q2(D=>{const K=[];for(const{target:te,contentRect:z}of D)if(te.offsetParent)if(te===v)k.A(4,z[U]);else{const ie=B.get(te);ie!=Hr&&K.push([ie,z[U]])}K.length&&k.A(3,K)});return{te(D){R.F(v=D)},re:(D,K)=>(B.set(D,K),R.F(D),()=>{B.delete(D),R.J(D)}),p:R.H}})(x,h),p=((k,P)=>{let v,U,B=yo(),R=!1;const D=P?"scrollLeft":"scrollTop",K=P?"overflowX":"overflowY",[te,z]=j2(k,()=>B[0],(ie,W)=>{ie=Ao(ie,R),W?v.scrollTo({[P?"left":"top"]:ie,behavior:"smooth"}):v[D]=ie});return{oe(ie){v=ie,P&&(R=getComputedStyle(ie).direction==="rtl"),U=X2(k,ie,P,()=>Ao(ie[D],R),(W,se,j)=>{if(j){const G=ie.style,V=G[K];G[K]="hidden",bo(()=>{G[K]=V})}ie[D]=Ao(k.N()+W,R),se&&z()}),B[1](!0)},p(){U&&U.H(),B[1](!1),B=yo()},ne:()=>R,se(ie){te(()=>ie)},ie(ie){ie+=k.N(),te(()=>ie)},le(ie,{align:W,smooth:se,offset:j=0}={}){if(ie=Ma(ie,0,k.j()-1),W==="nearest"){const G=k.O(ie),V=k.N();if(G<V)W="start";else{if(!(G+k.k(ie)>V+k.T()))return;W="end"}}te(()=>j+k.q()+k.O(ie)+(W==="end"?k.k(ie)-k.T():W==="center"?(k.k(ie)-k.T())/2:0),se)},ce:()=>{U&&U.V()}}})(x,h),C=l.ref(x.h());x.R(1,()=>{C.value=x.h()}),x.R(4,()=>{s("scroll",x.N())}),x.R(8,()=>{s("scrollEnd")});const y=l.computed(k=>{C.value;const P=x.v(o.bufferSize);return k&&$2(k,P)?k:P}),S=l.computed(()=>C.value&&x.B()),M=l.computed(()=>C.value&&x.M());return l.onMounted(()=>{f=!1;const k=requestAnimationFrame(()=>{const P=v=>{_.te(v),p.oe(v)};o.scrollRef?P(o.scrollRef):P(m.value.parentElement)});l.onUnmounted(()=>{cancelAnimationFrame(k)})}),l.onUnmounted(()=>{x.p(),_.p(),p.p()}),l.watch(()=>o.data.length,k=>{x.A(5,[k,o.shift])}),l.watch(()=>o.startMargin,k=>{x.A(6,k)},{immediate:!0}),l.watch([C],()=>{p.ce()},{flush:"post"}),i({get cache(){return x.m()},get scrollOffset(){return x.N()},get scrollSize(){return(k=>yn(k.M(),k.T()))(x)},get viewportSize(){return x.T()},findItemIndex:x.S,getItemOffset:x.O,getItemSize:x.k,scrollToIndex:p.le,scrollTo:p.se,scrollBy:p.ie}),()=>{const k=o.as,P=o.item,v=M.value,U=p.ne(),B=!h&&U?"unshift":"push",R=[],D=te=>{var z;const ie=u.default({item:o.data[te],index:te})[0];return l.createVNode(Z2,{key:Y2(ie,te),L:C,W:x,Y:_.re,D:te,X:ie,U:h,K:U,G:f,Z:P,ee:(z=o.itemProps)===null||z===void 0?void 0:z.call(o,{item:o.data[te],index:te})},null,8,["L","W","Y","D","X","U","K","G","Z","ee"])};if(o.keepMounted){const te=new Set(o.keepMounted);for(let[z,ie]=y.value;z<=ie;z++)te.add(z);va([...te]).forEach(z=>{R[B](D(z))})}else for(let[te,z]=y.value;te<=z;te++)R[B](D(te));return l.createVNode(k,{ref:m,style:{contain:"size style",overflowAnchor:"none",flex:"none",position:"relative",width:h?v+"px":"100%",height:h?"100%":v+"px",pointerEvents:S.value?"none":void 0}},typeof(K=R)=="function"||Object.prototype.toString.call(K)==="[object Object]"&&!l.isVNode(K)?R:{default:()=>[R],_:2},8,["style"]);var K}}}),K2=l.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(o,{emit:s,expose:i,slots:u}){const f=o.horizontal,h=_=>{s("scroll",_)},m=()=>{s("scrollEnd")},x=l.ref();return i({get cache(){return x.value.cache},get scrollOffset(){return x.value.scrollOffset},get scrollSize(){return x.value.scrollSize},get viewportSize(){return x.value.viewportSize},findItemIndex:(..._)=>x.value.findItemIndex(..._),getItemOffset:(..._)=>x.value.getItemOffset(..._),getItemSize:(..._)=>x.value.getItemSize(..._),scrollToIndex:(..._)=>x.value.scrollToIndex(..._),scrollTo:(..._)=>x.value.scrollTo(..._),scrollBy:(..._)=>x.value.scrollBy(..._)}),()=>{return l.createVNode("div",{style:{display:f?"inline-block":"block",[f?"overflowX":"overflowY"]:"auto",contain:"strict",width:"100%",height:"100%"}},[l.createVNode(Va,{ref:x,data:o.data,bufferSize:o.bufferSize,itemSize:o.itemSize,itemProps:o.itemProps,shift:o.shift,ssrCount:o.ssrCount,horizontal:f,keepMounted:o.keepMounted,cache:o.cache,onScroll:h,onScrollEnd:m},(_=u,typeof _=="function"||Object.prototype.toString.call(_)==="[object Object]"&&!l.isVNode(_)?u:{default:()=>[u],_:2}),8,["data","bufferSize","itemSize","itemProps","shift","ssrCount","horizontal","keepMounted","cache","onScroll","onScrollEnd"])],4);var _}}}),Q2=(o,s=10)=>new Promise(i=>{let u=0,f=0,h=0;const m=()=>{const x=o.scrollSize;x===h&&x>0?u++:(u=0)&&(h=x),f++,u>=2||f>=s?i():requestAnimationFrame(m)};requestAnimationFrame(m)});function J2(o,s){const i=(s==null?void 0:s.align)??"start";let u=!1;const f=l.ref(null),h=l.ref(!1),m=l.ref("measure"),x=l.computed(()=>l.toValue(o).length),_=l.computed(()=>m.value==="measure"||m.value==="virtual"?1:5),p=l.computed(()=>Array.from({length:x.value*_.value},(v,U)=>U)),C=async()=>{if(f.value&&(m.value="measure",u=!1,h.value=!1,await l.nextTick(),m.value==="measure")){if(await Q2(f.value),h.value=f.value.scrollSize>f.value.viewportSize,!h.value){u=!1;return}u=!0,m.value=(s==null?void 0:s.mode)||"loop",await l.nextTick(),f.value.scrollToIndex(x.value*3,{align:i})}},y=v=>m.value==="measure"?v:x.value===0?0:v%x.value,S=(v,U)=>{f.value&&f.value.scrollToIndex(v,U)},M=(v,U)=>!u||m.value!=="loop"?U:U+Math.round((v-U)/x.value)*x.value,k=v=>{if(!u||m.value!=="loop"||!f.value)return;const U=x.value-1,B=x.value*4;if(v<U)return S(x.value*3-1,{align:"start"});if(v>=B)return S(x.value*3,{align:"start"})},P=()=>{if(!f.value||!u)return;const v=f.value.findItemIndex(f.value.scrollOffset);k(v)};return l.onMounted(C),l.onUnmounted(()=>f.value=null),l.watch(x,()=>l.nextTick(C)),{listRef:f,items:p,hasScroll:h,realIndex:y,findNearestIndex:M,scrollToIndex:S,init:C,onScroll:P}}const eg=Object.prototype.toString,tg=o=>eg.call(o)==="[object Error]",ng=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"]),rg=o=>{if(!(o&&tg(o)&&o.name==="TypeError"&&typeof o.message=="string"))return!1;const{message:i,stack:u}=o;return i==="Load failed"?u===void 0||"__sentry_captured__"in o:i.startsWith("error sending request for url")||i==="Failed to fetch"||i.startsWith("Failed to fetch (")&&i.endsWith(")")?!0:ng.has(i)},ig={pinch:!0,doubleTap:!0,wheel:!0,buttons:["+","-","=","0"]},og=o=>{var i;const s=Object.assign({},ig,o);if(s.pinch&&(document.addEventListener("touchstart",u=>u.touches.length>1&&u.preventDefault(),{passive:!1}),document.addEventListener("gesturestart",u=>u.preventDefault(),{passive:!1})),s.doubleTap){let u=0;document.addEventListener("touchend",f=>{const h=Date.now();h-u<=250&&f.preventDefault(),u=h},{passive:!1})}s.wheel&&document.addEventListener("wheel",u=>(u.ctrlKey||u.metaKey)&&u.preventDefault(),{passive:!1}),(i=s.buttons)!=null&&i.length&&document.addEventListener("keydown",u=>(u.ctrlKey||u.metaKey)&&s.buttons.includes(u.key)&&u.preventDefault())};Object.defineProperty(fe,"useRoute",{enumerable:!0,get:()=>Re.useRoute}),Object.defineProperty(fe,"useRouter",{enumerable:!0,get:()=>Re.useRouter}),fe.BasketButton=P2,fe.BottomSheet=uo,fe.ButtonDefault=un,fe.CardMain=ha,fe.CardProductPage=a0,fe.CardReader=sa,fe.CartBox=oa,fe.CartPage=$f,fe.DrumItem=Th,fe.FallingHearts=k2,fe.GroupMain=yh,fe.InitConnection=En,fe.ModalWindows=Uh,fe.NotificationWindow=lo,fe.PopupWindowDefault=ia,fe.PricePrerender=dr,fe.QrCameraScanner=w2,fe.Recommendation=Ph,fe.RetryPage=ah,fe.TagsMain=Ah,fe.VList=K2,fe.Virtualizer=Va,fe.clearAllProductDB=yl,fe.clearLocalStorage=fr,fe.getCachedGroup=Hi,fe.getCachedProduct=$o,fe.getWebSocketInstance=ri,fe.initPinia=il,fe.initRouter=sl,fe.isNetworkError=rg,fe.parseTheme=Qs,fe.preventZoom=og,fe.updateIndexedDB=b2,fe.useCachedMedia=Fn,fe.useCardLibStore=Rt,fe.useCartLibStore=St,fe.useImageCacheStore=ti,fe.useMainLibStore=lt,fe.useModal=fa,fe.useModalStore=fo,fe.useModulesLibStore=Eo,fe.usePdf=Nn,fe.useThemeStore=It,fe.useVirtuaLoop=J2,fe.vClickOutside=_2,fe.vDragScroll=Vr,fe.vMuted=zr,Object.defineProperty(fe,Symbol.toStringTag,{value:"Module"})});
|