@gisatcz/deckgl-geolib 1.10.1-dev.1 → 1.10.2-dev.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.
@@ -1,6 +1,6 @@
1
- "use strict";var e=require("@deck.gl/core"),t=require("@deck.gl/geo-layers"),A=require("@deck.gl/layers"),i=require("@luma.gl/constants"),r=require("chroma-js");function n(e,t,A,i){return new(A||(A=Promise))((function(r,n){function a(e){try{o(i.next(e))}catch(e){n(e)}}function s(e){try{o(i.throw(e))}catch(e){n(e)}}function o(e){var t;e.done?r(e.value):(t=e.value,t instanceof A?t:new A((function(e){e(t)}))).then(a,s)}o((i=i.apply(e,t||[])).next())}))}function a(e,t){const A=[1/0,1/0,-1/0,-1/0];for(const i of e){const e=i.getBounds();if(e){const r=i.projectPosition(e[0],{viewport:t,autoOffset:!1}),n=i.projectPosition(e[1],{viewport:t,autoOffset:!1});A[0]=Math.min(A[0],r[0]),A[1]=Math.min(A[1],r[1]),A[2]=Math.max(A[2],n[0]),A[3]=Math.max(A[3],n[1])}}return Number.isFinite(A[0])?A:null}function s(t){const{bounds:A,viewport:i,border:r=0}=t,{isGeospatial:n}=i;if(A[2]<=A[0]||A[3]<=A[1])return null;const a=i.unprojectPosition([(A[0]+A[2])/2,(A[1]+A[3])/2,0]);let{width:s,height:o,zoom:l}=t;if(void 0===l){s-=2*r,o-=2*r;const e=Math.min(s/(A[2]-A[0]),o/(A[3]-A[1]));l=Math.min(Math.log2(e),20)}else if(!s||!o){const e=2**l;s=Math.round(Math.abs(A[2]-A[0])*e),o=Math.round(Math.abs(A[3]-A[1])*e);const t=2048-2*r;if(s>t||o>t){const e=t/Math.max(s,o);s=Math.round(s*e),o=Math.round(o*e),l+=Math.log2(e)}}return n?new e.WebMercatorViewport({id:i.id,x:r,y:r,width:s,height:o,longitude:a[0],latitude:a[1],zoom:l,orthographic:!0}):new e.OrthographicViewport({id:i.id,x:r,y:r,width:s,height:o,target:a,zoom:l,flipY:!1})}function o(e,t,A){if(!e)return[0,0,1,1];const i=function(e,t){let A;if(t&&2===t.length){const[i,r]=t,n=e.getBounds({z:i}),a=e.getBounds({z:r});A=[Math.min(n[0],a[0]),Math.min(n[1],a[1]),Math.max(n[2],a[2]),Math.max(n[3],a[3])]}else A=e.getBounds();const i=e.projectPosition(A.slice(0,2)),r=e.projectPosition(A.slice(2,4));return[i[0],i[1],r[0],r[1]]}(t,A),r=function(e){const t=e[2]-e[0],A=e[3]-e[1],i=(e[0]+e[2])/2,r=(e[1]+e[3])/2;return[i-t,r-A,i+t,r+A]}(i);return e[2]-e[0]<=r[2]-r[0]&&e[3]-e[1]<=r[3]-r[1]?e:[Math.max(e[0],r[0]),Math.max(e[1],r[1]),Math.min(e[2],r[2]),Math.min(e[3],r[3])]}const l={NONE:0,WRITE_HEIGHT_MAP:1,USE_HEIGHT_MAP:2,USE_COVER:3,USE_COVER_ONLY:4,SKIP:5},g=Object.keys(l).map((e=>`const float TERRAIN_MODE_${e} = ${l[e]}.0;`)).join("\n"),h={name:"terrain",dependencies:[e.project],inject:{"vs:#decl":"\nuniform float terrain_mode;\nuniform sampler2D terrain_map;\nuniform vec4 terrain_bounds;\nout vec3 commonPos;\n"+g,"vs:#main-start":"\nif (terrain_mode == TERRAIN_MODE_SKIP) {\ngl_Position = vec4(0.0);\nreturn;\n}\n","vs:DECKGL_FILTER_GL_POSITION":"\ncommonPos = geometry.position.xyz;\nif (terrain_mode == TERRAIN_MODE_WRITE_HEIGHT_MAP) {\nvec2 texCoords = (commonPos.xy - terrain_bounds.xy) / terrain_bounds.zw;\nposition = vec4(texCoords * 2.0 - 1.0, 0.0, 1.0);\ncommonPos.z += project_uCommonOrigin.z;\n}\nif (terrain_mode == TERRAIN_MODE_USE_HEIGHT_MAP) {\nvec3 anchor = geometry.worldPosition;\nanchor.z = 0.0;\nvec3 anchorCommon = project_position(anchor);\nvec2 texCoords = (anchorCommon.xy - terrain_bounds.xy) / terrain_bounds.zw;\nif (texCoords.x >= 0.0 && texCoords.y >= 0.0 && texCoords.x <= 1.0 && texCoords.y <= 1.0) {\nfloat terrainZ = texture(terrain_map, texCoords).r;\ngeometry.position.z += terrainZ;\nposition = project_common_position_to_clipspace(geometry.position);\n}\n}\n","fs:#decl":"\nuniform float terrain_mode;\nuniform sampler2D terrain_map;\nuniform vec4 terrain_bounds;\nin vec3 commonPos;\n"+g,"fs:#main-start":"\nif (terrain_mode == TERRAIN_MODE_WRITE_HEIGHT_MAP) {\nfragColor = vec4(commonPos.z, 0.0, 0.0, 1.0);\nreturn;\n}\n","fs:DECKGL_FILTER_COLOR":"\nif ((terrain_mode == TERRAIN_MODE_USE_COVER) || (terrain_mode == TERRAIN_MODE_USE_COVER_ONLY)) {\nvec2 texCoords = (commonPos.xy - terrain_bounds.xy) / terrain_bounds.zw;\nvec4 pixel = texture(terrain_map, texCoords);\nif (terrain_mode == TERRAIN_MODE_USE_COVER_ONLY) {\ncolor = pixel;\n} else {\ncolor = pixel + color * (1.0 - pixel.a);\n}\nreturn;\n}\n"},getUniforms:(e={},t)=>{if("dummyHeightMap"in e){const{drawToTerrainHeightMap:A,heightMap:i,heightMapBounds:r,dummyHeightMap:n,terrainCover:a,useTerrainHeightMap:s,terrainSkipRender:o}=e,{project_uCommonOrigin:g}=t;let h=o?l.SKIP:l.NONE,c=n,f=null;if(A)h=l.WRITE_HEIGHT_MAP,f=r;else if(s&&i)h=l.USE_HEIGHT_MAP,c=i,f=r;else if(a){const t=e.picking?.isActive,A=t?a.getPickingFramebuffer():a.getRenderFramebuffer();c=A?.colorAttachments[0].texture,t&&(h=l.SKIP),c?(h=h===l.SKIP?l.USE_COVER_ONLY:l.USE_COVER,f=a.bounds):c=n}return{terrain_mode:h,terrain_map:c,terrain_bounds:f?[f[0]-g[0],f[1]-g[1],f[2]-f[0],f[3]-f[1]]:[0,0,0,0]}}return null}};function c(e,t){return e.createFramebuffer({id:t.id,colorAttachments:[e.createTexture({id:t.id,...t.float&&{format:"rgba32float",type:5126},mipmaps:!1,sampler:{minFilter:"linear",magFilter:"linear",addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge"}})]})}class f{constructor(e){this.isDirty=!0,this.renderViewport=null,this.bounds=null,this.layers=[],this.targetBounds=null,this.targetBoundsCommon=null,this.targetLayer=e,this.tile=d(e)}get id(){return this.targetLayer.id}get isActive(){return Boolean(this.targetLayer.getCurrentLayer())}shouldUpdate({targetLayer:e,viewport:t,layers:A,layerNeedsRedraw:i}){e&&(this.targetLayer=e);const r=!!t&&this._updateViewport(t);let n=!!A&&this._updateLayers(A);if(i)for(const e of this.layers)if(i[e]){n=!0;break}return n||r}_updateLayers(e){let t=!1;if((e=this.tile?function(e,t){return t.filter((t=>{const A=d(t);return!A||function(e,t){if(e&&t)return e[0][0]<t[1][0]&&t[0][0]<e[1][0]&&e[0][1]<t[1][1]&&t[0][1]<e[1][1];return!1}(e.boundingBox,A.boundingBox)}))}(this.tile,e):e).length!==this.layers.length)t=!0;else for(let A=0;A<e.length;A++){if(e[A].id!==this.layers[A]){t=!0;break}}return t&&(this.layers=e.map((e=>e.id))),t}_updateViewport(e){const t=this.targetLayer;let A=!1;if(this.tile&&"boundingBox"in this.tile){if(!this.targetBounds){A=!0,this.targetBounds=this.tile.boundingBox;const t=e.projectPosition(this.targetBounds[0]),i=e.projectPosition(this.targetBounds[1]);this.targetBoundsCommon=[t[0],t[1],i[0],i[1]]}}else this.targetBounds!==t.getBounds()&&(A=!0,this.targetBounds=t.getBounds(),this.targetBoundsCommon=a([t],e));if(!this.targetBoundsCommon)return!1;const i=Math.ceil(e.zoom+.5);if(this.tile)this.bounds=this.targetBoundsCommon;else{const t=this.renderViewport?.zoom;A=A||i!==t;const r=o(this.targetBoundsCommon,e),n=this.bounds;A=A||!n||r.some(((e,t)=>e!==n[t])),this.bounds=r}return A&&(this.renderViewport=s({bounds:this.bounds,zoom:i,viewport:e})),A}getRenderFramebuffer(){return this.renderViewport&&0!==this.layers.length?(this.fbo||(this.fbo=c(this.targetLayer.context.device,{id:this.id})),this.fbo):null}getPickingFramebuffer(){return!this.renderViewport||0===this.layers.length&&!this.targetLayer.props.pickable?null:(this.pickingFbo||(this.pickingFbo=c(this.targetLayer.context.device,{id:`${this.id}-picking`})),this.pickingFbo)}filterLayers(e){return e.filter((({id:e})=>this.layers.includes(e)))}delete(){const{fbo:e,pickingFbo:t}=this;e&&(e.colorAttachments[0].destroy(),e.destroy()),t&&(t.colorAttachments[0].destroy(),t.destroy())}}function d(e){for(;e;){const{tile:t}=e.props;if(t)return t;e=e.parent}return null}const u={blendColorOperation:"max",blendColorSrcFactor:"one",blendColorDstFactor:"one",blendAlphaOperation:"max",blendAlphaSrcFactor:"one",blendAlphaDstFactor:"one"};class I extends e._LayersPass{getRenderableLayers(e,t){const{layers:A}=t,i=[],r=this._getDrawLayerParams(e,t,!0);for(let e=0;e<A.length;e++){const t=A[e];!t.isComposite&&r[e].shouldDrawLayer&&i.push(t)}return i}renderHeightMap(e,t){const A=e.getRenderFramebuffer(),i=e.renderViewport;A&&i&&(A.resize(i),this.render({...t,target:A,pass:"terrain-height-map",layers:t.layers,viewports:[i],effects:[],clearColor:[0,0,0,0]}))}renderTerrainCover(e,t){const A=e.getRenderFramebuffer(),i=e.renderViewport;if(!A||!i)return;const r=e.filterLayers(t.layers);A.resize(i),this.render({...t,target:A,pass:`terrain-cover-${e.id}`,layers:r,effects:[],viewports:[i],clearColor:[0,0,0,0]})}getLayerParameters(e,t,A){return{...e.props.parameters,blend:!0,depthTest:!1,...e.props.operation.includes("terrain")&&u}}}class B extends e._PickLayersPass{constructor(){super(...arguments),this.drawParameters={}}getRenderableLayers(e,t){const{layers:A}=t,i=[];this.drawParameters={},this._resetColorEncoder(t.pickZ);const r=this._getDrawLayerParams(e,t);for(let e=0;e<A.length;e++){const t=A[e];!t.isComposite&&r[e].shouldDrawLayer&&(i.push(t),this.drawParameters[t.id]=r[e].layerParameters)}return i}renderTerrainCover(e,t){const A=e.getPickingFramebuffer(),i=e.renderViewport;if(!A||!i)return;const r=e.filterLayers(t.layers),n=e.targetLayer;n.props.pickable&&r.unshift(n),A.resize(i),this.render({...t,pickingFBO:A,pass:`terrain-cover-picking-${e.id}`,layers:r,effects:[],viewports:[i],cullRect:void 0,deviceRect:i,pickZ:!1})}getLayerParameters(e,t,A){let i;return this.drawParameters[e.id]?i=this.drawParameters[e.id]:(i=super.getLayerParameters(e,t,A),i.blend=!0),{...i,depthTest:!1}}}class C{static isSupported(e){return e.isTextureFormatRenderable("rgba32float")}constructor(e){this.renderViewport=null,this.bounds=null,this.layers=[],this.layersBounds=[],this.layersBoundsCommon=null,this.lastViewport=null,this.device=e}getRenderFramebuffer(){return this.renderViewport?(this.fbo||(this.fbo=c(this.device,{id:"height-map",float:!0})),this.fbo):null}shouldUpdate({layers:e,viewport:t}){const A=e.length!==this.layers.length||e.some(((e,t)=>e!==this.layers[t]||e.props.transitions||e.getBounds()!==this.layersBounds[t]));A&&(this.layers=e,this.layersBounds=e.map((e=>e.getBounds())),this.layersBoundsCommon=a(e,t));const i=!this.lastViewport||!t.equals(this.lastViewport);if(this.layersBoundsCommon){if(A||i){const e=o(this.layersBoundsCommon,t);if(e[2]<=e[0]||e[3]<=e[1])return this.renderViewport=null,!1;this.bounds=e,this.lastViewport=t;const A=t.scale,i=(e[2]-e[0])*A,r=(e[3]-e[1])*A;return this.renderViewport=i>0||r>0?s({bounds:[t.center[0]-1,t.center[1]-1,t.center[0]+1,t.center[1]+1],zoom:t.zoom,width:Math.min(i,2048),height:Math.min(r,2048),viewport:t}):null,!0}}else this.renderViewport=null;return!1}delete(){this.fbo&&(this.fbo.colorAttachments[0].delete(),this.fbo.delete())}}class E{constructor(){this.id="terrain-effect",this.props=null,this.useInPicking=!0,this.isPicking=!1,this.isDrapingEnabled=!1,this.terrainCovers=new Map}setup({device:t,deck:A}){this.dummyHeightMap=t.createTexture({width:1,height:1,data:new Uint8Array([0,0,0,0])}),this.terrainPass=new I(t,{id:"terrain"}),this.terrainPickingPass=new B(t,{id:"terrain-picking"}),C.isSupported(t)?this.heightMap=new C(t):e.log.warn("Terrain offset mode is not supported by this browser")(),A._addDefaultShaderModule(h)}preRender(e){if(e.pickZ)return void(this.isDrapingEnabled=!1);const{viewports:t}=e,A=e.pass.startsWith("picking");this.isPicking=A,this.isDrapingEnabled=!0;const i=t[0],r=(A?this.terrainPickingPass:this.terrainPass).getRenderableLayers(i,e),n=r.filter((e=>e.props.operation.includes("terrain")));if(0===n.length)return;if(!A){r.filter((e=>"offset"===e.state.terrainDrawMode)).length>0&&this._updateHeightMap(n,i,e)}const a=r.filter((e=>"drape"===e.state.terrainDrawMode));this._updateTerrainCovers(n,a,i,e)}getModuleParameters(e){const{terrainDrawMode:t}=e.state;return{heightMap:this.heightMap?.getRenderFramebuffer()?.colorAttachments[0].texture||null,heightMapBounds:this.heightMap?.bounds,dummyHeightMap:this.dummyHeightMap,terrainCover:this.isDrapingEnabled?this.terrainCovers.get(e.id):null,useTerrainHeightMap:"offset"===t,terrainSkipRender:"drape"===t||!e.props.operation.includes("draw")}}cleanup({deck:e}){this.dummyHeightMap&&(this.dummyHeightMap.delete(),this.dummyHeightMap=void 0),this.heightMap&&(this.heightMap.delete(),this.heightMap=void 0);for(const e of this.terrainCovers.values())e.delete();this.terrainCovers.clear(),e._removeDefaultShaderModule(h)}_updateHeightMap(e,t,A){if(!this.heightMap)return;this.heightMap.shouldUpdate({layers:e,viewport:t})&&this.terrainPass.renderHeightMap(this.heightMap,{...A,layers:e,moduleParameters:{heightMapBounds:this.heightMap.bounds,dummyHeightMap:this.dummyHeightMap,devicePixelRatio:1,drawToTerrainHeightMap:!0}})}_updateTerrainCovers(e,t,A,i){const r={};for(const e of t)e.state.terrainCoverNeedsRedraw&&(r[e.id]=!0,e.state.terrainCoverNeedsRedraw=!1);for(const e of this.terrainCovers.values())e.isDirty=e.isDirty||e.shouldUpdate({layerNeedsRedraw:r});for(const r of e)this._updateTerrainCover(r,t,A,i);this.isPicking||this._pruneTerrainCovers()}_updateTerrainCover(e,t,A,i){const r=this.isPicking?this.terrainPickingPass:this.terrainPass;let n=this.terrainCovers.get(e.id);n||(n=new f(e),this.terrainCovers.set(e.id,n));try{const a=n.shouldUpdate({targetLayer:e,viewport:A,layers:t});(this.isPicking||n.isDirty||a)&&(r.renderTerrainCover(n,{...i,layers:t,moduleParameters:{dummyHeightMap:this.dummyHeightMap,terrainSkipRender:!1,devicePixelRatio:1}}),this.isPicking||(n.isDirty=!1))}catch(t){e.raiseError(t,`Error rendering terrain cover ${n.id}`)}}_pruneTerrainCovers(){const e=[];for(const[t,A]of this.terrainCovers)A.isActive||e.push(t);for(const t of e)this.terrainCovers.delete(t)}}const w={terrainDrawMode:void 0};class Q extends e.LayerExtension{static{this.defaultProps=w}static{this.extensionName="TerrainExtension"}getShaders(){return{modules:[h]}}initializeState(){this.context.deck?._addDefaultEffect(new E)}updateState(e){const{props:t,oldProps:A}=e;if(this.state.terrainDrawMode&&t.terrainDrawMode===A.terrainDrawMode&&t.extruded===A.extruded)return;let{terrainDrawMode:i}=t;if(!i){const e=this.props.extruded,t=this.getAttributeManager()?.attributes;i=e||t&&"instancePositions"in t?"offset":"drape"}this.setState({terrainDrawMode:i})}onNeedsRedraw(){const e=this.state;"drape"===e.terrainDrawMode&&(e.terrainCoverNeedsRedraw=!0)}}var m,p,y,_,b,D,k,v,x,S,G,U,M,R;!function(e){e[e.Big=19789]="Big",e[e.Little=18761]="Little"}(m||(m={})),function(e){e[e.ReducedImage=1]="ReducedImage",e[e.Page=2]="Page",e[e.Mask=4]="Mask"}(p||(p={})),function(e){e[e.TopLeft=1]="TopLeft",e[e.TopRight=2]="TopRight",e[e.BottomRight=3]="BottomRight",e[e.BottomLeft=4]="BottomLeft",e[e.LeftTop=5]="LeftTop",e[e.RightTOP=6]="RightTOP",e[e.RightBottom=7]="RightBottom",e[e.LeftBottom=8]="LeftBottom"}(y||(y={})),function(e){e[e.PixelIsArea=1]="PixelIsArea",e[e.PixelIsPoint=2]="PixelIsPoint"}(_||(_={})),function(e){e[e.Unknown=0]="Unknown",e[e.Projected=1]="Projected",e[e.Geographic=2]="Geographic",e[e.Geocentric=3]="Geocentric",e[e.UserDefined=32767]="UserDefined"}(b||(b={})),function(e){e[e.Image=1]="Image",e[e.ReducedImage=2]="ReducedImage",e[e.Page=3]="Page"}(D||(D={})),function(e){e[e.None=1]="None",e[e.Lzw=5]="Lzw",e[e.Jpeg6=6]="Jpeg6",e[e.Jpeg=7]="Jpeg",e[e.DeflateOther=8]="DeflateOther",e[e.Deflate=32946]="Deflate",e[e.Jp2000=3417]="Jp2000",e[e.Lerc=34887]="Lerc",e[e.Lzma=34925]="Lzma",e[e.Zstd=5e4]="Zstd",e[e.Webp=50001]="Webp",e[e.JpegXl=50002]="JpegXl"}(k||(k={})),function(e){e[e.Contig=1]="Contig",e[e.Separate=2]="Separate"}(v||(v={})),function(e){e[e.Uint=1]="Uint",e[e.Int=2]="Int",e[e.Float=3]="Float",e[e.Void=4]="Void",e[e.ComplexInt=5]="ComplexInt",e[e.ComplexFloat=6]="ComplexFloat"}(x||(x={})),function(e){e[e.MinIsWhite=0]="MinIsWhite",e[e.MinIsBlack=1]="MinIsBlack",e[e.Rgb=2]="Rgb",e[e.Palette=3]="Palette",e[e.Mask=4]="Mask",e[e.Separated=5]="Separated",e[e.Ycbcr=6]="Ycbcr",e[e.Cielab=8]="Cielab",e[e.Icclab=9]="Icclab",e[e.Itulab=10]="Itulab",e[e.Cfa=32803]="Cfa",e[e.Logl=32844]="Logl",e[e.Logluv=32845]="Logluv"}(S||(S={})),function(e){e[e.SubFileType=254]="SubFileType",e[e.OldSubFileType=255]="OldSubFileType",e[e.ImageWidth=256]="ImageWidth",e[e.ImageHeight=257]="ImageHeight",e[e.BitsPerSample=258]="BitsPerSample",e[e.SampleFormat=339]="SampleFormat",e[e.Compression=259]="Compression",e[e.Photometric=262]="Photometric",e[e.TileWidth=322]="TileWidth",e[e.TileHeight=323]="TileHeight",e[e.TileOffsets=324]="TileOffsets",e[e.TileByteCounts=325]="TileByteCounts",e[e.JpegTables=347]="JpegTables",e[e.StripOffsets=273]="StripOffsets",e[e.StripByteCounts=279]="StripByteCounts",e[e.GdalMetadata=42112]="GdalMetadata",e[e.GdalNoData=42113]="GdalNoData",e[e.ModelPixelScale=33550]="ModelPixelScale",e[e.ModelTiePoint=33922]="ModelTiePoint",e[e.ModelTransformation=34744]="ModelTransformation",e[e.GeoKeyDirectory=34735]="GeoKeyDirectory",e[e.GeoDoubleParams=34736]="GeoDoubleParams",e[e.GeoAsciiParams=34737]="GeoAsciiParams",e[e.LercParameters=50674]="LercParameters",e[e.PlanarConfiguration=284]="PlanarConfiguration",e[e.CellLength=265]="CellLength",e[e.CellWidth=264]="CellWidth",e[e.ColorMap=320]="ColorMap",e[e.Copyright=33432]="Copyright",e[e.DateTime=306]="DateTime",e[e.ExtraSamples=338]="ExtraSamples",e[e.FillOrder=266]="FillOrder",e[e.FreeByteCounts=289]="FreeByteCounts",e[e.FreeOffsets=288]="FreeOffsets",e[e.GrayResponseCurve=291]="GrayResponseCurve",e[e.GrayResponseUnit=290]="GrayResponseUnit",e[e.HostComputer=316]="HostComputer",e[e.ImageDescription=270]="ImageDescription",e[e.Make=271]="Make",e[e.MaxSampleValue=281]="MaxSampleValue",e[e.MinSampleValue=280]="MinSampleValue",e[e.Model=272]="Model",e[e.Orientation=274]="Orientation",e[e.ResolutionUnit=296]="ResolutionUnit",e[e.RowsPerStrip=278]="RowsPerStrip",e[e.SamplesPerPixel=277]="SamplesPerPixel",e[e.Software=305]="Software",e[e.Threshholding=263]="Threshholding",e[e.XResolution=282]="XResolution",e[e.YResolution=283]="YResolution",e[e.BadFaxLines=326]="BadFaxLines",e[e.CleanFaxData=327]="CleanFaxData",e[e.ClipPath=343]="ClipPath",e[e.ConsecutiveBadFaxLines=328]="ConsecutiveBadFaxLines",e[e.Decode=433]="Decode",e[e.DefaultImageColor=434]="DefaultImageColor",e[e.DocumentName=269]="DocumentName",e[e.DotRange=336]="DotRange",e[e.HalftoneHints=321]="HalftoneHints",e[e.Indexed=346]="Indexed",e[e.PageName=285]="PageName",e[e.PageNumber=297]="PageNumber",e[e.Predictor=317]="Predictor",e[e.PrimaryChromaticities=319]="PrimaryChromaticities",e[e.ReferenceBlackWhite=532]="ReferenceBlackWhite",e[e.SMinSampleValue=340]="SMinSampleValue",e[e.SMaxSampleValue=341]="SMaxSampleValue",e[e.StripRowCounts=559]="StripRowCounts",e[e.SubIFDs=330]="SubIFDs",e[e.T4Options=292]="T4Options",e[e.T6Options=293]="T6Options",e[e.TransferFunction=301]="TransferFunction",e[e.WhitePoint=318]="WhitePoint",e[e.XClipPathUnits=344]="XClipPathUnits",e[e.XPosition=286]="XPosition",e[e.YCbCrCoefficients=529]="YCbCrCoefficients",e[e.YCbCrPositioning=531]="YCbCrPositioning",e[e.YCbCrSubSampling=530]="YCbCrSubSampling",e[e.YClipPathUnits=345]="YClipPathUnits",e[e.YPosition=287]="YPosition",e[e.ApertureValue=37378]="ApertureValue",e[e.ColorSpace=40961]="ColorSpace",e[e.DateTimeDigitized=36868]="DateTimeDigitized",e[e.DateTimeOriginal=36867]="DateTimeOriginal",e[e.ExifIFD=34665]="ExifIFD",e[e.ExifVersion=36864]="ExifVersion",e[e.ExposureTime=33434]="ExposureTime",e[e.FileSource=41728]="FileSource",e[e.Flash=37385]="Flash",e[e.FlashpixVersion=40960]="FlashpixVersion",e[e.FNumber=33437]="FNumber",e[e.ImageUniqueID=42016]="ImageUniqueID",e[e.LightSource=37384]="LightSource",e[e.MakerNote=37500]="MakerNote",e[e.ShutterSpeedValue=37377]="ShutterSpeedValue",e[e.UserComment=37510]="UserComment",e[e.IPTC=33723]="IPTC",e[e.ICCProfile=34675]="ICCProfile",e[e.XMP=700]="XMP"}(G||(G={})),function(e){e[e.GTModelTypeGeoKey=1024]="GTModelTypeGeoKey",e[e.GTRasterTypeGeoKey=1025]="GTRasterTypeGeoKey",e[e.GTCitationGeoKey=1026]="GTCitationGeoKey",e[e.GeodeticCRSGeoKey=2048]="GeodeticCRSGeoKey",e[e.GeodeticCitationGeoKey=2049]="GeodeticCitationGeoKey",e[e.GeodeticDatumGeoKey=2050]="GeodeticDatumGeoKey",e[e.PrimeMeridianGeoKey=2051]="PrimeMeridianGeoKey",e[e.GeogLinearUnitsGeoKey=2052]="GeogLinearUnitsGeoKey",e[e.GeogLinearUnitSizeGeoKey=2053]="GeogLinearUnitSizeGeoKey",e[e.GeogAngularUnitsGeoKey=2054]="GeogAngularUnitsGeoKey",e[e.GeogAngularUnitSizeGeoKey=2055]="GeogAngularUnitSizeGeoKey",e[e.EllipsoidGeoKey=2056]="EllipsoidGeoKey",e[e.EllipsoidSemiMajorAxisGeoKey=2057]="EllipsoidSemiMajorAxisGeoKey",e[e.EllipsoidSemiMinorAxisGeoKey=2058]="EllipsoidSemiMinorAxisGeoKey",e[e.EllipsoidInvFlatteningGeoKey=2059]="EllipsoidInvFlatteningGeoKey",e[e.PrimeMeridianLongitudeGeoKey=2061]="PrimeMeridianLongitudeGeoKey",e[e.GeogTOWGS84GeoKey=2062]="GeogTOWGS84GeoKey",e[e.GeogAzimuthUnitsGeoKey=2060]="GeogAzimuthUnitsGeoKey",e[e.ProjectedCRSGeoKey=3072]="ProjectedCRSGeoKey",e[e.ProjectedCitationGeoKey=3073]="ProjectedCitationGeoKey",e[e.ProjectionGeoKey=3074]="ProjectionGeoKey",e[e.ProjMethodGeoKey=3075]="ProjMethodGeoKey",e[e.ProjLinearUnitsGeoKey=3076]="ProjLinearUnitsGeoKey",e[e.ProjLinearUnitSizeGeoKey=3077]="ProjLinearUnitSizeGeoKey",e[e.ProjStdParallel1GeoKey=3078]="ProjStdParallel1GeoKey",e[e.ProjStdParallel2GeoKey=3079]="ProjStdParallel2GeoKey",e[e.ProjNatOriginLongGeoKey=3080]="ProjNatOriginLongGeoKey",e[e.ProjNatOriginLatGeoKey=3081]="ProjNatOriginLatGeoKey",e[e.ProjFalseEastingGeoKey=3082]="ProjFalseEastingGeoKey",e[e.ProjFalseNorthingGeoKey=3083]="ProjFalseNorthingGeoKey",e[e.ProjFalseOriginLongGeoKey=3084]="ProjFalseOriginLongGeoKey",e[e.ProjFalseOriginLatGeoKey=3085]="ProjFalseOriginLatGeoKey",e[e.ProjFalseOriginEastingGeoKey=3086]="ProjFalseOriginEastingGeoKey",e[e.ProjFalseOriginNorthingGeoKey=3087]="ProjFalseOriginNorthingGeoKey",e[e.ProjCenterLongGeoKey=3088]="ProjCenterLongGeoKey",e[e.ProjCenterLatGeoKey=3089]="ProjCenterLatGeoKey",e[e.ProjCenterEastingGeoKey=3090]="ProjCenterEastingGeoKey",e[e.ProjCenterNorthingGeoKey=3091]="ProjCenterNorthingGeoKey",e[e.ProjScaleAtNatOriginGeoKey=3092]="ProjScaleAtNatOriginGeoKey",e[e.ProjScaleAtCenterGeoKey=3093]="ProjScaleAtCenterGeoKey",e[e.ProjAzimuthAngleGeoKey=3094]="ProjAzimuthAngleGeoKey",e[e.ProjStraightVertPoleLongGeoKey=3095]="ProjStraightVertPoleLongGeoKey",e[e.ProjRectifiedGridAngleGeoKey=3096]="ProjRectifiedGridAngleGeoKey",e[e.VerticalGeoKey=4096]="VerticalGeoKey",e[e.VerticalCitationGeoKey=4097]="VerticalCitationGeoKey",e[e.VerticalDatumGeoKey=4098]="VerticalDatumGeoKey",e[e.VerticalUnitsGeoKey=4099]="VerticalUnitsGeoKey"}(U||(U={})),function(e){e[e.Radian=9101]="Radian",e[e.Degree=9102]="Degree",e[e.ArcMinute=9103]="ArcMinute",e[e.ArcDegree=9104]="ArcDegree",e[e.Grad=9105]="Grad",e[e.Gon=9106]="Gon",e[e.Dms=9107]="Dms"}(M||(M={})),function(e){e[e.Metre=9001]="Metre",e[e.Foot=9002]="Foot",e[e.FootUsSurvey=9003]="FootUsSurvey",e[e.FootModifiedAmerican=9004]="FootModifiedAmerican",e[e.FootClarke=9005]="FootClarke",e[e.FootIndian=9006]="FootIndian",e[e.Link=9007]="Link",e[e.LinkBenoit=9008]="LinkBenoit",e[e.LinkSears=9009]="LinkSears",e[e.ChainBenoit=9010]="ChainBenoit",e[e.ChainSears=9011]="ChainSears",e[e.YardSears=9012]="YardSears",e[e.YardIndian=9013]="YardIndian",e[e.Fathom=9014]="Fathom",e[e.MileInternationalNautical=9015]="MileInternationalNautical"}(R||(R={}));const F={[G.TileByteCounts]:!0,[G.TileOffsets]:!0,[G.StripOffsets]:!0,[G.StripByteCounts]:!0,[G.BitsPerSample]:!0,[G.SampleFormat]:!0,[G.GeoKeyDirectory]:!0,[G.GeoDoubleParams]:!0};var L;!function(e){e.None="application/octet-stream",e.Jpeg="image/jpeg",e.Jp2000="image/jp2",e.JpegXl="image/jpegxl",e.Webp="image/webp",e.Zstd="application/zstd",e.Lzw="application/lzw",e.Deflate="application/deflate",e.Lerc="application/lerc",e.Lzma="application/x-lzma"}(L||(L={}));const T={[k.None]:L.None,[k.Lzw]:L.Lzw,[k.Jpeg6]:L.Jpeg,[k.Jpeg]:L.Jpeg,[k.DeflateOther]:L.Deflate,[k.Deflate]:L.Deflate,[k.Lerc]:L.Lerc,[k.Lzma]:L.Lzma,[k.Jp2000]:L.Jp2000,[k.Zstd]:L.Zstd,[k.Webp]:L.Webp,[k.JpegXl]:L.JpegXl};var N,P,O,z;function K(e){switch(e){case N.Uint8:case N.Ascii:case N.Int8:case N.Undefined:return 1;case N.Uint16:case N.Int16:return 2;case N.Uint32:case N.Int32:case N.Float32:return 4;case N.Rational:case N.SignedRational:case N.Float64:case N.Uint64:case N.Int64:case N.Ifd8:return 8;default:throw new Error(`Invalid fieldType ${e}`)}}!function(e){e[e.Uint8=1]="Uint8",e[e.Ascii=2]="Ascii",e[e.Uint16=3]="Uint16",e[e.Uint32=4]="Uint32",e[e.Rational=5]="Rational",e[e.Int8=6]="Int8",e[e.Undefined=7]="Undefined",e[e.Int16=8]="Int16",e[e.Int32=9]="Int32",e[e.SignedRational=10]="SignedRational",e[e.Float32=11]="Float32",e[e.Float64=12]="Float64",e[e.Uint64=16]="Uint64",e[e.Int64=17]="Int64",e[e.Ifd8=18]="Ifd8"}(N||(N={})),function(e){e[e.BigTiff=43]="BigTiff",e[e.Tiff=42]="Tiff"}(P||(P={})),function(e){e[e.Double=8]="Double",e[e.Float32=4]="Float32"}(O||(O={})),function(e){e[e.UInt64=8]="UInt64",e[e.UInt32=4]="UInt32",e[e.UInt16=2]="UInt16",e[e.UInt8=1]="UInt8"}(z||(z={}));const H=2**32;function q(e,t,A){const i=e.getUint32(t,A),r=e.getUint32(t+4,A),n=A?i+H*r:H*i+r;if(!Number.isSafeInteger(n))throw new Error(n+" exceeds MAX_SAFE_INTEGER. Precision may is lost");return n}function J(e,t,A,i){switch(A){case z.UInt8:return e.getUint8(t);case z.UInt16:return e.getUint16(t,i);case z.UInt32:return e.getUint32(t,i);case z.UInt64:return q(e,t,i)}}function Y(e,t,A){return!(t<e.sourceOffset)&&!(e.sourceOffset+e.byteLength<t+A)}function V(e,t,A,i){switch(e){case N.Ascii:return String.fromCharCode(t.getUint8(A));case N.Undefined:case N.Uint8:return t.getUint8(A);case N.Int8:return t.getInt8(A);case N.Uint16:return t.getUint16(A,i);case N.Int16:return t.getInt16(A,i);case N.Uint32:return t.getUint32(A,i);case N.Int32:return t.getInt32(A,i);case N.Rational:return[t.getUint32(A,i),t.getUint32(A+4,i)];case N.SignedRational:return[t.getInt32(A,i),t.getInt32(A+4,i)];case N.Float64:return t.getFloat64(A,i);case N.Float32:return t.getFloat32(A,i);case N.Uint64:return q(t,A,i);default:throw new Error(`Unknown read type "${e}" "${N[e]}"`)}}function Z(e,t,A,i,r,n){const a=K(r),s=n*a;if(1===n){const n=V(r,A,i,e.isLittleEndian);return t&&F[t]?[n]:n}if(r===N.Ascii)return String.fromCharCode.apply(null,new Uint8Array(A.buffer,i,s-1));const o=[];for(let t=0;t<s;t+=a)o.push(V(r,A,i+t,e.isLittleEndian));return o}function j(e,t,A){const i=t.getUint16(A+0,e.isLittleEndian),r=t.getUint16(A+2,e.isLittleEndian),n=J(t,A+4,e.ifdConfig.pointer,e.isLittleEndian),a=K(r)*n;if(a<=e.ifdConfig.pointer){const a=Z(e,i,t,A+4+e.ifdConfig.pointer,r,n);return{type:"inline",id:i,name:G[i],count:n,value:a,dataType:r,tagOffset:A}}const s=J(t,A+4+e.ifdConfig.pointer,e.ifdConfig.pointer,e.isLittleEndian);switch(i){case G.TileOffsets:case G.TileByteCounts:case G.StripByteCounts:case G.StripOffsets:const e={type:"offset",id:i,name:G[i],count:n,dataType:r,dataOffset:s,isLoaded:!1,value:[],tagOffset:A};return i===G.TileOffsets&&Y(t,s,a)&&function(e,t){const A=K(e.dataType),i=t.byteOffset+e.dataOffset-t.sourceOffset;e.view=new DataView(t.buffer.slice(i,i+A*e.count)),e.view.sourceOffset=e.dataOffset}(e,t),e}if(Y(t,s,a)){const a=Z(e,i,t,s-t.sourceOffset,r,n);return{type:"inline",id:i,name:G[i],count:n,value:a,dataType:r,tagOffset:A}}return{type:"lazy",id:i,name:G[i],count:n,dataOffset:s,dataType:r,tagOffset:A}}new Set([G.Compression,G.ImageHeight,G.ImageWidth,G.ModelPixelScale,G.ModelTiePoint,G.ModelTransformation,G.TileHeight,G.TileWidth,G.GeoKeyDirectory,G.GeoAsciiParams,G.GeoDoubleParams,G.TileOffsets]);class X{constructor(e,t,A){Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"tiff",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"isGeoTagsLoaded",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"tagsGeo",{enumerable:!0,configurable:!0,writable:!0,value:new Map}),Object.defineProperty(this,"tags",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.tiff=e,this.id=t,this.tags=A}async init(e=!0){const t=[this.fetch(G.Compression),this.fetch(G.ImageHeight),this.fetch(G.ImageWidth),this.fetch(G.ModelPixelScale),this.fetch(G.ModelTiePoint),this.fetch(G.ModelTransformation),this.fetch(G.TileHeight),this.fetch(G.TileWidth)];e&&(t.push(this.fetch(G.GeoKeyDirectory)),t.push(this.fetch(G.GeoAsciiParams)),t.push(this.fetch(G.GeoDoubleParams))),await Promise.all(t),e&&await this.loadGeoTiffTags()}value(e){const t=this.tags.get(e);return null==t||"offset"===t.type&&!1===t.isLoaded?null:t.value}has(e){return this.tags.has(e)}async fetch(e){const t=this.tags.get(e);if(null==t)return null;if("inline"===t.type)return t.value;if("lazy"===t.type)return async function(e,t){if(null!=e.value)return e.value;const A=K(e.dataType)*e.count,i=await t.source.fetch(e.dataOffset,A),r=new DataView(i);return e.value=Z(t,e.id,r,0,e.dataType,e.count),e.value}(t,this.tiff);if(t.isLoaded)return t.value;if("offset"===t.type)return async function(e,t){const A=K(t.dataType);if(null==t.view){const i=await e.source.fetch(t.dataOffset,A*t.count);t.view=new DataView(i),t.view.sourceOffset=t.dataOffset}return t.value=Z(e,t.id,t.view,0,t.dataType,t.count),t.isLoaded=!0,t.value}(this.tiff,t);throw new Error("Cannot fetch:"+e)}valueGeo(e){if(!1===this.isGeoTagsLoaded)throw new Error("loadGeoTiffTags() has not been called");return this.tagsGeo.get(e)}get noData(){const e=this.tags.get(G.GdalNoData);if(null==e)return null;if(e.value)return Number(e.value);throw new Error("GdalNoData tag is not loaded")}async loadGeoTiffTags(){if(this.isGeoTagsLoaded)return;const e=this.tags.get(G.GeoKeyDirectory);if(null==e)return void(this.isGeoTagsLoaded=!0);if("lazy"===e.type&&null==e.value&&await Promise.all([this.fetch(G.GeoKeyDirectory),this.fetch(G.GeoAsciiParams),this.fetch(G.GeoDoubleParams)]),this.isGeoTagsLoaded=!0,null==e.value)return;const t=e.value;if("number"==typeof t)throw new Error("Invalid geo tags found");for(let e=4;e<=4*t[3];e+=4){const A=t[e],i=t[e+1],r=t[e+3];if(0===i){this.tagsGeo.set(A,r);continue}const n=this.tags.get(i);if(null==n||null==n.value)continue;const a=t[e+2];if("string"==typeof n.value)this.tagsGeo.set(A,n.value.slice(r,r+a-1).trim());else{if(!Array.isArray(n.value))throw new Error("Failed to extract GeoTiffTags");1===a?this.tagsGeo.set(A,n.value[r]):this.tagsGeo.set(A,n.value.slice(r,r+a))}}}get origin(){const e=this.value(G.ModelTiePoint);if(null!=e&&6===e.length)return[e[3],e[4],e[5]];const t=this.value(G.ModelTransformation);if(null!=t)return[t[3],t[7],t[11]];if(this.value(G.SubFileType)===p.ReducedImage&&0!==this.id)return this.tiff.images[0].origin;throw new Error("Image does not have a geo transformation.")}get isGeoLocated(){return!(null==this.value(G.ModelPixelScale)&&null==this.value(G.ModelTransformation))||!(!this.isSubImage||0===this.id)&&this.tiff.images[0].isGeoLocated}get resolution(){const e=this.value(G.ModelPixelScale);if(null!=e)return[e[0],-e[1],e[2]];const t=this.value(G.ModelTransformation);if(null!=t)return[t[0],t[5],t[10]];if(this.isSubImage&&0!==this.id){const e=this.tiff.images[0],[t,A,i]=e.resolution,r=e.size,n=this.size;return[t*r.width/n.width,A*r.height/n.height,i]}throw new Error("Image does not have a geo transformation.")}get isSubImage(){return this.value(G.SubFileType)===p.ReducedImage}get bbox(){const e=this.size,t=this.origin,A=this.resolution;if(null==t||null==e||null==A)throw new Error("Unable to calculate bounding box");const i=t[0],r=t[1],n=i+A[0]*e.width,a=r+A[1]*e.height;return[Math.min(i,n),Math.min(r,a),Math.max(i,n),Math.max(r,a)]}get compression(){const e=this.value(G.Compression);return null==e?null:T[e]}get epsg(){const e=this.valueGeo(U.ProjectionGeoKey);if(null!=e&&32767!==e)return e;let t=null;switch(this.valueGeo(U.GTModelTypeGeoKey)){case b.Unknown:return null;case b.Projected:t=this.valueGeo(U.ProjectedCRSGeoKey);break;case b.Geographic:case b.Geocentric:t=this.valueGeo(U.GeodeticCRSGeoKey);break;case b.UserDefined:return null}return 32767===t?null:t}get size(){const e=this.value(G.ImageWidth),t=this.value(G.ImageHeight);if(null==e||null==t)throw new Error("Tiff has no height or width");return{width:e,height:t}}isTiled(){return null!==this.value(G.TileWidth)}get tileSize(){const e=this.value(G.TileWidth),t=this.value(G.TileHeight);if(null==e||null==t)throw new Error("Tiff is not tiled");return{width:e,height:t}}get tileCount(){const e=this.size,t=this.tileSize;return{x:Math.ceil(e.width/t.width),y:Math.ceil(e.height/t.height)}}get tileOffset(){const e=this.tags.get(G.TileOffsets);if(null==e)throw new Error("No tile offsets found");return e}get stripCount(){return this.tags.get(G.StripByteCounts)?.count??0}getTileBounds(e,t){const{size:A,tileSize:i}=this,r=t*i.height,n=e*i.width;return{x:n,y:r,width:n+i.width>=A.width?A.width-n:i.width,height:r+i.height>=A.height?A.height-r:i.height}}async getStrip(e){if(this.isTiled())throw new Error("Cannot read stripes, tiff is tiled: "+e);const t=this.tags.get(G.StripByteCounts),A=this.tags.get(G.StripOffsets);if(e>=t.count)throw new Error("Cannot read strip, index out of bounds");const[i,r]=await Promise.all([W(this.tiff,A,e),W(this.tiff,t,e)]);return this.getBytes(i,r)}getJpegHeader(e){const t=this.value(G.JpegTables);if(null==t)throw new Error("Unable to find Jpeg header");const A=t.slice(0,t.length-2),i=new Uint8Array(e.byteLength+A.length-2);return i.set(A,0),i.set(new Uint8Array(e).slice(2),A.length),i}async getBytes(e,t){if(0===t)return null;const A=await this.tiff.source.fetch(e,t);if(A.byteLength<t)throw new Error(`Failed to fetch bytes from offset:${e} wanted:${t} got:${A.byteLength}`);let i=this.value(G.Compression);null==i&&(i=k.None);const r=(null==(n=i)?null:T[n])??L.None;var n;return i===k.Jpeg?{mimeType:r,bytes:this.getJpegHeader(A),compression:i}:{mimeType:r,bytes:A,compression:i}}async getTile(e,t){const A=this.size,i=this.tileSize;if(null==i)throw new Error("Tiff is not tiled");const r=Math.ceil(A.height/i.height),n=Math.ceil(A.width/i.width);if(e>=n||t>=r)throw new Error(`Tile index is outside of range x:${e} >= ${n} or y:${t} >= ${r}`);const a=t*n+e,s=n*r;if(a>=s)throw new Error(`Tile index is outside of tile range: ${a} >= ${s}`);const{offset:o,imageSize:l}=await this.getTileSize(a);return this.getBytes(o,l)}async hasTile(e,t){const A=this.tileSize,i=this.size;if(null==A)throw new Error("Tiff is not tiled");const r=Math.ceil(i.height/A.height),n=Math.ceil(i.width/A.width);if(e>=n||t>=r)return!1;const a=t*n+e;return(await this.getTileSize(a)).offset>0}async getTileSize(e){const t=this.tiff.options?.tileLeaderByteSize;if(t){const A=await W(this.tiff,this.tileOffset,e);if(0===A)return{offset:0,imageSize:0};const i=await this.tiff.source.fetch(A-t,t);return{offset:A,imageSize:J(new DataView(i),0,t,this.tiff.isLittleEndian)}}const A=this.tags.get(G.TileByteCounts);if(null==A)throw new Error("No tile byte counts found");const[i,r]=await Promise.all([W(this.tiff,this.tileOffset,e),W(this.tiff,A,e)]);return{offset:i,imageSize:r}}}function W(e,t,A){if(A<0)throw new Error(`Tiff: ${e.source.url.href} out of bounds ${G[t.id]} index:${A} total:${t.count}`);return A>=t.count?0:"inline"===t.type?t.value[A]:async function(e,t,A){if(A>t.count||A<0)throw new Error("TagOffset: out of bounds :"+A);if(null!=t.value[A])return t.value[A];const i=K(t.dataType);if(null==t.view){const r=await e.source.fetch(t.dataOffset+A*i,i),n=Z(e,void 0,new DataView(r),0,t.dataType,1);return t.value[A]=n,n}const r=Z(e,void 0,t.view,A*i,t.dataType,1);return t.value[A]=r,r}(e,t,A)}var $,ee,te;!function(e){e.GdalStructuralMetadataSize="GDAL_STRUCTURAL_METADATA_SIZE",e.Layout="LAYOUT",e.BlockOrder="BLOCK_ORDER",e.BlockLeader="BLOCK_LEADER",e.BlockTrailer="BLOCK_TRAILER",e.KnownIncompatibleEdition="KNOWN_INCOMPATIBLE_EDITION",e.MaskInterleavedWithImagery="MASK_INTERLEAVED_WITH_IMAGERY"}($||($={})),function(e){e.RowMajor="ROW_MAJOR"}(ee||(ee={})),function(e){e.uint32="SIZE_AS_UINT4"}(te||(te={}));class Ae{constructor(){Object.defineProperty(this,"options",{enumerable:!0,configurable:!0,writable:!0,value:new Map})}get isCogOptimized(){return!this.isBroken&&"IFDS_BEFORE_DATA"===this.options.get($.Layout)}get isBroken(){return"YES"===this.options.get($.KnownIncompatibleEdition)}process(e,t,A){let i="",r="",n=!1;for(let a=0;a<A;a++){const A=e.getUint8(t+a);if(0===A)break;const s=String.fromCharCode(A);"\n"===s?(this.options.set(i.trim(),r.trim()),i="",r="",n=!1):"="===s?n=!0:n?r+=s:i+=s}}get tileLeaderByteSize(){return this.options.get($.BlockLeader)===te.uint32?z.UInt32:null}get isMaskInterleaved(){return"YES"===this.options.get($.MaskInterleavedWithImagery)}}const ie={version:P.Tiff,pointer:z.UInt32,offset:z.UInt16,ifd:z.UInt16+z.UInt16+2*z.UInt32},re={version:P.BigTiff,pointer:z.UInt64,offset:z.UInt64,ifd:z.UInt16+z.UInt16+2*z.UInt64};P.BigTiff,P.Tiff;class ne{constructor(e){Object.defineProperty(this,"defaultReadSize",{enumerable:!0,configurable:!0,writable:!0,value:ne.DefaultReadSize}),Object.defineProperty(this,"source",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:P.Tiff}),Object.defineProperty(this,"images",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"options",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"ifdConfig",{enumerable:!0,configurable:!0,writable:!0,value:ie}),Object.defineProperty(this,"isLittleEndian",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"isInitialized",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_initPromise",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.source=e}static create(e){return new ne(e).init()}init(){return this._initPromise||(this._initPromise=this.readHeader()),this._initPromise}getImageByResolution(e){const t=this.images[0],A=t.size,[i]=t.resolution,r=i*A.width;for(let t=this.images.length-1;t>0;t--){const A=this.images[t];if(r/A.size.width-e<=.01)return A}return t}async readHeader(){if(this.isInitialized)return this;const e=new DataView(await this.source.fetch(0,ae(this.source,0,this.defaultReadSize)));e.sourceOffset=0;let t=0;const A=e.getUint16(t,this.isLittleEndian);if(t+=2,this.isLittleEndian=A===m.Little,!this.isLittleEndian)throw new Error("Only little endian is supported");let i;if(this.version=e.getUint16(t,this.isLittleEndian),t+=2,this.version===P.BigTiff){this.ifdConfig=re;const A=e.getUint16(t,this.isLittleEndian);if(t+=2,8!==A)throw new Error("Only 8byte pointers are supported");const r=e.getUint16(t,this.isLittleEndian);if(t+=2,0!==r)throw new Error("Invalid big tiff header");i=J(e,t,this.ifdConfig.pointer,this.isLittleEndian),t+=this.ifdConfig.pointer}else{if(this.version!==P.Tiff)throw new Error(`Only tiff supported version:${this.version}`);i=J(e,t,this.ifdConfig.pointer,this.isLittleEndian),t+=this.ifdConfig.pointer}const r=i-t;for(r>0&&r<16384&&(this.options=new Ae,this.options.process(e,t,r));0!==i;){let t=e;if(!Y(t,i,1024)){const e=await this.source.fetch(i,ae(this.source,i,this.defaultReadSize));t=new DataView(e),t.sourceOffset=i}i=await this.readIfd(i,t)}return await Promise.all(this.images.map((e=>e.init()))),this.isInitialized=!0,this}async readIfd(e,t){const A=e-t.sourceOffset,i=J(t,A,this.ifdConfig.offset,this.isLittleEndian),r=new Map;if(!Y(t,e,i*this.ifdConfig.ifd))throw new Error("IFD out of range @ "+function(e,t=4,A=!0){const i=e.toString(16).padStart(t,"0");return A?"0x"+i:i}(e)+" IFD"+this.images.length);const n=this.ifdConfig.ifd,a=A+this.ifdConfig.offset;for(let e=0;e<i;e++){const A=j(this,t,a+e*n);r.set(A.id,A)}return this.images.push(new X(this,this.images.length,r)),J(t,a+i*n,this.ifdConfig.pointer,this.isLittleEndian)}}function ae(e,t,A){if(null==e.metadata?.size)return A;const i=e.metadata.size;return t+A>i?i-t:A}Object.defineProperty(ne,"DefaultReadSize",{enumerable:!0,configurable:!0,writable:!0,value:16384});class se extends Error{code;url;source;constructor(e,t,A,i){super(e,{cause:i}),this.code=t,this.url=A.url,this.source=A,Object.defineProperty(this,"_sourceError",{enumerable:!1,value:"SourceError"})}static is(e){return e instanceof se||"object"==typeof e&&(null!=e&&("_sourceError"in e&&"SourceError"===e._sourceError))}}const oe={toRange(e,t){if(null==t)return`bytes=${e}`;if(e<0)throw new Error("Cannot read from remote source with negative offset and length");return`bytes=${e}-${e+t-1}`},parseSize(e){const[t,A]=e.split(" ");if("bytes"!==t)throw new Error("Failed to parse content-range: "+e);if(null==A)throw new Error("Failed to parse content-range: "+e);const[,i]=A.split("/"),r=Number(i);if(isNaN(r))throw new Error("Failed to parse content-range: "+e);return r}};function le(e){const t={size:-1},A=e.headers.get("content-range");return null!=A&&(t.size=oe.parseSize(A)),t.eTag=e.headers.get("etag")??void 0,t.contentType=e.headers.get("content-type")??void 0,t.contentDisposition=e.headers.get("content-disposition")??void 0,t}class ge{constructor(e,t){this.type="http",this.url="string"==typeof e?ge.tryUrl(e):e,this.headers=t}static tryUrl(e){try{return new URL(e)}catch(t){return"undefined"!=typeof document?new URL(e,document.baseURI):new URL(e,"undefined"==typeof document?require("url").pathToFileURL(__filename).href:document.currentScript&&document.currentScript.src||new URL("index.min.js",document.baseURI).href)}}head(){return this._head||(this._head=ge.fetch(this.url,{method:"HEAD",headers:this.headers}).then((e=>{if(!e.ok)throw delete this._head,new Error(`Failed to HEAD ${this.url}`,{cause:{statusCode:e.status,msg:e.statusText}});return this.metadata=le(e),this.metadata}))),this._head}async fetch(e,t){try{const A={range:oe.toRange(e,t),...this.headers},i=await ge.fetch(this.url,{headers:A});if(!i.ok)throw new se(`Failed to fetch ${this.url} ${A.range}`,i.status,this,new Error(i.statusText));const r=le(i);if(null==this.metadata)this.metadata=r;else if(this.metadata.eTag&&this.metadata.eTag!==r.eTag)throw new se(`ETag conflict ${this.url} ${A.range} expected: ${this.metadata.eTag} got: ${r.eTag}`,409,this);return i.arrayBuffer()}catch(e){if(se.is(e)&&e.source===this)throw e;throw new se(`Failed to fetch: ${this.url}`,500,this,e)}}}ge.fetch=(e,t)=>fetch(e,t)
2
- /*! pako 2.1.0 https://github.com/nodeca/pako @license (MIT AND Zlib) */;function he(e){let t=e.length;for(;--t>=0;)e[t]=0}const ce=256,fe=286,de=30,ue=15,Ie=new Uint8Array([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]),Be=new Uint8Array([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]),Ce=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),Ee=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),we=new Array(576);he(we);const Qe=new Array(60);he(Qe);const me=new Array(512);he(me);const pe=new Array(256);he(pe);const ye=new Array(29);he(ye);const _e=new Array(de);function be(e,t,A,i,r){this.static_tree=e,this.extra_bits=t,this.extra_base=A,this.elems=i,this.max_length=r,this.has_stree=e&&e.length}let De,ke,ve;function xe(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}he(_e);const Se=e=>e<256?me[e]:me[256+(e>>>7)],Ge=(e,t)=>{e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255},Ue=(e,t,A)=>{e.bi_valid>16-A?(e.bi_buf|=t<<e.bi_valid&65535,Ge(e,e.bi_buf),e.bi_buf=t>>16-e.bi_valid,e.bi_valid+=A-16):(e.bi_buf|=t<<e.bi_valid&65535,e.bi_valid+=A)},Me=(e,t,A)=>{Ue(e,A[2*t],A[2*t+1])},Re=(e,t)=>{let A=0;do{A|=1&e,e>>>=1,A<<=1}while(--t>0);return A>>>1},Fe=(e,t,A)=>{const i=new Array(16);let r,n,a=0;for(r=1;r<=ue;r++)a=a+A[r-1]<<1,i[r]=a;for(n=0;n<=t;n++){let t=e[2*n+1];0!==t&&(e[2*n]=Re(i[t]++,t))}},Le=e=>{let t;for(t=0;t<fe;t++)e.dyn_ltree[2*t]=0;for(t=0;t<de;t++)e.dyn_dtree[2*t]=0;for(t=0;t<19;t++)e.bl_tree[2*t]=0;e.dyn_ltree[512]=1,e.opt_len=e.static_len=0,e.sym_next=e.matches=0},Te=e=>{e.bi_valid>8?Ge(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0},Ne=(e,t,A,i)=>{const r=2*t,n=2*A;return e[r]<e[n]||e[r]===e[n]&&i[t]<=i[A]},Pe=(e,t,A)=>{const i=e.heap[A];let r=A<<1;for(;r<=e.heap_len&&(r<e.heap_len&&Ne(t,e.heap[r+1],e.heap[r],e.depth)&&r++,!Ne(t,i,e.heap[r],e.depth));)e.heap[A]=e.heap[r],A=r,r<<=1;e.heap[A]=i},Oe=(e,t,A)=>{let i,r,n,a,s=0;if(0!==e.sym_next)do{i=255&e.pending_buf[e.sym_buf+s++],i+=(255&e.pending_buf[e.sym_buf+s++])<<8,r=e.pending_buf[e.sym_buf+s++],0===i?Me(e,r,t):(n=pe[r],Me(e,n+ce+1,t),a=Ie[n],0!==a&&(r-=ye[n],Ue(e,r,a)),i--,n=Se(i),Me(e,n,A),a=Be[n],0!==a&&(i-=_e[n],Ue(e,i,a)))}while(s<e.sym_next);Me(e,256,t)},ze=(e,t)=>{const A=t.dyn_tree,i=t.stat_desc.static_tree,r=t.stat_desc.has_stree,n=t.stat_desc.elems;let a,s,o,l=-1;for(e.heap_len=0,e.heap_max=573,a=0;a<n;a++)0!==A[2*a]?(e.heap[++e.heap_len]=l=a,e.depth[a]=0):A[2*a+1]=0;for(;e.heap_len<2;)o=e.heap[++e.heap_len]=l<2?++l:0,A[2*o]=1,e.depth[o]=0,e.opt_len--,r&&(e.static_len-=i[2*o+1]);for(t.max_code=l,a=e.heap_len>>1;a>=1;a--)Pe(e,A,a);o=n;do{a=e.heap[1],e.heap[1]=e.heap[e.heap_len--],Pe(e,A,1),s=e.heap[1],e.heap[--e.heap_max]=a,e.heap[--e.heap_max]=s,A[2*o]=A[2*a]+A[2*s],e.depth[o]=(e.depth[a]>=e.depth[s]?e.depth[a]:e.depth[s])+1,A[2*a+1]=A[2*s+1]=o,e.heap[1]=o++,Pe(e,A,1)}while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],((e,t)=>{const A=t.dyn_tree,i=t.max_code,r=t.stat_desc.static_tree,n=t.stat_desc.has_stree,a=t.stat_desc.extra_bits,s=t.stat_desc.extra_base,o=t.stat_desc.max_length;let l,g,h,c,f,d,u=0;for(c=0;c<=ue;c++)e.bl_count[c]=0;for(A[2*e.heap[e.heap_max]+1]=0,l=e.heap_max+1;l<573;l++)g=e.heap[l],c=A[2*A[2*g+1]+1]+1,c>o&&(c=o,u++),A[2*g+1]=c,g>i||(e.bl_count[c]++,f=0,g>=s&&(f=a[g-s]),d=A[2*g],e.opt_len+=d*(c+f),n&&(e.static_len+=d*(r[2*g+1]+f)));if(0!==u){do{for(c=o-1;0===e.bl_count[c];)c--;e.bl_count[c]--,e.bl_count[c+1]+=2,e.bl_count[o]--,u-=2}while(u>0);for(c=o;0!==c;c--)for(g=e.bl_count[c];0!==g;)h=e.heap[--l],h>i||(A[2*h+1]!==c&&(e.opt_len+=(c-A[2*h+1])*A[2*h],A[2*h+1]=c),g--)}})(e,t),Fe(A,l,e.bl_count)},Ke=(e,t,A)=>{let i,r,n=-1,a=t[1],s=0,o=7,l=4;for(0===a&&(o=138,l=3),t[2*(A+1)+1]=65535,i=0;i<=A;i++)r=a,a=t[2*(i+1)+1],++s<o&&r===a||(s<l?e.bl_tree[2*r]+=s:0!==r?(r!==n&&e.bl_tree[2*r]++,e.bl_tree[32]++):s<=10?e.bl_tree[34]++:e.bl_tree[36]++,s=0,n=r,0===a?(o=138,l=3):r===a?(o=6,l=3):(o=7,l=4))},He=(e,t,A)=>{let i,r,n=-1,a=t[1],s=0,o=7,l=4;for(0===a&&(o=138,l=3),i=0;i<=A;i++)if(r=a,a=t[2*(i+1)+1],!(++s<o&&r===a)){if(s<l)do{Me(e,r,e.bl_tree)}while(0!=--s);else 0!==r?(r!==n&&(Me(e,r,e.bl_tree),s--),Me(e,16,e.bl_tree),Ue(e,s-3,2)):s<=10?(Me(e,17,e.bl_tree),Ue(e,s-3,3)):(Me(e,18,e.bl_tree),Ue(e,s-11,7));s=0,n=r,0===a?(o=138,l=3):r===a?(o=6,l=3):(o=7,l=4)}};let qe=!1;const Je=(e,t,A,i)=>{Ue(e,0+(i?1:0),3),Te(e),Ge(e,A),Ge(e,~A),A&&e.pending_buf.set(e.window.subarray(t,t+A),e.pending),e.pending+=A};var Ye=(e,t,A,i)=>{let r,n,a=0;e.level>0?(2===e.strm.data_type&&(e.strm.data_type=(e=>{let t,A=4093624447;for(t=0;t<=31;t++,A>>>=1)if(1&A&&0!==e.dyn_ltree[2*t])return 0;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return 1;for(t=32;t<ce;t++)if(0!==e.dyn_ltree[2*t])return 1;return 0})(e)),ze(e,e.l_desc),ze(e,e.d_desc),a=(e=>{let t;for(Ke(e,e.dyn_ltree,e.l_desc.max_code),Ke(e,e.dyn_dtree,e.d_desc.max_code),ze(e,e.bl_desc),t=18;t>=3&&0===e.bl_tree[2*Ee[t]+1];t--);return e.opt_len+=3*(t+1)+5+5+4,t})(e),r=e.opt_len+3+7>>>3,n=e.static_len+3+7>>>3,n<=r&&(r=n)):r=n=A+5,A+4<=r&&-1!==t?Je(e,t,A,i):4===e.strategy||n===r?(Ue(e,2+(i?1:0),3),Oe(e,we,Qe)):(Ue(e,4+(i?1:0),3),((e,t,A,i)=>{let r;for(Ue(e,t-257,5),Ue(e,A-1,5),Ue(e,i-4,4),r=0;r<i;r++)Ue(e,e.bl_tree[2*Ee[r]+1],3);He(e,e.dyn_ltree,t-1),He(e,e.dyn_dtree,A-1)})(e,e.l_desc.max_code+1,e.d_desc.max_code+1,a+1),Oe(e,e.dyn_ltree,e.dyn_dtree)),Le(e),i&&Te(e)},Ve={_tr_init:e=>{qe||((()=>{let e,t,A,i,r;const n=new Array(16);for(A=0,i=0;i<28;i++)for(ye[i]=A,e=0;e<1<<Ie[i];e++)pe[A++]=i;for(pe[A-1]=i,r=0,i=0;i<16;i++)for(_e[i]=r,e=0;e<1<<Be[i];e++)me[r++]=i;for(r>>=7;i<de;i++)for(_e[i]=r<<7,e=0;e<1<<Be[i]-7;e++)me[256+r++]=i;for(t=0;t<=ue;t++)n[t]=0;for(e=0;e<=143;)we[2*e+1]=8,e++,n[8]++;for(;e<=255;)we[2*e+1]=9,e++,n[9]++;for(;e<=279;)we[2*e+1]=7,e++,n[7]++;for(;e<=287;)we[2*e+1]=8,e++,n[8]++;for(Fe(we,287,n),e=0;e<de;e++)Qe[2*e+1]=5,Qe[2*e]=Re(e,5);De=new be(we,Ie,257,fe,ue),ke=new be(Qe,Be,0,de,ue),ve=new be(new Array(0),Ce,0,19,7)})(),qe=!0),e.l_desc=new xe(e.dyn_ltree,De),e.d_desc=new xe(e.dyn_dtree,ke),e.bl_desc=new xe(e.bl_tree,ve),e.bi_buf=0,e.bi_valid=0,Le(e)},_tr_stored_block:Je,_tr_flush_block:Ye,_tr_tally:(e,t,A)=>(e.pending_buf[e.sym_buf+e.sym_next++]=t,e.pending_buf[e.sym_buf+e.sym_next++]=t>>8,e.pending_buf[e.sym_buf+e.sym_next++]=A,0===t?e.dyn_ltree[2*A]++:(e.matches++,t--,e.dyn_ltree[2*(pe[A]+ce+1)]++,e.dyn_dtree[2*Se(t)]++),e.sym_next===e.sym_end),_tr_align:e=>{Ue(e,2,3),Me(e,256,we),(e=>{16===e.bi_valid?(Ge(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):e.bi_valid>=8&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)})(e)}};var Ze=(e,t,A,i)=>{let r=65535&e|0,n=e>>>16&65535|0,a=0;for(;0!==A;){a=A>2e3?2e3:A,A-=a;do{r=r+t[i++]|0,n=n+r|0}while(--a);r%=65521,n%=65521}return r|n<<16|0};const je=new Uint32Array((()=>{let e,t=[];for(var A=0;A<256;A++){e=A;for(var i=0;i<8;i++)e=1&e?3988292384^e>>>1:e>>>1;t[A]=e}return t})());var Xe=(e,t,A,i)=>{const r=je,n=i+A;e^=-1;for(let A=i;A<n;A++)e=e>>>8^r[255&(e^t[A])];return-1^e},We={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},$e={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8};const{_tr_init:et,_tr_stored_block:tt,_tr_flush_block:At,_tr_tally:it,_tr_align:rt}=Ve,{Z_NO_FLUSH:nt,Z_PARTIAL_FLUSH:at,Z_FULL_FLUSH:st,Z_FINISH:ot,Z_BLOCK:lt,Z_OK:gt,Z_STREAM_END:ht,Z_STREAM_ERROR:ct,Z_DATA_ERROR:ft,Z_BUF_ERROR:dt,Z_DEFAULT_COMPRESSION:ut,Z_FILTERED:It,Z_HUFFMAN_ONLY:Bt,Z_RLE:Ct,Z_FIXED:Et,Z_DEFAULT_STRATEGY:wt,Z_UNKNOWN:Qt,Z_DEFLATED:mt}=$e,pt=258,yt=262,_t=42,bt=113,Dt=666,kt=(e,t)=>(e.msg=We[t],t),vt=e=>2*e-(e>4?9:0),xt=e=>{let t=e.length;for(;--t>=0;)e[t]=0},St=e=>{let t,A,i,r=e.w_size;t=e.hash_size,i=t;do{A=e.head[--i],e.head[i]=A>=r?A-r:0}while(--t);t=r,i=t;do{A=e.prev[--i],e.prev[i]=A>=r?A-r:0}while(--t)};let Gt=(e,t,A)=>(t<<e.hash_shift^A)&e.hash_mask;const Ut=e=>{const t=e.state;let A=t.pending;A>e.avail_out&&(A=e.avail_out),0!==A&&(e.output.set(t.pending_buf.subarray(t.pending_out,t.pending_out+A),e.next_out),e.next_out+=A,t.pending_out+=A,e.total_out+=A,e.avail_out-=A,t.pending-=A,0===t.pending&&(t.pending_out=0))},Mt=(e,t)=>{At(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,Ut(e.strm)},Rt=(e,t)=>{e.pending_buf[e.pending++]=t},Ft=(e,t)=>{e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t},Lt=(e,t,A,i)=>{let r=e.avail_in;return r>i&&(r=i),0===r?0:(e.avail_in-=r,t.set(e.input.subarray(e.next_in,e.next_in+r),A),1===e.state.wrap?e.adler=Ze(e.adler,t,r,A):2===e.state.wrap&&(e.adler=Xe(e.adler,t,r,A)),e.next_in+=r,e.total_in+=r,r)},Tt=(e,t)=>{let A,i,r=e.max_chain_length,n=e.strstart,a=e.prev_length,s=e.nice_match;const o=e.strstart>e.w_size-yt?e.strstart-(e.w_size-yt):0,l=e.window,g=e.w_mask,h=e.prev,c=e.strstart+pt;let f=l[n+a-1],d=l[n+a];e.prev_length>=e.good_match&&(r>>=2),s>e.lookahead&&(s=e.lookahead);do{if(A=t,l[A+a]===d&&l[A+a-1]===f&&l[A]===l[n]&&l[++A]===l[n+1]){n+=2,A++;do{}while(l[++n]===l[++A]&&l[++n]===l[++A]&&l[++n]===l[++A]&&l[++n]===l[++A]&&l[++n]===l[++A]&&l[++n]===l[++A]&&l[++n]===l[++A]&&l[++n]===l[++A]&&n<c);if(i=pt-(c-n),n=c-pt,i>a){if(e.match_start=t,a=i,i>=s)break;f=l[n+a-1],d=l[n+a]}}}while((t=h[t&g])>o&&0!=--r);return a<=e.lookahead?a:e.lookahead},Nt=e=>{const t=e.w_size;let A,i,r;do{if(i=e.window_size-e.lookahead-e.strstart,e.strstart>=t+(t-yt)&&(e.window.set(e.window.subarray(t,t+t-i),0),e.match_start-=t,e.strstart-=t,e.block_start-=t,e.insert>e.strstart&&(e.insert=e.strstart),St(e),i+=t),0===e.strm.avail_in)break;if(A=Lt(e.strm,e.window,e.strstart+e.lookahead,i),e.lookahead+=A,e.lookahead+e.insert>=3)for(r=e.strstart-e.insert,e.ins_h=e.window[r],e.ins_h=Gt(e,e.ins_h,e.window[r+1]);e.insert&&(e.ins_h=Gt(e,e.ins_h,e.window[r+3-1]),e.prev[r&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=r,r++,e.insert--,!(e.lookahead+e.insert<3)););}while(e.lookahead<yt&&0!==e.strm.avail_in)},Pt=(e,t)=>{let A,i,r,n=e.pending_buf_size-5>e.w_size?e.w_size:e.pending_buf_size-5,a=0,s=e.strm.avail_in;do{if(A=65535,r=e.bi_valid+42>>3,e.strm.avail_out<r)break;if(r=e.strm.avail_out-r,i=e.strstart-e.block_start,A>i+e.strm.avail_in&&(A=i+e.strm.avail_in),A>r&&(A=r),A<n&&(0===A&&t!==ot||t===nt||A!==i+e.strm.avail_in))break;a=t===ot&&A===i+e.strm.avail_in?1:0,tt(e,0,0,a),e.pending_buf[e.pending-4]=A,e.pending_buf[e.pending-3]=A>>8,e.pending_buf[e.pending-2]=~A,e.pending_buf[e.pending-1]=~A>>8,Ut(e.strm),i&&(i>A&&(i=A),e.strm.output.set(e.window.subarray(e.block_start,e.block_start+i),e.strm.next_out),e.strm.next_out+=i,e.strm.avail_out-=i,e.strm.total_out+=i,e.block_start+=i,A-=i),A&&(Lt(e.strm,e.strm.output,e.strm.next_out,A),e.strm.next_out+=A,e.strm.avail_out-=A,e.strm.total_out+=A)}while(0===a);return s-=e.strm.avail_in,s&&(s>=e.w_size?(e.matches=2,e.window.set(e.strm.input.subarray(e.strm.next_in-e.w_size,e.strm.next_in),0),e.strstart=e.w_size,e.insert=e.strstart):(e.window_size-e.strstart<=s&&(e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,e.insert>e.strstart&&(e.insert=e.strstart)),e.window.set(e.strm.input.subarray(e.strm.next_in-s,e.strm.next_in),e.strstart),e.strstart+=s,e.insert+=s>e.w_size-e.insert?e.w_size-e.insert:s),e.block_start=e.strstart),e.high_water<e.strstart&&(e.high_water=e.strstart),a?4:t!==nt&&t!==ot&&0===e.strm.avail_in&&e.strstart===e.block_start?2:(r=e.window_size-e.strstart,e.strm.avail_in>r&&e.block_start>=e.w_size&&(e.block_start-=e.w_size,e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,r+=e.w_size,e.insert>e.strstart&&(e.insert=e.strstart)),r>e.strm.avail_in&&(r=e.strm.avail_in),r&&(Lt(e.strm,e.window,e.strstart,r),e.strstart+=r,e.insert+=r>e.w_size-e.insert?e.w_size-e.insert:r),e.high_water<e.strstart&&(e.high_water=e.strstart),r=e.bi_valid+42>>3,r=e.pending_buf_size-r>65535?65535:e.pending_buf_size-r,n=r>e.w_size?e.w_size:r,i=e.strstart-e.block_start,(i>=n||(i||t===ot)&&t!==nt&&0===e.strm.avail_in&&i<=r)&&(A=i>r?r:i,a=t===ot&&0===e.strm.avail_in&&A===i?1:0,tt(e,e.block_start,A,a),e.block_start+=A,Ut(e.strm)),a?3:1)},Ot=(e,t)=>{let A,i;for(;;){if(e.lookahead<yt){if(Nt(e),e.lookahead<yt&&t===nt)return 1;if(0===e.lookahead)break}if(A=0,e.lookahead>=3&&(e.ins_h=Gt(e,e.ins_h,e.window[e.strstart+3-1]),A=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),0!==A&&e.strstart-A<=e.w_size-yt&&(e.match_length=Tt(e,A)),e.match_length>=3)if(i=it(e,e.strstart-e.match_start,e.match_length-3),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=3){e.match_length--;do{e.strstart++,e.ins_h=Gt(e,e.ins_h,e.window[e.strstart+3-1]),A=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart}while(0!=--e.match_length);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.ins_h=e.window[e.strstart],e.ins_h=Gt(e,e.ins_h,e.window[e.strstart+1]);else i=it(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(i&&(Mt(e,!1),0===e.strm.avail_out))return 1}return e.insert=e.strstart<2?e.strstart:2,t===ot?(Mt(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(Mt(e,!1),0===e.strm.avail_out)?1:2},zt=(e,t)=>{let A,i,r;for(;;){if(e.lookahead<yt){if(Nt(e),e.lookahead<yt&&t===nt)return 1;if(0===e.lookahead)break}if(A=0,e.lookahead>=3&&(e.ins_h=Gt(e,e.ins_h,e.window[e.strstart+3-1]),A=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=2,0!==A&&e.prev_length<e.max_lazy_match&&e.strstart-A<=e.w_size-yt&&(e.match_length=Tt(e,A),e.match_length<=5&&(e.strategy===It||3===e.match_length&&e.strstart-e.match_start>4096)&&(e.match_length=2)),e.prev_length>=3&&e.match_length<=e.prev_length){r=e.strstart+e.lookahead-3,i=it(e,e.strstart-1-e.prev_match,e.prev_length-3),e.lookahead-=e.prev_length-1,e.prev_length-=2;do{++e.strstart<=r&&(e.ins_h=Gt(e,e.ins_h,e.window[e.strstart+3-1]),A=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart)}while(0!=--e.prev_length);if(e.match_available=0,e.match_length=2,e.strstart++,i&&(Mt(e,!1),0===e.strm.avail_out))return 1}else if(e.match_available){if(i=it(e,0,e.window[e.strstart-1]),i&&Mt(e,!1),e.strstart++,e.lookahead--,0===e.strm.avail_out)return 1}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(i=it(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<2?e.strstart:2,t===ot?(Mt(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(Mt(e,!1),0===e.strm.avail_out)?1:2};function Kt(e,t,A,i,r){this.good_length=e,this.max_lazy=t,this.nice_length=A,this.max_chain=i,this.func=r}const Ht=[new Kt(0,0,0,0,Pt),new Kt(4,4,8,4,Ot),new Kt(4,5,16,8,Ot),new Kt(4,6,32,32,Ot),new Kt(4,4,16,16,zt),new Kt(8,16,32,32,zt),new Kt(8,16,128,128,zt),new Kt(8,32,128,256,zt),new Kt(32,128,258,1024,zt),new Kt(32,258,258,4096,zt)];function qt(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=mt,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(1146),this.dyn_dtree=new Uint16Array(122),this.bl_tree=new Uint16Array(78),xt(this.dyn_ltree),xt(this.dyn_dtree),xt(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(16),this.heap=new Uint16Array(573),xt(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(573),xt(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}const Jt=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||t.status!==_t&&57!==t.status&&69!==t.status&&73!==t.status&&91!==t.status&&103!==t.status&&t.status!==bt&&t.status!==Dt?1:0},Yt=e=>{if(Jt(e))return kt(e,ct);e.total_in=e.total_out=0,e.data_type=Qt;const t=e.state;return t.pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=2===t.wrap?57:t.wrap?_t:bt,e.adler=2===t.wrap?0:1,t.last_flush=-2,et(t),gt},Vt=e=>{const t=Yt(e);var A;return t===gt&&((A=e.state).window_size=2*A.w_size,xt(A.head),A.max_lazy_match=Ht[A.level].max_lazy,A.good_match=Ht[A.level].good_length,A.nice_match=Ht[A.level].nice_length,A.max_chain_length=Ht[A.level].max_chain,A.strstart=0,A.block_start=0,A.lookahead=0,A.insert=0,A.match_length=A.prev_length=2,A.match_available=0,A.ins_h=0),t},Zt=(e,t,A,i,r,n)=>{if(!e)return ct;let a=1;if(t===ut&&(t=6),i<0?(a=0,i=-i):i>15&&(a=2,i-=16),r<1||r>9||A!==mt||i<8||i>15||t<0||t>9||n<0||n>Et||8===i&&1!==a)return kt(e,ct);8===i&&(i=9);const s=new qt;return e.state=s,s.strm=e,s.status=_t,s.wrap=a,s.gzhead=null,s.w_bits=i,s.w_size=1<<s.w_bits,s.w_mask=s.w_size-1,s.hash_bits=r+7,s.hash_size=1<<s.hash_bits,s.hash_mask=s.hash_size-1,s.hash_shift=~~((s.hash_bits+3-1)/3),s.window=new Uint8Array(2*s.w_size),s.head=new Uint16Array(s.hash_size),s.prev=new Uint16Array(s.w_size),s.lit_bufsize=1<<r+6,s.pending_buf_size=4*s.lit_bufsize,s.pending_buf=new Uint8Array(s.pending_buf_size),s.sym_buf=s.lit_bufsize,s.sym_end=3*(s.lit_bufsize-1),s.level=t,s.strategy=n,s.method=A,Vt(e)};var jt={deflateInit:(e,t)=>Zt(e,t,mt,15,8,wt),deflateInit2:Zt,deflateReset:Vt,deflateResetKeep:Yt,deflateSetHeader:(e,t)=>Jt(e)||2!==e.state.wrap?ct:(e.state.gzhead=t,gt),deflate:(e,t)=>{if(Jt(e)||t>lt||t<0)return e?kt(e,ct):ct;const A=e.state;if(!e.output||0!==e.avail_in&&!e.input||A.status===Dt&&t!==ot)return kt(e,0===e.avail_out?dt:ct);const i=A.last_flush;if(A.last_flush=t,0!==A.pending){if(Ut(e),0===e.avail_out)return A.last_flush=-1,gt}else if(0===e.avail_in&&vt(t)<=vt(i)&&t!==ot)return kt(e,dt);if(A.status===Dt&&0!==e.avail_in)return kt(e,dt);if(A.status===_t&&0===A.wrap&&(A.status=bt),A.status===_t){let t=mt+(A.w_bits-8<<4)<<8,i=-1;if(i=A.strategy>=Bt||A.level<2?0:A.level<6?1:6===A.level?2:3,t|=i<<6,0!==A.strstart&&(t|=32),t+=31-t%31,Ft(A,t),0!==A.strstart&&(Ft(A,e.adler>>>16),Ft(A,65535&e.adler)),e.adler=1,A.status=bt,Ut(e),0!==A.pending)return A.last_flush=-1,gt}if(57===A.status)if(e.adler=0,Rt(A,31),Rt(A,139),Rt(A,8),A.gzhead)Rt(A,(A.gzhead.text?1:0)+(A.gzhead.hcrc?2:0)+(A.gzhead.extra?4:0)+(A.gzhead.name?8:0)+(A.gzhead.comment?16:0)),Rt(A,255&A.gzhead.time),Rt(A,A.gzhead.time>>8&255),Rt(A,A.gzhead.time>>16&255),Rt(A,A.gzhead.time>>24&255),Rt(A,9===A.level?2:A.strategy>=Bt||A.level<2?4:0),Rt(A,255&A.gzhead.os),A.gzhead.extra&&A.gzhead.extra.length&&(Rt(A,255&A.gzhead.extra.length),Rt(A,A.gzhead.extra.length>>8&255)),A.gzhead.hcrc&&(e.adler=Xe(e.adler,A.pending_buf,A.pending,0)),A.gzindex=0,A.status=69;else if(Rt(A,0),Rt(A,0),Rt(A,0),Rt(A,0),Rt(A,0),Rt(A,9===A.level?2:A.strategy>=Bt||A.level<2?4:0),Rt(A,3),A.status=bt,Ut(e),0!==A.pending)return A.last_flush=-1,gt;if(69===A.status){if(A.gzhead.extra){let t=A.pending,i=(65535&A.gzhead.extra.length)-A.gzindex;for(;A.pending+i>A.pending_buf_size;){let r=A.pending_buf_size-A.pending;if(A.pending_buf.set(A.gzhead.extra.subarray(A.gzindex,A.gzindex+r),A.pending),A.pending=A.pending_buf_size,A.gzhead.hcrc&&A.pending>t&&(e.adler=Xe(e.adler,A.pending_buf,A.pending-t,t)),A.gzindex+=r,Ut(e),0!==A.pending)return A.last_flush=-1,gt;t=0,i-=r}let r=new Uint8Array(A.gzhead.extra);A.pending_buf.set(r.subarray(A.gzindex,A.gzindex+i),A.pending),A.pending+=i,A.gzhead.hcrc&&A.pending>t&&(e.adler=Xe(e.adler,A.pending_buf,A.pending-t,t)),A.gzindex=0}A.status=73}if(73===A.status){if(A.gzhead.name){let t,i=A.pending;do{if(A.pending===A.pending_buf_size){if(A.gzhead.hcrc&&A.pending>i&&(e.adler=Xe(e.adler,A.pending_buf,A.pending-i,i)),Ut(e),0!==A.pending)return A.last_flush=-1,gt;i=0}t=A.gzindex<A.gzhead.name.length?255&A.gzhead.name.charCodeAt(A.gzindex++):0,Rt(A,t)}while(0!==t);A.gzhead.hcrc&&A.pending>i&&(e.adler=Xe(e.adler,A.pending_buf,A.pending-i,i)),A.gzindex=0}A.status=91}if(91===A.status){if(A.gzhead.comment){let t,i=A.pending;do{if(A.pending===A.pending_buf_size){if(A.gzhead.hcrc&&A.pending>i&&(e.adler=Xe(e.adler,A.pending_buf,A.pending-i,i)),Ut(e),0!==A.pending)return A.last_flush=-1,gt;i=0}t=A.gzindex<A.gzhead.comment.length?255&A.gzhead.comment.charCodeAt(A.gzindex++):0,Rt(A,t)}while(0!==t);A.gzhead.hcrc&&A.pending>i&&(e.adler=Xe(e.adler,A.pending_buf,A.pending-i,i))}A.status=103}if(103===A.status){if(A.gzhead.hcrc){if(A.pending+2>A.pending_buf_size&&(Ut(e),0!==A.pending))return A.last_flush=-1,gt;Rt(A,255&e.adler),Rt(A,e.adler>>8&255),e.adler=0}if(A.status=bt,Ut(e),0!==A.pending)return A.last_flush=-1,gt}if(0!==e.avail_in||0!==A.lookahead||t!==nt&&A.status!==Dt){let i=0===A.level?Pt(A,t):A.strategy===Bt?((e,t)=>{let A;for(;;){if(0===e.lookahead&&(Nt(e),0===e.lookahead)){if(t===nt)return 1;break}if(e.match_length=0,A=it(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,A&&(Mt(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,t===ot?(Mt(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(Mt(e,!1),0===e.strm.avail_out)?1:2})(A,t):A.strategy===Ct?((e,t)=>{let A,i,r,n;const a=e.window;for(;;){if(e.lookahead<=pt){if(Nt(e),e.lookahead<=pt&&t===nt)return 1;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=3&&e.strstart>0&&(r=e.strstart-1,i=a[r],i===a[++r]&&i===a[++r]&&i===a[++r])){n=e.strstart+pt;do{}while(i===a[++r]&&i===a[++r]&&i===a[++r]&&i===a[++r]&&i===a[++r]&&i===a[++r]&&i===a[++r]&&i===a[++r]&&r<n);e.match_length=pt-(n-r),e.match_length>e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=3?(A=it(e,1,e.match_length-3),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(A=it(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),A&&(Mt(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,t===ot?(Mt(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(Mt(e,!1),0===e.strm.avail_out)?1:2})(A,t):Ht[A.level].func(A,t);if(3!==i&&4!==i||(A.status=Dt),1===i||3===i)return 0===e.avail_out&&(A.last_flush=-1),gt;if(2===i&&(t===at?rt(A):t!==lt&&(tt(A,0,0,!1),t===st&&(xt(A.head),0===A.lookahead&&(A.strstart=0,A.block_start=0,A.insert=0))),Ut(e),0===e.avail_out))return A.last_flush=-1,gt}return t!==ot?gt:A.wrap<=0?ht:(2===A.wrap?(Rt(A,255&e.adler),Rt(A,e.adler>>8&255),Rt(A,e.adler>>16&255),Rt(A,e.adler>>24&255),Rt(A,255&e.total_in),Rt(A,e.total_in>>8&255),Rt(A,e.total_in>>16&255),Rt(A,e.total_in>>24&255)):(Ft(A,e.adler>>>16),Ft(A,65535&e.adler)),Ut(e),A.wrap>0&&(A.wrap=-A.wrap),0!==A.pending?gt:ht)},deflateEnd:e=>{if(Jt(e))return ct;const t=e.state.status;return e.state=null,t===bt?kt(e,ft):gt},deflateSetDictionary:(e,t)=>{let A=t.length;if(Jt(e))return ct;const i=e.state,r=i.wrap;if(2===r||1===r&&i.status!==_t||i.lookahead)return ct;if(1===r&&(e.adler=Ze(e.adler,t,A,0)),i.wrap=0,A>=i.w_size){0===r&&(xt(i.head),i.strstart=0,i.block_start=0,i.insert=0);let e=new Uint8Array(i.w_size);e.set(t.subarray(A-i.w_size,A),0),t=e,A=i.w_size}const n=e.avail_in,a=e.next_in,s=e.input;for(e.avail_in=A,e.next_in=0,e.input=t,Nt(i);i.lookahead>=3;){let e=i.strstart,t=i.lookahead-2;do{i.ins_h=Gt(i,i.ins_h,i.window[e+3-1]),i.prev[e&i.w_mask]=i.head[i.ins_h],i.head[i.ins_h]=e,e++}while(--t);i.strstart=e,i.lookahead=2,Nt(i)}return i.strstart+=i.lookahead,i.block_start=i.strstart,i.insert=i.lookahead,i.lookahead=0,i.match_length=i.prev_length=2,i.match_available=0,e.next_in=a,e.input=s,e.avail_in=n,i.wrap=r,gt},deflateInfo:"pako deflate (from Nodeca project)"};const Xt=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var Wt={assign:function(e){const t=Array.prototype.slice.call(arguments,1);for(;t.length;){const A=t.shift();if(A){if("object"!=typeof A)throw new TypeError(A+"must be non-object");for(const t in A)Xt(A,t)&&(e[t]=A[t])}}return e},flattenChunks:e=>{let t=0;for(let A=0,i=e.length;A<i;A++)t+=e[A].length;const A=new Uint8Array(t);for(let t=0,i=0,r=e.length;t<r;t++){let r=e[t];A.set(r,i),i+=r.length}return A}};let $t=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(e){$t=!1}const eA=new Uint8Array(256);for(let e=0;e<256;e++)eA[e]=e>=252?6:e>=248?5:e>=240?4:e>=224?3:e>=192?2:1;eA[254]=eA[254]=1;var tA={string2buf:e=>{if("function"==typeof TextEncoder&&TextEncoder.prototype.encode)return(new TextEncoder).encode(e);let t,A,i,r,n,a=e.length,s=0;for(r=0;r<a;r++)A=e.charCodeAt(r),55296==(64512&A)&&r+1<a&&(i=e.charCodeAt(r+1),56320==(64512&i)&&(A=65536+(A-55296<<10)+(i-56320),r++)),s+=A<128?1:A<2048?2:A<65536?3:4;for(t=new Uint8Array(s),n=0,r=0;n<s;r++)A=e.charCodeAt(r),55296==(64512&A)&&r+1<a&&(i=e.charCodeAt(r+1),56320==(64512&i)&&(A=65536+(A-55296<<10)+(i-56320),r++)),A<128?t[n++]=A:A<2048?(t[n++]=192|A>>>6,t[n++]=128|63&A):A<65536?(t[n++]=224|A>>>12,t[n++]=128|A>>>6&63,t[n++]=128|63&A):(t[n++]=240|A>>>18,t[n++]=128|A>>>12&63,t[n++]=128|A>>>6&63,t[n++]=128|63&A);return t},buf2string:(e,t)=>{const A=t||e.length;if("function"==typeof TextDecoder&&TextDecoder.prototype.decode)return(new TextDecoder).decode(e.subarray(0,t));let i,r;const n=new Array(2*A);for(r=0,i=0;i<A;){let t=e[i++];if(t<128){n[r++]=t;continue}let a=eA[t];if(a>4)n[r++]=65533,i+=a-1;else{for(t&=2===a?31:3===a?15:7;a>1&&i<A;)t=t<<6|63&e[i++],a--;a>1?n[r++]=65533:t<65536?n[r++]=t:(t-=65536,n[r++]=55296|t>>10&1023,n[r++]=56320|1023&t)}}return((e,t)=>{if(t<65534&&e.subarray&&$t)return String.fromCharCode.apply(null,e.length===t?e:e.subarray(0,t));let A="";for(let i=0;i<t;i++)A+=String.fromCharCode(e[i]);return A})(n,r)},utf8border:(e,t)=>{(t=t||e.length)>e.length&&(t=e.length);let A=t-1;for(;A>=0&&128==(192&e[A]);)A--;return A<0||0===A?t:A+eA[e[A]]>t?A:t}};var AA=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0};const iA=Object.prototype.toString,{Z_NO_FLUSH:rA,Z_SYNC_FLUSH:nA,Z_FULL_FLUSH:aA,Z_FINISH:sA,Z_OK:oA,Z_STREAM_END:lA,Z_DEFAULT_COMPRESSION:gA,Z_DEFAULT_STRATEGY:hA,Z_DEFLATED:cA}=$e;function fA(e){this.options=Wt.assign({level:gA,method:cA,chunkSize:16384,windowBits:15,memLevel:8,strategy:hA},e||{});let t=this.options;t.raw&&t.windowBits>0?t.windowBits=-t.windowBits:t.gzip&&t.windowBits>0&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new AA,this.strm.avail_out=0;let A=jt.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(A!==oA)throw new Error(We[A]);if(t.header&&jt.deflateSetHeader(this.strm,t.header),t.dictionary){let e;if(e="string"==typeof t.dictionary?tA.string2buf(t.dictionary):"[object ArrayBuffer]"===iA.call(t.dictionary)?new Uint8Array(t.dictionary):t.dictionary,A=jt.deflateSetDictionary(this.strm,e),A!==oA)throw new Error(We[A]);this._dict_set=!0}}fA.prototype.push=function(e,t){const A=this.strm,i=this.options.chunkSize;let r,n;if(this.ended)return!1;for(n=t===~~t?t:!0===t?sA:rA,"string"==typeof e?A.input=tA.string2buf(e):"[object ArrayBuffer]"===iA.call(e)?A.input=new Uint8Array(e):A.input=e,A.next_in=0,A.avail_in=A.input.length;;)if(0===A.avail_out&&(A.output=new Uint8Array(i),A.next_out=0,A.avail_out=i),(n===nA||n===aA)&&A.avail_out<=6)this.onData(A.output.subarray(0,A.next_out)),A.avail_out=0;else{if(r=jt.deflate(A,n),r===lA)return A.next_out>0&&this.onData(A.output.subarray(0,A.next_out)),r=jt.deflateEnd(this.strm),this.onEnd(r),this.ended=!0,r===oA;if(0!==A.avail_out){if(n>0&&A.next_out>0)this.onData(A.output.subarray(0,A.next_out)),A.avail_out=0;else if(0===A.avail_in)break}else this.onData(A.output)}return!0},fA.prototype.onData=function(e){this.chunks.push(e)},fA.prototype.onEnd=function(e){e===oA&&(this.result=Wt.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};const dA=16209;var uA=function(e,t){let A,i,r,n,a,s,o,l,g,h,c,f,d,u,I,B,C,E,w,Q,m,p,y,_;const b=e.state;A=e.next_in,y=e.input,i=A+(e.avail_in-5),r=e.next_out,_=e.output,n=r-(t-e.avail_out),a=r+(e.avail_out-257),s=b.dmax,o=b.wsize,l=b.whave,g=b.wnext,h=b.window,c=b.hold,f=b.bits,d=b.lencode,u=b.distcode,I=(1<<b.lenbits)-1,B=(1<<b.distbits)-1;e:do{f<15&&(c+=y[A++]<<f,f+=8,c+=y[A++]<<f,f+=8),C=d[c&I];t:for(;;){if(E=C>>>24,c>>>=E,f-=E,E=C>>>16&255,0===E)_[r++]=65535&C;else{if(!(16&E)){if(0==(64&E)){C=d[(65535&C)+(c&(1<<E)-1)];continue t}if(32&E){b.mode=16191;break e}e.msg="invalid literal/length code",b.mode=dA;break e}w=65535&C,E&=15,E&&(f<E&&(c+=y[A++]<<f,f+=8),w+=c&(1<<E)-1,c>>>=E,f-=E),f<15&&(c+=y[A++]<<f,f+=8,c+=y[A++]<<f,f+=8),C=u[c&B];A:for(;;){if(E=C>>>24,c>>>=E,f-=E,E=C>>>16&255,!(16&E)){if(0==(64&E)){C=u[(65535&C)+(c&(1<<E)-1)];continue A}e.msg="invalid distance code",b.mode=dA;break e}if(Q=65535&C,E&=15,f<E&&(c+=y[A++]<<f,f+=8,f<E&&(c+=y[A++]<<f,f+=8)),Q+=c&(1<<E)-1,Q>s){e.msg="invalid distance too far back",b.mode=dA;break e}if(c>>>=E,f-=E,E=r-n,Q>E){if(E=Q-E,E>l&&b.sane){e.msg="invalid distance too far back",b.mode=dA;break e}if(m=0,p=h,0===g){if(m+=o-E,E<w){w-=E;do{_[r++]=h[m++]}while(--E);m=r-Q,p=_}}else if(g<E){if(m+=o+g-E,E-=g,E<w){w-=E;do{_[r++]=h[m++]}while(--E);if(m=0,g<w){E=g,w-=E;do{_[r++]=h[m++]}while(--E);m=r-Q,p=_}}}else if(m+=g-E,E<w){w-=E;do{_[r++]=h[m++]}while(--E);m=r-Q,p=_}for(;w>2;)_[r++]=p[m++],_[r++]=p[m++],_[r++]=p[m++],w-=3;w&&(_[r++]=p[m++],w>1&&(_[r++]=p[m++]))}else{m=r-Q;do{_[r++]=_[m++],_[r++]=_[m++],_[r++]=_[m++],w-=3}while(w>2);w&&(_[r++]=_[m++],w>1&&(_[r++]=_[m++]))}break}}break}}while(A<i&&r<a);w=f>>3,A-=w,f-=w<<3,c&=(1<<f)-1,e.next_in=A,e.next_out=r,e.avail_in=A<i?i-A+5:5-(A-i),e.avail_out=r<a?a-r+257:257-(r-a),b.hold=c,b.bits=f};const IA=15,BA=new Uint16Array([3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0]),CA=new Uint8Array([16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78]),EA=new Uint16Array([1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0]),wA=new Uint8Array([16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64]);var QA=(e,t,A,i,r,n,a,s)=>{const o=s.bits;let l,g,h,c,f,d,u=0,I=0,B=0,C=0,E=0,w=0,Q=0,m=0,p=0,y=0,_=null;const b=new Uint16Array(16),D=new Uint16Array(16);let k,v,x,S=null;for(u=0;u<=IA;u++)b[u]=0;for(I=0;I<i;I++)b[t[A+I]]++;for(E=o,C=IA;C>=1&&0===b[C];C--);if(E>C&&(E=C),0===C)return r[n++]=20971520,r[n++]=20971520,s.bits=1,0;for(B=1;B<C&&0===b[B];B++);for(E<B&&(E=B),m=1,u=1;u<=IA;u++)if(m<<=1,m-=b[u],m<0)return-1;if(m>0&&(0===e||1!==C))return-1;for(D[1]=0,u=1;u<IA;u++)D[u+1]=D[u]+b[u];for(I=0;I<i;I++)0!==t[A+I]&&(a[D[t[A+I]]++]=I);if(0===e?(_=S=a,d=20):1===e?(_=BA,S=CA,d=257):(_=EA,S=wA,d=0),y=0,I=0,u=B,f=n,w=E,Q=0,h=-1,p=1<<E,c=p-1,1===e&&p>852||2===e&&p>592)return 1;for(;;){k=u-Q,a[I]+1<d?(v=0,x=a[I]):a[I]>=d?(v=S[a[I]-d],x=_[a[I]-d]):(v=96,x=0),l=1<<u-Q,g=1<<w,B=g;do{g-=l,r[f+(y>>Q)+g]=k<<24|v<<16|x|0}while(0!==g);for(l=1<<u-1;y&l;)l>>=1;if(0!==l?(y&=l-1,y+=l):y=0,I++,0==--b[u]){if(u===C)break;u=t[A+a[I]]}if(u>E&&(y&c)!==h){for(0===Q&&(Q=E),f+=B,w=u-Q,m=1<<w;w+Q<C&&(m-=b[w+Q],!(m<=0));)w++,m<<=1;if(p+=1<<w,1===e&&p>852||2===e&&p>592)return 1;h=y&c,r[h]=E<<24|w<<16|f-n|0}}return 0!==y&&(r[f+y]=u-Q<<24|64<<16|0),s.bits=E,0};const{Z_FINISH:mA,Z_BLOCK:pA,Z_TREES:yA,Z_OK:_A,Z_STREAM_END:bA,Z_NEED_DICT:DA,Z_STREAM_ERROR:kA,Z_DATA_ERROR:vA,Z_MEM_ERROR:xA,Z_BUF_ERROR:SA,Z_DEFLATED:GA}=$e,UA=16180,MA=16190,RA=16191,FA=16192,LA=16194,TA=16199,NA=16200,PA=16206,OA=16209,zA=e=>(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24);function KA(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}const HA=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||t.mode<UA||t.mode>16211?1:0},qA=e=>{if(HA(e))return kA;const t=e.state;return e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=UA,t.last=0,t.havedict=0,t.flags=-1,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new Int32Array(852),t.distcode=t.distdyn=new Int32Array(592),t.sane=1,t.back=-1,_A},JA=e=>{if(HA(e))return kA;const t=e.state;return t.wsize=0,t.whave=0,t.wnext=0,qA(e)},YA=(e,t)=>{let A;if(HA(e))return kA;const i=e.state;return t<0?(A=0,t=-t):(A=5+(t>>4),t<48&&(t&=15)),t&&(t<8||t>15)?kA:(null!==i.window&&i.wbits!==t&&(i.window=null),i.wrap=A,i.wbits=t,JA(e))},VA=(e,t)=>{if(!e)return kA;const A=new KA;e.state=A,A.strm=e,A.window=null,A.mode=UA;const i=YA(e,t);return i!==_A&&(e.state=null),i};let ZA,jA,XA=!0;const WA=e=>{if(XA){ZA=new Int32Array(512),jA=new Int32Array(32);let t=0;for(;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(QA(1,e.lens,0,288,ZA,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;QA(2,e.lens,0,32,jA,0,e.work,{bits:5}),XA=!1}e.lencode=ZA,e.lenbits=9,e.distcode=jA,e.distbits=5},$A=(e,t,A,i)=>{let r;const n=e.state;return null===n.window&&(n.wsize=1<<n.wbits,n.wnext=0,n.whave=0,n.window=new Uint8Array(n.wsize)),i>=n.wsize?(n.window.set(t.subarray(A-n.wsize,A),0),n.wnext=0,n.whave=n.wsize):(r=n.wsize-n.wnext,r>i&&(r=i),n.window.set(t.subarray(A-i,A-i+r),n.wnext),(i-=r)?(n.window.set(t.subarray(A-i,A),0),n.wnext=i,n.whave=n.wsize):(n.wnext+=r,n.wnext===n.wsize&&(n.wnext=0),n.whave<n.wsize&&(n.whave+=r))),0};var ei={inflateReset:JA,inflateReset2:YA,inflateResetKeep:qA,inflateInit:e=>VA(e,15),inflateInit2:VA,inflate:(e,t)=>{let A,i,r,n,a,s,o,l,g,h,c,f,d,u,I,B,C,E,w,Q,m,p,y=0;const _=new Uint8Array(4);let b,D;const k=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(HA(e)||!e.output||!e.input&&0!==e.avail_in)return kA;A=e.state,A.mode===RA&&(A.mode=FA),a=e.next_out,r=e.output,o=e.avail_out,n=e.next_in,i=e.input,s=e.avail_in,l=A.hold,g=A.bits,h=s,c=o,p=_A;e:for(;;)switch(A.mode){case UA:if(0===A.wrap){A.mode=FA;break}for(;g<16;){if(0===s)break e;s--,l+=i[n++]<<g,g+=8}if(2&A.wrap&&35615===l){0===A.wbits&&(A.wbits=15),A.check=0,_[0]=255&l,_[1]=l>>>8&255,A.check=Xe(A.check,_,2,0),l=0,g=0,A.mode=16181;break}if(A.head&&(A.head.done=!1),!(1&A.wrap)||(((255&l)<<8)+(l>>8))%31){e.msg="incorrect header check",A.mode=OA;break}if((15&l)!==GA){e.msg="unknown compression method",A.mode=OA;break}if(l>>>=4,g-=4,m=8+(15&l),0===A.wbits&&(A.wbits=m),m>15||m>A.wbits){e.msg="invalid window size",A.mode=OA;break}A.dmax=1<<A.wbits,A.flags=0,e.adler=A.check=1,A.mode=512&l?16189:RA,l=0,g=0;break;case 16181:for(;g<16;){if(0===s)break e;s--,l+=i[n++]<<g,g+=8}if(A.flags=l,(255&A.flags)!==GA){e.msg="unknown compression method",A.mode=OA;break}if(57344&A.flags){e.msg="unknown header flags set",A.mode=OA;break}A.head&&(A.head.text=l>>8&1),512&A.flags&&4&A.wrap&&(_[0]=255&l,_[1]=l>>>8&255,A.check=Xe(A.check,_,2,0)),l=0,g=0,A.mode=16182;case 16182:for(;g<32;){if(0===s)break e;s--,l+=i[n++]<<g,g+=8}A.head&&(A.head.time=l),512&A.flags&&4&A.wrap&&(_[0]=255&l,_[1]=l>>>8&255,_[2]=l>>>16&255,_[3]=l>>>24&255,A.check=Xe(A.check,_,4,0)),l=0,g=0,A.mode=16183;case 16183:for(;g<16;){if(0===s)break e;s--,l+=i[n++]<<g,g+=8}A.head&&(A.head.xflags=255&l,A.head.os=l>>8),512&A.flags&&4&A.wrap&&(_[0]=255&l,_[1]=l>>>8&255,A.check=Xe(A.check,_,2,0)),l=0,g=0,A.mode=16184;case 16184:if(1024&A.flags){for(;g<16;){if(0===s)break e;s--,l+=i[n++]<<g,g+=8}A.length=l,A.head&&(A.head.extra_len=l),512&A.flags&&4&A.wrap&&(_[0]=255&l,_[1]=l>>>8&255,A.check=Xe(A.check,_,2,0)),l=0,g=0}else A.head&&(A.head.extra=null);A.mode=16185;case 16185:if(1024&A.flags&&(f=A.length,f>s&&(f=s),f&&(A.head&&(m=A.head.extra_len-A.length,A.head.extra||(A.head.extra=new Uint8Array(A.head.extra_len)),A.head.extra.set(i.subarray(n,n+f),m)),512&A.flags&&4&A.wrap&&(A.check=Xe(A.check,i,f,n)),s-=f,n+=f,A.length-=f),A.length))break e;A.length=0,A.mode=16186;case 16186:if(2048&A.flags){if(0===s)break e;f=0;do{m=i[n+f++],A.head&&m&&A.length<65536&&(A.head.name+=String.fromCharCode(m))}while(m&&f<s);if(512&A.flags&&4&A.wrap&&(A.check=Xe(A.check,i,f,n)),s-=f,n+=f,m)break e}else A.head&&(A.head.name=null);A.length=0,A.mode=16187;case 16187:if(4096&A.flags){if(0===s)break e;f=0;do{m=i[n+f++],A.head&&m&&A.length<65536&&(A.head.comment+=String.fromCharCode(m))}while(m&&f<s);if(512&A.flags&&4&A.wrap&&(A.check=Xe(A.check,i,f,n)),s-=f,n+=f,m)break e}else A.head&&(A.head.comment=null);A.mode=16188;case 16188:if(512&A.flags){for(;g<16;){if(0===s)break e;s--,l+=i[n++]<<g,g+=8}if(4&A.wrap&&l!==(65535&A.check)){e.msg="header crc mismatch",A.mode=OA;break}l=0,g=0}A.head&&(A.head.hcrc=A.flags>>9&1,A.head.done=!0),e.adler=A.check=0,A.mode=RA;break;case 16189:for(;g<32;){if(0===s)break e;s--,l+=i[n++]<<g,g+=8}e.adler=A.check=zA(l),l=0,g=0,A.mode=MA;case MA:if(0===A.havedict)return e.next_out=a,e.avail_out=o,e.next_in=n,e.avail_in=s,A.hold=l,A.bits=g,DA;e.adler=A.check=1,A.mode=RA;case RA:if(t===pA||t===yA)break e;case FA:if(A.last){l>>>=7&g,g-=7&g,A.mode=PA;break}for(;g<3;){if(0===s)break e;s--,l+=i[n++]<<g,g+=8}switch(A.last=1&l,l>>>=1,g-=1,3&l){case 0:A.mode=16193;break;case 1:if(WA(A),A.mode=TA,t===yA){l>>>=2,g-=2;break e}break;case 2:A.mode=16196;break;case 3:e.msg="invalid block type",A.mode=OA}l>>>=2,g-=2;break;case 16193:for(l>>>=7&g,g-=7&g;g<32;){if(0===s)break e;s--,l+=i[n++]<<g,g+=8}if((65535&l)!=(l>>>16^65535)){e.msg="invalid stored block lengths",A.mode=OA;break}if(A.length=65535&l,l=0,g=0,A.mode=LA,t===yA)break e;case LA:A.mode=16195;case 16195:if(f=A.length,f){if(f>s&&(f=s),f>o&&(f=o),0===f)break e;r.set(i.subarray(n,n+f),a),s-=f,n+=f,o-=f,a+=f,A.length-=f;break}A.mode=RA;break;case 16196:for(;g<14;){if(0===s)break e;s--,l+=i[n++]<<g,g+=8}if(A.nlen=257+(31&l),l>>>=5,g-=5,A.ndist=1+(31&l),l>>>=5,g-=5,A.ncode=4+(15&l),l>>>=4,g-=4,A.nlen>286||A.ndist>30){e.msg="too many length or distance symbols",A.mode=OA;break}A.have=0,A.mode=16197;case 16197:for(;A.have<A.ncode;){for(;g<3;){if(0===s)break e;s--,l+=i[n++]<<g,g+=8}A.lens[k[A.have++]]=7&l,l>>>=3,g-=3}for(;A.have<19;)A.lens[k[A.have++]]=0;if(A.lencode=A.lendyn,A.lenbits=7,b={bits:A.lenbits},p=QA(0,A.lens,0,19,A.lencode,0,A.work,b),A.lenbits=b.bits,p){e.msg="invalid code lengths set",A.mode=OA;break}A.have=0,A.mode=16198;case 16198:for(;A.have<A.nlen+A.ndist;){for(;y=A.lencode[l&(1<<A.lenbits)-1],I=y>>>24,B=y>>>16&255,C=65535&y,!(I<=g);){if(0===s)break e;s--,l+=i[n++]<<g,g+=8}if(C<16)l>>>=I,g-=I,A.lens[A.have++]=C;else{if(16===C){for(D=I+2;g<D;){if(0===s)break e;s--,l+=i[n++]<<g,g+=8}if(l>>>=I,g-=I,0===A.have){e.msg="invalid bit length repeat",A.mode=OA;break}m=A.lens[A.have-1],f=3+(3&l),l>>>=2,g-=2}else if(17===C){for(D=I+3;g<D;){if(0===s)break e;s--,l+=i[n++]<<g,g+=8}l>>>=I,g-=I,m=0,f=3+(7&l),l>>>=3,g-=3}else{for(D=I+7;g<D;){if(0===s)break e;s--,l+=i[n++]<<g,g+=8}l>>>=I,g-=I,m=0,f=11+(127&l),l>>>=7,g-=7}if(A.have+f>A.nlen+A.ndist){e.msg="invalid bit length repeat",A.mode=OA;break}for(;f--;)A.lens[A.have++]=m}}if(A.mode===OA)break;if(0===A.lens[256]){e.msg="invalid code -- missing end-of-block",A.mode=OA;break}if(A.lenbits=9,b={bits:A.lenbits},p=QA(1,A.lens,0,A.nlen,A.lencode,0,A.work,b),A.lenbits=b.bits,p){e.msg="invalid literal/lengths set",A.mode=OA;break}if(A.distbits=6,A.distcode=A.distdyn,b={bits:A.distbits},p=QA(2,A.lens,A.nlen,A.ndist,A.distcode,0,A.work,b),A.distbits=b.bits,p){e.msg="invalid distances set",A.mode=OA;break}if(A.mode=TA,t===yA)break e;case TA:A.mode=NA;case NA:if(s>=6&&o>=258){e.next_out=a,e.avail_out=o,e.next_in=n,e.avail_in=s,A.hold=l,A.bits=g,uA(e,c),a=e.next_out,r=e.output,o=e.avail_out,n=e.next_in,i=e.input,s=e.avail_in,l=A.hold,g=A.bits,A.mode===RA&&(A.back=-1);break}for(A.back=0;y=A.lencode[l&(1<<A.lenbits)-1],I=y>>>24,B=y>>>16&255,C=65535&y,!(I<=g);){if(0===s)break e;s--,l+=i[n++]<<g,g+=8}if(B&&0==(240&B)){for(E=I,w=B,Q=C;y=A.lencode[Q+((l&(1<<E+w)-1)>>E)],I=y>>>24,B=y>>>16&255,C=65535&y,!(E+I<=g);){if(0===s)break e;s--,l+=i[n++]<<g,g+=8}l>>>=E,g-=E,A.back+=E}if(l>>>=I,g-=I,A.back+=I,A.length=C,0===B){A.mode=16205;break}if(32&B){A.back=-1,A.mode=RA;break}if(64&B){e.msg="invalid literal/length code",A.mode=OA;break}A.extra=15&B,A.mode=16201;case 16201:if(A.extra){for(D=A.extra;g<D;){if(0===s)break e;s--,l+=i[n++]<<g,g+=8}A.length+=l&(1<<A.extra)-1,l>>>=A.extra,g-=A.extra,A.back+=A.extra}A.was=A.length,A.mode=16202;case 16202:for(;y=A.distcode[l&(1<<A.distbits)-1],I=y>>>24,B=y>>>16&255,C=65535&y,!(I<=g);){if(0===s)break e;s--,l+=i[n++]<<g,g+=8}if(0==(240&B)){for(E=I,w=B,Q=C;y=A.distcode[Q+((l&(1<<E+w)-1)>>E)],I=y>>>24,B=y>>>16&255,C=65535&y,!(E+I<=g);){if(0===s)break e;s--,l+=i[n++]<<g,g+=8}l>>>=E,g-=E,A.back+=E}if(l>>>=I,g-=I,A.back+=I,64&B){e.msg="invalid distance code",A.mode=OA;break}A.offset=C,A.extra=15&B,A.mode=16203;case 16203:if(A.extra){for(D=A.extra;g<D;){if(0===s)break e;s--,l+=i[n++]<<g,g+=8}A.offset+=l&(1<<A.extra)-1,l>>>=A.extra,g-=A.extra,A.back+=A.extra}if(A.offset>A.dmax){e.msg="invalid distance too far back",A.mode=OA;break}A.mode=16204;case 16204:if(0===o)break e;if(f=c-o,A.offset>f){if(f=A.offset-f,f>A.whave&&A.sane){e.msg="invalid distance too far back",A.mode=OA;break}f>A.wnext?(f-=A.wnext,d=A.wsize-f):d=A.wnext-f,f>A.length&&(f=A.length),u=A.window}else u=r,d=a-A.offset,f=A.length;f>o&&(f=o),o-=f,A.length-=f;do{r[a++]=u[d++]}while(--f);0===A.length&&(A.mode=NA);break;case 16205:if(0===o)break e;r[a++]=A.length,o--,A.mode=NA;break;case PA:if(A.wrap){for(;g<32;){if(0===s)break e;s--,l|=i[n++]<<g,g+=8}if(c-=o,e.total_out+=c,A.total+=c,4&A.wrap&&c&&(e.adler=A.check=A.flags?Xe(A.check,r,c,a-c):Ze(A.check,r,c,a-c)),c=o,4&A.wrap&&(A.flags?l:zA(l))!==A.check){e.msg="incorrect data check",A.mode=OA;break}l=0,g=0}A.mode=16207;case 16207:if(A.wrap&&A.flags){for(;g<32;){if(0===s)break e;s--,l+=i[n++]<<g,g+=8}if(4&A.wrap&&l!==(4294967295&A.total)){e.msg="incorrect length check",A.mode=OA;break}l=0,g=0}A.mode=16208;case 16208:p=bA;break e;case OA:p=vA;break e;case 16210:return xA;default:return kA}return e.next_out=a,e.avail_out=o,e.next_in=n,e.avail_in=s,A.hold=l,A.bits=g,(A.wsize||c!==e.avail_out&&A.mode<OA&&(A.mode<PA||t!==mA))&&$A(e,e.output,e.next_out,c-e.avail_out),h-=e.avail_in,c-=e.avail_out,e.total_in+=h,e.total_out+=c,A.total+=c,4&A.wrap&&c&&(e.adler=A.check=A.flags?Xe(A.check,r,c,e.next_out-c):Ze(A.check,r,c,e.next_out-c)),e.data_type=A.bits+(A.last?64:0)+(A.mode===RA?128:0)+(A.mode===TA||A.mode===LA?256:0),(0===h&&0===c||t===mA)&&p===_A&&(p=SA),p},inflateEnd:e=>{if(HA(e))return kA;let t=e.state;return t.window&&(t.window=null),e.state=null,_A},inflateGetHeader:(e,t)=>{if(HA(e))return kA;const A=e.state;return 0==(2&A.wrap)?kA:(A.head=t,t.done=!1,_A)},inflateSetDictionary:(e,t)=>{const A=t.length;let i,r,n;return HA(e)?kA:(i=e.state,0!==i.wrap&&i.mode!==MA?kA:i.mode===MA&&(r=1,r=Ze(r,t,A,0),r!==i.check)?vA:(n=$A(e,t,A,A),n?(i.mode=16210,xA):(i.havedict=1,_A)))},inflateInfo:"pako inflate (from Nodeca project)"};var ti=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1};const Ai=Object.prototype.toString,{Z_NO_FLUSH:ii,Z_FINISH:ri,Z_OK:ni,Z_STREAM_END:ai,Z_NEED_DICT:si,Z_STREAM_ERROR:oi,Z_DATA_ERROR:li,Z_MEM_ERROR:gi}=$e;function hi(e){this.options=Wt.assign({chunkSize:65536,windowBits:15,to:""},e||{});const t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,0===t.windowBits&&(t.windowBits=-15)),!(t.windowBits>=0&&t.windowBits<16)||e&&e.windowBits||(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&0==(15&t.windowBits)&&(t.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new AA,this.strm.avail_out=0;let A=ei.inflateInit2(this.strm,t.windowBits);if(A!==ni)throw new Error(We[A]);if(this.header=new ti,ei.inflateGetHeader(this.strm,this.header),t.dictionary&&("string"==typeof t.dictionary?t.dictionary=tA.string2buf(t.dictionary):"[object ArrayBuffer]"===Ai.call(t.dictionary)&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(A=ei.inflateSetDictionary(this.strm,t.dictionary),A!==ni)))throw new Error(We[A])}function ci(e,t){const A=new hi(t);if(A.push(e),A.err)throw A.msg||We[A.err];return A.result}hi.prototype.push=function(e,t){const A=this.strm,i=this.options.chunkSize,r=this.options.dictionary;let n,a,s;if(this.ended)return!1;for(a=t===~~t?t:!0===t?ri:ii,"[object ArrayBuffer]"===Ai.call(e)?A.input=new Uint8Array(e):A.input=e,A.next_in=0,A.avail_in=A.input.length;;){for(0===A.avail_out&&(A.output=new Uint8Array(i),A.next_out=0,A.avail_out=i),n=ei.inflate(A,a),n===si&&r&&(n=ei.inflateSetDictionary(A,r),n===ni?n=ei.inflate(A,a):n===li&&(n=si));A.avail_in>0&&n===ai&&A.state.wrap>0&&0!==e[A.next_in];)ei.inflateReset(A),n=ei.inflate(A,a);switch(n){case oi:case li:case si:case gi:return this.onEnd(n),this.ended=!0,!1}if(s=A.avail_out,A.next_out&&(0===A.avail_out||n===ai))if("string"===this.options.to){let e=tA.utf8border(A.output,A.next_out),t=A.next_out-e,r=tA.buf2string(A.output,e);A.next_out=t,A.avail_out=i-t,t&&A.output.set(A.output.subarray(e,e+t),0),this.onData(r)}else this.onData(A.output.length===A.next_out?A.output:A.output.subarray(0,A.next_out));if(n!==ni||0!==s){if(n===ai)return n=ei.inflateEnd(this.strm),this.onEnd(n),this.ended=!0,!0;if(0===A.avail_in)break}}return!0},hi.prototype.onData=function(e){this.chunks.push(e)},hi.prototype.onEnd=function(e){e===ni&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=Wt.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};var fi={Inflate:hi,inflate:ci,inflateRaw:function(e,t){return(t=t||{}).raw=!0,ci(e,t)},ungzip:ci,constants:$e};const{Inflate:di,inflate:ui,inflateRaw:Ii,ungzip:Bi}=fi;var Ci=ui;function Ei(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var wi={exports:{}};!function(e){function t(e){var t,A,i,r,n,a=Math.floor,s=new Array(64),o=new Array(64),l=new Array(64),g=new Array(64),h=new Array(65535),c=new Array(65535),f=new Array(64),d=new Array(64),u=[],I=0,B=7,C=new Array(64),E=new Array(64),w=new Array(64),Q=new Array(256),m=new Array(2048),p=[0,1,5,6,14,15,27,28,2,4,7,13,16,26,29,42,3,8,12,17,25,30,41,43,9,11,18,24,31,40,44,53,10,19,23,32,39,45,52,54,20,22,33,38,46,51,55,60,21,34,37,47,50,56,59,61,35,36,48,49,57,58,62,63],y=[0,0,1,5,1,1,1,1,1,1,0,0,0,0,0,0,0],_=[0,1,2,3,4,5,6,7,8,9,10,11],b=[0,0,2,1,3,3,2,4,3,5,5,4,4,0,0,1,125],D=[1,2,3,0,4,17,5,18,33,49,65,6,19,81,97,7,34,113,20,50,129,145,161,8,35,66,177,193,21,82,209,240,36,51,98,114,130,9,10,22,23,24,25,26,37,38,39,40,41,42,52,53,54,55,56,57,58,67,68,69,70,71,72,73,74,83,84,85,86,87,88,89,90,99,100,101,102,103,104,105,106,115,116,117,118,119,120,121,122,131,132,133,134,135,136,137,138,146,147,148,149,150,151,152,153,154,162,163,164,165,166,167,168,169,170,178,179,180,181,182,183,184,185,186,194,195,196,197,198,199,200,201,202,210,211,212,213,214,215,216,217,218,225,226,227,228,229,230,231,232,233,234,241,242,243,244,245,246,247,248,249,250],k=[0,0,3,1,1,1,1,1,1,1,1,1,0,0,0,0,0],v=[0,1,2,3,4,5,6,7,8,9,10,11],x=[0,0,2,1,2,4,4,3,4,7,5,4,4,0,1,2,119],S=[0,1,2,3,17,4,5,33,49,6,18,65,81,7,97,113,19,34,50,129,8,20,66,145,161,177,193,9,35,51,82,240,21,98,114,209,10,22,36,52,225,37,241,23,24,25,26,38,39,40,41,42,53,54,55,56,57,58,67,68,69,70,71,72,73,74,83,84,85,86,87,88,89,90,99,100,101,102,103,104,105,106,115,116,117,118,119,120,121,122,130,131,132,133,134,135,136,137,138,146,147,148,149,150,151,152,153,154,162,163,164,165,166,167,168,169,170,178,179,180,181,182,183,184,185,186,194,195,196,197,198,199,200,201,202,210,211,212,213,214,215,216,217,218,226,227,228,229,230,231,232,233,234,242,243,244,245,246,247,248,249,250];function G(e,t){for(var A=0,i=0,r=new Array,n=1;n<=16;n++){for(var a=1;a<=e[n];a++)r[t[i]]=[],r[t[i]][0]=A,r[t[i]][1]=n,i++,A++;A*=2}return r}function U(e){for(var t=e[0],A=e[1]-1;A>=0;)t&1<<A&&(I|=1<<B),A--,--B<0&&(255==I?(M(255),M(0)):M(I),B=7,I=0)}function M(e){u.push(e)}function R(e){M(e>>8&255),M(255&e)}function F(e,t,A,i,r){for(var n,a=r[0],s=r[240],o=function(e,t){var A,i,r,n,a,s,o,l,g,h,c=0;for(g=0;g<8;++g){A=e[c],i=e[c+1],r=e[c+2],n=e[c+3],a=e[c+4],s=e[c+5],o=e[c+6];var d=A+(l=e[c+7]),u=A-l,I=i+o,B=i-o,C=r+s,E=r-s,w=n+a,Q=n-a,m=d+w,p=d-w,y=I+C,_=I-C;e[c]=m+y,e[c+4]=m-y;var b=.707106781*(_+p);e[c+2]=p+b,e[c+6]=p-b;var D=.382683433*((m=Q+E)-(_=B+u)),k=.5411961*m+D,v=1.306562965*_+D,x=.707106781*(y=E+B),S=u+x,G=u-x;e[c+5]=G+k,e[c+3]=G-k,e[c+1]=S+v,e[c+7]=S-v,c+=8}for(c=0,g=0;g<8;++g){A=e[c],i=e[c+8],r=e[c+16],n=e[c+24],a=e[c+32],s=e[c+40],o=e[c+48];var U=A+(l=e[c+56]),M=A-l,R=i+o,F=i-o,L=r+s,T=r-s,N=n+a,P=n-a,O=U+N,z=U-N,K=R+L,H=R-L;e[c]=O+K,e[c+32]=O-K;var q=.707106781*(H+z);e[c+16]=z+q,e[c+48]=z-q;var J=.382683433*((O=P+T)-(H=F+M)),Y=.5411961*O+J,V=1.306562965*H+J,Z=.707106781*(K=T+F),j=M+Z,X=M-Z;e[c+40]=X+Y,e[c+24]=X-Y,e[c+8]=j+V,e[c+56]=j-V,c++}for(g=0;g<64;++g)h=e[g]*t[g],f[g]=h>0?h+.5|0:h-.5|0;return f}(e,t),l=0;l<64;++l)d[p[l]]=o[l];var g=d[0]-A;A=d[0],0==g?U(i[0]):(U(i[c[n=32767+g]]),U(h[n]));for(var u=63;u>0&&0==d[u];u--);if(0==u)return U(a),A;for(var I,B=1;B<=u;){for(var C=B;0==d[B]&&B<=u;++B);var E=B-C;if(E>=16){I=E>>4;for(var w=1;w<=I;++w)U(s);E&=15}n=32767+d[B],U(r[(E<<4)+c[n]]),U(h[n]),B++}return 63!=u&&U(a),A}function L(e){if(e<=0&&(e=1),e>100&&(e=100),n!=e){(function(e){for(var t=[16,11,10,16,24,40,51,61,12,12,14,19,26,58,60,55,14,13,16,24,40,57,69,56,14,17,22,29,51,87,80,62,18,22,37,56,68,109,103,77,24,35,55,64,81,104,113,92,49,64,78,87,103,121,120,101,72,92,95,98,112,100,103,99],A=0;A<64;A++){var i=a((t[A]*e+50)/100);i<1?i=1:i>255&&(i=255),s[p[A]]=i}for(var r=[17,18,24,47,99,99,99,99,18,21,26,66,99,99,99,99,24,26,56,99,99,99,99,99,47,66,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99],n=0;n<64;n++){var h=a((r[n]*e+50)/100);h<1?h=1:h>255&&(h=255),o[p[n]]=h}for(var c=[1,1.387039845,1.306562965,1.175875602,1,.785694958,.5411961,.275899379],f=0,d=0;d<8;d++)for(var u=0;u<8;u++)l[f]=1/(s[p[f]]*c[d]*c[u]*8),g[f]=1/(o[p[f]]*c[d]*c[u]*8),f++})(e<50?Math.floor(5e3/e):Math.floor(200-2*e)),n=e}}this.encode=function(e,n){var a;(new Date).getTime(),n&&L(n),u=new Array,I=0,B=7,R(65496),R(65504),R(16),M(74),M(70),M(73),M(70),M(0),M(1),M(1),M(0),R(1),R(1),M(0),M(0),void 0!==(a=e.comments)&&a.constructor===Array&&a.forEach((e=>{if("string"==typeof e){R(65534);var t,A=e.length;for(R(A+2),t=0;t<A;t++)M(e.charCodeAt(t))}})),function(e){if(e){R(65505),69===e[0]&&120===e[1]&&105===e[2]&&102===e[3]?R(e.length+2):(R(e.length+5+2),M(69),M(120),M(105),M(102),M(0));for(var t=0;t<e.length;t++)M(e[t])}}(e.exifBuffer),function(){R(65499),R(132),M(0);for(var e=0;e<64;e++)M(s[e]);M(1);for(var t=0;t<64;t++)M(o[t])}(),function(e,t){R(65472),R(17),M(8),R(t),R(e),M(3),M(1),M(17),M(0),M(2),M(17),M(1),M(3),M(17),M(1)}(e.width,e.height),function(){R(65476),R(418),M(0);for(var e=0;e<16;e++)M(y[e+1]);for(var t=0;t<=11;t++)M(_[t]);M(16);for(var A=0;A<16;A++)M(b[A+1]);for(var i=0;i<=161;i++)M(D[i]);M(1);for(var r=0;r<16;r++)M(k[r+1]);for(var n=0;n<=11;n++)M(v[n]);M(17);for(var a=0;a<16;a++)M(x[a+1]);for(var s=0;s<=161;s++)M(S[s])}(),R(65498),R(12),M(3),M(1),M(0),M(2),M(17),M(3),M(17),M(0),M(63),M(0);var h=0,c=0,f=0;I=0,B=7,this.encode.displayName="_encode_";for(var d,Q,p,G,T,N,P,O,z,K=e.data,H=e.width,q=e.height,J=4*H,Y=0;Y<q;){for(d=0;d<J;){for(N=T=J*Y+d,P=-1,O=0,z=0;z<64;z++)N=T+(O=z>>3)*J+(P=4*(7&z)),Y+O>=q&&(N-=J*(Y+1+O-q)),d+P>=J&&(N-=d+P-J+4),Q=K[N++],p=K[N++],G=K[N++],C[z]=(m[Q]+m[p+256>>0]+m[G+512>>0]>>16)-128,E[z]=(m[Q+768>>0]+m[p+1024>>0]+m[G+1280>>0]>>16)-128,w[z]=(m[Q+1280>>0]+m[p+1536>>0]+m[G+1792>>0]>>16)-128;h=F(C,l,h,t,i),c=F(E,g,c,A,r),f=F(w,g,f,A,r),d+=32}Y+=8}if(B>=0){var V=[];V[1]=B+1,V[0]=(1<<B+1)-1,U(V)}return R(65497),Buffer.from(u)},(new Date).getTime(),e||(e=50),function(){for(var e=String.fromCharCode,t=0;t<256;t++)Q[t]=e(t)}(),t=G(y,_),A=G(k,v),i=G(b,D),r=G(x,S),function(){for(var e=1,t=2,A=1;A<=15;A++){for(var i=e;i<t;i++)c[32767+i]=A,h[32767+i]=[],h[32767+i][1]=A,h[32767+i][0]=i;for(var r=-(t-1);r<=-e;r++)c[32767+r]=A,h[32767+r]=[],h[32767+r][1]=A,h[32767+r][0]=t-1+r;e<<=1,t<<=1}}(),function(){for(var e=0;e<256;e++)m[e]=19595*e,m[e+256>>0]=38470*e,m[e+512>>0]=7471*e+32768,m[e+768>>0]=-11059*e,m[e+1024>>0]=-21709*e,m[e+1280>>0]=32768*e+8421375,m[e+1536>>0]=-27439*e,m[e+1792>>0]=-5329*e}(),L(e),(new Date).getTime()}wi.exports=function(e,A){void 0===A&&(A=50);var i=new t(A),r=i.encode(e,A);return{data:r,width:e.width,height:e.height}}}();var Qi=wi.exports,mi={exports:{}};!function(e){var t=function(){var e=new Int32Array([0,1,8,16,9,2,3,10,17,24,32,25,18,11,4,5,12,19,26,33,40,48,41,34,27,20,13,6,7,14,21,28,35,42,49,56,57,50,43,36,29,22,15,23,30,37,44,51,58,59,52,45,38,31,39,46,53,60,61,54,47,55,62,63]),t=4017,A=799,i=3406,r=2276,n=1567,a=3784,s=5793,o=2896;function l(){}function g(e,t){for(var A,i,r=0,n=[],a=16;a>0&&!e[a-1];)a--;n.push({children:[],index:0});var s,o=n[0];for(A=0;A<a;A++){for(i=0;i<e[A];i++){for((o=n.pop()).children[o.index]=t[r];o.index>0;){if(0===n.length)throw new Error("Could not recreate Huffman Table");o=n.pop()}for(o.index++,n.push(o);n.length<=A;)n.push(s={children:[],index:0}),o.children[o.index]=s.children,o=s;r++}A+1<a&&(n.push(s={children:[],index:0}),o.children[o.index]=s.children,o=s)}return n[0].children}function h(t,A,i,r,n,a,s,o,l,g){i.precision,i.samplesPerLine,i.scanLines;var h=i.mcusPerLine,c=i.progressive;i.maxH,i.maxV;var f=A,d=0,u=0;function I(){if(u>0)return u--,d>>u&1;if(255==(d=t[A++])){var e=t[A++];if(e)throw new Error("unexpected marker: "+(d<<8|e).toString(16))}return u=7,d>>>7}function B(e){for(var t,A=e;null!==(t=I());){if("number"==typeof(A=A[t]))return A;if("object"!=typeof A)throw new Error("invalid huffman sequence")}return null}function C(e){for(var t=0;e>0;){var A=I();if(null===A)return;t=t<<1|A,e--}return t}function E(e){var t=C(e);return t>=1<<e-1?t:t+(-1<<e)+1}var w=0;var Q,m=0;function p(e,t,A,i,r){var n=A%h,a=(A/h|0)*e.v+i,s=n*e.h+r;void 0===e.blocks[a]&&g.tolerantDecoding||t(e,e.blocks[a][s])}function y(e,t,A){var i=A/e.blocksPerLine|0,r=A%e.blocksPerLine;void 0===e.blocks[i]&&g.tolerantDecoding||t(e,e.blocks[i][r])}var _,b,D,k,v,x,S=r.length;x=c?0===a?0===o?function(e,t){var A=B(e.huffmanTableDC),i=0===A?0:E(A)<<l;t[0]=e.pred+=i}:function(e,t){t[0]|=I()<<l}:0===o?function(t,A){if(w>0)w--;else for(var i=a,r=s;i<=r;){var n=B(t.huffmanTableAC),o=15&n,g=n>>4;if(0!==o)A[e[i+=g]]=E(o)*(1<<l),i++;else{if(g<15){w=C(g)+(1<<g)-1;break}i+=16}}}:function(t,A){for(var i=a,r=s,n=0;i<=r;){var o=e[i],g=A[o]<0?-1:1;switch(m){case 0:var h=B(t.huffmanTableAC),c=15&h;if(n=h>>4,0===c)n<15?(w=C(n)+(1<<n),m=4):(n=16,m=1);else{if(1!==c)throw new Error("invalid ACn encoding");Q=E(c),m=n?2:3}continue;case 1:case 2:A[o]?A[o]+=(I()<<l)*g:0==--n&&(m=2==m?3:0);break;case 3:A[o]?A[o]+=(I()<<l)*g:(A[o]=Q<<l,m=0);break;case 4:A[o]&&(A[o]+=(I()<<l)*g)}i++}4===m&&0==--w&&(m=0)}:function(t,A){var i=B(t.huffmanTableDC),r=0===i?0:E(i);A[0]=t.pred+=r;for(var n=1;n<64;){var a=B(t.huffmanTableAC),s=15&a,o=a>>4;if(0!==s)A[e[n+=o]]=E(s),n++;else{if(o<15)break;n+=16}}};var G,U,M,R,F=0;for(U=1==S?r[0].blocksPerLine*r[0].blocksPerColumn:h*i.mcusPerColumn,n||(n=U);F<U;){for(b=0;b<S;b++)r[b].pred=0;if(w=0,1==S)for(_=r[0],v=0;v<n;v++)y(_,x,F),F++;else for(v=0;v<n;v++){for(b=0;b<S;b++)for(M=(_=r[b]).h,R=_.v,D=0;D<R;D++)for(k=0;k<M;k++)p(_,x,F,D,k);if(++F===U)break}if(F===U)do{if(255===t[A]&&0!==t[A+1])break;A+=1}while(A<t.length-2);if(u=0,(G=t[A]<<8|t[A+1])<65280)throw new Error("marker was not found");if(!(G>=65488&&G<=65495))break;A+=2}return A-f}function c(e,l){var g,h,c=[],f=l.blocksPerLine,d=l.blocksPerColumn,u=f<<3,B=new Int32Array(64),C=new Uint8Array(64);function E(e,g,h){var c,f,d,u,I,B,C,E,w,Q,m=l.quantizationTable,p=h;for(Q=0;Q<64;Q++)p[Q]=e[Q]*m[Q];for(Q=0;Q<8;++Q){var y=8*Q;0!=p[1+y]||0!=p[2+y]||0!=p[3+y]||0!=p[4+y]||0!=p[5+y]||0!=p[6+y]||0!=p[7+y]?(c=s*p[0+y]+128>>8,f=s*p[4+y]+128>>8,d=p[2+y],u=p[6+y],I=o*(p[1+y]-p[7+y])+128>>8,E=o*(p[1+y]+p[7+y])+128>>8,B=p[3+y]<<4,C=p[5+y]<<4,w=c-f+1>>1,c=c+f+1>>1,f=w,w=d*a+u*n+128>>8,d=d*n-u*a+128>>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]=b<0?0:b>255?255:b}}I(u*d*8);for(var w=0;w<d;w++){var Q=w<<3;for(g=0;g<8;g++)c.push(new Uint8Array(u));for(var m=0;m<f;m++){E(l.blocks[w][m],C,B);var p=0,y=m<<3;for(h=0;h<8;h++){var _=c[Q+h];for(g=0;g<8;g++)_[y+g]=C[p++]}}}return c}function f(e){return e<0?0:e>255?255:e}l.prototype={load:function(e){var t=new XMLHttpRequest;t.open("GET",e,!0),t.responseType="arraybuffer",t.onload=function(){var e=new Uint8Array(t.response||t.mozResponseArrayBuffer);this.parse(e),this.onload&&this.onload()}.bind(this),t.send(null)},parse:function(t){var A=1e3*this.opts.maxResolutionInMP*1e3,i=0;function r(){var e=t[i]<<8|t[i+1];return i+=2,e}function n(e){var t,A,i=1,r=1;for(A in e.components)e.components.hasOwnProperty(A)&&(i<(t=e.components[A]).h&&(i=t.h),r<t.v&&(r=t.v));var n=Math.ceil(e.samplesPerLine/8/i),a=Math.ceil(e.scanLines/8/r);for(A in e.components)if(e.components.hasOwnProperty(A)){t=e.components[A];var s=Math.ceil(Math.ceil(e.samplesPerLine/8)*t.h/i),o=Math.ceil(Math.ceil(e.scanLines/8)*t.v/r),l=n*t.h,g=a*t.v,h=[];I(256*(g*l));for(var c=0;c<g;c++){for(var f=[],d=0;d<l;d++)f.push(new Int32Array(64));h.push(f)}t.blocksPerLine=s,t.blocksPerColumn=o,t.blocks=h}e.maxH=i,e.maxV=r,e.mcusPerLine=n,e.mcusPerColumn=a}t.length;var a,s,o,l,f=null,d=null,u=[],B=[],C=[],E=[],w=r(),Q=-1;if(this.comments=[],65496!=w)throw new Error("SOI not found");for(w=r();65497!=w;){switch(w){case 65280:break;case 65504:case 65505:case 65506:case 65507:case 65508:case 65509:case 65510:case 65511:case 65512:case 65513:case 65514:case 65515:case 65516:case 65517:case 65518:case 65519:case 65534:var m=(o=void 0,l=void 0,o=r(),l=t.subarray(i,i+o-2),i+=l.length,l);if(65534===w){var p=String.fromCharCode.apply(null,m);this.comments.push(p)}65504===w&&74===m[0]&&70===m[1]&&73===m[2]&&70===m[3]&&0===m[4]&&(f={version:{major:m[5],minor:m[6]},densityUnits:m[7],xDensity:m[8]<<8|m[9],yDensity:m[10]<<8|m[11],thumbWidth:m[12],thumbHeight:m[13],thumbData:m.subarray(14,14+3*m[12]*m[13])}),65505===w&&69===m[0]&&120===m[1]&&105===m[2]&&102===m[3]&&0===m[4]&&(this.exifBuffer=m.subarray(5,m.length)),65518===w&&65===m[0]&&100===m[1]&&111===m[2]&&98===m[3]&&101===m[4]&&0===m[5]&&(d={version:m[6],flags0:m[7]<<8|m[8],flags1:m[9]<<8|m[10],transformCode:m[11]});break;case 65499:for(var y=r()+i-2;i<y;){var _=t[i++];I(256);var b=new Int32Array(64);if(_>>4==0)for(V=0;V<64;V++){b[e[V]]=t[i++]}else{if(_>>4!=1)throw new Error("DQT: invalid table spec");for(V=0;V<64;V++){b[e[V]]=r()}}u[15&_]=b}break;case 65472:case 65473:case 65474:r(),(a={}).extended=65473===w,a.progressive=65474===w,a.precision=t[i++],a.scanLines=r(),a.samplesPerLine=r(),a.components={},a.componentsOrder=[];var D=a.scanLines*a.samplesPerLine;if(D>A){var k=Math.ceil((D-A)/1e6);throw new Error(`maxResolutionInMP limit exceeded by ${k}MP`)}var v,x=t[i++];for(J=0;J<x;J++){v=t[i];var S=t[i+1]>>4,G=15&t[i+1],U=t[i+2];if(S<=0||G<=0)throw new Error("Invalid sampling factor, expected values above 0");a.componentsOrder.push(v),a.components[v]={h:S,v:G,quantizationIdx:U},i+=3}n(a),B.push(a);break;case 65476:var M=r();for(J=2;J<M;){var R=t[i++],F=new Uint8Array(16),L=0;for(V=0;V<16;V++,i++)L+=F[V]=t[i];I(16+L);var T=new Uint8Array(L);for(V=0;V<L;V++,i++)T[V]=t[i];J+=17+L,(R>>4==0?E:C)[15&R]=g(F,T)}break;case 65501:r(),s=r();break;case 65500:r(),r();break;case 65498:r();var N=t[i++],P=[];for(J=0;J<N;J++){Z=a.components[t[i++]];var O=t[i++];Z.huffmanTableDC=E[O>>4],Z.huffmanTableAC=C[15&O],P.push(Z)}var z=t[i++],K=t[i++],H=t[i++],q=h(t,i,a,P,s,z,K,H>>4,15&H,this.opts);i+=q;break;case 65535:255!==t[i]&&i--;break;default:if(255==t[i-3]&&t[i-2]>=192&&t[i-2]<=254){i-=3;break}if(224===w||225==w){if(-1!==Q)throw new Error(`first unknown JPEG marker at offset ${Q.toString(16)}, second unknown JPEG marker ${w.toString(16)} at offset ${(i-1).toString(16)}`);Q=i-1;const e=r();if(255===t[i+e-2]){i+=e-2;break}}throw new Error("unknown JPEG marker "+w.toString(16))}w=r()}if(1!=B.length)throw new Error("only single frame JPEGs supported");for(var J=0;J<B.length;J++){var Y=B[J].components;for(var V in Y)Y[V].quantizationTable=u[Y[V].quantizationIdx],delete Y[V].quantizationIdx}this.width=a.samplesPerLine,this.height=a.scanLines,this.jfif=f,this.adobe=d,this.components=[];for(J=0;J<a.componentsOrder.length;J++){var Z=a.components[a.componentsOrder[J]];this.components.push({lines:c(0,Z),scaleX:Z.h/a.maxH,scaleY:Z.v/a.maxV})}},getData:function(e,t){var A,i,r,n,a,s,o,l,g,h,c,d,u,B,C,E,w,Q,m,p,y,_=this.width/e,b=this.height/t,D=0,k=e*t*this.components.length;I(k);var v=new Uint8Array(k);switch(this.components.length){case 1:for(A=this.components[0],h=0;h<t;h++)for(a=A.lines[0|h*A.scaleY*b],g=0;g<e;g++)c=a[0|g*A.scaleX*_],v[D++]=c;break;case 2:for(A=this.components[0],i=this.components[1],h=0;h<t;h++)for(a=A.lines[0|h*A.scaleY*b],s=i.lines[0|h*i.scaleY*b],g=0;g<e;g++)c=a[0|g*A.scaleX*_],v[D++]=c,c=s[0|g*i.scaleX*_],v[D++]=c;break;case 3:for(y=!0,this.adobe&&this.adobe.transformCode?y=!0:void 0!==this.opts.colorTransform&&(y=!!this.opts.colorTransform),A=this.components[0],i=this.components[1],r=this.components[2],h=0;h<t;h++)for(a=A.lines[0|h*A.scaleY*b],s=i.lines[0|h*i.scaleY*b],o=r.lines[0|h*r.scaleY*b],g=0;g<e;g++)y?(c=a[0|g*A.scaleX*_],d=s[0|g*i.scaleX*_],Q=f(c+1.402*((u=o[0|g*r.scaleX*_])-128)),m=f(c-.3441363*(d-128)-.71413636*(u-128)),p=f(c+1.772*(d-128))):(Q=a[0|g*A.scaleX*_],m=s[0|g*i.scaleX*_],p=o[0|g*r.scaleX*_]),v[D++]=Q,v[D++]=m,v[D++]=p;break;case 4:if(!this.adobe)throw new Error("Unsupported color mode (4 components)");for(y=!1,this.adobe&&this.adobe.transformCode?y=!0:void 0!==this.opts.colorTransform&&(y=!!this.opts.colorTransform),A=this.components[0],i=this.components[1],r=this.components[2],n=this.components[3],h=0;h<t;h++)for(a=A.lines[0|h*A.scaleY*b],s=i.lines[0|h*i.scaleY*b],o=r.lines[0|h*r.scaleY*b],l=n.lines[0|h*n.scaleY*b],g=0;g<e;g++)y?(c=a[0|g*A.scaleX*_],d=s[0|g*i.scaleX*_],u=o[0|g*r.scaleX*_],B=l[0|g*n.scaleX*_],C=255-f(c+1.402*(u-128)),E=255-f(c-.3441363*(d-128)-.71413636*(u-128)),w=255-f(c+1.772*(d-128))):(C=a[0|g*A.scaleX*_],E=s[0|g*i.scaleX*_],w=o[0|g*r.scaleX*_],B=l[0|g*n.scaleX*_]),v[D++]=255-C,v[D++]=255-E,v[D++]=255-w,v[D++]=255-B;break;default:throw new Error("Unsupported color mode")}return v},copyToImageData:function(e,t){var A,i,r,n,a,s,o,l,g,h=e.width,c=e.height,d=e.data,u=this.getData(h,c),I=0,B=0;switch(this.components.length){case 1:for(i=0;i<c;i++)for(A=0;A<h;A++)r=u[I++],d[B++]=r,d[B++]=r,d[B++]=r,t&&(d[B++]=255);break;case 3:for(i=0;i<c;i++)for(A=0;A<h;A++)o=u[I++],l=u[I++],g=u[I++],d[B++]=o,d[B++]=l,d[B++]=g,t&&(d[B++]=255);break;case 4:for(i=0;i<c;i++)for(A=0;A<h;A++)a=u[I++],s=u[I++],r=u[I++],o=255-f(a*(1-(n=u[I++])/255)+n),l=255-f(s*(1-n/255)+n),g=255-f(r*(1-n/255)+n),d[B++]=o,d[B++]=l,d[B++]=g,t&&(d[B++]=255);break;default:throw new Error("Unsupported color mode")}}};var d=0,u=0;function I(e=0){var t=d+e;if(t>u){var A=Math.ceil((t-u)/1024/1024);throw new Error(`maxMemoryUsageInMB limit exceeded by at least ${A}MB`)}d=t}return l.resetMaxMemoryUsage=function(e){d=0,u=e},l.getBytesAllocated=function(){return d},l.requestMemoryAllocation=I,l}();e.exports=function(e,A={}){var i={colorTransform:void 0,useTArray:!1,formatAsRGBA:!0,tolerantDecoding:!0,maxResolutionInMP:100,maxMemoryUsageInMB:512,...A},r=new Uint8Array(e),n=new t;n.opts=i,t.resetMaxMemoryUsage(1024*i.maxMemoryUsageInMB*1024),n.parse(r);var a=i.formatAsRGBA?4:3,s=n.width*n.height*a;try{t.requestMemoryAllocation(s);var o={width:n.width,height:n.height,exifBuffer:n.exifBuffer,data:i.useTArray?new Uint8Array(s):Buffer.alloc(s)};n.comments.length>0&&(o.comments=n.comments)}catch(e){if(e instanceof RangeError)throw new Error("Could not allocate enough memory for the image. Required: "+s);if(e instanceof ReferenceError&&"Buffer is not defined"===e.message)throw new Error("Buffer is not globally defined in this environment. Consider setting useTArray to true");throw e}return n.copyToImageData(o,i.formatAsRGBA),o}}(mi);var pi=Ei({encode:Qi,decode:mi.exports});const yi=Math.PI,_i=yi/4,bi=180/yi;function Di(e,t){let A=e.length-t,i=0;do{for(let A=t;A>0;A--)e[i+t]+=e[i],i++;A-=t}while(A>0)}function ki(e,t,A){let i=0,r=e.length;const n=r/A;for(;r>t;){for(let A=t;A>0;--A)e[i+t]+=e[i],++i;r-=t}const a=e.slice();for(let t=0;t<n;++t)for(let i=0;i<A;++i)e[A*t+i]=a[(A-i-1)*n+t]}let vi=class{async decode(e,t){const A=await this.decodeBlock(t),i=e.Predictor||1;if(1!==i){const t=!e.StripOffsets;return function(e,t,A,i,r,n){if(!t||1===t)return e;for(let e=0;e<r.length;++e){if(r[e]%8!=0)throw new Error("When decoding with predictor, only multiple of 8 bits are supported.");if(r[e]!==r[0])throw new Error("When decoding with predictor, all samples must have the same size.")}const a=r[0]/8,s=2===n?1:r.length;for(let n=0;n<i&&!(n*s*A*a>=e.byteLength);++n){let i;if(2===t){switch(r[0]){case 8:i=new Uint8Array(e,n*s*A*a,s*A*a);break;case 16:i=new Uint16Array(e,n*s*A*a,s*A*a/2);break;case 32:i=new Uint32Array(e,n*s*A*a,s*A*a/4);break;default:throw new Error(`Predictor 2 not allowed with ${r[0]} bits per sample.`)}Di(i,s)}else 3===t&&(i=new Uint8Array(e,n*s*A*a,s*A*a),ki(i,s,a))}return e}(A,i,t?e.TileWidth:e.ImageWidth,t?e.TileLength:e.RowsPerStrip||e.ImageLength,e.BitsPerSample,e.PlanarConfiguration)}return A}};const xi=257;function Si(e,t){for(let A=t.length-1;A>=0;A--)e.push(t[A]);return e}function Gi(e){const t=new Uint16Array(4093),A=new Uint8Array(4093);for(let e=0;e<=257;e++)t[e]=4096,A[e]=e;let i=258,r=9,n=0;function a(){i=258,r=9}function s(e){const t=function(e,t,A){const i=t%8,r=Math.floor(t/8),n=8-i,a=t+A-8*(r+1);let s=8*(r+2)-(t+A);const o=8*(r+2)-t;if(s=Math.max(0,s),r>=e.length)return console.warn("ran off the end of the buffer before finding EOI_CODE (end on input code)"),xi;let l=e[r]&2**(8-i)-1;l<<=A-n;let g=l;if(r+1<e.length){let t=e[r+1]>>>s;t<<=Math.max(0,A-o),g+=t}if(a>8&&r+2<e.length){const i=8*(r+3)-(t+A);g+=e[r+2]>>>i}return g}(e,n,r);return n+=r,t}function o(e,r){return A[i]=r,t[i]=e,i++,i-1}function l(e){const i=[];for(let r=e;4096!==r;r=t[r])i.push(A[r]);return i}const g=[];a();const h=new Uint8Array(e);let c,f=s(h);for(;f!==xi;){if(256===f){for(a(),f=s(h);256===f;)f=s(h);if(f===xi)break;if(f>256)throw new Error(`corrupted code at scanline ${f}`);Si(g,l(f)),c=f}else if(f<i){const e=l(f);Si(g,e),o(c,e[e.length-1]),c=f}else{const e=l(c);if(!e)throw new Error(`Bogus entry. Not in dictionary,\n ${c} / ${i},\n position: ${n}`);Si(g,e),g.push(e[e.length-1]),o(c,e[e.length-1]),c=f}i+1>=2**r&&(12===r?c=void 0:r++),f=s(h)}return new Uint8Array(g)}let Ui=class extends vi{decodeBlock(e){return Gi(e).buffer}};function Mi(e){return(t,...A)=>Fi(e,t,A)}function Ri(e,t){return Mi(Pi(e,t).get)}const{apply:Fi,construct:Li,defineProperty:Ti,get:Ni,getOwnPropertyDescriptor:Pi,getPrototypeOf:Oi,has:zi,ownKeys:Ki,set:Hi,setPrototypeOf:qi}=Reflect,{iterator:Ji,species:Yi,toStringTag:Vi,for:Zi}=Symbol,ji=Object,{create:Xi,defineProperty:Wi,freeze:$i,is:er}=ji,tr=Array.prototype[Ji],Ar=Mi(tr),ir=ArrayBuffer;Ri(ir.prototype,"byteLength");const rr="undefined"!=typeof SharedArrayBuffer?SharedArrayBuffer:null;rr&&Ri(rr.prototype,"byteLength");const nr=Oi(Uint8Array);nr.from;const ar=nr.prototype;ar[Ji],Mi(ar.keys),Mi(ar.values),Mi(ar.entries),Mi(ar.set),Mi(ar.reverse),Mi(ar.fill),Mi(ar.copyWithin),Mi(ar.sort),Mi(ar.slice),Mi(ar.subarray),Ri(ar,"buffer"),Ri(ar,"byteOffset"),Ri(ar,"length"),Ri(ar,Vi);const sr=Uint32Array,or=Float32Array,lr=Oi([][Ji]()),gr=Mi(lr.next),hr=Mi(function*(){}().next),cr=Oi(lr),fr=Mi(DataView.prototype.getUint16),dr=WeakMap,ur=dr.prototype,Ir=Mi(ur.get),Br=Mi(ur.set),Cr=new dr,Er=Xi(null,{next:{value:function(){const e=Ir(Cr,this);return gr(e)}},[Ji]:{value:function(){return this}}});const wr=new dr,Qr=Xi(cr,{next:{value:function(){const e=Ir(wr,this);return hr(e)},writable:!0,configurable:!0}});for(const e of Ki(lr))"next"!==e&&Wi(Qr,e,Pi(lr,e));const mr=new ir(4),pr=new or(mr),yr=new sr(mr),_r=new sr(512),br=new sr(512);for(let e=0;e<256;++e){const t=e-127;t<-27?(_r[e]=0,_r[256|e]=32768,br[e]=24,br[256|e]=24):t<-14?(_r[e]=1024>>-t-14,_r[256|e]=1024>>-t-14|32768,br[e]=-t-1,br[256|e]=-t-1):t<=15?(_r[e]=t+15<<10,_r[256|e]=t+15<<10|32768,br[e]=13,br[256|e]=13):t<128?(_r[e]=31744,_r[256|e]=64512,br[e]=24,br[256|e]=24):(_r[e]=31744,_r[256|e]=64512,br[e]=13,br[256|e]=13)}const Dr=new sr(2048),kr=new sr(64),vr=new sr(64);for(let e=1;e<1024;++e){let t=e<<13,A=0;for(;0==(8388608&t);)t<<=1,A-=8388608;t&=-8388609,A+=947912704,Dr[e]=t|A}for(let e=1024;e<2048;++e)Dr[e]=939524096+(e-1024<<13);for(let e=1;e<31;++e)kr[e]=e<<23;kr[31]=1199570944,kr[32]=2147483648;for(let e=33;e<63;++e)kr[e]=2147483648+(e-32<<23);kr[63]=3347054592;for(let e=1;e<64;++e)32!==e&&(vr[e]=1024);function xr(e,t,...A){return function(e){const t=e>>10;return yr[0]=Dr[vr[t]+(1023&e)]+kr[t],pr[0]}(fr(e,t,...function(e){if(e[Ji]===tr&&lr.next===gr)return e;const t=Xi(Er);return Br(Cr,t,Ar(e)),t}(A)))}var Sr={exports:{}};function Gr(e,t,A){const i=A&&A.debug||!1;i&&console.log("[xml-utils] getting "+t+" in "+e);const r="object"==typeof e?e.outer:e,n=r.slice(0,r.indexOf(">")+1),a=['"',"'"];for(let e=0;e<a.length;e++){const A=a[e],r=t+"\\="+A+"([^"+A+"]*)"+A;i&&console.log("[xml-utils] pattern:",r);const s=new RegExp(r).exec(n);if(i&&console.log("[xml-utils] match:",s),s)return s[1]}}Sr.exports=Gr,Sr.exports.default=Gr;var Ur=Ei(Sr.exports),Mr={exports:{}},Rr={exports:{}},Fr={exports:{}};function Lr(e,t,A){const i=new RegExp(t).exec(e.slice(A));return i?A+i.index:-1}Fr.exports=Lr,Fr.exports.default=Lr;var Tr=Fr.exports,Nr={exports:{}};function Pr(e,t,A){const i=new RegExp(t).exec(e.slice(A));return i?A+i.index+i[0].length-1:-1}Nr.exports=Pr,Nr.exports.default=Pr;var Or=Nr.exports,zr={exports:{}};function Kr(e,t){const A=new RegExp(t,"g"),i=e.match(A);return i?i.length:0}zr.exports=Kr,zr.exports.default=Kr;var Hr=zr.exports;const qr=Tr,Jr=Or,Yr=Hr;function Vr(e,t,A){const i=A&&A.debug||!1,r=!(A&&!1===typeof A.nested),n=A&&A.startIndex||0;i&&console.log("[xml-utils] starting findTagByName with",t," and ",A);const a=qr(e,`<${t}[ \n>/]`,n);if(i&&console.log("[xml-utils] start:",a),-1===a)return;const s=e.slice(a+t.length);let o=Jr(s,"^[^<]*[ /]>",0);const l=-1!==o&&"/"===s[o-1];if(i&&console.log("[xml-utils] selfClosing:",l),!1===l)if(r){let e=0,A=1,i=0;for(;-1!==(o=Jr(s,"[ /]"+t+">",e));){const r=s.substring(e,o+1);if(A+=Yr(r,"<"+t+"[ \n\t>]"),i+=Yr(r,"</"+t+">"),i>=A)break;e=o}}else o=Jr(s,"[ /]"+t+">",0);const g=a+t.length+o+1;if(i&&console.log("[xml-utils] end:",g),-1===g)return;const h=e.slice(a,g);let c;return c=l?null:h.slice(h.indexOf(">")+1,h.lastIndexOf("<")),{inner:c,outer:h,start:a,end:g}}Rr.exports=Vr,Rr.exports.default=Vr;const Zr=Rr.exports;function jr(e,t,A){const i=[],r=A&&A.debug||!1,n=!A||"boolean"!=typeof A.nested||A.nested;let a,s=A&&A.startIndex||0;for(;a=Zr(e,t,{debug:r,startIndex:s});)s=n?a.start+1+t.length:a.end,i.push(a);return r&&console.log("findTagsByName found",i.length,"tags"),i}Mr.exports=jr,Mr.exports.default=jr;var Xr=Ei(Mr.exports);const Wr={315:"Artist",258:"BitsPerSample",265:"CellLength",264:"CellWidth",320:"ColorMap",259:"Compression",33432:"Copyright",306:"DateTime",338:"ExtraSamples",266:"FillOrder",289:"FreeByteCounts",288:"FreeOffsets",291:"GrayResponseCurve",290:"GrayResponseUnit",316:"HostComputer",270:"ImageDescription",257:"ImageLength",256:"ImageWidth",271:"Make",281:"MaxSampleValue",280:"MinSampleValue",272:"Model",254:"NewSubfileType",274:"Orientation",262:"PhotometricInterpretation",284:"PlanarConfiguration",296:"ResolutionUnit",278:"RowsPerStrip",277:"SamplesPerPixel",305:"Software",279:"StripByteCounts",273:"StripOffsets",255:"SubfileType",263:"Threshholding",282:"XResolution",283:"YResolution",326:"BadFaxLines",327:"CleanFaxData",343:"ClipPath",328:"ConsecutiveBadFaxLines",433:"Decode",434:"DefaultImageColor",269:"DocumentName",336:"DotRange",321:"HalftoneHints",346:"Indexed",347:"JPEGTables",285:"PageName",297:"PageNumber",317:"Predictor",319:"PrimaryChromaticities",532:"ReferenceBlackWhite",339:"SampleFormat",340:"SMinSampleValue",341:"SMaxSampleValue",559:"StripRowCounts",330:"SubIFDs",292:"T4Options",293:"T6Options",325:"TileByteCounts",323:"TileLength",324:"TileOffsets",322:"TileWidth",301:"TransferFunction",318:"WhitePoint",344:"XClipPathUnits",286:"XPosition",529:"YCbCrCoefficients",531:"YCbCrPositioning",530:"YCbCrSubSampling",345:"YClipPathUnits",287:"YPosition",37378:"ApertureValue",40961:"ColorSpace",36868:"DateTimeDigitized",36867:"DateTimeOriginal",34665:"Exif IFD",36864:"ExifVersion",33434:"ExposureTime",41728:"FileSource",37385:"Flash",40960:"FlashpixVersion",33437:"FNumber",42016:"ImageUniqueID",37384:"LightSource",37500:"MakerNote",37377:"ShutterSpeedValue",37510:"UserComment",33723:"IPTC",34675:"ICC Profile",700:"XMP",42112:"GDAL_METADATA",42113:"GDAL_NODATA",34377:"Photoshop",33550:"ModelPixelScale",33922:"ModelTiepoint",34264:"ModelTransformation",34735:"GeoKeyDirectory",34736:"GeoDoubleParams",34737:"GeoAsciiParams",50674:"LercParameters"},$r={};for(const e in Wr)Wr.hasOwnProperty(e)&&($r[Wr[e]]=parseInt(e,10));const en=[$r.BitsPerSample,$r.ExtraSamples,$r.SampleFormat,$r.StripByteCounts,$r.StripOffsets,$r.StripRowCounts,$r.TileByteCounts,$r.TileOffsets,$r.SubIFDs],tn={1:"BYTE",2:"ASCII",3:"SHORT",4:"LONG",5:"RATIONAL",6:"SBYTE",7:"UNDEFINED",8:"SSHORT",9:"SLONG",10:"SRATIONAL",11:"FLOAT",12:"DOUBLE",13:"IFD",16:"LONG8",17:"SLONG8",18:"IFD8"},An={};for(const e in tn)tn.hasOwnProperty(e)&&(An[tn[e]]=parseInt(e,10));const rn=0,nn=1,an=2,sn=3,on=5,ln=6,gn=8,hn=0,cn=1,fn=0,dn=1,un=2,In={1024:"GTModelTypeGeoKey",1025:"GTRasterTypeGeoKey",1026:"GTCitationGeoKey",2048:"GeographicTypeGeoKey",2049:"GeogCitationGeoKey",2050:"GeogGeodeticDatumGeoKey",2051:"GeogPrimeMeridianGeoKey",2052:"GeogLinearUnitsGeoKey",2053:"GeogLinearUnitSizeGeoKey",2054:"GeogAngularUnitsGeoKey",2055:"GeogAngularUnitSizeGeoKey",2056:"GeogEllipsoidGeoKey",2057:"GeogSemiMajorAxisGeoKey",2058:"GeogSemiMinorAxisGeoKey",2059:"GeogInvFlatteningGeoKey",2060:"GeogAzimuthUnitsGeoKey",2061:"GeogPrimeMeridianLongGeoKey",2062:"GeogTOWGS84GeoKey",3072:"ProjectedCSTypeGeoKey",3073:"PCSCitationGeoKey",3074:"ProjectionGeoKey",3075:"ProjCoordTransGeoKey",3076:"ProjLinearUnitsGeoKey",3077:"ProjLinearUnitSizeGeoKey",3078:"ProjStdParallel1GeoKey",3079:"ProjStdParallel2GeoKey",3080:"ProjNatOriginLongGeoKey",3081:"ProjNatOriginLatGeoKey",3082:"ProjFalseEastingGeoKey",3083:"ProjFalseNorthingGeoKey",3084:"ProjFalseOriginLongGeoKey",3085:"ProjFalseOriginLatGeoKey",3086:"ProjFalseOriginEastingGeoKey",3087:"ProjFalseOriginNorthingGeoKey",3088:"ProjCenterLongGeoKey",3089:"ProjCenterLatGeoKey",3090:"ProjCenterEastingGeoKey",3091:"ProjCenterNorthingGeoKey",3092:"ProjScaleAtNatOriginGeoKey",3093:"ProjScaleAtCenterGeoKey",3094:"ProjAzimuthAngleGeoKey",3095:"ProjStraightVertPoleLongGeoKey",3096:"ProjRectifiedGridAngleGeoKey",4096:"VerticalCSTypeGeoKey",4097:"VerticalCitationGeoKey",4098:"VerticalDatumGeoKey",4099:"VerticalUnitsGeoKey"};const Bn=new Map;function Cn(e,t){Array.isArray(e)||(e=[e]),e.forEach((e=>Bn.set(e,t)))}function En(e,t,A,i=1){return new(Object.getPrototypeOf(e).constructor)(t*A*i)}function wn(e,t,A){return(1-A)*e+A*t}function Qn(e,t,A,i,r,n="nearest"){switch(n.toLowerCase()){case"nearest":return function(e,t,A,i,r){const n=t/i,a=A/r;return e.map((e=>{const s=En(e,i,r);for(let o=0;o<r;++o){const r=Math.min(Math.round(a*o),A-1);for(let A=0;A<i;++A){const a=Math.min(Math.round(n*A),t-1),l=e[r*t+a];s[o*i+A]=l}}return s}))}(e,t,A,i,r);case"bilinear":case"linear":return function(e,t,A,i,r){const n=t/i,a=A/r;return e.map((e=>{const s=En(e,i,r);for(let o=0;o<r;++o){const r=a*o,l=Math.floor(r),g=Math.min(Math.ceil(r),A-1);for(let A=0;A<i;++A){const a=n*A,h=a%1,c=Math.floor(a),f=Math.min(Math.ceil(a),t-1),d=e[l*t+c],u=e[l*t+f],I=e[g*t+c],B=e[g*t+f],C=wn(wn(d,u,h),wn(I,B,h),r%1);s[o*i+A]=C}}return s}))}(e,t,A,i,r);default:throw new Error(`Unsupported resampling method: '${n}'`)}}function mn(e,t,A,i,r,n,a="nearest"){switch(a.toLowerCase()){case"nearest":return function(e,t,A,i,r,n){const a=t/i,s=A/r,o=En(e,i,r,n);for(let l=0;l<r;++l){const r=Math.min(Math.round(s*l),A-1);for(let A=0;A<i;++A){const s=Math.min(Math.round(a*A),t-1);for(let a=0;a<n;++a){const g=e[r*t*n+s*n+a];o[l*i*n+A*n+a]=g}}}return o}(e,t,A,i,r,n);case"bilinear":case"linear":return function(e,t,A,i,r,n){const a=t/i,s=A/r,o=En(e,i,r,n);for(let l=0;l<r;++l){const r=s*l,g=Math.floor(r),h=Math.min(Math.ceil(r),A-1);for(let A=0;A<i;++A){const s=a*A,c=s%1,f=Math.floor(s),d=Math.min(Math.ceil(s),t-1);for(let a=0;a<n;++a){const s=e[g*t*n+f*n+a],u=e[g*t*n+d*n+a],I=e[h*t*n+f*n+a],B=e[h*t*n+d*n+a],C=wn(wn(s,u,c),wn(I,B,c),r%1);o[l*i*n+A*n+a]=C}}}return o}(e,t,A,i,r,n);default:throw new Error(`Unsupported resampling method: '${a}'`)}}function pn(e,t,A){let i=0;for(let r=t;r<A;++r)i+=e[r];return i}function yn(e,t,A){switch(e){case 1:if(t<=8)return new Uint8Array(A);if(t<=16)return new Uint16Array(A);if(t<=32)return new Uint32Array(A);break;case 2:if(8===t)return new Int8Array(A);if(16===t)return new Int16Array(A);if(32===t)return new Int32Array(A);break;case 3:switch(t){case 16:case 32:return new Float32Array(A);case 64:return new Float64Array(A)}}throw Error("Unsupported data format/bitsPerSample")}Cn([void 0,1],(()=>Promise.resolve().then((function(){return ta})).then((e=>e.default)))),Cn(5,(()=>Promise.resolve().then((function(){return na})).then((e=>e.default)))),Cn(6,(()=>{throw new Error("old style JPEG compression is not supported.")})),Cn(7,(()=>Promise.resolve().then((function(){return Ea})).then((e=>e.default)))),Cn([8,32946],(()=>Promise.resolve().then((function(){return vl})).then((e=>e.default)))),Cn(32773,(()=>Promise.resolve().then((function(){return xl})).then((e=>e.default)))),Cn(34887,(()=>Promise.resolve().then((function(){return Nl})).then((async e=>(await e.zstd.init(),e))).then((e=>e.default)))),Cn(50001,(()=>Promise.resolve().then((function(){return Pl})).then((e=>e.default))));var _n=class{constructor(e,t,A,i,r,n){this.fileDirectory=e,this.geoKeys=t,this.dataView=A,this.littleEndian=i,this.tiles=r?{}:null,this.isTiled=!e.StripOffsets;const a=e.PlanarConfiguration;if(this.planarConfiguration=void 0===a?1:a,1!==this.planarConfiguration&&2!==this.planarConfiguration)throw new Error("Invalid planar configuration.");this.source=n}getFileDirectory(){return this.fileDirectory}getGeoKeys(){return this.geoKeys}getWidth(){return this.fileDirectory.ImageWidth}getHeight(){return this.fileDirectory.ImageLength}getSamplesPerPixel(){return void 0!==this.fileDirectory.SamplesPerPixel?this.fileDirectory.SamplesPerPixel:1}getTileWidth(){return this.isTiled?this.fileDirectory.TileWidth:this.getWidth()}getTileHeight(){return this.isTiled?this.fileDirectory.TileLength:void 0!==this.fileDirectory.RowsPerStrip?Math.min(this.fileDirectory.RowsPerStrip,this.getHeight()):this.getHeight()}getBlockWidth(){return this.getTileWidth()}getBlockHeight(e){return this.isTiled||(e+1)*this.getTileHeight()<=this.getHeight()?this.getTileHeight():this.getHeight()-e*this.getTileHeight()}getBytesPerPixel(){let e=0;for(let t=0;t<this.fileDirectory.BitsPerSample.length;++t)e+=this.getSampleByteSize(t);return e}getSampleByteSize(e){if(e>=this.fileDirectory.BitsPerSample.length)throw new RangeError(`Sample index ${e} is out of range.`);return Math.ceil(this.fileDirectory.BitsPerSample[e]/8)}getReaderForSample(e){const t=this.fileDirectory.SampleFormat?this.fileDirectory.SampleFormat[e]:1,A=this.fileDirectory.BitsPerSample[e];switch(t){case 1:if(A<=8)return DataView.prototype.getUint8;if(A<=16)return DataView.prototype.getUint16;if(A<=32)return DataView.prototype.getUint32;break;case 2:if(A<=8)return DataView.prototype.getInt8;if(A<=16)return DataView.prototype.getInt16;if(A<=32)return DataView.prototype.getInt32;break;case 3:switch(A){case 16:return function(e,t){return xr(this,e,t)};case 32:return DataView.prototype.getFloat32;case 64:return DataView.prototype.getFloat64}}throw Error("Unsupported data format/bitsPerSample")}getSampleFormat(e=0){return this.fileDirectory.SampleFormat?this.fileDirectory.SampleFormat[e]:1}getBitsPerSample(e=0){return this.fileDirectory.BitsPerSample[e]}getArrayForSample(e,t){return yn(this.getSampleFormat(e),this.getBitsPerSample(e),t)}async getTileOrStrip(e,t,A,i,r){const n=Math.ceil(this.getWidth()/this.getTileWidth()),a=Math.ceil(this.getHeight()/this.getTileHeight());let s;const{tiles:o}=this;let l,g;1===this.planarConfiguration?s=t*n+e:2===this.planarConfiguration&&(s=A*n*a+t*n+e),this.isTiled?(l=this.fileDirectory.TileOffsets[s],g=this.fileDirectory.TileByteCounts[s]):(l=this.fileDirectory.StripOffsets[s],g=this.fileDirectory.StripByteCounts[s]);const h=(await this.source.fetch([{offset:l,length:g}],r))[0];let c;return null!==o&&o[s]?c=o[s]:(c=(async()=>{let e=await i.decode(this.fileDirectory,h);const A=this.getSampleFormat(),r=this.getBitsPerSample();return function(e,t){return(1!==e&&2!==e||!(t<=32)||t%8!=0)&&(3!==e||16!==t&&32!==t&&64!==t)}(A,r)&&(e=function(e,t,A,i,r,n,a){const s=new DataView(e),o=2===A?1:i,l=yn(t,r,2===A?a*n:a*n*i),g=parseInt("1".repeat(r),2);if(1===t){let e;e=1===A?i*r:r;let t=n*e;0!=(7&t)&&(t=t+7&-8);for(let e=0;e<a;++e){const A=e*t;for(let t=0;t<n;++t){const i=A+t*o*r;for(let A=0;A<o;++A){const a=i+A*r,h=(e*n+t)*o+A,c=Math.floor(a/8),f=a%8;if(f+r<=8)l[h]=s.getUint8(c)>>8-r-f&g;else if(f+r<=16)l[h]=s.getUint16(c)>>16-r-f&g;else if(f+r<=24){const e=s.getUint16(c)<<8|s.getUint8(c+2);l[h]=e>>24-r-f&g}else l[h]=s.getUint32(c)>>32-r-f&g}}}}return l.buffer}(e,A,this.planarConfiguration,this.getSamplesPerPixel(),r,this.getTileWidth(),this.getBlockHeight(t))),e})(),null!==o&&(o[s]=c)),{x:e,y:t,sample:A,data:await c}}async _readRaster(e,t,A,i,r,n,a,s,o){const l=this.getTileWidth(),g=this.getTileHeight(),h=this.getWidth(),c=this.getHeight(),f=Math.max(Math.floor(e[0]/l),0),d=Math.min(Math.ceil(e[2]/l),Math.ceil(h/l)),u=Math.max(Math.floor(e[1]/g),0),I=Math.min(Math.ceil(e[3]/g),Math.ceil(c/g)),B=e[2]-e[0];let C=this.getBytesPerPixel();const E=[],w=[];for(let e=0;e<t.length;++e)1===this.planarConfiguration?E.push(pn(this.fileDirectory.BitsPerSample,0,t[e])/8):E.push(0),w.push(this.getReaderForSample(t[e]));const Q=[],{littleEndian:m}=this;for(let n=u;n<I;++n)for(let a=f;a<d;++a){let s;1===this.planarConfiguration&&(s=this.getTileOrStrip(a,n,0,r,o));for(let f=0;f<t.length;++f){const d=f,u=t[f];2===this.planarConfiguration&&(C=this.getSampleByteSize(u),s=this.getTileOrStrip(a,n,u,r,o));const I=s.then((r=>{const n=r.data,a=new DataView(n),s=this.getBlockHeight(r.y),o=r.y*g,f=r.x*l,u=o+s,I=(r.x+1)*l,Q=w[d],p=Math.min(s,s-(u-e[3]),c-o),y=Math.min(l,l-(I-e[2]),h-f);for(let r=Math.max(0,e[1]-o);r<p;++r)for(let n=Math.max(0,e[0]-f);n<y;++n){const s=(r*l+n)*C,g=Q.call(a,s+E[d],m);let h;i?(h=(r+o-e[1])*B*t.length+(n+f-e[0])*t.length+d,A[h]=g):(h=(r+o-e[1])*B+n+f-e[0],A[d][h]=g)}}));Q.push(I)}}if(await Promise.all(Q),n&&e[2]-e[0]!==n||a&&e[3]-e[1]!==a){let r;return r=i?mn(A,e[2]-e[0],e[3]-e[1],n,a,t.length,s):Qn(A,e[2]-e[0],e[3]-e[1],n,a,s),r.width=n,r.height=a,r}return A.width=n||e[2]-e[0],A.height=a||e[3]-e[1],A}async readRasters({window:e,samples:t=[],interleave:A,pool:i=null,width:r,height:n,resampleMethod:a,fillValue:s,signal:o}={}){const l=e||[0,0,this.getWidth(),this.getHeight()];if(l[0]>l[2]||l[1]>l[3])throw new Error("Invalid subsets");const g=(l[2]-l[0])*(l[3]-l[1]),h=this.getSamplesPerPixel();if(t&&t.length){for(let e=0;e<t.length;++e)if(t[e]>=h)return Promise.reject(new RangeError(`Invalid sample index '${t[e]}'.`))}else for(let e=0;e<h;++e)t.push(e);let c;if(A){c=yn(this.fileDirectory.SampleFormat?Math.max.apply(null,this.fileDirectory.SampleFormat):1,Math.max.apply(null,this.fileDirectory.BitsPerSample),g*t.length),s&&c.fill(s)}else{c=[];for(let e=0;e<t.length;++e){const A=this.getArrayForSample(t[e],g);Array.isArray(s)&&e<s.length?A.fill(s[e]):s&&!Array.isArray(s)&&A.fill(s),c.push(A)}}const f=i||await async function(e){const t=Bn.get(e.Compression);if(!t)throw new Error(`Unknown compression method identifier: ${e.Compression}`);return new(await t())(e)}(this.fileDirectory);return await this._readRaster(l,t,c,A,f,r,n,a,o)}async readRGB({window:e,interleave:t=!0,pool:A=null,width:i,height:r,resampleMethod:n,enableAlpha:a=!1,signal:s}={}){const o=e||[0,0,this.getWidth(),this.getHeight()];if(o[0]>o[2]||o[1]>o[3])throw new Error("Invalid subsets");const l=this.fileDirectory.PhotometricInterpretation;if(l===an){let o=[0,1,2];if(this.fileDirectory.ExtraSamples!==hn&&a){o=[];for(let e=0;e<this.fileDirectory.BitsPerSample.length;e+=1)o.push(e)}return this.readRasters({window:e,interleave:t,samples:o,pool:A,width:i,height:r,resampleMethod:n,signal:s})}let g;switch(l){case rn:case nn:case sn:g=[0];break;case on:g=[0,1,2,3];break;case ln:case gn:g=[0,1,2];break;default:throw new Error("Invalid or unsupported photometric interpretation.")}const h={window:o,interleave:!0,samples:g,pool:A,width:i,height:r,resampleMethod:n,signal:s},{fileDirectory:c}=this,f=await this.readRasters(h),d=2**this.fileDirectory.BitsPerSample[0];let u;switch(l){case rn:u=function(e,t){const{width:A,height:i}=e,r=new Uint8Array(A*i*3);let n;for(let A=0,i=0;A<e.length;++A,i+=3)n=256-e[A]/t*256,r[i]=n,r[i+1]=n,r[i+2]=n;return r}(f,d);break;case nn:u=function(e,t){const{width:A,height:i}=e,r=new Uint8Array(A*i*3);let n;for(let A=0,i=0;A<e.length;++A,i+=3)n=e[A]/t*256,r[i]=n,r[i+1]=n,r[i+2]=n;return r}(f,d);break;case sn:u=function(e,t){const{width:A,height:i}=e,r=new Uint8Array(A*i*3),n=t.length/3,a=t.length/3*2;for(let A=0,i=0;A<e.length;++A,i+=3){const s=e[A];r[i]=t[s]/65536*256,r[i+1]=t[s+n]/65536*256,r[i+2]=t[s+a]/65536*256}return r}(f,c.ColorMap);break;case on:u=function(e){const{width:t,height:A}=e,i=new Uint8Array(t*A*3);for(let t=0,A=0;t<e.length;t+=4,A+=3){const r=e[t],n=e[t+1],a=e[t+2],s=e[t+3];i[A]=(255-r)/256*255*((255-s)/256),i[A+1]=(255-n)/256*255*((255-s)/256),i[A+2]=(255-a)/256*255*((255-s)/256)}return i}(f);break;case ln:u=function(e){const{width:t,height:A}=e,i=new Uint8ClampedArray(t*A*3);for(let t=0,A=0;t<e.length;t+=3,A+=3){const r=e[t],n=e[t+1],a=e[t+2];i[A]=r+1.402*(a-128),i[A+1]=r-.34414*(n-128)-.71414*(a-128),i[A+2]=r+1.772*(n-128)}return i}(f);break;case gn:u=function(e){const{width:t,height:A}=e,i=new Uint8Array(t*A*3);for(let t=0,A=0;t<e.length;t+=3,A+=3){let r,n,a,s=(e[t+0]+16)/116,o=(e[t+1]<<24>>24)/500+s,l=s-(e[t+2]<<24>>24)/200;o=.95047*(o*o*o>.008856?o*o*o:(o-16/116)/7.787),s=1*(s*s*s>.008856?s*s*s:(s-16/116)/7.787),l=1.08883*(l*l*l>.008856?l*l*l:(l-16/116)/7.787),r=3.2406*o+-1.5372*s+-.4986*l,n=-.9689*o+1.8758*s+.0415*l,a=.0557*o+-.204*s+1.057*l,r=r>.0031308?1.055*r**(1/2.4)-.055:12.92*r,n=n>.0031308?1.055*n**(1/2.4)-.055:12.92*n,a=a>.0031308?1.055*a**(1/2.4)-.055:12.92*a,i[A]=255*Math.max(0,Math.min(1,r)),i[A+1]=255*Math.max(0,Math.min(1,n)),i[A+2]=255*Math.max(0,Math.min(1,a))}return i}(f);break;default:throw new Error("Unsupported photometric interpretation.")}if(!t){const e=new Uint8Array(u.length/3),t=new Uint8Array(u.length/3),A=new Uint8Array(u.length/3);for(let i=0,r=0;i<u.length;i+=3,++r)e[r]=u[i],t[r]=u[i+1],A[r]=u[i+2];u=[e,t,A]}return u.width=f.width,u.height=f.height,u}getTiePoints(){if(!this.fileDirectory.ModelTiepoint)return[];const e=[];for(let t=0;t<this.fileDirectory.ModelTiepoint.length;t+=6)e.push({i:this.fileDirectory.ModelTiepoint[t],j:this.fileDirectory.ModelTiepoint[t+1],k:this.fileDirectory.ModelTiepoint[t+2],x:this.fileDirectory.ModelTiepoint[t+3],y:this.fileDirectory.ModelTiepoint[t+4],z:this.fileDirectory.ModelTiepoint[t+5]});return e}getGDALMetadata(e=null){const t={};if(!this.fileDirectory.GDAL_METADATA)return null;const A=this.fileDirectory.GDAL_METADATA;let i=Xr(A,"Item");i=null===e?i.filter((e=>void 0===Ur(e,"sample"))):i.filter((t=>Number(Ur(t,"sample"))===e));for(let e=0;e<i.length;++e){const A=i[e];t[Ur(A,"name")]=A.inner}return t}getGDALNoData(){if(!this.fileDirectory.GDAL_NODATA)return null;const e=this.fileDirectory.GDAL_NODATA;return Number(e.substring(0,e.length-1))}getOrigin(){const e=this.fileDirectory.ModelTiepoint,t=this.fileDirectory.ModelTransformation;if(e&&6===e.length)return[e[3],e[4],e[5]];if(t)return[t[3],t[7],t[11]];throw new Error("The image does not have an affine transformation.")}getResolution(e=null){const t=this.fileDirectory.ModelPixelScale,A=this.fileDirectory.ModelTransformation;if(t)return[t[0],-t[1],t[2]];if(A)return 0===A[1]&&0===A[4]?[A[0],-A[5],A[10]]:[Math.sqrt(A[0]*A[0]+A[4]*A[4]),-Math.sqrt(A[1]*A[1]+A[5]*A[5]),A[10]];if(e){const[t,A,i]=e.getResolution();return[t*e.getWidth()/this.getWidth(),A*e.getHeight()/this.getHeight(),i*e.getWidth()/this.getWidth()]}throw new Error("The image does not have an affine transformation.")}pixelIsArea(){return 1===this.geoKeys.GTRasterTypeGeoKey}getBoundingBox(e=!1){const t=this.getHeight(),A=this.getWidth();if(this.fileDirectory.ModelTransformation&&!e){const[e,i,r,n,a,s,o,l]=this.fileDirectory.ModelTransformation,g=[[0,0],[0,t],[A,0],[A,t]].map((([t,A])=>[n+e*t+i*A,l+a*t+s*A])),h=g.map((e=>e[0])),c=g.map((e=>e[1]));return[Math.min(...h),Math.min(...c),Math.max(...h),Math.max(...c)]}{const e=this.getOrigin(),i=this.getResolution(),r=e[0],n=e[1],a=r+i[0]*A,s=n+i[1]*t;return[Math.min(r,a),Math.min(n,s),Math.max(r,a),Math.max(n,s)]}}};class bn{constructor(e){this._dataView=new DataView(e)}get buffer(){return this._dataView.buffer}getUint64(e,t){const A=this.getUint32(e,t),i=this.getUint32(e+4,t);let r;if(t){if(r=A+2**32*i,!Number.isSafeInteger(r))throw new Error(`${r} exceeds MAX_SAFE_INTEGER. Precision may be lost. Please report if you get this message to https://github.com/geotiffjs/geotiff.js/issues`);return r}if(r=2**32*A+i,!Number.isSafeInteger(r))throw new Error(`${r} exceeds MAX_SAFE_INTEGER. Precision may be lost. Please report if you get this message to https://github.com/geotiffjs/geotiff.js/issues`);return r}getInt64(e,t){let A=0;const i=(128&this._dataView.getUint8(e+(t?7:0)))>0;let r=!0;for(let n=0;n<8;n++){let a=this._dataView.getUint8(e+(t?n:7-n));i&&(r?0!==a&&(a=255&~(a-1),r=!1):a=255&~a),A+=a*256**n}return i&&(A=-A),A}getUint8(e,t){return this._dataView.getUint8(e,t)}getInt8(e,t){return this._dataView.getInt8(e,t)}getUint16(e,t){return this._dataView.getUint16(e,t)}getInt16(e,t){return this._dataView.getInt16(e,t)}getUint32(e,t){return this._dataView.getUint32(e,t)}getInt32(e,t){return this._dataView.getInt32(e,t)}getFloat16(e,t){return xr(this._dataView,e,t)}getFloat32(e,t){return this._dataView.getFloat32(e,t)}getFloat64(e,t){return this._dataView.getFloat64(e,t)}}class Dn{constructor(e,t,A,i){this._dataView=new DataView(e),this._sliceOffset=t,this._littleEndian=A,this._bigTiff=i}get sliceOffset(){return this._sliceOffset}get sliceTop(){return this._sliceOffset+this.buffer.byteLength}get littleEndian(){return this._littleEndian}get bigTiff(){return this._bigTiff}get buffer(){return this._dataView.buffer}covers(e,t){return this.sliceOffset<=e&&this.sliceTop>=e+t}readUint8(e){return this._dataView.getUint8(e-this._sliceOffset,this._littleEndian)}readInt8(e){return this._dataView.getInt8(e-this._sliceOffset,this._littleEndian)}readUint16(e){return this._dataView.getUint16(e-this._sliceOffset,this._littleEndian)}readInt16(e){return this._dataView.getInt16(e-this._sliceOffset,this._littleEndian)}readUint32(e){return this._dataView.getUint32(e-this._sliceOffset,this._littleEndian)}readInt32(e){return this._dataView.getInt32(e-this._sliceOffset,this._littleEndian)}readFloat32(e){return this._dataView.getFloat32(e-this._sliceOffset,this._littleEndian)}readFloat64(e){return this._dataView.getFloat64(e-this._sliceOffset,this._littleEndian)}readUint64(e){const t=this.readUint32(e),A=this.readUint32(e+4);let i;if(this._littleEndian){if(i=t+2**32*A,!Number.isSafeInteger(i))throw new Error(`${i} exceeds MAX_SAFE_INTEGER. Precision may be lost. Please report if you get this message to https://github.com/geotiffjs/geotiff.js/issues`);return i}if(i=2**32*t+A,!Number.isSafeInteger(i))throw new Error(`${i} exceeds MAX_SAFE_INTEGER. Precision may be lost. Please report if you get this message to https://github.com/geotiffjs/geotiff.js/issues`);return i}readInt64(e){let t=0;const A=(128&this._dataView.getUint8(e+(this._littleEndian?7:0)))>0;let i=!0;for(let r=0;r<8;r++){let n=this._dataView.getUint8(e+(this._littleEndian?r:7-r));A&&(i?0!==n&&(n=255&~(n-1),i=!1):n=255&~n),t+=n*256**r}return A&&(t=-t),t}readOffset(e){return this._bigTiff?this.readUint64(e):this.readUint32(e)}}class kn{async fetch(e,t=undefined){return Promise.all(e.map((e=>this.fetchSlice(e,t))))}async fetchSlice(e){throw new Error(`fetching of slice ${e} not possible, not implemented`)}get fileSize(){return null}async close(){}}class vn extends Error{constructor(e){super(e),Error.captureStackTrace&&Error.captureStackTrace(this,vn),this.name="AbortError"}}class xn extends kn{constructor(e){super(),this.arrayBuffer=e}fetchSlice(e,t){if(t&&t.aborted)throw new vn("Request aborted");return this.arrayBuffer.slice(e.offset,e.offset+e.length)}}function Sn(e,t){let A=e.length-t,i=0;do{for(let A=t;A>0;A--)e[i+t]+=e[i],i++;A-=t}while(A>0)}function Gn(e,t,A){let i=0,r=e.length;const n=r/A;for(;r>t;){for(let A=t;A>0;--A)e[i+t]+=e[i],++i;r-=t}const a=e.slice();for(let t=0;t<n;++t)for(let i=0;i<A;++i)e[A*t+i]=a[(A-i-1)*n+t]}class Un{async decode(e,t){const A=await this.decodeBlock(t),i=e.Predictor||1;if(1!==i){const t=!e.StripOffsets;return function(e,t,A,i,r,n){if(!t||1===t)return e;for(let e=0;e<r.length;++e){if(r[e]%8!=0)throw new Error("When decoding with predictor, only multiple of 8 bits are supported.");if(r[e]!==r[0])throw new Error("When decoding with predictor, all samples must have the same size.")}const a=r[0]/8,s=2===n?1:r.length;for(let n=0;n<i&&!(n*s*A*a>=e.byteLength);++n){let i;if(2===t){switch(r[0]){case 8:i=new Uint8Array(e,n*s*A*a,s*A*a);break;case 16:i=new Uint16Array(e,n*s*A*a,s*A*a/2);break;case 32:i=new Uint32Array(e,n*s*A*a,s*A*a/4);break;default:throw new Error(`Predictor 2 not allowed with ${r[0]} bits per sample.`)}Sn(i,s)}else 3===t&&(i=new Uint8Array(e,n*s*A*a,s*A*a),Gn(i,s,a))}return e}(A,i,t?e.TileWidth:e.ImageWidth,t?e.TileLength:e.RowsPerStrip||e.ImageLength,e.BitsPerSample,e.PlanarConfiguration)}return A}}function Mn(e){switch(e){case An.BYTE:case An.ASCII:case An.SBYTE:case An.UNDEFINED:return 1;case An.SHORT:case An.SSHORT:return 2;case An.LONG:case An.SLONG:case An.FLOAT:case An.IFD:return 4;case An.RATIONAL:case An.SRATIONAL:case An.DOUBLE:case An.LONG8:case An.SLONG8:case An.IFD8:return 8;default:throw new RangeError(`Invalid field type: ${e}`)}}function Rn(e,t,A,i){let r=null,n=null;const a=Mn(t);switch(t){case An.BYTE:case An.ASCII:case An.UNDEFINED:r=new Uint8Array(A),n=e.readUint8;break;case An.SBYTE:r=new Int8Array(A),n=e.readInt8;break;case An.SHORT:r=new Uint16Array(A),n=e.readUint16;break;case An.SSHORT:r=new Int16Array(A),n=e.readInt16;break;case An.LONG:case An.IFD:r=new Uint32Array(A),n=e.readUint32;break;case An.SLONG:r=new Int32Array(A),n=e.readInt32;break;case An.LONG8:case An.IFD8:r=new Array(A),n=e.readUint64;break;case An.SLONG8:r=new Array(A),n=e.readInt64;break;case An.RATIONAL:r=new Uint32Array(2*A),n=e.readUint32;break;case An.SRATIONAL:r=new Int32Array(2*A),n=e.readInt32;break;case An.FLOAT:r=new Float32Array(A),n=e.readFloat32;break;case An.DOUBLE:r=new Float64Array(A),n=e.readFloat64;break;default:throw new RangeError(`Invalid field type: ${t}`)}if(t!==An.RATIONAL&&t!==An.SRATIONAL)for(let t=0;t<A;++t)r[t]=n.call(e,i+t*a);else for(let t=0;t<A;t+=2)r[t]=n.call(e,i+t*a),r[t+1]=n.call(e,i+(t*a+4));return t===An.ASCII?new TextDecoder("utf-8").decode(r):r}class Fn{constructor(e,t,A){this.fileDirectory=e,this.geoKeyDirectory=t,this.nextIFDByteOffset=A}}class Ln extends Error{constructor(e){super(`No image at index ${e}`),this.index=e}}class Tn{async readRasters(e={}){const{window:t,width:A,height:i}=e;let{resX:r,resY:n,bbox:a}=e;const s=await this.getImage();let o=s;const l=await this.getImageCount(),g=s.getBoundingBox();if(t&&a)throw new Error('Both "bbox" and "window" passed.');if(A||i){if(t){const[e,A]=s.getOrigin(),[i,r]=s.getResolution();a=[e+t[0]*i,A+t[1]*r,e+t[2]*i,A+t[3]*r]}const e=a||g;if(A){if(r)throw new Error("Both width and resX passed");r=(e[2]-e[0])/A}if(i){if(n)throw new Error("Both width and resY passed");n=(e[3]-e[1])/i}}if(r||n){const e=[];for(let t=0;t<l;++t){const A=await this.getImage(t),{SubfileType:i,NewSubfileType:r}=A.fileDirectory;(0===t||2===i||1&r)&&e.push(A)}e.sort(((e,t)=>e.getWidth()-t.getWidth()));for(let t=0;t<e.length;++t){const A=e[t],i=(g[2]-g[0])/A.getWidth(),a=(g[3]-g[1])/A.getHeight();if(o=A,r&&r>i||n&&n>a)break}}let h=t;if(a){const[e,t]=s.getOrigin(),[A,i]=o.getResolution(s);h=[Math.round((a[0]-e)/A),Math.round((a[1]-t)/i),Math.round((a[2]-e)/A),Math.round((a[3]-t)/i)],h=[Math.min(h[0],h[2]),Math.min(h[1],h[3]),Math.max(h[0],h[2]),Math.max(h[1],h[3])]}return o.readRasters({...e,window:h})}}class Nn extends Tn{constructor(e,t,A,i,r={}){super(),this.source=e,this.littleEndian=t,this.bigTiff=A,this.firstIFDOffset=i,this.cache=r.cache||!1,this.ifdRequests=[],this.ghostValues=null}async getSlice(e,t){const A=this.bigTiff?4048:1024;return new Dn((await this.source.fetch([{offset:e,length:void 0!==t?t:A}]))[0],e,this.littleEndian,this.bigTiff)}async parseFileDirectoryAt(e){const t=this.bigTiff?20:12,A=this.bigTiff?8:2;let i=await this.getSlice(e);const r=this.bigTiff?i.readUint64(e):i.readUint16(e),n=r*t+(this.bigTiff?16:6);i.covers(e,n)||(i=await this.getSlice(e,n));const a={};let s=e+(this.bigTiff?8:2);for(let e=0;e<r;s+=t,++e){const e=i.readUint16(s),t=i.readUint16(s+2),A=this.bigTiff?i.readUint64(s+4):i.readUint32(s+4);let r,n;const o=Mn(t),l=s+(this.bigTiff?12:8);if(o*A<=(this.bigTiff?8:4))r=Rn(i,t,A,l);else{const e=i.readOffset(l),n=Mn(t)*A;if(i.covers(e,n))r=Rn(i,t,A,e);else{r=Rn(await this.getSlice(e,n),t,A,e)}}n=1===A&&-1===en.indexOf(e)&&t!==An.RATIONAL&&t!==An.SRATIONAL?r[0]:r,a[Wr[e]]=n}const o=function(e){const t=e.GeoKeyDirectory;if(!t)return null;const A={};for(let i=4;i<=4*t[3];i+=4){const r=In[t[i]],n=t[i+1]?Wr[t[i+1]]:null,a=t[i+2],s=t[i+3];let o=null;if(n){if(o=e[n],null==o)throw new Error(`Could not get value of geoKey '${r}'.`);"string"==typeof o?o=o.substring(s,s+a-1):o.subarray&&(o=o.subarray(s,s+a),1===a&&(o=o[0]))}else o=s;A[r]=o}return A}(a),l=i.readOffset(e+A+t*r);return new Fn(a,o,l)}async requestIFD(e){if(this.ifdRequests[e])return this.ifdRequests[e];if(0===e)return this.ifdRequests[e]=this.parseFileDirectoryAt(this.firstIFDOffset),this.ifdRequests[e];if(!this.ifdRequests[e-1])try{this.ifdRequests[e-1]=this.requestIFD(e-1)}catch(t){if(t instanceof Ln)throw new Ln(e);throw t}return this.ifdRequests[e]=(async()=>{const t=await this.ifdRequests[e-1];if(0===t.nextIFDByteOffset)throw new Ln(e);return this.parseFileDirectoryAt(t.nextIFDByteOffset)})(),this.ifdRequests[e]}async getImage(e=0){const t=await this.requestIFD(e);return new _n(t.fileDirectory,t.geoKeyDirectory,this.dataView,this.littleEndian,this.cache,this.source)}async getImageCount(){let e=0,t=!0;for(;t;)try{await this.requestIFD(e),++e}catch(e){if(!(e instanceof Ln))throw e;t=!1}return e}async getGhostValues(){const e=this.bigTiff?16:8;if(this.ghostValues)return this.ghostValues;const t="GDAL_STRUCTURAL_METADATA_SIZE=",A=t.length+100;let i=await this.getSlice(e,A);if(t===Rn(i,An.ASCII,t.length,e)){const t=Rn(i,An.ASCII,A,e).split("\n")[0],r=Number(t.split("=")[1].split(" ")[0])+t.length;r>A&&(i=await this.getSlice(e,r));const n=Rn(i,An.ASCII,r,e);this.ghostValues={},n.split("\n").filter((e=>e.length>0)).map((e=>e.split("="))).forEach((([e,t])=>{this.ghostValues[e]=t}))}return this.ghostValues}static async fromSource(e,t,A){const i=(await e.fetch([{offset:0,length:1024}],A))[0],r=new bn(i),n=r.getUint16(0,0);let a;if(18761===n)a=!0;else{if(19789!==n)throw new TypeError("Invalid byte order value.");a=!1}const s=r.getUint16(2,a);let o;if(42===s)o=!1;else{if(43!==s)throw new TypeError("Invalid magic number.");o=!0;if(8!==r.getUint16(4,a))throw new Error("Unsupported offset byte-size.")}const l=o?r.getUint64(8,a):r.getUint32(4,a);return new Nn(e,a,o,l,t)}close(){return"function"==typeof this.source.close&&this.source.close()}}async function Pn(e,t){return Nn.fromSource(function(e){return new xn(e)}(e),t)}class On{constructor(e=257){this.gridSize=e;const t=e-1;if(t&t-1)throw new Error(`Expected grid size to be 2^n+1, got ${e}.`);this.numTriangles=t*t*2-2,this.numParentTriangles=this.numTriangles-t*t,this.indices=new Uint32Array(this.gridSize*this.gridSize),this.coords=new Uint16Array(4*this.numTriangles);for(let e=0;e<this.numTriangles;e++){let A=e+2,i=0,r=0,n=0,a=0,s=0,o=0;for(1&A?n=a=s=t:i=r=o=t;(A>>=1)>1;){const e=i+n>>1,t=r+a>>1;1&A?(n=i,a=r,i=s,r=o):(i=n,r=a,n=s,a=o),s=e,o=t}const l=4*e;this.coords[l+0]=i,this.coords[l+1]=r,this.coords[l+2]=n,this.coords[l+3]=a}}createTile(e){return new zn(e,this)}}class zn{constructor(e,t){const A=t.gridSize;if(e.length!==A*A)throw new Error(`Expected terrain data of length ${A*A} (${A} x ${A}), got ${e.length}.`);this.terrain=e,this.martini=t,this.errors=new Float32Array(e.length),this.update()}update(){const{numTriangles:e,numParentTriangles:t,coords:A,gridSize:i}=this.martini,{terrain:r,errors:n}=this;for(let a=e-1;a>=0;a--){const e=4*a,s=A[e+0],o=A[e+1],l=A[e+2],g=A[e+3],h=s+l>>1,c=o+g>>1,f=h+c-o,d=c+s-h,u=(r[o*i+s]+r[g*i+l])/2,I=c*i+h,B=Math.abs(u-r[I]);if(n[I]=Math.max(n[I],B),a<t){const e=(o+d>>1)*i+(s+f>>1),t=(g+d>>1)*i+(l+f>>1);n[I]=Math.max(n[I],n[e],n[t])}}}getMesh(e=0){const{gridSize:t,indices:A}=this.martini,{errors:i}=this;let r=0,n=0;const a=t-1;function s(a,o,l,g,h,c){const f=a+l>>1,d=o+g>>1;Math.abs(a-h)+Math.abs(o-c)>1&&i[d*t+f]>e?(s(h,c,a,o,f,d),s(l,g,h,c,f,d)):(A[o*t+a]=A[o*t+a]||++r,A[g*t+l]=A[g*t+l]||++r,A[c*t+h]=A[c*t+h]||++r,n++)}A.fill(0),s(0,0,a,a,a,0),s(a,a,0,0,0,a);const o=new Uint16Array(2*r),l=new Uint32Array(3*n);let g=0;function h(r,n,a,s,c,f){const d=r+a>>1,u=n+s>>1;if(Math.abs(r-c)+Math.abs(n-f)>1&&i[u*t+d]>e)h(c,f,r,n,d,u),h(a,s,c,f,d,u);else{const e=A[n*t+r]-1,i=A[s*t+a]-1,h=A[f*t+c]-1;o[2*e]=r,o[2*e+1]=n,o[2*i]=a,o[2*i+1]=s,o[2*h]=c,o[2*h+1]=f,l[g++]=e,l[g++]=i,l[g++]=h}}return h(0,0,a,a,a,0),h(a,a,0,0,0,a),{vertices:o,triangles:l}}}function Kn(){for(var e=arguments.length,t=new Array(e),A=0;A<e;A++)t[A]=arguments[A];const i=t,r=i&&i.length>1&&i[0].constructor||null;if(!r)throw new Error('"concatenateTypedArrays" - incorrect quantity of arguments or arguments have incompatible data types');const n=new r(i.reduce(((e,t)=>e+t.length),0));let a=0;for(const e of i)n.set(e,a),a+=e.length;return n}function Hn(e,t,A,i){const r=i?function(e,t){e.westIndices.sort(((e,A)=>t[3*e+1]-t[3*A+1])),e.eastIndices.sort(((e,A)=>t[3*A+1]-t[3*e+1])),e.southIndices.sort(((e,A)=>t[3*A]-t[3*e])),e.northIndices.sort(((e,A)=>t[3*e]-t[3*A]));const A=[];for(const t in e){const i=e[t];for(let e=0;e<i.length-1;e++)A.push([i[e],i[e+1]])}return A}(i,e.POSITION.value):function(e){var t,A;const i=[];for(let t=0;t<e.length;t+=3)i.push([e[t],e[t+1]]),i.push([e[t+1],e[t+2]]),i.push([e[t+2],e[t]]);i.sort(((e,t)=>Math.min(...e)-Math.min(...t)||Math.max(...e)-Math.max(...t)));const r=[];let n=0;for(;n<i.length;)i[n][0]===(null===(t=i[n+1])||void 0===t?void 0:t[1])&&i[n][1]===(null===(A=i[n+1])||void 0===A?void 0:A[0])?n+=2:(r.push(i[n]),n++);return r}(t),n=new e.POSITION.value.constructor(6*r.length),a=new e.TEXCOORD_0.value.constructor(4*r.length),s=new t.constructor(6*r.length);for(let t=0;t<r.length;t++){qn({edge:r[t],edgeIndex:t,attributes:e,skirtHeight:A,newPosition:n,newTexcoord0:a,newTriangles:s})}e.POSITION.value=Kn(e.POSITION.value,n),e.TEXCOORD_0.value=Kn(e.TEXCOORD_0.value,a);return{attributes:e,triangles:t instanceof Array?t.concat(s):Kn(t,s)}}function qn({edge:e,edgeIndex:t,attributes:A,skirtHeight:i,newPosition:r,newTexcoord0:n,newTriangles:a}){const s=A.POSITION.value.length,o=2*t,l=2*t+1;r.set(A.POSITION.value.subarray(3*e[0],3*e[0]+3),3*o),r[3*o+2]=r[3*o+2]-i,r.set(A.POSITION.value.subarray(3*e[1],3*e[1]+3),3*l),r[3*l+2]=r[3*l+2]-i,n.set(A.TEXCOORD_0.value.subarray(2*e[0],2*e[0]+2),2*o),n.set(A.TEXCOORD_0.value.subarray(2*e[1],2*e[1]+2),2*l);const g=2*t*3;a[g]=e[0],a[g+1]=s/3+l,a[g+2]=e[1],a[g+3]=s/3+l,a[g+4]=e[0],a[g+5]=s/3+o}const Jn={type:"image",format:"uint8",useHeatMap:!0,useColorsBasedOnValues:!1,useAutoRange:!1,useDataForOpacity:!1,useSingleColor:!1,useColorClasses:!1,blurredTexture:!0,clipLow:null,clipHigh:null,multiplier:1,color:[255,0,255,255],colorScale:r.brewer.YlOrRd,colorScaleValueRange:[0,255],colorsBasedOnValues:null,colorClasses:null,alpha:100,useChannel:null,noDataValue:void 0,numOfChannels:void 0,nullColor:[0,0,0,0],unidentifiedColor:[0,0,0,0],clippedColor:[0,0,0,0],terrainColor:[133,133,133,255],terrainSkirtHeight:100,terrainMinValue:0};class Yn{constructor(){this.scale=(e,t,A,i,r)=>(e-t)*(r-i)/(A-t)+i}setUrl(e){return n(this,void 0,void 0,(function*(){const t=yield fetch(e),A=yield t.arrayBuffer(),i=yield Pn(A),r=yield i.getImage(0);this.data=r}))}getMap(e,t){return n(this,void 0,void 0,(function*(){const A=Object.assign(Object.assign({},Jn),t);switch(console.log("xxx_mergedOptions",A),A.type){case"image":return this.getBitmap(e,A);case"terrain":return this.getHeightmap(e,A);default:return null}}))}getHeightmap(e,t){return n(this,void 0,void 0,(function*(){let A,i,r=[];"string"==typeof e?(yield this.setUrl(e),r=yield this.data.readRasters(),A=this.data.getWidth(),i=this.data.getHeight()):(r=e.rasters,A=e.width,i=e.height);let n=r[0];null!=t.useChannel&&r[t.useChannel]&&(n=r[t.useChannel]);const a=new Float32Array((A+1)*(i+1)),s=n.length/(A*i),o=A*i;console.log("xxx_size",o);let l=null===t.useChannel?0:t.useChannel;for(let e=0,r=0;r<i;r++)for(let i=0;i<A;i++,e++){const A=t.noDataValue&&n[l]===t.noDataValue?t.terrainMinValue:n[l]*t.multiplier;a[e+r]=A,l+=s}console.log("xxx_terrain",a),a[0];for(let e=(A+1)*A,t=0;t<A;t++,e++)a[e]=a[e-A-1];for(let e=i,t=0;t<i+1;t++,e+=i+1)a[e]=a[e-1];const{terrainSkirtHeight:g}=t;let h;console.log("xxx_bounds_0",e.bounds),h=Vn(g,A,a);const{vertices:c}=h;let{triangles:f}=h,d=function(e,t,A,i,r){const n=A+1,a=e.length/2,s=new Float32Array(3*a),o=new Float32Array(2*a);console.log("xxx_bounds",r);const[l,g,h,c]=r||[0,0,A,i],f=(h-l)/A,d=(c-g)/i;for(let r=0;r<a;r++){const a=e[2*r],g=e[2*r+1],h=g*n+a;s[3*r+0]=a*f+l,s[3*r+1]=-g*d+c,s[3*r+2]=t[h],o[2*r+0]=a/A,o[2*r+1]=g/i}return{POSITION:{value:s,size:3},TEXCOORD_0:{value:o,size:2}}}(c,a,A,i,e.bounds);const u=function(e){let t=1/0,A=1/0,i=1/0,r=-1/0,n=-1/0,a=-1/0;const s=e.POSITION?e.POSITION.value:[],o=s&&s.length;for(let e=0;e<o;e+=3){const o=s[e],l=s[e+1],g=s[e+2];t=o<t?o:t,A=l<A?l:A,i=g<i?g:i,r=o>r?o:r,n=l>n?l:n,a=g>a?g:a}return[[t,A,i],[r,n,a]]}(d);if(console.log("xxx_skirtHeight",g),g){const{attributes:e,triangles:t}=Hn(d,f,g);d=e,f=t}return{loaderData:{header:{}},header:{vertexCount:f.length,boundingBox:u},mode:4,indices:{value:Uint32Array.from(f),size:1},attributes:d}}))}getBitmap(e,t){return n(this,void 0,void 0,(function*(){const A=Object.assign({},t);let i,r,n,a=[];"string"==typeof e?(yield this.setUrl(e),a=yield this.data.readRasters(),i=a.length,r=this.data.getWidth(),n=this.data.getHeight()):(a=e.rasters,i=a.length,r=e.width,n=e.height);const s=document.createElement("canvas");s.width=r,s.height=n;const o=s.getContext("2d"),l=o.createImageData(r,n);let g,h,c,f;const d=r*n*4;if(t.noDataValue||console.log("Missing noData value. Raster might be displayed incorrectly."),A.unidentifiedColor=this.getColorFromChromaType(A.unidentifiedColor),A.nullColor=this.getColorFromChromaType(A.nullColor),A.clippedColor=this.getColorFromChromaType(A.clippedColor),A.color=this.getColorFromChromaType(A.color),null==A.useChannel){if(1===i){if(a[0].length/(r*n)==1){const e=a[0];A.useAutoRange&&(A.colorScaleValueRange=this.getMinMax(e,A));this.getColorValue(e,A,d).forEach(((e,t)=>{l.data[t]=e}))}if(a[0].length/(r*n)==3){let e=0;for(let t=0;t<d;t+=4){const i=[a[0][e],a[0][e+1],a[0][e+2]],r=this.hasPixelsNoData(i,A.noDataValue)?A.nullColor:[...i,Math.floor(2.55*A.alpha)];[l.data[t],l.data[t+1],l.data[t+2],l.data[t+3]]=r,e+=3}}a[0].length/(r*n)==4&&a[0].forEach(((e,t)=>{l.data[t]=e}))}if(3===i){let e=0;for(let t=0;t<d;t+=4)g=a[0][e],h=a[1][e],c=a[2][e],f=Math.floor(2.55*A.alpha),l.data[t]=g,l.data[t+1]=h,l.data[t+2]=c,l.data[t+3]=f,e+=1}if(4===i){let e=0;for(let t=0;t<d;t+=4)g=a[0][e],h=a[1][e],c=a[2][e],f=Math.floor(2.55*A.alpha),l.data[t]=g,l.data[t+1]=h,l.data[t+2]=c,l.data[t+3]=f,e+=1}}else if(A.useChannel<=A.numOfChannels){let e=a[0];a[A.useChannel]&&(e=a[A.useChannel]),A.useAutoRange&&(A.colorScaleValueRange=this.getMinMax(e,A));const t=e.length/(r*n);this.getColorValue(e,A,d,t).forEach(((e,t)=>{l.data[t]=e}))}else{console.log("Defined channel does not exist, displaying only grey values");this.getDefaultColor(d,A.nullColor).forEach(((e,t)=>{l.data[t]=e}))}o.putImageData(l,0,0);return s.toDataURL("image/png")}))}getMinMax(e,t){let A=t.maxValue?t.maxValue:Number.MIN_VALUE,i=t.minValue?t.minValue:Number.MAX_VALUE;for(let r=0;r<e.length;r+=1)void 0!==t.noDataValue&&e[r]===t.noDataValue||(e[r]>A&&(A=e[r]),e[r]<i&&(i=e[r]));return[i,A]}getColorValue(e,t,A,i=1){const n=r.scale(t.colorScale).domain(t.colorScaleValueRange);let a=null===t.useChannel?0:t.useChannel;const s=new Array(A),o=t.colorsBasedOnValues?t.colorsBasedOnValues.map((([e])=>e)):void 0,l=t.colorsBasedOnValues?t.colorsBasedOnValues.map((([,e])=>[...r(e).rgb(),Math.floor(2.55*t.alpha)])):void 0,g=t.useColorClasses?t.colorClasses.map((([e])=>[...r(e).rgb(),Math.floor(2.55*t.alpha)])):void 0,h=t.useColorClasses?t.colorClasses.map((([,e])=>e)):void 0,c=t.useColorClasses?t.colorClasses.map((([,,e],A)=>void 0!==e?e:A===t.colorClasses.length-1?[!0,!0]:[!0,!1])):void 0;for(let r=0;r<A;r+=4){let A=t.nullColor;if(void 0===t.noDataValue||e[a]!==t.noDataValue)if(null!=t.clipLow&&e[a]<=t.clipLow||null!=t.clipHigh&&e[a]>=t.clipHigh)A=t.clippedColor;else{if(t.useHeatMap&&(A=[...n(e[a]).rgb(),Math.floor(2.55*t.alpha)]),t.useColorsBasedOnValues){const i=o.indexOf(e[a]);A=i>-1?l[i]:t.unidentifiedColor}if(t.useColorClasses){const i=this.findClassIndex(e[a],h,c);A=i>-1?g[i]:t.unidentifiedColor}t.useSingleColor&&(A=t.color),t.useDataForOpacity&&(A[3]=this.scale(e[a],t.colorScaleValueRange[0],t.colorScaleValueRange.slice(-1)[0],0,255))}else Number.isNaN(e[a])&&(A=[0,0,0,0]);[s[r],s[r+1],s[r+2],s[r+3]]=A,a+=i}return s}findClassIndex(e,t,A){for(let i=0;i<t.length;i+=1){const[r,n]=t[i],[a,s]=A[i];if((a?e>=r:e>r)&&(s?e<=n:e<n))return i}return-1}getDefaultColor(e,t){const A=new Array(e);for(let i=0;i<e;i+=4)[A[i],A[i+1],A[i+2],A[i+3]]=t;return A}getColorFromChromaType(e){return Array.isArray(e)&&4===e.length?e:[...r(e).rgb(),255]}hasPixelsNoData(e,t){return void 0!==t&&e.every((e=>e===t))}}function Vn(e,t,A){const i=new On(t+1).createTile(A),{vertices:r,triangles:n}=i.getMesh(e);return{vertices:r,triangles:n}}const Zn=40075e3,jn=20037500;class Xn{constructor(e){this.zoomRange=[0,0],this.lowestOriginTileOffset=[0,0],this.lowestOriginTileSize=0,this.loaded=!1,this.geo=new Yn,this.lzw=new Ui,this.options=e}initializeCog(e){return n(this,void 0,void 0,(function*(){ge.fetch=(e,t)=>n(this,void 0,void 0,(function*(){return yield fetch(e,t)}));const t=new ge(e);return this.cog=yield ne.create(t),this.cog.images.forEach((e=>{e.loadGeoTiffTags()})),this.tileSize=this.getTileSize(this.cog),this.lowestOriginTileOffset=this.getImageTileIndex(this.cog.images[this.cog.images.length-1]),this.zoomRange=this.getZoomRange(this.cog),this.cog}))}getTileSize(e){return e.images[e.images.length-1].tileSize.width}getZoomRange(e){const t=e.images[e.images.length-1],A=this.getZoomLevelFromResolution(e.images[e.images.length-1].tileSize.width,t.resolution[0]);return[A,A+(e.images.length-1)]}getBoundsAsLatLon(e){const{bbox:t}=e.images[e.images.length-1],A=Math.min(t[0],t[2]),i=Math.max(t[0],t[2]),r=Math.min(t[1],t[3]),n=Math.max(t[1],t[3]),a=this.getLatLon([A,r]),s=this.getLatLon([i,n]);return[a[0],a[1],s[0],s[1]]}getOriginAsLatLon(e){const{origin:t}=e.images[e.images.length-1];return this.getLatLon(t)}getImageTileIndex(e){const t=jn+e.origin[0],A=-(jn+(e.origin[1]-Zn)),i=e.tileSize.width*this.getResolutionFromZoomLevel(e.tileSize.width,this.getZoomLevelFromResolution(e.tileSize.width,e.resolution[0]));return[Math.round(t/i),Math.round(A/i),this.getZoomLevelFromResolution(e.tileSize.width,e.resolution[0])]}getResolutionFromZoomLevel(e,t){return Zn/e/Math.pow(2,t)}getZoomLevelFromResolution(e,t){return Math.round(Math.log2(Zn/(t*e)))}getLatLon(e){const t=function(e){const[t,A]=e,i=t/512*(2*yi)-yi,r=2*(Math.atan(Math.exp(A/512*(2*yi)-yi))-_i);return[i*bi,r*bi]}([12776044915782906e-21*(jn+e[0]),12776044915782906e-21*-(jn+(e[1]-Zn))]);return[t[0],-t[1]]}getTile(e,t,A,i){return n(this,void 0,void 0,(function*(){const r=this.getResolutionFromZoomLevel(this.tileSize,A),n=this.cog.getImageByResolution(r);let a=[0,0];if(A===this.zoomRange[0])a=this.lowestOriginTileOffset;else{const e=Math.pow(2,A-this.zoomRange[0]);a[0]=Math.floor(this.lowestOriginTileOffset[0]*e),a[1]=Math.floor(this.lowestOriginTileOffset[1]*e)}const s=n.tileCount.x,o=n.tileCount.y,l=a[0],g=a[1];let h,c;this.options.numOfChannels=Number(n.tags.get(277).value),this.options.noDataValue=this.getNoDataValue(n.tags),this.options.format||(this.options.format=this.getFormat(n.tags.get(339).value,n.tags.get(258).value));let f=n.tags.get(258).value;if(Array.isArray(f))if("terrain"===this.options.type){let e=0;f.forEach((t=>{e+=t})),f=e}else[f]=f;if(e-l>=0&&t-g>=0&&e-l<s&&t-g<o){const A=yield n.getTile(e-l,t-g);switch(n.compression){case"image/jpeg":c=pi.decode(A.bytes,{useTArray:!0});break;case"application/deflate":c=yield Ci(A.bytes);break;case"application/lzw":c=this.lzw.decodeBlock(A.bytes.buffer);break;default:console.warn(`Unexpected compression method: ${n.compression}`)}let r;switch(this.options.format){case"uint8":r=new Uint8Array(c.buffer);break;case"uint16":r=new Uint16Array(c.buffer);break;case"uint32":r=new Uint32Array(c.buffer);break;case"int8":r=new Int8Array(c.buffer);break;case"int16":r=new Int16Array(c.buffer);break;case"int32":r=new Int32Array(c.buffer);break;case"float32":r=new Float32Array(c.buffer);break;case"float64":r=new Float64Array(c.buffer);break;default:r=null}return h=yield this.geo.getMap({rasters:[r],width:this.tileSize,height:this.tileSize,bounds:i},this.options),h}return null}))}getFormat(e,t){let A,i=e,r=t;switch(Array.isArray(e)&&([i]=e),Array.isArray(t)&&([r]=t),i){case 1:switch(r){case 8:A="uint8";break;case 16:A="uint16";break;case 32:A="uint32";break;default:A=null}break;case 2:switch(r){case 8:A="int8";break;case 16:A="int16";break;case 32:A="int32";break;default:A=null}break;case 3:switch(r){case 32:A="float32";break;case 64:A="float64";break;default:A=null}break;default:throw new Error("Unknown data format.")}return A}getNoDataValue(e){if(e.has(42113)){const t=e.get(42113).value;if("string"==typeof t||t instanceof String){const e=t.replace(/[\0\s]/g,"");return Number(e)}return Number.isNaN(Number(t))?void 0:Number(t)}}testCog(){return n(this,void 0,void 0,(function*(){this.options={type:"image",multiplier:1,useChannel:1,alpha:180,clipLow:1,clipHigh:Number.MAX_VALUE};const e=yield this.initializeCog("https://gisat-gis.eu-central-1.linodeobjects.com/eman/versions/v2/Quadrants/Q3_Bolivia_ASTER_2002_RGB_COG_LZW.tif"),t=e.images[Math.floor(e.images.length/2)];console.log(t);const A=this.getImageTileIndex(t);console.log(A);const i=Math.floor(t.tileCount.x/2),r=Math.floor(t.tileCount.y/2);console.log(e.getTile(i,r,Math.floor(e.images.length/2)));const n=i+A[0],a=r+A[1],s=A[2],o=yield this.getTile(n,a,s);!1===o?console.log("couldn't retrieve tile"):console.log(o)}))}}class Wn extends e.CompositeLayer{constructor(e,t,A){super({}),this.id="",this.id=e,this.cogTiles=new Xn(A),this.blurredTexture=A.blurredTexture,this.url=t}initializeState(){this.state={initialized:!1},this.init(this.url)}init(e){return n(this,void 0,void 0,(function*(){const t=yield this.cogTiles.initializeCog(e);this.setState({initialized:!0}),this.tileSize=this.cogTiles.getTileSize(t);const A=this.cogTiles.getZoomRange(t);[this.minZoom,this.maxZoom]=A}))}renderLayers(){if(this.cogTiles.cog){return new t.TileLayer({id:`${this.id}-${String(performance.now())}`,getTileData:e=>this.cogTiles.getTile(e.index.x,e.index.y,e.index.z),minZoom:this.minZoom,maxZoom:this.maxZoom,tileSize:this.tileSize,maxRequests:6,extent:this.cogTiles.cog?this.cogTiles.getBoundsAsLatLon(this.cogTiles.cog):null,renderSubLayers:e=>{var t,r,n,a,s,o,l;const{bbox:{west:g,south:h,east:c,north:f}}=e.tile;return new A.BitmapLayer(e,Object.assign({data:null,image:e.data,bounds:[g,h,c,f],opacity:1,textureParameters:{[i.GL.TEXTURE_MIN_FILTER]:this.blurredTexture?i.GL.LINEAR:i.GL.NEAREST},extensions:(null===(r=null===(t=this.cogTiles)||void 0===t?void 0:t.options)||void 0===r?void 0:r.clampToTerrain)?[new Q]:[]},(null===(s=null===(a=null===(n=this.cogTiles)||void 0===n?void 0:n.options)||void 0===a?void 0:a.clampToTerrain)||void 0===s?void 0:s.terrainDrawMode)?{terrainDrawMode:null===(l=null===(o=this.cogTiles)||void 0===o?void 0:o.options)||void 0===l?void 0:l.clampToTerrain.terrainDrawMode}:{}))}})}return null}}Wn.layerName="CogBitmapLayer",Wn.displayName="CogBitmapLayer";class $n extends e.CompositeLayer{constructor(e,t,A,i,n){super({}),this.urlType="none",this.id="",this.id=e;const a=Object.assign(Object.assign({},Jn),A);var s;this.terrainOpacity=a.alpha/100,this.terrainColor=r(a.terrainColor.slice(0,3)).rgb(),this.terrainSkirtHeight=a.terrainSkirtHeight,i&&((s=i)&&s.includes("{x}")&&s.includes("{y}")&&s.includes("{z}")?(this.bitmapUrl=i,this.urlType="tile",this.terrainColor=[0,0,0,0]):!function(e){return!!(e.includes(".tif")||e.includes(".tiff")||e.includes(".TIF")||e.includes(".TIFF"))}(i)?console.warn("URL needs to point to a valid cog file, or needs to be in the {x}{y}{z} format."):(this.bitmapCogTiles=new Xn(n),this.bitmapCogTiles.initializeCog(i),this.urlType="cog",this.terrainColor=[0,0,0,0])),this.terrainCogTiles=new Xn(A),this.terrainUrl=t}initializeState(){const e=Object.create(null,{initializeState:{get:()=>super.initializeState}});return n(this,void 0,void 0,(function*(){e.initializeState.call(this),this.setState({initialized:!1}),yield this.init(this.terrainUrl)}))}shouldUpdateState(){var e;return 0===(null===(e=this.internalState)||void 0===e?void 0:e.subLayers.length)}init(e){return n(this,void 0,void 0,(function*(){const t=yield this.terrainCogTiles.initializeCog(e);this.tileSize=this.terrainCogTiles.getTileSize(t);const A=this.terrainCogTiles.getZoomRange(t);[this.props.minZoom,this.props.maxZoom]=A,this.setState({initialized:!0})}))}renderLayers(){if(this.terrainCogTiles.cog){let e;this.urlType;return[new t.TileLayer({id:`${this.id}-${String(performance.now())}`,zoomOffset:-1,getTileData:e=>this.terrainCogTiles.getTile(e.index.x,e.index.y,e.index.z),minZoom:this.minZoom,maxZoom:this.maxZoom,tileSize:this.tileSize,maxRequests:6,refinementStrategy:"best-available",extent:this.terrainCogTiles.getBoundsAsLatLon(this.terrainCogTiles.cog),renderSubLayers:A=>{if(A.data&&void 0!==A.tile.index.x){switch(this.urlType){case"tile":i=this.bitmapUrl,r=A.tile.index.x,n=A.tile.index.y,a=A.tile.index.z,e=i.replace("{x}",String(r)).replace("{y}",String(n)).replace("{z}",String(a));break;case"cog":e=this.bitmapCogTiles.getTile(A.tile.index.x,A.tile.index.y,A.tile.index.z);break;default:e=null}return new t.TerrainLayer({id:`terrain-${A.tile.index.x}-${A.tile.index.y}-${A.tile.index.z}`,pickable:!0,elevationDecoder:{rScaler:6553.6,gScaler:25.6,bScaler:.1,offset:-1e4},elevationData:A.data,texture:e,opacity:this.terrainOpacity,bounds:[A.tile.bbox.west,A.tile.bbox.south,A.tile.bbox.east,A.tile.bbox.north],color:this.terrainColor,operation:"terrain+draw",minZoom:this.minZoom,maxZoom:this.maxZoom,loadOptions:{terrain:{skirtHeight:this.terrainSkirtHeight,tesselator:"martini"}},meshMaxError:12})}var i,r,n,a;return null}})]}return[]}}$n.layerName="CogTerrainLayer",$n.displayName="CogTerrainLayer";var ea={CogBitmapLayer:Wn,CogTerrainLayer:$n,cogtiles:Xn,GeoImage:Yn};var ta=Object.freeze({__proto__:null,default:class extends Un{decodeBlock(e){return e}}});const Aa=257;function ia(e,t){for(let A=t.length-1;A>=0;A--)e.push(t[A]);return e}function ra(e){const t=new Uint16Array(4093),A=new Uint8Array(4093);for(let e=0;e<=257;e++)t[e]=4096,A[e]=e;let i=258,r=9,n=0;function a(){i=258,r=9}function s(e){const t=function(e,t,A){const i=t%8,r=Math.floor(t/8),n=8-i,a=t+A-8*(r+1);let s=8*(r+2)-(t+A);const o=8*(r+2)-t;if(s=Math.max(0,s),r>=e.length)return console.warn("ran off the end of the buffer before finding EOI_CODE (end on input code)"),Aa;let l=e[r]&2**(8-i)-1;l<<=A-n;let g=l;if(r+1<e.length){let t=e[r+1]>>>s;t<<=Math.max(0,A-o),g+=t}if(a>8&&r+2<e.length){const i=8*(r+3)-(t+A);g+=e[r+2]>>>i}return g}(e,n,r);return n+=r,t}function o(e,r){return A[i]=r,t[i]=e,i++,i-1}function l(e){const i=[];for(let r=e;4096!==r;r=t[r])i.push(A[r]);return i}const g=[];a();const h=new Uint8Array(e);let c,f=s(h);for(;f!==Aa;){if(256===f){for(a(),f=s(h);256===f;)f=s(h);if(f===Aa)break;if(f>256)throw new Error(`corrupted code at scanline ${f}`);ia(g,l(f)),c=f}else if(f<i){const e=l(f);ia(g,e),o(c,e[e.length-1]),c=f}else{const e=l(c);if(!e)throw new Error(`Bogus entry. Not in dictionary, ${c} / ${i}, position: ${n}`);ia(g,e),g.push(e[e.length-1]),o(c,e[e.length-1]),c=f}i+1>=2**r&&(12===r?c=void 0:r++),f=s(h)}return new Uint8Array(g)}var na=Object.freeze({__proto__:null,default:class extends Un{decodeBlock(e){return ra(e).buffer}}});const aa=new Int32Array([0,1,8,16,9,2,3,10,17,24,32,25,18,11,4,5,12,19,26,33,40,48,41,34,27,20,13,6,7,14,21,28,35,42,49,56,57,50,43,36,29,22,15,23,30,37,44,51,58,59,52,45,38,31,39,46,53,60,61,54,47,55,62,63]),sa=4017,oa=799,la=3406,ga=2276,ha=1567,ca=3784,fa=5793,da=2896;function ua(e,t){let A=0;const i=[];let r=16;for(;r>0&&!e[r-1];)--r;i.push({children:[],index:0});let n,a=i[0];for(let s=0;s<r;s++){for(let r=0;r<e[s];r++){for(a=i.pop(),a.children[a.index]=t[A];a.index>0;)a=i.pop();for(a.index++,i.push(a);i.length<=s;)i.push(n={children:[],index:0}),a.children[a.index]=n.children,a=n;A++}s+1<r&&(i.push(n={children:[],index:0}),a.children[a.index]=n.children,a=n)}return i[0].children}function Ia(e,t,A,i,r,n,a,s,o){const{mcusPerLine:l,progressive:g}=A,h=t;let c=t,f=0,d=0;function u(){if(d>0)return d--,f>>d&1;if(f=e[c++],255===f){const t=e[c++];if(t)throw new Error(`unexpected marker: ${(f<<8|t).toString(16)}`)}return d=7,f>>>7}function I(e){let t,A=e;for(;null!==(t=u());){if(A=A[t],"number"==typeof A)return A;if("object"!=typeof A)throw new Error("invalid huffman sequence")}return null}function B(e){let t=e,A=0;for(;t>0;){const e=u();if(null===e)return;A=A<<1|e,--t}return A}function C(e){const t=B(e);return t>=1<<e-1?t:t+(-1<<e)+1}let E=0;let w,Q=0;function m(e,t,A,i,r){const n=A%l,a=(A/l|0)*e.v+i,s=n*e.h+r;t(e,e.blocks[a][s])}function p(e,t,A){const i=A/e.blocksPerLine|0,r=A%e.blocksPerLine;t(e,e.blocks[i][r])}const y=i.length;let _,b,D,k,v,x;x=g?0===n?0===s?function(e,t){const A=I(e.huffmanTableDC),i=0===A?0:C(A)<<o;e.pred+=i,t[0]=e.pred}:function(e,t){t[0]|=u()<<o}:0===s?function(e,t){if(E>0)return void E--;let A=n;const i=a;for(;A<=i;){const i=I(e.huffmanTableAC),r=15&i,n=i>>4;if(0===r){if(n<15){E=B(n)+(1<<n)-1;break}A+=16}else A+=n,t[aa[A]]=C(r)*(1<<o),A++}}:function(e,t){let A=n;const i=a;let r=0;for(;A<=i;){const i=aa[A],n=t[i]<0?-1:1;switch(Q){case 0:{const t=I(e.huffmanTableAC),A=15&t;if(r=t>>4,0===A)r<15?(E=B(r)+(1<<r),Q=4):(r=16,Q=1);else{if(1!==A)throw new Error("invalid ACn encoding");w=C(A),Q=r?2:3}continue}case 1:case 2:t[i]?t[i]+=(u()<<o)*n:(r--,0===r&&(Q=2===Q?3:0));break;case 3:t[i]?t[i]+=(u()<<o)*n:(t[i]=w<<o,Q=0);break;case 4:t[i]&&(t[i]+=(u()<<o)*n)}A++}4===Q&&(E--,0===E&&(Q=0))}:function(e,t){const A=I(e.huffmanTableDC),i=0===A?0:C(A);e.pred+=i,t[0]=e.pred;let r=1;for(;r<64;){const A=I(e.huffmanTableAC),i=15&A,n=A>>4;if(0===i){if(n<15)break;r+=16}else r+=n,t[aa[r]]=C(i),r++}};let S,G,U=0;G=1===y?i[0].blocksPerLine*i[0].blocksPerColumn:l*A.mcusPerColumn;const M=r||G;for(;U<G;){for(b=0;b<y;b++)i[b].pred=0;if(E=0,1===y)for(_=i[0],v=0;v<M;v++)p(_,x,U),U++;else for(v=0;v<M;v++){for(b=0;b<y;b++){_=i[b];const{h:e,v:t}=_;for(D=0;D<t;D++)for(k=0;k<e;k++)m(_,x,U,D,k)}if(U++,U===G)break}if(d=0,S=e[c]<<8|e[c+1],S<65280)throw new Error("marker was not found");if(!(S>=65488&&S<=65495))break;c+=2}return c-h}function Ba(e,t){const A=[],{blocksPerLine:i,blocksPerColumn:r}=t,n=i<<3,a=new Int32Array(64),s=new Uint8Array(64);function o(e,A,i){const r=t.quantizationTable;let n,a,s,o,l,g,h,c,f;const d=i;let u;for(u=0;u<64;u++)d[u]=e[u]*r[u];for(u=0;u<8;++u){const e=8*u;0!==d[1+e]||0!==d[2+e]||0!==d[3+e]||0!==d[4+e]||0!==d[5+e]||0!==d[6+e]||0!==d[7+e]?(n=fa*d[0+e]+128>>8,a=fa*d[4+e]+128>>8,s=d[2+e],o=d[6+e],l=da*(d[1+e]-d[7+e])+128>>8,c=da*(d[1+e]+d[7+e])+128>>8,g=d[3+e]<<4,h=d[5+e]<<4,f=n-a+1>>1,n=n+a+1>>1,a=f,f=s*ca+o*ha+128>>8,s=s*ha-o*ca+128>>8,o=f,f=l-h+1>>1,l=l+h+1>>1,h=f,f=c+g+1>>1,g=c-g+1>>1,c=f,f=n-o+1>>1,n=n+o+1>>1,o=f,f=a-s+1>>1,a=a+s+1>>1,s=f,f=l*ga+c*la+2048>>12,l=l*la-c*ga+2048>>12,c=f,f=g*oa+h*sa+2048>>12,g=g*sa-h*oa+2048>>12,h=f,d[0+e]=n+c,d[7+e]=n-c,d[1+e]=a+h,d[6+e]=a-h,d[2+e]=s+g,d[5+e]=s-g,d[3+e]=o+l,d[4+e]=o-l):(f=fa*d[0+e]+512>>10,d[0+e]=f,d[1+e]=f,d[2+e]=f,d[3+e]=f,d[4+e]=f,d[5+e]=f,d[6+e]=f,d[7+e]=f)}for(u=0;u<8;++u){const e=u;0!==d[8+e]||0!==d[16+e]||0!==d[24+e]||0!==d[32+e]||0!==d[40+e]||0!==d[48+e]||0!==d[56+e]?(n=fa*d[0+e]+2048>>12,a=fa*d[32+e]+2048>>12,s=d[16+e],o=d[48+e],l=da*(d[8+e]-d[56+e])+2048>>12,c=da*(d[8+e]+d[56+e])+2048>>12,g=d[24+e],h=d[40+e],f=n-a+1>>1,n=n+a+1>>1,a=f,f=s*ca+o*ha+2048>>12,s=s*ha-o*ca+2048>>12,o=f,f=l-h+1>>1,l=l+h+1>>1,h=f,f=c+g+1>>1,g=c-g+1>>1,c=f,f=n-o+1>>1,n=n+o+1>>1,o=f,f=a-s+1>>1,a=a+s+1>>1,s=f,f=l*ga+c*la+2048>>12,l=l*la-c*ga+2048>>12,c=f,f=g*oa+h*sa+2048>>12,g=g*sa-h*oa+2048>>12,h=f,d[0+e]=n+c,d[56+e]=n-c,d[8+e]=a+h,d[48+e]=a-h,d[16+e]=s+g,d[40+e]=s-g,d[24+e]=o+l,d[32+e]=o-l):(f=fa*i[u+0]+8192>>14,d[0+e]=f,d[8+e]=f,d[16+e]=f,d[24+e]=f,d[32+e]=f,d[40+e]=f,d[48+e]=f,d[56+e]=f)}for(u=0;u<64;++u){const e=128+(d[u]+8>>4);A[u]=e<0?0:e>255?255:e}}for(let e=0;e<r;e++){const r=e<<3;for(let e=0;e<8;e++)A.push(new Uint8Array(n));for(let n=0;n<i;n++){o(t.blocks[e][n],s,a);let i=0;const l=n<<3;for(let e=0;e<8;e++){const t=A[r+e];for(let e=0;e<8;e++)t[l+e]=s[i++]}}}return A}class Ca{constructor(){this.jfif=null,this.adobe=null,this.quantizationTables=[],this.huffmanTablesAC=[],this.huffmanTablesDC=[],this.resetFrames()}resetFrames(){this.frames=[]}parse(e){let t=0;function A(){const A=e[t]<<8|e[t+1];return t+=2,A}function i(){const i=A(),r=e.subarray(t,t+i-2);return t+=r.length,r}function r(e){let t,A,i=0,r=0;for(A in e.components)e.components.hasOwnProperty(A)&&(t=e.components[A],i<t.h&&(i=t.h),r<t.v&&(r=t.v));const n=Math.ceil(e.samplesPerLine/8/i),a=Math.ceil(e.scanLines/8/r);for(A in e.components)if(e.components.hasOwnProperty(A)){t=e.components[A];const s=Math.ceil(Math.ceil(e.samplesPerLine/8)*t.h/i),o=Math.ceil(Math.ceil(e.scanLines/8)*t.v/r),l=n*t.h,g=a*t.v,h=[];for(let e=0;e<g;e++){const e=[];for(let t=0;t<l;t++)e.push(new Int32Array(64));h.push(e)}t.blocksPerLine=s,t.blocksPerColumn=o,t.blocks=h}e.maxH=i,e.maxV=r,e.mcusPerLine=n,e.mcusPerColumn=a}let n=A();if(65496!==n)throw new Error("SOI not found");for(n=A();65497!==n;){switch(n){case 65280:break;case 65504:case 65505:case 65506:case 65507:case 65508:case 65509:case 65510:case 65511:case 65512:case 65513:case 65514:case 65515:case 65516:case 65517:case 65518:case 65519:case 65534:{const e=i();65504===n&&74===e[0]&&70===e[1]&&73===e[2]&&70===e[3]&&0===e[4]&&(this.jfif={version:{major:e[5],minor:e[6]},densityUnits:e[7],xDensity:e[8]<<8|e[9],yDensity:e[10]<<8|e[11],thumbWidth:e[12],thumbHeight:e[13],thumbData:e.subarray(14,14+3*e[12]*e[13])}),65518===n&&65===e[0]&&100===e[1]&&111===e[2]&&98===e[3]&&101===e[4]&&0===e[5]&&(this.adobe={version:e[6],flags0:e[7]<<8|e[8],flags1:e[9]<<8|e[10],transformCode:e[11]});break}case 65499:{const i=A()+t-2;for(;t<i;){const i=e[t++],r=new Int32Array(64);if(i>>4==0)for(let A=0;A<64;A++){r[aa[A]]=e[t++]}else{if(i>>4!=1)throw new Error("DQT: invalid table spec");for(let e=0;e<64;e++){r[aa[e]]=A()}}this.quantizationTables[15&i]=r}break}case 65472:case 65473:case 65474:{A();const i={extended:65473===n,progressive:65474===n,precision:e[t++],scanLines:A(),samplesPerLine:A(),components:{},componentsOrder:[]},a=e[t++];let s;for(let A=0;A<a;A++){s=e[t];const A=e[t+1]>>4,r=15&e[t+1],n=e[t+2];i.componentsOrder.push(s),i.components[s]={h:A,v:r,quantizationIdx:n},t+=3}r(i),this.frames.push(i);break}case 65476:{const i=A();for(let A=2;A<i;){const i=e[t++],r=new Uint8Array(16);let n=0;for(let A=0;A<16;A++,t++)r[A]=e[t],n+=r[A];const a=new Uint8Array(n);for(let A=0;A<n;A++,t++)a[A]=e[t];A+=17+n,i>>4==0?this.huffmanTablesDC[15&i]=ua(r,a):this.huffmanTablesAC[15&i]=ua(r,a)}break}case 65501:A(),this.resetInterval=A();break;case 65498:{A();const i=e[t++],r=[],n=this.frames[0];for(let A=0;A<i;A++){const A=n.components[e[t++]],i=e[t++];A.huffmanTableDC=this.huffmanTablesDC[i>>4],A.huffmanTableAC=this.huffmanTablesAC[15&i],r.push(A)}const a=e[t++],s=e[t++],o=e[t++],l=Ia(e,t,n,r,this.resetInterval,a,s,o>>4,15&o);t+=l;break}case 65535:255!==e[t]&&t--;break;default:if(255===e[t-3]&&e[t-2]>=192&&e[t-2]<=254){t-=3;break}throw new Error(`unknown JPEG marker ${n.toString(16)}`)}n=A()}}getResult(){const{frames:e}=this;if(0===this.frames.length)throw new Error("no frames were decoded");this.frames.length>1&&console.warn("more than one frame is not supported");for(let e=0;e<this.frames.length;e++){const t=this.frames[e].components;for(const e of Object.keys(t))t[e].quantizationTable=this.quantizationTables[t[e].quantizationIdx],delete t[e].quantizationIdx}const t=e[0],{components:A,componentsOrder:i}=t,r=[],n=t.samplesPerLine,a=t.scanLines;for(let e=0;e<i.length;e++){const n=A[i[e]];r.push({lines:Ba(0,n),scaleX:n.h/t.maxH,scaleY:n.v/t.maxV})}const s=new Uint8Array(n*a*r.length);let o=0;for(let e=0;e<a;++e)for(let t=0;t<n;++t)for(let A=0;A<r.length;++A){const i=r[A];s[o]=i.lines[0|e*i.scaleY][0|t*i.scaleX],++o}return s}}var Ea=Object.freeze({__proto__:null,default:class extends Un{constructor(e){super(),this.reader=new Ca,e.JPEGTables&&this.reader.parse(e.JPEGTables)}decodeBlock(e){return this.reader.resetFrames(),this.reader.parse(new Uint8Array(e)),this.reader.getResult().buffer}}});
3
- /*! pako 2.1.0 https://github.com/nodeca/pako @license (MIT AND Zlib) */function wa(e){let t=e.length;for(;--t>=0;)e[t]=0}const Qa=256,ma=286,pa=30,ya=15,_a=new Uint8Array([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]),ba=new Uint8Array([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]),Da=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),ka=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),va=new Array(576);wa(va);const xa=new Array(60);wa(xa);const Sa=new Array(512);wa(Sa);const Ga=new Array(256);wa(Ga);const Ua=new Array(29);wa(Ua);const Ma=new Array(pa);function Ra(e,t,A,i,r){this.static_tree=e,this.extra_bits=t,this.extra_base=A,this.elems=i,this.max_length=r,this.has_stree=e&&e.length}let Fa,La,Ta;function Na(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}wa(Ma);const Pa=e=>e<256?Sa[e]:Sa[256+(e>>>7)],Oa=(e,t)=>{e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255},za=(e,t,A)=>{e.bi_valid>16-A?(e.bi_buf|=t<<e.bi_valid&65535,Oa(e,e.bi_buf),e.bi_buf=t>>16-e.bi_valid,e.bi_valid+=A-16):(e.bi_buf|=t<<e.bi_valid&65535,e.bi_valid+=A)},Ka=(e,t,A)=>{za(e,A[2*t],A[2*t+1])},Ha=(e,t)=>{let A=0;do{A|=1&e,e>>>=1,A<<=1}while(--t>0);return A>>>1},qa=(e,t,A)=>{const i=new Array(16);let r,n,a=0;for(r=1;r<=ya;r++)a=a+A[r-1]<<1,i[r]=a;for(n=0;n<=t;n++){let t=e[2*n+1];0!==t&&(e[2*n]=Ha(i[t]++,t))}},Ja=e=>{let t;for(t=0;t<ma;t++)e.dyn_ltree[2*t]=0;for(t=0;t<pa;t++)e.dyn_dtree[2*t]=0;for(t=0;t<19;t++)e.bl_tree[2*t]=0;e.dyn_ltree[512]=1,e.opt_len=e.static_len=0,e.sym_next=e.matches=0},Ya=e=>{e.bi_valid>8?Oa(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0},Va=(e,t,A,i)=>{const r=2*t,n=2*A;return e[r]<e[n]||e[r]===e[n]&&i[t]<=i[A]},Za=(e,t,A)=>{const i=e.heap[A];let r=A<<1;for(;r<=e.heap_len&&(r<e.heap_len&&Va(t,e.heap[r+1],e.heap[r],e.depth)&&r++,!Va(t,i,e.heap[r],e.depth));)e.heap[A]=e.heap[r],A=r,r<<=1;e.heap[A]=i},ja=(e,t,A)=>{let i,r,n,a,s=0;if(0!==e.sym_next)do{i=255&e.pending_buf[e.sym_buf+s++],i+=(255&e.pending_buf[e.sym_buf+s++])<<8,r=e.pending_buf[e.sym_buf+s++],0===i?Ka(e,r,t):(n=Ga[r],Ka(e,n+Qa+1,t),a=_a[n],0!==a&&(r-=Ua[n],za(e,r,a)),i--,n=Pa(i),Ka(e,n,A),a=ba[n],0!==a&&(i-=Ma[n],za(e,i,a)))}while(s<e.sym_next);Ka(e,256,t)},Xa=(e,t)=>{const A=t.dyn_tree,i=t.stat_desc.static_tree,r=t.stat_desc.has_stree,n=t.stat_desc.elems;let a,s,o,l=-1;for(e.heap_len=0,e.heap_max=573,a=0;a<n;a++)0!==A[2*a]?(e.heap[++e.heap_len]=l=a,e.depth[a]=0):A[2*a+1]=0;for(;e.heap_len<2;)o=e.heap[++e.heap_len]=l<2?++l:0,A[2*o]=1,e.depth[o]=0,e.opt_len--,r&&(e.static_len-=i[2*o+1]);for(t.max_code=l,a=e.heap_len>>1;a>=1;a--)Za(e,A,a);o=n;do{a=e.heap[1],e.heap[1]=e.heap[e.heap_len--],Za(e,A,1),s=e.heap[1],e.heap[--e.heap_max]=a,e.heap[--e.heap_max]=s,A[2*o]=A[2*a]+A[2*s],e.depth[o]=(e.depth[a]>=e.depth[s]?e.depth[a]:e.depth[s])+1,A[2*a+1]=A[2*s+1]=o,e.heap[1]=o++,Za(e,A,1)}while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],((e,t)=>{const A=t.dyn_tree,i=t.max_code,r=t.stat_desc.static_tree,n=t.stat_desc.has_stree,a=t.stat_desc.extra_bits,s=t.stat_desc.extra_base,o=t.stat_desc.max_length;let l,g,h,c,f,d,u=0;for(c=0;c<=ya;c++)e.bl_count[c]=0;for(A[2*e.heap[e.heap_max]+1]=0,l=e.heap_max+1;l<573;l++)g=e.heap[l],c=A[2*A[2*g+1]+1]+1,c>o&&(c=o,u++),A[2*g+1]=c,g>i||(e.bl_count[c]++,f=0,g>=s&&(f=a[g-s]),d=A[2*g],e.opt_len+=d*(c+f),n&&(e.static_len+=d*(r[2*g+1]+f)));if(0!==u){do{for(c=o-1;0===e.bl_count[c];)c--;e.bl_count[c]--,e.bl_count[c+1]+=2,e.bl_count[o]--,u-=2}while(u>0);for(c=o;0!==c;c--)for(g=e.bl_count[c];0!==g;)h=e.heap[--l],h>i||(A[2*h+1]!==c&&(e.opt_len+=(c-A[2*h+1])*A[2*h],A[2*h+1]=c),g--)}})(e,t),qa(A,l,e.bl_count)},Wa=(e,t,A)=>{let i,r,n=-1,a=t[1],s=0,o=7,l=4;for(0===a&&(o=138,l=3),t[2*(A+1)+1]=65535,i=0;i<=A;i++)r=a,a=t[2*(i+1)+1],++s<o&&r===a||(s<l?e.bl_tree[2*r]+=s:0!==r?(r!==n&&e.bl_tree[2*r]++,e.bl_tree[32]++):s<=10?e.bl_tree[34]++:e.bl_tree[36]++,s=0,n=r,0===a?(o=138,l=3):r===a?(o=6,l=3):(o=7,l=4))},$a=(e,t,A)=>{let i,r,n=-1,a=t[1],s=0,o=7,l=4;for(0===a&&(o=138,l=3),i=0;i<=A;i++)if(r=a,a=t[2*(i+1)+1],!(++s<o&&r===a)){if(s<l)do{Ka(e,r,e.bl_tree)}while(0!=--s);else 0!==r?(r!==n&&(Ka(e,r,e.bl_tree),s--),Ka(e,16,e.bl_tree),za(e,s-3,2)):s<=10?(Ka(e,17,e.bl_tree),za(e,s-3,3)):(Ka(e,18,e.bl_tree),za(e,s-11,7));s=0,n=r,0===a?(o=138,l=3):r===a?(o=6,l=3):(o=7,l=4)}};let es=!1;const ts=(e,t,A,i)=>{za(e,0+(i?1:0),3),Ya(e),Oa(e,A),Oa(e,~A),A&&e.pending_buf.set(e.window.subarray(t,t+A),e.pending),e.pending+=A};var As=(e,t,A,i)=>{let r,n,a=0;e.level>0?(2===e.strm.data_type&&(e.strm.data_type=(e=>{let t,A=4093624447;for(t=0;t<=31;t++,A>>>=1)if(1&A&&0!==e.dyn_ltree[2*t])return 0;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return 1;for(t=32;t<Qa;t++)if(0!==e.dyn_ltree[2*t])return 1;return 0})(e)),Xa(e,e.l_desc),Xa(e,e.d_desc),a=(e=>{let t;for(Wa(e,e.dyn_ltree,e.l_desc.max_code),Wa(e,e.dyn_dtree,e.d_desc.max_code),Xa(e,e.bl_desc),t=18;t>=3&&0===e.bl_tree[2*ka[t]+1];t--);return e.opt_len+=3*(t+1)+5+5+4,t})(e),r=e.opt_len+3+7>>>3,n=e.static_len+3+7>>>3,n<=r&&(r=n)):r=n=A+5,A+4<=r&&-1!==t?ts(e,t,A,i):4===e.strategy||n===r?(za(e,2+(i?1:0),3),ja(e,va,xa)):(za(e,4+(i?1:0),3),((e,t,A,i)=>{let r;for(za(e,t-257,5),za(e,A-1,5),za(e,i-4,4),r=0;r<i;r++)za(e,e.bl_tree[2*ka[r]+1],3);$a(e,e.dyn_ltree,t-1),$a(e,e.dyn_dtree,A-1)})(e,e.l_desc.max_code+1,e.d_desc.max_code+1,a+1),ja(e,e.dyn_ltree,e.dyn_dtree)),Ja(e),i&&Ya(e)},is={_tr_init:e=>{es||((()=>{let e,t,A,i,r;const n=new Array(16);for(A=0,i=0;i<28;i++)for(Ua[i]=A,e=0;e<1<<_a[i];e++)Ga[A++]=i;for(Ga[A-1]=i,r=0,i=0;i<16;i++)for(Ma[i]=r,e=0;e<1<<ba[i];e++)Sa[r++]=i;for(r>>=7;i<pa;i++)for(Ma[i]=r<<7,e=0;e<1<<ba[i]-7;e++)Sa[256+r++]=i;for(t=0;t<=ya;t++)n[t]=0;for(e=0;e<=143;)va[2*e+1]=8,e++,n[8]++;for(;e<=255;)va[2*e+1]=9,e++,n[9]++;for(;e<=279;)va[2*e+1]=7,e++,n[7]++;for(;e<=287;)va[2*e+1]=8,e++,n[8]++;for(qa(va,287,n),e=0;e<pa;e++)xa[2*e+1]=5,xa[2*e]=Ha(e,5);Fa=new Ra(va,_a,257,ma,ya),La=new Ra(xa,ba,0,pa,ya),Ta=new Ra(new Array(0),Da,0,19,7)})(),es=!0),e.l_desc=new Na(e.dyn_ltree,Fa),e.d_desc=new Na(e.dyn_dtree,La),e.bl_desc=new Na(e.bl_tree,Ta),e.bi_buf=0,e.bi_valid=0,Ja(e)},_tr_stored_block:ts,_tr_flush_block:As,_tr_tally:(e,t,A)=>(e.pending_buf[e.sym_buf+e.sym_next++]=t,e.pending_buf[e.sym_buf+e.sym_next++]=t>>8,e.pending_buf[e.sym_buf+e.sym_next++]=A,0===t?e.dyn_ltree[2*A]++:(e.matches++,t--,e.dyn_ltree[2*(Ga[A]+Qa+1)]++,e.dyn_dtree[2*Pa(t)]++),e.sym_next===e.sym_end),_tr_align:e=>{za(e,2,3),Ka(e,256,va),(e=>{16===e.bi_valid?(Oa(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):e.bi_valid>=8&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)})(e)}};var rs=(e,t,A,i)=>{let r=65535&e|0,n=e>>>16&65535|0,a=0;for(;0!==A;){a=A>2e3?2e3:A,A-=a;do{r=r+t[i++]|0,n=n+r|0}while(--a);r%=65521,n%=65521}return r|n<<16|0};const ns=new Uint32Array((()=>{let e,t=[];for(var A=0;A<256;A++){e=A;for(var i=0;i<8;i++)e=1&e?3988292384^e>>>1:e>>>1;t[A]=e}return t})());var as=(e,t,A,i)=>{const r=ns,n=i+A;e^=-1;for(let A=i;A<n;A++)e=e>>>8^r[255&(e^t[A])];return-1^e},ss={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},os={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8};const{_tr_init:ls,_tr_stored_block:gs,_tr_flush_block:hs,_tr_tally:cs,_tr_align:fs}=is,{Z_NO_FLUSH:ds,Z_PARTIAL_FLUSH:us,Z_FULL_FLUSH:Is,Z_FINISH:Bs,Z_BLOCK:Cs,Z_OK:Es,Z_STREAM_END:ws,Z_STREAM_ERROR:Qs,Z_DATA_ERROR:ms,Z_BUF_ERROR:ps,Z_DEFAULT_COMPRESSION:ys,Z_FILTERED:_s,Z_HUFFMAN_ONLY:bs,Z_RLE:Ds,Z_FIXED:ks,Z_DEFAULT_STRATEGY:vs,Z_UNKNOWN:xs,Z_DEFLATED:Ss}=os,Gs=258,Us=262,Ms=42,Rs=113,Fs=666,Ls=(e,t)=>(e.msg=ss[t],t),Ts=e=>2*e-(e>4?9:0),Ns=e=>{let t=e.length;for(;--t>=0;)e[t]=0},Ps=e=>{let t,A,i,r=e.w_size;t=e.hash_size,i=t;do{A=e.head[--i],e.head[i]=A>=r?A-r:0}while(--t);t=r,i=t;do{A=e.prev[--i],e.prev[i]=A>=r?A-r:0}while(--t)};let Os=(e,t,A)=>(t<<e.hash_shift^A)&e.hash_mask;const zs=e=>{const t=e.state;let A=t.pending;A>e.avail_out&&(A=e.avail_out),0!==A&&(e.output.set(t.pending_buf.subarray(t.pending_out,t.pending_out+A),e.next_out),e.next_out+=A,t.pending_out+=A,e.total_out+=A,e.avail_out-=A,t.pending-=A,0===t.pending&&(t.pending_out=0))},Ks=(e,t)=>{hs(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,zs(e.strm)},Hs=(e,t)=>{e.pending_buf[e.pending++]=t},qs=(e,t)=>{e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t},Js=(e,t,A,i)=>{let r=e.avail_in;return r>i&&(r=i),0===r?0:(e.avail_in-=r,t.set(e.input.subarray(e.next_in,e.next_in+r),A),1===e.state.wrap?e.adler=rs(e.adler,t,r,A):2===e.state.wrap&&(e.adler=as(e.adler,t,r,A)),e.next_in+=r,e.total_in+=r,r)},Ys=(e,t)=>{let A,i,r=e.max_chain_length,n=e.strstart,a=e.prev_length,s=e.nice_match;const o=e.strstart>e.w_size-Us?e.strstart-(e.w_size-Us):0,l=e.window,g=e.w_mask,h=e.prev,c=e.strstart+Gs;let f=l[n+a-1],d=l[n+a];e.prev_length>=e.good_match&&(r>>=2),s>e.lookahead&&(s=e.lookahead);do{if(A=t,l[A+a]===d&&l[A+a-1]===f&&l[A]===l[n]&&l[++A]===l[n+1]){n+=2,A++;do{}while(l[++n]===l[++A]&&l[++n]===l[++A]&&l[++n]===l[++A]&&l[++n]===l[++A]&&l[++n]===l[++A]&&l[++n]===l[++A]&&l[++n]===l[++A]&&l[++n]===l[++A]&&n<c);if(i=Gs-(c-n),n=c-Gs,i>a){if(e.match_start=t,a=i,i>=s)break;f=l[n+a-1],d=l[n+a]}}}while((t=h[t&g])>o&&0!=--r);return a<=e.lookahead?a:e.lookahead},Vs=e=>{const t=e.w_size;let A,i,r;do{if(i=e.window_size-e.lookahead-e.strstart,e.strstart>=t+(t-Us)&&(e.window.set(e.window.subarray(t,t+t-i),0),e.match_start-=t,e.strstart-=t,e.block_start-=t,e.insert>e.strstart&&(e.insert=e.strstart),Ps(e),i+=t),0===e.strm.avail_in)break;if(A=Js(e.strm,e.window,e.strstart+e.lookahead,i),e.lookahead+=A,e.lookahead+e.insert>=3)for(r=e.strstart-e.insert,e.ins_h=e.window[r],e.ins_h=Os(e,e.ins_h,e.window[r+1]);e.insert&&(e.ins_h=Os(e,e.ins_h,e.window[r+3-1]),e.prev[r&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=r,r++,e.insert--,!(e.lookahead+e.insert<3)););}while(e.lookahead<Us&&0!==e.strm.avail_in)},Zs=(e,t)=>{let A,i,r,n=e.pending_buf_size-5>e.w_size?e.w_size:e.pending_buf_size-5,a=0,s=e.strm.avail_in;do{if(A=65535,r=e.bi_valid+42>>3,e.strm.avail_out<r)break;if(r=e.strm.avail_out-r,i=e.strstart-e.block_start,A>i+e.strm.avail_in&&(A=i+e.strm.avail_in),A>r&&(A=r),A<n&&(0===A&&t!==Bs||t===ds||A!==i+e.strm.avail_in))break;a=t===Bs&&A===i+e.strm.avail_in?1:0,gs(e,0,0,a),e.pending_buf[e.pending-4]=A,e.pending_buf[e.pending-3]=A>>8,e.pending_buf[e.pending-2]=~A,e.pending_buf[e.pending-1]=~A>>8,zs(e.strm),i&&(i>A&&(i=A),e.strm.output.set(e.window.subarray(e.block_start,e.block_start+i),e.strm.next_out),e.strm.next_out+=i,e.strm.avail_out-=i,e.strm.total_out+=i,e.block_start+=i,A-=i),A&&(Js(e.strm,e.strm.output,e.strm.next_out,A),e.strm.next_out+=A,e.strm.avail_out-=A,e.strm.total_out+=A)}while(0===a);return s-=e.strm.avail_in,s&&(s>=e.w_size?(e.matches=2,e.window.set(e.strm.input.subarray(e.strm.next_in-e.w_size,e.strm.next_in),0),e.strstart=e.w_size,e.insert=e.strstart):(e.window_size-e.strstart<=s&&(e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,e.insert>e.strstart&&(e.insert=e.strstart)),e.window.set(e.strm.input.subarray(e.strm.next_in-s,e.strm.next_in),e.strstart),e.strstart+=s,e.insert+=s>e.w_size-e.insert?e.w_size-e.insert:s),e.block_start=e.strstart),e.high_water<e.strstart&&(e.high_water=e.strstart),a?4:t!==ds&&t!==Bs&&0===e.strm.avail_in&&e.strstart===e.block_start?2:(r=e.window_size-e.strstart,e.strm.avail_in>r&&e.block_start>=e.w_size&&(e.block_start-=e.w_size,e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,r+=e.w_size,e.insert>e.strstart&&(e.insert=e.strstart)),r>e.strm.avail_in&&(r=e.strm.avail_in),r&&(Js(e.strm,e.window,e.strstart,r),e.strstart+=r,e.insert+=r>e.w_size-e.insert?e.w_size-e.insert:r),e.high_water<e.strstart&&(e.high_water=e.strstart),r=e.bi_valid+42>>3,r=e.pending_buf_size-r>65535?65535:e.pending_buf_size-r,n=r>e.w_size?e.w_size:r,i=e.strstart-e.block_start,(i>=n||(i||t===Bs)&&t!==ds&&0===e.strm.avail_in&&i<=r)&&(A=i>r?r:i,a=t===Bs&&0===e.strm.avail_in&&A===i?1:0,gs(e,e.block_start,A,a),e.block_start+=A,zs(e.strm)),a?3:1)},js=(e,t)=>{let A,i;for(;;){if(e.lookahead<Us){if(Vs(e),e.lookahead<Us&&t===ds)return 1;if(0===e.lookahead)break}if(A=0,e.lookahead>=3&&(e.ins_h=Os(e,e.ins_h,e.window[e.strstart+3-1]),A=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),0!==A&&e.strstart-A<=e.w_size-Us&&(e.match_length=Ys(e,A)),e.match_length>=3)if(i=cs(e,e.strstart-e.match_start,e.match_length-3),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=3){e.match_length--;do{e.strstart++,e.ins_h=Os(e,e.ins_h,e.window[e.strstart+3-1]),A=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart}while(0!=--e.match_length);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.ins_h=e.window[e.strstart],e.ins_h=Os(e,e.ins_h,e.window[e.strstart+1]);else i=cs(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(i&&(Ks(e,!1),0===e.strm.avail_out))return 1}return e.insert=e.strstart<2?e.strstart:2,t===Bs?(Ks(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(Ks(e,!1),0===e.strm.avail_out)?1:2},Xs=(e,t)=>{let A,i,r;for(;;){if(e.lookahead<Us){if(Vs(e),e.lookahead<Us&&t===ds)return 1;if(0===e.lookahead)break}if(A=0,e.lookahead>=3&&(e.ins_h=Os(e,e.ins_h,e.window[e.strstart+3-1]),A=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=2,0!==A&&e.prev_length<e.max_lazy_match&&e.strstart-A<=e.w_size-Us&&(e.match_length=Ys(e,A),e.match_length<=5&&(e.strategy===_s||3===e.match_length&&e.strstart-e.match_start>4096)&&(e.match_length=2)),e.prev_length>=3&&e.match_length<=e.prev_length){r=e.strstart+e.lookahead-3,i=cs(e,e.strstart-1-e.prev_match,e.prev_length-3),e.lookahead-=e.prev_length-1,e.prev_length-=2;do{++e.strstart<=r&&(e.ins_h=Os(e,e.ins_h,e.window[e.strstart+3-1]),A=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart)}while(0!=--e.prev_length);if(e.match_available=0,e.match_length=2,e.strstart++,i&&(Ks(e,!1),0===e.strm.avail_out))return 1}else if(e.match_available){if(i=cs(e,0,e.window[e.strstart-1]),i&&Ks(e,!1),e.strstart++,e.lookahead--,0===e.strm.avail_out)return 1}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(i=cs(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<2?e.strstart:2,t===Bs?(Ks(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(Ks(e,!1),0===e.strm.avail_out)?1:2};function Ws(e,t,A,i,r){this.good_length=e,this.max_lazy=t,this.nice_length=A,this.max_chain=i,this.func=r}const $s=[new Ws(0,0,0,0,Zs),new Ws(4,4,8,4,js),new Ws(4,5,16,8,js),new Ws(4,6,32,32,js),new Ws(4,4,16,16,Xs),new Ws(8,16,32,32,Xs),new Ws(8,16,128,128,Xs),new Ws(8,32,128,256,Xs),new Ws(32,128,258,1024,Xs),new Ws(32,258,258,4096,Xs)];function eo(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=Ss,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(1146),this.dyn_dtree=new Uint16Array(122),this.bl_tree=new Uint16Array(78),Ns(this.dyn_ltree),Ns(this.dyn_dtree),Ns(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(16),this.heap=new Uint16Array(573),Ns(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(573),Ns(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}const to=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||t.status!==Ms&&57!==t.status&&69!==t.status&&73!==t.status&&91!==t.status&&103!==t.status&&t.status!==Rs&&t.status!==Fs?1:0},Ao=e=>{if(to(e))return Ls(e,Qs);e.total_in=e.total_out=0,e.data_type=xs;const t=e.state;return t.pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=2===t.wrap?57:t.wrap?Ms:Rs,e.adler=2===t.wrap?0:1,t.last_flush=-2,ls(t),Es},io=e=>{const t=Ao(e);var A;return t===Es&&((A=e.state).window_size=2*A.w_size,Ns(A.head),A.max_lazy_match=$s[A.level].max_lazy,A.good_match=$s[A.level].good_length,A.nice_match=$s[A.level].nice_length,A.max_chain_length=$s[A.level].max_chain,A.strstart=0,A.block_start=0,A.lookahead=0,A.insert=0,A.match_length=A.prev_length=2,A.match_available=0,A.ins_h=0),t},ro=(e,t,A,i,r,n)=>{if(!e)return Qs;let a=1;if(t===ys&&(t=6),i<0?(a=0,i=-i):i>15&&(a=2,i-=16),r<1||r>9||A!==Ss||i<8||i>15||t<0||t>9||n<0||n>ks||8===i&&1!==a)return Ls(e,Qs);8===i&&(i=9);const s=new eo;return e.state=s,s.strm=e,s.status=Ms,s.wrap=a,s.gzhead=null,s.w_bits=i,s.w_size=1<<s.w_bits,s.w_mask=s.w_size-1,s.hash_bits=r+7,s.hash_size=1<<s.hash_bits,s.hash_mask=s.hash_size-1,s.hash_shift=~~((s.hash_bits+3-1)/3),s.window=new Uint8Array(2*s.w_size),s.head=new Uint16Array(s.hash_size),s.prev=new Uint16Array(s.w_size),s.lit_bufsize=1<<r+6,s.pending_buf_size=4*s.lit_bufsize,s.pending_buf=new Uint8Array(s.pending_buf_size),s.sym_buf=s.lit_bufsize,s.sym_end=3*(s.lit_bufsize-1),s.level=t,s.strategy=n,s.method=A,io(e)};var no={deflateInit:(e,t)=>ro(e,t,Ss,15,8,vs),deflateInit2:ro,deflateReset:io,deflateResetKeep:Ao,deflateSetHeader:(e,t)=>to(e)||2!==e.state.wrap?Qs:(e.state.gzhead=t,Es),deflate:(e,t)=>{if(to(e)||t>Cs||t<0)return e?Ls(e,Qs):Qs;const A=e.state;if(!e.output||0!==e.avail_in&&!e.input||A.status===Fs&&t!==Bs)return Ls(e,0===e.avail_out?ps:Qs);const i=A.last_flush;if(A.last_flush=t,0!==A.pending){if(zs(e),0===e.avail_out)return A.last_flush=-1,Es}else if(0===e.avail_in&&Ts(t)<=Ts(i)&&t!==Bs)return Ls(e,ps);if(A.status===Fs&&0!==e.avail_in)return Ls(e,ps);if(A.status===Ms&&0===A.wrap&&(A.status=Rs),A.status===Ms){let t=Ss+(A.w_bits-8<<4)<<8,i=-1;if(i=A.strategy>=bs||A.level<2?0:A.level<6?1:6===A.level?2:3,t|=i<<6,0!==A.strstart&&(t|=32),t+=31-t%31,qs(A,t),0!==A.strstart&&(qs(A,e.adler>>>16),qs(A,65535&e.adler)),e.adler=1,A.status=Rs,zs(e),0!==A.pending)return A.last_flush=-1,Es}if(57===A.status)if(e.adler=0,Hs(A,31),Hs(A,139),Hs(A,8),A.gzhead)Hs(A,(A.gzhead.text?1:0)+(A.gzhead.hcrc?2:0)+(A.gzhead.extra?4:0)+(A.gzhead.name?8:0)+(A.gzhead.comment?16:0)),Hs(A,255&A.gzhead.time),Hs(A,A.gzhead.time>>8&255),Hs(A,A.gzhead.time>>16&255),Hs(A,A.gzhead.time>>24&255),Hs(A,9===A.level?2:A.strategy>=bs||A.level<2?4:0),Hs(A,255&A.gzhead.os),A.gzhead.extra&&A.gzhead.extra.length&&(Hs(A,255&A.gzhead.extra.length),Hs(A,A.gzhead.extra.length>>8&255)),A.gzhead.hcrc&&(e.adler=as(e.adler,A.pending_buf,A.pending,0)),A.gzindex=0,A.status=69;else if(Hs(A,0),Hs(A,0),Hs(A,0),Hs(A,0),Hs(A,0),Hs(A,9===A.level?2:A.strategy>=bs||A.level<2?4:0),Hs(A,3),A.status=Rs,zs(e),0!==A.pending)return A.last_flush=-1,Es;if(69===A.status){if(A.gzhead.extra){let t=A.pending,i=(65535&A.gzhead.extra.length)-A.gzindex;for(;A.pending+i>A.pending_buf_size;){let r=A.pending_buf_size-A.pending;if(A.pending_buf.set(A.gzhead.extra.subarray(A.gzindex,A.gzindex+r),A.pending),A.pending=A.pending_buf_size,A.gzhead.hcrc&&A.pending>t&&(e.adler=as(e.adler,A.pending_buf,A.pending-t,t)),A.gzindex+=r,zs(e),0!==A.pending)return A.last_flush=-1,Es;t=0,i-=r}let r=new Uint8Array(A.gzhead.extra);A.pending_buf.set(r.subarray(A.gzindex,A.gzindex+i),A.pending),A.pending+=i,A.gzhead.hcrc&&A.pending>t&&(e.adler=as(e.adler,A.pending_buf,A.pending-t,t)),A.gzindex=0}A.status=73}if(73===A.status){if(A.gzhead.name){let t,i=A.pending;do{if(A.pending===A.pending_buf_size){if(A.gzhead.hcrc&&A.pending>i&&(e.adler=as(e.adler,A.pending_buf,A.pending-i,i)),zs(e),0!==A.pending)return A.last_flush=-1,Es;i=0}t=A.gzindex<A.gzhead.name.length?255&A.gzhead.name.charCodeAt(A.gzindex++):0,Hs(A,t)}while(0!==t);A.gzhead.hcrc&&A.pending>i&&(e.adler=as(e.adler,A.pending_buf,A.pending-i,i)),A.gzindex=0}A.status=91}if(91===A.status){if(A.gzhead.comment){let t,i=A.pending;do{if(A.pending===A.pending_buf_size){if(A.gzhead.hcrc&&A.pending>i&&(e.adler=as(e.adler,A.pending_buf,A.pending-i,i)),zs(e),0!==A.pending)return A.last_flush=-1,Es;i=0}t=A.gzindex<A.gzhead.comment.length?255&A.gzhead.comment.charCodeAt(A.gzindex++):0,Hs(A,t)}while(0!==t);A.gzhead.hcrc&&A.pending>i&&(e.adler=as(e.adler,A.pending_buf,A.pending-i,i))}A.status=103}if(103===A.status){if(A.gzhead.hcrc){if(A.pending+2>A.pending_buf_size&&(zs(e),0!==A.pending))return A.last_flush=-1,Es;Hs(A,255&e.adler),Hs(A,e.adler>>8&255),e.adler=0}if(A.status=Rs,zs(e),0!==A.pending)return A.last_flush=-1,Es}if(0!==e.avail_in||0!==A.lookahead||t!==ds&&A.status!==Fs){let i=0===A.level?Zs(A,t):A.strategy===bs?((e,t)=>{let A;for(;;){if(0===e.lookahead&&(Vs(e),0===e.lookahead)){if(t===ds)return 1;break}if(e.match_length=0,A=cs(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,A&&(Ks(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,t===Bs?(Ks(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(Ks(e,!1),0===e.strm.avail_out)?1:2})(A,t):A.strategy===Ds?((e,t)=>{let A,i,r,n;const a=e.window;for(;;){if(e.lookahead<=Gs){if(Vs(e),e.lookahead<=Gs&&t===ds)return 1;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=3&&e.strstart>0&&(r=e.strstart-1,i=a[r],i===a[++r]&&i===a[++r]&&i===a[++r])){n=e.strstart+Gs;do{}while(i===a[++r]&&i===a[++r]&&i===a[++r]&&i===a[++r]&&i===a[++r]&&i===a[++r]&&i===a[++r]&&i===a[++r]&&r<n);e.match_length=Gs-(n-r),e.match_length>e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=3?(A=cs(e,1,e.match_length-3),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(A=cs(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),A&&(Ks(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,t===Bs?(Ks(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(Ks(e,!1),0===e.strm.avail_out)?1:2})(A,t):$s[A.level].func(A,t);if(3!==i&&4!==i||(A.status=Fs),1===i||3===i)return 0===e.avail_out&&(A.last_flush=-1),Es;if(2===i&&(t===us?fs(A):t!==Cs&&(gs(A,0,0,!1),t===Is&&(Ns(A.head),0===A.lookahead&&(A.strstart=0,A.block_start=0,A.insert=0))),zs(e),0===e.avail_out))return A.last_flush=-1,Es}return t!==Bs?Es:A.wrap<=0?ws:(2===A.wrap?(Hs(A,255&e.adler),Hs(A,e.adler>>8&255),Hs(A,e.adler>>16&255),Hs(A,e.adler>>24&255),Hs(A,255&e.total_in),Hs(A,e.total_in>>8&255),Hs(A,e.total_in>>16&255),Hs(A,e.total_in>>24&255)):(qs(A,e.adler>>>16),qs(A,65535&e.adler)),zs(e),A.wrap>0&&(A.wrap=-A.wrap),0!==A.pending?Es:ws)},deflateEnd:e=>{if(to(e))return Qs;const t=e.state.status;return e.state=null,t===Rs?Ls(e,ms):Es},deflateSetDictionary:(e,t)=>{let A=t.length;if(to(e))return Qs;const i=e.state,r=i.wrap;if(2===r||1===r&&i.status!==Ms||i.lookahead)return Qs;if(1===r&&(e.adler=rs(e.adler,t,A,0)),i.wrap=0,A>=i.w_size){0===r&&(Ns(i.head),i.strstart=0,i.block_start=0,i.insert=0);let e=new Uint8Array(i.w_size);e.set(t.subarray(A-i.w_size,A),0),t=e,A=i.w_size}const n=e.avail_in,a=e.next_in,s=e.input;for(e.avail_in=A,e.next_in=0,e.input=t,Vs(i);i.lookahead>=3;){let e=i.strstart,t=i.lookahead-2;do{i.ins_h=Os(i,i.ins_h,i.window[e+3-1]),i.prev[e&i.w_mask]=i.head[i.ins_h],i.head[i.ins_h]=e,e++}while(--t);i.strstart=e,i.lookahead=2,Vs(i)}return i.strstart+=i.lookahead,i.block_start=i.strstart,i.insert=i.lookahead,i.lookahead=0,i.match_length=i.prev_length=2,i.match_available=0,e.next_in=a,e.input=s,e.avail_in=n,i.wrap=r,Es},deflateInfo:"pako deflate (from Nodeca project)"};const ao=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var so={assign:function(e){const t=Array.prototype.slice.call(arguments,1);for(;t.length;){const A=t.shift();if(A){if("object"!=typeof A)throw new TypeError(A+"must be non-object");for(const t in A)ao(A,t)&&(e[t]=A[t])}}return e},flattenChunks:e=>{let t=0;for(let A=0,i=e.length;A<i;A++)t+=e[A].length;const A=new Uint8Array(t);for(let t=0,i=0,r=e.length;t<r;t++){let r=e[t];A.set(r,i),i+=r.length}return A}};let oo=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(e){oo=!1}const lo=new Uint8Array(256);for(let e=0;e<256;e++)lo[e]=e>=252?6:e>=248?5:e>=240?4:e>=224?3:e>=192?2:1;lo[254]=lo[254]=1;var go={string2buf:e=>{if("function"==typeof TextEncoder&&TextEncoder.prototype.encode)return(new TextEncoder).encode(e);let t,A,i,r,n,a=e.length,s=0;for(r=0;r<a;r++)A=e.charCodeAt(r),55296==(64512&A)&&r+1<a&&(i=e.charCodeAt(r+1),56320==(64512&i)&&(A=65536+(A-55296<<10)+(i-56320),r++)),s+=A<128?1:A<2048?2:A<65536?3:4;for(t=new Uint8Array(s),n=0,r=0;n<s;r++)A=e.charCodeAt(r),55296==(64512&A)&&r+1<a&&(i=e.charCodeAt(r+1),56320==(64512&i)&&(A=65536+(A-55296<<10)+(i-56320),r++)),A<128?t[n++]=A:A<2048?(t[n++]=192|A>>>6,t[n++]=128|63&A):A<65536?(t[n++]=224|A>>>12,t[n++]=128|A>>>6&63,t[n++]=128|63&A):(t[n++]=240|A>>>18,t[n++]=128|A>>>12&63,t[n++]=128|A>>>6&63,t[n++]=128|63&A);return t},buf2string:(e,t)=>{const A=t||e.length;if("function"==typeof TextDecoder&&TextDecoder.prototype.decode)return(new TextDecoder).decode(e.subarray(0,t));let i,r;const n=new Array(2*A);for(r=0,i=0;i<A;){let t=e[i++];if(t<128){n[r++]=t;continue}let a=lo[t];if(a>4)n[r++]=65533,i+=a-1;else{for(t&=2===a?31:3===a?15:7;a>1&&i<A;)t=t<<6|63&e[i++],a--;a>1?n[r++]=65533:t<65536?n[r++]=t:(t-=65536,n[r++]=55296|t>>10&1023,n[r++]=56320|1023&t)}}return((e,t)=>{if(t<65534&&e.subarray&&oo)return String.fromCharCode.apply(null,e.length===t?e:e.subarray(0,t));let A="";for(let i=0;i<t;i++)A+=String.fromCharCode(e[i]);return A})(n,r)},utf8border:(e,t)=>{(t=t||e.length)>e.length&&(t=e.length);let A=t-1;for(;A>=0&&128==(192&e[A]);)A--;return A<0||0===A?t:A+lo[e[A]]>t?A:t}};var ho=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0};const co=Object.prototype.toString,{Z_NO_FLUSH:fo,Z_SYNC_FLUSH:uo,Z_FULL_FLUSH:Io,Z_FINISH:Bo,Z_OK:Co,Z_STREAM_END:Eo,Z_DEFAULT_COMPRESSION:wo,Z_DEFAULT_STRATEGY:Qo,Z_DEFLATED:mo}=os;function po(e){this.options=so.assign({level:wo,method:mo,chunkSize:16384,windowBits:15,memLevel:8,strategy:Qo},e||{});let t=this.options;t.raw&&t.windowBits>0?t.windowBits=-t.windowBits:t.gzip&&t.windowBits>0&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new ho,this.strm.avail_out=0;let A=no.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(A!==Co)throw new Error(ss[A]);if(t.header&&no.deflateSetHeader(this.strm,t.header),t.dictionary){let e;if(e="string"==typeof t.dictionary?go.string2buf(t.dictionary):"[object ArrayBuffer]"===co.call(t.dictionary)?new Uint8Array(t.dictionary):t.dictionary,A=no.deflateSetDictionary(this.strm,e),A!==Co)throw new Error(ss[A]);this._dict_set=!0}}po.prototype.push=function(e,t){const A=this.strm,i=this.options.chunkSize;let r,n;if(this.ended)return!1;for(n=t===~~t?t:!0===t?Bo:fo,"string"==typeof e?A.input=go.string2buf(e):"[object ArrayBuffer]"===co.call(e)?A.input=new Uint8Array(e):A.input=e,A.next_in=0,A.avail_in=A.input.length;;)if(0===A.avail_out&&(A.output=new Uint8Array(i),A.next_out=0,A.avail_out=i),(n===uo||n===Io)&&A.avail_out<=6)this.onData(A.output.subarray(0,A.next_out)),A.avail_out=0;else{if(r=no.deflate(A,n),r===Eo)return A.next_out>0&&this.onData(A.output.subarray(0,A.next_out)),r=no.deflateEnd(this.strm),this.onEnd(r),this.ended=!0,r===Co;if(0!==A.avail_out){if(n>0&&A.next_out>0)this.onData(A.output.subarray(0,A.next_out)),A.avail_out=0;else if(0===A.avail_in)break}else this.onData(A.output)}return!0},po.prototype.onData=function(e){this.chunks.push(e)},po.prototype.onEnd=function(e){e===Co&&(this.result=so.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};const yo=16209;var _o=function(e,t){let A,i,r,n,a,s,o,l,g,h,c,f,d,u,I,B,C,E,w,Q,m,p,y,_;const b=e.state;A=e.next_in,y=e.input,i=A+(e.avail_in-5),r=e.next_out,_=e.output,n=r-(t-e.avail_out),a=r+(e.avail_out-257),s=b.dmax,o=b.wsize,l=b.whave,g=b.wnext,h=b.window,c=b.hold,f=b.bits,d=b.lencode,u=b.distcode,I=(1<<b.lenbits)-1,B=(1<<b.distbits)-1;e:do{f<15&&(c+=y[A++]<<f,f+=8,c+=y[A++]<<f,f+=8),C=d[c&I];t:for(;;){if(E=C>>>24,c>>>=E,f-=E,E=C>>>16&255,0===E)_[r++]=65535&C;else{if(!(16&E)){if(0==(64&E)){C=d[(65535&C)+(c&(1<<E)-1)];continue t}if(32&E){b.mode=16191;break e}e.msg="invalid literal/length code",b.mode=yo;break e}w=65535&C,E&=15,E&&(f<E&&(c+=y[A++]<<f,f+=8),w+=c&(1<<E)-1,c>>>=E,f-=E),f<15&&(c+=y[A++]<<f,f+=8,c+=y[A++]<<f,f+=8),C=u[c&B];A:for(;;){if(E=C>>>24,c>>>=E,f-=E,E=C>>>16&255,!(16&E)){if(0==(64&E)){C=u[(65535&C)+(c&(1<<E)-1)];continue A}e.msg="invalid distance code",b.mode=yo;break e}if(Q=65535&C,E&=15,f<E&&(c+=y[A++]<<f,f+=8,f<E&&(c+=y[A++]<<f,f+=8)),Q+=c&(1<<E)-1,Q>s){e.msg="invalid distance too far back",b.mode=yo;break e}if(c>>>=E,f-=E,E=r-n,Q>E){if(E=Q-E,E>l&&b.sane){e.msg="invalid distance too far back",b.mode=yo;break e}if(m=0,p=h,0===g){if(m+=o-E,E<w){w-=E;do{_[r++]=h[m++]}while(--E);m=r-Q,p=_}}else if(g<E){if(m+=o+g-E,E-=g,E<w){w-=E;do{_[r++]=h[m++]}while(--E);if(m=0,g<w){E=g,w-=E;do{_[r++]=h[m++]}while(--E);m=r-Q,p=_}}}else if(m+=g-E,E<w){w-=E;do{_[r++]=h[m++]}while(--E);m=r-Q,p=_}for(;w>2;)_[r++]=p[m++],_[r++]=p[m++],_[r++]=p[m++],w-=3;w&&(_[r++]=p[m++],w>1&&(_[r++]=p[m++]))}else{m=r-Q;do{_[r++]=_[m++],_[r++]=_[m++],_[r++]=_[m++],w-=3}while(w>2);w&&(_[r++]=_[m++],w>1&&(_[r++]=_[m++]))}break}}break}}while(A<i&&r<a);w=f>>3,A-=w,f-=w<<3,c&=(1<<f)-1,e.next_in=A,e.next_out=r,e.avail_in=A<i?i-A+5:5-(A-i),e.avail_out=r<a?a-r+257:257-(r-a),b.hold=c,b.bits=f};const bo=15,Do=new Uint16Array([3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0]),ko=new Uint8Array([16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78]),vo=new Uint16Array([1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0]),xo=new Uint8Array([16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64]);var So=(e,t,A,i,r,n,a,s)=>{const o=s.bits;let l,g,h,c,f,d,u=0,I=0,B=0,C=0,E=0,w=0,Q=0,m=0,p=0,y=0,_=null;const b=new Uint16Array(16),D=new Uint16Array(16);let k,v,x,S=null;for(u=0;u<=bo;u++)b[u]=0;for(I=0;I<i;I++)b[t[A+I]]++;for(E=o,C=bo;C>=1&&0===b[C];C--);if(E>C&&(E=C),0===C)return r[n++]=20971520,r[n++]=20971520,s.bits=1,0;for(B=1;B<C&&0===b[B];B++);for(E<B&&(E=B),m=1,u=1;u<=bo;u++)if(m<<=1,m-=b[u],m<0)return-1;if(m>0&&(0===e||1!==C))return-1;for(D[1]=0,u=1;u<bo;u++)D[u+1]=D[u]+b[u];for(I=0;I<i;I++)0!==t[A+I]&&(a[D[t[A+I]]++]=I);if(0===e?(_=S=a,d=20):1===e?(_=Do,S=ko,d=257):(_=vo,S=xo,d=0),y=0,I=0,u=B,f=n,w=E,Q=0,h=-1,p=1<<E,c=p-1,1===e&&p>852||2===e&&p>592)return 1;for(;;){k=u-Q,a[I]+1<d?(v=0,x=a[I]):a[I]>=d?(v=S[a[I]-d],x=_[a[I]-d]):(v=96,x=0),l=1<<u-Q,g=1<<w,B=g;do{g-=l,r[f+(y>>Q)+g]=k<<24|v<<16|x|0}while(0!==g);for(l=1<<u-1;y&l;)l>>=1;if(0!==l?(y&=l-1,y+=l):y=0,I++,0==--b[u]){if(u===C)break;u=t[A+a[I]]}if(u>E&&(y&c)!==h){for(0===Q&&(Q=E),f+=B,w=u-Q,m=1<<w;w+Q<C&&(m-=b[w+Q],!(m<=0));)w++,m<<=1;if(p+=1<<w,1===e&&p>852||2===e&&p>592)return 1;h=y&c,r[h]=E<<24|w<<16|f-n|0}}return 0!==y&&(r[f+y]=u-Q<<24|64<<16|0),s.bits=E,0};const{Z_FINISH:Go,Z_BLOCK:Uo,Z_TREES:Mo,Z_OK:Ro,Z_STREAM_END:Fo,Z_NEED_DICT:Lo,Z_STREAM_ERROR:To,Z_DATA_ERROR:No,Z_MEM_ERROR:Po,Z_BUF_ERROR:Oo,Z_DEFLATED:zo}=os,Ko=16180,Ho=16190,qo=16191,Jo=16192,Yo=16194,Vo=16199,Zo=16200,jo=16206,Xo=16209,Wo=e=>(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24);function $o(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}const el=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||t.mode<Ko||t.mode>16211?1:0},tl=e=>{if(el(e))return To;const t=e.state;return e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=Ko,t.last=0,t.havedict=0,t.flags=-1,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new Int32Array(852),t.distcode=t.distdyn=new Int32Array(592),t.sane=1,t.back=-1,Ro},Al=e=>{if(el(e))return To;const t=e.state;return t.wsize=0,t.whave=0,t.wnext=0,tl(e)},il=(e,t)=>{let A;if(el(e))return To;const i=e.state;return t<0?(A=0,t=-t):(A=5+(t>>4),t<48&&(t&=15)),t&&(t<8||t>15)?To:(null!==i.window&&i.wbits!==t&&(i.window=null),i.wrap=A,i.wbits=t,Al(e))},rl=(e,t)=>{if(!e)return To;const A=new $o;e.state=A,A.strm=e,A.window=null,A.mode=Ko;const i=il(e,t);return i!==Ro&&(e.state=null),i};let nl,al,sl=!0;const ol=e=>{if(sl){nl=new Int32Array(512),al=new Int32Array(32);let t=0;for(;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(So(1,e.lens,0,288,nl,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;So(2,e.lens,0,32,al,0,e.work,{bits:5}),sl=!1}e.lencode=nl,e.lenbits=9,e.distcode=al,e.distbits=5},ll=(e,t,A,i)=>{let r;const n=e.state;return null===n.window&&(n.wsize=1<<n.wbits,n.wnext=0,n.whave=0,n.window=new Uint8Array(n.wsize)),i>=n.wsize?(n.window.set(t.subarray(A-n.wsize,A),0),n.wnext=0,n.whave=n.wsize):(r=n.wsize-n.wnext,r>i&&(r=i),n.window.set(t.subarray(A-i,A-i+r),n.wnext),(i-=r)?(n.window.set(t.subarray(A-i,A),0),n.wnext=i,n.whave=n.wsize):(n.wnext+=r,n.wnext===n.wsize&&(n.wnext=0),n.whave<n.wsize&&(n.whave+=r))),0};var gl={inflateReset:Al,inflateReset2:il,inflateResetKeep:tl,inflateInit:e=>rl(e,15),inflateInit2:rl,inflate:(e,t)=>{let A,i,r,n,a,s,o,l,g,h,c,f,d,u,I,B,C,E,w,Q,m,p,y=0;const _=new Uint8Array(4);let b,D;const k=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(el(e)||!e.output||!e.input&&0!==e.avail_in)return To;A=e.state,A.mode===qo&&(A.mode=Jo),a=e.next_out,r=e.output,o=e.avail_out,n=e.next_in,i=e.input,s=e.avail_in,l=A.hold,g=A.bits,h=s,c=o,p=Ro;e:for(;;)switch(A.mode){case Ko:if(0===A.wrap){A.mode=Jo;break}for(;g<16;){if(0===s)break e;s--,l+=i[n++]<<g,g+=8}if(2&A.wrap&&35615===l){0===A.wbits&&(A.wbits=15),A.check=0,_[0]=255&l,_[1]=l>>>8&255,A.check=as(A.check,_,2,0),l=0,g=0,A.mode=16181;break}if(A.head&&(A.head.done=!1),!(1&A.wrap)||(((255&l)<<8)+(l>>8))%31){e.msg="incorrect header check",A.mode=Xo;break}if((15&l)!==zo){e.msg="unknown compression method",A.mode=Xo;break}if(l>>>=4,g-=4,m=8+(15&l),0===A.wbits&&(A.wbits=m),m>15||m>A.wbits){e.msg="invalid window size",A.mode=Xo;break}A.dmax=1<<A.wbits,A.flags=0,e.adler=A.check=1,A.mode=512&l?16189:qo,l=0,g=0;break;case 16181:for(;g<16;){if(0===s)break e;s--,l+=i[n++]<<g,g+=8}if(A.flags=l,(255&A.flags)!==zo){e.msg="unknown compression method",A.mode=Xo;break}if(57344&A.flags){e.msg="unknown header flags set",A.mode=Xo;break}A.head&&(A.head.text=l>>8&1),512&A.flags&&4&A.wrap&&(_[0]=255&l,_[1]=l>>>8&255,A.check=as(A.check,_,2,0)),l=0,g=0,A.mode=16182;case 16182:for(;g<32;){if(0===s)break e;s--,l+=i[n++]<<g,g+=8}A.head&&(A.head.time=l),512&A.flags&&4&A.wrap&&(_[0]=255&l,_[1]=l>>>8&255,_[2]=l>>>16&255,_[3]=l>>>24&255,A.check=as(A.check,_,4,0)),l=0,g=0,A.mode=16183;case 16183:for(;g<16;){if(0===s)break e;s--,l+=i[n++]<<g,g+=8}A.head&&(A.head.xflags=255&l,A.head.os=l>>8),512&A.flags&&4&A.wrap&&(_[0]=255&l,_[1]=l>>>8&255,A.check=as(A.check,_,2,0)),l=0,g=0,A.mode=16184;case 16184:if(1024&A.flags){for(;g<16;){if(0===s)break e;s--,l+=i[n++]<<g,g+=8}A.length=l,A.head&&(A.head.extra_len=l),512&A.flags&&4&A.wrap&&(_[0]=255&l,_[1]=l>>>8&255,A.check=as(A.check,_,2,0)),l=0,g=0}else A.head&&(A.head.extra=null);A.mode=16185;case 16185:if(1024&A.flags&&(f=A.length,f>s&&(f=s),f&&(A.head&&(m=A.head.extra_len-A.length,A.head.extra||(A.head.extra=new Uint8Array(A.head.extra_len)),A.head.extra.set(i.subarray(n,n+f),m)),512&A.flags&&4&A.wrap&&(A.check=as(A.check,i,f,n)),s-=f,n+=f,A.length-=f),A.length))break e;A.length=0,A.mode=16186;case 16186:if(2048&A.flags){if(0===s)break e;f=0;do{m=i[n+f++],A.head&&m&&A.length<65536&&(A.head.name+=String.fromCharCode(m))}while(m&&f<s);if(512&A.flags&&4&A.wrap&&(A.check=as(A.check,i,f,n)),s-=f,n+=f,m)break e}else A.head&&(A.head.name=null);A.length=0,A.mode=16187;case 16187:if(4096&A.flags){if(0===s)break e;f=0;do{m=i[n+f++],A.head&&m&&A.length<65536&&(A.head.comment+=String.fromCharCode(m))}while(m&&f<s);if(512&A.flags&&4&A.wrap&&(A.check=as(A.check,i,f,n)),s-=f,n+=f,m)break e}else A.head&&(A.head.comment=null);A.mode=16188;case 16188:if(512&A.flags){for(;g<16;){if(0===s)break e;s--,l+=i[n++]<<g,g+=8}if(4&A.wrap&&l!==(65535&A.check)){e.msg="header crc mismatch",A.mode=Xo;break}l=0,g=0}A.head&&(A.head.hcrc=A.flags>>9&1,A.head.done=!0),e.adler=A.check=0,A.mode=qo;break;case 16189:for(;g<32;){if(0===s)break e;s--,l+=i[n++]<<g,g+=8}e.adler=A.check=Wo(l),l=0,g=0,A.mode=Ho;case Ho:if(0===A.havedict)return e.next_out=a,e.avail_out=o,e.next_in=n,e.avail_in=s,A.hold=l,A.bits=g,Lo;e.adler=A.check=1,A.mode=qo;case qo:if(t===Uo||t===Mo)break e;case Jo:if(A.last){l>>>=7&g,g-=7&g,A.mode=jo;break}for(;g<3;){if(0===s)break e;s--,l+=i[n++]<<g,g+=8}switch(A.last=1&l,l>>>=1,g-=1,3&l){case 0:A.mode=16193;break;case 1:if(ol(A),A.mode=Vo,t===Mo){l>>>=2,g-=2;break e}break;case 2:A.mode=16196;break;case 3:e.msg="invalid block type",A.mode=Xo}l>>>=2,g-=2;break;case 16193:for(l>>>=7&g,g-=7&g;g<32;){if(0===s)break e;s--,l+=i[n++]<<g,g+=8}if((65535&l)!=(l>>>16^65535)){e.msg="invalid stored block lengths",A.mode=Xo;break}if(A.length=65535&l,l=0,g=0,A.mode=Yo,t===Mo)break e;case Yo:A.mode=16195;case 16195:if(f=A.length,f){if(f>s&&(f=s),f>o&&(f=o),0===f)break e;r.set(i.subarray(n,n+f),a),s-=f,n+=f,o-=f,a+=f,A.length-=f;break}A.mode=qo;break;case 16196:for(;g<14;){if(0===s)break e;s--,l+=i[n++]<<g,g+=8}if(A.nlen=257+(31&l),l>>>=5,g-=5,A.ndist=1+(31&l),l>>>=5,g-=5,A.ncode=4+(15&l),l>>>=4,g-=4,A.nlen>286||A.ndist>30){e.msg="too many length or distance symbols",A.mode=Xo;break}A.have=0,A.mode=16197;case 16197:for(;A.have<A.ncode;){for(;g<3;){if(0===s)break e;s--,l+=i[n++]<<g,g+=8}A.lens[k[A.have++]]=7&l,l>>>=3,g-=3}for(;A.have<19;)A.lens[k[A.have++]]=0;if(A.lencode=A.lendyn,A.lenbits=7,b={bits:A.lenbits},p=So(0,A.lens,0,19,A.lencode,0,A.work,b),A.lenbits=b.bits,p){e.msg="invalid code lengths set",A.mode=Xo;break}A.have=0,A.mode=16198;case 16198:for(;A.have<A.nlen+A.ndist;){for(;y=A.lencode[l&(1<<A.lenbits)-1],I=y>>>24,B=y>>>16&255,C=65535&y,!(I<=g);){if(0===s)break e;s--,l+=i[n++]<<g,g+=8}if(C<16)l>>>=I,g-=I,A.lens[A.have++]=C;else{if(16===C){for(D=I+2;g<D;){if(0===s)break e;s--,l+=i[n++]<<g,g+=8}if(l>>>=I,g-=I,0===A.have){e.msg="invalid bit length repeat",A.mode=Xo;break}m=A.lens[A.have-1],f=3+(3&l),l>>>=2,g-=2}else if(17===C){for(D=I+3;g<D;){if(0===s)break e;s--,l+=i[n++]<<g,g+=8}l>>>=I,g-=I,m=0,f=3+(7&l),l>>>=3,g-=3}else{for(D=I+7;g<D;){if(0===s)break e;s--,l+=i[n++]<<g,g+=8}l>>>=I,g-=I,m=0,f=11+(127&l),l>>>=7,g-=7}if(A.have+f>A.nlen+A.ndist){e.msg="invalid bit length repeat",A.mode=Xo;break}for(;f--;)A.lens[A.have++]=m}}if(A.mode===Xo)break;if(0===A.lens[256]){e.msg="invalid code -- missing end-of-block",A.mode=Xo;break}if(A.lenbits=9,b={bits:A.lenbits},p=So(1,A.lens,0,A.nlen,A.lencode,0,A.work,b),A.lenbits=b.bits,p){e.msg="invalid literal/lengths set",A.mode=Xo;break}if(A.distbits=6,A.distcode=A.distdyn,b={bits:A.distbits},p=So(2,A.lens,A.nlen,A.ndist,A.distcode,0,A.work,b),A.distbits=b.bits,p){e.msg="invalid distances set",A.mode=Xo;break}if(A.mode=Vo,t===Mo)break e;case Vo:A.mode=Zo;case Zo:if(s>=6&&o>=258){e.next_out=a,e.avail_out=o,e.next_in=n,e.avail_in=s,A.hold=l,A.bits=g,_o(e,c),a=e.next_out,r=e.output,o=e.avail_out,n=e.next_in,i=e.input,s=e.avail_in,l=A.hold,g=A.bits,A.mode===qo&&(A.back=-1);break}for(A.back=0;y=A.lencode[l&(1<<A.lenbits)-1],I=y>>>24,B=y>>>16&255,C=65535&y,!(I<=g);){if(0===s)break e;s--,l+=i[n++]<<g,g+=8}if(B&&0==(240&B)){for(E=I,w=B,Q=C;y=A.lencode[Q+((l&(1<<E+w)-1)>>E)],I=y>>>24,B=y>>>16&255,C=65535&y,!(E+I<=g);){if(0===s)break e;s--,l+=i[n++]<<g,g+=8}l>>>=E,g-=E,A.back+=E}if(l>>>=I,g-=I,A.back+=I,A.length=C,0===B){A.mode=16205;break}if(32&B){A.back=-1,A.mode=qo;break}if(64&B){e.msg="invalid literal/length code",A.mode=Xo;break}A.extra=15&B,A.mode=16201;case 16201:if(A.extra){for(D=A.extra;g<D;){if(0===s)break e;s--,l+=i[n++]<<g,g+=8}A.length+=l&(1<<A.extra)-1,l>>>=A.extra,g-=A.extra,A.back+=A.extra}A.was=A.length,A.mode=16202;case 16202:for(;y=A.distcode[l&(1<<A.distbits)-1],I=y>>>24,B=y>>>16&255,C=65535&y,!(I<=g);){if(0===s)break e;s--,l+=i[n++]<<g,g+=8}if(0==(240&B)){for(E=I,w=B,Q=C;y=A.distcode[Q+((l&(1<<E+w)-1)>>E)],I=y>>>24,B=y>>>16&255,C=65535&y,!(E+I<=g);){if(0===s)break e;s--,l+=i[n++]<<g,g+=8}l>>>=E,g-=E,A.back+=E}if(l>>>=I,g-=I,A.back+=I,64&B){e.msg="invalid distance code",A.mode=Xo;break}A.offset=C,A.extra=15&B,A.mode=16203;case 16203:if(A.extra){for(D=A.extra;g<D;){if(0===s)break e;s--,l+=i[n++]<<g,g+=8}A.offset+=l&(1<<A.extra)-1,l>>>=A.extra,g-=A.extra,A.back+=A.extra}if(A.offset>A.dmax){e.msg="invalid distance too far back",A.mode=Xo;break}A.mode=16204;case 16204:if(0===o)break e;if(f=c-o,A.offset>f){if(f=A.offset-f,f>A.whave&&A.sane){e.msg="invalid distance too far back",A.mode=Xo;break}f>A.wnext?(f-=A.wnext,d=A.wsize-f):d=A.wnext-f,f>A.length&&(f=A.length),u=A.window}else u=r,d=a-A.offset,f=A.length;f>o&&(f=o),o-=f,A.length-=f;do{r[a++]=u[d++]}while(--f);0===A.length&&(A.mode=Zo);break;case 16205:if(0===o)break e;r[a++]=A.length,o--,A.mode=Zo;break;case jo:if(A.wrap){for(;g<32;){if(0===s)break e;s--,l|=i[n++]<<g,g+=8}if(c-=o,e.total_out+=c,A.total+=c,4&A.wrap&&c&&(e.adler=A.check=A.flags?as(A.check,r,c,a-c):rs(A.check,r,c,a-c)),c=o,4&A.wrap&&(A.flags?l:Wo(l))!==A.check){e.msg="incorrect data check",A.mode=Xo;break}l=0,g=0}A.mode=16207;case 16207:if(A.wrap&&A.flags){for(;g<32;){if(0===s)break e;s--,l+=i[n++]<<g,g+=8}if(4&A.wrap&&l!==(4294967295&A.total)){e.msg="incorrect length check",A.mode=Xo;break}l=0,g=0}A.mode=16208;case 16208:p=Fo;break e;case Xo:p=No;break e;case 16210:return Po;default:return To}return e.next_out=a,e.avail_out=o,e.next_in=n,e.avail_in=s,A.hold=l,A.bits=g,(A.wsize||c!==e.avail_out&&A.mode<Xo&&(A.mode<jo||t!==Go))&&ll(e,e.output,e.next_out,c-e.avail_out),h-=e.avail_in,c-=e.avail_out,e.total_in+=h,e.total_out+=c,A.total+=c,4&A.wrap&&c&&(e.adler=A.check=A.flags?as(A.check,r,c,e.next_out-c):rs(A.check,r,c,e.next_out-c)),e.data_type=A.bits+(A.last?64:0)+(A.mode===qo?128:0)+(A.mode===Vo||A.mode===Yo?256:0),(0===h&&0===c||t===Go)&&p===Ro&&(p=Oo),p},inflateEnd:e=>{if(el(e))return To;let t=e.state;return t.window&&(t.window=null),e.state=null,Ro},inflateGetHeader:(e,t)=>{if(el(e))return To;const A=e.state;return 0==(2&A.wrap)?To:(A.head=t,t.done=!1,Ro)},inflateSetDictionary:(e,t)=>{const A=t.length;let i,r,n;return el(e)?To:(i=e.state,0!==i.wrap&&i.mode!==Ho?To:i.mode===Ho&&(r=1,r=rs(r,t,A,0),r!==i.check)?No:(n=ll(e,t,A,A),n?(i.mode=16210,Po):(i.havedict=1,Ro)))},inflateInfo:"pako inflate (from Nodeca project)"};var hl=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1};const cl=Object.prototype.toString,{Z_NO_FLUSH:fl,Z_FINISH:dl,Z_OK:ul,Z_STREAM_END:Il,Z_NEED_DICT:Bl,Z_STREAM_ERROR:Cl,Z_DATA_ERROR:El,Z_MEM_ERROR:wl}=os;function Ql(e){this.options=so.assign({chunkSize:65536,windowBits:15,to:""},e||{});const t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,0===t.windowBits&&(t.windowBits=-15)),!(t.windowBits>=0&&t.windowBits<16)||e&&e.windowBits||(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&0==(15&t.windowBits)&&(t.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new ho,this.strm.avail_out=0;let A=gl.inflateInit2(this.strm,t.windowBits);if(A!==ul)throw new Error(ss[A]);if(this.header=new hl,gl.inflateGetHeader(this.strm,this.header),t.dictionary&&("string"==typeof t.dictionary?t.dictionary=go.string2buf(t.dictionary):"[object ArrayBuffer]"===cl.call(t.dictionary)&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(A=gl.inflateSetDictionary(this.strm,t.dictionary),A!==ul)))throw new Error(ss[A])}function ml(e,t){const A=new Ql(t);if(A.push(e),A.err)throw A.msg||ss[A.err];return A.result}Ql.prototype.push=function(e,t){const A=this.strm,i=this.options.chunkSize,r=this.options.dictionary;let n,a,s;if(this.ended)return!1;for(a=t===~~t?t:!0===t?dl:fl,"[object ArrayBuffer]"===cl.call(e)?A.input=new Uint8Array(e):A.input=e,A.next_in=0,A.avail_in=A.input.length;;){for(0===A.avail_out&&(A.output=new Uint8Array(i),A.next_out=0,A.avail_out=i),n=gl.inflate(A,a),n===Bl&&r&&(n=gl.inflateSetDictionary(A,r),n===ul?n=gl.inflate(A,a):n===El&&(n=Bl));A.avail_in>0&&n===Il&&A.state.wrap>0&&0!==e[A.next_in];)gl.inflateReset(A),n=gl.inflate(A,a);switch(n){case Cl:case El:case Bl:case wl:return this.onEnd(n),this.ended=!0,!1}if(s=A.avail_out,A.next_out&&(0===A.avail_out||n===Il))if("string"===this.options.to){let e=go.utf8border(A.output,A.next_out),t=A.next_out-e,r=go.buf2string(A.output,e);A.next_out=t,A.avail_out=i-t,t&&A.output.set(A.output.subarray(e,e+t),0),this.onData(r)}else this.onData(A.output.length===A.next_out?A.output:A.output.subarray(0,A.next_out));if(n!==ul||0!==s){if(n===Il)return n=gl.inflateEnd(this.strm),this.onEnd(n),this.ended=!0,!0;if(0===A.avail_in)break}}return!0},Ql.prototype.onData=function(e){this.chunks.push(e)},Ql.prototype.onEnd=function(e){e===ul&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=so.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};var pl={Inflate:Ql,inflate:ml,inflateRaw:function(e,t){return(t=t||{}).raw=!0,ml(e,t)},ungzip:ml,constants:os};const{Inflate:yl,inflate:_l,inflateRaw:bl,ungzip:Dl}=pl;var kl=_l;var vl=Object.freeze({__proto__:null,default:class extends Un{decodeBlock(e){return kl(new Uint8Array(e)).buffer}}});var xl=Object.freeze({__proto__:null,default:class extends Un{decodeBlock(e){const t=new DataView(e),A=[];for(let i=0;i<e.byteLength;++i){let e=t.getInt8(i);if(e<0){const r=t.getUint8(i+1);e=-e;for(let t=0;t<=e;++t)A.push(r);i+=1}else{for(let r=0;r<=e;++r)A.push(t.getUint8(i+r+1));i+=e+1}}return new Uint8Array(A).buffer}}}),Sl={exports:{}};!function(e){
1
+ "use strict";var e=require("@deck.gl/core"),t=require("@deck.gl/geo-layers"),i=require("@deck.gl/layers"),r=require("@luma.gl/constants"),s=require("chroma-js"),n=require("@luma.gl/core");function a(e,t,i,r){return new(i||(i=Promise))((function(s,n){function a(e){try{A(r.next(e))}catch(e){n(e)}}function o(e){try{A(r.throw(e))}catch(e){n(e)}}function A(e){var t;e.done?s(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(a,o)}A((r=r.apply(e,t||[])).next())}))}function o(e,t){if(!e)throw new Error(t||"shadertools: assertion failed.")}const A={number:{type:"number",validate:(e,t)=>Number.isFinite(e)&&"object"==typeof t&&(void 0===t.max||e<=t.max)&&(void 0===t.min||e>=t.min)},array:{type:"array",validate:(e,t)=>Array.isArray(e)||ArrayBuffer.isView(e)}};function l(e){let t=h(e);if("object"!==t)return{value:e,...A[t],type:t};if("object"==typeof e)return e?void 0!==e.type?{...e,...A[e.type],type:e.type}:void 0===e.value?{type:"object",value:e}:(t=h(e.value),{...e,...A[t],type:t}):{type:"object",value:null};throw new Error("props")}function h(e){return Array.isArray(e)||ArrayBuffer.isView(e)?"array":typeof e}const c={vertex:"#ifdef MODULE_LOGDEPTH\nlogdepth_adjustPosition(gl_Position);\n#endif\n",fragment:"#ifdef MODULE_MATERIAL\ngl_FragColor = material_filterColor(gl_FragColor);\n#endif\n#ifdef MODULE_LIGHTING\ngl_FragColor = lighting_filterColor(gl_FragColor);\n#endif\n#ifdef MODULE_FOG\ngl_FragColor = fog_filterColor(gl_FragColor);\n#endif\n#ifdef MODULE_PICKING\ngl_FragColor = picking_filterHighlightColor(gl_FragColor);\ngl_FragColor = picking_filterPickingColor(gl_FragColor);\n#endif\n#ifdef MODULE_LOGDEPTH\nlogdepth_setFragDepth();\n#endif\n"},g=/void\s+main\s*\([^)]*\)\s*\{\n?/,u=/}\n?[^{}]*$/,d=[],f="__LUMA_INJECT_DECLARATIONS__";function p(e){const t=e.slice(0,2);switch(t){case"vs":return"vertex";case"fs":return"fragment";default:throw new Error(t)}}function I(e,t,i,r=!1){const s="vertex"===t;for(const t in i){const r=i[t];r.sort(((e,t)=>e.order-t.order)),d.length=r.length;for(let e=0,t=r.length;e<t;++e)d[e]=r[e].injection;const n=`${d.join("\n")}\n`;switch(t){case"vs:#decl":s&&(e=e.replace(f,n));break;case"vs:#main-start":s&&(e=e.replace(g,(e=>e+n)));break;case"vs:#main-end":s&&(e=e.replace(u,(e=>n+e)));break;case"fs:#decl":s||(e=e.replace(f,n));break;case"fs:#main-start":s||(e=e.replace(g,(e=>e+n)));break;case"fs:#main-end":s||(e=e.replace(u,(e=>n+e)));break;default:e=e.replace(t,(e=>e+n))}}return e=e.replace(f,""),r&&(e=e.replace(/\}\s*$/,(e=>e+c[t]))),e}let m=1;class _{name;vs;fs;getModuleUniforms;dependencies;deprecations;defines;injections;uniforms={};uniformTypes={};static instantiateModules(e){return e.map((e=>{if(e instanceof _)return e;o("string"!=typeof e,`Shader module use by name is deprecated. Import shader module '${JSON.stringify(e)}' and use it directly.`),e.name||(console.warn("shader module has no name"),e.name="shader-module-"+m++);const t=new _(e);return t.dependencies=_.instantiateModules(e.dependencies||[]),t}))}constructor(e){const{name:t,vs:i,fs:r,dependencies:s=[],uniformPropTypes:n={},getUniforms:a,deprecations:A=[],defines:h={},inject:c={}}=e;o("string"==typeof t),this.name=t,this.vs=i,this.fs=r,this.getModuleUniforms=a,this.dependencies=_.instantiateModules(s),this.deprecations=this._parseDeprecationDefinitions(A),this.defines=h,this.injections=function(e){const t={vertex:{},fragment:{}};for(const i in e){let r=e[i];"string"==typeof r&&(r={order:0,injection:r}),t[p(i)][i]=r}return t}(c),n&&(this.uniforms=function(e){const t={};for(const[i,r]of Object.entries(e))t[i]=l(r);return t}(n))}getModuleSource(e){let t;switch(e){case"vertex":t=this.vs||"";break;case"fragment":t=this.fs||"";break;default:o(!1)}const i=this.name.toUpperCase().replace(/[^0-9a-z]/gi,"_");return`// ----- MODULE ${this.name} ---------------\n\n#define MODULE_${i}\n${t}\n\n`}getUniforms(e,t){return this.getModuleUniforms?this.getModuleUniforms(e,t):function(e,t,i){const r={};for(const[s,n]of Object.entries(t))e&&s in e&&!n.private?(n.validate&&o(n.validate(e[s],n),`${i}: invalid ${s}`),r[s]=e[s]):r[s]=n.value;return r}(e,this.uniforms,this.name)}getDefines(){return this.defines}checkDeprecations(e,t){this.deprecations.forEach((i=>{i.regex?.test(e)&&(i.deprecated?t.deprecated(i.old,i.new)():t.removed(i.old,i.new)())}))}_parseDeprecationDefinitions(e){return e.forEach((e=>{if("function"===e.type)e.regex=new RegExp(`\\b${e.old}\\(`);else e.regex=new RegExp(`${e.type} ${e.old};`)})),e}_defaultGetUniforms(e={}){const t={},i=this.uniforms;for(const r in i){const s=i[r];r in e&&!s.private?(s.validate&&o(s.validate(e[r],s),`${this.name}: invalid ${r}`),t[r]=e[r]):t[r]=s.value}return t}}function w(e){if(e.source&&"webgpu"===e.platformInfo.type){return{...e,vs:void 0,fs:void 0}}if(!e.vs)throw new Error("no vertex shader");const t=C(e.platformInfo,e.vs);let i;return e.fs&&(i=C(e.platformInfo,e.fs)),{...e,vs:t,fs:i}}function C(e,t){if("string"==typeof t)return t;if("webgpu"===e.type){if(t?.wgsl)return t.wgsl;throw new Error("WebGPU does not support GLSL shaders")}if(t?.glsl)return t.glsl;throw new Error("WebGL does not support WGSL shaders")}function B(e){return function(e){const t={},i={};return E({modules:e,level:0,moduleMap:t,moduleDepth:i}),Object.keys(i).sort(((e,t)=>i[t]-i[e])).map((e=>t[e]))}(_.instantiateModules(e))}function E(e){const{modules:t,level:i,moduleMap:r,moduleDepth:s}=e;if(i>=5)throw new Error("Possible loop in shader dependency graph");for(const e of t)r[e.name]=e,(void 0===s[e.name]||s[e.name]<i)&&(s[e.name]=i);for(const e of t)e.dependencies&&E({modules:e.dependencies,level:i+1,moduleMap:r,moduleDepth:s})}const y=[[/^(#version[ \t]+(100|300[ \t]+es))?[ \t]*\n/,"#version 300 es\n"],[/\btexture(2D|2DProj|Cube)Lod(EXT)?\(/g,"textureLod("],[/\btexture(2D|2DProj|Cube)(EXT)?\(/g,"texture("]],Q=[...y,[x("attribute"),"in $1"],[x("varying"),"out $1"]],b=[...y,[x("varying"),"in $1"]];function k(e,t){for(const[i,r]of t)e=e.replace(i,r);return e}function x(e){return new RegExp(`\\b${e}[ \\t]+(\\w+[ \\t]+\\w+(\\[\\w+\\])?;)`,"g")}function v(e,t){let i="";for(const r in e){const s=e[r];if(i+=`void ${s.signature} {\n`,s.header&&(i+=` ${s.header}`),t[r]){const e=t[r];e.sort(((e,t)=>e.order-t.order));for(const t of e)i+=` ${t.injection}\n`}s.footer&&(i+=` ${s.footer}`),i+="}\n"}return i}function D(e){const t={vertex:{},fragment:{}};for(const i of e){let e,r;"string"!=typeof i?(e=i,r=e.hook):(e={},r=i),r=r.trim();const[s,n]=r.split(":"),a=r.replace(/\(.+/,""),o=Object.assign(e,{signature:n});switch(s){case"vs":t.vertex[a]=o;break;case"fs":t.fragment[a]=o;break;default:throw new Error(s)}}return t}function S(e,t="unnamed"){const i=/#define[^\S\r\n]*SHADER_NAME[^\S\r\n]*([A-Za-z0-9_-]+)\s*/.exec(e);return i?i[1]:t}function M(e){let t=100;const i=e.match(/[^\s]+/g);if(i&&i.length>=2&&"#version"===i[0]){const e=parseInt(i[1],10);Number.isFinite(e)&&(t=e)}if(100!==t&&300!==t)throw new Error(`Invalid GLSL version ${t}`);return t}const U=`\n\n${f}\n`,T="precision highp float;\n";function G(e,t){const{source:i,stage:r,modules:s,hookFunctions:n=[],inject:a={},log:A}=t;o("string"==typeof i,"shader source must be a string");const l=i;let h="";const c=D(n),g={},u={},d={};for(const e in a){const t="string"==typeof a[e]?{injection:a[e],order:0}:a[e],i=/^(v|f)s:(#)?([\w-]+)$/.exec(e);if(i){const r=i[2],s=i[3];r?"decl"===s?u[e]=[t]:d[e]=[t]:g[e]=[t]}else d[e]=[t]}const f="webgpu"!==e.type?s:[];for(const e of f){A&&e.checkDeprecations(l,A);h+=e.getModuleSource(r,"wgsl");const t=e.injections[r];for(const e in t){const i=/^(v|f)s:#([\w-]+)$/.exec(e);if(i){const r="decl"===i[2]?u:d;r[e]=r[e]||[],r[e].push(t[e])}else g[e]=g[e]||[],g[e].push(t[e])}}return h+=U,h=I(h,r,u),h+=v(c[r],g),h+=l,h=I(h,r,d),h}function L(e,t){const{id:i,source:r,stage:s,language:n="glsl",modules:a,defines:A={},hookFunctions:l=[],inject:h={},prologue:c=!0,log:g}=t;o("string"==typeof r,"shader source must be a string");const u="glsl"===n?function(e,t){return{name:S(e,t),language:"glsl",version:M(e)}}(r).version:-1,d=e.shaderLanguageVersion,f=100===u?"#version 100":"#version 300 es",p=r.split("\n").slice(1).join("\n"),m={};a.forEach((e=>{Object.assign(m,e.getDefines())})),Object.assign(m,A);let _="";switch(n){case"wgsl":break;case"glsl":_=c?`${f}\n\n// ----- PROLOGUE -------------------------\n${function(e){const{id:t,source:i,stage:r}=e,s=t&&-1===i.indexOf("SHADER_NAME");return s?`\n#define SHADER_NAME ${t}_${r}\n\n`:""}({id:i,source:r,stage:s})}\n#define SHADER_TYPE_${s.toUpperCase()}\n${function(e){switch(e?.gpu.toLowerCase()){case"apple":return"#define APPLE_GPU\n#define LUMA_FP64_CODE_ELIMINATION_WORKAROUND 1\n#define LUMA_FP32_TAN_PRECISION_WORKAROUND 1\n#define LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND 1\n";case"nvidia":return"#define NVIDIA_GPU\n#define LUMA_FP64_CODE_ELIMINATION_WORKAROUND 1\n";case"intel":return"#define INTEL_GPU\n#define LUMA_FP64_CODE_ELIMINATION_WORKAROUND 1\n#define LUMA_FP32_TAN_PRECISION_WORKAROUND 1\n#define LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND 1\n";case"amd":return"#define AMD_GPU\n";default:return"#define DEFAULT_GPU\n#define LUMA_FP64_CODE_ELIMINATION_WORKAROUND 1\n#define LUMA_FP32_TAN_PRECISION_WORKAROUND 1\n#define LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND 1\n"}}(e)}\n${"fragment"===s?T:""}\n\n// ----- APPLICATION DEFINES -------------------------\n\n${function(e={}){let t="";for(const i in e){const r=e[i];(r||Number.isFinite(r))&&(t+=`#define ${i.toUpperCase()} ${e[i]}\n`)}return t}(m)}\n\n`:`${f}\n`}const w=D(l),C={},B={},E={};for(const e in h){const t="string"==typeof h[e]?{injection:h[e],order:0}:h[e],i=/^(v|f)s:(#)?([\w-]+)$/.exec(e);if(i){const r=i[2],s=i[3];r?"decl"===s?B[e]=[t]:E[e]=[t]:C[e]=[t]}else E[e]=[t]}for(const e of a){g&&e.checkDeprecations(p,g);_+=e.getModuleSource(s);const t=e.injections[s];for(const e in t){const i=/^(v|f)s:#([\w-]+)$/.exec(e);if(i){const r="decl"===i[2]?B:E;r[e]=r[e]||[],r[e].push(t[e])}else C[e]=C[e]||[],C[e].push(t[e])}}return _+="// ----- MAIN SHADER SOURCE -------------------------",_+=U,_=I(_,s,B),_+=v(w[s],C),_+=p,_=I(_,s,E),"glsl"===n&&u!==d&&(_=function(e,t){if(300!==Number(e.match(/^#version[ \t]+(\d+)/m)?.[1]||100))throw new Error("luma.gl v9 only supports GLSL 3.00 shader sources");switch(t){case"vertex":return k(e,Q);case"fragment":return k(e,b);default:throw new Error(t)}}(_,s)),_.trim()}function R(e){return function(t){const i={};for(const r of e){const e=r.getUniforms(t,i);Object.assign(i,e)}return i}}class F{static defaultShaderAssembler;_hookFunctions=[];_defaultModules=[];static getDefaultShaderAssembler(){return F.defaultShaderAssembler=F.defaultShaderAssembler||new F,F.defaultShaderAssembler}addDefaultModule(e){this._defaultModules.find((t=>t.name===("string"==typeof e?e:e.name)))||this._defaultModules.push(e)}removeDefaultModule(e){const t="string"==typeof e?e:e.name;this._defaultModules=this._defaultModules.filter((e=>e.name!==t))}addShaderHook(e,t){t&&(e=Object.assign(t,{hook:e})),this._hookFunctions.push(e)}assembleShader(e){const t=this._getModuleList(e.modules),i=this._hookFunctions,r=w(e),s=function(e){const t=B(e.modules||[]);return{source:G(e.platformInfo,{...e,source:e.source,stage:"vertex",modules:t}),getUniforms:R(t)}}({platformInfo:e.platformInfo,...r,modules:t,hookFunctions:i});return{...s,modules:t}}assembleShaderPair(e){const t=w(e),i=this._getModuleList(e.modules),r=this._hookFunctions,{platformInfo:s}=e,n="wgsl"===e.platformInfo.shaderLanguage?function(e){const t=B(e.modules||[]);return{vs:G(e.platformInfo,{...e,source:e.vs,stage:"vertex",modules:t}),fs:G(e.platformInfo,{...e,source:e.fs,stage:"fragment",modules:t}),getUniforms:R(t)}}({platformInfo:s,...t,modules:i,hookFunctions:r}):function(e){const{vs:t,fs:i}=e,r=B(e.modules||[]);return{vs:L(e.platformInfo,{...e,source:t,stage:"vertex",modules:r}),fs:L(e.platformInfo,{...e,source:i,stage:"fragment",modules:r}),getUniforms:R(r)}}({platformInfo:s,...t,modules:i,hookFunctions:r});return{...n,modules:i}}_getModuleList(e=[]){const t=new Array(this._defaultModules.length+e.length),i={};let r=0;for(let e=0,s=this._defaultModules.length;e<s;++e){const s=this._defaultModules[e],n=s.name;t[r++]=s,i[n]=!0}for(let s=0,n=e.length;s<n;++s){const n=e[s],a=n.name;i[a]||(t[r++]=n,i[a]=!0)}return t.length=r,_.instantiateModules(t)}}class N{constructor(){this.constants=new Map,this.aliases=new Map,this.structs=new Map}}class O{constructor(){}get isAstNode(){return!0}get astNodeType(){return""}evaluate(e){throw new Error("Cannot evaluate node")}evaluateString(e){return this.evaluate(e).toString()}}class P extends O{constructor(){super()}}class z extends P{constructor(e,t,i,r){super(),this.name=e,this.args=t,this.returnType=i,this.body=r}get astNodeType(){return"function"}}class q extends P{constructor(e){super(),this.expression=e}get astNodeType(){return"staticAssert"}}class K extends P{constructor(e,t){super(),this.condition=e,this.body=t}get astNodeType(){return"while"}}class H extends P{constructor(e){super(),this.body=e}get astNodeType(){return"continuing"}}class V extends P{constructor(e,t,i,r){super(),this.init=e,this.condition=t,this.increment=i,this.body=r}get astNodeType(){return"for"}}class J extends P{constructor(e,t,i,r,s){super(),this.name=e,this.type=t,this.storage=i,this.access=r,this.value=s}get astNodeType(){return"var"}}class Y extends P{constructor(e,t,i){super(),this.name=e,this.type=t,this.value=i}get astNodeType(){return"override"}}class j extends P{constructor(e,t,i,r,s){super(),this.name=e,this.type=t,this.storage=i,this.access=r,this.value=s}get astNodeType(){return"let"}}class Z extends P{constructor(e,t,i,r,s){super(),this.name=e,this.type=t,this.storage=i,this.access=r,this.value=s}get astNodeType(){return"const"}evaluate(e){return this.value.evaluate(e)}}var W,X,$,ee,te;!function(e){e.increment="++",e.decrement="--"}(W||(W={})),function(e){e.parse=function(t){const i=t;if("parse"==i)throw new Error("Invalid value for IncrementOperator");return e[i]}}(W||(W={}));class ie extends P{constructor(e,t){super(),this.operator=e,this.variable=t}get astNodeType(){return"increment"}}!function(e){e.assign="=",e.addAssign="+=",e.subtractAssin="-=",e.multiplyAssign="*=",e.divideAssign="/=",e.moduloAssign="%=",e.andAssign="&=",e.orAssign="|=",e.xorAssign="^=",e.shiftLeftAssign="<<=",e.shiftRightAssign=">>="}(X||(X={})),function(e){e.parse=function(t){const i=t;if("parse"==i)throw new Error("Invalid value for AssignOperator");return e[i]}}(X||(X={}));class re extends P{constructor(e,t,i){super(),this.operator=e,this.variable=t,this.value=i}get astNodeType(){return"assign"}}class se extends P{constructor(e,t){super(),this.name=e,this.args=t}get astNodeType(){return"call"}}class ne extends P{constructor(e,t){super(),this.body=e,this.continuing=t}get astNodeType(){return"loop"}}class ae extends P{constructor(e,t){super(),this.condition=e,this.body=t}get astNodeType(){return"body"}}class oe extends P{constructor(e,t,i,r){super(),this.condition=e,this.body=t,this.elseif=i,this.else=r}get astNodeType(){return"if"}}class Ae extends P{constructor(e){super(),this.value=e}get astNodeType(){return"return"}}class le extends P{constructor(e){super(),this.name=e}get astNodeType(){return"enable"}}class he extends P{constructor(e,t){super(),this.name=e,this.type=t}get astNodeType(){return"alias"}}class ce extends P{constructor(){super()}get astNodeType(){return"discard"}}class ge extends P{constructor(){super()}get astNodeType(){return"break"}}class ue extends P{constructor(){super()}get astNodeType(){return"continue"}}class de extends P{constructor(e){super(),this.name=e}get astNodeType(){return"type"}get isStruct(){return!1}get isArray(){return!1}}class fe extends de{constructor(e,t){super(e),this.members=t}get astNodeType(){return"struct"}get isStruct(){return!0}getMemberIndex(e){for(let t=0;t<this.members.length;t++)if(this.members[t].name==e)return t;return-1}}class pe extends de{constructor(e,t,i){super(e),this.format=t,this.access=i}get astNodeType(){return"template"}}class Ie extends de{constructor(e,t,i,r){super(e),this.storage=t,this.type=i,this.access=r}get astNodeType(){return"pointer"}}class me extends de{constructor(e,t,i,r){super(e),this.attributes=t,this.format=i,this.count=r}get astNodeType(){return"array"}get isArray(){return!0}}class _e extends de{constructor(e,t,i){super(e),this.format=t,this.access=i}get astNodeType(){return"sampler"}}class we extends O{constructor(){super()}}class Ce extends we{constructor(e){super(),this.value=e}get astNodeType(){return"stringExpr"}toString(){return this.value}evaluateString(){return this.value}}class Be extends we{constructor(e,t){super(),this.type=e,this.args=t}get astNodeType(){return"createExpr"}}class Ee extends we{constructor(e,t){super(),this.name=e,this.args=t}get astNodeType(){return"callExpr"}evaluate(e){switch(this.name){case"abs":return Math.abs(this.args[0].evaluate(e));case"acos":return Math.acos(this.args[0].evaluate(e));case"acosh":return Math.acosh(this.args[0].evaluate(e));case"asin":return Math.asin(this.args[0].evaluate(e));case"asinh":return Math.asinh(this.args[0].evaluate(e));case"atan":return Math.atan(this.args[0].evaluate(e));case"atan2":return Math.atan2(this.args[0].evaluate(e),this.args[1].evaluate(e));case"atanh":return Math.atanh(this.args[0].evaluate(e));case"ceil":return Math.ceil(this.args[0].evaluate(e));case"clamp":return Math.min(Math.max(this.args[0].evaluate(e),this.args[1].evaluate(e)),this.args[2].evaluate(e));case"cos":return Math.cos(this.args[0].evaluate(e));case"degrees":return 180*this.args[0].evaluate(e)/Math.PI;case"distance":return Math.sqrt(Math.pow(this.args[0].evaluate(e)-this.args[1].evaluate(e),2));case"dot":case"exp":return Math.exp(this.args[0].evaluate(e));case"exp2":return Math.pow(2,this.args[0].evaluate(e));case"floor":return Math.floor(this.args[0].evaluate(e));case"fma":return this.args[0].evaluate(e)*this.args[1].evaluate(e)+this.args[2].evaluate(e);case"fract":case"modf":return this.args[0].evaluate(e)-Math.floor(this.args[0].evaluate(e));case"inverseSqrt":return 1/Math.sqrt(this.args[0].evaluate(e));case"log":return Math.log(this.args[0].evaluate(e));case"log2":return Math.log2(this.args[0].evaluate(e));case"max":return Math.max(this.args[0].evaluate(e),this.args[1].evaluate(e));case"min":return Math.min(this.args[0].evaluate(e),this.args[1].evaluate(e));case"mix":return this.args[0].evaluate(e)*(1-this.args[2].evaluate(e))+this.args[1].evaluate(e)*this.args[2].evaluate(e);case"pow":return Math.pow(this.args[0].evaluate(e),this.args[1].evaluate(e));case"radians":return this.args[0].evaluate(e)*Math.PI/180;case"round":return Math.round(this.args[0].evaluate(e));case"sign":return Math.sign(this.args[0].evaluate(e));case"sin":return Math.sin(this.args[0].evaluate(e));case"sinh":return Math.sinh(this.args[0].evaluate(e));case"saturate":return Math.min(Math.max(this.args[0].evaluate(e),0),1);case"smoothstep":return this.args[0].evaluate(e)*this.args[0].evaluate(e)*(3-2*this.args[0].evaluate(e));case"sqrt":return Math.sqrt(this.args[0].evaluate(e));case"step":return this.args[0].evaluate(e)<this.args[1].evaluate(e)?0:1;case"tan":return Math.tan(this.args[0].evaluate(e));case"tanh":return Math.tanh(this.args[0].evaluate(e));case"trunc":return Math.trunc(this.args[0].evaluate(e));default:throw new Error("Non const function: "+this.name)}}}class ye extends we{constructor(e){super(),this.name=e}get astNodeType(){return"varExpr"}}class Qe extends we{constructor(e,t){super(),this.name=e,this.initializer=t}get astNodeType(){return"constExpr"}evaluate(e){var t,i;if(this.initializer instanceof Be){const r=null===(t=this.postfix)||void 0===t?void 0:t.evaluateString(e),s=null===(i=this.initializer.type)||void 0===i?void 0:i.name,n=e.structs.get(s),a=null==n?void 0:n.getMemberIndex(r);if(-1!=a){return this.initializer.args[a].evaluate(e)}console.log(a)}return this.initializer.evaluate(e)}}class be extends we{constructor(e){super(),this.value=e}get astNodeType(){return"literalExpr"}evaluate(){return this.value}}class ke extends we{constructor(e,t){super(),this.type=e,this.value=t}get astNodeType(){return"bitcastExpr"}}class xe extends we{constructor(e,t){super(),this.type=e,this.args=t}get astNodeType(){return"typecastExpr"}evaluate(e){return this.args[0].evaluate(e)}}class ve extends we{constructor(e){super(),this.contents=e}get astNodeType(){return"groupExpr"}evaluate(e){return this.contents[0].evaluate(e)}}class De extends we{constructor(){super()}}class Se extends De{constructor(e,t){super(),this.operator=e,this.right=t}get astNodeType(){return"unaryOp"}evaluate(e){switch(this.operator){case"+":return this.right.evaluate(e);case"-":return-this.right.evaluate(e);case"!":return this.right.evaluate(e)?0:1;case"~":return~this.right.evaluate(e);default:throw new Error("Unknown unary operator: "+this.operator)}}}class Me extends De{constructor(e,t,i){super(),this.operator=e,this.left=t,this.right=i}get astNodeType(){return"binaryOp"}evaluate(e){switch(this.operator){case"+":return this.left.evaluate(e)+this.right.evaluate(e);case"-":return this.left.evaluate(e)-this.right.evaluate(e);case"*":return this.left.evaluate(e)*this.right.evaluate(e);case"/":return this.left.evaluate(e)/this.right.evaluate(e);case"%":return this.left.evaluate(e)%this.right.evaluate(e);case"==":return this.left.evaluate(e)==this.right.evaluate(e)?1:0;case"!=":return this.left.evaluate(e)!=this.right.evaluate(e)?1:0;case"<":return this.left.evaluate(e)<this.right.evaluate(e)?1:0;case">":return this.left.evaluate(e)>this.right.evaluate(e)?1:0;case"<=":return this.left.evaluate(e)<=this.right.evaluate(e)?1:0;case">=":return this.left.evaluate(e)>=this.right.evaluate(e)?1:0;case"&&":return this.left.evaluate(e)&&this.right.evaluate(e)?1:0;case"||":return this.left.evaluate(e)||this.right.evaluate(e)?1:0;default:throw new Error(`Unknown operator ${this.operator}`)}}}class Ue extends O{constructor(){super()}}class Te extends Ue{constructor(e,t){super(),this.selector=e,this.body=t}get astNodeType(){return"case"}}class Ge extends Ue{constructor(e){super(),this.body=e}get astNodeType(){return"default"}}class Le extends O{constructor(e,t,i){super(),this.name=e,this.type=t,this.attributes=i}get astNodeType(){return"argument"}}class Re extends O{constructor(e,t){super(),this.condition=e,this.body=t}get astNodeType(){return"elseif"}}class Fe extends O{constructor(e,t,i){super(),this.name=e,this.type=t,this.attributes=i}get astNodeType(){return"member"}}class Ne extends O{constructor(e,t){super(),this.name=e,this.value=t}get astNodeType(){return"attribute"}}!function(e){e[e.token=0]="token",e[e.keyword=1]="keyword",e[e.reserved=2]="reserved"}(ee||(ee={}));class Oe{constructor(e,t,i){this.name=e,this.type=t,this.rule=i}toString(){return this.name}}class Pe{}$=Pe,Pe.none=new Oe("",ee.reserved,""),Pe.eof=new Oe("EOF",ee.token,""),Pe.reserved={asm:new Oe("asm",ee.reserved,"asm"),bf16:new Oe("bf16",ee.reserved,"bf16"),do:new Oe("do",ee.reserved,"do"),enum:new Oe("enum",ee.reserved,"enum"),f16:new Oe("f16",ee.reserved,"f16"),f64:new Oe("f64",ee.reserved,"f64"),handle:new Oe("handle",ee.reserved,"handle"),i8:new Oe("i8",ee.reserved,"i8"),i16:new Oe("i16",ee.reserved,"i16"),i64:new Oe("i64",ee.reserved,"i64"),mat:new Oe("mat",ee.reserved,"mat"),premerge:new Oe("premerge",ee.reserved,"premerge"),regardless:new Oe("regardless",ee.reserved,"regardless"),typedef:new Oe("typedef",ee.reserved,"typedef"),u8:new Oe("u8",ee.reserved,"u8"),u16:new Oe("u16",ee.reserved,"u16"),u64:new Oe("u64",ee.reserved,"u64"),unless:new Oe("unless",ee.reserved,"unless"),using:new Oe("using",ee.reserved,"using"),vec:new Oe("vec",ee.reserved,"vec"),void:new Oe("void",ee.reserved,"void")},Pe.keywords={array:new Oe("array",ee.keyword,"array"),atomic:new Oe("atomic",ee.keyword,"atomic"),bool:new Oe("bool",ee.keyword,"bool"),f32:new Oe("f32",ee.keyword,"f32"),i32:new Oe("i32",ee.keyword,"i32"),mat2x2:new Oe("mat2x2",ee.keyword,"mat2x2"),mat2x3:new Oe("mat2x3",ee.keyword,"mat2x3"),mat2x4:new Oe("mat2x4",ee.keyword,"mat2x4"),mat3x2:new Oe("mat3x2",ee.keyword,"mat3x2"),mat3x3:new Oe("mat3x3",ee.keyword,"mat3x3"),mat3x4:new Oe("mat3x4",ee.keyword,"mat3x4"),mat4x2:new Oe("mat4x2",ee.keyword,"mat4x2"),mat4x3:new Oe("mat4x3",ee.keyword,"mat4x3"),mat4x4:new Oe("mat4x4",ee.keyword,"mat4x4"),ptr:new Oe("ptr",ee.keyword,"ptr"),sampler:new Oe("sampler",ee.keyword,"sampler"),sampler_comparison:new Oe("sampler_comparison",ee.keyword,"sampler_comparison"),struct:new Oe("struct",ee.keyword,"struct"),texture_1d:new Oe("texture_1d",ee.keyword,"texture_1d"),texture_2d:new Oe("texture_2d",ee.keyword,"texture_2d"),texture_2d_array:new Oe("texture_2d_array",ee.keyword,"texture_2d_array"),texture_3d:new Oe("texture_3d",ee.keyword,"texture_3d"),texture_cube:new Oe("texture_cube",ee.keyword,"texture_cube"),texture_cube_array:new Oe("texture_cube_array",ee.keyword,"texture_cube_array"),texture_multisampled_2d:new Oe("texture_multisampled_2d",ee.keyword,"texture_multisampled_2d"),texture_storage_1d:new Oe("texture_storage_1d",ee.keyword,"texture_storage_1d"),texture_storage_2d:new Oe("texture_storage_2d",ee.keyword,"texture_storage_2d"),texture_storage_2d_array:new Oe("texture_storage_2d_array",ee.keyword,"texture_storage_2d_array"),texture_storage_3d:new Oe("texture_storage_3d",ee.keyword,"texture_storage_3d"),texture_depth_2d:new Oe("texture_depth_2d",ee.keyword,"texture_depth_2d"),texture_depth_2d_array:new Oe("texture_depth_2d_array",ee.keyword,"texture_depth_2d_array"),texture_depth_cube:new Oe("texture_depth_cube",ee.keyword,"texture_depth_cube"),texture_depth_cube_array:new Oe("texture_depth_cube_array",ee.keyword,"texture_depth_cube_array"),texture_depth_multisampled_2d:new Oe("texture_depth_multisampled_2d",ee.keyword,"texture_depth_multisampled_2d"),texture_external:new Oe("texture_external",ee.keyword,"texture_external"),u32:new Oe("u32",ee.keyword,"u32"),vec2:new Oe("vec2",ee.keyword,"vec2"),vec3:new Oe("vec3",ee.keyword,"vec3"),vec4:new Oe("vec4",ee.keyword,"vec4"),bitcast:new Oe("bitcast",ee.keyword,"bitcast"),block:new Oe("block",ee.keyword,"block"),break:new Oe("break",ee.keyword,"break"),case:new Oe("case",ee.keyword,"case"),continue:new Oe("continue",ee.keyword,"continue"),continuing:new Oe("continuing",ee.keyword,"continuing"),default:new Oe("default",ee.keyword,"default"),discard:new Oe("discard",ee.keyword,"discard"),else:new Oe("else",ee.keyword,"else"),enable:new Oe("enable",ee.keyword,"enable"),fallthrough:new Oe("fallthrough",ee.keyword,"fallthrough"),false:new Oe("false",ee.keyword,"false"),fn:new Oe("fn",ee.keyword,"fn"),for:new Oe("for",ee.keyword,"for"),function:new Oe("function",ee.keyword,"function"),if:new Oe("if",ee.keyword,"if"),let:new Oe("let",ee.keyword,"let"),const:new Oe("const",ee.keyword,"const"),loop:new Oe("loop",ee.keyword,"loop"),while:new Oe("while",ee.keyword,"while"),private:new Oe("private",ee.keyword,"private"),read:new Oe("read",ee.keyword,"read"),read_write:new Oe("read_write",ee.keyword,"read_write"),return:new Oe("return",ee.keyword,"return"),storage:new Oe("storage",ee.keyword,"storage"),switch:new Oe("switch",ee.keyword,"switch"),true:new Oe("true",ee.keyword,"true"),alias:new Oe("alias",ee.keyword,"alias"),type:new Oe("type",ee.keyword,"type"),uniform:new Oe("uniform",ee.keyword,"uniform"),var:new Oe("var",ee.keyword,"var"),override:new Oe("override",ee.keyword,"override"),workgroup:new Oe("workgroup",ee.keyword,"workgroup"),write:new Oe("write",ee.keyword,"write"),r8unorm:new Oe("r8unorm",ee.keyword,"r8unorm"),r8snorm:new Oe("r8snorm",ee.keyword,"r8snorm"),r8uint:new Oe("r8uint",ee.keyword,"r8uint"),r8sint:new Oe("r8sint",ee.keyword,"r8sint"),r16uint:new Oe("r16uint",ee.keyword,"r16uint"),r16sint:new Oe("r16sint",ee.keyword,"r16sint"),r16float:new Oe("r16float",ee.keyword,"r16float"),rg8unorm:new Oe("rg8unorm",ee.keyword,"rg8unorm"),rg8snorm:new Oe("rg8snorm",ee.keyword,"rg8snorm"),rg8uint:new Oe("rg8uint",ee.keyword,"rg8uint"),rg8sint:new Oe("rg8sint",ee.keyword,"rg8sint"),r32uint:new Oe("r32uint",ee.keyword,"r32uint"),r32sint:new Oe("r32sint",ee.keyword,"r32sint"),r32float:new Oe("r32float",ee.keyword,"r32float"),rg16uint:new Oe("rg16uint",ee.keyword,"rg16uint"),rg16sint:new Oe("rg16sint",ee.keyword,"rg16sint"),rg16float:new Oe("rg16float",ee.keyword,"rg16float"),rgba8unorm:new Oe("rgba8unorm",ee.keyword,"rgba8unorm"),rgba8unorm_srgb:new Oe("rgba8unorm_srgb",ee.keyword,"rgba8unorm_srgb"),rgba8snorm:new Oe("rgba8snorm",ee.keyword,"rgba8snorm"),rgba8uint:new Oe("rgba8uint",ee.keyword,"rgba8uint"),rgba8sint:new Oe("rgba8sint",ee.keyword,"rgba8sint"),bgra8unorm:new Oe("bgra8unorm",ee.keyword,"bgra8unorm"),bgra8unorm_srgb:new Oe("bgra8unorm_srgb",ee.keyword,"bgra8unorm_srgb"),rgb10a2unorm:new Oe("rgb10a2unorm",ee.keyword,"rgb10a2unorm"),rg11b10float:new Oe("rg11b10float",ee.keyword,"rg11b10float"),rg32uint:new Oe("rg32uint",ee.keyword,"rg32uint"),rg32sint:new Oe("rg32sint",ee.keyword,"rg32sint"),rg32float:new Oe("rg32float",ee.keyword,"rg32float"),rgba16uint:new Oe("rgba16uint",ee.keyword,"rgba16uint"),rgba16sint:new Oe("rgba16sint",ee.keyword,"rgba16sint"),rgba16float:new Oe("rgba16float",ee.keyword,"rgba16float"),rgba32uint:new Oe("rgba32uint",ee.keyword,"rgba32uint"),rgba32sint:new Oe("rgba32sint",ee.keyword,"rgba32sint"),rgba32float:new Oe("rgba32float",ee.keyword,"rgba32float"),static_assert:new Oe("static_assert",ee.keyword,"static_assert")},Pe.tokens={decimal_float_literal:new Oe("decimal_float_literal",ee.token,/((-?[0-9]*\.[0-9]+|-?[0-9]+\.[0-9]*)((e|E)(\+|-)?[0-9]+)?f?)|(-?[0-9]+(e|E)(\+|-)?[0-9]+f?)|([0-9]+f)/),hex_float_literal:new Oe("hex_float_literal",ee.token,/-?0x((([0-9a-fA-F]*\.[0-9a-fA-F]+|[0-9a-fA-F]+\.[0-9a-fA-F]*)((p|P)(\+|-)?[0-9]+f?)?)|([0-9a-fA-F]+(p|P)(\+|-)?[0-9]+f?))/),int_literal:new Oe("int_literal",ee.token,/-?0x[0-9a-fA-F]+|0i?|-?[1-9][0-9]*i?/),uint_literal:new Oe("uint_literal",ee.token,/0x[0-9a-fA-F]+u|0u|[1-9][0-9]*u/),ident:new Oe("ident",ee.token,/[a-zA-Z][0-9a-zA-Z_]*/),and:new Oe("and",ee.token,"&"),and_and:new Oe("and_and",ee.token,"&&"),arrow:new Oe("arrow ",ee.token,"->"),attr:new Oe("attr",ee.token,"@"),attr_left:new Oe("attr_left",ee.token,"[["),attr_right:new Oe("attr_right",ee.token,"]]"),forward_slash:new Oe("forward_slash",ee.token,"/"),bang:new Oe("bang",ee.token,"!"),bracket_left:new Oe("bracket_left",ee.token,"["),bracket_right:new Oe("bracket_right",ee.token,"]"),brace_left:new Oe("brace_left",ee.token,"{"),brace_right:new Oe("brace_right",ee.token,"}"),colon:new Oe("colon",ee.token,":"),comma:new Oe("comma",ee.token,","),equal:new Oe("equal",ee.token,"="),equal_equal:new Oe("equal_equal",ee.token,"=="),not_equal:new Oe("not_equal",ee.token,"!="),greater_than:new Oe("greater_than",ee.token,">"),greater_than_equal:new Oe("greater_than_equal",ee.token,">="),shift_right:new Oe("shift_right",ee.token,">>"),less_than:new Oe("less_than",ee.token,"<"),less_than_equal:new Oe("less_than_equal",ee.token,"<="),shift_left:new Oe("shift_left",ee.token,"<<"),modulo:new Oe("modulo",ee.token,"%"),minus:new Oe("minus",ee.token,"-"),minus_minus:new Oe("minus_minus",ee.token,"--"),period:new Oe("period",ee.token,"."),plus:new Oe("plus",ee.token,"+"),plus_plus:new Oe("plus_plus",ee.token,"++"),or:new Oe("or",ee.token,"|"),or_or:new Oe("or_or",ee.token,"||"),paren_left:new Oe("paren_left",ee.token,"("),paren_right:new Oe("paren_right",ee.token,")"),semicolon:new Oe("semicolon",ee.token,";"),star:new Oe("star",ee.token,"*"),tilde:new Oe("tilde",ee.token,"~"),underscore:new Oe("underscore",ee.token,"_"),xor:new Oe("xor",ee.token,"^"),plus_equal:new Oe("plus_equal",ee.token,"+="),minus_equal:new Oe("minus_equal",ee.token,"-="),times_equal:new Oe("times_equal",ee.token,"*="),division_equal:new Oe("division_equal",ee.token,"/="),modulo_equal:new Oe("modulo_equal",ee.token,"%="),and_equal:new Oe("and_equal",ee.token,"&="),or_equal:new Oe("or_equal",ee.token,"|="),xor_equal:new Oe("xor_equal",ee.token,"^="),shift_right_equal:new Oe("shift_right_equal",ee.token,">>="),shift_left_equal:new Oe("shift_left_equal",ee.token,"<<=")},Pe.storage_class=[$.keywords.function,$.keywords.private,$.keywords.workgroup,$.keywords.uniform,$.keywords.storage],Pe.access_mode=[$.keywords.read,$.keywords.write,$.keywords.read_write],Pe.sampler_type=[$.keywords.sampler,$.keywords.sampler_comparison],Pe.sampled_texture_type=[$.keywords.texture_1d,$.keywords.texture_2d,$.keywords.texture_2d_array,$.keywords.texture_3d,$.keywords.texture_cube,$.keywords.texture_cube_array],Pe.multisampled_texture_type=[$.keywords.texture_multisampled_2d],Pe.storage_texture_type=[$.keywords.texture_storage_1d,$.keywords.texture_storage_2d,$.keywords.texture_storage_2d_array,$.keywords.texture_storage_3d],Pe.depth_texture_type=[$.keywords.texture_depth_2d,$.keywords.texture_depth_2d_array,$.keywords.texture_depth_cube,$.keywords.texture_depth_cube_array,$.keywords.texture_depth_multisampled_2d],Pe.texture_external_type=[$.keywords.texture_external],Pe.any_texture_type=[...$.sampled_texture_type,...$.multisampled_texture_type,...$.storage_texture_type,...$.depth_texture_type,...$.texture_external_type],Pe.texel_format=[$.keywords.r8unorm,$.keywords.r8snorm,$.keywords.r8uint,$.keywords.r8sint,$.keywords.r16uint,$.keywords.r16sint,$.keywords.r16float,$.keywords.rg8unorm,$.keywords.rg8snorm,$.keywords.rg8uint,$.keywords.rg8sint,$.keywords.r32uint,$.keywords.r32sint,$.keywords.r32float,$.keywords.rg16uint,$.keywords.rg16sint,$.keywords.rg16float,$.keywords.rgba8unorm,$.keywords.rgba8unorm_srgb,$.keywords.rgba8snorm,$.keywords.rgba8uint,$.keywords.rgba8sint,$.keywords.bgra8unorm,$.keywords.bgra8unorm_srgb,$.keywords.rgb10a2unorm,$.keywords.rg11b10float,$.keywords.rg32uint,$.keywords.rg32sint,$.keywords.rg32float,$.keywords.rgba16uint,$.keywords.rgba16sint,$.keywords.rgba16float,$.keywords.rgba32uint,$.keywords.rgba32sint,$.keywords.rgba32float],Pe.const_literal=[$.tokens.int_literal,$.tokens.uint_literal,$.tokens.decimal_float_literal,$.tokens.hex_float_literal,$.keywords.true,$.keywords.false],Pe.literal_or_ident=[$.tokens.ident,$.tokens.int_literal,$.tokens.uint_literal,$.tokens.decimal_float_literal,$.tokens.hex_float_literal],Pe.element_count_expression=[$.tokens.int_literal,$.tokens.uint_literal,$.tokens.ident],Pe.template_types=[$.keywords.vec2,$.keywords.vec3,$.keywords.vec4,$.keywords.mat2x2,$.keywords.mat2x3,$.keywords.mat2x4,$.keywords.mat3x2,$.keywords.mat3x3,$.keywords.mat3x4,$.keywords.mat4x2,$.keywords.mat4x3,$.keywords.mat4x4,$.keywords.atomic,$.keywords.bitcast,...$.any_texture_type],Pe.attribute_name=[$.tokens.ident,$.keywords.block],Pe.assignment_operators=[$.tokens.equal,$.tokens.plus_equal,$.tokens.minus_equal,$.tokens.times_equal,$.tokens.division_equal,$.tokens.modulo_equal,$.tokens.and_equal,$.tokens.or_equal,$.tokens.xor_equal,$.tokens.shift_right_equal,$.tokens.shift_left_equal],Pe.increment_operators=[$.tokens.plus_plus,$.tokens.minus_minus];class ze{constructor(e,t,i){this.type=e,this.lexeme=t,this.line=i}toString(){return this.lexeme}isTemplateType(){return-1!=Pe.template_types.indexOf(this.type)}isArrayType(){return this.type==Pe.keywords.array}isArrayOrTemplateType(){return this.isArrayType()||this.isTemplateType()}}class qe{constructor(e){this._tokens=[],this._start=0,this._current=0,this._line=1,this._source=null!=e?e:""}scanTokens(){for(;!this._isAtEnd();)if(this._start=this._current,!this.scanToken())throw`Invalid syntax at line ${this._line}`;return this._tokens.push(new ze(Pe.eof,"",this._line)),this._tokens}scanToken(){let e=this._advance();if("\n"==e)return this._line++,!0;if(this._isWhitespace(e))return!0;if("/"==e){if("/"==this._peekAhead()){for(;"\n"!=e;){if(this._isAtEnd())return!0;e=this._advance()}return this._line++,!0}if("*"==this._peekAhead()){this._advance();let t=1;for(;t>0;){if(this._isAtEnd())return!0;if(e=this._advance(),"\n"==e)this._line++;else if("*"==e){if("/"==this._peekAhead()&&(this._advance(),t--,0==t))return!0}else"/"==e&&"*"==this._peekAhead()&&(this._advance(),t++)}return!0}}let t=Pe.none;for(;;){let i=this._findType(e);const r=this._peekAhead();if(">"==e&&(">"==r||"="==r)){let e=!1,t=this._tokens.length-1;for(let i=0;i<5&&t>=0;++i,--t)if(this._tokens[t].type===Pe.tokens.less_than){t>0&&this._tokens[t-1].isArrayOrTemplateType()&&(e=!0);break}if(e)return this._addToken(i),!0}if(i===Pe.none){let r=e,s=0;const n=2;for(let e=0;e<n;++e)if(r+=this._peekAhead(e),i=this._findType(r),i!==Pe.none){s=e;break}if(i===Pe.none)return t!==Pe.none&&(this._current--,this._addToken(t),!0);e=r,this._current+=s+1}if(t=i,this._isAtEnd())break;e+=this._advance()}return t!==Pe.none&&(this._addToken(t),!0)}_findType(e){for(const t in Pe.keywords){const i=Pe.keywords[t];if(this._match(e,i.rule))return i}for(const t in Pe.tokens){const i=Pe.tokens[t];if(this._match(e,i.rule))return i}return Pe.none}_match(e,t){if("string"==typeof t){if(t==e)return!0}else{const i=t.exec(e);if(i&&0==i.index&&i[0]==e)return!0}return!1}_isAtEnd(){return this._current>=this._source.length}_isWhitespace(e){return" "==e||"\t"==e||"\r"==e}_advance(e=0){let t=this._source[this._current];return e=e||0,e++,this._current+=e,t}_peekAhead(e=0){return e=e||0,this._current+e>=this._source.length?"\0":this._source[this._current+e]}_addToken(e){const t=this._source.substring(this._start,this._current);this._tokens.push(new ze(e,t,this._line))}}class Ke{constructor(){this._tokens=[],this._current=0,this._context=new N}parse(e){this._initialize(e);let t=[];for(;!this._isAtEnd();){const e=this._global_decl_or_directive();if(!e)break;t.push(e)}return t}_initialize(e){if(e)if("string"==typeof e){const t=new qe(e);this._tokens=t.scanTokens()}else this._tokens=e;else this._tokens=[];this._current=0}_error(e,t){return console.error(e,t),{token:e,message:t,toString:function(){return`${t}`}}}_isAtEnd(){return this._current>=this._tokens.length||this._peek().type==Pe.eof}_match(e){if(e instanceof Oe)return!!this._check(e)&&(this._advance(),!0);for(let t=0,i=e.length;t<i;++t){const i=e[t];if(this._check(i))return this._advance(),!0}return!1}_consume(e,t){if(this._check(e))return this._advance();throw this._error(this._peek(),t)}_check(e){if(this._isAtEnd())return!1;const t=this._peek();if(e instanceof Array){let i=t.type;return-1!=e.indexOf(i)}return t.type==e}_advance(){return this._isAtEnd()||this._current++,this._previous()}_peek(){return this._tokens[this._current]}_previous(){return this._tokens[this._current-1]}_global_decl_or_directive(){for(;this._match(Pe.tokens.semicolon)&&!this._isAtEnd(););if(this._match(Pe.keywords.alias)){const e=this._type_alias();return this._consume(Pe.tokens.semicolon,"Expected ';'"),e}if(this._match(Pe.keywords.enable)){const e=this._enable_directive();return this._consume(Pe.tokens.semicolon,"Expected ';'"),e}const e=this._attribute();if(this._check(Pe.keywords.var)){const t=this._global_variable_decl();return null!=t&&(t.attributes=e),this._consume(Pe.tokens.semicolon,"Expected ';'."),t}if(this._check(Pe.keywords.override)){const t=this._override_variable_decl();return null!=t&&(t.attributes=e),this._consume(Pe.tokens.semicolon,"Expected ';'."),t}if(this._check(Pe.keywords.let)){const t=this._global_let_decl();return null!=t&&(t.attributes=e),this._consume(Pe.tokens.semicolon,"Expected ';'."),t}if(this._check(Pe.keywords.const)){const t=this._global_const_decl();return null!=t&&(t.attributes=e),this._consume(Pe.tokens.semicolon,"Expected ';'."),t}if(this._check(Pe.keywords.struct)){const t=this._struct_decl();return null!=t&&(t.attributes=e),t}if(this._check(Pe.keywords.fn)){const t=this._function_decl();return null!=t&&(t.attributes=e),t}return null}_function_decl(){if(!this._match(Pe.keywords.fn))return null;const e=this._consume(Pe.tokens.ident,"Expected function name.").toString();this._consume(Pe.tokens.paren_left,"Expected '(' for function arguments.");const t=[];if(!this._check(Pe.tokens.paren_right))do{if(this._check(Pe.tokens.paren_right))break;const e=this._attribute(),i=this._consume(Pe.tokens.ident,"Expected argument name.").toString();this._consume(Pe.tokens.colon,"Expected ':' for argument type.");const r=this._attribute(),s=this._type_decl();null!=s&&(s.attributes=r,t.push(new Le(i,s,e)))}while(this._match(Pe.tokens.comma));this._consume(Pe.tokens.paren_right,"Expected ')' after function arguments.");let i=null;if(this._match(Pe.tokens.arrow)){const e=this._attribute();i=this._type_decl(),null!=i&&(i.attributes=e)}const r=this._compound_statement();return new z(e,t,i,r)}_compound_statement(){const e=[];for(this._consume(Pe.tokens.brace_left,"Expected '{' for block.");!this._check(Pe.tokens.brace_right);){const t=this._statement();null!==t&&e.push(t)}return this._consume(Pe.tokens.brace_right,"Expected '}' for block."),e}_statement(){for(;this._match(Pe.tokens.semicolon)&&!this._isAtEnd(););if(this._check(Pe.keywords.if))return this._if_statement();if(this._check(Pe.keywords.switch))return this._switch_statement();if(this._check(Pe.keywords.loop))return this._loop_statement();if(this._check(Pe.keywords.for))return this._for_statement();if(this._check(Pe.keywords.while))return this._while_statement();if(this._check(Pe.keywords.continuing))return this._continuing_statement();if(this._check(Pe.keywords.static_assert))return this._static_assert_statement();if(this._check(Pe.tokens.brace_left))return this._compound_statement();let e=null;return e=this._check(Pe.keywords.return)?this._return_statement():this._check([Pe.keywords.var,Pe.keywords.let,Pe.keywords.const])?this._variable_statement():this._match(Pe.keywords.discard)?new ce:this._match(Pe.keywords.break)?new ge:this._match(Pe.keywords.continue)?new ue:this._increment_decrement_statement()||this._func_call_statement()||this._assignment_statement(),null!=e&&this._consume(Pe.tokens.semicolon,"Expected ';' after statement."),e}_static_assert_statement(){if(!this._match(Pe.keywords.static_assert))return null;let e=this._optional_paren_expression();return new q(e)}_while_statement(){if(!this._match(Pe.keywords.while))return null;let e=this._optional_paren_expression();const t=this._compound_statement();return new K(e,t)}_continuing_statement(){if(!this._match(Pe.keywords.continuing))return null;const e=this._compound_statement();return new H(e)}_for_statement(){if(!this._match(Pe.keywords.for))return null;this._consume(Pe.tokens.paren_left,"Expected '('.");const e=this._check(Pe.tokens.semicolon)?null:this._for_init();this._consume(Pe.tokens.semicolon,"Expected ';'.");const t=this._check(Pe.tokens.semicolon)?null:this._short_circuit_or_expression();this._consume(Pe.tokens.semicolon,"Expected ';'.");const i=this._check(Pe.tokens.paren_right)?null:this._for_increment();this._consume(Pe.tokens.paren_right,"Expected ')'.");const r=this._compound_statement();return new V(e,t,i,r)}_for_init(){return this._variable_statement()||this._func_call_statement()||this._assignment_statement()}_for_increment(){return this._func_call_statement()||this._increment_decrement_statement()||this._assignment_statement()}_variable_statement(){if(this._check(Pe.keywords.var)){const e=this._variable_decl();if(null===e)throw this._error(this._peek(),"Variable declaration expected.");let t=null;return this._match(Pe.tokens.equal)&&(t=this._short_circuit_or_expression()),new J(e.name,e.type,e.storage,e.access,t)}if(this._match(Pe.keywords.let)){const e=this._consume(Pe.tokens.ident,"Expected name for let.").toString();let t=null;if(this._match(Pe.tokens.colon)){const e=this._attribute();t=this._type_decl(),null!=t&&(t.attributes=e)}this._consume(Pe.tokens.equal,"Expected '=' for let.");const i=this._short_circuit_or_expression();return new j(e,t,null,null,i)}if(this._match(Pe.keywords.const)){const e=this._consume(Pe.tokens.ident,"Expected name for const.").toString();let t=null;if(this._match(Pe.tokens.colon)){const e=this._attribute();t=this._type_decl(),null!=t&&(t.attributes=e)}this._consume(Pe.tokens.equal,"Expected '=' for const.");const i=this._short_circuit_or_expression();return new Z(e,t,null,null,i)}return null}_increment_decrement_statement(){const e=this._current,t=this._unary_expression();if(null==t)return null;if(!this._check(Pe.increment_operators))return this._current=e,null;const i=this._consume(Pe.increment_operators,"Expected increment operator");return new ie(i.type===Pe.tokens.plus_plus?W.increment:W.decrement,t)}_assignment_statement(){let e=null;if(this._check(Pe.tokens.brace_right))return null;let t=this._match(Pe.tokens.underscore);if(t||(e=this._unary_expression()),!t&&null==e)return null;const i=this._consume(Pe.assignment_operators,"Expected assignment operator."),r=this._short_circuit_or_expression();return new re(X.parse(i.lexeme),e,r)}_func_call_statement(){if(!this._check(Pe.tokens.ident))return null;const e=this._current,t=this._consume(Pe.tokens.ident,"Expected function name."),i=this._argument_expression_list();return null===i?(this._current=e,null):new se(t.lexeme,i)}_loop_statement(){if(!this._match(Pe.keywords.loop))return null;this._consume(Pe.tokens.brace_left,"Expected '{' for loop.");const e=[];let t=this._statement();for(;null!==t;){if(Array.isArray(t))for(let i of t)e.push(i);else e.push(t);t=this._statement()}let i=null;return this._match(Pe.keywords.continuing)&&(i=this._compound_statement()),this._consume(Pe.tokens.brace_right,"Expected '}' for loop."),new ne(e,i)}_switch_statement(){if(!this._match(Pe.keywords.switch))return null;const e=this._optional_paren_expression();this._consume(Pe.tokens.brace_left,"Expected '{' for switch.");const t=this._switch_body();if(null==t||0==t.length)throw this._error(this._previous(),"Expected 'case' or 'default'.");return this._consume(Pe.tokens.brace_right,"Expected '}' for switch."),new ae(e,t)}_switch_body(){const e=[];if(this._match(Pe.keywords.case)){const t=this._case_selectors();this._match(Pe.tokens.colon),this._consume(Pe.tokens.brace_left,"Exected '{' for switch case.");const i=this._case_body();this._consume(Pe.tokens.brace_right,"Exected '}' for switch case."),e.push(new Te(t,i))}if(this._match(Pe.keywords.default)){this._match(Pe.tokens.colon),this._consume(Pe.tokens.brace_left,"Exected '{' for switch default.");const t=this._case_body();this._consume(Pe.tokens.brace_right,"Exected '}' for switch default."),e.push(new Ge(t))}if(this._check([Pe.keywords.default,Pe.keywords.case])){const t=this._switch_body();e.push(t[0])}return e}_case_selectors(){var e,t,i,r;const s=[null!==(t=null===(e=this._shift_expression())||void 0===e?void 0:e.evaluate(this._context).toString())&&void 0!==t?t:""];for(;this._match(Pe.tokens.comma);)s.push(null!==(r=null===(i=this._shift_expression())||void 0===i?void 0:i.evaluate(this._context).toString())&&void 0!==r?r:"");return s}_case_body(){if(this._match(Pe.keywords.fallthrough))return this._consume(Pe.tokens.semicolon,"Expected ';'"),[];let e=this._statement();if(null==e)return[];e instanceof Array||(e=[e]);const t=this._case_body();return 0==t.length?e:[...e,t[0]]}_if_statement(){if(!this._match(Pe.keywords.if))return null;const e=this._optional_paren_expression(),t=this._compound_statement();let i=[];this._match_elseif()&&(i=this._elseif_statement(i));let r=null;return this._match(Pe.keywords.else)&&(r=this._compound_statement()),new oe(e,t,i,r)}_match_elseif(){return this._tokens[this._current].type===Pe.keywords.else&&this._tokens[this._current+1].type===Pe.keywords.if&&(this._advance(),this._advance(),!0)}_elseif_statement(e=[]){const t=this._optional_paren_expression(),i=this._compound_statement();return e.push(new Re(t,i)),this._match_elseif()&&this._elseif_statement(e),e}_return_statement(){if(!this._match(Pe.keywords.return))return null;const e=this._short_circuit_or_expression();return new Ae(e)}_short_circuit_or_expression(){let e=this._short_circuit_and_expr();for(;this._match(Pe.tokens.or_or);)e=new Me(this._previous().toString(),e,this._short_circuit_and_expr());return e}_short_circuit_and_expr(){let e=this._inclusive_or_expression();for(;this._match(Pe.tokens.and_and);)e=new Me(this._previous().toString(),e,this._inclusive_or_expression());return e}_inclusive_or_expression(){let e=this._exclusive_or_expression();for(;this._match(Pe.tokens.or);)e=new Me(this._previous().toString(),e,this._exclusive_or_expression());return e}_exclusive_or_expression(){let e=this._and_expression();for(;this._match(Pe.tokens.xor);)e=new Me(this._previous().toString(),e,this._and_expression());return e}_and_expression(){let e=this._equality_expression();for(;this._match(Pe.tokens.and);)e=new Me(this._previous().toString(),e,this._equality_expression());return e}_equality_expression(){const e=this._relational_expression();return this._match([Pe.tokens.equal_equal,Pe.tokens.not_equal])?new Me(this._previous().toString(),e,this._relational_expression()):e}_relational_expression(){let e=this._shift_expression();for(;this._match([Pe.tokens.less_than,Pe.tokens.greater_than,Pe.tokens.less_than_equal,Pe.tokens.greater_than_equal]);)e=new Me(this._previous().toString(),e,this._shift_expression());return e}_shift_expression(){let e=this._additive_expression();for(;this._match([Pe.tokens.shift_left,Pe.tokens.shift_right]);)e=new Me(this._previous().toString(),e,this._additive_expression());return e}_additive_expression(){let e=this._multiplicative_expression();for(;this._match([Pe.tokens.plus,Pe.tokens.minus]);)e=new Me(this._previous().toString(),e,this._multiplicative_expression());return e}_multiplicative_expression(){let e=this._unary_expression();for(;this._match([Pe.tokens.star,Pe.tokens.forward_slash,Pe.tokens.modulo]);)e=new Me(this._previous().toString(),e,this._unary_expression());return e}_unary_expression(){return this._match([Pe.tokens.minus,Pe.tokens.bang,Pe.tokens.tilde,Pe.tokens.star,Pe.tokens.and])?new Se(this._previous().toString(),this._unary_expression()):this._singular_expression()}_singular_expression(){const e=this._primary_expression(),t=this._postfix_expression();return t&&(e.postfix=t),e}_postfix_expression(){if(this._match(Pe.tokens.bracket_left)){const e=this._short_circuit_or_expression();this._consume(Pe.tokens.bracket_right,"Expected ']'.");const t=this._postfix_expression();return t&&(e.postfix=t),e}if(this._match(Pe.tokens.period)){const e=this._consume(Pe.tokens.ident,"Expected member name."),t=this._postfix_expression(),i=new Ce(e.lexeme);return t&&(i.postfix=t),i}return null}_getStruct(e){if(this._context.aliases.has(e)){return this._context.aliases.get(e).type}if(this._context.structs.has(e)){return this._context.structs.get(e)}return null}_primary_expression(){if(this._match(Pe.tokens.ident)){const e=this._previous().toString();if(this._check(Pe.tokens.paren_left)){const t=this._argument_expression_list(),i=this._getStruct(e);return null!=i?new Be(i,t):new Ee(e,t)}if(this._context.constants.has(e)){const t=this._context.constants.get(e);return new Qe(e,t.value)}return new ye(e)}if(this._match(Pe.const_literal))return new be(parseFloat(this._previous().toString()));if(this._check(Pe.tokens.paren_left))return this._paren_expression();if(this._match(Pe.keywords.bitcast)){this._consume(Pe.tokens.less_than,"Expected '<'.");const e=this._type_decl();this._consume(Pe.tokens.greater_than,"Expected '>'.");const t=this._paren_expression();return new ke(e,t)}const e=this._type_decl(),t=this._argument_expression_list();return new xe(e,t)}_argument_expression_list(){if(!this._match(Pe.tokens.paren_left))return null;const e=[];do{if(this._check(Pe.tokens.paren_right))break;const t=this._short_circuit_or_expression();e.push(t)}while(this._match(Pe.tokens.comma));return this._consume(Pe.tokens.paren_right,"Expected ')' for agument list"),e}_optional_paren_expression(){this._match(Pe.tokens.paren_left);const e=this._short_circuit_or_expression();return this._match(Pe.tokens.paren_right),new ve([e])}_paren_expression(){this._consume(Pe.tokens.paren_left,"Expected '('.");const e=this._short_circuit_or_expression();return this._consume(Pe.tokens.paren_right,"Expected ')'."),new ve([e])}_struct_decl(){if(!this._match(Pe.keywords.struct))return null;const e=this._consume(Pe.tokens.ident,"Expected name for struct.").toString();this._consume(Pe.tokens.brace_left,"Expected '{' for struct body.");const t=[];for(;!this._check(Pe.tokens.brace_right);){const e=this._attribute(),i=this._consume(Pe.tokens.ident,"Expected variable name.").toString();this._consume(Pe.tokens.colon,"Expected ':' for struct member type.");const r=this._attribute(),s=this._type_decl();null!=s&&(s.attributes=r),this._check(Pe.tokens.brace_right)?this._match(Pe.tokens.comma):this._consume(Pe.tokens.comma,"Expected ',' for struct member."),t.push(new Fe(i,s,e))}this._consume(Pe.tokens.brace_right,"Expected '}' after struct body.");const i=new fe(e,t);return this._context.structs.set(e,i),i}_global_variable_decl(){const e=this._variable_decl();return e&&this._match(Pe.tokens.equal)&&(e.value=this._const_expression()),e}_override_variable_decl(){const e=this._override_decl();return e&&this._match(Pe.tokens.equal)&&(e.value=this._const_expression()),e}_global_const_decl(){if(!this._match(Pe.keywords.const))return null;const e=this._consume(Pe.tokens.ident,"Expected variable name");let t=null;if(this._match(Pe.tokens.colon)){const e=this._attribute();t=this._type_decl(),null!=t&&(t.attributes=e)}let i=null;if(this._match(Pe.tokens.equal)){const e=this._short_circuit_or_expression();if(e instanceof Be)i=e;else if(e instanceof Qe&&e.initializer instanceof Be)i=e.initializer;else try{const t=e.evaluate(this._context);i=new be(t)}catch(t){i=e}}const r=new Z(e.toString(),t,"","",i);return this._context.constants.set(r.name,r),r}_global_let_decl(){if(!this._match(Pe.keywords.let))return null;const e=this._consume(Pe.tokens.ident,"Expected variable name");let t=null;if(this._match(Pe.tokens.colon)){const e=this._attribute();t=this._type_decl(),null!=t&&(t.attributes=e)}let i=null;return this._match(Pe.tokens.equal)&&(i=this._const_expression()),new j(e.toString(),t,"","",i)}_const_expression(){if(this._match(Pe.const_literal))return new Ce(this._previous().toString());const e=this._type_decl();this._consume(Pe.tokens.paren_left,"Expected '('.");let t=[];for(;!this._check(Pe.tokens.paren_right)&&(t.push(this._const_expression()),this._check(Pe.tokens.comma));)this._advance();return this._consume(Pe.tokens.paren_right,"Expected ')'."),new Be(e,t)}_variable_decl(){if(!this._match(Pe.keywords.var))return null;let e="",t="";this._match(Pe.tokens.less_than)&&(e=this._consume(Pe.storage_class,"Expected storage_class.").toString(),this._match(Pe.tokens.comma)&&(t=this._consume(Pe.access_mode,"Expected access_mode.").toString()),this._consume(Pe.tokens.greater_than,"Expected '>'."));const i=this._consume(Pe.tokens.ident,"Expected variable name");let r=null;if(this._match(Pe.tokens.colon)){const e=this._attribute();r=this._type_decl(),null!=r&&(r.attributes=e)}return new J(i.toString(),r,e,t,null)}_override_decl(){if(!this._match(Pe.keywords.override))return null;const e=this._consume(Pe.tokens.ident,"Expected variable name");let t=null;if(this._match(Pe.tokens.colon)){const e=this._attribute();t=this._type_decl(),null!=t&&(t.attributes=e)}return new Y(e.toString(),t,null)}_enable_directive(){const e=this._consume(Pe.tokens.ident,"identity expected.");return new le(e.toString())}_type_alias(){const e=this._consume(Pe.tokens.ident,"identity expected.");this._consume(Pe.tokens.equal,"Expected '=' for type alias.");let t=this._type_decl();if(null===t)throw this._error(this._peek(),"Expected Type for Alias.");this._context.aliases.has(t.name)&&(t=this._context.aliases.get(t.name).type);const i=new he(e.toString(),t);return this._context.aliases.set(i.name,i),i}_type_decl(){if(this._check([Pe.tokens.ident,...Pe.texel_format,Pe.keywords.bool,Pe.keywords.f32,Pe.keywords.i32,Pe.keywords.u32])){const e=this._advance(),t=e.toString();return this._context.structs.has(t)?this._context.structs.get(t):this._context.aliases.has(t)?this._context.aliases.get(t).type:new de(e.toString())}let e=this._texture_sampler_types();if(e)return e;if(this._check(Pe.template_types)){let e=this._advance().toString(),t=null,i=null;return this._match(Pe.tokens.less_than)&&(t=this._type_decl(),i=null,this._match(Pe.tokens.comma)&&(i=this._consume(Pe.access_mode,"Expected access_mode for pointer").toString()),this._consume(Pe.tokens.greater_than,"Expected '>' for type.")),new pe(e,t,i)}if(this._match(Pe.keywords.ptr)){let e=this._previous().toString();this._consume(Pe.tokens.less_than,"Expected '<' for pointer.");const t=this._consume(Pe.storage_class,"Expected storage_class for pointer");this._consume(Pe.tokens.comma,"Expected ',' for pointer.");const i=this._type_decl();let r=null;return this._match(Pe.tokens.comma)&&(r=this._consume(Pe.access_mode,"Expected access_mode for pointer").toString()),this._consume(Pe.tokens.greater_than,"Expected '>' for pointer."),new Ie(e,t.toString(),i,r)}const t=this._attribute();if(this._match(Pe.keywords.array)){let e=null,i=-1;const r=this._previous();if(this._match(Pe.tokens.less_than)){e=this._type_decl(),this._context.aliases.has(e.name)&&(e=this._context.aliases.get(e.name).type);let t="";if(this._match(Pe.tokens.comma)){t=this._shift_expression().evaluate(this._context).toString()}this._consume(Pe.tokens.greater_than,"Expected '>' for array."),i=t?parseInt(t):0}return new me(r.toString(),t,e,i)}return null}_texture_sampler_types(){if(this._match(Pe.sampler_type))return new _e(this._previous().toString(),null,null);if(this._match(Pe.depth_texture_type))return new _e(this._previous().toString(),null,null);if(this._match(Pe.sampled_texture_type)||this._match(Pe.multisampled_texture_type)){const e=this._previous();this._consume(Pe.tokens.less_than,"Expected '<' for sampler type.");const t=this._type_decl();return this._consume(Pe.tokens.greater_than,"Expected '>' for sampler type."),new _e(e.toString(),t,null)}if(this._match(Pe.storage_texture_type)){const e=this._previous();this._consume(Pe.tokens.less_than,"Expected '<' for sampler type.");const t=this._consume(Pe.texel_format,"Invalid texel format.").toString();this._consume(Pe.tokens.comma,"Expected ',' after texel format.");const i=this._consume(Pe.access_mode,"Expected access mode for storage texture type.").toString();return this._consume(Pe.tokens.greater_than,"Expected '>' for sampler type."),new _e(e.toString(),t,i)}return null}_attribute(){let e=[];for(;this._match(Pe.tokens.attr);){const t=this._consume(Pe.attribute_name,"Expected attribute name"),i=new Ne(t.toString(),null);if(this._match(Pe.tokens.paren_left)){if(i.value=this._consume(Pe.literal_or_ident,"Expected attribute value").toString(),this._check(Pe.tokens.comma)){this._advance();do{const e=this._consume(Pe.literal_or_ident,"Expected attribute value").toString();i.value instanceof Array||(i.value=[i.value]),i.value.push(e)}while(this._match(Pe.tokens.comma))}this._consume(Pe.tokens.paren_right,"Expected ')'")}e.push(i)}for(;this._match(Pe.tokens.attr_left);){if(!this._check(Pe.tokens.attr_right))do{const t=this._consume(Pe.attribute_name,"Expected attribute name"),i=new Ne(t.toString(),null);if(this._match(Pe.tokens.paren_left)){if(i.value=[this._consume(Pe.literal_or_ident,"Expected attribute value").toString()],this._check(Pe.tokens.comma)){this._advance();do{const e=this._consume(Pe.literal_or_ident,"Expected attribute value").toString();i.value.push(e)}while(this._match(Pe.tokens.comma))}this._consume(Pe.tokens.paren_right,"Expected ')'")}e.push(i)}while(this._match(Pe.tokens.comma));this._consume(Pe.tokens.attr_right,"Expected ']]' after attribute declarations")}return 0==e.length?null:e}}class He{constructor(e,t){this.name=e,this.attributes=t,this.size=0}get isArray(){return!1}get isStruct(){return!1}get isTemplate(){return!1}}class Ve{constructor(e,t,i){this.name=e,this.type=t,this.attributes=i,this.offset=0,this.size=0}get isArray(){return this.type.isArray}get isStruct(){return this.type.isStruct}get isTemplate(){return this.type.isTemplate}get align(){return this.type.isStruct?this.type.align:0}get members(){return this.type.isStruct?this.type.members:null}get format(){return this.type.isArray||this.type.isTemplate?this.type.format:null}get count(){return this.type.isArray?this.type.count:0}get stride(){return this.type.isArray?this.type.stride:this.size}}class Je extends He{constructor(e,t){super(e,t),this.members=[],this.align=0}get isStruct(){return!0}}class Ye extends He{constructor(e,t){super(e,t),this.count=0,this.stride=0}get isArray(){return!0}}class je extends He{constructor(e,t,i,r){super(e,i),this.format=t,this.access=r}get isTemplate(){return!0}}!function(e){e[e.Uniform=0]="Uniform",e[e.Storage=1]="Storage",e[e.Texture=2]="Texture",e[e.Sampler=3]="Sampler",e[e.StorageTexture=4]="StorageTexture"}(te||(te={}));class Ze{constructor(e,t,i,r,s,n,a){this.name=e,this.type=t,this.group=i,this.binding=r,this.attributes=s,this.resourceType=n,this.access=a}get isArray(){return this.type.isArray}get isStruct(){return this.type.isStruct}get isTemplate(){return this.type.isTemplate}get size(){return this.type.size}get align(){return this.type.isStruct?this.type.align:0}get members(){return this.type.isStruct?this.type.members:null}get format(){return this.type.isArray||this.type.isTemplate?this.type.format:null}get count(){return this.type.isArray?this.type.count:0}get stride(){return this.type.isArray?this.type.stride:this.size}}class We{constructor(e,t){this.name=e,this.type=t}}class Xe{constructor(e,t){this.align=e,this.size=t}}class $e{constructor(e,t,i,r){this.name=e,this.type=t,this.locationType=i,this.location=r,this.interpolation=null}}class et{constructor(e,t,i,r){this.name=e,this.type=t,this.locationType=i,this.location=r}}class tt{constructor(e,t=null){this.stage=null,this.inputs=[],this.outputs=[],this.name=e,this.stage=t}}class it{constructor(){this.vertex=[],this.fragment=[],this.compute=[]}}class rt{constructor(e,t,i,r){this.name=e,this.type=t,this.attributes=i,this.id=r}}class st{constructor(e){this.uniforms=[],this.storage=[],this.textures=[],this.samplers=[],this.aliases=[],this.overrides=[],this.structs=[],this.entry=new it,this._types=new Map,e&&this.update(e)}_isStorageTexture(e){return"texture_storage_1d"==e.name||"texture_storage_2d"==e.name||"texture_storage_2d_array"==e.name||"texture_storage_3d"==e.name}update(e){const t=(new Ke).parse(e);for(const e of t)if(e instanceof fe){const t=this._getTypeInfo(e,null);t instanceof Je&&this.structs.push(t)}else if(e instanceof he)this.aliases.push(this._getAliasInfo(e));else if(e instanceof Y){const t=e,i=this._getAttributeNum(t.attributes,"id",0),r=null!=t.type?this._getTypeInfo(t.type,t.attributes):null;this.overrides.push(new rt(t.name,r,t.attributes,i))}else if(this._isUniformVar(e)){const t=e,i=this._getAttributeNum(t.attributes,"group",0),r=this._getAttributeNum(t.attributes,"binding",0),s=this._getTypeInfo(t.type,t.attributes),n=new Ze(t.name,s,i,r,t.attributes,te.Uniform,t.access);this.uniforms.push(n)}else if(this._isStorageVar(e)){const t=e,i=this._getAttributeNum(t.attributes,"group",0),r=this._getAttributeNum(t.attributes,"binding",0),s=this._getTypeInfo(t.type,t.attributes),n=this._isStorageTexture(s),a=new Ze(t.name,s,i,r,t.attributes,n?te.StorageTexture:te.Storage,t.access);this.storage.push(a)}else if(this._isTextureVar(e)){const t=e,i=this._getAttributeNum(t.attributes,"group",0),r=this._getAttributeNum(t.attributes,"binding",0),s=this._getTypeInfo(t.type,t.attributes),n=this._isStorageTexture(s),a=new Ze(t.name,s,i,r,t.attributes,n?te.StorageTexture:te.Texture,t.access);n?this.storage.push(a):this.textures.push(a)}else if(this._isSamplerVar(e)){const t=e,i=this._getAttributeNum(t.attributes,"group",0),r=this._getAttributeNum(t.attributes,"binding",0),s=this._getTypeInfo(t.type,t.attributes),n=new Ze(t.name,s,i,r,t.attributes,te.Sampler,t.access);this.samplers.push(n)}else if(e instanceof z){const t=this._getAttribute(e,"vertex"),i=this._getAttribute(e,"fragment"),r=this._getAttribute(e,"compute"),s=t||i||r;if(s){const t=new tt(e.name,s.name);t.inputs=this._getInputs(e.args),t.outputs=this._getOutputs(e.returnType),this.entry[s.name].push(t)}}else;}getBindGroups(){const e=[];function t(t,i){t>=e.length&&(e.length=t+1),void 0===e[t]&&(e[t]=[]),i>=e[t].length&&(e[t].length=i+1)}for(const i of this.uniforms){t(i.group,i.binding);e[i.group][i.binding]=i}for(const i of this.storage){t(i.group,i.binding);e[i.group][i.binding]=i}for(const i of this.textures){t(i.group,i.binding);e[i.group][i.binding]=i}for(const i of this.samplers){t(i.group,i.binding);e[i.group][i.binding]=i}return e}_getOutputs(e,t=undefined){if(void 0===t&&(t=[]),e instanceof fe)this._getStructOutputs(e,t);else{const i=this._getOutputInfo(e);null!==i&&t.push(i)}return t}_getStructOutputs(e,t){for(const i of e.members)if(i.type instanceof fe)this._getStructOutputs(i.type,t);else{const e=this._getAttribute(i,"location")||this._getAttribute(i,"builtin");if(null!==e){const r=this._getTypeInfo(i.type,i.type.attributes),s=this._parseInt(e.value),n=new et(i.name,r,e.name,s);t.push(n)}}}_getOutputInfo(e){const t=this._getAttribute(e,"location")||this._getAttribute(e,"builtin");if(null!==t){const i=this._getTypeInfo(e,e.attributes),r=this._parseInt(t.value);return new et("",i,t.name,r)}return null}_getInputs(e,t=undefined){void 0===t&&(t=[]);for(const i of e)if(i.type instanceof fe)this._getStructInputs(i.type,t);else{const e=this._getInputInfo(i);null!==e&&t.push(e)}return t}_getStructInputs(e,t){for(const i of e.members)if(i.type instanceof fe)this._getStructInputs(i.type,t);else{const e=this._getInputInfo(i);null!==e&&t.push(e)}}_getInputInfo(e){const t=this._getAttribute(e,"location")||this._getAttribute(e,"builtin");if(null!==t){const i=this._getAttribute(e,"interpolation"),r=this._getTypeInfo(e.type,e.attributes),s=this._parseInt(t.value),n=new $e(e.name,r,t.name,s);return null!==i&&(n.interpolation=this._parseString(i.value)),n}return null}_parseString(e){return e instanceof Array&&(e=e[0]),e}_parseInt(e){e instanceof Array&&(e=e[0]);const t=parseInt(e);return isNaN(t)?e:t}_getAlias(e){for(const t of this.aliases)if(t.name==e)return t.type;return null}_getAliasInfo(e){return new We(e.name,this._getTypeInfo(e.type,null))}_getTypeInfo(e,t){if(this._types.has(e))return this._types.get(e);if(e instanceof me){const i=e,r=this._getTypeInfo(i.format,i.attributes),s=new Ye(i.name,t);return s.format=r,s.count=i.count,this._types.set(e,s),this._updateTypeInfo(s),s}if(e instanceof fe){const i=e,r=new Je(i.name,t);for(const e of i.members){const t=this._getTypeInfo(e.type,e.attributes);r.members.push(new Ve(e.name,t,e.attributes))}return this._types.set(e,r),this._updateTypeInfo(r),r}if(e instanceof _e){const i=e,r=i.format instanceof de,s=i.format?r?this._getTypeInfo(i.format,null):new He(i.format,null):null,n=new je(i.name,s,t,i.access);return this._types.set(e,n),this._updateTypeInfo(n),n}if(e instanceof pe){const i=e,r=i.format?this._getTypeInfo(i.format,null):null,s=new je(i.name,r,t,i.access);return this._types.set(e,s),this._updateTypeInfo(s),s}const i=new He(e.name,t);return this._types.set(e,i),this._updateTypeInfo(i),i}_updateTypeInfo(e){var t,i;const r=this._getTypeSize(e);if(e.size=null!==(t=null==r?void 0:r.size)&&void 0!==t?t:0,e instanceof Ye){const t=this._getTypeSize(e.format);e.stride=null!==(i=null==t?void 0:t.size)&&void 0!==i?i:0,this._updateTypeInfo(e.format)}e instanceof Je&&this._updateStructInfo(e)}_updateStructInfo(e){var t;let i=0,r=0,s=0,n=0;for(let a=0,o=e.members.length;a<o;++a){const o=e.members[a],A=this._getTypeSize(o);if(!A)continue;null!==(t=this._getAlias(o.type.name))&&void 0!==t||o.type;const l=A.align,h=A.size;i=this._roundUp(l,i+r),r=h,s=i,n=Math.max(n,l),o.offset=i,o.size=h,this._updateTypeInfo(o.type)}e.size=this._roundUp(n,s+r),e.align=n}_getTypeSize(e){var t;if(null==e)return null;const i=this._getAttributeNum(e.attributes,"size",0),r=this._getAttributeNum(e.attributes,"align",0);if(e instanceof Ve&&(e=e.type),e instanceof He){const t=this._getAlias(e.name);null!==t&&(e=t)}{const t=st._typeInfo[e.name];if(void 0!==t){const s="f16"===e.format?2:1;return new Xe(Math.max(r,t.align/s),Math.max(i,t.size/s))}}{const t=st._typeInfo[e.name.substring(0,e.name.length-1)];if(t){const s="h"===e.name[e.name.length-1]?2:1;return new Xe(Math.max(r,t.align/s),Math.max(i,t.size/s))}}if(e instanceof Ye){let s=e,n=8,a=8;const o=this._getTypeSize(s.format);null!==o&&(a=o.size,n=o.align);return a=s.count*this._getAttributeNum(null!==(t=null==e?void 0:e.attributes)&&void 0!==t?t:null,"stride",this._roundUp(n,a)),i&&(a=i),new Xe(Math.max(r,n),Math.max(i,a))}if(e instanceof Je){let t=0,s=0,n=0,a=0,o=0;for(const i of e.members){const e=this._getTypeSize(i.type);null!==e&&(t=Math.max(e.align,t),n=this._roundUp(e.align,n+a),a=e.size,o=n)}return s=this._roundUp(t,o+a),new Xe(Math.max(r,t),Math.max(i,s))}return null}_isUniformVar(e){return e instanceof J&&"uniform"==e.storage}_isStorageVar(e){return e instanceof J&&"storage"==e.storage}_isTextureVar(e){return e instanceof J&&null!==e.type&&-1!=st._textureTypes.indexOf(e.type.name)}_isSamplerVar(e){return e instanceof J&&null!==e.type&&-1!=st._samplerTypes.indexOf(e.type.name)}_getAttribute(e,t){const i=e;if(!i||!i.attributes)return null;const r=i.attributes;for(let e of r)if(e.name==t)return e;return null}_getAttributeNum(e,t,i){if(null===e)return i;for(let r of e)if(r.name==t){let e=null!==r&&null!==r.value?r.value:i;return e instanceof Array&&(e=e[0]),"number"==typeof e?e:"string"==typeof e?parseInt(e):i}return i}_roundUp(e,t){return Math.ceil(t/e)*e}}function nt(e){const t={attributes:[],bindings:[]};let i;try{i=function(e){try{return new st(e)}catch(e){if(e instanceof Error)throw e;let t="WGSL parse error";throw"object"==typeof e&&e?.message&&(t+=`: ${e.message} `),"object"==typeof e&&e?.token&&(t+=e.token.line||""),new Error(t,{cause:e})}}(e)}catch(e){return n.log.error(e.message)(),t}for(const e of i.uniforms){const i=[];for(const t of e.type.members)i.push({name:t.name,type:at(t.type)});t.bindings.push({type:"uniform",name:e.name,location:e.binding,group:e.group,members:i})}const r=i.entry.vertex[0],s=r?.inputs.length||0;for(let e=0;e<s;e++){const i=r.inputs[e];if("location"===i.locationType){const e=at(i.type);t.attributes.push({name:i.name,location:i.location,type:e})}}return t}function at(e){return e.format?`${e.name}<${e.format.name}>`:e.name}st._typeInfo={f16:{align:2,size:2},i32:{align:4,size:4},u32:{align:4,size:4},f32:{align:4,size:4},atomic:{align:4,size:4},vec2:{align:8,size:8},vec3:{align:16,size:12},vec4:{align:16,size:16},mat2x2:{align:8,size:16},mat3x2:{align:8,size:24},mat4x2:{align:8,size:32},mat2x3:{align:16,size:32},mat3x3:{align:16,size:48},mat4x3:{align:16,size:64},mat2x4:{align:16,size:32},mat3x4:{align:16,size:48},mat4x4:{align:16,size:64}},st._textureTypes=Pe.any_texture_type.map((e=>e.name)),st._samplerTypes=Pe.sampler_type.map((e=>e.name));class ot{id;userData={};topology;bufferLayout=[];vertexCount;indices;attributes;constructor(e){this.id=e.id||n.uid("geometry"),this.topology=e.topology,this.indices=e.indices||null,this.attributes=e.attributes,this.vertexCount=e.vertexCount,this.bufferLayout=e.bufferLayout||[],this.indices&&n.assert(this.indices.usage===n.Buffer.INDEX)}destroy(){this.indices?.destroy();for(const e of Object.values(this.attributes))e.destroy()}getVertexCount(){return this.vertexCount}getAttributes(){return this.attributes}getIndexes(){return this.indices}_calculateVertexCount(e){return e.byteLength/12}}function At(e,t){if(t instanceof ot)return t;const i=function(e,t){if(!t.indices)return;const i=t.indices.value;return e.createBuffer({usage:n.Buffer.INDEX,data:i})}(e,t),{attributes:r,bufferLayout:s}=function(e,t){const i=[],r={};for(const[s,a]of Object.entries(t.attributes)){let t=s;switch(s){case"POSITION":t="positions";break;case"NORMAL":t="normals";break;case"TEXCOORD_0":t="texCoords";break;case"COLOR_0":t="colors"}r[t]=e.createBuffer({data:a.value,id:`${s}-buffer`});const{value:o,size:A,normalized:l}=a;i.push({name:t,format:n.getVertexFormatFromAttribute(o,A,l)})}const s=t._calculateVertexCount(t.attributes,t.indices);return{attributes:r,bufferLayout:i,vertexCount:s}}(e,t);return new ot({topology:t.topology||"triangle-list",bufferLayout:s,vertexCount:t.vertexCount,indices:i,attributes:r})}class lt{modules;moduleUniforms;moduleBindings;moduleUniformsChanged;constructor(e){const t=B(Object.values(e));n.log.log(1,"Creating ShaderInputs with modules",t.map((e=>e.name)))(),this.modules=e,this.moduleUniforms={},this.moduleBindings={};for(const[t,i]of Object.entries(e)){const e=t;this.moduleUniforms[e]=i.defaultUniforms||{},this.moduleBindings[e]={}}}destroy(){}setProps(e){for(const t of Object.keys(e)){const i=t,r=e[i],s=this.modules[i];if(!s){n.log.warn(`Module ${t} not found`)();continue}const a=this.moduleUniforms[i],o=s.getUniforms?.(r,this.moduleUniforms[i])||r;this.moduleUniforms[i]={...a,...o}}}getModules(){return Object.values(this.modules)}getUniformValues(){return this.moduleUniforms}getBindings(){const e={};for(const t of Object.values(this.moduleBindings))Object.assign(e,t);return e}getDebugTable(){const e={};for(const[t,i]of Object.entries(this.moduleUniforms))for(const[r,s]of Object.entries(i))e[`${t}.${r}`]={type:this.modules[t].uniformTypes?.[r],value:String(s)};return e}}class ht{static defaultProps={...n.RenderPipeline.defaultProps};device;_hashCounter=0;_hashes={};_renderPipelineCache={};_computePipelineCache={};static getDefaultPipelineFactory(e){return e._lumaData.defaultPipelineFactory=e._lumaData.defaultPipelineFactory||new ht(e),e._lumaData.defaultPipelineFactory}constructor(e){this.device=e}createRenderPipeline(e){const t={...n.RenderPipeline.defaultProps,...e},i=this._hashRenderPipeline(t);if(!this._renderPipelineCache[i]){const e=this.device.createRenderPipeline({...t,id:t.id?`${t.id}-cached`:void 0});e.hash=i,this._renderPipelineCache[i]={pipeline:e,useCount:0}}return this._renderPipelineCache[i].useCount++,this._renderPipelineCache[i].pipeline}createComputePipeline(e){const t={...n.ComputePipeline.defaultProps,...e},i=this._hashComputePipeline(t);if(!this._computePipelineCache[i]){const e=this.device.createComputePipeline({...t,id:t.id?`${t.id}-cached`:void 0});e.hash=i,this._computePipelineCache[i]={pipeline:e,useCount:0}}return this._computePipelineCache[i].useCount++,this._computePipelineCache[i].pipeline}release(e){const t=e.hash,i=e instanceof n.ComputePipeline?this._computePipelineCache:this._renderPipelineCache;i[t].useCount--,0===i[t].useCount&&(i[t].pipeline.destroy(),delete i[t])}_hashComputePipeline(e){return`${this._getHash(e.shader.source)}`}_hashRenderPipeline(e){const t=this._getHash(e.vs.source),i=e.fs?this._getHash(e.fs.source):0,r=this._getHash(JSON.stringify(e.bufferLayout));if("webgl"===this.device.type)return`${t}/${i}V-BL${r}`;{const s=this._getHash(JSON.stringify(e.parameters));return`${t}/${i}V-T${e.topology}P${s}BL${r}`}}_getHash(e){return void 0===this._hashes[e]&&(this._hashes[e]=this._hashCounter++),this._hashes[e]}}class ct{static defaultProps={...n.Shader.defaultProps};device;_cache={};static getDefaultShaderFactory(e){return e._lumaData.defaultShaderFactory||=new ct(e),e._lumaData.defaultShaderFactory}constructor(e){this.device=e}createShader(e){const t=this._hashShader(e);let i=this._cache[t];if(!i){const r=this.device.createShader({...e,id:e.id?`${e.id}-cached`:void 0});this._cache[t]=i={shader:r,useCount:0}}return i.useCount++,i.shader}release(e){const t=this._hashShader(e),i=this._cache[t];i&&(i.useCount--,0===i.useCount&&(delete this._cache[t],i.shader.destroy()))}_hashShader(e){return`${e.stage}:${e.source}`}}let gt=null,ut=null;class dt{static defaultProps={...n.RenderPipeline.defaultProps,source:null,vs:null,fs:null,id:"unnamed",handle:void 0,userData:{},defines:{},modules:[],moduleSettings:void 0,geometry:null,indexBuffer:null,attributes:{},constantAttributes:{},varyings:[],shaderInputs:void 0,pipelineFactory:void 0,shaderFactory:void 0,transformFeedback:void 0,shaderAssembler:F.getDefaultShaderAssembler(),debugShaders:void 0,disableWarnings:void 0};device;id;source;vs;fs;pipelineFactory;shaderFactory;userData={};parameters;topology;bufferLayout;vertexCount;instanceCount=0;indexBuffer=null;bufferAttributes={};constantAttributes={};bindings={};uniforms={};vertexArray;transformFeedback=null;pipeline;shaderInputs;_uniformStore;_attributeInfos={};_gpuGeometry=null;_getModuleUniforms;props;_pipelineNeedsUpdate="newly created";_needsRedraw="initializing";_destroyed=!1;_lastDrawTimestamp=-1;constructor(e,t){this.props={...dt.defaultProps,...t},t=this.props,this.id=t.id||n.uid("model"),this.device=e,Object.assign(this.userData,t.userData);const i=Object.fromEntries(this.props.modules?.map((e=>[e.name,e]))||[]);this.setShaderInputs(t.shaderInputs||new lt(i));const r=function(e){return{type:e.type,shaderLanguage:e.info.shadingLanguage,shaderLanguageVersion:e.info.shadingLanguageVersion,gpu:e.info.gpu,features:e.features}}(e),s=(this.props.modules?.length>0?this.props.modules:this.shaderInputs?.getModules())||[];if("webgpu"===this.device.type&&this.props.source){this.props.shaderLayout||=nt(this.props.source);const{source:e,getUniforms:t}=this.props.shaderAssembler.assembleShader({platformInfo:r,...this.props,modules:s});this.source=e,this._getModuleUniforms=t}else{const{vs:e,fs:t,getUniforms:i}=this.props.shaderAssembler.assembleShaderPair({platformInfo:r,...this.props,modules:s});this.vs=e,this.fs=t,this._getModuleUniforms=i}this.vertexCount=this.props.vertexCount,this.instanceCount=this.props.instanceCount,this.topology=this.props.topology,this.bufferLayout=this.props.bufferLayout,this.parameters=this.props.parameters,t.geometry&&this.setGeometry(t.geometry),this.pipelineFactory=t.pipelineFactory||ht.getDefaultPipelineFactory(this.device),this.shaderFactory=t.shaderFactory||ct.getDefaultShaderFactory(this.device),this.pipeline=this._updatePipeline(),this.vertexArray=e.createVertexArray({renderPipeline:this.pipeline}),this._gpuGeometry&&this._setGeometryAttributes(this._gpuGeometry),t.vertexCount&&this.setVertexCount(t.vertexCount),t.instanceCount&&this.setInstanceCount(t.instanceCount),t.indexBuffer&&this.setIndexBuffer(t.indexBuffer),t.attributes&&this.setAttributes(t.attributes),t.constantAttributes&&this.setConstantAttributes(t.constantAttributes),t.bindings&&this.setBindings(t.bindings),t.uniforms&&this.setUniforms(t.uniforms),t.moduleSettings&&this.updateModuleSettings(t.moduleSettings),t.transformFeedback&&(this.transformFeedback=t.transformFeedback),Object.seal(this)}destroy(){this._destroyed||(this.pipelineFactory.release(this.pipeline),this.shaderFactory.release(this.pipeline.vs),this.pipeline.fs&&this.shaderFactory.release(this.pipeline.fs),this._uniformStore.destroy(),this._gpuGeometry?.destroy(),this._destroyed=!0)}needsRedraw(){this._getBindingsUpdateTimestamp()>this._lastDrawTimestamp&&this.setNeedsRedraw("contents of bound textures or buffers updated");const e=this._needsRedraw;return this._needsRedraw=!1,e}setNeedsRedraw(e){this._needsRedraw||=e}predraw(){this.updateShaderInputs(),this.pipeline=this._updatePipeline()}draw(e){let t;this.predraw();try{this._logDrawCallStart(),this.pipeline=this._updatePipeline(),this.pipeline.setBindings(this.bindings,{disableWarnings:this.props.disableWarnings}),n.isObjectEmpty(this.uniforms)||this.pipeline.setUniformsWebGL(this.uniforms);const{indexBuffer:i}=this.vertexArray,r=i?i.byteLength/("uint32"===i.indexType?4:2):void 0;t=this.pipeline.draw({renderPass:e,vertexArray:this.vertexArray,vertexCount:this.vertexCount,instanceCount:this.instanceCount,indexCount:r,transformFeedback:this.transformFeedback||void 0,parameters:this.parameters,topology:this.topology})}finally{this._logDrawCallEnd()}return this._logFramebuffer(e),t?(this._lastDrawTimestamp=this.device.timestamp,this._needsRedraw=!1):this._needsRedraw="waiting for resource initialization",t}setGeometry(e){this._gpuGeometry?.destroy();const t=e&&At(this.device,e);t&&(this.setTopology(t.topology||"triangle-list"),this.bufferLayout=ft(t.bufferLayout,this.bufferLayout),this.vertexArray&&this._setGeometryAttributes(t)),this._gpuGeometry=t}setTopology(e){e!==this.topology&&(this.topology=e,this._setPipelineNeedsUpdate("topology"))}setBufferLayout(e){this.bufferLayout=this._gpuGeometry?ft(e,this._gpuGeometry.bufferLayout):e,this._setPipelineNeedsUpdate("bufferLayout"),this.pipeline=this._updatePipeline(),this.vertexArray=this.device.createVertexArray({renderPipeline:this.pipeline}),this._gpuGeometry&&this._setGeometryAttributes(this._gpuGeometry)}setParameters(e){n.deepEqual(e,this.parameters,2)||(this.parameters=e,this._setPipelineNeedsUpdate("parameters"))}setVertexCount(e){this.vertexCount=e,this.setNeedsRedraw("vertexCount")}setInstanceCount(e){this.instanceCount=e,this.setNeedsRedraw("instanceCount")}setShaderInputs(e){this.shaderInputs=e,this._uniformStore=new n.UniformStore(this.shaderInputs.modules);for(const e of Object.keys(this.shaderInputs.modules)){const t=this._uniformStore.getManagedUniformBuffer(this.device,e);this.bindings[`${e}Uniforms`]=t}this.setNeedsRedraw("shaderInputs")}updateShaderInputs(){this._uniformStore.setUniforms(this.shaderInputs.getUniformValues()),this.setNeedsRedraw("shaderInputs")}setBindings(e){Object.assign(this.bindings,e),this.setNeedsRedraw("bindings")}setTransformFeedback(e){this.transformFeedback=e,this.setNeedsRedraw("transformFeedback")}setIndexBuffer(e){this.vertexArray.setIndexBuffer(e),this.setNeedsRedraw("indexBuffer")}setAttributes(e,t){e.indices&&n.log.warn(`Model:${this.id} setAttributes() - indexBuffer should be set using setIndexBuffer()`)();for(const[i,r]of Object.entries(e)){const e=this.bufferLayout.find((e=>pt(e).includes(i)));if(!e){n.log.warn(`Model(${this.id}): Missing layout for buffer "${i}".`)();continue}const s=pt(e);let a=!1;for(const e of s){const t=this._attributeInfos[e];t&&(this.vertexArray.setBuffer(t.location,r),a=!0)}a||(t?.disableWarnings??this.props.disableWarnings)||n.log.warn(`Model(${this.id}): Ignoring buffer "${r.id}" for unknown attribute "${i}"`)()}this.setNeedsRedraw("attributes")}setConstantAttributes(e,t){for(const[i,r]of Object.entries(e)){const e=this._attributeInfos[i];e?this.vertexArray.setConstantWebGL(e.location,r):(t?.disableWarnings??this.props.disableWarnings)||n.log.warn(`Model "${this.id}: Ignoring constant supplied for unknown attribute "${i}"`)()}this.setNeedsRedraw("constants")}setUniforms(e){n.isObjectEmpty(e)||(this.pipeline.setUniformsWebGL(e),Object.assign(this.uniforms,e)),this.setNeedsRedraw("uniforms")}updateModuleSettings(e){const{bindings:t,uniforms:i}=n.splitUniformsAndBindings(this._getModuleUniforms(e));Object.assign(this.bindings,t),Object.assign(this.uniforms,i),this.setNeedsRedraw("moduleSettings")}_getBindingsUpdateTimestamp(){let e=0;for(const t of Object.values(this.bindings))t instanceof n.TextureView?e=Math.max(e,t.texture.updateTimestamp):t instanceof n.Buffer||t instanceof n.Texture?e=Math.max(e,t.updateTimestamp):t instanceof n.Sampler||(e=Math.max(e,t.buffer.updateTimestamp));return e}_setGeometryAttributes(e){const t={...e.attributes};for(const[e]of Object.entries(t))this.pipeline.shaderLayout.attributes.find((t=>t.name===e))||"positions"===e||delete t[e];this.vertexCount=e.vertexCount,this.setIndexBuffer(e.indices||null),this.setAttributes(e.attributes,{disableWarnings:!0}),this.setAttributes(t,{disableWarnings:this.props.disableWarnings}),this.setNeedsRedraw("geometry attributes")}_setPipelineNeedsUpdate(e){this._pipelineNeedsUpdate||=e,this.setNeedsRedraw(e)}_updatePipeline(){if(this._pipelineNeedsUpdate){let e=null,t=null;this.pipeline&&(n.log.log(1,`Model ${this.id}: Recreating pipeline because "${this._pipelineNeedsUpdate}".`)(),e=this.pipeline.vs,t=this.pipeline.fs),this._pipelineNeedsUpdate=!1;const i=this.shaderFactory.createShader({id:`${this.id}-vertex`,stage:"vertex",source:this.source||this.vs,debug:this.props.debugShaders});let r=null;this.source?r=i:this.fs&&(r=this.shaderFactory.createShader({id:`${this.id}-fragment`,stage:"fragment",source:this.source||this.fs,debug:this.props.debugShaders})),this.pipeline=this.pipelineFactory.createRenderPipeline({...this.props,bufferLayout:this.bufferLayout,topology:this.topology,parameters:this.parameters,vs:i,fs:r}),this._attributeInfos=n.getAttributeInfosFromLayouts(this.pipeline.shaderLayout,this.bufferLayout),e&&this.shaderFactory.release(e),t&&this.shaderFactory.release(t)}return this.pipeline}_lastLogTime=0;_logOpen=!1;_logDrawCallStart(){const e=n.log.level>3?0:1e4;n.log.level<2||Date.now()-this._lastLogTime<e||(this._lastLogTime=Date.now(),this._logOpen=!0,n.log.group(2,`>>> DRAWING MODEL ${this.id}`,{collapsed:n.log.level<=2})())}_logDrawCallEnd(){if(this._logOpen){const e=function(e,t){const i={},r="Values";if(0===e.attributes.length&&!e.varyings?.length)return{"No attributes or varyings":{[r]:"N/A"}};for(const t of e.attributes)t&&(i[`in ${t.location} ${t.name}: ${t.type}`]={[r]:t.stepMode||"vertex"});for(const t of e.varyings||[])i[`out ${t.location} ${t.name}`]={[r]:JSON.stringify(t.accessor)};return i}(this.pipeline.shaderLayout,this.id);n.log.table(2,e)();const t=this.shaderInputs.getDebugTable();for(const[e,i]of Object.entries(this.uniforms))t[e]={value:i};n.log.table(2,t)();const i=this._getAttributeDebugTable();n.log.table(2,this._attributeInfos)(),n.log.table(2,i)(),n.log.groupEnd(2)(),this._logOpen=!1}}_drawCount=0;_logFramebuffer(e){const t=n.log.get("framebuffer");if(this._drawCount++,!t||this._drawCount++>3&&this._drawCount%60)return;const i=e.props.framebuffer;i&&function(e,{id:t,minimap:i,opaque:r,top:s="0",left:n="0",rgbaScale:a=1}){gt||(gt=document.createElement("canvas"),gt.id=t,gt.title=t,gt.style.zIndex="100",gt.style.position="absolute",gt.style.top=s,gt.style.left=n,gt.style.border="blue 1px solid",gt.style.transform="scaleY(-1)",document.body.appendChild(gt),ut=gt.getContext("2d")),gt.width===e.width&&gt.height===e.height||(gt.width=e.width/2,gt.height=e.height/2,gt.style.width="400px",gt.style.height="400px");const o=e.device.readPixelsToArrayWebGL(e),A=ut.createImageData(e.width,e.height);for(let e=0;e<o.length;e+=4)A.data[0+e+0]=o[e+0]*a,A.data[0+e+1]=o[e+1]*a,A.data[0+e+2]=o[e+2]*a,A.data[0+e+3]=r?255:o[e+3]*a;ut.putImageData(A,0,0)}(i,{id:i.id,minimap:!0})}_getAttributeDebugTable(){const e={};for(const[t,i]of Object.entries(this._attributeInfos))e[i.location]={name:t,type:i.shaderType,values:this._getBufferOrConstantValues(this.vertexArray.attributes[i.location],i.bufferDataType)};if(this.vertexArray.indexBuffer){const{indexBuffer:t}=this.vertexArray,i="uint32"===t.indexType?new Uint32Array(t.debugData):new Uint16Array(t.debugData);e.indices={name:"indices",type:t.indexType,values:i.toString()}}return e}_getBufferOrConstantValues(e,t){const i=n.getTypedArrayFromDataType(t);return(e instanceof n.Buffer?new i(e.debugData):e).toString()}}function ft(e,t){const i=[...e];for(const e of t){const t=i.findIndex((t=>t.name===e.name));t<0?i.push(e):i[t]=e}return i}function pt(e){return e.attributes?e.attributes?.map((e=>e.attribute)):[e.name]}class It{id;topology;vertexCount;indices;attributes;userData={};constructor(e){const{attributes:t={},indices:i=null,vertexCount:r=null}=e;this.id=e.id||n.uid("geometry"),this.topology=e.topology,i&&(this.indices=ArrayBuffer.isView(i)?{value:i,size:1}:i),this.attributes={};for(const[e,i]of Object.entries(t)){const t=ArrayBuffer.isView(i)?{value:i}:i;n.assert(ArrayBuffer.isView(t.value),`${this._print(e)}: must be typed array or object with value as typed array`),"POSITION"!==e&&"positions"!==e||t.size||(t.size=3),"indices"===e?(n.assert(!this.indices),this.indices=t):this.attributes[e]=t}this.indices&&void 0!==this.indices.isIndexed&&(this.indices=Object.assign({},this.indices),delete this.indices.isIndexed),this.vertexCount=r||this._calculateVertexCount(this.attributes,this.indices)}getVertexCount(){return this.vertexCount}getAttributes(){return this.indices?{indices:this.indices,...this.attributes}:this.attributes}_print(e){return`Geometry ${this.id} attribute ${e}`}_setAttributes(e,t){return this}_calculateVertexCount(e,t){if(t)return t.value.length;let i=1/0;for(const t of Object.values(e)){const{value:e,size:r,constant:s}=t;!s&&e&&r>=1&&(i=Math.min(i,e.length/r))}return n.assert(Number.isFinite(i)),i}}function mt(e,t){const i=[1/0,1/0,-1/0,-1/0];for(const r of e){const e=r.getBounds();if(e){const s=r.projectPosition(e[0],{viewport:t,autoOffset:!1}),n=r.projectPosition(e[1],{viewport:t,autoOffset:!1});i[0]=Math.min(i[0],s[0]),i[1]=Math.min(i[1],s[1]),i[2]=Math.max(i[2],n[0]),i[3]=Math.max(i[3],n[1])}}return Number.isFinite(i[0])?i:null}function _t(t){const{bounds:i,viewport:r,border:s=0}=t,{isGeospatial:n}=r;if(i[2]<=i[0]||i[3]<=i[1])return null;const a=r.unprojectPosition([(i[0]+i[2])/2,(i[1]+i[3])/2,0]);let{width:o,height:A,zoom:l}=t;if(void 0===l){o-=2*s,A-=2*s;const e=Math.min(o/(i[2]-i[0]),A/(i[3]-i[1]));l=Math.min(Math.log2(e),20)}else if(!o||!A){const e=2**l;o=Math.round(Math.abs(i[2]-i[0])*e),A=Math.round(Math.abs(i[3]-i[1])*e);const t=2048-2*s;if(o>t||A>t){const e=t/Math.max(o,A);o=Math.round(o*e),A=Math.round(A*e),l+=Math.log2(e)}}return n?new e.WebMercatorViewport({id:r.id,x:s,y:s,width:o,height:A,longitude:a[0],latitude:a[1],zoom:l,orthographic:!0}):new e.OrthographicViewport({id:r.id,x:s,y:s,width:o,height:A,target:a,zoom:l,flipY:!1})}function wt(e,t,i){if(!e)return[0,0,1,1];const r=function(e,t){let i;if(t&&2===t.length){const[r,s]=t,n=e.getBounds({z:r}),a=e.getBounds({z:s});i=[Math.min(n[0],a[0]),Math.min(n[1],a[1]),Math.max(n[2],a[2]),Math.max(n[3],a[3])]}else i=e.getBounds();const r=e.projectPosition(i.slice(0,2)),s=e.projectPosition(i.slice(2,4));return[r[0],r[1],s[0],s[1]]}(t,i),s=function(e){const t=e[2]-e[0],i=e[3]-e[1],r=(e[0]+e[2])/2,s=(e[1]+e[3])/2;return[r-t,s-i,r+t,s+i]}(r);return e[2]-e[0]<=s[2]-s[0]&&e[3]-e[1]<=s[3]-s[1]?e:[Math.max(e[0],s[0]),Math.max(e[1],s[1]),Math.min(e[2],s[2]),Math.min(e[3],s[3])]}const Ct={NONE:0,WRITE_HEIGHT_MAP:1,USE_HEIGHT_MAP:2,USE_COVER:3,USE_COVER_ONLY:4,SKIP:5},Bt=Object.keys(Ct).map((e=>`const float TERRAIN_MODE_${e} = ${Ct[e]}.0;`)).join("\n"),Et={name:"terrain",dependencies:[e.project],inject:{"vs:#decl":"\nuniform float terrain_mode;\nuniform sampler2D terrain_map;\nuniform vec4 terrain_bounds;\nout vec3 commonPos;\n"+Bt,"vs:#main-start":"\nif (terrain_mode == TERRAIN_MODE_SKIP) {\ngl_Position = vec4(0.0);\nreturn;\n}\n","vs:DECKGL_FILTER_GL_POSITION":"\ncommonPos = geometry.position.xyz;\nif (terrain_mode == TERRAIN_MODE_WRITE_HEIGHT_MAP) {\nvec2 texCoords = (commonPos.xy - terrain_bounds.xy) / terrain_bounds.zw;\nposition = vec4(texCoords * 2.0 - 1.0, 0.0, 1.0);\ncommonPos.z += project_uCommonOrigin.z;\n}\nif (terrain_mode == TERRAIN_MODE_USE_HEIGHT_MAP) {\nvec3 anchor = geometry.worldPosition;\nanchor.z = 0.0;\nvec3 anchorCommon = project_position(anchor);\nvec2 texCoords = (anchorCommon.xy - terrain_bounds.xy) / terrain_bounds.zw;\nif (texCoords.x >= 0.0 && texCoords.y >= 0.0 && texCoords.x <= 1.0 && texCoords.y <= 1.0) {\nfloat terrainZ = texture(terrain_map, texCoords).r;\ngeometry.position.z += terrainZ;\nposition = project_common_position_to_clipspace(geometry.position);\n}\n}\n","fs:#decl":"\nuniform float terrain_mode;\nuniform sampler2D terrain_map;\nuniform vec4 terrain_bounds;\nin vec3 commonPos;\n"+Bt,"fs:#main-start":"\nif (terrain_mode == TERRAIN_MODE_WRITE_HEIGHT_MAP) {\nfragColor = vec4(commonPos.z, 0.0, 0.0, 1.0);\nreturn;\n}\n","fs:DECKGL_FILTER_COLOR":"\nif ((terrain_mode == TERRAIN_MODE_USE_COVER) || (terrain_mode == TERRAIN_MODE_USE_COVER_ONLY)) {\nvec2 texCoords = (commonPos.xy - terrain_bounds.xy) / terrain_bounds.zw;\nvec4 pixel = texture(terrain_map, texCoords);\nif (terrain_mode == TERRAIN_MODE_USE_COVER_ONLY) {\ncolor = pixel;\n} else {\ncolor = pixel + color * (1.0 - pixel.a);\n}\nreturn;\n}\n"},getUniforms:(e={},t)=>{if("dummyHeightMap"in e){const{drawToTerrainHeightMap:i,heightMap:r,heightMapBounds:s,dummyHeightMap:n,terrainCover:a,useTerrainHeightMap:o,terrainSkipRender:A}=e,{project_uCommonOrigin:l}=t;let h=A?Ct.SKIP:Ct.NONE,c=n,g=null;if(i)h=Ct.WRITE_HEIGHT_MAP,g=s;else if(o&&r)h=Ct.USE_HEIGHT_MAP,c=r,g=s;else if(a){const t=e.picking?.isActive,i=t?a.getPickingFramebuffer():a.getRenderFramebuffer();c=i?.colorAttachments[0].texture,t&&(h=Ct.SKIP),c?(h=h===Ct.SKIP?Ct.USE_COVER_ONLY:Ct.USE_COVER,g=a.bounds):c=n}return{terrain_mode:h,terrain_map:c,terrain_bounds:g?[g[0]-l[0],g[1]-l[1],g[2]-g[0],g[3]-g[1]]:[0,0,0,0]}}return null}};function yt(e,t){return e.createFramebuffer({id:t.id,colorAttachments:[e.createTexture({id:t.id,...t.float&&{format:"rgba32float",type:5126},mipmaps:!1,sampler:{minFilter:"linear",magFilter:"linear",addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge"}})]})}class Qt{constructor(e){this.isDirty=!0,this.renderViewport=null,this.bounds=null,this.layers=[],this.targetBounds=null,this.targetBoundsCommon=null,this.targetLayer=e,this.tile=bt(e)}get id(){return this.targetLayer.id}get isActive(){return Boolean(this.targetLayer.getCurrentLayer())}shouldUpdate({targetLayer:e,viewport:t,layers:i,layerNeedsRedraw:r}){e&&(this.targetLayer=e);const s=!!t&&this._updateViewport(t);let n=!!i&&this._updateLayers(i);if(r)for(const e of this.layers)if(r[e]){n=!0;break}return n||s}_updateLayers(e){let t=!1;if((e=this.tile?function(e,t){return t.filter((t=>{const i=bt(t);return!i||function(e,t){if(e&&t)return e[0][0]<t[1][0]&&t[0][0]<e[1][0]&&e[0][1]<t[1][1]&&t[0][1]<e[1][1];return!1}(e.boundingBox,i.boundingBox)}))}(this.tile,e):e).length!==this.layers.length)t=!0;else for(let i=0;i<e.length;i++){if(e[i].id!==this.layers[i]){t=!0;break}}return t&&(this.layers=e.map((e=>e.id))),t}_updateViewport(e){const t=this.targetLayer;let i=!1;if(this.tile&&"boundingBox"in this.tile){if(!this.targetBounds){i=!0,this.targetBounds=this.tile.boundingBox;const t=e.projectPosition(this.targetBounds[0]),r=e.projectPosition(this.targetBounds[1]);this.targetBoundsCommon=[t[0],t[1],r[0],r[1]]}}else this.targetBounds!==t.getBounds()&&(i=!0,this.targetBounds=t.getBounds(),this.targetBoundsCommon=mt([t],e));if(!this.targetBoundsCommon)return!1;const r=Math.ceil(e.zoom+.5);if(this.tile)this.bounds=this.targetBoundsCommon;else{const t=this.renderViewport?.zoom;i=i||r!==t;const s=wt(this.targetBoundsCommon,e),n=this.bounds;i=i||!n||s.some(((e,t)=>e!==n[t])),this.bounds=s}return i&&(this.renderViewport=_t({bounds:this.bounds,zoom:r,viewport:e})),i}getRenderFramebuffer(){return this.renderViewport&&0!==this.layers.length?(this.fbo||(this.fbo=yt(this.targetLayer.context.device,{id:this.id})),this.fbo):null}getPickingFramebuffer(){return!this.renderViewport||0===this.layers.length&&!this.targetLayer.props.pickable?null:(this.pickingFbo||(this.pickingFbo=yt(this.targetLayer.context.device,{id:`${this.id}-picking`})),this.pickingFbo)}filterLayers(e){return e.filter((({id:e})=>this.layers.includes(e)))}delete(){const{fbo:e,pickingFbo:t}=this;e&&(e.colorAttachments[0].destroy(),e.destroy()),t&&(t.colorAttachments[0].destroy(),t.destroy())}}function bt(e){for(;e;){const{tile:t}=e.props;if(t)return t;e=e.parent}return null}const kt={blendColorOperation:"max",blendColorSrcFactor:"one",blendColorDstFactor:"one",blendAlphaOperation:"max",blendAlphaSrcFactor:"one",blendAlphaDstFactor:"one"};class xt extends e._LayersPass{getRenderableLayers(e,t){const{layers:i}=t,r=[],s=this._getDrawLayerParams(e,t,!0);for(let e=0;e<i.length;e++){const t=i[e];!t.isComposite&&s[e].shouldDrawLayer&&r.push(t)}return r}renderHeightMap(e,t){const i=e.getRenderFramebuffer(),r=e.renderViewport;i&&r&&(i.resize(r),this.render({...t,target:i,pass:"terrain-height-map",layers:t.layers,viewports:[r],effects:[],clearColor:[0,0,0,0]}))}renderTerrainCover(e,t){const i=e.getRenderFramebuffer(),r=e.renderViewport;if(!i||!r)return;const s=e.filterLayers(t.layers);i.resize(r),this.render({...t,target:i,pass:`terrain-cover-${e.id}`,layers:s,effects:[],viewports:[r],clearColor:[0,0,0,0]})}getLayerParameters(e,t,i){return{...e.props.parameters,blend:!0,depthTest:!1,...e.props.operation.includes("terrain")&&kt}}}class vt extends e._PickLayersPass{constructor(){super(...arguments),this.drawParameters={}}getRenderableLayers(e,t){const{layers:i}=t,r=[];this.drawParameters={},this._resetColorEncoder(t.pickZ);const s=this._getDrawLayerParams(e,t);for(let e=0;e<i.length;e++){const t=i[e];!t.isComposite&&s[e].shouldDrawLayer&&(r.push(t),this.drawParameters[t.id]=s[e].layerParameters)}return r}renderTerrainCover(e,t){const i=e.getPickingFramebuffer(),r=e.renderViewport;if(!i||!r)return;const s=e.filterLayers(t.layers),n=e.targetLayer;n.props.pickable&&s.unshift(n),i.resize(r),this.render({...t,pickingFBO:i,pass:`terrain-cover-picking-${e.id}`,layers:s,effects:[],viewports:[r],cullRect:void 0,deviceRect:r,pickZ:!1})}getLayerParameters(e,t,i){let r;return this.drawParameters[e.id]?r=this.drawParameters[e.id]:(r=super.getLayerParameters(e,t,i),r.blend=!0),{...r,depthTest:!1}}}class Dt{static isSupported(e){return e.isTextureFormatRenderable("rgba32float")}constructor(e){this.renderViewport=null,this.bounds=null,this.layers=[],this.layersBounds=[],this.layersBoundsCommon=null,this.lastViewport=null,this.device=e}getRenderFramebuffer(){return this.renderViewport?(this.fbo||(this.fbo=yt(this.device,{id:"height-map",float:!0})),this.fbo):null}shouldUpdate({layers:e,viewport:t}){const i=e.length!==this.layers.length||e.some(((e,t)=>e!==this.layers[t]||e.props.transitions||e.getBounds()!==this.layersBounds[t]));i&&(this.layers=e,this.layersBounds=e.map((e=>e.getBounds())),this.layersBoundsCommon=mt(e,t));const r=!this.lastViewport||!t.equals(this.lastViewport);if(this.layersBoundsCommon){if(i||r){const e=wt(this.layersBoundsCommon,t);if(e[2]<=e[0]||e[3]<=e[1])return this.renderViewport=null,!1;this.bounds=e,this.lastViewport=t;const i=t.scale,r=(e[2]-e[0])*i,s=(e[3]-e[1])*i;return this.renderViewport=r>0||s>0?_t({bounds:[t.center[0]-1,t.center[1]-1,t.center[0]+1,t.center[1]+1],zoom:t.zoom,width:Math.min(r,2048),height:Math.min(s,2048),viewport:t}):null,!0}}else this.renderViewport=null;return!1}delete(){this.fbo&&(this.fbo.colorAttachments[0].delete(),this.fbo.delete())}}class St{constructor(){this.id="terrain-effect",this.props=null,this.useInPicking=!0,this.isPicking=!1,this.isDrapingEnabled=!1,this.terrainCovers=new Map}setup({device:t,deck:i}){this.dummyHeightMap=t.createTexture({width:1,height:1,data:new Uint8Array([0,0,0,0])}),this.terrainPass=new xt(t,{id:"terrain"}),this.terrainPickingPass=new vt(t,{id:"terrain-picking"}),Dt.isSupported(t)?this.heightMap=new Dt(t):e.log.warn("Terrain offset mode is not supported by this browser")(),i._addDefaultShaderModule(Et)}preRender(e){if(e.pickZ)return void(this.isDrapingEnabled=!1);const{viewports:t}=e,i=e.pass.startsWith("picking");this.isPicking=i,this.isDrapingEnabled=!0;const r=t[0],s=(i?this.terrainPickingPass:this.terrainPass).getRenderableLayers(r,e),n=s.filter((e=>e.props.operation.includes("terrain")));if(0===n.length)return;if(!i){s.filter((e=>"offset"===e.state.terrainDrawMode)).length>0&&this._updateHeightMap(n,r,e)}const a=s.filter((e=>"drape"===e.state.terrainDrawMode));this._updateTerrainCovers(n,a,r,e)}getModuleParameters(e){const{terrainDrawMode:t}=e.state;return{heightMap:this.heightMap?.getRenderFramebuffer()?.colorAttachments[0].texture||null,heightMapBounds:this.heightMap?.bounds,dummyHeightMap:this.dummyHeightMap,terrainCover:this.isDrapingEnabled?this.terrainCovers.get(e.id):null,useTerrainHeightMap:"offset"===t,terrainSkipRender:"drape"===t||!e.props.operation.includes("draw")}}cleanup({deck:e}){this.dummyHeightMap&&(this.dummyHeightMap.delete(),this.dummyHeightMap=void 0),this.heightMap&&(this.heightMap.delete(),this.heightMap=void 0);for(const e of this.terrainCovers.values())e.delete();this.terrainCovers.clear(),e._removeDefaultShaderModule(Et)}_updateHeightMap(e,t,i){if(!this.heightMap)return;this.heightMap.shouldUpdate({layers:e,viewport:t})&&this.terrainPass.renderHeightMap(this.heightMap,{...i,layers:e,moduleParameters:{heightMapBounds:this.heightMap.bounds,dummyHeightMap:this.dummyHeightMap,devicePixelRatio:1,drawToTerrainHeightMap:!0}})}_updateTerrainCovers(e,t,i,r){const s={};for(const e of t)e.state.terrainCoverNeedsRedraw&&(s[e.id]=!0,e.state.terrainCoverNeedsRedraw=!1);for(const e of this.terrainCovers.values())e.isDirty=e.isDirty||e.shouldUpdate({layerNeedsRedraw:s});for(const s of e)this._updateTerrainCover(s,t,i,r);this.isPicking||this._pruneTerrainCovers()}_updateTerrainCover(e,t,i,r){const s=this.isPicking?this.terrainPickingPass:this.terrainPass;let n=this.terrainCovers.get(e.id);n||(n=new Qt(e),this.terrainCovers.set(e.id,n));try{const a=n.shouldUpdate({targetLayer:e,viewport:i,layers:t});(this.isPicking||n.isDirty||a)&&(s.renderTerrainCover(n,{...r,layers:t,moduleParameters:{dummyHeightMap:this.dummyHeightMap,terrainSkipRender:!1,devicePixelRatio:1}}),this.isPicking||(n.isDirty=!1))}catch(t){e.raiseError(t,`Error rendering terrain cover ${n.id}`)}}_pruneTerrainCovers(){const e=[];for(const[t,i]of this.terrainCovers)i.isActive||e.push(t);for(const t of e)this.terrainCovers.delete(t)}}const Mt={terrainDrawMode:void 0};class Ut extends e.LayerExtension{static{this.defaultProps=Mt}static{this.extensionName="TerrainExtension"}getShaders(){return{modules:[Et]}}initializeState(){this.context.deck?._addDefaultEffect(new St)}updateState(e){const{props:t,oldProps:i}=e;if(this.state.terrainDrawMode&&t.terrainDrawMode===i.terrainDrawMode&&t.extruded===i.extruded)return;let{terrainDrawMode:r}=t;if(!r){const e=this.props.extruded,t=this.getAttributeManager()?.attributes;r=e||t&&"instancePositions"in t?"offset":"drape"}this.setState({terrainDrawMode:r})}onNeedsRedraw(){const e=this.state;"drape"===e.terrainDrawMode&&(e.terrainCoverNeedsRedraw=!0)}}var Tt,Gt,Lt,Rt,Ft,Nt,Ot,Pt,zt,qt,Kt,Ht,Vt,Jt;!function(e){e[e.Big=19789]="Big",e[e.Little=18761]="Little"}(Tt||(Tt={})),function(e){e[e.ReducedImage=1]="ReducedImage",e[e.Page=2]="Page",e[e.Mask=4]="Mask"}(Gt||(Gt={})),function(e){e[e.TopLeft=1]="TopLeft",e[e.TopRight=2]="TopRight",e[e.BottomRight=3]="BottomRight",e[e.BottomLeft=4]="BottomLeft",e[e.LeftTop=5]="LeftTop",e[e.RightTOP=6]="RightTOP",e[e.RightBottom=7]="RightBottom",e[e.LeftBottom=8]="LeftBottom"}(Lt||(Lt={})),function(e){e[e.PixelIsArea=1]="PixelIsArea",e[e.PixelIsPoint=2]="PixelIsPoint"}(Rt||(Rt={})),function(e){e[e.Unknown=0]="Unknown",e[e.Projected=1]="Projected",e[e.Geographic=2]="Geographic",e[e.Geocentric=3]="Geocentric",e[e.UserDefined=32767]="UserDefined"}(Ft||(Ft={})),function(e){e[e.Image=1]="Image",e[e.ReducedImage=2]="ReducedImage",e[e.Page=3]="Page"}(Nt||(Nt={})),function(e){e[e.None=1]="None",e[e.Lzw=5]="Lzw",e[e.Jpeg6=6]="Jpeg6",e[e.Jpeg=7]="Jpeg",e[e.DeflateOther=8]="DeflateOther",e[e.Deflate=32946]="Deflate",e[e.Jp2000=3417]="Jp2000",e[e.Lerc=34887]="Lerc",e[e.Lzma=34925]="Lzma",e[e.Zstd=5e4]="Zstd",e[e.Webp=50001]="Webp",e[e.JpegXl=50002]="JpegXl"}(Ot||(Ot={})),function(e){e[e.Contig=1]="Contig",e[e.Separate=2]="Separate"}(Pt||(Pt={})),function(e){e[e.Uint=1]="Uint",e[e.Int=2]="Int",e[e.Float=3]="Float",e[e.Void=4]="Void",e[e.ComplexInt=5]="ComplexInt",e[e.ComplexFloat=6]="ComplexFloat"}(zt||(zt={})),function(e){e[e.MinIsWhite=0]="MinIsWhite",e[e.MinIsBlack=1]="MinIsBlack",e[e.Rgb=2]="Rgb",e[e.Palette=3]="Palette",e[e.Mask=4]="Mask",e[e.Separated=5]="Separated",e[e.Ycbcr=6]="Ycbcr",e[e.Cielab=8]="Cielab",e[e.Icclab=9]="Icclab",e[e.Itulab=10]="Itulab",e[e.Cfa=32803]="Cfa",e[e.Logl=32844]="Logl",e[e.Logluv=32845]="Logluv"}(qt||(qt={})),function(e){e[e.SubFileType=254]="SubFileType",e[e.OldSubFileType=255]="OldSubFileType",e[e.ImageWidth=256]="ImageWidth",e[e.ImageHeight=257]="ImageHeight",e[e.BitsPerSample=258]="BitsPerSample",e[e.SampleFormat=339]="SampleFormat",e[e.Compression=259]="Compression",e[e.Photometric=262]="Photometric",e[e.TileWidth=322]="TileWidth",e[e.TileHeight=323]="TileHeight",e[e.TileOffsets=324]="TileOffsets",e[e.TileByteCounts=325]="TileByteCounts",e[e.JpegTables=347]="JpegTables",e[e.StripOffsets=273]="StripOffsets",e[e.StripByteCounts=279]="StripByteCounts",e[e.GdalMetadata=42112]="GdalMetadata",e[e.GdalNoData=42113]="GdalNoData",e[e.ModelPixelScale=33550]="ModelPixelScale",e[e.ModelTiePoint=33922]="ModelTiePoint",e[e.ModelTransformation=34744]="ModelTransformation",e[e.GeoKeyDirectory=34735]="GeoKeyDirectory",e[e.GeoDoubleParams=34736]="GeoDoubleParams",e[e.GeoAsciiParams=34737]="GeoAsciiParams",e[e.LercParameters=50674]="LercParameters",e[e.PlanarConfiguration=284]="PlanarConfiguration",e[e.CellLength=265]="CellLength",e[e.CellWidth=264]="CellWidth",e[e.ColorMap=320]="ColorMap",e[e.Copyright=33432]="Copyright",e[e.DateTime=306]="DateTime",e[e.ExtraSamples=338]="ExtraSamples",e[e.FillOrder=266]="FillOrder",e[e.FreeByteCounts=289]="FreeByteCounts",e[e.FreeOffsets=288]="FreeOffsets",e[e.GrayResponseCurve=291]="GrayResponseCurve",e[e.GrayResponseUnit=290]="GrayResponseUnit",e[e.HostComputer=316]="HostComputer",e[e.ImageDescription=270]="ImageDescription",e[e.Make=271]="Make",e[e.MaxSampleValue=281]="MaxSampleValue",e[e.MinSampleValue=280]="MinSampleValue",e[e.Model=272]="Model",e[e.Orientation=274]="Orientation",e[e.ResolutionUnit=296]="ResolutionUnit",e[e.RowsPerStrip=278]="RowsPerStrip",e[e.SamplesPerPixel=277]="SamplesPerPixel",e[e.Software=305]="Software",e[e.Threshholding=263]="Threshholding",e[e.XResolution=282]="XResolution",e[e.YResolution=283]="YResolution",e[e.BadFaxLines=326]="BadFaxLines",e[e.CleanFaxData=327]="CleanFaxData",e[e.ClipPath=343]="ClipPath",e[e.ConsecutiveBadFaxLines=328]="ConsecutiveBadFaxLines",e[e.Decode=433]="Decode",e[e.DefaultImageColor=434]="DefaultImageColor",e[e.DocumentName=269]="DocumentName",e[e.DotRange=336]="DotRange",e[e.HalftoneHints=321]="HalftoneHints",e[e.Indexed=346]="Indexed",e[e.PageName=285]="PageName",e[e.PageNumber=297]="PageNumber",e[e.Predictor=317]="Predictor",e[e.PrimaryChromaticities=319]="PrimaryChromaticities",e[e.ReferenceBlackWhite=532]="ReferenceBlackWhite",e[e.SMinSampleValue=340]="SMinSampleValue",e[e.SMaxSampleValue=341]="SMaxSampleValue",e[e.StripRowCounts=559]="StripRowCounts",e[e.SubIFDs=330]="SubIFDs",e[e.T4Options=292]="T4Options",e[e.T6Options=293]="T6Options",e[e.TransferFunction=301]="TransferFunction",e[e.WhitePoint=318]="WhitePoint",e[e.XClipPathUnits=344]="XClipPathUnits",e[e.XPosition=286]="XPosition",e[e.YCbCrCoefficients=529]="YCbCrCoefficients",e[e.YCbCrPositioning=531]="YCbCrPositioning",e[e.YCbCrSubSampling=530]="YCbCrSubSampling",e[e.YClipPathUnits=345]="YClipPathUnits",e[e.YPosition=287]="YPosition",e[e.ApertureValue=37378]="ApertureValue",e[e.ColorSpace=40961]="ColorSpace",e[e.DateTimeDigitized=36868]="DateTimeDigitized",e[e.DateTimeOriginal=36867]="DateTimeOriginal",e[e.ExifIFD=34665]="ExifIFD",e[e.ExifVersion=36864]="ExifVersion",e[e.ExposureTime=33434]="ExposureTime",e[e.FileSource=41728]="FileSource",e[e.Flash=37385]="Flash",e[e.FlashpixVersion=40960]="FlashpixVersion",e[e.FNumber=33437]="FNumber",e[e.ImageUniqueID=42016]="ImageUniqueID",e[e.LightSource=37384]="LightSource",e[e.MakerNote=37500]="MakerNote",e[e.ShutterSpeedValue=37377]="ShutterSpeedValue",e[e.UserComment=37510]="UserComment",e[e.IPTC=33723]="IPTC",e[e.ICCProfile=34675]="ICCProfile",e[e.XMP=700]="XMP"}(Kt||(Kt={})),function(e){e[e.GTModelTypeGeoKey=1024]="GTModelTypeGeoKey",e[e.GTRasterTypeGeoKey=1025]="GTRasterTypeGeoKey",e[e.GTCitationGeoKey=1026]="GTCitationGeoKey",e[e.GeodeticCRSGeoKey=2048]="GeodeticCRSGeoKey",e[e.GeodeticCitationGeoKey=2049]="GeodeticCitationGeoKey",e[e.GeodeticDatumGeoKey=2050]="GeodeticDatumGeoKey",e[e.PrimeMeridianGeoKey=2051]="PrimeMeridianGeoKey",e[e.GeogLinearUnitsGeoKey=2052]="GeogLinearUnitsGeoKey",e[e.GeogLinearUnitSizeGeoKey=2053]="GeogLinearUnitSizeGeoKey",e[e.GeogAngularUnitsGeoKey=2054]="GeogAngularUnitsGeoKey",e[e.GeogAngularUnitSizeGeoKey=2055]="GeogAngularUnitSizeGeoKey",e[e.EllipsoidGeoKey=2056]="EllipsoidGeoKey",e[e.EllipsoidSemiMajorAxisGeoKey=2057]="EllipsoidSemiMajorAxisGeoKey",e[e.EllipsoidSemiMinorAxisGeoKey=2058]="EllipsoidSemiMinorAxisGeoKey",e[e.EllipsoidInvFlatteningGeoKey=2059]="EllipsoidInvFlatteningGeoKey",e[e.PrimeMeridianLongitudeGeoKey=2061]="PrimeMeridianLongitudeGeoKey",e[e.GeogTOWGS84GeoKey=2062]="GeogTOWGS84GeoKey",e[e.GeogAzimuthUnitsGeoKey=2060]="GeogAzimuthUnitsGeoKey",e[e.ProjectedCRSGeoKey=3072]="ProjectedCRSGeoKey",e[e.ProjectedCitationGeoKey=3073]="ProjectedCitationGeoKey",e[e.ProjectionGeoKey=3074]="ProjectionGeoKey",e[e.ProjMethodGeoKey=3075]="ProjMethodGeoKey",e[e.ProjLinearUnitsGeoKey=3076]="ProjLinearUnitsGeoKey",e[e.ProjLinearUnitSizeGeoKey=3077]="ProjLinearUnitSizeGeoKey",e[e.ProjStdParallel1GeoKey=3078]="ProjStdParallel1GeoKey",e[e.ProjStdParallel2GeoKey=3079]="ProjStdParallel2GeoKey",e[e.ProjNatOriginLongGeoKey=3080]="ProjNatOriginLongGeoKey",e[e.ProjNatOriginLatGeoKey=3081]="ProjNatOriginLatGeoKey",e[e.ProjFalseEastingGeoKey=3082]="ProjFalseEastingGeoKey",e[e.ProjFalseNorthingGeoKey=3083]="ProjFalseNorthingGeoKey",e[e.ProjFalseOriginLongGeoKey=3084]="ProjFalseOriginLongGeoKey",e[e.ProjFalseOriginLatGeoKey=3085]="ProjFalseOriginLatGeoKey",e[e.ProjFalseOriginEastingGeoKey=3086]="ProjFalseOriginEastingGeoKey",e[e.ProjFalseOriginNorthingGeoKey=3087]="ProjFalseOriginNorthingGeoKey",e[e.ProjCenterLongGeoKey=3088]="ProjCenterLongGeoKey",e[e.ProjCenterLatGeoKey=3089]="ProjCenterLatGeoKey",e[e.ProjCenterEastingGeoKey=3090]="ProjCenterEastingGeoKey",e[e.ProjCenterNorthingGeoKey=3091]="ProjCenterNorthingGeoKey",e[e.ProjScaleAtNatOriginGeoKey=3092]="ProjScaleAtNatOriginGeoKey",e[e.ProjScaleAtCenterGeoKey=3093]="ProjScaleAtCenterGeoKey",e[e.ProjAzimuthAngleGeoKey=3094]="ProjAzimuthAngleGeoKey",e[e.ProjStraightVertPoleLongGeoKey=3095]="ProjStraightVertPoleLongGeoKey",e[e.ProjRectifiedGridAngleGeoKey=3096]="ProjRectifiedGridAngleGeoKey",e[e.VerticalGeoKey=4096]="VerticalGeoKey",e[e.VerticalCitationGeoKey=4097]="VerticalCitationGeoKey",e[e.VerticalDatumGeoKey=4098]="VerticalDatumGeoKey",e[e.VerticalUnitsGeoKey=4099]="VerticalUnitsGeoKey"}(Ht||(Ht={})),function(e){e[e.Radian=9101]="Radian",e[e.Degree=9102]="Degree",e[e.ArcMinute=9103]="ArcMinute",e[e.ArcDegree=9104]="ArcDegree",e[e.Grad=9105]="Grad",e[e.Gon=9106]="Gon",e[e.Dms=9107]="Dms"}(Vt||(Vt={})),function(e){e[e.Metre=9001]="Metre",e[e.Foot=9002]="Foot",e[e.FootUsSurvey=9003]="FootUsSurvey",e[e.FootModifiedAmerican=9004]="FootModifiedAmerican",e[e.FootClarke=9005]="FootClarke",e[e.FootIndian=9006]="FootIndian",e[e.Link=9007]="Link",e[e.LinkBenoit=9008]="LinkBenoit",e[e.LinkSears=9009]="LinkSears",e[e.ChainBenoit=9010]="ChainBenoit",e[e.ChainSears=9011]="ChainSears",e[e.YardSears=9012]="YardSears",e[e.YardIndian=9013]="YardIndian",e[e.Fathom=9014]="Fathom",e[e.MileInternationalNautical=9015]="MileInternationalNautical"}(Jt||(Jt={}));const Yt={[Kt.TileByteCounts]:!0,[Kt.TileOffsets]:!0,[Kt.StripOffsets]:!0,[Kt.StripByteCounts]:!0,[Kt.BitsPerSample]:!0,[Kt.SampleFormat]:!0,[Kt.GeoKeyDirectory]:!0,[Kt.GeoDoubleParams]:!0};var jt;!function(e){e.None="application/octet-stream",e.Jpeg="image/jpeg",e.Jp2000="image/jp2",e.JpegXl="image/jpegxl",e.Webp="image/webp",e.Zstd="application/zstd",e.Lzw="application/lzw",e.Deflate="application/deflate",e.Lerc="application/lerc",e.Lzma="application/x-lzma"}(jt||(jt={}));const Zt={[Ot.None]:jt.None,[Ot.Lzw]:jt.Lzw,[Ot.Jpeg6]:jt.Jpeg,[Ot.Jpeg]:jt.Jpeg,[Ot.DeflateOther]:jt.Deflate,[Ot.Deflate]:jt.Deflate,[Ot.Lerc]:jt.Lerc,[Ot.Lzma]:jt.Lzma,[Ot.Jp2000]:jt.Jp2000,[Ot.Zstd]:jt.Zstd,[Ot.Webp]:jt.Webp,[Ot.JpegXl]:jt.JpegXl};var Wt,Xt,$t,ei;function ti(e){switch(e){case Wt.Uint8:case Wt.Ascii:case Wt.Int8:case Wt.Undefined:return 1;case Wt.Uint16:case Wt.Int16:return 2;case Wt.Uint32:case Wt.Int32:case Wt.Float32:return 4;case Wt.Rational:case Wt.SignedRational:case Wt.Float64:case Wt.Uint64:case Wt.Int64:case Wt.Ifd8:return 8;default:throw new Error(`Invalid fieldType ${e}`)}}!function(e){e[e.Uint8=1]="Uint8",e[e.Ascii=2]="Ascii",e[e.Uint16=3]="Uint16",e[e.Uint32=4]="Uint32",e[e.Rational=5]="Rational",e[e.Int8=6]="Int8",e[e.Undefined=7]="Undefined",e[e.Int16=8]="Int16",e[e.Int32=9]="Int32",e[e.SignedRational=10]="SignedRational",e[e.Float32=11]="Float32",e[e.Float64=12]="Float64",e[e.Uint64=16]="Uint64",e[e.Int64=17]="Int64",e[e.Ifd8=18]="Ifd8"}(Wt||(Wt={})),function(e){e[e.BigTiff=43]="BigTiff",e[e.Tiff=42]="Tiff"}(Xt||(Xt={})),function(e){e[e.Double=8]="Double",e[e.Float32=4]="Float32"}($t||($t={})),function(e){e[e.UInt64=8]="UInt64",e[e.UInt32=4]="UInt32",e[e.UInt16=2]="UInt16",e[e.UInt8=1]="UInt8"}(ei||(ei={}));const ii=2**32;function ri(e,t,i){const r=e.getUint32(t,i),s=e.getUint32(t+4,i),n=i?r+ii*s:ii*r+s;if(!Number.isSafeInteger(n))throw new Error(n+" exceeds MAX_SAFE_INTEGER. Precision may is lost");return n}function si(e,t,i,r){switch(i){case ei.UInt8:return e.getUint8(t);case ei.UInt16:return e.getUint16(t,r);case ei.UInt32:return e.getUint32(t,r);case ei.UInt64:return ri(e,t,r)}}function ni(e,t,i){return!(t<e.sourceOffset)&&!(e.sourceOffset+e.byteLength<t+i)}function ai(e,t,i,r){switch(e){case Wt.Ascii:return String.fromCharCode(t.getUint8(i));case Wt.Undefined:case Wt.Uint8:return t.getUint8(i);case Wt.Int8:return t.getInt8(i);case Wt.Uint16:return t.getUint16(i,r);case Wt.Int16:return t.getInt16(i,r);case Wt.Uint32:return t.getUint32(i,r);case Wt.Int32:return t.getInt32(i,r);case Wt.Rational:return[t.getUint32(i,r),t.getUint32(i+4,r)];case Wt.SignedRational:return[t.getInt32(i,r),t.getInt32(i+4,r)];case Wt.Float64:return t.getFloat64(i,r);case Wt.Float32:return t.getFloat32(i,r);case Wt.Uint64:return ri(t,i,r);default:throw new Error(`Unknown read type "${e}" "${Wt[e]}"`)}}function oi(e,t,i,r,s,n){const a=ti(s),o=n*a;if(1===n){const n=ai(s,i,r,e.isLittleEndian);return t&&Yt[t]?[n]:n}if(s===Wt.Ascii)return String.fromCharCode.apply(null,new Uint8Array(i.buffer,r,o-1));const A=[];for(let t=0;t<o;t+=a)A.push(ai(s,i,r+t,e.isLittleEndian));return A}function Ai(e,t,i){const r=t.getUint16(i+0,e.isLittleEndian),s=t.getUint16(i+2,e.isLittleEndian),n=si(t,i+4,e.ifdConfig.pointer,e.isLittleEndian),a=ti(s)*n;if(a<=e.ifdConfig.pointer){const a=oi(e,r,t,i+4+e.ifdConfig.pointer,s,n);return{type:"inline",id:r,name:Kt[r],count:n,value:a,dataType:s,tagOffset:i}}const o=si(t,i+4+e.ifdConfig.pointer,e.ifdConfig.pointer,e.isLittleEndian);switch(r){case Kt.TileOffsets:case Kt.TileByteCounts:case Kt.StripByteCounts:case Kt.StripOffsets:const e={type:"offset",id:r,name:Kt[r],count:n,dataType:s,dataOffset:o,isLoaded:!1,value:[],tagOffset:i};return r===Kt.TileOffsets&&ni(t,o,a)&&function(e,t){const i=ti(e.dataType),r=t.byteOffset+e.dataOffset-t.sourceOffset;e.view=new DataView(t.buffer.slice(r,r+i*e.count)),e.view.sourceOffset=e.dataOffset}(e,t),e}if(ni(t,o,a)){const a=oi(e,r,t,o-t.sourceOffset,s,n);return{type:"inline",id:r,name:Kt[r],count:n,value:a,dataType:s,tagOffset:i}}return{type:"lazy",id:r,name:Kt[r],count:n,dataOffset:o,dataType:s,tagOffset:i}}new Set([Kt.Compression,Kt.ImageHeight,Kt.ImageWidth,Kt.ModelPixelScale,Kt.ModelTiePoint,Kt.ModelTransformation,Kt.TileHeight,Kt.TileWidth,Kt.GeoKeyDirectory,Kt.GeoAsciiParams,Kt.GeoDoubleParams,Kt.TileOffsets]);class li{constructor(e,t,i){Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"tiff",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"isGeoTagsLoaded",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"tagsGeo",{enumerable:!0,configurable:!0,writable:!0,value:new Map}),Object.defineProperty(this,"tags",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.tiff=e,this.id=t,this.tags=i}async init(e=!0){const t=[this.fetch(Kt.Compression),this.fetch(Kt.ImageHeight),this.fetch(Kt.ImageWidth),this.fetch(Kt.ModelPixelScale),this.fetch(Kt.ModelTiePoint),this.fetch(Kt.ModelTransformation),this.fetch(Kt.TileHeight),this.fetch(Kt.TileWidth)];e&&(t.push(this.fetch(Kt.GeoKeyDirectory)),t.push(this.fetch(Kt.GeoAsciiParams)),t.push(this.fetch(Kt.GeoDoubleParams))),await Promise.all(t),e&&await this.loadGeoTiffTags()}value(e){const t=this.tags.get(e);return null==t||"offset"===t.type&&!1===t.isLoaded?null:t.value}has(e){return this.tags.has(e)}async fetch(e){const t=this.tags.get(e);if(null==t)return null;if("inline"===t.type)return t.value;if("lazy"===t.type)return async function(e,t){if(null!=e.value)return e.value;const i=ti(e.dataType)*e.count,r=await t.source.fetch(e.dataOffset,i),s=new DataView(r);return e.value=oi(t,e.id,s,0,e.dataType,e.count),e.value}(t,this.tiff);if(t.isLoaded)return t.value;if("offset"===t.type)return async function(e,t){const i=ti(t.dataType);if(null==t.view){const r=await e.source.fetch(t.dataOffset,i*t.count);t.view=new DataView(r),t.view.sourceOffset=t.dataOffset}return t.value=oi(e,t.id,t.view,0,t.dataType,t.count),t.isLoaded=!0,t.value}(this.tiff,t);throw new Error("Cannot fetch:"+e)}valueGeo(e){if(!1===this.isGeoTagsLoaded)throw new Error("loadGeoTiffTags() has not been called");return this.tagsGeo.get(e)}get noData(){const e=this.tags.get(Kt.GdalNoData);if(null==e)return null;if(e.value)return Number(e.value);throw new Error("GdalNoData tag is not loaded")}async loadGeoTiffTags(){if(this.isGeoTagsLoaded)return;const e=this.tags.get(Kt.GeoKeyDirectory);if(null==e)return void(this.isGeoTagsLoaded=!0);if("lazy"===e.type&&null==e.value&&await Promise.all([this.fetch(Kt.GeoKeyDirectory),this.fetch(Kt.GeoAsciiParams),this.fetch(Kt.GeoDoubleParams)]),this.isGeoTagsLoaded=!0,null==e.value)return;const t=e.value;if("number"==typeof t)throw new Error("Invalid geo tags found");for(let e=4;e<=4*t[3];e+=4){const i=t[e],r=t[e+1],s=t[e+3];if(0===r){this.tagsGeo.set(i,s);continue}const n=this.tags.get(r);if(null==n||null==n.value)continue;const a=t[e+2];if("string"==typeof n.value)this.tagsGeo.set(i,n.value.slice(s,s+a-1).trim());else{if(!Array.isArray(n.value))throw new Error("Failed to extract GeoTiffTags");1===a?this.tagsGeo.set(i,n.value[s]):this.tagsGeo.set(i,n.value.slice(s,s+a))}}}get origin(){const e=this.value(Kt.ModelTiePoint);if(null!=e&&6===e.length)return[e[3],e[4],e[5]];const t=this.value(Kt.ModelTransformation);if(null!=t)return[t[3],t[7],t[11]];if(this.value(Kt.SubFileType)===Gt.ReducedImage&&0!==this.id)return this.tiff.images[0].origin;throw new Error("Image does not have a geo transformation.")}get isGeoLocated(){return!(null==this.value(Kt.ModelPixelScale)&&null==this.value(Kt.ModelTransformation))||!(!this.isSubImage||0===this.id)&&this.tiff.images[0].isGeoLocated}get resolution(){const e=this.value(Kt.ModelPixelScale);if(null!=e)return[e[0],-e[1],e[2]];const t=this.value(Kt.ModelTransformation);if(null!=t)return[t[0],t[5],t[10]];if(this.isSubImage&&0!==this.id){const e=this.tiff.images[0],[t,i,r]=e.resolution,s=e.size,n=this.size;return[t*s.width/n.width,i*s.height/n.height,r]}throw new Error("Image does not have a geo transformation.")}get isSubImage(){return this.value(Kt.SubFileType)===Gt.ReducedImage}get bbox(){const e=this.size,t=this.origin,i=this.resolution;if(null==t||null==e||null==i)throw new Error("Unable to calculate bounding box");const r=t[0],s=t[1],n=r+i[0]*e.width,a=s+i[1]*e.height;return[Math.min(r,n),Math.min(s,a),Math.max(r,n),Math.max(s,a)]}get compression(){const e=this.value(Kt.Compression);return null==e?null:Zt[e]}get epsg(){const e=this.valueGeo(Ht.ProjectionGeoKey);if(null!=e&&32767!==e)return e;let t=null;switch(this.valueGeo(Ht.GTModelTypeGeoKey)){case Ft.Unknown:return null;case Ft.Projected:t=this.valueGeo(Ht.ProjectedCRSGeoKey);break;case Ft.Geographic:case Ft.Geocentric:t=this.valueGeo(Ht.GeodeticCRSGeoKey);break;case Ft.UserDefined:return null}return 32767===t?null:t}get size(){const e=this.value(Kt.ImageWidth),t=this.value(Kt.ImageHeight);if(null==e||null==t)throw new Error("Tiff has no height or width");return{width:e,height:t}}isTiled(){return null!==this.value(Kt.TileWidth)}get tileSize(){const e=this.value(Kt.TileWidth),t=this.value(Kt.TileHeight);if(null==e||null==t)throw new Error("Tiff is not tiled");return{width:e,height:t}}get tileCount(){const e=this.size,t=this.tileSize;return{x:Math.ceil(e.width/t.width),y:Math.ceil(e.height/t.height)}}get tileOffset(){const e=this.tags.get(Kt.TileOffsets);if(null==e)throw new Error("No tile offsets found");return e}get stripCount(){return this.tags.get(Kt.StripByteCounts)?.count??0}getTileBounds(e,t){const{size:i,tileSize:r}=this,s=t*r.height,n=e*r.width;return{x:n,y:s,width:n+r.width>=i.width?i.width-n:r.width,height:s+r.height>=i.height?i.height-s:r.height}}async getStrip(e){if(this.isTiled())throw new Error("Cannot read stripes, tiff is tiled: "+e);const t=this.tags.get(Kt.StripByteCounts),i=this.tags.get(Kt.StripOffsets);if(e>=t.count)throw new Error("Cannot read strip, index out of bounds");const[r,s]=await Promise.all([hi(this.tiff,i,e),hi(this.tiff,t,e)]);return this.getBytes(r,s)}getJpegHeader(e){const t=this.value(Kt.JpegTables);if(null==t)throw new Error("Unable to find Jpeg header");const i=t.slice(0,t.length-2),r=new Uint8Array(e.byteLength+i.length-2);return r.set(i,0),r.set(new Uint8Array(e).slice(2),i.length),r}async getBytes(e,t){if(0===t)return null;const i=await this.tiff.source.fetch(e,t);if(i.byteLength<t)throw new Error(`Failed to fetch bytes from offset:${e} wanted:${t} got:${i.byteLength}`);let r=this.value(Kt.Compression);null==r&&(r=Ot.None);const s=(null==(n=r)?null:Zt[n])??jt.None;var n;return r===Ot.Jpeg?{mimeType:s,bytes:this.getJpegHeader(i),compression:r}:{mimeType:s,bytes:i,compression:r}}async getTile(e,t){const i=this.size,r=this.tileSize;if(null==r)throw new Error("Tiff is not tiled");const s=Math.ceil(i.height/r.height),n=Math.ceil(i.width/r.width);if(e>=n||t>=s)throw new Error(`Tile index is outside of range x:${e} >= ${n} or y:${t} >= ${s}`);const a=t*n+e,o=n*s;if(a>=o)throw new Error(`Tile index is outside of tile range: ${a} >= ${o}`);const{offset:A,imageSize:l}=await this.getTileSize(a);return this.getBytes(A,l)}async hasTile(e,t){const i=this.tileSize,r=this.size;if(null==i)throw new Error("Tiff is not tiled");const s=Math.ceil(r.height/i.height),n=Math.ceil(r.width/i.width);if(e>=n||t>=s)return!1;const a=t*n+e;return(await this.getTileSize(a)).offset>0}async getTileSize(e){const t=this.tiff.options?.tileLeaderByteSize;if(t){const i=await hi(this.tiff,this.tileOffset,e);if(0===i)return{offset:0,imageSize:0};const r=await this.tiff.source.fetch(i-t,t);return{offset:i,imageSize:si(new DataView(r),0,t,this.tiff.isLittleEndian)}}const i=this.tags.get(Kt.TileByteCounts);if(null==i)throw new Error("No tile byte counts found");const[r,s]=await Promise.all([hi(this.tiff,this.tileOffset,e),hi(this.tiff,i,e)]);return{offset:r,imageSize:s}}}function hi(e,t,i){if(i<0)throw new Error(`Tiff: ${e.source.url.href} out of bounds ${Kt[t.id]} index:${i} total:${t.count}`);return i>=t.count?0:"inline"===t.type?t.value[i]:async function(e,t,i){if(i>t.count||i<0)throw new Error("TagOffset: out of bounds :"+i);if(null!=t.value[i])return t.value[i];const r=ti(t.dataType);if(null==t.view){const s=await e.source.fetch(t.dataOffset+i*r,r),n=oi(e,void 0,new DataView(s),0,t.dataType,1);return t.value[i]=n,n}const s=oi(e,void 0,t.view,i*r,t.dataType,1);return t.value[i]=s,s}(e,t,i)}var ci,gi,ui;!function(e){e.GdalStructuralMetadataSize="GDAL_STRUCTURAL_METADATA_SIZE",e.Layout="LAYOUT",e.BlockOrder="BLOCK_ORDER",e.BlockLeader="BLOCK_LEADER",e.BlockTrailer="BLOCK_TRAILER",e.KnownIncompatibleEdition="KNOWN_INCOMPATIBLE_EDITION",e.MaskInterleavedWithImagery="MASK_INTERLEAVED_WITH_IMAGERY"}(ci||(ci={})),function(e){e.RowMajor="ROW_MAJOR"}(gi||(gi={})),function(e){e.uint32="SIZE_AS_UINT4"}(ui||(ui={}));class di{constructor(){Object.defineProperty(this,"options",{enumerable:!0,configurable:!0,writable:!0,value:new Map})}get isCogOptimized(){return!this.isBroken&&"IFDS_BEFORE_DATA"===this.options.get(ci.Layout)}get isBroken(){return"YES"===this.options.get(ci.KnownIncompatibleEdition)}process(e,t,i){let r="",s="",n=!1;for(let a=0;a<i;a++){const i=e.getUint8(t+a);if(0===i)break;const o=String.fromCharCode(i);"\n"===o?(this.options.set(r.trim(),s.trim()),r="",s="",n=!1):"="===o?n=!0:n?s+=o:r+=o}}get tileLeaderByteSize(){return this.options.get(ci.BlockLeader)===ui.uint32?ei.UInt32:null}get isMaskInterleaved(){return"YES"===this.options.get(ci.MaskInterleavedWithImagery)}}const fi={version:Xt.Tiff,pointer:ei.UInt32,offset:ei.UInt16,ifd:ei.UInt16+ei.UInt16+2*ei.UInt32},pi={version:Xt.BigTiff,pointer:ei.UInt64,offset:ei.UInt64,ifd:ei.UInt16+ei.UInt16+2*ei.UInt64};Xt.BigTiff,Xt.Tiff;class Ii{constructor(e){Object.defineProperty(this,"defaultReadSize",{enumerable:!0,configurable:!0,writable:!0,value:Ii.DefaultReadSize}),Object.defineProperty(this,"source",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:Xt.Tiff}),Object.defineProperty(this,"images",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"options",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"ifdConfig",{enumerable:!0,configurable:!0,writable:!0,value:fi}),Object.defineProperty(this,"isLittleEndian",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"isInitialized",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_initPromise",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.source=e}static create(e){return new Ii(e).init()}init(){return this._initPromise||(this._initPromise=this.readHeader()),this._initPromise}getImageByResolution(e){const t=this.images[0],i=t.size,[r]=t.resolution,s=r*i.width;for(let t=this.images.length-1;t>0;t--){const i=this.images[t];if(s/i.size.width-e<=.01)return i}return t}async readHeader(){if(this.isInitialized)return this;const e=new DataView(await this.source.fetch(0,mi(this.source,0,this.defaultReadSize)));e.sourceOffset=0;let t=0;const i=e.getUint16(t,this.isLittleEndian);if(t+=2,this.isLittleEndian=i===Tt.Little,!this.isLittleEndian)throw new Error("Only little endian is supported");let r;if(this.version=e.getUint16(t,this.isLittleEndian),t+=2,this.version===Xt.BigTiff){this.ifdConfig=pi;const i=e.getUint16(t,this.isLittleEndian);if(t+=2,8!==i)throw new Error("Only 8byte pointers are supported");const s=e.getUint16(t,this.isLittleEndian);if(t+=2,0!==s)throw new Error("Invalid big tiff header");r=si(e,t,this.ifdConfig.pointer,this.isLittleEndian),t+=this.ifdConfig.pointer}else{if(this.version!==Xt.Tiff)throw new Error(`Only tiff supported version:${this.version}`);r=si(e,t,this.ifdConfig.pointer,this.isLittleEndian),t+=this.ifdConfig.pointer}const s=r-t;for(s>0&&s<16384&&(this.options=new di,this.options.process(e,t,s));0!==r;){let t=e;if(!ni(t,r,1024)){const e=await this.source.fetch(r,mi(this.source,r,this.defaultReadSize));t=new DataView(e),t.sourceOffset=r}r=await this.readIfd(r,t)}return await Promise.all(this.images.map((e=>e.init()))),this.isInitialized=!0,this}async readIfd(e,t){const i=e-t.sourceOffset,r=si(t,i,this.ifdConfig.offset,this.isLittleEndian),s=new Map;if(!ni(t,e,r*this.ifdConfig.ifd))throw new Error("IFD out of range @ "+function(e,t=4,i=!0){const r=e.toString(16).padStart(t,"0");return i?"0x"+r:r}(e)+" IFD"+this.images.length);const n=this.ifdConfig.ifd,a=i+this.ifdConfig.offset;for(let e=0;e<r;e++){const i=Ai(this,t,a+e*n);s.set(i.id,i)}return this.images.push(new li(this,this.images.length,s)),si(t,a+r*n,this.ifdConfig.pointer,this.isLittleEndian)}}function mi(e,t,i){if(null==e.metadata?.size)return i;const r=e.metadata.size;return t+i>r?r-t:i}Object.defineProperty(Ii,"DefaultReadSize",{enumerable:!0,configurable:!0,writable:!0,value:16384});class _i extends Error{code;url;source;constructor(e,t,i,r){super(e,{cause:r}),this.code=t,this.url=i.url,this.source=i,Object.defineProperty(this,"_sourceError",{enumerable:!1,value:"SourceError"})}static is(e){return e instanceof _i||"object"==typeof e&&(null!=e&&("_sourceError"in e&&"SourceError"===e._sourceError))}}const wi={toRange(e,t){if(null==t)return`bytes=${e}`;if(e<0)throw new Error("Cannot read from remote source with negative offset and length");return`bytes=${e}-${e+t-1}`},parseSize(e){const[t,i]=e.split(" ");if("bytes"!==t)throw new Error("Failed to parse content-range: "+e);if(null==i)throw new Error("Failed to parse content-range: "+e);const[,r]=i.split("/"),s=Number(r);if(isNaN(s))throw new Error("Failed to parse content-range: "+e);return s}};function Ci(e){const t={size:-1},i=e.headers.get("content-range");return null!=i&&(t.size=wi.parseSize(i)),t.eTag=e.headers.get("etag")??void 0,t.contentType=e.headers.get("content-type")??void 0,t.contentDisposition=e.headers.get("content-disposition")??void 0,t}class Bi{constructor(e,t){this.type="http",this.url="string"==typeof e?Bi.tryUrl(e):e,this.headers=t}static tryUrl(e){try{return new URL(e)}catch(t){return"undefined"!=typeof document?new URL(e,document.baseURI):new URL(e,"undefined"==typeof document?require("url").pathToFileURL(__filename).href:document.currentScript&&document.currentScript.src||new URL("index.min.js",document.baseURI).href)}}head(){return this._head||(this._head=Bi.fetch(this.url,{method:"HEAD",headers:this.headers}).then((e=>{if(!e.ok)throw delete this._head,new Error(`Failed to HEAD ${this.url}`,{cause:{statusCode:e.status,msg:e.statusText}});return this.metadata=Ci(e),this.metadata}))),this._head}async fetch(e,t){try{const i={range:wi.toRange(e,t),...this.headers},r=await Bi.fetch(this.url,{headers:i});if(!r.ok)throw new _i(`Failed to fetch ${this.url} ${i.range}`,r.status,this,new Error(r.statusText));const s=Ci(r);if(null==this.metadata)this.metadata=s;else if(this.metadata.eTag&&this.metadata.eTag!==s.eTag)throw new _i(`ETag conflict ${this.url} ${i.range} expected: ${this.metadata.eTag} got: ${s.eTag}`,409,this);return r.arrayBuffer()}catch(e){if(_i.is(e)&&e.source===this)throw e;throw new _i(`Failed to fetch: ${this.url}`,500,this,e)}}}Bi.fetch=(e,t)=>fetch(e,t)
2
+ /*! pako 2.1.0 https://github.com/nodeca/pako @license (MIT AND Zlib) */;function Ei(e){let t=e.length;for(;--t>=0;)e[t]=0}const yi=256,Qi=286,bi=30,ki=15,xi=new Uint8Array([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]),vi=new Uint8Array([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]),Di=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),Si=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Mi=new Array(576);Ei(Mi);const Ui=new Array(60);Ei(Ui);const Ti=new Array(512);Ei(Ti);const Gi=new Array(256);Ei(Gi);const Li=new Array(29);Ei(Li);const Ri=new Array(bi);function Fi(e,t,i,r,s){this.static_tree=e,this.extra_bits=t,this.extra_base=i,this.elems=r,this.max_length=s,this.has_stree=e&&e.length}let Ni,Oi,Pi;function zi(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}Ei(Ri);const qi=e=>e<256?Ti[e]:Ti[256+(e>>>7)],Ki=(e,t)=>{e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255},Hi=(e,t,i)=>{e.bi_valid>16-i?(e.bi_buf|=t<<e.bi_valid&65535,Ki(e,e.bi_buf),e.bi_buf=t>>16-e.bi_valid,e.bi_valid+=i-16):(e.bi_buf|=t<<e.bi_valid&65535,e.bi_valid+=i)},Vi=(e,t,i)=>{Hi(e,i[2*t],i[2*t+1])},Ji=(e,t)=>{let i=0;do{i|=1&e,e>>>=1,i<<=1}while(--t>0);return i>>>1},Yi=(e,t,i)=>{const r=new Array(16);let s,n,a=0;for(s=1;s<=ki;s++)a=a+i[s-1]<<1,r[s]=a;for(n=0;n<=t;n++){let t=e[2*n+1];0!==t&&(e[2*n]=Ji(r[t]++,t))}},ji=e=>{let t;for(t=0;t<Qi;t++)e.dyn_ltree[2*t]=0;for(t=0;t<bi;t++)e.dyn_dtree[2*t]=0;for(t=0;t<19;t++)e.bl_tree[2*t]=0;e.dyn_ltree[512]=1,e.opt_len=e.static_len=0,e.sym_next=e.matches=0},Zi=e=>{e.bi_valid>8?Ki(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0},Wi=(e,t,i,r)=>{const s=2*t,n=2*i;return e[s]<e[n]||e[s]===e[n]&&r[t]<=r[i]},Xi=(e,t,i)=>{const r=e.heap[i];let s=i<<1;for(;s<=e.heap_len&&(s<e.heap_len&&Wi(t,e.heap[s+1],e.heap[s],e.depth)&&s++,!Wi(t,r,e.heap[s],e.depth));)e.heap[i]=e.heap[s],i=s,s<<=1;e.heap[i]=r},$i=(e,t,i)=>{let r,s,n,a,o=0;if(0!==e.sym_next)do{r=255&e.pending_buf[e.sym_buf+o++],r+=(255&e.pending_buf[e.sym_buf+o++])<<8,s=e.pending_buf[e.sym_buf+o++],0===r?Vi(e,s,t):(n=Gi[s],Vi(e,n+yi+1,t),a=xi[n],0!==a&&(s-=Li[n],Hi(e,s,a)),r--,n=qi(r),Vi(e,n,i),a=vi[n],0!==a&&(r-=Ri[n],Hi(e,r,a)))}while(o<e.sym_next);Vi(e,256,t)},er=(e,t)=>{const i=t.dyn_tree,r=t.stat_desc.static_tree,s=t.stat_desc.has_stree,n=t.stat_desc.elems;let a,o,A,l=-1;for(e.heap_len=0,e.heap_max=573,a=0;a<n;a++)0!==i[2*a]?(e.heap[++e.heap_len]=l=a,e.depth[a]=0):i[2*a+1]=0;for(;e.heap_len<2;)A=e.heap[++e.heap_len]=l<2?++l:0,i[2*A]=1,e.depth[A]=0,e.opt_len--,s&&(e.static_len-=r[2*A+1]);for(t.max_code=l,a=e.heap_len>>1;a>=1;a--)Xi(e,i,a);A=n;do{a=e.heap[1],e.heap[1]=e.heap[e.heap_len--],Xi(e,i,1),o=e.heap[1],e.heap[--e.heap_max]=a,e.heap[--e.heap_max]=o,i[2*A]=i[2*a]+i[2*o],e.depth[A]=(e.depth[a]>=e.depth[o]?e.depth[a]:e.depth[o])+1,i[2*a+1]=i[2*o+1]=A,e.heap[1]=A++,Xi(e,i,1)}while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],((e,t)=>{const i=t.dyn_tree,r=t.max_code,s=t.stat_desc.static_tree,n=t.stat_desc.has_stree,a=t.stat_desc.extra_bits,o=t.stat_desc.extra_base,A=t.stat_desc.max_length;let l,h,c,g,u,d,f=0;for(g=0;g<=ki;g++)e.bl_count[g]=0;for(i[2*e.heap[e.heap_max]+1]=0,l=e.heap_max+1;l<573;l++)h=e.heap[l],g=i[2*i[2*h+1]+1]+1,g>A&&(g=A,f++),i[2*h+1]=g,h>r||(e.bl_count[g]++,u=0,h>=o&&(u=a[h-o]),d=i[2*h],e.opt_len+=d*(g+u),n&&(e.static_len+=d*(s[2*h+1]+u)));if(0!==f){do{for(g=A-1;0===e.bl_count[g];)g--;e.bl_count[g]--,e.bl_count[g+1]+=2,e.bl_count[A]--,f-=2}while(f>0);for(g=A;0!==g;g--)for(h=e.bl_count[g];0!==h;)c=e.heap[--l],c>r||(i[2*c+1]!==g&&(e.opt_len+=(g-i[2*c+1])*i[2*c],i[2*c+1]=g),h--)}})(e,t),Yi(i,l,e.bl_count)},tr=(e,t,i)=>{let r,s,n=-1,a=t[1],o=0,A=7,l=4;for(0===a&&(A=138,l=3),t[2*(i+1)+1]=65535,r=0;r<=i;r++)s=a,a=t[2*(r+1)+1],++o<A&&s===a||(o<l?e.bl_tree[2*s]+=o:0!==s?(s!==n&&e.bl_tree[2*s]++,e.bl_tree[32]++):o<=10?e.bl_tree[34]++:e.bl_tree[36]++,o=0,n=s,0===a?(A=138,l=3):s===a?(A=6,l=3):(A=7,l=4))},ir=(e,t,i)=>{let r,s,n=-1,a=t[1],o=0,A=7,l=4;for(0===a&&(A=138,l=3),r=0;r<=i;r++)if(s=a,a=t[2*(r+1)+1],!(++o<A&&s===a)){if(o<l)do{Vi(e,s,e.bl_tree)}while(0!=--o);else 0!==s?(s!==n&&(Vi(e,s,e.bl_tree),o--),Vi(e,16,e.bl_tree),Hi(e,o-3,2)):o<=10?(Vi(e,17,e.bl_tree),Hi(e,o-3,3)):(Vi(e,18,e.bl_tree),Hi(e,o-11,7));o=0,n=s,0===a?(A=138,l=3):s===a?(A=6,l=3):(A=7,l=4)}};let rr=!1;const sr=(e,t,i,r)=>{Hi(e,0+(r?1:0),3),Zi(e),Ki(e,i),Ki(e,~i),i&&e.pending_buf.set(e.window.subarray(t,t+i),e.pending),e.pending+=i};var nr=(e,t,i,r)=>{let s,n,a=0;e.level>0?(2===e.strm.data_type&&(e.strm.data_type=(e=>{let t,i=4093624447;for(t=0;t<=31;t++,i>>>=1)if(1&i&&0!==e.dyn_ltree[2*t])return 0;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return 1;for(t=32;t<yi;t++)if(0!==e.dyn_ltree[2*t])return 1;return 0})(e)),er(e,e.l_desc),er(e,e.d_desc),a=(e=>{let t;for(tr(e,e.dyn_ltree,e.l_desc.max_code),tr(e,e.dyn_dtree,e.d_desc.max_code),er(e,e.bl_desc),t=18;t>=3&&0===e.bl_tree[2*Si[t]+1];t--);return e.opt_len+=3*(t+1)+5+5+4,t})(e),s=e.opt_len+3+7>>>3,n=e.static_len+3+7>>>3,n<=s&&(s=n)):s=n=i+5,i+4<=s&&-1!==t?sr(e,t,i,r):4===e.strategy||n===s?(Hi(e,2+(r?1:0),3),$i(e,Mi,Ui)):(Hi(e,4+(r?1:0),3),((e,t,i,r)=>{let s;for(Hi(e,t-257,5),Hi(e,i-1,5),Hi(e,r-4,4),s=0;s<r;s++)Hi(e,e.bl_tree[2*Si[s]+1],3);ir(e,e.dyn_ltree,t-1),ir(e,e.dyn_dtree,i-1)})(e,e.l_desc.max_code+1,e.d_desc.max_code+1,a+1),$i(e,e.dyn_ltree,e.dyn_dtree)),ji(e),r&&Zi(e)},ar={_tr_init:e=>{rr||((()=>{let e,t,i,r,s;const n=new Array(16);for(i=0,r=0;r<28;r++)for(Li[r]=i,e=0;e<1<<xi[r];e++)Gi[i++]=r;for(Gi[i-1]=r,s=0,r=0;r<16;r++)for(Ri[r]=s,e=0;e<1<<vi[r];e++)Ti[s++]=r;for(s>>=7;r<bi;r++)for(Ri[r]=s<<7,e=0;e<1<<vi[r]-7;e++)Ti[256+s++]=r;for(t=0;t<=ki;t++)n[t]=0;for(e=0;e<=143;)Mi[2*e+1]=8,e++,n[8]++;for(;e<=255;)Mi[2*e+1]=9,e++,n[9]++;for(;e<=279;)Mi[2*e+1]=7,e++,n[7]++;for(;e<=287;)Mi[2*e+1]=8,e++,n[8]++;for(Yi(Mi,287,n),e=0;e<bi;e++)Ui[2*e+1]=5,Ui[2*e]=Ji(e,5);Ni=new Fi(Mi,xi,257,Qi,ki),Oi=new Fi(Ui,vi,0,bi,ki),Pi=new Fi(new Array(0),Di,0,19,7)})(),rr=!0),e.l_desc=new zi(e.dyn_ltree,Ni),e.d_desc=new zi(e.dyn_dtree,Oi),e.bl_desc=new zi(e.bl_tree,Pi),e.bi_buf=0,e.bi_valid=0,ji(e)},_tr_stored_block:sr,_tr_flush_block:nr,_tr_tally:(e,t,i)=>(e.pending_buf[e.sym_buf+e.sym_next++]=t,e.pending_buf[e.sym_buf+e.sym_next++]=t>>8,e.pending_buf[e.sym_buf+e.sym_next++]=i,0===t?e.dyn_ltree[2*i]++:(e.matches++,t--,e.dyn_ltree[2*(Gi[i]+yi+1)]++,e.dyn_dtree[2*qi(t)]++),e.sym_next===e.sym_end),_tr_align:e=>{Hi(e,2,3),Vi(e,256,Mi),(e=>{16===e.bi_valid?(Ki(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):e.bi_valid>=8&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)})(e)}};var or=(e,t,i,r)=>{let s=65535&e|0,n=e>>>16&65535|0,a=0;for(;0!==i;){a=i>2e3?2e3:i,i-=a;do{s=s+t[r++]|0,n=n+s|0}while(--a);s%=65521,n%=65521}return s|n<<16|0};const Ar=new Uint32Array((()=>{let e,t=[];for(var i=0;i<256;i++){e=i;for(var r=0;r<8;r++)e=1&e?3988292384^e>>>1:e>>>1;t[i]=e}return t})());var lr=(e,t,i,r)=>{const s=Ar,n=r+i;e^=-1;for(let i=r;i<n;i++)e=e>>>8^s[255&(e^t[i])];return-1^e},hr={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},cr={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8};const{_tr_init:gr,_tr_stored_block:ur,_tr_flush_block:dr,_tr_tally:fr,_tr_align:pr}=ar,{Z_NO_FLUSH:Ir,Z_PARTIAL_FLUSH:mr,Z_FULL_FLUSH:_r,Z_FINISH:wr,Z_BLOCK:Cr,Z_OK:Br,Z_STREAM_END:Er,Z_STREAM_ERROR:yr,Z_DATA_ERROR:Qr,Z_BUF_ERROR:br,Z_DEFAULT_COMPRESSION:kr,Z_FILTERED:xr,Z_HUFFMAN_ONLY:vr,Z_RLE:Dr,Z_FIXED:Sr,Z_DEFAULT_STRATEGY:Mr,Z_UNKNOWN:Ur,Z_DEFLATED:Tr}=cr,Gr=258,Lr=262,Rr=42,Fr=113,Nr=666,Or=(e,t)=>(e.msg=hr[t],t),Pr=e=>2*e-(e>4?9:0),zr=e=>{let t=e.length;for(;--t>=0;)e[t]=0},qr=e=>{let t,i,r,s=e.w_size;t=e.hash_size,r=t;do{i=e.head[--r],e.head[r]=i>=s?i-s:0}while(--t);t=s,r=t;do{i=e.prev[--r],e.prev[r]=i>=s?i-s:0}while(--t)};let Kr=(e,t,i)=>(t<<e.hash_shift^i)&e.hash_mask;const Hr=e=>{const t=e.state;let i=t.pending;i>e.avail_out&&(i=e.avail_out),0!==i&&(e.output.set(t.pending_buf.subarray(t.pending_out,t.pending_out+i),e.next_out),e.next_out+=i,t.pending_out+=i,e.total_out+=i,e.avail_out-=i,t.pending-=i,0===t.pending&&(t.pending_out=0))},Vr=(e,t)=>{dr(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,Hr(e.strm)},Jr=(e,t)=>{e.pending_buf[e.pending++]=t},Yr=(e,t)=>{e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t},jr=(e,t,i,r)=>{let s=e.avail_in;return s>r&&(s=r),0===s?0:(e.avail_in-=s,t.set(e.input.subarray(e.next_in,e.next_in+s),i),1===e.state.wrap?e.adler=or(e.adler,t,s,i):2===e.state.wrap&&(e.adler=lr(e.adler,t,s,i)),e.next_in+=s,e.total_in+=s,s)},Zr=(e,t)=>{let i,r,s=e.max_chain_length,n=e.strstart,a=e.prev_length,o=e.nice_match;const A=e.strstart>e.w_size-Lr?e.strstart-(e.w_size-Lr):0,l=e.window,h=e.w_mask,c=e.prev,g=e.strstart+Gr;let u=l[n+a-1],d=l[n+a];e.prev_length>=e.good_match&&(s>>=2),o>e.lookahead&&(o=e.lookahead);do{if(i=t,l[i+a]===d&&l[i+a-1]===u&&l[i]===l[n]&&l[++i]===l[n+1]){n+=2,i++;do{}while(l[++n]===l[++i]&&l[++n]===l[++i]&&l[++n]===l[++i]&&l[++n]===l[++i]&&l[++n]===l[++i]&&l[++n]===l[++i]&&l[++n]===l[++i]&&l[++n]===l[++i]&&n<g);if(r=Gr-(g-n),n=g-Gr,r>a){if(e.match_start=t,a=r,r>=o)break;u=l[n+a-1],d=l[n+a]}}}while((t=c[t&h])>A&&0!=--s);return a<=e.lookahead?a:e.lookahead},Wr=e=>{const t=e.w_size;let i,r,s;do{if(r=e.window_size-e.lookahead-e.strstart,e.strstart>=t+(t-Lr)&&(e.window.set(e.window.subarray(t,t+t-r),0),e.match_start-=t,e.strstart-=t,e.block_start-=t,e.insert>e.strstart&&(e.insert=e.strstart),qr(e),r+=t),0===e.strm.avail_in)break;if(i=jr(e.strm,e.window,e.strstart+e.lookahead,r),e.lookahead+=i,e.lookahead+e.insert>=3)for(s=e.strstart-e.insert,e.ins_h=e.window[s],e.ins_h=Kr(e,e.ins_h,e.window[s+1]);e.insert&&(e.ins_h=Kr(e,e.ins_h,e.window[s+3-1]),e.prev[s&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=s,s++,e.insert--,!(e.lookahead+e.insert<3)););}while(e.lookahead<Lr&&0!==e.strm.avail_in)},Xr=(e,t)=>{let i,r,s,n=e.pending_buf_size-5>e.w_size?e.w_size:e.pending_buf_size-5,a=0,o=e.strm.avail_in;do{if(i=65535,s=e.bi_valid+42>>3,e.strm.avail_out<s)break;if(s=e.strm.avail_out-s,r=e.strstart-e.block_start,i>r+e.strm.avail_in&&(i=r+e.strm.avail_in),i>s&&(i=s),i<n&&(0===i&&t!==wr||t===Ir||i!==r+e.strm.avail_in))break;a=t===wr&&i===r+e.strm.avail_in?1:0,ur(e,0,0,a),e.pending_buf[e.pending-4]=i,e.pending_buf[e.pending-3]=i>>8,e.pending_buf[e.pending-2]=~i,e.pending_buf[e.pending-1]=~i>>8,Hr(e.strm),r&&(r>i&&(r=i),e.strm.output.set(e.window.subarray(e.block_start,e.block_start+r),e.strm.next_out),e.strm.next_out+=r,e.strm.avail_out-=r,e.strm.total_out+=r,e.block_start+=r,i-=r),i&&(jr(e.strm,e.strm.output,e.strm.next_out,i),e.strm.next_out+=i,e.strm.avail_out-=i,e.strm.total_out+=i)}while(0===a);return o-=e.strm.avail_in,o&&(o>=e.w_size?(e.matches=2,e.window.set(e.strm.input.subarray(e.strm.next_in-e.w_size,e.strm.next_in),0),e.strstart=e.w_size,e.insert=e.strstart):(e.window_size-e.strstart<=o&&(e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,e.insert>e.strstart&&(e.insert=e.strstart)),e.window.set(e.strm.input.subarray(e.strm.next_in-o,e.strm.next_in),e.strstart),e.strstart+=o,e.insert+=o>e.w_size-e.insert?e.w_size-e.insert:o),e.block_start=e.strstart),e.high_water<e.strstart&&(e.high_water=e.strstart),a?4:t!==Ir&&t!==wr&&0===e.strm.avail_in&&e.strstart===e.block_start?2:(s=e.window_size-e.strstart,e.strm.avail_in>s&&e.block_start>=e.w_size&&(e.block_start-=e.w_size,e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,s+=e.w_size,e.insert>e.strstart&&(e.insert=e.strstart)),s>e.strm.avail_in&&(s=e.strm.avail_in),s&&(jr(e.strm,e.window,e.strstart,s),e.strstart+=s,e.insert+=s>e.w_size-e.insert?e.w_size-e.insert:s),e.high_water<e.strstart&&(e.high_water=e.strstart),s=e.bi_valid+42>>3,s=e.pending_buf_size-s>65535?65535:e.pending_buf_size-s,n=s>e.w_size?e.w_size:s,r=e.strstart-e.block_start,(r>=n||(r||t===wr)&&t!==Ir&&0===e.strm.avail_in&&r<=s)&&(i=r>s?s:r,a=t===wr&&0===e.strm.avail_in&&i===r?1:0,ur(e,e.block_start,i,a),e.block_start+=i,Hr(e.strm)),a?3:1)},$r=(e,t)=>{let i,r;for(;;){if(e.lookahead<Lr){if(Wr(e),e.lookahead<Lr&&t===Ir)return 1;if(0===e.lookahead)break}if(i=0,e.lookahead>=3&&(e.ins_h=Kr(e,e.ins_h,e.window[e.strstart+3-1]),i=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),0!==i&&e.strstart-i<=e.w_size-Lr&&(e.match_length=Zr(e,i)),e.match_length>=3)if(r=fr(e,e.strstart-e.match_start,e.match_length-3),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=3){e.match_length--;do{e.strstart++,e.ins_h=Kr(e,e.ins_h,e.window[e.strstart+3-1]),i=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart}while(0!=--e.match_length);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.ins_h=e.window[e.strstart],e.ins_h=Kr(e,e.ins_h,e.window[e.strstart+1]);else r=fr(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(r&&(Vr(e,!1),0===e.strm.avail_out))return 1}return e.insert=e.strstart<2?e.strstart:2,t===wr?(Vr(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(Vr(e,!1),0===e.strm.avail_out)?1:2},es=(e,t)=>{let i,r,s;for(;;){if(e.lookahead<Lr){if(Wr(e),e.lookahead<Lr&&t===Ir)return 1;if(0===e.lookahead)break}if(i=0,e.lookahead>=3&&(e.ins_h=Kr(e,e.ins_h,e.window[e.strstart+3-1]),i=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=2,0!==i&&e.prev_length<e.max_lazy_match&&e.strstart-i<=e.w_size-Lr&&(e.match_length=Zr(e,i),e.match_length<=5&&(e.strategy===xr||3===e.match_length&&e.strstart-e.match_start>4096)&&(e.match_length=2)),e.prev_length>=3&&e.match_length<=e.prev_length){s=e.strstart+e.lookahead-3,r=fr(e,e.strstart-1-e.prev_match,e.prev_length-3),e.lookahead-=e.prev_length-1,e.prev_length-=2;do{++e.strstart<=s&&(e.ins_h=Kr(e,e.ins_h,e.window[e.strstart+3-1]),i=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart)}while(0!=--e.prev_length);if(e.match_available=0,e.match_length=2,e.strstart++,r&&(Vr(e,!1),0===e.strm.avail_out))return 1}else if(e.match_available){if(r=fr(e,0,e.window[e.strstart-1]),r&&Vr(e,!1),e.strstart++,e.lookahead--,0===e.strm.avail_out)return 1}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(r=fr(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<2?e.strstart:2,t===wr?(Vr(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(Vr(e,!1),0===e.strm.avail_out)?1:2};function ts(e,t,i,r,s){this.good_length=e,this.max_lazy=t,this.nice_length=i,this.max_chain=r,this.func=s}const is=[new ts(0,0,0,0,Xr),new ts(4,4,8,4,$r),new ts(4,5,16,8,$r),new ts(4,6,32,32,$r),new ts(4,4,16,16,es),new ts(8,16,32,32,es),new ts(8,16,128,128,es),new ts(8,32,128,256,es),new ts(32,128,258,1024,es),new ts(32,258,258,4096,es)];function rs(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=Tr,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(1146),this.dyn_dtree=new Uint16Array(122),this.bl_tree=new Uint16Array(78),zr(this.dyn_ltree),zr(this.dyn_dtree),zr(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(16),this.heap=new Uint16Array(573),zr(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(573),zr(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}const ss=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||t.status!==Rr&&57!==t.status&&69!==t.status&&73!==t.status&&91!==t.status&&103!==t.status&&t.status!==Fr&&t.status!==Nr?1:0},ns=e=>{if(ss(e))return Or(e,yr);e.total_in=e.total_out=0,e.data_type=Ur;const t=e.state;return t.pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=2===t.wrap?57:t.wrap?Rr:Fr,e.adler=2===t.wrap?0:1,t.last_flush=-2,gr(t),Br},as=e=>{const t=ns(e);var i;return t===Br&&((i=e.state).window_size=2*i.w_size,zr(i.head),i.max_lazy_match=is[i.level].max_lazy,i.good_match=is[i.level].good_length,i.nice_match=is[i.level].nice_length,i.max_chain_length=is[i.level].max_chain,i.strstart=0,i.block_start=0,i.lookahead=0,i.insert=0,i.match_length=i.prev_length=2,i.match_available=0,i.ins_h=0),t},os=(e,t,i,r,s,n)=>{if(!e)return yr;let a=1;if(t===kr&&(t=6),r<0?(a=0,r=-r):r>15&&(a=2,r-=16),s<1||s>9||i!==Tr||r<8||r>15||t<0||t>9||n<0||n>Sr||8===r&&1!==a)return Or(e,yr);8===r&&(r=9);const o=new rs;return e.state=o,o.strm=e,o.status=Rr,o.wrap=a,o.gzhead=null,o.w_bits=r,o.w_size=1<<o.w_bits,o.w_mask=o.w_size-1,o.hash_bits=s+7,o.hash_size=1<<o.hash_bits,o.hash_mask=o.hash_size-1,o.hash_shift=~~((o.hash_bits+3-1)/3),o.window=new Uint8Array(2*o.w_size),o.head=new Uint16Array(o.hash_size),o.prev=new Uint16Array(o.w_size),o.lit_bufsize=1<<s+6,o.pending_buf_size=4*o.lit_bufsize,o.pending_buf=new Uint8Array(o.pending_buf_size),o.sym_buf=o.lit_bufsize,o.sym_end=3*(o.lit_bufsize-1),o.level=t,o.strategy=n,o.method=i,as(e)};var As={deflateInit:(e,t)=>os(e,t,Tr,15,8,Mr),deflateInit2:os,deflateReset:as,deflateResetKeep:ns,deflateSetHeader:(e,t)=>ss(e)||2!==e.state.wrap?yr:(e.state.gzhead=t,Br),deflate:(e,t)=>{if(ss(e)||t>Cr||t<0)return e?Or(e,yr):yr;const i=e.state;if(!e.output||0!==e.avail_in&&!e.input||i.status===Nr&&t!==wr)return Or(e,0===e.avail_out?br:yr);const r=i.last_flush;if(i.last_flush=t,0!==i.pending){if(Hr(e),0===e.avail_out)return i.last_flush=-1,Br}else if(0===e.avail_in&&Pr(t)<=Pr(r)&&t!==wr)return Or(e,br);if(i.status===Nr&&0!==e.avail_in)return Or(e,br);if(i.status===Rr&&0===i.wrap&&(i.status=Fr),i.status===Rr){let t=Tr+(i.w_bits-8<<4)<<8,r=-1;if(r=i.strategy>=vr||i.level<2?0:i.level<6?1:6===i.level?2:3,t|=r<<6,0!==i.strstart&&(t|=32),t+=31-t%31,Yr(i,t),0!==i.strstart&&(Yr(i,e.adler>>>16),Yr(i,65535&e.adler)),e.adler=1,i.status=Fr,Hr(e),0!==i.pending)return i.last_flush=-1,Br}if(57===i.status)if(e.adler=0,Jr(i,31),Jr(i,139),Jr(i,8),i.gzhead)Jr(i,(i.gzhead.text?1:0)+(i.gzhead.hcrc?2:0)+(i.gzhead.extra?4:0)+(i.gzhead.name?8:0)+(i.gzhead.comment?16:0)),Jr(i,255&i.gzhead.time),Jr(i,i.gzhead.time>>8&255),Jr(i,i.gzhead.time>>16&255),Jr(i,i.gzhead.time>>24&255),Jr(i,9===i.level?2:i.strategy>=vr||i.level<2?4:0),Jr(i,255&i.gzhead.os),i.gzhead.extra&&i.gzhead.extra.length&&(Jr(i,255&i.gzhead.extra.length),Jr(i,i.gzhead.extra.length>>8&255)),i.gzhead.hcrc&&(e.adler=lr(e.adler,i.pending_buf,i.pending,0)),i.gzindex=0,i.status=69;else if(Jr(i,0),Jr(i,0),Jr(i,0),Jr(i,0),Jr(i,0),Jr(i,9===i.level?2:i.strategy>=vr||i.level<2?4:0),Jr(i,3),i.status=Fr,Hr(e),0!==i.pending)return i.last_flush=-1,Br;if(69===i.status){if(i.gzhead.extra){let t=i.pending,r=(65535&i.gzhead.extra.length)-i.gzindex;for(;i.pending+r>i.pending_buf_size;){let s=i.pending_buf_size-i.pending;if(i.pending_buf.set(i.gzhead.extra.subarray(i.gzindex,i.gzindex+s),i.pending),i.pending=i.pending_buf_size,i.gzhead.hcrc&&i.pending>t&&(e.adler=lr(e.adler,i.pending_buf,i.pending-t,t)),i.gzindex+=s,Hr(e),0!==i.pending)return i.last_flush=-1,Br;t=0,r-=s}let s=new Uint8Array(i.gzhead.extra);i.pending_buf.set(s.subarray(i.gzindex,i.gzindex+r),i.pending),i.pending+=r,i.gzhead.hcrc&&i.pending>t&&(e.adler=lr(e.adler,i.pending_buf,i.pending-t,t)),i.gzindex=0}i.status=73}if(73===i.status){if(i.gzhead.name){let t,r=i.pending;do{if(i.pending===i.pending_buf_size){if(i.gzhead.hcrc&&i.pending>r&&(e.adler=lr(e.adler,i.pending_buf,i.pending-r,r)),Hr(e),0!==i.pending)return i.last_flush=-1,Br;r=0}t=i.gzindex<i.gzhead.name.length?255&i.gzhead.name.charCodeAt(i.gzindex++):0,Jr(i,t)}while(0!==t);i.gzhead.hcrc&&i.pending>r&&(e.adler=lr(e.adler,i.pending_buf,i.pending-r,r)),i.gzindex=0}i.status=91}if(91===i.status){if(i.gzhead.comment){let t,r=i.pending;do{if(i.pending===i.pending_buf_size){if(i.gzhead.hcrc&&i.pending>r&&(e.adler=lr(e.adler,i.pending_buf,i.pending-r,r)),Hr(e),0!==i.pending)return i.last_flush=-1,Br;r=0}t=i.gzindex<i.gzhead.comment.length?255&i.gzhead.comment.charCodeAt(i.gzindex++):0,Jr(i,t)}while(0!==t);i.gzhead.hcrc&&i.pending>r&&(e.adler=lr(e.adler,i.pending_buf,i.pending-r,r))}i.status=103}if(103===i.status){if(i.gzhead.hcrc){if(i.pending+2>i.pending_buf_size&&(Hr(e),0!==i.pending))return i.last_flush=-1,Br;Jr(i,255&e.adler),Jr(i,e.adler>>8&255),e.adler=0}if(i.status=Fr,Hr(e),0!==i.pending)return i.last_flush=-1,Br}if(0!==e.avail_in||0!==i.lookahead||t!==Ir&&i.status!==Nr){let r=0===i.level?Xr(i,t):i.strategy===vr?((e,t)=>{let i;for(;;){if(0===e.lookahead&&(Wr(e),0===e.lookahead)){if(t===Ir)return 1;break}if(e.match_length=0,i=fr(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,i&&(Vr(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,t===wr?(Vr(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(Vr(e,!1),0===e.strm.avail_out)?1:2})(i,t):i.strategy===Dr?((e,t)=>{let i,r,s,n;const a=e.window;for(;;){if(e.lookahead<=Gr){if(Wr(e),e.lookahead<=Gr&&t===Ir)return 1;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=3&&e.strstart>0&&(s=e.strstart-1,r=a[s],r===a[++s]&&r===a[++s]&&r===a[++s])){n=e.strstart+Gr;do{}while(r===a[++s]&&r===a[++s]&&r===a[++s]&&r===a[++s]&&r===a[++s]&&r===a[++s]&&r===a[++s]&&r===a[++s]&&s<n);e.match_length=Gr-(n-s),e.match_length>e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=3?(i=fr(e,1,e.match_length-3),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(i=fr(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),i&&(Vr(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,t===wr?(Vr(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(Vr(e,!1),0===e.strm.avail_out)?1:2})(i,t):is[i.level].func(i,t);if(3!==r&&4!==r||(i.status=Nr),1===r||3===r)return 0===e.avail_out&&(i.last_flush=-1),Br;if(2===r&&(t===mr?pr(i):t!==Cr&&(ur(i,0,0,!1),t===_r&&(zr(i.head),0===i.lookahead&&(i.strstart=0,i.block_start=0,i.insert=0))),Hr(e),0===e.avail_out))return i.last_flush=-1,Br}return t!==wr?Br:i.wrap<=0?Er:(2===i.wrap?(Jr(i,255&e.adler),Jr(i,e.adler>>8&255),Jr(i,e.adler>>16&255),Jr(i,e.adler>>24&255),Jr(i,255&e.total_in),Jr(i,e.total_in>>8&255),Jr(i,e.total_in>>16&255),Jr(i,e.total_in>>24&255)):(Yr(i,e.adler>>>16),Yr(i,65535&e.adler)),Hr(e),i.wrap>0&&(i.wrap=-i.wrap),0!==i.pending?Br:Er)},deflateEnd:e=>{if(ss(e))return yr;const t=e.state.status;return e.state=null,t===Fr?Or(e,Qr):Br},deflateSetDictionary:(e,t)=>{let i=t.length;if(ss(e))return yr;const r=e.state,s=r.wrap;if(2===s||1===s&&r.status!==Rr||r.lookahead)return yr;if(1===s&&(e.adler=or(e.adler,t,i,0)),r.wrap=0,i>=r.w_size){0===s&&(zr(r.head),r.strstart=0,r.block_start=0,r.insert=0);let e=new Uint8Array(r.w_size);e.set(t.subarray(i-r.w_size,i),0),t=e,i=r.w_size}const n=e.avail_in,a=e.next_in,o=e.input;for(e.avail_in=i,e.next_in=0,e.input=t,Wr(r);r.lookahead>=3;){let e=r.strstart,t=r.lookahead-2;do{r.ins_h=Kr(r,r.ins_h,r.window[e+3-1]),r.prev[e&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=e,e++}while(--t);r.strstart=e,r.lookahead=2,Wr(r)}return r.strstart+=r.lookahead,r.block_start=r.strstart,r.insert=r.lookahead,r.lookahead=0,r.match_length=r.prev_length=2,r.match_available=0,e.next_in=a,e.input=o,e.avail_in=n,r.wrap=s,Br},deflateInfo:"pako deflate (from Nodeca project)"};const ls=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var hs={assign:function(e){const t=Array.prototype.slice.call(arguments,1);for(;t.length;){const i=t.shift();if(i){if("object"!=typeof i)throw new TypeError(i+"must be non-object");for(const t in i)ls(i,t)&&(e[t]=i[t])}}return e},flattenChunks:e=>{let t=0;for(let i=0,r=e.length;i<r;i++)t+=e[i].length;const i=new Uint8Array(t);for(let t=0,r=0,s=e.length;t<s;t++){let s=e[t];i.set(s,r),r+=s.length}return i}};let cs=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(e){cs=!1}const gs=new Uint8Array(256);for(let e=0;e<256;e++)gs[e]=e>=252?6:e>=248?5:e>=240?4:e>=224?3:e>=192?2:1;gs[254]=gs[254]=1;var us={string2buf:e=>{if("function"==typeof TextEncoder&&TextEncoder.prototype.encode)return(new TextEncoder).encode(e);let t,i,r,s,n,a=e.length,o=0;for(s=0;s<a;s++)i=e.charCodeAt(s),55296==(64512&i)&&s+1<a&&(r=e.charCodeAt(s+1),56320==(64512&r)&&(i=65536+(i-55296<<10)+(r-56320),s++)),o+=i<128?1:i<2048?2:i<65536?3:4;for(t=new Uint8Array(o),n=0,s=0;n<o;s++)i=e.charCodeAt(s),55296==(64512&i)&&s+1<a&&(r=e.charCodeAt(s+1),56320==(64512&r)&&(i=65536+(i-55296<<10)+(r-56320),s++)),i<128?t[n++]=i:i<2048?(t[n++]=192|i>>>6,t[n++]=128|63&i):i<65536?(t[n++]=224|i>>>12,t[n++]=128|i>>>6&63,t[n++]=128|63&i):(t[n++]=240|i>>>18,t[n++]=128|i>>>12&63,t[n++]=128|i>>>6&63,t[n++]=128|63&i);return t},buf2string:(e,t)=>{const i=t||e.length;if("function"==typeof TextDecoder&&TextDecoder.prototype.decode)return(new TextDecoder).decode(e.subarray(0,t));let r,s;const n=new Array(2*i);for(s=0,r=0;r<i;){let t=e[r++];if(t<128){n[s++]=t;continue}let a=gs[t];if(a>4)n[s++]=65533,r+=a-1;else{for(t&=2===a?31:3===a?15:7;a>1&&r<i;)t=t<<6|63&e[r++],a--;a>1?n[s++]=65533:t<65536?n[s++]=t:(t-=65536,n[s++]=55296|t>>10&1023,n[s++]=56320|1023&t)}}return((e,t)=>{if(t<65534&&e.subarray&&cs)return String.fromCharCode.apply(null,e.length===t?e:e.subarray(0,t));let i="";for(let r=0;r<t;r++)i+=String.fromCharCode(e[r]);return i})(n,s)},utf8border:(e,t)=>{(t=t||e.length)>e.length&&(t=e.length);let i=t-1;for(;i>=0&&128==(192&e[i]);)i--;return i<0||0===i?t:i+gs[e[i]]>t?i:t}};var ds=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0};const fs=Object.prototype.toString,{Z_NO_FLUSH:ps,Z_SYNC_FLUSH:Is,Z_FULL_FLUSH:ms,Z_FINISH:_s,Z_OK:ws,Z_STREAM_END:Cs,Z_DEFAULT_COMPRESSION:Bs,Z_DEFAULT_STRATEGY:Es,Z_DEFLATED:ys}=cr;function Qs(e){this.options=hs.assign({level:Bs,method:ys,chunkSize:16384,windowBits:15,memLevel:8,strategy:Es},e||{});let t=this.options;t.raw&&t.windowBits>0?t.windowBits=-t.windowBits:t.gzip&&t.windowBits>0&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new ds,this.strm.avail_out=0;let i=As.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(i!==ws)throw new Error(hr[i]);if(t.header&&As.deflateSetHeader(this.strm,t.header),t.dictionary){let e;if(e="string"==typeof t.dictionary?us.string2buf(t.dictionary):"[object ArrayBuffer]"===fs.call(t.dictionary)?new Uint8Array(t.dictionary):t.dictionary,i=As.deflateSetDictionary(this.strm,e),i!==ws)throw new Error(hr[i]);this._dict_set=!0}}Qs.prototype.push=function(e,t){const i=this.strm,r=this.options.chunkSize;let s,n;if(this.ended)return!1;for(n=t===~~t?t:!0===t?_s:ps,"string"==typeof e?i.input=us.string2buf(e):"[object ArrayBuffer]"===fs.call(e)?i.input=new Uint8Array(e):i.input=e,i.next_in=0,i.avail_in=i.input.length;;)if(0===i.avail_out&&(i.output=new Uint8Array(r),i.next_out=0,i.avail_out=r),(n===Is||n===ms)&&i.avail_out<=6)this.onData(i.output.subarray(0,i.next_out)),i.avail_out=0;else{if(s=As.deflate(i,n),s===Cs)return i.next_out>0&&this.onData(i.output.subarray(0,i.next_out)),s=As.deflateEnd(this.strm),this.onEnd(s),this.ended=!0,s===ws;if(0!==i.avail_out){if(n>0&&i.next_out>0)this.onData(i.output.subarray(0,i.next_out)),i.avail_out=0;else if(0===i.avail_in)break}else this.onData(i.output)}return!0},Qs.prototype.onData=function(e){this.chunks.push(e)},Qs.prototype.onEnd=function(e){e===ws&&(this.result=hs.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};const bs=16209;var ks=function(e,t){let i,r,s,n,a,o,A,l,h,c,g,u,d,f,p,I,m,_,w,C,B,E,y,Q;const b=e.state;i=e.next_in,y=e.input,r=i+(e.avail_in-5),s=e.next_out,Q=e.output,n=s-(t-e.avail_out),a=s+(e.avail_out-257),o=b.dmax,A=b.wsize,l=b.whave,h=b.wnext,c=b.window,g=b.hold,u=b.bits,d=b.lencode,f=b.distcode,p=(1<<b.lenbits)-1,I=(1<<b.distbits)-1;e:do{u<15&&(g+=y[i++]<<u,u+=8,g+=y[i++]<<u,u+=8),m=d[g&p];t:for(;;){if(_=m>>>24,g>>>=_,u-=_,_=m>>>16&255,0===_)Q[s++]=65535&m;else{if(!(16&_)){if(0==(64&_)){m=d[(65535&m)+(g&(1<<_)-1)];continue t}if(32&_){b.mode=16191;break e}e.msg="invalid literal/length code",b.mode=bs;break e}w=65535&m,_&=15,_&&(u<_&&(g+=y[i++]<<u,u+=8),w+=g&(1<<_)-1,g>>>=_,u-=_),u<15&&(g+=y[i++]<<u,u+=8,g+=y[i++]<<u,u+=8),m=f[g&I];i:for(;;){if(_=m>>>24,g>>>=_,u-=_,_=m>>>16&255,!(16&_)){if(0==(64&_)){m=f[(65535&m)+(g&(1<<_)-1)];continue i}e.msg="invalid distance code",b.mode=bs;break e}if(C=65535&m,_&=15,u<_&&(g+=y[i++]<<u,u+=8,u<_&&(g+=y[i++]<<u,u+=8)),C+=g&(1<<_)-1,C>o){e.msg="invalid distance too far back",b.mode=bs;break e}if(g>>>=_,u-=_,_=s-n,C>_){if(_=C-_,_>l&&b.sane){e.msg="invalid distance too far back",b.mode=bs;break e}if(B=0,E=c,0===h){if(B+=A-_,_<w){w-=_;do{Q[s++]=c[B++]}while(--_);B=s-C,E=Q}}else if(h<_){if(B+=A+h-_,_-=h,_<w){w-=_;do{Q[s++]=c[B++]}while(--_);if(B=0,h<w){_=h,w-=_;do{Q[s++]=c[B++]}while(--_);B=s-C,E=Q}}}else if(B+=h-_,_<w){w-=_;do{Q[s++]=c[B++]}while(--_);B=s-C,E=Q}for(;w>2;)Q[s++]=E[B++],Q[s++]=E[B++],Q[s++]=E[B++],w-=3;w&&(Q[s++]=E[B++],w>1&&(Q[s++]=E[B++]))}else{B=s-C;do{Q[s++]=Q[B++],Q[s++]=Q[B++],Q[s++]=Q[B++],w-=3}while(w>2);w&&(Q[s++]=Q[B++],w>1&&(Q[s++]=Q[B++]))}break}}break}}while(i<r&&s<a);w=u>>3,i-=w,u-=w<<3,g&=(1<<u)-1,e.next_in=i,e.next_out=s,e.avail_in=i<r?r-i+5:5-(i-r),e.avail_out=s<a?a-s+257:257-(s-a),b.hold=g,b.bits=u};const xs=15,vs=new Uint16Array([3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0]),Ds=new Uint8Array([16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78]),Ss=new Uint16Array([1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0]),Ms=new Uint8Array([16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64]);var Us=(e,t,i,r,s,n,a,o)=>{const A=o.bits;let l,h,c,g,u,d,f=0,p=0,I=0,m=0,_=0,w=0,C=0,B=0,E=0,y=0,Q=null;const b=new Uint16Array(16),k=new Uint16Array(16);let x,v,D,S=null;for(f=0;f<=xs;f++)b[f]=0;for(p=0;p<r;p++)b[t[i+p]]++;for(_=A,m=xs;m>=1&&0===b[m];m--);if(_>m&&(_=m),0===m)return s[n++]=20971520,s[n++]=20971520,o.bits=1,0;for(I=1;I<m&&0===b[I];I++);for(_<I&&(_=I),B=1,f=1;f<=xs;f++)if(B<<=1,B-=b[f],B<0)return-1;if(B>0&&(0===e||1!==m))return-1;for(k[1]=0,f=1;f<xs;f++)k[f+1]=k[f]+b[f];for(p=0;p<r;p++)0!==t[i+p]&&(a[k[t[i+p]]++]=p);if(0===e?(Q=S=a,d=20):1===e?(Q=vs,S=Ds,d=257):(Q=Ss,S=Ms,d=0),y=0,p=0,f=I,u=n,w=_,C=0,c=-1,E=1<<_,g=E-1,1===e&&E>852||2===e&&E>592)return 1;for(;;){x=f-C,a[p]+1<d?(v=0,D=a[p]):a[p]>=d?(v=S[a[p]-d],D=Q[a[p]-d]):(v=96,D=0),l=1<<f-C,h=1<<w,I=h;do{h-=l,s[u+(y>>C)+h]=x<<24|v<<16|D|0}while(0!==h);for(l=1<<f-1;y&l;)l>>=1;if(0!==l?(y&=l-1,y+=l):y=0,p++,0==--b[f]){if(f===m)break;f=t[i+a[p]]}if(f>_&&(y&g)!==c){for(0===C&&(C=_),u+=I,w=f-C,B=1<<w;w+C<m&&(B-=b[w+C],!(B<=0));)w++,B<<=1;if(E+=1<<w,1===e&&E>852||2===e&&E>592)return 1;c=y&g,s[c]=_<<24|w<<16|u-n|0}}return 0!==y&&(s[u+y]=f-C<<24|64<<16|0),o.bits=_,0};const{Z_FINISH:Ts,Z_BLOCK:Gs,Z_TREES:Ls,Z_OK:Rs,Z_STREAM_END:Fs,Z_NEED_DICT:Ns,Z_STREAM_ERROR:Os,Z_DATA_ERROR:Ps,Z_MEM_ERROR:zs,Z_BUF_ERROR:qs,Z_DEFLATED:Ks}=cr,Hs=16180,Vs=16190,Js=16191,Ys=16192,js=16194,Zs=16199,Ws=16200,Xs=16206,$s=16209,en=e=>(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24);function tn(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}const rn=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||t.mode<Hs||t.mode>16211?1:0},sn=e=>{if(rn(e))return Os;const t=e.state;return e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=Hs,t.last=0,t.havedict=0,t.flags=-1,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new Int32Array(852),t.distcode=t.distdyn=new Int32Array(592),t.sane=1,t.back=-1,Rs},nn=e=>{if(rn(e))return Os;const t=e.state;return t.wsize=0,t.whave=0,t.wnext=0,sn(e)},an=(e,t)=>{let i;if(rn(e))return Os;const r=e.state;return t<0?(i=0,t=-t):(i=5+(t>>4),t<48&&(t&=15)),t&&(t<8||t>15)?Os:(null!==r.window&&r.wbits!==t&&(r.window=null),r.wrap=i,r.wbits=t,nn(e))},on=(e,t)=>{if(!e)return Os;const i=new tn;e.state=i,i.strm=e,i.window=null,i.mode=Hs;const r=an(e,t);return r!==Rs&&(e.state=null),r};let An,ln,hn=!0;const cn=e=>{if(hn){An=new Int32Array(512),ln=new Int32Array(32);let t=0;for(;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(Us(1,e.lens,0,288,An,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;Us(2,e.lens,0,32,ln,0,e.work,{bits:5}),hn=!1}e.lencode=An,e.lenbits=9,e.distcode=ln,e.distbits=5},gn=(e,t,i,r)=>{let s;const n=e.state;return null===n.window&&(n.wsize=1<<n.wbits,n.wnext=0,n.whave=0,n.window=new Uint8Array(n.wsize)),r>=n.wsize?(n.window.set(t.subarray(i-n.wsize,i),0),n.wnext=0,n.whave=n.wsize):(s=n.wsize-n.wnext,s>r&&(s=r),n.window.set(t.subarray(i-r,i-r+s),n.wnext),(r-=s)?(n.window.set(t.subarray(i-r,i),0),n.wnext=r,n.whave=n.wsize):(n.wnext+=s,n.wnext===n.wsize&&(n.wnext=0),n.whave<n.wsize&&(n.whave+=s))),0};var un={inflateReset:nn,inflateReset2:an,inflateResetKeep:sn,inflateInit:e=>on(e,15),inflateInit2:on,inflate:(e,t)=>{let i,r,s,n,a,o,A,l,h,c,g,u,d,f,p,I,m,_,w,C,B,E,y=0;const Q=new Uint8Array(4);let b,k;const x=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(rn(e)||!e.output||!e.input&&0!==e.avail_in)return Os;i=e.state,i.mode===Js&&(i.mode=Ys),a=e.next_out,s=e.output,A=e.avail_out,n=e.next_in,r=e.input,o=e.avail_in,l=i.hold,h=i.bits,c=o,g=A,E=Rs;e:for(;;)switch(i.mode){case Hs:if(0===i.wrap){i.mode=Ys;break}for(;h<16;){if(0===o)break e;o--,l+=r[n++]<<h,h+=8}if(2&i.wrap&&35615===l){0===i.wbits&&(i.wbits=15),i.check=0,Q[0]=255&l,Q[1]=l>>>8&255,i.check=lr(i.check,Q,2,0),l=0,h=0,i.mode=16181;break}if(i.head&&(i.head.done=!1),!(1&i.wrap)||(((255&l)<<8)+(l>>8))%31){e.msg="incorrect header check",i.mode=$s;break}if((15&l)!==Ks){e.msg="unknown compression method",i.mode=$s;break}if(l>>>=4,h-=4,B=8+(15&l),0===i.wbits&&(i.wbits=B),B>15||B>i.wbits){e.msg="invalid window size",i.mode=$s;break}i.dmax=1<<i.wbits,i.flags=0,e.adler=i.check=1,i.mode=512&l?16189:Js,l=0,h=0;break;case 16181:for(;h<16;){if(0===o)break e;o--,l+=r[n++]<<h,h+=8}if(i.flags=l,(255&i.flags)!==Ks){e.msg="unknown compression method",i.mode=$s;break}if(57344&i.flags){e.msg="unknown header flags set",i.mode=$s;break}i.head&&(i.head.text=l>>8&1),512&i.flags&&4&i.wrap&&(Q[0]=255&l,Q[1]=l>>>8&255,i.check=lr(i.check,Q,2,0)),l=0,h=0,i.mode=16182;case 16182:for(;h<32;){if(0===o)break e;o--,l+=r[n++]<<h,h+=8}i.head&&(i.head.time=l),512&i.flags&&4&i.wrap&&(Q[0]=255&l,Q[1]=l>>>8&255,Q[2]=l>>>16&255,Q[3]=l>>>24&255,i.check=lr(i.check,Q,4,0)),l=0,h=0,i.mode=16183;case 16183:for(;h<16;){if(0===o)break e;o--,l+=r[n++]<<h,h+=8}i.head&&(i.head.xflags=255&l,i.head.os=l>>8),512&i.flags&&4&i.wrap&&(Q[0]=255&l,Q[1]=l>>>8&255,i.check=lr(i.check,Q,2,0)),l=0,h=0,i.mode=16184;case 16184:if(1024&i.flags){for(;h<16;){if(0===o)break e;o--,l+=r[n++]<<h,h+=8}i.length=l,i.head&&(i.head.extra_len=l),512&i.flags&&4&i.wrap&&(Q[0]=255&l,Q[1]=l>>>8&255,i.check=lr(i.check,Q,2,0)),l=0,h=0}else i.head&&(i.head.extra=null);i.mode=16185;case 16185:if(1024&i.flags&&(u=i.length,u>o&&(u=o),u&&(i.head&&(B=i.head.extra_len-i.length,i.head.extra||(i.head.extra=new Uint8Array(i.head.extra_len)),i.head.extra.set(r.subarray(n,n+u),B)),512&i.flags&&4&i.wrap&&(i.check=lr(i.check,r,u,n)),o-=u,n+=u,i.length-=u),i.length))break e;i.length=0,i.mode=16186;case 16186:if(2048&i.flags){if(0===o)break e;u=0;do{B=r[n+u++],i.head&&B&&i.length<65536&&(i.head.name+=String.fromCharCode(B))}while(B&&u<o);if(512&i.flags&&4&i.wrap&&(i.check=lr(i.check,r,u,n)),o-=u,n+=u,B)break e}else i.head&&(i.head.name=null);i.length=0,i.mode=16187;case 16187:if(4096&i.flags){if(0===o)break e;u=0;do{B=r[n+u++],i.head&&B&&i.length<65536&&(i.head.comment+=String.fromCharCode(B))}while(B&&u<o);if(512&i.flags&&4&i.wrap&&(i.check=lr(i.check,r,u,n)),o-=u,n+=u,B)break e}else i.head&&(i.head.comment=null);i.mode=16188;case 16188:if(512&i.flags){for(;h<16;){if(0===o)break e;o--,l+=r[n++]<<h,h+=8}if(4&i.wrap&&l!==(65535&i.check)){e.msg="header crc mismatch",i.mode=$s;break}l=0,h=0}i.head&&(i.head.hcrc=i.flags>>9&1,i.head.done=!0),e.adler=i.check=0,i.mode=Js;break;case 16189:for(;h<32;){if(0===o)break e;o--,l+=r[n++]<<h,h+=8}e.adler=i.check=en(l),l=0,h=0,i.mode=Vs;case Vs:if(0===i.havedict)return e.next_out=a,e.avail_out=A,e.next_in=n,e.avail_in=o,i.hold=l,i.bits=h,Ns;e.adler=i.check=1,i.mode=Js;case Js:if(t===Gs||t===Ls)break e;case Ys:if(i.last){l>>>=7&h,h-=7&h,i.mode=Xs;break}for(;h<3;){if(0===o)break e;o--,l+=r[n++]<<h,h+=8}switch(i.last=1&l,l>>>=1,h-=1,3&l){case 0:i.mode=16193;break;case 1:if(cn(i),i.mode=Zs,t===Ls){l>>>=2,h-=2;break e}break;case 2:i.mode=16196;break;case 3:e.msg="invalid block type",i.mode=$s}l>>>=2,h-=2;break;case 16193:for(l>>>=7&h,h-=7&h;h<32;){if(0===o)break e;o--,l+=r[n++]<<h,h+=8}if((65535&l)!=(l>>>16^65535)){e.msg="invalid stored block lengths",i.mode=$s;break}if(i.length=65535&l,l=0,h=0,i.mode=js,t===Ls)break e;case js:i.mode=16195;case 16195:if(u=i.length,u){if(u>o&&(u=o),u>A&&(u=A),0===u)break e;s.set(r.subarray(n,n+u),a),o-=u,n+=u,A-=u,a+=u,i.length-=u;break}i.mode=Js;break;case 16196:for(;h<14;){if(0===o)break e;o--,l+=r[n++]<<h,h+=8}if(i.nlen=257+(31&l),l>>>=5,h-=5,i.ndist=1+(31&l),l>>>=5,h-=5,i.ncode=4+(15&l),l>>>=4,h-=4,i.nlen>286||i.ndist>30){e.msg="too many length or distance symbols",i.mode=$s;break}i.have=0,i.mode=16197;case 16197:for(;i.have<i.ncode;){for(;h<3;){if(0===o)break e;o--,l+=r[n++]<<h,h+=8}i.lens[x[i.have++]]=7&l,l>>>=3,h-=3}for(;i.have<19;)i.lens[x[i.have++]]=0;if(i.lencode=i.lendyn,i.lenbits=7,b={bits:i.lenbits},E=Us(0,i.lens,0,19,i.lencode,0,i.work,b),i.lenbits=b.bits,E){e.msg="invalid code lengths set",i.mode=$s;break}i.have=0,i.mode=16198;case 16198:for(;i.have<i.nlen+i.ndist;){for(;y=i.lencode[l&(1<<i.lenbits)-1],p=y>>>24,I=y>>>16&255,m=65535&y,!(p<=h);){if(0===o)break e;o--,l+=r[n++]<<h,h+=8}if(m<16)l>>>=p,h-=p,i.lens[i.have++]=m;else{if(16===m){for(k=p+2;h<k;){if(0===o)break e;o--,l+=r[n++]<<h,h+=8}if(l>>>=p,h-=p,0===i.have){e.msg="invalid bit length repeat",i.mode=$s;break}B=i.lens[i.have-1],u=3+(3&l),l>>>=2,h-=2}else if(17===m){for(k=p+3;h<k;){if(0===o)break e;o--,l+=r[n++]<<h,h+=8}l>>>=p,h-=p,B=0,u=3+(7&l),l>>>=3,h-=3}else{for(k=p+7;h<k;){if(0===o)break e;o--,l+=r[n++]<<h,h+=8}l>>>=p,h-=p,B=0,u=11+(127&l),l>>>=7,h-=7}if(i.have+u>i.nlen+i.ndist){e.msg="invalid bit length repeat",i.mode=$s;break}for(;u--;)i.lens[i.have++]=B}}if(i.mode===$s)break;if(0===i.lens[256]){e.msg="invalid code -- missing end-of-block",i.mode=$s;break}if(i.lenbits=9,b={bits:i.lenbits},E=Us(1,i.lens,0,i.nlen,i.lencode,0,i.work,b),i.lenbits=b.bits,E){e.msg="invalid literal/lengths set",i.mode=$s;break}if(i.distbits=6,i.distcode=i.distdyn,b={bits:i.distbits},E=Us(2,i.lens,i.nlen,i.ndist,i.distcode,0,i.work,b),i.distbits=b.bits,E){e.msg="invalid distances set",i.mode=$s;break}if(i.mode=Zs,t===Ls)break e;case Zs:i.mode=Ws;case Ws:if(o>=6&&A>=258){e.next_out=a,e.avail_out=A,e.next_in=n,e.avail_in=o,i.hold=l,i.bits=h,ks(e,g),a=e.next_out,s=e.output,A=e.avail_out,n=e.next_in,r=e.input,o=e.avail_in,l=i.hold,h=i.bits,i.mode===Js&&(i.back=-1);break}for(i.back=0;y=i.lencode[l&(1<<i.lenbits)-1],p=y>>>24,I=y>>>16&255,m=65535&y,!(p<=h);){if(0===o)break e;o--,l+=r[n++]<<h,h+=8}if(I&&0==(240&I)){for(_=p,w=I,C=m;y=i.lencode[C+((l&(1<<_+w)-1)>>_)],p=y>>>24,I=y>>>16&255,m=65535&y,!(_+p<=h);){if(0===o)break e;o--,l+=r[n++]<<h,h+=8}l>>>=_,h-=_,i.back+=_}if(l>>>=p,h-=p,i.back+=p,i.length=m,0===I){i.mode=16205;break}if(32&I){i.back=-1,i.mode=Js;break}if(64&I){e.msg="invalid literal/length code",i.mode=$s;break}i.extra=15&I,i.mode=16201;case 16201:if(i.extra){for(k=i.extra;h<k;){if(0===o)break e;o--,l+=r[n++]<<h,h+=8}i.length+=l&(1<<i.extra)-1,l>>>=i.extra,h-=i.extra,i.back+=i.extra}i.was=i.length,i.mode=16202;case 16202:for(;y=i.distcode[l&(1<<i.distbits)-1],p=y>>>24,I=y>>>16&255,m=65535&y,!(p<=h);){if(0===o)break e;o--,l+=r[n++]<<h,h+=8}if(0==(240&I)){for(_=p,w=I,C=m;y=i.distcode[C+((l&(1<<_+w)-1)>>_)],p=y>>>24,I=y>>>16&255,m=65535&y,!(_+p<=h);){if(0===o)break e;o--,l+=r[n++]<<h,h+=8}l>>>=_,h-=_,i.back+=_}if(l>>>=p,h-=p,i.back+=p,64&I){e.msg="invalid distance code",i.mode=$s;break}i.offset=m,i.extra=15&I,i.mode=16203;case 16203:if(i.extra){for(k=i.extra;h<k;){if(0===o)break e;o--,l+=r[n++]<<h,h+=8}i.offset+=l&(1<<i.extra)-1,l>>>=i.extra,h-=i.extra,i.back+=i.extra}if(i.offset>i.dmax){e.msg="invalid distance too far back",i.mode=$s;break}i.mode=16204;case 16204:if(0===A)break e;if(u=g-A,i.offset>u){if(u=i.offset-u,u>i.whave&&i.sane){e.msg="invalid distance too far back",i.mode=$s;break}u>i.wnext?(u-=i.wnext,d=i.wsize-u):d=i.wnext-u,u>i.length&&(u=i.length),f=i.window}else f=s,d=a-i.offset,u=i.length;u>A&&(u=A),A-=u,i.length-=u;do{s[a++]=f[d++]}while(--u);0===i.length&&(i.mode=Ws);break;case 16205:if(0===A)break e;s[a++]=i.length,A--,i.mode=Ws;break;case Xs:if(i.wrap){for(;h<32;){if(0===o)break e;o--,l|=r[n++]<<h,h+=8}if(g-=A,e.total_out+=g,i.total+=g,4&i.wrap&&g&&(e.adler=i.check=i.flags?lr(i.check,s,g,a-g):or(i.check,s,g,a-g)),g=A,4&i.wrap&&(i.flags?l:en(l))!==i.check){e.msg="incorrect data check",i.mode=$s;break}l=0,h=0}i.mode=16207;case 16207:if(i.wrap&&i.flags){for(;h<32;){if(0===o)break e;o--,l+=r[n++]<<h,h+=8}if(4&i.wrap&&l!==(4294967295&i.total)){e.msg="incorrect length check",i.mode=$s;break}l=0,h=0}i.mode=16208;case 16208:E=Fs;break e;case $s:E=Ps;break e;case 16210:return zs;default:return Os}return e.next_out=a,e.avail_out=A,e.next_in=n,e.avail_in=o,i.hold=l,i.bits=h,(i.wsize||g!==e.avail_out&&i.mode<$s&&(i.mode<Xs||t!==Ts))&&gn(e,e.output,e.next_out,g-e.avail_out),c-=e.avail_in,g-=e.avail_out,e.total_in+=c,e.total_out+=g,i.total+=g,4&i.wrap&&g&&(e.adler=i.check=i.flags?lr(i.check,s,g,e.next_out-g):or(i.check,s,g,e.next_out-g)),e.data_type=i.bits+(i.last?64:0)+(i.mode===Js?128:0)+(i.mode===Zs||i.mode===js?256:0),(0===c&&0===g||t===Ts)&&E===Rs&&(E=qs),E},inflateEnd:e=>{if(rn(e))return Os;let t=e.state;return t.window&&(t.window=null),e.state=null,Rs},inflateGetHeader:(e,t)=>{if(rn(e))return Os;const i=e.state;return 0==(2&i.wrap)?Os:(i.head=t,t.done=!1,Rs)},inflateSetDictionary:(e,t)=>{const i=t.length;let r,s,n;return rn(e)?Os:(r=e.state,0!==r.wrap&&r.mode!==Vs?Os:r.mode===Vs&&(s=1,s=or(s,t,i,0),s!==r.check)?Ps:(n=gn(e,t,i,i),n?(r.mode=16210,zs):(r.havedict=1,Rs)))},inflateInfo:"pako inflate (from Nodeca project)"};var dn=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1};const fn=Object.prototype.toString,{Z_NO_FLUSH:pn,Z_FINISH:In,Z_OK:mn,Z_STREAM_END:_n,Z_NEED_DICT:wn,Z_STREAM_ERROR:Cn,Z_DATA_ERROR:Bn,Z_MEM_ERROR:En}=cr;function yn(e){this.options=hs.assign({chunkSize:65536,windowBits:15,to:""},e||{});const t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,0===t.windowBits&&(t.windowBits=-15)),!(t.windowBits>=0&&t.windowBits<16)||e&&e.windowBits||(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&0==(15&t.windowBits)&&(t.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new ds,this.strm.avail_out=0;let i=un.inflateInit2(this.strm,t.windowBits);if(i!==mn)throw new Error(hr[i]);if(this.header=new dn,un.inflateGetHeader(this.strm,this.header),t.dictionary&&("string"==typeof t.dictionary?t.dictionary=us.string2buf(t.dictionary):"[object ArrayBuffer]"===fn.call(t.dictionary)&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(i=un.inflateSetDictionary(this.strm,t.dictionary),i!==mn)))throw new Error(hr[i])}function Qn(e,t){const i=new yn(t);if(i.push(e),i.err)throw i.msg||hr[i.err];return i.result}yn.prototype.push=function(e,t){const i=this.strm,r=this.options.chunkSize,s=this.options.dictionary;let n,a,o;if(this.ended)return!1;for(a=t===~~t?t:!0===t?In:pn,"[object ArrayBuffer]"===fn.call(e)?i.input=new Uint8Array(e):i.input=e,i.next_in=0,i.avail_in=i.input.length;;){for(0===i.avail_out&&(i.output=new Uint8Array(r),i.next_out=0,i.avail_out=r),n=un.inflate(i,a),n===wn&&s&&(n=un.inflateSetDictionary(i,s),n===mn?n=un.inflate(i,a):n===Bn&&(n=wn));i.avail_in>0&&n===_n&&i.state.wrap>0&&0!==e[i.next_in];)un.inflateReset(i),n=un.inflate(i,a);switch(n){case Cn:case Bn:case wn:case En:return this.onEnd(n),this.ended=!0,!1}if(o=i.avail_out,i.next_out&&(0===i.avail_out||n===_n))if("string"===this.options.to){let e=us.utf8border(i.output,i.next_out),t=i.next_out-e,s=us.buf2string(i.output,e);i.next_out=t,i.avail_out=r-t,t&&i.output.set(i.output.subarray(e,e+t),0),this.onData(s)}else this.onData(i.output.length===i.next_out?i.output:i.output.subarray(0,i.next_out));if(n!==mn||0!==o){if(n===_n)return n=un.inflateEnd(this.strm),this.onEnd(n),this.ended=!0,!0;if(0===i.avail_in)break}}return!0},yn.prototype.onData=function(e){this.chunks.push(e)},yn.prototype.onEnd=function(e){e===mn&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=hs.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};var bn={Inflate:yn,inflate:Qn,inflateRaw:function(e,t){return(t=t||{}).raw=!0,Qn(e,t)},ungzip:Qn,constants:cr};const{Inflate:kn,inflate:xn,inflateRaw:vn,ungzip:Dn}=bn;var Sn=xn;function Mn(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Un={exports:{}};!function(e){function t(e){var t,i,r,s,n,a=Math.floor,o=new Array(64),A=new Array(64),l=new Array(64),h=new Array(64),c=new Array(65535),g=new Array(65535),u=new Array(64),d=new Array(64),f=[],p=0,I=7,m=new Array(64),_=new Array(64),w=new Array(64),C=new Array(256),B=new Array(2048),E=[0,1,5,6,14,15,27,28,2,4,7,13,16,26,29,42,3,8,12,17,25,30,41,43,9,11,18,24,31,40,44,53,10,19,23,32,39,45,52,54,20,22,33,38,46,51,55,60,21,34,37,47,50,56,59,61,35,36,48,49,57,58,62,63],y=[0,0,1,5,1,1,1,1,1,1,0,0,0,0,0,0,0],Q=[0,1,2,3,4,5,6,7,8,9,10,11],b=[0,0,2,1,3,3,2,4,3,5,5,4,4,0,0,1,125],k=[1,2,3,0,4,17,5,18,33,49,65,6,19,81,97,7,34,113,20,50,129,145,161,8,35,66,177,193,21,82,209,240,36,51,98,114,130,9,10,22,23,24,25,26,37,38,39,40,41,42,52,53,54,55,56,57,58,67,68,69,70,71,72,73,74,83,84,85,86,87,88,89,90,99,100,101,102,103,104,105,106,115,116,117,118,119,120,121,122,131,132,133,134,135,136,137,138,146,147,148,149,150,151,152,153,154,162,163,164,165,166,167,168,169,170,178,179,180,181,182,183,184,185,186,194,195,196,197,198,199,200,201,202,210,211,212,213,214,215,216,217,218,225,226,227,228,229,230,231,232,233,234,241,242,243,244,245,246,247,248,249,250],x=[0,0,3,1,1,1,1,1,1,1,1,1,0,0,0,0,0],v=[0,1,2,3,4,5,6,7,8,9,10,11],D=[0,0,2,1,2,4,4,3,4,7,5,4,4,0,1,2,119],S=[0,1,2,3,17,4,5,33,49,6,18,65,81,7,97,113,19,34,50,129,8,20,66,145,161,177,193,9,35,51,82,240,21,98,114,209,10,22,36,52,225,37,241,23,24,25,26,38,39,40,41,42,53,54,55,56,57,58,67,68,69,70,71,72,73,74,83,84,85,86,87,88,89,90,99,100,101,102,103,104,105,106,115,116,117,118,119,120,121,122,130,131,132,133,134,135,136,137,138,146,147,148,149,150,151,152,153,154,162,163,164,165,166,167,168,169,170,178,179,180,181,182,183,184,185,186,194,195,196,197,198,199,200,201,202,210,211,212,213,214,215,216,217,218,226,227,228,229,230,231,232,233,234,242,243,244,245,246,247,248,249,250];function M(e,t){for(var i=0,r=0,s=new Array,n=1;n<=16;n++){for(var a=1;a<=e[n];a++)s[t[r]]=[],s[t[r]][0]=i,s[t[r]][1]=n,r++,i++;i*=2}return s}function U(e){for(var t=e[0],i=e[1]-1;i>=0;)t&1<<i&&(p|=1<<I),i--,--I<0&&(255==p?(T(255),T(0)):T(p),I=7,p=0)}function T(e){f.push(e)}function G(e){T(e>>8&255),T(255&e)}function L(e,t,i,r,s){for(var n,a=s[0],o=s[240],A=function(e,t){var i,r,s,n,a,o,A,l,h,c,g=0;for(h=0;h<8;++h){i=e[g],r=e[g+1],s=e[g+2],n=e[g+3],a=e[g+4],o=e[g+5],A=e[g+6];var d=i+(l=e[g+7]),f=i-l,p=r+A,I=r-A,m=s+o,_=s-o,w=n+a,C=n-a,B=d+w,E=d-w,y=p+m,Q=p-m;e[g]=B+y,e[g+4]=B-y;var b=.707106781*(Q+E);e[g+2]=E+b,e[g+6]=E-b;var k=.382683433*((B=C+_)-(Q=I+f)),x=.5411961*B+k,v=1.306562965*Q+k,D=.707106781*(y=_+I),S=f+D,M=f-D;e[g+5]=M+x,e[g+3]=M-x,e[g+1]=S+v,e[g+7]=S-v,g+=8}for(g=0,h=0;h<8;++h){i=e[g],r=e[g+8],s=e[g+16],n=e[g+24],a=e[g+32],o=e[g+40],A=e[g+48];var U=i+(l=e[g+56]),T=i-l,G=r+A,L=r-A,R=s+o,F=s-o,N=n+a,O=n-a,P=U+N,z=U-N,q=G+R,K=G-R;e[g]=P+q,e[g+32]=P-q;var H=.707106781*(K+z);e[g+16]=z+H,e[g+48]=z-H;var V=.382683433*((P=O+F)-(K=L+T)),J=.5411961*P+V,Y=1.306562965*K+V,j=.707106781*(q=F+L),Z=T+j,W=T-j;e[g+40]=W+J,e[g+24]=W-J,e[g+8]=Z+Y,e[g+56]=Z-Y,g++}for(h=0;h<64;++h)c=e[h]*t[h],u[h]=c>0?c+.5|0:c-.5|0;return u}(e,t),l=0;l<64;++l)d[E[l]]=A[l];var h=d[0]-i;i=d[0],0==h?U(r[0]):(U(r[g[n=32767+h]]),U(c[n]));for(var f=63;f>0&&0==d[f];f--);if(0==f)return U(a),i;for(var p,I=1;I<=f;){for(var m=I;0==d[I]&&I<=f;++I);var _=I-m;if(_>=16){p=_>>4;for(var w=1;w<=p;++w)U(o);_&=15}n=32767+d[I],U(s[(_<<4)+g[n]]),U(c[n]),I++}return 63!=f&&U(a),i}function R(e){if(e<=0&&(e=1),e>100&&(e=100),n!=e){(function(e){for(var t=[16,11,10,16,24,40,51,61,12,12,14,19,26,58,60,55,14,13,16,24,40,57,69,56,14,17,22,29,51,87,80,62,18,22,37,56,68,109,103,77,24,35,55,64,81,104,113,92,49,64,78,87,103,121,120,101,72,92,95,98,112,100,103,99],i=0;i<64;i++){var r=a((t[i]*e+50)/100);r<1?r=1:r>255&&(r=255),o[E[i]]=r}for(var s=[17,18,24,47,99,99,99,99,18,21,26,66,99,99,99,99,24,26,56,99,99,99,99,99,47,66,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99],n=0;n<64;n++){var c=a((s[n]*e+50)/100);c<1?c=1:c>255&&(c=255),A[E[n]]=c}for(var g=[1,1.387039845,1.306562965,1.175875602,1,.785694958,.5411961,.275899379],u=0,d=0;d<8;d++)for(var f=0;f<8;f++)l[u]=1/(o[E[u]]*g[d]*g[f]*8),h[u]=1/(A[E[u]]*g[d]*g[f]*8),u++})(e<50?Math.floor(5e3/e):Math.floor(200-2*e)),n=e}}this.encode=function(e,n){var a;(new Date).getTime(),n&&R(n),f=new Array,p=0,I=7,G(65496),G(65504),G(16),T(74),T(70),T(73),T(70),T(0),T(1),T(1),T(0),G(1),G(1),T(0),T(0),void 0!==(a=e.comments)&&a.constructor===Array&&a.forEach((e=>{if("string"==typeof e){G(65534);var t,i=e.length;for(G(i+2),t=0;t<i;t++)T(e.charCodeAt(t))}})),function(e){if(e){G(65505),69===e[0]&&120===e[1]&&105===e[2]&&102===e[3]?G(e.length+2):(G(e.length+5+2),T(69),T(120),T(105),T(102),T(0));for(var t=0;t<e.length;t++)T(e[t])}}(e.exifBuffer),function(){G(65499),G(132),T(0);for(var e=0;e<64;e++)T(o[e]);T(1);for(var t=0;t<64;t++)T(A[t])}(),function(e,t){G(65472),G(17),T(8),G(t),G(e),T(3),T(1),T(17),T(0),T(2),T(17),T(1),T(3),T(17),T(1)}(e.width,e.height),function(){G(65476),G(418),T(0);for(var e=0;e<16;e++)T(y[e+1]);for(var t=0;t<=11;t++)T(Q[t]);T(16);for(var i=0;i<16;i++)T(b[i+1]);for(var r=0;r<=161;r++)T(k[r]);T(1);for(var s=0;s<16;s++)T(x[s+1]);for(var n=0;n<=11;n++)T(v[n]);T(17);for(var a=0;a<16;a++)T(D[a+1]);for(var o=0;o<=161;o++)T(S[o])}(),G(65498),G(12),T(3),T(1),T(0),T(2),T(17),T(3),T(17),T(0),T(63),T(0);var c=0,g=0,u=0;p=0,I=7,this.encode.displayName="_encode_";for(var d,C,E,M,F,N,O,P,z,q=e.data,K=e.width,H=e.height,V=4*K,J=0;J<H;){for(d=0;d<V;){for(N=F=V*J+d,O=-1,P=0,z=0;z<64;z++)N=F+(P=z>>3)*V+(O=4*(7&z)),J+P>=H&&(N-=V*(J+1+P-H)),d+O>=V&&(N-=d+O-V+4),C=q[N++],E=q[N++],M=q[N++],m[z]=(B[C]+B[E+256>>0]+B[M+512>>0]>>16)-128,_[z]=(B[C+768>>0]+B[E+1024>>0]+B[M+1280>>0]>>16)-128,w[z]=(B[C+1280>>0]+B[E+1536>>0]+B[M+1792>>0]>>16)-128;c=L(m,l,c,t,r),g=L(_,h,g,i,s),u=L(w,h,u,i,s),d+=32}J+=8}if(I>=0){var Y=[];Y[1]=I+1,Y[0]=(1<<I+1)-1,U(Y)}return G(65497),Buffer.from(f)},(new Date).getTime(),e||(e=50),function(){for(var e=String.fromCharCode,t=0;t<256;t++)C[t]=e(t)}(),t=M(y,Q),i=M(x,v),r=M(b,k),s=M(D,S),function(){for(var e=1,t=2,i=1;i<=15;i++){for(var r=e;r<t;r++)g[32767+r]=i,c[32767+r]=[],c[32767+r][1]=i,c[32767+r][0]=r;for(var s=-(t-1);s<=-e;s++)g[32767+s]=i,c[32767+s]=[],c[32767+s][1]=i,c[32767+s][0]=t-1+s;e<<=1,t<<=1}}(),function(){for(var e=0;e<256;e++)B[e]=19595*e,B[e+256>>0]=38470*e,B[e+512>>0]=7471*e+32768,B[e+768>>0]=-11059*e,B[e+1024>>0]=-21709*e,B[e+1280>>0]=32768*e+8421375,B[e+1536>>0]=-27439*e,B[e+1792>>0]=-5329*e}(),R(e),(new Date).getTime()}Un.exports=function(e,i){void 0===i&&(i=50);var r=new t(i),s=r.encode(e,i);return{data:s,width:e.width,height:e.height}}}();var Tn=Un.exports,Gn={exports:{}};!function(e){var t=function(){var e=new Int32Array([0,1,8,16,9,2,3,10,17,24,32,25,18,11,4,5,12,19,26,33,40,48,41,34,27,20,13,6,7,14,21,28,35,42,49,56,57,50,43,36,29,22,15,23,30,37,44,51,58,59,52,45,38,31,39,46,53,60,61,54,47,55,62,63]),t=4017,i=799,r=3406,s=2276,n=1567,a=3784,o=5793,A=2896;function l(){}function h(e,t){for(var i,r,s=0,n=[],a=16;a>0&&!e[a-1];)a--;n.push({children:[],index:0});var o,A=n[0];for(i=0;i<a;i++){for(r=0;r<e[i];r++){for((A=n.pop()).children[A.index]=t[s];A.index>0;){if(0===n.length)throw new Error("Could not recreate Huffman Table");A=n.pop()}for(A.index++,n.push(A);n.length<=i;)n.push(o={children:[],index:0}),A.children[A.index]=o.children,A=o;s++}i+1<a&&(n.push(o={children:[],index:0}),A.children[A.index]=o.children,A=o)}return n[0].children}function c(t,i,r,s,n,a,o,A,l,h){r.precision,r.samplesPerLine,r.scanLines;var c=r.mcusPerLine,g=r.progressive;r.maxH,r.maxV;var u=i,d=0,f=0;function p(){if(f>0)return f--,d>>f&1;if(255==(d=t[i++])){var e=t[i++];if(e)throw new Error("unexpected marker: "+(d<<8|e).toString(16))}return f=7,d>>>7}function I(e){for(var t,i=e;null!==(t=p());){if("number"==typeof(i=i[t]))return i;if("object"!=typeof i)throw new Error("invalid huffman sequence")}return null}function m(e){for(var t=0;e>0;){var i=p();if(null===i)return;t=t<<1|i,e--}return t}function _(e){var t=m(e);return t>=1<<e-1?t:t+(-1<<e)+1}var w=0;var C,B=0;function E(e,t,i,r,s){var n=i%c,a=(i/c|0)*e.v+r,o=n*e.h+s;void 0===e.blocks[a]&&h.tolerantDecoding||t(e,e.blocks[a][o])}function y(e,t,i){var r=i/e.blocksPerLine|0,s=i%e.blocksPerLine;void 0===e.blocks[r]&&h.tolerantDecoding||t(e,e.blocks[r][s])}var Q,b,k,x,v,D,S=s.length;D=g?0===a?0===A?function(e,t){var i=I(e.huffmanTableDC),r=0===i?0:_(i)<<l;t[0]=e.pred+=r}:function(e,t){t[0]|=p()<<l}:0===A?function(t,i){if(w>0)w--;else for(var r=a,s=o;r<=s;){var n=I(t.huffmanTableAC),A=15&n,h=n>>4;if(0!==A)i[e[r+=h]]=_(A)*(1<<l),r++;else{if(h<15){w=m(h)+(1<<h)-1;break}r+=16}}}:function(t,i){for(var r=a,s=o,n=0;r<=s;){var A=e[r],h=i[A]<0?-1:1;switch(B){case 0:var c=I(t.huffmanTableAC),g=15&c;if(n=c>>4,0===g)n<15?(w=m(n)+(1<<n),B=4):(n=16,B=1);else{if(1!==g)throw new Error("invalid ACn encoding");C=_(g),B=n?2:3}continue;case 1:case 2:i[A]?i[A]+=(p()<<l)*h:0==--n&&(B=2==B?3:0);break;case 3:i[A]?i[A]+=(p()<<l)*h:(i[A]=C<<l,B=0);break;case 4:i[A]&&(i[A]+=(p()<<l)*h)}r++}4===B&&0==--w&&(B=0)}:function(t,i){var r=I(t.huffmanTableDC),s=0===r?0:_(r);i[0]=t.pred+=s;for(var n=1;n<64;){var a=I(t.huffmanTableAC),o=15&a,A=a>>4;if(0!==o)i[e[n+=A]]=_(o),n++;else{if(A<15)break;n+=16}}};var M,U,T,G,L=0;for(U=1==S?s[0].blocksPerLine*s[0].blocksPerColumn:c*r.mcusPerColumn,n||(n=U);L<U;){for(b=0;b<S;b++)s[b].pred=0;if(w=0,1==S)for(Q=s[0],v=0;v<n;v++)y(Q,D,L),L++;else for(v=0;v<n;v++){for(b=0;b<S;b++)for(T=(Q=s[b]).h,G=Q.v,k=0;k<G;k++)for(x=0;x<T;x++)E(Q,D,L,k,x);if(++L===U)break}if(L===U)do{if(255===t[i]&&0!==t[i+1])break;i+=1}while(i<t.length-2);if(f=0,(M=t[i]<<8|t[i+1])<65280)throw new Error("marker was not found");if(!(M>=65488&&M<=65495))break;i+=2}return i-u}function g(e,l){var h,c,g=[],u=l.blocksPerLine,d=l.blocksPerColumn,f=u<<3,I=new Int32Array(64),m=new Uint8Array(64);function _(e,h,c){var g,u,d,f,p,I,m,_,w,C,B=l.quantizationTable,E=c;for(C=0;C<64;C++)E[C]=e[C]*B[C];for(C=0;C<8;++C){var y=8*C;0!=E[1+y]||0!=E[2+y]||0!=E[3+y]||0!=E[4+y]||0!=E[5+y]||0!=E[6+y]||0!=E[7+y]?(g=o*E[0+y]+128>>8,u=o*E[4+y]+128>>8,d=E[2+y],f=E[6+y],p=A*(E[1+y]-E[7+y])+128>>8,_=A*(E[1+y]+E[7+y])+128>>8,I=E[3+y]<<4,m=E[5+y]<<4,w=g-u+1>>1,g=g+u+1>>1,u=w,w=d*a+f*n+128>>8,d=d*n-f*a+128>>8,f=w,w=p-m+1>>1,p=p+m+1>>1,m=w,w=_+I+1>>1,I=_-I+1>>1,_=w,w=g-f+1>>1,g=g+f+1>>1,f=w,w=u-d+1>>1,u=u+d+1>>1,d=w,w=p*s+_*r+2048>>12,p=p*r-_*s+2048>>12,_=w,w=I*i+m*t+2048>>12,I=I*t-m*i+2048>>12,m=w,E[0+y]=g+_,E[7+y]=g-_,E[1+y]=u+m,E[6+y]=u-m,E[2+y]=d+I,E[5+y]=d-I,E[3+y]=f+p,E[4+y]=f-p):(w=o*E[0+y]+512>>10,E[0+y]=w,E[1+y]=w,E[2+y]=w,E[3+y]=w,E[4+y]=w,E[5+y]=w,E[6+y]=w,E[7+y]=w)}for(C=0;C<8;++C){var Q=C;0!=E[8+Q]||0!=E[16+Q]||0!=E[24+Q]||0!=E[32+Q]||0!=E[40+Q]||0!=E[48+Q]||0!=E[56+Q]?(g=o*E[0+Q]+2048>>12,u=o*E[32+Q]+2048>>12,d=E[16+Q],f=E[48+Q],p=A*(E[8+Q]-E[56+Q])+2048>>12,_=A*(E[8+Q]+E[56+Q])+2048>>12,I=E[24+Q],m=E[40+Q],w=g-u+1>>1,g=g+u+1>>1,u=w,w=d*a+f*n+2048>>12,d=d*n-f*a+2048>>12,f=w,w=p-m+1>>1,p=p+m+1>>1,m=w,w=_+I+1>>1,I=_-I+1>>1,_=w,w=g-f+1>>1,g=g+f+1>>1,f=w,w=u-d+1>>1,u=u+d+1>>1,d=w,w=p*s+_*r+2048>>12,p=p*r-_*s+2048>>12,_=w,w=I*i+m*t+2048>>12,I=I*t-m*i+2048>>12,m=w,E[0+Q]=g+_,E[56+Q]=g-_,E[8+Q]=u+m,E[48+Q]=u-m,E[16+Q]=d+I,E[40+Q]=d-I,E[24+Q]=f+p,E[32+Q]=f-p):(w=o*c[C+0]+8192>>14,E[0+Q]=w,E[8+Q]=w,E[16+Q]=w,E[24+Q]=w,E[32+Q]=w,E[40+Q]=w,E[48+Q]=w,E[56+Q]=w)}for(C=0;C<64;++C){var b=128+(E[C]+8>>4);h[C]=b<0?0:b>255?255:b}}p(f*d*8);for(var w=0;w<d;w++){var C=w<<3;for(h=0;h<8;h++)g.push(new Uint8Array(f));for(var B=0;B<u;B++){_(l.blocks[w][B],m,I);var E=0,y=B<<3;for(c=0;c<8;c++){var Q=g[C+c];for(h=0;h<8;h++)Q[y+h]=m[E++]}}}return g}function u(e){return e<0?0:e>255?255:e}l.prototype={load:function(e){var t=new XMLHttpRequest;t.open("GET",e,!0),t.responseType="arraybuffer",t.onload=function(){var e=new Uint8Array(t.response||t.mozResponseArrayBuffer);this.parse(e),this.onload&&this.onload()}.bind(this),t.send(null)},parse:function(t){var i=1e3*this.opts.maxResolutionInMP*1e3,r=0;function s(){var e=t[r]<<8|t[r+1];return r+=2,e}function n(e){var t,i,r=1,s=1;for(i in e.components)e.components.hasOwnProperty(i)&&(r<(t=e.components[i]).h&&(r=t.h),s<t.v&&(s=t.v));var n=Math.ceil(e.samplesPerLine/8/r),a=Math.ceil(e.scanLines/8/s);for(i in e.components)if(e.components.hasOwnProperty(i)){t=e.components[i];var o=Math.ceil(Math.ceil(e.samplesPerLine/8)*t.h/r),A=Math.ceil(Math.ceil(e.scanLines/8)*t.v/s),l=n*t.h,h=a*t.v,c=[];p(256*(h*l));for(var g=0;g<h;g++){for(var u=[],d=0;d<l;d++)u.push(new Int32Array(64));c.push(u)}t.blocksPerLine=o,t.blocksPerColumn=A,t.blocks=c}e.maxH=r,e.maxV=s,e.mcusPerLine=n,e.mcusPerColumn=a}t.length;var a,o,A,l,u=null,d=null,f=[],I=[],m=[],_=[],w=s(),C=-1;if(this.comments=[],65496!=w)throw new Error("SOI not found");for(w=s();65497!=w;){switch(w){case 65280:break;case 65504:case 65505:case 65506:case 65507:case 65508:case 65509:case 65510:case 65511:case 65512:case 65513:case 65514:case 65515:case 65516:case 65517:case 65518:case 65519:case 65534:var B=(A=void 0,l=void 0,A=s(),l=t.subarray(r,r+A-2),r+=l.length,l);if(65534===w){var E=String.fromCharCode.apply(null,B);this.comments.push(E)}65504===w&&74===B[0]&&70===B[1]&&73===B[2]&&70===B[3]&&0===B[4]&&(u={version:{major:B[5],minor:B[6]},densityUnits:B[7],xDensity:B[8]<<8|B[9],yDensity:B[10]<<8|B[11],thumbWidth:B[12],thumbHeight:B[13],thumbData:B.subarray(14,14+3*B[12]*B[13])}),65505===w&&69===B[0]&&120===B[1]&&105===B[2]&&102===B[3]&&0===B[4]&&(this.exifBuffer=B.subarray(5,B.length)),65518===w&&65===B[0]&&100===B[1]&&111===B[2]&&98===B[3]&&101===B[4]&&0===B[5]&&(d={version:B[6],flags0:B[7]<<8|B[8],flags1:B[9]<<8|B[10],transformCode:B[11]});break;case 65499:for(var y=s()+r-2;r<y;){var Q=t[r++];p(256);var b=new Int32Array(64);if(Q>>4==0)for(Y=0;Y<64;Y++){b[e[Y]]=t[r++]}else{if(Q>>4!=1)throw new Error("DQT: invalid table spec");for(Y=0;Y<64;Y++){b[e[Y]]=s()}}f[15&Q]=b}break;case 65472:case 65473:case 65474:s(),(a={}).extended=65473===w,a.progressive=65474===w,a.precision=t[r++],a.scanLines=s(),a.samplesPerLine=s(),a.components={},a.componentsOrder=[];var k=a.scanLines*a.samplesPerLine;if(k>i){var x=Math.ceil((k-i)/1e6);throw new Error(`maxResolutionInMP limit exceeded by ${x}MP`)}var v,D=t[r++];for(V=0;V<D;V++){v=t[r];var S=t[r+1]>>4,M=15&t[r+1],U=t[r+2];if(S<=0||M<=0)throw new Error("Invalid sampling factor, expected values above 0");a.componentsOrder.push(v),a.components[v]={h:S,v:M,quantizationIdx:U},r+=3}n(a),I.push(a);break;case 65476:var T=s();for(V=2;V<T;){var G=t[r++],L=new Uint8Array(16),R=0;for(Y=0;Y<16;Y++,r++)R+=L[Y]=t[r];p(16+R);var F=new Uint8Array(R);for(Y=0;Y<R;Y++,r++)F[Y]=t[r];V+=17+R,(G>>4==0?_:m)[15&G]=h(L,F)}break;case 65501:s(),o=s();break;case 65500:s(),s();break;case 65498:s();var N=t[r++],O=[];for(V=0;V<N;V++){j=a.components[t[r++]];var P=t[r++];j.huffmanTableDC=_[P>>4],j.huffmanTableAC=m[15&P],O.push(j)}var z=t[r++],q=t[r++],K=t[r++],H=c(t,r,a,O,o,z,q,K>>4,15&K,this.opts);r+=H;break;case 65535:255!==t[r]&&r--;break;default:if(255==t[r-3]&&t[r-2]>=192&&t[r-2]<=254){r-=3;break}if(224===w||225==w){if(-1!==C)throw new Error(`first unknown JPEG marker at offset ${C.toString(16)}, second unknown JPEG marker ${w.toString(16)} at offset ${(r-1).toString(16)}`);C=r-1;const e=s();if(255===t[r+e-2]){r+=e-2;break}}throw new Error("unknown JPEG marker "+w.toString(16))}w=s()}if(1!=I.length)throw new Error("only single frame JPEGs supported");for(var V=0;V<I.length;V++){var J=I[V].components;for(var Y in J)J[Y].quantizationTable=f[J[Y].quantizationIdx],delete J[Y].quantizationIdx}this.width=a.samplesPerLine,this.height=a.scanLines,this.jfif=u,this.adobe=d,this.components=[];for(V=0;V<a.componentsOrder.length;V++){var j=a.components[a.componentsOrder[V]];this.components.push({lines:g(0,j),scaleX:j.h/a.maxH,scaleY:j.v/a.maxV})}},getData:function(e,t){var i,r,s,n,a,o,A,l,h,c,g,d,f,I,m,_,w,C,B,E,y,Q=this.width/e,b=this.height/t,k=0,x=e*t*this.components.length;p(x);var v=new Uint8Array(x);switch(this.components.length){case 1:for(i=this.components[0],c=0;c<t;c++)for(a=i.lines[0|c*i.scaleY*b],h=0;h<e;h++)g=a[0|h*i.scaleX*Q],v[k++]=g;break;case 2:for(i=this.components[0],r=this.components[1],c=0;c<t;c++)for(a=i.lines[0|c*i.scaleY*b],o=r.lines[0|c*r.scaleY*b],h=0;h<e;h++)g=a[0|h*i.scaleX*Q],v[k++]=g,g=o[0|h*r.scaleX*Q],v[k++]=g;break;case 3:for(y=!0,this.adobe&&this.adobe.transformCode?y=!0:void 0!==this.opts.colorTransform&&(y=!!this.opts.colorTransform),i=this.components[0],r=this.components[1],s=this.components[2],c=0;c<t;c++)for(a=i.lines[0|c*i.scaleY*b],o=r.lines[0|c*r.scaleY*b],A=s.lines[0|c*s.scaleY*b],h=0;h<e;h++)y?(g=a[0|h*i.scaleX*Q],d=o[0|h*r.scaleX*Q],C=u(g+1.402*((f=A[0|h*s.scaleX*Q])-128)),B=u(g-.3441363*(d-128)-.71413636*(f-128)),E=u(g+1.772*(d-128))):(C=a[0|h*i.scaleX*Q],B=o[0|h*r.scaleX*Q],E=A[0|h*s.scaleX*Q]),v[k++]=C,v[k++]=B,v[k++]=E;break;case 4:if(!this.adobe)throw new Error("Unsupported color mode (4 components)");for(y=!1,this.adobe&&this.adobe.transformCode?y=!0:void 0!==this.opts.colorTransform&&(y=!!this.opts.colorTransform),i=this.components[0],r=this.components[1],s=this.components[2],n=this.components[3],c=0;c<t;c++)for(a=i.lines[0|c*i.scaleY*b],o=r.lines[0|c*r.scaleY*b],A=s.lines[0|c*s.scaleY*b],l=n.lines[0|c*n.scaleY*b],h=0;h<e;h++)y?(g=a[0|h*i.scaleX*Q],d=o[0|h*r.scaleX*Q],f=A[0|h*s.scaleX*Q],I=l[0|h*n.scaleX*Q],m=255-u(g+1.402*(f-128)),_=255-u(g-.3441363*(d-128)-.71413636*(f-128)),w=255-u(g+1.772*(d-128))):(m=a[0|h*i.scaleX*Q],_=o[0|h*r.scaleX*Q],w=A[0|h*s.scaleX*Q],I=l[0|h*n.scaleX*Q]),v[k++]=255-m,v[k++]=255-_,v[k++]=255-w,v[k++]=255-I;break;default:throw new Error("Unsupported color mode")}return v},copyToImageData:function(e,t){var i,r,s,n,a,o,A,l,h,c=e.width,g=e.height,d=e.data,f=this.getData(c,g),p=0,I=0;switch(this.components.length){case 1:for(r=0;r<g;r++)for(i=0;i<c;i++)s=f[p++],d[I++]=s,d[I++]=s,d[I++]=s,t&&(d[I++]=255);break;case 3:for(r=0;r<g;r++)for(i=0;i<c;i++)A=f[p++],l=f[p++],h=f[p++],d[I++]=A,d[I++]=l,d[I++]=h,t&&(d[I++]=255);break;case 4:for(r=0;r<g;r++)for(i=0;i<c;i++)a=f[p++],o=f[p++],s=f[p++],A=255-u(a*(1-(n=f[p++])/255)+n),l=255-u(o*(1-n/255)+n),h=255-u(s*(1-n/255)+n),d[I++]=A,d[I++]=l,d[I++]=h,t&&(d[I++]=255);break;default:throw new Error("Unsupported color mode")}}};var d=0,f=0;function p(e=0){var t=d+e;if(t>f){var i=Math.ceil((t-f)/1024/1024);throw new Error(`maxMemoryUsageInMB limit exceeded by at least ${i}MB`)}d=t}return l.resetMaxMemoryUsage=function(e){d=0,f=e},l.getBytesAllocated=function(){return d},l.requestMemoryAllocation=p,l}();e.exports=function(e,i={}){var r={colorTransform:void 0,useTArray:!1,formatAsRGBA:!0,tolerantDecoding:!0,maxResolutionInMP:100,maxMemoryUsageInMB:512,...i},s=new Uint8Array(e),n=new t;n.opts=r,t.resetMaxMemoryUsage(1024*r.maxMemoryUsageInMB*1024),n.parse(s);var a=r.formatAsRGBA?4:3,o=n.width*n.height*a;try{t.requestMemoryAllocation(o);var A={width:n.width,height:n.height,exifBuffer:n.exifBuffer,data:r.useTArray?new Uint8Array(o):Buffer.alloc(o)};n.comments.length>0&&(A.comments=n.comments)}catch(e){if(e instanceof RangeError)throw new Error("Could not allocate enough memory for the image. Required: "+o);if(e instanceof ReferenceError&&"Buffer is not defined"===e.message)throw new Error("Buffer is not globally defined in this environment. Consider setting useTArray to true");throw e}return n.copyToImageData(A,r.formatAsRGBA),A}}(Gn);var Ln=Mn({encode:Tn,decode:Gn.exports});const Rn=Math.PI,Fn=Rn/4,Nn=180/Rn;function On(e,t){let i=e.length-t,r=0;do{for(let i=t;i>0;i--)e[r+t]+=e[r],r++;i-=t}while(i>0)}function Pn(e,t,i){let r=0,s=e.length;const n=s/i;for(;s>t;){for(let i=t;i>0;--i)e[r+t]+=e[r],++r;s-=t}const a=e.slice();for(let t=0;t<n;++t)for(let r=0;r<i;++r)e[i*t+r]=a[(i-r-1)*n+t]}let zn=class{async decode(e,t){const i=await this.decodeBlock(t),r=e.Predictor||1;if(1!==r){const t=!e.StripOffsets;return function(e,t,i,r,s,n){if(!t||1===t)return e;for(let e=0;e<s.length;++e){if(s[e]%8!=0)throw new Error("When decoding with predictor, only multiple of 8 bits are supported.");if(s[e]!==s[0])throw new Error("When decoding with predictor, all samples must have the same size.")}const a=s[0]/8,o=2===n?1:s.length;for(let n=0;n<r&&!(n*o*i*a>=e.byteLength);++n){let r;if(2===t){switch(s[0]){case 8:r=new Uint8Array(e,n*o*i*a,o*i*a);break;case 16:r=new Uint16Array(e,n*o*i*a,o*i*a/2);break;case 32:r=new Uint32Array(e,n*o*i*a,o*i*a/4);break;default:throw new Error(`Predictor 2 not allowed with ${s[0]} bits per sample.`)}On(r,o)}else 3===t&&(r=new Uint8Array(e,n*o*i*a,o*i*a),Pn(r,o,a))}return e}(i,r,t?e.TileWidth:e.ImageWidth,t?e.TileLength:e.RowsPerStrip||e.ImageLength,e.BitsPerSample,e.PlanarConfiguration)}return i}};const qn=257;function Kn(e,t){for(let i=t.length-1;i>=0;i--)e.push(t[i]);return e}function Hn(e){const t=new Uint16Array(4093),i=new Uint8Array(4093);for(let e=0;e<=257;e++)t[e]=4096,i[e]=e;let r=258,s=9,n=0;function a(){r=258,s=9}function o(e){const t=function(e,t,i){const r=t%8,s=Math.floor(t/8),n=8-r,a=t+i-8*(s+1);let o=8*(s+2)-(t+i);const A=8*(s+2)-t;if(o=Math.max(0,o),s>=e.length)return console.warn("ran off the end of the buffer before finding EOI_CODE (end on input code)"),qn;let l=e[s]&2**(8-r)-1;l<<=i-n;let h=l;if(s+1<e.length){let t=e[s+1]>>>o;t<<=Math.max(0,i-A),h+=t}if(a>8&&s+2<e.length){const r=8*(s+3)-(t+i);h+=e[s+2]>>>r}return h}(e,n,s);return n+=s,t}function A(e,s){return i[r]=s,t[r]=e,r++,r-1}function l(e){const r=[];for(let s=e;4096!==s;s=t[s])r.push(i[s]);return r}const h=[];a();const c=new Uint8Array(e);let g,u=o(c);for(;u!==qn;){if(256===u){for(a(),u=o(c);256===u;)u=o(c);if(u===qn)break;if(u>256)throw new Error(`corrupted code at scanline ${u}`);Kn(h,l(u)),g=u}else if(u<r){const e=l(u);Kn(h,e),A(g,e[e.length-1]),g=u}else{const e=l(g);if(!e)throw new Error(`Bogus entry. Not in dictionary,\n ${g} / ${r},\n position: ${n}`);Kn(h,e),h.push(e[e.length-1]),A(g,e[e.length-1]),g=u}r+1>=2**s&&(12===s?g=void 0:s++),u=o(c)}return new Uint8Array(h)}let Vn=class extends zn{decodeBlock(e){return Hn(e).buffer}};function Jn(e){return(t,...i)=>jn(e,t,i)}function Yn(e,t){return Jn($n(e,t).get)}const{apply:jn,construct:Zn,defineProperty:Wn,get:Xn,getOwnPropertyDescriptor:$n,getPrototypeOf:ea,has:ta,ownKeys:ia,set:ra,setPrototypeOf:sa}=Reflect,{iterator:na,species:aa,toStringTag:oa,for:Aa}=Symbol,la=Object,{create:ha,defineProperty:ca,freeze:ga,is:ua}=la,da=Array.prototype[na],fa=Jn(da),pa=ArrayBuffer;Yn(pa.prototype,"byteLength");const Ia="undefined"!=typeof SharedArrayBuffer?SharedArrayBuffer:null;Ia&&Yn(Ia.prototype,"byteLength");const ma=ea(Uint8Array);ma.from;const _a=ma.prototype;_a[na],Jn(_a.keys),Jn(_a.values),Jn(_a.entries),Jn(_a.set),Jn(_a.reverse),Jn(_a.fill),Jn(_a.copyWithin),Jn(_a.sort),Jn(_a.slice),Jn(_a.subarray),Yn(_a,"buffer"),Yn(_a,"byteOffset"),Yn(_a,"length"),Yn(_a,oa);const wa=Uint32Array,Ca=Float32Array,Ba=ea([][na]()),Ea=Jn(Ba.next),ya=Jn(function*(){}().next),Qa=ea(Ba),ba=Jn(DataView.prototype.getUint16),ka=WeakMap,xa=ka.prototype,va=Jn(xa.get),Da=Jn(xa.set),Sa=new ka,Ma=ha(null,{next:{value:function(){const e=va(Sa,this);return Ea(e)}},[na]:{value:function(){return this}}});const Ua=new ka,Ta=ha(Qa,{next:{value:function(){const e=va(Ua,this);return ya(e)},writable:!0,configurable:!0}});for(const e of ia(Ba))"next"!==e&&ca(Ta,e,$n(Ba,e));const Ga=new pa(4),La=new Ca(Ga),Ra=new wa(Ga),Fa=new wa(512),Na=new wa(512);for(let e=0;e<256;++e){const t=e-127;t<-27?(Fa[e]=0,Fa[256|e]=32768,Na[e]=24,Na[256|e]=24):t<-14?(Fa[e]=1024>>-t-14,Fa[256|e]=1024>>-t-14|32768,Na[e]=-t-1,Na[256|e]=-t-1):t<=15?(Fa[e]=t+15<<10,Fa[256|e]=t+15<<10|32768,Na[e]=13,Na[256|e]=13):t<128?(Fa[e]=31744,Fa[256|e]=64512,Na[e]=24,Na[256|e]=24):(Fa[e]=31744,Fa[256|e]=64512,Na[e]=13,Na[256|e]=13)}const Oa=new wa(2048),Pa=new wa(64),za=new wa(64);for(let e=1;e<1024;++e){let t=e<<13,i=0;for(;0==(8388608&t);)t<<=1,i-=8388608;t&=-8388609,i+=947912704,Oa[e]=t|i}for(let e=1024;e<2048;++e)Oa[e]=939524096+(e-1024<<13);for(let e=1;e<31;++e)Pa[e]=e<<23;Pa[31]=1199570944,Pa[32]=2147483648;for(let e=33;e<63;++e)Pa[e]=2147483648+(e-32<<23);Pa[63]=3347054592;for(let e=1;e<64;++e)32!==e&&(za[e]=1024);function qa(e,t,...i){return function(e){const t=e>>10;return Ra[0]=Oa[za[t]+(1023&e)]+Pa[t],La[0]}(ba(e,t,...function(e){if(e[na]===da&&Ba.next===Ea)return e;const t=ha(Ma);return Da(Sa,t,fa(e)),t}(i)))}var Ka={exports:{}};function Ha(e,t,i){const r=i&&i.debug||!1;r&&console.log("[xml-utils] getting "+t+" in "+e);const s="object"==typeof e?e.outer:e,n=s.slice(0,s.indexOf(">")+1),a=['"',"'"];for(let e=0;e<a.length;e++){const i=a[e],s=t+"\\="+i+"([^"+i+"]*)"+i;r&&console.log("[xml-utils] pattern:",s);const o=new RegExp(s).exec(n);if(r&&console.log("[xml-utils] match:",o),o)return o[1]}}Ka.exports=Ha,Ka.exports.default=Ha;var Va=Mn(Ka.exports),Ja={exports:{}},Ya={exports:{}},ja={exports:{}};function Za(e,t,i){const r=new RegExp(t).exec(e.slice(i));return r?i+r.index:-1}ja.exports=Za,ja.exports.default=Za;var Wa=ja.exports,Xa={exports:{}};function $a(e,t,i){const r=new RegExp(t).exec(e.slice(i));return r?i+r.index+r[0].length-1:-1}Xa.exports=$a,Xa.exports.default=$a;var eo=Xa.exports,to={exports:{}};function io(e,t){const i=new RegExp(t,"g"),r=e.match(i);return r?r.length:0}to.exports=io,to.exports.default=io;var ro=to.exports;const so=Wa,no=eo,ao=ro;function oo(e,t,i){const r=i&&i.debug||!1,s=!(i&&!1===typeof i.nested),n=i&&i.startIndex||0;r&&console.log("[xml-utils] starting findTagByName with",t," and ",i);const a=so(e,`<${t}[ \n>/]`,n);if(r&&console.log("[xml-utils] start:",a),-1===a)return;const o=e.slice(a+t.length);let A=no(o,"^[^<]*[ /]>",0);const l=-1!==A&&"/"===o[A-1];if(r&&console.log("[xml-utils] selfClosing:",l),!1===l)if(s){let e=0,i=1,r=0;for(;-1!==(A=no(o,"[ /]"+t+">",e));){const s=o.substring(e,A+1);if(i+=ao(s,"<"+t+"[ \n\t>]"),r+=ao(s,"</"+t+">"),r>=i)break;e=A}}else A=no(o,"[ /]"+t+">",0);const h=a+t.length+A+1;if(r&&console.log("[xml-utils] end:",h),-1===h)return;const c=e.slice(a,h);let g;return g=l?null:c.slice(c.indexOf(">")+1,c.lastIndexOf("<")),{inner:g,outer:c,start:a,end:h}}Ya.exports=oo,Ya.exports.default=oo;const Ao=Ya.exports;function lo(e,t,i){const r=[],s=i&&i.debug||!1,n=!i||"boolean"!=typeof i.nested||i.nested;let a,o=i&&i.startIndex||0;for(;a=Ao(e,t,{debug:s,startIndex:o});)o=n?a.start+1+t.length:a.end,r.push(a);return s&&console.log("findTagsByName found",r.length,"tags"),r}Ja.exports=lo,Ja.exports.default=lo;var ho=Mn(Ja.exports);const co={315:"Artist",258:"BitsPerSample",265:"CellLength",264:"CellWidth",320:"ColorMap",259:"Compression",33432:"Copyright",306:"DateTime",338:"ExtraSamples",266:"FillOrder",289:"FreeByteCounts",288:"FreeOffsets",291:"GrayResponseCurve",290:"GrayResponseUnit",316:"HostComputer",270:"ImageDescription",257:"ImageLength",256:"ImageWidth",271:"Make",281:"MaxSampleValue",280:"MinSampleValue",272:"Model",254:"NewSubfileType",274:"Orientation",262:"PhotometricInterpretation",284:"PlanarConfiguration",296:"ResolutionUnit",278:"RowsPerStrip",277:"SamplesPerPixel",305:"Software",279:"StripByteCounts",273:"StripOffsets",255:"SubfileType",263:"Threshholding",282:"XResolution",283:"YResolution",326:"BadFaxLines",327:"CleanFaxData",343:"ClipPath",328:"ConsecutiveBadFaxLines",433:"Decode",434:"DefaultImageColor",269:"DocumentName",336:"DotRange",321:"HalftoneHints",346:"Indexed",347:"JPEGTables",285:"PageName",297:"PageNumber",317:"Predictor",319:"PrimaryChromaticities",532:"ReferenceBlackWhite",339:"SampleFormat",340:"SMinSampleValue",341:"SMaxSampleValue",559:"StripRowCounts",330:"SubIFDs",292:"T4Options",293:"T6Options",325:"TileByteCounts",323:"TileLength",324:"TileOffsets",322:"TileWidth",301:"TransferFunction",318:"WhitePoint",344:"XClipPathUnits",286:"XPosition",529:"YCbCrCoefficients",531:"YCbCrPositioning",530:"YCbCrSubSampling",345:"YClipPathUnits",287:"YPosition",37378:"ApertureValue",40961:"ColorSpace",36868:"DateTimeDigitized",36867:"DateTimeOriginal",34665:"Exif IFD",36864:"ExifVersion",33434:"ExposureTime",41728:"FileSource",37385:"Flash",40960:"FlashpixVersion",33437:"FNumber",42016:"ImageUniqueID",37384:"LightSource",37500:"MakerNote",37377:"ShutterSpeedValue",37510:"UserComment",33723:"IPTC",34675:"ICC Profile",700:"XMP",42112:"GDAL_METADATA",42113:"GDAL_NODATA",34377:"Photoshop",33550:"ModelPixelScale",33922:"ModelTiepoint",34264:"ModelTransformation",34735:"GeoKeyDirectory",34736:"GeoDoubleParams",34737:"GeoAsciiParams",50674:"LercParameters"},go={};for(const e in co)co.hasOwnProperty(e)&&(go[co[e]]=parseInt(e,10));const uo=[go.BitsPerSample,go.ExtraSamples,go.SampleFormat,go.StripByteCounts,go.StripOffsets,go.StripRowCounts,go.TileByteCounts,go.TileOffsets,go.SubIFDs],fo={1:"BYTE",2:"ASCII",3:"SHORT",4:"LONG",5:"RATIONAL",6:"SBYTE",7:"UNDEFINED",8:"SSHORT",9:"SLONG",10:"SRATIONAL",11:"FLOAT",12:"DOUBLE",13:"IFD",16:"LONG8",17:"SLONG8",18:"IFD8"},po={};for(const e in fo)fo.hasOwnProperty(e)&&(po[fo[e]]=parseInt(e,10));const Io=0,mo=1,_o=2,wo=3,Co=5,Bo=6,Eo=8,yo=0,Qo=1,bo=0,ko=1,xo=2,vo={1024:"GTModelTypeGeoKey",1025:"GTRasterTypeGeoKey",1026:"GTCitationGeoKey",2048:"GeographicTypeGeoKey",2049:"GeogCitationGeoKey",2050:"GeogGeodeticDatumGeoKey",2051:"GeogPrimeMeridianGeoKey",2052:"GeogLinearUnitsGeoKey",2053:"GeogLinearUnitSizeGeoKey",2054:"GeogAngularUnitsGeoKey",2055:"GeogAngularUnitSizeGeoKey",2056:"GeogEllipsoidGeoKey",2057:"GeogSemiMajorAxisGeoKey",2058:"GeogSemiMinorAxisGeoKey",2059:"GeogInvFlatteningGeoKey",2060:"GeogAzimuthUnitsGeoKey",2061:"GeogPrimeMeridianLongGeoKey",2062:"GeogTOWGS84GeoKey",3072:"ProjectedCSTypeGeoKey",3073:"PCSCitationGeoKey",3074:"ProjectionGeoKey",3075:"ProjCoordTransGeoKey",3076:"ProjLinearUnitsGeoKey",3077:"ProjLinearUnitSizeGeoKey",3078:"ProjStdParallel1GeoKey",3079:"ProjStdParallel2GeoKey",3080:"ProjNatOriginLongGeoKey",3081:"ProjNatOriginLatGeoKey",3082:"ProjFalseEastingGeoKey",3083:"ProjFalseNorthingGeoKey",3084:"ProjFalseOriginLongGeoKey",3085:"ProjFalseOriginLatGeoKey",3086:"ProjFalseOriginEastingGeoKey",3087:"ProjFalseOriginNorthingGeoKey",3088:"ProjCenterLongGeoKey",3089:"ProjCenterLatGeoKey",3090:"ProjCenterEastingGeoKey",3091:"ProjCenterNorthingGeoKey",3092:"ProjScaleAtNatOriginGeoKey",3093:"ProjScaleAtCenterGeoKey",3094:"ProjAzimuthAngleGeoKey",3095:"ProjStraightVertPoleLongGeoKey",3096:"ProjRectifiedGridAngleGeoKey",4096:"VerticalCSTypeGeoKey",4097:"VerticalCitationGeoKey",4098:"VerticalDatumGeoKey",4099:"VerticalUnitsGeoKey"};const Do=new Map;function So(e,t){Array.isArray(e)||(e=[e]),e.forEach((e=>Do.set(e,t)))}function Mo(e,t,i,r=1){return new(Object.getPrototypeOf(e).constructor)(t*i*r)}function Uo(e,t,i){return(1-i)*e+i*t}function To(e,t,i,r,s,n="nearest"){switch(n.toLowerCase()){case"nearest":return function(e,t,i,r,s){const n=t/r,a=i/s;return e.map((e=>{const o=Mo(e,r,s);for(let A=0;A<s;++A){const s=Math.min(Math.round(a*A),i-1);for(let i=0;i<r;++i){const a=Math.min(Math.round(n*i),t-1),l=e[s*t+a];o[A*r+i]=l}}return o}))}(e,t,i,r,s);case"bilinear":case"linear":return function(e,t,i,r,s){const n=t/r,a=i/s;return e.map((e=>{const o=Mo(e,r,s);for(let A=0;A<s;++A){const s=a*A,l=Math.floor(s),h=Math.min(Math.ceil(s),i-1);for(let i=0;i<r;++i){const a=n*i,c=a%1,g=Math.floor(a),u=Math.min(Math.ceil(a),t-1),d=e[l*t+g],f=e[l*t+u],p=e[h*t+g],I=e[h*t+u],m=Uo(Uo(d,f,c),Uo(p,I,c),s%1);o[A*r+i]=m}}return o}))}(e,t,i,r,s);default:throw new Error(`Unsupported resampling method: '${n}'`)}}function Go(e,t,i,r,s,n,a="nearest"){switch(a.toLowerCase()){case"nearest":return function(e,t,i,r,s,n){const a=t/r,o=i/s,A=Mo(e,r,s,n);for(let l=0;l<s;++l){const s=Math.min(Math.round(o*l),i-1);for(let i=0;i<r;++i){const o=Math.min(Math.round(a*i),t-1);for(let a=0;a<n;++a){const h=e[s*t*n+o*n+a];A[l*r*n+i*n+a]=h}}}return A}(e,t,i,r,s,n);case"bilinear":case"linear":return function(e,t,i,r,s,n){const a=t/r,o=i/s,A=Mo(e,r,s,n);for(let l=0;l<s;++l){const s=o*l,h=Math.floor(s),c=Math.min(Math.ceil(s),i-1);for(let i=0;i<r;++i){const o=a*i,g=o%1,u=Math.floor(o),d=Math.min(Math.ceil(o),t-1);for(let a=0;a<n;++a){const o=e[h*t*n+u*n+a],f=e[h*t*n+d*n+a],p=e[c*t*n+u*n+a],I=e[c*t*n+d*n+a],m=Uo(Uo(o,f,g),Uo(p,I,g),s%1);A[l*r*n+i*n+a]=m}}}return A}(e,t,i,r,s,n);default:throw new Error(`Unsupported resampling method: '${a}'`)}}function Lo(e,t,i){let r=0;for(let s=t;s<i;++s)r+=e[s];return r}function Ro(e,t,i){switch(e){case 1:if(t<=8)return new Uint8Array(i);if(t<=16)return new Uint16Array(i);if(t<=32)return new Uint32Array(i);break;case 2:if(8===t)return new Int8Array(i);if(16===t)return new Int16Array(i);if(32===t)return new Int32Array(i);break;case 3:switch(t){case 16:case 32:return new Float32Array(i);case 64:return new Float64Array(i)}}throw Error("Unsupported data format/bitsPerSample")}So([void 0,1],(()=>Promise.resolve().then((function(){return vA})).then((e=>e.default)))),So(5,(()=>Promise.resolve().then((function(){return UA})).then((e=>e.default)))),So(6,(()=>{throw new Error("old style JPEG compression is not supported.")})),So(7,(()=>Promise.resolve().then((function(){return JA})).then((e=>e.default)))),So([8,32946],(()=>Promise.resolve().then((function(){return ig})).then((e=>e.default)))),So(32773,(()=>Promise.resolve().then((function(){return rg})).then((e=>e.default)))),So(34887,(()=>Promise.resolve().then((function(){return gg})).then((async e=>(await e.zstd.init(),e))).then((e=>e.default)))),So(50001,(()=>Promise.resolve().then((function(){return ug})).then((e=>e.default))));var Fo=class{constructor(e,t,i,r,s,n){this.fileDirectory=e,this.geoKeys=t,this.dataView=i,this.littleEndian=r,this.tiles=s?{}:null,this.isTiled=!e.StripOffsets;const a=e.PlanarConfiguration;if(this.planarConfiguration=void 0===a?1:a,1!==this.planarConfiguration&&2!==this.planarConfiguration)throw new Error("Invalid planar configuration.");this.source=n}getFileDirectory(){return this.fileDirectory}getGeoKeys(){return this.geoKeys}getWidth(){return this.fileDirectory.ImageWidth}getHeight(){return this.fileDirectory.ImageLength}getSamplesPerPixel(){return void 0!==this.fileDirectory.SamplesPerPixel?this.fileDirectory.SamplesPerPixel:1}getTileWidth(){return this.isTiled?this.fileDirectory.TileWidth:this.getWidth()}getTileHeight(){return this.isTiled?this.fileDirectory.TileLength:void 0!==this.fileDirectory.RowsPerStrip?Math.min(this.fileDirectory.RowsPerStrip,this.getHeight()):this.getHeight()}getBlockWidth(){return this.getTileWidth()}getBlockHeight(e){return this.isTiled||(e+1)*this.getTileHeight()<=this.getHeight()?this.getTileHeight():this.getHeight()-e*this.getTileHeight()}getBytesPerPixel(){let e=0;for(let t=0;t<this.fileDirectory.BitsPerSample.length;++t)e+=this.getSampleByteSize(t);return e}getSampleByteSize(e){if(e>=this.fileDirectory.BitsPerSample.length)throw new RangeError(`Sample index ${e} is out of range.`);return Math.ceil(this.fileDirectory.BitsPerSample[e]/8)}getReaderForSample(e){const t=this.fileDirectory.SampleFormat?this.fileDirectory.SampleFormat[e]:1,i=this.fileDirectory.BitsPerSample[e];switch(t){case 1:if(i<=8)return DataView.prototype.getUint8;if(i<=16)return DataView.prototype.getUint16;if(i<=32)return DataView.prototype.getUint32;break;case 2:if(i<=8)return DataView.prototype.getInt8;if(i<=16)return DataView.prototype.getInt16;if(i<=32)return DataView.prototype.getInt32;break;case 3:switch(i){case 16:return function(e,t){return qa(this,e,t)};case 32:return DataView.prototype.getFloat32;case 64:return DataView.prototype.getFloat64}}throw Error("Unsupported data format/bitsPerSample")}getSampleFormat(e=0){return this.fileDirectory.SampleFormat?this.fileDirectory.SampleFormat[e]:1}getBitsPerSample(e=0){return this.fileDirectory.BitsPerSample[e]}getArrayForSample(e,t){return Ro(this.getSampleFormat(e),this.getBitsPerSample(e),t)}async getTileOrStrip(e,t,i,r,s){const n=Math.ceil(this.getWidth()/this.getTileWidth()),a=Math.ceil(this.getHeight()/this.getTileHeight());let o;const{tiles:A}=this;let l,h;1===this.planarConfiguration?o=t*n+e:2===this.planarConfiguration&&(o=i*n*a+t*n+e),this.isTiled?(l=this.fileDirectory.TileOffsets[o],h=this.fileDirectory.TileByteCounts[o]):(l=this.fileDirectory.StripOffsets[o],h=this.fileDirectory.StripByteCounts[o]);const c=(await this.source.fetch([{offset:l,length:h}],s))[0];let g;return null!==A&&A[o]?g=A[o]:(g=(async()=>{let e=await r.decode(this.fileDirectory,c);const i=this.getSampleFormat(),s=this.getBitsPerSample();return function(e,t){return(1!==e&&2!==e||!(t<=32)||t%8!=0)&&(3!==e||16!==t&&32!==t&&64!==t)}(i,s)&&(e=function(e,t,i,r,s,n,a){const o=new DataView(e),A=2===i?1:r,l=Ro(t,s,2===i?a*n:a*n*r),h=parseInt("1".repeat(s),2);if(1===t){let e;e=1===i?r*s:s;let t=n*e;0!=(7&t)&&(t=t+7&-8);for(let e=0;e<a;++e){const i=e*t;for(let t=0;t<n;++t){const r=i+t*A*s;for(let i=0;i<A;++i){const a=r+i*s,c=(e*n+t)*A+i,g=Math.floor(a/8),u=a%8;if(u+s<=8)l[c]=o.getUint8(g)>>8-s-u&h;else if(u+s<=16)l[c]=o.getUint16(g)>>16-s-u&h;else if(u+s<=24){const e=o.getUint16(g)<<8|o.getUint8(g+2);l[c]=e>>24-s-u&h}else l[c]=o.getUint32(g)>>32-s-u&h}}}}return l.buffer}(e,i,this.planarConfiguration,this.getSamplesPerPixel(),s,this.getTileWidth(),this.getBlockHeight(t))),e})(),null!==A&&(A[o]=g)),{x:e,y:t,sample:i,data:await g}}async _readRaster(e,t,i,r,s,n,a,o,A){const l=this.getTileWidth(),h=this.getTileHeight(),c=this.getWidth(),g=this.getHeight(),u=Math.max(Math.floor(e[0]/l),0),d=Math.min(Math.ceil(e[2]/l),Math.ceil(c/l)),f=Math.max(Math.floor(e[1]/h),0),p=Math.min(Math.ceil(e[3]/h),Math.ceil(g/h)),I=e[2]-e[0];let m=this.getBytesPerPixel();const _=[],w=[];for(let e=0;e<t.length;++e)1===this.planarConfiguration?_.push(Lo(this.fileDirectory.BitsPerSample,0,t[e])/8):_.push(0),w.push(this.getReaderForSample(t[e]));const C=[],{littleEndian:B}=this;for(let n=f;n<p;++n)for(let a=u;a<d;++a){let o;1===this.planarConfiguration&&(o=this.getTileOrStrip(a,n,0,s,A));for(let u=0;u<t.length;++u){const d=u,f=t[u];2===this.planarConfiguration&&(m=this.getSampleByteSize(f),o=this.getTileOrStrip(a,n,f,s,A));const p=o.then((s=>{const n=s.data,a=new DataView(n),o=this.getBlockHeight(s.y),A=s.y*h,u=s.x*l,f=A+o,p=(s.x+1)*l,C=w[d],E=Math.min(o,o-(f-e[3]),g-A),y=Math.min(l,l-(p-e[2]),c-u);for(let s=Math.max(0,e[1]-A);s<E;++s)for(let n=Math.max(0,e[0]-u);n<y;++n){const o=(s*l+n)*m,h=C.call(a,o+_[d],B);let c;r?(c=(s+A-e[1])*I*t.length+(n+u-e[0])*t.length+d,i[c]=h):(c=(s+A-e[1])*I+n+u-e[0],i[d][c]=h)}}));C.push(p)}}if(await Promise.all(C),n&&e[2]-e[0]!==n||a&&e[3]-e[1]!==a){let s;return s=r?Go(i,e[2]-e[0],e[3]-e[1],n,a,t.length,o):To(i,e[2]-e[0],e[3]-e[1],n,a,o),s.width=n,s.height=a,s}return i.width=n||e[2]-e[0],i.height=a||e[3]-e[1],i}async readRasters({window:e,samples:t=[],interleave:i,pool:r=null,width:s,height:n,resampleMethod:a,fillValue:o,signal:A}={}){const l=e||[0,0,this.getWidth(),this.getHeight()];if(l[0]>l[2]||l[1]>l[3])throw new Error("Invalid subsets");const h=(l[2]-l[0])*(l[3]-l[1]),c=this.getSamplesPerPixel();if(t&&t.length){for(let e=0;e<t.length;++e)if(t[e]>=c)return Promise.reject(new RangeError(`Invalid sample index '${t[e]}'.`))}else for(let e=0;e<c;++e)t.push(e);let g;if(i){g=Ro(this.fileDirectory.SampleFormat?Math.max.apply(null,this.fileDirectory.SampleFormat):1,Math.max.apply(null,this.fileDirectory.BitsPerSample),h*t.length),o&&g.fill(o)}else{g=[];for(let e=0;e<t.length;++e){const i=this.getArrayForSample(t[e],h);Array.isArray(o)&&e<o.length?i.fill(o[e]):o&&!Array.isArray(o)&&i.fill(o),g.push(i)}}const u=r||await async function(e){const t=Do.get(e.Compression);if(!t)throw new Error(`Unknown compression method identifier: ${e.Compression}`);return new(await t())(e)}(this.fileDirectory);return await this._readRaster(l,t,g,i,u,s,n,a,A)}async readRGB({window:e,interleave:t=!0,pool:i=null,width:r,height:s,resampleMethod:n,enableAlpha:a=!1,signal:o}={}){const A=e||[0,0,this.getWidth(),this.getHeight()];if(A[0]>A[2]||A[1]>A[3])throw new Error("Invalid subsets");const l=this.fileDirectory.PhotometricInterpretation;if(l===_o){let A=[0,1,2];if(this.fileDirectory.ExtraSamples!==yo&&a){A=[];for(let e=0;e<this.fileDirectory.BitsPerSample.length;e+=1)A.push(e)}return this.readRasters({window:e,interleave:t,samples:A,pool:i,width:r,height:s,resampleMethod:n,signal:o})}let h;switch(l){case Io:case mo:case wo:h=[0];break;case Co:h=[0,1,2,3];break;case Bo:case Eo:h=[0,1,2];break;default:throw new Error("Invalid or unsupported photometric interpretation.")}const c={window:A,interleave:!0,samples:h,pool:i,width:r,height:s,resampleMethod:n,signal:o},{fileDirectory:g}=this,u=await this.readRasters(c),d=2**this.fileDirectory.BitsPerSample[0];let f;switch(l){case Io:f=function(e,t){const{width:i,height:r}=e,s=new Uint8Array(i*r*3);let n;for(let i=0,r=0;i<e.length;++i,r+=3)n=256-e[i]/t*256,s[r]=n,s[r+1]=n,s[r+2]=n;return s}(u,d);break;case mo:f=function(e,t){const{width:i,height:r}=e,s=new Uint8Array(i*r*3);let n;for(let i=0,r=0;i<e.length;++i,r+=3)n=e[i]/t*256,s[r]=n,s[r+1]=n,s[r+2]=n;return s}(u,d);break;case wo:f=function(e,t){const{width:i,height:r}=e,s=new Uint8Array(i*r*3),n=t.length/3,a=t.length/3*2;for(let i=0,r=0;i<e.length;++i,r+=3){const o=e[i];s[r]=t[o]/65536*256,s[r+1]=t[o+n]/65536*256,s[r+2]=t[o+a]/65536*256}return s}(u,g.ColorMap);break;case Co:f=function(e){const{width:t,height:i}=e,r=new Uint8Array(t*i*3);for(let t=0,i=0;t<e.length;t+=4,i+=3){const s=e[t],n=e[t+1],a=e[t+2],o=e[t+3];r[i]=(255-s)/256*255*((255-o)/256),r[i+1]=(255-n)/256*255*((255-o)/256),r[i+2]=(255-a)/256*255*((255-o)/256)}return r}(u);break;case Bo:f=function(e){const{width:t,height:i}=e,r=new Uint8ClampedArray(t*i*3);for(let t=0,i=0;t<e.length;t+=3,i+=3){const s=e[t],n=e[t+1],a=e[t+2];r[i]=s+1.402*(a-128),r[i+1]=s-.34414*(n-128)-.71414*(a-128),r[i+2]=s+1.772*(n-128)}return r}(u);break;case Eo:f=function(e){const{width:t,height:i}=e,r=new Uint8Array(t*i*3);for(let t=0,i=0;t<e.length;t+=3,i+=3){let s,n,a,o=(e[t+0]+16)/116,A=(e[t+1]<<24>>24)/500+o,l=o-(e[t+2]<<24>>24)/200;A=.95047*(A*A*A>.008856?A*A*A:(A-16/116)/7.787),o=1*(o*o*o>.008856?o*o*o:(o-16/116)/7.787),l=1.08883*(l*l*l>.008856?l*l*l:(l-16/116)/7.787),s=3.2406*A+-1.5372*o+-.4986*l,n=-.9689*A+1.8758*o+.0415*l,a=.0557*A+-.204*o+1.057*l,s=s>.0031308?1.055*s**(1/2.4)-.055:12.92*s,n=n>.0031308?1.055*n**(1/2.4)-.055:12.92*n,a=a>.0031308?1.055*a**(1/2.4)-.055:12.92*a,r[i]=255*Math.max(0,Math.min(1,s)),r[i+1]=255*Math.max(0,Math.min(1,n)),r[i+2]=255*Math.max(0,Math.min(1,a))}return r}(u);break;default:throw new Error("Unsupported photometric interpretation.")}if(!t){const e=new Uint8Array(f.length/3),t=new Uint8Array(f.length/3),i=new Uint8Array(f.length/3);for(let r=0,s=0;r<f.length;r+=3,++s)e[s]=f[r],t[s]=f[r+1],i[s]=f[r+2];f=[e,t,i]}return f.width=u.width,f.height=u.height,f}getTiePoints(){if(!this.fileDirectory.ModelTiepoint)return[];const e=[];for(let t=0;t<this.fileDirectory.ModelTiepoint.length;t+=6)e.push({i:this.fileDirectory.ModelTiepoint[t],j:this.fileDirectory.ModelTiepoint[t+1],k:this.fileDirectory.ModelTiepoint[t+2],x:this.fileDirectory.ModelTiepoint[t+3],y:this.fileDirectory.ModelTiepoint[t+4],z:this.fileDirectory.ModelTiepoint[t+5]});return e}getGDALMetadata(e=null){const t={};if(!this.fileDirectory.GDAL_METADATA)return null;const i=this.fileDirectory.GDAL_METADATA;let r=ho(i,"Item");r=null===e?r.filter((e=>void 0===Va(e,"sample"))):r.filter((t=>Number(Va(t,"sample"))===e));for(let e=0;e<r.length;++e){const i=r[e];t[Va(i,"name")]=i.inner}return t}getGDALNoData(){if(!this.fileDirectory.GDAL_NODATA)return null;const e=this.fileDirectory.GDAL_NODATA;return Number(e.substring(0,e.length-1))}getOrigin(){const e=this.fileDirectory.ModelTiepoint,t=this.fileDirectory.ModelTransformation;if(e&&6===e.length)return[e[3],e[4],e[5]];if(t)return[t[3],t[7],t[11]];throw new Error("The image does not have an affine transformation.")}getResolution(e=null){const t=this.fileDirectory.ModelPixelScale,i=this.fileDirectory.ModelTransformation;if(t)return[t[0],-t[1],t[2]];if(i)return 0===i[1]&&0===i[4]?[i[0],-i[5],i[10]]:[Math.sqrt(i[0]*i[0]+i[4]*i[4]),-Math.sqrt(i[1]*i[1]+i[5]*i[5]),i[10]];if(e){const[t,i,r]=e.getResolution();return[t*e.getWidth()/this.getWidth(),i*e.getHeight()/this.getHeight(),r*e.getWidth()/this.getWidth()]}throw new Error("The image does not have an affine transformation.")}pixelIsArea(){return 1===this.geoKeys.GTRasterTypeGeoKey}getBoundingBox(e=!1){const t=this.getHeight(),i=this.getWidth();if(this.fileDirectory.ModelTransformation&&!e){const[e,r,s,n,a,o,A,l]=this.fileDirectory.ModelTransformation,h=[[0,0],[0,t],[i,0],[i,t]].map((([t,i])=>[n+e*t+r*i,l+a*t+o*i])),c=h.map((e=>e[0])),g=h.map((e=>e[1]));return[Math.min(...c),Math.min(...g),Math.max(...c),Math.max(...g)]}{const e=this.getOrigin(),r=this.getResolution(),s=e[0],n=e[1],a=s+r[0]*i,o=n+r[1]*t;return[Math.min(s,a),Math.min(n,o),Math.max(s,a),Math.max(n,o)]}}};class No{constructor(e){this._dataView=new DataView(e)}get buffer(){return this._dataView.buffer}getUint64(e,t){const i=this.getUint32(e,t),r=this.getUint32(e+4,t);let s;if(t){if(s=i+2**32*r,!Number.isSafeInteger(s))throw new Error(`${s} exceeds MAX_SAFE_INTEGER. Precision may be lost. Please report if you get this message to https://github.com/geotiffjs/geotiff.js/issues`);return s}if(s=2**32*i+r,!Number.isSafeInteger(s))throw new Error(`${s} exceeds MAX_SAFE_INTEGER. Precision may be lost. Please report if you get this message to https://github.com/geotiffjs/geotiff.js/issues`);return s}getInt64(e,t){let i=0;const r=(128&this._dataView.getUint8(e+(t?7:0)))>0;let s=!0;for(let n=0;n<8;n++){let a=this._dataView.getUint8(e+(t?n:7-n));r&&(s?0!==a&&(a=255&~(a-1),s=!1):a=255&~a),i+=a*256**n}return r&&(i=-i),i}getUint8(e,t){return this._dataView.getUint8(e,t)}getInt8(e,t){return this._dataView.getInt8(e,t)}getUint16(e,t){return this._dataView.getUint16(e,t)}getInt16(e,t){return this._dataView.getInt16(e,t)}getUint32(e,t){return this._dataView.getUint32(e,t)}getInt32(e,t){return this._dataView.getInt32(e,t)}getFloat16(e,t){return qa(this._dataView,e,t)}getFloat32(e,t){return this._dataView.getFloat32(e,t)}getFloat64(e,t){return this._dataView.getFloat64(e,t)}}class Oo{constructor(e,t,i,r){this._dataView=new DataView(e),this._sliceOffset=t,this._littleEndian=i,this._bigTiff=r}get sliceOffset(){return this._sliceOffset}get sliceTop(){return this._sliceOffset+this.buffer.byteLength}get littleEndian(){return this._littleEndian}get bigTiff(){return this._bigTiff}get buffer(){return this._dataView.buffer}covers(e,t){return this.sliceOffset<=e&&this.sliceTop>=e+t}readUint8(e){return this._dataView.getUint8(e-this._sliceOffset,this._littleEndian)}readInt8(e){return this._dataView.getInt8(e-this._sliceOffset,this._littleEndian)}readUint16(e){return this._dataView.getUint16(e-this._sliceOffset,this._littleEndian)}readInt16(e){return this._dataView.getInt16(e-this._sliceOffset,this._littleEndian)}readUint32(e){return this._dataView.getUint32(e-this._sliceOffset,this._littleEndian)}readInt32(e){return this._dataView.getInt32(e-this._sliceOffset,this._littleEndian)}readFloat32(e){return this._dataView.getFloat32(e-this._sliceOffset,this._littleEndian)}readFloat64(e){return this._dataView.getFloat64(e-this._sliceOffset,this._littleEndian)}readUint64(e){const t=this.readUint32(e),i=this.readUint32(e+4);let r;if(this._littleEndian){if(r=t+2**32*i,!Number.isSafeInteger(r))throw new Error(`${r} exceeds MAX_SAFE_INTEGER. Precision may be lost. Please report if you get this message to https://github.com/geotiffjs/geotiff.js/issues`);return r}if(r=2**32*t+i,!Number.isSafeInteger(r))throw new Error(`${r} exceeds MAX_SAFE_INTEGER. Precision may be lost. Please report if you get this message to https://github.com/geotiffjs/geotiff.js/issues`);return r}readInt64(e){let t=0;const i=(128&this._dataView.getUint8(e+(this._littleEndian?7:0)))>0;let r=!0;for(let s=0;s<8;s++){let n=this._dataView.getUint8(e+(this._littleEndian?s:7-s));i&&(r?0!==n&&(n=255&~(n-1),r=!1):n=255&~n),t+=n*256**s}return i&&(t=-t),t}readOffset(e){return this._bigTiff?this.readUint64(e):this.readUint32(e)}}class Po{async fetch(e,t=undefined){return Promise.all(e.map((e=>this.fetchSlice(e,t))))}async fetchSlice(e){throw new Error(`fetching of slice ${e} not possible, not implemented`)}get fileSize(){return null}async close(){}}class zo extends Error{constructor(e){super(e),Error.captureStackTrace&&Error.captureStackTrace(this,zo),this.name="AbortError"}}class qo extends Po{constructor(e){super(),this.arrayBuffer=e}fetchSlice(e,t){if(t&&t.aborted)throw new zo("Request aborted");return this.arrayBuffer.slice(e.offset,e.offset+e.length)}}function Ko(e,t){let i=e.length-t,r=0;do{for(let i=t;i>0;i--)e[r+t]+=e[r],r++;i-=t}while(i>0)}function Ho(e,t,i){let r=0,s=e.length;const n=s/i;for(;s>t;){for(let i=t;i>0;--i)e[r+t]+=e[r],++r;s-=t}const a=e.slice();for(let t=0;t<n;++t)for(let r=0;r<i;++r)e[i*t+r]=a[(i-r-1)*n+t]}class Vo{async decode(e,t){const i=await this.decodeBlock(t),r=e.Predictor||1;if(1!==r){const t=!e.StripOffsets;return function(e,t,i,r,s,n){if(!t||1===t)return e;for(let e=0;e<s.length;++e){if(s[e]%8!=0)throw new Error("When decoding with predictor, only multiple of 8 bits are supported.");if(s[e]!==s[0])throw new Error("When decoding with predictor, all samples must have the same size.")}const a=s[0]/8,o=2===n?1:s.length;for(let n=0;n<r&&!(n*o*i*a>=e.byteLength);++n){let r;if(2===t){switch(s[0]){case 8:r=new Uint8Array(e,n*o*i*a,o*i*a);break;case 16:r=new Uint16Array(e,n*o*i*a,o*i*a/2);break;case 32:r=new Uint32Array(e,n*o*i*a,o*i*a/4);break;default:throw new Error(`Predictor 2 not allowed with ${s[0]} bits per sample.`)}Ko(r,o)}else 3===t&&(r=new Uint8Array(e,n*o*i*a,o*i*a),Ho(r,o,a))}return e}(i,r,t?e.TileWidth:e.ImageWidth,t?e.TileLength:e.RowsPerStrip||e.ImageLength,e.BitsPerSample,e.PlanarConfiguration)}return i}}function Jo(e){switch(e){case po.BYTE:case po.ASCII:case po.SBYTE:case po.UNDEFINED:return 1;case po.SHORT:case po.SSHORT:return 2;case po.LONG:case po.SLONG:case po.FLOAT:case po.IFD:return 4;case po.RATIONAL:case po.SRATIONAL:case po.DOUBLE:case po.LONG8:case po.SLONG8:case po.IFD8:return 8;default:throw new RangeError(`Invalid field type: ${e}`)}}function Yo(e,t,i,r){let s=null,n=null;const a=Jo(t);switch(t){case po.BYTE:case po.ASCII:case po.UNDEFINED:s=new Uint8Array(i),n=e.readUint8;break;case po.SBYTE:s=new Int8Array(i),n=e.readInt8;break;case po.SHORT:s=new Uint16Array(i),n=e.readUint16;break;case po.SSHORT:s=new Int16Array(i),n=e.readInt16;break;case po.LONG:case po.IFD:s=new Uint32Array(i),n=e.readUint32;break;case po.SLONG:s=new Int32Array(i),n=e.readInt32;break;case po.LONG8:case po.IFD8:s=new Array(i),n=e.readUint64;break;case po.SLONG8:s=new Array(i),n=e.readInt64;break;case po.RATIONAL:s=new Uint32Array(2*i),n=e.readUint32;break;case po.SRATIONAL:s=new Int32Array(2*i),n=e.readInt32;break;case po.FLOAT:s=new Float32Array(i),n=e.readFloat32;break;case po.DOUBLE:s=new Float64Array(i),n=e.readFloat64;break;default:throw new RangeError(`Invalid field type: ${t}`)}if(t!==po.RATIONAL&&t!==po.SRATIONAL)for(let t=0;t<i;++t)s[t]=n.call(e,r+t*a);else for(let t=0;t<i;t+=2)s[t]=n.call(e,r+t*a),s[t+1]=n.call(e,r+(t*a+4));return t===po.ASCII?new TextDecoder("utf-8").decode(s):s}class jo{constructor(e,t,i){this.fileDirectory=e,this.geoKeyDirectory=t,this.nextIFDByteOffset=i}}class Zo extends Error{constructor(e){super(`No image at index ${e}`),this.index=e}}class Wo{async readRasters(e={}){const{window:t,width:i,height:r}=e;let{resX:s,resY:n,bbox:a}=e;const o=await this.getImage();let A=o;const l=await this.getImageCount(),h=o.getBoundingBox();if(t&&a)throw new Error('Both "bbox" and "window" passed.');if(i||r){if(t){const[e,i]=o.getOrigin(),[r,s]=o.getResolution();a=[e+t[0]*r,i+t[1]*s,e+t[2]*r,i+t[3]*s]}const e=a||h;if(i){if(s)throw new Error("Both width and resX passed");s=(e[2]-e[0])/i}if(r){if(n)throw new Error("Both width and resY passed");n=(e[3]-e[1])/r}}if(s||n){const e=[];for(let t=0;t<l;++t){const i=await this.getImage(t),{SubfileType:r,NewSubfileType:s}=i.fileDirectory;(0===t||2===r||1&s)&&e.push(i)}e.sort(((e,t)=>e.getWidth()-t.getWidth()));for(let t=0;t<e.length;++t){const i=e[t],r=(h[2]-h[0])/i.getWidth(),a=(h[3]-h[1])/i.getHeight();if(A=i,s&&s>r||n&&n>a)break}}let c=t;if(a){const[e,t]=o.getOrigin(),[i,r]=A.getResolution(o);c=[Math.round((a[0]-e)/i),Math.round((a[1]-t)/r),Math.round((a[2]-e)/i),Math.round((a[3]-t)/r)],c=[Math.min(c[0],c[2]),Math.min(c[1],c[3]),Math.max(c[0],c[2]),Math.max(c[1],c[3])]}return A.readRasters({...e,window:c})}}class Xo extends Wo{constructor(e,t,i,r,s={}){super(),this.source=e,this.littleEndian=t,this.bigTiff=i,this.firstIFDOffset=r,this.cache=s.cache||!1,this.ifdRequests=[],this.ghostValues=null}async getSlice(e,t){const i=this.bigTiff?4048:1024;return new Oo((await this.source.fetch([{offset:e,length:void 0!==t?t:i}]))[0],e,this.littleEndian,this.bigTiff)}async parseFileDirectoryAt(e){const t=this.bigTiff?20:12,i=this.bigTiff?8:2;let r=await this.getSlice(e);const s=this.bigTiff?r.readUint64(e):r.readUint16(e),n=s*t+(this.bigTiff?16:6);r.covers(e,n)||(r=await this.getSlice(e,n));const a={};let o=e+(this.bigTiff?8:2);for(let e=0;e<s;o+=t,++e){const e=r.readUint16(o),t=r.readUint16(o+2),i=this.bigTiff?r.readUint64(o+4):r.readUint32(o+4);let s,n;const A=Jo(t),l=o+(this.bigTiff?12:8);if(A*i<=(this.bigTiff?8:4))s=Yo(r,t,i,l);else{const e=r.readOffset(l),n=Jo(t)*i;if(r.covers(e,n))s=Yo(r,t,i,e);else{s=Yo(await this.getSlice(e,n),t,i,e)}}n=1===i&&-1===uo.indexOf(e)&&t!==po.RATIONAL&&t!==po.SRATIONAL?s[0]:s,a[co[e]]=n}const A=function(e){const t=e.GeoKeyDirectory;if(!t)return null;const i={};for(let r=4;r<=4*t[3];r+=4){const s=vo[t[r]],n=t[r+1]?co[t[r+1]]:null,a=t[r+2],o=t[r+3];let A=null;if(n){if(A=e[n],null==A)throw new Error(`Could not get value of geoKey '${s}'.`);"string"==typeof A?A=A.substring(o,o+a-1):A.subarray&&(A=A.subarray(o,o+a),1===a&&(A=A[0]))}else A=o;i[s]=A}return i}(a),l=r.readOffset(e+i+t*s);return new jo(a,A,l)}async requestIFD(e){if(this.ifdRequests[e])return this.ifdRequests[e];if(0===e)return this.ifdRequests[e]=this.parseFileDirectoryAt(this.firstIFDOffset),this.ifdRequests[e];if(!this.ifdRequests[e-1])try{this.ifdRequests[e-1]=this.requestIFD(e-1)}catch(t){if(t instanceof Zo)throw new Zo(e);throw t}return this.ifdRequests[e]=(async()=>{const t=await this.ifdRequests[e-1];if(0===t.nextIFDByteOffset)throw new Zo(e);return this.parseFileDirectoryAt(t.nextIFDByteOffset)})(),this.ifdRequests[e]}async getImage(e=0){const t=await this.requestIFD(e);return new Fo(t.fileDirectory,t.geoKeyDirectory,this.dataView,this.littleEndian,this.cache,this.source)}async getImageCount(){let e=0,t=!0;for(;t;)try{await this.requestIFD(e),++e}catch(e){if(!(e instanceof Zo))throw e;t=!1}return e}async getGhostValues(){const e=this.bigTiff?16:8;if(this.ghostValues)return this.ghostValues;const t="GDAL_STRUCTURAL_METADATA_SIZE=",i=t.length+100;let r=await this.getSlice(e,i);if(t===Yo(r,po.ASCII,t.length,e)){const t=Yo(r,po.ASCII,i,e).split("\n")[0],s=Number(t.split("=")[1].split(" ")[0])+t.length;s>i&&(r=await this.getSlice(e,s));const n=Yo(r,po.ASCII,s,e);this.ghostValues={},n.split("\n").filter((e=>e.length>0)).map((e=>e.split("="))).forEach((([e,t])=>{this.ghostValues[e]=t}))}return this.ghostValues}static async fromSource(e,t,i){const r=(await e.fetch([{offset:0,length:1024}],i))[0],s=new No(r),n=s.getUint16(0,0);let a;if(18761===n)a=!0;else{if(19789!==n)throw new TypeError("Invalid byte order value.");a=!1}const o=s.getUint16(2,a);let A;if(42===o)A=!1;else{if(43!==o)throw new TypeError("Invalid magic number.");A=!0;if(8!==s.getUint16(4,a))throw new Error("Unsupported offset byte-size.")}const l=A?s.getUint64(8,a):s.getUint32(4,a);return new Xo(e,a,A,l,t)}close(){return"function"==typeof this.source.close&&this.source.close()}}async function $o(e,t){return Xo.fromSource(function(e){return new qo(e)}(e),t)}class eA{constructor(e=257){this.gridSize=e;const t=e-1;if(t&t-1)throw new Error(`Expected grid size to be 2^n+1, got ${e}.`);this.numTriangles=t*t*2-2,this.numParentTriangles=this.numTriangles-t*t,this.indices=new Uint32Array(this.gridSize*this.gridSize),this.coords=new Uint16Array(4*this.numTriangles);for(let e=0;e<this.numTriangles;e++){let i=e+2,r=0,s=0,n=0,a=0,o=0,A=0;for(1&i?n=a=o=t:r=s=A=t;(i>>=1)>1;){const e=r+n>>1,t=s+a>>1;1&i?(n=r,a=s,r=o,s=A):(r=n,s=a,n=o,a=A),o=e,A=t}const l=4*e;this.coords[l+0]=r,this.coords[l+1]=s,this.coords[l+2]=n,this.coords[l+3]=a}}createTile(e){return new tA(e,this)}}class tA{constructor(e,t){const i=t.gridSize;if(e.length!==i*i)throw new Error(`Expected terrain data of length ${i*i} (${i} x ${i}), got ${e.length}.`);this.terrain=e,this.martini=t,this.errors=new Float32Array(e.length),this.update()}update(){const{numTriangles:e,numParentTriangles:t,coords:i,gridSize:r}=this.martini,{terrain:s,errors:n}=this;for(let a=e-1;a>=0;a--){const e=4*a,o=i[e+0],A=i[e+1],l=i[e+2],h=i[e+3],c=o+l>>1,g=A+h>>1,u=c+g-A,d=g+o-c,f=(s[A*r+o]+s[h*r+l])/2,p=g*r+c,I=Math.abs(f-s[p]);if(n[p]=Math.max(n[p],I),a<t){const e=(A+d>>1)*r+(o+u>>1),t=(h+d>>1)*r+(l+u>>1);n[p]=Math.max(n[p],n[e],n[t])}}}getMesh(e=0){const{gridSize:t,indices:i}=this.martini,{errors:r}=this;let s=0,n=0;const a=t-1;function o(a,A,l,h,c,g){const u=a+l>>1,d=A+h>>1;Math.abs(a-c)+Math.abs(A-g)>1&&r[d*t+u]>e?(o(c,g,a,A,u,d),o(l,h,c,g,u,d)):(i[A*t+a]=i[A*t+a]||++s,i[h*t+l]=i[h*t+l]||++s,i[g*t+c]=i[g*t+c]||++s,n++)}i.fill(0),o(0,0,a,a,a,0),o(a,a,0,0,0,a);const A=new Uint16Array(2*s),l=new Uint32Array(3*n);let h=0;function c(s,n,a,o,g,u){const d=s+a>>1,f=n+o>>1;if(Math.abs(s-g)+Math.abs(n-u)>1&&r[f*t+d]>e)c(g,u,s,n,d,f),c(a,o,g,u,d,f);else{const e=i[n*t+s]-1,r=i[o*t+a]-1,c=i[u*t+g]-1;A[2*e]=s,A[2*e+1]=n,A[2*r]=a,A[2*r+1]=o,A[2*c]=g,A[2*c+1]=u,l[h++]=e,l[h++]=r,l[h++]=c}}return c(0,0,a,a,a,0),c(a,a,0,0,0,a),{vertices:A,triangles:l}}}function iA(e){let t=1/0,i=1/0,r=1/0,s=-1/0,n=-1/0,a=-1/0;const o=e.POSITION?e.POSITION.value:[],A=o&&o.length;for(let e=0;e<A;e+=3){const A=o[e],l=o[e+1],h=o[e+2];t=A<t?A:t,i=l<i?l:i,r=h<r?h:r,s=A>s?A:s,n=l>n?l:n,a=h>a?h:a}return[[t,i,r],[s,n,a]]}function rA(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];const r=t,s=r&&r.length>1&&r[0].constructor||null;if(!s)throw new Error('"concatenateTypedArrays" - incorrect quantity of arguments or arguments have incompatible data types');const n=new s(r.reduce(((e,t)=>e+t.length),0));let a=0;for(const e of r)n.set(e,a),a+=e.length;return n}function sA(e,t,i,r){const s=r?function(e,t){e.westIndices.sort(((e,i)=>t[3*e+1]-t[3*i+1])),e.eastIndices.sort(((e,i)=>t[3*i+1]-t[3*e+1])),e.southIndices.sort(((e,i)=>t[3*i]-t[3*e])),e.northIndices.sort(((e,i)=>t[3*e]-t[3*i]));const i=[];for(const t in e){const r=e[t];for(let e=0;e<r.length-1;e++)i.push([r[e],r[e+1]])}return i}(r,e.POSITION.value):function(e){var t,i;const r=[];for(let t=0;t<e.length;t+=3)r.push([e[t],e[t+1]]),r.push([e[t+1],e[t+2]]),r.push([e[t+2],e[t]]);r.sort(((e,t)=>Math.min(...e)-Math.min(...t)||Math.max(...e)-Math.max(...t)));const s=[];let n=0;for(;n<r.length;)r[n][0]===(null===(t=r[n+1])||void 0===t?void 0:t[1])&&r[n][1]===(null===(i=r[n+1])||void 0===i?void 0:i[0])?n+=2:(s.push(r[n]),n++);return s}(t),n=new e.POSITION.value.constructor(6*s.length),a=new e.TEXCOORD_0.value.constructor(4*s.length),o=new t.constructor(6*s.length);for(let t=0;t<s.length;t++){nA({edge:s[t],edgeIndex:t,attributes:e,skirtHeight:i,newPosition:n,newTexcoord0:a,newTriangles:o})}e.POSITION.value=rA(e.POSITION.value,n),e.TEXCOORD_0.value=rA(e.TEXCOORD_0.value,a);return{attributes:e,triangles:t instanceof Array?t.concat(o):rA(t,o)}}function nA({edge:e,edgeIndex:t,attributes:i,skirtHeight:r,newPosition:s,newTexcoord0:n,newTriangles:a}){const o=i.POSITION.value.length,A=2*t,l=2*t+1;s.set(i.POSITION.value.subarray(3*e[0],3*e[0]+3),3*A),s[3*A+2]=s[3*A+2]-r,s.set(i.POSITION.value.subarray(3*e[1],3*e[1]+3),3*l),s[3*l+2]=s[3*l+2]-r,n.set(i.TEXCOORD_0.value.subarray(2*e[0],2*e[0]+2),2*A),n.set(i.TEXCOORD_0.value.subarray(2*e[1],2*e[1]+2),2*l);const h=2*t*3;a[h]=e[0],a[h+1]=o/3+l,a[h+2]=e[1],a[h+3]=o/3+l,a[h+4]=e[0],a[h+5]=o/3+A}const aA={type:"image",format:"uint8",useHeatMap:!0,useColorsBasedOnValues:!1,useAutoRange:!1,useDataForOpacity:!1,useSingleColor:!1,useColorClasses:!1,blurredTexture:!0,clipLow:null,clipHigh:null,multiplier:1,color:[255,0,255,255],colorScale:s.brewer.YlOrRd,colorScaleValueRange:[0,255],colorsBasedOnValues:null,colorClasses:null,alpha:100,useChannel:null,noDataValue:void 0,numOfChannels:void 0,nullColor:[0,0,0,0],unidentifiedColor:[0,0,0,0],clippedColor:[0,0,0,0],terrainColor:[133,133,133,255],terrainSkirtHeight:100,terrainMinValue:0};class oA{constructor(){this.scale=(e,t,i,r,s)=>(e-t)*(s-r)/(i-t)+r}setUrl(e){return a(this,void 0,void 0,(function*(){const t=yield fetch(e),i=yield t.arrayBuffer(),r=yield $o(i),s=yield r.getImage(0);this.data=s}))}getMap(e,t){return a(this,void 0,void 0,(function*(){const i=Object.assign(Object.assign({},aA),t);switch(console.log("xxx_mergedOptions",i),i.type){case"image":return this.getBitmap(e,i);case"terrain":return this.getHeightmap(e,i);default:return null}}))}getHeightmap(e,t){return a(this,void 0,void 0,(function*(){let i,r,s=[];"string"==typeof e?(yield this.setUrl(e),s=yield this.data.readRasters(),i=this.data.getWidth(),r=this.data.getHeight()):(s=e.rasters,i=e.width,r=e.height);let n=s[0];null!=t.useChannel&&s[t.useChannel]&&(n=s[t.useChannel]);const a=new Float32Array((i+1)*(r+1)),o=n.length/(i*r),A=i*r;console.log("xxx_size",A);let l=null===t.useChannel?0:t.useChannel;for(let e=0,s=0;s<r;s++)for(let r=0;r<i;r++,e++){const i=t.noDataValue&&n[l]===t.noDataValue?t.terrainMinValue:n[l]*t.multiplier;a[e+s]=i,l+=o}console.log("xxx_terrain",a),a[0];for(let e=(i+1)*i,t=0;t<i;t++,e++)a[e]=a[e-i-1];for(let e=r,t=0;t<r+1;t++,e+=r+1)a[e]=a[e-1];const{terrainSkirtHeight:h}=t;let c;console.log("xxx_bounds_0",e.bounds),c=AA(h,i,a);const{vertices:g}=c;let{triangles:u}=c,d=function(e,t,i,r,s){const n=i+1,a=e.length/2,o=new Float32Array(3*a),A=new Float32Array(2*a);console.log("xxx_bounds",s);const[l,h,c,g]=s||[0,0,i,r],u=(c-l)/i,d=(g-h)/r;for(let s=0;s<a;s++){const a=e[2*s],h=e[2*s+1],c=h*n+a;o[3*s+0]=a*u+l,o[3*s+1]=-h*d+g,o[3*s+2]=t[c],A[2*s+0]=a/i,A[2*s+1]=h/r}return{POSITION:{value:o,size:3},TEXCOORD_0:{value:A,size:2}}}(g,a,i,r,e.bounds);const f=iA(d);if(console.log("xxx_skirtHeight",h),h){const{attributes:e,triangles:t}=sA(d,u,h);d=e,u=t}return{loaderData:{header:{}},header:{vertexCount:u.length,boundingBox:f},mode:4,indices:{value:Uint32Array.from(u),size:1},attributes:d}}))}getBitmap(e,t){return a(this,void 0,void 0,(function*(){const i=Object.assign({},t);let r,s,n,a=[];"string"==typeof e?(yield this.setUrl(e),a=yield this.data.readRasters(),r=a.length,s=this.data.getWidth(),n=this.data.getHeight()):(a=e.rasters,r=a.length,s=e.width,n=e.height);const o=document.createElement("canvas");o.width=s,o.height=n;const A=o.getContext("2d"),l=A.createImageData(s,n);let h,c,g,u;const d=s*n*4;if(t.noDataValue||console.log("Missing noData value. Raster might be displayed incorrectly."),i.unidentifiedColor=this.getColorFromChromaType(i.unidentifiedColor),i.nullColor=this.getColorFromChromaType(i.nullColor),i.clippedColor=this.getColorFromChromaType(i.clippedColor),i.color=this.getColorFromChromaType(i.color),null==i.useChannel){if(1===r){if(a[0].length/(s*n)==1){const e=a[0];i.useAutoRange&&(i.colorScaleValueRange=this.getMinMax(e,i));this.getColorValue(e,i,d).forEach(((e,t)=>{l.data[t]=e}))}if(a[0].length/(s*n)==3){let e=0;for(let t=0;t<d;t+=4){const r=[a[0][e],a[0][e+1],a[0][e+2]],s=this.hasPixelsNoData(r,i.noDataValue)?i.nullColor:[...r,Math.floor(2.55*i.alpha)];[l.data[t],l.data[t+1],l.data[t+2],l.data[t+3]]=s,e+=3}}a[0].length/(s*n)==4&&a[0].forEach(((e,t)=>{l.data[t]=e}))}if(3===r){let e=0;for(let t=0;t<d;t+=4)h=a[0][e],c=a[1][e],g=a[2][e],u=Math.floor(2.55*i.alpha),l.data[t]=h,l.data[t+1]=c,l.data[t+2]=g,l.data[t+3]=u,e+=1}if(4===r){let e=0;for(let t=0;t<d;t+=4)h=a[0][e],c=a[1][e],g=a[2][e],u=Math.floor(2.55*i.alpha),l.data[t]=h,l.data[t+1]=c,l.data[t+2]=g,l.data[t+3]=u,e+=1}}else if(i.useChannel<=i.numOfChannels){let e=a[0];a[i.useChannel]&&(e=a[i.useChannel]),i.useAutoRange&&(i.colorScaleValueRange=this.getMinMax(e,i));const t=e.length/(s*n);this.getColorValue(e,i,d,t).forEach(((e,t)=>{l.data[t]=e}))}else{console.log("Defined channel does not exist, displaying only grey values");this.getDefaultColor(d,i.nullColor).forEach(((e,t)=>{l.data[t]=e}))}A.putImageData(l,0,0);return o.toDataURL("image/png")}))}getMinMax(e,t){let i=t.maxValue?t.maxValue:Number.MIN_VALUE,r=t.minValue?t.minValue:Number.MAX_VALUE;for(let s=0;s<e.length;s+=1)void 0!==t.noDataValue&&e[s]===t.noDataValue||(e[s]>i&&(i=e[s]),e[s]<r&&(r=e[s]));return[r,i]}getColorValue(e,t,i,r=1){const n=s.scale(t.colorScale).domain(t.colorScaleValueRange);let a=null===t.useChannel?0:t.useChannel;const o=new Array(i),A=t.colorsBasedOnValues?t.colorsBasedOnValues.map((([e])=>e)):void 0,l=t.colorsBasedOnValues?t.colorsBasedOnValues.map((([,e])=>[...s(e).rgb(),Math.floor(2.55*t.alpha)])):void 0,h=t.useColorClasses?t.colorClasses.map((([e])=>[...s(e).rgb(),Math.floor(2.55*t.alpha)])):void 0,c=t.useColorClasses?t.colorClasses.map((([,e])=>e)):void 0,g=t.useColorClasses?t.colorClasses.map((([,,e],i)=>void 0!==e?e:i===t.colorClasses.length-1?[!0,!0]:[!0,!1])):void 0;for(let s=0;s<i;s+=4){let i=t.nullColor;if(void 0===t.noDataValue||e[a]!==t.noDataValue)if(null!=t.clipLow&&e[a]<=t.clipLow||null!=t.clipHigh&&e[a]>=t.clipHigh)i=t.clippedColor;else{if(t.useHeatMap&&(i=[...n(e[a]).rgb(),Math.floor(2.55*t.alpha)]),t.useColorsBasedOnValues){const r=A.indexOf(e[a]);i=r>-1?l[r]:t.unidentifiedColor}if(t.useColorClasses){const r=this.findClassIndex(e[a],c,g);i=r>-1?h[r]:t.unidentifiedColor}t.useSingleColor&&(i=t.color),t.useDataForOpacity&&(i[3]=this.scale(e[a],t.colorScaleValueRange[0],t.colorScaleValueRange.slice(-1)[0],0,255))}else Number.isNaN(e[a])&&(i=[0,0,0,0]);[o[s],o[s+1],o[s+2],o[s+3]]=i,a+=r}return o}findClassIndex(e,t,i){for(let r=0;r<t.length;r+=1){const[s,n]=t[r],[a,o]=i[r];if((a?e>=s:e>s)&&(o?e<=n:e<n))return r}return-1}getDefaultColor(e,t){const i=new Array(e);for(let r=0;r<e;r+=4)[i[r],i[r+1],i[r+2],i[r+3]]=t;return i}getColorFromChromaType(e){return Array.isArray(e)&&4===e.length?e:[...s(e).rgb(),255]}hasPixelsNoData(e,t){return void 0!==t&&e.every((e=>e===t))}}function AA(e,t,i){const r=new eA(t+1).createTile(i),{vertices:s,triangles:n}=r.getMesh(e);return{vertices:s,triangles:n}}const lA=40075e3,hA=20037500;class cA{constructor(e){this.zoomRange=[0,0],this.lowestOriginTileOffset=[0,0],this.lowestOriginTileSize=0,this.loaded=!1,this.geo=new oA,this.lzw=new Vn,this.options=e}initializeCog(e){return a(this,void 0,void 0,(function*(){Bi.fetch=(e,t)=>a(this,void 0,void 0,(function*(){return yield fetch(e,t)}));const t=new Bi(e);return this.cog=yield Ii.create(t),this.cog.images.forEach((e=>{e.loadGeoTiffTags()})),this.tileSize=this.getTileSize(this.cog),this.lowestOriginTileOffset=this.getImageTileIndex(this.cog.images[this.cog.images.length-1]),this.zoomRange=this.getZoomRange(this.cog),this.cog}))}getTileSize(e){return e.images[e.images.length-1].tileSize.width}getZoomRange(e){const t=e.images[e.images.length-1],i=this.getZoomLevelFromResolution(e.images[e.images.length-1].tileSize.width,t.resolution[0]);return[i,i+(e.images.length-1)]}getBoundsAsLatLon(e){const{bbox:t}=e.images[e.images.length-1],i=Math.min(t[0],t[2]),r=Math.max(t[0],t[2]),s=Math.min(t[1],t[3]),n=Math.max(t[1],t[3]),a=this.getLatLon([i,s]),o=this.getLatLon([r,n]);return[a[0],a[1],o[0],o[1]]}getOriginAsLatLon(e){const{origin:t}=e.images[e.images.length-1];return this.getLatLon(t)}getImageTileIndex(e){const t=hA+e.origin[0],i=-(hA+(e.origin[1]-lA)),r=e.tileSize.width*this.getResolutionFromZoomLevel(e.tileSize.width,this.getZoomLevelFromResolution(e.tileSize.width,e.resolution[0]));return[Math.round(t/r),Math.round(i/r),this.getZoomLevelFromResolution(e.tileSize.width,e.resolution[0])]}getResolutionFromZoomLevel(e,t){return lA/e/Math.pow(2,t)}getZoomLevelFromResolution(e,t){return Math.round(Math.log2(lA/(t*e)))}getLatLon(e){const t=function(e){const[t,i]=e,r=t/512*(2*Rn)-Rn,s=2*(Math.atan(Math.exp(i/512*(2*Rn)-Rn))-Fn);return[r*Nn,s*Nn]}([12776044915782906e-21*(hA+e[0]),12776044915782906e-21*-(hA+(e[1]-lA))]);return[t[0],-t[1]]}getTile(e,t,i,r){return a(this,void 0,void 0,(function*(){const s=this.getResolutionFromZoomLevel(this.tileSize,i),n=this.cog.getImageByResolution(s);let a=[0,0];if(i===this.zoomRange[0])a=this.lowestOriginTileOffset;else{const e=Math.pow(2,i-this.zoomRange[0]);a[0]=Math.floor(this.lowestOriginTileOffset[0]*e),a[1]=Math.floor(this.lowestOriginTileOffset[1]*e)}const o=n.tileCount.x,A=n.tileCount.y,l=a[0],h=a[1];let c,g;this.options.numOfChannels=Number(n.tags.get(277).value),this.options.noDataValue=this.getNoDataValue(n.tags),this.options.format||(this.options.format=this.getFormat(n.tags.get(339).value,n.tags.get(258).value));let u=n.tags.get(258).value;if(Array.isArray(u))if("terrain"===this.options.type){let e=0;u.forEach((t=>{e+=t})),u=e}else[u]=u;if(e-l>=0&&t-h>=0&&e-l<o&&t-h<A){const i=yield n.getTile(e-l,t-h);switch(n.compression){case"image/jpeg":g=Ln.decode(i.bytes,{useTArray:!0});break;case"application/deflate":g=yield Sn(i.bytes);break;case"application/lzw":g=this.lzw.decodeBlock(i.bytes.buffer);break;default:console.warn(`Unexpected compression method: ${n.compression}`)}let s;switch(this.options.format){case"uint8":s=new Uint8Array(g.buffer);break;case"uint16":s=new Uint16Array(g.buffer);break;case"uint32":s=new Uint32Array(g.buffer);break;case"int8":s=new Int8Array(g.buffer);break;case"int16":s=new Int16Array(g.buffer);break;case"int32":s=new Int32Array(g.buffer);break;case"float32":s=new Float32Array(g.buffer);break;case"float64":s=new Float64Array(g.buffer);break;default:s=null}return c=yield this.geo.getMap({rasters:[s],width:this.tileSize,height:this.tileSize,bounds:r},this.options),c}return null}))}getFormat(e,t){let i,r=e,s=t;switch(Array.isArray(e)&&([r]=e),Array.isArray(t)&&([s]=t),r){case 1:switch(s){case 8:i="uint8";break;case 16:i="uint16";break;case 32:i="uint32";break;default:i=null}break;case 2:switch(s){case 8:i="int8";break;case 16:i="int16";break;case 32:i="int32";break;default:i=null}break;case 3:switch(s){case 32:i="float32";break;case 64:i="float64";break;default:i=null}break;default:throw new Error("Unknown data format.")}return i}getNoDataValue(e){if(e.has(42113)){const t=e.get(42113).value;if("string"==typeof t||t instanceof String){const e=t.replace(/[\0\s]/g,"");return Number(e)}return Number.isNaN(Number(t))?void 0:Number(t)}}testCog(){return a(this,void 0,void 0,(function*(){this.options={type:"image",multiplier:1,useChannel:1,alpha:180,clipLow:1,clipHigh:Number.MAX_VALUE};const e=yield this.initializeCog("https://gisat-gis.eu-central-1.linodeobjects.com/eman/versions/v2/Quadrants/Q3_Bolivia_ASTER_2002_RGB_COG_LZW.tif"),t=e.images[Math.floor(e.images.length/2)];console.log(t);const i=this.getImageTileIndex(t);console.log(i);const r=Math.floor(t.tileCount.x/2),s=Math.floor(t.tileCount.y/2);console.log(e.getTile(r,s,Math.floor(e.images.length/2)));const n=r+i[0],a=s+i[1],o=i[2],A=yield this.getTile(n,a,o);!1===A?console.log("couldn't retrieve tile"):console.log(A)}))}}class gA extends e.CompositeLayer{constructor(e,t,i){super({}),this.id="",this.id=e,this.cogTiles=new cA(i),this.blurredTexture=i.blurredTexture,this.url=t}initializeState(){this.state={initialized:!1},this.init(this.url)}init(e){return a(this,void 0,void 0,(function*(){const t=yield this.cogTiles.initializeCog(e);this.setState({initialized:!0}),this.tileSize=this.cogTiles.getTileSize(t);const i=this.cogTiles.getZoomRange(t);[this.minZoom,this.maxZoom]=i}))}renderLayers(){if(this.cogTiles.cog){const e=new t.TileLayer({id:`${this.id}-${String(performance.now())}`,getTileData:e=>this.cogTiles.getTile(e.index.x,e.index.y,e.index.z),minZoom:this.minZoom,maxZoom:this.maxZoom,tileSize:this.tileSize,maxRequests:6,extent:this.cogTiles.cog?this.cogTiles.getBoundsAsLatLon(this.cogTiles.cog):null,renderSubLayers:e=>{var t,s,n,a,o,A,l;const{bbox:{west:h,south:c,east:g,north:u}}=e.tile;return new i.BitmapLayer(e,Object.assign({data:null,image:e.data,bounds:[h,c,g,u],opacity:1,textureParameters:{[r.GL.TEXTURE_MIN_FILTER]:this.blurredTexture?r.GL.LINEAR:r.GL.NEAREST},extensions:(null===(s=null===(t=this.cogTiles)||void 0===t?void 0:t.options)||void 0===s?void 0:s.clampToTerrain)?[new Ut]:[]},(null===(o=null===(a=null===(n=this.cogTiles)||void 0===n?void 0:n.options)||void 0===a?void 0:a.clampToTerrain)||void 0===o?void 0:o.terrainDrawMode)?{terrainDrawMode:null===(l=null===(A=this.cogTiles)||void 0===A?void 0:A.options)||void 0===l?void 0:l.clampToTerrain.terrainDrawMode}:{}))}});return e}return null}}gA.layerName="CogBitmapLayer",gA.displayName="CogBitmapLayer";const uA=Math.PI/180,dA=new Float32Array(16),fA=new Float32Array(12);function pA(e,t,i){const r=t[0]*uA,s=t[1]*uA,n=t[2]*uA,a=Math.sin(n),o=Math.sin(r),A=Math.sin(s),l=Math.cos(n),h=Math.cos(r),c=Math.cos(s),g=i[0],u=i[1],d=i[2];e[0]=g*c*h,e[1]=g*A*h,e[2]=g*-o,e[3]=u*(-A*l+c*o*a),e[4]=u*(c*l+A*o*a),e[5]=u*h*a,e[6]=d*(A*a+c*o*l),e[7]=d*(-c*a+A*o*l),e[8]=d*h*l}function IA(e){return e[0]=e[0],e[1]=e[1],e[2]=e[2],e[3]=e[4],e[4]=e[5],e[5]=e[6],e[6]=e[8],e[7]=e[9],e[8]=e[10],e[9]=e[12],e[10]=e[13],e[11]=e[14],e.subarray(0,12)}const mA={size:12,accessor:["getOrientation","getScale","getTranslation","getTransformMatrix"],shaderAttributes:{instanceModelMatrixCol0:{size:3,elementOffset:0},instanceModelMatrixCol1:{size:3,elementOffset:3},instanceModelMatrixCol2:{size:3,elementOffset:6},instanceTranslation:{size:3,elementOffset:9}},update(t,{startRow:i,endRow:r}){const{data:s,getOrientation:n,getScale:a,getTranslation:o,getTransformMatrix:A}=this.props,l=Array.isArray(A),h=l&&16===A.length,c=Array.isArray(a),g=Array.isArray(n),u=Array.isArray(o),d=h||!l&&Boolean(A(s[0]));t.constant=d?h:g&&c&&u;const f=t.value;if(t.constant){let e;if(d)dA.set(A),e=IA(dA);else{e=fA;pA(e,n,a),e.set(o,9)}t.value=new Float32Array(e)}else{let l=i*t.size;const{iterable:p,objectInfo:I}=e.createIterable(s,i,r);for(const e of p){let t;if(I.index++,d)dA.set(h?A:A(e,I)),t=IA(dA);else{t=fA;pA(t,g?n:n(e,I),c?a:a(e,I)),t.set(u?o:o(e,I),9)}f[l++]=t[0],f[l++]=t[1],f[l++]=t[2],f[l++]=t[3],f[l++]=t[4],f[l++]=t[5],f[l++]=t[6],f[l++]=t[7],f[l++]=t[8],f[l++]=t[9],f[l++]=t[10],f[l++]=t[11]}}}};function _A(t,i){return i===e.COORDINATE_SYSTEM.CARTESIAN||i===e.COORDINATE_SYSTEM.METER_OFFSETS||i===e.COORDINATE_SYSTEM.DEFAULT&&!t.isGeospatial}function wA(t){const i=t.positions||t.POSITION;e.log.assert(i,'no "postions" or "POSITION" attribute in mesh');const r=i.value.length/i.size;let s=t.COLOR_0||t.colors;s||(s={size:3,value:new Float32Array(3*r).fill(1)});let n=t.NORMAL||t.normals;n||(n={size:3,value:new Float32Array(3*r).fill(0)});let a=t.TEXCOORD_0||t.texCoords;return a||(a={size:2,value:new Float32Array(2*r).fill(0)}),{positions:i,colors:s,normals:n,texCoords:a}}function CA(e){return e instanceof It?(e.attributes=wA(e.attributes),e):e.attributes?new It({...e,topology:"triangle-list",attributes:wA(e.attributes)}):new It({topology:"triangle-list",attributes:wA(e)})}const BA={mesh:{type:"object",value:null,async:!0},texture:{type:"image",value:null,async:!0},sizeScale:{type:"number",value:1,min:0},_instanced:!0,wireframe:!1,material:!0,getPosition:{type:"accessor",value:e=>e.position},getColor:{type:"accessor",value:[0,0,0,255]},getOrientation:{type:"accessor",value:[0,0,0]},getScale:{type:"accessor",value:[1,1,1]},getTranslation:{type:"accessor",value:[0,0,0]},getTransformMatrix:{type:"accessor",value:[]},textureParameters:{type:"object",ignore:!0,value:null}};class EA extends e.Layer{static{this.defaultProps=BA}static{this.layerName="SimpleMeshLayer"}getShaders(){return super.getShaders({vs:"#version 300 es\n#define SHADER_NAME simple-mesh-layer-vs\nuniform float sizeScale;\nuniform bool composeModelMatrix;\nin vec3 positions;\nin vec3 normals;\nin vec3 colors;\nin vec2 texCoords;\nin vec3 instancePositions;\nin vec3 instancePositions64Low;\nin vec4 instanceColors;\nin vec3 instancePickingColors;\nin vec3 instanceModelMatrixCol0;\nin vec3 instanceModelMatrixCol1;\nin vec3 instanceModelMatrixCol2;\nin vec3 instanceTranslation;\nout vec2 vTexCoord;\nout vec3 cameraPosition;\nout vec3 normals_commonspace;\nout vec4 position_commonspace;\nout vec4 vColor;\nvoid main(void) {\ngeometry.worldPosition = instancePositions;\ngeometry.uv = texCoords;\ngeometry.pickingColor = instancePickingColors;\nvTexCoord = texCoords;\ncameraPosition = project_uCameraPosition;\nvColor = vec4(colors * instanceColors.rgb, instanceColors.a);\nmat3 instanceModelMatrix = mat3(instanceModelMatrixCol0, instanceModelMatrixCol1, instanceModelMatrixCol2);\nvec3 pos = (instanceModelMatrix * positions) * sizeScale + instanceTranslation;\nif (composeModelMatrix) {\nDECKGL_FILTER_SIZE(pos, geometry);\nnormals_commonspace = project_normal(instanceModelMatrix * normals);\ngeometry.worldPosition += pos;\ngl_Position = project_position_to_clipspace(pos + instancePositions, instancePositions64Low, vec3(0.0), position_commonspace);\ngeometry.position = position_commonspace;\n}\nelse {\npos = project_size(pos);\nDECKGL_FILTER_SIZE(pos, geometry);\ngl_Position = project_position_to_clipspace(instancePositions, instancePositions64Low, pos, position_commonspace);\ngeometry.position = position_commonspace;\nnormals_commonspace = project_normal(instanceModelMatrix * normals);\n}\ngeometry.normal = normals_commonspace;\nDECKGL_FILTER_GL_POSITION(gl_Position, geometry);\nDECKGL_FILTER_COLOR(vColor, geometry);\n}\n",fs:"#version 300 es\n#define SHADER_NAME simple-mesh-layer-fs\nprecision highp float;\nuniform bool hasTexture;\nuniform sampler2D sampler;\nuniform bool flatShading;\nuniform float opacity;\nin vec2 vTexCoord;\nin vec3 cameraPosition;\nin vec3 normals_commonspace;\nin vec4 position_commonspace;\nin vec4 vColor;\nout vec4 fragColor;\nvoid main(void) {\ngeometry.uv = vTexCoord;\nvec3 normal;\nif (flatShading) {\nnormal = normalize(cross(dFdx(position_commonspace.xyz), dFdy(position_commonspace.xyz)));\n} else {\nnormal = normals_commonspace;\n}\nvec4 color = hasTexture ? texture(sampler, vTexCoord) : vColor;\nDECKGL_FILTER_COLOR(color, geometry);\nvec3 lightColor = lighting_getLightColor(color.rgb, cameraPosition, position_commonspace.xyz, normal);\nfragColor = vec4(lightColor, color.a * opacity);\n}\n",modules:[e.project32,e.phongLighting,e.picking]})}getBounds(){if(this.props._instanced)return super.getBounds();let e=this.state.positionBounds;if(e)return e;const{mesh:t}=this.props;if(!t)return null;if(e=t.header?.boundingBox,!e){const{attributes:i}=CA(t);i.POSITION=i.POSITION||i.positions,e=iA(i)}return this.state.positionBounds=e,e}initializeState(){this.getAttributeManager().addInstanced({instancePositions:{transition:!0,type:"float64",fp64:this.use64bitPositions(),size:3,accessor:"getPosition"},instanceColors:{type:"unorm8",transition:!0,size:this.props.colorFormat.length,accessor:"getColor",defaultValue:[0,0,0,255]},instanceModelMatrix:mA}),this.setState({emptyTexture:this.context.device.createTexture({data:new Uint8Array(4),width:1,height:1})})}updateState(e){super.updateState(e);const{props:t,oldProps:i,changeFlags:r}=e;if(t.mesh!==i.mesh||r.extensionsChanged){if(this.state.positionBounds=null,this.state.model?.destroy(),t.mesh){this.state.model=this.getModel(t.mesh);const e=t.mesh.attributes||t.mesh;this.setState({hasNormals:Boolean(e.NORMAL||e.normals)})}this.getAttributeManager().invalidateAll()}t.texture!==i.texture&&t.texture instanceof n.Texture&&this.setTexture(t.texture),this.state.model&&this.state.model.setTopology(this.props.wireframe?"line-strip":"triangle-list")}finalizeState(e){super.finalizeState(e),this.state.emptyTexture.delete()}draw({uniforms:e}){const{model:t}=this.state;if(!t)return;const{viewport:i,renderPass:r}=this.context,{sizeScale:s,coordinateSystem:n,_instanced:a}=this.props;t.setUniforms(e),t.setUniforms({sizeScale:s,composeModelMatrix:!a||_A(i,n),flatShading:!this.state.hasNormals}),t.draw(r)}get isLoaded(){return Boolean(this.state?.model&&super.isLoaded)}getModel(e){const t=new dt(this.context.device,{...this.getShaders(),id:this.props.id,bufferLayout:this.getAttributeManager().getBufferLayouts(),geometry:CA(e),isInstanced:!0}),{texture:i}=this.props,{emptyTexture:r}=this.state;return t.setBindings({sampler:i||r}),t.setUniforms({hasTexture:Boolean(i)}),t}setTexture(e){const{emptyTexture:t,model:i}=this.state;i&&(i.setBindings({sampler:e||t}),i.setUniforms({hasTexture:Boolean(e)}))}}const yA={type:"object",value:null,validate:(e,t)=>t.optional&&null===e||"string"==typeof e||Array.isArray(e)&&e.every((e=>"string"==typeof e)),equal:(e,t)=>{if(e===t)return!0;if(!Array.isArray(e)||!Array.isArray(t))return!1;const i=e.length;if(i!==t.length)return!1;for(let r=0;r<i;r++)if(e[r]!==t[r])return!1;return!0}},QA=[1],bA=Object.assign(Object.assign({},t.TileLayer.defaultProps),{elevationData:yA,texture:Object.assign(Object.assign({},yA),{optional:!0}),meshMaxError:{type:"number",value:4},bounds:{type:"array",value:null,optional:!0,compare:!0},color:{type:"color",value:[255,255,255]},elevationDecoder:{type:"object",value:{rScaler:1,gScaler:0,bScaler:0,offset:0}},workerUrl:"",wireframe:!1,material:!0});class kA extends e.CompositeLayer{constructor(e,t){super(e),console.log("xxx_terrainOptions",t),this.terrainCogTiles=new cA(t)}initializeState(e){const t=Object.create(null,{initializeState:{get:()=>super.initializeState}});return a(this,void 0,void 0,(function*(){t.initializeState.call(this,e),this.setState({initialized:!1}),yield this.init(this.terrainUrl)}))}init(e){return a(this,void 0,void 0,(function*(){console.log("xxx_LAYER INITIALIZE STATE");const e=yield this.terrainCogTiles.initializeCog(this.props.elevationData);console.log("xxx_LAYER INITIALIZE STATE",e);const t=this.terrainCogTiles.getZoomRange(e);console.log("xxx_LAYER INITIALIZE STATE",t),[this.minZoom,this.maxZoom]=t,this.setState({initialized:!0})}))}updateState({props:t,oldProps:i}){const r=t.elevationData!==i.elevationData;if(r){const{elevationData:e}=t,i=e&&(Array.isArray(e)||e.includes("{x}")&&e.includes("{y}"))||this.props.isTiled;this.setState({isTiled:i})}const s=r||t.meshMaxError!==i.meshMaxError||t.elevationDecoder!==i.elevationDecoder||t.bounds!==i.bounds;if(!this.state.isTiled&&s){const e=this.loadTerrain(t);this.setState({terrain:e})}t.workerUrl&&e.log.removed("workerUrl","loadOptions.terrain.workerUrl")()}loadTerrain({elevationData:e,bounds:t,elevationDecoder:i,meshMaxError:r,signal:s}){if(!e)return null;let n=this.getLoadOptions();n=Object.assign(Object.assign({},n),{_workerType:"test",terrain:Object.assign(Object.assign({skirtHeight:this.state.isTiled?2*r:0},null==n?void 0:n.terrain),{bounds:t,meshMaxError:r,elevationDecoder:i})});const{fetch:a}=this.props;return console.log("xxx_loaddata"),a(e,{propName:"elevationData",layer:this,loadOptions:n,signal:s})}getTiledTerrainData(e){return a(this,void 0,void 0,(function*(){this.props;const{viewport:t}=this.context;let i=[0,0],r=[0,0];if(t.isGeospatial){const s=e.bbox;console.log("xxx_coords",s.west,s.south,s.east,s.north),i=t.projectFlat([s.west,s.south]),r=t.projectFlat([s.east,s.north])}else{const t=e.bbox;i=[t.left,t.bottom],r=[t.right,t.top]}const s=[i[0],i[1],r[0],r[1]],n=yield this.terrainCogTiles.getTile(e.index.x,e.index.y,e.index.z,s);return console.log("xxx_TILE",n,s),Promise.all([n])}))}renderSubLayers(t){const i=this.getSubLayerClass("mesh",EA),{color:r,wireframe:s,material:n}=this.props,{data:a}=t;if(!a)return null;const[o]=a;return new i(Object.assign(Object.assign({},t),{tileSize:256}),{data:QA,mesh:o,_instanced:!1,coordinateSystem:e.COORDINATE_SYSTEM.CARTESIAN,getPosition:e=>[0,0,0],getColor:r,wireframe:s,material:n})}onViewportLoad(e){if(!e)return;const{zRange:t}=this.state,i=e.map((e=>e.content)).filter((e=>e&&e[0])).map((e=>{var t,i;const r=null===(i=null===(t=e[0])||void 0===t?void 0:t.header)||void 0===i?void 0:i.boundingBox;return null==r?void 0:r.map((e=>e[2]))}));if(0===i.length)return;const r=Math.min(...i.map((e=>e[0]))),s=Math.max(...i.map((e=>e[1])));console.log("xxx_ranges",i),(!t||r<t[0]||s>t[1])&&this.setState({zRange:[Number.isFinite(r)?r:0,Number.isFinite(s)?s:0]})}renderLayers(){const{color:e,material:i,elevationData:r,texture:s,wireframe:n,meshMaxError:a,elevationDecoder:o,tileSize:A,maxZoom:l,minZoom:h,extent:c,maxRequests:g,onTileLoad:u,onTileUnload:d,onTileError:f,maxCacheSize:p,maxCacheByteSize:I,refinementStrategy:m}=this.props;if(console.log("xxx_renderLayers",this.state.initialized),this.state.isTiled&&this.state.initialized)return new t.TileLayer(this.getSubLayerProps({id:"tiles"}),{getTileData:this.getTiledTerrainData.bind(this),renderSubLayers:this.renderSubLayers.bind(this),updateTriggers:{getTileData:{elevationData:(_=r,Array.isArray(_)?_.join(";"):_||""),meshMaxError:a,elevationDecoder:o}},onViewportLoad:this.onViewportLoad.bind(this),zRange:this.state.zRange||null,tileSize:A,maxZoom:l,minZoom:h,extent:c,maxRequests:g,onTileLoad:u,onTileUnload:d,onTileError:f,maxCacheSize:p,maxCacheByteSize:I,refinementStrategy:m});var _}}kA.defaultProps=bA,kA.layerName="TerrainLayer";var xA={CogBitmapLayer:gA,CogTerrainLayer:kA,cogtiles:cA,GeoImage:oA};var vA=Object.freeze({__proto__:null,default:class extends Vo{decodeBlock(e){return e}}});const DA=257;function SA(e,t){for(let i=t.length-1;i>=0;i--)e.push(t[i]);return e}function MA(e){const t=new Uint16Array(4093),i=new Uint8Array(4093);for(let e=0;e<=257;e++)t[e]=4096,i[e]=e;let r=258,s=9,n=0;function a(){r=258,s=9}function o(e){const t=function(e,t,i){const r=t%8,s=Math.floor(t/8),n=8-r,a=t+i-8*(s+1);let o=8*(s+2)-(t+i);const A=8*(s+2)-t;if(o=Math.max(0,o),s>=e.length)return console.warn("ran off the end of the buffer before finding EOI_CODE (end on input code)"),DA;let l=e[s]&2**(8-r)-1;l<<=i-n;let h=l;if(s+1<e.length){let t=e[s+1]>>>o;t<<=Math.max(0,i-A),h+=t}if(a>8&&s+2<e.length){const r=8*(s+3)-(t+i);h+=e[s+2]>>>r}return h}(e,n,s);return n+=s,t}function A(e,s){return i[r]=s,t[r]=e,r++,r-1}function l(e){const r=[];for(let s=e;4096!==s;s=t[s])r.push(i[s]);return r}const h=[];a();const c=new Uint8Array(e);let g,u=o(c);for(;u!==DA;){if(256===u){for(a(),u=o(c);256===u;)u=o(c);if(u===DA)break;if(u>256)throw new Error(`corrupted code at scanline ${u}`);SA(h,l(u)),g=u}else if(u<r){const e=l(u);SA(h,e),A(g,e[e.length-1]),g=u}else{const e=l(g);if(!e)throw new Error(`Bogus entry. Not in dictionary, ${g} / ${r}, position: ${n}`);SA(h,e),h.push(e[e.length-1]),A(g,e[e.length-1]),g=u}r+1>=2**s&&(12===s?g=void 0:s++),u=o(c)}return new Uint8Array(h)}var UA=Object.freeze({__proto__:null,default:class extends Vo{decodeBlock(e){return MA(e).buffer}}});const TA=new Int32Array([0,1,8,16,9,2,3,10,17,24,32,25,18,11,4,5,12,19,26,33,40,48,41,34,27,20,13,6,7,14,21,28,35,42,49,56,57,50,43,36,29,22,15,23,30,37,44,51,58,59,52,45,38,31,39,46,53,60,61,54,47,55,62,63]),GA=4017,LA=799,RA=3406,FA=2276,NA=1567,OA=3784,PA=5793,zA=2896;function qA(e,t){let i=0;const r=[];let s=16;for(;s>0&&!e[s-1];)--s;r.push({children:[],index:0});let n,a=r[0];for(let o=0;o<s;o++){for(let s=0;s<e[o];s++){for(a=r.pop(),a.children[a.index]=t[i];a.index>0;)a=r.pop();for(a.index++,r.push(a);r.length<=o;)r.push(n={children:[],index:0}),a.children[a.index]=n.children,a=n;i++}o+1<s&&(r.push(n={children:[],index:0}),a.children[a.index]=n.children,a=n)}return r[0].children}function KA(e,t,i,r,s,n,a,o,A){const{mcusPerLine:l,progressive:h}=i,c=t;let g=t,u=0,d=0;function f(){if(d>0)return d--,u>>d&1;if(u=e[g++],255===u){const t=e[g++];if(t)throw new Error(`unexpected marker: ${(u<<8|t).toString(16)}`)}return d=7,u>>>7}function p(e){let t,i=e;for(;null!==(t=f());){if(i=i[t],"number"==typeof i)return i;if("object"!=typeof i)throw new Error("invalid huffman sequence")}return null}function I(e){let t=e,i=0;for(;t>0;){const e=f();if(null===e)return;i=i<<1|e,--t}return i}function m(e){const t=I(e);return t>=1<<e-1?t:t+(-1<<e)+1}let _=0;let w,C=0;function B(e,t,i,r,s){const n=i%l,a=(i/l|0)*e.v+r,o=n*e.h+s;t(e,e.blocks[a][o])}function E(e,t,i){const r=i/e.blocksPerLine|0,s=i%e.blocksPerLine;t(e,e.blocks[r][s])}const y=r.length;let Q,b,k,x,v,D;D=h?0===n?0===o?function(e,t){const i=p(e.huffmanTableDC),r=0===i?0:m(i)<<A;e.pred+=r,t[0]=e.pred}:function(e,t){t[0]|=f()<<A}:0===o?function(e,t){if(_>0)return void _--;let i=n;const r=a;for(;i<=r;){const r=p(e.huffmanTableAC),s=15&r,n=r>>4;if(0===s){if(n<15){_=I(n)+(1<<n)-1;break}i+=16}else i+=n,t[TA[i]]=m(s)*(1<<A),i++}}:function(e,t){let i=n;const r=a;let s=0;for(;i<=r;){const r=TA[i],n=t[r]<0?-1:1;switch(C){case 0:{const t=p(e.huffmanTableAC),i=15&t;if(s=t>>4,0===i)s<15?(_=I(s)+(1<<s),C=4):(s=16,C=1);else{if(1!==i)throw new Error("invalid ACn encoding");w=m(i),C=s?2:3}continue}case 1:case 2:t[r]?t[r]+=(f()<<A)*n:(s--,0===s&&(C=2===C?3:0));break;case 3:t[r]?t[r]+=(f()<<A)*n:(t[r]=w<<A,C=0);break;case 4:t[r]&&(t[r]+=(f()<<A)*n)}i++}4===C&&(_--,0===_&&(C=0))}:function(e,t){const i=p(e.huffmanTableDC),r=0===i?0:m(i);e.pred+=r,t[0]=e.pred;let s=1;for(;s<64;){const i=p(e.huffmanTableAC),r=15&i,n=i>>4;if(0===r){if(n<15)break;s+=16}else s+=n,t[TA[s]]=m(r),s++}};let S,M,U=0;M=1===y?r[0].blocksPerLine*r[0].blocksPerColumn:l*i.mcusPerColumn;const T=s||M;for(;U<M;){for(b=0;b<y;b++)r[b].pred=0;if(_=0,1===y)for(Q=r[0],v=0;v<T;v++)E(Q,D,U),U++;else for(v=0;v<T;v++){for(b=0;b<y;b++){Q=r[b];const{h:e,v:t}=Q;for(k=0;k<t;k++)for(x=0;x<e;x++)B(Q,D,U,k,x)}if(U++,U===M)break}if(d=0,S=e[g]<<8|e[g+1],S<65280)throw new Error("marker was not found");if(!(S>=65488&&S<=65495))break;g+=2}return g-c}function HA(e,t){const i=[],{blocksPerLine:r,blocksPerColumn:s}=t,n=r<<3,a=new Int32Array(64),o=new Uint8Array(64);function A(e,i,r){const s=t.quantizationTable;let n,a,o,A,l,h,c,g,u;const d=r;let f;for(f=0;f<64;f++)d[f]=e[f]*s[f];for(f=0;f<8;++f){const e=8*f;0!==d[1+e]||0!==d[2+e]||0!==d[3+e]||0!==d[4+e]||0!==d[5+e]||0!==d[6+e]||0!==d[7+e]?(n=PA*d[0+e]+128>>8,a=PA*d[4+e]+128>>8,o=d[2+e],A=d[6+e],l=zA*(d[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=A+l,d[32+e]=A-l):(u=PA*r[f+0]+8192>>14,d[0+e]=u,d[8+e]=u,d[16+e]=u,d[24+e]=u,d[32+e]=u,d[40+e]=u,d[48+e]=u,d[56+e]=u)}for(f=0;f<64;++f){const e=128+(d[f]+8>>4);i[f]=e<0?0:e>255?255:e}}for(let e=0;e<s;e++){const s=e<<3;for(let e=0;e<8;e++)i.push(new Uint8Array(n));for(let n=0;n<r;n++){A(t.blocks[e][n],o,a);let r=0;const l=n<<3;for(let e=0;e<8;e++){const t=i[s+e];for(let e=0;e<8;e++)t[l+e]=o[r++]}}}return i}class VA{constructor(){this.jfif=null,this.adobe=null,this.quantizationTables=[],this.huffmanTablesAC=[],this.huffmanTablesDC=[],this.resetFrames()}resetFrames(){this.frames=[]}parse(e){let t=0;function i(){const i=e[t]<<8|e[t+1];return t+=2,i}function r(){const r=i(),s=e.subarray(t,t+r-2);return t+=s.length,s}function s(e){let t,i,r=0,s=0;for(i in e.components)e.components.hasOwnProperty(i)&&(t=e.components[i],r<t.h&&(r=t.h),s<t.v&&(s=t.v));const n=Math.ceil(e.samplesPerLine/8/r),a=Math.ceil(e.scanLines/8/s);for(i in e.components)if(e.components.hasOwnProperty(i)){t=e.components[i];const o=Math.ceil(Math.ceil(e.samplesPerLine/8)*t.h/r),A=Math.ceil(Math.ceil(e.scanLines/8)*t.v/s),l=n*t.h,h=a*t.v,c=[];for(let e=0;e<h;e++){const e=[];for(let t=0;t<l;t++)e.push(new Int32Array(64));c.push(e)}t.blocksPerLine=o,t.blocksPerColumn=A,t.blocks=c}e.maxH=r,e.maxV=s,e.mcusPerLine=n,e.mcusPerColumn=a}let n=i();if(65496!==n)throw new Error("SOI not found");for(n=i();65497!==n;){switch(n){case 65280:break;case 65504:case 65505:case 65506:case 65507:case 65508:case 65509:case 65510:case 65511:case 65512:case 65513:case 65514:case 65515:case 65516:case 65517:case 65518:case 65519:case 65534:{const e=r();65504===n&&74===e[0]&&70===e[1]&&73===e[2]&&70===e[3]&&0===e[4]&&(this.jfif={version:{major:e[5],minor:e[6]},densityUnits:e[7],xDensity:e[8]<<8|e[9],yDensity:e[10]<<8|e[11],thumbWidth:e[12],thumbHeight:e[13],thumbData:e.subarray(14,14+3*e[12]*e[13])}),65518===n&&65===e[0]&&100===e[1]&&111===e[2]&&98===e[3]&&101===e[4]&&0===e[5]&&(this.adobe={version:e[6],flags0:e[7]<<8|e[8],flags1:e[9]<<8|e[10],transformCode:e[11]});break}case 65499:{const r=i()+t-2;for(;t<r;){const r=e[t++],s=new Int32Array(64);if(r>>4==0)for(let i=0;i<64;i++){s[TA[i]]=e[t++]}else{if(r>>4!=1)throw new Error("DQT: invalid table spec");for(let e=0;e<64;e++){s[TA[e]]=i()}}this.quantizationTables[15&r]=s}break}case 65472:case 65473:case 65474:{i();const r={extended:65473===n,progressive:65474===n,precision:e[t++],scanLines:i(),samplesPerLine:i(),components:{},componentsOrder:[]},a=e[t++];let o;for(let i=0;i<a;i++){o=e[t];const i=e[t+1]>>4,s=15&e[t+1],n=e[t+2];r.componentsOrder.push(o),r.components[o]={h:i,v:s,quantizationIdx:n},t+=3}s(r),this.frames.push(r);break}case 65476:{const r=i();for(let i=2;i<r;){const r=e[t++],s=new Uint8Array(16);let n=0;for(let i=0;i<16;i++,t++)s[i]=e[t],n+=s[i];const a=new Uint8Array(n);for(let i=0;i<n;i++,t++)a[i]=e[t];i+=17+n,r>>4==0?this.huffmanTablesDC[15&r]=qA(s,a):this.huffmanTablesAC[15&r]=qA(s,a)}break}case 65501:i(),this.resetInterval=i();break;case 65498:{i();const r=e[t++],s=[],n=this.frames[0];for(let i=0;i<r;i++){const i=n.components[e[t++]],r=e[t++];i.huffmanTableDC=this.huffmanTablesDC[r>>4],i.huffmanTableAC=this.huffmanTablesAC[15&r],s.push(i)}const a=e[t++],o=e[t++],A=e[t++],l=KA(e,t,n,s,this.resetInterval,a,o,A>>4,15&A);t+=l;break}case 65535:255!==e[t]&&t--;break;default:if(255===e[t-3]&&e[t-2]>=192&&e[t-2]<=254){t-=3;break}throw new Error(`unknown JPEG marker ${n.toString(16)}`)}n=i()}}getResult(){const{frames:e}=this;if(0===this.frames.length)throw new Error("no frames were decoded");this.frames.length>1&&console.warn("more than one frame is not supported");for(let e=0;e<this.frames.length;e++){const t=this.frames[e].components;for(const e of Object.keys(t))t[e].quantizationTable=this.quantizationTables[t[e].quantizationIdx],delete t[e].quantizationIdx}const t=e[0],{components:i,componentsOrder:r}=t,s=[],n=t.samplesPerLine,a=t.scanLines;for(let e=0;e<r.length;e++){const n=i[r[e]];s.push({lines:HA(0,n),scaleX:n.h/t.maxH,scaleY:n.v/t.maxV})}const o=new Uint8Array(n*a*s.length);let A=0;for(let e=0;e<a;++e)for(let t=0;t<n;++t)for(let i=0;i<s.length;++i){const r=s[i];o[A]=r.lines[0|e*r.scaleY][0|t*r.scaleX],++A}return o}}var JA=Object.freeze({__proto__:null,default:class extends Vo{constructor(e){super(),this.reader=new VA,e.JPEGTables&&this.reader.parse(e.JPEGTables)}decodeBlock(e){return this.reader.resetFrames(),this.reader.parse(new Uint8Array(e)),this.reader.getResult().buffer}}});
3
+ /*! pako 2.1.0 https://github.com/nodeca/pako @license (MIT AND Zlib) */function YA(e){let t=e.length;for(;--t>=0;)e[t]=0}const jA=256,ZA=286,WA=30,XA=15,$A=new Uint8Array([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]),el=new Uint8Array([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]),tl=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),il=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),rl=new Array(576);YA(rl);const sl=new Array(60);YA(sl);const nl=new Array(512);YA(nl);const al=new Array(256);YA(al);const ol=new Array(29);YA(ol);const Al=new Array(WA);function ll(e,t,i,r,s){this.static_tree=e,this.extra_bits=t,this.extra_base=i,this.elems=r,this.max_length=s,this.has_stree=e&&e.length}let hl,cl,gl;function ul(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}YA(Al);const dl=e=>e<256?nl[e]:nl[256+(e>>>7)],fl=(e,t)=>{e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255},pl=(e,t,i)=>{e.bi_valid>16-i?(e.bi_buf|=t<<e.bi_valid&65535,fl(e,e.bi_buf),e.bi_buf=t>>16-e.bi_valid,e.bi_valid+=i-16):(e.bi_buf|=t<<e.bi_valid&65535,e.bi_valid+=i)},Il=(e,t,i)=>{pl(e,i[2*t],i[2*t+1])},ml=(e,t)=>{let i=0;do{i|=1&e,e>>>=1,i<<=1}while(--t>0);return i>>>1},_l=(e,t,i)=>{const r=new Array(16);let s,n,a=0;for(s=1;s<=XA;s++)a=a+i[s-1]<<1,r[s]=a;for(n=0;n<=t;n++){let t=e[2*n+1];0!==t&&(e[2*n]=ml(r[t]++,t))}},wl=e=>{let t;for(t=0;t<ZA;t++)e.dyn_ltree[2*t]=0;for(t=0;t<WA;t++)e.dyn_dtree[2*t]=0;for(t=0;t<19;t++)e.bl_tree[2*t]=0;e.dyn_ltree[512]=1,e.opt_len=e.static_len=0,e.sym_next=e.matches=0},Cl=e=>{e.bi_valid>8?fl(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0},Bl=(e,t,i,r)=>{const s=2*t,n=2*i;return e[s]<e[n]||e[s]===e[n]&&r[t]<=r[i]},El=(e,t,i)=>{const r=e.heap[i];let s=i<<1;for(;s<=e.heap_len&&(s<e.heap_len&&Bl(t,e.heap[s+1],e.heap[s],e.depth)&&s++,!Bl(t,r,e.heap[s],e.depth));)e.heap[i]=e.heap[s],i=s,s<<=1;e.heap[i]=r},yl=(e,t,i)=>{let r,s,n,a,o=0;if(0!==e.sym_next)do{r=255&e.pending_buf[e.sym_buf+o++],r+=(255&e.pending_buf[e.sym_buf+o++])<<8,s=e.pending_buf[e.sym_buf+o++],0===r?Il(e,s,t):(n=al[s],Il(e,n+jA+1,t),a=$A[n],0!==a&&(s-=ol[n],pl(e,s,a)),r--,n=dl(r),Il(e,n,i),a=el[n],0!==a&&(r-=Al[n],pl(e,r,a)))}while(o<e.sym_next);Il(e,256,t)},Ql=(e,t)=>{const i=t.dyn_tree,r=t.stat_desc.static_tree,s=t.stat_desc.has_stree,n=t.stat_desc.elems;let a,o,A,l=-1;for(e.heap_len=0,e.heap_max=573,a=0;a<n;a++)0!==i[2*a]?(e.heap[++e.heap_len]=l=a,e.depth[a]=0):i[2*a+1]=0;for(;e.heap_len<2;)A=e.heap[++e.heap_len]=l<2?++l:0,i[2*A]=1,e.depth[A]=0,e.opt_len--,s&&(e.static_len-=r[2*A+1]);for(t.max_code=l,a=e.heap_len>>1;a>=1;a--)El(e,i,a);A=n;do{a=e.heap[1],e.heap[1]=e.heap[e.heap_len--],El(e,i,1),o=e.heap[1],e.heap[--e.heap_max]=a,e.heap[--e.heap_max]=o,i[2*A]=i[2*a]+i[2*o],e.depth[A]=(e.depth[a]>=e.depth[o]?e.depth[a]:e.depth[o])+1,i[2*a+1]=i[2*o+1]=A,e.heap[1]=A++,El(e,i,1)}while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],((e,t)=>{const i=t.dyn_tree,r=t.max_code,s=t.stat_desc.static_tree,n=t.stat_desc.has_stree,a=t.stat_desc.extra_bits,o=t.stat_desc.extra_base,A=t.stat_desc.max_length;let l,h,c,g,u,d,f=0;for(g=0;g<=XA;g++)e.bl_count[g]=0;for(i[2*e.heap[e.heap_max]+1]=0,l=e.heap_max+1;l<573;l++)h=e.heap[l],g=i[2*i[2*h+1]+1]+1,g>A&&(g=A,f++),i[2*h+1]=g,h>r||(e.bl_count[g]++,u=0,h>=o&&(u=a[h-o]),d=i[2*h],e.opt_len+=d*(g+u),n&&(e.static_len+=d*(s[2*h+1]+u)));if(0!==f){do{for(g=A-1;0===e.bl_count[g];)g--;e.bl_count[g]--,e.bl_count[g+1]+=2,e.bl_count[A]--,f-=2}while(f>0);for(g=A;0!==g;g--)for(h=e.bl_count[g];0!==h;)c=e.heap[--l],c>r||(i[2*c+1]!==g&&(e.opt_len+=(g-i[2*c+1])*i[2*c],i[2*c+1]=g),h--)}})(e,t),_l(i,l,e.bl_count)},bl=(e,t,i)=>{let r,s,n=-1,a=t[1],o=0,A=7,l=4;for(0===a&&(A=138,l=3),t[2*(i+1)+1]=65535,r=0;r<=i;r++)s=a,a=t[2*(r+1)+1],++o<A&&s===a||(o<l?e.bl_tree[2*s]+=o:0!==s?(s!==n&&e.bl_tree[2*s]++,e.bl_tree[32]++):o<=10?e.bl_tree[34]++:e.bl_tree[36]++,o=0,n=s,0===a?(A=138,l=3):s===a?(A=6,l=3):(A=7,l=4))},kl=(e,t,i)=>{let r,s,n=-1,a=t[1],o=0,A=7,l=4;for(0===a&&(A=138,l=3),r=0;r<=i;r++)if(s=a,a=t[2*(r+1)+1],!(++o<A&&s===a)){if(o<l)do{Il(e,s,e.bl_tree)}while(0!=--o);else 0!==s?(s!==n&&(Il(e,s,e.bl_tree),o--),Il(e,16,e.bl_tree),pl(e,o-3,2)):o<=10?(Il(e,17,e.bl_tree),pl(e,o-3,3)):(Il(e,18,e.bl_tree),pl(e,o-11,7));o=0,n=s,0===a?(A=138,l=3):s===a?(A=6,l=3):(A=7,l=4)}};let xl=!1;const vl=(e,t,i,r)=>{pl(e,0+(r?1:0),3),Cl(e),fl(e,i),fl(e,~i),i&&e.pending_buf.set(e.window.subarray(t,t+i),e.pending),e.pending+=i};var Dl=(e,t,i,r)=>{let s,n,a=0;e.level>0?(2===e.strm.data_type&&(e.strm.data_type=(e=>{let t,i=4093624447;for(t=0;t<=31;t++,i>>>=1)if(1&i&&0!==e.dyn_ltree[2*t])return 0;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return 1;for(t=32;t<jA;t++)if(0!==e.dyn_ltree[2*t])return 1;return 0})(e)),Ql(e,e.l_desc),Ql(e,e.d_desc),a=(e=>{let t;for(bl(e,e.dyn_ltree,e.l_desc.max_code),bl(e,e.dyn_dtree,e.d_desc.max_code),Ql(e,e.bl_desc),t=18;t>=3&&0===e.bl_tree[2*il[t]+1];t--);return e.opt_len+=3*(t+1)+5+5+4,t})(e),s=e.opt_len+3+7>>>3,n=e.static_len+3+7>>>3,n<=s&&(s=n)):s=n=i+5,i+4<=s&&-1!==t?vl(e,t,i,r):4===e.strategy||n===s?(pl(e,2+(r?1:0),3),yl(e,rl,sl)):(pl(e,4+(r?1:0),3),((e,t,i,r)=>{let s;for(pl(e,t-257,5),pl(e,i-1,5),pl(e,r-4,4),s=0;s<r;s++)pl(e,e.bl_tree[2*il[s]+1],3);kl(e,e.dyn_ltree,t-1),kl(e,e.dyn_dtree,i-1)})(e,e.l_desc.max_code+1,e.d_desc.max_code+1,a+1),yl(e,e.dyn_ltree,e.dyn_dtree)),wl(e),r&&Cl(e)},Sl={_tr_init:e=>{xl||((()=>{let e,t,i,r,s;const n=new Array(16);for(i=0,r=0;r<28;r++)for(ol[r]=i,e=0;e<1<<$A[r];e++)al[i++]=r;for(al[i-1]=r,s=0,r=0;r<16;r++)for(Al[r]=s,e=0;e<1<<el[r];e++)nl[s++]=r;for(s>>=7;r<WA;r++)for(Al[r]=s<<7,e=0;e<1<<el[r]-7;e++)nl[256+s++]=r;for(t=0;t<=XA;t++)n[t]=0;for(e=0;e<=143;)rl[2*e+1]=8,e++,n[8]++;for(;e<=255;)rl[2*e+1]=9,e++,n[9]++;for(;e<=279;)rl[2*e+1]=7,e++,n[7]++;for(;e<=287;)rl[2*e+1]=8,e++,n[8]++;for(_l(rl,287,n),e=0;e<WA;e++)sl[2*e+1]=5,sl[2*e]=ml(e,5);hl=new ll(rl,$A,257,ZA,XA),cl=new ll(sl,el,0,WA,XA),gl=new ll(new Array(0),tl,0,19,7)})(),xl=!0),e.l_desc=new ul(e.dyn_ltree,hl),e.d_desc=new ul(e.dyn_dtree,cl),e.bl_desc=new ul(e.bl_tree,gl),e.bi_buf=0,e.bi_valid=0,wl(e)},_tr_stored_block:vl,_tr_flush_block:Dl,_tr_tally:(e,t,i)=>(e.pending_buf[e.sym_buf+e.sym_next++]=t,e.pending_buf[e.sym_buf+e.sym_next++]=t>>8,e.pending_buf[e.sym_buf+e.sym_next++]=i,0===t?e.dyn_ltree[2*i]++:(e.matches++,t--,e.dyn_ltree[2*(al[i]+jA+1)]++,e.dyn_dtree[2*dl(t)]++),e.sym_next===e.sym_end),_tr_align:e=>{pl(e,2,3),Il(e,256,rl),(e=>{16===e.bi_valid?(fl(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):e.bi_valid>=8&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)})(e)}};var Ml=(e,t,i,r)=>{let s=65535&e|0,n=e>>>16&65535|0,a=0;for(;0!==i;){a=i>2e3?2e3:i,i-=a;do{s=s+t[r++]|0,n=n+s|0}while(--a);s%=65521,n%=65521}return s|n<<16|0};const Ul=new Uint32Array((()=>{let e,t=[];for(var i=0;i<256;i++){e=i;for(var r=0;r<8;r++)e=1&e?3988292384^e>>>1:e>>>1;t[i]=e}return t})());var Tl=(e,t,i,r)=>{const s=Ul,n=r+i;e^=-1;for(let i=r;i<n;i++)e=e>>>8^s[255&(e^t[i])];return-1^e},Gl={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},Ll={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8};const{_tr_init:Rl,_tr_stored_block:Fl,_tr_flush_block:Nl,_tr_tally:Ol,_tr_align:Pl}=Sl,{Z_NO_FLUSH:zl,Z_PARTIAL_FLUSH:ql,Z_FULL_FLUSH:Kl,Z_FINISH:Hl,Z_BLOCK:Vl,Z_OK:Jl,Z_STREAM_END:Yl,Z_STREAM_ERROR:jl,Z_DATA_ERROR:Zl,Z_BUF_ERROR:Wl,Z_DEFAULT_COMPRESSION:Xl,Z_FILTERED:$l,Z_HUFFMAN_ONLY:eh,Z_RLE:th,Z_FIXED:ih,Z_DEFAULT_STRATEGY:rh,Z_UNKNOWN:sh,Z_DEFLATED:nh}=Ll,ah=258,oh=262,Ah=42,lh=113,hh=666,ch=(e,t)=>(e.msg=Gl[t],t),gh=e=>2*e-(e>4?9:0),uh=e=>{let t=e.length;for(;--t>=0;)e[t]=0},dh=e=>{let t,i,r,s=e.w_size;t=e.hash_size,r=t;do{i=e.head[--r],e.head[r]=i>=s?i-s:0}while(--t);t=s,r=t;do{i=e.prev[--r],e.prev[r]=i>=s?i-s:0}while(--t)};let fh=(e,t,i)=>(t<<e.hash_shift^i)&e.hash_mask;const ph=e=>{const t=e.state;let i=t.pending;i>e.avail_out&&(i=e.avail_out),0!==i&&(e.output.set(t.pending_buf.subarray(t.pending_out,t.pending_out+i),e.next_out),e.next_out+=i,t.pending_out+=i,e.total_out+=i,e.avail_out-=i,t.pending-=i,0===t.pending&&(t.pending_out=0))},Ih=(e,t)=>{Nl(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,ph(e.strm)},mh=(e,t)=>{e.pending_buf[e.pending++]=t},_h=(e,t)=>{e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t},wh=(e,t,i,r)=>{let s=e.avail_in;return s>r&&(s=r),0===s?0:(e.avail_in-=s,t.set(e.input.subarray(e.next_in,e.next_in+s),i),1===e.state.wrap?e.adler=Ml(e.adler,t,s,i):2===e.state.wrap&&(e.adler=Tl(e.adler,t,s,i)),e.next_in+=s,e.total_in+=s,s)},Ch=(e,t)=>{let i,r,s=e.max_chain_length,n=e.strstart,a=e.prev_length,o=e.nice_match;const A=e.strstart>e.w_size-oh?e.strstart-(e.w_size-oh):0,l=e.window,h=e.w_mask,c=e.prev,g=e.strstart+ah;let u=l[n+a-1],d=l[n+a];e.prev_length>=e.good_match&&(s>>=2),o>e.lookahead&&(o=e.lookahead);do{if(i=t,l[i+a]===d&&l[i+a-1]===u&&l[i]===l[n]&&l[++i]===l[n+1]){n+=2,i++;do{}while(l[++n]===l[++i]&&l[++n]===l[++i]&&l[++n]===l[++i]&&l[++n]===l[++i]&&l[++n]===l[++i]&&l[++n]===l[++i]&&l[++n]===l[++i]&&l[++n]===l[++i]&&n<g);if(r=ah-(g-n),n=g-ah,r>a){if(e.match_start=t,a=r,r>=o)break;u=l[n+a-1],d=l[n+a]}}}while((t=c[t&h])>A&&0!=--s);return a<=e.lookahead?a:e.lookahead},Bh=e=>{const t=e.w_size;let i,r,s;do{if(r=e.window_size-e.lookahead-e.strstart,e.strstart>=t+(t-oh)&&(e.window.set(e.window.subarray(t,t+t-r),0),e.match_start-=t,e.strstart-=t,e.block_start-=t,e.insert>e.strstart&&(e.insert=e.strstart),dh(e),r+=t),0===e.strm.avail_in)break;if(i=wh(e.strm,e.window,e.strstart+e.lookahead,r),e.lookahead+=i,e.lookahead+e.insert>=3)for(s=e.strstart-e.insert,e.ins_h=e.window[s],e.ins_h=fh(e,e.ins_h,e.window[s+1]);e.insert&&(e.ins_h=fh(e,e.ins_h,e.window[s+3-1]),e.prev[s&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=s,s++,e.insert--,!(e.lookahead+e.insert<3)););}while(e.lookahead<oh&&0!==e.strm.avail_in)},Eh=(e,t)=>{let i,r,s,n=e.pending_buf_size-5>e.w_size?e.w_size:e.pending_buf_size-5,a=0,o=e.strm.avail_in;do{if(i=65535,s=e.bi_valid+42>>3,e.strm.avail_out<s)break;if(s=e.strm.avail_out-s,r=e.strstart-e.block_start,i>r+e.strm.avail_in&&(i=r+e.strm.avail_in),i>s&&(i=s),i<n&&(0===i&&t!==Hl||t===zl||i!==r+e.strm.avail_in))break;a=t===Hl&&i===r+e.strm.avail_in?1:0,Fl(e,0,0,a),e.pending_buf[e.pending-4]=i,e.pending_buf[e.pending-3]=i>>8,e.pending_buf[e.pending-2]=~i,e.pending_buf[e.pending-1]=~i>>8,ph(e.strm),r&&(r>i&&(r=i),e.strm.output.set(e.window.subarray(e.block_start,e.block_start+r),e.strm.next_out),e.strm.next_out+=r,e.strm.avail_out-=r,e.strm.total_out+=r,e.block_start+=r,i-=r),i&&(wh(e.strm,e.strm.output,e.strm.next_out,i),e.strm.next_out+=i,e.strm.avail_out-=i,e.strm.total_out+=i)}while(0===a);return o-=e.strm.avail_in,o&&(o>=e.w_size?(e.matches=2,e.window.set(e.strm.input.subarray(e.strm.next_in-e.w_size,e.strm.next_in),0),e.strstart=e.w_size,e.insert=e.strstart):(e.window_size-e.strstart<=o&&(e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,e.insert>e.strstart&&(e.insert=e.strstart)),e.window.set(e.strm.input.subarray(e.strm.next_in-o,e.strm.next_in),e.strstart),e.strstart+=o,e.insert+=o>e.w_size-e.insert?e.w_size-e.insert:o),e.block_start=e.strstart),e.high_water<e.strstart&&(e.high_water=e.strstart),a?4:t!==zl&&t!==Hl&&0===e.strm.avail_in&&e.strstart===e.block_start?2:(s=e.window_size-e.strstart,e.strm.avail_in>s&&e.block_start>=e.w_size&&(e.block_start-=e.w_size,e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,s+=e.w_size,e.insert>e.strstart&&(e.insert=e.strstart)),s>e.strm.avail_in&&(s=e.strm.avail_in),s&&(wh(e.strm,e.window,e.strstart,s),e.strstart+=s,e.insert+=s>e.w_size-e.insert?e.w_size-e.insert:s),e.high_water<e.strstart&&(e.high_water=e.strstart),s=e.bi_valid+42>>3,s=e.pending_buf_size-s>65535?65535:e.pending_buf_size-s,n=s>e.w_size?e.w_size:s,r=e.strstart-e.block_start,(r>=n||(r||t===Hl)&&t!==zl&&0===e.strm.avail_in&&r<=s)&&(i=r>s?s:r,a=t===Hl&&0===e.strm.avail_in&&i===r?1:0,Fl(e,e.block_start,i,a),e.block_start+=i,ph(e.strm)),a?3:1)},yh=(e,t)=>{let i,r;for(;;){if(e.lookahead<oh){if(Bh(e),e.lookahead<oh&&t===zl)return 1;if(0===e.lookahead)break}if(i=0,e.lookahead>=3&&(e.ins_h=fh(e,e.ins_h,e.window[e.strstart+3-1]),i=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),0!==i&&e.strstart-i<=e.w_size-oh&&(e.match_length=Ch(e,i)),e.match_length>=3)if(r=Ol(e,e.strstart-e.match_start,e.match_length-3),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=3){e.match_length--;do{e.strstart++,e.ins_h=fh(e,e.ins_h,e.window[e.strstart+3-1]),i=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart}while(0!=--e.match_length);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.ins_h=e.window[e.strstart],e.ins_h=fh(e,e.ins_h,e.window[e.strstart+1]);else r=Ol(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(r&&(Ih(e,!1),0===e.strm.avail_out))return 1}return e.insert=e.strstart<2?e.strstart:2,t===Hl?(Ih(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(Ih(e,!1),0===e.strm.avail_out)?1:2},Qh=(e,t)=>{let i,r,s;for(;;){if(e.lookahead<oh){if(Bh(e),e.lookahead<oh&&t===zl)return 1;if(0===e.lookahead)break}if(i=0,e.lookahead>=3&&(e.ins_h=fh(e,e.ins_h,e.window[e.strstart+3-1]),i=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=2,0!==i&&e.prev_length<e.max_lazy_match&&e.strstart-i<=e.w_size-oh&&(e.match_length=Ch(e,i),e.match_length<=5&&(e.strategy===$l||3===e.match_length&&e.strstart-e.match_start>4096)&&(e.match_length=2)),e.prev_length>=3&&e.match_length<=e.prev_length){s=e.strstart+e.lookahead-3,r=Ol(e,e.strstart-1-e.prev_match,e.prev_length-3),e.lookahead-=e.prev_length-1,e.prev_length-=2;do{++e.strstart<=s&&(e.ins_h=fh(e,e.ins_h,e.window[e.strstart+3-1]),i=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart)}while(0!=--e.prev_length);if(e.match_available=0,e.match_length=2,e.strstart++,r&&(Ih(e,!1),0===e.strm.avail_out))return 1}else if(e.match_available){if(r=Ol(e,0,e.window[e.strstart-1]),r&&Ih(e,!1),e.strstart++,e.lookahead--,0===e.strm.avail_out)return 1}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(r=Ol(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<2?e.strstart:2,t===Hl?(Ih(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(Ih(e,!1),0===e.strm.avail_out)?1:2};function bh(e,t,i,r,s){this.good_length=e,this.max_lazy=t,this.nice_length=i,this.max_chain=r,this.func=s}const kh=[new bh(0,0,0,0,Eh),new bh(4,4,8,4,yh),new bh(4,5,16,8,yh),new bh(4,6,32,32,yh),new bh(4,4,16,16,Qh),new bh(8,16,32,32,Qh),new bh(8,16,128,128,Qh),new bh(8,32,128,256,Qh),new bh(32,128,258,1024,Qh),new bh(32,258,258,4096,Qh)];function xh(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=nh,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(1146),this.dyn_dtree=new Uint16Array(122),this.bl_tree=new Uint16Array(78),uh(this.dyn_ltree),uh(this.dyn_dtree),uh(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(16),this.heap=new Uint16Array(573),uh(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(573),uh(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}const vh=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||t.status!==Ah&&57!==t.status&&69!==t.status&&73!==t.status&&91!==t.status&&103!==t.status&&t.status!==lh&&t.status!==hh?1:0},Dh=e=>{if(vh(e))return ch(e,jl);e.total_in=e.total_out=0,e.data_type=sh;const t=e.state;return t.pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=2===t.wrap?57:t.wrap?Ah:lh,e.adler=2===t.wrap?0:1,t.last_flush=-2,Rl(t),Jl},Sh=e=>{const t=Dh(e);var i;return t===Jl&&((i=e.state).window_size=2*i.w_size,uh(i.head),i.max_lazy_match=kh[i.level].max_lazy,i.good_match=kh[i.level].good_length,i.nice_match=kh[i.level].nice_length,i.max_chain_length=kh[i.level].max_chain,i.strstart=0,i.block_start=0,i.lookahead=0,i.insert=0,i.match_length=i.prev_length=2,i.match_available=0,i.ins_h=0),t},Mh=(e,t,i,r,s,n)=>{if(!e)return jl;let a=1;if(t===Xl&&(t=6),r<0?(a=0,r=-r):r>15&&(a=2,r-=16),s<1||s>9||i!==nh||r<8||r>15||t<0||t>9||n<0||n>ih||8===r&&1!==a)return ch(e,jl);8===r&&(r=9);const o=new xh;return e.state=o,o.strm=e,o.status=Ah,o.wrap=a,o.gzhead=null,o.w_bits=r,o.w_size=1<<o.w_bits,o.w_mask=o.w_size-1,o.hash_bits=s+7,o.hash_size=1<<o.hash_bits,o.hash_mask=o.hash_size-1,o.hash_shift=~~((o.hash_bits+3-1)/3),o.window=new Uint8Array(2*o.w_size),o.head=new Uint16Array(o.hash_size),o.prev=new Uint16Array(o.w_size),o.lit_bufsize=1<<s+6,o.pending_buf_size=4*o.lit_bufsize,o.pending_buf=new Uint8Array(o.pending_buf_size),o.sym_buf=o.lit_bufsize,o.sym_end=3*(o.lit_bufsize-1),o.level=t,o.strategy=n,o.method=i,Sh(e)};var Uh={deflateInit:(e,t)=>Mh(e,t,nh,15,8,rh),deflateInit2:Mh,deflateReset:Sh,deflateResetKeep:Dh,deflateSetHeader:(e,t)=>vh(e)||2!==e.state.wrap?jl:(e.state.gzhead=t,Jl),deflate:(e,t)=>{if(vh(e)||t>Vl||t<0)return e?ch(e,jl):jl;const i=e.state;if(!e.output||0!==e.avail_in&&!e.input||i.status===hh&&t!==Hl)return ch(e,0===e.avail_out?Wl:jl);const r=i.last_flush;if(i.last_flush=t,0!==i.pending){if(ph(e),0===e.avail_out)return i.last_flush=-1,Jl}else if(0===e.avail_in&&gh(t)<=gh(r)&&t!==Hl)return ch(e,Wl);if(i.status===hh&&0!==e.avail_in)return ch(e,Wl);if(i.status===Ah&&0===i.wrap&&(i.status=lh),i.status===Ah){let t=nh+(i.w_bits-8<<4)<<8,r=-1;if(r=i.strategy>=eh||i.level<2?0:i.level<6?1:6===i.level?2:3,t|=r<<6,0!==i.strstart&&(t|=32),t+=31-t%31,_h(i,t),0!==i.strstart&&(_h(i,e.adler>>>16),_h(i,65535&e.adler)),e.adler=1,i.status=lh,ph(e),0!==i.pending)return i.last_flush=-1,Jl}if(57===i.status)if(e.adler=0,mh(i,31),mh(i,139),mh(i,8),i.gzhead)mh(i,(i.gzhead.text?1:0)+(i.gzhead.hcrc?2:0)+(i.gzhead.extra?4:0)+(i.gzhead.name?8:0)+(i.gzhead.comment?16:0)),mh(i,255&i.gzhead.time),mh(i,i.gzhead.time>>8&255),mh(i,i.gzhead.time>>16&255),mh(i,i.gzhead.time>>24&255),mh(i,9===i.level?2:i.strategy>=eh||i.level<2?4:0),mh(i,255&i.gzhead.os),i.gzhead.extra&&i.gzhead.extra.length&&(mh(i,255&i.gzhead.extra.length),mh(i,i.gzhead.extra.length>>8&255)),i.gzhead.hcrc&&(e.adler=Tl(e.adler,i.pending_buf,i.pending,0)),i.gzindex=0,i.status=69;else if(mh(i,0),mh(i,0),mh(i,0),mh(i,0),mh(i,0),mh(i,9===i.level?2:i.strategy>=eh||i.level<2?4:0),mh(i,3),i.status=lh,ph(e),0!==i.pending)return i.last_flush=-1,Jl;if(69===i.status){if(i.gzhead.extra){let t=i.pending,r=(65535&i.gzhead.extra.length)-i.gzindex;for(;i.pending+r>i.pending_buf_size;){let s=i.pending_buf_size-i.pending;if(i.pending_buf.set(i.gzhead.extra.subarray(i.gzindex,i.gzindex+s),i.pending),i.pending=i.pending_buf_size,i.gzhead.hcrc&&i.pending>t&&(e.adler=Tl(e.adler,i.pending_buf,i.pending-t,t)),i.gzindex+=s,ph(e),0!==i.pending)return i.last_flush=-1,Jl;t=0,r-=s}let s=new Uint8Array(i.gzhead.extra);i.pending_buf.set(s.subarray(i.gzindex,i.gzindex+r),i.pending),i.pending+=r,i.gzhead.hcrc&&i.pending>t&&(e.adler=Tl(e.adler,i.pending_buf,i.pending-t,t)),i.gzindex=0}i.status=73}if(73===i.status){if(i.gzhead.name){let t,r=i.pending;do{if(i.pending===i.pending_buf_size){if(i.gzhead.hcrc&&i.pending>r&&(e.adler=Tl(e.adler,i.pending_buf,i.pending-r,r)),ph(e),0!==i.pending)return i.last_flush=-1,Jl;r=0}t=i.gzindex<i.gzhead.name.length?255&i.gzhead.name.charCodeAt(i.gzindex++):0,mh(i,t)}while(0!==t);i.gzhead.hcrc&&i.pending>r&&(e.adler=Tl(e.adler,i.pending_buf,i.pending-r,r)),i.gzindex=0}i.status=91}if(91===i.status){if(i.gzhead.comment){let t,r=i.pending;do{if(i.pending===i.pending_buf_size){if(i.gzhead.hcrc&&i.pending>r&&(e.adler=Tl(e.adler,i.pending_buf,i.pending-r,r)),ph(e),0!==i.pending)return i.last_flush=-1,Jl;r=0}t=i.gzindex<i.gzhead.comment.length?255&i.gzhead.comment.charCodeAt(i.gzindex++):0,mh(i,t)}while(0!==t);i.gzhead.hcrc&&i.pending>r&&(e.adler=Tl(e.adler,i.pending_buf,i.pending-r,r))}i.status=103}if(103===i.status){if(i.gzhead.hcrc){if(i.pending+2>i.pending_buf_size&&(ph(e),0!==i.pending))return i.last_flush=-1,Jl;mh(i,255&e.adler),mh(i,e.adler>>8&255),e.adler=0}if(i.status=lh,ph(e),0!==i.pending)return i.last_flush=-1,Jl}if(0!==e.avail_in||0!==i.lookahead||t!==zl&&i.status!==hh){let r=0===i.level?Eh(i,t):i.strategy===eh?((e,t)=>{let i;for(;;){if(0===e.lookahead&&(Bh(e),0===e.lookahead)){if(t===zl)return 1;break}if(e.match_length=0,i=Ol(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,i&&(Ih(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,t===Hl?(Ih(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(Ih(e,!1),0===e.strm.avail_out)?1:2})(i,t):i.strategy===th?((e,t)=>{let i,r,s,n;const a=e.window;for(;;){if(e.lookahead<=ah){if(Bh(e),e.lookahead<=ah&&t===zl)return 1;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=3&&e.strstart>0&&(s=e.strstart-1,r=a[s],r===a[++s]&&r===a[++s]&&r===a[++s])){n=e.strstart+ah;do{}while(r===a[++s]&&r===a[++s]&&r===a[++s]&&r===a[++s]&&r===a[++s]&&r===a[++s]&&r===a[++s]&&r===a[++s]&&s<n);e.match_length=ah-(n-s),e.match_length>e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=3?(i=Ol(e,1,e.match_length-3),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(i=Ol(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),i&&(Ih(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,t===Hl?(Ih(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(Ih(e,!1),0===e.strm.avail_out)?1:2})(i,t):kh[i.level].func(i,t);if(3!==r&&4!==r||(i.status=hh),1===r||3===r)return 0===e.avail_out&&(i.last_flush=-1),Jl;if(2===r&&(t===ql?Pl(i):t!==Vl&&(Fl(i,0,0,!1),t===Kl&&(uh(i.head),0===i.lookahead&&(i.strstart=0,i.block_start=0,i.insert=0))),ph(e),0===e.avail_out))return i.last_flush=-1,Jl}return t!==Hl?Jl:i.wrap<=0?Yl:(2===i.wrap?(mh(i,255&e.adler),mh(i,e.adler>>8&255),mh(i,e.adler>>16&255),mh(i,e.adler>>24&255),mh(i,255&e.total_in),mh(i,e.total_in>>8&255),mh(i,e.total_in>>16&255),mh(i,e.total_in>>24&255)):(_h(i,e.adler>>>16),_h(i,65535&e.adler)),ph(e),i.wrap>0&&(i.wrap=-i.wrap),0!==i.pending?Jl:Yl)},deflateEnd:e=>{if(vh(e))return jl;const t=e.state.status;return e.state=null,t===lh?ch(e,Zl):Jl},deflateSetDictionary:(e,t)=>{let i=t.length;if(vh(e))return jl;const r=e.state,s=r.wrap;if(2===s||1===s&&r.status!==Ah||r.lookahead)return jl;if(1===s&&(e.adler=Ml(e.adler,t,i,0)),r.wrap=0,i>=r.w_size){0===s&&(uh(r.head),r.strstart=0,r.block_start=0,r.insert=0);let e=new Uint8Array(r.w_size);e.set(t.subarray(i-r.w_size,i),0),t=e,i=r.w_size}const n=e.avail_in,a=e.next_in,o=e.input;for(e.avail_in=i,e.next_in=0,e.input=t,Bh(r);r.lookahead>=3;){let e=r.strstart,t=r.lookahead-2;do{r.ins_h=fh(r,r.ins_h,r.window[e+3-1]),r.prev[e&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=e,e++}while(--t);r.strstart=e,r.lookahead=2,Bh(r)}return r.strstart+=r.lookahead,r.block_start=r.strstart,r.insert=r.lookahead,r.lookahead=0,r.match_length=r.prev_length=2,r.match_available=0,e.next_in=a,e.input=o,e.avail_in=n,r.wrap=s,Jl},deflateInfo:"pako deflate (from Nodeca project)"};const Th=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var Gh={assign:function(e){const t=Array.prototype.slice.call(arguments,1);for(;t.length;){const i=t.shift();if(i){if("object"!=typeof i)throw new TypeError(i+"must be non-object");for(const t in i)Th(i,t)&&(e[t]=i[t])}}return e},flattenChunks:e=>{let t=0;for(let i=0,r=e.length;i<r;i++)t+=e[i].length;const i=new Uint8Array(t);for(let t=0,r=0,s=e.length;t<s;t++){let s=e[t];i.set(s,r),r+=s.length}return i}};let Lh=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(e){Lh=!1}const Rh=new Uint8Array(256);for(let e=0;e<256;e++)Rh[e]=e>=252?6:e>=248?5:e>=240?4:e>=224?3:e>=192?2:1;Rh[254]=Rh[254]=1;var Fh={string2buf:e=>{if("function"==typeof TextEncoder&&TextEncoder.prototype.encode)return(new TextEncoder).encode(e);let t,i,r,s,n,a=e.length,o=0;for(s=0;s<a;s++)i=e.charCodeAt(s),55296==(64512&i)&&s+1<a&&(r=e.charCodeAt(s+1),56320==(64512&r)&&(i=65536+(i-55296<<10)+(r-56320),s++)),o+=i<128?1:i<2048?2:i<65536?3:4;for(t=new Uint8Array(o),n=0,s=0;n<o;s++)i=e.charCodeAt(s),55296==(64512&i)&&s+1<a&&(r=e.charCodeAt(s+1),56320==(64512&r)&&(i=65536+(i-55296<<10)+(r-56320),s++)),i<128?t[n++]=i:i<2048?(t[n++]=192|i>>>6,t[n++]=128|63&i):i<65536?(t[n++]=224|i>>>12,t[n++]=128|i>>>6&63,t[n++]=128|63&i):(t[n++]=240|i>>>18,t[n++]=128|i>>>12&63,t[n++]=128|i>>>6&63,t[n++]=128|63&i);return t},buf2string:(e,t)=>{const i=t||e.length;if("function"==typeof TextDecoder&&TextDecoder.prototype.decode)return(new TextDecoder).decode(e.subarray(0,t));let r,s;const n=new Array(2*i);for(s=0,r=0;r<i;){let t=e[r++];if(t<128){n[s++]=t;continue}let a=Rh[t];if(a>4)n[s++]=65533,r+=a-1;else{for(t&=2===a?31:3===a?15:7;a>1&&r<i;)t=t<<6|63&e[r++],a--;a>1?n[s++]=65533:t<65536?n[s++]=t:(t-=65536,n[s++]=55296|t>>10&1023,n[s++]=56320|1023&t)}}return((e,t)=>{if(t<65534&&e.subarray&&Lh)return String.fromCharCode.apply(null,e.length===t?e:e.subarray(0,t));let i="";for(let r=0;r<t;r++)i+=String.fromCharCode(e[r]);return i})(n,s)},utf8border:(e,t)=>{(t=t||e.length)>e.length&&(t=e.length);let i=t-1;for(;i>=0&&128==(192&e[i]);)i--;return i<0||0===i?t:i+Rh[e[i]]>t?i:t}};var Nh=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0};const Oh=Object.prototype.toString,{Z_NO_FLUSH:Ph,Z_SYNC_FLUSH:zh,Z_FULL_FLUSH:qh,Z_FINISH:Kh,Z_OK:Hh,Z_STREAM_END:Vh,Z_DEFAULT_COMPRESSION:Jh,Z_DEFAULT_STRATEGY:Yh,Z_DEFLATED:jh}=Ll;function Zh(e){this.options=Gh.assign({level:Jh,method:jh,chunkSize:16384,windowBits:15,memLevel:8,strategy:Yh},e||{});let t=this.options;t.raw&&t.windowBits>0?t.windowBits=-t.windowBits:t.gzip&&t.windowBits>0&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new Nh,this.strm.avail_out=0;let i=Uh.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(i!==Hh)throw new Error(Gl[i]);if(t.header&&Uh.deflateSetHeader(this.strm,t.header),t.dictionary){let e;if(e="string"==typeof t.dictionary?Fh.string2buf(t.dictionary):"[object ArrayBuffer]"===Oh.call(t.dictionary)?new Uint8Array(t.dictionary):t.dictionary,i=Uh.deflateSetDictionary(this.strm,e),i!==Hh)throw new Error(Gl[i]);this._dict_set=!0}}Zh.prototype.push=function(e,t){const i=this.strm,r=this.options.chunkSize;let s,n;if(this.ended)return!1;for(n=t===~~t?t:!0===t?Kh:Ph,"string"==typeof e?i.input=Fh.string2buf(e):"[object ArrayBuffer]"===Oh.call(e)?i.input=new Uint8Array(e):i.input=e,i.next_in=0,i.avail_in=i.input.length;;)if(0===i.avail_out&&(i.output=new Uint8Array(r),i.next_out=0,i.avail_out=r),(n===zh||n===qh)&&i.avail_out<=6)this.onData(i.output.subarray(0,i.next_out)),i.avail_out=0;else{if(s=Uh.deflate(i,n),s===Vh)return i.next_out>0&&this.onData(i.output.subarray(0,i.next_out)),s=Uh.deflateEnd(this.strm),this.onEnd(s),this.ended=!0,s===Hh;if(0!==i.avail_out){if(n>0&&i.next_out>0)this.onData(i.output.subarray(0,i.next_out)),i.avail_out=0;else if(0===i.avail_in)break}else this.onData(i.output)}return!0},Zh.prototype.onData=function(e){this.chunks.push(e)},Zh.prototype.onEnd=function(e){e===Hh&&(this.result=Gh.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};const Wh=16209;var Xh=function(e,t){let i,r,s,n,a,o,A,l,h,c,g,u,d,f,p,I,m,_,w,C,B,E,y,Q;const b=e.state;i=e.next_in,y=e.input,r=i+(e.avail_in-5),s=e.next_out,Q=e.output,n=s-(t-e.avail_out),a=s+(e.avail_out-257),o=b.dmax,A=b.wsize,l=b.whave,h=b.wnext,c=b.window,g=b.hold,u=b.bits,d=b.lencode,f=b.distcode,p=(1<<b.lenbits)-1,I=(1<<b.distbits)-1;e:do{u<15&&(g+=y[i++]<<u,u+=8,g+=y[i++]<<u,u+=8),m=d[g&p];t:for(;;){if(_=m>>>24,g>>>=_,u-=_,_=m>>>16&255,0===_)Q[s++]=65535&m;else{if(!(16&_)){if(0==(64&_)){m=d[(65535&m)+(g&(1<<_)-1)];continue t}if(32&_){b.mode=16191;break e}e.msg="invalid literal/length code",b.mode=Wh;break e}w=65535&m,_&=15,_&&(u<_&&(g+=y[i++]<<u,u+=8),w+=g&(1<<_)-1,g>>>=_,u-=_),u<15&&(g+=y[i++]<<u,u+=8,g+=y[i++]<<u,u+=8),m=f[g&I];i:for(;;){if(_=m>>>24,g>>>=_,u-=_,_=m>>>16&255,!(16&_)){if(0==(64&_)){m=f[(65535&m)+(g&(1<<_)-1)];continue i}e.msg="invalid distance code",b.mode=Wh;break e}if(C=65535&m,_&=15,u<_&&(g+=y[i++]<<u,u+=8,u<_&&(g+=y[i++]<<u,u+=8)),C+=g&(1<<_)-1,C>o){e.msg="invalid distance too far back",b.mode=Wh;break e}if(g>>>=_,u-=_,_=s-n,C>_){if(_=C-_,_>l&&b.sane){e.msg="invalid distance too far back",b.mode=Wh;break e}if(B=0,E=c,0===h){if(B+=A-_,_<w){w-=_;do{Q[s++]=c[B++]}while(--_);B=s-C,E=Q}}else if(h<_){if(B+=A+h-_,_-=h,_<w){w-=_;do{Q[s++]=c[B++]}while(--_);if(B=0,h<w){_=h,w-=_;do{Q[s++]=c[B++]}while(--_);B=s-C,E=Q}}}else if(B+=h-_,_<w){w-=_;do{Q[s++]=c[B++]}while(--_);B=s-C,E=Q}for(;w>2;)Q[s++]=E[B++],Q[s++]=E[B++],Q[s++]=E[B++],w-=3;w&&(Q[s++]=E[B++],w>1&&(Q[s++]=E[B++]))}else{B=s-C;do{Q[s++]=Q[B++],Q[s++]=Q[B++],Q[s++]=Q[B++],w-=3}while(w>2);w&&(Q[s++]=Q[B++],w>1&&(Q[s++]=Q[B++]))}break}}break}}while(i<r&&s<a);w=u>>3,i-=w,u-=w<<3,g&=(1<<u)-1,e.next_in=i,e.next_out=s,e.avail_in=i<r?r-i+5:5-(i-r),e.avail_out=s<a?a-s+257:257-(s-a),b.hold=g,b.bits=u};const $h=15,ec=new Uint16Array([3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0]),tc=new Uint8Array([16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78]),ic=new Uint16Array([1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0]),rc=new Uint8Array([16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64]);var sc=(e,t,i,r,s,n,a,o)=>{const A=o.bits;let l,h,c,g,u,d,f=0,p=0,I=0,m=0,_=0,w=0,C=0,B=0,E=0,y=0,Q=null;const b=new Uint16Array(16),k=new Uint16Array(16);let x,v,D,S=null;for(f=0;f<=$h;f++)b[f]=0;for(p=0;p<r;p++)b[t[i+p]]++;for(_=A,m=$h;m>=1&&0===b[m];m--);if(_>m&&(_=m),0===m)return s[n++]=20971520,s[n++]=20971520,o.bits=1,0;for(I=1;I<m&&0===b[I];I++);for(_<I&&(_=I),B=1,f=1;f<=$h;f++)if(B<<=1,B-=b[f],B<0)return-1;if(B>0&&(0===e||1!==m))return-1;for(k[1]=0,f=1;f<$h;f++)k[f+1]=k[f]+b[f];for(p=0;p<r;p++)0!==t[i+p]&&(a[k[t[i+p]]++]=p);if(0===e?(Q=S=a,d=20):1===e?(Q=ec,S=tc,d=257):(Q=ic,S=rc,d=0),y=0,p=0,f=I,u=n,w=_,C=0,c=-1,E=1<<_,g=E-1,1===e&&E>852||2===e&&E>592)return 1;for(;;){x=f-C,a[p]+1<d?(v=0,D=a[p]):a[p]>=d?(v=S[a[p]-d],D=Q[a[p]-d]):(v=96,D=0),l=1<<f-C,h=1<<w,I=h;do{h-=l,s[u+(y>>C)+h]=x<<24|v<<16|D|0}while(0!==h);for(l=1<<f-1;y&l;)l>>=1;if(0!==l?(y&=l-1,y+=l):y=0,p++,0==--b[f]){if(f===m)break;f=t[i+a[p]]}if(f>_&&(y&g)!==c){for(0===C&&(C=_),u+=I,w=f-C,B=1<<w;w+C<m&&(B-=b[w+C],!(B<=0));)w++,B<<=1;if(E+=1<<w,1===e&&E>852||2===e&&E>592)return 1;c=y&g,s[c]=_<<24|w<<16|u-n|0}}return 0!==y&&(s[u+y]=f-C<<24|64<<16|0),o.bits=_,0};const{Z_FINISH:nc,Z_BLOCK:ac,Z_TREES:oc,Z_OK:Ac,Z_STREAM_END:lc,Z_NEED_DICT:hc,Z_STREAM_ERROR:cc,Z_DATA_ERROR:gc,Z_MEM_ERROR:uc,Z_BUF_ERROR:dc,Z_DEFLATED:fc}=Ll,pc=16180,Ic=16190,mc=16191,_c=16192,wc=16194,Cc=16199,Bc=16200,Ec=16206,yc=16209,Qc=e=>(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24);function bc(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}const kc=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||t.mode<pc||t.mode>16211?1:0},xc=e=>{if(kc(e))return cc;const t=e.state;return e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=pc,t.last=0,t.havedict=0,t.flags=-1,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new Int32Array(852),t.distcode=t.distdyn=new Int32Array(592),t.sane=1,t.back=-1,Ac},vc=e=>{if(kc(e))return cc;const t=e.state;return t.wsize=0,t.whave=0,t.wnext=0,xc(e)},Dc=(e,t)=>{let i;if(kc(e))return cc;const r=e.state;return t<0?(i=0,t=-t):(i=5+(t>>4),t<48&&(t&=15)),t&&(t<8||t>15)?cc:(null!==r.window&&r.wbits!==t&&(r.window=null),r.wrap=i,r.wbits=t,vc(e))},Sc=(e,t)=>{if(!e)return cc;const i=new bc;e.state=i,i.strm=e,i.window=null,i.mode=pc;const r=Dc(e,t);return r!==Ac&&(e.state=null),r};let Mc,Uc,Tc=!0;const Gc=e=>{if(Tc){Mc=new Int32Array(512),Uc=new Int32Array(32);let t=0;for(;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(sc(1,e.lens,0,288,Mc,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;sc(2,e.lens,0,32,Uc,0,e.work,{bits:5}),Tc=!1}e.lencode=Mc,e.lenbits=9,e.distcode=Uc,e.distbits=5},Lc=(e,t,i,r)=>{let s;const n=e.state;return null===n.window&&(n.wsize=1<<n.wbits,n.wnext=0,n.whave=0,n.window=new Uint8Array(n.wsize)),r>=n.wsize?(n.window.set(t.subarray(i-n.wsize,i),0),n.wnext=0,n.whave=n.wsize):(s=n.wsize-n.wnext,s>r&&(s=r),n.window.set(t.subarray(i-r,i-r+s),n.wnext),(r-=s)?(n.window.set(t.subarray(i-r,i),0),n.wnext=r,n.whave=n.wsize):(n.wnext+=s,n.wnext===n.wsize&&(n.wnext=0),n.whave<n.wsize&&(n.whave+=s))),0};var Rc={inflateReset:vc,inflateReset2:Dc,inflateResetKeep:xc,inflateInit:e=>Sc(e,15),inflateInit2:Sc,inflate:(e,t)=>{let i,r,s,n,a,o,A,l,h,c,g,u,d,f,p,I,m,_,w,C,B,E,y=0;const Q=new Uint8Array(4);let b,k;const x=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(kc(e)||!e.output||!e.input&&0!==e.avail_in)return cc;i=e.state,i.mode===mc&&(i.mode=_c),a=e.next_out,s=e.output,A=e.avail_out,n=e.next_in,r=e.input,o=e.avail_in,l=i.hold,h=i.bits,c=o,g=A,E=Ac;e:for(;;)switch(i.mode){case pc:if(0===i.wrap){i.mode=_c;break}for(;h<16;){if(0===o)break e;o--,l+=r[n++]<<h,h+=8}if(2&i.wrap&&35615===l){0===i.wbits&&(i.wbits=15),i.check=0,Q[0]=255&l,Q[1]=l>>>8&255,i.check=Tl(i.check,Q,2,0),l=0,h=0,i.mode=16181;break}if(i.head&&(i.head.done=!1),!(1&i.wrap)||(((255&l)<<8)+(l>>8))%31){e.msg="incorrect header check",i.mode=yc;break}if((15&l)!==fc){e.msg="unknown compression method",i.mode=yc;break}if(l>>>=4,h-=4,B=8+(15&l),0===i.wbits&&(i.wbits=B),B>15||B>i.wbits){e.msg="invalid window size",i.mode=yc;break}i.dmax=1<<i.wbits,i.flags=0,e.adler=i.check=1,i.mode=512&l?16189:mc,l=0,h=0;break;case 16181:for(;h<16;){if(0===o)break e;o--,l+=r[n++]<<h,h+=8}if(i.flags=l,(255&i.flags)!==fc){e.msg="unknown compression method",i.mode=yc;break}if(57344&i.flags){e.msg="unknown header flags set",i.mode=yc;break}i.head&&(i.head.text=l>>8&1),512&i.flags&&4&i.wrap&&(Q[0]=255&l,Q[1]=l>>>8&255,i.check=Tl(i.check,Q,2,0)),l=0,h=0,i.mode=16182;case 16182:for(;h<32;){if(0===o)break e;o--,l+=r[n++]<<h,h+=8}i.head&&(i.head.time=l),512&i.flags&&4&i.wrap&&(Q[0]=255&l,Q[1]=l>>>8&255,Q[2]=l>>>16&255,Q[3]=l>>>24&255,i.check=Tl(i.check,Q,4,0)),l=0,h=0,i.mode=16183;case 16183:for(;h<16;){if(0===o)break e;o--,l+=r[n++]<<h,h+=8}i.head&&(i.head.xflags=255&l,i.head.os=l>>8),512&i.flags&&4&i.wrap&&(Q[0]=255&l,Q[1]=l>>>8&255,i.check=Tl(i.check,Q,2,0)),l=0,h=0,i.mode=16184;case 16184:if(1024&i.flags){for(;h<16;){if(0===o)break e;o--,l+=r[n++]<<h,h+=8}i.length=l,i.head&&(i.head.extra_len=l),512&i.flags&&4&i.wrap&&(Q[0]=255&l,Q[1]=l>>>8&255,i.check=Tl(i.check,Q,2,0)),l=0,h=0}else i.head&&(i.head.extra=null);i.mode=16185;case 16185:if(1024&i.flags&&(u=i.length,u>o&&(u=o),u&&(i.head&&(B=i.head.extra_len-i.length,i.head.extra||(i.head.extra=new Uint8Array(i.head.extra_len)),i.head.extra.set(r.subarray(n,n+u),B)),512&i.flags&&4&i.wrap&&(i.check=Tl(i.check,r,u,n)),o-=u,n+=u,i.length-=u),i.length))break e;i.length=0,i.mode=16186;case 16186:if(2048&i.flags){if(0===o)break e;u=0;do{B=r[n+u++],i.head&&B&&i.length<65536&&(i.head.name+=String.fromCharCode(B))}while(B&&u<o);if(512&i.flags&&4&i.wrap&&(i.check=Tl(i.check,r,u,n)),o-=u,n+=u,B)break e}else i.head&&(i.head.name=null);i.length=0,i.mode=16187;case 16187:if(4096&i.flags){if(0===o)break e;u=0;do{B=r[n+u++],i.head&&B&&i.length<65536&&(i.head.comment+=String.fromCharCode(B))}while(B&&u<o);if(512&i.flags&&4&i.wrap&&(i.check=Tl(i.check,r,u,n)),o-=u,n+=u,B)break e}else i.head&&(i.head.comment=null);i.mode=16188;case 16188:if(512&i.flags){for(;h<16;){if(0===o)break e;o--,l+=r[n++]<<h,h+=8}if(4&i.wrap&&l!==(65535&i.check)){e.msg="header crc mismatch",i.mode=yc;break}l=0,h=0}i.head&&(i.head.hcrc=i.flags>>9&1,i.head.done=!0),e.adler=i.check=0,i.mode=mc;break;case 16189:for(;h<32;){if(0===o)break e;o--,l+=r[n++]<<h,h+=8}e.adler=i.check=Qc(l),l=0,h=0,i.mode=Ic;case Ic:if(0===i.havedict)return e.next_out=a,e.avail_out=A,e.next_in=n,e.avail_in=o,i.hold=l,i.bits=h,hc;e.adler=i.check=1,i.mode=mc;case mc:if(t===ac||t===oc)break e;case _c:if(i.last){l>>>=7&h,h-=7&h,i.mode=Ec;break}for(;h<3;){if(0===o)break e;o--,l+=r[n++]<<h,h+=8}switch(i.last=1&l,l>>>=1,h-=1,3&l){case 0:i.mode=16193;break;case 1:if(Gc(i),i.mode=Cc,t===oc){l>>>=2,h-=2;break e}break;case 2:i.mode=16196;break;case 3:e.msg="invalid block type",i.mode=yc}l>>>=2,h-=2;break;case 16193:for(l>>>=7&h,h-=7&h;h<32;){if(0===o)break e;o--,l+=r[n++]<<h,h+=8}if((65535&l)!=(l>>>16^65535)){e.msg="invalid stored block lengths",i.mode=yc;break}if(i.length=65535&l,l=0,h=0,i.mode=wc,t===oc)break e;case wc:i.mode=16195;case 16195:if(u=i.length,u){if(u>o&&(u=o),u>A&&(u=A),0===u)break e;s.set(r.subarray(n,n+u),a),o-=u,n+=u,A-=u,a+=u,i.length-=u;break}i.mode=mc;break;case 16196:for(;h<14;){if(0===o)break e;o--,l+=r[n++]<<h,h+=8}if(i.nlen=257+(31&l),l>>>=5,h-=5,i.ndist=1+(31&l),l>>>=5,h-=5,i.ncode=4+(15&l),l>>>=4,h-=4,i.nlen>286||i.ndist>30){e.msg="too many length or distance symbols",i.mode=yc;break}i.have=0,i.mode=16197;case 16197:for(;i.have<i.ncode;){for(;h<3;){if(0===o)break e;o--,l+=r[n++]<<h,h+=8}i.lens[x[i.have++]]=7&l,l>>>=3,h-=3}for(;i.have<19;)i.lens[x[i.have++]]=0;if(i.lencode=i.lendyn,i.lenbits=7,b={bits:i.lenbits},E=sc(0,i.lens,0,19,i.lencode,0,i.work,b),i.lenbits=b.bits,E){e.msg="invalid code lengths set",i.mode=yc;break}i.have=0,i.mode=16198;case 16198:for(;i.have<i.nlen+i.ndist;){for(;y=i.lencode[l&(1<<i.lenbits)-1],p=y>>>24,I=y>>>16&255,m=65535&y,!(p<=h);){if(0===o)break e;o--,l+=r[n++]<<h,h+=8}if(m<16)l>>>=p,h-=p,i.lens[i.have++]=m;else{if(16===m){for(k=p+2;h<k;){if(0===o)break e;o--,l+=r[n++]<<h,h+=8}if(l>>>=p,h-=p,0===i.have){e.msg="invalid bit length repeat",i.mode=yc;break}B=i.lens[i.have-1],u=3+(3&l),l>>>=2,h-=2}else if(17===m){for(k=p+3;h<k;){if(0===o)break e;o--,l+=r[n++]<<h,h+=8}l>>>=p,h-=p,B=0,u=3+(7&l),l>>>=3,h-=3}else{for(k=p+7;h<k;){if(0===o)break e;o--,l+=r[n++]<<h,h+=8}l>>>=p,h-=p,B=0,u=11+(127&l),l>>>=7,h-=7}if(i.have+u>i.nlen+i.ndist){e.msg="invalid bit length repeat",i.mode=yc;break}for(;u--;)i.lens[i.have++]=B}}if(i.mode===yc)break;if(0===i.lens[256]){e.msg="invalid code -- missing end-of-block",i.mode=yc;break}if(i.lenbits=9,b={bits:i.lenbits},E=sc(1,i.lens,0,i.nlen,i.lencode,0,i.work,b),i.lenbits=b.bits,E){e.msg="invalid literal/lengths set",i.mode=yc;break}if(i.distbits=6,i.distcode=i.distdyn,b={bits:i.distbits},E=sc(2,i.lens,i.nlen,i.ndist,i.distcode,0,i.work,b),i.distbits=b.bits,E){e.msg="invalid distances set",i.mode=yc;break}if(i.mode=Cc,t===oc)break e;case Cc:i.mode=Bc;case Bc:if(o>=6&&A>=258){e.next_out=a,e.avail_out=A,e.next_in=n,e.avail_in=o,i.hold=l,i.bits=h,Xh(e,g),a=e.next_out,s=e.output,A=e.avail_out,n=e.next_in,r=e.input,o=e.avail_in,l=i.hold,h=i.bits,i.mode===mc&&(i.back=-1);break}for(i.back=0;y=i.lencode[l&(1<<i.lenbits)-1],p=y>>>24,I=y>>>16&255,m=65535&y,!(p<=h);){if(0===o)break e;o--,l+=r[n++]<<h,h+=8}if(I&&0==(240&I)){for(_=p,w=I,C=m;y=i.lencode[C+((l&(1<<_+w)-1)>>_)],p=y>>>24,I=y>>>16&255,m=65535&y,!(_+p<=h);){if(0===o)break e;o--,l+=r[n++]<<h,h+=8}l>>>=_,h-=_,i.back+=_}if(l>>>=p,h-=p,i.back+=p,i.length=m,0===I){i.mode=16205;break}if(32&I){i.back=-1,i.mode=mc;break}if(64&I){e.msg="invalid literal/length code",i.mode=yc;break}i.extra=15&I,i.mode=16201;case 16201:if(i.extra){for(k=i.extra;h<k;){if(0===o)break e;o--,l+=r[n++]<<h,h+=8}i.length+=l&(1<<i.extra)-1,l>>>=i.extra,h-=i.extra,i.back+=i.extra}i.was=i.length,i.mode=16202;case 16202:for(;y=i.distcode[l&(1<<i.distbits)-1],p=y>>>24,I=y>>>16&255,m=65535&y,!(p<=h);){if(0===o)break e;o--,l+=r[n++]<<h,h+=8}if(0==(240&I)){for(_=p,w=I,C=m;y=i.distcode[C+((l&(1<<_+w)-1)>>_)],p=y>>>24,I=y>>>16&255,m=65535&y,!(_+p<=h);){if(0===o)break e;o--,l+=r[n++]<<h,h+=8}l>>>=_,h-=_,i.back+=_}if(l>>>=p,h-=p,i.back+=p,64&I){e.msg="invalid distance code",i.mode=yc;break}i.offset=m,i.extra=15&I,i.mode=16203;case 16203:if(i.extra){for(k=i.extra;h<k;){if(0===o)break e;o--,l+=r[n++]<<h,h+=8}i.offset+=l&(1<<i.extra)-1,l>>>=i.extra,h-=i.extra,i.back+=i.extra}if(i.offset>i.dmax){e.msg="invalid distance too far back",i.mode=yc;break}i.mode=16204;case 16204:if(0===A)break e;if(u=g-A,i.offset>u){if(u=i.offset-u,u>i.whave&&i.sane){e.msg="invalid distance too far back",i.mode=yc;break}u>i.wnext?(u-=i.wnext,d=i.wsize-u):d=i.wnext-u,u>i.length&&(u=i.length),f=i.window}else f=s,d=a-i.offset,u=i.length;u>A&&(u=A),A-=u,i.length-=u;do{s[a++]=f[d++]}while(--u);0===i.length&&(i.mode=Bc);break;case 16205:if(0===A)break e;s[a++]=i.length,A--,i.mode=Bc;break;case Ec:if(i.wrap){for(;h<32;){if(0===o)break e;o--,l|=r[n++]<<h,h+=8}if(g-=A,e.total_out+=g,i.total+=g,4&i.wrap&&g&&(e.adler=i.check=i.flags?Tl(i.check,s,g,a-g):Ml(i.check,s,g,a-g)),g=A,4&i.wrap&&(i.flags?l:Qc(l))!==i.check){e.msg="incorrect data check",i.mode=yc;break}l=0,h=0}i.mode=16207;case 16207:if(i.wrap&&i.flags){for(;h<32;){if(0===o)break e;o--,l+=r[n++]<<h,h+=8}if(4&i.wrap&&l!==(4294967295&i.total)){e.msg="incorrect length check",i.mode=yc;break}l=0,h=0}i.mode=16208;case 16208:E=lc;break e;case yc:E=gc;break e;case 16210:return uc;default:return cc}return e.next_out=a,e.avail_out=A,e.next_in=n,e.avail_in=o,i.hold=l,i.bits=h,(i.wsize||g!==e.avail_out&&i.mode<yc&&(i.mode<Ec||t!==nc))&&Lc(e,e.output,e.next_out,g-e.avail_out),c-=e.avail_in,g-=e.avail_out,e.total_in+=c,e.total_out+=g,i.total+=g,4&i.wrap&&g&&(e.adler=i.check=i.flags?Tl(i.check,s,g,e.next_out-g):Ml(i.check,s,g,e.next_out-g)),e.data_type=i.bits+(i.last?64:0)+(i.mode===mc?128:0)+(i.mode===Cc||i.mode===wc?256:0),(0===c&&0===g||t===nc)&&E===Ac&&(E=dc),E},inflateEnd:e=>{if(kc(e))return cc;let t=e.state;return t.window&&(t.window=null),e.state=null,Ac},inflateGetHeader:(e,t)=>{if(kc(e))return cc;const i=e.state;return 0==(2&i.wrap)?cc:(i.head=t,t.done=!1,Ac)},inflateSetDictionary:(e,t)=>{const i=t.length;let r,s,n;return kc(e)?cc:(r=e.state,0!==r.wrap&&r.mode!==Ic?cc:r.mode===Ic&&(s=1,s=Ml(s,t,i,0),s!==r.check)?gc:(n=Lc(e,t,i,i),n?(r.mode=16210,uc):(r.havedict=1,Ac)))},inflateInfo:"pako inflate (from Nodeca project)"};var Fc=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1};const Nc=Object.prototype.toString,{Z_NO_FLUSH:Oc,Z_FINISH:Pc,Z_OK:zc,Z_STREAM_END:qc,Z_NEED_DICT:Kc,Z_STREAM_ERROR:Hc,Z_DATA_ERROR:Vc,Z_MEM_ERROR:Jc}=Ll;function Yc(e){this.options=Gh.assign({chunkSize:65536,windowBits:15,to:""},e||{});const t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,0===t.windowBits&&(t.windowBits=-15)),!(t.windowBits>=0&&t.windowBits<16)||e&&e.windowBits||(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&0==(15&t.windowBits)&&(t.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new Nh,this.strm.avail_out=0;let i=Rc.inflateInit2(this.strm,t.windowBits);if(i!==zc)throw new Error(Gl[i]);if(this.header=new Fc,Rc.inflateGetHeader(this.strm,this.header),t.dictionary&&("string"==typeof t.dictionary?t.dictionary=Fh.string2buf(t.dictionary):"[object ArrayBuffer]"===Nc.call(t.dictionary)&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(i=Rc.inflateSetDictionary(this.strm,t.dictionary),i!==zc)))throw new Error(Gl[i])}function jc(e,t){const i=new Yc(t);if(i.push(e),i.err)throw i.msg||Gl[i.err];return i.result}Yc.prototype.push=function(e,t){const i=this.strm,r=this.options.chunkSize,s=this.options.dictionary;let n,a,o;if(this.ended)return!1;for(a=t===~~t?t:!0===t?Pc:Oc,"[object ArrayBuffer]"===Nc.call(e)?i.input=new Uint8Array(e):i.input=e,i.next_in=0,i.avail_in=i.input.length;;){for(0===i.avail_out&&(i.output=new Uint8Array(r),i.next_out=0,i.avail_out=r),n=Rc.inflate(i,a),n===Kc&&s&&(n=Rc.inflateSetDictionary(i,s),n===zc?n=Rc.inflate(i,a):n===Vc&&(n=Kc));i.avail_in>0&&n===qc&&i.state.wrap>0&&0!==e[i.next_in];)Rc.inflateReset(i),n=Rc.inflate(i,a);switch(n){case Hc:case Vc:case Kc:case Jc:return this.onEnd(n),this.ended=!0,!1}if(o=i.avail_out,i.next_out&&(0===i.avail_out||n===qc))if("string"===this.options.to){let e=Fh.utf8border(i.output,i.next_out),t=i.next_out-e,s=Fh.buf2string(i.output,e);i.next_out=t,i.avail_out=r-t,t&&i.output.set(i.output.subarray(e,e+t),0),this.onData(s)}else this.onData(i.output.length===i.next_out?i.output:i.output.subarray(0,i.next_out));if(n!==zc||0!==o){if(n===qc)return n=Rc.inflateEnd(this.strm),this.onEnd(n),this.ended=!0,!0;if(0===i.avail_in)break}}return!0},Yc.prototype.onData=function(e){this.chunks.push(e)},Yc.prototype.onEnd=function(e){e===zc&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=Gh.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};var Zc={Inflate:Yc,inflate:jc,inflateRaw:function(e,t){return(t=t||{}).raw=!0,jc(e,t)},ungzip:jc,constants:Ll};const{Inflate:Wc,inflate:Xc,inflateRaw:$c,ungzip:eg}=Zc;var tg=Xc;var ig=Object.freeze({__proto__:null,default:class extends Vo{decodeBlock(e){return tg(new Uint8Array(e)).buffer}}});var rg=Object.freeze({__proto__:null,default:class extends Vo{decodeBlock(e){const t=new DataView(e),i=[];for(let r=0;r<e.byteLength;++r){let e=t.getInt8(r);if(e<0){const s=t.getUint8(r+1);e=-e;for(let t=0;t<=e;++t)i.push(s);r+=1}else{for(let s=0;s<=e;++s)i.push(t.getUint8(r+s+1));r+=e+1}}return new Uint8Array(i).buffer}}}),sg={exports:{}};!function(e){
4
4
  /* Copyright 2015-2021 Esri. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 @preserve */
5
- !function(){var t,A,i,r,n,a,s,o,l,g,h,c,f,d,u,I,B=(t={defaultNoDataValue:-34027999387901484e22,decode:function(e,a){var s=(a=a||{}).encodedMaskData||null===a.encodedMaskData,o=n(e,a.inputOffset||0,s),l=null!==a.noDataValue?a.noDataValue:t.defaultNoDataValue,g=A(o,a.pixelType||Float32Array,a.encodedMaskData,l,a.returnMask),h={width:o.width,height:o.height,pixelData:g.resultPixels,minValue:g.minValue,maxValue:o.pixels.maxValue,noDataValue:l};return g.resultMask&&(h.maskData=g.resultMask),a.returnEncodedMask&&o.mask&&(h.encodedMaskData=o.mask.bitset?o.mask.bitset:null),a.returnFileInfo&&(h.fileInfo=i(o),a.computeUsedBitDepths&&(h.fileInfo.bitDepths=r(o))),h}},A=function(e,t,A,i,r){var n,s,o,l=0,g=e.pixels.numBlocksX,h=e.pixels.numBlocksY,c=Math.floor(e.width/g),f=Math.floor(e.height/h),d=2*e.maxZError,u=Number.MAX_VALUE;A=A||(e.mask?e.mask.bitset:null),s=new t(e.width*e.height),r&&A&&(o=new Uint8Array(e.width*e.height));for(var I,B,C=new Float32Array(c*f),E=0;E<=h;E++){var w=E!==h?f:e.height%h;if(0!==w)for(var Q=0;Q<=g;Q++){var m=Q!==g?c:e.width%g;if(0!==m){var p,y,_,b,D=E*e.width*f+Q*c,k=e.width-m,v=e.pixels.blocks[l];if(v.encoding<2?(0===v.encoding?p=v.rawData:(a(v.stuffedData,v.bitsPerPixel,v.numValidPixels,v.offset,d,C,e.pixels.maxValue),p=C),y=0):_=2===v.encoding?0:v.offset,A)for(B=0;B<w;B++){for(7&D&&(b=A[D>>3],b<<=7&D),I=0;I<m;I++)7&D||(b=A[D>>3]),128&b?(o&&(o[D]=1),u=u>(n=v.encoding<2?p[y++]:_)?n:u,s[D++]=n):(o&&(o[D]=0),s[D++]=i),b<<=1;D+=k}else if(v.encoding<2)for(B=0;B<w;B++){for(I=0;I<m;I++)u=u>(n=p[y++])?n:u,s[D++]=n;D+=k}else for(u=u>_?_:u,B=0;B<w;B++){for(I=0;I<m;I++)s[D++]=_;D+=k}if(1===v.encoding&&y!==v.numValidPixels)throw"Block and Mask do not match";l++}}}return{resultPixels:s,resultMask:o,minValue:u}},i=function(e){return{fileIdentifierString:e.fileIdentifierString,fileVersion:e.fileVersion,imageType:e.imageType,height:e.height,width:e.width,maxZError:e.maxZError,eofOffset:e.eofOffset,mask:e.mask?{numBlocksX:e.mask.numBlocksX,numBlocksY:e.mask.numBlocksY,numBytes:e.mask.numBytes,maxValue:e.mask.maxValue}:null,pixels:{numBlocksX:e.pixels.numBlocksX,numBlocksY:e.pixels.numBlocksY,numBytes:e.pixels.numBytes,maxValue:e.pixels.maxValue,noDataValue:e.noDataValue}}},r=function(e){for(var t=e.pixels.numBlocksX*e.pixels.numBlocksY,A={},i=0;i<t;i++){var r=e.pixels.blocks[i];0===r.encoding?A.float32=!0:1===r.encoding?A[r.bitsPerPixel]=!0:A[0]=!0}return Object.keys(A)},n=function(e,t,A){var i={},r=new Uint8Array(e,t,10);if(i.fileIdentifierString=String.fromCharCode.apply(null,r),"CntZImage"!==i.fileIdentifierString.trim())throw"Unexpected file identifier string: "+i.fileIdentifierString;t+=10;var n=new DataView(e,t,24);if(i.fileVersion=n.getInt32(0,!0),i.imageType=n.getInt32(4,!0),i.height=n.getUint32(8,!0),i.width=n.getUint32(12,!0),i.maxZError=n.getFloat64(16,!0),t+=24,!A)if(n=new DataView(e,t,16),i.mask={},i.mask.numBlocksY=n.getUint32(0,!0),i.mask.numBlocksX=n.getUint32(4,!0),i.mask.numBytes=n.getUint32(8,!0),i.mask.maxValue=n.getFloat32(12,!0),t+=16,i.mask.numBytes>0){var a=new Uint8Array(Math.ceil(i.width*i.height/8)),s=(n=new DataView(e,t,i.mask.numBytes)).getInt16(0,!0),o=2,l=0;do{if(s>0)for(;s--;)a[l++]=n.getUint8(o++);else{var g=n.getUint8(o++);for(s=-s;s--;)a[l++]=g}s=n.getInt16(o,!0),o+=2}while(o<i.mask.numBytes);if(-32768!==s||l<a.length)throw"Unexpected end of mask RLE encoding";i.mask.bitset=a,t+=i.mask.numBytes}else 0==(i.mask.numBytes|i.mask.numBlocksY|i.mask.maxValue)&&(i.mask.bitset=new Uint8Array(Math.ceil(i.width*i.height/8)));n=new DataView(e,t,16),i.pixels={},i.pixels.numBlocksY=n.getUint32(0,!0),i.pixels.numBlocksX=n.getUint32(4,!0),i.pixels.numBytes=n.getUint32(8,!0),i.pixels.maxValue=n.getFloat32(12,!0),t+=16;var h=i.pixels.numBlocksX,c=i.pixels.numBlocksY,f=h+(i.width%h>0?1:0),d=c+(i.height%c>0?1:0);i.pixels.blocks=new Array(f*d);for(var u=0,I=0;I<d;I++)for(var B=0;B<f;B++){var C=0,E=e.byteLength-t;n=new DataView(e,t,Math.min(10,E));var w={};i.pixels.blocks[u++]=w;var Q=n.getUint8(0);if(C++,w.encoding=63&Q,w.encoding>3)throw"Invalid block encoding ("+w.encoding+")";if(2!==w.encoding){if(0!==Q&&2!==Q){if(Q>>=6,w.offsetType=Q,2===Q)w.offset=n.getInt8(1),C++;else if(1===Q)w.offset=n.getInt16(1,!0),C+=2;else{if(0!==Q)throw"Invalid block offset type";w.offset=n.getFloat32(1,!0),C+=4}if(1===w.encoding)if(Q=n.getUint8(C),C++,w.bitsPerPixel=63&Q,Q>>=6,w.numValidPixelsType=Q,2===Q)w.numValidPixels=n.getUint8(C),C++;else if(1===Q)w.numValidPixels=n.getUint16(C,!0),C+=2;else{if(0!==Q)throw"Invalid valid pixel count type";w.numValidPixels=n.getUint32(C,!0),C+=4}}var m;if(t+=C,3!==w.encoding)if(0===w.encoding){var p=(i.pixels.numBytes-1)/4;if(p!==Math.floor(p))throw"uncompressed block has invalid length";m=new ArrayBuffer(4*p),new Uint8Array(m).set(new Uint8Array(e,t,4*p));var y=new Float32Array(m);w.rawData=y,t+=4*p}else if(1===w.encoding){var _=Math.ceil(w.numValidPixels*w.bitsPerPixel/8),b=Math.ceil(_/4);m=new ArrayBuffer(4*b),new Uint8Array(m).set(new Uint8Array(e,t,_)),w.stuffedData=new Uint32Array(m),t+=_}}else t++}return i.eofOffset=t,i},a=function(e,t,A,i,r,n,a){var s,o,l,g=(1<<t)-1,h=0,c=0,f=Math.ceil((a-i)/r),d=4*e.length-Math.ceil(t*A/8);for(e[e.length-1]<<=8*d,s=0;s<A;s++){if(0===c&&(l=e[h++],c=32),c>=t)o=l>>>c-t&g,c-=t;else{var u=t-c;o=(l&g)<<u&g,o+=(l=e[h++])>>>(c=32-u)}n[s]=o<f?i+o*r:a}return n},t),C=(s=function(e,t,A,i,r,n,a,s){var o,l,g,h,c,f=(1<<A)-1,d=0,u=0,I=4*e.length-Math.ceil(A*i/8);if(e[e.length-1]<<=8*I,r)for(o=0;o<i;o++)0===u&&(g=e[d++],u=32),u>=A?(l=g>>>u-A&f,u-=A):(l=(g&f)<<(h=A-u)&f,l+=(g=e[d++])>>>(u=32-h)),t[o]=r[l];else for(c=Math.ceil((s-n)/a),o=0;o<i;o++)0===u&&(g=e[d++],u=32),u>=A?(l=g>>>u-A&f,u-=A):(l=(g&f)<<(h=A-u)&f,l+=(g=e[d++])>>>(u=32-h)),t[o]=l<c?n+l*a:s},o=function(e,t,A,i,r,n){var a,s=(1<<t)-1,o=0,l=0,g=0,h=0,c=0,f=[],d=4*e.length-Math.ceil(t*A/8);e[e.length-1]<<=8*d;var u=Math.ceil((n-i)/r);for(l=0;l<A;l++)0===h&&(a=e[o++],h=32),h>=t?(c=a>>>h-t&s,h-=t):(c=(a&s)<<(g=t-h)&s,c+=(a=e[o++])>>>(h=32-g)),f[l]=c<u?i+c*r:n;return f.unshift(i),f},l=function(e,t,A,i,r,n,a,s){var o,l,g,h,c=(1<<A)-1,f=0,d=0,u=0;if(r)for(o=0;o<i;o++)0===d&&(g=e[f++],d=32,u=0),d>=A?(l=g>>>u&c,d-=A,u+=A):(l=g>>>u&c,d=32-(h=A-d),l|=((g=e[f++])&(1<<h)-1)<<A-h,u=h),t[o]=r[l];else{var I=Math.ceil((s-n)/a);for(o=0;o<i;o++)0===d&&(g=e[f++],d=32,u=0),d>=A?(l=g>>>u&c,d-=A,u+=A):(l=g>>>u&c,d=32-(h=A-d),l|=((g=e[f++])&(1<<h)-1)<<A-h,u=h),t[o]=l<I?n+l*a:s}return t},g=function(e,t,A,i,r,n){var a,s=(1<<t)-1,o=0,l=0,g=0,h=0,c=0,f=0,d=[],u=Math.ceil((n-i)/r);for(l=0;l<A;l++)0===h&&(a=e[o++],h=32,f=0),h>=t?(c=a>>>f&s,h-=t,f+=t):(c=a>>>f&s,h=32-(g=t-h),c|=((a=e[o++])&(1<<g)-1)<<t-g,f=g),d[l]=c<u?i+c*r:n;return d.unshift(i),d},h=function(e,t,A,i){var r,n,a,s,o=(1<<A)-1,l=0,g=0,h=4*e.length-Math.ceil(A*i/8);for(e[e.length-1]<<=8*h,r=0;r<i;r++)0===g&&(a=e[l++],g=32),g>=A?(n=a>>>g-A&o,g-=A):(n=(a&o)<<(s=A-g)&o,n+=(a=e[l++])>>>(g=32-s)),t[r]=n;return t},c=function(e,t,A,i){var r,n,a,s,o=(1<<A)-1,l=0,g=0,h=0;for(r=0;r<i;r++)0===g&&(a=e[l++],g=32,h=0),g>=A?(n=a>>>h&o,g-=A,h+=A):(n=a>>>h&o,g=32-(s=A-g),n|=((a=e[l++])&(1<<s)-1)<<A-s,h=s),t[r]=n;return t},f={HUFFMAN_LUT_BITS_MAX:12,computeChecksumFletcher32:function(e){for(var t=65535,A=65535,i=e.length,r=Math.floor(i/2),n=0;r;){var a=r>=359?359:r;r-=a;do{t+=e[n++]<<8,A+=t+=e[n++]}while(--a);t=(65535&t)+(t>>>16),A=(65535&A)+(A>>>16)}return 1&i&&(A+=t+=e[n]<<8),((A=(65535&A)+(A>>>16))<<16|(t=(65535&t)+(t>>>16)))>>>0},readHeaderInfo:function(e,t){var A=t.ptr,i=new Uint8Array(e,A,6),r={};if(r.fileIdentifierString=String.fromCharCode.apply(null,i),0!==r.fileIdentifierString.lastIndexOf("Lerc2",0))throw"Unexpected file identifier string (expect Lerc2 ): "+r.fileIdentifierString;A+=6;var n,a=new DataView(e,A,8),s=a.getInt32(0,!0);if(r.fileVersion=s,A+=4,s>=3&&(r.checksum=a.getUint32(4,!0),A+=4),a=new DataView(e,A,12),r.height=a.getUint32(0,!0),r.width=a.getUint32(4,!0),A+=8,s>=4?(r.numDims=a.getUint32(8,!0),A+=4):r.numDims=1,a=new DataView(e,A,40),r.numValidPixel=a.getUint32(0,!0),r.microBlockSize=a.getInt32(4,!0),r.blobSize=a.getInt32(8,!0),r.imageType=a.getInt32(12,!0),r.maxZError=a.getFloat64(16,!0),r.zMin=a.getFloat64(24,!0),r.zMax=a.getFloat64(32,!0),A+=40,t.headerInfo=r,t.ptr=A,s>=3&&(n=s>=4?52:48,this.computeChecksumFletcher32(new Uint8Array(e,A-n,r.blobSize-14))!==r.checksum))throw"Checksum failed.";return!0},checkMinMaxRanges:function(e,t){var A=t.headerInfo,i=this.getDataTypeArray(A.imageType),r=A.numDims*this.getDataTypeSize(A.imageType),n=this.readSubArray(e,t.ptr,i,r),a=this.readSubArray(e,t.ptr+r,i,r);t.ptr+=2*r;var s,o=!0;for(s=0;s<A.numDims;s++)if(n[s]!==a[s]){o=!1;break}return A.minValues=n,A.maxValues=a,o},readSubArray:function(e,t,A,i){var r;if(A===Uint8Array)r=new Uint8Array(e,t,i);else{var n=new ArrayBuffer(i);new Uint8Array(n).set(new Uint8Array(e,t,i)),r=new A(n)}return r},readMask:function(e,t){var A,i,r=t.ptr,n=t.headerInfo,a=n.width*n.height,s=n.numValidPixel,o=new DataView(e,r,4),l={};if(l.numBytes=o.getUint32(0,!0),r+=4,(0===s||a===s)&&0!==l.numBytes)throw"invalid mask";if(0===s)A=new Uint8Array(Math.ceil(a/8)),l.bitset=A,i=new Uint8Array(a),t.pixels.resultMask=i,r+=l.numBytes;else if(l.numBytes>0){A=new Uint8Array(Math.ceil(a/8));var g=(o=new DataView(e,r,l.numBytes)).getInt16(0,!0),h=2,c=0,f=0;do{if(g>0)for(;g--;)A[c++]=o.getUint8(h++);else for(f=o.getUint8(h++),g=-g;g--;)A[c++]=f;g=o.getInt16(h,!0),h+=2}while(h<l.numBytes);if(-32768!==g||c<A.length)throw"Unexpected end of mask RLE encoding";i=new Uint8Array(a);var d=0,u=0;for(u=0;u<a;u++)7&u?(d=A[u>>3],d<<=7&u):d=A[u>>3],128&d&&(i[u]=1);t.pixels.resultMask=i,l.bitset=A,r+=l.numBytes}return t.ptr=r,t.mask=l,!0},readDataOneSweep:function(e,t,A,i){var r,n=t.ptr,a=t.headerInfo,s=a.numDims,o=a.width*a.height,l=a.imageType,g=a.numValidPixel*f.getDataTypeSize(l)*s,h=t.pixels.resultMask;if(A===Uint8Array)r=new Uint8Array(e,n,g);else{var c=new ArrayBuffer(g);new Uint8Array(c).set(new Uint8Array(e,n,g)),r=new A(c)}if(r.length===o*s)t.pixels.resultPixels=i?f.swapDimensionOrder(r,o,s,A,!0):r;else{t.pixels.resultPixels=new A(o*s);var d=0,u=0,I=0,B=0;if(s>1){if(i){for(u=0;u<o;u++)if(h[u])for(B=u,I=0;I<s;I++,B+=o)t.pixels.resultPixels[B]=r[d++]}else for(u=0;u<o;u++)if(h[u])for(B=u*s,I=0;I<s;I++)t.pixels.resultPixels[B+I]=r[d++]}else for(u=0;u<o;u++)h[u]&&(t.pixels.resultPixels[u]=r[d++])}return n+=g,t.ptr=n,!0},readHuffmanTree:function(e,t){var A=this.HUFFMAN_LUT_BITS_MAX,i=new DataView(e,t.ptr,16);if(t.ptr+=16,i.getInt32(0,!0)<2)throw"unsupported Huffman version";var r=i.getInt32(4,!0),n=i.getInt32(8,!0),a=i.getInt32(12,!0);if(n>=a)return!1;var s=new Uint32Array(a-n);f.decodeBits(e,t,s);var o,l,g,h,c=[];for(o=n;o<a;o++)c[l=o-(o<r?0:r)]={first:s[o-n],second:null};var u=e.byteLength-t.ptr,I=Math.ceil(u/4),B=new ArrayBuffer(4*I);new Uint8Array(B).set(new Uint8Array(e,t.ptr,u));var C,E=new Uint32Array(B),w=0,Q=0;for(C=E[0],o=n;o<a;o++)(h=c[l=o-(o<r?0:r)].first)>0&&(c[l].second=C<<w>>>32-h,32-w>=h?32===(w+=h)&&(w=0,C=E[++Q]):(w+=h-32,C=E[++Q],c[l].second|=C>>>32-w));var m=0,p=0,y=new d;for(o=0;o<c.length;o++)void 0!==c[o]&&(m=Math.max(m,c[o].first));p=m>=A?A:m;var _,b,D,k,v,x=[];for(o=n;o<a;o++)if((h=c[l=o-(o<r?0:r)].first)>0)if(_=[h,l],h<=p)for(b=c[l].second<<p-h,D=1<<p-h,g=0;g<D;g++)x[b|g]=_;else for(b=c[l].second,v=y,k=h-1;k>=0;k--)b>>>k&1?(v.right||(v.right=new d),v=v.right):(v.left||(v.left=new d),v=v.left),0!==k||v.val||(v.val=_[1]);return{decodeLut:x,numBitsLUTQick:p,numBitsLUT:m,tree:y,stuffedData:E,srcPtr:Q,bitPos:w}},readHuffman:function(e,t,A,i){var r,n,a,s,o,l,g,h,c,d=t.headerInfo.numDims,u=t.headerInfo.height,I=t.headerInfo.width,B=I*u,C=this.readHuffmanTree(e,t),E=C.decodeLut,w=C.tree,Q=C.stuffedData,m=C.srcPtr,p=C.bitPos,y=C.numBitsLUTQick,_=C.numBitsLUT,b=0===t.headerInfo.imageType?128:0,D=t.pixels.resultMask,k=0;p>0&&(m++,p=0);var v,x=Q[m],S=1===t.encodeMode,G=new A(B*d),U=G;if(d<2||S){for(v=0;v<d;v++)if(d>1&&(U=new A(G.buffer,B*v,B),k=0),t.headerInfo.numValidPixel===I*u)for(h=0,l=0;l<u;l++)for(g=0;g<I;g++,h++){if(n=0,o=s=x<<p>>>32-y,32-p<y&&(o=s|=Q[m+1]>>>64-p-y),E[o])n=E[o][1],p+=E[o][0];else for(o=s=x<<p>>>32-_,32-p<_&&(o=s|=Q[m+1]>>>64-p-_),r=w,c=0;c<_;c++)if(!(r=s>>>_-c-1&1?r.right:r.left).left&&!r.right){n=r.val,p=p+c+1;break}p>=32&&(p-=32,x=Q[++m]),a=n-b,S?(a+=g>0?k:l>0?U[h-I]:k,a&=255,U[h]=a,k=a):U[h]=a}else for(h=0,l=0;l<u;l++)for(g=0;g<I;g++,h++)if(D[h]){if(n=0,o=s=x<<p>>>32-y,32-p<y&&(o=s|=Q[m+1]>>>64-p-y),E[o])n=E[o][1],p+=E[o][0];else for(o=s=x<<p>>>32-_,32-p<_&&(o=s|=Q[m+1]>>>64-p-_),r=w,c=0;c<_;c++)if(!(r=s>>>_-c-1&1?r.right:r.left).left&&!r.right){n=r.val,p=p+c+1;break}p>=32&&(p-=32,x=Q[++m]),a=n-b,S?(g>0&&D[h-1]?a+=k:l>0&&D[h-I]?a+=U[h-I]:a+=k,a&=255,U[h]=a,k=a):U[h]=a}}else for(h=0,l=0;l<u;l++)for(g=0;g<I;g++)if(h=l*I+g,!D||D[h])for(v=0;v<d;v++,h+=B){if(n=0,o=s=x<<p>>>32-y,32-p<y&&(o=s|=Q[m+1]>>>64-p-y),E[o])n=E[o][1],p+=E[o][0];else for(o=s=x<<p>>>32-_,32-p<_&&(o=s|=Q[m+1]>>>64-p-_),r=w,c=0;c<_;c++)if(!(r=s>>>_-c-1&1?r.right:r.left).left&&!r.right){n=r.val,p=p+c+1;break}p>=32&&(p-=32,x=Q[++m]),a=n-b,U[h]=a}t.ptr=t.ptr+4*(m+1)+(p>0?4:0),t.pixels.resultPixels=G,d>1&&!i&&(t.pixels.resultPixels=f.swapDimensionOrder(G,B,d,A))},decodeBits:function(e,t,A,i,r){var n=t.headerInfo,a=n.fileVersion,f=0,d=e.byteLength-t.ptr>=5?5:e.byteLength-t.ptr,u=new DataView(e,t.ptr,d),I=u.getUint8(0);f++;var B=I>>6,C=0===B?4:3-B,E=(32&I)>0,w=31&I,Q=0;if(1===C)Q=u.getUint8(f),f++;else if(2===C)Q=u.getUint16(f,!0),f+=2;else{if(4!==C)throw"Invalid valid pixel count type";Q=u.getUint32(f,!0),f+=4}var m,p,y,_,b,D,k,v,x,S=2*n.maxZError,G=n.numDims>1?n.maxValues[r]:n.zMax;if(E){for(t.counter.lut++,v=u.getUint8(f),f++,_=Math.ceil((v-1)*w/8),b=Math.ceil(_/4),p=new ArrayBuffer(4*b),y=new Uint8Array(p),t.ptr+=f,y.set(new Uint8Array(e,t.ptr,_)),k=new Uint32Array(p),t.ptr+=_,x=0;v-1>>>x;)x++;_=Math.ceil(Q*x/8),b=Math.ceil(_/4),p=new ArrayBuffer(4*b),(y=new Uint8Array(p)).set(new Uint8Array(e,t.ptr,_)),m=new Uint32Array(p),t.ptr+=_,D=a>=3?g(k,w,v-1,i,S,G):o(k,w,v-1,i,S,G),a>=3?l(m,A,x,Q,D):s(m,A,x,Q,D)}else t.counter.bitstuffer++,x=w,t.ptr+=f,x>0&&(_=Math.ceil(Q*x/8),b=Math.ceil(_/4),p=new ArrayBuffer(4*b),(y=new Uint8Array(p)).set(new Uint8Array(e,t.ptr,_)),m=new Uint32Array(p),t.ptr+=_,a>=3?null==i?c(m,A,x,Q):l(m,A,x,Q,!1,i,S,G):null==i?h(m,A,x,Q):s(m,A,x,Q,!1,i,S,G))},readTiles:function(e,t,A,i){var r=t.headerInfo,n=r.width,a=r.height,s=n*a,o=r.microBlockSize,l=r.imageType,g=f.getDataTypeSize(l),h=Math.ceil(n/o),c=Math.ceil(a/o);t.pixels.numBlocksY=c,t.pixels.numBlocksX=h,t.pixels.ptr=0;var d,u,I,B,C,E,w,Q,m,p,y=0,_=0,b=0,D=0,k=0,v=0,x=0,S=0,G=0,U=0,M=0,R=0,F=0,L=0,T=0,N=new A(o*o),P=a%o||o,O=n%o||o,z=r.numDims,K=t.pixels.resultMask,H=t.pixels.resultPixels,q=r.fileVersion>=5?14:15,J=r.zMax;for(b=0;b<c;b++)for(k=b!==c-1?o:P,D=0;D<h;D++)for(U=b*n*o+D*o,M=n-(v=D!==h-1?o:O),Q=0;Q<z;Q++){if(z>1?(p=H,U=b*n*o+D*o,H=new A(t.pixels.resultPixels.buffer,s*Q*g,s),J=r.maxValues[Q]):p=null,x=e.byteLength-t.ptr,u={},T=0,S=(d=new DataView(e,t.ptr,Math.min(10,x))).getUint8(0),T++,m=r.fileVersion>=5?4&S:0,G=S>>6&255,(S>>2&q)!=(D*o>>3&q))throw"integrity issue";if(m&&0===Q)throw"integrity issue";if((C=3&S)>3)throw t.ptr+=T,"Invalid block encoding ("+C+")";if(2!==C)if(0===C){if(m)throw"integrity issue";if(t.counter.uncompressed++,t.ptr+=T,R=(R=k*v*g)<(F=e.byteLength-t.ptr)?R:F,I=new ArrayBuffer(R%g==0?R:R+g-R%g),new Uint8Array(I).set(new Uint8Array(e,t.ptr,R)),B=new A(I),L=0,K)for(y=0;y<k;y++){for(_=0;_<v;_++)K[U]&&(H[U]=B[L++]),U++;U+=M}else for(y=0;y<k;y++){for(_=0;_<v;_++)H[U++]=B[L++];U+=M}t.ptr+=L*g}else if(E=f.getDataTypeUsed(m&&l<6?4:l,G),w=f.getOnePixel(u,T,E,d),T+=f.getDataTypeSize(E),3===C)if(t.ptr+=T,t.counter.constantoffset++,K)for(y=0;y<k;y++){for(_=0;_<v;_++)K[U]&&(H[U]=m?Math.min(J,p[U]+w):w),U++;U+=M}else for(y=0;y<k;y++){for(_=0;_<v;_++)H[U]=m?Math.min(J,p[U]+w):w,U++;U+=M}else if(t.ptr+=T,f.decodeBits(e,t,N,w,Q),T=0,m)if(K)for(y=0;y<k;y++){for(_=0;_<v;_++)K[U]&&(H[U]=N[T++]+p[U]),U++;U+=M}else for(y=0;y<k;y++){for(_=0;_<v;_++)H[U]=N[T++]+p[U],U++;U+=M}else if(K)for(y=0;y<k;y++){for(_=0;_<v;_++)K[U]&&(H[U]=N[T++]),U++;U+=M}else for(y=0;y<k;y++){for(_=0;_<v;_++)H[U++]=N[T++];U+=M}else{if(m)if(K)for(y=0;y<k;y++)for(_=0;_<v;_++)K[U]&&(H[U]=p[U]),U++;else for(y=0;y<k;y++)for(_=0;_<v;_++)H[U]=p[U],U++;t.counter.constant++,t.ptr+=T}}z>1&&!i&&(t.pixels.resultPixels=f.swapDimensionOrder(t.pixels.resultPixels,s,z,A))},formatFileInfo:function(e){return{fileIdentifierString:e.headerInfo.fileIdentifierString,fileVersion:e.headerInfo.fileVersion,imageType:e.headerInfo.imageType,height:e.headerInfo.height,width:e.headerInfo.width,numValidPixel:e.headerInfo.numValidPixel,microBlockSize:e.headerInfo.microBlockSize,blobSize:e.headerInfo.blobSize,maxZError:e.headerInfo.maxZError,pixelType:f.getPixelType(e.headerInfo.imageType),eofOffset:e.eofOffset,mask:e.mask?{numBytes:e.mask.numBytes}:null,pixels:{numBlocksX:e.pixels.numBlocksX,numBlocksY:e.pixels.numBlocksY,maxValue:e.headerInfo.zMax,minValue:e.headerInfo.zMin,noDataValue:e.noDataValue}}},constructConstantSurface:function(e,t){var A=e.headerInfo.zMax,i=e.headerInfo.zMin,r=e.headerInfo.maxValues,n=e.headerInfo.numDims,a=e.headerInfo.height*e.headerInfo.width,s=0,o=0,l=0,g=e.pixels.resultMask,h=e.pixels.resultPixels;if(g)if(n>1){if(t)for(s=0;s<n;s++)for(l=s*a,A=r[s],o=0;o<a;o++)g[o]&&(h[l+o]=A);else for(o=0;o<a;o++)if(g[o])for(l=o*n,s=0;s<n;s++)h[l+n]=r[s]}else for(o=0;o<a;o++)g[o]&&(h[o]=A);else if(n>1&&i!==A)if(t)for(s=0;s<n;s++)for(l=s*a,A=r[s],o=0;o<a;o++)h[l+o]=A;else for(o=0;o<a;o++)for(l=o*n,s=0;s<n;s++)h[l+s]=r[s];else for(o=0;o<a*n;o++)h[o]=A},getDataTypeArray:function(e){var t;switch(e){case 0:t=Int8Array;break;case 1:t=Uint8Array;break;case 2:t=Int16Array;break;case 3:t=Uint16Array;break;case 4:t=Int32Array;break;case 5:t=Uint32Array;break;case 6:default:t=Float32Array;break;case 7:t=Float64Array}return t},getPixelType:function(e){var t;switch(e){case 0:t="S8";break;case 1:t="U8";break;case 2:t="S16";break;case 3:t="U16";break;case 4:t="S32";break;case 5:t="U32";break;case 6:default:t="F32";break;case 7:t="F64"}return t},isValidPixelValue:function(e,t){if(null==t)return!1;var A;switch(e){case 0:A=t>=-128&&t<=127;break;case 1:A=t>=0&&t<=255;break;case 2:A=t>=-32768&&t<=32767;break;case 3:A=t>=0&&t<=65536;break;case 4:A=t>=-2147483648&&t<=2147483647;break;case 5:A=t>=0&&t<=4294967296;break;case 6:A=t>=-34027999387901484e22&&t<=34027999387901484e22;break;case 7:A=t>=-17976931348623157e292&&t<=17976931348623157e292;break;default:A=!1}return A},getDataTypeSize:function(e){var t=0;switch(e){case 0:case 1:t=1;break;case 2:case 3:t=2;break;case 4:case 5:case 6:t=4;break;case 7:t=8;break;default:t=e}return t},getDataTypeUsed:function(e,t){var A=e;switch(e){case 2:case 4:A=e-t;break;case 3:case 5:A=e-2*t;break;case 6:A=0===t?e:1===t?2:1;break;case 7:A=0===t?e:e-2*t+1;break;default:A=e}return A},getOnePixel:function(e,t,A,i){var r=0;switch(A){case 0:r=i.getInt8(t);break;case 1:r=i.getUint8(t);break;case 2:r=i.getInt16(t,!0);break;case 3:r=i.getUint16(t,!0);break;case 4:r=i.getInt32(t,!0);break;case 5:r=i.getUInt32(t,!0);break;case 6:r=i.getFloat32(t,!0);break;case 7:r=i.getFloat64(t,!0);break;default:throw"the decoder does not understand this pixel type"}return r},swapDimensionOrder:function(e,t,A,i,r){var n=0,a=0,s=0,o=0,l=e;if(A>1)if(l=new i(t*A),r)for(n=0;n<t;n++)for(o=n,s=0;s<A;s++,o+=t)l[o]=e[a++];else for(n=0;n<t;n++)for(o=n,s=0;s<A;s++,o+=t)l[a++]=e[o];return l}},d=function(e,t,A){this.val=e,this.left=t,this.right=A},{decode:function(e,t){var A=(t=t||{}).noDataValue,i=0,r={};if(r.ptr=t.inputOffset||0,r.pixels={},f.readHeaderInfo(e,r)){var n=r.headerInfo,a=n.fileVersion,s=f.getDataTypeArray(n.imageType);if(a>5)throw"unsupported lerc version 2."+a;f.readMask(e,r),n.numValidPixel===n.width*n.height||r.pixels.resultMask||(r.pixels.resultMask=t.maskData);var o=n.width*n.height;r.pixels.resultPixels=new s(o*n.numDims),r.counter={onesweep:0,uncompressed:0,lut:0,bitstuffer:0,constant:0,constantoffset:0};var l,g=!t.returnPixelInterleavedDims;if(0!==n.numValidPixel)if(n.zMax===n.zMin)f.constructConstantSurface(r,g);else if(a>=4&&f.checkMinMaxRanges(e,r))f.constructConstantSurface(r,g);else{var h=new DataView(e,r.ptr,2),c=h.getUint8(0);if(r.ptr++,c)f.readDataOneSweep(e,r,s,g);else if(a>1&&n.imageType<=1&&Math.abs(n.maxZError-.5)<1e-5){var d=h.getUint8(1);if(r.ptr++,r.encodeMode=d,d>2||a<4&&d>1)throw"Invalid Huffman flag "+d;d?f.readHuffman(e,r,s,g):f.readTiles(e,r,s,g)}else f.readTiles(e,r,s,g)}r.eofOffset=r.ptr,t.inputOffset?(l=r.headerInfo.blobSize+t.inputOffset-r.ptr,Math.abs(l)>=1&&(r.eofOffset=t.inputOffset+r.headerInfo.blobSize)):(l=r.headerInfo.blobSize-r.ptr,Math.abs(l)>=1&&(r.eofOffset=r.headerInfo.blobSize));var u={width:n.width,height:n.height,pixelData:r.pixels.resultPixels,minValue:n.zMin,maxValue:n.zMax,validPixelCount:n.numValidPixel,dimCount:n.numDims,dimStats:{minValues:n.minValues,maxValues:n.maxValues},maskData:r.pixels.resultMask};if(r.pixels.resultMask&&f.isValidPixelValue(n.imageType,A)){var I=r.pixels.resultMask;for(i=0;i<o;i++)I[i]||(u.pixelData[i]=A);u.noDataValue=A}return r.noDataValue=A,t.returnFileInfo&&(u.fileInfo=f.formatFileInfo(r)),u}},getBandCount:function(e){for(var t=0,A=0,i={ptr:0,pixels:{}};A<e.byteLength-58;)f.readHeaderInfo(e,i),A+=i.headerInfo.blobSize,t++,i.ptr=A;return t}}),E=(u=new ArrayBuffer(4),I=new Uint8Array(u),new Uint32Array(u)[0]=1,1===I[0]),w={decode:function(e,t){if(!E)throw"Big endian system is not supported.";var A,i,r=(t=t||{}).inputOffset||0,n=new Uint8Array(e,r,10),a=String.fromCharCode.apply(null,n);if("CntZImage"===a.trim())A=B,i=1;else{if("Lerc2"!==a.substring(0,5))throw"Unexpected file identifier string: "+a;A=C,i=2}for(var s,o,l,g,h,c,f=0,d=e.byteLength-10,u=[],I={width:0,height:0,pixels:[],pixelType:t.pixelType,mask:null,statistics:[]},w=0;r<d;){var Q=A.decode(e,{inputOffset:r,encodedMaskData:s,maskData:l,returnMask:0===f,returnEncodedMask:0===f,returnFileInfo:!0,returnPixelInterleavedDims:t.returnPixelInterleavedDims,pixelType:t.pixelType||null,noDataValue:t.noDataValue||null});r=Q.fileInfo.eofOffset,l=Q.maskData,0===f&&(s=Q.encodedMaskData,I.width=Q.width,I.height=Q.height,I.dimCount=Q.dimCount||1,I.pixelType=Q.pixelType||Q.fileInfo.pixelType,I.mask=l),i>1&&(l&&u.push(l),Q.fileInfo.mask&&Q.fileInfo.mask.numBytes>0&&w++),f++,I.pixels.push(Q.pixelData),I.statistics.push({minValue:Q.minValue,maxValue:Q.maxValue,noDataValue:Q.noDataValue,dimStats:Q.dimStats})}if(i>1&&w>1){for(c=I.width*I.height,I.bandMasks=u,(l=new Uint8Array(c)).set(u[0]),g=1;g<u.length;g++)for(o=u[g],h=0;h<c;h++)l[h]=l[h]&o[h];I.maskData=l}return I}};e.exports?e.exports=w:this.Lerc=w}()}(Sl);var Gl=Ei(Sl.exports);let Ul,Ml,Rl;const Fl={env:{emscripten_notify_memory_growth:function(e){Rl=new Uint8Array(Ml.exports.memory.buffer)}}};const Ll="AGFzbQEAAAABpQEVYAF/AX9gAn9/AGADf39/AX9gBX9/f39/AX9g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AAAgAEEBaiEAIAJBAWohAgwAAAsACyAEQQFGBEACQCAAIAJrIgZBB00EQCAAIAItAAA6AAAgACACLQABOgABIAAgAi0AAjoAAiAAIAItAAM6AAMgAEEEaiACIAZBAnQiBkHAHmooAgBqIgIQFyACIAZB4B5qKAIAayECDAELIAAgAhAMCyACQQhqIQIgAEEIaiEACwJAAkACQAJAIAUgAU0EQCAAIANqIQEgBEEBRyAAIAJrQQ9Kcg0BA0AgACACEAwgAkEIaiECIABBCGoiACABSQ0ACwwFCyAAIAFLBEAgACEBDAQLIARBAUcgACACa0EPSnINASAAIQMgAiEEA0AgAyAEEAwgBEEIaiEEIANBCGoiAyABSQ0ACwwCCwNAIAAgAhAHIAJBEGohAiAAQRBqIgAgAUkNAAsMAwsgACEDIAIhBANAIAMgBBAHIARBEGohBCADQRBqIgMgAUkNAAsLIAIgASAAa2ohAgsDQCABIAVPDQEgASACLQAAOgAAIAFBAWohASACQQFqIQIMAAALAAsLQQECfyAAIAAoArjgASIDNgLE4AEgACgCvOABIQQgACABNgK84AEgACABIAJqNgK44AEgACABIAQgA2tqNgLA4AELpgEBAX8gACAAKALs4QEQFjYCyOABIABCADcD+OABIABCADcDuOABIABBwOABakIANwMAIABBqNAAaiIBQYyAgOAANgIAIABBADYCmOIBIABCADcDiOEBIABCAzcDgOEBIABBrNABakHgEikCADcCACAAQbTQAWpB6BIoAgA2AgAgACABNgIMIAAgAEGYIGo2AgggACAAQaAwajYCBCAAIABBEGo2AgALYQEBf0G4fyEDAkAgAUEDSQ0AIAIgABAhIgFBA3YiADYCCCACIAFBAXE2AgQgAiABQQF2QQNxIgM2AgACQCADQX9qIgFBAksNAAJAIAFBAWsOAgEAAgtBbA8LIAAhAwsgAwsMACAAIAEgAkEAEC4LiAQCA38CfiADEBYhBCAAQQBBKBAQIQAgBCACSwRAIAQPCyABRQRAQX8PCwJAAkAgA0EBRg0AIAEoAAAiBkGo6r5pRg0AQXYhAyAGQXBxQdDUtMIBRw0BQQghAyACQQhJ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F+IwBBQGoiBCQAAkACQCACQQhJDQAgASgAAEFwcUHQ1LTCAUcNACABIAIQIiEBIABCADcDCCAAQQA2AgQgACABNgIADAELIARBGGogASACEC0iAxADBEAgACADEBoMAQsgAwRAIABBuH8QGgwBCyACIAQoAjAiA2shAiABIANqIQMDQAJAIAAgAyACIARBCGoQLCIFEAMEfyAFBSACIAVBA2oiBU8NAUG4fwsQGgwCCyAGQQFqIQYgAiAFayECIAMgBWohAyAEKAIMRQ0ACyAEKAI4BEAgAkEDTQRAIABBuH8QGgwCCyADQQRqIQMLIAQoAighAiAEKQMYIQcgAEEANgIEIAAgAyABazYCACAAIAIgBmytIAcgB0J/URs3AwgLIARBQGskAAslAQF/IwBBEGsiAiQAIAIgACABEFEgAigCACEAIAJBEGokACAAC30BBH8jAEGQBGsiBCQAIARB/wE2AggCQCAEQRBqIARBCGogBEEMaiABIAIQFSIGEAMEQCAGIQUMAQtBVCEFIAQoAgwiB0EGSw0AIAMgBEEQaiAEKAIIIAcQQSIFEAMNACAAIAEgBmogAiAGayADEDwhBQsgBEGQBGokACAFC4cBAgJ/An5BABAWIQMCQANAIAEgA08EQAJAIAAoAABBcHFB0NS0wgFGBEAgACABECIiAhADRQ0BQn4PCyAAIAEQVSIEQn1WDQMgBCAFfCIFIARUIQJCfiEEIAINAyAAIAEQUiICEAMNAwsgASACayEBIAAgAmohAAwBCwtCfiAFIAEbIQQLIAQLPwIBfwF+IwBBMGsiAiQAAn5CfiACQQhqIAAgARAtDQAaQgAgAigCHEEBRg0AGiACKQMICyEDIAJBMGokACADC40BAQJ/IwBBMGsiASQAAkAgAEUNACAAKAKI4gENACABIABB/OEBaigCADYCKCABIAApAvThATcDICAAEDAgACgCqOIBIQIgASABKAIoNgIYIAEgASkDIDcDECACIAFBEGoQGyAAQQA2AqjiASABIAEoAig2AgggASABKQMgNwMAIAAgARAbCyABQTBqJAALKgECfyMAQRBrIgAkACAAQQA2AgggAEIANwMAIAAQWCEBIABBEGokACABC4cBAQN/IwBBEGsiAiQAAkAgACgCAEUgACgCBEVzDQAgAiAAKAIINgIIIAIgACkCADcDAAJ/IAIoAgAiAQRAIAIoAghBqOMJIAERBQAMAQtBqOMJECgLIgFFDQAgASAAKQIANwL04QEgAUH84QFqIAAoAgg2AgAgARBZIAEhAwsgAkEQaiQAIAMLywEBAn8jAEEgayIBJAAgAEGBgIDAADYCtOIBIABBADYCiOIBIABBADYC7OEBIABCADcDkOIBIABBADYCpOMJIABBADYC3OIBIABCADcCzOIBIABBADYCvOIBIABBADYCxOABIABCADcCnOIBIABBpOIBakIANwIAIABBrOIBakEANgIAIAFCADcCECABQgA3AhggASABKQMYNwMIIAEgASkDEDcDACABKAIIQQh2QQFxIQIgAEEANgLg4gEgACACNgKM4gEgAUEgaiQAC3YBA38jAEEwayIBJAAgAARAIAEgAEHE0AFqIgIoAgA2AiggASAAKQK80AE3AyAgACgCACEDIAEgAigCADYCGCABIAApArzQATcDECADIAFBEGoQGyABIAEoAig2AgggASABKQMgNwMAIAAgARAbCyABQTBqJAALzAEBAX8gACABKAK00AE2ApjiASAAIAEoAgQiAjYCwOABIAAgAjYCvOABIAAgAiABKAIIaiICNgK44AEgACACNgLE4AEgASgCuNABBEAgAEKBgICAEDcDiOEBIAAgAUGk0ABqNgIMIAAgAUGUIGo2AgggACABQZwwajYCBCAAIAFBDGo2AgAgAEGs0AFqIAFBqNABaigCADYCACAAQbDQAWogAUGs0AFqKAIANgIAIABBtNABaiABQbDQAWooAgA2AgAPCyAAQgA3A4jhAQs7ACACRQRAQbp/DwsgBEUEQEFsDwsgAiAEEGAEQCAAIAEgAiADIAQgBRBhDwsgACABIAIgAyAEIAUQZQtGAQF/IwBBEGsiBSQAIAVBCGogBBAOAn8gBS0ACQRAIAAgASACIAMgBBAyDAELIAAgASACIAMgBBA0CyEAIAVBEGokACAACzQAIAAgAyAEIAUQNiIFEAMEQCAFDwsgBSAESQR/IAEgAiADIAVqIAQgBWsgABA1BUG4fwsLRgEBfyMAQRBrIgUkACA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DwBBQ",Tl=new class{init(){return Ul||(Ul="undefined"!=typeof fetch?fetch("data:application/wasm;base64,"+Ll).then((e=>e.arrayBuffer())).then((e=>WebAssembly.instantiate(e,Fl))).then(this._init):WebAssembly.instantiate(Buffer.from(Ll,"base64"),Fl).then(this._init),Ul)}_init(e){Ml=e.instance,Fl.env.emscripten_notify_memory_growth(0)}decode(e,t=0){if(!Ml)throw new Error("ZSTDDecoder: Await .init() before decoding.");const A=e.byteLength,i=Ml.exports.malloc(A);Rl.set(e,i),t=t||Number(Ml.exports.ZSTD_findDecompressedSize(i,A));const r=Ml.exports.malloc(t),n=Ml.exports.ZSTD_decompress(r,t,i,A),a=Rl.slice(r,r+n);return Ml.exports.free(i),Ml.exports.free(r),a}};var Nl=Object.freeze({__proto__:null,default:class extends Un{constructor(e){super(),this.planarConfiguration=void 0!==e.PlanarConfiguration?e.PlanarConfiguration:1,this.samplesPerPixel=void 0!==e.SamplesPerPixel?e.SamplesPerPixel:1,this.addCompression=e.LercParameters[cn]}decodeBlock(e){switch(this.addCompression){case fn:break;case dn:e=kl(new Uint8Array(e)).buffer;break;case un:e=Tl.decode(new Uint8Array(e)).buffer;break;default:throw new Error(`Unsupported LERC additional compression method identifier: ${this.addCompression}`)}return Gl.decode(e,{returnPixelInterleavedDims:1===this.planarConfiguration}).pixels[0].buffer}},zstd:Tl});var Pl=Object.freeze({__proto__:null,default:class extends Un{constructor(){if(super(),"undefined"==typeof createImageBitmap)throw new Error("Cannot decode WebImage as `createImageBitmap` is not available");if("undefined"==typeof document&&"undefined"==typeof OffscreenCanvas)throw new Error("Cannot decode WebImage as neither `document` nor `OffscreenCanvas` is not available")}async decode(e,t){const A=new Blob([t]),i=await createImageBitmap(A);let r;"undefined"!=typeof document?(r=document.createElement("canvas"),r.width=i.width,r.height=i.height):r=new OffscreenCanvas(i.width,i.height);const n=r.getContext("2d");return n.drawImage(i,0,0),n.getImageData(0,0,i.width,i.height).data.buffer}}});module.exports=ea;
5
+ !function(){var t,i,r,s,n,a,o,A,l,h,c,g,u,d,f,p,I=(t={defaultNoDataValue:-34027999387901484e22,decode:function(e,a){var o=(a=a||{}).encodedMaskData||null===a.encodedMaskData,A=n(e,a.inputOffset||0,o),l=null!==a.noDataValue?a.noDataValue:t.defaultNoDataValue,h=i(A,a.pixelType||Float32Array,a.encodedMaskData,l,a.returnMask),c={width:A.width,height:A.height,pixelData:h.resultPixels,minValue:h.minValue,maxValue:A.pixels.maxValue,noDataValue:l};return h.resultMask&&(c.maskData=h.resultMask),a.returnEncodedMask&&A.mask&&(c.encodedMaskData=A.mask.bitset?A.mask.bitset:null),a.returnFileInfo&&(c.fileInfo=r(A),a.computeUsedBitDepths&&(c.fileInfo.bitDepths=s(A))),c}},i=function(e,t,i,r,s){var n,o,A,l=0,h=e.pixels.numBlocksX,c=e.pixels.numBlocksY,g=Math.floor(e.width/h),u=Math.floor(e.height/c),d=2*e.maxZError,f=Number.MAX_VALUE;i=i||(e.mask?e.mask.bitset:null),o=new t(e.width*e.height),s&&i&&(A=new Uint8Array(e.width*e.height));for(var p,I,m=new Float32Array(g*u),_=0;_<=c;_++){var w=_!==c?u:e.height%c;if(0!==w)for(var C=0;C<=h;C++){var B=C!==h?g:e.width%h;if(0!==B){var E,y,Q,b,k=_*e.width*u+C*g,x=e.width-B,v=e.pixels.blocks[l];if(v.encoding<2?(0===v.encoding?E=v.rawData:(a(v.stuffedData,v.bitsPerPixel,v.numValidPixels,v.offset,d,m,e.pixels.maxValue),E=m),y=0):Q=2===v.encoding?0:v.offset,i)for(I=0;I<w;I++){for(7&k&&(b=i[k>>3],b<<=7&k),p=0;p<B;p++)7&k||(b=i[k>>3]),128&b?(A&&(A[k]=1),f=f>(n=v.encoding<2?E[y++]:Q)?n:f,o[k++]=n):(A&&(A[k]=0),o[k++]=r),b<<=1;k+=x}else if(v.encoding<2)for(I=0;I<w;I++){for(p=0;p<B;p++)f=f>(n=E[y++])?n:f,o[k++]=n;k+=x}else for(f=f>Q?Q:f,I=0;I<w;I++){for(p=0;p<B;p++)o[k++]=Q;k+=x}if(1===v.encoding&&y!==v.numValidPixels)throw"Block and Mask do not match";l++}}}return{resultPixels:o,resultMask:A,minValue:f}},r=function(e){return{fileIdentifierString:e.fileIdentifierString,fileVersion:e.fileVersion,imageType:e.imageType,height:e.height,width:e.width,maxZError:e.maxZError,eofOffset:e.eofOffset,mask:e.mask?{numBlocksX:e.mask.numBlocksX,numBlocksY:e.mask.numBlocksY,numBytes:e.mask.numBytes,maxValue:e.mask.maxValue}:null,pixels:{numBlocksX:e.pixels.numBlocksX,numBlocksY:e.pixels.numBlocksY,numBytes:e.pixels.numBytes,maxValue:e.pixels.maxValue,noDataValue:e.noDataValue}}},s=function(e){for(var t=e.pixels.numBlocksX*e.pixels.numBlocksY,i={},r=0;r<t;r++){var s=e.pixels.blocks[r];0===s.encoding?i.float32=!0:1===s.encoding?i[s.bitsPerPixel]=!0:i[0]=!0}return Object.keys(i)},n=function(e,t,i){var r={},s=new Uint8Array(e,t,10);if(r.fileIdentifierString=String.fromCharCode.apply(null,s),"CntZImage"!==r.fileIdentifierString.trim())throw"Unexpected file identifier string: "+r.fileIdentifierString;t+=10;var n=new DataView(e,t,24);if(r.fileVersion=n.getInt32(0,!0),r.imageType=n.getInt32(4,!0),r.height=n.getUint32(8,!0),r.width=n.getUint32(12,!0),r.maxZError=n.getFloat64(16,!0),t+=24,!i)if(n=new DataView(e,t,16),r.mask={},r.mask.numBlocksY=n.getUint32(0,!0),r.mask.numBlocksX=n.getUint32(4,!0),r.mask.numBytes=n.getUint32(8,!0),r.mask.maxValue=n.getFloat32(12,!0),t+=16,r.mask.numBytes>0){var a=new Uint8Array(Math.ceil(r.width*r.height/8)),o=(n=new DataView(e,t,r.mask.numBytes)).getInt16(0,!0),A=2,l=0;do{if(o>0)for(;o--;)a[l++]=n.getUint8(A++);else{var h=n.getUint8(A++);for(o=-o;o--;)a[l++]=h}o=n.getInt16(A,!0),A+=2}while(A<r.mask.numBytes);if(-32768!==o||l<a.length)throw"Unexpected end of mask RLE encoding";r.mask.bitset=a,t+=r.mask.numBytes}else 0==(r.mask.numBytes|r.mask.numBlocksY|r.mask.maxValue)&&(r.mask.bitset=new Uint8Array(Math.ceil(r.width*r.height/8)));n=new DataView(e,t,16),r.pixels={},r.pixels.numBlocksY=n.getUint32(0,!0),r.pixels.numBlocksX=n.getUint32(4,!0),r.pixels.numBytes=n.getUint32(8,!0),r.pixels.maxValue=n.getFloat32(12,!0),t+=16;var c=r.pixels.numBlocksX,g=r.pixels.numBlocksY,u=c+(r.width%c>0?1:0),d=g+(r.height%g>0?1:0);r.pixels.blocks=new Array(u*d);for(var f=0,p=0;p<d;p++)for(var I=0;I<u;I++){var m=0,_=e.byteLength-t;n=new DataView(e,t,Math.min(10,_));var w={};r.pixels.blocks[f++]=w;var C=n.getUint8(0);if(m++,w.encoding=63&C,w.encoding>3)throw"Invalid block encoding ("+w.encoding+")";if(2!==w.encoding){if(0!==C&&2!==C){if(C>>=6,w.offsetType=C,2===C)w.offset=n.getInt8(1),m++;else if(1===C)w.offset=n.getInt16(1,!0),m+=2;else{if(0!==C)throw"Invalid block offset type";w.offset=n.getFloat32(1,!0),m+=4}if(1===w.encoding)if(C=n.getUint8(m),m++,w.bitsPerPixel=63&C,C>>=6,w.numValidPixelsType=C,2===C)w.numValidPixels=n.getUint8(m),m++;else if(1===C)w.numValidPixels=n.getUint16(m,!0),m+=2;else{if(0!==C)throw"Invalid valid pixel count type";w.numValidPixels=n.getUint32(m,!0),m+=4}}var B;if(t+=m,3!==w.encoding)if(0===w.encoding){var E=(r.pixels.numBytes-1)/4;if(E!==Math.floor(E))throw"uncompressed block has invalid length";B=new ArrayBuffer(4*E),new Uint8Array(B).set(new Uint8Array(e,t,4*E));var y=new Float32Array(B);w.rawData=y,t+=4*E}else if(1===w.encoding){var Q=Math.ceil(w.numValidPixels*w.bitsPerPixel/8),b=Math.ceil(Q/4);B=new ArrayBuffer(4*b),new Uint8Array(B).set(new Uint8Array(e,t,Q)),w.stuffedData=new Uint32Array(B),t+=Q}}else t++}return r.eofOffset=t,r},a=function(e,t,i,r,s,n,a){var o,A,l,h=(1<<t)-1,c=0,g=0,u=Math.ceil((a-r)/s),d=4*e.length-Math.ceil(t*i/8);for(e[e.length-1]<<=8*d,o=0;o<i;o++){if(0===g&&(l=e[c++],g=32),g>=t)A=l>>>g-t&h,g-=t;else{var f=t-g;A=(l&h)<<f&h,A+=(l=e[c++])>>>(g=32-f)}n[o]=A<u?r+A*s:a}return n},t),m=(o=function(e,t,i,r,s,n,a,o){var A,l,h,c,g,u=(1<<i)-1,d=0,f=0,p=4*e.length-Math.ceil(i*r/8);if(e[e.length-1]<<=8*p,s)for(A=0;A<r;A++)0===f&&(h=e[d++],f=32),f>=i?(l=h>>>f-i&u,f-=i):(l=(h&u)<<(c=i-f)&u,l+=(h=e[d++])>>>(f=32-c)),t[A]=s[l];else for(g=Math.ceil((o-n)/a),A=0;A<r;A++)0===f&&(h=e[d++],f=32),f>=i?(l=h>>>f-i&u,f-=i):(l=(h&u)<<(c=i-f)&u,l+=(h=e[d++])>>>(f=32-c)),t[A]=l<g?n+l*a:o},A=function(e,t,i,r,s,n){var a,o=(1<<t)-1,A=0,l=0,h=0,c=0,g=0,u=[],d=4*e.length-Math.ceil(t*i/8);e[e.length-1]<<=8*d;var f=Math.ceil((n-r)/s);for(l=0;l<i;l++)0===c&&(a=e[A++],c=32),c>=t?(g=a>>>c-t&o,c-=t):(g=(a&o)<<(h=t-c)&o,g+=(a=e[A++])>>>(c=32-h)),u[l]=g<f?r+g*s:n;return u.unshift(r),u},l=function(e,t,i,r,s,n,a,o){var A,l,h,c,g=(1<<i)-1,u=0,d=0,f=0;if(s)for(A=0;A<r;A++)0===d&&(h=e[u++],d=32,f=0),d>=i?(l=h>>>f&g,d-=i,f+=i):(l=h>>>f&g,d=32-(c=i-d),l|=((h=e[u++])&(1<<c)-1)<<i-c,f=c),t[A]=s[l];else{var p=Math.ceil((o-n)/a);for(A=0;A<r;A++)0===d&&(h=e[u++],d=32,f=0),d>=i?(l=h>>>f&g,d-=i,f+=i):(l=h>>>f&g,d=32-(c=i-d),l|=((h=e[u++])&(1<<c)-1)<<i-c,f=c),t[A]=l<p?n+l*a:o}return t},h=function(e,t,i,r,s,n){var a,o=(1<<t)-1,A=0,l=0,h=0,c=0,g=0,u=0,d=[],f=Math.ceil((n-r)/s);for(l=0;l<i;l++)0===c&&(a=e[A++],c=32,u=0),c>=t?(g=a>>>u&o,c-=t,u+=t):(g=a>>>u&o,c=32-(h=t-c),g|=((a=e[A++])&(1<<h)-1)<<t-h,u=h),d[l]=g<f?r+g*s:n;return d.unshift(r),d},c=function(e,t,i,r){var s,n,a,o,A=(1<<i)-1,l=0,h=0,c=4*e.length-Math.ceil(i*r/8);for(e[e.length-1]<<=8*c,s=0;s<r;s++)0===h&&(a=e[l++],h=32),h>=i?(n=a>>>h-i&A,h-=i):(n=(a&A)<<(o=i-h)&A,n+=(a=e[l++])>>>(h=32-o)),t[s]=n;return t},g=function(e,t,i,r){var s,n,a,o,A=(1<<i)-1,l=0,h=0,c=0;for(s=0;s<r;s++)0===h&&(a=e[l++],h=32,c=0),h>=i?(n=a>>>c&A,h-=i,c+=i):(n=a>>>c&A,h=32-(o=i-h),n|=((a=e[l++])&(1<<o)-1)<<i-o,c=o),t[s]=n;return t},u={HUFFMAN_LUT_BITS_MAX:12,computeChecksumFletcher32:function(e){for(var t=65535,i=65535,r=e.length,s=Math.floor(r/2),n=0;s;){var a=s>=359?359:s;s-=a;do{t+=e[n++]<<8,i+=t+=e[n++]}while(--a);t=(65535&t)+(t>>>16),i=(65535&i)+(i>>>16)}return 1&r&&(i+=t+=e[n]<<8),((i=(65535&i)+(i>>>16))<<16|(t=(65535&t)+(t>>>16)))>>>0},readHeaderInfo:function(e,t){var i=t.ptr,r=new Uint8Array(e,i,6),s={};if(s.fileIdentifierString=String.fromCharCode.apply(null,r),0!==s.fileIdentifierString.lastIndexOf("Lerc2",0))throw"Unexpected file identifier string (expect Lerc2 ): "+s.fileIdentifierString;i+=6;var n,a=new DataView(e,i,8),o=a.getInt32(0,!0);if(s.fileVersion=o,i+=4,o>=3&&(s.checksum=a.getUint32(4,!0),i+=4),a=new DataView(e,i,12),s.height=a.getUint32(0,!0),s.width=a.getUint32(4,!0),i+=8,o>=4?(s.numDims=a.getUint32(8,!0),i+=4):s.numDims=1,a=new DataView(e,i,40),s.numValidPixel=a.getUint32(0,!0),s.microBlockSize=a.getInt32(4,!0),s.blobSize=a.getInt32(8,!0),s.imageType=a.getInt32(12,!0),s.maxZError=a.getFloat64(16,!0),s.zMin=a.getFloat64(24,!0),s.zMax=a.getFloat64(32,!0),i+=40,t.headerInfo=s,t.ptr=i,o>=3&&(n=o>=4?52:48,this.computeChecksumFletcher32(new Uint8Array(e,i-n,s.blobSize-14))!==s.checksum))throw"Checksum failed.";return!0},checkMinMaxRanges:function(e,t){var i=t.headerInfo,r=this.getDataTypeArray(i.imageType),s=i.numDims*this.getDataTypeSize(i.imageType),n=this.readSubArray(e,t.ptr,r,s),a=this.readSubArray(e,t.ptr+s,r,s);t.ptr+=2*s;var o,A=!0;for(o=0;o<i.numDims;o++)if(n[o]!==a[o]){A=!1;break}return i.minValues=n,i.maxValues=a,A},readSubArray:function(e,t,i,r){var s;if(i===Uint8Array)s=new Uint8Array(e,t,r);else{var n=new ArrayBuffer(r);new Uint8Array(n).set(new Uint8Array(e,t,r)),s=new i(n)}return s},readMask:function(e,t){var i,r,s=t.ptr,n=t.headerInfo,a=n.width*n.height,o=n.numValidPixel,A=new DataView(e,s,4),l={};if(l.numBytes=A.getUint32(0,!0),s+=4,(0===o||a===o)&&0!==l.numBytes)throw"invalid mask";if(0===o)i=new Uint8Array(Math.ceil(a/8)),l.bitset=i,r=new Uint8Array(a),t.pixels.resultMask=r,s+=l.numBytes;else if(l.numBytes>0){i=new Uint8Array(Math.ceil(a/8));var h=(A=new DataView(e,s,l.numBytes)).getInt16(0,!0),c=2,g=0,u=0;do{if(h>0)for(;h--;)i[g++]=A.getUint8(c++);else for(u=A.getUint8(c++),h=-h;h--;)i[g++]=u;h=A.getInt16(c,!0),c+=2}while(c<l.numBytes);if(-32768!==h||g<i.length)throw"Unexpected end of mask RLE encoding";r=new Uint8Array(a);var d=0,f=0;for(f=0;f<a;f++)7&f?(d=i[f>>3],d<<=7&f):d=i[f>>3],128&d&&(r[f]=1);t.pixels.resultMask=r,l.bitset=i,s+=l.numBytes}return t.ptr=s,t.mask=l,!0},readDataOneSweep:function(e,t,i,r){var s,n=t.ptr,a=t.headerInfo,o=a.numDims,A=a.width*a.height,l=a.imageType,h=a.numValidPixel*u.getDataTypeSize(l)*o,c=t.pixels.resultMask;if(i===Uint8Array)s=new Uint8Array(e,n,h);else{var g=new ArrayBuffer(h);new Uint8Array(g).set(new Uint8Array(e,n,h)),s=new i(g)}if(s.length===A*o)t.pixels.resultPixels=r?u.swapDimensionOrder(s,A,o,i,!0):s;else{t.pixels.resultPixels=new i(A*o);var d=0,f=0,p=0,I=0;if(o>1){if(r){for(f=0;f<A;f++)if(c[f])for(I=f,p=0;p<o;p++,I+=A)t.pixels.resultPixels[I]=s[d++]}else for(f=0;f<A;f++)if(c[f])for(I=f*o,p=0;p<o;p++)t.pixels.resultPixels[I+p]=s[d++]}else for(f=0;f<A;f++)c[f]&&(t.pixels.resultPixels[f]=s[d++])}return n+=h,t.ptr=n,!0},readHuffmanTree:function(e,t){var i=this.HUFFMAN_LUT_BITS_MAX,r=new DataView(e,t.ptr,16);if(t.ptr+=16,r.getInt32(0,!0)<2)throw"unsupported Huffman version";var s=r.getInt32(4,!0),n=r.getInt32(8,!0),a=r.getInt32(12,!0);if(n>=a)return!1;var o=new Uint32Array(a-n);u.decodeBits(e,t,o);var A,l,h,c,g=[];for(A=n;A<a;A++)g[l=A-(A<s?0:s)]={first:o[A-n],second:null};var f=e.byteLength-t.ptr,p=Math.ceil(f/4),I=new ArrayBuffer(4*p);new Uint8Array(I).set(new Uint8Array(e,t.ptr,f));var m,_=new Uint32Array(I),w=0,C=0;for(m=_[0],A=n;A<a;A++)(c=g[l=A-(A<s?0:s)].first)>0&&(g[l].second=m<<w>>>32-c,32-w>=c?32===(w+=c)&&(w=0,m=_[++C]):(w+=c-32,m=_[++C],g[l].second|=m>>>32-w));var B=0,E=0,y=new d;for(A=0;A<g.length;A++)void 0!==g[A]&&(B=Math.max(B,g[A].first));E=B>=i?i:B;var Q,b,k,x,v,D=[];for(A=n;A<a;A++)if((c=g[l=A-(A<s?0:s)].first)>0)if(Q=[c,l],c<=E)for(b=g[l].second<<E-c,k=1<<E-c,h=0;h<k;h++)D[b|h]=Q;else for(b=g[l].second,v=y,x=c-1;x>=0;x--)b>>>x&1?(v.right||(v.right=new d),v=v.right):(v.left||(v.left=new d),v=v.left),0!==x||v.val||(v.val=Q[1]);return{decodeLut:D,numBitsLUTQick:E,numBitsLUT:B,tree:y,stuffedData:_,srcPtr:C,bitPos:w}},readHuffman:function(e,t,i,r){var s,n,a,o,A,l,h,c,g,d=t.headerInfo.numDims,f=t.headerInfo.height,p=t.headerInfo.width,I=p*f,m=this.readHuffmanTree(e,t),_=m.decodeLut,w=m.tree,C=m.stuffedData,B=m.srcPtr,E=m.bitPos,y=m.numBitsLUTQick,Q=m.numBitsLUT,b=0===t.headerInfo.imageType?128:0,k=t.pixels.resultMask,x=0;E>0&&(B++,E=0);var v,D=C[B],S=1===t.encodeMode,M=new i(I*d),U=M;if(d<2||S){for(v=0;v<d;v++)if(d>1&&(U=new i(M.buffer,I*v,I),x=0),t.headerInfo.numValidPixel===p*f)for(c=0,l=0;l<f;l++)for(h=0;h<p;h++,c++){if(n=0,A=o=D<<E>>>32-y,32-E<y&&(A=o|=C[B+1]>>>64-E-y),_[A])n=_[A][1],E+=_[A][0];else for(A=o=D<<E>>>32-Q,32-E<Q&&(A=o|=C[B+1]>>>64-E-Q),s=w,g=0;g<Q;g++)if(!(s=o>>>Q-g-1&1?s.right:s.left).left&&!s.right){n=s.val,E=E+g+1;break}E>=32&&(E-=32,D=C[++B]),a=n-b,S?(a+=h>0?x:l>0?U[c-p]:x,a&=255,U[c]=a,x=a):U[c]=a}else for(c=0,l=0;l<f;l++)for(h=0;h<p;h++,c++)if(k[c]){if(n=0,A=o=D<<E>>>32-y,32-E<y&&(A=o|=C[B+1]>>>64-E-y),_[A])n=_[A][1],E+=_[A][0];else for(A=o=D<<E>>>32-Q,32-E<Q&&(A=o|=C[B+1]>>>64-E-Q),s=w,g=0;g<Q;g++)if(!(s=o>>>Q-g-1&1?s.right:s.left).left&&!s.right){n=s.val,E=E+g+1;break}E>=32&&(E-=32,D=C[++B]),a=n-b,S?(h>0&&k[c-1]?a+=x:l>0&&k[c-p]?a+=U[c-p]:a+=x,a&=255,U[c]=a,x=a):U[c]=a}}else for(c=0,l=0;l<f;l++)for(h=0;h<p;h++)if(c=l*p+h,!k||k[c])for(v=0;v<d;v++,c+=I){if(n=0,A=o=D<<E>>>32-y,32-E<y&&(A=o|=C[B+1]>>>64-E-y),_[A])n=_[A][1],E+=_[A][0];else for(A=o=D<<E>>>32-Q,32-E<Q&&(A=o|=C[B+1]>>>64-E-Q),s=w,g=0;g<Q;g++)if(!(s=o>>>Q-g-1&1?s.right:s.left).left&&!s.right){n=s.val,E=E+g+1;break}E>=32&&(E-=32,D=C[++B]),a=n-b,U[c]=a}t.ptr=t.ptr+4*(B+1)+(E>0?4:0),t.pixels.resultPixels=M,d>1&&!r&&(t.pixels.resultPixels=u.swapDimensionOrder(M,I,d,i))},decodeBits:function(e,t,i,r,s){var n=t.headerInfo,a=n.fileVersion,u=0,d=e.byteLength-t.ptr>=5?5:e.byteLength-t.ptr,f=new DataView(e,t.ptr,d),p=f.getUint8(0);u++;var I=p>>6,m=0===I?4:3-I,_=(32&p)>0,w=31&p,C=0;if(1===m)C=f.getUint8(u),u++;else if(2===m)C=f.getUint16(u,!0),u+=2;else{if(4!==m)throw"Invalid valid pixel count type";C=f.getUint32(u,!0),u+=4}var B,E,y,Q,b,k,x,v,D,S=2*n.maxZError,M=n.numDims>1?n.maxValues[s]:n.zMax;if(_){for(t.counter.lut++,v=f.getUint8(u),u++,Q=Math.ceil((v-1)*w/8),b=Math.ceil(Q/4),E=new ArrayBuffer(4*b),y=new Uint8Array(E),t.ptr+=u,y.set(new Uint8Array(e,t.ptr,Q)),x=new Uint32Array(E),t.ptr+=Q,D=0;v-1>>>D;)D++;Q=Math.ceil(C*D/8),b=Math.ceil(Q/4),E=new ArrayBuffer(4*b),(y=new Uint8Array(E)).set(new Uint8Array(e,t.ptr,Q)),B=new Uint32Array(E),t.ptr+=Q,k=a>=3?h(x,w,v-1,r,S,M):A(x,w,v-1,r,S,M),a>=3?l(B,i,D,C,k):o(B,i,D,C,k)}else t.counter.bitstuffer++,D=w,t.ptr+=u,D>0&&(Q=Math.ceil(C*D/8),b=Math.ceil(Q/4),E=new ArrayBuffer(4*b),(y=new Uint8Array(E)).set(new Uint8Array(e,t.ptr,Q)),B=new Uint32Array(E),t.ptr+=Q,a>=3?null==r?g(B,i,D,C):l(B,i,D,C,!1,r,S,M):null==r?c(B,i,D,C):o(B,i,D,C,!1,r,S,M))},readTiles:function(e,t,i,r){var s=t.headerInfo,n=s.width,a=s.height,o=n*a,A=s.microBlockSize,l=s.imageType,h=u.getDataTypeSize(l),c=Math.ceil(n/A),g=Math.ceil(a/A);t.pixels.numBlocksY=g,t.pixels.numBlocksX=c,t.pixels.ptr=0;var d,f,p,I,m,_,w,C,B,E,y=0,Q=0,b=0,k=0,x=0,v=0,D=0,S=0,M=0,U=0,T=0,G=0,L=0,R=0,F=0,N=new i(A*A),O=a%A||A,P=n%A||A,z=s.numDims,q=t.pixels.resultMask,K=t.pixels.resultPixels,H=s.fileVersion>=5?14:15,V=s.zMax;for(b=0;b<g;b++)for(x=b!==g-1?A:O,k=0;k<c;k++)for(U=b*n*A+k*A,T=n-(v=k!==c-1?A:P),C=0;C<z;C++){if(z>1?(E=K,U=b*n*A+k*A,K=new i(t.pixels.resultPixels.buffer,o*C*h,o),V=s.maxValues[C]):E=null,D=e.byteLength-t.ptr,f={},F=0,S=(d=new DataView(e,t.ptr,Math.min(10,D))).getUint8(0),F++,B=s.fileVersion>=5?4&S:0,M=S>>6&255,(S>>2&H)!=(k*A>>3&H))throw"integrity issue";if(B&&0===C)throw"integrity issue";if((m=3&S)>3)throw t.ptr+=F,"Invalid block encoding ("+m+")";if(2!==m)if(0===m){if(B)throw"integrity issue";if(t.counter.uncompressed++,t.ptr+=F,G=(G=x*v*h)<(L=e.byteLength-t.ptr)?G:L,p=new ArrayBuffer(G%h==0?G:G+h-G%h),new Uint8Array(p).set(new Uint8Array(e,t.ptr,G)),I=new i(p),R=0,q)for(y=0;y<x;y++){for(Q=0;Q<v;Q++)q[U]&&(K[U]=I[R++]),U++;U+=T}else for(y=0;y<x;y++){for(Q=0;Q<v;Q++)K[U++]=I[R++];U+=T}t.ptr+=R*h}else if(_=u.getDataTypeUsed(B&&l<6?4:l,M),w=u.getOnePixel(f,F,_,d),F+=u.getDataTypeSize(_),3===m)if(t.ptr+=F,t.counter.constantoffset++,q)for(y=0;y<x;y++){for(Q=0;Q<v;Q++)q[U]&&(K[U]=B?Math.min(V,E[U]+w):w),U++;U+=T}else for(y=0;y<x;y++){for(Q=0;Q<v;Q++)K[U]=B?Math.min(V,E[U]+w):w,U++;U+=T}else if(t.ptr+=F,u.decodeBits(e,t,N,w,C),F=0,B)if(q)for(y=0;y<x;y++){for(Q=0;Q<v;Q++)q[U]&&(K[U]=N[F++]+E[U]),U++;U+=T}else for(y=0;y<x;y++){for(Q=0;Q<v;Q++)K[U]=N[F++]+E[U],U++;U+=T}else if(q)for(y=0;y<x;y++){for(Q=0;Q<v;Q++)q[U]&&(K[U]=N[F++]),U++;U+=T}else for(y=0;y<x;y++){for(Q=0;Q<v;Q++)K[U++]=N[F++];U+=T}else{if(B)if(q)for(y=0;y<x;y++)for(Q=0;Q<v;Q++)q[U]&&(K[U]=E[U]),U++;else for(y=0;y<x;y++)for(Q=0;Q<v;Q++)K[U]=E[U],U++;t.counter.constant++,t.ptr+=F}}z>1&&!r&&(t.pixels.resultPixels=u.swapDimensionOrder(t.pixels.resultPixels,o,z,i))},formatFileInfo:function(e){return{fileIdentifierString:e.headerInfo.fileIdentifierString,fileVersion:e.headerInfo.fileVersion,imageType:e.headerInfo.imageType,height:e.headerInfo.height,width:e.headerInfo.width,numValidPixel:e.headerInfo.numValidPixel,microBlockSize:e.headerInfo.microBlockSize,blobSize:e.headerInfo.blobSize,maxZError:e.headerInfo.maxZError,pixelType:u.getPixelType(e.headerInfo.imageType),eofOffset:e.eofOffset,mask:e.mask?{numBytes:e.mask.numBytes}:null,pixels:{numBlocksX:e.pixels.numBlocksX,numBlocksY:e.pixels.numBlocksY,maxValue:e.headerInfo.zMax,minValue:e.headerInfo.zMin,noDataValue:e.noDataValue}}},constructConstantSurface:function(e,t){var i=e.headerInfo.zMax,r=e.headerInfo.zMin,s=e.headerInfo.maxValues,n=e.headerInfo.numDims,a=e.headerInfo.height*e.headerInfo.width,o=0,A=0,l=0,h=e.pixels.resultMask,c=e.pixels.resultPixels;if(h)if(n>1){if(t)for(o=0;o<n;o++)for(l=o*a,i=s[o],A=0;A<a;A++)h[A]&&(c[l+A]=i);else for(A=0;A<a;A++)if(h[A])for(l=A*n,o=0;o<n;o++)c[l+n]=s[o]}else for(A=0;A<a;A++)h[A]&&(c[A]=i);else if(n>1&&r!==i)if(t)for(o=0;o<n;o++)for(l=o*a,i=s[o],A=0;A<a;A++)c[l+A]=i;else for(A=0;A<a;A++)for(l=A*n,o=0;o<n;o++)c[l+o]=s[o];else for(A=0;A<a*n;A++)c[A]=i},getDataTypeArray:function(e){var t;switch(e){case 0:t=Int8Array;break;case 1:t=Uint8Array;break;case 2:t=Int16Array;break;case 3:t=Uint16Array;break;case 4:t=Int32Array;break;case 5:t=Uint32Array;break;case 6:default:t=Float32Array;break;case 7:t=Float64Array}return t},getPixelType:function(e){var t;switch(e){case 0:t="S8";break;case 1:t="U8";break;case 2:t="S16";break;case 3:t="U16";break;case 4:t="S32";break;case 5:t="U32";break;case 6:default:t="F32";break;case 7:t="F64"}return t},isValidPixelValue:function(e,t){if(null==t)return!1;var i;switch(e){case 0:i=t>=-128&&t<=127;break;case 1:i=t>=0&&t<=255;break;case 2:i=t>=-32768&&t<=32767;break;case 3:i=t>=0&&t<=65536;break;case 4:i=t>=-2147483648&&t<=2147483647;break;case 5:i=t>=0&&t<=4294967296;break;case 6:i=t>=-34027999387901484e22&&t<=34027999387901484e22;break;case 7:i=t>=-17976931348623157e292&&t<=17976931348623157e292;break;default:i=!1}return i},getDataTypeSize:function(e){var t=0;switch(e){case 0:case 1:t=1;break;case 2:case 3:t=2;break;case 4:case 5:case 6:t=4;break;case 7:t=8;break;default:t=e}return t},getDataTypeUsed:function(e,t){var i=e;switch(e){case 2:case 4:i=e-t;break;case 3:case 5:i=e-2*t;break;case 6:i=0===t?e:1===t?2:1;break;case 7:i=0===t?e:e-2*t+1;break;default:i=e}return i},getOnePixel:function(e,t,i,r){var s=0;switch(i){case 0:s=r.getInt8(t);break;case 1:s=r.getUint8(t);break;case 2:s=r.getInt16(t,!0);break;case 3:s=r.getUint16(t,!0);break;case 4:s=r.getInt32(t,!0);break;case 5:s=r.getUInt32(t,!0);break;case 6:s=r.getFloat32(t,!0);break;case 7:s=r.getFloat64(t,!0);break;default:throw"the decoder does not understand this pixel type"}return s},swapDimensionOrder:function(e,t,i,r,s){var n=0,a=0,o=0,A=0,l=e;if(i>1)if(l=new r(t*i),s)for(n=0;n<t;n++)for(A=n,o=0;o<i;o++,A+=t)l[A]=e[a++];else for(n=0;n<t;n++)for(A=n,o=0;o<i;o++,A+=t)l[a++]=e[A];return l}},d=function(e,t,i){this.val=e,this.left=t,this.right=i},{decode:function(e,t){var i=(t=t||{}).noDataValue,r=0,s={};if(s.ptr=t.inputOffset||0,s.pixels={},u.readHeaderInfo(e,s)){var n=s.headerInfo,a=n.fileVersion,o=u.getDataTypeArray(n.imageType);if(a>5)throw"unsupported lerc version 2."+a;u.readMask(e,s),n.numValidPixel===n.width*n.height||s.pixels.resultMask||(s.pixels.resultMask=t.maskData);var A=n.width*n.height;s.pixels.resultPixels=new o(A*n.numDims),s.counter={onesweep:0,uncompressed:0,lut:0,bitstuffer:0,constant:0,constantoffset:0};var l,h=!t.returnPixelInterleavedDims;if(0!==n.numValidPixel)if(n.zMax===n.zMin)u.constructConstantSurface(s,h);else if(a>=4&&u.checkMinMaxRanges(e,s))u.constructConstantSurface(s,h);else{var c=new DataView(e,s.ptr,2),g=c.getUint8(0);if(s.ptr++,g)u.readDataOneSweep(e,s,o,h);else if(a>1&&n.imageType<=1&&Math.abs(n.maxZError-.5)<1e-5){var d=c.getUint8(1);if(s.ptr++,s.encodeMode=d,d>2||a<4&&d>1)throw"Invalid Huffman flag "+d;d?u.readHuffman(e,s,o,h):u.readTiles(e,s,o,h)}else u.readTiles(e,s,o,h)}s.eofOffset=s.ptr,t.inputOffset?(l=s.headerInfo.blobSize+t.inputOffset-s.ptr,Math.abs(l)>=1&&(s.eofOffset=t.inputOffset+s.headerInfo.blobSize)):(l=s.headerInfo.blobSize-s.ptr,Math.abs(l)>=1&&(s.eofOffset=s.headerInfo.blobSize));var f={width:n.width,height:n.height,pixelData:s.pixels.resultPixels,minValue:n.zMin,maxValue:n.zMax,validPixelCount:n.numValidPixel,dimCount:n.numDims,dimStats:{minValues:n.minValues,maxValues:n.maxValues},maskData:s.pixels.resultMask};if(s.pixels.resultMask&&u.isValidPixelValue(n.imageType,i)){var p=s.pixels.resultMask;for(r=0;r<A;r++)p[r]||(f.pixelData[r]=i);f.noDataValue=i}return s.noDataValue=i,t.returnFileInfo&&(f.fileInfo=u.formatFileInfo(s)),f}},getBandCount:function(e){for(var t=0,i=0,r={ptr:0,pixels:{}};i<e.byteLength-58;)u.readHeaderInfo(e,r),i+=r.headerInfo.blobSize,t++,r.ptr=i;return t}}),_=(f=new ArrayBuffer(4),p=new Uint8Array(f),new Uint32Array(f)[0]=1,1===p[0]),w={decode:function(e,t){if(!_)throw"Big endian system is not supported.";var i,r,s=(t=t||{}).inputOffset||0,n=new Uint8Array(e,s,10),a=String.fromCharCode.apply(null,n);if("CntZImage"===a.trim())i=I,r=1;else{if("Lerc2"!==a.substring(0,5))throw"Unexpected file identifier string: "+a;i=m,r=2}for(var o,A,l,h,c,g,u=0,d=e.byteLength-10,f=[],p={width:0,height:0,pixels:[],pixelType:t.pixelType,mask:null,statistics:[]},w=0;s<d;){var C=i.decode(e,{inputOffset:s,encodedMaskData:o,maskData:l,returnMask:0===u,returnEncodedMask:0===u,returnFileInfo:!0,returnPixelInterleavedDims:t.returnPixelInterleavedDims,pixelType:t.pixelType||null,noDataValue:t.noDataValue||null});s=C.fileInfo.eofOffset,l=C.maskData,0===u&&(o=C.encodedMaskData,p.width=C.width,p.height=C.height,p.dimCount=C.dimCount||1,p.pixelType=C.pixelType||C.fileInfo.pixelType,p.mask=l),r>1&&(l&&f.push(l),C.fileInfo.mask&&C.fileInfo.mask.numBytes>0&&w++),u++,p.pixels.push(C.pixelData),p.statistics.push({minValue:C.minValue,maxValue:C.maxValue,noDataValue:C.noDataValue,dimStats:C.dimStats})}if(r>1&&w>1){for(g=p.width*p.height,p.bandMasks=f,(l=new Uint8Array(g)).set(f[0]),h=1;h<f.length;h++)for(A=f[h],c=0;c<g;c++)l[c]=l[c]&A[c];p.maskData=l}return p}};e.exports?e.exports=w:this.Lerc=w}()}(sg);var ng=Mn(sg.exports);let ag,og,Ag;const lg={env:{emscripten_notify_memory_growth:function(e){Ag=new Uint8Array(og.exports.memory.buffer)}}};const hg="AGFzbQEAAAABpQEVYAF/AX9gAn9/AGADf39/AX9gBX9/f39/AX9gAX8AYAJ/fwF/YAR/f39/AX9gA39/fwBgBn9/f39/fwF/YAd/f39/f39/AX9gAn9/AX5gAn5+AX5gAABgBX9/f39/AGAGf39/f39/AGAIf39/f39/f38AYAl/f39/f39/f38AYAABf2AIf39/f39/f38Bf2ANf39/f39/f39/f39/fwF/YAF/AX4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ACwsgAkEDTQ0AA0AgACACQXxqIgJqIAEgAmooAgA2AgAgAkEDSw0ACwsgAkUNAgNAIAAgAkF/aiICaiABIAJqLQAAOgAAIAINAAsMAgsgAkEDTQ0AIAIhBANAIAMgASgCADYCACABQQRqIQEgA0EEaiEDIARBfGoiBEEDSw0ACyACQQNxIQILIAJFDQADQCADIAEtAAA6AAAgA0EBaiEDIAFBAWohASACQX9qIgINAAsLIAAL8wICAn8BfgJAIAJFDQAgACACaiIDQX9qIAE6AAAgACABOgAAIAJBA0kNACADQX5qIAE6AAAgACABOgABIANBfWogAToAACAAIAE6AAIgAkEHSQ0AIANBfGogAToAACAAIAE6AAMgAkEJSQ0AIABBACAAa0EDcSIEaiIDIAFB/wFxQYGChAhsIgE2AgAgAyACIARrQXxxIgRqIgJBfGogATYCACAEQQlJDQAgAyABNgIIIAMgATYCBCACQXhqIAE2AgAgAkF0aiABNgIAIARBGUkNACADIAE2AhggAyABNgIUIAMgATYCECADIAE2AgwgAkFwaiABNgIAIAJBbGogATYCACACQWhqIAE2AgAgAkFkaiABNgIAIAQgA0EEcUEYciIEayICQSBJDQAgAa0iBUIghiAFhCEFIAMgBGohAQNAIAEgBTcDGCABIAU3AxAgASAFNwMIIAEgBTcDACABQSBqIQEgAkFgaiICQR9LDQALCyAACy8BAn8gACgCBCAAKAIAQQJ0aiICLQACIQMgACACLwEAIAEgAi0AAxAIajYCACADCy8BAn8gACgCBCAAKAIAQQJ0aiICLQACIQMgACACLwEAIAEgAi0AAxAFajYCACADCx8AIAAgASACKAIEEAg2AgAgARAEGiAAIAJBCGo2AgQLCAAgAGdBH3MLugUBDX8jAEEQayIKJAACfyAEQQNNBEAgCkEANgIMIApBDGogAyAEEAsaIAAgASACIApBDGpBBBAVIgBBbCAAEAMbIAAgACAESxsMAQsgAEEAIAEoAgBBAXRBAmoQECENQVQgAygAACIGQQ9xIgBBCksNABogAiAAQQVqNgIAIAMgBGoiAkF8aiEMIAJBeWohDiACQXtqIRAgAEEGaiEL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ACIARBCGoQLCIFEAMEfyAFBSACIAVBA2oiBU8NAUG4fwsQGgwCCyAGQQFqIQYgAiAFayECIAMgBWohAyAEKAIMRQ0ACyAEKAI4BEAgAkEDTQRAIABBuH8QGgwCCyADQQRqIQMLIAQoAighAiAEKQMYIQcgAEEANgIEIAAgAyABazYCACAAIAIgBmytIAcgB0J/URs3AwgLIARBQGskAAslAQF/IwBBEGsiAiQAIAIgACABEFEgAigCACEAIAJBEGokACAAC30BBH8jAEGQBGsiBCQAIARB/wE2AggCQCAEQRBqIARBCGogBEEMaiABIAIQFSIGEAMEQCAGIQUMAQtBVCEFIAQoAgwiB0EGSw0AIAMgBEEQaiAEKAIIIAcQQSIFEAMNACAAIAEgBmogAiAGayADEDwhBQsgBEGQBGokACAFC4cBAgJ/An5BABAWIQMCQANAIAEgA08EQAJAIAAoAABBcHFB0NS0wgFGBEAgACABECIiAhADRQ0BQn4PCyAAIAEQVSIEQn1WDQMgBCAFfCIFIARUIQJCfiEEIAINAyAAIAEQUiICEAMNAwsgASACayEBIAAgAmohAAwBCwtCfiAFIAEbIQQLIAQLPwIBfwF+IwBBMGsiAiQAAn5CfiACQQhqIAAgARAtDQAaQgAgAigCHEEBRg0AGiACKQMICyEDIAJBMGokACADC40BAQJ/IwBBMGsiASQAAkAgAEUNACAAKAKI4gENACABIABB/OEBaigCADYCKCABIAApAvThATcDICAAEDAgACgCqOIBIQIgASABKAIoNgIYIAEgASkDIDcDECACIAFBEGoQGyAAQQA2AqjiASABIAEoAig2AgggASABKQMgNwMAIAAgARAbCyABQTBqJAALKgECfyMAQRBrIgAkACAAQQA2AgggAEIANwMAIAAQWCEBIABBEGokACABC4cBAQN/IwBBEGsiAiQAAkAgACgCAEUgACgCBEVzDQAgAiAAKAIINgIIIAIgACkCADcDAAJ/IAIoAgAiAQRAIAIoAghBqOMJIAERBQAMAQtBqOMJECgLIgFFDQAgASAAKQIANwL04QEgAUH84QFqIAAoAgg2AgAgARBZIAEhAwsgAkEQaiQAIAMLywEBAn8jAEEgayIBJAAgAEGBgIDAADYCtOIBIABBADYCiOIBIABBADYC7OEBIABCADcDkOIBIABBADYCpOMJIABBADYC3OIBIABCADcCzOIBIABBADYCvOIBIABBADYCxOABIABCADcCnOIBIABBpOIBakIANwIAIABBrOIBakEANgIAIAFCADcCECABQgA3AhggASABKQMYNwMIIAEgASkDEDcDACABKAIIQQh2QQFxIQIgAEEANgLg4gEgACACNgKM4gEgAUEgaiQAC3YBA38jAEEwayIBJAAgAARAIAEgAEHE0AFqIgIoAgA2AiggASAAKQK80AE3AyAgACgCACEDIAEgAigCADYCGCABIAApArzQATcDECADIAFBEGoQGyABIAEoAig2AgggASABKQMgNwMAIAAgARAbCyABQTBqJAALzAEBAX8gACABKAK00AE2ApjiASAAIAEoAgQiAjYCwOABIAAgAjYCvOABIAAgAiABKAIIaiICNgK44AEgACACNgLE4AEgASgCuNABBEAgAEKBgICAEDcDiOEBIAAgAUGk0ABqNgIMIAAgAUGUIGo2AgggACABQZwwajYCBCAAIAFBDGo2AgAgAEGs0AFqIAFBqNABaigCADYCACAAQbDQAWogAUGs0AFqKAIANgIAIABBtNABaiABQbDQAWooAgA2AgAPCyAAQgA3A4jhAQs7ACACRQRAQbp/DwsgBEUEQEFsDwsgAiAEEGAEQCAAIAEgAiADIAQgBRBhDwsgACABIAIgAyAEIAUQZQtGAQF/IwBBEGsiBSQAIAVBCGogBBAOAn8gBS0ACQRAIAAgASACIAMgBBAyDAELIAAgASACIAMgBBA0CyEAIAVBEGokACAACzQAIAAgAyAEIAUQNiIFEAMEQCAFDwsgBSAESQR/IAEgAiADIAVqIAQgBWsgABA1BUG4fwsLRgEBfyMAQRBrIgUkACAFQQhqIAQQDgJ/IAUtAAkEQCAAIAEgAiADIAQQYgwBCyAAIAEgAiADIAQQNQshACAFQRBqJAAgAAtZAQF/QQ8hAiABIABJBEAgAUEEdCAAbiECCyAAQQh2IgEgAkEYbCIAQYwIaigCAGwgAEGICGooAgBqIgJBA3YgAmogAEGACGoo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CQAAAAAAAAULAAAAAAAABg0AAAAAAAAGEAAAAAAAAAYTAAAAAAAABhYAAAAAAAAGGQAAAAAAAAYcAAAAAAAABh8AAAAAAAAGIgAAAAAAAQYlAAAAAAABBikAAAAAAAIGLwAAAAAAAwY7AAAAAAAEBlMAAAAAAAcGgwAAAAAACQYDAgAAEAAABAQAAAAAAAAEBQAAACAAAAUGAAAAAAAABQcAAAAgAAAFCQAAAAAAAAUKAAAAAAAABgwAAAAAAAAGDwAAAAAAAAYSAAAAAAAABhUAAAAAAAAGGAAAAAAAAAYbAAAAAAAABh4AAAAAAAAGIQAAAAAAAQYjAAAAAAABBicAAAAAAAIGKwAAAAAAAwYzAAAAAAAEBkMAAAAAAAUGYwAAAAAACAYDAQAAIAAABAQAAAAwAAAEBAAAABAAAAQFAAAAIAAABQcAAAAgAAAFCAAAACAAAAUKAAAAIAAABQsAAAAAAAAGDgAAAAAAAAYRAAAAAAAABhQAAAAAAAAGFwAAAAAAAAYaAAAAAAAABh0AAAAAAAAGIAAAAAAAEAYDAAEAAAAPBgOAAAAAAA4GA0AAAAAADQYDIAAAAAAMBgMQAAAAAAsGAwgAAAAACgYDBABBpB0L2QEBAAAAAwAAAAcAAAAPAAAAHwAAAD8AAAB/AAAA/wAAAP8BAAD/AwAA/wcAAP8PAAD/HwAA/z8AAP9/AAD//wAA//8BAP//AwD//wcA//8PAP//HwD//z8A//9/AP///wD///8B////A////wf///8P////H////z////9/AAAAAAEAAAACAAAABAAAAAAAAAACAAAABAAAAAgAAAAAAAAAAQAAAAIAAAABAAAABAAAAAQAAAAEAAAABAAAAAgAAAAIAAAACAAAAAcAAAAIAAAACQAAAAoAAAALAEGgIAsDwBBQ",cg=new class{init(){return ag||(ag="undefined"!=typeof fetch?fetch("data:application/wasm;base64,"+hg).then((e=>e.arrayBuffer())).then((e=>WebAssembly.instantiate(e,lg))).then(this._init):WebAssembly.instantiate(Buffer.from(hg,"base64"),lg).then(this._init),ag)}_init(e){og=e.instance,lg.env.emscripten_notify_memory_growth(0)}decode(e,t=0){if(!og)throw new Error("ZSTDDecoder: Await .init() before decoding.");const i=e.byteLength,r=og.exports.malloc(i);Ag.set(e,r),t=t||Number(og.exports.ZSTD_findDecompressedSize(r,i));const s=og.exports.malloc(t),n=og.exports.ZSTD_decompress(s,t,r,i),a=Ag.slice(s,s+n);return og.exports.free(r),og.exports.free(s),a}};var gg=Object.freeze({__proto__:null,default:class extends Vo{constructor(e){super(),this.planarConfiguration=void 0!==e.PlanarConfiguration?e.PlanarConfiguration:1,this.samplesPerPixel=void 0!==e.SamplesPerPixel?e.SamplesPerPixel:1,this.addCompression=e.LercParameters[Qo]}decodeBlock(e){switch(this.addCompression){case bo:break;case ko:e=tg(new Uint8Array(e)).buffer;break;case xo:e=cg.decode(new Uint8Array(e)).buffer;break;default:throw new Error(`Unsupported LERC additional compression method identifier: ${this.addCompression}`)}return ng.decode(e,{returnPixelInterleavedDims:1===this.planarConfiguration}).pixels[0].buffer}},zstd:cg});var ug=Object.freeze({__proto__:null,default:class extends Vo{constructor(){if(super(),"undefined"==typeof createImageBitmap)throw new Error("Cannot decode WebImage as `createImageBitmap` is not available");if("undefined"==typeof document&&"undefined"==typeof OffscreenCanvas)throw new Error("Cannot decode WebImage as neither `document` nor `OffscreenCanvas` is not available")}async decode(e,t){const i=new Blob([t]),r=await createImageBitmap(i);let s;"undefined"!=typeof document?(s=document.createElement("canvas"),s.width=r.width,s.height=r.height):s=new OffscreenCanvas(r.width,r.height);const n=s.getContext("2d");return n.drawImage(r,0,0),n.getImageData(0,0,r.width,r.height).data.buffer}}});module.exports=xA;
6
6
  //# sourceMappingURL=index.min.js.map