@nocobase/plugin-block-workbench 2.0.0-alpha.59 → 2.0.0-alpha.60
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/index.js +1 -1
- package/dist/externalVersion.js +4 -4
- package/package.json +2 -2
package/dist/client/index.js
CHANGED
|
@@ -7,4 +7,4 @@
|
|
|
7
7
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react-i18next"),require("@nocobase/plugin-mobile/client"),require("react-router-dom"),require("@ant-design/icons"),require("antd"),require("react-dom"),require("react"),require("@emotion/css"),require("@nocobase/flow-engine"),require("@nocobase/client"),require("@formily/react"),require("antd-style")):"function"==typeof define&&define.amd?define("@nocobase/plugin-block-workbench",["react-i18next","@nocobase/plugin-mobile/client","react-router-dom","@ant-design/icons","antd","react-dom","react","@emotion/css","@nocobase/flow-engine","@nocobase/client","@formily/react","antd-style"],t):"object"==typeof exports?exports["@nocobase/plugin-block-workbench"]=t(require("react-i18next"),require("@nocobase/plugin-mobile/client"),require("react-router-dom"),require("@ant-design/icons"),require("antd"),require("react-dom"),require("react"),require("@emotion/css"),require("@nocobase/flow-engine"),require("@nocobase/client"),require("@formily/react"),require("antd-style")):e["@nocobase/plugin-block-workbench"]=t(e["react-i18next"],e["@nocobase/plugin-mobile/client"],e["react-router-dom"],e["@ant-design/icons"],e.antd,e["react-dom"],e.react,e["@emotion/css"],e["@nocobase/flow-engine"],e["@nocobase/client"],e["@formily/react"],e["antd-style"])}(self,function(e,t,r,n,i,o,a,s,l,c,u,h){return function(){var d,f,g,p,m,w,C={916:function(e,t,r){"use strict";var n=r(589),i=r.n(n),o=r(758),a=r.n(o)()(i());a.push([e.id,".adm-grid {\n --gap: 0;\n --gap-horizontal: var(--gap);\n --gap-vertical: var(--gap);\n display: grid;\n grid-gap: 10px;\n -webkit-column-gap: var(--gap-horizontal);\n grid-column-gap: var(--gap-horizontal);\n -moz-column-gap: var(--gap-horizontal);\n column-gap: var(--gap-horizontal);\n grid-row-gap: var(--gap-vertical);\n row-gap: var(--gap-vertical);\n grid-template-columns: repeat(var(--columns), minmax(0, 1fr));\n align-items: stretch;\n}\n.adm-grid-item {\n grid-column-end: span var(--item-span);\n}\n",""]),t.Z=a},59:function(e,t,r){"use strict";var n=r(589),i=r.n(n),o=r(758),a=r.n(o)()(i());a.push([e.id,".adm-list {\n --header-font-size: var(--adm-font-size-7);\n --prefix-width: 'auto';\n --prefix-padding-right: 12px;\n --align-items: center;\n --active-background-color: var(--adm-color-border);\n --border-inner: solid 1px var(--adm-color-border);\n --border-top: solid 1px var(--adm-color-border);\n --border-bottom: solid 1px var(--adm-color-border);\n --padding-left: 12px;\n --padding-right: 12px;\n --font-size: var(--adm-font-size-9);\n --extra-max-width: 70%;\n}\n.adm-list-header {\n color: var(--adm-color-weak);\n font-size: var(--header-font-size);\n padding: 8px var(--padding-right) 8px var(--padding-left);\n}\n.adm-list-body {\n background-color: var(--adm-color-background);\n overflow: hidden;\n font-size: var(--font-size);\n}\n.adm-list-body-inner {\n margin-top: -1px;\n}\n.adm-list-default .adm-list-body {\n border-top: var(--border-top);\n border-bottom: var(--border-bottom);\n}\n.adm-list-card {\n margin: 12px;\n}\n.adm-list-card .adm-list-body {\n border-radius: 8px;\n}\n.adm-list-card .adm-list-header {\n padding-left: 0;\n}\n.adm-list-item {\n display: block;\n padding-left: var(--padding-left);\n position: relative;\n background-color: var(--adm-color-background);\n line-height: 1.5;\n}\n.adm-list-item-title,\n.adm-list-item-description {\n color: var(--adm-color-weak);\n font-size: var(--adm-font-size-main);\n}\n.adm-list-item-content {\n display: -webkit-box;\n display: -webkit-flex;\n display: -moz-box;\n display: flex;\n align-items: var(--align-items);\n justify-content: flex-start;\n border-top: var(--border-inner);\n padding-right: var(--padding-right);\n}\n.adm-list-item-content-prefix {\n width: var(--prefix-width);\n flex: none;\n padding-right: var(--prefix-padding-right);\n}\n.adm-list-item-content-main {\n flex: auto;\n padding: 12px 0;\n}\n.adm-list-item-content-extra {\n flex: none;\n padding-left: 12px;\n font-size: var(--adm-font-size-7);\n color: var(--adm-color-weak);\n max-width: var(--extra-max-width);\n}\n.adm-list-item-content-arrow {\n flex: none;\n display: -webkit-box;\n display: -webkit-flex;\n display: -moz-box;\n display: flex;\n align-items: center;\n margin-left: 4px;\n color: var(--adm-color-light);\n font-size: 19px;\n}\n.adm-list-item-disabled {\n cursor: not-allowed;\n}\n.adm-list-item-disabled.adm-list-item-disabled > .adm-list-item-content > * {\n opacity: 0.4;\n pointer-events: none;\n}\na.adm-list-item:active:not(.adm-list-item-disabled) {\n background-color: var(--active-background-color);\n}\na.adm-list-item:active:not(.adm-list-item-disabled)::after {\n content: ' ';\n display: block;\n position: absolute;\n width: 100%;\n bottom: -1px;\n left: 0;\n border-bottom: var(--border-inner);\n}\n",""]),t.Z=a},46:function(e,t,r){"use strict";var n=r(589),i=r.n(n),o=r(758),a=r.n(o)()(i());a.push([e.id,":root {\n --adm-radius-s: 4px;\n --adm-radius-m: 8px;\n --adm-radius-l: 12px;\n --adm-font-size-1: 9px;\n --adm-font-size-2: 10px;\n --adm-font-size-3: 11px;\n --adm-font-size-4: 12px;\n --adm-font-size-5: 13px;\n --adm-font-size-6: 14px;\n --adm-font-size-7: 15px;\n --adm-font-size-8: 16px;\n --adm-font-size-9: 17px;\n --adm-font-size-10: 18px;\n --adm-color-primary: #1677ff;\n --adm-color-success: #00b578;\n --adm-color-warning: #ff8f1f;\n --adm-color-danger: #ff3141;\n --adm-color-yellow: #ff9f18;\n --adm-color-orange: #ff6430;\n --adm-color-wathet: #e7f1ff;\n --adm-color-text: #333333;\n --adm-color-text-secondary: #666666;\n --adm-color-weak: #999999;\n --adm-color-light: #cccccc;\n --adm-color-border: #eeeeee;\n --adm-color-background: #ffffff;\n --adm-color-highlight: var(--adm-color-danger);\n --adm-color-white: #ffffff;\n --adm-color-box: #f5f5f5;\n --adm-color-text-light-solid: var(--adm-color-white);\n --adm-color-text-dark-solid: #000000;\n --adm-color-fill-content: var(--adm-color-box);\n --adm-font-size-main: var(--adm-font-size-5);\n --adm-font-family: -apple-system, blinkmacsystemfont, 'Helvetica Neue',\n helvetica, segoe ui, arial, roboto, 'PingFang SC', 'miui',\n 'Hiragino Sans GB', 'Microsoft Yahei', sans-serif;\n --adm-border-color: var(--adm-color-border);\n}\nhtml[data-prefers-color-scheme='dark'] {\n --adm-color-primary: #3086ff;\n --adm-color-success: #34b368;\n --adm-color-warning: #ffa930;\n --adm-color-danger: #ff4a58;\n --adm-color-yellow: #ffa930;\n --adm-color-orange: #e65a2b;\n --adm-color-wathet: #0d2543;\n --adm-color-text: #e6e6e6;\n --adm-color-text-secondary: #b3b3b3;\n --adm-color-weak: #808080;\n --adm-color-light: #4d4d4d;\n --adm-color-border: #2b2b2b;\n --adm-color-box: #0a0a0a;\n --adm-color-background: #1a1a1a;\n --adm-color-background-body: var(--adm-color-background);\n --adm-border-color: var(--adm-color-border);\n}\n:root {\n -webkit-tap-highlight-color: rgba(0, 0, 0, 0);\n}\nhtml {\n background-color: var(--adm-color-background-body);\n}\nbody {\n color: #333333;\n color: var(--adm-color-text);\n font-size: 13px;\n font-size: var(--adm-font-size-main);\n font-family: -apple-system, blinkmacsystemfont, 'Helvetica Neue',\n helvetica, segoe ui, arial, roboto, 'PingFang SC', 'miui',\n 'Hiragino Sans GB', 'Microsoft Yahei', sans-serif;\n font-family: var(--adm-font-family);\n}\na,\nbutton {\n cursor: pointer;\n}\na {\n color: #1677ff;\n color: var(--adm-color-primary);\n transition: opacity ease-in-out 0.2s;\n}\na:active {\n opacity: 0.8;\n}\n.adm-plain-anchor {\n color: inherit;\n transition: none;\n}\n.adm-plain-anchor:active {\n opacity: 1;\n opacity: initial;\n}\nbody.adm-overflow-hidden {\n overflow: hidden !important;\n}\ndiv.adm-px-tester {\n --size: 1;\n height: -webkit-calc(var(--size) / 2 * 2px);\n height: -moz-calc(var(--size) / 2 * 2px);\n height: calc(var(--size) / 2 * 2px);\n width: 0;\n position: fixed;\n left: -100vw;\n top: -100vh;\n -webkit-user-select: none;\n -moz-user-select: none;\n user-select: none;\n pointer-events: none;\n}\n",""]),t.Z=a},758:function(e){"use strict";e.exports=function(e){var t=[];return t.toString=function(){return this.map(function(t){var r="",n=void 0!==t[5];return t[4]&&(r+="@supports (".concat(t[4],") {")),t[2]&&(r+="@media ".concat(t[2]," {")),n&&(r+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),r+=e(t),n&&(r+="}"),t[2]&&(r+="}"),t[4]&&(r+="}"),r}).join("")},t.i=function(e,r,n,i,o){"string"==typeof e&&(e=[[null,e,void 0]]);var a={};if(n)for(var s=0;s<this.length;s++){var l=this[s][0];null!=l&&(a[l]=!0)}for(var c=0;c<e.length;c++){var u=[].concat(e[c]);n&&a[u[0]]||(void 0!==o&&(void 0===u[5]||(u[1]="@layer".concat(u[5].length>0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=o),r&&(u[2]&&(u[1]="@media ".concat(u[2]," {").concat(u[1],"}")),u[2]=r),i&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=i):u[4]="".concat(i)),t.push(u))}},t}},589:function(e){"use strict";e.exports=function(e){return e[1]}},738:function(e,t,r){"use strict";r.d(t,{t2:function(){return et},lz:function(){return p}}),(u=h||(h={}))[u.QR_CODE=0]="QR_CODE",u[u.AZTEC=1]="AZTEC",u[u.CODABAR=2]="CODABAR",u[u.CODE_39=3]="CODE_39",u[u.CODE_93=4]="CODE_93",u[u.CODE_128=5]="CODE_128",u[u.DATA_MATRIX=6]="DATA_MATRIX",u[u.MAXICODE=7]="MAXICODE",u[u.ITF=8]="ITF",u[u.EAN_13=9]="EAN_13",u[u.EAN_8=10]="EAN_8",u[u.PDF_417=11]="PDF_417",u[u.RSS_14=12]="RSS_14",u[u.RSS_EXPANDED=13]="RSS_EXPANDED",u[u.UPC_A=14]="UPC_A",u[u.UPC_E=15]="UPC_E",u[u.UPC_EAN_EXTENSION=16]="UPC_EAN_EXTENSION";var n,i,o,a,s,l,c,u,h,d,f,g,p,m,w=new Map([[h.QR_CODE,"QR_CODE"],[h.AZTEC,"AZTEC"],[h.CODABAR,"CODABAR"],[h.CODE_39,"CODE_39"],[h.CODE_93,"CODE_93"],[h.CODE_128,"CODE_128"],[h.DATA_MATRIX,"DATA_MATRIX"],[h.MAXICODE,"MAXICODE"],[h.ITF,"ITF"],[h.EAN_13,"EAN_13"],[h.EAN_8,"EAN_8"],[h.PDF_417,"PDF_417"],[h.RSS_14,"RSS_14"],[h.RSS_EXPANDED,"RSS_EXPANDED"],[h.UPC_A,"UPC_A"],[h.UPC_E,"UPC_E"],[h.UPC_EAN_EXTENSION,"UPC_EAN_EXTENSION"]]);(n=d||(d={}))[n.UNKNOWN=0]="UNKNOWN",n[n.URL=1]="URL",(i=f||(f={}))[i.SCAN_TYPE_CAMERA=0]="SCAN_TYPE_CAMERA",i[i.SCAN_TYPE_FILE=1]="SCAN_TYPE_FILE";var C=function(){function e(){}return e.GITHUB_PROJECT_URL="https://github.com/mebjas/html5-qrcode",e.SCAN_DEFAULT_FPS=2,e.DEFAULT_DISABLE_FLIP=!1,e.DEFAULT_REMEMBER_LAST_CAMERA_USED=!0,e.DEFAULT_SUPPORTED_SCAN_TYPE=[f.SCAN_TYPE_CAMERA,f.SCAN_TYPE_FILE],e}(),E=function(){function e(e,t){this.format=e,this.formatName=t}return e.prototype.toString=function(){return this.formatName},e.create=function(t){if(!w.has(t))throw"".concat(t," not in html5QrcodeSupportedFormatsTextMap");return new e(t,w.get(t))},e}(),A=function(){function e(){}return e.createFromText=function(e){return{decodedText:e,result:{text:e}}},e.createFromQrcodeResult=function(e){return{decodedText:e.text,result:e}},e}();(o=g||(g={}))[o.UNKWOWN_ERROR=0]="UNKWOWN_ERROR",o[o.IMPLEMENTATION_ERROR=1]="IMPLEMENTATION_ERROR",o[o.NO_CODE_FOUND_ERROR=2]="NO_CODE_FOUND_ERROR";var y=function(){function e(){}return e.createFrom=function(e){return{errorMessage:e,type:g.UNKWOWN_ERROR}},e}(),I=function(){function e(e){this.verbose=e}return e.prototype.log=function(e){this.verbose&&console.log(e)},e.prototype.warn=function(e){this.verbose&&console.warn(e)},e.prototype.logError=function(e,t){(this.verbose||!0===t)&&console.error(e)},e.prototype.logErrors=function(e){if(0===e.length)throw"Logger#logError called without arguments";this.verbose&&console.error(e)},e}();function S(e){return null==e}var _=function(){function e(){}return e.codeParseError=function(e){return"QR code parse error, error = ".concat(e)},e.errorGettingUserMedia=function(e){return"Error getting userMedia, error = ".concat(e)},e.onlyDeviceSupportedError=function(){return"The device doesn't support navigator.mediaDevices , only supported cameraIdOrConfig in this case is deviceId parameter (string)."},e.cameraStreamingNotSupported=function(){return"Camera streaming not supported by the browser."},e.unableToQuerySupportedDevices=function(){return"Unable to query supported devices, unknown error."},e.insecureContextCameraQueryError=function(){return"Camera access is only supported in secure context like https or localhost."},e.scannerPaused=function(){return"Scanner paused"},e}(),b=function(){function e(){}return e.scanningStatus=function(){return"Scanning"},e.idleStatus=function(){return"Idle"},e.errorStatus=function(){return"Error"},e.permissionStatus=function(){return"Permission"},e.noCameraFoundErrorStatus=function(){return"No Cameras"},e.lastMatch=function(e){return"Last Match: ".concat(e)},e.codeScannerTitle=function(){return"Code Scanner"},e.cameraPermissionTitle=function(){return"Request Camera Permissions"},e.cameraPermissionRequesting=function(){return"Requesting camera permissions..."},e.noCameraFound=function(){return"No camera found"},e.scanButtonStopScanningText=function(){return"Stop Scanning"},e.scanButtonStartScanningText=function(){return"Start Scanning"},e.torchOnButton=function(){return"Switch On Torch"},e.torchOffButton=function(){return"Switch Off Torch"},e.torchOnFailedMessage=function(){return"Failed to turn on torch"},e.torchOffFailedMessage=function(){return"Failed to turn off torch"},e.scanButtonScanningStarting=function(){return"Launching Camera..."},e.textIfCameraScanSelected=function(){return"Scan an Image File"},e.textIfFileScanSelected=function(){return"Scan using camera directly"},e.selectCamera=function(){return"Select Camera"},e.fileSelectionChooseImage=function(){return"Choose Image"},e.fileSelectionChooseAnother=function(){return"Choose Another"},e.fileSelectionNoImageSelected=function(){return"No image choosen"},e.anonymousCameraPrefix=function(){return"Anonymous Camera"},e.dragAndDropMessage=function(){return"Or drop an image to scan"},e.dragAndDropMessageOnlyImages=function(){return"Or drop an image to scan (other files not supported)"},e.zoom=function(){return"zoom"},e.loadingImage=function(){return"Loading image..."},e.cameraScanAltText=function(){return"Camera based scan"},e.fileScanAltText=function(){return"Fule based scan"},e}(),T=function(){function e(){}return e.poweredBy=function(){return"Powered by "},e.reportIssues=function(){return"Report issues"},e}(),N=function(){function e(){}return e.isMediaStreamConstraintsValid=function(e,t){if("object"!=typeof e){var r=typeof e;return t.logError("videoConstraints should be of type object, the "+"object passed is of type ".concat(r,"."),!0),!1}for(var n=new Set(["autoGainControl","channelCount","echoCancellation","latency","noiseSuppression","sampleRate","sampleSize","volume"]),i=Object.keys(e),o=0;o<i.length;o++){var a=i[o];if(n.has(a))return t.logError("".concat(a," is not supported videoConstaints."),!0),!1}return!0},e}(),M=r(103),D=function(){function e(e,t,r){if(this.formatMap=new Map([[h.QR_CODE,M.BarcodeFormat.QR_CODE],[h.AZTEC,M.BarcodeFormat.AZTEC],[h.CODABAR,M.BarcodeFormat.CODABAR],[h.CODE_39,M.BarcodeFormat.CODE_39],[h.CODE_93,M.BarcodeFormat.CODE_93],[h.CODE_128,M.BarcodeFormat.CODE_128],[h.DATA_MATRIX,M.BarcodeFormat.DATA_MATRIX],[h.MAXICODE,M.BarcodeFormat.MAXICODE],[h.ITF,M.BarcodeFormat.ITF],[h.EAN_13,M.BarcodeFormat.EAN_13],[h.EAN_8,M.BarcodeFormat.EAN_8],[h.PDF_417,M.BarcodeFormat.PDF_417],[h.RSS_14,M.BarcodeFormat.RSS_14],[h.RSS_EXPANDED,M.BarcodeFormat.RSS_EXPANDED],[h.UPC_A,M.BarcodeFormat.UPC_A],[h.UPC_E,M.BarcodeFormat.UPC_E],[h.UPC_EAN_EXTENSION,M.BarcodeFormat.UPC_EAN_EXTENSION]]),this.reverseFormatMap=this.createReverseFormatMap(),!M)throw"Use html5qrcode.min.js without edit, ZXing not found.";this.verbose=t,this.logger=r;var n=this.createZXingFormats(e),i=new Map;i.set(M.DecodeHintType.POSSIBLE_FORMATS,n),i.set(M.DecodeHintType.TRY_HARDER,!1),this.hints=i}return e.prototype.decodeAsync=function(e){var t=this;return new Promise(function(r,n){try{r(t.decode(e))}catch(e){n(e)}})},e.prototype.decode=function(e){var t=new M.MultiFormatReader(this.verbose,this.hints),r=new M.HTMLCanvasElementLuminanceSource(e),n=new M.BinaryBitmap(new M.HybridBinarizer(r)),i=t.decode(n);return{text:i.text,format:E.create(this.toHtml5QrcodeSupportedFormats(i.format)),debugData:this.createDebugData()}},e.prototype.createReverseFormatMap=function(){var e=new Map;return this.formatMap.forEach(function(t,r,n){e.set(t,r)}),e},e.prototype.toHtml5QrcodeSupportedFormats=function(e){if(!this.reverseFormatMap.has(e))throw"reverseFormatMap doesn't have ".concat(e);return this.reverseFormatMap.get(e)},e.prototype.createZXingFormats=function(e){for(var t=[],r=0;r<e.length;r++){var n=e[r];this.formatMap.has(n)?t.push(this.formatMap.get(n)):this.logger.logError("".concat(n," is not supported by")+"ZXingHtml5QrcodeShim")}return t},e.prototype.createDebugData=function(){return{decoderName:"zxing-js"}},e}(),O=function(e,t){var r,n,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(s){return function(l){var c=[s,l];if(r)throw TypeError("Generator is already executing.");for(;o&&(o=0,c[0]&&(a=0)),a;)try{if(r=1,n&&(i=2&c[0]?n.return:c[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,c[1])).done)return i;switch(n=0,i&&(c=[2&c[0],i.value]),c[0]){case 0:case 1:i=c;break;case 4:return a.label++,{value:c[1],done:!1};case 5:a.label++,n=c[1],c=[0];continue;case 7:c=a.ops.pop(),a.trys.pop();continue;default:if(!(i=(i=a.trys).length>0&&i[i.length-1])&&(6===c[0]||2===c[0])){a=0;continue}if(3===c[0]&&(!i||c[1]>i[0]&&c[1]<i[3])){a.label=c[1];break}if(6===c[0]&&a.label<i[1]){a.label=i[1],i=c;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(c);break}i[2]&&a.ops.pop(),a.trys.pop();continue}c=t.call(e,a)}catch(e){c=[6,e],n=0}finally{r=i=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}},R=function(){function e(t,r,n){if(this.formatMap=new Map([[h.QR_CODE,"qr_code"],[h.AZTEC,"aztec"],[h.CODABAR,"codabar"],[h.CODE_39,"code_39"],[h.CODE_93,"code_93"],[h.CODE_128,"code_128"],[h.DATA_MATRIX,"data_matrix"],[h.ITF,"itf"],[h.EAN_13,"ean_13"],[h.EAN_8,"ean_8"],[h.PDF_417,"pdf417"],[h.UPC_A,"upc_a"],[h.UPC_E,"upc_e"]]),this.reverseFormatMap=this.createReverseFormatMap(),!e.isSupported())throw"Use html5qrcode.min.js without edit, Use BarcodeDetectorDelegate only if it isSupported();";this.verbose=r,this.logger=n;var i=this.createBarcodeDetectorFormats(t);if(this.detector=new BarcodeDetector(i),!this.detector)throw"BarcodeDetector detector not supported"}return e.isSupported=function(){return"BarcodeDetector"in window&&(new BarcodeDetector({formats:["qr_code"]}),!0)},e.prototype.decodeAsync=function(e){var t,r,n,i;return t=this,r=void 0,n=void 0,i=function(){var t,r;return O(this,function(n){switch(n.label){case 0:return[4,this.detector.detect(e)];case 1:if(!(t=n.sent())||0===t.length)throw"No barcode or QR code detected.";return[2,{text:(r=this.selectLargestBarcode(t)).rawValue,format:E.create(this.toHtml5QrcodeSupportedFormats(r.format)),debugData:this.createDebugData()}]}})},new(n||(n=Promise))(function(e,o){function a(e){try{l(i.next(e))}catch(e){o(e)}}function s(e){try{l(i.throw(e))}catch(e){o(e)}}function l(t){var r;t.done?e(t.value):((r=t.value)instanceof n?r:new n(function(e){e(r)})).then(a,s)}l((i=i.apply(t,r||[])).next())})},e.prototype.selectLargestBarcode=function(e){for(var t=null,r=0,n=0;n<e.length;n++){var i=e[n],o=i.boundingBox.width*i.boundingBox.height;o>r&&(r=o,t=i)}if(!t)throw"No largest barcode found";return t},e.prototype.createBarcodeDetectorFormats=function(e){for(var t=[],r=0;r<e.length;r++){var n=e[r];this.formatMap.has(n)?t.push(this.formatMap.get(n)):this.logger.warn("".concat(n," is not supported by")+"BarcodeDetectorDelegate")}return{formats:t}},e.prototype.toHtml5QrcodeSupportedFormats=function(e){if(!this.reverseFormatMap.has(e))throw"reverseFormatMap doesn't have ".concat(e);return this.reverseFormatMap.get(e)},e.prototype.createReverseFormatMap=function(){var e=new Map;return this.formatMap.forEach(function(t,r,n){e.set(t,r)}),e},e.prototype.createDebugData=function(){return{decoderName:"BarcodeDetector"}},e}(),v=function(e,t,r,n){return new(r||(r=Promise))(function(i,o){function a(e){try{l(n.next(e))}catch(e){o(e)}}function s(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(a,s)}l((n=n.apply(e,t||[])).next())})},P=function(e,t){var r,n,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(s){return function(l){var c=[s,l];if(r)throw TypeError("Generator is already executing.");for(;o&&(o=0,c[0]&&(a=0)),a;)try{if(r=1,n&&(i=2&c[0]?n.return:c[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,c[1])).done)return i;switch(n=0,i&&(c=[2&c[0],i.value]),c[0]){case 0:case 1:i=c;break;case 4:return a.label++,{value:c[1],done:!1};case 5:a.label++,n=c[1],c=[0];continue;case 7:c=a.ops.pop(),a.trys.pop();continue;default:if(!(i=(i=a.trys).length>0&&i[i.length-1])&&(6===c[0]||2===c[0])){a=0;continue}if(3===c[0]&&(!i||c[1]>i[0]&&c[1]<i[3])){a.label=c[1];break}if(6===c[0]&&a.label<i[1]){a.label=i[1],i=c;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(c);break}i[2]&&a.ops.pop(),a.trys.pop();continue}c=t.call(e,a)}catch(e){c=[6,e],n=0}finally{r=i=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}},B=function(){function e(e,t,r,n){this.EXECUTIONS_TO_REPORT_PERFORMANCE=100,this.executions=0,this.executionResults=[],this.wasPrimaryDecoderUsedInLastDecode=!1,this.verbose=r,t&&R.isSupported()?(this.primaryDecoder=new R(e,r,n),this.secondaryDecoder=new D(e,r,n)):this.primaryDecoder=new D(e,r,n)}return e.prototype.decodeAsync=function(e){return v(this,void 0,void 0,function(){var t;return P(this,function(r){switch(r.label){case 0:t=performance.now(),r.label=1;case 1:return r.trys.push([1,,3,4]),[4,this.getDecoder().decodeAsync(e)];case 2:return[2,r.sent()];case 3:return this.possiblyLogPerformance(t),[7];case 4:return[2]}})})},e.prototype.decodeRobustlyAsync=function(e){return v(this,void 0,void 0,function(){var t,r;return P(this,function(n){switch(n.label){case 0:t=performance.now(),n.label=1;case 1:return n.trys.push([1,3,4,5]),[4,this.primaryDecoder.decodeAsync(e)];case 2:return[2,n.sent()];case 3:if(r=n.sent(),this.secondaryDecoder)return[2,this.secondaryDecoder.decodeAsync(e)];throw r;case 4:return this.possiblyLogPerformance(t),[7];case 5:return[2]}})})},e.prototype.getDecoder=function(){return this.secondaryDecoder?!1===this.wasPrimaryDecoderUsedInLastDecode?(this.wasPrimaryDecoderUsedInLastDecode=!0,this.primaryDecoder):(this.wasPrimaryDecoderUsedInLastDecode=!1,this.secondaryDecoder):this.primaryDecoder},e.prototype.possiblyLogPerformance=function(e){if(this.verbose){var t=performance.now()-e;this.executionResults.push(t),this.executions++,this.possiblyFlushPerformanceReport()}},e.prototype.possiblyFlushPerformanceReport=function(){if(!(this.executions<this.EXECUTIONS_TO_REPORT_PERFORMANCE)){for(var e=0,t=0,r=this.executionResults;t<r.length;t++)e+=r[t];var n=e/this.executionResults.length;console.log("".concat(n," ms for ").concat(this.executionResults.length," last runs.")),this.executions=0,this.executionResults=[]}},e}(),x=(a=function(e,t){return(a=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}a(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),L=function(e,t,r,n){return new(r||(r=Promise))(function(i,o){function a(e){try{l(n.next(e))}catch(e){o(e)}}function s(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(a,s)}l((n=n.apply(e,t||[])).next())})},k=function(e,t){var r,n,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(s){return function(l){var c=[s,l];if(r)throw TypeError("Generator is already executing.");for(;o&&(o=0,c[0]&&(a=0)),a;)try{if(r=1,n&&(i=2&c[0]?n.return:c[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,c[1])).done)return i;switch(n=0,i&&(c=[2&c[0],i.value]),c[0]){case 0:case 1:i=c;break;case 4:return a.label++,{value:c[1],done:!1};case 5:a.label++,n=c[1],c=[0];continue;case 7:c=a.ops.pop(),a.trys.pop();continue;default:if(!(i=(i=a.trys).length>0&&i[i.length-1])&&(6===c[0]||2===c[0])){a=0;continue}if(3===c[0]&&(!i||c[1]>i[0]&&c[1]<i[3])){a.label=c[1];break}if(6===c[0]&&a.label<i[1]){a.label=i[1],i=c;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(c);break}i[2]&&a.ops.pop(),a.trys.pop();continue}c=t.call(e,a)}catch(e){c=[6,e],n=0}finally{r=i=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}},F=function(){function e(e,t){this.name=e,this.track=t}return e.prototype.isSupported=function(){return!!this.track.getCapabilities&&this.name in this.track.getCapabilities()},e.prototype.apply=function(e){var t={};return t[this.name]=e,this.track.applyConstraints({advanced:[t]})},e.prototype.value=function(){var e=this.track.getSettings();return this.name in e?e[this.name]:null},e}(),U=function(e){function t(t){return e.call(this,"zoom",t)||this}return x(t,e),t}(function(e){function t(t,r){return e.call(this,t,r)||this}return x(t,e),t.prototype.min=function(){return this.getCapabilities().min},t.prototype.max=function(){return this.getCapabilities().max},t.prototype.step=function(){return this.getCapabilities().step},t.prototype.apply=function(e){var t={};return t[this.name]=e,this.track.applyConstraints({advanced:[t]})},t.prototype.getCapabilities=function(){this.failIfNotSupported();var e=this.track.getCapabilities()[this.name];return{min:e.min,max:e.max,step:e.step}},t.prototype.failIfNotSupported=function(){if(!this.isSupported())throw Error("".concat(this.name," capability not supported"))},t}(F)),H=function(e){function t(t){return e.call(this,"torch",t)||this}return x(t,e),t}(F),z=function(){function e(e){this.track=e}return e.prototype.zoomFeature=function(){return new U(this.track)},e.prototype.torchFeature=function(){return new H(this.track)},e}(),V=function(){function e(e,t,r){this.isClosed=!1,this.parentElement=e,this.mediaStream=t,this.callbacks=r,this.surface=this.createVideoElement(this.parentElement.clientWidth),e.append(this.surface)}return e.prototype.createVideoElement=function(e){var t=document.createElement("video");return t.style.width="".concat(e,"px"),t.style.display="block",t.muted=!0,t.setAttribute("muted","true"),t.playsInline=!0,t},e.prototype.setupSurface=function(){var e=this;this.surface.onabort=function(){throw"RenderedCameraImpl video surface onabort() called"},this.surface.onerror=function(){throw"RenderedCameraImpl video surface onerror() called"};var t=function(){var r=e.surface.clientWidth,n=e.surface.clientHeight;e.callbacks.onRenderSurfaceReady(r,n),e.surface.removeEventListener("playing",t)};this.surface.addEventListener("playing",t),this.surface.srcObject=this.mediaStream,this.surface.play()},e.create=function(t,r,n,i){return L(this,void 0,void 0,function(){var o,a;return k(this,function(s){switch(s.label){case 0:if(o=new e(t,r,i),!n.aspectRatio)return[3,2];return a={aspectRatio:n.aspectRatio},[4,o.getFirstTrackOrFail().applyConstraints(a)];case 1:s.sent(),s.label=2;case 2:return o.setupSurface(),[2,o]}})})},e.prototype.failIfClosed=function(){if(this.isClosed)throw"The RenderedCamera has already been closed."},e.prototype.getFirstTrackOrFail=function(){if(this.failIfClosed(),0===this.mediaStream.getVideoTracks().length)throw"No video tracks found";return this.mediaStream.getVideoTracks()[0]},e.prototype.pause=function(){this.failIfClosed(),this.surface.pause()},e.prototype.resume=function(e){this.failIfClosed();var t=this,r=function(){setTimeout(e,200),t.surface.removeEventListener("playing",r)};this.surface.addEventListener("playing",r),this.surface.play()},e.prototype.isPaused=function(){return this.failIfClosed(),this.surface.paused},e.prototype.getSurface=function(){return this.failIfClosed(),this.surface},e.prototype.getRunningTrackCapabilities=function(){return this.getFirstTrackOrFail().getCapabilities()},e.prototype.getRunningTrackSettings=function(){return this.getFirstTrackOrFail().getSettings()},e.prototype.applyVideoConstraints=function(e){return L(this,void 0,void 0,function(){return k(this,function(t){if("aspectRatio"in e)throw"Changing 'aspectRatio' in run-time is not yet supported.";return[2,this.getFirstTrackOrFail().applyConstraints(e)]})})},e.prototype.close=function(){if(this.isClosed)return Promise.resolve();var e=this;return new Promise(function(t,r){var n=e.mediaStream.getVideoTracks().length,i=0;e.mediaStream.getVideoTracks().forEach(function(r){e.mediaStream.removeTrack(r),r.stop(),++i>=n&&(e.isClosed=!0,e.parentElement.removeChild(e.surface),t())})})},e.prototype.getCapabilities=function(){return new z(this.getFirstTrackOrFail())},e}(),j=function(){function e(e){this.mediaStream=e}return e.prototype.render=function(e,t,r){return L(this,void 0,void 0,function(){return k(this,function(n){return[2,V.create(e,this.mediaStream,t,r)]})})},e.create=function(t){return L(this,void 0,void 0,function(){var r;return k(this,function(n){switch(n.label){case 0:if(!navigator.mediaDevices)throw"navigator.mediaDevices not supported";return r={audio:!1,video:t},[4,navigator.mediaDevices.getUserMedia(r)];case 1:return[2,new e(n.sent())]}})})},e}(),G=function(e,t,r,n){return new(r||(r=Promise))(function(i,o){function a(e){try{l(n.next(e))}catch(e){o(e)}}function s(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(a,s)}l((n=n.apply(e,t||[])).next())})},W=function(e,t){var r,n,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(s){return function(l){var c=[s,l];if(r)throw TypeError("Generator is already executing.");for(;o&&(o=0,c[0]&&(a=0)),a;)try{if(r=1,n&&(i=2&c[0]?n.return:c[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,c[1])).done)return i;switch(n=0,i&&(c=[2&c[0],i.value]),c[0]){case 0:case 1:i=c;break;case 4:return a.label++,{value:c[1],done:!1};case 5:a.label++,n=c[1],c=[0];continue;case 7:c=a.ops.pop(),a.trys.pop();continue;default:if(!(i=(i=a.trys).length>0&&i[i.length-1])&&(6===c[0]||2===c[0])){a=0;continue}if(3===c[0]&&(!i||c[1]>i[0]&&c[1]<i[3])){a.label=c[1];break}if(6===c[0]&&a.label<i[1]){a.label=i[1],i=c;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(c);break}i[2]&&a.ops.pop(),a.trys.pop();continue}c=t.call(e,a)}catch(e){c=[6,e],n=0}finally{r=i=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}},Y=function(){function e(){}return e.failIfNotSupported=function(){return G(this,void 0,void 0,function(){return W(this,function(t){if(!navigator.mediaDevices)throw"navigator.mediaDevices not supported";return[2,new e]})})},e.prototype.create=function(e){return G(this,void 0,void 0,function(){return W(this,function(t){return[2,j.create(e)]})})},e}(),X=function(e,t){var r,n,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(s){return function(l){var c=[s,l];if(r)throw TypeError("Generator is already executing.");for(;o&&(o=0,c[0]&&(a=0)),a;)try{if(r=1,n&&(i=2&c[0]?n.return:c[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,c[1])).done)return i;switch(n=0,i&&(c=[2&c[0],i.value]),c[0]){case 0:case 1:i=c;break;case 4:return a.label++,{value:c[1],done:!1};case 5:a.label++,n=c[1],c=[0];continue;case 7:c=a.ops.pop(),a.trys.pop();continue;default:if(!(i=(i=a.trys).length>0&&i[i.length-1])&&(6===c[0]||2===c[0])){a=0;continue}if(3===c[0]&&(!i||c[1]>i[0]&&c[1]<i[3])){a.label=c[1];break}if(6===c[0]&&a.label<i[1]){a.label=i[1],i=c;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(c);break}i[2]&&a.ops.pop(),a.trys.pop();continue}c=t.call(e,a)}catch(e){c=[6,e],n=0}finally{r=i=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}},Z=function(){function e(){}return e.retrieve=function(){if(navigator.mediaDevices)return e.getCamerasFromMediaDevices();var t=MediaStreamTrack;return MediaStreamTrack&&t.getSources?e.getCamerasFromMediaStreamTrack():e.rejectWithError()},e.rejectWithError=function(){var t=_.unableToQuerySupportedDevices();return e.isHttpsOrLocalhost()||(t=_.insecureContextCameraQueryError()),Promise.reject(t)},e.isHttpsOrLocalhost=function(){if("https:"===location.protocol)return!0;var e=location.host.split(":")[0];return"127.0.0.1"===e||"localhost"===e},e.getCamerasFromMediaDevices=function(){var e,t,r,n;return e=this,t=void 0,r=void 0,n=function(){var e,t,r,n,i,o,a;return X(this,function(s){switch(s.label){case 0:return e=function(e){for(var t=e.getVideoTracks(),r=0;r<t.length;r++){var n=t[r];n.enabled=!1,n.stop(),e.removeTrack(n)}},[4,navigator.mediaDevices.getUserMedia({audio:!1,video:!0})];case 1:return t=s.sent(),[4,navigator.mediaDevices.enumerateDevices()];case 2:for(i=0,r=s.sent(),n=[],o=r;i<o.length;i++)"videoinput"===(a=o[i]).kind&&n.push({id:a.deviceId,label:a.label});return e(t),[2,n]}})},new(r||(r=Promise))(function(i,o){function a(e){try{l(n.next(e))}catch(e){o(e)}}function s(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(a,s)}l((n=n.apply(e,t||[])).next())})},e.getCamerasFromMediaStreamTrack=function(){return new Promise(function(e,t){MediaStreamTrack.getSources(function(t){for(var r=[],n=0;n<t.length;n++){var i=t[n];"video"===i.kind&&r.push({id:i.id,label:i.label})}e(r)})})},e}();(s=p||(p={}))[s.UNKNOWN=0]="UNKNOWN",s[s.NOT_STARTED=1]="NOT_STARTED",s[s.SCANNING=2]="SCANNING",s[s.PAUSED=3]="PAUSED";var Q=function(){function e(){this.state=p.NOT_STARTED,this.onGoingTransactionNewState=p.UNKNOWN}return e.prototype.directTransition=function(e){this.failIfTransitionOngoing(),this.validateTransition(e),this.state=e},e.prototype.startTransition=function(e){return this.failIfTransitionOngoing(),this.validateTransition(e),this.onGoingTransactionNewState=e,this},e.prototype.execute=function(){if(this.onGoingTransactionNewState===p.UNKNOWN)throw"Transaction is already cancelled, cannot execute().";var e=this.onGoingTransactionNewState;this.onGoingTransactionNewState=p.UNKNOWN,this.directTransition(e)},e.prototype.cancel=function(){if(this.onGoingTransactionNewState===p.UNKNOWN)throw"Transaction is already cancelled, cannot cancel().";this.onGoingTransactionNewState=p.UNKNOWN},e.prototype.getState=function(){return this.state},e.prototype.failIfTransitionOngoing=function(){if(this.onGoingTransactionNewState!==p.UNKNOWN)throw"Cannot transition to a new state, already under transition"},e.prototype.validateTransition=function(e){switch(this.state){case p.UNKNOWN:throw"Transition from unknown is not allowed";case p.NOT_STARTED:this.failIfNewStateIs(e,[p.PAUSED]);case p.SCANNING:case p.PAUSED:}},e.prototype.failIfNewStateIs=function(e,t){for(var r=0;r<t.length;r++)if(e===t[r])throw"Cannot transition from ".concat(this.state," to ").concat(e)},e}(),q=function(){function e(e){this.stateManager=e}return e.prototype.startTransition=function(e){return this.stateManager.startTransition(e)},e.prototype.directTransition=function(e){this.stateManager.directTransition(e)},e.prototype.getState=function(){return this.stateManager.getState()},e.prototype.canScanFile=function(){return this.stateManager.getState()===p.NOT_STARTED},e.prototype.isScanning=function(){return this.stateManager.getState()!==p.NOT_STARTED},e.prototype.isStrictlyScanning=function(){return this.stateManager.getState()===p.SCANNING},e.prototype.isPaused=function(){return this.stateManager.getState()===p.PAUSED},e}(),K=function(){function e(){}return e.create=function(){return new q(new Q)},e}(),$=(l=function(e,t){return(l=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}l(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),J=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return $(t,e),t.DEFAULT_WIDTH=300,t.DEFAULT_WIDTH_OFFSET=2,t.FILE_SCAN_MIN_HEIGHT=300,t.FILE_SCAN_HIDDEN_CANVAS_PADDING=100,t.MIN_QR_BOX_SIZE=50,t.SHADED_LEFT=1,t.SHADED_RIGHT=2,t.SHADED_TOP=3,t.SHADED_BOTTOM=4,t.SHADED_REGION_ELEMENT_ID="qr-shaded-region",t.VERBOSE=!1,t.BORDER_SHADER_DEFAULT_COLOR="#ffffff",t.BORDER_SHADER_MATCH_COLOR="rgb(90, 193, 56)",t}(C),ee=function(){function e(e,t){this.logger=t,this.fps=J.SCAN_DEFAULT_FPS,e?(e.fps&&(this.fps=e.fps),this.disableFlip=!0===e.disableFlip,this.qrbox=e.qrbox,this.aspectRatio=e.aspectRatio,this.videoConstraints=e.videoConstraints):this.disableFlip=J.DEFAULT_DISABLE_FLIP}return e.prototype.isMediaStreamConstraintsValid=function(){return this.videoConstraints?N.isMediaStreamConstraintsValid(this.videoConstraints,this.logger):(this.logger.logError("Empty videoConstraints",!0),!1)},e.prototype.isShadedBoxEnabled=function(){return!S(this.qrbox)},e.create=function(t,r){return new e(t,r)},e}(),et=function(){function e(e,t){var r;if(this.element=null,this.canvasElement=null,this.scannerPausedUiElement=null,this.hasBorderShaders=null,this.borderShaders=null,this.qrMatch=null,this.renderedCamera=null,this.qrRegion=null,this.context=null,this.lastScanImageFile=null,this.isScanning=!1,!document.getElementById(e))throw"HTML Element with id=".concat(e," not found");this.elementId=e,this.verbose=!1,"boolean"==typeof t?this.verbose=!0===t:t&&(r=t,this.verbose=!0===r.verbose,r.experimentalFeatures),this.logger=new I(this.verbose),this.qrcode=new B(this.getSupportedFormats(t),this.getUseBarCodeDetectorIfSupported(r),this.verbose,this.logger),this.foreverScanTimeout,this.shouldScan=!0,this.stateManagerProxy=K.create()}return e.prototype.start=function(e,t,r,n){var i,o=this;if(!e)throw"cameraIdOrConfig is required";if(!r||"function"!=typeof r)throw"qrCodeSuccessCallback is required and should be a function.";i=n||(this.verbose?this.logger.log:function(){});var a=ee.create(t,this.logger);this.clearElement();var s=!1;a.videoConstraints&&(a.isMediaStreamConstraintsValid()?s=!0:this.logger.logError("'videoConstraints' is not valid 'MediaStreamConstraints, it will be ignored.'",!0));var l=s,c=document.getElementById(this.elementId);c.clientWidth?c.clientWidth:J.DEFAULT_WIDTH,c.style.position="relative",this.shouldScan=!0,this.element=c;var u=this,h=this.stateManagerProxy.startTransition(p.SCANNING);return new Promise(function(t,n){var s=l?a.videoConstraints:u.createVideoConstraints(e);if(!s){h.cancel(),n("videoConstraints should be defined");return}var c={};(!l||a.aspectRatio)&&(c.aspectRatio=a.aspectRatio);var d={onRenderSurfaceReady:function(e,t){u.setupUi(e,t,a),u.isScanning=!0,u.foreverScan(a,r,i)}};Y.failIfNotSupported().then(function(e){e.create(s).then(function(e){return e.render(o.element,c,d).then(function(e){u.renderedCamera=e,h.execute(),t(null)}).catch(function(e){h.cancel(),n(e)})}).catch(function(e){h.cancel(),n(_.errorGettingUserMedia(e))})}).catch(function(e){h.cancel(),n(_.cameraStreamingNotSupported())})})},e.prototype.pause=function(e){if(!this.stateManagerProxy.isStrictlyScanning())throw"Cannot pause, scanner is not scanning.";this.stateManagerProxy.directTransition(p.PAUSED),this.showPausedState(),(S(e)||!0!==e)&&(e=!1),e&&this.renderedCamera&&this.renderedCamera.pause()},e.prototype.resume=function(){if(!this.stateManagerProxy.isPaused())throw"Cannot result, scanner is not paused.";if(!this.renderedCamera)throw"renderedCamera doesn't exist while trying resume()";var e=this,t=function(){e.stateManagerProxy.directTransition(p.SCANNING),e.hidePausedState()};if(!this.renderedCamera.isPaused())return void t();this.renderedCamera.resume(function(){t()})},e.prototype.getState=function(){return this.stateManagerProxy.getState()},e.prototype.stop=function(){var e=this;if(!this.stateManagerProxy.isScanning())throw"Cannot stop, scanner is not running or paused.";var t=this.stateManagerProxy.startTransition(p.NOT_STARTED);this.shouldScan=!1,this.foreverScanTimeout&&clearTimeout(this.foreverScanTimeout);var r=function(){if(e.element){var t=document.getElementById(J.SHADED_REGION_ELEMENT_ID);t&&e.element.removeChild(t)}},n=this;return this.renderedCamera.close().then(function(){return n.renderedCamera=null,n.element&&(n.element.removeChild(n.canvasElement),n.canvasElement=null),r(),n.qrRegion&&(n.qrRegion=null),n.context&&(n.context=null),t.execute(),n.hidePausedState(),n.isScanning=!1,Promise.resolve()})},e.prototype.scanFile=function(e,t){return this.scanFileV2(e,t).then(function(e){return e.decodedText})},e.prototype.scanFileV2=function(e,t){var r=this;if(!e||!(e instanceof File))throw"imageFile argument is mandatory and should be instance of File. Use 'event.target.files[0]'.";if(S(t)&&(t=!0),!this.stateManagerProxy.canScanFile())throw"Cannot start file scan - ongoing camera scan";return new Promise(function(n,i){r.possiblyCloseLastScanImageFile(),r.clearElement(),r.lastScanImageFile=URL.createObjectURL(e);var o=new Image;o.onload=function(){var e=o.width,a=o.height,s=document.getElementById(r.elementId),l=s.clientWidth?s.clientWidth:J.DEFAULT_WIDTH,c=Math.max(s.clientHeight?s.clientHeight:a,J.FILE_SCAN_MIN_HEIGHT),u=r.computeCanvasDrawConfig(e,a,l,c);if(t){var h=r.createCanvasElement(l,c,"qr-canvas-visible");h.style.display="inline-block",s.appendChild(h);var d=h.getContext("2d");if(!d)throw"Unable to get 2d context from canvas";d.canvas.width=l,d.canvas.height=c,d.drawImage(o,0,0,e,a,u.x,u.y,u.width,u.height)}var f=J.FILE_SCAN_HIDDEN_CANVAS_PADDING,g=Math.max(o.width,u.width),p=Math.max(o.height,u.height),m=g+2*f,w=p+2*f,C=r.createCanvasElement(m,w);s.appendChild(C);var E=C.getContext("2d");if(!E)throw"Unable to get 2d context from canvas";E.canvas.width=m,E.canvas.height=w,E.drawImage(o,0,0,e,a,f,f,g,p);try{r.qrcode.decodeRobustlyAsync(C).then(function(e){n(A.createFromQrcodeResult(e))}).catch(i)}catch(e){i("QR code parse error, error = ".concat(e))}},o.onerror=i,o.onabort=i,o.onstalled=i,o.onsuspend=i,o.src=URL.createObjectURL(e)})},e.prototype.clear=function(){this.clearElement()},e.getCameras=function(){return Z.retrieve()},e.prototype.getRunningTrackCapabilities=function(){return this.getRenderedCameraOrFail().getRunningTrackCapabilities()},e.prototype.getRunningTrackSettings=function(){return this.getRenderedCameraOrFail().getRunningTrackSettings()},e.prototype.getRunningTrackCameraCapabilities=function(){return this.getRenderedCameraOrFail().getCapabilities()},e.prototype.applyVideoConstraints=function(e){if(e){if(!N.isMediaStreamConstraintsValid(e,this.logger))throw"invalid videoConstaints passed, check logs for more details"}else throw"videoConstaints is required argument.";return this.getRenderedCameraOrFail().applyVideoConstraints(e)},e.prototype.getRenderedCameraOrFail=function(){if(null==this.renderedCamera)throw"Scanning is not in running state, call this API only when QR code scanning using camera is in running state.";return this.renderedCamera},e.prototype.getSupportedFormats=function(e){var t=[h.QR_CODE,h.AZTEC,h.CODABAR,h.CODE_39,h.CODE_93,h.CODE_128,h.DATA_MATRIX,h.MAXICODE,h.ITF,h.EAN_13,h.EAN_8,h.PDF_417,h.RSS_14,h.RSS_EXPANDED,h.UPC_A,h.UPC_E,h.UPC_EAN_EXTENSION];if(!e||"boolean"==typeof e||!e.formatsToSupport)return t;if(!Array.isArray(e.formatsToSupport))throw"configOrVerbosityFlag.formatsToSupport should be undefined or an array.";if(0===e.formatsToSupport.length)throw"Atleast 1 formatsToSupport is needed.";for(var r=[],n=0,i=e.formatsToSupport;n<i.length;n++){var o=i[n];Object.values(h).includes(o)?r.push(o):this.logger.warn("Invalid format: ".concat(o," passed in config, ignoring."))}if(0===r.length)throw"None of formatsToSupport match supported values.";return r},e.prototype.getUseBarCodeDetectorIfSupported=function(e){if(S(e))return!0;if(!S(e.useBarCodeDetectorIfSupported))return!1!==e.useBarCodeDetectorIfSupported;if(S(e.experimentalFeatures))return!0;var t=e.experimentalFeatures;return!!S(t.useBarCodeDetectorIfSupported)||!1!==t.useBarCodeDetectorIfSupported},e.prototype.validateQrboxSize=function(e,t,r){var n,i=r.qrbox;this.validateQrboxConfig(i);var o=this.toQrdimensions(e,t,i),a=function(e){if(e<J.MIN_QR_BOX_SIZE)throw"minimum size of 'config.qrbox' dimension value is"+" ".concat(J.MIN_QR_BOX_SIZE,"px.")};a(o.width),a(o.height),(n=o.width)>e&&(this.logger.warn("`qrbox.width` or `qrbox` is larger than the width of the root element. The width will be truncated to the width of root element."),n=e),o.width=n},e.prototype.validateQrboxConfig=function(e){if("number"!=typeof e&&"function"!=typeof e&&(void 0===e.width||void 0===e.height))throw"Invalid instance of QrDimensions passed for 'config.qrbox'. Both 'width' and 'height' should be set."},e.prototype.toQrdimensions=function(e,t,r){if("number"==typeof r)return{width:r,height:r};if("function"==typeof r)try{return r(e,t)}catch(e){throw Error("qrbox config was passed as a function but it failed with unknown error"+e)}return r},e.prototype.setupUi=function(e,t,r){r.isShadedBoxEnabled()&&this.validateQrboxSize(e,t,r);var n=S(r.qrbox)?{width:e,height:t}:r.qrbox;this.validateQrboxConfig(n);var i=this.toQrdimensions(e,t,n);i.height>t&&this.logger.warn("[Html5Qrcode] config.qrbox has height that isgreater than the height of the video stream. Shading will be ignored");var o=r.isShadedBoxEnabled()&&i.height<=t,a=o?this.getShadedRegionBounds(e,t,i):{x:0,y:0,width:e,height:t},s=this.createCanvasElement(a.width,a.height),l=s.getContext("2d",{willReadFrequently:!0});l.canvas.width=a.width,l.canvas.height=a.height,this.element.append(s),o&&this.possiblyInsertShadingElement(this.element,e,t,i),this.createScannerPausedUiElement(this.element),this.qrRegion=a,this.context=l,this.canvasElement=s},e.prototype.createScannerPausedUiElement=function(e){var t=document.createElement("div");t.innerText=_.scannerPaused(),t.style.display="none",t.style.position="absolute",t.style.top="0px",t.style.zIndex="1",t.style.background="rgba(9, 9, 9, 0.46)",t.style.color="#FFECEC",t.style.textAlign="center",t.style.width="100%",e.appendChild(t),this.scannerPausedUiElement=t},e.prototype.scanContext=function(e,t){var r=this;return this.stateManagerProxy.isPaused()?Promise.resolve(!1):this.qrcode.decodeAsync(this.canvasElement).then(function(t){return e(t.text,A.createFromQrcodeResult(t)),r.possiblyUpdateShaders(!0),!0}).catch(function(e){r.possiblyUpdateShaders(!1);var n=_.codeParseError(e);return t(n,y.createFrom(n)),!1})},e.prototype.foreverScan=function(e,t,r){var n=this;if(this.shouldScan&&this.renderedCamera){var i=this.renderedCamera.getSurface(),o=i.videoWidth/i.clientWidth,a=i.videoHeight/i.clientHeight;if(!this.qrRegion)throw"qrRegion undefined when localMediaStream is ready.";var s=this.qrRegion.width*o,l=this.qrRegion.height*a,c=this.qrRegion.x*o,u=this.qrRegion.y*a;this.context.drawImage(i,c,u,s,l,0,0,this.qrRegion.width,this.qrRegion.height);var h=function(){n.foreverScanTimeout=setTimeout(function(){n.foreverScan(e,t,r)},n.getTimeoutFps(e.fps))};this.scanContext(t,r).then(function(i){i||!0===e.disableFlip?h():(n.context.translate(n.context.canvas.width,0),n.context.scale(-1,1),n.scanContext(t,r).finally(function(){h()}))}).catch(function(e){n.logger.logError("Error happend while scanning context",e),h()})}},e.prototype.createVideoConstraints=function(e){if("string"==typeof e)return{deviceId:{exact:e}};if("object"==typeof e){var t="facingMode",r="deviceId",n={user:!0,environment:!0},i="exact",o=function(e){if(e in n)return!0;throw"config has invalid 'facingMode' value = "+"'".concat(e,"'")},a=Object.keys(e);if(1!==a.length)throw"'cameraIdOrConfig' object should have exactly 1 key,"+" if passed as an object, found ".concat(a.length," keys");var s=Object.keys(e)[0];if(s!==t&&s!==r)throw"Only '".concat(t,"' and '").concat(r,"' ")+" are supported for 'cameraIdOrConfig'";if(s===t){var l=e.facingMode;if("string"==typeof l){if(o(l))return{facingMode:l}}else if("object"==typeof l)if(i in l){if(o(l["".concat(i)]))return{facingMode:{exact:l["".concat(i)]}}}else throw"'facingMode' should be string or object with"+" ".concat(i," as key.");else{var c=typeof l;throw"Invalid type of 'facingMode' = ".concat(c)}}else{var u=e.deviceId;if("string"==typeof u)return{deviceId:u};if("object"==typeof u)if(i in u)return{deviceId:{exact:u["".concat(i)]}};else throw"'deviceId' should be string or object with"+" ".concat(i," as key.");var h=typeof u;throw"Invalid type of 'deviceId' = ".concat(h)}}var d=typeof e;throw"Invalid type of 'cameraIdOrConfig' = ".concat(d)},e.prototype.computeCanvasDrawConfig=function(e,t,r,n){if(e<=r&&t<=n)return{x:(r-e)/2,y:(n-t)/2,width:e,height:t};var i=e,o=t;return e>r&&(t=r/e*t,e=r),t>n&&(e=n/t*e,t=n),this.logger.log("Image downsampled from "+"".concat(i,"X").concat(o)+" to ".concat(e,"X").concat(t,".")),this.computeCanvasDrawConfig(e,t,r,n)},e.prototype.clearElement=function(){if(this.stateManagerProxy.isScanning())throw"Cannot clear while scan is ongoing, close it first.";var e=document.getElementById(this.elementId);e&&(e.innerHTML="")},e.prototype.possiblyUpdateShaders=function(e){this.qrMatch!==e&&(this.hasBorderShaders&&this.borderShaders&&this.borderShaders.length&&this.borderShaders.forEach(function(t){t.style.backgroundColor=e?J.BORDER_SHADER_MATCH_COLOR:J.BORDER_SHADER_DEFAULT_COLOR}),this.qrMatch=e)},e.prototype.possiblyCloseLastScanImageFile=function(){this.lastScanImageFile&&(URL.revokeObjectURL(this.lastScanImageFile),this.lastScanImageFile=null)},e.prototype.createCanvasElement=function(e,t,r){var n=document.createElement("canvas");return n.style.width="".concat(e,"px"),n.style.height="".concat(t,"px"),n.style.display="none",n.id=S(r)?"qr-canvas":r,n},e.prototype.getShadedRegionBounds=function(e,t,r){if(r.width>e||r.height>t)throw"'config.qrbox' dimensions should not be greater than the dimensions of the root HTML element.";return{x:(e-r.width)/2,y:(t-r.height)/2,width:r.width,height:r.height}},e.prototype.possiblyInsertShadingElement=function(e,t,r,n){if(!(t-n.width<1)&&!(r-n.height<1)){var i=document.createElement("div");i.style.position="absolute";var o=(t-n.width)/2,a=(r-n.height)/2;i.style.borderLeft="".concat(o,"px solid rgba(0, 0, 0, 0.48)"),i.style.borderRight="".concat(o,"px solid rgba(0, 0, 0, 0.48)"),i.style.borderTop="".concat(a,"px solid rgba(0, 0, 0, 0.48)"),i.style.borderBottom="".concat(a,"px solid rgba(0, 0, 0, 0.48)"),i.style.boxSizing="border-box",i.style.top="0px",i.style.bottom="0px",i.style.left="0px",i.style.right="0px",i.id="".concat(J.SHADED_REGION_ELEMENT_ID),t-n.width<11||r-n.height<11?this.hasBorderShaders=!1:(this.insertShaderBorders(i,40,5,-5,null,0,!0),this.insertShaderBorders(i,40,5,-5,null,0,!1),this.insertShaderBorders(i,40,5,null,-5,0,!0),this.insertShaderBorders(i,40,5,null,-5,0,!1),this.insertShaderBorders(i,5,45,-5,null,-5,!0),this.insertShaderBorders(i,5,45,null,-5,-5,!0),this.insertShaderBorders(i,5,45,-5,null,-5,!1),this.insertShaderBorders(i,5,45,null,-5,-5,!1),this.hasBorderShaders=!0),e.append(i)}},e.prototype.insertShaderBorders=function(e,t,r,n,i,o,a){var s=document.createElement("div");s.style.position="absolute",s.style.backgroundColor=J.BORDER_SHADER_DEFAULT_COLOR,s.style.width="".concat(t,"px"),s.style.height="".concat(r,"px"),null!==n&&(s.style.top="".concat(n,"px")),null!==i&&(s.style.bottom="".concat(i,"px")),a?s.style.left="".concat(o,"px"):s.style.right="".concat(o,"px"),this.borderShaders||(this.borderShaders=[]),this.borderShaders.push(s),e.appendChild(s)},e.prototype.showPausedState=function(){if(!this.scannerPausedUiElement)throw"[internal error] scanner paused UI element not found";this.scannerPausedUiElement.style.display="block"},e.prototype.hidePausedState=function(){if(!this.scannerPausedUiElement)throw"[internal error] scanner paused UI element not found";this.scannerPausedUiElement.style.display="none"},e.prototype.getTimeoutFps=function(e){return 1e3/e},e}(),er="data:image/svg+xml;base64,",en=er+"PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAzNzEuNjQzIDM3MS42NDMiIHN0eWxlPSJlbmFibGUtYmFja2dyb3VuZDpuZXcgMCAwIDM3MS42NDMgMzcxLjY0MyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+PHBhdGggZD0iTTEwNS4wODQgMzguMjcxaDE2My43Njh2MjBIMTA1LjA4NHoiLz48cGF0aCBkPSJNMzExLjU5NiAxOTAuMTg5Yy03LjQ0MS05LjM0Ny0xOC40MDMtMTYuMjA2LTMyLjc0My0yMC41MjJWMzBjMC0xNi41NDItMTMuNDU4LTMwLTMwLTMwSDEyNS4wODRjLTE2LjU0MiAwLTMwIDEzLjQ1OC0zMCAzMHYxMjAuMTQzaC04LjI5NmMtMTYuNTQyIDAtMzAgMTMuNDU4LTMwIDMwdjEuMzMzYTI5LjgwNCAyOS44MDQgMCAwIDAgNC42MDMgMTUuOTM5Yy03LjM0IDUuNDc0LTEyLjEwMyAxNC4yMjEtMTIuMTAzIDI0LjA2MXYxLjMzM2MwIDkuODQgNC43NjMgMTguNTg3IDEyLjEwMyAyNC4wNjJhMjkuODEgMjkuODEgMCAwIDAtNC42MDMgMTUuOTM4djEuMzMzYzAgMTYuNTQyIDEzLjQ1OCAzMCAzMCAzMGg4LjMyNGMuNDI3IDExLjYzMSA3LjUwMyAyMS41ODcgMTcuNTM0IDI2LjE3Ny45MzEgMTAuNTAzIDQuMDg0IDMwLjE4NyAxNC43NjggNDUuNTM3YTkuOTg4IDkuOTg4IDAgMCAwIDguMjE2IDQuMjg4IDkuOTU4IDkuOTU4IDAgMCAwIDUuNzA0LTEuNzkzYzQuNTMzLTMuMTU1IDUuNjUtOS4zODggMi40OTUtMTMuOTIxLTYuNzk4LTkuNzY3LTkuNjAyLTIyLjYwOC0xMC43Ni0zMS40aDgyLjY4NWMuMjcyLjQxNC41NDUuODE4LjgxNSAxLjIxIDMuMTQyIDQuNTQxIDkuMzcyIDUuNjc5IDEzLjkxMyAyLjUzNCA0LjU0Mi0zLjE0MiA1LjY3Ny05LjM3MSAyLjUzNS0xMy45MTMtMTEuOTE5LTE3LjIyOS04Ljc4Ny0zNS44ODQgOS41ODEtNTcuMDEyIDMuMDY3LTIuNjUyIDEyLjMwNy0xMS43MzIgMTEuMjE3LTI0LjAzMy0uODI4LTkuMzQzLTcuMTA5LTE3LjE5NC0xOC42NjktMjMuMzM3YTkuODU3IDkuODU3IDAgMCAwLTEuMDYxLS40ODZjLS40NjYtLjE4Mi0xMS40MDMtNC41NzktOS43NDEtMTUuNzA2IDEuMDA3LTYuNzM3IDE0Ljc2OC04LjI3MyAyMy43NjYtNy42NjYgMjMuMTU2IDEuNTY5IDM5LjY5OCA3LjgwMyA0Ny44MzYgMTguMDI2IDUuNzUyIDcuMjI1IDcuNjA3IDE2LjYyMyA1LjY3MyAyOC43MzMtLjQxMyAyLjU4NS0uODI0IDUuMjQxLTEuMjQ1IDcuOTU5LTUuNzU2IDM3LjE5NC0xMi45MTkgODMuNDgzLTQ5Ljg3IDExNC42NjEtNC4yMjEgMy41NjEtNC43NTYgOS44Ny0xLjE5NCAxNC4wOTJhOS45OCA5Ljk4IDAgMCAwIDcuNjQ4IDMuNTUxIDkuOTU1IDkuOTU1IDAgMCAwIDYuNDQ0LTIuMzU4YzQyLjY3Mi0zNi4wMDUgNTAuODAyLTg4LjUzMyA1Ni43MzctMTI2Ljg4OC40MTUtMi42ODQuODIxLTUuMzA5IDEuMjI5LTcuODYzIDIuODM0LTE3LjcyMS0uNDU1LTMyLjY0MS05Ljc3Mi00NC4zNDV6bS0yMzIuMzA4IDQyLjYyYy01LjUxNCAwLTEwLTQuNDg2LTEwLTEwdi0xLjMzM2MwLTUuNTE0IDQuNDg2LTEwIDEwLTEwaDE1djIxLjMzM2gtMTV6bS0yLjUtNTIuNjY2YzAtNS41MTQgNC40ODYtMTAgMTAtMTBoNy41djIxLjMzM2gtNy41Yy01LjUxNCAwLTEwLTQuNDg2LTEwLTEwdi0xLjMzM3ptMTcuNSA5My45OTloLTcuNWMtNS41MTQgMC0xMC00LjQ4Ni0xMC0xMHYtMS4zMzNjMC01LjUxNCA0LjQ4Ni0xMCAxMC0xMGg3LjV2MjEuMzMzem0zMC43OTYgMjguODg3Yy01LjUxNCAwLTEwLTQuNDg2LTEwLTEwdi04LjI3MWg5MS40NTdjLS44NTEgNi42NjgtLjQzNyAxMi43ODcuNzMxIDE4LjI3MWgtODIuMTg4em03OS40ODItMTEzLjY5OGMtMy4xMjQgMjAuOTA2IDEyLjQyNyAzMy4xODQgMjEuNjI1IDM3LjA0IDUuNDQxIDIuOTY4IDcuNTUxIDUuNjQ3IDcuNzAxIDcuMTg4LjIxIDIuMTUtMi41NTMgNS42ODQtNC40NzcgNy4yNTEtLjQ4Mi4zNzgtLjkyOS44LTEuMzM1IDEuMjYxLTYuOTg3IDcuOTM2LTExLjk4MiAxNS41Mi0xNS40MzIgMjIuNjg4aC05Ny41NjRWMzBjMC01LjUxNCA0LjQ4Ni0xMCAxMC0xMGgxMjMuNzY5YzUuNTE0IDAgMTAgNC40ODYgMTAgMTB2MTM1LjU3OWMtMy4wMzItLjM4MS02LjE1LS42OTQtOS4zODktLjkxNC0yNS4xNTktMS42OTQtNDIuMzcgNy43NDgtNDQuODk4IDI0LjY2NnoiLz48cGF0aCBkPSJNMTc5LjEyOSA4My4xNjdoLTI0LjA2YTUgNSAwIDAgMC01IDV2MjQuMDYxYTUgNSAwIDAgMCA1IDVoMjQuMDZhNSA1IDAgMCAwIDUtNVY4OC4xNjdhNSA1IDAgMCAwLTUtNXpNMTcyLjYyOSAxNDIuODZoLTEyLjU2VjEzMC44YTUgNSAwIDEgMC0xMCAwdjE3LjA2MWE1IDUgMCAwIDAgNSA1aDE3LjU2YTUgNSAwIDEgMCAwLTEwLjAwMXpNMjE2LjU2OCA4My4xNjdoLTI0LjA2YTUgNSAwIDAgMC01IDV2MjQuMDYxYTUgNSAwIDAgMCA1IDVoMjQuMDZhNSA1IDAgMCAwIDUtNVY4OC4xNjdhNSA1IDAgMCAwLTUtNXptLTUgMjQuMDYxaC0xNC4wNlY5My4xNjdoMTQuMDZ2MTQuMDYxek0yMTEuNjY5IDEyNS45MzZIMTk3LjQxYTUgNSAwIDAgMC01IDV2MTQuMjU3YTUgNSAwIDAgMCA1IDVoMTQuMjU5YTUgNSAwIDAgMCA1LTV2LTE0LjI1N2E1IDUgMCAwIDAtNS01eiIvPjwvc3ZnPg==",ei=er+"PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA1OS4wMTggNTkuMDE4IiBzdHlsZT0iZW5hYmxlLWJhY2tncm91bmQ6bmV3IDAgMCA1OS4wMTggNTkuMDE4IiB4bWw6c3BhY2U9InByZXNlcnZlIj48cGF0aCBkPSJtNTguNzQxIDU0LjgwOS01Ljk2OS02LjI0NGExMC43NCAxMC43NCAwIDAgMCAyLjgyLTcuMjVjMC01Ljk1My00Ljg0My0xMC43OTYtMTAuNzk2LTEwLjc5NlMzNCAzNS4zNjEgMzQgNDEuMzE0IDM4Ljg0MyA1Mi4xMSA0NC43OTYgNTIuMTFjMi40NDEgMCA0LjY4OC0uODI0IDYuNDk5LTIuMTk2bDYuMDAxIDYuMjc3YS45OTguOTk4IDAgMCAwIDEuNDE0LjAzMiAxIDEgMCAwIDAgLjAzMS0xLjQxNHpNMzYgNDEuMzE0YzAtNC44NSAzLjk0Ni04Ljc5NiA4Ljc5Ni04Ljc5NnM4Ljc5NiAzLjk0NiA4Ljc5NiA4Ljc5Ni0zLjk0NiA4Ljc5Ni04Ljc5NiA4Ljc5NlMzNiA0Ni4xNjQgMzYgNDEuMzE0ek0xMC40MzEgMTYuMDg4YzAgMy4wNyAyLjQ5OCA1LjU2OCA1LjU2OSA1LjU2OHM1LjU2OS0yLjQ5OCA1LjU2OS01LjU2OGMwLTMuMDcxLTIuNDk4LTUuNTY5LTUuNTY5LTUuNTY5cy01LjU2OSAyLjQ5OC01LjU2OSA1LjU2OXptOS4xMzggMGMwIDEuOTY4LTEuNjAyIDMuNTY4LTMuNTY5IDMuNTY4cy0zLjU2OS0xLjYwMS0zLjU2OS0zLjU2OCAxLjYwMi0zLjU2OSAzLjU2OS0zLjU2OSAzLjU2OSAxLjYwMSAzLjU2OSAzLjU2OXoiLz48cGF0aCBkPSJtMzAuODgyIDI4Ljk4NyA5LjE4LTEwLjA1NCAxMS4yNjIgMTAuMzIzYTEgMSAwIDAgMCAxLjM1MS0xLjQ3NWwtMTItMTFhMSAxIDAgMCAwLTEuNDE0LjA2M2wtOS43OTQgMTAuNzI3LTQuNzQzLTQuNzQzYTEuMDAzIDEuMDAzIDAgMCAwLTEuMzY4LS4wNDRMNi4zMzkgMzcuNzY4YTEgMSAwIDEgMCAxLjMyMiAxLjUwMWwxNi4zMTMtMTQuMzYyIDcuMzE5IDcuMzE4YS45OTkuOTk5IDAgMSAwIDEuNDE0LTEuNDE0bC0xLjgyNS0xLjgyNHoiLz48cGF0aCBkPSJNMzAgNDYuNTE4SDJ2LTQyaDU0djI4YTEgMSAwIDEgMCAyIDB2LTI5YTEgMSAwIDAgMC0xLTFIMWExIDEgMCAwIDAtMSAxdjQ0YTEgMSAwIDAgMCAxIDFoMjlhMSAxIDAgMSAwIDAtMnoiLz48L3N2Zz4=",eo=er+"PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA0NjAgNDYwIiBzdHlsZT0iZW5hYmxlLWJhY2tncm91bmQ6bmV3IDAgMCA0NjAgNDYwIiB4bWw6c3BhY2U9InByZXNlcnZlIj48cGF0aCBkPSJNMjMwIDBDMTAyLjk3NSAwIDAgMTAyLjk3NSAwIDIzMHMxMDIuOTc1IDIzMCAyMzAgMjMwIDIzMC0xMDIuOTc0IDIzMC0yMzBTMzU3LjAyNSAwIDIzMCAwem0zOC4zMzMgMzc3LjM2YzAgOC42NzYtNy4wMzQgMTUuNzEtMTUuNzEgMTUuNzFoLTQzLjEwMWMtOC42NzYgMC0xNS43MS03LjAzNC0xNS43MS0xNS43MVYyMDIuNDc3YzAtOC42NzYgNy4wMzMtMTUuNzEgMTUuNzEtMTUuNzFoNDMuMTAxYzguNjc2IDAgMTUuNzEgNy4wMzMgMTUuNzEgMTUuNzFWMzc3LjM2ek0yMzAgMTU3Yy0yMS41MzkgMC0zOS0xNy40NjEtMzktMzlzMTcuNDYxLTM5IDM5LTM5IDM5IDE3LjQ2MSAzOSAzOS0xNy40NjEgMzktMzkgMzl6Ii8+PC9zdmc+",ea=function(){function e(){}return e.createDefault=function(){return{hasPermission:!1,lastUsedCameraId:null}},e}(),es=function(){function e(){this.data=ea.createDefault();var t=localStorage.getItem(e.LOCAL_STORAGE_KEY);t?this.data=JSON.parse(t):this.reset()}return e.prototype.hasCameraPermissions=function(){return this.data.hasPermission},e.prototype.getLastUsedCameraId=function(){return this.data.lastUsedCameraId},e.prototype.setHasPermission=function(e){this.data.hasPermission=e,this.flush()},e.prototype.setLastUsedCameraId=function(e){this.data.lastUsedCameraId=e,this.flush()},e.prototype.resetLastUsedCameraId=function(){this.data.lastUsedCameraId=null,this.flush()},e.prototype.reset=function(){this.data=ea.createDefault(),this.flush()},e.prototype.flush=function(){localStorage.setItem(e.LOCAL_STORAGE_KEY,JSON.stringify(this.data))},e.LOCAL_STORAGE_KEY="HTML5_QRCODE_DATA",e}(),el=function(){function e(){this.infoDiv=document.createElement("div")}return e.prototype.renderInto=function(e){this.infoDiv.style.position="absolute",this.infoDiv.style.top="10px",this.infoDiv.style.right="10px",this.infoDiv.style.zIndex="2",this.infoDiv.style.display="none",this.infoDiv.style.padding="5pt",this.infoDiv.style.border="1px solid #171717",this.infoDiv.style.fontSize="10pt",this.infoDiv.style.background="rgb(0 0 0 / 69%)",this.infoDiv.style.borderRadius="5px",this.infoDiv.style.textAlign="center",this.infoDiv.style.fontWeight="400",this.infoDiv.style.color="white",this.infoDiv.innerText=T.poweredBy();var t=document.createElement("a");t.innerText="ScanApp",t.href="https://scanapp.org",t.target="new",t.style.color="white",this.infoDiv.appendChild(t);var r=document.createElement("br"),n=document.createElement("br");this.infoDiv.appendChild(r),this.infoDiv.appendChild(n);var i=document.createElement("a");i.innerText=T.reportIssues(),i.href="https://github.com/mebjas/html5-qrcode/issues",i.target="new",i.style.color="white",this.infoDiv.appendChild(i),e.appendChild(this.infoDiv)},e.prototype.show=function(){this.infoDiv.style.display="block"},e.prototype.hide=function(){this.infoDiv.style.display="none"},e}(),ec=function(){function e(e,t){this.isShowingInfoIcon=!0,this.onTapIn=e,this.onTapOut=t,this.infoIcon=document.createElement("img")}return e.prototype.renderInto=function(e){var t=this;this.infoIcon.alt="Info icon",this.infoIcon.src=eo,this.infoIcon.style.position="absolute",this.infoIcon.style.top="4px",this.infoIcon.style.right="4px",this.infoIcon.style.opacity="0.6",this.infoIcon.style.cursor="pointer",this.infoIcon.style.zIndex="2",this.infoIcon.style.width="16px",this.infoIcon.style.height="16px",this.infoIcon.onmouseover=function(e){return t.onHoverIn()},this.infoIcon.onmouseout=function(e){return t.onHoverOut()},this.infoIcon.onclick=function(e){return t.onClick()},e.appendChild(this.infoIcon)},e.prototype.onHoverIn=function(){this.isShowingInfoIcon&&(this.infoIcon.style.opacity="1")},e.prototype.onHoverOut=function(){this.isShowingInfoIcon&&(this.infoIcon.style.opacity="0.6")},e.prototype.onClick=function(){this.isShowingInfoIcon?(this.isShowingInfoIcon=!1,this.onTapIn(),this.infoIcon.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAAQgAAAEIBarqQRAAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAAE1SURBVDiNfdI7S0NBEAXgLya1otFgpbYSbISAgpXYi6CmiH9KCAiChaVga6OiWPgfRDQ+0itaGVNosXtluWwcuMzePfM4M3sq8lbHBubwg1dc4m1E/J/N4ghDPOIsfk/4xiEao5KX0McFljN4C9d4QTPXuY99jP3DsIoDPGM6BY5i5yI5R7O4q+ImFkJY2DCh3cAH2klyB+9J1xUMMAG7eCh1a+Mr+k48b5diXrFVwwLuS+BJ9MfR7+G0FHOHhTHhnXNWS87VDF4pcnfQK4Ep7XScNLmPTZgURNKKYENYWDpzW1BhscS1WHS8CDgURFJQrWcoF3c13KKbgg1BYQfy8xZWEzTTw1QZbAoKu8FqJnktdu5hcVSHmchiILzzuaDQvjBzV2m8yohCE1jHfPx/xhU+y4G/D75ELlRJsSYAAAAASUVORK5CYII=",this.infoIcon.style.opacity="1"):(this.isShowingInfoIcon=!0,this.onTapOut(),this.infoIcon.src=eo,this.infoIcon.style.opacity="0.6")},e}(),eu=function(){function e(){var e=this;this.infoDiv=new el,this.infoIcon=new ec(function(){e.infoDiv.show()},function(){e.infoDiv.hide()})}return e.prototype.renderInto=function(e){this.infoDiv.renderInto(e),this.infoIcon.renderInto(e)},e}(),eh=function(e,t){var r,n,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(s){return function(l){var c=[s,l];if(r)throw TypeError("Generator is already executing.");for(;o&&(o=0,c[0]&&(a=0)),a;)try{if(r=1,n&&(i=2&c[0]?n.return:c[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,c[1])).done)return i;switch(n=0,i&&(c=[2&c[0],i.value]),c[0]){case 0:case 1:i=c;break;case 4:return a.label++,{value:c[1],done:!1};case 5:a.label++,n=c[1],c=[0];continue;case 7:c=a.ops.pop(),a.trys.pop();continue;default:if(!(i=(i=a.trys).length>0&&i[i.length-1])&&(6===c[0]||2===c[0])){a=0;continue}if(3===c[0]&&(!i||c[1]>i[0]&&c[1]<i[3])){a.label=c[1];break}if(6===c[0]&&a.label<i[1]){a.label=i[1],i=c;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(c);break}i[2]&&a.ops.pop(),a.trys.pop();continue}c=t.call(e,a)}catch(e){c=[6,e],n=0}finally{r=i=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}},ed=function(){function e(){}return e.hasPermissions=function(){var e,t,r,n;return e=this,t=void 0,r=void 0,n=function(){var e,t,r;return eh(this,function(n){switch(n.label){case 0:return[4,navigator.mediaDevices.enumerateDevices()];case 1:for(e=0,t=n.sent();e<t.length;e++)if("videoinput"===(r=t[e]).kind&&r.label)return[2,!0];return[2,!1]}})},new(r||(r=Promise))(function(i,o){function a(e){try{l(n.next(e))}catch(e){o(e)}}function s(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(a,s)}l((n=n.apply(e,t||[])).next())})},e}(),ef=function(){function e(e){this.supportedScanTypes=this.validateAndReturnScanTypes(e)}return e.prototype.getDefaultScanType=function(){return this.supportedScanTypes[0]},e.prototype.hasMoreThanOneScanType=function(){return this.supportedScanTypes.length>1},e.prototype.isCameraScanRequired=function(){for(var t=0,r=this.supportedScanTypes;t<r.length;t++){var n=r[t];if(e.isCameraScanType(n))return!0}return!1},e.isCameraScanType=function(e){return e===f.SCAN_TYPE_CAMERA},e.isFileScanType=function(e){return e===f.SCAN_TYPE_FILE},e.prototype.validateAndReturnScanTypes=function(e){if(!e||0===e.length)return C.DEFAULT_SUPPORTED_SCAN_TYPE;var t=C.DEFAULT_SUPPORTED_SCAN_TYPE.length;if(e.length>t)throw"Max ".concat(t," values expected for ")+"supportedScanTypes";for(var r=0;r<e.length;r++){var n=e[r];if(!C.DEFAULT_SUPPORTED_SCAN_TYPE.includes(n))throw"Unsupported scan type ".concat(n)}return e},e}(),eg=function(){function e(){}return e.ALL_ELEMENT_CLASS="html5-qrcode-element",e.CAMERA_PERMISSION_BUTTON_ID="html5-qrcode-button-camera-permission",e.CAMERA_START_BUTTON_ID="html5-qrcode-button-camera-start",e.CAMERA_STOP_BUTTON_ID="html5-qrcode-button-camera-stop",e.TORCH_BUTTON_ID="html5-qrcode-button-torch",e.CAMERA_SELECTION_SELECT_ID="html5-qrcode-select-camera",e.FILE_SELECTION_BUTTON_ID="html5-qrcode-button-file-selection",e.ZOOM_SLIDER_ID="html5-qrcode-input-range-zoom",e.SCAN_TYPE_CHANGE_ANCHOR_ID="html5-qrcode-anchor-scan-type-change",e.TORCH_BUTTON_CLASS_TORCH_ON="html5-qrcode-button-torch-on",e.TORCH_BUTTON_CLASS_TORCH_OFF="html5-qrcode-button-torch-off",e}(),ep=function(){function e(){}return e.createElement=function(e,t){var r=document.createElement(e);return r.id=t,r.classList.add(eg.ALL_ELEMENT_CLASS),"button"===e&&r.setAttribute("type","button"),r},e}(),em=function(e,t,r,n){return new(r||(r=Promise))(function(i,o){function a(e){try{l(n.next(e))}catch(e){o(e)}}function s(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(a,s)}l((n=n.apply(e,t||[])).next())})},ew=function(e,t){var r,n,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(s){return function(l){var c=[s,l];if(r)throw TypeError("Generator is already executing.");for(;o&&(o=0,c[0]&&(a=0)),a;)try{if(r=1,n&&(i=2&c[0]?n.return:c[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,c[1])).done)return i;switch(n=0,i&&(c=[2&c[0],i.value]),c[0]){case 0:case 1:i=c;break;case 4:return a.label++,{value:c[1],done:!1};case 5:a.label++,n=c[1],c=[0];continue;case 7:c=a.ops.pop(),a.trys.pop();continue;default:if(!(i=(i=a.trys).length>0&&i[i.length-1])&&(6===c[0]||2===c[0])){a=0;continue}if(3===c[0]&&(!i||c[1]>i[0]&&c[1]<i[3])){a.label=c[1];break}if(6===c[0]&&a.label<i[1]){a.label=i[1],i=c;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(c);break}i[2]&&a.ops.pop(),a.trys.pop();continue}c=t.call(e,a)}catch(e){c=[6,e],n=0}finally{r=i=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}},eC=function(){function e(e,t,r){this.isTorchOn=!1,this.torchCapability=e,this.buttonController=t,this.onTorchActionFailureCallback=r}return e.prototype.isTorchEnabled=function(){return this.isTorchOn},e.prototype.flipState=function(){return em(this,void 0,void 0,function(){var e,t;return ew(this,function(r){switch(r.label){case 0:this.buttonController.disable(),e=!this.isTorchOn,r.label=1;case 1:return r.trys.push([1,3,,4]),[4,this.torchCapability.apply(e)];case 2:return r.sent(),this.updateUiBasedOnLatestSettings(this.torchCapability.value(),e),[3,4];case 3:return t=r.sent(),this.propagateFailure(e,t),this.buttonController.enable(),[3,4];case 4:return[2]}})})},e.prototype.updateUiBasedOnLatestSettings=function(e,t){e===t?(this.buttonController.setText(t?b.torchOffButton():b.torchOnButton()),this.isTorchOn=t):this.propagateFailure(t),this.buttonController.enable()},e.prototype.propagateFailure=function(e,t){var r=e?b.torchOnFailedMessage():b.torchOffFailedMessage();t&&(r+="; Error = "+t),this.onTorchActionFailureCallback(r)},e.prototype.reset=function(){this.isTorchOn=!1},e}(),eE=function(){function e(e,t){this.onTorchActionFailureCallback=t,this.torchButton=ep.createElement("button",eg.TORCH_BUTTON_ID),this.torchController=new eC(e,this,t)}return e.prototype.render=function(e,t){var r=this;this.torchButton.innerText=b.torchOnButton(),this.torchButton.style.display=t.display,this.torchButton.style.marginLeft=t.marginLeft;var n=this;this.torchButton.addEventListener("click",function(e){return em(r,void 0,void 0,function(){return ew(this,function(e){switch(e.label){case 0:return[4,n.torchController.flipState()];case 1:return e.sent(),n.torchController.isTorchEnabled()?(n.torchButton.classList.remove(eg.TORCH_BUTTON_CLASS_TORCH_OFF),n.torchButton.classList.add(eg.TORCH_BUTTON_CLASS_TORCH_ON)):(n.torchButton.classList.remove(eg.TORCH_BUTTON_CLASS_TORCH_ON),n.torchButton.classList.add(eg.TORCH_BUTTON_CLASS_TORCH_OFF)),[2]}})})}),e.appendChild(this.torchButton)},e.prototype.updateTorchCapability=function(e){this.torchController=new eC(e,this,this.onTorchActionFailureCallback)},e.prototype.getTorchButton=function(){return this.torchButton},e.prototype.hide=function(){this.torchButton.style.display="none"},e.prototype.show=function(){this.torchButton.style.display="inline-block"},e.prototype.disable=function(){this.torchButton.disabled=!0},e.prototype.enable=function(){this.torchButton.disabled=!1},e.prototype.setText=function(e){this.torchButton.innerText=e},e.prototype.reset=function(){this.torchButton.innerText=b.torchOnButton(),this.torchController.reset()},e.create=function(t,r,n,i){var o=new e(r,i);return o.render(t,n),o},e}(),eA=function(){function e(e,t,r){this.fileBasedScanRegion=this.createFileBasedScanRegion(),this.fileBasedScanRegion.style.display=t?"block":"none",e.appendChild(this.fileBasedScanRegion);var n=document.createElement("label");n.setAttribute("for",this.getFileScanInputId()),n.style.display="inline-block",this.fileBasedScanRegion.appendChild(n),this.fileSelectionButton=ep.createElement("button",eg.FILE_SELECTION_BUTTON_ID),this.setInitialValueToButton(),this.fileSelectionButton.addEventListener("click",function(e){n.click()}),n.append(this.fileSelectionButton),this.fileScanInput=ep.createElement("input",this.getFileScanInputId()),this.fileScanInput.type="file",this.fileScanInput.accept="image/*",this.fileScanInput.style.display="none",n.appendChild(this.fileScanInput);var i=this;this.fileScanInput.addEventListener("change",function(e){if(null!=e&&null!=e.target){var t=e.target;if(!t.files||0!==t.files.length){var n=t.files[0],o=n.name;i.setImageNameToButton(o),r(n)}}});var o=this.createDragAndDropMessage();this.fileBasedScanRegion.appendChild(o),this.fileBasedScanRegion.addEventListener("dragenter",function(e){i.fileBasedScanRegion.style.border=i.fileBasedScanRegionActiveBorder(),e.stopPropagation(),e.preventDefault()}),this.fileBasedScanRegion.addEventListener("dragleave",function(e){i.fileBasedScanRegion.style.border=i.fileBasedScanRegionDefaultBorder(),e.stopPropagation(),e.preventDefault()}),this.fileBasedScanRegion.addEventListener("dragover",function(e){i.fileBasedScanRegion.style.border=i.fileBasedScanRegionActiveBorder(),e.stopPropagation(),e.preventDefault()}),this.fileBasedScanRegion.addEventListener("drop",function(e){e.stopPropagation(),e.preventDefault(),i.fileBasedScanRegion.style.border=i.fileBasedScanRegionDefaultBorder();var t=e.dataTransfer;if(t){var n=t.files;if(!n||0===n.length)return;for(var a=!1,s=0;s<n.length;++s){var l=n.item(s);if(l){var c=/image.*/;if(l.type.match(c)){a=!0;var u=l.name;i.setImageNameToButton(u),r(l),o.innerText=b.dragAndDropMessage();break}}}a||(o.innerText=b.dragAndDropMessageOnlyImages())}})}return e.prototype.hide=function(){this.fileBasedScanRegion.style.display="none",this.fileScanInput.disabled=!0},e.prototype.show=function(){this.fileBasedScanRegion.style.display="block",this.fileScanInput.disabled=!1},e.prototype.isShowing=function(){return"block"===this.fileBasedScanRegion.style.display},e.prototype.resetValue=function(){this.fileScanInput.value="",this.setInitialValueToButton()},e.prototype.createFileBasedScanRegion=function(){var e=document.createElement("div");return e.style.textAlign="center",e.style.margin="auto",e.style.width="80%",e.style.maxWidth="600px",e.style.border=this.fileBasedScanRegionDefaultBorder(),e.style.padding="10px",e.style.marginBottom="10px",e},e.prototype.fileBasedScanRegionDefaultBorder=function(){return"6px dashed #ebebeb"},e.prototype.fileBasedScanRegionActiveBorder=function(){return"6px dashed rgb(153 151 151)"},e.prototype.createDragAndDropMessage=function(){var e=document.createElement("div");return e.innerText=b.dragAndDropMessage(),e.style.fontWeight="400",e},e.prototype.setImageNameToButton=function(e){if(e.length>20){var t=e.substring(0,8),r=e.length,n=e.substring(r-8,r);e="".concat(t,"....").concat(n)}var i=b.fileSelectionChooseAnother()+" - "+e;this.fileSelectionButton.innerText=i},e.prototype.setInitialValueToButton=function(){var e=b.fileSelectionChooseImage()+" - "+b.fileSelectionNoImageSelected();this.fileSelectionButton.innerText=e},e.prototype.getFileScanInputId=function(){return"html5-qrcode-private-filescan-input"},e.create=function(t,r,n){return new e(t,r,n)},e}(),ey=function(){function e(e){this.selectElement=ep.createElement("select",eg.CAMERA_SELECTION_SELECT_ID),this.cameras=e,this.options=[]}return e.prototype.render=function(e){var t=document.createElement("span");t.style.marginRight="10px";var r=this.cameras.length;if(0===r)throw Error("No cameras found");if(1===r)t.style.display="none";else{var n=b.selectCamera();t.innerText="".concat(n," (").concat(this.cameras.length,") ")}for(var i=1,o=0,a=this.cameras;o<a.length;o++){var s=a[o],l=s.id,c=null==s.label?l:s.label;c&&""!==c||(c=[b.anonymousCameraPrefix(),i++].join(" "));var u=document.createElement("option");u.value=l,u.innerText=c,this.options.push(u),this.selectElement.appendChild(u)}t.appendChild(this.selectElement),e.appendChild(t)},e.prototype.disable=function(){this.selectElement.disabled=!0},e.prototype.isDisabled=function(){return!0===this.selectElement.disabled},e.prototype.enable=function(){this.selectElement.disabled=!1},e.prototype.getValue=function(){return this.selectElement.value},e.prototype.hasValue=function(e){for(var t=0,r=this.options;t<r.length;t++)if(r[t].value===e)return!0;return!1},e.prototype.setValue=function(e){if(!this.hasValue(e))throw Error("".concat(e," is not present in the camera list."));this.selectElement.value=e},e.prototype.hasSingleItem=function(){return 1===this.cameras.length},e.prototype.numCameras=function(){return this.cameras.length},e.create=function(t,r){var n=new e(r);return n.render(t),n},e}(),eI=function(){function e(){this.onChangeCallback=null,this.zoomElementContainer=document.createElement("div"),this.rangeInput=ep.createElement("input",eg.ZOOM_SLIDER_ID),this.rangeInput.type="range",this.rangeText=document.createElement("span"),this.rangeInput.min="1",this.rangeInput.max="5",this.rangeInput.value="1",this.rangeInput.step="0.1"}return e.prototype.render=function(e,t){this.zoomElementContainer.style.display=t?"block":"none",this.zoomElementContainer.style.padding="5px 10px",this.zoomElementContainer.style.textAlign="center",e.appendChild(this.zoomElementContainer),this.rangeInput.style.display="inline-block",this.rangeInput.style.width="50%",this.rangeInput.style.height="5px",this.rangeInput.style.background="#d3d3d3",this.rangeInput.style.outline="none",this.rangeInput.style.opacity="0.7";var r=b.zoom();this.rangeText.innerText="".concat(this.rangeInput.value,"x ").concat(r),this.rangeText.style.marginRight="10px";var n=this;this.rangeInput.addEventListener("input",function(){return n.onValueChange()}),this.rangeInput.addEventListener("change",function(){return n.onValueChange()}),this.zoomElementContainer.appendChild(this.rangeInput),this.zoomElementContainer.appendChild(this.rangeText)},e.prototype.onValueChange=function(){var e=b.zoom();this.rangeText.innerText="".concat(this.rangeInput.value,"x ").concat(e),this.onChangeCallback&&this.onChangeCallback(parseFloat(this.rangeInput.value))},e.prototype.setValues=function(e,t,r,n){this.rangeInput.min=e.toString(),this.rangeInput.max=t.toString(),this.rangeInput.step=n.toString(),this.rangeInput.value=r.toString(),this.onValueChange()},e.prototype.show=function(){this.zoomElementContainer.style.display="block"},e.prototype.hide=function(){this.zoomElementContainer.style.display="none"},e.prototype.setOnCameraZoomValueChangeCallback=function(e){this.onChangeCallback=e},e.prototype.removeOnCameraZoomValueChangeCallback=function(){this.onChangeCallback=null},e.create=function(t,r){var n=new e;return n.render(t,r),n},e}();function eS(e,t,r){if(this.lastMatchFound=null,this.cameraScanImage=null,this.fileScanImage=null,this.fileSelectionUi=null,this.elementId=e,this.config=this.createConfig(t),this.verbose=!0===r,!document.getElementById(e))throw"HTML Element with id=".concat(e," not found");this.scanTypeSelector=new ef(this.config.supportedScanTypes),this.currentScanType=this.scanTypeSelector.getDefaultScanType(),this.sectionSwapAllowed=!0,this.logger=new I(this.verbose),this.persistedDataManager=new es,!0!==t.rememberLastUsedCamera&&this.persistedDataManager.reset()}(c=m||(m={}))[c.STATUS_DEFAULT=0]="STATUS_DEFAULT",c[c.STATUS_SUCCESS=1]="STATUS_SUCCESS",c[c.STATUS_WARNING=2]="STATUS_WARNING",c[c.STATUS_REQUESTING_PERMISSION=3]="STATUS_REQUESTING_PERMISSION",eS.prototype.render=function(e,t){var r,n,i=this;this.lastMatchFound=null,this.qrCodeSuccessCallback=function(t,r){if(e)e(t,r);else{if(i.lastMatchFound===t)return;i.lastMatchFound=t,i.setHeaderMessage(b.lastMatch(t),m.STATUS_SUCCESS)}},this.qrCodeErrorCallback=function(e,r){t&&t(e,r)};var o=document.getElementById(this.elementId);if(!o)throw"HTML Element with id=".concat(this.elementId," not found");o.innerHTML="",this.createBasicLayout(o),this.html5Qrcode=new et(this.getScanRegionId(),(r=this.config,n=this.verbose,{formatsToSupport:r.formatsToSupport,useBarCodeDetectorIfSupported:r.useBarCodeDetectorIfSupported,experimentalFeatures:r.experimentalFeatures,verbose:n}))},eS.prototype.pause=function(e){(S(e)||!0!==e)&&(e=!1),this.getHtml5QrcodeOrFail().pause(e)},eS.prototype.resume=function(){this.getHtml5QrcodeOrFail().resume()},eS.prototype.getState=function(){return this.getHtml5QrcodeOrFail().getState()},eS.prototype.clear=function(){var e=this,t=function(){var t=document.getElementById(e.elementId);t&&(t.innerHTML="",e.resetBasicLayout(t))};return this.html5Qrcode?new Promise(function(r,n){if(!e.html5Qrcode)return void r();e.html5Qrcode.isScanning?e.html5Qrcode.stop().then(function(n){if(!e.html5Qrcode)return void r();e.html5Qrcode.clear(),t(),r()}).catch(function(t){e.verbose&&e.logger.logError("Unable to stop qrcode scanner",t),n(t)}):(e.html5Qrcode.clear(),t(),r())}):Promise.resolve()},eS.prototype.getRunningTrackCapabilities=function(){return this.getHtml5QrcodeOrFail().getRunningTrackCapabilities()},eS.prototype.getRunningTrackSettings=function(){return this.getHtml5QrcodeOrFail().getRunningTrackSettings()},eS.prototype.applyVideoConstraints=function(e){return this.getHtml5QrcodeOrFail().applyVideoConstraints(e)},eS.prototype.getHtml5QrcodeOrFail=function(){if(!this.html5Qrcode)throw"Code scanner not initialized.";return this.html5Qrcode},eS.prototype.createConfig=function(e){return e?(e.fps||(e.fps=C.SCAN_DEFAULT_FPS),!C.DEFAULT_REMEMBER_LAST_CAMERA_USED!==e.rememberLastUsedCamera&&(e.rememberLastUsedCamera=C.DEFAULT_REMEMBER_LAST_CAMERA_USED),e.supportedScanTypes||(e.supportedScanTypes=C.DEFAULT_SUPPORTED_SCAN_TYPE),e):{fps:C.SCAN_DEFAULT_FPS,rememberLastUsedCamera:C.DEFAULT_REMEMBER_LAST_CAMERA_USED,supportedScanTypes:C.DEFAULT_SUPPORTED_SCAN_TYPE}},eS.prototype.createBasicLayout=function(e){e.style.position="relative",e.style.padding="0px",e.style.border="1px solid silver",this.createHeader(e);var t=document.createElement("div");t.id=this.getScanRegionId(),t.style.width="100%",t.style.minHeight="100px",t.style.textAlign="center",e.appendChild(t),ef.isCameraScanType(this.currentScanType)?this.insertCameraScanImageToScanRegion():this.insertFileScanImageToScanRegion();var r=document.createElement("div");r.id=this.getDashboardId(),r.style.width="100%",e.appendChild(r),this.setupInitialDashboard(r)},eS.prototype.resetBasicLayout=function(e){e.style.border="none"},eS.prototype.setupInitialDashboard=function(e){this.createSection(e),this.createSectionControlPanel(),this.scanTypeSelector.hasMoreThanOneScanType()&&this.createSectionSwap()},eS.prototype.createHeader=function(e){var t=document.createElement("div");t.style.textAlign="left",t.style.margin="0px",e.appendChild(t),new eu().renderInto(t);var r=document.createElement("div");r.id=this.getHeaderMessageContainerId(),r.style.display="none",r.style.textAlign="center",r.style.fontSize="14px",r.style.padding="2px 10px",r.style.margin="4px",r.style.borderTop="1px solid #f6f6f6",t.appendChild(r)},eS.prototype.createSection=function(e){var t=document.createElement("div");t.id=this.getDashboardSectionId(),t.style.width="100%",t.style.padding="10px 0px 10px 0px",t.style.textAlign="left",e.appendChild(t)},eS.prototype.createCameraListUi=function(e,t,r){var n=this;n.showHideScanTypeSwapLink(!1),n.setHeaderMessage(b.cameraPermissionRequesting());var i=function(){r||n.createPermissionButton(e,t)};et.getCameras().then(function(r){n.persistedDataManager.setHasPermission(!0),n.showHideScanTypeSwapLink(!0),n.resetHeaderMessage(),r&&r.length>0?(e.removeChild(t),n.renderCameraSelection(r)):(n.setHeaderMessage(b.noCameraFound(),m.STATUS_WARNING),i())}).catch(function(e){n.persistedDataManager.setHasPermission(!1),r?r.disabled=!1:i(),n.setHeaderMessage(e,m.STATUS_WARNING),n.showHideScanTypeSwapLink(!0)})},eS.prototype.createPermissionButton=function(e,t){var r=this,n=ep.createElement("button",this.getCameraPermissionButtonId());n.innerText=b.cameraPermissionTitle(),n.addEventListener("click",function(){n.disabled=!0,r.createCameraListUi(e,t,n)}),t.appendChild(n)},eS.prototype.createPermissionsUi=function(e,t){var r=this;if(ef.isCameraScanType(this.currentScanType)&&this.persistedDataManager.hasCameraPermissions())return void ed.hasPermissions().then(function(n){n?r.createCameraListUi(e,t):(r.persistedDataManager.setHasPermission(!1),r.createPermissionButton(e,t))}).catch(function(n){r.persistedDataManager.setHasPermission(!1),r.createPermissionButton(e,t)});this.createPermissionButton(e,t)},eS.prototype.createSectionControlPanel=function(){var e=document.getElementById(this.getDashboardSectionId()),t=document.createElement("div");e.appendChild(t);var r=document.createElement("div");r.id=this.getDashboardSectionCameraScanRegionId(),r.style.display=ef.isCameraScanType(this.currentScanType)?"block":"none",t.appendChild(r);var n=document.createElement("div");n.style.textAlign="center",r.appendChild(n),this.scanTypeSelector.isCameraScanRequired()&&this.createPermissionsUi(r,n),this.renderFileScanUi(t)},eS.prototype.renderFileScanUi=function(e){var t=ef.isFileScanType(this.currentScanType),r=this;this.fileSelectionUi=eA.create(e,t,function(e){if(!r.html5Qrcode)throw"html5Qrcode not defined";ef.isFileScanType(r.currentScanType)&&(r.setHeaderMessage(b.loadingImage()),r.html5Qrcode.scanFileV2(e,!0).then(function(e){r.resetHeaderMessage(),r.qrCodeSuccessCallback(e.decodedText,e)}).catch(function(e){r.setHeaderMessage(e,m.STATUS_WARNING),r.qrCodeErrorCallback(e,y.createFrom(e))}))})},eS.prototype.renderCameraSelection=function(e){var t,r=this,n=this,i=document.getElementById(this.getDashboardSectionCameraScanRegionId());i.style.textAlign="center";var o=eI.create(i,!1),a=function(e){var t=e.zoomFeature();if(t.isSupported()){o.setOnCameraZoomValueChangeCallback(function(e){t.apply(e)});var n,i,a,s=1;r.config.defaultZoomValueIfSupported&&(s=r.config.defaultZoomValueIfSupported),n=s,i=t.min(),s=n>(a=t.max())?a:n<i?i:n,o.setValues(t.min(),t.max(),s,t.step()),o.show()}},s=ey.create(i,e),l=document.createElement("span"),c=ep.createElement("button",eg.CAMERA_START_BUTTON_ID);c.innerText=b.scanButtonStartScanningText(),l.appendChild(c);var u=ep.createElement("button",eg.CAMERA_STOP_BUTTON_ID);u.innerText=b.scanButtonStopScanningText(),u.style.display="none",u.disabled=!0,l.appendChild(u);var h=function(e){if(!e.torchFeature().isSupported()){t&&t.hide();return}t?t.updateTorchCapability(e.torchFeature()):t=eE.create(l,e.torchFeature(),{display:"none",marginLeft:"5px"},function(e){n.setHeaderMessage(e,m.STATUS_WARNING)}),t.show()};i.appendChild(l);var d=function(e){e||(c.style.display="none"),c.innerText=b.scanButtonStartScanningText(),c.style.opacity="1",c.disabled=!1,e&&(c.style.display="inline-block")};if(c.addEventListener("click",function(e){c.innerText=b.scanButtonScanningStarting(),s.disable(),c.disabled=!0,c.style.opacity="0.5",r.scanTypeSelector.hasMoreThanOneScanType()&&n.showHideScanTypeSwapLink(!1),n.resetHeaderMessage();var t,i=s.getValue();n.persistedDataManager.setLastUsedCameraId(i),n.html5Qrcode.start(i,{fps:(t=n.config).fps,qrbox:t.qrbox,aspectRatio:t.aspectRatio,disableFlip:t.disableFlip,videoConstraints:t.videoConstraints},n.qrCodeSuccessCallback,n.qrCodeErrorCallback).then(function(e){u.disabled=!1,u.style.display="inline-block",d(!1);var t=n.html5Qrcode.getRunningTrackCameraCapabilities();!0===r.config.showTorchButtonIfSupported&&h(t),!0===r.config.showZoomSliderIfSupported&&a(t)}).catch(function(e){n.showHideScanTypeSwapLink(!0),s.enable(),d(!0),n.setHeaderMessage(e,m.STATUS_WARNING)})}),s.hasSingleItem()&&c.click(),u.addEventListener("click",function(e){if(!n.html5Qrcode)throw"html5Qrcode not defined";u.disabled=!0,n.html5Qrcode.stop().then(function(e){r.scanTypeSelector.hasMoreThanOneScanType()&&n.showHideScanTypeSwapLink(!0),s.enable(),c.disabled=!1,u.style.display="none",c.style.display="inline-block",t&&(t.reset(),t.hide()),o.removeOnCameraZoomValueChangeCallback(),o.hide(),n.insertCameraScanImageToScanRegion()}).catch(function(e){u.disabled=!1,n.setHeaderMessage(e,m.STATUS_WARNING)})}),n.persistedDataManager.getLastUsedCameraId()){var f=n.persistedDataManager.getLastUsedCameraId();s.hasValue(f)?(s.setValue(f),c.click()):n.persistedDataManager.resetLastUsedCameraId()}},eS.prototype.createSectionSwap=function(){var e=this,t=b.textIfCameraScanSelected(),r=b.textIfFileScanSelected(),n=document.getElementById(this.getDashboardSectionId()),i=document.createElement("div");i.style.textAlign="center";var o=ep.createElement("span",this.getDashboardSectionSwapLinkId());o.style.textDecoration="underline",o.style.cursor="pointer",o.innerText=ef.isCameraScanType(this.currentScanType)?t:r,o.addEventListener("click",function(){if(!e.sectionSwapAllowed){e.verbose&&e.logger.logError("Section swap called when not allowed");return}e.resetHeaderMessage(),e.fileSelectionUi.resetValue(),e.sectionSwapAllowed=!1,ef.isCameraScanType(e.currentScanType)?(e.clearScanRegion(),e.getCameraScanRegion().style.display="none",e.fileSelectionUi.show(),o.innerText=r,e.currentScanType=f.SCAN_TYPE_FILE,e.insertFileScanImageToScanRegion()):(e.clearScanRegion(),e.getCameraScanRegion().style.display="block",e.fileSelectionUi.hide(),o.innerText=t,e.currentScanType=f.SCAN_TYPE_CAMERA,e.insertCameraScanImageToScanRegion(),e.startCameraScanIfPermissionExistsOnSwap()),e.sectionSwapAllowed=!0}),i.appendChild(o),n.appendChild(i)},eS.prototype.startCameraScanIfPermissionExistsOnSwap=function(){var e=this,t=this;if(this.persistedDataManager.hasCameraPermissions())return void ed.hasPermissions().then(function(r){if(r){var n=document.getElementById(t.getCameraPermissionButtonId());if(!n)throw e.logger.logError("Permission button not found, fail;"),"Permission button not found";n.click()}else t.persistedDataManager.setHasPermission(!1)}).catch(function(e){t.persistedDataManager.setHasPermission(!1)})},eS.prototype.resetHeaderMessage=function(){document.getElementById(this.getHeaderMessageContainerId()).style.display="none"},eS.prototype.setHeaderMessage=function(e,t){t||(t=m.STATUS_DEFAULT);var r=this.getHeaderMessageDiv();switch(r.innerText=e,r.style.display="block",t){case m.STATUS_SUCCESS:r.style.background="rgba(106, 175, 80, 0.26)",r.style.color="#477735";break;case m.STATUS_WARNING:r.style.background="rgba(203, 36, 49, 0.14)",r.style.color="#cb2431";break;case m.STATUS_DEFAULT:default:r.style.background="rgba(0, 0, 0, 0)",r.style.color="rgb(17, 17, 17)"}},eS.prototype.showHideScanTypeSwapLink=function(e){this.scanTypeSelector.hasMoreThanOneScanType()&&(!0!==e&&(e=!1),this.sectionSwapAllowed=e,this.getDashboardSectionSwapLink().style.display=e?"inline-block":"none")},eS.prototype.insertCameraScanImageToScanRegion=function(){var e=this,t=document.getElementById(this.getScanRegionId());if(this.cameraScanImage){t.innerHTML="<br>",t.appendChild(this.cameraScanImage);return}this.cameraScanImage=new Image,this.cameraScanImage.onload=function(r){t.innerHTML="<br>",t.appendChild(e.cameraScanImage)},this.cameraScanImage.width=64,this.cameraScanImage.style.opacity="0.8",this.cameraScanImage.src=en,this.cameraScanImage.alt=b.cameraScanAltText()},eS.prototype.insertFileScanImageToScanRegion=function(){var e=this,t=document.getElementById(this.getScanRegionId());if(this.fileScanImage){t.innerHTML="<br>",t.appendChild(this.fileScanImage);return}this.fileScanImage=new Image,this.fileScanImage.onload=function(r){t.innerHTML="<br>",t.appendChild(e.fileScanImage)},this.fileScanImage.width=64,this.fileScanImage.style.opacity="0.8",this.fileScanImage.src=ei,this.fileScanImage.alt=b.fileScanAltText()},eS.prototype.clearScanRegion=function(){document.getElementById(this.getScanRegionId()).innerHTML=""},eS.prototype.getDashboardSectionId=function(){return"".concat(this.elementId,"__dashboard_section")},eS.prototype.getDashboardSectionCameraScanRegionId=function(){return"".concat(this.elementId,"__dashboard_section_csr")},eS.prototype.getDashboardSectionSwapLinkId=function(){return eg.SCAN_TYPE_CHANGE_ANCHOR_ID},eS.prototype.getScanRegionId=function(){return"".concat(this.elementId,"__scan_region")},eS.prototype.getDashboardId=function(){return"".concat(this.elementId,"__dashboard")},eS.prototype.getHeaderMessageContainerId=function(){return"".concat(this.elementId,"__header_message")},eS.prototype.getCameraPermissionButtonId=function(){return eg.CAMERA_PERMISSION_BUTTON_ID},eS.prototype.getCameraScanRegion=function(){return document.getElementById(this.getDashboardSectionCameraScanRegionId())},eS.prototype.getDashboardSectionSwapLink=function(){return document.getElementById(this.getDashboardSectionSwapLinkId())},eS.prototype.getHeaderMessageDiv=function(){return document.getElementById(this.getHeaderMessageContainerId())}},103:function(e,t,r){(function(e){"use strict";let t;var n,i,o,a,s,l,c,u,h,d,f,g,p,m,w,C,E,A,y,I,S,_,b=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])},T=function(e){function t(){this.constructor=r}function r(t){var r,n,i,o,a=this.constructor,s=e.call(this,t)||this;return Object.defineProperty(s,"name",{value:a.name,enumerable:!1}),r=a.prototype,(n=Object.setPrototypeOf)?n(s,r):s.__proto__=r,void 0===i&&(i=s.constructor),(o=Error.captureStackTrace)&&o(s,i),s}return b(r,e),r.prototype=null===e?Object.create(e):(t.prototype=e.prototype,new t),r}(Error);class N extends T{constructor(e){super(e),this.message=e}getKind(){return this.constructor.kind}}N.kind="Exception";class M extends N{}M.kind="ArgumentException";class D extends N{}D.kind="IllegalArgumentException";class O{constructor(e){if(this.binarizer=e,null===e)throw new D("Binarizer must be non-null.")}getWidth(){return this.binarizer.getWidth()}getHeight(){return this.binarizer.getHeight()}getBlackRow(e,t){return this.binarizer.getBlackRow(e,t)}getBlackMatrix(){return(null===this.matrix||void 0===this.matrix)&&(this.matrix=this.binarizer.getBlackMatrix()),this.matrix}isCropSupported(){return this.binarizer.getLuminanceSource().isCropSupported()}crop(e,t,r,n){let i=this.binarizer.getLuminanceSource().crop(e,t,r,n);return new O(this.binarizer.createBinarizer(i))}isRotateSupported(){return this.binarizer.getLuminanceSource().isRotateSupported()}rotateCounterClockwise(){let e=this.binarizer.getLuminanceSource().rotateCounterClockwise();return new O(this.binarizer.createBinarizer(e))}rotateCounterClockwise45(){let e=this.binarizer.getLuminanceSource().rotateCounterClockwise45();return new O(this.binarizer.createBinarizer(e))}toString(){try{return this.getBlackMatrix().toString()}catch(e){return""}}}class R extends N{static getChecksumInstance(){return new R}}R.kind="ChecksumException";class v{constructor(e){this.source=e}getLuminanceSource(){return this.source}getWidth(){return this.source.getWidth()}getHeight(){return this.source.getHeight()}}class P{static arraycopy(e,t,r,n,i){for(;i--;)r[n++]=e[t++]}static currentTimeMillis(){return Date.now()}}class B extends N{}B.kind="IndexOutOfBoundsException";class x extends B{constructor(e,t){super(t),this.index=e,this.message=t}}x.kind="ArrayIndexOutOfBoundsException";class L{static fill(e,t){for(let r=0,n=e.length;r<n;r++)e[r]=t}static fillWithin(e,t,r,n){L.rangeCheck(e.length,t,r);for(let i=t;i<r;i++)e[i]=n}static rangeCheck(e,t,r){if(t>r)throw new D("fromIndex("+t+") > toIndex("+r+")");if(t<0)throw new x(t);if(r>e)throw new x(r)}static asList(...e){return e}static create(e,t,r){return Array.from({length:e}).map(e=>Array.from({length:t}).fill(r))}static createInt32Array(e,t,r){return Array.from({length:e}).map(e=>Int32Array.from({length:t}).fill(r))}static equals(e,t){if(!e||!t||!e.length||!t.length||e.length!==t.length)return!1;for(let r=0,n=e.length;r<n;r++)if(e[r]!==t[r])return!1;return!0}static hashCode(e){if(null===e)return 0;let t=1;for(let r of e)t=31*t+r;return t}static fillUint8Array(e,t){for(let r=0;r!==e.length;r++)e[r]=t}static copyOf(e,t){return e.slice(0,t)}static copyOfUint8Array(e,t){if(e.length<=t){let r=new Uint8Array(t);return r.set(e),r}return e.slice(0,t)}static copyOfRange(e,t,r){let n=r-t,i=new Int32Array(n);return P.arraycopy(e,t,i,0,n),i}static binarySearch(e,t,r){void 0===r&&(r=L.numberComparator);let n=0,i=e.length-1;for(;n<=i;){let o=i+n>>1,a=r(t,e[o]);if(a>0)n=o+1;else{if(!(a<0))return o;i=o-1}}return-n-1}static numberComparator(e,t){return e-t}}class k{static numberOfTrailingZeros(e){let t;if(0===e)return 32;let r=31;return 0!=(t=e<<16)&&(r-=16,e=t),0!=(t=e<<8)&&(r-=8,e=t),0!=(t=e<<4)&&(r-=4,e=t),0!=(t=e<<2)&&(r-=2,e=t),r-(e<<1>>>31)}static numberOfLeadingZeros(e){if(0===e)return 32;let t=1;return e>>>16==0&&(t+=16,e<<=16),e>>>24==0&&(t+=8,e<<=8),e>>>28==0&&(t+=4,e<<=4),e>>>30==0&&(t+=2,e<<=2),t-=e>>>31}static toHexString(e){return e.toString(16)}static toBinaryString(e){return String(parseInt(String(e),2))}static bitCount(e){return e-=e>>>1&0x55555555,e=(e=(0x33333333&e)+(e>>>2&0x33333333))+(e>>>4)&0xf0f0f0f,e+=e>>>8,63&(e+=e>>>16)}static truncDivision(e,t){return Math.trunc(e/t)}static parseInt(e,t){return parseInt(e,t)}}k.MIN_VALUE_32_BITS=-0x80000000,k.MAX_VALUE=Number.MAX_SAFE_INTEGER;class F{constructor(e,t){void 0===e?(this.size=0,this.bits=new Int32Array(1)):(this.size=e,null==t?this.bits=F.makeArray(e):this.bits=t)}getSize(){return this.size}getSizeInBytes(){return Math.floor((this.size+7)/8)}ensureCapacity(e){if(e>32*this.bits.length){let t=F.makeArray(e);P.arraycopy(this.bits,0,t,0,this.bits.length),this.bits=t}}get(e){return(this.bits[Math.floor(e/32)]&1<<(31&e))!=0}set(e){this.bits[Math.floor(e/32)]|=1<<(31&e)}flip(e){this.bits[Math.floor(e/32)]^=1<<(31&e)}getNextSet(e){let t=this.size;if(e>=t)return t;let r=this.bits,n=Math.floor(e/32),i=r[n];i&=~((1<<(31&e))-1);let o=r.length;for(;0===i;){if(++n===o)return t;i=r[n]}let a=32*n+k.numberOfTrailingZeros(i);return a>t?t:a}getNextUnset(e){let t=this.size;if(e>=t)return t;let r=this.bits,n=Math.floor(e/32),i=~r[n];i&=~((1<<(31&e))-1);let o=r.length;for(;0===i;){if(++n===o)return t;i=~r[n]}let a=32*n+k.numberOfTrailingZeros(i);return a>t?t:a}setBulk(e,t){this.bits[Math.floor(e/32)]=t}setRange(e,t){if(t<e||e<0||t>this.size)throw new D;if(t===e)return;let r=Math.floor(e/32),n=Math.floor(--t/32),i=this.bits;for(let o=r;o<=n;o++){let a=o>r?0:31&e,s=(2<<(o<n?31:31&t))-(1<<a);i[o]|=s}}clear(){let e=this.bits.length,t=this.bits;for(let r=0;r<e;r++)t[r]=0}isRange(e,t,r){if(t<e||e<0||t>this.size)throw new D;if(t===e)return!0;let n=Math.floor(e/32),i=Math.floor(--t/32),o=this.bits;for(let a=n;a<=i;a++){let s=a>n?0:31&e,l=(2<<(a<i?31:31&t))-(1<<s)&0xffffffff;if((o[a]&l)!==(r?l:0))return!1}return!0}appendBit(e){this.ensureCapacity(this.size+1),e&&(this.bits[Math.floor(this.size/32)]|=1<<(31&this.size)),this.size++}appendBits(e,t){if(t<0||t>32)throw new D("Num bits must be between 0 and 32");this.ensureCapacity(this.size+t);for(let r=t;r>0;r--)this.appendBit((e>>r-1&1)==1)}appendBitArray(e){let t=e.size;this.ensureCapacity(this.size+t);for(let r=0;r<t;r++)this.appendBit(e.get(r))}xor(e){if(this.size!==e.size)throw new D("Sizes don't match");let t=this.bits;for(let r=0,n=t.length;r<n;r++)t[r]^=e.bits[r]}toBytes(e,t,r,n){for(let i=0;i<n;i++){let n=0;for(let t=0;t<8;t++)this.get(e)&&(n|=1<<7-t),e++;t[r+i]=n}}getBitArray(){return this.bits}reverse(){let e=new Int32Array(this.bits.length),t=Math.floor((this.size-1)/32),r=t+1,n=this.bits;for(let i=0;i<r;i++){let r=n[i];r=(r=(r=(r=(r=r>>1&0x55555555|(0x55555555&r)<<1)>>2&0x33333333|(0x33333333&r)<<2)>>4&0xf0f0f0f|(0xf0f0f0f&r)<<4)>>8&0xff00ff|(0xff00ff&r)<<8)>>16&65535|(65535&r)<<16,e[t-i]=r}if(this.size!==32*r){let t=32*r-this.size,n=e[0]>>>t;for(let i=1;i<r;i++){let r=e[i];n|=r<<32-t,e[i-1]=n,n=r>>>t}e[r-1]=n}this.bits=e}static makeArray(e){return new Int32Array(Math.floor((e+31)/32))}equals(e){return e instanceof F&&this.size===e.size&&L.equals(this.bits,e.bits)}hashCode(){return 31*this.size+L.hashCode(this.bits)}toString(){let e="";for(let t=0,r=this.size;t<r;t++)(7&t)==0&&(e+=" "),e+=this.get(t)?"X":".";return e}clone(){return new F(this.size,this.bits.slice())}}(n=g||(g={}))[n.OTHER=0]="OTHER",n[n.PURE_BARCODE=1]="PURE_BARCODE",n[n.POSSIBLE_FORMATS=2]="POSSIBLE_FORMATS",n[n.TRY_HARDER=3]="TRY_HARDER",n[n.CHARACTER_SET=4]="CHARACTER_SET",n[n.ALLOWED_LENGTHS=5]="ALLOWED_LENGTHS",n[n.ASSUME_CODE_39_CHECK_DIGIT=6]="ASSUME_CODE_39_CHECK_DIGIT",n[n.ASSUME_GS1=7]="ASSUME_GS1",n[n.RETURN_CODABAR_START_END=8]="RETURN_CODABAR_START_END",n[n.NEED_RESULT_POINT_CALLBACK=9]="NEED_RESULT_POINT_CALLBACK",n[n.ALLOWED_EAN_EXTENSIONS=10]="ALLOWED_EAN_EXTENSIONS";var U=g;class H extends N{static getFormatInstance(){return new H}}H.kind="FormatException",(i=p||(p={}))[i.Cp437=0]="Cp437",i[i.ISO8859_1=1]="ISO8859_1",i[i.ISO8859_2=2]="ISO8859_2",i[i.ISO8859_3=3]="ISO8859_3",i[i.ISO8859_4=4]="ISO8859_4",i[i.ISO8859_5=5]="ISO8859_5",i[i.ISO8859_6=6]="ISO8859_6",i[i.ISO8859_7=7]="ISO8859_7",i[i.ISO8859_8=8]="ISO8859_8",i[i.ISO8859_9=9]="ISO8859_9",i[i.ISO8859_10=10]="ISO8859_10",i[i.ISO8859_11=11]="ISO8859_11",i[i.ISO8859_13=12]="ISO8859_13",i[i.ISO8859_14=13]="ISO8859_14",i[i.ISO8859_15=14]="ISO8859_15",i[i.ISO8859_16=15]="ISO8859_16",i[i.SJIS=16]="SJIS",i[i.Cp1250=17]="Cp1250",i[i.Cp1251=18]="Cp1251",i[i.Cp1252=19]="Cp1252",i[i.Cp1256=20]="Cp1256",i[i.UnicodeBigUnmarked=21]="UnicodeBigUnmarked",i[i.UTF8=22]="UTF8",i[i.ASCII=23]="ASCII",i[i.Big5=24]="Big5",i[i.GB18030=25]="GB18030",i[i.EUC_KR=26]="EUC_KR";class z{constructor(e,t,r,...n){this.valueIdentifier=e,this.name=r,"number"==typeof t?this.values=Int32Array.from([t]):this.values=t,this.otherEncodingNames=n,z.VALUE_IDENTIFIER_TO_ECI.set(e,this),z.NAME_TO_ECI.set(r,this);let i=this.values;for(let e=0,t=i.length;e!==t;e++){let t=i[e];z.VALUES_TO_ECI.set(t,this)}for(let e of n)z.NAME_TO_ECI.set(e,this)}getValueIdentifier(){return this.valueIdentifier}getName(){return this.name}getValue(){return this.values[0]}static getCharacterSetECIByValue(e){if(e<0||e>=900)throw new H("incorect value");let t=z.VALUES_TO_ECI.get(e);if(void 0===t)throw new H("incorect value");return t}static getCharacterSetECIByName(e){let t=z.NAME_TO_ECI.get(e);if(void 0===t)throw new H("incorect value");return t}equals(e){return e instanceof z&&this.getName()===e.getName()}}z.VALUE_IDENTIFIER_TO_ECI=new Map,z.VALUES_TO_ECI=new Map,z.NAME_TO_ECI=new Map,z.Cp437=new z(p.Cp437,Int32Array.from([0,2]),"Cp437"),z.ISO8859_1=new z(p.ISO8859_1,Int32Array.from([1,3]),"ISO-8859-1","ISO88591","ISO8859_1"),z.ISO8859_2=new z(p.ISO8859_2,4,"ISO-8859-2","ISO88592","ISO8859_2"),z.ISO8859_3=new z(p.ISO8859_3,5,"ISO-8859-3","ISO88593","ISO8859_3"),z.ISO8859_4=new z(p.ISO8859_4,6,"ISO-8859-4","ISO88594","ISO8859_4"),z.ISO8859_5=new z(p.ISO8859_5,7,"ISO-8859-5","ISO88595","ISO8859_5"),z.ISO8859_6=new z(p.ISO8859_6,8,"ISO-8859-6","ISO88596","ISO8859_6"),z.ISO8859_7=new z(p.ISO8859_7,9,"ISO-8859-7","ISO88597","ISO8859_7"),z.ISO8859_8=new z(p.ISO8859_8,10,"ISO-8859-8","ISO88598","ISO8859_8"),z.ISO8859_9=new z(p.ISO8859_9,11,"ISO-8859-9","ISO88599","ISO8859_9"),z.ISO8859_10=new z(p.ISO8859_10,12,"ISO-8859-10","ISO885910","ISO8859_10"),z.ISO8859_11=new z(p.ISO8859_11,13,"ISO-8859-11","ISO885911","ISO8859_11"),z.ISO8859_13=new z(p.ISO8859_13,15,"ISO-8859-13","ISO885913","ISO8859_13"),z.ISO8859_14=new z(p.ISO8859_14,16,"ISO-8859-14","ISO885914","ISO8859_14"),z.ISO8859_15=new z(p.ISO8859_15,17,"ISO-8859-15","ISO885915","ISO8859_15"),z.ISO8859_16=new z(p.ISO8859_16,18,"ISO-8859-16","ISO885916","ISO8859_16"),z.SJIS=new z(p.SJIS,20,"SJIS","Shift_JIS"),z.Cp1250=new z(p.Cp1250,21,"Cp1250","windows-1250"),z.Cp1251=new z(p.Cp1251,22,"Cp1251","windows-1251"),z.Cp1252=new z(p.Cp1252,23,"Cp1252","windows-1252"),z.Cp1256=new z(p.Cp1256,24,"Cp1256","windows-1256"),z.UnicodeBigUnmarked=new z(p.UnicodeBigUnmarked,25,"UnicodeBigUnmarked","UTF-16BE","UnicodeBig"),z.UTF8=new z(p.UTF8,26,"UTF8","UTF-8"),z.ASCII=new z(p.ASCII,Int32Array.from([27,170]),"ASCII","US-ASCII"),z.Big5=new z(p.Big5,28,"Big5"),z.GB18030=new z(p.GB18030,29,"GB18030","GB2312","EUC_CN","GBK"),z.EUC_KR=new z(p.EUC_KR,30,"EUC_KR","EUC-KR");class V extends N{}V.kind="UnsupportedOperationException";class j{static decode(e,t){let r=this.encodingName(t);return this.customDecoder?this.customDecoder(e,r):"undefined"==typeof TextDecoder||this.shouldDecodeOnFallback(r)?this.decodeFallback(e,r):new TextDecoder(r).decode(e)}static shouldDecodeOnFallback(e){return!j.isBrowser()&&"ISO-8859-1"===e}static encode(e,t){let r=this.encodingName(t);return this.customEncoder?this.customEncoder(e,r):"undefined"==typeof TextEncoder?this.encodeFallback(e):new TextEncoder().encode(e)}static isBrowser(){return"undefined"!=typeof window&&"[object Window]"===({}).toString.call(window)}static encodingName(e){return"string"==typeof e?e:e.getName()}static encodingCharacterSet(e){return e instanceof z?e:z.getCharacterSetECIByName(e)}static decodeFallback(e,t){let r=this.encodingCharacterSet(t);if(j.isDecodeFallbackSupported(r)){let t="";for(let r=0,n=e.length;r<n;r++){let n=e[r].toString(16);n.length<2&&(n="0"+n),t+="%"+n}return decodeURIComponent(t)}if(r.equals(z.UnicodeBigUnmarked))return String.fromCharCode.apply(null,new Uint16Array(e.buffer));throw new V(`Encoding ${this.encodingName(t)} not supported by fallback.`)}static isDecodeFallbackSupported(e){return e.equals(z.UTF8)||e.equals(z.ISO8859_1)||e.equals(z.ASCII)}static encodeFallback(e){let t=btoa(unescape(encodeURIComponent(e))).split(""),r=[];for(let e=0;e<t.length;e++)r.push(t[e].charCodeAt(0));return new Uint8Array(r)}}class G{static castAsNonUtf8Char(e,t=null){let r=t?t.getName():this.ISO88591;return j.decode(new Uint8Array([e]),r)}static guessEncoding(e,t){if(null!=t&&void 0!==t.get(U.CHARACTER_SET))return t.get(U.CHARACTER_SET).toString();let r=e.length,n=!0,i=!0,o=!0,a=0,s=0,l=0,c=0,u=0,h=0,d=0,f=0,g=0,p=0,m=0,w=e.length>3&&239===e[0]&&187===e[1]&&191===e[2];for(let t=0;t<r&&(n||i||o);t++){let r=255&e[t];o&&(a>0?(128&r)==0?o=!1:a--:(128&r)!=0&&((64&r)==0?o=!1:(a++,(32&r)==0?s++:(a++,(16&r)==0?l++:(a++,(8&r)==0?c++:o=!1))))),n&&(r>127&&r<160?n=!1:r>159&&(r<192||215===r||247===r)&&m++),i&&(u>0?r<64||127===r||r>252?i=!1:u--:128===r||160===r||r>239?i=!1:r>160&&r<224?(h++,f=0,++d>g&&(g=d)):r>127?(u++,d=0,++f>p&&(p=f)):(d=0,f=0))}return(o&&a>0&&(o=!1),i&&u>0&&(i=!1),o&&(w||s+l+c>0))?G.UTF8:i&&(G.ASSUME_SHIFT_JIS||g>=3||p>=3)?G.SHIFT_JIS:n&&i?2===g&&2===h||10*m>=r?G.SHIFT_JIS:G.ISO88591:n?G.ISO88591:i?G.SHIFT_JIS:o?G.UTF8:G.PLATFORM_DEFAULT_ENCODING}static format(e,...t){let r=-1;return e.replace(/%(-)?(0?[0-9]+)?([.][0-9]+)?([#][0-9]+)?([scfpexd%])/g,function(e,n,i,o,a,s){let l;if("%%"===e)return"%";if(void 0===t[++r])return;e=o?parseInt(o.substr(1)):void 0;let c=a?parseInt(a.substr(1)):void 0;switch(s){case"s":l=t[r];break;case"c":l=t[r][0];break;case"f":l=parseFloat(t[r]).toFixed(e);break;case"p":l=parseFloat(t[r]).toPrecision(e);break;case"e":l=parseFloat(t[r]).toExponential(e);break;case"x":l=parseInt(t[r]).toString(c||16);break;case"d":l=parseFloat(parseInt(t[r],c||10).toPrecision(e)).toFixed(0)}l="object"==typeof l?JSON.stringify(l):(+l).toString(c);let u=parseInt(i),h=i&&i[0]+""=="0"?"0":" ";for(;l.length<u;)l=void 0!==n?l+h:h+l;return l})}static getBytes(e,t){return j.encode(e,t)}static getCharCode(e,t=0){return e.charCodeAt(t)}static getCharAt(e){return String.fromCharCode(e)}}G.SHIFT_JIS=z.SJIS.getName(),G.GB2312="GB2312",G.ISO88591=z.ISO8859_1.getName(),G.EUC_JP="EUC_JP",G.UTF8=z.UTF8.getName(),G.PLATFORM_DEFAULT_ENCODING=G.UTF8,G.ASSUME_SHIFT_JIS=!1;class W{constructor(e=""){this.value=e}enableDecoding(e){return this.encoding=e,this}append(e){return"string"==typeof e?this.value+=e.toString():this.encoding?this.value+=G.castAsNonUtf8Char(e,this.encoding):this.value+=String.fromCharCode(e),this}appendChars(e,t,r){for(let n=t;t<t+r;n++)this.append(e[n]);return this}length(){return this.value.length}charAt(e){return this.value.charAt(e)}deleteCharAt(e){this.value=this.value.substr(0,e)+this.value.substring(e+1)}setCharAt(e,t){this.value=this.value.substr(0,e)+t+this.value.substr(e+1)}substring(e,t){return this.value.substring(e,t)}setLengthToZero(){this.value=""}toString(){return this.value}insert(e,t){this.value=this.value.substr(0,e)+t+this.value.substr(e+t.length)}}class Y{constructor(e,t,r,n){if(this.width=e,this.height=t,this.rowSize=r,this.bits=n,null==t&&(t=e),this.height=t,e<1||t<1)throw new D("Both dimensions must be greater than 0");null==r&&(r=Math.floor((e+31)/32)),this.rowSize=r,null==n&&(this.bits=new Int32Array(this.rowSize*this.height))}static parseFromBooleanArray(e){let t=e.length,r=e[0].length,n=new Y(r,t);for(let i=0;i<t;i++){let t=e[i];for(let e=0;e<r;e++)t[e]&&n.set(e,i)}return n}static parseFromString(e,t,r){if(null===e)throw new D("stringRepresentation cannot be null");let n=Array(e.length),i=0,o=0,a=-1,s=0,l=0;for(;l<e.length;)if("\n"===e.charAt(l)||"\r"===e.charAt(l)){if(i>o){if(-1===a)a=i-o;else if(i-o!==a)throw new D("row lengths do not match");o=i,s++}l++}else if(e.substring(l,l+t.length)===t)l+=t.length,n[i]=!0,i++;else if(e.substring(l,l+r.length)===r)l+=r.length,n[i]=!1,i++;else throw new D("illegal character encountered: "+e.substring(l));if(i>o){if(-1===a)a=i-o;else if(i-o!==a)throw new D("row lengths do not match");s++}let c=new Y(a,s);for(let e=0;e<i;e++)n[e]&&c.set(Math.floor(e%a),Math.floor(e/a));return c}get(e,t){let r=t*this.rowSize+Math.floor(e/32);return(this.bits[r]>>>(31&e)&1)!=0}set(e,t){let r=t*this.rowSize+Math.floor(e/32);this.bits[r]|=1<<(31&e)&0xffffffff}unset(e,t){let r=t*this.rowSize+Math.floor(e/32);this.bits[r]&=~(1<<(31&e)&0xffffffff)}flip(e,t){let r=t*this.rowSize+Math.floor(e/32);this.bits[r]^=1<<(31&e)&0xffffffff}xor(e){if(this.width!==e.getWidth()||this.height!==e.getHeight()||this.rowSize!==e.getRowSize())throw new D("input matrix dimensions do not match");let t=new F(Math.floor(this.width/32)+1),r=this.rowSize,n=this.bits;for(let i=0,o=this.height;i<o;i++){let o=i*r,a=e.getRow(i,t).getBitArray();for(let e=0;e<r;e++)n[o+e]^=a[e]}}clear(){let e=this.bits,t=e.length;for(let r=0;r<t;r++)e[r]=0}setRegion(e,t,r,n){if(t<0||e<0)throw new D("Left and top must be nonnegative");if(n<1||r<1)throw new D("Height and width must be at least 1");let i=e+r,o=t+n;if(o>this.height||i>this.width)throw new D("The region must fit inside the matrix");let a=this.rowSize,s=this.bits;for(let r=t;r<o;r++){let t=r*a;for(let r=e;r<i;r++)s[t+Math.floor(r/32)]|=1<<(31&r)&0xffffffff}}getRow(e,t){null==t||t.getSize()<this.width?t=new F(this.width):t.clear();let r=this.rowSize,n=this.bits,i=e*r;for(let e=0;e<r;e++)t.setBulk(32*e,n[i+e]);return t}setRow(e,t){P.arraycopy(t.getBitArray(),0,this.bits,e*this.rowSize,this.rowSize)}rotate180(){let e=this.getWidth(),t=this.getHeight(),r=new F(e),n=new F(e);for(let e=0,i=Math.floor((t+1)/2);e<i;e++)r=this.getRow(e,r),n=this.getRow(t-1-e,n),r.reverse(),n.reverse(),this.setRow(e,n),this.setRow(t-1-e,r)}getEnclosingRectangle(){let e=this.width,t=this.height,r=this.rowSize,n=this.bits,i=e,o=t,a=-1,s=-1;for(let e=0;e<t;e++)for(let t=0;t<r;t++){let l=n[e*r+t];if(0!==l){if(e<o&&(o=e),e>s&&(s=e),32*t<i){let e=0;for(;(l<<31-e&0xffffffff)==0;)e++;32*t+e<i&&(i=32*t+e)}if(32*t+31>a){let e=31;for(;l>>>e==0;)e--;32*t+e>a&&(a=32*t+e)}}}return a<i||s<o?null:Int32Array.from([i,o,a-i+1,s-o+1])}getTopLeftOnBit(){let e=this.rowSize,t=this.bits,r=0;for(;r<t.length&&0===t[r];)r++;if(r===t.length)return null;let n=r/e,i=r%e*32,o=t[r],a=0;for(;(o<<31-a&0xffffffff)==0;)a++;return i+=a,Int32Array.from([i,n])}getBottomRightOnBit(){let e=this.rowSize,t=this.bits,r=t.length-1;for(;r>=0&&0===t[r];)r--;if(r<0)return null;let n=Math.floor(r/e),i=32*Math.floor(r%e),o=t[r],a=31;for(;o>>>a==0;)a--;return i+=a,Int32Array.from([i,n])}getWidth(){return this.width}getHeight(){return this.height}getRowSize(){return this.rowSize}equals(e){return e instanceof Y&&this.width===e.width&&this.height===e.height&&this.rowSize===e.rowSize&&L.equals(this.bits,e.bits)}hashCode(){let e=this.width;return 31*(e=31*(e=31*(e=31*e+this.width)+this.height)+this.rowSize)+L.hashCode(this.bits)}toString(e="X ",t=" ",r="\n"){return this.buildToString(e,t,r)}buildToString(e,t,r){let n=new W;for(let i=0,o=this.height;i<o;i++){for(let r=0,o=this.width;r<o;r++)n.append(this.get(r,i)?e:t);n.append(r)}return n.toString()}clone(){return new Y(this.width,this.height,this.rowSize,this.bits.slice())}}class X extends N{static getNotFoundInstance(){return new X}}X.kind="NotFoundException";class Z extends v{constructor(e){super(e),this.luminances=Z.EMPTY,this.buckets=new Int32Array(Z.LUMINANCE_BUCKETS)}getBlackRow(e,t){let r=this.getLuminanceSource(),n=r.getWidth();null==t||t.getSize()<n?t=new F(n):t.clear(),this.initArrays(n);let i=r.getRow(e,this.luminances),o=this.buckets;for(let e=0;e<n;e++)o[(255&i[e])>>Z.LUMINANCE_SHIFT]++;let a=Z.estimateBlackPoint(o);if(n<3)for(let e=0;e<n;e++)(255&i[e])<a&&t.set(e);else{let e=255&i[0],r=255&i[1];for(let o=1;o<n-1;o++){let n=255&i[o+1];(4*r-e-n)/2<a&&t.set(o),e=r,r=n}}return t}getBlackMatrix(){let e=this.getLuminanceSource(),t=e.getWidth(),r=e.getHeight(),n=new Y(t,r);this.initArrays(t);let i=this.buckets;for(let n=1;n<5;n++){let o=Math.floor(r*n/5),a=e.getRow(o,this.luminances),s=Math.floor(4*t/5);for(let e=Math.floor(t/5);e<s;e++){let t=255&a[e];i[t>>Z.LUMINANCE_SHIFT]++}}let o=Z.estimateBlackPoint(i),a=e.getMatrix();for(let e=0;e<r;e++){let r=e*t;for(let i=0;i<t;i++)(255&a[r+i])<o&&n.set(i,e)}return n}createBinarizer(e){return new Z(e)}initArrays(e){this.luminances.length<e&&(this.luminances=new Uint8ClampedArray(e));let t=this.buckets;for(let e=0;e<Z.LUMINANCE_BUCKETS;e++)t[e]=0}static estimateBlackPoint(e){let t=e.length,r=0,n=0,i=0;for(let o=0;o<t;o++)e[o]>i&&(n=o,i=e[o]),e[o]>r&&(r=e[o]);let o=0,a=0;for(let r=0;r<t;r++){let t=r-n,i=e[r]*t*t;i>a&&(o=r,a=i)}if(n>o){let e=n;n=o,o=e}if(o-n<=t/16)throw new X;let s=o-1,l=-1;for(let t=o-1;t>n;t--){let i=t-n,a=i*i*(o-t)*(r-e[t]);a>l&&(s=t,l=a)}return s<<Z.LUMINANCE_SHIFT}}Z.LUMINANCE_BITS=5,Z.LUMINANCE_SHIFT=8-Z.LUMINANCE_BITS,Z.LUMINANCE_BUCKETS=1<<Z.LUMINANCE_BITS,Z.EMPTY=Uint8ClampedArray.from([0]);class Q extends Z{constructor(e){super(e),this.matrix=null}getBlackMatrix(){if(null!==this.matrix)return this.matrix;let e=this.getLuminanceSource(),t=e.getWidth(),r=e.getHeight();if(t>=Q.MINIMUM_DIMENSION&&r>=Q.MINIMUM_DIMENSION){let n=e.getMatrix(),i=t>>Q.BLOCK_SIZE_POWER;(t&Q.BLOCK_SIZE_MASK)!=0&&i++;let o=r>>Q.BLOCK_SIZE_POWER;(r&Q.BLOCK_SIZE_MASK)!=0&&o++;let a=Q.calculateBlackPoints(n,i,o,t,r),s=new Y(t,r);Q.calculateThresholdForBlock(n,i,o,t,r,a,s),this.matrix=s}else this.matrix=super.getBlackMatrix();return this.matrix}createBinarizer(e){return new Q(e)}static calculateThresholdForBlock(e,t,r,n,i,o,a){let s=i-Q.BLOCK_SIZE,l=n-Q.BLOCK_SIZE;for(let i=0;i<r;i++){let c=i<<Q.BLOCK_SIZE_POWER;c>s&&(c=s);let u=Q.cap(i,2,r-3);for(let r=0;r<t;r++){let i=r<<Q.BLOCK_SIZE_POWER;i>l&&(i=l);let s=Q.cap(r,2,t-3),h=0;for(let e=-2;e<=2;e++){let t=o[u+e];h+=t[s-2]+t[s-1]+t[s]+t[s+1]+t[s+2]}let d=h/25;Q.thresholdBlock(e,i,c,d,n,a)}}}static cap(e,t,r){return e<t?t:e>r?r:e}static thresholdBlock(e,t,r,n,i,o){for(let a=0,s=r*i+t;a<Q.BLOCK_SIZE;a++,s+=i)for(let i=0;i<Q.BLOCK_SIZE;i++)(255&e[s+i])<=n&&o.set(t+i,r+a)}static calculateBlackPoints(e,t,r,n,i){let o=i-Q.BLOCK_SIZE,a=n-Q.BLOCK_SIZE,s=Array(r);for(let i=0;i<r;i++){s[i]=new Int32Array(t);let r=i<<Q.BLOCK_SIZE_POWER;r>o&&(r=o);for(let o=0;o<t;o++){let t=o<<Q.BLOCK_SIZE_POWER;t>a&&(t=a);let l=0,c=255,u=0;for(let i=0,o=r*n+t;i<Q.BLOCK_SIZE;i++,o+=n){for(let t=0;t<Q.BLOCK_SIZE;t++){let r=255&e[o+t];l+=r,r<c&&(c=r),r>u&&(u=r)}if(u-c>Q.MIN_DYNAMIC_RANGE)for(i++,o+=n;i<Q.BLOCK_SIZE;i++,o+=n)for(let t=0;t<Q.BLOCK_SIZE;t++)l+=255&e[o+t]}let h=l>>2*Q.BLOCK_SIZE_POWER;if(u-c<=Q.MIN_DYNAMIC_RANGE&&(h=c/2,i>0&&o>0)){let e=(s[i-1][o]+2*s[i][o-1]+s[i-1][o-1])/4;c<e&&(h=e)}s[i][o]=h}}return s}}Q.BLOCK_SIZE_POWER=3,Q.BLOCK_SIZE=1<<Q.BLOCK_SIZE_POWER,Q.BLOCK_SIZE_MASK=Q.BLOCK_SIZE-1,Q.MINIMUM_DIMENSION=5*Q.BLOCK_SIZE,Q.MIN_DYNAMIC_RANGE=24;class q{constructor(e,t){this.width=e,this.height=t}getWidth(){return this.width}getHeight(){return this.height}isCropSupported(){return!1}crop(e,t,r,n){throw new V("This luminance source does not support cropping.")}isRotateSupported(){return!1}rotateCounterClockwise(){throw new V("This luminance source does not support rotation by 90 degrees.")}rotateCounterClockwise45(){throw new V("This luminance source does not support rotation by 45 degrees.")}toString(){let e=new Uint8ClampedArray(this.width),t=new W;for(let r=0;r<this.height;r++){let n=this.getRow(r,e);for(let e=0;e<this.width;e++){let r,i=255&n[e];r=i<64?"#":i<128?"+":i<192?".":" ",t.append(r)}t.append("\n")}return t.toString()}}class K extends q{constructor(e){super(e.getWidth(),e.getHeight()),this.delegate=e}getRow(e,t){let r=this.delegate.getRow(e,t),n=this.getWidth();for(let e=0;e<n;e++)r[e]=255-(255&r[e]);return r}getMatrix(){let e=this.delegate.getMatrix(),t=this.getWidth()*this.getHeight(),r=new Uint8ClampedArray(t);for(let n=0;n<t;n++)r[n]=255-(255&e[n]);return r}isCropSupported(){return this.delegate.isCropSupported()}crop(e,t,r,n){return new K(this.delegate.crop(e,t,r,n))}isRotateSupported(){return this.delegate.isRotateSupported()}invert(){return this.delegate}rotateCounterClockwise(){return new K(this.delegate.rotateCounterClockwise())}rotateCounterClockwise45(){return new K(this.delegate.rotateCounterClockwise45())}}class $ extends q{constructor(e){super(e.width,e.height),this.canvas=e,this.tempCanvasElement=null,this.buffer=$.makeBufferFromCanvasImageData(e)}static makeBufferFromCanvasImageData(e){let t=e.getContext("2d").getImageData(0,0,e.width,e.height);return $.toGrayscaleBuffer(t.data,e.width,e.height)}static toGrayscaleBuffer(e,t,r){let n=new Uint8ClampedArray(t*r);for(let t=0,r=0,i=e.length;t<i;t+=4,r++){let i;if(0===e[t+3])i=255;else{let r=e[t];i=306*r+601*e[t+1]+117*e[t+2]+512>>10}n[r]=i}return n}getRow(e,t){if(e<0||e>=this.getHeight())throw new D("Requested row is outside the image: "+e);let r=this.getWidth(),n=e*r;return null===t?t=this.buffer.slice(n,n+r):(t.length<r&&(t=new Uint8ClampedArray(r)),t.set(this.buffer.slice(n,n+r))),t}getMatrix(){return this.buffer}isCropSupported(){return!0}crop(e,t,r,n){return super.crop(e,t,r,n),this}isRotateSupported(){return!0}rotateCounterClockwise(){return this.rotate(-90),this}rotateCounterClockwise45(){return this.rotate(-45),this}getTempCanvasElement(){if(null===this.tempCanvasElement){let e=this.canvas.ownerDocument.createElement("canvas");e.width=this.canvas.width,e.height=this.canvas.height,this.tempCanvasElement=e}return this.tempCanvasElement}rotate(e){let t=this.getTempCanvasElement(),r=t.getContext("2d"),n=e*$.DEGREE_TO_RADIANS,i=this.canvas.width,o=this.canvas.height,a=Math.ceil(Math.abs(Math.cos(n))*i+Math.abs(Math.sin(n))*o),s=Math.ceil(Math.abs(Math.sin(n))*i+Math.abs(Math.cos(n))*o);return t.width=a,t.height=s,r.translate(a/2,s/2),r.rotate(n),r.drawImage(this.canvas,-(i/2),-(o/2)),this.buffer=$.makeBufferFromCanvasImageData(t),this}invert(){return new K(this)}}$.DEGREE_TO_RADIANS=Math.PI/180;class J{constructor(e,t,r){this.deviceId=e,this.label=t,this.kind="videoinput",this.groupId=r||void 0}toJSON(){return{kind:this.kind,groupId:this.groupId,deviceId:this.deviceId,label:this.label}}}var ee=(globalThis||r.g||self||window||void 0)&&(globalThis||r.g||self||window||void 0).__awaiter||function(e,t,r,n){return new(r||(r=Promise))(function(i,o){function a(e){try{l(n.next(e))}catch(e){o(e)}}function s(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(a,s)}l((n=n.apply(e,t||[])).next())})};class et{constructor(e,t=500,r){this.reader=e,this.timeBetweenScansMillis=t,this._hints=r,this._stopContinuousDecode=!1,this._stopAsyncDecode=!1,this._timeBetweenDecodingAttempts=0}get hasNavigator(){return"undefined"!=typeof navigator}get isMediaDevicesSuported(){return this.hasNavigator&&!!navigator.mediaDevices}get canEnumerateDevices(){return!!(this.isMediaDevicesSuported&&navigator.mediaDevices.enumerateDevices)}get timeBetweenDecodingAttempts(){return this._timeBetweenDecodingAttempts}set timeBetweenDecodingAttempts(e){this._timeBetweenDecodingAttempts=e<0?0:e}set hints(e){this._hints=e||null}get hints(){return this._hints}listVideoInputDevices(){return ee(this,void 0,void 0,function*(){if(!this.hasNavigator)throw Error("Can't enumerate devices, navigator is not present.");if(!this.canEnumerateDevices)throw Error("Can't enumerate devices, method not supported.");let e=yield navigator.mediaDevices.enumerateDevices(),t=[];for(let r of e){let e="video"===r.kind?"videoinput":r.kind;if("videoinput"!==e)continue;let n=r.deviceId||r.id,i={deviceId:n,label:r.label||`Video device ${t.length+1}`,kind:e,groupId:r.groupId};t.push(i)}return t})}getVideoInputDevices(){return ee(this,void 0,void 0,function*(){return(yield this.listVideoInputDevices()).map(e=>new J(e.deviceId,e.label))})}findDeviceById(e){return ee(this,void 0,void 0,function*(){let t=yield this.listVideoInputDevices();return t?t.find(t=>t.deviceId===e):null})}decodeFromInputVideoDevice(e,t){return ee(this,void 0,void 0,function*(){return yield this.decodeOnceFromVideoDevice(e,t)})}decodeOnceFromVideoDevice(e,t){return ee(this,void 0,void 0,function*(){return this.reset(),yield this.decodeOnceFromConstraints({video:e?{deviceId:{exact:e}}:{facingMode:"environment"}},t)})}decodeOnceFromConstraints(e,t){return ee(this,void 0,void 0,function*(){let r=yield navigator.mediaDevices.getUserMedia(e);return yield this.decodeOnceFromStream(r,t)})}decodeOnceFromStream(e,t){return ee(this,void 0,void 0,function*(){this.reset();let r=yield this.attachStreamToVideo(e,t);return yield this.decodeOnce(r)})}decodeFromInputVideoDeviceContinuously(e,t,r){return ee(this,void 0,void 0,function*(){return yield this.decodeFromVideoDevice(e,t,r)})}decodeFromVideoDevice(e,t,r){return ee(this,void 0,void 0,function*(){return yield this.decodeFromConstraints({video:e?{deviceId:{exact:e}}:{facingMode:"environment"}},t,r)})}decodeFromConstraints(e,t,r){return ee(this,void 0,void 0,function*(){let n=yield navigator.mediaDevices.getUserMedia(e);return yield this.decodeFromStream(n,t,r)})}decodeFromStream(e,t,r){return ee(this,void 0,void 0,function*(){this.reset();let n=yield this.attachStreamToVideo(e,t);return yield this.decodeContinuously(n,r)})}stopAsyncDecode(){this._stopAsyncDecode=!0}stopContinuousDecode(){this._stopContinuousDecode=!0}attachStreamToVideo(e,t){return ee(this,void 0,void 0,function*(){let r=this.prepareVideoElement(t);return this.addVideoSource(r,e),this.videoElement=r,this.stream=e,yield this.playVideoOnLoadAsync(r),r})}playVideoOnLoadAsync(e){return new Promise((t,r)=>this.playVideoOnLoad(e,()=>t()))}playVideoOnLoad(e,t){this.videoEndedListener=()=>this.stopStreams(),this.videoCanPlayListener=()=>this.tryPlayVideo(e),e.addEventListener("ended",this.videoEndedListener),e.addEventListener("canplay",this.videoCanPlayListener),e.addEventListener("playing",t),this.tryPlayVideo(e)}isVideoPlaying(e){return e.currentTime>0&&!e.paused&&!e.ended&&e.readyState>2}tryPlayVideo(e){return ee(this,void 0,void 0,function*(){if(this.isVideoPlaying(e))return void console.warn("Trying to play video that is already playing.");try{yield e.play()}catch(e){console.warn("It was not possible to play the video.")}})}getMediaElement(e,t){let r=document.getElementById(e);if(!r)throw new M(`element with id '${e}' not found`);if(r.nodeName.toLowerCase()!==t.toLowerCase())throw new M(`element with id '${e}' must be an ${t} element`);return r}decodeFromImage(e,t){if(!e&&!t)throw new M("either imageElement with a src set or an url must be provided");return t&&!e?this.decodeFromImageUrl(t):this.decodeFromImageElement(e)}decodeFromVideo(e,t){if(!e&&!t)throw new M("Either an element with a src set or an URL must be provided");return t&&!e?this.decodeFromVideoUrl(t):this.decodeFromVideoElement(e)}decodeFromVideoContinuously(e,t,r){if(void 0===e&&void 0===t)throw new M("Either an element with a src set or an URL must be provided");return t&&!e?this.decodeFromVideoUrlContinuously(t,r):this.decodeFromVideoElementContinuously(e,r)}decodeFromImageElement(e){let t;if(!e)throw new M("An image element must be provided.");this.reset();let r=this.prepareImageElement(e);return this.imageElement=r,this.isImageLoaded(r)?this.decodeOnce(r,!1,!0):this._decodeOnLoadImage(r)}decodeFromVideoElement(e){let t=this._decodeFromVideoElementSetup(e);return this._decodeOnLoadVideo(t)}decodeFromVideoElementContinuously(e,t){let r=this._decodeFromVideoElementSetup(e);return this._decodeOnLoadVideoContinuously(r,t)}_decodeFromVideoElementSetup(e){if(!e)throw new M("A video element must be provided.");this.reset();let t=this.prepareVideoElement(e);return this.videoElement=t,t}decodeFromImageUrl(e){if(!e)throw new M("An URL must be provided.");this.reset();let t=this.prepareImageElement();this.imageElement=t;let r=this._decodeOnLoadImage(t);return t.src=e,r}decodeFromVideoUrl(e){if(!e)throw new M("An URL must be provided.");this.reset();let t=this.prepareVideoElement(),r=this.decodeFromVideoElement(t);return t.src=e,r}decodeFromVideoUrlContinuously(e,t){if(!e)throw new M("An URL must be provided.");this.reset();let r=this.prepareVideoElement(),n=this.decodeFromVideoElementContinuously(r,t);return r.src=e,n}_decodeOnLoadImage(e){return new Promise((t,r)=>{this.imageLoadedListener=()=>this.decodeOnce(e,!1,!0).then(t,r),e.addEventListener("load",this.imageLoadedListener)})}_decodeOnLoadVideo(e){return ee(this,void 0,void 0,function*(){return yield this.playVideoOnLoadAsync(e),yield this.decodeOnce(e)})}_decodeOnLoadVideoContinuously(e,t){return ee(this,void 0,void 0,function*(){yield this.playVideoOnLoadAsync(e),this.decodeContinuously(e,t)})}isImageLoaded(e){return!!e.complete&&0!==e.naturalWidth}prepareImageElement(e){let t;return void 0===e&&((t=document.createElement("img")).width=200,t.height=200),"string"==typeof e&&(t=this.getMediaElement(e,"img")),e instanceof HTMLImageElement&&(t=e),t}prepareVideoElement(e){let t;return e||"undefined"==typeof document||((t=document.createElement("video")).width=200,t.height=200),"string"==typeof e&&(t=this.getMediaElement(e,"video")),e instanceof HTMLVideoElement&&(t=e),t.setAttribute("autoplay","true"),t.setAttribute("muted","true"),t.setAttribute("playsinline","true"),t}decodeOnce(e,t=!0,r=!0){this._stopAsyncDecode=!1;let n=(i,o)=>{if(this._stopAsyncDecode){o(new X("Video stream has ended before any code could be detected.")),this._stopAsyncDecode=void 0;return}try{let t=this.decode(e);i(t)}catch(s){let e=t&&s instanceof X,a=s instanceof R||s instanceof H;if(e||a&&r)return setTimeout(n,this._timeBetweenDecodingAttempts,i,o);o(s)}};return new Promise((e,t)=>n(e,t))}decodeContinuously(e,t){this._stopContinuousDecode=!1;let r=()=>{if(this._stopContinuousDecode){this._stopContinuousDecode=void 0;return}try{let n=this.decode(e);t(n,null),setTimeout(r,this.timeBetweenScansMillis)}catch(i){t(null,i);let e=i instanceof R||i instanceof H,n=i instanceof X;(e||n)&&setTimeout(r,this._timeBetweenDecodingAttempts)}};r()}decode(e){let t=this.createBinaryBitmap(e);return this.decodeBitmap(t)}_isHTMLVideoElement(e){return 0!==e.videoWidth}drawFrameOnCanvas(e,t,r){t||(t={sx:0,sy:0,sWidth:e.videoWidth,sHeight:e.videoHeight,dx:0,dy:0,dWidth:e.videoWidth,dHeight:e.videoHeight}),r||(r=this.captureCanvasContext),r.drawImage(e,t.sx,t.sy,t.sWidth,t.sHeight,t.dx,t.dy,t.dWidth,t.dHeight)}drawImageOnCanvas(e,t,r=this.captureCanvasContext){t||(t={sx:0,sy:0,sWidth:e.naturalWidth,sHeight:e.naturalHeight,dx:0,dy:0,dWidth:e.naturalWidth,dHeight:e.naturalHeight}),r||(r=this.captureCanvasContext),r.drawImage(e,t.sx,t.sy,t.sWidth,t.sHeight,t.dx,t.dy,t.dWidth,t.dHeight)}createBinaryBitmap(e){return this.getCaptureCanvasContext(e),this._isHTMLVideoElement(e)?this.drawFrameOnCanvas(e):this.drawImageOnCanvas(e),new O(new Q(new $(this.getCaptureCanvas(e))))}getCaptureCanvasContext(e){if(!this.captureCanvasContext){let t=this.getCaptureCanvas(e).getContext("2d");this.captureCanvasContext=t}return this.captureCanvasContext}getCaptureCanvas(e){if(!this.captureCanvas){let t=this.createCaptureCanvas(e);this.captureCanvas=t}return this.captureCanvas}decodeBitmap(e){return this.reader.decode(e,this._hints)}createCaptureCanvas(e){let t,r;if("undefined"==typeof document)return this._destroyCaptureCanvas(),null;let n=document.createElement("canvas");return void 0!==e&&(e instanceof HTMLVideoElement?(t=e.videoWidth,r=e.videoHeight):e instanceof HTMLImageElement&&(t=e.naturalWidth||e.width,r=e.naturalHeight||e.height)),n.style.width=t+"px",n.style.height=r+"px",n.width=t,n.height=r,n}stopStreams(){this.stream&&(this.stream.getVideoTracks().forEach(e=>e.stop()),this.stream=void 0),!1===this._stopAsyncDecode&&this.stopAsyncDecode(),!1===this._stopContinuousDecode&&this.stopContinuousDecode()}reset(){this.stopStreams(),this._destroyVideoElement(),this._destroyImageElement(),this._destroyCaptureCanvas()}_destroyVideoElement(){this.videoElement&&(void 0!==this.videoEndedListener&&this.videoElement.removeEventListener("ended",this.videoEndedListener),void 0!==this.videoPlayingEventListener&&this.videoElement.removeEventListener("playing",this.videoPlayingEventListener),void 0!==this.videoCanPlayListener&&this.videoElement.removeEventListener("loadedmetadata",this.videoCanPlayListener),this.cleanVideoSource(this.videoElement),this.videoElement=void 0)}_destroyImageElement(){this.imageElement&&(void 0!==this.imageLoadedListener&&this.imageElement.removeEventListener("load",this.imageLoadedListener),this.imageElement.src=void 0,this.imageElement.removeAttribute("src"),this.imageElement=void 0)}_destroyCaptureCanvas(){this.captureCanvasContext=void 0,this.captureCanvas=void 0}addVideoSource(e,t){try{e.srcObject=t}catch(r){e.src=URL.createObjectURL(t)}}cleanVideoSource(e){try{e.srcObject=null}catch(t){e.src=""}this.videoElement.removeAttribute("src")}}class er{constructor(e,t,r=null==t?0:8*t.length,n,i,o=P.currentTimeMillis()){this.text=e,this.rawBytes=t,this.numBits=r,this.resultPoints=n,this.format=i,this.timestamp=o,this.text=e,this.rawBytes=t,null==r?this.numBits=null==t?0:8*t.length:this.numBits=r,this.resultPoints=n,this.format=i,this.resultMetadata=null,null==o?this.timestamp=P.currentTimeMillis():this.timestamp=o}getText(){return this.text}getRawBytes(){return this.rawBytes}getNumBits(){return this.numBits}getResultPoints(){return this.resultPoints}getBarcodeFormat(){return this.format}getResultMetadata(){return this.resultMetadata}putMetadata(e,t){null===this.resultMetadata&&(this.resultMetadata=new Map),this.resultMetadata.set(e,t)}putAllMetadata(e){null!==e&&(null===this.resultMetadata?this.resultMetadata=e:this.resultMetadata=new Map(e))}addResultPoints(e){let t=this.resultPoints;if(null===t)this.resultPoints=e;else if(null!==e&&e.length>0){let r=Array(t.length+e.length);P.arraycopy(t,0,r,0,t.length),P.arraycopy(e,0,r,t.length,e.length),this.resultPoints=r}}getTimestamp(){return this.timestamp}toString(){return this.text}}(o=m||(m={}))[o.AZTEC=0]="AZTEC",o[o.CODABAR=1]="CODABAR",o[o.CODE_39=2]="CODE_39",o[o.CODE_93=3]="CODE_93",o[o.CODE_128=4]="CODE_128",o[o.DATA_MATRIX=5]="DATA_MATRIX",o[o.EAN_8=6]="EAN_8",o[o.EAN_13=7]="EAN_13",o[o.ITF=8]="ITF",o[o.MAXICODE=9]="MAXICODE",o[o.PDF_417=10]="PDF_417",o[o.QR_CODE=11]="QR_CODE",o[o.RSS_14=12]="RSS_14",o[o.RSS_EXPANDED=13]="RSS_EXPANDED",o[o.UPC_A=14]="UPC_A",o[o.UPC_E=15]="UPC_E",o[o.UPC_EAN_EXTENSION=16]="UPC_EAN_EXTENSION";var en=m;(a=w||(w={}))[a.OTHER=0]="OTHER",a[a.ORIENTATION=1]="ORIENTATION",a[a.BYTE_SEGMENTS=2]="BYTE_SEGMENTS",a[a.ERROR_CORRECTION_LEVEL=3]="ERROR_CORRECTION_LEVEL",a[a.ISSUE_NUMBER=4]="ISSUE_NUMBER",a[a.SUGGESTED_PRICE=5]="SUGGESTED_PRICE",a[a.POSSIBLE_COUNTRY=6]="POSSIBLE_COUNTRY",a[a.UPC_EAN_EXTENSION=7]="UPC_EAN_EXTENSION",a[a.PDF417_EXTRA_METADATA=8]="PDF417_EXTRA_METADATA",a[a.STRUCTURED_APPEND_SEQUENCE=9]="STRUCTURED_APPEND_SEQUENCE",a[a.STRUCTURED_APPEND_PARITY=10]="STRUCTURED_APPEND_PARITY";var ei=w;class eo{constructor(e,t,r,n,i=-1,o=-1){this.rawBytes=e,this.text=t,this.byteSegments=r,this.ecLevel=n,this.structuredAppendSequenceNumber=i,this.structuredAppendParity=o,this.numBits=null==e?0:8*e.length}getRawBytes(){return this.rawBytes}getNumBits(){return this.numBits}setNumBits(e){this.numBits=e}getText(){return this.text}getByteSegments(){return this.byteSegments}getECLevel(){return this.ecLevel}getErrorsCorrected(){return this.errorsCorrected}setErrorsCorrected(e){this.errorsCorrected=e}getErasures(){return this.erasures}setErasures(e){this.erasures=e}getOther(){return this.other}setOther(e){this.other=e}hasStructuredAppend(){return this.structuredAppendParity>=0&&this.structuredAppendSequenceNumber>=0}getStructuredAppendParity(){return this.structuredAppendParity}getStructuredAppendSequenceNumber(){return this.structuredAppendSequenceNumber}}class ea{exp(e){return this.expTable[e]}log(e){if(0===e)throw new D;return this.logTable[e]}static addOrSubtract(e,t){return e^t}}class es{constructor(e,t){if(0===t.length)throw new D;this.field=e;let r=t.length;if(r>1&&0===t[0]){let e=1;for(;e<r&&0===t[e];)e++;e===r?this.coefficients=Int32Array.from([0]):(this.coefficients=new Int32Array(r-e),P.arraycopy(t,e,this.coefficients,0,this.coefficients.length))}else this.coefficients=t}getCoefficients(){return this.coefficients}getDegree(){return this.coefficients.length-1}isZero(){return 0===this.coefficients[0]}getCoefficient(e){return this.coefficients[this.coefficients.length-1-e]}evaluateAt(e){let t;if(0===e)return this.getCoefficient(0);let r=this.coefficients;if(1===e){t=0;for(let e=0,n=r.length;e!==n;e++){let n=r[e];t=ea.addOrSubtract(t,n)}return t}t=r[0];let n=r.length,i=this.field;for(let o=1;o<n;o++)t=ea.addOrSubtract(i.multiply(e,t),r[o]);return t}addOrSubtract(e){if(!this.field.equals(e.field))throw new D("GenericGFPolys do not have same GenericGF field");if(this.isZero())return e;if(e.isZero())return this;let t=this.coefficients,r=e.coefficients;if(t.length>r.length){let e=t;t=r,r=e}let n=new Int32Array(r.length),i=r.length-t.length;P.arraycopy(r,0,n,0,i);for(let e=i;e<r.length;e++)n[e]=ea.addOrSubtract(t[e-i],r[e]);return new es(this.field,n)}multiply(e){if(!this.field.equals(e.field))throw new D("GenericGFPolys do not have same GenericGF field");if(this.isZero()||e.isZero())return this.field.getZero();let t=this.coefficients,r=t.length,n=e.coefficients,i=n.length,o=new Int32Array(r+i-1),a=this.field;for(let e=0;e<r;e++){let r=t[e];for(let t=0;t<i;t++)o[e+t]=ea.addOrSubtract(o[e+t],a.multiply(r,n[t]))}return new es(a,o)}multiplyScalar(e){if(0===e)return this.field.getZero();if(1===e)return this;let t=this.coefficients.length,r=this.field,n=new Int32Array(t),i=this.coefficients;for(let o=0;o<t;o++)n[o]=r.multiply(i[o],e);return new es(r,n)}multiplyByMonomial(e,t){if(e<0)throw new D;if(0===t)return this.field.getZero();let r=this.coefficients,n=r.length,i=new Int32Array(n+e),o=this.field;for(let e=0;e<n;e++)i[e]=o.multiply(r[e],t);return new es(o,i)}divide(e){if(!this.field.equals(e.field))throw new D("GenericGFPolys do not have same GenericGF field");if(e.isZero())throw new D("Divide by 0");let t=this.field,r=t.getZero(),n=this,i=e.getCoefficient(e.getDegree()),o=t.inverse(i);for(;n.getDegree()>=e.getDegree()&&!n.isZero();){let i=n.getDegree()-e.getDegree(),a=t.multiply(n.getCoefficient(n.getDegree()),o),s=e.multiplyByMonomial(i,a),l=t.buildMonomial(i,a);r=r.addOrSubtract(l),n=n.addOrSubtract(s)}return[r,n]}toString(){let e="";for(let t=this.getDegree();t>=0;t--){let r=this.getCoefficient(t);if(0!==r){if(r<0?(e+=" - ",r=-r):e.length>0&&(e+=" + "),0===t||1!==r){let t=this.field.log(r);0===t?e+="1":1===t?e+="a":(e+="a^",e+=t)}0!==t&&(1===t?e+="x":(e+="x^",e+=t))}}return e}}class el extends N{}el.kind="ArithmeticException";class ec extends ea{constructor(e,t,r){super(),this.primitive=e,this.size=t,this.generatorBase=r;let n=new Int32Array(t),i=1;for(let r=0;r<t;r++)n[r]=i,(i*=2)>=t&&(i^=e,i&=t-1);this.expTable=n;let o=new Int32Array(t);for(let e=0;e<t-1;e++)o[n[e]]=e;this.logTable=o,this.zero=new es(this,Int32Array.from([0])),this.one=new es(this,Int32Array.from([1]))}getZero(){return this.zero}getOne(){return this.one}buildMonomial(e,t){if(e<0)throw new D;if(0===t)return this.zero;let r=new Int32Array(e+1);return r[0]=t,new es(this,r)}inverse(e){if(0===e)throw new el;return this.expTable[this.size-this.logTable[e]-1]}multiply(e,t){return 0===e||0===t?0:this.expTable[(this.logTable[e]+this.logTable[t])%(this.size-1)]}getSize(){return this.size}getGeneratorBase(){return this.generatorBase}toString(){return"GF(0x"+k.toHexString(this.primitive)+","+this.size+")"}equals(e){return e===this}}ec.AZTEC_DATA_12=new ec(4201,4096,1),ec.AZTEC_DATA_10=new ec(1033,1024,1),ec.AZTEC_DATA_6=new ec(67,64,1),ec.AZTEC_PARAM=new ec(19,16,1),ec.QR_CODE_FIELD_256=new ec(285,256,0),ec.DATA_MATRIX_FIELD_256=new ec(301,256,1),ec.AZTEC_DATA_8=ec.DATA_MATRIX_FIELD_256,ec.MAXICODE_FIELD_64=ec.AZTEC_DATA_6;class eu extends N{}eu.kind="ReedSolomonException";class eh extends N{}eh.kind="IllegalStateException";class ed{constructor(e){this.field=e}decode(e,t){let r=this.field,n=new es(r,e),i=new Int32Array(t),o=!0;for(let e=0;e<t;e++){let t=n.evaluateAt(r.exp(e+r.getGeneratorBase()));i[i.length-1-e]=t,0!==t&&(o=!1)}if(o)return;let a=new es(r,i),s=this.runEuclideanAlgorithm(r.buildMonomial(t,1),a,t),l=s[0],c=s[1],u=this.findErrorLocations(l),h=this.findErrorMagnitudes(c,u);for(let t=0;t<u.length;t++){let n=e.length-1-r.log(u[t]);if(n<0)throw new eu("Bad error location");e[n]=ec.addOrSubtract(e[n],h[t])}}runEuclideanAlgorithm(e,t,r){if(e.getDegree()<t.getDegree()){let r=e;e=t,t=r}let n=this.field,i=e,o=t,a=n.getZero(),s=n.getOne();for(;o.getDegree()>=(r/2|0);){let e=i,t=a;if(i=o,a=s,i.isZero())throw new eu("r_{i-1} was zero");o=e;let r=n.getZero(),l=i.getCoefficient(i.getDegree()),c=n.inverse(l);for(;o.getDegree()>=i.getDegree()&&!o.isZero();){let e=o.getDegree()-i.getDegree(),t=n.multiply(o.getCoefficient(o.getDegree()),c);r=r.addOrSubtract(n.buildMonomial(e,t)),o=o.addOrSubtract(i.multiplyByMonomial(e,t))}if(s=r.multiply(a).addOrSubtract(t),o.getDegree()>=i.getDegree())throw new eh("Division algorithm failed to reduce polynomial?")}let l=s.getCoefficient(0);if(0===l)throw new eu("sigmaTilde(0) was zero");let c=n.inverse(l);return[s.multiplyScalar(c),o.multiplyScalar(c)]}findErrorLocations(e){let t=e.getDegree();if(1===t)return Int32Array.from([e.getCoefficient(1)]);let r=new Int32Array(t),n=0,i=this.field;for(let o=1;o<i.getSize()&&n<t;o++)0===e.evaluateAt(o)&&(r[n]=i.inverse(o),n++);if(n!==t)throw new eu("Error locator degree does not match number of roots");return r}findErrorMagnitudes(e,t){let r=t.length,n=new Int32Array(r),i=this.field;for(let o=0;o<r;o++){let a=i.inverse(t[o]),s=1;for(let e=0;e<r;e++)if(o!==e){let r=i.multiply(t[e],a),n=(1&r)==0?1|r:-2&r;s=i.multiply(s,n)}n[o]=i.multiply(e.evaluateAt(a),i.inverse(s)),0!==i.getGeneratorBase()&&(n[o]=i.multiply(n[o],a))}return n}}(s=C||(C={}))[s.UPPER=0]="UPPER",s[s.LOWER=1]="LOWER",s[s.MIXED=2]="MIXED",s[s.DIGIT=3]="DIGIT",s[s.PUNCT=4]="PUNCT",s[s.BINARY=5]="BINARY";class ef{decode(e){this.ddata=e;let t=e.getBits(),r=this.extractBits(t),n=this.correctBits(r),i=new eo(ef.convertBoolArrayToByteArray(n),ef.getEncodedData(n),null,null);return i.setNumBits(n.length),i}static highLevelDecode(e){return this.getEncodedData(e)}static getEncodedData(e){let t=e.length,r=C.UPPER,n=C.UPPER,i="",o=0;for(;o<t;)if(n===C.BINARY){if(t-o<5)break;let a=ef.readCode(e,o,5);if(o+=5,0===a){if(t-o<11)break;a=ef.readCode(e,o,11)+31,o+=11}for(let r=0;r<a;r++){if(t-o<8){o=t;break}let r=ef.readCode(e,o,8);i+=G.castAsNonUtf8Char(r),o+=8}n=r}else{let a=n===C.DIGIT?4:5;if(t-o<a)break;let s=ef.readCode(e,o,a);o+=a;let l=ef.getCharacter(n,s);l.startsWith("CTRL_")?(r=n,n=ef.getTable(l.charAt(5)),"L"===l.charAt(6)&&(r=n)):(i+=l,n=r)}return i}static getTable(e){switch(e){case"L":return C.LOWER;case"P":return C.PUNCT;case"M":return C.MIXED;case"D":return C.DIGIT;case"B":return C.BINARY;default:return C.UPPER}}static getCharacter(e,t){switch(e){case C.UPPER:return ef.UPPER_TABLE[t];case C.LOWER:return ef.LOWER_TABLE[t];case C.MIXED:return ef.MIXED_TABLE[t];case C.PUNCT:return ef.PUNCT_TABLE[t];case C.DIGIT:return ef.DIGIT_TABLE[t];default:throw new eh("Bad table")}}correctBits(e){let t,r;2>=this.ddata.getNbLayers()?(r=6,t=ec.AZTEC_DATA_6):8>=this.ddata.getNbLayers()?(r=8,t=ec.AZTEC_DATA_8):22>=this.ddata.getNbLayers()?(r=10,t=ec.AZTEC_DATA_10):(r=12,t=ec.AZTEC_DATA_12);let n=this.ddata.getNbDatablocks(),i=e.length/r;if(i<n)throw new H;let o=e.length%r,a=new Int32Array(i);for(let t=0;t<i;t++,o+=r)a[t]=ef.readCode(e,o,r);try{new ed(t).decode(a,i-n)}catch(e){throw new H(e)}let s=(1<<r)-1,l=0;for(let e=0;e<n;e++){let t=a[e];if(0===t||t===s)throw new H;(1===t||t===s-1)&&l++}let c=Array(n*r-l),u=0;for(let e=0;e<n;e++){let t=a[e];if(1===t||t===s-1)c.fill(t>1,u,u+r-1),u+=r-1;else for(let e=r-1;e>=0;--e)c[u++]=(t&1<<e)!=0}return c}extractBits(e){let t=this.ddata.isCompact(),r=this.ddata.getNbLayers(),n=(t?11:14)+4*r,i=new Int32Array(n),o=Array(this.totalBitsInLayer(r,t));if(t)for(let e=0;e<i.length;e++)i[e]=e;else{let e=n+1+2*k.truncDivision(k.truncDivision(n,2)-1,15),t=n/2,r=k.truncDivision(e,2);for(let e=0;e<t;e++){let n=e+k.truncDivision(e,15);i[t-e-1]=r-n-1,i[t+e]=r+n+1}}for(let a=0,s=0;a<r;a++){let l=(r-a)*4+(t?9:12),c=2*a,u=n-1-c;for(let t=0;t<l;t++){let r=2*t;for(let n=0;n<2;n++)o[s+r+n]=e.get(i[c+n],i[c+t]),o[s+2*l+r+n]=e.get(i[c+t],i[u-n]),o[s+4*l+r+n]=e.get(i[u-n],i[u-t]),o[s+6*l+r+n]=e.get(i[u-t],i[c+n])}s+=8*l}return o}static readCode(e,t,r){let n=0;for(let i=t;i<t+r;i++)n<<=1,e[i]&&(n|=1);return n}static readByte(e,t){let r=e.length-t;return r>=8?ef.readCode(e,t,8):ef.readCode(e,t,r)<<8-r}static convertBoolArrayToByteArray(e){let t=new Uint8Array((e.length+7)/8);for(let r=0;r<t.length;r++)t[r]=ef.readByte(e,8*r);return t}totalBitsInLayer(e,t){return((t?88:112)+16*e)*e}}ef.UPPER_TABLE=["CTRL_PS"," ","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","CTRL_LL","CTRL_ML","CTRL_DL","CTRL_BS"],ef.LOWER_TABLE=["CTRL_PS"," ","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","CTRL_US","CTRL_ML","CTRL_DL","CTRL_BS"],ef.MIXED_TABLE=["CTRL_PS"," ","\\1","\\2","\\3","\\4","\\5","\\6","\\7","\b"," ","\n","\\13","\f","\r","\\33","\\34","\\35","\\36","\\37","@","\\","^","_","`","|","~","\\177","CTRL_LL","CTRL_UL","CTRL_PL","CTRL_BS"],ef.PUNCT_TABLE=["","\r","\r\n",". ",", ",": ","!",'"',"#","$","%","&","'","(",")","*","+",",","-",".","/",":",";","<","=",">","?","[","]","{","}","CTRL_UL"],ef.DIGIT_TABLE=["CTRL_PS"," ","0","1","2","3","4","5","6","7","8","9",",",".","CTRL_UL","CTRL_US"];class eg{constructor(){}static round(e){return e<=Number.MIN_SAFE_INTEGER?Number.MIN_SAFE_INTEGER:e>=Number.MAX_SAFE_INTEGER?Number.MAX_SAFE_INTEGER:e+(e<0?-.5:.5)|0}static distance(e,t,r,n){let i=e-r,o=t-n;return Math.sqrt(i*i+o*o)}static sum(e){let t=0;for(let r=0,n=e.length;r!==n;r++)t+=e[r];return t}}class ep{static floatToIntBits(e){return e}}ep.MAX_VALUE=Number.MAX_SAFE_INTEGER;class em{constructor(e,t){this.x=e,this.y=t}getX(){return this.x}getY(){return this.y}equals(e){return e instanceof em&&this.x===e.x&&this.y===e.y}hashCode(){return 31*ep.floatToIntBits(this.x)+ep.floatToIntBits(this.y)}toString(){return"("+this.x+","+this.y+")"}static orderBestPatterns(e){let t,r,n,i=this.distance(e[0],e[1]),o=this.distance(e[1],e[2]),a=this.distance(e[0],e[2]);if(o>=i&&o>=a?(r=e[0],t=e[1],n=e[2]):a>=o&&a>=i?(r=e[1],t=e[0],n=e[2]):(r=e[2],t=e[0],n=e[1]),0>this.crossProductZ(t,r,n)){let e=t;t=n,n=e}e[0]=t,e[1]=r,e[2]=n}static distance(e,t){return eg.distance(e.x,e.y,t.x,t.y)}static crossProductZ(e,t,r){let n=t.x,i=t.y;return(r.x-n)*(e.y-i)-(r.y-i)*(e.x-n)}}class ew{constructor(e,t){this.bits=e,this.points=t}getBits(){return this.bits}getPoints(){return this.points}}class eC extends ew{constructor(e,t,r,n,i){super(e,t),this.compact=r,this.nbDatablocks=n,this.nbLayers=i}getNbLayers(){return this.nbLayers}getNbDatablocks(){return this.nbDatablocks}isCompact(){return this.compact}}class eE{constructor(e,t,r,n){this.image=e,this.height=e.getHeight(),this.width=e.getWidth(),null==t&&(t=eE.INIT_SIZE),null==r&&(r=e.getWidth()/2|0),null==n&&(n=e.getHeight()/2|0);let i=t/2|0;if(this.leftInit=r-i,this.rightInit=r+i,this.upInit=n-i,this.downInit=n+i,this.upInit<0||this.leftInit<0||this.downInit>=this.height||this.rightInit>=this.width)throw new X}detect(){let e=this.leftInit,t=this.rightInit,r=this.upInit,n=this.downInit,i=!1,o=!0,a=!1,s=!1,l=!1,c=!1,u=!1,h=this.width,d=this.height;for(;o;){o=!1;let f=!0;for(;(f||!s)&&t<h;)(f=this.containsBlackPoint(r,n,t,!1))?(t++,o=!0,s=!0):!s&&t++;if(t>=h){i=!0;break}let g=!0;for(;(g||!l)&&n<d;)(g=this.containsBlackPoint(e,t,n,!0))?(n++,o=!0,l=!0):!l&&n++;if(n>=d){i=!0;break}let p=!0;for(;(p||!c)&&e>=0;)(p=this.containsBlackPoint(r,n,e,!1))?(e--,o=!0,c=!0):!c&&e--;if(e<0){i=!0;break}let m=!0;for(;(m||!u)&&r>=0;)(m=this.containsBlackPoint(e,t,r,!0))?(r--,o=!0,u=!0):!u&&r--;if(r<0){i=!0;break}o&&(a=!0)}if(!i&&a){let i=t-e,o=null;for(let t=1;null===o&&t<i;t++)o=this.getBlackPointOnSegment(e,n-t,e+t,n);if(null==o)throw new X;let a=null;for(let t=1;null===a&&t<i;t++)a=this.getBlackPointOnSegment(e,r+t,e+t,r);if(null==a)throw new X;let s=null;for(let e=1;null===s&&e<i;e++)s=this.getBlackPointOnSegment(t,r+e,t-e,r);if(null==s)throw new X;let l=null;for(let e=1;null===l&&e<i;e++)l=this.getBlackPointOnSegment(t,n-e,t-e,n);if(null==l)throw new X;return this.centerEdges(l,o,s,a)}throw new X}getBlackPointOnSegment(e,t,r,n){let i=eg.round(eg.distance(e,t,r,n)),o=(r-e)/i,a=(n-t)/i,s=this.image;for(let r=0;r<i;r++){let n=eg.round(e+r*o),i=eg.round(t+r*a);if(s.get(n,i))return new em(n,i)}return null}centerEdges(e,t,r,n){let i=e.getX(),o=e.getY(),a=t.getX(),s=t.getY(),l=r.getX(),c=r.getY(),u=n.getX(),h=n.getY(),d=eE.CORR;return i<this.width/2?[new em(u-d,h+d),new em(a+d,s+d),new em(l-d,c-d),new em(i+d,o-d)]:[new em(u+d,h+d),new em(a+d,s-d),new em(l-d,c+d),new em(i-d,o-d)]}containsBlackPoint(e,t,r,n){let i=this.image;if(n){for(let n=e;n<=t;n++)if(i.get(n,r))return!0}else for(let n=e;n<=t;n++)if(i.get(r,n))return!0;return!1}}eE.INIT_SIZE=10,eE.CORR=1;class eA{static checkAndNudgePoints(e,t){let r=e.getWidth(),n=e.getHeight(),i=!0;for(let e=0;e<t.length&&i;e+=2){let o=Math.floor(t[e]),a=Math.floor(t[e+1]);if(o<-1||o>r||a<-1||a>n)throw new X;i=!1,-1===o?(t[e]=0,i=!0):o===r&&(t[e]=r-1,i=!0),-1===a?(t[e+1]=0,i=!0):a===n&&(t[e+1]=n-1,i=!0)}i=!0;for(let e=t.length-2;e>=0&&i;e-=2){let o=Math.floor(t[e]),a=Math.floor(t[e+1]);if(o<-1||o>r||a<-1||a>n)throw new X;i=!1,-1===o?(t[e]=0,i=!0):o===r&&(t[e]=r-1,i=!0),-1===a?(t[e+1]=0,i=!0):a===n&&(t[e+1]=n-1,i=!0)}}}class ey{constructor(e,t,r,n,i,o,a,s,l){this.a11=e,this.a21=t,this.a31=r,this.a12=n,this.a22=i,this.a32=o,this.a13=a,this.a23=s,this.a33=l}static quadrilateralToQuadrilateral(e,t,r,n,i,o,a,s,l,c,u,h,d,f,g,p){let m=ey.quadrilateralToSquare(e,t,r,n,i,o,a,s);return ey.squareToQuadrilateral(l,c,u,h,d,f,g,p).times(m)}transformPoints(e){let t=e.length,r=this.a11,n=this.a12,i=this.a13,o=this.a21,a=this.a22,s=this.a23,l=this.a31,c=this.a32,u=this.a33;for(let h=0;h<t;h+=2){let t=e[h],d=e[h+1],f=i*t+s*d+u;e[h]=(r*t+o*d+l)/f,e[h+1]=(n*t+a*d+c)/f}}transformPointsWithValues(e,t){let r=this.a11,n=this.a12,i=this.a13,o=this.a21,a=this.a22,s=this.a23,l=this.a31,c=this.a32,u=this.a33,h=e.length;for(let d=0;d<h;d++){let h=e[d],f=t[d],g=i*h+s*f+u;e[d]=(r*h+o*f+l)/g,t[d]=(n*h+a*f+c)/g}}static squareToQuadrilateral(e,t,r,n,i,o,a,s){let l=e-r+i-a,c=t-n+o-s;if(0===l&&0===c)return new ey(r-e,i-r,e,n-t,o-n,t,0,0,1);{let u=r-i,h=a-i,d=n-o,f=s-o,g=u*f-h*d,p=(l*f-h*c)/g,m=(u*c-l*d)/g;return new ey(r-e+p*r,a-e+m*a,e,n-t+p*n,s-t+m*s,t,p,m,1)}}static quadrilateralToSquare(e,t,r,n,i,o,a,s){return ey.squareToQuadrilateral(e,t,r,n,i,o,a,s).buildAdjoint()}buildAdjoint(){return new ey(this.a22*this.a33-this.a23*this.a32,this.a23*this.a31-this.a21*this.a33,this.a21*this.a32-this.a22*this.a31,this.a13*this.a32-this.a12*this.a33,this.a11*this.a33-this.a13*this.a31,this.a12*this.a31-this.a11*this.a32,this.a12*this.a23-this.a13*this.a22,this.a13*this.a21-this.a11*this.a23,this.a11*this.a22-this.a12*this.a21)}times(e){return new ey(this.a11*e.a11+this.a21*e.a12+this.a31*e.a13,this.a11*e.a21+this.a21*e.a22+this.a31*e.a23,this.a11*e.a31+this.a21*e.a32+this.a31*e.a33,this.a12*e.a11+this.a22*e.a12+this.a32*e.a13,this.a12*e.a21+this.a22*e.a22+this.a32*e.a23,this.a12*e.a31+this.a22*e.a32+this.a32*e.a33,this.a13*e.a11+this.a23*e.a12+this.a33*e.a13,this.a13*e.a21+this.a23*e.a22+this.a33*e.a23,this.a13*e.a31+this.a23*e.a32+this.a33*e.a33)}}class eI extends eA{sampleGrid(e,t,r,n,i,o,a,s,l,c,u,h,d,f,g,p,m,w,C){let E=ey.quadrilateralToQuadrilateral(n,i,o,a,s,l,c,u,h,d,f,g,p,m,w,C);return this.sampleGridWithTransform(e,t,r,E)}sampleGridWithTransform(e,t,r,n){if(t<=0||r<=0)throw new X;let i=new Y(t,r),o=new Float32Array(2*t);for(let t=0;t<r;t++){let r=o.length,a=t+.5;for(let e=0;e<r;e+=2)o[e]=e/2+.5,o[e+1]=a;n.transformPoints(o),eA.checkAndNudgePoints(e,o);try{for(let n=0;n<r;n+=2)e.get(Math.floor(o[n]),Math.floor(o[n+1]))&&i.set(n/2,t)}catch(e){throw new X}}return i}}class eS{static setGridSampler(e){eS.gridSampler=e}static getInstance(){return eS.gridSampler}}eS.gridSampler=new eI;class e_{constructor(e,t){this.x=e,this.y=t}toResultPoint(){return new em(this.getX(),this.getY())}getX(){return this.x}getY(){return this.y}}class eb{constructor(e){this.EXPECTED_CORNER_BITS=new Int32Array([3808,476,2107,1799]),this.image=e}detect(){return this.detectMirror(!1)}detectMirror(e){let t=this.getMatrixCenter(),r=this.getBullsEyeCorners(t);if(e){let e=r[0];r[0]=r[2],r[2]=e}return this.extractParameters(r),new eC(this.sampleGrid(this.image,r[this.shift%4],r[(this.shift+1)%4],r[(this.shift+2)%4],r[(this.shift+3)%4]),this.getMatrixCornerPoints(r),this.compact,this.nbDataBlocks,this.nbLayers)}extractParameters(e){if(!this.isValidPoint(e[0])||!this.isValidPoint(e[1])||!this.isValidPoint(e[2])||!this.isValidPoint(e[3]))throw new X;let t=2*this.nbCenterLayers,r=new Int32Array([this.sampleLine(e[0],e[1],t),this.sampleLine(e[1],e[2],t),this.sampleLine(e[2],e[3],t),this.sampleLine(e[3],e[0],t)]);this.shift=this.getRotation(r,t);let n=0;for(let e=0;e<4;e++){let t=r[(this.shift+e)%4];this.compact?(n<<=7,n+=t>>1&127):(n<<=10,n+=(t>>2&992)+(t>>1&31))}let i=this.getCorrectedParameterData(n,this.compact);this.compact?(this.nbLayers=(i>>6)+1,this.nbDataBlocks=(63&i)+1):(this.nbLayers=(i>>11)+1,this.nbDataBlocks=(2047&i)+1)}getRotation(e,t){let r=0;e.forEach((e,n,i)=>{r=(r<<3)+((e>>t-2<<1)+(1&e))}),r=((1&r)<<11)+(r>>1);for(let e=0;e<4;e++)if(2>=k.bitCount(r^this.EXPECTED_CORNER_BITS[e]))return e;throw new X}getCorrectedParameterData(e,t){let r,n;t?(r=7,n=2):(r=10,n=4);let i=r-n,o=new Int32Array(r);for(let t=r-1;t>=0;--t)o[t]=15&e,e>>=4;try{new ed(ec.AZTEC_PARAM).decode(o,i)}catch(e){throw new X}let a=0;for(let e=0;e<n;e++)a=(a<<4)+o[e];return a}getBullsEyeCorners(e){let t=e,r=e,n=e,i=e,o=!0;for(this.nbCenterLayers=1;this.nbCenterLayers<9;this.nbCenterLayers++){let e=this.getFirstDifferent(t,o,1,-1),a=this.getFirstDifferent(r,o,1,1),s=this.getFirstDifferent(n,o,-1,1),l=this.getFirstDifferent(i,o,-1,-1);if(this.nbCenterLayers>2){let r=this.distancePoint(l,e)*this.nbCenterLayers/(this.distancePoint(i,t)*(this.nbCenterLayers+2));if(r<.75||r>1.25||!this.isWhiteOrBlackRectangle(e,a,s,l))break}t=e,r=a,n=s,i=l,o=!o}if(5!==this.nbCenterLayers&&7!==this.nbCenterLayers)throw new X;this.compact=5===this.nbCenterLayers;let a=new em(t.getX()+.5,t.getY()-.5),s=new em(r.getX()+.5,r.getY()+.5),l=new em(n.getX()-.5,n.getY()+.5),c=new em(i.getX()-.5,i.getY()-.5);return this.expandSquare([a,s,l,c],2*this.nbCenterLayers-3,2*this.nbCenterLayers)}getMatrixCenter(){let e,t,r,n;try{let i=new eE(this.image).detect();e=i[0],t=i[1],r=i[2],n=i[3]}catch(a){let i=this.image.getWidth()/2,o=this.image.getHeight()/2;e=this.getFirstDifferent(new e_(i+7,o-7),!1,1,-1).toResultPoint(),t=this.getFirstDifferent(new e_(i+7,o+7),!1,1,1).toResultPoint(),r=this.getFirstDifferent(new e_(i-7,o+7),!1,-1,1).toResultPoint(),n=this.getFirstDifferent(new e_(i-7,o-7),!1,-1,-1).toResultPoint()}let i=eg.round((e.getX()+n.getX()+t.getX()+r.getX())/4),o=eg.round((e.getY()+n.getY()+t.getY()+r.getY())/4);try{let a=new eE(this.image,15,i,o).detect();e=a[0],t=a[1],r=a[2],n=a[3]}catch(a){e=this.getFirstDifferent(new e_(i+7,o-7),!1,1,-1).toResultPoint(),t=this.getFirstDifferent(new e_(i+7,o+7),!1,1,1).toResultPoint(),r=this.getFirstDifferent(new e_(i-7,o+7),!1,-1,1).toResultPoint(),n=this.getFirstDifferent(new e_(i-7,o-7),!1,-1,-1).toResultPoint()}return new e_(i=eg.round((e.getX()+n.getX()+t.getX()+r.getX())/4),o=eg.round((e.getY()+n.getY()+t.getY()+r.getY())/4))}getMatrixCornerPoints(e){return this.expandSquare(e,2*this.nbCenterLayers,this.getDimension())}sampleGrid(e,t,r,n,i){let o=eS.getInstance(),a=this.getDimension(),s=a/2-this.nbCenterLayers,l=a/2+this.nbCenterLayers;return o.sampleGrid(e,a,a,s,s,l,s,l,l,s,l,t.getX(),t.getY(),r.getX(),r.getY(),n.getX(),n.getY(),i.getX(),i.getY())}sampleLine(e,t,r){let n=0,i=this.distanceResultPoint(e,t),o=i/r,a=e.getX(),s=e.getY(),l=o*(t.getX()-e.getX())/i,c=o*(t.getY()-e.getY())/i;for(let e=0;e<r;e++)this.image.get(eg.round(a+e*l),eg.round(s+e*c))&&(n|=1<<r-e-1);return n}isWhiteOrBlackRectangle(e,t,r,n){e=new e_(e.getX()-3,e.getY()+3),t=new e_(t.getX()-3,t.getY()-3),r=new e_(r.getX()+3,r.getY()-3),n=new e_(n.getX()+3,n.getY()+3);let i=this.getColor(n,e);if(0===i)return!1;let o=this.getColor(e,t);return o===i&&(o=this.getColor(t,r))===i&&(o=this.getColor(r,n))===i}getColor(e,t){let r=this.distancePoint(e,t),n=(t.getX()-e.getX())/r,i=(t.getY()-e.getY())/r,o=0,a=e.getX(),s=e.getY(),l=this.image.get(e.getX(),e.getY()),c=Math.ceil(r);for(let e=0;e<c;e++)a+=n,s+=i,this.image.get(eg.round(a),eg.round(s))!==l&&o++;let u=o/r;return u>.1&&u<.9?0:u<=.1===l?1:-1}getFirstDifferent(e,t,r,n){let i=e.getX()+r,o=e.getY()+n;for(;this.isValid(i,o)&&this.image.get(i,o)===t;)i+=r,o+=n;for(i-=r,o-=n;this.isValid(i,o)&&this.image.get(i,o)===t;)i+=r;for(i-=r;this.isValid(i,o)&&this.image.get(i,o)===t;)o+=n;return new e_(i,o-=n)}expandSquare(e,t,r){let n=r/(2*t),i=e[0].getX()-e[2].getX(),o=e[0].getY()-e[2].getY(),a=(e[0].getX()+e[2].getX())/2,s=(e[0].getY()+e[2].getY())/2,l=new em(a+n*i,s+n*o),c=new em(a-n*i,s-n*o);return i=e[1].getX()-e[3].getX(),o=e[1].getY()-e[3].getY(),[l,new em((a=(e[1].getX()+e[3].getX())/2)+n*i,(s=(e[1].getY()+e[3].getY())/2)+n*o),c,new em(a-n*i,s-n*o)]}isValid(e,t){return e>=0&&e<this.image.getWidth()&&t>0&&t<this.image.getHeight()}isValidPoint(e){let t=eg.round(e.getX()),r=eg.round(e.getY());return this.isValid(t,r)}distancePoint(e,t){return eg.distance(e.getX(),e.getY(),t.getX(),t.getY())}distanceResultPoint(e,t){return eg.distance(e.getX(),e.getY(),t.getX(),t.getY())}getDimension(){return this.compact?4*this.nbLayers+11:this.nbLayers<=4?4*this.nbLayers+15:4*this.nbLayers+2*(k.truncDivision(this.nbLayers-4,8)+1)+15}}class eT{decode(e,t=null){let r=null,n=new eb(e.getBlackMatrix()),i=null,o=null;try{let e=n.detectMirror(!1);i=e.getPoints(),this.reportFoundResultPoints(t,i),o=new ef().decode(e)}catch(e){r=e}if(null==o)try{let e=n.detectMirror(!0);i=e.getPoints(),this.reportFoundResultPoints(t,i),o=new ef().decode(e)}catch(e){if(null!=r)throw r;throw e}let a=new er(o.getText(),o.getRawBytes(),o.getNumBits(),i,en.AZTEC,P.currentTimeMillis()),s=o.getByteSegments();null!=s&&a.putMetadata(ei.BYTE_SEGMENTS,s);let l=o.getECLevel();return null!=l&&a.putMetadata(ei.ERROR_CORRECTION_LEVEL,l),a}reportFoundResultPoints(e,t){if(null!=e){let r=e.get(U.NEED_RESULT_POINT_CALLBACK);null!=r&&t.forEach((e,t,n)=>{r.foundPossibleResultPoint(e)})}}reset(){}}class eN{decode(e,t){try{return this.doDecode(e,t)}catch(r){if(t&&!0===t.get(U.TRY_HARDER)&&e.isRotateSupported()){let r=e.rotateCounterClockwise(),n=this.doDecode(r,t),i=n.getResultMetadata(),o=270;null!==i&&!0===i.get(ei.ORIENTATION)&&(o+=i.get(ei.ORIENTATION)%360),n.putMetadata(ei.ORIENTATION,o);let a=n.getResultPoints();if(null!==a){let e=r.getHeight();for(let t=0;t<a.length;t++)a[t]=new em(e-a[t].getY()-1,a[t].getX())}return n}throw new X}}reset(){}doDecode(e,t){let r,n=e.getWidth(),i=e.getHeight(),o=new F(n),a=t&&!0===t.get(U.TRY_HARDER),s=Math.max(1,i>>(a?8:5));r=a?i:15;let l=Math.trunc(i/2);for(let a=0;a<r;a++){let r=Math.trunc((a+1)/2),c=l+s*((1&a)==0?r:-r);if(c<0||c>=i)break;try{o=e.getBlackRow(c,o)}catch(e){continue}for(let e=0;e<2;e++){if(1===e&&(o.reverse(),t&&!0===t.get(U.NEED_RESULT_POINT_CALLBACK))){let e=new Map;t.forEach((t,r)=>e.set(r,t)),e.delete(U.NEED_RESULT_POINT_CALLBACK),t=e}try{let r=this.decodeRow(c,o,t);if(1===e){r.putMetadata(ei.ORIENTATION,180);let e=r.getResultPoints();null!==e&&(e[0]=new em(n-e[0].getX()-1,e[0].getY()),e[1]=new em(n-e[1].getX()-1,e[1].getY()))}return r}catch(e){}}}throw new X}static recordPattern(e,t,r){let n=r.length;for(let e=0;e<n;e++)r[e]=0;let i=e.getSize();if(t>=i)throw new X;let o=!e.get(t),a=0,s=t;for(;s<i;){if(e.get(s)!==o)r[a]++;else if(++a===n)break;else r[a]=1,o=!o;s++}if(a!==n&&(a!==n-1||s!==i))throw new X}static recordPatternInReverse(e,t,r){let n=r.length,i=e.get(t);for(;t>0&&n>=0;)e.get(--t)!==i&&(n--,i=!i);if(n>=0)throw new X;eN.recordPattern(e,t+1,r)}static patternMatchVariance(e,t,r){let n=e.length,i=0,o=0;for(let r=0;r<n;r++)i+=e[r],o+=t[r];if(i<o)return Number.POSITIVE_INFINITY;let a=i/o;r*=a;let s=0;for(let i=0;i<n;i++){let n=e[i],o=t[i]*a,l=n>o?n-o:o-n;if(l>r)return Number.POSITIVE_INFINITY;s+=l}return s/i}}class eM extends eN{static findStartPattern(e){let t=e.getSize(),r=e.getNextSet(0),n=0,i=Int32Array.from([0,0,0,0,0,0]),o=r,a=!1;for(let s=r;s<t;s++)if(e.get(s)!==a)i[n]++;else{if(5===n){let t=eM.MAX_AVG_VARIANCE,r=-1;for(let e=eM.CODE_START_A;e<=eM.CODE_START_C;e++){let n=eN.patternMatchVariance(i,eM.CODE_PATTERNS[e],eM.MAX_INDIVIDUAL_VARIANCE);n<t&&(t=n,r=e)}if(r>=0&&e.isRange(Math.max(0,o-(s-o)/2),o,!1))return Int32Array.from([o,s,r]);o+=i[0]+i[1],(i=i.slice(2,i.length-1))[n-1]=0,i[n]=0,n--}else n++;i[n]=1,a=!a}throw new X}static decodeCode(e,t,r){eN.recordPattern(e,r,t);let n=eM.MAX_AVG_VARIANCE,i=-1;for(let e=0;e<eM.CODE_PATTERNS.length;e++){let r=eM.CODE_PATTERNS[e],o=this.patternMatchVariance(t,r,eM.MAX_INDIVIDUAL_VARIANCE);o<n&&(n=o,i=e)}if(i>=0)return i;throw new X}decodeRow(e,t,r){let n,i=r&&!0===r.get(U.ASSUME_GS1),o=eM.findStartPattern(t),a=o[2],s=0,l=new Uint8Array(20);switch(l[s++]=a,a){case eM.CODE_START_A:n=eM.CODE_CODE_A;break;case eM.CODE_START_B:n=eM.CODE_CODE_B;break;case eM.CODE_START_C:n=eM.CODE_CODE_C;break;default:throw new H}let c=!1,u=!1,h="",d=o[0],f=o[1],g=Int32Array.from([0,0,0,0,0,0]),p=0,m=0,w=a,C=0,E=!0,A=!1,y=!1;for(;!c;){let e=u;switch(u=!1,p=m,m=eM.decodeCode(t,g,f),l[s++]=m,m!==eM.CODE_STOP&&(E=!0),m!==eM.CODE_STOP&&(w+=++C*m),d=f,f+=g.reduce((e,t)=>e+t,0),m){case eM.CODE_START_A:case eM.CODE_START_B:case eM.CODE_START_C:throw new H}switch(n){case eM.CODE_CODE_A:if(m<64)y===A?h+=String.fromCharCode(32+m):h+=String.fromCharCode(32+m+128),y=!1;else if(m<96)y===A?h+=String.fromCharCode(m-64):h+=String.fromCharCode(m+64),y=!1;else switch(m!==eM.CODE_STOP&&(E=!1),m){case eM.CODE_FNC_1:i&&(0===h.length?h+="]C1":h+="\x1d");break;case eM.CODE_FNC_2:case eM.CODE_FNC_3:break;case eM.CODE_FNC_4_A:!A&&y?(A=!0,y=!1):A&&y?(A=!1,y=!1):y=!0;break;case eM.CODE_SHIFT:u=!0,n=eM.CODE_CODE_B;break;case eM.CODE_CODE_B:n=eM.CODE_CODE_B;break;case eM.CODE_CODE_C:n=eM.CODE_CODE_C;break;case eM.CODE_STOP:c=!0}break;case eM.CODE_CODE_B:if(m<96)y===A?h+=String.fromCharCode(32+m):h+=String.fromCharCode(32+m+128),y=!1;else switch(m!==eM.CODE_STOP&&(E=!1),m){case eM.CODE_FNC_1:i&&(0===h.length?h+="]C1":h+="\x1d");break;case eM.CODE_FNC_2:case eM.CODE_FNC_3:break;case eM.CODE_FNC_4_B:!A&&y?(A=!0,y=!1):A&&y?(A=!1,y=!1):y=!0;break;case eM.CODE_SHIFT:u=!0,n=eM.CODE_CODE_A;break;case eM.CODE_CODE_A:n=eM.CODE_CODE_A;break;case eM.CODE_CODE_C:n=eM.CODE_CODE_C;break;case eM.CODE_STOP:c=!0}break;case eM.CODE_CODE_C:if(m<100)m<10&&(h+="0"),h+=m;else switch(m!==eM.CODE_STOP&&(E=!1),m){case eM.CODE_FNC_1:i&&(0===h.length?h+="]C1":h+="\x1d");break;case eM.CODE_CODE_A:n=eM.CODE_CODE_A;break;case eM.CODE_CODE_B:n=eM.CODE_CODE_B;break;case eM.CODE_STOP:c=!0}}e&&(n=n===eM.CODE_CODE_A?eM.CODE_CODE_B:eM.CODE_CODE_A)}let I=f-d;if(f=t.getNextUnset(f),!t.isRange(f,Math.min(t.getSize(),f+(f-d)/2),!1))throw new X;if((w-=C*p)%103!==p)throw new R;let S=h.length;if(0===S)throw new X;S>0&&E&&(h=n===eM.CODE_CODE_C?h.substring(0,S-2):h.substring(0,S-1));let _=(o[1]+o[0])/2,b=d+I/2,T=l.length,N=new Uint8Array(T);for(let e=0;e<T;e++)N[e]=l[e];return new er(h,N,0,[new em(_,e),new em(b,e)],en.CODE_128,new Date().getTime())}}eM.CODE_PATTERNS=[Int32Array.from([2,1,2,2,2,2]),Int32Array.from([2,2,2,1,2,2]),Int32Array.from([2,2,2,2,2,1]),Int32Array.from([1,2,1,2,2,3]),Int32Array.from([1,2,1,3,2,2]),Int32Array.from([1,3,1,2,2,2]),Int32Array.from([1,2,2,2,1,3]),Int32Array.from([1,2,2,3,1,2]),Int32Array.from([1,3,2,2,1,2]),Int32Array.from([2,2,1,2,1,3]),Int32Array.from([2,2,1,3,1,2]),Int32Array.from([2,3,1,2,1,2]),Int32Array.from([1,1,2,2,3,2]),Int32Array.from([1,2,2,1,3,2]),Int32Array.from([1,2,2,2,3,1]),Int32Array.from([1,1,3,2,2,2]),Int32Array.from([1,2,3,1,2,2]),Int32Array.from([1,2,3,2,2,1]),Int32Array.from([2,2,3,2,1,1]),Int32Array.from([2,2,1,1,3,2]),Int32Array.from([2,2,1,2,3,1]),Int32Array.from([2,1,3,2,1,2]),Int32Array.from([2,2,3,1,1,2]),Int32Array.from([3,1,2,1,3,1]),Int32Array.from([3,1,1,2,2,2]),Int32Array.from([3,2,1,1,2,2]),Int32Array.from([3,2,1,2,2,1]),Int32Array.from([3,1,2,2,1,2]),Int32Array.from([3,2,2,1,1,2]),Int32Array.from([3,2,2,2,1,1]),Int32Array.from([2,1,2,1,2,3]),Int32Array.from([2,1,2,3,2,1]),Int32Array.from([2,3,2,1,2,1]),Int32Array.from([1,1,1,3,2,3]),Int32Array.from([1,3,1,1,2,3]),Int32Array.from([1,3,1,3,2,1]),Int32Array.from([1,1,2,3,1,3]),Int32Array.from([1,3,2,1,1,3]),Int32Array.from([1,3,2,3,1,1]),Int32Array.from([2,1,1,3,1,3]),Int32Array.from([2,3,1,1,1,3]),Int32Array.from([2,3,1,3,1,1]),Int32Array.from([1,1,2,1,3,3]),Int32Array.from([1,1,2,3,3,1]),Int32Array.from([1,3,2,1,3,1]),Int32Array.from([1,1,3,1,2,3]),Int32Array.from([1,1,3,3,2,1]),Int32Array.from([1,3,3,1,2,1]),Int32Array.from([3,1,3,1,2,1]),Int32Array.from([2,1,1,3,3,1]),Int32Array.from([2,3,1,1,3,1]),Int32Array.from([2,1,3,1,1,3]),Int32Array.from([2,1,3,3,1,1]),Int32Array.from([2,1,3,1,3,1]),Int32Array.from([3,1,1,1,2,3]),Int32Array.from([3,1,1,3,2,1]),Int32Array.from([3,3,1,1,2,1]),Int32Array.from([3,1,2,1,1,3]),Int32Array.from([3,1,2,3,1,1]),Int32Array.from([3,3,2,1,1,1]),Int32Array.from([3,1,4,1,1,1]),Int32Array.from([2,2,1,4,1,1]),Int32Array.from([4,3,1,1,1,1]),Int32Array.from([1,1,1,2,2,4]),Int32Array.from([1,1,1,4,2,2]),Int32Array.from([1,2,1,1,2,4]),Int32Array.from([1,2,1,4,2,1]),Int32Array.from([1,4,1,1,2,2]),Int32Array.from([1,4,1,2,2,1]),Int32Array.from([1,1,2,2,1,4]),Int32Array.from([1,1,2,4,1,2]),Int32Array.from([1,2,2,1,1,4]),Int32Array.from([1,2,2,4,1,1]),Int32Array.from([1,4,2,1,1,2]),Int32Array.from([1,4,2,2,1,1]),Int32Array.from([2,4,1,2,1,1]),Int32Array.from([2,2,1,1,1,4]),Int32Array.from([4,1,3,1,1,1]),Int32Array.from([2,4,1,1,1,2]),Int32Array.from([1,3,4,1,1,1]),Int32Array.from([1,1,1,2,4,2]),Int32Array.from([1,2,1,1,4,2]),Int32Array.from([1,2,1,2,4,1]),Int32Array.from([1,1,4,2,1,2]),Int32Array.from([1,2,4,1,1,2]),Int32Array.from([1,2,4,2,1,1]),Int32Array.from([4,1,1,2,1,2]),Int32Array.from([4,2,1,1,1,2]),Int32Array.from([4,2,1,2,1,1]),Int32Array.from([2,1,2,1,4,1]),Int32Array.from([2,1,4,1,2,1]),Int32Array.from([4,1,2,1,2,1]),Int32Array.from([1,1,1,1,4,3]),Int32Array.from([1,1,1,3,4,1]),Int32Array.from([1,3,1,1,4,1]),Int32Array.from([1,1,4,1,1,3]),Int32Array.from([1,1,4,3,1,1]),Int32Array.from([4,1,1,1,1,3]),Int32Array.from([4,1,1,3,1,1]),Int32Array.from([1,1,3,1,4,1]),Int32Array.from([1,1,4,1,3,1]),Int32Array.from([3,1,1,1,4,1]),Int32Array.from([4,1,1,1,3,1]),Int32Array.from([2,1,1,4,1,2]),Int32Array.from([2,1,1,2,1,4]),Int32Array.from([2,1,1,2,3,2]),Int32Array.from([2,3,3,1,1,1,2])],eM.MAX_AVG_VARIANCE=.25,eM.MAX_INDIVIDUAL_VARIANCE=.7,eM.CODE_SHIFT=98,eM.CODE_CODE_C=99,eM.CODE_CODE_B=100,eM.CODE_CODE_A=101,eM.CODE_FNC_1=102,eM.CODE_FNC_2=97,eM.CODE_FNC_3=96,eM.CODE_FNC_4_A=101,eM.CODE_FNC_4_B=100,eM.CODE_START_A=103,eM.CODE_START_B=104,eM.CODE_START_C=105,eM.CODE_STOP=106;class eD extends eN{constructor(e=!1,t=!1){super(),this.usingCheckDigit=e,this.extendedMode=t,this.decodeRowResult="",this.counters=new Int32Array(9)}decodeRow(e,t,r){let n,i,o,a=this.counters;a.fill(0),this.decodeRowResult="";let s=eD.findAsteriskPattern(t,a),l=t.getNextSet(s[1]),c=t.getSize();do{eD.recordPattern(t,l,a);let e=eD.toNarrowWidePattern(a);if(e<0)throw new X;for(let t of(n=eD.patternToChar(e),this.decodeRowResult+=n,i=l,a))l+=t;l=t.getNextSet(l)}while("*"!==n);this.decodeRowResult=this.decodeRowResult.substring(0,this.decodeRowResult.length-1);let u=0;for(let e of a)u+=e;let h=l-i-u;if(l!==c&&2*h<u)throw new X;if(this.usingCheckDigit){let e=this.decodeRowResult.length-1,t=0;for(let r=0;r<e;r++)t+=eD.ALPHABET_STRING.indexOf(this.decodeRowResult.charAt(r));if(this.decodeRowResult.charAt(e)!==eD.ALPHABET_STRING.charAt(t%43))throw new R;this.decodeRowResult=this.decodeRowResult.substring(0,e)}if(0===this.decodeRowResult.length)throw new X;o=this.extendedMode?eD.decodeExtended(this.decodeRowResult):this.decodeRowResult;let d=(s[1]+s[0])/2,f=i+u/2;return new er(o,null,0,[new em(d,e),new em(f,e)],en.CODE_39,new Date().getTime())}static findAsteriskPattern(e,t){let r=e.getSize(),n=e.getNextSet(0),i=0,o=n,a=!1,s=t.length;for(let l=n;l<r;l++)if(e.get(l)!==a)t[i]++;else{if(i===s-1){if(this.toNarrowWidePattern(t)===eD.ASTERISK_ENCODING&&e.isRange(Math.max(0,o-Math.floor((l-o)/2)),o,!1))return[o,l];o+=t[0]+t[1],t.copyWithin(0,2,2+i-1),t[i-1]=0,t[i]=0,i--}else i++;t[i]=1,a=!a}throw new X}static toNarrowWidePattern(e){let t,r=e.length,n=0;do{let i=0x7fffffff;for(let t of e)t<i&&t>n&&(i=t);n=i,t=0;let o=0,a=0;for(let i=0;i<r;i++){let s=e[i];s>n&&(a|=1<<r-1-i,t++,o+=s)}if(3===t){for(let i=0;i<r&&t>0;i++){let r=e[i];if(r>n&&(t--,2*r>=o))return -1}return a}}while(t>3);return -1}static patternToChar(e){for(let t=0;t<eD.CHARACTER_ENCODINGS.length;t++)if(eD.CHARACTER_ENCODINGS[t]===e)return eD.ALPHABET_STRING.charAt(t);if(e===eD.ASTERISK_ENCODING)return"*";throw new X}static decodeExtended(e){let t=e.length,r="";for(let n=0;n<t;n++){let t=e.charAt(n);if("+"===t||"$"===t||"%"===t||"/"===t){let i=e.charAt(n+1),o="\0";switch(t){case"+":if(i>="A"&&i<="Z")o=String.fromCharCode(i.charCodeAt(0)+32);else throw new H;break;case"$":if(i>="A"&&i<="Z")o=String.fromCharCode(i.charCodeAt(0)-64);else throw new H;break;case"%":if(i>="A"&&i<="E")o=String.fromCharCode(i.charCodeAt(0)-38);else if(i>="F"&&i<="J")o=String.fromCharCode(i.charCodeAt(0)-11);else if(i>="K"&&i<="O")o=String.fromCharCode(i.charCodeAt(0)+16);else if(i>="P"&&i<="T")o=String.fromCharCode(i.charCodeAt(0)+43);else if("U"===i)o="\0";else if("V"===i)o="@";else if("W"===i)o="`";else if("X"===i||"Y"===i||"Z"===i)o="";else throw new H;break;case"/":if(i>="A"&&i<="O")o=String.fromCharCode(i.charCodeAt(0)-32);else if("Z"===i)o=":";else throw new H}r+=o,n++}else r+=t}return r}}eD.ALPHABET_STRING="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%",eD.CHARACTER_ENCODINGS=[52,289,97,352,49,304,112,37,292,100,265,73,328,25,280,88,13,268,76,28,259,67,322,19,274,82,7,262,70,22,385,193,448,145,400,208,133,388,196,168,162,138,42],eD.ASTERISK_ENCODING=148;class eO extends eN{constructor(){super(...arguments),this.narrowLineWidth=-1}decodeRow(e,t,r){let n=this.decodeStart(t),i=this.decodeEnd(t),o=new W;eO.decodeMiddle(t,n[1],i[0],o);let a=o.toString(),s=null;null!=r&&(s=r.get(U.ALLOWED_LENGTHS)),null==s&&(s=eO.DEFAULT_ALLOWED_LENGTHS);let l=a.length,c=!1,u=0;for(let e of s){if(l===e){c=!0;break}e>u&&(u=e)}if(!c&&l>u&&(c=!0),!c)throw new H;return new er(a,null,0,[new em(n[1],e),new em(i[0],e)],en.ITF,new Date().getTime())}static decodeMiddle(e,t,r,n){let i=new Int32Array(10),o=new Int32Array(5),a=new Int32Array(5);for(i.fill(0),o.fill(0),a.fill(0);t<r;){eN.recordPattern(e,t,i);for(let e=0;e<5;e++){let t=2*e;o[e]=i[t],a[e]=i[t+1]}let r=eO.decodeDigit(o);n.append(r.toString()),r=this.decodeDigit(a),n.append(r.toString()),i.forEach(function(e){t+=e})}}decodeStart(e){let t=eO.skipWhiteSpace(e),r=eO.findGuardPattern(e,t,eO.START_PATTERN);return this.narrowLineWidth=(r[1]-r[0])/4,this.validateQuietZone(e,r[0]),r}validateQuietZone(e,t){let r=10*this.narrowLineWidth;r=r<t?r:t;for(let n=t-1;r>0&&n>=0&&!e.get(n);n--)r--;if(0!==r)throw new X}static skipWhiteSpace(e){let t=e.getSize(),r=e.getNextSet(0);if(r===t)throw new X;return r}decodeEnd(e){e.reverse();try{let t,r=eO.skipWhiteSpace(e);try{t=eO.findGuardPattern(e,r,eO.END_PATTERN_REVERSED[0])}catch(n){n instanceof X&&(t=eO.findGuardPattern(e,r,eO.END_PATTERN_REVERSED[1]))}this.validateQuietZone(e,t[0]);let n=t[0];return t[0]=e.getSize()-t[1],t[1]=e.getSize()-n,t}finally{e.reverse()}}static findGuardPattern(e,t,r){let n=r.length,i=new Int32Array(n),o=e.getSize(),a=!1,s=0,l=t;i.fill(0);for(let c=t;c<o;c++)if(e.get(c)!==a)i[s]++;else{if(s===n-1){if(eN.patternMatchVariance(i,r,eO.MAX_INDIVIDUAL_VARIANCE)<eO.MAX_AVG_VARIANCE)return[l,c];l+=i[0]+i[1],P.arraycopy(i,2,i,0,s-1),i[s-1]=0,i[s]=0,s--}else s++;i[s]=1,a=!a}throw new X}static decodeDigit(e){let t=eO.MAX_AVG_VARIANCE,r=-1,n=eO.PATTERNS.length;for(let i=0;i<n;i++){let n=eO.PATTERNS[i],o=eN.patternMatchVariance(e,n,eO.MAX_INDIVIDUAL_VARIANCE);o<t?(t=o,r=i):o===t&&(r=-1)}if(r>=0)return r%10;throw new X}}eO.PATTERNS=[Int32Array.from([1,1,2,2,1]),Int32Array.from([2,1,1,1,2]),Int32Array.from([1,2,1,1,2]),Int32Array.from([2,2,1,1,1]),Int32Array.from([1,1,2,1,2]),Int32Array.from([2,1,2,1,1]),Int32Array.from([1,2,2,1,1]),Int32Array.from([1,1,1,2,2]),Int32Array.from([2,1,1,2,1]),Int32Array.from([1,2,1,2,1]),Int32Array.from([1,1,3,3,1]),Int32Array.from([3,1,1,1,3]),Int32Array.from([1,3,1,1,3]),Int32Array.from([3,3,1,1,1]),Int32Array.from([1,1,3,1,3]),Int32Array.from([3,1,3,1,1]),Int32Array.from([1,3,3,1,1]),Int32Array.from([1,1,1,3,3]),Int32Array.from([3,1,1,3,1]),Int32Array.from([1,3,1,3,1])],eO.MAX_AVG_VARIANCE=.38,eO.MAX_INDIVIDUAL_VARIANCE=.5,eO.DEFAULT_ALLOWED_LENGTHS=[6,8,10,12,14],eO.START_PATTERN=Int32Array.from([1,1,1,1]),eO.END_PATTERN_REVERSED=[Int32Array.from([1,1,2]),Int32Array.from([1,1,3])];class eR extends eN{constructor(){super(...arguments),this.decodeRowStringBuffer=""}static findStartGuardPattern(e){let t,r=!1,n=0,i=Int32Array.from([0,0,0]);for(;!r;){i=Int32Array.from([0,0,0]);let o=(t=eR.findGuardPattern(e,n,!1,this.START_END_PATTERN,i))[0],a=o-((n=t[1])-o);a>=0&&(r=e.isRange(a,o,!1))}return t}static checkChecksum(e){return eR.checkStandardUPCEANChecksum(e)}static checkStandardUPCEANChecksum(e){let t=e.length;if(0===t)return!1;let r=parseInt(e.charAt(t-1),10);return eR.getStandardUPCEANChecksum(e.substring(0,t-1))===r}static getStandardUPCEANChecksum(e){let t=e.length,r=0;for(let n=t-1;n>=0;n-=2){let t=e.charAt(n).charCodeAt(0)-48;if(t<0||t>9)throw new H;r+=t}r*=3;for(let n=t-2;n>=0;n-=2){let t=e.charAt(n).charCodeAt(0)-48;if(t<0||t>9)throw new H;r+=t}return(1e3-r)%10}static decodeEnd(e,t){return eR.findGuardPattern(e,t,!1,eR.START_END_PATTERN,new Int32Array(eR.START_END_PATTERN.length).fill(0))}static findGuardPatternWithoutCounters(e,t,r,n){return this.findGuardPattern(e,t,r,n,new Int32Array(n.length))}static findGuardPattern(e,t,r,n,i){let o=e.getSize();t=r?e.getNextUnset(t):e.getNextSet(t);let a=0,s=t,l=n.length,c=r;for(let r=t;r<o;r++)if(e.get(r)!==c)i[a]++;else{if(a===l-1){if(eN.patternMatchVariance(i,n,eR.MAX_INDIVIDUAL_VARIANCE)<eR.MAX_AVG_VARIANCE)return Int32Array.from([s,r]);s+=i[0]+i[1];let e=i.slice(2,i.length-1);for(let t=0;t<a-1;t++)i[t]=e[t];i[a-1]=0,i[a]=0,a--}else a++;i[a]=1,c=!c}throw new X}static decodeDigit(e,t,r,n){this.recordPattern(e,r,t);let i=this.MAX_AVG_VARIANCE,o=-1,a=n.length;for(let e=0;e<a;e++){let r=n[e],a=eN.patternMatchVariance(t,r,eR.MAX_INDIVIDUAL_VARIANCE);a<i&&(i=a,o=e)}if(o>=0)return o;throw new X}}eR.MAX_AVG_VARIANCE=.48,eR.MAX_INDIVIDUAL_VARIANCE=.7,eR.START_END_PATTERN=Int32Array.from([1,1,1]),eR.MIDDLE_PATTERN=Int32Array.from([1,1,1,1,1]),eR.END_PATTERN=Int32Array.from([1,1,1,1,1,1]),eR.L_PATTERNS=[Int32Array.from([3,2,1,1]),Int32Array.from([2,2,2,1]),Int32Array.from([2,1,2,2]),Int32Array.from([1,4,1,1]),Int32Array.from([1,1,3,2]),Int32Array.from([1,2,3,1]),Int32Array.from([1,1,1,4]),Int32Array.from([1,3,1,2]),Int32Array.from([1,2,1,3]),Int32Array.from([3,1,1,2])];class ev{constructor(){this.CHECK_DIGIT_ENCODINGS=[24,20,18,17,12,6,3,10,9,5],this.decodeMiddleCounters=Int32Array.from([0,0,0,0]),this.decodeRowStringBuffer=""}decodeRow(e,t,r){let n=this.decodeRowStringBuffer,i=this.decodeMiddle(t,r,n),o=n.toString(),a=ev.parseExtensionString(o),s=new er(o,null,0,[new em((r[0]+r[1])/2,e),new em(i,e)],en.UPC_EAN_EXTENSION,new Date().getTime());return null!=a&&s.putAllMetadata(a),s}decodeMiddle(e,t,r){let n=this.decodeMiddleCounters;n[0]=0,n[1]=0,n[2]=0,n[3]=0;let i=e.getSize(),o=t[1],a=0;for(let t=0;t<5&&o<i;t++){let i=eR.decodeDigit(e,n,o,eR.L_AND_G_PATTERNS);for(let e of(r+=String.fromCharCode(48+i%10),n))o+=e;i>=10&&(a|=1<<4-t),4!==t&&(o=e.getNextSet(o),o=e.getNextUnset(o))}if(5!==r.length)throw new X;let s=this.determineCheckDigit(a);if(ev.extensionChecksum(r.toString())!==s)throw new X;return o}static extensionChecksum(e){let t=e.length,r=0;for(let n=t-2;n>=0;n-=2)r+=e.charAt(n).charCodeAt(0)-48;r*=3;for(let n=t-1;n>=0;n-=2)r+=e.charAt(n).charCodeAt(0)-48;return(r*=3)%10}determineCheckDigit(e){for(let t=0;t<10;t++)if(e===this.CHECK_DIGIT_ENCODINGS[t])return t;throw new X}static parseExtensionString(e){if(5!==e.length)return null;let t=ev.parseExtension5String(e);return null==t?null:new Map([[ei.SUGGESTED_PRICE,t]])}static parseExtension5String(e){let t;switch(e.charAt(0)){case"0":t="\xa3";break;case"5":t="$";break;case"9":switch(e){case"90000":return null;case"99991":return"0.00";case"99990":return"Used"}t="";break;default:t=""}let r=parseInt(e.substring(1)),n=(r/100).toString(),i=r%100;return t+n+"."+(i<10?"0"+i:i.toString())}}class eP{constructor(){this.decodeMiddleCounters=Int32Array.from([0,0,0,0]),this.decodeRowStringBuffer=""}decodeRow(e,t,r){let n=this.decodeRowStringBuffer,i=this.decodeMiddle(t,r,n),o=n.toString(),a=eP.parseExtensionString(o),s=new er(o,null,0,[new em((r[0]+r[1])/2,e),new em(i,e)],en.UPC_EAN_EXTENSION,new Date().getTime());return null!=a&&s.putAllMetadata(a),s}decodeMiddle(e,t,r){let n=this.decodeMiddleCounters;n[0]=0,n[1]=0,n[2]=0,n[3]=0;let i=e.getSize(),o=t[1],a=0;for(let t=0;t<2&&o<i;t++){let i=eR.decodeDigit(e,n,o,eR.L_AND_G_PATTERNS);for(let e of(r+=String.fromCharCode(48+i%10),n))o+=e;i>=10&&(a|=1<<1-t),1!==t&&(o=e.getNextSet(o),o=e.getNextUnset(o))}if(2!==r.length||parseInt(r.toString())%4!==a)throw new X;return o}static parseExtensionString(e){return 2!==e.length?null:new Map([[ei.ISSUE_NUMBER,parseInt(e)]])}}class eB{static decodeRow(e,t,r){let n=eR.findGuardPattern(t,r,!1,this.EXTENSION_START_PATTERN,new Int32Array(this.EXTENSION_START_PATTERN.length).fill(0));try{return new ev().decodeRow(e,t,n)}catch(r){return new eP().decodeRow(e,t,n)}}}eB.EXTENSION_START_PATTERN=Int32Array.from([1,1,2]);class ex extends eR{constructor(){super(),this.decodeRowStringBuffer="",ex.L_AND_G_PATTERNS=ex.L_PATTERNS.map(e=>Int32Array.from(e));for(let e=10;e<20;e++){let t=ex.L_PATTERNS[e-10],r=new Int32Array(t.length);for(let e=0;e<t.length;e++)r[e]=t[t.length-e-1];ex.L_AND_G_PATTERNS[e]=r}}decodeRow(e,t,r){let n=ex.findStartGuardPattern(t),i=null==r?null:r.get(U.NEED_RESULT_POINT_CALLBACK);if(null!=i){let t=new em((n[0]+n[1])/2,e);i.foundPossibleResultPoint(t)}let o=this.decodeMiddle(t,n,this.decodeRowStringBuffer),a=o.rowOffset,s=o.resultString;if(null!=i){let t=new em(a,e);i.foundPossibleResultPoint(t)}let l=this.decodeEnd(t,a);if(null!=i){let t=new em((l[0]+l[1])/2,e);i.foundPossibleResultPoint(t)}let c=l[1],u=c+(c-l[0]);if(u>=t.getSize()||!t.isRange(c,u,!1))throw new X;let h=s.toString();if(h.length<8)throw new H;if(!ex.checkChecksum(h))throw new R;let d=(n[1]+n[0])/2,f=(l[1]+l[0])/2,g=this.getBarcodeFormat(),p=new er(h,null,0,[new em(d,e),new em(f,e)],g,new Date().getTime()),m=0;try{let r=eB.decodeRow(e,t,l[1]);p.putMetadata(ei.UPC_EAN_EXTENSION,r.getText()),p.putAllMetadata(r.getResultMetadata()),p.addResultPoints(r.getResultPoints()),m=r.getText().length}catch(e){}let w=null==r?null:r.get(U.ALLOWED_EAN_EXTENSIONS);if(null!=w){let e=!1;for(let t in w)if(m.toString()===t){e=!0;break}if(!e)throw new X}return p}decodeEnd(e,t){return ex.findGuardPattern(e,t,!1,ex.START_END_PATTERN,new Int32Array(ex.START_END_PATTERN.length).fill(0))}static checkChecksum(e){return ex.checkStandardUPCEANChecksum(e)}static checkStandardUPCEANChecksum(e){let t=e.length;if(0===t)return!1;let r=parseInt(e.charAt(t-1),10);return ex.getStandardUPCEANChecksum(e.substring(0,t-1))===r}static getStandardUPCEANChecksum(e){let t=e.length,r=0;for(let n=t-1;n>=0;n-=2){let t=e.charAt(n).charCodeAt(0)-48;if(t<0||t>9)throw new H;r+=t}r*=3;for(let n=t-2;n>=0;n-=2){let t=e.charAt(n).charCodeAt(0)-48;if(t<0||t>9)throw new H;r+=t}return(1e3-r)%10}}class eL extends ex{constructor(){super(),this.decodeMiddleCounters=Int32Array.from([0,0,0,0])}decodeMiddle(e,t,r){let n=this.decodeMiddleCounters;n[0]=0,n[1]=0,n[2]=0,n[3]=0;let i=e.getSize(),o=t[1],a=0;for(let t=0;t<6&&o<i;t++){let i=ex.decodeDigit(e,n,o,ex.L_AND_G_PATTERNS);for(let e of(r+=String.fromCharCode(48+i%10),n))o+=e;i>=10&&(a|=1<<5-t)}r=eL.determineFirstDigit(r,a),o=ex.findGuardPattern(e,o,!0,ex.MIDDLE_PATTERN,new Int32Array(ex.MIDDLE_PATTERN.length).fill(0))[1];for(let t=0;t<6&&o<i;t++){let t=ex.decodeDigit(e,n,o,ex.L_PATTERNS);for(let e of(r+=String.fromCharCode(48+t),n))o+=e}return{rowOffset:o,resultString:r}}getBarcodeFormat(){return en.EAN_13}static determineFirstDigit(e,t){for(let r=0;r<10;r++)if(t===this.FIRST_DIGIT_ENCODINGS[r])return e=String.fromCharCode(48+r)+e;throw new X}}eL.FIRST_DIGIT_ENCODINGS=[0,11,13,14,19,25,28,21,22,26];class ek extends ex{constructor(){super(),this.decodeMiddleCounters=Int32Array.from([0,0,0,0])}decodeMiddle(e,t,r){let n=this.decodeMiddleCounters;n[0]=0,n[1]=0,n[2]=0,n[3]=0;let i=e.getSize(),o=t[1];for(let t=0;t<4&&o<i;t++){let t=ex.decodeDigit(e,n,o,ex.L_PATTERNS);for(let e of(r+=String.fromCharCode(48+t),n))o+=e}o=ex.findGuardPattern(e,o,!0,ex.MIDDLE_PATTERN,new Int32Array(ex.MIDDLE_PATTERN.length).fill(0))[1];for(let t=0;t<4&&o<i;t++){let t=ex.decodeDigit(e,n,o,ex.L_PATTERNS);for(let e of(r+=String.fromCharCode(48+t),n))o+=e}return{rowOffset:o,resultString:r}}getBarcodeFormat(){return en.EAN_8}}class eF extends ex{constructor(){super(...arguments),this.ean13Reader=new eL}getBarcodeFormat(){return en.UPC_A}decode(e,t){return this.maybeReturnResult(this.ean13Reader.decode(e))}decodeRow(e,t,r){return this.maybeReturnResult(this.ean13Reader.decodeRow(e,t,r))}decodeMiddle(e,t,r){return this.ean13Reader.decodeMiddle(e,t,r)}maybeReturnResult(e){let t=e.getText();if("0"===t.charAt(0)){let r=new er(t.substring(1),null,null,e.getResultPoints(),en.UPC_A);return null!=e.getResultMetadata()&&r.putAllMetadata(e.getResultMetadata()),r}throw new X}reset(){this.ean13Reader.reset()}}class eU extends ex{constructor(){super(),this.decodeMiddleCounters=new Int32Array(4)}decodeMiddle(e,t,r){let n=this.decodeMiddleCounters.map(e=>e);n[0]=0,n[1]=0,n[2]=0,n[3]=0;let i=e.getSize(),o=t[1],a=0;for(let t=0;t<6&&o<i;t++){let i=eU.decodeDigit(e,n,o,eU.L_AND_G_PATTERNS);for(let e of(r+=String.fromCharCode(48+i%10),n))o+=e;i>=10&&(a|=1<<5-t)}return{rowOffset:o,resultString:eU.determineNumSysAndCheckDigit(r,a)}}decodeEnd(e,t){return eU.findGuardPatternWithoutCounters(e,t,!0,eU.MIDDLE_END_PATTERN)}checkChecksum(e){return ex.checkChecksum(eU.convertUPCEtoUPCA(e))}static determineNumSysAndCheckDigit(e,t){for(let r=0;r<=1;r++)for(let n=0;n<10;n++)if(t===this.NUMSYS_AND_CHECK_DIGIT_PATTERNS[r][n])return String.fromCharCode(48+r)+e+String.fromCharCode(48+n);throw X.getNotFoundInstance()}getBarcodeFormat(){return en.UPC_E}static convertUPCEtoUPCA(e){let t=e.slice(1,7).split("").map(e=>e.charCodeAt(0)),r=new W;r.append(e.charAt(0));let n=t[5];switch(n){case 0:case 1:case 2:r.appendChars(t,0,2),r.append(n),r.append("0000"),r.appendChars(t,2,3);break;case 3:r.appendChars(t,0,3),r.append("00000"),r.appendChars(t,3,2);break;case 4:r.appendChars(t,0,4),r.append("00000"),r.append(t[4]);break;default:r.appendChars(t,0,5),r.append("0000"),r.append(n)}return e.length>=8&&r.append(e.charAt(7)),r.toString()}}eU.MIDDLE_END_PATTERN=Int32Array.from([1,1,1,1,1,1]),eU.NUMSYS_AND_CHECK_DIGIT_PATTERNS=[Int32Array.from([56,52,50,49,44,38,35,42,41,37]),Int32Array.from([7,11,13,14,19,25,28,21,22,26])];class eH extends eN{constructor(e){super();let t=null==e?null:e.get(U.POSSIBLE_FORMATS),r=[];null==t?(r.push(new eL),r.push(new eF),r.push(new ek),r.push(new eU)):(t.indexOf(en.EAN_13)>-1&&r.push(new eL),t.indexOf(en.UPC_A)>-1&&r.push(new eF),t.indexOf(en.EAN_8)>-1&&r.push(new ek),t.indexOf(en.UPC_E)>-1&&r.push(new eU)),this.readers=r}decodeRow(e,t,r){for(let n of this.readers)try{let i=n.decodeRow(e,t,r),o=i.getBarcodeFormat()===en.EAN_13&&"0"===i.getText().charAt(0),a=null==r?null:r.get(U.POSSIBLE_FORMATS),s=null==a||a.includes(en.UPC_A);if(o&&s){let e=i.getRawBytes(),t=new er(i.getText().substring(1),e,e?e.length:null,i.getResultPoints(),en.UPC_A);return t.putAllMetadata(i.getResultMetadata()),t}return i}catch(e){}throw new X}reset(){for(let e of this.readers)e.reset()}}class ez extends eN{constructor(){super(),this.decodeFinderCounters=new Int32Array(4),this.dataCharacterCounters=new Int32Array(8),this.oddRoundingErrors=[,,,,],this.evenRoundingErrors=[,,,,],this.oddCounts=Array(this.dataCharacterCounters.length/2),this.evenCounts=Array(this.dataCharacterCounters.length/2)}getDecodeFinderCounters(){return this.decodeFinderCounters}getDataCharacterCounters(){return this.dataCharacterCounters}getOddRoundingErrors(){return this.oddRoundingErrors}getEvenRoundingErrors(){return this.evenRoundingErrors}getOddCounts(){return this.oddCounts}getEvenCounts(){return this.evenCounts}parseFinderValue(e,t){for(let r=0;r<t.length;r++)if(eN.patternMatchVariance(e,t[r],ez.MAX_INDIVIDUAL_VARIANCE)<ez.MAX_AVG_VARIANCE)return r;throw new X}static count(e){return eg.sum(new Int32Array(e))}static increment(e,t){let r=0,n=t[0];for(let i=1;i<e.length;i++)t[i]>n&&(n=t[i],r=i);e[r]++}static decrement(e,t){let r=0,n=t[0];for(let i=1;i<e.length;i++)t[i]<n&&(n=t[i],r=i);e[r]--}static isFinderPattern(e){let t=e[0]+e[1],r=t+e[2]+e[3],n=t/r;if(n>=ez.MIN_FINDER_PATTERN_RATIO&&n<=ez.MAX_FINDER_PATTERN_RATIO){let t=Number.MAX_SAFE_INTEGER,r=Number.MIN_SAFE_INTEGER;for(let n of e)n>r&&(r=n),n<t&&(t=n);return r<10*t}return!1}}ez.MAX_AVG_VARIANCE=.2,ez.MAX_INDIVIDUAL_VARIANCE=.45,ez.MIN_FINDER_PATTERN_RATIO=9.5/12,ez.MAX_FINDER_PATTERN_RATIO=12.5/14;class eV{constructor(e,t){this.value=e,this.checksumPortion=t}getValue(){return this.value}getChecksumPortion(){return this.checksumPortion}toString(){return this.value+"("+this.checksumPortion+")"}equals(e){return e instanceof eV&&this.value===e.value&&this.checksumPortion===e.checksumPortion}hashCode(){return this.value^this.checksumPortion}}class ej{constructor(e,t,r,n,i){this.value=e,this.startEnd=t,this.value=e,this.startEnd=t,this.resultPoints=[],this.resultPoints.push(new em(r,i)),this.resultPoints.push(new em(n,i))}getValue(){return this.value}getStartEnd(){return this.startEnd}getResultPoints(){return this.resultPoints}equals(e){return e instanceof ej&&this.value===e.value}hashCode(){return this.value}}class eG{constructor(){}static getRSSvalue(e,t,r){let n=0;for(let t of e)n+=t;let i=0,o=0,a=e.length;for(let s=0;s<a-1;s++){let l;for(l=1,o|=1<<s;l<e[s];l++,o&=~(1<<s)){let e=eG.combins(n-l-1,a-s-2);if(r&&0===o&&n-l-(a-s-1)>=a-s-1&&(e-=eG.combins(n-l-(a-s),a-s-2)),a-s-1>1){let r=0;for(let e=n-l-(a-s-2);e>t;e--)r+=eG.combins(n-l-e-1,a-s-3);e-=r*(a-1-s)}else n-l>t&&e--;i+=e}n-=l}return i}static combins(e,t){let r,n;e-t>t?(n=t,r=e-t):(n=e-t,r=t);let i=1,o=1;for(let t=e;t>r;t--)i*=t,o<=n&&(i/=o,o++);for(;o<=n;)i/=o,o++;return i}}class eW{static buildBitArray(e){let t=2*e.length-1;null==e[e.length-1].getRightChar()&&(t-=1);let r=new F(12*t),n=0,i=e[0].getRightChar().getValue();for(let e=11;e>=0;--e)(i&1<<e)!=0&&r.set(n),n++;for(let t=1;t<e.length;++t){let i=e[t],o=i.getLeftChar().getValue();for(let e=11;e>=0;--e)(o&1<<e)!=0&&r.set(n),n++;if(null!=i.getRightChar()){let e=i.getRightChar().getValue();for(let t=11;t>=0;--t)(e&1<<t)!=0&&r.set(n),n++}}return r}}class eY{constructor(e,t){t?this.decodedInformation=null:(this.finished=e,this.decodedInformation=t)}getDecodedInformation(){return this.decodedInformation}isFinished(){return this.finished}}class eX{constructor(e){this.newPosition=e}getNewPosition(){return this.newPosition}}class eZ extends eX{constructor(e,t){super(e),this.value=t}getValue(){return this.value}isFNC1(){return this.value===eZ.FNC1}}eZ.FNC1="$";class eQ extends eX{constructor(e,t,r){super(e),r?(this.remaining=!0,this.remainingValue=this.remainingValue):(this.remaining=!1,this.remainingValue=0),this.newString=t}getNewString(){return this.newString}isRemaining(){return this.remaining}getRemainingValue(){return this.remainingValue}}class eq extends eX{constructor(e,t,r){if(super(e),t<0||t>10||r<0||r>10)throw new H;this.firstDigit=t,this.secondDigit=r}getFirstDigit(){return this.firstDigit}getSecondDigit(){return this.secondDigit}getValue(){return 10*this.firstDigit+this.secondDigit}isFirstDigitFNC1(){return this.firstDigit===eq.FNC1}isSecondDigitFNC1(){return this.secondDigit===eq.FNC1}isAnyFNC1(){return this.firstDigit===eq.FNC1||this.secondDigit===eq.FNC1}}eq.FNC1=10;class eK{constructor(){}static parseFieldsInGeneralPurpose(e){if(!e)return null;if(e.length<2)throw new X;let t=e.substring(0,2);for(let r of eK.TWO_DIGIT_DATA_LENGTH)if(r[0]===t){if(r[1]===eK.VARIABLE_LENGTH)return eK.processVariableAI(2,r[2],e);return eK.processFixedAI(2,r[1],e)}if(e.length<3)throw new X;let r=e.substring(0,3);for(let t of eK.THREE_DIGIT_DATA_LENGTH)if(t[0]===r){if(t[1]===eK.VARIABLE_LENGTH)return eK.processVariableAI(3,t[2],e);return eK.processFixedAI(3,t[1],e)}for(let t of eK.THREE_DIGIT_PLUS_DIGIT_DATA_LENGTH)if(t[0]===r){if(t[1]===eK.VARIABLE_LENGTH)return eK.processVariableAI(4,t[2],e);return eK.processFixedAI(4,t[1],e)}if(e.length<4)throw new X;let n=e.substring(0,4);for(let t of eK.FOUR_DIGIT_DATA_LENGTH)if(t[0]===n){if(t[1]===eK.VARIABLE_LENGTH)return eK.processVariableAI(4,t[2],e);return eK.processFixedAI(4,t[1],e)}throw new X}static processFixedAI(e,t,r){if(r.length<e)throw new X;let n=r.substring(0,e);if(r.length<e+t)throw new X;let i=r.substring(e,e+t),o=r.substring(e+t),a="("+n+")"+i,s=eK.parseFieldsInGeneralPurpose(o);return null==s?a:a+s}static processVariableAI(e,t,r){let n,i=r.substring(0,e);n=r.length<e+t?r.length:e+t;let o=r.substring(e,n),a=r.substring(n),s="("+i+")"+o,l=eK.parseFieldsInGeneralPurpose(a);return null==l?s:s+l}}eK.VARIABLE_LENGTH=[],eK.TWO_DIGIT_DATA_LENGTH=[["00",18],["01",14],["02",14],["10",eK.VARIABLE_LENGTH,20],["11",6],["12",6],["13",6],["15",6],["17",6],["20",2],["21",eK.VARIABLE_LENGTH,20],["22",eK.VARIABLE_LENGTH,29],["30",eK.VARIABLE_LENGTH,8],["37",eK.VARIABLE_LENGTH,8],["90",eK.VARIABLE_LENGTH,30],["91",eK.VARIABLE_LENGTH,30],["92",eK.VARIABLE_LENGTH,30],["93",eK.VARIABLE_LENGTH,30],["94",eK.VARIABLE_LENGTH,30],["95",eK.VARIABLE_LENGTH,30],["96",eK.VARIABLE_LENGTH,30],["97",eK.VARIABLE_LENGTH,3],["98",eK.VARIABLE_LENGTH,30],["99",eK.VARIABLE_LENGTH,30]],eK.THREE_DIGIT_DATA_LENGTH=[["240",eK.VARIABLE_LENGTH,30],["241",eK.VARIABLE_LENGTH,30],["242",eK.VARIABLE_LENGTH,6],["250",eK.VARIABLE_LENGTH,30],["251",eK.VARIABLE_LENGTH,30],["253",eK.VARIABLE_LENGTH,17],["254",eK.VARIABLE_LENGTH,20],["400",eK.VARIABLE_LENGTH,30],["401",eK.VARIABLE_LENGTH,30],["402",17],["403",eK.VARIABLE_LENGTH,30],["410",13],["411",13],["412",13],["413",13],["414",13],["420",eK.VARIABLE_LENGTH,20],["421",eK.VARIABLE_LENGTH,15],["422",3],["423",eK.VARIABLE_LENGTH,15],["424",3],["425",3],["426",3]],eK.THREE_DIGIT_PLUS_DIGIT_DATA_LENGTH=[["310",6],["311",6],["312",6],["313",6],["314",6],["315",6],["316",6],["320",6],["321",6],["322",6],["323",6],["324",6],["325",6],["326",6],["327",6],["328",6],["329",6],["330",6],["331",6],["332",6],["333",6],["334",6],["335",6],["336",6],["340",6],["341",6],["342",6],["343",6],["344",6],["345",6],["346",6],["347",6],["348",6],["349",6],["350",6],["351",6],["352",6],["353",6],["354",6],["355",6],["356",6],["357",6],["360",6],["361",6],["362",6],["363",6],["364",6],["365",6],["366",6],["367",6],["368",6],["369",6],["390",eK.VARIABLE_LENGTH,15],["391",eK.VARIABLE_LENGTH,18],["392",eK.VARIABLE_LENGTH,15],["393",eK.VARIABLE_LENGTH,18],["703",eK.VARIABLE_LENGTH,30]],eK.FOUR_DIGIT_DATA_LENGTH=[["7001",13],["7002",eK.VARIABLE_LENGTH,30],["7003",10],["8001",14],["8002",eK.VARIABLE_LENGTH,20],["8003",eK.VARIABLE_LENGTH,30],["8004",eK.VARIABLE_LENGTH,30],["8005",6],["8006",18],["8007",eK.VARIABLE_LENGTH,30],["8008",eK.VARIABLE_LENGTH,12],["8018",18],["8020",eK.VARIABLE_LENGTH,25],["8100",6],["8101",10],["8102",2],["8110",eK.VARIABLE_LENGTH,70],["8200",eK.VARIABLE_LENGTH,70]];class e${constructor(e){this.buffer=new W,this.information=e}decodeAllCodes(e,t){let r=t,n=null;for(;;){let t=this.decodeGeneralPurposeField(r,n),i=eK.parseFieldsInGeneralPurpose(t.getNewString());if(null!=i&&e.append(i),n=t.isRemaining()?""+t.getRemainingValue():null,r===t.getNewPosition())break;r=t.getNewPosition()}return e.toString()}isStillNumeric(e){if(e+7>this.information.getSize())return e+4<=this.information.getSize();for(let t=e;t<e+3;++t)if(this.information.get(t))return!0;return this.information.get(e+3)}decodeNumeric(e){if(e+7>this.information.getSize()){let t=this.extractNumericValueFromBitArray(e,4);return 0===t?new eq(this.information.getSize(),eq.FNC1,eq.FNC1):new eq(this.information.getSize(),t-1,eq.FNC1)}let t=this.extractNumericValueFromBitArray(e,7);return new eq(e+7,(t-8)/11,(t-8)%11)}extractNumericValueFromBitArray(e,t){return e$.extractNumericValueFromBitArray(this.information,e,t)}static extractNumericValueFromBitArray(e,t,r){let n=0;for(let i=0;i<r;++i)e.get(t+i)&&(n|=1<<r-i-1);return n}decodeGeneralPurposeField(e,t){this.buffer.setLengthToZero(),null!=t&&this.buffer.append(t),this.current.setPosition(e);let r=this.parseBlocks();return null!=r&&r.isRemaining()?new eQ(this.current.getPosition(),this.buffer.toString(),r.getRemainingValue()):new eQ(this.current.getPosition(),this.buffer.toString())}parseBlocks(){let e,t;do{let r=this.current.getPosition();if(e=this.current.isAlpha()?(t=this.parseAlphaBlock()).isFinished():this.current.isIsoIec646()?(t=this.parseIsoIec646Block()).isFinished():(t=this.parseNumericBlock()).isFinished(),r===this.current.getPosition()&&!e)break}while(!e);return t.getDecodedInformation()}parseNumericBlock(){for(;this.isStillNumeric(this.current.getPosition());){let e=this.decodeNumeric(this.current.getPosition());if(this.current.setPosition(e.getNewPosition()),e.isFirstDigitFNC1()){let t;return new eY(!0,e.isSecondDigitFNC1()?new eQ(this.current.getPosition(),this.buffer.toString()):new eQ(this.current.getPosition(),this.buffer.toString(),e.getSecondDigit()))}if(this.buffer.append(e.getFirstDigit()),e.isSecondDigitFNC1())return new eY(!0,new eQ(this.current.getPosition(),this.buffer.toString()));this.buffer.append(e.getSecondDigit())}return this.isNumericToAlphaNumericLatch(this.current.getPosition())&&(this.current.setAlpha(),this.current.incrementPosition(4)),new eY(!1)}parseIsoIec646Block(){for(;this.isStillIsoIec646(this.current.getPosition());){let e=this.decodeIsoIec646(this.current.getPosition());if(this.current.setPosition(e.getNewPosition()),e.isFNC1())return new eY(!0,new eQ(this.current.getPosition(),this.buffer.toString()));this.buffer.append(e.getValue())}return this.isAlphaOr646ToNumericLatch(this.current.getPosition())?(this.current.incrementPosition(3),this.current.setNumeric()):this.isAlphaTo646ToAlphaLatch(this.current.getPosition())&&(this.current.getPosition()+5<this.information.getSize()?this.current.incrementPosition(5):this.current.setPosition(this.information.getSize()),this.current.setAlpha()),new eY(!1)}parseAlphaBlock(){for(;this.isStillAlpha(this.current.getPosition());){let e=this.decodeAlphanumeric(this.current.getPosition());if(this.current.setPosition(e.getNewPosition()),e.isFNC1())return new eY(!0,new eQ(this.current.getPosition(),this.buffer.toString()));this.buffer.append(e.getValue())}return this.isAlphaOr646ToNumericLatch(this.current.getPosition())?(this.current.incrementPosition(3),this.current.setNumeric()):this.isAlphaTo646ToAlphaLatch(this.current.getPosition())&&(this.current.getPosition()+5<this.information.getSize()?this.current.incrementPosition(5):this.current.setPosition(this.information.getSize()),this.current.setIsoIec646()),new eY(!1)}isStillIsoIec646(e){if(e+5>this.information.getSize())return!1;let t=this.extractNumericValueFromBitArray(e,5);if(t>=5&&t<16)return!0;if(e+7>this.information.getSize())return!1;let r=this.extractNumericValueFromBitArray(e,7);if(r>=64&&r<116)return!0;if(e+8>this.information.getSize())return!1;let n=this.extractNumericValueFromBitArray(e,8);return n>=232&&n<253}decodeIsoIec646(e){let t,r=this.extractNumericValueFromBitArray(e,5);if(15===r)return new eZ(e+5,eZ.FNC1);if(r>=5&&r<15)return new eZ(e+5,"0"+(r-5));let n=this.extractNumericValueFromBitArray(e,7);if(n>=64&&n<90)return new eZ(e+7,""+(n+1));if(n>=90&&n<116)return new eZ(e+7,""+(n+7));switch(this.extractNumericValueFromBitArray(e,8)){case 232:t="!";break;case 233:t='"';break;case 234:t="%";break;case 235:t="&";break;case 236:t="'";break;case 237:t="(";break;case 238:t=")";break;case 239:t="*";break;case 240:t="+";break;case 241:t=",";break;case 242:t="-";break;case 243:t=".";break;case 244:t="/";break;case 245:t=":";break;case 246:t=";";break;case 247:t="<";break;case 248:t="=";break;case 249:t=">";break;case 250:t="?";break;case 251:t="_";break;case 252:t=" ";break;default:throw new H}return new eZ(e+8,t)}isStillAlpha(e){if(e+5>this.information.getSize())return!1;let t=this.extractNumericValueFromBitArray(e,5);if(t>=5&&t<16)return!0;if(e+6>this.information.getSize())return!1;let r=this.extractNumericValueFromBitArray(e,6);return r>=16&&r<63}decodeAlphanumeric(e){let t,r=this.extractNumericValueFromBitArray(e,5);if(15===r)return new eZ(e+5,eZ.FNC1);if(r>=5&&r<15)return new eZ(e+5,"0"+(r-5));let n=this.extractNumericValueFromBitArray(e,6);if(n>=32&&n<58)return new eZ(e+6,""+(n+33));switch(n){case 58:t="*";break;case 59:t=",";break;case 60:t="-";break;case 61:t=".";break;case 62:t="/";break;default:throw new eh("Decoding invalid alphanumeric value: "+n)}return new eZ(e+6,t)}isAlphaTo646ToAlphaLatch(e){if(e+1>this.information.getSize())return!1;for(let t=0;t<5&&t+e<this.information.getSize();++t)if(2===t){if(!this.information.get(e+2))return!1}else if(this.information.get(e+t))return!1;return!0}isAlphaOr646ToNumericLatch(e){if(e+3>this.information.getSize())return!1;for(let t=e;t<e+3;++t)if(this.information.get(t))return!1;return!0}isNumericToAlphaNumericLatch(e){if(e+1>this.information.getSize())return!1;for(let t=0;t<4&&t+e<this.information.getSize();++t)if(this.information.get(e+t))return!1;return!0}}class eJ{constructor(e){this.information=e,this.generalDecoder=new e$(e)}getInformation(){return this.information}getGeneralDecoder(){return this.generalDecoder}}class e1 extends eJ{constructor(e){super(e)}encodeCompressedGtin(e,t){e.append("(01)");let r=e.length();e.append("9"),this.encodeCompressedGtinWithoutAI(e,t,r)}encodeCompressedGtinWithoutAI(e,t,r){for(let r=0;r<4;++r){let n=this.getGeneralDecoder().extractNumericValueFromBitArray(t+10*r,10);n/100==0&&e.append("0"),n/10==0&&e.append("0"),e.append(n)}e1.appendCheckDigit(e,r)}static appendCheckDigit(e,t){let r=0;for(let n=0;n<13;n++){let i=e.charAt(n+t).charCodeAt(0)-48;r+=(1&n)==0?3*i:i}10==(r=10-r%10)&&(r=0),e.append(r)}}e1.GTIN_SIZE=40;class e0 extends e1{constructor(e){super(e)}parseInformation(){let e=new W;e.append("(01)");let t=e.length(),r=this.getGeneralDecoder().extractNumericValueFromBitArray(e0.HEADER_SIZE,4);return e.append(r),this.encodeCompressedGtinWithoutAI(e,e0.HEADER_SIZE+4,t),this.getGeneralDecoder().decodeAllCodes(e,e0.HEADER_SIZE+44)}}e0.HEADER_SIZE=4;class e2 extends eJ{constructor(e){super(e)}parseInformation(){let e=new W;return this.getGeneralDecoder().decodeAllCodes(e,e2.HEADER_SIZE)}}e2.HEADER_SIZE=5;class e3 extends e1{constructor(e){super(e)}encodeCompressedWeight(e,t,r){let n=this.getGeneralDecoder().extractNumericValueFromBitArray(t,r);this.addWeightCode(e,n);let i=this.checkWeight(n),o=1e5;for(let t=0;t<5;++t)i/o==0&&e.append("0"),o/=10;e.append(i)}}class e4 extends e3{constructor(e){super(e)}parseInformation(){if(this.getInformation().getSize()!=e4.HEADER_SIZE+e3.GTIN_SIZE+e4.WEIGHT_SIZE)throw new X;let e=new W;return this.encodeCompressedGtin(e,e4.HEADER_SIZE),this.encodeCompressedWeight(e,e4.HEADER_SIZE+e3.GTIN_SIZE,e4.WEIGHT_SIZE),e.toString()}}e4.HEADER_SIZE=5,e4.WEIGHT_SIZE=15;class e8 extends e4{constructor(e){super(e)}addWeightCode(e,t){e.append("(3103)")}checkWeight(e){return e}}class e6 extends e4{constructor(e){super(e)}addWeightCode(e,t){t<1e4?e.append("(3202)"):e.append("(3203)")}checkWeight(e){return e<1e4?e:e-1e4}}class e5 extends e1{constructor(e){super(e)}parseInformation(){if(this.getInformation().getSize()<e5.HEADER_SIZE+e1.GTIN_SIZE)throw new X;let e=new W;this.encodeCompressedGtin(e,e5.HEADER_SIZE);let t=this.getGeneralDecoder().extractNumericValueFromBitArray(e5.HEADER_SIZE+e1.GTIN_SIZE,e5.LAST_DIGIT_SIZE);e.append("(392"),e.append(t),e.append(")");let r=this.getGeneralDecoder().decodeGeneralPurposeField(e5.HEADER_SIZE+e1.GTIN_SIZE+e5.LAST_DIGIT_SIZE,null);return e.append(r.getNewString()),e.toString()}}e5.HEADER_SIZE=8,e5.LAST_DIGIT_SIZE=2;class e7 extends e1{constructor(e){super(e)}parseInformation(){if(this.getInformation().getSize()<e7.HEADER_SIZE+e1.GTIN_SIZE)throw new X;let e=new W;this.encodeCompressedGtin(e,e7.HEADER_SIZE);let t=this.getGeneralDecoder().extractNumericValueFromBitArray(e7.HEADER_SIZE+e1.GTIN_SIZE,e7.LAST_DIGIT_SIZE);e.append("(393"),e.append(t),e.append(")");let r=this.getGeneralDecoder().extractNumericValueFromBitArray(e7.HEADER_SIZE+e1.GTIN_SIZE+e7.LAST_DIGIT_SIZE,e7.FIRST_THREE_DIGITS_SIZE);r/100==0&&e.append("0"),r/10==0&&e.append("0"),e.append(r);let n=this.getGeneralDecoder().decodeGeneralPurposeField(e7.HEADER_SIZE+e1.GTIN_SIZE+e7.LAST_DIGIT_SIZE+e7.FIRST_THREE_DIGITS_SIZE,null);return e.append(n.getNewString()),e.toString()}}e7.HEADER_SIZE=8,e7.LAST_DIGIT_SIZE=2,e7.FIRST_THREE_DIGITS_SIZE=10;class e9 extends e3{constructor(e,t,r){super(e),this.dateCode=r,this.firstAIdigits=t}parseInformation(){if(this.getInformation().getSize()!=e9.HEADER_SIZE+e9.GTIN_SIZE+e9.WEIGHT_SIZE+e9.DATE_SIZE)throw new X;let e=new W;return this.encodeCompressedGtin(e,e9.HEADER_SIZE),this.encodeCompressedWeight(e,e9.HEADER_SIZE+e9.GTIN_SIZE,e9.WEIGHT_SIZE),this.encodeCompressedDate(e,e9.HEADER_SIZE+e9.GTIN_SIZE+e9.WEIGHT_SIZE),e.toString()}encodeCompressedDate(e,t){let r=this.getGeneralDecoder().extractNumericValueFromBitArray(t,e9.DATE_SIZE);if(38400==r)return;e.append("("),e.append(this.dateCode),e.append(")");let n=r%32,i=(r/=32)%12+1,o=r/=12;o/10==0&&e.append("0"),e.append(o),i/10==0&&e.append("0"),e.append(i),n/10==0&&e.append("0"),e.append(n)}addWeightCode(e,t){e.append("("),e.append(this.firstAIdigits),e.append(t/1e5),e.append(")")}checkWeight(e){return e%1e5}}function te(e){try{if(e.get(1))return new e0(e);if(!e.get(2))return new e2(e);switch(e$.extractNumericValueFromBitArray(e,1,4)){case 4:return new e8(e);case 5:return new e6(e)}switch(e$.extractNumericValueFromBitArray(e,1,5)){case 12:return new e5(e);case 13:return new e7(e)}switch(e$.extractNumericValueFromBitArray(e,1,7)){case 56:return new e9(e,"310","11");case 57:return new e9(e,"320","11");case 58:return new e9(e,"310","13");case 59:return new e9(e,"320","13");case 60:return new e9(e,"310","15");case 61:return new e9(e,"320","15");case 62:return new e9(e,"310","17");case 63:return new e9(e,"320","17")}}catch(t){throw console.log(t),new eh("unknown decoder: "+e)}}e9.HEADER_SIZE=8,e9.WEIGHT_SIZE=20,e9.DATE_SIZE=16;class tt{constructor(e,t,r,n){this.leftchar=e,this.rightchar=t,this.finderpattern=r,this.maybeLast=n}mayBeLast(){return this.maybeLast}getLeftChar(){return this.leftchar}getRightChar(){return this.rightchar}getFinderPattern(){return this.finderpattern}mustBeLast(){return null==this.rightchar}toString(){return"[ "+this.leftchar+", "+this.rightchar+" : "+(null==this.finderpattern?"null":this.finderpattern.getValue())+" ]"}static equals(e,t){return e instanceof tt&&tt.equalsOrNull(e.leftchar,t.leftchar)&&tt.equalsOrNull(e.rightchar,t.rightchar)&&tt.equalsOrNull(e.finderpattern,t.finderpattern)}static equalsOrNull(e,t){return null===e?null===t:tt.equals(e,t)}hashCode(){return this.leftchar.getValue()^this.rightchar.getValue()^this.finderpattern.getValue()}}class tr{constructor(e,t,r){this.pairs=e,this.rowNumber=t,this.wasReversed=r}getPairs(){return this.pairs}getRowNumber(){return this.rowNumber}isReversed(){return this.wasReversed}isEquivalent(e){return this.checkEqualitity(this,e)}toString(){return"{ "+this.pairs+" }"}equals(e,t){return e instanceof tr&&this.checkEqualitity(e,t)&&e.wasReversed===t.wasReversed}checkEqualitity(e,t){let r;if(e&&t)return e.forEach((e,n)=>{t.forEach(t=>{e.getLeftChar().getValue()===t.getLeftChar().getValue()&&e.getRightChar().getValue()===t.getRightChar().getValue()&&e.getFinderPatter().getValue()===t.getFinderPatter().getValue()&&(r=!0)})}),r}}class tn extends ez{constructor(e){super(...arguments),this.pairs=Array(tn.MAX_PAIRS),this.rows=[],this.startEnd=[2],this.verbose=!0===e}decodeRow(e,t,r){this.pairs.length=0,this.startFromEven=!1;try{return tn.constructResult(this.decodeRow2pairs(e,t))}catch(e){this.verbose&&console.log(e)}return this.pairs.length=0,this.startFromEven=!0,tn.constructResult(this.decodeRow2pairs(e,t))}reset(){this.pairs.length=0,this.rows.length=0}decodeRow2pairs(e,t){let r,n=!1;for(;!n;)try{this.pairs.push(this.retrieveNextPair(t,this.pairs,e))}catch(e){if(e instanceof X){if(!this.pairs.length)throw new X;n=!0}}if(this.checkChecksum())return this.pairs;if(r=!!this.rows.length,this.storeRow(e,!1),r){let e=this.checkRowsBoolean(!1);if(null!=e||null!=(e=this.checkRowsBoolean(!0)))return e}throw new X}checkRowsBoolean(e){if(this.rows.length>25)return this.rows.length=0,null;this.pairs.length=0,e&&(this.rows=this.rows.reverse());let t=null;try{t=this.checkRows([],0)}catch(e){this.verbose&&console.log(e)}return e&&(this.rows=this.rows.reverse()),t}checkRows(e,t){for(let r=t;r<this.rows.length;r++){let t=this.rows[r];for(let t of(this.pairs.length=0,e))this.pairs.push(t.getPairs());if(this.pairs.push(t.getPairs()),!tn.isValidSequence(this.pairs))continue;if(this.checkChecksum())return this.pairs;let n=Array(e);n.push(t);try{return this.checkRows(n,r+1)}catch(e){this.verbose&&console.log(e)}}throw new X}static isValidSequence(e){for(let t of tn.FINDER_PATTERN_SEQUENCES){if(e.length>t.length)continue;let r=!0;for(let n=0;n<e.length;n++)if(e[n].getFinderPattern().getValue()!=t[n]){r=!1;break}if(r)return!0}return!1}storeRow(e,t){let r=0,n=!1,i=!1;for(;r<this.rows.length;){let t=this.rows[r];if(t.getRowNumber()>e){i=t.isEquivalent(this.pairs);break}n=t.isEquivalent(this.pairs),r++}i||n||tn.isPartialRow(this.pairs,this.rows)||(this.rows.push(r,new tr(this.pairs,e,t)),this.removePartialRows(this.pairs,this.rows))}removePartialRows(e,t){for(let r of t)if(r.getPairs().length!==e.length){for(let t of r.getPairs())for(let r of e)if(tt.equals(t,r))break}}static isPartialRow(e,t){for(let r of t){let t=!0;for(let n of e){let e=!1;for(let t of r.getPairs())if(n.equals(t)){e=!0;break}if(!e){t=!1;break}}if(t)return!0}return!1}getRows(){return this.rows}static constructResult(e){let t=te(eW.buildBitArray(e)).parseInformation(),r=e[0].getFinderPattern().getResultPoints(),n=e[e.length-1].getFinderPattern().getResultPoints();return new er(t,null,null,[r[0],r[1],n[0],n[1]],en.RSS_EXPANDED,null)}checkChecksum(){let e=this.pairs.get(0),t=e.getLeftChar(),r=e.getRightChar();if(null==r)return!1;let n=r.getChecksumPortion(),i=2;for(let e=1;e<this.pairs.size();++e){let t=this.pairs.get(e);n+=t.getLeftChar().getChecksumPortion(),i++;let r=t.getRightChar();null!=r&&(n+=r.getChecksumPortion(),i++)}return 211*(i-4)+(n%=211)==t.getValue()}static getNextSecondBar(e,t){let r;return e.get(t)?(r=e.getNextUnset(t),r=e.getNextSet(r)):(r=e.getNextSet(t),r=e.getNextUnset(r)),r}retrieveNextPair(e,t,r){let n,i,o=t.length%2==0;this.startFromEven&&(o=!o);let a=!0,s=-1;do this.findNextPair(e,t,s),null==(n=this.parseFoundFinderPattern(e,r,o))?s=tn.getNextSecondBar(e,this.startEnd[0]):a=!1;while(a);let l=this.decodeDataCharacter(e,n,o,!0);if(!this.isEmptyPair(t)&&t[t.length-1].mustBeLast())throw new X;try{i=this.decodeDataCharacter(e,n,o,!1)}catch(e){i=null,this.verbose&&console.log(e)}return new tt(l,i,n,!0)}isEmptyPair(e){return 0===e.length}findNextPair(e,t,r){let n,i=this.getDecodeFinderCounters();i[0]=0,i[1]=0,i[2]=0,i[3]=0;let o=e.getSize();n=r>=0?r:this.isEmptyPair(t)?0:t[t.length-1].getFinderPattern().getStartEnd()[1];let a=t.length%2!=0;this.startFromEven&&(a=!a);let s=!1;for(;n<o&&(s=!e.get(n));)n++;let l=0,c=n;for(let t=n;t<o;t++)if(e.get(t)!=s)i[l]++;else{if(3==l){if(a&&tn.reverseCounters(i),tn.isFinderPattern(i)){this.startEnd[0]=c,this.startEnd[1]=t;return}a&&tn.reverseCounters(i),c+=i[0]+i[1],i[0]=i[2],i[1]=i[3],i[2]=0,i[3]=0,l--}else l++;i[l]=1,s=!s}throw new X}static reverseCounters(e){let t=e.length;for(let r=0;r<t/2;++r){let n=e[r];e[r]=e[t-r-1],e[t-r-1]=n}}parseFoundFinderPattern(e,t,r){let n,i,o,a;if(r){let t=this.startEnd[0]-1;for(;t>=0&&!e.get(t);)t--;t++,n=this.startEnd[0]-t,i=t,o=this.startEnd[1]}else i=this.startEnd[0],n=(o=e.getNextUnset(this.startEnd[1]+1))-this.startEnd[1];let s=this.getDecodeFinderCounters();P.arraycopy(s,0,s,1,s.length-1),s[0]=n;try{a=this.parseFinderValue(s,tn.FINDER_PATTERNS)}catch(e){return null}return new ej(a,[i,o],i,o,t)}decodeDataCharacter(e,t,r,n){let i=this.getDataCharacterCounters();for(let e=0;e<i.length;e++)i[e]=0;if(n)tn.recordPatternInReverse(e,t.getStartEnd()[0],i);else{tn.recordPattern(e,t.getStartEnd()[1],i);for(let e=0,t=i.length-1;e<t;e++,t--){let r=i[e];i[e]=i[t],i[t]=r}}let o=eg.sum(new Int32Array(i))/17,a=(t.getStartEnd()[1]-t.getStartEnd()[0])/15;if(Math.abs(o-a)/a>.3)throw new X;let s=this.getOddCounts(),l=this.getEvenCounts(),c=this.getOddRoundingErrors(),u=this.getEvenRoundingErrors();for(let e=0;e<i.length;e++){let t=+i[e]/o,r=t+.5;if(r<1){if(t<.3)throw new X;r=1}else if(r>8){if(t>8.7)throw new X;r=8}let n=e/2;(1&e)==0?(s[n]=r,c[n]=t-r):(l[n]=r,u[n]=t-r)}this.adjustOddEvenCounts(17);let h=4*t.getValue()+2*!r+ +!n-1,d=0,f=0;for(let e=s.length-1;e>=0;e--){if(tn.isNotA1left(t,r,n)){let t=tn.WEIGHTS[h][2*e];f+=s[e]*t}d+=s[e]}let g=0;for(let e=l.length-1;e>=0;e--)if(tn.isNotA1left(t,r,n)){let t=tn.WEIGHTS[h][2*e+1];g+=l[e]*t}let p=f+g;if((1&d)!=0||d>13||d<4)throw new X;let m=(13-d)/2,w=tn.SYMBOL_WIDEST[m],C=eG.getRSSvalue(s,w,!0),E=eG.getRSSvalue(l,9-w,!1);return new eV(C*tn.EVEN_TOTAL_SUBSET[m]+E+tn.GSUM[m],p)}static isNotA1left(e,t,r){return!(0==e.getValue()&&t&&r)}adjustOddEvenCounts(e){let t=eg.sum(new Int32Array(this.getOddCounts())),r=eg.sum(new Int32Array(this.getEvenCounts())),n=!1,i=!1;t>13?i=!0:t<4&&(n=!0);let o=!1,a=!1;r>13?a=!0:r<4&&(o=!0);let s=t+r-e,l=(1&t)==1,c=(1&r)==0;if(1==s)if(l){if(c)throw new X;i=!0}else{if(!c)throw new X;a=!0}else if(-1==s)if(l){if(c)throw new X;n=!0}else{if(!c)throw new X;o=!0}else if(0==s){if(l){if(!c)throw new X;t<r?(n=!0,a=!0):(i=!0,o=!0)}else if(c)throw new X}else throw new X;if(n){if(i)throw new X;tn.increment(this.getOddCounts(),this.getOddRoundingErrors())}if(i&&tn.decrement(this.getOddCounts(),this.getOddRoundingErrors()),o){if(a)throw new X;tn.increment(this.getEvenCounts(),this.getOddRoundingErrors())}a&&tn.decrement(this.getEvenCounts(),this.getEvenRoundingErrors())}}tn.SYMBOL_WIDEST=[7,5,4,3,1],tn.EVEN_TOTAL_SUBSET=[4,20,52,104,204],tn.GSUM=[0,348,1388,2948,3988],tn.FINDER_PATTERNS=[Int32Array.from([1,8,4,1]),Int32Array.from([3,6,4,1]),Int32Array.from([3,4,6,1]),Int32Array.from([3,2,8,1]),Int32Array.from([2,6,5,1]),Int32Array.from([2,2,9,1])],tn.WEIGHTS=[[1,3,9,27,81,32,96,77],[20,60,180,118,143,7,21,63],[189,145,13,39,117,140,209,205],[193,157,49,147,19,57,171,91],[62,186,136,197,169,85,44,132],[185,133,188,142,4,12,36,108],[113,128,173,97,80,29,87,50],[150,28,84,41,123,158,52,156],[46,138,203,187,139,206,196,166],[76,17,51,153,37,111,122,155],[43,129,176,106,107,110,119,146],[16,48,144,10,30,90,59,177],[109,116,137,200,178,112,125,164],[70,210,208,202,184,130,179,115],[134,191,151,31,93,68,204,190],[148,22,66,198,172,94,71,2],[6,18,54,162,64,192,154,40],[120,149,25,75,14,42,126,167],[79,26,78,23,69,207,199,175],[103,98,83,38,114,131,182,124],[161,61,183,127,170,88,53,159],[55,165,73,8,24,72,5,15],[45,135,194,160,58,174,100,89]],tn.FINDER_PAT_A=0,tn.FINDER_PAT_B=1,tn.FINDER_PAT_C=2,tn.FINDER_PAT_D=3,tn.FINDER_PAT_E=4,tn.FINDER_PAT_F=5,tn.FINDER_PATTERN_SEQUENCES=[[tn.FINDER_PAT_A,tn.FINDER_PAT_A],[tn.FINDER_PAT_A,tn.FINDER_PAT_B,tn.FINDER_PAT_B],[tn.FINDER_PAT_A,tn.FINDER_PAT_C,tn.FINDER_PAT_B,tn.FINDER_PAT_D],[tn.FINDER_PAT_A,tn.FINDER_PAT_E,tn.FINDER_PAT_B,tn.FINDER_PAT_D,tn.FINDER_PAT_C],[tn.FINDER_PAT_A,tn.FINDER_PAT_E,tn.FINDER_PAT_B,tn.FINDER_PAT_D,tn.FINDER_PAT_D,tn.FINDER_PAT_F],[tn.FINDER_PAT_A,tn.FINDER_PAT_E,tn.FINDER_PAT_B,tn.FINDER_PAT_D,tn.FINDER_PAT_E,tn.FINDER_PAT_F,tn.FINDER_PAT_F],[tn.FINDER_PAT_A,tn.FINDER_PAT_A,tn.FINDER_PAT_B,tn.FINDER_PAT_B,tn.FINDER_PAT_C,tn.FINDER_PAT_C,tn.FINDER_PAT_D,tn.FINDER_PAT_D],[tn.FINDER_PAT_A,tn.FINDER_PAT_A,tn.FINDER_PAT_B,tn.FINDER_PAT_B,tn.FINDER_PAT_C,tn.FINDER_PAT_C,tn.FINDER_PAT_D,tn.FINDER_PAT_E,tn.FINDER_PAT_E],[tn.FINDER_PAT_A,tn.FINDER_PAT_A,tn.FINDER_PAT_B,tn.FINDER_PAT_B,tn.FINDER_PAT_C,tn.FINDER_PAT_C,tn.FINDER_PAT_D,tn.FINDER_PAT_E,tn.FINDER_PAT_F,tn.FINDER_PAT_F],[tn.FINDER_PAT_A,tn.FINDER_PAT_A,tn.FINDER_PAT_B,tn.FINDER_PAT_B,tn.FINDER_PAT_C,tn.FINDER_PAT_D,tn.FINDER_PAT_D,tn.FINDER_PAT_E,tn.FINDER_PAT_E,tn.FINDER_PAT_F,tn.FINDER_PAT_F]],tn.MAX_PAIRS=11;class ti extends eV{constructor(e,t,r){super(e,t),this.count=0,this.finderPattern=r}getFinderPattern(){return this.finderPattern}getCount(){return this.count}incrementCount(){this.count++}}class to extends ez{constructor(){super(...arguments),this.possibleLeftPairs=[],this.possibleRightPairs=[]}decodeRow(e,t,r){let n=this.decodePair(t,!1,e,r);to.addOrTally(this.possibleLeftPairs,n),t.reverse();let i=this.decodePair(t,!0,e,r);for(let e of(to.addOrTally(this.possibleRightPairs,i),t.reverse(),this.possibleLeftPairs))if(e.getCount()>1){for(let t of this.possibleRightPairs)if(t.getCount()>1&&to.checkChecksum(e,t))return to.constructResult(e,t)}throw new X}static addOrTally(e,t){if(null==t)return;let r=!1;for(let n of e)if(n.getValue()===t.getValue()){n.incrementCount(),r=!0;break}r||e.push(t)}reset(){this.possibleLeftPairs.length=0,this.possibleRightPairs.length=0}static constructResult(e,t){let r=new String(4537077*e.getValue()+t.getValue()).toString(),n=new W;for(let e=13-r.length;e>0;e--)n.append("0");n.append(r);let i=0;for(let e=0;e<13;e++){let t=n.charAt(e).charCodeAt(0)-48;i+=(1&e)==0?3*t:t}10==(i=10-i%10)&&(i=0),n.append(i.toString());let o=e.getFinderPattern().getResultPoints(),a=t.getFinderPattern().getResultPoints();return new er(n.toString(),null,0,[o[0],o[1],a[0],a[1]],en.RSS_14,new Date().getTime())}static checkChecksum(e,t){let r=(e.getChecksumPortion()+16*t.getChecksumPortion())%79,n=9*e.getFinderPattern().getValue()+t.getFinderPattern().getValue();return n>72&&n--,n>8&&n--,r===n}decodePair(e,t,r,n){try{let i=this.findFinderPattern(e,t),o=this.parseFoundFinderPattern(e,r,t,i),a=null==n?null:n.get(U.NEED_RESULT_POINT_CALLBACK);if(null!=a){let n=(i[0]+i[1])/2;t&&(n=e.getSize()-1-n),a.foundPossibleResultPoint(new em(n,r))}let s=this.decodeDataCharacter(e,o,!0),l=this.decodeDataCharacter(e,o,!1);return new ti(1597*s.getValue()+l.getValue(),s.getChecksumPortion()+4*l.getChecksumPortion(),o)}catch(e){return null}}decodeDataCharacter(e,t,r){let n=this.getDataCharacterCounters();for(let e=0;e<n.length;e++)n[e]=0;if(r)eN.recordPatternInReverse(e,t.getStartEnd()[0],n);else{eN.recordPattern(e,t.getStartEnd()[1]+1,n);for(let e=0,t=n.length-1;e<t;e++,t--){let r=n[e];n[e]=n[t],n[t]=r}}let i=r?16:15,o=eg.sum(new Int32Array(n))/i,a=this.getOddCounts(),s=this.getEvenCounts(),l=this.getOddRoundingErrors(),c=this.getEvenRoundingErrors();for(let e=0;e<n.length;e++){let t=n[e]/o,r=Math.floor(t+.5);r<1?r=1:r>8&&(r=8);let i=Math.floor(e/2);(1&e)==0?(a[i]=r,l[i]=t-r):(s[i]=r,c[i]=t-r)}this.adjustOddEvenCounts(r,i);let u=0,h=0;for(let e=a.length-1;e>=0;e--)h*=9,h+=a[e],u+=a[e];let d=0,f=0;for(let e=s.length-1;e>=0;e--)d*=9,d+=s[e],f+=s[e];let g=h+3*d;if(r){if((1&u)!=0||u>12||u<4)throw new X;let e=(12-u)/2,t=to.OUTSIDE_ODD_WIDEST[e],r=eG.getRSSvalue(a,t,!1),n=eG.getRSSvalue(s,9-t,!0);return new eV(r*to.OUTSIDE_EVEN_TOTAL_SUBSET[e]+n+to.OUTSIDE_GSUM[e],g)}{if((1&f)!=0||f>10||f<4)throw new X;let e=(10-f)/2,t=to.INSIDE_ODD_WIDEST[e],r=eG.getRSSvalue(a,t,!0);return new eV(eG.getRSSvalue(s,9-t,!1)*to.INSIDE_ODD_TOTAL_SUBSET[e]+r+to.INSIDE_GSUM[e],g)}}findFinderPattern(e,t){let r=this.getDecodeFinderCounters();r[0]=0,r[1]=0,r[2]=0,r[3]=0;let n=e.getSize(),i=!1,o=0;for(;o<n&&t!==(i=!e.get(o));)o++;let a=0,s=o;for(let t=o;t<n;t++)if(e.get(t)!==i)r[a]++;else{if(3===a){if(ez.isFinderPattern(r))return[s,t];s+=r[0]+r[1],r[0]=r[2],r[1]=r[3],r[2]=0,r[3]=0,a--}else a++;r[a]=1,i=!i}throw new X}parseFoundFinderPattern(e,t,r,n){let i=e.get(n[0]),o=n[0]-1;for(;o>=0&&i!==e.get(o);)o--;o++;let a=n[0]-o,s=this.getDecodeFinderCounters(),l=new Int32Array(s.length);P.arraycopy(s,0,l,1,s.length-1),l[0]=a;let c=this.parseFinderValue(l,to.FINDER_PATTERNS),u=o,h=n[1];return r&&(u=e.getSize()-1-u,h=e.getSize()-1-h),new ej(c,[o,n[1]],u,h,t)}adjustOddEvenCounts(e,t){let r=eg.sum(new Int32Array(this.getOddCounts())),n=eg.sum(new Int32Array(this.getEvenCounts())),i=!1,o=!1,a=!1,s=!1;e?(r>12?o=!0:r<4&&(i=!0),n>12?s=!0:n<4&&(a=!0)):(r>11?o=!0:r<5&&(i=!0),n>10?s=!0:n<4&&(a=!0));let l=r+n-t,c=(1&r)==+!!e,u=(1&n)==1;if(1===l)if(c){if(u)throw new X;o=!0}else{if(!u)throw new X;s=!0}else if(-1===l)if(c){if(u)throw new X;i=!0}else{if(!u)throw new X;a=!0}else if(0===l){if(c){if(!u)throw new X;r<n?(i=!0,s=!0):(o=!0,a=!0)}else if(u)throw new X}else throw new X;if(i){if(o)throw new X;ez.increment(this.getOddCounts(),this.getOddRoundingErrors())}if(o&&ez.decrement(this.getOddCounts(),this.getOddRoundingErrors()),a){if(s)throw new X;ez.increment(this.getEvenCounts(),this.getOddRoundingErrors())}s&&ez.decrement(this.getEvenCounts(),this.getEvenRoundingErrors())}}to.OUTSIDE_EVEN_TOTAL_SUBSET=[1,10,34,70,126],to.INSIDE_ODD_TOTAL_SUBSET=[4,20,48,81],to.OUTSIDE_GSUM=[0,161,961,2015,2715],to.INSIDE_GSUM=[0,336,1036,1516],to.OUTSIDE_ODD_WIDEST=[8,6,4,3,1],to.INSIDE_ODD_WIDEST=[2,4,6,8],to.FINDER_PATTERNS=[Int32Array.from([3,8,2,1]),Int32Array.from([3,5,5,1]),Int32Array.from([3,3,7,1]),Int32Array.from([3,1,9,1]),Int32Array.from([2,7,4,1]),Int32Array.from([2,5,6,1]),Int32Array.from([2,3,8,1]),Int32Array.from([1,5,7,1]),Int32Array.from([1,3,9,1])];class ta extends eN{constructor(e,t){super(),this.readers=[],this.verbose=!0===t;let r=e?e.get(U.POSSIBLE_FORMATS):null,n=e&&void 0!==e.get(U.ASSUME_CODE_39_CHECK_DIGIT);r?((r.includes(en.EAN_13)||r.includes(en.UPC_A)||r.includes(en.EAN_8)||r.includes(en.UPC_E))&&this.readers.push(new eH(e)),r.includes(en.CODE_39)&&this.readers.push(new eD(n)),r.includes(en.CODE_128)&&this.readers.push(new eM),r.includes(en.ITF)&&this.readers.push(new eO),r.includes(en.RSS_14)&&this.readers.push(new to),r.includes(en.RSS_EXPANDED)&&this.readers.push(new tn(this.verbose))):(this.readers.push(new eH(e)),this.readers.push(new eD),this.readers.push(new eH(e)),this.readers.push(new eM),this.readers.push(new eO),this.readers.push(new to),this.readers.push(new tn(this.verbose)))}decodeRow(e,t,r){for(let n=0;n<this.readers.length;n++)try{return this.readers[n].decodeRow(e,t,r)}catch(e){}throw new X}reset(){this.readers.forEach(e=>e.reset())}}class ts{constructor(e,t,r){this.ecCodewords=e,this.ecBlocks=[t],r&&this.ecBlocks.push(r)}getECCodewords(){return this.ecCodewords}getECBlocks(){return this.ecBlocks}}class tl{constructor(e,t){this.count=e,this.dataCodewords=t}getCount(){return this.count}getDataCodewords(){return this.dataCodewords}}class tc{constructor(e,t,r,n,i,o){this.versionNumber=e,this.symbolSizeRows=t,this.symbolSizeColumns=r,this.dataRegionSizeRows=n,this.dataRegionSizeColumns=i,this.ecBlocks=o;let a=0,s=o.getECCodewords();for(let e of o.getECBlocks())a+=e.getCount()*(e.getDataCodewords()+s);this.totalCodewords=a}getVersionNumber(){return this.versionNumber}getSymbolSizeRows(){return this.symbolSizeRows}getSymbolSizeColumns(){return this.symbolSizeColumns}getDataRegionSizeRows(){return this.dataRegionSizeRows}getDataRegionSizeColumns(){return this.dataRegionSizeColumns}getTotalCodewords(){return this.totalCodewords}getECBlocks(){return this.ecBlocks}static getVersionForDimensions(e,t){if((1&e)!=0||(1&t)!=0)throw new H;for(let r of tc.VERSIONS)if(r.symbolSizeRows===e&&r.symbolSizeColumns===t)return r;throw new H}toString(){return""+this.versionNumber}static buildVersions(){return[new tc(1,10,10,8,8,new ts(5,new tl(1,3))),new tc(2,12,12,10,10,new ts(7,new tl(1,5))),new tc(3,14,14,12,12,new ts(10,new tl(1,8))),new tc(4,16,16,14,14,new ts(12,new tl(1,12))),new tc(5,18,18,16,16,new ts(14,new tl(1,18))),new tc(6,20,20,18,18,new ts(18,new tl(1,22))),new tc(7,22,22,20,20,new ts(20,new tl(1,30))),new tc(8,24,24,22,22,new ts(24,new tl(1,36))),new tc(9,26,26,24,24,new ts(28,new tl(1,44))),new tc(10,32,32,14,14,new ts(36,new tl(1,62))),new tc(11,36,36,16,16,new ts(42,new tl(1,86))),new tc(12,40,40,18,18,new ts(48,new tl(1,114))),new tc(13,44,44,20,20,new ts(56,new tl(1,144))),new tc(14,48,48,22,22,new ts(68,new tl(1,174))),new tc(15,52,52,24,24,new ts(42,new tl(2,102))),new tc(16,64,64,14,14,new ts(56,new tl(2,140))),new tc(17,72,72,16,16,new ts(36,new tl(4,92))),new tc(18,80,80,18,18,new ts(48,new tl(4,114))),new tc(19,88,88,20,20,new ts(56,new tl(4,144))),new tc(20,96,96,22,22,new ts(68,new tl(4,174))),new tc(21,104,104,24,24,new ts(56,new tl(6,136))),new tc(22,120,120,18,18,new ts(68,new tl(6,175))),new tc(23,132,132,20,20,new ts(62,new tl(8,163))),new tc(24,144,144,22,22,new ts(62,new tl(8,156),new tl(2,155))),new tc(25,8,18,6,16,new ts(7,new tl(1,5))),new tc(26,8,32,6,14,new ts(11,new tl(1,10))),new tc(27,12,26,10,24,new ts(14,new tl(1,16))),new tc(28,12,36,10,16,new ts(18,new tl(1,22))),new tc(29,16,36,14,16,new ts(24,new tl(1,32))),new tc(30,16,48,14,22,new ts(28,new tl(1,49)))]}}tc.VERSIONS=tc.buildVersions();class tu{constructor(e){let t=e.getHeight();if(t<8||t>144||(1&t)!=0)throw new H;this.version=tu.readVersion(e),this.mappingBitMatrix=this.extractDataRegion(e),this.readMappingMatrix=new Y(this.mappingBitMatrix.getWidth(),this.mappingBitMatrix.getHeight())}getVersion(){return this.version}static readVersion(e){let t=e.getHeight(),r=e.getWidth();return tc.getVersionForDimensions(t,r)}readCodewords(){let e=new Int8Array(this.version.getTotalCodewords()),t=0,r=4,n=0,i=this.mappingBitMatrix.getHeight(),o=this.mappingBitMatrix.getWidth(),a=!1,s=!1,l=!1,c=!1;do if(r!==i||0!==n||a)if(r!==i-2||0!==n||(3&o)==0||s)if(r!==i+4||2!==n||(7&o)!=0||l)if(r!==i-2||0!==n||(7&o)!=4||c){do r<i&&n>=0&&!this.readMappingMatrix.get(n,r)&&(e[t++]=255&this.readUtah(r,n,i,o)),r-=2,n+=2;while(r>=0&&n<o);r+=1,n+=3;do r>=0&&n<o&&!this.readMappingMatrix.get(n,r)&&(e[t++]=255&this.readUtah(r,n,i,o)),r+=2,n-=2;while(r<i&&n>=0);r+=3,n+=1}else e[t++]=255&this.readCorner4(i,o),r-=2,n+=2,c=!0;else e[t++]=255&this.readCorner3(i,o),r-=2,n+=2,l=!0;else e[t++]=255&this.readCorner2(i,o),r-=2,n+=2,s=!0;else e[t++]=255&this.readCorner1(i,o),r-=2,n+=2,a=!0;while(r<i||n<o);if(t!==this.version.getTotalCodewords())throw new H;return e}readModule(e,t,r,n){return e<0&&(e+=r,t+=4-(r+4&7)),t<0&&(t+=n,e+=4-(n+4&7)),this.readMappingMatrix.set(t,e),this.mappingBitMatrix.get(t,e)}readUtah(e,t,r,n){let i=0;return this.readModule(e-2,t-2,r,n)&&(i|=1),i<<=1,this.readModule(e-2,t-1,r,n)&&(i|=1),i<<=1,this.readModule(e-1,t-2,r,n)&&(i|=1),i<<=1,this.readModule(e-1,t-1,r,n)&&(i|=1),i<<=1,this.readModule(e-1,t,r,n)&&(i|=1),i<<=1,this.readModule(e,t-2,r,n)&&(i|=1),i<<=1,this.readModule(e,t-1,r,n)&&(i|=1),i<<=1,this.readModule(e,t,r,n)&&(i|=1),i}readCorner1(e,t){let r=0;return this.readModule(e-1,0,e,t)&&(r|=1),r<<=1,this.readModule(e-1,1,e,t)&&(r|=1),r<<=1,this.readModule(e-1,2,e,t)&&(r|=1),r<<=1,this.readModule(0,t-2,e,t)&&(r|=1),r<<=1,this.readModule(0,t-1,e,t)&&(r|=1),r<<=1,this.readModule(1,t-1,e,t)&&(r|=1),r<<=1,this.readModule(2,t-1,e,t)&&(r|=1),r<<=1,this.readModule(3,t-1,e,t)&&(r|=1),r}readCorner2(e,t){let r=0;return this.readModule(e-3,0,e,t)&&(r|=1),r<<=1,this.readModule(e-2,0,e,t)&&(r|=1),r<<=1,this.readModule(e-1,0,e,t)&&(r|=1),r<<=1,this.readModule(0,t-4,e,t)&&(r|=1),r<<=1,this.readModule(0,t-3,e,t)&&(r|=1),r<<=1,this.readModule(0,t-2,e,t)&&(r|=1),r<<=1,this.readModule(0,t-1,e,t)&&(r|=1),r<<=1,this.readModule(1,t-1,e,t)&&(r|=1),r}readCorner3(e,t){let r=0;return this.readModule(e-1,0,e,t)&&(r|=1),r<<=1,this.readModule(e-1,t-1,e,t)&&(r|=1),r<<=1,this.readModule(0,t-3,e,t)&&(r|=1),r<<=1,this.readModule(0,t-2,e,t)&&(r|=1),r<<=1,this.readModule(0,t-1,e,t)&&(r|=1),r<<=1,this.readModule(1,t-3,e,t)&&(r|=1),r<<=1,this.readModule(1,t-2,e,t)&&(r|=1),r<<=1,this.readModule(1,t-1,e,t)&&(r|=1),r}readCorner4(e,t){let r=0;return this.readModule(e-3,0,e,t)&&(r|=1),r<<=1,this.readModule(e-2,0,e,t)&&(r|=1),r<<=1,this.readModule(e-1,0,e,t)&&(r|=1),r<<=1,this.readModule(0,t-2,e,t)&&(r|=1),r<<=1,this.readModule(0,t-1,e,t)&&(r|=1),r<<=1,this.readModule(1,t-1,e,t)&&(r|=1),r<<=1,this.readModule(2,t-1,e,t)&&(r|=1),r<<=1,this.readModule(3,t-1,e,t)&&(r|=1),r}extractDataRegion(e){let t=this.version.getSymbolSizeRows(),r=this.version.getSymbolSizeColumns();if(e.getHeight()!==t)throw new D("Dimension of bitMatrix must match the version size");let n=this.version.getDataRegionSizeRows(),i=this.version.getDataRegionSizeColumns(),o=t/n|0,a=r/i|0,s=new Y(a*i,o*n);for(let t=0;t<o;++t){let r=t*n;for(let o=0;o<a;++o){let a=o*i;for(let l=0;l<n;++l){let c=t*(n+2)+1+l,u=r+l;for(let t=0;t<i;++t){let r=o*(i+2)+1+t;if(e.get(r,c)){let e=a+t;s.set(e,u)}}}}}return s}}class th{constructor(e,t){this.numDataCodewords=e,this.codewords=t}static getDataBlocks(e,t){let r=t.getECBlocks(),n=0,i=r.getECBlocks();for(let e of i)n+=e.getCount();let o=Array(n),a=0;for(let e of i)for(let t=0;t<e.getCount();t++){let t=e.getDataCodewords(),n=r.getECCodewords()+t;o[a++]=new th(t,new Uint8Array(n))}let s=o[0].codewords.length-r.getECCodewords(),l=s-1,c=0;for(let t=0;t<l;t++)for(let r=0;r<a;r++)o[r].codewords[t]=e[c++];let u=24===t.getVersionNumber(),h=u?8:a;for(let t=0;t<h;t++)o[t].codewords[s-1]=e[c++];let d=o[0].codewords.length;for(let t=s;t<d;t++)for(let r=0;r<a;r++){let n=u?(r+8)%a:r,i=u&&n>7?t-1:t;o[n].codewords[i]=e[c++]}if(c!==e.length)throw new D;return o}getNumDataCodewords(){return this.numDataCodewords}getCodewords(){return this.codewords}}class td{constructor(e){this.bytes=e,this.byteOffset=0,this.bitOffset=0}getBitOffset(){return this.bitOffset}getByteOffset(){return this.byteOffset}readBits(e){if(e<1||e>32||e>this.available())throw new D(""+e);let t=0,r=this.bitOffset,n=this.byteOffset,i=this.bytes;if(r>0){let o=8-r,a=e<o?e:o,s=o-a;t=(i[n]&255>>8-a<<s)>>s,e-=a,8===(r+=a)&&(r=0,n++)}if(e>0){for(;e>=8;)t=t<<8|255&i[n],n++,e-=8;if(e>0){let o=8-e;t=t<<e|(i[n]&255>>o<<o)>>o,r+=e}}return this.bitOffset=r,this.byteOffset=n,t}available(){return 8*(this.bytes.length-this.byteOffset)-this.bitOffset}}(l=E||(E={}))[l.PAD_ENCODE=0]="PAD_ENCODE",l[l.ASCII_ENCODE=1]="ASCII_ENCODE",l[l.C40_ENCODE=2]="C40_ENCODE",l[l.TEXT_ENCODE=3]="TEXT_ENCODE",l[l.ANSIX12_ENCODE=4]="ANSIX12_ENCODE",l[l.EDIFACT_ENCODE=5]="EDIFACT_ENCODE",l[l.BASE256_ENCODE=6]="BASE256_ENCODE";class tf{static decode(e){let t=new td(e),r=new W,n=new W,i=[],o=E.ASCII_ENCODE;do if(o===E.ASCII_ENCODE)o=this.decodeAsciiSegment(t,r,n);else{switch(o){case E.C40_ENCODE:this.decodeC40Segment(t,r);break;case E.TEXT_ENCODE:this.decodeTextSegment(t,r);break;case E.ANSIX12_ENCODE:this.decodeAnsiX12Segment(t,r);break;case E.EDIFACT_ENCODE:this.decodeEdifactSegment(t,r);break;case E.BASE256_ENCODE:this.decodeBase256Segment(t,r,i);break;default:throw new H}o=E.ASCII_ENCODE}while(o!==E.PAD_ENCODE&&t.available()>0);return n.length()>0&&r.append(n.toString()),new eo(e,r.toString(),0===i.length?null:i,null)}static decodeAsciiSegment(e,t,r){let n=!1;do{let i=e.readBits(8);if(0===i)throw new H;if(i<=128){n&&(i+=128),t.append(String.fromCharCode(i-1));break}if(129===i)return E.PAD_ENCODE;else if(i<=229){let e=i-130;e<10&&t.append("0"),t.append(""+e)}else switch(i){case 230:return E.C40_ENCODE;case 231:return E.BASE256_ENCODE;case 232:t.append("\x1d");break;case 233:case 234:case 241:break;case 235:n=!0;break;case 236:t.append("[)>\x1e05\x1d"),r.insert(0,"\x1e\x04");break;case 237:t.append("[)>\x1e06\x1d"),r.insert(0,"\x1e\x04");break;case 238:return E.ANSIX12_ENCODE;case 239:return E.TEXT_ENCODE;case 240:return E.EDIFACT_ENCODE;default:if(254!==i||0!==e.available())throw new H}}while(e.available()>0);return E.ASCII_ENCODE}static decodeC40Segment(e,t){let r=!1,n=[],i=0;do{if(8===e.available())return;let o=e.readBits(8);if(254===o)return;this.parseTwoBytes(o,e.readBits(8),n);for(let e=0;e<3;e++){let o=n[e];switch(i){case 0:if(o<3)i=o+1;else if(o<this.C40_BASIC_SET_CHARS.length){let e=this.C40_BASIC_SET_CHARS[o];r?(t.append(String.fromCharCode(e.charCodeAt(0)+128)),r=!1):t.append(e)}else throw new H;break;case 1:r?(t.append(String.fromCharCode(o+128)),r=!1):t.append(String.fromCharCode(o)),i=0;break;case 2:if(o<this.C40_SHIFT2_SET_CHARS.length){let e=this.C40_SHIFT2_SET_CHARS[o];r?(t.append(String.fromCharCode(e.charCodeAt(0)+128)),r=!1):t.append(e)}else switch(o){case 27:t.append("\x1d");break;case 30:r=!0;break;default:throw new H}i=0;break;case 3:r?(t.append(String.fromCharCode(o+224)),r=!1):t.append(String.fromCharCode(o+96)),i=0;break;default:throw new H}}}while(e.available()>0)}static decodeTextSegment(e,t){let r=!1,n=[],i=0;do{if(8===e.available())return;let o=e.readBits(8);if(254===o)return;this.parseTwoBytes(o,e.readBits(8),n);for(let e=0;e<3;e++){let o=n[e];switch(i){case 0:if(o<3)i=o+1;else if(o<this.TEXT_BASIC_SET_CHARS.length){let e=this.TEXT_BASIC_SET_CHARS[o];r?(t.append(String.fromCharCode(e.charCodeAt(0)+128)),r=!1):t.append(e)}else throw new H;break;case 1:r?(t.append(String.fromCharCode(o+128)),r=!1):t.append(String.fromCharCode(o)),i=0;break;case 2:if(o<this.TEXT_SHIFT2_SET_CHARS.length){let e=this.TEXT_SHIFT2_SET_CHARS[o];r?(t.append(String.fromCharCode(e.charCodeAt(0)+128)),r=!1):t.append(e)}else switch(o){case 27:t.append("\x1d");break;case 30:r=!0;break;default:throw new H}i=0;break;case 3:if(o<this.TEXT_SHIFT3_SET_CHARS.length){let e=this.TEXT_SHIFT3_SET_CHARS[o];r?(t.append(String.fromCharCode(e.charCodeAt(0)+128)),r=!1):t.append(e),i=0}else throw new H;break;default:throw new H}}}while(e.available()>0)}static decodeAnsiX12Segment(e,t){let r=[];do{if(8===e.available())return;let n=e.readBits(8);if(254===n)return;this.parseTwoBytes(n,e.readBits(8),r);for(let e=0;e<3;e++){let n=r[e];switch(n){case 0:t.append("\r");break;case 1:t.append("*");break;case 2:t.append(">");break;case 3:t.append(" ");break;default:if(n<14)t.append(String.fromCharCode(n+44));else if(n<40)t.append(String.fromCharCode(n+51));else throw new H}}}while(e.available()>0)}static parseTwoBytes(e,t,r){let n=(e<<8)+t-1,i=Math.floor(n/1600);r[0]=i,n-=1600*i,i=Math.floor(n/40),r[1]=i,r[2]=n-40*i}static decodeEdifactSegment(e,t){do{if(16>=e.available())return;for(let r=0;r<4;r++){let r=e.readBits(6);if(31===r){let t=8-e.getBitOffset();8!==t&&e.readBits(t);return}(32&r)==0&&(r|=64),t.append(String.fromCharCode(r))}}while(e.available()>0)}static decodeBase256Segment(e,t,r){let n,i=1+e.getByteOffset(),o=this.unrandomize255State(e.readBits(8),i++);if((n=0===o?e.available()/8|0:o<250?o:250*(o-249)+this.unrandomize255State(e.readBits(8),i++))<0)throw new H;let a=new Uint8Array(n);for(let t=0;t<n;t++){if(8>e.available())throw new H;a[t]=this.unrandomize255State(e.readBits(8),i++)}r.push(a);try{t.append(j.decode(a,G.ISO88591))}catch(e){throw new eh("Platform does not support required encoding: "+e.message)}}static unrandomize255State(e,t){let r=e-(149*t%255+1);return r>=0?r:r+256}}tf.C40_BASIC_SET_CHARS=["*","*","*"," ","0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],tf.C40_SHIFT2_SET_CHARS=["!",'"',"#","$","%","&","'","(",")","*","+",",","-",".","/",":",";","<","=",">","?","@","[","\\","]","^","_"],tf.TEXT_BASIC_SET_CHARS=["*","*","*"," ","0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"],tf.TEXT_SHIFT2_SET_CHARS=tf.C40_SHIFT2_SET_CHARS,tf.TEXT_SHIFT3_SET_CHARS=["`","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","{","|","}","~",""];class tg{constructor(){this.rsDecoder=new ed(ec.DATA_MATRIX_FIELD_256)}decode(e){let t=new tu(e),r=t.getVersion(),n=t.readCodewords(),i=th.getDataBlocks(n,r),o=0;for(let e of i)o+=e.getNumDataCodewords();let a=new Uint8Array(o),s=i.length;for(let e=0;e<s;e++){let t=i[e],r=t.getCodewords(),n=t.getNumDataCodewords();this.correctErrors(r,n);for(let t=0;t<n;t++)a[t*s+e]=r[t]}return tf.decode(a)}correctErrors(e,t){let r=new Int32Array(e);try{this.rsDecoder.decode(r,e.length-t)}catch(e){throw new R}for(let n=0;n<t;n++)e[n]=r[n]}}class tp{constructor(e){this.image=e,this.rectangleDetector=new eE(this.image)}detect(){let e=this.rectangleDetector.detect(),t=this.detectSolid1(e);if((t=this.detectSolid2(t))[3]=this.correctTopRight(t),!t[3])throw new X;let r=(t=this.shiftToModuleCenter(t))[0],n=t[1],i=t[2],o=t[3],a=this.transitionsBetween(r,o)+1,s=this.transitionsBetween(i,o)+1;return(1&a)==1&&(a+=1),(1&s)==1&&(s+=1),4*a<7*s&&4*s<7*a&&(a=s=Math.max(a,s)),new ew(tp.sampleGrid(this.image,r,n,i,o,a,s),[r,n,i,o])}static shiftPoint(e,t,r){let n=(t.getX()-e.getX())/(r+1),i=(t.getY()-e.getY())/(r+1);return new em(e.getX()+n,e.getY()+i)}static moveAway(e,t,r){let n=e.getX(),i=e.getY();return n<t?n-=1:n+=1,i<r?i-=1:i+=1,new em(n,i)}detectSolid1(e){let t=e[0],r=e[1],n=e[3],i=e[2],o=this.transitionsBetween(t,r),a=this.transitionsBetween(r,n),s=this.transitionsBetween(n,i),l=this.transitionsBetween(i,t),c=o,u=[i,t,r,n];return c>a&&(c=a,u[0]=t,u[1]=r,u[2]=n,u[3]=i),c>s&&(c=s,u[0]=r,u[1]=n,u[2]=i,u[3]=t),c>l&&(u[0]=n,u[1]=i,u[2]=t,u[3]=r),u}detectSolid2(e){let t=e[0],r=e[1],n=e[2],i=e[3],o=this.transitionsBetween(t,i),a=tp.shiftPoint(r,n,(o+1)*4),s=tp.shiftPoint(n,r,(o+1)*4);return this.transitionsBetween(a,t)<this.transitionsBetween(s,i)?(e[0]=t,e[1]=r,e[2]=n,e[3]=i):(e[0]=r,e[1]=n,e[2]=i,e[3]=t),e}correctTopRight(e){let t=e[0],r=e[1],n=e[2],i=e[3],o=this.transitionsBetween(t,i),a=this.transitionsBetween(r,i),s=tp.shiftPoint(t,r,(a+1)*4),l=tp.shiftPoint(n,r,(o+1)*4);o=this.transitionsBetween(s,i),a=this.transitionsBetween(l,i);let c=new em(i.getX()+(n.getX()-r.getX())/(o+1),i.getY()+(n.getY()-r.getY())/(o+1)),u=new em(i.getX()+(t.getX()-r.getX())/(a+1),i.getY()+(t.getY()-r.getY())/(a+1));return this.isValid(c)?this.isValid(u)?this.transitionsBetween(s,c)+this.transitionsBetween(l,c)>this.transitionsBetween(s,u)+this.transitionsBetween(l,u)?c:u:c:this.isValid(u)?u:null}shiftToModuleCenter(e){let t,r,n=e[0],i=e[1],o=e[2],a=e[3],s=this.transitionsBetween(n,a)+1,l=this.transitionsBetween(o,a)+1,c=tp.shiftPoint(n,i,4*l),u=tp.shiftPoint(o,i,4*s);s=this.transitionsBetween(c,a)+1,l=this.transitionsBetween(u,a)+1,(1&s)==1&&(s+=1),(1&l)==1&&(l+=1);let h=(n.getX()+i.getX()+o.getX()+a.getX())/4,d=(n.getY()+i.getY()+o.getY()+a.getY())/4;return n=tp.moveAway(n,h,d),i=tp.moveAway(i,h,d),o=tp.moveAway(o,h,d),a=tp.moveAway(a,h,d),c=tp.shiftPoint(n,i,4*l),c=tp.shiftPoint(c,a,4*s),t=tp.shiftPoint(i,n,4*l),t=tp.shiftPoint(t,o,4*s),u=tp.shiftPoint(o,a,4*l),u=tp.shiftPoint(u,i,4*s),r=tp.shiftPoint(a,o,4*l),[c,t,u,r=tp.shiftPoint(r,n,4*s)]}isValid(e){return e.getX()>=0&&e.getX()<this.image.getWidth()&&e.getY()>0&&e.getY()<this.image.getHeight()}static sampleGrid(e,t,r,n,i,o,a){return eS.getInstance().sampleGrid(e,o,a,.5,.5,o-.5,.5,o-.5,a-.5,.5,a-.5,t.getX(),t.getY(),i.getX(),i.getY(),n.getX(),n.getY(),r.getX(),r.getY())}transitionsBetween(e,t){let r=Math.trunc(e.getX()),n=Math.trunc(e.getY()),i=Math.trunc(t.getX()),o=Math.trunc(t.getY()),a=Math.abs(o-n)>Math.abs(i-r);if(a){let e=r;r=n,n=e,e=i,i=o,o=e}let s=Math.abs(i-r),l=Math.abs(o-n),c=-s/2,u=n<o?1:-1,h=r<i?1:-1,d=0,f=this.image.get(a?n:r,a?r:n);for(let e=r,t=n;e!==i;e+=h){let r=this.image.get(a?t:e,a?e:t);if(r!==f&&(d++,f=r),(c+=l)>0){if(t===o)break;t+=u,c-=s}}return d}}class tm{constructor(){this.decoder=new tg}decode(e,t=null){let r,n;if(null!=t&&t.has(U.PURE_BARCODE)){let t=tm.extractPureBits(e.getBlackMatrix());r=this.decoder.decode(t),n=tm.NO_POINTS}else{let t=new tp(e.getBlackMatrix()).detect();r=this.decoder.decode(t.getBits()),n=t.getPoints()}let i=r.getRawBytes(),o=new er(r.getText(),i,8*i.length,n,en.DATA_MATRIX,P.currentTimeMillis()),a=r.getByteSegments();null!=a&&o.putMetadata(ei.BYTE_SEGMENTS,a);let s=r.getECLevel();return null!=s&&o.putMetadata(ei.ERROR_CORRECTION_LEVEL,s),o}reset(){}static extractPureBits(e){let t=e.getTopLeftOnBit(),r=e.getBottomRightOnBit();if(null==t||null==r)throw new X;let n=this.moduleSize(t,e),i=t[1],o=r[1],a=t[0],s=(r[0]-a+1)/n,l=(o-i+1)/n;if(s<=0||l<=0)throw new X;let c=n/2;i+=c,a+=c;let u=new Y(s,l);for(let t=0;t<l;t++){let r=i+t*n;for(let i=0;i<s;i++)e.get(a+i*n,r)&&u.set(i,t)}return u}static moduleSize(e,t){let r=t.getWidth(),n=e[0],i=e[1];for(;n<r&&t.get(n,i);)n++;if(n===r)throw new X;let o=n-e[0];if(0===o)throw new X;return o}}tm.NO_POINTS=[],(c=A||(A={}))[c.L=0]="L",c[c.M=1]="M",c[c.Q=2]="Q",c[c.H=3]="H";class tw{constructor(e,t,r){this.value=e,this.stringValue=t,this.bits=r,tw.FOR_BITS.set(r,this),tw.FOR_VALUE.set(e,this)}getValue(){return this.value}getBits(){return this.bits}static fromString(e){switch(e){case"L":return tw.L;case"M":return tw.M;case"Q":return tw.Q;case"H":return tw.H;default:throw new M(e+"not available")}}toString(){return this.stringValue}equals(e){return e instanceof tw&&this.value===e.value}static forBits(e){if(e<0||e>=tw.FOR_BITS.size)throw new D;return tw.FOR_BITS.get(e)}}tw.FOR_BITS=new Map,tw.FOR_VALUE=new Map,tw.L=new tw(A.L,"L",1),tw.M=new tw(A.M,"M",0),tw.Q=new tw(A.Q,"Q",3),tw.H=new tw(A.H,"H",2);class tC{constructor(e){this.errorCorrectionLevel=tw.forBits(e>>3&3),this.dataMask=7&e}static numBitsDiffering(e,t){return k.bitCount(e^t)}static decodeFormatInformation(e,t){let r=tC.doDecodeFormatInformation(e,t);return null!==r?r:tC.doDecodeFormatInformation(e^tC.FORMAT_INFO_MASK_QR,t^tC.FORMAT_INFO_MASK_QR)}static doDecodeFormatInformation(e,t){let r=Number.MAX_SAFE_INTEGER,n=0;for(let i of tC.FORMAT_INFO_DECODE_LOOKUP){let o=i[0];if(o===e||o===t)return new tC(i[1]);let a=tC.numBitsDiffering(e,o);a<r&&(n=i[1],r=a),e!==t&&(a=tC.numBitsDiffering(t,o))<r&&(n=i[1],r=a)}return r<=3?new tC(n):null}getErrorCorrectionLevel(){return this.errorCorrectionLevel}getDataMask(){return this.dataMask}hashCode(){return this.errorCorrectionLevel.getBits()<<3|this.dataMask}equals(e){return e instanceof tC&&this.errorCorrectionLevel===e.errorCorrectionLevel&&this.dataMask===e.dataMask}}tC.FORMAT_INFO_MASK_QR=21522,tC.FORMAT_INFO_DECODE_LOOKUP=[Int32Array.from([21522,0]),Int32Array.from([20773,1]),Int32Array.from([24188,2]),Int32Array.from([23371,3]),Int32Array.from([17913,4]),Int32Array.from([16590,5]),Int32Array.from([20375,6]),Int32Array.from([19104,7]),Int32Array.from([30660,8]),Int32Array.from([29427,9]),Int32Array.from([32170,10]),Int32Array.from([30877,11]),Int32Array.from([26159,12]),Int32Array.from([25368,13]),Int32Array.from([27713,14]),Int32Array.from([26998,15]),Int32Array.from([5769,16]),Int32Array.from([5054,17]),Int32Array.from([7399,18]),Int32Array.from([6608,19]),Int32Array.from([1890,20]),Int32Array.from([597,21]),Int32Array.from([3340,22]),Int32Array.from([2107,23]),Int32Array.from([13663,24]),Int32Array.from([12392,25]),Int32Array.from([16177,26]),Int32Array.from([14854,27]),Int32Array.from([9396,28]),Int32Array.from([8579,29]),Int32Array.from([11994,30]),Int32Array.from([11245,31])];class tE{constructor(e,...t){this.ecCodewordsPerBlock=e,this.ecBlocks=t}getECCodewordsPerBlock(){return this.ecCodewordsPerBlock}getNumBlocks(){let e=0;for(let t of this.ecBlocks)e+=t.getCount();return e}getTotalECCodewords(){return this.ecCodewordsPerBlock*this.getNumBlocks()}getECBlocks(){return this.ecBlocks}}class tA{constructor(e,t){this.count=e,this.dataCodewords=t}getCount(){return this.count}getDataCodewords(){return this.dataCodewords}}class ty{constructor(e,t,...r){this.versionNumber=e,this.alignmentPatternCenters=t,this.ecBlocks=r;let n=0,i=r[0].getECCodewordsPerBlock();for(let e of r[0].getECBlocks())n+=e.getCount()*(e.getDataCodewords()+i);this.totalCodewords=n}getVersionNumber(){return this.versionNumber}getAlignmentPatternCenters(){return this.alignmentPatternCenters}getTotalCodewords(){return this.totalCodewords}getDimensionForVersion(){return 17+4*this.versionNumber}getECBlocksForLevel(e){return this.ecBlocks[e.getValue()]}static getProvisionalVersionForDimension(e){if(e%4!=1)throw new H;try{return this.getVersionForNumber((e-17)/4)}catch(e){throw new H}}static getVersionForNumber(e){if(e<1||e>40)throw new D;return ty.VERSIONS[e-1]}static decodeVersionInformation(e){let t=Number.MAX_SAFE_INTEGER,r=0;for(let n=0;n<ty.VERSION_DECODE_INFO.length;n++){let i=ty.VERSION_DECODE_INFO[n];if(i===e)return ty.getVersionForNumber(n+7);let o=tC.numBitsDiffering(e,i);o<t&&(r=n+7,t=o)}return t<=3?ty.getVersionForNumber(r):null}buildFunctionPattern(){let e=this.getDimensionForVersion(),t=new Y(e);t.setRegion(0,0,9,9),t.setRegion(e-8,0,8,9),t.setRegion(0,e-8,9,8);let r=this.alignmentPatternCenters.length;for(let e=0;e<r;e++){let n=this.alignmentPatternCenters[e]-2;for(let i=0;i<r;i++)(0!==e||0!==i&&i!==r-1)&&(e!==r-1||0!==i)&&t.setRegion(this.alignmentPatternCenters[i]-2,n,5,5)}return t.setRegion(6,9,1,e-17),t.setRegion(9,6,e-17,1),this.versionNumber>6&&(t.setRegion(e-11,0,3,6),t.setRegion(0,e-11,6,3)),t}toString(){return""+this.versionNumber}}ty.VERSION_DECODE_INFO=Int32Array.from([31892,34236,39577,42195,48118,51042,55367,58893,63784,68472,70749,76311,79154,84390,87683,92361,96236,102084,102881,110507,110734,117786,119615,126325,127568,133589,136944,141498,145311,150283,152622,158308,161089,167017]),ty.VERSIONS=[new ty(1,new Int32Array(0),new tE(7,new tA(1,19)),new tE(10,new tA(1,16)),new tE(13,new tA(1,13)),new tE(17,new tA(1,9))),new ty(2,Int32Array.from([6,18]),new tE(10,new tA(1,34)),new tE(16,new tA(1,28)),new tE(22,new tA(1,22)),new tE(28,new tA(1,16))),new ty(3,Int32Array.from([6,22]),new tE(15,new tA(1,55)),new tE(26,new tA(1,44)),new tE(18,new tA(2,17)),new tE(22,new tA(2,13))),new ty(4,Int32Array.from([6,26]),new tE(20,new tA(1,80)),new tE(18,new tA(2,32)),new tE(26,new tA(2,24)),new tE(16,new tA(4,9))),new ty(5,Int32Array.from([6,30]),new tE(26,new tA(1,108)),new tE(24,new tA(2,43)),new tE(18,new tA(2,15),new tA(2,16)),new tE(22,new tA(2,11),new tA(2,12))),new ty(6,Int32Array.from([6,34]),new tE(18,new tA(2,68)),new tE(16,new tA(4,27)),new tE(24,new tA(4,19)),new tE(28,new tA(4,15))),new ty(7,Int32Array.from([6,22,38]),new tE(20,new tA(2,78)),new tE(18,new tA(4,31)),new tE(18,new tA(2,14),new tA(4,15)),new tE(26,new tA(4,13),new tA(1,14))),new ty(8,Int32Array.from([6,24,42]),new tE(24,new tA(2,97)),new tE(22,new tA(2,38),new tA(2,39)),new tE(22,new tA(4,18),new tA(2,19)),new tE(26,new tA(4,14),new tA(2,15))),new ty(9,Int32Array.from([6,26,46]),new tE(30,new tA(2,116)),new tE(22,new tA(3,36),new tA(2,37)),new tE(20,new tA(4,16),new tA(4,17)),new tE(24,new tA(4,12),new tA(4,13))),new ty(10,Int32Array.from([6,28,50]),new tE(18,new tA(2,68),new tA(2,69)),new tE(26,new tA(4,43),new tA(1,44)),new tE(24,new tA(6,19),new tA(2,20)),new tE(28,new tA(6,15),new tA(2,16))),new ty(11,Int32Array.from([6,30,54]),new tE(20,new tA(4,81)),new tE(30,new tA(1,50),new tA(4,51)),new tE(28,new tA(4,22),new tA(4,23)),new tE(24,new tA(3,12),new tA(8,13))),new ty(12,Int32Array.from([6,32,58]),new tE(24,new tA(2,92),new tA(2,93)),new tE(22,new tA(6,36),new tA(2,37)),new tE(26,new tA(4,20),new tA(6,21)),new tE(28,new tA(7,14),new tA(4,15))),new ty(13,Int32Array.from([6,34,62]),new tE(26,new tA(4,107)),new tE(22,new tA(8,37),new tA(1,38)),new tE(24,new tA(8,20),new tA(4,21)),new tE(22,new tA(12,11),new tA(4,12))),new ty(14,Int32Array.from([6,26,46,66]),new tE(30,new tA(3,115),new tA(1,116)),new tE(24,new tA(4,40),new tA(5,41)),new tE(20,new tA(11,16),new tA(5,17)),new tE(24,new tA(11,12),new tA(5,13))),new ty(15,Int32Array.from([6,26,48,70]),new tE(22,new tA(5,87),new tA(1,88)),new tE(24,new tA(5,41),new tA(5,42)),new tE(30,new tA(5,24),new tA(7,25)),new tE(24,new tA(11,12),new tA(7,13))),new ty(16,Int32Array.from([6,26,50,74]),new tE(24,new tA(5,98),new tA(1,99)),new tE(28,new tA(7,45),new tA(3,46)),new tE(24,new tA(15,19),new tA(2,20)),new tE(30,new tA(3,15),new tA(13,16))),new ty(17,Int32Array.from([6,30,54,78]),new tE(28,new tA(1,107),new tA(5,108)),new tE(28,new tA(10,46),new tA(1,47)),new tE(28,new tA(1,22),new tA(15,23)),new tE(28,new tA(2,14),new tA(17,15))),new ty(18,Int32Array.from([6,30,56,82]),new tE(30,new tA(5,120),new tA(1,121)),new tE(26,new tA(9,43),new tA(4,44)),new tE(28,new tA(17,22),new tA(1,23)),new tE(28,new tA(2,14),new tA(19,15))),new ty(19,Int32Array.from([6,30,58,86]),new tE(28,new tA(3,113),new tA(4,114)),new tE(26,new tA(3,44),new tA(11,45)),new tE(26,new tA(17,21),new tA(4,22)),new tE(26,new tA(9,13),new tA(16,14))),new ty(20,Int32Array.from([6,34,62,90]),new tE(28,new tA(3,107),new tA(5,108)),new tE(26,new tA(3,41),new tA(13,42)),new tE(30,new tA(15,24),new tA(5,25)),new tE(28,new tA(15,15),new tA(10,16))),new ty(21,Int32Array.from([6,28,50,72,94]),new tE(28,new tA(4,116),new tA(4,117)),new tE(26,new tA(17,42)),new tE(28,new tA(17,22),new tA(6,23)),new tE(30,new tA(19,16),new tA(6,17))),new ty(22,Int32Array.from([6,26,50,74,98]),new tE(28,new tA(2,111),new tA(7,112)),new tE(28,new tA(17,46)),new tE(30,new tA(7,24),new tA(16,25)),new tE(24,new tA(34,13))),new ty(23,Int32Array.from([6,30,54,78,102]),new tE(30,new tA(4,121),new tA(5,122)),new tE(28,new tA(4,47),new tA(14,48)),new tE(30,new tA(11,24),new tA(14,25)),new tE(30,new tA(16,15),new tA(14,16))),new ty(24,Int32Array.from([6,28,54,80,106]),new tE(30,new tA(6,117),new tA(4,118)),new tE(28,new tA(6,45),new tA(14,46)),new tE(30,new tA(11,24),new tA(16,25)),new tE(30,new tA(30,16),new tA(2,17))),new ty(25,Int32Array.from([6,32,58,84,110]),new tE(26,new tA(8,106),new tA(4,107)),new tE(28,new tA(8,47),new tA(13,48)),new tE(30,new tA(7,24),new tA(22,25)),new tE(30,new tA(22,15),new tA(13,16))),new ty(26,Int32Array.from([6,30,58,86,114]),new tE(28,new tA(10,114),new tA(2,115)),new tE(28,new tA(19,46),new tA(4,47)),new tE(28,new tA(28,22),new tA(6,23)),new tE(30,new tA(33,16),new tA(4,17))),new ty(27,Int32Array.from([6,34,62,90,118]),new tE(30,new tA(8,122),new tA(4,123)),new tE(28,new tA(22,45),new tA(3,46)),new tE(30,new tA(8,23),new tA(26,24)),new tE(30,new tA(12,15),new tA(28,16))),new ty(28,Int32Array.from([6,26,50,74,98,122]),new tE(30,new tA(3,117),new tA(10,118)),new tE(28,new tA(3,45),new tA(23,46)),new tE(30,new tA(4,24),new tA(31,25)),new tE(30,new tA(11,15),new tA(31,16))),new ty(29,Int32Array.from([6,30,54,78,102,126]),new tE(30,new tA(7,116),new tA(7,117)),new tE(28,new tA(21,45),new tA(7,46)),new tE(30,new tA(1,23),new tA(37,24)),new tE(30,new tA(19,15),new tA(26,16))),new ty(30,Int32Array.from([6,26,52,78,104,130]),new tE(30,new tA(5,115),new tA(10,116)),new tE(28,new tA(19,47),new tA(10,48)),new tE(30,new tA(15,24),new tA(25,25)),new tE(30,new tA(23,15),new tA(25,16))),new ty(31,Int32Array.from([6,30,56,82,108,134]),new tE(30,new tA(13,115),new tA(3,116)),new tE(28,new tA(2,46),new tA(29,47)),new tE(30,new tA(42,24),new tA(1,25)),new tE(30,new tA(23,15),new tA(28,16))),new ty(32,Int32Array.from([6,34,60,86,112,138]),new tE(30,new tA(17,115)),new tE(28,new tA(10,46),new tA(23,47)),new tE(30,new tA(10,24),new tA(35,25)),new tE(30,new tA(19,15),new tA(35,16))),new ty(33,Int32Array.from([6,30,58,86,114,142]),new tE(30,new tA(17,115),new tA(1,116)),new tE(28,new tA(14,46),new tA(21,47)),new tE(30,new tA(29,24),new tA(19,25)),new tE(30,new tA(11,15),new tA(46,16))),new ty(34,Int32Array.from([6,34,62,90,118,146]),new tE(30,new tA(13,115),new tA(6,116)),new tE(28,new tA(14,46),new tA(23,47)),new tE(30,new tA(44,24),new tA(7,25)),new tE(30,new tA(59,16),new tA(1,17))),new ty(35,Int32Array.from([6,30,54,78,102,126,150]),new tE(30,new tA(12,121),new tA(7,122)),new tE(28,new tA(12,47),new tA(26,48)),new tE(30,new tA(39,24),new tA(14,25)),new tE(30,new tA(22,15),new tA(41,16))),new ty(36,Int32Array.from([6,24,50,76,102,128,154]),new tE(30,new tA(6,121),new tA(14,122)),new tE(28,new tA(6,47),new tA(34,48)),new tE(30,new tA(46,24),new tA(10,25)),new tE(30,new tA(2,15),new tA(64,16))),new ty(37,Int32Array.from([6,28,54,80,106,132,158]),new tE(30,new tA(17,122),new tA(4,123)),new tE(28,new tA(29,46),new tA(14,47)),new tE(30,new tA(49,24),new tA(10,25)),new tE(30,new tA(24,15),new tA(46,16))),new ty(38,Int32Array.from([6,32,58,84,110,136,162]),new tE(30,new tA(4,122),new tA(18,123)),new tE(28,new tA(13,46),new tA(32,47)),new tE(30,new tA(48,24),new tA(14,25)),new tE(30,new tA(42,15),new tA(32,16))),new ty(39,Int32Array.from([6,26,54,82,110,138,166]),new tE(30,new tA(20,117),new tA(4,118)),new tE(28,new tA(40,47),new tA(7,48)),new tE(30,new tA(43,24),new tA(22,25)),new tE(30,new tA(10,15),new tA(67,16))),new ty(40,Int32Array.from([6,30,58,86,114,142,170]),new tE(30,new tA(19,118),new tA(6,119)),new tE(28,new tA(18,47),new tA(31,48)),new tE(30,new tA(34,24),new tA(34,25)),new tE(30,new tA(20,15),new tA(61,16)))],(u=y||(y={}))[u.DATA_MASK_000=0]="DATA_MASK_000",u[u.DATA_MASK_001=1]="DATA_MASK_001",u[u.DATA_MASK_010=2]="DATA_MASK_010",u[u.DATA_MASK_011=3]="DATA_MASK_011",u[u.DATA_MASK_100=4]="DATA_MASK_100",u[u.DATA_MASK_101=5]="DATA_MASK_101",u[u.DATA_MASK_110=6]="DATA_MASK_110",u[u.DATA_MASK_111=7]="DATA_MASK_111";class tI{constructor(e,t){this.value=e,this.isMasked=t}unmaskBitMatrix(e,t){for(let r=0;r<t;r++)for(let n=0;n<t;n++)this.isMasked(r,n)&&e.flip(n,r)}}tI.values=new Map([[y.DATA_MASK_000,new tI(y.DATA_MASK_000,(e,t)=>(e+t&1)==0)],[y.DATA_MASK_001,new tI(y.DATA_MASK_001,(e,t)=>(1&e)==0)],[y.DATA_MASK_010,new tI(y.DATA_MASK_010,(e,t)=>t%3==0)],[y.DATA_MASK_011,new tI(y.DATA_MASK_011,(e,t)=>(e+t)%3==0)],[y.DATA_MASK_100,new tI(y.DATA_MASK_100,(e,t)=>(Math.floor(e/2)+Math.floor(t/3)&1)==0)],[y.DATA_MASK_101,new tI(y.DATA_MASK_101,(e,t)=>e*t%6==0)],[y.DATA_MASK_110,new tI(y.DATA_MASK_110,(e,t)=>e*t%6<3)],[y.DATA_MASK_111,new tI(y.DATA_MASK_111,(e,t)=>(e+t+e*t%3&1)==0)]]);class tS{constructor(e){let t=e.getHeight();if(t<21||(3&t)!=1)throw new H;this.bitMatrix=e}readFormatInformation(){if(null!==this.parsedFormatInfo&&void 0!==this.parsedFormatInfo)return this.parsedFormatInfo;let e=0;for(let t=0;t<6;t++)e=this.copyBit(t,8,e);e=this.copyBit(7,8,e),e=this.copyBit(8,8,e),e=this.copyBit(8,7,e);for(let t=5;t>=0;t--)e=this.copyBit(8,t,e);let t=this.bitMatrix.getHeight(),r=0,n=t-7;for(let e=t-1;e>=n;e--)r=this.copyBit(8,e,r);for(let e=t-8;e<t;e++)r=this.copyBit(e,8,r);if(this.parsedFormatInfo=tC.decodeFormatInformation(e,r),null!==this.parsedFormatInfo)return this.parsedFormatInfo;throw new H}readVersion(){if(null!==this.parsedVersion&&void 0!==this.parsedVersion)return this.parsedVersion;let e=this.bitMatrix.getHeight(),t=Math.floor((e-17)/4);if(t<=6)return ty.getVersionForNumber(t);let r=0,n=e-11;for(let t=5;t>=0;t--)for(let i=e-9;i>=n;i--)r=this.copyBit(i,t,r);let i=ty.decodeVersionInformation(r);if(null!==i&&i.getDimensionForVersion()===e)return this.parsedVersion=i,i;r=0;for(let t=5;t>=0;t--)for(let i=e-9;i>=n;i--)r=this.copyBit(t,i,r);if(null!==(i=ty.decodeVersionInformation(r))&&i.getDimensionForVersion()===e)return this.parsedVersion=i,i;throw new H}copyBit(e,t,r){return(this.isMirror?this.bitMatrix.get(t,e):this.bitMatrix.get(e,t))?r<<1|1:r<<1}readCodewords(){let e=this.readFormatInformation(),t=this.readVersion(),r=tI.values.get(e.getDataMask()),n=this.bitMatrix.getHeight();r.unmaskBitMatrix(this.bitMatrix,n);let i=t.buildFunctionPattern(),o=!0,a=new Uint8Array(t.getTotalCodewords()),s=0,l=0,c=0;for(let e=n-1;e>0;e-=2){6===e&&e--;for(let t=0;t<n;t++){let r=o?n-1-t:t;for(let t=0;t<2;t++)i.get(e-t,r)||(c++,l<<=1,this.bitMatrix.get(e-t,r)&&(l|=1),8===c&&(a[s++]=l,c=0,l=0))}o=!o}if(s!==t.getTotalCodewords())throw new H;return a}remask(){if(null===this.parsedFormatInfo)return;let e=tI.values[this.parsedFormatInfo.getDataMask()],t=this.bitMatrix.getHeight();e.unmaskBitMatrix(this.bitMatrix,t)}setMirror(e){this.parsedVersion=null,this.parsedFormatInfo=null,this.isMirror=e}mirror(){let e=this.bitMatrix;for(let t=0,r=e.getWidth();t<r;t++)for(let r=t+1,n=e.getHeight();r<n;r++)e.get(t,r)!==e.get(r,t)&&(e.flip(r,t),e.flip(t,r))}}class t_{constructor(e,t){this.numDataCodewords=e,this.codewords=t}static getDataBlocks(e,t,r){if(e.length!==t.getTotalCodewords())throw new D;let n=t.getECBlocksForLevel(r),i=0,o=n.getECBlocks();for(let e of o)i+=e.getCount();let a=Array(i),s=0;for(let e of o)for(let t=0;t<e.getCount();t++){let t=e.getDataCodewords(),r=n.getECCodewordsPerBlock()+t;a[s++]=new t_(t,new Uint8Array(r))}let l=a[0].codewords.length,c=a.length-1;for(;c>=0&&a[c].codewords.length!==l;)c--;c++;let u=l-n.getECCodewordsPerBlock(),h=0;for(let t=0;t<u;t++)for(let r=0;r<s;r++)a[r].codewords[t]=e[h++];for(let t=c;t<s;t++)a[t].codewords[u]=e[h++];let d=a[0].codewords.length;for(let t=u;t<d;t++)for(let r=0;r<s;r++){let n=r<c?t:t+1;a[r].codewords[n]=e[h++]}return a}getNumDataCodewords(){return this.numDataCodewords}getCodewords(){return this.codewords}}(h=I||(I={}))[h.TERMINATOR=0]="TERMINATOR",h[h.NUMERIC=1]="NUMERIC",h[h.ALPHANUMERIC=2]="ALPHANUMERIC",h[h.STRUCTURED_APPEND=3]="STRUCTURED_APPEND",h[h.BYTE=4]="BYTE",h[h.ECI=5]="ECI",h[h.KANJI=6]="KANJI",h[h.FNC1_FIRST_POSITION=7]="FNC1_FIRST_POSITION",h[h.FNC1_SECOND_POSITION=8]="FNC1_SECOND_POSITION",h[h.HANZI=9]="HANZI";class tb{constructor(e,t,r,n){this.value=e,this.stringValue=t,this.characterCountBitsForVersions=r,this.bits=n,tb.FOR_BITS.set(n,this),tb.FOR_VALUE.set(e,this)}static forBits(e){let t=tb.FOR_BITS.get(e);if(void 0===t)throw new D;return t}getCharacterCountBits(e){let t,r=e.getVersionNumber();return t=r<=9?0:r<=26?1:2,this.characterCountBitsForVersions[t]}getValue(){return this.value}getBits(){return this.bits}equals(e){return e instanceof tb&&this.value===e.value}toString(){return this.stringValue}}tb.FOR_BITS=new Map,tb.FOR_VALUE=new Map,tb.TERMINATOR=new tb(I.TERMINATOR,"TERMINATOR",Int32Array.from([0,0,0]),0),tb.NUMERIC=new tb(I.NUMERIC,"NUMERIC",Int32Array.from([10,12,14]),1),tb.ALPHANUMERIC=new tb(I.ALPHANUMERIC,"ALPHANUMERIC",Int32Array.from([9,11,13]),2),tb.STRUCTURED_APPEND=new tb(I.STRUCTURED_APPEND,"STRUCTURED_APPEND",Int32Array.from([0,0,0]),3),tb.BYTE=new tb(I.BYTE,"BYTE",Int32Array.from([8,16,16]),4),tb.ECI=new tb(I.ECI,"ECI",Int32Array.from([0,0,0]),7),tb.KANJI=new tb(I.KANJI,"KANJI",Int32Array.from([8,10,12]),8),tb.FNC1_FIRST_POSITION=new tb(I.FNC1_FIRST_POSITION,"FNC1_FIRST_POSITION",Int32Array.from([0,0,0]),5),tb.FNC1_SECOND_POSITION=new tb(I.FNC1_SECOND_POSITION,"FNC1_SECOND_POSITION",Int32Array.from([0,0,0]),9),tb.HANZI=new tb(I.HANZI,"HANZI",Int32Array.from([8,10,12]),13);class tT{static decode(e,t,r,n){let i=new td(e),o=new W,a=[],s=-1,l=-1;try{let e,r=null,c=!1;do{if(4>i.available())e=tb.TERMINATOR;else{let t=i.readBits(4);e=tb.forBits(t)}switch(e){case tb.TERMINATOR:break;case tb.FNC1_FIRST_POSITION:case tb.FNC1_SECOND_POSITION:c=!0;break;case tb.STRUCTURED_APPEND:if(16>i.available())throw new H;s=i.readBits(8),l=i.readBits(8);break;case tb.ECI:let u=tT.parseECIValue(i);if(r=z.getCharacterSetECIByValue(u),null===r)throw new H;break;case tb.HANZI:let h=i.readBits(4),d=i.readBits(e.getCharacterCountBits(t));h===tT.GB2312_SUBSET&&tT.decodeHanziSegment(i,o,d);break;default:let f=i.readBits(e.getCharacterCountBits(t));switch(e){case tb.NUMERIC:tT.decodeNumericSegment(i,o,f);break;case tb.ALPHANUMERIC:tT.decodeAlphanumericSegment(i,o,f,c);break;case tb.BYTE:tT.decodeByteSegment(i,o,f,r,a,n);break;case tb.KANJI:tT.decodeKanjiSegment(i,o,f);break;default:throw new H}}}while(e!==tb.TERMINATOR)}catch(e){throw new H}return new eo(e,o.toString(),0===a.length?null:a,null===r?null:r.toString(),s,l)}static decodeHanziSegment(e,t,r){if(13*r>e.available())throw new H;let n=new Uint8Array(2*r),i=0;for(;r>0;){let t=e.readBits(13),o=t/96<<8&0xffffffff|t%96;o<959?o+=41377:o+=42657,n[i]=o>>8&255,n[i+1]=255&o,i+=2,r--}try{t.append(j.decode(n,G.GB2312))}catch(e){throw new H(e)}}static decodeKanjiSegment(e,t,r){if(13*r>e.available())throw new H;let n=new Uint8Array(2*r),i=0;for(;r>0;){let t=e.readBits(13),o=t/192<<8&0xffffffff|t%192;o<7936?o+=33088:o+=49472,n[i]=o>>8,n[i+1]=o,i+=2,r--}try{t.append(j.decode(n,G.SHIFT_JIS))}catch(e){throw new H(e)}}static decodeByteSegment(e,t,r,n,i,o){let a;if(8*r>e.available())throw new H;let s=new Uint8Array(r);for(let t=0;t<r;t++)s[t]=e.readBits(8);a=null===n?G.guessEncoding(s,o):n.getName();try{t.append(j.decode(s,a))}catch(e){throw new H(e)}i.push(s)}static toAlphaNumericChar(e){if(e>=tT.ALPHANUMERIC_CHARS.length)throw new H;return tT.ALPHANUMERIC_CHARS[e]}static decodeAlphanumericSegment(e,t,r,n){let i=t.length();for(;r>1;){if(11>e.available())throw new H;let n=e.readBits(11);t.append(tT.toAlphaNumericChar(Math.floor(n/45))),t.append(tT.toAlphaNumericChar(n%45)),r-=2}if(1===r){if(6>e.available())throw new H;t.append(tT.toAlphaNumericChar(e.readBits(6)))}if(n)for(let e=i;e<t.length();e++)"%"===t.charAt(e)&&(e<t.length()-1&&"%"===t.charAt(e+1)?t.deleteCharAt(e+1):t.setCharAt(e,"\x1d"))}static decodeNumericSegment(e,t,r){for(;r>=3;){if(10>e.available())throw new H;let n=e.readBits(10);if(n>=1e3)throw new H;t.append(tT.toAlphaNumericChar(Math.floor(n/100))),t.append(tT.toAlphaNumericChar(Math.floor(n/10)%10)),t.append(tT.toAlphaNumericChar(n%10)),r-=3}if(2===r){if(7>e.available())throw new H;let r=e.readBits(7);if(r>=100)throw new H;t.append(tT.toAlphaNumericChar(Math.floor(r/10))),t.append(tT.toAlphaNumericChar(r%10))}else if(1===r){if(4>e.available())throw new H;let r=e.readBits(4);if(r>=10)throw new H;t.append(tT.toAlphaNumericChar(r))}}static parseECIValue(e){let t=e.readBits(8);if((128&t)==0)return 127&t;if((192&t)==128)return(63&t)<<8&0xffffffff|e.readBits(8);if((224&t)==192)return(31&t)<<16&0xffffffff|e.readBits(16);throw new H}}tT.ALPHANUMERIC_CHARS="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:",tT.GB2312_SUBSET=1;class tN{constructor(e){this.mirrored=e}isMirrored(){return this.mirrored}applyMirroredCorrection(e){if(!this.mirrored||null===e||e.length<3)return;let t=e[0];e[0]=e[2],e[2]=t}}class tM{constructor(){this.rsDecoder=new ed(ec.QR_CODE_FIELD_256)}decodeBooleanArray(e,t){return this.decodeBitMatrix(Y.parseFromBooleanArray(e),t)}decodeBitMatrix(e,t){let r=new tS(e),n=null;try{return this.decodeBitMatrixParser(r,t)}catch(e){n=e}try{r.remask(),r.setMirror(!0),r.readVersion(),r.readFormatInformation(),r.mirror();let e=this.decodeBitMatrixParser(r,t);return e.setOther(new tN(!0)),e}catch(e){if(null!==n)throw n;throw e}}decodeBitMatrixParser(e,t){let r=e.readVersion(),n=e.readFormatInformation().getErrorCorrectionLevel(),i=e.readCodewords(),o=t_.getDataBlocks(i,r,n),a=0;for(let e of o)a+=e.getNumDataCodewords();let s=new Uint8Array(a),l=0;for(let e of o){let t=e.getCodewords(),r=e.getNumDataCodewords();this.correctErrors(t,r);for(let e=0;e<r;e++)s[l++]=t[e]}return tT.decode(s,r,n,t)}correctErrors(e,t){let r=new Int32Array(e);try{this.rsDecoder.decode(r,e.length-t)}catch(e){throw new R}for(let n=0;n<t;n++)e[n]=r[n]}}class tD extends em{constructor(e,t,r){super(e,t),this.estimatedModuleSize=r}aboutEquals(e,t,r){if(Math.abs(t-this.getY())<=e&&Math.abs(r-this.getX())<=e){let t=Math.abs(e-this.estimatedModuleSize);return t<=1||t<=this.estimatedModuleSize}return!1}combineEstimate(e,t,r){let n=(this.getX()+t)/2;return new tD(n,(this.getY()+e)/2,(this.estimatedModuleSize+r)/2)}}class tO{constructor(e,t,r,n,i,o,a){this.image=e,this.startX=t,this.startY=r,this.width=n,this.height=i,this.moduleSize=o,this.resultPointCallback=a,this.possibleCenters=[],this.crossCheckStateCount=new Int32Array(3)}find(){let e=this.startX,t=this.height,r=e+this.width,n=this.startY+t/2,i=new Int32Array(3),o=this.image;for(let a=0;a<t;a++){let t=n+((1&a)==0?Math.floor((a+1)/2):-Math.floor((a+1)/2));i[0]=0,i[1]=0,i[2]=0;let s=e;for(;s<r&&!o.get(s,t);)s++;let l=0;for(;s<r;){if(o.get(s,t))if(1===l)i[1]++;else if(2===l){if(this.foundPatternCross(i)){let e=this.handlePossibleCenter(i,t,s);if(null!==e)return e}i[0]=i[2],i[1]=1,i[2]=0,l=1}else i[++l]++;else 1===l&&l++,i[l]++;s++}if(this.foundPatternCross(i)){let e=this.handlePossibleCenter(i,t,r);if(null!==e)return e}}if(0!==this.possibleCenters.length)return this.possibleCenters[0];throw new X}static centerFromEnd(e,t){return t-e[2]-e[1]/2}foundPatternCross(e){let t=this.moduleSize,r=t/2;for(let n=0;n<3;n++)if(Math.abs(t-e[n])>=r)return!1;return!0}crossCheckVertical(e,t,r,n){let i=this.image,o=i.getHeight(),a=this.crossCheckStateCount;a[0]=0,a[1]=0,a[2]=0;let s=e;for(;s>=0&&i.get(t,s)&&a[1]<=r;)a[1]++,s--;if(s<0||a[1]>r)return NaN;for(;s>=0&&!i.get(t,s)&&a[0]<=r;)a[0]++,s--;if(a[0]>r)return NaN;for(s=e+1;s<o&&i.get(t,s)&&a[1]<=r;)a[1]++,s++;if(s===o||a[1]>r)return NaN;for(;s<o&&!i.get(t,s)&&a[2]<=r;)a[2]++,s++;return a[2]>r||5*Math.abs(a[0]+a[1]+a[2]-n)>=2*n?NaN:this.foundPatternCross(a)?tO.centerFromEnd(a,s):NaN}handlePossibleCenter(e,t,r){let n=e[0]+e[1]+e[2],i=tO.centerFromEnd(e,r),o=this.crossCheckVertical(t,i,2*e[1],n);if(!isNaN(o)){let t=(e[0]+e[1]+e[2])/3;for(let e of this.possibleCenters)if(e.aboutEquals(t,o,i))return e.combineEstimate(o,i,t);let r=new tD(i,o,t);this.possibleCenters.push(r),null!==this.resultPointCallback&&void 0!==this.resultPointCallback&&this.resultPointCallback.foundPossibleResultPoint(r)}return null}}class tR extends em{constructor(e,t,r,n){super(e,t),this.estimatedModuleSize=r,this.count=n,void 0===n&&(this.count=1)}getEstimatedModuleSize(){return this.estimatedModuleSize}getCount(){return this.count}aboutEquals(e,t,r){if(Math.abs(t-this.getY())<=e&&Math.abs(r-this.getX())<=e){let t=Math.abs(e-this.estimatedModuleSize);return t<=1||t<=this.estimatedModuleSize}return!1}combineEstimate(e,t,r){let n=this.count+1,i=(this.count*this.getX()+t)/n;return new tR(i,(this.count*this.getY()+e)/n,(this.count*this.estimatedModuleSize+r)/n,n)}}class tv{constructor(e){this.bottomLeft=e[0],this.topLeft=e[1],this.topRight=e[2]}getBottomLeft(){return this.bottomLeft}getTopLeft(){return this.topLeft}getTopRight(){return this.topRight}}class tP{constructor(e,t){this.image=e,this.resultPointCallback=t,this.possibleCenters=[],this.crossCheckStateCount=new Int32Array(5),this.resultPointCallback=t}getImage(){return this.image}getPossibleCenters(){return this.possibleCenters}find(e){let t=null!=e&&void 0!==e.get(U.TRY_HARDER),r=null!=e&&void 0!==e.get(U.PURE_BARCODE),n=this.image,i=n.getHeight(),o=n.getWidth(),a=Math.floor(3*i/(4*tP.MAX_MODULES));(a<tP.MIN_SKIP||t)&&(a=tP.MIN_SKIP);let s=!1,l=new Int32Array(5);for(let e=a-1;e<i&&!s;e+=a){l[0]=0,l[1]=0,l[2]=0,l[3]=0,l[4]=0;let t=0;for(let i=0;i<o;i++)if(n.get(i,e))(1&t)==1&&t++,l[t]++;else if((1&t)==0)if(4===t)if(tP.foundPatternCross(l)){if(!0===this.handlePossibleCenter(l,e,i,r))if(a=2,!0===this.hasSkipped)s=this.haveMultiplyConfirmedCenters();else{let t=this.findRowSkip();t>l[2]&&(e+=t-l[2]-a,i=o-1)}else{l[0]=l[2],l[1]=l[3],l[2]=l[4],l[3]=1,l[4]=0,t=3;continue}t=0,l[0]=0,l[1]=0,l[2]=0,l[3]=0,l[4]=0}else l[0]=l[2],l[1]=l[3],l[2]=l[4],l[3]=1,l[4]=0,t=3;else l[++t]++;else l[t]++;tP.foundPatternCross(l)&&!0===this.handlePossibleCenter(l,e,o,r)&&(a=l[0],this.hasSkipped&&(s=this.haveMultiplyConfirmedCenters()))}let c=this.selectBestPatterns();return em.orderBestPatterns(c),new tv(c)}static centerFromEnd(e,t){return t-e[4]-e[3]-e[2]/2}static foundPatternCross(e){let t=0;for(let r=0;r<5;r++){let n=e[r];if(0===n)return!1;t+=n}if(t<7)return!1;let r=t/7,n=r/2;return Math.abs(r-e[0])<n&&Math.abs(r-e[1])<n&&Math.abs(3*r-e[2])<3*n&&Math.abs(r-e[3])<n&&Math.abs(r-e[4])<n}getCrossCheckStateCount(){let e=this.crossCheckStateCount;return e[0]=0,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e}crossCheckDiagonal(e,t,r,n){let i=this.getCrossCheckStateCount(),o=0,a=this.image;for(;e>=o&&t>=o&&a.get(t-o,e-o);)i[2]++,o++;if(e<o||t<o)return!1;for(;e>=o&&t>=o&&!a.get(t-o,e-o)&&i[1]<=r;)i[1]++,o++;if(e<o||t<o||i[1]>r)return!1;for(;e>=o&&t>=o&&a.get(t-o,e-o)&&i[0]<=r;)i[0]++,o++;if(i[0]>r)return!1;let s=a.getHeight(),l=a.getWidth();for(o=1;e+o<s&&t+o<l&&a.get(t+o,e+o);)i[2]++,o++;if(e+o>=s||t+o>=l)return!1;for(;e+o<s&&t+o<l&&!a.get(t+o,e+o)&&i[3]<r;)i[3]++,o++;if(e+o>=s||t+o>=l||i[3]>=r)return!1;for(;e+o<s&&t+o<l&&a.get(t+o,e+o)&&i[4]<r;)i[4]++,o++;return!(i[4]>=r)&&Math.abs(i[0]+i[1]+i[2]+i[3]+i[4]-n)<2*n&&tP.foundPatternCross(i)}crossCheckVertical(e,t,r,n){let i=this.image,o=i.getHeight(),a=this.getCrossCheckStateCount(),s=e;for(;s>=0&&i.get(t,s);)a[2]++,s--;if(s<0)return NaN;for(;s>=0&&!i.get(t,s)&&a[1]<=r;)a[1]++,s--;if(s<0||a[1]>r)return NaN;for(;s>=0&&i.get(t,s)&&a[0]<=r;)a[0]++,s--;if(a[0]>r)return NaN;for(s=e+1;s<o&&i.get(t,s);)a[2]++,s++;if(s===o)return NaN;for(;s<o&&!i.get(t,s)&&a[3]<r;)a[3]++,s++;if(s===o||a[3]>=r)return NaN;for(;s<o&&i.get(t,s)&&a[4]<r;)a[4]++,s++;return a[4]>=r||5*Math.abs(a[0]+a[1]+a[2]+a[3]+a[4]-n)>=2*n?NaN:tP.foundPatternCross(a)?tP.centerFromEnd(a,s):NaN}crossCheckHorizontal(e,t,r,n){let i=this.image,o=i.getWidth(),a=this.getCrossCheckStateCount(),s=e;for(;s>=0&&i.get(s,t);)a[2]++,s--;if(s<0)return NaN;for(;s>=0&&!i.get(s,t)&&a[1]<=r;)a[1]++,s--;if(s<0||a[1]>r)return NaN;for(;s>=0&&i.get(s,t)&&a[0]<=r;)a[0]++,s--;if(a[0]>r)return NaN;for(s=e+1;s<o&&i.get(s,t);)a[2]++,s++;if(s===o)return NaN;for(;s<o&&!i.get(s,t)&&a[3]<r;)a[3]++,s++;if(s===o||a[3]>=r)return NaN;for(;s<o&&i.get(s,t)&&a[4]<r;)a[4]++,s++;return a[4]>=r||5*Math.abs(a[0]+a[1]+a[2]+a[3]+a[4]-n)>=n?NaN:tP.foundPatternCross(a)?tP.centerFromEnd(a,s):NaN}handlePossibleCenter(e,t,r,n){let i=e[0]+e[1]+e[2]+e[3]+e[4],o=tP.centerFromEnd(e,r),a=this.crossCheckVertical(t,Math.floor(o),e[2],i);if(!isNaN(a)&&!isNaN(o=this.crossCheckHorizontal(Math.floor(o),Math.floor(a),e[2],i))&&(!n||this.crossCheckDiagonal(Math.floor(a),Math.floor(o),e[2],i))){let e=i/7,t=!1,r=this.possibleCenters;for(let n=0,i=r.length;n<i;n++){let i=r[n];if(i.aboutEquals(e,a,o)){r[n]=i.combineEstimate(a,o,e),t=!0;break}}if(!t){let t=new tR(o,a,e);r.push(t),null!==this.resultPointCallback&&void 0!==this.resultPointCallback&&this.resultPointCallback.foundPossibleResultPoint(t)}return!0}return!1}findRowSkip(){if(this.possibleCenters.length<=1)return 0;let e=null;for(let t of this.possibleCenters)if(t.getCount()>=tP.CENTER_QUORUM)if(null!=e)return this.hasSkipped=!0,Math.floor((Math.abs(e.getX()-t.getX())-Math.abs(e.getY()-t.getY()))/2);else e=t;return 0}haveMultiplyConfirmedCenters(){let e=0,t=0,r=this.possibleCenters.length;for(let r of this.possibleCenters)r.getCount()>=tP.CENTER_QUORUM&&(e++,t+=r.getEstimatedModuleSize());if(e<3)return!1;let n=t/r,i=0;for(let e of this.possibleCenters)i+=Math.abs(e.getEstimatedModuleSize()-n);return i<=.05*t}selectBestPatterns(){let e,t=this.possibleCenters.length;if(t<3)throw new X;let r=this.possibleCenters;if(t>3){let n=0,i=0;for(let e of this.possibleCenters){let t=e.getEstimatedModuleSize();n+=t,i+=t*t}e=n/t;let o=Math.sqrt(i/t-e*e);r.sort((t,r)=>{let n=Math.abs(r.getEstimatedModuleSize()-e),i=Math.abs(t.getEstimatedModuleSize()-e);return n<i?-1:+(n>i)});let a=Math.max(.2*e,o);for(let t=0;t<r.length&&r.length>3;t++)Math.abs(r[t].getEstimatedModuleSize()-e)>a&&(r.splice(t,1),t--)}if(r.length>3){let t=0;for(let e of r)t+=e.getEstimatedModuleSize();e=t/r.length,r.sort((t,r)=>{if(r.getCount()!==t.getCount())return r.getCount()-t.getCount();{let n=Math.abs(r.getEstimatedModuleSize()-e),i=Math.abs(t.getEstimatedModuleSize()-e);return n<i?1:n>i?-1:0}}),r.splice(3)}return[r[0],r[1],r[2]]}}tP.CENTER_QUORUM=2,tP.MIN_SKIP=3,tP.MAX_MODULES=57;class tB{constructor(e){this.image=e}getImage(){return this.image}getResultPointCallback(){return this.resultPointCallback}detect(e){this.resultPointCallback=null==e?null:e.get(U.NEED_RESULT_POINT_CALLBACK);let t=new tP(this.image,this.resultPointCallback).find(e);return this.processFinderPatternInfo(t)}processFinderPatternInfo(e){let t,r=e.getTopLeft(),n=e.getTopRight(),i=e.getBottomLeft(),o=this.calculateModuleSize(r,n,i);if(o<1)throw new X("No pattern found in proccess finder.");let a=tB.computeDimension(r,n,i,o),s=ty.getProvisionalVersionForDimension(a),l=s.getDimensionForVersion()-7,c=null;if(s.getAlignmentPatternCenters().length>0){let e=n.getX()-r.getX()+i.getX(),t=n.getY()-r.getY()+i.getY(),a=1-3/l,s=Math.floor(r.getX()+a*(e-r.getX())),u=Math.floor(r.getY()+a*(t-r.getY()));for(let e=4;e<=16;e<<=1)try{c=this.findAlignmentInRegion(o,s,u,e);break}catch(e){if(!(e instanceof X))throw e}}let u=tB.createTransform(r,n,i,c,a);return new ew(tB.sampleGrid(this.image,u,a),null===c?[i,r,n]:[i,r,n,c])}static createTransform(e,t,r,n,i){let o,a,s,l,c=i-3.5;return null!==n?(o=n.getX(),a=n.getY(),l=s=c-3):(o=t.getX()-e.getX()+r.getX(),a=t.getY()-e.getY()+r.getY(),s=c,l=c),ey.quadrilateralToQuadrilateral(3.5,3.5,c,3.5,s,l,3.5,c,e.getX(),e.getY(),t.getX(),t.getY(),o,a,r.getX(),r.getY())}static sampleGrid(e,t,r){return eS.getInstance().sampleGridWithTransform(e,r,r,t)}static computeDimension(e,t,r,n){let i=Math.floor((eg.round(em.distance(e,t)/n)+eg.round(em.distance(e,r)/n))/2)+7;switch(3&i){case 0:i++;break;case 2:i--;break;case 3:throw new X("Dimensions could be not found.")}return i}calculateModuleSize(e,t,r){return(this.calculateModuleSizeOneWay(e,t)+this.calculateModuleSizeOneWay(e,r))/2}calculateModuleSizeOneWay(e,t){let r=this.sizeOfBlackWhiteBlackRunBothWays(Math.floor(e.getX()),Math.floor(e.getY()),Math.floor(t.getX()),Math.floor(t.getY())),n=this.sizeOfBlackWhiteBlackRunBothWays(Math.floor(t.getX()),Math.floor(t.getY()),Math.floor(e.getX()),Math.floor(e.getY()));return isNaN(r)?n/7:isNaN(n)?r/7:(r+n)/14}sizeOfBlackWhiteBlackRunBothWays(e,t,r,n){let i=this.sizeOfBlackWhiteBlackRun(e,t,r,n),o=1,a=e-(r-e);a<0?(o=e/(e-a),a=0):a>=this.image.getWidth()&&(o=(this.image.getWidth()-1-e)/(a-e),a=this.image.getWidth()-1);let s=Math.floor(t-(n-t)*o);return o=1,s<0?(o=t/(t-s),s=0):s>=this.image.getHeight()&&(o=(this.image.getHeight()-1-t)/(s-t),s=this.image.getHeight()-1),a=Math.floor(e+(a-e)*o),(i+=this.sizeOfBlackWhiteBlackRun(e,t,a,s))-1}sizeOfBlackWhiteBlackRun(e,t,r,n){let i=Math.abs(n-t)>Math.abs(r-e);if(i){let i=e;e=t,t=i,i=r,r=n,n=i}let o=Math.abs(r-e),a=Math.abs(n-t),s=-o/2,l=e<r?1:-1,c=t<n?1:-1,u=0,h=r+l;for(let r=e,d=t;r!==h;r+=l){let l=i?d:r,h=i?r:d;if(1===u===this.image.get(l,h)){if(2===u)return eg.distance(r,d,e,t);u++}if((s+=a)>0){if(d===n)break;d+=c,s-=o}}return 2===u?eg.distance(r+l,n,e,t):NaN}findAlignmentInRegion(e,t,r,n){let i=Math.floor(n*e),o=Math.max(0,t-i),a=Math.min(this.image.getWidth()-1,t+i);if(a-o<3*e)throw new X("Alignment top exceeds estimated module size.");let s=Math.max(0,r-i),l=Math.min(this.image.getHeight()-1,r+i);if(l-s<3*e)throw new X("Alignment bottom exceeds estimated module size.");return new tO(this.image,o,s,a-o,l-s,e,this.resultPointCallback).find()}}class tx{constructor(){this.decoder=new tM}getDecoder(){return this.decoder}decode(e,t){let r,n;if(null!=t&&void 0!==t.get(U.PURE_BARCODE)){let i=tx.extractPureBits(e.getBlackMatrix());r=this.decoder.decodeBitMatrix(i,t),n=tx.NO_POINTS}else{let i=new tB(e.getBlackMatrix()).detect(t);r=this.decoder.decodeBitMatrix(i.getBits(),t),n=i.getPoints()}r.getOther()instanceof tN&&r.getOther().applyMirroredCorrection(n);let i=new er(r.getText(),r.getRawBytes(),void 0,n,en.QR_CODE,void 0),o=r.getByteSegments();null!==o&&i.putMetadata(ei.BYTE_SEGMENTS,o);let a=r.getECLevel();return null!==a&&i.putMetadata(ei.ERROR_CORRECTION_LEVEL,a),r.hasStructuredAppend()&&(i.putMetadata(ei.STRUCTURED_APPEND_SEQUENCE,r.getStructuredAppendSequenceNumber()),i.putMetadata(ei.STRUCTURED_APPEND_PARITY,r.getStructuredAppendParity())),i}reset(){}static extractPureBits(e){let t=e.getTopLeftOnBit(),r=e.getBottomRightOnBit();if(null===t||null===r)throw new X;let n=this.moduleSize(t,e),i=t[1],o=r[1],a=t[0],s=r[0];if(a>=s||i>=o||o-i!=s-a&&(s=a+(o-i))>=e.getWidth())throw new X;let l=Math.round((s-a+1)/n),c=Math.round((o-i+1)/n);if(l<=0||c<=0||c!==l)throw new X;let u=Math.floor(n/2);i+=u;let h=(a+=u)+Math.floor((l-1)*n)-s;if(h>0){if(h>u)throw new X;a-=h}let d=i+Math.floor((c-1)*n)-o;if(d>0){if(d>u)throw new X;i-=d}let f=new Y(l,c);for(let t=0;t<c;t++){let r=i+Math.floor(t*n);for(let i=0;i<l;i++)e.get(a+Math.floor(i*n),r)&&f.set(i,t)}return f}static moduleSize(e,t){let r=t.getHeight(),n=t.getWidth(),i=e[0],o=e[1],a=!0,s=0;for(;i<n&&o<r;){if(a!==t.get(i,o)){if(5==++s)break;a=!a}i++,o++}if(i===n||o===r)throw new X;return(i-e[0])/7}}tx.NO_POINTS=[];class tL{PDF417Common(){}static getBitCountSum(e){return eg.sum(e)}static toIntArray(e){if(null==e||!e.length)return tL.EMPTY_INT_ARRAY;let t=new Int32Array(e.length),r=0;for(let n of e)t[r++]=n;return t}static getCodeword(e){let t=L.binarySearch(tL.SYMBOL_TABLE,262143&e);return t<0?-1:(tL.CODEWORD_TABLE[t]-1)%tL.NUMBER_OF_CODEWORDS}}tL.NUMBER_OF_CODEWORDS=929,tL.MAX_CODEWORDS_IN_BARCODE=tL.NUMBER_OF_CODEWORDS-1,tL.MIN_ROWS_IN_BARCODE=3,tL.MAX_ROWS_IN_BARCODE=90,tL.MODULES_IN_CODEWORD=17,tL.MODULES_IN_STOP_PATTERN=18,tL.BARS_IN_MODULE=8,tL.EMPTY_INT_ARRAY=new Int32Array([]),tL.SYMBOL_TABLE=Int32Array.from([66142,66170,66206,66236,66290,66292,66350,66382,66396,66454,66470,66476,66594,66600,66614,66626,66628,66632,66640,66654,66662,66668,66682,66690,66718,66720,66748,66758,66776,66798,66802,66804,66820,66824,66832,66846,66848,66876,66880,66936,66950,66956,66968,66992,67006,67022,67036,67042,67044,67048,67062,67118,67150,67164,67214,67228,67256,67294,67322,67350,67366,67372,67398,67404,67416,67438,67474,67476,67490,67492,67496,67510,67618,67624,67650,67656,67664,67678,67686,67692,67706,67714,67716,67728,67742,67744,67772,67782,67788,67800,67822,67826,67828,67842,67848,67870,67872,67900,67904,67960,67974,67992,68016,68030,68046,68060,68066,68068,68072,68086,68104,68112,68126,68128,68156,68160,68216,68336,68358,68364,68376,68400,68414,68448,68476,68494,68508,68536,68546,68548,68552,68560,68574,68582,68588,68654,68686,68700,68706,68708,68712,68726,68750,68764,68792,68802,68804,68808,68816,68830,68838,68844,68858,68878,68892,68920,68976,68990,68994,68996,69e3,69008,69022,69024,69052,69062,69068,69080,69102,69106,69108,69142,69158,69164,69190,69208,69230,69254,69260,69272,69296,69310,69326,69340,69386,69394,69396,69410,69416,69430,69442,69444,69448,69456,69470,69478,69484,69554,69556,69666,69672,69698,69704,69712,69726,69754,69762,69764,69776,69790,69792,69820,69830,69836,69848,69870,69874,69876,69890,69918,69920,69948,69952,70008,70022,70040,70064,70078,70094,70108,70114,70116,70120,70134,70152,70174,70176,70264,70384,70412,70448,70462,70496,70524,70542,70556,70584,70594,70600,70608,70622,70630,70636,70664,70672,70686,70688,70716,70720,70776,70896,71136,71180,71192,71216,71230,71264,71292,71360,71416,71452,71480,71536,71550,71554,71556,71560,71568,71582,71584,71612,71622,71628,71640,71662,71726,71732,71758,71772,71778,71780,71784,71798,71822,71836,71864,71874,71880,71888,71902,71910,71916,71930,71950,71964,71992,72048,72062,72066,72068,72080,72094,72096,72124,72134,72140,72152,72174,72178,72180,72206,72220,72248,72304,72318,72416,72444,72456,72464,72478,72480,72508,72512,72568,72588,72600,72624,72638,72654,72668,72674,72676,72680,72694,72726,72742,72748,72774,72780,72792,72814,72838,72856,72880,72894,72910,72924,72930,72932,72936,72950,72966,72972,72984,73008,73022,73056,73084,73102,73116,73144,73156,73160,73168,73182,73190,73196,73210,73226,73234,73236,73250,73252,73256,73270,73282,73284,73296,73310,73318,73324,73346,73348,73352,73360,73374,73376,73404,73414,73420,73432,73454,73498,73518,73522,73524,73550,73564,73570,73572,73576,73590,73800,73822,73858,73860,73872,73886,73888,73916,73944,73970,73972,73992,74014,74016,74044,74048,74104,74118,74136,74160,74174,74210,74212,74216,74230,74244,74256,74270,74272,74360,74480,74502,74508,74544,74558,74592,74620,74638,74652,74680,74690,74696,74704,74726,74732,74782,74784,74812,74992,75232,75288,75326,75360,75388,75456,75512,75576,75632,75646,75650,75652,75664,75678,75680,75708,75718,75724,75736,75758,75808,75836,75840,75896,76016,76256,76736,76824,76848,76862,76896,76924,76992,77048,77296,77340,77368,77424,77438,77536,77564,77572,77576,77584,77600,77628,77632,77688,77702,77708,77720,77744,77758,77774,77788,77870,77902,77916,77922,77928,77966,77980,78008,78018,78024,78032,78046,78060,78074,78094,78136,78192,78206,78210,78212,78224,78238,78240,78268,78278,78284,78296,78322,78324,78350,78364,78448,78462,78560,78588,78600,78622,78624,78652,78656,78712,78726,78744,78768,78782,78798,78812,78818,78820,78824,78838,78862,78876,78904,78960,78974,79072,79100,79296,79352,79368,79376,79390,79392,79420,79424,79480,79600,79628,79640,79664,79678,79712,79740,79772,79800,79810,79812,79816,79824,79838,79846,79852,79894,79910,79916,79942,79948,79960,79982,79988,80006,80024,80048,80062,80078,80092,80098,80100,80104,80134,80140,80176,80190,80224,80252,80270,80284,80312,80328,80336,80350,80358,80364,80378,80390,80396,80408,80432,80446,80480,80508,80576,80632,80654,80668,80696,80752,80766,80776,80784,80798,80800,80828,80844,80856,80878,80882,80884,80914,80916,80930,80932,80936,80950,80962,80968,80976,80990,80998,81004,81026,81028,81040,81054,81056,81084,81094,81100,81112,81134,81154,81156,81160,81168,81182,81184,81212,81216,81272,81286,81292,81304,81328,81342,81358,81372,81380,81384,81398,81434,81454,81458,81460,81486,81500,81506,81508,81512,81526,81550,81564,81592,81602,81604,81608,81616,81630,81638,81644,81702,81708,81722,81734,81740,81752,81774,81778,81780,82050,82078,82080,82108,82180,82184,82192,82206,82208,82236,82240,82296,82316,82328,82352,82366,82402,82404,82408,82440,82448,82462,82464,82492,82496,82552,82672,82694,82700,82712,82736,82750,82784,82812,82830,82882,82884,82888,82896,82918,82924,82952,82960,82974,82976,83004,83008,83064,83184,83424,83468,83480,83504,83518,83552,83580,83648,83704,83740,83768,83824,83838,83842,83844,83848,83856,83872,83900,83910,83916,83928,83950,83984,84e3,84028,84032,84088,84208,84448,84928,85040,85054,85088,85116,85184,85240,85488,85560,85616,85630,85728,85756,85764,85768,85776,85790,85792,85820,85824,85880,85894,85900,85912,85936,85966,85980,86048,86080,86136,86256,86496,86976,88160,88188,88256,88312,88560,89056,89200,89214,89312,89340,89536,89592,89608,89616,89632,89664,89720,89840,89868,89880,89904,89952,89980,89998,90012,90040,90190,90204,90254,90268,90296,90306,90308,90312,90334,90382,90396,90424,90480,90494,90500,90504,90512,90526,90528,90556,90566,90572,90584,90610,90612,90638,90652,90680,90736,90750,90848,90876,90884,90888,90896,90910,90912,90940,90944,91e3,91014,91020,91032,91056,91070,91086,91100,91106,91108,91112,91126,91150,91164,91192,91248,91262,91360,91388,91584,91640,91664,91678,91680,91708,91712,91768,91888,91928,91952,91966,92e3,92028,92046,92060,92088,92098,92100,92104,92112,92126,92134,92140,92188,92216,92272,92384,92412,92608,92664,93168,93200,93214,93216,93244,93248,93304,93424,93664,93720,93744,93758,93792,93820,93888,93944,93980,94008,94064,94078,94084,94088,94096,94110,94112,94140,94150,94156,94168,94246,94252,94278,94284,94296,94318,94342,94348,94360,94384,94398,94414,94428,94440,94470,94476,94488,94512,94526,94560,94588,94606,94620,94648,94658,94660,94664,94672,94686,94694,94700,94714,94726,94732,94744,94768,94782,94816,94844,94912,94968,94990,95004,95032,95088,95102,95112,95120,95134,95136,95164,95180,95192,95214,95218,95220,95244,95256,95280,95294,95328,95356,95424,95480,95728,95758,95772,95800,95856,95870,95968,95996,96008,96016,96030,96032,96060,96064,96120,96152,96176,96190,96220,96226,96228,96232,96290,96292,96296,96310,96322,96324,96328,96336,96350,96358,96364,96386,96388,96392,96400,96414,96416,96444,96454,96460,96472,96494,96498,96500,96514,96516,96520,96528,96542,96544,96572,96576,96632,96646,96652,96664,96688,96702,96718,96732,96738,96740,96744,96758,96772,96776,96784,96798,96800,96828,96832,96888,97008,97030,97036,97048,97072,97086,97120,97148,97166,97180,97208,97220,97224,97232,97246,97254,97260,97326,97330,97332,97358,97372,97378,97380,97384,97398,97422,97436,97464,97474,97476,97480,97488,97502,97510,97516,97550,97564,97592,97648,97666,97668,97672,97680,97694,97696,97724,97734,97740,97752,97774,97830,97836,97850,97862,97868,97880,97902,97906,97908,97926,97932,97944,97968,97998,98012,98018,98020,98024,98038,98618,98674,98676,98838,98854,98874,98892,98904,98926,98930,98932,98968,99006,99042,99044,99048,99062,99166,99194,99246,99286,99350,99366,99372,99386,99398,99416,99438,99442,99444,99462,99504,99518,99534,99548,99554,99556,99560,99574,99590,99596,99608,99632,99646,99680,99708,99726,99740,99768,99778,99780,99784,99792,99806,99814,99820,99834,99858,99860,99874,99880,99894,99906,99920,99934,99962,99970,99972,99976,99984,99998,1e5,100028,100038,100044,100056,100078,100082,100084,100142,100174,100188,100246,100262,100268,100306,100308,100390,100396,100410,100422,100428,100440,100462,100466,100468,100486,100504,100528,100542,100558,100572,100578,100580,100584,100598,100620,100656,100670,100704,100732,100750,100792,100802,100808,100816,100830,100838,100844,100858,100888,100912,100926,100960,100988,101056,101112,101148,101176,101232,101246,101250,101252,101256,101264,101278,101280,101308,101318,101324,101336,101358,101362,101364,101410,101412,101416,101430,101442,101448,101456,101470,101478,101498,101506,101508,101520,101534,101536,101564,101580,101618,101620,101636,101640,101648,101662,101664,101692,101696,101752,101766,101784,101838,101858,101860,101864,101934,101938,101940,101966,101980,101986,101988,101992,102030,102044,102072,102082,102084,102088,102096,102138,102166,102182,102188,102214,102220,102232,102254,102282,102290,102292,102306,102308,102312,102326,102444,102458,102470,102476,102488,102514,102516,102534,102552,102576,102590,102606,102620,102626,102632,102646,102662,102668,102704,102718,102752,102780,102798,102812,102840,102850,102856,102864,102878,102886,102892,102906,102936,102974,103008,103036,103104,103160,103224,103280,103294,103298,103300,103312,103326,103328,103356,103366,103372,103384,103406,103410,103412,103472,103486,103520,103548,103616,103672,103920,103992,104048,104062,104160,104188,104194,104196,104200,104208,104224,104252,104256,104312,104326,104332,104344,104368,104382,104398,104412,104418,104420,104424,104482,104484,104514,104520,104528,104542,104550,104570,104578,104580,104592,104606,104608,104636,104652,104690,104692,104706,104712,104734,104736,104764,104768,104824,104838,104856,104910,104930,104932,104936,104968,104976,104990,104992,105020,105024,105080,105200,105240,105278,105312,105372,105410,105412,105416,105424,105446,105518,105524,105550,105564,105570,105572,105576,105614,105628,105656,105666,105672,105680,105702,105722,105742,105756,105784,105840,105854,105858,105860,105864,105872,105888,105932,105970,105972,106006,106022,106028,106054,106060,106072,106100,106118,106124,106136,106160,106174,106190,106210,106212,106216,106250,106258,106260,106274,106276,106280,106306,106308,106312,106320,106334,106348,106394,106414,106418,106420,106566,106572,106610,106612,106630,106636,106648,106672,106686,106722,106724,106728,106742,106758,106764,106776,106800,106814,106848,106876,106894,106908,106936,106946,106948,106952,106960,106974,106982,106988,107032,107056,107070,107104,107132,107200,107256,107292,107320,107376,107390,107394,107396,107400,107408,107422,107424,107452,107462,107468,107480,107502,107506,107508,107544,107568,107582,107616,107644,107712,107768,108016,108060,108088,108144,108158,108256,108284,108290,108292,108296,108304,108318,108320,108348,108352,108408,108422,108428,108440,108464,108478,108494,108508,108514,108516,108520,108592,108640,108668,108736,108792,109040,109536,109680,109694,109792,109820,110016,110072,110084,110088,110096,110112,110140,110144,110200,110320,110342,110348,110360,110384,110398,110432,110460,110478,110492,110520,110532,110536,110544,110558,110658,110686,110714,110722,110724,110728,110736,110750,110752,110780,110796,110834,110836,110850,110852,110856,110864,110878,110880,110908,110912,110968,110982,111e3,111054,111074,111076,111080,111108,111112,111120,111134,111136,111164,111168,111224,111344,111372,111422,111456,111516,111554,111556,111560,111568,111590,111632,111646,111648,111676,111680,111736,111856,112096,112152,112224,112252,112320,112440,112514,112516,112520,112528,112542,112544,112588,112686,112718,112732,112782,112796,112824,112834,112836,112840,112848,112870,112890,112910,112924,112952,113008,113022,113026,113028,113032,113040,113054,113056,113100,113138,113140,113166,113180,113208,113264,113278,113376,113404,113416,113424,113440,113468,113472,113560,113614,113634,113636,113640,113686,113702,113708,113734,113740,113752,113778,113780,113798,113804,113816,113840,113854,113870,113890,113892,113896,113926,113932,113944,113968,113982,114016,114044,114076,114114,114116,114120,114128,114150,114170,114194,114196,114210,114212,114216,114242,114244,114248,114256,114270,114278,114306,114308,114312,114320,114334,114336,114364,114380,114420,114458,114478,114482,114484,114510,114524,114530,114532,114536,114842,114866,114868,114970,114994,114996,115042,115044,115048,115062,115130,115226,115250,115252,115278,115292,115298,115300,115304,115318,115342,115394,115396,115400,115408,115422,115430,115436,115450,115478,115494,115514,115526,115532,115570,115572,115738,115758,115762,115764,115790,115804,115810,115812,115816,115830,115854,115868,115896,115906,115912,115920,115934,115942,115948,115962,115996,116024,116080,116094,116098,116100,116104,116112,116126,116128,116156,116166,116172,116184,116206,116210,116212,116246,116262,116268,116282,116294,116300,116312,116334,116338,116340,116358,116364,116376,116400,116414,116430,116444,116450,116452,116456,116498,116500,116514,116520,116534,116546,116548,116552,116560,116574,116582,116588,116602,116654,116694,116714,116762,116782,116786,116788,116814,116828,116834,116836,116840,116854,116878,116892,116920,116930,116936,116944,116958,116966,116972,116986,117006,117048,117104,117118,117122,117124,117136,117150,117152,117180,117190,117196,117208,117230,117234,117236,117304,117360,117374,117472,117500,117506,117508,117512,117520,117536,117564,117568,117624,117638,117644,117656,117680,117694,117710,117724,117730,117732,117736,117750,117782,117798,117804,117818,117830,117848,117874,117876,117894,117936,117950,117966,117986,117988,117992,118022,118028,118040,118064,118078,118112,118140,118172,118210,118212,118216,118224,118238,118246,118266,118306,118312,118338,118352,118366,118374,118394,118402,118404,118408,118416,118430,118432,118460,118476,118514,118516,118574,118578,118580,118606,118620,118626,118628,118632,118678,118694,118700,118730,118738,118740,118830,118834,118836,118862,118876,118882,118884,118888,118902,118926,118940,118968,118978,118980,118984,118992,119006,119014,119020,119034,119068,119096,119152,119166,119170,119172,119176,119184,119198,119200,119228,119238,119244,119256,119278,119282,119284,119324,119352,119408,119422,119520,119548,119554,119556,119560,119568,119582,119584,119612,119616,119672,119686,119692,119704,119728,119742,119758,119772,119778,119780,119784,119798,119920,119934,120032,120060,120256,120312,120324,120328,120336,120352,120384,120440,120560,120582,120588,120600,120624,120638,120672,120700,120718,120732,120760,120770,120772,120776,120784,120798,120806,120812,120870,120876,120890,120902,120908,120920,120946,120948,120966,120972,120984,121008,121022,121038,121058,121060,121064,121078,121100,121112,121136,121150,121184,121212,121244,121282,121284,121288,121296,121318,121338,121356,121368,121392,121406,121440,121468,121536,121592,121656,121730,121732,121736,121744,121758,121760,121804,121842,121844,121890,121922,121924,121928,121936,121950,121958,121978,121986,121988,121992,122e3,122014,122016,122044,122060,122098,122100,122116,122120,122128,122142,122144,122172,122176,122232,122246,122264,122318,122338,122340,122344,122414,122418,122420,122446,122460,122466,122468,122472,122510,122524,122552,122562,122564,122568,122576,122598,122618,122646,122662,122668,122694,122700,122712,122738,122740,122762,122770,122772,122786,122788,122792,123018,123026,123028,123042,123044,123048,123062,123098,123146,123154,123156,123170,123172,123176,123190,123202,123204,123208,123216,123238,123244,123258,123290,123314,123316,123402,123410,123412,123426,123428,123432,123446,123458,123464,123472,123486,123494,123500,123514,123522,123524,123528,123536,123552,123580,123590,123596,123608,123630,123634,123636,123674,123698,123700,123740,123746,123748,123752,123834,123914,123922,123924,123938,123944,123958,123970,123976,123984,123998,124006,124012,124026,124034,124036,124048,124062,124064,124092,124102,124108,124120,124142,124146,124148,124162,124164,124168,124176,124190,124192,124220,124224,124280,124294,124300,124312,124336,124350,124366,124380,124386,124388,124392,124406,124442,124462,124466,124468,124494,124508,124514,124520,124558,124572,124600,124610,124612,124616,124624,124646,124666,124694,124710,124716,124730,124742,124748,124760,124786,124788,124818,124820,124834,124836,124840,124854,124946,124948,124962,124964,124968,124982,124994,124996,125e3,125008,125022,125030,125036,125050,125058,125060,125064,125072,125086,125088,125116,125126,125132,125144,125166,125170,125172,125186,125188,125192,125200,125216,125244,125248,125304,125318,125324,125336,125360,125374,125390,125404,125410,125412,125416,125430,125444,125448,125456,125472,125504,125560,125680,125702,125708,125720,125744,125758,125792,125820,125838,125852,125880,125890,125892,125896,125904,125918,125926,125932,125978,125998,126002,126004,126030,126044,126050,126052,126056,126094,126108,126136,126146,126148,126152,126160,126182,126202,126222,126236,126264,126320,126334,126338,126340,126344,126352,126366,126368,126412,126450,126452,126486,126502,126508,126522,126534,126540,126552,126574,126578,126580,126598,126604,126616,126640,126654,126670,126684,126690,126692,126696,126738,126754,126756,126760,126774,126786,126788,126792,126800,126814,126822,126828,126842,126894,126898,126900,126934,127126,127142,127148,127162,127178,127186,127188,127254,127270,127276,127290,127302,127308,127320,127342,127346,127348,127370,127378,127380,127394,127396,127400,127450,127510,127526,127532,127546,127558,127576,127598,127602,127604,127622,127628,127640,127664,127678,127694,127708,127714,127716,127720,127734,127754,127762,127764,127778,127784,127810,127812,127816,127824,127838,127846,127866,127898,127918,127922,127924,128022,128038,128044,128058,128070,128076,128088,128110,128114,128116,128134,128140,128152,128176,128190,128206,128220,128226,128228,128232,128246,128262,128268,128280,128304,128318,128352,128380,128398,128412,128440,128450,128452,128456,128464,128478,128486,128492,128506,128522,128530,128532,128546,128548,128552,128566,128578,128580,128584,128592,128606,128614,128634,128642,128644,128648,128656,128670,128672,128700,128716,128754,128756,128794,128814,128818,128820,128846,128860,128866,128868,128872,128886,128918,128934,128940,128954,128978,128980,129178,129198,129202,129204,129238,129258,129306,129326,129330,129332,129358,129372,129378,129380,129384,129398,129430,129446,129452,129466,129482,129490,129492,129562,129582,129586,129588,129614,129628,129634,129636,129640,129654,129678,129692,129720,129730,129732,129736,129744,129758,129766,129772,129814,129830,129836,129850,129862,129868,129880,129902,129906,129908,129930,129938,129940,129954,129956,129960,129974,130010]),tL.CODEWORD_TABLE=Int32Array.from([2627,1819,2622,2621,1813,1812,2729,2724,2723,2779,2774,2773,902,896,908,868,865,861,859,2511,873,871,1780,835,2493,825,2491,842,837,844,1764,1762,811,810,809,2483,807,2482,806,2480,815,814,813,812,2484,817,816,1745,1744,1742,1746,2655,2637,2635,2626,2625,2623,2628,1820,2752,2739,2737,2728,2727,2725,2730,2785,2783,2778,2777,2775,2780,787,781,747,739,736,2413,754,752,1719,692,689,681,2371,678,2369,700,697,694,703,1688,1686,642,638,2343,631,2341,627,2338,651,646,643,2345,654,652,1652,1650,1647,1654,601,599,2322,596,2321,594,2319,2317,611,610,608,606,2324,603,2323,615,614,612,1617,1616,1614,1612,616,1619,1618,2575,2538,2536,905,901,898,909,2509,2507,2504,870,867,864,860,2512,875,872,1781,2490,2489,2487,2485,1748,836,834,832,830,2494,827,2492,843,841,839,845,1765,1763,2701,2676,2674,2653,2648,2656,2634,2633,2631,2629,1821,2638,2636,2770,2763,2761,2750,2745,2753,2736,2735,2733,2731,1848,2740,2738,2786,2784,591,588,576,569,566,2296,1590,537,534,526,2276,522,2274,545,542,539,548,1572,1570,481,2245,466,2242,462,2239,492,485,482,2249,496,494,1534,1531,1528,1538,413,2196,406,2191,2188,425,419,2202,415,2199,432,430,427,1472,1467,1464,433,1476,1474,368,367,2160,365,2159,362,2157,2155,2152,378,377,375,2166,372,2165,369,2162,383,381,379,2168,1419,1418,1416,1414,385,1411,384,1423,1422,1420,1424,2461,802,2441,2439,790,786,783,794,2409,2406,2403,750,742,738,2414,756,753,1720,2367,2365,2362,2359,1663,693,691,684,2373,680,2370,702,699,696,704,1690,1687,2337,2336,2334,2332,1624,2329,1622,640,637,2344,634,2342,630,2340,650,648,645,2346,655,653,1653,1651,1649,1655,2612,2597,2595,2571,2568,2565,2576,2534,2529,2526,1787,2540,2537,907,904,900,910,2503,2502,2500,2498,1768,2495,1767,2510,2508,2506,869,866,863,2513,876,874,1782,2720,2713,2711,2697,2694,2691,2702,2672,2670,2664,1828,2678,2675,2647,2646,2644,2642,1823,2639,1822,2654,2652,2650,2657,2771,1855,2765,2762,1850,1849,2751,2749,2747,2754,353,2148,344,342,336,2142,332,2140,345,1375,1373,306,2130,299,2128,295,2125,319,314,311,2132,1354,1352,1349,1356,262,257,2101,253,2096,2093,274,273,267,2107,263,2104,280,278,275,1316,1311,1308,1320,1318,2052,202,2050,2044,2040,219,2063,212,2060,208,2055,224,221,2066,1260,1258,1252,231,1248,229,1266,1264,1261,1268,155,1998,153,1996,1994,1991,1988,165,164,2007,162,2006,159,2003,2e3,172,171,169,2012,166,2010,1186,1184,1182,1179,175,1176,173,1192,1191,1189,1187,176,1194,1193,2313,2307,2305,592,589,2294,2292,2289,578,572,568,2297,580,1591,2272,2267,2264,1547,538,536,529,2278,525,2275,547,544,541,1574,1571,2237,2235,2229,1493,2225,1489,478,2247,470,2244,465,2241,493,488,484,2250,498,495,1536,1533,1530,1539,2187,2186,2184,2182,1432,2179,1430,2176,1427,414,412,2197,409,2195,405,2193,2190,426,424,421,2203,418,2201,431,429,1473,1471,1469,1466,434,1477,1475,2478,2472,2470,2459,2457,2454,2462,803,2437,2432,2429,1726,2443,2440,792,789,785,2401,2399,2393,1702,2389,1699,2411,2408,2405,745,741,2415,758,755,1721,2358,2357,2355,2353,1661,2350,1660,2347,1657,2368,2366,2364,2361,1666,690,687,2374,683,2372,701,698,705,1691,1689,2619,2617,2610,2608,2605,2613,2593,2588,2585,1803,2599,2596,2563,2561,2555,1797,2551,1795,2573,2570,2567,2577,2525,2524,2522,2520,1786,2517,1785,2514,1783,2535,2533,2531,2528,1788,2541,2539,906,903,911,2721,1844,2715,2712,1838,1836,2699,2696,2693,2703,1827,1826,1824,2673,2671,2669,2666,1829,2679,2677,1858,1857,2772,1854,1853,1851,1856,2766,2764,143,1987,139,1986,135,133,131,1984,128,1983,125,1981,138,137,136,1985,1133,1132,1130,112,110,1974,107,1973,104,1971,1969,122,121,119,117,1977,114,1976,124,1115,1114,1112,1110,1117,1116,84,83,1953,81,1952,78,1950,1948,1945,94,93,91,1959,88,1958,85,1955,99,97,95,1961,1086,1085,1083,1081,1078,100,1090,1089,1087,1091,49,47,1917,44,1915,1913,1910,1907,59,1926,56,1925,53,1922,1919,66,64,1931,61,1929,1042,1040,1038,71,1035,70,1032,68,1048,1047,1045,1043,1050,1049,12,10,1869,1867,1864,1861,21,1880,19,1877,1874,1871,28,1888,25,1886,22,1883,982,980,977,974,32,30,991,989,987,984,34,995,994,992,2151,2150,2147,2146,2144,356,355,354,2149,2139,2138,2136,2134,1359,343,341,338,2143,335,2141,348,347,346,1376,1374,2124,2123,2121,2119,1326,2116,1324,310,308,305,2131,302,2129,298,2127,320,318,316,313,2133,322,321,1355,1353,1351,1357,2092,2091,2089,2087,1276,2084,1274,2081,1271,259,2102,256,2100,252,2098,2095,272,269,2108,266,2106,281,279,277,1317,1315,1313,1310,282,1321,1319,2039,2037,2035,2032,1203,2029,1200,1197,207,2053,205,2051,201,2049,2046,2043,220,218,2064,215,2062,211,2059,228,226,223,2069,1259,1257,1254,232,1251,230,1267,1265,1263,2316,2315,2312,2311,2309,2314,2304,2303,2301,2299,1593,2308,2306,590,2288,2287,2285,2283,1578,2280,1577,2295,2293,2291,579,577,574,571,2298,582,581,1592,2263,2262,2260,2258,1545,2255,1544,2252,1541,2273,2271,2269,2266,1550,535,532,2279,528,2277,546,543,549,1575,1573,2224,2222,2220,1486,2217,1485,2214,1482,1479,2238,2236,2234,2231,1496,2228,1492,480,477,2248,473,2246,469,2243,490,487,2251,497,1537,1535,1532,2477,2476,2474,2479,2469,2468,2466,2464,1730,2473,2471,2453,2452,2450,2448,1729,2445,1728,2460,2458,2456,2463,805,804,2428,2427,2425,2423,1725,2420,1724,2417,1722,2438,2436,2434,2431,1727,2444,2442,793,791,788,795,2388,2386,2384,1697,2381,1696,2378,1694,1692,2402,2400,2398,2395,1703,2392,1701,2412,2410,2407,751,748,744,2416,759,757,1807,2620,2618,1806,1805,2611,2609,2607,2614,1802,1801,1799,2594,2592,2590,2587,1804,2600,2598,1794,1793,1791,1789,2564,2562,2560,2557,1798,2554,1796,2574,2572,2569,2578,1847,1846,2722,1843,1842,1840,1845,2716,2714,1835,1834,1832,1830,1839,1837,2700,2698,2695,2704,1817,1811,1810,897,862,1777,829,826,838,1760,1758,808,2481,1741,1740,1738,1743,2624,1818,2726,2776,782,740,737,1715,686,679,695,1682,1680,639,628,2339,647,644,1645,1643,1640,1648,602,600,597,595,2320,593,2318,609,607,604,1611,1610,1608,1606,613,1615,1613,2328,926,924,892,886,899,857,850,2505,1778,824,823,821,819,2488,818,2486,833,831,828,840,1761,1759,2649,2632,2630,2746,2734,2732,2782,2781,570,567,1587,531,527,523,540,1566,1564,476,467,463,2240,486,483,1524,1521,1518,1529,411,403,2192,399,2189,423,416,1462,1457,1454,428,1468,1465,2210,366,363,2158,360,2156,357,2153,376,373,370,2163,1410,1409,1407,1405,382,1402,380,1417,1415,1412,1421,2175,2174,777,774,771,784,732,725,722,2404,743,1716,676,674,668,2363,665,2360,685,1684,1681,626,624,622,2335,620,2333,617,2330,641,635,649,1646,1644,1642,2566,928,925,2530,2527,894,891,888,2501,2499,2496,858,856,854,851,1779,2692,2668,2665,2645,2643,2640,2651,2768,2759,2757,2744,2743,2741,2748,352,1382,340,337,333,1371,1369,307,300,296,2126,315,312,1347,1342,1350,261,258,250,2097,246,2094,271,268,264,1306,1301,1298,276,1312,1309,2115,203,2048,195,2045,191,2041,213,209,2056,1246,1244,1238,225,1234,222,1256,1253,1249,1262,2080,2079,154,1997,150,1995,147,1992,1989,163,160,2004,156,2001,1175,1174,1172,1170,1167,170,1164,167,1185,1183,1180,1177,174,1190,1188,2025,2024,2022,587,586,564,559,556,2290,573,1588,520,518,512,2268,508,2265,530,1568,1565,461,457,2233,450,2230,446,2226,479,471,489,1526,1523,1520,397,395,2185,392,2183,389,2180,2177,410,2194,402,422,1463,1461,1459,1456,1470,2455,799,2433,2430,779,776,773,2397,2394,2390,734,728,724,746,1717,2356,2354,2351,2348,1658,677,675,673,670,667,688,1685,1683,2606,2589,2586,2559,2556,2552,927,2523,2521,2518,2515,1784,2532,895,893,890,2718,2709,2707,2689,2687,2684,2663,2662,2660,2658,1825,2667,2769,1852,2760,2758,142,141,1139,1138,134,132,129,126,1982,1129,1128,1126,1131,113,111,108,105,1972,101,1970,120,118,115,1109,1108,1106,1104,123,1113,1111,82,79,1951,75,1949,72,1946,92,89,86,1956,1077,1076,1074,1072,98,1069,96,1084,1082,1079,1088,1968,1967,48,45,1916,42,1914,39,1911,1908,60,57,54,1923,50,1920,1031,1030,1028,1026,67,1023,65,1020,62,1041,1039,1036,1033,69,1046,1044,1944,1943,1941,11,9,1868,7,1865,1862,1859,20,1878,16,1875,13,1872,970,968,966,963,29,960,26,23,983,981,978,975,33,971,31,990,988,985,1906,1904,1902,993,351,2145,1383,331,330,328,326,2137,323,2135,339,1372,1370,294,293,291,289,2122,286,2120,283,2117,309,303,317,1348,1346,1344,245,244,242,2090,239,2088,236,2085,2082,260,2099,249,270,1307,1305,1303,1300,1314,189,2038,186,2036,183,2033,2030,2026,206,198,2047,194,216,1247,1245,1243,1240,227,1237,1255,2310,2302,2300,2286,2284,2281,565,563,561,558,575,1589,2261,2259,2256,2253,1542,521,519,517,514,2270,511,533,1569,1567,2223,2221,2218,2215,1483,2211,1480,459,456,453,2232,449,474,491,1527,1525,1522,2475,2467,2465,2451,2449,2446,801,800,2426,2424,2421,2418,1723,2435,780,778,775,2387,2385,2382,2379,1695,2375,1693,2396,735,733,730,727,749,1718,2616,2615,2604,2603,2601,2584,2583,2581,2579,1800,2591,2550,2549,2547,2545,1792,2542,1790,2558,929,2719,1841,2710,2708,1833,1831,2690,2688,2686,1815,1809,1808,1774,1756,1754,1737,1736,1734,1739,1816,1711,1676,1674,633,629,1638,1636,1633,1641,598,1605,1604,1602,1600,605,1609,1607,2327,887,853,1775,822,820,1757,1755,1584,524,1560,1558,468,464,1514,1511,1508,1519,408,404,400,1452,1447,1444,417,1458,1455,2208,364,361,358,2154,1401,1400,1398,1396,374,1393,371,1408,1406,1403,1413,2173,2172,772,726,723,1712,672,669,666,682,1678,1675,625,623,621,618,2331,636,632,1639,1637,1635,920,918,884,880,889,849,848,847,846,2497,855,852,1776,2641,2742,2787,1380,334,1367,1365,301,297,1340,1338,1335,1343,255,251,247,1296,1291,1288,265,1302,1299,2113,204,196,192,2042,1232,1230,1224,214,1220,210,1242,1239,1235,1250,2077,2075,151,148,1993,144,1990,1163,1162,1160,1158,1155,161,1152,157,1173,1171,1168,1165,168,1181,1178,2021,2020,2018,2023,585,560,557,1585,516,509,1562,1559,458,447,2227,472,1516,1513,1510,398,396,393,390,2181,386,2178,407,1453,1451,1449,1446,420,1460,2209,769,764,720,712,2391,729,1713,664,663,661,659,2352,656,2349,671,1679,1677,2553,922,919,2519,2516,885,883,881,2685,2661,2659,2767,2756,2755,140,1137,1136,130,127,1125,1124,1122,1127,109,106,102,1103,1102,1100,1098,116,1107,1105,1980,80,76,73,1947,1068,1067,1065,1063,90,1060,87,1075,1073,1070,1080,1966,1965,46,43,40,1912,36,1909,1019,1018,1016,1014,58,1011,55,1008,51,1029,1027,1024,1021,63,1037,1034,1940,1939,1937,1942,8,1866,4,1863,1,1860,956,954,952,949,946,17,14,969,967,964,961,27,957,24,979,976,972,1901,1900,1898,1896,986,1905,1903,350,349,1381,329,327,324,1368,1366,292,290,287,284,2118,304,1341,1339,1337,1345,243,240,237,2086,233,2083,254,1297,1295,1293,1290,1304,2114,190,187,184,2034,180,2031,177,2027,199,1233,1231,1229,1226,217,1223,1241,2078,2076,584,555,554,552,550,2282,562,1586,507,506,504,502,2257,499,2254,515,1563,1561,445,443,441,2219,438,2216,435,2212,460,454,475,1517,1515,1512,2447,798,797,2422,2419,770,768,766,2383,2380,2376,721,719,717,714,731,1714,2602,2582,2580,2548,2546,2543,923,921,2717,2706,2705,2683,2682,2680,1771,1752,1750,1733,1732,1731,1735,1814,1707,1670,1668,1631,1629,1626,1634,1599,1598,1596,1594,1603,1601,2326,1772,1753,1751,1581,1554,1552,1504,1501,1498,1509,1442,1437,1434,401,1448,1445,2206,1392,1391,1389,1387,1384,359,1399,1397,1394,1404,2171,2170,1708,1672,1669,619,1632,1630,1628,1773,1378,1363,1361,1333,1328,1336,1286,1281,1278,248,1292,1289,2111,1218,1216,1210,197,1206,193,1228,1225,1221,1236,2073,2071,1151,1150,1148,1146,152,1143,149,1140,145,1161,1159,1156,1153,158,1169,1166,2017,2016,2014,2019,1582,510,1556,1553,452,448,1506,1500,394,391,387,1443,1441,1439,1436,1450,2207,765,716,713,1709,662,660,657,1673,1671,916,914,879,878,877,882,1135,1134,1121,1120,1118,1123,1097,1096,1094,1092,103,1101,1099,1979,1059,1058,1056,1054,77,1051,74,1066,1064,1061,1071,1964,1963,1007,1006,1004,1002,999,41,996,37,1017,1015,1012,1009,52,1025,1022,1936,1935,1933,1938,942,940,938,935,932,5,2,955,953,950,947,18,943,15,965,962,958,1895,1894,1892,1890,973,1899,1897,1379,325,1364,1362,288,285,1334,1332,1330,241,238,234,1287,1285,1283,1280,1294,2112,188,185,181,178,2028,1219,1217,1215,1212,200,1209,1227,2074,2072,583,553,551,1583,505,503,500,513,1557,1555,444,442,439,436,2213,455,451,1507,1505,1502,796,763,762,760,767,711,710,708,706,2377,718,715,1710,2544,917,915,2681,1627,1597,1595,2325,1769,1749,1747,1499,1438,1435,2204,1390,1388,1385,1395,2169,2167,1704,1665,1662,1625,1623,1620,1770,1329,1282,1279,2109,1214,1207,1222,2068,2065,1149,1147,1144,1141,146,1157,1154,2013,2011,2008,2015,1579,1549,1546,1495,1487,1433,1431,1428,1425,388,1440,2205,1705,658,1667,1664,1119,1095,1093,1978,1057,1055,1052,1062,1962,1960,1005,1003,1e3,997,38,1013,1010,1932,1930,1927,1934,941,939,936,933,6,930,3,951,948,944,1889,1887,1884,1881,959,1893,1891,35,1377,1360,1358,1327,1325,1322,1331,1277,1275,1272,1269,235,1284,2110,1205,1204,1201,1198,182,1195,179,1213,2070,2067,1580,501,1551,1548,440,437,1497,1494,1490,1503,761,709,707,1706,913,912,2198,1386,2164,2161,1621,1766,2103,1208,2058,2054,1145,1142,2005,2002,1999,2009,1488,1429,1426,2200,1698,1659,1656,1975,1053,1957,1954,1001,998,1924,1921,1918,1928,937,934,931,1879,1876,1873,1870,945,1885,1882,1323,1273,1270,2105,1202,1199,1196,1211,2061,2057,1576,1543,1540,1484,1481,1478,1491,1700]);class tk{constructor(e,t){this.bits=e,this.points=t}getBits(){return this.bits}getPoints(){return this.points}}class tF{static detectMultiple(e,t,r){let n=e.getBlackMatrix(),i=tF.detect(r,n);return i.length||((n=n.clone()).rotate180(),i=tF.detect(r,n)),new tk(n,i)}static detect(e,t){let r=[],n=0,i=0,o=!1;for(;n<t.getHeight();){let a=tF.findVertices(t,n,i);if(null==a[0]&&null==a[3]){if(!o)break;for(let e of(o=!1,i=0,r))null!=e[1]&&(n=Math.trunc(Math.max(n,e[1].getY()))),null!=e[3]&&(n=Math.max(n,Math.trunc(e[3].getY())));n+=tF.ROW_STEP;continue}if(o=!0,r.push(a),!e)break;null!=a[2]?(i=Math.trunc(a[2].getX()),n=Math.trunc(a[2].getY())):(i=Math.trunc(a[4].getX()),n=Math.trunc(a[4].getY()))}return r}static findVertices(e,t,r){let n=e.getHeight(),i=e.getWidth(),o=Array(8);return tF.copyToResult(o,tF.findRowsWithPattern(e,n,i,t,r,tF.START_PATTERN),tF.INDEXES_START_PATTERN),null!=o[4]&&(r=Math.trunc(o[4].getX()),t=Math.trunc(o[4].getY())),tF.copyToResult(o,tF.findRowsWithPattern(e,n,i,t,r,tF.STOP_PATTERN),tF.INDEXES_STOP_PATTERN),o}static copyToResult(e,t,r){for(let n=0;n<r.length;n++)e[r[n]]=t[n]}static findRowsWithPattern(e,t,r,n,i,o){let a=[,,,,],s=!1,l=new Int32Array(o.length);for(;n<t;n+=tF.ROW_STEP){let t=tF.findGuardPattern(e,i,n,r,!1,o,l);if(null!=t){for(;n>0;){let a=tF.findGuardPattern(e,i,--n,r,!1,o,l);if(null!=a)t=a;else{n++;break}}a[0]=new em(t[0],n),a[1]=new em(t[1],n),s=!0;break}}let c=n+1;if(s){let n=0,i=Int32Array.from([Math.trunc(a[0].getX()),Math.trunc(a[1].getX())]);for(;c<t;c++){let t=tF.findGuardPattern(e,i[0],c,r,!1,o,l);if(null!=t&&Math.abs(i[0]-t[0])<tF.MAX_PATTERN_DRIFT&&Math.abs(i[1]-t[1])<tF.MAX_PATTERN_DRIFT)i=t,n=0;else if(n>tF.SKIPPED_ROW_COUNT_MAX)break;else n++}c-=n+1,a[2]=new em(i[0],c),a[3]=new em(i[1],c)}return c-n<tF.BARCODE_MIN_HEIGHT&&L.fill(a,null),a}static findGuardPattern(e,t,r,n,i,o,a){L.fillWithin(a,0,a.length,0);let s=t,l=0;for(;e.get(s,r)&&s>0&&l++<tF.MAX_PIXEL_DRIFT;)s--;let c=s,u=0,h=o.length;for(let t=i;c<n;c++)if(e.get(c,r)!==t)a[u]++;else{if(u===h-1){if(tF.patternMatchVariance(a,o,tF.MAX_INDIVIDUAL_VARIANCE)<tF.MAX_AVG_VARIANCE)return new Int32Array([s,c]);s+=a[0]+a[1],P.arraycopy(a,2,a,0,u-1),a[u-1]=0,a[u]=0,u--}else u++;a[u]=1,t=!t}return u===h-1&&tF.patternMatchVariance(a,o,tF.MAX_INDIVIDUAL_VARIANCE)<tF.MAX_AVG_VARIANCE?new Int32Array([s,c-1]):null}static patternMatchVariance(e,t,r){let n=e.length,i=0,o=0;for(let r=0;r<n;r++)i+=e[r],o+=t[r];if(i<o)return 1/0;let a=i/o;r*=a;let s=0;for(let i=0;i<n;i++){let n=e[i],o=t[i]*a,l=n>o?n-o:o-n;if(l>r)return 1/0;s+=l}return s/i}}tF.INDEXES_START_PATTERN=Int32Array.from([0,4,1,5]),tF.INDEXES_STOP_PATTERN=Int32Array.from([6,2,7,3]),tF.MAX_AVG_VARIANCE=.42,tF.MAX_INDIVIDUAL_VARIANCE=.8,tF.START_PATTERN=Int32Array.from([8,1,1,1,1,1,1,3]),tF.STOP_PATTERN=Int32Array.from([7,1,1,3,1,1,1,2,1]),tF.MAX_PIXEL_DRIFT=3,tF.MAX_PATTERN_DRIFT=5,tF.SKIPPED_ROW_COUNT_MAX=25,tF.ROW_STEP=5,tF.BARCODE_MIN_HEIGHT=10;class tU{constructor(e,t){if(0===t.length)throw new D;this.field=e;let r=t.length;if(r>1&&0===t[0]){let e=1;for(;e<r&&0===t[e];)e++;e===r?this.coefficients=new Int32Array([0]):(this.coefficients=new Int32Array(r-e),P.arraycopy(t,e,this.coefficients,0,this.coefficients.length))}else this.coefficients=t}getCoefficients(){return this.coefficients}getDegree(){return this.coefficients.length-1}isZero(){return 0===this.coefficients[0]}getCoefficient(e){return this.coefficients[this.coefficients.length-1-e]}evaluateAt(e){if(0===e)return this.getCoefficient(0);if(1===e){let e=0;for(let t of this.coefficients)e=this.field.add(e,t);return e}let t=this.coefficients[0],r=this.coefficients.length;for(let n=1;n<r;n++)t=this.field.add(this.field.multiply(e,t),this.coefficients[n]);return t}add(e){if(!this.field.equals(e.field))throw new D("ModulusPolys do not have same ModulusGF field");if(this.isZero())return e;if(e.isZero())return this;let t=this.coefficients,r=e.coefficients;if(t.length>r.length){let e=t;t=r,r=e}let n=new Int32Array(r.length),i=r.length-t.length;P.arraycopy(r,0,n,0,i);for(let e=i;e<r.length;e++)n[e]=this.field.add(t[e-i],r[e]);return new tU(this.field,n)}subtract(e){if(!this.field.equals(e.field))throw new D("ModulusPolys do not have same ModulusGF field");return e.isZero()?this:this.add(e.negative())}multiply(e){return e instanceof tU?this.multiplyOther(e):this.multiplyScalar(e)}multiplyOther(e){if(!this.field.equals(e.field))throw new D("ModulusPolys do not have same ModulusGF field");if(this.isZero()||e.isZero())return new tU(this.field,new Int32Array([0]));let t=this.coefficients,r=t.length,n=e.coefficients,i=n.length,o=new Int32Array(r+i-1);for(let e=0;e<r;e++){let r=t[e];for(let t=0;t<i;t++)o[e+t]=this.field.add(o[e+t],this.field.multiply(r,n[t]))}return new tU(this.field,o)}negative(){let e=this.coefficients.length,t=new Int32Array(e);for(let r=0;r<e;r++)t[r]=this.field.subtract(0,this.coefficients[r]);return new tU(this.field,t)}multiplyScalar(e){if(0===e)return new tU(this.field,new Int32Array([0]));if(1===e)return this;let t=this.coefficients.length,r=new Int32Array(t);for(let n=0;n<t;n++)r[n]=this.field.multiply(this.coefficients[n],e);return new tU(this.field,r)}multiplyByMonomial(e,t){if(e<0)throw new D;if(0===t)return new tU(this.field,new Int32Array([0]));let r=this.coefficients.length,n=new Int32Array(r+e);for(let e=0;e<r;e++)n[e]=this.field.multiply(this.coefficients[e],t);return new tU(this.field,n)}toString(){let e=new W;for(let t=this.getDegree();t>=0;t--){let r=this.getCoefficient(t);0!==r&&(r<0?(e.append(" - "),r=-r):e.length()>0&&e.append(" + "),(0===t||1!==r)&&e.append(r),0!==t&&(1===t?e.append("x"):(e.append("x^"),e.append(t))))}return e.toString()}}class tH{add(e,t){return(e+t)%this.modulus}subtract(e,t){return(this.modulus+e-t)%this.modulus}exp(e){return this.expTable[e]}log(e){if(0===e)throw new D;return this.logTable[e]}inverse(e){if(0===e)throw new el;return this.expTable[this.modulus-this.logTable[e]-1]}multiply(e,t){return 0===e||0===t?0:this.expTable[(this.logTable[e]+this.logTable[t])%(this.modulus-1)]}getSize(){return this.modulus}equals(e){return e===this}}class tz extends tH{constructor(e,t){super(),this.modulus=e,this.expTable=new Int32Array(e),this.logTable=new Int32Array(e);let r=1;for(let n=0;n<e;n++)this.expTable[n]=r,r=r*t%e;for(let t=0;t<e-1;t++)this.logTable[this.expTable[t]]=t;this.zero=new tU(this,new Int32Array([0])),this.one=new tU(this,new Int32Array([1]))}getZero(){return this.zero}getOne(){return this.one}buildMonomial(e,t){if(e<0)throw new D;if(0===t)return this.zero;let r=new Int32Array(e+1);return r[0]=t,new tU(this,r)}}tz.PDF417_GF=new tz(tL.NUMBER_OF_CODEWORDS,3);class tV{constructor(){this.field=tz.PDF417_GF}decode(e,t,r){let n=new tU(this.field,e),i=new Int32Array(t),o=!1;for(let e=t;e>0;e--){let r=n.evaluateAt(this.field.exp(e));i[t-e]=r,0!==r&&(o=!0)}if(!o)return 0;let a=this.field.getOne();if(null!=r)for(let t of r){let r=this.field.exp(e.length-1-t),n=new tU(this.field,new Int32Array([this.field.subtract(0,r),1]));a=a.multiply(n)}let s=new tU(this.field,i),l=this.runEuclideanAlgorithm(this.field.buildMonomial(t,1),s,t),c=l[0],u=l[1],h=this.findErrorLocations(c),d=this.findErrorMagnitudes(u,c,h);for(let t=0;t<h.length;t++){let r=e.length-1-this.field.log(h[t]);if(r<0)throw R.getChecksumInstance();e[r]=this.field.subtract(e[r],d[t])}return h.length}runEuclideanAlgorithm(e,t,r){if(e.getDegree()<t.getDegree()){let r=e;e=t,t=r}let n=e,i=t,o=this.field.getZero(),a=this.field.getOne();for(;i.getDegree()>=Math.round(r/2);){let e=n,t=o;if(n=i,o=a,n.isZero())throw R.getChecksumInstance();i=e;let r=this.field.getZero(),s=n.getCoefficient(n.getDegree()),l=this.field.inverse(s);for(;i.getDegree()>=n.getDegree()&&!i.isZero();){let e=i.getDegree()-n.getDegree(),t=this.field.multiply(i.getCoefficient(i.getDegree()),l);r=r.add(this.field.buildMonomial(e,t)),i=i.subtract(n.multiplyByMonomial(e,t))}a=r.multiply(o).subtract(t).negative()}let s=a.getCoefficient(0);if(0===s)throw R.getChecksumInstance();let l=this.field.inverse(s);return[a.multiply(l),i.multiply(l)]}findErrorLocations(e){let t=e.getDegree(),r=new Int32Array(t),n=0;for(let i=1;i<this.field.getSize()&&n<t;i++)0===e.evaluateAt(i)&&(r[n]=this.field.inverse(i),n++);if(n!==t)throw R.getChecksumInstance();return r}findErrorMagnitudes(e,t,r){let n=t.getDegree(),i=new Int32Array(n);for(let e=1;e<=n;e++)i[n-e]=this.field.multiply(e,t.getCoefficient(e));let o=new tU(this.field,i),a=r.length,s=new Int32Array(a);for(let t=0;t<a;t++){let n=this.field.inverse(r[t]),i=this.field.subtract(0,e.evaluateAt(n)),a=this.field.inverse(o.evaluateAt(n));s[t]=this.field.multiply(i,a)}return s}}class tj{constructor(e,t,r,n,i){e instanceof tj?this.constructor_2(e):this.constructor_1(e,t,r,n,i)}constructor_1(e,t,r,n,i){let o=null==t||null==r,a=null==n||null==i;if(o&&a)throw new X;o?(t=new em(0,n.getY()),r=new em(0,i.getY())):a&&(n=new em(e.getWidth()-1,t.getY()),i=new em(e.getWidth()-1,r.getY())),this.image=e,this.topLeft=t,this.bottomLeft=r,this.topRight=n,this.bottomRight=i,this.minX=Math.trunc(Math.min(t.getX(),r.getX())),this.maxX=Math.trunc(Math.max(n.getX(),i.getX())),this.minY=Math.trunc(Math.min(t.getY(),n.getY())),this.maxY=Math.trunc(Math.max(r.getY(),i.getY()))}constructor_2(e){this.image=e.image,this.topLeft=e.getTopLeft(),this.bottomLeft=e.getBottomLeft(),this.topRight=e.getTopRight(),this.bottomRight=e.getBottomRight(),this.minX=e.getMinX(),this.maxX=e.getMaxX(),this.minY=e.getMinY(),this.maxY=e.getMaxY()}static merge(e,t){return null==e?t:null==t?e:new tj(e.image,e.topLeft,e.bottomLeft,t.topRight,t.bottomRight)}addMissingRows(e,t,r){let n=this.topLeft,i=this.bottomLeft,o=this.topRight,a=this.bottomRight;if(e>0){let t=r?this.topLeft:this.topRight,i=Math.trunc(t.getY()-e);i<0&&(i=0);let a=new em(t.getX(),i);r?n=a:o=a}if(t>0){let e=r?this.bottomLeft:this.bottomRight,n=Math.trunc(e.getY()+t);n>=this.image.getHeight()&&(n=this.image.getHeight()-1);let o=new em(e.getX(),n);r?i=o:a=o}return new tj(this.image,n,i,o,a)}getMinX(){return this.minX}getMaxX(){return this.maxX}getMinY(){return this.minY}getMaxY(){return this.maxY}getTopLeft(){return this.topLeft}getTopRight(){return this.topRight}getBottomLeft(){return this.bottomLeft}getBottomRight(){return this.bottomRight}}class tG{constructor(e,t,r,n){this.columnCount=e,this.errorCorrectionLevel=n,this.rowCountUpperPart=t,this.rowCountLowerPart=r,this.rowCount=t+r}getColumnCount(){return this.columnCount}getErrorCorrectionLevel(){return this.errorCorrectionLevel}getRowCount(){return this.rowCount}getRowCountUpperPart(){return this.rowCountUpperPart}getRowCountLowerPart(){return this.rowCountLowerPart}}class tW{constructor(){this.buffer=""}static form(e,t){let r=-1;return e.replace(/%(-)?(0?[0-9]+)?([.][0-9]+)?([#][0-9]+)?([scfpexd%])/g,function(e,n,i,o,a,s){let l;if("%%"===e)return"%";if(void 0===t[++r])return;e=o?parseInt(o.substr(1)):void 0;let c=a?parseInt(a.substr(1)):void 0;switch(s){case"s":l=t[r];break;case"c":l=t[r][0];break;case"f":l=parseFloat(t[r]).toFixed(e);break;case"p":l=parseFloat(t[r]).toPrecision(e);break;case"e":l=parseFloat(t[r]).toExponential(e);break;case"x":l=parseInt(t[r]).toString(c||16);break;case"d":l=parseFloat(parseInt(t[r],c||10).toPrecision(e)).toFixed(0)}l="object"==typeof l?JSON.stringify(l):(+l).toString(c);let u=parseInt(i),h=i&&i[0]+""=="0"?"0":" ";for(;l.length<u;)l=void 0!==n?l+h:h+l;return l})}format(e,...t){this.buffer+=tW.form(e,t)}toString(){return this.buffer}}class tY{constructor(e){this.boundingBox=new tj(e),this.codewords=Array(e.getMaxY()-e.getMinY()+1)}getCodewordNearby(e){let t=this.getCodeword(e);if(null!=t)return t;for(let r=1;r<tY.MAX_NEARBY_DISTANCE;r++){let n=this.imageRowToCodewordIndex(e)-r;if(n>=0&&null!=(t=this.codewords[n])||(n=this.imageRowToCodewordIndex(e)+r)<this.codewords.length&&null!=(t=this.codewords[n]))return t}return null}imageRowToCodewordIndex(e){return e-this.boundingBox.getMinY()}setCodeword(e,t){this.codewords[this.imageRowToCodewordIndex(e)]=t}getCodeword(e){return this.codewords[this.imageRowToCodewordIndex(e)]}getBoundingBox(){return this.boundingBox}getCodewords(){return this.codewords}toString(){let e=new tW,t=0;for(let r of this.codewords){if(null==r){e.format("%3d: | %n",t++);continue}e.format("%3d: %3d|%3d%n",t++,r.getRowNumber(),r.getValue())}return e.toString()}}tY.MAX_NEARBY_DISTANCE=5;class tX{constructor(){this.values=new Map}setValue(e){e=Math.trunc(e);let t=this.values.get(e);null==t&&(t=0),t++,this.values.set(e,t)}getValue(){let e=-1,t=[];for(let[r,n]of this.values.entries()){let i={getKey:()=>r,getValue:()=>n};i.getValue()>e?(e=i.getValue(),(t=[]).push(i.getKey())):i.getValue()===e&&t.push(i.getKey())}return tL.toIntArray(t)}getConfidence(e){return this.values.get(e)}}class tZ extends tY{constructor(e,t){super(e),this._isLeft=t}setRowNumbers(){for(let e of this.getCodewords())null!=e&&e.setRowNumberAsRowIndicatorColumn()}adjustCompleteIndicatorColumnRowNumbers(e){let t=this.getCodewords();this.setRowNumbers(),this.removeIncorrectCodewords(t,e);let r=this.getBoundingBox(),n=this._isLeft?r.getTopLeft():r.getTopRight(),i=this._isLeft?r.getBottomLeft():r.getBottomRight(),o=this.imageRowToCodewordIndex(Math.trunc(n.getY())),a=this.imageRowToCodewordIndex(Math.trunc(i.getY())),s=-1,l=1,c=0;for(let r=o;r<a;r++){if(null==t[r])continue;let n=t[r],i=n.getRowNumber()-s;if(0===i)c++;else if(1===i)l=Math.max(l,c),c=1,s=n.getRowNumber();else if(i<0||n.getRowNumber()>=e.getRowCount()||i>r)t[r]=null;else{let e,o=(e=l>2?(l-2)*i:i)>=r;for(let n=1;n<=e&&!o;n++)o=null!=t[r-n];o?t[r]=null:(s=n.getRowNumber(),c=1)}}}getRowHeights(){let e=this.getBarcodeMetadata();if(null==e)return null;this.adjustIncompleteIndicatorColumnRowNumbers(e);let t=new Int32Array(e.getRowCount());for(let e of this.getCodewords())if(null!=e){let r=e.getRowNumber();if(r>=t.length)continue;t[r]++}return t}adjustIncompleteIndicatorColumnRowNumbers(e){let t=this.getBoundingBox(),r=this._isLeft?t.getTopLeft():t.getTopRight(),n=this._isLeft?t.getBottomLeft():t.getBottomRight(),i=this.imageRowToCodewordIndex(Math.trunc(r.getY())),o=this.imageRowToCodewordIndex(Math.trunc(n.getY())),a=this.getCodewords(),s=-1;for(let t=i;t<o;t++){if(null==a[t])continue;let r=a[t];r.setRowNumberAsRowIndicatorColumn();let n=r.getRowNumber()-s;0===n||(1===n?s=r.getRowNumber():r.getRowNumber()>=e.getRowCount()?a[t]=null:s=r.getRowNumber())}}getBarcodeMetadata(){let e=this.getCodewords(),t=new tX,r=new tX,n=new tX,i=new tX;for(let o of e){if(null==o)continue;o.setRowNumberAsRowIndicatorColumn();let e=o.getValue()%30,a=o.getRowNumber();switch(!this._isLeft&&(a+=2),a%3){case 0:r.setValue(3*e+1);break;case 1:i.setValue(e/3),n.setValue(e%3);break;case 2:t.setValue(e+1)}}if(0===t.getValue().length||0===r.getValue().length||0===n.getValue().length||0===i.getValue().length||t.getValue()[0]<1||r.getValue()[0]+n.getValue()[0]<tL.MIN_ROWS_IN_BARCODE||r.getValue()[0]+n.getValue()[0]>tL.MAX_ROWS_IN_BARCODE)return null;let o=new tG(t.getValue()[0],r.getValue()[0],n.getValue()[0],i.getValue()[0]);return this.removeIncorrectCodewords(e,o),o}removeIncorrectCodewords(e,t){for(let r=0;r<e.length;r++){let n=e[r];if(null==e[r])continue;let i=n.getValue()%30,o=n.getRowNumber();if(o>t.getRowCount()){e[r]=null;continue}switch(!this._isLeft&&(o+=2),o%3){case 0:3*i+1!==t.getRowCountUpperPart()&&(e[r]=null);break;case 1:(Math.trunc(i/3)!==t.getErrorCorrectionLevel()||i%3!==t.getRowCountLowerPart())&&(e[r]=null);break;case 2:i+1!==t.getColumnCount()&&(e[r]=null)}}}isLeft(){return this._isLeft}toString(){return"IsLeft: "+this._isLeft+"\n"+super.toString()}}class tQ{constructor(e,t){this.ADJUST_ROW_NUMBER_SKIP=2,this.barcodeMetadata=e,this.barcodeColumnCount=e.getColumnCount(),this.boundingBox=t,this.detectionResultColumns=Array(this.barcodeColumnCount+2)}getDetectionResultColumns(){let e;this.adjustIndicatorColumnRowNumbers(this.detectionResultColumns[0]),this.adjustIndicatorColumnRowNumbers(this.detectionResultColumns[this.barcodeColumnCount+1]);let t=tL.MAX_CODEWORDS_IN_BARCODE;do e=t,t=this.adjustRowNumbersAndGetCount();while(t>0&&t<e);return this.detectionResultColumns}adjustIndicatorColumnRowNumbers(e){null!=e&&e.adjustCompleteIndicatorColumnRowNumbers(this.barcodeMetadata)}adjustRowNumbersAndGetCount(){let e=this.adjustRowNumbersByRow();if(0===e)return 0;for(let e=1;e<this.barcodeColumnCount+1;e++){let t=this.detectionResultColumns[e].getCodewords();for(let r=0;r<t.length;r++)null!=t[r]&&(t[r].hasValidRowNumber()||this.adjustRowNumbers(e,r,t))}return e}adjustRowNumbersByRow(){return this.adjustRowNumbersFromBothRI(),this.adjustRowNumbersFromLRI()+this.adjustRowNumbersFromRRI()}adjustRowNumbersFromBothRI(){if(null==this.detectionResultColumns[0]||null==this.detectionResultColumns[this.barcodeColumnCount+1])return;let e=this.detectionResultColumns[0].getCodewords(),t=this.detectionResultColumns[this.barcodeColumnCount+1].getCodewords();for(let r=0;r<e.length;r++)if(null!=e[r]&&null!=t[r]&&e[r].getRowNumber()===t[r].getRowNumber())for(let t=1;t<=this.barcodeColumnCount;t++){let n=this.detectionResultColumns[t].getCodewords()[r];null!=n&&(n.setRowNumber(e[r].getRowNumber()),n.hasValidRowNumber()||(this.detectionResultColumns[t].getCodewords()[r]=null))}}adjustRowNumbersFromRRI(){if(null==this.detectionResultColumns[this.barcodeColumnCount+1])return 0;let e=0,t=this.detectionResultColumns[this.barcodeColumnCount+1].getCodewords();for(let r=0;r<t.length;r++){if(null==t[r])continue;let n=t[r].getRowNumber(),i=0;for(let t=this.barcodeColumnCount+1;t>0&&i<this.ADJUST_ROW_NUMBER_SKIP;t--){let o=this.detectionResultColumns[t].getCodewords()[r];null!=o&&(i=tQ.adjustRowNumberIfValid(n,i,o),!o.hasValidRowNumber()&&e++)}}return e}adjustRowNumbersFromLRI(){if(null==this.detectionResultColumns[0])return 0;let e=0,t=this.detectionResultColumns[0].getCodewords();for(let r=0;r<t.length;r++){if(null==t[r])continue;let n=t[r].getRowNumber(),i=0;for(let t=1;t<this.barcodeColumnCount+1&&i<this.ADJUST_ROW_NUMBER_SKIP;t++){let o=this.detectionResultColumns[t].getCodewords()[r];null!=o&&(i=tQ.adjustRowNumberIfValid(n,i,o),!o.hasValidRowNumber()&&e++)}}return e}static adjustRowNumberIfValid(e,t,r){return null==r||!r.hasValidRowNumber()&&(r.isValidRowNumber(e)?(r.setRowNumber(e),t=0):++t),t}adjustRowNumbers(e,t,r){if(!this.detectionResultColumns[e-1])return;let n=r[t],i=this.detectionResultColumns[e-1].getCodewords(),o=i;null!=this.detectionResultColumns[e+1]&&(o=this.detectionResultColumns[e+1].getCodewords());let a=Array(14);for(let e of(a[2]=i[t],a[3]=o[t],t>0&&(a[0]=r[t-1],a[4]=i[t-1],a[5]=o[t-1]),t>1&&(a[8]=r[t-2],a[10]=i[t-2],a[11]=o[t-2]),t<r.length-1&&(a[1]=r[t+1],a[6]=i[t+1],a[7]=o[t+1]),t<r.length-2&&(a[9]=r[t+2],a[12]=i[t+2],a[13]=o[t+2]),a))if(tQ.adjustRowNumber(n,e))return}static adjustRowNumber(e,t){return null!=t&&!!t.hasValidRowNumber()&&t.getBucket()===e.getBucket()&&(e.setRowNumber(t.getRowNumber()),!0)}getBarcodeColumnCount(){return this.barcodeColumnCount}getBarcodeRowCount(){return this.barcodeMetadata.getRowCount()}getBarcodeECLevel(){return this.barcodeMetadata.getErrorCorrectionLevel()}setBoundingBox(e){this.boundingBox=e}getBoundingBox(){return this.boundingBox}setDetectionResultColumn(e,t){this.detectionResultColumns[e]=t}getDetectionResultColumn(e){return this.detectionResultColumns[e]}toString(){let e=this.detectionResultColumns[0];null==e&&(e=this.detectionResultColumns[this.barcodeColumnCount+1]);let t=new tW;for(let r=0;r<e.getCodewords().length;r++){t.format("CW %3d:",r);for(let e=0;e<this.barcodeColumnCount+2;e++){if(null==this.detectionResultColumns[e]){t.format(" | ");continue}let n=this.detectionResultColumns[e].getCodewords()[r];if(null==n){t.format(" | ");continue}t.format(" %3d|%3d",n.getRowNumber(),n.getValue())}t.format("%n")}return t.toString()}}class tq{constructor(e,t,r,n){this.rowNumber=tq.BARCODE_ROW_UNKNOWN,this.startX=Math.trunc(e),this.endX=Math.trunc(t),this.bucket=Math.trunc(r),this.value=Math.trunc(n)}hasValidRowNumber(){return this.isValidRowNumber(this.rowNumber)}isValidRowNumber(e){return e!==tq.BARCODE_ROW_UNKNOWN&&this.bucket===e%3*3}setRowNumberAsRowIndicatorColumn(){this.rowNumber=Math.trunc(3*Math.trunc(this.value/30)+Math.trunc(this.bucket/3))}getWidth(){return this.endX-this.startX}getStartX(){return this.startX}getEndX(){return this.endX}getBucket(){return this.bucket}getValue(){return this.value}getRowNumber(){return this.rowNumber}setRowNumber(e){this.rowNumber=e}toString(){return this.rowNumber+"|"+this.value}}tq.BARCODE_ROW_UNKNOWN=-1;class tK{static initialize(){for(let e=0;e<tL.SYMBOL_TABLE.length;e++){let t=tL.SYMBOL_TABLE[e],r=1&t;for(let n=0;n<tL.BARS_IN_MODULE;n++){let i=0;for(;(1&t)===r;)i+=1,t>>=1;r=1&t,tK.RATIOS_TABLE[e]||(tK.RATIOS_TABLE[e]=Array(tL.BARS_IN_MODULE)),tK.RATIOS_TABLE[e][tL.BARS_IN_MODULE-n-1]=Math.fround(i/tL.MODULES_IN_CODEWORD)}}this.bSymbolTableReady=!0}static getDecodedValue(e){let t=tK.getDecodedCodewordValue(tK.sampleBitCounts(e));return -1!==t?t:tK.getClosestDecodedValue(e)}static sampleBitCounts(e){let t=eg.sum(e),r=new Int32Array(tL.BARS_IN_MODULE),n=0,i=0;for(let o=0;o<tL.MODULES_IN_CODEWORD;o++){let a=t/(2*tL.MODULES_IN_CODEWORD)+o*t/tL.MODULES_IN_CODEWORD;i+e[n]<=a&&(i+=e[n],n++),r[n]++}return r}static getDecodedCodewordValue(e){let t=tK.getBitValue(e);return -1===tL.getCodeword(t)?-1:t}static getBitValue(e){let t=0;for(let r=0;r<e.length;r++)for(let n=0;n<e[r];n++)t=t<<1|+(r%2==0);return Math.trunc(t)}static getClosestDecodedValue(e){let t=eg.sum(e),r=Array(tL.BARS_IN_MODULE);if(t>1)for(let n=0;n<r.length;n++)r[n]=Math.fround(e[n]/t);let n=ep.MAX_VALUE,i=-1;this.bSymbolTableReady||tK.initialize();for(let e=0;e<tK.RATIOS_TABLE.length;e++){let t=0,o=tK.RATIOS_TABLE[e];for(let e=0;e<tL.BARS_IN_MODULE;e++){let i=Math.fround(o[e]-r[e]);if((t+=Math.fround(i*i))>=n)break}t<n&&(n=t,i=tL.SYMBOL_TABLE[e])}return i}}tK.bSymbolTableReady=!1,tK.RATIOS_TABLE=Array(tL.SYMBOL_TABLE.length).map(e=>Array(tL.BARS_IN_MODULE));class t${constructor(){this.segmentCount=-1,this.fileSize=-1,this.timestamp=-1,this.checksum=-1}getSegmentIndex(){return this.segmentIndex}setSegmentIndex(e){this.segmentIndex=e}getFileId(){return this.fileId}setFileId(e){this.fileId=e}getOptionalData(){return this.optionalData}setOptionalData(e){this.optionalData=e}isLastSegment(){return this.lastSegment}setLastSegment(e){this.lastSegment=e}getSegmentCount(){return this.segmentCount}setSegmentCount(e){this.segmentCount=e}getSender(){return this.sender||null}setSender(e){this.sender=e}getAddressee(){return this.addressee||null}setAddressee(e){this.addressee=e}getFileName(){return this.fileName}setFileName(e){this.fileName=e}getFileSize(){return this.fileSize}setFileSize(e){this.fileSize=e}getChecksum(){return this.checksum}setChecksum(e){this.checksum=e}getTimestamp(){return this.timestamp}setTimestamp(e){this.timestamp=e}}class tJ{static parseLong(e,t){return parseInt(e,t)}}class t1 extends N{}t1.kind="NullPointerException";class t0{writeBytes(e){this.writeBytesOffset(e,0,e.length)}writeBytesOffset(e,t,r){if(null==e)throw new t1;if(t<0||t>e.length||r<0||t+r>e.length||t+r<0)throw new B;if(0!==r)for(let n=0;n<r;n++)this.write(e[t+n])}flush(){}close(){}}class t2 extends N{}class t3 extends t0{constructor(e=32){if(super(),this.count=0,e<0)throw new D("Negative initial size: "+e);this.buf=new Uint8Array(e)}ensureCapacity(e){e-this.buf.length>0&&this.grow(e)}grow(e){let t=this.buf.length<<1;if(t-e<0&&(t=e),t<0){if(e<0)throw new t2;t=k.MAX_VALUE}this.buf=L.copyOfUint8Array(this.buf,t)}write(e){this.ensureCapacity(this.count+1),this.buf[this.count]=e,this.count+=1}writeBytesOffset(e,t,r){if(t<0||t>e.length||r<0||t+r-e.length>0)throw new B;this.ensureCapacity(this.count+r),P.arraycopy(e,t,this.buf,this.count,r),this.count+=r}writeTo(e){e.writeBytesOffset(this.buf,0,this.count)}reset(){this.count=0}toByteArray(){return L.copyOfUint8Array(this.buf,this.count)}size(){return this.count}toString(e){return e?"string"==typeof e?this.toString_string(e):this.toString_number(e):this.toString_void()}toString_void(){return new String(this.buf).toString()}toString_string(e){return new String(this.buf).toString()}toString_number(e){return new String(this.buf).toString()}close(){}}function t4(){if("undefined"!=typeof window)return window.BigInt||null;if(void 0!==r.g)return r.g.BigInt||null;if("undefined"!=typeof self)return self.BigInt||null;throw Error("Can't search globals for BigInt!")}function t8(e){if(void 0===t&&(t=t4()),null===t)throw Error("BigInt is not supported!");return t(e)}(d=S||(S={}))[d.ALPHA=0]="ALPHA",d[d.LOWER=1]="LOWER",d[d.MIXED=2]="MIXED",d[d.PUNCT=3]="PUNCT",d[d.ALPHA_SHIFT=4]="ALPHA_SHIFT",d[d.PUNCT_SHIFT=5]="PUNCT_SHIFT";class t6{static decode(e,t){let r=new W(""),n=z.ISO8859_1;r.enableDecoding(n);let i=1,o=e[i++],a=new t$;for(;i<e[0];){switch(o){case t6.TEXT_COMPACTION_MODE_LATCH:i=t6.textCompaction(e,i,r);break;case t6.BYTE_COMPACTION_MODE_LATCH:case t6.BYTE_COMPACTION_MODE_LATCH_6:i=t6.byteCompaction(o,e,n,i,r);break;case t6.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:r.append(e[i++]);break;case t6.NUMERIC_COMPACTION_MODE_LATCH:i=t6.numericCompaction(e,i,r);break;case t6.ECI_CHARSET:z.getCharacterSetECIByValue(e[i++]);break;case t6.ECI_GENERAL_PURPOSE:i+=2;break;case t6.ECI_USER_DEFINED:i++;break;case t6.BEGIN_MACRO_PDF417_CONTROL_BLOCK:i=t6.decodeMacroBlock(e,i,a);break;case t6.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case t6.MACRO_PDF417_TERMINATOR:throw new H;default:i--,i=t6.textCompaction(e,i,r)}if(i<e.length)o=e[i++];else throw H.getFormatInstance()}if(0===r.length())throw H.getFormatInstance();let s=new eo(null,r.toString(),null,t);return s.setOther(a),s}static decodeMacroBlock(e,t,r){if(t+t6.NUMBER_OF_SEQUENCE_CODEWORDS>e[0])throw H.getFormatInstance();let n=new Int32Array(t6.NUMBER_OF_SEQUENCE_CODEWORDS);for(let r=0;r<t6.NUMBER_OF_SEQUENCE_CODEWORDS;r++,t++)n[r]=e[t];r.setSegmentIndex(k.parseInt(t6.decodeBase900toBase10(n,t6.NUMBER_OF_SEQUENCE_CODEWORDS)));let i=new W;t=t6.textCompaction(e,t,i),r.setFileId(i.toString());let o=-1;for(e[t]===t6.BEGIN_MACRO_PDF417_OPTIONAL_FIELD&&(o=t+1);t<e[0];)switch(e[t]){case t6.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:switch(e[++t]){case t6.MACRO_PDF417_OPTIONAL_FIELD_FILE_NAME:let n=new W;t=t6.textCompaction(e,t+1,n),r.setFileName(n.toString());break;case t6.MACRO_PDF417_OPTIONAL_FIELD_SENDER:let i=new W;t=t6.textCompaction(e,t+1,i),r.setSender(i.toString());break;case t6.MACRO_PDF417_OPTIONAL_FIELD_ADDRESSEE:let o=new W;t=t6.textCompaction(e,t+1,o),r.setAddressee(o.toString());break;case t6.MACRO_PDF417_OPTIONAL_FIELD_SEGMENT_COUNT:let a=new W;t=t6.numericCompaction(e,t+1,a),r.setSegmentCount(k.parseInt(a.toString()));break;case t6.MACRO_PDF417_OPTIONAL_FIELD_TIME_STAMP:let s=new W;t=t6.numericCompaction(e,t+1,s),r.setTimestamp(tJ.parseLong(s.toString()));break;case t6.MACRO_PDF417_OPTIONAL_FIELD_CHECKSUM:let l=new W;t=t6.numericCompaction(e,t+1,l),r.setChecksum(k.parseInt(l.toString()));break;case t6.MACRO_PDF417_OPTIONAL_FIELD_FILE_SIZE:let c=new W;t=t6.numericCompaction(e,t+1,c),r.setFileSize(tJ.parseLong(c.toString()));break;default:throw H.getFormatInstance()}break;case t6.MACRO_PDF417_TERMINATOR:t++,r.setLastSegment(!0);break;default:throw H.getFormatInstance()}if(-1!==o){let n=t-o;r.isLastSegment()&&n--,r.setOptionalData(L.copyOfRange(e,o,o+n))}return t}static textCompaction(e,t,r){let n=new Int32Array((e[0]-t)*2),i=new Int32Array((e[0]-t)*2),o=0,a=!1;for(;t<e[0]&&!a;){let r=e[t++];if(r<t6.TEXT_COMPACTION_MODE_LATCH)n[o]=r/30,n[o+1]=r%30,o+=2;else switch(r){case t6.TEXT_COMPACTION_MODE_LATCH:n[o++]=t6.TEXT_COMPACTION_MODE_LATCH;break;case t6.BYTE_COMPACTION_MODE_LATCH:case t6.BYTE_COMPACTION_MODE_LATCH_6:case t6.NUMERIC_COMPACTION_MODE_LATCH:case t6.BEGIN_MACRO_PDF417_CONTROL_BLOCK:case t6.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case t6.MACRO_PDF417_TERMINATOR:t--,a=!0;break;case t6.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:n[o]=t6.MODE_SHIFT_TO_BYTE_COMPACTION_MODE,r=e[t++],i[o]=r,o++}}return t6.decodeTextCompaction(n,i,o,r),t}static decodeTextCompaction(e,t,r,n){let i=S.ALPHA,o=S.ALPHA,a=0;for(;a<r;){let r=e[a],s="";switch(i){case S.ALPHA:if(r<26)s=String.fromCharCode(65+r);else switch(r){case 26:s=" ";break;case t6.LL:i=S.LOWER;break;case t6.ML:i=S.MIXED;break;case t6.PS:o=i,i=S.PUNCT_SHIFT;break;case t6.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:n.append(t[a]);break;case t6.TEXT_COMPACTION_MODE_LATCH:i=S.ALPHA}break;case S.LOWER:if(r<26)s=String.fromCharCode(97+r);else switch(r){case 26:s=" ";break;case t6.AS:o=i,i=S.ALPHA_SHIFT;break;case t6.ML:i=S.MIXED;break;case t6.PS:o=i,i=S.PUNCT_SHIFT;break;case t6.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:n.append(t[a]);break;case t6.TEXT_COMPACTION_MODE_LATCH:i=S.ALPHA}break;case S.MIXED:if(r<t6.PL)s=t6.MIXED_CHARS[r];else switch(r){case t6.PL:i=S.PUNCT;break;case 26:s=" ";break;case t6.LL:i=S.LOWER;break;case t6.AL:i=S.ALPHA;break;case t6.PS:o=i,i=S.PUNCT_SHIFT;break;case t6.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:n.append(t[a]);break;case t6.TEXT_COMPACTION_MODE_LATCH:i=S.ALPHA}break;case S.PUNCT:if(r<t6.PAL)s=t6.PUNCT_CHARS[r];else switch(r){case t6.PAL:i=S.ALPHA;break;case t6.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:n.append(t[a]);break;case t6.TEXT_COMPACTION_MODE_LATCH:i=S.ALPHA}break;case S.ALPHA_SHIFT:if(i=o,r<26)s=String.fromCharCode(65+r);else switch(r){case 26:s=" ";break;case t6.TEXT_COMPACTION_MODE_LATCH:i=S.ALPHA}break;case S.PUNCT_SHIFT:if(i=o,r<t6.PAL)s=t6.PUNCT_CHARS[r];else switch(r){case t6.PAL:i=S.ALPHA;break;case t6.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:n.append(t[a]);break;case t6.TEXT_COMPACTION_MODE_LATCH:i=S.ALPHA}}""!==s&&n.append(s),a++}}static byteCompaction(e,t,r,n,i){let o=new t3,a=0,s=0,l=!1;switch(e){case t6.BYTE_COMPACTION_MODE_LATCH:let c=new Int32Array(6),u=t[n++];for(;n<t[0]&&!l;)switch(c[a++]=u,s=900*s+u,u=t[n++]){case t6.TEXT_COMPACTION_MODE_LATCH:case t6.BYTE_COMPACTION_MODE_LATCH:case t6.NUMERIC_COMPACTION_MODE_LATCH:case t6.BYTE_COMPACTION_MODE_LATCH_6:case t6.BEGIN_MACRO_PDF417_CONTROL_BLOCK:case t6.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case t6.MACRO_PDF417_TERMINATOR:n--,l=!0;break;default:if(a%5==0&&a>0){for(let e=0;e<6;++e)o.write(Number(t8(s)>>t8(8*(5-e))));s=0,a=0}}n===t[0]&&u<t6.TEXT_COMPACTION_MODE_LATCH&&(c[a++]=u);for(let e=0;e<a;e++)o.write(c[e]);break;case t6.BYTE_COMPACTION_MODE_LATCH_6:for(;n<t[0]&&!l;){let e=t[n++];if(e<t6.TEXT_COMPACTION_MODE_LATCH)a++,s=900*s+e;else switch(e){case t6.TEXT_COMPACTION_MODE_LATCH:case t6.BYTE_COMPACTION_MODE_LATCH:case t6.NUMERIC_COMPACTION_MODE_LATCH:case t6.BYTE_COMPACTION_MODE_LATCH_6:case t6.BEGIN_MACRO_PDF417_CONTROL_BLOCK:case t6.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case t6.MACRO_PDF417_TERMINATOR:n--,l=!0}if(a%5==0&&a>0){for(let e=0;e<6;++e)o.write(Number(t8(s)>>t8(8*(5-e))));s=0,a=0}}}return i.append(j.decode(o.toByteArray(),r)),n}static numericCompaction(e,t,r){let n=0,i=!1,o=new Int32Array(t6.MAX_NUMERIC_CODEWORDS);for(;t<e[0]&&!i;){let a=e[t++];if(t===e[0]&&(i=!0),a<t6.TEXT_COMPACTION_MODE_LATCH)o[n]=a,n++;else switch(a){case t6.TEXT_COMPACTION_MODE_LATCH:case t6.BYTE_COMPACTION_MODE_LATCH:case t6.BYTE_COMPACTION_MODE_LATCH_6:case t6.BEGIN_MACRO_PDF417_CONTROL_BLOCK:case t6.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case t6.MACRO_PDF417_TERMINATOR:t--,i=!0}(n%t6.MAX_NUMERIC_CODEWORDS==0||a===t6.NUMERIC_COMPACTION_MODE_LATCH||i)&&n>0&&(r.append(t6.decodeBase900toBase10(o,n)),n=0)}return t}static decodeBase900toBase10(e,t){let r=t8(0);for(let n=0;n<t;n++)r+=t6.EXP900[t-n-1]*t8(e[n]);let n=r.toString();if("1"!==n.charAt(0))throw new H;return n.substring(1)}}t6.TEXT_COMPACTION_MODE_LATCH=900,t6.BYTE_COMPACTION_MODE_LATCH=901,t6.NUMERIC_COMPACTION_MODE_LATCH=902,t6.BYTE_COMPACTION_MODE_LATCH_6=924,t6.ECI_USER_DEFINED=925,t6.ECI_GENERAL_PURPOSE=926,t6.ECI_CHARSET=927,t6.BEGIN_MACRO_PDF417_CONTROL_BLOCK=928,t6.BEGIN_MACRO_PDF417_OPTIONAL_FIELD=923,t6.MACRO_PDF417_TERMINATOR=922,t6.MODE_SHIFT_TO_BYTE_COMPACTION_MODE=913,t6.MAX_NUMERIC_CODEWORDS=15,t6.MACRO_PDF417_OPTIONAL_FIELD_FILE_NAME=0,t6.MACRO_PDF417_OPTIONAL_FIELD_SEGMENT_COUNT=1,t6.MACRO_PDF417_OPTIONAL_FIELD_TIME_STAMP=2,t6.MACRO_PDF417_OPTIONAL_FIELD_SENDER=3,t6.MACRO_PDF417_OPTIONAL_FIELD_ADDRESSEE=4,t6.MACRO_PDF417_OPTIONAL_FIELD_FILE_SIZE=5,t6.MACRO_PDF417_OPTIONAL_FIELD_CHECKSUM=6,t6.PL=25,t6.LL=27,t6.AS=27,t6.ML=28,t6.AL=28,t6.PS=29,t6.PAL=29,t6.PUNCT_CHARS=";<>@[\\]_`~!\r ,:\n-.$/\"|*()?{}'",t6.MIXED_CHARS="0123456789&\r ,:#-.$/+%*=^",t6.EXP900=t4()?function(){let e=[];e[0]=t8(1);let t=t8(900);e[1]=t;for(let r=2;r<16;r++)e[r]=e[r-1]*t;return e}():[],t6.NUMBER_OF_SEQUENCE_CODEWORDS=2;class t5{constructor(){}static decode(e,t,r,n,i,o,a){let s,l=new tj(e,t,r,n,i),c=null,u=null;for(let r=!0;;r=!1){if(null!=t&&(c=t5.getRowIndicatorColumn(e,l,t,!0,o,a)),null!=n&&(u=t5.getRowIndicatorColumn(e,l,n,!1,o,a)),null==(s=t5.merge(c,u)))throw X.getNotFoundInstance();let i=s.getBoundingBox();if(r&&null!=i&&(i.getMinY()<l.getMinY()||i.getMaxY()>l.getMaxY()))l=i;else break}s.setBoundingBox(l);let h=s.getBarcodeColumnCount()+1;s.setDetectionResultColumn(0,c),s.setDetectionResultColumn(h,u);let d=null!=c;for(let t=1;t<=h;t++){let r,n=d?t:h-t;if(void 0!==s.getDetectionResultColumn(n))continue;r=0===n||n===h?new tZ(l,0===n):new tY(l),s.setDetectionResultColumn(n,r);let i=-1,c=-1;for(let t=l.getMinY();t<=l.getMaxY();t++){if((i=t5.getStartColumn(s,n,t,d))<0||i>l.getMaxX()){if(-1===c)continue;i=c}let u=t5.detectCodeword(e,l.getMinX(),l.getMaxX(),d,i,t,o,a);null!=u&&(r.setCodeword(t,u),c=i,o=Math.min(o,u.getWidth()),a=Math.max(a,u.getWidth()))}}return t5.createDecoderResult(s)}static merge(e,t){if(null==e&&null==t)return null;let r=t5.getBarcodeMetadata(e,t);return null==r?null:new tQ(r,tj.merge(t5.adjustBoundingBox(e),t5.adjustBoundingBox(t)))}static adjustBoundingBox(e){if(null==e)return null;let t=e.getRowHeights();if(null==t)return null;let r=t5.getMax(t),n=0;for(let e of t)if(n+=r-e,e>0)break;let i=e.getCodewords();for(let e=0;n>0&&null==i[e];e++)n--;let o=0;for(let e=t.length-1;e>=0&&(o+=r-t[e],!(t[e]>0));e--);for(let e=i.length-1;o>0&&null==i[e];e--)o--;return e.getBoundingBox().addMissingRows(n,o,e.isLeft())}static getMax(e){let t=-1;for(let r of e)t=Math.max(t,r);return t}static getBarcodeMetadata(e,t){let r,n;return null==e||null==(r=e.getBarcodeMetadata())?null==t?null:t.getBarcodeMetadata():null==t||null==(n=t.getBarcodeMetadata())?r:r.getColumnCount()!==n.getColumnCount()&&r.getErrorCorrectionLevel()!==n.getErrorCorrectionLevel()&&r.getRowCount()!==n.getRowCount()?null:r}static getRowIndicatorColumn(e,t,r,n,i,o){let a=new tZ(t,n);for(let s=0;s<2;s++){let l=0===s?1:-1,c=Math.trunc(Math.trunc(r.getX()));for(let s=Math.trunc(Math.trunc(r.getY()));s<=t.getMaxY()&&s>=t.getMinY();s+=l){let t=t5.detectCodeword(e,0,e.getWidth(),n,c,s,i,o);null!=t&&(a.setCodeword(s,t),c=n?t.getStartX():t.getEndX())}}return a}static adjustCodewordCount(e,t){let r=t[0][1],n=r.getValue(),i=e.getBarcodeColumnCount()*e.getBarcodeRowCount()-t5.getNumberOfECCodeWords(e.getBarcodeECLevel());if(0===n.length){if(i<1||i>tL.MAX_CODEWORDS_IN_BARCODE)throw X.getNotFoundInstance();r.setValue(i)}else n[0]!==i&&r.setValue(i)}static createDecoderResult(e){let t=t5.createBarcodeMatrix(e);t5.adjustCodewordCount(e,t);let r=[],n=new Int32Array(e.getBarcodeRowCount()*e.getBarcodeColumnCount()),i=[],o=[];for(let a=0;a<e.getBarcodeRowCount();a++)for(let s=0;s<e.getBarcodeColumnCount();s++){let l=t[a][s+1].getValue(),c=a*e.getBarcodeColumnCount()+s;0===l.length?r.push(c):1===l.length?n[c]=l[0]:(o.push(c),i.push(l))}let a=Array(i.length);for(let e=0;e<a.length;e++)a[e]=i[e];return t5.createDecoderResultFromAmbiguousValues(e.getBarcodeECLevel(),n,tL.toIntArray(r),tL.toIntArray(o),a)}static createDecoderResultFromAmbiguousValues(e,t,r,n,i){let o=new Int32Array(n.length),a=100;for(;a-- >0;){for(let e=0;e<o.length;e++)t[n[e]]=i[e][o[e]];try{return t5.decodeCodewords(t,e,r)}catch(e){if(!(e instanceof R))throw e}if(0===o.length)break;for(let e=0;e<o.length;e++)if(o[e]<i[e].length-1){o[e]++;break}else if(o[e]=0,e===o.length-1)throw R.getChecksumInstance()}throw R.getChecksumInstance()}static createBarcodeMatrix(e){let t=Array.from({length:e.getBarcodeRowCount()},()=>Array(e.getBarcodeColumnCount()+2));for(let e=0;e<t.length;e++)for(let r=0;r<t[e].length;r++)t[e][r]=new tX;let r=0;for(let n of e.getDetectionResultColumns()){if(null!=n){for(let e of n.getCodewords())if(null!=e){let n=e.getRowNumber();if(n>=0){if(n>=t.length)continue;t[n][r].setValue(e.getValue())}}}r++}return t}static isValidBarcodeColumn(e,t){return t>=0&&t<=e.getBarcodeColumnCount()+1}static getStartColumn(e,t,r,n){let i=n?1:-1,o=null;if(t5.isValidBarcodeColumn(e,t-i)&&(o=e.getDetectionResultColumn(t-i).getCodeword(r)),null!=o)return n?o.getEndX():o.getStartX();if(null!=(o=e.getDetectionResultColumn(t).getCodewordNearby(r)))return n?o.getStartX():o.getEndX();if(t5.isValidBarcodeColumn(e,t-i)&&(o=e.getDetectionResultColumn(t-i).getCodewordNearby(r)),null!=o)return n?o.getEndX():o.getStartX();let a=0;for(;t5.isValidBarcodeColumn(e,t-i);){for(let r of(t-=i,e.getDetectionResultColumn(t).getCodewords()))if(null!=r)return(n?r.getEndX():r.getStartX())+i*a*(r.getEndX()-r.getStartX());a++}return n?e.getBoundingBox().getMinX():e.getBoundingBox().getMaxX()}static detectCodeword(e,t,r,n,i,o,a,s){let l;i=t5.adjustCodewordStartColumn(e,t,r,n,i,o);let c=t5.getModuleBitCount(e,t,r,n,i,o);if(null==c)return null;let u=eg.sum(c);if(n)l=i+u;else{for(let e=0;e<c.length/2;e++){let t=c[e];c[e]=c[c.length-1-e],c[c.length-1-e]=t}i=(l=i)-u}if(!t5.checkCodewordSkew(u,a,s))return null;let h=tK.getDecodedValue(c),d=tL.getCodeword(h);return -1===d?null:new tq(i,l,t5.getCodewordBucketNumber(h),d)}static getModuleBitCount(e,t,r,n,i,o){let a=i,s=new Int32Array(8),l=0,c=n?1:-1,u=n;for(;(n?a<r:a>=t)&&l<s.length;)e.get(a,o)===u?(s[l]++,a+=c):(l++,u=!u);return l===s.length||a===(n?r:t)&&l===s.length-1?s:null}static getNumberOfECCodeWords(e){return 2<<e}static adjustCodewordStartColumn(e,t,r,n,i,o){let a=i,s=n?-1:1;for(let l=0;l<2;l++){for(;(n?a>=t:a<r)&&n===e.get(a,o);){if(Math.abs(i-a)>t5.CODEWORD_SKEW_SIZE)return i;a+=s}s=-s,n=!n}return a}static checkCodewordSkew(e,t,r){return t-t5.CODEWORD_SKEW_SIZE<=e&&e<=r+t5.CODEWORD_SKEW_SIZE}static decodeCodewords(e,t,r){if(0===e.length)throw H.getFormatInstance();let n=1<<t+1,i=t5.correctErrors(e,r,n);t5.verifyCodewordCount(e,n);let o=t6.decode(e,""+t);return o.setErrorsCorrected(i),o.setErasures(r.length),o}static correctErrors(e,t,r){if(null!=t&&t.length>r/2+t5.MAX_ERRORS||r<0||r>t5.MAX_EC_CODEWORDS)throw R.getChecksumInstance();return t5.errorCorrection.decode(e,r,t)}static verifyCodewordCount(e,t){if(e.length<4)throw H.getFormatInstance();let r=e[0];if(r>e.length)throw H.getFormatInstance();if(0===r)if(t<e.length)e[0]=e.length-t;else throw H.getFormatInstance()}static getBitCountForCodeword(e){let t=new Int32Array(8),r=0,n=t.length-1;for(;!((1&e)!==r&&(r=1&e,--n<0));)t[n]++,e>>=1;return t}static getCodewordBucketNumber(e){return e instanceof Int32Array?this.getCodewordBucketNumber_Int32Array(e):this.getCodewordBucketNumber_number(e)}static getCodewordBucketNumber_number(e){return t5.getCodewordBucketNumber(t5.getBitCountForCodeword(e))}static getCodewordBucketNumber_Int32Array(e){return(e[0]-e[2]+e[4]-e[6]+9)%9}static toString(e){let t=new tW;for(let r=0;r<e.length;r++){t.format("Row %2d: ",r);for(let n=0;n<e[r].length;n++){let i=e[r][n];0===i.getValue().length?t.format(" ",null):t.format("%4d(%2d)",i.getValue()[0],i.getConfidence(i.getValue()[0]))}t.format("%n")}return t.toString()}}t5.CODEWORD_SKEW_SIZE=2,t5.MAX_ERRORS=3,t5.MAX_EC_CODEWORDS=512,t5.errorCorrection=new tV;class t7{decode(e,t=null){let r=t7.decode(e,t,!1);if(null==r||0===r.length||null==r[0])throw X.getNotFoundInstance();return r[0]}decodeMultiple(e,t=null){try{return t7.decode(e,t,!0)}catch(e){if(e instanceof H||e instanceof R)throw X.getNotFoundInstance();throw e}}static decode(e,t,r){let n=[],i=tF.detectMultiple(e,t,r);for(let e of i.getPoints()){let t=t5.decode(i.getBits(),e[4],e[5],e[6],e[7],t7.getMinCodewordWidth(e),t7.getMaxCodewordWidth(e)),r=new er(t.getText(),t.getRawBytes(),void 0,e,en.PDF_417);r.putMetadata(ei.ERROR_CORRECTION_LEVEL,t.getECLevel());let o=t.getOther();null!=o&&r.putMetadata(ei.PDF417_EXTRA_METADATA,o),n.push(r)}return n.map(e=>e)}static getMaxWidth(e,t){return null==e||null==t?0:Math.trunc(Math.abs(e.getX()-t.getX()))}static getMinWidth(e,t){return null==e||null==t?k.MAX_VALUE:Math.trunc(Math.abs(e.getX()-t.getX()))}static getMaxCodewordWidth(e){return Math.floor(Math.max(Math.max(t7.getMaxWidth(e[0],e[4]),t7.getMaxWidth(e[6],e[2])*tL.MODULES_IN_CODEWORD/tL.MODULES_IN_STOP_PATTERN),Math.max(t7.getMaxWidth(e[1],e[5]),t7.getMaxWidth(e[7],e[3])*tL.MODULES_IN_CODEWORD/tL.MODULES_IN_STOP_PATTERN)))}static getMinCodewordWidth(e){return Math.floor(Math.min(Math.min(t7.getMinWidth(e[0],e[4]),t7.getMinWidth(e[6],e[2])*tL.MODULES_IN_CODEWORD/tL.MODULES_IN_STOP_PATTERN),Math.min(t7.getMinWidth(e[1],e[5]),t7.getMinWidth(e[7],e[3])*tL.MODULES_IN_CODEWORD/tL.MODULES_IN_STOP_PATTERN)))}reset(){}}class t9 extends N{}t9.kind="ReaderException";class re{constructor(e,t){this.verbose=!0===e,t&&this.setHints(t)}decode(e,t){return t&&this.setHints(t),this.decodeInternal(e)}decodeWithState(e){return(null===this.readers||void 0===this.readers)&&this.setHints(null),this.decodeInternal(e)}setHints(e){this.hints=e;let t=null!=e&&!0===e.get(U.TRY_HARDER),r=null==e?null:e.get(U.POSSIBLE_FORMATS),n=[];if(null!=r){let i=r.some(e=>e===en.UPC_A||e===en.UPC_E||e===en.EAN_13||e===en.EAN_8||e===en.CODABAR||e===en.CODE_39||e===en.CODE_93||e===en.CODE_128||e===en.ITF||e===en.RSS_14||e===en.RSS_EXPANDED);i&&!t&&n.push(new ta(e,this.verbose)),r.includes(en.QR_CODE)&&n.push(new tx),r.includes(en.DATA_MATRIX)&&n.push(new tm),r.includes(en.AZTEC)&&n.push(new eT),r.includes(en.PDF_417)&&n.push(new t7),i&&t&&n.push(new ta(e,this.verbose))}0===n.length&&(t||n.push(new ta(e,this.verbose)),n.push(new tx),n.push(new tm),n.push(new eT),n.push(new t7),t&&n.push(new ta(e,this.verbose))),this.readers=n}reset(){if(null!==this.readers)for(let e of this.readers)e.reset()}decodeInternal(e){if(null===this.readers)throw new t9("No readers where selected, nothing can be read.");for(let t of this.readers)try{return t.decode(e,this.hints)}catch(e){if(e instanceof t9)continue}throw new X("No MultiFormat Readers were able to detect the code.")}}(f=_||(_={}))[f.ERROR_CORRECTION=0]="ERROR_CORRECTION",f[f.CHARACTER_SET=1]="CHARACTER_SET",f[f.DATA_MATRIX_SHAPE=2]="DATA_MATRIX_SHAPE",f[f.MIN_SIZE=3]="MIN_SIZE",f[f.MAX_SIZE=4]="MAX_SIZE",f[f.MARGIN=5]="MARGIN",f[f.PDF417_COMPACT=6]="PDF417_COMPACT",f[f.PDF417_COMPACTION=7]="PDF417_COMPACTION",f[f.PDF417_DIMENSIONS=8]="PDF417_DIMENSIONS",f[f.AZTEC_LAYERS=9]="AZTEC_LAYERS",f[f.QR_VERSION=10]="QR_VERSION";var rt=_;class rr{constructor(e){this.field=e,this.cachedGenerators=[],this.cachedGenerators.push(new es(e,Int32Array.from([1])))}buildGenerator(e){let t=this.cachedGenerators;if(e>=t.length){let r=t[t.length-1],n=this.field;for(let i=t.length;i<=e;i++){let e=r.multiply(new es(n,Int32Array.from([1,n.exp(i-1+n.getGeneratorBase())])));t.push(e),r=e}}return t[e]}encode(e,t){if(0===t)throw new D("No error correction bytes");let r=e.length-t;if(r<=0)throw new D("No data bytes provided");let n=this.buildGenerator(t),i=new Int32Array(r);P.arraycopy(e,0,i,0,r);let o=new es(this.field,i),a=(o=o.multiplyByMonomial(t,1)).divide(n)[1].getCoefficients(),s=t-a.length;for(let t=0;t<s;t++)e[r+t]=0;P.arraycopy(a,0,e,r+s,a.length)}}class rn{constructor(){}static applyMaskPenaltyRule1(e){return rn.applyMaskPenaltyRule1Internal(e,!0)+rn.applyMaskPenaltyRule1Internal(e,!1)}static applyMaskPenaltyRule2(e){let t=0,r=e.getArray(),n=e.getWidth(),i=e.getHeight();for(let e=0;e<i-1;e++){let i=r[e];for(let o=0;o<n-1;o++){let n=i[o];n===i[o+1]&&n===r[e+1][o]&&n===r[e+1][o+1]&&t++}}return rn.N2*t}static applyMaskPenaltyRule3(e){let t=0,r=e.getArray(),n=e.getWidth(),i=e.getHeight();for(let e=0;e<i;e++)for(let o=0;o<n;o++){let a=r[e];o+6<n&&1===a[o]&&0===a[o+1]&&1===a[o+2]&&1===a[o+3]&&1===a[o+4]&&0===a[o+5]&&1===a[o+6]&&(rn.isWhiteHorizontal(a,o-4,o)||rn.isWhiteHorizontal(a,o+7,o+11))&&t++,e+6<i&&1===r[e][o]&&0===r[e+1][o]&&1===r[e+2][o]&&1===r[e+3][o]&&1===r[e+4][o]&&0===r[e+5][o]&&1===r[e+6][o]&&(rn.isWhiteVertical(r,o,e-4,e)||rn.isWhiteVertical(r,o,e+7,e+11))&&t++}return t*rn.N3}static isWhiteHorizontal(e,t,r){t=Math.max(t,0),r=Math.min(r,e.length);for(let n=t;n<r;n++)if(1===e[n])return!1;return!0}static isWhiteVertical(e,t,r,n){r=Math.max(r,0),n=Math.min(n,e.length);for(let i=r;i<n;i++)if(1===e[i][t])return!1;return!0}static applyMaskPenaltyRule4(e){let t=0,r=e.getArray(),n=e.getWidth(),i=e.getHeight();for(let e=0;e<i;e++){let i=r[e];for(let e=0;e<n;e++)1===i[e]&&t++}let o=e.getHeight()*e.getWidth();return Math.floor(10*Math.abs(2*t-o)/o)*rn.N4}static getDataMaskBit(e,t,r){let n,i;switch(e){case 0:n=r+t&1;break;case 1:n=1&r;break;case 2:n=t%3;break;case 3:n=(r+t)%3;break;case 4:n=Math.floor(r/2)+Math.floor(t/3)&1;break;case 5:n=(1&(i=r*t))+i%3;break;case 6:n=(1&(i=r*t))+i%3&1;break;case 7:n=(i=r*t)%3+(r+t&1)&1;break;default:throw new D("Invalid mask pattern: "+e)}return 0===n}static applyMaskPenaltyRule1Internal(e,t){let r=0,n=t?e.getHeight():e.getWidth(),i=t?e.getWidth():e.getHeight(),o=e.getArray();for(let e=0;e<n;e++){let n=0,a=-1;for(let s=0;s<i;s++){let i=t?o[e][s]:o[s][e];i===a?n++:(n>=5&&(r+=rn.N1+(n-5)),n=1,a=i)}n>=5&&(r+=rn.N1+(n-5))}return r}}rn.N1=3,rn.N2=3,rn.N3=40,rn.N4=10;class ri{constructor(e,t){this.width=e,this.height=t;let r=Array(t);for(let n=0;n!==t;n++)r[n]=new Uint8Array(e);this.bytes=r}getHeight(){return this.height}getWidth(){return this.width}get(e,t){return this.bytes[t][e]}getArray(){return this.bytes}setNumber(e,t,r){this.bytes[t][e]=r}setBoolean(e,t,r){this.bytes[t][e]=+!!r}clear(e){for(let t of this.bytes)L.fill(t,e)}equals(e){if(!(e instanceof ri)||this.width!==e.width||this.height!==e.height)return!1;for(let t=0,r=this.height;t<r;++t){let r=this.bytes[t],n=e.bytes[t];for(let e=0,t=this.width;e<t;++e)if(r[e]!==n[e])return!1}return!0}toString(){let e=new W;for(let t=0,r=this.height;t<r;++t){let r=this.bytes[t];for(let t=0,n=this.width;t<n;++t)switch(r[t]){case 0:e.append(" 0");break;case 1:e.append(" 1");break;default:e.append(" ")}e.append("\n")}return e.toString()}}class ro{constructor(){this.maskPattern=-1}getMode(){return this.mode}getECLevel(){return this.ecLevel}getVersion(){return this.version}getMaskPattern(){return this.maskPattern}getMatrix(){return this.matrix}toString(){let e=new W;return e.append("<<\n"),e.append(" mode: "),e.append(this.mode?this.mode.toString():"null"),e.append("\n ecLevel: "),e.append(this.ecLevel?this.ecLevel.toString():"null"),e.append("\n version: "),e.append(this.version?this.version.toString():"null"),e.append("\n maskPattern: "),e.append(this.maskPattern.toString()),this.matrix?(e.append("\n matrix:\n"),e.append(this.matrix.toString())):e.append("\n matrix: null\n"),e.append(">>\n"),e.toString()}setMode(e){this.mode=e}setECLevel(e){this.ecLevel=e}setVersion(e){this.version=e}setMaskPattern(e){this.maskPattern=e}setMatrix(e){this.matrix=e}static isValidMaskPattern(e){return e>=0&&e<ro.NUM_MASK_PATTERNS}}ro.NUM_MASK_PATTERNS=8;class ra extends N{}ra.kind="WriterException";class rs{constructor(){}static clearMatrix(e){e.clear(255)}static buildMatrix(e,t,r,n,i){rs.clearMatrix(i),rs.embedBasicPatterns(r,i),rs.embedTypeInfo(t,n,i),rs.maybeEmbedVersionInfo(r,i),rs.embedDataBits(e,n,i)}static embedBasicPatterns(e,t){rs.embedPositionDetectionPatternsAndSeparators(t),rs.embedDarkDotAtLeftBottomCorner(t),rs.maybeEmbedPositionAdjustmentPatterns(e,t),rs.embedTimingPatterns(t)}static embedTypeInfo(e,t,r){let n=new F;rs.makeTypeInfoBits(e,t,n);for(let e=0,t=n.getSize();e<t;++e){let t=n.get(n.getSize()-1-e),i=rs.TYPE_INFO_COORDINATES[e],o=i[0],a=i[1];if(r.setBoolean(o,a,t),e<8){let n=r.getWidth()-e-1;r.setBoolean(n,8,t)}else{let n=r.getHeight()-7+(e-8);r.setBoolean(8,n,t)}}}static maybeEmbedVersionInfo(e,t){if(7>e.getVersionNumber())return;let r=new F;rs.makeVersionInfoBits(e,r);let n=17;for(let e=0;e<6;++e)for(let i=0;i<3;++i){let o=r.get(n);n--,t.setBoolean(e,t.getHeight()-11+i,o),t.setBoolean(t.getHeight()-11+i,e,o)}}static embedDataBits(e,t,r){let n=0,i=-1,o=r.getWidth()-1,a=r.getHeight()-1;for(;o>0;){for(6===o&&(o-=1);a>=0&&a<r.getHeight();){for(let i=0;i<2;++i){let s,l=o-i;rs.isEmpty(r.get(l,a))&&(n<e.getSize()?(s=e.get(n),++n):s=!1,255!==t&&rn.getDataMaskBit(t,l,a)&&(s=!s),r.setBoolean(l,a,s))}a+=i}a+=i=-i,o-=2}if(n!==e.getSize())throw new ra("Not all bits consumed: "+n+"/"+e.getSize())}static findMSBSet(e){return 32-k.numberOfLeadingZeros(e)}static calculateBCHCode(e,t){if(0===t)throw new D("0 polynomial");let r=rs.findMSBSet(t);for(e<<=r-1;rs.findMSBSet(e)>=r;)e^=t<<rs.findMSBSet(e)-r;return e}static makeTypeInfoBits(e,t,r){if(!ro.isValidMaskPattern(t))throw new ra("Invalid mask pattern");let n=e.getBits()<<3|t;r.appendBits(n,5);let i=rs.calculateBCHCode(n,rs.TYPE_INFO_POLY);r.appendBits(i,10);let o=new F;if(o.appendBits(rs.TYPE_INFO_MASK_PATTERN,15),r.xor(o),15!==r.getSize())throw new ra("should not happen but we got: "+r.getSize())}static makeVersionInfoBits(e,t){t.appendBits(e.getVersionNumber(),6);let r=rs.calculateBCHCode(e.getVersionNumber(),rs.VERSION_INFO_POLY);if(t.appendBits(r,12),18!==t.getSize())throw new ra("should not happen but we got: "+t.getSize())}static isEmpty(e){return 255===e}static embedTimingPatterns(e){for(let t=8;t<e.getWidth()-8;++t){let r=(t+1)%2;rs.isEmpty(e.get(t,6))&&e.setNumber(t,6,r),rs.isEmpty(e.get(6,t))&&e.setNumber(6,t,r)}}static embedDarkDotAtLeftBottomCorner(e){if(0===e.get(8,e.getHeight()-8))throw new ra;e.setNumber(8,e.getHeight()-8,1)}static embedHorizontalSeparationPattern(e,t,r){for(let n=0;n<8;++n){if(!rs.isEmpty(r.get(e+n,t)))throw new ra;r.setNumber(e+n,t,0)}}static embedVerticalSeparationPattern(e,t,r){for(let n=0;n<7;++n){if(!rs.isEmpty(r.get(e,t+n)))throw new ra;r.setNumber(e,t+n,0)}}static embedPositionAdjustmentPattern(e,t,r){for(let n=0;n<5;++n){let i=rs.POSITION_ADJUSTMENT_PATTERN[n];for(let o=0;o<5;++o)r.setNumber(e+o,t+n,i[o])}}static embedPositionDetectionPattern(e,t,r){for(let n=0;n<7;++n){let i=rs.POSITION_DETECTION_PATTERN[n];for(let o=0;o<7;++o)r.setNumber(e+o,t+n,i[o])}}static embedPositionDetectionPatternsAndSeparators(e){let t=rs.POSITION_DETECTION_PATTERN[0].length;rs.embedPositionDetectionPattern(0,0,e),rs.embedPositionDetectionPattern(e.getWidth()-t,0,e),rs.embedPositionDetectionPattern(0,e.getWidth()-t,e),rs.embedHorizontalSeparationPattern(0,7,e),rs.embedHorizontalSeparationPattern(e.getWidth()-8,7,e),rs.embedHorizontalSeparationPattern(0,e.getWidth()-8,e),rs.embedVerticalSeparationPattern(7,0,e),rs.embedVerticalSeparationPattern(e.getHeight()-7-1,0,e),rs.embedVerticalSeparationPattern(7,e.getHeight()-7,e)}static maybeEmbedPositionAdjustmentPatterns(e,t){if(2>e.getVersionNumber())return;let r=e.getVersionNumber()-1,n=rs.POSITION_ADJUSTMENT_PATTERN_COORDINATE_TABLE[r];for(let e=0,r=n.length;e!==r;e++){let i=n[e];if(i>=0)for(let e=0;e!==r;e++){let r=n[e];r>=0&&rs.isEmpty(t.get(r,i))&&rs.embedPositionAdjustmentPattern(r-2,i-2,t)}}}}rs.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])]),rs.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])]),rs.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])]),rs.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])]),rs.VERSION_INFO_POLY=7973,rs.TYPE_INFO_POLY=1335,rs.TYPE_INFO_MASK_PATTERN=21522;class rl{constructor(e,t){this.dataBytes=e,this.errorCorrectionBytes=t}getDataBytes(){return this.dataBytes}getErrorCorrectionBytes(){return this.errorCorrectionBytes}}class rc{constructor(){}static calculateMaskPenalty(e){return rn.applyMaskPenaltyRule1(e)+rn.applyMaskPenaltyRule2(e)+rn.applyMaskPenaltyRule3(e)+rn.applyMaskPenaltyRule4(e)}static encode(e,t,r=null){let n,i=rc.DEFAULT_BYTE_MODE_ENCODING,o=null!==r&&void 0!==r.get(rt.CHARACTER_SET);o&&(i=r.get(rt.CHARACTER_SET).toString());let a=this.chooseMode(e,i),s=new F;if(a===tb.BYTE&&(o||rc.DEFAULT_BYTE_MODE_ENCODING!==i)){let e=z.getCharacterSetECIByName(i);void 0!==e&&this.appendECI(e,s)}this.appendModeInfo(a,s);let l=new F;if(this.appendBytes(e,a,l,i),null!==r&&void 0!==r.get(rt.QR_VERSION)){let e=Number.parseInt(r.get(rt.QR_VERSION).toString(),10);n=ty.getVersionForNumber(e);let i=this.calculateBitsNeeded(a,s,l,n);if(!this.willFit(i,n,t))throw new ra("Data too big for requested version")}else n=this.recommendVersion(t,a,s,l);let c=new F;c.appendBitArray(s);let u=a===tb.BYTE?l.getSizeInBytes():e.length;this.appendLengthInfo(u,n,a,c),c.appendBitArray(l);let h=n.getECBlocksForLevel(t),d=n.getTotalCodewords()-h.getTotalECCodewords();this.terminateBits(d,c);let f=this.interleaveWithECBytes(c,n.getTotalCodewords(),d,h.getNumBlocks()),g=new ro;g.setECLevel(t),g.setMode(a),g.setVersion(n);let p=n.getDimensionForVersion(),m=new ri(p,p),w=this.chooseMaskPattern(f,t,n,m);return g.setMaskPattern(w),rs.buildMatrix(f,t,n,w,m),g.setMatrix(m),g}static recommendVersion(e,t,r,n){let i=this.calculateBitsNeeded(t,r,n,ty.getVersionForNumber(1)),o=this.chooseVersion(i,e),a=this.calculateBitsNeeded(t,r,n,o);return this.chooseVersion(a,e)}static calculateBitsNeeded(e,t,r,n){return t.getSize()+e.getCharacterCountBits(n)+r.getSize()}static getAlphanumericCode(e){return e<rc.ALPHANUMERIC_TABLE.length?rc.ALPHANUMERIC_TABLE[e]:-1}static chooseMode(e,t=null){if(z.SJIS.getName()===t&&this.isOnlyDoubleByteKanji(e))return tb.KANJI;let r=!1,n=!1;for(let t=0,i=e.length;t<i;++t){let i=e.charAt(t);if(rc.isDigit(i))r=!0;else{if(-1===this.getAlphanumericCode(i.charCodeAt(0)))return tb.BYTE;n=!0}}return n?tb.ALPHANUMERIC:r?tb.NUMERIC:tb.BYTE}static isOnlyDoubleByteKanji(e){let t;try{t=j.encode(e,z.SJIS)}catch(e){return!1}let r=t.length;if(r%2!=0)return!1;for(let e=0;e<r;e+=2){let r=255&t[e];if((r<129||r>159)&&(r<224||r>235))return!1}return!0}static chooseMaskPattern(e,t,r,n){let i=Number.MAX_SAFE_INTEGER,o=-1;for(let a=0;a<ro.NUM_MASK_PATTERNS;a++){rs.buildMatrix(e,t,r,a,n);let s=this.calculateMaskPenalty(n);s<i&&(i=s,o=a)}return o}static chooseVersion(e,t){for(let r=1;r<=40;r++){let n=ty.getVersionForNumber(r);if(rc.willFit(e,n,t))return n}throw new ra("Data too big")}static willFit(e,t,r){let n=t.getTotalCodewords();return n-t.getECBlocksForLevel(r).getTotalECCodewords()>=(e+7)/8}static terminateBits(e,t){let r=8*e;if(t.getSize()>r)throw new ra("data bits cannot fit in the QR Code"+t.getSize()+" > "+r);for(let e=0;e<4&&t.getSize()<r;++e)t.appendBit(!1);let n=7&t.getSize();if(n>0)for(let e=n;e<8;e++)t.appendBit(!1);let i=e-t.getSizeInBytes();for(let e=0;e<i;++e)t.appendBits((1&e)==0?236:17,8);if(t.getSize()!==r)throw new ra("Bits size does not equal capacity")}static getNumDataBytesAndNumECBytesForBlockID(e,t,r,n,i,o){if(n>=r)throw new ra("Block ID too large");let a=e%r,s=r-a,l=Math.floor(e/r),c=Math.floor(t/r),u=c+1,h=l-c,d=l+1-u;if(h!==d)throw new ra("EC bytes mismatch");if(r!==s+a)throw new ra("RS blocks mismatch");if(e!==(c+h)*s+(u+d)*a)throw new ra("Total bytes mismatch");n<s?(i[0]=c,o[0]=h):(i[0]=u,o[0]=d)}static interleaveWithECBytes(e,t,r,n){if(e.getSizeInBytes()!==r)throw new ra("Number of bits and data bytes does not match");let i=0,o=0,a=0,s=[];for(let l=0;l<n;++l){let c=new Int32Array(1),u=new Int32Array(1);rc.getNumDataBytesAndNumECBytesForBlockID(t,r,n,l,c,u);let h=c[0],d=new Uint8Array(h);e.toBytes(8*i,d,0,h);let f=rc.generateECBytes(d,u[0]);s.push(new rl(d,f)),o=Math.max(o,h),a=Math.max(a,f.length),i+=c[0]}if(r!==i)throw new ra("Data bytes does not match offset");let l=new F;for(let e=0;e<o;++e)for(let t of s){let r=t.getDataBytes();e<r.length&&l.appendBits(r[e],8)}for(let e=0;e<a;++e)for(let t of s){let r=t.getErrorCorrectionBytes();e<r.length&&l.appendBits(r[e],8)}if(t!==l.getSizeInBytes())throw new ra("Interleaving error: "+t+" and "+l.getSizeInBytes()+" differ.");return l}static generateECBytes(e,t){let r=e.length,n=new Int32Array(r+t);for(let t=0;t<r;t++)n[t]=255&e[t];new rr(ec.QR_CODE_FIELD_256).encode(n,t);let i=new Uint8Array(t);for(let e=0;e<t;e++)i[e]=n[r+e];return i}static appendModeInfo(e,t){t.appendBits(e.getBits(),4)}static appendLengthInfo(e,t,r,n){let i=r.getCharacterCountBits(t);if(e>=1<<i)throw new ra(e+" is bigger than "+((1<<i)-1));n.appendBits(e,i)}static appendBytes(e,t,r,n){switch(t){case tb.NUMERIC:rc.appendNumericBytes(e,r);break;case tb.ALPHANUMERIC:rc.appendAlphanumericBytes(e,r);break;case tb.BYTE:rc.append8BitBytes(e,r,n);break;case tb.KANJI:rc.appendKanjiBytes(e,r);break;default:throw new ra("Invalid mode: "+t)}}static getDigit(e){return e.charCodeAt(0)-48}static isDigit(e){let t=rc.getDigit(e);return t>=0&&t<=9}static appendNumericBytes(e,t){let r=e.length,n=0;for(;n<r;){let i=rc.getDigit(e.charAt(n));if(n+2<r){let r=rc.getDigit(e.charAt(n+1)),o=rc.getDigit(e.charAt(n+2));t.appendBits(100*i+10*r+o,10),n+=3}else if(n+1<r){let r=rc.getDigit(e.charAt(n+1));t.appendBits(10*i+r,7),n+=2}else t.appendBits(i,4),n++}}static appendAlphanumericBytes(e,t){let r=e.length,n=0;for(;n<r;){let i=rc.getAlphanumericCode(e.charCodeAt(n));if(-1===i)throw new ra;if(n+1<r){let r=rc.getAlphanumericCode(e.charCodeAt(n+1));if(-1===r)throw new ra;t.appendBits(45*i+r,11),n+=2}else t.appendBits(i,6),n++}}static append8BitBytes(e,t,r){let n;try{n=j.encode(e,r)}catch(e){throw new ra(e)}for(let e=0,r=n.length;e!==r;e++){let r=n[e];t.appendBits(r,8)}}static appendKanjiBytes(e,t){let r;try{r=j.encode(e,z.SJIS)}catch(e){throw new ra(e)}let n=r.length;for(let e=0;e<n;e+=2){let n=(255&r[e])<<8&0xffffffff|255&r[e+1],i=-1;if(n>=33088&&n<=40956?i=n-33088:n>=57408&&n<=60351&&(i=n-49472),-1===i)throw new ra("Invalid byte sequence");let o=(i>>8)*192+(255&i);t.appendBits(o,13)}}static appendECI(e,t){t.appendBits(tb.ECI.getBits(),4),t.appendBits(e.getValue(),8)}}rc.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]),rc.DEFAULT_BYTE_MODE_ENCODING=z.UTF8.getName();class ru{write(e,t,r,n=null){if(0===e.length)throw new D("Found empty contents");if(t<0||r<0)throw new D("Requested dimensions are too small: "+t+"x"+r);let i=tw.L,o=ru.QUIET_ZONE_SIZE;null!==n&&(void 0!==n.get(rt.ERROR_CORRECTION)&&(i=tw.fromString(n.get(rt.ERROR_CORRECTION).toString())),void 0!==n.get(rt.MARGIN)&&(o=Number.parseInt(n.get(rt.MARGIN).toString(),10)));let a=rc.encode(e,i,n);return this.renderResult(a,t,r,o)}writeToDom(e,t,r,n,i=null){"string"==typeof e&&(e=document.querySelector(e));let o=this.write(t,r,n,i);e&&e.appendChild(o)}renderResult(e,t,r,n){let i=e.getMatrix();if(null===i)throw new eh;let o=i.getWidth(),a=i.getHeight(),s=o+2*n,l=a+2*n,c=Math.max(t,s),u=Math.max(r,l),h=Math.min(Math.floor(c/s),Math.floor(u/l)),d=Math.floor((c-o*h)/2),f=Math.floor((u-a*h)/2),g=this.createSVGElement(c,u);for(let e=0,t=f;e<a;e++,t+=h)for(let r=0,n=d;r<o;r++,n+=h)if(1===i.get(r,e)){let e=this.createSvgRectElement(n,t,h,h);g.appendChild(e)}return g}createSVGElement(e,t){let r=document.createElementNS(ru.SVG_NS,"svg");return r.setAttributeNS(null,"height",e.toString()),r.setAttributeNS(null,"width",t.toString()),r}createSvgRectElement(e,t,r,n){let i=document.createElementNS(ru.SVG_NS,"rect");return i.setAttributeNS(null,"x",e.toString()),i.setAttributeNS(null,"y",t.toString()),i.setAttributeNS(null,"height",r.toString()),i.setAttributeNS(null,"width",n.toString()),i.setAttributeNS(null,"fill","#000000"),i}}ru.QUIET_ZONE_SIZE=4,ru.SVG_NS="http://www.w3.org/2000/svg";class rh{encode(e,t,r,n,i){if(0===e.length)throw new D("Found empty contents");if(t!==en.QR_CODE)throw new D("Can only encode QR_CODE, but got "+t);if(r<0||n<0)throw new D(`Requested dimensions are too small: ${r}x${n}`);let o=tw.L,a=rh.QUIET_ZONE_SIZE;null!==i&&(void 0!==i.get(rt.ERROR_CORRECTION)&&(o=tw.fromString(i.get(rt.ERROR_CORRECTION).toString())),void 0!==i.get(rt.MARGIN)&&(a=Number.parseInt(i.get(rt.MARGIN).toString(),10)));let s=rc.encode(e,o,i);return rh.renderResult(s,r,n,a)}static renderResult(e,t,r,n){let i=e.getMatrix();if(null===i)throw new eh;let o=i.getWidth(),a=i.getHeight(),s=o+2*n,l=a+2*n,c=Math.max(t,s),u=Math.max(r,l),h=Math.min(Math.floor(c/s),Math.floor(u/l)),d=Math.floor((c-o*h)/2),f=Math.floor((u-a*h)/2),g=new Y(c,u);for(let e=0,t=f;e<a;e++,t+=h)for(let r=0,n=d;r<o;r++,n+=h)1===i.get(r,e)&&g.setRegion(n,t,h,h);return g}}rh.QUIET_ZONE_SIZE=4;class rd extends q{constructor(e,t,r,n,i,o,a,s){if(super(o,a),this.yuvData=e,this.dataWidth=t,this.dataHeight=r,this.left=n,this.top=i,n+o>t||i+a>r)throw new D("Crop rectangle does not fit within image data.");s&&this.reverseHorizontal(o,a)}getRow(e,t){if(e<0||e>=this.getHeight())throw new D("Requested row is outside the image: "+e);let r=this.getWidth();(null==t||t.length<r)&&(t=new Uint8ClampedArray(r));let n=(e+this.top)*this.dataWidth+this.left;return P.arraycopy(this.yuvData,n,t,0,r),t}getMatrix(){let e=this.getWidth(),t=this.getHeight();if(e===this.dataWidth&&t===this.dataHeight)return this.yuvData;let r=e*t,n=new Uint8ClampedArray(r),i=this.top*this.dataWidth+this.left;if(e===this.dataWidth)return P.arraycopy(this.yuvData,i,n,0,r),n;for(let r=0;r<t;r++){let t=r*e;P.arraycopy(this.yuvData,i,n,t,e),i+=this.dataWidth}return n}isCropSupported(){return!0}crop(e,t,r,n){return new rd(this.yuvData,this.dataWidth,this.dataHeight,this.left+e,this.top+t,r,n,!1)}renderThumbnail(){let e=this.getWidth()/rd.THUMBNAIL_SCALE_FACTOR,t=this.getHeight()/rd.THUMBNAIL_SCALE_FACTOR,r=new Int32Array(e*t),n=this.yuvData,i=this.top*this.dataWidth+this.left;for(let o=0;o<t;o++){let t=o*e;for(let o=0;o<e;o++){let e=255&n[i+o*rd.THUMBNAIL_SCALE_FACTOR];r[t+o]=0xff000000|65793*e}i+=this.dataWidth*rd.THUMBNAIL_SCALE_FACTOR}return r}getThumbnailWidth(){return this.getWidth()/rd.THUMBNAIL_SCALE_FACTOR}getThumbnailHeight(){return this.getHeight()/rd.THUMBNAIL_SCALE_FACTOR}reverseHorizontal(e,t){let r=this.yuvData;for(let n=0,i=this.top*this.dataWidth+this.left;n<t;n++,i+=this.dataWidth){let t=i+e/2;for(let n=i,o=i+e-1;n<t;n++,o--){let e=r[n];r[n]=r[o],r[o]=e}}}invert(){return new K(this)}}rd.THUMBNAIL_SCALE_FACTOR=2;class rf extends q{constructor(e,t,r,n,i,o,a){if(super(t,r),this.dataWidth=n,this.dataHeight=i,this.left=o,this.top=a,4===e.BYTES_PER_ELEMENT){let n=t*r,i=new Uint8ClampedArray(n);for(let t=0;t<n;t++){let r=e[t],n=r>>16&255,o=r>>7&510,a=255&r;i[t]=(n+o+a)/4&255}this.luminances=i}else this.luminances=e;if(void 0===n&&(this.dataWidth=t),void 0===i&&(this.dataHeight=r),void 0===o&&(this.left=0),void 0===a&&(this.top=0),this.left+t>this.dataWidth||this.top+r>this.dataHeight)throw new D("Crop rectangle does not fit within image data.")}getRow(e,t){if(e<0||e>=this.getHeight())throw new D("Requested row is outside the image: "+e);let r=this.getWidth();(null==t||t.length<r)&&(t=new Uint8ClampedArray(r));let n=(e+this.top)*this.dataWidth+this.left;return P.arraycopy(this.luminances,n,t,0,r),t}getMatrix(){let e=this.getWidth(),t=this.getHeight();if(e===this.dataWidth&&t===this.dataHeight)return this.luminances;let r=e*t,n=new Uint8ClampedArray(r),i=this.top*this.dataWidth+this.left;if(e===this.dataWidth)return P.arraycopy(this.luminances,i,n,0,r),n;for(let r=0;r<t;r++){let t=r*e;P.arraycopy(this.luminances,i,n,t,e),i+=this.dataWidth}return n}isCropSupported(){return!0}crop(e,t,r,n){return new rf(this.luminances,r,n,this.dataWidth,this.dataHeight,this.left+e,this.top+t)}invert(){return new K(this)}}class rg extends z{static forName(e){return this.getCharacterSetECIByName(e)}}class rp{}rp.ISO_8859_1=z.ISO8859_1;class rm{isCompact(){return this.compact}setCompact(e){this.compact=e}getSize(){return this.size}setSize(e){this.size=e}getLayers(){return this.layers}setLayers(e){this.layers=e}getCodeWords(){return this.codeWords}setCodeWords(e){this.codeWords=e}getMatrix(){return this.matrix}setMatrix(e){this.matrix=e}}class rw{static singletonList(e){return[e]}static min(e,t){return e.sort(t)[0]}}class rC{constructor(e){this.previous=e}getPrevious(){return this.previous}}class rE extends rC{constructor(e,t,r){super(e),this.value=t,this.bitCount=r}appendTo(e,t){e.appendBits(this.value,this.bitCount)}add(e,t){return new rE(this,e,t)}addBinaryShift(e,t){return console.warn("addBinaryShift on SimpleToken, this simply returns a copy of this token"),new rE(this,e,t)}toString(){let e=this.value&(1<<this.bitCount)-1;return e|=1<<this.bitCount,"<"+k.toBinaryString(e|1<<this.bitCount).substring(1)+">"}}class rA extends rE{constructor(e,t,r){super(e,0,0),this.binaryShiftStart=t,this.binaryShiftByteCount=r}appendTo(e,t){for(let r=0;r<this.binaryShiftByteCount;r++)(0===r||31===r&&this.binaryShiftByteCount<=62)&&(e.appendBits(31,5),this.binaryShiftByteCount>62?e.appendBits(this.binaryShiftByteCount-31,16):0===r?e.appendBits(Math.min(this.binaryShiftByteCount,31),5):e.appendBits(this.binaryShiftByteCount-31,5)),e.appendBits(t[this.binaryShiftStart+r],8)}addBinaryShift(e,t){return new rA(this,e,t)}toString(){return"<"+this.binaryShiftStart+"::"+(this.binaryShiftStart+this.binaryShiftByteCount-1)+">"}}function ry(e,t,r){return new rE(e,t,r)}let rI=["UPPER","LOWER","DIGIT","MIXED","PUNCT"],rS=new rE(null,0,0),r_=[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])],rb=function(e){for(let t of e)L.fill(t,-1);return e[0][4]=0,e[1][4]=0,e[1][0]=28,e[3][4]=0,e[2][4]=0,e[2][0]=15,e}(L.createInt32Array(6,6));class rT{constructor(e,t,r,n){this.token=e,this.mode=t,this.binaryShiftByteCount=r,this.bitCount=n}getMode(){return this.mode}getToken(){return this.token}getBinaryShiftByteCount(){return this.binaryShiftByteCount}getBitCount(){return this.bitCount}latchAndAppend(e,t){let r=this.bitCount,n=this.token;if(e!==this.mode){let t=r_[this.mode][e];n=ry(n,65535&t,t>>16),r+=t>>16}let i=2===e?4:5;return new rT(n=ry(n,t,i),e,0,r+i)}shiftAndAppend(e,t){let r=this.token,n=2===this.mode?4:5;return r=ry(r,rb[this.mode][e],n),new rT(r=ry(r,t,5),this.mode,0,this.bitCount+n+5)}addBinaryShiftChar(e){let t=this.token,r=this.mode,n=this.bitCount;if(4===this.mode||2===this.mode){let e=r_[r][0];t=ry(t,65535&e,e>>16),n+=e>>16,r=0}let i=0===this.binaryShiftByteCount||31===this.binaryShiftByteCount?18:62===this.binaryShiftByteCount?9:8,o=new rT(t,r,this.binaryShiftByteCount+1,n+i);return 2078===o.binaryShiftByteCount&&(o=o.endBinaryShift(e+1)),o}endBinaryShift(e){if(0===this.binaryShiftByteCount)return this;let t=this.token;return new rT(t=new rA(t,e-this.binaryShiftByteCount,this.binaryShiftByteCount),this.mode,0,this.bitCount)}isBetterThanOrEqualTo(e){let t=this.bitCount+(r_[this.mode][e.mode]>>16);return this.binaryShiftByteCount<e.binaryShiftByteCount?t+=rT.calculateBinaryShiftCost(e)-rT.calculateBinaryShiftCost(this):this.binaryShiftByteCount>e.binaryShiftByteCount&&e.binaryShiftByteCount>0&&(t+=10),t<=e.bitCount}toBitArray(e){let t=[];for(let r=this.endBinaryShift(e.length).token;null!==r;r=r.getPrevious())t.unshift(r);let r=new F;for(let n of t)n.appendTo(r,e);return r}toString(){return G.format("%s bits=%d bytes=%d",rI[this.mode],this.bitCount,this.binaryShiftByteCount)}static calculateBinaryShiftCost(e){return e.binaryShiftByteCount>62?21:e.binaryShiftByteCount>31?20:10*(e.binaryShiftByteCount>0)}}rT.INITIAL_STATE=new rT(rS,0,0,0);let rN=function(e){let t=G.getCharCode(" "),r=G.getCharCode("."),n=G.getCharCode(",");e[0][t]=1;let i=G.getCharCode("Z"),o=G.getCharCode("A");for(let t=o;t<=i;t++)e[0][t]=t-o+2;e[1][t]=1;let a=G.getCharCode("z"),s=G.getCharCode("a");for(let t=s;t<=a;t++)e[1][t]=t-s+2;e[2][t]=1;let l=G.getCharCode("9"),c=G.getCharCode("0");for(let t=c;t<=l;t++)e[2][t]=t-c+2;e[2][n]=12,e[2][r]=13;let u=["\0"," ","\x01","\x02","\x03","\x04","\x05","\x06","\x07","\b"," ","\n","\v","\f","\r","\x1b","\x1c","\x1d","\x1e","\x1f","@","\\","^","_","`","|","~",""];for(let t=0;t<u.length;t++)e[3][G.getCharCode(u[t])]=t;let h=["\0","\r","\0","\0","\0","\0","!","'","#","$","%","&","'","(",")","*","+",",","-",".","/",":",";","<","=",">","?","[","]","{","}"];for(let t=0;t<h.length;t++)G.getCharCode(h[t])>0&&(e[4][G.getCharCode(h[t])]=t);return e}(L.createInt32Array(5,256));class rM{constructor(e){this.text=e}encode(){let e=G.getCharCode(" "),t=G.getCharCode("\n"),r=rw.singletonList(rT.INITIAL_STATE);for(let n=0;n<this.text.length;n++){let i,o=n+1<this.text.length?this.text[n+1]:0;switch(this.text[n]){case G.getCharCode("\r"):i=2*(o===t);break;case G.getCharCode("."):i=3*(o===e);break;case G.getCharCode(","):i=4*(o===e);break;case G.getCharCode(":"):i=5*(o===e);break;default:i=0}i>0?(r=rM.updateStateListForPair(r,n,i),n++):r=this.updateStateListForChar(r,n)}return rw.min(r,(e,t)=>e.getBitCount()-t.getBitCount()).toBitArray(this.text)}updateStateListForChar(e,t){let r=[];for(let n of e)this.updateStateForChar(n,t,r);return rM.simplifyStates(r)}updateStateForChar(e,t,r){let n=255&this.text[t],i=rN[e.getMode()][n]>0,o=null;for(let a=0;a<=4;a++){let s=rN[a][n];if(s>0){if(null==o&&(o=e.endBinaryShift(t)),!i||a===e.getMode()||2===a){let e=o.latchAndAppend(a,s);r.push(e)}if(!i&&rb[e.getMode()][a]>=0){let e=o.shiftAndAppend(a,s);r.push(e)}}}if(e.getBinaryShiftByteCount()>0||0===rN[e.getMode()][n]){let n=e.addBinaryShiftChar(t);r.push(n)}}static updateStateListForPair(e,t,r){let n=[];for(let i of e)this.updateStateForPair(i,t,r,n);return this.simplifyStates(n)}static updateStateForPair(e,t,r,n){let i=e.endBinaryShift(t);if(n.push(i.latchAndAppend(4,r)),4!==e.getMode()&&n.push(i.shiftAndAppend(4,r)),3===r||4===r){let e=i.latchAndAppend(2,16-r).latchAndAppend(2,1);n.push(e)}if(e.getBinaryShiftByteCount()>0){let r=e.addBinaryShiftChar(t).addBinaryShiftChar(t+1);n.push(r)}}static simplifyStates(e){let t=[];for(let r of e){let e=!0;for(let n of t){if(n.isBetterThanOrEqualTo(r)){e=!1;break}r.isBetterThanOrEqualTo(n)&&(t=t.filter(e=>e!==n))}e&&t.push(r)}return t}}class rD{constructor(){}static encodeBytes(e){return rD.encode(e,rD.DEFAULT_EC_PERCENT,rD.DEFAULT_AZTEC_LAYERS)}static encode(e,t,r){let n,i,o,a,s,l,c=new rM(e).encode(),u=k.truncDivision(c.getSize()*t,100)+11,h=c.getSize()+u;if(r!==rD.DEFAULT_AZTEC_LAYERS){if(n=r<0,(i=Math.abs(r))>(n?rD.MAX_NB_BITS_COMPACT:rD.MAX_NB_BITS))throw new D(G.format("Illegal value %s for layers",r));let e=(o=rD.totalBitsInLayer(i,n))-o%(a=rD.WORD_SIZE[i]);if((s=rD.stuffBits(c,a)).getSize()+u>e||n&&s.getSize()>64*a)throw new D("Data to large for user specified layer")}else{a=0,s=null;for(let e=0;;e++){if(e>rD.MAX_NB_BITS)throw new D("Data too large for an Aztec code");if(i=(n=e<=3)?e+1:e,h>(o=rD.totalBitsInLayer(i,n)))continue;(null==s||a!==rD.WORD_SIZE[i])&&(a=rD.WORD_SIZE[i],s=rD.stuffBits(c,a));let t=o-o%a;if(!(n&&s.getSize()>64*a)&&s.getSize()+u<=t)break}}let d=rD.generateCheckWords(s,o,a),f=s.getSize()/a,g=rD.generateModeMessage(n,i,f),p=(n?11:14)+4*i,m=new Int32Array(p);if(n){l=p;for(let e=0;e<m.length;e++)m[e]=e}else{l=p+1+2*k.truncDivision(k.truncDivision(p,2)-1,15);let e=k.truncDivision(p,2),t=k.truncDivision(l,2);for(let r=0;r<e;r++){let n=r+k.truncDivision(r,15);m[e-r-1]=t-n-1,m[e+r]=t+n+1}}let w=new Y(l);for(let e=0,t=0;e<i;e++){let r=(i-e)*4+(n?9:12);for(let n=0;n<r;n++){let i=2*n;for(let o=0;o<2;o++)d.get(t+i+o)&&w.set(m[2*e+o],m[2*e+n]),d.get(t+2*r+i+o)&&w.set(m[2*e+n],m[p-1-2*e-o]),d.get(t+4*r+i+o)&&w.set(m[p-1-2*e-o],m[p-1-2*e-n]),d.get(t+6*r+i+o)&&w.set(m[p-1-2*e-n],m[2*e+o])}t+=8*r}if(rD.drawModeMessage(w,n,l,g),n)rD.drawBullsEye(w,k.truncDivision(l,2),5);else{rD.drawBullsEye(w,k.truncDivision(l,2),7);for(let e=0,t=0;e<k.truncDivision(p,2)-1;e+=15,t+=16)for(let e=1&k.truncDivision(l,2);e<l;e+=2)w.set(k.truncDivision(l,2)-t,e),w.set(k.truncDivision(l,2)+t,e),w.set(e,k.truncDivision(l,2)-t),w.set(e,k.truncDivision(l,2)+t)}let C=new rm;return C.setCompact(n),C.setSize(l),C.setLayers(i),C.setCodeWords(f),C.setMatrix(w),C}static drawBullsEye(e,t,r){for(let n=0;n<r;n+=2)for(let r=t-n;r<=t+n;r++)e.set(r,t-n),e.set(r,t+n),e.set(t-n,r),e.set(t+n,r);e.set(t-r,t-r),e.set(t-r+1,t-r),e.set(t-r,t-r+1),e.set(t+r,t-r),e.set(t+r,t-r+1),e.set(t+r,t+r-1)}static generateModeMessage(e,t,r){let n=new F;return e?(n.appendBits(t-1,2),n.appendBits(r-1,6),n=rD.generateCheckWords(n,28,4)):(n.appendBits(t-1,5),n.appendBits(r-1,11),n=rD.generateCheckWords(n,40,4)),n}static drawModeMessage(e,t,r,n){let i=k.truncDivision(r,2);if(t)for(let t=0;t<7;t++){let r=i-3+t;n.get(t)&&e.set(r,i-5),n.get(t+7)&&e.set(i+5,r),n.get(20-t)&&e.set(r,i+5),n.get(27-t)&&e.set(i-5,r)}else for(let t=0;t<10;t++){let r=i-5+t+k.truncDivision(t,5);n.get(t)&&e.set(r,i-7),n.get(t+10)&&e.set(i+7,r),n.get(29-t)&&e.set(r,i+7),n.get(39-t)&&e.set(i-7,r)}}static generateCheckWords(e,t,r){let n=e.getSize()/r,i=new rr(rD.getGF(r)),o=k.truncDivision(t,r),a=rD.bitsToWords(e,r,o);i.encode(a,o-n);let s=t%r,l=new F;for(let e of(l.appendBits(0,s),Array.from(a)))l.appendBits(e,r);return l}static bitsToWords(e,t,r){let n,i,o=new Int32Array(r);for(n=0,i=e.getSize()/t;n<i;n++){let r=0;for(let i=0;i<t;i++)r|=e.get(n*t+i)?1<<t-i-1:0;o[n]=r}return o}static getGF(e){switch(e){case 4:return ec.AZTEC_PARAM;case 6:return ec.AZTEC_DATA_6;case 8:return ec.AZTEC_DATA_8;case 10:return ec.AZTEC_DATA_10;case 12:return ec.AZTEC_DATA_12;default:throw new D("Unsupported word size "+e)}}static stuffBits(e,t){let r=new F,n=e.getSize(),i=(1<<t)-2;for(let o=0;o<n;o+=t){let a=0;for(let r=0;r<t;r++)(o+r>=n||e.get(o+r))&&(a|=1<<t-1-r);(a&i)===i?(r.appendBits(a&i,t),o--):(a&i)==0?(r.appendBits(1|a,t),o--):r.appendBits(a,t)}return r}static totalBitsInLayer(e,t){return((t?88:112)+16*e)*e}}rD.DEFAULT_EC_PERCENT=33,rD.DEFAULT_AZTEC_LAYERS=0,rD.MAX_NB_BITS=32,rD.MAX_NB_BITS_COMPACT=4,rD.WORD_SIZE=Int32Array.from([4,6,6,8,8,8,8,8,8,10,10,10,10,10,10,10,10,10,10,10,10,10,10,12,12,12,12,12,12,12,12,12,12]);class rO{encode(e,t,r,n){return this.encodeWithHints(e,t,r,n,null)}encodeWithHints(e,t,r,n,i){let o=rp.ISO_8859_1,a=rD.DEFAULT_EC_PERCENT,s=rD.DEFAULT_AZTEC_LAYERS;return null!=i&&(i.has(rt.CHARACTER_SET)&&(o=rg.forName(i.get(rt.CHARACTER_SET).toString())),i.has(rt.ERROR_CORRECTION)&&(a=k.parseInt(i.get(rt.ERROR_CORRECTION).toString())),i.has(rt.AZTEC_LAYERS)&&(s=k.parseInt(i.get(rt.AZTEC_LAYERS).toString()))),rO.encodeLayers(e,t,r,n,o,a,s)}static encodeLayers(e,t,r,n,i,o,a){if(t!==en.AZTEC)throw new D("Can only encode AZTEC, but got "+t);let s=rD.encode(G.getBytes(e,i),o,a);return rO.renderResult(s,r,n)}static renderResult(e,t,r){let n=e.getMatrix();if(null==n)throw new eh;let i=n.getWidth(),o=n.getHeight(),a=Math.max(t,i),s=Math.max(r,o),l=Math.min(a/i,s/o),c=(a-i*l)/2,u=(s-o*l)/2,h=new Y(a,s);for(let e=0,t=u;e<o;e++,t+=l)for(let r=0,o=c;r<i;r++,o+=l)n.get(r,e)&&h.setRegion(o,t,l,l);return h}}e.AbstractExpandedDecoder=eJ,e.ArgumentException=M,e.ArithmeticException=el,e.AztecCode=rm,e.AztecCodeReader=eT,e.AztecCodeWriter=rO,e.AztecDecoder=ef,e.AztecDetector=eb,e.AztecDetectorResult=eC,e.AztecEncoder=rD,e.AztecHighLevelEncoder=rM,e.AztecPoint=e_,e.BarcodeFormat=en,e.Binarizer=v,e.BinaryBitmap=O,e.BitArray=F,e.BitMatrix=Y,e.BitSource=td,e.BrowserAztecCodeReader=class extends et{constructor(e=500){super(new eT,e)}},e.BrowserBarcodeReader=class extends et{constructor(e=500,t){super(new ta(t),e,t)}},e.BrowserCodeReader=et,e.BrowserDatamatrixCodeReader=class extends et{constructor(e=500){super(new tm,e)}},e.BrowserMultiFormatReader=class extends et{constructor(e=null,t=500){let r=new re;r.setHints(e),super(r,t)}decodeBitmap(e){return this.reader.decodeWithState(e)}},e.BrowserPDF417Reader=class extends et{constructor(e=500){super(new t7,e)}},e.BrowserQRCodeReader=class extends et{constructor(e=500){super(new tx,e)}},e.BrowserQRCodeSvgWriter=ru,e.CharacterSetECI=z,e.ChecksumException=R,e.Code128Reader=eM,e.Code39Reader=eD,e.DataMatrixDecodedBitStreamParser=tf,e.DataMatrixReader=tm,e.DecodeHintType=U,e.DecoderResult=eo,e.DefaultGridSampler=eI,e.DetectorResult=ew,e.EAN13Reader=eL,e.EncodeHintType=rt,e.Exception=N,e.FormatException=H,e.GenericGF=ec,e.GenericGFPoly=es,e.GlobalHistogramBinarizer=Z,e.GridSampler=eA,e.GridSamplerInstance=eS,e.HTMLCanvasElementLuminanceSource=$,e.HybridBinarizer=Q,e.ITFReader=eO,e.IllegalArgumentException=D,e.IllegalStateException=eh,e.InvertedLuminanceSource=K,e.LuminanceSource=q,e.MathUtils=eg,e.MultiFormatOneDReader=ta,e.MultiFormatReader=re,e.MultiFormatWriter=class{encode(e,t,r,n,i){let o;if(t===en.QR_CODE)o=new rh;else throw new D("No encoder available for format "+t);return o.encode(e,t,r,n,i)}},e.NotFoundException=X,e.OneDReader=eN,e.PDF417DecodedBitStreamParser=t6,e.PDF417DecoderErrorCorrection=tV,e.PDF417Reader=t7,e.PDF417ResultMetadata=t$,e.PerspectiveTransform=ey,e.PlanarYUVLuminanceSource=rd,e.QRCodeByteMatrix=ri,e.QRCodeDataMask=tI,e.QRCodeDecodedBitStreamParser=tT,e.QRCodeDecoderErrorCorrectionLevel=tw,e.QRCodeDecoderFormatInformation=tC,e.QRCodeEncoder=rc,e.QRCodeEncoderQRCode=ro,e.QRCodeMaskUtil=rn,e.QRCodeMatrixUtil=rs,e.QRCodeMode=tb,e.QRCodeReader=tx,e.QRCodeVersion=ty,e.QRCodeWriter=rh,e.RGBLuminanceSource=rf,e.RSS14Reader=to,e.RSSExpandedReader=tn,e.ReaderException=t9,e.ReedSolomonDecoder=ed,e.ReedSolomonEncoder=rr,e.ReedSolomonException=eu,e.Result=er,e.ResultMetadataType=ei,e.ResultPoint=em,e.StringUtils=G,e.UnsupportedOperationException=V,e.VideoInputDevice=J,e.WhiteRectangleDetector=eE,e.WriterException=ra,e.ZXingArrays=L,e.ZXingCharset=rg,e.ZXingInteger=k,e.ZXingStandardCharsets=rp,e.ZXingStringBuilder=W,e.ZXingStringEncoding=j,e.ZXingSystem=P,e.createAbstractExpandedDecoder=te,Object.defineProperty(e,"__esModule",{value:!0})})(t)},195:function(e,t,r){"use strict";var n=r(111);t.createRoot=n.createRoot,t.hydrateRoot=n.hydrateRoot},581:function(e){e.exports=function(e,t){return"undefined"!=typeof __deoptimization_sideEffect__&&__deoptimization_sideEffect__(e,t),t}},278:function(e){"use strict";var t=[];function r(e){for(var r=-1,n=0;n<t.length;n++)if(t[n].identifier===e){r=n;break}return r}function n(e,n){for(var i={},o=[],a=0;a<e.length;a++){var s=e[a],l=n.base?s[0]+n.base:s[0],c=i[l]||0,u="".concat(l," ").concat(c);i[l]=c+1;var h=r(u),d={css:s[1],media:s[2],sourceMap:s[3],supports:s[4],layer:s[5]};if(-1!==h)t[h].references++,t[h].updater(d);else{var f=function(e,t){var r=t.domAPI(t);return r.update(e),function(t){t?(t.css!==e.css||t.media!==e.media||t.sourceMap!==e.sourceMap||t.supports!==e.supports||t.layer!==e.layer)&&r.update(e=t):r.remove()}}(d,n);n.byIndex=a,t.splice(a,0,{identifier:u,updater:f,references:1})}o.push(u)}return o}e.exports=function(e,i){var o=n(e=e||[],i=i||{});return function(e){e=e||[];for(var a=0;a<o.length;a++){var s=r(o[a]);t[s].references--}for(var l=n(e,i),c=0;c<o.length;c++){var u=r(o[c]);0===t[u].references&&(t[u].updater(),t.splice(u,1))}o=l}}},547:function(e){"use strict";var t={};e.exports=function(e,r){var n=function(e){if(void 0===t[e]){var r=document.querySelector(e);if(window.HTMLIFrameElement&&r instanceof window.HTMLIFrameElement)try{r=r.contentDocument.head}catch(e){r=null}t[e]=r}return t[e]}(e);if(!n)throw Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");n.appendChild(r)}},593:function(e){"use strict";e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},604:function(e,t,r){"use strict";e.exports=function(e){var t=r.nc;t&&e.setAttribute("nonce",t)}},391:function(e){"use strict";e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(r){var n,i,o;n="",r.supports&&(n+="@supports (".concat(r.supports,") {")),r.media&&(n+="@media ".concat(r.media," {")),(i=void 0!==r.layer)&&(n+="@layer".concat(r.layer.length>0?" ".concat(r.layer):""," {")),n+=r.css,i&&(n+="}"),r.media&&(n+="}"),r.supports&&(n+="}"),(o=r.sourceMap)&&"undefined"!=typeof btoa&&(n+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(o))))," */")),e.styleTagTransform(n,t,e.options)},remove:function(){!function(e){if(null!==e.parentNode)e.parentNode.removeChild(e)}(t)}}}},784:function(e){"use strict";e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},482:function(e){"use strict";e.exports=n},964:function(e){"use strict";e.exports=s},505:function(e){"use strict";e.exports=u},772:function(e){"use strict";e.exports=c},667:function(e){"use strict";e.exports=l},58:function(e){"use strict";e.exports=t},721:function(e){"use strict";e.exports=i},202:function(e){"use strict";e.exports=h},156:function(e){"use strict";e.exports=a},111:function(e){"use strict";e.exports=o},238:function(t){"use strict";t.exports=e},128:function(e){"use strict";e.exports=r},527:function(e,t){var r;!function(){"use strict";var n={}.hasOwnProperty;function i(){for(var e="",t=0;t<arguments.length;t++){var r=arguments[t];r&&(e=o(e,function(e){if("string"==typeof e||"number"==typeof e)return e;if("object"!=typeof e)return"";if(Array.isArray(e))return i.apply(null,e);if(e.toString!==Object.prototype.toString&&!e.toString.toString().includes("[native code]"))return e.toString();var t="";for(var r in e)n.call(e,r)&&e[r]&&(t=o(t,r));return t}(r)))}return e}function o(e,t){return t?e?e+" "+t:e+t:e}e.exports?(i.default=i,e.exports=i):void 0===(r=(function(){return i}).apply(t,[]))||(e.exports=r)}()}},E={};function A(e){var t=E[e];if(void 0!==t)return t.exports;var r=E[e]={id:e,exports:{}};return C[e].call(r.exports,r,r.exports,A),r.exports}A.m=C,A.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return A.d(t,{a:t}),t},A.d=function(e,t){for(var r in t)A.o(t,r)&&!A.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},A.f={},A.e=function(e){return Promise.all(Object.keys(A.f).reduce(function(t,r){return A.f[r](e,t),t},[]))},A.u=function(e){return"403f3c00a8759a8e.js"},A.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),A.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},d={},f="@nocobase/plugin-block-workbench:",A.l=function(e,t,r,n){if(d[e])return void d[e].push(t);if(void 0!==r)for(var i,o,a=document.getElementsByTagName("script"),s=0;s<a.length;s++){var l=a[s];if(l.getAttribute("src")==e||l.getAttribute("data-webpack")==f+r){i=l;break}}i||(o=!0,(i=document.createElement("script")).charset="utf-8",i.timeout=120,A.nc&&i.setAttribute("nonce",A.nc),i.setAttribute("data-webpack",f+r),i.src=e),d[e]=[t];var c=function(t,r){i.onerror=i.onload=null,clearTimeout(u);var n=d[e];if(delete d[e],i.parentNode&&i.parentNode.removeChild(i),n&&n.forEach(function(e){return e(r)}),t)return t(r)},u=setTimeout(c.bind(null,void 0,{type:"timeout",target:i}),12e4);i.onerror=c.bind(null,i.onerror),i.onload=c.bind(null,i.onload),o&&document.head.appendChild(i)},A.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},A.nc=void 0,(g=window.__nocobase_public_path__||"/").endsWith("/")||(g+="/"),A.p=g+"static/plugins/@nocobase/plugin-block-workbench/dist/client/",p={909:0},A.f.j=function(e,t){var r=A.o(p,e)?p[e]:void 0;if(0!==r)if(r)t.push(r[2]);else{var n=new Promise(function(t,n){r=p[e]=[t,n]});t.push(r[2]=n);var i=A.p+A.u(e),o=Error();A.l(i,function(t){if(A.o(p,e)&&(0!==(r=p[e])&&(p[e]=void 0),r)){var n=t&&("load"===t.type?"missing":t.type),i=t&&t.target&&t.target.src;o.message="Loading chunk "+e+" failed.\n("+n+": "+i+")",o.name="ChunkLoadError",o.type=n,o.request=i,r[1](o)}},"chunk-"+e,e)}},m=function(e,t){var r,n,i=t[0],o=t[1],a=t[2],s=0;if(i.some(function(e){return 0!==p[e]})){for(r in o)A.o(o,r)&&(A.m[r]=o[r]);a&&a(A)}for(e&&e(t);s<i.length;s++)n=i[s],A.o(p,n)&&p[n]&&p[n][0](),p[n]=0},(w=self.webpackChunk_nocobase_plugin_block_workbench=self.webpackChunk_nocobase_plugin_block_workbench||[]).forEach(m.bind(null,0)),w.push=m.bind(null,w.push.bind(w));var y={};return!function(){"use strict";A.r(y),A.d(y,{PluginBlockWorkbenchClient:function(){return tA},default:function(){return ty}});var e,t,r,n,i,o,a,s,l={};A.r(l),A.d(l,{ActionPanelGroupActionModel:function(){return th},ActionPanelScanActionModel:function(){return ts}});var c=A(772),u=A(505),h=A(964),d=A(721),f=A(278),g=A.n(f),p=A(391),m=A.n(p),w=A(547),C=A.n(w),E=A(604),I=A.n(E),S=A(593),_=A.n(S),b=A(784),T=A.n(b),N=A(46),M={};M.styleTagTransform=T(),M.setAttributes=I(),M.insert=C().bind(null,"head"),M.domAPI=m(),M.insertStyleElement=_(),g()(N.Z,M),N.Z&&N.Z.locals&&N.Z.locals,"undefined"!=typeof window&&"undefined"!=typeof document&&window.document&&window.document.createElement&&document.addEventListener("touchstart",()=>{},!0);var D=A(916),O={};function R(e,t){for(let r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);return e}function v(...e){let t={};return e.forEach(e=>{e&&Object.keys(e).forEach(r=>{void 0!==e[r]&&(t[r]=e[r])})}),t}O.styleTagTransform=T(),O.setAttributes=I(),O.insert=C().bind(null,"head"),O.domAPI=m(),O.insertStyleElement=_(),g()(D.Z,O),D.Z&&D.Z.locals&&D.Z.locals;var P=A(156),B=A.n(P),x=A(527),L=A.n(x);function k(e,t){let r=Object.assign({},t.props);for(let n in e.className&&(r.className=L()(t.props.className,e.className)),e.style&&(r.style=Object.assign(Object.assign({},r.style),e.style)),void 0!==e.tabIndex&&(r.tabIndex=e.tabIndex),e)e.hasOwnProperty(n)&&(n.startsWith("data-")||n.startsWith("aria-"))&&(r[n]=e[n]);return B().cloneElement(t,r)}function F(e){return"number"==typeof e?`${e}px`:e}let U="adm-grid";var H=R(e=>{let t={"--columns":e.columns.toString()},{gap:r}=e;return void 0!==r&&(Array.isArray(r)?(t["--gap-horizontal"]=F(r[0]),t["--gap-vertical"]=F(r[1])):t["--gap"]=F(r)),k(e,B().createElement("div",{className:U,style:t},e.children))},{Item:e=>{let t=v({span:1},e),r={"--item-span":t.span};return k(t,B().createElement("div",{className:`${U}-item`,style:r,onClick:t.onClick},t.children))}}),z=A(59),V={};V.styleTagTransform=T(),V.setAttributes=I(),V.insert=C().bind(null,"head"),V.domAPI=m(),V.insertStyleElement=_(),g()(z.Z,V),z.Z&&z.Z.locals&&z.Z.locals;let j="adm-list",G={mode:"default"},W=(0,P.forwardRef)((e,t)=>{let r=v(G,e),n=(0,P.useRef)(null);return(0,P.useImperativeHandle)(t,()=>({get nativeElement(){return n.current}})),k(r,B().createElement("div",{className:L()(j,`${j}-${r.mode}`),ref:n},r.header&&B().createElement("div",{className:`${j}-header`},r.header),B().createElement("div",{className:`${j}-body`},B().createElement("div",{className:`${j}-body-inner`},r.children))))});var Y=function(e){return P.createElement("svg",Object.assign({width:"1em",height:"1em",viewBox:"0 0 48 48",xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink"},e,{style:Object.assign({verticalAlign:"-0.125em"},e.style),className:["antd-mobile-icon",e.className].filter(Boolean).join(" ")}),P.createElement("g",{id:"RightOutline-RightOutline",stroke:"none",strokeWidth:1,fill:"none",fillRule:"evenodd"},P.createElement("g",{id:"RightOutline-RightOutlined"},P.createElement("rect",{id:"RightOutline-矩形",fill:"#FFFFFF",opacity:0,x:0,y:0,width:48,height:48}),P.createElement("path",{d:"M17.3947957,5.11219264 L35.5767382,22.6612572 L35.5767382,22.6612572 C36.1304785,23.2125856 36.1630514,24.0863155 35.6744571,24.6755735 L35.5767382,24.7825775 L17.3956061,42.8834676 C17.320643,42.9580998 17.2191697,43 17.1133896,43 L13.9866673,43 C13.7657534,43 13.5866673,42.8209139 13.5866673,42.6 C13.5866673,42.4936115 13.6290496,42.391606 13.7044413,42.316542 L32.3201933,23.7816937 L32.3201933,23.7816937 L13.7237117,5.6866816 C13.5653818,5.53262122 13.5619207,5.27937888 13.7159811,5.121049 C13.7912854,5.04365775 13.8946805,5 14.0026627,5 L17.1170064,5 C17.2206403,5 17.3202292,5.04022164 17.3947957,5.11219264 Z",id:"RightOutline-right",fill:"currentColor",fillRule:"nonzero"}))))};function X(e){return null!=e&&!1!==e}let Z="${label}不是一个有效的${type}",Q={locale:{locale:"zh-CH",common:{confirm:"确定",cancel:"取消",loading:"加载中",close:"关闭"},Calendar:{title:"日期选择",confirm:"确认",start:"开始",end:"结束",today:"今日",markItems:["一","二","三","四","五","六","日"],yearAndMonth:"${year}年${month}月"},Cascader:{placeholder:"请选择"},Dialog:{ok:"我知道了"},DatePicker:{tillNow:"至今"},ErrorBlock:{default:{title:"页面遇到一些小问题",description:"待会来试试"},busy:{title:"前方拥堵",description:"刷新试试"},disconnected:{title:"网络有点忙",description:"动动手指帮忙修复"},empty:{title:"没有找到你需要的东西",description:"找找其他的吧"}},Form:{required:"必填",optional:"选填",defaultValidateMessages:{default:"字段验证错误${label}",required:"请输入${label}",enum:"${label}必须是其中一个[${enum}]",whitespace:"${label}不能为空字符",date:{format:"${label}日期格式无效",parse:"${label}不能转换为日期",invalid:"${label}是一个无效日期"},types:{string:Z,method:Z,array:Z,object:Z,number:Z,date:Z,boolean:Z,integer:Z,float:Z,regexp:Z,email:Z,url:Z,hex:Z},string:{len:"${label}须为${len}个字符",min:"${label}最少${min}个字符",max:"${label}最多${max}个字符",range:"${label}须在${min}-${max}字符之间"},number:{len:"${label}必须等于${len}",min:"${label}最小值为${min}",max:"${label}最大值为${max}",range:"${label}须在${min}-${max}之间"},array:{len:"须为${len}个${label}",min:"最少${min}个${label}",max:"最多${max}个${label}",range:"${label}数量须在${min}-${max}之间"},pattern:{mismatch:"${label}与模式不匹配${pattern}"}}},ImageUploader:{uploading:"上传中...",upload:"上传"},InfiniteScroll:{noMore:"没有更多了",failedToLoad:"加载失败",retry:"重新加载"},Input:{clear:"清除"},Mask:{name:"背景蒙层"},Modal:{ok:"我知道了"},PasscodeInput:{name:"密码输入框"},PullToRefresh:{pulling:"下拉刷新",canRelease:"释放立即刷新",complete:"刷新成功"},SearchBar:{name:"搜索框"},Slider:{name:"滑动输入条"},Stepper:{decrease:"减少",increase:"增加"},Switch:{name:"开关"},Selector:{name:"选择组"}}},q=B().createContext(null),K="adm-list-item";var $=R(W,{Item:e=>{var t,r,n;let{arrow:i,arrowIcon:o}=e,{list:a={}}=null!=(n=(0,P.useContext)(q))?n:Q,s=null!=(t=e.clickable)?t:!!e.onClick,l=null!=(r=null!=i?i:o)?r:s,c=function(e,...t){for(let e=t.length-1;e>=0;e-=1)if(void 0!==t[e])return t[e];return e}(a.arrowIcon,!0!==i?i:null,!0!==o?o:null),u=B().createElement("div",{className:`${K}-content`},X(e.prefix)&&B().createElement("div",{className:`${K}-content-prefix`},e.prefix),B().createElement("div",{className:`${K}-content-main`},X(e.title)&&B().createElement("div",{className:`${K}-title`},e.title),e.children,X(e.description)&&B().createElement("div",{className:`${K}-description`},e.description)),X(e.extra)&&B().createElement("div",{className:`${K}-content-extra`},e.extra),l&&B().createElement("div",{className:`${K}-content-arrow`},c||B().createElement(Y,null)));return k(e,B().createElement(s?"a":"div",{className:L()(`${K}`,s?["adm-plain-anchor"]:[],e.disabled&&`${K}-disabled`),onClick:e.disabled?void 0:e.onClick},u))}}),J=A(202),ee=A(238);function et(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function er(e,t,r,n,i,o,a){try{var s=e[o](a),l=s.value}catch(e){r(e);return}s.done?t(l):Promise.resolve(l).then(n,i)}function en(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var ei={Grid:"grid",List:"list"},eo=new c.SchemaSettings({name:"blockSettings:workbench",items:[{name:"title",Component:function(){var e,t,r=(0,u.useField)(),n=(0,u.useFieldSchema)(),i=(0,c.useDesignable)().dn,o=(0,ee.useTranslation)().t;return B().createElement(c.SchemaSettingsModalItem,{title:o("Edit block title & description"),schema:{type:"object",title:o("Edit block title & description"),properties:{title:{title:o("Block title"),type:"string",default:null==n||null==(e=n["x-decorator-props"])?void 0:e.title,"x-decorator":"FormItem","x-component":"Input"},description:{title:o("Description"),type:"string",default:null==n||null==(t=n["x-decorator-props"])?void 0:t.description,"x-decorator":"FormItem","x-component":"Markdown"}}},onSubmit:function(e){var t,o=e.title,a=e.description,s=n["x-decorator-props"]||{};s.title=o,s.description=a,n["x-decorator-props"]=s,r.decoratorProps.title=o,r.decoratorProps.description=a,i.emit("patch",{schema:(et(t={},"x-uid",n["x-uid"]),et(t,"x-decorator-props",n["x-decorator-props"]),t)}),i.refresh()}})}},{name:"setTheBlockHeight",Component:c.SchemaSettingsBlockHeightItem},{name:"blockLinkageRules",Component:c.SchemaSettingsLinkageRules,useComponentProps:function(){return{title:(0,(0,ee.useTranslation)().t)("Block Linkage rules"),category:c.LinkageRuleCategory.block}}},{name:"layout",Component:function(){var e,t=(0,ee.useTranslation)().t,r=(0,u.useFieldSchema)(),n=(0,u.useField)(),i=(0,c.useDesignable)().dn;return B().createElement(c.SchemaSettingsSelectItem,{title:t("Layout",{ns:"block-workbench"}),options:[{label:t("Grid",{ns:"block-workbench"}),value:ei.Grid},{label:t("List",{ns:"block-workbench"}),value:ei.List}],value:(null==r||null==(e=r["x-component-props"])?void 0:e.layout)||ei.Grid,onChange:function(e){n.componentProps.layout=e;var t={"x-uid":r["x-uid"]};r["x-component-props"]=r["x-component-props"]||{},t["x-component-props"]=r["x-component-props"]||{},t["x-component-props"].layout=e,r["x-component-props"].layout=e,i.emit("patch",{schema:t}),i.refresh()}})}},{name:"itemsPerRow",Component:function(){var e,t=(0,u.useField)(),r=(0,u.useFieldSchema)(),n=(0,c.useDesignable)().dn,i=(0,ee.useTranslation)().t;return B().createElement(c.SchemaSettingsModalItem,{title:i("Items per row",{ns:"block-workbench"}),schema:{type:"object",properties:{itemsPerRow:{type:"number",default:(null==r||null==(e=r["x-decorator-props"])?void 0:e.itemsPerRow)||4,"x-decorator":"FormItem","x-component":"InputNumber","x-component-props":{min:1,max:6},description:i("At least 1, up to 6",{ns:"block-workbench"}),required:!0}}},onSubmit:function(e){var i,o=e.itemsPerRow,a=r["x-decorator-props"]||{};a.itemsPerRow=o,r["x-decorator-props"]=a,t.decoratorProps.ItemsPerRow=o,n.emit("patch",{schema:(en(i={},"x-uid",r["x-uid"]),en(i,"x-decorator-props",r["x-decorator-props"]),i)}),n.refresh()}})},useVisible:function(){var e,t=((0,c.useOpenModeContext)()||{}).isMobile,r=(0,u.useFieldSchema)();return t&&(null==r||null==(e=r["x-component-props"])?void 0:e.layout)!==ei.List}},{name:"ellipsis",type:"switch",useComponentProps:function(){var e,t,r,n=(0,u.useFieldSchema)(),i=(0,c.useDesignable)().dn;return{title:(0,(0,ee.useTranslation)().t)("Ellipsis action title",{ns:"block-workbench"}),checked:(null==(r=n["x-component-props"])?void 0:r.ellipsis)!==!1,onChange:(e=function(e){return function(e,t){var r,n,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){var l=[o,s];if(r)throw TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(i=2&l[0]?n.return:l[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,l[1])).done)return i;switch(n=0,i&&(l=[2&l[0],i.value]),l[0]){case 0:case 1:i=l;break;case 4:return a.label++,{value:l[1],done:!1};case 5:a.label++,n=l[1],l=[0];continue;case 7:l=a.ops.pop(),a.trys.pop();continue;default:if(!(i=(i=a.trys).length>0&&i[i.length-1])&&(6===l[0]||2===l[0])){a=0;continue}if(3===l[0]&&(!i||l[1]>i[0]&&l[1]<i[3])){a.label=l[1];break}if(6===l[0]&&a.label<i[1]){a.label=i[1],i=l;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(l);break}i[2]&&a.ops.pop(),a.trys.pop();continue}l=t.call(e,a)}catch(e){l=[6,e],n=0}finally{r=i=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}}(this,function(t){switch(t.label){case 0:var r,o;return n["x-component-props"]=n["x-component-props"]||{},n["x-component-props"].ellipsis=e,[4,i.emit("patch",{schema:{"x-uid":n["x-uid"],"x-component-props":(r=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){en(e,t,r[t])})}return e}({},n["x-component-props"]),o=o={ellipsis:e},Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(o)):(function(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r.push.apply(r,n)}return r})(Object(o)).forEach(function(e){Object.defineProperty(r,e,Object.getOwnPropertyDescriptor(o,e))}),r)}})];case 1:return t.sent(),[2]}})},t=function(){var t=this,r=arguments;return new Promise(function(n,i){var o=e.apply(t,r);function a(e){er(o,n,i,a,s,"next",e)}function s(e){er(o,n,i,a,s,"throw",e)}a(void 0)})},function(e){return t.apply(this,arguments)})}}},{type:"remove",name:"remove"}]});function ea(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function es(){var e=ea(["\n &.list {\n margin: -","px;\n border-radius: ","px;\n overflow: hidden;\n\n .adm-list {\n --padding-left: ","px;\n --padding-right: ","px;\n\n .adm-list-item-content-main {\n display: flex;\n\n button {\n background-color: transparent;\n border: none;\n height: auto;\n box-shadow: none;\n padding: 16px 32px;\n margin: -12px -32px;\n width: calc(100% + 64px);\n text-align: start;\n justify-content: start !important;\n color: ",";\n }\n }\n }\n\n button[aria-label*='schema-initializer-WorkbenchBlock.ActionBar-workbench:configureActions'] {\n margin-bottom: ","px;\n margin-left: ","px;\n }\n .adm-list-body-inner {\n margin-top: 6px;\n margin-bottom: 3px;\n }\n }\n "]);return es=function(){return e},e}function el(){var e=ea(["\n height: ",";\n\n .nb-action-panel-warp {\n height: ",";\n overflow-y: auto;\n }\n "]);return el=function(){return e},e}var ec=(0,u.observer)(function(){var e=(0,u.useFieldSchema)();return(0,(0,c.useSchemaInitializerRender)(e["x-initializer"]).render)()},{displayName:"WorkbenchConfigureActionsButton"}),eu=function(){var e=(0,u.useFieldSchema)(),t=window.matchMedia("(max-width: 768px)").matches,r=((0,c.useOpenModeContext)()||{}).isMobile,n=(e.parent["x-decorator-props"]||{}).itemsPerRow;return r||t?B().createElement(H,{columns:void 0===n?4:n,gap:8},e.mapProperties(function(e,t){return B().createElement(c.NocoBaseRecursionField,{name:t,schema:e,key:t})})):B().createElement(d.Space,{wrap:!0,size:8,align:"start"},e.mapProperties(function(e,t){return B().createElement(c.NocoBaseRecursionField,{name:t,schema:e,key:t})}))},eh=function(){var e=(0,u.useFieldSchema)(),t=(e.parent["x-component-props"]||{}).layout,r=void 0===t?ei.Grid:t,n=(0,c.useToken)().token;return B().createElement("div",{className:"nb-action-panel-warp"},B().createElement(c.DndContext,null,r===ei.Grid?B().createElement(eu,null):B().createElement($,{style:{"--adm-color-background":n.colorBgContainer,"--active-background-color":n.colorBorderSecondary,"--border-inner":"solid 1px ".concat(n.colorBorderSecondary),"--border-bottom":"none","--border-top":"none"}},e.mapProperties(function(e,t){return B().createElement(c.NocoBaseRecursionField,{name:t,schema:e})}))))},ed=(0,P.createContext)({layout:"grid",ellipsis:!0}),ef=(0,c.createStyles)(function(e){var t=e.token;return{containerClass:(0,e.css)(es(),t.paddingLG,t.borderRadiusBlock,t.paddingLG,t.paddingLG,t.colorText,t.paddingLG,t.paddingLG)}}),eg=(0,c.withDynamicSchemaProps)(function(e){var t=(0,u.useFieldSchema)(),r=t["x-component-props"]||{},n=r.layout,i=void 0===n?"grid":n,o=r.ellipsis,a=ef().styles,s=(t["x-decorator-props"]||{}).title,l=(0,c.useBlockHeight)(),h=d.theme.useToken().token,f=(0,c.useDesignable)().designable,g=s?h.fontSizeLG*h.lineHeightLG+2*h.padding:0,p=l-2*h.paddingLG-g,m="calc(".concat(p,"px - 1rem - ").concat(h.controlHeight,"px)");"list"===i&&(p=l-g,m="calc(".concat(p,"px - 1rem - ").concat(h.controlHeight+h.paddingLG,"px)"));var w=(0,c.css)(el(),l?p+"px":"100%",f?m:"100%");return B().createElement("div",{className:"nb-action-penal-container ".concat(i," ").concat(a.containerClass," ").concat(w)},B().createElement(ed.Provider,{value:{layout:i,ellipsis:o}},B().createElement(c.DataSourceContext.Provider,{value:void 0},B().createElement(c.CollectionContext.Provider,{value:void 0},e.children))))},{displayName:"WorkbenchBlock"});function ep(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){var n;n=r[t],t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n})}return e}function em(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r.push.apply(r,n)}return r})(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}),e}function ew(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function eC(){var e=ew(["\n display: flex;\n background-color: transparent;\n border: 0;\n height: auto;\n box-shadow: none;\n padding-top: 8px;\n "]);return eC=function(){return e},e}function eE(){var e=ew(["\n width: 5em;\n "]);return eE=function(){return e},e}function eA(){var e=ew(["\n margin-top: ","px;\n width: 100%;\n "]);return eA=function(){return e},e}function ey(){var e=ew(["\n > span {\n width: 100%;\n }\n padding-top: 0px !important;\n "]);return ey=function(){return e},e}eg.ActionBar=function(){return B().createElement(B().Fragment,null,B().createElement(eh,null),B().createElement(ec,null))};var eI=(0,J.createStyles)(function(e){var t=e.token,r=e.css;return{action:r(eC()),avatar:r(eE()),title:r(eA(),t.marginSM)}});function eS(e){var t=e.onlyIcon,r=(0,u.useFieldSchema)(),n=r["x-component-props"]||{},i=n.icon,o=n.iconColor,a=(0,P.useContext)(ed),s=a.layout,l=a.ellipsis,h=void 0===l||l,f=eI(),g=f.styles,p=f.cx,m=(0,(0,ee.useTranslation)().t)(r.title,{ns:c.NAMESPACE_UI_SCHEMA}),w=!t;return s===ei.Grid?B().createElement("div",{title:m,className:p(g.avatar)},B().createElement(d.Avatar,{style:{backgroundColor:o},size:48,icon:B().createElement(c.Icon,{type:i})}),B().createElement("div",{className:p(g.title),style:{whiteSpace:h?"nowrap":"normal",textOverflow:h?"ellipsis":"clip",overflow:h?"hidden":"visible"}},w&&m)):B().createElement("span",null,w&&m)}var e_=(0,c.withDynamicSchemaProps)(function(e){var t=e.className,r=(e.targetComponent,e.iconColor,function(e,t){if(null==e)return{};var r,n,i=function(e,t){if(null==e)return{};var r,n,i={},o=Object.keys(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||(i[r]=e[r]);return i}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)r=o[n],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}(e,["className","targetComponent","iconColor"])),n=eI(),i=n.styles,o=n.cx,a=(0,u.useFieldSchema)(),s=(0,c.useComponent)(null==e?void 0:e.targetComponent)||c.Action,l=((null==(g=a.parent)||null==(f=g.parent)?void 0:f["x-component-props"])||{}).layout;if("list"!==(void 0===l?ei.Grid:l))return B().createElement(c.ACLActionProvider,null,B().createElement(s,em(ep({className:o(t,i.action,"nb-action-panel")},r),{onlyIcon:!1,type:"text",icon:null,title:B().createElement(eS,{onlyIcon:null==r?void 0:r.onlyIcon}),confirmTitle:a.title,style:{display:"flex",alignItems:"center",justifyContent:"center"}})));var f,g,p,m,w=null==(p=a["x-component-props"])?void 0:p.icon,C=null==(m=a["x-component-props"])?void 0:m.iconColor;return B().createElement(c.ACLActionProvider,null,B().createElement(s,em(ep({className:o(t,i.action,"nb-action-panel",(0,h.css)(ey()))},r),{onlyIcon:!1,type:"text",icon:null,title:B().createElement($.Item,{prefix:B().createElement(d.Avatar,{style:{backgroundColor:C},icon:B().createElement(c.Icon,{type:w})}),onClick:function(){},style:{marginTop:"5px"}},B().createElement(eS,{onlyIcon:null==r?void 0:r.onlyIcon})),confirmTitle:a.title,style:{display:"flex",alignItems:"center",justifyContent:"center",width:"100%",backgroundColor:"rgb(255, 255, 255)"}})))}),eb={type:"void","x-decorator":"CardItem","x-decorator-props":{title:""},"x-settings":"blockSettings:workbench","x-schema-toolbar":"BlockSchemaToolbar","x-component":"WorkbenchBlock",properties:{actions:{"x-component":"WorkbenchBlock.ActionBar","x-initializer":"workbench:configureActions"}}},eT={type:"item",name:"workbenchBlock",icon:"AppstoreAddOutlined",useComponentProps:function(){var e=(0,ee.useTranslation)("@nocobase/plugin-block-workbench").t,t=(0,c.useSchemaInitializer)().insert;return{title:e("Action panel"),onClick:function(){t(eb)}}}};function eN(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){var n;n=r[t],t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n})}return e}var eM=new c.SchemaSettings({name:"workbench:actionSettings:link",items:[{name:"editButton",Component:c.ButtonEditor,useComponentProps:function(){return{hasIconColor:!0}}},{name:"linkageRules",Component:c.SchemaSettingsLinkageRules,useComponentProps:function(){return eN({},(0,c.useSchemaToolbar)().linkageRulesProps)}},{name:"editLink",Component:c.SchemaSettingsActionLinkItem},(e=eN({},c.SchemaSettingAccessControl),t=t={useVisible:function(){return!0}},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r.push.apply(r,n)}return r})(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}),e),{sort:800,name:"d1",type:"divider"},{sort:900,type:"remove",name:"remove"}]}),eD=new c.SchemaInitializer({name:"workbench:configureActions",title:'{{t("Configure actions")}}',insertPosition:"beforeEnd",items:[{name:"link",title:'{{t("Link")}}',Component:function(e){var t=(0,c.useSchemaInitializerItem)(),r=(0,c.useSchemaInitializer)().insert,n=(0,ee.useTranslation)().t;return B().createElement(c.ModalActionSchemaInitializerItem,{title:t.title,modalSchema:{title:n("Add link"),properties:{title:{title:n("Title"),required:!0,"x-component":"Input","x-decorator":"FormItem"},icon:{title:n("Icon"),required:!0,"x-component":"IconPicker","x-decorator":"FormItem"},iconColor:{title:n("Color"),required:!0,default:"#1677FF","x-component":"ColorPicker","x-decorator":"FormItem"}}},onSubmit:function(e){r({type:"void",title:e.title,"x-action":"customize:link","x-toolbar":"ActionSchemaToolbar","x-settings":"workbench:actionSettings:link","x-component":"WorkbenchAction","x-use-component-props":"useLinkActionProps","x-component-props":{icon:e.icon,iconColor:e.iconColor}})}})}}]});function eO(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){var n;n=r[t],t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n})}return e}var eR=new c.SchemaSettings({name:"workbench:actionSettings:popup",items:[{name:"editButton",Component:c.ButtonEditor,useComponentProps:function(){return{hasIconColor:!0}}},{name:"linkageRules",Component:c.SchemaSettingsLinkageRules,useComponentProps:function(){return eO({},(0,c.useSchemaToolbar)().linkageRulesProps)}},{name:"openMode",Component:c.SchemaSettingOpenModeSchemaItems,useComponentProps:function(){var e=(0,ee.useTranslation)().t,t=(0,c.useOpenModeContext)().hideOpenMode;return{openSize:!t,modeOptions:t&&[{label:e("Drawer"),value:"drawer"},{label:e("Page"),value:"page"}]}}},(r=eO({},c.SchemaSettingAccessControl),n=n={useVisible:function(){return!0}},Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(n)):(function(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r.push.apply(r,n)}return r})(Object(n)).forEach(function(e){Object.defineProperty(r,e,Object.getOwnPropertyDescriptor(n,e))}),r),{sort:800,name:"d1",type:"divider"},{sort:900,type:"remove",name:"remove"}]});function ev(e){var t=(0,c.useSchemaInitializer)().insert,r=(0,ee.useTranslation)().t,n=(0,c.useOpenModeContext)().isMobile;return B().createElement(c.ModalActionSchemaInitializerItem,{title:r("Popup"),modalSchema:{title:r("Add popup",{ns:"block-workbench"}),properties:{title:{title:r("Title"),required:!0,"x-component":"Input","x-decorator":"FormItem"},icon:{title:r("Icon"),required:!0,"x-component":"IconPicker","x-decorator":"FormItem"},iconColor:{title:r("Color"),required:!0,default:"#1677FF","x-component":"ColorPicker","x-decorator":"FormItem"}}},onSubmit:function(e){t({type:"void",title:e.title,"x-action":"customize:popup","x-toolbar":"ActionSchemaToolbar","x-settings":"workbench:actionSettings:popup","x-component":"WorkbenchAction","x-component-props":{icon:e.icon,iconColor:e.iconColor,refreshDataBlockRequest:!1},properties:{drawer:{type:"void",title:e.title,"x-component":"Action.Container","x-component-props":{className:"nb-action-popup"},properties:{tabs:{type:"void","x-component":"Tabs","x-component-props":{},"x-initializer":"popup:addTab",properties:{tab1:{type:"void",title:'{{t("Details")}}',"x-component":"Tabs.TabPane","x-designer":"Tabs.Designer","x-component-props":{},properties:{grid:{type:"void","x-component":"Grid","x-initializer":n?"mobile:addBlock":"page:addBlock",properties:{}}}}}}}}}})}})}function eP(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){var n;n=r[t],t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n})}return e}var eB=new c.SchemaSettings({name:"workbench:actionSettings:scanQrCode",items:[{name:"editButton",Component:c.ButtonEditor,useComponentProps:function(){return{hasIconColor:!0}}},{name:"linkageRules",Component:c.SchemaSettingsLinkageRules,useComponentProps:function(){return eP({},(0,c.useSchemaToolbar)().linkageRulesProps)}},(i=eP({},c.SchemaSettingAccessControl),o=o={useVisible:function(){return!0}},Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(o)):(function(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r.push.apply(r,n)}return r})(Object(o)).forEach(function(e){Object.defineProperty(i,e,Object.getOwnPropertyDescriptor(o,e))}),i),{name:"d1",type:"divider"},{type:"remove",name:"remove"}]});function ex(e){(0,c.useSchemaInitializerItem)();var t=(0,c.useSchemaInitializer)().insert,r=(0,ee.useTranslation)().t;return B().createElement(c.ModalActionSchemaInitializerItem,{title:r("Scan QR code",{ns:"block-workbench"}),modalSchema:{title:r("Scan QR code",{ns:"block-workbench"}),properties:{title:{title:r("Title"),required:!0,"x-component":"Input","x-decorator":"FormItem"},icon:{title:r("Icon"),required:!0,"x-component":"IconPicker","x-decorator":"FormItem"},iconColor:{title:r("Color"),required:!0,default:"#1677FF","x-component":"ColorPicker","x-decorator":"FormItem"}}},onSubmit:function(e){t({type:"void",title:e.title,"x-component":"WorkbenchAction","x-toolbar":"ActionSchemaToolbar","x-settings":"workbench:actionSettings:scanQrCode","x-component-props":{icon:e.icon,iconColor:e.iconColor,openMode:"modal"},properties:{modal:{type:"void","x-component":"QRCodeScanner",title:r("Scan QR code",{ns:"block-workbench"})}}})}})}function eL(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){var n;n=r[t],t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n})}return e}var ek=new c.SchemaSettings({name:"workbench:actionSettings:customRequest",items:[{name:"editButton",Component:c.ButtonEditor,useComponentProps:function(){return{hasIconColor:!0}}},{name:"linkageRules",Component:c.SchemaSettingsLinkageRules,useComponentProps:function(){return eL({},(0,c.useSchemaToolbar)().linkageRulesProps)}},{name:"editLink",Component:c.SchemaSettingsActionLinkItem},(a=eL({},c.SchemaSettingAccessControl),s=s={useVisible:function(){return!0}},Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(s)):(function(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r.push.apply(r,n)}return r})(Object(s)).forEach(function(e){Object.defineProperty(a,e,Object.getOwnPropertyDescriptor(s,e))}),a),{sort:800,name:"d1",type:"divider"},{sort:900,type:"remove",name:"remove"}]});function eF(e){var t=(0,c.useSchemaInitializer)().insert,r=(0,ee.useTranslation)().t;return B().createElement(c.ModalActionSchemaInitializerItem,{title:r("Custom request"),modalSchema:{title:r("Add custom request",{ns:"block-workbench"}),properties:{title:{title:r("Title"),required:!0,"x-component":"Input","x-decorator":"FormItem"},icon:{title:r("Icon"),required:!0,"x-component":"IconPicker","x-decorator":"FormItem"},iconColor:{title:r("Color"),required:!0,default:"#1677FF","x-component":"ColorPicker","x-decorator":"FormItem"}}},onSubmit:function(e){t({type:"void",title:e.title,"x-component":"WorkbenchAction","x-component-props":{icon:e.icon,iconColor:e.iconColor,targetComponent:"CustomRequestAction"},"x-action":"customize:form:request","x-toolbar":"ActionSchemaToolbar","x-settings":"actionSettings:customRequest","x-decorator":"CustomRequestAction.Decorator","x-action-settings":{onSuccess:{manualClose:!1,redirecting:!1,successMessage:'{{t("Request success")}}'}}})}})}var eU=A(667),eH=A(482);function ez(e){return(ez=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function eV(e,t){return(eV=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function ej(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function eG(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(eG=function(){return!!e})()}function eW(){var e=ej(["\n padding: 10px 0px;\n margin-bottom: 15px;\n .ant-btn {\n background: none;\n border: none !important;\n box-shadow: none;\n .ant-btn-icon {\n display: none;\n }\n }\n "]);return eW=function(){return e},e}function eY(){var e=ej(["\n .ant-btn {\n box-shadow: none;\n border: none;\n background: none;\n display: block;\n width: 100%;\n text-align: justify;\n height: 100%;\n .ant-btn-icon {\n display: ",";\n }\n }\n .adm-list-item-content-main {\n overflow: hidden;\n }\n "]);return eY=function(){return e},e}var eX="grid",eZ=function(e){var t=window.matchMedia("(max-width: 768px)").matches;return((0,c.useOpenModeContext)()||{}).isMobile||t?B().createElement(H,{columns:4,gap:8},e.children):B().createElement(d.Space,{wrap:!0,size:8,align:"start"},e.children)},eQ=function(e){var t;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function r(){var e,t;if(!(this instanceof r))throw TypeError("Cannot call a class as a function");return e=r,t=arguments,e=ez(e),function(e,t){var r;if(t&&("object"==((r=t)&&"undefined"!=typeof Symbol&&r.constructor===Symbol?"symbol":typeof r)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,eG()?Reflect.construct(e,t||[],ez(this).constructor):e.apply(this,t))}return r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),e&&eV(r,e),t=[{key:"renderConfigureActions",value:function(){return B().createElement(eU.AddSubModelButton,{key:"action-panel-add-actions",model:this,subModelBaseClass:this.getModelClassName("ActionPanelGroupActionModel"),subModelKey:"actions"},B().createElement(eU.FlowSettingsButton,{icon:B().createElement(eH.SettingOutlined,null)},this.translate("Actions")))}},{key:"renderComponent",value:function(){var e=this,t=this.props,r=t.layout,n=t.ellipsis,i=this.context.themeToken,o=!!this.context.flowSettingsEnabled;return B().createElement("div",{id:"model-".concat(this.uid),className:"action-panel-block"},B().createElement(d.ConfigProvider,{wave:{disabled:!0}},B().createElement(eU.DndProvider,null,B().createElement("div",{className:"nb-action-panel-warp"},r===eX?B().createElement(eZ,null,this.mapSubModels("actions",function(t){if(!t.hidden||o){var r=t.props,i=r.icon,a=r.color,s=void 0===a?"#1677FF":a,l=r.title;return t.enableEditDanger=!1,t.enableEditType=!1,t.renderHiddenInConfig=function(){return B().createElement(d.Tooltip,{title:e.context.t("The button is hidden and only visible when the UI Editor is active")},B().createElement(d.Button,{onClick:t.onClick.bind(t)},B().createElement("div",{style:{width:"5em",opacity:"0.3"}},B().createElement(d.Avatar,{style:{backgroundColor:s},size:48,icon:B().createElement(c.Icon,{type:i})}),B().createElement("div",{style:n?{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}:{whiteSpace:"normal",wordBreak:"break-word"}},l))))},t.props.children=B().createElement("div",{style:{width:"5em"}},B().createElement(d.Avatar,{style:{backgroundColor:s},size:48,icon:B().createElement(c.Icon,{type:i})}),B().createElement("div",{style:n?{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}:{whiteSpace:"normal",wordBreak:"break-word"}},l)),B().createElement(eU.Droppable,{model:t,key:t.uid},B().createElement("div",{className:(0,h.css)(eW())},B().createElement(eU.FlowModelRenderer,{model:t,showFlowSettings:{showBackground:!1,showBorder:!1,toolbarPosition:"above"},extraToolbarItems:[{key:"drag-handler",component:eU.DragHandler,sort:1}]})))}})):B().createElement($,{style:{"--adm-color-background":i.colorBgContainer,"--active-background-color":i.colorBorderSecondary,"--border-inner":"solid 1px ".concat(i.colorBorderSecondary),"--border-bottom":"none","--border-top":"none"}},this.mapSubModels("actions",function(t){var r=t.props,i=r.icon,o=r.color,a=void 0===o?"#1677FF":o,s=r.title;return t.enableEditDanger=!1,t.enableEditType=!1,t.renderHiddenInConfig=function(){return B().createElement(d.Tooltip,{title:e.context.t("The button is hidden and only visible when the UI Editor is active")},B().createElement(d.Button,{style:{opacity:"0.3"},onClick:t.onClick.bind(t)},B().createElement($.Item,{prefix:B().createElement(d.Avatar,{style:{backgroundColor:a},icon:B().createElement(c.Icon,{type:i})})},B().createElement("div",{style:n?{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}:{whiteSpace:"normal",wordBreak:"break-word"}},s))))},t.props.children=B().createElement($.Item,{prefix:B().createElement(d.Avatar,{style:{backgroundColor:a},icon:B().createElement(c.Icon,{type:i})})},B().createElement("div",{style:n?{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}:{whiteSpace:"normal",wordBreak:"break-word"}},s)),B().createElement(eU.Droppable,{model:t,key:t.uid},B().createElement("div",{className:(0,h.css)(eY(),t.hidden?"block":" none")},B().createElement(eU.FlowModelRenderer,{model:t,showFlowSettings:{showBackground:!1,showBorder:!1},extraToolbarItems:[{key:"drag-handler",component:eU.DragHandler,sort:1}]})))}))))),this.context.flowSettingsEnabled&&B().createElement("div",{style:{marginTop:"10px"}},this.renderConfigureActions()))}}],function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(r.prototype,t),r}(c.BlockModel);eQ.define({label:(0,eU.tExpr)("Action panel"),createModelOptions:{use:"ActionPanelBlockModel"}}),eQ.registerFlow({key:"actionPanelBlockSetting",title:(0,eU.tExpr)("Action panel settings",{ns:"block-workbench"}),steps:{layout:{title:(0,eU.tExpr)("Layout",{ns:"block-workbench"}),uiMode:function(e){var t=e.t;return{type:"select",key:"layout",props:{options:[{label:t("Grid",{ns:"block-workbench"}),value:eX},{label:t("List",{ns:"block-workbench"}),value:"list"}]}}},defaultParams:{layout:eX},handler:function(e,t){e.model.setProps({layout:t.layout})}},ellipsis:{title:(0,eU.tExpr)("Ellipsis action title",{ns:"block-workbench"}),uiMode:{type:"switch",key:"ellipsis"},defaultParams:{ellipsis:!0},handler:function(e,t){e.model.setProps({ellipsis:t.ellipsis})}}}});var eq=A(195);function eK(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){var n;n=r[t],t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n})}return e}function e$(e){var t=e.style,r={position:"absolute",backgroundColor:"rgb(255, 255, 255)"};return B().createElement("div",{id:"qr-scan-box",style:eK({boxSizing:"border-box",inset:"0px"},void 0===t?{}:t)},B().createElement("div",{style:eK({width:"40px",height:"5px",top:"-5px",left:"0px"},r)}),B().createElement("div",{style:eK({width:"40px",height:"5px",top:"-5px",right:"0px"},r)}),B().createElement("div",{style:eK({width:"40px",height:"5px",bottom:"-5px",left:"0px"},r)}),B().createElement("div",{style:eK({width:"40px",height:"5px",bottom:"-5px",right:"0px"},r)}),B().createElement("div",{style:eK({width:"5px",height:"45px",top:"-5px",left:"-5px"},r)}),B().createElement("div",{style:eK({width:"5px",height:"45px",bottom:"-5px",left:"-5px"},r)}),B().createElement("div",{style:eK({width:"5px",height:"45px",top:"-5px",right:"-5px"},r)}),B().createElement("div",{style:eK({width:"5px",height:"45px",bottom:"-5px",right:"-5px"},r)}))}var eJ=A(58),e1=A.n(eJ),e0=A(738);function e2(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function e3(e,t,r,n,i,o,a){try{var s=e[o](a),l=s.value}catch(e){r(e);return}s.done?t(l):Promise.resolve(l).then(n,i)}function e4(e){return function(){var t=this,r=arguments;return new Promise(function(n,i){var o=e.apply(t,r);function a(e){e3(o,n,i,a,s,"next",e)}function s(e){e3(o,n,i,a,s,"throw",e)}a(void 0)})}}function e8(e,t){var r,n,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){var l=[o,s];if(r)throw TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(i=2&l[0]?n.return:l[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,l[1])).done)return i;switch(n=0,i&&(l=[2&l[0],i.value]),l[0]){case 0:case 1:i=l;break;case 4:return a.label++,{value:l[1],done:!1};case 5:a.label++,n=l[1],l=[0];continue;case 7:l=a.ops.pop(),a.trys.pop();continue;default:if(!(i=(i=a.trys).length>0&&i[i.length-1])&&(6===l[0]||2===l[0])){a=0;continue}if(3===l[0]&&(!i||l[1]>i[0]&&l[1]<i[3])){a.label=l[1];break}if(6===l[0]&&a.label<i[1]){a.label=i[1],i=l;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(l);break}i[2]&&a.ops.pop(),a.trys.pop();continue}l=t.call(e,a)}catch(e){l=[6,e],n=0}finally{r=i=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}}function e6(e,t){return e.startsWith(t)?e.slice(t.length):e}function e5(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}var e7="qrcode",e9=function(e){var t,r,n,i,o,a,s,l,u,h,d,f,g,p,m,w,C,E,A,y,I,S,_,b,T,N,M,D=e.setVisible,O=e.app,R=e.navigate;e.onClose;var v=(0,P.useRef)(),x=(0,P.useRef)(),L=(0,ee.useTranslation)("block-workbench").t,k=(t=(0,P.useState)({width:0,height:0}),function(e){if(Array.isArray(e))return e}(t)||function(e,t){var r,n,i=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=i){var o=[],a=!0,s=!1;try{for(i=i.call(e);!(a=(r=i.next()).done)&&(o.push(r.value),o.length!==t);a=!0);}catch(e){s=!0,n=e}finally{try{a||null==i.return||i.return()}finally{if(s)throw n}}return o}}(t,2)||function(e,t){if(e){if("string"==typeof e)return e5(e,2);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(r);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return e5(e,t)}}(t,2)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),F=k[0],U=k[1],H=Math.max(document.documentElement.clientWidth||0,window.innerWidth||0),z=Math.max(document.documentElement.clientHeight||0,window.innerHeight||0),V=(o=(r={onScannerSizeChanged:U,elementId:e7,onScanSuccess:(0,P.useCallback)(function(e){D(!1)},[D]),app:O,navigate:R}).onScannerSizeChanged,a=r.elementId,s=r.onScanSuccess,l=r.app,u=r.navigate,h=(0,c.useApp)(),f=(null==(n=(i=(d=l||h).pm).get)?void 0:n.call(i,e1())).mobileRouter,g=d.router,p=((null==f?void 0:f.router)?null==f?void 0:f.basename:g.basename).replace(/\/+$/,""),C=(m=(0,P.useState)(),w=function(e){if(Array.isArray(e))return e}(m)||function(e,t){var r,n,i=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=i){var o=[],a=!0,s=!1;try{for(i=i.call(e);!(a=(r=i.next()).done)&&(o.push(r.value),o.length!==t);a=!0);}catch(e){s=!0,n=e}finally{try{a||null==i.return||i.return()}finally{if(s)throw n}}return o}}(m,2)||function(e,t){if(e){if("string"==typeof e)return e2(e,2);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(r);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return e2(e,t)}}(m,2)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}())[0],E=w[1],A=(0,ee.useTranslation)("block-workbench").t,y=(0,P.useMemo)(function(){return{width:Math.max(document.documentElement.clientWidth||0,window.innerWidth||0),height:Math.max(document.documentElement.clientHeight||0,window.innerHeight||0)}},[]),S=(0,P.useCallback)((I=e4(function(e){return e8(this,function(t){return[2,e.start({facingMode:"environment"},{fps:10,qrbox:function(e,t){return o({width:e,height:t}),{width:y.width,height:y.height}}},function(e){if(null==e?void 0:e.startsWith("http")){window.location.href=e;return}u(e6(e,p)),s&&s(e)},void 0)]})}),function(e){return I.apply(this,arguments)}),[u,o,y,p,s]),b=(0,P.useCallback)((_=e4(function(e){var t;return e8(this,function(r){return(t=e.getState(),[e0.lz.SCANNING,e0.lz.PAUSED].includes(t))?(console.log(e),[2,null==e?void 0:e.stop()]):[2]})}),function(e){return _.apply(this,arguments)}),[]),N=(0,P.useCallback)((T=e4(function(e){var t;return e8(this,function(r){switch(r.label){case 0:return[4,b(C)];case 1:r.sent(),r.label=2;case 2:return r.trys.push([2,4,,5]),[4,C.scanFileV2(e,!1)];case 3:if(null==(t=r.sent().decodedText)?void 0:t.startsWith("http"))return window.location.href=t,[2];return u(e6(t,p)),s&&s(t),[3,5];case 4:return r.sent(),alert(A("QR code recognition failed, please scan again")),S(C),[3,5];case 5:return[2]}})}),function(e){return T.apply(this,arguments)}),[b,C,u,p,A,S,s]),(0,P.useEffect)(function(){var e=new e0.t2(a);return E(e),S(e),function(){b(e)}},[a,S,b]),{startScanCamera:S,startScanFile:N}).startScanFile,j=function(){x.current&&x.current.click()},G=function(e){var t=e.target.files;if(t.length>0){var r=t[0];r.size<1e6?V(r):alert(L("The image size is too large. Please compress it to below 1MB before uploading"))}};(0,P.useEffect)(function(){return document.documentElement.style.overscrollBehavior="none",function(){document.documentElement.style.overscrollBehavior="default"}},[]),(0,P.useEffect)(function(){var e=F.width,t=F.height,r=Math.max(document.documentElement.clientWidth||0,window.innerWidth||0),n=Math.max(document.documentElement.clientHeight||0,window.innerHeight||0);if(e>0&&t>0&&t<n){var i=Math.floor(n/t*e),o=document.getElementsByTagName("video")[0];o.style.height="".concat(n,"px"),o.style.width="".concat(i,"px"),v.current.style.left="".concat((r-i)/2,"px"),v.current.style.position="absolute"}},[F]);var W={zIndex:"1003",fontSize:"1.8em",fontWeight:"bold"};return B().createElement(B().Fragment,null,B().createElement("div",{ref:v,id:e7,style:{position:"absolute"}}),B().createElement(e$,{style:function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){var n;n=r[t],t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n})}return e}({},(M=Math.floor(.6*Math.min(H,z)),{left:"".concat((H-M)/2,"px"),top:"".concat((z-M)/2,"px"),position:"fixed",width:"".concat(M,"px"),height:"".concat(M,"px")}))}),B().createElement(function(){return B().createElement("div",{style:{position:"absolute",bottom:"20px",left:"20px",padding:"10px 60px"}},B().createElement("div",{style:{color:"white",width:"40px",display:"flex",flexDirection:"column",alignItems:"center"}},B().createElement(eH.FileImageOutlined,{style:W,onClick:j}),L("Album"),B().createElement("input",{ref:x,type:"file",accept:"image/*",onChange:G,style:{visibility:"hidden"}})))},null))};function te(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function tt(e,t,r,n,i,o,a){try{var s=e[o](a),l=s.value}catch(e){r(e);return}s.done?t(l):Promise.resolve(l).then(n,i)}function tr(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function tn(e){return(tn=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function ti(e,t){return(ti=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function to(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(to=function(){return!!e})()}var ta=function(e){var t,r=(t=(0,P.useState)(!0),function(e){if(Array.isArray(e))return e}(t)||function(e,t){var r,n,i=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=i){var o=[],a=!0,s=!1;try{for(i=i.call(e);!(a=(r=i.next()).done)&&(o.push(r.value),o.length!==t);a=!0);}catch(e){s=!0,n=e}finally{try{a||null==i.return||i.return()}finally{if(s)throw n}}return o}}(t,2)||function(e,t){if(e){if("string"==typeof e)return te(e,2);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(r);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return te(e,t)}}(t,2)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),n=r[0],i=r[1],o=(0,ee.useTranslation)("block-workbench").t;return n?B().createElement("div",{style:{position:"fixed",width:"100%",height:"100%",background:"black",zIndex:1001,top:0,left:0,overflow:"hidden"}},B().createElement(e9,{setVisible:i,app:e.app,navigate:e.navigate,onClose:e.onClose}),B().createElement(eH.LeftOutlined,{style:{position:"absolute",top:"22px",left:"20px",zIndex:1003,color:"white",fontSize:"1.8em",fontWeight:"bold"},onClick:function(){return i(!1)}}),B().createElement("div",{style:{position:"absolute",color:"white",fontSize:"1.5em",left:0,right:0,top:"20px",zIndex:1002,marginLeft:"auto",marginRight:"auto",textAlign:"center"}},o("Scan QR code"))):null},ts=function(e){var t;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function r(){var e,t,n;if(!(this instanceof r))throw TypeError("Cannot call a class as a function");return t=r,n=arguments,t=tn(t),tr(e=function(e,t){var r;if(t&&("object"==((r=t)&&"undefined"!=typeof Symbol&&r.constructor===Symbol?"symbol":typeof r)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,to()?Reflect.construct(t,n||[],tn(this).constructor):t.apply(this,n)),"defaultProps",{title:(0,eU.escapeT)("Scan QR code",{ns:"block-workbench"}),icon:"ScanOutlined"}),e}return r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),e&&ti(r,e),t=[{key:"onClick",value:function(e){this.dispatchEvent("click",function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){tr(e,t,r[t])})}return e}({event:e},this.getInputArgs()))}}],function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(r.prototype,t),r}(c.ActionModel);function tl(e){return(tl=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function tc(e,t){return(tc=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function tu(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(tu=function(){return!!e})()}ts.registerFlow({key:"actionPanelScanSettings",on:"click",steps:{scanClick:{handler:function(e,t){var r;return(r=function(){var t,r,n,i;return function(e,t){var r,n,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){var l=[o,s];if(r)throw TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(i=2&l[0]?n.return:l[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,l[1])).done)return i;switch(n=0,i&&(l=[2&l[0],i.value]),l[0]){case 0:case 1:i=l;break;case 4:return a.label++,{value:l[1],done:!1};case 5:a.label++,n=l[1],l=[0];continue;case 7:l=a.ops.pop(),a.trys.pop();continue;default:if(!(i=(i=a.trys).length>0&&i[i.length-1])&&(6===l[0]||2===l[0])){a=0;continue}if(3===l[0]&&(!i||l[1]>i[0]&&l[1]<i[3])){a.label=l[1];break}if(6===l[0]&&a.label<i[1]){a.label=i[1],i=l;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(l);break}i[2]&&a.ops.pop(),a.trys.pop();continue}l=t.call(e,a)}catch(e){l=[6,e],n=0}finally{r=i=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}}(this,function(o){return(t=document.getElementById("qr-scanner-container"))&&t.remove(),(r=document.createElement("div")).id="qr-scanner-container",document.body.appendChild(r),n=eq.createRoot(r),i=function(){n.unmount(),r.remove()},n.render(B().createElement(ta,{app:e.app,navigate:e.router.navigate,onClose:i})),[2]})},function(){var e=this,t=arguments;return new Promise(function(n,i){var o=r.apply(e,t);function a(e){tt(o,n,i,a,s,"next",e)}function s(e){tt(o,n,i,a,s,"throw",e)}a(void 0)})})()}}}}),ts.define({label:(0,eU.escapeT)("Scan QR code",{ns:"block-workbench"})});var th=function(e){if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function t(){var e,r;if(!(this instanceof t))throw TypeError("Cannot call a class as a function");return e=t,r=arguments,e=tl(e),function(e,t){var r;if(t&&("object"==((r=t)&&"undefined"!=typeof Symbol&&r.constructor===Symbol?"symbol":typeof r)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,tu()?Reflect.construct(e,r||[],tl(this).constructor):e.apply(this,r))}return t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&tc(t,e),t}(c.ActionGroupModel);th.define({label:(0,eU.escapeT)("Action panel action",{ns:"block-workbench"})}),th.registerActionModels({PopupActionModel:c.PopupActionModel,LinkActionModel:c.LinkActionModel,ActionPanelScanActionModel:ts});var td=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){var n;n=r[t],t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n})}return e}({ActionPanelBlockModel:eQ},l),tf=A(581);function tg(e,t,r,n,i,o,a){try{var s=e[o](a),l=s.value}catch(e){r(e);return}s.done?t(l):Promise.resolve(l).then(n,i)}function tp(e,t,r){return(tp=tE()?Reflect.construct:function(e,t,r){var n=[null];n.push.apply(n,t);var i=new(Function.bind.apply(e,n));return r&&tw(i,r.prototype),i}).apply(null,arguments)}function tm(e){return(tm=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function tw(e,t){return(tw=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function tC(e){var t="function"==typeof Map?new Map:void 0;return(tC=function(e){if(null===e||-1===Function.toString.call(e).indexOf("[native code]"))return e;if("function"!=typeof e)throw TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return tp(e,arguments,tm(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),tw(r,e)})(e)}function tE(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(tE=function(){return!!e})()}var tA=function(e){var t;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function r(){var e,t;if(!(this instanceof r))throw TypeError("Cannot call a class as a function");return e=r,t=arguments,e=tm(e),function(e,t){var r;if(t&&("object"==((r=t)&&"undefined"!=typeof Symbol&&r.constructor===Symbol?"symbol":typeof r)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,tE()?Reflect.construct(e,t||[],tm(this).constructor):e.apply(this,t))}return r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),e&&tw(r,e),t=[{key:"load",value:function(){var e,t=this;return(e=function(){var e;return function(e,t){var r,n,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){var l=[o,s];if(r)throw TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(i=2&l[0]?n.return:l[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,l[1])).done)return i;switch(n=0,i&&(l=[2&l[0],i.value]),l[0]){case 0:case 1:i=l;break;case 4:return a.label++,{value:l[1],done:!1};case 5:a.label++,n=l[1],l=[0];continue;case 7:l=a.ops.pop(),a.trys.pop();continue;default:if(!(i=(i=a.trys).length>0&&i[i.length-1])&&(6===l[0]||2===l[0])){a=0;continue}if(3===l[0]&&(!i||l[1]>i[0]&&l[1]<i[3])){a.label=l[1];break}if(6===l[0]&&a.label<i[1]){a.label=i[1],i=l;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(l);break}i[2]&&a.ops.pop(),a.trys.pop();continue}l=t.call(e,a)}catch(e){l=[6,e],n=0}finally{r=i=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}}(this,function(r){return e=(0,c.lazy)(function(){return tf("imported_1nibks6_component",A.e("397").then(A.bind(A,626)))},"QRCodeScanner").QRCodeScanner,t.app.addComponents({WorkbenchBlock:eg,QRCodeScanner:e,WorkbenchAction:e_}),t.app.schemaSettingsManager.add(eo),t.app.schemaInitializerManager.add(eD),t.app.schemaInitializerManager.addItem("page:addBlock","otherBlocks.".concat(eT.name),eT),t.app.schemaInitializerManager.addItem("popup:common:addBlock","otherBlocks.".concat(eT.name),eT),t.app.schemaInitializerManager.addItem("mobilePage:addBlock","otherBlocks.".concat(eT.name),eT),t.app.schemaInitializerManager.addItem("mobile:addBlock","otherBlocks.".concat(eT.name),eT),t.app.schemaSettingsManager.add(eM),t.app.schemaSettingsManager.add(eB),t.app.schemaInitializerManager.addItem("workbench:configureActions","qrcode",{Component:ex}),t.app.schemaSettingsManager.add(eR),t.app.schemaInitializerManager.addItem("workbench:configureActions","popup",{Component:ev}),t.app.schemaSettingsManager.add(ek),t.app.schemaInitializerManager.addItem("workbench:configureActions","customRequest",{Component:eF}),t.flowEngine.registerModels(td),[2]})},function(){var t=this,r=arguments;return new Promise(function(n,i){var o=e.apply(t,r);function a(e){tg(o,n,i,a,s,"next",e)}function s(e){tg(o,n,i,a,s,"throw",e)}a(void 0)})})()}}],function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(r.prototype,t),r}(tC(c.Plugin)),ty=tA}(),y}()});
|
|
10
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react-i18next"),require("@nocobase/plugin-mobile/client"),require("react-router-dom"),require("@ant-design/icons"),require("antd"),require("react-dom"),require("react"),require("@emotion/css"),require("@nocobase/flow-engine"),require("@nocobase/client"),require("@formily/react"),require("antd-style")):"function"==typeof define&&define.amd?define("@nocobase/plugin-block-workbench",["react-i18next","@nocobase/plugin-mobile/client","react-router-dom","@ant-design/icons","antd","react-dom","react","@emotion/css","@nocobase/flow-engine","@nocobase/client","@formily/react","antd-style"],t):"object"==typeof exports?exports["@nocobase/plugin-block-workbench"]=t(require("react-i18next"),require("@nocobase/plugin-mobile/client"),require("react-router-dom"),require("@ant-design/icons"),require("antd"),require("react-dom"),require("react"),require("@emotion/css"),require("@nocobase/flow-engine"),require("@nocobase/client"),require("@formily/react"),require("antd-style")):e["@nocobase/plugin-block-workbench"]=t(e["react-i18next"],e["@nocobase/plugin-mobile/client"],e["react-router-dom"],e["@ant-design/icons"],e.antd,e["react-dom"],e.react,e["@emotion/css"],e["@nocobase/flow-engine"],e["@nocobase/client"],e["@formily/react"],e["antd-style"])}(self,function(e,t,r,n,i,o,a,s,l,c,u,h){return function(){var d,f,g,p,m,w,C={916:function(e,t,r){"use strict";var n=r(589),i=r.n(n),o=r(758),a=r.n(o)()(i());a.push([e.id,".adm-grid {\n --gap: 0;\n --gap-horizontal: var(--gap);\n --gap-vertical: var(--gap);\n display: grid;\n grid-gap: 10px;\n -webkit-column-gap: var(--gap-horizontal);\n grid-column-gap: var(--gap-horizontal);\n -moz-column-gap: var(--gap-horizontal);\n column-gap: var(--gap-horizontal);\n grid-row-gap: var(--gap-vertical);\n row-gap: var(--gap-vertical);\n grid-template-columns: repeat(var(--columns), minmax(0, 1fr));\n align-items: stretch;\n}\n.adm-grid-item {\n grid-column-end: span var(--item-span);\n}\n",""]),t.Z=a},59:function(e,t,r){"use strict";var n=r(589),i=r.n(n),o=r(758),a=r.n(o)()(i());a.push([e.id,".adm-list {\n --header-font-size: var(--adm-font-size-7);\n --prefix-width: 'auto';\n --prefix-padding-right: 12px;\n --align-items: center;\n --active-background-color: var(--adm-color-border);\n --border-inner: solid 1px var(--adm-color-border);\n --border-top: solid 1px var(--adm-color-border);\n --border-bottom: solid 1px var(--adm-color-border);\n --padding-left: 12px;\n --padding-right: 12px;\n --font-size: var(--adm-font-size-9);\n --extra-max-width: 70%;\n}\n.adm-list-header {\n color: var(--adm-color-weak);\n font-size: var(--header-font-size);\n padding: 8px var(--padding-right) 8px var(--padding-left);\n}\n.adm-list-body {\n background-color: var(--adm-color-background);\n overflow: hidden;\n font-size: var(--font-size);\n}\n.adm-list-body-inner {\n margin-top: -1px;\n}\n.adm-list-default .adm-list-body {\n border-top: var(--border-top);\n border-bottom: var(--border-bottom);\n}\n.adm-list-card {\n margin: 12px;\n}\n.adm-list-card .adm-list-body {\n border-radius: 8px;\n}\n.adm-list-card .adm-list-header {\n padding-left: 0;\n}\n.adm-list-item {\n display: block;\n padding-left: var(--padding-left);\n position: relative;\n background-color: var(--adm-color-background);\n line-height: 1.5;\n}\n.adm-list-item-title,\n.adm-list-item-description {\n color: var(--adm-color-weak);\n font-size: var(--adm-font-size-main);\n}\n.adm-list-item-content {\n display: -webkit-box;\n display: -webkit-flex;\n display: -moz-box;\n display: flex;\n align-items: var(--align-items);\n justify-content: flex-start;\n border-top: var(--border-inner);\n padding-right: var(--padding-right);\n}\n.adm-list-item-content-prefix {\n width: var(--prefix-width);\n flex: none;\n padding-right: var(--prefix-padding-right);\n}\n.adm-list-item-content-main {\n flex: auto;\n padding: 12px 0;\n}\n.adm-list-item-content-extra {\n flex: none;\n padding-left: 12px;\n font-size: var(--adm-font-size-7);\n color: var(--adm-color-weak);\n max-width: var(--extra-max-width);\n}\n.adm-list-item-content-arrow {\n flex: none;\n display: -webkit-box;\n display: -webkit-flex;\n display: -moz-box;\n display: flex;\n align-items: center;\n margin-left: 4px;\n color: var(--adm-color-light);\n font-size: 19px;\n}\n.adm-list-item-disabled {\n cursor: not-allowed;\n}\n.adm-list-item-disabled.adm-list-item-disabled > .adm-list-item-content > * {\n opacity: 0.4;\n pointer-events: none;\n}\na.adm-list-item:active:not(.adm-list-item-disabled) {\n background-color: var(--active-background-color);\n}\na.adm-list-item:active:not(.adm-list-item-disabled)::after {\n content: ' ';\n display: block;\n position: absolute;\n width: 100%;\n bottom: -1px;\n left: 0;\n border-bottom: var(--border-inner);\n}\n",""]),t.Z=a},46:function(e,t,r){"use strict";var n=r(589),i=r.n(n),o=r(758),a=r.n(o)()(i());a.push([e.id,":root {\n --adm-radius-s: 4px;\n --adm-radius-m: 8px;\n --adm-radius-l: 12px;\n --adm-font-size-1: 9px;\n --adm-font-size-2: 10px;\n --adm-font-size-3: 11px;\n --adm-font-size-4: 12px;\n --adm-font-size-5: 13px;\n --adm-font-size-6: 14px;\n --adm-font-size-7: 15px;\n --adm-font-size-8: 16px;\n --adm-font-size-9: 17px;\n --adm-font-size-10: 18px;\n --adm-color-primary: #1677ff;\n --adm-color-success: #00b578;\n --adm-color-warning: #ff8f1f;\n --adm-color-danger: #ff3141;\n --adm-color-yellow: #ff9f18;\n --adm-color-orange: #ff6430;\n --adm-color-wathet: #e7f1ff;\n --adm-color-text: #333333;\n --adm-color-text-secondary: #666666;\n --adm-color-weak: #999999;\n --adm-color-light: #cccccc;\n --adm-color-border: #eeeeee;\n --adm-color-background: #ffffff;\n --adm-color-highlight: var(--adm-color-danger);\n --adm-color-white: #ffffff;\n --adm-color-box: #f5f5f5;\n --adm-color-text-light-solid: var(--adm-color-white);\n --adm-color-text-dark-solid: #000000;\n --adm-color-fill-content: var(--adm-color-box);\n --adm-font-size-main: var(--adm-font-size-5);\n --adm-font-family: -apple-system, blinkmacsystemfont, 'Helvetica Neue',\n helvetica, segoe ui, arial, roboto, 'PingFang SC', 'miui',\n 'Hiragino Sans GB', 'Microsoft Yahei', sans-serif;\n --adm-border-color: var(--adm-color-border);\n}\nhtml[data-prefers-color-scheme='dark'] {\n --adm-color-primary: #3086ff;\n --adm-color-success: #34b368;\n --adm-color-warning: #ffa930;\n --adm-color-danger: #ff4a58;\n --adm-color-yellow: #ffa930;\n --adm-color-orange: #e65a2b;\n --adm-color-wathet: #0d2543;\n --adm-color-text: #e6e6e6;\n --adm-color-text-secondary: #b3b3b3;\n --adm-color-weak: #808080;\n --adm-color-light: #4d4d4d;\n --adm-color-border: #2b2b2b;\n --adm-color-box: #0a0a0a;\n --adm-color-background: #1a1a1a;\n --adm-color-background-body: var(--adm-color-background);\n --adm-border-color: var(--adm-color-border);\n}\n:root {\n -webkit-tap-highlight-color: rgba(0, 0, 0, 0);\n}\nhtml {\n background-color: var(--adm-color-background-body);\n}\nbody {\n color: #333333;\n color: var(--adm-color-text);\n font-size: 13px;\n font-size: var(--adm-font-size-main);\n font-family: -apple-system, blinkmacsystemfont, 'Helvetica Neue',\n helvetica, segoe ui, arial, roboto, 'PingFang SC', 'miui',\n 'Hiragino Sans GB', 'Microsoft Yahei', sans-serif;\n font-family: var(--adm-font-family);\n}\na,\nbutton {\n cursor: pointer;\n}\na {\n color: #1677ff;\n color: var(--adm-color-primary);\n transition: opacity ease-in-out 0.2s;\n}\na:active {\n opacity: 0.8;\n}\n.adm-plain-anchor {\n color: inherit;\n transition: none;\n}\n.adm-plain-anchor:active {\n opacity: 1;\n opacity: initial;\n}\nbody.adm-overflow-hidden {\n overflow: hidden !important;\n}\ndiv.adm-px-tester {\n --size: 1;\n height: -webkit-calc(var(--size) / 2 * 2px);\n height: -moz-calc(var(--size) / 2 * 2px);\n height: calc(var(--size) / 2 * 2px);\n width: 0;\n position: fixed;\n left: -100vw;\n top: -100vh;\n -webkit-user-select: none;\n -moz-user-select: none;\n user-select: none;\n pointer-events: none;\n}\n",""]),t.Z=a},758:function(e){"use strict";e.exports=function(e){var t=[];return t.toString=function(){return this.map(function(t){var r="",n=void 0!==t[5];return t[4]&&(r+="@supports (".concat(t[4],") {")),t[2]&&(r+="@media ".concat(t[2]," {")),n&&(r+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),r+=e(t),n&&(r+="}"),t[2]&&(r+="}"),t[4]&&(r+="}"),r}).join("")},t.i=function(e,r,n,i,o){"string"==typeof e&&(e=[[null,e,void 0]]);var a={};if(n)for(var s=0;s<this.length;s++){var l=this[s][0];null!=l&&(a[l]=!0)}for(var c=0;c<e.length;c++){var u=[].concat(e[c]);n&&a[u[0]]||(void 0!==o&&(void 0===u[5]||(u[1]="@layer".concat(u[5].length>0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=o),r&&(u[2]&&(u[1]="@media ".concat(u[2]," {").concat(u[1],"}")),u[2]=r),i&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=i):u[4]="".concat(i)),t.push(u))}},t}},589:function(e){"use strict";e.exports=function(e){return e[1]}},738:function(e,t,r){"use strict";r.d(t,{t2:function(){return et},lz:function(){return p}}),(u=h||(h={}))[u.QR_CODE=0]="QR_CODE",u[u.AZTEC=1]="AZTEC",u[u.CODABAR=2]="CODABAR",u[u.CODE_39=3]="CODE_39",u[u.CODE_93=4]="CODE_93",u[u.CODE_128=5]="CODE_128",u[u.DATA_MATRIX=6]="DATA_MATRIX",u[u.MAXICODE=7]="MAXICODE",u[u.ITF=8]="ITF",u[u.EAN_13=9]="EAN_13",u[u.EAN_8=10]="EAN_8",u[u.PDF_417=11]="PDF_417",u[u.RSS_14=12]="RSS_14",u[u.RSS_EXPANDED=13]="RSS_EXPANDED",u[u.UPC_A=14]="UPC_A",u[u.UPC_E=15]="UPC_E",u[u.UPC_EAN_EXTENSION=16]="UPC_EAN_EXTENSION";var n,i,o,a,s,l,c,u,h,d,f,g,p,m,w=new Map([[h.QR_CODE,"QR_CODE"],[h.AZTEC,"AZTEC"],[h.CODABAR,"CODABAR"],[h.CODE_39,"CODE_39"],[h.CODE_93,"CODE_93"],[h.CODE_128,"CODE_128"],[h.DATA_MATRIX,"DATA_MATRIX"],[h.MAXICODE,"MAXICODE"],[h.ITF,"ITF"],[h.EAN_13,"EAN_13"],[h.EAN_8,"EAN_8"],[h.PDF_417,"PDF_417"],[h.RSS_14,"RSS_14"],[h.RSS_EXPANDED,"RSS_EXPANDED"],[h.UPC_A,"UPC_A"],[h.UPC_E,"UPC_E"],[h.UPC_EAN_EXTENSION,"UPC_EAN_EXTENSION"]]);(n=d||(d={}))[n.UNKNOWN=0]="UNKNOWN",n[n.URL=1]="URL",(i=f||(f={}))[i.SCAN_TYPE_CAMERA=0]="SCAN_TYPE_CAMERA",i[i.SCAN_TYPE_FILE=1]="SCAN_TYPE_FILE";var C=function(){function e(){}return e.GITHUB_PROJECT_URL="https://github.com/mebjas/html5-qrcode",e.SCAN_DEFAULT_FPS=2,e.DEFAULT_DISABLE_FLIP=!1,e.DEFAULT_REMEMBER_LAST_CAMERA_USED=!0,e.DEFAULT_SUPPORTED_SCAN_TYPE=[f.SCAN_TYPE_CAMERA,f.SCAN_TYPE_FILE],e}(),E=function(){function e(e,t){this.format=e,this.formatName=t}return e.prototype.toString=function(){return this.formatName},e.create=function(t){if(!w.has(t))throw"".concat(t," not in html5QrcodeSupportedFormatsTextMap");return new e(t,w.get(t))},e}(),A=function(){function e(){}return e.createFromText=function(e){return{decodedText:e,result:{text:e}}},e.createFromQrcodeResult=function(e){return{decodedText:e.text,result:e}},e}();(o=g||(g={}))[o.UNKWOWN_ERROR=0]="UNKWOWN_ERROR",o[o.IMPLEMENTATION_ERROR=1]="IMPLEMENTATION_ERROR",o[o.NO_CODE_FOUND_ERROR=2]="NO_CODE_FOUND_ERROR";var y=function(){function e(){}return e.createFrom=function(e){return{errorMessage:e,type:g.UNKWOWN_ERROR}},e}(),I=function(){function e(e){this.verbose=e}return e.prototype.log=function(e){this.verbose&&console.log(e)},e.prototype.warn=function(e){this.verbose&&console.warn(e)},e.prototype.logError=function(e,t){(this.verbose||!0===t)&&console.error(e)},e.prototype.logErrors=function(e){if(0===e.length)throw"Logger#logError called without arguments";this.verbose&&console.error(e)},e}();function S(e){return null==e}var _=function(){function e(){}return e.codeParseError=function(e){return"QR code parse error, error = ".concat(e)},e.errorGettingUserMedia=function(e){return"Error getting userMedia, error = ".concat(e)},e.onlyDeviceSupportedError=function(){return"The device doesn't support navigator.mediaDevices , only supported cameraIdOrConfig in this case is deviceId parameter (string)."},e.cameraStreamingNotSupported=function(){return"Camera streaming not supported by the browser."},e.unableToQuerySupportedDevices=function(){return"Unable to query supported devices, unknown error."},e.insecureContextCameraQueryError=function(){return"Camera access is only supported in secure context like https or localhost."},e.scannerPaused=function(){return"Scanner paused"},e}(),b=function(){function e(){}return e.scanningStatus=function(){return"Scanning"},e.idleStatus=function(){return"Idle"},e.errorStatus=function(){return"Error"},e.permissionStatus=function(){return"Permission"},e.noCameraFoundErrorStatus=function(){return"No Cameras"},e.lastMatch=function(e){return"Last Match: ".concat(e)},e.codeScannerTitle=function(){return"Code Scanner"},e.cameraPermissionTitle=function(){return"Request Camera Permissions"},e.cameraPermissionRequesting=function(){return"Requesting camera permissions..."},e.noCameraFound=function(){return"No camera found"},e.scanButtonStopScanningText=function(){return"Stop Scanning"},e.scanButtonStartScanningText=function(){return"Start Scanning"},e.torchOnButton=function(){return"Switch On Torch"},e.torchOffButton=function(){return"Switch Off Torch"},e.torchOnFailedMessage=function(){return"Failed to turn on torch"},e.torchOffFailedMessage=function(){return"Failed to turn off torch"},e.scanButtonScanningStarting=function(){return"Launching Camera..."},e.textIfCameraScanSelected=function(){return"Scan an Image File"},e.textIfFileScanSelected=function(){return"Scan using camera directly"},e.selectCamera=function(){return"Select Camera"},e.fileSelectionChooseImage=function(){return"Choose Image"},e.fileSelectionChooseAnother=function(){return"Choose Another"},e.fileSelectionNoImageSelected=function(){return"No image choosen"},e.anonymousCameraPrefix=function(){return"Anonymous Camera"},e.dragAndDropMessage=function(){return"Or drop an image to scan"},e.dragAndDropMessageOnlyImages=function(){return"Or drop an image to scan (other files not supported)"},e.zoom=function(){return"zoom"},e.loadingImage=function(){return"Loading image..."},e.cameraScanAltText=function(){return"Camera based scan"},e.fileScanAltText=function(){return"Fule based scan"},e}(),T=function(){function e(){}return e.poweredBy=function(){return"Powered by "},e.reportIssues=function(){return"Report issues"},e}(),N=function(){function e(){}return e.isMediaStreamConstraintsValid=function(e,t){if("object"!=typeof e){var r=typeof e;return t.logError("videoConstraints should be of type object, the "+"object passed is of type ".concat(r,"."),!0),!1}for(var n=new Set(["autoGainControl","channelCount","echoCancellation","latency","noiseSuppression","sampleRate","sampleSize","volume"]),i=Object.keys(e),o=0;o<i.length;o++){var a=i[o];if(n.has(a))return t.logError("".concat(a," is not supported videoConstaints."),!0),!1}return!0},e}(),M=r(103),D=function(){function e(e,t,r){if(this.formatMap=new Map([[h.QR_CODE,M.BarcodeFormat.QR_CODE],[h.AZTEC,M.BarcodeFormat.AZTEC],[h.CODABAR,M.BarcodeFormat.CODABAR],[h.CODE_39,M.BarcodeFormat.CODE_39],[h.CODE_93,M.BarcodeFormat.CODE_93],[h.CODE_128,M.BarcodeFormat.CODE_128],[h.DATA_MATRIX,M.BarcodeFormat.DATA_MATRIX],[h.MAXICODE,M.BarcodeFormat.MAXICODE],[h.ITF,M.BarcodeFormat.ITF],[h.EAN_13,M.BarcodeFormat.EAN_13],[h.EAN_8,M.BarcodeFormat.EAN_8],[h.PDF_417,M.BarcodeFormat.PDF_417],[h.RSS_14,M.BarcodeFormat.RSS_14],[h.RSS_EXPANDED,M.BarcodeFormat.RSS_EXPANDED],[h.UPC_A,M.BarcodeFormat.UPC_A],[h.UPC_E,M.BarcodeFormat.UPC_E],[h.UPC_EAN_EXTENSION,M.BarcodeFormat.UPC_EAN_EXTENSION]]),this.reverseFormatMap=this.createReverseFormatMap(),!M)throw"Use html5qrcode.min.js without edit, ZXing not found.";this.verbose=t,this.logger=r;var n=this.createZXingFormats(e),i=new Map;i.set(M.DecodeHintType.POSSIBLE_FORMATS,n),i.set(M.DecodeHintType.TRY_HARDER,!1),this.hints=i}return e.prototype.decodeAsync=function(e){var t=this;return new Promise(function(r,n){try{r(t.decode(e))}catch(e){n(e)}})},e.prototype.decode=function(e){var t=new M.MultiFormatReader(this.verbose,this.hints),r=new M.HTMLCanvasElementLuminanceSource(e),n=new M.BinaryBitmap(new M.HybridBinarizer(r)),i=t.decode(n);return{text:i.text,format:E.create(this.toHtml5QrcodeSupportedFormats(i.format)),debugData:this.createDebugData()}},e.prototype.createReverseFormatMap=function(){var e=new Map;return this.formatMap.forEach(function(t,r,n){e.set(t,r)}),e},e.prototype.toHtml5QrcodeSupportedFormats=function(e){if(!this.reverseFormatMap.has(e))throw"reverseFormatMap doesn't have ".concat(e);return this.reverseFormatMap.get(e)},e.prototype.createZXingFormats=function(e){for(var t=[],r=0;r<e.length;r++){var n=e[r];this.formatMap.has(n)?t.push(this.formatMap.get(n)):this.logger.logError("".concat(n," is not supported by")+"ZXingHtml5QrcodeShim")}return t},e.prototype.createDebugData=function(){return{decoderName:"zxing-js"}},e}(),O=function(e,t){var r,n,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(s){return function(l){var c=[s,l];if(r)throw TypeError("Generator is already executing.");for(;o&&(o=0,c[0]&&(a=0)),a;)try{if(r=1,n&&(i=2&c[0]?n.return:c[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,c[1])).done)return i;switch(n=0,i&&(c=[2&c[0],i.value]),c[0]){case 0:case 1:i=c;break;case 4:return a.label++,{value:c[1],done:!1};case 5:a.label++,n=c[1],c=[0];continue;case 7:c=a.ops.pop(),a.trys.pop();continue;default:if(!(i=(i=a.trys).length>0&&i[i.length-1])&&(6===c[0]||2===c[0])){a=0;continue}if(3===c[0]&&(!i||c[1]>i[0]&&c[1]<i[3])){a.label=c[1];break}if(6===c[0]&&a.label<i[1]){a.label=i[1],i=c;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(c);break}i[2]&&a.ops.pop(),a.trys.pop();continue}c=t.call(e,a)}catch(e){c=[6,e],n=0}finally{r=i=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}},R=function(){function e(t,r,n){if(this.formatMap=new Map([[h.QR_CODE,"qr_code"],[h.AZTEC,"aztec"],[h.CODABAR,"codabar"],[h.CODE_39,"code_39"],[h.CODE_93,"code_93"],[h.CODE_128,"code_128"],[h.DATA_MATRIX,"data_matrix"],[h.ITF,"itf"],[h.EAN_13,"ean_13"],[h.EAN_8,"ean_8"],[h.PDF_417,"pdf417"],[h.UPC_A,"upc_a"],[h.UPC_E,"upc_e"]]),this.reverseFormatMap=this.createReverseFormatMap(),!e.isSupported())throw"Use html5qrcode.min.js without edit, Use BarcodeDetectorDelegate only if it isSupported();";this.verbose=r,this.logger=n;var i=this.createBarcodeDetectorFormats(t);if(this.detector=new BarcodeDetector(i),!this.detector)throw"BarcodeDetector detector not supported"}return e.isSupported=function(){return"BarcodeDetector"in window&&(new BarcodeDetector({formats:["qr_code"]}),!0)},e.prototype.decodeAsync=function(e){var t,r,n,i;return t=this,r=void 0,n=void 0,i=function(){var t,r;return O(this,function(n){switch(n.label){case 0:return[4,this.detector.detect(e)];case 1:if(!(t=n.sent())||0===t.length)throw"No barcode or QR code detected.";return[2,{text:(r=this.selectLargestBarcode(t)).rawValue,format:E.create(this.toHtml5QrcodeSupportedFormats(r.format)),debugData:this.createDebugData()}]}})},new(n||(n=Promise))(function(e,o){function a(e){try{l(i.next(e))}catch(e){o(e)}}function s(e){try{l(i.throw(e))}catch(e){o(e)}}function l(t){var r;t.done?e(t.value):((r=t.value)instanceof n?r:new n(function(e){e(r)})).then(a,s)}l((i=i.apply(t,r||[])).next())})},e.prototype.selectLargestBarcode=function(e){for(var t=null,r=0,n=0;n<e.length;n++){var i=e[n],o=i.boundingBox.width*i.boundingBox.height;o>r&&(r=o,t=i)}if(!t)throw"No largest barcode found";return t},e.prototype.createBarcodeDetectorFormats=function(e){for(var t=[],r=0;r<e.length;r++){var n=e[r];this.formatMap.has(n)?t.push(this.formatMap.get(n)):this.logger.warn("".concat(n," is not supported by")+"BarcodeDetectorDelegate")}return{formats:t}},e.prototype.toHtml5QrcodeSupportedFormats=function(e){if(!this.reverseFormatMap.has(e))throw"reverseFormatMap doesn't have ".concat(e);return this.reverseFormatMap.get(e)},e.prototype.createReverseFormatMap=function(){var e=new Map;return this.formatMap.forEach(function(t,r,n){e.set(t,r)}),e},e.prototype.createDebugData=function(){return{decoderName:"BarcodeDetector"}},e}(),v=function(e,t,r,n){return new(r||(r=Promise))(function(i,o){function a(e){try{l(n.next(e))}catch(e){o(e)}}function s(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(a,s)}l((n=n.apply(e,t||[])).next())})},P=function(e,t){var r,n,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(s){return function(l){var c=[s,l];if(r)throw TypeError("Generator is already executing.");for(;o&&(o=0,c[0]&&(a=0)),a;)try{if(r=1,n&&(i=2&c[0]?n.return:c[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,c[1])).done)return i;switch(n=0,i&&(c=[2&c[0],i.value]),c[0]){case 0:case 1:i=c;break;case 4:return a.label++,{value:c[1],done:!1};case 5:a.label++,n=c[1],c=[0];continue;case 7:c=a.ops.pop(),a.trys.pop();continue;default:if(!(i=(i=a.trys).length>0&&i[i.length-1])&&(6===c[0]||2===c[0])){a=0;continue}if(3===c[0]&&(!i||c[1]>i[0]&&c[1]<i[3])){a.label=c[1];break}if(6===c[0]&&a.label<i[1]){a.label=i[1],i=c;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(c);break}i[2]&&a.ops.pop(),a.trys.pop();continue}c=t.call(e,a)}catch(e){c=[6,e],n=0}finally{r=i=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}},B=function(){function e(e,t,r,n){this.EXECUTIONS_TO_REPORT_PERFORMANCE=100,this.executions=0,this.executionResults=[],this.wasPrimaryDecoderUsedInLastDecode=!1,this.verbose=r,t&&R.isSupported()?(this.primaryDecoder=new R(e,r,n),this.secondaryDecoder=new D(e,r,n)):this.primaryDecoder=new D(e,r,n)}return e.prototype.decodeAsync=function(e){return v(this,void 0,void 0,function(){var t;return P(this,function(r){switch(r.label){case 0:t=performance.now(),r.label=1;case 1:return r.trys.push([1,,3,4]),[4,this.getDecoder().decodeAsync(e)];case 2:return[2,r.sent()];case 3:return this.possiblyLogPerformance(t),[7];case 4:return[2]}})})},e.prototype.decodeRobustlyAsync=function(e){return v(this,void 0,void 0,function(){var t,r;return P(this,function(n){switch(n.label){case 0:t=performance.now(),n.label=1;case 1:return n.trys.push([1,3,4,5]),[4,this.primaryDecoder.decodeAsync(e)];case 2:return[2,n.sent()];case 3:if(r=n.sent(),this.secondaryDecoder)return[2,this.secondaryDecoder.decodeAsync(e)];throw r;case 4:return this.possiblyLogPerformance(t),[7];case 5:return[2]}})})},e.prototype.getDecoder=function(){return this.secondaryDecoder?!1===this.wasPrimaryDecoderUsedInLastDecode?(this.wasPrimaryDecoderUsedInLastDecode=!0,this.primaryDecoder):(this.wasPrimaryDecoderUsedInLastDecode=!1,this.secondaryDecoder):this.primaryDecoder},e.prototype.possiblyLogPerformance=function(e){if(this.verbose){var t=performance.now()-e;this.executionResults.push(t),this.executions++,this.possiblyFlushPerformanceReport()}},e.prototype.possiblyFlushPerformanceReport=function(){if(!(this.executions<this.EXECUTIONS_TO_REPORT_PERFORMANCE)){for(var e=0,t=0,r=this.executionResults;t<r.length;t++)e+=r[t];var n=e/this.executionResults.length;console.log("".concat(n," ms for ").concat(this.executionResults.length," last runs.")),this.executions=0,this.executionResults=[]}},e}(),x=(a=function(e,t){return(a=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}a(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),L=function(e,t,r,n){return new(r||(r=Promise))(function(i,o){function a(e){try{l(n.next(e))}catch(e){o(e)}}function s(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(a,s)}l((n=n.apply(e,t||[])).next())})},k=function(e,t){var r,n,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(s){return function(l){var c=[s,l];if(r)throw TypeError("Generator is already executing.");for(;o&&(o=0,c[0]&&(a=0)),a;)try{if(r=1,n&&(i=2&c[0]?n.return:c[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,c[1])).done)return i;switch(n=0,i&&(c=[2&c[0],i.value]),c[0]){case 0:case 1:i=c;break;case 4:return a.label++,{value:c[1],done:!1};case 5:a.label++,n=c[1],c=[0];continue;case 7:c=a.ops.pop(),a.trys.pop();continue;default:if(!(i=(i=a.trys).length>0&&i[i.length-1])&&(6===c[0]||2===c[0])){a=0;continue}if(3===c[0]&&(!i||c[1]>i[0]&&c[1]<i[3])){a.label=c[1];break}if(6===c[0]&&a.label<i[1]){a.label=i[1],i=c;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(c);break}i[2]&&a.ops.pop(),a.trys.pop();continue}c=t.call(e,a)}catch(e){c=[6,e],n=0}finally{r=i=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}},F=function(){function e(e,t){this.name=e,this.track=t}return e.prototype.isSupported=function(){return!!this.track.getCapabilities&&this.name in this.track.getCapabilities()},e.prototype.apply=function(e){var t={};return t[this.name]=e,this.track.applyConstraints({advanced:[t]})},e.prototype.value=function(){var e=this.track.getSettings();return this.name in e?e[this.name]:null},e}(),U=function(e){function t(t){return e.call(this,"zoom",t)||this}return x(t,e),t}(function(e){function t(t,r){return e.call(this,t,r)||this}return x(t,e),t.prototype.min=function(){return this.getCapabilities().min},t.prototype.max=function(){return this.getCapabilities().max},t.prototype.step=function(){return this.getCapabilities().step},t.prototype.apply=function(e){var t={};return t[this.name]=e,this.track.applyConstraints({advanced:[t]})},t.prototype.getCapabilities=function(){this.failIfNotSupported();var e=this.track.getCapabilities()[this.name];return{min:e.min,max:e.max,step:e.step}},t.prototype.failIfNotSupported=function(){if(!this.isSupported())throw Error("".concat(this.name," capability not supported"))},t}(F)),H=function(e){function t(t){return e.call(this,"torch",t)||this}return x(t,e),t}(F),z=function(){function e(e){this.track=e}return e.prototype.zoomFeature=function(){return new U(this.track)},e.prototype.torchFeature=function(){return new H(this.track)},e}(),V=function(){function e(e,t,r){this.isClosed=!1,this.parentElement=e,this.mediaStream=t,this.callbacks=r,this.surface=this.createVideoElement(this.parentElement.clientWidth),e.append(this.surface)}return e.prototype.createVideoElement=function(e){var t=document.createElement("video");return t.style.width="".concat(e,"px"),t.style.display="block",t.muted=!0,t.setAttribute("muted","true"),t.playsInline=!0,t},e.prototype.setupSurface=function(){var e=this;this.surface.onabort=function(){throw"RenderedCameraImpl video surface onabort() called"},this.surface.onerror=function(){throw"RenderedCameraImpl video surface onerror() called"};var t=function(){var r=e.surface.clientWidth,n=e.surface.clientHeight;e.callbacks.onRenderSurfaceReady(r,n),e.surface.removeEventListener("playing",t)};this.surface.addEventListener("playing",t),this.surface.srcObject=this.mediaStream,this.surface.play()},e.create=function(t,r,n,i){return L(this,void 0,void 0,function(){var o,a;return k(this,function(s){switch(s.label){case 0:if(o=new e(t,r,i),!n.aspectRatio)return[3,2];return a={aspectRatio:n.aspectRatio},[4,o.getFirstTrackOrFail().applyConstraints(a)];case 1:s.sent(),s.label=2;case 2:return o.setupSurface(),[2,o]}})})},e.prototype.failIfClosed=function(){if(this.isClosed)throw"The RenderedCamera has already been closed."},e.prototype.getFirstTrackOrFail=function(){if(this.failIfClosed(),0===this.mediaStream.getVideoTracks().length)throw"No video tracks found";return this.mediaStream.getVideoTracks()[0]},e.prototype.pause=function(){this.failIfClosed(),this.surface.pause()},e.prototype.resume=function(e){this.failIfClosed();var t=this,r=function(){setTimeout(e,200),t.surface.removeEventListener("playing",r)};this.surface.addEventListener("playing",r),this.surface.play()},e.prototype.isPaused=function(){return this.failIfClosed(),this.surface.paused},e.prototype.getSurface=function(){return this.failIfClosed(),this.surface},e.prototype.getRunningTrackCapabilities=function(){return this.getFirstTrackOrFail().getCapabilities()},e.prototype.getRunningTrackSettings=function(){return this.getFirstTrackOrFail().getSettings()},e.prototype.applyVideoConstraints=function(e){return L(this,void 0,void 0,function(){return k(this,function(t){if("aspectRatio"in e)throw"Changing 'aspectRatio' in run-time is not yet supported.";return[2,this.getFirstTrackOrFail().applyConstraints(e)]})})},e.prototype.close=function(){if(this.isClosed)return Promise.resolve();var e=this;return new Promise(function(t,r){var n=e.mediaStream.getVideoTracks().length,i=0;e.mediaStream.getVideoTracks().forEach(function(r){e.mediaStream.removeTrack(r),r.stop(),++i>=n&&(e.isClosed=!0,e.parentElement.removeChild(e.surface),t())})})},e.prototype.getCapabilities=function(){return new z(this.getFirstTrackOrFail())},e}(),j=function(){function e(e){this.mediaStream=e}return e.prototype.render=function(e,t,r){return L(this,void 0,void 0,function(){return k(this,function(n){return[2,V.create(e,this.mediaStream,t,r)]})})},e.create=function(t){return L(this,void 0,void 0,function(){var r;return k(this,function(n){switch(n.label){case 0:if(!navigator.mediaDevices)throw"navigator.mediaDevices not supported";return r={audio:!1,video:t},[4,navigator.mediaDevices.getUserMedia(r)];case 1:return[2,new e(n.sent())]}})})},e}(),G=function(e,t,r,n){return new(r||(r=Promise))(function(i,o){function a(e){try{l(n.next(e))}catch(e){o(e)}}function s(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(a,s)}l((n=n.apply(e,t||[])).next())})},W=function(e,t){var r,n,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(s){return function(l){var c=[s,l];if(r)throw TypeError("Generator is already executing.");for(;o&&(o=0,c[0]&&(a=0)),a;)try{if(r=1,n&&(i=2&c[0]?n.return:c[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,c[1])).done)return i;switch(n=0,i&&(c=[2&c[0],i.value]),c[0]){case 0:case 1:i=c;break;case 4:return a.label++,{value:c[1],done:!1};case 5:a.label++,n=c[1],c=[0];continue;case 7:c=a.ops.pop(),a.trys.pop();continue;default:if(!(i=(i=a.trys).length>0&&i[i.length-1])&&(6===c[0]||2===c[0])){a=0;continue}if(3===c[0]&&(!i||c[1]>i[0]&&c[1]<i[3])){a.label=c[1];break}if(6===c[0]&&a.label<i[1]){a.label=i[1],i=c;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(c);break}i[2]&&a.ops.pop(),a.trys.pop();continue}c=t.call(e,a)}catch(e){c=[6,e],n=0}finally{r=i=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}},Y=function(){function e(){}return e.failIfNotSupported=function(){return G(this,void 0,void 0,function(){return W(this,function(t){if(!navigator.mediaDevices)throw"navigator.mediaDevices not supported";return[2,new e]})})},e.prototype.create=function(e){return G(this,void 0,void 0,function(){return W(this,function(t){return[2,j.create(e)]})})},e}(),X=function(e,t){var r,n,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(s){return function(l){var c=[s,l];if(r)throw TypeError("Generator is already executing.");for(;o&&(o=0,c[0]&&(a=0)),a;)try{if(r=1,n&&(i=2&c[0]?n.return:c[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,c[1])).done)return i;switch(n=0,i&&(c=[2&c[0],i.value]),c[0]){case 0:case 1:i=c;break;case 4:return a.label++,{value:c[1],done:!1};case 5:a.label++,n=c[1],c=[0];continue;case 7:c=a.ops.pop(),a.trys.pop();continue;default:if(!(i=(i=a.trys).length>0&&i[i.length-1])&&(6===c[0]||2===c[0])){a=0;continue}if(3===c[0]&&(!i||c[1]>i[0]&&c[1]<i[3])){a.label=c[1];break}if(6===c[0]&&a.label<i[1]){a.label=i[1],i=c;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(c);break}i[2]&&a.ops.pop(),a.trys.pop();continue}c=t.call(e,a)}catch(e){c=[6,e],n=0}finally{r=i=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}},Z=function(){function e(){}return e.retrieve=function(){if(navigator.mediaDevices)return e.getCamerasFromMediaDevices();var t=MediaStreamTrack;return MediaStreamTrack&&t.getSources?e.getCamerasFromMediaStreamTrack():e.rejectWithError()},e.rejectWithError=function(){var t=_.unableToQuerySupportedDevices();return e.isHttpsOrLocalhost()||(t=_.insecureContextCameraQueryError()),Promise.reject(t)},e.isHttpsOrLocalhost=function(){if("https:"===location.protocol)return!0;var e=location.host.split(":")[0];return"127.0.0.1"===e||"localhost"===e},e.getCamerasFromMediaDevices=function(){var e,t,r,n;return e=this,t=void 0,r=void 0,n=function(){var e,t,r,n,i,o,a;return X(this,function(s){switch(s.label){case 0:return e=function(e){for(var t=e.getVideoTracks(),r=0;r<t.length;r++){var n=t[r];n.enabled=!1,n.stop(),e.removeTrack(n)}},[4,navigator.mediaDevices.getUserMedia({audio:!1,video:!0})];case 1:return t=s.sent(),[4,navigator.mediaDevices.enumerateDevices()];case 2:for(i=0,r=s.sent(),n=[],o=r;i<o.length;i++)"videoinput"===(a=o[i]).kind&&n.push({id:a.deviceId,label:a.label});return e(t),[2,n]}})},new(r||(r=Promise))(function(i,o){function a(e){try{l(n.next(e))}catch(e){o(e)}}function s(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(a,s)}l((n=n.apply(e,t||[])).next())})},e.getCamerasFromMediaStreamTrack=function(){return new Promise(function(e,t){MediaStreamTrack.getSources(function(t){for(var r=[],n=0;n<t.length;n++){var i=t[n];"video"===i.kind&&r.push({id:i.id,label:i.label})}e(r)})})},e}();(s=p||(p={}))[s.UNKNOWN=0]="UNKNOWN",s[s.NOT_STARTED=1]="NOT_STARTED",s[s.SCANNING=2]="SCANNING",s[s.PAUSED=3]="PAUSED";var Q=function(){function e(){this.state=p.NOT_STARTED,this.onGoingTransactionNewState=p.UNKNOWN}return e.prototype.directTransition=function(e){this.failIfTransitionOngoing(),this.validateTransition(e),this.state=e},e.prototype.startTransition=function(e){return this.failIfTransitionOngoing(),this.validateTransition(e),this.onGoingTransactionNewState=e,this},e.prototype.execute=function(){if(this.onGoingTransactionNewState===p.UNKNOWN)throw"Transaction is already cancelled, cannot execute().";var e=this.onGoingTransactionNewState;this.onGoingTransactionNewState=p.UNKNOWN,this.directTransition(e)},e.prototype.cancel=function(){if(this.onGoingTransactionNewState===p.UNKNOWN)throw"Transaction is already cancelled, cannot cancel().";this.onGoingTransactionNewState=p.UNKNOWN},e.prototype.getState=function(){return this.state},e.prototype.failIfTransitionOngoing=function(){if(this.onGoingTransactionNewState!==p.UNKNOWN)throw"Cannot transition to a new state, already under transition"},e.prototype.validateTransition=function(e){switch(this.state){case p.UNKNOWN:throw"Transition from unknown is not allowed";case p.NOT_STARTED:this.failIfNewStateIs(e,[p.PAUSED]);case p.SCANNING:case p.PAUSED:}},e.prototype.failIfNewStateIs=function(e,t){for(var r=0;r<t.length;r++)if(e===t[r])throw"Cannot transition from ".concat(this.state," to ").concat(e)},e}(),q=function(){function e(e){this.stateManager=e}return e.prototype.startTransition=function(e){return this.stateManager.startTransition(e)},e.prototype.directTransition=function(e){this.stateManager.directTransition(e)},e.prototype.getState=function(){return this.stateManager.getState()},e.prototype.canScanFile=function(){return this.stateManager.getState()===p.NOT_STARTED},e.prototype.isScanning=function(){return this.stateManager.getState()!==p.NOT_STARTED},e.prototype.isStrictlyScanning=function(){return this.stateManager.getState()===p.SCANNING},e.prototype.isPaused=function(){return this.stateManager.getState()===p.PAUSED},e}(),K=function(){function e(){}return e.create=function(){return new q(new Q)},e}(),$=(l=function(e,t){return(l=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}l(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),J=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return $(t,e),t.DEFAULT_WIDTH=300,t.DEFAULT_WIDTH_OFFSET=2,t.FILE_SCAN_MIN_HEIGHT=300,t.FILE_SCAN_HIDDEN_CANVAS_PADDING=100,t.MIN_QR_BOX_SIZE=50,t.SHADED_LEFT=1,t.SHADED_RIGHT=2,t.SHADED_TOP=3,t.SHADED_BOTTOM=4,t.SHADED_REGION_ELEMENT_ID="qr-shaded-region",t.VERBOSE=!1,t.BORDER_SHADER_DEFAULT_COLOR="#ffffff",t.BORDER_SHADER_MATCH_COLOR="rgb(90, 193, 56)",t}(C),ee=function(){function e(e,t){this.logger=t,this.fps=J.SCAN_DEFAULT_FPS,e?(e.fps&&(this.fps=e.fps),this.disableFlip=!0===e.disableFlip,this.qrbox=e.qrbox,this.aspectRatio=e.aspectRatio,this.videoConstraints=e.videoConstraints):this.disableFlip=J.DEFAULT_DISABLE_FLIP}return e.prototype.isMediaStreamConstraintsValid=function(){return this.videoConstraints?N.isMediaStreamConstraintsValid(this.videoConstraints,this.logger):(this.logger.logError("Empty videoConstraints",!0),!1)},e.prototype.isShadedBoxEnabled=function(){return!S(this.qrbox)},e.create=function(t,r){return new e(t,r)},e}(),et=function(){function e(e,t){var r;if(this.element=null,this.canvasElement=null,this.scannerPausedUiElement=null,this.hasBorderShaders=null,this.borderShaders=null,this.qrMatch=null,this.renderedCamera=null,this.qrRegion=null,this.context=null,this.lastScanImageFile=null,this.isScanning=!1,!document.getElementById(e))throw"HTML Element with id=".concat(e," not found");this.elementId=e,this.verbose=!1,"boolean"==typeof t?this.verbose=!0===t:t&&(r=t,this.verbose=!0===r.verbose,r.experimentalFeatures),this.logger=new I(this.verbose),this.qrcode=new B(this.getSupportedFormats(t),this.getUseBarCodeDetectorIfSupported(r),this.verbose,this.logger),this.foreverScanTimeout,this.shouldScan=!0,this.stateManagerProxy=K.create()}return e.prototype.start=function(e,t,r,n){var i,o=this;if(!e)throw"cameraIdOrConfig is required";if(!r||"function"!=typeof r)throw"qrCodeSuccessCallback is required and should be a function.";i=n||(this.verbose?this.logger.log:function(){});var a=ee.create(t,this.logger);this.clearElement();var s=!1;a.videoConstraints&&(a.isMediaStreamConstraintsValid()?s=!0:this.logger.logError("'videoConstraints' is not valid 'MediaStreamConstraints, it will be ignored.'",!0));var l=s,c=document.getElementById(this.elementId);c.clientWidth?c.clientWidth:J.DEFAULT_WIDTH,c.style.position="relative",this.shouldScan=!0,this.element=c;var u=this,h=this.stateManagerProxy.startTransition(p.SCANNING);return new Promise(function(t,n){var s=l?a.videoConstraints:u.createVideoConstraints(e);if(!s){h.cancel(),n("videoConstraints should be defined");return}var c={};(!l||a.aspectRatio)&&(c.aspectRatio=a.aspectRatio);var d={onRenderSurfaceReady:function(e,t){u.setupUi(e,t,a),u.isScanning=!0,u.foreverScan(a,r,i)}};Y.failIfNotSupported().then(function(e){e.create(s).then(function(e){return e.render(o.element,c,d).then(function(e){u.renderedCamera=e,h.execute(),t(null)}).catch(function(e){h.cancel(),n(e)})}).catch(function(e){h.cancel(),n(_.errorGettingUserMedia(e))})}).catch(function(e){h.cancel(),n(_.cameraStreamingNotSupported())})})},e.prototype.pause=function(e){if(!this.stateManagerProxy.isStrictlyScanning())throw"Cannot pause, scanner is not scanning.";this.stateManagerProxy.directTransition(p.PAUSED),this.showPausedState(),(S(e)||!0!==e)&&(e=!1),e&&this.renderedCamera&&this.renderedCamera.pause()},e.prototype.resume=function(){if(!this.stateManagerProxy.isPaused())throw"Cannot result, scanner is not paused.";if(!this.renderedCamera)throw"renderedCamera doesn't exist while trying resume()";var e=this,t=function(){e.stateManagerProxy.directTransition(p.SCANNING),e.hidePausedState()};if(!this.renderedCamera.isPaused())return void t();this.renderedCamera.resume(function(){t()})},e.prototype.getState=function(){return this.stateManagerProxy.getState()},e.prototype.stop=function(){var e=this;if(!this.stateManagerProxy.isScanning())throw"Cannot stop, scanner is not running or paused.";var t=this.stateManagerProxy.startTransition(p.NOT_STARTED);this.shouldScan=!1,this.foreverScanTimeout&&clearTimeout(this.foreverScanTimeout);var r=function(){if(e.element){var t=document.getElementById(J.SHADED_REGION_ELEMENT_ID);t&&e.element.removeChild(t)}},n=this;return this.renderedCamera.close().then(function(){return n.renderedCamera=null,n.element&&(n.element.removeChild(n.canvasElement),n.canvasElement=null),r(),n.qrRegion&&(n.qrRegion=null),n.context&&(n.context=null),t.execute(),n.hidePausedState(),n.isScanning=!1,Promise.resolve()})},e.prototype.scanFile=function(e,t){return this.scanFileV2(e,t).then(function(e){return e.decodedText})},e.prototype.scanFileV2=function(e,t){var r=this;if(!e||!(e instanceof File))throw"imageFile argument is mandatory and should be instance of File. Use 'event.target.files[0]'.";if(S(t)&&(t=!0),!this.stateManagerProxy.canScanFile())throw"Cannot start file scan - ongoing camera scan";return new Promise(function(n,i){r.possiblyCloseLastScanImageFile(),r.clearElement(),r.lastScanImageFile=URL.createObjectURL(e);var o=new Image;o.onload=function(){var e=o.width,a=o.height,s=document.getElementById(r.elementId),l=s.clientWidth?s.clientWidth:J.DEFAULT_WIDTH,c=Math.max(s.clientHeight?s.clientHeight:a,J.FILE_SCAN_MIN_HEIGHT),u=r.computeCanvasDrawConfig(e,a,l,c);if(t){var h=r.createCanvasElement(l,c,"qr-canvas-visible");h.style.display="inline-block",s.appendChild(h);var d=h.getContext("2d");if(!d)throw"Unable to get 2d context from canvas";d.canvas.width=l,d.canvas.height=c,d.drawImage(o,0,0,e,a,u.x,u.y,u.width,u.height)}var f=J.FILE_SCAN_HIDDEN_CANVAS_PADDING,g=Math.max(o.width,u.width),p=Math.max(o.height,u.height),m=g+2*f,w=p+2*f,C=r.createCanvasElement(m,w);s.appendChild(C);var E=C.getContext("2d");if(!E)throw"Unable to get 2d context from canvas";E.canvas.width=m,E.canvas.height=w,E.drawImage(o,0,0,e,a,f,f,g,p);try{r.qrcode.decodeRobustlyAsync(C).then(function(e){n(A.createFromQrcodeResult(e))}).catch(i)}catch(e){i("QR code parse error, error = ".concat(e))}},o.onerror=i,o.onabort=i,o.onstalled=i,o.onsuspend=i,o.src=URL.createObjectURL(e)})},e.prototype.clear=function(){this.clearElement()},e.getCameras=function(){return Z.retrieve()},e.prototype.getRunningTrackCapabilities=function(){return this.getRenderedCameraOrFail().getRunningTrackCapabilities()},e.prototype.getRunningTrackSettings=function(){return this.getRenderedCameraOrFail().getRunningTrackSettings()},e.prototype.getRunningTrackCameraCapabilities=function(){return this.getRenderedCameraOrFail().getCapabilities()},e.prototype.applyVideoConstraints=function(e){if(e){if(!N.isMediaStreamConstraintsValid(e,this.logger))throw"invalid videoConstaints passed, check logs for more details"}else throw"videoConstaints is required argument.";return this.getRenderedCameraOrFail().applyVideoConstraints(e)},e.prototype.getRenderedCameraOrFail=function(){if(null==this.renderedCamera)throw"Scanning is not in running state, call this API only when QR code scanning using camera is in running state.";return this.renderedCamera},e.prototype.getSupportedFormats=function(e){var t=[h.QR_CODE,h.AZTEC,h.CODABAR,h.CODE_39,h.CODE_93,h.CODE_128,h.DATA_MATRIX,h.MAXICODE,h.ITF,h.EAN_13,h.EAN_8,h.PDF_417,h.RSS_14,h.RSS_EXPANDED,h.UPC_A,h.UPC_E,h.UPC_EAN_EXTENSION];if(!e||"boolean"==typeof e||!e.formatsToSupport)return t;if(!Array.isArray(e.formatsToSupport))throw"configOrVerbosityFlag.formatsToSupport should be undefined or an array.";if(0===e.formatsToSupport.length)throw"Atleast 1 formatsToSupport is needed.";for(var r=[],n=0,i=e.formatsToSupport;n<i.length;n++){var o=i[n];Object.values(h).includes(o)?r.push(o):this.logger.warn("Invalid format: ".concat(o," passed in config, ignoring."))}if(0===r.length)throw"None of formatsToSupport match supported values.";return r},e.prototype.getUseBarCodeDetectorIfSupported=function(e){if(S(e))return!0;if(!S(e.useBarCodeDetectorIfSupported))return!1!==e.useBarCodeDetectorIfSupported;if(S(e.experimentalFeatures))return!0;var t=e.experimentalFeatures;return!!S(t.useBarCodeDetectorIfSupported)||!1!==t.useBarCodeDetectorIfSupported},e.prototype.validateQrboxSize=function(e,t,r){var n,i=r.qrbox;this.validateQrboxConfig(i);var o=this.toQrdimensions(e,t,i),a=function(e){if(e<J.MIN_QR_BOX_SIZE)throw"minimum size of 'config.qrbox' dimension value is"+" ".concat(J.MIN_QR_BOX_SIZE,"px.")};a(o.width),a(o.height),(n=o.width)>e&&(this.logger.warn("`qrbox.width` or `qrbox` is larger than the width of the root element. The width will be truncated to the width of root element."),n=e),o.width=n},e.prototype.validateQrboxConfig=function(e){if("number"!=typeof e&&"function"!=typeof e&&(void 0===e.width||void 0===e.height))throw"Invalid instance of QrDimensions passed for 'config.qrbox'. Both 'width' and 'height' should be set."},e.prototype.toQrdimensions=function(e,t,r){if("number"==typeof r)return{width:r,height:r};if("function"==typeof r)try{return r(e,t)}catch(e){throw Error("qrbox config was passed as a function but it failed with unknown error"+e)}return r},e.prototype.setupUi=function(e,t,r){r.isShadedBoxEnabled()&&this.validateQrboxSize(e,t,r);var n=S(r.qrbox)?{width:e,height:t}:r.qrbox;this.validateQrboxConfig(n);var i=this.toQrdimensions(e,t,n);i.height>t&&this.logger.warn("[Html5Qrcode] config.qrbox has height that isgreater than the height of the video stream. Shading will be ignored");var o=r.isShadedBoxEnabled()&&i.height<=t,a=o?this.getShadedRegionBounds(e,t,i):{x:0,y:0,width:e,height:t},s=this.createCanvasElement(a.width,a.height),l=s.getContext("2d",{willReadFrequently:!0});l.canvas.width=a.width,l.canvas.height=a.height,this.element.append(s),o&&this.possiblyInsertShadingElement(this.element,e,t,i),this.createScannerPausedUiElement(this.element),this.qrRegion=a,this.context=l,this.canvasElement=s},e.prototype.createScannerPausedUiElement=function(e){var t=document.createElement("div");t.innerText=_.scannerPaused(),t.style.display="none",t.style.position="absolute",t.style.top="0px",t.style.zIndex="1",t.style.background="rgba(9, 9, 9, 0.46)",t.style.color="#FFECEC",t.style.textAlign="center",t.style.width="100%",e.appendChild(t),this.scannerPausedUiElement=t},e.prototype.scanContext=function(e,t){var r=this;return this.stateManagerProxy.isPaused()?Promise.resolve(!1):this.qrcode.decodeAsync(this.canvasElement).then(function(t){return e(t.text,A.createFromQrcodeResult(t)),r.possiblyUpdateShaders(!0),!0}).catch(function(e){r.possiblyUpdateShaders(!1);var n=_.codeParseError(e);return t(n,y.createFrom(n)),!1})},e.prototype.foreverScan=function(e,t,r){var n=this;if(this.shouldScan&&this.renderedCamera){var i=this.renderedCamera.getSurface(),o=i.videoWidth/i.clientWidth,a=i.videoHeight/i.clientHeight;if(!this.qrRegion)throw"qrRegion undefined when localMediaStream is ready.";var s=this.qrRegion.width*o,l=this.qrRegion.height*a,c=this.qrRegion.x*o,u=this.qrRegion.y*a;this.context.drawImage(i,c,u,s,l,0,0,this.qrRegion.width,this.qrRegion.height);var h=function(){n.foreverScanTimeout=setTimeout(function(){n.foreverScan(e,t,r)},n.getTimeoutFps(e.fps))};this.scanContext(t,r).then(function(i){i||!0===e.disableFlip?h():(n.context.translate(n.context.canvas.width,0),n.context.scale(-1,1),n.scanContext(t,r).finally(function(){h()}))}).catch(function(e){n.logger.logError("Error happend while scanning context",e),h()})}},e.prototype.createVideoConstraints=function(e){if("string"==typeof e)return{deviceId:{exact:e}};if("object"==typeof e){var t="facingMode",r="deviceId",n={user:!0,environment:!0},i="exact",o=function(e){if(e in n)return!0;throw"config has invalid 'facingMode' value = "+"'".concat(e,"'")},a=Object.keys(e);if(1!==a.length)throw"'cameraIdOrConfig' object should have exactly 1 key,"+" if passed as an object, found ".concat(a.length," keys");var s=Object.keys(e)[0];if(s!==t&&s!==r)throw"Only '".concat(t,"' and '").concat(r,"' ")+" are supported for 'cameraIdOrConfig'";if(s===t){var l=e.facingMode;if("string"==typeof l){if(o(l))return{facingMode:l}}else if("object"==typeof l)if(i in l){if(o(l["".concat(i)]))return{facingMode:{exact:l["".concat(i)]}}}else throw"'facingMode' should be string or object with"+" ".concat(i," as key.");else{var c=typeof l;throw"Invalid type of 'facingMode' = ".concat(c)}}else{var u=e.deviceId;if("string"==typeof u)return{deviceId:u};if("object"==typeof u)if(i in u)return{deviceId:{exact:u["".concat(i)]}};else throw"'deviceId' should be string or object with"+" ".concat(i," as key.");var h=typeof u;throw"Invalid type of 'deviceId' = ".concat(h)}}var d=typeof e;throw"Invalid type of 'cameraIdOrConfig' = ".concat(d)},e.prototype.computeCanvasDrawConfig=function(e,t,r,n){if(e<=r&&t<=n)return{x:(r-e)/2,y:(n-t)/2,width:e,height:t};var i=e,o=t;return e>r&&(t=r/e*t,e=r),t>n&&(e=n/t*e,t=n),this.logger.log("Image downsampled from "+"".concat(i,"X").concat(o)+" to ".concat(e,"X").concat(t,".")),this.computeCanvasDrawConfig(e,t,r,n)},e.prototype.clearElement=function(){if(this.stateManagerProxy.isScanning())throw"Cannot clear while scan is ongoing, close it first.";var e=document.getElementById(this.elementId);e&&(e.innerHTML="")},e.prototype.possiblyUpdateShaders=function(e){this.qrMatch!==e&&(this.hasBorderShaders&&this.borderShaders&&this.borderShaders.length&&this.borderShaders.forEach(function(t){t.style.backgroundColor=e?J.BORDER_SHADER_MATCH_COLOR:J.BORDER_SHADER_DEFAULT_COLOR}),this.qrMatch=e)},e.prototype.possiblyCloseLastScanImageFile=function(){this.lastScanImageFile&&(URL.revokeObjectURL(this.lastScanImageFile),this.lastScanImageFile=null)},e.prototype.createCanvasElement=function(e,t,r){var n=document.createElement("canvas");return n.style.width="".concat(e,"px"),n.style.height="".concat(t,"px"),n.style.display="none",n.id=S(r)?"qr-canvas":r,n},e.prototype.getShadedRegionBounds=function(e,t,r){if(r.width>e||r.height>t)throw"'config.qrbox' dimensions should not be greater than the dimensions of the root HTML element.";return{x:(e-r.width)/2,y:(t-r.height)/2,width:r.width,height:r.height}},e.prototype.possiblyInsertShadingElement=function(e,t,r,n){if(!(t-n.width<1)&&!(r-n.height<1)){var i=document.createElement("div");i.style.position="absolute";var o=(t-n.width)/2,a=(r-n.height)/2;i.style.borderLeft="".concat(o,"px solid rgba(0, 0, 0, 0.48)"),i.style.borderRight="".concat(o,"px solid rgba(0, 0, 0, 0.48)"),i.style.borderTop="".concat(a,"px solid rgba(0, 0, 0, 0.48)"),i.style.borderBottom="".concat(a,"px solid rgba(0, 0, 0, 0.48)"),i.style.boxSizing="border-box",i.style.top="0px",i.style.bottom="0px",i.style.left="0px",i.style.right="0px",i.id="".concat(J.SHADED_REGION_ELEMENT_ID),t-n.width<11||r-n.height<11?this.hasBorderShaders=!1:(this.insertShaderBorders(i,40,5,-5,null,0,!0),this.insertShaderBorders(i,40,5,-5,null,0,!1),this.insertShaderBorders(i,40,5,null,-5,0,!0),this.insertShaderBorders(i,40,5,null,-5,0,!1),this.insertShaderBorders(i,5,45,-5,null,-5,!0),this.insertShaderBorders(i,5,45,null,-5,-5,!0),this.insertShaderBorders(i,5,45,-5,null,-5,!1),this.insertShaderBorders(i,5,45,null,-5,-5,!1),this.hasBorderShaders=!0),e.append(i)}},e.prototype.insertShaderBorders=function(e,t,r,n,i,o,a){var s=document.createElement("div");s.style.position="absolute",s.style.backgroundColor=J.BORDER_SHADER_DEFAULT_COLOR,s.style.width="".concat(t,"px"),s.style.height="".concat(r,"px"),null!==n&&(s.style.top="".concat(n,"px")),null!==i&&(s.style.bottom="".concat(i,"px")),a?s.style.left="".concat(o,"px"):s.style.right="".concat(o,"px"),this.borderShaders||(this.borderShaders=[]),this.borderShaders.push(s),e.appendChild(s)},e.prototype.showPausedState=function(){if(!this.scannerPausedUiElement)throw"[internal error] scanner paused UI element not found";this.scannerPausedUiElement.style.display="block"},e.prototype.hidePausedState=function(){if(!this.scannerPausedUiElement)throw"[internal error] scanner paused UI element not found";this.scannerPausedUiElement.style.display="none"},e.prototype.getTimeoutFps=function(e){return 1e3/e},e}(),er="data:image/svg+xml;base64,",en=er+"PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAzNzEuNjQzIDM3MS42NDMiIHN0eWxlPSJlbmFibGUtYmFja2dyb3VuZDpuZXcgMCAwIDM3MS42NDMgMzcxLjY0MyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+PHBhdGggZD0iTTEwNS4wODQgMzguMjcxaDE2My43Njh2MjBIMTA1LjA4NHoiLz48cGF0aCBkPSJNMzExLjU5NiAxOTAuMTg5Yy03LjQ0MS05LjM0Ny0xOC40MDMtMTYuMjA2LTMyLjc0My0yMC41MjJWMzBjMC0xNi41NDItMTMuNDU4LTMwLTMwLTMwSDEyNS4wODRjLTE2LjU0MiAwLTMwIDEzLjQ1OC0zMCAzMHYxMjAuMTQzaC04LjI5NmMtMTYuNTQyIDAtMzAgMTMuNDU4LTMwIDMwdjEuMzMzYTI5LjgwNCAyOS44MDQgMCAwIDAgNC42MDMgMTUuOTM5Yy03LjM0IDUuNDc0LTEyLjEwMyAxNC4yMjEtMTIuMTAzIDI0LjA2MXYxLjMzM2MwIDkuODQgNC43NjMgMTguNTg3IDEyLjEwMyAyNC4wNjJhMjkuODEgMjkuODEgMCAwIDAtNC42MDMgMTUuOTM4djEuMzMzYzAgMTYuNTQyIDEzLjQ1OCAzMCAzMCAzMGg4LjMyNGMuNDI3IDExLjYzMSA3LjUwMyAyMS41ODcgMTcuNTM0IDI2LjE3Ny45MzEgMTAuNTAzIDQuMDg0IDMwLjE4NyAxNC43NjggNDUuNTM3YTkuOTg4IDkuOTg4IDAgMCAwIDguMjE2IDQuMjg4IDkuOTU4IDkuOTU4IDAgMCAwIDUuNzA0LTEuNzkzYzQuNTMzLTMuMTU1IDUuNjUtOS4zODggMi40OTUtMTMuOTIxLTYuNzk4LTkuNzY3LTkuNjAyLTIyLjYwOC0xMC43Ni0zMS40aDgyLjY4NWMuMjcyLjQxNC41NDUuODE4LjgxNSAxLjIxIDMuMTQyIDQuNTQxIDkuMzcyIDUuNjc5IDEzLjkxMyAyLjUzNCA0LjU0Mi0zLjE0MiA1LjY3Ny05LjM3MSAyLjUzNS0xMy45MTMtMTEuOTE5LTE3LjIyOS04Ljc4Ny0zNS44ODQgOS41ODEtNTcuMDEyIDMuMDY3LTIuNjUyIDEyLjMwNy0xMS43MzIgMTEuMjE3LTI0LjAzMy0uODI4LTkuMzQzLTcuMTA5LTE3LjE5NC0xOC42NjktMjMuMzM3YTkuODU3IDkuODU3IDAgMCAwLTEuMDYxLS40ODZjLS40NjYtLjE4Mi0xMS40MDMtNC41NzktOS43NDEtMTUuNzA2IDEuMDA3LTYuNzM3IDE0Ljc2OC04LjI3MyAyMy43NjYtNy42NjYgMjMuMTU2IDEuNTY5IDM5LjY5OCA3LjgwMyA0Ny44MzYgMTguMDI2IDUuNzUyIDcuMjI1IDcuNjA3IDE2LjYyMyA1LjY3MyAyOC43MzMtLjQxMyAyLjU4NS0uODI0IDUuMjQxLTEuMjQ1IDcuOTU5LTUuNzU2IDM3LjE5NC0xMi45MTkgODMuNDgzLTQ5Ljg3IDExNC42NjEtNC4yMjEgMy41NjEtNC43NTYgOS44Ny0xLjE5NCAxNC4wOTJhOS45OCA5Ljk4IDAgMCAwIDcuNjQ4IDMuNTUxIDkuOTU1IDkuOTU1IDAgMCAwIDYuNDQ0LTIuMzU4YzQyLjY3Mi0zNi4wMDUgNTAuODAyLTg4LjUzMyA1Ni43MzctMTI2Ljg4OC40MTUtMi42ODQuODIxLTUuMzA5IDEuMjI5LTcuODYzIDIuODM0LTE3LjcyMS0uNDU1LTMyLjY0MS05Ljc3Mi00NC4zNDV6bS0yMzIuMzA4IDQyLjYyYy01LjUxNCAwLTEwLTQuNDg2LTEwLTEwdi0xLjMzM2MwLTUuNTE0IDQuNDg2LTEwIDEwLTEwaDE1djIxLjMzM2gtMTV6bS0yLjUtNTIuNjY2YzAtNS41MTQgNC40ODYtMTAgMTAtMTBoNy41djIxLjMzM2gtNy41Yy01LjUxNCAwLTEwLTQuNDg2LTEwLTEwdi0xLjMzM3ptMTcuNSA5My45OTloLTcuNWMtNS41MTQgMC0xMC00LjQ4Ni0xMC0xMHYtMS4zMzNjMC01LjUxNCA0LjQ4Ni0xMCAxMC0xMGg3LjV2MjEuMzMzem0zMC43OTYgMjguODg3Yy01LjUxNCAwLTEwLTQuNDg2LTEwLTEwdi04LjI3MWg5MS40NTdjLS44NTEgNi42NjgtLjQzNyAxMi43ODcuNzMxIDE4LjI3MWgtODIuMTg4em03OS40ODItMTEzLjY5OGMtMy4xMjQgMjAuOTA2IDEyLjQyNyAzMy4xODQgMjEuNjI1IDM3LjA0IDUuNDQxIDIuOTY4IDcuNTUxIDUuNjQ3IDcuNzAxIDcuMTg4LjIxIDIuMTUtMi41NTMgNS42ODQtNC40NzcgNy4yNTEtLjQ4Mi4zNzgtLjkyOS44LTEuMzM1IDEuMjYxLTYuOTg3IDcuOTM2LTExLjk4MiAxNS41Mi0xNS40MzIgMjIuNjg4aC05Ny41NjRWMzBjMC01LjUxNCA0LjQ4Ni0xMCAxMC0xMGgxMjMuNzY5YzUuNTE0IDAgMTAgNC40ODYgMTAgMTB2MTM1LjU3OWMtMy4wMzItLjM4MS02LjE1LS42OTQtOS4zODktLjkxNC0yNS4xNTktMS42OTQtNDIuMzcgNy43NDgtNDQuODk4IDI0LjY2NnoiLz48cGF0aCBkPSJNMTc5LjEyOSA4My4xNjdoLTI0LjA2YTUgNSAwIDAgMC01IDV2MjQuMDYxYTUgNSAwIDAgMCA1IDVoMjQuMDZhNSA1IDAgMCAwIDUtNVY4OC4xNjdhNSA1IDAgMCAwLTUtNXpNMTcyLjYyOSAxNDIuODZoLTEyLjU2VjEzMC44YTUgNSAwIDEgMC0xMCAwdjE3LjA2MWE1IDUgMCAwIDAgNSA1aDE3LjU2YTUgNSAwIDEgMCAwLTEwLjAwMXpNMjE2LjU2OCA4My4xNjdoLTI0LjA2YTUgNSAwIDAgMC01IDV2MjQuMDYxYTUgNSAwIDAgMCA1IDVoMjQuMDZhNSA1IDAgMCAwIDUtNVY4OC4xNjdhNSA1IDAgMCAwLTUtNXptLTUgMjQuMDYxaC0xNC4wNlY5My4xNjdoMTQuMDZ2MTQuMDYxek0yMTEuNjY5IDEyNS45MzZIMTk3LjQxYTUgNSAwIDAgMC01IDV2MTQuMjU3YTUgNSAwIDAgMCA1IDVoMTQuMjU5YTUgNSAwIDAgMCA1LTV2LTE0LjI1N2E1IDUgMCAwIDAtNS01eiIvPjwvc3ZnPg==",ei=er+"PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA1OS4wMTggNTkuMDE4IiBzdHlsZT0iZW5hYmxlLWJhY2tncm91bmQ6bmV3IDAgMCA1OS4wMTggNTkuMDE4IiB4bWw6c3BhY2U9InByZXNlcnZlIj48cGF0aCBkPSJtNTguNzQxIDU0LjgwOS01Ljk2OS02LjI0NGExMC43NCAxMC43NCAwIDAgMCAyLjgyLTcuMjVjMC01Ljk1My00Ljg0My0xMC43OTYtMTAuNzk2LTEwLjc5NlMzNCAzNS4zNjEgMzQgNDEuMzE0IDM4Ljg0MyA1Mi4xMSA0NC43OTYgNTIuMTFjMi40NDEgMCA0LjY4OC0uODI0IDYuNDk5LTIuMTk2bDYuMDAxIDYuMjc3YS45OTguOTk4IDAgMCAwIDEuNDE0LjAzMiAxIDEgMCAwIDAgLjAzMS0xLjQxNHpNMzYgNDEuMzE0YzAtNC44NSAzLjk0Ni04Ljc5NiA4Ljc5Ni04Ljc5NnM4Ljc5NiAzLjk0NiA4Ljc5NiA4Ljc5Ni0zLjk0NiA4Ljc5Ni04Ljc5NiA4Ljc5NlMzNiA0Ni4xNjQgMzYgNDEuMzE0ek0xMC40MzEgMTYuMDg4YzAgMy4wNyAyLjQ5OCA1LjU2OCA1LjU2OSA1LjU2OHM1LjU2OS0yLjQ5OCA1LjU2OS01LjU2OGMwLTMuMDcxLTIuNDk4LTUuNTY5LTUuNTY5LTUuNTY5cy01LjU2OSAyLjQ5OC01LjU2OSA1LjU2OXptOS4xMzggMGMwIDEuOTY4LTEuNjAyIDMuNTY4LTMuNTY5IDMuNTY4cy0zLjU2OS0xLjYwMS0zLjU2OS0zLjU2OCAxLjYwMi0zLjU2OSAzLjU2OS0zLjU2OSAzLjU2OSAxLjYwMSAzLjU2OSAzLjU2OXoiLz48cGF0aCBkPSJtMzAuODgyIDI4Ljk4NyA5LjE4LTEwLjA1NCAxMS4yNjIgMTAuMzIzYTEgMSAwIDAgMCAxLjM1MS0xLjQ3NWwtMTItMTFhMSAxIDAgMCAwLTEuNDE0LjA2M2wtOS43OTQgMTAuNzI3LTQuNzQzLTQuNzQzYTEuMDAzIDEuMDAzIDAgMCAwLTEuMzY4LS4wNDRMNi4zMzkgMzcuNzY4YTEgMSAwIDEgMCAxLjMyMiAxLjUwMWwxNi4zMTMtMTQuMzYyIDcuMzE5IDcuMzE4YS45OTkuOTk5IDAgMSAwIDEuNDE0LTEuNDE0bC0xLjgyNS0xLjgyNHoiLz48cGF0aCBkPSJNMzAgNDYuNTE4SDJ2LTQyaDU0djI4YTEgMSAwIDEgMCAyIDB2LTI5YTEgMSAwIDAgMC0xLTFIMWExIDEgMCAwIDAtMSAxdjQ0YTEgMSAwIDAgMCAxIDFoMjlhMSAxIDAgMSAwIDAtMnoiLz48L3N2Zz4=",eo=er+"PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA0NjAgNDYwIiBzdHlsZT0iZW5hYmxlLWJhY2tncm91bmQ6bmV3IDAgMCA0NjAgNDYwIiB4bWw6c3BhY2U9InByZXNlcnZlIj48cGF0aCBkPSJNMjMwIDBDMTAyLjk3NSAwIDAgMTAyLjk3NSAwIDIzMHMxMDIuOTc1IDIzMCAyMzAgMjMwIDIzMC0xMDIuOTc0IDIzMC0yMzBTMzU3LjAyNSAwIDIzMCAwem0zOC4zMzMgMzc3LjM2YzAgOC42NzYtNy4wMzQgMTUuNzEtMTUuNzEgMTUuNzFoLTQzLjEwMWMtOC42NzYgMC0xNS43MS03LjAzNC0xNS43MS0xNS43MVYyMDIuNDc3YzAtOC42NzYgNy4wMzMtMTUuNzEgMTUuNzEtMTUuNzFoNDMuMTAxYzguNjc2IDAgMTUuNzEgNy4wMzMgMTUuNzEgMTUuNzFWMzc3LjM2ek0yMzAgMTU3Yy0yMS41MzkgMC0zOS0xNy40NjEtMzktMzlzMTcuNDYxLTM5IDM5LTM5IDM5IDE3LjQ2MSAzOSAzOS0xNy40NjEgMzktMzkgMzl6Ii8+PC9zdmc+",ea=function(){function e(){}return e.createDefault=function(){return{hasPermission:!1,lastUsedCameraId:null}},e}(),es=function(){function e(){this.data=ea.createDefault();var t=localStorage.getItem(e.LOCAL_STORAGE_KEY);t?this.data=JSON.parse(t):this.reset()}return e.prototype.hasCameraPermissions=function(){return this.data.hasPermission},e.prototype.getLastUsedCameraId=function(){return this.data.lastUsedCameraId},e.prototype.setHasPermission=function(e){this.data.hasPermission=e,this.flush()},e.prototype.setLastUsedCameraId=function(e){this.data.lastUsedCameraId=e,this.flush()},e.prototype.resetLastUsedCameraId=function(){this.data.lastUsedCameraId=null,this.flush()},e.prototype.reset=function(){this.data=ea.createDefault(),this.flush()},e.prototype.flush=function(){localStorage.setItem(e.LOCAL_STORAGE_KEY,JSON.stringify(this.data))},e.LOCAL_STORAGE_KEY="HTML5_QRCODE_DATA",e}(),el=function(){function e(){this.infoDiv=document.createElement("div")}return e.prototype.renderInto=function(e){this.infoDiv.style.position="absolute",this.infoDiv.style.top="10px",this.infoDiv.style.right="10px",this.infoDiv.style.zIndex="2",this.infoDiv.style.display="none",this.infoDiv.style.padding="5pt",this.infoDiv.style.border="1px solid #171717",this.infoDiv.style.fontSize="10pt",this.infoDiv.style.background="rgb(0 0 0 / 69%)",this.infoDiv.style.borderRadius="5px",this.infoDiv.style.textAlign="center",this.infoDiv.style.fontWeight="400",this.infoDiv.style.color="white",this.infoDiv.innerText=T.poweredBy();var t=document.createElement("a");t.innerText="ScanApp",t.href="https://scanapp.org",t.target="new",t.style.color="white",this.infoDiv.appendChild(t);var r=document.createElement("br"),n=document.createElement("br");this.infoDiv.appendChild(r),this.infoDiv.appendChild(n);var i=document.createElement("a");i.innerText=T.reportIssues(),i.href="https://github.com/mebjas/html5-qrcode/issues",i.target="new",i.style.color="white",this.infoDiv.appendChild(i),e.appendChild(this.infoDiv)},e.prototype.show=function(){this.infoDiv.style.display="block"},e.prototype.hide=function(){this.infoDiv.style.display="none"},e}(),ec=function(){function e(e,t){this.isShowingInfoIcon=!0,this.onTapIn=e,this.onTapOut=t,this.infoIcon=document.createElement("img")}return e.prototype.renderInto=function(e){var t=this;this.infoIcon.alt="Info icon",this.infoIcon.src=eo,this.infoIcon.style.position="absolute",this.infoIcon.style.top="4px",this.infoIcon.style.right="4px",this.infoIcon.style.opacity="0.6",this.infoIcon.style.cursor="pointer",this.infoIcon.style.zIndex="2",this.infoIcon.style.width="16px",this.infoIcon.style.height="16px",this.infoIcon.onmouseover=function(e){return t.onHoverIn()},this.infoIcon.onmouseout=function(e){return t.onHoverOut()},this.infoIcon.onclick=function(e){return t.onClick()},e.appendChild(this.infoIcon)},e.prototype.onHoverIn=function(){this.isShowingInfoIcon&&(this.infoIcon.style.opacity="1")},e.prototype.onHoverOut=function(){this.isShowingInfoIcon&&(this.infoIcon.style.opacity="0.6")},e.prototype.onClick=function(){this.isShowingInfoIcon?(this.isShowingInfoIcon=!1,this.onTapIn(),this.infoIcon.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAAQgAAAEIBarqQRAAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAAE1SURBVDiNfdI7S0NBEAXgLya1otFgpbYSbISAgpXYi6CmiH9KCAiChaVga6OiWPgfRDQ+0itaGVNosXtluWwcuMzePfM4M3sq8lbHBubwg1dc4m1E/J/N4ghDPOIsfk/4xiEao5KX0McFljN4C9d4QTPXuY99jP3DsIoDPGM6BY5i5yI5R7O4q+ImFkJY2DCh3cAH2klyB+9J1xUMMAG7eCh1a+Mr+k48b5diXrFVwwLuS+BJ9MfR7+G0FHOHhTHhnXNWS87VDF4pcnfQK4Ep7XScNLmPTZgURNKKYENYWDpzW1BhscS1WHS8CDgURFJQrWcoF3c13KKbgg1BYQfy8xZWEzTTw1QZbAoKu8FqJnktdu5hcVSHmchiILzzuaDQvjBzV2m8yohCE1jHfPx/xhU+y4G/D75ELlRJsSYAAAAASUVORK5CYII=",this.infoIcon.style.opacity="1"):(this.isShowingInfoIcon=!0,this.onTapOut(),this.infoIcon.src=eo,this.infoIcon.style.opacity="0.6")},e}(),eu=function(){function e(){var e=this;this.infoDiv=new el,this.infoIcon=new ec(function(){e.infoDiv.show()},function(){e.infoDiv.hide()})}return e.prototype.renderInto=function(e){this.infoDiv.renderInto(e),this.infoIcon.renderInto(e)},e}(),eh=function(e,t){var r,n,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(s){return function(l){var c=[s,l];if(r)throw TypeError("Generator is already executing.");for(;o&&(o=0,c[0]&&(a=0)),a;)try{if(r=1,n&&(i=2&c[0]?n.return:c[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,c[1])).done)return i;switch(n=0,i&&(c=[2&c[0],i.value]),c[0]){case 0:case 1:i=c;break;case 4:return a.label++,{value:c[1],done:!1};case 5:a.label++,n=c[1],c=[0];continue;case 7:c=a.ops.pop(),a.trys.pop();continue;default:if(!(i=(i=a.trys).length>0&&i[i.length-1])&&(6===c[0]||2===c[0])){a=0;continue}if(3===c[0]&&(!i||c[1]>i[0]&&c[1]<i[3])){a.label=c[1];break}if(6===c[0]&&a.label<i[1]){a.label=i[1],i=c;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(c);break}i[2]&&a.ops.pop(),a.trys.pop();continue}c=t.call(e,a)}catch(e){c=[6,e],n=0}finally{r=i=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}},ed=function(){function e(){}return e.hasPermissions=function(){var e,t,r,n;return e=this,t=void 0,r=void 0,n=function(){var e,t,r;return eh(this,function(n){switch(n.label){case 0:return[4,navigator.mediaDevices.enumerateDevices()];case 1:for(e=0,t=n.sent();e<t.length;e++)if("videoinput"===(r=t[e]).kind&&r.label)return[2,!0];return[2,!1]}})},new(r||(r=Promise))(function(i,o){function a(e){try{l(n.next(e))}catch(e){o(e)}}function s(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(a,s)}l((n=n.apply(e,t||[])).next())})},e}(),ef=function(){function e(e){this.supportedScanTypes=this.validateAndReturnScanTypes(e)}return e.prototype.getDefaultScanType=function(){return this.supportedScanTypes[0]},e.prototype.hasMoreThanOneScanType=function(){return this.supportedScanTypes.length>1},e.prototype.isCameraScanRequired=function(){for(var t=0,r=this.supportedScanTypes;t<r.length;t++){var n=r[t];if(e.isCameraScanType(n))return!0}return!1},e.isCameraScanType=function(e){return e===f.SCAN_TYPE_CAMERA},e.isFileScanType=function(e){return e===f.SCAN_TYPE_FILE},e.prototype.validateAndReturnScanTypes=function(e){if(!e||0===e.length)return C.DEFAULT_SUPPORTED_SCAN_TYPE;var t=C.DEFAULT_SUPPORTED_SCAN_TYPE.length;if(e.length>t)throw"Max ".concat(t," values expected for ")+"supportedScanTypes";for(var r=0;r<e.length;r++){var n=e[r];if(!C.DEFAULT_SUPPORTED_SCAN_TYPE.includes(n))throw"Unsupported scan type ".concat(n)}return e},e}(),eg=function(){function e(){}return e.ALL_ELEMENT_CLASS="html5-qrcode-element",e.CAMERA_PERMISSION_BUTTON_ID="html5-qrcode-button-camera-permission",e.CAMERA_START_BUTTON_ID="html5-qrcode-button-camera-start",e.CAMERA_STOP_BUTTON_ID="html5-qrcode-button-camera-stop",e.TORCH_BUTTON_ID="html5-qrcode-button-torch",e.CAMERA_SELECTION_SELECT_ID="html5-qrcode-select-camera",e.FILE_SELECTION_BUTTON_ID="html5-qrcode-button-file-selection",e.ZOOM_SLIDER_ID="html5-qrcode-input-range-zoom",e.SCAN_TYPE_CHANGE_ANCHOR_ID="html5-qrcode-anchor-scan-type-change",e.TORCH_BUTTON_CLASS_TORCH_ON="html5-qrcode-button-torch-on",e.TORCH_BUTTON_CLASS_TORCH_OFF="html5-qrcode-button-torch-off",e}(),ep=function(){function e(){}return e.createElement=function(e,t){var r=document.createElement(e);return r.id=t,r.classList.add(eg.ALL_ELEMENT_CLASS),"button"===e&&r.setAttribute("type","button"),r},e}(),em=function(e,t,r,n){return new(r||(r=Promise))(function(i,o){function a(e){try{l(n.next(e))}catch(e){o(e)}}function s(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(a,s)}l((n=n.apply(e,t||[])).next())})},ew=function(e,t){var r,n,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(s){return function(l){var c=[s,l];if(r)throw TypeError("Generator is already executing.");for(;o&&(o=0,c[0]&&(a=0)),a;)try{if(r=1,n&&(i=2&c[0]?n.return:c[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,c[1])).done)return i;switch(n=0,i&&(c=[2&c[0],i.value]),c[0]){case 0:case 1:i=c;break;case 4:return a.label++,{value:c[1],done:!1};case 5:a.label++,n=c[1],c=[0];continue;case 7:c=a.ops.pop(),a.trys.pop();continue;default:if(!(i=(i=a.trys).length>0&&i[i.length-1])&&(6===c[0]||2===c[0])){a=0;continue}if(3===c[0]&&(!i||c[1]>i[0]&&c[1]<i[3])){a.label=c[1];break}if(6===c[0]&&a.label<i[1]){a.label=i[1],i=c;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(c);break}i[2]&&a.ops.pop(),a.trys.pop();continue}c=t.call(e,a)}catch(e){c=[6,e],n=0}finally{r=i=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}},eC=function(){function e(e,t,r){this.isTorchOn=!1,this.torchCapability=e,this.buttonController=t,this.onTorchActionFailureCallback=r}return e.prototype.isTorchEnabled=function(){return this.isTorchOn},e.prototype.flipState=function(){return em(this,void 0,void 0,function(){var e,t;return ew(this,function(r){switch(r.label){case 0:this.buttonController.disable(),e=!this.isTorchOn,r.label=1;case 1:return r.trys.push([1,3,,4]),[4,this.torchCapability.apply(e)];case 2:return r.sent(),this.updateUiBasedOnLatestSettings(this.torchCapability.value(),e),[3,4];case 3:return t=r.sent(),this.propagateFailure(e,t),this.buttonController.enable(),[3,4];case 4:return[2]}})})},e.prototype.updateUiBasedOnLatestSettings=function(e,t){e===t?(this.buttonController.setText(t?b.torchOffButton():b.torchOnButton()),this.isTorchOn=t):this.propagateFailure(t),this.buttonController.enable()},e.prototype.propagateFailure=function(e,t){var r=e?b.torchOnFailedMessage():b.torchOffFailedMessage();t&&(r+="; Error = "+t),this.onTorchActionFailureCallback(r)},e.prototype.reset=function(){this.isTorchOn=!1},e}(),eE=function(){function e(e,t){this.onTorchActionFailureCallback=t,this.torchButton=ep.createElement("button",eg.TORCH_BUTTON_ID),this.torchController=new eC(e,this,t)}return e.prototype.render=function(e,t){var r=this;this.torchButton.innerText=b.torchOnButton(),this.torchButton.style.display=t.display,this.torchButton.style.marginLeft=t.marginLeft;var n=this;this.torchButton.addEventListener("click",function(e){return em(r,void 0,void 0,function(){return ew(this,function(e){switch(e.label){case 0:return[4,n.torchController.flipState()];case 1:return e.sent(),n.torchController.isTorchEnabled()?(n.torchButton.classList.remove(eg.TORCH_BUTTON_CLASS_TORCH_OFF),n.torchButton.classList.add(eg.TORCH_BUTTON_CLASS_TORCH_ON)):(n.torchButton.classList.remove(eg.TORCH_BUTTON_CLASS_TORCH_ON),n.torchButton.classList.add(eg.TORCH_BUTTON_CLASS_TORCH_OFF)),[2]}})})}),e.appendChild(this.torchButton)},e.prototype.updateTorchCapability=function(e){this.torchController=new eC(e,this,this.onTorchActionFailureCallback)},e.prototype.getTorchButton=function(){return this.torchButton},e.prototype.hide=function(){this.torchButton.style.display="none"},e.prototype.show=function(){this.torchButton.style.display="inline-block"},e.prototype.disable=function(){this.torchButton.disabled=!0},e.prototype.enable=function(){this.torchButton.disabled=!1},e.prototype.setText=function(e){this.torchButton.innerText=e},e.prototype.reset=function(){this.torchButton.innerText=b.torchOnButton(),this.torchController.reset()},e.create=function(t,r,n,i){var o=new e(r,i);return o.render(t,n),o},e}(),eA=function(){function e(e,t,r){this.fileBasedScanRegion=this.createFileBasedScanRegion(),this.fileBasedScanRegion.style.display=t?"block":"none",e.appendChild(this.fileBasedScanRegion);var n=document.createElement("label");n.setAttribute("for",this.getFileScanInputId()),n.style.display="inline-block",this.fileBasedScanRegion.appendChild(n),this.fileSelectionButton=ep.createElement("button",eg.FILE_SELECTION_BUTTON_ID),this.setInitialValueToButton(),this.fileSelectionButton.addEventListener("click",function(e){n.click()}),n.append(this.fileSelectionButton),this.fileScanInput=ep.createElement("input",this.getFileScanInputId()),this.fileScanInput.type="file",this.fileScanInput.accept="image/*",this.fileScanInput.style.display="none",n.appendChild(this.fileScanInput);var i=this;this.fileScanInput.addEventListener("change",function(e){if(null!=e&&null!=e.target){var t=e.target;if(!t.files||0!==t.files.length){var n=t.files[0],o=n.name;i.setImageNameToButton(o),r(n)}}});var o=this.createDragAndDropMessage();this.fileBasedScanRegion.appendChild(o),this.fileBasedScanRegion.addEventListener("dragenter",function(e){i.fileBasedScanRegion.style.border=i.fileBasedScanRegionActiveBorder(),e.stopPropagation(),e.preventDefault()}),this.fileBasedScanRegion.addEventListener("dragleave",function(e){i.fileBasedScanRegion.style.border=i.fileBasedScanRegionDefaultBorder(),e.stopPropagation(),e.preventDefault()}),this.fileBasedScanRegion.addEventListener("dragover",function(e){i.fileBasedScanRegion.style.border=i.fileBasedScanRegionActiveBorder(),e.stopPropagation(),e.preventDefault()}),this.fileBasedScanRegion.addEventListener("drop",function(e){e.stopPropagation(),e.preventDefault(),i.fileBasedScanRegion.style.border=i.fileBasedScanRegionDefaultBorder();var t=e.dataTransfer;if(t){var n=t.files;if(!n||0===n.length)return;for(var a=!1,s=0;s<n.length;++s){var l=n.item(s);if(l){var c=/image.*/;if(l.type.match(c)){a=!0;var u=l.name;i.setImageNameToButton(u),r(l),o.innerText=b.dragAndDropMessage();break}}}a||(o.innerText=b.dragAndDropMessageOnlyImages())}})}return e.prototype.hide=function(){this.fileBasedScanRegion.style.display="none",this.fileScanInput.disabled=!0},e.prototype.show=function(){this.fileBasedScanRegion.style.display="block",this.fileScanInput.disabled=!1},e.prototype.isShowing=function(){return"block"===this.fileBasedScanRegion.style.display},e.prototype.resetValue=function(){this.fileScanInput.value="",this.setInitialValueToButton()},e.prototype.createFileBasedScanRegion=function(){var e=document.createElement("div");return e.style.textAlign="center",e.style.margin="auto",e.style.width="80%",e.style.maxWidth="600px",e.style.border=this.fileBasedScanRegionDefaultBorder(),e.style.padding="10px",e.style.marginBottom="10px",e},e.prototype.fileBasedScanRegionDefaultBorder=function(){return"6px dashed #ebebeb"},e.prototype.fileBasedScanRegionActiveBorder=function(){return"6px dashed rgb(153 151 151)"},e.prototype.createDragAndDropMessage=function(){var e=document.createElement("div");return e.innerText=b.dragAndDropMessage(),e.style.fontWeight="400",e},e.prototype.setImageNameToButton=function(e){if(e.length>20){var t=e.substring(0,8),r=e.length,n=e.substring(r-8,r);e="".concat(t,"....").concat(n)}var i=b.fileSelectionChooseAnother()+" - "+e;this.fileSelectionButton.innerText=i},e.prototype.setInitialValueToButton=function(){var e=b.fileSelectionChooseImage()+" - "+b.fileSelectionNoImageSelected();this.fileSelectionButton.innerText=e},e.prototype.getFileScanInputId=function(){return"html5-qrcode-private-filescan-input"},e.create=function(t,r,n){return new e(t,r,n)},e}(),ey=function(){function e(e){this.selectElement=ep.createElement("select",eg.CAMERA_SELECTION_SELECT_ID),this.cameras=e,this.options=[]}return e.prototype.render=function(e){var t=document.createElement("span");t.style.marginRight="10px";var r=this.cameras.length;if(0===r)throw Error("No cameras found");if(1===r)t.style.display="none";else{var n=b.selectCamera();t.innerText="".concat(n," (").concat(this.cameras.length,") ")}for(var i=1,o=0,a=this.cameras;o<a.length;o++){var s=a[o],l=s.id,c=null==s.label?l:s.label;c&&""!==c||(c=[b.anonymousCameraPrefix(),i++].join(" "));var u=document.createElement("option");u.value=l,u.innerText=c,this.options.push(u),this.selectElement.appendChild(u)}t.appendChild(this.selectElement),e.appendChild(t)},e.prototype.disable=function(){this.selectElement.disabled=!0},e.prototype.isDisabled=function(){return!0===this.selectElement.disabled},e.prototype.enable=function(){this.selectElement.disabled=!1},e.prototype.getValue=function(){return this.selectElement.value},e.prototype.hasValue=function(e){for(var t=0,r=this.options;t<r.length;t++)if(r[t].value===e)return!0;return!1},e.prototype.setValue=function(e){if(!this.hasValue(e))throw Error("".concat(e," is not present in the camera list."));this.selectElement.value=e},e.prototype.hasSingleItem=function(){return 1===this.cameras.length},e.prototype.numCameras=function(){return this.cameras.length},e.create=function(t,r){var n=new e(r);return n.render(t),n},e}(),eI=function(){function e(){this.onChangeCallback=null,this.zoomElementContainer=document.createElement("div"),this.rangeInput=ep.createElement("input",eg.ZOOM_SLIDER_ID),this.rangeInput.type="range",this.rangeText=document.createElement("span"),this.rangeInput.min="1",this.rangeInput.max="5",this.rangeInput.value="1",this.rangeInput.step="0.1"}return e.prototype.render=function(e,t){this.zoomElementContainer.style.display=t?"block":"none",this.zoomElementContainer.style.padding="5px 10px",this.zoomElementContainer.style.textAlign="center",e.appendChild(this.zoomElementContainer),this.rangeInput.style.display="inline-block",this.rangeInput.style.width="50%",this.rangeInput.style.height="5px",this.rangeInput.style.background="#d3d3d3",this.rangeInput.style.outline="none",this.rangeInput.style.opacity="0.7";var r=b.zoom();this.rangeText.innerText="".concat(this.rangeInput.value,"x ").concat(r),this.rangeText.style.marginRight="10px";var n=this;this.rangeInput.addEventListener("input",function(){return n.onValueChange()}),this.rangeInput.addEventListener("change",function(){return n.onValueChange()}),this.zoomElementContainer.appendChild(this.rangeInput),this.zoomElementContainer.appendChild(this.rangeText)},e.prototype.onValueChange=function(){var e=b.zoom();this.rangeText.innerText="".concat(this.rangeInput.value,"x ").concat(e),this.onChangeCallback&&this.onChangeCallback(parseFloat(this.rangeInput.value))},e.prototype.setValues=function(e,t,r,n){this.rangeInput.min=e.toString(),this.rangeInput.max=t.toString(),this.rangeInput.step=n.toString(),this.rangeInput.value=r.toString(),this.onValueChange()},e.prototype.show=function(){this.zoomElementContainer.style.display="block"},e.prototype.hide=function(){this.zoomElementContainer.style.display="none"},e.prototype.setOnCameraZoomValueChangeCallback=function(e){this.onChangeCallback=e},e.prototype.removeOnCameraZoomValueChangeCallback=function(){this.onChangeCallback=null},e.create=function(t,r){var n=new e;return n.render(t,r),n},e}();function eS(e,t,r){if(this.lastMatchFound=null,this.cameraScanImage=null,this.fileScanImage=null,this.fileSelectionUi=null,this.elementId=e,this.config=this.createConfig(t),this.verbose=!0===r,!document.getElementById(e))throw"HTML Element with id=".concat(e," not found");this.scanTypeSelector=new ef(this.config.supportedScanTypes),this.currentScanType=this.scanTypeSelector.getDefaultScanType(),this.sectionSwapAllowed=!0,this.logger=new I(this.verbose),this.persistedDataManager=new es,!0!==t.rememberLastUsedCamera&&this.persistedDataManager.reset()}(c=m||(m={}))[c.STATUS_DEFAULT=0]="STATUS_DEFAULT",c[c.STATUS_SUCCESS=1]="STATUS_SUCCESS",c[c.STATUS_WARNING=2]="STATUS_WARNING",c[c.STATUS_REQUESTING_PERMISSION=3]="STATUS_REQUESTING_PERMISSION",eS.prototype.render=function(e,t){var r,n,i=this;this.lastMatchFound=null,this.qrCodeSuccessCallback=function(t,r){if(e)e(t,r);else{if(i.lastMatchFound===t)return;i.lastMatchFound=t,i.setHeaderMessage(b.lastMatch(t),m.STATUS_SUCCESS)}},this.qrCodeErrorCallback=function(e,r){t&&t(e,r)};var o=document.getElementById(this.elementId);if(!o)throw"HTML Element with id=".concat(this.elementId," not found");o.innerHTML="",this.createBasicLayout(o),this.html5Qrcode=new et(this.getScanRegionId(),(r=this.config,n=this.verbose,{formatsToSupport:r.formatsToSupport,useBarCodeDetectorIfSupported:r.useBarCodeDetectorIfSupported,experimentalFeatures:r.experimentalFeatures,verbose:n}))},eS.prototype.pause=function(e){(S(e)||!0!==e)&&(e=!1),this.getHtml5QrcodeOrFail().pause(e)},eS.prototype.resume=function(){this.getHtml5QrcodeOrFail().resume()},eS.prototype.getState=function(){return this.getHtml5QrcodeOrFail().getState()},eS.prototype.clear=function(){var e=this,t=function(){var t=document.getElementById(e.elementId);t&&(t.innerHTML="",e.resetBasicLayout(t))};return this.html5Qrcode?new Promise(function(r,n){if(!e.html5Qrcode)return void r();e.html5Qrcode.isScanning?e.html5Qrcode.stop().then(function(n){if(!e.html5Qrcode)return void r();e.html5Qrcode.clear(),t(),r()}).catch(function(t){e.verbose&&e.logger.logError("Unable to stop qrcode scanner",t),n(t)}):(e.html5Qrcode.clear(),t(),r())}):Promise.resolve()},eS.prototype.getRunningTrackCapabilities=function(){return this.getHtml5QrcodeOrFail().getRunningTrackCapabilities()},eS.prototype.getRunningTrackSettings=function(){return this.getHtml5QrcodeOrFail().getRunningTrackSettings()},eS.prototype.applyVideoConstraints=function(e){return this.getHtml5QrcodeOrFail().applyVideoConstraints(e)},eS.prototype.getHtml5QrcodeOrFail=function(){if(!this.html5Qrcode)throw"Code scanner not initialized.";return this.html5Qrcode},eS.prototype.createConfig=function(e){return e?(e.fps||(e.fps=C.SCAN_DEFAULT_FPS),!C.DEFAULT_REMEMBER_LAST_CAMERA_USED!==e.rememberLastUsedCamera&&(e.rememberLastUsedCamera=C.DEFAULT_REMEMBER_LAST_CAMERA_USED),e.supportedScanTypes||(e.supportedScanTypes=C.DEFAULT_SUPPORTED_SCAN_TYPE),e):{fps:C.SCAN_DEFAULT_FPS,rememberLastUsedCamera:C.DEFAULT_REMEMBER_LAST_CAMERA_USED,supportedScanTypes:C.DEFAULT_SUPPORTED_SCAN_TYPE}},eS.prototype.createBasicLayout=function(e){e.style.position="relative",e.style.padding="0px",e.style.border="1px solid silver",this.createHeader(e);var t=document.createElement("div");t.id=this.getScanRegionId(),t.style.width="100%",t.style.minHeight="100px",t.style.textAlign="center",e.appendChild(t),ef.isCameraScanType(this.currentScanType)?this.insertCameraScanImageToScanRegion():this.insertFileScanImageToScanRegion();var r=document.createElement("div");r.id=this.getDashboardId(),r.style.width="100%",e.appendChild(r),this.setupInitialDashboard(r)},eS.prototype.resetBasicLayout=function(e){e.style.border="none"},eS.prototype.setupInitialDashboard=function(e){this.createSection(e),this.createSectionControlPanel(),this.scanTypeSelector.hasMoreThanOneScanType()&&this.createSectionSwap()},eS.prototype.createHeader=function(e){var t=document.createElement("div");t.style.textAlign="left",t.style.margin="0px",e.appendChild(t),new eu().renderInto(t);var r=document.createElement("div");r.id=this.getHeaderMessageContainerId(),r.style.display="none",r.style.textAlign="center",r.style.fontSize="14px",r.style.padding="2px 10px",r.style.margin="4px",r.style.borderTop="1px solid #f6f6f6",t.appendChild(r)},eS.prototype.createSection=function(e){var t=document.createElement("div");t.id=this.getDashboardSectionId(),t.style.width="100%",t.style.padding="10px 0px 10px 0px",t.style.textAlign="left",e.appendChild(t)},eS.prototype.createCameraListUi=function(e,t,r){var n=this;n.showHideScanTypeSwapLink(!1),n.setHeaderMessage(b.cameraPermissionRequesting());var i=function(){r||n.createPermissionButton(e,t)};et.getCameras().then(function(r){n.persistedDataManager.setHasPermission(!0),n.showHideScanTypeSwapLink(!0),n.resetHeaderMessage(),r&&r.length>0?(e.removeChild(t),n.renderCameraSelection(r)):(n.setHeaderMessage(b.noCameraFound(),m.STATUS_WARNING),i())}).catch(function(e){n.persistedDataManager.setHasPermission(!1),r?r.disabled=!1:i(),n.setHeaderMessage(e,m.STATUS_WARNING),n.showHideScanTypeSwapLink(!0)})},eS.prototype.createPermissionButton=function(e,t){var r=this,n=ep.createElement("button",this.getCameraPermissionButtonId());n.innerText=b.cameraPermissionTitle(),n.addEventListener("click",function(){n.disabled=!0,r.createCameraListUi(e,t,n)}),t.appendChild(n)},eS.prototype.createPermissionsUi=function(e,t){var r=this;if(ef.isCameraScanType(this.currentScanType)&&this.persistedDataManager.hasCameraPermissions())return void ed.hasPermissions().then(function(n){n?r.createCameraListUi(e,t):(r.persistedDataManager.setHasPermission(!1),r.createPermissionButton(e,t))}).catch(function(n){r.persistedDataManager.setHasPermission(!1),r.createPermissionButton(e,t)});this.createPermissionButton(e,t)},eS.prototype.createSectionControlPanel=function(){var e=document.getElementById(this.getDashboardSectionId()),t=document.createElement("div");e.appendChild(t);var r=document.createElement("div");r.id=this.getDashboardSectionCameraScanRegionId(),r.style.display=ef.isCameraScanType(this.currentScanType)?"block":"none",t.appendChild(r);var n=document.createElement("div");n.style.textAlign="center",r.appendChild(n),this.scanTypeSelector.isCameraScanRequired()&&this.createPermissionsUi(r,n),this.renderFileScanUi(t)},eS.prototype.renderFileScanUi=function(e){var t=ef.isFileScanType(this.currentScanType),r=this;this.fileSelectionUi=eA.create(e,t,function(e){if(!r.html5Qrcode)throw"html5Qrcode not defined";ef.isFileScanType(r.currentScanType)&&(r.setHeaderMessage(b.loadingImage()),r.html5Qrcode.scanFileV2(e,!0).then(function(e){r.resetHeaderMessage(),r.qrCodeSuccessCallback(e.decodedText,e)}).catch(function(e){r.setHeaderMessage(e,m.STATUS_WARNING),r.qrCodeErrorCallback(e,y.createFrom(e))}))})},eS.prototype.renderCameraSelection=function(e){var t,r=this,n=this,i=document.getElementById(this.getDashboardSectionCameraScanRegionId());i.style.textAlign="center";var o=eI.create(i,!1),a=function(e){var t=e.zoomFeature();if(t.isSupported()){o.setOnCameraZoomValueChangeCallback(function(e){t.apply(e)});var n,i,a,s=1;r.config.defaultZoomValueIfSupported&&(s=r.config.defaultZoomValueIfSupported),n=s,i=t.min(),s=n>(a=t.max())?a:n<i?i:n,o.setValues(t.min(),t.max(),s,t.step()),o.show()}},s=ey.create(i,e),l=document.createElement("span"),c=ep.createElement("button",eg.CAMERA_START_BUTTON_ID);c.innerText=b.scanButtonStartScanningText(),l.appendChild(c);var u=ep.createElement("button",eg.CAMERA_STOP_BUTTON_ID);u.innerText=b.scanButtonStopScanningText(),u.style.display="none",u.disabled=!0,l.appendChild(u);var h=function(e){if(!e.torchFeature().isSupported()){t&&t.hide();return}t?t.updateTorchCapability(e.torchFeature()):t=eE.create(l,e.torchFeature(),{display:"none",marginLeft:"5px"},function(e){n.setHeaderMessage(e,m.STATUS_WARNING)}),t.show()};i.appendChild(l);var d=function(e){e||(c.style.display="none"),c.innerText=b.scanButtonStartScanningText(),c.style.opacity="1",c.disabled=!1,e&&(c.style.display="inline-block")};if(c.addEventListener("click",function(e){c.innerText=b.scanButtonScanningStarting(),s.disable(),c.disabled=!0,c.style.opacity="0.5",r.scanTypeSelector.hasMoreThanOneScanType()&&n.showHideScanTypeSwapLink(!1),n.resetHeaderMessage();var t,i=s.getValue();n.persistedDataManager.setLastUsedCameraId(i),n.html5Qrcode.start(i,{fps:(t=n.config).fps,qrbox:t.qrbox,aspectRatio:t.aspectRatio,disableFlip:t.disableFlip,videoConstraints:t.videoConstraints},n.qrCodeSuccessCallback,n.qrCodeErrorCallback).then(function(e){u.disabled=!1,u.style.display="inline-block",d(!1);var t=n.html5Qrcode.getRunningTrackCameraCapabilities();!0===r.config.showTorchButtonIfSupported&&h(t),!0===r.config.showZoomSliderIfSupported&&a(t)}).catch(function(e){n.showHideScanTypeSwapLink(!0),s.enable(),d(!0),n.setHeaderMessage(e,m.STATUS_WARNING)})}),s.hasSingleItem()&&c.click(),u.addEventListener("click",function(e){if(!n.html5Qrcode)throw"html5Qrcode not defined";u.disabled=!0,n.html5Qrcode.stop().then(function(e){r.scanTypeSelector.hasMoreThanOneScanType()&&n.showHideScanTypeSwapLink(!0),s.enable(),c.disabled=!1,u.style.display="none",c.style.display="inline-block",t&&(t.reset(),t.hide()),o.removeOnCameraZoomValueChangeCallback(),o.hide(),n.insertCameraScanImageToScanRegion()}).catch(function(e){u.disabled=!1,n.setHeaderMessage(e,m.STATUS_WARNING)})}),n.persistedDataManager.getLastUsedCameraId()){var f=n.persistedDataManager.getLastUsedCameraId();s.hasValue(f)?(s.setValue(f),c.click()):n.persistedDataManager.resetLastUsedCameraId()}},eS.prototype.createSectionSwap=function(){var e=this,t=b.textIfCameraScanSelected(),r=b.textIfFileScanSelected(),n=document.getElementById(this.getDashboardSectionId()),i=document.createElement("div");i.style.textAlign="center";var o=ep.createElement("span",this.getDashboardSectionSwapLinkId());o.style.textDecoration="underline",o.style.cursor="pointer",o.innerText=ef.isCameraScanType(this.currentScanType)?t:r,o.addEventListener("click",function(){if(!e.sectionSwapAllowed){e.verbose&&e.logger.logError("Section swap called when not allowed");return}e.resetHeaderMessage(),e.fileSelectionUi.resetValue(),e.sectionSwapAllowed=!1,ef.isCameraScanType(e.currentScanType)?(e.clearScanRegion(),e.getCameraScanRegion().style.display="none",e.fileSelectionUi.show(),o.innerText=r,e.currentScanType=f.SCAN_TYPE_FILE,e.insertFileScanImageToScanRegion()):(e.clearScanRegion(),e.getCameraScanRegion().style.display="block",e.fileSelectionUi.hide(),o.innerText=t,e.currentScanType=f.SCAN_TYPE_CAMERA,e.insertCameraScanImageToScanRegion(),e.startCameraScanIfPermissionExistsOnSwap()),e.sectionSwapAllowed=!0}),i.appendChild(o),n.appendChild(i)},eS.prototype.startCameraScanIfPermissionExistsOnSwap=function(){var e=this,t=this;if(this.persistedDataManager.hasCameraPermissions())return void ed.hasPermissions().then(function(r){if(r){var n=document.getElementById(t.getCameraPermissionButtonId());if(!n)throw e.logger.logError("Permission button not found, fail;"),"Permission button not found";n.click()}else t.persistedDataManager.setHasPermission(!1)}).catch(function(e){t.persistedDataManager.setHasPermission(!1)})},eS.prototype.resetHeaderMessage=function(){document.getElementById(this.getHeaderMessageContainerId()).style.display="none"},eS.prototype.setHeaderMessage=function(e,t){t||(t=m.STATUS_DEFAULT);var r=this.getHeaderMessageDiv();switch(r.innerText=e,r.style.display="block",t){case m.STATUS_SUCCESS:r.style.background="rgba(106, 175, 80, 0.26)",r.style.color="#477735";break;case m.STATUS_WARNING:r.style.background="rgba(203, 36, 49, 0.14)",r.style.color="#cb2431";break;case m.STATUS_DEFAULT:default:r.style.background="rgba(0, 0, 0, 0)",r.style.color="rgb(17, 17, 17)"}},eS.prototype.showHideScanTypeSwapLink=function(e){this.scanTypeSelector.hasMoreThanOneScanType()&&(!0!==e&&(e=!1),this.sectionSwapAllowed=e,this.getDashboardSectionSwapLink().style.display=e?"inline-block":"none")},eS.prototype.insertCameraScanImageToScanRegion=function(){var e=this,t=document.getElementById(this.getScanRegionId());if(this.cameraScanImage){t.innerHTML="<br>",t.appendChild(this.cameraScanImage);return}this.cameraScanImage=new Image,this.cameraScanImage.onload=function(r){t.innerHTML="<br>",t.appendChild(e.cameraScanImage)},this.cameraScanImage.width=64,this.cameraScanImage.style.opacity="0.8",this.cameraScanImage.src=en,this.cameraScanImage.alt=b.cameraScanAltText()},eS.prototype.insertFileScanImageToScanRegion=function(){var e=this,t=document.getElementById(this.getScanRegionId());if(this.fileScanImage){t.innerHTML="<br>",t.appendChild(this.fileScanImage);return}this.fileScanImage=new Image,this.fileScanImage.onload=function(r){t.innerHTML="<br>",t.appendChild(e.fileScanImage)},this.fileScanImage.width=64,this.fileScanImage.style.opacity="0.8",this.fileScanImage.src=ei,this.fileScanImage.alt=b.fileScanAltText()},eS.prototype.clearScanRegion=function(){document.getElementById(this.getScanRegionId()).innerHTML=""},eS.prototype.getDashboardSectionId=function(){return"".concat(this.elementId,"__dashboard_section")},eS.prototype.getDashboardSectionCameraScanRegionId=function(){return"".concat(this.elementId,"__dashboard_section_csr")},eS.prototype.getDashboardSectionSwapLinkId=function(){return eg.SCAN_TYPE_CHANGE_ANCHOR_ID},eS.prototype.getScanRegionId=function(){return"".concat(this.elementId,"__scan_region")},eS.prototype.getDashboardId=function(){return"".concat(this.elementId,"__dashboard")},eS.prototype.getHeaderMessageContainerId=function(){return"".concat(this.elementId,"__header_message")},eS.prototype.getCameraPermissionButtonId=function(){return eg.CAMERA_PERMISSION_BUTTON_ID},eS.prototype.getCameraScanRegion=function(){return document.getElementById(this.getDashboardSectionCameraScanRegionId())},eS.prototype.getDashboardSectionSwapLink=function(){return document.getElementById(this.getDashboardSectionSwapLinkId())},eS.prototype.getHeaderMessageDiv=function(){return document.getElementById(this.getHeaderMessageContainerId())}},103:function(e,t,r){(function(e){"use strict";let t;var n,i,o,a,s,l,c,u,h,d,f,g,p,m,w,C,E,A,y,I,S,_,b=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])},T=function(e){function t(){this.constructor=r}function r(t){var r,n,i,o,a=this.constructor,s=e.call(this,t)||this;return Object.defineProperty(s,"name",{value:a.name,enumerable:!1}),r=a.prototype,(n=Object.setPrototypeOf)?n(s,r):s.__proto__=r,void 0===i&&(i=s.constructor),(o=Error.captureStackTrace)&&o(s,i),s}return b(r,e),r.prototype=null===e?Object.create(e):(t.prototype=e.prototype,new t),r}(Error);class N extends T{constructor(e){super(e),this.message=e}getKind(){return this.constructor.kind}}N.kind="Exception";class M extends N{}M.kind="ArgumentException";class D extends N{}D.kind="IllegalArgumentException";class O{constructor(e){if(this.binarizer=e,null===e)throw new D("Binarizer must be non-null.")}getWidth(){return this.binarizer.getWidth()}getHeight(){return this.binarizer.getHeight()}getBlackRow(e,t){return this.binarizer.getBlackRow(e,t)}getBlackMatrix(){return(null===this.matrix||void 0===this.matrix)&&(this.matrix=this.binarizer.getBlackMatrix()),this.matrix}isCropSupported(){return this.binarizer.getLuminanceSource().isCropSupported()}crop(e,t,r,n){let i=this.binarizer.getLuminanceSource().crop(e,t,r,n);return new O(this.binarizer.createBinarizer(i))}isRotateSupported(){return this.binarizer.getLuminanceSource().isRotateSupported()}rotateCounterClockwise(){let e=this.binarizer.getLuminanceSource().rotateCounterClockwise();return new O(this.binarizer.createBinarizer(e))}rotateCounterClockwise45(){let e=this.binarizer.getLuminanceSource().rotateCounterClockwise45();return new O(this.binarizer.createBinarizer(e))}toString(){try{return this.getBlackMatrix().toString()}catch(e){return""}}}class R extends N{static getChecksumInstance(){return new R}}R.kind="ChecksumException";class v{constructor(e){this.source=e}getLuminanceSource(){return this.source}getWidth(){return this.source.getWidth()}getHeight(){return this.source.getHeight()}}class P{static arraycopy(e,t,r,n,i){for(;i--;)r[n++]=e[t++]}static currentTimeMillis(){return Date.now()}}class B extends N{}B.kind="IndexOutOfBoundsException";class x extends B{constructor(e,t){super(t),this.index=e,this.message=t}}x.kind="ArrayIndexOutOfBoundsException";class L{static fill(e,t){for(let r=0,n=e.length;r<n;r++)e[r]=t}static fillWithin(e,t,r,n){L.rangeCheck(e.length,t,r);for(let i=t;i<r;i++)e[i]=n}static rangeCheck(e,t,r){if(t>r)throw new D("fromIndex("+t+") > toIndex("+r+")");if(t<0)throw new x(t);if(r>e)throw new x(r)}static asList(...e){return e}static create(e,t,r){return Array.from({length:e}).map(e=>Array.from({length:t}).fill(r))}static createInt32Array(e,t,r){return Array.from({length:e}).map(e=>Int32Array.from({length:t}).fill(r))}static equals(e,t){if(!e||!t||!e.length||!t.length||e.length!==t.length)return!1;for(let r=0,n=e.length;r<n;r++)if(e[r]!==t[r])return!1;return!0}static hashCode(e){if(null===e)return 0;let t=1;for(let r of e)t=31*t+r;return t}static fillUint8Array(e,t){for(let r=0;r!==e.length;r++)e[r]=t}static copyOf(e,t){return e.slice(0,t)}static copyOfUint8Array(e,t){if(e.length<=t){let r=new Uint8Array(t);return r.set(e),r}return e.slice(0,t)}static copyOfRange(e,t,r){let n=r-t,i=new Int32Array(n);return P.arraycopy(e,t,i,0,n),i}static binarySearch(e,t,r){void 0===r&&(r=L.numberComparator);let n=0,i=e.length-1;for(;n<=i;){let o=i+n>>1,a=r(t,e[o]);if(a>0)n=o+1;else{if(!(a<0))return o;i=o-1}}return-n-1}static numberComparator(e,t){return e-t}}class k{static numberOfTrailingZeros(e){let t;if(0===e)return 32;let r=31;return 0!=(t=e<<16)&&(r-=16,e=t),0!=(t=e<<8)&&(r-=8,e=t),0!=(t=e<<4)&&(r-=4,e=t),0!=(t=e<<2)&&(r-=2,e=t),r-(e<<1>>>31)}static numberOfLeadingZeros(e){if(0===e)return 32;let t=1;return e>>>16==0&&(t+=16,e<<=16),e>>>24==0&&(t+=8,e<<=8),e>>>28==0&&(t+=4,e<<=4),e>>>30==0&&(t+=2,e<<=2),t-=e>>>31}static toHexString(e){return e.toString(16)}static toBinaryString(e){return String(parseInt(String(e),2))}static bitCount(e){return e-=e>>>1&0x55555555,e=(e=(0x33333333&e)+(e>>>2&0x33333333))+(e>>>4)&0xf0f0f0f,e+=e>>>8,63&(e+=e>>>16)}static truncDivision(e,t){return Math.trunc(e/t)}static parseInt(e,t){return parseInt(e,t)}}k.MIN_VALUE_32_BITS=-0x80000000,k.MAX_VALUE=Number.MAX_SAFE_INTEGER;class F{constructor(e,t){void 0===e?(this.size=0,this.bits=new Int32Array(1)):(this.size=e,null==t?this.bits=F.makeArray(e):this.bits=t)}getSize(){return this.size}getSizeInBytes(){return Math.floor((this.size+7)/8)}ensureCapacity(e){if(e>32*this.bits.length){let t=F.makeArray(e);P.arraycopy(this.bits,0,t,0,this.bits.length),this.bits=t}}get(e){return(this.bits[Math.floor(e/32)]&1<<(31&e))!=0}set(e){this.bits[Math.floor(e/32)]|=1<<(31&e)}flip(e){this.bits[Math.floor(e/32)]^=1<<(31&e)}getNextSet(e){let t=this.size;if(e>=t)return t;let r=this.bits,n=Math.floor(e/32),i=r[n];i&=~((1<<(31&e))-1);let o=r.length;for(;0===i;){if(++n===o)return t;i=r[n]}let a=32*n+k.numberOfTrailingZeros(i);return a>t?t:a}getNextUnset(e){let t=this.size;if(e>=t)return t;let r=this.bits,n=Math.floor(e/32),i=~r[n];i&=~((1<<(31&e))-1);let o=r.length;for(;0===i;){if(++n===o)return t;i=~r[n]}let a=32*n+k.numberOfTrailingZeros(i);return a>t?t:a}setBulk(e,t){this.bits[Math.floor(e/32)]=t}setRange(e,t){if(t<e||e<0||t>this.size)throw new D;if(t===e)return;let r=Math.floor(e/32),n=Math.floor(--t/32),i=this.bits;for(let o=r;o<=n;o++){let a=o>r?0:31&e,s=(2<<(o<n?31:31&t))-(1<<a);i[o]|=s}}clear(){let e=this.bits.length,t=this.bits;for(let r=0;r<e;r++)t[r]=0}isRange(e,t,r){if(t<e||e<0||t>this.size)throw new D;if(t===e)return!0;let n=Math.floor(e/32),i=Math.floor(--t/32),o=this.bits;for(let a=n;a<=i;a++){let s=a>n?0:31&e,l=(2<<(a<i?31:31&t))-(1<<s)&0xffffffff;if((o[a]&l)!==(r?l:0))return!1}return!0}appendBit(e){this.ensureCapacity(this.size+1),e&&(this.bits[Math.floor(this.size/32)]|=1<<(31&this.size)),this.size++}appendBits(e,t){if(t<0||t>32)throw new D("Num bits must be between 0 and 32");this.ensureCapacity(this.size+t);for(let r=t;r>0;r--)this.appendBit((e>>r-1&1)==1)}appendBitArray(e){let t=e.size;this.ensureCapacity(this.size+t);for(let r=0;r<t;r++)this.appendBit(e.get(r))}xor(e){if(this.size!==e.size)throw new D("Sizes don't match");let t=this.bits;for(let r=0,n=t.length;r<n;r++)t[r]^=e.bits[r]}toBytes(e,t,r,n){for(let i=0;i<n;i++){let n=0;for(let t=0;t<8;t++)this.get(e)&&(n|=1<<7-t),e++;t[r+i]=n}}getBitArray(){return this.bits}reverse(){let e=new Int32Array(this.bits.length),t=Math.floor((this.size-1)/32),r=t+1,n=this.bits;for(let i=0;i<r;i++){let r=n[i];r=(r=(r=(r=(r=r>>1&0x55555555|(0x55555555&r)<<1)>>2&0x33333333|(0x33333333&r)<<2)>>4&0xf0f0f0f|(0xf0f0f0f&r)<<4)>>8&0xff00ff|(0xff00ff&r)<<8)>>16&65535|(65535&r)<<16,e[t-i]=r}if(this.size!==32*r){let t=32*r-this.size,n=e[0]>>>t;for(let i=1;i<r;i++){let r=e[i];n|=r<<32-t,e[i-1]=n,n=r>>>t}e[r-1]=n}this.bits=e}static makeArray(e){return new Int32Array(Math.floor((e+31)/32))}equals(e){return e instanceof F&&this.size===e.size&&L.equals(this.bits,e.bits)}hashCode(){return 31*this.size+L.hashCode(this.bits)}toString(){let e="";for(let t=0,r=this.size;t<r;t++)(7&t)==0&&(e+=" "),e+=this.get(t)?"X":".";return e}clone(){return new F(this.size,this.bits.slice())}}(n=g||(g={}))[n.OTHER=0]="OTHER",n[n.PURE_BARCODE=1]="PURE_BARCODE",n[n.POSSIBLE_FORMATS=2]="POSSIBLE_FORMATS",n[n.TRY_HARDER=3]="TRY_HARDER",n[n.CHARACTER_SET=4]="CHARACTER_SET",n[n.ALLOWED_LENGTHS=5]="ALLOWED_LENGTHS",n[n.ASSUME_CODE_39_CHECK_DIGIT=6]="ASSUME_CODE_39_CHECK_DIGIT",n[n.ASSUME_GS1=7]="ASSUME_GS1",n[n.RETURN_CODABAR_START_END=8]="RETURN_CODABAR_START_END",n[n.NEED_RESULT_POINT_CALLBACK=9]="NEED_RESULT_POINT_CALLBACK",n[n.ALLOWED_EAN_EXTENSIONS=10]="ALLOWED_EAN_EXTENSIONS";var U=g;class H extends N{static getFormatInstance(){return new H}}H.kind="FormatException",(i=p||(p={}))[i.Cp437=0]="Cp437",i[i.ISO8859_1=1]="ISO8859_1",i[i.ISO8859_2=2]="ISO8859_2",i[i.ISO8859_3=3]="ISO8859_3",i[i.ISO8859_4=4]="ISO8859_4",i[i.ISO8859_5=5]="ISO8859_5",i[i.ISO8859_6=6]="ISO8859_6",i[i.ISO8859_7=7]="ISO8859_7",i[i.ISO8859_8=8]="ISO8859_8",i[i.ISO8859_9=9]="ISO8859_9",i[i.ISO8859_10=10]="ISO8859_10",i[i.ISO8859_11=11]="ISO8859_11",i[i.ISO8859_13=12]="ISO8859_13",i[i.ISO8859_14=13]="ISO8859_14",i[i.ISO8859_15=14]="ISO8859_15",i[i.ISO8859_16=15]="ISO8859_16",i[i.SJIS=16]="SJIS",i[i.Cp1250=17]="Cp1250",i[i.Cp1251=18]="Cp1251",i[i.Cp1252=19]="Cp1252",i[i.Cp1256=20]="Cp1256",i[i.UnicodeBigUnmarked=21]="UnicodeBigUnmarked",i[i.UTF8=22]="UTF8",i[i.ASCII=23]="ASCII",i[i.Big5=24]="Big5",i[i.GB18030=25]="GB18030",i[i.EUC_KR=26]="EUC_KR";class z{constructor(e,t,r,...n){this.valueIdentifier=e,this.name=r,"number"==typeof t?this.values=Int32Array.from([t]):this.values=t,this.otherEncodingNames=n,z.VALUE_IDENTIFIER_TO_ECI.set(e,this),z.NAME_TO_ECI.set(r,this);let i=this.values;for(let e=0,t=i.length;e!==t;e++){let t=i[e];z.VALUES_TO_ECI.set(t,this)}for(let e of n)z.NAME_TO_ECI.set(e,this)}getValueIdentifier(){return this.valueIdentifier}getName(){return this.name}getValue(){return this.values[0]}static getCharacterSetECIByValue(e){if(e<0||e>=900)throw new H("incorect value");let t=z.VALUES_TO_ECI.get(e);if(void 0===t)throw new H("incorect value");return t}static getCharacterSetECIByName(e){let t=z.NAME_TO_ECI.get(e);if(void 0===t)throw new H("incorect value");return t}equals(e){return e instanceof z&&this.getName()===e.getName()}}z.VALUE_IDENTIFIER_TO_ECI=new Map,z.VALUES_TO_ECI=new Map,z.NAME_TO_ECI=new Map,z.Cp437=new z(p.Cp437,Int32Array.from([0,2]),"Cp437"),z.ISO8859_1=new z(p.ISO8859_1,Int32Array.from([1,3]),"ISO-8859-1","ISO88591","ISO8859_1"),z.ISO8859_2=new z(p.ISO8859_2,4,"ISO-8859-2","ISO88592","ISO8859_2"),z.ISO8859_3=new z(p.ISO8859_3,5,"ISO-8859-3","ISO88593","ISO8859_3"),z.ISO8859_4=new z(p.ISO8859_4,6,"ISO-8859-4","ISO88594","ISO8859_4"),z.ISO8859_5=new z(p.ISO8859_5,7,"ISO-8859-5","ISO88595","ISO8859_5"),z.ISO8859_6=new z(p.ISO8859_6,8,"ISO-8859-6","ISO88596","ISO8859_6"),z.ISO8859_7=new z(p.ISO8859_7,9,"ISO-8859-7","ISO88597","ISO8859_7"),z.ISO8859_8=new z(p.ISO8859_8,10,"ISO-8859-8","ISO88598","ISO8859_8"),z.ISO8859_9=new z(p.ISO8859_9,11,"ISO-8859-9","ISO88599","ISO8859_9"),z.ISO8859_10=new z(p.ISO8859_10,12,"ISO-8859-10","ISO885910","ISO8859_10"),z.ISO8859_11=new z(p.ISO8859_11,13,"ISO-8859-11","ISO885911","ISO8859_11"),z.ISO8859_13=new z(p.ISO8859_13,15,"ISO-8859-13","ISO885913","ISO8859_13"),z.ISO8859_14=new z(p.ISO8859_14,16,"ISO-8859-14","ISO885914","ISO8859_14"),z.ISO8859_15=new z(p.ISO8859_15,17,"ISO-8859-15","ISO885915","ISO8859_15"),z.ISO8859_16=new z(p.ISO8859_16,18,"ISO-8859-16","ISO885916","ISO8859_16"),z.SJIS=new z(p.SJIS,20,"SJIS","Shift_JIS"),z.Cp1250=new z(p.Cp1250,21,"Cp1250","windows-1250"),z.Cp1251=new z(p.Cp1251,22,"Cp1251","windows-1251"),z.Cp1252=new z(p.Cp1252,23,"Cp1252","windows-1252"),z.Cp1256=new z(p.Cp1256,24,"Cp1256","windows-1256"),z.UnicodeBigUnmarked=new z(p.UnicodeBigUnmarked,25,"UnicodeBigUnmarked","UTF-16BE","UnicodeBig"),z.UTF8=new z(p.UTF8,26,"UTF8","UTF-8"),z.ASCII=new z(p.ASCII,Int32Array.from([27,170]),"ASCII","US-ASCII"),z.Big5=new z(p.Big5,28,"Big5"),z.GB18030=new z(p.GB18030,29,"GB18030","GB2312","EUC_CN","GBK"),z.EUC_KR=new z(p.EUC_KR,30,"EUC_KR","EUC-KR");class V extends N{}V.kind="UnsupportedOperationException";class j{static decode(e,t){let r=this.encodingName(t);return this.customDecoder?this.customDecoder(e,r):"undefined"==typeof TextDecoder||this.shouldDecodeOnFallback(r)?this.decodeFallback(e,r):new TextDecoder(r).decode(e)}static shouldDecodeOnFallback(e){return!j.isBrowser()&&"ISO-8859-1"===e}static encode(e,t){let r=this.encodingName(t);return this.customEncoder?this.customEncoder(e,r):"undefined"==typeof TextEncoder?this.encodeFallback(e):new TextEncoder().encode(e)}static isBrowser(){return"undefined"!=typeof window&&"[object Window]"===({}).toString.call(window)}static encodingName(e){return"string"==typeof e?e:e.getName()}static encodingCharacterSet(e){return e instanceof z?e:z.getCharacterSetECIByName(e)}static decodeFallback(e,t){let r=this.encodingCharacterSet(t);if(j.isDecodeFallbackSupported(r)){let t="";for(let r=0,n=e.length;r<n;r++){let n=e[r].toString(16);n.length<2&&(n="0"+n),t+="%"+n}return decodeURIComponent(t)}if(r.equals(z.UnicodeBigUnmarked))return String.fromCharCode.apply(null,new Uint16Array(e.buffer));throw new V(`Encoding ${this.encodingName(t)} not supported by fallback.`)}static isDecodeFallbackSupported(e){return e.equals(z.UTF8)||e.equals(z.ISO8859_1)||e.equals(z.ASCII)}static encodeFallback(e){let t=btoa(unescape(encodeURIComponent(e))).split(""),r=[];for(let e=0;e<t.length;e++)r.push(t[e].charCodeAt(0));return new Uint8Array(r)}}class G{static castAsNonUtf8Char(e,t=null){let r=t?t.getName():this.ISO88591;return j.decode(new Uint8Array([e]),r)}static guessEncoding(e,t){if(null!=t&&void 0!==t.get(U.CHARACTER_SET))return t.get(U.CHARACTER_SET).toString();let r=e.length,n=!0,i=!0,o=!0,a=0,s=0,l=0,c=0,u=0,h=0,d=0,f=0,g=0,p=0,m=0,w=e.length>3&&239===e[0]&&187===e[1]&&191===e[2];for(let t=0;t<r&&(n||i||o);t++){let r=255&e[t];o&&(a>0?(128&r)==0?o=!1:a--:(128&r)!=0&&((64&r)==0?o=!1:(a++,(32&r)==0?s++:(a++,(16&r)==0?l++:(a++,(8&r)==0?c++:o=!1))))),n&&(r>127&&r<160?n=!1:r>159&&(r<192||215===r||247===r)&&m++),i&&(u>0?r<64||127===r||r>252?i=!1:u--:128===r||160===r||r>239?i=!1:r>160&&r<224?(h++,f=0,++d>g&&(g=d)):r>127?(u++,d=0,++f>p&&(p=f)):(d=0,f=0))}return(o&&a>0&&(o=!1),i&&u>0&&(i=!1),o&&(w||s+l+c>0))?G.UTF8:i&&(G.ASSUME_SHIFT_JIS||g>=3||p>=3)?G.SHIFT_JIS:n&&i?2===g&&2===h||10*m>=r?G.SHIFT_JIS:G.ISO88591:n?G.ISO88591:i?G.SHIFT_JIS:o?G.UTF8:G.PLATFORM_DEFAULT_ENCODING}static format(e,...t){let r=-1;return e.replace(/%(-)?(0?[0-9]+)?([.][0-9]+)?([#][0-9]+)?([scfpexd%])/g,function(e,n,i,o,a,s){let l;if("%%"===e)return"%";if(void 0===t[++r])return;e=o?parseInt(o.substr(1)):void 0;let c=a?parseInt(a.substr(1)):void 0;switch(s){case"s":l=t[r];break;case"c":l=t[r][0];break;case"f":l=parseFloat(t[r]).toFixed(e);break;case"p":l=parseFloat(t[r]).toPrecision(e);break;case"e":l=parseFloat(t[r]).toExponential(e);break;case"x":l=parseInt(t[r]).toString(c||16);break;case"d":l=parseFloat(parseInt(t[r],c||10).toPrecision(e)).toFixed(0)}l="object"==typeof l?JSON.stringify(l):(+l).toString(c);let u=parseInt(i),h=i&&i[0]+""=="0"?"0":" ";for(;l.length<u;)l=void 0!==n?l+h:h+l;return l})}static getBytes(e,t){return j.encode(e,t)}static getCharCode(e,t=0){return e.charCodeAt(t)}static getCharAt(e){return String.fromCharCode(e)}}G.SHIFT_JIS=z.SJIS.getName(),G.GB2312="GB2312",G.ISO88591=z.ISO8859_1.getName(),G.EUC_JP="EUC_JP",G.UTF8=z.UTF8.getName(),G.PLATFORM_DEFAULT_ENCODING=G.UTF8,G.ASSUME_SHIFT_JIS=!1;class W{constructor(e=""){this.value=e}enableDecoding(e){return this.encoding=e,this}append(e){return"string"==typeof e?this.value+=e.toString():this.encoding?this.value+=G.castAsNonUtf8Char(e,this.encoding):this.value+=String.fromCharCode(e),this}appendChars(e,t,r){for(let n=t;t<t+r;n++)this.append(e[n]);return this}length(){return this.value.length}charAt(e){return this.value.charAt(e)}deleteCharAt(e){this.value=this.value.substr(0,e)+this.value.substring(e+1)}setCharAt(e,t){this.value=this.value.substr(0,e)+t+this.value.substr(e+1)}substring(e,t){return this.value.substring(e,t)}setLengthToZero(){this.value=""}toString(){return this.value}insert(e,t){this.value=this.value.substr(0,e)+t+this.value.substr(e+t.length)}}class Y{constructor(e,t,r,n){if(this.width=e,this.height=t,this.rowSize=r,this.bits=n,null==t&&(t=e),this.height=t,e<1||t<1)throw new D("Both dimensions must be greater than 0");null==r&&(r=Math.floor((e+31)/32)),this.rowSize=r,null==n&&(this.bits=new Int32Array(this.rowSize*this.height))}static parseFromBooleanArray(e){let t=e.length,r=e[0].length,n=new Y(r,t);for(let i=0;i<t;i++){let t=e[i];for(let e=0;e<r;e++)t[e]&&n.set(e,i)}return n}static parseFromString(e,t,r){if(null===e)throw new D("stringRepresentation cannot be null");let n=Array(e.length),i=0,o=0,a=-1,s=0,l=0;for(;l<e.length;)if("\n"===e.charAt(l)||"\r"===e.charAt(l)){if(i>o){if(-1===a)a=i-o;else if(i-o!==a)throw new D("row lengths do not match");o=i,s++}l++}else if(e.substring(l,l+t.length)===t)l+=t.length,n[i]=!0,i++;else if(e.substring(l,l+r.length)===r)l+=r.length,n[i]=!1,i++;else throw new D("illegal character encountered: "+e.substring(l));if(i>o){if(-1===a)a=i-o;else if(i-o!==a)throw new D("row lengths do not match");s++}let c=new Y(a,s);for(let e=0;e<i;e++)n[e]&&c.set(Math.floor(e%a),Math.floor(e/a));return c}get(e,t){let r=t*this.rowSize+Math.floor(e/32);return(this.bits[r]>>>(31&e)&1)!=0}set(e,t){let r=t*this.rowSize+Math.floor(e/32);this.bits[r]|=1<<(31&e)&0xffffffff}unset(e,t){let r=t*this.rowSize+Math.floor(e/32);this.bits[r]&=~(1<<(31&e)&0xffffffff)}flip(e,t){let r=t*this.rowSize+Math.floor(e/32);this.bits[r]^=1<<(31&e)&0xffffffff}xor(e){if(this.width!==e.getWidth()||this.height!==e.getHeight()||this.rowSize!==e.getRowSize())throw new D("input matrix dimensions do not match");let t=new F(Math.floor(this.width/32)+1),r=this.rowSize,n=this.bits;for(let i=0,o=this.height;i<o;i++){let o=i*r,a=e.getRow(i,t).getBitArray();for(let e=0;e<r;e++)n[o+e]^=a[e]}}clear(){let e=this.bits,t=e.length;for(let r=0;r<t;r++)e[r]=0}setRegion(e,t,r,n){if(t<0||e<0)throw new D("Left and top must be nonnegative");if(n<1||r<1)throw new D("Height and width must be at least 1");let i=e+r,o=t+n;if(o>this.height||i>this.width)throw new D("The region must fit inside the matrix");let a=this.rowSize,s=this.bits;for(let r=t;r<o;r++){let t=r*a;for(let r=e;r<i;r++)s[t+Math.floor(r/32)]|=1<<(31&r)&0xffffffff}}getRow(e,t){null==t||t.getSize()<this.width?t=new F(this.width):t.clear();let r=this.rowSize,n=this.bits,i=e*r;for(let e=0;e<r;e++)t.setBulk(32*e,n[i+e]);return t}setRow(e,t){P.arraycopy(t.getBitArray(),0,this.bits,e*this.rowSize,this.rowSize)}rotate180(){let e=this.getWidth(),t=this.getHeight(),r=new F(e),n=new F(e);for(let e=0,i=Math.floor((t+1)/2);e<i;e++)r=this.getRow(e,r),n=this.getRow(t-1-e,n),r.reverse(),n.reverse(),this.setRow(e,n),this.setRow(t-1-e,r)}getEnclosingRectangle(){let e=this.width,t=this.height,r=this.rowSize,n=this.bits,i=e,o=t,a=-1,s=-1;for(let e=0;e<t;e++)for(let t=0;t<r;t++){let l=n[e*r+t];if(0!==l){if(e<o&&(o=e),e>s&&(s=e),32*t<i){let e=0;for(;(l<<31-e&0xffffffff)==0;)e++;32*t+e<i&&(i=32*t+e)}if(32*t+31>a){let e=31;for(;l>>>e==0;)e--;32*t+e>a&&(a=32*t+e)}}}return a<i||s<o?null:Int32Array.from([i,o,a-i+1,s-o+1])}getTopLeftOnBit(){let e=this.rowSize,t=this.bits,r=0;for(;r<t.length&&0===t[r];)r++;if(r===t.length)return null;let n=r/e,i=r%e*32,o=t[r],a=0;for(;(o<<31-a&0xffffffff)==0;)a++;return i+=a,Int32Array.from([i,n])}getBottomRightOnBit(){let e=this.rowSize,t=this.bits,r=t.length-1;for(;r>=0&&0===t[r];)r--;if(r<0)return null;let n=Math.floor(r/e),i=32*Math.floor(r%e),o=t[r],a=31;for(;o>>>a==0;)a--;return i+=a,Int32Array.from([i,n])}getWidth(){return this.width}getHeight(){return this.height}getRowSize(){return this.rowSize}equals(e){return e instanceof Y&&this.width===e.width&&this.height===e.height&&this.rowSize===e.rowSize&&L.equals(this.bits,e.bits)}hashCode(){let e=this.width;return 31*(e=31*(e=31*(e=31*e+this.width)+this.height)+this.rowSize)+L.hashCode(this.bits)}toString(e="X ",t=" ",r="\n"){return this.buildToString(e,t,r)}buildToString(e,t,r){let n=new W;for(let i=0,o=this.height;i<o;i++){for(let r=0,o=this.width;r<o;r++)n.append(this.get(r,i)?e:t);n.append(r)}return n.toString()}clone(){return new Y(this.width,this.height,this.rowSize,this.bits.slice())}}class X extends N{static getNotFoundInstance(){return new X}}X.kind="NotFoundException";class Z extends v{constructor(e){super(e),this.luminances=Z.EMPTY,this.buckets=new Int32Array(Z.LUMINANCE_BUCKETS)}getBlackRow(e,t){let r=this.getLuminanceSource(),n=r.getWidth();null==t||t.getSize()<n?t=new F(n):t.clear(),this.initArrays(n);let i=r.getRow(e,this.luminances),o=this.buckets;for(let e=0;e<n;e++)o[(255&i[e])>>Z.LUMINANCE_SHIFT]++;let a=Z.estimateBlackPoint(o);if(n<3)for(let e=0;e<n;e++)(255&i[e])<a&&t.set(e);else{let e=255&i[0],r=255&i[1];for(let o=1;o<n-1;o++){let n=255&i[o+1];(4*r-e-n)/2<a&&t.set(o),e=r,r=n}}return t}getBlackMatrix(){let e=this.getLuminanceSource(),t=e.getWidth(),r=e.getHeight(),n=new Y(t,r);this.initArrays(t);let i=this.buckets;for(let n=1;n<5;n++){let o=Math.floor(r*n/5),a=e.getRow(o,this.luminances),s=Math.floor(4*t/5);for(let e=Math.floor(t/5);e<s;e++){let t=255&a[e];i[t>>Z.LUMINANCE_SHIFT]++}}let o=Z.estimateBlackPoint(i),a=e.getMatrix();for(let e=0;e<r;e++){let r=e*t;for(let i=0;i<t;i++)(255&a[r+i])<o&&n.set(i,e)}return n}createBinarizer(e){return new Z(e)}initArrays(e){this.luminances.length<e&&(this.luminances=new Uint8ClampedArray(e));let t=this.buckets;for(let e=0;e<Z.LUMINANCE_BUCKETS;e++)t[e]=0}static estimateBlackPoint(e){let t=e.length,r=0,n=0,i=0;for(let o=0;o<t;o++)e[o]>i&&(n=o,i=e[o]),e[o]>r&&(r=e[o]);let o=0,a=0;for(let r=0;r<t;r++){let t=r-n,i=e[r]*t*t;i>a&&(o=r,a=i)}if(n>o){let e=n;n=o,o=e}if(o-n<=t/16)throw new X;let s=o-1,l=-1;for(let t=o-1;t>n;t--){let i=t-n,a=i*i*(o-t)*(r-e[t]);a>l&&(s=t,l=a)}return s<<Z.LUMINANCE_SHIFT}}Z.LUMINANCE_BITS=5,Z.LUMINANCE_SHIFT=8-Z.LUMINANCE_BITS,Z.LUMINANCE_BUCKETS=1<<Z.LUMINANCE_BITS,Z.EMPTY=Uint8ClampedArray.from([0]);class Q extends Z{constructor(e){super(e),this.matrix=null}getBlackMatrix(){if(null!==this.matrix)return this.matrix;let e=this.getLuminanceSource(),t=e.getWidth(),r=e.getHeight();if(t>=Q.MINIMUM_DIMENSION&&r>=Q.MINIMUM_DIMENSION){let n=e.getMatrix(),i=t>>Q.BLOCK_SIZE_POWER;(t&Q.BLOCK_SIZE_MASK)!=0&&i++;let o=r>>Q.BLOCK_SIZE_POWER;(r&Q.BLOCK_SIZE_MASK)!=0&&o++;let a=Q.calculateBlackPoints(n,i,o,t,r),s=new Y(t,r);Q.calculateThresholdForBlock(n,i,o,t,r,a,s),this.matrix=s}else this.matrix=super.getBlackMatrix();return this.matrix}createBinarizer(e){return new Q(e)}static calculateThresholdForBlock(e,t,r,n,i,o,a){let s=i-Q.BLOCK_SIZE,l=n-Q.BLOCK_SIZE;for(let i=0;i<r;i++){let c=i<<Q.BLOCK_SIZE_POWER;c>s&&(c=s);let u=Q.cap(i,2,r-3);for(let r=0;r<t;r++){let i=r<<Q.BLOCK_SIZE_POWER;i>l&&(i=l);let s=Q.cap(r,2,t-3),h=0;for(let e=-2;e<=2;e++){let t=o[u+e];h+=t[s-2]+t[s-1]+t[s]+t[s+1]+t[s+2]}let d=h/25;Q.thresholdBlock(e,i,c,d,n,a)}}}static cap(e,t,r){return e<t?t:e>r?r:e}static thresholdBlock(e,t,r,n,i,o){for(let a=0,s=r*i+t;a<Q.BLOCK_SIZE;a++,s+=i)for(let i=0;i<Q.BLOCK_SIZE;i++)(255&e[s+i])<=n&&o.set(t+i,r+a)}static calculateBlackPoints(e,t,r,n,i){let o=i-Q.BLOCK_SIZE,a=n-Q.BLOCK_SIZE,s=Array(r);for(let i=0;i<r;i++){s[i]=new Int32Array(t);let r=i<<Q.BLOCK_SIZE_POWER;r>o&&(r=o);for(let o=0;o<t;o++){let t=o<<Q.BLOCK_SIZE_POWER;t>a&&(t=a);let l=0,c=255,u=0;for(let i=0,o=r*n+t;i<Q.BLOCK_SIZE;i++,o+=n){for(let t=0;t<Q.BLOCK_SIZE;t++){let r=255&e[o+t];l+=r,r<c&&(c=r),r>u&&(u=r)}if(u-c>Q.MIN_DYNAMIC_RANGE)for(i++,o+=n;i<Q.BLOCK_SIZE;i++,o+=n)for(let t=0;t<Q.BLOCK_SIZE;t++)l+=255&e[o+t]}let h=l>>2*Q.BLOCK_SIZE_POWER;if(u-c<=Q.MIN_DYNAMIC_RANGE&&(h=c/2,i>0&&o>0)){let e=(s[i-1][o]+2*s[i][o-1]+s[i-1][o-1])/4;c<e&&(h=e)}s[i][o]=h}}return s}}Q.BLOCK_SIZE_POWER=3,Q.BLOCK_SIZE=1<<Q.BLOCK_SIZE_POWER,Q.BLOCK_SIZE_MASK=Q.BLOCK_SIZE-1,Q.MINIMUM_DIMENSION=5*Q.BLOCK_SIZE,Q.MIN_DYNAMIC_RANGE=24;class q{constructor(e,t){this.width=e,this.height=t}getWidth(){return this.width}getHeight(){return this.height}isCropSupported(){return!1}crop(e,t,r,n){throw new V("This luminance source does not support cropping.")}isRotateSupported(){return!1}rotateCounterClockwise(){throw new V("This luminance source does not support rotation by 90 degrees.")}rotateCounterClockwise45(){throw new V("This luminance source does not support rotation by 45 degrees.")}toString(){let e=new Uint8ClampedArray(this.width),t=new W;for(let r=0;r<this.height;r++){let n=this.getRow(r,e);for(let e=0;e<this.width;e++){let r,i=255&n[e];r=i<64?"#":i<128?"+":i<192?".":" ",t.append(r)}t.append("\n")}return t.toString()}}class K extends q{constructor(e){super(e.getWidth(),e.getHeight()),this.delegate=e}getRow(e,t){let r=this.delegate.getRow(e,t),n=this.getWidth();for(let e=0;e<n;e++)r[e]=255-(255&r[e]);return r}getMatrix(){let e=this.delegate.getMatrix(),t=this.getWidth()*this.getHeight(),r=new Uint8ClampedArray(t);for(let n=0;n<t;n++)r[n]=255-(255&e[n]);return r}isCropSupported(){return this.delegate.isCropSupported()}crop(e,t,r,n){return new K(this.delegate.crop(e,t,r,n))}isRotateSupported(){return this.delegate.isRotateSupported()}invert(){return this.delegate}rotateCounterClockwise(){return new K(this.delegate.rotateCounterClockwise())}rotateCounterClockwise45(){return new K(this.delegate.rotateCounterClockwise45())}}class $ extends q{constructor(e){super(e.width,e.height),this.canvas=e,this.tempCanvasElement=null,this.buffer=$.makeBufferFromCanvasImageData(e)}static makeBufferFromCanvasImageData(e){let t=e.getContext("2d").getImageData(0,0,e.width,e.height);return $.toGrayscaleBuffer(t.data,e.width,e.height)}static toGrayscaleBuffer(e,t,r){let n=new Uint8ClampedArray(t*r);for(let t=0,r=0,i=e.length;t<i;t+=4,r++){let i;if(0===e[t+3])i=255;else{let r=e[t];i=306*r+601*e[t+1]+117*e[t+2]+512>>10}n[r]=i}return n}getRow(e,t){if(e<0||e>=this.getHeight())throw new D("Requested row is outside the image: "+e);let r=this.getWidth(),n=e*r;return null===t?t=this.buffer.slice(n,n+r):(t.length<r&&(t=new Uint8ClampedArray(r)),t.set(this.buffer.slice(n,n+r))),t}getMatrix(){return this.buffer}isCropSupported(){return!0}crop(e,t,r,n){return super.crop(e,t,r,n),this}isRotateSupported(){return!0}rotateCounterClockwise(){return this.rotate(-90),this}rotateCounterClockwise45(){return this.rotate(-45),this}getTempCanvasElement(){if(null===this.tempCanvasElement){let e=this.canvas.ownerDocument.createElement("canvas");e.width=this.canvas.width,e.height=this.canvas.height,this.tempCanvasElement=e}return this.tempCanvasElement}rotate(e){let t=this.getTempCanvasElement(),r=t.getContext("2d"),n=e*$.DEGREE_TO_RADIANS,i=this.canvas.width,o=this.canvas.height,a=Math.ceil(Math.abs(Math.cos(n))*i+Math.abs(Math.sin(n))*o),s=Math.ceil(Math.abs(Math.sin(n))*i+Math.abs(Math.cos(n))*o);return t.width=a,t.height=s,r.translate(a/2,s/2),r.rotate(n),r.drawImage(this.canvas,-(i/2),-(o/2)),this.buffer=$.makeBufferFromCanvasImageData(t),this}invert(){return new K(this)}}$.DEGREE_TO_RADIANS=Math.PI/180;class J{constructor(e,t,r){this.deviceId=e,this.label=t,this.kind="videoinput",this.groupId=r||void 0}toJSON(){return{kind:this.kind,groupId:this.groupId,deviceId:this.deviceId,label:this.label}}}var ee=(globalThis||r.g||self||window||void 0)&&(globalThis||r.g||self||window||void 0).__awaiter||function(e,t,r,n){return new(r||(r=Promise))(function(i,o){function a(e){try{l(n.next(e))}catch(e){o(e)}}function s(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(a,s)}l((n=n.apply(e,t||[])).next())})};class et{constructor(e,t=500,r){this.reader=e,this.timeBetweenScansMillis=t,this._hints=r,this._stopContinuousDecode=!1,this._stopAsyncDecode=!1,this._timeBetweenDecodingAttempts=0}get hasNavigator(){return"undefined"!=typeof navigator}get isMediaDevicesSuported(){return this.hasNavigator&&!!navigator.mediaDevices}get canEnumerateDevices(){return!!(this.isMediaDevicesSuported&&navigator.mediaDevices.enumerateDevices)}get timeBetweenDecodingAttempts(){return this._timeBetweenDecodingAttempts}set timeBetweenDecodingAttempts(e){this._timeBetweenDecodingAttempts=e<0?0:e}set hints(e){this._hints=e||null}get hints(){return this._hints}listVideoInputDevices(){return ee(this,void 0,void 0,function*(){if(!this.hasNavigator)throw Error("Can't enumerate devices, navigator is not present.");if(!this.canEnumerateDevices)throw Error("Can't enumerate devices, method not supported.");let e=yield navigator.mediaDevices.enumerateDevices(),t=[];for(let r of e){let e="video"===r.kind?"videoinput":r.kind;if("videoinput"!==e)continue;let n=r.deviceId||r.id,i={deviceId:n,label:r.label||`Video device ${t.length+1}`,kind:e,groupId:r.groupId};t.push(i)}return t})}getVideoInputDevices(){return ee(this,void 0,void 0,function*(){return(yield this.listVideoInputDevices()).map(e=>new J(e.deviceId,e.label))})}findDeviceById(e){return ee(this,void 0,void 0,function*(){let t=yield this.listVideoInputDevices();return t?t.find(t=>t.deviceId===e):null})}decodeFromInputVideoDevice(e,t){return ee(this,void 0,void 0,function*(){return yield this.decodeOnceFromVideoDevice(e,t)})}decodeOnceFromVideoDevice(e,t){return ee(this,void 0,void 0,function*(){return this.reset(),yield this.decodeOnceFromConstraints({video:e?{deviceId:{exact:e}}:{facingMode:"environment"}},t)})}decodeOnceFromConstraints(e,t){return ee(this,void 0,void 0,function*(){let r=yield navigator.mediaDevices.getUserMedia(e);return yield this.decodeOnceFromStream(r,t)})}decodeOnceFromStream(e,t){return ee(this,void 0,void 0,function*(){this.reset();let r=yield this.attachStreamToVideo(e,t);return yield this.decodeOnce(r)})}decodeFromInputVideoDeviceContinuously(e,t,r){return ee(this,void 0,void 0,function*(){return yield this.decodeFromVideoDevice(e,t,r)})}decodeFromVideoDevice(e,t,r){return ee(this,void 0,void 0,function*(){return yield this.decodeFromConstraints({video:e?{deviceId:{exact:e}}:{facingMode:"environment"}},t,r)})}decodeFromConstraints(e,t,r){return ee(this,void 0,void 0,function*(){let n=yield navigator.mediaDevices.getUserMedia(e);return yield this.decodeFromStream(n,t,r)})}decodeFromStream(e,t,r){return ee(this,void 0,void 0,function*(){this.reset();let n=yield this.attachStreamToVideo(e,t);return yield this.decodeContinuously(n,r)})}stopAsyncDecode(){this._stopAsyncDecode=!0}stopContinuousDecode(){this._stopContinuousDecode=!0}attachStreamToVideo(e,t){return ee(this,void 0,void 0,function*(){let r=this.prepareVideoElement(t);return this.addVideoSource(r,e),this.videoElement=r,this.stream=e,yield this.playVideoOnLoadAsync(r),r})}playVideoOnLoadAsync(e){return new Promise((t,r)=>this.playVideoOnLoad(e,()=>t()))}playVideoOnLoad(e,t){this.videoEndedListener=()=>this.stopStreams(),this.videoCanPlayListener=()=>this.tryPlayVideo(e),e.addEventListener("ended",this.videoEndedListener),e.addEventListener("canplay",this.videoCanPlayListener),e.addEventListener("playing",t),this.tryPlayVideo(e)}isVideoPlaying(e){return e.currentTime>0&&!e.paused&&!e.ended&&e.readyState>2}tryPlayVideo(e){return ee(this,void 0,void 0,function*(){if(this.isVideoPlaying(e))return void console.warn("Trying to play video that is already playing.");try{yield e.play()}catch(e){console.warn("It was not possible to play the video.")}})}getMediaElement(e,t){let r=document.getElementById(e);if(!r)throw new M(`element with id '${e}' not found`);if(r.nodeName.toLowerCase()!==t.toLowerCase())throw new M(`element with id '${e}' must be an ${t} element`);return r}decodeFromImage(e,t){if(!e&&!t)throw new M("either imageElement with a src set or an url must be provided");return t&&!e?this.decodeFromImageUrl(t):this.decodeFromImageElement(e)}decodeFromVideo(e,t){if(!e&&!t)throw new M("Either an element with a src set or an URL must be provided");return t&&!e?this.decodeFromVideoUrl(t):this.decodeFromVideoElement(e)}decodeFromVideoContinuously(e,t,r){if(void 0===e&&void 0===t)throw new M("Either an element with a src set or an URL must be provided");return t&&!e?this.decodeFromVideoUrlContinuously(t,r):this.decodeFromVideoElementContinuously(e,r)}decodeFromImageElement(e){let t;if(!e)throw new M("An image element must be provided.");this.reset();let r=this.prepareImageElement(e);return this.imageElement=r,this.isImageLoaded(r)?this.decodeOnce(r,!1,!0):this._decodeOnLoadImage(r)}decodeFromVideoElement(e){let t=this._decodeFromVideoElementSetup(e);return this._decodeOnLoadVideo(t)}decodeFromVideoElementContinuously(e,t){let r=this._decodeFromVideoElementSetup(e);return this._decodeOnLoadVideoContinuously(r,t)}_decodeFromVideoElementSetup(e){if(!e)throw new M("A video element must be provided.");this.reset();let t=this.prepareVideoElement(e);return this.videoElement=t,t}decodeFromImageUrl(e){if(!e)throw new M("An URL must be provided.");this.reset();let t=this.prepareImageElement();this.imageElement=t;let r=this._decodeOnLoadImage(t);return t.src=e,r}decodeFromVideoUrl(e){if(!e)throw new M("An URL must be provided.");this.reset();let t=this.prepareVideoElement(),r=this.decodeFromVideoElement(t);return t.src=e,r}decodeFromVideoUrlContinuously(e,t){if(!e)throw new M("An URL must be provided.");this.reset();let r=this.prepareVideoElement(),n=this.decodeFromVideoElementContinuously(r,t);return r.src=e,n}_decodeOnLoadImage(e){return new Promise((t,r)=>{this.imageLoadedListener=()=>this.decodeOnce(e,!1,!0).then(t,r),e.addEventListener("load",this.imageLoadedListener)})}_decodeOnLoadVideo(e){return ee(this,void 0,void 0,function*(){return yield this.playVideoOnLoadAsync(e),yield this.decodeOnce(e)})}_decodeOnLoadVideoContinuously(e,t){return ee(this,void 0,void 0,function*(){yield this.playVideoOnLoadAsync(e),this.decodeContinuously(e,t)})}isImageLoaded(e){return!!e.complete&&0!==e.naturalWidth}prepareImageElement(e){let t;return void 0===e&&((t=document.createElement("img")).width=200,t.height=200),"string"==typeof e&&(t=this.getMediaElement(e,"img")),e instanceof HTMLImageElement&&(t=e),t}prepareVideoElement(e){let t;return e||"undefined"==typeof document||((t=document.createElement("video")).width=200,t.height=200),"string"==typeof e&&(t=this.getMediaElement(e,"video")),e instanceof HTMLVideoElement&&(t=e),t.setAttribute("autoplay","true"),t.setAttribute("muted","true"),t.setAttribute("playsinline","true"),t}decodeOnce(e,t=!0,r=!0){this._stopAsyncDecode=!1;let n=(i,o)=>{if(this._stopAsyncDecode){o(new X("Video stream has ended before any code could be detected.")),this._stopAsyncDecode=void 0;return}try{let t=this.decode(e);i(t)}catch(s){let e=t&&s instanceof X,a=s instanceof R||s instanceof H;if(e||a&&r)return setTimeout(n,this._timeBetweenDecodingAttempts,i,o);o(s)}};return new Promise((e,t)=>n(e,t))}decodeContinuously(e,t){this._stopContinuousDecode=!1;let r=()=>{if(this._stopContinuousDecode){this._stopContinuousDecode=void 0;return}try{let n=this.decode(e);t(n,null),setTimeout(r,this.timeBetweenScansMillis)}catch(i){t(null,i);let e=i instanceof R||i instanceof H,n=i instanceof X;(e||n)&&setTimeout(r,this._timeBetweenDecodingAttempts)}};r()}decode(e){let t=this.createBinaryBitmap(e);return this.decodeBitmap(t)}_isHTMLVideoElement(e){return 0!==e.videoWidth}drawFrameOnCanvas(e,t,r){t||(t={sx:0,sy:0,sWidth:e.videoWidth,sHeight:e.videoHeight,dx:0,dy:0,dWidth:e.videoWidth,dHeight:e.videoHeight}),r||(r=this.captureCanvasContext),r.drawImage(e,t.sx,t.sy,t.sWidth,t.sHeight,t.dx,t.dy,t.dWidth,t.dHeight)}drawImageOnCanvas(e,t,r=this.captureCanvasContext){t||(t={sx:0,sy:0,sWidth:e.naturalWidth,sHeight:e.naturalHeight,dx:0,dy:0,dWidth:e.naturalWidth,dHeight:e.naturalHeight}),r||(r=this.captureCanvasContext),r.drawImage(e,t.sx,t.sy,t.sWidth,t.sHeight,t.dx,t.dy,t.dWidth,t.dHeight)}createBinaryBitmap(e){return this.getCaptureCanvasContext(e),this._isHTMLVideoElement(e)?this.drawFrameOnCanvas(e):this.drawImageOnCanvas(e),new O(new Q(new $(this.getCaptureCanvas(e))))}getCaptureCanvasContext(e){if(!this.captureCanvasContext){let t=this.getCaptureCanvas(e).getContext("2d");this.captureCanvasContext=t}return this.captureCanvasContext}getCaptureCanvas(e){if(!this.captureCanvas){let t=this.createCaptureCanvas(e);this.captureCanvas=t}return this.captureCanvas}decodeBitmap(e){return this.reader.decode(e,this._hints)}createCaptureCanvas(e){let t,r;if("undefined"==typeof document)return this._destroyCaptureCanvas(),null;let n=document.createElement("canvas");return void 0!==e&&(e instanceof HTMLVideoElement?(t=e.videoWidth,r=e.videoHeight):e instanceof HTMLImageElement&&(t=e.naturalWidth||e.width,r=e.naturalHeight||e.height)),n.style.width=t+"px",n.style.height=r+"px",n.width=t,n.height=r,n}stopStreams(){this.stream&&(this.stream.getVideoTracks().forEach(e=>e.stop()),this.stream=void 0),!1===this._stopAsyncDecode&&this.stopAsyncDecode(),!1===this._stopContinuousDecode&&this.stopContinuousDecode()}reset(){this.stopStreams(),this._destroyVideoElement(),this._destroyImageElement(),this._destroyCaptureCanvas()}_destroyVideoElement(){this.videoElement&&(void 0!==this.videoEndedListener&&this.videoElement.removeEventListener("ended",this.videoEndedListener),void 0!==this.videoPlayingEventListener&&this.videoElement.removeEventListener("playing",this.videoPlayingEventListener),void 0!==this.videoCanPlayListener&&this.videoElement.removeEventListener("loadedmetadata",this.videoCanPlayListener),this.cleanVideoSource(this.videoElement),this.videoElement=void 0)}_destroyImageElement(){this.imageElement&&(void 0!==this.imageLoadedListener&&this.imageElement.removeEventListener("load",this.imageLoadedListener),this.imageElement.src=void 0,this.imageElement.removeAttribute("src"),this.imageElement=void 0)}_destroyCaptureCanvas(){this.captureCanvasContext=void 0,this.captureCanvas=void 0}addVideoSource(e,t){try{e.srcObject=t}catch(r){e.src=URL.createObjectURL(t)}}cleanVideoSource(e){try{e.srcObject=null}catch(t){e.src=""}this.videoElement.removeAttribute("src")}}class er{constructor(e,t,r=null==t?0:8*t.length,n,i,o=P.currentTimeMillis()){this.text=e,this.rawBytes=t,this.numBits=r,this.resultPoints=n,this.format=i,this.timestamp=o,this.text=e,this.rawBytes=t,null==r?this.numBits=null==t?0:8*t.length:this.numBits=r,this.resultPoints=n,this.format=i,this.resultMetadata=null,null==o?this.timestamp=P.currentTimeMillis():this.timestamp=o}getText(){return this.text}getRawBytes(){return this.rawBytes}getNumBits(){return this.numBits}getResultPoints(){return this.resultPoints}getBarcodeFormat(){return this.format}getResultMetadata(){return this.resultMetadata}putMetadata(e,t){null===this.resultMetadata&&(this.resultMetadata=new Map),this.resultMetadata.set(e,t)}putAllMetadata(e){null!==e&&(null===this.resultMetadata?this.resultMetadata=e:this.resultMetadata=new Map(e))}addResultPoints(e){let t=this.resultPoints;if(null===t)this.resultPoints=e;else if(null!==e&&e.length>0){let r=Array(t.length+e.length);P.arraycopy(t,0,r,0,t.length),P.arraycopy(e,0,r,t.length,e.length),this.resultPoints=r}}getTimestamp(){return this.timestamp}toString(){return this.text}}(o=m||(m={}))[o.AZTEC=0]="AZTEC",o[o.CODABAR=1]="CODABAR",o[o.CODE_39=2]="CODE_39",o[o.CODE_93=3]="CODE_93",o[o.CODE_128=4]="CODE_128",o[o.DATA_MATRIX=5]="DATA_MATRIX",o[o.EAN_8=6]="EAN_8",o[o.EAN_13=7]="EAN_13",o[o.ITF=8]="ITF",o[o.MAXICODE=9]="MAXICODE",o[o.PDF_417=10]="PDF_417",o[o.QR_CODE=11]="QR_CODE",o[o.RSS_14=12]="RSS_14",o[o.RSS_EXPANDED=13]="RSS_EXPANDED",o[o.UPC_A=14]="UPC_A",o[o.UPC_E=15]="UPC_E",o[o.UPC_EAN_EXTENSION=16]="UPC_EAN_EXTENSION";var en=m;(a=w||(w={}))[a.OTHER=0]="OTHER",a[a.ORIENTATION=1]="ORIENTATION",a[a.BYTE_SEGMENTS=2]="BYTE_SEGMENTS",a[a.ERROR_CORRECTION_LEVEL=3]="ERROR_CORRECTION_LEVEL",a[a.ISSUE_NUMBER=4]="ISSUE_NUMBER",a[a.SUGGESTED_PRICE=5]="SUGGESTED_PRICE",a[a.POSSIBLE_COUNTRY=6]="POSSIBLE_COUNTRY",a[a.UPC_EAN_EXTENSION=7]="UPC_EAN_EXTENSION",a[a.PDF417_EXTRA_METADATA=8]="PDF417_EXTRA_METADATA",a[a.STRUCTURED_APPEND_SEQUENCE=9]="STRUCTURED_APPEND_SEQUENCE",a[a.STRUCTURED_APPEND_PARITY=10]="STRUCTURED_APPEND_PARITY";var ei=w;class eo{constructor(e,t,r,n,i=-1,o=-1){this.rawBytes=e,this.text=t,this.byteSegments=r,this.ecLevel=n,this.structuredAppendSequenceNumber=i,this.structuredAppendParity=o,this.numBits=null==e?0:8*e.length}getRawBytes(){return this.rawBytes}getNumBits(){return this.numBits}setNumBits(e){this.numBits=e}getText(){return this.text}getByteSegments(){return this.byteSegments}getECLevel(){return this.ecLevel}getErrorsCorrected(){return this.errorsCorrected}setErrorsCorrected(e){this.errorsCorrected=e}getErasures(){return this.erasures}setErasures(e){this.erasures=e}getOther(){return this.other}setOther(e){this.other=e}hasStructuredAppend(){return this.structuredAppendParity>=0&&this.structuredAppendSequenceNumber>=0}getStructuredAppendParity(){return this.structuredAppendParity}getStructuredAppendSequenceNumber(){return this.structuredAppendSequenceNumber}}class ea{exp(e){return this.expTable[e]}log(e){if(0===e)throw new D;return this.logTable[e]}static addOrSubtract(e,t){return e^t}}class es{constructor(e,t){if(0===t.length)throw new D;this.field=e;let r=t.length;if(r>1&&0===t[0]){let e=1;for(;e<r&&0===t[e];)e++;e===r?this.coefficients=Int32Array.from([0]):(this.coefficients=new Int32Array(r-e),P.arraycopy(t,e,this.coefficients,0,this.coefficients.length))}else this.coefficients=t}getCoefficients(){return this.coefficients}getDegree(){return this.coefficients.length-1}isZero(){return 0===this.coefficients[0]}getCoefficient(e){return this.coefficients[this.coefficients.length-1-e]}evaluateAt(e){let t;if(0===e)return this.getCoefficient(0);let r=this.coefficients;if(1===e){t=0;for(let e=0,n=r.length;e!==n;e++){let n=r[e];t=ea.addOrSubtract(t,n)}return t}t=r[0];let n=r.length,i=this.field;for(let o=1;o<n;o++)t=ea.addOrSubtract(i.multiply(e,t),r[o]);return t}addOrSubtract(e){if(!this.field.equals(e.field))throw new D("GenericGFPolys do not have same GenericGF field");if(this.isZero())return e;if(e.isZero())return this;let t=this.coefficients,r=e.coefficients;if(t.length>r.length){let e=t;t=r,r=e}let n=new Int32Array(r.length),i=r.length-t.length;P.arraycopy(r,0,n,0,i);for(let e=i;e<r.length;e++)n[e]=ea.addOrSubtract(t[e-i],r[e]);return new es(this.field,n)}multiply(e){if(!this.field.equals(e.field))throw new D("GenericGFPolys do not have same GenericGF field");if(this.isZero()||e.isZero())return this.field.getZero();let t=this.coefficients,r=t.length,n=e.coefficients,i=n.length,o=new Int32Array(r+i-1),a=this.field;for(let e=0;e<r;e++){let r=t[e];for(let t=0;t<i;t++)o[e+t]=ea.addOrSubtract(o[e+t],a.multiply(r,n[t]))}return new es(a,o)}multiplyScalar(e){if(0===e)return this.field.getZero();if(1===e)return this;let t=this.coefficients.length,r=this.field,n=new Int32Array(t),i=this.coefficients;for(let o=0;o<t;o++)n[o]=r.multiply(i[o],e);return new es(r,n)}multiplyByMonomial(e,t){if(e<0)throw new D;if(0===t)return this.field.getZero();let r=this.coefficients,n=r.length,i=new Int32Array(n+e),o=this.field;for(let e=0;e<n;e++)i[e]=o.multiply(r[e],t);return new es(o,i)}divide(e){if(!this.field.equals(e.field))throw new D("GenericGFPolys do not have same GenericGF field");if(e.isZero())throw new D("Divide by 0");let t=this.field,r=t.getZero(),n=this,i=e.getCoefficient(e.getDegree()),o=t.inverse(i);for(;n.getDegree()>=e.getDegree()&&!n.isZero();){let i=n.getDegree()-e.getDegree(),a=t.multiply(n.getCoefficient(n.getDegree()),o),s=e.multiplyByMonomial(i,a),l=t.buildMonomial(i,a);r=r.addOrSubtract(l),n=n.addOrSubtract(s)}return[r,n]}toString(){let e="";for(let t=this.getDegree();t>=0;t--){let r=this.getCoefficient(t);if(0!==r){if(r<0?(e+=" - ",r=-r):e.length>0&&(e+=" + "),0===t||1!==r){let t=this.field.log(r);0===t?e+="1":1===t?e+="a":(e+="a^",e+=t)}0!==t&&(1===t?e+="x":(e+="x^",e+=t))}}return e}}class el extends N{}el.kind="ArithmeticException";class ec extends ea{constructor(e,t,r){super(),this.primitive=e,this.size=t,this.generatorBase=r;let n=new Int32Array(t),i=1;for(let r=0;r<t;r++)n[r]=i,(i*=2)>=t&&(i^=e,i&=t-1);this.expTable=n;let o=new Int32Array(t);for(let e=0;e<t-1;e++)o[n[e]]=e;this.logTable=o,this.zero=new es(this,Int32Array.from([0])),this.one=new es(this,Int32Array.from([1]))}getZero(){return this.zero}getOne(){return this.one}buildMonomial(e,t){if(e<0)throw new D;if(0===t)return this.zero;let r=new Int32Array(e+1);return r[0]=t,new es(this,r)}inverse(e){if(0===e)throw new el;return this.expTable[this.size-this.logTable[e]-1]}multiply(e,t){return 0===e||0===t?0:this.expTable[(this.logTable[e]+this.logTable[t])%(this.size-1)]}getSize(){return this.size}getGeneratorBase(){return this.generatorBase}toString(){return"GF(0x"+k.toHexString(this.primitive)+","+this.size+")"}equals(e){return e===this}}ec.AZTEC_DATA_12=new ec(4201,4096,1),ec.AZTEC_DATA_10=new ec(1033,1024,1),ec.AZTEC_DATA_6=new ec(67,64,1),ec.AZTEC_PARAM=new ec(19,16,1),ec.QR_CODE_FIELD_256=new ec(285,256,0),ec.DATA_MATRIX_FIELD_256=new ec(301,256,1),ec.AZTEC_DATA_8=ec.DATA_MATRIX_FIELD_256,ec.MAXICODE_FIELD_64=ec.AZTEC_DATA_6;class eu extends N{}eu.kind="ReedSolomonException";class eh extends N{}eh.kind="IllegalStateException";class ed{constructor(e){this.field=e}decode(e,t){let r=this.field,n=new es(r,e),i=new Int32Array(t),o=!0;for(let e=0;e<t;e++){let t=n.evaluateAt(r.exp(e+r.getGeneratorBase()));i[i.length-1-e]=t,0!==t&&(o=!1)}if(o)return;let a=new es(r,i),s=this.runEuclideanAlgorithm(r.buildMonomial(t,1),a,t),l=s[0],c=s[1],u=this.findErrorLocations(l),h=this.findErrorMagnitudes(c,u);for(let t=0;t<u.length;t++){let n=e.length-1-r.log(u[t]);if(n<0)throw new eu("Bad error location");e[n]=ec.addOrSubtract(e[n],h[t])}}runEuclideanAlgorithm(e,t,r){if(e.getDegree()<t.getDegree()){let r=e;e=t,t=r}let n=this.field,i=e,o=t,a=n.getZero(),s=n.getOne();for(;o.getDegree()>=(r/2|0);){let e=i,t=a;if(i=o,a=s,i.isZero())throw new eu("r_{i-1} was zero");o=e;let r=n.getZero(),l=i.getCoefficient(i.getDegree()),c=n.inverse(l);for(;o.getDegree()>=i.getDegree()&&!o.isZero();){let e=o.getDegree()-i.getDegree(),t=n.multiply(o.getCoefficient(o.getDegree()),c);r=r.addOrSubtract(n.buildMonomial(e,t)),o=o.addOrSubtract(i.multiplyByMonomial(e,t))}if(s=r.multiply(a).addOrSubtract(t),o.getDegree()>=i.getDegree())throw new eh("Division algorithm failed to reduce polynomial?")}let l=s.getCoefficient(0);if(0===l)throw new eu("sigmaTilde(0) was zero");let c=n.inverse(l);return[s.multiplyScalar(c),o.multiplyScalar(c)]}findErrorLocations(e){let t=e.getDegree();if(1===t)return Int32Array.from([e.getCoefficient(1)]);let r=new Int32Array(t),n=0,i=this.field;for(let o=1;o<i.getSize()&&n<t;o++)0===e.evaluateAt(o)&&(r[n]=i.inverse(o),n++);if(n!==t)throw new eu("Error locator degree does not match number of roots");return r}findErrorMagnitudes(e,t){let r=t.length,n=new Int32Array(r),i=this.field;for(let o=0;o<r;o++){let a=i.inverse(t[o]),s=1;for(let e=0;e<r;e++)if(o!==e){let r=i.multiply(t[e],a),n=(1&r)==0?1|r:-2&r;s=i.multiply(s,n)}n[o]=i.multiply(e.evaluateAt(a),i.inverse(s)),0!==i.getGeneratorBase()&&(n[o]=i.multiply(n[o],a))}return n}}(s=C||(C={}))[s.UPPER=0]="UPPER",s[s.LOWER=1]="LOWER",s[s.MIXED=2]="MIXED",s[s.DIGIT=3]="DIGIT",s[s.PUNCT=4]="PUNCT",s[s.BINARY=5]="BINARY";class ef{decode(e){this.ddata=e;let t=e.getBits(),r=this.extractBits(t),n=this.correctBits(r),i=new eo(ef.convertBoolArrayToByteArray(n),ef.getEncodedData(n),null,null);return i.setNumBits(n.length),i}static highLevelDecode(e){return this.getEncodedData(e)}static getEncodedData(e){let t=e.length,r=C.UPPER,n=C.UPPER,i="",o=0;for(;o<t;)if(n===C.BINARY){if(t-o<5)break;let a=ef.readCode(e,o,5);if(o+=5,0===a){if(t-o<11)break;a=ef.readCode(e,o,11)+31,o+=11}for(let r=0;r<a;r++){if(t-o<8){o=t;break}let r=ef.readCode(e,o,8);i+=G.castAsNonUtf8Char(r),o+=8}n=r}else{let a=n===C.DIGIT?4:5;if(t-o<a)break;let s=ef.readCode(e,o,a);o+=a;let l=ef.getCharacter(n,s);l.startsWith("CTRL_")?(r=n,n=ef.getTable(l.charAt(5)),"L"===l.charAt(6)&&(r=n)):(i+=l,n=r)}return i}static getTable(e){switch(e){case"L":return C.LOWER;case"P":return C.PUNCT;case"M":return C.MIXED;case"D":return C.DIGIT;case"B":return C.BINARY;default:return C.UPPER}}static getCharacter(e,t){switch(e){case C.UPPER:return ef.UPPER_TABLE[t];case C.LOWER:return ef.LOWER_TABLE[t];case C.MIXED:return ef.MIXED_TABLE[t];case C.PUNCT:return ef.PUNCT_TABLE[t];case C.DIGIT:return ef.DIGIT_TABLE[t];default:throw new eh("Bad table")}}correctBits(e){let t,r;2>=this.ddata.getNbLayers()?(r=6,t=ec.AZTEC_DATA_6):8>=this.ddata.getNbLayers()?(r=8,t=ec.AZTEC_DATA_8):22>=this.ddata.getNbLayers()?(r=10,t=ec.AZTEC_DATA_10):(r=12,t=ec.AZTEC_DATA_12);let n=this.ddata.getNbDatablocks(),i=e.length/r;if(i<n)throw new H;let o=e.length%r,a=new Int32Array(i);for(let t=0;t<i;t++,o+=r)a[t]=ef.readCode(e,o,r);try{new ed(t).decode(a,i-n)}catch(e){throw new H(e)}let s=(1<<r)-1,l=0;for(let e=0;e<n;e++){let t=a[e];if(0===t||t===s)throw new H;(1===t||t===s-1)&&l++}let c=Array(n*r-l),u=0;for(let e=0;e<n;e++){let t=a[e];if(1===t||t===s-1)c.fill(t>1,u,u+r-1),u+=r-1;else for(let e=r-1;e>=0;--e)c[u++]=(t&1<<e)!=0}return c}extractBits(e){let t=this.ddata.isCompact(),r=this.ddata.getNbLayers(),n=(t?11:14)+4*r,i=new Int32Array(n),o=Array(this.totalBitsInLayer(r,t));if(t)for(let e=0;e<i.length;e++)i[e]=e;else{let e=n+1+2*k.truncDivision(k.truncDivision(n,2)-1,15),t=n/2,r=k.truncDivision(e,2);for(let e=0;e<t;e++){let n=e+k.truncDivision(e,15);i[t-e-1]=r-n-1,i[t+e]=r+n+1}}for(let a=0,s=0;a<r;a++){let l=(r-a)*4+(t?9:12),c=2*a,u=n-1-c;for(let t=0;t<l;t++){let r=2*t;for(let n=0;n<2;n++)o[s+r+n]=e.get(i[c+n],i[c+t]),o[s+2*l+r+n]=e.get(i[c+t],i[u-n]),o[s+4*l+r+n]=e.get(i[u-n],i[u-t]),o[s+6*l+r+n]=e.get(i[u-t],i[c+n])}s+=8*l}return o}static readCode(e,t,r){let n=0;for(let i=t;i<t+r;i++)n<<=1,e[i]&&(n|=1);return n}static readByte(e,t){let r=e.length-t;return r>=8?ef.readCode(e,t,8):ef.readCode(e,t,r)<<8-r}static convertBoolArrayToByteArray(e){let t=new Uint8Array((e.length+7)/8);for(let r=0;r<t.length;r++)t[r]=ef.readByte(e,8*r);return t}totalBitsInLayer(e,t){return((t?88:112)+16*e)*e}}ef.UPPER_TABLE=["CTRL_PS"," ","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","CTRL_LL","CTRL_ML","CTRL_DL","CTRL_BS"],ef.LOWER_TABLE=["CTRL_PS"," ","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","CTRL_US","CTRL_ML","CTRL_DL","CTRL_BS"],ef.MIXED_TABLE=["CTRL_PS"," ","\\1","\\2","\\3","\\4","\\5","\\6","\\7","\b"," ","\n","\\13","\f","\r","\\33","\\34","\\35","\\36","\\37","@","\\","^","_","`","|","~","\\177","CTRL_LL","CTRL_UL","CTRL_PL","CTRL_BS"],ef.PUNCT_TABLE=["","\r","\r\n",". ",", ",": ","!",'"',"#","$","%","&","'","(",")","*","+",",","-",".","/",":",";","<","=",">","?","[","]","{","}","CTRL_UL"],ef.DIGIT_TABLE=["CTRL_PS"," ","0","1","2","3","4","5","6","7","8","9",",",".","CTRL_UL","CTRL_US"];class eg{constructor(){}static round(e){return e<=Number.MIN_SAFE_INTEGER?Number.MIN_SAFE_INTEGER:e>=Number.MAX_SAFE_INTEGER?Number.MAX_SAFE_INTEGER:e+(e<0?-.5:.5)|0}static distance(e,t,r,n){let i=e-r,o=t-n;return Math.sqrt(i*i+o*o)}static sum(e){let t=0;for(let r=0,n=e.length;r!==n;r++)t+=e[r];return t}}class ep{static floatToIntBits(e){return e}}ep.MAX_VALUE=Number.MAX_SAFE_INTEGER;class em{constructor(e,t){this.x=e,this.y=t}getX(){return this.x}getY(){return this.y}equals(e){return e instanceof em&&this.x===e.x&&this.y===e.y}hashCode(){return 31*ep.floatToIntBits(this.x)+ep.floatToIntBits(this.y)}toString(){return"("+this.x+","+this.y+")"}static orderBestPatterns(e){let t,r,n,i=this.distance(e[0],e[1]),o=this.distance(e[1],e[2]),a=this.distance(e[0],e[2]);if(o>=i&&o>=a?(r=e[0],t=e[1],n=e[2]):a>=o&&a>=i?(r=e[1],t=e[0],n=e[2]):(r=e[2],t=e[0],n=e[1]),0>this.crossProductZ(t,r,n)){let e=t;t=n,n=e}e[0]=t,e[1]=r,e[2]=n}static distance(e,t){return eg.distance(e.x,e.y,t.x,t.y)}static crossProductZ(e,t,r){let n=t.x,i=t.y;return(r.x-n)*(e.y-i)-(r.y-i)*(e.x-n)}}class ew{constructor(e,t){this.bits=e,this.points=t}getBits(){return this.bits}getPoints(){return this.points}}class eC extends ew{constructor(e,t,r,n,i){super(e,t),this.compact=r,this.nbDatablocks=n,this.nbLayers=i}getNbLayers(){return this.nbLayers}getNbDatablocks(){return this.nbDatablocks}isCompact(){return this.compact}}class eE{constructor(e,t,r,n){this.image=e,this.height=e.getHeight(),this.width=e.getWidth(),null==t&&(t=eE.INIT_SIZE),null==r&&(r=e.getWidth()/2|0),null==n&&(n=e.getHeight()/2|0);let i=t/2|0;if(this.leftInit=r-i,this.rightInit=r+i,this.upInit=n-i,this.downInit=n+i,this.upInit<0||this.leftInit<0||this.downInit>=this.height||this.rightInit>=this.width)throw new X}detect(){let e=this.leftInit,t=this.rightInit,r=this.upInit,n=this.downInit,i=!1,o=!0,a=!1,s=!1,l=!1,c=!1,u=!1,h=this.width,d=this.height;for(;o;){o=!1;let f=!0;for(;(f||!s)&&t<h;)(f=this.containsBlackPoint(r,n,t,!1))?(t++,o=!0,s=!0):!s&&t++;if(t>=h){i=!0;break}let g=!0;for(;(g||!l)&&n<d;)(g=this.containsBlackPoint(e,t,n,!0))?(n++,o=!0,l=!0):!l&&n++;if(n>=d){i=!0;break}let p=!0;for(;(p||!c)&&e>=0;)(p=this.containsBlackPoint(r,n,e,!1))?(e--,o=!0,c=!0):!c&&e--;if(e<0){i=!0;break}let m=!0;for(;(m||!u)&&r>=0;)(m=this.containsBlackPoint(e,t,r,!0))?(r--,o=!0,u=!0):!u&&r--;if(r<0){i=!0;break}o&&(a=!0)}if(!i&&a){let i=t-e,o=null;for(let t=1;null===o&&t<i;t++)o=this.getBlackPointOnSegment(e,n-t,e+t,n);if(null==o)throw new X;let a=null;for(let t=1;null===a&&t<i;t++)a=this.getBlackPointOnSegment(e,r+t,e+t,r);if(null==a)throw new X;let s=null;for(let e=1;null===s&&e<i;e++)s=this.getBlackPointOnSegment(t,r+e,t-e,r);if(null==s)throw new X;let l=null;for(let e=1;null===l&&e<i;e++)l=this.getBlackPointOnSegment(t,n-e,t-e,n);if(null==l)throw new X;return this.centerEdges(l,o,s,a)}throw new X}getBlackPointOnSegment(e,t,r,n){let i=eg.round(eg.distance(e,t,r,n)),o=(r-e)/i,a=(n-t)/i,s=this.image;for(let r=0;r<i;r++){let n=eg.round(e+r*o),i=eg.round(t+r*a);if(s.get(n,i))return new em(n,i)}return null}centerEdges(e,t,r,n){let i=e.getX(),o=e.getY(),a=t.getX(),s=t.getY(),l=r.getX(),c=r.getY(),u=n.getX(),h=n.getY(),d=eE.CORR;return i<this.width/2?[new em(u-d,h+d),new em(a+d,s+d),new em(l-d,c-d),new em(i+d,o-d)]:[new em(u+d,h+d),new em(a+d,s-d),new em(l-d,c+d),new em(i-d,o-d)]}containsBlackPoint(e,t,r,n){let i=this.image;if(n){for(let n=e;n<=t;n++)if(i.get(n,r))return!0}else for(let n=e;n<=t;n++)if(i.get(r,n))return!0;return!1}}eE.INIT_SIZE=10,eE.CORR=1;class eA{static checkAndNudgePoints(e,t){let r=e.getWidth(),n=e.getHeight(),i=!0;for(let e=0;e<t.length&&i;e+=2){let o=Math.floor(t[e]),a=Math.floor(t[e+1]);if(o<-1||o>r||a<-1||a>n)throw new X;i=!1,-1===o?(t[e]=0,i=!0):o===r&&(t[e]=r-1,i=!0),-1===a?(t[e+1]=0,i=!0):a===n&&(t[e+1]=n-1,i=!0)}i=!0;for(let e=t.length-2;e>=0&&i;e-=2){let o=Math.floor(t[e]),a=Math.floor(t[e+1]);if(o<-1||o>r||a<-1||a>n)throw new X;i=!1,-1===o?(t[e]=0,i=!0):o===r&&(t[e]=r-1,i=!0),-1===a?(t[e+1]=0,i=!0):a===n&&(t[e+1]=n-1,i=!0)}}}class ey{constructor(e,t,r,n,i,o,a,s,l){this.a11=e,this.a21=t,this.a31=r,this.a12=n,this.a22=i,this.a32=o,this.a13=a,this.a23=s,this.a33=l}static quadrilateralToQuadrilateral(e,t,r,n,i,o,a,s,l,c,u,h,d,f,g,p){let m=ey.quadrilateralToSquare(e,t,r,n,i,o,a,s);return ey.squareToQuadrilateral(l,c,u,h,d,f,g,p).times(m)}transformPoints(e){let t=e.length,r=this.a11,n=this.a12,i=this.a13,o=this.a21,a=this.a22,s=this.a23,l=this.a31,c=this.a32,u=this.a33;for(let h=0;h<t;h+=2){let t=e[h],d=e[h+1],f=i*t+s*d+u;e[h]=(r*t+o*d+l)/f,e[h+1]=(n*t+a*d+c)/f}}transformPointsWithValues(e,t){let r=this.a11,n=this.a12,i=this.a13,o=this.a21,a=this.a22,s=this.a23,l=this.a31,c=this.a32,u=this.a33,h=e.length;for(let d=0;d<h;d++){let h=e[d],f=t[d],g=i*h+s*f+u;e[d]=(r*h+o*f+l)/g,t[d]=(n*h+a*f+c)/g}}static squareToQuadrilateral(e,t,r,n,i,o,a,s){let l=e-r+i-a,c=t-n+o-s;if(0===l&&0===c)return new ey(r-e,i-r,e,n-t,o-n,t,0,0,1);{let u=r-i,h=a-i,d=n-o,f=s-o,g=u*f-h*d,p=(l*f-h*c)/g,m=(u*c-l*d)/g;return new ey(r-e+p*r,a-e+m*a,e,n-t+p*n,s-t+m*s,t,p,m,1)}}static quadrilateralToSquare(e,t,r,n,i,o,a,s){return ey.squareToQuadrilateral(e,t,r,n,i,o,a,s).buildAdjoint()}buildAdjoint(){return new ey(this.a22*this.a33-this.a23*this.a32,this.a23*this.a31-this.a21*this.a33,this.a21*this.a32-this.a22*this.a31,this.a13*this.a32-this.a12*this.a33,this.a11*this.a33-this.a13*this.a31,this.a12*this.a31-this.a11*this.a32,this.a12*this.a23-this.a13*this.a22,this.a13*this.a21-this.a11*this.a23,this.a11*this.a22-this.a12*this.a21)}times(e){return new ey(this.a11*e.a11+this.a21*e.a12+this.a31*e.a13,this.a11*e.a21+this.a21*e.a22+this.a31*e.a23,this.a11*e.a31+this.a21*e.a32+this.a31*e.a33,this.a12*e.a11+this.a22*e.a12+this.a32*e.a13,this.a12*e.a21+this.a22*e.a22+this.a32*e.a23,this.a12*e.a31+this.a22*e.a32+this.a32*e.a33,this.a13*e.a11+this.a23*e.a12+this.a33*e.a13,this.a13*e.a21+this.a23*e.a22+this.a33*e.a23,this.a13*e.a31+this.a23*e.a32+this.a33*e.a33)}}class eI extends eA{sampleGrid(e,t,r,n,i,o,a,s,l,c,u,h,d,f,g,p,m,w,C){let E=ey.quadrilateralToQuadrilateral(n,i,o,a,s,l,c,u,h,d,f,g,p,m,w,C);return this.sampleGridWithTransform(e,t,r,E)}sampleGridWithTransform(e,t,r,n){if(t<=0||r<=0)throw new X;let i=new Y(t,r),o=new Float32Array(2*t);for(let t=0;t<r;t++){let r=o.length,a=t+.5;for(let e=0;e<r;e+=2)o[e]=e/2+.5,o[e+1]=a;n.transformPoints(o),eA.checkAndNudgePoints(e,o);try{for(let n=0;n<r;n+=2)e.get(Math.floor(o[n]),Math.floor(o[n+1]))&&i.set(n/2,t)}catch(e){throw new X}}return i}}class eS{static setGridSampler(e){eS.gridSampler=e}static getInstance(){return eS.gridSampler}}eS.gridSampler=new eI;class e_{constructor(e,t){this.x=e,this.y=t}toResultPoint(){return new em(this.getX(),this.getY())}getX(){return this.x}getY(){return this.y}}class eb{constructor(e){this.EXPECTED_CORNER_BITS=new Int32Array([3808,476,2107,1799]),this.image=e}detect(){return this.detectMirror(!1)}detectMirror(e){let t=this.getMatrixCenter(),r=this.getBullsEyeCorners(t);if(e){let e=r[0];r[0]=r[2],r[2]=e}return this.extractParameters(r),new eC(this.sampleGrid(this.image,r[this.shift%4],r[(this.shift+1)%4],r[(this.shift+2)%4],r[(this.shift+3)%4]),this.getMatrixCornerPoints(r),this.compact,this.nbDataBlocks,this.nbLayers)}extractParameters(e){if(!this.isValidPoint(e[0])||!this.isValidPoint(e[1])||!this.isValidPoint(e[2])||!this.isValidPoint(e[3]))throw new X;let t=2*this.nbCenterLayers,r=new Int32Array([this.sampleLine(e[0],e[1],t),this.sampleLine(e[1],e[2],t),this.sampleLine(e[2],e[3],t),this.sampleLine(e[3],e[0],t)]);this.shift=this.getRotation(r,t);let n=0;for(let e=0;e<4;e++){let t=r[(this.shift+e)%4];this.compact?(n<<=7,n+=t>>1&127):(n<<=10,n+=(t>>2&992)+(t>>1&31))}let i=this.getCorrectedParameterData(n,this.compact);this.compact?(this.nbLayers=(i>>6)+1,this.nbDataBlocks=(63&i)+1):(this.nbLayers=(i>>11)+1,this.nbDataBlocks=(2047&i)+1)}getRotation(e,t){let r=0;e.forEach((e,n,i)=>{r=(r<<3)+((e>>t-2<<1)+(1&e))}),r=((1&r)<<11)+(r>>1);for(let e=0;e<4;e++)if(2>=k.bitCount(r^this.EXPECTED_CORNER_BITS[e]))return e;throw new X}getCorrectedParameterData(e,t){let r,n;t?(r=7,n=2):(r=10,n=4);let i=r-n,o=new Int32Array(r);for(let t=r-1;t>=0;--t)o[t]=15&e,e>>=4;try{new ed(ec.AZTEC_PARAM).decode(o,i)}catch(e){throw new X}let a=0;for(let e=0;e<n;e++)a=(a<<4)+o[e];return a}getBullsEyeCorners(e){let t=e,r=e,n=e,i=e,o=!0;for(this.nbCenterLayers=1;this.nbCenterLayers<9;this.nbCenterLayers++){let e=this.getFirstDifferent(t,o,1,-1),a=this.getFirstDifferent(r,o,1,1),s=this.getFirstDifferent(n,o,-1,1),l=this.getFirstDifferent(i,o,-1,-1);if(this.nbCenterLayers>2){let r=this.distancePoint(l,e)*this.nbCenterLayers/(this.distancePoint(i,t)*(this.nbCenterLayers+2));if(r<.75||r>1.25||!this.isWhiteOrBlackRectangle(e,a,s,l))break}t=e,r=a,n=s,i=l,o=!o}if(5!==this.nbCenterLayers&&7!==this.nbCenterLayers)throw new X;this.compact=5===this.nbCenterLayers;let a=new em(t.getX()+.5,t.getY()-.5),s=new em(r.getX()+.5,r.getY()+.5),l=new em(n.getX()-.5,n.getY()+.5),c=new em(i.getX()-.5,i.getY()-.5);return this.expandSquare([a,s,l,c],2*this.nbCenterLayers-3,2*this.nbCenterLayers)}getMatrixCenter(){let e,t,r,n;try{let i=new eE(this.image).detect();e=i[0],t=i[1],r=i[2],n=i[3]}catch(a){let i=this.image.getWidth()/2,o=this.image.getHeight()/2;e=this.getFirstDifferent(new e_(i+7,o-7),!1,1,-1).toResultPoint(),t=this.getFirstDifferent(new e_(i+7,o+7),!1,1,1).toResultPoint(),r=this.getFirstDifferent(new e_(i-7,o+7),!1,-1,1).toResultPoint(),n=this.getFirstDifferent(new e_(i-7,o-7),!1,-1,-1).toResultPoint()}let i=eg.round((e.getX()+n.getX()+t.getX()+r.getX())/4),o=eg.round((e.getY()+n.getY()+t.getY()+r.getY())/4);try{let a=new eE(this.image,15,i,o).detect();e=a[0],t=a[1],r=a[2],n=a[3]}catch(a){e=this.getFirstDifferent(new e_(i+7,o-7),!1,1,-1).toResultPoint(),t=this.getFirstDifferent(new e_(i+7,o+7),!1,1,1).toResultPoint(),r=this.getFirstDifferent(new e_(i-7,o+7),!1,-1,1).toResultPoint(),n=this.getFirstDifferent(new e_(i-7,o-7),!1,-1,-1).toResultPoint()}return new e_(i=eg.round((e.getX()+n.getX()+t.getX()+r.getX())/4),o=eg.round((e.getY()+n.getY()+t.getY()+r.getY())/4))}getMatrixCornerPoints(e){return this.expandSquare(e,2*this.nbCenterLayers,this.getDimension())}sampleGrid(e,t,r,n,i){let o=eS.getInstance(),a=this.getDimension(),s=a/2-this.nbCenterLayers,l=a/2+this.nbCenterLayers;return o.sampleGrid(e,a,a,s,s,l,s,l,l,s,l,t.getX(),t.getY(),r.getX(),r.getY(),n.getX(),n.getY(),i.getX(),i.getY())}sampleLine(e,t,r){let n=0,i=this.distanceResultPoint(e,t),o=i/r,a=e.getX(),s=e.getY(),l=o*(t.getX()-e.getX())/i,c=o*(t.getY()-e.getY())/i;for(let e=0;e<r;e++)this.image.get(eg.round(a+e*l),eg.round(s+e*c))&&(n|=1<<r-e-1);return n}isWhiteOrBlackRectangle(e,t,r,n){e=new e_(e.getX()-3,e.getY()+3),t=new e_(t.getX()-3,t.getY()-3),r=new e_(r.getX()+3,r.getY()-3),n=new e_(n.getX()+3,n.getY()+3);let i=this.getColor(n,e);if(0===i)return!1;let o=this.getColor(e,t);return o===i&&(o=this.getColor(t,r))===i&&(o=this.getColor(r,n))===i}getColor(e,t){let r=this.distancePoint(e,t),n=(t.getX()-e.getX())/r,i=(t.getY()-e.getY())/r,o=0,a=e.getX(),s=e.getY(),l=this.image.get(e.getX(),e.getY()),c=Math.ceil(r);for(let e=0;e<c;e++)a+=n,s+=i,this.image.get(eg.round(a),eg.round(s))!==l&&o++;let u=o/r;return u>.1&&u<.9?0:u<=.1===l?1:-1}getFirstDifferent(e,t,r,n){let i=e.getX()+r,o=e.getY()+n;for(;this.isValid(i,o)&&this.image.get(i,o)===t;)i+=r,o+=n;for(i-=r,o-=n;this.isValid(i,o)&&this.image.get(i,o)===t;)i+=r;for(i-=r;this.isValid(i,o)&&this.image.get(i,o)===t;)o+=n;return new e_(i,o-=n)}expandSquare(e,t,r){let n=r/(2*t),i=e[0].getX()-e[2].getX(),o=e[0].getY()-e[2].getY(),a=(e[0].getX()+e[2].getX())/2,s=(e[0].getY()+e[2].getY())/2,l=new em(a+n*i,s+n*o),c=new em(a-n*i,s-n*o);return i=e[1].getX()-e[3].getX(),o=e[1].getY()-e[3].getY(),[l,new em((a=(e[1].getX()+e[3].getX())/2)+n*i,(s=(e[1].getY()+e[3].getY())/2)+n*o),c,new em(a-n*i,s-n*o)]}isValid(e,t){return e>=0&&e<this.image.getWidth()&&t>0&&t<this.image.getHeight()}isValidPoint(e){let t=eg.round(e.getX()),r=eg.round(e.getY());return this.isValid(t,r)}distancePoint(e,t){return eg.distance(e.getX(),e.getY(),t.getX(),t.getY())}distanceResultPoint(e,t){return eg.distance(e.getX(),e.getY(),t.getX(),t.getY())}getDimension(){return this.compact?4*this.nbLayers+11:this.nbLayers<=4?4*this.nbLayers+15:4*this.nbLayers+2*(k.truncDivision(this.nbLayers-4,8)+1)+15}}class eT{decode(e,t=null){let r=null,n=new eb(e.getBlackMatrix()),i=null,o=null;try{let e=n.detectMirror(!1);i=e.getPoints(),this.reportFoundResultPoints(t,i),o=new ef().decode(e)}catch(e){r=e}if(null==o)try{let e=n.detectMirror(!0);i=e.getPoints(),this.reportFoundResultPoints(t,i),o=new ef().decode(e)}catch(e){if(null!=r)throw r;throw e}let a=new er(o.getText(),o.getRawBytes(),o.getNumBits(),i,en.AZTEC,P.currentTimeMillis()),s=o.getByteSegments();null!=s&&a.putMetadata(ei.BYTE_SEGMENTS,s);let l=o.getECLevel();return null!=l&&a.putMetadata(ei.ERROR_CORRECTION_LEVEL,l),a}reportFoundResultPoints(e,t){if(null!=e){let r=e.get(U.NEED_RESULT_POINT_CALLBACK);null!=r&&t.forEach((e,t,n)=>{r.foundPossibleResultPoint(e)})}}reset(){}}class eN{decode(e,t){try{return this.doDecode(e,t)}catch(r){if(t&&!0===t.get(U.TRY_HARDER)&&e.isRotateSupported()){let r=e.rotateCounterClockwise(),n=this.doDecode(r,t),i=n.getResultMetadata(),o=270;null!==i&&!0===i.get(ei.ORIENTATION)&&(o+=i.get(ei.ORIENTATION)%360),n.putMetadata(ei.ORIENTATION,o);let a=n.getResultPoints();if(null!==a){let e=r.getHeight();for(let t=0;t<a.length;t++)a[t]=new em(e-a[t].getY()-1,a[t].getX())}return n}throw new X}}reset(){}doDecode(e,t){let r,n=e.getWidth(),i=e.getHeight(),o=new F(n),a=t&&!0===t.get(U.TRY_HARDER),s=Math.max(1,i>>(a?8:5));r=a?i:15;let l=Math.trunc(i/2);for(let a=0;a<r;a++){let r=Math.trunc((a+1)/2),c=l+s*((1&a)==0?r:-r);if(c<0||c>=i)break;try{o=e.getBlackRow(c,o)}catch(e){continue}for(let e=0;e<2;e++){if(1===e&&(o.reverse(),t&&!0===t.get(U.NEED_RESULT_POINT_CALLBACK))){let e=new Map;t.forEach((t,r)=>e.set(r,t)),e.delete(U.NEED_RESULT_POINT_CALLBACK),t=e}try{let r=this.decodeRow(c,o,t);if(1===e){r.putMetadata(ei.ORIENTATION,180);let e=r.getResultPoints();null!==e&&(e[0]=new em(n-e[0].getX()-1,e[0].getY()),e[1]=new em(n-e[1].getX()-1,e[1].getY()))}return r}catch(e){}}}throw new X}static recordPattern(e,t,r){let n=r.length;for(let e=0;e<n;e++)r[e]=0;let i=e.getSize();if(t>=i)throw new X;let o=!e.get(t),a=0,s=t;for(;s<i;){if(e.get(s)!==o)r[a]++;else if(++a===n)break;else r[a]=1,o=!o;s++}if(a!==n&&(a!==n-1||s!==i))throw new X}static recordPatternInReverse(e,t,r){let n=r.length,i=e.get(t);for(;t>0&&n>=0;)e.get(--t)!==i&&(n--,i=!i);if(n>=0)throw new X;eN.recordPattern(e,t+1,r)}static patternMatchVariance(e,t,r){let n=e.length,i=0,o=0;for(let r=0;r<n;r++)i+=e[r],o+=t[r];if(i<o)return Number.POSITIVE_INFINITY;let a=i/o;r*=a;let s=0;for(let i=0;i<n;i++){let n=e[i],o=t[i]*a,l=n>o?n-o:o-n;if(l>r)return Number.POSITIVE_INFINITY;s+=l}return s/i}}class eM extends eN{static findStartPattern(e){let t=e.getSize(),r=e.getNextSet(0),n=0,i=Int32Array.from([0,0,0,0,0,0]),o=r,a=!1;for(let s=r;s<t;s++)if(e.get(s)!==a)i[n]++;else{if(5===n){let t=eM.MAX_AVG_VARIANCE,r=-1;for(let e=eM.CODE_START_A;e<=eM.CODE_START_C;e++){let n=eN.patternMatchVariance(i,eM.CODE_PATTERNS[e],eM.MAX_INDIVIDUAL_VARIANCE);n<t&&(t=n,r=e)}if(r>=0&&e.isRange(Math.max(0,o-(s-o)/2),o,!1))return Int32Array.from([o,s,r]);o+=i[0]+i[1],(i=i.slice(2,i.length-1))[n-1]=0,i[n]=0,n--}else n++;i[n]=1,a=!a}throw new X}static decodeCode(e,t,r){eN.recordPattern(e,r,t);let n=eM.MAX_AVG_VARIANCE,i=-1;for(let e=0;e<eM.CODE_PATTERNS.length;e++){let r=eM.CODE_PATTERNS[e],o=this.patternMatchVariance(t,r,eM.MAX_INDIVIDUAL_VARIANCE);o<n&&(n=o,i=e)}if(i>=0)return i;throw new X}decodeRow(e,t,r){let n,i=r&&!0===r.get(U.ASSUME_GS1),o=eM.findStartPattern(t),a=o[2],s=0,l=new Uint8Array(20);switch(l[s++]=a,a){case eM.CODE_START_A:n=eM.CODE_CODE_A;break;case eM.CODE_START_B:n=eM.CODE_CODE_B;break;case eM.CODE_START_C:n=eM.CODE_CODE_C;break;default:throw new H}let c=!1,u=!1,h="",d=o[0],f=o[1],g=Int32Array.from([0,0,0,0,0,0]),p=0,m=0,w=a,C=0,E=!0,A=!1,y=!1;for(;!c;){let e=u;switch(u=!1,p=m,m=eM.decodeCode(t,g,f),l[s++]=m,m!==eM.CODE_STOP&&(E=!0),m!==eM.CODE_STOP&&(w+=++C*m),d=f,f+=g.reduce((e,t)=>e+t,0),m){case eM.CODE_START_A:case eM.CODE_START_B:case eM.CODE_START_C:throw new H}switch(n){case eM.CODE_CODE_A:if(m<64)y===A?h+=String.fromCharCode(32+m):h+=String.fromCharCode(32+m+128),y=!1;else if(m<96)y===A?h+=String.fromCharCode(m-64):h+=String.fromCharCode(m+64),y=!1;else switch(m!==eM.CODE_STOP&&(E=!1),m){case eM.CODE_FNC_1:i&&(0===h.length?h+="]C1":h+="\x1d");break;case eM.CODE_FNC_2:case eM.CODE_FNC_3:break;case eM.CODE_FNC_4_A:!A&&y?(A=!0,y=!1):A&&y?(A=!1,y=!1):y=!0;break;case eM.CODE_SHIFT:u=!0,n=eM.CODE_CODE_B;break;case eM.CODE_CODE_B:n=eM.CODE_CODE_B;break;case eM.CODE_CODE_C:n=eM.CODE_CODE_C;break;case eM.CODE_STOP:c=!0}break;case eM.CODE_CODE_B:if(m<96)y===A?h+=String.fromCharCode(32+m):h+=String.fromCharCode(32+m+128),y=!1;else switch(m!==eM.CODE_STOP&&(E=!1),m){case eM.CODE_FNC_1:i&&(0===h.length?h+="]C1":h+="\x1d");break;case eM.CODE_FNC_2:case eM.CODE_FNC_3:break;case eM.CODE_FNC_4_B:!A&&y?(A=!0,y=!1):A&&y?(A=!1,y=!1):y=!0;break;case eM.CODE_SHIFT:u=!0,n=eM.CODE_CODE_A;break;case eM.CODE_CODE_A:n=eM.CODE_CODE_A;break;case eM.CODE_CODE_C:n=eM.CODE_CODE_C;break;case eM.CODE_STOP:c=!0}break;case eM.CODE_CODE_C:if(m<100)m<10&&(h+="0"),h+=m;else switch(m!==eM.CODE_STOP&&(E=!1),m){case eM.CODE_FNC_1:i&&(0===h.length?h+="]C1":h+="\x1d");break;case eM.CODE_CODE_A:n=eM.CODE_CODE_A;break;case eM.CODE_CODE_B:n=eM.CODE_CODE_B;break;case eM.CODE_STOP:c=!0}}e&&(n=n===eM.CODE_CODE_A?eM.CODE_CODE_B:eM.CODE_CODE_A)}let I=f-d;if(f=t.getNextUnset(f),!t.isRange(f,Math.min(t.getSize(),f+(f-d)/2),!1))throw new X;if((w-=C*p)%103!==p)throw new R;let S=h.length;if(0===S)throw new X;S>0&&E&&(h=n===eM.CODE_CODE_C?h.substring(0,S-2):h.substring(0,S-1));let _=(o[1]+o[0])/2,b=d+I/2,T=l.length,N=new Uint8Array(T);for(let e=0;e<T;e++)N[e]=l[e];return new er(h,N,0,[new em(_,e),new em(b,e)],en.CODE_128,new Date().getTime())}}eM.CODE_PATTERNS=[Int32Array.from([2,1,2,2,2,2]),Int32Array.from([2,2,2,1,2,2]),Int32Array.from([2,2,2,2,2,1]),Int32Array.from([1,2,1,2,2,3]),Int32Array.from([1,2,1,3,2,2]),Int32Array.from([1,3,1,2,2,2]),Int32Array.from([1,2,2,2,1,3]),Int32Array.from([1,2,2,3,1,2]),Int32Array.from([1,3,2,2,1,2]),Int32Array.from([2,2,1,2,1,3]),Int32Array.from([2,2,1,3,1,2]),Int32Array.from([2,3,1,2,1,2]),Int32Array.from([1,1,2,2,3,2]),Int32Array.from([1,2,2,1,3,2]),Int32Array.from([1,2,2,2,3,1]),Int32Array.from([1,1,3,2,2,2]),Int32Array.from([1,2,3,1,2,2]),Int32Array.from([1,2,3,2,2,1]),Int32Array.from([2,2,3,2,1,1]),Int32Array.from([2,2,1,1,3,2]),Int32Array.from([2,2,1,2,3,1]),Int32Array.from([2,1,3,2,1,2]),Int32Array.from([2,2,3,1,1,2]),Int32Array.from([3,1,2,1,3,1]),Int32Array.from([3,1,1,2,2,2]),Int32Array.from([3,2,1,1,2,2]),Int32Array.from([3,2,1,2,2,1]),Int32Array.from([3,1,2,2,1,2]),Int32Array.from([3,2,2,1,1,2]),Int32Array.from([3,2,2,2,1,1]),Int32Array.from([2,1,2,1,2,3]),Int32Array.from([2,1,2,3,2,1]),Int32Array.from([2,3,2,1,2,1]),Int32Array.from([1,1,1,3,2,3]),Int32Array.from([1,3,1,1,2,3]),Int32Array.from([1,3,1,3,2,1]),Int32Array.from([1,1,2,3,1,3]),Int32Array.from([1,3,2,1,1,3]),Int32Array.from([1,3,2,3,1,1]),Int32Array.from([2,1,1,3,1,3]),Int32Array.from([2,3,1,1,1,3]),Int32Array.from([2,3,1,3,1,1]),Int32Array.from([1,1,2,1,3,3]),Int32Array.from([1,1,2,3,3,1]),Int32Array.from([1,3,2,1,3,1]),Int32Array.from([1,1,3,1,2,3]),Int32Array.from([1,1,3,3,2,1]),Int32Array.from([1,3,3,1,2,1]),Int32Array.from([3,1,3,1,2,1]),Int32Array.from([2,1,1,3,3,1]),Int32Array.from([2,3,1,1,3,1]),Int32Array.from([2,1,3,1,1,3]),Int32Array.from([2,1,3,3,1,1]),Int32Array.from([2,1,3,1,3,1]),Int32Array.from([3,1,1,1,2,3]),Int32Array.from([3,1,1,3,2,1]),Int32Array.from([3,3,1,1,2,1]),Int32Array.from([3,1,2,1,1,3]),Int32Array.from([3,1,2,3,1,1]),Int32Array.from([3,3,2,1,1,1]),Int32Array.from([3,1,4,1,1,1]),Int32Array.from([2,2,1,4,1,1]),Int32Array.from([4,3,1,1,1,1]),Int32Array.from([1,1,1,2,2,4]),Int32Array.from([1,1,1,4,2,2]),Int32Array.from([1,2,1,1,2,4]),Int32Array.from([1,2,1,4,2,1]),Int32Array.from([1,4,1,1,2,2]),Int32Array.from([1,4,1,2,2,1]),Int32Array.from([1,1,2,2,1,4]),Int32Array.from([1,1,2,4,1,2]),Int32Array.from([1,2,2,1,1,4]),Int32Array.from([1,2,2,4,1,1]),Int32Array.from([1,4,2,1,1,2]),Int32Array.from([1,4,2,2,1,1]),Int32Array.from([2,4,1,2,1,1]),Int32Array.from([2,2,1,1,1,4]),Int32Array.from([4,1,3,1,1,1]),Int32Array.from([2,4,1,1,1,2]),Int32Array.from([1,3,4,1,1,1]),Int32Array.from([1,1,1,2,4,2]),Int32Array.from([1,2,1,1,4,2]),Int32Array.from([1,2,1,2,4,1]),Int32Array.from([1,1,4,2,1,2]),Int32Array.from([1,2,4,1,1,2]),Int32Array.from([1,2,4,2,1,1]),Int32Array.from([4,1,1,2,1,2]),Int32Array.from([4,2,1,1,1,2]),Int32Array.from([4,2,1,2,1,1]),Int32Array.from([2,1,2,1,4,1]),Int32Array.from([2,1,4,1,2,1]),Int32Array.from([4,1,2,1,2,1]),Int32Array.from([1,1,1,1,4,3]),Int32Array.from([1,1,1,3,4,1]),Int32Array.from([1,3,1,1,4,1]),Int32Array.from([1,1,4,1,1,3]),Int32Array.from([1,1,4,3,1,1]),Int32Array.from([4,1,1,1,1,3]),Int32Array.from([4,1,1,3,1,1]),Int32Array.from([1,1,3,1,4,1]),Int32Array.from([1,1,4,1,3,1]),Int32Array.from([3,1,1,1,4,1]),Int32Array.from([4,1,1,1,3,1]),Int32Array.from([2,1,1,4,1,2]),Int32Array.from([2,1,1,2,1,4]),Int32Array.from([2,1,1,2,3,2]),Int32Array.from([2,3,3,1,1,1,2])],eM.MAX_AVG_VARIANCE=.25,eM.MAX_INDIVIDUAL_VARIANCE=.7,eM.CODE_SHIFT=98,eM.CODE_CODE_C=99,eM.CODE_CODE_B=100,eM.CODE_CODE_A=101,eM.CODE_FNC_1=102,eM.CODE_FNC_2=97,eM.CODE_FNC_3=96,eM.CODE_FNC_4_A=101,eM.CODE_FNC_4_B=100,eM.CODE_START_A=103,eM.CODE_START_B=104,eM.CODE_START_C=105,eM.CODE_STOP=106;class eD extends eN{constructor(e=!1,t=!1){super(),this.usingCheckDigit=e,this.extendedMode=t,this.decodeRowResult="",this.counters=new Int32Array(9)}decodeRow(e,t,r){let n,i,o,a=this.counters;a.fill(0),this.decodeRowResult="";let s=eD.findAsteriskPattern(t,a),l=t.getNextSet(s[1]),c=t.getSize();do{eD.recordPattern(t,l,a);let e=eD.toNarrowWidePattern(a);if(e<0)throw new X;for(let t of(n=eD.patternToChar(e),this.decodeRowResult+=n,i=l,a))l+=t;l=t.getNextSet(l)}while("*"!==n);this.decodeRowResult=this.decodeRowResult.substring(0,this.decodeRowResult.length-1);let u=0;for(let e of a)u+=e;let h=l-i-u;if(l!==c&&2*h<u)throw new X;if(this.usingCheckDigit){let e=this.decodeRowResult.length-1,t=0;for(let r=0;r<e;r++)t+=eD.ALPHABET_STRING.indexOf(this.decodeRowResult.charAt(r));if(this.decodeRowResult.charAt(e)!==eD.ALPHABET_STRING.charAt(t%43))throw new R;this.decodeRowResult=this.decodeRowResult.substring(0,e)}if(0===this.decodeRowResult.length)throw new X;o=this.extendedMode?eD.decodeExtended(this.decodeRowResult):this.decodeRowResult;let d=(s[1]+s[0])/2,f=i+u/2;return new er(o,null,0,[new em(d,e),new em(f,e)],en.CODE_39,new Date().getTime())}static findAsteriskPattern(e,t){let r=e.getSize(),n=e.getNextSet(0),i=0,o=n,a=!1,s=t.length;for(let l=n;l<r;l++)if(e.get(l)!==a)t[i]++;else{if(i===s-1){if(this.toNarrowWidePattern(t)===eD.ASTERISK_ENCODING&&e.isRange(Math.max(0,o-Math.floor((l-o)/2)),o,!1))return[o,l];o+=t[0]+t[1],t.copyWithin(0,2,2+i-1),t[i-1]=0,t[i]=0,i--}else i++;t[i]=1,a=!a}throw new X}static toNarrowWidePattern(e){let t,r=e.length,n=0;do{let i=0x7fffffff;for(let t of e)t<i&&t>n&&(i=t);n=i,t=0;let o=0,a=0;for(let i=0;i<r;i++){let s=e[i];s>n&&(a|=1<<r-1-i,t++,o+=s)}if(3===t){for(let i=0;i<r&&t>0;i++){let r=e[i];if(r>n&&(t--,2*r>=o))return -1}return a}}while(t>3);return -1}static patternToChar(e){for(let t=0;t<eD.CHARACTER_ENCODINGS.length;t++)if(eD.CHARACTER_ENCODINGS[t]===e)return eD.ALPHABET_STRING.charAt(t);if(e===eD.ASTERISK_ENCODING)return"*";throw new X}static decodeExtended(e){let t=e.length,r="";for(let n=0;n<t;n++){let t=e.charAt(n);if("+"===t||"$"===t||"%"===t||"/"===t){let i=e.charAt(n+1),o="\0";switch(t){case"+":if(i>="A"&&i<="Z")o=String.fromCharCode(i.charCodeAt(0)+32);else throw new H;break;case"$":if(i>="A"&&i<="Z")o=String.fromCharCode(i.charCodeAt(0)-64);else throw new H;break;case"%":if(i>="A"&&i<="E")o=String.fromCharCode(i.charCodeAt(0)-38);else if(i>="F"&&i<="J")o=String.fromCharCode(i.charCodeAt(0)-11);else if(i>="K"&&i<="O")o=String.fromCharCode(i.charCodeAt(0)+16);else if(i>="P"&&i<="T")o=String.fromCharCode(i.charCodeAt(0)+43);else if("U"===i)o="\0";else if("V"===i)o="@";else if("W"===i)o="`";else if("X"===i||"Y"===i||"Z"===i)o="";else throw new H;break;case"/":if(i>="A"&&i<="O")o=String.fromCharCode(i.charCodeAt(0)-32);else if("Z"===i)o=":";else throw new H}r+=o,n++}else r+=t}return r}}eD.ALPHABET_STRING="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%",eD.CHARACTER_ENCODINGS=[52,289,97,352,49,304,112,37,292,100,265,73,328,25,280,88,13,268,76,28,259,67,322,19,274,82,7,262,70,22,385,193,448,145,400,208,133,388,196,168,162,138,42],eD.ASTERISK_ENCODING=148;class eO extends eN{constructor(){super(...arguments),this.narrowLineWidth=-1}decodeRow(e,t,r){let n=this.decodeStart(t),i=this.decodeEnd(t),o=new W;eO.decodeMiddle(t,n[1],i[0],o);let a=o.toString(),s=null;null!=r&&(s=r.get(U.ALLOWED_LENGTHS)),null==s&&(s=eO.DEFAULT_ALLOWED_LENGTHS);let l=a.length,c=!1,u=0;for(let e of s){if(l===e){c=!0;break}e>u&&(u=e)}if(!c&&l>u&&(c=!0),!c)throw new H;return new er(a,null,0,[new em(n[1],e),new em(i[0],e)],en.ITF,new Date().getTime())}static decodeMiddle(e,t,r,n){let i=new Int32Array(10),o=new Int32Array(5),a=new Int32Array(5);for(i.fill(0),o.fill(0),a.fill(0);t<r;){eN.recordPattern(e,t,i);for(let e=0;e<5;e++){let t=2*e;o[e]=i[t],a[e]=i[t+1]}let r=eO.decodeDigit(o);n.append(r.toString()),r=this.decodeDigit(a),n.append(r.toString()),i.forEach(function(e){t+=e})}}decodeStart(e){let t=eO.skipWhiteSpace(e),r=eO.findGuardPattern(e,t,eO.START_PATTERN);return this.narrowLineWidth=(r[1]-r[0])/4,this.validateQuietZone(e,r[0]),r}validateQuietZone(e,t){let r=10*this.narrowLineWidth;r=r<t?r:t;for(let n=t-1;r>0&&n>=0&&!e.get(n);n--)r--;if(0!==r)throw new X}static skipWhiteSpace(e){let t=e.getSize(),r=e.getNextSet(0);if(r===t)throw new X;return r}decodeEnd(e){e.reverse();try{let t,r=eO.skipWhiteSpace(e);try{t=eO.findGuardPattern(e,r,eO.END_PATTERN_REVERSED[0])}catch(n){n instanceof X&&(t=eO.findGuardPattern(e,r,eO.END_PATTERN_REVERSED[1]))}this.validateQuietZone(e,t[0]);let n=t[0];return t[0]=e.getSize()-t[1],t[1]=e.getSize()-n,t}finally{e.reverse()}}static findGuardPattern(e,t,r){let n=r.length,i=new Int32Array(n),o=e.getSize(),a=!1,s=0,l=t;i.fill(0);for(let c=t;c<o;c++)if(e.get(c)!==a)i[s]++;else{if(s===n-1){if(eN.patternMatchVariance(i,r,eO.MAX_INDIVIDUAL_VARIANCE)<eO.MAX_AVG_VARIANCE)return[l,c];l+=i[0]+i[1],P.arraycopy(i,2,i,0,s-1),i[s-1]=0,i[s]=0,s--}else s++;i[s]=1,a=!a}throw new X}static decodeDigit(e){let t=eO.MAX_AVG_VARIANCE,r=-1,n=eO.PATTERNS.length;for(let i=0;i<n;i++){let n=eO.PATTERNS[i],o=eN.patternMatchVariance(e,n,eO.MAX_INDIVIDUAL_VARIANCE);o<t?(t=o,r=i):o===t&&(r=-1)}if(r>=0)return r%10;throw new X}}eO.PATTERNS=[Int32Array.from([1,1,2,2,1]),Int32Array.from([2,1,1,1,2]),Int32Array.from([1,2,1,1,2]),Int32Array.from([2,2,1,1,1]),Int32Array.from([1,1,2,1,2]),Int32Array.from([2,1,2,1,1]),Int32Array.from([1,2,2,1,1]),Int32Array.from([1,1,1,2,2]),Int32Array.from([2,1,1,2,1]),Int32Array.from([1,2,1,2,1]),Int32Array.from([1,1,3,3,1]),Int32Array.from([3,1,1,1,3]),Int32Array.from([1,3,1,1,3]),Int32Array.from([3,3,1,1,1]),Int32Array.from([1,1,3,1,3]),Int32Array.from([3,1,3,1,1]),Int32Array.from([1,3,3,1,1]),Int32Array.from([1,1,1,3,3]),Int32Array.from([3,1,1,3,1]),Int32Array.from([1,3,1,3,1])],eO.MAX_AVG_VARIANCE=.38,eO.MAX_INDIVIDUAL_VARIANCE=.5,eO.DEFAULT_ALLOWED_LENGTHS=[6,8,10,12,14],eO.START_PATTERN=Int32Array.from([1,1,1,1]),eO.END_PATTERN_REVERSED=[Int32Array.from([1,1,2]),Int32Array.from([1,1,3])];class eR extends eN{constructor(){super(...arguments),this.decodeRowStringBuffer=""}static findStartGuardPattern(e){let t,r=!1,n=0,i=Int32Array.from([0,0,0]);for(;!r;){i=Int32Array.from([0,0,0]);let o=(t=eR.findGuardPattern(e,n,!1,this.START_END_PATTERN,i))[0],a=o-((n=t[1])-o);a>=0&&(r=e.isRange(a,o,!1))}return t}static checkChecksum(e){return eR.checkStandardUPCEANChecksum(e)}static checkStandardUPCEANChecksum(e){let t=e.length;if(0===t)return!1;let r=parseInt(e.charAt(t-1),10);return eR.getStandardUPCEANChecksum(e.substring(0,t-1))===r}static getStandardUPCEANChecksum(e){let t=e.length,r=0;for(let n=t-1;n>=0;n-=2){let t=e.charAt(n).charCodeAt(0)-48;if(t<0||t>9)throw new H;r+=t}r*=3;for(let n=t-2;n>=0;n-=2){let t=e.charAt(n).charCodeAt(0)-48;if(t<0||t>9)throw new H;r+=t}return(1e3-r)%10}static decodeEnd(e,t){return eR.findGuardPattern(e,t,!1,eR.START_END_PATTERN,new Int32Array(eR.START_END_PATTERN.length).fill(0))}static findGuardPatternWithoutCounters(e,t,r,n){return this.findGuardPattern(e,t,r,n,new Int32Array(n.length))}static findGuardPattern(e,t,r,n,i){let o=e.getSize();t=r?e.getNextUnset(t):e.getNextSet(t);let a=0,s=t,l=n.length,c=r;for(let r=t;r<o;r++)if(e.get(r)!==c)i[a]++;else{if(a===l-1){if(eN.patternMatchVariance(i,n,eR.MAX_INDIVIDUAL_VARIANCE)<eR.MAX_AVG_VARIANCE)return Int32Array.from([s,r]);s+=i[0]+i[1];let e=i.slice(2,i.length-1);for(let t=0;t<a-1;t++)i[t]=e[t];i[a-1]=0,i[a]=0,a--}else a++;i[a]=1,c=!c}throw new X}static decodeDigit(e,t,r,n){this.recordPattern(e,r,t);let i=this.MAX_AVG_VARIANCE,o=-1,a=n.length;for(let e=0;e<a;e++){let r=n[e],a=eN.patternMatchVariance(t,r,eR.MAX_INDIVIDUAL_VARIANCE);a<i&&(i=a,o=e)}if(o>=0)return o;throw new X}}eR.MAX_AVG_VARIANCE=.48,eR.MAX_INDIVIDUAL_VARIANCE=.7,eR.START_END_PATTERN=Int32Array.from([1,1,1]),eR.MIDDLE_PATTERN=Int32Array.from([1,1,1,1,1]),eR.END_PATTERN=Int32Array.from([1,1,1,1,1,1]),eR.L_PATTERNS=[Int32Array.from([3,2,1,1]),Int32Array.from([2,2,2,1]),Int32Array.from([2,1,2,2]),Int32Array.from([1,4,1,1]),Int32Array.from([1,1,3,2]),Int32Array.from([1,2,3,1]),Int32Array.from([1,1,1,4]),Int32Array.from([1,3,1,2]),Int32Array.from([1,2,1,3]),Int32Array.from([3,1,1,2])];class ev{constructor(){this.CHECK_DIGIT_ENCODINGS=[24,20,18,17,12,6,3,10,9,5],this.decodeMiddleCounters=Int32Array.from([0,0,0,0]),this.decodeRowStringBuffer=""}decodeRow(e,t,r){let n=this.decodeRowStringBuffer,i=this.decodeMiddle(t,r,n),o=n.toString(),a=ev.parseExtensionString(o),s=new er(o,null,0,[new em((r[0]+r[1])/2,e),new em(i,e)],en.UPC_EAN_EXTENSION,new Date().getTime());return null!=a&&s.putAllMetadata(a),s}decodeMiddle(e,t,r){let n=this.decodeMiddleCounters;n[0]=0,n[1]=0,n[2]=0,n[3]=0;let i=e.getSize(),o=t[1],a=0;for(let t=0;t<5&&o<i;t++){let i=eR.decodeDigit(e,n,o,eR.L_AND_G_PATTERNS);for(let e of(r+=String.fromCharCode(48+i%10),n))o+=e;i>=10&&(a|=1<<4-t),4!==t&&(o=e.getNextSet(o),o=e.getNextUnset(o))}if(5!==r.length)throw new X;let s=this.determineCheckDigit(a);if(ev.extensionChecksum(r.toString())!==s)throw new X;return o}static extensionChecksum(e){let t=e.length,r=0;for(let n=t-2;n>=0;n-=2)r+=e.charAt(n).charCodeAt(0)-48;r*=3;for(let n=t-1;n>=0;n-=2)r+=e.charAt(n).charCodeAt(0)-48;return(r*=3)%10}determineCheckDigit(e){for(let t=0;t<10;t++)if(e===this.CHECK_DIGIT_ENCODINGS[t])return t;throw new X}static parseExtensionString(e){if(5!==e.length)return null;let t=ev.parseExtension5String(e);return null==t?null:new Map([[ei.SUGGESTED_PRICE,t]])}static parseExtension5String(e){let t;switch(e.charAt(0)){case"0":t="\xa3";break;case"5":t="$";break;case"9":switch(e){case"90000":return null;case"99991":return"0.00";case"99990":return"Used"}t="";break;default:t=""}let r=parseInt(e.substring(1)),n=(r/100).toString(),i=r%100;return t+n+"."+(i<10?"0"+i:i.toString())}}class eP{constructor(){this.decodeMiddleCounters=Int32Array.from([0,0,0,0]),this.decodeRowStringBuffer=""}decodeRow(e,t,r){let n=this.decodeRowStringBuffer,i=this.decodeMiddle(t,r,n),o=n.toString(),a=eP.parseExtensionString(o),s=new er(o,null,0,[new em((r[0]+r[1])/2,e),new em(i,e)],en.UPC_EAN_EXTENSION,new Date().getTime());return null!=a&&s.putAllMetadata(a),s}decodeMiddle(e,t,r){let n=this.decodeMiddleCounters;n[0]=0,n[1]=0,n[2]=0,n[3]=0;let i=e.getSize(),o=t[1],a=0;for(let t=0;t<2&&o<i;t++){let i=eR.decodeDigit(e,n,o,eR.L_AND_G_PATTERNS);for(let e of(r+=String.fromCharCode(48+i%10),n))o+=e;i>=10&&(a|=1<<1-t),1!==t&&(o=e.getNextSet(o),o=e.getNextUnset(o))}if(2!==r.length||parseInt(r.toString())%4!==a)throw new X;return o}static parseExtensionString(e){return 2!==e.length?null:new Map([[ei.ISSUE_NUMBER,parseInt(e)]])}}class eB{static decodeRow(e,t,r){let n=eR.findGuardPattern(t,r,!1,this.EXTENSION_START_PATTERN,new Int32Array(this.EXTENSION_START_PATTERN.length).fill(0));try{return new ev().decodeRow(e,t,n)}catch(r){return new eP().decodeRow(e,t,n)}}}eB.EXTENSION_START_PATTERN=Int32Array.from([1,1,2]);class ex extends eR{constructor(){super(),this.decodeRowStringBuffer="",ex.L_AND_G_PATTERNS=ex.L_PATTERNS.map(e=>Int32Array.from(e));for(let e=10;e<20;e++){let t=ex.L_PATTERNS[e-10],r=new Int32Array(t.length);for(let e=0;e<t.length;e++)r[e]=t[t.length-e-1];ex.L_AND_G_PATTERNS[e]=r}}decodeRow(e,t,r){let n=ex.findStartGuardPattern(t),i=null==r?null:r.get(U.NEED_RESULT_POINT_CALLBACK);if(null!=i){let t=new em((n[0]+n[1])/2,e);i.foundPossibleResultPoint(t)}let o=this.decodeMiddle(t,n,this.decodeRowStringBuffer),a=o.rowOffset,s=o.resultString;if(null!=i){let t=new em(a,e);i.foundPossibleResultPoint(t)}let l=this.decodeEnd(t,a);if(null!=i){let t=new em((l[0]+l[1])/2,e);i.foundPossibleResultPoint(t)}let c=l[1],u=c+(c-l[0]);if(u>=t.getSize()||!t.isRange(c,u,!1))throw new X;let h=s.toString();if(h.length<8)throw new H;if(!ex.checkChecksum(h))throw new R;let d=(n[1]+n[0])/2,f=(l[1]+l[0])/2,g=this.getBarcodeFormat(),p=new er(h,null,0,[new em(d,e),new em(f,e)],g,new Date().getTime()),m=0;try{let r=eB.decodeRow(e,t,l[1]);p.putMetadata(ei.UPC_EAN_EXTENSION,r.getText()),p.putAllMetadata(r.getResultMetadata()),p.addResultPoints(r.getResultPoints()),m=r.getText().length}catch(e){}let w=null==r?null:r.get(U.ALLOWED_EAN_EXTENSIONS);if(null!=w){let e=!1;for(let t in w)if(m.toString()===t){e=!0;break}if(!e)throw new X}return p}decodeEnd(e,t){return ex.findGuardPattern(e,t,!1,ex.START_END_PATTERN,new Int32Array(ex.START_END_PATTERN.length).fill(0))}static checkChecksum(e){return ex.checkStandardUPCEANChecksum(e)}static checkStandardUPCEANChecksum(e){let t=e.length;if(0===t)return!1;let r=parseInt(e.charAt(t-1),10);return ex.getStandardUPCEANChecksum(e.substring(0,t-1))===r}static getStandardUPCEANChecksum(e){let t=e.length,r=0;for(let n=t-1;n>=0;n-=2){let t=e.charAt(n).charCodeAt(0)-48;if(t<0||t>9)throw new H;r+=t}r*=3;for(let n=t-2;n>=0;n-=2){let t=e.charAt(n).charCodeAt(0)-48;if(t<0||t>9)throw new H;r+=t}return(1e3-r)%10}}class eL extends ex{constructor(){super(),this.decodeMiddleCounters=Int32Array.from([0,0,0,0])}decodeMiddle(e,t,r){let n=this.decodeMiddleCounters;n[0]=0,n[1]=0,n[2]=0,n[3]=0;let i=e.getSize(),o=t[1],a=0;for(let t=0;t<6&&o<i;t++){let i=ex.decodeDigit(e,n,o,ex.L_AND_G_PATTERNS);for(let e of(r+=String.fromCharCode(48+i%10),n))o+=e;i>=10&&(a|=1<<5-t)}r=eL.determineFirstDigit(r,a),o=ex.findGuardPattern(e,o,!0,ex.MIDDLE_PATTERN,new Int32Array(ex.MIDDLE_PATTERN.length).fill(0))[1];for(let t=0;t<6&&o<i;t++){let t=ex.decodeDigit(e,n,o,ex.L_PATTERNS);for(let e of(r+=String.fromCharCode(48+t),n))o+=e}return{rowOffset:o,resultString:r}}getBarcodeFormat(){return en.EAN_13}static determineFirstDigit(e,t){for(let r=0;r<10;r++)if(t===this.FIRST_DIGIT_ENCODINGS[r])return e=String.fromCharCode(48+r)+e;throw new X}}eL.FIRST_DIGIT_ENCODINGS=[0,11,13,14,19,25,28,21,22,26];class ek extends ex{constructor(){super(),this.decodeMiddleCounters=Int32Array.from([0,0,0,0])}decodeMiddle(e,t,r){let n=this.decodeMiddleCounters;n[0]=0,n[1]=0,n[2]=0,n[3]=0;let i=e.getSize(),o=t[1];for(let t=0;t<4&&o<i;t++){let t=ex.decodeDigit(e,n,o,ex.L_PATTERNS);for(let e of(r+=String.fromCharCode(48+t),n))o+=e}o=ex.findGuardPattern(e,o,!0,ex.MIDDLE_PATTERN,new Int32Array(ex.MIDDLE_PATTERN.length).fill(0))[1];for(let t=0;t<4&&o<i;t++){let t=ex.decodeDigit(e,n,o,ex.L_PATTERNS);for(let e of(r+=String.fromCharCode(48+t),n))o+=e}return{rowOffset:o,resultString:r}}getBarcodeFormat(){return en.EAN_8}}class eF extends ex{constructor(){super(...arguments),this.ean13Reader=new eL}getBarcodeFormat(){return en.UPC_A}decode(e,t){return this.maybeReturnResult(this.ean13Reader.decode(e))}decodeRow(e,t,r){return this.maybeReturnResult(this.ean13Reader.decodeRow(e,t,r))}decodeMiddle(e,t,r){return this.ean13Reader.decodeMiddle(e,t,r)}maybeReturnResult(e){let t=e.getText();if("0"===t.charAt(0)){let r=new er(t.substring(1),null,null,e.getResultPoints(),en.UPC_A);return null!=e.getResultMetadata()&&r.putAllMetadata(e.getResultMetadata()),r}throw new X}reset(){this.ean13Reader.reset()}}class eU extends ex{constructor(){super(),this.decodeMiddleCounters=new Int32Array(4)}decodeMiddle(e,t,r){let n=this.decodeMiddleCounters.map(e=>e);n[0]=0,n[1]=0,n[2]=0,n[3]=0;let i=e.getSize(),o=t[1],a=0;for(let t=0;t<6&&o<i;t++){let i=eU.decodeDigit(e,n,o,eU.L_AND_G_PATTERNS);for(let e of(r+=String.fromCharCode(48+i%10),n))o+=e;i>=10&&(a|=1<<5-t)}return{rowOffset:o,resultString:eU.determineNumSysAndCheckDigit(r,a)}}decodeEnd(e,t){return eU.findGuardPatternWithoutCounters(e,t,!0,eU.MIDDLE_END_PATTERN)}checkChecksum(e){return ex.checkChecksum(eU.convertUPCEtoUPCA(e))}static determineNumSysAndCheckDigit(e,t){for(let r=0;r<=1;r++)for(let n=0;n<10;n++)if(t===this.NUMSYS_AND_CHECK_DIGIT_PATTERNS[r][n])return String.fromCharCode(48+r)+e+String.fromCharCode(48+n);throw X.getNotFoundInstance()}getBarcodeFormat(){return en.UPC_E}static convertUPCEtoUPCA(e){let t=e.slice(1,7).split("").map(e=>e.charCodeAt(0)),r=new W;r.append(e.charAt(0));let n=t[5];switch(n){case 0:case 1:case 2:r.appendChars(t,0,2),r.append(n),r.append("0000"),r.appendChars(t,2,3);break;case 3:r.appendChars(t,0,3),r.append("00000"),r.appendChars(t,3,2);break;case 4:r.appendChars(t,0,4),r.append("00000"),r.append(t[4]);break;default:r.appendChars(t,0,5),r.append("0000"),r.append(n)}return e.length>=8&&r.append(e.charAt(7)),r.toString()}}eU.MIDDLE_END_PATTERN=Int32Array.from([1,1,1,1,1,1]),eU.NUMSYS_AND_CHECK_DIGIT_PATTERNS=[Int32Array.from([56,52,50,49,44,38,35,42,41,37]),Int32Array.from([7,11,13,14,19,25,28,21,22,26])];class eH extends eN{constructor(e){super();let t=null==e?null:e.get(U.POSSIBLE_FORMATS),r=[];null==t?(r.push(new eL),r.push(new eF),r.push(new ek),r.push(new eU)):(t.indexOf(en.EAN_13)>-1&&r.push(new eL),t.indexOf(en.UPC_A)>-1&&r.push(new eF),t.indexOf(en.EAN_8)>-1&&r.push(new ek),t.indexOf(en.UPC_E)>-1&&r.push(new eU)),this.readers=r}decodeRow(e,t,r){for(let n of this.readers)try{let i=n.decodeRow(e,t,r),o=i.getBarcodeFormat()===en.EAN_13&&"0"===i.getText().charAt(0),a=null==r?null:r.get(U.POSSIBLE_FORMATS),s=null==a||a.includes(en.UPC_A);if(o&&s){let e=i.getRawBytes(),t=new er(i.getText().substring(1),e,e?e.length:null,i.getResultPoints(),en.UPC_A);return t.putAllMetadata(i.getResultMetadata()),t}return i}catch(e){}throw new X}reset(){for(let e of this.readers)e.reset()}}class ez extends eN{constructor(){super(),this.decodeFinderCounters=new Int32Array(4),this.dataCharacterCounters=new Int32Array(8),this.oddRoundingErrors=[,,,,],this.evenRoundingErrors=[,,,,],this.oddCounts=Array(this.dataCharacterCounters.length/2),this.evenCounts=Array(this.dataCharacterCounters.length/2)}getDecodeFinderCounters(){return this.decodeFinderCounters}getDataCharacterCounters(){return this.dataCharacterCounters}getOddRoundingErrors(){return this.oddRoundingErrors}getEvenRoundingErrors(){return this.evenRoundingErrors}getOddCounts(){return this.oddCounts}getEvenCounts(){return this.evenCounts}parseFinderValue(e,t){for(let r=0;r<t.length;r++)if(eN.patternMatchVariance(e,t[r],ez.MAX_INDIVIDUAL_VARIANCE)<ez.MAX_AVG_VARIANCE)return r;throw new X}static count(e){return eg.sum(new Int32Array(e))}static increment(e,t){let r=0,n=t[0];for(let i=1;i<e.length;i++)t[i]>n&&(n=t[i],r=i);e[r]++}static decrement(e,t){let r=0,n=t[0];for(let i=1;i<e.length;i++)t[i]<n&&(n=t[i],r=i);e[r]--}static isFinderPattern(e){let t=e[0]+e[1],r=t+e[2]+e[3],n=t/r;if(n>=ez.MIN_FINDER_PATTERN_RATIO&&n<=ez.MAX_FINDER_PATTERN_RATIO){let t=Number.MAX_SAFE_INTEGER,r=Number.MIN_SAFE_INTEGER;for(let n of e)n>r&&(r=n),n<t&&(t=n);return r<10*t}return!1}}ez.MAX_AVG_VARIANCE=.2,ez.MAX_INDIVIDUAL_VARIANCE=.45,ez.MIN_FINDER_PATTERN_RATIO=9.5/12,ez.MAX_FINDER_PATTERN_RATIO=12.5/14;class eV{constructor(e,t){this.value=e,this.checksumPortion=t}getValue(){return this.value}getChecksumPortion(){return this.checksumPortion}toString(){return this.value+"("+this.checksumPortion+")"}equals(e){return e instanceof eV&&this.value===e.value&&this.checksumPortion===e.checksumPortion}hashCode(){return this.value^this.checksumPortion}}class ej{constructor(e,t,r,n,i){this.value=e,this.startEnd=t,this.value=e,this.startEnd=t,this.resultPoints=[],this.resultPoints.push(new em(r,i)),this.resultPoints.push(new em(n,i))}getValue(){return this.value}getStartEnd(){return this.startEnd}getResultPoints(){return this.resultPoints}equals(e){return e instanceof ej&&this.value===e.value}hashCode(){return this.value}}class eG{constructor(){}static getRSSvalue(e,t,r){let n=0;for(let t of e)n+=t;let i=0,o=0,a=e.length;for(let s=0;s<a-1;s++){let l;for(l=1,o|=1<<s;l<e[s];l++,o&=~(1<<s)){let e=eG.combins(n-l-1,a-s-2);if(r&&0===o&&n-l-(a-s-1)>=a-s-1&&(e-=eG.combins(n-l-(a-s),a-s-2)),a-s-1>1){let r=0;for(let e=n-l-(a-s-2);e>t;e--)r+=eG.combins(n-l-e-1,a-s-3);e-=r*(a-1-s)}else n-l>t&&e--;i+=e}n-=l}return i}static combins(e,t){let r,n;e-t>t?(n=t,r=e-t):(n=e-t,r=t);let i=1,o=1;for(let t=e;t>r;t--)i*=t,o<=n&&(i/=o,o++);for(;o<=n;)i/=o,o++;return i}}class eW{static buildBitArray(e){let t=2*e.length-1;null==e[e.length-1].getRightChar()&&(t-=1);let r=new F(12*t),n=0,i=e[0].getRightChar().getValue();for(let e=11;e>=0;--e)(i&1<<e)!=0&&r.set(n),n++;for(let t=1;t<e.length;++t){let i=e[t],o=i.getLeftChar().getValue();for(let e=11;e>=0;--e)(o&1<<e)!=0&&r.set(n),n++;if(null!=i.getRightChar()){let e=i.getRightChar().getValue();for(let t=11;t>=0;--t)(e&1<<t)!=0&&r.set(n),n++}}return r}}class eY{constructor(e,t){t?this.decodedInformation=null:(this.finished=e,this.decodedInformation=t)}getDecodedInformation(){return this.decodedInformation}isFinished(){return this.finished}}class eX{constructor(e){this.newPosition=e}getNewPosition(){return this.newPosition}}class eZ extends eX{constructor(e,t){super(e),this.value=t}getValue(){return this.value}isFNC1(){return this.value===eZ.FNC1}}eZ.FNC1="$";class eQ extends eX{constructor(e,t,r){super(e),r?(this.remaining=!0,this.remainingValue=this.remainingValue):(this.remaining=!1,this.remainingValue=0),this.newString=t}getNewString(){return this.newString}isRemaining(){return this.remaining}getRemainingValue(){return this.remainingValue}}class eq extends eX{constructor(e,t,r){if(super(e),t<0||t>10||r<0||r>10)throw new H;this.firstDigit=t,this.secondDigit=r}getFirstDigit(){return this.firstDigit}getSecondDigit(){return this.secondDigit}getValue(){return 10*this.firstDigit+this.secondDigit}isFirstDigitFNC1(){return this.firstDigit===eq.FNC1}isSecondDigitFNC1(){return this.secondDigit===eq.FNC1}isAnyFNC1(){return this.firstDigit===eq.FNC1||this.secondDigit===eq.FNC1}}eq.FNC1=10;class eK{constructor(){}static parseFieldsInGeneralPurpose(e){if(!e)return null;if(e.length<2)throw new X;let t=e.substring(0,2);for(let r of eK.TWO_DIGIT_DATA_LENGTH)if(r[0]===t){if(r[1]===eK.VARIABLE_LENGTH)return eK.processVariableAI(2,r[2],e);return eK.processFixedAI(2,r[1],e)}if(e.length<3)throw new X;let r=e.substring(0,3);for(let t of eK.THREE_DIGIT_DATA_LENGTH)if(t[0]===r){if(t[1]===eK.VARIABLE_LENGTH)return eK.processVariableAI(3,t[2],e);return eK.processFixedAI(3,t[1],e)}for(let t of eK.THREE_DIGIT_PLUS_DIGIT_DATA_LENGTH)if(t[0]===r){if(t[1]===eK.VARIABLE_LENGTH)return eK.processVariableAI(4,t[2],e);return eK.processFixedAI(4,t[1],e)}if(e.length<4)throw new X;let n=e.substring(0,4);for(let t of eK.FOUR_DIGIT_DATA_LENGTH)if(t[0]===n){if(t[1]===eK.VARIABLE_LENGTH)return eK.processVariableAI(4,t[2],e);return eK.processFixedAI(4,t[1],e)}throw new X}static processFixedAI(e,t,r){if(r.length<e)throw new X;let n=r.substring(0,e);if(r.length<e+t)throw new X;let i=r.substring(e,e+t),o=r.substring(e+t),a="("+n+")"+i,s=eK.parseFieldsInGeneralPurpose(o);return null==s?a:a+s}static processVariableAI(e,t,r){let n,i=r.substring(0,e);n=r.length<e+t?r.length:e+t;let o=r.substring(e,n),a=r.substring(n),s="("+i+")"+o,l=eK.parseFieldsInGeneralPurpose(a);return null==l?s:s+l}}eK.VARIABLE_LENGTH=[],eK.TWO_DIGIT_DATA_LENGTH=[["00",18],["01",14],["02",14],["10",eK.VARIABLE_LENGTH,20],["11",6],["12",6],["13",6],["15",6],["17",6],["20",2],["21",eK.VARIABLE_LENGTH,20],["22",eK.VARIABLE_LENGTH,29],["30",eK.VARIABLE_LENGTH,8],["37",eK.VARIABLE_LENGTH,8],["90",eK.VARIABLE_LENGTH,30],["91",eK.VARIABLE_LENGTH,30],["92",eK.VARIABLE_LENGTH,30],["93",eK.VARIABLE_LENGTH,30],["94",eK.VARIABLE_LENGTH,30],["95",eK.VARIABLE_LENGTH,30],["96",eK.VARIABLE_LENGTH,30],["97",eK.VARIABLE_LENGTH,3],["98",eK.VARIABLE_LENGTH,30],["99",eK.VARIABLE_LENGTH,30]],eK.THREE_DIGIT_DATA_LENGTH=[["240",eK.VARIABLE_LENGTH,30],["241",eK.VARIABLE_LENGTH,30],["242",eK.VARIABLE_LENGTH,6],["250",eK.VARIABLE_LENGTH,30],["251",eK.VARIABLE_LENGTH,30],["253",eK.VARIABLE_LENGTH,17],["254",eK.VARIABLE_LENGTH,20],["400",eK.VARIABLE_LENGTH,30],["401",eK.VARIABLE_LENGTH,30],["402",17],["403",eK.VARIABLE_LENGTH,30],["410",13],["411",13],["412",13],["413",13],["414",13],["420",eK.VARIABLE_LENGTH,20],["421",eK.VARIABLE_LENGTH,15],["422",3],["423",eK.VARIABLE_LENGTH,15],["424",3],["425",3],["426",3]],eK.THREE_DIGIT_PLUS_DIGIT_DATA_LENGTH=[["310",6],["311",6],["312",6],["313",6],["314",6],["315",6],["316",6],["320",6],["321",6],["322",6],["323",6],["324",6],["325",6],["326",6],["327",6],["328",6],["329",6],["330",6],["331",6],["332",6],["333",6],["334",6],["335",6],["336",6],["340",6],["341",6],["342",6],["343",6],["344",6],["345",6],["346",6],["347",6],["348",6],["349",6],["350",6],["351",6],["352",6],["353",6],["354",6],["355",6],["356",6],["357",6],["360",6],["361",6],["362",6],["363",6],["364",6],["365",6],["366",6],["367",6],["368",6],["369",6],["390",eK.VARIABLE_LENGTH,15],["391",eK.VARIABLE_LENGTH,18],["392",eK.VARIABLE_LENGTH,15],["393",eK.VARIABLE_LENGTH,18],["703",eK.VARIABLE_LENGTH,30]],eK.FOUR_DIGIT_DATA_LENGTH=[["7001",13],["7002",eK.VARIABLE_LENGTH,30],["7003",10],["8001",14],["8002",eK.VARIABLE_LENGTH,20],["8003",eK.VARIABLE_LENGTH,30],["8004",eK.VARIABLE_LENGTH,30],["8005",6],["8006",18],["8007",eK.VARIABLE_LENGTH,30],["8008",eK.VARIABLE_LENGTH,12],["8018",18],["8020",eK.VARIABLE_LENGTH,25],["8100",6],["8101",10],["8102",2],["8110",eK.VARIABLE_LENGTH,70],["8200",eK.VARIABLE_LENGTH,70]];class e${constructor(e){this.buffer=new W,this.information=e}decodeAllCodes(e,t){let r=t,n=null;for(;;){let t=this.decodeGeneralPurposeField(r,n),i=eK.parseFieldsInGeneralPurpose(t.getNewString());if(null!=i&&e.append(i),n=t.isRemaining()?""+t.getRemainingValue():null,r===t.getNewPosition())break;r=t.getNewPosition()}return e.toString()}isStillNumeric(e){if(e+7>this.information.getSize())return e+4<=this.information.getSize();for(let t=e;t<e+3;++t)if(this.information.get(t))return!0;return this.information.get(e+3)}decodeNumeric(e){if(e+7>this.information.getSize()){let t=this.extractNumericValueFromBitArray(e,4);return 0===t?new eq(this.information.getSize(),eq.FNC1,eq.FNC1):new eq(this.information.getSize(),t-1,eq.FNC1)}let t=this.extractNumericValueFromBitArray(e,7);return new eq(e+7,(t-8)/11,(t-8)%11)}extractNumericValueFromBitArray(e,t){return e$.extractNumericValueFromBitArray(this.information,e,t)}static extractNumericValueFromBitArray(e,t,r){let n=0;for(let i=0;i<r;++i)e.get(t+i)&&(n|=1<<r-i-1);return n}decodeGeneralPurposeField(e,t){this.buffer.setLengthToZero(),null!=t&&this.buffer.append(t),this.current.setPosition(e);let r=this.parseBlocks();return null!=r&&r.isRemaining()?new eQ(this.current.getPosition(),this.buffer.toString(),r.getRemainingValue()):new eQ(this.current.getPosition(),this.buffer.toString())}parseBlocks(){let e,t;do{let r=this.current.getPosition();if(e=this.current.isAlpha()?(t=this.parseAlphaBlock()).isFinished():this.current.isIsoIec646()?(t=this.parseIsoIec646Block()).isFinished():(t=this.parseNumericBlock()).isFinished(),r===this.current.getPosition()&&!e)break}while(!e);return t.getDecodedInformation()}parseNumericBlock(){for(;this.isStillNumeric(this.current.getPosition());){let e=this.decodeNumeric(this.current.getPosition());if(this.current.setPosition(e.getNewPosition()),e.isFirstDigitFNC1()){let t;return new eY(!0,e.isSecondDigitFNC1()?new eQ(this.current.getPosition(),this.buffer.toString()):new eQ(this.current.getPosition(),this.buffer.toString(),e.getSecondDigit()))}if(this.buffer.append(e.getFirstDigit()),e.isSecondDigitFNC1())return new eY(!0,new eQ(this.current.getPosition(),this.buffer.toString()));this.buffer.append(e.getSecondDigit())}return this.isNumericToAlphaNumericLatch(this.current.getPosition())&&(this.current.setAlpha(),this.current.incrementPosition(4)),new eY(!1)}parseIsoIec646Block(){for(;this.isStillIsoIec646(this.current.getPosition());){let e=this.decodeIsoIec646(this.current.getPosition());if(this.current.setPosition(e.getNewPosition()),e.isFNC1())return new eY(!0,new eQ(this.current.getPosition(),this.buffer.toString()));this.buffer.append(e.getValue())}return this.isAlphaOr646ToNumericLatch(this.current.getPosition())?(this.current.incrementPosition(3),this.current.setNumeric()):this.isAlphaTo646ToAlphaLatch(this.current.getPosition())&&(this.current.getPosition()+5<this.information.getSize()?this.current.incrementPosition(5):this.current.setPosition(this.information.getSize()),this.current.setAlpha()),new eY(!1)}parseAlphaBlock(){for(;this.isStillAlpha(this.current.getPosition());){let e=this.decodeAlphanumeric(this.current.getPosition());if(this.current.setPosition(e.getNewPosition()),e.isFNC1())return new eY(!0,new eQ(this.current.getPosition(),this.buffer.toString()));this.buffer.append(e.getValue())}return this.isAlphaOr646ToNumericLatch(this.current.getPosition())?(this.current.incrementPosition(3),this.current.setNumeric()):this.isAlphaTo646ToAlphaLatch(this.current.getPosition())&&(this.current.getPosition()+5<this.information.getSize()?this.current.incrementPosition(5):this.current.setPosition(this.information.getSize()),this.current.setIsoIec646()),new eY(!1)}isStillIsoIec646(e){if(e+5>this.information.getSize())return!1;let t=this.extractNumericValueFromBitArray(e,5);if(t>=5&&t<16)return!0;if(e+7>this.information.getSize())return!1;let r=this.extractNumericValueFromBitArray(e,7);if(r>=64&&r<116)return!0;if(e+8>this.information.getSize())return!1;let n=this.extractNumericValueFromBitArray(e,8);return n>=232&&n<253}decodeIsoIec646(e){let t,r=this.extractNumericValueFromBitArray(e,5);if(15===r)return new eZ(e+5,eZ.FNC1);if(r>=5&&r<15)return new eZ(e+5,"0"+(r-5));let n=this.extractNumericValueFromBitArray(e,7);if(n>=64&&n<90)return new eZ(e+7,""+(n+1));if(n>=90&&n<116)return new eZ(e+7,""+(n+7));switch(this.extractNumericValueFromBitArray(e,8)){case 232:t="!";break;case 233:t='"';break;case 234:t="%";break;case 235:t="&";break;case 236:t="'";break;case 237:t="(";break;case 238:t=")";break;case 239:t="*";break;case 240:t="+";break;case 241:t=",";break;case 242:t="-";break;case 243:t=".";break;case 244:t="/";break;case 245:t=":";break;case 246:t=";";break;case 247:t="<";break;case 248:t="=";break;case 249:t=">";break;case 250:t="?";break;case 251:t="_";break;case 252:t=" ";break;default:throw new H}return new eZ(e+8,t)}isStillAlpha(e){if(e+5>this.information.getSize())return!1;let t=this.extractNumericValueFromBitArray(e,5);if(t>=5&&t<16)return!0;if(e+6>this.information.getSize())return!1;let r=this.extractNumericValueFromBitArray(e,6);return r>=16&&r<63}decodeAlphanumeric(e){let t,r=this.extractNumericValueFromBitArray(e,5);if(15===r)return new eZ(e+5,eZ.FNC1);if(r>=5&&r<15)return new eZ(e+5,"0"+(r-5));let n=this.extractNumericValueFromBitArray(e,6);if(n>=32&&n<58)return new eZ(e+6,""+(n+33));switch(n){case 58:t="*";break;case 59:t=",";break;case 60:t="-";break;case 61:t=".";break;case 62:t="/";break;default:throw new eh("Decoding invalid alphanumeric value: "+n)}return new eZ(e+6,t)}isAlphaTo646ToAlphaLatch(e){if(e+1>this.information.getSize())return!1;for(let t=0;t<5&&t+e<this.information.getSize();++t)if(2===t){if(!this.information.get(e+2))return!1}else if(this.information.get(e+t))return!1;return!0}isAlphaOr646ToNumericLatch(e){if(e+3>this.information.getSize())return!1;for(let t=e;t<e+3;++t)if(this.information.get(t))return!1;return!0}isNumericToAlphaNumericLatch(e){if(e+1>this.information.getSize())return!1;for(let t=0;t<4&&t+e<this.information.getSize();++t)if(this.information.get(e+t))return!1;return!0}}class eJ{constructor(e){this.information=e,this.generalDecoder=new e$(e)}getInformation(){return this.information}getGeneralDecoder(){return this.generalDecoder}}class e1 extends eJ{constructor(e){super(e)}encodeCompressedGtin(e,t){e.append("(01)");let r=e.length();e.append("9"),this.encodeCompressedGtinWithoutAI(e,t,r)}encodeCompressedGtinWithoutAI(e,t,r){for(let r=0;r<4;++r){let n=this.getGeneralDecoder().extractNumericValueFromBitArray(t+10*r,10);n/100==0&&e.append("0"),n/10==0&&e.append("0"),e.append(n)}e1.appendCheckDigit(e,r)}static appendCheckDigit(e,t){let r=0;for(let n=0;n<13;n++){let i=e.charAt(n+t).charCodeAt(0)-48;r+=(1&n)==0?3*i:i}10==(r=10-r%10)&&(r=0),e.append(r)}}e1.GTIN_SIZE=40;class e0 extends e1{constructor(e){super(e)}parseInformation(){let e=new W;e.append("(01)");let t=e.length(),r=this.getGeneralDecoder().extractNumericValueFromBitArray(e0.HEADER_SIZE,4);return e.append(r),this.encodeCompressedGtinWithoutAI(e,e0.HEADER_SIZE+4,t),this.getGeneralDecoder().decodeAllCodes(e,e0.HEADER_SIZE+44)}}e0.HEADER_SIZE=4;class e2 extends eJ{constructor(e){super(e)}parseInformation(){let e=new W;return this.getGeneralDecoder().decodeAllCodes(e,e2.HEADER_SIZE)}}e2.HEADER_SIZE=5;class e3 extends e1{constructor(e){super(e)}encodeCompressedWeight(e,t,r){let n=this.getGeneralDecoder().extractNumericValueFromBitArray(t,r);this.addWeightCode(e,n);let i=this.checkWeight(n),o=1e5;for(let t=0;t<5;++t)i/o==0&&e.append("0"),o/=10;e.append(i)}}class e4 extends e3{constructor(e){super(e)}parseInformation(){if(this.getInformation().getSize()!=e4.HEADER_SIZE+e3.GTIN_SIZE+e4.WEIGHT_SIZE)throw new X;let e=new W;return this.encodeCompressedGtin(e,e4.HEADER_SIZE),this.encodeCompressedWeight(e,e4.HEADER_SIZE+e3.GTIN_SIZE,e4.WEIGHT_SIZE),e.toString()}}e4.HEADER_SIZE=5,e4.WEIGHT_SIZE=15;class e8 extends e4{constructor(e){super(e)}addWeightCode(e,t){e.append("(3103)")}checkWeight(e){return e}}class e6 extends e4{constructor(e){super(e)}addWeightCode(e,t){t<1e4?e.append("(3202)"):e.append("(3203)")}checkWeight(e){return e<1e4?e:e-1e4}}class e5 extends e1{constructor(e){super(e)}parseInformation(){if(this.getInformation().getSize()<e5.HEADER_SIZE+e1.GTIN_SIZE)throw new X;let e=new W;this.encodeCompressedGtin(e,e5.HEADER_SIZE);let t=this.getGeneralDecoder().extractNumericValueFromBitArray(e5.HEADER_SIZE+e1.GTIN_SIZE,e5.LAST_DIGIT_SIZE);e.append("(392"),e.append(t),e.append(")");let r=this.getGeneralDecoder().decodeGeneralPurposeField(e5.HEADER_SIZE+e1.GTIN_SIZE+e5.LAST_DIGIT_SIZE,null);return e.append(r.getNewString()),e.toString()}}e5.HEADER_SIZE=8,e5.LAST_DIGIT_SIZE=2;class e7 extends e1{constructor(e){super(e)}parseInformation(){if(this.getInformation().getSize()<e7.HEADER_SIZE+e1.GTIN_SIZE)throw new X;let e=new W;this.encodeCompressedGtin(e,e7.HEADER_SIZE);let t=this.getGeneralDecoder().extractNumericValueFromBitArray(e7.HEADER_SIZE+e1.GTIN_SIZE,e7.LAST_DIGIT_SIZE);e.append("(393"),e.append(t),e.append(")");let r=this.getGeneralDecoder().extractNumericValueFromBitArray(e7.HEADER_SIZE+e1.GTIN_SIZE+e7.LAST_DIGIT_SIZE,e7.FIRST_THREE_DIGITS_SIZE);r/100==0&&e.append("0"),r/10==0&&e.append("0"),e.append(r);let n=this.getGeneralDecoder().decodeGeneralPurposeField(e7.HEADER_SIZE+e1.GTIN_SIZE+e7.LAST_DIGIT_SIZE+e7.FIRST_THREE_DIGITS_SIZE,null);return e.append(n.getNewString()),e.toString()}}e7.HEADER_SIZE=8,e7.LAST_DIGIT_SIZE=2,e7.FIRST_THREE_DIGITS_SIZE=10;class e9 extends e3{constructor(e,t,r){super(e),this.dateCode=r,this.firstAIdigits=t}parseInformation(){if(this.getInformation().getSize()!=e9.HEADER_SIZE+e9.GTIN_SIZE+e9.WEIGHT_SIZE+e9.DATE_SIZE)throw new X;let e=new W;return this.encodeCompressedGtin(e,e9.HEADER_SIZE),this.encodeCompressedWeight(e,e9.HEADER_SIZE+e9.GTIN_SIZE,e9.WEIGHT_SIZE),this.encodeCompressedDate(e,e9.HEADER_SIZE+e9.GTIN_SIZE+e9.WEIGHT_SIZE),e.toString()}encodeCompressedDate(e,t){let r=this.getGeneralDecoder().extractNumericValueFromBitArray(t,e9.DATE_SIZE);if(38400==r)return;e.append("("),e.append(this.dateCode),e.append(")");let n=r%32,i=(r/=32)%12+1,o=r/=12;o/10==0&&e.append("0"),e.append(o),i/10==0&&e.append("0"),e.append(i),n/10==0&&e.append("0"),e.append(n)}addWeightCode(e,t){e.append("("),e.append(this.firstAIdigits),e.append(t/1e5),e.append(")")}checkWeight(e){return e%1e5}}function te(e){try{if(e.get(1))return new e0(e);if(!e.get(2))return new e2(e);switch(e$.extractNumericValueFromBitArray(e,1,4)){case 4:return new e8(e);case 5:return new e6(e)}switch(e$.extractNumericValueFromBitArray(e,1,5)){case 12:return new e5(e);case 13:return new e7(e)}switch(e$.extractNumericValueFromBitArray(e,1,7)){case 56:return new e9(e,"310","11");case 57:return new e9(e,"320","11");case 58:return new e9(e,"310","13");case 59:return new e9(e,"320","13");case 60:return new e9(e,"310","15");case 61:return new e9(e,"320","15");case 62:return new e9(e,"310","17");case 63:return new e9(e,"320","17")}}catch(t){throw console.log(t),new eh("unknown decoder: "+e)}}e9.HEADER_SIZE=8,e9.WEIGHT_SIZE=20,e9.DATE_SIZE=16;class tt{constructor(e,t,r,n){this.leftchar=e,this.rightchar=t,this.finderpattern=r,this.maybeLast=n}mayBeLast(){return this.maybeLast}getLeftChar(){return this.leftchar}getRightChar(){return this.rightchar}getFinderPattern(){return this.finderpattern}mustBeLast(){return null==this.rightchar}toString(){return"[ "+this.leftchar+", "+this.rightchar+" : "+(null==this.finderpattern?"null":this.finderpattern.getValue())+" ]"}static equals(e,t){return e instanceof tt&&tt.equalsOrNull(e.leftchar,t.leftchar)&&tt.equalsOrNull(e.rightchar,t.rightchar)&&tt.equalsOrNull(e.finderpattern,t.finderpattern)}static equalsOrNull(e,t){return null===e?null===t:tt.equals(e,t)}hashCode(){return this.leftchar.getValue()^this.rightchar.getValue()^this.finderpattern.getValue()}}class tr{constructor(e,t,r){this.pairs=e,this.rowNumber=t,this.wasReversed=r}getPairs(){return this.pairs}getRowNumber(){return this.rowNumber}isReversed(){return this.wasReversed}isEquivalent(e){return this.checkEqualitity(this,e)}toString(){return"{ "+this.pairs+" }"}equals(e,t){return e instanceof tr&&this.checkEqualitity(e,t)&&e.wasReversed===t.wasReversed}checkEqualitity(e,t){let r;if(e&&t)return e.forEach((e,n)=>{t.forEach(t=>{e.getLeftChar().getValue()===t.getLeftChar().getValue()&&e.getRightChar().getValue()===t.getRightChar().getValue()&&e.getFinderPatter().getValue()===t.getFinderPatter().getValue()&&(r=!0)})}),r}}class tn extends ez{constructor(e){super(...arguments),this.pairs=Array(tn.MAX_PAIRS),this.rows=[],this.startEnd=[2],this.verbose=!0===e}decodeRow(e,t,r){this.pairs.length=0,this.startFromEven=!1;try{return tn.constructResult(this.decodeRow2pairs(e,t))}catch(e){this.verbose&&console.log(e)}return this.pairs.length=0,this.startFromEven=!0,tn.constructResult(this.decodeRow2pairs(e,t))}reset(){this.pairs.length=0,this.rows.length=0}decodeRow2pairs(e,t){let r,n=!1;for(;!n;)try{this.pairs.push(this.retrieveNextPair(t,this.pairs,e))}catch(e){if(e instanceof X){if(!this.pairs.length)throw new X;n=!0}}if(this.checkChecksum())return this.pairs;if(r=!!this.rows.length,this.storeRow(e,!1),r){let e=this.checkRowsBoolean(!1);if(null!=e||null!=(e=this.checkRowsBoolean(!0)))return e}throw new X}checkRowsBoolean(e){if(this.rows.length>25)return this.rows.length=0,null;this.pairs.length=0,e&&(this.rows=this.rows.reverse());let t=null;try{t=this.checkRows([],0)}catch(e){this.verbose&&console.log(e)}return e&&(this.rows=this.rows.reverse()),t}checkRows(e,t){for(let r=t;r<this.rows.length;r++){let t=this.rows[r];for(let t of(this.pairs.length=0,e))this.pairs.push(t.getPairs());if(this.pairs.push(t.getPairs()),!tn.isValidSequence(this.pairs))continue;if(this.checkChecksum())return this.pairs;let n=Array(e);n.push(t);try{return this.checkRows(n,r+1)}catch(e){this.verbose&&console.log(e)}}throw new X}static isValidSequence(e){for(let t of tn.FINDER_PATTERN_SEQUENCES){if(e.length>t.length)continue;let r=!0;for(let n=0;n<e.length;n++)if(e[n].getFinderPattern().getValue()!=t[n]){r=!1;break}if(r)return!0}return!1}storeRow(e,t){let r=0,n=!1,i=!1;for(;r<this.rows.length;){let t=this.rows[r];if(t.getRowNumber()>e){i=t.isEquivalent(this.pairs);break}n=t.isEquivalent(this.pairs),r++}i||n||tn.isPartialRow(this.pairs,this.rows)||(this.rows.push(r,new tr(this.pairs,e,t)),this.removePartialRows(this.pairs,this.rows))}removePartialRows(e,t){for(let r of t)if(r.getPairs().length!==e.length){for(let t of r.getPairs())for(let r of e)if(tt.equals(t,r))break}}static isPartialRow(e,t){for(let r of t){let t=!0;for(let n of e){let e=!1;for(let t of r.getPairs())if(n.equals(t)){e=!0;break}if(!e){t=!1;break}}if(t)return!0}return!1}getRows(){return this.rows}static constructResult(e){let t=te(eW.buildBitArray(e)).parseInformation(),r=e[0].getFinderPattern().getResultPoints(),n=e[e.length-1].getFinderPattern().getResultPoints();return new er(t,null,null,[r[0],r[1],n[0],n[1]],en.RSS_EXPANDED,null)}checkChecksum(){let e=this.pairs.get(0),t=e.getLeftChar(),r=e.getRightChar();if(null==r)return!1;let n=r.getChecksumPortion(),i=2;for(let e=1;e<this.pairs.size();++e){let t=this.pairs.get(e);n+=t.getLeftChar().getChecksumPortion(),i++;let r=t.getRightChar();null!=r&&(n+=r.getChecksumPortion(),i++)}return 211*(i-4)+(n%=211)==t.getValue()}static getNextSecondBar(e,t){let r;return e.get(t)?(r=e.getNextUnset(t),r=e.getNextSet(r)):(r=e.getNextSet(t),r=e.getNextUnset(r)),r}retrieveNextPair(e,t,r){let n,i,o=t.length%2==0;this.startFromEven&&(o=!o);let a=!0,s=-1;do this.findNextPair(e,t,s),null==(n=this.parseFoundFinderPattern(e,r,o))?s=tn.getNextSecondBar(e,this.startEnd[0]):a=!1;while(a);let l=this.decodeDataCharacter(e,n,o,!0);if(!this.isEmptyPair(t)&&t[t.length-1].mustBeLast())throw new X;try{i=this.decodeDataCharacter(e,n,o,!1)}catch(e){i=null,this.verbose&&console.log(e)}return new tt(l,i,n,!0)}isEmptyPair(e){return 0===e.length}findNextPair(e,t,r){let n,i=this.getDecodeFinderCounters();i[0]=0,i[1]=0,i[2]=0,i[3]=0;let o=e.getSize();n=r>=0?r:this.isEmptyPair(t)?0:t[t.length-1].getFinderPattern().getStartEnd()[1];let a=t.length%2!=0;this.startFromEven&&(a=!a);let s=!1;for(;n<o&&(s=!e.get(n));)n++;let l=0,c=n;for(let t=n;t<o;t++)if(e.get(t)!=s)i[l]++;else{if(3==l){if(a&&tn.reverseCounters(i),tn.isFinderPattern(i)){this.startEnd[0]=c,this.startEnd[1]=t;return}a&&tn.reverseCounters(i),c+=i[0]+i[1],i[0]=i[2],i[1]=i[3],i[2]=0,i[3]=0,l--}else l++;i[l]=1,s=!s}throw new X}static reverseCounters(e){let t=e.length;for(let r=0;r<t/2;++r){let n=e[r];e[r]=e[t-r-1],e[t-r-1]=n}}parseFoundFinderPattern(e,t,r){let n,i,o,a;if(r){let t=this.startEnd[0]-1;for(;t>=0&&!e.get(t);)t--;t++,n=this.startEnd[0]-t,i=t,o=this.startEnd[1]}else i=this.startEnd[0],n=(o=e.getNextUnset(this.startEnd[1]+1))-this.startEnd[1];let s=this.getDecodeFinderCounters();P.arraycopy(s,0,s,1,s.length-1),s[0]=n;try{a=this.parseFinderValue(s,tn.FINDER_PATTERNS)}catch(e){return null}return new ej(a,[i,o],i,o,t)}decodeDataCharacter(e,t,r,n){let i=this.getDataCharacterCounters();for(let e=0;e<i.length;e++)i[e]=0;if(n)tn.recordPatternInReverse(e,t.getStartEnd()[0],i);else{tn.recordPattern(e,t.getStartEnd()[1],i);for(let e=0,t=i.length-1;e<t;e++,t--){let r=i[e];i[e]=i[t],i[t]=r}}let o=eg.sum(new Int32Array(i))/17,a=(t.getStartEnd()[1]-t.getStartEnd()[0])/15;if(Math.abs(o-a)/a>.3)throw new X;let s=this.getOddCounts(),l=this.getEvenCounts(),c=this.getOddRoundingErrors(),u=this.getEvenRoundingErrors();for(let e=0;e<i.length;e++){let t=+i[e]/o,r=t+.5;if(r<1){if(t<.3)throw new X;r=1}else if(r>8){if(t>8.7)throw new X;r=8}let n=e/2;(1&e)==0?(s[n]=r,c[n]=t-r):(l[n]=r,u[n]=t-r)}this.adjustOddEvenCounts(17);let h=4*t.getValue()+2*!r+ +!n-1,d=0,f=0;for(let e=s.length-1;e>=0;e--){if(tn.isNotA1left(t,r,n)){let t=tn.WEIGHTS[h][2*e];f+=s[e]*t}d+=s[e]}let g=0;for(let e=l.length-1;e>=0;e--)if(tn.isNotA1left(t,r,n)){let t=tn.WEIGHTS[h][2*e+1];g+=l[e]*t}let p=f+g;if((1&d)!=0||d>13||d<4)throw new X;let m=(13-d)/2,w=tn.SYMBOL_WIDEST[m],C=eG.getRSSvalue(s,w,!0),E=eG.getRSSvalue(l,9-w,!1);return new eV(C*tn.EVEN_TOTAL_SUBSET[m]+E+tn.GSUM[m],p)}static isNotA1left(e,t,r){return!(0==e.getValue()&&t&&r)}adjustOddEvenCounts(e){let t=eg.sum(new Int32Array(this.getOddCounts())),r=eg.sum(new Int32Array(this.getEvenCounts())),n=!1,i=!1;t>13?i=!0:t<4&&(n=!0);let o=!1,a=!1;r>13?a=!0:r<4&&(o=!0);let s=t+r-e,l=(1&t)==1,c=(1&r)==0;if(1==s)if(l){if(c)throw new X;i=!0}else{if(!c)throw new X;a=!0}else if(-1==s)if(l){if(c)throw new X;n=!0}else{if(!c)throw new X;o=!0}else if(0==s){if(l){if(!c)throw new X;t<r?(n=!0,a=!0):(i=!0,o=!0)}else if(c)throw new X}else throw new X;if(n){if(i)throw new X;tn.increment(this.getOddCounts(),this.getOddRoundingErrors())}if(i&&tn.decrement(this.getOddCounts(),this.getOddRoundingErrors()),o){if(a)throw new X;tn.increment(this.getEvenCounts(),this.getOddRoundingErrors())}a&&tn.decrement(this.getEvenCounts(),this.getEvenRoundingErrors())}}tn.SYMBOL_WIDEST=[7,5,4,3,1],tn.EVEN_TOTAL_SUBSET=[4,20,52,104,204],tn.GSUM=[0,348,1388,2948,3988],tn.FINDER_PATTERNS=[Int32Array.from([1,8,4,1]),Int32Array.from([3,6,4,1]),Int32Array.from([3,4,6,1]),Int32Array.from([3,2,8,1]),Int32Array.from([2,6,5,1]),Int32Array.from([2,2,9,1])],tn.WEIGHTS=[[1,3,9,27,81,32,96,77],[20,60,180,118,143,7,21,63],[189,145,13,39,117,140,209,205],[193,157,49,147,19,57,171,91],[62,186,136,197,169,85,44,132],[185,133,188,142,4,12,36,108],[113,128,173,97,80,29,87,50],[150,28,84,41,123,158,52,156],[46,138,203,187,139,206,196,166],[76,17,51,153,37,111,122,155],[43,129,176,106,107,110,119,146],[16,48,144,10,30,90,59,177],[109,116,137,200,178,112,125,164],[70,210,208,202,184,130,179,115],[134,191,151,31,93,68,204,190],[148,22,66,198,172,94,71,2],[6,18,54,162,64,192,154,40],[120,149,25,75,14,42,126,167],[79,26,78,23,69,207,199,175],[103,98,83,38,114,131,182,124],[161,61,183,127,170,88,53,159],[55,165,73,8,24,72,5,15],[45,135,194,160,58,174,100,89]],tn.FINDER_PAT_A=0,tn.FINDER_PAT_B=1,tn.FINDER_PAT_C=2,tn.FINDER_PAT_D=3,tn.FINDER_PAT_E=4,tn.FINDER_PAT_F=5,tn.FINDER_PATTERN_SEQUENCES=[[tn.FINDER_PAT_A,tn.FINDER_PAT_A],[tn.FINDER_PAT_A,tn.FINDER_PAT_B,tn.FINDER_PAT_B],[tn.FINDER_PAT_A,tn.FINDER_PAT_C,tn.FINDER_PAT_B,tn.FINDER_PAT_D],[tn.FINDER_PAT_A,tn.FINDER_PAT_E,tn.FINDER_PAT_B,tn.FINDER_PAT_D,tn.FINDER_PAT_C],[tn.FINDER_PAT_A,tn.FINDER_PAT_E,tn.FINDER_PAT_B,tn.FINDER_PAT_D,tn.FINDER_PAT_D,tn.FINDER_PAT_F],[tn.FINDER_PAT_A,tn.FINDER_PAT_E,tn.FINDER_PAT_B,tn.FINDER_PAT_D,tn.FINDER_PAT_E,tn.FINDER_PAT_F,tn.FINDER_PAT_F],[tn.FINDER_PAT_A,tn.FINDER_PAT_A,tn.FINDER_PAT_B,tn.FINDER_PAT_B,tn.FINDER_PAT_C,tn.FINDER_PAT_C,tn.FINDER_PAT_D,tn.FINDER_PAT_D],[tn.FINDER_PAT_A,tn.FINDER_PAT_A,tn.FINDER_PAT_B,tn.FINDER_PAT_B,tn.FINDER_PAT_C,tn.FINDER_PAT_C,tn.FINDER_PAT_D,tn.FINDER_PAT_E,tn.FINDER_PAT_E],[tn.FINDER_PAT_A,tn.FINDER_PAT_A,tn.FINDER_PAT_B,tn.FINDER_PAT_B,tn.FINDER_PAT_C,tn.FINDER_PAT_C,tn.FINDER_PAT_D,tn.FINDER_PAT_E,tn.FINDER_PAT_F,tn.FINDER_PAT_F],[tn.FINDER_PAT_A,tn.FINDER_PAT_A,tn.FINDER_PAT_B,tn.FINDER_PAT_B,tn.FINDER_PAT_C,tn.FINDER_PAT_D,tn.FINDER_PAT_D,tn.FINDER_PAT_E,tn.FINDER_PAT_E,tn.FINDER_PAT_F,tn.FINDER_PAT_F]],tn.MAX_PAIRS=11;class ti extends eV{constructor(e,t,r){super(e,t),this.count=0,this.finderPattern=r}getFinderPattern(){return this.finderPattern}getCount(){return this.count}incrementCount(){this.count++}}class to extends ez{constructor(){super(...arguments),this.possibleLeftPairs=[],this.possibleRightPairs=[]}decodeRow(e,t,r){let n=this.decodePair(t,!1,e,r);to.addOrTally(this.possibleLeftPairs,n),t.reverse();let i=this.decodePair(t,!0,e,r);for(let e of(to.addOrTally(this.possibleRightPairs,i),t.reverse(),this.possibleLeftPairs))if(e.getCount()>1){for(let t of this.possibleRightPairs)if(t.getCount()>1&&to.checkChecksum(e,t))return to.constructResult(e,t)}throw new X}static addOrTally(e,t){if(null==t)return;let r=!1;for(let n of e)if(n.getValue()===t.getValue()){n.incrementCount(),r=!0;break}r||e.push(t)}reset(){this.possibleLeftPairs.length=0,this.possibleRightPairs.length=0}static constructResult(e,t){let r=new String(4537077*e.getValue()+t.getValue()).toString(),n=new W;for(let e=13-r.length;e>0;e--)n.append("0");n.append(r);let i=0;for(let e=0;e<13;e++){let t=n.charAt(e).charCodeAt(0)-48;i+=(1&e)==0?3*t:t}10==(i=10-i%10)&&(i=0),n.append(i.toString());let o=e.getFinderPattern().getResultPoints(),a=t.getFinderPattern().getResultPoints();return new er(n.toString(),null,0,[o[0],o[1],a[0],a[1]],en.RSS_14,new Date().getTime())}static checkChecksum(e,t){let r=(e.getChecksumPortion()+16*t.getChecksumPortion())%79,n=9*e.getFinderPattern().getValue()+t.getFinderPattern().getValue();return n>72&&n--,n>8&&n--,r===n}decodePair(e,t,r,n){try{let i=this.findFinderPattern(e,t),o=this.parseFoundFinderPattern(e,r,t,i),a=null==n?null:n.get(U.NEED_RESULT_POINT_CALLBACK);if(null!=a){let n=(i[0]+i[1])/2;t&&(n=e.getSize()-1-n),a.foundPossibleResultPoint(new em(n,r))}let s=this.decodeDataCharacter(e,o,!0),l=this.decodeDataCharacter(e,o,!1);return new ti(1597*s.getValue()+l.getValue(),s.getChecksumPortion()+4*l.getChecksumPortion(),o)}catch(e){return null}}decodeDataCharacter(e,t,r){let n=this.getDataCharacterCounters();for(let e=0;e<n.length;e++)n[e]=0;if(r)eN.recordPatternInReverse(e,t.getStartEnd()[0],n);else{eN.recordPattern(e,t.getStartEnd()[1]+1,n);for(let e=0,t=n.length-1;e<t;e++,t--){let r=n[e];n[e]=n[t],n[t]=r}}let i=r?16:15,o=eg.sum(new Int32Array(n))/i,a=this.getOddCounts(),s=this.getEvenCounts(),l=this.getOddRoundingErrors(),c=this.getEvenRoundingErrors();for(let e=0;e<n.length;e++){let t=n[e]/o,r=Math.floor(t+.5);r<1?r=1:r>8&&(r=8);let i=Math.floor(e/2);(1&e)==0?(a[i]=r,l[i]=t-r):(s[i]=r,c[i]=t-r)}this.adjustOddEvenCounts(r,i);let u=0,h=0;for(let e=a.length-1;e>=0;e--)h*=9,h+=a[e],u+=a[e];let d=0,f=0;for(let e=s.length-1;e>=0;e--)d*=9,d+=s[e],f+=s[e];let g=h+3*d;if(r){if((1&u)!=0||u>12||u<4)throw new X;let e=(12-u)/2,t=to.OUTSIDE_ODD_WIDEST[e],r=eG.getRSSvalue(a,t,!1),n=eG.getRSSvalue(s,9-t,!0);return new eV(r*to.OUTSIDE_EVEN_TOTAL_SUBSET[e]+n+to.OUTSIDE_GSUM[e],g)}{if((1&f)!=0||f>10||f<4)throw new X;let e=(10-f)/2,t=to.INSIDE_ODD_WIDEST[e],r=eG.getRSSvalue(a,t,!0);return new eV(eG.getRSSvalue(s,9-t,!1)*to.INSIDE_ODD_TOTAL_SUBSET[e]+r+to.INSIDE_GSUM[e],g)}}findFinderPattern(e,t){let r=this.getDecodeFinderCounters();r[0]=0,r[1]=0,r[2]=0,r[3]=0;let n=e.getSize(),i=!1,o=0;for(;o<n&&t!==(i=!e.get(o));)o++;let a=0,s=o;for(let t=o;t<n;t++)if(e.get(t)!==i)r[a]++;else{if(3===a){if(ez.isFinderPattern(r))return[s,t];s+=r[0]+r[1],r[0]=r[2],r[1]=r[3],r[2]=0,r[3]=0,a--}else a++;r[a]=1,i=!i}throw new X}parseFoundFinderPattern(e,t,r,n){let i=e.get(n[0]),o=n[0]-1;for(;o>=0&&i!==e.get(o);)o--;o++;let a=n[0]-o,s=this.getDecodeFinderCounters(),l=new Int32Array(s.length);P.arraycopy(s,0,l,1,s.length-1),l[0]=a;let c=this.parseFinderValue(l,to.FINDER_PATTERNS),u=o,h=n[1];return r&&(u=e.getSize()-1-u,h=e.getSize()-1-h),new ej(c,[o,n[1]],u,h,t)}adjustOddEvenCounts(e,t){let r=eg.sum(new Int32Array(this.getOddCounts())),n=eg.sum(new Int32Array(this.getEvenCounts())),i=!1,o=!1,a=!1,s=!1;e?(r>12?o=!0:r<4&&(i=!0),n>12?s=!0:n<4&&(a=!0)):(r>11?o=!0:r<5&&(i=!0),n>10?s=!0:n<4&&(a=!0));let l=r+n-t,c=(1&r)==+!!e,u=(1&n)==1;if(1===l)if(c){if(u)throw new X;o=!0}else{if(!u)throw new X;s=!0}else if(-1===l)if(c){if(u)throw new X;i=!0}else{if(!u)throw new X;a=!0}else if(0===l){if(c){if(!u)throw new X;r<n?(i=!0,s=!0):(o=!0,a=!0)}else if(u)throw new X}else throw new X;if(i){if(o)throw new X;ez.increment(this.getOddCounts(),this.getOddRoundingErrors())}if(o&&ez.decrement(this.getOddCounts(),this.getOddRoundingErrors()),a){if(s)throw new X;ez.increment(this.getEvenCounts(),this.getOddRoundingErrors())}s&&ez.decrement(this.getEvenCounts(),this.getEvenRoundingErrors())}}to.OUTSIDE_EVEN_TOTAL_SUBSET=[1,10,34,70,126],to.INSIDE_ODD_TOTAL_SUBSET=[4,20,48,81],to.OUTSIDE_GSUM=[0,161,961,2015,2715],to.INSIDE_GSUM=[0,336,1036,1516],to.OUTSIDE_ODD_WIDEST=[8,6,4,3,1],to.INSIDE_ODD_WIDEST=[2,4,6,8],to.FINDER_PATTERNS=[Int32Array.from([3,8,2,1]),Int32Array.from([3,5,5,1]),Int32Array.from([3,3,7,1]),Int32Array.from([3,1,9,1]),Int32Array.from([2,7,4,1]),Int32Array.from([2,5,6,1]),Int32Array.from([2,3,8,1]),Int32Array.from([1,5,7,1]),Int32Array.from([1,3,9,1])];class ta extends eN{constructor(e,t){super(),this.readers=[],this.verbose=!0===t;let r=e?e.get(U.POSSIBLE_FORMATS):null,n=e&&void 0!==e.get(U.ASSUME_CODE_39_CHECK_DIGIT);r?((r.includes(en.EAN_13)||r.includes(en.UPC_A)||r.includes(en.EAN_8)||r.includes(en.UPC_E))&&this.readers.push(new eH(e)),r.includes(en.CODE_39)&&this.readers.push(new eD(n)),r.includes(en.CODE_128)&&this.readers.push(new eM),r.includes(en.ITF)&&this.readers.push(new eO),r.includes(en.RSS_14)&&this.readers.push(new to),r.includes(en.RSS_EXPANDED)&&this.readers.push(new tn(this.verbose))):(this.readers.push(new eH(e)),this.readers.push(new eD),this.readers.push(new eH(e)),this.readers.push(new eM),this.readers.push(new eO),this.readers.push(new to),this.readers.push(new tn(this.verbose)))}decodeRow(e,t,r){for(let n=0;n<this.readers.length;n++)try{return this.readers[n].decodeRow(e,t,r)}catch(e){}throw new X}reset(){this.readers.forEach(e=>e.reset())}}class ts{constructor(e,t,r){this.ecCodewords=e,this.ecBlocks=[t],r&&this.ecBlocks.push(r)}getECCodewords(){return this.ecCodewords}getECBlocks(){return this.ecBlocks}}class tl{constructor(e,t){this.count=e,this.dataCodewords=t}getCount(){return this.count}getDataCodewords(){return this.dataCodewords}}class tc{constructor(e,t,r,n,i,o){this.versionNumber=e,this.symbolSizeRows=t,this.symbolSizeColumns=r,this.dataRegionSizeRows=n,this.dataRegionSizeColumns=i,this.ecBlocks=o;let a=0,s=o.getECCodewords();for(let e of o.getECBlocks())a+=e.getCount()*(e.getDataCodewords()+s);this.totalCodewords=a}getVersionNumber(){return this.versionNumber}getSymbolSizeRows(){return this.symbolSizeRows}getSymbolSizeColumns(){return this.symbolSizeColumns}getDataRegionSizeRows(){return this.dataRegionSizeRows}getDataRegionSizeColumns(){return this.dataRegionSizeColumns}getTotalCodewords(){return this.totalCodewords}getECBlocks(){return this.ecBlocks}static getVersionForDimensions(e,t){if((1&e)!=0||(1&t)!=0)throw new H;for(let r of tc.VERSIONS)if(r.symbolSizeRows===e&&r.symbolSizeColumns===t)return r;throw new H}toString(){return""+this.versionNumber}static buildVersions(){return[new tc(1,10,10,8,8,new ts(5,new tl(1,3))),new tc(2,12,12,10,10,new ts(7,new tl(1,5))),new tc(3,14,14,12,12,new ts(10,new tl(1,8))),new tc(4,16,16,14,14,new ts(12,new tl(1,12))),new tc(5,18,18,16,16,new ts(14,new tl(1,18))),new tc(6,20,20,18,18,new ts(18,new tl(1,22))),new tc(7,22,22,20,20,new ts(20,new tl(1,30))),new tc(8,24,24,22,22,new ts(24,new tl(1,36))),new tc(9,26,26,24,24,new ts(28,new tl(1,44))),new tc(10,32,32,14,14,new ts(36,new tl(1,62))),new tc(11,36,36,16,16,new ts(42,new tl(1,86))),new tc(12,40,40,18,18,new ts(48,new tl(1,114))),new tc(13,44,44,20,20,new ts(56,new tl(1,144))),new tc(14,48,48,22,22,new ts(68,new tl(1,174))),new tc(15,52,52,24,24,new ts(42,new tl(2,102))),new tc(16,64,64,14,14,new ts(56,new tl(2,140))),new tc(17,72,72,16,16,new ts(36,new tl(4,92))),new tc(18,80,80,18,18,new ts(48,new tl(4,114))),new tc(19,88,88,20,20,new ts(56,new tl(4,144))),new tc(20,96,96,22,22,new ts(68,new tl(4,174))),new tc(21,104,104,24,24,new ts(56,new tl(6,136))),new tc(22,120,120,18,18,new ts(68,new tl(6,175))),new tc(23,132,132,20,20,new ts(62,new tl(8,163))),new tc(24,144,144,22,22,new ts(62,new tl(8,156),new tl(2,155))),new tc(25,8,18,6,16,new ts(7,new tl(1,5))),new tc(26,8,32,6,14,new ts(11,new tl(1,10))),new tc(27,12,26,10,24,new ts(14,new tl(1,16))),new tc(28,12,36,10,16,new ts(18,new tl(1,22))),new tc(29,16,36,14,16,new ts(24,new tl(1,32))),new tc(30,16,48,14,22,new ts(28,new tl(1,49)))]}}tc.VERSIONS=tc.buildVersions();class tu{constructor(e){let t=e.getHeight();if(t<8||t>144||(1&t)!=0)throw new H;this.version=tu.readVersion(e),this.mappingBitMatrix=this.extractDataRegion(e),this.readMappingMatrix=new Y(this.mappingBitMatrix.getWidth(),this.mappingBitMatrix.getHeight())}getVersion(){return this.version}static readVersion(e){let t=e.getHeight(),r=e.getWidth();return tc.getVersionForDimensions(t,r)}readCodewords(){let e=new Int8Array(this.version.getTotalCodewords()),t=0,r=4,n=0,i=this.mappingBitMatrix.getHeight(),o=this.mappingBitMatrix.getWidth(),a=!1,s=!1,l=!1,c=!1;do if(r!==i||0!==n||a)if(r!==i-2||0!==n||(3&o)==0||s)if(r!==i+4||2!==n||(7&o)!=0||l)if(r!==i-2||0!==n||(7&o)!=4||c){do r<i&&n>=0&&!this.readMappingMatrix.get(n,r)&&(e[t++]=255&this.readUtah(r,n,i,o)),r-=2,n+=2;while(r>=0&&n<o);r+=1,n+=3;do r>=0&&n<o&&!this.readMappingMatrix.get(n,r)&&(e[t++]=255&this.readUtah(r,n,i,o)),r+=2,n-=2;while(r<i&&n>=0);r+=3,n+=1}else e[t++]=255&this.readCorner4(i,o),r-=2,n+=2,c=!0;else e[t++]=255&this.readCorner3(i,o),r-=2,n+=2,l=!0;else e[t++]=255&this.readCorner2(i,o),r-=2,n+=2,s=!0;else e[t++]=255&this.readCorner1(i,o),r-=2,n+=2,a=!0;while(r<i||n<o);if(t!==this.version.getTotalCodewords())throw new H;return e}readModule(e,t,r,n){return e<0&&(e+=r,t+=4-(r+4&7)),t<0&&(t+=n,e+=4-(n+4&7)),this.readMappingMatrix.set(t,e),this.mappingBitMatrix.get(t,e)}readUtah(e,t,r,n){let i=0;return this.readModule(e-2,t-2,r,n)&&(i|=1),i<<=1,this.readModule(e-2,t-1,r,n)&&(i|=1),i<<=1,this.readModule(e-1,t-2,r,n)&&(i|=1),i<<=1,this.readModule(e-1,t-1,r,n)&&(i|=1),i<<=1,this.readModule(e-1,t,r,n)&&(i|=1),i<<=1,this.readModule(e,t-2,r,n)&&(i|=1),i<<=1,this.readModule(e,t-1,r,n)&&(i|=1),i<<=1,this.readModule(e,t,r,n)&&(i|=1),i}readCorner1(e,t){let r=0;return this.readModule(e-1,0,e,t)&&(r|=1),r<<=1,this.readModule(e-1,1,e,t)&&(r|=1),r<<=1,this.readModule(e-1,2,e,t)&&(r|=1),r<<=1,this.readModule(0,t-2,e,t)&&(r|=1),r<<=1,this.readModule(0,t-1,e,t)&&(r|=1),r<<=1,this.readModule(1,t-1,e,t)&&(r|=1),r<<=1,this.readModule(2,t-1,e,t)&&(r|=1),r<<=1,this.readModule(3,t-1,e,t)&&(r|=1),r}readCorner2(e,t){let r=0;return this.readModule(e-3,0,e,t)&&(r|=1),r<<=1,this.readModule(e-2,0,e,t)&&(r|=1),r<<=1,this.readModule(e-1,0,e,t)&&(r|=1),r<<=1,this.readModule(0,t-4,e,t)&&(r|=1),r<<=1,this.readModule(0,t-3,e,t)&&(r|=1),r<<=1,this.readModule(0,t-2,e,t)&&(r|=1),r<<=1,this.readModule(0,t-1,e,t)&&(r|=1),r<<=1,this.readModule(1,t-1,e,t)&&(r|=1),r}readCorner3(e,t){let r=0;return this.readModule(e-1,0,e,t)&&(r|=1),r<<=1,this.readModule(e-1,t-1,e,t)&&(r|=1),r<<=1,this.readModule(0,t-3,e,t)&&(r|=1),r<<=1,this.readModule(0,t-2,e,t)&&(r|=1),r<<=1,this.readModule(0,t-1,e,t)&&(r|=1),r<<=1,this.readModule(1,t-3,e,t)&&(r|=1),r<<=1,this.readModule(1,t-2,e,t)&&(r|=1),r<<=1,this.readModule(1,t-1,e,t)&&(r|=1),r}readCorner4(e,t){let r=0;return this.readModule(e-3,0,e,t)&&(r|=1),r<<=1,this.readModule(e-2,0,e,t)&&(r|=1),r<<=1,this.readModule(e-1,0,e,t)&&(r|=1),r<<=1,this.readModule(0,t-2,e,t)&&(r|=1),r<<=1,this.readModule(0,t-1,e,t)&&(r|=1),r<<=1,this.readModule(1,t-1,e,t)&&(r|=1),r<<=1,this.readModule(2,t-1,e,t)&&(r|=1),r<<=1,this.readModule(3,t-1,e,t)&&(r|=1),r}extractDataRegion(e){let t=this.version.getSymbolSizeRows(),r=this.version.getSymbolSizeColumns();if(e.getHeight()!==t)throw new D("Dimension of bitMatrix must match the version size");let n=this.version.getDataRegionSizeRows(),i=this.version.getDataRegionSizeColumns(),o=t/n|0,a=r/i|0,s=new Y(a*i,o*n);for(let t=0;t<o;++t){let r=t*n;for(let o=0;o<a;++o){let a=o*i;for(let l=0;l<n;++l){let c=t*(n+2)+1+l,u=r+l;for(let t=0;t<i;++t){let r=o*(i+2)+1+t;if(e.get(r,c)){let e=a+t;s.set(e,u)}}}}}return s}}class th{constructor(e,t){this.numDataCodewords=e,this.codewords=t}static getDataBlocks(e,t){let r=t.getECBlocks(),n=0,i=r.getECBlocks();for(let e of i)n+=e.getCount();let o=Array(n),a=0;for(let e of i)for(let t=0;t<e.getCount();t++){let t=e.getDataCodewords(),n=r.getECCodewords()+t;o[a++]=new th(t,new Uint8Array(n))}let s=o[0].codewords.length-r.getECCodewords(),l=s-1,c=0;for(let t=0;t<l;t++)for(let r=0;r<a;r++)o[r].codewords[t]=e[c++];let u=24===t.getVersionNumber(),h=u?8:a;for(let t=0;t<h;t++)o[t].codewords[s-1]=e[c++];let d=o[0].codewords.length;for(let t=s;t<d;t++)for(let r=0;r<a;r++){let n=u?(r+8)%a:r,i=u&&n>7?t-1:t;o[n].codewords[i]=e[c++]}if(c!==e.length)throw new D;return o}getNumDataCodewords(){return this.numDataCodewords}getCodewords(){return this.codewords}}class td{constructor(e){this.bytes=e,this.byteOffset=0,this.bitOffset=0}getBitOffset(){return this.bitOffset}getByteOffset(){return this.byteOffset}readBits(e){if(e<1||e>32||e>this.available())throw new D(""+e);let t=0,r=this.bitOffset,n=this.byteOffset,i=this.bytes;if(r>0){let o=8-r,a=e<o?e:o,s=o-a;t=(i[n]&255>>8-a<<s)>>s,e-=a,8===(r+=a)&&(r=0,n++)}if(e>0){for(;e>=8;)t=t<<8|255&i[n],n++,e-=8;if(e>0){let o=8-e;t=t<<e|(i[n]&255>>o<<o)>>o,r+=e}}return this.bitOffset=r,this.byteOffset=n,t}available(){return 8*(this.bytes.length-this.byteOffset)-this.bitOffset}}(l=E||(E={}))[l.PAD_ENCODE=0]="PAD_ENCODE",l[l.ASCII_ENCODE=1]="ASCII_ENCODE",l[l.C40_ENCODE=2]="C40_ENCODE",l[l.TEXT_ENCODE=3]="TEXT_ENCODE",l[l.ANSIX12_ENCODE=4]="ANSIX12_ENCODE",l[l.EDIFACT_ENCODE=5]="EDIFACT_ENCODE",l[l.BASE256_ENCODE=6]="BASE256_ENCODE";class tf{static decode(e){let t=new td(e),r=new W,n=new W,i=[],o=E.ASCII_ENCODE;do if(o===E.ASCII_ENCODE)o=this.decodeAsciiSegment(t,r,n);else{switch(o){case E.C40_ENCODE:this.decodeC40Segment(t,r);break;case E.TEXT_ENCODE:this.decodeTextSegment(t,r);break;case E.ANSIX12_ENCODE:this.decodeAnsiX12Segment(t,r);break;case E.EDIFACT_ENCODE:this.decodeEdifactSegment(t,r);break;case E.BASE256_ENCODE:this.decodeBase256Segment(t,r,i);break;default:throw new H}o=E.ASCII_ENCODE}while(o!==E.PAD_ENCODE&&t.available()>0);return n.length()>0&&r.append(n.toString()),new eo(e,r.toString(),0===i.length?null:i,null)}static decodeAsciiSegment(e,t,r){let n=!1;do{let i=e.readBits(8);if(0===i)throw new H;if(i<=128){n&&(i+=128),t.append(String.fromCharCode(i-1));break}if(129===i)return E.PAD_ENCODE;else if(i<=229){let e=i-130;e<10&&t.append("0"),t.append(""+e)}else switch(i){case 230:return E.C40_ENCODE;case 231:return E.BASE256_ENCODE;case 232:t.append("\x1d");break;case 233:case 234:case 241:break;case 235:n=!0;break;case 236:t.append("[)>\x1e05\x1d"),r.insert(0,"\x1e\x04");break;case 237:t.append("[)>\x1e06\x1d"),r.insert(0,"\x1e\x04");break;case 238:return E.ANSIX12_ENCODE;case 239:return E.TEXT_ENCODE;case 240:return E.EDIFACT_ENCODE;default:if(254!==i||0!==e.available())throw new H}}while(e.available()>0);return E.ASCII_ENCODE}static decodeC40Segment(e,t){let r=!1,n=[],i=0;do{if(8===e.available())return;let o=e.readBits(8);if(254===o)return;this.parseTwoBytes(o,e.readBits(8),n);for(let e=0;e<3;e++){let o=n[e];switch(i){case 0:if(o<3)i=o+1;else if(o<this.C40_BASIC_SET_CHARS.length){let e=this.C40_BASIC_SET_CHARS[o];r?(t.append(String.fromCharCode(e.charCodeAt(0)+128)),r=!1):t.append(e)}else throw new H;break;case 1:r?(t.append(String.fromCharCode(o+128)),r=!1):t.append(String.fromCharCode(o)),i=0;break;case 2:if(o<this.C40_SHIFT2_SET_CHARS.length){let e=this.C40_SHIFT2_SET_CHARS[o];r?(t.append(String.fromCharCode(e.charCodeAt(0)+128)),r=!1):t.append(e)}else switch(o){case 27:t.append("\x1d");break;case 30:r=!0;break;default:throw new H}i=0;break;case 3:r?(t.append(String.fromCharCode(o+224)),r=!1):t.append(String.fromCharCode(o+96)),i=0;break;default:throw new H}}}while(e.available()>0)}static decodeTextSegment(e,t){let r=!1,n=[],i=0;do{if(8===e.available())return;let o=e.readBits(8);if(254===o)return;this.parseTwoBytes(o,e.readBits(8),n);for(let e=0;e<3;e++){let o=n[e];switch(i){case 0:if(o<3)i=o+1;else if(o<this.TEXT_BASIC_SET_CHARS.length){let e=this.TEXT_BASIC_SET_CHARS[o];r?(t.append(String.fromCharCode(e.charCodeAt(0)+128)),r=!1):t.append(e)}else throw new H;break;case 1:r?(t.append(String.fromCharCode(o+128)),r=!1):t.append(String.fromCharCode(o)),i=0;break;case 2:if(o<this.TEXT_SHIFT2_SET_CHARS.length){let e=this.TEXT_SHIFT2_SET_CHARS[o];r?(t.append(String.fromCharCode(e.charCodeAt(0)+128)),r=!1):t.append(e)}else switch(o){case 27:t.append("\x1d");break;case 30:r=!0;break;default:throw new H}i=0;break;case 3:if(o<this.TEXT_SHIFT3_SET_CHARS.length){let e=this.TEXT_SHIFT3_SET_CHARS[o];r?(t.append(String.fromCharCode(e.charCodeAt(0)+128)),r=!1):t.append(e),i=0}else throw new H;break;default:throw new H}}}while(e.available()>0)}static decodeAnsiX12Segment(e,t){let r=[];do{if(8===e.available())return;let n=e.readBits(8);if(254===n)return;this.parseTwoBytes(n,e.readBits(8),r);for(let e=0;e<3;e++){let n=r[e];switch(n){case 0:t.append("\r");break;case 1:t.append("*");break;case 2:t.append(">");break;case 3:t.append(" ");break;default:if(n<14)t.append(String.fromCharCode(n+44));else if(n<40)t.append(String.fromCharCode(n+51));else throw new H}}}while(e.available()>0)}static parseTwoBytes(e,t,r){let n=(e<<8)+t-1,i=Math.floor(n/1600);r[0]=i,n-=1600*i,i=Math.floor(n/40),r[1]=i,r[2]=n-40*i}static decodeEdifactSegment(e,t){do{if(16>=e.available())return;for(let r=0;r<4;r++){let r=e.readBits(6);if(31===r){let t=8-e.getBitOffset();8!==t&&e.readBits(t);return}(32&r)==0&&(r|=64),t.append(String.fromCharCode(r))}}while(e.available()>0)}static decodeBase256Segment(e,t,r){let n,i=1+e.getByteOffset(),o=this.unrandomize255State(e.readBits(8),i++);if((n=0===o?e.available()/8|0:o<250?o:250*(o-249)+this.unrandomize255State(e.readBits(8),i++))<0)throw new H;let a=new Uint8Array(n);for(let t=0;t<n;t++){if(8>e.available())throw new H;a[t]=this.unrandomize255State(e.readBits(8),i++)}r.push(a);try{t.append(j.decode(a,G.ISO88591))}catch(e){throw new eh("Platform does not support required encoding: "+e.message)}}static unrandomize255State(e,t){let r=e-(149*t%255+1);return r>=0?r:r+256}}tf.C40_BASIC_SET_CHARS=["*","*","*"," ","0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],tf.C40_SHIFT2_SET_CHARS=["!",'"',"#","$","%","&","'","(",")","*","+",",","-",".","/",":",";","<","=",">","?","@","[","\\","]","^","_"],tf.TEXT_BASIC_SET_CHARS=["*","*","*"," ","0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"],tf.TEXT_SHIFT2_SET_CHARS=tf.C40_SHIFT2_SET_CHARS,tf.TEXT_SHIFT3_SET_CHARS=["`","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","{","|","}","~",""];class tg{constructor(){this.rsDecoder=new ed(ec.DATA_MATRIX_FIELD_256)}decode(e){let t=new tu(e),r=t.getVersion(),n=t.readCodewords(),i=th.getDataBlocks(n,r),o=0;for(let e of i)o+=e.getNumDataCodewords();let a=new Uint8Array(o),s=i.length;for(let e=0;e<s;e++){let t=i[e],r=t.getCodewords(),n=t.getNumDataCodewords();this.correctErrors(r,n);for(let t=0;t<n;t++)a[t*s+e]=r[t]}return tf.decode(a)}correctErrors(e,t){let r=new Int32Array(e);try{this.rsDecoder.decode(r,e.length-t)}catch(e){throw new R}for(let n=0;n<t;n++)e[n]=r[n]}}class tp{constructor(e){this.image=e,this.rectangleDetector=new eE(this.image)}detect(){let e=this.rectangleDetector.detect(),t=this.detectSolid1(e);if((t=this.detectSolid2(t))[3]=this.correctTopRight(t),!t[3])throw new X;let r=(t=this.shiftToModuleCenter(t))[0],n=t[1],i=t[2],o=t[3],a=this.transitionsBetween(r,o)+1,s=this.transitionsBetween(i,o)+1;return(1&a)==1&&(a+=1),(1&s)==1&&(s+=1),4*a<7*s&&4*s<7*a&&(a=s=Math.max(a,s)),new ew(tp.sampleGrid(this.image,r,n,i,o,a,s),[r,n,i,o])}static shiftPoint(e,t,r){let n=(t.getX()-e.getX())/(r+1),i=(t.getY()-e.getY())/(r+1);return new em(e.getX()+n,e.getY()+i)}static moveAway(e,t,r){let n=e.getX(),i=e.getY();return n<t?n-=1:n+=1,i<r?i-=1:i+=1,new em(n,i)}detectSolid1(e){let t=e[0],r=e[1],n=e[3],i=e[2],o=this.transitionsBetween(t,r),a=this.transitionsBetween(r,n),s=this.transitionsBetween(n,i),l=this.transitionsBetween(i,t),c=o,u=[i,t,r,n];return c>a&&(c=a,u[0]=t,u[1]=r,u[2]=n,u[3]=i),c>s&&(c=s,u[0]=r,u[1]=n,u[2]=i,u[3]=t),c>l&&(u[0]=n,u[1]=i,u[2]=t,u[3]=r),u}detectSolid2(e){let t=e[0],r=e[1],n=e[2],i=e[3],o=this.transitionsBetween(t,i),a=tp.shiftPoint(r,n,(o+1)*4),s=tp.shiftPoint(n,r,(o+1)*4);return this.transitionsBetween(a,t)<this.transitionsBetween(s,i)?(e[0]=t,e[1]=r,e[2]=n,e[3]=i):(e[0]=r,e[1]=n,e[2]=i,e[3]=t),e}correctTopRight(e){let t=e[0],r=e[1],n=e[2],i=e[3],o=this.transitionsBetween(t,i),a=this.transitionsBetween(r,i),s=tp.shiftPoint(t,r,(a+1)*4),l=tp.shiftPoint(n,r,(o+1)*4);o=this.transitionsBetween(s,i),a=this.transitionsBetween(l,i);let c=new em(i.getX()+(n.getX()-r.getX())/(o+1),i.getY()+(n.getY()-r.getY())/(o+1)),u=new em(i.getX()+(t.getX()-r.getX())/(a+1),i.getY()+(t.getY()-r.getY())/(a+1));return this.isValid(c)?this.isValid(u)?this.transitionsBetween(s,c)+this.transitionsBetween(l,c)>this.transitionsBetween(s,u)+this.transitionsBetween(l,u)?c:u:c:this.isValid(u)?u:null}shiftToModuleCenter(e){let t,r,n=e[0],i=e[1],o=e[2],a=e[3],s=this.transitionsBetween(n,a)+1,l=this.transitionsBetween(o,a)+1,c=tp.shiftPoint(n,i,4*l),u=tp.shiftPoint(o,i,4*s);s=this.transitionsBetween(c,a)+1,l=this.transitionsBetween(u,a)+1,(1&s)==1&&(s+=1),(1&l)==1&&(l+=1);let h=(n.getX()+i.getX()+o.getX()+a.getX())/4,d=(n.getY()+i.getY()+o.getY()+a.getY())/4;return n=tp.moveAway(n,h,d),i=tp.moveAway(i,h,d),o=tp.moveAway(o,h,d),a=tp.moveAway(a,h,d),c=tp.shiftPoint(n,i,4*l),c=tp.shiftPoint(c,a,4*s),t=tp.shiftPoint(i,n,4*l),t=tp.shiftPoint(t,o,4*s),u=tp.shiftPoint(o,a,4*l),u=tp.shiftPoint(u,i,4*s),r=tp.shiftPoint(a,o,4*l),[c,t,u,r=tp.shiftPoint(r,n,4*s)]}isValid(e){return e.getX()>=0&&e.getX()<this.image.getWidth()&&e.getY()>0&&e.getY()<this.image.getHeight()}static sampleGrid(e,t,r,n,i,o,a){return eS.getInstance().sampleGrid(e,o,a,.5,.5,o-.5,.5,o-.5,a-.5,.5,a-.5,t.getX(),t.getY(),i.getX(),i.getY(),n.getX(),n.getY(),r.getX(),r.getY())}transitionsBetween(e,t){let r=Math.trunc(e.getX()),n=Math.trunc(e.getY()),i=Math.trunc(t.getX()),o=Math.trunc(t.getY()),a=Math.abs(o-n)>Math.abs(i-r);if(a){let e=r;r=n,n=e,e=i,i=o,o=e}let s=Math.abs(i-r),l=Math.abs(o-n),c=-s/2,u=n<o?1:-1,h=r<i?1:-1,d=0,f=this.image.get(a?n:r,a?r:n);for(let e=r,t=n;e!==i;e+=h){let r=this.image.get(a?t:e,a?e:t);if(r!==f&&(d++,f=r),(c+=l)>0){if(t===o)break;t+=u,c-=s}}return d}}class tm{constructor(){this.decoder=new tg}decode(e,t=null){let r,n;if(null!=t&&t.has(U.PURE_BARCODE)){let t=tm.extractPureBits(e.getBlackMatrix());r=this.decoder.decode(t),n=tm.NO_POINTS}else{let t=new tp(e.getBlackMatrix()).detect();r=this.decoder.decode(t.getBits()),n=t.getPoints()}let i=r.getRawBytes(),o=new er(r.getText(),i,8*i.length,n,en.DATA_MATRIX,P.currentTimeMillis()),a=r.getByteSegments();null!=a&&o.putMetadata(ei.BYTE_SEGMENTS,a);let s=r.getECLevel();return null!=s&&o.putMetadata(ei.ERROR_CORRECTION_LEVEL,s),o}reset(){}static extractPureBits(e){let t=e.getTopLeftOnBit(),r=e.getBottomRightOnBit();if(null==t||null==r)throw new X;let n=this.moduleSize(t,e),i=t[1],o=r[1],a=t[0],s=(r[0]-a+1)/n,l=(o-i+1)/n;if(s<=0||l<=0)throw new X;let c=n/2;i+=c,a+=c;let u=new Y(s,l);for(let t=0;t<l;t++){let r=i+t*n;for(let i=0;i<s;i++)e.get(a+i*n,r)&&u.set(i,t)}return u}static moduleSize(e,t){let r=t.getWidth(),n=e[0],i=e[1];for(;n<r&&t.get(n,i);)n++;if(n===r)throw new X;let o=n-e[0];if(0===o)throw new X;return o}}tm.NO_POINTS=[],(c=A||(A={}))[c.L=0]="L",c[c.M=1]="M",c[c.Q=2]="Q",c[c.H=3]="H";class tw{constructor(e,t,r){this.value=e,this.stringValue=t,this.bits=r,tw.FOR_BITS.set(r,this),tw.FOR_VALUE.set(e,this)}getValue(){return this.value}getBits(){return this.bits}static fromString(e){switch(e){case"L":return tw.L;case"M":return tw.M;case"Q":return tw.Q;case"H":return tw.H;default:throw new M(e+"not available")}}toString(){return this.stringValue}equals(e){return e instanceof tw&&this.value===e.value}static forBits(e){if(e<0||e>=tw.FOR_BITS.size)throw new D;return tw.FOR_BITS.get(e)}}tw.FOR_BITS=new Map,tw.FOR_VALUE=new Map,tw.L=new tw(A.L,"L",1),tw.M=new tw(A.M,"M",0),tw.Q=new tw(A.Q,"Q",3),tw.H=new tw(A.H,"H",2);class tC{constructor(e){this.errorCorrectionLevel=tw.forBits(e>>3&3),this.dataMask=7&e}static numBitsDiffering(e,t){return k.bitCount(e^t)}static decodeFormatInformation(e,t){let r=tC.doDecodeFormatInformation(e,t);return null!==r?r:tC.doDecodeFormatInformation(e^tC.FORMAT_INFO_MASK_QR,t^tC.FORMAT_INFO_MASK_QR)}static doDecodeFormatInformation(e,t){let r=Number.MAX_SAFE_INTEGER,n=0;for(let i of tC.FORMAT_INFO_DECODE_LOOKUP){let o=i[0];if(o===e||o===t)return new tC(i[1]);let a=tC.numBitsDiffering(e,o);a<r&&(n=i[1],r=a),e!==t&&(a=tC.numBitsDiffering(t,o))<r&&(n=i[1],r=a)}return r<=3?new tC(n):null}getErrorCorrectionLevel(){return this.errorCorrectionLevel}getDataMask(){return this.dataMask}hashCode(){return this.errorCorrectionLevel.getBits()<<3|this.dataMask}equals(e){return e instanceof tC&&this.errorCorrectionLevel===e.errorCorrectionLevel&&this.dataMask===e.dataMask}}tC.FORMAT_INFO_MASK_QR=21522,tC.FORMAT_INFO_DECODE_LOOKUP=[Int32Array.from([21522,0]),Int32Array.from([20773,1]),Int32Array.from([24188,2]),Int32Array.from([23371,3]),Int32Array.from([17913,4]),Int32Array.from([16590,5]),Int32Array.from([20375,6]),Int32Array.from([19104,7]),Int32Array.from([30660,8]),Int32Array.from([29427,9]),Int32Array.from([32170,10]),Int32Array.from([30877,11]),Int32Array.from([26159,12]),Int32Array.from([25368,13]),Int32Array.from([27713,14]),Int32Array.from([26998,15]),Int32Array.from([5769,16]),Int32Array.from([5054,17]),Int32Array.from([7399,18]),Int32Array.from([6608,19]),Int32Array.from([1890,20]),Int32Array.from([597,21]),Int32Array.from([3340,22]),Int32Array.from([2107,23]),Int32Array.from([13663,24]),Int32Array.from([12392,25]),Int32Array.from([16177,26]),Int32Array.from([14854,27]),Int32Array.from([9396,28]),Int32Array.from([8579,29]),Int32Array.from([11994,30]),Int32Array.from([11245,31])];class tE{constructor(e,...t){this.ecCodewordsPerBlock=e,this.ecBlocks=t}getECCodewordsPerBlock(){return this.ecCodewordsPerBlock}getNumBlocks(){let e=0;for(let t of this.ecBlocks)e+=t.getCount();return e}getTotalECCodewords(){return this.ecCodewordsPerBlock*this.getNumBlocks()}getECBlocks(){return this.ecBlocks}}class tA{constructor(e,t){this.count=e,this.dataCodewords=t}getCount(){return this.count}getDataCodewords(){return this.dataCodewords}}class ty{constructor(e,t,...r){this.versionNumber=e,this.alignmentPatternCenters=t,this.ecBlocks=r;let n=0,i=r[0].getECCodewordsPerBlock();for(let e of r[0].getECBlocks())n+=e.getCount()*(e.getDataCodewords()+i);this.totalCodewords=n}getVersionNumber(){return this.versionNumber}getAlignmentPatternCenters(){return this.alignmentPatternCenters}getTotalCodewords(){return this.totalCodewords}getDimensionForVersion(){return 17+4*this.versionNumber}getECBlocksForLevel(e){return this.ecBlocks[e.getValue()]}static getProvisionalVersionForDimension(e){if(e%4!=1)throw new H;try{return this.getVersionForNumber((e-17)/4)}catch(e){throw new H}}static getVersionForNumber(e){if(e<1||e>40)throw new D;return ty.VERSIONS[e-1]}static decodeVersionInformation(e){let t=Number.MAX_SAFE_INTEGER,r=0;for(let n=0;n<ty.VERSION_DECODE_INFO.length;n++){let i=ty.VERSION_DECODE_INFO[n];if(i===e)return ty.getVersionForNumber(n+7);let o=tC.numBitsDiffering(e,i);o<t&&(r=n+7,t=o)}return t<=3?ty.getVersionForNumber(r):null}buildFunctionPattern(){let e=this.getDimensionForVersion(),t=new Y(e);t.setRegion(0,0,9,9),t.setRegion(e-8,0,8,9),t.setRegion(0,e-8,9,8);let r=this.alignmentPatternCenters.length;for(let e=0;e<r;e++){let n=this.alignmentPatternCenters[e]-2;for(let i=0;i<r;i++)(0!==e||0!==i&&i!==r-1)&&(e!==r-1||0!==i)&&t.setRegion(this.alignmentPatternCenters[i]-2,n,5,5)}return t.setRegion(6,9,1,e-17),t.setRegion(9,6,e-17,1),this.versionNumber>6&&(t.setRegion(e-11,0,3,6),t.setRegion(0,e-11,6,3)),t}toString(){return""+this.versionNumber}}ty.VERSION_DECODE_INFO=Int32Array.from([31892,34236,39577,42195,48118,51042,55367,58893,63784,68472,70749,76311,79154,84390,87683,92361,96236,102084,102881,110507,110734,117786,119615,126325,127568,133589,136944,141498,145311,150283,152622,158308,161089,167017]),ty.VERSIONS=[new ty(1,new Int32Array(0),new tE(7,new tA(1,19)),new tE(10,new tA(1,16)),new tE(13,new tA(1,13)),new tE(17,new tA(1,9))),new ty(2,Int32Array.from([6,18]),new tE(10,new tA(1,34)),new tE(16,new tA(1,28)),new tE(22,new tA(1,22)),new tE(28,new tA(1,16))),new ty(3,Int32Array.from([6,22]),new tE(15,new tA(1,55)),new tE(26,new tA(1,44)),new tE(18,new tA(2,17)),new tE(22,new tA(2,13))),new ty(4,Int32Array.from([6,26]),new tE(20,new tA(1,80)),new tE(18,new tA(2,32)),new tE(26,new tA(2,24)),new tE(16,new tA(4,9))),new ty(5,Int32Array.from([6,30]),new tE(26,new tA(1,108)),new tE(24,new tA(2,43)),new tE(18,new tA(2,15),new tA(2,16)),new tE(22,new tA(2,11),new tA(2,12))),new ty(6,Int32Array.from([6,34]),new tE(18,new tA(2,68)),new tE(16,new tA(4,27)),new tE(24,new tA(4,19)),new tE(28,new tA(4,15))),new ty(7,Int32Array.from([6,22,38]),new tE(20,new tA(2,78)),new tE(18,new tA(4,31)),new tE(18,new tA(2,14),new tA(4,15)),new tE(26,new tA(4,13),new tA(1,14))),new ty(8,Int32Array.from([6,24,42]),new tE(24,new tA(2,97)),new tE(22,new tA(2,38),new tA(2,39)),new tE(22,new tA(4,18),new tA(2,19)),new tE(26,new tA(4,14),new tA(2,15))),new ty(9,Int32Array.from([6,26,46]),new tE(30,new tA(2,116)),new tE(22,new tA(3,36),new tA(2,37)),new tE(20,new tA(4,16),new tA(4,17)),new tE(24,new tA(4,12),new tA(4,13))),new ty(10,Int32Array.from([6,28,50]),new tE(18,new tA(2,68),new tA(2,69)),new tE(26,new tA(4,43),new tA(1,44)),new tE(24,new tA(6,19),new tA(2,20)),new tE(28,new tA(6,15),new tA(2,16))),new ty(11,Int32Array.from([6,30,54]),new tE(20,new tA(4,81)),new tE(30,new tA(1,50),new tA(4,51)),new tE(28,new tA(4,22),new tA(4,23)),new tE(24,new tA(3,12),new tA(8,13))),new ty(12,Int32Array.from([6,32,58]),new tE(24,new tA(2,92),new tA(2,93)),new tE(22,new tA(6,36),new tA(2,37)),new tE(26,new tA(4,20),new tA(6,21)),new tE(28,new tA(7,14),new tA(4,15))),new ty(13,Int32Array.from([6,34,62]),new tE(26,new tA(4,107)),new tE(22,new tA(8,37),new tA(1,38)),new tE(24,new tA(8,20),new tA(4,21)),new tE(22,new tA(12,11),new tA(4,12))),new ty(14,Int32Array.from([6,26,46,66]),new tE(30,new tA(3,115),new tA(1,116)),new tE(24,new tA(4,40),new tA(5,41)),new tE(20,new tA(11,16),new tA(5,17)),new tE(24,new tA(11,12),new tA(5,13))),new ty(15,Int32Array.from([6,26,48,70]),new tE(22,new tA(5,87),new tA(1,88)),new tE(24,new tA(5,41),new tA(5,42)),new tE(30,new tA(5,24),new tA(7,25)),new tE(24,new tA(11,12),new tA(7,13))),new ty(16,Int32Array.from([6,26,50,74]),new tE(24,new tA(5,98),new tA(1,99)),new tE(28,new tA(7,45),new tA(3,46)),new tE(24,new tA(15,19),new tA(2,20)),new tE(30,new tA(3,15),new tA(13,16))),new ty(17,Int32Array.from([6,30,54,78]),new tE(28,new tA(1,107),new tA(5,108)),new tE(28,new tA(10,46),new tA(1,47)),new tE(28,new tA(1,22),new tA(15,23)),new tE(28,new tA(2,14),new tA(17,15))),new ty(18,Int32Array.from([6,30,56,82]),new tE(30,new tA(5,120),new tA(1,121)),new tE(26,new tA(9,43),new tA(4,44)),new tE(28,new tA(17,22),new tA(1,23)),new tE(28,new tA(2,14),new tA(19,15))),new ty(19,Int32Array.from([6,30,58,86]),new tE(28,new tA(3,113),new tA(4,114)),new tE(26,new tA(3,44),new tA(11,45)),new tE(26,new tA(17,21),new tA(4,22)),new tE(26,new tA(9,13),new tA(16,14))),new ty(20,Int32Array.from([6,34,62,90]),new tE(28,new tA(3,107),new tA(5,108)),new tE(26,new tA(3,41),new tA(13,42)),new tE(30,new tA(15,24),new tA(5,25)),new tE(28,new tA(15,15),new tA(10,16))),new ty(21,Int32Array.from([6,28,50,72,94]),new tE(28,new tA(4,116),new tA(4,117)),new tE(26,new tA(17,42)),new tE(28,new tA(17,22),new tA(6,23)),new tE(30,new tA(19,16),new tA(6,17))),new ty(22,Int32Array.from([6,26,50,74,98]),new tE(28,new tA(2,111),new tA(7,112)),new tE(28,new tA(17,46)),new tE(30,new tA(7,24),new tA(16,25)),new tE(24,new tA(34,13))),new ty(23,Int32Array.from([6,30,54,78,102]),new tE(30,new tA(4,121),new tA(5,122)),new tE(28,new tA(4,47),new tA(14,48)),new tE(30,new tA(11,24),new tA(14,25)),new tE(30,new tA(16,15),new tA(14,16))),new ty(24,Int32Array.from([6,28,54,80,106]),new tE(30,new tA(6,117),new tA(4,118)),new tE(28,new tA(6,45),new tA(14,46)),new tE(30,new tA(11,24),new tA(16,25)),new tE(30,new tA(30,16),new tA(2,17))),new ty(25,Int32Array.from([6,32,58,84,110]),new tE(26,new tA(8,106),new tA(4,107)),new tE(28,new tA(8,47),new tA(13,48)),new tE(30,new tA(7,24),new tA(22,25)),new tE(30,new tA(22,15),new tA(13,16))),new ty(26,Int32Array.from([6,30,58,86,114]),new tE(28,new tA(10,114),new tA(2,115)),new tE(28,new tA(19,46),new tA(4,47)),new tE(28,new tA(28,22),new tA(6,23)),new tE(30,new tA(33,16),new tA(4,17))),new ty(27,Int32Array.from([6,34,62,90,118]),new tE(30,new tA(8,122),new tA(4,123)),new tE(28,new tA(22,45),new tA(3,46)),new tE(30,new tA(8,23),new tA(26,24)),new tE(30,new tA(12,15),new tA(28,16))),new ty(28,Int32Array.from([6,26,50,74,98,122]),new tE(30,new tA(3,117),new tA(10,118)),new tE(28,new tA(3,45),new tA(23,46)),new tE(30,new tA(4,24),new tA(31,25)),new tE(30,new tA(11,15),new tA(31,16))),new ty(29,Int32Array.from([6,30,54,78,102,126]),new tE(30,new tA(7,116),new tA(7,117)),new tE(28,new tA(21,45),new tA(7,46)),new tE(30,new tA(1,23),new tA(37,24)),new tE(30,new tA(19,15),new tA(26,16))),new ty(30,Int32Array.from([6,26,52,78,104,130]),new tE(30,new tA(5,115),new tA(10,116)),new tE(28,new tA(19,47),new tA(10,48)),new tE(30,new tA(15,24),new tA(25,25)),new tE(30,new tA(23,15),new tA(25,16))),new ty(31,Int32Array.from([6,30,56,82,108,134]),new tE(30,new tA(13,115),new tA(3,116)),new tE(28,new tA(2,46),new tA(29,47)),new tE(30,new tA(42,24),new tA(1,25)),new tE(30,new tA(23,15),new tA(28,16))),new ty(32,Int32Array.from([6,34,60,86,112,138]),new tE(30,new tA(17,115)),new tE(28,new tA(10,46),new tA(23,47)),new tE(30,new tA(10,24),new tA(35,25)),new tE(30,new tA(19,15),new tA(35,16))),new ty(33,Int32Array.from([6,30,58,86,114,142]),new tE(30,new tA(17,115),new tA(1,116)),new tE(28,new tA(14,46),new tA(21,47)),new tE(30,new tA(29,24),new tA(19,25)),new tE(30,new tA(11,15),new tA(46,16))),new ty(34,Int32Array.from([6,34,62,90,118,146]),new tE(30,new tA(13,115),new tA(6,116)),new tE(28,new tA(14,46),new tA(23,47)),new tE(30,new tA(44,24),new tA(7,25)),new tE(30,new tA(59,16),new tA(1,17))),new ty(35,Int32Array.from([6,30,54,78,102,126,150]),new tE(30,new tA(12,121),new tA(7,122)),new tE(28,new tA(12,47),new tA(26,48)),new tE(30,new tA(39,24),new tA(14,25)),new tE(30,new tA(22,15),new tA(41,16))),new ty(36,Int32Array.from([6,24,50,76,102,128,154]),new tE(30,new tA(6,121),new tA(14,122)),new tE(28,new tA(6,47),new tA(34,48)),new tE(30,new tA(46,24),new tA(10,25)),new tE(30,new tA(2,15),new tA(64,16))),new ty(37,Int32Array.from([6,28,54,80,106,132,158]),new tE(30,new tA(17,122),new tA(4,123)),new tE(28,new tA(29,46),new tA(14,47)),new tE(30,new tA(49,24),new tA(10,25)),new tE(30,new tA(24,15),new tA(46,16))),new ty(38,Int32Array.from([6,32,58,84,110,136,162]),new tE(30,new tA(4,122),new tA(18,123)),new tE(28,new tA(13,46),new tA(32,47)),new tE(30,new tA(48,24),new tA(14,25)),new tE(30,new tA(42,15),new tA(32,16))),new ty(39,Int32Array.from([6,26,54,82,110,138,166]),new tE(30,new tA(20,117),new tA(4,118)),new tE(28,new tA(40,47),new tA(7,48)),new tE(30,new tA(43,24),new tA(22,25)),new tE(30,new tA(10,15),new tA(67,16))),new ty(40,Int32Array.from([6,30,58,86,114,142,170]),new tE(30,new tA(19,118),new tA(6,119)),new tE(28,new tA(18,47),new tA(31,48)),new tE(30,new tA(34,24),new tA(34,25)),new tE(30,new tA(20,15),new tA(61,16)))],(u=y||(y={}))[u.DATA_MASK_000=0]="DATA_MASK_000",u[u.DATA_MASK_001=1]="DATA_MASK_001",u[u.DATA_MASK_010=2]="DATA_MASK_010",u[u.DATA_MASK_011=3]="DATA_MASK_011",u[u.DATA_MASK_100=4]="DATA_MASK_100",u[u.DATA_MASK_101=5]="DATA_MASK_101",u[u.DATA_MASK_110=6]="DATA_MASK_110",u[u.DATA_MASK_111=7]="DATA_MASK_111";class tI{constructor(e,t){this.value=e,this.isMasked=t}unmaskBitMatrix(e,t){for(let r=0;r<t;r++)for(let n=0;n<t;n++)this.isMasked(r,n)&&e.flip(n,r)}}tI.values=new Map([[y.DATA_MASK_000,new tI(y.DATA_MASK_000,(e,t)=>(e+t&1)==0)],[y.DATA_MASK_001,new tI(y.DATA_MASK_001,(e,t)=>(1&e)==0)],[y.DATA_MASK_010,new tI(y.DATA_MASK_010,(e,t)=>t%3==0)],[y.DATA_MASK_011,new tI(y.DATA_MASK_011,(e,t)=>(e+t)%3==0)],[y.DATA_MASK_100,new tI(y.DATA_MASK_100,(e,t)=>(Math.floor(e/2)+Math.floor(t/3)&1)==0)],[y.DATA_MASK_101,new tI(y.DATA_MASK_101,(e,t)=>e*t%6==0)],[y.DATA_MASK_110,new tI(y.DATA_MASK_110,(e,t)=>e*t%6<3)],[y.DATA_MASK_111,new tI(y.DATA_MASK_111,(e,t)=>(e+t+e*t%3&1)==0)]]);class tS{constructor(e){let t=e.getHeight();if(t<21||(3&t)!=1)throw new H;this.bitMatrix=e}readFormatInformation(){if(null!==this.parsedFormatInfo&&void 0!==this.parsedFormatInfo)return this.parsedFormatInfo;let e=0;for(let t=0;t<6;t++)e=this.copyBit(t,8,e);e=this.copyBit(7,8,e),e=this.copyBit(8,8,e),e=this.copyBit(8,7,e);for(let t=5;t>=0;t--)e=this.copyBit(8,t,e);let t=this.bitMatrix.getHeight(),r=0,n=t-7;for(let e=t-1;e>=n;e--)r=this.copyBit(8,e,r);for(let e=t-8;e<t;e++)r=this.copyBit(e,8,r);if(this.parsedFormatInfo=tC.decodeFormatInformation(e,r),null!==this.parsedFormatInfo)return this.parsedFormatInfo;throw new H}readVersion(){if(null!==this.parsedVersion&&void 0!==this.parsedVersion)return this.parsedVersion;let e=this.bitMatrix.getHeight(),t=Math.floor((e-17)/4);if(t<=6)return ty.getVersionForNumber(t);let r=0,n=e-11;for(let t=5;t>=0;t--)for(let i=e-9;i>=n;i--)r=this.copyBit(i,t,r);let i=ty.decodeVersionInformation(r);if(null!==i&&i.getDimensionForVersion()===e)return this.parsedVersion=i,i;r=0;for(let t=5;t>=0;t--)for(let i=e-9;i>=n;i--)r=this.copyBit(t,i,r);if(null!==(i=ty.decodeVersionInformation(r))&&i.getDimensionForVersion()===e)return this.parsedVersion=i,i;throw new H}copyBit(e,t,r){return(this.isMirror?this.bitMatrix.get(t,e):this.bitMatrix.get(e,t))?r<<1|1:r<<1}readCodewords(){let e=this.readFormatInformation(),t=this.readVersion(),r=tI.values.get(e.getDataMask()),n=this.bitMatrix.getHeight();r.unmaskBitMatrix(this.bitMatrix,n);let i=t.buildFunctionPattern(),o=!0,a=new Uint8Array(t.getTotalCodewords()),s=0,l=0,c=0;for(let e=n-1;e>0;e-=2){6===e&&e--;for(let t=0;t<n;t++){let r=o?n-1-t:t;for(let t=0;t<2;t++)i.get(e-t,r)||(c++,l<<=1,this.bitMatrix.get(e-t,r)&&(l|=1),8===c&&(a[s++]=l,c=0,l=0))}o=!o}if(s!==t.getTotalCodewords())throw new H;return a}remask(){if(null===this.parsedFormatInfo)return;let e=tI.values[this.parsedFormatInfo.getDataMask()],t=this.bitMatrix.getHeight();e.unmaskBitMatrix(this.bitMatrix,t)}setMirror(e){this.parsedVersion=null,this.parsedFormatInfo=null,this.isMirror=e}mirror(){let e=this.bitMatrix;for(let t=0,r=e.getWidth();t<r;t++)for(let r=t+1,n=e.getHeight();r<n;r++)e.get(t,r)!==e.get(r,t)&&(e.flip(r,t),e.flip(t,r))}}class t_{constructor(e,t){this.numDataCodewords=e,this.codewords=t}static getDataBlocks(e,t,r){if(e.length!==t.getTotalCodewords())throw new D;let n=t.getECBlocksForLevel(r),i=0,o=n.getECBlocks();for(let e of o)i+=e.getCount();let a=Array(i),s=0;for(let e of o)for(let t=0;t<e.getCount();t++){let t=e.getDataCodewords(),r=n.getECCodewordsPerBlock()+t;a[s++]=new t_(t,new Uint8Array(r))}let l=a[0].codewords.length,c=a.length-1;for(;c>=0&&a[c].codewords.length!==l;)c--;c++;let u=l-n.getECCodewordsPerBlock(),h=0;for(let t=0;t<u;t++)for(let r=0;r<s;r++)a[r].codewords[t]=e[h++];for(let t=c;t<s;t++)a[t].codewords[u]=e[h++];let d=a[0].codewords.length;for(let t=u;t<d;t++)for(let r=0;r<s;r++){let n=r<c?t:t+1;a[r].codewords[n]=e[h++]}return a}getNumDataCodewords(){return this.numDataCodewords}getCodewords(){return this.codewords}}(h=I||(I={}))[h.TERMINATOR=0]="TERMINATOR",h[h.NUMERIC=1]="NUMERIC",h[h.ALPHANUMERIC=2]="ALPHANUMERIC",h[h.STRUCTURED_APPEND=3]="STRUCTURED_APPEND",h[h.BYTE=4]="BYTE",h[h.ECI=5]="ECI",h[h.KANJI=6]="KANJI",h[h.FNC1_FIRST_POSITION=7]="FNC1_FIRST_POSITION",h[h.FNC1_SECOND_POSITION=8]="FNC1_SECOND_POSITION",h[h.HANZI=9]="HANZI";class tb{constructor(e,t,r,n){this.value=e,this.stringValue=t,this.characterCountBitsForVersions=r,this.bits=n,tb.FOR_BITS.set(n,this),tb.FOR_VALUE.set(e,this)}static forBits(e){let t=tb.FOR_BITS.get(e);if(void 0===t)throw new D;return t}getCharacterCountBits(e){let t,r=e.getVersionNumber();return t=r<=9?0:r<=26?1:2,this.characterCountBitsForVersions[t]}getValue(){return this.value}getBits(){return this.bits}equals(e){return e instanceof tb&&this.value===e.value}toString(){return this.stringValue}}tb.FOR_BITS=new Map,tb.FOR_VALUE=new Map,tb.TERMINATOR=new tb(I.TERMINATOR,"TERMINATOR",Int32Array.from([0,0,0]),0),tb.NUMERIC=new tb(I.NUMERIC,"NUMERIC",Int32Array.from([10,12,14]),1),tb.ALPHANUMERIC=new tb(I.ALPHANUMERIC,"ALPHANUMERIC",Int32Array.from([9,11,13]),2),tb.STRUCTURED_APPEND=new tb(I.STRUCTURED_APPEND,"STRUCTURED_APPEND",Int32Array.from([0,0,0]),3),tb.BYTE=new tb(I.BYTE,"BYTE",Int32Array.from([8,16,16]),4),tb.ECI=new tb(I.ECI,"ECI",Int32Array.from([0,0,0]),7),tb.KANJI=new tb(I.KANJI,"KANJI",Int32Array.from([8,10,12]),8),tb.FNC1_FIRST_POSITION=new tb(I.FNC1_FIRST_POSITION,"FNC1_FIRST_POSITION",Int32Array.from([0,0,0]),5),tb.FNC1_SECOND_POSITION=new tb(I.FNC1_SECOND_POSITION,"FNC1_SECOND_POSITION",Int32Array.from([0,0,0]),9),tb.HANZI=new tb(I.HANZI,"HANZI",Int32Array.from([8,10,12]),13);class tT{static decode(e,t,r,n){let i=new td(e),o=new W,a=[],s=-1,l=-1;try{let e,r=null,c=!1;do{if(4>i.available())e=tb.TERMINATOR;else{let t=i.readBits(4);e=tb.forBits(t)}switch(e){case tb.TERMINATOR:break;case tb.FNC1_FIRST_POSITION:case tb.FNC1_SECOND_POSITION:c=!0;break;case tb.STRUCTURED_APPEND:if(16>i.available())throw new H;s=i.readBits(8),l=i.readBits(8);break;case tb.ECI:let u=tT.parseECIValue(i);if(r=z.getCharacterSetECIByValue(u),null===r)throw new H;break;case tb.HANZI:let h=i.readBits(4),d=i.readBits(e.getCharacterCountBits(t));h===tT.GB2312_SUBSET&&tT.decodeHanziSegment(i,o,d);break;default:let f=i.readBits(e.getCharacterCountBits(t));switch(e){case tb.NUMERIC:tT.decodeNumericSegment(i,o,f);break;case tb.ALPHANUMERIC:tT.decodeAlphanumericSegment(i,o,f,c);break;case tb.BYTE:tT.decodeByteSegment(i,o,f,r,a,n);break;case tb.KANJI:tT.decodeKanjiSegment(i,o,f);break;default:throw new H}}}while(e!==tb.TERMINATOR)}catch(e){throw new H}return new eo(e,o.toString(),0===a.length?null:a,null===r?null:r.toString(),s,l)}static decodeHanziSegment(e,t,r){if(13*r>e.available())throw new H;let n=new Uint8Array(2*r),i=0;for(;r>0;){let t=e.readBits(13),o=t/96<<8&0xffffffff|t%96;o<959?o+=41377:o+=42657,n[i]=o>>8&255,n[i+1]=255&o,i+=2,r--}try{t.append(j.decode(n,G.GB2312))}catch(e){throw new H(e)}}static decodeKanjiSegment(e,t,r){if(13*r>e.available())throw new H;let n=new Uint8Array(2*r),i=0;for(;r>0;){let t=e.readBits(13),o=t/192<<8&0xffffffff|t%192;o<7936?o+=33088:o+=49472,n[i]=o>>8,n[i+1]=o,i+=2,r--}try{t.append(j.decode(n,G.SHIFT_JIS))}catch(e){throw new H(e)}}static decodeByteSegment(e,t,r,n,i,o){let a;if(8*r>e.available())throw new H;let s=new Uint8Array(r);for(let t=0;t<r;t++)s[t]=e.readBits(8);a=null===n?G.guessEncoding(s,o):n.getName();try{t.append(j.decode(s,a))}catch(e){throw new H(e)}i.push(s)}static toAlphaNumericChar(e){if(e>=tT.ALPHANUMERIC_CHARS.length)throw new H;return tT.ALPHANUMERIC_CHARS[e]}static decodeAlphanumericSegment(e,t,r,n){let i=t.length();for(;r>1;){if(11>e.available())throw new H;let n=e.readBits(11);t.append(tT.toAlphaNumericChar(Math.floor(n/45))),t.append(tT.toAlphaNumericChar(n%45)),r-=2}if(1===r){if(6>e.available())throw new H;t.append(tT.toAlphaNumericChar(e.readBits(6)))}if(n)for(let e=i;e<t.length();e++)"%"===t.charAt(e)&&(e<t.length()-1&&"%"===t.charAt(e+1)?t.deleteCharAt(e+1):t.setCharAt(e,"\x1d"))}static decodeNumericSegment(e,t,r){for(;r>=3;){if(10>e.available())throw new H;let n=e.readBits(10);if(n>=1e3)throw new H;t.append(tT.toAlphaNumericChar(Math.floor(n/100))),t.append(tT.toAlphaNumericChar(Math.floor(n/10)%10)),t.append(tT.toAlphaNumericChar(n%10)),r-=3}if(2===r){if(7>e.available())throw new H;let r=e.readBits(7);if(r>=100)throw new H;t.append(tT.toAlphaNumericChar(Math.floor(r/10))),t.append(tT.toAlphaNumericChar(r%10))}else if(1===r){if(4>e.available())throw new H;let r=e.readBits(4);if(r>=10)throw new H;t.append(tT.toAlphaNumericChar(r))}}static parseECIValue(e){let t=e.readBits(8);if((128&t)==0)return 127&t;if((192&t)==128)return(63&t)<<8&0xffffffff|e.readBits(8);if((224&t)==192)return(31&t)<<16&0xffffffff|e.readBits(16);throw new H}}tT.ALPHANUMERIC_CHARS="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:",tT.GB2312_SUBSET=1;class tN{constructor(e){this.mirrored=e}isMirrored(){return this.mirrored}applyMirroredCorrection(e){if(!this.mirrored||null===e||e.length<3)return;let t=e[0];e[0]=e[2],e[2]=t}}class tM{constructor(){this.rsDecoder=new ed(ec.QR_CODE_FIELD_256)}decodeBooleanArray(e,t){return this.decodeBitMatrix(Y.parseFromBooleanArray(e),t)}decodeBitMatrix(e,t){let r=new tS(e),n=null;try{return this.decodeBitMatrixParser(r,t)}catch(e){n=e}try{r.remask(),r.setMirror(!0),r.readVersion(),r.readFormatInformation(),r.mirror();let e=this.decodeBitMatrixParser(r,t);return e.setOther(new tN(!0)),e}catch(e){if(null!==n)throw n;throw e}}decodeBitMatrixParser(e,t){let r=e.readVersion(),n=e.readFormatInformation().getErrorCorrectionLevel(),i=e.readCodewords(),o=t_.getDataBlocks(i,r,n),a=0;for(let e of o)a+=e.getNumDataCodewords();let s=new Uint8Array(a),l=0;for(let e of o){let t=e.getCodewords(),r=e.getNumDataCodewords();this.correctErrors(t,r);for(let e=0;e<r;e++)s[l++]=t[e]}return tT.decode(s,r,n,t)}correctErrors(e,t){let r=new Int32Array(e);try{this.rsDecoder.decode(r,e.length-t)}catch(e){throw new R}for(let n=0;n<t;n++)e[n]=r[n]}}class tD extends em{constructor(e,t,r){super(e,t),this.estimatedModuleSize=r}aboutEquals(e,t,r){if(Math.abs(t-this.getY())<=e&&Math.abs(r-this.getX())<=e){let t=Math.abs(e-this.estimatedModuleSize);return t<=1||t<=this.estimatedModuleSize}return!1}combineEstimate(e,t,r){let n=(this.getX()+t)/2;return new tD(n,(this.getY()+e)/2,(this.estimatedModuleSize+r)/2)}}class tO{constructor(e,t,r,n,i,o,a){this.image=e,this.startX=t,this.startY=r,this.width=n,this.height=i,this.moduleSize=o,this.resultPointCallback=a,this.possibleCenters=[],this.crossCheckStateCount=new Int32Array(3)}find(){let e=this.startX,t=this.height,r=e+this.width,n=this.startY+t/2,i=new Int32Array(3),o=this.image;for(let a=0;a<t;a++){let t=n+((1&a)==0?Math.floor((a+1)/2):-Math.floor((a+1)/2));i[0]=0,i[1]=0,i[2]=0;let s=e;for(;s<r&&!o.get(s,t);)s++;let l=0;for(;s<r;){if(o.get(s,t))if(1===l)i[1]++;else if(2===l){if(this.foundPatternCross(i)){let e=this.handlePossibleCenter(i,t,s);if(null!==e)return e}i[0]=i[2],i[1]=1,i[2]=0,l=1}else i[++l]++;else 1===l&&l++,i[l]++;s++}if(this.foundPatternCross(i)){let e=this.handlePossibleCenter(i,t,r);if(null!==e)return e}}if(0!==this.possibleCenters.length)return this.possibleCenters[0];throw new X}static centerFromEnd(e,t){return t-e[2]-e[1]/2}foundPatternCross(e){let t=this.moduleSize,r=t/2;for(let n=0;n<3;n++)if(Math.abs(t-e[n])>=r)return!1;return!0}crossCheckVertical(e,t,r,n){let i=this.image,o=i.getHeight(),a=this.crossCheckStateCount;a[0]=0,a[1]=0,a[2]=0;let s=e;for(;s>=0&&i.get(t,s)&&a[1]<=r;)a[1]++,s--;if(s<0||a[1]>r)return NaN;for(;s>=0&&!i.get(t,s)&&a[0]<=r;)a[0]++,s--;if(a[0]>r)return NaN;for(s=e+1;s<o&&i.get(t,s)&&a[1]<=r;)a[1]++,s++;if(s===o||a[1]>r)return NaN;for(;s<o&&!i.get(t,s)&&a[2]<=r;)a[2]++,s++;return a[2]>r||5*Math.abs(a[0]+a[1]+a[2]-n)>=2*n?NaN:this.foundPatternCross(a)?tO.centerFromEnd(a,s):NaN}handlePossibleCenter(e,t,r){let n=e[0]+e[1]+e[2],i=tO.centerFromEnd(e,r),o=this.crossCheckVertical(t,i,2*e[1],n);if(!isNaN(o)){let t=(e[0]+e[1]+e[2])/3;for(let e of this.possibleCenters)if(e.aboutEquals(t,o,i))return e.combineEstimate(o,i,t);let r=new tD(i,o,t);this.possibleCenters.push(r),null!==this.resultPointCallback&&void 0!==this.resultPointCallback&&this.resultPointCallback.foundPossibleResultPoint(r)}return null}}class tR extends em{constructor(e,t,r,n){super(e,t),this.estimatedModuleSize=r,this.count=n,void 0===n&&(this.count=1)}getEstimatedModuleSize(){return this.estimatedModuleSize}getCount(){return this.count}aboutEquals(e,t,r){if(Math.abs(t-this.getY())<=e&&Math.abs(r-this.getX())<=e){let t=Math.abs(e-this.estimatedModuleSize);return t<=1||t<=this.estimatedModuleSize}return!1}combineEstimate(e,t,r){let n=this.count+1,i=(this.count*this.getX()+t)/n;return new tR(i,(this.count*this.getY()+e)/n,(this.count*this.estimatedModuleSize+r)/n,n)}}class tv{constructor(e){this.bottomLeft=e[0],this.topLeft=e[1],this.topRight=e[2]}getBottomLeft(){return this.bottomLeft}getTopLeft(){return this.topLeft}getTopRight(){return this.topRight}}class tP{constructor(e,t){this.image=e,this.resultPointCallback=t,this.possibleCenters=[],this.crossCheckStateCount=new Int32Array(5),this.resultPointCallback=t}getImage(){return this.image}getPossibleCenters(){return this.possibleCenters}find(e){let t=null!=e&&void 0!==e.get(U.TRY_HARDER),r=null!=e&&void 0!==e.get(U.PURE_BARCODE),n=this.image,i=n.getHeight(),o=n.getWidth(),a=Math.floor(3*i/(4*tP.MAX_MODULES));(a<tP.MIN_SKIP||t)&&(a=tP.MIN_SKIP);let s=!1,l=new Int32Array(5);for(let e=a-1;e<i&&!s;e+=a){l[0]=0,l[1]=0,l[2]=0,l[3]=0,l[4]=0;let t=0;for(let i=0;i<o;i++)if(n.get(i,e))(1&t)==1&&t++,l[t]++;else if((1&t)==0)if(4===t)if(tP.foundPatternCross(l)){if(!0===this.handlePossibleCenter(l,e,i,r))if(a=2,!0===this.hasSkipped)s=this.haveMultiplyConfirmedCenters();else{let t=this.findRowSkip();t>l[2]&&(e+=t-l[2]-a,i=o-1)}else{l[0]=l[2],l[1]=l[3],l[2]=l[4],l[3]=1,l[4]=0,t=3;continue}t=0,l[0]=0,l[1]=0,l[2]=0,l[3]=0,l[4]=0}else l[0]=l[2],l[1]=l[3],l[2]=l[4],l[3]=1,l[4]=0,t=3;else l[++t]++;else l[t]++;tP.foundPatternCross(l)&&!0===this.handlePossibleCenter(l,e,o,r)&&(a=l[0],this.hasSkipped&&(s=this.haveMultiplyConfirmedCenters()))}let c=this.selectBestPatterns();return em.orderBestPatterns(c),new tv(c)}static centerFromEnd(e,t){return t-e[4]-e[3]-e[2]/2}static foundPatternCross(e){let t=0;for(let r=0;r<5;r++){let n=e[r];if(0===n)return!1;t+=n}if(t<7)return!1;let r=t/7,n=r/2;return Math.abs(r-e[0])<n&&Math.abs(r-e[1])<n&&Math.abs(3*r-e[2])<3*n&&Math.abs(r-e[3])<n&&Math.abs(r-e[4])<n}getCrossCheckStateCount(){let e=this.crossCheckStateCount;return e[0]=0,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e}crossCheckDiagonal(e,t,r,n){let i=this.getCrossCheckStateCount(),o=0,a=this.image;for(;e>=o&&t>=o&&a.get(t-o,e-o);)i[2]++,o++;if(e<o||t<o)return!1;for(;e>=o&&t>=o&&!a.get(t-o,e-o)&&i[1]<=r;)i[1]++,o++;if(e<o||t<o||i[1]>r)return!1;for(;e>=o&&t>=o&&a.get(t-o,e-o)&&i[0]<=r;)i[0]++,o++;if(i[0]>r)return!1;let s=a.getHeight(),l=a.getWidth();for(o=1;e+o<s&&t+o<l&&a.get(t+o,e+o);)i[2]++,o++;if(e+o>=s||t+o>=l)return!1;for(;e+o<s&&t+o<l&&!a.get(t+o,e+o)&&i[3]<r;)i[3]++,o++;if(e+o>=s||t+o>=l||i[3]>=r)return!1;for(;e+o<s&&t+o<l&&a.get(t+o,e+o)&&i[4]<r;)i[4]++,o++;return!(i[4]>=r)&&Math.abs(i[0]+i[1]+i[2]+i[3]+i[4]-n)<2*n&&tP.foundPatternCross(i)}crossCheckVertical(e,t,r,n){let i=this.image,o=i.getHeight(),a=this.getCrossCheckStateCount(),s=e;for(;s>=0&&i.get(t,s);)a[2]++,s--;if(s<0)return NaN;for(;s>=0&&!i.get(t,s)&&a[1]<=r;)a[1]++,s--;if(s<0||a[1]>r)return NaN;for(;s>=0&&i.get(t,s)&&a[0]<=r;)a[0]++,s--;if(a[0]>r)return NaN;for(s=e+1;s<o&&i.get(t,s);)a[2]++,s++;if(s===o)return NaN;for(;s<o&&!i.get(t,s)&&a[3]<r;)a[3]++,s++;if(s===o||a[3]>=r)return NaN;for(;s<o&&i.get(t,s)&&a[4]<r;)a[4]++,s++;return a[4]>=r||5*Math.abs(a[0]+a[1]+a[2]+a[3]+a[4]-n)>=2*n?NaN:tP.foundPatternCross(a)?tP.centerFromEnd(a,s):NaN}crossCheckHorizontal(e,t,r,n){let i=this.image,o=i.getWidth(),a=this.getCrossCheckStateCount(),s=e;for(;s>=0&&i.get(s,t);)a[2]++,s--;if(s<0)return NaN;for(;s>=0&&!i.get(s,t)&&a[1]<=r;)a[1]++,s--;if(s<0||a[1]>r)return NaN;for(;s>=0&&i.get(s,t)&&a[0]<=r;)a[0]++,s--;if(a[0]>r)return NaN;for(s=e+1;s<o&&i.get(s,t);)a[2]++,s++;if(s===o)return NaN;for(;s<o&&!i.get(s,t)&&a[3]<r;)a[3]++,s++;if(s===o||a[3]>=r)return NaN;for(;s<o&&i.get(s,t)&&a[4]<r;)a[4]++,s++;return a[4]>=r||5*Math.abs(a[0]+a[1]+a[2]+a[3]+a[4]-n)>=n?NaN:tP.foundPatternCross(a)?tP.centerFromEnd(a,s):NaN}handlePossibleCenter(e,t,r,n){let i=e[0]+e[1]+e[2]+e[3]+e[4],o=tP.centerFromEnd(e,r),a=this.crossCheckVertical(t,Math.floor(o),e[2],i);if(!isNaN(a)&&!isNaN(o=this.crossCheckHorizontal(Math.floor(o),Math.floor(a),e[2],i))&&(!n||this.crossCheckDiagonal(Math.floor(a),Math.floor(o),e[2],i))){let e=i/7,t=!1,r=this.possibleCenters;for(let n=0,i=r.length;n<i;n++){let i=r[n];if(i.aboutEquals(e,a,o)){r[n]=i.combineEstimate(a,o,e),t=!0;break}}if(!t){let t=new tR(o,a,e);r.push(t),null!==this.resultPointCallback&&void 0!==this.resultPointCallback&&this.resultPointCallback.foundPossibleResultPoint(t)}return!0}return!1}findRowSkip(){if(this.possibleCenters.length<=1)return 0;let e=null;for(let t of this.possibleCenters)if(t.getCount()>=tP.CENTER_QUORUM)if(null!=e)return this.hasSkipped=!0,Math.floor((Math.abs(e.getX()-t.getX())-Math.abs(e.getY()-t.getY()))/2);else e=t;return 0}haveMultiplyConfirmedCenters(){let e=0,t=0,r=this.possibleCenters.length;for(let r of this.possibleCenters)r.getCount()>=tP.CENTER_QUORUM&&(e++,t+=r.getEstimatedModuleSize());if(e<3)return!1;let n=t/r,i=0;for(let e of this.possibleCenters)i+=Math.abs(e.getEstimatedModuleSize()-n);return i<=.05*t}selectBestPatterns(){let e,t=this.possibleCenters.length;if(t<3)throw new X;let r=this.possibleCenters;if(t>3){let n=0,i=0;for(let e of this.possibleCenters){let t=e.getEstimatedModuleSize();n+=t,i+=t*t}e=n/t;let o=Math.sqrt(i/t-e*e);r.sort((t,r)=>{let n=Math.abs(r.getEstimatedModuleSize()-e),i=Math.abs(t.getEstimatedModuleSize()-e);return n<i?-1:+(n>i)});let a=Math.max(.2*e,o);for(let t=0;t<r.length&&r.length>3;t++)Math.abs(r[t].getEstimatedModuleSize()-e)>a&&(r.splice(t,1),t--)}if(r.length>3){let t=0;for(let e of r)t+=e.getEstimatedModuleSize();e=t/r.length,r.sort((t,r)=>{if(r.getCount()!==t.getCount())return r.getCount()-t.getCount();{let n=Math.abs(r.getEstimatedModuleSize()-e),i=Math.abs(t.getEstimatedModuleSize()-e);return n<i?1:n>i?-1:0}}),r.splice(3)}return[r[0],r[1],r[2]]}}tP.CENTER_QUORUM=2,tP.MIN_SKIP=3,tP.MAX_MODULES=57;class tB{constructor(e){this.image=e}getImage(){return this.image}getResultPointCallback(){return this.resultPointCallback}detect(e){this.resultPointCallback=null==e?null:e.get(U.NEED_RESULT_POINT_CALLBACK);let t=new tP(this.image,this.resultPointCallback).find(e);return this.processFinderPatternInfo(t)}processFinderPatternInfo(e){let t,r=e.getTopLeft(),n=e.getTopRight(),i=e.getBottomLeft(),o=this.calculateModuleSize(r,n,i);if(o<1)throw new X("No pattern found in proccess finder.");let a=tB.computeDimension(r,n,i,o),s=ty.getProvisionalVersionForDimension(a),l=s.getDimensionForVersion()-7,c=null;if(s.getAlignmentPatternCenters().length>0){let e=n.getX()-r.getX()+i.getX(),t=n.getY()-r.getY()+i.getY(),a=1-3/l,s=Math.floor(r.getX()+a*(e-r.getX())),u=Math.floor(r.getY()+a*(t-r.getY()));for(let e=4;e<=16;e<<=1)try{c=this.findAlignmentInRegion(o,s,u,e);break}catch(e){if(!(e instanceof X))throw e}}let u=tB.createTransform(r,n,i,c,a);return new ew(tB.sampleGrid(this.image,u,a),null===c?[i,r,n]:[i,r,n,c])}static createTransform(e,t,r,n,i){let o,a,s,l,c=i-3.5;return null!==n?(o=n.getX(),a=n.getY(),l=s=c-3):(o=t.getX()-e.getX()+r.getX(),a=t.getY()-e.getY()+r.getY(),s=c,l=c),ey.quadrilateralToQuadrilateral(3.5,3.5,c,3.5,s,l,3.5,c,e.getX(),e.getY(),t.getX(),t.getY(),o,a,r.getX(),r.getY())}static sampleGrid(e,t,r){return eS.getInstance().sampleGridWithTransform(e,r,r,t)}static computeDimension(e,t,r,n){let i=Math.floor((eg.round(em.distance(e,t)/n)+eg.round(em.distance(e,r)/n))/2)+7;switch(3&i){case 0:i++;break;case 2:i--;break;case 3:throw new X("Dimensions could be not found.")}return i}calculateModuleSize(e,t,r){return(this.calculateModuleSizeOneWay(e,t)+this.calculateModuleSizeOneWay(e,r))/2}calculateModuleSizeOneWay(e,t){let r=this.sizeOfBlackWhiteBlackRunBothWays(Math.floor(e.getX()),Math.floor(e.getY()),Math.floor(t.getX()),Math.floor(t.getY())),n=this.sizeOfBlackWhiteBlackRunBothWays(Math.floor(t.getX()),Math.floor(t.getY()),Math.floor(e.getX()),Math.floor(e.getY()));return isNaN(r)?n/7:isNaN(n)?r/7:(r+n)/14}sizeOfBlackWhiteBlackRunBothWays(e,t,r,n){let i=this.sizeOfBlackWhiteBlackRun(e,t,r,n),o=1,a=e-(r-e);a<0?(o=e/(e-a),a=0):a>=this.image.getWidth()&&(o=(this.image.getWidth()-1-e)/(a-e),a=this.image.getWidth()-1);let s=Math.floor(t-(n-t)*o);return o=1,s<0?(o=t/(t-s),s=0):s>=this.image.getHeight()&&(o=(this.image.getHeight()-1-t)/(s-t),s=this.image.getHeight()-1),a=Math.floor(e+(a-e)*o),(i+=this.sizeOfBlackWhiteBlackRun(e,t,a,s))-1}sizeOfBlackWhiteBlackRun(e,t,r,n){let i=Math.abs(n-t)>Math.abs(r-e);if(i){let i=e;e=t,t=i,i=r,r=n,n=i}let o=Math.abs(r-e),a=Math.abs(n-t),s=-o/2,l=e<r?1:-1,c=t<n?1:-1,u=0,h=r+l;for(let r=e,d=t;r!==h;r+=l){let l=i?d:r,h=i?r:d;if(1===u===this.image.get(l,h)){if(2===u)return eg.distance(r,d,e,t);u++}if((s+=a)>0){if(d===n)break;d+=c,s-=o}}return 2===u?eg.distance(r+l,n,e,t):NaN}findAlignmentInRegion(e,t,r,n){let i=Math.floor(n*e),o=Math.max(0,t-i),a=Math.min(this.image.getWidth()-1,t+i);if(a-o<3*e)throw new X("Alignment top exceeds estimated module size.");let s=Math.max(0,r-i),l=Math.min(this.image.getHeight()-1,r+i);if(l-s<3*e)throw new X("Alignment bottom exceeds estimated module size.");return new tO(this.image,o,s,a-o,l-s,e,this.resultPointCallback).find()}}class tx{constructor(){this.decoder=new tM}getDecoder(){return this.decoder}decode(e,t){let r,n;if(null!=t&&void 0!==t.get(U.PURE_BARCODE)){let i=tx.extractPureBits(e.getBlackMatrix());r=this.decoder.decodeBitMatrix(i,t),n=tx.NO_POINTS}else{let i=new tB(e.getBlackMatrix()).detect(t);r=this.decoder.decodeBitMatrix(i.getBits(),t),n=i.getPoints()}r.getOther()instanceof tN&&r.getOther().applyMirroredCorrection(n);let i=new er(r.getText(),r.getRawBytes(),void 0,n,en.QR_CODE,void 0),o=r.getByteSegments();null!==o&&i.putMetadata(ei.BYTE_SEGMENTS,o);let a=r.getECLevel();return null!==a&&i.putMetadata(ei.ERROR_CORRECTION_LEVEL,a),r.hasStructuredAppend()&&(i.putMetadata(ei.STRUCTURED_APPEND_SEQUENCE,r.getStructuredAppendSequenceNumber()),i.putMetadata(ei.STRUCTURED_APPEND_PARITY,r.getStructuredAppendParity())),i}reset(){}static extractPureBits(e){let t=e.getTopLeftOnBit(),r=e.getBottomRightOnBit();if(null===t||null===r)throw new X;let n=this.moduleSize(t,e),i=t[1],o=r[1],a=t[0],s=r[0];if(a>=s||i>=o||o-i!=s-a&&(s=a+(o-i))>=e.getWidth())throw new X;let l=Math.round((s-a+1)/n),c=Math.round((o-i+1)/n);if(l<=0||c<=0||c!==l)throw new X;let u=Math.floor(n/2);i+=u;let h=(a+=u)+Math.floor((l-1)*n)-s;if(h>0){if(h>u)throw new X;a-=h}let d=i+Math.floor((c-1)*n)-o;if(d>0){if(d>u)throw new X;i-=d}let f=new Y(l,c);for(let t=0;t<c;t++){let r=i+Math.floor(t*n);for(let i=0;i<l;i++)e.get(a+Math.floor(i*n),r)&&f.set(i,t)}return f}static moduleSize(e,t){let r=t.getHeight(),n=t.getWidth(),i=e[0],o=e[1],a=!0,s=0;for(;i<n&&o<r;){if(a!==t.get(i,o)){if(5==++s)break;a=!a}i++,o++}if(i===n||o===r)throw new X;return(i-e[0])/7}}tx.NO_POINTS=[];class tL{PDF417Common(){}static getBitCountSum(e){return eg.sum(e)}static toIntArray(e){if(null==e||!e.length)return tL.EMPTY_INT_ARRAY;let t=new Int32Array(e.length),r=0;for(let n of e)t[r++]=n;return t}static getCodeword(e){let t=L.binarySearch(tL.SYMBOL_TABLE,262143&e);return t<0?-1:(tL.CODEWORD_TABLE[t]-1)%tL.NUMBER_OF_CODEWORDS}}tL.NUMBER_OF_CODEWORDS=929,tL.MAX_CODEWORDS_IN_BARCODE=tL.NUMBER_OF_CODEWORDS-1,tL.MIN_ROWS_IN_BARCODE=3,tL.MAX_ROWS_IN_BARCODE=90,tL.MODULES_IN_CODEWORD=17,tL.MODULES_IN_STOP_PATTERN=18,tL.BARS_IN_MODULE=8,tL.EMPTY_INT_ARRAY=new Int32Array([]),tL.SYMBOL_TABLE=Int32Array.from([66142,66170,66206,66236,66290,66292,66350,66382,66396,66454,66470,66476,66594,66600,66614,66626,66628,66632,66640,66654,66662,66668,66682,66690,66718,66720,66748,66758,66776,66798,66802,66804,66820,66824,66832,66846,66848,66876,66880,66936,66950,66956,66968,66992,67006,67022,67036,67042,67044,67048,67062,67118,67150,67164,67214,67228,67256,67294,67322,67350,67366,67372,67398,67404,67416,67438,67474,67476,67490,67492,67496,67510,67618,67624,67650,67656,67664,67678,67686,67692,67706,67714,67716,67728,67742,67744,67772,67782,67788,67800,67822,67826,67828,67842,67848,67870,67872,67900,67904,67960,67974,67992,68016,68030,68046,68060,68066,68068,68072,68086,68104,68112,68126,68128,68156,68160,68216,68336,68358,68364,68376,68400,68414,68448,68476,68494,68508,68536,68546,68548,68552,68560,68574,68582,68588,68654,68686,68700,68706,68708,68712,68726,68750,68764,68792,68802,68804,68808,68816,68830,68838,68844,68858,68878,68892,68920,68976,68990,68994,68996,69e3,69008,69022,69024,69052,69062,69068,69080,69102,69106,69108,69142,69158,69164,69190,69208,69230,69254,69260,69272,69296,69310,69326,69340,69386,69394,69396,69410,69416,69430,69442,69444,69448,69456,69470,69478,69484,69554,69556,69666,69672,69698,69704,69712,69726,69754,69762,69764,69776,69790,69792,69820,69830,69836,69848,69870,69874,69876,69890,69918,69920,69948,69952,70008,70022,70040,70064,70078,70094,70108,70114,70116,70120,70134,70152,70174,70176,70264,70384,70412,70448,70462,70496,70524,70542,70556,70584,70594,70600,70608,70622,70630,70636,70664,70672,70686,70688,70716,70720,70776,70896,71136,71180,71192,71216,71230,71264,71292,71360,71416,71452,71480,71536,71550,71554,71556,71560,71568,71582,71584,71612,71622,71628,71640,71662,71726,71732,71758,71772,71778,71780,71784,71798,71822,71836,71864,71874,71880,71888,71902,71910,71916,71930,71950,71964,71992,72048,72062,72066,72068,72080,72094,72096,72124,72134,72140,72152,72174,72178,72180,72206,72220,72248,72304,72318,72416,72444,72456,72464,72478,72480,72508,72512,72568,72588,72600,72624,72638,72654,72668,72674,72676,72680,72694,72726,72742,72748,72774,72780,72792,72814,72838,72856,72880,72894,72910,72924,72930,72932,72936,72950,72966,72972,72984,73008,73022,73056,73084,73102,73116,73144,73156,73160,73168,73182,73190,73196,73210,73226,73234,73236,73250,73252,73256,73270,73282,73284,73296,73310,73318,73324,73346,73348,73352,73360,73374,73376,73404,73414,73420,73432,73454,73498,73518,73522,73524,73550,73564,73570,73572,73576,73590,73800,73822,73858,73860,73872,73886,73888,73916,73944,73970,73972,73992,74014,74016,74044,74048,74104,74118,74136,74160,74174,74210,74212,74216,74230,74244,74256,74270,74272,74360,74480,74502,74508,74544,74558,74592,74620,74638,74652,74680,74690,74696,74704,74726,74732,74782,74784,74812,74992,75232,75288,75326,75360,75388,75456,75512,75576,75632,75646,75650,75652,75664,75678,75680,75708,75718,75724,75736,75758,75808,75836,75840,75896,76016,76256,76736,76824,76848,76862,76896,76924,76992,77048,77296,77340,77368,77424,77438,77536,77564,77572,77576,77584,77600,77628,77632,77688,77702,77708,77720,77744,77758,77774,77788,77870,77902,77916,77922,77928,77966,77980,78008,78018,78024,78032,78046,78060,78074,78094,78136,78192,78206,78210,78212,78224,78238,78240,78268,78278,78284,78296,78322,78324,78350,78364,78448,78462,78560,78588,78600,78622,78624,78652,78656,78712,78726,78744,78768,78782,78798,78812,78818,78820,78824,78838,78862,78876,78904,78960,78974,79072,79100,79296,79352,79368,79376,79390,79392,79420,79424,79480,79600,79628,79640,79664,79678,79712,79740,79772,79800,79810,79812,79816,79824,79838,79846,79852,79894,79910,79916,79942,79948,79960,79982,79988,80006,80024,80048,80062,80078,80092,80098,80100,80104,80134,80140,80176,80190,80224,80252,80270,80284,80312,80328,80336,80350,80358,80364,80378,80390,80396,80408,80432,80446,80480,80508,80576,80632,80654,80668,80696,80752,80766,80776,80784,80798,80800,80828,80844,80856,80878,80882,80884,80914,80916,80930,80932,80936,80950,80962,80968,80976,80990,80998,81004,81026,81028,81040,81054,81056,81084,81094,81100,81112,81134,81154,81156,81160,81168,81182,81184,81212,81216,81272,81286,81292,81304,81328,81342,81358,81372,81380,81384,81398,81434,81454,81458,81460,81486,81500,81506,81508,81512,81526,81550,81564,81592,81602,81604,81608,81616,81630,81638,81644,81702,81708,81722,81734,81740,81752,81774,81778,81780,82050,82078,82080,82108,82180,82184,82192,82206,82208,82236,82240,82296,82316,82328,82352,82366,82402,82404,82408,82440,82448,82462,82464,82492,82496,82552,82672,82694,82700,82712,82736,82750,82784,82812,82830,82882,82884,82888,82896,82918,82924,82952,82960,82974,82976,83004,83008,83064,83184,83424,83468,83480,83504,83518,83552,83580,83648,83704,83740,83768,83824,83838,83842,83844,83848,83856,83872,83900,83910,83916,83928,83950,83984,84e3,84028,84032,84088,84208,84448,84928,85040,85054,85088,85116,85184,85240,85488,85560,85616,85630,85728,85756,85764,85768,85776,85790,85792,85820,85824,85880,85894,85900,85912,85936,85966,85980,86048,86080,86136,86256,86496,86976,88160,88188,88256,88312,88560,89056,89200,89214,89312,89340,89536,89592,89608,89616,89632,89664,89720,89840,89868,89880,89904,89952,89980,89998,90012,90040,90190,90204,90254,90268,90296,90306,90308,90312,90334,90382,90396,90424,90480,90494,90500,90504,90512,90526,90528,90556,90566,90572,90584,90610,90612,90638,90652,90680,90736,90750,90848,90876,90884,90888,90896,90910,90912,90940,90944,91e3,91014,91020,91032,91056,91070,91086,91100,91106,91108,91112,91126,91150,91164,91192,91248,91262,91360,91388,91584,91640,91664,91678,91680,91708,91712,91768,91888,91928,91952,91966,92e3,92028,92046,92060,92088,92098,92100,92104,92112,92126,92134,92140,92188,92216,92272,92384,92412,92608,92664,93168,93200,93214,93216,93244,93248,93304,93424,93664,93720,93744,93758,93792,93820,93888,93944,93980,94008,94064,94078,94084,94088,94096,94110,94112,94140,94150,94156,94168,94246,94252,94278,94284,94296,94318,94342,94348,94360,94384,94398,94414,94428,94440,94470,94476,94488,94512,94526,94560,94588,94606,94620,94648,94658,94660,94664,94672,94686,94694,94700,94714,94726,94732,94744,94768,94782,94816,94844,94912,94968,94990,95004,95032,95088,95102,95112,95120,95134,95136,95164,95180,95192,95214,95218,95220,95244,95256,95280,95294,95328,95356,95424,95480,95728,95758,95772,95800,95856,95870,95968,95996,96008,96016,96030,96032,96060,96064,96120,96152,96176,96190,96220,96226,96228,96232,96290,96292,96296,96310,96322,96324,96328,96336,96350,96358,96364,96386,96388,96392,96400,96414,96416,96444,96454,96460,96472,96494,96498,96500,96514,96516,96520,96528,96542,96544,96572,96576,96632,96646,96652,96664,96688,96702,96718,96732,96738,96740,96744,96758,96772,96776,96784,96798,96800,96828,96832,96888,97008,97030,97036,97048,97072,97086,97120,97148,97166,97180,97208,97220,97224,97232,97246,97254,97260,97326,97330,97332,97358,97372,97378,97380,97384,97398,97422,97436,97464,97474,97476,97480,97488,97502,97510,97516,97550,97564,97592,97648,97666,97668,97672,97680,97694,97696,97724,97734,97740,97752,97774,97830,97836,97850,97862,97868,97880,97902,97906,97908,97926,97932,97944,97968,97998,98012,98018,98020,98024,98038,98618,98674,98676,98838,98854,98874,98892,98904,98926,98930,98932,98968,99006,99042,99044,99048,99062,99166,99194,99246,99286,99350,99366,99372,99386,99398,99416,99438,99442,99444,99462,99504,99518,99534,99548,99554,99556,99560,99574,99590,99596,99608,99632,99646,99680,99708,99726,99740,99768,99778,99780,99784,99792,99806,99814,99820,99834,99858,99860,99874,99880,99894,99906,99920,99934,99962,99970,99972,99976,99984,99998,1e5,100028,100038,100044,100056,100078,100082,100084,100142,100174,100188,100246,100262,100268,100306,100308,100390,100396,100410,100422,100428,100440,100462,100466,100468,100486,100504,100528,100542,100558,100572,100578,100580,100584,100598,100620,100656,100670,100704,100732,100750,100792,100802,100808,100816,100830,100838,100844,100858,100888,100912,100926,100960,100988,101056,101112,101148,101176,101232,101246,101250,101252,101256,101264,101278,101280,101308,101318,101324,101336,101358,101362,101364,101410,101412,101416,101430,101442,101448,101456,101470,101478,101498,101506,101508,101520,101534,101536,101564,101580,101618,101620,101636,101640,101648,101662,101664,101692,101696,101752,101766,101784,101838,101858,101860,101864,101934,101938,101940,101966,101980,101986,101988,101992,102030,102044,102072,102082,102084,102088,102096,102138,102166,102182,102188,102214,102220,102232,102254,102282,102290,102292,102306,102308,102312,102326,102444,102458,102470,102476,102488,102514,102516,102534,102552,102576,102590,102606,102620,102626,102632,102646,102662,102668,102704,102718,102752,102780,102798,102812,102840,102850,102856,102864,102878,102886,102892,102906,102936,102974,103008,103036,103104,103160,103224,103280,103294,103298,103300,103312,103326,103328,103356,103366,103372,103384,103406,103410,103412,103472,103486,103520,103548,103616,103672,103920,103992,104048,104062,104160,104188,104194,104196,104200,104208,104224,104252,104256,104312,104326,104332,104344,104368,104382,104398,104412,104418,104420,104424,104482,104484,104514,104520,104528,104542,104550,104570,104578,104580,104592,104606,104608,104636,104652,104690,104692,104706,104712,104734,104736,104764,104768,104824,104838,104856,104910,104930,104932,104936,104968,104976,104990,104992,105020,105024,105080,105200,105240,105278,105312,105372,105410,105412,105416,105424,105446,105518,105524,105550,105564,105570,105572,105576,105614,105628,105656,105666,105672,105680,105702,105722,105742,105756,105784,105840,105854,105858,105860,105864,105872,105888,105932,105970,105972,106006,106022,106028,106054,106060,106072,106100,106118,106124,106136,106160,106174,106190,106210,106212,106216,106250,106258,106260,106274,106276,106280,106306,106308,106312,106320,106334,106348,106394,106414,106418,106420,106566,106572,106610,106612,106630,106636,106648,106672,106686,106722,106724,106728,106742,106758,106764,106776,106800,106814,106848,106876,106894,106908,106936,106946,106948,106952,106960,106974,106982,106988,107032,107056,107070,107104,107132,107200,107256,107292,107320,107376,107390,107394,107396,107400,107408,107422,107424,107452,107462,107468,107480,107502,107506,107508,107544,107568,107582,107616,107644,107712,107768,108016,108060,108088,108144,108158,108256,108284,108290,108292,108296,108304,108318,108320,108348,108352,108408,108422,108428,108440,108464,108478,108494,108508,108514,108516,108520,108592,108640,108668,108736,108792,109040,109536,109680,109694,109792,109820,110016,110072,110084,110088,110096,110112,110140,110144,110200,110320,110342,110348,110360,110384,110398,110432,110460,110478,110492,110520,110532,110536,110544,110558,110658,110686,110714,110722,110724,110728,110736,110750,110752,110780,110796,110834,110836,110850,110852,110856,110864,110878,110880,110908,110912,110968,110982,111e3,111054,111074,111076,111080,111108,111112,111120,111134,111136,111164,111168,111224,111344,111372,111422,111456,111516,111554,111556,111560,111568,111590,111632,111646,111648,111676,111680,111736,111856,112096,112152,112224,112252,112320,112440,112514,112516,112520,112528,112542,112544,112588,112686,112718,112732,112782,112796,112824,112834,112836,112840,112848,112870,112890,112910,112924,112952,113008,113022,113026,113028,113032,113040,113054,113056,113100,113138,113140,113166,113180,113208,113264,113278,113376,113404,113416,113424,113440,113468,113472,113560,113614,113634,113636,113640,113686,113702,113708,113734,113740,113752,113778,113780,113798,113804,113816,113840,113854,113870,113890,113892,113896,113926,113932,113944,113968,113982,114016,114044,114076,114114,114116,114120,114128,114150,114170,114194,114196,114210,114212,114216,114242,114244,114248,114256,114270,114278,114306,114308,114312,114320,114334,114336,114364,114380,114420,114458,114478,114482,114484,114510,114524,114530,114532,114536,114842,114866,114868,114970,114994,114996,115042,115044,115048,115062,115130,115226,115250,115252,115278,115292,115298,115300,115304,115318,115342,115394,115396,115400,115408,115422,115430,115436,115450,115478,115494,115514,115526,115532,115570,115572,115738,115758,115762,115764,115790,115804,115810,115812,115816,115830,115854,115868,115896,115906,115912,115920,115934,115942,115948,115962,115996,116024,116080,116094,116098,116100,116104,116112,116126,116128,116156,116166,116172,116184,116206,116210,116212,116246,116262,116268,116282,116294,116300,116312,116334,116338,116340,116358,116364,116376,116400,116414,116430,116444,116450,116452,116456,116498,116500,116514,116520,116534,116546,116548,116552,116560,116574,116582,116588,116602,116654,116694,116714,116762,116782,116786,116788,116814,116828,116834,116836,116840,116854,116878,116892,116920,116930,116936,116944,116958,116966,116972,116986,117006,117048,117104,117118,117122,117124,117136,117150,117152,117180,117190,117196,117208,117230,117234,117236,117304,117360,117374,117472,117500,117506,117508,117512,117520,117536,117564,117568,117624,117638,117644,117656,117680,117694,117710,117724,117730,117732,117736,117750,117782,117798,117804,117818,117830,117848,117874,117876,117894,117936,117950,117966,117986,117988,117992,118022,118028,118040,118064,118078,118112,118140,118172,118210,118212,118216,118224,118238,118246,118266,118306,118312,118338,118352,118366,118374,118394,118402,118404,118408,118416,118430,118432,118460,118476,118514,118516,118574,118578,118580,118606,118620,118626,118628,118632,118678,118694,118700,118730,118738,118740,118830,118834,118836,118862,118876,118882,118884,118888,118902,118926,118940,118968,118978,118980,118984,118992,119006,119014,119020,119034,119068,119096,119152,119166,119170,119172,119176,119184,119198,119200,119228,119238,119244,119256,119278,119282,119284,119324,119352,119408,119422,119520,119548,119554,119556,119560,119568,119582,119584,119612,119616,119672,119686,119692,119704,119728,119742,119758,119772,119778,119780,119784,119798,119920,119934,120032,120060,120256,120312,120324,120328,120336,120352,120384,120440,120560,120582,120588,120600,120624,120638,120672,120700,120718,120732,120760,120770,120772,120776,120784,120798,120806,120812,120870,120876,120890,120902,120908,120920,120946,120948,120966,120972,120984,121008,121022,121038,121058,121060,121064,121078,121100,121112,121136,121150,121184,121212,121244,121282,121284,121288,121296,121318,121338,121356,121368,121392,121406,121440,121468,121536,121592,121656,121730,121732,121736,121744,121758,121760,121804,121842,121844,121890,121922,121924,121928,121936,121950,121958,121978,121986,121988,121992,122e3,122014,122016,122044,122060,122098,122100,122116,122120,122128,122142,122144,122172,122176,122232,122246,122264,122318,122338,122340,122344,122414,122418,122420,122446,122460,122466,122468,122472,122510,122524,122552,122562,122564,122568,122576,122598,122618,122646,122662,122668,122694,122700,122712,122738,122740,122762,122770,122772,122786,122788,122792,123018,123026,123028,123042,123044,123048,123062,123098,123146,123154,123156,123170,123172,123176,123190,123202,123204,123208,123216,123238,123244,123258,123290,123314,123316,123402,123410,123412,123426,123428,123432,123446,123458,123464,123472,123486,123494,123500,123514,123522,123524,123528,123536,123552,123580,123590,123596,123608,123630,123634,123636,123674,123698,123700,123740,123746,123748,123752,123834,123914,123922,123924,123938,123944,123958,123970,123976,123984,123998,124006,124012,124026,124034,124036,124048,124062,124064,124092,124102,124108,124120,124142,124146,124148,124162,124164,124168,124176,124190,124192,124220,124224,124280,124294,124300,124312,124336,124350,124366,124380,124386,124388,124392,124406,124442,124462,124466,124468,124494,124508,124514,124520,124558,124572,124600,124610,124612,124616,124624,124646,124666,124694,124710,124716,124730,124742,124748,124760,124786,124788,124818,124820,124834,124836,124840,124854,124946,124948,124962,124964,124968,124982,124994,124996,125e3,125008,125022,125030,125036,125050,125058,125060,125064,125072,125086,125088,125116,125126,125132,125144,125166,125170,125172,125186,125188,125192,125200,125216,125244,125248,125304,125318,125324,125336,125360,125374,125390,125404,125410,125412,125416,125430,125444,125448,125456,125472,125504,125560,125680,125702,125708,125720,125744,125758,125792,125820,125838,125852,125880,125890,125892,125896,125904,125918,125926,125932,125978,125998,126002,126004,126030,126044,126050,126052,126056,126094,126108,126136,126146,126148,126152,126160,126182,126202,126222,126236,126264,126320,126334,126338,126340,126344,126352,126366,126368,126412,126450,126452,126486,126502,126508,126522,126534,126540,126552,126574,126578,126580,126598,126604,126616,126640,126654,126670,126684,126690,126692,126696,126738,126754,126756,126760,126774,126786,126788,126792,126800,126814,126822,126828,126842,126894,126898,126900,126934,127126,127142,127148,127162,127178,127186,127188,127254,127270,127276,127290,127302,127308,127320,127342,127346,127348,127370,127378,127380,127394,127396,127400,127450,127510,127526,127532,127546,127558,127576,127598,127602,127604,127622,127628,127640,127664,127678,127694,127708,127714,127716,127720,127734,127754,127762,127764,127778,127784,127810,127812,127816,127824,127838,127846,127866,127898,127918,127922,127924,128022,128038,128044,128058,128070,128076,128088,128110,128114,128116,128134,128140,128152,128176,128190,128206,128220,128226,128228,128232,128246,128262,128268,128280,128304,128318,128352,128380,128398,128412,128440,128450,128452,128456,128464,128478,128486,128492,128506,128522,128530,128532,128546,128548,128552,128566,128578,128580,128584,128592,128606,128614,128634,128642,128644,128648,128656,128670,128672,128700,128716,128754,128756,128794,128814,128818,128820,128846,128860,128866,128868,128872,128886,128918,128934,128940,128954,128978,128980,129178,129198,129202,129204,129238,129258,129306,129326,129330,129332,129358,129372,129378,129380,129384,129398,129430,129446,129452,129466,129482,129490,129492,129562,129582,129586,129588,129614,129628,129634,129636,129640,129654,129678,129692,129720,129730,129732,129736,129744,129758,129766,129772,129814,129830,129836,129850,129862,129868,129880,129902,129906,129908,129930,129938,129940,129954,129956,129960,129974,130010]),tL.CODEWORD_TABLE=Int32Array.from([2627,1819,2622,2621,1813,1812,2729,2724,2723,2779,2774,2773,902,896,908,868,865,861,859,2511,873,871,1780,835,2493,825,2491,842,837,844,1764,1762,811,810,809,2483,807,2482,806,2480,815,814,813,812,2484,817,816,1745,1744,1742,1746,2655,2637,2635,2626,2625,2623,2628,1820,2752,2739,2737,2728,2727,2725,2730,2785,2783,2778,2777,2775,2780,787,781,747,739,736,2413,754,752,1719,692,689,681,2371,678,2369,700,697,694,703,1688,1686,642,638,2343,631,2341,627,2338,651,646,643,2345,654,652,1652,1650,1647,1654,601,599,2322,596,2321,594,2319,2317,611,610,608,606,2324,603,2323,615,614,612,1617,1616,1614,1612,616,1619,1618,2575,2538,2536,905,901,898,909,2509,2507,2504,870,867,864,860,2512,875,872,1781,2490,2489,2487,2485,1748,836,834,832,830,2494,827,2492,843,841,839,845,1765,1763,2701,2676,2674,2653,2648,2656,2634,2633,2631,2629,1821,2638,2636,2770,2763,2761,2750,2745,2753,2736,2735,2733,2731,1848,2740,2738,2786,2784,591,588,576,569,566,2296,1590,537,534,526,2276,522,2274,545,542,539,548,1572,1570,481,2245,466,2242,462,2239,492,485,482,2249,496,494,1534,1531,1528,1538,413,2196,406,2191,2188,425,419,2202,415,2199,432,430,427,1472,1467,1464,433,1476,1474,368,367,2160,365,2159,362,2157,2155,2152,378,377,375,2166,372,2165,369,2162,383,381,379,2168,1419,1418,1416,1414,385,1411,384,1423,1422,1420,1424,2461,802,2441,2439,790,786,783,794,2409,2406,2403,750,742,738,2414,756,753,1720,2367,2365,2362,2359,1663,693,691,684,2373,680,2370,702,699,696,704,1690,1687,2337,2336,2334,2332,1624,2329,1622,640,637,2344,634,2342,630,2340,650,648,645,2346,655,653,1653,1651,1649,1655,2612,2597,2595,2571,2568,2565,2576,2534,2529,2526,1787,2540,2537,907,904,900,910,2503,2502,2500,2498,1768,2495,1767,2510,2508,2506,869,866,863,2513,876,874,1782,2720,2713,2711,2697,2694,2691,2702,2672,2670,2664,1828,2678,2675,2647,2646,2644,2642,1823,2639,1822,2654,2652,2650,2657,2771,1855,2765,2762,1850,1849,2751,2749,2747,2754,353,2148,344,342,336,2142,332,2140,345,1375,1373,306,2130,299,2128,295,2125,319,314,311,2132,1354,1352,1349,1356,262,257,2101,253,2096,2093,274,273,267,2107,263,2104,280,278,275,1316,1311,1308,1320,1318,2052,202,2050,2044,2040,219,2063,212,2060,208,2055,224,221,2066,1260,1258,1252,231,1248,229,1266,1264,1261,1268,155,1998,153,1996,1994,1991,1988,165,164,2007,162,2006,159,2003,2e3,172,171,169,2012,166,2010,1186,1184,1182,1179,175,1176,173,1192,1191,1189,1187,176,1194,1193,2313,2307,2305,592,589,2294,2292,2289,578,572,568,2297,580,1591,2272,2267,2264,1547,538,536,529,2278,525,2275,547,544,541,1574,1571,2237,2235,2229,1493,2225,1489,478,2247,470,2244,465,2241,493,488,484,2250,498,495,1536,1533,1530,1539,2187,2186,2184,2182,1432,2179,1430,2176,1427,414,412,2197,409,2195,405,2193,2190,426,424,421,2203,418,2201,431,429,1473,1471,1469,1466,434,1477,1475,2478,2472,2470,2459,2457,2454,2462,803,2437,2432,2429,1726,2443,2440,792,789,785,2401,2399,2393,1702,2389,1699,2411,2408,2405,745,741,2415,758,755,1721,2358,2357,2355,2353,1661,2350,1660,2347,1657,2368,2366,2364,2361,1666,690,687,2374,683,2372,701,698,705,1691,1689,2619,2617,2610,2608,2605,2613,2593,2588,2585,1803,2599,2596,2563,2561,2555,1797,2551,1795,2573,2570,2567,2577,2525,2524,2522,2520,1786,2517,1785,2514,1783,2535,2533,2531,2528,1788,2541,2539,906,903,911,2721,1844,2715,2712,1838,1836,2699,2696,2693,2703,1827,1826,1824,2673,2671,2669,2666,1829,2679,2677,1858,1857,2772,1854,1853,1851,1856,2766,2764,143,1987,139,1986,135,133,131,1984,128,1983,125,1981,138,137,136,1985,1133,1132,1130,112,110,1974,107,1973,104,1971,1969,122,121,119,117,1977,114,1976,124,1115,1114,1112,1110,1117,1116,84,83,1953,81,1952,78,1950,1948,1945,94,93,91,1959,88,1958,85,1955,99,97,95,1961,1086,1085,1083,1081,1078,100,1090,1089,1087,1091,49,47,1917,44,1915,1913,1910,1907,59,1926,56,1925,53,1922,1919,66,64,1931,61,1929,1042,1040,1038,71,1035,70,1032,68,1048,1047,1045,1043,1050,1049,12,10,1869,1867,1864,1861,21,1880,19,1877,1874,1871,28,1888,25,1886,22,1883,982,980,977,974,32,30,991,989,987,984,34,995,994,992,2151,2150,2147,2146,2144,356,355,354,2149,2139,2138,2136,2134,1359,343,341,338,2143,335,2141,348,347,346,1376,1374,2124,2123,2121,2119,1326,2116,1324,310,308,305,2131,302,2129,298,2127,320,318,316,313,2133,322,321,1355,1353,1351,1357,2092,2091,2089,2087,1276,2084,1274,2081,1271,259,2102,256,2100,252,2098,2095,272,269,2108,266,2106,281,279,277,1317,1315,1313,1310,282,1321,1319,2039,2037,2035,2032,1203,2029,1200,1197,207,2053,205,2051,201,2049,2046,2043,220,218,2064,215,2062,211,2059,228,226,223,2069,1259,1257,1254,232,1251,230,1267,1265,1263,2316,2315,2312,2311,2309,2314,2304,2303,2301,2299,1593,2308,2306,590,2288,2287,2285,2283,1578,2280,1577,2295,2293,2291,579,577,574,571,2298,582,581,1592,2263,2262,2260,2258,1545,2255,1544,2252,1541,2273,2271,2269,2266,1550,535,532,2279,528,2277,546,543,549,1575,1573,2224,2222,2220,1486,2217,1485,2214,1482,1479,2238,2236,2234,2231,1496,2228,1492,480,477,2248,473,2246,469,2243,490,487,2251,497,1537,1535,1532,2477,2476,2474,2479,2469,2468,2466,2464,1730,2473,2471,2453,2452,2450,2448,1729,2445,1728,2460,2458,2456,2463,805,804,2428,2427,2425,2423,1725,2420,1724,2417,1722,2438,2436,2434,2431,1727,2444,2442,793,791,788,795,2388,2386,2384,1697,2381,1696,2378,1694,1692,2402,2400,2398,2395,1703,2392,1701,2412,2410,2407,751,748,744,2416,759,757,1807,2620,2618,1806,1805,2611,2609,2607,2614,1802,1801,1799,2594,2592,2590,2587,1804,2600,2598,1794,1793,1791,1789,2564,2562,2560,2557,1798,2554,1796,2574,2572,2569,2578,1847,1846,2722,1843,1842,1840,1845,2716,2714,1835,1834,1832,1830,1839,1837,2700,2698,2695,2704,1817,1811,1810,897,862,1777,829,826,838,1760,1758,808,2481,1741,1740,1738,1743,2624,1818,2726,2776,782,740,737,1715,686,679,695,1682,1680,639,628,2339,647,644,1645,1643,1640,1648,602,600,597,595,2320,593,2318,609,607,604,1611,1610,1608,1606,613,1615,1613,2328,926,924,892,886,899,857,850,2505,1778,824,823,821,819,2488,818,2486,833,831,828,840,1761,1759,2649,2632,2630,2746,2734,2732,2782,2781,570,567,1587,531,527,523,540,1566,1564,476,467,463,2240,486,483,1524,1521,1518,1529,411,403,2192,399,2189,423,416,1462,1457,1454,428,1468,1465,2210,366,363,2158,360,2156,357,2153,376,373,370,2163,1410,1409,1407,1405,382,1402,380,1417,1415,1412,1421,2175,2174,777,774,771,784,732,725,722,2404,743,1716,676,674,668,2363,665,2360,685,1684,1681,626,624,622,2335,620,2333,617,2330,641,635,649,1646,1644,1642,2566,928,925,2530,2527,894,891,888,2501,2499,2496,858,856,854,851,1779,2692,2668,2665,2645,2643,2640,2651,2768,2759,2757,2744,2743,2741,2748,352,1382,340,337,333,1371,1369,307,300,296,2126,315,312,1347,1342,1350,261,258,250,2097,246,2094,271,268,264,1306,1301,1298,276,1312,1309,2115,203,2048,195,2045,191,2041,213,209,2056,1246,1244,1238,225,1234,222,1256,1253,1249,1262,2080,2079,154,1997,150,1995,147,1992,1989,163,160,2004,156,2001,1175,1174,1172,1170,1167,170,1164,167,1185,1183,1180,1177,174,1190,1188,2025,2024,2022,587,586,564,559,556,2290,573,1588,520,518,512,2268,508,2265,530,1568,1565,461,457,2233,450,2230,446,2226,479,471,489,1526,1523,1520,397,395,2185,392,2183,389,2180,2177,410,2194,402,422,1463,1461,1459,1456,1470,2455,799,2433,2430,779,776,773,2397,2394,2390,734,728,724,746,1717,2356,2354,2351,2348,1658,677,675,673,670,667,688,1685,1683,2606,2589,2586,2559,2556,2552,927,2523,2521,2518,2515,1784,2532,895,893,890,2718,2709,2707,2689,2687,2684,2663,2662,2660,2658,1825,2667,2769,1852,2760,2758,142,141,1139,1138,134,132,129,126,1982,1129,1128,1126,1131,113,111,108,105,1972,101,1970,120,118,115,1109,1108,1106,1104,123,1113,1111,82,79,1951,75,1949,72,1946,92,89,86,1956,1077,1076,1074,1072,98,1069,96,1084,1082,1079,1088,1968,1967,48,45,1916,42,1914,39,1911,1908,60,57,54,1923,50,1920,1031,1030,1028,1026,67,1023,65,1020,62,1041,1039,1036,1033,69,1046,1044,1944,1943,1941,11,9,1868,7,1865,1862,1859,20,1878,16,1875,13,1872,970,968,966,963,29,960,26,23,983,981,978,975,33,971,31,990,988,985,1906,1904,1902,993,351,2145,1383,331,330,328,326,2137,323,2135,339,1372,1370,294,293,291,289,2122,286,2120,283,2117,309,303,317,1348,1346,1344,245,244,242,2090,239,2088,236,2085,2082,260,2099,249,270,1307,1305,1303,1300,1314,189,2038,186,2036,183,2033,2030,2026,206,198,2047,194,216,1247,1245,1243,1240,227,1237,1255,2310,2302,2300,2286,2284,2281,565,563,561,558,575,1589,2261,2259,2256,2253,1542,521,519,517,514,2270,511,533,1569,1567,2223,2221,2218,2215,1483,2211,1480,459,456,453,2232,449,474,491,1527,1525,1522,2475,2467,2465,2451,2449,2446,801,800,2426,2424,2421,2418,1723,2435,780,778,775,2387,2385,2382,2379,1695,2375,1693,2396,735,733,730,727,749,1718,2616,2615,2604,2603,2601,2584,2583,2581,2579,1800,2591,2550,2549,2547,2545,1792,2542,1790,2558,929,2719,1841,2710,2708,1833,1831,2690,2688,2686,1815,1809,1808,1774,1756,1754,1737,1736,1734,1739,1816,1711,1676,1674,633,629,1638,1636,1633,1641,598,1605,1604,1602,1600,605,1609,1607,2327,887,853,1775,822,820,1757,1755,1584,524,1560,1558,468,464,1514,1511,1508,1519,408,404,400,1452,1447,1444,417,1458,1455,2208,364,361,358,2154,1401,1400,1398,1396,374,1393,371,1408,1406,1403,1413,2173,2172,772,726,723,1712,672,669,666,682,1678,1675,625,623,621,618,2331,636,632,1639,1637,1635,920,918,884,880,889,849,848,847,846,2497,855,852,1776,2641,2742,2787,1380,334,1367,1365,301,297,1340,1338,1335,1343,255,251,247,1296,1291,1288,265,1302,1299,2113,204,196,192,2042,1232,1230,1224,214,1220,210,1242,1239,1235,1250,2077,2075,151,148,1993,144,1990,1163,1162,1160,1158,1155,161,1152,157,1173,1171,1168,1165,168,1181,1178,2021,2020,2018,2023,585,560,557,1585,516,509,1562,1559,458,447,2227,472,1516,1513,1510,398,396,393,390,2181,386,2178,407,1453,1451,1449,1446,420,1460,2209,769,764,720,712,2391,729,1713,664,663,661,659,2352,656,2349,671,1679,1677,2553,922,919,2519,2516,885,883,881,2685,2661,2659,2767,2756,2755,140,1137,1136,130,127,1125,1124,1122,1127,109,106,102,1103,1102,1100,1098,116,1107,1105,1980,80,76,73,1947,1068,1067,1065,1063,90,1060,87,1075,1073,1070,1080,1966,1965,46,43,40,1912,36,1909,1019,1018,1016,1014,58,1011,55,1008,51,1029,1027,1024,1021,63,1037,1034,1940,1939,1937,1942,8,1866,4,1863,1,1860,956,954,952,949,946,17,14,969,967,964,961,27,957,24,979,976,972,1901,1900,1898,1896,986,1905,1903,350,349,1381,329,327,324,1368,1366,292,290,287,284,2118,304,1341,1339,1337,1345,243,240,237,2086,233,2083,254,1297,1295,1293,1290,1304,2114,190,187,184,2034,180,2031,177,2027,199,1233,1231,1229,1226,217,1223,1241,2078,2076,584,555,554,552,550,2282,562,1586,507,506,504,502,2257,499,2254,515,1563,1561,445,443,441,2219,438,2216,435,2212,460,454,475,1517,1515,1512,2447,798,797,2422,2419,770,768,766,2383,2380,2376,721,719,717,714,731,1714,2602,2582,2580,2548,2546,2543,923,921,2717,2706,2705,2683,2682,2680,1771,1752,1750,1733,1732,1731,1735,1814,1707,1670,1668,1631,1629,1626,1634,1599,1598,1596,1594,1603,1601,2326,1772,1753,1751,1581,1554,1552,1504,1501,1498,1509,1442,1437,1434,401,1448,1445,2206,1392,1391,1389,1387,1384,359,1399,1397,1394,1404,2171,2170,1708,1672,1669,619,1632,1630,1628,1773,1378,1363,1361,1333,1328,1336,1286,1281,1278,248,1292,1289,2111,1218,1216,1210,197,1206,193,1228,1225,1221,1236,2073,2071,1151,1150,1148,1146,152,1143,149,1140,145,1161,1159,1156,1153,158,1169,1166,2017,2016,2014,2019,1582,510,1556,1553,452,448,1506,1500,394,391,387,1443,1441,1439,1436,1450,2207,765,716,713,1709,662,660,657,1673,1671,916,914,879,878,877,882,1135,1134,1121,1120,1118,1123,1097,1096,1094,1092,103,1101,1099,1979,1059,1058,1056,1054,77,1051,74,1066,1064,1061,1071,1964,1963,1007,1006,1004,1002,999,41,996,37,1017,1015,1012,1009,52,1025,1022,1936,1935,1933,1938,942,940,938,935,932,5,2,955,953,950,947,18,943,15,965,962,958,1895,1894,1892,1890,973,1899,1897,1379,325,1364,1362,288,285,1334,1332,1330,241,238,234,1287,1285,1283,1280,1294,2112,188,185,181,178,2028,1219,1217,1215,1212,200,1209,1227,2074,2072,583,553,551,1583,505,503,500,513,1557,1555,444,442,439,436,2213,455,451,1507,1505,1502,796,763,762,760,767,711,710,708,706,2377,718,715,1710,2544,917,915,2681,1627,1597,1595,2325,1769,1749,1747,1499,1438,1435,2204,1390,1388,1385,1395,2169,2167,1704,1665,1662,1625,1623,1620,1770,1329,1282,1279,2109,1214,1207,1222,2068,2065,1149,1147,1144,1141,146,1157,1154,2013,2011,2008,2015,1579,1549,1546,1495,1487,1433,1431,1428,1425,388,1440,2205,1705,658,1667,1664,1119,1095,1093,1978,1057,1055,1052,1062,1962,1960,1005,1003,1e3,997,38,1013,1010,1932,1930,1927,1934,941,939,936,933,6,930,3,951,948,944,1889,1887,1884,1881,959,1893,1891,35,1377,1360,1358,1327,1325,1322,1331,1277,1275,1272,1269,235,1284,2110,1205,1204,1201,1198,182,1195,179,1213,2070,2067,1580,501,1551,1548,440,437,1497,1494,1490,1503,761,709,707,1706,913,912,2198,1386,2164,2161,1621,1766,2103,1208,2058,2054,1145,1142,2005,2002,1999,2009,1488,1429,1426,2200,1698,1659,1656,1975,1053,1957,1954,1001,998,1924,1921,1918,1928,937,934,931,1879,1876,1873,1870,945,1885,1882,1323,1273,1270,2105,1202,1199,1196,1211,2061,2057,1576,1543,1540,1484,1481,1478,1491,1700]);class tk{constructor(e,t){this.bits=e,this.points=t}getBits(){return this.bits}getPoints(){return this.points}}class tF{static detectMultiple(e,t,r){let n=e.getBlackMatrix(),i=tF.detect(r,n);return i.length||((n=n.clone()).rotate180(),i=tF.detect(r,n)),new tk(n,i)}static detect(e,t){let r=[],n=0,i=0,o=!1;for(;n<t.getHeight();){let a=tF.findVertices(t,n,i);if(null==a[0]&&null==a[3]){if(!o)break;for(let e of(o=!1,i=0,r))null!=e[1]&&(n=Math.trunc(Math.max(n,e[1].getY()))),null!=e[3]&&(n=Math.max(n,Math.trunc(e[3].getY())));n+=tF.ROW_STEP;continue}if(o=!0,r.push(a),!e)break;null!=a[2]?(i=Math.trunc(a[2].getX()),n=Math.trunc(a[2].getY())):(i=Math.trunc(a[4].getX()),n=Math.trunc(a[4].getY()))}return r}static findVertices(e,t,r){let n=e.getHeight(),i=e.getWidth(),o=Array(8);return tF.copyToResult(o,tF.findRowsWithPattern(e,n,i,t,r,tF.START_PATTERN),tF.INDEXES_START_PATTERN),null!=o[4]&&(r=Math.trunc(o[4].getX()),t=Math.trunc(o[4].getY())),tF.copyToResult(o,tF.findRowsWithPattern(e,n,i,t,r,tF.STOP_PATTERN),tF.INDEXES_STOP_PATTERN),o}static copyToResult(e,t,r){for(let n=0;n<r.length;n++)e[r[n]]=t[n]}static findRowsWithPattern(e,t,r,n,i,o){let a=[,,,,],s=!1,l=new Int32Array(o.length);for(;n<t;n+=tF.ROW_STEP){let t=tF.findGuardPattern(e,i,n,r,!1,o,l);if(null!=t){for(;n>0;){let a=tF.findGuardPattern(e,i,--n,r,!1,o,l);if(null!=a)t=a;else{n++;break}}a[0]=new em(t[0],n),a[1]=new em(t[1],n),s=!0;break}}let c=n+1;if(s){let n=0,i=Int32Array.from([Math.trunc(a[0].getX()),Math.trunc(a[1].getX())]);for(;c<t;c++){let t=tF.findGuardPattern(e,i[0],c,r,!1,o,l);if(null!=t&&Math.abs(i[0]-t[0])<tF.MAX_PATTERN_DRIFT&&Math.abs(i[1]-t[1])<tF.MAX_PATTERN_DRIFT)i=t,n=0;else if(n>tF.SKIPPED_ROW_COUNT_MAX)break;else n++}c-=n+1,a[2]=new em(i[0],c),a[3]=new em(i[1],c)}return c-n<tF.BARCODE_MIN_HEIGHT&&L.fill(a,null),a}static findGuardPattern(e,t,r,n,i,o,a){L.fillWithin(a,0,a.length,0);let s=t,l=0;for(;e.get(s,r)&&s>0&&l++<tF.MAX_PIXEL_DRIFT;)s--;let c=s,u=0,h=o.length;for(let t=i;c<n;c++)if(e.get(c,r)!==t)a[u]++;else{if(u===h-1){if(tF.patternMatchVariance(a,o,tF.MAX_INDIVIDUAL_VARIANCE)<tF.MAX_AVG_VARIANCE)return new Int32Array([s,c]);s+=a[0]+a[1],P.arraycopy(a,2,a,0,u-1),a[u-1]=0,a[u]=0,u--}else u++;a[u]=1,t=!t}return u===h-1&&tF.patternMatchVariance(a,o,tF.MAX_INDIVIDUAL_VARIANCE)<tF.MAX_AVG_VARIANCE?new Int32Array([s,c-1]):null}static patternMatchVariance(e,t,r){let n=e.length,i=0,o=0;for(let r=0;r<n;r++)i+=e[r],o+=t[r];if(i<o)return 1/0;let a=i/o;r*=a;let s=0;for(let i=0;i<n;i++){let n=e[i],o=t[i]*a,l=n>o?n-o:o-n;if(l>r)return 1/0;s+=l}return s/i}}tF.INDEXES_START_PATTERN=Int32Array.from([0,4,1,5]),tF.INDEXES_STOP_PATTERN=Int32Array.from([6,2,7,3]),tF.MAX_AVG_VARIANCE=.42,tF.MAX_INDIVIDUAL_VARIANCE=.8,tF.START_PATTERN=Int32Array.from([8,1,1,1,1,1,1,3]),tF.STOP_PATTERN=Int32Array.from([7,1,1,3,1,1,1,2,1]),tF.MAX_PIXEL_DRIFT=3,tF.MAX_PATTERN_DRIFT=5,tF.SKIPPED_ROW_COUNT_MAX=25,tF.ROW_STEP=5,tF.BARCODE_MIN_HEIGHT=10;class tU{constructor(e,t){if(0===t.length)throw new D;this.field=e;let r=t.length;if(r>1&&0===t[0]){let e=1;for(;e<r&&0===t[e];)e++;e===r?this.coefficients=new Int32Array([0]):(this.coefficients=new Int32Array(r-e),P.arraycopy(t,e,this.coefficients,0,this.coefficients.length))}else this.coefficients=t}getCoefficients(){return this.coefficients}getDegree(){return this.coefficients.length-1}isZero(){return 0===this.coefficients[0]}getCoefficient(e){return this.coefficients[this.coefficients.length-1-e]}evaluateAt(e){if(0===e)return this.getCoefficient(0);if(1===e){let e=0;for(let t of this.coefficients)e=this.field.add(e,t);return e}let t=this.coefficients[0],r=this.coefficients.length;for(let n=1;n<r;n++)t=this.field.add(this.field.multiply(e,t),this.coefficients[n]);return t}add(e){if(!this.field.equals(e.field))throw new D("ModulusPolys do not have same ModulusGF field");if(this.isZero())return e;if(e.isZero())return this;let t=this.coefficients,r=e.coefficients;if(t.length>r.length){let e=t;t=r,r=e}let n=new Int32Array(r.length),i=r.length-t.length;P.arraycopy(r,0,n,0,i);for(let e=i;e<r.length;e++)n[e]=this.field.add(t[e-i],r[e]);return new tU(this.field,n)}subtract(e){if(!this.field.equals(e.field))throw new D("ModulusPolys do not have same ModulusGF field");return e.isZero()?this:this.add(e.negative())}multiply(e){return e instanceof tU?this.multiplyOther(e):this.multiplyScalar(e)}multiplyOther(e){if(!this.field.equals(e.field))throw new D("ModulusPolys do not have same ModulusGF field");if(this.isZero()||e.isZero())return new tU(this.field,new Int32Array([0]));let t=this.coefficients,r=t.length,n=e.coefficients,i=n.length,o=new Int32Array(r+i-1);for(let e=0;e<r;e++){let r=t[e];for(let t=0;t<i;t++)o[e+t]=this.field.add(o[e+t],this.field.multiply(r,n[t]))}return new tU(this.field,o)}negative(){let e=this.coefficients.length,t=new Int32Array(e);for(let r=0;r<e;r++)t[r]=this.field.subtract(0,this.coefficients[r]);return new tU(this.field,t)}multiplyScalar(e){if(0===e)return new tU(this.field,new Int32Array([0]));if(1===e)return this;let t=this.coefficients.length,r=new Int32Array(t);for(let n=0;n<t;n++)r[n]=this.field.multiply(this.coefficients[n],e);return new tU(this.field,r)}multiplyByMonomial(e,t){if(e<0)throw new D;if(0===t)return new tU(this.field,new Int32Array([0]));let r=this.coefficients.length,n=new Int32Array(r+e);for(let e=0;e<r;e++)n[e]=this.field.multiply(this.coefficients[e],t);return new tU(this.field,n)}toString(){let e=new W;for(let t=this.getDegree();t>=0;t--){let r=this.getCoefficient(t);0!==r&&(r<0?(e.append(" - "),r=-r):e.length()>0&&e.append(" + "),(0===t||1!==r)&&e.append(r),0!==t&&(1===t?e.append("x"):(e.append("x^"),e.append(t))))}return e.toString()}}class tH{add(e,t){return(e+t)%this.modulus}subtract(e,t){return(this.modulus+e-t)%this.modulus}exp(e){return this.expTable[e]}log(e){if(0===e)throw new D;return this.logTable[e]}inverse(e){if(0===e)throw new el;return this.expTable[this.modulus-this.logTable[e]-1]}multiply(e,t){return 0===e||0===t?0:this.expTable[(this.logTable[e]+this.logTable[t])%(this.modulus-1)]}getSize(){return this.modulus}equals(e){return e===this}}class tz extends tH{constructor(e,t){super(),this.modulus=e,this.expTable=new Int32Array(e),this.logTable=new Int32Array(e);let r=1;for(let n=0;n<e;n++)this.expTable[n]=r,r=r*t%e;for(let t=0;t<e-1;t++)this.logTable[this.expTable[t]]=t;this.zero=new tU(this,new Int32Array([0])),this.one=new tU(this,new Int32Array([1]))}getZero(){return this.zero}getOne(){return this.one}buildMonomial(e,t){if(e<0)throw new D;if(0===t)return this.zero;let r=new Int32Array(e+1);return r[0]=t,new tU(this,r)}}tz.PDF417_GF=new tz(tL.NUMBER_OF_CODEWORDS,3);class tV{constructor(){this.field=tz.PDF417_GF}decode(e,t,r){let n=new tU(this.field,e),i=new Int32Array(t),o=!1;for(let e=t;e>0;e--){let r=n.evaluateAt(this.field.exp(e));i[t-e]=r,0!==r&&(o=!0)}if(!o)return 0;let a=this.field.getOne();if(null!=r)for(let t of r){let r=this.field.exp(e.length-1-t),n=new tU(this.field,new Int32Array([this.field.subtract(0,r),1]));a=a.multiply(n)}let s=new tU(this.field,i),l=this.runEuclideanAlgorithm(this.field.buildMonomial(t,1),s,t),c=l[0],u=l[1],h=this.findErrorLocations(c),d=this.findErrorMagnitudes(u,c,h);for(let t=0;t<h.length;t++){let r=e.length-1-this.field.log(h[t]);if(r<0)throw R.getChecksumInstance();e[r]=this.field.subtract(e[r],d[t])}return h.length}runEuclideanAlgorithm(e,t,r){if(e.getDegree()<t.getDegree()){let r=e;e=t,t=r}let n=e,i=t,o=this.field.getZero(),a=this.field.getOne();for(;i.getDegree()>=Math.round(r/2);){let e=n,t=o;if(n=i,o=a,n.isZero())throw R.getChecksumInstance();i=e;let r=this.field.getZero(),s=n.getCoefficient(n.getDegree()),l=this.field.inverse(s);for(;i.getDegree()>=n.getDegree()&&!i.isZero();){let e=i.getDegree()-n.getDegree(),t=this.field.multiply(i.getCoefficient(i.getDegree()),l);r=r.add(this.field.buildMonomial(e,t)),i=i.subtract(n.multiplyByMonomial(e,t))}a=r.multiply(o).subtract(t).negative()}let s=a.getCoefficient(0);if(0===s)throw R.getChecksumInstance();let l=this.field.inverse(s);return[a.multiply(l),i.multiply(l)]}findErrorLocations(e){let t=e.getDegree(),r=new Int32Array(t),n=0;for(let i=1;i<this.field.getSize()&&n<t;i++)0===e.evaluateAt(i)&&(r[n]=this.field.inverse(i),n++);if(n!==t)throw R.getChecksumInstance();return r}findErrorMagnitudes(e,t,r){let n=t.getDegree(),i=new Int32Array(n);for(let e=1;e<=n;e++)i[n-e]=this.field.multiply(e,t.getCoefficient(e));let o=new tU(this.field,i),a=r.length,s=new Int32Array(a);for(let t=0;t<a;t++){let n=this.field.inverse(r[t]),i=this.field.subtract(0,e.evaluateAt(n)),a=this.field.inverse(o.evaluateAt(n));s[t]=this.field.multiply(i,a)}return s}}class tj{constructor(e,t,r,n,i){e instanceof tj?this.constructor_2(e):this.constructor_1(e,t,r,n,i)}constructor_1(e,t,r,n,i){let o=null==t||null==r,a=null==n||null==i;if(o&&a)throw new X;o?(t=new em(0,n.getY()),r=new em(0,i.getY())):a&&(n=new em(e.getWidth()-1,t.getY()),i=new em(e.getWidth()-1,r.getY())),this.image=e,this.topLeft=t,this.bottomLeft=r,this.topRight=n,this.bottomRight=i,this.minX=Math.trunc(Math.min(t.getX(),r.getX())),this.maxX=Math.trunc(Math.max(n.getX(),i.getX())),this.minY=Math.trunc(Math.min(t.getY(),n.getY())),this.maxY=Math.trunc(Math.max(r.getY(),i.getY()))}constructor_2(e){this.image=e.image,this.topLeft=e.getTopLeft(),this.bottomLeft=e.getBottomLeft(),this.topRight=e.getTopRight(),this.bottomRight=e.getBottomRight(),this.minX=e.getMinX(),this.maxX=e.getMaxX(),this.minY=e.getMinY(),this.maxY=e.getMaxY()}static merge(e,t){return null==e?t:null==t?e:new tj(e.image,e.topLeft,e.bottomLeft,t.topRight,t.bottomRight)}addMissingRows(e,t,r){let n=this.topLeft,i=this.bottomLeft,o=this.topRight,a=this.bottomRight;if(e>0){let t=r?this.topLeft:this.topRight,i=Math.trunc(t.getY()-e);i<0&&(i=0);let a=new em(t.getX(),i);r?n=a:o=a}if(t>0){let e=r?this.bottomLeft:this.bottomRight,n=Math.trunc(e.getY()+t);n>=this.image.getHeight()&&(n=this.image.getHeight()-1);let o=new em(e.getX(),n);r?i=o:a=o}return new tj(this.image,n,i,o,a)}getMinX(){return this.minX}getMaxX(){return this.maxX}getMinY(){return this.minY}getMaxY(){return this.maxY}getTopLeft(){return this.topLeft}getTopRight(){return this.topRight}getBottomLeft(){return this.bottomLeft}getBottomRight(){return this.bottomRight}}class tG{constructor(e,t,r,n){this.columnCount=e,this.errorCorrectionLevel=n,this.rowCountUpperPart=t,this.rowCountLowerPart=r,this.rowCount=t+r}getColumnCount(){return this.columnCount}getErrorCorrectionLevel(){return this.errorCorrectionLevel}getRowCount(){return this.rowCount}getRowCountUpperPart(){return this.rowCountUpperPart}getRowCountLowerPart(){return this.rowCountLowerPart}}class tW{constructor(){this.buffer=""}static form(e,t){let r=-1;return e.replace(/%(-)?(0?[0-9]+)?([.][0-9]+)?([#][0-9]+)?([scfpexd%])/g,function(e,n,i,o,a,s){let l;if("%%"===e)return"%";if(void 0===t[++r])return;e=o?parseInt(o.substr(1)):void 0;let c=a?parseInt(a.substr(1)):void 0;switch(s){case"s":l=t[r];break;case"c":l=t[r][0];break;case"f":l=parseFloat(t[r]).toFixed(e);break;case"p":l=parseFloat(t[r]).toPrecision(e);break;case"e":l=parseFloat(t[r]).toExponential(e);break;case"x":l=parseInt(t[r]).toString(c||16);break;case"d":l=parseFloat(parseInt(t[r],c||10).toPrecision(e)).toFixed(0)}l="object"==typeof l?JSON.stringify(l):(+l).toString(c);let u=parseInt(i),h=i&&i[0]+""=="0"?"0":" ";for(;l.length<u;)l=void 0!==n?l+h:h+l;return l})}format(e,...t){this.buffer+=tW.form(e,t)}toString(){return this.buffer}}class tY{constructor(e){this.boundingBox=new tj(e),this.codewords=Array(e.getMaxY()-e.getMinY()+1)}getCodewordNearby(e){let t=this.getCodeword(e);if(null!=t)return t;for(let r=1;r<tY.MAX_NEARBY_DISTANCE;r++){let n=this.imageRowToCodewordIndex(e)-r;if(n>=0&&null!=(t=this.codewords[n])||(n=this.imageRowToCodewordIndex(e)+r)<this.codewords.length&&null!=(t=this.codewords[n]))return t}return null}imageRowToCodewordIndex(e){return e-this.boundingBox.getMinY()}setCodeword(e,t){this.codewords[this.imageRowToCodewordIndex(e)]=t}getCodeword(e){return this.codewords[this.imageRowToCodewordIndex(e)]}getBoundingBox(){return this.boundingBox}getCodewords(){return this.codewords}toString(){let e=new tW,t=0;for(let r of this.codewords){if(null==r){e.format("%3d: | %n",t++);continue}e.format("%3d: %3d|%3d%n",t++,r.getRowNumber(),r.getValue())}return e.toString()}}tY.MAX_NEARBY_DISTANCE=5;class tX{constructor(){this.values=new Map}setValue(e){e=Math.trunc(e);let t=this.values.get(e);null==t&&(t=0),t++,this.values.set(e,t)}getValue(){let e=-1,t=[];for(let[r,n]of this.values.entries()){let i={getKey:()=>r,getValue:()=>n};i.getValue()>e?(e=i.getValue(),(t=[]).push(i.getKey())):i.getValue()===e&&t.push(i.getKey())}return tL.toIntArray(t)}getConfidence(e){return this.values.get(e)}}class tZ extends tY{constructor(e,t){super(e),this._isLeft=t}setRowNumbers(){for(let e of this.getCodewords())null!=e&&e.setRowNumberAsRowIndicatorColumn()}adjustCompleteIndicatorColumnRowNumbers(e){let t=this.getCodewords();this.setRowNumbers(),this.removeIncorrectCodewords(t,e);let r=this.getBoundingBox(),n=this._isLeft?r.getTopLeft():r.getTopRight(),i=this._isLeft?r.getBottomLeft():r.getBottomRight(),o=this.imageRowToCodewordIndex(Math.trunc(n.getY())),a=this.imageRowToCodewordIndex(Math.trunc(i.getY())),s=-1,l=1,c=0;for(let r=o;r<a;r++){if(null==t[r])continue;let n=t[r],i=n.getRowNumber()-s;if(0===i)c++;else if(1===i)l=Math.max(l,c),c=1,s=n.getRowNumber();else if(i<0||n.getRowNumber()>=e.getRowCount()||i>r)t[r]=null;else{let e,o=(e=l>2?(l-2)*i:i)>=r;for(let n=1;n<=e&&!o;n++)o=null!=t[r-n];o?t[r]=null:(s=n.getRowNumber(),c=1)}}}getRowHeights(){let e=this.getBarcodeMetadata();if(null==e)return null;this.adjustIncompleteIndicatorColumnRowNumbers(e);let t=new Int32Array(e.getRowCount());for(let e of this.getCodewords())if(null!=e){let r=e.getRowNumber();if(r>=t.length)continue;t[r]++}return t}adjustIncompleteIndicatorColumnRowNumbers(e){let t=this.getBoundingBox(),r=this._isLeft?t.getTopLeft():t.getTopRight(),n=this._isLeft?t.getBottomLeft():t.getBottomRight(),i=this.imageRowToCodewordIndex(Math.trunc(r.getY())),o=this.imageRowToCodewordIndex(Math.trunc(n.getY())),a=this.getCodewords(),s=-1;for(let t=i;t<o;t++){if(null==a[t])continue;let r=a[t];r.setRowNumberAsRowIndicatorColumn();let n=r.getRowNumber()-s;0===n||(1===n?s=r.getRowNumber():r.getRowNumber()>=e.getRowCount()?a[t]=null:s=r.getRowNumber())}}getBarcodeMetadata(){let e=this.getCodewords(),t=new tX,r=new tX,n=new tX,i=new tX;for(let o of e){if(null==o)continue;o.setRowNumberAsRowIndicatorColumn();let e=o.getValue()%30,a=o.getRowNumber();switch(!this._isLeft&&(a+=2),a%3){case 0:r.setValue(3*e+1);break;case 1:i.setValue(e/3),n.setValue(e%3);break;case 2:t.setValue(e+1)}}if(0===t.getValue().length||0===r.getValue().length||0===n.getValue().length||0===i.getValue().length||t.getValue()[0]<1||r.getValue()[0]+n.getValue()[0]<tL.MIN_ROWS_IN_BARCODE||r.getValue()[0]+n.getValue()[0]>tL.MAX_ROWS_IN_BARCODE)return null;let o=new tG(t.getValue()[0],r.getValue()[0],n.getValue()[0],i.getValue()[0]);return this.removeIncorrectCodewords(e,o),o}removeIncorrectCodewords(e,t){for(let r=0;r<e.length;r++){let n=e[r];if(null==e[r])continue;let i=n.getValue()%30,o=n.getRowNumber();if(o>t.getRowCount()){e[r]=null;continue}switch(!this._isLeft&&(o+=2),o%3){case 0:3*i+1!==t.getRowCountUpperPart()&&(e[r]=null);break;case 1:(Math.trunc(i/3)!==t.getErrorCorrectionLevel()||i%3!==t.getRowCountLowerPart())&&(e[r]=null);break;case 2:i+1!==t.getColumnCount()&&(e[r]=null)}}}isLeft(){return this._isLeft}toString(){return"IsLeft: "+this._isLeft+"\n"+super.toString()}}class tQ{constructor(e,t){this.ADJUST_ROW_NUMBER_SKIP=2,this.barcodeMetadata=e,this.barcodeColumnCount=e.getColumnCount(),this.boundingBox=t,this.detectionResultColumns=Array(this.barcodeColumnCount+2)}getDetectionResultColumns(){let e;this.adjustIndicatorColumnRowNumbers(this.detectionResultColumns[0]),this.adjustIndicatorColumnRowNumbers(this.detectionResultColumns[this.barcodeColumnCount+1]);let t=tL.MAX_CODEWORDS_IN_BARCODE;do e=t,t=this.adjustRowNumbersAndGetCount();while(t>0&&t<e);return this.detectionResultColumns}adjustIndicatorColumnRowNumbers(e){null!=e&&e.adjustCompleteIndicatorColumnRowNumbers(this.barcodeMetadata)}adjustRowNumbersAndGetCount(){let e=this.adjustRowNumbersByRow();if(0===e)return 0;for(let e=1;e<this.barcodeColumnCount+1;e++){let t=this.detectionResultColumns[e].getCodewords();for(let r=0;r<t.length;r++)null!=t[r]&&(t[r].hasValidRowNumber()||this.adjustRowNumbers(e,r,t))}return e}adjustRowNumbersByRow(){return this.adjustRowNumbersFromBothRI(),this.adjustRowNumbersFromLRI()+this.adjustRowNumbersFromRRI()}adjustRowNumbersFromBothRI(){if(null==this.detectionResultColumns[0]||null==this.detectionResultColumns[this.barcodeColumnCount+1])return;let e=this.detectionResultColumns[0].getCodewords(),t=this.detectionResultColumns[this.barcodeColumnCount+1].getCodewords();for(let r=0;r<e.length;r++)if(null!=e[r]&&null!=t[r]&&e[r].getRowNumber()===t[r].getRowNumber())for(let t=1;t<=this.barcodeColumnCount;t++){let n=this.detectionResultColumns[t].getCodewords()[r];null!=n&&(n.setRowNumber(e[r].getRowNumber()),n.hasValidRowNumber()||(this.detectionResultColumns[t].getCodewords()[r]=null))}}adjustRowNumbersFromRRI(){if(null==this.detectionResultColumns[this.barcodeColumnCount+1])return 0;let e=0,t=this.detectionResultColumns[this.barcodeColumnCount+1].getCodewords();for(let r=0;r<t.length;r++){if(null==t[r])continue;let n=t[r].getRowNumber(),i=0;for(let t=this.barcodeColumnCount+1;t>0&&i<this.ADJUST_ROW_NUMBER_SKIP;t--){let o=this.detectionResultColumns[t].getCodewords()[r];null!=o&&(i=tQ.adjustRowNumberIfValid(n,i,o),!o.hasValidRowNumber()&&e++)}}return e}adjustRowNumbersFromLRI(){if(null==this.detectionResultColumns[0])return 0;let e=0,t=this.detectionResultColumns[0].getCodewords();for(let r=0;r<t.length;r++){if(null==t[r])continue;let n=t[r].getRowNumber(),i=0;for(let t=1;t<this.barcodeColumnCount+1&&i<this.ADJUST_ROW_NUMBER_SKIP;t++){let o=this.detectionResultColumns[t].getCodewords()[r];null!=o&&(i=tQ.adjustRowNumberIfValid(n,i,o),!o.hasValidRowNumber()&&e++)}}return e}static adjustRowNumberIfValid(e,t,r){return null==r||!r.hasValidRowNumber()&&(r.isValidRowNumber(e)?(r.setRowNumber(e),t=0):++t),t}adjustRowNumbers(e,t,r){if(!this.detectionResultColumns[e-1])return;let n=r[t],i=this.detectionResultColumns[e-1].getCodewords(),o=i;null!=this.detectionResultColumns[e+1]&&(o=this.detectionResultColumns[e+1].getCodewords());let a=Array(14);for(let e of(a[2]=i[t],a[3]=o[t],t>0&&(a[0]=r[t-1],a[4]=i[t-1],a[5]=o[t-1]),t>1&&(a[8]=r[t-2],a[10]=i[t-2],a[11]=o[t-2]),t<r.length-1&&(a[1]=r[t+1],a[6]=i[t+1],a[7]=o[t+1]),t<r.length-2&&(a[9]=r[t+2],a[12]=i[t+2],a[13]=o[t+2]),a))if(tQ.adjustRowNumber(n,e))return}static adjustRowNumber(e,t){return null!=t&&!!t.hasValidRowNumber()&&t.getBucket()===e.getBucket()&&(e.setRowNumber(t.getRowNumber()),!0)}getBarcodeColumnCount(){return this.barcodeColumnCount}getBarcodeRowCount(){return this.barcodeMetadata.getRowCount()}getBarcodeECLevel(){return this.barcodeMetadata.getErrorCorrectionLevel()}setBoundingBox(e){this.boundingBox=e}getBoundingBox(){return this.boundingBox}setDetectionResultColumn(e,t){this.detectionResultColumns[e]=t}getDetectionResultColumn(e){return this.detectionResultColumns[e]}toString(){let e=this.detectionResultColumns[0];null==e&&(e=this.detectionResultColumns[this.barcodeColumnCount+1]);let t=new tW;for(let r=0;r<e.getCodewords().length;r++){t.format("CW %3d:",r);for(let e=0;e<this.barcodeColumnCount+2;e++){if(null==this.detectionResultColumns[e]){t.format(" | ");continue}let n=this.detectionResultColumns[e].getCodewords()[r];if(null==n){t.format(" | ");continue}t.format(" %3d|%3d",n.getRowNumber(),n.getValue())}t.format("%n")}return t.toString()}}class tq{constructor(e,t,r,n){this.rowNumber=tq.BARCODE_ROW_UNKNOWN,this.startX=Math.trunc(e),this.endX=Math.trunc(t),this.bucket=Math.trunc(r),this.value=Math.trunc(n)}hasValidRowNumber(){return this.isValidRowNumber(this.rowNumber)}isValidRowNumber(e){return e!==tq.BARCODE_ROW_UNKNOWN&&this.bucket===e%3*3}setRowNumberAsRowIndicatorColumn(){this.rowNumber=Math.trunc(3*Math.trunc(this.value/30)+Math.trunc(this.bucket/3))}getWidth(){return this.endX-this.startX}getStartX(){return this.startX}getEndX(){return this.endX}getBucket(){return this.bucket}getValue(){return this.value}getRowNumber(){return this.rowNumber}setRowNumber(e){this.rowNumber=e}toString(){return this.rowNumber+"|"+this.value}}tq.BARCODE_ROW_UNKNOWN=-1;class tK{static initialize(){for(let e=0;e<tL.SYMBOL_TABLE.length;e++){let t=tL.SYMBOL_TABLE[e],r=1&t;for(let n=0;n<tL.BARS_IN_MODULE;n++){let i=0;for(;(1&t)===r;)i+=1,t>>=1;r=1&t,tK.RATIOS_TABLE[e]||(tK.RATIOS_TABLE[e]=Array(tL.BARS_IN_MODULE)),tK.RATIOS_TABLE[e][tL.BARS_IN_MODULE-n-1]=Math.fround(i/tL.MODULES_IN_CODEWORD)}}this.bSymbolTableReady=!0}static getDecodedValue(e){let t=tK.getDecodedCodewordValue(tK.sampleBitCounts(e));return -1!==t?t:tK.getClosestDecodedValue(e)}static sampleBitCounts(e){let t=eg.sum(e),r=new Int32Array(tL.BARS_IN_MODULE),n=0,i=0;for(let o=0;o<tL.MODULES_IN_CODEWORD;o++){let a=t/(2*tL.MODULES_IN_CODEWORD)+o*t/tL.MODULES_IN_CODEWORD;i+e[n]<=a&&(i+=e[n],n++),r[n]++}return r}static getDecodedCodewordValue(e){let t=tK.getBitValue(e);return -1===tL.getCodeword(t)?-1:t}static getBitValue(e){let t=0;for(let r=0;r<e.length;r++)for(let n=0;n<e[r];n++)t=t<<1|+(r%2==0);return Math.trunc(t)}static getClosestDecodedValue(e){let t=eg.sum(e),r=Array(tL.BARS_IN_MODULE);if(t>1)for(let n=0;n<r.length;n++)r[n]=Math.fround(e[n]/t);let n=ep.MAX_VALUE,i=-1;this.bSymbolTableReady||tK.initialize();for(let e=0;e<tK.RATIOS_TABLE.length;e++){let t=0,o=tK.RATIOS_TABLE[e];for(let e=0;e<tL.BARS_IN_MODULE;e++){let i=Math.fround(o[e]-r[e]);if((t+=Math.fround(i*i))>=n)break}t<n&&(n=t,i=tL.SYMBOL_TABLE[e])}return i}}tK.bSymbolTableReady=!1,tK.RATIOS_TABLE=Array(tL.SYMBOL_TABLE.length).map(e=>Array(tL.BARS_IN_MODULE));class t${constructor(){this.segmentCount=-1,this.fileSize=-1,this.timestamp=-1,this.checksum=-1}getSegmentIndex(){return this.segmentIndex}setSegmentIndex(e){this.segmentIndex=e}getFileId(){return this.fileId}setFileId(e){this.fileId=e}getOptionalData(){return this.optionalData}setOptionalData(e){this.optionalData=e}isLastSegment(){return this.lastSegment}setLastSegment(e){this.lastSegment=e}getSegmentCount(){return this.segmentCount}setSegmentCount(e){this.segmentCount=e}getSender(){return this.sender||null}setSender(e){this.sender=e}getAddressee(){return this.addressee||null}setAddressee(e){this.addressee=e}getFileName(){return this.fileName}setFileName(e){this.fileName=e}getFileSize(){return this.fileSize}setFileSize(e){this.fileSize=e}getChecksum(){return this.checksum}setChecksum(e){this.checksum=e}getTimestamp(){return this.timestamp}setTimestamp(e){this.timestamp=e}}class tJ{static parseLong(e,t){return parseInt(e,t)}}class t1 extends N{}t1.kind="NullPointerException";class t0{writeBytes(e){this.writeBytesOffset(e,0,e.length)}writeBytesOffset(e,t,r){if(null==e)throw new t1;if(t<0||t>e.length||r<0||t+r>e.length||t+r<0)throw new B;if(0!==r)for(let n=0;n<r;n++)this.write(e[t+n])}flush(){}close(){}}class t2 extends N{}class t3 extends t0{constructor(e=32){if(super(),this.count=0,e<0)throw new D("Negative initial size: "+e);this.buf=new Uint8Array(e)}ensureCapacity(e){e-this.buf.length>0&&this.grow(e)}grow(e){let t=this.buf.length<<1;if(t-e<0&&(t=e),t<0){if(e<0)throw new t2;t=k.MAX_VALUE}this.buf=L.copyOfUint8Array(this.buf,t)}write(e){this.ensureCapacity(this.count+1),this.buf[this.count]=e,this.count+=1}writeBytesOffset(e,t,r){if(t<0||t>e.length||r<0||t+r-e.length>0)throw new B;this.ensureCapacity(this.count+r),P.arraycopy(e,t,this.buf,this.count,r),this.count+=r}writeTo(e){e.writeBytesOffset(this.buf,0,this.count)}reset(){this.count=0}toByteArray(){return L.copyOfUint8Array(this.buf,this.count)}size(){return this.count}toString(e){return e?"string"==typeof e?this.toString_string(e):this.toString_number(e):this.toString_void()}toString_void(){return new String(this.buf).toString()}toString_string(e){return new String(this.buf).toString()}toString_number(e){return new String(this.buf).toString()}close(){}}function t4(){if("undefined"!=typeof window)return window.BigInt||null;if(void 0!==r.g)return r.g.BigInt||null;if("undefined"!=typeof self)return self.BigInt||null;throw Error("Can't search globals for BigInt!")}function t8(e){if(void 0===t&&(t=t4()),null===t)throw Error("BigInt is not supported!");return t(e)}(d=S||(S={}))[d.ALPHA=0]="ALPHA",d[d.LOWER=1]="LOWER",d[d.MIXED=2]="MIXED",d[d.PUNCT=3]="PUNCT",d[d.ALPHA_SHIFT=4]="ALPHA_SHIFT",d[d.PUNCT_SHIFT=5]="PUNCT_SHIFT";class t6{static decode(e,t){let r=new W(""),n=z.ISO8859_1;r.enableDecoding(n);let i=1,o=e[i++],a=new t$;for(;i<e[0];){switch(o){case t6.TEXT_COMPACTION_MODE_LATCH:i=t6.textCompaction(e,i,r);break;case t6.BYTE_COMPACTION_MODE_LATCH:case t6.BYTE_COMPACTION_MODE_LATCH_6:i=t6.byteCompaction(o,e,n,i,r);break;case t6.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:r.append(e[i++]);break;case t6.NUMERIC_COMPACTION_MODE_LATCH:i=t6.numericCompaction(e,i,r);break;case t6.ECI_CHARSET:z.getCharacterSetECIByValue(e[i++]);break;case t6.ECI_GENERAL_PURPOSE:i+=2;break;case t6.ECI_USER_DEFINED:i++;break;case t6.BEGIN_MACRO_PDF417_CONTROL_BLOCK:i=t6.decodeMacroBlock(e,i,a);break;case t6.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case t6.MACRO_PDF417_TERMINATOR:throw new H;default:i--,i=t6.textCompaction(e,i,r)}if(i<e.length)o=e[i++];else throw H.getFormatInstance()}if(0===r.length())throw H.getFormatInstance();let s=new eo(null,r.toString(),null,t);return s.setOther(a),s}static decodeMacroBlock(e,t,r){if(t+t6.NUMBER_OF_SEQUENCE_CODEWORDS>e[0])throw H.getFormatInstance();let n=new Int32Array(t6.NUMBER_OF_SEQUENCE_CODEWORDS);for(let r=0;r<t6.NUMBER_OF_SEQUENCE_CODEWORDS;r++,t++)n[r]=e[t];r.setSegmentIndex(k.parseInt(t6.decodeBase900toBase10(n,t6.NUMBER_OF_SEQUENCE_CODEWORDS)));let i=new W;t=t6.textCompaction(e,t,i),r.setFileId(i.toString());let o=-1;for(e[t]===t6.BEGIN_MACRO_PDF417_OPTIONAL_FIELD&&(o=t+1);t<e[0];)switch(e[t]){case t6.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:switch(e[++t]){case t6.MACRO_PDF417_OPTIONAL_FIELD_FILE_NAME:let n=new W;t=t6.textCompaction(e,t+1,n),r.setFileName(n.toString());break;case t6.MACRO_PDF417_OPTIONAL_FIELD_SENDER:let i=new W;t=t6.textCompaction(e,t+1,i),r.setSender(i.toString());break;case t6.MACRO_PDF417_OPTIONAL_FIELD_ADDRESSEE:let o=new W;t=t6.textCompaction(e,t+1,o),r.setAddressee(o.toString());break;case t6.MACRO_PDF417_OPTIONAL_FIELD_SEGMENT_COUNT:let a=new W;t=t6.numericCompaction(e,t+1,a),r.setSegmentCount(k.parseInt(a.toString()));break;case t6.MACRO_PDF417_OPTIONAL_FIELD_TIME_STAMP:let s=new W;t=t6.numericCompaction(e,t+1,s),r.setTimestamp(tJ.parseLong(s.toString()));break;case t6.MACRO_PDF417_OPTIONAL_FIELD_CHECKSUM:let l=new W;t=t6.numericCompaction(e,t+1,l),r.setChecksum(k.parseInt(l.toString()));break;case t6.MACRO_PDF417_OPTIONAL_FIELD_FILE_SIZE:let c=new W;t=t6.numericCompaction(e,t+1,c),r.setFileSize(tJ.parseLong(c.toString()));break;default:throw H.getFormatInstance()}break;case t6.MACRO_PDF417_TERMINATOR:t++,r.setLastSegment(!0);break;default:throw H.getFormatInstance()}if(-1!==o){let n=t-o;r.isLastSegment()&&n--,r.setOptionalData(L.copyOfRange(e,o,o+n))}return t}static textCompaction(e,t,r){let n=new Int32Array((e[0]-t)*2),i=new Int32Array((e[0]-t)*2),o=0,a=!1;for(;t<e[0]&&!a;){let r=e[t++];if(r<t6.TEXT_COMPACTION_MODE_LATCH)n[o]=r/30,n[o+1]=r%30,o+=2;else switch(r){case t6.TEXT_COMPACTION_MODE_LATCH:n[o++]=t6.TEXT_COMPACTION_MODE_LATCH;break;case t6.BYTE_COMPACTION_MODE_LATCH:case t6.BYTE_COMPACTION_MODE_LATCH_6:case t6.NUMERIC_COMPACTION_MODE_LATCH:case t6.BEGIN_MACRO_PDF417_CONTROL_BLOCK:case t6.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case t6.MACRO_PDF417_TERMINATOR:t--,a=!0;break;case t6.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:n[o]=t6.MODE_SHIFT_TO_BYTE_COMPACTION_MODE,r=e[t++],i[o]=r,o++}}return t6.decodeTextCompaction(n,i,o,r),t}static decodeTextCompaction(e,t,r,n){let i=S.ALPHA,o=S.ALPHA,a=0;for(;a<r;){let r=e[a],s="";switch(i){case S.ALPHA:if(r<26)s=String.fromCharCode(65+r);else switch(r){case 26:s=" ";break;case t6.LL:i=S.LOWER;break;case t6.ML:i=S.MIXED;break;case t6.PS:o=i,i=S.PUNCT_SHIFT;break;case t6.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:n.append(t[a]);break;case t6.TEXT_COMPACTION_MODE_LATCH:i=S.ALPHA}break;case S.LOWER:if(r<26)s=String.fromCharCode(97+r);else switch(r){case 26:s=" ";break;case t6.AS:o=i,i=S.ALPHA_SHIFT;break;case t6.ML:i=S.MIXED;break;case t6.PS:o=i,i=S.PUNCT_SHIFT;break;case t6.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:n.append(t[a]);break;case t6.TEXT_COMPACTION_MODE_LATCH:i=S.ALPHA}break;case S.MIXED:if(r<t6.PL)s=t6.MIXED_CHARS[r];else switch(r){case t6.PL:i=S.PUNCT;break;case 26:s=" ";break;case t6.LL:i=S.LOWER;break;case t6.AL:i=S.ALPHA;break;case t6.PS:o=i,i=S.PUNCT_SHIFT;break;case t6.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:n.append(t[a]);break;case t6.TEXT_COMPACTION_MODE_LATCH:i=S.ALPHA}break;case S.PUNCT:if(r<t6.PAL)s=t6.PUNCT_CHARS[r];else switch(r){case t6.PAL:i=S.ALPHA;break;case t6.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:n.append(t[a]);break;case t6.TEXT_COMPACTION_MODE_LATCH:i=S.ALPHA}break;case S.ALPHA_SHIFT:if(i=o,r<26)s=String.fromCharCode(65+r);else switch(r){case 26:s=" ";break;case t6.TEXT_COMPACTION_MODE_LATCH:i=S.ALPHA}break;case S.PUNCT_SHIFT:if(i=o,r<t6.PAL)s=t6.PUNCT_CHARS[r];else switch(r){case t6.PAL:i=S.ALPHA;break;case t6.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:n.append(t[a]);break;case t6.TEXT_COMPACTION_MODE_LATCH:i=S.ALPHA}}""!==s&&n.append(s),a++}}static byteCompaction(e,t,r,n,i){let o=new t3,a=0,s=0,l=!1;switch(e){case t6.BYTE_COMPACTION_MODE_LATCH:let c=new Int32Array(6),u=t[n++];for(;n<t[0]&&!l;)switch(c[a++]=u,s=900*s+u,u=t[n++]){case t6.TEXT_COMPACTION_MODE_LATCH:case t6.BYTE_COMPACTION_MODE_LATCH:case t6.NUMERIC_COMPACTION_MODE_LATCH:case t6.BYTE_COMPACTION_MODE_LATCH_6:case t6.BEGIN_MACRO_PDF417_CONTROL_BLOCK:case t6.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case t6.MACRO_PDF417_TERMINATOR:n--,l=!0;break;default:if(a%5==0&&a>0){for(let e=0;e<6;++e)o.write(Number(t8(s)>>t8(8*(5-e))));s=0,a=0}}n===t[0]&&u<t6.TEXT_COMPACTION_MODE_LATCH&&(c[a++]=u);for(let e=0;e<a;e++)o.write(c[e]);break;case t6.BYTE_COMPACTION_MODE_LATCH_6:for(;n<t[0]&&!l;){let e=t[n++];if(e<t6.TEXT_COMPACTION_MODE_LATCH)a++,s=900*s+e;else switch(e){case t6.TEXT_COMPACTION_MODE_LATCH:case t6.BYTE_COMPACTION_MODE_LATCH:case t6.NUMERIC_COMPACTION_MODE_LATCH:case t6.BYTE_COMPACTION_MODE_LATCH_6:case t6.BEGIN_MACRO_PDF417_CONTROL_BLOCK:case t6.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case t6.MACRO_PDF417_TERMINATOR:n--,l=!0}if(a%5==0&&a>0){for(let e=0;e<6;++e)o.write(Number(t8(s)>>t8(8*(5-e))));s=0,a=0}}}return i.append(j.decode(o.toByteArray(),r)),n}static numericCompaction(e,t,r){let n=0,i=!1,o=new Int32Array(t6.MAX_NUMERIC_CODEWORDS);for(;t<e[0]&&!i;){let a=e[t++];if(t===e[0]&&(i=!0),a<t6.TEXT_COMPACTION_MODE_LATCH)o[n]=a,n++;else switch(a){case t6.TEXT_COMPACTION_MODE_LATCH:case t6.BYTE_COMPACTION_MODE_LATCH:case t6.BYTE_COMPACTION_MODE_LATCH_6:case t6.BEGIN_MACRO_PDF417_CONTROL_BLOCK:case t6.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case t6.MACRO_PDF417_TERMINATOR:t--,i=!0}(n%t6.MAX_NUMERIC_CODEWORDS==0||a===t6.NUMERIC_COMPACTION_MODE_LATCH||i)&&n>0&&(r.append(t6.decodeBase900toBase10(o,n)),n=0)}return t}static decodeBase900toBase10(e,t){let r=t8(0);for(let n=0;n<t;n++)r+=t6.EXP900[t-n-1]*t8(e[n]);let n=r.toString();if("1"!==n.charAt(0))throw new H;return n.substring(1)}}t6.TEXT_COMPACTION_MODE_LATCH=900,t6.BYTE_COMPACTION_MODE_LATCH=901,t6.NUMERIC_COMPACTION_MODE_LATCH=902,t6.BYTE_COMPACTION_MODE_LATCH_6=924,t6.ECI_USER_DEFINED=925,t6.ECI_GENERAL_PURPOSE=926,t6.ECI_CHARSET=927,t6.BEGIN_MACRO_PDF417_CONTROL_BLOCK=928,t6.BEGIN_MACRO_PDF417_OPTIONAL_FIELD=923,t6.MACRO_PDF417_TERMINATOR=922,t6.MODE_SHIFT_TO_BYTE_COMPACTION_MODE=913,t6.MAX_NUMERIC_CODEWORDS=15,t6.MACRO_PDF417_OPTIONAL_FIELD_FILE_NAME=0,t6.MACRO_PDF417_OPTIONAL_FIELD_SEGMENT_COUNT=1,t6.MACRO_PDF417_OPTIONAL_FIELD_TIME_STAMP=2,t6.MACRO_PDF417_OPTIONAL_FIELD_SENDER=3,t6.MACRO_PDF417_OPTIONAL_FIELD_ADDRESSEE=4,t6.MACRO_PDF417_OPTIONAL_FIELD_FILE_SIZE=5,t6.MACRO_PDF417_OPTIONAL_FIELD_CHECKSUM=6,t6.PL=25,t6.LL=27,t6.AS=27,t6.ML=28,t6.AL=28,t6.PS=29,t6.PAL=29,t6.PUNCT_CHARS=";<>@[\\]_`~!\r ,:\n-.$/\"|*()?{}'",t6.MIXED_CHARS="0123456789&\r ,:#-.$/+%*=^",t6.EXP900=t4()?function(){let e=[];e[0]=t8(1);let t=t8(900);e[1]=t;for(let r=2;r<16;r++)e[r]=e[r-1]*t;return e}():[],t6.NUMBER_OF_SEQUENCE_CODEWORDS=2;class t5{constructor(){}static decode(e,t,r,n,i,o,a){let s,l=new tj(e,t,r,n,i),c=null,u=null;for(let r=!0;;r=!1){if(null!=t&&(c=t5.getRowIndicatorColumn(e,l,t,!0,o,a)),null!=n&&(u=t5.getRowIndicatorColumn(e,l,n,!1,o,a)),null==(s=t5.merge(c,u)))throw X.getNotFoundInstance();let i=s.getBoundingBox();if(r&&null!=i&&(i.getMinY()<l.getMinY()||i.getMaxY()>l.getMaxY()))l=i;else break}s.setBoundingBox(l);let h=s.getBarcodeColumnCount()+1;s.setDetectionResultColumn(0,c),s.setDetectionResultColumn(h,u);let d=null!=c;for(let t=1;t<=h;t++){let r,n=d?t:h-t;if(void 0!==s.getDetectionResultColumn(n))continue;r=0===n||n===h?new tZ(l,0===n):new tY(l),s.setDetectionResultColumn(n,r);let i=-1,c=-1;for(let t=l.getMinY();t<=l.getMaxY();t++){if((i=t5.getStartColumn(s,n,t,d))<0||i>l.getMaxX()){if(-1===c)continue;i=c}let u=t5.detectCodeword(e,l.getMinX(),l.getMaxX(),d,i,t,o,a);null!=u&&(r.setCodeword(t,u),c=i,o=Math.min(o,u.getWidth()),a=Math.max(a,u.getWidth()))}}return t5.createDecoderResult(s)}static merge(e,t){if(null==e&&null==t)return null;let r=t5.getBarcodeMetadata(e,t);return null==r?null:new tQ(r,tj.merge(t5.adjustBoundingBox(e),t5.adjustBoundingBox(t)))}static adjustBoundingBox(e){if(null==e)return null;let t=e.getRowHeights();if(null==t)return null;let r=t5.getMax(t),n=0;for(let e of t)if(n+=r-e,e>0)break;let i=e.getCodewords();for(let e=0;n>0&&null==i[e];e++)n--;let o=0;for(let e=t.length-1;e>=0&&(o+=r-t[e],!(t[e]>0));e--);for(let e=i.length-1;o>0&&null==i[e];e--)o--;return e.getBoundingBox().addMissingRows(n,o,e.isLeft())}static getMax(e){let t=-1;for(let r of e)t=Math.max(t,r);return t}static getBarcodeMetadata(e,t){let r,n;return null==e||null==(r=e.getBarcodeMetadata())?null==t?null:t.getBarcodeMetadata():null==t||null==(n=t.getBarcodeMetadata())?r:r.getColumnCount()!==n.getColumnCount()&&r.getErrorCorrectionLevel()!==n.getErrorCorrectionLevel()&&r.getRowCount()!==n.getRowCount()?null:r}static getRowIndicatorColumn(e,t,r,n,i,o){let a=new tZ(t,n);for(let s=0;s<2;s++){let l=0===s?1:-1,c=Math.trunc(Math.trunc(r.getX()));for(let s=Math.trunc(Math.trunc(r.getY()));s<=t.getMaxY()&&s>=t.getMinY();s+=l){let t=t5.detectCodeword(e,0,e.getWidth(),n,c,s,i,o);null!=t&&(a.setCodeword(s,t),c=n?t.getStartX():t.getEndX())}}return a}static adjustCodewordCount(e,t){let r=t[0][1],n=r.getValue(),i=e.getBarcodeColumnCount()*e.getBarcodeRowCount()-t5.getNumberOfECCodeWords(e.getBarcodeECLevel());if(0===n.length){if(i<1||i>tL.MAX_CODEWORDS_IN_BARCODE)throw X.getNotFoundInstance();r.setValue(i)}else n[0]!==i&&r.setValue(i)}static createDecoderResult(e){let t=t5.createBarcodeMatrix(e);t5.adjustCodewordCount(e,t);let r=[],n=new Int32Array(e.getBarcodeRowCount()*e.getBarcodeColumnCount()),i=[],o=[];for(let a=0;a<e.getBarcodeRowCount();a++)for(let s=0;s<e.getBarcodeColumnCount();s++){let l=t[a][s+1].getValue(),c=a*e.getBarcodeColumnCount()+s;0===l.length?r.push(c):1===l.length?n[c]=l[0]:(o.push(c),i.push(l))}let a=Array(i.length);for(let e=0;e<a.length;e++)a[e]=i[e];return t5.createDecoderResultFromAmbiguousValues(e.getBarcodeECLevel(),n,tL.toIntArray(r),tL.toIntArray(o),a)}static createDecoderResultFromAmbiguousValues(e,t,r,n,i){let o=new Int32Array(n.length),a=100;for(;a-- >0;){for(let e=0;e<o.length;e++)t[n[e]]=i[e][o[e]];try{return t5.decodeCodewords(t,e,r)}catch(e){if(!(e instanceof R))throw e}if(0===o.length)break;for(let e=0;e<o.length;e++)if(o[e]<i[e].length-1){o[e]++;break}else if(o[e]=0,e===o.length-1)throw R.getChecksumInstance()}throw R.getChecksumInstance()}static createBarcodeMatrix(e){let t=Array.from({length:e.getBarcodeRowCount()},()=>Array(e.getBarcodeColumnCount()+2));for(let e=0;e<t.length;e++)for(let r=0;r<t[e].length;r++)t[e][r]=new tX;let r=0;for(let n of e.getDetectionResultColumns()){if(null!=n){for(let e of n.getCodewords())if(null!=e){let n=e.getRowNumber();if(n>=0){if(n>=t.length)continue;t[n][r].setValue(e.getValue())}}}r++}return t}static isValidBarcodeColumn(e,t){return t>=0&&t<=e.getBarcodeColumnCount()+1}static getStartColumn(e,t,r,n){let i=n?1:-1,o=null;if(t5.isValidBarcodeColumn(e,t-i)&&(o=e.getDetectionResultColumn(t-i).getCodeword(r)),null!=o)return n?o.getEndX():o.getStartX();if(null!=(o=e.getDetectionResultColumn(t).getCodewordNearby(r)))return n?o.getStartX():o.getEndX();if(t5.isValidBarcodeColumn(e,t-i)&&(o=e.getDetectionResultColumn(t-i).getCodewordNearby(r)),null!=o)return n?o.getEndX():o.getStartX();let a=0;for(;t5.isValidBarcodeColumn(e,t-i);){for(let r of(t-=i,e.getDetectionResultColumn(t).getCodewords()))if(null!=r)return(n?r.getEndX():r.getStartX())+i*a*(r.getEndX()-r.getStartX());a++}return n?e.getBoundingBox().getMinX():e.getBoundingBox().getMaxX()}static detectCodeword(e,t,r,n,i,o,a,s){let l;i=t5.adjustCodewordStartColumn(e,t,r,n,i,o);let c=t5.getModuleBitCount(e,t,r,n,i,o);if(null==c)return null;let u=eg.sum(c);if(n)l=i+u;else{for(let e=0;e<c.length/2;e++){let t=c[e];c[e]=c[c.length-1-e],c[c.length-1-e]=t}i=(l=i)-u}if(!t5.checkCodewordSkew(u,a,s))return null;let h=tK.getDecodedValue(c),d=tL.getCodeword(h);return -1===d?null:new tq(i,l,t5.getCodewordBucketNumber(h),d)}static getModuleBitCount(e,t,r,n,i,o){let a=i,s=new Int32Array(8),l=0,c=n?1:-1,u=n;for(;(n?a<r:a>=t)&&l<s.length;)e.get(a,o)===u?(s[l]++,a+=c):(l++,u=!u);return l===s.length||a===(n?r:t)&&l===s.length-1?s:null}static getNumberOfECCodeWords(e){return 2<<e}static adjustCodewordStartColumn(e,t,r,n,i,o){let a=i,s=n?-1:1;for(let l=0;l<2;l++){for(;(n?a>=t:a<r)&&n===e.get(a,o);){if(Math.abs(i-a)>t5.CODEWORD_SKEW_SIZE)return i;a+=s}s=-s,n=!n}return a}static checkCodewordSkew(e,t,r){return t-t5.CODEWORD_SKEW_SIZE<=e&&e<=r+t5.CODEWORD_SKEW_SIZE}static decodeCodewords(e,t,r){if(0===e.length)throw H.getFormatInstance();let n=1<<t+1,i=t5.correctErrors(e,r,n);t5.verifyCodewordCount(e,n);let o=t6.decode(e,""+t);return o.setErrorsCorrected(i),o.setErasures(r.length),o}static correctErrors(e,t,r){if(null!=t&&t.length>r/2+t5.MAX_ERRORS||r<0||r>t5.MAX_EC_CODEWORDS)throw R.getChecksumInstance();return t5.errorCorrection.decode(e,r,t)}static verifyCodewordCount(e,t){if(e.length<4)throw H.getFormatInstance();let r=e[0];if(r>e.length)throw H.getFormatInstance();if(0===r)if(t<e.length)e[0]=e.length-t;else throw H.getFormatInstance()}static getBitCountForCodeword(e){let t=new Int32Array(8),r=0,n=t.length-1;for(;!((1&e)!==r&&(r=1&e,--n<0));)t[n]++,e>>=1;return t}static getCodewordBucketNumber(e){return e instanceof Int32Array?this.getCodewordBucketNumber_Int32Array(e):this.getCodewordBucketNumber_number(e)}static getCodewordBucketNumber_number(e){return t5.getCodewordBucketNumber(t5.getBitCountForCodeword(e))}static getCodewordBucketNumber_Int32Array(e){return(e[0]-e[2]+e[4]-e[6]+9)%9}static toString(e){let t=new tW;for(let r=0;r<e.length;r++){t.format("Row %2d: ",r);for(let n=0;n<e[r].length;n++){let i=e[r][n];0===i.getValue().length?t.format(" ",null):t.format("%4d(%2d)",i.getValue()[0],i.getConfidence(i.getValue()[0]))}t.format("%n")}return t.toString()}}t5.CODEWORD_SKEW_SIZE=2,t5.MAX_ERRORS=3,t5.MAX_EC_CODEWORDS=512,t5.errorCorrection=new tV;class t7{decode(e,t=null){let r=t7.decode(e,t,!1);if(null==r||0===r.length||null==r[0])throw X.getNotFoundInstance();return r[0]}decodeMultiple(e,t=null){try{return t7.decode(e,t,!0)}catch(e){if(e instanceof H||e instanceof R)throw X.getNotFoundInstance();throw e}}static decode(e,t,r){let n=[],i=tF.detectMultiple(e,t,r);for(let e of i.getPoints()){let t=t5.decode(i.getBits(),e[4],e[5],e[6],e[7],t7.getMinCodewordWidth(e),t7.getMaxCodewordWidth(e)),r=new er(t.getText(),t.getRawBytes(),void 0,e,en.PDF_417);r.putMetadata(ei.ERROR_CORRECTION_LEVEL,t.getECLevel());let o=t.getOther();null!=o&&r.putMetadata(ei.PDF417_EXTRA_METADATA,o),n.push(r)}return n.map(e=>e)}static getMaxWidth(e,t){return null==e||null==t?0:Math.trunc(Math.abs(e.getX()-t.getX()))}static getMinWidth(e,t){return null==e||null==t?k.MAX_VALUE:Math.trunc(Math.abs(e.getX()-t.getX()))}static getMaxCodewordWidth(e){return Math.floor(Math.max(Math.max(t7.getMaxWidth(e[0],e[4]),t7.getMaxWidth(e[6],e[2])*tL.MODULES_IN_CODEWORD/tL.MODULES_IN_STOP_PATTERN),Math.max(t7.getMaxWidth(e[1],e[5]),t7.getMaxWidth(e[7],e[3])*tL.MODULES_IN_CODEWORD/tL.MODULES_IN_STOP_PATTERN)))}static getMinCodewordWidth(e){return Math.floor(Math.min(Math.min(t7.getMinWidth(e[0],e[4]),t7.getMinWidth(e[6],e[2])*tL.MODULES_IN_CODEWORD/tL.MODULES_IN_STOP_PATTERN),Math.min(t7.getMinWidth(e[1],e[5]),t7.getMinWidth(e[7],e[3])*tL.MODULES_IN_CODEWORD/tL.MODULES_IN_STOP_PATTERN)))}reset(){}}class t9 extends N{}t9.kind="ReaderException";class re{constructor(e,t){this.verbose=!0===e,t&&this.setHints(t)}decode(e,t){return t&&this.setHints(t),this.decodeInternal(e)}decodeWithState(e){return(null===this.readers||void 0===this.readers)&&this.setHints(null),this.decodeInternal(e)}setHints(e){this.hints=e;let t=null!=e&&!0===e.get(U.TRY_HARDER),r=null==e?null:e.get(U.POSSIBLE_FORMATS),n=[];if(null!=r){let i=r.some(e=>e===en.UPC_A||e===en.UPC_E||e===en.EAN_13||e===en.EAN_8||e===en.CODABAR||e===en.CODE_39||e===en.CODE_93||e===en.CODE_128||e===en.ITF||e===en.RSS_14||e===en.RSS_EXPANDED);i&&!t&&n.push(new ta(e,this.verbose)),r.includes(en.QR_CODE)&&n.push(new tx),r.includes(en.DATA_MATRIX)&&n.push(new tm),r.includes(en.AZTEC)&&n.push(new eT),r.includes(en.PDF_417)&&n.push(new t7),i&&t&&n.push(new ta(e,this.verbose))}0===n.length&&(t||n.push(new ta(e,this.verbose)),n.push(new tx),n.push(new tm),n.push(new eT),n.push(new t7),t&&n.push(new ta(e,this.verbose))),this.readers=n}reset(){if(null!==this.readers)for(let e of this.readers)e.reset()}decodeInternal(e){if(null===this.readers)throw new t9("No readers where selected, nothing can be read.");for(let t of this.readers)try{return t.decode(e,this.hints)}catch(e){if(e instanceof t9)continue}throw new X("No MultiFormat Readers were able to detect the code.")}}(f=_||(_={}))[f.ERROR_CORRECTION=0]="ERROR_CORRECTION",f[f.CHARACTER_SET=1]="CHARACTER_SET",f[f.DATA_MATRIX_SHAPE=2]="DATA_MATRIX_SHAPE",f[f.MIN_SIZE=3]="MIN_SIZE",f[f.MAX_SIZE=4]="MAX_SIZE",f[f.MARGIN=5]="MARGIN",f[f.PDF417_COMPACT=6]="PDF417_COMPACT",f[f.PDF417_COMPACTION=7]="PDF417_COMPACTION",f[f.PDF417_DIMENSIONS=8]="PDF417_DIMENSIONS",f[f.AZTEC_LAYERS=9]="AZTEC_LAYERS",f[f.QR_VERSION=10]="QR_VERSION";var rt=_;class rr{constructor(e){this.field=e,this.cachedGenerators=[],this.cachedGenerators.push(new es(e,Int32Array.from([1])))}buildGenerator(e){let t=this.cachedGenerators;if(e>=t.length){let r=t[t.length-1],n=this.field;for(let i=t.length;i<=e;i++){let e=r.multiply(new es(n,Int32Array.from([1,n.exp(i-1+n.getGeneratorBase())])));t.push(e),r=e}}return t[e]}encode(e,t){if(0===t)throw new D("No error correction bytes");let r=e.length-t;if(r<=0)throw new D("No data bytes provided");let n=this.buildGenerator(t),i=new Int32Array(r);P.arraycopy(e,0,i,0,r);let o=new es(this.field,i),a=(o=o.multiplyByMonomial(t,1)).divide(n)[1].getCoefficients(),s=t-a.length;for(let t=0;t<s;t++)e[r+t]=0;P.arraycopy(a,0,e,r+s,a.length)}}class rn{constructor(){}static applyMaskPenaltyRule1(e){return rn.applyMaskPenaltyRule1Internal(e,!0)+rn.applyMaskPenaltyRule1Internal(e,!1)}static applyMaskPenaltyRule2(e){let t=0,r=e.getArray(),n=e.getWidth(),i=e.getHeight();for(let e=0;e<i-1;e++){let i=r[e];for(let o=0;o<n-1;o++){let n=i[o];n===i[o+1]&&n===r[e+1][o]&&n===r[e+1][o+1]&&t++}}return rn.N2*t}static applyMaskPenaltyRule3(e){let t=0,r=e.getArray(),n=e.getWidth(),i=e.getHeight();for(let e=0;e<i;e++)for(let o=0;o<n;o++){let a=r[e];o+6<n&&1===a[o]&&0===a[o+1]&&1===a[o+2]&&1===a[o+3]&&1===a[o+4]&&0===a[o+5]&&1===a[o+6]&&(rn.isWhiteHorizontal(a,o-4,o)||rn.isWhiteHorizontal(a,o+7,o+11))&&t++,e+6<i&&1===r[e][o]&&0===r[e+1][o]&&1===r[e+2][o]&&1===r[e+3][o]&&1===r[e+4][o]&&0===r[e+5][o]&&1===r[e+6][o]&&(rn.isWhiteVertical(r,o,e-4,e)||rn.isWhiteVertical(r,o,e+7,e+11))&&t++}return t*rn.N3}static isWhiteHorizontal(e,t,r){t=Math.max(t,0),r=Math.min(r,e.length);for(let n=t;n<r;n++)if(1===e[n])return!1;return!0}static isWhiteVertical(e,t,r,n){r=Math.max(r,0),n=Math.min(n,e.length);for(let i=r;i<n;i++)if(1===e[i][t])return!1;return!0}static applyMaskPenaltyRule4(e){let t=0,r=e.getArray(),n=e.getWidth(),i=e.getHeight();for(let e=0;e<i;e++){let i=r[e];for(let e=0;e<n;e++)1===i[e]&&t++}let o=e.getHeight()*e.getWidth();return Math.floor(10*Math.abs(2*t-o)/o)*rn.N4}static getDataMaskBit(e,t,r){let n,i;switch(e){case 0:n=r+t&1;break;case 1:n=1&r;break;case 2:n=t%3;break;case 3:n=(r+t)%3;break;case 4:n=Math.floor(r/2)+Math.floor(t/3)&1;break;case 5:n=(1&(i=r*t))+i%3;break;case 6:n=(1&(i=r*t))+i%3&1;break;case 7:n=(i=r*t)%3+(r+t&1)&1;break;default:throw new D("Invalid mask pattern: "+e)}return 0===n}static applyMaskPenaltyRule1Internal(e,t){let r=0,n=t?e.getHeight():e.getWidth(),i=t?e.getWidth():e.getHeight(),o=e.getArray();for(let e=0;e<n;e++){let n=0,a=-1;for(let s=0;s<i;s++){let i=t?o[e][s]:o[s][e];i===a?n++:(n>=5&&(r+=rn.N1+(n-5)),n=1,a=i)}n>=5&&(r+=rn.N1+(n-5))}return r}}rn.N1=3,rn.N2=3,rn.N3=40,rn.N4=10;class ri{constructor(e,t){this.width=e,this.height=t;let r=Array(t);for(let n=0;n!==t;n++)r[n]=new Uint8Array(e);this.bytes=r}getHeight(){return this.height}getWidth(){return this.width}get(e,t){return this.bytes[t][e]}getArray(){return this.bytes}setNumber(e,t,r){this.bytes[t][e]=r}setBoolean(e,t,r){this.bytes[t][e]=+!!r}clear(e){for(let t of this.bytes)L.fill(t,e)}equals(e){if(!(e instanceof ri)||this.width!==e.width||this.height!==e.height)return!1;for(let t=0,r=this.height;t<r;++t){let r=this.bytes[t],n=e.bytes[t];for(let e=0,t=this.width;e<t;++e)if(r[e]!==n[e])return!1}return!0}toString(){let e=new W;for(let t=0,r=this.height;t<r;++t){let r=this.bytes[t];for(let t=0,n=this.width;t<n;++t)switch(r[t]){case 0:e.append(" 0");break;case 1:e.append(" 1");break;default:e.append(" ")}e.append("\n")}return e.toString()}}class ro{constructor(){this.maskPattern=-1}getMode(){return this.mode}getECLevel(){return this.ecLevel}getVersion(){return this.version}getMaskPattern(){return this.maskPattern}getMatrix(){return this.matrix}toString(){let e=new W;return e.append("<<\n"),e.append(" mode: "),e.append(this.mode?this.mode.toString():"null"),e.append("\n ecLevel: "),e.append(this.ecLevel?this.ecLevel.toString():"null"),e.append("\n version: "),e.append(this.version?this.version.toString():"null"),e.append("\n maskPattern: "),e.append(this.maskPattern.toString()),this.matrix?(e.append("\n matrix:\n"),e.append(this.matrix.toString())):e.append("\n matrix: null\n"),e.append(">>\n"),e.toString()}setMode(e){this.mode=e}setECLevel(e){this.ecLevel=e}setVersion(e){this.version=e}setMaskPattern(e){this.maskPattern=e}setMatrix(e){this.matrix=e}static isValidMaskPattern(e){return e>=0&&e<ro.NUM_MASK_PATTERNS}}ro.NUM_MASK_PATTERNS=8;class ra extends N{}ra.kind="WriterException";class rs{constructor(){}static clearMatrix(e){e.clear(255)}static buildMatrix(e,t,r,n,i){rs.clearMatrix(i),rs.embedBasicPatterns(r,i),rs.embedTypeInfo(t,n,i),rs.maybeEmbedVersionInfo(r,i),rs.embedDataBits(e,n,i)}static embedBasicPatterns(e,t){rs.embedPositionDetectionPatternsAndSeparators(t),rs.embedDarkDotAtLeftBottomCorner(t),rs.maybeEmbedPositionAdjustmentPatterns(e,t),rs.embedTimingPatterns(t)}static embedTypeInfo(e,t,r){let n=new F;rs.makeTypeInfoBits(e,t,n);for(let e=0,t=n.getSize();e<t;++e){let t=n.get(n.getSize()-1-e),i=rs.TYPE_INFO_COORDINATES[e],o=i[0],a=i[1];if(r.setBoolean(o,a,t),e<8){let n=r.getWidth()-e-1;r.setBoolean(n,8,t)}else{let n=r.getHeight()-7+(e-8);r.setBoolean(8,n,t)}}}static maybeEmbedVersionInfo(e,t){if(7>e.getVersionNumber())return;let r=new F;rs.makeVersionInfoBits(e,r);let n=17;for(let e=0;e<6;++e)for(let i=0;i<3;++i){let o=r.get(n);n--,t.setBoolean(e,t.getHeight()-11+i,o),t.setBoolean(t.getHeight()-11+i,e,o)}}static embedDataBits(e,t,r){let n=0,i=-1,o=r.getWidth()-1,a=r.getHeight()-1;for(;o>0;){for(6===o&&(o-=1);a>=0&&a<r.getHeight();){for(let i=0;i<2;++i){let s,l=o-i;rs.isEmpty(r.get(l,a))&&(n<e.getSize()?(s=e.get(n),++n):s=!1,255!==t&&rn.getDataMaskBit(t,l,a)&&(s=!s),r.setBoolean(l,a,s))}a+=i}a+=i=-i,o-=2}if(n!==e.getSize())throw new ra("Not all bits consumed: "+n+"/"+e.getSize())}static findMSBSet(e){return 32-k.numberOfLeadingZeros(e)}static calculateBCHCode(e,t){if(0===t)throw new D("0 polynomial");let r=rs.findMSBSet(t);for(e<<=r-1;rs.findMSBSet(e)>=r;)e^=t<<rs.findMSBSet(e)-r;return e}static makeTypeInfoBits(e,t,r){if(!ro.isValidMaskPattern(t))throw new ra("Invalid mask pattern");let n=e.getBits()<<3|t;r.appendBits(n,5);let i=rs.calculateBCHCode(n,rs.TYPE_INFO_POLY);r.appendBits(i,10);let o=new F;if(o.appendBits(rs.TYPE_INFO_MASK_PATTERN,15),r.xor(o),15!==r.getSize())throw new ra("should not happen but we got: "+r.getSize())}static makeVersionInfoBits(e,t){t.appendBits(e.getVersionNumber(),6);let r=rs.calculateBCHCode(e.getVersionNumber(),rs.VERSION_INFO_POLY);if(t.appendBits(r,12),18!==t.getSize())throw new ra("should not happen but we got: "+t.getSize())}static isEmpty(e){return 255===e}static embedTimingPatterns(e){for(let t=8;t<e.getWidth()-8;++t){let r=(t+1)%2;rs.isEmpty(e.get(t,6))&&e.setNumber(t,6,r),rs.isEmpty(e.get(6,t))&&e.setNumber(6,t,r)}}static embedDarkDotAtLeftBottomCorner(e){if(0===e.get(8,e.getHeight()-8))throw new ra;e.setNumber(8,e.getHeight()-8,1)}static embedHorizontalSeparationPattern(e,t,r){for(let n=0;n<8;++n){if(!rs.isEmpty(r.get(e+n,t)))throw new ra;r.setNumber(e+n,t,0)}}static embedVerticalSeparationPattern(e,t,r){for(let n=0;n<7;++n){if(!rs.isEmpty(r.get(e,t+n)))throw new ra;r.setNumber(e,t+n,0)}}static embedPositionAdjustmentPattern(e,t,r){for(let n=0;n<5;++n){let i=rs.POSITION_ADJUSTMENT_PATTERN[n];for(let o=0;o<5;++o)r.setNumber(e+o,t+n,i[o])}}static embedPositionDetectionPattern(e,t,r){for(let n=0;n<7;++n){let i=rs.POSITION_DETECTION_PATTERN[n];for(let o=0;o<7;++o)r.setNumber(e+o,t+n,i[o])}}static embedPositionDetectionPatternsAndSeparators(e){let t=rs.POSITION_DETECTION_PATTERN[0].length;rs.embedPositionDetectionPattern(0,0,e),rs.embedPositionDetectionPattern(e.getWidth()-t,0,e),rs.embedPositionDetectionPattern(0,e.getWidth()-t,e),rs.embedHorizontalSeparationPattern(0,7,e),rs.embedHorizontalSeparationPattern(e.getWidth()-8,7,e),rs.embedHorizontalSeparationPattern(0,e.getWidth()-8,e),rs.embedVerticalSeparationPattern(7,0,e),rs.embedVerticalSeparationPattern(e.getHeight()-7-1,0,e),rs.embedVerticalSeparationPattern(7,e.getHeight()-7,e)}static maybeEmbedPositionAdjustmentPatterns(e,t){if(2>e.getVersionNumber())return;let r=e.getVersionNumber()-1,n=rs.POSITION_ADJUSTMENT_PATTERN_COORDINATE_TABLE[r];for(let e=0,r=n.length;e!==r;e++){let i=n[e];if(i>=0)for(let e=0;e!==r;e++){let r=n[e];r>=0&&rs.isEmpty(t.get(r,i))&&rs.embedPositionAdjustmentPattern(r-2,i-2,t)}}}}rs.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])]),rs.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])]),rs.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])]),rs.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])]),rs.VERSION_INFO_POLY=7973,rs.TYPE_INFO_POLY=1335,rs.TYPE_INFO_MASK_PATTERN=21522;class rl{constructor(e,t){this.dataBytes=e,this.errorCorrectionBytes=t}getDataBytes(){return this.dataBytes}getErrorCorrectionBytes(){return this.errorCorrectionBytes}}class rc{constructor(){}static calculateMaskPenalty(e){return rn.applyMaskPenaltyRule1(e)+rn.applyMaskPenaltyRule2(e)+rn.applyMaskPenaltyRule3(e)+rn.applyMaskPenaltyRule4(e)}static encode(e,t,r=null){let n,i=rc.DEFAULT_BYTE_MODE_ENCODING,o=null!==r&&void 0!==r.get(rt.CHARACTER_SET);o&&(i=r.get(rt.CHARACTER_SET).toString());let a=this.chooseMode(e,i),s=new F;if(a===tb.BYTE&&(o||rc.DEFAULT_BYTE_MODE_ENCODING!==i)){let e=z.getCharacterSetECIByName(i);void 0!==e&&this.appendECI(e,s)}this.appendModeInfo(a,s);let l=new F;if(this.appendBytes(e,a,l,i),null!==r&&void 0!==r.get(rt.QR_VERSION)){let e=Number.parseInt(r.get(rt.QR_VERSION).toString(),10);n=ty.getVersionForNumber(e);let i=this.calculateBitsNeeded(a,s,l,n);if(!this.willFit(i,n,t))throw new ra("Data too big for requested version")}else n=this.recommendVersion(t,a,s,l);let c=new F;c.appendBitArray(s);let u=a===tb.BYTE?l.getSizeInBytes():e.length;this.appendLengthInfo(u,n,a,c),c.appendBitArray(l);let h=n.getECBlocksForLevel(t),d=n.getTotalCodewords()-h.getTotalECCodewords();this.terminateBits(d,c);let f=this.interleaveWithECBytes(c,n.getTotalCodewords(),d,h.getNumBlocks()),g=new ro;g.setECLevel(t),g.setMode(a),g.setVersion(n);let p=n.getDimensionForVersion(),m=new ri(p,p),w=this.chooseMaskPattern(f,t,n,m);return g.setMaskPattern(w),rs.buildMatrix(f,t,n,w,m),g.setMatrix(m),g}static recommendVersion(e,t,r,n){let i=this.calculateBitsNeeded(t,r,n,ty.getVersionForNumber(1)),o=this.chooseVersion(i,e),a=this.calculateBitsNeeded(t,r,n,o);return this.chooseVersion(a,e)}static calculateBitsNeeded(e,t,r,n){return t.getSize()+e.getCharacterCountBits(n)+r.getSize()}static getAlphanumericCode(e){return e<rc.ALPHANUMERIC_TABLE.length?rc.ALPHANUMERIC_TABLE[e]:-1}static chooseMode(e,t=null){if(z.SJIS.getName()===t&&this.isOnlyDoubleByteKanji(e))return tb.KANJI;let r=!1,n=!1;for(let t=0,i=e.length;t<i;++t){let i=e.charAt(t);if(rc.isDigit(i))r=!0;else{if(-1===this.getAlphanumericCode(i.charCodeAt(0)))return tb.BYTE;n=!0}}return n?tb.ALPHANUMERIC:r?tb.NUMERIC:tb.BYTE}static isOnlyDoubleByteKanji(e){let t;try{t=j.encode(e,z.SJIS)}catch(e){return!1}let r=t.length;if(r%2!=0)return!1;for(let e=0;e<r;e+=2){let r=255&t[e];if((r<129||r>159)&&(r<224||r>235))return!1}return!0}static chooseMaskPattern(e,t,r,n){let i=Number.MAX_SAFE_INTEGER,o=-1;for(let a=0;a<ro.NUM_MASK_PATTERNS;a++){rs.buildMatrix(e,t,r,a,n);let s=this.calculateMaskPenalty(n);s<i&&(i=s,o=a)}return o}static chooseVersion(e,t){for(let r=1;r<=40;r++){let n=ty.getVersionForNumber(r);if(rc.willFit(e,n,t))return n}throw new ra("Data too big")}static willFit(e,t,r){let n=t.getTotalCodewords();return n-t.getECBlocksForLevel(r).getTotalECCodewords()>=(e+7)/8}static terminateBits(e,t){let r=8*e;if(t.getSize()>r)throw new ra("data bits cannot fit in the QR Code"+t.getSize()+" > "+r);for(let e=0;e<4&&t.getSize()<r;++e)t.appendBit(!1);let n=7&t.getSize();if(n>0)for(let e=n;e<8;e++)t.appendBit(!1);let i=e-t.getSizeInBytes();for(let e=0;e<i;++e)t.appendBits((1&e)==0?236:17,8);if(t.getSize()!==r)throw new ra("Bits size does not equal capacity")}static getNumDataBytesAndNumECBytesForBlockID(e,t,r,n,i,o){if(n>=r)throw new ra("Block ID too large");let a=e%r,s=r-a,l=Math.floor(e/r),c=Math.floor(t/r),u=c+1,h=l-c,d=l+1-u;if(h!==d)throw new ra("EC bytes mismatch");if(r!==s+a)throw new ra("RS blocks mismatch");if(e!==(c+h)*s+(u+d)*a)throw new ra("Total bytes mismatch");n<s?(i[0]=c,o[0]=h):(i[0]=u,o[0]=d)}static interleaveWithECBytes(e,t,r,n){if(e.getSizeInBytes()!==r)throw new ra("Number of bits and data bytes does not match");let i=0,o=0,a=0,s=[];for(let l=0;l<n;++l){let c=new Int32Array(1),u=new Int32Array(1);rc.getNumDataBytesAndNumECBytesForBlockID(t,r,n,l,c,u);let h=c[0],d=new Uint8Array(h);e.toBytes(8*i,d,0,h);let f=rc.generateECBytes(d,u[0]);s.push(new rl(d,f)),o=Math.max(o,h),a=Math.max(a,f.length),i+=c[0]}if(r!==i)throw new ra("Data bytes does not match offset");let l=new F;for(let e=0;e<o;++e)for(let t of s){let r=t.getDataBytes();e<r.length&&l.appendBits(r[e],8)}for(let e=0;e<a;++e)for(let t of s){let r=t.getErrorCorrectionBytes();e<r.length&&l.appendBits(r[e],8)}if(t!==l.getSizeInBytes())throw new ra("Interleaving error: "+t+" and "+l.getSizeInBytes()+" differ.");return l}static generateECBytes(e,t){let r=e.length,n=new Int32Array(r+t);for(let t=0;t<r;t++)n[t]=255&e[t];new rr(ec.QR_CODE_FIELD_256).encode(n,t);let i=new Uint8Array(t);for(let e=0;e<t;e++)i[e]=n[r+e];return i}static appendModeInfo(e,t){t.appendBits(e.getBits(),4)}static appendLengthInfo(e,t,r,n){let i=r.getCharacterCountBits(t);if(e>=1<<i)throw new ra(e+" is bigger than "+((1<<i)-1));n.appendBits(e,i)}static appendBytes(e,t,r,n){switch(t){case tb.NUMERIC:rc.appendNumericBytes(e,r);break;case tb.ALPHANUMERIC:rc.appendAlphanumericBytes(e,r);break;case tb.BYTE:rc.append8BitBytes(e,r,n);break;case tb.KANJI:rc.appendKanjiBytes(e,r);break;default:throw new ra("Invalid mode: "+t)}}static getDigit(e){return e.charCodeAt(0)-48}static isDigit(e){let t=rc.getDigit(e);return t>=0&&t<=9}static appendNumericBytes(e,t){let r=e.length,n=0;for(;n<r;){let i=rc.getDigit(e.charAt(n));if(n+2<r){let r=rc.getDigit(e.charAt(n+1)),o=rc.getDigit(e.charAt(n+2));t.appendBits(100*i+10*r+o,10),n+=3}else if(n+1<r){let r=rc.getDigit(e.charAt(n+1));t.appendBits(10*i+r,7),n+=2}else t.appendBits(i,4),n++}}static appendAlphanumericBytes(e,t){let r=e.length,n=0;for(;n<r;){let i=rc.getAlphanumericCode(e.charCodeAt(n));if(-1===i)throw new ra;if(n+1<r){let r=rc.getAlphanumericCode(e.charCodeAt(n+1));if(-1===r)throw new ra;t.appendBits(45*i+r,11),n+=2}else t.appendBits(i,6),n++}}static append8BitBytes(e,t,r){let n;try{n=j.encode(e,r)}catch(e){throw new ra(e)}for(let e=0,r=n.length;e!==r;e++){let r=n[e];t.appendBits(r,8)}}static appendKanjiBytes(e,t){let r;try{r=j.encode(e,z.SJIS)}catch(e){throw new ra(e)}let n=r.length;for(let e=0;e<n;e+=2){let n=(255&r[e])<<8&0xffffffff|255&r[e+1],i=-1;if(n>=33088&&n<=40956?i=n-33088:n>=57408&&n<=60351&&(i=n-49472),-1===i)throw new ra("Invalid byte sequence");let o=(i>>8)*192+(255&i);t.appendBits(o,13)}}static appendECI(e,t){t.appendBits(tb.ECI.getBits(),4),t.appendBits(e.getValue(),8)}}rc.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]),rc.DEFAULT_BYTE_MODE_ENCODING=z.UTF8.getName();class ru{write(e,t,r,n=null){if(0===e.length)throw new D("Found empty contents");if(t<0||r<0)throw new D("Requested dimensions are too small: "+t+"x"+r);let i=tw.L,o=ru.QUIET_ZONE_SIZE;null!==n&&(void 0!==n.get(rt.ERROR_CORRECTION)&&(i=tw.fromString(n.get(rt.ERROR_CORRECTION).toString())),void 0!==n.get(rt.MARGIN)&&(o=Number.parseInt(n.get(rt.MARGIN).toString(),10)));let a=rc.encode(e,i,n);return this.renderResult(a,t,r,o)}writeToDom(e,t,r,n,i=null){"string"==typeof e&&(e=document.querySelector(e));let o=this.write(t,r,n,i);e&&e.appendChild(o)}renderResult(e,t,r,n){let i=e.getMatrix();if(null===i)throw new eh;let o=i.getWidth(),a=i.getHeight(),s=o+2*n,l=a+2*n,c=Math.max(t,s),u=Math.max(r,l),h=Math.min(Math.floor(c/s),Math.floor(u/l)),d=Math.floor((c-o*h)/2),f=Math.floor((u-a*h)/2),g=this.createSVGElement(c,u);for(let e=0,t=f;e<a;e++,t+=h)for(let r=0,n=d;r<o;r++,n+=h)if(1===i.get(r,e)){let e=this.createSvgRectElement(n,t,h,h);g.appendChild(e)}return g}createSVGElement(e,t){let r=document.createElementNS(ru.SVG_NS,"svg");return r.setAttributeNS(null,"height",e.toString()),r.setAttributeNS(null,"width",t.toString()),r}createSvgRectElement(e,t,r,n){let i=document.createElementNS(ru.SVG_NS,"rect");return i.setAttributeNS(null,"x",e.toString()),i.setAttributeNS(null,"y",t.toString()),i.setAttributeNS(null,"height",r.toString()),i.setAttributeNS(null,"width",n.toString()),i.setAttributeNS(null,"fill","#000000"),i}}ru.QUIET_ZONE_SIZE=4,ru.SVG_NS="http://www.w3.org/2000/svg";class rh{encode(e,t,r,n,i){if(0===e.length)throw new D("Found empty contents");if(t!==en.QR_CODE)throw new D("Can only encode QR_CODE, but got "+t);if(r<0||n<0)throw new D(`Requested dimensions are too small: ${r}x${n}`);let o=tw.L,a=rh.QUIET_ZONE_SIZE;null!==i&&(void 0!==i.get(rt.ERROR_CORRECTION)&&(o=tw.fromString(i.get(rt.ERROR_CORRECTION).toString())),void 0!==i.get(rt.MARGIN)&&(a=Number.parseInt(i.get(rt.MARGIN).toString(),10)));let s=rc.encode(e,o,i);return rh.renderResult(s,r,n,a)}static renderResult(e,t,r,n){let i=e.getMatrix();if(null===i)throw new eh;let o=i.getWidth(),a=i.getHeight(),s=o+2*n,l=a+2*n,c=Math.max(t,s),u=Math.max(r,l),h=Math.min(Math.floor(c/s),Math.floor(u/l)),d=Math.floor((c-o*h)/2),f=Math.floor((u-a*h)/2),g=new Y(c,u);for(let e=0,t=f;e<a;e++,t+=h)for(let r=0,n=d;r<o;r++,n+=h)1===i.get(r,e)&&g.setRegion(n,t,h,h);return g}}rh.QUIET_ZONE_SIZE=4;class rd extends q{constructor(e,t,r,n,i,o,a,s){if(super(o,a),this.yuvData=e,this.dataWidth=t,this.dataHeight=r,this.left=n,this.top=i,n+o>t||i+a>r)throw new D("Crop rectangle does not fit within image data.");s&&this.reverseHorizontal(o,a)}getRow(e,t){if(e<0||e>=this.getHeight())throw new D("Requested row is outside the image: "+e);let r=this.getWidth();(null==t||t.length<r)&&(t=new Uint8ClampedArray(r));let n=(e+this.top)*this.dataWidth+this.left;return P.arraycopy(this.yuvData,n,t,0,r),t}getMatrix(){let e=this.getWidth(),t=this.getHeight();if(e===this.dataWidth&&t===this.dataHeight)return this.yuvData;let r=e*t,n=new Uint8ClampedArray(r),i=this.top*this.dataWidth+this.left;if(e===this.dataWidth)return P.arraycopy(this.yuvData,i,n,0,r),n;for(let r=0;r<t;r++){let t=r*e;P.arraycopy(this.yuvData,i,n,t,e),i+=this.dataWidth}return n}isCropSupported(){return!0}crop(e,t,r,n){return new rd(this.yuvData,this.dataWidth,this.dataHeight,this.left+e,this.top+t,r,n,!1)}renderThumbnail(){let e=this.getWidth()/rd.THUMBNAIL_SCALE_FACTOR,t=this.getHeight()/rd.THUMBNAIL_SCALE_FACTOR,r=new Int32Array(e*t),n=this.yuvData,i=this.top*this.dataWidth+this.left;for(let o=0;o<t;o++){let t=o*e;for(let o=0;o<e;o++){let e=255&n[i+o*rd.THUMBNAIL_SCALE_FACTOR];r[t+o]=0xff000000|65793*e}i+=this.dataWidth*rd.THUMBNAIL_SCALE_FACTOR}return r}getThumbnailWidth(){return this.getWidth()/rd.THUMBNAIL_SCALE_FACTOR}getThumbnailHeight(){return this.getHeight()/rd.THUMBNAIL_SCALE_FACTOR}reverseHorizontal(e,t){let r=this.yuvData;for(let n=0,i=this.top*this.dataWidth+this.left;n<t;n++,i+=this.dataWidth){let t=i+e/2;for(let n=i,o=i+e-1;n<t;n++,o--){let e=r[n];r[n]=r[o],r[o]=e}}}invert(){return new K(this)}}rd.THUMBNAIL_SCALE_FACTOR=2;class rf extends q{constructor(e,t,r,n,i,o,a){if(super(t,r),this.dataWidth=n,this.dataHeight=i,this.left=o,this.top=a,4===e.BYTES_PER_ELEMENT){let n=t*r,i=new Uint8ClampedArray(n);for(let t=0;t<n;t++){let r=e[t],n=r>>16&255,o=r>>7&510,a=255&r;i[t]=(n+o+a)/4&255}this.luminances=i}else this.luminances=e;if(void 0===n&&(this.dataWidth=t),void 0===i&&(this.dataHeight=r),void 0===o&&(this.left=0),void 0===a&&(this.top=0),this.left+t>this.dataWidth||this.top+r>this.dataHeight)throw new D("Crop rectangle does not fit within image data.")}getRow(e,t){if(e<0||e>=this.getHeight())throw new D("Requested row is outside the image: "+e);let r=this.getWidth();(null==t||t.length<r)&&(t=new Uint8ClampedArray(r));let n=(e+this.top)*this.dataWidth+this.left;return P.arraycopy(this.luminances,n,t,0,r),t}getMatrix(){let e=this.getWidth(),t=this.getHeight();if(e===this.dataWidth&&t===this.dataHeight)return this.luminances;let r=e*t,n=new Uint8ClampedArray(r),i=this.top*this.dataWidth+this.left;if(e===this.dataWidth)return P.arraycopy(this.luminances,i,n,0,r),n;for(let r=0;r<t;r++){let t=r*e;P.arraycopy(this.luminances,i,n,t,e),i+=this.dataWidth}return n}isCropSupported(){return!0}crop(e,t,r,n){return new rf(this.luminances,r,n,this.dataWidth,this.dataHeight,this.left+e,this.top+t)}invert(){return new K(this)}}class rg extends z{static forName(e){return this.getCharacterSetECIByName(e)}}class rp{}rp.ISO_8859_1=z.ISO8859_1;class rm{isCompact(){return this.compact}setCompact(e){this.compact=e}getSize(){return this.size}setSize(e){this.size=e}getLayers(){return this.layers}setLayers(e){this.layers=e}getCodeWords(){return this.codeWords}setCodeWords(e){this.codeWords=e}getMatrix(){return this.matrix}setMatrix(e){this.matrix=e}}class rw{static singletonList(e){return[e]}static min(e,t){return e.sort(t)[0]}}class rC{constructor(e){this.previous=e}getPrevious(){return this.previous}}class rE extends rC{constructor(e,t,r){super(e),this.value=t,this.bitCount=r}appendTo(e,t){e.appendBits(this.value,this.bitCount)}add(e,t){return new rE(this,e,t)}addBinaryShift(e,t){return console.warn("addBinaryShift on SimpleToken, this simply returns a copy of this token"),new rE(this,e,t)}toString(){let e=this.value&(1<<this.bitCount)-1;return e|=1<<this.bitCount,"<"+k.toBinaryString(e|1<<this.bitCount).substring(1)+">"}}class rA extends rE{constructor(e,t,r){super(e,0,0),this.binaryShiftStart=t,this.binaryShiftByteCount=r}appendTo(e,t){for(let r=0;r<this.binaryShiftByteCount;r++)(0===r||31===r&&this.binaryShiftByteCount<=62)&&(e.appendBits(31,5),this.binaryShiftByteCount>62?e.appendBits(this.binaryShiftByteCount-31,16):0===r?e.appendBits(Math.min(this.binaryShiftByteCount,31),5):e.appendBits(this.binaryShiftByteCount-31,5)),e.appendBits(t[this.binaryShiftStart+r],8)}addBinaryShift(e,t){return new rA(this,e,t)}toString(){return"<"+this.binaryShiftStart+"::"+(this.binaryShiftStart+this.binaryShiftByteCount-1)+">"}}function ry(e,t,r){return new rE(e,t,r)}let rI=["UPPER","LOWER","DIGIT","MIXED","PUNCT"],rS=new rE(null,0,0),r_=[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])],rb=function(e){for(let t of e)L.fill(t,-1);return e[0][4]=0,e[1][4]=0,e[1][0]=28,e[3][4]=0,e[2][4]=0,e[2][0]=15,e}(L.createInt32Array(6,6));class rT{constructor(e,t,r,n){this.token=e,this.mode=t,this.binaryShiftByteCount=r,this.bitCount=n}getMode(){return this.mode}getToken(){return this.token}getBinaryShiftByteCount(){return this.binaryShiftByteCount}getBitCount(){return this.bitCount}latchAndAppend(e,t){let r=this.bitCount,n=this.token;if(e!==this.mode){let t=r_[this.mode][e];n=ry(n,65535&t,t>>16),r+=t>>16}let i=2===e?4:5;return new rT(n=ry(n,t,i),e,0,r+i)}shiftAndAppend(e,t){let r=this.token,n=2===this.mode?4:5;return r=ry(r,rb[this.mode][e],n),new rT(r=ry(r,t,5),this.mode,0,this.bitCount+n+5)}addBinaryShiftChar(e){let t=this.token,r=this.mode,n=this.bitCount;if(4===this.mode||2===this.mode){let e=r_[r][0];t=ry(t,65535&e,e>>16),n+=e>>16,r=0}let i=0===this.binaryShiftByteCount||31===this.binaryShiftByteCount?18:62===this.binaryShiftByteCount?9:8,o=new rT(t,r,this.binaryShiftByteCount+1,n+i);return 2078===o.binaryShiftByteCount&&(o=o.endBinaryShift(e+1)),o}endBinaryShift(e){if(0===this.binaryShiftByteCount)return this;let t=this.token;return new rT(t=new rA(t,e-this.binaryShiftByteCount,this.binaryShiftByteCount),this.mode,0,this.bitCount)}isBetterThanOrEqualTo(e){let t=this.bitCount+(r_[this.mode][e.mode]>>16);return this.binaryShiftByteCount<e.binaryShiftByteCount?t+=rT.calculateBinaryShiftCost(e)-rT.calculateBinaryShiftCost(this):this.binaryShiftByteCount>e.binaryShiftByteCount&&e.binaryShiftByteCount>0&&(t+=10),t<=e.bitCount}toBitArray(e){let t=[];for(let r=this.endBinaryShift(e.length).token;null!==r;r=r.getPrevious())t.unshift(r);let r=new F;for(let n of t)n.appendTo(r,e);return r}toString(){return G.format("%s bits=%d bytes=%d",rI[this.mode],this.bitCount,this.binaryShiftByteCount)}static calculateBinaryShiftCost(e){return e.binaryShiftByteCount>62?21:e.binaryShiftByteCount>31?20:10*(e.binaryShiftByteCount>0)}}rT.INITIAL_STATE=new rT(rS,0,0,0);let rN=function(e){let t=G.getCharCode(" "),r=G.getCharCode("."),n=G.getCharCode(",");e[0][t]=1;let i=G.getCharCode("Z"),o=G.getCharCode("A");for(let t=o;t<=i;t++)e[0][t]=t-o+2;e[1][t]=1;let a=G.getCharCode("z"),s=G.getCharCode("a");for(let t=s;t<=a;t++)e[1][t]=t-s+2;e[2][t]=1;let l=G.getCharCode("9"),c=G.getCharCode("0");for(let t=c;t<=l;t++)e[2][t]=t-c+2;e[2][n]=12,e[2][r]=13;let u=["\0"," ","\x01","\x02","\x03","\x04","\x05","\x06","\x07","\b"," ","\n","\v","\f","\r","\x1b","\x1c","\x1d","\x1e","\x1f","@","\\","^","_","`","|","~",""];for(let t=0;t<u.length;t++)e[3][G.getCharCode(u[t])]=t;let h=["\0","\r","\0","\0","\0","\0","!","'","#","$","%","&","'","(",")","*","+",",","-",".","/",":",";","<","=",">","?","[","]","{","}"];for(let t=0;t<h.length;t++)G.getCharCode(h[t])>0&&(e[4][G.getCharCode(h[t])]=t);return e}(L.createInt32Array(5,256));class rM{constructor(e){this.text=e}encode(){let e=G.getCharCode(" "),t=G.getCharCode("\n"),r=rw.singletonList(rT.INITIAL_STATE);for(let n=0;n<this.text.length;n++){let i,o=n+1<this.text.length?this.text[n+1]:0;switch(this.text[n]){case G.getCharCode("\r"):i=2*(o===t);break;case G.getCharCode("."):i=3*(o===e);break;case G.getCharCode(","):i=4*(o===e);break;case G.getCharCode(":"):i=5*(o===e);break;default:i=0}i>0?(r=rM.updateStateListForPair(r,n,i),n++):r=this.updateStateListForChar(r,n)}return rw.min(r,(e,t)=>e.getBitCount()-t.getBitCount()).toBitArray(this.text)}updateStateListForChar(e,t){let r=[];for(let n of e)this.updateStateForChar(n,t,r);return rM.simplifyStates(r)}updateStateForChar(e,t,r){let n=255&this.text[t],i=rN[e.getMode()][n]>0,o=null;for(let a=0;a<=4;a++){let s=rN[a][n];if(s>0){if(null==o&&(o=e.endBinaryShift(t)),!i||a===e.getMode()||2===a){let e=o.latchAndAppend(a,s);r.push(e)}if(!i&&rb[e.getMode()][a]>=0){let e=o.shiftAndAppend(a,s);r.push(e)}}}if(e.getBinaryShiftByteCount()>0||0===rN[e.getMode()][n]){let n=e.addBinaryShiftChar(t);r.push(n)}}static updateStateListForPair(e,t,r){let n=[];for(let i of e)this.updateStateForPair(i,t,r,n);return this.simplifyStates(n)}static updateStateForPair(e,t,r,n){let i=e.endBinaryShift(t);if(n.push(i.latchAndAppend(4,r)),4!==e.getMode()&&n.push(i.shiftAndAppend(4,r)),3===r||4===r){let e=i.latchAndAppend(2,16-r).latchAndAppend(2,1);n.push(e)}if(e.getBinaryShiftByteCount()>0){let r=e.addBinaryShiftChar(t).addBinaryShiftChar(t+1);n.push(r)}}static simplifyStates(e){let t=[];for(let r of e){let e=!0;for(let n of t){if(n.isBetterThanOrEqualTo(r)){e=!1;break}r.isBetterThanOrEqualTo(n)&&(t=t.filter(e=>e!==n))}e&&t.push(r)}return t}}class rD{constructor(){}static encodeBytes(e){return rD.encode(e,rD.DEFAULT_EC_PERCENT,rD.DEFAULT_AZTEC_LAYERS)}static encode(e,t,r){let n,i,o,a,s,l,c=new rM(e).encode(),u=k.truncDivision(c.getSize()*t,100)+11,h=c.getSize()+u;if(r!==rD.DEFAULT_AZTEC_LAYERS){if(n=r<0,(i=Math.abs(r))>(n?rD.MAX_NB_BITS_COMPACT:rD.MAX_NB_BITS))throw new D(G.format("Illegal value %s for layers",r));let e=(o=rD.totalBitsInLayer(i,n))-o%(a=rD.WORD_SIZE[i]);if((s=rD.stuffBits(c,a)).getSize()+u>e||n&&s.getSize()>64*a)throw new D("Data to large for user specified layer")}else{a=0,s=null;for(let e=0;;e++){if(e>rD.MAX_NB_BITS)throw new D("Data too large for an Aztec code");if(i=(n=e<=3)?e+1:e,h>(o=rD.totalBitsInLayer(i,n)))continue;(null==s||a!==rD.WORD_SIZE[i])&&(a=rD.WORD_SIZE[i],s=rD.stuffBits(c,a));let t=o-o%a;if(!(n&&s.getSize()>64*a)&&s.getSize()+u<=t)break}}let d=rD.generateCheckWords(s,o,a),f=s.getSize()/a,g=rD.generateModeMessage(n,i,f),p=(n?11:14)+4*i,m=new Int32Array(p);if(n){l=p;for(let e=0;e<m.length;e++)m[e]=e}else{l=p+1+2*k.truncDivision(k.truncDivision(p,2)-1,15);let e=k.truncDivision(p,2),t=k.truncDivision(l,2);for(let r=0;r<e;r++){let n=r+k.truncDivision(r,15);m[e-r-1]=t-n-1,m[e+r]=t+n+1}}let w=new Y(l);for(let e=0,t=0;e<i;e++){let r=(i-e)*4+(n?9:12);for(let n=0;n<r;n++){let i=2*n;for(let o=0;o<2;o++)d.get(t+i+o)&&w.set(m[2*e+o],m[2*e+n]),d.get(t+2*r+i+o)&&w.set(m[2*e+n],m[p-1-2*e-o]),d.get(t+4*r+i+o)&&w.set(m[p-1-2*e-o],m[p-1-2*e-n]),d.get(t+6*r+i+o)&&w.set(m[p-1-2*e-n],m[2*e+o])}t+=8*r}if(rD.drawModeMessage(w,n,l,g),n)rD.drawBullsEye(w,k.truncDivision(l,2),5);else{rD.drawBullsEye(w,k.truncDivision(l,2),7);for(let e=0,t=0;e<k.truncDivision(p,2)-1;e+=15,t+=16)for(let e=1&k.truncDivision(l,2);e<l;e+=2)w.set(k.truncDivision(l,2)-t,e),w.set(k.truncDivision(l,2)+t,e),w.set(e,k.truncDivision(l,2)-t),w.set(e,k.truncDivision(l,2)+t)}let C=new rm;return C.setCompact(n),C.setSize(l),C.setLayers(i),C.setCodeWords(f),C.setMatrix(w),C}static drawBullsEye(e,t,r){for(let n=0;n<r;n+=2)for(let r=t-n;r<=t+n;r++)e.set(r,t-n),e.set(r,t+n),e.set(t-n,r),e.set(t+n,r);e.set(t-r,t-r),e.set(t-r+1,t-r),e.set(t-r,t-r+1),e.set(t+r,t-r),e.set(t+r,t-r+1),e.set(t+r,t+r-1)}static generateModeMessage(e,t,r){let n=new F;return e?(n.appendBits(t-1,2),n.appendBits(r-1,6),n=rD.generateCheckWords(n,28,4)):(n.appendBits(t-1,5),n.appendBits(r-1,11),n=rD.generateCheckWords(n,40,4)),n}static drawModeMessage(e,t,r,n){let i=k.truncDivision(r,2);if(t)for(let t=0;t<7;t++){let r=i-3+t;n.get(t)&&e.set(r,i-5),n.get(t+7)&&e.set(i+5,r),n.get(20-t)&&e.set(r,i+5),n.get(27-t)&&e.set(i-5,r)}else for(let t=0;t<10;t++){let r=i-5+t+k.truncDivision(t,5);n.get(t)&&e.set(r,i-7),n.get(t+10)&&e.set(i+7,r),n.get(29-t)&&e.set(r,i+7),n.get(39-t)&&e.set(i-7,r)}}static generateCheckWords(e,t,r){let n=e.getSize()/r,i=new rr(rD.getGF(r)),o=k.truncDivision(t,r),a=rD.bitsToWords(e,r,o);i.encode(a,o-n);let s=t%r,l=new F;for(let e of(l.appendBits(0,s),Array.from(a)))l.appendBits(e,r);return l}static bitsToWords(e,t,r){let n,i,o=new Int32Array(r);for(n=0,i=e.getSize()/t;n<i;n++){let r=0;for(let i=0;i<t;i++)r|=e.get(n*t+i)?1<<t-i-1:0;o[n]=r}return o}static getGF(e){switch(e){case 4:return ec.AZTEC_PARAM;case 6:return ec.AZTEC_DATA_6;case 8:return ec.AZTEC_DATA_8;case 10:return ec.AZTEC_DATA_10;case 12:return ec.AZTEC_DATA_12;default:throw new D("Unsupported word size "+e)}}static stuffBits(e,t){let r=new F,n=e.getSize(),i=(1<<t)-2;for(let o=0;o<n;o+=t){let a=0;for(let r=0;r<t;r++)(o+r>=n||e.get(o+r))&&(a|=1<<t-1-r);(a&i)===i?(r.appendBits(a&i,t),o--):(a&i)==0?(r.appendBits(1|a,t),o--):r.appendBits(a,t)}return r}static totalBitsInLayer(e,t){return((t?88:112)+16*e)*e}}rD.DEFAULT_EC_PERCENT=33,rD.DEFAULT_AZTEC_LAYERS=0,rD.MAX_NB_BITS=32,rD.MAX_NB_BITS_COMPACT=4,rD.WORD_SIZE=Int32Array.from([4,6,6,8,8,8,8,8,8,10,10,10,10,10,10,10,10,10,10,10,10,10,10,12,12,12,12,12,12,12,12,12,12]);class rO{encode(e,t,r,n){return this.encodeWithHints(e,t,r,n,null)}encodeWithHints(e,t,r,n,i){let o=rp.ISO_8859_1,a=rD.DEFAULT_EC_PERCENT,s=rD.DEFAULT_AZTEC_LAYERS;return null!=i&&(i.has(rt.CHARACTER_SET)&&(o=rg.forName(i.get(rt.CHARACTER_SET).toString())),i.has(rt.ERROR_CORRECTION)&&(a=k.parseInt(i.get(rt.ERROR_CORRECTION).toString())),i.has(rt.AZTEC_LAYERS)&&(s=k.parseInt(i.get(rt.AZTEC_LAYERS).toString()))),rO.encodeLayers(e,t,r,n,o,a,s)}static encodeLayers(e,t,r,n,i,o,a){if(t!==en.AZTEC)throw new D("Can only encode AZTEC, but got "+t);let s=rD.encode(G.getBytes(e,i),o,a);return rO.renderResult(s,r,n)}static renderResult(e,t,r){let n=e.getMatrix();if(null==n)throw new eh;let i=n.getWidth(),o=n.getHeight(),a=Math.max(t,i),s=Math.max(r,o),l=Math.min(a/i,s/o),c=(a-i*l)/2,u=(s-o*l)/2,h=new Y(a,s);for(let e=0,t=u;e<o;e++,t+=l)for(let r=0,o=c;r<i;r++,o+=l)n.get(r,e)&&h.setRegion(o,t,l,l);return h}}e.AbstractExpandedDecoder=eJ,e.ArgumentException=M,e.ArithmeticException=el,e.AztecCode=rm,e.AztecCodeReader=eT,e.AztecCodeWriter=rO,e.AztecDecoder=ef,e.AztecDetector=eb,e.AztecDetectorResult=eC,e.AztecEncoder=rD,e.AztecHighLevelEncoder=rM,e.AztecPoint=e_,e.BarcodeFormat=en,e.Binarizer=v,e.BinaryBitmap=O,e.BitArray=F,e.BitMatrix=Y,e.BitSource=td,e.BrowserAztecCodeReader=class extends et{constructor(e=500){super(new eT,e)}},e.BrowserBarcodeReader=class extends et{constructor(e=500,t){super(new ta(t),e,t)}},e.BrowserCodeReader=et,e.BrowserDatamatrixCodeReader=class extends et{constructor(e=500){super(new tm,e)}},e.BrowserMultiFormatReader=class extends et{constructor(e=null,t=500){let r=new re;r.setHints(e),super(r,t)}decodeBitmap(e){return this.reader.decodeWithState(e)}},e.BrowserPDF417Reader=class extends et{constructor(e=500){super(new t7,e)}},e.BrowserQRCodeReader=class extends et{constructor(e=500){super(new tx,e)}},e.BrowserQRCodeSvgWriter=ru,e.CharacterSetECI=z,e.ChecksumException=R,e.Code128Reader=eM,e.Code39Reader=eD,e.DataMatrixDecodedBitStreamParser=tf,e.DataMatrixReader=tm,e.DecodeHintType=U,e.DecoderResult=eo,e.DefaultGridSampler=eI,e.DetectorResult=ew,e.EAN13Reader=eL,e.EncodeHintType=rt,e.Exception=N,e.FormatException=H,e.GenericGF=ec,e.GenericGFPoly=es,e.GlobalHistogramBinarizer=Z,e.GridSampler=eA,e.GridSamplerInstance=eS,e.HTMLCanvasElementLuminanceSource=$,e.HybridBinarizer=Q,e.ITFReader=eO,e.IllegalArgumentException=D,e.IllegalStateException=eh,e.InvertedLuminanceSource=K,e.LuminanceSource=q,e.MathUtils=eg,e.MultiFormatOneDReader=ta,e.MultiFormatReader=re,e.MultiFormatWriter=class{encode(e,t,r,n,i){let o;if(t===en.QR_CODE)o=new rh;else throw new D("No encoder available for format "+t);return o.encode(e,t,r,n,i)}},e.NotFoundException=X,e.OneDReader=eN,e.PDF417DecodedBitStreamParser=t6,e.PDF417DecoderErrorCorrection=tV,e.PDF417Reader=t7,e.PDF417ResultMetadata=t$,e.PerspectiveTransform=ey,e.PlanarYUVLuminanceSource=rd,e.QRCodeByteMatrix=ri,e.QRCodeDataMask=tI,e.QRCodeDecodedBitStreamParser=tT,e.QRCodeDecoderErrorCorrectionLevel=tw,e.QRCodeDecoderFormatInformation=tC,e.QRCodeEncoder=rc,e.QRCodeEncoderQRCode=ro,e.QRCodeMaskUtil=rn,e.QRCodeMatrixUtil=rs,e.QRCodeMode=tb,e.QRCodeReader=tx,e.QRCodeVersion=ty,e.QRCodeWriter=rh,e.RGBLuminanceSource=rf,e.RSS14Reader=to,e.RSSExpandedReader=tn,e.ReaderException=t9,e.ReedSolomonDecoder=ed,e.ReedSolomonEncoder=rr,e.ReedSolomonException=eu,e.Result=er,e.ResultMetadataType=ei,e.ResultPoint=em,e.StringUtils=G,e.UnsupportedOperationException=V,e.VideoInputDevice=J,e.WhiteRectangleDetector=eE,e.WriterException=ra,e.ZXingArrays=L,e.ZXingCharset=rg,e.ZXingInteger=k,e.ZXingStandardCharsets=rp,e.ZXingStringBuilder=W,e.ZXingStringEncoding=j,e.ZXingSystem=P,e.createAbstractExpandedDecoder=te,Object.defineProperty(e,"__esModule",{value:!0})})(t)},195:function(e,t,r){"use strict";var n=r(111);t.createRoot=n.createRoot,t.hydrateRoot=n.hydrateRoot},581:function(e){e.exports=function(e,t){return"undefined"!=typeof __deoptimization_sideEffect__&&__deoptimization_sideEffect__(e,t),t}},278:function(e){"use strict";var t=[];function r(e){for(var r=-1,n=0;n<t.length;n++)if(t[n].identifier===e){r=n;break}return r}function n(e,n){for(var i={},o=[],a=0;a<e.length;a++){var s=e[a],l=n.base?s[0]+n.base:s[0],c=i[l]||0,u="".concat(l," ").concat(c);i[l]=c+1;var h=r(u),d={css:s[1],media:s[2],sourceMap:s[3],supports:s[4],layer:s[5]};if(-1!==h)t[h].references++,t[h].updater(d);else{var f=function(e,t){var r=t.domAPI(t);return r.update(e),function(t){t?(t.css!==e.css||t.media!==e.media||t.sourceMap!==e.sourceMap||t.supports!==e.supports||t.layer!==e.layer)&&r.update(e=t):r.remove()}}(d,n);n.byIndex=a,t.splice(a,0,{identifier:u,updater:f,references:1})}o.push(u)}return o}e.exports=function(e,i){var o=n(e=e||[],i=i||{});return function(e){e=e||[];for(var a=0;a<o.length;a++){var s=r(o[a]);t[s].references--}for(var l=n(e,i),c=0;c<o.length;c++){var u=r(o[c]);0===t[u].references&&(t[u].updater(),t.splice(u,1))}o=l}}},547:function(e){"use strict";var t={};e.exports=function(e,r){var n=function(e){if(void 0===t[e]){var r=document.querySelector(e);if(window.HTMLIFrameElement&&r instanceof window.HTMLIFrameElement)try{r=r.contentDocument.head}catch(e){r=null}t[e]=r}return t[e]}(e);if(!n)throw Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");n.appendChild(r)}},593:function(e){"use strict";e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},604:function(e,t,r){"use strict";e.exports=function(e){var t=r.nc;t&&e.setAttribute("nonce",t)}},391:function(e){"use strict";e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(r){var n,i,o;n="",r.supports&&(n+="@supports (".concat(r.supports,") {")),r.media&&(n+="@media ".concat(r.media," {")),(i=void 0!==r.layer)&&(n+="@layer".concat(r.layer.length>0?" ".concat(r.layer):""," {")),n+=r.css,i&&(n+="}"),r.media&&(n+="}"),r.supports&&(n+="}"),(o=r.sourceMap)&&"undefined"!=typeof btoa&&(n+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(o))))," */")),e.styleTagTransform(n,t,e.options)},remove:function(){!function(e){if(null!==e.parentNode)e.parentNode.removeChild(e)}(t)}}}},784:function(e){"use strict";e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},482:function(e){"use strict";e.exports=n},964:function(e){"use strict";e.exports=s},505:function(e){"use strict";e.exports=u},772:function(e){"use strict";e.exports=c},667:function(e){"use strict";e.exports=l},58:function(e){"use strict";e.exports=t},721:function(e){"use strict";e.exports=i},202:function(e){"use strict";e.exports=h},156:function(e){"use strict";e.exports=a},111:function(e){"use strict";e.exports=o},238:function(t){"use strict";t.exports=e},128:function(e){"use strict";e.exports=r},527:function(e,t){var r;!function(){"use strict";var n={}.hasOwnProperty;function i(){for(var e="",t=0;t<arguments.length;t++){var r=arguments[t];r&&(e=o(e,function(e){if("string"==typeof e||"number"==typeof e)return e;if("object"!=typeof e)return"";if(Array.isArray(e))return i.apply(null,e);if(e.toString!==Object.prototype.toString&&!e.toString.toString().includes("[native code]"))return e.toString();var t="";for(var r in e)n.call(e,r)&&e[r]&&(t=o(t,r));return t}(r)))}return e}function o(e,t){return t?e?e+" "+t:e+t:e}e.exports?(i.default=i,e.exports=i):void 0===(r=(function(){return i}).apply(t,[]))||(e.exports=r)}()}},E={};function A(e){var t=E[e];if(void 0!==t)return t.exports;var r=E[e]={id:e,exports:{}};return C[e].call(r.exports,r,r.exports,A),r.exports}A.m=C,A.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return A.d(t,{a:t}),t},A.d=function(e,t){for(var r in t)A.o(t,r)&&!A.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},A.f={},A.e=function(e){return Promise.all(Object.keys(A.f).reduce(function(t,r){return A.f[r](e,t),t},[]))},A.u=function(e){return"403f3c00a8759a8e.js"},A.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),A.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},d={},f="@nocobase/plugin-block-workbench:",A.l=function(e,t,r,n){if(d[e])return void d[e].push(t);if(void 0!==r)for(var i,o,a=document.getElementsByTagName("script"),s=0;s<a.length;s++){var l=a[s];if(l.getAttribute("src")==e||l.getAttribute("data-webpack")==f+r){i=l;break}}i||(o=!0,(i=document.createElement("script")).charset="utf-8",i.timeout=120,A.nc&&i.setAttribute("nonce",A.nc),i.setAttribute("data-webpack",f+r),i.src=e),d[e]=[t];var c=function(t,r){i.onerror=i.onload=null,clearTimeout(u);var n=d[e];if(delete d[e],i.parentNode&&i.parentNode.removeChild(i),n&&n.forEach(function(e){return e(r)}),t)return t(r)},u=setTimeout(c.bind(null,void 0,{type:"timeout",target:i}),12e4);i.onerror=c.bind(null,i.onerror),i.onload=c.bind(null,i.onload),o&&document.head.appendChild(i)},A.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},A.nc=void 0,(g=window.__nocobase_public_path__||"/").endsWith("/")||(g+="/"),A.p=g+"static/plugins/@nocobase/plugin-block-workbench/dist/client/",p={909:0},A.f.j=function(e,t){var r=A.o(p,e)?p[e]:void 0;if(0!==r)if(r)t.push(r[2]);else{var n=new Promise(function(t,n){r=p[e]=[t,n]});t.push(r[2]=n);var i=A.p+A.u(e),o=Error();A.l(i,function(t){if(A.o(p,e)&&(0!==(r=p[e])&&(p[e]=void 0),r)){var n=t&&("load"===t.type?"missing":t.type),i=t&&t.target&&t.target.src;o.message="Loading chunk "+e+" failed.\n("+n+": "+i+")",o.name="ChunkLoadError",o.type=n,o.request=i,r[1](o)}},"chunk-"+e,e)}},m=function(e,t){var r,n,i=t[0],o=t[1],a=t[2],s=0;if(i.some(function(e){return 0!==p[e]})){for(r in o)A.o(o,r)&&(A.m[r]=o[r]);a&&a(A)}for(e&&e(t);s<i.length;s++)n=i[s],A.o(p,n)&&p[n]&&p[n][0](),p[n]=0},(w=self.webpackChunk_nocobase_plugin_block_workbench=self.webpackChunk_nocobase_plugin_block_workbench||[]).forEach(m.bind(null,0)),w.push=m.bind(null,w.push.bind(w));var y={};return!function(){"use strict";A.r(y),A.d(y,{PluginBlockWorkbenchClient:function(){return tA},default:function(){return ty}});var e,t,r,n,i,o,a,s,l={};A.r(l),A.d(l,{ActionPanelGroupActionModel:function(){return th},ActionPanelScanActionModel:function(){return ts}});var c=A(772),u=A(505),h=A(964),d=A(721),f=A(278),g=A.n(f),p=A(391),m=A.n(p),w=A(547),C=A.n(w),E=A(604),I=A.n(E),S=A(593),_=A.n(S),b=A(784),T=A.n(b),N=A(46),M={};M.styleTagTransform=T(),M.setAttributes=I(),M.insert=C().bind(null,"head"),M.domAPI=m(),M.insertStyleElement=_(),g()(N.Z,M),N.Z&&N.Z.locals&&N.Z.locals,"undefined"!=typeof window&&"undefined"!=typeof document&&window.document&&window.document.createElement&&document.addEventListener("touchstart",()=>{},!0);var D=A(916),O={};function R(e,t){for(let r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);return e}function v(...e){let t={};return e.forEach(e=>{e&&Object.keys(e).forEach(r=>{void 0!==e[r]&&(t[r]=e[r])})}),t}O.styleTagTransform=T(),O.setAttributes=I(),O.insert=C().bind(null,"head"),O.domAPI=m(),O.insertStyleElement=_(),g()(D.Z,O),D.Z&&D.Z.locals&&D.Z.locals;var P=A(156),B=A.n(P),x=A(527),L=A.n(x);function k(e,t){let r=Object.assign({},t.props);for(let n in e.className&&(r.className=L()(t.props.className,e.className)),e.style&&(r.style=Object.assign(Object.assign({},r.style),e.style)),void 0!==e.tabIndex&&(r.tabIndex=e.tabIndex),e)e.hasOwnProperty(n)&&(n.startsWith("data-")||n.startsWith("aria-"))&&(r[n]=e[n]);return B().cloneElement(t,r)}function F(e){return"number"==typeof e?`${e}px`:e}let U="adm-grid";var H=R(e=>{let t={"--columns":e.columns.toString()},{gap:r}=e;return void 0!==r&&(Array.isArray(r)?(t["--gap-horizontal"]=F(r[0]),t["--gap-vertical"]=F(r[1])):t["--gap"]=F(r)),k(e,B().createElement("div",{className:U,style:t},e.children))},{Item:e=>{let t=v({span:1},e),r={"--item-span":t.span};return k(t,B().createElement("div",{className:`${U}-item`,style:r,onClick:t.onClick},t.children))}}),z=A(59),V={};V.styleTagTransform=T(),V.setAttributes=I(),V.insert=C().bind(null,"head"),V.domAPI=m(),V.insertStyleElement=_(),g()(z.Z,V),z.Z&&z.Z.locals&&z.Z.locals;let j="adm-list",G={mode:"default"},W=(0,P.forwardRef)((e,t)=>{let r=v(G,e),n=(0,P.useRef)(null);return(0,P.useImperativeHandle)(t,()=>({get nativeElement(){return n.current}})),k(r,B().createElement("div",{className:L()(j,`${j}-${r.mode}`),ref:n},r.header&&B().createElement("div",{className:`${j}-header`},r.header),B().createElement("div",{className:`${j}-body`},B().createElement("div",{className:`${j}-body-inner`},r.children))))});var Y=function(e){return P.createElement("svg",Object.assign({width:"1em",height:"1em",viewBox:"0 0 48 48",xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink"},e,{style:Object.assign({verticalAlign:"-0.125em"},e.style),className:["antd-mobile-icon",e.className].filter(Boolean).join(" ")}),P.createElement("g",{id:"RightOutline-RightOutline",stroke:"none",strokeWidth:1,fill:"none",fillRule:"evenodd"},P.createElement("g",{id:"RightOutline-RightOutlined"},P.createElement("rect",{id:"RightOutline-矩形",fill:"#FFFFFF",opacity:0,x:0,y:0,width:48,height:48}),P.createElement("path",{d:"M17.3947957,5.11219264 L35.5767382,22.6612572 L35.5767382,22.6612572 C36.1304785,23.2125856 36.1630514,24.0863155 35.6744571,24.6755735 L35.5767382,24.7825775 L17.3956061,42.8834676 C17.320643,42.9580998 17.2191697,43 17.1133896,43 L13.9866673,43 C13.7657534,43 13.5866673,42.8209139 13.5866673,42.6 C13.5866673,42.4936115 13.6290496,42.391606 13.7044413,42.316542 L32.3201933,23.7816937 L32.3201933,23.7816937 L13.7237117,5.6866816 C13.5653818,5.53262122 13.5619207,5.27937888 13.7159811,5.121049 C13.7912854,5.04365775 13.8946805,5 14.0026627,5 L17.1170064,5 C17.2206403,5 17.3202292,5.04022164 17.3947957,5.11219264 Z",id:"RightOutline-right",fill:"currentColor",fillRule:"nonzero"}))))};function X(e){return null!=e&&!1!==e}let Z="${label}不是一个有效的${type}",Q={locale:{locale:"zh-CH",common:{confirm:"确定",cancel:"取消",loading:"加载中",close:"关闭"},Calendar:{title:"日期选择",confirm:"确认",start:"开始",end:"结束",today:"今日",markItems:["一","二","三","四","五","六","日"],yearAndMonth:"${year}年${month}月"},Cascader:{placeholder:"请选择"},Dialog:{ok:"我知道了"},DatePicker:{tillNow:"至今"},ErrorBlock:{default:{title:"页面遇到一些小问题",description:"待会来试试"},busy:{title:"前方拥堵",description:"刷新试试"},disconnected:{title:"网络有点忙",description:"动动手指帮忙修复"},empty:{title:"没有找到你需要的东西",description:"找找其他的吧"}},Form:{required:"必填",optional:"选填",defaultValidateMessages:{default:"字段验证错误${label}",required:"请输入${label}",enum:"${label}必须是其中一个[${enum}]",whitespace:"${label}不能为空字符",date:{format:"${label}日期格式无效",parse:"${label}不能转换为日期",invalid:"${label}是一个无效日期"},types:{string:Z,method:Z,array:Z,object:Z,number:Z,date:Z,boolean:Z,integer:Z,float:Z,regexp:Z,email:Z,url:Z,hex:Z},string:{len:"${label}须为${len}个字符",min:"${label}最少${min}个字符",max:"${label}最多${max}个字符",range:"${label}须在${min}-${max}字符之间"},number:{len:"${label}必须等于${len}",min:"${label}最小值为${min}",max:"${label}最大值为${max}",range:"${label}须在${min}-${max}之间"},array:{len:"须为${len}个${label}",min:"最少${min}个${label}",max:"最多${max}个${label}",range:"${label}数量须在${min}-${max}之间"},pattern:{mismatch:"${label}与模式不匹配${pattern}"}}},ImageUploader:{uploading:"上传中...",upload:"上传"},InfiniteScroll:{noMore:"没有更多了",failedToLoad:"加载失败",retry:"重新加载"},Input:{clear:"清除"},Mask:{name:"背景蒙层"},Modal:{ok:"我知道了"},PasscodeInput:{name:"密码输入框"},PullToRefresh:{pulling:"下拉刷新",canRelease:"释放立即刷新",complete:"刷新成功"},SearchBar:{name:"搜索框"},Slider:{name:"滑动输入条"},Stepper:{decrease:"减少",increase:"增加"},Switch:{name:"开关"},Selector:{name:"选择组"}}},q=B().createContext(null),K="adm-list-item";var $=R(W,{Item:e=>{var t,r,n;let{arrow:i,arrowIcon:o}=e,{list:a={}}=null!=(n=(0,P.useContext)(q))?n:Q,s=null!=(t=e.clickable)?t:!!e.onClick,l=null!=(r=null!=i?i:o)?r:s,c=function(e,...t){for(let e=t.length-1;e>=0;e-=1)if(void 0!==t[e])return t[e];return e}(a.arrowIcon,!0!==i?i:null,!0!==o?o:null),u=B().createElement("div",{className:`${K}-content`},X(e.prefix)&&B().createElement("div",{className:`${K}-content-prefix`},e.prefix),B().createElement("div",{className:`${K}-content-main`},X(e.title)&&B().createElement("div",{className:`${K}-title`},e.title),e.children,X(e.description)&&B().createElement("div",{className:`${K}-description`},e.description)),X(e.extra)&&B().createElement("div",{className:`${K}-content-extra`},e.extra),l&&B().createElement("div",{className:`${K}-content-arrow`},c||B().createElement(Y,null)));return k(e,B().createElement(s?"a":"div",{className:L()(`${K}`,s?["adm-plain-anchor"]:[],e.disabled&&`${K}-disabled`),onClick:e.disabled?void 0:e.onClick},u))}}),J=A(202),ee=A(238);function et(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function er(e,t,r,n,i,o,a){try{var s=e[o](a),l=s.value}catch(e){r(e);return}s.done?t(l):Promise.resolve(l).then(n,i)}function en(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var ei={Grid:"grid",List:"list"},eo=new c.SchemaSettings({name:"blockSettings:workbench",items:[{name:"title",Component:function(){var e,t,r=(0,u.useField)(),n=(0,u.useFieldSchema)(),i=(0,c.useDesignable)().dn,o=(0,ee.useTranslation)().t;return B().createElement(c.SchemaSettingsModalItem,{title:o("Edit block title & description"),schema:{type:"object",title:o("Edit block title & description"),properties:{title:{title:o("Block title"),type:"string",default:null==n||null==(e=n["x-decorator-props"])?void 0:e.title,"x-decorator":"FormItem","x-component":"Input"},description:{title:o("Description"),type:"string",default:null==n||null==(t=n["x-decorator-props"])?void 0:t.description,"x-decorator":"FormItem","x-component":"Markdown"}}},onSubmit:function(e){var t,o=e.title,a=e.description,s=n["x-decorator-props"]||{};s.title=o,s.description=a,n["x-decorator-props"]=s,r.decoratorProps.title=o,r.decoratorProps.description=a,i.emit("patch",{schema:(et(t={},"x-uid",n["x-uid"]),et(t,"x-decorator-props",n["x-decorator-props"]),t)}),i.refresh()}})}},{name:"setTheBlockHeight",Component:c.SchemaSettingsBlockHeightItem},{name:"blockLinkageRules",Component:c.SchemaSettingsLinkageRules,useComponentProps:function(){return{title:(0,(0,ee.useTranslation)().t)("Block Linkage rules"),category:c.LinkageRuleCategory.block}}},{name:"layout",Component:function(){var e,t=(0,ee.useTranslation)().t,r=(0,u.useFieldSchema)(),n=(0,u.useField)(),i=(0,c.useDesignable)().dn;return B().createElement(c.SchemaSettingsSelectItem,{title:t("Layout",{ns:"block-workbench"}),options:[{label:t("Grid",{ns:"block-workbench"}),value:ei.Grid},{label:t("List",{ns:"block-workbench"}),value:ei.List}],value:(null==r||null==(e=r["x-component-props"])?void 0:e.layout)||ei.Grid,onChange:function(e){n.componentProps.layout=e;var t={"x-uid":r["x-uid"]};r["x-component-props"]=r["x-component-props"]||{},t["x-component-props"]=r["x-component-props"]||{},t["x-component-props"].layout=e,r["x-component-props"].layout=e,i.emit("patch",{schema:t}),i.refresh()}})}},{name:"itemsPerRow",Component:function(){var e,t=(0,u.useField)(),r=(0,u.useFieldSchema)(),n=(0,c.useDesignable)().dn,i=(0,ee.useTranslation)().t;return B().createElement(c.SchemaSettingsModalItem,{title:i("Items per row",{ns:"block-workbench"}),schema:{type:"object",properties:{itemsPerRow:{type:"number",default:(null==r||null==(e=r["x-decorator-props"])?void 0:e.itemsPerRow)||4,"x-decorator":"FormItem","x-component":"InputNumber","x-component-props":{min:1,max:6},description:i("At least 1, up to 6",{ns:"block-workbench"}),required:!0}}},onSubmit:function(e){var i,o=e.itemsPerRow,a=r["x-decorator-props"]||{};a.itemsPerRow=o,r["x-decorator-props"]=a,t.decoratorProps.ItemsPerRow=o,n.emit("patch",{schema:(en(i={},"x-uid",r["x-uid"]),en(i,"x-decorator-props",r["x-decorator-props"]),i)}),n.refresh()}})},useVisible:function(){var e,t=((0,c.useOpenModeContext)()||{}).isMobile,r=(0,u.useFieldSchema)();return t&&(null==r||null==(e=r["x-component-props"])?void 0:e.layout)!==ei.List}},{name:"ellipsis",type:"switch",useComponentProps:function(){var e,t,r,n=(0,u.useFieldSchema)(),i=(0,c.useDesignable)().dn;return{title:(0,(0,ee.useTranslation)().t)("Ellipsis action title",{ns:"block-workbench"}),checked:(null==(r=n["x-component-props"])?void 0:r.ellipsis)!==!1,onChange:(e=function(e){return function(e,t){var r,n,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){var l=[o,s];if(r)throw TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(i=2&l[0]?n.return:l[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,l[1])).done)return i;switch(n=0,i&&(l=[2&l[0],i.value]),l[0]){case 0:case 1:i=l;break;case 4:return a.label++,{value:l[1],done:!1};case 5:a.label++,n=l[1],l=[0];continue;case 7:l=a.ops.pop(),a.trys.pop();continue;default:if(!(i=(i=a.trys).length>0&&i[i.length-1])&&(6===l[0]||2===l[0])){a=0;continue}if(3===l[0]&&(!i||l[1]>i[0]&&l[1]<i[3])){a.label=l[1];break}if(6===l[0]&&a.label<i[1]){a.label=i[1],i=l;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(l);break}i[2]&&a.ops.pop(),a.trys.pop();continue}l=t.call(e,a)}catch(e){l=[6,e],n=0}finally{r=i=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}}(this,function(t){switch(t.label){case 0:var r,o;return n["x-component-props"]=n["x-component-props"]||{},n["x-component-props"].ellipsis=e,[4,i.emit("patch",{schema:{"x-uid":n["x-uid"],"x-component-props":(r=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){en(e,t,r[t])})}return e}({},n["x-component-props"]),o=o={ellipsis:e},Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(o)):(function(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r.push.apply(r,n)}return r})(Object(o)).forEach(function(e){Object.defineProperty(r,e,Object.getOwnPropertyDescriptor(o,e))}),r)}})];case 1:return t.sent(),[2]}})},t=function(){var t=this,r=arguments;return new Promise(function(n,i){var o=e.apply(t,r);function a(e){er(o,n,i,a,s,"next",e)}function s(e){er(o,n,i,a,s,"throw",e)}a(void 0)})},function(e){return t.apply(this,arguments)})}}},{type:"remove",name:"remove"}]});function ea(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function es(){var e=ea(["\n &.list {\n margin: -","px;\n border-radius: ","px;\n overflow: hidden;\n\n .adm-list {\n --padding-left: ","px;\n --padding-right: ","px;\n\n .adm-list-item-content-main {\n display: flex;\n\n button {\n background-color: transparent;\n border: none;\n height: auto;\n box-shadow: none;\n padding: 16px 32px;\n margin: -12px -32px;\n width: calc(100% + 64px);\n text-align: start;\n justify-content: start !important;\n color: ",";\n }\n }\n }\n\n button[aria-label*='schema-initializer-WorkbenchBlock.ActionBar-workbench:configureActions'] {\n margin-bottom: ","px;\n margin-left: ","px;\n }\n .adm-list-body-inner {\n margin-top: 6px;\n margin-bottom: 3px;\n }\n }\n "]);return es=function(){return e},e}function el(){var e=ea(["\n height: ",";\n\n .nb-action-panel-warp {\n height: ",";\n overflow-y: auto;\n }\n "]);return el=function(){return e},e}var ec=(0,u.observer)(function(){var e=(0,u.useFieldSchema)();return(0,(0,c.useSchemaInitializerRender)(e["x-initializer"]).render)()},{displayName:"WorkbenchConfigureActionsButton"}),eu=function(){var e=(0,u.useFieldSchema)(),t=window.matchMedia("(max-width: 768px)").matches,r=((0,c.useOpenModeContext)()||{}).isMobile,n=(e.parent["x-decorator-props"]||{}).itemsPerRow;return r||t?B().createElement(H,{columns:void 0===n?4:n,gap:8},e.mapProperties(function(e,t){return B().createElement(c.NocoBaseRecursionField,{name:t,schema:e,key:t})})):B().createElement(d.Space,{wrap:!0,size:8,align:"start"},e.mapProperties(function(e,t){return B().createElement(c.NocoBaseRecursionField,{name:t,schema:e,key:t})}))},eh=function(){var e=(0,u.useFieldSchema)(),t=(e.parent["x-component-props"]||{}).layout,r=void 0===t?ei.Grid:t,n=(0,c.useToken)().token;return B().createElement("div",{className:"nb-action-panel-warp"},B().createElement(c.DndContext,null,r===ei.Grid?B().createElement(eu,null):B().createElement($,{style:{"--adm-color-background":n.colorBgContainer,"--active-background-color":n.colorBorderSecondary,"--border-inner":"solid 1px ".concat(n.colorBorderSecondary),"--border-bottom":"none","--border-top":"none"}},e.mapProperties(function(e,t){return B().createElement(c.NocoBaseRecursionField,{name:t,schema:e})}))))},ed=(0,P.createContext)({layout:"grid",ellipsis:!0}),ef=(0,c.createStyles)(function(e){var t=e.token;return{containerClass:(0,e.css)(es(),t.paddingLG,t.borderRadiusBlock,t.paddingLG,t.paddingLG,t.colorText,t.paddingLG,t.paddingLG)}}),eg=(0,c.withDynamicSchemaProps)(function(e){var t=(0,u.useFieldSchema)(),r=t["x-component-props"]||{},n=r.layout,i=void 0===n?"grid":n,o=r.ellipsis,a=ef().styles,s=(t["x-decorator-props"]||{}).title,l=(0,c.useBlockHeight)(),h=d.theme.useToken().token,f=(0,c.useDesignable)().designable,g=s?h.fontSizeLG*h.lineHeightLG+2*h.padding:0,p=l-2*h.paddingLG-g,m="calc(".concat(p,"px - 1rem - ").concat(h.controlHeight,"px)");"list"===i&&(p=l-g,m="calc(".concat(p,"px - 1rem - ").concat(h.controlHeight+h.paddingLG,"px)"));var w=(0,c.css)(el(),l?p+"px":"100%",f?m:"100%");return B().createElement("div",{className:"nb-action-penal-container ".concat(i," ").concat(a.containerClass," ").concat(w)},B().createElement(ed.Provider,{value:{layout:i,ellipsis:o}},B().createElement(c.DataSourceContext.Provider,{value:void 0},B().createElement(c.CollectionContext.Provider,{value:void 0},e.children))))},{displayName:"WorkbenchBlock"});function ep(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){var n;n=r[t],t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n})}return e}function em(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r.push.apply(r,n)}return r})(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}),e}function ew(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function eC(){var e=ew(["\n display: flex;\n background-color: transparent;\n border: 0;\n height: auto;\n box-shadow: none;\n padding-top: 8px;\n "]);return eC=function(){return e},e}function eE(){var e=ew(["\n width: 5em;\n "]);return eE=function(){return e},e}function eA(){var e=ew(["\n margin-top: ","px;\n width: 100%;\n "]);return eA=function(){return e},e}function ey(){var e=ew(["\n > span {\n width: 100%;\n }\n padding-top: 0px !important;\n "]);return ey=function(){return e},e}eg.ActionBar=function(){return B().createElement(B().Fragment,null,B().createElement(eh,null),B().createElement(ec,null))};var eI=(0,J.createStyles)(function(e){var t=e.token,r=e.css;return{action:r(eC()),avatar:r(eE()),title:r(eA(),t.marginSM)}});function eS(e){var t=e.onlyIcon,r=(0,u.useFieldSchema)(),n=r["x-component-props"]||{},i=n.icon,o=n.iconColor,a=(0,P.useContext)(ed),s=a.layout,l=a.ellipsis,h=void 0===l||l,f=eI(),g=f.styles,p=f.cx,m=(0,(0,ee.useTranslation)().t)(r.title,{ns:c.NAMESPACE_UI_SCHEMA}),w=!t;return s===ei.Grid?B().createElement("div",{title:m,className:p(g.avatar)},B().createElement(d.Avatar,{style:{backgroundColor:o},size:48,icon:B().createElement(c.Icon,{type:i})}),B().createElement("div",{className:p(g.title),style:{whiteSpace:h?"nowrap":"normal",textOverflow:h?"ellipsis":"clip",overflow:h?"hidden":"visible"}},w&&m)):B().createElement("span",null,w&&m)}var e_=(0,c.withDynamicSchemaProps)(function(e){var t=e.className,r=(e.targetComponent,e.iconColor,function(e,t){if(null==e)return{};var r,n,i=function(e,t){if(null==e)return{};var r,n,i={},o=Object.keys(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||(i[r]=e[r]);return i}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)r=o[n],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}(e,["className","targetComponent","iconColor"])),n=eI(),i=n.styles,o=n.cx,a=(0,u.useFieldSchema)(),s=(0,c.useComponent)(null==e?void 0:e.targetComponent)||c.Action,l=((null==(g=a.parent)||null==(f=g.parent)?void 0:f["x-component-props"])||{}).layout;if("list"!==(void 0===l?ei.Grid:l))return B().createElement(c.ACLActionProvider,null,B().createElement(s,em(ep({className:o(t,i.action,"nb-action-panel")},r),{onlyIcon:!1,type:"text",icon:null,title:B().createElement(eS,{onlyIcon:null==r?void 0:r.onlyIcon}),confirmTitle:a.title,style:{display:"flex",alignItems:"center",justifyContent:"center"}})));var f,g,p,m,w=null==(p=a["x-component-props"])?void 0:p.icon,C=null==(m=a["x-component-props"])?void 0:m.iconColor;return B().createElement(c.ACLActionProvider,null,B().createElement(s,em(ep({className:o(t,i.action,"nb-action-panel",(0,h.css)(ey()))},r),{onlyIcon:!1,type:"text",icon:null,title:B().createElement($.Item,{prefix:B().createElement(d.Avatar,{style:{backgroundColor:C},icon:B().createElement(c.Icon,{type:w})}),onClick:function(){},style:{marginTop:"5px"}},B().createElement(eS,{onlyIcon:null==r?void 0:r.onlyIcon})),confirmTitle:a.title,style:{display:"flex",alignItems:"center",justifyContent:"center",width:"100%",backgroundColor:"rgb(255, 255, 255)"}})))}),eb={type:"void","x-decorator":"CardItem","x-decorator-props":{title:""},"x-settings":"blockSettings:workbench","x-schema-toolbar":"BlockSchemaToolbar","x-component":"WorkbenchBlock",properties:{actions:{"x-component":"WorkbenchBlock.ActionBar","x-initializer":"workbench:configureActions"}}},eT={type:"item",name:"workbenchBlock",icon:"AppstoreAddOutlined",useComponentProps:function(){var e=(0,ee.useTranslation)("@nocobase/plugin-block-workbench").t,t=(0,c.useSchemaInitializer)().insert;return{title:e("Action panel"),onClick:function(){t(eb)}}}};function eN(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){var n;n=r[t],t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n})}return e}var eM=new c.SchemaSettings({name:"workbench:actionSettings:link",items:[{name:"editButton",Component:c.ButtonEditor,useComponentProps:function(){return{hasIconColor:!0}}},{name:"linkageRules",Component:c.SchemaSettingsLinkageRules,useComponentProps:function(){return eN({},(0,c.useSchemaToolbar)().linkageRulesProps)}},{name:"editLink",Component:c.SchemaSettingsActionLinkItem},(e=eN({},c.SchemaSettingAccessControl),t=t={useVisible:function(){return!0}},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r.push.apply(r,n)}return r})(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}),e),{sort:800,name:"d1",type:"divider"},{sort:900,type:"remove",name:"remove"}]}),eD=new c.SchemaInitializer({name:"workbench:configureActions",title:'{{t("Configure actions")}}',insertPosition:"beforeEnd",items:[{name:"link",title:'{{t("Link")}}',Component:function(e){var t=(0,c.useSchemaInitializerItem)(),r=(0,c.useSchemaInitializer)().insert,n=(0,ee.useTranslation)().t;return B().createElement(c.ModalActionSchemaInitializerItem,{title:t.title,modalSchema:{title:n("Add link"),properties:{title:{title:n("Title"),required:!0,"x-component":"Input","x-decorator":"FormItem"},icon:{title:n("Icon"),required:!0,"x-component":"IconPicker","x-decorator":"FormItem"},iconColor:{title:n("Color"),required:!0,default:"#1677FF","x-component":"ColorPicker","x-decorator":"FormItem"}}},onSubmit:function(e){r({type:"void",title:e.title,"x-action":"customize:link","x-toolbar":"ActionSchemaToolbar","x-settings":"workbench:actionSettings:link","x-component":"WorkbenchAction","x-use-component-props":"useLinkActionProps","x-component-props":{icon:e.icon,iconColor:e.iconColor}})}})}}]});function eO(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){var n;n=r[t],t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n})}return e}var eR=new c.SchemaSettings({name:"workbench:actionSettings:popup",items:[{name:"editButton",Component:c.ButtonEditor,useComponentProps:function(){return{hasIconColor:!0}}},{name:"linkageRules",Component:c.SchemaSettingsLinkageRules,useComponentProps:function(){return eO({},(0,c.useSchemaToolbar)().linkageRulesProps)}},{name:"openMode",Component:c.SchemaSettingOpenModeSchemaItems,useComponentProps:function(){var e=(0,ee.useTranslation)().t,t=(0,c.useOpenModeContext)().hideOpenMode;return{openSize:!t,modeOptions:t&&[{label:e("Drawer"),value:"drawer"},{label:e("Page"),value:"page"}]}}},(r=eO({},c.SchemaSettingAccessControl),n=n={useVisible:function(){return!0}},Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(n)):(function(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r.push.apply(r,n)}return r})(Object(n)).forEach(function(e){Object.defineProperty(r,e,Object.getOwnPropertyDescriptor(n,e))}),r),{sort:800,name:"d1",type:"divider"},{sort:900,type:"remove",name:"remove"}]});function ev(e){var t=(0,c.useSchemaInitializer)().insert,r=(0,ee.useTranslation)().t,n=(0,c.useOpenModeContext)().isMobile;return B().createElement(c.ModalActionSchemaInitializerItem,{title:r("Popup"),modalSchema:{title:r("Add popup",{ns:"block-workbench"}),properties:{title:{title:r("Title"),required:!0,"x-component":"Input","x-decorator":"FormItem"},icon:{title:r("Icon"),required:!0,"x-component":"IconPicker","x-decorator":"FormItem"},iconColor:{title:r("Color"),required:!0,default:"#1677FF","x-component":"ColorPicker","x-decorator":"FormItem"}}},onSubmit:function(e){t({type:"void",title:e.title,"x-action":"customize:popup","x-toolbar":"ActionSchemaToolbar","x-settings":"workbench:actionSettings:popup","x-component":"WorkbenchAction","x-component-props":{icon:e.icon,iconColor:e.iconColor,refreshDataBlockRequest:!1},properties:{drawer:{type:"void",title:e.title,"x-component":"Action.Container","x-component-props":{className:"nb-action-popup"},properties:{tabs:{type:"void","x-component":"Tabs","x-component-props":{},"x-initializer":"popup:addTab",properties:{tab1:{type:"void",title:'{{t("Details")}}',"x-component":"Tabs.TabPane","x-designer":"Tabs.Designer","x-component-props":{},properties:{grid:{type:"void","x-component":"Grid","x-initializer":n?"mobile:addBlock":"page:addBlock",properties:{}}}}}}}}}})}})}function eP(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){var n;n=r[t],t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n})}return e}var eB=new c.SchemaSettings({name:"workbench:actionSettings:scanQrCode",items:[{name:"editButton",Component:c.ButtonEditor,useComponentProps:function(){return{hasIconColor:!0}}},{name:"linkageRules",Component:c.SchemaSettingsLinkageRules,useComponentProps:function(){return eP({},(0,c.useSchemaToolbar)().linkageRulesProps)}},(i=eP({},c.SchemaSettingAccessControl),o=o={useVisible:function(){return!0}},Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(o)):(function(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r.push.apply(r,n)}return r})(Object(o)).forEach(function(e){Object.defineProperty(i,e,Object.getOwnPropertyDescriptor(o,e))}),i),{name:"d1",type:"divider"},{type:"remove",name:"remove"}]});function ex(e){(0,c.useSchemaInitializerItem)();var t=(0,c.useSchemaInitializer)().insert,r=(0,ee.useTranslation)().t;return B().createElement(c.ModalActionSchemaInitializerItem,{title:r("Scan QR code",{ns:"block-workbench"}),modalSchema:{title:r("Scan QR code",{ns:"block-workbench"}),properties:{title:{title:r("Title"),required:!0,"x-component":"Input","x-decorator":"FormItem"},icon:{title:r("Icon"),required:!0,"x-component":"IconPicker","x-decorator":"FormItem"},iconColor:{title:r("Color"),required:!0,default:"#1677FF","x-component":"ColorPicker","x-decorator":"FormItem"}}},onSubmit:function(e){t({type:"void",title:e.title,"x-component":"WorkbenchAction","x-toolbar":"ActionSchemaToolbar","x-settings":"workbench:actionSettings:scanQrCode","x-component-props":{icon:e.icon,iconColor:e.iconColor,openMode:"modal"},properties:{modal:{type:"void","x-component":"QRCodeScanner",title:r("Scan QR code",{ns:"block-workbench"})}}})}})}function eL(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){var n;n=r[t],t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n})}return e}var ek=new c.SchemaSettings({name:"workbench:actionSettings:customRequest",items:[{name:"editButton",Component:c.ButtonEditor,useComponentProps:function(){return{hasIconColor:!0}}},{name:"linkageRules",Component:c.SchemaSettingsLinkageRules,useComponentProps:function(){return eL({},(0,c.useSchemaToolbar)().linkageRulesProps)}},{name:"editLink",Component:c.SchemaSettingsActionLinkItem},(a=eL({},c.SchemaSettingAccessControl),s=s={useVisible:function(){return!0}},Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(s)):(function(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r.push.apply(r,n)}return r})(Object(s)).forEach(function(e){Object.defineProperty(a,e,Object.getOwnPropertyDescriptor(s,e))}),a),{sort:800,name:"d1",type:"divider"},{sort:900,type:"remove",name:"remove"}]});function eF(e){var t=(0,c.useSchemaInitializer)().insert,r=(0,ee.useTranslation)().t;return B().createElement(c.ModalActionSchemaInitializerItem,{title:r("Custom request"),modalSchema:{title:r("Add custom request",{ns:"block-workbench"}),properties:{title:{title:r("Title"),required:!0,"x-component":"Input","x-decorator":"FormItem"},icon:{title:r("Icon"),required:!0,"x-component":"IconPicker","x-decorator":"FormItem"},iconColor:{title:r("Color"),required:!0,default:"#1677FF","x-component":"ColorPicker","x-decorator":"FormItem"}}},onSubmit:function(e){t({type:"void",title:e.title,"x-component":"WorkbenchAction","x-component-props":{icon:e.icon,iconColor:e.iconColor,targetComponent:"CustomRequestAction"},"x-action":"customize:form:request","x-toolbar":"ActionSchemaToolbar","x-settings":"actionSettings:customRequest","x-decorator":"CustomRequestAction.Decorator","x-action-settings":{onSuccess:{manualClose:!1,redirecting:!1,successMessage:'{{t("Request success")}}'}}})}})}var eU=A(667),eH=A(482);function ez(e){return(ez=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function eV(e,t){return(eV=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function ej(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function eG(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(eG=function(){return!!e})()}function eW(){var e=ej(["\n padding: 10px 0px;\n margin-bottom: 15px;\n .ant-btn {\n background: none;\n border: none !important;\n box-shadow: none;\n .ant-btn-icon {\n display: none;\n }\n }\n "]);return eW=function(){return e},e}function eY(){var e=ej(["\n .ant-btn {\n box-shadow: none;\n border: none;\n background: none;\n display: block;\n width: 100%;\n text-align: justify;\n height: 100%;\n .ant-btn-icon {\n display: ",";\n }\n }\n .adm-list-item-content-main {\n overflow: hidden;\n }\n "]);return eY=function(){return e},e}var eX="grid",eZ=function(e){var t=window.matchMedia("(max-width: 768px)").matches;return((0,c.useOpenModeContext)()||{}).isMobile||t?B().createElement(H,{columns:4,gap:8},e.children):B().createElement(d.Space,{wrap:!0,size:8,align:"start"},e.children)},eQ=function(e){var t;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function r(){var e,t;if(!(this instanceof r))throw TypeError("Cannot call a class as a function");return e=r,t=arguments,e=ez(e),function(e,t){var r;if(t&&("object"==((r=t)&&"undefined"!=typeof Symbol&&r.constructor===Symbol?"symbol":typeof r)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,eG()?Reflect.construct(e,t||[],ez(this).constructor):e.apply(this,t))}return r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),e&&eV(r,e),t=[{key:"renderConfigureActions",value:function(){return B().createElement(eU.AddSubModelButton,{key:"action-panel-add-actions",model:this,subModelBaseClass:this.getModelClassName("ActionPanelGroupActionModel"),subModelKey:"actions"},B().createElement(eU.FlowSettingsButton,{icon:B().createElement(eH.SettingOutlined,null)},this.translate("Actions")))}},{key:"renderComponent",value:function(){var e=this,t=this.props,r=t.layout,n=t.ellipsis,i=this.context.themeToken,o=!!this.context.flowSettingsEnabled;return B().createElement("div",{id:"model-".concat(this.uid),className:"action-panel-block"},B().createElement(d.ConfigProvider,{wave:{disabled:!0}},B().createElement(eU.DndProvider,null,B().createElement("div",{className:"nb-action-panel-warp"},r===eX?B().createElement(eZ,null,this.mapSubModels("actions",function(t){if(!t.hidden||o){var r=t.props,i=r.icon,a=void 0===i?"SettingOutlined":i,s=r.color,l=void 0===s?"#1677FF":s,u=r.title;return t.enableEditDanger=!1,t.enableEditType=!1,t.renderHiddenInConfig=function(){return B().createElement(d.Tooltip,{title:e.context.t("The button is hidden and only visible when the UI Editor is active")},B().createElement(d.Button,{onClick:t.onClick.bind(t)},B().createElement("div",{style:{width:"5em",opacity:"0.3"}},B().createElement(d.Avatar,{style:{backgroundColor:l},size:48,icon:B().createElement(c.Icon,{type:a})}),B().createElement("div",{style:n?{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}:{whiteSpace:"normal",wordBreak:"break-word"}},u))))},t.props.children=B().createElement("div",{style:{width:"5em"}},B().createElement(d.Avatar,{style:{backgroundColor:l},size:48,icon:B().createElement(c.Icon,{type:a})}),B().createElement("div",{style:n?{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}:{whiteSpace:"normal",wordBreak:"break-word"}},u)),B().createElement(eU.Droppable,{model:t,key:t.uid},B().createElement("div",{className:(0,h.css)(eW())},B().createElement(eU.FlowModelRenderer,{model:t,showFlowSettings:{showBackground:!1,showBorder:!1,toolbarPosition:"above"},extraToolbarItems:[{key:"drag-handler",component:eU.DragHandler,sort:1}]})))}})):B().createElement($,{style:{"--adm-color-background":i.colorBgContainer,"--active-background-color":i.colorBorderSecondary,"--border-inner":"solid 1px ".concat(i.colorBorderSecondary),"--border-bottom":"none","--border-top":"none"}},this.mapSubModels("actions",function(t){var r=t.props,i=r.icon,o=void 0===i?"SettingOutlined":i,a=r.color,s=void 0===a?"#1677FF":a,l=r.title;return t.enableEditDanger=!1,t.enableEditType=!1,t.renderHiddenInConfig=function(){return B().createElement(d.Tooltip,{title:e.context.t("The button is hidden and only visible when the UI Editor is active")},B().createElement(d.Button,{style:{opacity:"0.3"},onClick:t.onClick.bind(t)},B().createElement($.Item,{prefix:B().createElement(d.Avatar,{style:{backgroundColor:s},icon:B().createElement(c.Icon,{type:o})})},B().createElement("div",{style:n?{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}:{whiteSpace:"normal",wordBreak:"break-word"}},l))))},t.props.children=B().createElement($.Item,{prefix:B().createElement(d.Avatar,{style:{backgroundColor:s},icon:B().createElement(c.Icon,{type:o})})},B().createElement("div",{style:n?{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}:{whiteSpace:"normal",wordBreak:"break-word"}},l)),B().createElement(eU.Droppable,{model:t,key:t.uid},B().createElement("div",{className:(0,h.css)(eY(),t.hidden?"block":" none")},B().createElement(eU.FlowModelRenderer,{model:t,showFlowSettings:{showBackground:!1,showBorder:!1},extraToolbarItems:[{key:"drag-handler",component:eU.DragHandler,sort:1}]})))}))))),this.context.flowSettingsEnabled&&B().createElement("div",{style:{marginTop:"10px"}},this.renderConfigureActions()))}}],function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(r.prototype,t),r}(c.BlockModel);eQ.define({label:(0,eU.tExpr)("Action panel"),createModelOptions:{use:"ActionPanelBlockModel"}}),eQ.registerFlow({key:"actionPanelBlockSetting",title:(0,eU.tExpr)("Action panel settings",{ns:"block-workbench"}),steps:{layout:{title:(0,eU.tExpr)("Layout",{ns:"block-workbench"}),uiMode:function(e){var t=e.t;return{type:"select",key:"layout",props:{options:[{label:t("Grid",{ns:"block-workbench"}),value:eX},{label:t("List",{ns:"block-workbench"}),value:"list"}]}}},defaultParams:{layout:eX},handler:function(e,t){e.model.setProps({layout:t.layout})}},ellipsis:{title:(0,eU.tExpr)("Ellipsis action title",{ns:"block-workbench"}),uiMode:{type:"switch",key:"ellipsis"},defaultParams:{ellipsis:!0},handler:function(e,t){e.model.setProps({ellipsis:t.ellipsis})}}}});var eq=A(195);function eK(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){var n;n=r[t],t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n})}return e}function e$(e){var t=e.style,r={position:"absolute",backgroundColor:"rgb(255, 255, 255)"};return B().createElement("div",{id:"qr-scan-box",style:eK({boxSizing:"border-box",inset:"0px"},void 0===t?{}:t)},B().createElement("div",{style:eK({width:"40px",height:"5px",top:"-5px",left:"0px"},r)}),B().createElement("div",{style:eK({width:"40px",height:"5px",top:"-5px",right:"0px"},r)}),B().createElement("div",{style:eK({width:"40px",height:"5px",bottom:"-5px",left:"0px"},r)}),B().createElement("div",{style:eK({width:"40px",height:"5px",bottom:"-5px",right:"0px"},r)}),B().createElement("div",{style:eK({width:"5px",height:"45px",top:"-5px",left:"-5px"},r)}),B().createElement("div",{style:eK({width:"5px",height:"45px",bottom:"-5px",left:"-5px"},r)}),B().createElement("div",{style:eK({width:"5px",height:"45px",top:"-5px",right:"-5px"},r)}),B().createElement("div",{style:eK({width:"5px",height:"45px",bottom:"-5px",right:"-5px"},r)}))}var eJ=A(58),e1=A.n(eJ),e0=A(738);function e2(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function e3(e,t,r,n,i,o,a){try{var s=e[o](a),l=s.value}catch(e){r(e);return}s.done?t(l):Promise.resolve(l).then(n,i)}function e4(e){return function(){var t=this,r=arguments;return new Promise(function(n,i){var o=e.apply(t,r);function a(e){e3(o,n,i,a,s,"next",e)}function s(e){e3(o,n,i,a,s,"throw",e)}a(void 0)})}}function e8(e,t){var r,n,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){var l=[o,s];if(r)throw TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(i=2&l[0]?n.return:l[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,l[1])).done)return i;switch(n=0,i&&(l=[2&l[0],i.value]),l[0]){case 0:case 1:i=l;break;case 4:return a.label++,{value:l[1],done:!1};case 5:a.label++,n=l[1],l=[0];continue;case 7:l=a.ops.pop(),a.trys.pop();continue;default:if(!(i=(i=a.trys).length>0&&i[i.length-1])&&(6===l[0]||2===l[0])){a=0;continue}if(3===l[0]&&(!i||l[1]>i[0]&&l[1]<i[3])){a.label=l[1];break}if(6===l[0]&&a.label<i[1]){a.label=i[1],i=l;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(l);break}i[2]&&a.ops.pop(),a.trys.pop();continue}l=t.call(e,a)}catch(e){l=[6,e],n=0}finally{r=i=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}}function e6(e,t){return e.startsWith(t)?e.slice(t.length):e}function e5(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}var e7="qrcode",e9=function(e){var t,r,n,i,o,a,s,l,u,h,d,f,g,p,m,w,C,E,A,y,I,S,_,b,T,N,M,D=e.setVisible,O=e.app,R=e.navigate;e.onClose;var v=(0,P.useRef)(),x=(0,P.useRef)(),L=(0,ee.useTranslation)("block-workbench").t,k=(t=(0,P.useState)({width:0,height:0}),function(e){if(Array.isArray(e))return e}(t)||function(e,t){var r,n,i=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=i){var o=[],a=!0,s=!1;try{for(i=i.call(e);!(a=(r=i.next()).done)&&(o.push(r.value),o.length!==t);a=!0);}catch(e){s=!0,n=e}finally{try{a||null==i.return||i.return()}finally{if(s)throw n}}return o}}(t,2)||function(e,t){if(e){if("string"==typeof e)return e5(e,2);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(r);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return e5(e,t)}}(t,2)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),F=k[0],U=k[1],H=Math.max(document.documentElement.clientWidth||0,window.innerWidth||0),z=Math.max(document.documentElement.clientHeight||0,window.innerHeight||0),V=(o=(r={onScannerSizeChanged:U,elementId:e7,onScanSuccess:(0,P.useCallback)(function(e){D(!1)},[D]),app:O,navigate:R}).onScannerSizeChanged,a=r.elementId,s=r.onScanSuccess,l=r.app,u=r.navigate,h=(0,c.useApp)(),f=(null==(n=(i=(d=l||h).pm).get)?void 0:n.call(i,e1())).mobileRouter,g=d.router,p=((null==f?void 0:f.router)?null==f?void 0:f.basename:g.basename).replace(/\/+$/,""),C=(m=(0,P.useState)(),w=function(e){if(Array.isArray(e))return e}(m)||function(e,t){var r,n,i=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=i){var o=[],a=!0,s=!1;try{for(i=i.call(e);!(a=(r=i.next()).done)&&(o.push(r.value),o.length!==t);a=!0);}catch(e){s=!0,n=e}finally{try{a||null==i.return||i.return()}finally{if(s)throw n}}return o}}(m,2)||function(e,t){if(e){if("string"==typeof e)return e2(e,2);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(r);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return e2(e,t)}}(m,2)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}())[0],E=w[1],A=(0,ee.useTranslation)("block-workbench").t,y=(0,P.useMemo)(function(){return{width:Math.max(document.documentElement.clientWidth||0,window.innerWidth||0),height:Math.max(document.documentElement.clientHeight||0,window.innerHeight||0)}},[]),S=(0,P.useCallback)((I=e4(function(e){return e8(this,function(t){return[2,e.start({facingMode:"environment"},{fps:10,qrbox:function(e,t){return o({width:e,height:t}),{width:y.width,height:y.height}}},function(e){if(null==e?void 0:e.startsWith("http")){window.location.href=e;return}u(e6(e,p)),s&&s(e)},void 0)]})}),function(e){return I.apply(this,arguments)}),[u,o,y,p,s]),b=(0,P.useCallback)((_=e4(function(e){var t;return e8(this,function(r){return(t=e.getState(),[e0.lz.SCANNING,e0.lz.PAUSED].includes(t))?(console.log(e),[2,null==e?void 0:e.stop()]):[2]})}),function(e){return _.apply(this,arguments)}),[]),N=(0,P.useCallback)((T=e4(function(e){var t;return e8(this,function(r){switch(r.label){case 0:return[4,b(C)];case 1:r.sent(),r.label=2;case 2:return r.trys.push([2,4,,5]),[4,C.scanFileV2(e,!1)];case 3:if(null==(t=r.sent().decodedText)?void 0:t.startsWith("http"))return window.location.href=t,[2];return u(e6(t,p)),s&&s(t),[3,5];case 4:return r.sent(),alert(A("QR code recognition failed, please scan again")),S(C),[3,5];case 5:return[2]}})}),function(e){return T.apply(this,arguments)}),[b,C,u,p,A,S,s]),(0,P.useEffect)(function(){var e=new e0.t2(a);return E(e),S(e),function(){b(e)}},[a,S,b]),{startScanCamera:S,startScanFile:N}).startScanFile,j=function(){x.current&&x.current.click()},G=function(e){var t=e.target.files;if(t.length>0){var r=t[0];r.size<1e6?V(r):alert(L("The image size is too large. Please compress it to below 1MB before uploading"))}};(0,P.useEffect)(function(){return document.documentElement.style.overscrollBehavior="none",function(){document.documentElement.style.overscrollBehavior="default"}},[]),(0,P.useEffect)(function(){var e=F.width,t=F.height,r=Math.max(document.documentElement.clientWidth||0,window.innerWidth||0),n=Math.max(document.documentElement.clientHeight||0,window.innerHeight||0);if(e>0&&t>0&&t<n){var i=Math.floor(n/t*e),o=document.getElementsByTagName("video")[0];o.style.height="".concat(n,"px"),o.style.width="".concat(i,"px"),v.current.style.left="".concat((r-i)/2,"px"),v.current.style.position="absolute"}},[F]);var W={zIndex:"1003",fontSize:"1.8em",fontWeight:"bold"};return B().createElement(B().Fragment,null,B().createElement("div",{ref:v,id:e7,style:{position:"absolute"}}),B().createElement(e$,{style:function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){var n;n=r[t],t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n})}return e}({},(M=Math.floor(.6*Math.min(H,z)),{left:"".concat((H-M)/2,"px"),top:"".concat((z-M)/2,"px"),position:"fixed",width:"".concat(M,"px"),height:"".concat(M,"px")}))}),B().createElement(function(){return B().createElement("div",{style:{position:"absolute",bottom:"20px",left:"20px",padding:"10px 60px"}},B().createElement("div",{style:{color:"white",width:"40px",display:"flex",flexDirection:"column",alignItems:"center"}},B().createElement(eH.FileImageOutlined,{style:W,onClick:j}),L("Album"),B().createElement("input",{ref:x,type:"file",accept:"image/*",onChange:G,style:{visibility:"hidden"}})))},null))};function te(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function tt(e,t,r,n,i,o,a){try{var s=e[o](a),l=s.value}catch(e){r(e);return}s.done?t(l):Promise.resolve(l).then(n,i)}function tr(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function tn(e){return(tn=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function ti(e,t){return(ti=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function to(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(to=function(){return!!e})()}var ta=function(e){var t,r=(t=(0,P.useState)(!0),function(e){if(Array.isArray(e))return e}(t)||function(e,t){var r,n,i=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=i){var o=[],a=!0,s=!1;try{for(i=i.call(e);!(a=(r=i.next()).done)&&(o.push(r.value),o.length!==t);a=!0);}catch(e){s=!0,n=e}finally{try{a||null==i.return||i.return()}finally{if(s)throw n}}return o}}(t,2)||function(e,t){if(e){if("string"==typeof e)return te(e,2);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(r);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return te(e,t)}}(t,2)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),n=r[0],i=r[1],o=(0,ee.useTranslation)("block-workbench").t;return n?B().createElement("div",{style:{position:"fixed",width:"100%",height:"100%",background:"black",zIndex:1001,top:0,left:0,overflow:"hidden"}},B().createElement(e9,{setVisible:i,app:e.app,navigate:e.navigate,onClose:e.onClose}),B().createElement(eH.LeftOutlined,{style:{position:"absolute",top:"22px",left:"20px",zIndex:1003,color:"white",fontSize:"1.8em",fontWeight:"bold"},onClick:function(){return i(!1)}}),B().createElement("div",{style:{position:"absolute",color:"white",fontSize:"1.5em",left:0,right:0,top:"20px",zIndex:1002,marginLeft:"auto",marginRight:"auto",textAlign:"center"}},o("Scan QR code"))):null},ts=function(e){var t;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function r(){var e,t,n;if(!(this instanceof r))throw TypeError("Cannot call a class as a function");return t=r,n=arguments,t=tn(t),tr(e=function(e,t){var r;if(t&&("object"==((r=t)&&"undefined"!=typeof Symbol&&r.constructor===Symbol?"symbol":typeof r)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,to()?Reflect.construct(t,n||[],tn(this).constructor):t.apply(this,n)),"defaultProps",{title:(0,eU.escapeT)("Scan QR code",{ns:"block-workbench"}),icon:"ScanOutlined"}),e}return r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),e&&ti(r,e),t=[{key:"onClick",value:function(e){this.dispatchEvent("click",function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){tr(e,t,r[t])})}return e}({event:e},this.getInputArgs()),{debounce:!0})}}],function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(r.prototype,t),r}(c.ActionModel);function tl(e){return(tl=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function tc(e,t){return(tc=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function tu(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(tu=function(){return!!e})()}ts.registerFlow({key:"actionPanelScanSettings",on:"click",steps:{scanClick:{handler:function(e,t){var r;return(r=function(){var t,r,n,i;return function(e,t){var r,n,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){var l=[o,s];if(r)throw TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(i=2&l[0]?n.return:l[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,l[1])).done)return i;switch(n=0,i&&(l=[2&l[0],i.value]),l[0]){case 0:case 1:i=l;break;case 4:return a.label++,{value:l[1],done:!1};case 5:a.label++,n=l[1],l=[0];continue;case 7:l=a.ops.pop(),a.trys.pop();continue;default:if(!(i=(i=a.trys).length>0&&i[i.length-1])&&(6===l[0]||2===l[0])){a=0;continue}if(3===l[0]&&(!i||l[1]>i[0]&&l[1]<i[3])){a.label=l[1];break}if(6===l[0]&&a.label<i[1]){a.label=i[1],i=l;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(l);break}i[2]&&a.ops.pop(),a.trys.pop();continue}l=t.call(e,a)}catch(e){l=[6,e],n=0}finally{r=i=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}}(this,function(o){return(t=document.getElementById("qr-scanner-container"))&&t.remove(),(r=document.createElement("div")).id="qr-scanner-container",document.body.appendChild(r),n=eq.createRoot(r),i=function(){n.unmount(),r.remove()},n.render(B().createElement(ta,{app:e.app,navigate:e.router.navigate,onClose:i})),[2]})},function(){var e=this,t=arguments;return new Promise(function(n,i){var o=r.apply(e,t);function a(e){tt(o,n,i,a,s,"next",e)}function s(e){tt(o,n,i,a,s,"throw",e)}a(void 0)})})()}}}}),ts.define({label:(0,eU.escapeT)("Scan QR code",{ns:"block-workbench"})});var th=function(e){if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function t(){var e,r;if(!(this instanceof t))throw TypeError("Cannot call a class as a function");return e=t,r=arguments,e=tl(e),function(e,t){var r;if(t&&("object"==((r=t)&&"undefined"!=typeof Symbol&&r.constructor===Symbol?"symbol":typeof r)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,tu()?Reflect.construct(e,r||[],tl(this).constructor):e.apply(this,r))}return t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&tc(t,e),t}(c.ActionGroupModel);th.define({label:(0,eU.tExpr)("Action panel action",{ns:"block-workbench"})}),th.registerActionModels({PopupActionModel:c.PopupActionModel,LinkActionModel:c.LinkActionModel,ActionPanelScanActionModel:ts,JSActionModel:c.JSActionModel});var td=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){var n;n=r[t],t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n})}return e}({ActionPanelBlockModel:eQ},l),tf=A(581);function tg(e,t,r,n,i,o,a){try{var s=e[o](a),l=s.value}catch(e){r(e);return}s.done?t(l):Promise.resolve(l).then(n,i)}function tp(e,t,r){return(tp=tE()?Reflect.construct:function(e,t,r){var n=[null];n.push.apply(n,t);var i=new(Function.bind.apply(e,n));return r&&tw(i,r.prototype),i}).apply(null,arguments)}function tm(e){return(tm=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function tw(e,t){return(tw=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function tC(e){var t="function"==typeof Map?new Map:void 0;return(tC=function(e){if(null===e||-1===Function.toString.call(e).indexOf("[native code]"))return e;if("function"!=typeof e)throw TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return tp(e,arguments,tm(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),tw(r,e)})(e)}function tE(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(tE=function(){return!!e})()}var tA=function(e){var t;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function r(){var e,t;if(!(this instanceof r))throw TypeError("Cannot call a class as a function");return e=r,t=arguments,e=tm(e),function(e,t){var r;if(t&&("object"==((r=t)&&"undefined"!=typeof Symbol&&r.constructor===Symbol?"symbol":typeof r)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,tE()?Reflect.construct(e,t||[],tm(this).constructor):e.apply(this,t))}return r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),e&&tw(r,e),t=[{key:"load",value:function(){var e,t=this;return(e=function(){var e;return function(e,t){var r,n,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){var l=[o,s];if(r)throw TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(i=2&l[0]?n.return:l[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,l[1])).done)return i;switch(n=0,i&&(l=[2&l[0],i.value]),l[0]){case 0:case 1:i=l;break;case 4:return a.label++,{value:l[1],done:!1};case 5:a.label++,n=l[1],l=[0];continue;case 7:l=a.ops.pop(),a.trys.pop();continue;default:if(!(i=(i=a.trys).length>0&&i[i.length-1])&&(6===l[0]||2===l[0])){a=0;continue}if(3===l[0]&&(!i||l[1]>i[0]&&l[1]<i[3])){a.label=l[1];break}if(6===l[0]&&a.label<i[1]){a.label=i[1],i=l;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(l);break}i[2]&&a.ops.pop(),a.trys.pop();continue}l=t.call(e,a)}catch(e){l=[6,e],n=0}finally{r=i=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}}(this,function(r){return e=(0,c.lazy)(function(){return tf("imported_1nibks6_component",A.e("397").then(A.bind(A,626)))},"QRCodeScanner").QRCodeScanner,t.app.addComponents({WorkbenchBlock:eg,QRCodeScanner:e,WorkbenchAction:e_}),t.app.schemaSettingsManager.add(eo),t.app.schemaInitializerManager.add(eD),t.app.schemaInitializerManager.addItem("page:addBlock","otherBlocks.".concat(eT.name),eT),t.app.schemaInitializerManager.addItem("popup:common:addBlock","otherBlocks.".concat(eT.name),eT),t.app.schemaInitializerManager.addItem("mobilePage:addBlock","otherBlocks.".concat(eT.name),eT),t.app.schemaInitializerManager.addItem("mobile:addBlock","otherBlocks.".concat(eT.name),eT),t.app.schemaSettingsManager.add(eM),t.app.schemaSettingsManager.add(eB),t.app.schemaInitializerManager.addItem("workbench:configureActions","qrcode",{Component:ex}),t.app.schemaSettingsManager.add(eR),t.app.schemaInitializerManager.addItem("workbench:configureActions","popup",{Component:ev}),t.app.schemaSettingsManager.add(ek),t.app.schemaInitializerManager.addItem("workbench:configureActions","customRequest",{Component:eF}),t.flowEngine.registerModels(td),[2]})},function(){var t=this,r=arguments;return new Promise(function(n,i){var o=e.apply(t,r);function a(e){tg(o,n,i,a,s,"next",e)}function s(e){tg(o,n,i,a,s,"throw",e)}a(void 0)})})()}}],function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(r.prototype,t),r}(tC(c.Plugin)),ty=tA}(),y}()});
|