@nocobase/plugin-block-workbench 1.2.8-alpha → 1.2.9-alpha
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 +3 -3
- package/package.json +9 -2
package/dist/client/index.js
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
box-shadow: none;
|
|
15
15
|
`,title:u`
|
|
16
16
|
margin-top: ${h.marginSM}px;
|
|
17
|
-
`}));function Si(){var d,y;const h=Ve.useFieldSchema(),u=(d=h["x-component-props"])==null?void 0:d.icon,l=(y=h["x-component-props"])==null?void 0:y.iconColor,{styles:w,cx:C}=Tr();return ee.jsxs("div",{children:[ee.jsx(dn.Avatar,{style:{backgroundColor:l},size:64,icon:ee.jsx(Z.Icon,{type:u})}),ee.jsx("div",{className:C(w.title),children:h.title})]})}const yi=Z.withDynamicSchemaProps(h=>{const d=h,{className:u}=d,l=Kn(d,["className"]),{styles:w,cx:C}=Tr();return ee.jsx(Z.Action,Rn(Dn({className:C(u,w.action)},l),{icon:null,title:ee.jsx(Si,{})}))}),Ti=Ve.observer(()=>{const h=Ve.useFieldSchema(),{render:u}=Z.useSchemaInitializerRender(h["x-initializer"]);return u()},{displayName:"WorkbenchConfigureActionsButton"}),bi=()=>{const h=Ve.useFieldSchema(),{designable:u}=Z.useDesignable();return ee.jsx("div",{style:{marginBottom:u?"1rem":0},children:ee.jsx(Z.DndContext,{children:ee.jsx(dn.Space,{wrap:!0,children:h.mapProperties((l,w)=>ee.jsx(Ve.RecursionField,{name:w,schema:l}))})})})},br=Z.withDynamicSchemaProps(h=>ee.jsx("div",{children:ee.jsx(Z.SchemaComponentOptions,{components:{WorkbenchAction:yi},children:h.children})}),{displayName:"WorkbenchBlock"});br.ActionBar=()=>ee.jsxs(ee.Fragment,{children:[ee.jsx(bi,{}),ee.jsx(Ti,{})]});function Nr(h){const E=h,{modalSchema:u={}}=E,l=Kn(E,["modalSchema"]),_=u,{properties:w}=_,C=Kn(_,["properties"]),[d,y]=mt.useState(!1),{setVisible:D}=Z.useSchemaInitializer(),B=mt.useMemo(()=>Rn(Dn({name:xn.uid(),"x-component":"Action.Modal","x-component-props":{width:"520px"},type:"void","x-decorator":"FormV2","x-decorator-props":{}},C),{properties:Rn(Dn({},w),{footer1:{"x-component":"Action.Modal.Footer",type:"void",properties:{close:{title:"Cancel","x-component":"Action","x-component-props":{type:"default"},"x-use-component-props":()=>({onClick(){var N;y(!1),(N=h==null?void 0:h.onCancel)==null||N.call(h)}})},submit:{title:"OK","x-component":"Action","x-component-props":{type:"primary"},"x-use-component-props":()=>{const N=Ve.useForm();return{onClick(){return yr(this,null,function*(){var $;yield N.submit(),y(!1),($=h==null?void 0:h.onSubmit)==null||$.call(h,N.values)})}}}}}}})}),[]);return ee.jsxs(ee.Fragment,{children:[ee.jsx(Z.SchemaInitializerItem,Rn(Dn({},l),{onClick:N=>{var se;D(!1),y(!0),(se=h==null?void 0:h.onClick)==null||se.call(h,N)}})),ee.jsx(Z.ActionContextProvider,{value:{visible:d,setVisible:y},children:ee.jsx(Z.SchemaComponent,{components:{Action:Z.Action},schema:B})})]})}const Ni=new Z.SchemaSettings({name:"workbench:actionSettings:link",items:[{name:"editButton",Component:Z.ButtonEditor,useComponentProps(){return{hasIconColor:!0}}},{name:"editLink",Component:Z.SchemaSettingsActionLinkItem},{sort:800,name:"d1",type:"divider"},{sort:900,type:"remove",name:"remove"}]});function Mi(h){const u=Z.useSchemaInitializerItem(),{insert:l}=Z.useSchemaInitializer(),{t:w}=gn.useTranslation();return ee.jsx(Nr,{title:u.title,modalSchema:{title:w("Add link"),properties:{title:{title:w("Title"),required:!0,"x-component":"Input","x-decorator":"FormItem"},icon:{title:w("Icon"),required:!0,"x-component":"IconPicker","x-decorator":"FormItem"},iconColor:{title:w("Color"),required:!0,default:"#1677FF","x-component":"ColorPicker","x-decorator":"FormItem"}}},onSubmit:C=>{l({type:"void",title:C.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:C.icon,iconColor:C.iconColor}})}})}const Oi=new Z.SchemaSettings({name:"workbench:actionSettings:scanQrCode",items:[{name:"editButton",Component:Z.ButtonEditor,useComponentProps(){return{hasIconColor:!0}}},{name:"d1",type:"divider"},{type:"remove",name:"remove"}]});function _i(h){Z.useSchemaInitializerItem();const{insert:u}=Z.useSchemaInitializer(),{t:l}=gn.useTranslation(),w=()=>{const{setVisible:C}=Z.useActionContext();return{run(){C(!1)}}};return ee.jsx(Nr,{title:l("Scan QR code",{ns:"block-workbench"}),modalSchema:{title:l("Scan QR code",{ns:"block-workbench"}),properties:{title:{title:l("Title"),required:!0,"x-component":"Input","x-decorator":"FormItem"},icon:{title:l("Icon"),required:!0,"x-component":"IconPicker","x-decorator":"FormItem"},iconColor:{title:l("Color"),required:!0,default:"#1677FF","x-component":"ColorPicker","x-decorator":"FormItem"}}},onSubmit:C=>{u({type:"void",title:C.title,"x-component":"WorkbenchAction","x-toolbar":"ActionSchemaToolbar","x-settings":"workbench:actionSettings:scanQrCode","x-component-props":{icon:C.icon,iconColor:C.iconColor,openMode:"modal"},properties:{modal:{type:"void","x-component":"Action.Modal",title:l("Scan QR code",{ns:"block-workbench"}),"x-decorator":"FormV2",properties:{scanner:{"x-component":"QRCodeScanner","x-component-props":{fps:10,qrbox:250,disableFlip:!1}},footer:{type:"void","x-component":"Action.Modal.Footer",properties:{close:{title:"Close","x-component":"Action","x-component-props":{type:"default",useAction:w}}}}}}}})}})}var z;(function(h){h[h.QR_CODE=0]="QR_CODE",h[h.AZTEC=1]="AZTEC",h[h.CODABAR=2]="CODABAR",h[h.CODE_39=3]="CODE_39",h[h.CODE_93=4]="CODE_93",h[h.CODE_128=5]="CODE_128",h[h.DATA_MATRIX=6]="DATA_MATRIX",h[h.MAXICODE=7]="MAXICODE",h[h.ITF=8]="ITF",h[h.EAN_13=9]="EAN_13",h[h.EAN_8=10]="EAN_8",h[h.PDF_417=11]="PDF_417",h[h.RSS_14=12]="RSS_14",h[h.RSS_EXPANDED=13]="RSS_EXPANDED",h[h.UPC_A=14]="UPC_A",h[h.UPC_E=15]="UPC_E",h[h.UPC_EAN_EXTENSION=16]="UPC_EAN_EXTENSION"})(z||(z={}));var Mr=new Map([[z.QR_CODE,"QR_CODE"],[z.AZTEC,"AZTEC"],[z.CODABAR,"CODABAR"],[z.CODE_39,"CODE_39"],[z.CODE_93,"CODE_93"],[z.CODE_128,"CODE_128"],[z.DATA_MATRIX,"DATA_MATRIX"],[z.MAXICODE,"MAXICODE"],[z.ITF,"ITF"],[z.EAN_13,"EAN_13"],[z.EAN_8,"EAN_8"],[z.PDF_417,"PDF_417"],[z.RSS_14,"RSS_14"],[z.RSS_EXPANDED,"RSS_EXPANDED"],[z.UPC_A,"UPC_A"],[z.UPC_E,"UPC_E"],[z.UPC_EAN_EXTENSION,"UPC_EAN_EXTENSION"]]),Or;(function(h){h[h.UNKNOWN=0]="UNKNOWN",h[h.URL=1]="URL"})(Or||(Or={}));function Di(h){return Object.values(z).includes(h)}var vt;(function(h){h[h.SCAN_TYPE_CAMERA=0]="SCAN_TYPE_CAMERA",h[h.SCAN_TYPE_FILE=1]="SCAN_TYPE_FILE"})(vt||(vt={}));var pt=function(){function h(){}return h.GITHUB_PROJECT_URL="https://github.com/mebjas/html5-qrcode",h.SCAN_DEFAULT_FPS=2,h.DEFAULT_DISABLE_FLIP=!1,h.DEFAULT_REMEMBER_LAST_CAMERA_USED=!0,h.DEFAULT_SUPPORTED_SCAN_TYPE=[vt.SCAN_TYPE_CAMERA,vt.SCAN_TYPE_FILE],h}(),_r=function(){function h(u,l){this.format=u,this.formatName=l}return h.prototype.toString=function(){return this.formatName},h.create=function(u){if(!Mr.has(u))throw"".concat(u," not in html5QrcodeSupportedFormatsTextMap");return new h(u,Mr.get(u))},h}(),Dr=function(){function h(){}return h.createFromText=function(u){var l={text:u};return{decodedText:u,result:l}},h.createFromQrcodeResult=function(u){return{decodedText:u.text,result:u}},h}(),Jn;(function(h){h[h.UNKWOWN_ERROR=0]="UNKWOWN_ERROR",h[h.IMPLEMENTATION_ERROR=1]="IMPLEMENTATION_ERROR",h[h.NO_CODE_FOUND_ERROR=2]="NO_CODE_FOUND_ERROR"})(Jn||(Jn={}));var Rr=function(){function h(){}return h.createFrom=function(u){return{errorMessage:u,type:Jn.UNKWOWN_ERROR}},h}(),Br=function(){function h(u){this.verbose=u}return h.prototype.log=function(u){this.verbose&&console.log(u)},h.prototype.warn=function(u){this.verbose&&console.warn(u)},h.prototype.logError=function(u,l){(this.verbose||l===!0)&&console.error(u)},h.prototype.logErrors=function(u){if(u.length===0)throw"Logger#logError called without arguments";this.verbose&&console.error(u)},h}();function Tt(h){return typeof h=="undefined"||h===null}function Ri(h,u,l){return h>l?l:h<u?u:h}var en=function(){function h(){}return h.codeParseError=function(u){return"QR code parse error, error = ".concat(u)},h.errorGettingUserMedia=function(u){return"Error getting userMedia, error = ".concat(u)},h.onlyDeviceSupportedError=function(){return"The device doesn't support navigator.mediaDevices , only supported cameraIdOrConfig in this case is deviceId parameter (string)."},h.cameraStreamingNotSupported=function(){return"Camera streaming not supported by the browser."},h.unableToQuerySupportedDevices=function(){return"Unable to query supported devices, unknown error."},h.insecureContextCameraQueryError=function(){return"Camera access is only supported in secure context like https or localhost."},h.scannerPaused=function(){return"Scanner paused"},h}(),Ae=function(){function h(){}return h.scanningStatus=function(){return"Scanning"},h.idleStatus=function(){return"Idle"},h.errorStatus=function(){return"Error"},h.permissionStatus=function(){return"Permission"},h.noCameraFoundErrorStatus=function(){return"No Cameras"},h.lastMatch=function(u){return"Last Match: ".concat(u)},h.codeScannerTitle=function(){return"Code Scanner"},h.cameraPermissionTitle=function(){return"Request Camera Permissions"},h.cameraPermissionRequesting=function(){return"Requesting camera permissions..."},h.noCameraFound=function(){return"No camera found"},h.scanButtonStopScanningText=function(){return"Stop Scanning"},h.scanButtonStartScanningText=function(){return"Start Scanning"},h.torchOnButton=function(){return"Switch On Torch"},h.torchOffButton=function(){return"Switch Off Torch"},h.torchOnFailedMessage=function(){return"Failed to turn on torch"},h.torchOffFailedMessage=function(){return"Failed to turn off torch"},h.scanButtonScanningStarting=function(){return"Launching Camera..."},h.textIfCameraScanSelected=function(){return"Scan an Image File"},h.textIfFileScanSelected=function(){return"Scan using camera directly"},h.selectCamera=function(){return"Select Camera"},h.fileSelectionChooseImage=function(){return"Choose Image"},h.fileSelectionChooseAnother=function(){return"Choose Another"},h.fileSelectionNoImageSelected=function(){return"No image choosen"},h.anonymousCameraPrefix=function(){return"Anonymous Camera"},h.dragAndDropMessage=function(){return"Or drop an image to scan"},h.dragAndDropMessageOnlyImages=function(){return"Or drop an image to scan (other files not supported)"},h.zoom=function(){return"zoom"},h.loadingImage=function(){return"Loading image..."},h.cameraScanAltText=function(){return"Camera based scan"},h.fileScanAltText=function(){return"Fule based scan"},h}(),Lr=function(){function h(){}return h.poweredBy=function(){return"Powered by "},h.reportIssues=function(){return"Report issues"},h}(),vr=function(){function h(){}return h.isMediaStreamConstraintsValid=function(u,l){if(typeof u!="object"){var w=typeof u;return l.logError("videoConstraints should be of type object, the "+"object passed is of type ".concat(w,"."),!0),!1}for(var C=["autoGainControl","channelCount","echoCancellation","latency","noiseSuppression","sampleRate","sampleSize","volume"],d=new Set(C),y=Object.keys(u),D=0,B=y;D<B.length;D++){var E=B[D];if(d.has(E))return l.logError("".concat(E," is not supported videoConstaints."),!0),!1}return!0},h}(),An=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{};function Bi(h){return h&&h.__esModule&&Object.prototype.hasOwnProperty.call(h,"default")?h.default:h}var $n={exports:{}};(function(h,u){(function(l,w){w(u)})(An,function(l){function w(g){return g==null}var C=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(g,e){g.__proto__=e}||function(g,e){for(var t in e)e.hasOwnProperty(t)&&(g[t]=e[t])};function d(g,e){C(g,e);function t(){this.constructor=g}g.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}function y(g,e){var t=Object.setPrototypeOf;t?t(g,e):g.__proto__=e}function D(g,e){e===void 0&&(e=g.constructor);var t=Error.captureStackTrace;t&&t(g,e)}var B=function(g){d(e,g);function e(t){var n=this.constructor,r=g.call(this,t)||this;return Object.defineProperty(r,"name",{value:n.name,enumerable:!1}),y(r,n.prototype),D(r),r}return e}(Error);class E extends B{constructor(e=void 0){super(e),this.message=e}getKind(){return this.constructor.kind}}E.kind="Exception";class _ extends E{}_.kind="ArgumentException";class N extends E{}N.kind="IllegalArgumentException";class se{constructor(e){if(this.binarizer=e,e===null)throw new N("Binarizer must be non-null.")}getWidth(){return this.binarizer.getWidth()}getHeight(){return this.binarizer.getHeight()}getBlackRow(e,t){return this.binarizer.getBlackRow(e,t)}getBlackMatrix(){return(this.matrix===null||this.matrix===void 0)&&(this.matrix=this.binarizer.getBlackMatrix()),this.matrix}isCropSupported(){return this.binarizer.getLuminanceSource().isCropSupported()}crop(e,t,n,r){const i=this.binarizer.getLuminanceSource().crop(e,t,n,r);return new se(this.binarizer.createBinarizer(i))}isRotateSupported(){return this.binarizer.getLuminanceSource().isRotateSupported()}rotateCounterClockwise(){const e=this.binarizer.getLuminanceSource().rotateCounterClockwise();return new se(this.binarizer.createBinarizer(e))}rotateCounterClockwise45(){const e=this.binarizer.getLuminanceSource().rotateCounterClockwise45();return new se(this.binarizer.createBinarizer(e))}toString(){try{return this.getBlackMatrix().toString()}catch(e){return""}}}class $ extends E{static getChecksumInstance(){return new $}}$.kind="ChecksumException";class ke{constructor(e){this.source=e}getLuminanceSource(){return this.source}getWidth(){return this.source.getWidth()}getHeight(){return this.source.getHeight()}}class q{static arraycopy(e,t,n,r,i){for(;i--;)n[r++]=e[t++]}static currentTimeMillis(){return Date.now()}}class Te extends E{}Te.kind="IndexOutOfBoundsException";class Je extends Te{constructor(e=void 0,t=void 0){super(t),this.index=e,this.message=t}}Je.kind="ArrayIndexOutOfBoundsException";class fe{static fill(e,t){for(let n=0,r=e.length;n<r;n++)e[n]=t}static fillWithin(e,t,n,r){fe.rangeCheck(e.length,t,n);for(let i=t;i<n;i++)e[i]=r}static rangeCheck(e,t,n){if(t>n)throw new N("fromIndex("+t+") > toIndex("+n+")");if(t<0)throw new Je(t);if(n>e)throw new Je(n)}static asList(...e){return e}static create(e,t,n){return Array.from({length:e}).map(i=>Array.from({length:t}).fill(n))}static createInt32Array(e,t,n){return Array.from({length:e}).map(i=>Int32Array.from({length:t}).fill(n))}static equals(e,t){if(!e||!t||!e.length||!t.length||e.length!==t.length)return!1;for(let n=0,r=e.length;n<r;n++)if(e[n]!==t[n])return!1;return!0}static hashCode(e){if(e===null)return 0;let t=1;for(const n of e)t=31*t+n;return t}static fillUint8Array(e,t){for(let n=0;n!==e.length;n++)e[n]=t}static copyOf(e,t){return e.slice(0,t)}static copyOfUint8Array(e,t){if(e.length<=t){const n=new Uint8Array(t);return n.set(e),n}return e.slice(0,t)}static copyOfRange(e,t,n){const r=n-t,i=new Int32Array(r);return q.arraycopy(e,t,i,0,r),i}static binarySearch(e,t,n){n===void 0&&(n=fe.numberComparator);let r=0,i=e.length-1;for(;r<=i;){const s=i+r>>1,o=n(t,e[s]);if(o>0)r=s+1;else if(o<0)i=s-1;else return s}return-r-1}static numberComparator(e,t){return e-t}}class K{static numberOfTrailingZeros(e){let t;if(e===0)return 32;let n=31;return t=e<<16,t!==0&&(n-=16,e=t),t=e<<8,t!==0&&(n-=8,e=t),t=e<<4,t!==0&&(n-=4,e=t),t=e<<2,t!==0&&(n-=2,e=t),n-(e<<1>>>31)}static numberOfLeadingZeros(e){if(e===0)return 32;let t=1;return e>>>16||(t+=16,e<<=16),e>>>24||(t+=8,e<<=8),e>>>28||(t+=4,e<<=4),e>>>30||(t+=2,e<<=2),t-=e>>>31,t}static toHexString(e){return e.toString(16)}static toBinaryString(e){return String(parseInt(String(e),2))}static bitCount(e){return e=e-(e>>>1&1431655765),e=(e&858993459)+(e>>>2&858993459),e=e+(e>>>4)&252645135,e=e+(e>>>8),e=e+(e>>>16),e&63}static truncDivision(e,t){return Math.trunc(e/t)}static parseInt(e,t=void 0){return parseInt(e,t)}}K.MIN_VALUE_32_BITS=-2147483648,K.MAX_VALUE=Number.MAX_SAFE_INTEGER;class he{constructor(e,t){e===void 0?(this.size=0,this.bits=new Int32Array(1)):(this.size=e,t==null?this.bits=he.makeArray(e):this.bits=t)}getSize(){return this.size}getSizeInBytes(){return Math.floor((this.size+7)/8)}ensureCapacity(e){if(e>this.bits.length*32){const t=he.makeArray(e);q.arraycopy(this.bits,0,t,0,this.bits.length),this.bits=t}}get(e){return(this.bits[Math.floor(e/32)]&1<<(e&31))!==0}set(e){this.bits[Math.floor(e/32)]|=1<<(e&31)}flip(e){this.bits[Math.floor(e/32)]^=1<<(e&31)}getNextSet(e){const t=this.size;if(e>=t)return t;const n=this.bits;let r=Math.floor(e/32),i=n[r];i&=~((1<<(e&31))-1);const s=n.length;for(;i===0;){if(++r===s)return t;i=n[r]}const o=r*32+K.numberOfTrailingZeros(i);return o>t?t:o}getNextUnset(e){const t=this.size;if(e>=t)return t;const n=this.bits;let r=Math.floor(e/32),i=~n[r];i&=~((1<<(e&31))-1);const s=n.length;for(;i===0;){if(++r===s)return t;i=~n[r]}const o=r*32+K.numberOfTrailingZeros(i);return o>t?t:o}setBulk(e,t){this.bits[Math.floor(e/32)]=t}setRange(e,t){if(t<e||e<0||t>this.size)throw new N;if(t===e)return;t--;const n=Math.floor(e/32),r=Math.floor(t/32),i=this.bits;for(let s=n;s<=r;s++){const o=s>n?0:e&31,c=(2<<(s<r?31:t&31))-(1<<o);i[s]|=c}}clear(){const e=this.bits.length,t=this.bits;for(let n=0;n<e;n++)t[n]=0}isRange(e,t,n){if(t<e||e<0||t>this.size)throw new N;if(t===e)return!0;t--;const r=Math.floor(e/32),i=Math.floor(t/32),s=this.bits;for(let o=r;o<=i;o++){const a=o>r?0:e&31,f=(2<<(o<i?31:t&31))-(1<<a)&4294967295;if((s[o]&f)!==(n?f:0))return!1}return!0}appendBit(e){this.ensureCapacity(this.size+1),e&&(this.bits[Math.floor(this.size/32)]|=1<<(this.size&31)),this.size++}appendBits(e,t){if(t<0||t>32)throw new N("Num bits must be between 0 and 32");this.ensureCapacity(this.size+t);for(let n=t;n>0;n--)this.appendBit((e>>n-1&1)===1)}appendBitArray(e){const t=e.size;this.ensureCapacity(this.size+t);for(let n=0;n<t;n++)this.appendBit(e.get(n))}xor(e){if(this.size!==e.size)throw new N("Sizes don't match");const t=this.bits;for(let n=0,r=t.length;n<r;n++)t[n]^=e.bits[n]}toBytes(e,t,n,r){for(let i=0;i<r;i++){let s=0;for(let o=0;o<8;o++)this.get(e)&&(s|=1<<7-o),e++;t[n+i]=s}}getBitArray(){return this.bits}reverse(){const e=new Int32Array(this.bits.length),t=Math.floor((this.size-1)/32),n=t+1,r=this.bits;for(let i=0;i<n;i++){let s=r[i];s=s>>1&1431655765|(s&1431655765)<<1,s=s>>2&858993459|(s&858993459)<<2,s=s>>4&252645135|(s&252645135)<<4,s=s>>8&16711935|(s&16711935)<<8,s=s>>16&65535|(s&65535)<<16,e[t-i]=s}if(this.size!==n*32){const i=n*32-this.size;let s=e[0]>>>i;for(let o=1;o<n;o++){const a=e[o];s|=a<<32-i,e[o-1]=s,s=a>>>i}e[n-1]=s}this.bits=e}static makeArray(e){return new Int32Array(Math.floor((e+31)/32))}equals(e){if(!(e instanceof he))return!1;const t=e;return this.size===t.size&&fe.equals(this.bits,t.bits)}hashCode(){return 31*this.size+fe.hashCode(this.bits)}toString(){let e="";for(let t=0,n=this.size;t<n;t++)t&7||(e+=" "),e+=this.get(t)?"X":".";return e}clone(){return new he(this.size,this.bits.slice())}}var kt;(function(g){g[g.OTHER=0]="OTHER",g[g.PURE_BARCODE=1]="PURE_BARCODE",g[g.POSSIBLE_FORMATS=2]="POSSIBLE_FORMATS",g[g.TRY_HARDER=3]="TRY_HARDER",g[g.CHARACTER_SET=4]="CHARACTER_SET",g[g.ALLOWED_LENGTHS=5]="ALLOWED_LENGTHS",g[g.ASSUME_CODE_39_CHECK_DIGIT=6]="ASSUME_CODE_39_CHECK_DIGIT",g[g.ASSUME_GS1=7]="ASSUME_GS1",g[g.RETURN_CODABAR_START_END=8]="RETURN_CODABAR_START_END",g[g.NEED_RESULT_POINT_CALLBACK=9]="NEED_RESULT_POINT_CALLBACK",g[g.ALLOWED_EAN_EXTENSIONS=10]="ALLOWED_EAN_EXTENSIONS"})(kt||(kt={}));var Ee=kt;class U extends E{static getFormatInstance(){return new U}}U.kind="FormatException";var Ce;(function(g){g[g.Cp437=0]="Cp437",g[g.ISO8859_1=1]="ISO8859_1",g[g.ISO8859_2=2]="ISO8859_2",g[g.ISO8859_3=3]="ISO8859_3",g[g.ISO8859_4=4]="ISO8859_4",g[g.ISO8859_5=5]="ISO8859_5",g[g.ISO8859_6=6]="ISO8859_6",g[g.ISO8859_7=7]="ISO8859_7",g[g.ISO8859_8=8]="ISO8859_8",g[g.ISO8859_9=9]="ISO8859_9",g[g.ISO8859_10=10]="ISO8859_10",g[g.ISO8859_11=11]="ISO8859_11",g[g.ISO8859_13=12]="ISO8859_13",g[g.ISO8859_14=13]="ISO8859_14",g[g.ISO8859_15=14]="ISO8859_15",g[g.ISO8859_16=15]="ISO8859_16",g[g.SJIS=16]="SJIS",g[g.Cp1250=17]="Cp1250",g[g.Cp1251=18]="Cp1251",g[g.Cp1252=19]="Cp1252",g[g.Cp1256=20]="Cp1256",g[g.UnicodeBigUnmarked=21]="UnicodeBigUnmarked",g[g.UTF8=22]="UTF8",g[g.ASCII=23]="ASCII",g[g.Big5=24]="Big5",g[g.GB18030=25]="GB18030",g[g.EUC_KR=26]="EUC_KR"})(Ce||(Ce={}));class F{constructor(e,t,n,...r){this.valueIdentifier=e,this.name=n,typeof t=="number"?this.values=Int32Array.from([t]):this.values=t,this.otherEncodingNames=r,F.VALUE_IDENTIFIER_TO_ECI.set(e,this),F.NAME_TO_ECI.set(n,this);const i=this.values;for(let s=0,o=i.length;s!==o;s++){const a=i[s];F.VALUES_TO_ECI.set(a,this)}for(const s of r)F.NAME_TO_ECI.set(s,this)}getValueIdentifier(){return this.valueIdentifier}getName(){return this.name}getValue(){return this.values[0]}static getCharacterSetECIByValue(e){if(e<0||e>=900)throw new U("incorect value");const t=F.VALUES_TO_ECI.get(e);if(t===void 0)throw new U("incorect value");return t}static getCharacterSetECIByName(e){const t=F.NAME_TO_ECI.get(e);if(t===void 0)throw new U("incorect value");return t}equals(e){if(!(e instanceof F))return!1;const t=e;return this.getName()===t.getName()}}F.VALUE_IDENTIFIER_TO_ECI=new Map,F.VALUES_TO_ECI=new Map,F.NAME_TO_ECI=new Map,F.Cp437=new F(Ce.Cp437,Int32Array.from([0,2]),"Cp437"),F.ISO8859_1=new F(Ce.ISO8859_1,Int32Array.from([1,3]),"ISO-8859-1","ISO88591","ISO8859_1"),F.ISO8859_2=new F(Ce.ISO8859_2,4,"ISO-8859-2","ISO88592","ISO8859_2"),F.ISO8859_3=new F(Ce.ISO8859_3,5,"ISO-8859-3","ISO88593","ISO8859_3"),F.ISO8859_4=new F(Ce.ISO8859_4,6,"ISO-8859-4","ISO88594","ISO8859_4"),F.ISO8859_5=new F(Ce.ISO8859_5,7,"ISO-8859-5","ISO88595","ISO8859_5"),F.ISO8859_6=new F(Ce.ISO8859_6,8,"ISO-8859-6","ISO88596","ISO8859_6"),F.ISO8859_7=new F(Ce.ISO8859_7,9,"ISO-8859-7","ISO88597","ISO8859_7"),F.ISO8859_8=new F(Ce.ISO8859_8,10,"ISO-8859-8","ISO88598","ISO8859_8"),F.ISO8859_9=new F(Ce.ISO8859_9,11,"ISO-8859-9","ISO88599","ISO8859_9"),F.ISO8859_10=new F(Ce.ISO8859_10,12,"ISO-8859-10","ISO885910","ISO8859_10"),F.ISO8859_11=new F(Ce.ISO8859_11,13,"ISO-8859-11","ISO885911","ISO8859_11"),F.ISO8859_13=new F(Ce.ISO8859_13,15,"ISO-8859-13","ISO885913","ISO8859_13"),F.ISO8859_14=new F(Ce.ISO8859_14,16,"ISO-8859-14","ISO885914","ISO8859_14"),F.ISO8859_15=new F(Ce.ISO8859_15,17,"ISO-8859-15","ISO885915","ISO8859_15"),F.ISO8859_16=new F(Ce.ISO8859_16,18,"ISO-8859-16","ISO885916","ISO8859_16"),F.SJIS=new F(Ce.SJIS,20,"SJIS","Shift_JIS"),F.Cp1250=new F(Ce.Cp1250,21,"Cp1250","windows-1250"),F.Cp1251=new F(Ce.Cp1251,22,"Cp1251","windows-1251"),F.Cp1252=new F(Ce.Cp1252,23,"Cp1252","windows-1252"),F.Cp1256=new F(Ce.Cp1256,24,"Cp1256","windows-1256"),F.UnicodeBigUnmarked=new F(Ce.UnicodeBigUnmarked,25,"UnicodeBigUnmarked","UTF-16BE","UnicodeBig"),F.UTF8=new F(Ce.UTF8,26,"UTF8","UTF-8"),F.ASCII=new F(Ce.ASCII,Int32Array.from([27,170]),"ASCII","US-ASCII"),F.Big5=new F(Ce.Big5,28,"Big5"),F.GB18030=new F(Ce.GB18030,29,"GB18030","GB2312","EUC_CN","GBK"),F.EUC_KR=new F(Ce.EUC_KR,30,"EUC_KR","EUC-KR");class tn extends E{}tn.kind="UnsupportedOperationException";class st{static decode(e,t){const n=this.encodingName(t);return this.customDecoder?this.customDecoder(e,n):typeof TextDecoder=="undefined"||this.shouldDecodeOnFallback(n)?this.decodeFallback(e,n):new TextDecoder(n).decode(e)}static shouldDecodeOnFallback(e){return!st.isBrowser()&&e==="ISO-8859-1"}static encode(e,t){const n=this.encodingName(t);return this.customEncoder?this.customEncoder(e,n):typeof TextEncoder=="undefined"?this.encodeFallback(e):new TextEncoder().encode(e)}static isBrowser(){return typeof window!="undefined"&&{}.toString.call(window)==="[object Window]"}static encodingName(e){return typeof e=="string"?e:e.getName()}static encodingCharacterSet(e){return e instanceof F?e:F.getCharacterSetECIByName(e)}static decodeFallback(e,t){const n=this.encodingCharacterSet(t);if(st.isDecodeFallbackSupported(n)){let r="";for(let i=0,s=e.length;i<s;i++){let o=e[i].toString(16);o.length<2&&(o="0"+o),r+="%"+o}return decodeURIComponent(r)}if(n.equals(F.UnicodeBigUnmarked))return String.fromCharCode.apply(null,new Uint16Array(e.buffer));throw new tn(`Encoding ${this.encodingName(t)} not supported by fallback.`)}static isDecodeFallbackSupported(e){return e.equals(F.UTF8)||e.equals(F.ISO8859_1)||e.equals(F.ASCII)}static encodeFallback(e){const n=btoa(unescape(encodeURIComponent(e))).split(""),r=[];for(let i=0;i<n.length;i++)r.push(n[i].charCodeAt(0));return new Uint8Array(r)}}class J{static castAsNonUtf8Char(e,t=null){const n=t?t.getName():this.ISO88591;return st.decode(new Uint8Array([e]),n)}static guessEncoding(e,t){if(t!=null&&t.get(Ee.CHARACTER_SET)!==void 0)return t.get(Ee.CHARACTER_SET).toString();const n=e.length;let r=!0,i=!0,s=!0,o=0,a=0,c=0,f=0,x=0,A=0,p=0,I=0,S=0,T=0,O=0;const P=e.length>3&&e[0]===239&&e[1]===187&&e[2]===191;for(let k=0;k<n&&(r||i||s);k++){const v=e[k]&255;s&&(o>0?v&128?o--:s=!1:v&128&&(v&64?(o++,v&32?(o++,v&16?(o++,v&8?s=!1:f++):c++):a++):s=!1)),r&&(v>127&&v<160?r=!1:v>159&&(v<192||v===215||v===247)&&O++),i&&(x>0?v<64||v===127||v>252?i=!1:x--:v===128||v===160||v>239?i=!1:v>160&&v<224?(A++,I=0,p++,p>S&&(S=p)):v>127?(x++,p=0,I++,I>T&&(T=I)):(p=0,I=0))}return s&&o>0&&(s=!1),i&&x>0&&(i=!1),s&&(P||a+c+f>0)?J.UTF8:i&&(J.ASSUME_SHIFT_JIS||S>=3||T>=3)?J.SHIFT_JIS:r&&i?S===2&&A===2||O*10>=n?J.SHIFT_JIS:J.ISO88591:r?J.ISO88591:i?J.SHIFT_JIS:s?J.UTF8:J.PLATFORM_DEFAULT_ENCODING}static format(e,...t){let n=-1;function r(s,o,a,c,f,x){if(s==="%%")return"%";if(t[++n]===void 0)return;s=c?parseInt(c.substr(1)):void 0;let A=f?parseInt(f.substr(1)):void 0,p;switch(x){case"s":p=t[n];break;case"c":p=t[n][0];break;case"f":p=parseFloat(t[n]).toFixed(s);break;case"p":p=parseFloat(t[n]).toPrecision(s);break;case"e":p=parseFloat(t[n]).toExponential(s);break;case"x":p=parseInt(t[n]).toString(A||16);break;case"d":p=parseFloat(parseInt(t[n],A||10).toPrecision(s)).toFixed(0);break}p=typeof p=="object"?JSON.stringify(p):(+p).toString(A);let I=parseInt(a),S=a&&a[0]+""=="0"?"0":" ";for(;p.length<I;)p=o!==void 0?p+S:S+p;return p}let i=/%(-)?(0?[0-9]+)?([.][0-9]+)?([#][0-9]+)?([scfpexd%])/g;return e.replace(i,r)}static getBytes(e,t){return st.encode(e,t)}static getCharCode(e,t=0){return e.charCodeAt(t)}static getCharAt(e){return String.fromCharCode(e)}}J.SHIFT_JIS=F.SJIS.getName(),J.GB2312="GB2312",J.ISO88591=F.ISO8859_1.getName(),J.EUC_JP="EUC_JP",J.UTF8=F.UTF8.getName(),J.PLATFORM_DEFAULT_ENCODING=J.UTF8,J.ASSUME_SHIFT_JIS=!1;class me{constructor(e=""){this.value=e}enableDecoding(e){return this.encoding=e,this}append(e){return typeof e=="string"?this.value+=e.toString():this.encoding?this.value+=J.castAsNonUtf8Char(e,this.encoding):this.value+=String.fromCharCode(e),this}appendChars(e,t,n){for(let r=t;t<t+n;r++)this.append(e[r]);return this}length(){return this.value.length}charAt(e){return this.value.charAt(e)}deleteCharAt(e){this.value=this.value.substr(0,e)+this.value.substring(e+1)}setCharAt(e,t){this.value=this.value.substr(0,e)+t+this.value.substr(e+1)}substring(e,t){return this.value.substring(e,t)}setLengthToZero(){this.value=""}toString(){return this.value}insert(e,t){this.value=this.value.substr(0,e)+t+this.value.substr(e+t.length)}}class je{constructor(e,t,n,r){if(this.width=e,this.height=t,this.rowSize=n,this.bits=r,t==null&&(t=e),this.height=t,e<1||t<1)throw new N("Both dimensions must be greater than 0");n==null&&(n=Math.floor((e+31)/32)),this.rowSize=n,r==null&&(this.bits=new Int32Array(this.rowSize*this.height))}static parseFromBooleanArray(e){const t=e.length,n=e[0].length,r=new je(n,t);for(let i=0;i<t;i++){const s=e[i];for(let o=0;o<n;o++)s[o]&&r.set(o,i)}return r}static parseFromString(e,t,n){if(e===null)throw new N("stringRepresentation cannot be null");const r=new Array(e.length);let i=0,s=0,o=-1,a=0,c=0;for(;c<e.length;)if(e.charAt(c)===`
|
|
17
|
+
`}));function Si(){var d,y;const h=Ve.useFieldSchema(),u=(d=h["x-component-props"])==null?void 0:d.icon,l=(y=h["x-component-props"])==null?void 0:y.iconColor,{styles:w,cx:C}=Tr();return ee.jsxs("div",{children:[ee.jsx(dn.Avatar,{style:{backgroundColor:l},size:64,icon:ee.jsx(Z.Icon,{type:u})}),ee.jsx("div",{className:C(w.title),children:h.title})]})}const yi=Z.withDynamicSchemaProps(h=>{const d=h,{className:u}=d,l=Kn(d,["className"]),{styles:w,cx:C}=Tr();return ee.jsx(Z.Action,Rn(Dn({className:C(u,w.action)},l),{icon:null,title:ee.jsx(Si,{})}))}),Ti=Ve.observer(()=>{const h=Ve.useFieldSchema(),{render:u}=Z.useSchemaInitializerRender(h["x-initializer"]);return u()},{displayName:"WorkbenchConfigureActionsButton"}),bi=()=>{const h=Ve.useFieldSchema(),{designable:u}=Z.useDesignable();return ee.jsx("div",{style:{marginBottom:u?"1rem":0},children:ee.jsx(Z.DndContext,{children:ee.jsx(dn.Space,{wrap:!0,children:h.mapProperties((l,w)=>ee.jsx(Ve.RecursionField,{name:w,schema:l}))})})})},br=Z.withDynamicSchemaProps(h=>ee.jsx("div",{children:ee.jsx(Z.SchemaComponentOptions,{components:{WorkbenchAction:yi},children:h.children})}),{displayName:"WorkbenchBlock"});br.ActionBar=()=>ee.jsxs(ee.Fragment,{children:[ee.jsx(bi,{}),ee.jsx(Ti,{})]});function Nr(h){const E=h,{modalSchema:u={}}=E,l=Kn(E,["modalSchema"]),_=u,{properties:w}=_,C=Kn(_,["properties"]),[d,y]=mt.useState(!1),{setVisible:D}=Z.useSchemaInitializer(),B=mt.useMemo(()=>Rn(Dn({name:xn.uid(),"x-component":"Action.Modal","x-component-props":{width:"520px"},type:"void","x-decorator":"FormV2","x-decorator-props":{}},C),{properties:Rn(Dn({},w),{footer1:{"x-component":"Action.Modal.Footer",type:"void",properties:{close:{title:"Cancel","x-component":"Action","x-component-props":{type:"default"},"x-use-component-props":()=>({onClick(){var N;y(!1),(N=h==null?void 0:h.onCancel)==null||N.call(h)}})},submit:{title:"OK","x-component":"Action","x-component-props":{type:"primary"},"x-use-component-props":()=>{const N=Ve.useForm();return{onClick(){return yr(this,null,function*(){var $;yield N.submit(),y(!1),($=h==null?void 0:h.onSubmit)==null||$.call(h,N.values)})}}}}}}})}),[d]);return ee.jsxs(ee.Fragment,{children:[ee.jsx(Z.SchemaInitializerItem,Rn(Dn({},l),{onClick:N=>{var se;D(!1),y(!0),(se=h==null?void 0:h.onClick)==null||se.call(h,N)}})),ee.jsx(Z.ActionContextProvider,{value:{visible:d,setVisible:y},children:ee.jsx(Z.SchemaComponent,{components:{Action:Z.Action},schema:B})})]})}const Ni=new Z.SchemaSettings({name:"workbench:actionSettings:link",items:[{name:"editButton",Component:Z.ButtonEditor,useComponentProps(){return{hasIconColor:!0}}},{name:"editLink",Component:Z.SchemaSettingsActionLinkItem},{sort:800,name:"d1",type:"divider"},{sort:900,type:"remove",name:"remove"}]});function Mi(h){const u=Z.useSchemaInitializerItem(),{insert:l}=Z.useSchemaInitializer(),{t:w}=gn.useTranslation();return ee.jsx(Nr,{title:u.title,modalSchema:{title:w("Add link"),properties:{title:{title:w("Title"),required:!0,"x-component":"Input","x-decorator":"FormItem"},icon:{title:w("Icon"),required:!0,"x-component":"IconPicker","x-decorator":"FormItem"},iconColor:{title:w("Color"),required:!0,default:"#1677FF","x-component":"ColorPicker","x-decorator":"FormItem"}}},onSubmit:C=>{l({type:"void",title:C.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:C.icon,iconColor:C.iconColor}})}})}const Oi=new Z.SchemaSettings({name:"workbench:actionSettings:scanQrCode",items:[{name:"editButton",Component:Z.ButtonEditor,useComponentProps(){return{hasIconColor:!0}}},{name:"d1",type:"divider"},{type:"remove",name:"remove"}]});function _i(h){Z.useSchemaInitializerItem();const{insert:u}=Z.useSchemaInitializer(),{t:l}=gn.useTranslation(),w=()=>{const{setVisible:C}=Z.useActionContext();return{run(){C(!1)}}};return ee.jsx(Nr,{title:l("Scan QR code",{ns:"block-workbench"}),modalSchema:{title:l("Scan QR code",{ns:"block-workbench"}),properties:{title:{title:l("Title"),required:!0,"x-component":"Input","x-decorator":"FormItem"},icon:{title:l("Icon"),required:!0,"x-component":"IconPicker","x-decorator":"FormItem"},iconColor:{title:l("Color"),required:!0,default:"#1677FF","x-component":"ColorPicker","x-decorator":"FormItem"}}},onSubmit:C=>{u({type:"void",title:C.title,"x-component":"WorkbenchAction","x-toolbar":"ActionSchemaToolbar","x-settings":"workbench:actionSettings:scanQrCode","x-component-props":{icon:C.icon,iconColor:C.iconColor,openMode:"modal"},properties:{modal:{type:"void","x-component":"Action.Modal",title:l("Scan QR code",{ns:"block-workbench"}),"x-decorator":"FormV2",properties:{scanner:{"x-component":"QRCodeScanner","x-component-props":{fps:10,qrbox:250,disableFlip:!1}},footer:{type:"void","x-component":"Action.Modal.Footer",properties:{close:{title:"Close","x-component":"Action","x-component-props":{type:"default",useAction:w}}}}}}}})}})}var z;(function(h){h[h.QR_CODE=0]="QR_CODE",h[h.AZTEC=1]="AZTEC",h[h.CODABAR=2]="CODABAR",h[h.CODE_39=3]="CODE_39",h[h.CODE_93=4]="CODE_93",h[h.CODE_128=5]="CODE_128",h[h.DATA_MATRIX=6]="DATA_MATRIX",h[h.MAXICODE=7]="MAXICODE",h[h.ITF=8]="ITF",h[h.EAN_13=9]="EAN_13",h[h.EAN_8=10]="EAN_8",h[h.PDF_417=11]="PDF_417",h[h.RSS_14=12]="RSS_14",h[h.RSS_EXPANDED=13]="RSS_EXPANDED",h[h.UPC_A=14]="UPC_A",h[h.UPC_E=15]="UPC_E",h[h.UPC_EAN_EXTENSION=16]="UPC_EAN_EXTENSION"})(z||(z={}));var Mr=new Map([[z.QR_CODE,"QR_CODE"],[z.AZTEC,"AZTEC"],[z.CODABAR,"CODABAR"],[z.CODE_39,"CODE_39"],[z.CODE_93,"CODE_93"],[z.CODE_128,"CODE_128"],[z.DATA_MATRIX,"DATA_MATRIX"],[z.MAXICODE,"MAXICODE"],[z.ITF,"ITF"],[z.EAN_13,"EAN_13"],[z.EAN_8,"EAN_8"],[z.PDF_417,"PDF_417"],[z.RSS_14,"RSS_14"],[z.RSS_EXPANDED,"RSS_EXPANDED"],[z.UPC_A,"UPC_A"],[z.UPC_E,"UPC_E"],[z.UPC_EAN_EXTENSION,"UPC_EAN_EXTENSION"]]),Or;(function(h){h[h.UNKNOWN=0]="UNKNOWN",h[h.URL=1]="URL"})(Or||(Or={}));function Di(h){return Object.values(z).includes(h)}var vt;(function(h){h[h.SCAN_TYPE_CAMERA=0]="SCAN_TYPE_CAMERA",h[h.SCAN_TYPE_FILE=1]="SCAN_TYPE_FILE"})(vt||(vt={}));var pt=function(){function h(){}return h.GITHUB_PROJECT_URL="https://github.com/mebjas/html5-qrcode",h.SCAN_DEFAULT_FPS=2,h.DEFAULT_DISABLE_FLIP=!1,h.DEFAULT_REMEMBER_LAST_CAMERA_USED=!0,h.DEFAULT_SUPPORTED_SCAN_TYPE=[vt.SCAN_TYPE_CAMERA,vt.SCAN_TYPE_FILE],h}(),_r=function(){function h(u,l){this.format=u,this.formatName=l}return h.prototype.toString=function(){return this.formatName},h.create=function(u){if(!Mr.has(u))throw"".concat(u," not in html5QrcodeSupportedFormatsTextMap");return new h(u,Mr.get(u))},h}(),Dr=function(){function h(){}return h.createFromText=function(u){var l={text:u};return{decodedText:u,result:l}},h.createFromQrcodeResult=function(u){return{decodedText:u.text,result:u}},h}(),Jn;(function(h){h[h.UNKWOWN_ERROR=0]="UNKWOWN_ERROR",h[h.IMPLEMENTATION_ERROR=1]="IMPLEMENTATION_ERROR",h[h.NO_CODE_FOUND_ERROR=2]="NO_CODE_FOUND_ERROR"})(Jn||(Jn={}));var Rr=function(){function h(){}return h.createFrom=function(u){return{errorMessage:u,type:Jn.UNKWOWN_ERROR}},h}(),Br=function(){function h(u){this.verbose=u}return h.prototype.log=function(u){this.verbose&&console.log(u)},h.prototype.warn=function(u){this.verbose&&console.warn(u)},h.prototype.logError=function(u,l){(this.verbose||l===!0)&&console.error(u)},h.prototype.logErrors=function(u){if(u.length===0)throw"Logger#logError called without arguments";this.verbose&&console.error(u)},h}();function Tt(h){return typeof h=="undefined"||h===null}function Ri(h,u,l){return h>l?l:h<u?u:h}var en=function(){function h(){}return h.codeParseError=function(u){return"QR code parse error, error = ".concat(u)},h.errorGettingUserMedia=function(u){return"Error getting userMedia, error = ".concat(u)},h.onlyDeviceSupportedError=function(){return"The device doesn't support navigator.mediaDevices , only supported cameraIdOrConfig in this case is deviceId parameter (string)."},h.cameraStreamingNotSupported=function(){return"Camera streaming not supported by the browser."},h.unableToQuerySupportedDevices=function(){return"Unable to query supported devices, unknown error."},h.insecureContextCameraQueryError=function(){return"Camera access is only supported in secure context like https or localhost."},h.scannerPaused=function(){return"Scanner paused"},h}(),Ae=function(){function h(){}return h.scanningStatus=function(){return"Scanning"},h.idleStatus=function(){return"Idle"},h.errorStatus=function(){return"Error"},h.permissionStatus=function(){return"Permission"},h.noCameraFoundErrorStatus=function(){return"No Cameras"},h.lastMatch=function(u){return"Last Match: ".concat(u)},h.codeScannerTitle=function(){return"Code Scanner"},h.cameraPermissionTitle=function(){return"Request Camera Permissions"},h.cameraPermissionRequesting=function(){return"Requesting camera permissions..."},h.noCameraFound=function(){return"No camera found"},h.scanButtonStopScanningText=function(){return"Stop Scanning"},h.scanButtonStartScanningText=function(){return"Start Scanning"},h.torchOnButton=function(){return"Switch On Torch"},h.torchOffButton=function(){return"Switch Off Torch"},h.torchOnFailedMessage=function(){return"Failed to turn on torch"},h.torchOffFailedMessage=function(){return"Failed to turn off torch"},h.scanButtonScanningStarting=function(){return"Launching Camera..."},h.textIfCameraScanSelected=function(){return"Scan an Image File"},h.textIfFileScanSelected=function(){return"Scan using camera directly"},h.selectCamera=function(){return"Select Camera"},h.fileSelectionChooseImage=function(){return"Choose Image"},h.fileSelectionChooseAnother=function(){return"Choose Another"},h.fileSelectionNoImageSelected=function(){return"No image choosen"},h.anonymousCameraPrefix=function(){return"Anonymous Camera"},h.dragAndDropMessage=function(){return"Or drop an image to scan"},h.dragAndDropMessageOnlyImages=function(){return"Or drop an image to scan (other files not supported)"},h.zoom=function(){return"zoom"},h.loadingImage=function(){return"Loading image..."},h.cameraScanAltText=function(){return"Camera based scan"},h.fileScanAltText=function(){return"Fule based scan"},h}(),Lr=function(){function h(){}return h.poweredBy=function(){return"Powered by "},h.reportIssues=function(){return"Report issues"},h}(),vr=function(){function h(){}return h.isMediaStreamConstraintsValid=function(u,l){if(typeof u!="object"){var w=typeof u;return l.logError("videoConstraints should be of type object, the "+"object passed is of type ".concat(w,"."),!0),!1}for(var C=["autoGainControl","channelCount","echoCancellation","latency","noiseSuppression","sampleRate","sampleSize","volume"],d=new Set(C),y=Object.keys(u),D=0,B=y;D<B.length;D++){var E=B[D];if(d.has(E))return l.logError("".concat(E," is not supported videoConstaints."),!0),!1}return!0},h}(),An=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{};function Bi(h){return h&&h.__esModule&&Object.prototype.hasOwnProperty.call(h,"default")?h.default:h}var $n={exports:{}};(function(h,u){(function(l,w){w(u)})(An,function(l){function w(g){return g==null}var C=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(g,e){g.__proto__=e}||function(g,e){for(var t in e)e.hasOwnProperty(t)&&(g[t]=e[t])};function d(g,e){C(g,e);function t(){this.constructor=g}g.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}function y(g,e){var t=Object.setPrototypeOf;t?t(g,e):g.__proto__=e}function D(g,e){e===void 0&&(e=g.constructor);var t=Error.captureStackTrace;t&&t(g,e)}var B=function(g){d(e,g);function e(t){var n=this.constructor,r=g.call(this,t)||this;return Object.defineProperty(r,"name",{value:n.name,enumerable:!1}),y(r,n.prototype),D(r),r}return e}(Error);class E extends B{constructor(e=void 0){super(e),this.message=e}getKind(){return this.constructor.kind}}E.kind="Exception";class _ extends E{}_.kind="ArgumentException";class N extends E{}N.kind="IllegalArgumentException";class se{constructor(e){if(this.binarizer=e,e===null)throw new N("Binarizer must be non-null.")}getWidth(){return this.binarizer.getWidth()}getHeight(){return this.binarizer.getHeight()}getBlackRow(e,t){return this.binarizer.getBlackRow(e,t)}getBlackMatrix(){return(this.matrix===null||this.matrix===void 0)&&(this.matrix=this.binarizer.getBlackMatrix()),this.matrix}isCropSupported(){return this.binarizer.getLuminanceSource().isCropSupported()}crop(e,t,n,r){const i=this.binarizer.getLuminanceSource().crop(e,t,n,r);return new se(this.binarizer.createBinarizer(i))}isRotateSupported(){return this.binarizer.getLuminanceSource().isRotateSupported()}rotateCounterClockwise(){const e=this.binarizer.getLuminanceSource().rotateCounterClockwise();return new se(this.binarizer.createBinarizer(e))}rotateCounterClockwise45(){const e=this.binarizer.getLuminanceSource().rotateCounterClockwise45();return new se(this.binarizer.createBinarizer(e))}toString(){try{return this.getBlackMatrix().toString()}catch(e){return""}}}class $ extends E{static getChecksumInstance(){return new $}}$.kind="ChecksumException";class ke{constructor(e){this.source=e}getLuminanceSource(){return this.source}getWidth(){return this.source.getWidth()}getHeight(){return this.source.getHeight()}}class q{static arraycopy(e,t,n,r,i){for(;i--;)n[r++]=e[t++]}static currentTimeMillis(){return Date.now()}}class Te extends E{}Te.kind="IndexOutOfBoundsException";class Je extends Te{constructor(e=void 0,t=void 0){super(t),this.index=e,this.message=t}}Je.kind="ArrayIndexOutOfBoundsException";class fe{static fill(e,t){for(let n=0,r=e.length;n<r;n++)e[n]=t}static fillWithin(e,t,n,r){fe.rangeCheck(e.length,t,n);for(let i=t;i<n;i++)e[i]=r}static rangeCheck(e,t,n){if(t>n)throw new N("fromIndex("+t+") > toIndex("+n+")");if(t<0)throw new Je(t);if(n>e)throw new Je(n)}static asList(...e){return e}static create(e,t,n){return Array.from({length:e}).map(i=>Array.from({length:t}).fill(n))}static createInt32Array(e,t,n){return Array.from({length:e}).map(i=>Int32Array.from({length:t}).fill(n))}static equals(e,t){if(!e||!t||!e.length||!t.length||e.length!==t.length)return!1;for(let n=0,r=e.length;n<r;n++)if(e[n]!==t[n])return!1;return!0}static hashCode(e){if(e===null)return 0;let t=1;for(const n of e)t=31*t+n;return t}static fillUint8Array(e,t){for(let n=0;n!==e.length;n++)e[n]=t}static copyOf(e,t){return e.slice(0,t)}static copyOfUint8Array(e,t){if(e.length<=t){const n=new Uint8Array(t);return n.set(e),n}return e.slice(0,t)}static copyOfRange(e,t,n){const r=n-t,i=new Int32Array(r);return q.arraycopy(e,t,i,0,r),i}static binarySearch(e,t,n){n===void 0&&(n=fe.numberComparator);let r=0,i=e.length-1;for(;r<=i;){const s=i+r>>1,o=n(t,e[s]);if(o>0)r=s+1;else if(o<0)i=s-1;else return s}return-r-1}static numberComparator(e,t){return e-t}}class K{static numberOfTrailingZeros(e){let t;if(e===0)return 32;let n=31;return t=e<<16,t!==0&&(n-=16,e=t),t=e<<8,t!==0&&(n-=8,e=t),t=e<<4,t!==0&&(n-=4,e=t),t=e<<2,t!==0&&(n-=2,e=t),n-(e<<1>>>31)}static numberOfLeadingZeros(e){if(e===0)return 32;let t=1;return e>>>16||(t+=16,e<<=16),e>>>24||(t+=8,e<<=8),e>>>28||(t+=4,e<<=4),e>>>30||(t+=2,e<<=2),t-=e>>>31,t}static toHexString(e){return e.toString(16)}static toBinaryString(e){return String(parseInt(String(e),2))}static bitCount(e){return e=e-(e>>>1&1431655765),e=(e&858993459)+(e>>>2&858993459),e=e+(e>>>4)&252645135,e=e+(e>>>8),e=e+(e>>>16),e&63}static truncDivision(e,t){return Math.trunc(e/t)}static parseInt(e,t=void 0){return parseInt(e,t)}}K.MIN_VALUE_32_BITS=-2147483648,K.MAX_VALUE=Number.MAX_SAFE_INTEGER;class he{constructor(e,t){e===void 0?(this.size=0,this.bits=new Int32Array(1)):(this.size=e,t==null?this.bits=he.makeArray(e):this.bits=t)}getSize(){return this.size}getSizeInBytes(){return Math.floor((this.size+7)/8)}ensureCapacity(e){if(e>this.bits.length*32){const t=he.makeArray(e);q.arraycopy(this.bits,0,t,0,this.bits.length),this.bits=t}}get(e){return(this.bits[Math.floor(e/32)]&1<<(e&31))!==0}set(e){this.bits[Math.floor(e/32)]|=1<<(e&31)}flip(e){this.bits[Math.floor(e/32)]^=1<<(e&31)}getNextSet(e){const t=this.size;if(e>=t)return t;const n=this.bits;let r=Math.floor(e/32),i=n[r];i&=~((1<<(e&31))-1);const s=n.length;for(;i===0;){if(++r===s)return t;i=n[r]}const o=r*32+K.numberOfTrailingZeros(i);return o>t?t:o}getNextUnset(e){const t=this.size;if(e>=t)return t;const n=this.bits;let r=Math.floor(e/32),i=~n[r];i&=~((1<<(e&31))-1);const s=n.length;for(;i===0;){if(++r===s)return t;i=~n[r]}const o=r*32+K.numberOfTrailingZeros(i);return o>t?t:o}setBulk(e,t){this.bits[Math.floor(e/32)]=t}setRange(e,t){if(t<e||e<0||t>this.size)throw new N;if(t===e)return;t--;const n=Math.floor(e/32),r=Math.floor(t/32),i=this.bits;for(let s=n;s<=r;s++){const o=s>n?0:e&31,c=(2<<(s<r?31:t&31))-(1<<o);i[s]|=c}}clear(){const e=this.bits.length,t=this.bits;for(let n=0;n<e;n++)t[n]=0}isRange(e,t,n){if(t<e||e<0||t>this.size)throw new N;if(t===e)return!0;t--;const r=Math.floor(e/32),i=Math.floor(t/32),s=this.bits;for(let o=r;o<=i;o++){const a=o>r?0:e&31,f=(2<<(o<i?31:t&31))-(1<<a)&4294967295;if((s[o]&f)!==(n?f:0))return!1}return!0}appendBit(e){this.ensureCapacity(this.size+1),e&&(this.bits[Math.floor(this.size/32)]|=1<<(this.size&31)),this.size++}appendBits(e,t){if(t<0||t>32)throw new N("Num bits must be between 0 and 32");this.ensureCapacity(this.size+t);for(let n=t;n>0;n--)this.appendBit((e>>n-1&1)===1)}appendBitArray(e){const t=e.size;this.ensureCapacity(this.size+t);for(let n=0;n<t;n++)this.appendBit(e.get(n))}xor(e){if(this.size!==e.size)throw new N("Sizes don't match");const t=this.bits;for(let n=0,r=t.length;n<r;n++)t[n]^=e.bits[n]}toBytes(e,t,n,r){for(let i=0;i<r;i++){let s=0;for(let o=0;o<8;o++)this.get(e)&&(s|=1<<7-o),e++;t[n+i]=s}}getBitArray(){return this.bits}reverse(){const e=new Int32Array(this.bits.length),t=Math.floor((this.size-1)/32),n=t+1,r=this.bits;for(let i=0;i<n;i++){let s=r[i];s=s>>1&1431655765|(s&1431655765)<<1,s=s>>2&858993459|(s&858993459)<<2,s=s>>4&252645135|(s&252645135)<<4,s=s>>8&16711935|(s&16711935)<<8,s=s>>16&65535|(s&65535)<<16,e[t-i]=s}if(this.size!==n*32){const i=n*32-this.size;let s=e[0]>>>i;for(let o=1;o<n;o++){const a=e[o];s|=a<<32-i,e[o-1]=s,s=a>>>i}e[n-1]=s}this.bits=e}static makeArray(e){return new Int32Array(Math.floor((e+31)/32))}equals(e){if(!(e instanceof he))return!1;const t=e;return this.size===t.size&&fe.equals(this.bits,t.bits)}hashCode(){return 31*this.size+fe.hashCode(this.bits)}toString(){let e="";for(let t=0,n=this.size;t<n;t++)t&7||(e+=" "),e+=this.get(t)?"X":".";return e}clone(){return new he(this.size,this.bits.slice())}}var kt;(function(g){g[g.OTHER=0]="OTHER",g[g.PURE_BARCODE=1]="PURE_BARCODE",g[g.POSSIBLE_FORMATS=2]="POSSIBLE_FORMATS",g[g.TRY_HARDER=3]="TRY_HARDER",g[g.CHARACTER_SET=4]="CHARACTER_SET",g[g.ALLOWED_LENGTHS=5]="ALLOWED_LENGTHS",g[g.ASSUME_CODE_39_CHECK_DIGIT=6]="ASSUME_CODE_39_CHECK_DIGIT",g[g.ASSUME_GS1=7]="ASSUME_GS1",g[g.RETURN_CODABAR_START_END=8]="RETURN_CODABAR_START_END",g[g.NEED_RESULT_POINT_CALLBACK=9]="NEED_RESULT_POINT_CALLBACK",g[g.ALLOWED_EAN_EXTENSIONS=10]="ALLOWED_EAN_EXTENSIONS"})(kt||(kt={}));var Ee=kt;class U extends E{static getFormatInstance(){return new U}}U.kind="FormatException";var Ce;(function(g){g[g.Cp437=0]="Cp437",g[g.ISO8859_1=1]="ISO8859_1",g[g.ISO8859_2=2]="ISO8859_2",g[g.ISO8859_3=3]="ISO8859_3",g[g.ISO8859_4=4]="ISO8859_4",g[g.ISO8859_5=5]="ISO8859_5",g[g.ISO8859_6=6]="ISO8859_6",g[g.ISO8859_7=7]="ISO8859_7",g[g.ISO8859_8=8]="ISO8859_8",g[g.ISO8859_9=9]="ISO8859_9",g[g.ISO8859_10=10]="ISO8859_10",g[g.ISO8859_11=11]="ISO8859_11",g[g.ISO8859_13=12]="ISO8859_13",g[g.ISO8859_14=13]="ISO8859_14",g[g.ISO8859_15=14]="ISO8859_15",g[g.ISO8859_16=15]="ISO8859_16",g[g.SJIS=16]="SJIS",g[g.Cp1250=17]="Cp1250",g[g.Cp1251=18]="Cp1251",g[g.Cp1252=19]="Cp1252",g[g.Cp1256=20]="Cp1256",g[g.UnicodeBigUnmarked=21]="UnicodeBigUnmarked",g[g.UTF8=22]="UTF8",g[g.ASCII=23]="ASCII",g[g.Big5=24]="Big5",g[g.GB18030=25]="GB18030",g[g.EUC_KR=26]="EUC_KR"})(Ce||(Ce={}));class F{constructor(e,t,n,...r){this.valueIdentifier=e,this.name=n,typeof t=="number"?this.values=Int32Array.from([t]):this.values=t,this.otherEncodingNames=r,F.VALUE_IDENTIFIER_TO_ECI.set(e,this),F.NAME_TO_ECI.set(n,this);const i=this.values;for(let s=0,o=i.length;s!==o;s++){const a=i[s];F.VALUES_TO_ECI.set(a,this)}for(const s of r)F.NAME_TO_ECI.set(s,this)}getValueIdentifier(){return this.valueIdentifier}getName(){return this.name}getValue(){return this.values[0]}static getCharacterSetECIByValue(e){if(e<0||e>=900)throw new U("incorect value");const t=F.VALUES_TO_ECI.get(e);if(t===void 0)throw new U("incorect value");return t}static getCharacterSetECIByName(e){const t=F.NAME_TO_ECI.get(e);if(t===void 0)throw new U("incorect value");return t}equals(e){if(!(e instanceof F))return!1;const t=e;return this.getName()===t.getName()}}F.VALUE_IDENTIFIER_TO_ECI=new Map,F.VALUES_TO_ECI=new Map,F.NAME_TO_ECI=new Map,F.Cp437=new F(Ce.Cp437,Int32Array.from([0,2]),"Cp437"),F.ISO8859_1=new F(Ce.ISO8859_1,Int32Array.from([1,3]),"ISO-8859-1","ISO88591","ISO8859_1"),F.ISO8859_2=new F(Ce.ISO8859_2,4,"ISO-8859-2","ISO88592","ISO8859_2"),F.ISO8859_3=new F(Ce.ISO8859_3,5,"ISO-8859-3","ISO88593","ISO8859_3"),F.ISO8859_4=new F(Ce.ISO8859_4,6,"ISO-8859-4","ISO88594","ISO8859_4"),F.ISO8859_5=new F(Ce.ISO8859_5,7,"ISO-8859-5","ISO88595","ISO8859_5"),F.ISO8859_6=new F(Ce.ISO8859_6,8,"ISO-8859-6","ISO88596","ISO8859_6"),F.ISO8859_7=new F(Ce.ISO8859_7,9,"ISO-8859-7","ISO88597","ISO8859_7"),F.ISO8859_8=new F(Ce.ISO8859_8,10,"ISO-8859-8","ISO88598","ISO8859_8"),F.ISO8859_9=new F(Ce.ISO8859_9,11,"ISO-8859-9","ISO88599","ISO8859_9"),F.ISO8859_10=new F(Ce.ISO8859_10,12,"ISO-8859-10","ISO885910","ISO8859_10"),F.ISO8859_11=new F(Ce.ISO8859_11,13,"ISO-8859-11","ISO885911","ISO8859_11"),F.ISO8859_13=new F(Ce.ISO8859_13,15,"ISO-8859-13","ISO885913","ISO8859_13"),F.ISO8859_14=new F(Ce.ISO8859_14,16,"ISO-8859-14","ISO885914","ISO8859_14"),F.ISO8859_15=new F(Ce.ISO8859_15,17,"ISO-8859-15","ISO885915","ISO8859_15"),F.ISO8859_16=new F(Ce.ISO8859_16,18,"ISO-8859-16","ISO885916","ISO8859_16"),F.SJIS=new F(Ce.SJIS,20,"SJIS","Shift_JIS"),F.Cp1250=new F(Ce.Cp1250,21,"Cp1250","windows-1250"),F.Cp1251=new F(Ce.Cp1251,22,"Cp1251","windows-1251"),F.Cp1252=new F(Ce.Cp1252,23,"Cp1252","windows-1252"),F.Cp1256=new F(Ce.Cp1256,24,"Cp1256","windows-1256"),F.UnicodeBigUnmarked=new F(Ce.UnicodeBigUnmarked,25,"UnicodeBigUnmarked","UTF-16BE","UnicodeBig"),F.UTF8=new F(Ce.UTF8,26,"UTF8","UTF-8"),F.ASCII=new F(Ce.ASCII,Int32Array.from([27,170]),"ASCII","US-ASCII"),F.Big5=new F(Ce.Big5,28,"Big5"),F.GB18030=new F(Ce.GB18030,29,"GB18030","GB2312","EUC_CN","GBK"),F.EUC_KR=new F(Ce.EUC_KR,30,"EUC_KR","EUC-KR");class tn extends E{}tn.kind="UnsupportedOperationException";class st{static decode(e,t){const n=this.encodingName(t);return this.customDecoder?this.customDecoder(e,n):typeof TextDecoder=="undefined"||this.shouldDecodeOnFallback(n)?this.decodeFallback(e,n):new TextDecoder(n).decode(e)}static shouldDecodeOnFallback(e){return!st.isBrowser()&&e==="ISO-8859-1"}static encode(e,t){const n=this.encodingName(t);return this.customEncoder?this.customEncoder(e,n):typeof TextEncoder=="undefined"?this.encodeFallback(e):new TextEncoder().encode(e)}static isBrowser(){return typeof window!="undefined"&&{}.toString.call(window)==="[object Window]"}static encodingName(e){return typeof e=="string"?e:e.getName()}static encodingCharacterSet(e){return e instanceof F?e:F.getCharacterSetECIByName(e)}static decodeFallback(e,t){const n=this.encodingCharacterSet(t);if(st.isDecodeFallbackSupported(n)){let r="";for(let i=0,s=e.length;i<s;i++){let o=e[i].toString(16);o.length<2&&(o="0"+o),r+="%"+o}return decodeURIComponent(r)}if(n.equals(F.UnicodeBigUnmarked))return String.fromCharCode.apply(null,new Uint16Array(e.buffer));throw new tn(`Encoding ${this.encodingName(t)} not supported by fallback.`)}static isDecodeFallbackSupported(e){return e.equals(F.UTF8)||e.equals(F.ISO8859_1)||e.equals(F.ASCII)}static encodeFallback(e){const n=btoa(unescape(encodeURIComponent(e))).split(""),r=[];for(let i=0;i<n.length;i++)r.push(n[i].charCodeAt(0));return new Uint8Array(r)}}class J{static castAsNonUtf8Char(e,t=null){const n=t?t.getName():this.ISO88591;return st.decode(new Uint8Array([e]),n)}static guessEncoding(e,t){if(t!=null&&t.get(Ee.CHARACTER_SET)!==void 0)return t.get(Ee.CHARACTER_SET).toString();const n=e.length;let r=!0,i=!0,s=!0,o=0,a=0,c=0,f=0,x=0,A=0,p=0,I=0,S=0,T=0,O=0;const P=e.length>3&&e[0]===239&&e[1]===187&&e[2]===191;for(let k=0;k<n&&(r||i||s);k++){const v=e[k]&255;s&&(o>0?v&128?o--:s=!1:v&128&&(v&64?(o++,v&32?(o++,v&16?(o++,v&8?s=!1:f++):c++):a++):s=!1)),r&&(v>127&&v<160?r=!1:v>159&&(v<192||v===215||v===247)&&O++),i&&(x>0?v<64||v===127||v>252?i=!1:x--:v===128||v===160||v>239?i=!1:v>160&&v<224?(A++,I=0,p++,p>S&&(S=p)):v>127?(x++,p=0,I++,I>T&&(T=I)):(p=0,I=0))}return s&&o>0&&(s=!1),i&&x>0&&(i=!1),s&&(P||a+c+f>0)?J.UTF8:i&&(J.ASSUME_SHIFT_JIS||S>=3||T>=3)?J.SHIFT_JIS:r&&i?S===2&&A===2||O*10>=n?J.SHIFT_JIS:J.ISO88591:r?J.ISO88591:i?J.SHIFT_JIS:s?J.UTF8:J.PLATFORM_DEFAULT_ENCODING}static format(e,...t){let n=-1;function r(s,o,a,c,f,x){if(s==="%%")return"%";if(t[++n]===void 0)return;s=c?parseInt(c.substr(1)):void 0;let A=f?parseInt(f.substr(1)):void 0,p;switch(x){case"s":p=t[n];break;case"c":p=t[n][0];break;case"f":p=parseFloat(t[n]).toFixed(s);break;case"p":p=parseFloat(t[n]).toPrecision(s);break;case"e":p=parseFloat(t[n]).toExponential(s);break;case"x":p=parseInt(t[n]).toString(A||16);break;case"d":p=parseFloat(parseInt(t[n],A||10).toPrecision(s)).toFixed(0);break}p=typeof p=="object"?JSON.stringify(p):(+p).toString(A);let I=parseInt(a),S=a&&a[0]+""=="0"?"0":" ";for(;p.length<I;)p=o!==void 0?p+S:S+p;return p}let i=/%(-)?(0?[0-9]+)?([.][0-9]+)?([#][0-9]+)?([scfpexd%])/g;return e.replace(i,r)}static getBytes(e,t){return st.encode(e,t)}static getCharCode(e,t=0){return e.charCodeAt(t)}static getCharAt(e){return String.fromCharCode(e)}}J.SHIFT_JIS=F.SJIS.getName(),J.GB2312="GB2312",J.ISO88591=F.ISO8859_1.getName(),J.EUC_JP="EUC_JP",J.UTF8=F.UTF8.getName(),J.PLATFORM_DEFAULT_ENCODING=J.UTF8,J.ASSUME_SHIFT_JIS=!1;class me{constructor(e=""){this.value=e}enableDecoding(e){return this.encoding=e,this}append(e){return typeof e=="string"?this.value+=e.toString():this.encoding?this.value+=J.castAsNonUtf8Char(e,this.encoding):this.value+=String.fromCharCode(e),this}appendChars(e,t,n){for(let r=t;t<t+n;r++)this.append(e[r]);return this}length(){return this.value.length}charAt(e){return this.value.charAt(e)}deleteCharAt(e){this.value=this.value.substr(0,e)+this.value.substring(e+1)}setCharAt(e,t){this.value=this.value.substr(0,e)+t+this.value.substr(e+1)}substring(e,t){return this.value.substring(e,t)}setLengthToZero(){this.value=""}toString(){return this.value}insert(e,t){this.value=this.value.substr(0,e)+t+this.value.substr(e+t.length)}}class je{constructor(e,t,n,r){if(this.width=e,this.height=t,this.rowSize=n,this.bits=r,t==null&&(t=e),this.height=t,e<1||t<1)throw new N("Both dimensions must be greater than 0");n==null&&(n=Math.floor((e+31)/32)),this.rowSize=n,r==null&&(this.bits=new Int32Array(this.rowSize*this.height))}static parseFromBooleanArray(e){const t=e.length,n=e[0].length,r=new je(n,t);for(let i=0;i<t;i++){const s=e[i];for(let o=0;o<n;o++)s[o]&&r.set(o,i)}return r}static parseFromString(e,t,n){if(e===null)throw new N("stringRepresentation cannot be null");const r=new Array(e.length);let i=0,s=0,o=-1,a=0,c=0;for(;c<e.length;)if(e.charAt(c)===`
|
|
18
18
|
`||e.charAt(c)==="\r"){if(i>s){if(o===-1)o=i-s;else if(i-s!==o)throw new N("row lengths do not match");s=i,a++}c++}else if(e.substring(c,c+t.length)===t)c+=t.length,r[i]=!0,i++;else if(e.substring(c,c+n.length)===n)c+=n.length,r[i]=!1,i++;else throw new N("illegal character encountered: "+e.substring(c));if(i>s){if(o===-1)o=i-s;else if(i-s!==o)throw new N("row lengths do not match");a++}const f=new je(o,a);for(let x=0;x<i;x++)r[x]&&f.set(Math.floor(x%o),Math.floor(x/o));return f}get(e,t){const n=t*this.rowSize+Math.floor(e/32);return(this.bits[n]>>>(e&31)&1)!==0}set(e,t){const n=t*this.rowSize+Math.floor(e/32);this.bits[n]|=1<<(e&31)&4294967295}unset(e,t){const n=t*this.rowSize+Math.floor(e/32);this.bits[n]&=~(1<<(e&31)&4294967295)}flip(e,t){const n=t*this.rowSize+Math.floor(e/32);this.bits[n]^=1<<(e&31)&4294967295}xor(e){if(this.width!==e.getWidth()||this.height!==e.getHeight()||this.rowSize!==e.getRowSize())throw new N("input matrix dimensions do not match");const t=new he(Math.floor(this.width/32)+1),n=this.rowSize,r=this.bits;for(let i=0,s=this.height;i<s;i++){const o=i*n,a=e.getRow(i,t).getBitArray();for(let c=0;c<n;c++)r[o+c]^=a[c]}}clear(){const e=this.bits,t=e.length;for(let n=0;n<t;n++)e[n]=0}setRegion(e,t,n,r){if(t<0||e<0)throw new N("Left and top must be nonnegative");if(r<1||n<1)throw new N("Height and width must be at least 1");const i=e+n,s=t+r;if(s>this.height||i>this.width)throw new N("The region must fit inside the matrix");const o=this.rowSize,a=this.bits;for(let c=t;c<s;c++){const f=c*o;for(let x=e;x<i;x++)a[f+Math.floor(x/32)]|=1<<(x&31)&4294967295}}getRow(e,t){t==null||t.getSize()<this.width?t=new he(this.width):t.clear();const n=this.rowSize,r=this.bits,i=e*n;for(let s=0;s<n;s++)t.setBulk(s*32,r[i+s]);return t}setRow(e,t){q.arraycopy(t.getBitArray(),0,this.bits,e*this.rowSize,this.rowSize)}rotate180(){const e=this.getWidth(),t=this.getHeight();let n=new he(e),r=new he(e);for(let i=0,s=Math.floor((t+1)/2);i<s;i++)n=this.getRow(i,n),r=this.getRow(t-1-i,r),n.reverse(),r.reverse(),this.setRow(i,r),this.setRow(t-1-i,n)}getEnclosingRectangle(){const e=this.width,t=this.height,n=this.rowSize,r=this.bits;let i=e,s=t,o=-1,a=-1;for(let c=0;c<t;c++)for(let f=0;f<n;f++){const x=r[c*n+f];if(x!==0){if(c<s&&(s=c),c>a&&(a=c),f*32<i){let A=0;for(;!(x<<31-A&4294967295);)A++;f*32+A<i&&(i=f*32+A)}if(f*32+31>o){let A=31;for(;!(x>>>A);)A--;f*32+A>o&&(o=f*32+A)}}}return o<i||a<s?null:Int32Array.from([i,s,o-i+1,a-s+1])}getTopLeftOnBit(){const e=this.rowSize,t=this.bits;let n=0;for(;n<t.length&&t[n]===0;)n++;if(n===t.length)return null;const r=n/e;let i=n%e*32;const s=t[n];let o=0;for(;!(s<<31-o&4294967295);)o++;return i+=o,Int32Array.from([i,r])}getBottomRightOnBit(){const e=this.rowSize,t=this.bits;let n=t.length-1;for(;n>=0&&t[n]===0;)n--;if(n<0)return null;const r=Math.floor(n/e);let i=Math.floor(n%e)*32;const s=t[n];let o=31;for(;!(s>>>o);)o--;return i+=o,Int32Array.from([i,r])}getWidth(){return this.width}getHeight(){return this.height}getRowSize(){return this.rowSize}equals(e){if(!(e instanceof je))return!1;const t=e;return this.width===t.width&&this.height===t.height&&this.rowSize===t.rowSize&&fe.equals(this.bits,t.bits)}hashCode(){let e=this.width;return e=31*e+this.width,e=31*e+this.height,e=31*e+this.rowSize,e=31*e+fe.hashCode(this.bits),e}toString(e="X ",t=" ",n=`
|
|
19
19
|
`){return this.buildToString(e,t,n)}buildToString(e,t,n){let r=new me;for(let i=0,s=this.height;i<s;i++){for(let o=0,a=this.width;o<a;o++)r.append(this.get(o,i)?e:t);r.append(n)}return r.toString()}clone(){return new je(this.width,this.height,this.rowSize,this.bits.slice())}}class R extends E{static getNotFoundInstance(){return new R}}R.kind="NotFoundException";class Ge extends ke{constructor(e){super(e),this.luminances=Ge.EMPTY,this.buckets=new Int32Array(Ge.LUMINANCE_BUCKETS)}getBlackRow(e,t){const n=this.getLuminanceSource(),r=n.getWidth();t==null||t.getSize()<r?t=new he(r):t.clear(),this.initArrays(r);const i=n.getRow(e,this.luminances),s=this.buckets;for(let a=0;a<r;a++)s[(i[a]&255)>>Ge.LUMINANCE_SHIFT]++;const o=Ge.estimateBlackPoint(s);if(r<3)for(let a=0;a<r;a++)(i[a]&255)<o&&t.set(a);else{let a=i[0]&255,c=i[1]&255;for(let f=1;f<r-1;f++){const x=i[f+1]&255;(c*4-a-x)/2<o&&t.set(f),a=c,c=x}}return t}getBlackMatrix(){const e=this.getLuminanceSource(),t=e.getWidth(),n=e.getHeight(),r=new je(t,n);this.initArrays(t);const i=this.buckets;for(let a=1;a<5;a++){const c=Math.floor(n*a/5),f=e.getRow(c,this.luminances),x=Math.floor(t*4/5);for(let A=Math.floor(t/5);A<x;A++){const p=f[A]&255;i[p>>Ge.LUMINANCE_SHIFT]++}}const s=Ge.estimateBlackPoint(i),o=e.getMatrix();for(let a=0;a<n;a++){const c=a*t;for(let f=0;f<t;f++)(o[c+f]&255)<s&&r.set(f,a)}return r}createBinarizer(e){return new Ge(e)}initArrays(e){this.luminances.length<e&&(this.luminances=new Uint8ClampedArray(e));const t=this.buckets;for(let n=0;n<Ge.LUMINANCE_BUCKETS;n++)t[n]=0}static estimateBlackPoint(e){const t=e.length;let n=0,r=0,i=0;for(let f=0;f<t;f++)e[f]>i&&(r=f,i=e[f]),e[f]>n&&(n=e[f]);let s=0,o=0;for(let f=0;f<t;f++){const x=f-r,A=e[f]*x*x;A>o&&(s=f,o=A)}if(r>s){const f=r;r=s,s=f}if(s-r<=t/16)throw new R;let a=s-1,c=-1;for(let f=s-1;f>r;f--){const x=f-r,A=x*x*(s-f)*(n-e[f]);A>c&&(a=f,c=A)}return a<<Ge.LUMINANCE_SHIFT}}Ge.LUMINANCE_BITS=5,Ge.LUMINANCE_SHIFT=8-Ge.LUMINANCE_BITS,Ge.LUMINANCE_BUCKETS=1<<Ge.LUMINANCE_BITS,Ge.EMPTY=Uint8ClampedArray.from([0]);class ne extends Ge{constructor(e){super(e),this.matrix=null}getBlackMatrix(){if(this.matrix!==null)return this.matrix;const e=this.getLuminanceSource(),t=e.getWidth(),n=e.getHeight();if(t>=ne.MINIMUM_DIMENSION&&n>=ne.MINIMUM_DIMENSION){const r=e.getMatrix();let i=t>>ne.BLOCK_SIZE_POWER;t&ne.BLOCK_SIZE_MASK&&i++;let s=n>>ne.BLOCK_SIZE_POWER;n&ne.BLOCK_SIZE_MASK&&s++;const o=ne.calculateBlackPoints(r,i,s,t,n),a=new je(t,n);ne.calculateThresholdForBlock(r,i,s,t,n,o,a),this.matrix=a}else this.matrix=super.getBlackMatrix();return this.matrix}createBinarizer(e){return new ne(e)}static calculateThresholdForBlock(e,t,n,r,i,s,o){const a=i-ne.BLOCK_SIZE,c=r-ne.BLOCK_SIZE;for(let f=0;f<n;f++){let x=f<<ne.BLOCK_SIZE_POWER;x>a&&(x=a);const A=ne.cap(f,2,n-3);for(let p=0;p<t;p++){let I=p<<ne.BLOCK_SIZE_POWER;I>c&&(I=c);const S=ne.cap(p,2,t-3);let T=0;for(let P=-2;P<=2;P++){const k=s[A+P];T+=k[S-2]+k[S-1]+k[S]+k[S+1]+k[S+2]}const O=T/25;ne.thresholdBlock(e,I,x,O,r,o)}}}static cap(e,t,n){return e<t?t:e>n?n:e}static thresholdBlock(e,t,n,r,i,s){for(let o=0,a=n*i+t;o<ne.BLOCK_SIZE;o++,a+=i)for(let c=0;c<ne.BLOCK_SIZE;c++)(e[a+c]&255)<=r&&s.set(t+c,n+o)}static calculateBlackPoints(e,t,n,r,i){const s=i-ne.BLOCK_SIZE,o=r-ne.BLOCK_SIZE,a=new Array(n);for(let c=0;c<n;c++){a[c]=new Int32Array(t);let f=c<<ne.BLOCK_SIZE_POWER;f>s&&(f=s);for(let x=0;x<t;x++){let A=x<<ne.BLOCK_SIZE_POWER;A>o&&(A=o);let p=0,I=255,S=0;for(let O=0,P=f*r+A;O<ne.BLOCK_SIZE;O++,P+=r){for(let k=0;k<ne.BLOCK_SIZE;k++){const v=e[P+k]&255;p+=v,v<I&&(I=v),v>S&&(S=v)}if(S-I>ne.MIN_DYNAMIC_RANGE)for(O++,P+=r;O<ne.BLOCK_SIZE;O++,P+=r)for(let k=0;k<ne.BLOCK_SIZE;k++)p+=e[P+k]&255}let T=p>>ne.BLOCK_SIZE_POWER*2;if(S-I<=ne.MIN_DYNAMIC_RANGE&&(T=I/2,c>0&&x>0)){const O=(a[c-1][x]+2*a[c][x-1]+a[c-1][x-1])/4;I<O&&(T=O)}a[c][x]=T}}return a}}ne.BLOCK_SIZE_POWER=3,ne.BLOCK_SIZE=1<<ne.BLOCK_SIZE_POWER,ne.BLOCK_SIZE_MASK=ne.BLOCK_SIZE-1,ne.MINIMUM_DIMENSION=ne.BLOCK_SIZE*5,ne.MIN_DYNAMIC_RANGE=24;class Cn{constructor(e,t){this.width=e,this.height=t}getWidth(){return this.width}getHeight(){return this.height}isCropSupported(){return!1}crop(e,t,n,r){throw new tn("This luminance source does not support cropping.")}isRotateSupported(){return!1}rotateCounterClockwise(){throw new tn("This luminance source does not support rotation by 90 degrees.")}rotateCounterClockwise45(){throw new tn("This luminance source does not support rotation by 45 degrees.")}toString(){const e=new Uint8ClampedArray(this.width);let t=new me;for(let n=0;n<this.height;n++){const r=this.getRow(n,e);for(let i=0;i<this.width;i++){const s=r[i]&255;let o;s<64?o="#":s<128?o="+":s<192?o=".":o=" ",t.append(o)}t.append(`
|
|
20
20
|
`)}return t.toString()}}class Ft extends Cn{constructor(e){super(e.getWidth(),e.getHeight()),this.delegate=e}getRow(e,t){const n=this.delegate.getRow(e,t),r=this.getWidth();for(let i=0;i<r;i++)n[i]=255-(n[i]&255);return n}getMatrix(){const e=this.delegate.getMatrix(),t=this.getWidth()*this.getHeight(),n=new Uint8ClampedArray(t);for(let r=0;r<t;r++)n[r]=255-(e[r]&255);return n}isCropSupported(){return this.delegate.isCropSupported()}crop(e,t,n,r){return new Ft(this.delegate.crop(e,t,n,r))}isRotateSupported(){return this.delegate.isRotateSupported()}invert(){return this.delegate}rotateCounterClockwise(){return new Ft(this.delegate.rotateCounterClockwise())}rotateCounterClockwise45(){return new Ft(this.delegate.rotateCounterClockwise45())}}class Ut extends Cn{constructor(e){super(e.width,e.height),this.canvas=e,this.tempCanvasElement=null,this.buffer=Ut.makeBufferFromCanvasImageData(e)}static makeBufferFromCanvasImageData(e){const t=e.getContext("2d").getImageData(0,0,e.width,e.height);return Ut.toGrayscaleBuffer(t.data,e.width,e.height)}static toGrayscaleBuffer(e,t,n){const r=new Uint8ClampedArray(t*n);for(let i=0,s=0,o=e.length;i<o;i+=4,s++){let a;if(e[i+3]===0)a=255;else{const f=e[i],x=e[i+1],A=e[i+2];a=306*f+601*x+117*A+512>>10}r[s]=a}return r}getRow(e,t){if(e<0||e>=this.getHeight())throw new N("Requested row is outside the image: "+e);const n=this.getWidth(),r=e*n;return t===null?t=this.buffer.slice(r,r+n):(t.length<n&&(t=new Uint8ClampedArray(n)),t.set(this.buffer.slice(r,r+n))),t}getMatrix(){return this.buffer}isCropSupported(){return!0}crop(e,t,n,r){return super.crop(e,t,n,r),this}isRotateSupported(){return!0}rotateCounterClockwise(){return this.rotate(-90),this}rotateCounterClockwise45(){return this.rotate(-45),this}getTempCanvasElement(){if(this.tempCanvasElement===null){const e=this.canvas.ownerDocument.createElement("canvas");e.width=this.canvas.width,e.height=this.canvas.height,this.tempCanvasElement=e}return this.tempCanvasElement}rotate(e){const t=this.getTempCanvasElement(),n=t.getContext("2d"),r=e*Ut.DEGREE_TO_RADIANS,i=this.canvas.width,s=this.canvas.height,o=Math.ceil(Math.abs(Math.cos(r))*i+Math.abs(Math.sin(r))*s),a=Math.ceil(Math.abs(Math.sin(r))*i+Math.abs(Math.cos(r))*s);return t.width=o,t.height=a,n.translate(o/2,a/2),n.rotate(r),n.drawImage(this.canvas,i/-2,s/-2),this.buffer=Ut.makeBufferFromCanvasImageData(t),this}invert(){return new Ft(this)}}Ut.DEGREE_TO_RADIANS=Math.PI/180;class Jr{constructor(e,t,n){this.deviceId=e,this.label=t,this.kind="videoinput",this.groupId=n||void 0}toJSON(){return{kind:this.kind,groupId:this.groupId,deviceId:this.deviceId,label:this.label}}}var tt=(globalThis||An||self||window||void 0)&&(globalThis||An||self||window||void 0).__awaiter||function(g,e,t,n){function r(i){return i instanceof t?i:new t(function(s){s(i)})}return new(t||(t=Promise))(function(i,s){function o(f){try{c(n.next(f))}catch(x){s(x)}}function a(f){try{c(n.throw(f))}catch(x){s(x)}}function c(f){f.done?i(f.value):r(f.value).then(o,a)}c((n=n.apply(g,e||[])).next())})};class Xt{constructor(e,t=500,n){this.reader=e,this.timeBetweenScansMillis=t,this._hints=n,this._stopContinuousDecode=!1,this._stopAsyncDecode=!1,this._timeBetweenDecodingAttempts=0}get hasNavigator(){return typeof navigator!="undefined"}get isMediaDevicesSuported(){return this.hasNavigator&&!!navigator.mediaDevices}get canEnumerateDevices(){return!!(this.isMediaDevicesSuported&&navigator.mediaDevices.enumerateDevices)}get timeBetweenDecodingAttempts(){return this._timeBetweenDecodingAttempts}set timeBetweenDecodingAttempts(e){this._timeBetweenDecodingAttempts=e<0?0:e}set hints(e){this._hints=e||null}get hints(){return this._hints}listVideoInputDevices(){return tt(this,void 0,void 0,function*(){if(!this.hasNavigator)throw new Error("Can't enumerate devices, navigator is not present.");if(!this.canEnumerateDevices)throw new Error("Can't enumerate devices, method not supported.");const e=yield navigator.mediaDevices.enumerateDevices(),t=[];for(const n of e){const r=n.kind==="video"?"videoinput":n.kind;if(r!=="videoinput")continue;const i=n.deviceId||n.id,s=n.label||`Video device ${t.length+1}`,o=n.groupId,a={deviceId:i,label:s,kind:r,groupId:o};t.push(a)}return t})}getVideoInputDevices(){return tt(this,void 0,void 0,function*(){return(yield this.listVideoInputDevices()).map(t=>new Jr(t.deviceId,t.label))})}findDeviceById(e){return tt(this,void 0,void 0,function*(){const t=yield this.listVideoInputDevices();return t?t.find(n=>n.deviceId===e):null})}decodeFromInputVideoDevice(e,t){return tt(this,void 0,void 0,function*(){return yield this.decodeOnceFromVideoDevice(e,t)})}decodeOnceFromVideoDevice(e,t){return tt(this,void 0,void 0,function*(){this.reset();let n;e?n={deviceId:{exact:e}}:n={facingMode:"environment"};const r={video:n};return yield this.decodeOnceFromConstraints(r,t)})}decodeOnceFromConstraints(e,t){return tt(this,void 0,void 0,function*(){const n=yield navigator.mediaDevices.getUserMedia(e);return yield this.decodeOnceFromStream(n,t)})}decodeOnceFromStream(e,t){return tt(this,void 0,void 0,function*(){this.reset();const n=yield this.attachStreamToVideo(e,t);return yield this.decodeOnce(n)})}decodeFromInputVideoDeviceContinuously(e,t,n){return tt(this,void 0,void 0,function*(){return yield this.decodeFromVideoDevice(e,t,n)})}decodeFromVideoDevice(e,t,n){return tt(this,void 0,void 0,function*(){let r;e?r={deviceId:{exact:e}}:r={facingMode:"environment"};const i={video:r};return yield this.decodeFromConstraints(i,t,n)})}decodeFromConstraints(e,t,n){return tt(this,void 0,void 0,function*(){const r=yield navigator.mediaDevices.getUserMedia(e);return yield this.decodeFromStream(r,t,n)})}decodeFromStream(e,t,n){return tt(this,void 0,void 0,function*(){this.reset();const r=yield this.attachStreamToVideo(e,t);return yield this.decodeContinuously(r,n)})}stopAsyncDecode(){this._stopAsyncDecode=!0}stopContinuousDecode(){this._stopContinuousDecode=!0}attachStreamToVideo(e,t){return tt(this,void 0,void 0,function*(){const n=this.prepareVideoElement(t);return this.addVideoSource(n,e),this.videoElement=n,this.stream=e,yield this.playVideoOnLoadAsync(n),n})}playVideoOnLoadAsync(e){return new Promise((t,n)=>this.playVideoOnLoad(e,()=>t()))}playVideoOnLoad(e,t){this.videoEndedListener=()=>this.stopStreams(),this.videoCanPlayListener=()=>this.tryPlayVideo(e),e.addEventListener("ended",this.videoEndedListener),e.addEventListener("canplay",this.videoCanPlayListener),e.addEventListener("playing",t),this.tryPlayVideo(e)}isVideoPlaying(e){return e.currentTime>0&&!e.paused&&!e.ended&&e.readyState>2}tryPlayVideo(e){return tt(this,void 0,void 0,function*(){if(this.isVideoPlaying(e)){console.warn("Trying to play video that is already playing.");return}try{yield e.play()}catch(t){console.warn("It was not possible to play the video.")}})}getMediaElement(e,t){const n=document.getElementById(e);if(!n)throw new _(`element with id '${e}' not found`);if(n.nodeName.toLowerCase()!==t.toLowerCase())throw new _(`element with id '${e}' must be an ${t} element`);return n}decodeFromImage(e,t){if(!e&&!t)throw new _("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 _("Either an element with a src set or an URL must be provided");return t&&!e?this.decodeFromVideoUrl(t):this.decodeFromVideoElement(e)}decodeFromVideoContinuously(e,t,n){if(e===void 0&&t===void 0)throw new _("Either an element with a src set or an URL must be provided");return t&&!e?this.decodeFromVideoUrlContinuously(t,n):this.decodeFromVideoElementContinuously(e,n)}decodeFromImageElement(e){if(!e)throw new _("An image element must be provided.");this.reset();const t=this.prepareImageElement(e);this.imageElement=t;let n;return this.isImageLoaded(t)?n=this.decodeOnce(t,!1,!0):n=this._decodeOnLoadImage(t),n}decodeFromVideoElement(e){const t=this._decodeFromVideoElementSetup(e);return this._decodeOnLoadVideo(t)}decodeFromVideoElementContinuously(e,t){const n=this._decodeFromVideoElementSetup(e);return this._decodeOnLoadVideoContinuously(n,t)}_decodeFromVideoElementSetup(e){if(!e)throw new _("A video element must be provided.");this.reset();const t=this.prepareVideoElement(e);return this.videoElement=t,t}decodeFromImageUrl(e){if(!e)throw new _("An URL must be provided.");this.reset();const t=this.prepareImageElement();this.imageElement=t;const n=this._decodeOnLoadImage(t);return t.src=e,n}decodeFromVideoUrl(e){if(!e)throw new _("An URL must be provided.");this.reset();const t=this.prepareVideoElement(),n=this.decodeFromVideoElement(t);return t.src=e,n}decodeFromVideoUrlContinuously(e,t){if(!e)throw new _("An URL must be provided.");this.reset();const n=this.prepareVideoElement(),r=this.decodeFromVideoElementContinuously(n,t);return n.src=e,r}_decodeOnLoadImage(e){return new Promise((t,n)=>{this.imageLoadedListener=()=>this.decodeOnce(e,!1,!0).then(t,n),e.addEventListener("load",this.imageLoadedListener)})}_decodeOnLoadVideo(e){return tt(this,void 0,void 0,function*(){return yield this.playVideoOnLoadAsync(e),yield this.decodeOnce(e)})}_decodeOnLoadVideoContinuously(e,t){return tt(this,void 0,void 0,function*(){yield this.playVideoOnLoadAsync(e),this.decodeContinuously(e,t)})}isImageLoaded(e){return!(!e.complete||e.naturalWidth===0)}prepareImageElement(e){let t;return typeof e=="undefined"&&(t=document.createElement("img"),t.width=200,t.height=200),typeof e=="string"&&(t=this.getMediaElement(e,"img")),e instanceof HTMLImageElement&&(t=e),t}prepareVideoElement(e){let t;return!e&&typeof document!="undefined"&&(t=document.createElement("video"),t.width=200,t.height=200),typeof e=="string"&&(t=this.getMediaElement(e,"video")),e instanceof HTMLVideoElement&&(t=e),t.setAttribute("autoplay","true"),t.setAttribute("muted","true"),t.setAttribute("playsinline","true"),t}decodeOnce(e,t=!0,n=!0){this._stopAsyncDecode=!1;const r=(i,s)=>{if(this._stopAsyncDecode){s(new R("Video stream has ended before any code could be detected.")),this._stopAsyncDecode=void 0;return}try{const o=this.decode(e);i(o)}catch(o){const a=t&&o instanceof R,f=(o instanceof $||o instanceof U)&&n;if(a||f)return setTimeout(r,this._timeBetweenDecodingAttempts,i,s);s(o)}};return new Promise((i,s)=>r(i,s))}decodeContinuously(e,t){this._stopContinuousDecode=!1;const n=()=>{if(this._stopContinuousDecode){this._stopContinuousDecode=void 0;return}try{const r=this.decode(e);t(r,null),setTimeout(n,this.timeBetweenScansMillis)}catch(r){t(null,r);const i=r instanceof $||r instanceof U,s=r instanceof R;(i||s)&&setTimeout(n,this._timeBetweenDecodingAttempts)}};n()}decode(e){const t=this.createBinaryBitmap(e);return this.decodeBitmap(t)}_isHTMLVideoElement(e){return e.videoWidth!==0}drawFrameOnCanvas(e,t,n){t||(t={sx:0,sy:0,sWidth:e.videoWidth,sHeight:e.videoHeight,dx:0,dy:0,dWidth:e.videoWidth,dHeight:e.videoHeight}),n||(n=this.captureCanvasContext),n.drawImage(e,t.sx,t.sy,t.sWidth,t.sHeight,t.dx,t.dy,t.dWidth,t.dHeight)}drawImageOnCanvas(e,t,n=this.captureCanvasContext){t||(t={sx:0,sy:0,sWidth:e.naturalWidth,sHeight:e.naturalHeight,dx:0,dy:0,dWidth:e.naturalWidth,dHeight:e.naturalHeight}),n||(n=this.captureCanvasContext),n.drawImage(e,t.sx,t.sy,t.sWidth,t.sHeight,t.dx,t.dy,t.dWidth,t.dHeight)}createBinaryBitmap(e){this.getCaptureCanvasContext(e),this._isHTMLVideoElement(e)?this.drawFrameOnCanvas(e):this.drawImageOnCanvas(e);const t=this.getCaptureCanvas(e),n=new Ut(t),r=new ne(n);return new se(r)}getCaptureCanvasContext(e){if(!this.captureCanvasContext){const n=this.getCaptureCanvas(e).getContext("2d");this.captureCanvasContext=n}return this.captureCanvasContext}getCaptureCanvas(e){if(!this.captureCanvas){const t=this.createCaptureCanvas(e);this.captureCanvas=t}return this.captureCanvas}decodeBitmap(e){return this.reader.decode(e,this._hints)}createCaptureCanvas(e){if(typeof document=="undefined")return this._destroyCaptureCanvas(),null;const t=document.createElement("canvas");let n,r;return typeof e!="undefined"&&(e instanceof HTMLVideoElement?(n=e.videoWidth,r=e.videoHeight):e instanceof HTMLImageElement&&(n=e.naturalWidth||e.width,r=e.naturalHeight||e.height)),t.style.width=n+"px",t.style.height=r+"px",t.width=n,t.height=r,t}stopStreams(){this.stream&&(this.stream.getVideoTracks().forEach(e=>e.stop()),this.stream=void 0),this._stopAsyncDecode===!1&&this.stopAsyncDecode(),this._stopContinuousDecode===!1&&this.stopContinuousDecode()}reset(){this.stopStreams(),this._destroyVideoElement(),this._destroyImageElement(),this._destroyCaptureCanvas()}_destroyVideoElement(){this.videoElement&&(typeof this.videoEndedListener!="undefined"&&this.videoElement.removeEventListener("ended",this.videoEndedListener),typeof this.videoPlayingEventListener!="undefined"&&this.videoElement.removeEventListener("playing",this.videoPlayingEventListener),typeof this.videoCanPlayListener!="undefined"&&this.videoElement.removeEventListener("loadedmetadata",this.videoCanPlayListener),this.cleanVideoSource(this.videoElement),this.videoElement=void 0)}_destroyImageElement(){this.imageElement&&(this.imageLoadedListener!==void 0&&this.imageElement.removeEventListener("load",this.imageLoadedListener),this.imageElement.src=void 0,this.imageElement.removeAttribute("src"),this.imageElement=void 0)}_destroyCaptureCanvas(){this.captureCanvasContext=void 0,this.captureCanvas=void 0}addVideoSource(e,t){try{e.srcObject=t}catch(n){e.src=URL.createObjectURL(t)}}cleanVideoSource(e){try{e.srcObject=null}catch(t){e.src=""}this.videoElement.removeAttribute("src")}}class nt{constructor(e,t,n=t==null?0:8*t.length,r,i,s=q.currentTimeMillis()){this.text=e,this.rawBytes=t,this.numBits=n,this.resultPoints=r,this.format=i,this.timestamp=s,this.text=e,this.rawBytes=t,n==null?this.numBits=t==null?0:8*t.length:this.numBits=n,this.resultPoints=r,this.format=i,this.resultMetadata=null,s==null?this.timestamp=q.currentTimeMillis():this.timestamp=s}getText(){return this.text}getRawBytes(){return this.rawBytes}getNumBits(){return this.numBits}getResultPoints(){return this.resultPoints}getBarcodeFormat(){return this.format}getResultMetadata(){return this.resultMetadata}putMetadata(e,t){this.resultMetadata===null&&(this.resultMetadata=new Map),this.resultMetadata.set(e,t)}putAllMetadata(e){e!==null&&(this.resultMetadata===null?this.resultMetadata=e:this.resultMetadata=new Map(e))}addResultPoints(e){const t=this.resultPoints;if(t===null)this.resultPoints=e;else if(e!==null&&e.length>0){const n=new Array(t.length+e.length);q.arraycopy(t,0,n,0,t.length),q.arraycopy(e,0,n,t.length,e.length),this.resultPoints=n}}getTimestamp(){return this.timestamp}toString(){return this.text}}var nr;(function(g){g[g.AZTEC=0]="AZTEC",g[g.CODABAR=1]="CODABAR",g[g.CODE_39=2]="CODE_39",g[g.CODE_93=3]="CODE_93",g[g.CODE_128=4]="CODE_128",g[g.DATA_MATRIX=5]="DATA_MATRIX",g[g.EAN_8=6]="EAN_8",g[g.EAN_13=7]="EAN_13",g[g.ITF=8]="ITF",g[g.MAXICODE=9]="MAXICODE",g[g.PDF_417=10]="PDF_417",g[g.QR_CODE=11]="QR_CODE",g[g.RSS_14=12]="RSS_14",g[g.RSS_EXPANDED=13]="RSS_EXPANDED",g[g.UPC_A=14]="UPC_A",g[g.UPC_E=15]="UPC_E",g[g.UPC_EAN_EXTENSION=16]="UPC_EAN_EXTENSION"})(nr||(nr={}));var Y=nr,rr;(function(g){g[g.OTHER=0]="OTHER",g[g.ORIENTATION=1]="ORIENTATION",g[g.BYTE_SEGMENTS=2]="BYTE_SEGMENTS",g[g.ERROR_CORRECTION_LEVEL=3]="ERROR_CORRECTION_LEVEL",g[g.ISSUE_NUMBER=4]="ISSUE_NUMBER",g[g.SUGGESTED_PRICE=5]="SUGGESTED_PRICE",g[g.POSSIBLE_COUNTRY=6]="POSSIBLE_COUNTRY",g[g.UPC_EAN_EXTENSION=7]="UPC_EAN_EXTENSION",g[g.PDF417_EXTRA_METADATA=8]="PDF417_EXTRA_METADATA",g[g.STRUCTURED_APPEND_SEQUENCE=9]="STRUCTURED_APPEND_SEQUENCE",g[g.STRUCTURED_APPEND_PARITY=10]="STRUCTURED_APPEND_PARITY"})(rr||(rr={}));var We=rr;class En{constructor(e,t,n,r,i=-1,s=-1){this.rawBytes=e,this.text=t,this.byteSegments=n,this.ecLevel=r,this.structuredAppendSequenceNumber=i,this.structuredAppendParity=s,this.numBits=e==null?0:8*e.length}getRawBytes(){return this.rawBytes}getNumBits(){return this.numBits}setNumBits(e){this.numBits=e}getText(){return this.text}getByteSegments(){return this.byteSegments}getECLevel(){return this.ecLevel}getErrorsCorrected(){return this.errorsCorrected}setErrorsCorrected(e){this.errorsCorrected=e}getErasures(){return this.erasures}setErasures(e){this.erasures=e}getOther(){return this.other}setOther(e){this.other=e}hasStructuredAppend(){return this.structuredAppendParity>=0&&this.structuredAppendSequenceNumber>=0}getStructuredAppendParity(){return this.structuredAppendParity}getStructuredAppendSequenceNumber(){return this.structuredAppendSequenceNumber}}class mn{exp(e){return this.expTable[e]}log(e){if(e===0)throw new N;return this.logTable[e]}static addOrSubtract(e,t){return e^t}}class ot{constructor(e,t){if(t.length===0)throw new N;this.field=e;const n=t.length;if(n>1&&t[0]===0){let r=1;for(;r<n&&t[r]===0;)r++;r===n?this.coefficients=Int32Array.from([0]):(this.coefficients=new Int32Array(n-r),q.arraycopy(t,r,this.coefficients,0,this.coefficients.length))}else this.coefficients=t}getCoefficients(){return this.coefficients}getDegree(){return this.coefficients.length-1}isZero(){return this.coefficients[0]===0}getCoefficient(e){return this.coefficients[this.coefficients.length-1-e]}evaluateAt(e){if(e===0)return this.getCoefficient(0);const t=this.coefficients;let n;if(e===1){n=0;for(let s=0,o=t.length;s!==o;s++){const a=t[s];n=mn.addOrSubtract(n,a)}return n}n=t[0];const r=t.length,i=this.field;for(let s=1;s<r;s++)n=mn.addOrSubtract(i.multiply(e,n),t[s]);return n}addOrSubtract(e){if(!this.field.equals(e.field))throw new N("GenericGFPolys do not have same GenericGF field");if(this.isZero())return e;if(e.isZero())return this;let t=this.coefficients,n=e.coefficients;if(t.length>n.length){const s=t;t=n,n=s}let r=new Int32Array(n.length);const i=n.length-t.length;q.arraycopy(n,0,r,0,i);for(let s=i;s<n.length;s++)r[s]=mn.addOrSubtract(t[s-i],n[s]);return new ot(this.field,r)}multiply(e){if(!this.field.equals(e.field))throw new N("GenericGFPolys do not have same GenericGF field");if(this.isZero()||e.isZero())return this.field.getZero();const t=this.coefficients,n=t.length,r=e.coefficients,i=r.length,s=new Int32Array(n+i-1),o=this.field;for(let a=0;a<n;a++){const c=t[a];for(let f=0;f<i;f++)s[a+f]=mn.addOrSubtract(s[a+f],o.multiply(c,r[f]))}return new ot(o,s)}multiplyScalar(e){if(e===0)return this.field.getZero();if(e===1)return this;const t=this.coefficients.length,n=this.field,r=new Int32Array(t),i=this.coefficients;for(let s=0;s<t;s++)r[s]=n.multiply(i[s],e);return new ot(n,r)}multiplyByMonomial(e,t){if(e<0)throw new N;if(t===0)return this.field.getZero();const n=this.coefficients,r=n.length,i=new Int32Array(r+e),s=this.field;for(let o=0;o<r;o++)i[o]=s.multiply(n[o],t);return new ot(s,i)}divide(e){if(!this.field.equals(e.field))throw new N("GenericGFPolys do not have same GenericGF field");if(e.isZero())throw new N("Divide by 0");const t=this.field;let n=t.getZero(),r=this;const i=e.getCoefficient(e.getDegree()),s=t.inverse(i);for(;r.getDegree()>=e.getDegree()&&!r.isZero();){const o=r.getDegree()-e.getDegree(),a=t.multiply(r.getCoefficient(r.getDegree()),s),c=e.multiplyByMonomial(o,a),f=t.buildMonomial(o,a);n=n.addOrSubtract(f),r=r.addOrSubtract(c)}return[n,r]}toString(){let e="";for(let t=this.getDegree();t>=0;t--){let n=this.getCoefficient(t);if(n!==0){if(n<0?(e+=" - ",n=-n):e.length>0&&(e+=" + "),t===0||n!==1){const r=this.field.log(n);r===0?e+="1":r===1?e+="a":(e+="a^",e+=r)}t!==0&&(t===1?e+="x":(e+="x^",e+=t))}}return e}}class Pn extends E{}Pn.kind="ArithmeticException";class de extends mn{constructor(e,t,n){super(),this.primitive=e,this.size=t,this.generatorBase=n;const r=new Int32Array(t);let i=1;for(let o=0;o<t;o++)r[o]=i,i*=2,i>=t&&(i^=e,i&=t-1);this.expTable=r;const s=new Int32Array(t);for(let o=0;o<t-1;o++)s[r[o]]=o;this.logTable=s,this.zero=new ot(this,Int32Array.from([0])),this.one=new ot(this,Int32Array.from([1]))}getZero(){return this.zero}getOne(){return this.one}buildMonomial(e,t){if(e<0)throw new N;if(t===0)return this.zero;const n=new Int32Array(e+1);return n[0]=t,new ot(this,n)}inverse(e){if(e===0)throw new Pn;return this.expTable[this.size-this.logTable[e]-1]}multiply(e,t){return e===0||t===0?0:this.expTable[(this.logTable[e]+this.logTable[t])%(this.size-1)]}getSize(){return this.size}getGeneratorBase(){return this.generatorBase}toString(){return"GF(0x"+K.toHexString(this.primitive)+","+this.size+")"}equals(e){return e===this}}de.AZTEC_DATA_12=new de(4201,4096,1),de.AZTEC_DATA_10=new de(1033,1024,1),de.AZTEC_DATA_6=new de(67,64,1),de.AZTEC_PARAM=new de(19,16,1),de.QR_CODE_FIELD_256=new de(285,256,0),de.DATA_MATRIX_FIELD_256=new de(301,256,1),de.AZTEC_DATA_8=de.DATA_MATRIX_FIELD_256,de.MAXICODE_FIELD_64=de.AZTEC_DATA_6;class nn extends E{}nn.kind="ReedSolomonException";class bt extends E{}bt.kind="IllegalStateException";class pn{constructor(e){this.field=e}decode(e,t){const n=this.field,r=new ot(n,e),i=new Int32Array(t);let s=!0;for(let p=0;p<t;p++){const I=r.evaluateAt(n.exp(p+n.getGeneratorBase()));i[i.length-1-p]=I,I!==0&&(s=!1)}if(s)return;const o=new ot(n,i),a=this.runEuclideanAlgorithm(n.buildMonomial(t,1),o,t),c=a[0],f=a[1],x=this.findErrorLocations(c),A=this.findErrorMagnitudes(f,x);for(let p=0;p<x.length;p++){const I=e.length-1-n.log(x[p]);if(I<0)throw new nn("Bad error location");e[I]=de.addOrSubtract(e[I],A[p])}}runEuclideanAlgorithm(e,t,n){if(e.getDegree()<t.getDegree()){const p=e;e=t,t=p}const r=this.field;let i=e,s=t,o=r.getZero(),a=r.getOne();for(;s.getDegree()>=(n/2|0);){let p=i,I=o;if(i=s,o=a,i.isZero())throw new nn("r_{i-1} was zero");s=p;let S=r.getZero();const T=i.getCoefficient(i.getDegree()),O=r.inverse(T);for(;s.getDegree()>=i.getDegree()&&!s.isZero();){const P=s.getDegree()-i.getDegree(),k=r.multiply(s.getCoefficient(s.getDegree()),O);S=S.addOrSubtract(r.buildMonomial(P,k)),s=s.addOrSubtract(i.multiplyByMonomial(P,k))}if(a=S.multiply(o).addOrSubtract(I),s.getDegree()>=i.getDegree())throw new bt("Division algorithm failed to reduce polynomial?")}const c=a.getCoefficient(0);if(c===0)throw new nn("sigmaTilde(0) was zero");const f=r.inverse(c),x=a.multiplyScalar(f),A=s.multiplyScalar(f);return[x,A]}findErrorLocations(e){const t=e.getDegree();if(t===1)return Int32Array.from([e.getCoefficient(1)]);const n=new Int32Array(t);let r=0;const i=this.field;for(let s=1;s<i.getSize()&&r<t;s++)e.evaluateAt(s)===0&&(n[r]=i.inverse(s),r++);if(r!==t)throw new nn("Error locator degree does not match number of roots");return n}findErrorMagnitudes(e,t){const n=t.length,r=new Int32Array(n),i=this.field;for(let s=0;s<n;s++){const o=i.inverse(t[s]);let a=1;for(let c=0;c<n;c++)if(s!==c){const f=i.multiply(t[c],o),x=f&1?f&-2:f|1;a=i.multiply(a,x)}r[s]=i.multiply(e.evaluateAt(o),i.inverse(a)),i.getGeneratorBase()!==0&&(r[s]=i.multiply(r[s],o))}return r}}var Ze;(function(g){g[g.UPPER=0]="UPPER",g[g.LOWER=1]="LOWER",g[g.MIXED=2]="MIXED",g[g.DIGIT=3]="DIGIT",g[g.PUNCT=4]="PUNCT",g[g.BINARY=5]="BINARY"})(Ze||(Ze={}));class be{decode(e){this.ddata=e;let t=e.getBits(),n=this.extractBits(t),r=this.correctBits(n),i=be.convertBoolArrayToByteArray(r),s=be.getEncodedData(r),o=new En(i,s,null,null);return o.setNumBits(r.length),o}static highLevelDecode(e){return this.getEncodedData(e)}static getEncodedData(e){let t=e.length,n=Ze.UPPER,r=Ze.UPPER,i="",s=0;for(;s<t;)if(r===Ze.BINARY){if(t-s<5)break;let o=be.readCode(e,s,5);if(s+=5,o===0){if(t-s<11)break;o=be.readCode(e,s,11)+31,s+=11}for(let a=0;a<o;a++){if(t-s<8){s=t;break}const c=be.readCode(e,s,8);i+=J.castAsNonUtf8Char(c),s+=8}r=n}else{let o=r===Ze.DIGIT?4:5;if(t-s<o)break;let a=be.readCode(e,s,o);s+=o;let c=be.getCharacter(r,a);c.startsWith("CTRL_")?(n=r,r=be.getTable(c.charAt(5)),c.charAt(6)==="L"&&(n=r)):(i+=c,r=n)}return i}static getTable(e){switch(e){case"L":return Ze.LOWER;case"P":return Ze.PUNCT;case"M":return Ze.MIXED;case"D":return Ze.DIGIT;case"B":return Ze.BINARY;case"U":default:return Ze.UPPER}}static getCharacter(e,t){switch(e){case Ze.UPPER:return be.UPPER_TABLE[t];case Ze.LOWER:return be.LOWER_TABLE[t];case Ze.MIXED:return be.MIXED_TABLE[t];case Ze.PUNCT:return be.PUNCT_TABLE[t];case Ze.DIGIT:return be.DIGIT_TABLE[t];default:throw new bt("Bad table")}}correctBits(e){let t,n;this.ddata.getNbLayers()<=2?(n=6,t=de.AZTEC_DATA_6):this.ddata.getNbLayers()<=8?(n=8,t=de.AZTEC_DATA_8):this.ddata.getNbLayers()<=22?(n=10,t=de.AZTEC_DATA_10):(n=12,t=de.AZTEC_DATA_12);let r=this.ddata.getNbDatablocks(),i=e.length/n;if(i<r)throw new U;let s=e.length%n,o=new Int32Array(i);for(let A=0;A<i;A++,s+=n)o[A]=be.readCode(e,s,n);try{new pn(t).decode(o,i-r)}catch(A){throw new U(A)}let a=(1<<n)-1,c=0;for(let A=0;A<r;A++){let p=o[A];if(p===0||p===a)throw new U;(p===1||p===a-1)&&c++}let f=new Array(r*n-c),x=0;for(let A=0;A<r;A++){let p=o[A];if(p===1||p===a-1)f.fill(p>1,x,x+n-1),x+=n-1;else for(let I=n-1;I>=0;--I)f[x++]=(p&1<<I)!==0}return f}extractBits(e){let t=this.ddata.isCompact(),n=this.ddata.getNbLayers(),r=(t?11:14)+n*4,i=new Int32Array(r),s=new Array(this.totalBitsInLayer(n,t));if(t)for(let o=0;o<i.length;o++)i[o]=o;else{let o=r+1+2*K.truncDivision(K.truncDivision(r,2)-1,15),a=r/2,c=K.truncDivision(o,2);for(let f=0;f<a;f++){let x=f+K.truncDivision(f,15);i[a-f-1]=c-x-1,i[a+f]=c+x+1}}for(let o=0,a=0;o<n;o++){let c=(n-o)*4+(t?9:12),f=o*2,x=r-1-f;for(let A=0;A<c;A++){let p=A*2;for(let I=0;I<2;I++)s[a+p+I]=e.get(i[f+I],i[f+A]),s[a+2*c+p+I]=e.get(i[f+A],i[x-I]),s[a+4*c+p+I]=e.get(i[x-I],i[x-A]),s[a+6*c+p+I]=e.get(i[x-A],i[f+I])}a+=c*8}return s}static readCode(e,t,n){let r=0;for(let i=t;i<t+n;i++)r<<=1,e[i]&&(r|=1);return r}static readByte(e,t){let n=e.length-t;return n>=8?be.readCode(e,t,8):be.readCode(e,t,n)<<8-n}static convertBoolArrayToByteArray(e){let t=new Uint8Array((e.length+7)/8);for(let n=0;n<t.length;n++)t[n]=be.readByte(e,8*n);return t}totalBitsInLayer(e,t){return((t?88:112)+16*e)*e}}be.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"],be.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"],be.MIXED_TABLE=["CTRL_PS"," ","\\1","\\2","\\3","\\4","\\5","\\6","\\7","\b"," ",`
|
package/dist/externalVersion.js
CHANGED
|
@@ -9,12 +9,12 @@
|
|
|
9
9
|
|
|
10
10
|
module.exports = {
|
|
11
11
|
"@formily/react": "2.3.0",
|
|
12
|
-
"@nocobase/client": "1.2.
|
|
13
|
-
"@nocobase/utils": "1.2.
|
|
12
|
+
"@nocobase/client": "1.2.9-alpha",
|
|
13
|
+
"@nocobase/utils": "1.2.9-alpha",
|
|
14
14
|
"react": "18.2.0",
|
|
15
15
|
"antd": "5.12.8",
|
|
16
16
|
"antd-style": "3.4.5",
|
|
17
17
|
"react-i18next": "11.18.6",
|
|
18
|
-
"@nocobase/server": "1.2.
|
|
18
|
+
"@nocobase/server": "1.2.9-alpha",
|
|
19
19
|
"react-router-dom": "6.21.0"
|
|
20
20
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nocobase/plugin-block-workbench",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.9-alpha",
|
|
4
|
+
"displayName": "Block: Workbench",
|
|
5
|
+
"displayName.zh-CN": "区块:工作台",
|
|
6
|
+
"description": "Add buttons for actions, links, etc. in the workbench block to quickly initiate actions and jump pages.",
|
|
7
|
+
"description.zh-CN": "在工作台区块中添加操作、链接等按钮,以便快捷发起操作和跳转页面。",
|
|
4
8
|
"main": "dist/server/index.js",
|
|
5
9
|
"peerDependencies": {
|
|
6
10
|
"@nocobase/client": "1.x",
|
|
@@ -11,5 +15,8 @@
|
|
|
11
15
|
"html5-qrcode": "^2.3.8",
|
|
12
16
|
"react-router-dom": "^6.x"
|
|
13
17
|
},
|
|
14
|
-
"
|
|
18
|
+
"keywords": [
|
|
19
|
+
"Blocks"
|
|
20
|
+
],
|
|
21
|
+
"gitHead": "b80e4678e8098d60755195ec63f865122aba021a"
|
|
15
22
|
}
|