diff --git a/dist/assets/index.e641ed81.js b/dist/assets/index.42a79cc2.js similarity index 99% rename from dist/assets/index.e641ed81.js rename to dist/assets/index.42a79cc2.js index 8e44d44..efba36c 100644 --- a/dist/assets/index.e641ed81.js +++ b/dist/assets/index.42a79cc2.js @@ -30,4 +30,4 @@ function Al(o,a){return a.forEach(function(f){f&&typeof f!="string"&&!Array.isAr `),e.append(`>> `),e.toString()}setMode(e){this.mode=e}setECLevel(e){this.ecLevel=e}setVersion(e){this.version=e}setMaskPattern(e){this.maskPattern=e}setMatrix(e){this.matrix=e}static isValidMaskPattern(e){return e>=0&&e0;){for(s===6&&(s-=1);l>=0&&l=n;)e^=t<=0)for(let c=0;c!==s;c++){const u=r[c];u>=0&&xe.isEmpty(t.get(u,l))&&xe.embedPositionAdjustmentPattern(u-2,l-2,t)}}}}xe.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])]),xe.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])]),xe.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])]),xe.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])]),xe.VERSION_INFO_POLY=7973,xe.TYPE_INFO_POLY=1335,xe.TYPE_INFO_MASK_PATTERN=21522;class ol{constructor(e,t){this.dataBytes=e,this.errorCorrectionBytes=t}getDataBytes(){return this.dataBytes}getErrorCorrectionBytes(){return this.errorCorrectionBytes}}class nt{constructor(){}static calculateMaskPenalty(e){return lt.applyMaskPenaltyRule1(e)+lt.applyMaskPenaltyRule2(e)+lt.applyMaskPenaltyRule3(e)+lt.applyMaskPenaltyRule4(e)}static encode(e,t,n=null){let r=nt.DEFAULT_BYTE_MODE_ENCODING;const i=n!==null&&n.get(gt.CHARACTER_SET)!==void 0;i&&(r=n.get(gt.CHARACTER_SET).toString());const s=this.chooseMode(e,r),l=new Ee;if(s===ge.BYTE&&(i||nt.DEFAULT_BYTE_MODE_ENCODING!==r)){const Z=V.getCharacterSetECIByName(r);Z!==void 0&&this.appendECI(Z,l)}this.appendModeInfo(s,l);const c=new Ee;this.appendBytes(e,s,c,r);let u;if(n!==null&&n.get(gt.QR_VERSION)!==void 0){const Z=Number.parseInt(n.get(gt.QR_VERSION).toString(),10);u=ce.getVersionForNumber(Z);const W=this.calculateBitsNeeded(s,l,c,u);if(!this.willFit(W,u,t))throw new Ke("Data too big for requested version")}else u=this.recommendVersion(t,s,l,c);const g=new Ee;g.appendBitArray(l);const w=s===ge.BYTE?c.getSizeInBytes():e.length;this.appendLengthInfo(w,u,s,g),g.appendBitArray(c);const E=u.getECBlocksForLevel(t),I=u.getTotalCodewords()-E.getTotalECCodewords();this.terminateBits(I,g);const y=this.interleaveWithECBytes(g,u.getTotalCodewords(),I,E.getNumBlocks()),N=new Hn;N.setECLevel(t),N.setMode(s),N.setVersion(u);const O=u.getDimensionForVersion(),B=new Kr(O,O),X=this.chooseMaskPattern(y,t,u,B);return N.setMaskPattern(X),xe.buildMatrix(y,t,u,X,B),N.setMatrix(B),N}static recommendVersion(e,t,n,r){const i=this.calculateBitsNeeded(t,n,r,ce.getVersionForNumber(1)),s=this.chooseVersion(i,e),l=this.calculateBitsNeeded(t,n,r,s);return this.chooseVersion(l,e)}static calculateBitsNeeded(e,t,n,r){return t.getSize()+e.getCharacterCountBits(r)+n.getSize()}static getAlphanumericCode(e){return e159)&&(i<224||i>235))return!1}return!0}static chooseMaskPattern(e,t,n,r){let i=Number.MAX_SAFE_INTEGER,s=-1;for(let l=0;l=c}static terminateBits(e,t){const n=e*8;if(t.getSize()>n)throw new Ke("data bits cannot fit in the QR Code"+t.getSize()+" > "+n);for(let s=0;s<4&&t.getSize()0)for(let s=r;s<8;s++)t.appendBit(!1);const i=e-t.getSizeInBytes();for(let s=0;s=n)throw new Ke("Block ID too large");const l=e%n,c=n-l,u=Math.floor(e/n),g=u+1,w=Math.floor(t/n),E=w+1,I=u-w,y=g-E;if(I!==y)throw new Ke("EC bytes mismatch");if(n!==c+l)throw new Ke("RS blocks mismatch");if(e!==(w+I)*c+(E+y)*l)throw new Ke("Total bytes mismatch");r=1<=0&&t<=9}static appendNumericBytes(e,t){const n=e.length;let r=0;for(;r=33088&&c<=40956?u=c-33088:c>=57408&&c<=60351&&(u=c-49472),u===-1)throw new Ke("Invalid byte sequence");const g=(u>>8)*192+(u&255);t.appendBits(g,13)}}static appendECI(e,t){t.appendBits(ge.ECI.getBits(),4),t.appendBits(e.getValue(),8)}}nt.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]),nt.DEFAULT_BYTE_MODE_ENCODING=V.UTF8.getName();class jn{write(e,t,n,r=null){if(e.length===0)throw new M("Found empty contents");if(t<0||n<0)throw new M("Requested dimensions are too small: "+t+"x"+n);let i=qe.L,s=jn.QUIET_ZONE_SIZE;r!==null&&(r.get(gt.ERROR_CORRECTION)!==void 0&&(i=qe.fromString(r.get(gt.ERROR_CORRECTION).toString())),r.get(gt.MARGIN)!==void 0&&(s=Number.parseInt(r.get(gt.MARGIN).toString(),10)));const l=nt.encode(e,i,r);return this.renderResult(l,t,n,s)}writeToDom(e,t,n,r,i=null){typeof e=="string"&&(e=document.querySelector(e));const s=this.write(t,n,r,i);e&&e.appendChild(s)}renderResult(e,t,n,r){const i=e.getMatrix();if(i===null)throw new _;const s=i.getWidth(),l=i.getHeight(),c=s+r*2,u=l+r*2,g=Math.max(t,c),w=Math.max(n,u),E=Math.min(Math.floor(g/c),Math.floor(w/u)),I=Math.floor((g-s*E)/2),y=Math.floor((w-l*E)/2),N=this.createSVGElement(g,w);for(let O=0,B=y;Ot||i+l>n)throw new M("Crop rectangle does not fit within image data.");c&&this.reverseHorizontal(s,l)}getRow(e,t){if(e<0||e>=this.getHeight())throw new M("Requested row is outside the image: "+e);const n=this.getWidth();(t==null||t.length>16&255,I=w>>7&510,y=w&255;u[g]=(E+I+y)/4&255}this.luminances=u}else this.luminances=e;if(r===void 0&&(this.dataWidth=t),i===void 0&&(this.dataHeight=n),s===void 0&&(this.left=0),l===void 0&&(this.top=0),this.left+t>this.dataWidth||this.top+n>this.dataHeight)throw new M("Crop rectangle does not fit within image data.")}getRow(e,t){if(e<0||e>=this.getHeight())throw new M("Requested row is outside the image: "+e);const n=this.getWidth();(t==null||t.length"}}class Bi extends or{constructor(e,t,n){super(e,0,0),this.binaryShiftStart=t,this.binaryShiftByteCount=n}appendTo(e,t){for(let n=0;n62?e.appendBits(this.binaryShiftByteCount-31,16):n===0?e.appendBits(Math.min(this.binaryShiftByteCount,31),5):e.appendBits(this.binaryShiftByteCount-31,5)),e.appendBits(t[this.binaryShiftStart+n],8)}addBinaryShift(e,t){return new Bi(this,e,t)}toString(){return"<"+this.binaryShiftStart+"::"+(this.binaryShiftStart+this.binaryShiftByteCount-1)+">"}}function cl(A,e,t){return new Bi(A,e,t)}function _r(A,e,t){return new or(A,e,t)}const fl=["UPPER","LOWER","DIGIT","MIXED","PUNCT"],_n=0,Qr=1,Yt=2,Xs=3,ln=4,ul=new or(null,0,0),vi=[Int32Array.from([0,(5<<16)+28,(5<<16)+30,(5<<16)+29,(10<<16)+(29<<5)+30]),Int32Array.from([(9<<16)+(30<<4)+14,0,(5<<16)+30,(5<<16)+29,(10<<16)+(29<<5)+30]),Int32Array.from([(4<<16)+14,(9<<16)+(14<<5)+28,0,(9<<16)+(14<<5)+29,(14<<16)+(14<<10)+(29<<5)+30]),Int32Array.from([(5<<16)+29,(5<<16)+28,(10<<16)+(29<<5)+30,0,(5<<16)+30]),Int32Array.from([(5<<16)+31,(10<<16)+(31<<5)+28,(10<<16)+(31<<5)+30,(10<<16)+(31<<5)+29,0])];function hl(A){for(let e of A)$.fill(e,-1);return A[_n][ln]=0,A[Qr][ln]=0,A[Qr][_n]=28,A[Xs][ln]=0,A[Yt][ln]=0,A[Yt][_n]=15,A}const Zs=hl($.createInt32Array(6,6));class cn{constructor(e,t,n,r){this.token=e,this.mode=t,this.binaryShiftByteCount=n,this.bitCount=r}getMode(){return this.mode}getToken(){return this.token}getBinaryShiftByteCount(){return this.binaryShiftByteCount}getBitCount(){return this.bitCount}latchAndAppend(e,t){let n=this.bitCount,r=this.token;if(e!==this.mode){let s=vi[this.mode][e];r=_r(r,s&65535,s>>16),n+=s>>16}let i=e===Yt?4:5;return r=_r(r,t,i),new cn(r,e,0,n+i)}shiftAndAppend(e,t){let n=this.token,r=this.mode===Yt?4:5;return n=_r(n,Zs[this.mode][e],r),n=_r(n,t,5),new cn(n,this.mode,0,this.bitCount+r+5)}addBinaryShiftChar(e){let t=this.token,n=this.mode,r=this.bitCount;if(this.mode===ln||this.mode===Yt){let l=vi[n][_n];t=_r(t,l&65535,l>>16),r+=l>>16,n=_n}let i=this.binaryShiftByteCount===0||this.binaryShiftByteCount===31?18:this.binaryShiftByteCount===62?9:8,s=new cn(t,n,this.binaryShiftByteCount+1,r+i);return s.binaryShiftByteCount===2047+31&&(s=s.endBinaryShift(e+1)),s}endBinaryShift(e){if(this.binaryShiftByteCount===0)return this;let t=this.token;return t=cl(t,e-this.binaryShiftByteCount,this.binaryShiftByteCount),new cn(t,this.mode,0,this.bitCount)}isBetterThanOrEqualTo(e){let t=this.bitCount+(vi[this.mode][e.mode]>>16);return this.binaryShiftByteCounte.binaryShiftByteCount&&e.binaryShiftByteCount>0&&(t+=10),t<=e.bitCount}toBitArray(e){let t=[];for(let r=this.endBinaryShift(e.length).token;r!==null;r=r.getPrevious())t.unshift(r);let n=new Ee;for(const r of t)r.appendTo(n,e);return n}toString(){return le.format("%s bits=%d bytes=%d",fl[this.mode],this.bitCount,this.binaryShiftByteCount)}static calculateBinaryShiftCost(e){return e.binaryShiftByteCount>62?21:e.binaryShiftByteCount>31?20:e.binaryShiftByteCount>0?10:0}}cn.INITIAL_STATE=new cn(ul,_n,0,0);function dl(A){const e=le.getCharCode(" "),t=le.getCharCode("."),n=le.getCharCode(",");A[_n][e]=1;const r=le.getCharCode("Z"),i=le.getCharCode("A");for(let E=i;E<=r;E++)A[_n][E]=E-i+2;A[Qr][e]=1;const s=le.getCharCode("z"),l=le.getCharCode("a");for(let E=l;E<=s;E++)A[Qr][E]=E-l+2;A[Yt][e]=1;const c=le.getCharCode("9"),u=le.getCharCode("0");for(let E=u;E<=c;E++)A[Yt][E]=E-u+2;A[Yt][n]=12,A[Yt][t]=13;const g=["\0"," ","","","","","","","\x07","\b"," ",` `,"\v","\f","\r","\x1B","","","","","@","\\","^","_","`","|","~","\x7F"];for(let E=0;E","?","[","]","{","}"];for(let E=0;E0&&(A[ln][le.getCharCode(w[E])]=E);return A}const Pi=dl($.createInt32Array(5,256));class Mr{constructor(e){this.text=e}encode(){const e=le.getCharCode(" "),t=le.getCharCode(` -`);let n=Gs.singletonList(cn.INITIAL_STATE);for(let i=0;i0?(n=Mr.updateStateListForPair(n,i,s),i++):n=this.updateStateListForChar(n,i)}return Gs.min(n,(i,s)=>i.getBitCount()-s.getBitCount()).toBitArray(this.text)}updateStateListForChar(e,t){const n=[];for(let r of e)this.updateStateForChar(r,t,n);return Mr.simplifyStates(n)}updateStateForChar(e,t,n){let r=this.text[t]&255,i=Pi[e.getMode()][r]>0,s=null;for(let l=0;l<=ln;l++){let c=Pi[l][r];if(c>0){if(s==null&&(s=e.endBinaryShift(t)),!i||l===e.getMode()||l===Yt){const u=s.latchAndAppend(l,c);n.push(u)}if(!i&&Zs[e.getMode()][l]>=0){const u=s.shiftAndAppend(l,c);n.push(u)}}}if(e.getBinaryShiftByteCount()>0||Pi[e.getMode()][r]===0){let l=e.addBinaryShiftChar(t);n.push(l)}}static updateStateListForPair(e,t,n){const r=[];for(let i of e)this.updateStateForPair(i,t,n,r);return this.simplifyStates(r)}static updateStateForPair(e,t,n,r){let i=e.endBinaryShift(t);if(r.push(i.latchAndAppend(ln,n)),e.getMode()!==ln&&r.push(i.shiftAndAppend(ln,n)),n===3||n===4){let s=i.latchAndAppend(Yt,16-n).latchAndAppend(Yt,1);r.push(s)}if(e.getBinaryShiftByteCount()>0){let s=e.addBinaryShiftChar(t).addBinaryShiftChar(t+1);r.push(s)}}static simplifyStates(e){let t=[];for(const n of e){let r=!0;for(const i of t){if(i.isBetterThanOrEqualTo(n)){r=!1;break}n.isBetterThanOrEqualTo(i)&&(t=t.filter(s=>s!==i))}r&&t.push(n)}return t}}class Be{constructor(){}static encodeBytes(e){return Be.encode(e,Be.DEFAULT_EC_PERCENT,Be.DEFAULT_AZTEC_LAYERS)}static encode(e,t,n){let r=new Mr(e).encode(),i=se.truncDivision(r.getSize()*t,100)+11,s=r.getSize()+i,l,c,u,g,w;if(n!==Be.DEFAULT_AZTEC_LAYERS){if(l=n<0,c=Math.abs(n),c>(l?Be.MAX_NB_BITS_COMPACT:Be.MAX_NB_BITS))throw new M(le.format("Illegal value %s for layers",n));u=Be.totalBitsInLayer(c,l),g=Be.WORD_SIZE[c];let W=u-u%g;if(w=Be.stuffBits(r,g),w.getSize()+i>W)throw new M("Data to large for user specified layer");if(l&&w.getSize()>g*64)throw new M("Data to large for user specified layer")}else{g=0,w=null;for(let W=0;;W++){if(W>Be.MAX_NB_BITS)throw new M("Data too large for an Aztec code");if(l=W<=3,c=l?W+1:W,u=Be.totalBitsInLayer(c,l),s>u)continue;(w==null||g!==Be.WORD_SIZE[c])&&(g=Be.WORD_SIZE[c],w=Be.stuffBits(r,g));let Me=u-u%g;if(!(l&&w.getSize()>g*64)&&w.getSize()+i<=Me)break}}let E=Be.generateCheckWords(w,u,g),I=w.getSize()/g,y=Be.generateModeMessage(l,c,I),N=(l?11:14)+c*4,O=new Int32Array(N),B;if(l){B=N;for(let W=0;W=r||e.get(s+c))&&(l|=1<0&&x[x.length-1])&&(S[0]===6||S[0]===2)){f=0;continue}if(S[0]===3&&(!x||S[1]>x[0]&&S[1]h&&(h=T,f=p)}if(!f)throw"No largest barcode found";return f},o.prototype.createBarcodeDetectorFormats=function(a){for(var f=[],h=0,d=a;h=T&&p()})})},o.prototype.scanFile=function(a,f){return this.scanFileV2(a,f).then(function(h){return h.decodedText})},o.prototype.scanFileV2=function(a,f){var h=this;if(!a||!(a instanceof File))throw"imageFile argument is mandatory and should be instance of File. Use 'event.target.files[0]'.";if(hr(f)&&(f=!0),!this.stateManagerProxy.canScanFile())throw"Cannot start file scan - ongoing camera scan";return new Promise(function(d,x){h.possiblyCloseLastScanImageFile(),h.clearElement(),h.lastScanImageFile=URL.createObjectURL(a);var p=new Image;p.onload=function(){var T=p.width,m=p.height,S=document.getElementById(h.elementId),M=S.clientWidth?S.clientWidth:Xt.DEFAULT_WIDTH,j=Math.max(S.clientHeight?S.clientHeight:m,Xt.FILE_SCAN_MIN_HEIGHT),U=h.computeCanvasDrawConfig(T,m,M,j);if(f){var ne=h.createCanvasElement(M,j,"qr-canvas-visible");ne.style.display="inline-block",S.appendChild(ne);var K=ne.getContext("2d");if(!K)throw"Unable to get 2d context from canvas";K.canvas.width=M,K.canvas.height=j,K.drawImage(p,0,0,T,m,U.x,U.y,U.width,U.height)}var fe=h.createCanvasElement(U.width,U.height);S.appendChild(fe);var ue=fe.getContext("2d");if(!ue)throw"Unable to get 2d context from canvas";ue.canvas.width=U.width,ue.canvas.height=U.height,ue.drawImage(p,0,0,T,m,0,0,U.width,U.height);try{h.qrcode.decodeAsync(fe).then(function($){d(So.createFromQrcodeResult($))}).catch(x)}catch($){x("QR code parse error, error = "+$)}},p.onerror=x,p.onabort=x,p.onstalled=x,p.onsuspend=x,p.src=URL.createObjectURL(a)})},o.prototype.clear=function(){this.clearElement()},o.getCameras=function(){if(navigator.mediaDevices)return o.getCamerasFromMediaDevices();var a=MediaStreamTrack;if(MediaStreamTrack&&a.getSources)return o.getCamerasFromMediaStreamTrack();var f=function(){if(location.protocol==="https:")return!0;var d=location.host.split(":")[0];return d==="127.0.0.1"||d==="localhost"},h=Or.unableToQuerySupportedDevices();return f()||(h=Or.insecureContextCameraQueryError()),Promise.reject(h)},o.prototype.getRunningTrackCapabilities=function(){if(this.localMediaStream==null)throw"Scanning is not in running state, call this API only when QR code scanning using camera is in running state.";if(this.localMediaStream.getVideoTracks().length===0)throw"No video tracks found";var a=this.localMediaStream.getVideoTracks()[0];return a.getCapabilities()},o.prototype.applyVideoConstraints=function(a){var f=this;if(a){if(!Fa.isMediaStreamConstraintsValid(a,this.logger))throw"invalid videoConstaints passed, check logs for more details"}else throw"videoConstaints is required argument.";if(this.localMediaStream===null)throw"Scanning is not in running state, call this API only when QR code scanning using camera is in running state.";if(this.localMediaStream.getVideoTracks().length===0)throw"No video tracks found";return new Promise(function(h,d){if("aspectRatio"in a){d("Chaning 'aspectRatio' in run-time is not yet supported.");return}var x=f.localMediaStream.getVideoTracks()[0];x.applyConstraints(a).then(function(p){h(p)}).catch(function(p){d(p)})})},o.getCamerasFromMediaDevices=function(){return new Promise(function(a,f){navigator.mediaDevices.getUserMedia({audio:!1,video:!0}).then(function(h){var d=function(x){for(var p=x.getVideoTracks(),T=0,m=p;Ta&&(d.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."),S=a),S};T(p.width),T(p.height),p.width=m(p.width)},o.prototype.validateQrboxConfig=function(a){if(typeof a!="number"&&typeof a!="function"&&(a.width===void 0||a.height===void 0))throw"Invalid instance of QrDimensions passed for 'config.qrbox'. Both 'width' and 'height' should be set."},o.prototype.toQrdimensions=function(a,f,h){if(typeof h=="number")return{width:h,height:h};if(typeof h=="function")try{return h(a,f)}catch(d){throw new Error("qrbox config was passed as a function but it failed with unknown error"+d)}return h},o.prototype.setupUi=function(a,f,h){h.isShadedBoxEnabled()&&this.validateQrboxSize(a,f,h);var d=hr(h.qrbox)?{width:a,height:f}:h.qrbox;this.validateQrboxConfig(d);var x=this.toQrdimensions(a,f,d);x.height>f&&this.logger.warn("[Html5Qrcode] config.qrbox has height that isgreater than the height of the video stream. Shading will be ignored");var p=h.isShadedBoxEnabled()&&x.height<=f,T={x:0,y:0,width:a,height:f},m=p?this.getShadedRegionBounds(a,f,x):T,S=this.createCanvasElement(m.width,m.height),M=S.getContext("2d");M.canvas.width=m.width,M.canvas.height=m.height,this.element.append(S),p&&this.possiblyInsertShadingElement(this.element,a,f,x),this.createScannerPausedUiElement(this.element),this.qrRegion=m,this.context=M,this.canvasElement=S},o.prototype.createScannerPausedUiElement=function(a){var f=document.createElement("div");f.innerText="Scanner paused",f.style.display="none",f.style.position="absolute",f.style.top="0px",f.style.zIndex="1",f.style.background="yellow",f.style.textAlign="center",f.style.width="100%",a.appendChild(f),this.scannerPausedUiElement=f},o.prototype.scanContext=function(a,f){var h=this;return this.stateManagerProxy.isPaused()?Promise.resolve(!1):this.qrcode.decodeAsync(this.canvasElement).then(function(d){return a(d.text,So.createFromQrcodeResult(d)),h.possiblyUpdateShaders(!0),!0}).catch(function(d){h.possiblyUpdateShaders(!1);var x=Or.codeParseError(d);return f(x,va.createFrom(x)),!1})},o.prototype.foreverScan=function(a,f,h){var d=this;if(!!this.shouldScan&&!!this.localMediaStream){var x=this.videoElement,p=x.videoWidth/x.clientWidth,T=x.videoHeight/x.clientHeight;if(!this.qrRegion)throw"qrRegion undefined when localMediaStream is ready.";var m=this.qrRegion.width*p,S=this.qrRegion.height*T,M=this.qrRegion.x*p,j=this.qrRegion.y*T;this.context.drawImage(x,M,j,m,S,0,0,this.qrRegion.width,this.qrRegion.height);var U=function(){d.foreverScanTimeout=setTimeout(function(){d.foreverScan(a,f,h)},d.getTimeoutFps(a.fps))};this.scanContext(f,h).then(function(ne){!ne&&a.disableFlip!==!0?(d.context.translate(d.context.canvas.width,0),d.context.scale(-1,1),d.scanContext(f,h).finally(function(){U()})):U()}).catch(function(ne){d.logger.logError("Error happend while scanning context",ne),U()})}},o.prototype.onMediaStreamReceived=function(a,f,h,d,x,p){var T=this,m=this;return new Promise(function(S,M){var j=function(){var K=T.createVideoElement(d);m.element.append(K),K.onabort=M,K.onerror=M;var fe=function(){var ue=K.clientWidth,$=K.clientHeight;m.setupUi(ue,$,f),m.foreverScan(f,x,p),K.removeEventListener("playing",fe),S(null)};K.addEventListener("playing",fe),K.srcObject=a,K.play(),m.videoElement=K};if(m.localMediaStream=a,h||!f.aspectRatio)j();else{var U={aspectRatio:f.aspectRatio},ne=a.getVideoTracks()[0];ne.applyConstraints(U).then(function(K){return j()}).catch(function(K){m.logger.logErrors(["[Html5Qrcode] Constriants could not be satisfied, ignoring constraints",K]),j()})}})},o.prototype.createVideoConstraints=function(a){if(typeof a=="string")return{deviceId:{exact:a}};if(typeof a=="object"){var f="facingMode",h="deviceId",d={user:!0,environment:!0},x="exact",p=function(K){if(K in d)return!0;throw"config has invalid 'facingMode' value = "+("'"+K+"'")},T=Object.keys(a);if(T.length!==1)throw"'cameraIdOrConfig' object should have exactly 1 key,"+(" if passed as an object, found "+T.length+" keys");var m=Object.keys(a)[0];if(m!==f&&m!==h)throw"Only '"+f+"' and '"+h+"' are supported for 'cameraIdOrConfig'";if(m===f){var S=a.facingMode;if(typeof S=="string"){if(p(S))return{facingMode:S}}else if(typeof S=="object")if(x in S){if(p(S[""+x]))return{facingMode:{exact:S[""+x]}}}else throw"'facingMode' should be string or object with"+(" "+x+" as key.");else{var M=typeof S;throw"Invalid type of 'facingMode' = "+M}}else{var j=a.deviceId;if(typeof j=="string")return{deviceId:j};if(typeof j=="object"){if(x in j)return{deviceId:{exact:j[""+x]}};throw"'deviceId' should be string or object with"+(" "+x+" as key.")}else{var U=typeof j;throw"Invalid type of 'deviceId' = "+U}}}var ne=typeof a;throw"Invalid type of 'cameraIdOrConfig' = "+ne},o.prototype.computeCanvasDrawConfig=function(a,f,h,d){if(a<=h&&f<=d){var x=(h-a)/2,p=(d-f)/2;return{x,y:p,width:a,height:f}}else{var T=a,m=f;return a>h&&(f=h/a*f,a=h),f>d&&(a=d/f*a,f=d),this.logger.log("Image downsampled from "+(T+"X"+m)+(" to "+a+"X"+f+".")),this.computeCanvasDrawConfig(a,f,h,d)}},o.prototype.clearElement=function(){if(this.stateManagerProxy.isScanning())throw"Cannot clear while scan is ongoing, close it first.";var a=document.getElementById(this.elementId);a&&(a.innerHTML="")},o.prototype.createVideoElement=function(a){var f=document.createElement("video");return f.style.width=a+"px",f.muted=!0,f.setAttribute("muted","true"),f.playsInline=!0,f},o.prototype.possiblyUpdateShaders=function(a){this.qrMatch!==a&&(this.hasBorderShaders&&this.borderShaders&&this.borderShaders.length&&this.borderShaders.forEach(function(f){f.style.backgroundColor=a?Xt.BORDER_SHADER_MATCH_COLOR:Xt.BORDER_SHADER_DEFAULT_COLOR}),this.qrMatch=a)},o.prototype.possiblyCloseLastScanImageFile=function(){this.lastScanImageFile&&(URL.revokeObjectURL(this.lastScanImageFile),this.lastScanImageFile=null)},o.prototype.createCanvasElement=function(a,f,h){var d=a,x=f,p=document.createElement("canvas");return p.style.width=d+"px",p.style.height=x+"px",p.style.display="none",p.id=hr(h)?"qr-canvas":h,p},o.prototype.getShadedRegionBounds=function(a,f,h){if(h.width>a||h.height>f)throw"'config.qrbox' dimensions should not be greater than the dimensions of the root HTML element.";return{x:(a-h.width)/2,y:(f-h.height)/2,width:h.width,height:h.height}},o.prototype.possiblyInsertShadingElement=function(a,f,h,d){if(!(f-d.width<1||h-d.height<1)){var x=document.createElement("div");x.style.position="absolute";var p=(f-d.width)/2,T=(h-d.height)/2;if(x.style.borderLeft=p+"px solid #0000007a",x.style.borderRight=p+"px solid #0000007a",x.style.borderTop=T+"px solid #0000007a",x.style.borderBottom=T+"px solid #0000007a",x.style.boxSizing="border-box",x.style.top="0px",x.style.bottom="0px",x.style.left="0px",x.style.right="0px",x.id=""+Xt.SHADED_REGION_ELEMENT_ID,f-d.width<11||h-d.height<11)this.hasBorderShaders=!1;else{var m=5,S=40;this.insertShaderBorders(x,S,m,-m,0,!0),this.insertShaderBorders(x,S,m,-m,0,!1),this.insertShaderBorders(x,S,m,d.height+m,0,!0),this.insertShaderBorders(x,S,m,d.height+m,0,!1),this.insertShaderBorders(x,m,S+m,-m,-m,!0),this.insertShaderBorders(x,m,S+m,d.height+m-S,-m,!0),this.insertShaderBorders(x,m,S+m,-m,-m,!1),this.insertShaderBorders(x,m,S+m,d.height+m-S,-m,!1),this.hasBorderShaders=!0}a.append(x)}},o.prototype.insertShaderBorders=function(a,f,h,d,x,p){var T=document.createElement("div");T.style.position="absolute",T.style.backgroundColor=Xt.BORDER_SHADER_DEFAULT_COLOR,T.style.width=f+"px",T.style.height=h+"px",T.style.top=d+"px",p?T.style.left=x+"px":T.style.right=x+"px",this.borderShaders||(this.borderShaders=[]),this.borderShaders.push(T),a.appendChild(T)},o.prototype.showPausedState=function(){if(!this.scannerPausedUiElement)throw"[internal error] scanner paused UI element not found";this.scannerPausedUiElement.style.display="block"},o.prototype.hidePausedState=function(){if(!this.scannerPausedUiElement)throw"[internal error] scanner paused UI element not found";this.scannerPausedUiElement.style.display="none"},o.prototype.getTimeoutFps=function(a){return 1e3/a},o}(),Rs="data:image/svg+xml;base64,",s0=Rs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zYtNy4wMzQgMTUuNzEtMTUuNzEgMTUuNzFoLTQzLjEwMWMtOC42NzYgMC0xNS43MS03LjAzNC0xNS43MS0xNS43MVYyMDIuNDc3YzAtOC42NzYgNy4wMzMtMTUuNzEgMTUuNzEtMTUuNzFoNDMuMTAxYzguNjc2IDAgMTUuNzEgNy4wMzMgMTUuNzEgMTUuNzFWMzc3LjM2ek0yMzAgMTU3Yy0yMS41MzkgMC0zOS0xNy40NjEtMzktMzlzMTcuNDYxLTM5IDM5LTM5IDM5IDE3LjQ2MSAzOSAzOS0xNy40NjEgMzktMzkgMzl6Ii8+PC9zdmc+",a0="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAAQgAAAEIBarqQRAAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAAE1SURBVDiNfdI7S0NBEAXgLya1otFgpbYSbISAgpXYi6CmiH9KCAiChaVga6OiWPgfRDQ+0itaGVNosXtluWwcuMzePfM4M3sq8lbHBubwg1dc4m1E/J/N4ghDPOIsfk/4xiEao5KX0McFljN4C9d4QTPXuY99jP3DsIoDPGM6BY5i5yI5R7O4q+ImFkJY2DCh3cAH2klyB+9J1xUMMAG7eCh1a+Mr+k48b5diXrFVwwLuS+BJ9MfR7+G0FHOHhTHhnXNWS87VDF4pcnfQK4Ep7XScNLmPTZgURNKKYENYWDpzW1BhscS1WHS8CDgURFJQrWcoF3c13KKbgg1BYQfy8xZWEzTTw1QZbAoKu8FqJnktdu5hcVSHmchiILzzuaDQvjBzV2m8yohCE1jHfPx/xhU+y4G/D75ELlRJsSYAAAAASUVORK5CYII=",Mo=function(){function o(){}return o.createDefault=function(){return{hasPermission:!1,lastUsedCameraId:null}},o}(),l0=function(){function o(){this.data=Mo.createDefault();var a=localStorage.getItem(o.LOCAL_STORAGE_KEY);a?this.data=JSON.parse(a):this.reset()}return o.prototype.hasCameraPermissions=function(){return this.data.hasPermission},o.prototype.getLastUsedCameraId=function(){return this.data.lastUsedCameraId},o.prototype.setHasPermission=function(a){this.data.hasPermission=a,this.flush()},o.prototype.setLastUsedCameraId=function(a){this.data.lastUsedCameraId=a,this.flush()},o.prototype.resetLastUsedCameraId=function(){this.data.lastUsedCameraId=null,this.flush()},o.prototype.reset=function(){this.data=Mo.createDefault(),this.flush()},o.prototype.flush=function(){localStorage.setItem(o.LOCAL_STORAGE_KEY,JSON.stringify(this.data))},o.LOCAL_STORAGE_KEY="HTML5_QRCODE_DATA",o}(),c0=function(){function o(){this.infoDiv=document.createElement("div")}return o.prototype.renderInto=function(a){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 silver",this.infoDiv.style.fontSize="10pt",this.infoDiv.style.background="rgb(248 248 248)",this.infoDiv.innerText=bo.builtUsing();var f=document.createElement("a");f.innerText="html5-qrcode",f.href="https://github.com/mebjas/html5-qrcode",f.target="new",this.infoDiv.appendChild(f);var h=document.createElement("br"),d=document.createElement("br");this.infoDiv.appendChild(h),this.infoDiv.appendChild(d);var x=document.createElement("a");x.innerText=bo.reportIssues(),x.href="https://github.com/mebjas/html5-qrcode/issues",x.target="new",this.infoDiv.appendChild(x),a.appendChild(this.infoDiv)},o.prototype.show=function(){this.infoDiv.style.display="block"},o.prototype.hide=function(){this.infoDiv.style.display="none"},o}(),f0=function(){function o(a,f){this.isShowingInfoIcon=!0,this.onTapIn=a,this.onTapOut=f,this.infoIcon=document.createElement("img")}return o.prototype.renderInto=function(a){var f=this;this.infoIcon.alt="Info icon",this.infoIcon.src=_o,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(h){return f.onHoverIn()},this.infoIcon.onmouseout=function(h){return f.onHoverOut()},this.infoIcon.onclick=function(h){return f.onClick()},a.appendChild(this.infoIcon)},o.prototype.onHoverIn=function(){this.isShowingInfoIcon&&(this.infoIcon.style.opacity="1")},o.prototype.onHoverOut=function(){this.isShowingInfoIcon&&(this.infoIcon.style.opacity="0.6")},o.prototype.onClick=function(){this.isShowingInfoIcon?(this.isShowingInfoIcon=!1,this.onTapIn(),this.infoIcon.src=a0,this.infoIcon.style.opacity="1"):(this.isShowingInfoIcon=!0,this.onTapOut(),this.infoIcon.src=_o,this.infoIcon.style.opacity="0.6")},o}(),u0=function(){function o(){var a=this;this.infoDiv=new c0,this.infoIcon=new f0(function(){a.infoDiv.show()},function(){a.infoDiv.hide()})}return o.prototype.renderInto=function(a){this.infoDiv.renderInto(a),this.infoIcon.renderInto(a)},o}(),Oo=function(){function o(){}return o.hasCameraPermissions=function(){return new Promise(function(a,f){navigator.mediaDevices.enumerateDevices().then(function(h){h.forEach(function(d){d.kind==="videoinput"&&d.label&&a(!0)}),a(!1)})})},o}(),xn=function(){function o(a){this.supportedScanTypes=this.validateAndReturnScanTypes(a)}return o.prototype.getDefaultScanType=function(){return this.supportedScanTypes[0]},o.prototype.hasMoreThanOneScanType=function(){return this.supportedScanTypes.length>1},o.prototype.isCameraScanRequired=function(){for(var a=0,f=this.supportedScanTypes;af)throw"Max "+f+" values expected for supportedScanTypes";for(var h=0,d=a;h0?(a.removeChild(f),d.renderCameraSelection(p)):(d.setHeaderMessage(Jt.noCameraFound(),Zt.STATUS_WARNING),x())}).catch(function(p){d.persistedDataManager.setHasPermission(!1),h?h.disabled=!1:x(),d.setHeaderMessage(p,Zt.STATUS_WARNING)})},o.prototype.createPermissionButton=function(a,f){var h=this,d=document.createElement("button");d.id=this.getCameraPermissionButtonId(),d.innerText=Jt.cameraPermissionTitle(),d.addEventListener("click",function(){d.disabled=!0,h.createCameraListUi(a,f,d)}),f.appendChild(d)},o.prototype.createPermissionsUi=function(a,f){var h=this;if(xn.isCameraScanType(this.currentScanType)&&this.persistedDataManager.hasCameraPermissions()){Oo.hasCameraPermissions().then(function(d){d?h.createCameraListUi(a,f):(h.persistedDataManager.setHasPermission(!1),h.createPermissionButton(a,f))}).catch(function(d){h.persistedDataManager.setHasPermission(!1),h.createPermissionButton(a,f)});return}this.createPermissionButton(a,f)},o.prototype.createSectionControlPanel=function(){var a=document.getElementById(this.getDashboardSectionId()),f=document.createElement("div");a.appendChild(f);var h=document.createElement("div");h.id=this.getDashboardSectionCameraScanRegionId(),h.style.display=xn.isCameraScanType(this.currentScanType)?"block":"none",f.appendChild(h);var d=document.createElement("div");d.style.textAlign="center",h.appendChild(d),this.scanTypeSelector.isCameraScanRequired()&&this.createPermissionsUi(h,d),this.renderFileScanUi(f)},o.prototype.renderFileScanUi=function(a){var f=this,h=document.createElement("div");h.id=this.getDashboardSectionFileScanRegionId(),h.style.textAlign="center",h.style.display=xn.isCameraScanType(this.currentScanType)?"none":"block",a.appendChild(h);var d=document.createElement("input");d.id=this.getFileScanInputId(),d.accept="image/*",d.type="file",d.style.width="200px",d.disabled=xn.isCameraScanType(this.currentScanType);var x=document.createElement("span");x.innerText=" Select Image",h.appendChild(d),h.appendChild(x),d.addEventListener("change",function(p){if(!f.html5Qrcode)throw"html5Qrcode not defined";if(!(p==null||p.target==null)&&!!xn.isFileScanType(f.currentScanType)&&p.target.files.length!==0){var T=p.target.files[0];f.html5Qrcode.scanFileV2(T,!0).then(function(m){f.resetHeaderMessage(),f.qrCodeSuccessCallback(m.decodedText,m)}).catch(function(m){f.setHeaderMessage(m,Zt.STATUS_WARNING),f.qrCodeErrorCallback(m,va.createFrom(m))})}})},o.prototype.renderCameraSelection=function(a){var f=this,h=this,d=document.getElementById(this.getDashboardSectionCameraScanRegionId());d.style.textAlign="center";var x=document.createElement("span");x.style.marginRight="10px";var p=a.length,T=document.createElement("select");if(p===1)T.style.display="none";else{var m=Jt.selectCamera();x.innerText=m+" ("+a.length+") "}T.id=this.getCameraSelectionId();for(var S=[],M=0,j=a;M",f.appendChild(this.cameraScanImage);return}this.cameraScanImage=new Image,this.cameraScanImage.onload=function(h){f.innerHTML="
",f.appendChild(a.cameraScanImage)},this.cameraScanImage.width=64,this.cameraScanImage.style.opacity="0.8",this.cameraScanImage.src=s0},o.prototype.insertFileScanImageToScanRegion=function(){var a=this,f=document.getElementById(this.getScanRegionId());if(this.fileScanImage){f.innerHTML="
",f.appendChild(this.fileScanImage);return}this.fileScanImage=new Image,this.fileScanImage.onload=function(h){f.innerHTML="
",f.appendChild(a.fileScanImage)},this.fileScanImage.width=64,this.fileScanImage.style.opacity="0.8",this.fileScanImage.src=o0},o.prototype.clearScanRegion=function(){var a=document.getElementById(this.getScanRegionId());a.innerHTML=""},o.prototype.getDashboardSectionId=function(){return this.elementId+"__dashboard_section"},o.prototype.getDashboardSectionCameraScanRegionId=function(){return this.elementId+"__dashboard_section_csr"},o.prototype.getDashboardSectionFileScanRegionId=function(){return this.elementId+"__dashboard_section_fsr"},o.prototype.getDashboardSectionSwapLinkId=function(){return this.elementId+"__dashboard_section_swaplink"},o.prototype.getScanRegionId=function(){return this.elementId+"__scan_region"},o.prototype.getDashboardId=function(){return this.elementId+"__dashboard"},o.prototype.getFileScanInputId=function(){return this.elementId+"__filescan_input"},o.prototype.getStatusSpanId=function(){return this.elementId+"__status_span"},o.prototype.getHeaderMessageContainerId=function(){return this.elementId+"__header_message"},o.prototype.getCameraSelectionId=function(){return this.elementId+"__camera_selection"},o.prototype.getCameraPermissionButtonId=function(){return this.elementId+"__camera_permission_button"},o.prototype.getCameraScanRegion=function(){return document.getElementById(this.getDashboardSectionCameraScanRegionId())},o.prototype.getFileScanRegion=function(){return document.getElementById(this.getDashboardSectionFileScanRegionId())},o.prototype.getFileScanInput=function(){return document.getElementById(this.getFileScanInputId())},o.prototype.getDashboardSectionSwapLink=function(){return document.getElementById(this.getDashboardSectionSwapLinkId())},o.prototype.getHeaderMessageDiv=function(){return document.getElementById(this.getHeaderMessageContainerId())},o}();const x0={id:"qr-code-full-region"},A0=ys({props:{qrbox:null,fps:null},emits:["decodedCode"],setup(o,{emit:a}){const f=o;var h={fps:f.fps?f.fps:10};let d="";f.qrbox&&(h.qrbox=f.qrbox);function x(m,S){d!==m&&(d=m,a("decodedCode",m,S))}function p(m,S){}async function T(){await ra();var m=new g0("qr-code-full-region",h,void 0);m.render(x,p)}return T(),(m,S)=>(Ms(),Ma("div",x0))}}),w0={class:"section",style:{width:"500px",margin:"auto"}},E0=jr("div",{id:"smsto"},null,-1),p0=ys({setup(o){let a=Ui("");Ui(""),Ui("visibility:hidden");const f=function(d,x){d.includes("smsto:1922:")?h(d):a.value=`\u5167\u5BB9:${d}`};function h(d){let p=d.split("smsto:1922:")[1];a.value=`\u5167\u5BB9:${p}`;let T=document.getElementById("smsto");T.innerHTML=`\u6309\u6211\u50B3\u9001\u7C21\u8A0A`}return(d,x)=>(Ms(),Ma($t,null,[jr("div",w0,[En(A0,{qrbox:250,fps:10,style:{width:"100%"},onDecodedCode:f})]),jr("div",null,Tl(ea(a)),1),E0],64))}});const C0=ys({setup(o){return(a,f)=>(Ms(),rc(p0))}});zc(C0).mount("#app"); +`);let n=Gs.singletonList(cn.INITIAL_STATE);for(let i=0;i0?(n=Mr.updateStateListForPair(n,i,s),i++):n=this.updateStateListForChar(n,i)}return Gs.min(n,(i,s)=>i.getBitCount()-s.getBitCount()).toBitArray(this.text)}updateStateListForChar(e,t){const n=[];for(let r of e)this.updateStateForChar(r,t,n);return Mr.simplifyStates(n)}updateStateForChar(e,t,n){let r=this.text[t]&255,i=Pi[e.getMode()][r]>0,s=null;for(let l=0;l<=ln;l++){let c=Pi[l][r];if(c>0){if(s==null&&(s=e.endBinaryShift(t)),!i||l===e.getMode()||l===Yt){const u=s.latchAndAppend(l,c);n.push(u)}if(!i&&Zs[e.getMode()][l]>=0){const u=s.shiftAndAppend(l,c);n.push(u)}}}if(e.getBinaryShiftByteCount()>0||Pi[e.getMode()][r]===0){let l=e.addBinaryShiftChar(t);n.push(l)}}static updateStateListForPair(e,t,n){const r=[];for(let i of e)this.updateStateForPair(i,t,n,r);return this.simplifyStates(r)}static updateStateForPair(e,t,n,r){let i=e.endBinaryShift(t);if(r.push(i.latchAndAppend(ln,n)),e.getMode()!==ln&&r.push(i.shiftAndAppend(ln,n)),n===3||n===4){let s=i.latchAndAppend(Yt,16-n).latchAndAppend(Yt,1);r.push(s)}if(e.getBinaryShiftByteCount()>0){let s=e.addBinaryShiftChar(t).addBinaryShiftChar(t+1);r.push(s)}}static simplifyStates(e){let t=[];for(const n of e){let r=!0;for(const i of t){if(i.isBetterThanOrEqualTo(n)){r=!1;break}n.isBetterThanOrEqualTo(i)&&(t=t.filter(s=>s!==i))}r&&t.push(n)}return t}}class Be{constructor(){}static encodeBytes(e){return Be.encode(e,Be.DEFAULT_EC_PERCENT,Be.DEFAULT_AZTEC_LAYERS)}static encode(e,t,n){let r=new Mr(e).encode(),i=se.truncDivision(r.getSize()*t,100)+11,s=r.getSize()+i,l,c,u,g,w;if(n!==Be.DEFAULT_AZTEC_LAYERS){if(l=n<0,c=Math.abs(n),c>(l?Be.MAX_NB_BITS_COMPACT:Be.MAX_NB_BITS))throw new M(le.format("Illegal value %s for layers",n));u=Be.totalBitsInLayer(c,l),g=Be.WORD_SIZE[c];let W=u-u%g;if(w=Be.stuffBits(r,g),w.getSize()+i>W)throw new M("Data to large for user specified layer");if(l&&w.getSize()>g*64)throw new M("Data to large for user specified layer")}else{g=0,w=null;for(let W=0;;W++){if(W>Be.MAX_NB_BITS)throw new M("Data too large for an Aztec code");if(l=W<=3,c=l?W+1:W,u=Be.totalBitsInLayer(c,l),s>u)continue;(w==null||g!==Be.WORD_SIZE[c])&&(g=Be.WORD_SIZE[c],w=Be.stuffBits(r,g));let Me=u-u%g;if(!(l&&w.getSize()>g*64)&&w.getSize()+i<=Me)break}}let E=Be.generateCheckWords(w,u,g),I=w.getSize()/g,y=Be.generateModeMessage(l,c,I),N=(l?11:14)+c*4,O=new Int32Array(N),B;if(l){B=N;for(let W=0;W=r||e.get(s+c))&&(l|=1<0&&x[x.length-1])&&(S[0]===6||S[0]===2)){f=0;continue}if(S[0]===3&&(!x||S[1]>x[0]&&S[1]h&&(h=T,f=p)}if(!f)throw"No largest barcode found";return f},o.prototype.createBarcodeDetectorFormats=function(a){for(var f=[],h=0,d=a;h=T&&p()})})},o.prototype.scanFile=function(a,f){return this.scanFileV2(a,f).then(function(h){return h.decodedText})},o.prototype.scanFileV2=function(a,f){var h=this;if(!a||!(a instanceof File))throw"imageFile argument is mandatory and should be instance of File. Use 'event.target.files[0]'.";if(hr(f)&&(f=!0),!this.stateManagerProxy.canScanFile())throw"Cannot start file scan - ongoing camera scan";return new Promise(function(d,x){h.possiblyCloseLastScanImageFile(),h.clearElement(),h.lastScanImageFile=URL.createObjectURL(a);var p=new Image;p.onload=function(){var T=p.width,m=p.height,S=document.getElementById(h.elementId),M=S.clientWidth?S.clientWidth:Xt.DEFAULT_WIDTH,j=Math.max(S.clientHeight?S.clientHeight:m,Xt.FILE_SCAN_MIN_HEIGHT),U=h.computeCanvasDrawConfig(T,m,M,j);if(f){var ne=h.createCanvasElement(M,j,"qr-canvas-visible");ne.style.display="inline-block",S.appendChild(ne);var K=ne.getContext("2d");if(!K)throw"Unable to get 2d context from canvas";K.canvas.width=M,K.canvas.height=j,K.drawImage(p,0,0,T,m,U.x,U.y,U.width,U.height)}var fe=h.createCanvasElement(U.width,U.height);S.appendChild(fe);var ue=fe.getContext("2d");if(!ue)throw"Unable to get 2d context from canvas";ue.canvas.width=U.width,ue.canvas.height=U.height,ue.drawImage(p,0,0,T,m,0,0,U.width,U.height);try{h.qrcode.decodeAsync(fe).then(function($){d(So.createFromQrcodeResult($))}).catch(x)}catch($){x("QR code parse error, error = "+$)}},p.onerror=x,p.onabort=x,p.onstalled=x,p.onsuspend=x,p.src=URL.createObjectURL(a)})},o.prototype.clear=function(){this.clearElement()},o.getCameras=function(){if(navigator.mediaDevices)return o.getCamerasFromMediaDevices();var a=MediaStreamTrack;if(MediaStreamTrack&&a.getSources)return o.getCamerasFromMediaStreamTrack();var f=function(){if(location.protocol==="https:")return!0;var d=location.host.split(":")[0];return d==="127.0.0.1"||d==="localhost"},h=Or.unableToQuerySupportedDevices();return f()||(h=Or.insecureContextCameraQueryError()),Promise.reject(h)},o.prototype.getRunningTrackCapabilities=function(){if(this.localMediaStream==null)throw"Scanning is not in running state, call this API only when QR code scanning using camera is in running state.";if(this.localMediaStream.getVideoTracks().length===0)throw"No video tracks found";var a=this.localMediaStream.getVideoTracks()[0];return a.getCapabilities()},o.prototype.applyVideoConstraints=function(a){var f=this;if(a){if(!Fa.isMediaStreamConstraintsValid(a,this.logger))throw"invalid videoConstaints passed, check logs for more details"}else throw"videoConstaints is required argument.";if(this.localMediaStream===null)throw"Scanning is not in running state, call this API only when QR code scanning using camera is in running state.";if(this.localMediaStream.getVideoTracks().length===0)throw"No video tracks found";return new Promise(function(h,d){if("aspectRatio"in a){d("Chaning 'aspectRatio' in run-time is not yet supported.");return}var x=f.localMediaStream.getVideoTracks()[0];x.applyConstraints(a).then(function(p){h(p)}).catch(function(p){d(p)})})},o.getCamerasFromMediaDevices=function(){return new Promise(function(a,f){navigator.mediaDevices.getUserMedia({audio:!1,video:!0}).then(function(h){var d=function(x){for(var p=x.getVideoTracks(),T=0,m=p;Ta&&(d.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."),S=a),S};T(p.width),T(p.height),p.width=m(p.width)},o.prototype.validateQrboxConfig=function(a){if(typeof a!="number"&&typeof a!="function"&&(a.width===void 0||a.height===void 0))throw"Invalid instance of QrDimensions passed for 'config.qrbox'. Both 'width' and 'height' should be set."},o.prototype.toQrdimensions=function(a,f,h){if(typeof h=="number")return{width:h,height:h};if(typeof h=="function")try{return h(a,f)}catch(d){throw new Error("qrbox config was passed as a function but it failed with unknown error"+d)}return h},o.prototype.setupUi=function(a,f,h){h.isShadedBoxEnabled()&&this.validateQrboxSize(a,f,h);var d=hr(h.qrbox)?{width:a,height:f}:h.qrbox;this.validateQrboxConfig(d);var x=this.toQrdimensions(a,f,d);x.height>f&&this.logger.warn("[Html5Qrcode] config.qrbox has height that isgreater than the height of the video stream. Shading will be ignored");var p=h.isShadedBoxEnabled()&&x.height<=f,T={x:0,y:0,width:a,height:f},m=p?this.getShadedRegionBounds(a,f,x):T,S=this.createCanvasElement(m.width,m.height),M=S.getContext("2d");M.canvas.width=m.width,M.canvas.height=m.height,this.element.append(S),p&&this.possiblyInsertShadingElement(this.element,a,f,x),this.createScannerPausedUiElement(this.element),this.qrRegion=m,this.context=M,this.canvasElement=S},o.prototype.createScannerPausedUiElement=function(a){var f=document.createElement("div");f.innerText="Scanner paused",f.style.display="none",f.style.position="absolute",f.style.top="0px",f.style.zIndex="1",f.style.background="yellow",f.style.textAlign="center",f.style.width="100%",a.appendChild(f),this.scannerPausedUiElement=f},o.prototype.scanContext=function(a,f){var h=this;return this.stateManagerProxy.isPaused()?Promise.resolve(!1):this.qrcode.decodeAsync(this.canvasElement).then(function(d){return a(d.text,So.createFromQrcodeResult(d)),h.possiblyUpdateShaders(!0),!0}).catch(function(d){h.possiblyUpdateShaders(!1);var x=Or.codeParseError(d);return f(x,va.createFrom(x)),!1})},o.prototype.foreverScan=function(a,f,h){var d=this;if(!!this.shouldScan&&!!this.localMediaStream){var x=this.videoElement,p=x.videoWidth/x.clientWidth,T=x.videoHeight/x.clientHeight;if(!this.qrRegion)throw"qrRegion undefined when localMediaStream is ready.";var m=this.qrRegion.width*p,S=this.qrRegion.height*T,M=this.qrRegion.x*p,j=this.qrRegion.y*T;this.context.drawImage(x,M,j,m,S,0,0,this.qrRegion.width,this.qrRegion.height);var U=function(){d.foreverScanTimeout=setTimeout(function(){d.foreverScan(a,f,h)},d.getTimeoutFps(a.fps))};this.scanContext(f,h).then(function(ne){!ne&&a.disableFlip!==!0?(d.context.translate(d.context.canvas.width,0),d.context.scale(-1,1),d.scanContext(f,h).finally(function(){U()})):U()}).catch(function(ne){d.logger.logError("Error happend while scanning context",ne),U()})}},o.prototype.onMediaStreamReceived=function(a,f,h,d,x,p){var T=this,m=this;return new Promise(function(S,M){var j=function(){var K=T.createVideoElement(d);m.element.append(K),K.onabort=M,K.onerror=M;var fe=function(){var ue=K.clientWidth,$=K.clientHeight;m.setupUi(ue,$,f),m.foreverScan(f,x,p),K.removeEventListener("playing",fe),S(null)};K.addEventListener("playing",fe),K.srcObject=a,K.play(),m.videoElement=K};if(m.localMediaStream=a,h||!f.aspectRatio)j();else{var U={aspectRatio:f.aspectRatio},ne=a.getVideoTracks()[0];ne.applyConstraints(U).then(function(K){return j()}).catch(function(K){m.logger.logErrors(["[Html5Qrcode] Constriants could not be satisfied, ignoring constraints",K]),j()})}})},o.prototype.createVideoConstraints=function(a){if(typeof a=="string")return{deviceId:{exact:a}};if(typeof a=="object"){var f="facingMode",h="deviceId",d={user:!0,environment:!0},x="exact",p=function(K){if(K in d)return!0;throw"config has invalid 'facingMode' value = "+("'"+K+"'")},T=Object.keys(a);if(T.length!==1)throw"'cameraIdOrConfig' object should have exactly 1 key,"+(" if passed as an object, found "+T.length+" keys");var m=Object.keys(a)[0];if(m!==f&&m!==h)throw"Only '"+f+"' and '"+h+"' are supported for 'cameraIdOrConfig'";if(m===f){var S=a.facingMode;if(typeof S=="string"){if(p(S))return{facingMode:S}}else if(typeof S=="object")if(x in S){if(p(S[""+x]))return{facingMode:{exact:S[""+x]}}}else throw"'facingMode' should be string or object with"+(" "+x+" as key.");else{var M=typeof S;throw"Invalid type of 'facingMode' = "+M}}else{var j=a.deviceId;if(typeof j=="string")return{deviceId:j};if(typeof j=="object"){if(x in j)return{deviceId:{exact:j[""+x]}};throw"'deviceId' should be string or object with"+(" "+x+" as key.")}else{var U=typeof j;throw"Invalid type of 'deviceId' = "+U}}}var ne=typeof a;throw"Invalid type of 'cameraIdOrConfig' = "+ne},o.prototype.computeCanvasDrawConfig=function(a,f,h,d){if(a<=h&&f<=d){var x=(h-a)/2,p=(d-f)/2;return{x,y:p,width:a,height:f}}else{var T=a,m=f;return a>h&&(f=h/a*f,a=h),f>d&&(a=d/f*a,f=d),this.logger.log("Image downsampled from "+(T+"X"+m)+(" to "+a+"X"+f+".")),this.computeCanvasDrawConfig(a,f,h,d)}},o.prototype.clearElement=function(){if(this.stateManagerProxy.isScanning())throw"Cannot clear while scan is ongoing, close it first.";var a=document.getElementById(this.elementId);a&&(a.innerHTML="")},o.prototype.createVideoElement=function(a){var f=document.createElement("video");return f.style.width=a+"px",f.muted=!0,f.setAttribute("muted","true"),f.playsInline=!0,f},o.prototype.possiblyUpdateShaders=function(a){this.qrMatch!==a&&(this.hasBorderShaders&&this.borderShaders&&this.borderShaders.length&&this.borderShaders.forEach(function(f){f.style.backgroundColor=a?Xt.BORDER_SHADER_MATCH_COLOR:Xt.BORDER_SHADER_DEFAULT_COLOR}),this.qrMatch=a)},o.prototype.possiblyCloseLastScanImageFile=function(){this.lastScanImageFile&&(URL.revokeObjectURL(this.lastScanImageFile),this.lastScanImageFile=null)},o.prototype.createCanvasElement=function(a,f,h){var d=a,x=f,p=document.createElement("canvas");return p.style.width=d+"px",p.style.height=x+"px",p.style.display="none",p.id=hr(h)?"qr-canvas":h,p},o.prototype.getShadedRegionBounds=function(a,f,h){if(h.width>a||h.height>f)throw"'config.qrbox' dimensions should not be greater than the dimensions of the root HTML element.";return{x:(a-h.width)/2,y:(f-h.height)/2,width:h.width,height:h.height}},o.prototype.possiblyInsertShadingElement=function(a,f,h,d){if(!(f-d.width<1||h-d.height<1)){var x=document.createElement("div");x.style.position="absolute";var p=(f-d.width)/2,T=(h-d.height)/2;if(x.style.borderLeft=p+"px solid #0000007a",x.style.borderRight=p+"px solid #0000007a",x.style.borderTop=T+"px solid #0000007a",x.style.borderBottom=T+"px solid #0000007a",x.style.boxSizing="border-box",x.style.top="0px",x.style.bottom="0px",x.style.left="0px",x.style.right="0px",x.id=""+Xt.SHADED_REGION_ELEMENT_ID,f-d.width<11||h-d.height<11)this.hasBorderShaders=!1;else{var m=5,S=40;this.insertShaderBorders(x,S,m,-m,0,!0),this.insertShaderBorders(x,S,m,-m,0,!1),this.insertShaderBorders(x,S,m,d.height+m,0,!0),this.insertShaderBorders(x,S,m,d.height+m,0,!1),this.insertShaderBorders(x,m,S+m,-m,-m,!0),this.insertShaderBorders(x,m,S+m,d.height+m-S,-m,!0),this.insertShaderBorders(x,m,S+m,-m,-m,!1),this.insertShaderBorders(x,m,S+m,d.height+m-S,-m,!1),this.hasBorderShaders=!0}a.append(x)}},o.prototype.insertShaderBorders=function(a,f,h,d,x,p){var T=document.createElement("div");T.style.position="absolute",T.style.backgroundColor=Xt.BORDER_SHADER_DEFAULT_COLOR,T.style.width=f+"px",T.style.height=h+"px",T.style.top=d+"px",p?T.style.left=x+"px":T.style.right=x+"px",this.borderShaders||(this.borderShaders=[]),this.borderShaders.push(T),a.appendChild(T)},o.prototype.showPausedState=function(){if(!this.scannerPausedUiElement)throw"[internal error] scanner paused UI element not found";this.scannerPausedUiElement.style.display="block"},o.prototype.hidePausedState=function(){if(!this.scannerPausedUiElement)throw"[internal error] scanner paused UI element not found";this.scannerPausedUiElement.style.display="none"},o.prototype.getTimeoutFps=function(a){return 1e3/a},o}(),Rs="data:image/svg+xml;base64,",s0=Rs+"PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAzNzEuNjQzIDM3MS42NDMiIHN0eWxlPSJlbmFibGUtYmFja2dyb3VuZDpuZXcgMCAwIDM3MS42NDMgMzcxLjY0MyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+PHBhdGggZD0iTTEwNS4wODQgMzguMjcxaDE2My43Njh2MjBIMTA1LjA4NHoiLz48cGF0aCBkPSJNMzExLjU5NiAxOTAuMTg5Yy03LjQ0MS05LjM0Ny0xOC40MDMtMTYuMjA2LTMyLjc0My0yMC41MjJWMzBjMC0x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w0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAAQgAAAEIBarqQRAAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAAE1SURBVDiNfdI7S0NBEAXgLya1otFgpbYSbISAgpXYi6CmiH9KCAiChaVga6OiWPgfRDQ+0itaGVNosXtluWwcuMzePfM4M3sq8lbHBubwg1dc4m1E/J/N4ghDPOIsfk/4xiEao5KX0McFljN4C9d4QTPXuY99jP3DsIoDPGM6BY5i5yI5R7O4q+ImFkJY2DCh3cAH2klyB+9J1xUMMAG7eCh1a+Mr+k48b5diXrFVwwLuS+BJ9MfR7+G0FHOHhTHhnXNWS87VDF4pcnfQK4Ep7XScNLmPTZgURNKKYENYWDpzW1BhscS1WHS8CDgURFJQrWcoF3c13KKbgg1BYQfy8xZWEzTTw1QZbAoKu8FqJnktdu5hcVSHmchiILzzuaDQvjBzV2m8yohCE1jHfPx/xhU+y4G/D75ELlRJsSYAAAAASUVORK5CYII=",Mo=function(){function o(){}return o.createDefault=function(){return{hasPermission:!1,lastUsedCameraId:null}},o}(),l0=function(){function o(){this.data=Mo.createDefault();var a=localStorage.getItem(o.LOCAL_STORAGE_KEY);a?this.data=JSON.parse(a):this.reset()}return o.prototype.hasCameraPermissions=function(){return this.data.hasPermission},o.prototype.getLastUsedCameraId=function(){return this.data.lastUsedCameraId},o.prototype.setHasPermission=function(a){this.data.hasPermission=a,this.flush()},o.prototype.setLastUsedCameraId=function(a){this.data.lastUsedCameraId=a,this.flush()},o.prototype.resetLastUsedCameraId=function(){this.data.lastUsedCameraId=null,this.flush()},o.prototype.reset=function(){this.data=Mo.createDefault(),this.flush()},o.prototype.flush=function(){localStorage.setItem(o.LOCAL_STORAGE_KEY,JSON.stringify(this.data))},o.LOCAL_STORAGE_KEY="HTML5_QRCODE_DATA",o}(),c0=function(){function o(){this.infoDiv=document.createElement("div")}return o.prototype.renderInto=function(a){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 silver",this.infoDiv.style.fontSize="10pt",this.infoDiv.style.background="rgb(248 248 248)",this.infoDiv.innerText=bo.builtUsing();var f=document.createElement("a");f.innerText="html5-qrcode",f.href="https://github.com/mebjas/html5-qrcode",f.target="new",this.infoDiv.appendChild(f);var h=document.createElement("br"),d=document.createElement("br");this.infoDiv.appendChild(h),this.infoDiv.appendChild(d);var x=document.createElement("a");x.innerText=bo.reportIssues(),x.href="https://github.com/mebjas/html5-qrcode/issues",x.target="new",this.infoDiv.appendChild(x),a.appendChild(this.infoDiv)},o.prototype.show=function(){this.infoDiv.style.display="block"},o.prototype.hide=function(){this.infoDiv.style.display="none"},o}(),f0=function(){function o(a,f){this.isShowingInfoIcon=!0,this.onTapIn=a,this.onTapOut=f,this.infoIcon=document.createElement("img")}return o.prototype.renderInto=function(a){var f=this;this.infoIcon.alt="Info icon",this.infoIcon.src=_o,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(h){return f.onHoverIn()},this.infoIcon.onmouseout=function(h){return f.onHoverOut()},this.infoIcon.onclick=function(h){return f.onClick()},a.appendChild(this.infoIcon)},o.prototype.onHoverIn=function(){this.isShowingInfoIcon&&(this.infoIcon.style.opacity="1")},o.prototype.onHoverOut=function(){this.isShowingInfoIcon&&(this.infoIcon.style.opacity="0.6")},o.prototype.onClick=function(){this.isShowingInfoIcon?(this.isShowingInfoIcon=!1,this.onTapIn(),this.infoIcon.src=a0,this.infoIcon.style.opacity="1"):(this.isShowingInfoIcon=!0,this.onTapOut(),this.infoIcon.src=_o,this.infoIcon.style.opacity="0.6")},o}(),u0=function(){function o(){var a=this;this.infoDiv=new c0,this.infoIcon=new f0(function(){a.infoDiv.show()},function(){a.infoDiv.hide()})}return o.prototype.renderInto=function(a){this.infoDiv.renderInto(a),this.infoIcon.renderInto(a)},o}(),Oo=function(){function o(){}return o.hasCameraPermissions=function(){return new Promise(function(a,f){navigator.mediaDevices.enumerateDevices().then(function(h){h.forEach(function(d){d.kind==="videoinput"&&d.label&&a(!0)}),a(!1)})})},o}(),xn=function(){function o(a){this.supportedScanTypes=this.validateAndReturnScanTypes(a)}return o.prototype.getDefaultScanType=function(){return this.supportedScanTypes[0]},o.prototype.hasMoreThanOneScanType=function(){return this.supportedScanTypes.length>1},o.prototype.isCameraScanRequired=function(){for(var a=0,f=this.supportedScanTypes;af)throw"Max "+f+" values expected for supportedScanTypes";for(var h=0,d=a;h0?(a.removeChild(f),d.renderCameraSelection(p)):(d.setHeaderMessage(Jt.noCameraFound(),Zt.STATUS_WARNING),x())}).catch(function(p){d.persistedDataManager.setHasPermission(!1),h?h.disabled=!1:x(),d.setHeaderMessage(p,Zt.STATUS_WARNING)})},o.prototype.createPermissionButton=function(a,f){var h=this,d=document.createElement("button");d.id=this.getCameraPermissionButtonId(),d.innerText=Jt.cameraPermissionTitle(),d.addEventListener("click",function(){d.disabled=!0,h.createCameraListUi(a,f,d)}),f.appendChild(d)},o.prototype.createPermissionsUi=function(a,f){var h=this;if(xn.isCameraScanType(this.currentScanType)&&this.persistedDataManager.hasCameraPermissions()){Oo.hasCameraPermissions().then(function(d){d?h.createCameraListUi(a,f):(h.persistedDataManager.setHasPermission(!1),h.createPermissionButton(a,f))}).catch(function(d){h.persistedDataManager.setHasPermission(!1),h.createPermissionButton(a,f)});return}this.createPermissionButton(a,f)},o.prototype.createSectionControlPanel=function(){var a=document.getElementById(this.getDashboardSectionId()),f=document.createElement("div");a.appendChild(f);var h=document.createElement("div");h.id=this.getDashboardSectionCameraScanRegionId(),h.style.display=xn.isCameraScanType(this.currentScanType)?"block":"none",f.appendChild(h);var d=document.createElement("div");d.style.textAlign="center",h.appendChild(d),this.scanTypeSelector.isCameraScanRequired()&&this.createPermissionsUi(h,d),this.renderFileScanUi(f)},o.prototype.renderFileScanUi=function(a){var f=this,h=document.createElement("div");h.id=this.getDashboardSectionFileScanRegionId(),h.style.textAlign="center",h.style.display=xn.isCameraScanType(this.currentScanType)?"none":"block",a.appendChild(h);var d=document.createElement("input");d.id=this.getFileScanInputId(),d.accept="image/*",d.type="file",d.style.width="200px",d.disabled=xn.isCameraScanType(this.currentScanType);var x=document.createElement("span");x.innerText=" Select Image",h.appendChild(d),h.appendChild(x),d.addEventListener("change",function(p){if(!f.html5Qrcode)throw"html5Qrcode not defined";if(!(p==null||p.target==null)&&!!xn.isFileScanType(f.currentScanType)&&p.target.files.length!==0){var T=p.target.files[0];f.html5Qrcode.scanFileV2(T,!0).then(function(m){f.resetHeaderMessage(),f.qrCodeSuccessCallback(m.decodedText,m)}).catch(function(m){f.setHeaderMessage(m,Zt.STATUS_WARNING),f.qrCodeErrorCallback(m,va.createFrom(m))})}})},o.prototype.renderCameraSelection=function(a){var f=this,h=this,d=document.getElementById(this.getDashboardSectionCameraScanRegionId());d.style.textAlign="center";var x=document.createElement("span");x.style.marginRight="10px";var p=a.length,T=document.createElement("select");if(p===1)T.style.display="none";else{var m=Jt.selectCamera();x.innerText=m+" ("+a.length+") "}T.id=this.getCameraSelectionId();for(var S=[],M=0,j=a;M",f.appendChild(this.cameraScanImage);return}this.cameraScanImage=new Image,this.cameraScanImage.onload=function(h){f.innerHTML="
",f.appendChild(a.cameraScanImage)},this.cameraScanImage.width=64,this.cameraScanImage.style.opacity="0.8",this.cameraScanImage.src=s0},o.prototype.insertFileScanImageToScanRegion=function(){var a=this,f=document.getElementById(this.getScanRegionId());if(this.fileScanImage){f.innerHTML="
",f.appendChild(this.fileScanImage);return}this.fileScanImage=new Image,this.fileScanImage.onload=function(h){f.innerHTML="
",f.appendChild(a.fileScanImage)},this.fileScanImage.width=64,this.fileScanImage.style.opacity="0.8",this.fileScanImage.src=o0},o.prototype.clearScanRegion=function(){var a=document.getElementById(this.getScanRegionId());a.innerHTML=""},o.prototype.getDashboardSectionId=function(){return this.elementId+"__dashboard_section"},o.prototype.getDashboardSectionCameraScanRegionId=function(){return this.elementId+"__dashboard_section_csr"},o.prototype.getDashboardSectionFileScanRegionId=function(){return this.elementId+"__dashboard_section_fsr"},o.prototype.getDashboardSectionSwapLinkId=function(){return this.elementId+"__dashboard_section_swaplink"},o.prototype.getScanRegionId=function(){return this.elementId+"__scan_region"},o.prototype.getDashboardId=function(){return this.elementId+"__dashboard"},o.prototype.getFileScanInputId=function(){return this.elementId+"__filescan_input"},o.prototype.getStatusSpanId=function(){return this.elementId+"__status_span"},o.prototype.getHeaderMessageContainerId=function(){return this.elementId+"__header_message"},o.prototype.getCameraSelectionId=function(){return this.elementId+"__camera_selection"},o.prototype.getCameraPermissionButtonId=function(){return this.elementId+"__camera_permission_button"},o.prototype.getCameraScanRegion=function(){return document.getElementById(this.getDashboardSectionCameraScanRegionId())},o.prototype.getFileScanRegion=function(){return document.getElementById(this.getDashboardSectionFileScanRegionId())},o.prototype.getFileScanInput=function(){return document.getElementById(this.getFileScanInputId())},o.prototype.getDashboardSectionSwapLink=function(){return document.getElementById(this.getDashboardSectionSwapLinkId())},o.prototype.getHeaderMessageDiv=function(){return document.getElementById(this.getHeaderMessageContainerId())},o}();const x0={id:"qr-code-full-region"},A0=ys({props:{qrbox:null,fps:null},emits:["decodedCode"],setup(o,{emit:a}){const f=o;var h={fps:f.fps?f.fps:10};let d="";f.qrbox&&(h.qrbox=f.qrbox);function x(m,S){d!==m&&(d=m,a("decodedCode",m,S))}function p(m,S){}async function T(){await ra();var m=new g0("qr-code-full-region",h,void 0);m.render(x,p)}return T(),(m,S)=>(Ms(),Ma("div",x0))}}),w0={class:"section",style:{width:"500px",margin:"auto"}},E0=jr("div",{id:"smsto"},null,-1),p0=ys({setup(o){let a=Ui("");Ui(""),Ui("visibility:hidden");const f=function(d,x){d.includes("1922:")?h(d):a.value=`\u5167\u5BB9:${d}`};function h(d){let p=d.split("1922:")[1];a.value=`\u5167\u5BB9:${p}`;let T=document.getElementById("smsto");T.innerHTML=`\u6309\u6211\u50B3\u9001\u7C21\u8A0A`}return(d,x)=>(Ms(),Ma($t,null,[jr("div",w0,[En(A0,{qrbox:250,fps:10,style:{width:"100%"},onDecodedCode:f})]),jr("div",null,Tl(ea(a)),1),E0],64))}});const C0=ys({setup(o){return(a,f)=>(Ms(),rc(p0))}});zc(C0).mount("#app"); diff --git a/dist/index.html b/dist/index.html index 3deb48d..f290c4c 100644 --- a/dist/index.html +++ b/dist/index.html @@ -7,7 +7,7 @@ HTML5 QR Code with Vue js - + diff --git a/src/components/QRCode.vue b/src/components/QRCode.vue index f767f0d..ffc9296 100644 --- a/src/components/QRCode.vue +++ b/src/components/QRCode.vue @@ -10,7 +10,7 @@ let isSHowSMS = ref('visibility:hidden') const decodedCode = function (decodedText: string, decodedResult: any) { // console.log(`Scan result ${decodedText}`, decodedResult); - if (decodedText.includes('smsto:1922:')) { + if (decodedText.includes('1922:')) { smsto1922(decodedText); } else { result.value = `內容:${decodedText}`; @@ -18,7 +18,7 @@ const decodedCode = function (decodedText: string, decodedResult: any) { } function smsto1922(decodedText: string) { - let contents = decodedText.split('smsto:1922:'); + let contents = decodedText.split('1922:'); let sms = contents[1]; result.value = `內容:${sms}`; // smscontent.value = sms;