barcode-detector-api-polyfill 1.0.3 → 1.0.4
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/README.md +2 -2
- package/browser/barcode-detector-polyfill.min.js +1 -1
- package/browser/barcode-detector-polyfill.min.js.map +3 -3
- package/cjs/BarcodeDetector.d.ts +1 -1
- package/cjs/BarcodeDetector.js +13 -4
- package/cjs/BarcodeDetector.js.map +1 -1
- package/es2022/BarcodeDetector.d.ts +1 -1
- package/es2022/BarcodeDetector.js +13 -4
- package/es2022/BarcodeDetector.js.map +1 -1
- package/package.json +6 -5
package/README.md
CHANGED
|
@@ -77,8 +77,8 @@ Due to the presence of all ZXing decoders, the minified JS build of the polyfill
|
|
|
77
77
|
|
|
78
78
|
## How it's done?
|
|
79
79
|
|
|
80
|
-
This section here is for the curious ones who are interested in the development itself (and maybe want to contribute too). The polyfill is basically a class that implements the specified BarcodeDetector interface, and [the MDN documentation](https://developer.mozilla.org/en-US/docs/Web/API/BarcodeDetector) has been very helpful during the development. The class uses a ZXing multi-format reader internally and initializes it with a specific list of formats (if such are passed to the constructor). The class has the public static method `getSupportedFormats()` and the instance method `detect()`, both of can be used the same way as the native API.
|
|
80
|
+
This section here is for the curious ones who are interested in the development itself (and maybe want to contribute too). The polyfill is basically a class that implements the specified BarcodeDetector interface, and [the MDN documentation](https://developer.mozilla.org/en-US/docs/Web/API/BarcodeDetector) has been very helpful during the development. The class uses a ZXing multi-format reader internally and initializes it with a specific list of formats (if such are passed to the constructor). The class has the public static method `getSupportedFormats()` and the instance method `detect()`, both of which can be used the same way as the native API.
|
|
81
81
|
|
|
82
82
|
The implementation of the `detect()` method was a challenge because unlike the BarcodeDetector API, ZXing doesn't have this silver bullet detection method that accepts all kinds of image sources but rather has different methods that decode from different sources (canvas, video, image, stream, etc.). Because of this, the polyfill implementation conditionally calls different methods for one-time detection based on the type of the image source.
|
|
83
83
|
|
|
84
|
-
Another challenge was to align the differences between the barcode formats of ZXing and the BarcodeDetector API. The barcode formats in ZXing are presented as
|
|
84
|
+
Another challenge was to align the differences between the barcode formats of ZXing and the BarcodeDetector API. The barcode formats in ZXing are presented as a numeric `enum` while the BarcodeDetector API accepts (and returns) strings. To make the methods of the polyfill work as expected, two special map-like objects had to be created to make it possible to map barcode formats back and forth.
|
|
@@ -17,5 +17,5 @@
|
|
|
17
17
|
`),t.append(`>>
|
|
18
18
|
`),t.toString()},r.prototype.setMode=function(t){this.mode=t},r.prototype.setECLevel=function(t){this.ecLevel=t},r.prototype.setVersion=function(t){this.version=t},r.prototype.setMaskPattern=function(t){this.maskPattern=t},r.prototype.setMatrix=function(t){this.matrix=t},r.isValidMaskPattern=function(t){return t>=0&&t<r.NUM_MASK_PATTERNS},r.NUM_MASK_PATTERNS=8,r}(),Te=Es;var _s=function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)i.hasOwnProperty(o)&&(n[o]=i[o])},r(t,e)};return function(t,e){r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),Cs=function(r){_s(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return t.kind="WriterException",t}($),nt=Cs;var Is=function(){function r(){}return r.clearMatrix=function(t){t.clear(255)},r.buildMatrix=function(t,e,n,i,o){r.clearMatrix(o),r.embedBasicPatterns(n,o),r.embedTypeInfo(e,i,o),r.maybeEmbedVersionInfo(n,o),r.embedDataBits(t,i,o)},r.embedBasicPatterns=function(t,e){r.embedPositionDetectionPatternsAndSeparators(e),r.embedDarkDotAtLeftBottomCorner(e),r.maybeEmbedPositionAdjustmentPatterns(t,e),r.embedTimingPatterns(e)},r.embedTypeInfo=function(t,e,n){var i=new it;r.makeTypeInfoBits(t,e,i);for(var o=0,a=i.getSize();o<a;++o){var f=i.get(i.getSize()-1-o),s=r.TYPE_INFO_COORDINATES[o],u=s[0],c=s[1];if(n.setBoolean(u,c,f),o<8){var h=n.getWidth()-o-1,l=8;n.setBoolean(h,l,f)}else{var h=8,l=n.getHeight()-7+(o-8);n.setBoolean(h,l,f)}}},r.maybeEmbedVersionInfo=function(t,e){if(!(t.getVersionNumber()<7)){var n=new it;r.makeVersionInfoBits(t,n);for(var i=6*3-1,o=0;o<6;++o)for(var a=0;a<3;++a){var f=n.get(i);i--,e.setBoolean(o,e.getHeight()-11+a,f),e.setBoolean(e.getHeight()-11+a,o,f)}}},r.embedDataBits=function(t,e,n){for(var i=0,o=-1,a=n.getWidth()-1,f=n.getHeight()-1;a>0;){for(a===6&&(a-=1);f>=0&&f<n.getHeight();){for(var s=0;s<2;++s){var u=a-s;if(r.isEmpty(n.get(u,f))){var c=void 0;i<t.getSize()?(c=t.get(i),++i):c=!1,e!==255&&ue.getDataMaskBit(e,u,f)&&(c=!c),n.setBoolean(u,f,c)}}f+=o}o=-o,f+=o,a-=2}if(i!==t.getSize())throw new nt("Not all bits consumed: "+i+"/"+t.getSize())},r.findMSBSet=function(t){return 32-M.numberOfLeadingZeros(t)},r.calculateBCHCode=function(t,e){if(e===0)throw new O("0 polynomial");var n=r.findMSBSet(e);for(t<<=n-1;r.findMSBSet(t)>=n;)t^=e<<r.findMSBSet(t)-n;return t},r.makeTypeInfoBits=function(t,e,n){if(!Te.isValidMaskPattern(e))throw new nt("Invalid mask pattern");var i=t.getBits()<<3|e;n.appendBits(i,5);var o=r.calculateBCHCode(i,r.TYPE_INFO_POLY);n.appendBits(o,10);var a=new it;if(a.appendBits(r.TYPE_INFO_MASK_PATTERN,15),n.xor(a),n.getSize()!==15)throw new nt("should not happen but we got: "+n.getSize())},r.makeVersionInfoBits=function(t,e){e.appendBits(t.getVersionNumber(),6);var n=r.calculateBCHCode(t.getVersionNumber(),r.VERSION_INFO_POLY);if(e.appendBits(n,12),e.getSize()!==18)throw new nt("should not happen but we got: "+e.getSize())},r.isEmpty=function(t){return t===255},r.embedTimingPatterns=function(t){for(var e=8;e<t.getWidth()-8;++e){var n=(e+1)%2;r.isEmpty(t.get(e,6))&&t.setNumber(e,6,n),r.isEmpty(t.get(6,e))&&t.setNumber(6,e,n)}},r.embedDarkDotAtLeftBottomCorner=function(t){if(t.get(8,t.getHeight()-8)===0)throw new nt;t.setNumber(8,t.getHeight()-8,1)},r.embedHorizontalSeparationPattern=function(t,e,n){for(var i=0;i<8;++i){if(!r.isEmpty(n.get(t+i,e)))throw new nt;n.setNumber(t+i,e,0)}},r.embedVerticalSeparationPattern=function(t,e,n){for(var i=0;i<7;++i){if(!r.isEmpty(n.get(t,e+i)))throw new nt;n.setNumber(t,e+i,0)}},r.embedPositionAdjustmentPattern=function(t,e,n){for(var i=0;i<5;++i)for(var o=r.POSITION_ADJUSTMENT_PATTERN[i],a=0;a<5;++a)n.setNumber(t+a,e+i,o[a])},r.embedPositionDetectionPattern=function(t,e,n){for(var i=0;i<7;++i)for(var o=r.POSITION_DETECTION_PATTERN[i],a=0;a<7;++a)n.setNumber(t+a,e+i,o[a])},r.embedPositionDetectionPatternsAndSeparators=function(t){var e=r.POSITION_DETECTION_PATTERN[0].length;r.embedPositionDetectionPattern(0,0,t),r.embedPositionDetectionPattern(t.getWidth()-e,0,t),r.embedPositionDetectionPattern(0,t.getWidth()-e,t);var n=8;r.embedHorizontalSeparationPattern(0,n-1,t),r.embedHorizontalSeparationPattern(t.getWidth()-n,n-1,t),r.embedHorizontalSeparationPattern(0,t.getWidth()-n,t);var i=7;r.embedVerticalSeparationPattern(i,0,t),r.embedVerticalSeparationPattern(t.getHeight()-i-1,0,t),r.embedVerticalSeparationPattern(i,t.getHeight()-i,t)},r.maybeEmbedPositionAdjustmentPatterns=function(t,e){if(!(t.getVersionNumber()<2))for(var n=t.getVersionNumber()-1,i=r.POSITION_ADJUSTMENT_PATTERN_COORDINATE_TABLE[n],o=0,a=i.length;o!==a;o++){var f=i[o];if(f>=0)for(var s=0;s!==a;s++){var u=i[s];u>=0&&r.isEmpty(e.get(u,f))&&r.embedPositionAdjustmentPattern(u-2,f-2,e)}}},r.POSITION_DETECTION_PATTERN=Array.from([Int32Array.from([1,1,1,1,1,1,1]),Int32Array.from([1,0,0,0,0,0,1]),Int32Array.from([1,0,1,1,1,0,1]),Int32Array.from([1,0,1,1,1,0,1]),Int32Array.from([1,0,1,1,1,0,1]),Int32Array.from([1,0,0,0,0,0,1]),Int32Array.from([1,1,1,1,1,1,1])]),r.POSITION_ADJUSTMENT_PATTERN=Array.from([Int32Array.from([1,1,1,1,1]),Int32Array.from([1,0,0,0,1]),Int32Array.from([1,0,1,0,1]),Int32Array.from([1,0,0,0,1]),Int32Array.from([1,1,1,1,1])]),r.POSITION_ADJUSTMENT_PATTERN_COORDINATE_TABLE=Array.from([Int32Array.from([-1,-1,-1,-1,-1,-1,-1]),Int32Array.from([6,18,-1,-1,-1,-1,-1]),Int32Array.from([6,22,-1,-1,-1,-1,-1]),Int32Array.from([6,26,-1,-1,-1,-1,-1]),Int32Array.from([6,30,-1,-1,-1,-1,-1]),Int32Array.from([6,34,-1,-1,-1,-1,-1]),Int32Array.from([6,22,38,-1,-1,-1,-1]),Int32Array.from([6,24,42,-1,-1,-1,-1]),Int32Array.from([6,26,46,-1,-1,-1,-1]),Int32Array.from([6,28,50,-1,-1,-1,-1]),Int32Array.from([6,30,54,-1,-1,-1,-1]),Int32Array.from([6,32,58,-1,-1,-1,-1]),Int32Array.from([6,34,62,-1,-1,-1,-1]),Int32Array.from([6,26,46,66,-1,-1,-1]),Int32Array.from([6,26,48,70,-1,-1,-1]),Int32Array.from([6,26,50,74,-1,-1,-1]),Int32Array.from([6,30,54,78,-1,-1,-1]),Int32Array.from([6,30,56,82,-1,-1,-1]),Int32Array.from([6,30,58,86,-1,-1,-1]),Int32Array.from([6,34,62,90,-1,-1,-1]),Int32Array.from([6,28,50,72,94,-1,-1]),Int32Array.from([6,26,50,74,98,-1,-1]),Int32Array.from([6,30,54,78,102,-1,-1]),Int32Array.from([6,28,54,80,106,-1,-1]),Int32Array.from([6,32,58,84,110,-1,-1]),Int32Array.from([6,30,58,86,114,-1,-1]),Int32Array.from([6,34,62,90,118,-1,-1]),Int32Array.from([6,26,50,74,98,122,-1]),Int32Array.from([6,30,54,78,102,126,-1]),Int32Array.from([6,26,52,78,104,130,-1]),Int32Array.from([6,30,56,82,108,134,-1]),Int32Array.from([6,34,60,86,112,138,-1]),Int32Array.from([6,30,58,86,114,142,-1]),Int32Array.from([6,34,62,90,118,146,-1]),Int32Array.from([6,30,54,78,102,126,150]),Int32Array.from([6,24,50,76,102,128,154]),Int32Array.from([6,28,54,80,106,132,158]),Int32Array.from([6,32,58,84,110,136,162]),Int32Array.from([6,26,54,82,110,138,166]),Int32Array.from([6,30,58,86,114,142,170])]),r.TYPE_INFO_COORDINATES=Array.from([Int32Array.from([8,0]),Int32Array.from([8,1]),Int32Array.from([8,2]),Int32Array.from([8,3]),Int32Array.from([8,4]),Int32Array.from([8,5]),Int32Array.from([8,7]),Int32Array.from([8,8]),Int32Array.from([7,8]),Int32Array.from([5,8]),Int32Array.from([4,8]),Int32Array.from([3,8]),Int32Array.from([2,8]),Int32Array.from([1,8]),Int32Array.from([0,8])]),r.VERSION_INFO_POLY=7973,r.TYPE_INFO_POLY=1335,r.TYPE_INFO_MASK_PATTERN=21522,r}(),gr=Is;var Ss=function(){function r(t,e){this.dataBytes=t,this.errorCorrectionBytes=e}return r.prototype.getDataBytes=function(){return this.dataBytes},r.prototype.getErrorCorrectionBytes=function(){return this.errorCorrectionBytes},r}(),Ii=Ss;var Si=function(r){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&r[t],n=0;if(e)return e.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},Os=function(){function r(){}return r.calculateMaskPenalty=function(t){return ue.applyMaskPenaltyRule1(t)+ue.applyMaskPenaltyRule2(t)+ue.applyMaskPenaltyRule3(t)+ue.applyMaskPenaltyRule4(t)},r.encode=function(t,e,n){n===void 0&&(n=null);var i=r.DEFAULT_BYTE_MODE_ENCODING,o=n!==null&&n.get(H.CHARACTER_SET)!==void 0;o&&(i=n.get(H.CHARACTER_SET).toString());var a=this.chooseMode(t,i),f=new it;if(a===et.BYTE&&(o||r.DEFAULT_BYTE_MODE_ENCODING!==i)){var s=ot.getCharacterSetECIByName(i);s!==void 0&&this.appendECI(s,f)}this.appendModeInfo(a,f);var u=new it;this.appendBytes(t,a,u,i);var c;if(n!==null&&n.get(H.QR_VERSION)!==void 0){var h=Number.parseInt(n.get(H.QR_VERSION).toString(),10);c=Vt.getVersionForNumber(h);var l=this.calculateBitsNeeded(a,f,u,c);if(!this.willFit(l,c,e))throw new nt("Data too big for requested version")}else c=this.recommendVersion(e,a,f,u);var d=new it;d.appendBitArray(f);var p=a===et.BYTE?u.getSizeInBytes():t.length;this.appendLengthInfo(p,c,a,d),d.appendBitArray(u);var v=c.getECBlocksForLevel(e),g=c.getTotalCodewords()-v.getTotalECCodewords();this.terminateBits(g,d);var y=this.interleaveWithECBytes(d,c.getTotalCodewords(),g,v.getNumBlocks()),m=new Te;m.setECLevel(e),m.setMode(a),m.setVersion(c);var A=c.getDimensionForVersion(),_=new Qe(A,A),I=this.chooseMaskPattern(y,e,c,_);return m.setMaskPattern(I),gr.buildMatrix(y,e,c,I,_),m.setMatrix(_),m},r.recommendVersion=function(t,e,n,i){var o=this.calculateBitsNeeded(e,n,i,Vt.getVersionForNumber(1)),a=this.chooseVersion(o,t),f=this.calculateBitsNeeded(e,n,i,a);return this.chooseVersion(f,t)},r.calculateBitsNeeded=function(t,e,n,i){return e.getSize()+t.getCharacterCountBits(i)+n.getSize()},r.getAlphanumericCode=function(t){return t<r.ALPHANUMERIC_TABLE.length?r.ALPHANUMERIC_TABLE[t]:-1},r.chooseMode=function(t,e){if(e===void 0&&(e=null),ot.SJIS.getName()===e&&this.isOnlyDoubleByteKanji(t))return et.KANJI;for(var n=!1,i=!1,o=0,a=t.length;o<a;++o){var f=t.charAt(o);if(r.isDigit(f))n=!0;else if(this.getAlphanumericCode(f.charCodeAt(0))!==-1)i=!0;else return et.BYTE}return i?et.ALPHANUMERIC:n?et.NUMERIC:et.BYTE},r.isOnlyDoubleByteKanji=function(t){var e;try{e=yt.encode(t,ot.SJIS)}catch{return!1}var n=e.length;if(n%2!==0)return!1;for(var i=0;i<n;i+=2){var o=e[i]&255;if((o<129||o>159)&&(o<224||o>235))return!1}return!0},r.chooseMaskPattern=function(t,e,n,i){for(var o=Number.MAX_SAFE_INTEGER,a=-1,f=0;f<Te.NUM_MASK_PATTERNS;f++){gr.buildMatrix(t,e,n,f,i);var s=this.calculateMaskPenalty(i);s<o&&(o=s,a=f)}return a},r.chooseVersion=function(t,e){for(var n=1;n<=40;n++){var i=Vt.getVersionForNumber(n);if(r.willFit(t,i,e))return i}throw new nt("Data too big")},r.willFit=function(t,e,n){var i=e.getTotalCodewords(),o=e.getECBlocksForLevel(n),a=o.getTotalECCodewords(),f=i-a,s=(t+7)/8;return f>=s},r.terminateBits=function(t,e){var n=t*8;if(e.getSize()>n)throw new nt("data bits cannot fit in the QR Code"+e.getSize()+" > "+n);for(var i=0;i<4&&e.getSize()<n;++i)e.appendBit(!1);var o=e.getSize()&7;if(o>0)for(var i=o;i<8;i++)e.appendBit(!1);for(var a=t-e.getSizeInBytes(),i=0;i<a;++i)e.appendBits(i&1?17:236,8);if(e.getSize()!==n)throw new nt("Bits size does not equal capacity")},r.getNumDataBytesAndNumECBytesForBlockID=function(t,e,n,i,o,a){if(i>=n)throw new nt("Block ID too large");var f=t%n,s=n-f,u=Math.floor(t/n),c=u+1,h=Math.floor(e/n),l=h+1,d=u-h,p=c-l;if(d!==p)throw new nt("EC bytes mismatch");if(n!==s+f)throw new nt("RS blocks mismatch");if(t!==(h+d)*s+(l+p)*f)throw new nt("Total bytes mismatch");i<s?(o[0]=h,a[0]=d):(o[0]=l,a[0]=p)},r.interleaveWithECBytes=function(t,e,n,i){var o,a,f,s;if(t.getSizeInBytes()!==n)throw new nt("Number of bits and data bytes does not match");for(var u=0,c=0,h=0,l=new Array,d=0;d<i;++d){var p=new Int32Array(1),v=new Int32Array(1);r.getNumDataBytesAndNumECBytesForBlockID(e,n,i,d,p,v);var g=p[0],y=new Uint8Array(g);t.toBytes(8*u,y,0,g);var m=r.generateECBytes(y,v[0]);l.push(new Ii(y,m)),c=Math.max(c,g),h=Math.max(h,m.length),u+=p[0]}if(n!==u)throw new nt("Data bytes does not match offset");for(var A=new it,d=0;d<c;++d)try{for(var _=(o=void 0,Si(l)),I=_.next();!I.done;I=_.next()){var T=I.value,y=T.getDataBytes();d<y.length&&A.appendBits(y[d],8)}}catch(B){o={error:B}}finally{try{I&&!I.done&&(a=_.return)&&a.call(_)}finally{if(o)throw o.error}}for(var d=0;d<h;++d)try{for(var D=(f=void 0,Si(l)),b=D.next();!b.done;b=D.next()){var T=b.value,m=T.getErrorCorrectionBytes();d<m.length&&A.appendBits(m[d],8)}}catch(B){f={error:B}}finally{try{b&&!b.done&&(s=D.return)&&s.call(D)}finally{if(f)throw f.error}}if(e!==A.getSizeInBytes())throw new nt("Interleaving error: "+e+" and "+A.getSizeInBytes()+" differ.");return A},r.generateECBytes=function(t,e){for(var n=t.length,i=new Int32Array(n+e),o=0;o<n;o++)i[o]=t[o]&255;new Ke(dt.QR_CODE_FIELD_256).encode(i,e);for(var a=new Uint8Array(e),o=0;o<e;o++)a[o]=i[n+o];return a},r.appendModeInfo=function(t,e){e.appendBits(t.getBits(),4)},r.appendLengthInfo=function(t,e,n,i){var o=n.getCharacterCountBits(e);if(t>=1<<o)throw new nt(t+" is bigger than "+((1<<o)-1));i.appendBits(t,o)},r.appendBytes=function(t,e,n,i){switch(e){case et.NUMERIC:r.appendNumericBytes(t,n);break;case et.ALPHANUMERIC:r.appendAlphanumericBytes(t,n);break;case et.BYTE:r.append8BitBytes(t,n,i);break;case et.KANJI:r.appendKanjiBytes(t,n);break;default:throw new nt("Invalid mode: "+e)}},r.getDigit=function(t){return t.charCodeAt(0)-48},r.isDigit=function(t){var e=r.getDigit(t);return e>=0&&e<=9},r.appendNumericBytes=function(t,e){for(var n=t.length,i=0;i<n;){var o=r.getDigit(t.charAt(i));if(i+2<n){var a=r.getDigit(t.charAt(i+1)),f=r.getDigit(t.charAt(i+2));e.appendBits(o*100+a*10+f,10),i+=3}else if(i+1<n){var a=r.getDigit(t.charAt(i+1));e.appendBits(o*10+a,7),i+=2}else e.appendBits(o,4),i++}},r.appendAlphanumericBytes=function(t,e){for(var n=t.length,i=0;i<n;){var o=r.getAlphanumericCode(t.charCodeAt(i));if(o===-1)throw new nt;if(i+1<n){var a=r.getAlphanumericCode(t.charCodeAt(i+1));if(a===-1)throw new nt;e.appendBits(o*45+a,11),i+=2}else e.appendBits(o,6),i++}},r.append8BitBytes=function(t,e,n){var i;try{i=yt.encode(t,n)}catch(s){throw new nt(s)}for(var o=0,a=i.length;o!==a;o++){var f=i[o];e.appendBits(f,8)}},r.appendKanjiBytes=function(t,e){var n;try{n=yt.encode(t,ot.SJIS)}catch(h){throw new nt(h)}for(var i=n.length,o=0;o<i;o+=2){var a=n[o]&255,f=n[o+1]&255,s=a<<8&4294967295|f,u=-1;if(s>=33088&&s<=40956?u=s-33088:s>=57408&&s<=60351&&(u=s-49472),u===-1)throw new nt("Invalid byte sequence");var c=(u>>8)*192+(u&255);e.appendBits(c,13)}},r.appendECI=function(t,e){e.appendBits(et.ECI.getBits(),4),e.appendBits(t.getValue(),8)},r.ALPHANUMERIC_TABLE=Int32Array.from([-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,36,-1,-1,-1,37,38,-1,-1,-1,-1,39,40,-1,41,42,43,0,1,2,3,4,5,6,7,8,9,44,-1,-1,-1,-1,-1,-1,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,-1,-1,-1,-1,-1]),r.DEFAULT_BYTE_MODE_ENCODING=ot.UTF8.getName(),r}(),qt=Os;var o3=function(){function r(){}return r.prototype.write=function(t,e,n,i){if(i===void 0&&(i=null),t.length===0)throw new O("Found empty contents");if(e<0||n<0)throw new O("Requested dimensions are too small: "+e+"x"+n);var o=Nt.L,a=r.QUIET_ZONE_SIZE;i!==null&&(i.get(H.ERROR_CORRECTION)!==void 0&&(o=Nt.fromString(i.get(H.ERROR_CORRECTION).toString())),i.get(H.MARGIN)!==void 0&&(a=Number.parseInt(i.get(H.MARGIN).toString(),10)));var f=qt.encode(t,o,i);return this.renderResult(f,e,n,a)},r.prototype.writeToDom=function(t,e,n,i,o){o===void 0&&(o=null),typeof t=="string"&&(t=document.querySelector(t));var a=this.write(e,n,i,o);t&&t.appendChild(a)},r.prototype.renderResult=function(t,e,n,i){var o=t.getMatrix();if(o===null)throw new xt;for(var a=o.getWidth(),f=o.getHeight(),s=a+i*2,u=f+i*2,c=Math.max(e,s),h=Math.max(n,u),l=Math.min(Math.floor(c/s),Math.floor(h/u)),d=Math.floor((c-a*l)/2),p=Math.floor((h-f*l)/2),v=this.createSVGElement(c,h),g=0,y=p;g<f;g++,y+=l)for(var m=0,A=d;m<a;m++,A+=l)if(o.get(m,g)===1){var _=this.createSvgRectElement(A,y,l,l);v.appendChild(_)}return v},r.prototype.createSVGElement=function(t,e){var n=document.createElementNS(r.SVG_NS,"svg");return n.setAttributeNS(null,"height",t.toString()),n.setAttributeNS(null,"width",e.toString()),n},r.prototype.createSvgRectElement=function(t,e,n,i){var o=document.createElementNS(r.SVG_NS,"rect");return o.setAttributeNS(null,"x",t.toString()),o.setAttributeNS(null,"y",e.toString()),o.setAttributeNS(null,"height",n.toString()),o.setAttributeNS(null,"width",i.toString()),o.setAttributeNS(null,"fill","#000000"),o},r.QUIET_ZONE_SIZE=4,r.SVG_NS="http://www.w3.org/2000/svg",r}();var Ts=function(){function r(){}return r.prototype.encode=function(t,e,n,i,o){if(t.length===0)throw new O("Found empty contents");if(e!==C.QR_CODE)throw new O("Can only encode QR_CODE, but got "+e);if(n<0||i<0)throw new O("Requested dimensions are too small: "+n+"x"+i);var a=Nt.L,f=r.QUIET_ZONE_SIZE;o!==null&&(o.get(H.ERROR_CORRECTION)!==void 0&&(a=Nt.fromString(o.get(H.ERROR_CORRECTION).toString())),o.get(H.MARGIN)!==void 0&&(f=Number.parseInt(o.get(H.MARGIN).toString(),10)));var s=qt.encode(t,a,o);return r.renderResult(s,n,i,f)},r.renderResult=function(t,e,n,i){var o=t.getMatrix();if(o===null)throw new xt;for(var a=o.getWidth(),f=o.getHeight(),s=a+i*2,u=f+i*2,c=Math.max(e,s),h=Math.max(n,u),l=Math.min(Math.floor(c/s),Math.floor(h/u)),d=Math.floor((c-a*l)/2),p=Math.floor((h-f*l)/2),v=new at(c,h),g=0,y=p;g<f;g++,y+=l)for(var m=0,A=d;m<a;m++,A+=l)o.get(m,g)===1&&v.setRegion(A,y,l,l);return v},r.QUIET_ZONE_SIZE=4,r}(),fn=Ts;var N3=function(){function r(){}return r.prototype.encode=function(t,e,n,i,o){var a;switch(e){case C.QR_CODE:a=new fn;break;default:throw new O("No encoder available for format "+e)}return a.encode(t,e,n,i,o)},r}();var Ds=function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)i.hasOwnProperty(o)&&(n[o]=i[o])},r(t,e)};return function(t,e){r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),L3=function(r){Ds(t,r);function t(e,n,i,o,a,f,s,u){var c=r.call(this,f,s)||this;if(c.yuvData=e,c.dataWidth=n,c.dataHeight=i,c.left=o,c.top=a,o+f>n||a+s>i)throw new O("Crop rectangle does not fit within image data.");return u&&c.reverseHorizontal(f,s),c}return t.prototype.getRow=function(e,n){if(e<0||e>=this.getHeight())throw new O("Requested row is outside the image: "+e);var i=this.getWidth();(n==null||n.length<i)&&(n=new Uint8ClampedArray(i));var o=(e+this.top)*this.dataWidth+this.left;return V.arraycopy(this.yuvData,o,n,0,i),n},t.prototype.getMatrix=function(){var e=this.getWidth(),n=this.getHeight();if(e===this.dataWidth&&n===this.dataHeight)return this.yuvData;var i=e*n,o=new Uint8ClampedArray(i),a=this.top*this.dataWidth+this.left;if(e===this.dataWidth)return V.arraycopy(this.yuvData,a,o,0,i),o;for(var f=0;f<n;f++){var s=f*e;V.arraycopy(this.yuvData,a,o,s,e),a+=this.dataWidth}return o},t.prototype.isCropSupported=function(){return!0},t.prototype.crop=function(e,n,i,o){return new t(this.yuvData,this.dataWidth,this.dataHeight,this.left+e,this.top+n,i,o,!1)},t.prototype.renderThumbnail=function(){for(var e=this.getWidth()/t.THUMBNAIL_SCALE_FACTOR,n=this.getHeight()/t.THUMBNAIL_SCALE_FACTOR,i=new Int32Array(e*n),o=this.yuvData,a=this.top*this.dataWidth+this.left,f=0;f<n;f++){for(var s=f*e,u=0;u<e;u++){var c=o[a+u*t.THUMBNAIL_SCALE_FACTOR]&255;i[s+u]=4278190080|c*65793}a+=this.dataWidth*t.THUMBNAIL_SCALE_FACTOR}return i},t.prototype.getThumbnailWidth=function(){return this.getWidth()/t.THUMBNAIL_SCALE_FACTOR},t.prototype.getThumbnailHeight=function(){return this.getHeight()/t.THUMBNAIL_SCALE_FACTOR},t.prototype.reverseHorizontal=function(e,n){for(var i=this.yuvData,o=0,a=this.top*this.dataWidth+this.left;o<n;o++,a+=this.dataWidth)for(var f=a+e/2,s=a,u=a+e-1;s<f;s++,u--){var c=i[s];i[s]=i[u],i[u]=c}},t.prototype.invert=function(){return new zt(this)},t.THUMBNAIL_SCALE_FACTOR=2,t}(Ht);var Rs=function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)i.hasOwnProperty(o)&&(n[o]=i[o])},r(t,e)};return function(t,e){r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),X3=function(r){Rs(t,r);function t(e,n,i,o,a,f,s){var u=r.call(this,n,i)||this;if(u.dataWidth=o,u.dataHeight=a,u.left=f,u.top=s,e.BYTES_PER_ELEMENT===4){for(var c=n*i,h=new Uint8ClampedArray(c),l=0;l<c;l++){var d=e[l],p=d>>16&255,v=d>>7&510,g=d&255;h[l]=(p+v+g)/4&255}u.luminances=h}else u.luminances=e;if(o===void 0&&(u.dataWidth=n),a===void 0&&(u.dataHeight=i),f===void 0&&(u.left=0),s===void 0&&(u.top=0),u.left+n>u.dataWidth||u.top+i>u.dataHeight)throw new O("Crop rectangle does not fit within image data.");return u}return t.prototype.getRow=function(e,n){if(e<0||e>=this.getHeight())throw new O("Requested row is outside the image: "+e);var i=this.getWidth();(n==null||n.length<i)&&(n=new Uint8ClampedArray(i));var o=(e+this.top)*this.dataWidth+this.left;return V.arraycopy(this.luminances,o,n,0,i),n},t.prototype.getMatrix=function(){var e=this.getWidth(),n=this.getHeight();if(e===this.dataWidth&&n===this.dataHeight)return this.luminances;var i=e*n,o=new Uint8ClampedArray(i),a=this.top*this.dataWidth+this.left;if(e===this.dataWidth)return V.arraycopy(this.luminances,a,o,0,i),o;for(var f=0;f<n;f++){var s=f*e;V.arraycopy(this.luminances,a,o,s,e),a+=this.dataWidth}return o},t.prototype.isCropSupported=function(){return!0},t.prototype.crop=function(e,n,i,o){return new t(this.luminances,i,o,this.dataWidth,this.dataHeight,this.left+e,this.top+n)},t.prototype.invert=function(){return new zt(this)},t}(Ht);var Ns=function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)i.hasOwnProperty(o)&&(n[o]=i[o])},r(t,e)};return function(t,e){r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),bs=function(r){Ns(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return t.forName=function(e){return this.getCharacterSetECIByName(e)},t}(ot),ge=bs;var Ps=function(){function r(){}return r.ISO_8859_1=ot.ISO8859_1,r}(),qe=Ps;var Ms=function(){function r(t,e,n){this.codewords=t,this.numcols=e,this.numrows=n,this.bits=new Uint8Array(e*n),Y.fill(this.bits,2)}return r.prototype.getNumrows=function(){return this.numrows},r.prototype.getNumcols=function(){return this.numcols},r.prototype.getBits=function(){return this.bits},r.prototype.getBit=function(t,e){return this.bits[e*this.numcols+t]===1},r.prototype.setBit=function(t,e,n){this.bits[e*this.numcols+t]=n?1:0},r.prototype.noBit=function(t,e){return this.bits[e*this.numcols+t]===2},r.prototype.place=function(){var t=0,e=4,n=0;do{e===this.numrows&&n===0&&this.corner1(t++),e===this.numrows-2&&n===0&&this.numcols%4!==0&&this.corner2(t++),e===this.numrows-2&&n===0&&this.numcols%8===4&&this.corner3(t++),e===this.numrows+4&&n===2&&this.numcols%8===0&&this.corner4(t++);do e<this.numrows&&n>=0&&this.noBit(n,e)&&this.utah(e,n,t++),e-=2,n+=2;while(e>=0&&n<this.numcols);e++,n+=3;do e>=0&&n<this.numcols&&this.noBit(n,e)&&this.utah(e,n,t++),e+=2,n-=2;while(e<this.numrows&&n>=0);e+=3,n++}while(e<this.numrows||n<this.numcols);this.noBit(this.numcols-1,this.numrows-1)&&(this.setBit(this.numcols-1,this.numrows-1,!0),this.setBit(this.numcols-2,this.numrows-2,!0))},r.prototype.module=function(t,e,n,i){t<0&&(t+=this.numrows,e+=4-(this.numrows+4)%8),e<0&&(e+=this.numcols,t+=4-(this.numcols+4)%8);var o=this.codewords.charCodeAt(n);o&=1<<8-i,this.setBit(e,t,o!==0)},r.prototype.utah=function(t,e,n){this.module(t-2,e-2,n,1),this.module(t-2,e-1,n,2),this.module(t-1,e-2,n,3),this.module(t-1,e-1,n,4),this.module(t-1,e,n,5),this.module(t,e-2,n,6),this.module(t,e-1,n,7),this.module(t,e,n,8)},r.prototype.corner1=function(t){this.module(this.numrows-1,0,t,1),this.module(this.numrows-1,1,t,2),this.module(this.numrows-1,2,t,3),this.module(0,this.numcols-2,t,4),this.module(0,this.numcols-1,t,5),this.module(1,this.numcols-1,t,6),this.module(2,this.numcols-1,t,7),this.module(3,this.numcols-1,t,8)},r.prototype.corner2=function(t){this.module(this.numrows-3,0,t,1),this.module(this.numrows-2,0,t,2),this.module(this.numrows-1,0,t,3),this.module(0,this.numcols-4,t,4),this.module(0,this.numcols-3,t,5),this.module(0,this.numcols-2,t,6),this.module(0,this.numcols-1,t,7),this.module(1,this.numcols-1,t,8)},r.prototype.corner3=function(t){this.module(this.numrows-3,0,t,1),this.module(this.numrows-2,0,t,2),this.module(this.numrows-1,0,t,3),this.module(0,this.numcols-2,t,4),this.module(0,this.numcols-1,t,5),this.module(1,this.numcols-1,t,6),this.module(2,this.numcols-1,t,7),this.module(3,this.numcols-1,t,8)},r.prototype.corner4=function(t){this.module(this.numrows-1,0,t,1),this.module(this.numrows-1,this.numcols-1,t,2),this.module(0,this.numcols-3,t,3),this.module(0,this.numcols-2,t,4),this.module(0,this.numcols-1,t,5),this.module(1,this.numcols-3,t,6),this.module(1,this.numcols-2,t,7),this.module(1,this.numcols-1,t,8)},r}(),mr=Ms;var sn,cn=[5,7,10,11,12,14,18,20,24,28,36,42,48,56,62,68],Oi=[[228,48,15,111,62],[23,68,144,134,240,92,254],[28,24,185,166,223,248,116,255,110,61],[175,138,205,12,194,168,39,245,60,97,120],[41,153,158,91,61,42,142,213,97,178,100,242],[156,97,192,252,95,9,157,119,138,45,18,186,83,185],[83,195,100,39,188,75,66,61,241,213,109,129,94,254,225,48,90,188],[15,195,244,9,233,71,168,2,188,160,153,145,253,79,108,82,27,174,186,172],[52,190,88,205,109,39,176,21,155,197,251,223,155,21,5,172,254,124,12,181,184,96,50,193],[211,231,43,97,71,96,103,174,37,151,170,53,75,34,249,121,17,138,110,213,141,136,120,151,233,168,93,255],[245,127,242,218,130,250,162,181,102,120,84,179,220,251,80,182,229,18,2,4,68,33,101,137,95,119,115,44,175,184,59,25,225,98,81,112],[77,193,137,31,19,38,22,153,247,105,122,2,245,133,242,8,175,95,100,9,167,105,214,111,57,121,21,1,253,57,54,101,248,202,69,50,150,177,226,5,9,5],[245,132,172,223,96,32,117,22,238,133,238,231,205,188,237,87,191,106,16,147,118,23,37,90,170,205,131,88,120,100,66,138,186,240,82,44,176,87,187,147,160,175,69,213,92,253,225,19],[175,9,223,238,12,17,220,208,100,29,175,170,230,192,215,235,150,159,36,223,38,200,132,54,228,146,218,234,117,203,29,232,144,238,22,150,201,117,62,207,164,13,137,245,127,67,247,28,155,43,203,107,233,53,143,46],[242,93,169,50,144,210,39,118,202,188,201,189,143,108,196,37,185,112,134,230,245,63,197,190,250,106,185,221,175,64,114,71,161,44,147,6,27,218,51,63,87,10,40,130,188,17,163,31,176,170,4,107,232,7,94,166,224,124,86,47,11,204],[220,228,173,89,251,149,159,56,89,33,147,244,154,36,73,127,213,136,248,180,234,197,158,177,68,122,93,213,15,160,227,236,66,139,153,185,202,167,179,25,220,232,96,210,231,136,223,239,181,241,59,52,172,25,49,232,211,189,64,54,108,153,132,63,96,103,82,186]],Bs=301,Fs=function(r,t){for(var e=1,n=0;n<255;n++)t[n]=e,r[e]=n,e*=2,e>=256&&(e^=Bs);return{LOG:r,ALOG:t}},Je=(sn=Fs([],[]),sn.LOG),hn=sn.ALOG,un;(function(r){r[r.FORCE_NONE=0]="FORCE_NONE",r[r.FORCE_SQUARE=1]="FORCE_SQUARE",r[r.FORCE_RECTANGLE=2]="FORCE_RECTANGLE"})(un||(un={}));var ln=129,yr=230,Ti=231,Di=235,Ri=236,Ni=237,bi=238,Pi=239,Mi=240,Ar=254,Bi=254,De="[)>05",Re="[)>06",Ne="",X=0,mt=1,_t=2,pt=3,gt=4,wt=5;var Ls=function(){function r(){}return r.encodeECC200=function(t,e){if(t.length!==e.getDataCapacity())throw new Error("The number of codewords does not match the selected symbol");var n=new P;n.append(t);var i=e.getInterleavedBlockCount();if(i===1){var o=this.createECCBlock(t,e.getErrorCodewords());n.append(o)}else{for(var a=[],f=[],s=0;s<i;s++)a[s]=e.getDataLengthForInterleavedBlock(s+1),f[s]=e.getErrorLengthForInterleavedBlock(s+1);for(var u=0;u<i;u++){for(var c=new P,h=u;h<e.getDataCapacity();h+=i)c.append(t.charAt(h));for(var o=this.createECCBlock(c.toString(),f[u]),l=0,d=u;d<f[u]*i;d+=i)n.setCharAt(e.getDataCapacity()+d,o.charAt(l++))}}return n.toString()},r.createECCBlock=function(t,e){for(var n=-1,i=0;i<cn.length;i++)if(cn[i]===e){n=i;break}if(n<0)throw new Error("Illegal number of error correction codewords specified: "+e);for(var o=Oi[n],a=[],i=0;i<e;i++)a[i]=0;for(var i=0;i<t.length;i++){for(var f=a[e-1]^t.charAt(i).charCodeAt(0),s=e-1;s>0;s--)f!==0&&o[s]!==0?a[s]=a[s-1]^hn[(Je[f]+Je[o[s]])%255]:a[s]=a[s-1];f!==0&&o[0]!==0?a[0]=hn[(Je[f]+Je[o[0]])%255]:a[0]=0}for(var u=[],i=0;i<e;i++)u[i]=a[e-i-1];return u.map(function(c){return String.fromCharCode(c)}).join("")},r}(),wr=Ls;var dn=function(){function r(){}return r.prototype.getEncodingMode=function(){return X},r.prototype.encode=function(t){var e=k.determineConsecutiveDigitCount(t.getMessage(),t.pos);if(e>=2)t.writeCodeword(this.encodeASCIIDigits(t.getMessage().charCodeAt(t.pos),t.getMessage().charCodeAt(t.pos+1))),t.pos+=2;else{var n=t.getCurrentChar(),i=k.lookAheadTest(t.getMessage(),t.pos,this.getEncodingMode());if(i!==this.getEncodingMode())switch(i){case wt:t.writeCodeword(Ti),t.signalEncoderChange(wt);return;case mt:t.writeCodeword(yr),t.signalEncoderChange(mt);return;case pt:t.writeCodeword(bi),t.signalEncoderChange(pt);break;case _t:t.writeCodeword(Pi),t.signalEncoderChange(_t);break;case gt:t.writeCodeword(Mi),t.signalEncoderChange(gt);break;default:throw new Error("Illegal mode: "+i)}else k.isExtendedASCII(n)?(t.writeCodeword(Di),t.writeCodeword(n-128+1),t.pos++):(t.writeCodeword(n+1),t.pos++)}},r.prototype.encodeASCIIDigits=function(t,e){if(k.isDigit(t)&&k.isDigit(e)){var n=(t-48)*10+(e-48);return n+130}throw new Error("not digits: "+t+e)},r}();var pn=function(){function r(){}return r.prototype.getEncodingMode=function(){return wt},r.prototype.encode=function(t){var e=new P;for(e.append(0);t.hasMoreCharacters();){var n=t.getCurrentChar();e.append(n),t.pos++;var i=k.lookAheadTest(t.getMessage(),t.pos,this.getEncodingMode());if(i!==this.getEncodingMode()){t.signalEncoderChange(X);break}}var o=e.length()-1,a=1,f=t.getCodewordCount()+o+a;t.updateSymbolInfo(f);var s=t.getSymbolInfo().getDataCapacity()-f>0;if(t.hasMoreCharacters()||s)if(o<=249)e.setCharAt(0,F.getCharAt(o));else if(o<=1555)e.setCharAt(0,F.getCharAt(Math.floor(o/250)+249)),e.insert(1,F.getCharAt(o%250));else throw new Error("Message length not in valid ranges: "+o);for(var u=0,n=e.length();u<n;u++)t.writeCodeword(this.randomize255State(e.charAt(u).charCodeAt(0),t.getCodewordCount()+1))},r.prototype.randomize255State=function(t,e){var n=149*e%255+1,i=t+n;return i<=255?i:i-256},r}();var me=function(){function r(){}return r.prototype.getEncodingMode=function(){return mt},r.prototype.encodeMaximal=function(t){for(var e=new P,n=0,i=t.pos,o=0;t.hasMoreCharacters();){var a=t.getCurrentChar();t.pos++,n=this.encodeChar(a,e),e.length()%3===0&&(i=t.pos,o=e.length())}if(o!==e.length()){var f=Math.floor(e.length()/3*2),s=Math.floor(t.getCodewordCount()+f+1);t.updateSymbolInfo(s);var u=t.getSymbolInfo().getDataCapacity()-s,c=Math.floor(e.length()%3);(c===2&&u!==2||c===1&&(n>3||u!==1))&&(t.pos=i)}e.length()>0&&t.writeCodeword(yr),this.handleEOD(t,e)},r.prototype.encode=function(t){for(var e=new P;t.hasMoreCharacters();){var n=t.getCurrentChar();t.pos++;var i=this.encodeChar(n,e),o=Math.floor(e.length()/3)*2,a=t.getCodewordCount()+o;t.updateSymbolInfo(a);var f=t.getSymbolInfo().getDataCapacity()-a;if(!t.hasMoreCharacters()){var s=new P;for(e.length()%3===2&&f!==2&&(i=this.backtrackOneCharacter(t,e,s,i));e.length()%3===1&&(i>3||f!==1);)i=this.backtrackOneCharacter(t,e,s,i);break}var u=e.length();if(u%3===0){var c=k.lookAheadTest(t.getMessage(),t.pos,this.getEncodingMode());if(c!==this.getEncodingMode()){t.signalEncoderChange(X);break}}}this.handleEOD(t,e)},r.prototype.backtrackOneCharacter=function(t,e,n,i){var o=e.length(),a=e.toString().substring(0,o-i);e.setLengthToZero(),e.append(a),t.pos--;var f=t.getCurrentChar();return i=this.encodeChar(f,n),t.resetSymbolInfo(),i},r.prototype.writeNextTriplet=function(t,e){t.writeCodewords(this.encodeToCodewords(e.toString()));var n=e.toString().substring(3);e.setLengthToZero(),e.append(n)},r.prototype.handleEOD=function(t,e){var n=Math.floor(e.length()/3*2),i=e.length()%3,o=t.getCodewordCount()+n;t.updateSymbolInfo(o);var a=t.getSymbolInfo().getDataCapacity()-o;if(i===2){for(e.append("\0");e.length()>=3;)this.writeNextTriplet(t,e);t.hasMoreCharacters()&&t.writeCodeword(Ar)}else if(a===1&&i===1){for(;e.length()>=3;)this.writeNextTriplet(t,e);t.hasMoreCharacters()&&t.writeCodeword(Ar),t.pos--}else if(i===0){for(;e.length()>=3;)this.writeNextTriplet(t,e);(a>0||t.hasMoreCharacters())&&t.writeCodeword(Ar)}else throw new Error("Unexpected case. Please report!");t.signalEncoderChange(X)},r.prototype.encodeChar=function(t,e){if(t===" ".charCodeAt(0))return e.append(3),1;if(t>="0".charCodeAt(0)&&t<="9".charCodeAt(0))return e.append(t-48+4),1;if(t>="A".charCodeAt(0)&&t<="Z".charCodeAt(0))return e.append(t-65+14),1;if(t<" ".charCodeAt(0))return e.append(0),e.append(t),2;if(t<="/".charCodeAt(0))return e.append(1),e.append(t-33),2;if(t<="@".charCodeAt(0))return e.append(1),e.append(t-58+15),2;if(t<="_".charCodeAt(0))return e.append(1),e.append(t-91+22),2;if(t<=127)return e.append(2),e.append(t-96),2;e.append("1");var n=2;return n+=this.encodeChar(t-128,e),n},r.prototype.encodeToCodewords=function(t){var e=1600*t.charCodeAt(0)+40*t.charCodeAt(1)+t.charCodeAt(2)+1,n=e/256,i=e%256,o=new P;return o.append(n),o.append(i),o.toString()},r}();var vn=function(){function r(){}return r.prototype.getEncodingMode=function(){return gt},r.prototype.encode=function(t){for(var e=new P;t.hasMoreCharacters();){var n=t.getCurrentChar();this.encodeChar(n,e),t.pos++;var i=e.length();if(i>=4){t.writeCodewords(this.encodeToCodewords(e.toString()));var o=e.toString().substring(4);e.setLengthToZero(),e.append(o);var a=k.lookAheadTest(t.getMessage(),t.pos,this.getEncodingMode());if(a!==this.getEncodingMode()){t.signalEncoderChange(X);break}}}e.append(F.getCharAt(31)),this.handleEOD(t,e)},r.prototype.handleEOD=function(t,e){try{var n=e.length();if(n===0)return;if(n===1){t.updateSymbolInfo();var i=t.getSymbolInfo().getDataCapacity()-t.getCodewordCount(),o=t.getRemainingCharacters();if(o>i&&(t.updateSymbolInfo(t.getCodewordCount()+1),i=t.getSymbolInfo().getDataCapacity()-t.getCodewordCount()),o<=i&&i<=2)return}if(n>4)throw new Error("Count must not exceed 4");var a=n-1,f=this.encodeToCodewords(e.toString()),s=!t.hasMoreCharacters(),u=s&&a<=2;if(a<=2){t.updateSymbolInfo(t.getCodewordCount()+a);var i=t.getSymbolInfo().getDataCapacity()-t.getCodewordCount();i>=3&&(u=!1,t.updateSymbolInfo(t.getCodewordCount()+f.length))}u?(t.resetSymbolInfo(),t.pos-=a):t.writeCodewords(f)}finally{t.signalEncoderChange(X)}},r.prototype.encodeChar=function(t,e){t>=" ".charCodeAt(0)&&t<="?".charCodeAt(0)?e.append(t):t>="@".charCodeAt(0)&&t<="^".charCodeAt(0)?e.append(F.getCharAt(t-64)):k.illegalCharacter(F.getCharAt(t))},r.prototype.encodeToCodewords=function(t){var e=t.length;if(e===0)throw new Error("StringBuilder must not be empty");var n=t.charAt(0).charCodeAt(0),i=e>=2?t.charAt(1).charCodeAt(0):0,o=e>=3?t.charAt(2).charCodeAt(0):0,a=e>=4?t.charAt(3).charCodeAt(0):0,f=(n<<18)+(i<<12)+(o<<6)+a,s=f>>16&255,u=f>>8&255,c=f&255,h=new P;return h.append(s),e>=2&&h.append(u),e>=3&&h.append(c),h.toString()},r}();var ks=function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)i.hasOwnProperty(o)&&(n[o]=i[o])},r(t,e)};return function(t,e){r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),Us=function(r){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&r[t],n=0;if(e)return e.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},Q=function(){function r(t,e,n,i,o,a,f,s){f===void 0&&(f=0),s===void 0&&(s=0),this.rectangular=t,this.dataCapacity=e,this.errorCodewords=n,this.matrixWidth=i,this.matrixHeight=o,this.dataRegions=a,this.rsBlockData=f,this.rsBlockError=s}return r.lookup=function(t,e,n,i,o){var a,f;e===void 0&&(e=0),n===void 0&&(n=null),i===void 0&&(i=null),o===void 0&&(o=!0);try{for(var s=Us(Vs),u=s.next();!u.done;u=s.next()){var c=u.value;if(!(e===1&&c.rectangular)&&!(e===2&&!c.rectangular)&&!(n!=null&&(c.getSymbolWidth()<n.getWidth()||c.getSymbolHeight()<n.getHeight()))&&!(i!=null&&(c.getSymbolWidth()>i.getWidth()||c.getSymbolHeight()>i.getHeight()))&&t<=c.dataCapacity)return c}}catch(h){a={error:h}}finally{try{u&&!u.done&&(f=s.return)&&f.call(s)}finally{if(a)throw a.error}}if(o)throw new Error("Can't find a symbol arrangement that matches the message. Data codewords: "+t);return null},r.prototype.getHorizontalDataRegions=function(){switch(this.dataRegions){case 1:return 1;case 2:case 4:return 2;case 16:return 4;case 36:return 6;default:throw new Error("Cannot handle this number of data regions")}},r.prototype.getVerticalDataRegions=function(){switch(this.dataRegions){case 1:case 2:return 1;case 4:return 2;case 16:return 4;case 36:return 6;default:throw new Error("Cannot handle this number of data regions")}},r.prototype.getSymbolDataWidth=function(){return this.getHorizontalDataRegions()*this.matrixWidth},r.prototype.getSymbolDataHeight=function(){return this.getVerticalDataRegions()*this.matrixHeight},r.prototype.getSymbolWidth=function(){return this.getSymbolDataWidth()+this.getHorizontalDataRegions()*2},r.prototype.getSymbolHeight=function(){return this.getSymbolDataHeight()+this.getVerticalDataRegions()*2},r.prototype.getCodewordCount=function(){return this.dataCapacity+this.errorCodewords},r.prototype.getInterleavedBlockCount=function(){return this.rsBlockData?this.dataCapacity/this.rsBlockData:1},r.prototype.getDataCapacity=function(){return this.dataCapacity},r.prototype.getErrorCodewords=function(){return this.errorCodewords},r.prototype.getDataLengthForInterleavedBlock=function(t){return this.rsBlockData},r.prototype.getErrorLengthForInterleavedBlock=function(t){return this.rsBlockError},r}(),be=Q,Hs=function(r){ks(t,r);function t(){return r.call(this,!1,1558,620,22,22,36,-1,62)||this}return t.prototype.getInterleavedBlockCount=function(){return 10},t.prototype.getDataLengthForInterleavedBlock=function(e){return e<=8?156:155},t}(Q),Vs=[new Q(!1,3,5,8,8,1),new Q(!1,5,7,10,10,1),new Q(!0,5,7,16,6,1),new Q(!1,8,10,12,12,1),new Q(!0,10,11,14,6,2),new Q(!1,12,12,14,14,1),new Q(!0,16,14,24,10,1),new Q(!1,18,14,16,16,1),new Q(!1,22,18,18,18,1),new Q(!0,22,18,16,10,2),new Q(!1,30,20,20,20,1),new Q(!0,32,24,16,14,2),new Q(!1,36,24,22,22,1),new Q(!1,44,28,24,24,1),new Q(!0,49,28,22,14,2),new Q(!1,62,36,14,14,4),new Q(!1,86,42,16,16,4),new Q(!1,114,48,18,18,4),new Q(!1,144,56,20,20,4),new Q(!1,174,68,22,22,4),new Q(!1,204,84,24,24,4,102,42),new Q(!1,280,112,14,14,16,140,56),new Q(!1,368,144,16,16,16,92,36),new Q(!1,456,192,18,18,16,114,48),new Q(!1,576,224,20,20,16,144,56),new Q(!1,696,272,22,22,16,174,68),new Q(!1,816,336,24,24,16,136,56),new Q(!1,1050,408,18,18,36,175,68),new Q(!1,1304,496,20,20,36,163,62),new Hs];var xn=function(){function r(t){this.msg=t,this.pos=0,this.skipAtEnd=0;for(var e=t.split("").map(function(f){return f.charCodeAt(0)}),n=new P,i=0,o=e.length;i<o;i++){var a=String.fromCharCode(e[i]&255);if(a==="?"&&t.charAt(i)!=="?")throw new Error("Message contains characters outside ISO-8859-1 encoding.");n.append(a)}this.msg=n.toString(),this.shape=0,this.codewords=new P,this.newEncoding=-1}return r.prototype.setSymbolShape=function(t){this.shape=t},r.prototype.setSizeConstraints=function(t,e){this.minSize=t,this.maxSize=e},r.prototype.getMessage=function(){return this.msg},r.prototype.setSkipAtEnd=function(t){this.skipAtEnd=t},r.prototype.getCurrentChar=function(){return this.msg.charCodeAt(this.pos)},r.prototype.getCurrent=function(){return this.msg.charCodeAt(this.pos)},r.prototype.getCodewords=function(){return this.codewords},r.prototype.writeCodewords=function(t){this.codewords.append(t)},r.prototype.writeCodeword=function(t){this.codewords.append(t)},r.prototype.getCodewordCount=function(){return this.codewords.length()},r.prototype.getNewEncoding=function(){return this.newEncoding},r.prototype.signalEncoderChange=function(t){this.newEncoding=t},r.prototype.resetEncoderSignal=function(){this.newEncoding=-1},r.prototype.hasMoreCharacters=function(){return this.pos<this.getTotalMessageCharCount()},r.prototype.getTotalMessageCharCount=function(){return this.msg.length-this.skipAtEnd},r.prototype.getRemainingCharacters=function(){return this.getTotalMessageCharCount()-this.pos},r.prototype.getSymbolInfo=function(){return this.symbolInfo},r.prototype.updateSymbolInfo=function(t){t===void 0&&(t=this.getCodewordCount()),(this.symbolInfo==null||t>this.symbolInfo.getDataCapacity())&&(this.symbolInfo=be.lookup(t,this.shape,this.minSize,this.maxSize,!0))},r.prototype.resetSymbolInfo=function(){this.symbolInfo=null},r}();var Gs=function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)i.hasOwnProperty(o)&&(n[o]=i[o])},r(t,e)};return function(t,e){r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),gn=function(r){Gs(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return t.prototype.getEncodingMode=function(){return pt},t.prototype.encode=function(e){for(var n=new P;e.hasMoreCharacters();){var i=e.getCurrentChar();e.pos++,this.encodeChar(i,n);var o=n.length();if(o%3===0){this.writeNextTriplet(e,n);var a=k.lookAheadTest(e.getMessage(),e.pos,this.getEncodingMode());if(a!==this.getEncodingMode()){e.signalEncoderChange(X);break}}}this.handleEOD(e,n)},t.prototype.encodeChar=function(e,n){switch(e){case 13:n.append(0);break;case"*".charCodeAt(0):n.append(1);break;case">".charCodeAt(0):n.append(2);break;case" ".charCodeAt(0):n.append(3);break;default:e>="0".charCodeAt(0)&&e<="9".charCodeAt(0)?n.append(e-48+4):e>="A".charCodeAt(0)&&e<="Z".charCodeAt(0)?n.append(e-65+14):k.illegalCharacter(F.getCharAt(e));break}return 1},t.prototype.handleEOD=function(e,n){e.updateSymbolInfo();var i=e.getSymbolInfo().getDataCapacity()-e.getCodewordCount(),o=n.length();e.pos-=o,(e.getRemainingCharacters()>1||i>1||e.getRemainingCharacters()!==i)&&e.writeCodeword(Bi),e.getNewEncoding()<0&&e.signalEncoderChange(X)},t}(me);var Ws=function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)i.hasOwnProperty(o)&&(n[o]=i[o])},r(t,e)};return function(t,e){r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),mn=function(r){Ws(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return t.prototype.getEncodingMode=function(){return _t},t.prototype.encodeChar=function(e,n){if(e===" ".charCodeAt(0))return n.append(3),1;if(e>="0".charCodeAt(0)&&e<="9".charCodeAt(0))return n.append(e-48+4),1;if(e>="a".charCodeAt(0)&&e<="z".charCodeAt(0))return n.append(e-97+14),1;if(e<" ".charCodeAt(0))return n.append(0),n.append(e),2;if(e<="/".charCodeAt(0))return n.append(1),n.append(e-33),2;if(e<="@".charCodeAt(0))return n.append(1),n.append(e-58+15),2;if(e>="[".charCodeAt(0)&&e<="_".charCodeAt(0))return n.append(1),n.append(e-91+22),2;if(e==="`".charCodeAt(0))return n.append(2),n.append(0),2;if(e<="Z".charCodeAt(0))return n.append(2),n.append(e-65+1),2;if(e<=127)return n.append(2),n.append(e-123+27),2;n.append("1");var i=2;return i+=this.encodeChar(e-128,n),i},t}(me);var Xs=function(){function r(){}return r.randomize253State=function(t){var e=149*t%253+1,n=ln+e;return n<=254?n:n-254},r.encodeHighLevel=function(t,e,n,i,o){e===void 0&&(e=0),n===void 0&&(n=null),i===void 0&&(i=null),o===void 0&&(o=!1);var a=new me,f=[new dn,a,new mn,new gn,new vn,new pn],s=new xn(t);s.setSymbolShape(e),s.setSizeConstraints(n,i),t.startsWith(De)&&t.endsWith(Ne)?(s.writeCodeword(Ri),s.setSkipAtEnd(2),s.pos+=De.length):t.startsWith(Re)&&t.endsWith(Ne)&&(s.writeCodeword(Ni),s.setSkipAtEnd(2),s.pos+=Re.length);var u=X;for(o&&(a.encodeMaximal(s),u=s.getNewEncoding(),s.resetEncoderSignal());s.hasMoreCharacters();)f[u].encode(s),s.getNewEncoding()>=0&&(u=s.getNewEncoding(),s.resetEncoderSignal());var c=s.getCodewordCount();s.updateSymbolInfo();var h=s.getSymbolInfo().getDataCapacity();c<h&&u!==X&&u!==wt&&u!==gt&&s.writeCodeword("\xFE");var l=s.getCodewords();for(l.length()<h&&l.append(ln);l.length()<h;)l.append(this.randomize253State(l.length()+1));return s.getCodewords().toString()},r.lookAheadTest=function(t,e,n){var i=this.lookAheadTestIntern(t,e,n);if(n===pt&&i===pt){for(var o=Math.min(e+3,t.length),a=e;a<o;a++)if(!this.isNativeX12(t.charCodeAt(a)))return X}else if(n===gt&&i===gt){for(var o=Math.min(e+4,t.length),a=e;a<o;a++)if(!this.isNativeEDIFACT(t.charCodeAt(a)))return X}return i},r.lookAheadTestIntern=function(t,e,n){if(e>=t.length)return n;var i;n===X?i=[0,1,1,1,1,1.25]:(i=[1,2,2,2,2,2.25],i[n]=0);for(var o=0,a=new Uint8Array(6),f=[];;){if(e+o===t.length){Y.fill(a,0),Y.fill(f,0);var s=this.findMinimums(i,f,M.MAX_VALUE,a),u=this.getMinimumCount(a);if(f[X]===s)return X;if(u===1){if(a[wt]>0)return wt;if(a[gt]>0)return gt;if(a[_t]>0)return _t;if(a[pt]>0)return pt}return mt}var c=t.charCodeAt(e+o);if(o++,this.isDigit(c)?i[X]+=.5:this.isExtendedASCII(c)?(i[X]=Math.ceil(i[X]),i[X]+=2):(i[X]=Math.ceil(i[X]),i[X]++),this.isNativeC40(c)?i[mt]+=2/3:this.isExtendedASCII(c)?i[mt]+=8/3:i[mt]+=4/3,this.isNativeText(c)?i[_t]+=2/3:this.isExtendedASCII(c)?i[_t]+=8/3:i[_t]+=4/3,this.isNativeX12(c)?i[pt]+=2/3:this.isExtendedASCII(c)?i[pt]+=13/3:i[pt]+=10/3,this.isNativeEDIFACT(c)?i[gt]+=3/4:this.isExtendedASCII(c)?i[gt]+=17/4:i[gt]+=13/4,this.isSpecialB256(c)?i[wt]+=4:i[wt]++,o>=4){if(Y.fill(a,0),Y.fill(f,0),this.findMinimums(i,f,M.MAX_VALUE,a),f[X]<this.min(f[wt],f[mt],f[_t],f[pt],f[gt]))return X;if(f[wt]<f[X]||f[wt]+1<this.min(f[mt],f[_t],f[pt],f[gt]))return wt;if(f[gt]+1<this.min(f[wt],f[mt],f[_t],f[pt],f[X]))return gt;if(f[_t]+1<this.min(f[wt],f[mt],f[gt],f[pt],f[X]))return _t;if(f[pt]+1<this.min(f[wt],f[mt],f[gt],f[_t],f[X]))return pt;if(f[mt]+1<this.min(f[X],f[wt],f[gt],f[_t])){if(f[mt]<f[pt])return mt;if(f[mt]===f[pt]){for(var h=e+o+1;h<t.length;){var l=t.charCodeAt(h);if(this.isX12TermSep(l))return pt;if(!this.isNativeX12(l))break;h++}return mt}}}}},r.min=function(t,e,n,i,o){var a=Math.min(t,Math.min(e,Math.min(n,i)));return o===void 0?a:Math.min(a,o)},r.findMinimums=function(t,e,n,i){for(var o=0;o<6;o++){var a=e[o]=Math.ceil(t[o]);n>a&&(n=a,Y.fill(i,0)),n===a&&(i[o]=i[o]+1)}return n},r.getMinimumCount=function(t){for(var e=0,n=0;n<6;n++)e+=t[n];return e||0},r.isDigit=function(t){return t>="0".charCodeAt(0)&&t<="9".charCodeAt(0)},r.isExtendedASCII=function(t){return t>=128&&t<=255},r.isNativeC40=function(t){return t===" ".charCodeAt(0)||t>="0".charCodeAt(0)&&t<="9".charCodeAt(0)||t>="A".charCodeAt(0)&&t<="Z".charCodeAt(0)},r.isNativeText=function(t){return t===" ".charCodeAt(0)||t>="0".charCodeAt(0)&&t<="9".charCodeAt(0)||t>="a".charCodeAt(0)&&t<="z".charCodeAt(0)},r.isNativeX12=function(t){return this.isX12TermSep(t)||t===" ".charCodeAt(0)||t>="0".charCodeAt(0)&&t<="9".charCodeAt(0)||t>="A".charCodeAt(0)&&t<="Z".charCodeAt(0)},r.isX12TermSep=function(t){return t===13||t==="*".charCodeAt(0)||t===">".charCodeAt(0)},r.isNativeEDIFACT=function(t){return t>=" ".charCodeAt(0)&&t<="^".charCodeAt(0)},r.isSpecialB256=function(t){return!1},r.determineConsecutiveDigitCount=function(t,e){e===void 0&&(e=0);for(var n=t.length,i=e;i<n&&this.isDigit(t.charCodeAt(i));)i++;return i-e},r.illegalCharacter=function(t){var e=M.toHexString(t.charCodeAt(0));throw e="0000".substring(0,4-e.length)+e,new Error("Illegal character: "+t+" (0x"+e+")")},r}(),k=Xs;var yn=function(r){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&r[t],n=0;if(e)return e.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},Fi=function(){function r(t){this.charset=t,this.name=t.name}return r.prototype.canEncode=function(t){try{return yt.encode(t,this.charset)!=null}catch{return!1}},r}(),Li=function(){function r(t,e,n){var i,o,a,f,s,u;this.ENCODERS=["IBM437","ISO-8859-2","ISO-8859-3","ISO-8859-4","ISO-8859-5","ISO-8859-6","ISO-8859-7","ISO-8859-8","ISO-8859-9","ISO-8859-10","ISO-8859-11","ISO-8859-13","ISO-8859-14","ISO-8859-15","ISO-8859-16","windows-1250","windows-1251","windows-1252","windows-1256","Shift_JIS"].map(function(L){return new Fi(ge.forName(L))}),this.encoders=[];var c=[];c.push(new Fi(qe.ISO_8859_1));for(var h=e!=null&&e.name.startsWith("UTF"),l=0;l<t.length;l++){var d=!1;try{for(var p=(i=void 0,yn(c)),v=p.next();!v.done;v=p.next()){var g=v.value,y=t.charAt(l),m=y.charCodeAt(0);if(m===n||g.canEncode(y)){d=!0;break}}}catch(L){i={error:L}}finally{try{v&&!v.done&&(o=p.return)&&o.call(p)}finally{if(i)throw i.error}}if(!d)try{for(var A=(a=void 0,yn(this.ENCODERS)),_=A.next();!_.done;_=A.next()){var g=_.value;if(g.canEncode(t.charAt(l))){c.push(g),d=!0;break}}}catch(L){a={error:L}}finally{try{_&&!_.done&&(f=A.return)&&f.call(A)}finally{if(a)throw a.error}}d||(h=!0)}if(c.length===1&&!h)this.encoders=[c[0]];else{this.encoders=[];var I=0;try{for(var T=yn(c),D=T.next();!D.done;D=T.next()){var g=D.value;this.encoders[I++]=g}}catch(L){s={error:L}}finally{try{D&&!D.done&&(u=T.return)&&u.call(T)}finally{if(s)throw s.error}}}var b=-1;if(e!=null){for(var l=0;l<this.encoders.length;l++)if(this.encoders[l]!=null&&e.name===this.encoders[l].name){b=l;break}}this.priorityEncoderIndex=b}return r.prototype.length=function(){return this.encoders.length},r.prototype.getCharsetName=function(t){if(!(t<this.length()))throw new Error("index must be less than length");return this.encoders[t].name},r.prototype.getCharset=function(t){if(!(t<this.length()))throw new Error("index must be less than length");return this.encoders[t].charset},r.prototype.getECIValue=function(t){return this.encoders[t].charset.getValueIdentifier()},r.prototype.getPriorityEncoderIndex=function(){return this.priorityEncoderIndex},r.prototype.canEncode=function(t,e){if(!(e<this.length()))throw new Error("index must be less than length");return!0},r.prototype.encode=function(t,e){if(!(e<this.length()))throw new Error("index must be less than length");return yt.encode(F.getCharAt(t),this.encoders[e].name)},r}();var zs=3,Ui=function(){function r(t,e,n){this.fnc1=n;var i=new Li(t,e,n);if(i.length()===1)for(var o=0;o<this.bytes.length;o++){var a=t.charAt(o).charCodeAt(0);this.bytes[o]=a===n?1e3:a}else this.bytes=this.encodeMinimally(t,i,n)}return r.prototype.getFNC1Character=function(){return this.fnc1},r.prototype.length=function(){return this.bytes.length},r.prototype.haveNCharacters=function(t,e){if(t+e-1>=this.bytes.length)return!1;for(var n=0;n<e;n++)if(this.isECI(t+n))return!1;return!0},r.prototype.charAt=function(t){if(t<0||t>=this.length())throw new Error(""+t);if(this.isECI(t))throw new Error("value at "+t+" is not a character but an ECI");return this.isFNC1(t)?this.fnc1:this.bytes[t]},r.prototype.subSequence=function(t,e){if(t<0||t>e||e>this.length())throw new Error(""+t);for(var n=new P,i=t;i<e;i++){if(this.isECI(i))throw new Error("value at "+i+" is not a character but an ECI");n.append(this.charAt(i))}return n.toString()},r.prototype.isECI=function(t){if(t<0||t>=this.length())throw new Error(""+t);return this.bytes[t]>255&&this.bytes[t]<=999},r.prototype.isFNC1=function(t){if(t<0||t>=this.length())throw new Error(""+t);return this.bytes[t]===1e3},r.prototype.getECIValue=function(t){if(t<0||t>=this.length())throw new Error(""+t);if(!this.isECI(t))throw new Error("value at "+t+" is not an ECI but a character");return this.bytes[t]-256},r.prototype.addEdge=function(t,e,n){(t[e][n.encoderIndex]==null||t[e][n.encoderIndex].cachedTotalSize>n.cachedTotalSize)&&(t[e][n.encoderIndex]=n)},r.prototype.addEdges=function(t,e,n,i,o,a){var f=t.charAt(i).charCodeAt(0),s=0,u=e.length();e.getPriorityEncoderIndex()>=0&&(f===a||e.canEncode(f,e.getPriorityEncoderIndex()))&&(s=e.getPriorityEncoderIndex(),u=s+1);for(var c=s;c<u;c++)(f===a||e.canEncode(f,c))&&this.addEdge(n,i+1,new ki(f,e,c,o,a))},r.prototype.encodeMinimally=function(t,e,n){var i=t.length,o=new ki[i+1][e.length()];this.addEdges(t,e,o,0,null,n);for(var a=1;a<=i;a++){for(var f=0;f<e.length();f++)o[a][f]!=null&&a<i&&this.addEdges(t,e,o,a,o[a][f],n);for(var f=0;f<e.length();f++)o[a-1][f]=null}for(var s=-1,u=M.MAX_VALUE,f=0;f<e.length();f++)if(o[i][f]!=null){var c=o[i][f];c.cachedTotalSize<u&&(u=c.cachedTotalSize,s=f)}if(s<0)throw new Error('Failed to encode "'+t+'"');for(var h=[],l=o[i][s];l!=null;){if(l.isFNC1())h.unshift(1e3);else for(var d=e.encode(l.c,l.encoderIndex),a=d.length-1;a>=0;a--)h.unshift(d[a]&255);var p=l.previous===null?0:l.previous.encoderIndex;p!==l.encoderIndex&&h.unshift(256+e.getECIValue(l.encoderIndex)),l=l.previous}for(var v=[],a=0;a<v.length;a++)v[a]=h[a];return v},r}();var ki=function(){function r(t,e,n,i,o){this.c=t,this.encoderSet=e,this.encoderIndex=n,this.previous=i,this.fnc1=o,this.c=t===o?1e3:t;var a=this.isFNC1()?1:e.encode(t,n).length,f=i===null?0:i.encoderIndex;f!==n&&(a+=zs),i!=null&&(a+=i.cachedTotalSize),this.cachedTotalSize=a}return r.prototype.isFNC1=function(){return this.c===1e3},r}();var Zs=function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)i.hasOwnProperty(o)&&(n[o]=i[o])},r(t,e)};return function(t,e){r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),$e=function(r){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&r[t],n=0;if(e)return e.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},js=function(r,t){var e=typeof Symbol=="function"&&r[Symbol.iterator];if(!e)return r;var n=e.call(r),i,o=[],a;try{for(;(t===void 0||t-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(f){a={error:f}}finally{try{i&&!i.done&&(e=n.return)&&e.call(n)}finally{if(a)throw a.error}}return o},Ys=function(){for(var r=[],t=0;t<arguments.length;t++)r=r.concat(js(arguments[t]));return r},N;(function(r){r[r.ASCII=0]="ASCII",r[r.C40=1]="C40",r[r.TEXT=2]="TEXT",r[r.X12=3]="X12",r[r.EDF=4]="EDF",r[r.B256=5]="B256"})(N||(N={}));var Ks=["!",'"',"#","$","%","&","'","(",")","*","+",",","-",".","/",":",";","<","=",">","?","@","[","\\","]","^","_"],It=function(){function r(){}return r.isExtendedASCII=function(t,e){return t!==e&&t>=128&&t<=255},r.isInC40Shift1Set=function(t){return t<=31},r.isInC40Shift2Set=function(t,e){var n,i;try{for(var o=$e(Ks),a=o.next();!a.done;a=o.next()){var f=a.value;if(f.charCodeAt(0)===t)return!0}}catch(s){n={error:s}}finally{try{a&&!a.done&&(i=o.return)&&i.call(o)}finally{if(n)throw n.error}}return t===e},r.isInTextShift1Set=function(t){return this.isInC40Shift1Set(t)},r.isInTextShift2Set=function(t,e){return this.isInC40Shift2Set(t,e)},r.encodeHighLevel=function(t,e,n,i){e===void 0&&(e=null),n===void 0&&(n=-1),i===void 0&&(i=0);var o=0;return t.startsWith(De)&&t.endsWith(Ne)?(o=5,t=t.substring(De.length,t.length-2)):t.startsWith(Re)&&t.endsWith(Ne)&&(o=6,t=t.substring(Re.length,t.length-2)),decodeURIComponent(escape(String.fromCharCode.apply(String,Ys(this.encode(t,e,n,i,o)))))},r.encode=function(t,e,n,i,o){return this.encodeMinimally(new qs(t,e,n,i,o)).getBytes()},r.addEdge=function(t,e){var n=e.fromPosition+e.characterLength;(t[n][e.getEndMode()]===null||t[n][e.getEndMode()].cachedTotalSize>e.cachedTotalSize)&&(t[n][e.getEndMode()]=e)},r.getNumberOfC40Words=function(t,e,n,i){for(var o=0,a=e;a<t.length();a++){if(t.isECI(a))return i[0]=0,0;var f=t.charAt(a);if(n&&k.isNativeC40(f)||!n&&k.isNativeText(f))o++;else if(!r.isExtendedASCII(f,t.getFNC1Character()))o+=2;else{var s=f&255;s>=128&&(n&&k.isNativeC40(s-128)||!n&&k.isNativeText(s-128))?o+=3:o+=4}if(o%3===0||(o-2)%3===0&&a+1===t.length())return i[0]=a-e+1,Math.ceil(o/3)}return i[0]=0,0},r.addEdges=function(t,e,n,i){var o,a;if(t.isECI(n)){this.addEdge(e,new kt(t,N.ASCII,n,1,i));return}var f=t.charAt(n);if(i===null||i.getEndMode()!==N.EDF){k.isDigit(f)&&t.haveNCharacters(n,2)&&k.isDigit(t.charAt(n+1))?this.addEdge(e,new kt(t,N.ASCII,n,2,i)):this.addEdge(e,new kt(t,N.ASCII,n,1,i));var s=[N.C40,N.TEXT];try{for(var u=$e(s),c=u.next();!c.done;c=u.next()){var h=c.value,l=[];r.getNumberOfC40Words(t,n,h===N.C40,l)>0&&this.addEdge(e,new kt(t,h,n,l[0],i))}}catch(v){o={error:v}}finally{try{c&&!c.done&&(a=u.return)&&a.call(u)}finally{if(o)throw o.error}}t.haveNCharacters(n,3)&&k.isNativeX12(t.charAt(n))&&k.isNativeX12(t.charAt(n+1))&&k.isNativeX12(t.charAt(n+2))&&this.addEdge(e,new kt(t,N.X12,n,3,i)),this.addEdge(e,new kt(t,N.B256,n,1,i))}var d;for(d=0;d<3;d++){var p=n+d;if(t.haveNCharacters(p,1)&&k.isNativeEDIFACT(t.charAt(p)))this.addEdge(e,new kt(t,N.EDF,n,d+1,i));else break}d===3&&t.haveNCharacters(n,4)&&k.isNativeEDIFACT(t.charAt(n+3))&&this.addEdge(e,new kt(t,N.EDF,n,4,i))},r.encodeMinimally=function(t){var e=t.length(),n=Array(e+1).fill(null).map(function(){return Array(6).fill(0)});this.addEdges(t,n,0,null);for(var i=1;i<=e;i++){for(var o=0;o<6;o++)n[i][o]!==null&&i<e&&this.addEdges(t,n,i,n[i][o]);for(var o=0;o<6;o++)n[i-1][o]=null}for(var a=-1,f=M.MAX_VALUE,o=0;o<6;o++)if(n[e][o]!==null){var s=n[e][o],u=o>=1&&o<=3?s.cachedTotalSize+1:s.cachedTotalSize;u<f&&(f=u,a=o)}if(a<0)throw new Error('Failed to encode "'+t+'"');return new Qs(n[e][a])},r}();var Qs=function(){function r(t){var e=t.input,n=0,i=[],o=[],a=[];(t.mode===N.C40||t.mode===N.TEXT||t.mode===N.X12)&&t.getEndMode()!==N.ASCII&&(n+=this.prepend(kt.getBytes(254),i));for(var f=t;f!==null;)n+=this.prepend(f.getDataBytes(),i),(f.previous===null||f.getPreviousStartMode()!==f.getMode())&&(f.getMode()===N.B256&&(n<=249?(i.unshift(n),n++):(i.unshift(n%250),i.unshift(n/250+249),n+=2),o.push(i.length),a.push(n)),this.prepend(f.getLatchBytes(),i),n=0),f=f.previous;e.getMacroId()===5?n+=this.prepend(kt.getBytes(236),i):e.getMacroId()===6&&(n+=this.prepend(kt.getBytes(237),i)),e.getFNC1Character()>0&&(n+=this.prepend(kt.getBytes(232),i));for(var s=0;s<o.length;s++)this.applyRandomPattern(i,i.length-o[s],a[s]);var u=t.getMinSymbolSize(i.length);for(i.length<u&&i.push(129);i.length<u;)i.push(this.randomize253State(i.length+1));this.bytes=new Uint8Array(i.length);for(var s=0;s<this.bytes.length;s++)this.bytes[s]=i[s]}return r.prototype.prepend=function(t,e){for(var n=t.length-1;n>=0;n--)e.unshift(t[n]);return t.length},r.prototype.randomize253State=function(t){var e=149*t%253+1,n=129+e;return n<=254?n:n-254},r.prototype.applyRandomPattern=function(t,e,n){for(var i=0;i<n;i++){var o=e+i,a=t[o]&255,f=149*(o+1)%255+1,s=a+f;t[o]=s<=255?s:s-256}},r.prototype.getBytes=function(){return this.bytes},r}(),kt=function(){function r(t,e,n,i,o){if(this.input=t,this.mode=e,this.fromPosition=n,this.characterLength=i,this.previous=o,this.allCodewordCapacities=[3,5,8,10,12,16,18,22,30,32,36,44,49,62,86,114,144,174,204,280,368,456,576,696,816,1050,1304,1558],this.squareCodewordCapacities=[3,5,8,12,18,22,30,36,44,62,86,114,144,174,204,280,368,456,576,696,816,1050,1304,1558],this.rectangularCodewordCapacities=[5,10,16,33,32,49],!(n+i<=t.length()))throw new Error("Invalid edge");var a=o!==null?o.cachedTotalSize:0,f=this.getPreviousMode();switch(e){case N.ASCII:a++,(t.isECI(n)||It.isExtendedASCII(t.charAt(n),t.getFNC1Character()))&&a++,(f===N.C40||f===N.TEXT||f===N.X12)&&a++;break;case N.B256:a++,(f!==N.B256||this.getB256Size()===250)&&a++,f===N.ASCII?a++:(f===N.C40||f===N.TEXT||f===N.X12)&&(a+=2);break;case N.C40:case N.TEXT:case N.X12:if(e===N.X12)a+=2;else{var s=[];a+=It.getNumberOfC40Words(t,n,e===N.C40,s)*2}f===N.ASCII||f===N.B256?a++:f!==e&&(f===N.C40||f===N.TEXT||f===N.X12)&&(a+=2);break;case N.EDF:a+=3,f===N.ASCII||f===N.B256?a++:(f===N.C40||f===N.TEXT||f===N.X12)&&(a+=2);break}this.cachedTotalSize=a}return r.prototype.getB256Size=function(){for(var t=0,e=this;e!==null&&e.mode===N.B256&&t<=250;)t++,e=e.previous;return t},r.prototype.getPreviousStartMode=function(){return this.previous===null?N.ASCII:this.previous.mode},r.prototype.getPreviousMode=function(){return this.previous===null?N.ASCII:this.previous.getEndMode()},r.prototype.getEndMode=function(){if(this.mode===N.EDF){if(this.characterLength<4)return N.ASCII;var t=this.getLastASCII();if(t>0&&this.getCodewordsRemaining(this.cachedTotalSize+t)<=2-t)return N.ASCII}if(this.mode===N.C40||this.mode===N.TEXT||this.mode===N.X12){if(this.fromPosition+this.characterLength>=this.input.length()&&this.getCodewordsRemaining(this.cachedTotalSize)===0)return N.ASCII;var t=this.getLastASCII();if(t===1&&this.getCodewordsRemaining(this.cachedTotalSize+1)===0)return N.ASCII}return this.mode},r.prototype.getMode=function(){return this.mode},r.prototype.getLastASCII=function(){var t=this.input.length(),e=this.fromPosition+this.characterLength;return t-e>4||e>=t?0:t-e===1?It.isExtendedASCII(this.input.charAt(e),this.input.getFNC1Character())?0:1:t-e===2?It.isExtendedASCII(this.input.charAt(e),this.input.getFNC1Character())||It.isExtendedASCII(this.input.charAt(e+1),this.input.getFNC1Character())?0:k.isDigit(this.input.charAt(e))&&k.isDigit(this.input.charAt(e+1))?1:2:t-e===3?k.isDigit(this.input.charAt(e))&&k.isDigit(this.input.charAt(e+1))&&!It.isExtendedASCII(this.input.charAt(e+2),this.input.getFNC1Character())||k.isDigit(this.input.charAt(e+1))&&k.isDigit(this.input.charAt(e+2))&&!It.isExtendedASCII(this.input.charAt(e),this.input.getFNC1Character())?2:0:k.isDigit(this.input.charAt(e))&&k.isDigit(this.input.charAt(e+1))&&k.isDigit(this.input.charAt(e+2))&&k.isDigit(this.input.charAt(e+3))?2:0},r.prototype.getMinSymbolSize=function(t){var e,n,i,o,a,f;switch(this.input.getShapeHint()){case 1:try{for(var s=$e(this.squareCodewordCapacities),u=s.next();!u.done;u=s.next()){var c=u.value;if(c>=t)return c}}catch(v){e={error:v}}finally{try{u&&!u.done&&(n=s.return)&&n.call(s)}finally{if(e)throw e.error}}break;case 2:try{for(var h=$e(this.rectangularCodewordCapacities),l=h.next();!l.done;l=h.next()){var c=l.value;if(c>=t)return c}}catch(v){i={error:v}}finally{try{l&&!l.done&&(o=h.return)&&o.call(h)}finally{if(i)throw i.error}}break}try{for(var d=$e(this.allCodewordCapacities),p=d.next();!p.done;p=d.next()){var c=p.value;if(c>=t)return c}}catch(v){a={error:v}}finally{try{p&&!p.done&&(f=d.return)&&f.call(d)}finally{if(a)throw a.error}}return this.allCodewordCapacities[this.allCodewordCapacities.length-1]},r.prototype.getCodewordsRemaining=function(t){return this.getMinSymbolSize(t)-t},r.getBytes=function(t,e){var n=new Uint8Array(e?2:1);return n[0]=t,e&&(n[1]=e),n},r.prototype.setC40Word=function(t,e,n,i,o){var a=1600*(n&255)+40*(i&255)+(o&255)+1;t[e]=a/256,t[e+1]=a%256},r.prototype.getX12Value=function(t){return t===13?0:t===42?1:t===62?2:t===32?3:t>=48&&t<=57?t-44:t>=65&&t<=90?t-51:t},r.prototype.getX12Words=function(){if(this.characterLength%3!==0)throw new Error("X12 words must be a multiple of 3");for(var t=new Uint8Array(this.characterLength/3*2),e=0;e<t.length;e+=2)this.setC40Word(t,e,this.getX12Value(this.input.charAt(this.fromPosition+e/2*3)),this.getX12Value(this.input.charAt(this.fromPosition+e/2*3+1)),this.getX12Value(this.input.charAt(this.fromPosition+e/2*3+2)));return t},r.prototype.getShiftValue=function(t,e,n){return e&&It.isInC40Shift1Set(t)||!e&&It.isInTextShift1Set(t)?0:e&&It.isInC40Shift2Set(t,n)||!e&&It.isInTextShift2Set(t,n)?1:2},r.prototype.getC40Value=function(t,e,n,i){if(n===i){if(e!==2)throw new Error("FNC1 cannot be used in C40 shift 2");return 27}return t?n<=31?n:n===32?3:n<=47?n-33:n<=57?n-44:n<=64?n-43:n<=90?n-51:n<=95?n-69:n<=127?n-96:n:n===0?0:e===0&&n<=3?n-1:e===1&&n<=31?n:n===32?3:n>=33&&n<=47?n-33:n>=48&&n<=57?n-44:n>=58&&n<=64?n-43:n>=65&&n<=90?n-64:n>=91&&n<=95?n-69:n===96?0:n>=97&&n<=122?n-83:n>=123&&n<=127?n-96:n},r.prototype.getC40Words=function(t,e){for(var n=[],i=0;i<this.characterLength;i++){var o=this.input.charAt(this.fromPosition+i);if(t&&k.isNativeC40(o)||!t&&k.isNativeText(o))n.push(this.getC40Value(t,0,o,e));else if(It.isExtendedASCII(o,e)){var f=(o&255)-128;if(t&&k.isNativeC40(f)||!t&&k.isNativeText(f))n.push(1),n.push(30),n.push(this.getC40Value(t,0,f,e));else{n.push(1),n.push(30);var a=this.getShiftValue(f,t,e);n.push(a),n.push(this.getC40Value(t,a,f,e))}}else{var a=this.getShiftValue(o,t,e);n.push(a),n.push(this.getC40Value(t,a,o,e))}}if(n.length%3!==0){if(!((n.length-2)%3===0&&this.fromPosition+this.characterLength===this.input.length()))throw new Error("C40 words must be a multiple of 3");n.push(0)}for(var s=new Uint8Array(n.length/3*2),u=0,i=0;i<n.length;i+=3)this.setC40Word(s,u,n[i]&255,n[i+1]&255,n[i+2]&255),u+=2;return s},r.prototype.getEDFBytes=function(){for(var t=Math.ceil(this.characterLength/4),e=new Uint8Array(t*3),n=this.fromPosition,i=Math.min(this.fromPosition+this.characterLength-1,this.input.length()-1),o=0;o<t;o+=3){for(var a=[],f=0;f<4;f++)n<=i?a[f]=this.input.charAt(n++)&63:a[f]=n===i+1?31:0;var s=a[0]<<18;s|=a[1]<<12,s|=a[2]<<6,s|=a[3],e[o]=s>>16&255,e[o+1]=s>>8&255,e[o+2]=s&255}return e},r.prototype.getLatchBytes=function(){switch(this.getPreviousMode()){case N.ASCII:case N.B256:switch(this.mode){case N.B256:return r.getBytes(231);case N.C40:return r.getBytes(230);case N.TEXT:return r.getBytes(239);case N.X12:return r.getBytes(238);case N.EDF:return r.getBytes(240)}break;case N.C40:case N.TEXT:case N.X12:if(this.mode!==this.getPreviousMode())switch(this.mode){case N.ASCII:return r.getBytes(254);case N.B256:return r.getBytes(254,231);case N.C40:return r.getBytes(254,230);case N.TEXT:return r.getBytes(254,239);case N.X12:return r.getBytes(254,238);case N.EDF:return r.getBytes(254,240)}break;case N.EDF:if(this.mode!==N.EDF)throw new Error("Cannot switch from EDF to "+this.mode);break}return new Uint8Array(0)},r.prototype.getDataBytes=function(){switch(this.mode){case N.ASCII:return this.input.isECI(this.fromPosition)?r.getBytes(241,this.input.getECIValue(this.fromPosition)+1):It.isExtendedASCII(this.input.charAt(this.fromPosition),this.input.getFNC1Character())?r.getBytes(235,this.input.charAt(this.fromPosition)-127):this.characterLength===2?r.getBytes(this.input.charAt(this.fromPosition)*10+this.input.charAt(this.fromPosition+1)+130):this.input.isFNC1(this.fromPosition)?r.getBytes(232):r.getBytes(this.input.charAt(this.fromPosition)+1);case N.B256:return r.getBytes(this.input.charAt(this.fromPosition));case N.C40:return this.getC40Words(!0,this.input.getFNC1Character());case N.TEXT:return this.getC40Words(!1,this.input.getFNC1Character());case N.X12:return this.getX12Words();case N.EDF:return this.getEDFBytes()}},r}(),qs=function(r){Zs(t,r);function t(e,n,i,o,a){var f=r.call(this,e,n,i)||this;return f.shape=o,f.macroId=a,f}return t.prototype.getMacroId=function(){return this.macroId},t.prototype.getShapeHint=function(){return this.shape},t}(Ui);var Ew=function(){function r(){}return r.prototype.encode=function(t,e,n,i,o){if(o===void 0&&(o=null),t.trim()==="")throw new Error("Found empty contents");if(e!==C.DATA_MATRIX)throw new Error("Can only encode DATA_MATRIX, but got "+e);if(n<0||i<0)throw new Error("Requested dimensions can't be negative: "+n+"x"+i);var a=0,f=null,s=null;if(o!=null){var u=o.get(H.DATA_MATRIX_SHAPE);u!=null&&(a=u);var c=o.get(H.MIN_SIZE);c!=null&&(f=c);var h=o.get(H.MAX_SIZE);h!=null&&(s=h)}var l,d=o!=null&&o.has(H.DATA_MATRIX_COMPACT)&&!!o.get(H.DATA_MATRIX_COMPACT).toString();if(d){var p=o.has(H.GS1_FORMAT)&&!!o.get(H.GS1_FORMAT).toString(),v=null,g=o.has(H.CHARACTER_SET);g&&(v=ge.forName(o.get(H.CHARACTER_SET).toString())),l=It.encodeHighLevel(t,v,p?29:-1,a)}else{var y=o!=null&&o.has(H.FORCE_C40)&&!!o.get(H.FORCE_C40).toString();l=k.encodeHighLevel(t,a,f,s,y)}var m=be.lookup(l.length,a,f,s,!0),A=wr.encodeECC200(l,m),_=new mr(A,m.getSymbolDataWidth(),m.getSymbolDataHeight());return _.place(),this.encodeLowLevel(_,m,n,i)},r.prototype.encodeLowLevel=function(t,e,n,i){for(var o=e.getSymbolDataWidth(),a=e.getSymbolDataHeight(),f=new Qe(e.getSymbolWidth(),e.getSymbolHeight()),s=0,u=0;u<a;u++){var c=void 0;if(u%e.matrixHeight===0){c=0;for(var h=0;h<e.getSymbolWidth();h++)f.setBoolean(c,s,h%2===0),c++;s++}c=0;for(var h=0;h<o;h++)h%e.matrixWidth===0&&(f.setBoolean(c,s,!0),c++),f.setBoolean(c,s,t.getBit(h,u)),c++,h%e.matrixWidth===e.matrixWidth-1&&(f.setBoolean(c,s,u%2===0),c++);if(s++,u%e.matrixHeight===e.matrixHeight-1){c=0;for(var h=0;h<e.getSymbolWidth();h++)f.setBoolean(c,s,!0),c++;s++}}return this.convertByteMatrixToBitMatrix(f,n,i)},r.prototype.convertByteMatrixToBitMatrix=function(t,e,n){var i=t.getWidth(),o=t.getHeight(),a=Math.max(e,i),f=Math.max(n,o),s=Math.min(a/i,f/o),u=(a-i*s)/2,c=(f-o*s)/2,h;n<o||e<i?(u=0,c=0,h=new at(i,o)):h=new at(e,n),h.clear();for(var l=0,d=c;l<o;l++,d+=s)for(var p=0,v=u;p<i;p++,v+=s)t.get(p,l)===1&&h.setRegion(v,d,s,s);return h},r}();var Js=function(){function r(){}return r.prototype.isCompact=function(){return this.compact},r.prototype.setCompact=function(t){this.compact=t},r.prototype.getSize=function(){return this.size},r.prototype.setSize=function(t){this.size=t},r.prototype.getLayers=function(){return this.layers},r.prototype.setLayers=function(t){this.layers=t},r.prototype.getCodeWords=function(){return this.codeWords},r.prototype.setCodeWords=function(t){this.codeWords=t},r.prototype.getMatrix=function(){return this.matrix},r.prototype.setMatrix=function(t){this.matrix=t},r}(),An=Js;var $s=function(){function r(){}return r.singletonList=function(t){return[t]},r.min=function(t,e){return t.sort(e)[0]},r}(),wn=$s;var t0=function(){function r(t){this.previous=t}return r.prototype.getPrevious=function(){return this.previous},r}(),Hi=t0;var e0=function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)i.hasOwnProperty(o)&&(n[o]=i[o])},r(t,e)};return function(t,e){r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),r0=function(r){e0(t,r);function t(e,n,i){var o=r.call(this,e)||this;return o.value=n,o.bitCount=i,o}return t.prototype.appendTo=function(e,n){e.appendBits(this.value,this.bitCount)},t.prototype.add=function(e,n){return new t(this,e,n)},t.prototype.addBinaryShift=function(e,n){return console.warn("addBinaryShift on SimpleToken, this simply returns a copy of this token"),new t(this,e,n)},t.prototype.toString=function(){var e=this.value&(1<<this.bitCount)-1;return e|=1<<this.bitCount,"<"+M.toBinaryString(e|1<<this.bitCount).substring(1)+">"},t}(Hi),Pe=r0;var n0=function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)i.hasOwnProperty(o)&&(n[o]=i[o])},r(t,e)};return function(t,e){r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),i0=function(r){n0(t,r);function t(e,n,i){var o=r.call(this,e,0,0)||this;return o.binaryShiftStart=n,o.binaryShiftByteCount=i,o}return t.prototype.appendTo=function(e,n){for(var i=0;i<this.binaryShiftByteCount;i++)(i===0||i===31&&this.binaryShiftByteCount<=62)&&(e.appendBits(31,5),this.binaryShiftByteCount>62?e.appendBits(this.binaryShiftByteCount-31,16):i===0?e.appendBits(Math.min(this.binaryShiftByteCount,31),5):e.appendBits(this.binaryShiftByteCount-31,5)),e.appendBits(n[this.binaryShiftStart+i],8)},t.prototype.addBinaryShift=function(e,n){return new t(this,e,n)},t.prototype.toString=function(){return"<"+this.binaryShiftStart+"::"+(this.binaryShiftStart+this.binaryShiftByteCount-1)+">"},t}(Pe),Vi=i0;function Gi(r,t,e){return new Vi(r,t,e)}function Me(r,t,e){return new Pe(r,t,e)}var Wi=["UPPER","LOWER","DIGIT","MIXED","PUNCT"],Gt=0,Be=1,St=2,Er=3,bt=4,Xi=new Pe(null,0,0);var Cr=[Int32Array.from([0,327708,327710,327709,656318]),Int32Array.from([590318,0,327710,327709,656318]),Int32Array.from([262158,590300,0,590301,932798]),Int32Array.from([327709,327708,656318,0,327710]),Int32Array.from([327711,656380,656382,656381,0])];var f0=function(r){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&r[t],n=0;if(e)return e.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};function s0(r){var t,e;try{for(var n=f0(r),i=n.next();!i.done;i=n.next()){var o=i.value;Y.fill(o,-1)}}catch(a){t={error:a}}finally{try{i&&!i.done&&(e=n.return)&&e.call(n)}finally{if(t)throw t.error}}return r[Gt][bt]=0,r[Be][bt]=0,r[Be][Gt]=28,r[Er][bt]=0,r[St][bt]=0,r[St][Gt]=15,r}var Ir=s0(Y.createInt32Array(6,6));var u0=function(r){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&r[t],n=0;if(e)return e.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},c0=function(){function r(t,e,n,i){this.token=t,this.mode=e,this.binaryShiftByteCount=n,this.bitCount=i}return r.prototype.getMode=function(){return this.mode},r.prototype.getToken=function(){return this.token},r.prototype.getBinaryShiftByteCount=function(){return this.binaryShiftByteCount},r.prototype.getBitCount=function(){return this.bitCount},r.prototype.latchAndAppend=function(t,e){var n=this.bitCount,i=this.token;if(t!==this.mode){var o=Cr[this.mode][t];i=Me(i,o&65535,o>>16),n+=o>>16}var a=t===St?4:5;return i=Me(i,e,a),new r(i,t,0,n+a)},r.prototype.shiftAndAppend=function(t,e){var n=this.token,i=this.mode===St?4:5;return n=Me(n,Ir[this.mode][t],i),n=Me(n,e,5),new r(n,this.mode,0,this.bitCount+i+5)},r.prototype.addBinaryShiftChar=function(t){var e=this.token,n=this.mode,i=this.bitCount;if(this.mode===bt||this.mode===St){var o=Cr[n][Gt];e=Me(e,o&65535,o>>16),i+=o>>16,n=Gt}var a=this.binaryShiftByteCount===0||this.binaryShiftByteCount===31?18:this.binaryShiftByteCount===62?9:8,f=new r(e,n,this.binaryShiftByteCount+1,i+a);return f.binaryShiftByteCount===2047+31&&(f=f.endBinaryShift(t+1)),f},r.prototype.endBinaryShift=function(t){if(this.binaryShiftByteCount===0)return this;var e=this.token;return e=Gi(e,t-this.binaryShiftByteCount,this.binaryShiftByteCount),new r(e,this.mode,0,this.bitCount)},r.prototype.isBetterThanOrEqualTo=function(t){var e=this.bitCount+(Cr[this.mode][t.mode]>>16);return this.binaryShiftByteCount<t.binaryShiftByteCount?e+=r.calculateBinaryShiftCost(t)-r.calculateBinaryShiftCost(this):this.binaryShiftByteCount>t.binaryShiftByteCount&&t.binaryShiftByteCount>0&&(e+=10),e<=t.bitCount},r.prototype.toBitArray=function(t){for(var e,n,i=[],o=this.endBinaryShift(t.length).token;o!==null;o=o.getPrevious())i.unshift(o);var a=new it;try{for(var f=u0(i),s=f.next();!s.done;s=f.next()){var u=s.value;u.appendTo(a,t)}}catch(c){e={error:c}}finally{try{s&&!s.done&&(n=f.return)&&n.call(f)}finally{if(e)throw e.error}}return a},r.prototype.toString=function(){return F.format("%s bits=%d bytes=%d",Wi[this.mode],this.bitCount,this.binaryShiftByteCount)},r.calculateBinaryShiftCost=function(t){return t.binaryShiftByteCount>62?21:t.binaryShiftByteCount>31?20:t.binaryShiftByteCount>0?10:0},r.INITIAL_STATE=new r(Xi,Gt,0,0),r}(),Zi=c0;function h0(r){var t=F.getCharCode(" "),e=F.getCharCode("."),n=F.getCharCode(",");r[Gt][t]=1;for(var i=F.getCharCode("Z"),o=F.getCharCode("A"),a=o;a<=i;a++)r[Gt][a]=a-o+2;r[Be][t]=1;for(var f=F.getCharCode("z"),s=F.getCharCode("a"),a=s;a<=f;a++)r[Be][a]=a-s+2;r[St][t]=1;for(var u=F.getCharCode("9"),c=F.getCharCode("0"),a=c;a<=u;a++)r[St][a]=a-c+2;r[St][n]=12,r[St][e]=13;for(var h=["\0"," ","","","","","","","\x07","\b"," ",`
|
|
19
19
|
`,"\v","\f","\r","\x1B","","","","","@","\\","^","_","`","|","~","\x7F"],l=0;l<h.length;l++)r[Er][F.getCharCode(h[l])]=l;for(var d=["\0","\r","\0","\0","\0","\0","!","'","#","$","%","&","'","(",")","*","+",",","-",".","/",":",";","<","=",">","?","[","]","{","}"],l=0;l<d.length;l++)F.getCharCode(d[l])>0&&(r[bt][F.getCharCode(d[l])]=l);return r}var Sr=h0(Y.createInt32Array(5,256));var Or=function(r){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&r[t],n=0;if(e)return e.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},d0=function(){function r(t){this.text=t}return r.prototype.encode=function(){for(var t=F.getCharCode(" "),e=F.getCharCode(`
|
|
20
|
-
`),n=wn.singletonList(Zi.INITIAL_STATE),i=0;i<this.text.length;i++){var o=void 0,a=i+1<this.text.length?this.text[i+1]:0;switch(this.text[i]){case F.getCharCode("\r"):o=a===e?2:0;break;case F.getCharCode("."):o=a===t?3:0;break;case F.getCharCode(","):o=a===t?4:0;break;case F.getCharCode(":"):o=a===t?5:0;break;default:o=0}o>0?(n=r.updateStateListForPair(n,i,o),i++):n=this.updateStateListForChar(n,i)}var f=wn.min(n,function(s,u){return s.getBitCount()-u.getBitCount()});return f.toBitArray(this.text)},r.prototype.updateStateListForChar=function(t,e){var n,i,o=[];try{for(var a=Or(t),f=a.next();!f.done;f=a.next()){var s=f.value;this.updateStateForChar(s,e,o)}}catch(u){n={error:u}}finally{try{f&&!f.done&&(i=a.return)&&i.call(a)}finally{if(n)throw n.error}}return r.simplifyStates(o)},r.prototype.updateStateForChar=function(t,e,n){for(var i=this.text[e]&255,o=Sr[t.getMode()][i]>0,a=null,f=0;f<=bt;f++){var s=Sr[f][i];if(s>0){if(a==null&&(a=t.endBinaryShift(e)),!o||f===t.getMode()||f===St){var u=a.latchAndAppend(f,s);n.push(u)}if(!o&&Ir[t.getMode()][f]>=0){var c=a.shiftAndAppend(f,s);n.push(c)}}}if(t.getBinaryShiftByteCount()>0||Sr[t.getMode()][i]===0){var h=t.addBinaryShiftChar(e);n.push(h)}},r.updateStateListForPair=function(t,e,n){var i,o,a=[];try{for(var f=Or(t),s=f.next();!s.done;s=f.next()){var u=s.value;this.updateStateForPair(u,e,n,a)}}catch(c){i={error:c}}finally{try{s&&!s.done&&(o=f.return)&&o.call(f)}finally{if(i)throw i.error}}return this.simplifyStates(a)},r.updateStateForPair=function(t,e,n,i){var o=t.endBinaryShift(e);if(i.push(o.latchAndAppend(bt,n)),t.getMode()!==bt&&i.push(o.shiftAndAppend(bt,n)),n===3||n===4){var a=o.latchAndAppend(St,16-n).latchAndAppend(St,1);i.push(a)}if(t.getBinaryShiftByteCount()>0){var f=t.addBinaryShiftChar(e).addBinaryShiftChar(e+1);i.push(f)}},r.simplifyStates=function(t){var e,n,i,o,a=[];try{for(var f=Or(t),s=f.next();!s.done;s=f.next()){var u=s.value,c=!0,h=function(g){if(g.isBetterThanOrEqualTo(u))return c=!1,"break";u.isBetterThanOrEqualTo(g)&&(a=a.filter(function(y){return y!==g}))};try{for(var l=(i=void 0,Or(a)),d=l.next();!d.done;d=l.next()){var p=d.value,v=h(p);if(v==="break")break}}catch(g){i={error:g}}finally{try{d&&!d.done&&(o=l.return)&&o.call(l)}finally{if(i)throw i.error}}c&&a.push(u)}}catch(g){e={error:g}}finally{try{s&&!s.done&&(n=f.return)&&n.call(f)}finally{if(e)throw e.error}}return a},r}(),En=d0;var p0=function(r){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&r[t],n=0;if(e)return e.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},v0=function(){function r(){}return r.encodeBytes=function(t){return r.encode(t,r.DEFAULT_EC_PERCENT,r.DEFAULT_AZTEC_LAYERS)},r.encode=function(t,e,n){var i=new En(t).encode(),o=M.truncDivision(i.getSize()*e,100)+11,a=i.getSize()+o,f,s,u,c,h;if(n!==r.DEFAULT_AZTEC_LAYERS){if(f=n<0,s=Math.abs(n),s>(f?r.MAX_NB_BITS_COMPACT:r.MAX_NB_BITS))throw new O(F.format("Illegal value %s for layers",n));u=r.totalBitsInLayer(s,f),c=r.WORD_SIZE[s];var l=u-u%c;if(h=r.stuffBits(i,c),h.getSize()+o>l)throw new O("Data to large for user specified layer");if(f&&h.getSize()>c*64)throw new O("Data to large for user specified layer")}else{c=0,h=null;for(var d=0;;d++){if(d>r.MAX_NB_BITS)throw new O("Data too large for an Aztec code");if(f=d<=3,s=f?d+1:d,u=r.totalBitsInLayer(s,f),!(a>u)){(h==null||c!==r.WORD_SIZE[s])&&(c=r.WORD_SIZE[s],h=r.stuffBits(i,c));var l=u-u%c;if(!(f&&h.getSize()>c*64)&&h.getSize()+o<=l)break}}}var p=r.generateCheckWords(h,u,c),v=h.getSize()/c,g=r.generateModeMessage(f,s,v),y=(f?11:14)+s*4,m=new Int32Array(y),A;if(f){A=y;for(var d=0;d<m.length;d++)m[d]=d}else{A=y+1+2*M.truncDivision(M.truncDivision(y,2)-1,15);for(var _=M.truncDivision(y,2),I=M.truncDivision(A,2),d=0;d<_;d++){var T=d+M.truncDivision(d,15);m[_-d-1]=I-T-1,m[_+d]=I+T+1}}for(var D=new at(A),d=0,b=0;d<s;d++){for(var L=(s-d)*4+(f?9:12),B=0;B<L;B++)for(var vt=B*2,z=0;z<2;z++)p.get(b+vt+z)&&D.set(m[d*2+z],m[d*2+B]),p.get(b+L*2+vt+z)&&D.set(m[d*2+B],m[y-1-d*2-z]),p.get(b+L*4+vt+z)&&D.set(m[y-1-d*2-z],m[y-1-d*2-B]),p.get(b+L*6+vt+z)&&D.set(m[y-1-d*2-B],m[d*2+z]);b+=L*8}if(r.drawModeMessage(D,f,A,g),f)r.drawBullsEye(D,M.truncDivision(A,2),5);else{r.drawBullsEye(D,M.truncDivision(A,2),7);for(var d=0,B=0;d<M.truncDivision(y,2)-1;d+=15,B+=16)for(var z=M.truncDivision(A,2)&1;z<A;z+=2)D.set(M.truncDivision(A,2)-B,z),D.set(M.truncDivision(A,2)+B,z),D.set(z,M.truncDivision(A,2)-B),D.set(z,M.truncDivision(A,2)+B)}var ut=new An;return ut.setCompact(f),ut.setSize(A),ut.setLayers(s),ut.setCodeWords(v),ut.setMatrix(D),ut},r.drawBullsEye=function(t,e,n){for(var i=0;i<n;i+=2)for(var o=e-i;o<=e+i;o++)t.set(o,e-i),t.set(o,e+i),t.set(e-i,o),t.set(e+i,o);t.set(e-n,e-n),t.set(e-n+1,e-n),t.set(e-n,e-n+1),t.set(e+n,e-n),t.set(e+n,e-n+1),t.set(e+n,e+n-1)},r.generateModeMessage=function(t,e,n){var i=new it;return t?(i.appendBits(e-1,2),i.appendBits(n-1,6),i=r.generateCheckWords(i,28,4)):(i.appendBits(e-1,5),i.appendBits(n-1,11),i=r.generateCheckWords(i,40,4)),i},r.drawModeMessage=function(t,e,n,i){var o=M.truncDivision(n,2);if(e)for(var a=0;a<7;a++){var f=o-3+a;i.get(a)&&t.set(f,o-5),i.get(a+7)&&t.set(o+5,f),i.get(20-a)&&t.set(f,o+5),i.get(27-a)&&t.set(o-5,f)}else for(var a=0;a<10;a++){var f=o-5+a+M.truncDivision(a,5);i.get(a)&&t.set(f,o-7),i.get(a+10)&&t.set(o+7,f),i.get(29-a)&&t.set(f,o+7),i.get(39-a)&&t.set(o-7,f)}},r.generateCheckWords=function(t,e,n){var i,o,a=t.getSize()/n,f=new Ke(r.getGF(n)),s=M.truncDivision(e,n),u=r.bitsToWords(t,n,s);f.encode(u,s-a);var c=e%n,h=new it;h.appendBits(0,c);try{for(var l=p0(Array.from(u)),d=l.next();!d.done;d=l.next()){var p=d.value;h.appendBits(p,n)}}catch(v){i={error:v}}finally{try{d&&!d.done&&(o=l.return)&&o.call(l)}finally{if(i)throw i.error}}return h},r.bitsToWords=function(t,e,n){var i=new Int32Array(n),o,a;for(o=0,a=t.getSize()/e;o<a;o++){for(var f=0,s=0;s<e;s++)f|=t.get(o*e+s)?1<<e-s-1:0;i[o]=f}return i},r.getGF=function(t){switch(t){case 4:return dt.AZTEC_PARAM;case 6:return dt.AZTEC_DATA_6;case 8:return dt.AZTEC_DATA_8;case 10:return dt.AZTEC_DATA_10;case 12:return dt.AZTEC_DATA_12;default:throw new O("Unsupported word size "+t)}},r.stuffBits=function(t,e){for(var n=new it,i=t.getSize(),o=(1<<e)-2,a=0;a<i;a+=e){for(var f=0,s=0;s<e;s++)(a+s>=i||t.get(a+s))&&(f|=1<<e-1-s);(f&o)===o?(n.appendBits(f&o,e),a--):f&o?n.appendBits(f,e):(n.appendBits(f|1,e),a--)}return n},r.totalBitsInLayer=function(t,e){return((e?88:112)+16*t)*t},r.DEFAULT_EC_PERCENT=33,r.DEFAULT_AZTEC_LAYERS=0,r.MAX_NB_BITS=32,r.MAX_NB_BITS_COMPACT=4,r.WORD_SIZE=Int32Array.from([4,6,6,8,8,8,8,8,8,10,10,10,10,10,10,10,10,10,10,10,10,10,10,12,12,12,12,12,12,12,12,12,12]),r}(),tr=v0;var hE=function(){function r(){}return r.prototype.encode=function(t,e,n,i){return this.encodeWithHints(t,e,n,i,null)},r.prototype.encodeWithHints=function(t,e,n,i,o){var a=qe.ISO_8859_1,f=tr.DEFAULT_EC_PERCENT,s=tr.DEFAULT_AZTEC_LAYERS;return o!=null&&(o.has(H.CHARACTER_SET)&&(a=ge.forName(o.get(H.CHARACTER_SET).toString())),o.has(H.ERROR_CORRECTION)&&(f=M.parseInt(o.get(H.ERROR_CORRECTION).toString())),o.has(H.AZTEC_LAYERS)&&(s=M.parseInt(o.get(H.AZTEC_LAYERS).toString()))),r.encodeLayers(t,e,n,i,a,f,s)},r.encodeLayers=function(t,e,n,i,o,a,f){if(e!==C.AZTEC)throw new O("Can only encode AZTEC, but got "+e);var s=tr.encode(F.getBytes(t,o),a,f);return r.renderResult(s,n,i)},r.renderResult=function(t,e,n){var i=t.getMatrix();if(i==null)throw new xt;for(var o=i.getWidth(),a=i.getHeight(),f=Math.max(e,o),s=Math.max(n,a),u=Math.min(f/o,s/a),c=(f-o*u)/2,h=(s-a*u)/2,l=new at(f,s),d=0,p=h;d<a;d++,p+=u)for(var v=0,g=c;v<o;v++,g+=u)i.get(v,d)&&l.setRegion(g,p,u,u);return l},r}();var x0=function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(n[o]=i[o])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),ji=function(r){x0(t,r);function t(e){var n=r.call(this,e.width,e.height)||this;return n.canvas=e,n.tempCanvasElement=null,n.buffer=t.makeBufferFromCanvasImageData(e),n}return t.makeBufferFromCanvasImageData=function(e){var n=e.getContext("2d");if(!n)throw new Error("Couldn't get canvas context.");var i=n.getImageData(0,0,e.width,e.height);return t.toGrayscaleBuffer(i.data,e.width,e.height)},t.toGrayscaleBuffer=function(e,n,i){for(var o=new Uint8ClampedArray(n*i),a=0,f=0,s=e.length;a<s;a+=4,f++){var u=void 0,c=e[a+3];if(c===0)u=255;else{var h=e[a],l=e[a+1],d=e[a+2];u=306*h+601*l+117*d+512>>10}o[f]=u}return o},t.prototype.getRow=function(e,n){if(e<0||e>=this.getHeight())throw new O("Requested row is outside the image: "+e);var i=this.getWidth(),o=e*i;return n===null?n=this.buffer.slice(o,o+i):(n.length<i&&(n=new Uint8ClampedArray(i)),n.set(this.buffer.slice(o,o+i))),n},t.prototype.getMatrix=function(){return this.buffer},t.prototype.isCropSupported=function(){return!0},t.prototype.crop=function(e,n,i,o){return r.prototype.crop.call(this,e,n,i,o),this},t.prototype.isRotateSupported=function(){return!0},t.prototype.rotateCounterClockwise=function(){return this.rotate(-90),this},t.prototype.rotateCounterClockwise45=function(){return this.rotate(-45),this},t.prototype.invert=function(){return new zt(this)},t.prototype.getTempCanvasElement=function(){if(this.tempCanvasElement===null){var e=this.canvas.ownerDocument.createElement("canvas");e.width=this.canvas.width,e.height=this.canvas.height,this.tempCanvasElement=e}return this.tempCanvasElement},t.prototype.rotate=function(e){var n=this.getTempCanvasElement();if(!n)throw new Error("Could not create a Canvas element.");var i=e*t.DEGREE_TO_RADIANS,o=this.canvas.width,a=this.canvas.height,f=Math.ceil(Math.abs(Math.cos(i))*o+Math.abs(Math.sin(i))*a),s=Math.ceil(Math.abs(Math.sin(i))*o+Math.abs(Math.cos(i))*a);n.width=f,n.height=s;var u=n.getContext("2d");if(!u)throw new Error("Could not create a Canvas Context element.");return u.translate(f/2,s/2),u.rotate(i),u.drawImage(this.canvas,o/-2,a/-2),this.buffer=t.makeBufferFromCanvasImageData(n),this},t.DEGREE_TO_RADIANS=Math.PI/180,t}(Ht);function _n(){return typeof navigator<"u"}function g0(){return _n()&&!!navigator.mediaDevices}function Yi(){return!!(g0()&&navigator.mediaDevices.enumerateDevices)}var Fe=function(){return Fe=Object.assign||function(r){for(var t,e=1,n=arguments.length;e<n;e++){t=arguments[e];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(r[i]=t[i])}return r},Fe.apply(this,arguments)},ht=function(r,t,e,n){function i(o){return o instanceof e?o:new e(function(a){a(o)})}return new(e||(e=Promise))(function(o,a){function f(c){try{u(n.next(c))}catch(h){a(h)}}function s(c){try{u(n.throw(c))}catch(h){a(h)}}function u(c){c.done?o(c.value):i(c.value).then(f,s)}u((n=n.apply(r,t||[])).next())})},lt=function(r,t){var e={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},n,i,o,a;return a={next:f(0),throw:f(1),return:f(2)},typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function f(u){return function(c){return s([u,c])}}function s(u){if(n)throw new TypeError("Generator is already executing.");for(;e;)try{if(n=1,i&&(o=u[0]&2?i.return:u[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,u[1])).done)return o;switch(i=0,o&&(u=[u[0]&2,o.value]),u[0]){case 0:case 1:o=u;break;case 4:return e.label++,{value:u[1],done:!1};case 5:e.label++,i=u[1],u=[0];continue;case 7:u=e.ops.pop(),e.trys.pop();continue;default:if(o=e.trys,!(o=o.length>0&&o[o.length-1])&&(u[0]===6||u[0]===2)){e=0;continue}if(u[0]===3&&(!o||u[1]>o[0]&&u[1]<o[3])){e.label=u[1];break}if(u[0]===6&&e.label<o[1]){e.label=o[1],o=u;break}if(o&&e.label<o[2]){e.label=o[2],e.ops.push(u);break}o[2]&&e.ops.pop(),e.trys.pop();continue}u=t.call(r,e)}catch(c){u=[6,c],i=0}finally{n=o=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}},Cn=function(r){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&r[t],n=0;if(e)return e.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},m0={delayBetweenScanAttempts:500,delayBetweenScanSuccess:500,tryPlayVideoTimeout:5e3},Ut=function(){function r(t,e,n){e===void 0&&(e=new Map),n===void 0&&(n={}),this.reader=t,this.hints=e,this.options=Fe(Fe({},m0),n)}return Object.defineProperty(r.prototype,"possibleFormats",{set:function(t){this.hints.set(U.POSSIBLE_FORMATS,t)},enumerable:!1,configurable:!0}),r.addVideoSource=function(t,e){try{t.srcObject=e}catch{console.error("got interrupted by new loading request")}},r.mediaStreamSetTorch=function(t,e){return ht(this,void 0,void 0,function(){return lt(this,function(n){switch(n.label){case 0:return[4,t.applyConstraints({advanced:[{fillLightMode:e?"flash":"off",torch:!!e}]})];case 1:return n.sent(),[2]}})})},r.mediaStreamIsTorchCompatible=function(t){var e,n,i=t.getVideoTracks();try{for(var o=Cn(i),a=o.next();!a.done;a=o.next()){var f=a.value;if(r.mediaStreamIsTorchCompatibleTrack(f))return!0}}catch(s){e={error:s}}finally{try{a&&!a.done&&(n=o.return)&&n.call(o)}finally{if(e)throw e.error}}return!1},r.mediaStreamIsTorchCompatibleTrack=function(t){try{var e=t.getCapabilities();return"torch"in e}catch(n){return console.error(n),console.warn("Your browser may be not fully compatible with WebRTC and/or ImageCapture specs. Torch will not be available."),!1}},r.isVideoPlaying=function(t){return t.currentTime>0&&!t.paused&&t.readyState>2},r.getMediaElement=function(t,e){var n=document.getElementById(t);if(!n)throw new st("element with id '".concat(t,"' not found"));if(n.nodeName.toLowerCase()!==e.toLowerCase())throw new st("element with id '".concat(t,"' must be an ").concat(e," element"));return n},r.createVideoElement=function(t){if(t instanceof HTMLVideoElement)return t;if(typeof t=="string")return r.getMediaElement(t,"video");if(!t&&typeof document<"u"){var e=document.createElement("video");return e.width=200,e.height=200,e}throw new Error("Couldn't get videoElement from videoSource!")},r.prepareImageElement=function(t){if(t instanceof HTMLImageElement)return t;if(typeof t=="string")return r.getMediaElement(t,"img");if(typeof t>"u"){var e=document.createElement("img");return e.width=200,e.height=200,e}throw new Error("Couldn't get imageElement from imageSource!")},r.prepareVideoElement=function(t){var e=r.createVideoElement(t);return e.setAttribute("autoplay","true"),e.setAttribute("muted","true"),e.setAttribute("playsinline","true"),e},r.isImageLoaded=function(t){return!(!t.complete||t.naturalWidth===0)},r.createBinaryBitmapFromCanvas=function(t){var e=new ji(t),n=new ke(e);return new Le(n)},r.drawImageOnCanvas=function(t,e){t.drawImage(e,0,0)},r.getMediaElementDimensions=function(t){if(t instanceof HTMLVideoElement)return{height:t.videoHeight,width:t.videoWidth};if(t instanceof HTMLImageElement)return{height:t.naturalHeight||t.height,width:t.naturalWidth||t.width};throw new Error("Couldn't find the Source's dimensions!")},r.createCaptureCanvas=function(t){if(!t)throw new st("Cannot create a capture canvas without a media element.");if(typeof document>"u")throw new Error(`The page "Document" is undefined, make sure you're running in a browser.`);var e=document.createElement("canvas"),n=r.getMediaElementDimensions(t),i=n.width,o=n.height;return e.style.width=i+"px",e.style.height=o+"px",e.width=i,e.height=o,e},r.tryPlayVideo=function(t){return ht(this,void 0,void 0,function(){var e;return lt(this,function(n){switch(n.label){case 0:if(t?.ended)return console.error("Trying to play video that has ended."),[2,!1];if(r.isVideoPlaying(t))return console.warn("Trying to play video that is already playing."),[2,!0];n.label=1;case 1:return n.trys.push([1,3,,4]),[4,t.play()];case 2:return n.sent(),[2,!0];case 3:return e=n.sent(),console.warn("It was not possible to play the video.",e),[2,!1];case 4:return[2]}})})},r.createCanvasFromMediaElement=function(t){var e=r.createCaptureCanvas(t),n=e.getContext("2d");if(!n)throw new Error("Couldn't find Canvas 2D Context.");return r.drawImageOnCanvas(n,t),e},r.createBinaryBitmapFromMediaElem=function(t){var e=r.createCanvasFromMediaElement(t);return r.createBinaryBitmapFromCanvas(e)},r.destroyImageElement=function(t){t.src="",t.removeAttribute("src"),t=void 0},r.listVideoInputDevices=function(){return ht(this,void 0,void 0,function(){var t,e,n,i,o,a,f,s,u,c,h,l;return lt(this,function(d){switch(d.label){case 0:if(!_n())throw new Error("Can't enumerate devices, navigator is not present.");if(!Yi())throw new Error("Can't enumerate devices, method not supported.");return[4,navigator.mediaDevices.enumerateDevices()];case 1:t=d.sent(),e=[];try{for(n=Cn(t),i=n.next();!i.done;i=n.next())o=i.value,a=o.kind==="video"?"videoinput":o.kind,a==="videoinput"&&(f=o.deviceId||o.id,s=o.label||"Video device ".concat(e.length+1),u=o.groupId,c={deviceId:f,label:s,kind:a,groupId:u},e.push(c))}catch(p){h={error:p}}finally{try{i&&!i.done&&(l=n.return)&&l.call(n)}finally{if(h)throw h.error}}return[2,e]}})})},r.findDeviceById=function(t){return ht(this,void 0,void 0,function(){var e;return lt(this,function(n){switch(n.label){case 0:return[4,r.listVideoInputDevices()];case 1:return e=n.sent(),e?[2,e.find(function(i){return i.deviceId===t})]:[2]}})})},r.cleanVideoSource=function(t){if(t){try{t.srcObject=null}catch{t.src=""}t&&t.removeAttribute("src")}},r.releaseAllStreams=function(){r.streamTracker.length!==0&&r.streamTracker.forEach(function(t){t.getTracks().forEach(function(e){return e.stop()})}),r.streamTracker=[]},r.playVideoOnLoadAsync=function(t,e){return ht(this,void 0,void 0,function(){var n;return lt(this,function(i){switch(i.label){case 0:return[4,r.tryPlayVideo(t)];case 1:return n=i.sent(),n?[2,!0]:[2,new Promise(function(o,a){var f=setTimeout(function(){r.isVideoPlaying(t)||(a(!1),t.removeEventListener("canplay",s))},e),s=function(){r.tryPlayVideo(t).then(function(u){clearTimeout(f),t.removeEventListener("canplay",s),o(u)})};t.addEventListener("canplay",s)})]}})})},r.attachStreamToVideo=function(t,e,n){return n===void 0&&(n=5e3),ht(this,void 0,void 0,function(){var i;return lt(this,function(o){switch(o.label){case 0:return i=r.prepareVideoElement(e),r.addVideoSource(i,t),[4,r.playVideoOnLoadAsync(i,n)];case 1:return o.sent(),[2,i]}})})},r._waitImageLoad=function(t){return new Promise(function(e,n){var i=1e4,o=setTimeout(function(){r.isImageLoaded(t)||(t.removeEventListener("load",a),n())},i),a=function(){clearTimeout(o),t.removeEventListener("load",a),e()};t.addEventListener("load",a)})},r.checkCallbackFnOrThrow=function(t){if(!t)throw new st("`callbackFn` is a required parameter, you cannot capture results without it.")},r.disposeMediaStream=function(t){t.getVideoTracks().forEach(function(e){return e.stop()}),t=void 0},r.prototype.decode=function(t){var e=r.createCanvasFromMediaElement(t);return this.decodeFromCanvas(e)},r.prototype.decodeBitmap=function(t){return this.reader.decode(t,this.hints)},r.prototype.decodeFromCanvas=function(t){var e=r.createBinaryBitmapFromCanvas(t);return this.decodeBitmap(e)},r.prototype.decodeFromImageElement=function(t){return ht(this,void 0,void 0,function(){var e;return lt(this,function(n){switch(n.label){case 0:if(!t)throw new st("An image element must be provided.");return e=r.prepareImageElement(t),[4,this._decodeOnLoadImage(e)];case 1:return[2,n.sent()]}})})},r.prototype.decodeFromImageUrl=function(t){return ht(this,void 0,void 0,function(){var e;return lt(this,function(n){switch(n.label){case 0:if(!t)throw new st("An URL must be provided.");e=r.prepareImageElement(),e.src=t,n.label=1;case 1:return n.trys.push([1,,3,4]),[4,this.decodeFromImageElement(e)];case 2:return[2,n.sent()];case 3:return r.destroyImageElement(e),[7];case 4:return[2]}})})},r.prototype.decodeFromConstraints=function(t,e,n){return ht(this,void 0,void 0,function(){var i,o;return lt(this,function(a){switch(a.label){case 0:return r.checkCallbackFnOrThrow(n),[4,this.getUserMedia(t)];case 1:i=a.sent(),a.label=2;case 2:return a.trys.push([2,4,,5]),[4,this.decodeFromStream(i,e,n)];case 3:return[2,a.sent()];case 4:throw o=a.sent(),r.disposeMediaStream(i),o;case 5:return[2]}})})},r.prototype.decodeFromStream=function(t,e,n){return ht(this,void 0,void 0,function(){var i,o,a,f,s,u,c,h,l,d=this;return lt(this,function(p){switch(p.label){case 0:return r.checkCallbackFnOrThrow(n),i=this.options.tryPlayVideoTimeout,[4,r.attachStreamToVideo(t,e,i)];case 1:return o=p.sent(),a=function(){r.disposeMediaStream(t),r.cleanVideoSource(o)},f=this.scan(o,n,a),s=t.getVideoTracks(),u=Fe(Fe({},f),{stop:function(){f.stop()},streamVideoConstraintsApply:function(v,g){return ht(this,void 0,void 0,function(){var y,m,A,_,I,T,D;return lt(this,function(b){switch(b.label){case 0:y=g?s.filter(g):s,b.label=1;case 1:b.trys.push([1,6,7,8]),m=Cn(y),A=m.next(),b.label=2;case 2:return A.done?[3,5]:(_=A.value,[4,_.applyConstraints(v)]);case 3:b.sent(),b.label=4;case 4:return A=m.next(),[3,2];case 5:return[3,8];case 6:return I=b.sent(),T={error:I},[3,8];case 7:try{A&&!A.done&&(D=m.return)&&D.call(m)}finally{if(T)throw T.error}return[7];case 8:return[2]}})})},streamVideoConstraintsGet:function(v){return s.find(v).getConstraints()},streamVideoSettingsGet:function(v){return s.find(v).getSettings()},streamVideoCapabilitiesGet:function(v){return s.find(v).getCapabilities()}}),c=r.mediaStreamIsTorchCompatible(t),c&&(h=s?.find(function(v){return r.mediaStreamIsTorchCompatibleTrack(v)}),l=function(v){return ht(d,void 0,void 0,function(){return lt(this,function(g){switch(g.label){case 0:return[4,r.mediaStreamSetTorch(h,v)];case 1:return g.sent(),[2]}})})},u.switchTorch=l,u.stop=function(){return ht(d,void 0,void 0,function(){return lt(this,function(v){switch(v.label){case 0:return f.stop(),[4,l(!1)];case 1:return v.sent(),[2]}})})}),[2,u]}})})},r.prototype.decodeFromVideoDevice=function(t,e,n){return ht(this,void 0,void 0,function(){var i,o;return lt(this,function(a){switch(a.label){case 0:return r.checkCallbackFnOrThrow(n),t?i={deviceId:{exact:t}}:i={facingMode:"environment"},o={video:i},[4,this.decodeFromConstraints(o,e,n)];case 1:return[2,a.sent()]}})})},r.prototype.decodeFromVideoElement=function(t,e){return ht(this,void 0,void 0,function(){var n,i;return lt(this,function(o){switch(o.label){case 0:if(r.checkCallbackFnOrThrow(e),!t)throw new st("A video element must be provided.");return n=r.prepareVideoElement(t),i=this.options.tryPlayVideoTimeout,[4,r.playVideoOnLoadAsync(n,i)];case 1:return o.sent(),[2,this.scan(n,e)]}})})},r.prototype.decodeFromVideoUrl=function(t,e){return ht(this,void 0,void 0,function(){var n,i,o,a;return lt(this,function(f){switch(f.label){case 0:if(r.checkCallbackFnOrThrow(e),!t)throw new st("An URL must be provided.");return n=r.prepareVideoElement(),n.src=t,i=function(){r.cleanVideoSource(n)},o=this.options.tryPlayVideoTimeout,[4,r.playVideoOnLoadAsync(n,o)];case 1:return f.sent(),a=this.scan(n,e,i),[2,a]}})})},r.prototype.decodeOnceFromConstraints=function(t,e){return ht(this,void 0,void 0,function(){var n;return lt(this,function(i){switch(i.label){case 0:return[4,this.getUserMedia(t)];case 1:return n=i.sent(),[4,this.decodeOnceFromStream(n,e)];case 2:return[2,i.sent()]}})})},r.prototype.decodeOnceFromStream=function(t,e){return ht(this,void 0,void 0,function(){var n,i,o;return lt(this,function(a){switch(a.label){case 0:return n=!!e,[4,r.attachStreamToVideo(t,e)];case 1:i=a.sent(),a.label=2;case 2:return a.trys.push([2,,4,5]),[4,this.scanOneResult(i)];case 3:return o=a.sent(),[2,o];case 4:return n||r.cleanVideoSource(i),[7];case 5:return[2]}})})},r.prototype.decodeOnceFromVideoDevice=function(t,e){return ht(this,void 0,void 0,function(){var n,i;return lt(this,function(o){switch(o.label){case 0:return t?n={deviceId:{exact:t}}:n={facingMode:"environment"},i={video:n},[4,this.decodeOnceFromConstraints(i,e)];case 1:return[2,o.sent()]}})})},r.prototype.decodeOnceFromVideoElement=function(t){return ht(this,void 0,void 0,function(){var e,n;return lt(this,function(i){switch(i.label){case 0:if(!t)throw new st("A video element must be provided.");return e=r.prepareVideoElement(t),n=this.options.tryPlayVideoTimeout,[4,r.playVideoOnLoadAsync(e,n)];case 1:return i.sent(),[4,this.scanOneResult(e)];case 2:return[2,i.sent()]}})})},r.prototype.decodeOnceFromVideoUrl=function(t){return ht(this,void 0,void 0,function(){var e,n;return lt(this,function(i){switch(i.label){case 0:if(!t)throw new st("An URL must be provided.");e=r.prepareVideoElement(),e.src=t,n=this.decodeOnceFromVideoElement(e),i.label=1;case 1:return i.trys.push([1,,3,4]),[4,n];case 2:return[2,i.sent()];case 3:return r.cleanVideoSource(e),[7];case 4:return[2]}})})},r.prototype.scanOneResult=function(t,e,n,i){var o=this;return e===void 0&&(e=!0),n===void 0&&(n=!0),i===void 0&&(i=!0),new Promise(function(a,f){o.scan(t,function(s,u,c){if(s){a(s),c.stop();return}if(u){if(u instanceof w&&e||u instanceof j&&n||u instanceof S&&i)return;c.stop(),f(u)}})})},r.prototype.scan=function(t,e,n){var i=this;r.checkCallbackFnOrThrow(e);var o=r.createCaptureCanvas(t),a=o.getContext("2d");if(!a)throw new Error("Couldn't create canvas for visual element scan.");var f=function(){a=void 0,o=void 0},s=!1,u,c=function(){s=!0,clearTimeout(u),f(),n&&n()},h={stop:c},l=function(){if(!s)try{r.drawImageOnCanvas(a,t);var d=i.decodeFromCanvas(o);e(d,void 0,h),u=setTimeout(l,i.options.delayBetweenScanSuccess)}catch(y){e(void 0,y,h);var p=y instanceof j,v=y instanceof S,g=y instanceof w;if(p||v||g){u=setTimeout(l,i.options.delayBetweenScanAttempts);return}f(),n&&n(y)}};return l(),h},r.prototype._decodeOnLoadImage=function(t){return ht(this,void 0,void 0,function(){var e;return lt(this,function(n){switch(n.label){case 0:return e=r.isImageLoaded(t),e?[3,2]:[4,r._waitImageLoad(t)];case 1:n.sent(),n.label=2;case 2:return[2,this.decode(t)]}})})},r.prototype.getUserMedia=function(t){return ht(this,void 0,void 0,function(){var e;return lt(this,function(n){switch(n.label){case 0:return[4,navigator.mediaDevices.getUserMedia(t)];case 1:return e=n.sent(),r.streamTracker.push(e),[2,e]}})})},r.streamTracker=[],r}();var y0=function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(n[o]=i[o])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),y8=function(r){y0(t,r);function t(e,n){return r.call(this,new te,e,n)||this}return t}(Ut);var A0=function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(n[o]=i[o])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),_8=function(r){A0(t,r);function t(e,n){return r.call(this,new Xt(e),e,n)||this}return t}(Ut);var w0=function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(n[o]=i[o])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),O8=function(r){w0(t,r);function t(e,n){return r.call(this,new oe,e,n)||this}return t}(Ut);var E0=function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(n[o]=i[o])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),Ki=function(r){E0(t,r);function t(e,n){var i=this,o=new Ye;return o.setHints(e),i=r.call(this,o,e,n)||this,i.reader=o,i}return Object.defineProperty(t.prototype,"possibleFormats",{set:function(e){this.hints.set(U.POSSIBLE_FORMATS,e),this.reader.setHints(this.hints)},enumerable:!1,configurable:!0}),t.prototype.decodeBitmap=function(e){return this.reader.decodeWithState(e)},t.prototype.setHints=function(e){this.hints=e,this.reader.setHints(this.hints)},t}(Ut);var _0=function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(n[o]=i[o])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),M8=function(r){_0(t,r);function t(e,n){return r.call(this,new se,e,n)||this}return t}(Ut);var C0=function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(n[o]=i[o])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),k8=function(r){C0(t,r);function t(e,n){return r.call(this,new ae,e,n)||this}return t}(Ut);var Jt="http://www.w3.org/2000/svg",V8=function(){function r(t){if(typeof t=="string"){var e=document.getElementById(t);if(!e)throw new Error("Could not find a Container element with '".concat(t,"'."));this.containerElement=e}else this.containerElement=t}return r.prototype.write=function(t,e,n,i){if(t.length===0)throw new O("Found empty contents");if(e<0||n<0)throw new O("Requested dimensions are too small: "+e+"x"+n);var o=i&&i.get(H.MARGIN)!==void 0?Number.parseInt(i.get(H.MARGIN).toString(),10):r.QUIET_ZONE_SIZE,a=this.encode(i,t);return this.renderResult(a,e,n,o)},r.prototype.createSVGElement=function(t,e){var n=document.createElementNS(r.SVG_NS,"svg");return n.setAttributeNS(Jt,"width",e.toString()),n.setAttributeNS(Jt,"height",t.toString()),n},r.prototype.createSvgPathPlaceholderElement=function(t,e){var n=document.createElementNS(r.SVG_NS,"path");return n.setAttributeNS(Jt,"d","M0 0h".concat(t,"v").concat(e,"H0z")),n.setAttributeNS(Jt,"fill","none"),n},r.prototype.createSvgRectElement=function(t,e,n,i){var o=document.createElementNS(r.SVG_NS,"rect");return o.setAttributeNS(Jt,"x",t.toString()),o.setAttributeNS(Jt,"y",e.toString()),o.setAttributeNS(Jt,"height",n.toString()),o.setAttributeNS(Jt,"width",i.toString()),o.setAttributeNS(Jt,"fill","#000000"),o},r.prototype.encode=function(t,e){var n=Nt.L;if(t&&t.get(H.ERROR_CORRECTION)!==void 0){var i=t.get(H.ERROR_CORRECTION).toString();n=Nt.fromString(i)}var o=qt.encode(e,n,t);return o},r.prototype.renderResult=function(t,e,n,i){var o=t.getMatrix();if(o===null)throw new xt;var a=o.getWidth(),f=o.getHeight(),s=a+i*2,u=f+i*2,c=Math.max(e,s),h=Math.max(n,u),l=Math.min(Math.floor(c/s),Math.floor(h/u)),d=Math.floor((c-a*l)/2),p=Math.floor((h-f*l)/2),v=this.createSVGElement(c,h),g=this.createSvgPathPlaceholderElement(e,n);v.appendChild(g),this.containerElement.appendChild(v);for(var y=0,m=p;y<f;y++,m+=l)for(var A=0,_=d;A<a;A++,_+=l)if(o.get(A,y)===1){var I=this.createSvgRectElement(_,m,l,l);v.appendChild(I)}return v},r.QUIET_ZONE_SIZE=4,r.SVG_NS="http://www.w3.org/2000/svg",r}();var Qi="http://www.w3.org/2000/svg",X8=function(){function r(){}return r.prototype.write=function(t,e,n,i){if(t.length===0)throw new O("Found empty contents");if(e<0||n<0)throw new O("Requested dimensions are too small: "+e+"x"+n);var o=Nt.L,a=r.QUIET_ZONE_SIZE;if(i){if(i.get(H.ERROR_CORRECTION)!==void 0){var f=i.get(H.ERROR_CORRECTION).toString();o=Nt.fromString(f)}i.get(H.MARGIN)!==void 0&&(a=Number.parseInt(i.get(H.MARGIN).toString(),10))}var s=qt.encode(t,o,i);return this.renderResult(s,e,n,a)},r.prototype.writeToDom=function(t,e,n,i,o){if(typeof t=="string"){var a=document.querySelector(t);if(!a)throw new Error("Could no find the target HTML element.");t=a}var f=this.write(e,n,i,o);t instanceof HTMLElement&&t.appendChild(f)},r.prototype.renderResult=function(t,e,n,i){var o=t.getMatrix();if(o===null)throw new xt;for(var a=o.getWidth(),f=o.getHeight(),s=a+i*2,u=f+i*2,c=Math.max(e,s),h=Math.max(n,u),l=Math.min(Math.floor(c/s),Math.floor(h/u)),d=Math.floor((c-a*l)/2),p=Math.floor((h-f*l)/2),v=this.createSVGElement(c,h),g=0,y=p;g<f;g++,y+=l)for(var m=0,A=d;m<a;m++,A+=l)if(o.get(m,g)===1){var _=this.createSvgRectElement(A,y,l,l);v.appendChild(_)}return v},r.prototype.createSVGElement=function(t,e){var n=document.createElementNS(Qi,"svg"),i=t.toString(),o=e.toString();return n.setAttribute("height",o),n.setAttribute("width",i),n.setAttribute("viewBox","0 0 "+i+" "+o),n},r.prototype.createSvgRectElement=function(t,e,n,i){var o=document.createElementNS(Qi,"rect");return o.setAttribute("x",t.toString()),o.setAttribute("y",e.toString()),o.setAttribute("height",n.toString()),o.setAttribute("width",i.toString()),o.setAttribute("fill","#000000"),o},r.QUIET_ZONE_SIZE=4,r}();var In={[C.AZTEC]:"aztec",[C.CODABAR]:"codabar",[C.CODE_39]:"code_39",[C.CODE_93]:"code_93",[C.CODE_128]:"code_128",[C.DATA_MATRIX]:"data_matrix",[C.EAN_8]:"ean_8",[C.EAN_13]:"ean_13",[C.ITF]:"itf",[C.PDF_417]:"pdf417",[C.QR_CODE]:"qr_code",[C.UPC_A]:"upc_a",[C.UPC_E]:"upc_e",[C.UPC_EAN_EXTENSION]:"unknown",[C.MAXICODE]:"unknown",[C.RSS_14]:"unknown",[C.RSS_EXPANDED]:"unknown"},Sn={aztec:C.AZTEC,codabar:C.CODABAR,code_39:C.CODE_39,code_93:C.CODE_93,code_128:C.CODE_128,data_matrix:C.DATA_MATRIX,ean_8:C.EAN_8,ean_13:C.EAN_13,itf:C.ITF,pdf417:C.PDF_417,qr_code:C.QR_CODE,upc_a:C.UPC_A,upc_e:C.UPC_E};var Tr=class{reader;constructor(t){let e=new Map([[U.TRY_HARDER,!0],[U.POSSIBLE_FORMATS,t?t.formats.map(n=>Sn[n]):Object.values(Sn)]]);this.reader=new Ki(e)}static getSupportedFormats(){return Promise.resolve(Object.values(In))}async detect(t){try{let e;if(t instanceof HTMLVideoElement||t instanceof HTMLImageElement)e=await this.reader.scanOneResult(t,!1);else if(t instanceof HTMLCanvasElement)e=this.reader.decodeFromCanvas(t);else if(t instanceof Blob){let n=await this.blobToImage(t);e=await this.reader.scanOneResult(n,!1)}else if(t instanceof ImageBitmap)e=this.reader.decodeFromCanvas(this.imageBitmapToCanvas(t));else throw new TypeError("Image source is not supported");return[{rawValue:e.getText(),format:In[e.getBarcodeFormat()],boundingBox:new DOMRectReadOnly,cornerPoints:e.getResultPoints().map(n=>({x:n.getX(),y:n.getY()}))}]}catch(e){if(e&&!(e instanceof w))throw e;return[]}}async blobToImage(t){return new Promise((e,n)=>{let i=URL.createObjectURL(t),o=new Image;o.onload=()=>{URL.revokeObjectURL(i),e(o)},o.onerror=()=>n(),o.src=i})}imageBitmapToCanvas(t){let e=document.createElement("canvas"),n=e.getContext("2d");return n&&n.drawImage(t,t.width,t.height),e}};"BarcodeDetector"in window||(window.BarcodeDetector=Tr);})();
|
|
20
|
+
`),n=wn.singletonList(Zi.INITIAL_STATE),i=0;i<this.text.length;i++){var o=void 0,a=i+1<this.text.length?this.text[i+1]:0;switch(this.text[i]){case F.getCharCode("\r"):o=a===e?2:0;break;case F.getCharCode("."):o=a===t?3:0;break;case F.getCharCode(","):o=a===t?4:0;break;case F.getCharCode(":"):o=a===t?5:0;break;default:o=0}o>0?(n=r.updateStateListForPair(n,i,o),i++):n=this.updateStateListForChar(n,i)}var f=wn.min(n,function(s,u){return s.getBitCount()-u.getBitCount()});return f.toBitArray(this.text)},r.prototype.updateStateListForChar=function(t,e){var n,i,o=[];try{for(var a=Or(t),f=a.next();!f.done;f=a.next()){var s=f.value;this.updateStateForChar(s,e,o)}}catch(u){n={error:u}}finally{try{f&&!f.done&&(i=a.return)&&i.call(a)}finally{if(n)throw n.error}}return r.simplifyStates(o)},r.prototype.updateStateForChar=function(t,e,n){for(var i=this.text[e]&255,o=Sr[t.getMode()][i]>0,a=null,f=0;f<=bt;f++){var s=Sr[f][i];if(s>0){if(a==null&&(a=t.endBinaryShift(e)),!o||f===t.getMode()||f===St){var u=a.latchAndAppend(f,s);n.push(u)}if(!o&&Ir[t.getMode()][f]>=0){var c=a.shiftAndAppend(f,s);n.push(c)}}}if(t.getBinaryShiftByteCount()>0||Sr[t.getMode()][i]===0){var h=t.addBinaryShiftChar(e);n.push(h)}},r.updateStateListForPair=function(t,e,n){var i,o,a=[];try{for(var f=Or(t),s=f.next();!s.done;s=f.next()){var u=s.value;this.updateStateForPair(u,e,n,a)}}catch(c){i={error:c}}finally{try{s&&!s.done&&(o=f.return)&&o.call(f)}finally{if(i)throw i.error}}return this.simplifyStates(a)},r.updateStateForPair=function(t,e,n,i){var o=t.endBinaryShift(e);if(i.push(o.latchAndAppend(bt,n)),t.getMode()!==bt&&i.push(o.shiftAndAppend(bt,n)),n===3||n===4){var a=o.latchAndAppend(St,16-n).latchAndAppend(St,1);i.push(a)}if(t.getBinaryShiftByteCount()>0){var f=t.addBinaryShiftChar(e).addBinaryShiftChar(e+1);i.push(f)}},r.simplifyStates=function(t){var e,n,i,o,a=[];try{for(var f=Or(t),s=f.next();!s.done;s=f.next()){var u=s.value,c=!0,h=function(g){if(g.isBetterThanOrEqualTo(u))return c=!1,"break";u.isBetterThanOrEqualTo(g)&&(a=a.filter(function(y){return y!==g}))};try{for(var l=(i=void 0,Or(a)),d=l.next();!d.done;d=l.next()){var p=d.value,v=h(p);if(v==="break")break}}catch(g){i={error:g}}finally{try{d&&!d.done&&(o=l.return)&&o.call(l)}finally{if(i)throw i.error}}c&&a.push(u)}}catch(g){e={error:g}}finally{try{s&&!s.done&&(n=f.return)&&n.call(f)}finally{if(e)throw e.error}}return a},r}(),En=d0;var p0=function(r){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&r[t],n=0;if(e)return e.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},v0=function(){function r(){}return r.encodeBytes=function(t){return r.encode(t,r.DEFAULT_EC_PERCENT,r.DEFAULT_AZTEC_LAYERS)},r.encode=function(t,e,n){var i=new En(t).encode(),o=M.truncDivision(i.getSize()*e,100)+11,a=i.getSize()+o,f,s,u,c,h;if(n!==r.DEFAULT_AZTEC_LAYERS){if(f=n<0,s=Math.abs(n),s>(f?r.MAX_NB_BITS_COMPACT:r.MAX_NB_BITS))throw new O(F.format("Illegal value %s for layers",n));u=r.totalBitsInLayer(s,f),c=r.WORD_SIZE[s];var l=u-u%c;if(h=r.stuffBits(i,c),h.getSize()+o>l)throw new O("Data to large for user specified layer");if(f&&h.getSize()>c*64)throw new O("Data to large for user specified layer")}else{c=0,h=null;for(var d=0;;d++){if(d>r.MAX_NB_BITS)throw new O("Data too large for an Aztec code");if(f=d<=3,s=f?d+1:d,u=r.totalBitsInLayer(s,f),!(a>u)){(h==null||c!==r.WORD_SIZE[s])&&(c=r.WORD_SIZE[s],h=r.stuffBits(i,c));var l=u-u%c;if(!(f&&h.getSize()>c*64)&&h.getSize()+o<=l)break}}}var p=r.generateCheckWords(h,u,c),v=h.getSize()/c,g=r.generateModeMessage(f,s,v),y=(f?11:14)+s*4,m=new Int32Array(y),A;if(f){A=y;for(var d=0;d<m.length;d++)m[d]=d}else{A=y+1+2*M.truncDivision(M.truncDivision(y,2)-1,15);for(var _=M.truncDivision(y,2),I=M.truncDivision(A,2),d=0;d<_;d++){var T=d+M.truncDivision(d,15);m[_-d-1]=I-T-1,m[_+d]=I+T+1}}for(var D=new at(A),d=0,b=0;d<s;d++){for(var L=(s-d)*4+(f?9:12),B=0;B<L;B++)for(var vt=B*2,z=0;z<2;z++)p.get(b+vt+z)&&D.set(m[d*2+z],m[d*2+B]),p.get(b+L*2+vt+z)&&D.set(m[d*2+B],m[y-1-d*2-z]),p.get(b+L*4+vt+z)&&D.set(m[y-1-d*2-z],m[y-1-d*2-B]),p.get(b+L*6+vt+z)&&D.set(m[y-1-d*2-B],m[d*2+z]);b+=L*8}if(r.drawModeMessage(D,f,A,g),f)r.drawBullsEye(D,M.truncDivision(A,2),5);else{r.drawBullsEye(D,M.truncDivision(A,2),7);for(var d=0,B=0;d<M.truncDivision(y,2)-1;d+=15,B+=16)for(var z=M.truncDivision(A,2)&1;z<A;z+=2)D.set(M.truncDivision(A,2)-B,z),D.set(M.truncDivision(A,2)+B,z),D.set(z,M.truncDivision(A,2)-B),D.set(z,M.truncDivision(A,2)+B)}var ut=new An;return ut.setCompact(f),ut.setSize(A),ut.setLayers(s),ut.setCodeWords(v),ut.setMatrix(D),ut},r.drawBullsEye=function(t,e,n){for(var i=0;i<n;i+=2)for(var o=e-i;o<=e+i;o++)t.set(o,e-i),t.set(o,e+i),t.set(e-i,o),t.set(e+i,o);t.set(e-n,e-n),t.set(e-n+1,e-n),t.set(e-n,e-n+1),t.set(e+n,e-n),t.set(e+n,e-n+1),t.set(e+n,e+n-1)},r.generateModeMessage=function(t,e,n){var i=new it;return t?(i.appendBits(e-1,2),i.appendBits(n-1,6),i=r.generateCheckWords(i,28,4)):(i.appendBits(e-1,5),i.appendBits(n-1,11),i=r.generateCheckWords(i,40,4)),i},r.drawModeMessage=function(t,e,n,i){var o=M.truncDivision(n,2);if(e)for(var a=0;a<7;a++){var f=o-3+a;i.get(a)&&t.set(f,o-5),i.get(a+7)&&t.set(o+5,f),i.get(20-a)&&t.set(f,o+5),i.get(27-a)&&t.set(o-5,f)}else for(var a=0;a<10;a++){var f=o-5+a+M.truncDivision(a,5);i.get(a)&&t.set(f,o-7),i.get(a+10)&&t.set(o+7,f),i.get(29-a)&&t.set(f,o+7),i.get(39-a)&&t.set(o-7,f)}},r.generateCheckWords=function(t,e,n){var i,o,a=t.getSize()/n,f=new Ke(r.getGF(n)),s=M.truncDivision(e,n),u=r.bitsToWords(t,n,s);f.encode(u,s-a);var c=e%n,h=new it;h.appendBits(0,c);try{for(var l=p0(Array.from(u)),d=l.next();!d.done;d=l.next()){var p=d.value;h.appendBits(p,n)}}catch(v){i={error:v}}finally{try{d&&!d.done&&(o=l.return)&&o.call(l)}finally{if(i)throw i.error}}return h},r.bitsToWords=function(t,e,n){var i=new Int32Array(n),o,a;for(o=0,a=t.getSize()/e;o<a;o++){for(var f=0,s=0;s<e;s++)f|=t.get(o*e+s)?1<<e-s-1:0;i[o]=f}return i},r.getGF=function(t){switch(t){case 4:return dt.AZTEC_PARAM;case 6:return dt.AZTEC_DATA_6;case 8:return dt.AZTEC_DATA_8;case 10:return dt.AZTEC_DATA_10;case 12:return dt.AZTEC_DATA_12;default:throw new O("Unsupported word size "+t)}},r.stuffBits=function(t,e){for(var n=new it,i=t.getSize(),o=(1<<e)-2,a=0;a<i;a+=e){for(var f=0,s=0;s<e;s++)(a+s>=i||t.get(a+s))&&(f|=1<<e-1-s);(f&o)===o?(n.appendBits(f&o,e),a--):f&o?n.appendBits(f,e):(n.appendBits(f|1,e),a--)}return n},r.totalBitsInLayer=function(t,e){return((e?88:112)+16*t)*t},r.DEFAULT_EC_PERCENT=33,r.DEFAULT_AZTEC_LAYERS=0,r.MAX_NB_BITS=32,r.MAX_NB_BITS_COMPACT=4,r.WORD_SIZE=Int32Array.from([4,6,6,8,8,8,8,8,8,10,10,10,10,10,10,10,10,10,10,10,10,10,10,12,12,12,12,12,12,12,12,12,12]),r}(),tr=v0;var hE=function(){function r(){}return r.prototype.encode=function(t,e,n,i){return this.encodeWithHints(t,e,n,i,null)},r.prototype.encodeWithHints=function(t,e,n,i,o){var a=qe.ISO_8859_1,f=tr.DEFAULT_EC_PERCENT,s=tr.DEFAULT_AZTEC_LAYERS;return o!=null&&(o.has(H.CHARACTER_SET)&&(a=ge.forName(o.get(H.CHARACTER_SET).toString())),o.has(H.ERROR_CORRECTION)&&(f=M.parseInt(o.get(H.ERROR_CORRECTION).toString())),o.has(H.AZTEC_LAYERS)&&(s=M.parseInt(o.get(H.AZTEC_LAYERS).toString()))),r.encodeLayers(t,e,n,i,a,f,s)},r.encodeLayers=function(t,e,n,i,o,a,f){if(e!==C.AZTEC)throw new O("Can only encode AZTEC, but got "+e);var s=tr.encode(F.getBytes(t,o),a,f);return r.renderResult(s,n,i)},r.renderResult=function(t,e,n){var i=t.getMatrix();if(i==null)throw new xt;for(var o=i.getWidth(),a=i.getHeight(),f=Math.max(e,o),s=Math.max(n,a),u=Math.min(f/o,s/a),c=(f-o*u)/2,h=(s-a*u)/2,l=new at(f,s),d=0,p=h;d<a;d++,p+=u)for(var v=0,g=c;v<o;v++,g+=u)i.get(v,d)&&l.setRegion(g,p,u,u);return l},r}();var x0=function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(n[o]=i[o])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),ji=function(r){x0(t,r);function t(e){var n=r.call(this,e.width,e.height)||this;return n.canvas=e,n.tempCanvasElement=null,n.buffer=t.makeBufferFromCanvasImageData(e),n}return t.makeBufferFromCanvasImageData=function(e){var n=e.getContext("2d");if(!n)throw new Error("Couldn't get canvas context.");var i=n.getImageData(0,0,e.width,e.height);return t.toGrayscaleBuffer(i.data,e.width,e.height)},t.toGrayscaleBuffer=function(e,n,i){for(var o=new Uint8ClampedArray(n*i),a=0,f=0,s=e.length;a<s;a+=4,f++){var u=void 0,c=e[a+3];if(c===0)u=255;else{var h=e[a],l=e[a+1],d=e[a+2];u=306*h+601*l+117*d+512>>10}o[f]=u}return o},t.prototype.getRow=function(e,n){if(e<0||e>=this.getHeight())throw new O("Requested row is outside the image: "+e);var i=this.getWidth(),o=e*i;return n===null?n=this.buffer.slice(o,o+i):(n.length<i&&(n=new Uint8ClampedArray(i)),n.set(this.buffer.slice(o,o+i))),n},t.prototype.getMatrix=function(){return this.buffer},t.prototype.isCropSupported=function(){return!0},t.prototype.crop=function(e,n,i,o){return r.prototype.crop.call(this,e,n,i,o),this},t.prototype.isRotateSupported=function(){return!0},t.prototype.rotateCounterClockwise=function(){return this.rotate(-90),this},t.prototype.rotateCounterClockwise45=function(){return this.rotate(-45),this},t.prototype.invert=function(){return new zt(this)},t.prototype.getTempCanvasElement=function(){if(this.tempCanvasElement===null){var e=this.canvas.ownerDocument.createElement("canvas");e.width=this.canvas.width,e.height=this.canvas.height,this.tempCanvasElement=e}return this.tempCanvasElement},t.prototype.rotate=function(e){var n=this.getTempCanvasElement();if(!n)throw new Error("Could not create a Canvas element.");var i=e*t.DEGREE_TO_RADIANS,o=this.canvas.width,a=this.canvas.height,f=Math.ceil(Math.abs(Math.cos(i))*o+Math.abs(Math.sin(i))*a),s=Math.ceil(Math.abs(Math.sin(i))*o+Math.abs(Math.cos(i))*a);n.width=f,n.height=s;var u=n.getContext("2d");if(!u)throw new Error("Could not create a Canvas Context element.");return u.translate(f/2,s/2),u.rotate(i),u.drawImage(this.canvas,o/-2,a/-2),this.buffer=t.makeBufferFromCanvasImageData(n),this},t.DEGREE_TO_RADIANS=Math.PI/180,t}(Ht);function _n(){return typeof navigator<"u"}function g0(){return _n()&&!!navigator.mediaDevices}function Yi(){return!!(g0()&&navigator.mediaDevices.enumerateDevices)}var Fe=function(){return Fe=Object.assign||function(r){for(var t,e=1,n=arguments.length;e<n;e++){t=arguments[e];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(r[i]=t[i])}return r},Fe.apply(this,arguments)},ht=function(r,t,e,n){function i(o){return o instanceof e?o:new e(function(a){a(o)})}return new(e||(e=Promise))(function(o,a){function f(c){try{u(n.next(c))}catch(h){a(h)}}function s(c){try{u(n.throw(c))}catch(h){a(h)}}function u(c){c.done?o(c.value):i(c.value).then(f,s)}u((n=n.apply(r,t||[])).next())})},lt=function(r,t){var e={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},n,i,o,a;return a={next:f(0),throw:f(1),return:f(2)},typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function f(u){return function(c){return s([u,c])}}function s(u){if(n)throw new TypeError("Generator is already executing.");for(;e;)try{if(n=1,i&&(o=u[0]&2?i.return:u[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,u[1])).done)return o;switch(i=0,o&&(u=[u[0]&2,o.value]),u[0]){case 0:case 1:o=u;break;case 4:return e.label++,{value:u[1],done:!1};case 5:e.label++,i=u[1],u=[0];continue;case 7:u=e.ops.pop(),e.trys.pop();continue;default:if(o=e.trys,!(o=o.length>0&&o[o.length-1])&&(u[0]===6||u[0]===2)){e=0;continue}if(u[0]===3&&(!o||u[1]>o[0]&&u[1]<o[3])){e.label=u[1];break}if(u[0]===6&&e.label<o[1]){e.label=o[1],o=u;break}if(o&&e.label<o[2]){e.label=o[2],e.ops.push(u);break}o[2]&&e.ops.pop(),e.trys.pop();continue}u=t.call(r,e)}catch(c){u=[6,c],i=0}finally{n=o=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}},Cn=function(r){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&r[t],n=0;if(e)return e.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},m0={delayBetweenScanAttempts:500,delayBetweenScanSuccess:500,tryPlayVideoTimeout:5e3},Ut=function(){function r(t,e,n){e===void 0&&(e=new Map),n===void 0&&(n={}),this.reader=t,this.hints=e,this.options=Fe(Fe({},m0),n)}return Object.defineProperty(r.prototype,"possibleFormats",{set:function(t){this.hints.set(U.POSSIBLE_FORMATS,t)},enumerable:!1,configurable:!0}),r.addVideoSource=function(t,e){try{t.srcObject=e}catch{console.error("got interrupted by new loading request")}},r.mediaStreamSetTorch=function(t,e){return ht(this,void 0,void 0,function(){return lt(this,function(n){switch(n.label){case 0:return[4,t.applyConstraints({advanced:[{fillLightMode:e?"flash":"off",torch:!!e}]})];case 1:return n.sent(),[2]}})})},r.mediaStreamIsTorchCompatible=function(t){var e,n,i=t.getVideoTracks();try{for(var o=Cn(i),a=o.next();!a.done;a=o.next()){var f=a.value;if(r.mediaStreamIsTorchCompatibleTrack(f))return!0}}catch(s){e={error:s}}finally{try{a&&!a.done&&(n=o.return)&&n.call(o)}finally{if(e)throw e.error}}return!1},r.mediaStreamIsTorchCompatibleTrack=function(t){try{var e=t.getCapabilities();return"torch"in e}catch(n){return console.error(n),console.warn("Your browser may be not fully compatible with WebRTC and/or ImageCapture specs. Torch will not be available."),!1}},r.isVideoPlaying=function(t){return t.currentTime>0&&!t.paused&&t.readyState>2},r.getMediaElement=function(t,e){var n=document.getElementById(t);if(!n)throw new st("element with id '".concat(t,"' not found"));if(n.nodeName.toLowerCase()!==e.toLowerCase())throw new st("element with id '".concat(t,"' must be an ").concat(e," element"));return n},r.createVideoElement=function(t){if(t instanceof HTMLVideoElement)return t;if(typeof t=="string")return r.getMediaElement(t,"video");if(!t&&typeof document<"u"){var e=document.createElement("video");return e.width=200,e.height=200,e}throw new Error("Couldn't get videoElement from videoSource!")},r.prepareImageElement=function(t){if(t instanceof HTMLImageElement)return t;if(typeof t=="string")return r.getMediaElement(t,"img");if(typeof t>"u"){var e=document.createElement("img");return e.width=200,e.height=200,e}throw new Error("Couldn't get imageElement from imageSource!")},r.prepareVideoElement=function(t){var e=r.createVideoElement(t);return e.setAttribute("autoplay","true"),e.setAttribute("muted","true"),e.setAttribute("playsinline","true"),e},r.isImageLoaded=function(t){return!(!t.complete||t.naturalWidth===0)},r.createBinaryBitmapFromCanvas=function(t){var e=new ji(t),n=new ke(e);return new Le(n)},r.drawImageOnCanvas=function(t,e){t.drawImage(e,0,0)},r.getMediaElementDimensions=function(t){if(t instanceof HTMLVideoElement)return{height:t.videoHeight,width:t.videoWidth};if(t instanceof HTMLImageElement)return{height:t.naturalHeight||t.height,width:t.naturalWidth||t.width};throw new Error("Couldn't find the Source's dimensions!")},r.createCaptureCanvas=function(t){if(!t)throw new st("Cannot create a capture canvas without a media element.");if(typeof document>"u")throw new Error(`The page "Document" is undefined, make sure you're running in a browser.`);var e=document.createElement("canvas"),n=r.getMediaElementDimensions(t),i=n.width,o=n.height;return e.style.width=i+"px",e.style.height=o+"px",e.width=i,e.height=o,e},r.tryPlayVideo=function(t){return ht(this,void 0,void 0,function(){var e;return lt(this,function(n){switch(n.label){case 0:if(t?.ended)return console.error("Trying to play video that has ended."),[2,!1];if(r.isVideoPlaying(t))return console.warn("Trying to play video that is already playing."),[2,!0];n.label=1;case 1:return n.trys.push([1,3,,4]),[4,t.play()];case 2:return n.sent(),[2,!0];case 3:return e=n.sent(),console.warn("It was not possible to play the video.",e),[2,!1];case 4:return[2]}})})},r.createCanvasFromMediaElement=function(t){var e=r.createCaptureCanvas(t),n=e.getContext("2d");if(!n)throw new Error("Couldn't find Canvas 2D Context.");return r.drawImageOnCanvas(n,t),e},r.createBinaryBitmapFromMediaElem=function(t){var e=r.createCanvasFromMediaElement(t);return r.createBinaryBitmapFromCanvas(e)},r.destroyImageElement=function(t){t.src="",t.removeAttribute("src"),t=void 0},r.listVideoInputDevices=function(){return ht(this,void 0,void 0,function(){var t,e,n,i,o,a,f,s,u,c,h,l;return lt(this,function(d){switch(d.label){case 0:if(!_n())throw new Error("Can't enumerate devices, navigator is not present.");if(!Yi())throw new Error("Can't enumerate devices, method not supported.");return[4,navigator.mediaDevices.enumerateDevices()];case 1:t=d.sent(),e=[];try{for(n=Cn(t),i=n.next();!i.done;i=n.next())o=i.value,a=o.kind==="video"?"videoinput":o.kind,a==="videoinput"&&(f=o.deviceId||o.id,s=o.label||"Video device ".concat(e.length+1),u=o.groupId,c={deviceId:f,label:s,kind:a,groupId:u},e.push(c))}catch(p){h={error:p}}finally{try{i&&!i.done&&(l=n.return)&&l.call(n)}finally{if(h)throw h.error}}return[2,e]}})})},r.findDeviceById=function(t){return ht(this,void 0,void 0,function(){var e;return lt(this,function(n){switch(n.label){case 0:return[4,r.listVideoInputDevices()];case 1:return e=n.sent(),e?[2,e.find(function(i){return i.deviceId===t})]:[2]}})})},r.cleanVideoSource=function(t){if(t){try{t.srcObject=null}catch{t.src=""}t&&t.removeAttribute("src")}},r.releaseAllStreams=function(){r.streamTracker.length!==0&&r.streamTracker.forEach(function(t){t.getTracks().forEach(function(e){return e.stop()})}),r.streamTracker=[]},r.playVideoOnLoadAsync=function(t,e){return ht(this,void 0,void 0,function(){var n;return lt(this,function(i){switch(i.label){case 0:return[4,r.tryPlayVideo(t)];case 1:return n=i.sent(),n?[2,!0]:[2,new Promise(function(o,a){var f=setTimeout(function(){r.isVideoPlaying(t)||(a(!1),t.removeEventListener("canplay",s))},e),s=function(){r.tryPlayVideo(t).then(function(u){clearTimeout(f),t.removeEventListener("canplay",s),o(u)})};t.addEventListener("canplay",s)})]}})})},r.attachStreamToVideo=function(t,e,n){return n===void 0&&(n=5e3),ht(this,void 0,void 0,function(){var i;return lt(this,function(o){switch(o.label){case 0:return i=r.prepareVideoElement(e),r.addVideoSource(i,t),[4,r.playVideoOnLoadAsync(i,n)];case 1:return o.sent(),[2,i]}})})},r._waitImageLoad=function(t){return new Promise(function(e,n){var i=1e4,o=setTimeout(function(){r.isImageLoaded(t)||(t.removeEventListener("load",a),n())},i),a=function(){clearTimeout(o),t.removeEventListener("load",a),e()};t.addEventListener("load",a)})},r.checkCallbackFnOrThrow=function(t){if(!t)throw new st("`callbackFn` is a required parameter, you cannot capture results without it.")},r.disposeMediaStream=function(t){t.getVideoTracks().forEach(function(e){return e.stop()}),t=void 0},r.prototype.decode=function(t){var e=r.createCanvasFromMediaElement(t);return this.decodeFromCanvas(e)},r.prototype.decodeBitmap=function(t){return this.reader.decode(t,this.hints)},r.prototype.decodeFromCanvas=function(t){var e=r.createBinaryBitmapFromCanvas(t);return this.decodeBitmap(e)},r.prototype.decodeFromImageElement=function(t){return ht(this,void 0,void 0,function(){var e;return lt(this,function(n){switch(n.label){case 0:if(!t)throw new st("An image element must be provided.");return e=r.prepareImageElement(t),[4,this._decodeOnLoadImage(e)];case 1:return[2,n.sent()]}})})},r.prototype.decodeFromImageUrl=function(t){return ht(this,void 0,void 0,function(){var e;return lt(this,function(n){switch(n.label){case 0:if(!t)throw new st("An URL must be provided.");e=r.prepareImageElement(),e.src=t,n.label=1;case 1:return n.trys.push([1,,3,4]),[4,this.decodeFromImageElement(e)];case 2:return[2,n.sent()];case 3:return r.destroyImageElement(e),[7];case 4:return[2]}})})},r.prototype.decodeFromConstraints=function(t,e,n){return ht(this,void 0,void 0,function(){var i,o;return lt(this,function(a){switch(a.label){case 0:return r.checkCallbackFnOrThrow(n),[4,this.getUserMedia(t)];case 1:i=a.sent(),a.label=2;case 2:return a.trys.push([2,4,,5]),[4,this.decodeFromStream(i,e,n)];case 3:return[2,a.sent()];case 4:throw o=a.sent(),r.disposeMediaStream(i),o;case 5:return[2]}})})},r.prototype.decodeFromStream=function(t,e,n){return ht(this,void 0,void 0,function(){var i,o,a,f,s,u,c,h,l,d=this;return lt(this,function(p){switch(p.label){case 0:return r.checkCallbackFnOrThrow(n),i=this.options.tryPlayVideoTimeout,[4,r.attachStreamToVideo(t,e,i)];case 1:return o=p.sent(),a=function(){r.disposeMediaStream(t),r.cleanVideoSource(o)},f=this.scan(o,n,a),s=t.getVideoTracks(),u=Fe(Fe({},f),{stop:function(){f.stop()},streamVideoConstraintsApply:function(v,g){return ht(this,void 0,void 0,function(){var y,m,A,_,I,T,D;return lt(this,function(b){switch(b.label){case 0:y=g?s.filter(g):s,b.label=1;case 1:b.trys.push([1,6,7,8]),m=Cn(y),A=m.next(),b.label=2;case 2:return A.done?[3,5]:(_=A.value,[4,_.applyConstraints(v)]);case 3:b.sent(),b.label=4;case 4:return A=m.next(),[3,2];case 5:return[3,8];case 6:return I=b.sent(),T={error:I},[3,8];case 7:try{A&&!A.done&&(D=m.return)&&D.call(m)}finally{if(T)throw T.error}return[7];case 8:return[2]}})})},streamVideoConstraintsGet:function(v){return s.find(v).getConstraints()},streamVideoSettingsGet:function(v){return s.find(v).getSettings()},streamVideoCapabilitiesGet:function(v){return s.find(v).getCapabilities()}}),c=r.mediaStreamIsTorchCompatible(t),c&&(h=s?.find(function(v){return r.mediaStreamIsTorchCompatibleTrack(v)}),l=function(v){return ht(d,void 0,void 0,function(){return lt(this,function(g){switch(g.label){case 0:return[4,r.mediaStreamSetTorch(h,v)];case 1:return g.sent(),[2]}})})},u.switchTorch=l,u.stop=function(){return ht(d,void 0,void 0,function(){return lt(this,function(v){switch(v.label){case 0:return f.stop(),[4,l(!1)];case 1:return v.sent(),[2]}})})}),[2,u]}})})},r.prototype.decodeFromVideoDevice=function(t,e,n){return ht(this,void 0,void 0,function(){var i,o;return lt(this,function(a){switch(a.label){case 0:return r.checkCallbackFnOrThrow(n),t?i={deviceId:{exact:t}}:i={facingMode:"environment"},o={video:i},[4,this.decodeFromConstraints(o,e,n)];case 1:return[2,a.sent()]}})})},r.prototype.decodeFromVideoElement=function(t,e){return ht(this,void 0,void 0,function(){var n,i;return lt(this,function(o){switch(o.label){case 0:if(r.checkCallbackFnOrThrow(e),!t)throw new st("A video element must be provided.");return n=r.prepareVideoElement(t),i=this.options.tryPlayVideoTimeout,[4,r.playVideoOnLoadAsync(n,i)];case 1:return o.sent(),[2,this.scan(n,e)]}})})},r.prototype.decodeFromVideoUrl=function(t,e){return ht(this,void 0,void 0,function(){var n,i,o,a;return lt(this,function(f){switch(f.label){case 0:if(r.checkCallbackFnOrThrow(e),!t)throw new st("An URL must be provided.");return n=r.prepareVideoElement(),n.src=t,i=function(){r.cleanVideoSource(n)},o=this.options.tryPlayVideoTimeout,[4,r.playVideoOnLoadAsync(n,o)];case 1:return f.sent(),a=this.scan(n,e,i),[2,a]}})})},r.prototype.decodeOnceFromConstraints=function(t,e){return ht(this,void 0,void 0,function(){var n;return lt(this,function(i){switch(i.label){case 0:return[4,this.getUserMedia(t)];case 1:return n=i.sent(),[4,this.decodeOnceFromStream(n,e)];case 2:return[2,i.sent()]}})})},r.prototype.decodeOnceFromStream=function(t,e){return ht(this,void 0,void 0,function(){var n,i,o;return lt(this,function(a){switch(a.label){case 0:return n=!!e,[4,r.attachStreamToVideo(t,e)];case 1:i=a.sent(),a.label=2;case 2:return a.trys.push([2,,4,5]),[4,this.scanOneResult(i)];case 3:return o=a.sent(),[2,o];case 4:return n||r.cleanVideoSource(i),[7];case 5:return[2]}})})},r.prototype.decodeOnceFromVideoDevice=function(t,e){return ht(this,void 0,void 0,function(){var n,i;return lt(this,function(o){switch(o.label){case 0:return t?n={deviceId:{exact:t}}:n={facingMode:"environment"},i={video:n},[4,this.decodeOnceFromConstraints(i,e)];case 1:return[2,o.sent()]}})})},r.prototype.decodeOnceFromVideoElement=function(t){return ht(this,void 0,void 0,function(){var e,n;return lt(this,function(i){switch(i.label){case 0:if(!t)throw new st("A video element must be provided.");return e=r.prepareVideoElement(t),n=this.options.tryPlayVideoTimeout,[4,r.playVideoOnLoadAsync(e,n)];case 1:return i.sent(),[4,this.scanOneResult(e)];case 2:return[2,i.sent()]}})})},r.prototype.decodeOnceFromVideoUrl=function(t){return ht(this,void 0,void 0,function(){var e,n;return lt(this,function(i){switch(i.label){case 0:if(!t)throw new st("An URL must be provided.");e=r.prepareVideoElement(),e.src=t,n=this.decodeOnceFromVideoElement(e),i.label=1;case 1:return i.trys.push([1,,3,4]),[4,n];case 2:return[2,i.sent()];case 3:return r.cleanVideoSource(e),[7];case 4:return[2]}})})},r.prototype.scanOneResult=function(t,e,n,i){var o=this;return e===void 0&&(e=!0),n===void 0&&(n=!0),i===void 0&&(i=!0),new Promise(function(a,f){o.scan(t,function(s,u,c){if(s){a(s),c.stop();return}if(u){if(u instanceof w&&e||u instanceof j&&n||u instanceof S&&i)return;c.stop(),f(u)}})})},r.prototype.scan=function(t,e,n){var i=this;r.checkCallbackFnOrThrow(e);var o=r.createCaptureCanvas(t),a=o.getContext("2d");if(!a)throw new Error("Couldn't create canvas for visual element scan.");var f=function(){a=void 0,o=void 0},s=!1,u,c=function(){s=!0,clearTimeout(u),f(),n&&n()},h={stop:c},l=function(){if(!s)try{r.drawImageOnCanvas(a,t);var d=i.decodeFromCanvas(o);e(d,void 0,h),u=setTimeout(l,i.options.delayBetweenScanSuccess)}catch(y){e(void 0,y,h);var p=y instanceof j,v=y instanceof S,g=y instanceof w;if(p||v||g){u=setTimeout(l,i.options.delayBetweenScanAttempts);return}f(),n&&n(y)}};return l(),h},r.prototype._decodeOnLoadImage=function(t){return ht(this,void 0,void 0,function(){var e;return lt(this,function(n){switch(n.label){case 0:return e=r.isImageLoaded(t),e?[3,2]:[4,r._waitImageLoad(t)];case 1:n.sent(),n.label=2;case 2:return[2,this.decode(t)]}})})},r.prototype.getUserMedia=function(t){return ht(this,void 0,void 0,function(){var e;return lt(this,function(n){switch(n.label){case 0:return[4,navigator.mediaDevices.getUserMedia(t)];case 1:return e=n.sent(),r.streamTracker.push(e),[2,e]}})})},r.streamTracker=[],r}();var y0=function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(n[o]=i[o])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),y8=function(r){y0(t,r);function t(e,n){return r.call(this,new te,e,n)||this}return t}(Ut);var A0=function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(n[o]=i[o])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),_8=function(r){A0(t,r);function t(e,n){return r.call(this,new Xt(e),e,n)||this}return t}(Ut);var w0=function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(n[o]=i[o])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),O8=function(r){w0(t,r);function t(e,n){return r.call(this,new oe,e,n)||this}return t}(Ut);var E0=function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(n[o]=i[o])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),Ki=function(r){E0(t,r);function t(e,n){var i=this,o=new Ye;return o.setHints(e),i=r.call(this,o,e,n)||this,i.reader=o,i}return Object.defineProperty(t.prototype,"possibleFormats",{set:function(e){this.hints.set(U.POSSIBLE_FORMATS,e),this.reader.setHints(this.hints)},enumerable:!1,configurable:!0}),t.prototype.decodeBitmap=function(e){return this.reader.decodeWithState(e)},t.prototype.setHints=function(e){this.hints=e,this.reader.setHints(this.hints)},t}(Ut);var _0=function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(n[o]=i[o])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),M8=function(r){_0(t,r);function t(e,n){return r.call(this,new se,e,n)||this}return t}(Ut);var C0=function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(n[o]=i[o])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),k8=function(r){C0(t,r);function t(e,n){return r.call(this,new ae,e,n)||this}return t}(Ut);var Jt="http://www.w3.org/2000/svg",V8=function(){function r(t){if(typeof t=="string"){var e=document.getElementById(t);if(!e)throw new Error("Could not find a Container element with '".concat(t,"'."));this.containerElement=e}else this.containerElement=t}return r.prototype.write=function(t,e,n,i){if(t.length===0)throw new O("Found empty contents");if(e<0||n<0)throw new O("Requested dimensions are too small: "+e+"x"+n);var o=i&&i.get(H.MARGIN)!==void 0?Number.parseInt(i.get(H.MARGIN).toString(),10):r.QUIET_ZONE_SIZE,a=this.encode(i,t);return this.renderResult(a,e,n,o)},r.prototype.createSVGElement=function(t,e){var n=document.createElementNS(r.SVG_NS,"svg");return n.setAttributeNS(Jt,"width",e.toString()),n.setAttributeNS(Jt,"height",t.toString()),n},r.prototype.createSvgPathPlaceholderElement=function(t,e){var n=document.createElementNS(r.SVG_NS,"path");return n.setAttributeNS(Jt,"d","M0 0h".concat(t,"v").concat(e,"H0z")),n.setAttributeNS(Jt,"fill","none"),n},r.prototype.createSvgRectElement=function(t,e,n,i){var o=document.createElementNS(r.SVG_NS,"rect");return o.setAttributeNS(Jt,"x",t.toString()),o.setAttributeNS(Jt,"y",e.toString()),o.setAttributeNS(Jt,"height",n.toString()),o.setAttributeNS(Jt,"width",i.toString()),o.setAttributeNS(Jt,"fill","#000000"),o},r.prototype.encode=function(t,e){var n=Nt.L;if(t&&t.get(H.ERROR_CORRECTION)!==void 0){var i=t.get(H.ERROR_CORRECTION).toString();n=Nt.fromString(i)}var o=qt.encode(e,n,t);return o},r.prototype.renderResult=function(t,e,n,i){var o=t.getMatrix();if(o===null)throw new xt;var a=o.getWidth(),f=o.getHeight(),s=a+i*2,u=f+i*2,c=Math.max(e,s),h=Math.max(n,u),l=Math.min(Math.floor(c/s),Math.floor(h/u)),d=Math.floor((c-a*l)/2),p=Math.floor((h-f*l)/2),v=this.createSVGElement(c,h),g=this.createSvgPathPlaceholderElement(e,n);v.appendChild(g),this.containerElement.appendChild(v);for(var y=0,m=p;y<f;y++,m+=l)for(var A=0,_=d;A<a;A++,_+=l)if(o.get(A,y)===1){var I=this.createSvgRectElement(_,m,l,l);v.appendChild(I)}return v},r.QUIET_ZONE_SIZE=4,r.SVG_NS="http://www.w3.org/2000/svg",r}();var Qi="http://www.w3.org/2000/svg",X8=function(){function r(){}return r.prototype.write=function(t,e,n,i){if(t.length===0)throw new O("Found empty contents");if(e<0||n<0)throw new O("Requested dimensions are too small: "+e+"x"+n);var o=Nt.L,a=r.QUIET_ZONE_SIZE;if(i){if(i.get(H.ERROR_CORRECTION)!==void 0){var f=i.get(H.ERROR_CORRECTION).toString();o=Nt.fromString(f)}i.get(H.MARGIN)!==void 0&&(a=Number.parseInt(i.get(H.MARGIN).toString(),10))}var s=qt.encode(t,o,i);return this.renderResult(s,e,n,a)},r.prototype.writeToDom=function(t,e,n,i,o){if(typeof t=="string"){var a=document.querySelector(t);if(!a)throw new Error("Could no find the target HTML element.");t=a}var f=this.write(e,n,i,o);t instanceof HTMLElement&&t.appendChild(f)},r.prototype.renderResult=function(t,e,n,i){var o=t.getMatrix();if(o===null)throw new xt;for(var a=o.getWidth(),f=o.getHeight(),s=a+i*2,u=f+i*2,c=Math.max(e,s),h=Math.max(n,u),l=Math.min(Math.floor(c/s),Math.floor(h/u)),d=Math.floor((c-a*l)/2),p=Math.floor((h-f*l)/2),v=this.createSVGElement(c,h),g=0,y=p;g<f;g++,y+=l)for(var m=0,A=d;m<a;m++,A+=l)if(o.get(m,g)===1){var _=this.createSvgRectElement(A,y,l,l);v.appendChild(_)}return v},r.prototype.createSVGElement=function(t,e){var n=document.createElementNS(Qi,"svg"),i=t.toString(),o=e.toString();return n.setAttribute("height",o),n.setAttribute("width",i),n.setAttribute("viewBox","0 0 "+i+" "+o),n},r.prototype.createSvgRectElement=function(t,e,n,i){var o=document.createElementNS(Qi,"rect");return o.setAttribute("x",t.toString()),o.setAttribute("y",e.toString()),o.setAttribute("height",n.toString()),o.setAttribute("width",i.toString()),o.setAttribute("fill","#000000"),o},r.QUIET_ZONE_SIZE=4,r}();var In={[C.AZTEC]:"aztec",[C.CODABAR]:"codabar",[C.CODE_39]:"code_39",[C.CODE_93]:"code_93",[C.CODE_128]:"code_128",[C.DATA_MATRIX]:"data_matrix",[C.EAN_8]:"ean_8",[C.EAN_13]:"ean_13",[C.ITF]:"itf",[C.PDF_417]:"pdf417",[C.QR_CODE]:"qr_code",[C.UPC_A]:"upc_a",[C.UPC_E]:"upc_e",[C.UPC_EAN_EXTENSION]:"unknown",[C.MAXICODE]:"unknown",[C.RSS_14]:"unknown",[C.RSS_EXPANDED]:"unknown"},Sn={aztec:C.AZTEC,codabar:C.CODABAR,code_39:C.CODE_39,code_93:C.CODE_93,code_128:C.CODE_128,data_matrix:C.DATA_MATRIX,ean_8:C.EAN_8,ean_13:C.EAN_13,itf:C.ITF,pdf417:C.PDF_417,qr_code:C.QR_CODE,upc_a:C.UPC_A,upc_e:C.UPC_E};var Tr=class{reader;constructor(t){let e=new Map([[U.TRY_HARDER,!0],[U.POSSIBLE_FORMATS,t?t.formats.map(n=>Sn[n]):Object.values(Sn)]]);this.reader=new Ki(e)}static getSupportedFormats(){return Promise.resolve(Object.values(In))}async detect(t){try{let e;if(t instanceof HTMLVideoElement||t instanceof HTMLImageElement)e=await this.reader.scanOneResult(t,!1);else if(t instanceof HTMLCanvasElement)e=this.reader.decodeFromCanvas(t);else if(t instanceof Blob){let n=await this.blobToImage(t);e=await this.reader.scanOneResult(n,!1)}else if(t instanceof ImageBitmap||t instanceof ImageData||t instanceof VideoFrame)e=this.reader.decodeFromCanvas(this.imageDataSourceToCanvas(t));else throw new TypeError("Image source is not supported");return[{rawValue:e.getText(),format:In[e.getBarcodeFormat()],boundingBox:new DOMRectReadOnly,cornerPoints:e.getResultPoints().map(n=>({x:n.getX(),y:n.getY()}))}]}catch(e){if(e&&!(e instanceof w))throw e;return[]}}async blobToImage(t){return new Promise((e,n)=>{let i=URL.createObjectURL(t),o=new Image;o.onload=()=>{URL.revokeObjectURL(i),e(o)},o.onerror=()=>n(),o.src=i})}imageDataSourceToCanvas(t){let e=document.createElement("canvas"),n=e.getContext("2d"),i=t instanceof VideoFrame?t.displayWidth:t.width,o=t instanceof VideoFrame?t.displayHeight:t.height;return n&&(t instanceof ImageData?n.putImageData(t,i,o):n.drawImage(t,i,o)),e}};"BarcodeDetector"in window||(window.BarcodeDetector=Tr);})();
|
|
21
21
|
//# sourceMappingURL=barcode-detector-polyfill.min.js.map
|