@qr-platform/qr-code.js 0.11.8 → 0.11.10
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/lib/browser.d.ts +3 -0
- package/lib/browser.js +8 -0
- package/lib/chunks/{zbar-scan-validator-CdUmQrkV.js → zbar-scan-validator-CPwNKIiK.js} +1 -1
- package/lib/chunks/zxing-scan-validator-BhQsyUDu.js +1 -0
- package/lib/esm.js +8 -0
- package/lib/index.js +1 -1
- package/lib/node/browser.d.ts +3 -0
- package/lib/node.js +1 -1
- package/package.json +1 -1
- package/lib/chunks/zxing-scan-validator-BF0vLC4Z.js +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@qr-platform/qr-code.js",
|
|
3
|
-
"version": "0.11.
|
|
3
|
+
"version": "0.11.10",
|
|
4
4
|
"description": "QRCode.js is a professional JavaScript/TypeScript library for creating customized QR codes, offering a blend of simplicity and sophistication. With versatile styling options—dot shapes, colors, gradients, embedded images, borders, and text—it enables you to design unique, visually appealing QR codes that work flawlessly with standard scanners. QRCode.js is part of QR-Platform: All-in-One QR Codes Management Solution.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./lib/node.js",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{A as t}from"./zbar-scan-validator-CdUmQrkV.js";var e,r,n,s,i,o,a,h,l=(e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},e(t,r)},function(t,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}),c=function(t){function e(e,r){var n,s,i,o=this.constructor,a=t.call(this,e,r)||this;return Object.defineProperty(a,"name",{value:o.name,enumerable:!1,configurable:!0}),n=a,s=o.prototype,(i=Object.setPrototypeOf)?i(n,s):n.__proto__=s,function(t,e){void 0===e&&(e=t.constructor);var r=Error.captureStackTrace;r&&r(t,e)}(a),a}return l(e,t),e}(Error);class u extends c{constructor(t=void 0){super(t),this.message=t}getKind(){return this.constructor.kind}}u.kind="Exception";class w extends u{static getNotFoundInstance(){return new w}}w.kind="NotFoundException",function(t){t[t.AZTEC=0]="AZTEC",t[t.CODABAR=1]="CODABAR",t[t.CODE_39=2]="CODE_39",t[t.CODE_93=3]="CODE_93",t[t.CODE_128=4]="CODE_128",t[t.DATA_MATRIX=5]="DATA_MATRIX",t[t.EAN_8=6]="EAN_8",t[t.EAN_13=7]="EAN_13",t[t.ITF=8]="ITF",t[t.MAXICODE=9]="MAXICODE",t[t.PDF_417=10]="PDF_417",t[t.QR_CODE=11]="QR_CODE",t[t.RSS_14=12]="RSS_14",t[t.RSS_EXPANDED=13]="RSS_EXPANDED",t[t.UPC_A=14]="UPC_A",t[t.UPC_E=15]="UPC_E",t[t.UPC_EAN_EXTENSION=16]="UPC_EAN_EXTENSION"}(r||(r={}));class d extends u{}d.kind="IllegalArgumentException";class f extends u{}f.kind="IndexOutOfBoundsException";class g extends f{constructor(t,e){super(e),this.index=t,this.message=e}}g.kind="ArrayIndexOutOfBoundsException";class m{static arraycopy(t,e,r,n,s){if(t===r&&e<n)for(n+=s-1,e+=s-1;s--;)r[n--]=t[e--];else for(;s--;)r[n++]=t[e++]}static currentTimeMillis(){return Date.now()}}class I{static fill(t,e){for(let r=0,n=t.length;r<n;r++)t[r]=e}static fillWithin(t,e,r,n){I.rangeCheck(t.length,e,r);for(let s=e;s<r;s++)t[s]=n}static rangeCheck(t,e,r){if(e>r)throw new d("fromIndex("+e+") > toIndex("+r+")");if(e<0)throw new g(e);if(r>t)throw new g(r)}static asList(...t){return t}static create(t,e,r){return Array.from({length:t}).map((t=>Array.from({length:e}).fill(r)))}static createInt32Array(t,e,r){return Array.from({length:t}).map((t=>Int32Array.from({length:e}).fill(r)))}static equals(t,e){if(!t)return!1;if(!e)return!1;if(!t.length)return!1;if(!e.length)return!1;if(t.length!==e.length)return!1;for(let r=0,n=t.length;r<n;r++)if(t[r]!==e[r])return!1;return!0}static hashCode(t){if(null===t)return 0;let e=1;for(const r of t)e=31*e+r;return e}static fillUint8Array(t,e){for(let r=0;r!==t.length;r++)t[r]=e}static copyOf(t,e){return t.slice(0,e)}static copyOfUint8Array(t,e){if(t.length<=e){const r=new Uint8Array(e);return r.set(t),r}return t.slice(0,e)}static copyOfRange(t,e,r){const n=r-e,s=new Int32Array(n);return m.arraycopy(t,e,s,0,n),s}static binarySearch(t,e,r){void 0===r&&(r=I.numberComparator);let n=0,s=t.length-1;for(;n<=s;){const i=s+n>>1,o=r(e,t[i]);if(o>0)n=i+1;else{if(!(o<0))return i;s=i-1}}return-n-1}static numberComparator(t,e){return t-e}}!function(t){t[t.OTHER=0]="OTHER",t[t.PURE_BARCODE=1]="PURE_BARCODE",t[t.POSSIBLE_FORMATS=2]="POSSIBLE_FORMATS",t[t.TRY_HARDER=3]="TRY_HARDER",t[t.CHARACTER_SET=4]="CHARACTER_SET",t[t.ALLOWED_LENGTHS=5]="ALLOWED_LENGTHS",t[t.ASSUME_CODE_39_CHECK_DIGIT=6]="ASSUME_CODE_39_CHECK_DIGIT",t[t.ENABLE_CODE_39_EXTENDED_MODE=7]="ENABLE_CODE_39_EXTENDED_MODE",t[t.ASSUME_GS1=8]="ASSUME_GS1",t[t.RETURN_CODABAR_START_END=9]="RETURN_CODABAR_START_END",t[t.NEED_RESULT_POINT_CALLBACK=10]="NEED_RESULT_POINT_CALLBACK",t[t.ALLOWED_EAN_EXTENSIONS=11]="ALLOWED_EAN_EXTENSIONS"}(n||(n={}));class S extends u{static getFormatInstance(){return new S}}S.kind="FormatException",function(t){t[t.Cp437=0]="Cp437",t[t.ISO8859_1=1]="ISO8859_1",t[t.ISO8859_2=2]="ISO8859_2",t[t.ISO8859_3=3]="ISO8859_3",t[t.ISO8859_4=4]="ISO8859_4",t[t.ISO8859_5=5]="ISO8859_5",t[t.ISO8859_6=6]="ISO8859_6",t[t.ISO8859_7=7]="ISO8859_7",t[t.ISO8859_8=8]="ISO8859_8",t[t.ISO8859_9=9]="ISO8859_9",t[t.ISO8859_10=10]="ISO8859_10",t[t.ISO8859_11=11]="ISO8859_11",t[t.ISO8859_13=12]="ISO8859_13",t[t.ISO8859_14=13]="ISO8859_14",t[t.ISO8859_15=14]="ISO8859_15",t[t.ISO8859_16=15]="ISO8859_16",t[t.SJIS=16]="SJIS",t[t.Cp1250=17]="Cp1250",t[t.Cp1251=18]="Cp1251",t[t.Cp1252=19]="Cp1252",t[t.Cp1256=20]="Cp1256",t[t.UnicodeBigUnmarked=21]="UnicodeBigUnmarked",t[t.UTF8=22]="UTF8",t[t.ASCII=23]="ASCII",t[t.Big5=24]="Big5",t[t.GB18030=25]="GB18030",t[t.EUC_KR=26]="EUC_KR"}(s||(s={}));class A{constructor(t,e,r,...n){this.valueIdentifier=t,this.name=r,this.values="number"==typeof e?Int32Array.from([e]):e,this.otherEncodingNames=n,A.VALUE_IDENTIFIER_TO_ECI.set(t,this),A.NAME_TO_ECI.set(r,this);const s=this.values;for(let t=0,e=s.length;t!==e;t++){const e=s[t];A.VALUES_TO_ECI.set(e,this)}for(const t of n)A.NAME_TO_ECI.set(t,this)}getValueIdentifier(){return this.valueIdentifier}getName(){return this.name}getValue(){return this.values[0]}static getCharacterSetECIByValue(t){if(t<0||t>=900)throw new S("incorect value");const e=A.VALUES_TO_ECI.get(t);if(void 0===e)throw new S("incorect value");return e}static getCharacterSetECIByName(t){const e=A.NAME_TO_ECI.get(t);if(void 0===e)throw new S("incorect value");return e}equals(t){if(!(t instanceof A))return!1;const e=t;return this.getName()===e.getName()}}A.VALUE_IDENTIFIER_TO_ECI=new Map,A.VALUES_TO_ECI=new Map,A.NAME_TO_ECI=new Map,A.Cp437=new A(s.Cp437,Int32Array.from([0,2]),"Cp437"),A.ISO8859_1=new A(s.ISO8859_1,Int32Array.from([1,3]),"ISO-8859-1","ISO88591","ISO8859_1"),A.ISO8859_2=new A(s.ISO8859_2,4,"ISO-8859-2","ISO88592","ISO8859_2"),A.ISO8859_3=new A(s.ISO8859_3,5,"ISO-8859-3","ISO88593","ISO8859_3"),A.ISO8859_4=new A(s.ISO8859_4,6,"ISO-8859-4","ISO88594","ISO8859_4"),A.ISO8859_5=new A(s.ISO8859_5,7,"ISO-8859-5","ISO88595","ISO8859_5"),A.ISO8859_6=new A(s.ISO8859_6,8,"ISO-8859-6","ISO88596","ISO8859_6"),A.ISO8859_7=new A(s.ISO8859_7,9,"ISO-8859-7","ISO88597","ISO8859_7"),A.ISO8859_8=new A(s.ISO8859_8,10,"ISO-8859-8","ISO88598","ISO8859_8"),A.ISO8859_9=new A(s.ISO8859_9,11,"ISO-8859-9","ISO88599","ISO8859_9"),A.ISO8859_10=new A(s.ISO8859_10,12,"ISO-8859-10","ISO885910","ISO8859_10"),A.ISO8859_11=new A(s.ISO8859_11,13,"ISO-8859-11","ISO885911","ISO8859_11"),A.ISO8859_13=new A(s.ISO8859_13,15,"ISO-8859-13","ISO885913","ISO8859_13"),A.ISO8859_14=new A(s.ISO8859_14,16,"ISO-8859-14","ISO885914","ISO8859_14"),A.ISO8859_15=new A(s.ISO8859_15,17,"ISO-8859-15","ISO885915","ISO8859_15"),A.ISO8859_16=new A(s.ISO8859_16,18,"ISO-8859-16","ISO885916","ISO8859_16"),A.SJIS=new A(s.SJIS,20,"SJIS","Shift_JIS"),A.Cp1250=new A(s.Cp1250,21,"Cp1250","windows-1250"),A.Cp1251=new A(s.Cp1251,22,"Cp1251","windows-1251"),A.Cp1252=new A(s.Cp1252,23,"Cp1252","windows-1252"),A.Cp1256=new A(s.Cp1256,24,"Cp1256","windows-1256"),A.UnicodeBigUnmarked=new A(s.UnicodeBigUnmarked,25,"UnicodeBigUnmarked","UTF-16BE","UnicodeBig"),A.UTF8=new A(s.UTF8,26,"UTF8","UTF-8"),A.ASCII=new A(s.ASCII,Int32Array.from([27,170]),"ASCII","US-ASCII"),A.Big5=new A(s.Big5,28,"Big5"),A.GB18030=new A(s.GB18030,29,"GB18030","GB2312","EUC_CN","GBK"),A.EUC_KR=new A(s.EUC_KR,30,"EUC_KR","EUC-KR");class C extends u{}C.kind="UnsupportedOperationException";class E{static decode(t,e){const r=this.encodingName(e);return this.customDecoder?this.customDecoder(t,r):"undefined"==typeof TextDecoder||this.shouldDecodeOnFallback(r)?this.decodeFallback(t,r):new TextDecoder(r).decode(t)}static shouldDecodeOnFallback(t){return!E.isBrowser()&&"ISO-8859-1"===t}static encode(t,e){const r=this.encodingName(e);return this.customEncoder?this.customEncoder(t,r):"undefined"==typeof TextEncoder?this.encodeFallback(t):(new TextEncoder).encode(t)}static isBrowser(){return"undefined"!=typeof window&&"[object Window]"==={}.toString.call(window)}static encodingName(t){return"string"==typeof t?t:t.getName()}static encodingCharacterSet(t){return t instanceof A?t:A.getCharacterSetECIByName(t)}static decodeFallback(t,e){const r=this.encodingCharacterSet(e);if(E.isDecodeFallbackSupported(r)){let e="";for(let r=0,n=t.length;r<n;r++){let n=t[r].toString(16);n.length<2&&(n="0"+n),e+="%"+n}return decodeURIComponent(e)}if(r.equals(A.UnicodeBigUnmarked))return String.fromCharCode.apply(null,new Uint16Array(t.buffer));throw new C(`Encoding ${this.encodingName(e)} not supported by fallback.`)}static isDecodeFallbackSupported(t){return t.equals(A.UTF8)||t.equals(A.ISO8859_1)||t.equals(A.ASCII)}static encodeFallback(t){const e=btoa(unescape(encodeURIComponent(t))).split(""),r=[];for(let t=0;t<e.length;t++)r.push(e[t].charCodeAt(0));return new Uint8Array(r)}}class _{static castAsNonUtf8Char(t,e=null){const r=e?e.getName():this.ISO88591;return E.decode(new Uint8Array([t]),r)}static guessEncoding(t,e){if(null!=e&&void 0!==e.get(n.CHARACTER_SET))return e.get(n.CHARACTER_SET).toString();const r=t.length;let s=!0,i=!0,o=!0,a=0,h=0,l=0,c=0,u=0,w=0,d=0,f=0,g=0,m=0,I=0;const S=t.length>3&&239===t[0]&&187===t[1]&&191===t[2];for(let e=0;e<r&&(s||i||o);e++){const r=255&t[e];o&&(a>0?128&r?a--:o=!1:128&r&&(64&r?(a++,32&r?(a++,16&r?(a++,8&r?o=!1:c++):l++):h++):o=!1)),s&&(r>127&&r<160?s=!1:r>159&&(r<192||215===r||247===r)&&I++),i&&(u>0?r<64||127===r||r>252?i=!1:u--:128===r||160===r||r>239?i=!1:r>160&&r<224?(w++,f=0,d++,d>g&&(g=d)):r>127?(u++,d=0,f++,f>m&&(m=f)):(d=0,f=0))}return o&&a>0&&(o=!1),i&&u>0&&(i=!1),o&&(S||h+l+c>0)?_.UTF8:i&&(_.ASSUME_SHIFT_JIS||g>=3||m>=3)?_.SHIFT_JIS:s&&i?2===g&&2===w||10*I>=r?_.SHIFT_JIS:_.ISO88591:s?_.ISO88591:i?_.SHIFT_JIS:o?_.UTF8:_.PLATFORM_DEFAULT_ENCODING}static format(t,...e){let r=-1;return t.replace(/%(-)?(0?[0-9]+)?([.][0-9]+)?([#][0-9]+)?([scfpexd%])/g,(function(t,n,s,i,o,a){if("%%"===t)return"%";if(void 0===e[++r])return;t=i?parseInt(i.substr(1)):void 0;let h,l=o?parseInt(o.substr(1)):void 0;switch(a){case"s":h=e[r];break;case"c":h=e[r][0];break;case"f":h=parseFloat(e[r]).toFixed(t);break;case"p":h=parseFloat(e[r]).toPrecision(t);break;case"e":h=parseFloat(e[r]).toExponential(t);break;case"x":h=parseInt(e[r]).toString(l||16);break;case"d":h=parseFloat(parseInt(e[r],l||10).toPrecision(t)).toFixed(0)}h="object"==typeof h?JSON.stringify(h):(+h).toString(l);let c=parseInt(s),u=s&&s[0]+""=="0"?"0":" ";for(;h.length<c;)h=void 0!==n?h+u:u+h;return h}))}static getBytes(t,e){return E.encode(t,e)}static getCharCode(t,e=0){return t.charCodeAt(e)}static getCharAt(t){return String.fromCharCode(t)}}_.SHIFT_JIS=A.SJIS.getName(),_.GB2312="GB2312",_.ISO88591=A.ISO8859_1.getName(),_.EUC_JP="EUC_JP",_.UTF8=A.UTF8.getName(),_.PLATFORM_DEFAULT_ENCODING=_.UTF8,_.ASSUME_SHIFT_JIS=!1;class p{constructor(t=""){this.value=t}enableDecoding(t){return this.encoding=t,this}append(t){return"string"==typeof t?this.value+=t.toString():this.encoding?this.value+=_.castAsNonUtf8Char(t,this.encoding):this.value+=String.fromCharCode(t),this}appendChars(t,e,r){for(let n=e;e<e+r;n++)this.append(t[n]);return this}length(){return this.value.length}charAt(t){return this.value.charAt(t)}deleteCharAt(t){this.value=this.value.substr(0,t)+this.value.substring(t+1)}setCharAt(t,e){this.value=this.value.substr(0,t)+e+this.value.substr(t+1)}substring(t,e){return this.value.substring(t,e)}setLengthToZero(){this.value=""}toString(){return this.value}insert(t,e){this.value=this.value.substring(0,t)+e+this.value.substring(t)}}class M{static numberOfTrailingZeros(t){let e;if(0===t)return 32;let r=31;return e=t<<16,0!==e&&(r-=16,t=e),e=t<<8,0!==e&&(r-=8,t=e),e=t<<4,0!==e&&(r-=4,t=e),e=t<<2,0!==e&&(r-=2,t=e),r-(t<<1>>>31)}static numberOfLeadingZeros(t){if(0===t)return 32;let e=1;return t>>>16==0&&(e+=16,t<<=16),t>>>24==0&&(e+=8,t<<=8),t>>>28==0&&(e+=4,t<<=4),t>>>30==0&&(e+=2,t<<=2),e-=t>>>31,e}static toHexString(t){return t.toString(16)}static toBinaryString(t){return String(parseInt(String(t),2))}static bitCount(t){return t=(t=(858993459&(t-=t>>>1&1431655765))+(t>>>2&858993459))+(t>>>4)&252645135,t+=t>>>8,63&(t+=t>>>16)}static truncDivision(t,e){return Math.trunc(t/e)}static parseInt(t,e=void 0){return parseInt(t,e)}}M.MIN_VALUE_32_BITS=-2147483648,M.MAX_VALUE=Number.MAX_SAFE_INTEGER;class O{constructor(t,e){void 0===t?(this.size=0,this.bits=new Int32Array(1)):(this.size=t,this.bits=null==e?O.makeArray(t):e)}getSize(){return this.size}getSizeInBytes(){return Math.floor((this.size+7)/8)}ensureCapacity(t){if(t>32*this.bits.length){const e=O.makeArray(t);m.arraycopy(this.bits,0,e,0,this.bits.length),this.bits=e}}get(t){return!!(this.bits[Math.floor(t/32)]&1<<(31&t))}set(t){this.bits[Math.floor(t/32)]|=1<<(31&t)}flip(t){this.bits[Math.floor(t/32)]^=1<<(31&t)}getNextSet(t){const e=this.size;if(t>=e)return e;const r=this.bits;let n=Math.floor(t/32),s=r[n];s&=~((1<<(31&t))-1);const i=r.length;for(;0===s;){if(++n===i)return e;s=r[n]}const o=32*n+M.numberOfTrailingZeros(s);return o>e?e:o}getNextUnset(t){const e=this.size;if(t>=e)return e;const r=this.bits;let n=Math.floor(t/32),s=~r[n];s&=~((1<<(31&t))-1);const i=r.length;for(;0===s;){if(++n===i)return e;s=~r[n]}const o=32*n+M.numberOfTrailingZeros(s);return o>e?e:o}setBulk(t,e){this.bits[Math.floor(t/32)]=e}setRange(t,e){if(e<t||t<0||e>this.size)throw new d;if(e===t)return;e--;const r=Math.floor(t/32),n=Math.floor(e/32),s=this.bits;for(let i=r;i<=n;i++){const o=(2<<(i<n?31:31&e))-(1<<(i>r?0:31&t));s[i]|=o}}clear(){const t=this.bits.length,e=this.bits;for(let r=0;r<t;r++)e[r]=0}isRange(t,e,r){if(e<t||t<0||e>this.size)throw new d;if(e===t)return!0;e--;const n=Math.floor(t/32),s=Math.floor(e/32),i=this.bits;for(let o=n;o<=s;o++){const a=(2<<(o<s?31:31&e))-(1<<(o>n?0:31&t))&4294967295;if((i[o]&a)!==(r?a:0))return!1}return!0}appendBit(t){this.ensureCapacity(this.size+1),t&&(this.bits[Math.floor(this.size/32)]|=1<<(31&this.size)),this.size++}appendBits(t,e){if(e<0||e>32)throw new d("Num bits must be between 0 and 32");this.ensureCapacity(this.size+e);for(let r=e;r>0;r--)this.appendBit(1==(t>>r-1&1))}appendBitArray(t){const e=t.size;this.ensureCapacity(this.size+e);for(let r=0;r<e;r++)this.appendBit(t.get(r))}xor(t){if(this.size!==t.size)throw new d("Sizes don't match");const e=this.bits;for(let r=0,n=e.length;r<n;r++)e[r]^=t.bits[r]}toBytes(t,e,r,n){for(let s=0;s<n;s++){let n=0;for(let e=0;e<8;e++)this.get(t)&&(n|=1<<7-e),t++;e[r+s]=n}}getBitArray(){return this.bits}reverse(){const t=new Int32Array(this.bits.length),e=Math.floor((this.size-1)/32),r=e+1,n=this.bits;for(let s=0;s<r;s++){let r=n[s];r=r>>1&1431655765|(1431655765&r)<<1,r=r>>2&858993459|(858993459&r)<<2,r=r>>4&252645135|(252645135&r)<<4,r=r>>8&16711935|(16711935&r)<<8,r=r>>16&65535|(65535&r)<<16,t[e-s]=r}if(this.size!==32*r){const e=32*r-this.size;let n=t[0]>>>e;for(let s=1;s<r;s++){const r=t[s];n|=r<<32-e,t[s-1]=n,n=r>>>e}t[r-1]=n}this.bits=t}static makeArray(t){return new Int32Array(Math.floor((t+31)/32))}equals(t){if(!(t instanceof O))return!1;const e=t;return this.size===e.size&&I.equals(this.bits,e.bits)}hashCode(){return 31*this.size+I.hashCode(this.bits)}toString(){let t="";for(let e=0,r=this.size;e<r;e++)7&e||(t+=" "),t+=this.get(e)?"X":".";return t}clone(){return new O(this.size,this.bits.slice())}toArray(){let t=[];for(let e=0,r=this.size;e<r;e++)t.push(this.get(e));return t}}class N{constructor(t,e,r,n){if(this.width=t,this.height=e,this.rowSize=r,this.bits=n,null==e&&(e=t),this.height=e,t<1||e<1)throw new d("Both dimensions must be greater than 0");null==r&&(r=(t+31)/32|0),this.rowSize=r,null==n&&(this.bits=new Int32Array(this.rowSize*this.height))}static parseFromBooleanArray(t){const e=t.length,r=t[0].length,n=new N(r,e);for(let s=0;s<e;s++){const e=t[s];for(let t=0;t<r;t++)e[t]&&n.set(t,s)}return n}static parseFromString(t,e,r){if(null===t)throw new d("stringRepresentation cannot be null");const n=new Array(t.length);let s=0,i=0,o=-1,a=0,h=0;for(;h<t.length;){const l=t.charAt(h);if("\n"===l||"\r"===l){if(s>i){if(-1===o)o=s-i;else if(s-i!==o)throw new d("row lengths do not match");i=s,a++}h++}else if(t.substring(h,h+e.length)===e)h+=e.length,n[s++]=!0;else{if(t.substring(h,h+r.length)!==r)throw new d("illegal character encountered: "+t.substring(h));h+=r.length,n[s++]=!1}}if(s>i){if(-1===o)o=s-i;else if(s-i!==o)throw new d("row lengths do not match");a++}const l=new N(o,a);for(let t=0;t<s;t++)n[t]&&l.set(t%o,Math.floor(t/o));return l}get(t,e){const r=e*this.rowSize+(t>>5);return!!(this.bits[r]>>>(31&t)&1)}set(t,e){const r=e*this.rowSize+(t>>5);this.bits[r]|=1<<(31&t)}unset(t,e){const r=e*this.rowSize+(t>>5);this.bits[r]&=~(1<<(31&t))}flip(t,e){const r=e*this.rowSize+(t>>5);this.bits[r]^=1<<(31&t)}xor(t){if(this.width!==t.getWidth()||this.height!==t.getHeight()||this.rowSize!==t.getRowSize())throw new d("input matrix dimensions do not match");const e=new O(1+(this.width>>5)),r=this.rowSize,n=this.bits;for(let s=0,i=this.height;s<i;s++){const i=s*r,o=t.getRow(s,e).getBitArray();for(let t=0;t<r;t++)n[i+t]^=o[t]}}clear(){const t=this.bits,e=t.length;for(let r=0;r<e;r++)t[r]=0}setRegion(t,e,r,n){if(e<0||t<0)throw new d("Left and top must be nonnegative");if(n<1||r<1)throw new d("Height and width must be at least 1");const s=t+r,i=e+n;if(i>this.height||s>this.width)throw new d("The region must fit inside the matrix");const o=this.rowSize,a=this.bits;for(let r=e;r<i;r++){const e=r*o;for(let r=t;r<s;r++)a[e+(r>>5)]|=1<<(31&r)}}getRow(t,e){null==e||e.getSize()<this.width?e=new O(this.width):e.clear();const r=this.rowSize,n=this.bits,s=t*r;for(let t=0;t<r;t++)e.setBulk(32*t,n[s+t]);return e}setRow(t,e){m.arraycopy(e.getBitArray(),0,this.bits,t*this.rowSize,this.rowSize)}rotate180(){const t=this.getWidth(),e=this.getHeight();let r=new O(t),n=new O(t);for(let t=0,s=Math.floor((e+1)/2);t<s;t++)r=this.getRow(t,r),n=this.getRow(e-1-t,n),r.reverse(),n.reverse(),this.setRow(t,n),this.setRow(e-1-t,r)}getEnclosingRectangle(){const t=this.width,e=this.height,r=this.rowSize,n=this.bits;let s=t,i=e,o=-1,a=-1;for(let t=0;t<e;t++)for(let e=0;e<r;e++){const h=n[t*r+e];if(0!==h){if(t<i&&(i=t),t>a&&(a=t),32*e<s){let t=0;for(;h<<31-t>>>0==0;)t++;32*e+t<s&&(s=32*e+t)}if(32*e+31>o){let t=31;for(;h>>>t==0;)t--;32*e+t>o&&(o=32*e+t)}}}return o<s||a<i?null:Int32Array.from([s,i,o-s+1,a-i+1])}getTopLeftOnBit(){const t=this.rowSize,e=this.bits;let r=0;for(;r<e.length&&0===e[r];)r++;if(r===e.length)return null;const n=Math.floor(r/t);let s=r%t<<5;const i=e[r];let o=0;for(;i<<31-o>>>0==0;)o++;return s+=o,Int32Array.from([s,n])}getBottomRightOnBit(){const t=this.rowSize,e=this.bits;let r=e.length-1;for(;r>=0&&0===e[r];)r--;if(r<0)return null;const n=Math.floor(r/t);let s=r%t<<5;const i=e[r];let o=31;for(;i>>>o==0;)o--;return s+=o,Int32Array.from([s,n])}getWidth(){return this.width}getHeight(){return this.height}getRowSize(){return this.rowSize}equals(t){if(!(t instanceof N))return!1;const e=t;return this.width===e.width&&this.height===e.height&&this.rowSize===e.rowSize&&I.equals(this.bits,e.bits)}hashCode(){let t=this.width;return t=31*t+this.height,t=31*t+this.rowSize,t=31*t+I.hashCode(this.bits),t}toString(t="X ",e=" ",r="\n"){return this.buildToString(t,e,r)}buildToString(t,e,r){const n=new p,s=this.height,i=this.width;if(void 0===s||void 0===i)throw new Error("Matrix dimensions are undefined");for(let o=0;o<s;o++){for(let r=0;r<i;r++)n.append(this.get(r,o)?t:e);n.append(r)}return n.toString()}clone(){return new N(this.width,this.height,this.rowSize,this.bits.slice())}}class y{constructor(t=null,e,r=(null==e?0:8*e.length),n,s,i=m.currentTimeMillis()){this.text=t,this.rawBytes=e,this.numBits=r,this.resultPoints=n,this.format=s,this.timestamp=i,this.text=t,this.rawBytes=e,this.numBits=null==r?null==e?0:8*e.length:r,this.resultPoints=n,this.format=s,this.resultMetadata=new Map,this.timestamp=null==i?m.currentTimeMillis():i}getText(){return this.text?this.text:null}getRawBytes(){return this.rawBytes}getNumBits(){return this.numBits}getResultPoints(){return this.resultPoints}getBarcodeFormat(){return this.format}getResultMetadata(){return this.resultMetadata}putMetadata(t,e){null===this.resultMetadata&&(this.resultMetadata=new Map),this.resultMetadata.set(t,e)}putAllMetadata(t){null!==t&&(null===this.resultMetadata?this.resultMetadata=t:this.resultMetadata=new Map(t))}addResultPoints(t){const e=this.resultPoints;if(null===e)this.resultPoints=t;else if(null!==t&&t.length>0){const r=new Array(e.length+t.length);m.arraycopy(e,0,r,0,e.length),m.arraycopy(t,0,r,e.length,t.length),this.resultPoints=r}}getTimestamp(){return this.timestamp}toString(){return null===this.text?this.resultPoints.toString():this.text}}!function(t){t[t.OTHER=0]="OTHER",t[t.ORIENTATION=1]="ORIENTATION",t[t.BYTE_SEGMENTS=2]="BYTE_SEGMENTS",t[t.ERROR_CORRECTION_LEVEL=3]="ERROR_CORRECTION_LEVEL",t[t.ISSUE_NUMBER=4]="ISSUE_NUMBER",t[t.SUGGESTED_PRICE=5]="SUGGESTED_PRICE",t[t.POSSIBLE_COUNTRY=6]="POSSIBLE_COUNTRY",t[t.UPC_EAN_EXTENSION=7]="UPC_EAN_EXTENSION",t[t.PDF417_EXTRA_METADATA=8]="PDF417_EXTRA_METADATA",t[t.STRUCTURED_APPEND_SEQUENCE=9]="STRUCTURED_APPEND_SEQUENCE",t[t.STRUCTURED_APPEND_PARITY=10]="STRUCTURED_APPEND_PARITY"}(i||(i={}));class T extends u{static getChecksumInstance(){return new T}}T.kind="ChecksumException";class b extends u{}b.kind="ArithmeticException";class R{exp(t){return this.expTable[t]}log(t){if(0===t)throw new d;return this.logTable[t]}static addOrSubtract(t,e){return t^e}}class B{constructor(t,e){if(0===e.length)throw new d;this.field=t;const r=e.length;if(r>1&&0===e[0]){let t=1;for(;t<r&&0===e[t];)t++;t===r?this.coefficients=Int32Array.from([0]):(this.coefficients=new Int32Array(r-t),m.arraycopy(e,t,this.coefficients,0,this.coefficients.length))}else this.coefficients=e}getCoefficients(){return this.coefficients}getDegree(){return this.coefficients.length-1}isZero(){return 0===this.coefficients[0]}getCoefficient(t){return this.coefficients[this.coefficients.length-1-t]}evaluateAt(t){if(0===t)return this.getCoefficient(0);const e=this.coefficients;let r;if(1===t){r=0;for(let t=0,n=e.length;t!==n;t++){const n=e[t];r=R.addOrSubtract(r,n)}return r}r=e[0];const n=e.length,s=this.field;for(let i=1;i<n;i++)r=R.addOrSubtract(s.multiply(t,r),e[i]);return r}addOrSubtract(t){if(!this.field.equals(t.field))throw new d("GenericGFPolys do not have same GenericGF field");if(this.isZero())return t;if(t.isZero())return this;let e=this.coefficients,r=t.coefficients;if(e.length>r.length){const t=e;e=r,r=t}let n=new Int32Array(r.length);const s=r.length-e.length;m.arraycopy(r,0,n,0,s);for(let t=s;t<r.length;t++)n[t]=R.addOrSubtract(e[t-s],r[t]);return new B(this.field,n)}multiply(t){if(!this.field.equals(t.field))throw new d("GenericGFPolys do not have same GenericGF field");if(this.isZero()||t.isZero())return this.field.getZero();const e=this.coefficients,r=e.length,n=t.coefficients,s=n.length,i=new Int32Array(r+s-1),o=this.field;for(let t=0;t<r;t++){const r=e[t];for(let e=0;e<s;e++)i[t+e]=R.addOrSubtract(i[t+e],o.multiply(r,n[e]))}return new B(o,i)}multiplyScalar(t){if(0===t)return this.field.getZero();if(1===t)return this;const e=this.coefficients.length,r=this.field,n=new Int32Array(e),s=this.coefficients;for(let i=0;i<e;i++)n[i]=r.multiply(s[i],t);return new B(r,n)}multiplyByMonomial(t,e){if(t<0)throw new d;if(0===e)return this.field.getZero();const r=this.coefficients,n=r.length,s=new Int32Array(n+t),i=this.field;for(let t=0;t<n;t++)s[t]=i.multiply(r[t],e);return new B(i,s)}divide(t){if(!this.field.equals(t.field))throw new d("GenericGFPolys do not have same GenericGF field");if(t.isZero())throw new d("Divide by 0");const e=this.field;let r=e.getZero(),n=this;const s=t.getCoefficient(t.getDegree()),i=e.inverse(s);for(;n.getDegree()>=t.getDegree()&&!n.isZero();){const s=n.getDegree()-t.getDegree(),o=e.multiply(n.getCoefficient(n.getDegree()),i),a=t.multiplyByMonomial(s,o),h=e.buildMonomial(s,o);r=r.addOrSubtract(h),n=n.addOrSubtract(a)}return[r,n]}toString(){let t="";for(let e=this.getDegree();e>=0;e--){let r=this.getCoefficient(e);if(0!==r){if(r<0?(t+=" - ",r=-r):t.length>0&&(t+=" + "),0===e||1!==r){const e=this.field.log(r);0===e?t+="1":1===e?t+="a":(t+="a^",t+=e)}0!==e&&(1===e?t+="x":(t+="x^",t+=e))}}return t}}class D extends R{constructor(t,e,r){super(),this.primitive=t,this.size=e,this.generatorBase=r;const n=new Int32Array(e);let s=1;for(let r=0;r<e;r++)n[r]=s,s*=2,s>=e&&(s^=t,s&=e-1);this.expTable=n;const i=new Int32Array(e);for(let t=0;t<e-1;t++)i[n[t]]=t;this.logTable=i,this.zero=new B(this,Int32Array.from([0])),this.one=new B(this,Int32Array.from([1]))}getZero(){return this.zero}getOne(){return this.one}buildMonomial(t,e){if(t<0)throw new d;if(0===e)return this.zero;const r=new Int32Array(t+1);return r[0]=e,new B(this,r)}inverse(t){if(0===t)throw new b;return this.expTable[this.size-this.logTable[t]-1]}multiply(t,e){return 0===t||0===e?0:this.expTable[(this.logTable[t]+this.logTable[e])%(this.size-1)]}getSize(){return this.size}getGeneratorBase(){return this.generatorBase}toString(){return"GF(0x"+M.toHexString(this.primitive)+","+this.size+")"}equals(t){return t===this}}D.AZTEC_DATA_12=new D(4201,4096,1),D.AZTEC_DATA_10=new D(1033,1024,1),D.AZTEC_DATA_6=new D(67,64,1),D.AZTEC_PARAM=new D(19,16,1),D.QR_CODE_FIELD_256=new D(285,256,0),D.DATA_MATRIX_FIELD_256=new D(301,256,1),D.AZTEC_DATA_8=D.DATA_MATRIX_FIELD_256,D.MAXICODE_FIELD_64=D.AZTEC_DATA_6;class P extends u{}P.kind="IllegalStateException";class v extends u{}v.kind="ReedSolomonException";class F{constructor(t){this.field=t}decode(t,e){const r=this.field,n=new B(r,t),s=new Int32Array(e);let i=!0;for(let t=0;t<e;t++){const e=n.evaluateAt(r.exp(t+r.getGeneratorBase()));s[s.length-1-t]=e,0!==e&&(i=!1)}if(i)return;const o=new B(r,s),a=this.runEuclideanAlgorithm(r.buildMonomial(e,1),o,e),h=a[0],l=a[1],c=this.findErrorLocations(h),u=this.findErrorMagnitudes(l,c);for(let e=0;e<c.length;e++){const n=t.length-1-r.log(c[e]);if(n<0)throw new v("Bad error location");t[n]=D.addOrSubtract(t[n],u[e])}}runEuclideanAlgorithm(t,e,r){if(t.getDegree()<e.getDegree()){const r=t;t=e,e=r}const n=this.field;let s=t,i=e,o=n.getZero(),a=n.getOne();for(;i.getDegree()>=(r/2|0);){let t=s,e=o;if(s=i,o=a,s.isZero())throw new v("r_{i-1} was zero");i=t;let r=n.getZero();const h=s.getCoefficient(s.getDegree()),l=n.inverse(h);for(;i.getDegree()>=s.getDegree()&&!i.isZero();){const t=i.getDegree()-s.getDegree(),e=n.multiply(i.getCoefficient(i.getDegree()),l);r=r.addOrSubtract(n.buildMonomial(t,e)),i=i.addOrSubtract(s.multiplyByMonomial(t,e))}if(a=r.multiply(o).addOrSubtract(e),i.getDegree()>=s.getDegree())throw new P("Division algorithm failed to reduce polynomial?")}const h=a.getCoefficient(0);if(0===h)throw new v("sigmaTilde(0) was zero");const l=n.inverse(h);return[a.multiplyScalar(l),i.multiplyScalar(l)]}findErrorLocations(t){const e=t.getDegree();if(1===e)return Int32Array.from([t.getCoefficient(1)]);const r=new Int32Array(e);let n=0;const s=this.field;for(let i=1;i<s.getSize()&&n<e;i++)0===t.evaluateAt(i)&&(r[n]=s.inverse(i),n++);if(n!==e)throw new v("Error locator degree does not match number of roots");return r}findErrorMagnitudes(t,e){const r=e.length,n=new Int32Array(r),s=this.field;for(let i=0;i<r;i++){const o=s.inverse(e[i]);let a=1;for(let t=0;t<r;t++)if(i!==t){const r=s.multiply(e[t],o),n=1&r?-2&r:1|r;a=s.multiply(a,n)}n[i]=s.multiply(t.evaluateAt(o),s.inverse(a)),0!==s.getGeneratorBase()&&(n[i]=s.multiply(n[i],o))}return n}}!function(t){t[t.DATA_MASK_000=0]="DATA_MASK_000",t[t.DATA_MASK_001=1]="DATA_MASK_001",t[t.DATA_MASK_010=2]="DATA_MASK_010",t[t.DATA_MASK_011=3]="DATA_MASK_011",t[t.DATA_MASK_100=4]="DATA_MASK_100",t[t.DATA_MASK_101=5]="DATA_MASK_101",t[t.DATA_MASK_110=6]="DATA_MASK_110",t[t.DATA_MASK_111=7]="DATA_MASK_111"}(o||(o={}));class U{constructor(t,e){this.value=t,this.isMasked=e}unmaskBitMatrix(t,e){for(let r=0;r<e;r++)for(let n=0;n<e;n++)this.isMasked(r,n)&&t.flip(n,r)}}U.values=new Map([[o.DATA_MASK_000,new U(o.DATA_MASK_000,((t,e)=>!(t+e&1)))],[o.DATA_MASK_001,new U(o.DATA_MASK_001,((t,e)=>!(1&t)))],[o.DATA_MASK_010,new U(o.DATA_MASK_010,((t,e)=>e%3==0))],[o.DATA_MASK_011,new U(o.DATA_MASK_011,((t,e)=>(t+e)%3==0))],[o.DATA_MASK_100,new U(o.DATA_MASK_100,((t,e)=>!(Math.floor(t/2)+Math.floor(e/3)&1)))],[o.DATA_MASK_101,new U(o.DATA_MASK_101,((t,e)=>t*e%6==0))],[o.DATA_MASK_110,new U(o.DATA_MASK_110,((t,e)=>t*e%6<3))],[o.DATA_MASK_111,new U(o.DATA_MASK_111,((t,e)=>!(t+e+t*e%3&1)))]]);class k extends u{}k.kind="ArgumentException",function(t){t[t.L=0]="L",t[t.M=1]="M",t[t.Q=2]="Q",t[t.H=3]="H"}(a||(a={}));class x{constructor(t,e,r){this.value=t,this.stringValue=e,this.bits=r,x.FOR_BITS.set(r,this),x.FOR_VALUE.set(t,this)}getValue(){return this.value}getBits(){return this.bits}static fromString(t){switch(t){case"L":return x.L;case"M":return x.M;case"Q":return x.Q;case"H":return x.H;default:throw new k(t+"not available")}}toString(){return this.stringValue}equals(t){if(!(t instanceof x))return!1;const e=t;return this.value===e.value}static forBits(t){if(t<0||t>=x.FOR_BITS.size)throw new d;return x.FOR_BITS.get(t)}}x.FOR_BITS=new Map,x.FOR_VALUE=new Map,x.L=new x(a.L,"L",1),x.M=new x(a.M,"M",0),x.Q=new x(a.Q,"Q",3),x.H=new x(a.H,"H",2);class L{constructor(t){this.errorCorrectionLevel=x.forBits(t>>3&3),this.dataMask=7&t}static numBitsDiffering(t,e){return M.bitCount(t^e)}static decodeFormatInformation(t,e){const r=L.doDecodeFormatInformation(t,e);return null!==r?r:L.doDecodeFormatInformation(t^L.FORMAT_INFO_MASK_QR,e^L.FORMAT_INFO_MASK_QR)}static doDecodeFormatInformation(t,e){let r=Number.MAX_SAFE_INTEGER,n=0;for(const s of L.FORMAT_INFO_DECODE_LOOKUP){const i=s[0];if(i===t||i===e)return new L(s[1]);let o=L.numBitsDiffering(t,i);o<r&&(n=s[1],r=o),t!==e&&(o=L.numBitsDiffering(e,i),o<r&&(n=s[1],r=o))}return r<=3?new L(n):null}getErrorCorrectionLevel(){return this.errorCorrectionLevel}getDataMask(){return this.dataMask}hashCode(){return this.errorCorrectionLevel.getBits()<<3|this.dataMask}equals(t){if(!(t instanceof L))return!1;const e=t;return this.errorCorrectionLevel===e.errorCorrectionLevel&&this.dataMask===e.dataMask}}L.FORMAT_INFO_MASK_QR=21522,L.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 z{constructor(t,e){this.count=t,this.dataCodewords=e}getCount(){return this.count}getDataCodewords(){return this.dataCodewords}}class H{constructor(t,...e){this.ecCodewordsPerBlock=t,this.ecBlocks=e}getECCodewordsPerBlock(){return this.ecCodewordsPerBlock}getNumBlocks(){let t=0;const e=this.ecBlocks;for(const r of e)t+=r.getCount();return t}getTotalECCodewords(){return this.ecCodewordsPerBlock*this.getNumBlocks()}getECBlocks(){return this.ecBlocks}}class K{constructor(t,e,...r){this.versionNumber=t,this.alignmentPatternCenters=e,this.ecBlocks=r;let n=0;const s=r[0].getECCodewordsPerBlock(),i=r[0].getECBlocks();for(const t of i)n+=t.getCount()*(t.getDataCodewords()+s);this.totalCodewords=n}getVersionNumber(){return this.versionNumber}getAlignmentPatternCenters(){return this.alignmentPatternCenters}getTotalCodewords(){return this.totalCodewords}getDimensionForVersion(){return 17+4*this.versionNumber}getECBlocksForLevel(t){return this.ecBlocks[t.getValue()]}static getProvisionalVersionForDimension(t){if(t%4!=1)throw new S;try{return this.getVersionForNumber((t-17)/4)}catch(t){throw new S}}static getVersionForNumber(t){if(t<1||t>40)throw new d;return K.VERSIONS[t-1]}static decodeVersionInformation(t){let e=Number.MAX_SAFE_INTEGER,r=0;for(let n=0;n<K.VERSION_DECODE_INFO.length;n++){const s=K.VERSION_DECODE_INFO[n];if(s===t)return K.getVersionForNumber(n+7);const i=L.numBitsDiffering(t,s);i<e&&(r=n+7,e=i)}return e<=3?K.getVersionForNumber(r):null}buildFunctionPattern(){const t=this.getDimensionForVersion(),e=new N(t);e.setRegion(0,0,9,9),e.setRegion(t-8,0,8,9),e.setRegion(0,t-8,9,8);const r=this.alignmentPatternCenters.length;for(let t=0;t<r;t++){const n=this.alignmentPatternCenters[t]-2;for(let s=0;s<r;s++)0===t&&(0===s||s===r-1)||t===r-1&&0===s||e.setRegion(this.alignmentPatternCenters[s]-2,n,5,5)}return e.setRegion(6,9,1,t-17),e.setRegion(9,6,t-17,1),this.versionNumber>6&&(e.setRegion(t-11,0,3,6),e.setRegion(0,t-11,6,3)),e}toString(){return""+this.versionNumber}}K.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]),K.VERSIONS=[new K(1,new Int32Array(0),new H(7,new z(1,19)),new H(10,new z(1,16)),new H(13,new z(1,13)),new H(17,new z(1,9))),new K(2,Int32Array.from([6,18]),new H(10,new z(1,34)),new H(16,new z(1,28)),new H(22,new z(1,22)),new H(28,new z(1,16))),new K(3,Int32Array.from([6,22]),new H(15,new z(1,55)),new H(26,new z(1,44)),new H(18,new z(2,17)),new H(22,new z(2,13))),new K(4,Int32Array.from([6,26]),new H(20,new z(1,80)),new H(18,new z(2,32)),new H(26,new z(2,24)),new H(16,new z(4,9))),new K(5,Int32Array.from([6,30]),new H(26,new z(1,108)),new H(24,new z(2,43)),new H(18,new z(2,15),new z(2,16)),new H(22,new z(2,11),new z(2,12))),new K(6,Int32Array.from([6,34]),new H(18,new z(2,68)),new H(16,new z(4,27)),new H(24,new z(4,19)),new H(28,new z(4,15))),new K(7,Int32Array.from([6,22,38]),new H(20,new z(2,78)),new H(18,new z(4,31)),new H(18,new z(2,14),new z(4,15)),new H(26,new z(4,13),new z(1,14))),new K(8,Int32Array.from([6,24,42]),new H(24,new z(2,97)),new H(22,new z(2,38),new z(2,39)),new H(22,new z(4,18),new z(2,19)),new H(26,new z(4,14),new z(2,15))),new K(9,Int32Array.from([6,26,46]),new H(30,new z(2,116)),new H(22,new z(3,36),new z(2,37)),new H(20,new z(4,16),new z(4,17)),new H(24,new z(4,12),new z(4,13))),new K(10,Int32Array.from([6,28,50]),new H(18,new z(2,68),new z(2,69)),new H(26,new z(4,43),new z(1,44)),new H(24,new z(6,19),new z(2,20)),new H(28,new z(6,15),new z(2,16))),new K(11,Int32Array.from([6,30,54]),new H(20,new z(4,81)),new H(30,new z(1,50),new z(4,51)),new H(28,new z(4,22),new z(4,23)),new H(24,new z(3,12),new z(8,13))),new K(12,Int32Array.from([6,32,58]),new H(24,new z(2,92),new z(2,93)),new H(22,new z(6,36),new z(2,37)),new H(26,new z(4,20),new z(6,21)),new H(28,new z(7,14),new z(4,15))),new K(13,Int32Array.from([6,34,62]),new H(26,new z(4,107)),new H(22,new z(8,37),new z(1,38)),new H(24,new z(8,20),new z(4,21)),new H(22,new z(12,11),new z(4,12))),new K(14,Int32Array.from([6,26,46,66]),new H(30,new z(3,115),new z(1,116)),new H(24,new z(4,40),new z(5,41)),new H(20,new z(11,16),new z(5,17)),new H(24,new z(11,12),new z(5,13))),new K(15,Int32Array.from([6,26,48,70]),new H(22,new z(5,87),new z(1,88)),new H(24,new z(5,41),new z(5,42)),new H(30,new z(5,24),new z(7,25)),new H(24,new z(11,12),new z(7,13))),new K(16,Int32Array.from([6,26,50,74]),new H(24,new z(5,98),new z(1,99)),new H(28,new z(7,45),new z(3,46)),new H(24,new z(15,19),new z(2,20)),new H(30,new z(3,15),new z(13,16))),new K(17,Int32Array.from([6,30,54,78]),new H(28,new z(1,107),new z(5,108)),new H(28,new z(10,46),new z(1,47)),new H(28,new z(1,22),new z(15,23)),new H(28,new z(2,14),new z(17,15))),new K(18,Int32Array.from([6,30,56,82]),new H(30,new z(5,120),new z(1,121)),new H(26,new z(9,43),new z(4,44)),new H(28,new z(17,22),new z(1,23)),new H(28,new z(2,14),new z(19,15))),new K(19,Int32Array.from([6,30,58,86]),new H(28,new z(3,113),new z(4,114)),new H(26,new z(3,44),new z(11,45)),new H(26,new z(17,21),new z(4,22)),new H(26,new z(9,13),new z(16,14))),new K(20,Int32Array.from([6,34,62,90]),new H(28,new z(3,107),new z(5,108)),new H(26,new z(3,41),new z(13,42)),new H(30,new z(15,24),new z(5,25)),new H(28,new z(15,15),new z(10,16))),new K(21,Int32Array.from([6,28,50,72,94]),new H(28,new z(4,116),new z(4,117)),new H(26,new z(17,42)),new H(28,new z(17,22),new z(6,23)),new H(30,new z(19,16),new z(6,17))),new K(22,Int32Array.from([6,26,50,74,98]),new H(28,new z(2,111),new z(7,112)),new H(28,new z(17,46)),new H(30,new z(7,24),new z(16,25)),new H(24,new z(34,13))),new K(23,Int32Array.from([6,30,54,78,102]),new H(30,new z(4,121),new z(5,122)),new H(28,new z(4,47),new z(14,48)),new H(30,new z(11,24),new z(14,25)),new H(30,new z(16,15),new z(14,16))),new K(24,Int32Array.from([6,28,54,80,106]),new H(30,new z(6,117),new z(4,118)),new H(28,new z(6,45),new z(14,46)),new H(30,new z(11,24),new z(16,25)),new H(30,new z(30,16),new z(2,17))),new K(25,Int32Array.from([6,32,58,84,110]),new H(26,new z(8,106),new z(4,107)),new H(28,new z(8,47),new z(13,48)),new H(30,new z(7,24),new z(22,25)),new H(30,new z(22,15),new z(13,16))),new K(26,Int32Array.from([6,30,58,86,114]),new H(28,new z(10,114),new z(2,115)),new H(28,new z(19,46),new z(4,47)),new H(28,new z(28,22),new z(6,23)),new H(30,new z(33,16),new z(4,17))),new K(27,Int32Array.from([6,34,62,90,118]),new H(30,new z(8,122),new z(4,123)),new H(28,new z(22,45),new z(3,46)),new H(30,new z(8,23),new z(26,24)),new H(30,new z(12,15),new z(28,16))),new K(28,Int32Array.from([6,26,50,74,98,122]),new H(30,new z(3,117),new z(10,118)),new H(28,new z(3,45),new z(23,46)),new H(30,new z(4,24),new z(31,25)),new H(30,new z(11,15),new z(31,16))),new K(29,Int32Array.from([6,30,54,78,102,126]),new H(30,new z(7,116),new z(7,117)),new H(28,new z(21,45),new z(7,46)),new H(30,new z(1,23),new z(37,24)),new H(30,new z(19,15),new z(26,16))),new K(30,Int32Array.from([6,26,52,78,104,130]),new H(30,new z(5,115),new z(10,116)),new H(28,new z(19,47),new z(10,48)),new H(30,new z(15,24),new z(25,25)),new H(30,new z(23,15),new z(25,16))),new K(31,Int32Array.from([6,30,56,82,108,134]),new H(30,new z(13,115),new z(3,116)),new H(28,new z(2,46),new z(29,47)),new H(30,new z(42,24),new z(1,25)),new H(30,new z(23,15),new z(28,16))),new K(32,Int32Array.from([6,34,60,86,112,138]),new H(30,new z(17,115)),new H(28,new z(10,46),new z(23,47)),new H(30,new z(10,24),new z(35,25)),new H(30,new z(19,15),new z(35,16))),new K(33,Int32Array.from([6,30,58,86,114,142]),new H(30,new z(17,115),new z(1,116)),new H(28,new z(14,46),new z(21,47)),new H(30,new z(29,24),new z(19,25)),new H(30,new z(11,15),new z(46,16))),new K(34,Int32Array.from([6,34,62,90,118,146]),new H(30,new z(13,115),new z(6,116)),new H(28,new z(14,46),new z(23,47)),new H(30,new z(44,24),new z(7,25)),new H(30,new z(59,16),new z(1,17))),new K(35,Int32Array.from([6,30,54,78,102,126,150]),new H(30,new z(12,121),new z(7,122)),new H(28,new z(12,47),new z(26,48)),new H(30,new z(39,24),new z(14,25)),new H(30,new z(22,15),new z(41,16))),new K(36,Int32Array.from([6,24,50,76,102,128,154]),new H(30,new z(6,121),new z(14,122)),new H(28,new z(6,47),new z(34,48)),new H(30,new z(46,24),new z(10,25)),new H(30,new z(2,15),new z(64,16))),new K(37,Int32Array.from([6,28,54,80,106,132,158]),new H(30,new z(17,122),new z(4,123)),new H(28,new z(29,46),new z(14,47)),new H(30,new z(49,24),new z(10,25)),new H(30,new z(24,15),new z(46,16))),new K(38,Int32Array.from([6,32,58,84,110,136,162]),new H(30,new z(4,122),new z(18,123)),new H(28,new z(13,46),new z(32,47)),new H(30,new z(48,24),new z(14,25)),new H(30,new z(42,15),new z(32,16))),new K(39,Int32Array.from([6,26,54,82,110,138,166]),new H(30,new z(20,117),new z(4,118)),new H(28,new z(40,47),new z(7,48)),new H(30,new z(43,24),new z(22,25)),new H(30,new z(10,15),new z(67,16))),new K(40,Int32Array.from([6,30,58,86,114,142,170]),new H(30,new z(19,118),new z(6,119)),new H(28,new z(18,47),new z(31,48)),new H(30,new z(34,24),new z(34,25)),new H(30,new z(20,15),new z(61,16)))];class V{constructor(t){const e=t.getHeight();if(e<21||1!=(3&e))throw new S;this.bitMatrix=t}readFormatInformation(){if(null!==this.parsedFormatInfo&&void 0!==this.parsedFormatInfo)return this.parsedFormatInfo;let t=0;for(let e=0;e<6;e++)t=this.copyBit(e,8,t);t=this.copyBit(7,8,t),t=this.copyBit(8,8,t),t=this.copyBit(8,7,t);for(let e=5;e>=0;e--)t=this.copyBit(8,e,t);const e=this.bitMatrix.getHeight();let r=0;const n=e-7;for(let t=e-1;t>=n;t--)r=this.copyBit(8,t,r);for(let t=e-8;t<e;t++)r=this.copyBit(t,8,r);if(this.parsedFormatInfo=L.decodeFormatInformation(t,r),null!==this.parsedFormatInfo)return this.parsedFormatInfo;throw new S}readVersion(){if(null!==this.parsedVersion&&void 0!==this.parsedVersion)return this.parsedVersion;const t=this.bitMatrix.getHeight(),e=Math.floor((t-17)/4);if(e<=6)return K.getVersionForNumber(e);let r=0;const n=t-11;for(let e=5;e>=0;e--)for(let s=t-9;s>=n;s--)r=this.copyBit(s,e,r);let s=K.decodeVersionInformation(r);if(null!==s&&s.getDimensionForVersion()===t)return this.parsedVersion=s,s;r=0;for(let e=5;e>=0;e--)for(let s=t-9;s>=n;s--)r=this.copyBit(e,s,r);if(s=K.decodeVersionInformation(r),null!==s&&s.getDimensionForVersion()===t)return this.parsedVersion=s,s;throw new S}copyBit(t,e,r){return(this.isMirror?this.bitMatrix.get(e,t):this.bitMatrix.get(t,e))?r<<1|1:r<<1}readCodewords(){const t=this.readFormatInformation(),e=this.readVersion(),r=U.values.get(t.getDataMask()),n=this.bitMatrix.getHeight();r?.unmaskBitMatrix(this.bitMatrix,n);const s=e.buildFunctionPattern();let i=!0;const o=new Uint8Array(e.getTotalCodewords());let a=0,h=0,l=0;for(let t=n-1;t>0;t-=2){6===t&&t--;for(let e=0;e<n;e++){const r=i?n-1-e:e;for(let e=0;e<2;e++)s.get(t-e,r)||(l++,h<<=1,this.bitMatrix.get(t-e,r)&&(h|=1),8===l&&(o[a++]=h,l=0,h=0))}i=!i}if(a!==e.getTotalCodewords())throw new S;return o}remask(){if(null===this.parsedFormatInfo)return;const t=this.parsedFormatInfo&&U.values.get(this.parsedFormatInfo.getDataMask()),e=this.bitMatrix.getHeight();t?.unmaskBitMatrix(this.bitMatrix,e)}setMirror(t){this.parsedVersion=null,this.parsedFormatInfo=null,this.isMirror=t}mirror(){const t=this.bitMatrix;for(let e=0,r=t.getWidth();e<r;e++)for(let r=e+1,n=t.getHeight();r<n;r++)t.get(e,r)!==t.get(r,e)&&(t.flip(r,e),t.flip(e,r))}}class G{constructor(t,e){this.numDataCodewords=t,this.codewords=e}static getDataBlocks(t,e,r){if(t.length!==e.getTotalCodewords())throw new d;const n=e.getECBlocksForLevel(r);let s=0;const i=n.getECBlocks();for(const t of i)s+=t.getCount();const o=new Array(s);let a=0;for(const t of i)for(let e=0;e<t.getCount();e++){const e=t.getDataCodewords(),r=n.getECCodewordsPerBlock()+e;o[a++]=new G(e,new Uint8Array(r))}const h=o[0].codewords.length;let l=o.length-1;for(;l>=0;){if(o[l].codewords.length===h)break;l--}l++;const c=h-n.getECCodewordsPerBlock();let u=0;for(let e=0;e<c;e++)for(let r=0;r<a;r++)o[r].codewords[e]=t[u++];for(let e=l;e<a;e++)o[e].codewords[c]=t[u++];const w=o[0].codewords.length;for(let e=c;e<w;e++)for(let r=0;r<a;r++){const n=r<l?e:e+1;o[r].codewords[n]=t[u++]}return o}getNumDataCodewords(){return this.numDataCodewords}getCodewords(){return this.codewords}}class W{constructor(t){this.bytes=t,this.byteOffset=0,this.bitOffset=0}getBitOffset(){return this.bitOffset}getByteOffset(){return this.byteOffset}readBits(t){if(t<1||t>32||t>this.available())throw new d(""+t);let e=0,r=this.bitOffset,n=this.byteOffset;const s=this.bytes;if(r>0){const i=8-r,o=t<i?t:i,a=i-o,h=255>>8-o<<a;e=(s[n]&h)>>a,t-=o,r+=o,8===r&&(r=0,n++)}if(t>0){for(;t>=8;)e=e<<8|255&s[n],n++,t-=8;if(t>0){const i=8-t,o=255>>i<<i;e=e<<t|(s[n]&o)>>i,r+=t}}return this.bitOffset=r,this.byteOffset=n,e}available(){return 8*(this.bytes.length-this.byteOffset)-this.bitOffset}}class Z{constructor(t,e,r,n,s=-1,i=-1){this.rawBytes=t,this.text=e,this.byteSegments=r,this.ecLevel=n,this.structuredAppendSequenceNumber=s,this.structuredAppendParity=i,this.numBits=null==t?0:8*t.length}getRawBytes(){return this.rawBytes}getNumBits(){return this.numBits}setNumBits(t){this.numBits=t}getText(){return this.text}getByteSegments(){return this.byteSegments}getECLevel(){return this.ecLevel}getErrorsCorrected(){return this.errorsCorrected}setErrorsCorrected(t){this.errorsCorrected=t}getErasures(){return this.erasures}setErasures(t){this.erasures=t}getOther(){return this.other}setOther(t){this.other=t}hasStructuredAppend(){return this.structuredAppendParity>=0&&this.structuredAppendSequenceNumber>=0}getStructuredAppendParity(){return this.structuredAppendParity}getStructuredAppendSequenceNumber(){return this.structuredAppendSequenceNumber}}!function(t){t[t.TERMINATOR=0]="TERMINATOR",t[t.NUMERIC=1]="NUMERIC",t[t.ALPHANUMERIC=2]="ALPHANUMERIC",t[t.STRUCTURED_APPEND=3]="STRUCTURED_APPEND",t[t.BYTE=4]="BYTE",t[t.ECI=5]="ECI",t[t.KANJI=6]="KANJI",t[t.FNC1_FIRST_POSITION=7]="FNC1_FIRST_POSITION",t[t.FNC1_SECOND_POSITION=8]="FNC1_SECOND_POSITION",t[t.HANZI=9]="HANZI"}(h||(h={}));class X{constructor(t,e,r,n){this.value=t,this.stringValue=e,this.characterCountBitsForVersions=r,this.bits=n,X.FOR_BITS.set(n,this),X.FOR_VALUE.set(t,this)}static forBits(t){const e=X.FOR_BITS.get(t);if(void 0===e)throw new d;return e}getCharacterCountBits(t){const e=t.getVersionNumber();let r;return r=e<=9?0:e<=26?1:2,this.characterCountBitsForVersions[r]}getValue(){return this.value}getBits(){return this.bits}equals(t){if(!(t instanceof X))return!1;const e=t;return this.value===e.value}toString(){return this.stringValue}}X.FOR_BITS=new Map,X.FOR_VALUE=new Map,X.TERMINATOR=new X(h.TERMINATOR,"TERMINATOR",Int32Array.from([0,0,0]),0),X.NUMERIC=new X(h.NUMERIC,"NUMERIC",Int32Array.from([10,12,14]),1),X.ALPHANUMERIC=new X(h.ALPHANUMERIC,"ALPHANUMERIC",Int32Array.from([9,11,13]),2),X.STRUCTURED_APPEND=new X(h.STRUCTURED_APPEND,"STRUCTURED_APPEND",Int32Array.from([0,0,0]),3),X.BYTE=new X(h.BYTE,"BYTE",Int32Array.from([8,16,16]),4),X.ECI=new X(h.ECI,"ECI",Int32Array.from([0,0,0]),7),X.KANJI=new X(h.KANJI,"KANJI",Int32Array.from([8,10,12]),8),X.FNC1_FIRST_POSITION=new X(h.FNC1_FIRST_POSITION,"FNC1_FIRST_POSITION",Int32Array.from([0,0,0]),5),X.FNC1_SECOND_POSITION=new X(h.FNC1_SECOND_POSITION,"FNC1_SECOND_POSITION",Int32Array.from([0,0,0]),9),X.HANZI=new X(h.HANZI,"HANZI",Int32Array.from([8,10,12]),13);class Y{static decode(t,e,r,n){const s=new W(t);let i=new p;const o=new Array;let a=-1,h=-1;try{let t,r=null,l=!1;do{if(s.available()<4)t=X.TERMINATOR;else{const e=s.readBits(4);t=X.forBits(e)}switch(t){case X.TERMINATOR:break;case X.FNC1_FIRST_POSITION:case X.FNC1_SECOND_POSITION:l=!0;break;case X.STRUCTURED_APPEND:if(s.available()<16)throw new S;a=s.readBits(8),h=s.readBits(8);break;case X.ECI:const c=Y.parseECIValue(s);if(r=A.getCharacterSetECIByValue(c),null===r)throw new S;break;case X.HANZI:const u=s.readBits(4),w=s.readBits(t.getCharacterCountBits(e));u===Y.GB2312_SUBSET&&Y.decodeHanziSegment(s,i,w);break;default:const d=s.readBits(t.getCharacterCountBits(e));switch(t){case X.NUMERIC:Y.decodeNumericSegment(s,i,d);break;case X.ALPHANUMERIC:Y.decodeAlphanumericSegment(s,i,d,l);break;case X.BYTE:Y.decodeByteSegment(s,i,d,r,o,n);break;case X.KANJI:Y.decodeKanjiSegment(s,i,d);break;default:throw new S}}}while(t!==X.TERMINATOR)}catch(t){throw new S}return new Z(t,i.toString(),0===o.length?null:o,null===r?null:r.toString(),a,h)}static decodeHanziSegment(t,e,r){if(13*r>t.available())throw new S;const n=new Uint8Array(2*r);let s=0;for(;r>0;){const e=t.readBits(13);let i=e/96<<8&4294967295|e%96;i+=i<959?41377:42657,n[s]=i>>8&255,n[s+1]=255&i,s+=2,r--}try{e.append(E.decode(n,_.GB2312))}catch(t){throw new S(t)}}static decodeKanjiSegment(t,e,r){if(13*r>t.available())throw new S;const n=new Uint8Array(2*r);let s=0;for(;r>0;){const e=t.readBits(13);let i=e/192<<8&4294967295|e%192;i+=i<7936?33088:49472,n[s]=i>>8,n[s+1]=i,s+=2,r--}try{e.append(E.decode(n,_.SHIFT_JIS))}catch(t){throw new S(t)}}static decodeByteSegment(t,e,r,n,s,i){if(8*r>t.available())throw new S;const o=new Uint8Array(r);for(let e=0;e<r;e++)o[e]=t.readBits(8);let a;a=null===n?_.guessEncoding(o,i):n.getName();try{e.append(E.decode(o,a))}catch(t){throw new S(t)}s.push(o)}static toAlphaNumericChar(t){if(t>=Y.ALPHANUMERIC_CHARS.length)throw new S;return Y.ALPHANUMERIC_CHARS[t]}static decodeAlphanumericSegment(t,e,r,n){const s=e.length();for(;r>1;){if(t.available()<11)throw new S;const n=t.readBits(11);e.append(Y.toAlphaNumericChar(Math.floor(n/45))),e.append(Y.toAlphaNumericChar(n%45)),r-=2}if(1===r){if(t.available()<6)throw new S;e.append(Y.toAlphaNumericChar(t.readBits(6)))}if(n)for(let t=s;t<e.length();t++)"%"===e.charAt(t)&&(t<e.length()-1&&"%"===e.charAt(t+1)?e.deleteCharAt(t+1):e.setCharAt(t,String.fromCharCode(29)))}static decodeNumericSegment(t,e,r){for(;r>=3;){if(t.available()<10)throw new S;const n=t.readBits(10);if(n>=1e3)throw new S;e.append(Y.toAlphaNumericChar(Math.floor(n/100))),e.append(Y.toAlphaNumericChar(Math.floor(n/10)%10)),e.append(Y.toAlphaNumericChar(n%10)),r-=3}if(2===r){if(t.available()<7)throw new S;const r=t.readBits(7);if(r>=100)throw new S;e.append(Y.toAlphaNumericChar(Math.floor(r/10))),e.append(Y.toAlphaNumericChar(r%10))}else if(1===r){if(t.available()<4)throw new S;const r=t.readBits(4);if(r>=10)throw new S;e.append(Y.toAlphaNumericChar(r))}}static parseECIValue(t){const e=t.readBits(8);if(!(128&e))return 127&e;if(128==(192&e)){return(63&e)<<8&4294967295|t.readBits(8)}if(192==(224&e)){return(31&e)<<16&4294967295|t.readBits(16)}throw new S}}Y.ALPHANUMERIC_CHARS="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:",Y.GB2312_SUBSET=1;class q{constructor(t){this.mirrored=t}isMirrored(){return this.mirrored}applyMirroredCorrection(t){if(!this.mirrored||null===t||t.length<3)return;const e=t[0];t[0]=t[2],t[2]=e}}class Q{constructor(){this.rsDecoder=new F(D.QR_CODE_FIELD_256)}decodeBooleanArray(t,e){return this.decodeBitMatrix(N.parseFromBooleanArray(t),e)}decodeBitMatrix(t,e){const r=new V(t);let n=null;try{return this.decodeBitMatrixParser(r,e)}catch(t){n=t}try{r.remask(),r.setMirror(!0),r.readVersion(),r.readFormatInformation(),r.mirror();const t=this.decodeBitMatrixParser(r,e);return t.setOther(new q(!0)),t}catch(t){if(null!==n)throw n;throw t}}decodeBitMatrixParser(t,e){const r=t.readVersion(),n=t.readFormatInformation().getErrorCorrectionLevel(),s=t.readCodewords(),i=G.getDataBlocks(s,r,n);let o=0;for(const t of i)o+=t.getNumDataCodewords();const a=new Uint8Array(o);let h=0;for(const t of i){const e=t.getCodewords(),r=t.getNumDataCodewords();this.correctErrors(e,r);for(let t=0;t<r;t++)a[h++]=e[t]}return Y.decode(a,r,n,e)}correctErrors(t,e){const r=new Int32Array(t);try{this.rsDecoder.decode(r,t.length-e)}catch(t){throw new T}for(let n=0;n<e;n++)t[n]=r[n]}}class J{constructor(){}static round(t){return isNaN(t)?0:t<=Number.MIN_SAFE_INTEGER?Number.MIN_SAFE_INTEGER:t>=Number.MAX_SAFE_INTEGER?Number.MAX_SAFE_INTEGER:t+(t<0?-.5:.5)|0}static distance(t,e,r,n){const s=t-r,i=e-n;return Math.sqrt(s*s+i*i)}static sum(t){let e=0;for(let r=0,n=t.length;r!==n;r++){e+=t[r]}return e}}class j{constructor(t,e){this.bits=t,this.points=e}getBits(){return this.bits}getPoints(){return this.points}}class ${static checkAndNudgePoints(t,e){const r=t.getWidth(),n=t.getHeight();let s=!0;for(let t=0;t<e.length&&s;t+=2){const i=Math.floor(e[t]),o=Math.floor(e[t+1]);if(i<-1||i>r||o<-1||o>n)throw new w;s=!1,-1===i?(e[t]=0,s=!0):i===r&&(e[t]=r-1,s=!0),-1===o?(e[t+1]=0,s=!0):o===n&&(e[t+1]=n-1,s=!0)}s=!0;for(let t=e.length-2;t>=0&&s;t-=2){const i=Math.floor(e[t]),o=Math.floor(e[t+1]);if(i<-1||i>r||o<-1||o>n)throw new w;s=!1,-1===i?(e[t]=0,s=!0):i===r&&(e[t]=r-1,s=!0),-1===o?(e[t+1]=0,s=!0):o===n&&(e[t+1]=n-1,s=!0)}}}class tt{constructor(t,e,r,n,s,i,o,a,h){this.a11=t,this.a21=e,this.a31=r,this.a12=n,this.a22=s,this.a32=i,this.a13=o,this.a23=a,this.a33=h}static quadrilateralToQuadrilateral(t,e,r,n,s,i,o,a,h,l,c,u,w,d,f,g){const m=tt.quadrilateralToSquare(t,e,r,n,s,i,o,a);return tt.squareToQuadrilateral(h,l,c,u,w,d,f,g).times(m)}transformPoints(t){const e=t.length,r=this.a11,n=this.a12,s=this.a13,i=this.a21,o=this.a22,a=this.a23,h=this.a31,l=this.a32,c=this.a33;for(let u=0;u<e;u+=2){const e=t[u],w=t[u+1],d=s*e+a*w+c;t[u]=(r*e+i*w+h)/d,t[u+1]=(n*e+o*w+l)/d}}transformPointsWithValues(t,e){const r=this.a11,n=this.a12,s=this.a13,i=this.a21,o=this.a22,a=this.a23,h=this.a31,l=this.a32,c=this.a33,u=t.length;for(let w=0;w<u;w++){const u=t[w],d=e[w],f=s*u+a*d+c;t[w]=(r*u+i*d+h)/f,e[w]=(n*u+o*d+l)/f}}static squareToQuadrilateral(t,e,r,n,s,i,o,a){const h=t-r+s-o,l=e-n+i-a;if(0===h&&0===l)return new tt(r-t,s-r,t,n-e,i-n,e,0,0,1);{const c=r-s,u=o-s,w=n-i,d=a-i,f=c*d-u*w,g=(h*d-u*l)/f,m=(c*l-h*w)/f;return new tt(r-t+g*r,o-t+m*o,t,n-e+g*n,a-e+m*a,e,g,m,1)}}static quadrilateralToSquare(t,e,r,n,s,i,o,a){return tt.squareToQuadrilateral(t,e,r,n,s,i,o,a).buildAdjoint()}buildAdjoint(){return new tt(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(t){return new tt(this.a11*t.a11+this.a21*t.a12+this.a31*t.a13,this.a11*t.a21+this.a21*t.a22+this.a31*t.a23,this.a11*t.a31+this.a21*t.a32+this.a31*t.a33,this.a12*t.a11+this.a22*t.a12+this.a32*t.a13,this.a12*t.a21+this.a22*t.a22+this.a32*t.a23,this.a12*t.a31+this.a22*t.a32+this.a32*t.a33,this.a13*t.a11+this.a23*t.a12+this.a33*t.a13,this.a13*t.a21+this.a23*t.a22+this.a33*t.a23,this.a13*t.a31+this.a23*t.a32+this.a33*t.a33)}}class et{static setGridSampler(t){et.gridSampler=t}static getInstance(){return et.gridSampler}}et.gridSampler=new class extends ${sampleGrid(t,e,r,n,s,i,o,a,h,l,c,u,w,d,f,g,m,I,S){const A=tt.quadrilateralToQuadrilateral(n,s,i,o,a,h,l,c,u,w,d,f,g,m,I,S);return this.sampleGridWithTransform(t,e,r,A)}sampleGridWithTransform(t,e,r,n){if(e<=0||r<=0)throw new w;const s=new N(e,r),i=new Float32Array(2*e);for(let e=0;e<r;e++){const r=i.length,o=e+.5;for(let t=0;t<r;t+=2)i[t]=t/2+.5,i[t+1]=o;n.transformPoints(i),$.checkAndNudgePoints(t,i);try{for(let n=0;n<r;n+=2)t.get(Math.floor(i[n]),Math.floor(i[n+1]))&&s.set(n/2,e)}catch(t){throw new w}}return s}};class rt{static floatToIntBits(t){return t}}rt.MAX_VALUE=Number.MAX_SAFE_INTEGER;class nt{constructor(t,e){this.x=t,this.y=e}getX(){return this.x}getY(){return this.y}equals(t){if(t instanceof nt){const e=t;return this.x===e.x&&this.y===e.y}return!1}hashCode(){return 31*rt.floatToIntBits(this.x)+rt.floatToIntBits(this.y)}toString(){return"("+this.x+","+this.y+")"}static orderBestPatterns(t){const e=this.distance(t[0],t[1]),r=this.distance(t[1],t[2]),n=this.distance(t[0],t[2]);let s,i,o;if(r>=e&&r>=n?(i=t[0],s=t[1],o=t[2]):n>=r&&n>=e?(i=t[1],s=t[0],o=t[2]):(i=t[2],s=t[0],o=t[1]),this.crossProductZ(s,i,o)<0){const t=s;s=o,o=t}t[0]=s,t[1]=i,t[2]=o}static distance(t,e){return J.distance(t.x,t.y,e.x,e.y)}static crossProductZ(t,e,r){const n=e.x,s=e.y;return(r.x-n)*(t.y-s)-(r.y-s)*(t.x-n)}}class st extends nt{constructor(t,e,r){super(t,e),this.estimatedModuleSize=r}aboutEquals(t,e,r){if(Math.abs(e-this.getY())<=t&&Math.abs(r-this.getX())<=t){const e=Math.abs(t-this.estimatedModuleSize);return e<=1||e<=this.estimatedModuleSize}return!1}combineEstimate(t,e,r){const n=(this.getX()+e)/2,s=(this.getY()+t)/2,i=(this.estimatedModuleSize+r)/2;return new st(n,s,i)}}class it{constructor(t,e,r,n,s,i,o){this.image=t,this.startX=e,this.startY=r,this.width=n,this.height=s,this.moduleSize=i,this.resultPointCallback=o,this.possibleCenters=[],this.crossCheckStateCount=new Int32Array(3)}find(){const t=this.startX,e=this.height,r=t+this.width,n=this.startY+e/2,s=new Int32Array(3),i=this.image;for(let o=0;o<e;o++){const e=n+(1&o?-Math.floor((o+1)/2):Math.floor((o+1)/2));s[0]=0,s[1]=0,s[2]=0;let a=t;for(;a<r&&!i.get(a,e);)a++;let h=0;for(;a<r;){if(i.get(a,e))if(1===h)s[1]++;else if(2===h){if(this.foundPatternCross(s)){const t=this.handlePossibleCenter(s,e,a);if(null!==t)return t}s[0]=s[2],s[1]=1,s[2]=0,h=1}else s[++h]++;else 1===h&&h++,s[h]++;a++}if(this.foundPatternCross(s)){const t=this.handlePossibleCenter(s,e,r);if(null!==t)return t}}if(0!==this.possibleCenters.length)return this.possibleCenters[0];throw new w}static centerFromEnd(t,e){return e-t[2]-t[1]/2}foundPatternCross(t){const e=this.moduleSize,r=e/2;for(let n=0;n<3;n++)if(Math.abs(e-t[n])>=r)return!1;return!0}crossCheckVertical(t,e,r,n){const s=this.image,i=s.getHeight(),o=this.crossCheckStateCount;o[0]=0,o[1]=0,o[2]=0;let a=t;for(;a>=0&&s.get(e,a)&&o[1]<=r;)o[1]++,a--;if(a<0||o[1]>r)return NaN;for(;a>=0&&!s.get(e,a)&&o[0]<=r;)o[0]++,a--;if(o[0]>r)return NaN;for(a=t+1;a<i&&s.get(e,a)&&o[1]<=r;)o[1]++,a++;if(a===i||o[1]>r)return NaN;for(;a<i&&!s.get(e,a)&&o[2]<=r;)o[2]++,a++;if(o[2]>r)return NaN;const h=o[0]+o[1]+o[2];return 5*Math.abs(h-n)>=2*n?NaN:this.foundPatternCross(o)?it.centerFromEnd(o,a):NaN}handlePossibleCenter(t,e,r){const n=t[0]+t[1]+t[2],s=it.centerFromEnd(t,r),i=this.crossCheckVertical(e,s,2*t[1],n);if(!isNaN(i)){const e=(t[0]+t[1]+t[2])/3;for(const t of this.possibleCenters)if(t.aboutEquals(e,i,s))return t.combineEstimate(i,s,e);const r=new st(s,i,e);this.possibleCenters.push(r),null!==this.resultPointCallback&&void 0!==this.resultPointCallback&&this.resultPointCallback.foundPossibleResultPoint(r)}return null}}class ot extends nt{constructor(t,e,r,n){super(t,e),this.estimatedModuleSize=r,this.count=n,void 0===n&&(this.count=1)}getEstimatedModuleSize(){return this.estimatedModuleSize}getCount(){return this.count}aboutEquals(t,e,r){if(Math.abs(e-this.getY())<=t&&Math.abs(r-this.getX())<=t){const e=Math.abs(t-this.estimatedModuleSize);return e<=1||e<=this.estimatedModuleSize}return!1}combineEstimate(t,e,r){const n=this.count??0,s=n+1,i=(n*this.getX()+e)/s,o=(n*this.getY()+t)/s,a=(n*this.estimatedModuleSize+r)/s;return new ot(i,o,a,s)}}class at{constructor(t){this.bottomLeft=t[0],this.topLeft=t[1],this.topRight=t[2]}getBottomLeft(){return this.bottomLeft}getTopLeft(){return this.topLeft}getTopRight(){return this.topRight}}class ht{constructor(t,e){this.image=t,this.resultPointCallback=e,this.possibleCenters=[],this.crossCheckStateCount=new Int32Array(5),this.resultPointCallback=e}getImage(){return this.image}getPossibleCenters(){return this.possibleCenters}find(t){const e=null!=t&&void 0!==t.get(n.TRY_HARDER),r=null!=t&&void 0!==t.get(n.PURE_BARCODE),s=this.image,i=s.getHeight(),o=s.getWidth();let a=Math.floor(3*i/(4*ht.MAX_MODULES));(a<ht.MIN_SKIP||e)&&(a=ht.MIN_SKIP);let h=!1;const l=new Int32Array(5);for(let t=a-1;t<i&&!h;t+=a){l[0]=0,l[1]=0,l[2]=0,l[3]=0,l[4]=0;let e=0;for(let n=0;n<o;n++)if(s.get(n,t))1&~e||e++,l[e]++;else if(1&e)l[e]++;else if(4===e)if(ht.foundPatternCross(l)){if(!0!==this.handlePossibleCenter(l,t,n,r)){l[0]=l[2],l[1]=l[3],l[2]=l[4],l[3]=1,l[4]=0,e=3;continue}if(a=2,!0===this.hasSkipped)h=this.haveMultiplyConfirmedCenters();else{const e=this.findRowSkip();e>l[2]&&(t+=e-l[2]-a,n=o-1)}e=0,l[0]=0,l[1]=0,l[2]=0,l[3]=0,l[4]=0}else l[0]=l[2],l[1]=l[3],l[2]=l[4],l[3]=1,l[4]=0,e=3;else l[++e]++;if(ht.foundPatternCross(l)){!0===this.handlePossibleCenter(l,t,o,r)&&(a=l[0],this.hasSkipped&&(h=this.haveMultiplyConfirmedCenters()))}}const c=this.selectBestPatterns();return nt.orderBestPatterns(c),new at(c)}static centerFromEnd(t,e){return e-t[4]-t[3]-t[2]/2}static foundPatternCross(t){let e=0;for(let r=0;r<5;r++){const n=t[r];if(0===n)return!1;e+=n}if(e<7)return!1;const r=e/7,n=r/2;return Math.abs(r-t[0])<n&&Math.abs(r-t[1])<n&&Math.abs(3*r-t[2])<3*n&&Math.abs(r-t[3])<n&&Math.abs(r-t[4])<n}getCrossCheckStateCount(){const t=this.crossCheckStateCount;return t[0]=0,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t}crossCheckDiagonal(t,e,r,n){const s=this.getCrossCheckStateCount();let i=0;const o=this.image;for(;t>=i&&e>=i&&o.get(e-i,t-i);)s[2]++,i++;if(t<i||e<i)return!1;for(;t>=i&&e>=i&&!o.get(e-i,t-i)&&s[1]<=r;)s[1]++,i++;if(t<i||e<i||s[1]>r)return!1;for(;t>=i&&e>=i&&o.get(e-i,t-i)&&s[0]<=r;)s[0]++,i++;if(s[0]>r)return!1;const a=o.getHeight(),h=o.getWidth();for(i=1;t+i<a&&e+i<h&&o.get(e+i,t+i);)s[2]++,i++;if(t+i>=a||e+i>=h)return!1;for(;t+i<a&&e+i<h&&!o.get(e+i,t+i)&&s[3]<r;)s[3]++,i++;if(t+i>=a||e+i>=h||s[3]>=r)return!1;for(;t+i<a&&e+i<h&&o.get(e+i,t+i)&&s[4]<r;)s[4]++,i++;if(s[4]>=r)return!1;const l=s[0]+s[1]+s[2]+s[3]+s[4];return Math.abs(l-n)<2*n&&ht.foundPatternCross(s)}crossCheckVertical(t,e,r,n){const s=this.image,i=s.getHeight(),o=this.getCrossCheckStateCount();let a=t;for(;a>=0&&s.get(e,a);)o[2]++,a--;if(a<0)return NaN;for(;a>=0&&!s.get(e,a)&&o[1]<=r;)o[1]++,a--;if(a<0||o[1]>r)return NaN;for(;a>=0&&s.get(e,a)&&o[0]<=r;)o[0]++,a--;if(o[0]>r)return NaN;for(a=t+1;a<i&&s.get(e,a);)o[2]++,a++;if(a===i)return NaN;for(;a<i&&!s.get(e,a)&&o[3]<r;)o[3]++,a++;if(a===i||o[3]>=r)return NaN;for(;a<i&&s.get(e,a)&&o[4]<r;)o[4]++,a++;if(o[4]>=r)return NaN;const h=o[0]+o[1]+o[2]+o[3]+o[4];return 5*Math.abs(h-n)>=2*n?NaN:ht.foundPatternCross(o)?ht.centerFromEnd(o,a):NaN}crossCheckHorizontal(t,e,r,n){const s=this.image,i=s.getWidth(),o=this.getCrossCheckStateCount();let a=t;for(;a>=0&&s.get(a,e);)o[2]++,a--;if(a<0)return NaN;for(;a>=0&&!s.get(a,e)&&o[1]<=r;)o[1]++,a--;if(a<0||o[1]>r)return NaN;for(;a>=0&&s.get(a,e)&&o[0]<=r;)o[0]++,a--;if(o[0]>r)return NaN;for(a=t+1;a<i&&s.get(a,e);)o[2]++,a++;if(a===i)return NaN;for(;a<i&&!s.get(a,e)&&o[3]<r;)o[3]++,a++;if(a===i||o[3]>=r)return NaN;for(;a<i&&s.get(a,e)&&o[4]<r;)o[4]++,a++;if(o[4]>=r)return NaN;const h=o[0]+o[1]+o[2]+o[3]+o[4];return 5*Math.abs(h-n)>=n?NaN:ht.foundPatternCross(o)?ht.centerFromEnd(o,a):NaN}handlePossibleCenter(t,e,r,n){const s=t[0]+t[1]+t[2]+t[3]+t[4];let i=ht.centerFromEnd(t,r),o=this.crossCheckVertical(e,Math.floor(i),t[2],s);if(!isNaN(o)&&(i=this.crossCheckHorizontal(Math.floor(i),Math.floor(o),t[2],s),!isNaN(i)&&(!n||this.crossCheckDiagonal(Math.floor(o),Math.floor(i),t[2],s)))){const t=s/7;let e=!1;const r=this.possibleCenters;for(let n=0,s=r.length;n<s;n++){const s=r[n];if(s.aboutEquals(t,o,i)){r[n]=s.combineEstimate(o,i,t),e=!0;break}}if(!e){const e=new ot(i,o,t);r.push(e),null!==this.resultPointCallback&&void 0!==this.resultPointCallback&&this.resultPointCallback.foundPossibleResultPoint(e)}return!0}return!1}findRowSkip(){if(this.possibleCenters.length<=1)return 0;let t=null;for(const e of this.possibleCenters){const r=e?.getCount();if(void 0!==r&&r>=ht.CENTER_QUORUM){if(null!=t)return this.hasSkipped=!0,Math.floor((Math.abs(t.getX()-e.getX())-Math.abs(t.getY()-e.getY()))/2);t=e}}return 0}haveMultiplyConfirmedCenters(){let t=0,e=0;const r=this.possibleCenters.length;for(const r of this.possibleCenters){const n=r.getCount();void 0!==n&&n>=ht.CENTER_QUORUM&&(t++,e+=r.getEstimatedModuleSize())}if(t<3)return!1;const n=e/r;let s=0;for(const t of this.possibleCenters)s+=Math.abs(t.getEstimatedModuleSize()-n);return s<=.05*e}selectBestPatterns(){const t=this.possibleCenters.length;if(t<3)throw new w;const e=this.possibleCenters;let r;if(t>3){let n=0,s=0;for(const t of this.possibleCenters){const e=t.getEstimatedModuleSize();n+=e,s+=e*e}r=n/t;let i=Math.sqrt(s/t-r*r);e.sort(((t,e)=>{const n=Math.abs(e.getEstimatedModuleSize()-r),s=Math.abs(t.getEstimatedModuleSize()-r);return n<s?-1:n>s?1:0}));const o=Math.max(.2*r,i);for(let t=0;t<e.length&&e.length>3;t++){const n=e[t];Math.abs(n.getEstimatedModuleSize()-r)>o&&(e.splice(t,1),t--)}}if(e.length>3){let t=0;for(const r of e)t+=r.getEstimatedModuleSize();r=t/e.length,e.sort(((t,e)=>{if(e.getCount()===t.getCount()){const n=Math.abs(e.getEstimatedModuleSize()-r),s=Math.abs(t.getEstimatedModuleSize()-r);return n<s?1:n>s?-1:0}return(e.getCount()??0)-(t.getCount()??0)})),e.splice(3)}return[e[0],e[1],e[2]]}}ht.CENTER_QUORUM=2,ht.MIN_SKIP=3,ht.MAX_MODULES=57;class lt{constructor(t){this.image=t}getImage(){return this.image}getResultPointCallback(){return this.resultPointCallback}detect(t){this.resultPointCallback=null==t?null:t.get(n.NEED_RESULT_POINT_CALLBACK);const e=new ht(this.image,this.resultPointCallback).find(t);return this.processFinderPatternInfo(e)}processFinderPatternInfo(t){const e=t.getTopLeft(),r=t.getTopRight(),n=t.getBottomLeft(),s=this.calculateModuleSize(e,r,n);if(s<1)throw new w("No pattern found in proccess finder.");const i=lt.computeDimension(e,r,n,s),o=K.getProvisionalVersionForDimension(i),a=o.getDimensionForVersion()-7;let h=null;if(o.getAlignmentPatternCenters().length>0){const t=r.getX()-e.getX()+n.getX(),i=r.getY()-e.getY()+n.getY(),o=1-3/a,l=Math.floor(e.getX()+o*(t-e.getX())),c=Math.floor(e.getY()+o*(i-e.getY()));for(let t=4;t<=16;t<<=1)try{h=this.findAlignmentInRegion(s,l,c,t);break}catch(t){if(!(t instanceof w))throw t}}const l=lt.createTransform(e,r,n,h,i),c=lt.sampleGrid(this.image,l,i);let u;return u=null===h?[n,e,r]:[n,e,r,h],new j(c,u)}static createTransform(t,e,r,n,s){const i=s-3.5;let o,a,h,l;return null!==n?(o=n.getX(),a=n.getY(),h=i-3,l=h):(o=e.getX()-t.getX()+r.getX(),a=e.getY()-t.getY()+r.getY(),h=i,l=i),tt.quadrilateralToQuadrilateral(3.5,3.5,i,3.5,h,l,3.5,i,t.getX(),t.getY(),e.getX(),e.getY(),o,a,r.getX(),r.getY())}static sampleGrid(t,e,r){return et.getInstance().sampleGridWithTransform(t,r,r,e)}static computeDimension(t,e,r,n){const s=J.round(nt.distance(t,e)/n),i=J.round(nt.distance(t,r)/n);let o=Math.floor((s+i)/2)+7;switch(3&o){case 0:o++;break;case 2:o--;break;case 3:throw new w("Dimensions could be not found.")}return o}calculateModuleSize(t,e,r){return(this.calculateModuleSizeOneWay(t,e)+this.calculateModuleSizeOneWay(t,r))/2}calculateModuleSizeOneWay(t,e){const r=this.sizeOfBlackWhiteBlackRunBothWays(Math.floor(t.getX()),Math.floor(t.getY()),Math.floor(e.getX()),Math.floor(e.getY())),n=this.sizeOfBlackWhiteBlackRunBothWays(Math.floor(e.getX()),Math.floor(e.getY()),Math.floor(t.getX()),Math.floor(t.getY()));return isNaN(r)?n/7:isNaN(n)?r/7:(r+n)/14}sizeOfBlackWhiteBlackRunBothWays(t,e,r,n){let s=this.sizeOfBlackWhiteBlackRun(t,e,r,n),i=1,o=t-(r-t);o<0?(i=t/(t-o),o=0):o>=this.image.getWidth()&&(i=(this.image.getWidth()-1-t)/(o-t),o=this.image.getWidth()-1);let a=Math.floor(e-(n-e)*i);return i=1,a<0?(i=e/(e-a),a=0):a>=this.image.getHeight()&&(i=(this.image.getHeight()-1-e)/(a-e),a=this.image.getHeight()-1),o=Math.floor(t+(o-t)*i),s+=this.sizeOfBlackWhiteBlackRun(t,e,o,a),s-1}sizeOfBlackWhiteBlackRun(t,e,r,n){const s=Math.abs(n-e)>Math.abs(r-t);if(s){let s=t;t=e,e=s,s=r,r=n,n=s}const i=Math.abs(r-t),o=Math.abs(n-e);let a=-i/2;const h=t<r?1:-1,l=e<n?1:-1;let c=0;const u=r+h;for(let r=t,w=e;r!==u;r+=h){const h=s?w:r,u=s?r:w;if(1===c===this.image.get(h,u)){if(2===c)return J.distance(r,w,t,e);c++}if(a+=o,a>0){if(w===n)break;w+=l,a-=i}}return 2===c?J.distance(r+h,n,t,e):NaN}findAlignmentInRegion(t,e,r,n){const s=Math.floor(n*t),i=Math.max(0,e-s),o=Math.min(this.image.getWidth()-1,e+s);if(o-i<3*t)throw new w("Alignment top exceeds estimated module size.");const a=Math.max(0,r-s),h=Math.min(this.image.getHeight()-1,r+s);if(h-a<3*t)throw new w("Alignment bottom exceeds estimated module size.");return new it(this.image,i,a,o-i,h-a,t,this.resultPointCallback).find()}}class ct{constructor(){this.decoder=new Q}getDecoder(){return this.decoder}decode(t,e){let s,o;const a=null==e?(new Map).set(n.TRY_HARDER,!0):e;try{const e=ct.extractPureBits(t.getBlackMatrix());s=this.decoder.decodeBitMatrix(e,a),o=ct.NO_POINTS}catch(e){const r=new lt(t.getBlackMatrix()).detect(a);s=this.decoder.decodeBitMatrix(r.getBits(),a),o=r.getPoints()}s.getOther()instanceof q&&s.getOther().applyMirroredCorrection(o);const h=new y(s.getText(),s.getRawBytes(),void 0,o,r.QR_CODE,void 0),l=s.getByteSegments();l&&h.putMetadata(i.BYTE_SEGMENTS,l);const c=s.getECLevel();return c&&h.putMetadata(i.ERROR_CORRECTION_LEVEL,c),s.hasStructuredAppend()&&(h.putMetadata(i.STRUCTURED_APPEND_SEQUENCE,s.getStructuredAppendSequenceNumber()),h.putMetadata(i.STRUCTURED_APPEND_PARITY,s.getStructuredAppendParity())),h}decode2(t,e){let s,o;const a=null==e||null==e?(new Map).set(n.TRY_HARDER,!0):void 0;console.log("hintsDef",a);const h=ct.extractPureBits(t.getBlackMatrix());s=this.decoder.decodeBitMatrix(h,a),o=ct.NO_POINTS,s.getOther()instanceof q&&s.getOther().applyMirroredCorrection(o);const l=new y(s.getText(),s.getRawBytes(),void 0,o,r.QR_CODE,void 0),c=s.getByteSegments();null!==c&&l.putMetadata(i.BYTE_SEGMENTS,c);const u=s.getECLevel();return null!==u&&l.putMetadata(i.ERROR_CORRECTION_LEVEL,u),s.hasStructuredAppend()&&(l.putMetadata(i.STRUCTURED_APPEND_SEQUENCE,s.getStructuredAppendSequenceNumber()),l.putMetadata(i.STRUCTURED_APPEND_PARITY,s.getStructuredAppendParity())),l}reset(){}static extractPureBits(t){const e=t.getTopLeftOnBit(),r=t.getBottomRightOnBit();if(null===e||null===r)throw new w;const n=this.moduleSize(e,t);let s=e[1],i=r[1],o=e[0],a=r[0];if(o>=a||s>=i)throw new w;if(i-s!=a-o&&(a=o+(i-s),a>=t.getWidth()))throw new w;const h=Math.round((a-o+1)/n),l=Math.round((i-s+1)/n);if(h<=0||l<=0)throw new w;if(l!==h)throw new w;const c=Math.floor(n/2);s+=c,o+=c;const u=o+Math.floor((h-1)*n)-a;if(u>0){if(u>c)throw new w;o-=u}const d=s+Math.floor((l-1)*n)-i;if(d>0){if(d>c)throw new w;s-=d}const f=new N(h,l);for(let e=0;e<l;e++){const r=s+Math.floor(e*n);for(let s=0;s<h;s++)t.get(o+Math.floor(s*n),r)&&f.set(s,e)}return f}static moduleSize(t,e){const r=e.getHeight(),n=e.getWidth();let s=t[0],i=t[1],o=!0,a=0;for(;s<n&&i<r;){if(o!==e.get(s,i)){if(5==++a)break;o=!o}s++,i++}if(s===n||i===r)throw new w;return(s-t[0])/7}}ct.NO_POINTS=new Array;class ut{constructor(t){if(this.binarizer=t,null===t)throw new d("Binarizer must be non-null.")}getWidth(){return this.binarizer.getWidth()}getHeight(){return this.binarizer.getHeight()}getBlackRow(t,e){return this.binarizer.getBlackRow(t,e)}getBlackMatrix(){return null!==this.matrix&&void 0!==this.matrix||(this.matrix=this.binarizer.getBlackMatrix()),this.matrix}isCropSupported(){return this.binarizer.getLuminanceSource().isCropSupported()}crop(t,e,r,n){const s=this.binarizer.getLuminanceSource().crop(t,e,r,n);return new ut(this.binarizer.createBinarizer(s))}isRotateSupported(){return this.binarizer.getLuminanceSource().isRotateSupported()}rotateCounterClockwise(){const t=this.binarizer.getLuminanceSource().rotateCounterClockwise();return new ut(this.binarizer.createBinarizer(t))}rotateCounterClockwise45(){const t=this.binarizer.getLuminanceSource().rotateCounterClockwise45();return new ut(this.binarizer.createBinarizer(t))}toString(){try{return this.getBlackMatrix().toString()}catch(t){return""}}}class wt{constructor(t){this.source=t}getLuminanceSource(){return this.source}getWidth(){return this.source.getWidth()}getHeight(){return this.source.getHeight()}}class dt extends wt{constructor(t){super(t),this.luminances=dt.EMPTY,this.buckets=new Int32Array(dt.LUMINANCE_BUCKETS)}getBlackRow(t,e){const r=this.getLuminanceSource(),n=r.getWidth();null==e||e.getSize()<n?e=new O(n):e.clear(),this.initArrays(n);const s=r.getRow(t,this.luminances),i=this.buckets;for(let t=0;t<n;t++)i[(255&s[t])>>dt.LUMINANCE_SHIFT]++;const o=dt.estimateBlackPoint(i);if(n<3)for(let t=0;t<n;t++)(255&s[t])<o&&e.set(t);else{let t=255&s[0],r=255&s[1];for(let i=1;i<n-1;i++){const n=255&s[i+1];(4*r-t-n)/2<o&&e.set(i),t=r,r=n}}return e}getBlackMatrix(){const t=this.getLuminanceSource(),e=t.getWidth(),r=t.getHeight(),n=new N(e,r);this.initArrays(e);const s=this.buckets;for(let n=1;n<5;n++){const i=Math.floor(r*n/5),o=t.getRow(i,this.luminances),a=Math.floor(4*e/5);for(let t=Math.floor(e/5);t<a;t++){s[(255&o[t])>>dt.LUMINANCE_SHIFT]++}}const i=dt.estimateBlackPoint(s),o=t.getMatrix();for(let t=0;t<r;t++){const r=t*e;for(let s=0;s<e;s++){(255&o[r+s])<i&&n.set(s,t)}}return n}createBinarizer(t){return new dt(t)}initArrays(t){this.luminances.length<t&&(this.luminances=new Uint8ClampedArray(t));const e=this.buckets;for(let t=0;t<dt.LUMINANCE_BUCKETS;t++)e[t]=0}static estimateBlackPoint(t){const e=t.length;let r=0,n=0,s=0;for(let i=0;i<e;i++)t[i]>s&&(n=i,s=t[i]),t[i]>r&&(r=t[i]);let i=0,o=0;for(let r=0;r<e;r++){const e=r-n,s=t[r]*e*e;s>o&&(i=r,o=s)}if(n>i){const t=n;n=i,i=t}if(i-n<=e/16)throw new w;let a=i-1,h=-1;for(let e=i-1;e>n;e--){const s=e-n,o=s*s*(i-e)*(r-t[e]);o>h&&(a=e,h=o)}return a<<dt.LUMINANCE_SHIFT}}dt.LUMINANCE_BITS=5,dt.LUMINANCE_SHIFT=8-dt.LUMINANCE_BITS,dt.LUMINANCE_BUCKETS=1<<dt.LUMINANCE_BITS,dt.EMPTY=Uint8ClampedArray.from([0]);class ft extends dt{constructor(t){super(t),this.matrix=null}getBlackMatrix(){if(null!==this.matrix)return this.matrix;const t=this.getLuminanceSource(),e=t.getWidth(),r=t.getHeight();if(e>=ft.MINIMUM_DIMENSION&&r>=ft.MINIMUM_DIMENSION){const n=t.getMatrix();let s=e>>ft.BLOCK_SIZE_POWER;e&ft.BLOCK_SIZE_MASK&&s++;let i=r>>ft.BLOCK_SIZE_POWER;r&ft.BLOCK_SIZE_MASK&&i++;const o=ft.calculateBlackPoints(n,s,i,e,r),a=new N(e,r);ft.calculateThresholdForBlock(n,s,i,e,r,o,a),this.matrix=a}else this.matrix=super.getBlackMatrix();return this.matrix}createBinarizer(t){return new ft(t)}static calculateThresholdForBlock(t,e,r,n,s,i,o){const a=s-ft.BLOCK_SIZE,h=n-ft.BLOCK_SIZE;for(let s=0;s<r;s++){let l=s<<ft.BLOCK_SIZE_POWER;l>a&&(l=a);const c=ft.cap(s,2,r-3);for(let r=0;r<e;r++){let s=r<<ft.BLOCK_SIZE_POWER;s>h&&(s=h);const a=ft.cap(r,2,e-3);let u=0;for(let t=-2;t<=2;t++){const e=i[c+t];u+=e[a-2]+e[a-1]+e[a]+e[a+1]+e[a+2]}const w=u/25;ft.thresholdBlock(t,s,l,w,n,o)}}}static cap(t,e,r){return t<e?e:t>r?r:t}static thresholdBlock(t,e,r,n,s,i){for(let o=0,a=r*s+e;o<ft.BLOCK_SIZE;o++,a+=s)for(let s=0;s<ft.BLOCK_SIZE;s++)(255&t[a+s])<=n&&i.set(e+s,r+o)}static calculateBlackPoints(t,e,r,n,s){const i=s-ft.BLOCK_SIZE,o=n-ft.BLOCK_SIZE,a=new Array(r);for(let s=0;s<r;s++){a[s]=new Int32Array(e);let r=s<<ft.BLOCK_SIZE_POWER;r>i&&(r=i);for(let i=0;i<e;i++){let e=i<<ft.BLOCK_SIZE_POWER;e>o&&(e=o);let h=0,l=255,c=0;for(let s=0,i=r*n+e;s<ft.BLOCK_SIZE;s++,i+=n){for(let e=0;e<ft.BLOCK_SIZE;e++){const r=255&t[i+e];h+=r,r<l&&(l=r),r>c&&(c=r)}if(c-l>ft.MIN_DYNAMIC_RANGE)for(s++,i+=n;s<ft.BLOCK_SIZE;s++,i+=n)for(let e=0;e<ft.BLOCK_SIZE;e++)h+=255&t[i+e]}let u=h>>2*ft.BLOCK_SIZE_POWER;if(c-l<=ft.MIN_DYNAMIC_RANGE&&(u=l/2,s>0&&i>0)){const t=(a[s-1][i]+2*a[s][i-1]+a[s-1][i-1])/4;l<t&&(u=t)}a[s][i]=u}}return a}}ft.BLOCK_SIZE_POWER=3,ft.BLOCK_SIZE=1<<ft.BLOCK_SIZE_POWER,ft.BLOCK_SIZE_MASK=ft.BLOCK_SIZE-1,ft.MINIMUM_DIMENSION=5*ft.BLOCK_SIZE,ft.MIN_DYNAMIC_RANGE=24;class gt{constructor(t,e){this.width=t,this.height=e}getWidth(){return this.width}getHeight(){return this.height}isCropSupported(){return!1}crop(t,e,r,n){throw new C("This luminance source does not support cropping.")}isRotateSupported(){return!1}rotateCounterClockwise(){throw new C("This luminance source does not support rotation by 90 degrees.")}rotateCounterClockwise45(){throw new C("This luminance source does not support rotation by 45 degrees.")}toString(){const t=new Uint8ClampedArray(this.width);let e=new p;for(let r=0;r<this.height;r++){const n=this.getRow(r,t);for(let t=0;t<this.width;t++){const r=255&n[t];let s;s=r<64?"#":r<128?"+":r<192?".":" ",e.append(s)}e.append("\n")}return e.toString()}}class mt extends gt{constructor(t){super(t.getWidth(),t.getHeight()),this.delegate=t}getRow(t,e){const r=this.delegate.getRow(t,e),n=this.getWidth();for(let t=0;t<n;t++)r[t]=255-(255&r[t]);return r}getMatrix(){const t=this.delegate.getMatrix(),e=this.getWidth()*this.getHeight(),r=new Uint8ClampedArray(e);for(let n=0;n<e;n++)r[n]=255-(255&t[n]);return r}isCropSupported(){return this.delegate.isCropSupported()}crop(t,e,r,n){return new mt(this.delegate.crop(t,e,r,n))}isRotateSupported(){return this.delegate.isRotateSupported()}invert(){return this.delegate}rotateCounterClockwise(){return new mt(this.delegate.rotateCounterClockwise())}rotateCounterClockwise45(){return new mt(this.delegate.rotateCounterClockwise45())}}class It extends gt{constructor(t,e=128){super(t.getWidth(),t.getHeight()),this.delegate=t,this.threshold=e}getRow(t,e){const r=this.delegate.getRow(t,e),n=this.getWidth();for(let t=0;t<n;t++)r[t]=r[t]<this.threshold?0:255;return r}getMatrix(){const t=this.delegate.getMatrix(),e=this.getWidth()*this.getHeight(),r=new Uint8ClampedArray(e);for(let n=0;n<e;n++)r[n]=t[n]<this.threshold?0:255;return r}isCropSupported(){return this.delegate.isCropSupported()}crop(t,e,r,n){return new It(this.delegate.crop(t,e,r,n),this.threshold)}isRotateSupported(){return this.delegate.isRotateSupported()}rotateCounterClockwise(){return new It(this.delegate.rotateCounterClockwise(),this.threshold)}rotateCounterClockwise45(){return new It(this.delegate.rotateCounterClockwise45(),this.threshold)}invert(){return new mt(this)}highContrast(){return this}}class St extends gt{constructor(t,e=!1){super(t.width,t.height),this.canvas=t,this.tempCanvasElement=null,this.buffer=St.makeBufferFromCanvasImageData(t,e)}static makeBufferFromCanvasImageData(t,e=!1){const r=t.getContext("2d").getImageData(0,0,t.width,t.height);return St.toGrayscaleBuffer(r.data,t.width,t.height,e)}static toGrayscaleBuffer(t,e,r,n=!1){const s=new Uint8ClampedArray(e*r);if(St.FRAME_INDEX=!St.FRAME_INDEX,St.FRAME_INDEX||!n)for(let e=0,r=0,n=t.length;e<n;e+=4,r++){let n;if(0===t[e+3])n=255;else{n=306*t[e]+601*t[e+1]+117*t[e+2]+512>>10}s[r]=n}else for(let e=0,r=0,n=t.length;e<n;e+=4,r++){let n;if(0===t[e+3])n=255;else{n=306*t[e]+601*t[e+1]+117*t[e+2]+512>>10}s[r]=255-n}return s}getRow(t,e){if(t<0||t>=this.getHeight())throw new d("Requested row is outside the image: "+t);const r=this.getWidth(),n=t*r;return null===e?e=this.buffer.slice(n,n+r):(e.length<r&&(e=new Uint8ClampedArray(r)),e.set(this.buffer.slice(n,n+r))),e}getMatrix(){return this.buffer}isCropSupported(){return!0}crop(t,e,r,n){return super.crop(t,e,r,n),this}isRotateSupported(){return!0}rotateCounterClockwise(){return this.rotate(-90),this}rotateCounterClockwise45(){return this.rotate(-45),this}getTempCanvasElement(){if(null===this.tempCanvasElement){const t=this.canvas.ownerDocument.createElement("canvas");t.width=this.canvas.width,t.height=this.canvas.height,this.tempCanvasElement=t}return this.tempCanvasElement}rotate(t){const e=this.getTempCanvasElement(),r=e.getContext("2d"),n=t*St.DEGREE_TO_RADIANS,s=this.canvas.width,i=this.canvas.height,o=Math.ceil(Math.abs(Math.cos(n))*s+Math.abs(Math.sin(n))*i),a=Math.ceil(Math.abs(Math.sin(n))*s+Math.abs(Math.cos(n))*i);return e.width=o,e.height=a,r.translate(o/2,a/2),r.rotate(n),r.drawImage(this.canvas,s/-2,i/-2),this.buffer=St.makeBufferFromCanvasImageData(e),this}invert(){return new mt(this)}hightContrast(t=128){return new It(this,t)}}St.DEGREE_TO_RADIANS=Math.PI/180,St.FRAME_INDEX=!0;class At{get hasNavigator(){return"undefined"!=typeof navigator}get isMediaDevicesSuported(){return this.hasNavigator&&!!navigator.mediaDevices}get canEnumerateDevices(){return!(!this.isMediaDevicesSuported||!navigator.mediaDevices.enumerateDevices)}get timeBetweenDecodingAttempts(){return this._timeBetweenDecodingAttempts}set timeBetweenDecodingAttempts(t){this._timeBetweenDecodingAttempts=t<0?0:t}set hints(t){this._hints=t||null}get hints(){return this._hints}constructor(t,e=500,r){this.reader=t,this.timeBetweenScansMillis=e,this._hints=r,this._timeBetweenDecodingAttempts=0}getMediaElement(t,e){const r=document.getElementById(t);if(!r)throw new k(`element with id '${t}' not found`);if(r.nodeName.toLowerCase()!==e.toLowerCase())throw new k(`element with id '${t}' must be an ${e} element`);return r}decodeFromImage(t,e){if(!t&&!e)throw new k("either imageElement with a src set or an url must be provided");return e&&!t?this.decodeFromImageUrl(e):this.decodeFromImageElement(t)}decodeFromImageElement(t){if(!t)throw new k("An image element must be provided.");this.reset();const e=this.prepareImageElement(t);let r;return this.imageElement=e,r=this.isImageLoaded(e)?this.decodeOnce(e,!1,!0):this._decodeOnLoadImage(e),r}decodeFromImageUrl(t){if(!t)throw new k("An URL must be provided.");this.reset();const e=this.prepareImageElement();this.imageElement=e;const r=this._decodeOnLoadImage(e);return e.src=t,r}_decodeOnLoadImage(t){return new Promise(((e,r)=>{this.imageLoadedListener=()=>this.decodeOnce(t,!1,!0).then(e,r),t.addEventListener("load",this.imageLoadedListener)}))}isImageLoaded(t){return!!t.complete&&0!==t.naturalWidth}prepareImageElement(t){let e;return void 0===t&&(e=document.createElement("img"),e.width=200,e.height=200),"string"==typeof t&&(e=this.getMediaElement(t,"img")),t instanceof HTMLImageElement&&(e=t),e}decodeOnce(t,e=!0,r=!0){const n=(s,i)=>{try{s(this.decode(t))}catch(t){if(e&&t instanceof w||(t instanceof T||t instanceof S)&&r)return setTimeout(n,this._timeBetweenDecodingAttempts,s,i);i(t)}};return new Promise(((t,e)=>n(t,e)))}decode(t){const e=this.createBinaryBitmap(t);return this.decodeBitmap(e)}createBinaryBitmap(t){this.getCaptureCanvasContext(t),this.drawImageOnCanvas(t);const e=this.getCaptureCanvas(t),r=new St(e),n=new ft(r);return new ut(n)}getCaptureCanvasContext(t){if(!this.captureCanvasContext){const e=this.getCaptureCanvas(t);let r;try{r=e.getContext("2d",{willReadFrequently:!0})}catch(t){r=e.getContext("2d")}this.captureCanvasContext=r}return this.captureCanvasContext}getCaptureCanvas(t){if(!this.captureCanvas){const e=this.createCaptureCanvas(t);this.captureCanvas=e}return this.captureCanvas}drawImageOnCanvas(t,e={sx:0,sy:0,sWidth:t.naturalWidth,sHeight:t.naturalHeight,dx:0,dy:0,dWidth:t.naturalWidth,dHeight:t.naturalHeight},r=this.captureCanvasContext){r.drawImage(t,e.sx,e.sy,e.sWidth,e.sHeight,e.dx,e.dy,e.dWidth,e.dHeight)}decodeBitmap(t){try{return this.reader.decode(t,this._hints)}finally{this.reader.reset()}}createCaptureCanvas(t){if("undefined"==typeof document)return this._destroyCaptureCanvas(),null;const e=document.createElement("canvas");let r,n;return void 0!==t&&t instanceof HTMLImageElement&&(r=t.naturalWidth||t.width,n=t.naturalHeight||t.height),e.style.width=r+"px",e.style.height=n+"px",e.width=r,e.height=n,e}reset(){this._destroyImageElement(),this._destroyCaptureCanvas()}_destroyImageElement(){this.imageElement&&(void 0!==this.imageLoadedListener&&this.imageElement.removeEventListener("load",this.imageLoadedListener),this.imageElement.src="",this.imageElement.removeAttribute("src"),this.imageElement=void 0)}_destroyCaptureCanvas(){this.captureCanvasContext=void 0,this.captureCanvas=void 0}}class Ct extends At{constructor(t=100){const e=new ct;super(e,t),this.inProgressDecodes=0,this.qrReader=e}safeReset(){if(0===this.inProgressDecodes)try{this.qrReader.reset()}catch(t){}}decodeBitmap(t){if(!t)throw new w("Bitmap cannot be null");this.inProgressDecodes++;try{return this.qrReader.decode(t,this._hints)}catch(t){throw t}finally{this.inProgressDecodes--,setTimeout((()=>this.safeReset()),0)}}async decodeFromImageUrl(t){this.inProgressDecodes++;try{const e=document.createElement("img");return e.src=t,new Promise(((t,r)=>{e.onload=()=>{try{const r=this.decode(e);t(r)}catch(t){r(t)}},e.onerror=()=>{r(new Error("Failed to load image"))}}))}finally{this.inProgressDecodes--}}reset(){0===this.inProgressDecodes?super.reset():setTimeout((()=>{0===this.inProgressDecodes&&super.reset()}),100)}}class Et extends t{constructor(t=!1){super(),this.debug=t,this.validatorName="ZXing Data URL Validator",this.validator=new Ct}async validate(t,e,r=!1){this.debug=this.debug||r;const n=[{name:"Normal SVG",execute:async()=>{if(!t)throw new Error("No svg source");const e="data:image/svg+xml;charset=utf-8,"+encodeURIComponent(t),r=await this.validator.decodeFromImageUrl(e);if(!r.getText())throw new Error("No text found in normal QR code");return{isValid:!0,data:r.getText(),message:"Decoded successfully."}}},{name:"Inverted SVG",execute:async()=>{const t=await e();if(!t)throw new Error("Failed to get inverted SVG");const r="data:image/svg+xml;charset=utf-8,"+encodeURIComponent(t),n=await this.validator.decodeFromImageUrl(r);if(!n.getText())throw new Error("No text found in inverted QR code");return{isValid:!0,isInverted:!0,data:n.getText(),message:"Decoded successfully (inverted)."}}}];for(const t of n)try{this.log(`Trying ${t.name} decode...`);return await t.execute()}catch(e){this.log(`${t.name} decode failed:`),this.log(e)}return{isValid:!1,message:"Failed to decode QR code after all attempts."}}}export{Et as default};
|