cornerstone-wado-image-loader
Version:
Cornerstone Image Loader for DICOM WADO-URI and WADO-RS
1 lines • 1.27 MB
JavaScript
(()=>{var A,I,g={8726:function(A,I){!function(g){if("object"==typeof I&&void 0!==A)A.exports=g();else if("function"==typeof define&&define.amd)define([],g);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).jpeg=g()}}((function(){return function A(I,g,B){function Q(E,i){if(!g[E]){if(!I[E]){var o="function"==typeof require&&require;if(!i&&o)return o(E,!0);if(C)return C(E,!0);var D=new Error("Cannot find module '"+E+"'");throw D.code="MODULE_NOT_FOUND",D}var a=g[E]={exports:{}};I[E][0].call(a.exports,(function(A){var g=I[E][1][A];return Q(g||A)}),a,a.exports,A,I,g,B)}return g[E].exports}for(var C="function"==typeof require&&require,E=0;E<B.length;E++)Q(B[E]);return Q}({1:[function(A,I,g){"use strict";var B=B||{};B.lossless=B.lossless||{},B.lossless.ComponentSpec=B.lossless.ComponentSpec||function(){this.hSamp=0,this.quantTableSel=0,this.vSamp=0},"undefined"!==typeof I&&I.exports&&(I.exports=B.lossless.ComponentSpec)},{}],2:[function(A,I,g){"use strict";var B=B||{};B.lossless=B.lossless||{},B.lossless.DataStream=B.lossless.DataStream||function(A,I,g){this.buffer=new Uint8Array(A,I,g),this.index=0},B.lossless.DataStream.prototype.get16=function(){var A=(this.buffer[this.index]<<8)+this.buffer[this.index+1];return this.index+=2,A},B.lossless.DataStream.prototype.get8=function(){var A=this.buffer[this.index];return this.index+=1,A},"undefined"!==typeof I&&I.exports&&(I.exports=B.lossless.DataStream)},{}],3:[function(A,I,g){"use strict";var B,Q=Q||{};Q.lossless=Q.lossless||{},Q.lossless.DataStream=Q.lossless.DataStream||(void 0!==A?A("./data-stream.js"):null),Q.lossless.HuffmanTable=Q.lossless.HuffmanTable||(void 0!==A?A("./huffman-table.js"):null),Q.lossless.QuantizationTable=Q.lossless.QuantizationTable||(void 0!==A?A("./quantization-table.js"):null),Q.lossless.ScanHeader=Q.lossless.ScanHeader||(void 0!==A?A("./scan-header.js"):null),Q.lossless.FrameHeader=Q.lossless.FrameHeader||(void 0!==A?A("./frame-header.js"):null),Q.lossless.Utils=Q.lossless.Utils||(void 0!==A?A("./utils.js"):null),Q.lossless.Decoder=Q.lossless.Decoder||function(A,I){this.buffer=A,this.frame=new Q.lossless.FrameHeader,this.huffTable=new Q.lossless.HuffmanTable,this.quantTable=new Q.lossless.QuantizationTable,this.scan=new Q.lossless.ScanHeader,this.DU=Q.lossless.Utils.createArray(10,4,64),this.HuffTab=Q.lossless.Utils.createArray(4,2,12800),this.IDCT_Source=[],this.nBlock=[],this.acTab=Q.lossless.Utils.createArray(10,1),this.dcTab=Q.lossless.Utils.createArray(10,1),this.qTab=Q.lossless.Utils.createArray(10,1),this.marker=0,this.markerIndex=0,this.numComp=0,this.restartInterval=0,this.selection=0,this.xDim=0,this.yDim=0,this.xLoc=0,this.yLoc=0,this.numBytes=0,this.outputData=null,this.restarting=!1,this.mask=0,void 0!==I&&(this.numBytes=I)},Q.lossless.Decoder.IDCT_P=[0,5,40,16,45,2,7,42,21,56,8,61,18,47,1,4,41,23,58,13,32,24,37,10,63,17,44,3,6,43,20,57,15,34,29,48,53,26,39,9,60,19,46,22,59,12,33,31,50,55,25,36,11,62,14,35,28,49,52,27,38,30,51,54],Q.lossless.Decoder.TABLE=[0,1,5,6,14,15,27,28,2,4,7,13,16,26,29,42,3,8,12,17,25,30,41,43,9,11,18,24,31,40,44,53,10,19,23,32,39,45,52,54,20,22,33,38,46,51,55,60,21,34,37,47,50,56,59,61,35,36,48,49,57,58,62,63],Q.lossless.Decoder.MAX_HUFFMAN_SUBTREE=50,Q.lossless.Decoder.MSB=2147483648,Q.lossless.Decoder.RESTART_MARKER_BEGIN=65488,Q.lossless.Decoder.RESTART_MARKER_END=65495,Q.lossless.Decoder.prototype.decompress=function(A,I,g){return this.decode(A,I,g).buffer},Q.lossless.Decoder.prototype.decode=function(A,I,g,B){var C,E,i,o,D=0,a=[],s=[],w=[];if(void 0!==A&&(this.buffer=A),void 0!==B&&(this.numBytes=B),this.stream=new Q.lossless.DataStream(this.buffer,I,g),this.buffer=null,this.xLoc=0,this.yLoc=0,65496!==(C=this.stream.get16()))throw new Error("Not a JPEG file");for(C=this.stream.get16();C>>4!=4092||65476===C;){switch(C){case 65476:this.huffTable.read(this.stream,this.HuffTab);break;case 65484:throw new Error("Program doesn't support arithmetic coding. (format throw new IOException)");case 65499:this.quantTable.read(this.stream,Q.lossless.Decoder.TABLE);break;case 65501:this.restartInterval=this.readNumber();break;case 65504:case 65505:case 65506:case 65507:case 65508:case 65509:case 65510:case 65511:case 65512:case 65513:case 65514:case 65515:case 65516:case 65517:case 65518:case 65519:this.readApp();break;case 65534:this.readComment();break;default:if(C>>8!=255)throw new Error("ERROR: format throw new IOException! (decode)")}C=this.stream.get16()}if(C<65472||C>65479)throw new Error("ERROR: could not handle arithmetic code!");this.frame.read(this.stream),C=this.stream.get16();do{for(;65498!==C;){switch(C){case 65476:this.huffTable.read(this.stream,this.HuffTab);break;case 65484:throw new Error("Program doesn't support arithmetic coding. (format throw new IOException)");case 65499:this.quantTable.read(this.stream,Q.lossless.Decoder.TABLE);break;case 65501:this.restartInterval=this.readNumber();break;case 65504:case 65505:case 65506:case 65507:case 65508:case 65509:case 65510:case 65511:case 65512:case 65513:case 65514:case 65515:case 65516:case 65517:case 65518:case 65519:this.readApp();break;case 65534:this.readComment();break;default:if(C>>8!=255)throw new Error("ERROR: format throw new IOException! (Parser.decode)")}C=this.stream.get16()}switch(this.precision=this.frame.precision,this.components=this.frame.components,this.numBytes||(this.numBytes=parseInt(Math.ceil(this.precision/8))),1==this.numBytes?this.mask=255:this.mask=65535,this.scan.read(this.stream),this.numComp=this.scan.numComp,this.selection=this.scan.selection,1===this.numBytes?3===this.numComp?(this.getter=this.getValueRGB,this.setter=this.setValueRGB,this.output=this.outputRGB):(this.getter=this.getValue8,this.setter=this.setValue8,this.output=this.outputSingle):(this.getter=this.getValue16,this.setter=this.setValue16,this.output=this.outputSingle),this.selection){case 2:this.selector=this.select2;break;case 3:this.selector=this.select3;break;case 4:this.selector=this.select4;break;case 5:this.selector=this.select5;break;case 6:this.selector=this.select6;break;case 7:this.selector=this.select7;break;default:this.selector=this.select1}for(this.scanComps=this.scan.components,this.quantTables=this.quantTable.quantTables,E=0;E<this.numComp;E+=1)i=this.scanComps[E].scanCompSel,this.qTab[E]=this.quantTables[this.components[i].quantTableSel],this.nBlock[E]=this.components[i].vSamp*this.components[i].hSamp,this.dcTab[E]=this.HuffTab[this.scanComps[E].dcTabSel][0],this.acTab[E]=this.HuffTab[this.scanComps[E].acTabSel][1];for(this.xDim=this.frame.dimX,this.yDim=this.frame.dimY,1==this.numBytes?this.outputData=new Uint8Array(new ArrayBuffer(this.xDim*this.yDim*this.numBytes*this.numComp)):this.outputData=new Uint16Array(new ArrayBuffer(this.xDim*this.yDim*this.numBytes*this.numComp)),D+=1;;){for(s[0]=0,w[0]=0,E=0;E<10;E+=1)a[E]=1<<this.precision-1;if(0===this.restartInterval){for(C=this.decodeUnit(a,s,w);0===C&&this.xLoc<this.xDim&&this.yLoc<this.yDim;)this.output(a),C=this.decodeUnit(a,s,w);break}for(o=0;o<this.restartInterval&&(this.restarting=0==o,C=this.decodeUnit(a,s,w),this.output(a),0===C);o+=1);if(0===C&&(0!==this.markerIndex?(C=65280|this.marker,this.markerIndex=0):C=this.stream.get16()),!(C>=Q.lossless.Decoder.RESTART_MARKER_BEGIN&&C<=Q.lossless.Decoder.RESTART_MARKER_END))break}65500===C&&1===D&&(this.readNumber(),C=this.stream.get16())}while(65497!==C&&this.xLoc<this.xDim&&this.yLoc<this.yDim&&0===D);return this.outputData},Q.lossless.Decoder.prototype.decodeUnit=function(A,I,g){return 1==this.numComp?this.decodeSingle(A,I,g):3==this.numComp?this.decodeRGB(A,I,g):-1},Q.lossless.Decoder.prototype.select1=function(A){return this.getPreviousX(A)},Q.lossless.Decoder.prototype.select2=function(A){return this.getPreviousY(A)},Q.lossless.Decoder.prototype.select3=function(A){return this.getPreviousXY(A)},Q.lossless.Decoder.prototype.select4=function(A){return this.getPreviousX(A)+this.getPreviousY(A)-this.getPreviousXY(A)},Q.lossless.Decoder.prototype.select5=function(A){return this.getPreviousX(A)+(this.getPreviousY(A)-this.getPreviousXY(A)>>1)},Q.lossless.Decoder.prototype.select6=function(A){return this.getPreviousY(A)+(this.getPreviousX(A)-this.getPreviousXY(A)>>1)},Q.lossless.Decoder.prototype.select7=function(A){return(this.getPreviousX(A)+this.getPreviousY(A))/2},Q.lossless.Decoder.prototype.decodeRGB=function(A,I,g){var B,C,E,i,o,D,a,s;for(A[0]=this.selector(0),A[1]=this.selector(1),A[2]=this.selector(2),o=0;o<this.numComp;o+=1)for(i=this.qTab[o],C=this.acTab[o],E=this.dcTab[o],D=0;D<this.nBlock[o];D+=1){for(a=0;a<this.IDCT_Source.length;a+=1)this.IDCT_Source[a]=0;if((B=this.getHuffmanValue(E,I,g))>=65280)return B;for(A[o]=this.IDCT_Source[0]=A[o]+this.getn(g,B,I,g),this.IDCT_Source[0]*=i[0],s=1;s<64;s+=1){if((B=this.getHuffmanValue(C,I,g))>=65280)return B;if(s+=B>>4,0==(15&B)){if(B>>4==0)break}else this.IDCT_Source[Q.lossless.Decoder.IDCT_P[s]]=this.getn(g,15&B,I,g)*i[s]}}return 0},Q.lossless.Decoder.prototype.decodeSingle=function(A,I,g){var B,C,E,i;for(this.restarting?(this.restarting=!1,A[0]=1<<this.frame.precision-1):A[0]=this.selector(),C=0;C<this.nBlock[0];C+=1){if((B=this.getHuffmanValue(this.dcTab[0],I,g))>=65280)return B;if((i=(E=this.getn(A,B,I,g))>>8)>=Q.lossless.Decoder.RESTART_MARKER_BEGIN&&i<=Q.lossless.Decoder.RESTART_MARKER_END)return i;A[0]+=E}return 0},Q.lossless.Decoder.prototype.getHuffmanValue=function(A,I,g){var B,C;if(65535,g[0]<8?(I[0]<<=8,255===(C=this.stream.get8())&&(this.marker=this.stream.get8(),0!==this.marker&&(this.markerIndex=9)),I[0]|=C):g[0]-=8,0!=((B=A[I[0]>>g[0]])&Q.lossless.Decoder.MSB)){if(0!==this.markerIndex)return this.markerIndex=0,65280|this.marker;I[0]&=65535>>16-g[0],I[0]<<=8,255===(C=this.stream.get8())&&(this.marker=this.stream.get8(),0!==this.marker&&(this.markerIndex=9)),I[0]|=C,B=A[256*(255&B)+(I[0]>>g[0])],g[0]+=8}if(g[0]+=8-(B>>8),g[0]<0)throw new Error("index="+g[0]+" temp="+I[0]+" code="+B+" in HuffmanValue()");return g[0]<this.markerIndex?(this.markerIndex=0,65280|this.marker):(I[0]&=65535>>16-g[0],255&B)},Q.lossless.Decoder.prototype.getn=function(A,I,g,B){var Q,C;if(1,-1,65535,0===I)return 0;if(16===I)return A[0]>=0?-32768:32768;if(B[0]-=I,B[0]>=0){if(B[0]<this.markerIndex&&!this.isLastPixel())return this.markerIndex=0,(65280|this.marker)<<8;Q=g[0]>>B[0],g[0]&=65535>>16-B[0]}else{if(g[0]<<=8,255===(C=this.stream.get8())&&(this.marker=this.stream.get8(),0!==this.marker&&(this.markerIndex=9)),g[0]|=C,B[0]+=8,B[0]<0){if(0!==this.markerIndex)return this.markerIndex=0,(65280|this.marker)<<8;g[0]<<=8,255===(C=this.stream.get8())&&(this.marker=this.stream.get8(),0!==this.marker&&(this.markerIndex=9)),g[0]|=C,B[0]+=8}if(B[0]<0)throw new Error("index="+B[0]+" in getn()");if(B[0]<this.markerIndex)return this.markerIndex=0,(65280|this.marker)<<8;Q=g[0]>>B[0],g[0]&=65535>>16-B[0]}return Q<1<<I-1&&(Q+=1+(-1<<I)),Q},Q.lossless.Decoder.prototype.getPreviousX=function(A){return this.xLoc>0?this.getter(this.yLoc*this.xDim+this.xLoc-1,A):this.yLoc>0?this.getPreviousY(A):1<<this.frame.precision-1},Q.lossless.Decoder.prototype.getPreviousXY=function(A){return this.xLoc>0&&this.yLoc>0?this.getter((this.yLoc-1)*this.xDim+this.xLoc-1,A):this.getPreviousY(A)},Q.lossless.Decoder.prototype.getPreviousY=function(A){return this.yLoc>0?this.getter((this.yLoc-1)*this.xDim+this.xLoc,A):this.getPreviousX(A)},Q.lossless.Decoder.prototype.isLastPixel=function(){return this.xLoc===this.xDim-1&&this.yLoc===this.yDim-1},Q.lossless.Decoder.prototype.outputSingle=function(A){this.xLoc<this.xDim&&this.yLoc<this.yDim&&(this.setter(this.yLoc*this.xDim+this.xLoc,this.mask&A[0]),this.xLoc+=1,this.xLoc>=this.xDim&&(this.yLoc+=1,this.xLoc=0))},Q.lossless.Decoder.prototype.outputRGB=function(A){var I=this.yLoc*this.xDim+this.xLoc;this.xLoc<this.xDim&&this.yLoc<this.yDim&&(this.setter(I,A[0],0),this.setter(I,A[1],1),this.setter(I,A[2],2),this.xLoc+=1,this.xLoc>=this.xDim&&(this.yLoc+=1,this.xLoc=0))},Q.lossless.Decoder.prototype.setValue8=function(A,I){this.outputData[A]=I},Q.lossless.Decoder.prototype.getValue8=function(A){return this.outputData[A]},(B=new ArrayBuffer(2),new DataView(B).setInt16(0,256,!0),256===new Int16Array(B)[0])?(Q.lossless.Decoder.prototype.setValue16=Q.lossless.Decoder.prototype.setValue8,Q.lossless.Decoder.prototype.getValue16=Q.lossless.Decoder.prototype.getValue8):(Q.lossless.Decoder.prototype.setValue16=function(A,I){this.outputData[A]=(255&I)<<8|I>>8&255},Q.lossless.Decoder.prototype.getValue16=function(A){var I=this.outputData[A];return(255&I)<<8|I>>8&255}),Q.lossless.Decoder.prototype.setValueRGB=function(A,I,g){this.outputData[3*A+g]=I},Q.lossless.Decoder.prototype.getValueRGB=function(A,I){return this.outputData[3*A+I]},Q.lossless.Decoder.prototype.readApp=function(){var A=0,I=this.stream.get16();for(A+=2;A<I;)this.stream.get8(),A+=1;return I},Q.lossless.Decoder.prototype.readComment=function(){var A,I="",g=0;for(A=this.stream.get16(),g+=2;g<A;)I+=this.stream.get8(),g+=1;return I},Q.lossless.Decoder.prototype.readNumber=function(){if(4!==this.stream.get16())throw new Error("ERROR: Define number format throw new IOException [Ld!=4]");return this.stream.get16()},"undefined"!==typeof I&&I.exports&&(I.exports=Q.lossless.Decoder)},{"./data-stream.js":2,"./frame-header.js":4,"./huffman-table.js":5,"./quantization-table.js":7,"./scan-header.js":9,"./utils.js":10}],4:[function(A,I,g){"use strict";var B=B||{};B.lossless=B.lossless||{},B.lossless.ComponentSpec=B.lossless.ComponentSpec||(void 0!==A?A("./component-spec.js"):null),B.lossless.DataStream=B.lossless.DataStream||(void 0!==A?A("./data-stream.js"):null),B.lossless.FrameHeader=B.lossless.FrameHeader||function(){this.components=[],this.dimX=0,this.dimY=0,this.numComp=0,this.precision=0},B.lossless.FrameHeader.prototype.read=function(A){var I,g,Q,C,E=0;for(I=A.get16(),E+=2,this.precision=A.get8(),E+=1,this.dimY=A.get16(),E+=2,this.dimX=A.get16(),E+=2,this.numComp=A.get8(),E+=1,g=1;g<=this.numComp;g+=1){if(E>I)throw new Error("ERROR: frame format error");if(Q=A.get8(),(E+=1)>=I)throw new Error("ERROR: frame format error [c>=Lf]");C=A.get8(),E+=1,this.components[Q]||(this.components[Q]=new B.lossless.ComponentSpec),this.components[Q].hSamp=C>>4,this.components[Q].vSamp=15&C,this.components[Q].quantTableSel=A.get8(),E+=1}if(E!==I)throw new Error("ERROR: frame format error [Lf!=count]");return 1},"undefined"!==typeof I&&I.exports&&(I.exports=B.lossless.FrameHeader)},{"./component-spec.js":1,"./data-stream.js":2}],5:[function(A,I,g){"use strict";var B=B||{};B.lossless=B.lossless||{},B.lossless.DataStream=B.lossless.DataStream||(void 0!==A?A("./data-stream.js"):null),B.lossless.Utils=B.lossless.Utils||(void 0!==A?A("./utils.js"):null),B.lossless.HuffmanTable=B.lossless.HuffmanTable||function(){this.l=B.lossless.Utils.createArray(4,2,16),this.th=[],this.v=B.lossless.Utils.createArray(4,2,16,200),this.tc=B.lossless.Utils.createArray(4,2),this.tc[0][0]=0,this.tc[1][0]=0,this.tc[2][0]=0,this.tc[3][0]=0,this.tc[0][1]=0,this.tc[1][1]=0,this.tc[2][1]=0,this.tc[3][1]=0,this.th[0]=0,this.th[1]=0,this.th[2]=0,this.th[3]=0},B.lossless.HuffmanTable.MSB=2147483648,B.lossless.HuffmanTable.prototype.read=function(A,I){var g,B,Q,C,E,i,o=0;for(g=A.get16(),o+=2;o<g;){if(o+=1,(Q=15&(B=A.get8()))>3)throw new Error("ERROR: Huffman table ID > 3");if((C=B>>4)>2)throw new Error("ERROR: Huffman table [Table class > 2 ]");for(this.th[Q]=1,this.tc[Q][C]=1,E=0;E<16;E+=1)this.l[Q][C][E]=A.get8(),o+=1;for(E=0;E<16;E+=1)for(i=0;i<this.l[Q][C][E];i+=1){if(o>g)throw new Error("ERROR: Huffman table format error [count>Lh]");this.v[Q][C][E][i]=A.get8(),o+=1}}if(o!==g)throw new Error("ERROR: Huffman table format error [count!=Lf]");for(E=0;E<4;E+=1)for(i=0;i<2;i+=1)0!==this.tc[E][i]&&this.buildHuffTable(I[E][i],this.l[E][i],this.v[E][i]);return 1},B.lossless.HuffmanTable.prototype.buildHuffTable=function(A,I,g){var Q,C,E,i,o;for(256,C=0,E=0;E<8;E+=1)for(i=0;i<I[E];i+=1)for(o=0;o<256>>E+1;o+=1)A[C]=g[E][i]|E+1<<8,C+=1;for(E=1;C<256;E+=1,C+=1)A[C]=E|B.lossless.HuffmanTable.MSB;for(Q=1,C=0,E=8;E<16;E+=1)for(i=0;i<I[E];i+=1){for(o=0;o<256>>E-7;o+=1)A[256*Q+C]=g[E][i]|E+1<<8,C+=1;if(C>=256){if(C>256)throw new Error("ERROR: Huffman table error(1)!");C=0,Q+=1}}},"undefined"!==typeof I&&I.exports&&(I.exports=B.lossless.HuffmanTable)},{"./data-stream.js":2,"./utils.js":10}],6:[function(A,I,g){"use strict";var B=B||{};B.lossless=B.lossless||{},B.lossless.ComponentSpec=B.lossless.ComponentSpec||(void 0!==A?A("./component-spec.js"):null),B.lossless.DataStream=B.lossless.DataStream||(void 0!==A?A("./data-stream.js"):null),B.lossless.Decoder=B.lossless.Decoder||(void 0!==A?A("./decoder.js"):null),B.lossless.FrameHeader=B.lossless.FrameHeader||(void 0!==A?A("./frame-header.js"):null),B.lossless.HuffmanTable=B.lossless.HuffmanTable||(void 0!==A?A("./huffman-table.js"):null),B.lossless.QuantizationTable=B.lossless.QuantizationTable||(void 0!==A?A("./quantization-table.js"):null),B.lossless.ScanComponent=B.lossless.ScanComponent||(void 0!==A?A("./scan-component.js"):null),B.lossless.ScanHeader=B.lossless.ScanHeader||(void 0!==A?A("./scan-header.js"):null),B.lossless.Utils=B.lossless.Utils||(void 0!==A?A("./utils.js"):null),"undefined"!==typeof I&&I.exports&&(I.exports=B)},{"./component-spec.js":1,"./data-stream.js":2,"./decoder.js":3,"./frame-header.js":4,"./huffman-table.js":5,"./quantization-table.js":7,"./scan-component.js":8,"./scan-header.js":9,"./utils.js":10}],7:[function(A,I,g){"use strict";var B=B||{};B.lossless=B.lossless||{},B.lossless.DataStream=B.lossless.DataStream||(void 0!==A?A("./data-stream.js"):null),B.lossless.Utils=B.lossless.Utils||(void 0!==A?A("./utils.js"):null),B.lossless.QuantizationTable=B.lossless.QuantizationTable||function(){this.precision=[],this.tq=[],this.quantTables=B.lossless.Utils.createArray(4,64),this.tq[0]=0,this.tq[1]=0,this.tq[2]=0,this.tq[3]=0},B.lossless.QuantizationTable.enhanceQuantizationTable=function(A,I){var g;for(g=0;g<8;g+=1)A[I[0+g]]*=90,A[I[32+g]]*=90,A[I[16+g]]*=118,A[I[48+g]]*=49,A[I[40+g]]*=71,A[I[8+g]]*=126,A[I[56+g]]*=25,A[I[24+g]]*=106;for(g=0;g<8;g+=1)A[I[0+8*g]]*=90,A[I[4+8*g]]*=90,A[I[2+8*g]]*=118,A[I[6+8*g]]*=49,A[I[5+8*g]]*=71,A[I[1+8*g]]*=126,A[I[7+8*g]]*=25,A[I[3+8*g]]*=106;for(g=0;g<64;g+=1)A[g]>>=6},B.lossless.QuantizationTable.prototype.read=function(A,I){var g,Q,C,E,i=0;for(g=A.get16(),i+=2;i<g;){if(i+=1,(C=15&(Q=A.get8()))>3)throw new Error("ERROR: Quantization table ID > 3");if(this.precision[C]=Q>>4,0===this.precision[C])this.precision[C]=8;else{if(1!==this.precision[C])throw new Error("ERROR: Quantization table precision error");this.precision[C]=16}if(this.tq[C]=1,8===this.precision[C]){for(E=0;E<64;E+=1){if(i>g)throw new Error("ERROR: Quantization table format error");this.quantTables[C][E]=A.get8(),i+=1}B.lossless.QuantizationTable.enhanceQuantizationTable(this.quantTables[C],I)}else{for(E=0;E<64;E+=1){if(i>g)throw new Error("ERROR: Quantization table format error");this.quantTables[C][E]=A.get16(),i+=2}B.lossless.QuantizationTable.enhanceQuantizationTable(this.quantTables[C],I)}}if(i!==g)throw new Error("ERROR: Quantization table error [count!=Lq]");return 1},"undefined"!==typeof I&&I.exports&&(I.exports=B.lossless.QuantizationTable)},{"./data-stream.js":2,"./utils.js":10}],8:[function(A,I,g){"use strict";var B=B||{};B.lossless=B.lossless||{},B.lossless.ScanComponent=B.lossless.ScanComponent||function(){this.acTabSel=0,this.dcTabSel=0,this.scanCompSel=0},"undefined"!==typeof I&&I.exports&&(I.exports=B.lossless.ScanComponent)},{}],9:[function(A,I,g){"use strict";var B=B||{};B.lossless=B.lossless||{},B.lossless.DataStream=B.lossless.DataStream||(void 0!==A?A("./data-stream.js"):null),B.lossless.ScanComponent=B.lossless.ScanComponent||(void 0!==A?A("./scan-component.js"):null),B.lossless.ScanHeader=B.lossless.ScanHeader||function(){this.ah=0,this.al=0,this.numComp=0,this.selection=0,this.spectralEnd=0,this.components=[]},B.lossless.ScanHeader.prototype.read=function(A){var I,g,Q,C=0;for(I=A.get16(),C+=2,this.numComp=A.get8(),C+=1,g=0;g<this.numComp;g+=1){if(this.components[g]=new B.lossless.ScanComponent,C>I)throw new Error("ERROR: scan header format error");this.components[g].scanCompSel=A.get8(),C+=1,Q=A.get8(),C+=1,this.components[g].dcTabSel=Q>>4,this.components[g].acTabSel=15&Q}if(this.selection=A.get8(),C+=1,this.spectralEnd=A.get8(),C+=1,Q=A.get8(),this.ah=Q>>4,this.al=15&Q,(C+=1)!==I)throw new Error("ERROR: scan header format error [count!=Ns]");return 1},"undefined"!==typeof I&&I.exports&&(I.exports=B.lossless.ScanHeader)},{"./data-stream.js":2,"./scan-component.js":8}],10:[function(A,I,g){"use strict";var B=B||{};B.lossless=B.lossless||{},B.lossless.Utils=B.lossless.Utils||{},B.lossless.Utils.createArray=function(A){var I=new Array(A||0),g=A;if(arguments.length>1)for(var Q=Array.prototype.slice.call(arguments,1);g--;)I[A-1-g]=B.lossless.Utils.createArray.apply(this,Q);return I},B.lossless.Utils.makeCRCTable=function(){for(var A,I=[],g=0;g<256;g++){A=g;for(var B=0;B<8;B++)A=1&A?3988292384^A>>>1:A>>>1;I[g]=A}return I},B.lossless.Utils.crc32=function(A){for(var I=new Uint8Array(A.buffer),g=B.lossless.Utils.crcTable||(B.lossless.Utils.crcTable=B.lossless.Utils.makeCRCTable()),Q=-1,C=0;C<I.length;C++)Q=Q>>>8^g[255&(Q^I[C])];return(-1^Q)>>>0},"undefined"!==typeof I&&I.exports&&(I.exports=B.lossless.Utils)},{}]},{},[6])(6)}))},4559:(A,I,g)=>{A.exports=g(9842)},7552:(A,I,g)=>{A.exports=g(5697)},7647:(A,I,g)=>{A.exports=g(3798)},6028:(A,I,g)=>{A.exports=g(671)},1246:(A,I,g)=>{A.exports=g(8730)},337:(A,I,g)=>{A.exports=g(3751)},2770:(A,I,g)=>{A.exports=g(1380)},1882:(A,I,g)=>{A.exports=g(6601)},7878:(A,I,g)=>{A.exports=g(8783)},2250:(A,I,g)=>{A.exports=g(4731)},1082:(A,I,g)=>{A.exports=g(5723)},5534:(A,I,g)=>{A.exports=g(5213)},7458:A=>{var I=function(A){"use strict";var I,g=Object.prototype,B=g.hasOwnProperty,Q="function"==typeof Symbol?Symbol:{},C=Q.iterator||"@@iterator",E=Q.asyncIterator||"@@asyncIterator",i=Q.toStringTag||"@@toStringTag";function o(A,I,g){return Object.defineProperty(A,I,{value:g,enumerable:!0,configurable:!0,writable:!0}),A[I]}try{o({},"")}catch(A){o=function(A,I,g){return A[I]=g}}function D(A,I,g,B){var Q=I&&I.prototype instanceof F?I:F,C=Object.create(Q.prototype),E=new H(B||[]);return C._invoke=function(A,I,g){var B=s;return function(Q,C){if(B===t)throw new Error("Generator is already running");if(B===G){if("throw"===Q)throw C;return L()}for(g.method=Q,g.arg=C;;){var E=g.delegate;if(E){var i=U(E,g);if(i){if(i===h)continue;return i}}if("next"===g.method)g.sent=g._sent=g.arg;else if("throw"===g.method){if(B===s)throw B=G,g.arg;g.dispatchException(g.arg)}else"return"===g.method&&g.abrupt("return",g.arg);B=t;var o=a(A,I,g);if("normal"===o.type){if(B=g.done?G:w,o.arg===h)continue;return{value:o.arg,done:g.done}}"throw"===o.type&&(B=G,g.method="throw",g.arg=o.arg)}}}(A,g,E),C}function a(A,I,g){try{return{type:"normal",arg:A.call(I,g)}}catch(A){return{type:"throw",arg:A}}}A.wrap=D;var s="suspendedStart",w="suspendedYield",t="executing",G="completed",h={};function F(){}function y(){}function c(){}var r={};o(r,C,(function(){return this}));var N=Object.getPrototypeOf,R=N&&N(N(M([])));R&&R!==g&&B.call(R,C)&&(r=R);var e=c.prototype=F.prototype=Object.create(r);function n(A){["next","throw","return"].forEach((function(I){o(A,I,(function(A){return this._invoke(I,A)}))}))}function S(A,I){function g(Q,C,E,i){var o=a(A[Q],A,C);if("throw"!==o.type){var D=o.arg,s=D.value;return s&&"object"==typeof s&&B.call(s,"__await")?I.resolve(s.__await).then((function(A){g("next",A,E,i)}),(function(A){g("throw",A,E,i)})):I.resolve(s).then((function(A){D.value=A,E(D)}),(function(A){return g("throw",A,E,i)}))}i(o.arg)}var Q;this._invoke=function(A,B){function C(){return new I((function(I,Q){g(A,B,I,Q)}))}return Q=Q?Q.then(C,C):C()}}function U(A,g){var B=A.iterator[g.method];if(B===I){if(g.delegate=null,"throw"===g.method){if(A.iterator.return&&(g.method="return",g.arg=I,U(A,g),"throw"===g.method))return h;g.method="throw",g.arg=new TypeError("The iterator does not provide a 'throw' method")}return h}var Q=a(B,A.iterator,g.arg);if("throw"===Q.type)return g.method="throw",g.arg=Q.arg,g.delegate=null,h;var C=Q.arg;return C?C.done?(g[A.resultName]=C.value,g.next=A.nextLoc,"return"!==g.method&&(g.method="next",g.arg=I),g.delegate=null,h):C:(g.method="throw",g.arg=new TypeError("iterator result is not an object"),g.delegate=null,h)}function k(A){var I={tryLoc:A[0]};1 in A&&(I.catchLoc=A[1]),2 in A&&(I.finallyLoc=A[2],I.afterLoc=A[3]),this.tryEntries.push(I)}function J(A){var I=A.completion||{};I.type="normal",delete I.arg,A.completion=I}function H(A){this.tryEntries=[{tryLoc:"root"}],A.forEach(k,this),this.reset(!0)}function M(A){if(A){var g=A[C];if(g)return g.call(A);if("function"==typeof A.next)return A;if(!isNaN(A.length)){var Q=-1,E=function g(){for(;++Q<A.length;)if(B.call(A,Q))return g.value=A[Q],g.done=!1,g;return g.value=I,g.done=!0,g};return E.next=E}}return{next:L}}function L(){return{value:I,done:!0}}return y.prototype=c,o(e,"constructor",c),o(c,"constructor",y),y.displayName=o(c,i,"GeneratorFunction"),A.isGeneratorFunction=function(A){var I="function"==typeof A&&A.constructor;return!!I&&(I===y||"GeneratorFunction"===(I.displayName||I.name))},A.mark=function(A){return Object.setPrototypeOf?Object.setPrototypeOf(A,c):(A.__proto__=c,o(A,i,"GeneratorFunction")),A.prototype=Object.create(e),A},A.awrap=function(A){return{__await:A}},n(S.prototype),o(S.prototype,E,(function(){return this})),A.AsyncIterator=S,A.async=function(I,g,B,Q,C){void 0===C&&(C=Promise);var E=new S(D(I,g,B,Q),C);return A.isGeneratorFunction(g)?E:E.next().then((function(A){return A.done?A.value:E.next()}))},n(e),o(e,i,"Generator"),o(e,C,(function(){return this})),o(e,"toString",(function(){return"[object Generator]"})),A.keys=function(A){var I=[];for(var g in A)I.push(g);return I.reverse(),function g(){for(;I.length;){var B=I.pop();if(B in A)return g.value=B,g.done=!1,g}return g.done=!0,g}},A.values=M,H.prototype={constructor:H,reset:function(A){if(this.prev=0,this.next=0,this.sent=this._sent=I,this.done=!1,this.delegate=null,this.method="next",this.arg=I,this.tryEntries.forEach(J),!A)for(var g in this)"t"===g.charAt(0)&&B.call(this,g)&&!isNaN(+g.slice(1))&&(this[g]=I)},stop:function(){this.done=!0;var A=this.tryEntries[0].completion;if("throw"===A.type)throw A.arg;return this.rval},dispatchException:function(A){if(this.done)throw A;var g=this;function Q(B,Q){return i.type="throw",i.arg=A,g.next=B,Q&&(g.method="next",g.arg=I),!!Q}for(var C=this.tryEntries.length-1;C>=0;--C){var E=this.tryEntries[C],i=E.completion;if("root"===E.tryLoc)return Q("end");if(E.tryLoc<=this.prev){var o=B.call(E,"catchLoc"),D=B.call(E,"finallyLoc");if(o&&D){if(this.prev<E.catchLoc)return Q(E.catchLoc,!0);if(this.prev<E.finallyLoc)return Q(E.finallyLoc)}else if(o){if(this.prev<E.catchLoc)return Q(E.catchLoc,!0)}else{if(!D)throw new Error("try statement without catch or finally");if(this.prev<E.finallyLoc)return Q(E.finallyLoc)}}}},abrupt:function(A,I){for(var g=this.tryEntries.length-1;g>=0;--g){var Q=this.tryEntries[g];if(Q.tryLoc<=this.prev&&B.call(Q,"finallyLoc")&&this.prev<Q.finallyLoc){var C=Q;break}}C&&("break"===A||"continue"===A)&&C.tryLoc<=I&&I<=C.finallyLoc&&(C=null);var E=C?C.completion:{};return E.type=A,E.arg=I,C?(this.method="next",this.next=C.finallyLoc,h):this.complete(E)},complete:function(A,I){if("throw"===A.type)throw A.arg;return"break"===A.type||"continue"===A.type?this.next=A.arg:"return"===A.type?(this.rval=this.arg=A.arg,this.method="return",this.next="end"):"normal"===A.type&&I&&(this.next=I),h},finish:function(A){for(var I=this.tryEntries.length-1;I>=0;--I){var g=this.tryEntries[I];if(g.finallyLoc===A)return this.complete(g.completion,g.afterLoc),J(g),h}},catch:function(A){for(var I=this.tryEntries.length-1;I>=0;--I){var g=this.tryEntries[I];if(g.tryLoc===A){var B=g.completion;if("throw"===B.type){var Q=B.arg;J(g)}return Q}}throw new Error("illegal catch attempt")},delegateYield:function(A,g,B){return this.delegate={iterator:M(A),resultName:g,nextLoc:B},"next"===this.method&&(this.arg=I),h}},A}(A.exports);try{regeneratorRuntime=I}catch(A){"object"==typeof globalThis?globalThis.regeneratorRuntime=I:Function("r","regeneratorRuntime = r")(I)}},2043:(A,I,g)=>{A.exports=g(7458)},8327:(A,I,g)=>{var B,Q=(B=(B="undefined"!=typeof document&&document.currentScript?document.currentScript.src:void 0)||"/index.js",function(A){var I,Q,C=void 0!==(A=A||{})?A:{};C.ready=new Promise((function(A,g){I=A,Q=g}));var E,i,o,D=Object.assign({},C),a=[],s="object"==typeof window,w="function"==typeof importScripts,t="object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node,G="";if(t){var h=g(981),F=g(1209);G=w?F.dirname(G)+"/":"//",E=(A,I)=>(A=v(A)?new URL(A):F.normalize(A),h.readFileSync(A,I?void 0:"utf8")),o=A=>{var I=E(A,!0);return I.buffer||(I=new Uint8Array(I)),I},i=(A,I,g)=>{A=v(A)?new URL(A):F.normalize(A),h.readFile(A,(function(A,B){A?g(A):I(B.buffer)}))},process.argv.length>1&&process.argv[1].replace(/\\/g,"/"),a=process.argv.slice(2),process.on("uncaughtException",(function(A){if(!(A instanceof P))throw A})),process.on("unhandledRejection",(function(A){throw A})),C.inspect=function(){return"[Emscripten Module object]"}}else(s||w)&&(w?G=self.location.href:"undefined"!=typeof document&&document.currentScript&&(G=document.currentScript.src),B&&(G=B),G=0!==G.indexOf("blob:")?G.substr(0,G.replace(/[?#].*/,"").lastIndexOf("/")+1):"",E=A=>{var I=new XMLHttpRequest;return I.open("GET",A,!1),I.send(null),I.responseText},w&&(o=A=>{var I=new XMLHttpRequest;return I.open("GET",A,!1),I.responseType="arraybuffer",I.send(null),new Uint8Array(I.response)}),i=(A,I,g)=>{var B=new XMLHttpRequest;B.open("GET",A,!0),B.responseType="arraybuffer",B.onload=()=>{200==B.status||0==B.status&&B.response?I(B.response):g()},B.onerror=g,B.send(null)});C.print||console.log.bind(console);var y,c=C.printErr||console.warn.bind(console);Object.assign(C,D),D=null,C.arguments&&(a=C.arguments),C.thisProgram&&C.thisProgram,C.quit&&C.quit,C.wasmBinary&&(y=C.wasmBinary);var r;C.noExitRuntime;"object"!=typeof WebAssembly&&x("no native wasm support detected");var N,R,e,n,S,U,k,J,H,M=!1,L="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0;function Y(A,I){return A?function(A,I,g){for(var B=I+g,Q=I;A[Q]&&!(Q>=B);)++Q;if(Q-I>16&&A.buffer&&L)return L.decode(A.subarray(I,Q));for(var C="";I<Q;){var E=A[I++];if(128&E){var i=63&A[I++];if(192!=(224&E)){var o=63&A[I++];if((E=224==(240&E)?(15&E)<<12|i<<6|o:(7&E)<<18|i<<12|o<<6|63&A[I++])<65536)C+=String.fromCharCode(E);else{var D=E-65536;C+=String.fromCharCode(55296|D>>10,56320|1023&D)}}else C+=String.fromCharCode((31&E)<<6|i)}else C+=String.fromCharCode(E)}return C}(e,A,I):""}function K(A,I,g){return function(A,I,g,B){if(!(B>0))return 0;for(var Q=g,C=g+B-1,E=0;E<A.length;++E){var i=A.charCodeAt(E);if(i>=55296&&i<=57343&&(i=65536+((1023&i)<<10)|1023&A.charCodeAt(++E)),i<=127){if(g>=C)break;I[g++]=i}else if(i<=2047){if(g+1>=C)break;I[g++]=192|i>>6,I[g++]=128|63&i}else if(i<=65535){if(g+2>=C)break;I[g++]=224|i>>12,I[g++]=128|i>>6&63,I[g++]=128|63&i}else{if(g+3>=C)break;I[g++]=240|i>>18,I[g++]=128|i>>12&63,I[g++]=128|i>>6&63,I[g++]=128|63&i}}return I[g]=0,g-Q}(A,e,I,g)}function d(A){N=A,C.HEAP8=R=new Int8Array(A),C.HEAP16=n=new Int16Array(A),C.HEAP32=U=new Int32Array(A),C.HEAPU8=e=new Uint8Array(A),C.HEAPU16=S=new Uint16Array(A),C.HEAPU32=k=new Uint32Array(A),C.HEAPF32=J=new Float32Array(A),C.HEAPF64=H=new Float64Array(A)}C.INITIAL_MEMORY;var l,f,u,q=[],p=[],b=[],W=0,Z=null,m=null;function x(A){C.onAbort&&C.onAbort(A),c(A="Aborted("+A+")"),M=!0,A+=". Build with -sASSERTIONS for more info.";var I=new WebAssembly.RuntimeError(A);throw Q(I),I}function T(A){return A.startsWith("data:application/octet-stream;base64,")}function v(A){return A.startsWith("file://")}function X(A){try{if(A==f&&y)return new Uint8Array(y);if(o)return o(A);throw"both async and sync fetching of the wasm failed"}catch(A){x(A)}}function P(A){this.name="ExitStatus",this.message="Program terminated with exit("+A+")",this.status=A}function V(A){for(;A.length>0;)A.shift()(C)}function O(A){this.excPtr=A,this.ptr=A-24,this.set_type=function(A){k[this.ptr+4>>2]=A},this.get_type=function(){return k[this.ptr+4>>2]},this.set_destructor=function(A){k[this.ptr+8>>2]=A},this.get_destructor=function(){return k[this.ptr+8>>2]},this.set_refcount=function(A){U[this.ptr>>2]=A},this.set_caught=function(A){A=A?1:0,R[this.ptr+12>>0]=A},this.get_caught=function(){return 0!=R[this.ptr+12>>0]},this.set_rethrown=function(A){A=A?1:0,R[this.ptr+13>>0]=A},this.get_rethrown=function(){return 0!=R[this.ptr+13>>0]},this.init=function(A,I){this.set_adjusted_ptr(0),this.set_type(A),this.set_destructor(I),this.set_refcount(0),this.set_caught(!1),this.set_rethrown(!1)},this.add_ref=function(){var A=U[this.ptr>>2];U[this.ptr>>2]=A+1},this.release_ref=function(){var A=U[this.ptr>>2];return U[this.ptr>>2]=A-1,1===A},this.set_adjusted_ptr=function(A){k[this.ptr+16>>2]=A},this.get_adjusted_ptr=function(){return k[this.ptr+16>>2]},this.get_exception_ptr=function(){if(dI(this.get_type()))return k[this.excPtr>>2];var A=this.get_adjusted_ptr();return 0!==A?A:this.excPtr}}T(f="charlswasm_decode.wasm")||(u=f,f=C.locateFile?C.locateFile(u,G):G+u);var j={};function z(A){for(;A.length;){var I=A.pop();A.pop()(I)}}function _(A){return this.fromWireType(U[A>>2])}var $={},AA={},IA={};function gA(A){if(void 0===A)return"_unknown";var I=(A=A.replace(/[^a-zA-Z0-9_]/g,"$")).charCodeAt(0);return I>=48&&I<=57?"_"+A:A}function BA(A,I){return A=gA(A),new Function("body","return function "+A+'() {\n "use strict"; return body.apply(this, arguments);\n};\n')(I)}function QA(A,I){var g=BA(I,(function(A){this.name=I,this.message=A;var g=new Error(A).stack;void 0!==g&&(this.stack=this.toString()+"\n"+g.replace(/^Error(:[^\n]*)?\n/,""))}));return g.prototype=Object.create(A.prototype),g.prototype.constructor=g,g.prototype.toString=function(){return void 0===this.message?this.name:this.name+": "+this.message},g}var CA=void 0;function EA(A){throw new CA(A)}function iA(A,I,g){function B(I){var B=g(I);B.length!==A.length&&EA("Mismatched type converter count");for(var Q=0;Q<A.length;++Q)tA(A[Q],B[Q])}A.forEach((function(A){IA[A]=I}));var Q=new Array(I.length),C=[],E=0;I.forEach(((A,I)=>{AA.hasOwnProperty(A)?Q[I]=AA[A]:(C.push(A),$.hasOwnProperty(A)||($[A]=[]),$[A].push((()=>{Q[I]=AA[A],++E===C.length&&B(Q)})))})),0===C.length&&B(Q)}function oA(A){switch(A){case 1:return 0;case 2:return 1;case 4:return 2;case 8:return 3;default:throw new TypeError("Unknown type size: "+A)}}var DA=void 0;function aA(A){for(var I="",g=A;e[g];)I+=DA[e[g++]];return I}var sA=void 0;function wA(A){throw new sA(A)}function tA(A,I,g={}){if(!("argPackAdvance"in I))throw new TypeError("registerType registeredInstance requires argPackAdvance");var B=I.name;if(A||wA('type "'+B+'" must have a positive integer typeid pointer'),AA.hasOwnProperty(A)){if(g.ignoreDuplicateRegistrations)return;wA("Cannot register type '"+B+"' twice")}if(AA[A]=I,delete IA[A],$.hasOwnProperty(A)){var Q=$[A];delete $[A],Q.forEach((A=>A()))}}function GA(A){if(!(this instanceof uA))return!1;if(!(A instanceof uA))return!1;for(var I=this.$$.ptrType.registeredClass,g=this.$$.ptr,B=A.$$.ptrType.registeredClass,Q=A.$$.ptr;I.baseClass;)g=I.upcast(g),I=I.baseClass;for(;B.baseClass;)Q=B.upcast(Q),B=B.baseClass;return I===B&&g===Q}function hA(A){wA(A.$$.ptrType.registeredClass.name+" instance already deleted")}var FA=!1;function yA(A){}function cA(A){A.count.value-=1,0===A.count.value&&function(A){A.smartPtr?A.smartPtrType.rawDestructor(A.smartPtr):A.ptrType.registeredClass.rawDestructor(A.ptr)}(A)}function rA(A,I,g){if(I===g)return A;if(void 0===g.baseClass)return null;var B=rA(A,I,g.baseClass);return null===B?null:g.downcast(B)}var NA={};function RA(){return Object.keys(JA).length}function eA(){var A=[];for(var I in JA)JA.hasOwnProperty(I)&&A.push(JA[I]);return A}var nA=[];function SA(){for(;nA.length;){var A=nA.pop();A.$$.deleteScheduled=!1,A.delete()}}var UA=void 0;function kA(A){UA=A,nA.length&&UA&&UA(SA)}var JA={};function HA(A,I){return I=function(A,I){for(void 0===I&&wA("ptr should not be undefined");A.baseClass;)I=A.upcast(I),A=A.baseClass;return I}(A,I),JA[I]}function MA(A,I){return I.ptrType&&I.ptr||EA("makeClassHandle requires ptr and ptrType"),!!I.smartPtrType!=!!I.smartPtr&&EA("Both smartPtrType and smartPtr must be specified"),I.count={value:1},YA(Object.create(A,{$$:{value:I}}))}function LA(A){var I=this.getPointee(A);if(!I)return this.destructor(A),null;var g=HA(this.registeredClass,I);if(void 0!==g){if(0===g.$$.count.value)return g.$$.ptr=I,g.$$.smartPtr=A,g.clone();var B=g.clone();return this.destructor(A),B}function Q(){return this.isSmartPointer?MA(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:I,smartPtrType:this,smartPtr:A}):MA(this.registeredClass.instancePrototype,{ptrType:this,ptr:A})}var C,E=this.registeredClass.getActualType(I),i=NA[E];if(!i)return Q.call(this);C=this.isConst?i.constPointerType:i.pointerType;var o=rA(I,this.registeredClass,C.registeredClass);return null===o?Q.call(this):this.isSmartPointer?MA(C.registeredClass.instancePrototype,{ptrType:C,ptr:o,smartPtrType:this,smartPtr:A}):MA(C.registeredClass.instancePrototype,{ptrType:C,ptr:o})}function YA(A){return"undefined"==typeof FinalizationRegistry?(YA=A=>A,A):(FA=new FinalizationRegistry((A=>{cA(A.$$)})),yA=A=>FA.unregister(A),(YA=A=>{var I=A.$$;if(I.smartPtr){var g={$$:I};FA.register(A,g,A)}return A})(A))}function KA(){if(this.$$.ptr||hA(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var A,I=YA(Object.create(Object.getPrototypeOf(this),{$$:{value:(A=this.$$,{count:A.count,deleteScheduled:A.deleteScheduled,preservePointerOnDelete:A.preservePointerOnDelete,ptr:A.ptr,ptrType:A.ptrType,smartPtr:A.smartPtr,smartPtrType:A.smartPtrType})}}));return I.$$.count.value+=1,I.$$.deleteScheduled=!1,I}function dA(){this.$$.ptr||hA(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&wA("Object already scheduled for deletion"),yA(this),cA(this.$$),this.$$.preservePointerOnDelete||(this.$$.smartPtr=void 0,this.$$.ptr=void 0)}function lA(){return!this.$$.ptr}function fA(){return this.$$.ptr||hA(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&wA("Object already scheduled for deletion"),nA.push(this),1===nA.length&&UA&&UA(SA),this.$$.deleteScheduled=!0,this}function uA(){}function qA(A,I,g){if(void 0===A[I].overloadTable){var B=A[I];A[I]=function(){return A[I].overloadTable.hasOwnProperty(arguments.length)||wA("Function '"+g+"' called with an invalid number of arguments ("+arguments.length+") - expects one of ("+A[I].overloadTable+")!"),A[I].overloadTable[arguments.length].apply(this,arguments)},A[I].overloadTable=[],A[I].overloadTable[B.argCount]=B}}function pA(A,I,g){C.hasOwnProperty(A)?((void 0===g||void 0!==C[A].overloadTable&&void 0!==C[A].overloadTable[g])&&wA("Cannot register public name '"+A+"' twice"),qA(C,A,A),C.hasOwnProperty(g)&&wA("Cannot register multiple overloads of a function with the same number of arguments ("+g+")!"),C[A].overloadTable[g]=I):(C[A]=I,void 0!==g&&(C[A].numArguments=g))}function bA(A,I,g,B,Q,C,E,i){this.name=A,this.constructor=I,this.instancePrototype=g,this.rawDestructor=B,this.baseClass=Q,this.getActualType=C,this.upcast=E,this.downcast=i,this.pureVirtualFunctions=[]}function WA(A,I,g){for(;I!==g;)I.upcast||wA("Expected null or instance of "+g.name+", got an instance of "+I.name),A=I.upcast(A),I=I.baseClass;return A}function ZA(A,I){if(null===I)return this.isReference&&wA("null is not a valid "+this.name),0;I.$$||wA('Cannot pass "'+aI(I)+'" as a '+this.name),I.$$.ptr||wA("Cannot pass deleted object as a pointer of type "+this.name);var g=I.$$.ptrType.registeredClass;return WA(I.$$.ptr,g,this.registeredClass)}function mA(A,I){var g;if(null===I)return this.isReference&&wA("null is not a valid "+this.name),this.isSmartPointer?(g=this.rawConstructor(),null!==A&&A.push(this.rawDestructor,g),g):0;I.$$||wA('Cannot pass "'+aI(I)+'" as a '+this.name),I.$$.ptr||wA("Cannot pass deleted object as a pointer of type "+this.name),!this.isConst&&I.$$.ptrType.isConst&&wA("Cannot convert argument of type "+(I.$$.smartPtrType?I.$$.smartPtrType.name:I.$$.ptrType.name)+" to parameter type "+this.name);var B=I.$$.ptrType.registeredClass;if(g=WA(I.$$.ptr,B,this.registeredClass),this.isSmartPointer)switch(void 0===I.$$.smartPtr&&wA("Passing raw pointer to smart pointer is illegal"),this.sharingPolicy){case 0:I.$$.smartPtrType===this?g=I.$$.smartPtr:wA("Cannot convert argument of type "+(I.$$.smartPtrType?I.$$.smartPtrType.name:I.$$.ptrType.name)+" to parameter type "+this.name);break;case 1:g=I.$$.smartPtr;break;case 2:if(I.$$.smartPtrType===this)g=I.$$.smartPtr;else{var Q=I.clone();g=this.rawShare(g,DI.toHandle((function(){Q.delete()}))),null!==A&&A.push(this.rawDestructor,g)}break;default:wA("Unsupporting sharing policy")}return g}function xA(A,I){if(null===I)return this.isReference&&wA("null is not a valid "+this.name),0;I.$$||wA('Cannot pass "'+aI(I)+'" as a '+this.name),I.$$.ptr||wA("Cannot pass deleted object as a pointer of type "+this.name),I.$$.ptrType.isConst&&wA("Cannot convert argument of type "+I.$$.ptrType.name+" to parameter type "+this.name);var g=I.$$.ptrType.registeredClass;return WA(I.$$.ptr,g,this.registeredClass)}function TA(A){return this.rawGetPointee&&(A=this.rawGetPointee(A)),A}function vA(A){this.rawDestructor&&this.rawDestructor(A)}function XA(A){null!==A&&A.delete()}function PA(A,I,g,B,Q,C,E,i,o,D,a){this.name=A,this.registeredClass=I,this.isReference=g,this.isConst=B,this.isSmartPointer=Q,this.pointeeType=C,this.sharingPolicy=E,this.rawGetPointee=i,this.rawConstructor=o,this.rawShare=D,this.rawDestructor=a,Q||void 0!==I.baseClass?this.toWireType=mA:B?(this.toWireType=ZA,this.destructorFunction=null):(this.toWireType=xA,this.destructorFunction=null)}function VA(A,I,g){C.hasOwnProperty(A)||EA("Replacing nonexistant public symbol"),void 0!==C[A].overloadTable&&void 0!==g?C[A].overloadTable[g]=I:(C[A]=I,C[A].argCount=g)}var OA=[];function jA(A){var I=OA[A];return I||(A>=OA.length&&(OA.length=A+1),OA[A]=I=l.get(A)),I}function zA(A,I,g){return A.includes("j")?function(A,I,g){var B=C["dynCall_"+A];return g&&g.length?B.apply(null,[I].concat(g)):B.call(null,I)}(A,I,g):jA(I).apply(null,g)}function _A(A,I){var g,B,Q,C=(A=aA(A)).includes("j")?(g=A,B=I,Q=[],function(){return Q.length=0,Object.assign(Q,arguments),zA(g,B,Q)}):jA(I);return"function"!=typeof C&&wA("unknown function pointer with signature "+A+": "+I),C}var $A=void 0;function AI(A){var I=HI(A),g=aA(I);return MI(I),g}function II(A,I){var g=[],B={};throw I.forEach((function A(I){B[I]||AA[I]||(IA[I]?IA[I].forEach(A):(g.push(I),B[I]=!0))})),new $A(A+": "+g.map(AI).join([", "]))}function gI(A,I){for(var g=[],B=0;B<A;B++)g.push(k[I+4*B>>2]);return g}function BI(A,I,g,B,Q){var C=I.length;C<2&&wA("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var E=null!==I[1]&&null!==g,i=!1,o=1;o<I.length;++o)if(null!==I[o]&&void 0===I[o].destructorFunction){i=!0;break}var D="void"!==I[0].name,a="",s="";for(o=0;o<C-2;++o)a+=(0!==o?", ":"")+"arg"+o,s+=(0!==o?", ":"")+"arg"+o+"Wired";var w="return function "+gA(A)+"("+a+") {\nif (arguments.length !== "+(C-2)+") {\nthrowBindingError('function "+A+" called with ' + arguments.length + ' arguments, expected "+(C-2)+" args!');\n}\n";i&&(w+="var destructors = [];\n");var t=i?"destructors":"null",G=["throwBindingError","invoker","fn","runDestructors","retType","classParam"],h=[wA,B,Q,z,I[0],I[1]];for(E&&(w+="var thisWired = classParam.toWireType("+t+", this);\n"),o=0;o<C-2;++o)w+="var arg"+o+"Wired = argType"+o+".toWireType("+t+", arg"+o+"); // "+I[o+2].name+"\n",G.push("argType"+o),h.push(I[o+2]);if(E&&(s="thisWired"+(s.length>0?", ":"")+s),w+=(D?"var rv = ":"")+"invoker(fn"+(s.length>0?", ":"")+s+");\n",i)w+="runDestructors(destructors);\n";else for(o=E?1:2;o<I.length;++o){var F=1===o?"thisWired":"arg"+(o-2)+"Wired";null!==I[o].destructorFunction&&(w+=F+"_dtor("+F+"); // "+I[o].name+"\n",G.push(F+"_dtor"),h.push(I[o].destructorFunction))}return D&&(w+="var ret = retType.fromWireType(rv);\nreturn ret;\n"),w+="}\n",G.push(w),function(A,I){if(!(A instanceof Function))throw new TypeError("new_ called with constructor type "+typeof A+" which is not a function");var g=BA(A.name||"unknownFunctionName",(function(){}));g.prototype=A.prototype;var B=new g,Q=A.apply(B,I);return Q instanceof Object?Q:B}(Function,G).apply(null,h)}var QI=[],CI=[{},{value:void 0},{value:null},{value:!0},{value:!1}];function EI(A){A>4&&0==--CI[A].refcount&&(CI[A]=void 0,QI.push(A))}function iI(){for(var A=0,I=5;I<CI.length;++I)void 0!==CI[I]&&++A;return A}function oI(){for(var A=5;A<CI.length;++A)if(void 0!==CI[A])return CI[A];return null}var DI={toValue:A=>(A||wA("Cannot use deleted val. handle = "+A),CI[A].value),toHandle:A=>{switch(A){case void 0:return 1;case null:return 2;case!0:return 3;case!1:return 4;default:var I=QI.length?QI.pop():CI.length;return CI[I]={refcount:1,value:A},I}}};function aI(A){if(null===A)return"null";var I=typeof A;return"object"===I||"array"===I||"function"===I?A.toString():""+A}function sI(A,I){switch(I){case 2:return function(A){return this.fromWireType(J[A>>2])};case 3:return function(A){return this.fromWireType(H[A>>3])};default:throw new TypeError("Unknown float type: "+A)}}function wI(A,I,g){switch(I){case 0:return g?function(A){return R[A]}:function(A){return e[A]};case 1:return g?function(A){return n[A>>1]}:function(A){return S[A>>1]};case 2:return g?function(A){return U[A>>2]}:function(A){return k[A>>2]};default:throw new TypeError("Unknown integer type: "+A)}}var tI="undefined"!=typeof TextDecoder?new TextDecoder("utf-16le"):void 0;function GI(A,I){for(var g=A,B=g>>1,Q=B+I/2;!(B>=Q)&&S[B];)++B;if((g=B<<1)-A>32&&tI)return tI.decode(e.subarray(A,g));for(var C="",E=0;!(E>=I/2);++E){var i=n[A+2*E>>1];if(0==i)break;C+=String.fromCharCode(i)}return C}function hI(A,I,g){if(void 0===g&&(g=2147483647),g<2)return 0;for(var B=I,Q=(g-=2)<2*A.length?g/2:A.length,C=0;C<Q;++C){var E=A.charCodeAt(C);n[I>>1]=E,I+=2}return n[I>>1]=0,I-B}function FI(A){return 2*A.length}function yI(A,I){for(var g=0,B="";!(g>=I/4);){var Q=U[A+4*g>>2];if(0==Q)break;if(++g,Q>=65536){var C=Q-65536;B+=String.fromCharCode(55296|C>>10,56320|1023&C)}else B+=String.fromCharCode(Q)}return B}function cI(A,I,g){if(void 0===g&&(g=2147483647),g<4)return 0;for(var B=I,Q=B+g-4,C=0;C<A.length;++C){var E=A.charCodeAt(C);if(E>=55296&&E<=57343&&(E=65536+((1023&E)<<10)|1023&A.charCodeAt(++C)),U[I>>2]=E,(I+=4)+4>Q)break}return U[I>>2]=0,I-B}function rI(A){for(var I=0,g=0;g<A.length;++g){var B=A.charCodeAt(g);B>=55296&&B<=57343&&++g,I+=4}return I}var NI={};function RI(){return"object"==typeof globalThis?globalThis:Function("return this")()}function eI(A,I){var g=AA[A];return void 0===g&&wA(I+" has unknown type "+AI(A)),g}var nI={};function SI(A){try{return r.grow(A-N.byteLength+65535>>>16),d(r.buffer),1}catch(A){}}CA=C.InternalError=QA(Error,"InternalError"),function(){for(var A=new Array(256),I=0;I<256;++I)A[I]=String.fromCharCode(I);DA=A}(),sA=C.BindingError=QA(Error,"BindingError"),uA.prototype.isAliasOf=GA,uA.prototype.clone=KA,uA.prototype.delete=dA,uA.prototype.isDeleted=lA,uA.prototype.deleteLater=fA,C.getInheritedInstanceCount=RA,C.getLiveInheritedInstances=eA,C.flushPendingDeletes=SA,C.setDelayFunction=kA,PA.prototype.getPointee=TA,PA.prototype.destructor=vA,PA.prototype.argPackAdvance=8,PA.prototype.readValueFromPointer=_,PA.prototype.deleteObject=XA,PA.prototype.fromWireType=LA,$A=C.UnboundTypeError=QA(Error,"UnboundTypeError"),C.count_emval_handles=iI,C.get_first_emval=oI;var UI,kI={h:function(A,I,g){throw new O(A).init(I,g),A},q:function(A){var I=j[A];delete j[A];var g=I.rawConstructor,B=I.rawDestructor,Q=I.fields;iA([A],Q.map((A=>A.getterReturnType)).concat(Q.map((A=>A.setterArgumentType))),(A=>{var C={};return Q.forEach(((I,g)=>{var B=I.fieldName,E=A[g],i=I.getter,o=I.getterContext,D=A[g+Q.length],a=I.setter,s=I.setterContext;C[B]={read:A=>E.fromWireType(i(o,A)),write:(A,I)=>{var g=[];a(s,A,D.toWireType(g,I)),z(g)}}})),[{name:I.name,fromWireType:function(A){var I={};for(var g in C)I[g]=C[g].read(A);return B(A),I},toWireType:function(A,I){for(var Q in C)if(!(Q in I))throw new TypeError('Missing field: "'+Q+'"');var E=g();for(Q in C)C[Q].write(E,I[Q]);return null!==A&&A.push(B,E),E},argPackAdvance:8,readValueFromPointer:_,destructorFunction:B}]}))},r:function(A,I,g,B,Q){},w:function(A,I,g,B,Q){var C=oA(g);tA(A,{name:I=aA(I),fromWireType:function(A){return!!A},toWireType:function(A,I){return I?B:Q},argPackAdvance:8,readValueFromPointer:function(A){var B;if(1===g)B=R;else if(2===g)B=n;else{if(4!==g)throw new TypeError("Unknown boolean type size: "+I);B=U}return this.fromWireType(B[A>>C])},destructorFunction:null})},p:function(A,I,g,B,Q,C,E,i,o,D,a,s,w){a=aA(a),C=_A(Q,C),i&&(i=_A(E,i)),D&&(D=_A(o,D)),w=_A(s,w);var t=gA(a);pA(t,(function(){II("Cannot construct "+a+" due to unbound types",[B])})),iA([A,I,g],B?[B]:[],(function(I){var g,Q;I=I[0],Q=B?(g=I.registeredClass).instancePrototype:uA.prototype;var E=BA(t,(function(){if(Object.getPrototypeOf(this)!==o)throw new sA("Use 'new' to construct "+a);if(void 0===s.constructor_body)throw new sA(a+" has no accessible constructor");var A=s.constructor_body[arguments.length];if(void 0===A)throw new sA("Tried to invoke ctor of "+a+" with invalid number of parameters ("+arguments.length+") - expected ("+Object.keys(s.constructor_body).toString()+") parameters instead!");return A.apply(this,arguments)})),o=Object.create(Q,{constructor:{value:E}});E.prototype=o;var s=new bA(a,E,o,w,g,C,i,D),G=new PA(a,s,!0,!1,!1),h=new PA(a+"*",s,!1,!1,!1),F=new PA(a+" const*",s,!1,!0,!1);return NA[A]={pointerType:h,constPointerType:F},VA(t,E),[G,h,F]}))},o:function(A,I,g,B,Q,C){var E;I