@cornerstonejs/nifti-volume-loader 1.30.0 → 1.31.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/umd/index.js
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
/*! For license information please see index.js.LICENSE.txt */
|
|
2
|
-
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("@cornerstonejs/core"),require("gl-matrix")):"function"==typeof define&&define.amd?define(["@cornerstonejs/core","gl-matrix"],e):"object"==typeof exports?exports.cornerstoneNiftiVolumeLoader=e(require("@cornerstonejs/core"),require("gl-matrix")):t.cornerstoneNiftiVolumeLoader=e(t.cornerstone3D,t.window)}(self,(function(t,e){return function(){var n={237:function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.NIFTIEXTENSION=void 0,e.NIFTIEXTENSION=class{esize;ecode;edata;littleEndian;constructor(t,e,n,i){if(t%16!=0)throw new Error("This does not appear to be a NIFTI extension");this.esize=t,this.ecode=e,this.edata=n,this.littleEndian=i}toArrayBuffer(){let t=new Uint8Array(this.esize),e=new Uint8Array(this.edata);t.set(e,8);let n=new DataView(t.buffer);return n.setInt32(0,this.esize,this.littleEndian),n.setInt32(4,this.ecode,this.littleEndian),t.buffer}}},130:function(t,e,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(t,e,n,i){void 0===i&&(i=n);var r=Object.getOwnPropertyDescriptor(e,n);r&&!("get"in r?!e.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,r)}:function(t,e,n,i){void 0===i&&(i=n),t[i]=e[n]}),r=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),s=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)"default"!==n&&Object.prototype.hasOwnProperty.call(t,n)&&i(e,t,n);return r(e,t),e};Object.defineProperty(e,"__esModule",{value:!0}),e.readExtensionData=e.readExtension=e.readImage=e.hasExtension=e.readHeader=e.decompress=e.isCompressed=e.isNIFTI=e.isNIFTI2=e.isNIFTI1=e.NIFTIEXTENSION=e.Utils=e.NIFTI2=e.NIFTI1=void 0;const o=s(n(876)),a=n(232),l=n(103),f=n(517);var h=n(232);Object.defineProperty(e,"NIFTI1",{enumerable:!0,get:function(){return h.NIFTI1}});var u=n(103);Object.defineProperty(e,"NIFTI2",{enumerable:!0,get:function(){return u.NIFTI2}});var c=n(517);Object.defineProperty(e,"Utils",{enumerable:!0,get:function(){return c.Utils}});var d=n(237);function p(t,e=!1){var n,i,r,s;return!(t.byteLength<a.NIFTI1.STANDARD_HEADER_SIZE||((n=new DataView(t))&&(i=n.getUint8(a.NIFTI1.MAGIC_NUMBER_LOCATION)),r=n.getUint8(a.NIFTI1.MAGIC_NUMBER_LOCATION+1),s=n.getUint8(a.NIFTI1.MAGIC_NUMBER_LOCATION+2),!(e&&i===a.NIFTI1.MAGIC_NUMBER2[0]&&r===a.NIFTI1.MAGIC_NUMBER2[1]&&s===a.NIFTI1.MAGIC_NUMBER2[2]||i===a.NIFTI1.MAGIC_NUMBER[0]&&r===a.NIFTI1.MAGIC_NUMBER[1]&&s===a.NIFTI1.MAGIC_NUMBER[2])))}function g(t,e=!1){var n,i,r,s;return!(t.byteLength<a.NIFTI1.STANDARD_HEADER_SIZE||(i=(n=new DataView(t)).getUint8(l.NIFTI2.MAGIC_NUMBER_LOCATION),r=n.getUint8(l.NIFTI2.MAGIC_NUMBER_LOCATION+1),s=n.getUint8(l.NIFTI2.MAGIC_NUMBER_LOCATION+2),!(e&&i===l.NIFTI2.MAGIC_NUMBER2[0]&&r===l.NIFTI2.MAGIC_NUMBER2[1]&&s===l.NIFTI2.MAGIC_NUMBER2[2]||i===l.NIFTI2.MAGIC_NUMBER[0]&&r===l.NIFTI2.MAGIC_NUMBER[1]&&s===l.NIFTI2.MAGIC_NUMBER[2])))}function v(t){var e,n,i;if(t){if(n=(e=new DataView(t)).getUint8(0),i=e.getUint8(1),n===f.Utils.GUNZIP_MAGIC_COOKIE1)return!0;if(i===f.Utils.GUNZIP_MAGIC_COOKIE2)return!0}return!1}function m(t){return o.decompressSync(new Uint8Array(t)).buffer}Object.defineProperty(e,"NIFTIEXTENSION",{enumerable:!0,get:function(){return d.NIFTIEXTENSION}}),e.isNIFTI1=p,e.isNIFTI2=g,e.isNIFTI=function(t,e=!1){return p(t,e)||g(t,e)},e.isCompressed=v,e.decompress=m,e.readHeader=function(t,e=!1){var n=null;return v(t)&&(t=m(t)),p(t,e)?n=new a.NIFTI1:g(t,e)&&(n=new l.NIFTI2),n?n.readHeader(t):console.error("That file does not appear to be NIFTI!"),n},e.hasExtension=function(t){return 0!=t.extensionFlag[0]},e.readImage=function(t,e){var n=t.vox_offset,i=1,r=1;t.dims[4]&&(i=t.dims[4]),t.dims[5]&&(r=t.dims[5]);var s=t.dims[1]*t.dims[2]*t.dims[3]*i*r*(t.numBitsPerVoxel/8);return e.slice(n,n+s)},e.readExtension=function(t,e){var n=t.getExtensionLocation(),i=t.extensionSize;return e.slice(n,n+i)},e.readExtensionData=function(t,e){var n=t.getExtensionLocation(),i=t.extensionSize;return e.slice(n+8,n+i)}},232:function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.NIFTI1=void 0;const i=n(517);class r{littleEndian=!1;dim_info=0;dims=[];intent_p1=0;intent_p2=0;intent_p3=0;intent_code=0;datatypeCode=0;numBitsPerVoxel=0;slice_start=0;slice_end=0;slice_code=0;pixDims=[];vox_offset=0;scl_slope=1;scl_inter=0;xyzt_units=0;cal_max=0;cal_min=0;slice_duration=0;toffset=0;description="";aux_file="";intent_name="";qform_code=0;sform_code=0;quatern_a=0;quatern_b=0;quatern_c=0;quatern_d=0;qoffset_x=0;qoffset_y=0;qoffset_z=0;affine=[[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]];qfac=1;quatern_R;magic="0";isHDR=!1;extensionFlag=[0,0,0,0];extensionSize=0;extensionCode=0;extensions=[];static TYPE_NONE=0;static TYPE_BINARY=1;static TYPE_UINT8=2;static TYPE_INT16=4;static TYPE_INT32=8;static TYPE_FLOAT32=16;static TYPE_COMPLEX64=32;static TYPE_FLOAT64=64;static TYPE_RGB24=128;static TYPE_INT8=256;static TYPE_UINT16=512;static TYPE_UINT32=768;static TYPE_INT64=1024;static TYPE_UINT64=1280;static TYPE_FLOAT128=1536;static TYPE_COMPLEX128=1792;static TYPE_COMPLEX256=2048;static XFORM_UNKNOWN=0;static XFORM_SCANNER_ANAT=1;static XFORM_ALIGNED_ANAT=2;static XFORM_TALAIRACH=3;static XFORM_MNI_152=4;static SPATIAL_UNITS_MASK=7;static TEMPORAL_UNITS_MASK=56;static UNITS_UNKNOWN=0;static UNITS_METER=1;static UNITS_MM=2;static UNITS_MICRON=3;static UNITS_SEC=8;static UNITS_MSEC=16;static UNITS_USEC=24;static UNITS_HZ=32;static UNITS_PPM=40;static UNITS_RADS=48;static MAGIC_COOKIE=348;static STANDARD_HEADER_SIZE=348;static MAGIC_NUMBER_LOCATION=344;static MAGIC_NUMBER=[110,43,49];static MAGIC_NUMBER2=[110,105,49];static EXTENSION_HEADER_SIZE=8;readHeader(t){var e,n,s,o,a=new DataView(t),l=i.Utils.getIntAt(a,0,this.littleEndian);if(l!==r.MAGIC_COOKIE&&(this.littleEndian=!0,l=i.Utils.getIntAt(a,0,this.littleEndian)),l!==r.MAGIC_COOKIE)throw new Error("This does not appear to be a NIFTI file!");for(this.dim_info=i.Utils.getByteAt(a,39),e=0;e<8;e+=1)o=40+2*e,this.dims[e]=i.Utils.getShortAt(a,o,this.littleEndian);for(this.intent_p1=i.Utils.getFloatAt(a,56,this.littleEndian),this.intent_p2=i.Utils.getFloatAt(a,60,this.littleEndian),this.intent_p3=i.Utils.getFloatAt(a,64,this.littleEndian),this.intent_code=i.Utils.getShortAt(a,68,this.littleEndian),this.datatypeCode=i.Utils.getShortAt(a,70,this.littleEndian),this.numBitsPerVoxel=i.Utils.getShortAt(a,72,this.littleEndian),this.slice_start=i.Utils.getShortAt(a,74,this.littleEndian),e=0;e<8;e+=1)o=76+4*e,this.pixDims[e]=i.Utils.getFloatAt(a,o,this.littleEndian);if(this.vox_offset=i.Utils.getFloatAt(a,108,this.littleEndian),this.scl_slope=i.Utils.getFloatAt(a,112,this.littleEndian),this.scl_inter=i.Utils.getFloatAt(a,116,this.littleEndian),this.slice_end=i.Utils.getShortAt(a,120,this.littleEndian),this.slice_code=i.Utils.getByteAt(a,122),this.xyzt_units=i.Utils.getByteAt(a,123),this.cal_max=i.Utils.getFloatAt(a,124,this.littleEndian),this.cal_min=i.Utils.getFloatAt(a,128,this.littleEndian),this.slice_duration=i.Utils.getFloatAt(a,132,this.littleEndian),this.toffset=i.Utils.getFloatAt(a,136,this.littleEndian),this.description=i.Utils.getStringAt(a,148,228),this.aux_file=i.Utils.getStringAt(a,228,252),this.qform_code=i.Utils.getShortAt(a,252,this.littleEndian),this.sform_code=i.Utils.getShortAt(a,254,this.littleEndian),this.quatern_b=i.Utils.getFloatAt(a,256,this.littleEndian),this.quatern_c=i.Utils.getFloatAt(a,260,this.littleEndian),this.quatern_d=i.Utils.getFloatAt(a,264,this.littleEndian),this.quatern_a=Math.sqrt(1-(Math.pow(this.quatern_b,2)+Math.pow(this.quatern_c,2)+Math.pow(this.quatern_d,2))),this.qoffset_x=i.Utils.getFloatAt(a,268,this.littleEndian),this.qoffset_y=i.Utils.getFloatAt(a,272,this.littleEndian),this.qoffset_z=i.Utils.getFloatAt(a,276,this.littleEndian),this.qform_code<1&&this.sform_code<1&&(this.affine[0][0]=this.pixDims[1],this.affine[1][1]=this.pixDims[2],this.affine[2][2]=this.pixDims[3]),this.qform_code>0&&this.sform_code<this.qform_code){const t=this.quatern_a,e=this.quatern_b,i=this.quatern_c,r=this.quatern_d;for(this.qfac=0===this.pixDims[0]?1:this.pixDims[0],this.quatern_R=[[t*t+e*e-i*i-r*r,2*e*i-2*t*r,2*e*r+2*t*i],[2*e*i+2*t*r,t*t+i*i-e*e-r*r,2*i*r-2*t*e],[2*e*r-2*t*i,2*i*r+2*t*e,t*t+r*r-i*i-e*e]],n=0;n<3;n+=1)for(s=0;s<3;s+=1)this.affine[n][s]=this.quatern_R[n][s]*this.pixDims[s+1],2===s&&(this.affine[n][s]*=this.qfac);this.affine[0][3]=this.qoffset_x,this.affine[1][3]=this.qoffset_y,this.affine[2][3]=this.qoffset_z}else if(this.sform_code>0)for(n=0;n<3;n+=1)for(s=0;s<4;s+=1)o=280+4*(4*n+s),this.affine[n][s]=i.Utils.getFloatAt(a,o,this.littleEndian);this.affine[3][0]=0,this.affine[3][1]=0,this.affine[3][2]=0,this.affine[3][3]=1,this.intent_name=i.Utils.getStringAt(a,328,344),this.magic=i.Utils.getStringAt(a,344,348),this.isHDR=this.magic===String.fromCharCode.apply(null,r.MAGIC_NUMBER2),a.byteLength>r.MAGIC_COOKIE&&(this.extensionFlag[0]=i.Utils.getByteAt(a,348),this.extensionFlag[1]=i.Utils.getByteAt(a,349),this.extensionFlag[2]=i.Utils.getByteAt(a,350),this.extensionFlag[3]=i.Utils.getByteAt(a,351),this.extensionFlag[0]&&(this.extensions=i.Utils.getExtensionsAt(a,this.getExtensionLocation(),this.littleEndian,this.vox_offset),this.extensionSize=this.extensions[0].esize,this.extensionCode=this.extensions[0].ecode))}toFormattedString(){var t=i.Utils.formatNumber,e="";return e+="Dim Info = "+this.dim_info+"\n",e+="Image Dimensions (1-8): "+this.dims[0]+", "+this.dims[1]+", "+this.dims[2]+", "+this.dims[3]+", "+this.dims[4]+", "+this.dims[5]+", "+this.dims[6]+", "+this.dims[7]+"\n",e+="Intent Parameters (1-3): "+this.intent_p1+", "+this.intent_p2+", "+this.intent_p3+"\n",e+="Intent Code = "+this.intent_code+"\n",e+="Datatype = "+this.datatypeCode+" ("+this.getDatatypeCodeString(this.datatypeCode)+")\n",e+="Bits Per Voxel = "+this.numBitsPerVoxel+"\n",e+="Slice Start = "+this.slice_start+"\n",e+="Voxel Dimensions (1-8): "+t(this.pixDims[0])+", "+t(this.pixDims[1])+", "+t(this.pixDims[2])+", "+t(this.pixDims[3])+", "+t(this.pixDims[4])+", "+t(this.pixDims[5])+", "+t(this.pixDims[6])+", "+t(this.pixDims[7])+"\n",e+="Image Offset = "+this.vox_offset+"\n",e+="Data Scale: Slope = "+t(this.scl_slope)+" Intercept = "+t(this.scl_inter)+"\n",e+="Slice End = "+this.slice_end+"\n",e+="Slice Code = "+this.slice_code+"\n",e+="Units Code = "+this.xyzt_units+" ("+this.getUnitsCodeString(r.SPATIAL_UNITS_MASK&this.xyzt_units)+", "+this.getUnitsCodeString(r.TEMPORAL_UNITS_MASK&this.xyzt_units)+")\n",e+="Display Range: Max = "+t(this.cal_max)+" Min = "+t(this.cal_min)+"\n",e+="Slice Duration = "+this.slice_duration+"\n",e+="Time Axis Shift = "+this.toffset+"\n",e+='Description: "'+this.description+'"\n',e+='Auxiliary File: "'+this.aux_file+'"\n',e+="Q-Form Code = "+this.qform_code+" ("+this.getTransformCodeString(this.qform_code)+")\n",e+="S-Form Code = "+this.sform_code+" ("+this.getTransformCodeString(this.sform_code)+")\n",e+="Quaternion Parameters: b = "+t(this.quatern_b)+" c = "+t(this.quatern_c)+" d = "+t(this.quatern_d)+"\n",e+="Quaternion Offsets: x = "+this.qoffset_x+" y = "+this.qoffset_y+" z = "+this.qoffset_z+"\n",e+="S-Form Parameters X: "+t(this.affine[0][0])+", "+t(this.affine[0][1])+", "+t(this.affine[0][2])+", "+t(this.affine[0][3])+"\n",e+="S-Form Parameters Y: "+t(this.affine[1][0])+", "+t(this.affine[1][1])+", "+t(this.affine[1][2])+", "+t(this.affine[1][3])+"\n",e+="S-Form Parameters Z: "+t(this.affine[2][0])+", "+t(this.affine[2][1])+", "+t(this.affine[2][2])+", "+t(this.affine[2][3])+"\n",e+='Intent Name: "'+this.intent_name+'"\n',this.extensionFlag[0]&&(e+="Extension: Size = "+this.extensionSize+" Code = "+this.extensionCode+"\n"),e}getDatatypeCodeString=function(t){return t===r.TYPE_UINT8?"1-Byte Unsigned Integer":t===r.TYPE_INT16?"2-Byte Signed Integer":t===r.TYPE_INT32?"4-Byte Signed Integer":t===r.TYPE_FLOAT32?"4-Byte Float":t===r.TYPE_FLOAT64?"8-Byte Float":t===r.TYPE_RGB24?"RGB":t===r.TYPE_INT8?"1-Byte Signed Integer":t===r.TYPE_UINT16?"2-Byte Unsigned Integer":t===r.TYPE_UINT32?"4-Byte Unsigned Integer":t===r.TYPE_INT64?"8-Byte Signed Integer":t===r.TYPE_UINT64?"8-Byte Unsigned Integer":"Unknown"};getTransformCodeString=function(t){return t===r.XFORM_SCANNER_ANAT?"Scanner":t===r.XFORM_ALIGNED_ANAT?"Aligned":t===r.XFORM_TALAIRACH?"Talairach":t===r.XFORM_MNI_152?"MNI":"Unknown"};getUnitsCodeString=function(t){return t===r.UNITS_METER?"Meters":t===r.UNITS_MM?"Millimeters":t===r.UNITS_MICRON?"Microns":t===r.UNITS_SEC?"Seconds":t===r.UNITS_MSEC?"Milliseconds":t===r.UNITS_USEC?"Microseconds":t===r.UNITS_HZ?"Hz":t===r.UNITS_PPM?"PPM":t===r.UNITS_RADS?"Rads":"Unknown"};getQformMat(){return this.convertNiftiQFormToNiftiSForm(this.quatern_b,this.quatern_c,this.quatern_d,this.qoffset_x,this.qoffset_y,this.qoffset_z,this.pixDims[1],this.pixDims[2],this.pixDims[3],this.pixDims[0])}convertNiftiQFormToNiftiSForm(t,e,n,i,r,s,o,a,l,f){var h,u,c,d,p=[[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0]],g=t,v=e,m=n;return p[3][0]=p[3][1]=p[3][2]=0,p[3][3]=1,(h=1-(g*g+v*v+m*m))<1e-7?(g*=h=1/Math.sqrt(g*g+v*v+m*m),v*=h,m*=h,h=0):h=Math.sqrt(h),u=o>0?o:1,c=a>0?a:1,d=l>0?l:1,f<0&&(d=-d),p[0][0]=(h*h+g*g-v*v-m*m)*u,p[0][1]=2*(g*v-h*m)*c,p[0][2]=2*(g*m+h*v)*d,p[1][0]=2*(g*v+h*m)*u,p[1][1]=(h*h+v*v-g*g-m*m)*c,p[1][2]=2*(v*m-h*g)*d,p[2][0]=2*(g*m-h*v)*u,p[2][1]=2*(v*m+h*g)*c,p[2][2]=(h*h+m*m-v*v-g*g)*d,p[0][3]=i,p[1][3]=r,p[2][3]=s,p}convertNiftiSFormToNEMA(t){var e,n,i,r,s,o,a,l,f,h,u,c,d,p,g,v,m,y,_,I,E,b,x,A,w,T,N,U,S,F,M,C,O;if(p=0,T=[[0,0,0],[0,0,0],[0,0,0]],N=[[0,0,0],[0,0,0],[0,0,0]],e=t[0][0],n=t[0][1],i=t[0][2],r=t[1][0],s=t[1][1],o=t[1][2],a=t[2][0],l=t[2][1],f=t[2][2],0===(h=Math.sqrt(e*e+r*r+a*a)))return null;if(e/=h,r/=h,a/=h,0===(h=Math.sqrt(n*n+s*s+l*l)))return null;if(h=e*(n/=h)+r*(s/=h)+a*(l/=h),Math.abs(h)>1e-4){if(n-=h*e,s-=h*r,l-=h*a,0===(h=Math.sqrt(n*n+s*s+l*l)))return null;n/=h,s/=h,l/=h}if(0===(h=Math.sqrt(i*i+o*o+f*f))?(i=r*l-a*s,o=a*n-l*e,f=e*s-r*n):(i/=h,o/=h,f/=h),h=e*i+r*o+a*f,Math.abs(h)>1e-4){if(i-=h*e,o-=h*r,f-=h*a,0===(h=Math.sqrt(i*i+o*o+f*f)))return null;i/=h,o/=h,f/=h}if(h=n*i+s*o+l*f,Math.abs(h)>1e-4){if(i-=h*n,o-=h*s,f-=h*l,0===(h=Math.sqrt(i*i+o*o+f*f)))return null;i/=h,o/=h,f/=h}if(T[0][0]=e,T[0][1]=n,T[0][2]=i,T[1][0]=r,T[1][1]=s,T[1][2]=o,T[2][0]=a,T[2][1]=l,T[2][2]=f,0===(u=this.nifti_mat33_determ(T)))return null;for(w=-666,y=E=b=x=1,_=2,I=3,c=1;c<=3;c+=1)for(d=1;d<=3;d+=1)if(c!==d)for(p=1;p<=3;p+=1)if(c!==p&&d!==p)for(N[0][0]=N[0][1]=N[0][2]=N[1][0]=N[1][1]=N[1][2]=N[2][0]=N[2][1]=N[2][2]=0,g=-1;g<=1;g+=2)for(v=-1;v<=1;v+=2)for(m=-1;m<=1;m+=2)N[0][c-1]=g,N[1][d-1]=v,N[2][p-1]=m,this.nifti_mat33_determ(N)*u>0&&(h=(A=this.nifti_mat33_mul(N,T))[0][0]+A[1][1]+A[2][2])>w&&(w=h,y=c,_=d,I=p,E=g,b=v,x=m);switch(U=S=F=M=C=O="",y*E){case 1:U="X",M="+";break;case-1:U="X",M="-";break;case 2:U="Y",M="+";break;case-2:U="Y",M="-";break;case 3:U="Z",M="+";break;case-3:U="Z",M="-"}switch(_*b){case 1:S="X",C="+";break;case-1:S="X",C="-";break;case 2:S="Y",C="+";break;case-2:S="Y",C="-";break;case 3:S="Z",C="+";break;case-3:S="Z",C="-"}switch(I*x){case 1:F="X",O="+";break;case-1:F="X",O="-";break;case 2:F="Y",O="+";break;case-2:F="Y",O="-";break;case 3:F="Z",O="+";break;case-3:F="Z",O="-"}return U+S+F+M+C+O}nifti_mat33_mul=function(t,e){var n,i,r=[[0,0,0],[0,0,0],[0,0,0]];for(n=0;n<3;n+=1)for(i=0;i<3;i+=1)r[n][i]=t[n][0]*e[0][i]+t[n][1]*e[1][i]+t[n][2]*e[2][i];return r};nifti_mat33_determ=function(t){var e,n,i,r,s,o,a,l,f;return e=t[0][0],n=t[0][1],i=t[0][2],r=t[1][0],s=t[1][1],o=t[1][2],a=t[2][0],l=t[2][1],e*s*(f=t[2][2])-e*l*o-r*n*f+r*l*i+a*n*o-a*s*i};getExtensionLocation(){return r.MAGIC_COOKIE+4}getExtensionSize(t){return i.Utils.getIntAt(t,this.getExtensionLocation(),this.littleEndian)}getExtensionCode(t){return i.Utils.getIntAt(t,this.getExtensionLocation()+4,this.littleEndian)}addExtension(t,e=-1){-1==e?this.extensions.push(t):this.extensions.splice(e,0,t),this.vox_offset+=t.esize}removeExtension(t){let e=this.extensions[t];e&&(this.vox_offset-=e.esize),this.extensions.splice(t,1)}toArrayBuffer(t=!1){let e=352;if(t)for(let t of this.extensions)e+=t.esize;let n=new Uint8Array(e),i=new DataView(n.buffer);i.setInt32(0,348,this.littleEndian),i.setUint8(39,this.dim_info);for(let t=0;t<8;t++)i.setUint16(40+2*t,this.dims[t],this.littleEndian);i.setFloat32(56,this.intent_p1,this.littleEndian),i.setFloat32(60,this.intent_p2,this.littleEndian),i.setFloat32(64,this.intent_p3,this.littleEndian),i.setInt16(68,this.intent_code,this.littleEndian),i.setInt16(70,this.datatypeCode,this.littleEndian),i.setInt16(72,this.numBitsPerVoxel,this.littleEndian),i.setInt16(74,this.slice_start,this.littleEndian);for(let t=0;t<8;t++)i.setFloat32(76+4*t,this.pixDims[t],this.littleEndian);i.setFloat32(108,this.vox_offset,this.littleEndian),i.setFloat32(112,this.scl_slope,this.littleEndian),i.setFloat32(116,this.scl_inter,this.littleEndian),i.setInt16(120,this.slice_end,this.littleEndian),i.setUint8(122,this.slice_code),i.setUint8(123,this.xyzt_units),i.setFloat32(124,this.cal_max,this.littleEndian),i.setFloat32(128,this.cal_min,this.littleEndian),i.setFloat32(132,this.slice_duration,this.littleEndian),i.setFloat32(136,this.toffset,this.littleEndian),n.set(Buffer.from(this.description),148),n.set(Buffer.from(this.aux_file),228),i.setInt16(252,this.qform_code,this.littleEndian),i.setInt16(254,this.sform_code,this.littleEndian),i.setFloat32(256,this.quatern_b,this.littleEndian),i.setFloat32(260,this.quatern_c,this.littleEndian),i.setFloat32(264,this.quatern_d,this.littleEndian),i.setFloat32(268,this.qoffset_x,this.littleEndian),i.setFloat32(272,this.qoffset_y,this.littleEndian),i.setFloat32(276,this.qoffset_z,this.littleEndian);const r=this.affine.flat();for(let t=0;t<12;t++)i.setFloat32(280+4*t,r[t],this.littleEndian);if(n.set(Buffer.from(this.intent_name),328),n.set(Buffer.from(this.magic),344),t){n.set(Uint8Array.from([1,0,0,0]),348);let t=this.getExtensionLocation();for(const e of this.extensions)i.setInt32(t,e.esize,e.littleEndian),i.setInt32(t+4,e.ecode,e.littleEndian),n.set(new Uint8Array(e.edata),t+8),t+=e.esize}else n.set(new Uint8Array(4).fill(0),348);return n.buffer}}e.NIFTI1=r},103:function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.NIFTI2=void 0;const i=n(232),r=n(517);class s{littleEndian=!1;dim_info=0;dims=[];intent_p1=0;intent_p2=0;intent_p3=0;intent_code=0;datatypeCode=0;numBitsPerVoxel=0;slice_start=0;slice_end=0;slice_code=0;pixDims=[];vox_offset=0;scl_slope=1;scl_inter=0;xyzt_units=0;cal_max=0;cal_min=0;slice_duration=0;toffset=0;description="";aux_file="";intent_name="";qform_code=0;sform_code=0;quatern_b=0;quatern_c=0;quatern_d=0;qoffset_x=0;qoffset_y=0;qoffset_z=0;affine=[[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]];magic="0";extensionFlag=[0,0,0,0];extensions=[];extensionSize=0;extensionCode=0;static MAGIC_COOKIE=540;static MAGIC_NUMBER_LOCATION=4;static MAGIC_NUMBER=[110,43,50,0,13,10,26,10];static MAGIC_NUMBER2=[110,105,50,0,13,10,26,10];readHeader(t){var e,n,i,o,a=new DataView(t),l=r.Utils.getIntAt(a,0,this.littleEndian);if(l!==s.MAGIC_COOKIE&&(this.littleEndian=!0,l=r.Utils.getIntAt(a,0,this.littleEndian)),l!==s.MAGIC_COOKIE)throw new Error("This does not appear to be a NIFTI file!");for(this.magic=r.Utils.getStringAt(a,4,12),this.datatypeCode=r.Utils.getShortAt(a,12,this.littleEndian),this.numBitsPerVoxel=r.Utils.getShortAt(a,14,this.littleEndian),e=0;e<8;e+=1)o=16+8*e,this.dims[e]=r.Utils.getLongAt(a,o,this.littleEndian);for(this.intent_p1=r.Utils.getDoubleAt(a,80,this.littleEndian),this.intent_p2=r.Utils.getDoubleAt(a,88,this.littleEndian),this.intent_p3=r.Utils.getDoubleAt(a,96,this.littleEndian),e=0;e<8;e+=1)o=104+8*e,this.pixDims[e]=r.Utils.getDoubleAt(a,o,this.littleEndian);for(this.vox_offset=r.Utils.getLongAt(a,168,this.littleEndian),this.scl_slope=r.Utils.getDoubleAt(a,176,this.littleEndian),this.scl_inter=r.Utils.getDoubleAt(a,184,this.littleEndian),this.cal_max=r.Utils.getDoubleAt(a,192,this.littleEndian),this.cal_min=r.Utils.getDoubleAt(a,200,this.littleEndian),this.slice_duration=r.Utils.getDoubleAt(a,208,this.littleEndian),this.toffset=r.Utils.getDoubleAt(a,216,this.littleEndian),this.slice_start=r.Utils.getLongAt(a,224,this.littleEndian),this.slice_end=r.Utils.getLongAt(a,232,this.littleEndian),this.description=r.Utils.getStringAt(a,240,320),this.aux_file=r.Utils.getStringAt(a,320,344),this.qform_code=r.Utils.getIntAt(a,344,this.littleEndian),this.sform_code=r.Utils.getIntAt(a,348,this.littleEndian),this.quatern_b=r.Utils.getDoubleAt(a,352,this.littleEndian),this.quatern_c=r.Utils.getDoubleAt(a,360,this.littleEndian),this.quatern_d=r.Utils.getDoubleAt(a,368,this.littleEndian),this.qoffset_x=r.Utils.getDoubleAt(a,376,this.littleEndian),this.qoffset_y=r.Utils.getDoubleAt(a,384,this.littleEndian),this.qoffset_z=r.Utils.getDoubleAt(a,392,this.littleEndian),n=0;n<3;n+=1)for(i=0;i<4;i+=1)o=400+8*(4*n+i),this.affine[n][i]=r.Utils.getDoubleAt(a,o,this.littleEndian);this.affine[3][0]=0,this.affine[3][1]=0,this.affine[3][2]=0,this.affine[3][3]=1,this.slice_code=r.Utils.getIntAt(a,496,this.littleEndian),this.xyzt_units=r.Utils.getIntAt(a,500,this.littleEndian),this.intent_code=r.Utils.getIntAt(a,504,this.littleEndian),this.intent_name=r.Utils.getStringAt(a,508,524),this.dim_info=r.Utils.getByteAt(a,524),a.byteLength>s.MAGIC_COOKIE&&(this.extensionFlag[0]=r.Utils.getByteAt(a,540),this.extensionFlag[1]=r.Utils.getByteAt(a,541),this.extensionFlag[2]=r.Utils.getByteAt(a,542),this.extensionFlag[3]=r.Utils.getByteAt(a,543),this.extensionFlag[0]&&(this.extensions=r.Utils.getExtensionsAt(a,this.getExtensionLocation(),this.littleEndian,this.vox_offset),this.extensionSize=this.extensions[0].esize,this.extensionCode=this.extensions[0].ecode))}toFormattedString(){var t=r.Utils.formatNumber,e="";return e+="Datatype = "+ +this.datatypeCode+" ("+this.getDatatypeCodeString(this.datatypeCode)+")\n",e+="Bits Per Voxel = = "+this.numBitsPerVoxel+"\n",e+="Image Dimensions (1-8): "+this.dims[0]+", "+this.dims[1]+", "+this.dims[2]+", "+this.dims[3]+", "+this.dims[4]+", "+this.dims[5]+", "+this.dims[6]+", "+this.dims[7]+"\n",e+="Intent Parameters (1-3): "+this.intent_p1+", "+this.intent_p2+", "+this.intent_p3+"\n",e+="Voxel Dimensions (1-8): "+t(this.pixDims[0])+", "+t(this.pixDims[1])+", "+t(this.pixDims[2])+", "+t(this.pixDims[3])+", "+t(this.pixDims[4])+", "+t(this.pixDims[5])+", "+t(this.pixDims[6])+", "+t(this.pixDims[7])+"\n",e+="Image Offset = "+this.vox_offset+"\n",e+="Data Scale: Slope = "+t(this.scl_slope)+" Intercept = "+t(this.scl_inter)+"\n",e+="Display Range: Max = "+t(this.cal_max)+" Min = "+t(this.cal_min)+"\n",e+="Slice Duration = "+this.slice_duration+"\n",e+="Time Axis Shift = "+this.toffset+"\n",e+="Slice Start = "+this.slice_start+"\n",e+="Slice End = "+this.slice_end+"\n",e+='Description: "'+this.description+'"\n',e+='Auxiliary File: "'+this.aux_file+'"\n',e+="Q-Form Code = "+this.qform_code+" ("+this.getTransformCodeString(this.qform_code)+")\n",e+="S-Form Code = "+this.sform_code+" ("+this.getTransformCodeString(this.sform_code)+")\n",e+="Quaternion Parameters: b = "+t(this.quatern_b)+" c = "+t(this.quatern_c)+" d = "+t(this.quatern_d)+"\n",e+="Quaternion Offsets: x = "+this.qoffset_x+" y = "+this.qoffset_y+" z = "+this.qoffset_z+"\n",e+="S-Form Parameters X: "+t(this.affine[0][0])+", "+t(this.affine[0][1])+", "+t(this.affine[0][2])+", "+t(this.affine[0][3])+"\n",e+="S-Form Parameters Y: "+t(this.affine[1][0])+", "+t(this.affine[1][1])+", "+t(this.affine[1][2])+", "+t(this.affine[1][3])+"\n",e+="S-Form Parameters Z: "+t(this.affine[2][0])+", "+t(this.affine[2][1])+", "+t(this.affine[2][2])+", "+t(this.affine[2][3])+"\n",e+="Slice Code = "+this.slice_code+"\n",e+="Units Code = "+this.xyzt_units+" ("+this.getUnitsCodeString(i.NIFTI1.SPATIAL_UNITS_MASK&this.xyzt_units)+", "+this.getUnitsCodeString(i.NIFTI1.TEMPORAL_UNITS_MASK&this.xyzt_units)+")\n",e+="Intent Code = "+this.intent_code+"\n",(e+='Intent Name: "'+this.intent_name+'"\n')+"Dim Info = "+this.dim_info+"\n"}getExtensionLocation=function(){return s.MAGIC_COOKIE+4};getExtensionSize=i.NIFTI1.prototype.getExtensionSize;getExtensionCode=i.NIFTI1.prototype.getExtensionCode;addExtension=i.NIFTI1.prototype.addExtension;removeExtension=i.NIFTI1.prototype.removeExtension;getDatatypeCodeString=i.NIFTI1.prototype.getDatatypeCodeString;getTransformCodeString=i.NIFTI1.prototype.getTransformCodeString;getUnitsCodeString=i.NIFTI1.prototype.getUnitsCodeString;getQformMat=i.NIFTI1.prototype.getQformMat;convertNiftiQFormToNiftiSForm=i.NIFTI1.prototype.convertNiftiQFormToNiftiSForm;convertNiftiSFormToNEMA=i.NIFTI1.prototype.convertNiftiSFormToNEMA;nifti_mat33_mul=i.NIFTI1.prototype.nifti_mat33_mul;nifti_mat33_determ=i.NIFTI1.prototype.nifti_mat33_determ;toArrayBuffer(t=!1){let e=544;if(t)for(let t of this.extensions)e+=t.esize;let n=new Uint8Array(e),i=new DataView(n.buffer);i.setInt32(0,540,this.littleEndian),n.set(Buffer.from(this.magic),4),i.setInt16(12,this.datatypeCode,this.littleEndian),i.setInt16(14,this.numBitsPerVoxel,this.littleEndian);for(let t=0;t<8;t++)i.setBigInt64(16+8*t,BigInt(this.dims[t]),this.littleEndian);i.setFloat64(80,this.intent_p1,this.littleEndian),i.setFloat64(88,this.intent_p2,this.littleEndian),i.setFloat64(96,this.intent_p3,this.littleEndian);for(let t=0;t<8;t++)i.setFloat64(104+8*t,this.pixDims[t],this.littleEndian);i.setBigInt64(168,BigInt(this.vox_offset),this.littleEndian),i.setFloat64(176,this.scl_slope,this.littleEndian),i.setFloat64(184,this.scl_inter,this.littleEndian),i.setFloat64(192,this.cal_max,this.littleEndian),i.setFloat64(200,this.cal_min,this.littleEndian),i.setFloat64(208,this.slice_duration,this.littleEndian),i.setFloat64(216,this.toffset,this.littleEndian),i.setBigInt64(224,BigInt(this.slice_start),this.littleEndian),i.setBigInt64(232,BigInt(this.slice_end),this.littleEndian),n.set(Buffer.from(this.description),240),n.set(Buffer.from(this.aux_file),320),i.setInt32(344,this.qform_code,this.littleEndian),i.setInt32(348,this.sform_code,this.littleEndian),i.setFloat64(352,this.quatern_b,this.littleEndian),i.setFloat64(360,this.quatern_c,this.littleEndian),i.setFloat64(368,this.quatern_d,this.littleEndian),i.setFloat64(376,this.qoffset_x,this.littleEndian),i.setFloat64(384,this.qoffset_y,this.littleEndian),i.setFloat64(392,this.qoffset_z,this.littleEndian);const r=this.affine.flat();for(let t=0;t<12;t++)i.setFloat64(400+8*t,r[t],this.littleEndian);if(i.setInt32(496,this.slice_code,this.littleEndian),i.setInt32(500,this.xyzt_units,this.littleEndian),i.setInt32(504,this.intent_code,this.littleEndian),n.set(Buffer.from(this.intent_name),508),i.setUint8(524,this.dim_info),t){n.set(Uint8Array.from([1,0,0,0]),540);let t=this.getExtensionLocation();for(const e of this.extensions)i.setInt32(t,e.esize,e.littleEndian),i.setInt32(t+4,e.ecode,e.littleEndian),n.set(new Uint8Array(e.edata),t+8),t+=e.esize}else n.set(new Uint8Array(4).fill(0),540);return n.buffer}}e.NIFTI2=s},517:function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Utils=void 0;const i=n(237);class r{static crcTable=null;static GUNZIP_MAGIC_COOKIE1=31;static GUNZIP_MAGIC_COOKIE2=139;static getStringAt(t,e,n){var i,r,s="";for(i=e;i<n;i+=1)0!==(r=t.getUint8(i))&&(s+=String.fromCharCode(r));return s}static getByteAt=function(t,e){return t.getInt8(e)};static getShortAt=function(t,e,n){return t.getInt16(e,n)};static getIntAt(t,e,n){return t.getInt32(e,n)}static getFloatAt(t,e,n){return t.getFloat32(e,n)}static getDoubleAt(t,e,n){return t.getFloat64(e,n)}static getLongAt(t,e,n){var i,s=[],o=0;for(i=0;i<8;i+=1)s[i]=r.getByteAt(t,e+i);for(i=s.length-1;i>=0;i--)o=256*o+s[i];return o}static getExtensionsAt(t,e,n,s){let o=[],a=e;for(;a<s;){let e=n,l=r.getIntAt(t,a,n);if(!l)break;if(l+a>s&&(e=!e,l=r.getIntAt(t,a,e),l+a>s))throw new Error("This does not appear to be a valid NIFTI extension");if(l%16!=0)throw new Error("This does not appear to be a NIFTI extension");let f=r.getIntAt(t,a+4,e),h=t.buffer.slice(a+8,a+l);console.log("extensionByteIndex: "+(a+8)+" esize: "+l),console.log(h);let u=new i.NIFTIEXTENSION(l,f,h,e);o.push(u),a+=l}return o}static toArrayBuffer(t){var e,n,i;for(e=new ArrayBuffer(t.length),n=new Uint8Array(e),i=0;i<t.length;i+=1)n[i]=t[i];return e}static isString(t){return"string"==typeof t||t instanceof String}static formatNumber(t,e=void 0){let n;return n=r.isString(t)?Number(t):t,n=e?n.toPrecision(5):n.toPrecision(7),parseFloat(n)}static makeCRCTable(){let t,e=[];for(var n=0;n<256;n++){t=n;for(var i=0;i<8;i++)t=1&t?3988292384^t>>>1:t>>>1;e[n]=t}return e}static crc32(t){r.crcTable||(r.crcTable=r.makeCRCTable());const e=r.crcTable;let n=-1;for(var i=0;i<t.byteLength;i++)n=n>>>8^e[255&(n^t.getUint8(i))];return(-1^n)>>>0}}e.Utils=r},953:function(e){"use strict";e.exports=t},976:function(t){"use strict";t.exports=e},609:function(t,e,n){var i=n(425).default;function r(){"use strict";t.exports=r=function(){return e},t.exports.__esModule=!0,t.exports.default=t.exports;var e={},n=Object.prototype,s=n.hasOwnProperty,o=Object.defineProperty||function(t,e,n){t[e]=n.value},a="function"==typeof Symbol?Symbol:{},l=a.iterator||"@@iterator",f=a.asyncIterator||"@@asyncIterator",h=a.toStringTag||"@@toStringTag";function u(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(t){u=function(t,e,n){return t[e]=n}}function c(t,e,n,i){var r=e&&e.prototype instanceof g?e:g,s=Object.create(r.prototype),a=new U(i||[]);return o(s,"_invoke",{value:A(t,n,a)}),s}function d(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}e.wrap=c;var p={};function g(){}function v(){}function m(){}var y={};u(y,l,(function(){return this}));var _=Object.getPrototypeOf,I=_&&_(_(S([])));I&&I!==n&&s.call(I,l)&&(y=I);var E=m.prototype=g.prototype=Object.create(y);function b(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function x(t,e){function n(r,o,a,l){var f=d(t[r],t,o);if("throw"!==f.type){var h=f.arg,u=h.value;return u&&"object"==i(u)&&s.call(u,"__await")?e.resolve(u.__await).then((function(t){n("next",t,a,l)}),(function(t){n("throw",t,a,l)})):e.resolve(u).then((function(t){h.value=t,a(h)}),(function(t){return n("throw",t,a,l)}))}l(f.arg)}var r;o(this,"_invoke",{value:function(t,i){function s(){return new e((function(e,r){n(t,i,e,r)}))}return r=r?r.then(s,s):s()}})}function A(t,e,n){var i="suspendedStart";return function(r,s){if("executing"===i)throw new Error("Generator is already running");if("completed"===i){if("throw"===r)throw s;return{value:void 0,done:!0}}for(n.method=r,n.arg=s;;){var o=n.delegate;if(o){var a=w(o,n);if(a){if(a===p)continue;return a}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===i)throw i="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);i="executing";var l=d(t,e,n);if("normal"===l.type){if(i=n.done?"completed":"suspendedYield",l.arg===p)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(i="completed",n.method="throw",n.arg=l.arg)}}}function w(t,e){var n=e.method,i=t.iterator[n];if(void 0===i)return e.delegate=null,"throw"===n&&t.iterator.return&&(e.method="return",e.arg=void 0,w(t,e),"throw"===e.method)||"return"!==n&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+n+"' method")),p;var r=d(i,t.iterator,e.arg);if("throw"===r.type)return e.method="throw",e.arg=r.arg,e.delegate=null,p;var s=r.arg;return s?s.done?(e[t.resultName]=s.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,p):s:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,p)}function T(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function N(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function U(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(T,this),this.reset(!0)}function S(t){if(t){var e=t[l];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,i=function e(){for(;++n<t.length;)if(s.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};return i.next=i}}return{next:F}}function F(){return{value:void 0,done:!0}}return v.prototype=m,o(E,"constructor",{value:m,configurable:!0}),o(m,"constructor",{value:v,configurable:!0}),v.displayName=u(m,h,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===v||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,m):(t.__proto__=m,u(t,h,"GeneratorFunction")),t.prototype=Object.create(E),t},e.awrap=function(t){return{__await:t}},b(x.prototype),u(x.prototype,f,(function(){return this})),e.AsyncIterator=x,e.async=function(t,n,i,r,s){void 0===s&&(s=Promise);var o=new x(c(t,n,i,r),s);return e.isGeneratorFunction(n)?o:o.next().then((function(t){return t.done?t.value:o.next()}))},b(E),u(E,h,"Generator"),u(E,l,(function(){return this})),u(E,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),n=[];for(var i in e)n.push(i);return n.reverse(),function t(){for(;n.length;){var i=n.pop();if(i in e)return t.value=i,t.done=!1,t}return t.done=!0,t}},e.values=S,U.prototype={constructor:U,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(N),!t)for(var e in this)"t"===e.charAt(0)&&s.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(n,i){return o.type="throw",o.arg=t,e.next=n,i&&(e.method="next",e.arg=void 0),!!i}for(var i=this.tryEntries.length-1;i>=0;--i){var r=this.tryEntries[i],o=r.completion;if("root"===r.tryLoc)return n("end");if(r.tryLoc<=this.prev){var a=s.call(r,"catchLoc"),l=s.call(r,"finallyLoc");if(a&&l){if(this.prev<r.catchLoc)return n(r.catchLoc,!0);if(this.prev<r.finallyLoc)return n(r.finallyLoc)}else if(a){if(this.prev<r.catchLoc)return n(r.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<r.finallyLoc)return n(r.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&s.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var r=i;break}}r&&("break"===t||"continue"===t)&&r.tryLoc<=e&&e<=r.finallyLoc&&(r=null);var o=r?r.completion:{};return o.type=t,o.arg=e,r?(this.method="next",this.next=r.finallyLoc,p):this.complete(o)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),p},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),N(n),p}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var i=n.completion;if("throw"===i.type){var r=i.arg;N(n)}return r}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:S(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),p}},e}t.exports=r,t.exports.__esModule=!0,t.exports.default=t.exports},425:function(t){function e(n){return t.exports=e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t.exports.__esModule=!0,t.exports.default=t.exports,e(n)}t.exports=e,t.exports.__esModule=!0,t.exports.default=t.exports},841:function(t,e,n){var i=n(609)();t.exports=i;try{regeneratorRuntime=i}catch(t){"object"==typeof globalThis?globalThis.regeneratorRuntime=i:Function("r","regeneratorRuntime = r")(i)}},876:function(t,e,n){"use strict";var i=n(735),r=Uint8Array,s=Uint16Array,o=Int32Array,a=new r([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),l=new r([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),f=new r([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),h=function(t,e){for(var n=new s(31),i=0;i<31;++i)n[i]=e+=1<<t[i-1];var r=new o(n[30]);for(i=1;i<30;++i)for(var a=n[i];a<n[i+1];++a)r[a]=a-n[i]<<5|i;return{b:n,r:r}},u=h(a,2),c=u.b,d=u.r;c[28]=258,d[258]=28;for(var p=h(l,0),g=p.b,v=p.r,m=new s(32768),y=0;y<32768;++y){var _=(43690&y)>>1|(21845&y)<<1;_=(61680&(_=(52428&_)>>2|(13107&_)<<2))>>4|(3855&_)<<4,m[y]=((65280&_)>>8|(255&_)<<8)>>1}var I=function(t,e,n){for(var i=t.length,r=0,o=new s(e);r<i;++r)t[r]&&++o[t[r]-1];var a,l=new s(e);for(r=1;r<e;++r)l[r]=l[r-1]+o[r-1]<<1;if(n){a=new s(1<<e);var f=15-e;for(r=0;r<i;++r)if(t[r])for(var h=r<<4|t[r],u=e-t[r],c=l[t[r]-1]++<<u,d=c|(1<<u)-1;c<=d;++c)a[m[c]>>f]=h}else for(a=new s(i),r=0;r<i;++r)t[r]&&(a[r]=m[l[t[r]-1]++]>>15-t[r]);return a},E=new r(288);for(y=0;y<144;++y)E[y]=8;for(y=144;y<256;++y)E[y]=9;for(y=256;y<280;++y)E[y]=7;for(y=280;y<288;++y)E[y]=8;var b=new r(32);for(y=0;y<32;++y)b[y]=5;var x=I(E,9,0),A=I(E,9,1),w=I(b,5,0),T=I(b,5,1),N=function(t){for(var e=t[0],n=1;n<t.length;++n)t[n]>e&&(e=t[n]);return e},U=function(t,e,n){var i=e/8|0;return(t[i]|t[i+1]<<8)>>(7&e)&n},S=function(t,e){var n=e/8|0;return(t[n]|t[n+1]<<8|t[n+2]<<16)>>(7&e)},F=function(t){return(t+7)/8|0},M=function(t,e,n){(null==e||e<0)&&(e=0),(null==n||n>t.length)&&(n=t.length);var i=new r(n-e);return i.set(t.subarray(e,n)),i};e.FlateErrorCode={UnexpectedEOF:0,InvalidBlockType:1,InvalidLengthLiteral:2,InvalidDistance:3,StreamFinished:4,NoStreamHandler:5,InvalidHeader:6,NoCallback:7,InvalidUTF8:8,ExtraFieldTooLong:9,InvalidDate:10,FilenameTooLong:11,StreamFinishing:12,InvalidZipData:13,UnknownCompressionMethod:14};var C=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],O=function(t,e,n){var i=new Error(e||C[t]);if(i.code=t,Error.captureStackTrace&&Error.captureStackTrace(i,O),!n)throw i;return i},D=function(t,e,n,i){var s=t.length,o=i?i.length:0;if(!s||e.f&&!e.l)return n||new r(0);var h=!n||2!=e.i,u=e.i;n||(n=new r(3*s));var d=function(t){var e=n.length;if(t>e){var i=new r(Math.max(2*e,t));i.set(n),n=i}},p=e.f||0,v=e.p||0,m=e.b||0,y=e.l,_=e.d,E=e.m,b=e.n,x=8*s;do{if(!y){p=U(t,v,1);var w=U(t,v+1,3);if(v+=3,!w){var C=t[(Y=F(v)+4)-4]|t[Y-3]<<8,D=Y+C;if(D>s){u&&O(0);break}h&&d(m+C),n.set(t.subarray(Y,D),m),e.b=m+=C,e.p=v=8*D,e.f=p;continue}if(1==w)y=A,_=T,E=9,b=5;else if(2==w){var P=U(t,v,31)+257,z=U(t,v+10,15)+4,q=P+U(t,v+5,31)+1;v+=14;for(var L=new r(q),B=new r(19),R=0;R<z;++R)B[f[R]]=U(t,v+3*R,7);v+=3*z;var k=N(B),G=(1<<k)-1,j=I(B,k,1);for(R=0;R<q;){var Y,V=j[U(t,v,G)];if(v+=15&V,(Y=V>>4)<16)L[R++]=Y;else{var X=0,Z=0;for(16==Y?(Z=3+U(t,v,3),v+=2,X=L[R-1]):17==Y?(Z=3+U(t,v,7),v+=3):18==Y&&(Z=11+U(t,v,127),v+=7);Z--;)L[R++]=X}}var H=L.subarray(0,P),K=L.subarray(P);E=N(H),b=N(K),y=I(H,E,1),_=I(K,b,1)}else O(1);if(v>x){u&&O(0);break}}h&&d(m+131072);for(var Q=(1<<E)-1,W=(1<<b)-1,$=v;;$=v){var J=(X=y[S(t,v)&Q])>>4;if((v+=15&X)>x){u&&O(0);break}if(X||O(2),J<256)n[m++]=J;else{if(256==J){$=v,y=null;break}var tt=J-254;if(J>264){var et=a[R=J-257];tt=U(t,v,(1<<et)-1)+c[R],v+=et}var nt=_[S(t,v)&W],it=nt>>4;if(nt||O(3),v+=15&nt,K=g[it],it>3&&(et=l[it],K+=S(t,v)&(1<<et)-1,v+=et),v>x){u&&O(0);break}h&&d(m+131072);var rt=m+tt;if(m<K){var st=o-K,ot=Math.min(K,rt);for(st+m<0&&O(3);m<ot;++m)n[m]=i[st+m]}for(;m<rt;m+=4)n[m]=n[m-K],n[m+1]=n[m+1-K],n[m+2]=n[m+2-K],n[m+3]=n[m+3-K];m=rt}}e.l=y,e.p=$,e.b=m,e.f=p,y&&(p=1,e.m=E,e.d=_,e.n=b)}while(!p);return m==n.length?n:M(n,0,m)},P=function(t,e,n){n<<=7&e;var i=e/8|0;t[i]|=n,t[i+1]|=n>>8},z=function(t,e,n){n<<=7&e;var i=e/8|0;t[i]|=n,t[i+1]|=n>>8,t[i+2]|=n>>16},q=function(t,e){for(var n=[],i=0;i<t.length;++i)t[i]&&n.push({s:i,f:t[i]});var o=n.length,a=n.slice();if(!o)return{t:Y,l:0};if(1==o){var l=new r(n[0].s+1);return l[n[0].s]=1,{t:l,l:1}}n.sort((function(t,e){return t.f-e.f})),n.push({s:-1,f:25001});var f=n[0],h=n[1],u=0,c=1,d=2;for(n[0]={s:-1,f:f.f+h.f,l:f,r:h};c!=o-1;)f=n[n[u].f<n[d].f?u++:d++],h=n[u!=c&&n[u].f<n[d].f?u++:d++],n[c++]={s:-1,f:f.f+h.f,l:f,r:h};var p=a[0].s;for(i=1;i<o;++i)a[i].s>p&&(p=a[i].s);var g=new s(p+1),v=L(n[c-1],g,0);if(v>e){i=0;var m=0,y=v-e,_=1<<y;for(a.sort((function(t,e){return g[e.s]-g[t.s]||t.f-e.f}));i<o;++i){var I=a[i].s;if(!(g[I]>e))break;m+=_-(1<<v-g[I]),g[I]=e}for(m>>=y;m>0;){var E=a[i].s;g[E]<e?m-=1<<e-g[E]++-1:++i}for(;i>=0&&m;--i){var b=a[i].s;g[b]==e&&(--g[b],++m)}v=e}return{t:new r(g),l:v}},L=function(t,e,n){return-1==t.s?Math.max(L(t.l,e,n+1),L(t.r,e,n+1)):e[t.s]=n},B=function(t){for(var e=t.length;e&&!t[--e];);for(var n=new s(++e),i=0,r=t[0],o=1,a=function(t){n[i++]=t},l=1;l<=e;++l)if(t[l]==r&&l!=e)++o;else{if(!r&&o>2){for(;o>138;o-=138)a(32754);o>2&&(a(o>10?o-11<<5|28690:o-3<<5|12305),o=0)}else if(o>3){for(a(r),--o;o>6;o-=6)a(8304);o>2&&(a(o-3<<5|8208),o=0)}for(;o--;)a(r);o=1,r=t[l]}return{c:n.subarray(0,i),n:e}},R=function(t,e){for(var n=0,i=0;i<e.length;++i)n+=t[i]*e[i];return n},k=function(t,e,n){var i=n.length,r=F(e+2);t[r]=255&i,t[r+1]=i>>8,t[r+2]=255^t[r],t[r+3]=255^t[r+1];for(var s=0;s<i;++s)t[r+s+4]=n[s];return 8*(r+4+i)},G=function(t,e,n,i,r,o,h,u,c,d,p){P(e,p++,n),++r[256];for(var g=q(r,15),v=g.t,m=g.l,y=q(o,15),_=y.t,A=y.l,T=B(v),N=T.c,U=T.n,S=B(_),F=S.c,M=S.n,C=new s(19),O=0;O<N.length;++O)++C[31&N[O]];for(O=0;O<F.length;++O)++C[31&F[O]];for(var D=q(C,7),L=D.t,G=D.l,j=19;j>4&&!L[f[j-1]];--j);var Y,V,X,Z,H=d+5<<3,K=R(r,E)+R(o,b)+h,Q=R(r,v)+R(o,_)+h+14+3*j+R(C,L)+2*C[16]+3*C[17]+7*C[18];if(c>=0&&H<=K&&H<=Q)return k(e,p,t.subarray(c,c+d));if(P(e,p,1+(Q<K)),p+=2,Q<K){Y=I(v,m,0),V=v,X=I(_,A,0),Z=_;var W=I(L,G,0);for(P(e,p,U-257),P(e,p+5,M-1),P(e,p+10,j-4),p+=14,O=0;O<j;++O)P(e,p+3*O,L[f[O]]);p+=3*j;for(var $=[N,F],J=0;J<2;++J){var tt=$[J];for(O=0;O<tt.length;++O){var et=31&tt[O];P(e,p,W[et]),p+=L[et],et>15&&(P(e,p,tt[O]>>5&127),p+=tt[O]>>12)}}}else Y=x,V=E,X=w,Z=b;for(O=0;O<u;++O){var nt=i[O];if(nt>255){z(e,p,Y[257+(et=nt>>18&31)]),p+=V[et+257],et>7&&(P(e,p,nt>>23&31),p+=a[et]);var it=31&nt;z(e,p,X[it]),p+=Z[it],it>3&&(z(e,p,nt>>5&8191),p+=l[it])}else z(e,p,Y[nt]),p+=V[nt]}return z(e,p,Y[256]),p+V[256]},j=new o([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Y=new r(0),V=function(t,e,n,i,f,h){var u=h.z||t.length,c=new r(i+u+5*(1+Math.ceil(u/7e3))+f),p=c.subarray(i,c.length-f),g=h.l,m=7&(h.r||0);if(e){m&&(p[0]=h.r>>3);for(var y=j[e-1],_=y>>13,I=8191&y,E=(1<<n)-1,b=h.p||new s(32768),x=h.h||new s(E+1),A=Math.ceil(n/3),w=2*A,T=function(e){return(t[e]^t[e+1]<<A^t[e+2]<<w)&E},N=new o(25e3),U=new s(288),S=new s(32),C=0,O=0,D=h.i||0,P=0,z=h.w||0,q=0;D+2<u;++D){var L=T(D),B=32767&D,R=x[L];if(b[B]=R,x[L]=B,z<=D){var Y=u-D;if((C>7e3||P>24576)&&(Y>423||!g)){m=G(t,p,0,N,U,S,O,P,q,D-q,m),P=C=O=0,q=D;for(var V=0;V<286;++V)U[V]=0;for(V=0;V<30;++V)S[V]=0}var X=2,Z=0,H=I,K=B-R&32767;if(Y>2&&L==T(D-K))for(var Q=Math.min(_,Y)-1,W=Math.min(32767,D),$=Math.min(258,Y);K<=W&&--H&&B!=R;){if(t[D+X]==t[D+X-K]){for(var J=0;J<$&&t[D+J]==t[D+J-K];++J);if(J>X){if(X=J,Z=K,J>Q)break;var tt=Math.min(K,J-2),et=0;for(V=0;V<tt;++V){var nt=D-K+V&32767,it=nt-b[nt]&32767;it>et&&(et=it,R=nt)}}}K+=(B=R)-(R=b[B])&32767}if(Z){N[P++]=268435456|d[X]<<18|v[Z];var rt=31&d[X],st=31&v[Z];O+=a[rt]+l[st],++U[257+rt],++S[st],z=D+X,++C}else N[P++]=t[D],++U[t[D]]}}for(D=Math.max(D,z);D<u;++D)N[P++]=t[D],++U[t[D]];m=G(t,p,g,N,U,S,O,P,q,D-q,m),g||(h.r=7&m|p[m/8|0]<<3,m-=7,h.h=x,h.p=b,h.i=D,h.w=z)}else{for(D=h.w||0;D<u+g;D+=65535){var ot=D+65535;ot>=u&&(p[m/8|0]=g,ot=u),m=k(p,m+1,t.subarray(D,ot))}h.i=u}return M(c,0,i+F(m)+f)},X=function(){for(var t=new Int32Array(256),e=0;e<256;++e){for(var n=e,i=9;--i;)n=(1&n&&-306674912)^n>>>1;t[e]=n}return t}(),Z=function(){var t=-1;return{p:function(e){for(var n=t,i=0;i<e.length;++i)n=X[255&n^e[i]]^n>>>8;t=n},d:function(){return~t}}},H=function(){var t=1,e=0;return{p:function(n){for(var i=t,r=e,s=0|n.length,o=0;o!=s;){for(var a=Math.min(o+2655,s);o<a;++o)r+=i+=n[o];i=(65535&i)+15*(i>>16),r=(65535&r)+15*(r>>16)}t=i,e=r},d:function(){return(255&(t%=65521))<<24|(65280&t)<<8|(255&(e%=65521))<<8|e>>8}}},K=function(t,e,n,i,s){if(!s&&(s={l:1},e.dictionary)){var o=e.dictionary.subarray(-32768),a=new r(o.length+t.length);a.set(o),a.set(t,o.length),t=a,s.w=o.length}return V(t,null==e.level?6:e.level,null==e.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(t.length)))):12+e.mem,n,i,s)},Q=function(t,e){var n={};for(var i in t)n[i]=t[i];for(var i in e)n[i]=e[i];return n},W=function(t,e,n){for(var i=t(),r=t.toString(),s=r.slice(r.indexOf("[")+1,r.lastIndexOf("]")).replace(/\s+/g,"").split(","),o=0;o<i.length;++o){var a=i[o],l=s[o];if("function"==typeof a){e+=";"+l+"=";var f=a.toString();if(a.prototype)if(-1!=f.indexOf("[native code]")){var h=f.indexOf(" ",8)+1;e+=f.slice(h,f.indexOf("(",h))}else for(var u in e+=f,a.prototype)e+=";"+l+".prototype."+u+"="+a.prototype[u].toString();else e+=f}else n[l]=a}return e},$=[],J=function(t,e,n,r){if(!$[n]){for(var s="",o={},a=t.length-1,l=0;l<a;++l)s=W(t[l],s,o);$[n]={c:W(t[a],s,o),e:o}}var f=Q({},$[n].e);return i.default($[n].c+";onmessage=function(e){for(var k in e.data)self[k]=e.data[k];onmessage="+e.toString()+"}",n,f,function(t){var e=[];for(var n in t)t[n].buffer&&e.push((t[n]=new t[n].constructor(t[n])).buffer);return e}(f),r)},tt=function(){return[r,s,o,a,l,f,c,g,A,T,m,C,I,N,U,S,F,M,O,D,St,ot,at]},et=function(){return[r,s,o,a,l,f,d,v,x,E,w,b,m,j,Y,I,P,z,q,L,B,R,k,G,F,M,V,K,wt,ot]},nt=function(){return[gt,yt,pt,Z,X]},it=function(){return[vt,mt]},rt=function(){return[_t,pt,H]},st=function(){return[It]},ot=function(t){return postMessage(t,[t.buffer])},at=function(t){return t&&{out:t.size&&new r(t.size),dictionary:t.dictionary}},lt=function(t,e,n,i,r,s){var o=J(n,i,r,(function(t,e){o.terminate(),s(t,e)}));return o.postMessage([t,e],e.consume?[t.buffer]:[]),function(){o.terminate()}},ft=function(t){return t.ondata=function(t,e){return postMessage([t,e],[t.buffer])},function(e){return t.push(e.data[0],e.data[1])}},ht=function(t,e,n,i,r,s){var o,a=J(t,i,r,(function(t,n){t?(a.terminate(),e.ondata.call(e,t)):Array.isArray(n)?(n[1]&&a.terminate(),e.ondata.call(e,t,n[0],n[1])):s(n)}));a.postMessage(n),e.push=function(t,n){e.ondata||O(5),o&&e.ondata(O(4,0,1),null,!!n),a.postMessage([t,o=n],[t.buffer])},e.terminate=function(){a.terminate()}},ut=function(t,e){return t[e]|t[e+1]<<8},ct=function(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16|t[e+3]<<24)>>>0},dt=function(t,e){return ct(t,e)+4294967296*ct(t,e+4)},pt=function(t,e,n){for(;n;++e)t[e]=n,n>>>=8},gt=function(t,e){var n=e.filename;if(t[0]=31,t[1]=139,t[2]=8,t[8]=e.level<2?4:9==e.level?2:0,t[9]=3,0!=e.mtime&&pt(t,4,Math.floor(new Date(e.mtime||Date.now())/1e3)),n){t[3]=8;for(var i=0;i<=n.length;++i)t[i+10]=n.charCodeAt(i)}},vt=function(t){31==t[0]&&139==t[1]&&8==t[2]||O(6,"invalid gzip data");var e=t[3],n=10;4&e&&(n+=2+(t[10]|t[11]<<8));for(var i=(e>>3&1)+(e>>4&1);i>0;i-=!t[n++]);return n+(2&e)},mt=function(t){var e=t.length;return(t[e-4]|t[e-3]<<8|t[e-2]<<16|t[e-1]<<24)>>>0},yt=function(t){return 10+(t.filename?t.filename.length+1:0)},_t=function(t,e){var n=e.level,i=0==n?0:n<6?1:9==n?3:2;if(t[0]=120,t[1]=i<<6|(e.dictionary&&32),t[1]|=31-(t[0]<<8|t[1])%31,e.dictionary){var r=H();r.p(e.dictionary),pt(t,2,r.d())}},It=function(t,e){return(8!=(15&t[0])||t[0]>>4>7||(t[0]<<8|t[1])%31)&&O(6,"invalid zlib data"),(t[1]>>5&1)==+!e&&O(6,"invalid zlib data: "+(32&t[1]?"need":"unexpected")+" dictionary"),2+(t[1]>>3&4)};function Et(t,e){return"function"==typeof t&&(e=t,t={}),this.ondata=e,t}var bt=function(){function t(t,e){if("function"==typeof t&&(e=t,t={}),this.ondata=e,this.o=t||{},this.s={l:0,i:32768,w:32768,z:32768},this.b=new r(98304),this.o.dictionary){var n=this.o.dictionary.subarray(-32768);this.b.set(n,32768-n.length),this.s.i=32768-n.length}}return t.prototype.p=function(t,e){this.ondata(K(t,this.o,0,0,this.s),e)},t.prototype.push=function(t,e){this.ondata||O(5),this.s.l&&O(4);var n=t.length+this.s.z;if(n>this.b.length){if(n>2*this.b.length-32768){var i=new r(-32768&n);i.set(this.b.subarray(0,this.s.z)),this.b=i}var s=this.b.length-this.s.z;s&&(this.b.set(t.subarray(0,s),this.s.z),this.s.z=this.b.length,this.p(this.b,!1)),this.b.set(this.b.subarray(-32768)),this.b.set(t.subarray(s),32768),this.s.z=t.length-s+32768,this.s.i=32766,this.s.w=32768}else this.b.set(t,this.s.z),this.s.z+=t.length;this.s.l=1&e,(this.s.z>this.s.w+8191||e)&&(this.p(this.b,e||!1),this.s.w=this.s.i,this.s.i-=2)},t}();e.Deflate=bt;var xt=function(){return function(t,e){ht([et,function(){return[ft,bt]}],this,Et.call(this,t,e),(function(t){var e=new bt(t.data);onmessage=ft(e)}),6)}}();function At(t,e,n){return n||(n=e,e={}),"function"!=typeof n&&O(7),lt(t,e,[et],(function(t){return ot(wt(t.data[0],t.data[1]))}),0,n)}function wt(t,e){return K(t,e||{},0,0)}e.AsyncDeflate=xt,e.deflate=At,e.deflateSync=wt;var Tt=function(){function t(t,e){"function"==typeof t&&(e=t,t={}),this.ondata=e;var n=t&&t.dictionary&&t.dictionary.subarray(-32768);this.s={i:0,b:n?n.length:0},this.o=new r(32768),this.p=new r(0),n&&this.o.set(n)}return t.prototype.e=function(t){if(this.ondata||O(5),this.d&&O(4),this.p.length){if(t.length){var e=new r(this.p.length+t.length);e.set(this.p),e.set(t,this.p.length),this.p=e}}else this.p=t},t.prototype.c=function(t){this.s.i=+(this.d=t||!1);var e=this.s.b,n=D(this.p,this.s,this.o);this.ondata(M(n,e,this.s.b),this.d),this.o=M(n,this.s.b-32768),this.s.b=this.o.length,this.p=M(this.p,this.s.p/8|0),this.s.p&=7},t.prototype.push=function(t,e){this.e(t),this.c(e)},t}();e.Inflate=Tt;var Nt=function(){return function(t,e){ht([tt,function(){return[ft,Tt]}],this,Et.call(this,t,e),(function(t){var e=new Tt(t.data);onmessage=ft(e)}),7)}}();function Ut(t,e,n){return n||(n=e,e={}),"function"!=typeof n&&O(7),lt(t,e,[tt],(function(t){return ot(St(t.data[0],at(t.data[1])))}),1,n)}function St(t,e){return D(t,{i:2},e&&e.out,e&&e.dictionary)}e.AsyncInflate=Nt,e.inflate=Ut,e.inflateSync=St;var Ft=function(){function t(t,e){this.c=Z(),this.l=0,this.v=1,bt.call(this,t,e)}return t.prototype.push=function(t,e){this.c.p(t),this.l+=t.length,bt.prototype.push.call(this,t,e)},t.prototype.p=function(t,e){var n=K(t,this.o,this.v&&yt(this.o),e&&8,this.s);this.v&&(gt(n,this.o),this.v=0),e&&(pt(n,n.length-8,this.c.d()),pt(n,n.length-4,this.l)),this.ondata(n,e)},t}();e.Gzip=Ft,e.Compress=Ft;var Mt=function(){return function(t,e){ht([et,nt,function(){return[ft,bt,Ft]}],this,Et.call(this,t,e),(function(t){var e=new Ft(t.data);onmessage=ft(e)}),8)}}();function Ct(t,e,n){return n||(n=e,e={}),"function"!=typeof n&&O(7),lt(t,e,[et,nt,function(){return[Ot]}],(function(t){return ot(Ot(t.data[0],t.data[1]))}),2,n)}function Ot(t,e){e||(e={});var n=Z(),i=t.length;n.p(t);var r=K(t,e,yt(e),8),s=r.length;return gt(r,e),pt(r,s-8,n.d()),pt(r,s-4,i),r}e.AsyncGzip=Mt,e.AsyncCompress=Mt,e.gzip=Ct,e.compress=Ct,e.gzipSync=Ot,e.compressSync=Ot;var Dt=function(){function t(t,e){this.v=1,this.r=0,Tt.call(this,t,e)}return t.prototype.push=function(t,e){if(Tt.prototype.e.call(this,t),this.r+=t.length,this.v){var n=this.p.subarray(this.v-1),i=n.length>3?vt(n):4;if(i>n.length){if(!e)return}else this.v>1&&this.onmember&&this.onmember(this.r-n.length);this.p=n.subarray(i),this.v=0}Tt.prototype.c.call(this,e),this.s.f&&!this.s.l&&(this.v=F(this.s.p)+9,this.s={i:0},this.o=new r(0),this.p.length&&this.push(new r(0),e))},t}();e.Gunzip=Dt;var Pt=function(){return function(t,e){var n=this;ht([tt,it,function(){return[ft,Tt,Dt]}],this,Et.call(this,t,e),(function(t){var e=new Dt(t.data);e.onmember=function(t){return postMessage(t)},onmessage=ft(e)}),9,(function(t){return n.onmember&&n.onmember(t)}))}}();function zt(t,e,n){return n||(n=e,e={}),"function"!=typeof n&&O(7),lt(t,e,[tt,it,function(){return[qt]}],(function(t){return ot(qt(t.data[0],t.data[1]))}),3,n)}function qt(t,e){var n=vt(t);return n+8>t.length&&O(6,"invalid gzip data"),D(t.subarray(n,-8),{i:2},e&&e.out||new r(mt(t)),e&&e.dictionary)}e.AsyncGunzip=Pt,e.gunzip=zt,e.gunzipSync=qt;var Lt=function(){function t(t,e){this.c=H(),this.v=1,bt.call(this,t,e)}return t.prototype.push=function(t,e){this.c.p(t),bt.prototype.push.call(this,t,e)},t.prototype.p=function(t,e){var n=K(t,this.o,this.v&&(this.o.dictionary?6:2),e&&4,this.s);this.v&&(_t(n,this.o),this.v=0),e&&pt(n,n.length-4,this.c.d()),this.ondata(n,e)},t}();e.Zlib=Lt;var Bt=function(){return function(t,e){ht([et,rt,function(){return[ft,bt,Lt]}],this,Et.call(this,t,e),(function(t){var e=new Lt(t.data);onmessage=ft(e)}),10)}}();function Rt(t,e){e||(e={});var n=H();n.p(t);var i=K(t,e,e.dictionary?6:2,4);return _t(i,e),pt(i,i.length-4,n.d()),i}e.AsyncZlib=Bt,e.zlib=function(t,e,n){return n||(n=e,e={}),"function"!=typeof n&&O(7),lt(t,e,[et,rt,function(){return[Rt]}],(function(t){return ot(Rt(t.data[0],t.data[1]))}),4,n)},e.zlibSync=Rt;var kt=function(){function t(t,e){Tt.call(this,t,e),this.v=t&&t.dictionary?2:1}return t.prototype.push=function(t,e){if(Tt.prototype.e.call(this,t),this.v){if(this.p.length<6&&!e)return;this.p=this.p.subarray(It(this.p,this.v-1)),this.v=0}e&&(this.p.length<4&&O(6,"invalid zlib data"),this.p=this.p.subarray(0,-4)),Tt.prototype.c.call(this,e)},t}();e.Unzlib=kt;var Gt=function(){return function(t,e){ht([tt,st,function(){return[ft,Tt,kt]}],this,Et.call(this,t,e),(function(t){var e=new kt(t.data);onmessage=ft(e)}),11)}}();function jt(t,e,n){return n||(n=e,e={}),"function"!=typeof n&&O(7),lt(t,e,[tt,st,function(){return[Yt]}],(function(t){return ot(Yt(t.data[0],at(t.data[1])))}),5,n)}function Yt(t,e){return D(t.subarray(It(t,e&&e.dictionary),-4),{i:2},e&&e.out,e&&e.dictionary)}e.AsyncUnzlib=Gt,e.unzlib=jt,e.unzlibSync=Yt;var Vt=function(){function t(t,e){this.G=Dt,this.I=Tt,this.Z=kt,this.o=Et.call(this,t,e)||{}}return t.prototype.push=function(t,e){if(this.ondata||O(5),this.s)this.s.push(t,e);else{if(this.p&&this.p.length){var n=new r(this.p.length+t.length);n.set(this.p),n.set(t,this.p.length)}else this.p=t;if(this.p.length>2){var i=this,s=function(){i.ondata.apply(i,arguments)};this.s=31==this.p[0]&&139==this.p[1]&&8==this.p[2]?new this.G(this.o,s):8!=(15&this.p[0])||this.p[0]>>4>7||(this.p[0]<<8|this.p[1])%31?new this.I(this.o,s):new this.Z(this.o,s),this.s.push(this.p,e),this.p=null}}},t}();e.Decompress=Vt;var Xt=function(){function t(t,e){this.G=Pt,this.I=Nt,this.Z=Gt,Vt.call(this,t,e)}return t.prototype.push=function(t,e){Vt.prototype.push.call(this,t,e)},t}();e.AsyncDecompress=Xt,e.decompress=function(t,e,n){return n||(n=e,e={}),"function"!=typeof n&&O(7),31==t[0]&&139==t[1]&&8==t[2]?zt(t,e,n):8!=(15&t[0])||t[0]>>4>7||(t[0]<<8|t[1])%31?Ut(t,e,n):jt(t,e,n)},e.decompressSync=function(t,e){return 31==t[0]&&139==t[1]&&8==t[2]?qt(t,e):8!=(15&t[0])||t[0]>>4>7||(t[0]<<8|t[1])%31?St(t,e):Yt(t,e)};var Zt=function(t,e,n,i){for(var s in t){var o=t[s],a=e+s,l=i;Array.isArray(o)&&(l=Q(i,o[1]),o=o[0]),o instanceof r?n[a]=[o,l]:(n[a+="/"]=[new r(0),l],Zt(o,a,n,i))}},Ht="undefined"!=typeof TextEncoder&&new TextEncoder,Kt="undefined"!=typeof TextDecoder&&new TextDecoder,Qt=0;try{Kt.decode(Y,{stream:!0}),Qt=1}catch(t){}var Wt=function(t){for(var e="",n=0;;){var i=t[n++],r=(i>127)+(i>223)+(i>239);if(n+r>t.length)return{s:e,r:M(t,n-1)};r?3==r?(i=((15&i)<<18|(63&t[n++])<<12|(63&t[n++])<<6|63&t[n++])-65536,e+=String.fromCharCode(55296|i>>10,56320|1023&i)):e+=1&r?String.fromCharCode((31&i)<<6|63&t[n++]):String.fromCharCode((15&i)<<12|(63&t[n++])<<6|63&t[n++]):e+=String.fromCharCode(i)}},$t=function(){function t(t){this.ondata=t,Qt?this.t=new TextDecoder:this.p=Y}return t.prototype.push=function(t,e){if(this.ondata||O(5),e=!!e,this.t)return this.ondata(this.t.decode(t,{stream:!0}),e),void(e&&(this.t.decode().length&&O(8),this.t=null));this.p||O(4);var n=new r(this.p.length+t.length);n.set(this.p),n.set(t,this.p.length);var i=Wt(n),s=i.s,o=i.r;e?(o.length&&O(8),this.p=null):this.p=o,this.ondata(s,e)},t}();e.DecodeUTF8=$t;var Jt=function(){function t(t){this.ondata=t}return t.prototype.push=function(t,e){this.ondata||O(5),this.d&&O(4),this.ondata(te(t),this.d=e||!1)},t}();function te(t,e){if(e){for(var n=new r(t.length),i=0;i<t.length;++i)n[i]=t.charCodeAt(i);return n}if(Ht)return Ht.encode(t);var s=t.length,o=new r(t.length+(t.length>>1)),a=0,l=function(t){o[a++]=t};for(i=0;i<s;++i){if(a+5>o.length){var f=new r(a+8+(s-i<<1));f.set(o),o=f}var h=t.charCodeAt(i);h<128||e?l(h):h<2048?(l(192|h>>6),l(128|63&h)):h>55295&&h<57344?(l(240|(h=65536+(1047552&h)|1023&t.charCodeAt(++i))>>18),l(128|h>>12&63),l(128|h>>6&63),l(128|63&h)):(l(224|h>>12),l(128|h>>6&63),l(128|63&h))}return M(o,0,a)}function ee(t,e){if(e){for(var n="",i=0;i<t.length;i+=16384)n+=String.fromCharCode.apply(null,t.subarray(i,i+16384));return n}if(Kt)return Kt.decode(t);var r=Wt(t),s=r.s;return(n=r.r).length&&O(8),s}e.EncodeUTF8=Jt,e.strToU8=te,e.strFromU8=ee;var ne=function(t){return 1==t?3:t<6?2:9==t?1:0},ie=function(t,e){return e+30+ut(t,e+26)+ut(t,e+28)},re=function(t,e,n){var i=ut(t,e+28),r=ee(t.subarray(e+46,e+46+i),!(2048&ut(t,e+8))),s=e+46+i,o=ct(t,e+20),a=n&&4294967295==o?se(t,s):[o,ct(t,e+24),ct(t,e+42)],l=a[0],f=a[1],h=a[2];return[ut(t,e+10),l,f,r,s+ut(t,e+30)+ut(t,e+32),h]},se=function(t,e){for(;1!=ut(t,e);e+=4+ut(t,e+2));return[dt(t,e+12),dt(t,e+4),dt(t,e+20)]},oe=function(t){var e=0;if(t)for(var n in t){var i=t[n].length;i>65535&&O(9),e+=i+4}return e},ae=function(t,e,n,i,r,s,o,a){var l=i.length,f=n.extra,h=a&&a.length,u=oe(f);pt(t,e,null!=o?33639248:67324752),e+=4,null!=o&&(t[e++]=20,t[e++]=n.os),t[e]=20,e+=2,t[e++]=n.flag<<1|(s<0&&8),t[e++]=r&&8,t[e++]=255&n.compression,t[e++]=n.compression>>8;var c=new Date(null==n.mtime?Date.now():n.mtime),d=c.getFullYear()-1980;if((d<0||d>119)&&O(10),pt(t,e,d<<25|c.getMonth()+1<<21|c.getDate()<<16|c.getHours()<<11|c.getMinutes()<<5|c.getSeconds()>>1),e+=4,-1!=s&&(pt(t,e,n.crc),pt(t,e+4,s<0?-s-2:s),pt(t,e+8,n.size)),pt(t,e+12,l),pt(t,e+14,u),e+=16,null!=o&&(pt(t,e,h),pt(t,e+6,n.attrs),pt(t,e+10,o),e+=14),t.set(i,e),e+=l,u)for(var p in f){var g=f[p],v=g.length;pt(t,e,+p),pt(t,e+2,v),t.set(g,e+4),e+=4+v}return h&&(t.set(a,e),e+=h),e},le=function(t,e,n,i,r){pt(t,e,101010256),pt(t,e+8,n),pt(t,e+10,n),pt(t,e+12,i),pt(t,e+16,r)},fe=function(){function t(t){this.filename=t,this.c=Z(),this.size=0,this.compression=0}return t.prototype.process=function(t,e){this.ondata(null,t,e)},t.prototype.push=function(t,e){this.ondata||O(5),this.c.p(t),this.size+=t.length,e&&(this.crc=this.c.d()),this.process(t,e||!1)},t}();e.ZipPassThrough=fe;var he=function(){function t(t,e){var n=this;e||(e={}),fe.call(this,t),this.d=new bt(e,(function(t,e){n.ondata(null,t,e)})),this.compression=8,this.flag=ne(e.level)}return t.prototype.process=function(t,e){try{this.d.push(t,e)}catch(t){this.ondata(t,null,e)}},t.prototype.push=function(t,e){fe.prototype.push.call(this,t,e)},t}();e.ZipDeflate=he;var ue=function(){function t(t,e){var n=this;e||(e={}),fe.call(this,t),this.d=new xt(e,(function(t,e,i){n.ondata(t,e,i)})),this.compression=8,this.flag=ne(e.level),this.terminate=this.d.terminate}return t.prototype.process=function(t,e){this.d.push(t,e)},t.prototype.push=function(t,e){fe.prototype.push.call(this,t,e)},t}();e.AsyncZipDeflate=ue;var ce=function(){function t(t){this.ondata=t,this.u=[],this.d=1}return t.prototype.add=function(t){var e=this;if(this.ondata||O(5),2&this.d)this.ondata(O(4+8*(1&this.d),0,1),null,!1);else{var n=te(t.filename),i=n.length,s=t.comment,o=s&&te(s),a=i!=t.filename.length||o&&s.length!=o.length,l=i+oe(t.extra)+30;i>65535&&this.ondata(O(11,0,1),null,!1);var f=new r(l);ae(f,0,t,n,a,-1);var h=[f],u=function(){for(var t=0,n=h;t<n.length;t++){var i=n[t];e.ondata(null,i,!1)}h=[]},c=this.d;this.d=0;var d=this.u.length,p=Q(t,{f:n,u:a,o:o,t:function(){t.terminate&&t.terminate()},r:function(){if(u(),c){var t=e.u[d+1];t?t.r():e.d=1}c=1}}),g=0;t.ondata=function(n,i,s){if(n)e.ondata(n,i,s),e.terminate();else if(g+=i.length,h.push(i),s){var o=new r(16);pt(o,0,134695760),pt(o,4,t.crc),pt(o,8,g),pt(o,12,t.size),h.push(o),p.c=g,p.b=l+g+16,p.crc=t.crc,p.size=t.size,c&&p.r(),c=1}else c&&u()},this.u.push(p)}},t.prototype.end=function(){var t=this;2&this.d?this.ondata(O(4+8*(1&this.d),0,1),null,!0):(this.d?this.e():this.u.push({r:function(){1&t.d&&(t.u.splice(-1,1),t.e())},t:function(){}}),this.d=3)},t.prototype.e=function(){for(var t=0,e=0,n=0,i=0,s=this.u;i<s.length;i++)n+=46+(f=s[i]).f.length+oe(f.extra)+(f.o?f.o.length:0);for(var o=new r(n+22),a=0,l=this.u;a<l.length;a++){var f=l[a];ae(o,t,f,f.f,f.u,-f.c-2,e,f.o),t+=46+f.f.length+oe(f.extra)+(f.o?f.o.length:0),e+=f.b}le(o,t,this.u.length,n,e),this.ondata(null,o,!0),this.d=2},t.prototype.terminate=function(){for(var t=0,e=this.u;t<e.length;t++)e[t].t();this.d=2},t}();e.Zip=ce,e.zip=function(t,e,n){n||(n=e,e={}),"function"!=typeof n&&O(7);var i={};Zt(t,"",i,e);var s=Object.keys(i),o=s.length,a=0,l=0,f=o,h=new Array(o),u=[],c=function(){for(var t=0;t<u.length;++t)u[t]()},d=function(t,e){me((function(){n(t,e)}))};me((function(){d=n}));var p=function(){var t=new r(l+22),e=a,n=l-a;l=0;for(var i=0;i<f;++i){var s=h[i];try{var o=s.c.length;ae(t,l,s,s.f,s.u,o);var u=30+s.f.length+oe(s.extra),c=l+u;t.set(s.c,c),ae(t,a,s,s.f,s.u,o,l,s.m),a+=16+u+(s.m?s.m.length:0),l=c+o}catch(t){return d(t,null)}}le(t,a,h.length,n,e),d(null,t)};o||p();for(var g=function(t){var e=s[t],n=i[e],r=n[0],f=n[1],g=Z(),v=r.length;g.p(r);var m=te(e),y=m.length,_=f.comment,I=_&&te(_),E=I&&I.length,b=oe(f.extra),x=0==f.level?0:8,A=function(n,i){if(n)c(),d(n,null);else{var r=i.length;h[t]=Q(f,{size:v,crc:g.d(),c:i,f:m,m:I,u:y!=e.length||I&&_.length!=E,compression:x}),a+=30+y+b+r,l+=76+2*(y+b)+(E||0)+r,--o||p()}};if(y>65535&&A(O(11,0,1),null),x)if(v<16e4)try{A(null,wt(r,f))}catch(t){A(t,null)}else u.push(At(r,f,A));else A(null,r)},v=0;v<f;++v)g(v);return c},e.zipSync=function(t,e){e||(e={});var n={},i=[];Zt(t,"",n,e);var s=0,o=0;for(var a in n){var l=n[a],f=l[0],h=l[1],u=0==h.level?0:8,c=(A=te(a)).length,d=h.comment,p=d&&te(d),g=p&&p.length,v=oe(h.extra);c>65535&&O(11);var m=u?wt(f,h):f,y=m.length,_=Z();_.p(f),i.push(Q(h,{size:f.length,crc:_.d(),c:m,f:A,m:p,u:c!=a.length||p&&d.length!=g,o:s,compression:u})),s+=30+c+v+y,o+=76+2*(c+v)+(g||0)+y}for(var I=new r(o+22),E=s,b=o-s,x=0;x<i.length;++x){var A=i[x];ae(I,A.o,A,A.f,A.u,A.c.length);var w=30+A.f.length+oe(A.extra);I.set(A.c,A.o+w),ae(I,s,A,A.f,A.u,A.c.length,A.o,A.m),s+=16+w+(A.m?A.m.length:0)}return le(I,s,i.length,b,E),I};var de=function(){function t(){}return t.prototype.push=function(t,e){this.ondata(null,t,e)},t.compression=0,t}();e.UnzipPassThrough=de;var pe=function(){function t(){var t=this;this.i=new Tt((function(e,n){t.ondata(null,e,n)}))}return t.prototype.push=function(t,e){try{this.i.push(t,e)}catch(t){this.ondata(t,null,e)}},t.compression=8,t}();e.UnzipInflate=pe;var ge=function(){function t(t,e){var n=this;e<32e4?this.i=new Tt((function(t,e){n.ondata(null,t,e)})):(this.i=new Nt((function(t,e,i){n.ondata(t,e,i)})),this.terminate=this.i.terminate)}return t.prototype.push=function(t,e){this.i.terminate&&(t=M(t,0)),this.i.push(t,e)},t.compression=8,t}();e.AsyncUnzipInflate=ge;var ve=function(){function t(t){this.onfile=t,this.k=[],this.o={0:de},this.p=Y}return t.prototype.push=function(t,e){var n=this;if(this.onfile||O(5),this.p||O(4),this.c>0){var i=Math.min(this.c,t.length),s=t.subarray(0,i);if(this.c-=i,this.d?this.d.push(s,!this.c):this.k[0].push(s),(t=t.subarray(i)).length)return this.push(t,e)}else{var o=0,a=0,l=void 0,f=void 0;this.p.length?t.length?((f=new r(this.p.length+t.length)).set(this.p),f.set(t,this.p.length)):f=this.p:f=t;for(var h=f.length,u=this.c,c=u&&this.d,d=function(){var t,e=ct(f,a);if(67324752==e){o=1,l=a,p.d=null,p.c=0;var i=ut(f,a+6),r=ut(f,a+8),s=2048&i,c=8&i,d=ut(f,a+26),g=ut(f,a+28);if(h>a+30+d+g){var v=[];p.k.unshift(v),o=2;var m,y=ct(f,a+18),_=ct(f,a+22),I=ee(f.subarray(a+30,a+=30+d),!s);4294967295==y?(t=c?[-2]:se(f,a),y=t[0],_=t[1]):c&&(y=-1),a+=g,p.c=y;var E={name:I,compression:r,start:function(){if(E.ondata||O(5),y){var t=n.o[r];t||E.ondata(O(14,"unknown compression type "+r,1),null,!1),(m=y<0?new t(I):new t(I,y,_)).ondata=function(t,e,n){E.ondata(t,e,n)};for(var e=0,i=v;e<i.length;e++){var s=i[e];m.push(s,!1)}n.k[0]==v&&n.c?n.d=m:m.push(Y,!0)}else E.ondata(null,Y,!0)},terminate:function(){m&&m.terminate&&m.terminate()}};y>=0&&(E.size=y,E.originalSize=_),p.onfile(E)}return"break"}if(u){if(134695760==e)return l=a+=12+(-2==u&&8),o=3,p.c=0,"break";if(33639248==e)return l=a-=4,o=3,p.c=0,"break"}},p=this;a<h-4&&"break"!==d();++a);if(this.p=Y,u<0){var g=o?f.subarray(0,l-12-(-2==u&&8)-(134695760==ct(f,l-16)&&4)):f.subarray(0,a);c?c.push(g,!!o):this.k[+(2==o)].push(g)}if(2&o)return this.push(f.subarray(a),e);this.p=f.subarray(a)}e&&(this.c&&O(13),this.p=null)},t.prototype.register=function(t){this.o[t.compression]=t},t}();e.Unzip=ve;var me="function"==typeof queueMicrotask?queueMicrotask:"function"==typeof setTimeout?setTimeout:function(t){t()};e.unzip=function(t,e,n){n||(n=e,e={}),"function"!=typeof n&&O(7);var i=[],s=function(){for(var t=0;t<i.length;++t)i[t]()},o={},a=function(t,e){me((function(){n(t,e)}))};me((function(){a=n}));for(var l=t.length-22;101010256!=ct(t,l);--l)if(!l||t.length-l>65558)return a(O(13,0,1),null),s;var f=ut(t,l+8);if(f){var h=f,u=ct(t,l+16),c=4294967295==u||65535==h;if(c){var d=ct(t,l-12);(c=101075792==ct(t,d))&&(h=f=ct(t,d+32),u=ct(t,d+48))}for(var p=e&&e.filter,g=function(e){var n=re(t,u,c),l=n[0],h=n[1],d=n[2],g=n[3],v=n[4],m=n[5],y=ie(t,m);u=v;var _=function(t,e){t?(s(),a(t,null)):(e&&(o[g]=e),--f||a(null,o))};if(!p||p({name:g,size:h,originalSize:d,compression:l}))if(l)if(8==l){var I=t.subarray(y,y+h);if(h<32e4)try{_(null,St(I,{out:new r(d)}))}catch(t){_(t,null)}else i.push(Ut(I,{size:d},_))}else _(O(14,"unknown compression type "+l,1),null);else _(null,M(t,y,y+h));else _(null,null)},v=0;v<h;++v)g()}else a(null,{});return s},e.unzipSync=function(t,e){for(var n={},i=t.length-22;101010256!=ct(t,i);--i)(!i||t.length-i>65558)&&O(13);var s=ut(t,i+8);if(!s)return{};var o=ct(t,i+16),a=4294967295==o||65535==s;if(a){var l=ct(t,i-12);(a=101075792==ct(t,l))&&(s=ct(t,l+32),o=ct(t,l+48))}for(var f=e&&e.filter,h=0;h<s;++h){var u=re(t,o,a),c=u[0],d=u[1],p=u[2],g=u[3],v=u[4],m=u[5],y=ie(t,m);o=v,f&&!f({name:g,size:d,originalSize:p,compression:c})||(c?8==c?n[g]=St(t.subarray(y,y+d),{out:new r(p)}):O(14,"unknown compression type "+c):n[g]=M(t,y,y+d))}return n}},735:function(t,e){"use strict";var n={};e.default=function(t,e,i,r,s){var o=new Worker(n[e]||(n[e]=URL.createObjectURL(new Blob([t+';addEventListener("error",function(e){e=e.error;postMessage({$e$:[e.message,e.code,e.stack]})})'],{type:"text/javascript"}))));return o.onmessage=function(t){var e=t.data,n=e.$e$;if(n){var i=new Error(n[0]);i.code=n[1],i.stack=n[2],s(i,null)}else s(null,e)},o.postMessage(i,r),o}}},i={};function r(t){var e=i[t];if(void 0!==e)return e.exports;var s=i[t]={exports:{}};return n[t].call(s.exports,s,s.exports,r),s.exports}r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,{a:e}),e},r.d=function(t,e){for(var n in e)r.o(e,n)&&!r.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var s={};return function(){"use strict";r.r(s),r.d(s,{Enums:function(){return e},NiftiImageVolume:function(){return y},cornerstoneNiftiImageVolumeLoader:function(){return C},helpers:function(){return t}});var t={};r.r(t),r.d(t,{fetchAndAllocateNiftiVolume:function(){return F},makeVolumeMetadata:function(){return h},modalityScaleNifti:function(){return E}});var e={};function n(t,e,n,i,r,s,o){try{var a=t[s](o),l=a.value}catch(t){return void n(t)}a.done?e(l):Promise.resolve(l).then(i,r)}r.r(e),r.d(e,{Events:function(){return x}});var i=r(841),o=r.n(i),a=r(130),l=r(953),f=r(976);function h(t,e,n){var i=t.numBitsPerVoxel,r=t.littleEndian,s=t.pixDims,o=t.dims,a=f.vec3.create(),l=f.vec3.create();f.vec3.set(a,e[0],e[1],e[2]),f.vec3.set(l,e[3],e[4],e[5]);for(var h=1/0,u=-1/0,c=o[1],d=o[2],p=o[3],g=c*d,v=g*Math.floor(p/2),m=v;m<v+g;m++){var y=n[m];y>u&&(u=y),y<h&&(h=y)}var _=(u+h)/2,I=u-h;return{BitsAllocated:i,BitsStored:i,SamplesPerPixel:1,HighBit:r?i-1:1,PhotometricInterpretation:"MONOCHROME2",PixelRepresentation:1,ImageOrientationPatient:[a[0],a[1],a[2],l[0],l[1],l[2]],PixelSpacing:[s[1],s[2]],Columns:c,Rows:d,voiLut:[{windowCenter:_,windowWidth:I}],FrameOfReferenceUID:"1.2.3",Modality:"MR",VOILUTFunction:"LINEAR"}}function u(t){return u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},u(t)}function c(t){var e=function(t,e){if("object"!==u(t)||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var i=n.call(t,"string");if("object"!==u(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"===u(e)?e:String(e)}function d(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,c(i.key),i)}}function p(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function g(t,e){return g=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},g(t,e)}function v(t){return v=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},v(t)}function m(t,e,n){return(e=c(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var y=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&g(t,e)}(o,t);var e,n,i,r,s=(i=o,r=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=v(i);if(r){var n=v(this).constructor;t=Reflect.construct(e,arguments,n)}else t=e.apply(this,arguments);return function(t,e){if(e&&("object"===u(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return p(t)}(this,t)});function o(t,e){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,o),m(p(n=s.call(this,t)),"loadStatus",void 0),m(p(n),"controller",void 0),m(p(n),"cancelLoading",(function(){var t=p(n).loadStatus;t&&t.loading&&(t.loading=!1,n.clearLoadCallbacks(),n.controller.abort())})),m(p(n),"load",(function(t){})),n.loadStatus=e.loadStatus,n.controller=e.controller,n}return e=o,(n=[{key:"clearLoadCallbacks",value:function(){this.loadStatus.callbacks=[]}},{key:"decache",value:function(){l.cache.removeVolumeLoadObject(this.volumeId)}}])&&d(e.prototype,n),Object.defineProperty(e,"prototype",{writable:!1}),o}(l.ImageVolume),_=function(t,e){var n,i;if(e instanceof Uint8Array||e instanceof ArrayBuffer||e instanceof SharedArrayBuffer)n=Uint8Array,i=1;else if(e instanceof Int16Array)n=Int16Array,i=2;else{if(!(e instanceof Float32Array))throw new Error("imageDataArray needs to be a Uint8Array, Int16Array or Float32Array.");n=Float32Array,i=4}var r=new n(e.byteLength),s=new n(e);r.set(s);for(var o=t[2],a=t[0]*t[1],l=r.buffer,f=0;f<o;f++)new n(l,a*f*i,a).reverse();return r};function I(t){var e=function(t){var e=[t[0][3],t[1][3],t[2][3]],n=[Math.sqrt(Math.pow(t[0][0],2)+Math.pow(t[1][0],2)+Math.pow(t[2][0],2)),Math.sqrt(Math.pow(t[0][1],2)+Math.pow(t[1][1],2)+Math.pow(t[2][1],2)),Math.sqrt(Math.pow(t[0][2],2)+Math.pow(t[1][2],2)+Math.pow(t[2][2],2))];return{origin:e,orientation:[t[0][0]/n[0],t[0][1]/n[1],t[0][2]/n[2],t[1][0]/n[0],t[1][1]/n[1],t[1][2]/n[2],t[2][0]/n[0],t[2][1]/n[1],t[2][2]/n[2]],spacing:n}}(t.affine),n=e.orientation,i=e.origin,r=e.spacing;return{origin:[-i[0],-i[1],i[2]],orientation:[-n[0],-n[3],n[6],-n[1],-n[4],n[7],-n[2],-n[5],n[8]],spacing:r}}function E(t,e){var n=t.length,i=e.scl_slope,r=e.scl_inter;if(i&&0!==i&&!Number.isNaN(i))for(var s=0;s<n;s++)t[s]=t[s]*i+r}var b=function(t){return t.NIFTI_VOLUME_LOADED="CORNERSTONE_NIFTI_VOLUME_LOADED",t.NIFTI_VOLUME_PROGRESS="CORNERSTONE_NIFTI_VOLUME_PROGRESS",t}(b||{}),x=b,A="nifti",w=l.utilities.createUint8SharedArray,T=l.utilities.createFloat32SharedArray,N=new Map;function U(t,e,n,i){return new Promise((function(r,s){var o=new XMLHttpRequest;o.open("GET",t,!0),o.responseType="arraybuffer";var a=function(t){i&&"function"==typeof i&&i(),n&&n.removeEventListener("abort",l),r(o.response)},l=function(){o.abort(),o.removeEventListener("load",a),s(new Error("Request aborted"))};o.addEventListener("load",a),e&&"function"==typeof e&&(o.onprogress=function(t){e(t.loaded,t.total)}),n&&n.aborted?(o.abort(),s(new Error("Request aborted"))):n&&n.addEventListener("abort",l),o.send()}))}var S=function(t,e){switch(t){case 2:return new Uint8Array(e);case 16:return new Float32Array(e);case 4:return new Int16Array(e);default:throw new Error("datatypeCode ".concat(t," is not yet supported"))}};function F(t){return M.apply(this,arguments)}function M(){var t;return t=o().mark((function t(e){var n,i,r,s,u,c,d,p,g,v,m,b,F,M,C,O,D,P,z,q,L,B,R,k,G,j,Y,V,X,Z,H,K,Q,W;return o().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.substring(A.length+1),i=function(t,n){var i={volumeId:e,loaded:t,total:n};(0,l.triggerEvent)(l.eventTarget,x.NIFTI_VOLUME_PROGRESS,{data:i})},r=function(){var t={volumeId:e};(0,l.triggerEvent)(l.eventTarget,x.NIFTI_VOLUME_LOADED,{data:t})},s=new AbortController,u=s.signal,N.set(n,{controller:s,loading:!0}),t.next=8,U(n,i,u,r);case 8:if(c=t.sent,N.delete(n),d=null,p=null,a.isCompressed(c)&&(c=a.decompress(c)),a.isNIFTI(c)&&(d=a.readHeader(c),p=a.readImage(d,c)),g=S(d.datatypeCode,p),v=I(d),m=v.orientation,b=v.origin,F=v.spacing,_(d.dims.slice(1,4),g),E(g,d),M=h(d,m,g),C=f.vec3.create(),f.vec3.set(C,m[6],m[7],m[8]),O=M.BitsAllocated,D=M.PixelRepresentation,P=M.PhotometricInterpretation,z=M.ImageOrientationPatient,q=M.Columns,L=M.Rows,B=f.vec3.fromValues(z[0],z[1],z[2]),R=f.vec3.fromValues(z[3],z[4],z[5]),k=d.dims,G=k[3],j=[q,L,G],Y=new Float32Array([B[0],B[1],B[2],R[0],R[1],R[2],C[0],C[1],C[2]]),V=1===D,X=1,16!==O&&32!==O||(X=4),Z=X*j[0]*j[1]*j[2],H=1,"RGB"===P&&(H=3),K=Z*H,l.cache.isCacheable(K)){t.next=38;break}throw new Error(l.Enums.Events.CACHE_SIZE_EXCEEDED);case 38:l.cache.decacheIfNecessaryUntilBytesAvailable(K),t.t0=O,t.next=8===t.t0?42:16===t.t0||32===t.t0?48:50;break;case 42:if(!V){t.next=46;break}throw new Error("8 Bit signed images are not yet supported by this plugin.");case 46:Q=w(j[0]*j[1]*j[2]);case 47:return t.abrupt("break",50);case 48:return Q=T(j[0]*j[1]*j[2]),t.abrupt("break",50);case 50:return Q.set(g),W=new y({volumeId:e,metadata:M,dimensions:j,spacing:F,origin:b,direction:Y,scalarData:Q,sizeInBytes:K},{loadStatus:{loaded:!1,loading:!1,callbacks:[]},controller:s}),t.abrupt("return",W);case 53:case"end":return t.stop()}}),t)})),M=function(){var e=this,i=arguments;return new Promise((function(r,s){var o=t.apply(e,i);function a(t){n(o,r,s,a,l,"next",t)}function l(t){n(o,r,s,a,l,"throw",t)}a(void 0)}))},M.apply(this,arguments)}function C(t){return{promise:F(t),cancel:function(){}}}}(),s}()}));
|
|
1
|
+
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("@cornerstonejs/core"),require("gl-matrix")):"function"==typeof define&&define.amd?define(["@cornerstonejs/core","gl-matrix"],e):"object"==typeof exports?exports.cornerstoneNiftiVolumeLoader=e(require("@cornerstonejs/core"),require("gl-matrix")):t.cornerstoneNiftiVolumeLoader=e(t.cornerstone3D,t.window)}(self,((t,e)=>(()=>{"use strict";var i={237:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.NIFTIEXTENSION=void 0,e.NIFTIEXTENSION=class{esize;ecode;edata;littleEndian;constructor(t,e,i,n){if(t%16!=0)throw new Error("This does not appear to be a NIFTI extension");this.esize=t,this.ecode=e,this.edata=i,this.littleEndian=n}toArrayBuffer(){let t=new Uint8Array(this.esize),e=new Uint8Array(this.edata);t.set(e,8);let i=new DataView(t.buffer);return i.setInt32(0,this.esize,this.littleEndian),i.setInt32(4,this.ecode,this.littleEndian),t.buffer}}},130:function(t,e,i){var n=this&&this.__createBinding||(Object.create?function(t,e,i,n){void 0===n&&(n=i);var s=Object.getOwnPropertyDescriptor(e,i);s&&!("get"in s?!e.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return e[i]}}),Object.defineProperty(t,n,s)}:function(t,e,i,n){void 0===n&&(n=i),t[n]=e[i]}),s=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),r=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var i in t)"default"!==i&&Object.prototype.hasOwnProperty.call(t,i)&&n(e,t,i);return s(e,t),e};Object.defineProperty(e,"__esModule",{value:!0}),e.readExtensionData=e.readExtension=e.readImage=e.hasExtension=e.readHeader=e.decompress=e.isCompressed=e.isNIFTI=e.isNIFTI2=e.isNIFTI1=e.NIFTIEXTENSION=e.Utils=e.NIFTI2=e.NIFTI1=void 0;const o=r(i(471)),a=i(232),l=i(103),h=i(517);var f=i(232);Object.defineProperty(e,"NIFTI1",{enumerable:!0,get:function(){return f.NIFTI1}});var c=i(103);Object.defineProperty(e,"NIFTI2",{enumerable:!0,get:function(){return c.NIFTI2}});var u=i(517);Object.defineProperty(e,"Utils",{enumerable:!0,get:function(){return u.Utils}});var d=i(237);function p(t,e=!1){var i,n,s,r;return!(t.byteLength<a.NIFTI1.STANDARD_HEADER_SIZE||((i=new DataView(t))&&(n=i.getUint8(a.NIFTI1.MAGIC_NUMBER_LOCATION)),s=i.getUint8(a.NIFTI1.MAGIC_NUMBER_LOCATION+1),r=i.getUint8(a.NIFTI1.MAGIC_NUMBER_LOCATION+2),!(e&&n===a.NIFTI1.MAGIC_NUMBER2[0]&&s===a.NIFTI1.MAGIC_NUMBER2[1]&&r===a.NIFTI1.MAGIC_NUMBER2[2]||n===a.NIFTI1.MAGIC_NUMBER[0]&&s===a.NIFTI1.MAGIC_NUMBER[1]&&r===a.NIFTI1.MAGIC_NUMBER[2])))}function g(t,e=!1){var i,n,s,r;return!(t.byteLength<a.NIFTI1.STANDARD_HEADER_SIZE||(n=(i=new DataView(t)).getUint8(l.NIFTI2.MAGIC_NUMBER_LOCATION),s=i.getUint8(l.NIFTI2.MAGIC_NUMBER_LOCATION+1),r=i.getUint8(l.NIFTI2.MAGIC_NUMBER_LOCATION+2),!(e&&n===l.NIFTI2.MAGIC_NUMBER2[0]&&s===l.NIFTI2.MAGIC_NUMBER2[1]&&r===l.NIFTI2.MAGIC_NUMBER2[2]||n===l.NIFTI2.MAGIC_NUMBER[0]&&s===l.NIFTI2.MAGIC_NUMBER[1]&&r===l.NIFTI2.MAGIC_NUMBER[2])))}function m(t){var e,i,n;if(t){if(i=(e=new DataView(t)).getUint8(0),n=e.getUint8(1),i===h.Utils.GUNZIP_MAGIC_COOKIE1)return!0;if(n===h.Utils.GUNZIP_MAGIC_COOKIE2)return!0}return!1}function _(t){return o.decompressSync(new Uint8Array(t)).buffer}Object.defineProperty(e,"NIFTIEXTENSION",{enumerable:!0,get:function(){return d.NIFTIEXTENSION}}),e.isNIFTI1=p,e.isNIFTI2=g,e.isNIFTI=function(t,e=!1){return p(t,e)||g(t,e)},e.isCompressed=m,e.decompress=_,e.readHeader=function(t,e=!1){var i=null;return m(t)&&(t=_(t)),p(t,e)?i=new a.NIFTI1:g(t,e)&&(i=new l.NIFTI2),i?i.readHeader(t):console.error("That file does not appear to be NIFTI!"),i},e.hasExtension=function(t){return 0!=t.extensionFlag[0]},e.readImage=function(t,e){var i=t.vox_offset,n=1,s=1;t.dims[4]&&(n=t.dims[4]),t.dims[5]&&(s=t.dims[5]);var r=t.dims[1]*t.dims[2]*t.dims[3]*n*s*(t.numBitsPerVoxel/8);return e.slice(i,i+r)},e.readExtension=function(t,e){var i=t.getExtensionLocation(),n=t.extensionSize;return e.slice(i,i+n)},e.readExtensionData=function(t,e){var i=t.getExtensionLocation(),n=t.extensionSize;return e.slice(i+8,i+n)}},232:(t,e,i)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.NIFTI1=void 0;const n=i(517);class s{littleEndian=!1;dim_info=0;dims=[];intent_p1=0;intent_p2=0;intent_p3=0;intent_code=0;datatypeCode=0;numBitsPerVoxel=0;slice_start=0;slice_end=0;slice_code=0;pixDims=[];vox_offset=0;scl_slope=1;scl_inter=0;xyzt_units=0;cal_max=0;cal_min=0;slice_duration=0;toffset=0;description="";aux_file="";intent_name="";qform_code=0;sform_code=0;quatern_a=0;quatern_b=0;quatern_c=0;quatern_d=0;qoffset_x=0;qoffset_y=0;qoffset_z=0;affine=[[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]];qfac=1;quatern_R;magic="0";isHDR=!1;extensionFlag=[0,0,0,0];extensionSize=0;extensionCode=0;extensions=[];static TYPE_NONE=0;static TYPE_BINARY=1;static TYPE_UINT8=2;static TYPE_INT16=4;static TYPE_INT32=8;static TYPE_FLOAT32=16;static TYPE_COMPLEX64=32;static TYPE_FLOAT64=64;static TYPE_RGB24=128;static TYPE_INT8=256;static TYPE_UINT16=512;static TYPE_UINT32=768;static TYPE_INT64=1024;static TYPE_UINT64=1280;static TYPE_FLOAT128=1536;static TYPE_COMPLEX128=1792;static TYPE_COMPLEX256=2048;static XFORM_UNKNOWN=0;static XFORM_SCANNER_ANAT=1;static XFORM_ALIGNED_ANAT=2;static XFORM_TALAIRACH=3;static XFORM_MNI_152=4;static SPATIAL_UNITS_MASK=7;static TEMPORAL_UNITS_MASK=56;static UNITS_UNKNOWN=0;static UNITS_METER=1;static UNITS_MM=2;static UNITS_MICRON=3;static UNITS_SEC=8;static UNITS_MSEC=16;static UNITS_USEC=24;static UNITS_HZ=32;static UNITS_PPM=40;static UNITS_RADS=48;static MAGIC_COOKIE=348;static STANDARD_HEADER_SIZE=348;static MAGIC_NUMBER_LOCATION=344;static MAGIC_NUMBER=[110,43,49];static MAGIC_NUMBER2=[110,105,49];static EXTENSION_HEADER_SIZE=8;readHeader(t){var e,i,r,o,a=new DataView(t),l=n.Utils.getIntAt(a,0,this.littleEndian);if(l!==s.MAGIC_COOKIE&&(this.littleEndian=!0,l=n.Utils.getIntAt(a,0,this.littleEndian)),l!==s.MAGIC_COOKIE)throw new Error("This does not appear to be a NIFTI file!");for(this.dim_info=n.Utils.getByteAt(a,39),e=0;e<8;e+=1)o=40+2*e,this.dims[e]=n.Utils.getShortAt(a,o,this.littleEndian);for(this.intent_p1=n.Utils.getFloatAt(a,56,this.littleEndian),this.intent_p2=n.Utils.getFloatAt(a,60,this.littleEndian),this.intent_p3=n.Utils.getFloatAt(a,64,this.littleEndian),this.intent_code=n.Utils.getShortAt(a,68,this.littleEndian),this.datatypeCode=n.Utils.getShortAt(a,70,this.littleEndian),this.numBitsPerVoxel=n.Utils.getShortAt(a,72,this.littleEndian),this.slice_start=n.Utils.getShortAt(a,74,this.littleEndian),e=0;e<8;e+=1)o=76+4*e,this.pixDims[e]=n.Utils.getFloatAt(a,o,this.littleEndian);if(this.vox_offset=n.Utils.getFloatAt(a,108,this.littleEndian),this.scl_slope=n.Utils.getFloatAt(a,112,this.littleEndian),this.scl_inter=n.Utils.getFloatAt(a,116,this.littleEndian),this.slice_end=n.Utils.getShortAt(a,120,this.littleEndian),this.slice_code=n.Utils.getByteAt(a,122),this.xyzt_units=n.Utils.getByteAt(a,123),this.cal_max=n.Utils.getFloatAt(a,124,this.littleEndian),this.cal_min=n.Utils.getFloatAt(a,128,this.littleEndian),this.slice_duration=n.Utils.getFloatAt(a,132,this.littleEndian),this.toffset=n.Utils.getFloatAt(a,136,this.littleEndian),this.description=n.Utils.getStringAt(a,148,228),this.aux_file=n.Utils.getStringAt(a,228,252),this.qform_code=n.Utils.getShortAt(a,252,this.littleEndian),this.sform_code=n.Utils.getShortAt(a,254,this.littleEndian),this.quatern_b=n.Utils.getFloatAt(a,256,this.littleEndian),this.quatern_c=n.Utils.getFloatAt(a,260,this.littleEndian),this.quatern_d=n.Utils.getFloatAt(a,264,this.littleEndian),this.quatern_a=Math.sqrt(1-(Math.pow(this.quatern_b,2)+Math.pow(this.quatern_c,2)+Math.pow(this.quatern_d,2))),this.qoffset_x=n.Utils.getFloatAt(a,268,this.littleEndian),this.qoffset_y=n.Utils.getFloatAt(a,272,this.littleEndian),this.qoffset_z=n.Utils.getFloatAt(a,276,this.littleEndian),this.qform_code<1&&this.sform_code<1&&(this.affine[0][0]=this.pixDims[1],this.affine[1][1]=this.pixDims[2],this.affine[2][2]=this.pixDims[3]),this.qform_code>0&&this.sform_code<this.qform_code){const t=this.quatern_a,e=this.quatern_b,n=this.quatern_c,s=this.quatern_d;for(this.qfac=0===this.pixDims[0]?1:this.pixDims[0],this.quatern_R=[[t*t+e*e-n*n-s*s,2*e*n-2*t*s,2*e*s+2*t*n],[2*e*n+2*t*s,t*t+n*n-e*e-s*s,2*n*s-2*t*e],[2*e*s-2*t*n,2*n*s+2*t*e,t*t+s*s-n*n-e*e]],i=0;i<3;i+=1)for(r=0;r<3;r+=1)this.affine[i][r]=this.quatern_R[i][r]*this.pixDims[r+1],2===r&&(this.affine[i][r]*=this.qfac);this.affine[0][3]=this.qoffset_x,this.affine[1][3]=this.qoffset_y,this.affine[2][3]=this.qoffset_z}else if(this.sform_code>0)for(i=0;i<3;i+=1)for(r=0;r<4;r+=1)o=280+4*(4*i+r),this.affine[i][r]=n.Utils.getFloatAt(a,o,this.littleEndian);this.affine[3][0]=0,this.affine[3][1]=0,this.affine[3][2]=0,this.affine[3][3]=1,this.intent_name=n.Utils.getStringAt(a,328,344),this.magic=n.Utils.getStringAt(a,344,348),this.isHDR=this.magic===String.fromCharCode.apply(null,s.MAGIC_NUMBER2),a.byteLength>s.MAGIC_COOKIE&&(this.extensionFlag[0]=n.Utils.getByteAt(a,348),this.extensionFlag[1]=n.Utils.getByteAt(a,349),this.extensionFlag[2]=n.Utils.getByteAt(a,350),this.extensionFlag[3]=n.Utils.getByteAt(a,351),this.extensionFlag[0]&&(this.extensions=n.Utils.getExtensionsAt(a,this.getExtensionLocation(),this.littleEndian,this.vox_offset),this.extensionSize=this.extensions[0].esize,this.extensionCode=this.extensions[0].ecode))}toFormattedString(){var t=n.Utils.formatNumber,e="";return e+="Dim Info = "+this.dim_info+"\n",e+="Image Dimensions (1-8): "+this.dims[0]+", "+this.dims[1]+", "+this.dims[2]+", "+this.dims[3]+", "+this.dims[4]+", "+this.dims[5]+", "+this.dims[6]+", "+this.dims[7]+"\n",e+="Intent Parameters (1-3): "+this.intent_p1+", "+this.intent_p2+", "+this.intent_p3+"\n",e+="Intent Code = "+this.intent_code+"\n",e+="Datatype = "+this.datatypeCode+" ("+this.getDatatypeCodeString(this.datatypeCode)+")\n",e+="Bits Per Voxel = "+this.numBitsPerVoxel+"\n",e+="Slice Start = "+this.slice_start+"\n",e+="Voxel Dimensions (1-8): "+t(this.pixDims[0])+", "+t(this.pixDims[1])+", "+t(this.pixDims[2])+", "+t(this.pixDims[3])+", "+t(this.pixDims[4])+", "+t(this.pixDims[5])+", "+t(this.pixDims[6])+", "+t(this.pixDims[7])+"\n",e+="Image Offset = "+this.vox_offset+"\n",e+="Data Scale: Slope = "+t(this.scl_slope)+" Intercept = "+t(this.scl_inter)+"\n",e+="Slice End = "+this.slice_end+"\n",e+="Slice Code = "+this.slice_code+"\n",e+="Units Code = "+this.xyzt_units+" ("+this.getUnitsCodeString(s.SPATIAL_UNITS_MASK&this.xyzt_units)+", "+this.getUnitsCodeString(s.TEMPORAL_UNITS_MASK&this.xyzt_units)+")\n",e+="Display Range: Max = "+t(this.cal_max)+" Min = "+t(this.cal_min)+"\n",e+="Slice Duration = "+this.slice_duration+"\n",e+="Time Axis Shift = "+this.toffset+"\n",e+='Description: "'+this.description+'"\n',e+='Auxiliary File: "'+this.aux_file+'"\n',e+="Q-Form Code = "+this.qform_code+" ("+this.getTransformCodeString(this.qform_code)+")\n",e+="S-Form Code = "+this.sform_code+" ("+this.getTransformCodeString(this.sform_code)+")\n",e+="Quaternion Parameters: b = "+t(this.quatern_b)+" c = "+t(this.quatern_c)+" d = "+t(this.quatern_d)+"\n",e+="Quaternion Offsets: x = "+this.qoffset_x+" y = "+this.qoffset_y+" z = "+this.qoffset_z+"\n",e+="S-Form Parameters X: "+t(this.affine[0][0])+", "+t(this.affine[0][1])+", "+t(this.affine[0][2])+", "+t(this.affine[0][3])+"\n",e+="S-Form Parameters Y: "+t(this.affine[1][0])+", "+t(this.affine[1][1])+", "+t(this.affine[1][2])+", "+t(this.affine[1][3])+"\n",e+="S-Form Parameters Z: "+t(this.affine[2][0])+", "+t(this.affine[2][1])+", "+t(this.affine[2][2])+", "+t(this.affine[2][3])+"\n",e+='Intent Name: "'+this.intent_name+'"\n',this.extensionFlag[0]&&(e+="Extension: Size = "+this.extensionSize+" Code = "+this.extensionCode+"\n"),e}getDatatypeCodeString=function(t){return t===s.TYPE_UINT8?"1-Byte Unsigned Integer":t===s.TYPE_INT16?"2-Byte Signed Integer":t===s.TYPE_INT32?"4-Byte Signed Integer":t===s.TYPE_FLOAT32?"4-Byte Float":t===s.TYPE_FLOAT64?"8-Byte Float":t===s.TYPE_RGB24?"RGB":t===s.TYPE_INT8?"1-Byte Signed Integer":t===s.TYPE_UINT16?"2-Byte Unsigned Integer":t===s.TYPE_UINT32?"4-Byte Unsigned Integer":t===s.TYPE_INT64?"8-Byte Signed Integer":t===s.TYPE_UINT64?"8-Byte Unsigned Integer":"Unknown"};getTransformCodeString=function(t){return t===s.XFORM_SCANNER_ANAT?"Scanner":t===s.XFORM_ALIGNED_ANAT?"Aligned":t===s.XFORM_TALAIRACH?"Talairach":t===s.XFORM_MNI_152?"MNI":"Unknown"};getUnitsCodeString=function(t){return t===s.UNITS_METER?"Meters":t===s.UNITS_MM?"Millimeters":t===s.UNITS_MICRON?"Microns":t===s.UNITS_SEC?"Seconds":t===s.UNITS_MSEC?"Milliseconds":t===s.UNITS_USEC?"Microseconds":t===s.UNITS_HZ?"Hz":t===s.UNITS_PPM?"PPM":t===s.UNITS_RADS?"Rads":"Unknown"};getQformMat(){return this.convertNiftiQFormToNiftiSForm(this.quatern_b,this.quatern_c,this.quatern_d,this.qoffset_x,this.qoffset_y,this.qoffset_z,this.pixDims[1],this.pixDims[2],this.pixDims[3],this.pixDims[0])}convertNiftiQFormToNiftiSForm(t,e,i,n,s,r,o,a,l,h){var f,c,u,d,p=[[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0]],g=t,m=e,_=i;return p[3][0]=p[3][1]=p[3][2]=0,p[3][3]=1,(f=1-(g*g+m*m+_*_))<1e-7?(g*=f=1/Math.sqrt(g*g+m*m+_*_),m*=f,_*=f,f=0):f=Math.sqrt(f),c=o>0?o:1,u=a>0?a:1,d=l>0?l:1,h<0&&(d=-d),p[0][0]=(f*f+g*g-m*m-_*_)*c,p[0][1]=2*(g*m-f*_)*u,p[0][2]=2*(g*_+f*m)*d,p[1][0]=2*(g*m+f*_)*c,p[1][1]=(f*f+m*m-g*g-_*_)*u,p[1][2]=2*(m*_-f*g)*d,p[2][0]=2*(g*_-f*m)*c,p[2][1]=2*(m*_+f*g)*u,p[2][2]=(f*f+_*_-m*m-g*g)*d,p[0][3]=n,p[1][3]=s,p[2][3]=r,p}convertNiftiSFormToNEMA(t){var e,i,n,s,r,o,a,l,h,f,c,u,d,p,g,m,_,v,I,E,y,A,b,T,x,U,N,S,F,M,w,C,O;if(p=0,U=[[0,0,0],[0,0,0],[0,0,0]],N=[[0,0,0],[0,0,0],[0,0,0]],e=t[0][0],i=t[0][1],n=t[0][2],s=t[1][0],r=t[1][1],o=t[1][2],a=t[2][0],l=t[2][1],h=t[2][2],0===(f=Math.sqrt(e*e+s*s+a*a)))return null;if(e/=f,s/=f,a/=f,0===(f=Math.sqrt(i*i+r*r+l*l)))return null;if(f=e*(i/=f)+s*(r/=f)+a*(l/=f),Math.abs(f)>1e-4){if(i-=f*e,r-=f*s,l-=f*a,0===(f=Math.sqrt(i*i+r*r+l*l)))return null;i/=f,r/=f,l/=f}if(0===(f=Math.sqrt(n*n+o*o+h*h))?(n=s*l-a*r,o=a*i-l*e,h=e*r-s*i):(n/=f,o/=f,h/=f),f=e*n+s*o+a*h,Math.abs(f)>1e-4){if(n-=f*e,o-=f*s,h-=f*a,0===(f=Math.sqrt(n*n+o*o+h*h)))return null;n/=f,o/=f,h/=f}if(f=i*n+r*o+l*h,Math.abs(f)>1e-4){if(n-=f*i,o-=f*r,h-=f*l,0===(f=Math.sqrt(n*n+o*o+h*h)))return null;n/=f,o/=f,h/=f}if(U[0][0]=e,U[0][1]=i,U[0][2]=n,U[1][0]=s,U[1][1]=r,U[1][2]=o,U[2][0]=a,U[2][1]=l,U[2][2]=h,0===(c=this.nifti_mat33_determ(U)))return null;for(x=-666,v=y=A=b=1,I=2,E=3,u=1;u<=3;u+=1)for(d=1;d<=3;d+=1)if(u!==d)for(p=1;p<=3;p+=1)if(u!==p&&d!==p)for(N[0][0]=N[0][1]=N[0][2]=N[1][0]=N[1][1]=N[1][2]=N[2][0]=N[2][1]=N[2][2]=0,g=-1;g<=1;g+=2)for(m=-1;m<=1;m+=2)for(_=-1;_<=1;_+=2)N[0][u-1]=g,N[1][d-1]=m,N[2][p-1]=_,this.nifti_mat33_determ(N)*c>0&&(f=(T=this.nifti_mat33_mul(N,U))[0][0]+T[1][1]+T[2][2])>x&&(x=f,v=u,I=d,E=p,y=g,A=m,b=_);switch(S=F=M=w=C=O="",v*y){case 1:S="X",w="+";break;case-1:S="X",w="-";break;case 2:S="Y",w="+";break;case-2:S="Y",w="-";break;case 3:S="Z",w="+";break;case-3:S="Z",w="-"}switch(I*A){case 1:F="X",C="+";break;case-1:F="X",C="-";break;case 2:F="Y",C="+";break;case-2:F="Y",C="-";break;case 3:F="Z",C="+";break;case-3:F="Z",C="-"}switch(E*b){case 1:M="X",O="+";break;case-1:M="X",O="-";break;case 2:M="Y",O="+";break;case-2:M="Y",O="-";break;case 3:M="Z",O="+";break;case-3:M="Z",O="-"}return S+F+M+w+C+O}nifti_mat33_mul=function(t,e){var i,n,s=[[0,0,0],[0,0,0],[0,0,0]];for(i=0;i<3;i+=1)for(n=0;n<3;n+=1)s[i][n]=t[i][0]*e[0][n]+t[i][1]*e[1][n]+t[i][2]*e[2][n];return s};nifti_mat33_determ=function(t){var e,i,n,s,r,o,a,l,h;return e=t[0][0],i=t[0][1],n=t[0][2],s=t[1][0],r=t[1][1],o=t[1][2],a=t[2][0],l=t[2][1],e*r*(h=t[2][2])-e*l*o-s*i*h+s*l*n+a*i*o-a*r*n};getExtensionLocation(){return s.MAGIC_COOKIE+4}getExtensionSize(t){return n.Utils.getIntAt(t,this.getExtensionLocation(),this.littleEndian)}getExtensionCode(t){return n.Utils.getIntAt(t,this.getExtensionLocation()+4,this.littleEndian)}addExtension(t,e=-1){-1==e?this.extensions.push(t):this.extensions.splice(e,0,t),this.vox_offset+=t.esize}removeExtension(t){let e=this.extensions[t];e&&(this.vox_offset-=e.esize),this.extensions.splice(t,1)}toArrayBuffer(t=!1){let e=352;if(t)for(let t of this.extensions)e+=t.esize;let i=new Uint8Array(e),n=new DataView(i.buffer);n.setInt32(0,348,this.littleEndian),n.setUint8(39,this.dim_info);for(let t=0;t<8;t++)n.setUint16(40+2*t,this.dims[t],this.littleEndian);n.setFloat32(56,this.intent_p1,this.littleEndian),n.setFloat32(60,this.intent_p2,this.littleEndian),n.setFloat32(64,this.intent_p3,this.littleEndian),n.setInt16(68,this.intent_code,this.littleEndian),n.setInt16(70,this.datatypeCode,this.littleEndian),n.setInt16(72,this.numBitsPerVoxel,this.littleEndian),n.setInt16(74,this.slice_start,this.littleEndian);for(let t=0;t<8;t++)n.setFloat32(76+4*t,this.pixDims[t],this.littleEndian);n.setFloat32(108,this.vox_offset,this.littleEndian),n.setFloat32(112,this.scl_slope,this.littleEndian),n.setFloat32(116,this.scl_inter,this.littleEndian),n.setInt16(120,this.slice_end,this.littleEndian),n.setUint8(122,this.slice_code),n.setUint8(123,this.xyzt_units),n.setFloat32(124,this.cal_max,this.littleEndian),n.setFloat32(128,this.cal_min,this.littleEndian),n.setFloat32(132,this.slice_duration,this.littleEndian),n.setFloat32(136,this.toffset,this.littleEndian),i.set(Buffer.from(this.description),148),i.set(Buffer.from(this.aux_file),228),n.setInt16(252,this.qform_code,this.littleEndian),n.setInt16(254,this.sform_code,this.littleEndian),n.setFloat32(256,this.quatern_b,this.littleEndian),n.setFloat32(260,this.quatern_c,this.littleEndian),n.setFloat32(264,this.quatern_d,this.littleEndian),n.setFloat32(268,this.qoffset_x,this.littleEndian),n.setFloat32(272,this.qoffset_y,this.littleEndian),n.setFloat32(276,this.qoffset_z,this.littleEndian);const s=this.affine.flat();for(let t=0;t<12;t++)n.setFloat32(280+4*t,s[t],this.littleEndian);if(i.set(Buffer.from(this.intent_name),328),i.set(Buffer.from(this.magic),344),t){i.set(Uint8Array.from([1,0,0,0]),348);let t=this.getExtensionLocation();for(const e of this.extensions)n.setInt32(t,e.esize,e.littleEndian),n.setInt32(t+4,e.ecode,e.littleEndian),i.set(new Uint8Array(e.edata),t+8),t+=e.esize}else i.set(new Uint8Array(4).fill(0),348);return i.buffer}}e.NIFTI1=s},103:(t,e,i)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.NIFTI2=void 0;const n=i(232),s=i(517);class r{littleEndian=!1;dim_info=0;dims=[];intent_p1=0;intent_p2=0;intent_p3=0;intent_code=0;datatypeCode=0;numBitsPerVoxel=0;slice_start=0;slice_end=0;slice_code=0;pixDims=[];vox_offset=0;scl_slope=1;scl_inter=0;xyzt_units=0;cal_max=0;cal_min=0;slice_duration=0;toffset=0;description="";aux_file="";intent_name="";qform_code=0;sform_code=0;quatern_b=0;quatern_c=0;quatern_d=0;qoffset_x=0;qoffset_y=0;qoffset_z=0;affine=[[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]];magic="0";extensionFlag=[0,0,0,0];extensions=[];extensionSize=0;extensionCode=0;static MAGIC_COOKIE=540;static MAGIC_NUMBER_LOCATION=4;static MAGIC_NUMBER=[110,43,50,0,13,10,26,10];static MAGIC_NUMBER2=[110,105,50,0,13,10,26,10];readHeader(t){var e,i,n,o,a=new DataView(t),l=s.Utils.getIntAt(a,0,this.littleEndian);if(l!==r.MAGIC_COOKIE&&(this.littleEndian=!0,l=s.Utils.getIntAt(a,0,this.littleEndian)),l!==r.MAGIC_COOKIE)throw new Error("This does not appear to be a NIFTI file!");for(this.magic=s.Utils.getStringAt(a,4,12),this.datatypeCode=s.Utils.getShortAt(a,12,this.littleEndian),this.numBitsPerVoxel=s.Utils.getShortAt(a,14,this.littleEndian),e=0;e<8;e+=1)o=16+8*e,this.dims[e]=s.Utils.getLongAt(a,o,this.littleEndian);for(this.intent_p1=s.Utils.getDoubleAt(a,80,this.littleEndian),this.intent_p2=s.Utils.getDoubleAt(a,88,this.littleEndian),this.intent_p3=s.Utils.getDoubleAt(a,96,this.littleEndian),e=0;e<8;e+=1)o=104+8*e,this.pixDims[e]=s.Utils.getDoubleAt(a,o,this.littleEndian);for(this.vox_offset=s.Utils.getLongAt(a,168,this.littleEndian),this.scl_slope=s.Utils.getDoubleAt(a,176,this.littleEndian),this.scl_inter=s.Utils.getDoubleAt(a,184,this.littleEndian),this.cal_max=s.Utils.getDoubleAt(a,192,this.littleEndian),this.cal_min=s.Utils.getDoubleAt(a,200,this.littleEndian),this.slice_duration=s.Utils.getDoubleAt(a,208,this.littleEndian),this.toffset=s.Utils.getDoubleAt(a,216,this.littleEndian),this.slice_start=s.Utils.getLongAt(a,224,this.littleEndian),this.slice_end=s.Utils.getLongAt(a,232,this.littleEndian),this.description=s.Utils.getStringAt(a,240,320),this.aux_file=s.Utils.getStringAt(a,320,344),this.qform_code=s.Utils.getIntAt(a,344,this.littleEndian),this.sform_code=s.Utils.getIntAt(a,348,this.littleEndian),this.quatern_b=s.Utils.getDoubleAt(a,352,this.littleEndian),this.quatern_c=s.Utils.getDoubleAt(a,360,this.littleEndian),this.quatern_d=s.Utils.getDoubleAt(a,368,this.littleEndian),this.qoffset_x=s.Utils.getDoubleAt(a,376,this.littleEndian),this.qoffset_y=s.Utils.getDoubleAt(a,384,this.littleEndian),this.qoffset_z=s.Utils.getDoubleAt(a,392,this.littleEndian),i=0;i<3;i+=1)for(n=0;n<4;n+=1)o=400+8*(4*i+n),this.affine[i][n]=s.Utils.getDoubleAt(a,o,this.littleEndian);this.affine[3][0]=0,this.affine[3][1]=0,this.affine[3][2]=0,this.affine[3][3]=1,this.slice_code=s.Utils.getIntAt(a,496,this.littleEndian),this.xyzt_units=s.Utils.getIntAt(a,500,this.littleEndian),this.intent_code=s.Utils.getIntAt(a,504,this.littleEndian),this.intent_name=s.Utils.getStringAt(a,508,524),this.dim_info=s.Utils.getByteAt(a,524),a.byteLength>r.MAGIC_COOKIE&&(this.extensionFlag[0]=s.Utils.getByteAt(a,540),this.extensionFlag[1]=s.Utils.getByteAt(a,541),this.extensionFlag[2]=s.Utils.getByteAt(a,542),this.extensionFlag[3]=s.Utils.getByteAt(a,543),this.extensionFlag[0]&&(this.extensions=s.Utils.getExtensionsAt(a,this.getExtensionLocation(),this.littleEndian,this.vox_offset),this.extensionSize=this.extensions[0].esize,this.extensionCode=this.extensions[0].ecode))}toFormattedString(){var t=s.Utils.formatNumber,e="";return e+="Datatype = "+ +this.datatypeCode+" ("+this.getDatatypeCodeString(this.datatypeCode)+")\n",e+="Bits Per Voxel = = "+this.numBitsPerVoxel+"\n",e+="Image Dimensions (1-8): "+this.dims[0]+", "+this.dims[1]+", "+this.dims[2]+", "+this.dims[3]+", "+this.dims[4]+", "+this.dims[5]+", "+this.dims[6]+", "+this.dims[7]+"\n",e+="Intent Parameters (1-3): "+this.intent_p1+", "+this.intent_p2+", "+this.intent_p3+"\n",e+="Voxel Dimensions (1-8): "+t(this.pixDims[0])+", "+t(this.pixDims[1])+", "+t(this.pixDims[2])+", "+t(this.pixDims[3])+", "+t(this.pixDims[4])+", "+t(this.pixDims[5])+", "+t(this.pixDims[6])+", "+t(this.pixDims[7])+"\n",e+="Image Offset = "+this.vox_offset+"\n",e+="Data Scale: Slope = "+t(this.scl_slope)+" Intercept = "+t(this.scl_inter)+"\n",e+="Display Range: Max = "+t(this.cal_max)+" Min = "+t(this.cal_min)+"\n",e+="Slice Duration = "+this.slice_duration+"\n",e+="Time Axis Shift = "+this.toffset+"\n",e+="Slice Start = "+this.slice_start+"\n",e+="Slice End = "+this.slice_end+"\n",e+='Description: "'+this.description+'"\n',e+='Auxiliary File: "'+this.aux_file+'"\n',e+="Q-Form Code = "+this.qform_code+" ("+this.getTransformCodeString(this.qform_code)+")\n",e+="S-Form Code = "+this.sform_code+" ("+this.getTransformCodeString(this.sform_code)+")\n",e+="Quaternion Parameters: b = "+t(this.quatern_b)+" c = "+t(this.quatern_c)+" d = "+t(this.quatern_d)+"\n",e+="Quaternion Offsets: x = "+this.qoffset_x+" y = "+this.qoffset_y+" z = "+this.qoffset_z+"\n",e+="S-Form Parameters X: "+t(this.affine[0][0])+", "+t(this.affine[0][1])+", "+t(this.affine[0][2])+", "+t(this.affine[0][3])+"\n",e+="S-Form Parameters Y: "+t(this.affine[1][0])+", "+t(this.affine[1][1])+", "+t(this.affine[1][2])+", "+t(this.affine[1][3])+"\n",e+="S-Form Parameters Z: "+t(this.affine[2][0])+", "+t(this.affine[2][1])+", "+t(this.affine[2][2])+", "+t(this.affine[2][3])+"\n",e+="Slice Code = "+this.slice_code+"\n",e+="Units Code = "+this.xyzt_units+" ("+this.getUnitsCodeString(n.NIFTI1.SPATIAL_UNITS_MASK&this.xyzt_units)+", "+this.getUnitsCodeString(n.NIFTI1.TEMPORAL_UNITS_MASK&this.xyzt_units)+")\n",e+="Intent Code = "+this.intent_code+"\n",(e+='Intent Name: "'+this.intent_name+'"\n')+"Dim Info = "+this.dim_info+"\n"}getExtensionLocation=function(){return r.MAGIC_COOKIE+4};getExtensionSize=n.NIFTI1.prototype.getExtensionSize;getExtensionCode=n.NIFTI1.prototype.getExtensionCode;addExtension=n.NIFTI1.prototype.addExtension;removeExtension=n.NIFTI1.prototype.removeExtension;getDatatypeCodeString=n.NIFTI1.prototype.getDatatypeCodeString;getTransformCodeString=n.NIFTI1.prototype.getTransformCodeString;getUnitsCodeString=n.NIFTI1.prototype.getUnitsCodeString;getQformMat=n.NIFTI1.prototype.getQformMat;convertNiftiQFormToNiftiSForm=n.NIFTI1.prototype.convertNiftiQFormToNiftiSForm;convertNiftiSFormToNEMA=n.NIFTI1.prototype.convertNiftiSFormToNEMA;nifti_mat33_mul=n.NIFTI1.prototype.nifti_mat33_mul;nifti_mat33_determ=n.NIFTI1.prototype.nifti_mat33_determ;toArrayBuffer(t=!1){let e=544;if(t)for(let t of this.extensions)e+=t.esize;let i=new Uint8Array(e),n=new DataView(i.buffer);n.setInt32(0,540,this.littleEndian),i.set(Buffer.from(this.magic),4),n.setInt16(12,this.datatypeCode,this.littleEndian),n.setInt16(14,this.numBitsPerVoxel,this.littleEndian);for(let t=0;t<8;t++)n.setBigInt64(16+8*t,BigInt(this.dims[t]),this.littleEndian);n.setFloat64(80,this.intent_p1,this.littleEndian),n.setFloat64(88,this.intent_p2,this.littleEndian),n.setFloat64(96,this.intent_p3,this.littleEndian);for(let t=0;t<8;t++)n.setFloat64(104+8*t,this.pixDims[t],this.littleEndian);n.setBigInt64(168,BigInt(this.vox_offset),this.littleEndian),n.setFloat64(176,this.scl_slope,this.littleEndian),n.setFloat64(184,this.scl_inter,this.littleEndian),n.setFloat64(192,this.cal_max,this.littleEndian),n.setFloat64(200,this.cal_min,this.littleEndian),n.setFloat64(208,this.slice_duration,this.littleEndian),n.setFloat64(216,this.toffset,this.littleEndian),n.setBigInt64(224,BigInt(this.slice_start),this.littleEndian),n.setBigInt64(232,BigInt(this.slice_end),this.littleEndian),i.set(Buffer.from(this.description),240),i.set(Buffer.from(this.aux_file),320),n.setInt32(344,this.qform_code,this.littleEndian),n.setInt32(348,this.sform_code,this.littleEndian),n.setFloat64(352,this.quatern_b,this.littleEndian),n.setFloat64(360,this.quatern_c,this.littleEndian),n.setFloat64(368,this.quatern_d,this.littleEndian),n.setFloat64(376,this.qoffset_x,this.littleEndian),n.setFloat64(384,this.qoffset_y,this.littleEndian),n.setFloat64(392,this.qoffset_z,this.littleEndian);const s=this.affine.flat();for(let t=0;t<12;t++)n.setFloat64(400+8*t,s[t],this.littleEndian);if(n.setInt32(496,this.slice_code,this.littleEndian),n.setInt32(500,this.xyzt_units,this.littleEndian),n.setInt32(504,this.intent_code,this.littleEndian),i.set(Buffer.from(this.intent_name),508),n.setUint8(524,this.dim_info),t){i.set(Uint8Array.from([1,0,0,0]),540);let t=this.getExtensionLocation();for(const e of this.extensions)n.setInt32(t,e.esize,e.littleEndian),n.setInt32(t+4,e.ecode,e.littleEndian),i.set(new Uint8Array(e.edata),t+8),t+=e.esize}else i.set(new Uint8Array(4).fill(0),540);return i.buffer}}e.NIFTI2=r},517:(t,e,i)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Utils=void 0;const n=i(237);class s{static crcTable=null;static GUNZIP_MAGIC_COOKIE1=31;static GUNZIP_MAGIC_COOKIE2=139;static getStringAt(t,e,i){var n,s,r="";for(n=e;n<i;n+=1)0!==(s=t.getUint8(n))&&(r+=String.fromCharCode(s));return r}static getByteAt=function(t,e){return t.getInt8(e)};static getShortAt=function(t,e,i){return t.getInt16(e,i)};static getIntAt(t,e,i){return t.getInt32(e,i)}static getFloatAt(t,e,i){return t.getFloat32(e,i)}static getDoubleAt(t,e,i){return t.getFloat64(e,i)}static getLongAt(t,e,i){var n,r=[],o=0;for(n=0;n<8;n+=1)r[n]=s.getByteAt(t,e+n);for(n=r.length-1;n>=0;n--)o=256*o+r[n];return o}static getExtensionsAt(t,e,i,r){let o=[],a=e;for(;a<r;){let e=i,l=s.getIntAt(t,a,i);if(!l)break;if(l+a>r&&(e=!e,l=s.getIntAt(t,a,e),l+a>r))throw new Error("This does not appear to be a valid NIFTI extension");if(l%16!=0)throw new Error("This does not appear to be a NIFTI extension");let h=s.getIntAt(t,a+4,e),f=t.buffer.slice(a+8,a+l);console.log("extensionByteIndex: "+(a+8)+" esize: "+l),console.log(f);let c=new n.NIFTIEXTENSION(l,h,f,e);o.push(c),a+=l}return o}static toArrayBuffer(t){var e,i,n;for(e=new ArrayBuffer(t.length),i=new Uint8Array(e),n=0;n<t.length;n+=1)i[n]=t[n];return e}static isString(t){return"string"==typeof t||t instanceof String}static formatNumber(t,e=void 0){let i;return i=s.isString(t)?Number(t):t,i=e?i.toPrecision(5):i.toPrecision(7),parseFloat(i)}static makeCRCTable(){let t,e=[];for(var i=0;i<256;i++){t=i;for(var n=0;n<8;n++)t=1&t?3988292384^t>>>1:t>>>1;e[i]=t}return e}static crc32(t){s.crcTable||(s.crcTable=s.makeCRCTable());const e=s.crcTable;let i=-1;for(var n=0;n<t.byteLength;n++)i=i>>>8^e[255&(i^t.getUint8(n))];return(-1^i)>>>0}}e.Utils=s},953:e=>{e.exports=t},976:t=>{t.exports=e},471:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0});var i={},n=function(t,e,n,s,r){var o=new Worker(i[e]||(i[e]=URL.createObjectURL(new Blob([t+';addEventListener("error",function(e){e=e.error;postMessage({$e$:[e.message,e.code,e.stack]})})'],{type:"text/javascript"}))));return o.onmessage=function(t){var e=t.data,i=e.$e$;if(i){var n=new Error(i[0]);n.code=i[1],n.stack=i[2],r(n,null)}else r(null,e)},o.postMessage(n,s),o},s=Uint8Array,r=Uint16Array,o=Int32Array,a=new s([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),l=new s([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),h=new s([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),f=function(t,e){for(var i=new r(31),n=0;n<31;++n)i[n]=e+=1<<t[n-1];var s=new o(i[30]);for(n=1;n<30;++n)for(var a=i[n];a<i[n+1];++a)s[a]=a-i[n]<<5|n;return{b:i,r:s}},c=f(a,2),u=c.b,d=c.r;u[28]=258,d[258]=28;for(var p=f(l,0),g=p.b,m=p.r,_=new r(32768),v=0;v<32768;++v){var I=(43690&v)>>1|(21845&v)<<1;I=(61680&(I=(52428&I)>>2|(13107&I)<<2))>>4|(3855&I)<<4,_[v]=((65280&I)>>8|(255&I)<<8)>>1}var E=function(t,e,i){for(var n=t.length,s=0,o=new r(e);s<n;++s)t[s]&&++o[t[s]-1];var a,l=new r(e);for(s=1;s<e;++s)l[s]=l[s-1]+o[s-1]<<1;if(i){a=new r(1<<e);var h=15-e;for(s=0;s<n;++s)if(t[s])for(var f=s<<4|t[s],c=e-t[s],u=l[t[s]-1]++<<c,d=u|(1<<c)-1;u<=d;++u)a[_[u]>>h]=f}else for(a=new r(n),s=0;s<n;++s)t[s]&&(a[s]=_[l[t[s]-1]++]>>15-t[s]);return a},y=new s(288);for(v=0;v<144;++v)y[v]=8;for(v=144;v<256;++v)y[v]=9;for(v=256;v<280;++v)y[v]=7;for(v=280;v<288;++v)y[v]=8;var A=new s(32);for(v=0;v<32;++v)A[v]=5;var b=E(y,9,0),T=E(y,9,1),x=E(A,5,0),U=E(A,5,1),N=function(t){for(var e=t[0],i=1;i<t.length;++i)t[i]>e&&(e=t[i]);return e},S=function(t,e,i){var n=e/8|0;return(t[n]|t[n+1]<<8)>>(7&e)&i},F=function(t,e){var i=e/8|0;return(t[i]|t[i+1]<<8|t[i+2]<<16)>>(7&e)},M=function(t){return(t+7)/8|0},w=function(t,e,i){return(null==e||e<0)&&(e=0),(null==i||i>t.length)&&(i=t.length),new s(t.subarray(e,i))};e.FlateErrorCode={UnexpectedEOF:0,InvalidBlockType:1,InvalidLengthLiteral:2,InvalidDistance:3,StreamFinished:4,NoStreamHandler:5,InvalidHeader:6,NoCallback:7,InvalidUTF8:8,ExtraFieldTooLong:9,InvalidDate:10,FilenameTooLong:11,StreamFinishing:12,InvalidZipData:13,UnknownCompressionMethod:14};var C=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],O=function(t,e,i){var n=new Error(e||C[t]);if(n.code=t,Error.captureStackTrace&&Error.captureStackTrace(n,O),!i)throw n;return n},D=function(t,e,i,n){var r=t.length,o=n?n.length:0;if(!r||e.f&&!e.l)return i||new s(0);var f=!i,c=f||2!=e.i,d=e.i;f&&(i=new s(3*r));var p=function(t){var e=i.length;if(t>e){var n=new s(Math.max(2*e,t));n.set(i),i=n}},m=e.f||0,_=e.p||0,v=e.b||0,I=e.l,y=e.d,A=e.m,b=e.n,x=8*r;do{if(!I){m=S(t,_,1);var C=S(t,_+1,3);if(_+=3,!C){var D=t[(j=M(_)+4)-4]|t[j-3]<<8,z=j+D;if(z>r){d&&O(0);break}c&&p(v+D),i.set(t.subarray(j,z),v),e.b=v+=D,e.p=_=8*z,e.f=m;continue}if(1==C)I=T,y=U,A=9,b=5;else if(2==C){var P=S(t,_,31)+257,q=S(t,_+10,15)+4,B=P+S(t,_+5,31)+1;_+=14;for(var R=new s(B),L=new s(19),k=0;k<q;++k)L[h[k]]=S(t,_+3*k,7);_+=3*q;var G=N(L),V=(1<<G)-1,Y=E(L,G,1);for(k=0;k<B;){var j,X=Y[S(t,_,V)];if(_+=15&X,(j=X>>4)<16)R[k++]=j;else{var Z=0,H=0;for(16==j?(H=3+S(t,_,3),_+=2,Z=R[k-1]):17==j?(H=3+S(t,_,7),_+=3):18==j&&(H=11+S(t,_,127),_+=7);H--;)R[k++]=Z}}var K=R.subarray(0,P),Q=R.subarray(P);A=N(K),b=N(Q),I=E(K,A,1),y=E(Q,b,1)}else O(1);if(_>x){d&&O(0);break}}c&&p(v+131072);for(var W=(1<<A)-1,$=(1<<b)-1,J=_;;J=_){var tt=(Z=I[F(t,_)&W])>>4;if((_+=15&Z)>x){d&&O(0);break}if(Z||O(2),tt<256)i[v++]=tt;else{if(256==tt){J=_,I=null;break}var et=tt-254;if(tt>264){var it=a[k=tt-257];et=S(t,_,(1<<it)-1)+u[k],_+=it}var nt=y[F(t,_)&$],st=nt>>4;if(nt||O(3),_+=15&nt,Q=g[st],st>3&&(it=l[st],Q+=F(t,_)&(1<<it)-1,_+=it),_>x){d&&O(0);break}c&&p(v+131072);var rt=v+et;if(v<Q){var ot=o-Q,at=Math.min(Q,rt);for(ot+v<0&&O(3);v<at;++v)i[v]=n[ot+v]}for(;v<rt;++v)i[v]=i[v-Q]}}e.l=I,e.p=J,e.b=v,e.f=m,I&&(m=1,e.m=A,e.d=y,e.n=b)}while(!m);return v!=i.length&&f?w(i,0,v):i.subarray(0,v)},z=function(t,e,i){i<<=7&e;var n=e/8|0;t[n]|=i,t[n+1]|=i>>8},P=function(t,e,i){i<<=7&e;var n=e/8|0;t[n]|=i,t[n+1]|=i>>8,t[n+2]|=i>>16},q=function(t,e){for(var i=[],n=0;n<t.length;++n)t[n]&&i.push({s:n,f:t[n]});var o=i.length,a=i.slice();if(!o)return{t:Y,l:0};if(1==o){var l=new s(i[0].s+1);return l[i[0].s]=1,{t:l,l:1}}i.sort((function(t,e){return t.f-e.f})),i.push({s:-1,f:25001});var h=i[0],f=i[1],c=0,u=1,d=2;for(i[0]={s:-1,f:h.f+f.f,l:h,r:f};u!=o-1;)h=i[i[c].f<i[d].f?c++:d++],f=i[c!=u&&i[c].f<i[d].f?c++:d++],i[u++]={s:-1,f:h.f+f.f,l:h,r:f};var p=a[0].s;for(n=1;n<o;++n)a[n].s>p&&(p=a[n].s);var g=new r(p+1),m=B(i[u-1],g,0);if(m>e){n=0;var _=0,v=m-e,I=1<<v;for(a.sort((function(t,e){return g[e.s]-g[t.s]||t.f-e.f}));n<o;++n){var E=a[n].s;if(!(g[E]>e))break;_+=I-(1<<m-g[E]),g[E]=e}for(_>>=v;_>0;){var y=a[n].s;g[y]<e?_-=1<<e-g[y]++-1:++n}for(;n>=0&&_;--n){var A=a[n].s;g[A]==e&&(--g[A],++_)}m=e}return{t:new s(g),l:m}},B=function(t,e,i){return-1==t.s?Math.max(B(t.l,e,i+1),B(t.r,e,i+1)):e[t.s]=i},R=function(t){for(var e=t.length;e&&!t[--e];);for(var i=new r(++e),n=0,s=t[0],o=1,a=function(t){i[n++]=t},l=1;l<=e;++l)if(t[l]==s&&l!=e)++o;else{if(!s&&o>2){for(;o>138;o-=138)a(32754);o>2&&(a(o>10?o-11<<5|28690:o-3<<5|12305),o=0)}else if(o>3){for(a(s),--o;o>6;o-=6)a(8304);o>2&&(a(o-3<<5|8208),o=0)}for(;o--;)a(s);o=1,s=t[l]}return{c:i.subarray(0,n),n:e}},L=function(t,e){for(var i=0,n=0;n<e.length;++n)i+=t[n]*e[n];return i},k=function(t,e,i){var n=i.length,s=M(e+2);t[s]=255&n,t[s+1]=n>>8,t[s+2]=255^t[s],t[s+3]=255^t[s+1];for(var r=0;r<n;++r)t[s+r+4]=i[r];return 8*(s+4+n)},G=function(t,e,i,n,s,o,f,c,u,d,p){z(e,p++,i),++s[256];for(var g=q(s,15),m=g.t,_=g.l,v=q(o,15),I=v.t,T=v.l,U=R(m),N=U.c,S=U.n,F=R(I),M=F.c,w=F.n,C=new r(19),O=0;O<N.length;++O)++C[31&N[O]];for(O=0;O<M.length;++O)++C[31&M[O]];for(var D=q(C,7),B=D.t,G=D.l,V=19;V>4&&!B[h[V-1]];--V);var Y,j,X,Z,H=d+5<<3,K=L(s,y)+L(o,A)+f,Q=L(s,m)+L(o,I)+f+14+3*V+L(C,B)+2*C[16]+3*C[17]+7*C[18];if(u>=0&&H<=K&&H<=Q)return k(e,p,t.subarray(u,u+d));if(z(e,p,1+(Q<K)),p+=2,Q<K){Y=E(m,_,0),j=m,X=E(I,T,0),Z=I;var W=E(B,G,0);for(z(e,p,S-257),z(e,p+5,w-1),z(e,p+10,V-4),p+=14,O=0;O<V;++O)z(e,p+3*O,B[h[O]]);p+=3*V;for(var $=[N,M],J=0;J<2;++J){var tt=$[J];for(O=0;O<tt.length;++O){var et=31&tt[O];z(e,p,W[et]),p+=B[et],et>15&&(z(e,p,tt[O]>>5&127),p+=tt[O]>>12)}}}else Y=b,j=y,X=x,Z=A;for(O=0;O<c;++O){var it=n[O];if(it>255){P(e,p,Y[257+(et=it>>18&31)]),p+=j[et+257],et>7&&(z(e,p,it>>23&31),p+=a[et]);var nt=31⁢P(e,p,X[nt]),p+=Z[nt],nt>3&&(P(e,p,it>>5&8191),p+=l[nt])}else P(e,p,Y[it]),p+=j[it]}return P(e,p,Y[256]),p+j[256]},V=new o([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Y=new s(0),j=function(t,e,i,n,h,f){var c=f.z||t.length,u=new s(n+c+5*(1+Math.ceil(c/7e3))+h),p=u.subarray(n,u.length-h),g=f.l,_=7&(f.r||0);if(e){_&&(p[0]=f.r>>3);for(var v=V[e-1],I=v>>13,E=8191&v,y=(1<<i)-1,A=f.p||new r(32768),b=f.h||new r(y+1),T=Math.ceil(i/3),x=2*T,U=function(e){return(t[e]^t[e+1]<<T^t[e+2]<<x)&y},N=new o(25e3),S=new r(288),F=new r(32),C=0,O=0,D=f.i||0,z=0,P=f.w||0,q=0;D+2<c;++D){var B=U(D),R=32767&D,L=b[B];if(A[R]=L,b[B]=R,P<=D){var Y=c-D;if((C>7e3||z>24576)&&(Y>423||!g)){_=G(t,p,0,N,S,F,O,z,q,D-q,_),z=C=O=0,q=D;for(var j=0;j<286;++j)S[j]=0;for(j=0;j<30;++j)F[j]=0}var X=2,Z=0,H=E,K=R-L&32767;if(Y>2&&B==U(D-K))for(var Q=Math.min(I,Y)-1,W=Math.min(32767,D),$=Math.min(258,Y);K<=W&&--H&&R!=L;){if(t[D+X]==t[D+X-K]){for(var J=0;J<$&&t[D+J]==t[D+J-K];++J);if(J>X){if(X=J,Z=K,J>Q)break;var tt=Math.min(K,J-2),et=0;for(j=0;j<tt;++j){var it=D-K+j&32767,nt=it-A[it]&32767;nt>et&&(et=nt,L=it)}}}K+=(R=L)-(L=A[R])&32767}if(Z){N[z++]=268435456|d[X]<<18|m[Z];var st=31&d[X],rt=31&m[Z];O+=a[st]+l[rt],++S[257+st],++F[rt],P=D+X,++C}else N[z++]=t[D],++S[t[D]]}}for(D=Math.max(D,P);D<c;++D)N[z++]=t[D],++S[t[D]];_=G(t,p,g,N,S,F,O,z,q,D-q,_),g||(f.r=7&_|p[_/8|0]<<3,_-=7,f.h=b,f.p=A,f.i=D,f.w=P)}else{for(D=f.w||0;D<c+g;D+=65535){var ot=D+65535;ot>=c&&(p[_/8|0]=g,ot=c),_=k(p,_+1,t.subarray(D,ot))}f.i=c}return w(u,0,n+M(_)+h)},X=function(){for(var t=new Int32Array(256),e=0;e<256;++e){for(var i=e,n=9;--n;)i=(1&i&&-306674912)^i>>>1;t[e]=i}return t}(),Z=function(){var t=-1;return{p:function(e){for(var i=t,n=0;n<e.length;++n)i=X[255&i^e[n]]^i>>>8;t=i},d:function(){return~t}}},H=function(){var t=1,e=0;return{p:function(i){for(var n=t,s=e,r=0|i.length,o=0;o!=r;){for(var a=Math.min(o+2655,r);o<a;++o)s+=n+=i[o];n=(65535&n)+15*(n>>16),s=(65535&s)+15*(s>>16)}t=n,e=s},d:function(){return(255&(t%=65521))<<24|(65280&t)<<8|(255&(e%=65521))<<8|e>>8}}},K=function(t,e,i,n,r){if(!r&&(r={l:1},e.dictionary)){var o=e.dictionary.subarray(-32768),a=new s(o.length+t.length);a.set(o),a.set(t,o.length),t=a,r.w=o.length}return j(t,null==e.level?6:e.level,null==e.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(t.length)))):12+e.mem,i,n,r)},Q=function(t,e){var i={};for(var n in t)i[n]=t[n];for(var n in e)i[n]=e[n];return i},W=function(t,e,i){for(var n=t(),s=t.toString(),r=s.slice(s.indexOf("[")+1,s.lastIndexOf("]")).replace(/\s+/g,"").split(","),o=0;o<n.length;++o){var a=n[o],l=r[o];if("function"==typeof a){e+=";"+l+"=";var h=a.toString();if(a.prototype)if(-1!=h.indexOf("[native code]")){var f=h.indexOf(" ",8)+1;e+=h.slice(f,h.indexOf("(",f))}else for(var c in e+=h,a.prototype)e+=";"+l+".prototype."+c+"="+a.prototype[c].toString();else e+=h}else i[l]=a}return e},$=[],J=function(t,e,i,s){if(!$[i]){for(var r="",o={},a=t.length-1,l=0;l<a;++l)r=W(t[l],r,o);$[i]={c:W(t[a],r,o),e:o}}var h=Q({},$[i].e);return n($[i].c+";onmessage=function(e){for(var k in e.data)self[k]=e.data[k];onmessage="+e.toString()+"}",i,h,function(t){var e=[];for(var i in t)t[i].buffer&&e.push((t[i]=new t[i].constructor(t[i])).buffer);return e}(h),s)},tt=function(){return[s,r,o,a,l,h,u,g,T,U,_,C,E,N,S,F,M,w,O,D,Ft,ot,at]},et=function(){return[s,r,o,a,l,h,d,m,b,y,x,A,_,V,Y,E,z,P,q,B,R,L,k,G,M,w,j,K,xt,ot]},it=function(){return[gt,vt,pt,Z,X]},nt=function(){return[mt,_t]},st=function(){return[It,pt,H]},rt=function(){return[Et]},ot=function(t){return postMessage(t,[t.buffer])},at=function(t){return t&&{out:t.size&&new s(t.size),dictionary:t.dictionary}},lt=function(t,e,i,n,s,r){var o=J(i,n,s,(function(t,e){o.terminate(),r(t,e)}));return o.postMessage([t,e],e.consume?[t.buffer]:[]),function(){o.terminate()}},ht=function(t){return t.ondata=function(t,e){return postMessage([t,e],[t.buffer])},function(e){return t.push(e.data[0],e.data[1])}},ft=function(t,e,i,n,s,r){var o,a=J(t,n,s,(function(t,i){t?(a.terminate(),e.ondata.call(e,t)):Array.isArray(i)?(i[1]&&a.terminate(),e.ondata.call(e,t,i[0],i[1])):r(i)}));a.postMessage(i),e.push=function(t,i){e.ondata||O(5),o&&e.ondata(O(4,0,1),null,!!i),a.postMessage([t,o=i],[t.buffer])},e.terminate=function(){a.terminate()}},ct=function(t,e){return t[e]|t[e+1]<<8},ut=function(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16|t[e+3]<<24)>>>0},dt=function(t,e){return ut(t,e)+4294967296*ut(t,e+4)},pt=function(t,e,i){for(;i;++e)t[e]=i,i>>>=8},gt=function(t,e){var i=e.filename;if(t[0]=31,t[1]=139,t[2]=8,t[8]=e.level<2?4:9==e.level?2:0,t[9]=3,0!=e.mtime&&pt(t,4,Math.floor(new Date(e.mtime||Date.now())/1e3)),i){t[3]=8;for(var n=0;n<=i.length;++n)t[n+10]=i.charCodeAt(n)}},mt=function(t){31==t[0]&&139==t[1]&&8==t[2]||O(6,"invalid gzip data");var e=t[3],i=10;4&e&&(i+=2+(t[10]|t[11]<<8));for(var n=(e>>3&1)+(e>>4&1);n>0;n-=!t[i++]);return i+(2&e)},_t=function(t){var e=t.length;return(t[e-4]|t[e-3]<<8|t[e-2]<<16|t[e-1]<<24)>>>0},vt=function(t){return 10+(t.filename?t.filename.length+1:0)},It=function(t,e){var i=e.level,n=0==i?0:i<6?1:9==i?3:2;if(t[0]=120,t[1]=n<<6|(e.dictionary&&32),t[1]|=31-(t[0]<<8|t[1])%31,e.dictionary){var s=H();s.p(e.dictionary),pt(t,2,s.d())}},Et=function(t,e){return(8!=(15&t[0])||t[0]>>4>7||(t[0]<<8|t[1])%31)&&O(6,"invalid zlib data"),(t[1]>>5&1)==+!e&&O(6,"invalid zlib data: "+(32&t[1]?"need":"unexpected")+" dictionary"),2+(t[1]>>3&4)};function yt(t,e){return"function"==typeof t&&(e=t,t={}),this.ondata=e,t}var At=function(){function t(t,e){if("function"==typeof t&&(e=t,t={}),this.ondata=e,this.o=t||{},this.s={l:0,i:32768,w:32768,z:32768},this.b=new s(98304),this.o.dictionary){var i=this.o.dictionary.subarray(-32768);this.b.set(i,32768-i.length),this.s.i=32768-i.length}}return t.prototype.p=function(t,e){this.ondata(K(t,this.o,0,0,this.s),e)},t.prototype.push=function(t,e){this.ondata||O(5),this.s.l&&O(4);var i=t.length+this.s.z;if(i>this.b.length){if(i>2*this.b.length-32768){var n=new s(-32768&i);n.set(this.b.subarray(0,this.s.z)),this.b=n}var r=this.b.length-this.s.z;r&&(this.b.set(t.subarray(0,r),this.s.z),this.s.z=this.b.length,this.p(this.b,!1)),this.b.set(this.b.subarray(-32768)),this.b.set(t.subarray(r),32768),this.s.z=t.length-r+32768,this.s.i=32766,this.s.w=32768}else this.b.set(t,this.s.z),this.s.z+=t.length;this.s.l=1&e,(this.s.z>this.s.w+8191||e)&&(this.p(this.b,e||!1),this.s.w=this.s.i,this.s.i-=2)},t}();e.Deflate=At;var bt=function(){return function(t,e){ft([et,function(){return[ht,At]}],this,yt.call(this,t,e),(function(t){var e=new At(t.data);onmessage=ht(e)}),6)}}();function Tt(t,e,i){return i||(i=e,e={}),"function"!=typeof i&&O(7),lt(t,e,[et],(function(t){return ot(xt(t.data[0],t.data[1]))}),0,i)}function xt(t,e){return K(t,e||{},0,0)}e.AsyncDeflate=bt,e.deflate=Tt,e.deflateSync=xt;var Ut=function(){function t(t,e){"function"==typeof t&&(e=t,t={}),this.ondata=e;var i=t&&t.dictionary&&t.dictionary.subarray(-32768);this.s={i:0,b:i?i.length:0},this.o=new s(32768),this.p=new s(0),i&&this.o.set(i)}return t.prototype.e=function(t){if(this.ondata||O(5),this.d&&O(4),this.p.length){if(t.length){var e=new s(this.p.length+t.length);e.set(this.p),e.set(t,this.p.length),this.p=e}}else this.p=t},t.prototype.c=function(t){this.s.i=+(this.d=t||!1);var e=this.s.b,i=D(this.p,this.s,this.o);this.ondata(w(i,e,this.s.b),this.d),this.o=w(i,this.s.b-32768),this.s.b=this.o.length,this.p=w(this.p,this.s.p/8|0),this.s.p&=7},t.prototype.push=function(t,e){this.e(t),this.c(e)},t}();e.Inflate=Ut;var Nt=function(){return function(t,e){ft([tt,function(){return[ht,Ut]}],this,yt.call(this,t,e),(function(t){var e=new Ut(t.data);onmessage=ht(e)}),7)}}();function St(t,e,i){return i||(i=e,e={}),"function"!=typeof i&&O(7),lt(t,e,[tt],(function(t){return ot(Ft(t.data[0],at(t.data[1])))}),1,i)}function Ft(t,e){return D(t,{i:2},e&&e.out,e&&e.dictionary)}e.AsyncInflate=Nt,e.inflate=St,e.inflateSync=Ft;var Mt=function(){function t(t,e){this.c=Z(),this.l=0,this.v=1,At.call(this,t,e)}return t.prototype.push=function(t,e){this.c.p(t),this.l+=t.length,At.prototype.push.call(this,t,e)},t.prototype.p=function(t,e){var i=K(t,this.o,this.v&&vt(this.o),e&&8,this.s);this.v&&(gt(i,this.o),this.v=0),e&&(pt(i,i.length-8,this.c.d()),pt(i,i.length-4,this.l)),this.ondata(i,e)},t}();e.Gzip=Mt,e.Compress=Mt;var wt=function(){return function(t,e){ft([et,it,function(){return[ht,At,Mt]}],this,yt.call(this,t,e),(function(t){var e=new Mt(t.data);onmessage=ht(e)}),8)}}();function Ct(t,e,i){return i||(i=e,e={}),"function"!=typeof i&&O(7),lt(t,e,[et,it,function(){return[Ot]}],(function(t){return ot(Ot(t.data[0],t.data[1]))}),2,i)}function Ot(t,e){e||(e={});var i=Z(),n=t.length;i.p(t);var s=K(t,e,vt(e),8),r=s.length;return gt(s,e),pt(s,r-8,i.d()),pt(s,r-4,n),s}e.AsyncGzip=wt,e.AsyncCompress=wt,e.gzip=Ct,e.compress=Ct,e.gzipSync=Ot,e.compressSync=Ot;var Dt=function(){function t(t,e){this.v=1,this.r=0,Ut.call(this,t,e)}return t.prototype.push=function(t,e){if(Ut.prototype.e.call(this,t),this.r+=t.length,this.v){var i=this.p.subarray(this.v-1),n=i.length>3?mt(i):4;if(n>i.length){if(!e)return}else this.v>1&&this.onmember&&this.onmember(this.r-i.length);this.p=i.subarray(n),this.v=0}Ut.prototype.c.call(this,e),this.s.f&&!this.s.l&&(this.v=M(this.s.p)+9,this.s={i:0},this.o=new s(0),this.p.length&&this.push(new s(0),e))},t}();e.Gunzip=Dt;var zt=function(){return function(t,e){var i=this;ft([tt,nt,function(){return[ht,Ut,Dt]}],this,yt.call(this,t,e),(function(t){var e=new Dt(t.data);e.onmember=function(t){return postMessage(t)},onmessage=ht(e)}),9,(function(t){return i.onmember&&i.onmember(t)}))}}();function Pt(t,e,i){return i||(i=e,e={}),"function"!=typeof i&&O(7),lt(t,e,[tt,nt,function(){return[qt]}],(function(t){return ot(qt(t.data[0],t.data[1]))}),3,i)}function qt(t,e){var i=mt(t);return i+8>t.length&&O(6,"invalid gzip data"),D(t.subarray(i,-8),{i:2},e&&e.out||new s(_t(t)),e&&e.dictionary)}e.AsyncGunzip=zt,e.gunzip=Pt,e.gunzipSync=qt;var Bt=function(){function t(t,e){this.c=H(),this.v=1,At.call(this,t,e)}return t.prototype.push=function(t,e){this.c.p(t),At.prototype.push.call(this,t,e)},t.prototype.p=function(t,e){var i=K(t,this.o,this.v&&(this.o.dictionary?6:2),e&&4,this.s);this.v&&(It(i,this.o),this.v=0),e&&pt(i,i.length-4,this.c.d()),this.ondata(i,e)},t}();e.Zlib=Bt;var Rt=function(){return function(t,e){ft([et,st,function(){return[ht,At,Bt]}],this,yt.call(this,t,e),(function(t){var e=new Bt(t.data);onmessage=ht(e)}),10)}}();function Lt(t,e){e||(e={});var i=H();i.p(t);var n=K(t,e,e.dictionary?6:2,4);return It(n,e),pt(n,n.length-4,i.d()),n}e.AsyncZlib=Rt,e.zlib=function(t,e,i){return i||(i=e,e={}),"function"!=typeof i&&O(7),lt(t,e,[et,st,function(){return[Lt]}],(function(t){return ot(Lt(t.data[0],t.data[1]))}),4,i)},e.zlibSync=Lt;var kt=function(){function t(t,e){Ut.call(this,t,e),this.v=t&&t.dictionary?2:1}return t.prototype.push=function(t,e){if(Ut.prototype.e.call(this,t),this.v){if(this.p.length<6&&!e)return;this.p=this.p.subarray(Et(this.p,this.v-1)),this.v=0}e&&(this.p.length<4&&O(6,"invalid zlib data"),this.p=this.p.subarray(0,-4)),Ut.prototype.c.call(this,e)},t}();e.Unzlib=kt;var Gt=function(){return function(t,e){ft([tt,rt,function(){return[ht,Ut,kt]}],this,yt.call(this,t,e),(function(t){var e=new kt(t.data);onmessage=ht(e)}),11)}}();function Vt(t,e,i){return i||(i=e,e={}),"function"!=typeof i&&O(7),lt(t,e,[tt,rt,function(){return[Yt]}],(function(t){return ot(Yt(t.data[0],at(t.data[1])))}),5,i)}function Yt(t,e){return D(t.subarray(Et(t,e&&e.dictionary),-4),{i:2},e&&e.out,e&&e.dictionary)}e.AsyncUnzlib=Gt,e.unzlib=Vt,e.unzlibSync=Yt;var jt=function(){function t(t,e){this.G=Dt,this.I=Ut,this.Z=kt,this.o=yt.call(this,t,e)||{}}return t.prototype.push=function(t,e){if(this.ondata||O(5),this.s)this.s.push(t,e);else{if(this.p&&this.p.length){var i=new s(this.p.length+t.length);i.set(this.p),i.set(t,this.p.length)}else this.p=t;if(this.p.length>2){var n=this,r=function(){n.ondata.apply(n,arguments)};this.s=31==this.p[0]&&139==this.p[1]&&8==this.p[2]?new this.G(this.o,r):8!=(15&this.p[0])||this.p[0]>>4>7||(this.p[0]<<8|this.p[1])%31?new this.I(this.o,r):new this.Z(this.o,r),this.s.push(this.p,e),this.p=null}}},t}();e.Decompress=jt;var Xt=function(){function t(t,e){this.G=zt,this.I=Nt,this.Z=Gt,jt.call(this,t,e)}return t.prototype.push=function(t,e){jt.prototype.push.call(this,t,e)},t}();e.AsyncDecompress=Xt,e.decompress=function(t,e,i){return i||(i=e,e={}),"function"!=typeof i&&O(7),31==t[0]&&139==t[1]&&8==t[2]?Pt(t,e,i):8!=(15&t[0])||t[0]>>4>7||(t[0]<<8|t[1])%31?St(t,e,i):Vt(t,e,i)},e.decompressSync=function(t,e){return 31==t[0]&&139==t[1]&&8==t[2]?qt(t,e):8!=(15&t[0])||t[0]>>4>7||(t[0]<<8|t[1])%31?Ft(t,e):Yt(t,e)};var Zt=function(t,e,i,n){for(var r in t){var o=t[r],a=e+r,l=n;Array.isArray(o)&&(l=Q(n,o[1]),o=o[0]),o instanceof s?i[a]=[o,l]:(i[a+="/"]=[new s(0),l],Zt(o,a,i,n))}},Ht="undefined"!=typeof TextEncoder&&new TextEncoder,Kt="undefined"!=typeof TextDecoder&&new TextDecoder,Qt=0;try{Kt.decode(Y,{stream:!0}),Qt=1}catch(t){}var Wt=function(t){for(var e="",i=0;;){var n=t[i++],s=(n>127)+(n>223)+(n>239);if(i+s>t.length)return{s:e,r:w(t,i-1)};s?3==s?(n=((15&n)<<18|(63&t[i++])<<12|(63&t[i++])<<6|63&t[i++])-65536,e+=String.fromCharCode(55296|n>>10,56320|1023&n)):e+=1&s?String.fromCharCode((31&n)<<6|63&t[i++]):String.fromCharCode((15&n)<<12|(63&t[i++])<<6|63&t[i++]):e+=String.fromCharCode(n)}},$t=function(){function t(t){this.ondata=t,Qt?this.t=new TextDecoder:this.p=Y}return t.prototype.push=function(t,e){if(this.ondata||O(5),e=!!e,this.t)return this.ondata(this.t.decode(t,{stream:!0}),e),void(e&&(this.t.decode().length&&O(8),this.t=null));this.p||O(4);var i=new s(this.p.length+t.length);i.set(this.p),i.set(t,this.p.length);var n=Wt(i),r=n.s,o=n.r;e?(o.length&&O(8),this.p=null):this.p=o,this.ondata(r,e)},t}();e.DecodeUTF8=$t;var Jt=function(){function t(t){this.ondata=t}return t.prototype.push=function(t,e){this.ondata||O(5),this.d&&O(4),this.ondata(te(t),this.d=e||!1)},t}();function te(t,e){if(e){for(var i=new s(t.length),n=0;n<t.length;++n)i[n]=t.charCodeAt(n);return i}if(Ht)return Ht.encode(t);var r=t.length,o=new s(t.length+(t.length>>1)),a=0,l=function(t){o[a++]=t};for(n=0;n<r;++n){if(a+5>o.length){var h=new s(a+8+(r-n<<1));h.set(o),o=h}var f=t.charCodeAt(n);f<128||e?l(f):f<2048?(l(192|f>>6),l(128|63&f)):f>55295&&f<57344?(l(240|(f=65536+(1047552&f)|1023&t.charCodeAt(++n))>>18),l(128|f>>12&63),l(128|f>>6&63),l(128|63&f)):(l(224|f>>12),l(128|f>>6&63),l(128|63&f))}return w(o,0,a)}function ee(t,e){if(e){for(var i="",n=0;n<t.length;n+=16384)i+=String.fromCharCode.apply(null,t.subarray(n,n+16384));return i}if(Kt)return Kt.decode(t);var s=Wt(t),r=s.s;return(i=s.r).length&&O(8),r}e.EncodeUTF8=Jt,e.strToU8=te,e.strFromU8=ee;var ie=function(t){return 1==t?3:t<6?2:9==t?1:0},ne=function(t,e){return e+30+ct(t,e+26)+ct(t,e+28)},se=function(t,e,i){var n=ct(t,e+28),s=ee(t.subarray(e+46,e+46+n),!(2048&ct(t,e+8))),r=e+46+n,o=ut(t,e+20),a=i&&4294967295==o?re(t,r):[o,ut(t,e+24),ut(t,e+42)],l=a[0],h=a[1],f=a[2];return[ct(t,e+10),l,h,s,r+ct(t,e+30)+ct(t,e+32),f]},re=function(t,e){for(;1!=ct(t,e);e+=4+ct(t,e+2));return[dt(t,e+12),dt(t,e+4),dt(t,e+20)]},oe=function(t){var e=0;if(t)for(var i in t){var n=t[i].length;n>65535&&O(9),e+=n+4}return e},ae=function(t,e,i,n,s,r,o,a){var l=n.length,h=i.extra,f=a&&a.length,c=oe(h);pt(t,e,null!=o?33639248:67324752),e+=4,null!=o&&(t[e++]=20,t[e++]=i.os),t[e]=20,e+=2,t[e++]=i.flag<<1|(r<0&&8),t[e++]=s&&8,t[e++]=255&i.compression,t[e++]=i.compression>>8;var u=new Date(null==i.mtime?Date.now():i.mtime),d=u.getFullYear()-1980;if((d<0||d>119)&&O(10),pt(t,e,d<<25|u.getMonth()+1<<21|u.getDate()<<16|u.getHours()<<11|u.getMinutes()<<5|u.getSeconds()>>1),e+=4,-1!=r&&(pt(t,e,i.crc),pt(t,e+4,r<0?-r-2:r),pt(t,e+8,i.size)),pt(t,e+12,l),pt(t,e+14,c),e+=16,null!=o&&(pt(t,e,f),pt(t,e+6,i.attrs),pt(t,e+10,o),e+=14),t.set(n,e),e+=l,c)for(var p in h){var g=h[p],m=g.length;pt(t,e,+p),pt(t,e+2,m),t.set(g,e+4),e+=4+m}return f&&(t.set(a,e),e+=f),e},le=function(t,e,i,n,s){pt(t,e,101010256),pt(t,e+8,i),pt(t,e+10,i),pt(t,e+12,n),pt(t,e+16,s)},he=function(){function t(t){this.filename=t,this.c=Z(),this.size=0,this.compression=0}return t.prototype.process=function(t,e){this.ondata(null,t,e)},t.prototype.push=function(t,e){this.ondata||O(5),this.c.p(t),this.size+=t.length,e&&(this.crc=this.c.d()),this.process(t,e||!1)},t}();e.ZipPassThrough=he;var fe=function(){function t(t,e){var i=this;e||(e={}),he.call(this,t),this.d=new At(e,(function(t,e){i.ondata(null,t,e)})),this.compression=8,this.flag=ie(e.level)}return t.prototype.process=function(t,e){try{this.d.push(t,e)}catch(t){this.ondata(t,null,e)}},t.prototype.push=function(t,e){he.prototype.push.call(this,t,e)},t}();e.ZipDeflate=fe;var ce=function(){function t(t,e){var i=this;e||(e={}),he.call(this,t),this.d=new bt(e,(function(t,e,n){i.ondata(t,e,n)})),this.compression=8,this.flag=ie(e.level),this.terminate=this.d.terminate}return t.prototype.process=function(t,e){this.d.push(t,e)},t.prototype.push=function(t,e){he.prototype.push.call(this,t,e)},t}();e.AsyncZipDeflate=ce;var ue=function(){function t(t){this.ondata=t,this.u=[],this.d=1}return t.prototype.add=function(t){var e=this;if(this.ondata||O(5),2&this.d)this.ondata(O(4+8*(1&this.d),0,1),null,!1);else{var i=te(t.filename),n=i.length,r=t.comment,o=r&&te(r),a=n!=t.filename.length||o&&r.length!=o.length,l=n+oe(t.extra)+30;n>65535&&this.ondata(O(11,0,1),null,!1);var h=new s(l);ae(h,0,t,i,a,-1);var f=[h],c=function(){for(var t=0,i=f;t<i.length;t++){var n=i[t];e.ondata(null,n,!1)}f=[]},u=this.d;this.d=0;var d=this.u.length,p=Q(t,{f:i,u:a,o,t:function(){t.terminate&&t.terminate()},r:function(){if(c(),u){var t=e.u[d+1];t?t.r():e.d=1}u=1}}),g=0;t.ondata=function(i,n,r){if(i)e.ondata(i,n,r),e.terminate();else if(g+=n.length,f.push(n),r){var o=new s(16);pt(o,0,134695760),pt(o,4,t.crc),pt(o,8,g),pt(o,12,t.size),f.push(o),p.c=g,p.b=l+g+16,p.crc=t.crc,p.size=t.size,u&&p.r(),u=1}else u&&c()},this.u.push(p)}},t.prototype.end=function(){var t=this;2&this.d?this.ondata(O(4+8*(1&this.d),0,1),null,!0):(this.d?this.e():this.u.push({r:function(){1&t.d&&(t.u.splice(-1,1),t.e())},t:function(){}}),this.d=3)},t.prototype.e=function(){for(var t=0,e=0,i=0,n=0,r=this.u;n<r.length;n++)i+=46+(h=r[n]).f.length+oe(h.extra)+(h.o?h.o.length:0);for(var o=new s(i+22),a=0,l=this.u;a<l.length;a++){var h=l[a];ae(o,t,h,h.f,h.u,-h.c-2,e,h.o),t+=46+h.f.length+oe(h.extra)+(h.o?h.o.length:0),e+=h.b}le(o,t,this.u.length,i,e),this.ondata(null,o,!0),this.d=2},t.prototype.terminate=function(){for(var t=0,e=this.u;t<e.length;t++)e[t].t();this.d=2},t}();e.Zip=ue,e.zip=function(t,e,i){i||(i=e,e={}),"function"!=typeof i&&O(7);var n={};Zt(t,"",n,e);var r=Object.keys(n),o=r.length,a=0,l=0,h=o,f=new Array(o),c=[],u=function(){for(var t=0;t<c.length;++t)c[t]()},d=function(t,e){_e((function(){i(t,e)}))};_e((function(){d=i}));var p=function(){var t=new s(l+22),e=a,i=l-a;l=0;for(var n=0;n<h;++n){var r=f[n];try{var o=r.c.length;ae(t,l,r,r.f,r.u,o);var c=30+r.f.length+oe(r.extra),u=l+c;t.set(r.c,u),ae(t,a,r,r.f,r.u,o,l,r.m),a+=16+c+(r.m?r.m.length:0),l=u+o}catch(t){return d(t,null)}}le(t,a,f.length,i,e),d(null,t)};o||p();for(var g=function(t){var e=r[t],i=n[e],s=i[0],h=i[1],g=Z(),m=s.length;g.p(s);var _=te(e),v=_.length,I=h.comment,E=I&&te(I),y=E&&E.length,A=oe(h.extra),b=0==h.level?0:8,T=function(i,n){if(i)u(),d(i,null);else{var s=n.length;f[t]=Q(h,{size:m,crc:g.d(),c:n,f:_,m:E,u:v!=e.length||E&&I.length!=y,compression:b}),a+=30+v+A+s,l+=76+2*(v+A)+(y||0)+s,--o||p()}};if(v>65535&&T(O(11,0,1),null),b)if(m<16e4)try{T(null,xt(s,h))}catch(t){T(t,null)}else c.push(Tt(s,h,T));else T(null,s)},m=0;m<h;++m)g(m);return u},e.zipSync=function(t,e){e||(e={});var i={},n=[];Zt(t,"",i,e);var r=0,o=0;for(var a in i){var l=i[a],h=l[0],f=l[1],c=0==f.level?0:8,u=(T=te(a)).length,d=f.comment,p=d&&te(d),g=p&&p.length,m=oe(f.extra);u>65535&&O(11);var _=c?xt(h,f):h,v=_.length,I=Z();I.p(h),n.push(Q(f,{size:h.length,crc:I.d(),c:_,f:T,m:p,u:u!=a.length||p&&d.length!=g,o:r,compression:c})),r+=30+u+m+v,o+=76+2*(u+m)+(g||0)+v}for(var E=new s(o+22),y=r,A=o-r,b=0;b<n.length;++b){var T=n[b];ae(E,T.o,T,T.f,T.u,T.c.length);var x=30+T.f.length+oe(T.extra);E.set(T.c,T.o+x),ae(E,r,T,T.f,T.u,T.c.length,T.o,T.m),r+=16+x+(T.m?T.m.length:0)}return le(E,r,n.length,A,y),E};var de=function(){function t(){}return t.prototype.push=function(t,e){this.ondata(null,t,e)},t.compression=0,t}();e.UnzipPassThrough=de;var pe=function(){function t(){var t=this;this.i=new Ut((function(e,i){t.ondata(null,e,i)}))}return t.prototype.push=function(t,e){try{this.i.push(t,e)}catch(t){this.ondata(t,null,e)}},t.compression=8,t}();e.UnzipInflate=pe;var ge=function(){function t(t,e){var i=this;e<32e4?this.i=new Ut((function(t,e){i.ondata(null,t,e)})):(this.i=new Nt((function(t,e,n){i.ondata(t,e,n)})),this.terminate=this.i.terminate)}return t.prototype.push=function(t,e){this.i.terminate&&(t=w(t,0)),this.i.push(t,e)},t.compression=8,t}();e.AsyncUnzipInflate=ge;var me=function(){function t(t){this.onfile=t,this.k=[],this.o={0:de},this.p=Y}return t.prototype.push=function(t,e){var i=this;if(this.onfile||O(5),this.p||O(4),this.c>0){var n=Math.min(this.c,t.length),r=t.subarray(0,n);if(this.c-=n,this.d?this.d.push(r,!this.c):this.k[0].push(r),(t=t.subarray(n)).length)return this.push(t,e)}else{var o=0,a=0,l=void 0,h=void 0;this.p.length?t.length?((h=new s(this.p.length+t.length)).set(this.p),h.set(t,this.p.length)):h=this.p:h=t;for(var f=h.length,c=this.c,u=c&&this.d,d=function(){var t,e=ut(h,a);if(67324752==e){o=1,l=a,p.d=null,p.c=0;var n=ct(h,a+6),s=ct(h,a+8),r=2048&n,u=8&n,d=ct(h,a+26),g=ct(h,a+28);if(f>a+30+d+g){var m=[];p.k.unshift(m),o=2;var _,v=ut(h,a+18),I=ut(h,a+22),E=ee(h.subarray(a+30,a+=30+d),!r);4294967295==v?(t=u?[-2]:re(h,a),v=t[0],I=t[1]):u&&(v=-1),a+=g,p.c=v;var y={name:E,compression:s,start:function(){if(y.ondata||O(5),v){var t=i.o[s];t||y.ondata(O(14,"unknown compression type "+s,1),null,!1),(_=v<0?new t(E):new t(E,v,I)).ondata=function(t,e,i){y.ondata(t,e,i)};for(var e=0,n=m;e<n.length;e++){var r=n[e];_.push(r,!1)}i.k[0]==m&&i.c?i.d=_:_.push(Y,!0)}else y.ondata(null,Y,!0)},terminate:function(){_&&_.terminate&&_.terminate()}};v>=0&&(y.size=v,y.originalSize=I),p.onfile(y)}return"break"}if(c){if(134695760==e)return l=a+=12+(-2==c&&8),o=3,p.c=0,"break";if(33639248==e)return l=a-=4,o=3,p.c=0,"break"}},p=this;a<f-4&&"break"!==d();++a);if(this.p=Y,c<0){var g=o?h.subarray(0,l-12-(-2==c&&8)-(134695760==ut(h,l-16)&&4)):h.subarray(0,a);u?u.push(g,!!o):this.k[+(2==o)].push(g)}if(2&o)return this.push(h.subarray(a),e);this.p=h.subarray(a)}e&&(this.c&&O(13),this.p=null)},t.prototype.register=function(t){this.o[t.compression]=t},t}();e.Unzip=me;var _e="function"==typeof queueMicrotask?queueMicrotask:"function"==typeof setTimeout?setTimeout:function(t){t()};e.unzip=function(t,e,i){i||(i=e,e={}),"function"!=typeof i&&O(7);var n=[],r=function(){for(var t=0;t<n.length;++t)n[t]()},o={},a=function(t,e){_e((function(){i(t,e)}))};_e((function(){a=i}));for(var l=t.length-22;101010256!=ut(t,l);--l)if(!l||t.length-l>65558)return a(O(13,0,1),null),r;var h=ct(t,l+8);if(h){var f=h,c=ut(t,l+16),u=4294967295==c||65535==f;if(u){var d=ut(t,l-12);(u=101075792==ut(t,d))&&(f=h=ut(t,d+32),c=ut(t,d+48))}for(var p=e&&e.filter,g=function(e){var i=se(t,c,u),l=i[0],f=i[1],d=i[2],g=i[3],m=i[4],_=i[5],v=ne(t,_);c=m;var I=function(t,e){t?(r(),a(t,null)):(e&&(o[g]=e),--h||a(null,o))};if(!p||p({name:g,size:f,originalSize:d,compression:l}))if(l)if(8==l){var E=t.subarray(v,v+f);if(f<32e4)try{I(null,Ft(E,{out:new s(d)}))}catch(t){I(t,null)}else n.push(St(E,{size:d},I))}else I(O(14,"unknown compression type "+l,1),null);else I(null,w(t,v,v+f));else I(null,null)},m=0;m<f;++m)g()}else a(null,{});return r},e.unzipSync=function(t,e){for(var i={},n=t.length-22;101010256!=ut(t,n);--n)(!n||t.length-n>65558)&&O(13);var r=ct(t,n+8);if(!r)return{};var o=ut(t,n+16),a=4294967295==o||65535==r;if(a){var l=ut(t,n-12);(a=101075792==ut(t,l))&&(r=ut(t,l+32),o=ut(t,l+48))}for(var h=e&&e.filter,f=0;f<r;++f){var c=se(t,o,a),u=c[0],d=c[1],p=c[2],g=c[3],m=c[4],_=c[5],v=ne(t,_);o=m,h&&!h({name:g,size:d,originalSize:p,compression:u})||(u?8==u?i[g]=Ft(t.subarray(v,v+d),{out:new s(p)}):O(14,"unknown compression type "+u):i[g]=w(t,v,v+d))}return i}}},n={};function s(t){var e=n[t];if(void 0!==e)return e.exports;var r=n[t]={exports:{}};return i[t].call(r.exports,r,r.exports,s),r.exports}s.d=(t,e)=>{for(var i in e)s.o(e,i)&&!s.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},s.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),s.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var r={};return(()=>{s.r(r),s.d(r,{Enums:()=>e,NiftiImageVolume:()=>f,cornerstoneNiftiImageVolumeLoader:()=>y,helpers:()=>t});var t={};s.r(t),s.d(t,{fetchAndAllocateNiftiVolume:()=>E,makeVolumeMetadata:()=>a,modalityScaleNifti:()=>u});var e={};s.r(e),s.d(e,{Events:()=>p});var i=s(130),n=s(953),o=s(976);function a(t,e,i){const{numBitsPerVoxel:n,littleEndian:s,pixDims:r,dims:a}=t,l=o.vec3.create(),h=o.vec3.create();o.vec3.set(l,e[0],e[1],e[2]),o.vec3.set(h,e[3],e[4],e[5]);let f=1/0,c=-1/0;const u=a[1],d=a[2],p=a[3],g=u*d,m=g*Math.floor(p/2);for(let t=m;t<m+g;t++){const e=i[t];e>c&&(c=e),e<f&&(f=e)}const _=(c+f)/2,v=c-f;return{BitsAllocated:n,BitsStored:n,SamplesPerPixel:1,HighBit:s?n-1:1,PhotometricInterpretation:"MONOCHROME2",PixelRepresentation:1,ImageOrientationPatient:[l[0],l[1],l[2],h[0],h[1],h[2]],PixelSpacing:[r[1],r[2]],Columns:u,Rows:d,voiLut:[{windowCenter:_,windowWidth:v}],FrameOfReferenceUID:"1.2.3",Modality:"MR",VOILUTFunction:"LINEAR"}}function l(t){return l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},l(t)}function h(t,e,i){return(e=function(t){var e=function(t,e){if("object"!==l(t)||null===t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,"string");if("object"!==l(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"===l(e)?e:String(e)}(e))in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}class f extends n.ImageVolume{constructor(t,e){super(t),h(this,"loadStatus",void 0),h(this,"controller",void 0),h(this,"cancelLoading",(()=>{const{loadStatus:t}=this;t&&t.loading&&(t.loading=!1,this.clearLoadCallbacks(),this.controller.abort())})),h(this,"load",(function(t){})),this.loadStatus=e.loadStatus,this.controller=e.controller}clearLoadCallbacks(){this.loadStatus.callbacks=[]}decache(){n.cache.removeVolumeLoadObject(this.volumeId)}}const c=(t,e)=>{let i,n;if(e instanceof Uint8Array||e instanceof ArrayBuffer||e instanceof SharedArrayBuffer)i=Uint8Array,n=1;else if(e instanceof Int16Array)i=Int16Array,n=2;else{if(!(e instanceof Float32Array))throw new Error("imageDataArray needs to be a Uint8Array, Int16Array or Float32Array.");i=Float32Array,n=4}const s=new i(e.byteLength),r=new i(e);s.set(r);const o=t[2],a=t[0]*t[1],l=s.buffer;for(let t=0;t<o;t++)new i(l,a*t*n,a).reverse();return s};function u(t,e){const i=t.length,{scl_slope:n,scl_inter:s}=e;if(n&&0!==n&&!Number.isNaN(n))for(let e=0;e<i;e++)t[e]=t[e]*n+s}var d=function(t){return t.NIFTI_VOLUME_LOADED="CORNERSTONE_NIFTI_VOLUME_LOADED",t.NIFTI_VOLUME_PROGRESS="CORNERSTONE_NIFTI_VOLUME_PROGRESS",t}(d||{});const p=d,g="nifti",{createUint8SharedArray:m,createFloat32SharedArray:_}=n.utilities,v=new Map,I=(t,e)=>{switch(t){case 2:return new Uint8Array(e);case 16:return new Float32Array(e);case 4:return new Int16Array(e);default:throw new Error("datatypeCode ".concat(t," is not yet supported"))}};async function E(t){const e=t.substring(g.length+1),s=new AbortController,r=s.signal;v.set(e,{controller:s,loading:!0});let l=await function(t,e,i,n){return new Promise(((s,r)=>{const o=new XMLHttpRequest;o.open("GET",t,!0),o.responseType="arraybuffer";const a=function(t){n&&n(),i&&i.removeEventListener("abort",l),s(o.response)},l=()=>{o.abort(),o.removeEventListener("load",a),r(new Error("Request aborted"))};o.addEventListener("load",a),e&&(o.onprogress=function(t){e(t.loaded,t.total)}),i&&i.aborted?(o.abort(),r(new Error("Request aborted"))):i&&i.addEventListener("abort",l),o.send()}))}(e,((e,i)=>{const s={volumeId:t,loaded:e,total:i};(0,n.triggerEvent)(n.eventTarget,p.NIFTI_VOLUME_PROGRESS,{data:s})}),r,(()=>{const e={volumeId:t};(0,n.triggerEvent)(n.eventTarget,p.NIFTI_VOLUME_LOADED,{data:e})}));v.delete(e);let h=null,d=null;i.isCompressed(l)&&(l=i.decompress(l)),i.isNIFTI(l)&&(h=i.readHeader(l),d=i.readImage(h,l));const E=I(h.datatypeCode,d),{orientation:y,origin:A,spacing:b}=function(t){const{affine:e}=t,{orientation:i,origin:n,spacing:s}=function(t){const e=[t[0][3],t[1][3],t[2][3]],i=[Math.sqrt(t[0][0]**2+t[1][0]**2+t[2][0]**2),Math.sqrt(t[0][1]**2+t[1][1]**2+t[2][1]**2),Math.sqrt(t[0][2]**2+t[1][2]**2+t[2][2]**2)];return{origin:e,orientation:[t[0][0]/i[0],t[0][1]/i[1],t[0][2]/i[2],t[1][0]/i[0],t[1][1]/i[1],t[1][2]/i[2],t[2][0]/i[0],t[2][1]/i[1],t[2][2]/i[2]],spacing:i}}(e);return{origin:[-n[0],-n[1],n[2]],orientation:[-i[0],-i[3],i[6],-i[1],-i[4],i[7],-i[2],-i[5],i[8]],spacing:s}}(h);c(h.dims.slice(1,4),E),u(E,h);const T=a(h,y,E),x=o.vec3.create();o.vec3.set(x,y[6],y[7],y[8]);const{BitsAllocated:U,PixelRepresentation:N,PhotometricInterpretation:S,ImageOrientationPatient:F,Columns:M,Rows:w}=T,C=o.vec3.fromValues(F[0],F[1],F[2]),O=o.vec3.fromValues(F[3],F[4],F[5]),{dims:D}=h,z=[M,w,D[3]],P=new Float32Array([C[0],C[1],C[2],O[0],O[1],O[2],x[0],x[1],x[2]]),q=1===N;let B=1;16!==U&&32!==U||(B=4);let R=1;"RGB"===S&&(R=3);const L=B*z[0]*z[1]*z[2]*R;if(!n.cache.isCacheable(L))throw new Error(n.Enums.Events.CACHE_SIZE_EXCEEDED);let k;switch(n.cache.decacheIfNecessaryUntilBytesAvailable(L),U){case 8:if(q)throw new Error("8 Bit signed images are not yet supported by this plugin.");k=m(z[0]*z[1]*z[2]);break;case 16:case 32:k=_(z[0]*z[1]*z[2])}return k.set(E),new f({volumeId:t,metadata:T,dimensions:z,spacing:b,origin:A,direction:P,scalarData:k,sizeInBytes:L},{loadStatus:{loaded:!1,loading:!1,callbacks:[]},controller:s})}function y(t){return{promise:E(t),cancel:()=>{}}}})(),r})()));
|
|
3
2
|
//# sourceMappingURL=index.js.map
|