34 lines
395 KiB
JavaScript
34 lines
395 KiB
JavaScript
|
function xl(o,a){return a.forEach(function(f){f&&typeof f!="string"&&!Array.isArray(f)&&Object.keys(f).forEach(function(h){if(h!=="default"&&!(h in o)){var d=Object.getOwnPropertyDescriptor(f,h);Object.defineProperty(o,h,d.get?d:{enumerable:!0,get:function(){return f[h]}})}})}),Object.freeze(Object.defineProperty(o,Symbol.toStringTag,{value:"Module"}))}const Al=function(){const a=document.createElement("link").relList;if(a&&a.supports&&a.supports("modulepreload"))return;for(const d of document.querySelectorAll('link[rel="modulepreload"]'))h(d);new MutationObserver(d=>{for(const x of d)if(x.type==="childList")for(const p of x.addedNodes)p.tagName==="LINK"&&p.rel==="modulepreload"&&h(p)}).observe(document,{childList:!0,subtree:!0});function f(d){const x={};return d.integrity&&(x.integrity=d.integrity),d.referrerpolicy&&(x.referrerPolicy=d.referrerpolicy),d.crossorigin==="use-credentials"?x.credentials="include":d.crossorigin==="anonymous"?x.credentials="omit":x.credentials="same-origin",x}function h(d){if(d.ep)return;d.ep=!0;const x=f(d);fetch(d.href,x)}};Al();function ls(o,a){const f=Object.create(null),h=o.split(",");for(let d=0;d<h.length;d++)f[h[d]]=!0;return a?d=>!!f[d.toLowerCase()]:d=>!!f[d]}const wl="itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly",El=ls(wl);function Oo(o){return!!o||o===""}function cs(o){if(be(o)){const a={};for(let f=0;f<o.length;f++){const h=o[f],d=Tt(h)?ml(h):cs(h);if(d)for(const x in d)a[x]=d[x]}return a}else{if(Tt(o))return o;if(St(o))return o}}const pl=/;(?![^(]*\))/g,Cl=/:(.+)/;function ml(o){const a={};return o.split(pl).forEach(f=>{if(f){const h=f.split(Cl);h.length>1&&(a[h[0].trim()]=h[1].trim())}}),a}function fs(o){let a="";if(Tt(o))a=o;else if(be(o))for(let f=0;f<o.length;f++){const h=fs(o[f]);h&&(a+=h+" ")}else if(St(o))for(const f in o)o[f]&&(a+=f+" ");return a.trim()}const Il=o=>Tt(o)?o:o==null?"":be(o)||St(o)&&(o.toString===Bo||!Ne(o.toString))?JSON.stringify(o,Do,2):String(o),Do=(o,a)=>a&&a.__v_isRef?Do(o,a.value):gr(a)?{[`Map(${a.size})`]:[...a.entries()].reduce((f,[h,d])=>(f[`${h} =>`]=d,f),{})}:Ro(a)?{[`Set(${a.size})`]:[...a.values()]}:St(a)&&!be(a)&&!vo(a)?String(a):a,$e={},dr=[],tn=()=>{},Tl=()=>!1,Sl=/^on[^a-z]/,ui=o=>Sl.test(o),us=o=>o.startsWith("onUpdate:"),_t=Object.assign,hs=(o,a)=>{const f=o.indexOf(a);f>-1&&o.splice(f,1)},bl=Object.prototype.hasOwnProperty,Le=(o,a)=>bl.call(o,a),be=Array.isArray,gr=o=>hi(o)==="[object Map]",Ro=o=>hi(o)==="[object Set]",Ne=o=>typeof o=="function",Tt=o=>typeof o=="string",ds=o=>typeof o=="symbol",St=o=>o!==null&&typeof o=="object",Lo=o=>St(o)&&Ne(o.then)&&Ne(o.catch),Bo=Object.prototype.toString,hi=o=>Bo.call(o),yl=o=>hi(o).slice(8,-1),vo=o=>hi(o)==="[object Object]",gs=o=>Tt(o)&&o!=="NaN"&&o[0]!=="-"&&""+parseInt(o,10)===o,ni=ls(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),di=o=>{const a=Object.create(null);return f=>a[f]||(a[f]=o(f))},Nl=/-(\w)/g,Ar=di(o=>o.replace(Nl,(a,f)=>f?f.toUpperCase():"")),_l=/\B([A-Z])/g,Er=di(o=>o.replace(_l,"-$1").toLowerCase()),Po=di(o=>o.charAt(0).toUpperCase()+o.slice(1)),Fi=di(o=>o?`on${Po(o)}`:""),Fr=(o,a)=>!Object.is(o,a),ki=(o,a)=>{for(let f=0;f<o.length;f++)o[f](a)},ii=(o,a,f)=>{Object.defineProperty(o,a,{configurable:!0,enumerable:!1,value:f})},Ml=o=>{const a=parseFloat(o);return isNaN(a)?o:a};let Zs;const Ol=()=>Zs||(Zs=typeof globalThis!="undefined"?globalThis:typeof self!="undefined"?self:typeof window!="undefined"?window:typeof global!="undefined"?global:{});let un;class Dl{constructor(a=!1){this.active=!0,this.effects=[],this.cleanups=[],!a&&un&&(this.parent=un,this.index=(un.scopes||(un.scopes=[])).push(this)-1)}run(a){if(this.active){const f=un;try{return un=this,a()}finally{un=f}}}on(){un=this}off(){un=this.parent}stop(a){if(this.active){let f,h;for(f=0,h=this.effects.length;f<h;f++)this.effects[f].stop();for(f=0,h=this.cleanups.length;f<h;f++)this.cleanups[f]();if(this.scopes)for(f=0,h=this.scopes.length;f<h;f++)this.scopes[f].stop(!0);if(this.parent&&!a){const d=this.par
|
|||
|
Copyright (c) Microsoft Corporation. All rights reserved.
|
|||
|
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
|||
|
this file except in compliance with the License. You may obtain a copy of the
|
|||
|
License at http://www.apache.org/licenses/LICENSE-2.0
|
|||
|
|
|||
|
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|||
|
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
|
|||
|
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
|
|||
|
MERCHANTABLITY OR NON-INFRINGEMENT.
|
|||
|
|
|||
|
See the Apache Version 2.0 License for specific language governing permissions
|
|||
|
and limitations under the License.
|
|||
|
***************************************************************************** */var h=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(A,e){A.__proto__=e}||function(A,e){for(var t in e)e.hasOwnProperty(t)&&(A[t]=e[t])};function d(A,e){h(A,e);function t(){this.constructor=A}A.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}function x(A,e){var t=Object.setPrototypeOf;t?t(A,e):A.__proto__=e}function p(A,e){e===void 0&&(e=A.constructor);var t=Error.captureStackTrace;t&&t(A,e)}var T=function(A){d(e,A);function e(t){var n=this.constructor,r=A.call(this,t)||this;return Object.defineProperty(r,"name",{value:n.name,enumerable:!1}),x(r,n.prototype),p(r),r}return e}(Error);class m extends T{constructor(e=void 0){super(e),this.message=e}getKind(){return this.constructor.kind}}m.kind="Exception";class S extends m{}S.kind="ArgumentException";class M extends m{}M.kind="IllegalArgumentException";class j{constructor(e){if(this.binarizer=e,e===null)throw new M("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 i=this.binarizer.getLuminanceSource().crop(e,t,n,r);return new j(this.binarizer.createBinarizer(i))}isRotateSupported(){return this.binarizer.getLuminanceSource().isRotateSupported()}rotateCounterClockwise(){const e=this.binarizer.getLuminanceSource().rotateCounterClockwise();return new j(this.binarizer.createBinarizer(e))}rotateCounterClockwise45(){const e=this.binarizer.getLuminanceSource().rotateCounterClockwise45();return new j(this.binarizer.createBinarizer(e))}toString(){try{return this.getBlackMatrix().toString()}catch{return""}}}class U extends m{static getChecksumInstance(){return new U}}U.kind="ChecksumException";class ne{constructor(e){this.source=e}getLuminanceSource(){return this.source}getWidth(){return this.source.getWidth()}getHeight(){return this.source.getHeight()}}class K{static arraycopy(e,t,n,r,i){for(;i--;)n[r++]=e[t++]}static currentTimeMillis(){return Date.now()}}class fe extends m{}fe.kind="IndexOutOfBoundsException";class ue extends fe{constructor(e=void 0,t=void 0){super(t),this.index=e,this.message=t}}ue.kind="ArrayIndexOutOfBoundsException";class ${static fill(e,t){for(let n=0,r=e.length;n<r;n++)e[n]=t}static fillWithin(e,t,n,r){$.rangeCheck(e.length,t,n);for(let i=t;i<n;i++)e[i]=r}static rangeCheck(e,t,n){if(t>n)throw new M("fromIndex("+t+") > toIndex("+n+")");if(t<0)throw new ue(t);if(n>e)throw new ue(n)}static asList(...e){return e}static create(e,t,n){return Array.from({length:e}).map(i=>Array.from({length:t}).fill(n))}static createInt32Array(e,t,n){return Array.from({length:e}).map(i=>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,i=new Int32Array(r);return K.arraycopy(e,t,i,0,r),i}static binarySearch(e,t,n){n===void 0&&(n=$.numberComparator);let r=0,i=e.length-1;for(;r<=i;){const s=i+r>>1,l=n(t,e[s]);if(l>0)r=s+1;else if(l<0)i=s-1;else return s}return-r-1}static numberComparator(e,t){return e-t}}class se{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===0&&(t+=16,e<<=16),e>>>24===0&&(t+=8,e<<=8),e>>>28===0&&(t+=4,e<<=4),e>>>30===0&&(t+=2,e<<=2),t-=e
|
|||
|
`||e.charAt(u)==="\r"){if(i>s){if(l===-1)l=i-s;else if(i-s!==l)throw new M("row lengths do not match");s=i,c++}u++}else if(e.substring(u,u+t.length)===t)u+=t.length,r[i]=!0,i++;else if(e.substring(u,u+n.length)===n)u+=n.length,r[i]=!1,i++;else throw new M("illegal character encountered: "+e.substring(u));if(i>s){if(l===-1)l=i-s;else if(i-s!==l)throw new M("row lengths do not match");c++}const g=new et(l,c);for(let w=0;w<i;w++)r[w]&&g.set(Math.floor(w%l),Math.floor(w/l));return g}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 M("input matrix dimensions do not match");const t=new Ee(Math.floor(this.width/32)+1),n=this.rowSize,r=this.bits;for(let i=0,s=this.height;i<s;i++){const l=i*n,c=e.getRow(i,t).getBitArray();for(let u=0;u<n;u++)r[l+u]^=c[u]}}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 M("Left and top must be nonnegative");if(r<1||n<1)throw new M("Height and width must be at least 1");const i=e+n,s=t+r;if(s>this.height||i>this.width)throw new M("The region must fit inside the matrix");const l=this.rowSize,c=this.bits;for(let u=t;u<s;u++){const g=u*l;for(let w=e;w<i;w++)c[g+Math.floor(w/32)]|=1<<(w&31)&4294967295}}getRow(e,t){t==null||t.getSize()<this.width?t=new Ee(this.width):t.clear();const n=this.rowSize,r=this.bits,i=e*n;for(let s=0;s<n;s++)t.setBulk(s*32,r[i+s]);return t}setRow(e,t){K.arraycopy(t.getBitArray(),0,this.bits,e*this.rowSize,this.rowSize)}rotate180(){const e=this.getWidth(),t=this.getHeight();let n=new Ee(e),r=new Ee(e);for(let i=0,s=Math.floor((t+1)/2);i<s;i++)n=this.getRow(i,n),r=this.getRow(t-1-i,r),n.reverse(),r.reverse(),this.setRow(i,r),this.setRow(t-1-i,n)}getEnclosingRectangle(){const e=this.width,t=this.height,n=this.rowSize,r=this.bits;let i=e,s=t,l=-1,c=-1;for(let u=0;u<t;u++)for(let g=0;g<n;g++){const w=r[u*n+g];if(w!==0){if(u<s&&(s=u),u>c&&(c=u),g*32<i){let E=0;for(;(w<<31-E&4294967295)===0;)E++;g*32+E<i&&(i=g*32+E)}if(g*32+31>l){let E=31;for(;w>>>E===0;)E--;g*32+E>l&&(l=g*32+E)}}}return l<i||c<s?null:Int32Array.from([i,s,l-i+1,c-s+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 i=n%e*32;const s=t[n];let l=0;for(;(s<<31-l&4294967295)===0;)l++;return i+=l,Int32Array.from([i,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 i=Math.floor(n%e)*32;const s=t[n];let l=31;for(;s>>>l===0;)l--;return i+=l,Int32Array.from([i,r])}getWidth(){return this.width}getHeight(){return this.height}getRowSize(){return this.rowSize}equals(e){if(!(e instanceof et))return!1;const t=e;return this.width===t.width&&this.height===t.height&&this.rowSize===t.rowSize&&$.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+$.hashCode(this.bits),e}toString(e="X ",t=" ",n=`
|
|||
|
`){return this.buildToString(e,t,n)}buildToString(e,t,n){let r=new Ie;for(let i=0,s=this.height;i<s;i++){for(let l=0,c=this.width;l<c;l++)r.append(this.get(l,i)?e:t);r.append(n)}return r.toString()}clone(){return new et(this.width,this.height,this.rowSize,this.bits.slice())}}class F extends m{static getNotFoundInstance(){return new F}}F.kind="NotFoundException";class ot extends ne{constructor(e){super(e),this.luminances=ot.EMPTY,this.buckets=new Int32Array(ot.LUMINANCE_BUCKETS)}getBlackRow(e,t){const n=this.getLuminanceSource(),r=n.getWidth();t==null||t.getSize()<r?t=new Ee(r):t.clear(),this.initArrays(r);const i=n.getRow(e,this.luminances),s=this.buckets;for(let c=0;c<r;c++)s[(i[c]&255)>>ot.LUMINANCE_SHIFT]++;const l=ot.estimateBlackPoint(s);if(r<3)for(let c=0;c<r;c++)(i[c]&255)<l&&t.set(c);else{let c=i[0]&255,u=i[1]&255;for(let g=1;g<r-1;g++){const w=i[g+1]&255;(u*4-c-w)/2<l&&t.set(g),c=u,u=w}}return t}getBlackMatrix(){const e=this.getLuminanceSource(),t=e.getWidth(),n=e.getHeight(),r=new et(t,n);this.initArrays(t);const i=this.buckets;for(let c=1;c<5;c++){const u=Math.floor(n*c/5),g=e.getRow(u,this.luminances),w=Math.floor(t*4/5);for(let E=Math.floor(t/5);E<w;E++){const I=g[E]&255;i[I>>ot.LUMINANCE_SHIFT]++}}const s=ot.estimateBlackPoint(i),l=e.getMatrix();for(let c=0;c<n;c++){const u=c*t;for(let g=0;g<t;g++)(l[u+g]&255)<s&&r.set(g,c)}return r}createBinarizer(e){return new ot(e)}initArrays(e){this.luminances.length<e&&(this.luminances=new Uint8ClampedArray(e));const t=this.buckets;for(let n=0;n<ot.LUMINANCE_BUCKETS;n++)t[n]=0}static estimateBlackPoint(e){const t=e.length;let n=0,r=0,i=0;for(let g=0;g<t;g++)e[g]>i&&(r=g,i=e[g]),e[g]>n&&(n=e[g]);let s=0,l=0;for(let g=0;g<t;g++){const w=g-r,E=e[g]*w*w;E>l&&(s=g,l=E)}if(r>s){const g=r;r=s,s=g}if(s-r<=t/16)throw new F;let c=s-1,u=-1;for(let g=s-1;g>r;g--){const w=g-r,E=w*w*(s-g)*(n-e[g]);E>u&&(c=g,u=E)}return c<<ot.LUMINANCE_SHIFT}}ot.LUMINANCE_BITS=5,ot.LUMINANCE_SHIFT=8-ot.LUMINANCE_BITS,ot.LUMINANCE_BUCKETS=1<<ot.LUMINANCE_BITS,ot.EMPTY=Uint8ClampedArray.from([0]);class he extends ot{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>=he.MINIMUM_DIMENSION&&n>=he.MINIMUM_DIMENSION){const r=e.getMatrix();let i=t>>he.BLOCK_SIZE_POWER;(t&he.BLOCK_SIZE_MASK)!==0&&i++;let s=n>>he.BLOCK_SIZE_POWER;(n&he.BLOCK_SIZE_MASK)!==0&&s++;const l=he.calculateBlackPoints(r,i,s,t,n),c=new et(t,n);he.calculateThresholdForBlock(r,i,s,t,n,l,c),this.matrix=c}else this.matrix=super.getBlackMatrix();return this.matrix}createBinarizer(e){return new he(e)}static calculateThresholdForBlock(e,t,n,r,i,s,l){const c=i-he.BLOCK_SIZE,u=r-he.BLOCK_SIZE;for(let g=0;g<n;g++){let w=g<<he.BLOCK_SIZE_POWER;w>c&&(w=c);const E=he.cap(g,2,n-3);for(let I=0;I<t;I++){let y=I<<he.BLOCK_SIZE_POWER;y>u&&(y=u);const N=he.cap(I,2,t-3);let O=0;for(let X=-2;X<=2;X++){const Z=s[E+X];O+=Z[N-2]+Z[N-1]+Z[N]+Z[N+1]+Z[N+2]}const B=O/25;he.thresholdBlock(e,y,w,B,r,l)}}}static cap(e,t,n){return e<t?t:e>n?n:e}static thresholdBlock(e,t,n,r,i,s){for(let l=0,c=n*i+t;l<he.BLOCK_SIZE;l++,c+=i)for(let u=0;u<he.BLOCK_SIZE;u++)(e[c+u]&255)<=r&&s.set(t+u,n+l)}static calculateBlackPoints(e,t,n,r,i){const s=i-he.BLOCK_SIZE,l=r-he.BLOCK_SIZE,c=new Array(n);for(let u=0;u<n;u++){c[u]=new Int32Array(t);let g=u<<he.BLOCK_SIZE_POWER;g>s&&(g=s);for(let w=0;w<t;w++){let E=w<<he.BLOCK_SIZE_POWER;E>l&&(E=l);let I=0,y=255,N=0;for(let B=0,X=g*r+E;B<he.BLOCK_SIZE;B++,X+=r){for(let Z=0;Z<he.BLOCK_SIZE;Z++){const W=e[X+Z]&255;I+=W,W<y&&(y=W),W>N&&(N=W)}if(N-y>he.MIN_DYNAMIC_RANGE)for(B++,X+=r;B<he.BLOCK_SIZE;B++,X+=r)for(let Z=0;Z<he.BLOCK_SIZE;Z++)I+=e[X+Z]&255}let O=I>>he.BLOCK_SIZE_POWER*2;if(N-y<=he.MIN_DYNAMIC_RANGE&&(O=y/2,u>0&&w>0)){const B=(c[u-1][w]+2*c[u][w-1]+c[u-1][w-1])/4;y<B&&(O=B)}c[u][w]=O}}return c}}he.BLOCK_SIZE_POWER=3,he.BLOCK_SIZE=1<<he.BLOCK_SIZE_POWER,he.BLOCK_SIZE_MASK=he.BLOCK_SIZE-1,he.MINIMUM_DIMENSION=he.BLOCK_SIZE*5,he.MIN_DYNAMIC_RANGE=24;class We{constructor(e,t){this.width=e,this.height=t}getWidth(){return t
|
|||
|
`)}return t.toString()}}class Re extends We{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 i=0;i<r;i++)n[i]=255-(n[i]&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 Re(this.delegate.crop(e,t,n,r))}isRotateSupported(){return this.delegate.isRotateSupported()}invert(){return this.delegate}rotateCounterClockwise(){return new Re(this.delegate.rotateCounterClockwise())}rotateCounterClockwise45(){return new Re(this.delegate.rotateCounterClockwise45())}}class xt extends We{constructor(e){super(e.width,e.height),this.canvas=e,this.tempCanvasElement=null,this.buffer=xt.makeBufferFromCanvasImageData(e)}static makeBufferFromCanvasImageData(e){const t=e.getContext("2d").getImageData(0,0,e.width,e.height);return xt.toGrayscaleBuffer(t.data,e.width,e.height)}static toGrayscaleBuffer(e,t,n){const r=new Uint8ClampedArray(t*n);for(let i=0,s=0,l=e.length;i<l;i+=4,s++){let c;if(e[i+3]===0)c=255;else{const g=e[i],w=e[i+1],E=e[i+2];c=306*g+601*w+117*E+512>>10}r[s]=c}return r}getRow(e,t){if(e<0||e>=this.getHeight())throw new M("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*xt.DEGREE_TO_RADIANS,i=this.canvas.width,s=this.canvas.height,l=Math.ceil(Math.abs(Math.cos(r))*i+Math.abs(Math.sin(r))*s),c=Math.ceil(Math.abs(Math.sin(r))*i+Math.abs(Math.cos(r))*s);return t.width=l,t.height=c,n.translate(l/2,c/2),n.rotate(r),n.drawImage(this.canvas,i/-2,s/-2),this.buffer=xt.makeBufferFromCanvasImageData(t),this}invert(){return new Re(this)}}xt.DEGREE_TO_RADIANS=Math.PI/180;class qn{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 ft=(globalThis||Dr||self||window||void 0)&&(globalThis||Dr||self||window||void 0).__awaiter||function(A,e,t,n){function r(i){return i instanceof t?i:new t(function(s){s(i)})}return new(t||(t=Promise))(function(i,s){function l(g){try{u(n.next(g))}catch(w){s(w)}}function c(g){try{u(n.throw(g))}catch(w){s(w)}}function u(g){g.done?i(g.value):r(g.value).then(l,c)}u((n=n.apply(A,e||[])).next())})};class Dt{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!="undefined"}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 ft(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 i=n.dev
|
|||
|
`,"\\13","\f","\r","\\33","\\34","\\35","\\36","\\37","@","\\","^","_","`","|","~","\\177","CTRL_LL","CTRL_UL","CTRL_PL","CTRL_BS"],P.PUNCT_TABLE=["","\r",`\r
|
|||
|
`,". ",", ",": ","!",'"',"#","$","%","&","'","(",")","*","+",",","-",".","/",":",";","<","=",">","?","[","]","{","}","CTRL_UL"],P.DIGIT_TABLE=["CTRL_PS"," ","0","1","2","3","4","5","6","7","8","9",",",".","CTRL_UL","CTRL_US"];class H{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 i=e-n,s=t-r;return Math.sqrt(i*i+s*s)}static sum(e){let t=0;for(let n=0,r=e.length;n!==r;n++)t+=e[n];return t}}class J{static floatToIntBits(e){return e}}J.MAX_VALUE=Number.MAX_SAFE_INTEGER;class R{constructor(e,t){this.x=e,this.y=t}getX(){return this.x}getY(){return this.y}equals(e){if(e instanceof R){const t=e;return this.x===t.x&&this.y===t.y}return!1}hashCode(){return 31*J.floatToIntBits(this.x)+J.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 i,s,l;if(n>=t&&n>=r?(s=e[0],i=e[1],l=e[2]):r>=n&&r>=t?(s=e[1],i=e[0],l=e[2]):(s=e[2],i=e[0],l=e[1]),this.crossProductZ(i,s,l)<0){const c=i;i=l,l=c}e[0]=i,e[1]=s,e[2]=l}static distance(e,t){return H.distance(e.x,e.y,t.x,t.y)}static crossProductZ(e,t,n){const r=t.x,i=t.y;return(n.x-r)*(e.y-i)-(n.y-i)*(e.x-r)}}class Q{constructor(e,t){this.bits=e,this.points=t}getBits(){return this.bits}getPoints(){return this.points}}class Y extends Q{constructor(e,t,n,r,i){super(e,t),this.compact=n,this.nbDatablocks=r,this.nbLayers=i}getNbLayers(){return this.nbLayers}getNbDatablocks(){return this.nbDatablocks}isCompact(){return this.compact}}class oe{constructor(e,t,n,r){this.image=e,this.height=e.getHeight(),this.width=e.getWidth(),t==null&&(t=oe.INIT_SIZE),n==null&&(n=e.getWidth()/2|0),r==null&&(r=e.getHeight()/2|0);const i=t/2|0;if(this.leftInit=n-i,this.rightInit=n+i,this.upInit=r-i,this.downInit=r+i,this.upInit<0||this.leftInit<0||this.downInit>=this.height||this.rightInit>=this.width)throw new F}detect(){let e=this.leftInit,t=this.rightInit,n=this.upInit,r=this.downInit,i=!1,s=!0,l=!1,c=!1,u=!1,g=!1,w=!1;const E=this.width,I=this.height;for(;s;){s=!1;let y=!0;for(;(y||!c)&&t<E;)y=this.containsBlackPoint(n,r,t,!1),y?(t++,s=!0,c=!0):c||t++;if(t>=E){i=!0;break}let N=!0;for(;(N||!u)&&r<I;)N=this.containsBlackPoint(e,t,r,!0),N?(r++,s=!0,u=!0):u||r++;if(r>=I){i=!0;break}let O=!0;for(;(O||!g)&&e>=0;)O=this.containsBlackPoint(n,r,e,!1),O?(e--,s=!0,g=!0):g||e--;if(e<0){i=!0;break}let B=!0;for(;(B||!w)&&n>=0;)B=this.containsBlackPoint(e,t,n,!0),B?(n--,s=!0,w=!0):w||n--;if(n<0){i=!0;break}s&&(l=!0)}if(!i&&l){const y=t-e;let N=null;for(let Z=1;N===null&&Z<y;Z++)N=this.getBlackPointOnSegment(e,r-Z,e+Z,r);if(N==null)throw new F;let O=null;for(let Z=1;O===null&&Z<y;Z++)O=this.getBlackPointOnSegment(e,n+Z,e+Z,n);if(O==null)throw new F;let B=null;for(let Z=1;B===null&&Z<y;Z++)B=this.getBlackPointOnSegment(t,n+Z,t-Z,n);if(B==null)throw new F;let X=null;for(let Z=1;X===null&&Z<y;Z++)X=this.getBlackPointOnSegment(t,r-Z,t-Z,r);if(X==null)throw new F;return this.centerEdges(X,N,B,O)}else throw new F}getBlackPointOnSegment(e,t,n,r){const i=H.round(H.distance(e,t,n,r)),s=(n-e)/i,l=(r-t)/i,c=this.image;for(let u=0;u<i;u++){const g=H.round(e+u*s),w=H.round(t+u*l);if(c.get(g,w))return new R(g,w)}return null}centerEdges(e,t,n,r){const i=e.getX(),s=e.getY(),l=t.getX(),c=t.getY(),u=n.getX(),g=n.getY(),w=r.getX(),E=r.getY(),I=oe.CORR;return i<this.width/2?[new R(w-I,E+I),new R(l+I,c+I),new R(u-I,g-I),new R(i+I,s-I)]:[new R(w+I,E+I),new R(l+I,c-I),new R(u-I,g+I),new R(i-I,s-I)]}containsBlackPoint(e,t,n,r){const i=this.image;if(r){for(let s=e;s<=t;s++)if(i.get(s,n))return!0}else for(let s=e;s<=t;s++)if(i.get(n,s))return!0;return!1}}oe.INIT_SIZE=10,oe.CORR=1;class ie{static checkAndNudgePoints(e,t){const n=e.getWidth(),r=e.getHeight();let i=!0;for(let s=0;s<t.length&&i;s+=2){const l=Math.floor(t[s]),c=Math.floor(t[s+1]);if(l<-1||l>n||c<-1||c>r)throw new F;i=!1,l===-1?(t[s]=0,i=!0):l===n&&(t[s]=n-1,i=!0),c===-1?(t[s+1]=0,i=!0):c===r&&(t[s+1]=r-1,i=!0)}i=!0;for(le
|
|||
|
`+super.toString()}}class yr{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=Ae.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 i=this.detectionResultColumns[r].getCodewords()[n];i!=null&&(i.setRowNumber(e[n].getRowNumber()),i.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(),i=0;for(let s=this.barcodeColumnCount+1;s>0&&i<this.ADJUST_ROW_NUMBER_SKIP;s--){let l=this.detectionResultColumns[s].getCodewords()[n];l!=null&&(i=yr.adjustRowNumberIfValid(r,i,l),l.hasValidRowNumber()||e++)}}return e}adjustRowNumbersFromLRI(){if(this.detectionResultColumns[0]==null)return 0;let e=0,t=this.detectionResultColumns[0].getCodewords();for(let n=0;n<t.length;n++){if(t[n]==null)continue;let r=t[n].getRowNumber(),i=0;for(let s=1;s<this.barcodeColumnCount+1&&i<this.ADJUST_ROW_NUMBER_SKIP;s++){let l=this.detectionResultColumns[s].getCodewords()[n];l!=null&&(i=yr.adjustRowNumberIfValid(r,i,l),l.hasValidRowNumber()||e++)}}return e}static adjustRowNumberIfValid(e,t,n){return n==null||n.hasValidRowNumber()||(n.isValidRowNumber(e)?(n.setRowNumber(e),t=0):++t),t}adjustRowNumbers(e,t,n){let r=n[t],i=this.detectionResultColumns[e-1].getCodewords(),s=i;this.detectionResultColumns[e+1]!=null&&(s=this.detectionResultColumns[e+1].getCodewords());let l=new Array(14);l[2]=i[t],l[3]=s[t],t>0&&(l[0]=n[t-1],l[4]=i[t-1],l[5]=s[t-1]),t>1&&(l[8]=n[t-2],l[10]=i[t-2],l[11]=s[t-2]),t<n.length-1&&(l[1]=n[t+1],l[6]=i[t+1],l[7]=s[t+1]),t<n.length-2&&(l[9]=n[t+2],l[12]=i[t+2],l[13]=s[t+2]);for(let c of l)if(yr.adjustRowNumber(r,c))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 Tr;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 i=this.detectionResultColumns[r].getCodewords()[n];if(i==null){t.format(" | ");continue}t.fo
|
|||
|
-.$/"|*()?{}'`,L.MIXED_CHARS="0123456789&\r ,:#-.$/+%*=^",L.EXP900=js()?tl():[],L.NUMBER_OF_SEQUENCE_CODEWORDS=2;class ye{constructor(){}static decode(e,t,n,r,i,s,l){let c=new Un(e,t,n,r,i),u=null,g=null,w;for(let y=!0;;y=!1){if(t!=null&&(u=ye.getRowIndicatorColumn(e,c,t,!0,s,l)),r!=null&&(g=ye.getRowIndicatorColumn(e,c,r,!1,s,l)),w=ye.merge(u,g),w==null)throw F.getNotFoundInstance();let N=w.getBoundingBox();if(y&&N!=null&&(N.getMinY()<c.getMinY()||N.getMaxY()>c.getMaxY()))c=N;else break}w.setBoundingBox(c);let E=w.getBarcodeColumnCount()+1;w.setDetectionResultColumn(0,u),w.setDetectionResultColumn(E,g);let I=u!=null;for(let y=1;y<=E;y++){let N=I?y:E-y;if(w.getDetectionResultColumn(N)!==void 0)continue;let O;N===0||N===E?O=new Fs(c,N===0):O=new Sr(c),w.setDetectionResultColumn(N,O);let B=-1,X=B;for(let Z=c.getMinY();Z<=c.getMaxY();Z++){if(B=ye.getStartColumn(w,N,Z,I),B<0||B>c.getMaxX()){if(X===-1)continue;B=X}let W=ye.detectCodeword(e,c.getMinX(),c.getMaxX(),I,B,Z,s,l);W!=null&&(O.setCodeword(Z,W),X=B,s=Math.min(s,W.getWidth()),l=Math.max(l,W.getWidth()))}}return ye.createDecoderResult(w)}static merge(e,t){if(e==null&&t==null)return null;let n=ye.getBarcodeMetadata(e,t);if(n==null)return null;let r=Un.merge(ye.adjustBoundingBox(e),ye.adjustBoundingBox(t));return new yr(n,r)}static adjustBoundingBox(e){if(e==null)return null;let t=e.getRowHeights();if(t==null)return null;let n=ye.getMax(t),r=0;for(let l of t)if(r+=n-l,l>0)break;let i=e.getCodewords();for(let l=0;r>0&&i[l]==null;l++)r--;let s=0;for(let l=t.length-1;l>=0&&(s+=n-t[l],!(t[l]>0));l--);for(let l=i.length-1;s>0&&i[l]==null;l--)s--;return e.getBoundingBox().addMissingRows(r,s,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,i,s){let l=new Fs(t,r);for(let c=0;c<2;c++){let u=c===0?1:-1,g=Math.trunc(Math.trunc(n.getX()));for(let w=Math.trunc(Math.trunc(n.getY()));w<=t.getMaxY()&&w>=t.getMinY();w+=u){let E=ye.detectCodeword(e,0,e.getWidth(),r,g,w,i,s);E!=null&&(l.setCodeword(w,E),r?g=E.getStartX():g=E.getEndX())}}return l}static adjustCodewordCount(e,t){let n=t[0][1],r=n.getValue(),i=e.getBarcodeColumnCount()*e.getBarcodeRowCount()-ye.getNumberOfECCodeWords(e.getBarcodeECLevel());if(r.length===0){if(i<1||i>Ae.MAX_CODEWORDS_IN_BARCODE)throw F.getNotFoundInstance();n.setValue(i)}else r[0]!==i&&n.setValue(i)}static createDecoderResult(e){let t=ye.createBarcodeMatrix(e);ye.adjustCodewordCount(e,t);let n=new Array,r=new Int32Array(e.getBarcodeRowCount()*e.getBarcodeColumnCount()),i=[],s=new Array;for(let c=0;c<e.getBarcodeRowCount();c++)for(let u=0;u<e.getBarcodeColumnCount();u++){let g=t[c][u+1].getValue(),w=c*e.getBarcodeColumnCount()+u;g.length===0?n.push(w):g.length===1?r[w]=g[0]:(s.push(w),i.push(g))}let l=new Array(i.length);for(let c=0;c<l.length;c++)l[c]=i[c];return ye.createDecoderResultFromAmbiguousValues(e.getBarcodeECLevel(),r,Ae.toIntArray(n),Ae.toIntArray(s),l)}static createDecoderResultFromAmbiguousValues(e,t,n,r,i){let s=new Int32Array(r.length),l=100;for(;l-- >0;){for(let c=0;c<s.length;c++)t[r[c]]=i[c][s[c]];try{return ye.decodeCodewords(t,e,n)}catch(c){if(!(c instanceof U))throw c}if(s.length===0)throw U.getChecksumInstance();for(let c=0;c<s.length;c++)if(s[c]<i[c].length-1){s[c]++;break}else if(s[c]=0,c===s.length-1)throw U.getChecksumInstance()}throw U.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 i=0;i<t[r].length;i++)t[r][i]=new br;let n=0;for(let r of e.getDetectionResultColumns()){if(r!=null){for(let i of r.getCodewords())if(i!=null){let s=i.getRowNumber();if(s>=0){if(s>=t.length)continue;t[s][n].setValue(i.getValue())}}}n++}return t
|
|||
|
`)}return e.toString()}}class Hn{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 Ie;return e.append(`<<
|
|||
|
`),e.append(" mode: "),e.append(this.mode?this.mode.toString():"null"),e.append(`
|
|||
|
ecLevel: `),e.append(this.ecLevel?this.ecLevel.toString():"null"),e.append(`
|
|||
|
version: `),e.append(this.version?this.version.toString():"null"),e.append(`
|
|||
|
maskPattern: `),e.append(this.maskPattern.toString()),this.matrix?(e.append(`
|
|||
|
matrix:
|
|||
|
`),e.append(this.matrix.toString())):e.append(`
|
|||
|
matrix: null
|
|||
|
`),e.append(`>>
|
|||
|
`),e.toString()}setMode(e){this.mode=e}setECLevel(e){this.ecLevel=e}setVersion(e){this.version=e}setMaskPattern(e){this.maskPattern=e}setMatrix(e){this.matrix=e}static isValidMaskPattern(e){return e>=0&&e<Hn.NUM_MASK_PATTERNS}}Hn.NUM_MASK_PATTERNS=8;class Ke extends m{}Ke.kind="WriterException";class xe{constructor(){}static clearMatrix(e){e.clear(255)}static buildMatrix(e,t,n,r,i){xe.clearMatrix(i),xe.embedBasicPatterns(n,i),xe.embedTypeInfo(t,r,i),xe.maybeEmbedVersionInfo(n,i),xe.embedDataBits(e,r,i)}static embedBasicPatterns(e,t){xe.embedPositionDetectionPatternsAndSeparators(t),xe.embedDarkDotAtLeftBottomCorner(t),xe.maybeEmbedPositionAdjustmentPatterns(e,t),xe.embedTimingPatterns(t)}static embedTypeInfo(e,t,n){const r=new Ee;xe.makeTypeInfoBits(e,t,r);for(let i=0,s=r.getSize();i<s;++i){const l=r.get(r.getSize()-1-i),c=xe.TYPE_INFO_COORDINATES[i],u=c[0],g=c[1];if(n.setBoolean(u,g,l),i<8){const w=n.getWidth()-i-1,E=8;n.setBoolean(w,E,l)}else{const E=n.getHeight()-7+(i-8);n.setBoolean(8,E,l)}}}static maybeEmbedVersionInfo(e,t){if(e.getVersionNumber()<7)return;const n=new Ee;xe.makeVersionInfoBits(e,n);let r=6*3-1;for(let i=0;i<6;++i)for(let s=0;s<3;++s){const l=n.get(r);r--,t.setBoolean(i,t.getHeight()-11+s,l),t.setBoolean(t.getHeight()-11+s,i,l)}}static embedDataBits(e,t,n){let r=0,i=-1,s=n.getWidth()-1,l=n.getHeight()-1;for(;s>0;){for(s===6&&(s-=1);l>=0&&l<n.getHeight();){for(let c=0;c<2;++c){const u=s-c;if(!xe.isEmpty(n.get(u,l)))continue;let g;r<e.getSize()?(g=e.get(r),++r):g=!1,t!==255&<.getDataMaskBit(t,u,l)&&(g=!g),n.setBoolean(u,l,g)}l+=i}i=-i,l+=i,s-=2}if(r!==e.getSize())throw new Ke("Not all bits consumed: "+r+"/"+e.getSize())}static findMSBSet(e){return 32-se.numberOfLeadingZeros(e)}static calculateBCHCode(e,t){if(t===0)throw new M("0 polynomial");const n=xe.findMSBSet(t);for(e<<=n-1;xe.findMSBSet(e)>=n;)e^=t<<xe.findMSBSet(e)-n;return e}static makeTypeInfoBits(e,t,n){if(!Hn.isValidMaskPattern(t))throw new Ke("Invalid mask pattern");const r=e.getBits()<<3|t;n.appendBits(r,5);const i=xe.calculateBCHCode(r,xe.TYPE_INFO_POLY);n.appendBits(i,10);const s=new Ee;if(s.appendBits(xe.TYPE_INFO_MASK_PATTERN,15),n.xor(s),n.getSize()!==15)throw new Ke("should not happen but we got: "+n.getSize())}static makeVersionInfoBits(e,t){t.appendBits(e.getVersionNumber(),6);const n=xe.calculateBCHCode(e.getVersionNumber(),xe.VERSION_INFO_POLY);if(t.appendBits(n,12),t.getSize()!==18)throw new Ke("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;xe.isEmpty(e.get(t,6))&&e.setNumber(t,6,n),xe.isEmpty(e.get(6,t))&&e.setNumber(6,t,n)}}static embedDarkDotAtLeftBottomCorner(e){if(e.get(8,e.getHeight()-8)===0)throw new Ke;e.setNumber(8,e.getHeight()-8,1)}static embedHorizontalSeparationPattern(e,t,n){for(let r=0;r<8;++r){if(!xe.isEmpty(n.get(e+r,t)))throw new Ke;n.setNumber(e+r,t,0)}}static embedVerticalSeparationPattern(e,t,n){for(let r=0;r<7;++r){if(!xe.isEmpty(n.get(e,t+r)))throw new Ke;n.setNumber(e,t+r,0)}}static embedPositionAdjustmentPattern(e,t,n){for(let r=0;r<5;++r){const i=xe.POSITION_ADJUSTMENT_PATTERN[r];for(let s=0;s<5;++s)n.setNumber(e+s,t+r,i[s])}}static embedPositionDetectionPattern(e,t,n){for(let r=0;r<7;++r){const i=xe.POSITION_DETECTION_PATTERN[r];for(let s=0;s<7;++s)n.setNumber(e+s,t+r,i[s])}}static embedPositionDetectionPatternsAndSeparators(e){const t=xe.POSITION_DETECTION_PATTERN[0].length;xe.embedPositionDetectionPattern(0,0,e),xe.embedPositionDetectionPattern(e.getWidth()-t,0,e),xe.embedPositionDetectionPattern(0,e.getWidth()-t,e);const n=8;xe.embedHorizontalSeparationPattern(0,n-1,e),xe.embedHorizontalSeparationPattern(e.getWidth()-n,n-1,e),xe.embedHorizontalSeparationPattern(0,e.getWidth()-n,e);const r=7;xe.embedVerticalSeparationPattern(r,0,e),xe.embedVerticalSeparationPattern(e.getHeight()-r-1,0,e),xe.embedVerticalSeparationPattern(r,e.getHeight()-r,e)}static maybeEmbedPositionAdjustmentPatterns(e,t){if(e.getVersionNumber()<2)return;const n=e.getVersionNumber()-1,r=xe.POSITION_ADJUSTMENT_PATTERN_COO
|
|||
|
`,"\v","\f","\r","\x1B","","","","","@","\\","^","_","`","|","~","\x7F"];for(let E=0;E<g.length;E++)A[Gs][le.getCharCode(g[E])]=E;const w=["\0","\r","\0","\0","\0","\0","!","'","#","$","%","&","'","(",")","*","+",",","-",".","/",":",";","<","=",">","?","[","]","{","}"];for(let E=0;E<w.length;E++)le.getCharCode(w[E])>0&&(A[ln][le.getCharCode(w[E])]=E);return A}const Pi=hl($.createInt32Array(5,256));class Mr{constructor(e){this.text=e}encode(){const e=le.getCharCode(" "),t=le.getCharCode(`
|
|||
|
`);let n=Ys.singletonList(cn.INITIAL_STATE);for(let i=0;i<this.text.length;i++){let s,l=i+1<this.text.length?this.text[i+1]:0;switch(this.text[i]){case le.getCharCode("\r"):s=l===t?2:0;break;case le.getCharCode("."):s=l===e?3:0;break;case le.getCharCode(","):s=l===e?4:0;break;case le.getCharCode(":"):s=l===e?5:0;break;default:s=0}s>0?(n=Mr.updateStateListForPair(n,i,s),i++):n=this.updateStateListForChar(n,i)}return Ys.min(n,(i,s)=>i.getBitCount()-s.getBitCount()).toBitArray(this.text)}updateStateListForChar(e,t){const n=[];for(let r of e)this.updateStateForChar(r,t,n);return Mr.simplifyStates(n)}updateStateForChar(e,t,n){let r=this.text[t]&255,i=Pi[e.getMode()][r]>0,s=null;for(let l=0;l<=ln;l++){let c=Pi[l][r];if(c>0){if(s==null&&(s=e.endBinaryShift(t)),!i||l===e.getMode()||l===Yt){const u=s.latchAndAppend(l,c);n.push(u)}if(!i&&Xs[e.getMode()][l]>=0){const u=s.shiftAndAppend(l,c);n.push(u)}}}if(e.getBinaryShiftByteCount()>0||Pi[e.getMode()][r]===0){let l=e.addBinaryShiftChar(t);n.push(l)}}static updateStateListForPair(e,t,n){const r=[];for(let i of e)this.updateStateForPair(i,t,n,r);return this.simplifyStates(r)}static updateStateForPair(e,t,n,r){let i=e.endBinaryShift(t);if(r.push(i.latchAndAppend(ln,n)),e.getMode()!==ln&&r.push(i.shiftAndAppend(ln,n)),n===3||n===4){let s=i.latchAndAppend(Yt,16-n).latchAndAppend(Yt,1);r.push(s)}if(e.getBinaryShiftByteCount()>0){let s=e.addBinaryShiftChar(t).addBinaryShiftChar(t+1);r.push(s)}}static simplifyStates(e){let t=[];for(const n of e){let r=!0;for(const i of t){if(i.isBetterThanOrEqualTo(n)){r=!1;break}n.isBetterThanOrEqualTo(i)&&(t=t.filter(s=>s!==i))}r&&t.push(n)}return t}}class Be{constructor(){}static encodeBytes(e){return Be.encode(e,Be.DEFAULT_EC_PERCENT,Be.DEFAULT_AZTEC_LAYERS)}static encode(e,t,n){let r=new Mr(e).encode(),i=se.truncDivision(r.getSize()*t,100)+11,s=r.getSize()+i,l,c,u,g,w;if(n!==Be.DEFAULT_AZTEC_LAYERS){if(l=n<0,c=Math.abs(n),c>(l?Be.MAX_NB_BITS_COMPACT:Be.MAX_NB_BITS))throw new M(le.format("Illegal value %s for layers",n));u=Be.totalBitsInLayer(c,l),g=Be.WORD_SIZE[c];let W=u-u%g;if(w=Be.stuffBits(r,g),w.getSize()+i>W)throw new M("Data to large for user specified layer");if(l&&w.getSize()>g*64)throw new M("Data to large for user specified layer")}else{g=0,w=null;for(let W=0;;W++){if(W>Be.MAX_NB_BITS)throw new M("Data too large for an Aztec code");if(l=W<=3,c=l?W+1:W,u=Be.totalBitsInLayer(c,l),s>u)continue;(w==null||g!==Be.WORD_SIZE[c])&&(g=Be.WORD_SIZE[c],w=Be.stuffBits(r,g));let Me=u-u%g;if(!(l&&w.getSize()>g*64)&&w.getSize()+i<=Me)break}}let E=Be.generateCheckWords(w,u,g),I=w.getSize()/g,y=Be.generateModeMessage(l,c,I),N=(l?11:14)+c*4,O=new Int32Array(N),B;if(l){B=N;for(let W=0;W<O.length;W++)O[W]=W}else{B=N+1+2*se.truncDivision(se.truncDivision(N,2)-1,15);let W=se.truncDivision(N,2),Me=se.truncDivision(B,2);for(let Ce=0;Ce<W;Ce++){let vt=Ce+se.truncDivision(Ce,15);O[W-Ce-1]=Me-vt-1,O[W+Ce]=Me+vt+1}}let X=new et(B);for(let W=0,Me=0;W<c;W++){let Ce=(c-W)*4+(l?9:12);for(let vt=0;vt<Ce;vt++){let qt=vt*2;for(let Pt=0;Pt<2;Pt++)E.get(Me+qt+Pt)&&X.set(O[W*2+Pt],O[W*2+vt]),E.get(Me+Ce*2+qt+Pt)&&X.set(O[W*2+vt],O[N-1-W*2-Pt]),E.get(Me+Ce*4+qt+Pt)&&X.set(O[N-1-W*2-Pt],O[N-1-W*2-vt]),E.get(Me+Ce*6+qt+Pt)&&X.set(O[N-1-W*2-vt],O[W*2+Pt])}Me+=Ce*8}if(Be.drawModeMessage(X,l,B,y),l)Be.drawBullsEye(X,se.truncDivision(B,2),5);else{Be.drawBullsEye(X,se.truncDivision(B,2),7);for(let W=0,Me=0;W<se.truncDivision(N,2)-1;W+=15,Me+=16)for(let Ce=se.truncDivision(B,2)&1;Ce<B;Ce+=2)X.set(se.truncDivision(B,2)-Me,Ce),X.set(se.truncDivision(B,2)+Me,Ce),X.set(Ce,se.truncDivision(B,2)-Me),X.set(Ce,se.truncDivision(B,2)+Me)}let Z=new Ws;return Z.setCompact(l),Z.setSize(B),Z.setLayers(c),Z.setCodeWords(I),Z.setMatrix(X),Z}static drawBullsEye(e,t,n){for(let r=0;r<n;r+=2)for(let i=t-r;i<=t+r;i++)e.set(i,t-r),e.set(i,t+r),e.set(t-r,i),e.set(t+r,i);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 Ee;return e?(r.appendBits(t-1,2),r.appendBits(n-1,6),r=Be.generateCheckWords(r,28,4)):(r.appendBits(t
|