@gisatcz/deckgl-geolib 1.11.0-dev.0 → 1.11.0-dev.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.js +3 -5
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/index.min.js +1 -1
- package/dist/cjs/index.min.js.map +1 -1
- package/dist/esm/index.js +3 -5
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/index.min.js +1 -1
- package/dist/esm/index.min.js.map +1 -1
- package/package.json +1 -1
- package/src/geoimage/geoimage.ts +3 -4
package/dist/cjs/index.min.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";var e,t,A,i,r,a,n,s,o,l,g,h,f,c,d=require("@deck.gl/core"),I=require("@deck.gl/geo-layers"),u=require("@deck.gl/layers"),B=require("@deck.gl/extensions"),C=require("chroma-js"),E=require("@loaders.gl/schema"),w=require("@loaders.gl/loader-utils"),Q=require("@deck.gl/mesh-layers");function m(e,t,A,i){return new(A||(A=Promise))((function(r,a){function n(e){try{o(i.next(e))}catch(e){a(e)}}function s(e){try{o(i.throw(e))}catch(e){a(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(n,s)}o((i=i.apply(e,t||[])).next())}))}!function(e){e[e.Big=19789]="Big",e[e.Little=18761]="Little"}(e||(e={})),function(e){e[e.ReducedImage=1]="ReducedImage",e[e.Page=2]="Page",e[e.Mask=4]="Mask"}(t||(t={})),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"}(A||(A={})),function(e){e[e.PixelIsArea=1]="PixelIsArea",e[e.PixelIsPoint=2]="PixelIsPoint"}(i||(i={})),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"}(r||(r={})),function(e){e[e.Image=1]="Image",e[e.ReducedImage=2]="ReducedImage",e[e.Page=3]="Page"}(a||(a={})),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"}(n||(n={})),function(e){e[e.Contig=1]="Contig",e[e.Separate=2]="Separate"}(s||(s={})),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"}(o||(o={})),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"}(l||(l={})),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"}(h||(h={})),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"}(f||(f={})),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"}(c||(c={}));const p={[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 y;!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"}(y||(y={}));const _={[n.None]:y.None,[n.Lzw]:y.Lzw,[n.Jpeg6]:y.Jpeg,[n.Jpeg]:y.Jpeg,[n.DeflateOther]:y.Deflate,[n.Deflate]:y.Deflate,[n.Lerc]:y.Lerc,[n.Lzma]:y.Lzma,[n.Jp2000]:y.Jp2000,[n.Zstd]:y.Zstd,[n.Webp]:y.Webp,[n.JpegXl]:y.JpegXl};var b,D,k,v;function S(e){switch(e){case b.Uint8:case b.Ascii:case b.Int8:case b.Undefined:return 1;case b.Uint16:case b.Int16:return 2;case b.Uint32:case b.Int32:case b.Float32:return 4;case b.Rational:case b.SignedRational:case b.Float64:case b.Uint64:case b.Int64:case b.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"}(b||(b={})),function(e){e[e.BigTiff=43]="BigTiff",e[e.Tiff=42]="Tiff"}(D||(D={})),function(e){e[e.Double=8]="Double",e[e.Float32=4]="Float32"}(k||(k={})),function(e){e[e.UInt64=8]="UInt64",e[e.UInt32=4]="UInt32",e[e.UInt16=2]="UInt16",e[e.UInt8=1]="UInt8"}(v||(v={}));const x=2**32;function G(e,t,A){const i=e.getUint32(t,A),r=e.getUint32(t+4,A),a=A?i+x*r:x*i+r;if(!Number.isSafeInteger(a))throw new Error(a+" exceeds MAX_SAFE_INTEGER. Precision may is lost");return a}function U(e,t,A,i){switch(A){case v.UInt8:return e.getUint8(t);case v.UInt16:return e.getUint16(t,i);case v.UInt32:return e.getUint32(t,i);case v.UInt64:return G(e,t,i)}}function F(e,t,A){return!(t<e.sourceOffset)&&!(e.sourceOffset+e.byteLength<t+A)}function R(e,t,A,i){switch(e){case b.Ascii:return String.fromCharCode(t.getUint8(A));case b.Undefined:case b.Uint8:return t.getUint8(A);case b.Int8:return t.getInt8(A);case b.Uint16:return t.getUint16(A,i);case b.Int16:return t.getInt16(A,i);case b.Uint32:return t.getUint32(A,i);case b.Int32:return t.getInt32(A,i);case b.Rational:return[t.getUint32(A,i),t.getUint32(A+4,i)];case b.SignedRational:return[t.getInt32(A,i),t.getInt32(A+4,i)];case b.Float64:return t.getFloat64(A,i);case b.Float32:return t.getFloat32(A,i);case b.Uint64:return G(t,A,i);default:throw new Error(`Unknown read type "${e}" "${b[e]}"`)}}function L(e,t,A,i,r,a){const n=S(r),s=a*n;if(1===a){const a=R(r,A,i,e.isLittleEndian);return t&&p[t]?[a]:a}if(r===b.Ascii)return String.fromCharCode.apply(null,new Uint8Array(A.buffer,i,s-1));const o=[];for(let t=0;t<s;t+=n)o.push(R(r,A,i+t,e.isLittleEndian));return o}function M(e,t,A){const i=t.getUint16(A+0,e.isLittleEndian),r=t.getUint16(A+2,e.isLittleEndian),a=U(t,A+4,e.ifdConfig.pointer,e.isLittleEndian),n=S(r)*a;if(n<=e.ifdConfig.pointer){const n=L(e,i,t,A+4+e.ifdConfig.pointer,r,a);return{type:"inline",id:i,name:g[i],count:a,value:n,dataType:r,tagOffset:A}}const s=U(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:a,dataType:r,dataOffset:s,isLoaded:!1,value:[],tagOffset:A};return i===g.TileOffsets&&F(t,s,n)&&function(e,t){const A=S(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(F(t,s,n)){const n=L(e,i,t,s-t.sourceOffset,r,a);return{type:"inline",id:i,name:g[i],count:a,value:n,dataType:r,tagOffset:A}}return{type:"lazy",id:i,name:g[i],count:a,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 T{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=S(e.dataType)*e.count,i=await t.source.fetch(e.dataOffset,A),r=new DataView(i);return e.value=L(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=S(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=L(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 a=this.tags.get(i);if(null==a||null==a.value)continue;const n=t[e+2];if("string"==typeof a.value)this.tagsGeo.set(A,a.value.slice(r,r+n-1).trim());else{if(!Array.isArray(a.value))throw new Error("Failed to extract GeoTiffTags");1===n?this.tagsGeo.set(A,a.value[r]):this.tagsGeo.set(A,a.value.slice(r,r+n))}}}get origin(){const e=this.value(g.ModelTiePoint);if(null!=e&&6===e.length)return[e[3],e[4],e[5]];const A=this.value(g.ModelTransformation);if(null!=A)return[A[3],A[7],A[11]];if(this.value(g.SubFileType)===t.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,a=this.size;return[t*r.width/a.width,A*r.height/a.height,i]}throw new Error("Image does not have a geo transformation.")}get isSubImage(){return this.value(g.SubFileType)===t.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],a=i+A[0]*e.width,n=r+A[1]*e.height;return[Math.min(i,a),Math.min(r,n),Math.max(i,a),Math.max(r,n)]}get compression(){const e=this.value(g.Compression);return null==e?null:_[e]}get epsg(){const e=this.valueGeo(h.ProjectionGeoKey);if(null!=e&&32767!==e)return e;let t=null;switch(this.valueGeo(h.GTModelTypeGeoKey)){case r.Unknown:return null;case r.Projected:t=this.valueGeo(h.ProjectedCRSGeoKey);break;case r.Geographic:case r.Geocentric:t=this.valueGeo(h.GeodeticCRSGeoKey);break;case r.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,a=e*i.width;return{x:a,y:r,width:a+i.width>=A.width?A.width-a: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([N(this.tiff,A,e),N(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=n.None);const r=(null==(a=i)?null:_[a])??y.None;var a;return i===n.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),a=Math.ceil(A.width/i.width);if(e>=a||t>=r)throw new Error(`Tile index is outside of range x:${e} >= ${a} or y:${t} >= ${r}`);const n=t*a+e,s=a*r;if(n>=s)throw new Error(`Tile index is outside of tile range: ${n} >= ${s}`);const{offset:o,imageSize:l}=await this.getTileSize(n);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),a=Math.ceil(i.width/A.width);if(e>=a||t>=r)return!1;const n=t*a+e;return(await this.getTileSize(n)).offset>0}async getTileSize(e){const t=this.tiff.options?.tileLeaderByteSize;if(t){const A=await N(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:U(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([N(this.tiff,this.tileOffset,e),N(this.tiff,A,e)]);return{offset:i,imageSize:r}}}function N(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=S(t.dataType);if(null==t.view){const r=await e.source.fetch(t.dataOffset+A*i,i),a=L(e,void 0,new DataView(r),0,t.dataType,1);return t.value[A]=a,a}const r=L(e,void 0,t.view,A*i,t.dataType,1);return t.value[A]=r,r}(e,t,A)}var O,P,z;!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"}(O||(O={})),function(e){e.RowMajor="ROW_MAJOR"}(P||(P={})),function(e){e.uint32="SIZE_AS_UINT4"}(z||(z={}));class K{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(O.Layout)}get isBroken(){return"YES"===this.options.get(O.KnownIncompatibleEdition)}process(e,t,A){let i="",r="",a=!1;for(let n=0;n<A;n++){const A=e.getUint8(t+n);if(0===A)break;const s=String.fromCharCode(A);"\n"===s?(this.options.set(i.trim(),r.trim()),i="",r="",a=!1):"="===s?a=!0:a?r+=s:i+=s}}get tileLeaderByteSize(){return this.options.get(O.BlockLeader)===z.uint32?v.UInt32:null}get isMaskInterleaved(){return"YES"===this.options.get(O.MaskInterleavedWithImagery)}}const q={version:D.Tiff,pointer:v.UInt32,offset:v.UInt16,ifd:v.UInt16+v.UInt16+2*v.UInt32},J={version:D.BigTiff,pointer:v.UInt64,offset:v.UInt64,ifd:v.UInt16+v.UInt16+2*v.UInt64};D.BigTiff,D.Tiff;class H{constructor(e){Object.defineProperty(this,"defaultReadSize",{enumerable:!0,configurable:!0,writable:!0,value:H.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:D.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:q}),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 H(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 t=new DataView(await this.source.fetch(0,Y(this.source,0,this.defaultReadSize)));t.sourceOffset=0;let A=0;const i=t.getUint16(A,this.isLittleEndian);if(A+=2,this.isLittleEndian=i===e.Little,!this.isLittleEndian)throw new Error("Only little endian is supported");let r;if(this.version=t.getUint16(A,this.isLittleEndian),A+=2,this.version===D.BigTiff){this.ifdConfig=J;const e=t.getUint16(A,this.isLittleEndian);if(A+=2,8!==e)throw new Error("Only 8byte pointers are supported");const i=t.getUint16(A,this.isLittleEndian);if(A+=2,0!==i)throw new Error("Invalid big tiff header");r=U(t,A,this.ifdConfig.pointer,this.isLittleEndian),A+=this.ifdConfig.pointer}else{if(this.version!==D.Tiff)throw new Error(`Only tiff supported version:${this.version}`);r=U(t,A,this.ifdConfig.pointer,this.isLittleEndian),A+=this.ifdConfig.pointer}const a=r-A;for(a>0&&a<16384&&(this.options=new K,this.options.process(t,A,a));0!==r;){let e=t;if(!F(e,r,1024)){const t=await this.source.fetch(r,Y(this.source,r,this.defaultReadSize));e=new DataView(t),e.sourceOffset=r}r=await this.readIfd(r,e)}return await Promise.all(this.images.map((e=>e.init()))),this.isInitialized=!0,this}async readIfd(e,t){const A=e-t.sourceOffset,i=U(t,A,this.ifdConfig.offset,this.isLittleEndian),r=new Map;if(!F(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 a=this.ifdConfig.ifd,n=A+this.ifdConfig.offset;for(let e=0;e<i;e++){const A=M(this,t,n+e*a);r.set(A.id,A)}return this.images.push(new T(this,this.images.length,r)),U(t,n+i*a,this.ifdConfig.pointer,this.isLittleEndian)}}function Y(e,t,A){if(null==e.metadata?.size)return A;const i=e.metadata.size;return t+A>i?i-t:A}Object.defineProperty(H,"DefaultReadSize",{enumerable:!0,configurable:!0,writable:!0,value:16384});class V 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 V||"object"==typeof e&&(null!=e&&("_sourceError"in e&&"SourceError"===e._sourceError))}}const Z={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 j(e){const t={size:-1},A=e.headers.get("content-range");return null!=A&&(t.size=Z.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 X{constructor(e,t){this.type="http",this.url="string"==typeof e?X.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=X.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=j(e),this.metadata}))),this._head}async fetch(e,t){try{const A={range:Z.toRange(e,t),...this.headers},i=await X.fetch(this.url,{headers:A});if(!i.ok)throw new V(`Failed to fetch ${this.url} ${A.range}`,i.status,this,new Error(i.statusText));const r=j(i);if(null==this.metadata)this.metadata=r;else if(this.metadata.eTag&&this.metadata.eTag!==r.eTag)throw new V(`ETag conflict ${this.url} ${A.range} expected: ${this.metadata.eTag} got: ${r.eTag}`,409,this);return i.arrayBuffer()}catch(e){if(V.is(e)&&e.source===this)throw e;throw new V(`Failed to fetch: ${this.url}`,500,this,e)}}}X.fetch=(e,t)=>fetch(e,t)
|
|
2
|
-
/*! pako 2.1.0 https://github.com/nodeca/pako @license (MIT AND Zlib) */;function W(e){let t=e.length;for(;--t>=0;)e[t]=0}const $=256,ee=286,te=30,Ae=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]),re=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]),ae=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),ne=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),se=new Array(576);W(se);const oe=new Array(60);W(oe);const le=new Array(512);W(le);const ge=new Array(256);W(ge);const he=new Array(29);W(he);const fe=new Array(te);function ce(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,Ie,ue;function Be(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}W(fe);const Ce=e=>e<256?le[e]:le[256+(e>>>7)],Ee=(e,t)=>{e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255},we=(e,t,A)=>{e.bi_valid>16-A?(e.bi_buf|=t<<e.bi_valid&65535,Ee(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)},Qe=(e,t,A)=>{we(e,A[2*t],A[2*t+1])},me=(e,t)=>{let A=0;do{A|=1&e,e>>>=1,A<<=1}while(--t>0);return A>>>1},pe=(e,t,A)=>{const i=new Array(16);let r,a,n=0;for(r=1;r<=Ae;r++)n=n+A[r-1]<<1,i[r]=n;for(a=0;a<=t;a++){let t=e[2*a+1];0!==t&&(e[2*a]=me(i[t]++,t))}},ye=e=>{let t;for(t=0;t<ee;t++)e.dyn_ltree[2*t]=0;for(t=0;t<te;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},_e=e=>{e.bi_valid>8?Ee(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0},be=(e,t,A,i)=>{const r=2*t,a=2*A;return e[r]<e[a]||e[r]===e[a]&&i[t]<=i[A]},De=(e,t,A)=>{const i=e.heap[A];let r=A<<1;for(;r<=e.heap_len&&(r<e.heap_len&&be(t,e.heap[r+1],e.heap[r],e.depth)&&r++,!be(t,i,e.heap[r],e.depth));)e.heap[A]=e.heap[r],A=r,r<<=1;e.heap[A]=i},ke=(e,t,A)=>{let i,r,a,n,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?Qe(e,r,t):(a=ge[r],Qe(e,a+$+1,t),n=ie[a],0!==n&&(r-=he[a],we(e,r,n)),i--,a=Ce(i),Qe(e,a,A),n=re[a],0!==n&&(i-=fe[a],we(e,i,n)))}while(s<e.sym_next);Qe(e,256,t)},ve=(e,t)=>{const A=t.dyn_tree,i=t.stat_desc.static_tree,r=t.stat_desc.has_stree,a=t.stat_desc.elems;let n,s,o,l=-1;for(e.heap_len=0,e.heap_max=573,n=0;n<a;n++)0!==A[2*n]?(e.heap[++e.heap_len]=l=n,e.depth[n]=0):A[2*n+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,n=e.heap_len>>1;n>=1;n--)De(e,A,n);o=a;do{n=e.heap[1],e.heap[1]=e.heap[e.heap_len--],De(e,A,1),s=e.heap[1],e.heap[--e.heap_max]=n,e.heap[--e.heap_max]=s,A[2*o]=A[2*n]+A[2*s],e.depth[o]=(e.depth[n]>=e.depth[s]?e.depth[n]:e.depth[s])+1,A[2*n+1]=A[2*s+1]=o,e.heap[1]=o++,De(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,a=t.stat_desc.has_stree,n=t.stat_desc.extra_bits,s=t.stat_desc.extra_base,o=t.stat_desc.max_length;let l,g,h,f,c,d,I=0;for(f=0;f<=Ae;f++)e.bl_count[f]=0;for(A[2*e.heap[e.heap_max]+1]=0,l=e.heap_max+1;l<573;l++)g=e.heap[l],f=A[2*A[2*g+1]+1]+1,f>o&&(f=o,I++),A[2*g+1]=f,g>i||(e.bl_count[f]++,c=0,g>=s&&(c=n[g-s]),d=A[2*g],e.opt_len+=d*(f+c),a&&(e.static_len+=d*(r[2*g+1]+c)));if(0!==I){do{for(f=o-1;0===e.bl_count[f];)f--;e.bl_count[f]--,e.bl_count[f+1]+=2,e.bl_count[o]--,I-=2}while(I>0);for(f=o;0!==f;f--)for(g=e.bl_count[f];0!==g;)h=e.heap[--l],h>i||(A[2*h+1]!==f&&(e.opt_len+=(f-A[2*h+1])*A[2*h],A[2*h+1]=f),g--)}})(e,t),pe(A,l,e.bl_count)},Se=(e,t,A)=>{let i,r,a=-1,n=t[1],s=0,o=7,l=4;for(0===n&&(o=138,l=3),t[2*(A+1)+1]=65535,i=0;i<=A;i++)r=n,n=t[2*(i+1)+1],++s<o&&r===n||(s<l?e.bl_tree[2*r]+=s:0!==r?(r!==a&&e.bl_tree[2*r]++,e.bl_tree[32]++):s<=10?e.bl_tree[34]++:e.bl_tree[36]++,s=0,a=r,0===n?(o=138,l=3):r===n?(o=6,l=3):(o=7,l=4))},xe=(e,t,A)=>{let i,r,a=-1,n=t[1],s=0,o=7,l=4;for(0===n&&(o=138,l=3),i=0;i<=A;i++)if(r=n,n=t[2*(i+1)+1],!(++s<o&&r===n)){if(s<l)do{Qe(e,r,e.bl_tree)}while(0!=--s);else 0!==r?(r!==a&&(Qe(e,r,e.bl_tree),s--),Qe(e,16,e.bl_tree),we(e,s-3,2)):s<=10?(Qe(e,17,e.bl_tree),we(e,s-3,3)):(Qe(e,18,e.bl_tree),we(e,s-11,7));s=0,a=r,0===n?(o=138,l=3):r===n?(o=6,l=3):(o=7,l=4)}};let Ge=!1;const Ue=(e,t,A,i)=>{we(e,0+(i?1:0),3),_e(e),Ee(e,A),Ee(e,~A),A&&e.pending_buf.set(e.window.subarray(t,t+A),e.pending),e.pending+=A};var Fe=(e,t,A,i)=>{let r,a,n=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<$;t++)if(0!==e.dyn_ltree[2*t])return 1;return 0})(e)),ve(e,e.l_desc),ve(e,e.d_desc),n=(e=>{let t;for(Se(e,e.dyn_ltree,e.l_desc.max_code),Se(e,e.dyn_dtree,e.d_desc.max_code),ve(e,e.bl_desc),t=18;t>=3&&0===e.bl_tree[2*ne[t]+1];t--);return e.opt_len+=3*(t+1)+5+5+4,t})(e),r=e.opt_len+3+7>>>3,a=e.static_len+3+7>>>3,a<=r&&(r=a)):r=a=A+5,A+4<=r&&-1!==t?Ue(e,t,A,i):4===e.strategy||a===r?(we(e,2+(i?1:0),3),ke(e,se,oe)):(we(e,4+(i?1:0),3),((e,t,A,i)=>{let r;for(we(e,t-257,5),we(e,A-1,5),we(e,i-4,4),r=0;r<i;r++)we(e,e.bl_tree[2*ne[r]+1],3);xe(e,e.dyn_ltree,t-1),xe(e,e.dyn_dtree,A-1)})(e,e.l_desc.max_code+1,e.d_desc.max_code+1,n+1),ke(e,e.dyn_ltree,e.dyn_dtree)),ye(e),i&&_e(e)},Re={_tr_init:e=>{Ge||((()=>{let e,t,A,i,r;const a=new Array(16);for(A=0,i=0;i<28;i++)for(he[i]=A,e=0;e<1<<ie[i];e++)ge[A++]=i;for(ge[A-1]=i,r=0,i=0;i<16;i++)for(fe[i]=r,e=0;e<1<<re[i];e++)le[r++]=i;for(r>>=7;i<te;i++)for(fe[i]=r<<7,e=0;e<1<<re[i]-7;e++)le[256+r++]=i;for(t=0;t<=Ae;t++)a[t]=0;for(e=0;e<=143;)se[2*e+1]=8,e++,a[8]++;for(;e<=255;)se[2*e+1]=9,e++,a[9]++;for(;e<=279;)se[2*e+1]=7,e++,a[7]++;for(;e<=287;)se[2*e+1]=8,e++,a[8]++;for(pe(se,287,a),e=0;e<te;e++)oe[2*e+1]=5,oe[2*e]=me(e,5);de=new ce(se,ie,257,ee,Ae),Ie=new ce(oe,re,0,te,Ae),ue=new ce(new Array(0),ae,0,19,7)})(),Ge=!0),e.l_desc=new Be(e.dyn_ltree,de),e.d_desc=new Be(e.dyn_dtree,Ie),e.bl_desc=new Be(e.bl_tree,ue),e.bi_buf=0,e.bi_valid=0,ye(e)},_tr_stored_block:Ue,_tr_flush_block:Fe,_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*(ge[A]+$+1)]++,e.dyn_dtree[2*Ce(t)]++),e.sym_next===e.sym_end),_tr_align:e=>{we(e,2,3),Qe(e,256,se),(e=>{16===e.bi_valid?(Ee(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 Le=(e,t,A,i)=>{let r=65535&e|0,a=e>>>16&65535|0,n=0;for(;0!==A;){n=A>2e3?2e3:A,A-=n;do{r=r+t[i++]|0,a=a+r|0}while(--n);r%=65521,a%=65521}return r|a<<16|0};const Me=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 Te=(e,t,A,i)=>{const r=Me,a=i+A;e^=-1;for(let A=i;A<a;A++)e=e>>>8^r[255&(e^t[A])];return-1^e},Ne={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"},Oe={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:Pe,_tr_stored_block:ze,_tr_flush_block:Ke,_tr_tally:qe,_tr_align:Je}=Re,{Z_NO_FLUSH:He,Z_PARTIAL_FLUSH:Ye,Z_FULL_FLUSH:Ve,Z_FINISH:Ze,Z_BLOCK:je,Z_OK:Xe,Z_STREAM_END:We,Z_STREAM_ERROR:$e,Z_DATA_ERROR:et,Z_BUF_ERROR:tt,Z_DEFAULT_COMPRESSION:At,Z_FILTERED:it,Z_HUFFMAN_ONLY:rt,Z_RLE:at,Z_FIXED:nt,Z_DEFAULT_STRATEGY:st,Z_UNKNOWN:ot,Z_DEFLATED:lt}=Oe,gt=258,ht=262,ft=42,ct=113,dt=666,It=(e,t)=>(e.msg=Ne[t],t),ut=e=>2*e-(e>4?9:0),Bt=e=>{let t=e.length;for(;--t>=0;)e[t]=0},Ct=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 Et=(e,t,A)=>(t<<e.hash_shift^A)&e.hash_mask;const wt=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))},Qt=(e,t)=>{Ke(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,wt(e.strm)},mt=(e,t)=>{e.pending_buf[e.pending++]=t},pt=(e,t)=>{e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t},yt=(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=Le(e.adler,t,r,A):2===e.state.wrap&&(e.adler=Te(e.adler,t,r,A)),e.next_in+=r,e.total_in+=r,r)},_t=(e,t)=>{let A,i,r=e.max_chain_length,a=e.strstart,n=e.prev_length,s=e.nice_match;const o=e.strstart>e.w_size-ht?e.strstart-(e.w_size-ht):0,l=e.window,g=e.w_mask,h=e.prev,f=e.strstart+gt;let c=l[a+n-1],d=l[a+n];e.prev_length>=e.good_match&&(r>>=2),s>e.lookahead&&(s=e.lookahead);do{if(A=t,l[A+n]===d&&l[A+n-1]===c&&l[A]===l[a]&&l[++A]===l[a+1]){a+=2,A++;do{}while(l[++a]===l[++A]&&l[++a]===l[++A]&&l[++a]===l[++A]&&l[++a]===l[++A]&&l[++a]===l[++A]&&l[++a]===l[++A]&&l[++a]===l[++A]&&l[++a]===l[++A]&&a<f);if(i=gt-(f-a),a=f-gt,i>n){if(e.match_start=t,n=i,i>=s)break;c=l[a+n-1],d=l[a+n]}}}while((t=h[t&g])>o&&0!=--r);return n<=e.lookahead?n:e.lookahead},bt=e=>{const t=e.w_size;let A,i,r;do{if(i=e.window_size-e.lookahead-e.strstart,e.strstart>=t+(t-ht)&&(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),Ct(e),i+=t),0===e.strm.avail_in)break;if(A=yt(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=Et(e,e.ins_h,e.window[r+1]);e.insert&&(e.ins_h=Et(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<ht&&0!==e.strm.avail_in)},Dt=(e,t)=>{let A,i,r,a=e.pending_buf_size-5>e.w_size?e.w_size:e.pending_buf_size-5,n=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<a&&(0===A&&t!==Ze||t===He||A!==i+e.strm.avail_in))break;n=t===Ze&&A===i+e.strm.avail_in?1:0,ze(e,0,0,n),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,wt(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&&(yt(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===n);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),n?4:t!==He&&t!==Ze&&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&&(yt(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,a=r>e.w_size?e.w_size:r,i=e.strstart-e.block_start,(i>=a||(i||t===Ze)&&t!==He&&0===e.strm.avail_in&&i<=r)&&(A=i>r?r:i,n=t===Ze&&0===e.strm.avail_in&&A===i?1:0,ze(e,e.block_start,A,n),e.block_start+=A,wt(e.strm)),n?3:1)},kt=(e,t)=>{let A,i;for(;;){if(e.lookahead<ht){if(bt(e),e.lookahead<ht&&t===He)return 1;if(0===e.lookahead)break}if(A=0,e.lookahead>=3&&(e.ins_h=Et(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-ht&&(e.match_length=_t(e,A)),e.match_length>=3)if(i=qe(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=Et(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=Et(e,e.ins_h,e.window[e.strstart+1]);else i=qe(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(i&&(Qt(e,!1),0===e.strm.avail_out))return 1}return e.insert=e.strstart<2?e.strstart:2,t===Ze?(Qt(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(Qt(e,!1),0===e.strm.avail_out)?1:2},vt=(e,t)=>{let A,i,r;for(;;){if(e.lookahead<ht){if(bt(e),e.lookahead<ht&&t===He)return 1;if(0===e.lookahead)break}if(A=0,e.lookahead>=3&&(e.ins_h=Et(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-ht&&(e.match_length=_t(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=qe(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=Et(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&&(Qt(e,!1),0===e.strm.avail_out))return 1}else if(e.match_available){if(i=qe(e,0,e.window[e.strstart-1]),i&&Qt(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=qe(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<2?e.strstart:2,t===Ze?(Qt(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(Qt(e,!1),0===e.strm.avail_out)?1:2};function St(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 xt=[new St(0,0,0,0,Dt),new St(4,4,8,4,kt),new St(4,5,16,8,kt),new St(4,6,32,32,kt),new St(4,4,16,16,vt),new St(8,16,32,32,vt),new St(8,16,128,128,vt),new St(8,32,128,256,vt),new St(32,128,258,1024,vt),new St(32,258,258,4096,vt)];function Gt(){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=lt,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),Bt(this.dyn_ltree),Bt(this.dyn_dtree),Bt(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),Bt(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(573),Bt(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 Ut=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||t.status!==ft&&57!==t.status&&69!==t.status&&73!==t.status&&91!==t.status&&103!==t.status&&t.status!==ct&&t.status!==dt?1:0},Ft=e=>{if(Ut(e))return It(e,$e);e.total_in=e.total_out=0,e.data_type=ot;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?ft:ct,e.adler=2===t.wrap?0:1,t.last_flush=-2,Pe(t),Xe},Rt=e=>{const t=Ft(e);var A;return t===Xe&&((A=e.state).window_size=2*A.w_size,Bt(A.head),A.max_lazy_match=xt[A.level].max_lazy,A.good_match=xt[A.level].good_length,A.nice_match=xt[A.level].nice_length,A.max_chain_length=xt[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},Lt=(e,t,A,i,r,a)=>{if(!e)return $e;let n=1;if(t===At&&(t=6),i<0?(n=0,i=-i):i>15&&(n=2,i-=16),r<1||r>9||A!==lt||i<8||i>15||t<0||t>9||a<0||a>nt||8===i&&1!==n)return It(e,$e);8===i&&(i=9);const s=new Gt;return e.state=s,s.strm=e,s.status=ft,s.wrap=n,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=a,s.method=A,Rt(e)};var Mt={deflateInit:(e,t)=>Lt(e,t,lt,15,8,st),deflateInit2:Lt,deflateReset:Rt,deflateResetKeep:Ft,deflateSetHeader:(e,t)=>Ut(e)||2!==e.state.wrap?$e:(e.state.gzhead=t,Xe),deflate:(e,t)=>{if(Ut(e)||t>je||t<0)return e?It(e,$e):$e;const A=e.state;if(!e.output||0!==e.avail_in&&!e.input||A.status===dt&&t!==Ze)return It(e,0===e.avail_out?tt:$e);const i=A.last_flush;if(A.last_flush=t,0!==A.pending){if(wt(e),0===e.avail_out)return A.last_flush=-1,Xe}else if(0===e.avail_in&&ut(t)<=ut(i)&&t!==Ze)return It(e,tt);if(A.status===dt&&0!==e.avail_in)return It(e,tt);if(A.status===ft&&0===A.wrap&&(A.status=ct),A.status===ft){let t=lt+(A.w_bits-8<<4)<<8,i=-1;if(i=A.strategy>=rt||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,pt(A,t),0!==A.strstart&&(pt(A,e.adler>>>16),pt(A,65535&e.adler)),e.adler=1,A.status=ct,wt(e),0!==A.pending)return A.last_flush=-1,Xe}if(57===A.status)if(e.adler=0,mt(A,31),mt(A,139),mt(A,8),A.gzhead)mt(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)),mt(A,255&A.gzhead.time),mt(A,A.gzhead.time>>8&255),mt(A,A.gzhead.time>>16&255),mt(A,A.gzhead.time>>24&255),mt(A,9===A.level?2:A.strategy>=rt||A.level<2?4:0),mt(A,255&A.gzhead.os),A.gzhead.extra&&A.gzhead.extra.length&&(mt(A,255&A.gzhead.extra.length),mt(A,A.gzhead.extra.length>>8&255)),A.gzhead.hcrc&&(e.adler=Te(e.adler,A.pending_buf,A.pending,0)),A.gzindex=0,A.status=69;else if(mt(A,0),mt(A,0),mt(A,0),mt(A,0),mt(A,0),mt(A,9===A.level?2:A.strategy>=rt||A.level<2?4:0),mt(A,3),A.status=ct,wt(e),0!==A.pending)return A.last_flush=-1,Xe;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=Te(e.adler,A.pending_buf,A.pending-t,t)),A.gzindex+=r,wt(e),0!==A.pending)return A.last_flush=-1,Xe;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=Te(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=Te(e.adler,A.pending_buf,A.pending-i,i)),wt(e),0!==A.pending)return A.last_flush=-1,Xe;i=0}t=A.gzindex<A.gzhead.name.length?255&A.gzhead.name.charCodeAt(A.gzindex++):0,mt(A,t)}while(0!==t);A.gzhead.hcrc&&A.pending>i&&(e.adler=Te(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=Te(e.adler,A.pending_buf,A.pending-i,i)),wt(e),0!==A.pending)return A.last_flush=-1,Xe;i=0}t=A.gzindex<A.gzhead.comment.length?255&A.gzhead.comment.charCodeAt(A.gzindex++):0,mt(A,t)}while(0!==t);A.gzhead.hcrc&&A.pending>i&&(e.adler=Te(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&&(wt(e),0!==A.pending))return A.last_flush=-1,Xe;mt(A,255&e.adler),mt(A,e.adler>>8&255),e.adler=0}if(A.status=ct,wt(e),0!==A.pending)return A.last_flush=-1,Xe}if(0!==e.avail_in||0!==A.lookahead||t!==He&&A.status!==dt){let i=0===A.level?Dt(A,t):A.strategy===rt?((e,t)=>{let A;for(;;){if(0===e.lookahead&&(bt(e),0===e.lookahead)){if(t===He)return 1;break}if(e.match_length=0,A=qe(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,A&&(Qt(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,t===Ze?(Qt(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(Qt(e,!1),0===e.strm.avail_out)?1:2})(A,t):A.strategy===at?((e,t)=>{let A,i,r,a;const n=e.window;for(;;){if(e.lookahead<=gt){if(bt(e),e.lookahead<=gt&&t===He)return 1;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=3&&e.strstart>0&&(r=e.strstart-1,i=n[r],i===n[++r]&&i===n[++r]&&i===n[++r])){a=e.strstart+gt;do{}while(i===n[++r]&&i===n[++r]&&i===n[++r]&&i===n[++r]&&i===n[++r]&&i===n[++r]&&i===n[++r]&&i===n[++r]&&r<a);e.match_length=gt-(a-r),e.match_length>e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=3?(A=qe(e,1,e.match_length-3),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(A=qe(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),A&&(Qt(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,t===Ze?(Qt(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(Qt(e,!1),0===e.strm.avail_out)?1:2})(A,t):xt[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),Xe;if(2===i&&(t===Ye?Je(A):t!==je&&(ze(A,0,0,!1),t===Ve&&(Bt(A.head),0===A.lookahead&&(A.strstart=0,A.block_start=0,A.insert=0))),wt(e),0===e.avail_out))return A.last_flush=-1,Xe}return t!==Ze?Xe:A.wrap<=0?We:(2===A.wrap?(mt(A,255&e.adler),mt(A,e.adler>>8&255),mt(A,e.adler>>16&255),mt(A,e.adler>>24&255),mt(A,255&e.total_in),mt(A,e.total_in>>8&255),mt(A,e.total_in>>16&255),mt(A,e.total_in>>24&255)):(pt(A,e.adler>>>16),pt(A,65535&e.adler)),wt(e),A.wrap>0&&(A.wrap=-A.wrap),0!==A.pending?Xe:We)},deflateEnd:e=>{if(Ut(e))return $e;const t=e.state.status;return e.state=null,t===ct?It(e,et):Xe},deflateSetDictionary:(e,t)=>{let A=t.length;if(Ut(e))return $e;const i=e.state,r=i.wrap;if(2===r||1===r&&i.status!==ft||i.lookahead)return $e;if(1===r&&(e.adler=Le(e.adler,t,A,0)),i.wrap=0,A>=i.w_size){0===r&&(Bt(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 a=e.avail_in,n=e.next_in,s=e.input;for(e.avail_in=A,e.next_in=0,e.input=t,bt(i);i.lookahead>=3;){let e=i.strstart,t=i.lookahead-2;do{i.ins_h=Et(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,bt(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=n,e.input=s,e.avail_in=a,i.wrap=r,Xe},deflateInfo:"pako deflate (from Nodeca project)"};const Tt=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var Nt={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)Tt(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 Ot=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(e){Ot=!1}const Pt=new Uint8Array(256);for(let e=0;e<256;e++)Pt[e]=e>=252?6:e>=248?5:e>=240?4:e>=224?3:e>=192?2:1;Pt[254]=Pt[254]=1;var zt={string2buf:e=>{if("function"==typeof TextEncoder&&TextEncoder.prototype.encode)return(new TextEncoder).encode(e);let t,A,i,r,a,n=e.length,s=0;for(r=0;r<n;r++)A=e.charCodeAt(r),55296==(64512&A)&&r+1<n&&(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),a=0,r=0;a<s;r++)A=e.charCodeAt(r),55296==(64512&A)&&r+1<n&&(i=e.charCodeAt(r+1),56320==(64512&i)&&(A=65536+(A-55296<<10)+(i-56320),r++)),A<128?t[a++]=A:A<2048?(t[a++]=192|A>>>6,t[a++]=128|63&A):A<65536?(t[a++]=224|A>>>12,t[a++]=128|A>>>6&63,t[a++]=128|63&A):(t[a++]=240|A>>>18,t[a++]=128|A>>>12&63,t[a++]=128|A>>>6&63,t[a++]=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 a=new Array(2*A);for(r=0,i=0;i<A;){let t=e[i++];if(t<128){a[r++]=t;continue}let n=Pt[t];if(n>4)a[r++]=65533,i+=n-1;else{for(t&=2===n?31:3===n?15:7;n>1&&i<A;)t=t<<6|63&e[i++],n--;n>1?a[r++]=65533:t<65536?a[r++]=t:(t-=65536,a[r++]=55296|t>>10&1023,a[r++]=56320|1023&t)}}return((e,t)=>{if(t<65534&&e.subarray&&Ot)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})(a,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+Pt[e[A]]>t?A:t}};var Kt=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 qt=Object.prototype.toString,{Z_NO_FLUSH:Jt,Z_SYNC_FLUSH:Ht,Z_FULL_FLUSH:Yt,Z_FINISH:Vt,Z_OK:Zt,Z_STREAM_END:jt,Z_DEFAULT_COMPRESSION:Xt,Z_DEFAULT_STRATEGY:Wt,Z_DEFLATED:$t}=Oe;function eA(e){this.options=Nt.assign({level:Xt,method:$t,chunkSize:16384,windowBits:15,memLevel:8,strategy:Wt},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 Kt,this.strm.avail_out=0;let A=Mt.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(A!==Zt)throw new Error(Ne[A]);if(t.header&&Mt.deflateSetHeader(this.strm,t.header),t.dictionary){let e;if(e="string"==typeof t.dictionary?zt.string2buf(t.dictionary):"[object ArrayBuffer]"===qt.call(t.dictionary)?new Uint8Array(t.dictionary):t.dictionary,A=Mt.deflateSetDictionary(this.strm,e),A!==Zt)throw new Error(Ne[A]);this._dict_set=!0}}eA.prototype.push=function(e,t){const A=this.strm,i=this.options.chunkSize;let r,a;if(this.ended)return!1;for(a=t===~~t?t:!0===t?Vt:Jt,"string"==typeof e?A.input=zt.string2buf(e):"[object ArrayBuffer]"===qt.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),(a===Ht||a===Yt)&&A.avail_out<=6)this.onData(A.output.subarray(0,A.next_out)),A.avail_out=0;else{if(r=Mt.deflate(A,a),r===jt)return A.next_out>0&&this.onData(A.output.subarray(0,A.next_out)),r=Mt.deflateEnd(this.strm),this.onEnd(r),this.ended=!0,r===Zt;if(0!==A.avail_out){if(a>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},eA.prototype.onData=function(e){this.chunks.push(e)},eA.prototype.onEnd=function(e){e===Zt&&(this.result=Nt.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};const tA=16209;var AA=function(e,t){let A,i,r,a,n,s,o,l,g,h,f,c,d,I,u,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,a=r-(t-e.avail_out),n=r+(e.avail_out-257),s=b.dmax,o=b.wsize,l=b.whave,g=b.wnext,h=b.window,f=b.hold,c=b.bits,d=b.lencode,I=b.distcode,u=(1<<b.lenbits)-1,B=(1<<b.distbits)-1;e:do{c<15&&(f+=y[A++]<<c,c+=8,f+=y[A++]<<c,c+=8),C=d[f&u];t:for(;;){if(E=C>>>24,f>>>=E,c-=E,E=C>>>16&255,0===E)_[r++]=65535&C;else{if(!(16&E)){if(0==(64&E)){C=d[(65535&C)+(f&(1<<E)-1)];continue t}if(32&E){b.mode=16191;break e}e.msg="invalid literal/length code",b.mode=tA;break e}w=65535&C,E&=15,E&&(c<E&&(f+=y[A++]<<c,c+=8),w+=f&(1<<E)-1,f>>>=E,c-=E),c<15&&(f+=y[A++]<<c,c+=8,f+=y[A++]<<c,c+=8),C=I[f&B];A:for(;;){if(E=C>>>24,f>>>=E,c-=E,E=C>>>16&255,!(16&E)){if(0==(64&E)){C=I[(65535&C)+(f&(1<<E)-1)];continue A}e.msg="invalid distance code",b.mode=tA;break e}if(Q=65535&C,E&=15,c<E&&(f+=y[A++]<<c,c+=8,c<E&&(f+=y[A++]<<c,c+=8)),Q+=f&(1<<E)-1,Q>s){e.msg="invalid distance too far back",b.mode=tA;break e}if(f>>>=E,c-=E,E=r-a,Q>E){if(E=Q-E,E>l&&b.sane){e.msg="invalid distance too far back",b.mode=tA;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<n);w=c>>3,A-=w,c-=w<<3,f&=(1<<c)-1,e.next_in=A,e.next_out=r,e.avail_in=A<i?i-A+5:5-(A-i),e.avail_out=r<n?n-r+257:257-(r-n),b.hold=f,b.bits=c};const iA=15,rA=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]),aA=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]),nA=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]),sA=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 oA=(e,t,A,i,r,a,n,s)=>{const o=s.bits;let l,g,h,f,c,d,I=0,u=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,S,x=null;for(I=0;I<=iA;I++)b[I]=0;for(u=0;u<i;u++)b[t[A+u]]++;for(E=o,C=iA;C>=1&&0===b[C];C--);if(E>C&&(E=C),0===C)return r[a++]=20971520,r[a++]=20971520,s.bits=1,0;for(B=1;B<C&&0===b[B];B++);for(E<B&&(E=B),m=1,I=1;I<=iA;I++)if(m<<=1,m-=b[I],m<0)return-1;if(m>0&&(0===e||1!==C))return-1;for(D[1]=0,I=1;I<iA;I++)D[I+1]=D[I]+b[I];for(u=0;u<i;u++)0!==t[A+u]&&(n[D[t[A+u]]++]=u);if(0===e?(_=x=n,d=20):1===e?(_=rA,x=aA,d=257):(_=nA,x=sA,d=0),y=0,u=0,I=B,c=a,w=E,Q=0,h=-1,p=1<<E,f=p-1,1===e&&p>852||2===e&&p>592)return 1;for(;;){k=I-Q,n[u]+1<d?(v=0,S=n[u]):n[u]>=d?(v=x[n[u]-d],S=_[n[u]-d]):(v=96,S=0),l=1<<I-Q,g=1<<w,B=g;do{g-=l,r[c+(y>>Q)+g]=k<<24|v<<16|S|0}while(0!==g);for(l=1<<I-1;y&l;)l>>=1;if(0!==l?(y&=l-1,y+=l):y=0,u++,0==--b[I]){if(I===C)break;I=t[A+n[u]]}if(I>E&&(y&f)!==h){for(0===Q&&(Q=E),c+=B,w=I-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&f,r[h]=E<<24|w<<16|c-a|0}}return 0!==y&&(r[c+y]=I-Q<<24|64<<16|0),s.bits=E,0};const{Z_FINISH:lA,Z_BLOCK:gA,Z_TREES:hA,Z_OK:fA,Z_STREAM_END:cA,Z_NEED_DICT:dA,Z_STREAM_ERROR:IA,Z_DATA_ERROR:uA,Z_MEM_ERROR:BA,Z_BUF_ERROR:CA,Z_DEFLATED:EA}=Oe,wA=16180,QA=16190,mA=16191,pA=16192,yA=16194,_A=16199,bA=16200,DA=16206,kA=16209,vA=e=>(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24);function SA(){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 xA=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||t.mode<wA||t.mode>16211?1:0},GA=e=>{if(xA(e))return IA;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=wA,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,fA},UA=e=>{if(xA(e))return IA;const t=e.state;return t.wsize=0,t.whave=0,t.wnext=0,GA(e)},FA=(e,t)=>{let A;if(xA(e))return IA;const i=e.state;return t<0?(A=0,t=-t):(A=5+(t>>4),t<48&&(t&=15)),t&&(t<8||t>15)?IA:(null!==i.window&&i.wbits!==t&&(i.window=null),i.wrap=A,i.wbits=t,UA(e))},RA=(e,t)=>{if(!e)return IA;const A=new SA;e.state=A,A.strm=e,A.window=null,A.mode=wA;const i=FA(e,t);return i!==fA&&(e.state=null),i};let LA,MA,TA=!0;const NA=e=>{if(TA){LA=new Int32Array(512),MA=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(oA(1,e.lens,0,288,LA,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;oA(2,e.lens,0,32,MA,0,e.work,{bits:5}),TA=!1}e.lencode=LA,e.lenbits=9,e.distcode=MA,e.distbits=5},OA=(e,t,A,i)=>{let r;const a=e.state;return null===a.window&&(a.wsize=1<<a.wbits,a.wnext=0,a.whave=0,a.window=new Uint8Array(a.wsize)),i>=a.wsize?(a.window.set(t.subarray(A-a.wsize,A),0),a.wnext=0,a.whave=a.wsize):(r=a.wsize-a.wnext,r>i&&(r=i),a.window.set(t.subarray(A-i,A-i+r),a.wnext),(i-=r)?(a.window.set(t.subarray(A-i,A),0),a.wnext=i,a.whave=a.wsize):(a.wnext+=r,a.wnext===a.wsize&&(a.wnext=0),a.whave<a.wsize&&(a.whave+=r))),0};var PA={inflateReset:UA,inflateReset2:FA,inflateResetKeep:GA,inflateInit:e=>RA(e,15),inflateInit2:RA,inflate:(e,t)=>{let A,i,r,a,n,s,o,l,g,h,f,c,d,I,u,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(xA(e)||!e.output||!e.input&&0!==e.avail_in)return IA;A=e.state,A.mode===mA&&(A.mode=pA),n=e.next_out,r=e.output,o=e.avail_out,a=e.next_in,i=e.input,s=e.avail_in,l=A.hold,g=A.bits,h=s,f=o,p=fA;e:for(;;)switch(A.mode){case wA:if(0===A.wrap){A.mode=pA;break}for(;g<16;){if(0===s)break e;s--,l+=i[a++]<<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=Te(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=kA;break}if((15&l)!==EA){e.msg="unknown compression method",A.mode=kA;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=kA;break}A.dmax=1<<A.wbits,A.flags=0,e.adler=A.check=1,A.mode=512&l?16189:mA,l=0,g=0;break;case 16181:for(;g<16;){if(0===s)break e;s--,l+=i[a++]<<g,g+=8}if(A.flags=l,(255&A.flags)!==EA){e.msg="unknown compression method",A.mode=kA;break}if(57344&A.flags){e.msg="unknown header flags set",A.mode=kA;break}A.head&&(A.head.text=l>>8&1),512&A.flags&&4&A.wrap&&(_[0]=255&l,_[1]=l>>>8&255,A.check=Te(A.check,_,2,0)),l=0,g=0,A.mode=16182;case 16182:for(;g<32;){if(0===s)break e;s--,l+=i[a++]<<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=Te(A.check,_,4,0)),l=0,g=0,A.mode=16183;case 16183:for(;g<16;){if(0===s)break e;s--,l+=i[a++]<<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=Te(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[a++]<<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=Te(A.check,_,2,0)),l=0,g=0}else A.head&&(A.head.extra=null);A.mode=16185;case 16185:if(1024&A.flags&&(c=A.length,c>s&&(c=s),c&&(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(a,a+c),m)),512&A.flags&&4&A.wrap&&(A.check=Te(A.check,i,c,a)),s-=c,a+=c,A.length-=c),A.length))break e;A.length=0,A.mode=16186;case 16186:if(2048&A.flags){if(0===s)break e;c=0;do{m=i[a+c++],A.head&&m&&A.length<65536&&(A.head.name+=String.fromCharCode(m))}while(m&&c<s);if(512&A.flags&&4&A.wrap&&(A.check=Te(A.check,i,c,a)),s-=c,a+=c,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;c=0;do{m=i[a+c++],A.head&&m&&A.length<65536&&(A.head.comment+=String.fromCharCode(m))}while(m&&c<s);if(512&A.flags&&4&A.wrap&&(A.check=Te(A.check,i,c,a)),s-=c,a+=c,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[a++]<<g,g+=8}if(4&A.wrap&&l!==(65535&A.check)){e.msg="header crc mismatch",A.mode=kA;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=mA;break;case 16189:for(;g<32;){if(0===s)break e;s--,l+=i[a++]<<g,g+=8}e.adler=A.check=vA(l),l=0,g=0,A.mode=QA;case QA:if(0===A.havedict)return e.next_out=n,e.avail_out=o,e.next_in=a,e.avail_in=s,A.hold=l,A.bits=g,dA;e.adler=A.check=1,A.mode=mA;case mA:if(t===gA||t===hA)break e;case pA:if(A.last){l>>>=7&g,g-=7&g,A.mode=DA;break}for(;g<3;){if(0===s)break e;s--,l+=i[a++]<<g,g+=8}switch(A.last=1&l,l>>>=1,g-=1,3&l){case 0:A.mode=16193;break;case 1:if(NA(A),A.mode=_A,t===hA){l>>>=2,g-=2;break e}break;case 2:A.mode=16196;break;case 3:e.msg="invalid block type",A.mode=kA}l>>>=2,g-=2;break;case 16193:for(l>>>=7&g,g-=7&g;g<32;){if(0===s)break e;s--,l+=i[a++]<<g,g+=8}if((65535&l)!=(l>>>16^65535)){e.msg="invalid stored block lengths",A.mode=kA;break}if(A.length=65535&l,l=0,g=0,A.mode=yA,t===hA)break e;case yA:A.mode=16195;case 16195:if(c=A.length,c){if(c>s&&(c=s),c>o&&(c=o),0===c)break e;r.set(i.subarray(a,a+c),n),s-=c,a+=c,o-=c,n+=c,A.length-=c;break}A.mode=mA;break;case 16196:for(;g<14;){if(0===s)break e;s--,l+=i[a++]<<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=kA;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[a++]<<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=oA(0,A.lens,0,19,A.lencode,0,A.work,b),A.lenbits=b.bits,p){e.msg="invalid code lengths set",A.mode=kA;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],u=y>>>24,B=y>>>16&255,C=65535&y,!(u<=g);){if(0===s)break e;s--,l+=i[a++]<<g,g+=8}if(C<16)l>>>=u,g-=u,A.lens[A.have++]=C;else{if(16===C){for(D=u+2;g<D;){if(0===s)break e;s--,l+=i[a++]<<g,g+=8}if(l>>>=u,g-=u,0===A.have){e.msg="invalid bit length repeat",A.mode=kA;break}m=A.lens[A.have-1],c=3+(3&l),l>>>=2,g-=2}else if(17===C){for(D=u+3;g<D;){if(0===s)break e;s--,l+=i[a++]<<g,g+=8}l>>>=u,g-=u,m=0,c=3+(7&l),l>>>=3,g-=3}else{for(D=u+7;g<D;){if(0===s)break e;s--,l+=i[a++]<<g,g+=8}l>>>=u,g-=u,m=0,c=11+(127&l),l>>>=7,g-=7}if(A.have+c>A.nlen+A.ndist){e.msg="invalid bit length repeat",A.mode=kA;break}for(;c--;)A.lens[A.have++]=m}}if(A.mode===kA)break;if(0===A.lens[256]){e.msg="invalid code -- missing end-of-block",A.mode=kA;break}if(A.lenbits=9,b={bits:A.lenbits},p=oA(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=kA;break}if(A.distbits=6,A.distcode=A.distdyn,b={bits:A.distbits},p=oA(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=kA;break}if(A.mode=_A,t===hA)break e;case _A:A.mode=bA;case bA:if(s>=6&&o>=258){e.next_out=n,e.avail_out=o,e.next_in=a,e.avail_in=s,A.hold=l,A.bits=g,AA(e,f),n=e.next_out,r=e.output,o=e.avail_out,a=e.next_in,i=e.input,s=e.avail_in,l=A.hold,g=A.bits,A.mode===mA&&(A.back=-1);break}for(A.back=0;y=A.lencode[l&(1<<A.lenbits)-1],u=y>>>24,B=y>>>16&255,C=65535&y,!(u<=g);){if(0===s)break e;s--,l+=i[a++]<<g,g+=8}if(B&&0==(240&B)){for(E=u,w=B,Q=C;y=A.lencode[Q+((l&(1<<E+w)-1)>>E)],u=y>>>24,B=y>>>16&255,C=65535&y,!(E+u<=g);){if(0===s)break e;s--,l+=i[a++]<<g,g+=8}l>>>=E,g-=E,A.back+=E}if(l>>>=u,g-=u,A.back+=u,A.length=C,0===B){A.mode=16205;break}if(32&B){A.back=-1,A.mode=mA;break}if(64&B){e.msg="invalid literal/length code",A.mode=kA;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[a++]<<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],u=y>>>24,B=y>>>16&255,C=65535&y,!(u<=g);){if(0===s)break e;s--,l+=i[a++]<<g,g+=8}if(0==(240&B)){for(E=u,w=B,Q=C;y=A.distcode[Q+((l&(1<<E+w)-1)>>E)],u=y>>>24,B=y>>>16&255,C=65535&y,!(E+u<=g);){if(0===s)break e;s--,l+=i[a++]<<g,g+=8}l>>>=E,g-=E,A.back+=E}if(l>>>=u,g-=u,A.back+=u,64&B){e.msg="invalid distance code",A.mode=kA;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[a++]<<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=kA;break}A.mode=16204;case 16204:if(0===o)break e;if(c=f-o,A.offset>c){if(c=A.offset-c,c>A.whave&&A.sane){e.msg="invalid distance too far back",A.mode=kA;break}c>A.wnext?(c-=A.wnext,d=A.wsize-c):d=A.wnext-c,c>A.length&&(c=A.length),I=A.window}else I=r,d=n-A.offset,c=A.length;c>o&&(c=o),o-=c,A.length-=c;do{r[n++]=I[d++]}while(--c);0===A.length&&(A.mode=bA);break;case 16205:if(0===o)break e;r[n++]=A.length,o--,A.mode=bA;break;case DA:if(A.wrap){for(;g<32;){if(0===s)break e;s--,l|=i[a++]<<g,g+=8}if(f-=o,e.total_out+=f,A.total+=f,4&A.wrap&&f&&(e.adler=A.check=A.flags?Te(A.check,r,f,n-f):Le(A.check,r,f,n-f)),f=o,4&A.wrap&&(A.flags?l:vA(l))!==A.check){e.msg="incorrect data check",A.mode=kA;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[a++]<<g,g+=8}if(4&A.wrap&&l!==(4294967295&A.total)){e.msg="incorrect length check",A.mode=kA;break}l=0,g=0}A.mode=16208;case 16208:p=cA;break e;case kA:p=uA;break e;case 16210:return BA;default:return IA}return e.next_out=n,e.avail_out=o,e.next_in=a,e.avail_in=s,A.hold=l,A.bits=g,(A.wsize||f!==e.avail_out&&A.mode<kA&&(A.mode<DA||t!==lA))&&OA(e,e.output,e.next_out,f-e.avail_out),h-=e.avail_in,f-=e.avail_out,e.total_in+=h,e.total_out+=f,A.total+=f,4&A.wrap&&f&&(e.adler=A.check=A.flags?Te(A.check,r,f,e.next_out-f):Le(A.check,r,f,e.next_out-f)),e.data_type=A.bits+(A.last?64:0)+(A.mode===mA?128:0)+(A.mode===_A||A.mode===yA?256:0),(0===h&&0===f||t===lA)&&p===fA&&(p=CA),p},inflateEnd:e=>{if(xA(e))return IA;let t=e.state;return t.window&&(t.window=null),e.state=null,fA},inflateGetHeader:(e,t)=>{if(xA(e))return IA;const A=e.state;return 0==(2&A.wrap)?IA:(A.head=t,t.done=!1,fA)},inflateSetDictionary:(e,t)=>{const A=t.length;let i,r,a;return xA(e)?IA:(i=e.state,0!==i.wrap&&i.mode!==QA?IA:i.mode===QA&&(r=1,r=Le(r,t,A,0),r!==i.check)?uA:(a=OA(e,t,A,A),a?(i.mode=16210,BA):(i.havedict=1,fA)))},inflateInfo:"pako inflate (from Nodeca project)"};var zA=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 KA=Object.prototype.toString,{Z_NO_FLUSH:qA,Z_FINISH:JA,Z_OK:HA,Z_STREAM_END:YA,Z_NEED_DICT:VA,Z_STREAM_ERROR:ZA,Z_DATA_ERROR:jA,Z_MEM_ERROR:XA}=Oe;function WA(e){this.options=Nt.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 Kt,this.strm.avail_out=0;let A=PA.inflateInit2(this.strm,t.windowBits);if(A!==HA)throw new Error(Ne[A]);if(this.header=new zA,PA.inflateGetHeader(this.strm,this.header),t.dictionary&&("string"==typeof t.dictionary?t.dictionary=zt.string2buf(t.dictionary):"[object ArrayBuffer]"===KA.call(t.dictionary)&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(A=PA.inflateSetDictionary(this.strm,t.dictionary),A!==HA)))throw new Error(Ne[A])}function $A(e,t){const A=new WA(t);if(A.push(e),A.err)throw A.msg||Ne[A.err];return A.result}WA.prototype.push=function(e,t){const A=this.strm,i=this.options.chunkSize,r=this.options.dictionary;let a,n,s;if(this.ended)return!1;for(n=t===~~t?t:!0===t?JA:qA,"[object ArrayBuffer]"===KA.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),a=PA.inflate(A,n),a===VA&&r&&(a=PA.inflateSetDictionary(A,r),a===HA?a=PA.inflate(A,n):a===jA&&(a=VA));A.avail_in>0&&a===YA&&A.state.wrap>0&&0!==e[A.next_in];)PA.inflateReset(A),a=PA.inflate(A,n);switch(a){case ZA:case jA:case VA:case XA:return this.onEnd(a),this.ended=!0,!1}if(s=A.avail_out,A.next_out&&(0===A.avail_out||a===YA))if("string"===this.options.to){let e=zt.utf8border(A.output,A.next_out),t=A.next_out-e,r=zt.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(a!==HA||0!==s){if(a===YA)return a=PA.inflateEnd(this.strm),this.onEnd(a),this.ended=!0,!0;if(0===A.avail_in)break}}return!0},WA.prototype.onData=function(e){this.chunks.push(e)},WA.prototype.onEnd=function(e){e===HA&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=Nt.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};var ei={Inflate:WA,inflate:$A,inflateRaw:function(e,t){return(t=t||{}).raw=!0,$A(e,t)},ungzip:$A,constants:Oe};const{Inflate:ti,inflate:Ai,inflateRaw:ii,ungzip:ri}=ei;var ai=Ai;function ni(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var si={exports:{}};!function(e){function t(e){var t,A,i,r,a,n=Math.floor,s=new Array(64),o=new Array(64),l=new Array(64),g=new Array(64),h=new Array(65535),f=new Array(65535),c=new Array(64),d=new Array(64),I=[],u=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],S=[0,0,2,1,2,4,4,3,4,7,5,4,4,0,1,2,119],x=[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,a=1;a<=16;a++){for(var n=1;n<=e[a];n++)r[t[i]]=[],r[t[i]][0]=A,r[t[i]][1]=a,i++,A++;A*=2}return r}function U(e){for(var t=e[0],A=e[1]-1;A>=0;)t&1<<A&&(u|=1<<B),A--,--B<0&&(255==u?(F(255),F(0)):F(u),B=7,u=0)}function F(e){I.push(e)}function R(e){F(e>>8&255),F(255&e)}function L(e,t,A,i,r){for(var a,n=r[0],s=r[240],o=function(e,t){var A,i,r,a,n,s,o,l,g,h,f=0;for(g=0;g<8;++g){A=e[f],i=e[f+1],r=e[f+2],a=e[f+3],n=e[f+4],s=e[f+5],o=e[f+6];var d=A+(l=e[f+7]),I=A-l,u=i+o,B=i-o,C=r+s,E=r-s,w=a+n,Q=a-n,m=d+w,p=d-w,y=u+C,_=u-C;e[f]=m+y,e[f+4]=m-y;var b=.707106781*(_+p);e[f+2]=p+b,e[f+6]=p-b;var D=.382683433*((m=Q+E)-(_=B+I)),k=.5411961*m+D,v=1.306562965*_+D,S=.707106781*(y=E+B),x=I+S,G=I-S;e[f+5]=G+k,e[f+3]=G-k,e[f+1]=x+v,e[f+7]=x-v,f+=8}for(f=0,g=0;g<8;++g){A=e[f],i=e[f+8],r=e[f+16],a=e[f+24],n=e[f+32],s=e[f+40],o=e[f+48];var U=A+(l=e[f+56]),F=A-l,R=i+o,L=i-o,M=r+s,T=r-s,N=a+n,O=a-n,P=U+N,z=U-N,K=R+M,q=R-M;e[f]=P+K,e[f+32]=P-K;var J=.707106781*(q+z);e[f+16]=z+J,e[f+48]=z-J;var H=.382683433*((P=O+T)-(q=L+F)),Y=.5411961*P+H,V=1.306562965*q+H,Z=.707106781*(K=T+L),j=F+Z,X=F-Z;e[f+40]=X+Y,e[f+24]=X-Y,e[f+8]=j+V,e[f+56]=j-V,f++}for(g=0;g<64;++g)h=e[g]*t[g],c[g]=h>0?h+.5|0:h-.5|0;return c}(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[f[a=32767+g]]),U(h[a]));for(var I=63;I>0&&0==d[I];I--);if(0==I)return U(n),A;for(var u,B=1;B<=I;){for(var C=B;0==d[B]&&B<=I;++B);var E=B-C;if(E>=16){u=E>>4;for(var w=1;w<=u;++w)U(s);E&=15}a=32767+d[B],U(r[(E<<4)+f[a]]),U(h[a]),B++}return 63!=I&&U(n),A}function M(e){if(e<=0&&(e=1),e>100&&(e=100),a!=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=n((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],a=0;a<64;a++){var h=n((r[a]*e+50)/100);h<1?h=1:h>255&&(h=255),o[p[a]]=h}for(var f=[1,1.387039845,1.306562965,1.175875602,1,.785694958,.5411961,.275899379],c=0,d=0;d<8;d++)for(var I=0;I<8;I++)l[c]=1/(s[p[c]]*f[d]*f[I]*8),g[c]=1/(o[p[c]]*f[d]*f[I]*8),c++})(e<50?Math.floor(5e3/e):Math.floor(200-2*e)),a=e}}this.encode=function(e,a){var n;(new Date).getTime(),a&&M(a),I=new Array,u=0,B=7,R(65496),R(65504),R(16),F(74),F(70),F(73),F(70),F(0),F(1),F(1),F(0),R(1),R(1),F(0),F(0),void 0!==(n=e.comments)&&n.constructor===Array&&n.forEach((e=>{if("string"==typeof e){R(65534);var t,A=e.length;for(R(A+2),t=0;t<A;t++)F(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),F(69),F(120),F(105),F(102),F(0));for(var t=0;t<e.length;t++)F(e[t])}}(e.exifBuffer),function(){R(65499),R(132),F(0);for(var e=0;e<64;e++)F(s[e]);F(1);for(var t=0;t<64;t++)F(o[t])}(),function(e,t){R(65472),R(17),F(8),R(t),R(e),F(3),F(1),F(17),F(0),F(2),F(17),F(1),F(3),F(17),F(1)}(e.width,e.height),function(){R(65476),R(418),F(0);for(var e=0;e<16;e++)F(y[e+1]);for(var t=0;t<=11;t++)F(_[t]);F(16);for(var A=0;A<16;A++)F(b[A+1]);for(var i=0;i<=161;i++)F(D[i]);F(1);for(var r=0;r<16;r++)F(k[r+1]);for(var a=0;a<=11;a++)F(v[a]);F(17);for(var n=0;n<16;n++)F(S[n+1]);for(var s=0;s<=161;s++)F(x[s])}(),R(65498),R(12),F(3),F(1),F(0),F(2),F(17),F(3),F(17),F(0),F(63),F(0);var h=0,f=0,c=0;u=0,B=7,this.encode.displayName="_encode_";for(var d,Q,p,G,T,N,O,P,z,K=e.data,q=e.width,J=e.height,H=4*q,Y=0;Y<J;){for(d=0;d<H;){for(N=T=H*Y+d,O=-1,P=0,z=0;z<64;z++)N=T+(P=z>>3)*H+(O=4*(7&z)),Y+P>=J&&(N-=H*(Y+1+P-J)),d+O>=H&&(N-=d+O-H+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=L(C,l,h,t,i),f=L(E,g,f,A,r),c=L(w,g,c,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(I)},(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(S,x),function(){for(var e=1,t=2,A=1;A<=15;A++){for(var i=e;i<t;i++)f[32767+i]=A,h[32767+i]=[],h[32767+i][1]=A,h[32767+i][0]=i;for(var r=-(t-1);r<=-e;r++)f[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}(),M(e),(new Date).getTime()}si.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 oi=si.exports,li={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,a=1567,n=3784,s=5793,o=2896;function l(){}function g(e,t){for(var A,i,r=0,a=[],n=16;n>0&&!e[n-1];)n--;a.push({children:[],index:0});var s,o=a[0];for(A=0;A<n;A++){for(i=0;i<e[A];i++){for((o=a.pop()).children[o.index]=t[r];o.index>0;){if(0===a.length)throw new Error("Could not recreate Huffman Table");o=a.pop()}for(o.index++,a.push(o);a.length<=A;)a.push(s={children:[],index:0}),o.children[o.index]=s.children,o=s;r++}A+1<n&&(a.push(s={children:[],index:0}),o.children[o.index]=s.children,o=s)}return a[0].children}function h(t,A,i,r,a,n,s,o,l,g){i.precision,i.samplesPerLine,i.scanLines;var h=i.mcusPerLine,f=i.progressive;i.maxH,i.maxV;var c=A,d=0,I=0;function u(){if(I>0)return I--,d>>I&1;if(255==(d=t[A++])){var e=t[A++];if(e)throw new Error("unexpected marker: "+(d<<8|e).toString(16))}return I=7,d>>>7}function B(e){for(var t,A=e;null!==(t=u());){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=u();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 a=A%h,n=(A/h|0)*e.v+i,s=a*e.h+r;void 0===e.blocks[n]&&g.tolerantDecoding||t(e,e.blocks[n][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,S,x=r.length;S=f?0===n?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]|=u()<<l}:0===o?function(t,A){if(w>0)w--;else for(var i=n,r=s;i<=r;){var a=B(t.huffmanTableAC),o=15&a,g=a>>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=n,r=s,a=0;i<=r;){var o=e[i],g=A[o]<0?-1:1;switch(m){case 0:var h=B(t.huffmanTableAC),f=15&h;if(a=h>>4,0===f)a<15?(w=C(a)+(1<<a),m=4):(a=16,m=1);else{if(1!==f)throw new Error("invalid ACn encoding");Q=E(f),m=a?2:3}continue;case 1:case 2:A[o]?A[o]+=(u()<<l)*g:0==--a&&(m=2==m?3:0);break;case 3:A[o]?A[o]+=(u()<<l)*g:(A[o]=Q<<l,m=0);break;case 4:A[o]&&(A[o]+=(u()<<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 a=1;a<64;){var n=B(t.huffmanTableAC),s=15&n,o=n>>4;if(0!==s)A[e[a+=o]]=E(s),a++;else{if(o<15)break;a+=16}}};var G,U,F,R,L=0;for(U=1==x?r[0].blocksPerLine*r[0].blocksPerColumn:h*i.mcusPerColumn,a||(a=U);L<U;){for(b=0;b<x;b++)r[b].pred=0;if(w=0,1==x)for(_=r[0],v=0;v<a;v++)y(_,S,L),L++;else for(v=0;v<a;v++){for(b=0;b<x;b++)for(F=(_=r[b]).h,R=_.v,D=0;D<R;D++)for(k=0;k<F;k++)p(_,S,L,D,k);if(++L===U)break}if(L===U)do{if(255===t[A]&&0!==t[A+1])break;A+=1}while(A<t.length-2);if(I=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-c}function f(e,l){var g,h,f=[],c=l.blocksPerLine,d=l.blocksPerColumn,I=c<<3,B=new Int32Array(64),C=new Uint8Array(64);function E(e,g,h){var f,c,d,I,u,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]?(f=s*p[0+y]+128>>8,c=s*p[4+y]+128>>8,d=p[2+y],I=p[6+y],u=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=f-c+1>>1,f=f+c+1>>1,c=w,w=d*n+I*a+128>>8,d=d*a-I*n+128>>8,I=w,w=u-C+1>>1,u=u+C+1>>1,C=w,w=E+B+1>>1,B=E-B+1>>1,E=w,w=f-I+1>>1,f=f+I+1>>1,I=w,w=c-d+1>>1,c=c+d+1>>1,d=w,w=u*r+E*i+2048>>12,u=u*i-E*r+2048>>12,E=w,w=B*A+C*t+2048>>12,B=B*t-C*A+2048>>12,C=w,p[0+y]=f+E,p[7+y]=f-E,p[1+y]=c+C,p[6+y]=c-C,p[2+y]=d+B,p[5+y]=d-B,p[3+y]=I+u,p[4+y]=I-u):(w=s*p[0+y]+512>>10,p[0+y]=w,p[1+y]=w,p[2+y]=w,p[3+y]=w,p[4+y]=w,p[5+y]=w,p[6+y]=w,p[7+y]=w)}for(Q=0;Q<8;++Q){var _=Q;0!=p[8+_]||0!=p[16+_]||0!=p[24+_]||0!=p[32+_]||0!=p[40+_]||0!=p[48+_]||0!=p[56+_]?(f=s*p[0+_]+2048>>12,c=s*p[32+_]+2048>>12,d=p[16+_],I=p[48+_],u=o*(p[8+_]-p[56+_])+2048>>12,E=o*(p[8+_]+p[56+_])+2048>>12,B=p[24+_],C=p[40+_],w=f-c+1>>1,f=f+c+1>>1,c=w,w=d*n+I*a+2048>>12,d=d*a-I*n+2048>>12,I=w,w=u-C+1>>1,u=u+C+1>>1,C=w,w=E+B+1>>1,B=E-B+1>>1,E=w,w=f-I+1>>1,f=f+I+1>>1,I=w,w=c-d+1>>1,c=c+d+1>>1,d=w,w=u*r+E*i+2048>>12,u=u*i-E*r+2048>>12,E=w,w=B*A+C*t+2048>>12,B=B*t-C*A+2048>>12,C=w,p[0+_]=f+E,p[56+_]=f-E,p[8+_]=c+C,p[48+_]=c-C,p[16+_]=d+B,p[40+_]=d-B,p[24+_]=I+u,p[32+_]=I-u):(w=s*h[Q+0]+8192>>14,p[0+_]=w,p[8+_]=w,p[16+_]=w,p[24+_]=w,p[32+_]=w,p[40+_]=w,p[48+_]=w,p[56+_]=w)}for(Q=0;Q<64;++Q){var b=128+(p[Q]+8>>4);g[Q]=b<0?0:b>255?255:b}}u(I*d*8);for(var w=0;w<d;w++){var Q=w<<3;for(g=0;g<8;g++)f.push(new Uint8Array(I));for(var m=0;m<c;m++){E(l.blocks[w][m],C,B);var p=0,y=m<<3;for(h=0;h<8;h++){var _=f[Q+h];for(g=0;g<8;g++)_[y+g]=C[p++]}}}return f}function c(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 a(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 a=Math.ceil(e.samplesPerLine/8/i),n=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=a*t.h,g=n*t.v,h=[];u(256*(g*l));for(var f=0;f<g;f++){for(var c=[],d=0;d<l;d++)c.push(new Int32Array(64));h.push(c)}t.blocksPerLine=s,t.blocksPerColumn=o,t.blocks=h}e.maxH=i,e.maxV=r,e.mcusPerLine=a,e.mcusPerColumn=n}t.length;var n,s,o,l,c=null,d=null,I=[],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]&&(c={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++];u(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()}}I[15&_]=b}break;case 65472:case 65473:case 65474:r(),(n={}).extended=65473===w,n.progressive=65474===w,n.precision=t[i++],n.scanLines=r(),n.samplesPerLine=r(),n.components={},n.componentsOrder=[];var D=n.scanLines*n.samplesPerLine;if(D>A){var k=Math.ceil((D-A)/1e6);throw new Error(`maxResolutionInMP limit exceeded by ${k}MP`)}var v,S=t[i++];for(H=0;H<S;H++){v=t[i];var x=t[i+1]>>4,G=15&t[i+1],U=t[i+2];if(x<=0||G<=0)throw new Error("Invalid sampling factor, expected values above 0");n.componentsOrder.push(v),n.components[v]={h:x,v:G,quantizationIdx:U},i+=3}a(n),B.push(n);break;case 65476:var F=r();for(H=2;H<F;){var R=t[i++],L=new Uint8Array(16),M=0;for(V=0;V<16;V++,i++)M+=L[V]=t[i];u(16+M);var T=new Uint8Array(M);for(V=0;V<M;V++,i++)T[V]=t[i];H+=17+M,(R>>4==0?E:C)[15&R]=g(L,T)}break;case 65501:r(),s=r();break;case 65500:r(),r();break;case 65498:r();var N=t[i++],O=[];for(H=0;H<N;H++){Z=n.components[t[i++]];var P=t[i++];Z.huffmanTableDC=E[P>>4],Z.huffmanTableAC=C[15&P],O.push(Z)}var z=t[i++],K=t[i++],q=t[i++],J=h(t,i,n,O,s,z,K,q>>4,15&q,this.opts);i+=J;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 H=0;H<B.length;H++){var Y=B[H].components;for(var V in Y)Y[V].quantizationTable=I[Y[V].quantizationIdx],delete Y[V].quantizationIdx}this.width=n.samplesPerLine,this.height=n.scanLines,this.jfif=c,this.adobe=d,this.components=[];for(H=0;H<n.componentsOrder.length;H++){var Z=n.components[n.componentsOrder[H]];this.components.push({lines:f(0,Z),scaleX:Z.h/n.maxH,scaleY:Z.v/n.maxV})}},getData:function(e,t){var A,i,r,a,n,s,o,l,g,h,f,d,I,B,C,E,w,Q,m,p,y,_=this.width/e,b=this.height/t,D=0,k=e*t*this.components.length;u(k);var v=new Uint8Array(k);switch(this.components.length){case 1:for(A=this.components[0],h=0;h<t;h++)for(n=A.lines[0|h*A.scaleY*b],g=0;g<e;g++)f=n[0|g*A.scaleX*_],v[D++]=f;break;case 2:for(A=this.components[0],i=this.components[1],h=0;h<t;h++)for(n=A.lines[0|h*A.scaleY*b],s=i.lines[0|h*i.scaleY*b],g=0;g<e;g++)f=n[0|g*A.scaleX*_],v[D++]=f,f=s[0|g*i.scaleX*_],v[D++]=f;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(n=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?(f=n[0|g*A.scaleX*_],d=s[0|g*i.scaleX*_],Q=c(f+1.402*((I=o[0|g*r.scaleX*_])-128)),m=c(f-.3441363*(d-128)-.71413636*(I-128)),p=c(f+1.772*(d-128))):(Q=n[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],a=this.components[3],h=0;h<t;h++)for(n=A.lines[0|h*A.scaleY*b],s=i.lines[0|h*i.scaleY*b],o=r.lines[0|h*r.scaleY*b],l=a.lines[0|h*a.scaleY*b],g=0;g<e;g++)y?(f=n[0|g*A.scaleX*_],d=s[0|g*i.scaleX*_],I=o[0|g*r.scaleX*_],B=l[0|g*a.scaleX*_],C=255-c(f+1.402*(I-128)),E=255-c(f-.3441363*(d-128)-.71413636*(I-128)),w=255-c(f+1.772*(d-128))):(C=n[0|g*A.scaleX*_],E=s[0|g*i.scaleX*_],w=o[0|g*r.scaleX*_],B=l[0|g*a.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,a,n,s,o,l,g,h=e.width,f=e.height,d=e.data,I=this.getData(h,f),u=0,B=0;switch(this.components.length){case 1:for(i=0;i<f;i++)for(A=0;A<h;A++)r=I[u++],d[B++]=r,d[B++]=r,d[B++]=r,t&&(d[B++]=255);break;case 3:for(i=0;i<f;i++)for(A=0;A<h;A++)o=I[u++],l=I[u++],g=I[u++],d[B++]=o,d[B++]=l,d[B++]=g,t&&(d[B++]=255);break;case 4:for(i=0;i<f;i++)for(A=0;A<h;A++)n=I[u++],s=I[u++],r=I[u++],o=255-c(n*(1-(a=I[u++])/255)+a),l=255-c(s*(1-a/255)+a),g=255-c(r*(1-a/255)+a),d[B++]=o,d[B++]=l,d[B++]=g,t&&(d[B++]=255);break;default:throw new Error("Unsupported color mode")}}};var d=0,I=0;function u(e=0){var t=d+e;if(t>I){var A=Math.ceil((t-I)/1024/1024);throw new Error(`maxMemoryUsageInMB limit exceeded by at least ${A}MB`)}d=t}return l.resetMaxMemoryUsage=function(e){d=0,I=e},l.getBytesAllocated=function(){return d},l.requestMemoryAllocation=u,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),a=new t;a.opts=i,t.resetMaxMemoryUsage(1024*i.maxMemoryUsageInMB*1024),a.parse(r);var n=i.formatAsRGBA?4:3,s=a.width*a.height*n;try{t.requestMemoryAllocation(s);var o={width:a.width,height:a.height,exifBuffer:a.exifBuffer,data:i.useTArray?new Uint8Array(s):Buffer.alloc(s)};a.comments.length>0&&(o.comments=a.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 a.copyToImageData(o,i.formatAsRGBA),o}}(li);var gi=ni({encode:oi,decode:li.exports});const hi=Math.PI,fi=hi/4,ci=180/hi;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 Ii(e,t,A){let i=0,r=e.length;const a=r/A;for(;r>t;){for(let A=t;A>0;--A)e[i+t]+=e[i],++i;r-=t}const n=e.slice();for(let t=0;t<a;++t)for(let i=0;i<A;++i)e[A*t+i]=n[(A-i-1)*a+t]}let ui=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,a){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 n=r[0]/8,s=2===a?1:r.length;for(let a=0;a<i&&!(a*s*A*n>=e.byteLength);++a){let i;if(2===t){switch(r[0]){case 8:i=new Uint8Array(e,a*s*A*n,s*A*n);break;case 16:i=new Uint16Array(e,a*s*A*n,s*A*n/2);break;case 32:i=new Uint32Array(e,a*s*A*n,s*A*n/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,a*s*A*n,s*A*n),Ii(i,s,n))}return e}(A,i,t?e.TileWidth:e.ImageWidth,t?e.TileLength:e.RowsPerStrip||e.ImageLength,e.BitsPerSample,e.PlanarConfiguration)}return A}};const Bi=257;function Ci(e,t){for(let A=t.length-1;A>=0;A--)e.push(t[A]);return e}function Ei(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,a=0;function n(){i=258,r=9}function s(e){const t=function(e,t,A){const i=t%8,r=Math.floor(t/8),a=8-i,n=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)"),Bi;let l=e[r]&2**(8-i)-1;l<<=A-a;let g=l;if(r+1<e.length){let t=e[r+1]>>>s;t<<=Math.max(0,A-o),g+=t}if(n>8&&r+2<e.length){const i=8*(r+3)-(t+A);g+=e[r+2]>>>i}return g}(e,a,r);return a+=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=[];n();const h=new Uint8Array(e);let f,c=s(h);for(;c!==Bi;){if(256===c){for(n(),c=s(h);256===c;)c=s(h);if(c===Bi)break;if(c>256)throw new Error(`corrupted code at scanline ${c}`);Ci(g,l(c)),f=c}else if(c<i){const e=l(c);Ci(g,e),o(f,e[e.length-1]),f=c}else{const e=l(f);if(!e)throw new Error(`Bogus entry. Not in dictionary,\n ${f} / ${i},\n position: ${a}`);Ci(g,e),g.push(e[e.length-1]),o(f,e[e.length-1]),f=c}i+1>=2**r&&(12===r?f=void 0:r++),c=s(h)}return new Uint8Array(g)}let wi=class extends ui{decodeBlock(e){return Ei(e).buffer}};function Qi(e){return(t,...A)=>pi(e,t,A)}function mi(e,t){return Qi(Di(e,t).get)}const{apply:pi,construct:yi,defineProperty:_i,get:bi,getOwnPropertyDescriptor:Di,getPrototypeOf:ki,has:vi,ownKeys:Si,set:xi,setPrototypeOf:Gi}=Reflect,{iterator:Ui,species:Fi,toStringTag:Ri,for:Li}=Symbol,Mi=Object,{create:Ti,defineProperty:Ni,freeze:Oi,is:Pi}=Mi,zi=Array.prototype[Ui],Ki=Qi(zi),qi=ArrayBuffer;mi(qi.prototype,"byteLength");const Ji="undefined"!=typeof SharedArrayBuffer?SharedArrayBuffer:null;Ji&&mi(Ji.prototype,"byteLength");const Hi=ki(Uint8Array);Hi.from;const Yi=Hi.prototype;Yi[Ui],Qi(Yi.keys),Qi(Yi.values),Qi(Yi.entries),Qi(Yi.set),Qi(Yi.reverse),Qi(Yi.fill),Qi(Yi.copyWithin),Qi(Yi.sort),Qi(Yi.slice),Qi(Yi.subarray),mi(Yi,"buffer"),mi(Yi,"byteOffset"),mi(Yi,"length"),mi(Yi,Ri);const Vi=Uint32Array,Zi=Float32Array,ji=ki([][Ui]()),Xi=Qi(ji.next),Wi=Qi(function*(){}().next),$i=ki(ji),er=Qi(DataView.prototype.getUint16),tr=WeakMap,Ar=tr.prototype,ir=Qi(Ar.get),rr=Qi(Ar.set),ar=new tr,nr=Ti(null,{next:{value:function(){const e=ir(ar,this);return Xi(e)}},[Ui]:{value:function(){return this}}});const sr=new tr,or=Ti($i,{next:{value:function(){const e=ir(sr,this);return Wi(e)},writable:!0,configurable:!0}});for(const e of Si(ji))"next"!==e&&Ni(or,e,Di(ji,e));const lr=new qi(4),gr=new Zi(lr),hr=new Vi(lr),fr=new Vi(512),cr=new Vi(512);for(let e=0;e<256;++e){const t=e-127;t<-27?(fr[e]=0,fr[256|e]=32768,cr[e]=24,cr[256|e]=24):t<-14?(fr[e]=1024>>-t-14,fr[256|e]=1024>>-t-14|32768,cr[e]=-t-1,cr[256|e]=-t-1):t<=15?(fr[e]=t+15<<10,fr[256|e]=t+15<<10|32768,cr[e]=13,cr[256|e]=13):t<128?(fr[e]=31744,fr[256|e]=64512,cr[e]=24,cr[256|e]=24):(fr[e]=31744,fr[256|e]=64512,cr[e]=13,cr[256|e]=13)}const dr=new Vi(2048),Ir=new Vi(64),ur=new Vi(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)Ir[e]=e<<23;Ir[31]=1199570944,Ir[32]=2147483648;for(let e=33;e<63;++e)Ir[e]=2147483648+(e-32<<23);Ir[63]=3347054592;for(let e=1;e<64;++e)32!==e&&(ur[e]=1024);function Br(e,t,...A){return function(e){const t=e>>10;return hr[0]=dr[ur[t]+(1023&e)]+Ir[t],gr[0]}(er(e,t,...function(e){if(e[Ui]===zi&&ji.next===Xi)return e;const t=Ti(nr);return rr(ar,t,Ki(e)),t}(A)))}var Cr={exports:{}};function Er(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,a=r.slice(0,r.indexOf(">")+1),n=['"',"'"];for(let e=0;e<n.length;e++){const A=n[e],r=t+"\\="+A+"([^"+A+"]*)"+A;i&&console.log("[xml-utils] pattern:",r);const s=new RegExp(r).exec(a);if(i&&console.log("[xml-utils] match:",s),s)return s[1]}}Cr.exports=Er,Cr.exports.default=Er;var wr=ni(Cr.exports),Qr={exports:{}},mr={exports:{}},pr={exports:{}};function yr(e,t,A){const i=new RegExp(t).exec(e.slice(A));return i?A+i.index:-1}pr.exports=yr,pr.exports.default=yr;var _r=pr.exports,br={exports:{}};function Dr(e,t,A){const i=new RegExp(t).exec(e.slice(A));return i?A+i.index+i[0].length-1:-1}br.exports=Dr,br.exports.default=Dr;var kr=br.exports,vr={exports:{}};function Sr(e,t){const A=new RegExp(t,"g"),i=e.match(A);return i?i.length:0}vr.exports=Sr,vr.exports.default=Sr;var xr=vr.exports;const Gr=_r,Ur=kr,Fr=xr;function Rr(e,t,A){const i=A&&A.debug||!1,r=!(A&&!1===typeof A.nested),a=A&&A.startIndex||0;i&&console.log("[xml-utils] starting findTagByName with",t," and ",A);const n=Gr(e,`<${t}[ \n>/]`,a);if(i&&console.log("[xml-utils] start:",n),-1===n)return;const s=e.slice(n+t.length);let o=Ur(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=Ur(s,"[ /]"+t+">",e));){const r=s.substring(e,o+1);if(A+=Fr(r,"<"+t+"[ \n\t>]"),i+=Fr(r,"</"+t+">"),i>=A)break;e=o}}else o=Ur(s,"[ /]"+t+">",0);const g=n+t.length+o+1;if(i&&console.log("[xml-utils] end:",g),-1===g)return;const h=e.slice(n,g);let f;return f=l?null:h.slice(h.indexOf(">")+1,h.lastIndexOf("<")),{inner:f,outer:h,start:n,end:g}}mr.exports=Rr,mr.exports.default=Rr;const Lr=mr.exports;function Mr(e,t,A){const i=[],r=A&&A.debug||!1,a=!A||"boolean"!=typeof A.nested||A.nested;let n,s=A&&A.startIndex||0;for(;n=Lr(e,t,{debug:r,startIndex:s});)s=a?n.start+1+t.length:n.end,i.push(n);return r&&console.log("findTagsByName found",i.length,"tags"),i}Qr.exports=Mr,Qr.exports.default=Mr;var Tr=ni(Qr.exports);const Nr={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"},Or={};for(const e in Nr)Nr.hasOwnProperty(e)&&(Or[Nr[e]]=parseInt(e,10));const Pr=[Or.BitsPerSample,Or.ExtraSamples,Or.SampleFormat,Or.StripByteCounts,Or.StripOffsets,Or.StripRowCounts,Or.TileByteCounts,Or.TileOffsets,Or.SubIFDs],zr={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"},Kr={};for(const e in zr)zr.hasOwnProperty(e)&&(Kr[zr[e]]=parseInt(e,10));const qr=0,Jr=1,Hr=2,Yr=3,Vr=5,Zr=6,jr=8,Xr=0,Wr=1,$r=0,ea=1,ta=2,Aa={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 ia=new Map;function ra(e,t){Array.isArray(e)||(e=[e]),e.forEach((e=>ia.set(e,t)))}function aa(e,t,A,i=1){return new(Object.getPrototypeOf(e).constructor)(t*A*i)}function na(e,t,A){return(1-A)*e+A*t}function sa(e,t,A,i,r,a="nearest"){switch(a.toLowerCase()){case"nearest":return function(e,t,A,i,r){const a=t/i,n=A/r;return e.map((e=>{const s=aa(e,i,r);for(let o=0;o<r;++o){const r=Math.min(Math.round(n*o),A-1);for(let A=0;A<i;++A){const n=Math.min(Math.round(a*A),t-1),l=e[r*t+n];s[o*i+A]=l}}return s}))}(e,t,A,i,r);case"bilinear":case"linear":return function(e,t,A,i,r){const a=t/i,n=A/r;return e.map((e=>{const s=aa(e,i,r);for(let o=0;o<r;++o){const r=n*o,l=Math.floor(r),g=Math.min(Math.ceil(r),A-1);for(let A=0;A<i;++A){const n=a*A,h=n%1,f=Math.floor(n),c=Math.min(Math.ceil(n),t-1),d=e[l*t+f],I=e[l*t+c],u=e[g*t+f],B=e[g*t+c],C=na(na(d,I,h),na(u,B,h),r%1);s[o*i+A]=C}}return s}))}(e,t,A,i,r);default:throw new Error(`Unsupported resampling method: '${a}'`)}}function oa(e,t,A,i,r,a,n="nearest"){switch(n.toLowerCase()){case"nearest":return function(e,t,A,i,r,a){const n=t/i,s=A/r,o=aa(e,i,r,a);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(n*A),t-1);for(let n=0;n<a;++n){const g=e[r*t*a+s*a+n];o[l*i*a+A*a+n]=g}}}return o}(e,t,A,i,r,a);case"bilinear":case"linear":return function(e,t,A,i,r,a){const n=t/i,s=A/r,o=aa(e,i,r,a);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=n*A,f=s%1,c=Math.floor(s),d=Math.min(Math.ceil(s),t-1);for(let n=0;n<a;++n){const s=e[g*t*a+c*a+n],I=e[g*t*a+d*a+n],u=e[h*t*a+c*a+n],B=e[h*t*a+d*a+n],C=na(na(s,I,f),na(u,B,f),r%1);o[l*i*a+A*a+n]=C}}}return o}(e,t,A,i,r,a);default:throw new Error(`Unsupported resampling method: '${n}'`)}}function la(e,t,A){let i=0;for(let r=t;r<A;++r)i+=e[r];return i}function ga(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")}ra([void 0,1],(()=>Promise.resolve().then((function(){return Ka})).then((e=>e.default)))),ra(5,(()=>Promise.resolve().then((function(){return Ya})).then((e=>e.default)))),ra(6,(()=>{throw new Error("old style JPEG compression is not supported.")})),ra(7,(()=>Promise.resolve().then((function(){return on})).then((e=>e.default)))),ra([8,32946],(()=>Promise.resolve().then((function(){return Cl})).then((e=>e.default)))),ra(32773,(()=>Promise.resolve().then((function(){return El})).then((e=>e.default)))),ra(34887,(()=>Promise.resolve().then((function(){return kl})).then((async e=>(await e.zstd.init(),e))).then((e=>e.default)))),ra(50001,(()=>Promise.resolve().then((function(){return vl})).then((e=>e.default))));var ha=class{constructor(e,t,A,i,r,a){this.fileDirectory=e,this.geoKeys=t,this.dataView=A,this.littleEndian=i,this.tiles=r?{}:null,this.isTiled=!e.StripOffsets;const n=e.PlanarConfiguration;if(this.planarConfiguration=void 0===n?1:n,1!==this.planarConfiguration&&2!==this.planarConfiguration)throw new Error("Invalid planar configuration.");this.source=a}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 Br(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 ga(this.getSampleFormat(e),this.getBitsPerSample(e),t)}async getTileOrStrip(e,t,A,i,r){const a=Math.ceil(this.getWidth()/this.getTileWidth()),n=Math.ceil(this.getHeight()/this.getTileHeight());let s;const{tiles:o}=this;let l,g;1===this.planarConfiguration?s=t*a+e:2===this.planarConfiguration&&(s=A*a*n+t*a+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 f;return null!==o&&o[s]?f=o[s]:(f=(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,a,n){const s=new DataView(e),o=2===A?1:i,l=ga(t,r,2===A?n*a:n*a*i),g=parseInt("1".repeat(r),2);if(1===t){let e;e=1===A?i*r:r;let t=a*e;0!=(7&t)&&(t=t+7&-8);for(let e=0;e<n;++e){const A=e*t;for(let t=0;t<a;++t){const i=A+t*o*r;for(let A=0;A<o;++A){const n=i+A*r,h=(e*a+t)*o+A,f=Math.floor(n/8),c=n%8;if(c+r<=8)l[h]=s.getUint8(f)>>8-r-c&g;else if(c+r<=16)l[h]=s.getUint16(f)>>16-r-c&g;else if(c+r<=24){const e=s.getUint16(f)<<8|s.getUint8(f+2);l[h]=e>>24-r-c&g}else l[h]=s.getUint32(f)>>32-r-c&g}}}}return l.buffer}(e,A,this.planarConfiguration,this.getSamplesPerPixel(),r,this.getTileWidth(),this.getBlockHeight(t))),e})(),null!==o&&(o[s]=f)),{x:e,y:t,sample:A,data:await f}}async _readRaster(e,t,A,i,r,a,n,s,o){const l=this.getTileWidth(),g=this.getTileHeight(),h=this.getWidth(),f=this.getHeight(),c=Math.max(Math.floor(e[0]/l),0),d=Math.min(Math.ceil(e[2]/l),Math.ceil(h/l)),I=Math.max(Math.floor(e[1]/g),0),u=Math.min(Math.ceil(e[3]/g),Math.ceil(f/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(la(this.fileDirectory.BitsPerSample,0,t[e])/8):E.push(0),w.push(this.getReaderForSample(t[e]));const Q=[],{littleEndian:m}=this;for(let a=I;a<u;++a)for(let n=c;n<d;++n){let s;1===this.planarConfiguration&&(s=this.getTileOrStrip(n,a,0,r,o));for(let c=0;c<t.length;++c){const d=c,I=t[c];2===this.planarConfiguration&&(C=this.getSampleByteSize(I),s=this.getTileOrStrip(n,a,I,r,o));const u=s.then((r=>{const a=r.data,n=new DataView(a),s=this.getBlockHeight(r.y),o=r.y*g,c=r.x*l,I=o+s,u=(r.x+1)*l,Q=w[d],p=Math.min(s,s-(I-e[3]),f-o),y=Math.min(l,l-(u-e[2]),h-c);for(let r=Math.max(0,e[1]-o);r<p;++r)for(let a=Math.max(0,e[0]-c);a<y;++a){const s=(r*l+a)*C,g=Q.call(n,s+E[d],m);let h;i?(h=(r+o-e[1])*B*t.length+(a+c-e[0])*t.length+d,A[h]=g):(h=(r+o-e[1])*B+a+c-e[0],A[d][h]=g)}}));Q.push(u)}}if(await Promise.all(Q),a&&e[2]-e[0]!==a||n&&e[3]-e[1]!==n){let r;return r=i?oa(A,e[2]-e[0],e[3]-e[1],a,n,t.length,s):sa(A,e[2]-e[0],e[3]-e[1],a,n,s),r.width=a,r.height=n,r}return A.width=a||e[2]-e[0],A.height=n||e[3]-e[1],A}async readRasters({window:e,samples:t=[],interleave:A,pool:i=null,width:r,height:a,resampleMethod:n,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 f;if(A){f=ga(this.fileDirectory.SampleFormat?Math.max.apply(null,this.fileDirectory.SampleFormat):1,Math.max.apply(null,this.fileDirectory.BitsPerSample),g*t.length),s&&f.fill(s)}else{f=[];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),f.push(A)}}const c=i||await async function(e){const t=ia.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,f,A,c,r,a,n,o)}async readRGB({window:e,interleave:t=!0,pool:A=null,width:i,height:r,resampleMethod:a,enableAlpha:n=!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===Hr){let o=[0,1,2];if(this.fileDirectory.ExtraSamples!==Xr&&n){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:a,signal:s})}let g;switch(l){case qr:case Jr:case Yr:g=[0];break;case Vr:g=[0,1,2,3];break;case Zr:case jr: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:a,signal:s},{fileDirectory:f}=this,c=await this.readRasters(h),d=2**this.fileDirectory.BitsPerSample[0];let I;switch(l){case qr:I=function(e,t){const{width:A,height:i}=e,r=new Uint8Array(A*i*3);let a;for(let A=0,i=0;A<e.length;++A,i+=3)a=256-e[A]/t*256,r[i]=a,r[i+1]=a,r[i+2]=a;return r}(c,d);break;case Jr:I=function(e,t){const{width:A,height:i}=e,r=new Uint8Array(A*i*3);let a;for(let A=0,i=0;A<e.length;++A,i+=3)a=e[A]/t*256,r[i]=a,r[i+1]=a,r[i+2]=a;return r}(c,d);break;case Yr:I=function(e,t){const{width:A,height:i}=e,r=new Uint8Array(A*i*3),a=t.length/3,n=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+a]/65536*256,r[i+2]=t[s+n]/65536*256}return r}(c,f.ColorMap);break;case Vr:I=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],a=e[t+1],n=e[t+2],s=e[t+3];i[A]=(255-r)/256*255*((255-s)/256),i[A+1]=(255-a)/256*255*((255-s)/256),i[A+2]=(255-n)/256*255*((255-s)/256)}return i}(c);break;case Zr:I=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],a=e[t+1],n=e[t+2];i[A]=r+1.402*(n-128),i[A+1]=r-.34414*(a-128)-.71414*(n-128),i[A+2]=r+1.772*(a-128)}return i}(c);break;case jr:I=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,a,n,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,a=-.9689*o+1.8758*s+.0415*l,n=.0557*o+-.204*s+1.057*l,r=r>.0031308?1.055*r**(1/2.4)-.055:12.92*r,a=a>.0031308?1.055*a**(1/2.4)-.055:12.92*a,n=n>.0031308?1.055*n**(1/2.4)-.055:12.92*n,i[A]=255*Math.max(0,Math.min(1,r)),i[A+1]=255*Math.max(0,Math.min(1,a)),i[A+2]=255*Math.max(0,Math.min(1,n))}return i}(c);break;default:throw new Error("Unsupported photometric interpretation.")}if(!t){const e=new Uint8Array(I.length/3),t=new Uint8Array(I.length/3),A=new Uint8Array(I.length/3);for(let i=0,r=0;i<I.length;i+=3,++r)e[r]=I[i],t[r]=I[i+1],A[r]=I[i+2];I=[e,t,A]}return I.width=c.width,I.height=c.height,I}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=Tr(A,"Item");i=null===e?i.filter((e=>void 0===wr(e,"sample"))):i.filter((t=>Number(wr(t,"sample"))===e));for(let e=0;e<i.length;++e){const A=i[e];t[wr(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,a,n,s,o,l]=this.fileDirectory.ModelTransformation,g=[[0,0],[0,t],[A,0],[A,t]].map((([t,A])=>[a+e*t+i*A,l+n*t+s*A])),h=g.map((e=>e[0])),f=g.map((e=>e[1]));return[Math.min(...h),Math.min(...f),Math.max(...h),Math.max(...f)]}{const e=this.getOrigin(),i=this.getResolution(),r=e[0],a=e[1],n=r+i[0]*A,s=a+i[1]*t;return[Math.min(r,n),Math.min(a,s),Math.max(r,n),Math.max(a,s)]}}};class fa{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 a=0;a<8;a++){let n=this._dataView.getUint8(e+(t?a:7-a));i&&(r?0!==n&&(n=255&~(n-1),r=!1):n=255&~n),A+=n*256**a}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 Br(this._dataView,e,t)}getFloat32(e,t){return this._dataView.getFloat32(e,t)}getFloat64(e,t){return this._dataView.getFloat64(e,t)}}class ca{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 a=this._dataView.getUint8(e+(this._littleEndian?r:7-r));A&&(i?0!==a&&(a=255&~(a-1),i=!1):a=255&~a),t+=a*256**r}return A&&(t=-t),t}readOffset(e){return this._bigTiff?this.readUint64(e):this.readUint32(e)}}class da{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 Ia extends Error{constructor(e){super(e),Error.captureStackTrace&&Error.captureStackTrace(this,Ia),this.name="AbortError"}}class ua extends da{constructor(e){super(),this.arrayBuffer=e}fetchSlice(e,t){if(t&&t.aborted)throw new Ia("Request aborted");return this.arrayBuffer.slice(e.offset,e.offset+e.length)}}function Ba(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 Ca(e,t,A){let i=0,r=e.length;const a=r/A;for(;r>t;){for(let A=t;A>0;--A)e[i+t]+=e[i],++i;r-=t}const n=e.slice();for(let t=0;t<a;++t)for(let i=0;i<A;++i)e[A*t+i]=n[(A-i-1)*a+t]}class Ea{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,a){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 n=r[0]/8,s=2===a?1:r.length;for(let a=0;a<i&&!(a*s*A*n>=e.byteLength);++a){let i;if(2===t){switch(r[0]){case 8:i=new Uint8Array(e,a*s*A*n,s*A*n);break;case 16:i=new Uint16Array(e,a*s*A*n,s*A*n/2);break;case 32:i=new Uint32Array(e,a*s*A*n,s*A*n/4);break;default:throw new Error(`Predictor 2 not allowed with ${r[0]} bits per sample.`)}Ba(i,s)}else 3===t&&(i=new Uint8Array(e,a*s*A*n,s*A*n),Ca(i,s,n))}return e}(A,i,t?e.TileWidth:e.ImageWidth,t?e.TileLength:e.RowsPerStrip||e.ImageLength,e.BitsPerSample,e.PlanarConfiguration)}return A}}function wa(e){switch(e){case Kr.BYTE:case Kr.ASCII:case Kr.SBYTE:case Kr.UNDEFINED:return 1;case Kr.SHORT:case Kr.SSHORT:return 2;case Kr.LONG:case Kr.SLONG:case Kr.FLOAT:case Kr.IFD:return 4;case Kr.RATIONAL:case Kr.SRATIONAL:case Kr.DOUBLE:case Kr.LONG8:case Kr.SLONG8:case Kr.IFD8:return 8;default:throw new RangeError(`Invalid field type: ${e}`)}}function Qa(e,t,A,i){let r=null,a=null;const n=wa(t);switch(t){case Kr.BYTE:case Kr.ASCII:case Kr.UNDEFINED:r=new Uint8Array(A),a=e.readUint8;break;case Kr.SBYTE:r=new Int8Array(A),a=e.readInt8;break;case Kr.SHORT:r=new Uint16Array(A),a=e.readUint16;break;case Kr.SSHORT:r=new Int16Array(A),a=e.readInt16;break;case Kr.LONG:case Kr.IFD:r=new Uint32Array(A),a=e.readUint32;break;case Kr.SLONG:r=new Int32Array(A),a=e.readInt32;break;case Kr.LONG8:case Kr.IFD8:r=new Array(A),a=e.readUint64;break;case Kr.SLONG8:r=new Array(A),a=e.readInt64;break;case Kr.RATIONAL:r=new Uint32Array(2*A),a=e.readUint32;break;case Kr.SRATIONAL:r=new Int32Array(2*A),a=e.readInt32;break;case Kr.FLOAT:r=new Float32Array(A),a=e.readFloat32;break;case Kr.DOUBLE:r=new Float64Array(A),a=e.readFloat64;break;default:throw new RangeError(`Invalid field type: ${t}`)}if(t!==Kr.RATIONAL&&t!==Kr.SRATIONAL)for(let t=0;t<A;++t)r[t]=a.call(e,i+t*n);else for(let t=0;t<A;t+=2)r[t]=a.call(e,i+t*n),r[t+1]=a.call(e,i+(t*n+4));return t===Kr.ASCII?new TextDecoder("utf-8").decode(r):r}class ma{constructor(e,t,A){this.fileDirectory=e,this.geoKeyDirectory=t,this.nextIFDByteOffset=A}}class pa extends Error{constructor(e){super(`No image at index ${e}`),this.index=e}}class ya{async readRasters(e={}){const{window:t,width:A,height:i}=e;let{resX:r,resY:a,bbox:n}=e;const s=await this.getImage();let o=s;const l=await this.getImageCount(),g=s.getBoundingBox();if(t&&n)throw new Error('Both "bbox" and "window" passed.');if(A||i){if(t){const[e,A]=s.getOrigin(),[i,r]=s.getResolution();n=[e+t[0]*i,A+t[1]*r,e+t[2]*i,A+t[3]*r]}const e=n||g;if(A){if(r)throw new Error("Both width and resX passed");r=(e[2]-e[0])/A}if(i){if(a)throw new Error("Both width and resY passed");a=(e[3]-e[1])/i}}if(r||a){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(),n=(g[3]-g[1])/A.getHeight();if(o=A,r&&r>i||a&&a>n)break}}let h=t;if(n){const[e,t]=s.getOrigin(),[A,i]=o.getResolution(s);h=[Math.round((n[0]-e)/A),Math.round((n[1]-t)/i),Math.round((n[2]-e)/A),Math.round((n[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 _a extends ya{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 ca((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),a=r*t+(this.bigTiff?16:6);i.covers(e,a)||(i=await this.getSlice(e,a));const n={};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,a;const o=wa(t),l=s+(this.bigTiff?12:8);if(o*A<=(this.bigTiff?8:4))r=Qa(i,t,A,l);else{const e=i.readOffset(l),a=wa(t)*A;if(i.covers(e,a))r=Qa(i,t,A,e);else{r=Qa(await this.getSlice(e,a),t,A,e)}}a=1===A&&-1===Pr.indexOf(e)&&t!==Kr.RATIONAL&&t!==Kr.SRATIONAL?r[0]:r,n[Nr[e]]=a}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=Aa[t[i]],a=t[i+1]?Nr[t[i+1]]:null,n=t[i+2],s=t[i+3];let o=null;if(a){if(o=e[a],null==o)throw new Error(`Could not get value of geoKey '${r}'.`);"string"==typeof o?o=o.substring(s,s+n-1):o.subarray&&(o=o.subarray(s,s+n),1===n&&(o=o[0]))}else o=s;A[r]=o}return A}(n),l=i.readOffset(e+A+t*r);return new ma(n,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 pa)throw new pa(e);throw t}return this.ifdRequests[e]=(async()=>{const t=await this.ifdRequests[e-1];if(0===t.nextIFDByteOffset)throw new pa(e);return this.parseFileDirectoryAt(t.nextIFDByteOffset)})(),this.ifdRequests[e]}async getImage(e=0){const t=await this.requestIFD(e);return new ha(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 pa))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===Qa(i,Kr.ASCII,t.length,e)){const t=Qa(i,Kr.ASCII,A,e).split("\n")[0],r=Number(t.split("=")[1].split(" ")[0])+t.length;r>A&&(i=await this.getSlice(e,r));const a=Qa(i,Kr.ASCII,r,e);this.ghostValues={},a.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 fa(i),a=r.getUint16(0,0);let n;if(18761===a)n=!0;else{if(19789!==a)throw new TypeError("Invalid byte order value.");n=!1}const s=r.getUint16(2,n);let o;if(42===s)o=!1;else{if(43!==s)throw new TypeError("Invalid magic number.");o=!0;if(8!==r.getUint16(4,n))throw new Error("Unsupported offset byte-size.")}const l=o?r.getUint64(8,n):r.getUint32(4,n);return new _a(e,n,o,l,t)}close(){return"function"==typeof this.source.close&&this.source.close()}}async function ba(e,t){return _a.fromSource(function(e){return new ua(e)}(e),t)}class Da{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,a=0,n=0,s=0,o=0;for(1&A?a=n=s=t:i=r=o=t;(A>>=1)>1;){const e=i+a>>1,t=r+n>>1;1&A?(a=i,n=r,i=s,r=o):(i=a,r=n,a=s,n=o),s=e,o=t}const l=4*e;this.coords[l+0]=i,this.coords[l+1]=r,this.coords[l+2]=a,this.coords[l+3]=n}}createTile(e){return new ka(e,this)}}class ka{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:a}=this;for(let n=e-1;n>=0;n--){const e=4*n,s=A[e+0],o=A[e+1],l=A[e+2],g=A[e+3],h=s+l>>1,f=o+g>>1,c=h+f-o,d=f+s-h,I=(r[o*i+s]+r[g*i+l])/2,u=f*i+h,B=Math.abs(I-r[u]);if(a[u]=Math.max(a[u],B),n<t){const e=(o+d>>1)*i+(s+c>>1),t=(g+d>>1)*i+(l+c>>1);a[u]=Math.max(a[u],a[e],a[t])}}}getMesh(e=0){const{gridSize:t,indices:A}=this.martini,{errors:i}=this;let r=0,a=0;const n=t-1;function s(n,o,l,g,h,f){const c=n+l>>1,d=o+g>>1;Math.abs(n-h)+Math.abs(o-f)>1&&i[d*t+c]>e?(s(h,f,n,o,c,d),s(l,g,h,f,c,d)):(A[o*t+n]=A[o*t+n]||++r,A[g*t+l]=A[g*t+l]||++r,A[f*t+h]=A[f*t+h]||++r,a++)}A.fill(0),s(0,0,n,n,n,0),s(n,n,0,0,0,n);const o=new Uint16Array(2*r),l=new Uint32Array(3*a);let g=0;function h(r,a,n,s,f,c){const d=r+n>>1,I=a+s>>1;if(Math.abs(r-f)+Math.abs(a-c)>1&&i[I*t+d]>e)h(f,c,r,a,d,I),h(n,s,f,c,d,I);else{const e=A[a*t+r]-1,i=A[s*t+n]-1,h=A[c*t+f]-1;o[2*e]=r,o[2*e+1]=a,o[2*i]=n,o[2*i+1]=s,o[2*h]=f,o[2*h+1]=c,l[g++]=e,l[g++]=i,l[g++]=h}}return h(0,0,n,n,n,0),h(n,n,0,0,0,n),{vertices:o,triangles:l}}}function va(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 a=0;for(;a<i.length;)i[a][0]===(null===(t=i[a+1])||void 0===t?void 0:t[1])&&i[a][1]===(null===(A=i[a+1])||void 0===A?void 0:A[0])?a+=2:(r.push(i[a]),a++);return r}(t),a=new e.POSITION.value.constructor(6*r.length),n=new e.TEXCOORD_0.value.constructor(4*r.length),s=new t.constructor(6*r.length);for(let t=0;t<r.length;t++){Sa({edge:r[t],edgeIndex:t,attributes:e,skirtHeight:A,newPosition:a,newTexcoord0:n,newTriangles:s})}e.POSITION.value=w.concatenateTypedArrays(e.POSITION.value,a),e.TEXCOORD_0.value=w.concatenateTypedArrays(e.TEXCOORD_0.value,n);return{attributes:e,triangles:t instanceof Array?t.concat(s):w.concatenateTypedArrays(t,s)}}function Sa({edge:e,edgeIndex:t,attributes:A,skirtHeight:i,newPosition:r,newTexcoord0:a,newTriangles:n}){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,a.set(A.TEXCOORD_0.value.subarray(2*e[0],2*e[0]+2),2*o),a.set(A.TEXCOORD_0.value.subarray(2*e[1],2*e[1]+2),2*l);const g=2*t*3;n[g]=e[0],n[g+1]=s/3+l,n[g+2]=e[1],n[g+3]=s/3+l,n[g+4]=e[0],n[g+5]=s/3+o}const xa={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:C.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 Ga{constructor(){this.scale=(e,t,A,i,r)=>(e-t)*(r-i)/(A-t)+i}setUrl(e){return m(this,void 0,void 0,(function*(){const t=yield fetch(e),A=yield t.arrayBuffer(),i=yield ba(A),r=yield i.getImage(0);this.data=r}))}getMap(e,t,A){return m(this,void 0,void 0,(function*(){const i=Object.assign(Object.assign({},xa),t);switch(i.type){case"image":return this.getBitmap(e,i);case"terrain":return this.getHeightmap(e,i,A);default:return null}}))}getHeightmap(e,t,A){return m(this,void 0,void 0,(function*(){let i,r,a=[];"string"==typeof e?(yield this.setUrl(e),a=yield this.data.readRasters(),i=this.data.getWidth(),r=this.data.getHeight()):(a=e.rasters,i=e.width,r=e.height);let n=a[0];null!=t.useChannel&&a[t.useChannel]&&(n=a[t.useChannel]);const s=new Float32Array((i+1)*(r+1)),o=n.length/(i*r);let l=null===t.useChannel?0:t.useChannel;for(let e=0,A=0;A<r;A++)for(let r=0;r<i;r++,e++){const i=t.noDataValue&&n[l]===t.noDataValue?t.terrainMinValue:n[l]*t.multiplier;s[e+A]=i,l+=o}for(let e=(i+1)*i,t=0;t<i;t++,e++)s[e]=s[e-i-1];for(let e=r,t=0;t<r+1;t++,e+=r+1)s[e]=s[e-1];const{terrainSkirtHeight:g}=t;let h;h=Ua(A,i,s);const{vertices:f}=h;let{triangles:c}=h,d=function(e,t,A,i,r){const a=A+1,n=e.length/2,s=new Float32Array(3*n),o=new Float32Array(2*n),[l,g,h,f]=r||[0,0,A,i],c=(h-l)/A,d=(f-g)/i;for(let r=0;r<n;r++){const n=e[2*r],g=e[2*r+1],h=g*a+n;s[3*r+0]=n*c+l,s[3*r+1]=-g*d+f,s[3*r+2]=t[h],o[2*r+0]=n/A,o[2*r+1]=g/i}return{POSITION:{value:s,size:3},TEXCOORD_0:{value:o,size:2}}}(f,s,i,r,e.bounds);const I=E.getMeshBoundingBox(d);if(g){const{attributes:e,triangles:t}=va(d,c,g);d=e,c=t}return{loaderData:{header:{}},header:{vertexCount:c.length,boundingBox:I},mode:4,indices:{value:Uint32Array.from(c),size:1},attributes:d}}))}getBitmap(e,t){return m(this,void 0,void 0,(function*(){const A=Object.assign({},t);let i,r,a,n=[];"string"==typeof e?(yield this.setUrl(e),n=yield this.data.readRasters(),i=n.length,r=this.data.getWidth(),a=this.data.getHeight()):(n=e.rasters,i=n.length,r=e.width,a=e.height);const s=document.createElement("canvas");s.width=r,s.height=a;const o=s.getContext("2d"),l=o.createImageData(r,a);let g,h,f,c;const d=r*a*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(n[0].length/(r*a)==1){const e=n[0];A.useAutoRange&&(A.colorScaleValueRange=this.getMinMax(e,A));this.getColorValue(e,A,d).forEach(((e,t)=>{l.data[t]=e}))}if(n[0].length/(r*a)==3){let e=0;for(let t=0;t<d;t+=4){const i=[n[0][e],n[0][e+1],n[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}}n[0].length/(r*a)==4&&n[0].forEach(((e,t)=>{l.data[t]=e}))}if(3===i){let e=0;for(let t=0;t<d;t+=4)g=n[0][e],h=n[1][e],f=n[2][e],c=Math.floor(2.55*A.alpha),l.data[t]=g,l.data[t+1]=h,l.data[t+2]=f,l.data[t+3]=c,e+=1}if(4===i){let e=0;for(let t=0;t<d;t+=4)g=n[0][e],h=n[1][e],f=n[2][e],c=Math.floor(2.55*A.alpha),l.data[t]=g,l.data[t+1]=h,l.data[t+2]=f,l.data[t+3]=c,e+=1}}else if(A.useChannel<=A.numOfChannels){let e=n[0];n[A.useChannel]&&(e=n[A.useChannel]),A.useAutoRange&&(A.colorScaleValueRange=this.getMinMax(e,A));const t=e.length/(r*a);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 r=C.scale(t.colorScale).domain(t.colorScaleValueRange);let a=null===t.useChannel?0:t.useChannel;const n=new Array(A),s=t.colorsBasedOnValues?t.colorsBasedOnValues.map((([e])=>e)):void 0,o=t.colorsBasedOnValues?t.colorsBasedOnValues.map((([,e])=>[...C(e).rgb(),Math.floor(2.55*t.alpha)])):void 0,l=t.useColorClasses?t.colorClasses.map((([e])=>[...C(e).rgb(),Math.floor(2.55*t.alpha)])):void 0,g=t.useColorClasses?t.colorClasses.map((([,e])=>e)):void 0,h=t.useColorClasses?t.colorClasses.map((([,,e],A)=>void 0!==e?e:A===t.colorClasses.length-1?[!0,!0]:[!0,!1])):void 0;for(let f=0;f<A;f+=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=[...r(e[a]).rgb(),Math.floor(2.55*t.alpha)]),t.useColorsBasedOnValues){const i=s.indexOf(e[a]);A=i>-1?o[i]:t.unidentifiedColor}if(t.useColorClasses){const i=this.findClassIndex(e[a],g,h);A=i>-1?l[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]);[n[f],n[f+1],n[f+2],n[f+3]]=A,a+=i}return n}findClassIndex(e,t,A){for(let i=0;i<t.length;i+=1){const[r,a]=t[i],[n,s]=A[i];if((n?e>=r:e>r)&&(s?e<=a:e<a))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:[...C(e).rgb(),255]}hasPixelsNoData(e,t){return void 0!==t&&e.every((e=>e===t))}}function Ua(e,t,A){const i=new Da(t+1).createTile(A),{vertices:r,triangles:a}=i.getMesh(e);return{vertices:r,triangles:a}}const Fa=40075e3,Ra=20037500;class La{constructor(e){this.zoomRange=[0,0],this.lowestOriginTileOffset=[0,0],this.lowestOriginTileSize=0,this.loaded=!1,this.geo=new Ga,this.lzw=new wi,this.options=e}initializeCog(e){return m(this,void 0,void 0,(function*(){X.fetch=(e,t)=>m(this,void 0,void 0,(function*(){return yield fetch(e,t)}));const t=new X(e);return this.cog=yield H.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]),a=Math.max(t[1],t[3]),n=this.getLatLon([A,r]),s=this.getLatLon([i,a]);return[n[0],n[1],s[0],s[1]]}getOriginAsLatLon(e){const{origin:t}=e.images[e.images.length-1];return this.getLatLon(t)}getImageTileIndex(e){const t=Ra+e.origin[0],A=-(Ra+(e.origin[1]-Fa)),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 Fa/e/Math.pow(2,t)}getZoomLevelFromResolution(e,t){return Math.round(Math.log2(Fa/(t*e)))}getLatLon(e){const t=function(e){const[t,A]=e,i=t/512*(2*hi)-hi,r=2*(Math.atan(Math.exp(A/512*(2*hi)-hi))-fi);return[i*ci,r*ci]}([12776044915782906e-21*(Ra+e[0]),12776044915782906e-21*-(Ra+(e[1]-Fa))]);return[t[0],-t[1]]}getTile(e,t,A,i,r){return m(this,void 0,void 0,(function*(){const a=this.getResolutionFromZoomLevel(this.tileSize,A),n=this.cog.getImageByResolution(a);let s=[0,0];if(A===this.zoomRange[0])s=this.lowestOriginTileOffset;else{const e=Math.pow(2,A-this.zoomRange[0]);s[0]=Math.floor(this.lowestOriginTileOffset[0]*e),s[1]=Math.floor(this.lowestOriginTileOffset[1]*e)}const o=n.tileCount.x,l=n.tileCount.y,g=s[0],h=s[1];let f,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 d=n.tags.get(258).value;if(Array.isArray(d))if("terrain"===this.options.type){let e=0;d.forEach((t=>{e+=t})),d=e}else[d]=d;if(e-g>=0&&t-h>=0&&e-g<o&&t-h<l){const A=yield n.getTile(e-g,t-h);switch(n.compression){case"image/jpeg":c=gi.decode(A.bytes,{useTArray:!0});break;case"application/deflate":c=yield ai(A.bytes);break;case"application/lzw":c=this.lzw.decodeBlock(A.bytes.buffer);break;default:console.warn(`Unexpected compression method: ${n.compression}`)}let a;switch(this.options.format){case"uint8":a=new Uint8Array(c.buffer);break;case"uint16":a=new Uint16Array(c.buffer);break;case"uint32":a=new Uint32Array(c.buffer);break;case"int8":a=new Int8Array(c.buffer);break;case"int16":a=new Int16Array(c.buffer);break;case"int32":a=new Int32Array(c.buffer);break;case"float32":a=new Float32Array(c.buffer);break;case"float64":a=new Float64Array(c.buffer);break;default:a=null}return f=yield this.geo.getMap({rasters:[a],width:this.tileSize,height:this.tileSize,bounds:i},this.options,r),f}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)}}}class Ma extends d.CompositeLayer{constructor(e,t,A){super({}),this.id="",this.id=e,this.cogTiles=new La(A),this.blurredTexture=A.blurredTexture,this.url=t}initializeState(){this.state={initialized:!1},this.init(this.url)}init(e){return m(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 I.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,A,i,r,a,n,s;const{bbox:{west:o,south:l,east:g,north:h}}=e.tile;return new u.BitmapLayer(e,Object.assign({data:null,image:e.data,bounds:[o,l,g,h],opacity:1,textureParameters:{minFilter:this.blurredTexture?"linear":"nearest",magFilter:this.blurredTexture?"linear":"nearest"},extensions:(null===(A=null===(t=this.cogTiles)||void 0===t?void 0:t.options)||void 0===A?void 0:A.clampToTerrain)?[new B._TerrainExtension]:[]},(null===(a=null===(r=null===(i=this.cogTiles)||void 0===i?void 0:i.options)||void 0===r?void 0:r.clampToTerrain)||void 0===a?void 0:a.terrainDrawMode)?{terrainDrawMode:null===(s=null===(n=this.cogTiles)||void 0===n?void 0:n.options)||void 0===s?void 0:s.clampToTerrain.terrainDrawMode}:{}))}})}return null}}Ma.layerName="CogBitmapLayer",Ma.displayName="CogBitmapLayer";const Ta={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 A=e.length;if(A!==t.length)return!1;for(let i=0;i<A;i++)if(e[i]!==t[i])return!1;return!0}},Na=[1],Oa=Object.assign(Object.assign({},I.TileLayer.defaultProps),{elevationData:Ta,texture:Object.assign(Object.assign({},Ta),{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 Pa extends d.CompositeLayer{initializeState(e){const t=Object.create(null,{initializeState:{get:()=>super.initializeState}});return m(this,void 0,void 0,(function*(){t.initializeState.call(this,e),this.setState({terrainCogTiles:new La(this.props.terrainOptions),initialized:!1}),yield this.init(this.terrainUrl)}))}init(e){return m(this,void 0,void 0,(function*(){const e=yield this.state.terrainCogTiles.initializeCog(this.props.elevationData),t=this.state.terrainCogTiles.getZoomRange(e);[this.minZoom,this.maxZoom]=t,this.setState({initialized:!0})}))}updateState({props:e,oldProps:t}){const A=e.elevationData!==t.elevationData;if(A){const{elevationData:t}=e,A=t&&(Array.isArray(t)||t.includes("{x}")&&t.includes("{y}"))||this.props.isTiled;this.setState({isTiled:A})}A||e.meshMaxError!==t.meshMaxError||e.elevationDecoder!==t.elevationDecoder||(e.bounds,t.bounds);this.state.isTiled,e.workerUrl&&d.log.removed("workerUrl","loadOptions.terrain.workerUrl")()}loadTerrain({elevationData:e,bounds:t,elevationDecoder:A,meshMaxError:i,signal:r}){if(!e)return null;let a=this.getLoadOptions();a=Object.assign(Object.assign({},a),{_workerType:"test",terrain:Object.assign(Object.assign({skirtHeight:this.state.isTiled?2*i:0},null==a?void 0:a.terrain),{bounds:t,meshMaxError:i,elevationDecoder:A})});const{fetch:n}=this.props;return n(e,{propName:"elevationData",layer:this,loadOptions:a,signal:r,loaders:[]})}getTiledTerrainData(e){return m(this,void 0,void 0,(function*(){this.props;const{viewport:t}=this.context;let A=[0,0],i=[0,0];if(t.isGeospatial){const r=e.bbox;A=t.projectFlat([r.west,r.south]),i=t.projectFlat([r.east,r.north])}else{const t=e.bbox;A=[t.left,t.bottom],i=[t.right,t.top]}const r=[A[0],A[1],i[0],i[1]],a=yield this.state.terrainCogTiles.getTile(e.index.x,e.index.y,e.index.z,r,this.props.meshMaxError);return Promise.all([a])}))}renderSubLayers(e){const t=this.getSubLayerClass("mesh",Q.SimpleMeshLayer),{color:A,wireframe:i,material:r}=this.props,{data:a}=e;if(!a)return null;const[n]=a;return new t(Object.assign(Object.assign({},e),{tileSize:256}),{data:Na,mesh:n,_instanced:!1,coordinateSystem:d.COORDINATE_SYSTEM.CARTESIAN,getPosition:e=>[0,0,0],getColor:A,wireframe:i,material:r})}onViewportLoad(e){if(!e)return;const{zRange:t}=this.state,A=e.map((e=>e.content)).filter((e=>e&&e[0])).map((e=>{var t,A;const i=null===(A=null===(t=e[0])||void 0===t?void 0:t.header)||void 0===A?void 0:A.boundingBox;return null==i?void 0:i.map((e=>e[2]))}));if(0===A.length)return;const i=Math.min(...A.map((e=>e[0]))),r=Math.max(...A.map((e=>e[1])));(!t||i<t[0]||r>t[1])&&this.setState({zRange:[Number.isFinite(i)?i:0,Number.isFinite(r)?r:0]})}renderLayers(){const{color:e,material:t,elevationData:A,texture:i,wireframe:r,meshMaxError:a,elevationDecoder:n,tileSize:s,maxZoom:o,minZoom:l,extent:g,maxRequests:h,onTileLoad:f,onTileUnload:c,onTileError:d,maxCacheSize:u,maxCacheByteSize:B,refinementStrategy:C}=this.props;if(this.state.isTiled&&this.state.initialized)return new I.TileLayer(this.getSubLayerProps({id:"tiles"}),{getTileData:this.getTiledTerrainData.bind(this),renderSubLayers:this.renderSubLayers.bind(this),updateTriggers:{getTileData:{elevationData:(E=A,Array.isArray(E)?E.join(";"):E||""),meshMaxError:a,elevationDecoder:n}},onViewportLoad:this.onViewportLoad.bind(this),zRange:this.state.zRange||null,tileSize:s,maxZoom:o,minZoom:l,extent:g,maxRequests:h,onTileLoad:f,onTileUnload:c,onTileError:d,maxCacheSize:u,maxCacheByteSize:B,refinementStrategy:C});var E}}Pa.defaultProps=Oa,Pa.layerName="TerrainLayer";var za={CogBitmapLayer:Ma,CogTerrainLayer:Pa,cogtiles:La,GeoImage:Ga};var Ka=Object.freeze({__proto__:null,default:class extends Ea{decodeBlock(e){return e}}});const qa=257;function Ja(e,t){for(let A=t.length-1;A>=0;A--)e.push(t[A]);return e}function Ha(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,a=0;function n(){i=258,r=9}function s(e){const t=function(e,t,A){const i=t%8,r=Math.floor(t/8),a=8-i,n=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)"),qa;let l=e[r]&2**(8-i)-1;l<<=A-a;let g=l;if(r+1<e.length){let t=e[r+1]>>>s;t<<=Math.max(0,A-o),g+=t}if(n>8&&r+2<e.length){const i=8*(r+3)-(t+A);g+=e[r+2]>>>i}return g}(e,a,r);return a+=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=[];n();const h=new Uint8Array(e);let f,c=s(h);for(;c!==qa;){if(256===c){for(n(),c=s(h);256===c;)c=s(h);if(c===qa)break;if(c>256)throw new Error(`corrupted code at scanline ${c}`);Ja(g,l(c)),f=c}else if(c<i){const e=l(c);Ja(g,e),o(f,e[e.length-1]),f=c}else{const e=l(f);if(!e)throw new Error(`Bogus entry. Not in dictionary, ${f} / ${i}, position: ${a}`);Ja(g,e),g.push(e[e.length-1]),o(f,e[e.length-1]),f=c}i+1>=2**r&&(12===r?f=void 0:r++),c=s(h)}return new Uint8Array(g)}var Ya=Object.freeze({__proto__:null,default:class extends Ea{decodeBlock(e){return Ha(e).buffer}}});const Va=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]),Za=4017,ja=799,Xa=3406,Wa=2276,$a=1567,en=3784,tn=5793,An=2896;function rn(e,t){let A=0;const i=[];let r=16;for(;r>0&&!e[r-1];)--r;i.push({children:[],index:0});let a,n=i[0];for(let s=0;s<r;s++){for(let r=0;r<e[s];r++){for(n=i.pop(),n.children[n.index]=t[A];n.index>0;)n=i.pop();for(n.index++,i.push(n);i.length<=s;)i.push(a={children:[],index:0}),n.children[n.index]=a.children,n=a;A++}s+1<r&&(i.push(a={children:[],index:0}),n.children[n.index]=a.children,n=a)}return i[0].children}function an(e,t,A,i,r,a,n,s,o){const{mcusPerLine:l,progressive:g}=A,h=t;let f=t,c=0,d=0;function I(){if(d>0)return d--,c>>d&1;if(c=e[f++],255===c){const t=e[f++];if(t)throw new Error(`unexpected marker: ${(c<<8|t).toString(16)}`)}return d=7,c>>>7}function u(e){let t,A=e;for(;null!==(t=I());){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=I();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 a=A%l,n=(A/l|0)*e.v+i,s=a*e.h+r;t(e,e.blocks[n][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,S;S=g?0===a?0===s?function(e,t){const A=u(e.huffmanTableDC),i=0===A?0:C(A)<<o;e.pred+=i,t[0]=e.pred}:function(e,t){t[0]|=I()<<o}:0===s?function(e,t){if(E>0)return void E--;let A=a;const i=n;for(;A<=i;){const i=u(e.huffmanTableAC),r=15&i,a=i>>4;if(0===r){if(a<15){E=B(a)+(1<<a)-1;break}A+=16}else A+=a,t[Va[A]]=C(r)*(1<<o),A++}}:function(e,t){let A=a;const i=n;let r=0;for(;A<=i;){const i=Va[A],a=t[i]<0?-1:1;switch(Q){case 0:{const t=u(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]+=(I()<<o)*a:(r--,0===r&&(Q=2===Q?3:0));break;case 3:t[i]?t[i]+=(I()<<o)*a:(t[i]=w<<o,Q=0);break;case 4:t[i]&&(t[i]+=(I()<<o)*a)}A++}4===Q&&(E--,0===E&&(Q=0))}:function(e,t){const A=u(e.huffmanTableDC),i=0===A?0:C(A);e.pred+=i,t[0]=e.pred;let r=1;for(;r<64;){const A=u(e.huffmanTableAC),i=15&A,a=A>>4;if(0===i){if(a<15)break;r+=16}else r+=a,t[Va[r]]=C(i),r++}};let x,G,U=0;G=1===y?i[0].blocksPerLine*i[0].blocksPerColumn:l*A.mcusPerColumn;const F=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<F;v++)p(_,S,U),U++;else for(v=0;v<F;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(_,S,U,D,k)}if(U++,U===G)break}if(d=0,x=e[f]<<8|e[f+1],x<65280)throw new Error("marker was not found");if(!(x>=65488&&x<=65495))break;f+=2}return f-h}function nn(e,t){const A=[],{blocksPerLine:i,blocksPerColumn:r}=t,a=i<<3,n=new Int32Array(64),s=new Uint8Array(64);function o(e,A,i){const r=t.quantizationTable;let a,n,s,o,l,g,h,f,c;const d=i;let I;for(I=0;I<64;I++)d[I]=e[I]*r[I];for(I=0;I<8;++I){const e=8*I;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]?(a=tn*d[0+e]+128>>8,n=tn*d[4+e]+128>>8,s=d[2+e],o=d[6+e],l=An*(d[1+e]-d[7+e])+128>>8,f=An*(d[1+e]+d[7+e])+128>>8,g=d[3+e]<<4,h=d[5+e]<<4,c=a-n+1>>1,a=a+n+1>>1,n=c,c=s*en+o*$a+128>>8,s=s*$a-o*en+128>>8,o=c,c=l-h+1>>1,l=l+h+1>>1,h=c,c=f+g+1>>1,g=f-g+1>>1,f=c,c=a-o+1>>1,a=a+o+1>>1,o=c,c=n-s+1>>1,n=n+s+1>>1,s=c,c=l*Wa+f*Xa+2048>>12,l=l*Xa-f*Wa+2048>>12,f=c,c=g*ja+h*Za+2048>>12,g=g*Za-h*ja+2048>>12,h=c,d[0+e]=a+f,d[7+e]=a-f,d[1+e]=n+h,d[6+e]=n-h,d[2+e]=s+g,d[5+e]=s-g,d[3+e]=o+l,d[4+e]=o-l):(c=tn*d[0+e]+512>>10,d[0+e]=c,d[1+e]=c,d[2+e]=c,d[3+e]=c,d[4+e]=c,d[5+e]=c,d[6+e]=c,d[7+e]=c)}for(I=0;I<8;++I){const e=I;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]?(a=tn*d[0+e]+2048>>12,n=tn*d[32+e]+2048>>12,s=d[16+e],o=d[48+e],l=An*(d[8+e]-d[56+e])+2048>>12,f=An*(d[8+e]+d[56+e])+2048>>12,g=d[24+e],h=d[40+e],c=a-n+1>>1,a=a+n+1>>1,n=c,c=s*en+o*$a+2048>>12,s=s*$a-o*en+2048>>12,o=c,c=l-h+1>>1,l=l+h+1>>1,h=c,c=f+g+1>>1,g=f-g+1>>1,f=c,c=a-o+1>>1,a=a+o+1>>1,o=c,c=n-s+1>>1,n=n+s+1>>1,s=c,c=l*Wa+f*Xa+2048>>12,l=l*Xa-f*Wa+2048>>12,f=c,c=g*ja+h*Za+2048>>12,g=g*Za-h*ja+2048>>12,h=c,d[0+e]=a+f,d[56+e]=a-f,d[8+e]=n+h,d[48+e]=n-h,d[16+e]=s+g,d[40+e]=s-g,d[24+e]=o+l,d[32+e]=o-l):(c=tn*i[I+0]+8192>>14,d[0+e]=c,d[8+e]=c,d[16+e]=c,d[24+e]=c,d[32+e]=c,d[40+e]=c,d[48+e]=c,d[56+e]=c)}for(I=0;I<64;++I){const e=128+(d[I]+8>>4);A[I]=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(a));for(let a=0;a<i;a++){o(t.blocks[e][a],s,n);let i=0;const l=a<<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 sn{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 a=Math.ceil(e.samplesPerLine/8/i),n=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=a*t.h,g=n*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=a,e.mcusPerColumn=n}let a=A();if(65496!==a)throw new Error("SOI not found");for(a=A();65497!==a;){switch(a){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===a&&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===a&&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[Va[A]]=e[t++]}else{if(i>>4!=1)throw new Error("DQT: invalid table spec");for(let e=0;e<64;e++){r[Va[e]]=A()}}this.quantizationTables[15&i]=r}break}case 65472:case 65473:case 65474:{A();const i={extended:65473===a,progressive:65474===a,precision:e[t++],scanLines:A(),samplesPerLine:A(),components:{},componentsOrder:[]},n=e[t++];let s;for(let A=0;A<n;A++){s=e[t];const A=e[t+1]>>4,r=15&e[t+1],a=e[t+2];i.componentsOrder.push(s),i.components[s]={h:A,v:r,quantizationIdx:a},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 a=0;for(let A=0;A<16;A++,t++)r[A]=e[t],a+=r[A];const n=new Uint8Array(a);for(let A=0;A<a;A++,t++)n[A]=e[t];A+=17+a,i>>4==0?this.huffmanTablesDC[15&i]=rn(r,n):this.huffmanTablesAC[15&i]=rn(r,n)}break}case 65501:A(),this.resetInterval=A();break;case 65498:{A();const i=e[t++],r=[],a=this.frames[0];for(let A=0;A<i;A++){const A=a.components[e[t++]],i=e[t++];A.huffmanTableDC=this.huffmanTablesDC[i>>4],A.huffmanTableAC=this.huffmanTablesAC[15&i],r.push(A)}const n=e[t++],s=e[t++],o=e[t++],l=an(e,t,a,r,this.resetInterval,n,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 ${a.toString(16)}`)}a=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=[],a=t.samplesPerLine,n=t.scanLines;for(let e=0;e<i.length;e++){const a=A[i[e]];r.push({lines:nn(0,a),scaleX:a.h/t.maxH,scaleY:a.v/t.maxV})}const s=new Uint8Array(a*n*r.length);let o=0;for(let e=0;e<n;++e)for(let t=0;t<a;++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 on=Object.freeze({__proto__:null,default:class extends Ea{constructor(e){super(),this.reader=new sn,e.JPEGTables&&this.reader.parse(e.JPEGTables)}decodeBlock(e){return this.reader.resetFrames(),this.reader.parse(new Uint8Array(e)),this.reader.getResult().buffer}}});
|
|
2
|
+
/*! pako 2.1.0 https://github.com/nodeca/pako @license (MIT AND Zlib) */;function W(e){let t=e.length;for(;--t>=0;)e[t]=0}const $=256,ee=286,te=30,Ae=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]),re=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]),ae=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),ne=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),se=new Array(576);W(se);const oe=new Array(60);W(oe);const le=new Array(512);W(le);const ge=new Array(256);W(ge);const he=new Array(29);W(he);const fe=new Array(te);function ce(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,Ie,ue;function Be(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}W(fe);const Ce=e=>e<256?le[e]:le[256+(e>>>7)],Ee=(e,t)=>{e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255},we=(e,t,A)=>{e.bi_valid>16-A?(e.bi_buf|=t<<e.bi_valid&65535,Ee(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)},Qe=(e,t,A)=>{we(e,A[2*t],A[2*t+1])},me=(e,t)=>{let A=0;do{A|=1&e,e>>>=1,A<<=1}while(--t>0);return A>>>1},pe=(e,t,A)=>{const i=new Array(16);let r,a,n=0;for(r=1;r<=Ae;r++)n=n+A[r-1]<<1,i[r]=n;for(a=0;a<=t;a++){let t=e[2*a+1];0!==t&&(e[2*a]=me(i[t]++,t))}},ye=e=>{let t;for(t=0;t<ee;t++)e.dyn_ltree[2*t]=0;for(t=0;t<te;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},_e=e=>{e.bi_valid>8?Ee(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0},be=(e,t,A,i)=>{const r=2*t,a=2*A;return e[r]<e[a]||e[r]===e[a]&&i[t]<=i[A]},De=(e,t,A)=>{const i=e.heap[A];let r=A<<1;for(;r<=e.heap_len&&(r<e.heap_len&&be(t,e.heap[r+1],e.heap[r],e.depth)&&r++,!be(t,i,e.heap[r],e.depth));)e.heap[A]=e.heap[r],A=r,r<<=1;e.heap[A]=i},ke=(e,t,A)=>{let i,r,a,n,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?Qe(e,r,t):(a=ge[r],Qe(e,a+$+1,t),n=ie[a],0!==n&&(r-=he[a],we(e,r,n)),i--,a=Ce(i),Qe(e,a,A),n=re[a],0!==n&&(i-=fe[a],we(e,i,n)))}while(s<e.sym_next);Qe(e,256,t)},ve=(e,t)=>{const A=t.dyn_tree,i=t.stat_desc.static_tree,r=t.stat_desc.has_stree,a=t.stat_desc.elems;let n,s,o,l=-1;for(e.heap_len=0,e.heap_max=573,n=0;n<a;n++)0!==A[2*n]?(e.heap[++e.heap_len]=l=n,e.depth[n]=0):A[2*n+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,n=e.heap_len>>1;n>=1;n--)De(e,A,n);o=a;do{n=e.heap[1],e.heap[1]=e.heap[e.heap_len--],De(e,A,1),s=e.heap[1],e.heap[--e.heap_max]=n,e.heap[--e.heap_max]=s,A[2*o]=A[2*n]+A[2*s],e.depth[o]=(e.depth[n]>=e.depth[s]?e.depth[n]:e.depth[s])+1,A[2*n+1]=A[2*s+1]=o,e.heap[1]=o++,De(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,a=t.stat_desc.has_stree,n=t.stat_desc.extra_bits,s=t.stat_desc.extra_base,o=t.stat_desc.max_length;let l,g,h,f,c,d,I=0;for(f=0;f<=Ae;f++)e.bl_count[f]=0;for(A[2*e.heap[e.heap_max]+1]=0,l=e.heap_max+1;l<573;l++)g=e.heap[l],f=A[2*A[2*g+1]+1]+1,f>o&&(f=o,I++),A[2*g+1]=f,g>i||(e.bl_count[f]++,c=0,g>=s&&(c=n[g-s]),d=A[2*g],e.opt_len+=d*(f+c),a&&(e.static_len+=d*(r[2*g+1]+c)));if(0!==I){do{for(f=o-1;0===e.bl_count[f];)f--;e.bl_count[f]--,e.bl_count[f+1]+=2,e.bl_count[o]--,I-=2}while(I>0);for(f=o;0!==f;f--)for(g=e.bl_count[f];0!==g;)h=e.heap[--l],h>i||(A[2*h+1]!==f&&(e.opt_len+=(f-A[2*h+1])*A[2*h],A[2*h+1]=f),g--)}})(e,t),pe(A,l,e.bl_count)},Se=(e,t,A)=>{let i,r,a=-1,n=t[1],s=0,o=7,l=4;for(0===n&&(o=138,l=3),t[2*(A+1)+1]=65535,i=0;i<=A;i++)r=n,n=t[2*(i+1)+1],++s<o&&r===n||(s<l?e.bl_tree[2*r]+=s:0!==r?(r!==a&&e.bl_tree[2*r]++,e.bl_tree[32]++):s<=10?e.bl_tree[34]++:e.bl_tree[36]++,s=0,a=r,0===n?(o=138,l=3):r===n?(o=6,l=3):(o=7,l=4))},xe=(e,t,A)=>{let i,r,a=-1,n=t[1],s=0,o=7,l=4;for(0===n&&(o=138,l=3),i=0;i<=A;i++)if(r=n,n=t[2*(i+1)+1],!(++s<o&&r===n)){if(s<l)do{Qe(e,r,e.bl_tree)}while(0!=--s);else 0!==r?(r!==a&&(Qe(e,r,e.bl_tree),s--),Qe(e,16,e.bl_tree),we(e,s-3,2)):s<=10?(Qe(e,17,e.bl_tree),we(e,s-3,3)):(Qe(e,18,e.bl_tree),we(e,s-11,7));s=0,a=r,0===n?(o=138,l=3):r===n?(o=6,l=3):(o=7,l=4)}};let Ge=!1;const Ue=(e,t,A,i)=>{we(e,0+(i?1:0),3),_e(e),Ee(e,A),Ee(e,~A),A&&e.pending_buf.set(e.window.subarray(t,t+A),e.pending),e.pending+=A};var Fe=(e,t,A,i)=>{let r,a,n=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<$;t++)if(0!==e.dyn_ltree[2*t])return 1;return 0})(e)),ve(e,e.l_desc),ve(e,e.d_desc),n=(e=>{let t;for(Se(e,e.dyn_ltree,e.l_desc.max_code),Se(e,e.dyn_dtree,e.d_desc.max_code),ve(e,e.bl_desc),t=18;t>=3&&0===e.bl_tree[2*ne[t]+1];t--);return e.opt_len+=3*(t+1)+5+5+4,t})(e),r=e.opt_len+3+7>>>3,a=e.static_len+3+7>>>3,a<=r&&(r=a)):r=a=A+5,A+4<=r&&-1!==t?Ue(e,t,A,i):4===e.strategy||a===r?(we(e,2+(i?1:0),3),ke(e,se,oe)):(we(e,4+(i?1:0),3),((e,t,A,i)=>{let r;for(we(e,t-257,5),we(e,A-1,5),we(e,i-4,4),r=0;r<i;r++)we(e,e.bl_tree[2*ne[r]+1],3);xe(e,e.dyn_ltree,t-1),xe(e,e.dyn_dtree,A-1)})(e,e.l_desc.max_code+1,e.d_desc.max_code+1,n+1),ke(e,e.dyn_ltree,e.dyn_dtree)),ye(e),i&&_e(e)},Re={_tr_init:e=>{Ge||((()=>{let e,t,A,i,r;const a=new Array(16);for(A=0,i=0;i<28;i++)for(he[i]=A,e=0;e<1<<ie[i];e++)ge[A++]=i;for(ge[A-1]=i,r=0,i=0;i<16;i++)for(fe[i]=r,e=0;e<1<<re[i];e++)le[r++]=i;for(r>>=7;i<te;i++)for(fe[i]=r<<7,e=0;e<1<<re[i]-7;e++)le[256+r++]=i;for(t=0;t<=Ae;t++)a[t]=0;for(e=0;e<=143;)se[2*e+1]=8,e++,a[8]++;for(;e<=255;)se[2*e+1]=9,e++,a[9]++;for(;e<=279;)se[2*e+1]=7,e++,a[7]++;for(;e<=287;)se[2*e+1]=8,e++,a[8]++;for(pe(se,287,a),e=0;e<te;e++)oe[2*e+1]=5,oe[2*e]=me(e,5);de=new ce(se,ie,257,ee,Ae),Ie=new ce(oe,re,0,te,Ae),ue=new ce(new Array(0),ae,0,19,7)})(),Ge=!0),e.l_desc=new Be(e.dyn_ltree,de),e.d_desc=new Be(e.dyn_dtree,Ie),e.bl_desc=new Be(e.bl_tree,ue),e.bi_buf=0,e.bi_valid=0,ye(e)},_tr_stored_block:Ue,_tr_flush_block:Fe,_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*(ge[A]+$+1)]++,e.dyn_dtree[2*Ce(t)]++),e.sym_next===e.sym_end),_tr_align:e=>{we(e,2,3),Qe(e,256,se),(e=>{16===e.bi_valid?(Ee(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 Le=(e,t,A,i)=>{let r=65535&e|0,a=e>>>16&65535|0,n=0;for(;0!==A;){n=A>2e3?2e3:A,A-=n;do{r=r+t[i++]|0,a=a+r|0}while(--n);r%=65521,a%=65521}return r|a<<16|0};const Me=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 Te=(e,t,A,i)=>{const r=Me,a=i+A;e^=-1;for(let A=i;A<a;A++)e=e>>>8^r[255&(e^t[A])];return-1^e},Ne={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"},Oe={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:Pe,_tr_stored_block:ze,_tr_flush_block:Ke,_tr_tally:qe,_tr_align:Je}=Re,{Z_NO_FLUSH:He,Z_PARTIAL_FLUSH:Ye,Z_FULL_FLUSH:Ve,Z_FINISH:Ze,Z_BLOCK:je,Z_OK:Xe,Z_STREAM_END:We,Z_STREAM_ERROR:$e,Z_DATA_ERROR:et,Z_BUF_ERROR:tt,Z_DEFAULT_COMPRESSION:At,Z_FILTERED:it,Z_HUFFMAN_ONLY:rt,Z_RLE:at,Z_FIXED:nt,Z_DEFAULT_STRATEGY:st,Z_UNKNOWN:ot,Z_DEFLATED:lt}=Oe,gt=258,ht=262,ft=42,ct=113,dt=666,It=(e,t)=>(e.msg=Ne[t],t),ut=e=>2*e-(e>4?9:0),Bt=e=>{let t=e.length;for(;--t>=0;)e[t]=0},Ct=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 Et=(e,t,A)=>(t<<e.hash_shift^A)&e.hash_mask;const wt=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))},Qt=(e,t)=>{Ke(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,wt(e.strm)},mt=(e,t)=>{e.pending_buf[e.pending++]=t},pt=(e,t)=>{e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t},yt=(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=Le(e.adler,t,r,A):2===e.state.wrap&&(e.adler=Te(e.adler,t,r,A)),e.next_in+=r,e.total_in+=r,r)},_t=(e,t)=>{let A,i,r=e.max_chain_length,a=e.strstart,n=e.prev_length,s=e.nice_match;const o=e.strstart>e.w_size-ht?e.strstart-(e.w_size-ht):0,l=e.window,g=e.w_mask,h=e.prev,f=e.strstart+gt;let c=l[a+n-1],d=l[a+n];e.prev_length>=e.good_match&&(r>>=2),s>e.lookahead&&(s=e.lookahead);do{if(A=t,l[A+n]===d&&l[A+n-1]===c&&l[A]===l[a]&&l[++A]===l[a+1]){a+=2,A++;do{}while(l[++a]===l[++A]&&l[++a]===l[++A]&&l[++a]===l[++A]&&l[++a]===l[++A]&&l[++a]===l[++A]&&l[++a]===l[++A]&&l[++a]===l[++A]&&l[++a]===l[++A]&&a<f);if(i=gt-(f-a),a=f-gt,i>n){if(e.match_start=t,n=i,i>=s)break;c=l[a+n-1],d=l[a+n]}}}while((t=h[t&g])>o&&0!=--r);return n<=e.lookahead?n:e.lookahead},bt=e=>{const t=e.w_size;let A,i,r;do{if(i=e.window_size-e.lookahead-e.strstart,e.strstart>=t+(t-ht)&&(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),Ct(e),i+=t),0===e.strm.avail_in)break;if(A=yt(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=Et(e,e.ins_h,e.window[r+1]);e.insert&&(e.ins_h=Et(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<ht&&0!==e.strm.avail_in)},Dt=(e,t)=>{let A,i,r,a=e.pending_buf_size-5>e.w_size?e.w_size:e.pending_buf_size-5,n=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<a&&(0===A&&t!==Ze||t===He||A!==i+e.strm.avail_in))break;n=t===Ze&&A===i+e.strm.avail_in?1:0,ze(e,0,0,n),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,wt(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&&(yt(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===n);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),n?4:t!==He&&t!==Ze&&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&&(yt(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,a=r>e.w_size?e.w_size:r,i=e.strstart-e.block_start,(i>=a||(i||t===Ze)&&t!==He&&0===e.strm.avail_in&&i<=r)&&(A=i>r?r:i,n=t===Ze&&0===e.strm.avail_in&&A===i?1:0,ze(e,e.block_start,A,n),e.block_start+=A,wt(e.strm)),n?3:1)},kt=(e,t)=>{let A,i;for(;;){if(e.lookahead<ht){if(bt(e),e.lookahead<ht&&t===He)return 1;if(0===e.lookahead)break}if(A=0,e.lookahead>=3&&(e.ins_h=Et(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-ht&&(e.match_length=_t(e,A)),e.match_length>=3)if(i=qe(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=Et(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=Et(e,e.ins_h,e.window[e.strstart+1]);else i=qe(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(i&&(Qt(e,!1),0===e.strm.avail_out))return 1}return e.insert=e.strstart<2?e.strstart:2,t===Ze?(Qt(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(Qt(e,!1),0===e.strm.avail_out)?1:2},vt=(e,t)=>{let A,i,r;for(;;){if(e.lookahead<ht){if(bt(e),e.lookahead<ht&&t===He)return 1;if(0===e.lookahead)break}if(A=0,e.lookahead>=3&&(e.ins_h=Et(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-ht&&(e.match_length=_t(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=qe(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=Et(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&&(Qt(e,!1),0===e.strm.avail_out))return 1}else if(e.match_available){if(i=qe(e,0,e.window[e.strstart-1]),i&&Qt(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=qe(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<2?e.strstart:2,t===Ze?(Qt(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(Qt(e,!1),0===e.strm.avail_out)?1:2};function St(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 xt=[new St(0,0,0,0,Dt),new St(4,4,8,4,kt),new St(4,5,16,8,kt),new St(4,6,32,32,kt),new St(4,4,16,16,vt),new St(8,16,32,32,vt),new St(8,16,128,128,vt),new St(8,32,128,256,vt),new St(32,128,258,1024,vt),new St(32,258,258,4096,vt)];function Gt(){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=lt,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),Bt(this.dyn_ltree),Bt(this.dyn_dtree),Bt(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),Bt(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(573),Bt(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 Ut=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||t.status!==ft&&57!==t.status&&69!==t.status&&73!==t.status&&91!==t.status&&103!==t.status&&t.status!==ct&&t.status!==dt?1:0},Ft=e=>{if(Ut(e))return It(e,$e);e.total_in=e.total_out=0,e.data_type=ot;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?ft:ct,e.adler=2===t.wrap?0:1,t.last_flush=-2,Pe(t),Xe},Rt=e=>{const t=Ft(e);var A;return t===Xe&&((A=e.state).window_size=2*A.w_size,Bt(A.head),A.max_lazy_match=xt[A.level].max_lazy,A.good_match=xt[A.level].good_length,A.nice_match=xt[A.level].nice_length,A.max_chain_length=xt[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},Lt=(e,t,A,i,r,a)=>{if(!e)return $e;let n=1;if(t===At&&(t=6),i<0?(n=0,i=-i):i>15&&(n=2,i-=16),r<1||r>9||A!==lt||i<8||i>15||t<0||t>9||a<0||a>nt||8===i&&1!==n)return It(e,$e);8===i&&(i=9);const s=new Gt;return e.state=s,s.strm=e,s.status=ft,s.wrap=n,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=a,s.method=A,Rt(e)};var Mt={deflateInit:(e,t)=>Lt(e,t,lt,15,8,st),deflateInit2:Lt,deflateReset:Rt,deflateResetKeep:Ft,deflateSetHeader:(e,t)=>Ut(e)||2!==e.state.wrap?$e:(e.state.gzhead=t,Xe),deflate:(e,t)=>{if(Ut(e)||t>je||t<0)return e?It(e,$e):$e;const A=e.state;if(!e.output||0!==e.avail_in&&!e.input||A.status===dt&&t!==Ze)return It(e,0===e.avail_out?tt:$e);const i=A.last_flush;if(A.last_flush=t,0!==A.pending){if(wt(e),0===e.avail_out)return A.last_flush=-1,Xe}else if(0===e.avail_in&&ut(t)<=ut(i)&&t!==Ze)return It(e,tt);if(A.status===dt&&0!==e.avail_in)return It(e,tt);if(A.status===ft&&0===A.wrap&&(A.status=ct),A.status===ft){let t=lt+(A.w_bits-8<<4)<<8,i=-1;if(i=A.strategy>=rt||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,pt(A,t),0!==A.strstart&&(pt(A,e.adler>>>16),pt(A,65535&e.adler)),e.adler=1,A.status=ct,wt(e),0!==A.pending)return A.last_flush=-1,Xe}if(57===A.status)if(e.adler=0,mt(A,31),mt(A,139),mt(A,8),A.gzhead)mt(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)),mt(A,255&A.gzhead.time),mt(A,A.gzhead.time>>8&255),mt(A,A.gzhead.time>>16&255),mt(A,A.gzhead.time>>24&255),mt(A,9===A.level?2:A.strategy>=rt||A.level<2?4:0),mt(A,255&A.gzhead.os),A.gzhead.extra&&A.gzhead.extra.length&&(mt(A,255&A.gzhead.extra.length),mt(A,A.gzhead.extra.length>>8&255)),A.gzhead.hcrc&&(e.adler=Te(e.adler,A.pending_buf,A.pending,0)),A.gzindex=0,A.status=69;else if(mt(A,0),mt(A,0),mt(A,0),mt(A,0),mt(A,0),mt(A,9===A.level?2:A.strategy>=rt||A.level<2?4:0),mt(A,3),A.status=ct,wt(e),0!==A.pending)return A.last_flush=-1,Xe;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=Te(e.adler,A.pending_buf,A.pending-t,t)),A.gzindex+=r,wt(e),0!==A.pending)return A.last_flush=-1,Xe;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=Te(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=Te(e.adler,A.pending_buf,A.pending-i,i)),wt(e),0!==A.pending)return A.last_flush=-1,Xe;i=0}t=A.gzindex<A.gzhead.name.length?255&A.gzhead.name.charCodeAt(A.gzindex++):0,mt(A,t)}while(0!==t);A.gzhead.hcrc&&A.pending>i&&(e.adler=Te(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=Te(e.adler,A.pending_buf,A.pending-i,i)),wt(e),0!==A.pending)return A.last_flush=-1,Xe;i=0}t=A.gzindex<A.gzhead.comment.length?255&A.gzhead.comment.charCodeAt(A.gzindex++):0,mt(A,t)}while(0!==t);A.gzhead.hcrc&&A.pending>i&&(e.adler=Te(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&&(wt(e),0!==A.pending))return A.last_flush=-1,Xe;mt(A,255&e.adler),mt(A,e.adler>>8&255),e.adler=0}if(A.status=ct,wt(e),0!==A.pending)return A.last_flush=-1,Xe}if(0!==e.avail_in||0!==A.lookahead||t!==He&&A.status!==dt){let i=0===A.level?Dt(A,t):A.strategy===rt?((e,t)=>{let A;for(;;){if(0===e.lookahead&&(bt(e),0===e.lookahead)){if(t===He)return 1;break}if(e.match_length=0,A=qe(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,A&&(Qt(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,t===Ze?(Qt(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(Qt(e,!1),0===e.strm.avail_out)?1:2})(A,t):A.strategy===at?((e,t)=>{let A,i,r,a;const n=e.window;for(;;){if(e.lookahead<=gt){if(bt(e),e.lookahead<=gt&&t===He)return 1;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=3&&e.strstart>0&&(r=e.strstart-1,i=n[r],i===n[++r]&&i===n[++r]&&i===n[++r])){a=e.strstart+gt;do{}while(i===n[++r]&&i===n[++r]&&i===n[++r]&&i===n[++r]&&i===n[++r]&&i===n[++r]&&i===n[++r]&&i===n[++r]&&r<a);e.match_length=gt-(a-r),e.match_length>e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=3?(A=qe(e,1,e.match_length-3),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(A=qe(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),A&&(Qt(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,t===Ze?(Qt(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(Qt(e,!1),0===e.strm.avail_out)?1:2})(A,t):xt[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),Xe;if(2===i&&(t===Ye?Je(A):t!==je&&(ze(A,0,0,!1),t===Ve&&(Bt(A.head),0===A.lookahead&&(A.strstart=0,A.block_start=0,A.insert=0))),wt(e),0===e.avail_out))return A.last_flush=-1,Xe}return t!==Ze?Xe:A.wrap<=0?We:(2===A.wrap?(mt(A,255&e.adler),mt(A,e.adler>>8&255),mt(A,e.adler>>16&255),mt(A,e.adler>>24&255),mt(A,255&e.total_in),mt(A,e.total_in>>8&255),mt(A,e.total_in>>16&255),mt(A,e.total_in>>24&255)):(pt(A,e.adler>>>16),pt(A,65535&e.adler)),wt(e),A.wrap>0&&(A.wrap=-A.wrap),0!==A.pending?Xe:We)},deflateEnd:e=>{if(Ut(e))return $e;const t=e.state.status;return e.state=null,t===ct?It(e,et):Xe},deflateSetDictionary:(e,t)=>{let A=t.length;if(Ut(e))return $e;const i=e.state,r=i.wrap;if(2===r||1===r&&i.status!==ft||i.lookahead)return $e;if(1===r&&(e.adler=Le(e.adler,t,A,0)),i.wrap=0,A>=i.w_size){0===r&&(Bt(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 a=e.avail_in,n=e.next_in,s=e.input;for(e.avail_in=A,e.next_in=0,e.input=t,bt(i);i.lookahead>=3;){let e=i.strstart,t=i.lookahead-2;do{i.ins_h=Et(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,bt(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=n,e.input=s,e.avail_in=a,i.wrap=r,Xe},deflateInfo:"pako deflate (from Nodeca project)"};const Tt=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var Nt={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)Tt(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 Ot=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(e){Ot=!1}const Pt=new Uint8Array(256);for(let e=0;e<256;e++)Pt[e]=e>=252?6:e>=248?5:e>=240?4:e>=224?3:e>=192?2:1;Pt[254]=Pt[254]=1;var zt={string2buf:e=>{if("function"==typeof TextEncoder&&TextEncoder.prototype.encode)return(new TextEncoder).encode(e);let t,A,i,r,a,n=e.length,s=0;for(r=0;r<n;r++)A=e.charCodeAt(r),55296==(64512&A)&&r+1<n&&(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),a=0,r=0;a<s;r++)A=e.charCodeAt(r),55296==(64512&A)&&r+1<n&&(i=e.charCodeAt(r+1),56320==(64512&i)&&(A=65536+(A-55296<<10)+(i-56320),r++)),A<128?t[a++]=A:A<2048?(t[a++]=192|A>>>6,t[a++]=128|63&A):A<65536?(t[a++]=224|A>>>12,t[a++]=128|A>>>6&63,t[a++]=128|63&A):(t[a++]=240|A>>>18,t[a++]=128|A>>>12&63,t[a++]=128|A>>>6&63,t[a++]=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 a=new Array(2*A);for(r=0,i=0;i<A;){let t=e[i++];if(t<128){a[r++]=t;continue}let n=Pt[t];if(n>4)a[r++]=65533,i+=n-1;else{for(t&=2===n?31:3===n?15:7;n>1&&i<A;)t=t<<6|63&e[i++],n--;n>1?a[r++]=65533:t<65536?a[r++]=t:(t-=65536,a[r++]=55296|t>>10&1023,a[r++]=56320|1023&t)}}return((e,t)=>{if(t<65534&&e.subarray&&Ot)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})(a,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+Pt[e[A]]>t?A:t}};var Kt=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 qt=Object.prototype.toString,{Z_NO_FLUSH:Jt,Z_SYNC_FLUSH:Ht,Z_FULL_FLUSH:Yt,Z_FINISH:Vt,Z_OK:Zt,Z_STREAM_END:jt,Z_DEFAULT_COMPRESSION:Xt,Z_DEFAULT_STRATEGY:Wt,Z_DEFLATED:$t}=Oe;function eA(e){this.options=Nt.assign({level:Xt,method:$t,chunkSize:16384,windowBits:15,memLevel:8,strategy:Wt},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 Kt,this.strm.avail_out=0;let A=Mt.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(A!==Zt)throw new Error(Ne[A]);if(t.header&&Mt.deflateSetHeader(this.strm,t.header),t.dictionary){let e;if(e="string"==typeof t.dictionary?zt.string2buf(t.dictionary):"[object ArrayBuffer]"===qt.call(t.dictionary)?new Uint8Array(t.dictionary):t.dictionary,A=Mt.deflateSetDictionary(this.strm,e),A!==Zt)throw new Error(Ne[A]);this._dict_set=!0}}eA.prototype.push=function(e,t){const A=this.strm,i=this.options.chunkSize;let r,a;if(this.ended)return!1;for(a=t===~~t?t:!0===t?Vt:Jt,"string"==typeof e?A.input=zt.string2buf(e):"[object ArrayBuffer]"===qt.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),(a===Ht||a===Yt)&&A.avail_out<=6)this.onData(A.output.subarray(0,A.next_out)),A.avail_out=0;else{if(r=Mt.deflate(A,a),r===jt)return A.next_out>0&&this.onData(A.output.subarray(0,A.next_out)),r=Mt.deflateEnd(this.strm),this.onEnd(r),this.ended=!0,r===Zt;if(0!==A.avail_out){if(a>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},eA.prototype.onData=function(e){this.chunks.push(e)},eA.prototype.onEnd=function(e){e===Zt&&(this.result=Nt.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};const tA=16209;var AA=function(e,t){let A,i,r,a,n,s,o,l,g,h,f,c,d,I,u,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,a=r-(t-e.avail_out),n=r+(e.avail_out-257),s=b.dmax,o=b.wsize,l=b.whave,g=b.wnext,h=b.window,f=b.hold,c=b.bits,d=b.lencode,I=b.distcode,u=(1<<b.lenbits)-1,B=(1<<b.distbits)-1;e:do{c<15&&(f+=y[A++]<<c,c+=8,f+=y[A++]<<c,c+=8),C=d[f&u];t:for(;;){if(E=C>>>24,f>>>=E,c-=E,E=C>>>16&255,0===E)_[r++]=65535&C;else{if(!(16&E)){if(0==(64&E)){C=d[(65535&C)+(f&(1<<E)-1)];continue t}if(32&E){b.mode=16191;break e}e.msg="invalid literal/length code",b.mode=tA;break e}w=65535&C,E&=15,E&&(c<E&&(f+=y[A++]<<c,c+=8),w+=f&(1<<E)-1,f>>>=E,c-=E),c<15&&(f+=y[A++]<<c,c+=8,f+=y[A++]<<c,c+=8),C=I[f&B];A:for(;;){if(E=C>>>24,f>>>=E,c-=E,E=C>>>16&255,!(16&E)){if(0==(64&E)){C=I[(65535&C)+(f&(1<<E)-1)];continue A}e.msg="invalid distance code",b.mode=tA;break e}if(Q=65535&C,E&=15,c<E&&(f+=y[A++]<<c,c+=8,c<E&&(f+=y[A++]<<c,c+=8)),Q+=f&(1<<E)-1,Q>s){e.msg="invalid distance too far back",b.mode=tA;break e}if(f>>>=E,c-=E,E=r-a,Q>E){if(E=Q-E,E>l&&b.sane){e.msg="invalid distance too far back",b.mode=tA;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<n);w=c>>3,A-=w,c-=w<<3,f&=(1<<c)-1,e.next_in=A,e.next_out=r,e.avail_in=A<i?i-A+5:5-(A-i),e.avail_out=r<n?n-r+257:257-(r-n),b.hold=f,b.bits=c};const iA=15,rA=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]),aA=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]),nA=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]),sA=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 oA=(e,t,A,i,r,a,n,s)=>{const o=s.bits;let l,g,h,f,c,d,I=0,u=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,S,x=null;for(I=0;I<=iA;I++)b[I]=0;for(u=0;u<i;u++)b[t[A+u]]++;for(E=o,C=iA;C>=1&&0===b[C];C--);if(E>C&&(E=C),0===C)return r[a++]=20971520,r[a++]=20971520,s.bits=1,0;for(B=1;B<C&&0===b[B];B++);for(E<B&&(E=B),m=1,I=1;I<=iA;I++)if(m<<=1,m-=b[I],m<0)return-1;if(m>0&&(0===e||1!==C))return-1;for(D[1]=0,I=1;I<iA;I++)D[I+1]=D[I]+b[I];for(u=0;u<i;u++)0!==t[A+u]&&(n[D[t[A+u]]++]=u);if(0===e?(_=x=n,d=20):1===e?(_=rA,x=aA,d=257):(_=nA,x=sA,d=0),y=0,u=0,I=B,c=a,w=E,Q=0,h=-1,p=1<<E,f=p-1,1===e&&p>852||2===e&&p>592)return 1;for(;;){k=I-Q,n[u]+1<d?(v=0,S=n[u]):n[u]>=d?(v=x[n[u]-d],S=_[n[u]-d]):(v=96,S=0),l=1<<I-Q,g=1<<w,B=g;do{g-=l,r[c+(y>>Q)+g]=k<<24|v<<16|S|0}while(0!==g);for(l=1<<I-1;y&l;)l>>=1;if(0!==l?(y&=l-1,y+=l):y=0,u++,0==--b[I]){if(I===C)break;I=t[A+n[u]]}if(I>E&&(y&f)!==h){for(0===Q&&(Q=E),c+=B,w=I-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&f,r[h]=E<<24|w<<16|c-a|0}}return 0!==y&&(r[c+y]=I-Q<<24|64<<16|0),s.bits=E,0};const{Z_FINISH:lA,Z_BLOCK:gA,Z_TREES:hA,Z_OK:fA,Z_STREAM_END:cA,Z_NEED_DICT:dA,Z_STREAM_ERROR:IA,Z_DATA_ERROR:uA,Z_MEM_ERROR:BA,Z_BUF_ERROR:CA,Z_DEFLATED:EA}=Oe,wA=16180,QA=16190,mA=16191,pA=16192,yA=16194,_A=16199,bA=16200,DA=16206,kA=16209,vA=e=>(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24);function SA(){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 xA=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||t.mode<wA||t.mode>16211?1:0},GA=e=>{if(xA(e))return IA;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=wA,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,fA},UA=e=>{if(xA(e))return IA;const t=e.state;return t.wsize=0,t.whave=0,t.wnext=0,GA(e)},FA=(e,t)=>{let A;if(xA(e))return IA;const i=e.state;return t<0?(A=0,t=-t):(A=5+(t>>4),t<48&&(t&=15)),t&&(t<8||t>15)?IA:(null!==i.window&&i.wbits!==t&&(i.window=null),i.wrap=A,i.wbits=t,UA(e))},RA=(e,t)=>{if(!e)return IA;const A=new SA;e.state=A,A.strm=e,A.window=null,A.mode=wA;const i=FA(e,t);return i!==fA&&(e.state=null),i};let LA,MA,TA=!0;const NA=e=>{if(TA){LA=new Int32Array(512),MA=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(oA(1,e.lens,0,288,LA,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;oA(2,e.lens,0,32,MA,0,e.work,{bits:5}),TA=!1}e.lencode=LA,e.lenbits=9,e.distcode=MA,e.distbits=5},OA=(e,t,A,i)=>{let r;const a=e.state;return null===a.window&&(a.wsize=1<<a.wbits,a.wnext=0,a.whave=0,a.window=new Uint8Array(a.wsize)),i>=a.wsize?(a.window.set(t.subarray(A-a.wsize,A),0),a.wnext=0,a.whave=a.wsize):(r=a.wsize-a.wnext,r>i&&(r=i),a.window.set(t.subarray(A-i,A-i+r),a.wnext),(i-=r)?(a.window.set(t.subarray(A-i,A),0),a.wnext=i,a.whave=a.wsize):(a.wnext+=r,a.wnext===a.wsize&&(a.wnext=0),a.whave<a.wsize&&(a.whave+=r))),0};var PA={inflateReset:UA,inflateReset2:FA,inflateResetKeep:GA,inflateInit:e=>RA(e,15),inflateInit2:RA,inflate:(e,t)=>{let A,i,r,a,n,s,o,l,g,h,f,c,d,I,u,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(xA(e)||!e.output||!e.input&&0!==e.avail_in)return IA;A=e.state,A.mode===mA&&(A.mode=pA),n=e.next_out,r=e.output,o=e.avail_out,a=e.next_in,i=e.input,s=e.avail_in,l=A.hold,g=A.bits,h=s,f=o,p=fA;e:for(;;)switch(A.mode){case wA:if(0===A.wrap){A.mode=pA;break}for(;g<16;){if(0===s)break e;s--,l+=i[a++]<<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=Te(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=kA;break}if((15&l)!==EA){e.msg="unknown compression method",A.mode=kA;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=kA;break}A.dmax=1<<A.wbits,A.flags=0,e.adler=A.check=1,A.mode=512&l?16189:mA,l=0,g=0;break;case 16181:for(;g<16;){if(0===s)break e;s--,l+=i[a++]<<g,g+=8}if(A.flags=l,(255&A.flags)!==EA){e.msg="unknown compression method",A.mode=kA;break}if(57344&A.flags){e.msg="unknown header flags set",A.mode=kA;break}A.head&&(A.head.text=l>>8&1),512&A.flags&&4&A.wrap&&(_[0]=255&l,_[1]=l>>>8&255,A.check=Te(A.check,_,2,0)),l=0,g=0,A.mode=16182;case 16182:for(;g<32;){if(0===s)break e;s--,l+=i[a++]<<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=Te(A.check,_,4,0)),l=0,g=0,A.mode=16183;case 16183:for(;g<16;){if(0===s)break e;s--,l+=i[a++]<<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=Te(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[a++]<<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=Te(A.check,_,2,0)),l=0,g=0}else A.head&&(A.head.extra=null);A.mode=16185;case 16185:if(1024&A.flags&&(c=A.length,c>s&&(c=s),c&&(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(a,a+c),m)),512&A.flags&&4&A.wrap&&(A.check=Te(A.check,i,c,a)),s-=c,a+=c,A.length-=c),A.length))break e;A.length=0,A.mode=16186;case 16186:if(2048&A.flags){if(0===s)break e;c=0;do{m=i[a+c++],A.head&&m&&A.length<65536&&(A.head.name+=String.fromCharCode(m))}while(m&&c<s);if(512&A.flags&&4&A.wrap&&(A.check=Te(A.check,i,c,a)),s-=c,a+=c,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;c=0;do{m=i[a+c++],A.head&&m&&A.length<65536&&(A.head.comment+=String.fromCharCode(m))}while(m&&c<s);if(512&A.flags&&4&A.wrap&&(A.check=Te(A.check,i,c,a)),s-=c,a+=c,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[a++]<<g,g+=8}if(4&A.wrap&&l!==(65535&A.check)){e.msg="header crc mismatch",A.mode=kA;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=mA;break;case 16189:for(;g<32;){if(0===s)break e;s--,l+=i[a++]<<g,g+=8}e.adler=A.check=vA(l),l=0,g=0,A.mode=QA;case QA:if(0===A.havedict)return e.next_out=n,e.avail_out=o,e.next_in=a,e.avail_in=s,A.hold=l,A.bits=g,dA;e.adler=A.check=1,A.mode=mA;case mA:if(t===gA||t===hA)break e;case pA:if(A.last){l>>>=7&g,g-=7&g,A.mode=DA;break}for(;g<3;){if(0===s)break e;s--,l+=i[a++]<<g,g+=8}switch(A.last=1&l,l>>>=1,g-=1,3&l){case 0:A.mode=16193;break;case 1:if(NA(A),A.mode=_A,t===hA){l>>>=2,g-=2;break e}break;case 2:A.mode=16196;break;case 3:e.msg="invalid block type",A.mode=kA}l>>>=2,g-=2;break;case 16193:for(l>>>=7&g,g-=7&g;g<32;){if(0===s)break e;s--,l+=i[a++]<<g,g+=8}if((65535&l)!=(l>>>16^65535)){e.msg="invalid stored block lengths",A.mode=kA;break}if(A.length=65535&l,l=0,g=0,A.mode=yA,t===hA)break e;case yA:A.mode=16195;case 16195:if(c=A.length,c){if(c>s&&(c=s),c>o&&(c=o),0===c)break e;r.set(i.subarray(a,a+c),n),s-=c,a+=c,o-=c,n+=c,A.length-=c;break}A.mode=mA;break;case 16196:for(;g<14;){if(0===s)break e;s--,l+=i[a++]<<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=kA;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[a++]<<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=oA(0,A.lens,0,19,A.lencode,0,A.work,b),A.lenbits=b.bits,p){e.msg="invalid code lengths set",A.mode=kA;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],u=y>>>24,B=y>>>16&255,C=65535&y,!(u<=g);){if(0===s)break e;s--,l+=i[a++]<<g,g+=8}if(C<16)l>>>=u,g-=u,A.lens[A.have++]=C;else{if(16===C){for(D=u+2;g<D;){if(0===s)break e;s--,l+=i[a++]<<g,g+=8}if(l>>>=u,g-=u,0===A.have){e.msg="invalid bit length repeat",A.mode=kA;break}m=A.lens[A.have-1],c=3+(3&l),l>>>=2,g-=2}else if(17===C){for(D=u+3;g<D;){if(0===s)break e;s--,l+=i[a++]<<g,g+=8}l>>>=u,g-=u,m=0,c=3+(7&l),l>>>=3,g-=3}else{for(D=u+7;g<D;){if(0===s)break e;s--,l+=i[a++]<<g,g+=8}l>>>=u,g-=u,m=0,c=11+(127&l),l>>>=7,g-=7}if(A.have+c>A.nlen+A.ndist){e.msg="invalid bit length repeat",A.mode=kA;break}for(;c--;)A.lens[A.have++]=m}}if(A.mode===kA)break;if(0===A.lens[256]){e.msg="invalid code -- missing end-of-block",A.mode=kA;break}if(A.lenbits=9,b={bits:A.lenbits},p=oA(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=kA;break}if(A.distbits=6,A.distcode=A.distdyn,b={bits:A.distbits},p=oA(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=kA;break}if(A.mode=_A,t===hA)break e;case _A:A.mode=bA;case bA:if(s>=6&&o>=258){e.next_out=n,e.avail_out=o,e.next_in=a,e.avail_in=s,A.hold=l,A.bits=g,AA(e,f),n=e.next_out,r=e.output,o=e.avail_out,a=e.next_in,i=e.input,s=e.avail_in,l=A.hold,g=A.bits,A.mode===mA&&(A.back=-1);break}for(A.back=0;y=A.lencode[l&(1<<A.lenbits)-1],u=y>>>24,B=y>>>16&255,C=65535&y,!(u<=g);){if(0===s)break e;s--,l+=i[a++]<<g,g+=8}if(B&&0==(240&B)){for(E=u,w=B,Q=C;y=A.lencode[Q+((l&(1<<E+w)-1)>>E)],u=y>>>24,B=y>>>16&255,C=65535&y,!(E+u<=g);){if(0===s)break e;s--,l+=i[a++]<<g,g+=8}l>>>=E,g-=E,A.back+=E}if(l>>>=u,g-=u,A.back+=u,A.length=C,0===B){A.mode=16205;break}if(32&B){A.back=-1,A.mode=mA;break}if(64&B){e.msg="invalid literal/length code",A.mode=kA;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[a++]<<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],u=y>>>24,B=y>>>16&255,C=65535&y,!(u<=g);){if(0===s)break e;s--,l+=i[a++]<<g,g+=8}if(0==(240&B)){for(E=u,w=B,Q=C;y=A.distcode[Q+((l&(1<<E+w)-1)>>E)],u=y>>>24,B=y>>>16&255,C=65535&y,!(E+u<=g);){if(0===s)break e;s--,l+=i[a++]<<g,g+=8}l>>>=E,g-=E,A.back+=E}if(l>>>=u,g-=u,A.back+=u,64&B){e.msg="invalid distance code",A.mode=kA;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[a++]<<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=kA;break}A.mode=16204;case 16204:if(0===o)break e;if(c=f-o,A.offset>c){if(c=A.offset-c,c>A.whave&&A.sane){e.msg="invalid distance too far back",A.mode=kA;break}c>A.wnext?(c-=A.wnext,d=A.wsize-c):d=A.wnext-c,c>A.length&&(c=A.length),I=A.window}else I=r,d=n-A.offset,c=A.length;c>o&&(c=o),o-=c,A.length-=c;do{r[n++]=I[d++]}while(--c);0===A.length&&(A.mode=bA);break;case 16205:if(0===o)break e;r[n++]=A.length,o--,A.mode=bA;break;case DA:if(A.wrap){for(;g<32;){if(0===s)break e;s--,l|=i[a++]<<g,g+=8}if(f-=o,e.total_out+=f,A.total+=f,4&A.wrap&&f&&(e.adler=A.check=A.flags?Te(A.check,r,f,n-f):Le(A.check,r,f,n-f)),f=o,4&A.wrap&&(A.flags?l:vA(l))!==A.check){e.msg="incorrect data check",A.mode=kA;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[a++]<<g,g+=8}if(4&A.wrap&&l!==(4294967295&A.total)){e.msg="incorrect length check",A.mode=kA;break}l=0,g=0}A.mode=16208;case 16208:p=cA;break e;case kA:p=uA;break e;case 16210:return BA;default:return IA}return e.next_out=n,e.avail_out=o,e.next_in=a,e.avail_in=s,A.hold=l,A.bits=g,(A.wsize||f!==e.avail_out&&A.mode<kA&&(A.mode<DA||t!==lA))&&OA(e,e.output,e.next_out,f-e.avail_out),h-=e.avail_in,f-=e.avail_out,e.total_in+=h,e.total_out+=f,A.total+=f,4&A.wrap&&f&&(e.adler=A.check=A.flags?Te(A.check,r,f,e.next_out-f):Le(A.check,r,f,e.next_out-f)),e.data_type=A.bits+(A.last?64:0)+(A.mode===mA?128:0)+(A.mode===_A||A.mode===yA?256:0),(0===h&&0===f||t===lA)&&p===fA&&(p=CA),p},inflateEnd:e=>{if(xA(e))return IA;let t=e.state;return t.window&&(t.window=null),e.state=null,fA},inflateGetHeader:(e,t)=>{if(xA(e))return IA;const A=e.state;return 0==(2&A.wrap)?IA:(A.head=t,t.done=!1,fA)},inflateSetDictionary:(e,t)=>{const A=t.length;let i,r,a;return xA(e)?IA:(i=e.state,0!==i.wrap&&i.mode!==QA?IA:i.mode===QA&&(r=1,r=Le(r,t,A,0),r!==i.check)?uA:(a=OA(e,t,A,A),a?(i.mode=16210,BA):(i.havedict=1,fA)))},inflateInfo:"pako inflate (from Nodeca project)"};var zA=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 KA=Object.prototype.toString,{Z_NO_FLUSH:qA,Z_FINISH:JA,Z_OK:HA,Z_STREAM_END:YA,Z_NEED_DICT:VA,Z_STREAM_ERROR:ZA,Z_DATA_ERROR:jA,Z_MEM_ERROR:XA}=Oe;function WA(e){this.options=Nt.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 Kt,this.strm.avail_out=0;let A=PA.inflateInit2(this.strm,t.windowBits);if(A!==HA)throw new Error(Ne[A]);if(this.header=new zA,PA.inflateGetHeader(this.strm,this.header),t.dictionary&&("string"==typeof t.dictionary?t.dictionary=zt.string2buf(t.dictionary):"[object ArrayBuffer]"===KA.call(t.dictionary)&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(A=PA.inflateSetDictionary(this.strm,t.dictionary),A!==HA)))throw new Error(Ne[A])}function $A(e,t){const A=new WA(t);if(A.push(e),A.err)throw A.msg||Ne[A.err];return A.result}WA.prototype.push=function(e,t){const A=this.strm,i=this.options.chunkSize,r=this.options.dictionary;let a,n,s;if(this.ended)return!1;for(n=t===~~t?t:!0===t?JA:qA,"[object ArrayBuffer]"===KA.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),a=PA.inflate(A,n),a===VA&&r&&(a=PA.inflateSetDictionary(A,r),a===HA?a=PA.inflate(A,n):a===jA&&(a=VA));A.avail_in>0&&a===YA&&A.state.wrap>0&&0!==e[A.next_in];)PA.inflateReset(A),a=PA.inflate(A,n);switch(a){case ZA:case jA:case VA:case XA:return this.onEnd(a),this.ended=!0,!1}if(s=A.avail_out,A.next_out&&(0===A.avail_out||a===YA))if("string"===this.options.to){let e=zt.utf8border(A.output,A.next_out),t=A.next_out-e,r=zt.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(a!==HA||0!==s){if(a===YA)return a=PA.inflateEnd(this.strm),this.onEnd(a),this.ended=!0,!0;if(0===A.avail_in)break}}return!0},WA.prototype.onData=function(e){this.chunks.push(e)},WA.prototype.onEnd=function(e){e===HA&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=Nt.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};var ei={Inflate:WA,inflate:$A,inflateRaw:function(e,t){return(t=t||{}).raw=!0,$A(e,t)},ungzip:$A,constants:Oe};const{Inflate:ti,inflate:Ai,inflateRaw:ii,ungzip:ri}=ei;var ai=Ai;function ni(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var si={exports:{}};!function(e){function t(e){var t,A,i,r,a,n=Math.floor,s=new Array(64),o=new Array(64),l=new Array(64),g=new Array(64),h=new Array(65535),f=new Array(65535),c=new Array(64),d=new Array(64),I=[],u=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],S=[0,0,2,1,2,4,4,3,4,7,5,4,4,0,1,2,119],x=[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,a=1;a<=16;a++){for(var n=1;n<=e[a];n++)r[t[i]]=[],r[t[i]][0]=A,r[t[i]][1]=a,i++,A++;A*=2}return r}function U(e){for(var t=e[0],A=e[1]-1;A>=0;)t&1<<A&&(u|=1<<B),A--,--B<0&&(255==u?(F(255),F(0)):F(u),B=7,u=0)}function F(e){I.push(e)}function R(e){F(e>>8&255),F(255&e)}function L(e,t,A,i,r){for(var a,n=r[0],s=r[240],o=function(e,t){var A,i,r,a,n,s,o,l,g,h,f=0;for(g=0;g<8;++g){A=e[f],i=e[f+1],r=e[f+2],a=e[f+3],n=e[f+4],s=e[f+5],o=e[f+6];var d=A+(l=e[f+7]),I=A-l,u=i+o,B=i-o,C=r+s,E=r-s,w=a+n,Q=a-n,m=d+w,p=d-w,y=u+C,_=u-C;e[f]=m+y,e[f+4]=m-y;var b=.707106781*(_+p);e[f+2]=p+b,e[f+6]=p-b;var D=.382683433*((m=Q+E)-(_=B+I)),k=.5411961*m+D,v=1.306562965*_+D,S=.707106781*(y=E+B),x=I+S,G=I-S;e[f+5]=G+k,e[f+3]=G-k,e[f+1]=x+v,e[f+7]=x-v,f+=8}for(f=0,g=0;g<8;++g){A=e[f],i=e[f+8],r=e[f+16],a=e[f+24],n=e[f+32],s=e[f+40],o=e[f+48];var U=A+(l=e[f+56]),F=A-l,R=i+o,L=i-o,M=r+s,T=r-s,N=a+n,O=a-n,P=U+N,z=U-N,K=R+M,q=R-M;e[f]=P+K,e[f+32]=P-K;var J=.707106781*(q+z);e[f+16]=z+J,e[f+48]=z-J;var H=.382683433*((P=O+T)-(q=L+F)),Y=.5411961*P+H,V=1.306562965*q+H,Z=.707106781*(K=T+L),j=F+Z,X=F-Z;e[f+40]=X+Y,e[f+24]=X-Y,e[f+8]=j+V,e[f+56]=j-V,f++}for(g=0;g<64;++g)h=e[g]*t[g],c[g]=h>0?h+.5|0:h-.5|0;return c}(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[f[a=32767+g]]),U(h[a]));for(var I=63;I>0&&0==d[I];I--);if(0==I)return U(n),A;for(var u,B=1;B<=I;){for(var C=B;0==d[B]&&B<=I;++B);var E=B-C;if(E>=16){u=E>>4;for(var w=1;w<=u;++w)U(s);E&=15}a=32767+d[B],U(r[(E<<4)+f[a]]),U(h[a]),B++}return 63!=I&&U(n),A}function M(e){if(e<=0&&(e=1),e>100&&(e=100),a!=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=n((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],a=0;a<64;a++){var h=n((r[a]*e+50)/100);h<1?h=1:h>255&&(h=255),o[p[a]]=h}for(var f=[1,1.387039845,1.306562965,1.175875602,1,.785694958,.5411961,.275899379],c=0,d=0;d<8;d++)for(var I=0;I<8;I++)l[c]=1/(s[p[c]]*f[d]*f[I]*8),g[c]=1/(o[p[c]]*f[d]*f[I]*8),c++})(e<50?Math.floor(5e3/e):Math.floor(200-2*e)),a=e}}this.encode=function(e,a){var n;(new Date).getTime(),a&&M(a),I=new Array,u=0,B=7,R(65496),R(65504),R(16),F(74),F(70),F(73),F(70),F(0),F(1),F(1),F(0),R(1),R(1),F(0),F(0),void 0!==(n=e.comments)&&n.constructor===Array&&n.forEach((e=>{if("string"==typeof e){R(65534);var t,A=e.length;for(R(A+2),t=0;t<A;t++)F(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),F(69),F(120),F(105),F(102),F(0));for(var t=0;t<e.length;t++)F(e[t])}}(e.exifBuffer),function(){R(65499),R(132),F(0);for(var e=0;e<64;e++)F(s[e]);F(1);for(var t=0;t<64;t++)F(o[t])}(),function(e,t){R(65472),R(17),F(8),R(t),R(e),F(3),F(1),F(17),F(0),F(2),F(17),F(1),F(3),F(17),F(1)}(e.width,e.height),function(){R(65476),R(418),F(0);for(var e=0;e<16;e++)F(y[e+1]);for(var t=0;t<=11;t++)F(_[t]);F(16);for(var A=0;A<16;A++)F(b[A+1]);for(var i=0;i<=161;i++)F(D[i]);F(1);for(var r=0;r<16;r++)F(k[r+1]);for(var a=0;a<=11;a++)F(v[a]);F(17);for(var n=0;n<16;n++)F(S[n+1]);for(var s=0;s<=161;s++)F(x[s])}(),R(65498),R(12),F(3),F(1),F(0),F(2),F(17),F(3),F(17),F(0),F(63),F(0);var h=0,f=0,c=0;u=0,B=7,this.encode.displayName="_encode_";for(var d,Q,p,G,T,N,O,P,z,K=e.data,q=e.width,J=e.height,H=4*q,Y=0;Y<J;){for(d=0;d<H;){for(N=T=H*Y+d,O=-1,P=0,z=0;z<64;z++)N=T+(P=z>>3)*H+(O=4*(7&z)),Y+P>=J&&(N-=H*(Y+1+P-J)),d+O>=H&&(N-=d+O-H+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=L(C,l,h,t,i),f=L(E,g,f,A,r),c=L(w,g,c,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(I)},(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(S,x),function(){for(var e=1,t=2,A=1;A<=15;A++){for(var i=e;i<t;i++)f[32767+i]=A,h[32767+i]=[],h[32767+i][1]=A,h[32767+i][0]=i;for(var r=-(t-1);r<=-e;r++)f[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}(),M(e),(new Date).getTime()}si.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 oi=si.exports,li={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,a=1567,n=3784,s=5793,o=2896;function l(){}function g(e,t){for(var A,i,r=0,a=[],n=16;n>0&&!e[n-1];)n--;a.push({children:[],index:0});var s,o=a[0];for(A=0;A<n;A++){for(i=0;i<e[A];i++){for((o=a.pop()).children[o.index]=t[r];o.index>0;){if(0===a.length)throw new Error("Could not recreate Huffman Table");o=a.pop()}for(o.index++,a.push(o);a.length<=A;)a.push(s={children:[],index:0}),o.children[o.index]=s.children,o=s;r++}A+1<n&&(a.push(s={children:[],index:0}),o.children[o.index]=s.children,o=s)}return a[0].children}function h(t,A,i,r,a,n,s,o,l,g){i.precision,i.samplesPerLine,i.scanLines;var h=i.mcusPerLine,f=i.progressive;i.maxH,i.maxV;var c=A,d=0,I=0;function u(){if(I>0)return I--,d>>I&1;if(255==(d=t[A++])){var e=t[A++];if(e)throw new Error("unexpected marker: "+(d<<8|e).toString(16))}return I=7,d>>>7}function B(e){for(var t,A=e;null!==(t=u());){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=u();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 a=A%h,n=(A/h|0)*e.v+i,s=a*e.h+r;void 0===e.blocks[n]&&g.tolerantDecoding||t(e,e.blocks[n][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,S,x=r.length;S=f?0===n?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]|=u()<<l}:0===o?function(t,A){if(w>0)w--;else for(var i=n,r=s;i<=r;){var a=B(t.huffmanTableAC),o=15&a,g=a>>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=n,r=s,a=0;i<=r;){var o=e[i],g=A[o]<0?-1:1;switch(m){case 0:var h=B(t.huffmanTableAC),f=15&h;if(a=h>>4,0===f)a<15?(w=C(a)+(1<<a),m=4):(a=16,m=1);else{if(1!==f)throw new Error("invalid ACn encoding");Q=E(f),m=a?2:3}continue;case 1:case 2:A[o]?A[o]+=(u()<<l)*g:0==--a&&(m=2==m?3:0);break;case 3:A[o]?A[o]+=(u()<<l)*g:(A[o]=Q<<l,m=0);break;case 4:A[o]&&(A[o]+=(u()<<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 a=1;a<64;){var n=B(t.huffmanTableAC),s=15&n,o=n>>4;if(0!==s)A[e[a+=o]]=E(s),a++;else{if(o<15)break;a+=16}}};var G,U,F,R,L=0;for(U=1==x?r[0].blocksPerLine*r[0].blocksPerColumn:h*i.mcusPerColumn,a||(a=U);L<U;){for(b=0;b<x;b++)r[b].pred=0;if(w=0,1==x)for(_=r[0],v=0;v<a;v++)y(_,S,L),L++;else for(v=0;v<a;v++){for(b=0;b<x;b++)for(F=(_=r[b]).h,R=_.v,D=0;D<R;D++)for(k=0;k<F;k++)p(_,S,L,D,k);if(++L===U)break}if(L===U)do{if(255===t[A]&&0!==t[A+1])break;A+=1}while(A<t.length-2);if(I=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-c}function f(e,l){var g,h,f=[],c=l.blocksPerLine,d=l.blocksPerColumn,I=c<<3,B=new Int32Array(64),C=new Uint8Array(64);function E(e,g,h){var f,c,d,I,u,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]?(f=s*p[0+y]+128>>8,c=s*p[4+y]+128>>8,d=p[2+y],I=p[6+y],u=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=f-c+1>>1,f=f+c+1>>1,c=w,w=d*n+I*a+128>>8,d=d*a-I*n+128>>8,I=w,w=u-C+1>>1,u=u+C+1>>1,C=w,w=E+B+1>>1,B=E-B+1>>1,E=w,w=f-I+1>>1,f=f+I+1>>1,I=w,w=c-d+1>>1,c=c+d+1>>1,d=w,w=u*r+E*i+2048>>12,u=u*i-E*r+2048>>12,E=w,w=B*A+C*t+2048>>12,B=B*t-C*A+2048>>12,C=w,p[0+y]=f+E,p[7+y]=f-E,p[1+y]=c+C,p[6+y]=c-C,p[2+y]=d+B,p[5+y]=d-B,p[3+y]=I+u,p[4+y]=I-u):(w=s*p[0+y]+512>>10,p[0+y]=w,p[1+y]=w,p[2+y]=w,p[3+y]=w,p[4+y]=w,p[5+y]=w,p[6+y]=w,p[7+y]=w)}for(Q=0;Q<8;++Q){var _=Q;0!=p[8+_]||0!=p[16+_]||0!=p[24+_]||0!=p[32+_]||0!=p[40+_]||0!=p[48+_]||0!=p[56+_]?(f=s*p[0+_]+2048>>12,c=s*p[32+_]+2048>>12,d=p[16+_],I=p[48+_],u=o*(p[8+_]-p[56+_])+2048>>12,E=o*(p[8+_]+p[56+_])+2048>>12,B=p[24+_],C=p[40+_],w=f-c+1>>1,f=f+c+1>>1,c=w,w=d*n+I*a+2048>>12,d=d*a-I*n+2048>>12,I=w,w=u-C+1>>1,u=u+C+1>>1,C=w,w=E+B+1>>1,B=E-B+1>>1,E=w,w=f-I+1>>1,f=f+I+1>>1,I=w,w=c-d+1>>1,c=c+d+1>>1,d=w,w=u*r+E*i+2048>>12,u=u*i-E*r+2048>>12,E=w,w=B*A+C*t+2048>>12,B=B*t-C*A+2048>>12,C=w,p[0+_]=f+E,p[56+_]=f-E,p[8+_]=c+C,p[48+_]=c-C,p[16+_]=d+B,p[40+_]=d-B,p[24+_]=I+u,p[32+_]=I-u):(w=s*h[Q+0]+8192>>14,p[0+_]=w,p[8+_]=w,p[16+_]=w,p[24+_]=w,p[32+_]=w,p[40+_]=w,p[48+_]=w,p[56+_]=w)}for(Q=0;Q<64;++Q){var b=128+(p[Q]+8>>4);g[Q]=b<0?0:b>255?255:b}}u(I*d*8);for(var w=0;w<d;w++){var Q=w<<3;for(g=0;g<8;g++)f.push(new Uint8Array(I));for(var m=0;m<c;m++){E(l.blocks[w][m],C,B);var p=0,y=m<<3;for(h=0;h<8;h++){var _=f[Q+h];for(g=0;g<8;g++)_[y+g]=C[p++]}}}return f}function c(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 a(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 a=Math.ceil(e.samplesPerLine/8/i),n=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=a*t.h,g=n*t.v,h=[];u(256*(g*l));for(var f=0;f<g;f++){for(var c=[],d=0;d<l;d++)c.push(new Int32Array(64));h.push(c)}t.blocksPerLine=s,t.blocksPerColumn=o,t.blocks=h}e.maxH=i,e.maxV=r,e.mcusPerLine=a,e.mcusPerColumn=n}t.length;var n,s,o,l,c=null,d=null,I=[],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]&&(c={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++];u(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()}}I[15&_]=b}break;case 65472:case 65473:case 65474:r(),(n={}).extended=65473===w,n.progressive=65474===w,n.precision=t[i++],n.scanLines=r(),n.samplesPerLine=r(),n.components={},n.componentsOrder=[];var D=n.scanLines*n.samplesPerLine;if(D>A){var k=Math.ceil((D-A)/1e6);throw new Error(`maxResolutionInMP limit exceeded by ${k}MP`)}var v,S=t[i++];for(H=0;H<S;H++){v=t[i];var x=t[i+1]>>4,G=15&t[i+1],U=t[i+2];if(x<=0||G<=0)throw new Error("Invalid sampling factor, expected values above 0");n.componentsOrder.push(v),n.components[v]={h:x,v:G,quantizationIdx:U},i+=3}a(n),B.push(n);break;case 65476:var F=r();for(H=2;H<F;){var R=t[i++],L=new Uint8Array(16),M=0;for(V=0;V<16;V++,i++)M+=L[V]=t[i];u(16+M);var T=new Uint8Array(M);for(V=0;V<M;V++,i++)T[V]=t[i];H+=17+M,(R>>4==0?E:C)[15&R]=g(L,T)}break;case 65501:r(),s=r();break;case 65500:r(),r();break;case 65498:r();var N=t[i++],O=[];for(H=0;H<N;H++){Z=n.components[t[i++]];var P=t[i++];Z.huffmanTableDC=E[P>>4],Z.huffmanTableAC=C[15&P],O.push(Z)}var z=t[i++],K=t[i++],q=t[i++],J=h(t,i,n,O,s,z,K,q>>4,15&q,this.opts);i+=J;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 H=0;H<B.length;H++){var Y=B[H].components;for(var V in Y)Y[V].quantizationTable=I[Y[V].quantizationIdx],delete Y[V].quantizationIdx}this.width=n.samplesPerLine,this.height=n.scanLines,this.jfif=c,this.adobe=d,this.components=[];for(H=0;H<n.componentsOrder.length;H++){var Z=n.components[n.componentsOrder[H]];this.components.push({lines:f(0,Z),scaleX:Z.h/n.maxH,scaleY:Z.v/n.maxV})}},getData:function(e,t){var A,i,r,a,n,s,o,l,g,h,f,d,I,B,C,E,w,Q,m,p,y,_=this.width/e,b=this.height/t,D=0,k=e*t*this.components.length;u(k);var v=new Uint8Array(k);switch(this.components.length){case 1:for(A=this.components[0],h=0;h<t;h++)for(n=A.lines[0|h*A.scaleY*b],g=0;g<e;g++)f=n[0|g*A.scaleX*_],v[D++]=f;break;case 2:for(A=this.components[0],i=this.components[1],h=0;h<t;h++)for(n=A.lines[0|h*A.scaleY*b],s=i.lines[0|h*i.scaleY*b],g=0;g<e;g++)f=n[0|g*A.scaleX*_],v[D++]=f,f=s[0|g*i.scaleX*_],v[D++]=f;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(n=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?(f=n[0|g*A.scaleX*_],d=s[0|g*i.scaleX*_],Q=c(f+1.402*((I=o[0|g*r.scaleX*_])-128)),m=c(f-.3441363*(d-128)-.71413636*(I-128)),p=c(f+1.772*(d-128))):(Q=n[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],a=this.components[3],h=0;h<t;h++)for(n=A.lines[0|h*A.scaleY*b],s=i.lines[0|h*i.scaleY*b],o=r.lines[0|h*r.scaleY*b],l=a.lines[0|h*a.scaleY*b],g=0;g<e;g++)y?(f=n[0|g*A.scaleX*_],d=s[0|g*i.scaleX*_],I=o[0|g*r.scaleX*_],B=l[0|g*a.scaleX*_],C=255-c(f+1.402*(I-128)),E=255-c(f-.3441363*(d-128)-.71413636*(I-128)),w=255-c(f+1.772*(d-128))):(C=n[0|g*A.scaleX*_],E=s[0|g*i.scaleX*_],w=o[0|g*r.scaleX*_],B=l[0|g*a.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,a,n,s,o,l,g,h=e.width,f=e.height,d=e.data,I=this.getData(h,f),u=0,B=0;switch(this.components.length){case 1:for(i=0;i<f;i++)for(A=0;A<h;A++)r=I[u++],d[B++]=r,d[B++]=r,d[B++]=r,t&&(d[B++]=255);break;case 3:for(i=0;i<f;i++)for(A=0;A<h;A++)o=I[u++],l=I[u++],g=I[u++],d[B++]=o,d[B++]=l,d[B++]=g,t&&(d[B++]=255);break;case 4:for(i=0;i<f;i++)for(A=0;A<h;A++)n=I[u++],s=I[u++],r=I[u++],o=255-c(n*(1-(a=I[u++])/255)+a),l=255-c(s*(1-a/255)+a),g=255-c(r*(1-a/255)+a),d[B++]=o,d[B++]=l,d[B++]=g,t&&(d[B++]=255);break;default:throw new Error("Unsupported color mode")}}};var d=0,I=0;function u(e=0){var t=d+e;if(t>I){var A=Math.ceil((t-I)/1024/1024);throw new Error(`maxMemoryUsageInMB limit exceeded by at least ${A}MB`)}d=t}return l.resetMaxMemoryUsage=function(e){d=0,I=e},l.getBytesAllocated=function(){return d},l.requestMemoryAllocation=u,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),a=new t;a.opts=i,t.resetMaxMemoryUsage(1024*i.maxMemoryUsageInMB*1024),a.parse(r);var n=i.formatAsRGBA?4:3,s=a.width*a.height*n;try{t.requestMemoryAllocation(s);var o={width:a.width,height:a.height,exifBuffer:a.exifBuffer,data:i.useTArray?new Uint8Array(s):Buffer.alloc(s)};a.comments.length>0&&(o.comments=a.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 a.copyToImageData(o,i.formatAsRGBA),o}}(li);var gi=ni({encode:oi,decode:li.exports});const hi=Math.PI,fi=hi/4,ci=180/hi;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 Ii(e,t,A){let i=0,r=e.length;const a=r/A;for(;r>t;){for(let A=t;A>0;--A)e[i+t]+=e[i],++i;r-=t}const n=e.slice();for(let t=0;t<a;++t)for(let i=0;i<A;++i)e[A*t+i]=n[(A-i-1)*a+t]}let ui=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,a){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 n=r[0]/8,s=2===a?1:r.length;for(let a=0;a<i&&!(a*s*A*n>=e.byteLength);++a){let i;if(2===t){switch(r[0]){case 8:i=new Uint8Array(e,a*s*A*n,s*A*n);break;case 16:i=new Uint16Array(e,a*s*A*n,s*A*n/2);break;case 32:i=new Uint32Array(e,a*s*A*n,s*A*n/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,a*s*A*n,s*A*n),Ii(i,s,n))}return e}(A,i,t?e.TileWidth:e.ImageWidth,t?e.TileLength:e.RowsPerStrip||e.ImageLength,e.BitsPerSample,e.PlanarConfiguration)}return A}};const Bi=257;function Ci(e,t){for(let A=t.length-1;A>=0;A--)e.push(t[A]);return e}function Ei(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,a=0;function n(){i=258,r=9}function s(e){const t=function(e,t,A){const i=t%8,r=Math.floor(t/8),a=8-i,n=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)"),Bi;let l=e[r]&2**(8-i)-1;l<<=A-a;let g=l;if(r+1<e.length){let t=e[r+1]>>>s;t<<=Math.max(0,A-o),g+=t}if(n>8&&r+2<e.length){const i=8*(r+3)-(t+A);g+=e[r+2]>>>i}return g}(e,a,r);return a+=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=[];n();const h=new Uint8Array(e);let f,c=s(h);for(;c!==Bi;){if(256===c){for(n(),c=s(h);256===c;)c=s(h);if(c===Bi)break;if(c>256)throw new Error(`corrupted code at scanline ${c}`);Ci(g,l(c)),f=c}else if(c<i){const e=l(c);Ci(g,e),o(f,e[e.length-1]),f=c}else{const e=l(f);if(!e)throw new Error(`Bogus entry. Not in dictionary,\n ${f} / ${i},\n position: ${a}`);Ci(g,e),g.push(e[e.length-1]),o(f,e[e.length-1]),f=c}i+1>=2**r&&(12===r?f=void 0:r++),c=s(h)}return new Uint8Array(g)}let wi=class extends ui{decodeBlock(e){return Ei(e).buffer}};function Qi(e){return(t,...A)=>pi(e,t,A)}function mi(e,t){return Qi(Di(e,t).get)}const{apply:pi,construct:yi,defineProperty:_i,get:bi,getOwnPropertyDescriptor:Di,getPrototypeOf:ki,has:vi,ownKeys:Si,set:xi,setPrototypeOf:Gi}=Reflect,{iterator:Ui,species:Fi,toStringTag:Ri,for:Li}=Symbol,Mi=Object,{create:Ti,defineProperty:Ni,freeze:Oi,is:Pi}=Mi,zi=Array.prototype[Ui],Ki=Qi(zi),qi=ArrayBuffer;mi(qi.prototype,"byteLength");const Ji="undefined"!=typeof SharedArrayBuffer?SharedArrayBuffer:null;Ji&&mi(Ji.prototype,"byteLength");const Hi=ki(Uint8Array);Hi.from;const Yi=Hi.prototype;Yi[Ui],Qi(Yi.keys),Qi(Yi.values),Qi(Yi.entries),Qi(Yi.set),Qi(Yi.reverse),Qi(Yi.fill),Qi(Yi.copyWithin),Qi(Yi.sort),Qi(Yi.slice),Qi(Yi.subarray),mi(Yi,"buffer"),mi(Yi,"byteOffset"),mi(Yi,"length"),mi(Yi,Ri);const Vi=Uint32Array,Zi=Float32Array,ji=ki([][Ui]()),Xi=Qi(ji.next),Wi=Qi(function*(){}().next),$i=ki(ji),er=Qi(DataView.prototype.getUint16),tr=WeakMap,Ar=tr.prototype,ir=Qi(Ar.get),rr=Qi(Ar.set),ar=new tr,nr=Ti(null,{next:{value:function(){const e=ir(ar,this);return Xi(e)}},[Ui]:{value:function(){return this}}});const sr=new tr,or=Ti($i,{next:{value:function(){const e=ir(sr,this);return Wi(e)},writable:!0,configurable:!0}});for(const e of Si(ji))"next"!==e&&Ni(or,e,Di(ji,e));const lr=new qi(4),gr=new Zi(lr),hr=new Vi(lr),fr=new Vi(512),cr=new Vi(512);for(let e=0;e<256;++e){const t=e-127;t<-27?(fr[e]=0,fr[256|e]=32768,cr[e]=24,cr[256|e]=24):t<-14?(fr[e]=1024>>-t-14,fr[256|e]=1024>>-t-14|32768,cr[e]=-t-1,cr[256|e]=-t-1):t<=15?(fr[e]=t+15<<10,fr[256|e]=t+15<<10|32768,cr[e]=13,cr[256|e]=13):t<128?(fr[e]=31744,fr[256|e]=64512,cr[e]=24,cr[256|e]=24):(fr[e]=31744,fr[256|e]=64512,cr[e]=13,cr[256|e]=13)}const dr=new Vi(2048),Ir=new Vi(64),ur=new Vi(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)Ir[e]=e<<23;Ir[31]=1199570944,Ir[32]=2147483648;for(let e=33;e<63;++e)Ir[e]=2147483648+(e-32<<23);Ir[63]=3347054592;for(let e=1;e<64;++e)32!==e&&(ur[e]=1024);function Br(e,t,...A){return function(e){const t=e>>10;return hr[0]=dr[ur[t]+(1023&e)]+Ir[t],gr[0]}(er(e,t,...function(e){if(e[Ui]===zi&&ji.next===Xi)return e;const t=Ti(nr);return rr(ar,t,Ki(e)),t}(A)))}var Cr={exports:{}};function Er(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,a=r.slice(0,r.indexOf(">")+1),n=['"',"'"];for(let e=0;e<n.length;e++){const A=n[e],r=t+"\\="+A+"([^"+A+"]*)"+A;i&&console.log("[xml-utils] pattern:",r);const s=new RegExp(r).exec(a);if(i&&console.log("[xml-utils] match:",s),s)return s[1]}}Cr.exports=Er,Cr.exports.default=Er;var wr=ni(Cr.exports),Qr={exports:{}},mr={exports:{}},pr={exports:{}};function yr(e,t,A){const i=new RegExp(t).exec(e.slice(A));return i?A+i.index:-1}pr.exports=yr,pr.exports.default=yr;var _r=pr.exports,br={exports:{}};function Dr(e,t,A){const i=new RegExp(t).exec(e.slice(A));return i?A+i.index+i[0].length-1:-1}br.exports=Dr,br.exports.default=Dr;var kr=br.exports,vr={exports:{}};function Sr(e,t){const A=new RegExp(t,"g"),i=e.match(A);return i?i.length:0}vr.exports=Sr,vr.exports.default=Sr;var xr=vr.exports;const Gr=_r,Ur=kr,Fr=xr;function Rr(e,t,A){const i=A&&A.debug||!1,r=!(A&&!1===typeof A.nested),a=A&&A.startIndex||0;i&&console.log("[xml-utils] starting findTagByName with",t," and ",A);const n=Gr(e,`<${t}[ \n>/]`,a);if(i&&console.log("[xml-utils] start:",n),-1===n)return;const s=e.slice(n+t.length);let o=Ur(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=Ur(s,"[ /]"+t+">",e));){const r=s.substring(e,o+1);if(A+=Fr(r,"<"+t+"[ \n\t>]"),i+=Fr(r,"</"+t+">"),i>=A)break;e=o}}else o=Ur(s,"[ /]"+t+">",0);const g=n+t.length+o+1;if(i&&console.log("[xml-utils] end:",g),-1===g)return;const h=e.slice(n,g);let f;return f=l?null:h.slice(h.indexOf(">")+1,h.lastIndexOf("<")),{inner:f,outer:h,start:n,end:g}}mr.exports=Rr,mr.exports.default=Rr;const Lr=mr.exports;function Mr(e,t,A){const i=[],r=A&&A.debug||!1,a=!A||"boolean"!=typeof A.nested||A.nested;let n,s=A&&A.startIndex||0;for(;n=Lr(e,t,{debug:r,startIndex:s});)s=a?n.start+1+t.length:n.end,i.push(n);return r&&console.log("findTagsByName found",i.length,"tags"),i}Qr.exports=Mr,Qr.exports.default=Mr;var Tr=ni(Qr.exports);const Nr={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"},Or={};for(const e in Nr)Nr.hasOwnProperty(e)&&(Or[Nr[e]]=parseInt(e,10));const Pr=[Or.BitsPerSample,Or.ExtraSamples,Or.SampleFormat,Or.StripByteCounts,Or.StripOffsets,Or.StripRowCounts,Or.TileByteCounts,Or.TileOffsets,Or.SubIFDs],zr={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"},Kr={};for(const e in zr)zr.hasOwnProperty(e)&&(Kr[zr[e]]=parseInt(e,10));const qr=0,Jr=1,Hr=2,Yr=3,Vr=5,Zr=6,jr=8,Xr=0,Wr=1,$r=0,ea=1,ta=2,Aa={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 ia=new Map;function ra(e,t){Array.isArray(e)||(e=[e]),e.forEach((e=>ia.set(e,t)))}function aa(e,t,A,i=1){return new(Object.getPrototypeOf(e).constructor)(t*A*i)}function na(e,t,A){return(1-A)*e+A*t}function sa(e,t,A,i,r,a="nearest"){switch(a.toLowerCase()){case"nearest":return function(e,t,A,i,r){const a=t/i,n=A/r;return e.map((e=>{const s=aa(e,i,r);for(let o=0;o<r;++o){const r=Math.min(Math.round(n*o),A-1);for(let A=0;A<i;++A){const n=Math.min(Math.round(a*A),t-1),l=e[r*t+n];s[o*i+A]=l}}return s}))}(e,t,A,i,r);case"bilinear":case"linear":return function(e,t,A,i,r){const a=t/i,n=A/r;return e.map((e=>{const s=aa(e,i,r);for(let o=0;o<r;++o){const r=n*o,l=Math.floor(r),g=Math.min(Math.ceil(r),A-1);for(let A=0;A<i;++A){const n=a*A,h=n%1,f=Math.floor(n),c=Math.min(Math.ceil(n),t-1),d=e[l*t+f],I=e[l*t+c],u=e[g*t+f],B=e[g*t+c],C=na(na(d,I,h),na(u,B,h),r%1);s[o*i+A]=C}}return s}))}(e,t,A,i,r);default:throw new Error(`Unsupported resampling method: '${a}'`)}}function oa(e,t,A,i,r,a,n="nearest"){switch(n.toLowerCase()){case"nearest":return function(e,t,A,i,r,a){const n=t/i,s=A/r,o=aa(e,i,r,a);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(n*A),t-1);for(let n=0;n<a;++n){const g=e[r*t*a+s*a+n];o[l*i*a+A*a+n]=g}}}return o}(e,t,A,i,r,a);case"bilinear":case"linear":return function(e,t,A,i,r,a){const n=t/i,s=A/r,o=aa(e,i,r,a);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=n*A,f=s%1,c=Math.floor(s),d=Math.min(Math.ceil(s),t-1);for(let n=0;n<a;++n){const s=e[g*t*a+c*a+n],I=e[g*t*a+d*a+n],u=e[h*t*a+c*a+n],B=e[h*t*a+d*a+n],C=na(na(s,I,f),na(u,B,f),r%1);o[l*i*a+A*a+n]=C}}}return o}(e,t,A,i,r,a);default:throw new Error(`Unsupported resampling method: '${n}'`)}}function la(e,t,A){let i=0;for(let r=t;r<A;++r)i+=e[r];return i}function ga(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")}ra([void 0,1],(()=>Promise.resolve().then((function(){return Ka})).then((e=>e.default)))),ra(5,(()=>Promise.resolve().then((function(){return Ya})).then((e=>e.default)))),ra(6,(()=>{throw new Error("old style JPEG compression is not supported.")})),ra(7,(()=>Promise.resolve().then((function(){return on})).then((e=>e.default)))),ra([8,32946],(()=>Promise.resolve().then((function(){return Cl})).then((e=>e.default)))),ra(32773,(()=>Promise.resolve().then((function(){return El})).then((e=>e.default)))),ra(34887,(()=>Promise.resolve().then((function(){return kl})).then((async e=>(await e.zstd.init(),e))).then((e=>e.default)))),ra(50001,(()=>Promise.resolve().then((function(){return vl})).then((e=>e.default))));var ha=class{constructor(e,t,A,i,r,a){this.fileDirectory=e,this.geoKeys=t,this.dataView=A,this.littleEndian=i,this.tiles=r?{}:null,this.isTiled=!e.StripOffsets;const n=e.PlanarConfiguration;if(this.planarConfiguration=void 0===n?1:n,1!==this.planarConfiguration&&2!==this.planarConfiguration)throw new Error("Invalid planar configuration.");this.source=a}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 Br(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 ga(this.getSampleFormat(e),this.getBitsPerSample(e),t)}async getTileOrStrip(e,t,A,i,r){const a=Math.ceil(this.getWidth()/this.getTileWidth()),n=Math.ceil(this.getHeight()/this.getTileHeight());let s;const{tiles:o}=this;let l,g;1===this.planarConfiguration?s=t*a+e:2===this.planarConfiguration&&(s=A*a*n+t*a+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 f;return null!==o&&o[s]?f=o[s]:(f=(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,a,n){const s=new DataView(e),o=2===A?1:i,l=ga(t,r,2===A?n*a:n*a*i),g=parseInt("1".repeat(r),2);if(1===t){let e;e=1===A?i*r:r;let t=a*e;0!=(7&t)&&(t=t+7&-8);for(let e=0;e<n;++e){const A=e*t;for(let t=0;t<a;++t){const i=A+t*o*r;for(let A=0;A<o;++A){const n=i+A*r,h=(e*a+t)*o+A,f=Math.floor(n/8),c=n%8;if(c+r<=8)l[h]=s.getUint8(f)>>8-r-c&g;else if(c+r<=16)l[h]=s.getUint16(f)>>16-r-c&g;else if(c+r<=24){const e=s.getUint16(f)<<8|s.getUint8(f+2);l[h]=e>>24-r-c&g}else l[h]=s.getUint32(f)>>32-r-c&g}}}}return l.buffer}(e,A,this.planarConfiguration,this.getSamplesPerPixel(),r,this.getTileWidth(),this.getBlockHeight(t))),e})(),null!==o&&(o[s]=f)),{x:e,y:t,sample:A,data:await f}}async _readRaster(e,t,A,i,r,a,n,s,o){const l=this.getTileWidth(),g=this.getTileHeight(),h=this.getWidth(),f=this.getHeight(),c=Math.max(Math.floor(e[0]/l),0),d=Math.min(Math.ceil(e[2]/l),Math.ceil(h/l)),I=Math.max(Math.floor(e[1]/g),0),u=Math.min(Math.ceil(e[3]/g),Math.ceil(f/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(la(this.fileDirectory.BitsPerSample,0,t[e])/8):E.push(0),w.push(this.getReaderForSample(t[e]));const Q=[],{littleEndian:m}=this;for(let a=I;a<u;++a)for(let n=c;n<d;++n){let s;1===this.planarConfiguration&&(s=this.getTileOrStrip(n,a,0,r,o));for(let c=0;c<t.length;++c){const d=c,I=t[c];2===this.planarConfiguration&&(C=this.getSampleByteSize(I),s=this.getTileOrStrip(n,a,I,r,o));const u=s.then((r=>{const a=r.data,n=new DataView(a),s=this.getBlockHeight(r.y),o=r.y*g,c=r.x*l,I=o+s,u=(r.x+1)*l,Q=w[d],p=Math.min(s,s-(I-e[3]),f-o),y=Math.min(l,l-(u-e[2]),h-c);for(let r=Math.max(0,e[1]-o);r<p;++r)for(let a=Math.max(0,e[0]-c);a<y;++a){const s=(r*l+a)*C,g=Q.call(n,s+E[d],m);let h;i?(h=(r+o-e[1])*B*t.length+(a+c-e[0])*t.length+d,A[h]=g):(h=(r+o-e[1])*B+a+c-e[0],A[d][h]=g)}}));Q.push(u)}}if(await Promise.all(Q),a&&e[2]-e[0]!==a||n&&e[3]-e[1]!==n){let r;return r=i?oa(A,e[2]-e[0],e[3]-e[1],a,n,t.length,s):sa(A,e[2]-e[0],e[3]-e[1],a,n,s),r.width=a,r.height=n,r}return A.width=a||e[2]-e[0],A.height=n||e[3]-e[1],A}async readRasters({window:e,samples:t=[],interleave:A,pool:i=null,width:r,height:a,resampleMethod:n,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 f;if(A){f=ga(this.fileDirectory.SampleFormat?Math.max.apply(null,this.fileDirectory.SampleFormat):1,Math.max.apply(null,this.fileDirectory.BitsPerSample),g*t.length),s&&f.fill(s)}else{f=[];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),f.push(A)}}const c=i||await async function(e){const t=ia.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,f,A,c,r,a,n,o)}async readRGB({window:e,interleave:t=!0,pool:A=null,width:i,height:r,resampleMethod:a,enableAlpha:n=!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===Hr){let o=[0,1,2];if(this.fileDirectory.ExtraSamples!==Xr&&n){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:a,signal:s})}let g;switch(l){case qr:case Jr:case Yr:g=[0];break;case Vr:g=[0,1,2,3];break;case Zr:case jr: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:a,signal:s},{fileDirectory:f}=this,c=await this.readRasters(h),d=2**this.fileDirectory.BitsPerSample[0];let I;switch(l){case qr:I=function(e,t){const{width:A,height:i}=e,r=new Uint8Array(A*i*3);let a;for(let A=0,i=0;A<e.length;++A,i+=3)a=256-e[A]/t*256,r[i]=a,r[i+1]=a,r[i+2]=a;return r}(c,d);break;case Jr:I=function(e,t){const{width:A,height:i}=e,r=new Uint8Array(A*i*3);let a;for(let A=0,i=0;A<e.length;++A,i+=3)a=e[A]/t*256,r[i]=a,r[i+1]=a,r[i+2]=a;return r}(c,d);break;case Yr:I=function(e,t){const{width:A,height:i}=e,r=new Uint8Array(A*i*3),a=t.length/3,n=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+a]/65536*256,r[i+2]=t[s+n]/65536*256}return r}(c,f.ColorMap);break;case Vr:I=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],a=e[t+1],n=e[t+2],s=e[t+3];i[A]=(255-r)/256*255*((255-s)/256),i[A+1]=(255-a)/256*255*((255-s)/256),i[A+2]=(255-n)/256*255*((255-s)/256)}return i}(c);break;case Zr:I=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],a=e[t+1],n=e[t+2];i[A]=r+1.402*(n-128),i[A+1]=r-.34414*(a-128)-.71414*(n-128),i[A+2]=r+1.772*(a-128)}return i}(c);break;case jr:I=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,a,n,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,a=-.9689*o+1.8758*s+.0415*l,n=.0557*o+-.204*s+1.057*l,r=r>.0031308?1.055*r**(1/2.4)-.055:12.92*r,a=a>.0031308?1.055*a**(1/2.4)-.055:12.92*a,n=n>.0031308?1.055*n**(1/2.4)-.055:12.92*n,i[A]=255*Math.max(0,Math.min(1,r)),i[A+1]=255*Math.max(0,Math.min(1,a)),i[A+2]=255*Math.max(0,Math.min(1,n))}return i}(c);break;default:throw new Error("Unsupported photometric interpretation.")}if(!t){const e=new Uint8Array(I.length/3),t=new Uint8Array(I.length/3),A=new Uint8Array(I.length/3);for(let i=0,r=0;i<I.length;i+=3,++r)e[r]=I[i],t[r]=I[i+1],A[r]=I[i+2];I=[e,t,A]}return I.width=c.width,I.height=c.height,I}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=Tr(A,"Item");i=null===e?i.filter((e=>void 0===wr(e,"sample"))):i.filter((t=>Number(wr(t,"sample"))===e));for(let e=0;e<i.length;++e){const A=i[e];t[wr(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,a,n,s,o,l]=this.fileDirectory.ModelTransformation,g=[[0,0],[0,t],[A,0],[A,t]].map((([t,A])=>[a+e*t+i*A,l+n*t+s*A])),h=g.map((e=>e[0])),f=g.map((e=>e[1]));return[Math.min(...h),Math.min(...f),Math.max(...h),Math.max(...f)]}{const e=this.getOrigin(),i=this.getResolution(),r=e[0],a=e[1],n=r+i[0]*A,s=a+i[1]*t;return[Math.min(r,n),Math.min(a,s),Math.max(r,n),Math.max(a,s)]}}};class fa{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 a=0;a<8;a++){let n=this._dataView.getUint8(e+(t?a:7-a));i&&(r?0!==n&&(n=255&~(n-1),r=!1):n=255&~n),A+=n*256**a}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 Br(this._dataView,e,t)}getFloat32(e,t){return this._dataView.getFloat32(e,t)}getFloat64(e,t){return this._dataView.getFloat64(e,t)}}class ca{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 a=this._dataView.getUint8(e+(this._littleEndian?r:7-r));A&&(i?0!==a&&(a=255&~(a-1),i=!1):a=255&~a),t+=a*256**r}return A&&(t=-t),t}readOffset(e){return this._bigTiff?this.readUint64(e):this.readUint32(e)}}class da{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 Ia extends Error{constructor(e){super(e),Error.captureStackTrace&&Error.captureStackTrace(this,Ia),this.name="AbortError"}}class ua extends da{constructor(e){super(),this.arrayBuffer=e}fetchSlice(e,t){if(t&&t.aborted)throw new Ia("Request aborted");return this.arrayBuffer.slice(e.offset,e.offset+e.length)}}function Ba(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 Ca(e,t,A){let i=0,r=e.length;const a=r/A;for(;r>t;){for(let A=t;A>0;--A)e[i+t]+=e[i],++i;r-=t}const n=e.slice();for(let t=0;t<a;++t)for(let i=0;i<A;++i)e[A*t+i]=n[(A-i-1)*a+t]}class Ea{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,a){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 n=r[0]/8,s=2===a?1:r.length;for(let a=0;a<i&&!(a*s*A*n>=e.byteLength);++a){let i;if(2===t){switch(r[0]){case 8:i=new Uint8Array(e,a*s*A*n,s*A*n);break;case 16:i=new Uint16Array(e,a*s*A*n,s*A*n/2);break;case 32:i=new Uint32Array(e,a*s*A*n,s*A*n/4);break;default:throw new Error(`Predictor 2 not allowed with ${r[0]} bits per sample.`)}Ba(i,s)}else 3===t&&(i=new Uint8Array(e,a*s*A*n,s*A*n),Ca(i,s,n))}return e}(A,i,t?e.TileWidth:e.ImageWidth,t?e.TileLength:e.RowsPerStrip||e.ImageLength,e.BitsPerSample,e.PlanarConfiguration)}return A}}function wa(e){switch(e){case Kr.BYTE:case Kr.ASCII:case Kr.SBYTE:case Kr.UNDEFINED:return 1;case Kr.SHORT:case Kr.SSHORT:return 2;case Kr.LONG:case Kr.SLONG:case Kr.FLOAT:case Kr.IFD:return 4;case Kr.RATIONAL:case Kr.SRATIONAL:case Kr.DOUBLE:case Kr.LONG8:case Kr.SLONG8:case Kr.IFD8:return 8;default:throw new RangeError(`Invalid field type: ${e}`)}}function Qa(e,t,A,i){let r=null,a=null;const n=wa(t);switch(t){case Kr.BYTE:case Kr.ASCII:case Kr.UNDEFINED:r=new Uint8Array(A),a=e.readUint8;break;case Kr.SBYTE:r=new Int8Array(A),a=e.readInt8;break;case Kr.SHORT:r=new Uint16Array(A),a=e.readUint16;break;case Kr.SSHORT:r=new Int16Array(A),a=e.readInt16;break;case Kr.LONG:case Kr.IFD:r=new Uint32Array(A),a=e.readUint32;break;case Kr.SLONG:r=new Int32Array(A),a=e.readInt32;break;case Kr.LONG8:case Kr.IFD8:r=new Array(A),a=e.readUint64;break;case Kr.SLONG8:r=new Array(A),a=e.readInt64;break;case Kr.RATIONAL:r=new Uint32Array(2*A),a=e.readUint32;break;case Kr.SRATIONAL:r=new Int32Array(2*A),a=e.readInt32;break;case Kr.FLOAT:r=new Float32Array(A),a=e.readFloat32;break;case Kr.DOUBLE:r=new Float64Array(A),a=e.readFloat64;break;default:throw new RangeError(`Invalid field type: ${t}`)}if(t!==Kr.RATIONAL&&t!==Kr.SRATIONAL)for(let t=0;t<A;++t)r[t]=a.call(e,i+t*n);else for(let t=0;t<A;t+=2)r[t]=a.call(e,i+t*n),r[t+1]=a.call(e,i+(t*n+4));return t===Kr.ASCII?new TextDecoder("utf-8").decode(r):r}class ma{constructor(e,t,A){this.fileDirectory=e,this.geoKeyDirectory=t,this.nextIFDByteOffset=A}}class pa extends Error{constructor(e){super(`No image at index ${e}`),this.index=e}}class ya{async readRasters(e={}){const{window:t,width:A,height:i}=e;let{resX:r,resY:a,bbox:n}=e;const s=await this.getImage();let o=s;const l=await this.getImageCount(),g=s.getBoundingBox();if(t&&n)throw new Error('Both "bbox" and "window" passed.');if(A||i){if(t){const[e,A]=s.getOrigin(),[i,r]=s.getResolution();n=[e+t[0]*i,A+t[1]*r,e+t[2]*i,A+t[3]*r]}const e=n||g;if(A){if(r)throw new Error("Both width and resX passed");r=(e[2]-e[0])/A}if(i){if(a)throw new Error("Both width and resY passed");a=(e[3]-e[1])/i}}if(r||a){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(),n=(g[3]-g[1])/A.getHeight();if(o=A,r&&r>i||a&&a>n)break}}let h=t;if(n){const[e,t]=s.getOrigin(),[A,i]=o.getResolution(s);h=[Math.round((n[0]-e)/A),Math.round((n[1]-t)/i),Math.round((n[2]-e)/A),Math.round((n[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 _a extends ya{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 ca((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),a=r*t+(this.bigTiff?16:6);i.covers(e,a)||(i=await this.getSlice(e,a));const n={};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,a;const o=wa(t),l=s+(this.bigTiff?12:8);if(o*A<=(this.bigTiff?8:4))r=Qa(i,t,A,l);else{const e=i.readOffset(l),a=wa(t)*A;if(i.covers(e,a))r=Qa(i,t,A,e);else{r=Qa(await this.getSlice(e,a),t,A,e)}}a=1===A&&-1===Pr.indexOf(e)&&t!==Kr.RATIONAL&&t!==Kr.SRATIONAL?r[0]:r,n[Nr[e]]=a}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=Aa[t[i]],a=t[i+1]?Nr[t[i+1]]:null,n=t[i+2],s=t[i+3];let o=null;if(a){if(o=e[a],null==o)throw new Error(`Could not get value of geoKey '${r}'.`);"string"==typeof o?o=o.substring(s,s+n-1):o.subarray&&(o=o.subarray(s,s+n),1===n&&(o=o[0]))}else o=s;A[r]=o}return A}(n),l=i.readOffset(e+A+t*r);return new ma(n,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 pa)throw new pa(e);throw t}return this.ifdRequests[e]=(async()=>{const t=await this.ifdRequests[e-1];if(0===t.nextIFDByteOffset)throw new pa(e);return this.parseFileDirectoryAt(t.nextIFDByteOffset)})(),this.ifdRequests[e]}async getImage(e=0){const t=await this.requestIFD(e);return new ha(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 pa))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===Qa(i,Kr.ASCII,t.length,e)){const t=Qa(i,Kr.ASCII,A,e).split("\n")[0],r=Number(t.split("=")[1].split(" ")[0])+t.length;r>A&&(i=await this.getSlice(e,r));const a=Qa(i,Kr.ASCII,r,e);this.ghostValues={},a.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 fa(i),a=r.getUint16(0,0);let n;if(18761===a)n=!0;else{if(19789!==a)throw new TypeError("Invalid byte order value.");n=!1}const s=r.getUint16(2,n);let o;if(42===s)o=!1;else{if(43!==s)throw new TypeError("Invalid magic number.");o=!0;if(8!==r.getUint16(4,n))throw new Error("Unsupported offset byte-size.")}const l=o?r.getUint64(8,n):r.getUint32(4,n);return new _a(e,n,o,l,t)}close(){return"function"==typeof this.source.close&&this.source.close()}}async function ba(e,t){return _a.fromSource(function(e){return new ua(e)}(e),t)}class Da{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,a=0,n=0,s=0,o=0;for(1&A?a=n=s=t:i=r=o=t;(A>>=1)>1;){const e=i+a>>1,t=r+n>>1;1&A?(a=i,n=r,i=s,r=o):(i=a,r=n,a=s,n=o),s=e,o=t}const l=4*e;this.coords[l+0]=i,this.coords[l+1]=r,this.coords[l+2]=a,this.coords[l+3]=n}}createTile(e){return new ka(e,this)}}class ka{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:a}=this;for(let n=e-1;n>=0;n--){const e=4*n,s=A[e+0],o=A[e+1],l=A[e+2],g=A[e+3],h=s+l>>1,f=o+g>>1,c=h+f-o,d=f+s-h,I=(r[o*i+s]+r[g*i+l])/2,u=f*i+h,B=Math.abs(I-r[u]);if(a[u]=Math.max(a[u],B),n<t){const e=(o+d>>1)*i+(s+c>>1),t=(g+d>>1)*i+(l+c>>1);a[u]=Math.max(a[u],a[e],a[t])}}}getMesh(e=0){const{gridSize:t,indices:A}=this.martini,{errors:i}=this;let r=0,a=0;const n=t-1;function s(n,o,l,g,h,f){const c=n+l>>1,d=o+g>>1;Math.abs(n-h)+Math.abs(o-f)>1&&i[d*t+c]>e?(s(h,f,n,o,c,d),s(l,g,h,f,c,d)):(A[o*t+n]=A[o*t+n]||++r,A[g*t+l]=A[g*t+l]||++r,A[f*t+h]=A[f*t+h]||++r,a++)}A.fill(0),s(0,0,n,n,n,0),s(n,n,0,0,0,n);const o=new Uint16Array(2*r),l=new Uint32Array(3*a);let g=0;function h(r,a,n,s,f,c){const d=r+n>>1,I=a+s>>1;if(Math.abs(r-f)+Math.abs(a-c)>1&&i[I*t+d]>e)h(f,c,r,a,d,I),h(n,s,f,c,d,I);else{const e=A[a*t+r]-1,i=A[s*t+n]-1,h=A[c*t+f]-1;o[2*e]=r,o[2*e+1]=a,o[2*i]=n,o[2*i+1]=s,o[2*h]=f,o[2*h+1]=c,l[g++]=e,l[g++]=i,l[g++]=h}}return h(0,0,n,n,n,0),h(n,n,0,0,0,n),{vertices:o,triangles:l}}}function va(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 a=0;for(;a<i.length;)i[a][0]===(null===(t=i[a+1])||void 0===t?void 0:t[1])&&i[a][1]===(null===(A=i[a+1])||void 0===A?void 0:A[0])?a+=2:(r.push(i[a]),a++);return r}(t),a=new e.POSITION.value.constructor(6*r.length),n=new e.TEXCOORD_0.value.constructor(4*r.length),s=new t.constructor(6*r.length);for(let t=0;t<r.length;t++){Sa({edge:r[t],edgeIndex:t,attributes:e,skirtHeight:A,newPosition:a,newTexcoord0:n,newTriangles:s})}e.POSITION.value=w.concatenateTypedArrays(e.POSITION.value,a),e.TEXCOORD_0.value=w.concatenateTypedArrays(e.TEXCOORD_0.value,n);return{attributes:e,triangles:t instanceof Array?t.concat(s):w.concatenateTypedArrays(t,s)}}function Sa({edge:e,edgeIndex:t,attributes:A,skirtHeight:i,newPosition:r,newTexcoord0:a,newTriangles:n}){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,a.set(A.TEXCOORD_0.value.subarray(2*e[0],2*e[0]+2),2*o),a.set(A.TEXCOORD_0.value.subarray(2*e[1],2*e[1]+2),2*l);const g=2*t*3;n[g]=e[0],n[g+1]=s/3+l,n[g+2]=e[1],n[g+3]=s/3+l,n[g+4]=e[0],n[g+5]=s/3+o}const xa={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:C.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 Ga{constructor(){this.scale=(e,t,A,i,r)=>(e-t)*(r-i)/(A-t)+i}setUrl(e){return m(this,void 0,void 0,(function*(){const t=yield fetch(e),A=yield t.arrayBuffer(),i=yield ba(A),r=yield i.getImage(0);this.data=r}))}getMap(e,t,A){return m(this,void 0,void 0,(function*(){const i=Object.assign(Object.assign({},xa),t);switch(i.type){case"image":return this.getBitmap(e,i);case"terrain":return this.getHeightmap(e,i,A);default:return null}}))}getHeightmap(e,t,A){return m(this,void 0,void 0,(function*(){let i,r,a=[];"string"==typeof e?(yield this.setUrl(e),a=yield this.data.readRasters(),i=this.data.getWidth(),r=this.data.getHeight()):(a=e.rasters,i=e.width,r=e.height);let n=a[0];null!=t.useChannel&&a[t.useChannel]&&(n=a[t.useChannel]);const s=new Float32Array((i+1)*(r+1)),o=n.length/(i*r);let l=null===t.useChannel?0:t.useChannel;for(let e=0,A=0;A<r;A++)for(let r=0;r<i;r++,e++){const i=t.noDataValue&&n[l]===t.noDataValue?t.terrainMinValue:n[l]*t.multiplier;s[e+A]=i,l+=o}for(let e=(i+1)*i,t=0;t<i;t++,e++)s[e]=s[e-i-1];for(let e=r,t=0;t<r+1;t++,e+=r+1)s[e]=s[e-1];const{terrainSkirtHeight:g}=t;let h;h=Ua(A,i,s);const{vertices:f}=h;let{triangles:c}=h,d=function(e,t,A,i,r){const a=A+1,n=e.length/2,s=new Float32Array(3*n),o=new Float32Array(2*n),[l,g,h,f]=r||[0,0,A,i],c=(h-l)/A,d=(f-g)/i;for(let r=0;r<n;r++){const n=e[2*r],g=e[2*r+1],h=g*a+n;s[3*r+0]=n*c+l,s[3*r+1]=-g*d+f,s[3*r+2]=t[h],o[2*r+0]=n/A,o[2*r+1]=g/i}return{POSITION:{value:s,size:3},TEXCOORD_0:{value:o,size:2}}}(f,s,i,r,e.bounds);const I=E.getMeshBoundingBox(d);if(g){const{attributes:e,triangles:t}=va(d,c,g);d=e,c=t}return{loaderData:{header:{}},header:{vertexCount:c.length,boundingBox:I},mode:4,indices:{value:Uint32Array.from(c),size:1},attributes:d}}))}getBitmap(e,t){return m(this,void 0,void 0,(function*(){const A=Object.assign({},t);let i,r,a,n=[];"string"==typeof e?(yield this.setUrl(e),n=yield this.data.readRasters(),i=n.length,r=this.data.getWidth(),a=this.data.getHeight()):(n=e.rasters,i=n.length,r=e.width,a=e.height);const s=document.createElement("canvas");s.width=r,s.height=a;const o=s.getContext("2d"),l=o.createImageData(r,a);let g,h,f,c;const d=r*a*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(n[0].length/(r*a)==1){const e=n[0];A.useAutoRange&&(A.colorScaleValueRange=this.getMinMax(e,A));this.getColorValue(e,A,d).forEach(((e,t)=>{l.data[t]=e}))}if(n[0].length/(r*a)==3){let e=0;for(let t=0;t<d;t+=4){const i=[n[0][e],n[0][e+1],n[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}}n[0].length/(r*a)==4&&n[0].forEach(((e,t)=>{l.data[t]=e}))}if(3===i){let e=0;for(let t=0;t<d;t+=4)g=n[0][e],h=n[1][e],f=n[2][e],c=Math.floor(2.55*A.alpha),l.data[t]=g,l.data[t+1]=h,l.data[t+2]=f,l.data[t+3]=c,e+=1}if(4===i){let e=0;for(let t=0;t<d;t+=4)g=n[0][e],h=n[1][e],f=n[2][e],c=Math.floor(2.55*A.alpha),l.data[t]=g,l.data[t+1]=h,l.data[t+2]=f,l.data[t+3]=c,e+=1}}else if(A.useChannel<=A.numOfChannels){let e=n[0];n[A.useChannel]&&(e=n[A.useChannel]),A.useAutoRange&&(A.colorScaleValueRange=this.getMinMax(e,A));const t=e.length/(r*a);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 r=C.scale(t.colorScale).domain(t.colorScaleValueRange);let a=null===t.useChannel?0:t.useChannel;const n=new Array(A),s=t.colorsBasedOnValues?t.colorsBasedOnValues.map((([e])=>e)):void 0,o=t.colorsBasedOnValues?t.colorsBasedOnValues.map((([,e])=>[...C(e).rgb(),Math.floor(2.55*t.alpha)])):void 0,l=t.useColorClasses?t.colorClasses.map((([e])=>[...C(e).rgb(),Math.floor(2.55*t.alpha)])):void 0,g=t.useColorClasses?t.colorClasses.map((([,e])=>e)):void 0,h=t.useColorClasses?t.colorClasses.map((([,,e],A)=>void 0!==e?e:A===t.colorClasses.length-1?[!0,!0]:[!0,!1])):void 0;for(let f=0;f<A;f+=4){let A=t.nullColor;if(!Number.isNaN(e[a])&&(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=[...r(e[a]).rgb(),Math.floor(2.55*t.alpha)]),t.useColorsBasedOnValues){const i=s.indexOf(e[a]);A=i>-1?o[i]:t.unidentifiedColor}if(t.useColorClasses){const i=this.findClassIndex(e[a],g,h);A=i>-1?l[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))}[n[f],n[f+1],n[f+2],n[f+3]]=A,a+=i}return n}findClassIndex(e,t,A){for(let i=0;i<t.length;i+=1){const[r,a]=t[i],[n,s]=A[i];if((n?e>=r:e>r)&&(s?e<=a:e<a))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:[...C(e).rgb(),255]}hasPixelsNoData(e,t){return void 0!==t&&e.every((e=>e===t))}}function Ua(e,t,A){const i=new Da(t+1).createTile(A),{vertices:r,triangles:a}=i.getMesh(e);return{vertices:r,triangles:a}}const Fa=40075e3,Ra=20037500;class La{constructor(e){this.zoomRange=[0,0],this.lowestOriginTileOffset=[0,0],this.lowestOriginTileSize=0,this.loaded=!1,this.geo=new Ga,this.lzw=new wi,this.options=e}initializeCog(e){return m(this,void 0,void 0,(function*(){X.fetch=(e,t)=>m(this,void 0,void 0,(function*(){return yield fetch(e,t)}));const t=new X(e);return this.cog=yield H.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]),a=Math.max(t[1],t[3]),n=this.getLatLon([A,r]),s=this.getLatLon([i,a]);return[n[0],n[1],s[0],s[1]]}getOriginAsLatLon(e){const{origin:t}=e.images[e.images.length-1];return this.getLatLon(t)}getImageTileIndex(e){const t=Ra+e.origin[0],A=-(Ra+(e.origin[1]-Fa)),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 Fa/e/Math.pow(2,t)}getZoomLevelFromResolution(e,t){return Math.round(Math.log2(Fa/(t*e)))}getLatLon(e){const t=function(e){const[t,A]=e,i=t/512*(2*hi)-hi,r=2*(Math.atan(Math.exp(A/512*(2*hi)-hi))-fi);return[i*ci,r*ci]}([12776044915782906e-21*(Ra+e[0]),12776044915782906e-21*-(Ra+(e[1]-Fa))]);return[t[0],-t[1]]}getTile(e,t,A,i,r){return m(this,void 0,void 0,(function*(){const a=this.getResolutionFromZoomLevel(this.tileSize,A),n=this.cog.getImageByResolution(a);let s=[0,0];if(A===this.zoomRange[0])s=this.lowestOriginTileOffset;else{const e=Math.pow(2,A-this.zoomRange[0]);s[0]=Math.floor(this.lowestOriginTileOffset[0]*e),s[1]=Math.floor(this.lowestOriginTileOffset[1]*e)}const o=n.tileCount.x,l=n.tileCount.y,g=s[0],h=s[1];let f,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 d=n.tags.get(258).value;if(Array.isArray(d))if("terrain"===this.options.type){let e=0;d.forEach((t=>{e+=t})),d=e}else[d]=d;if(e-g>=0&&t-h>=0&&e-g<o&&t-h<l){const A=yield n.getTile(e-g,t-h);switch(n.compression){case"image/jpeg":c=gi.decode(A.bytes,{useTArray:!0});break;case"application/deflate":c=yield ai(A.bytes);break;case"application/lzw":c=this.lzw.decodeBlock(A.bytes.buffer);break;default:console.warn(`Unexpected compression method: ${n.compression}`)}let a;switch(this.options.format){case"uint8":a=new Uint8Array(c.buffer);break;case"uint16":a=new Uint16Array(c.buffer);break;case"uint32":a=new Uint32Array(c.buffer);break;case"int8":a=new Int8Array(c.buffer);break;case"int16":a=new Int16Array(c.buffer);break;case"int32":a=new Int32Array(c.buffer);break;case"float32":a=new Float32Array(c.buffer);break;case"float64":a=new Float64Array(c.buffer);break;default:a=null}return f=yield this.geo.getMap({rasters:[a],width:this.tileSize,height:this.tileSize,bounds:i},this.options,r),f}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)}}}class Ma extends d.CompositeLayer{constructor(e,t,A){super({}),this.id="",this.id=e,this.cogTiles=new La(A),this.blurredTexture=A.blurredTexture,this.url=t}initializeState(){this.state={initialized:!1},this.init(this.url)}init(e){return m(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 I.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,A,i,r,a,n,s;const{bbox:{west:o,south:l,east:g,north:h}}=e.tile;return new u.BitmapLayer(e,Object.assign({data:null,image:e.data,bounds:[o,l,g,h],opacity:1,textureParameters:{minFilter:this.blurredTexture?"linear":"nearest",magFilter:this.blurredTexture?"linear":"nearest"},extensions:(null===(A=null===(t=this.cogTiles)||void 0===t?void 0:t.options)||void 0===A?void 0:A.clampToTerrain)?[new B._TerrainExtension]:[]},(null===(a=null===(r=null===(i=this.cogTiles)||void 0===i?void 0:i.options)||void 0===r?void 0:r.clampToTerrain)||void 0===a?void 0:a.terrainDrawMode)?{terrainDrawMode:null===(s=null===(n=this.cogTiles)||void 0===n?void 0:n.options)||void 0===s?void 0:s.clampToTerrain.terrainDrawMode}:{}))}})}return null}}Ma.layerName="CogBitmapLayer",Ma.displayName="CogBitmapLayer";const Ta={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 A=e.length;if(A!==t.length)return!1;for(let i=0;i<A;i++)if(e[i]!==t[i])return!1;return!0}},Na=[1],Oa=Object.assign(Object.assign({},I.TileLayer.defaultProps),{elevationData:Ta,texture:Object.assign(Object.assign({},Ta),{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 Pa extends d.CompositeLayer{initializeState(e){const t=Object.create(null,{initializeState:{get:()=>super.initializeState}});return m(this,void 0,void 0,(function*(){t.initializeState.call(this,e),this.setState({terrainCogTiles:new La(this.props.terrainOptions),initialized:!1}),yield this.init(this.terrainUrl)}))}init(e){return m(this,void 0,void 0,(function*(){const e=yield this.state.terrainCogTiles.initializeCog(this.props.elevationData),t=this.state.terrainCogTiles.getZoomRange(e);[this.minZoom,this.maxZoom]=t,this.setState({initialized:!0})}))}updateState({props:e,oldProps:t}){const A=e.elevationData!==t.elevationData;if(A){const{elevationData:t}=e,A=t&&(Array.isArray(t)||t.includes("{x}")&&t.includes("{y}"))||this.props.isTiled;this.setState({isTiled:A})}A||e.meshMaxError!==t.meshMaxError||e.elevationDecoder!==t.elevationDecoder||(e.bounds,t.bounds);this.state.isTiled,e.workerUrl&&d.log.removed("workerUrl","loadOptions.terrain.workerUrl")()}loadTerrain({elevationData:e,bounds:t,elevationDecoder:A,meshMaxError:i,signal:r}){if(!e)return null;let a=this.getLoadOptions();a=Object.assign(Object.assign({},a),{_workerType:"test",terrain:Object.assign(Object.assign({skirtHeight:this.state.isTiled?2*i:0},null==a?void 0:a.terrain),{bounds:t,meshMaxError:i,elevationDecoder:A})});const{fetch:n}=this.props;return n(e,{propName:"elevationData",layer:this,loadOptions:a,signal:r,loaders:[]})}getTiledTerrainData(e){return m(this,void 0,void 0,(function*(){this.props;const{viewport:t}=this.context;let A=[0,0],i=[0,0];if(t.isGeospatial){const r=e.bbox;A=t.projectFlat([r.west,r.south]),i=t.projectFlat([r.east,r.north])}else{const t=e.bbox;A=[t.left,t.bottom],i=[t.right,t.top]}const r=[A[0],A[1],i[0],i[1]],a=yield this.state.terrainCogTiles.getTile(e.index.x,e.index.y,e.index.z,r,this.props.meshMaxError);return Promise.all([a])}))}renderSubLayers(e){const t=this.getSubLayerClass("mesh",Q.SimpleMeshLayer),{color:A,wireframe:i,material:r}=this.props,{data:a}=e;if(!a)return null;const[n]=a;return new t(Object.assign(Object.assign({},e),{tileSize:256}),{data:Na,mesh:n,_instanced:!1,coordinateSystem:d.COORDINATE_SYSTEM.CARTESIAN,getPosition:e=>[0,0,0],getColor:A,wireframe:i,material:r})}onViewportLoad(e){if(!e)return;const{zRange:t}=this.state,A=e.map((e=>e.content)).filter((e=>e&&e[0])).map((e=>{var t,A;const i=null===(A=null===(t=e[0])||void 0===t?void 0:t.header)||void 0===A?void 0:A.boundingBox;return null==i?void 0:i.map((e=>e[2]))}));if(0===A.length)return;const i=Math.min(...A.map((e=>e[0]))),r=Math.max(...A.map((e=>e[1])));(!t||i<t[0]||r>t[1])&&this.setState({zRange:[Number.isFinite(i)?i:0,Number.isFinite(r)?r:0]})}renderLayers(){const{color:e,material:t,elevationData:A,texture:i,wireframe:r,meshMaxError:a,elevationDecoder:n,tileSize:s,maxZoom:o,minZoom:l,extent:g,maxRequests:h,onTileLoad:f,onTileUnload:c,onTileError:d,maxCacheSize:u,maxCacheByteSize:B,refinementStrategy:C}=this.props;if(this.state.isTiled&&this.state.initialized)return new I.TileLayer(this.getSubLayerProps({id:"tiles"}),{getTileData:this.getTiledTerrainData.bind(this),renderSubLayers:this.renderSubLayers.bind(this),updateTriggers:{getTileData:{elevationData:(E=A,Array.isArray(E)?E.join(";"):E||""),meshMaxError:a,elevationDecoder:n}},onViewportLoad:this.onViewportLoad.bind(this),zRange:this.state.zRange||null,tileSize:s,maxZoom:o,minZoom:l,extent:g,maxRequests:h,onTileLoad:f,onTileUnload:c,onTileError:d,maxCacheSize:u,maxCacheByteSize:B,refinementStrategy:C});var E}}Pa.defaultProps=Oa,Pa.layerName="TerrainLayer";var za={CogBitmapLayer:Ma,CogTerrainLayer:Pa,cogtiles:La,GeoImage:Ga};var Ka=Object.freeze({__proto__:null,default:class extends Ea{decodeBlock(e){return e}}});const qa=257;function Ja(e,t){for(let A=t.length-1;A>=0;A--)e.push(t[A]);return e}function Ha(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,a=0;function n(){i=258,r=9}function s(e){const t=function(e,t,A){const i=t%8,r=Math.floor(t/8),a=8-i,n=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)"),qa;let l=e[r]&2**(8-i)-1;l<<=A-a;let g=l;if(r+1<e.length){let t=e[r+1]>>>s;t<<=Math.max(0,A-o),g+=t}if(n>8&&r+2<e.length){const i=8*(r+3)-(t+A);g+=e[r+2]>>>i}return g}(e,a,r);return a+=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=[];n();const h=new Uint8Array(e);let f,c=s(h);for(;c!==qa;){if(256===c){for(n(),c=s(h);256===c;)c=s(h);if(c===qa)break;if(c>256)throw new Error(`corrupted code at scanline ${c}`);Ja(g,l(c)),f=c}else if(c<i){const e=l(c);Ja(g,e),o(f,e[e.length-1]),f=c}else{const e=l(f);if(!e)throw new Error(`Bogus entry. Not in dictionary, ${f} / ${i}, position: ${a}`);Ja(g,e),g.push(e[e.length-1]),o(f,e[e.length-1]),f=c}i+1>=2**r&&(12===r?f=void 0:r++),c=s(h)}return new Uint8Array(g)}var Ya=Object.freeze({__proto__:null,default:class extends Ea{decodeBlock(e){return Ha(e).buffer}}});const Va=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]),Za=4017,ja=799,Xa=3406,Wa=2276,$a=1567,en=3784,tn=5793,An=2896;function rn(e,t){let A=0;const i=[];let r=16;for(;r>0&&!e[r-1];)--r;i.push({children:[],index:0});let a,n=i[0];for(let s=0;s<r;s++){for(let r=0;r<e[s];r++){for(n=i.pop(),n.children[n.index]=t[A];n.index>0;)n=i.pop();for(n.index++,i.push(n);i.length<=s;)i.push(a={children:[],index:0}),n.children[n.index]=a.children,n=a;A++}s+1<r&&(i.push(a={children:[],index:0}),n.children[n.index]=a.children,n=a)}return i[0].children}function an(e,t,A,i,r,a,n,s,o){const{mcusPerLine:l,progressive:g}=A,h=t;let f=t,c=0,d=0;function I(){if(d>0)return d--,c>>d&1;if(c=e[f++],255===c){const t=e[f++];if(t)throw new Error(`unexpected marker: ${(c<<8|t).toString(16)}`)}return d=7,c>>>7}function u(e){let t,A=e;for(;null!==(t=I());){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=I();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 a=A%l,n=(A/l|0)*e.v+i,s=a*e.h+r;t(e,e.blocks[n][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,S;S=g?0===a?0===s?function(e,t){const A=u(e.huffmanTableDC),i=0===A?0:C(A)<<o;e.pred+=i,t[0]=e.pred}:function(e,t){t[0]|=I()<<o}:0===s?function(e,t){if(E>0)return void E--;let A=a;const i=n;for(;A<=i;){const i=u(e.huffmanTableAC),r=15&i,a=i>>4;if(0===r){if(a<15){E=B(a)+(1<<a)-1;break}A+=16}else A+=a,t[Va[A]]=C(r)*(1<<o),A++}}:function(e,t){let A=a;const i=n;let r=0;for(;A<=i;){const i=Va[A],a=t[i]<0?-1:1;switch(Q){case 0:{const t=u(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]+=(I()<<o)*a:(r--,0===r&&(Q=2===Q?3:0));break;case 3:t[i]?t[i]+=(I()<<o)*a:(t[i]=w<<o,Q=0);break;case 4:t[i]&&(t[i]+=(I()<<o)*a)}A++}4===Q&&(E--,0===E&&(Q=0))}:function(e,t){const A=u(e.huffmanTableDC),i=0===A?0:C(A);e.pred+=i,t[0]=e.pred;let r=1;for(;r<64;){const A=u(e.huffmanTableAC),i=15&A,a=A>>4;if(0===i){if(a<15)break;r+=16}else r+=a,t[Va[r]]=C(i),r++}};let x,G,U=0;G=1===y?i[0].blocksPerLine*i[0].blocksPerColumn:l*A.mcusPerColumn;const F=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<F;v++)p(_,S,U),U++;else for(v=0;v<F;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(_,S,U,D,k)}if(U++,U===G)break}if(d=0,x=e[f]<<8|e[f+1],x<65280)throw new Error("marker was not found");if(!(x>=65488&&x<=65495))break;f+=2}return f-h}function nn(e,t){const A=[],{blocksPerLine:i,blocksPerColumn:r}=t,a=i<<3,n=new Int32Array(64),s=new Uint8Array(64);function o(e,A,i){const r=t.quantizationTable;let a,n,s,o,l,g,h,f,c;const d=i;let I;for(I=0;I<64;I++)d[I]=e[I]*r[I];for(I=0;I<8;++I){const e=8*I;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]?(a=tn*d[0+e]+128>>8,n=tn*d[4+e]+128>>8,s=d[2+e],o=d[6+e],l=An*(d[1+e]-d[7+e])+128>>8,f=An*(d[1+e]+d[7+e])+128>>8,g=d[3+e]<<4,h=d[5+e]<<4,c=a-n+1>>1,a=a+n+1>>1,n=c,c=s*en+o*$a+128>>8,s=s*$a-o*en+128>>8,o=c,c=l-h+1>>1,l=l+h+1>>1,h=c,c=f+g+1>>1,g=f-g+1>>1,f=c,c=a-o+1>>1,a=a+o+1>>1,o=c,c=n-s+1>>1,n=n+s+1>>1,s=c,c=l*Wa+f*Xa+2048>>12,l=l*Xa-f*Wa+2048>>12,f=c,c=g*ja+h*Za+2048>>12,g=g*Za-h*ja+2048>>12,h=c,d[0+e]=a+f,d[7+e]=a-f,d[1+e]=n+h,d[6+e]=n-h,d[2+e]=s+g,d[5+e]=s-g,d[3+e]=o+l,d[4+e]=o-l):(c=tn*d[0+e]+512>>10,d[0+e]=c,d[1+e]=c,d[2+e]=c,d[3+e]=c,d[4+e]=c,d[5+e]=c,d[6+e]=c,d[7+e]=c)}for(I=0;I<8;++I){const e=I;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]?(a=tn*d[0+e]+2048>>12,n=tn*d[32+e]+2048>>12,s=d[16+e],o=d[48+e],l=An*(d[8+e]-d[56+e])+2048>>12,f=An*(d[8+e]+d[56+e])+2048>>12,g=d[24+e],h=d[40+e],c=a-n+1>>1,a=a+n+1>>1,n=c,c=s*en+o*$a+2048>>12,s=s*$a-o*en+2048>>12,o=c,c=l-h+1>>1,l=l+h+1>>1,h=c,c=f+g+1>>1,g=f-g+1>>1,f=c,c=a-o+1>>1,a=a+o+1>>1,o=c,c=n-s+1>>1,n=n+s+1>>1,s=c,c=l*Wa+f*Xa+2048>>12,l=l*Xa-f*Wa+2048>>12,f=c,c=g*ja+h*Za+2048>>12,g=g*Za-h*ja+2048>>12,h=c,d[0+e]=a+f,d[56+e]=a-f,d[8+e]=n+h,d[48+e]=n-h,d[16+e]=s+g,d[40+e]=s-g,d[24+e]=o+l,d[32+e]=o-l):(c=tn*i[I+0]+8192>>14,d[0+e]=c,d[8+e]=c,d[16+e]=c,d[24+e]=c,d[32+e]=c,d[40+e]=c,d[48+e]=c,d[56+e]=c)}for(I=0;I<64;++I){const e=128+(d[I]+8>>4);A[I]=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(a));for(let a=0;a<i;a++){o(t.blocks[e][a],s,n);let i=0;const l=a<<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 sn{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 a=Math.ceil(e.samplesPerLine/8/i),n=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=a*t.h,g=n*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=a,e.mcusPerColumn=n}let a=A();if(65496!==a)throw new Error("SOI not found");for(a=A();65497!==a;){switch(a){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===a&&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===a&&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[Va[A]]=e[t++]}else{if(i>>4!=1)throw new Error("DQT: invalid table spec");for(let e=0;e<64;e++){r[Va[e]]=A()}}this.quantizationTables[15&i]=r}break}case 65472:case 65473:case 65474:{A();const i={extended:65473===a,progressive:65474===a,precision:e[t++],scanLines:A(),samplesPerLine:A(),components:{},componentsOrder:[]},n=e[t++];let s;for(let A=0;A<n;A++){s=e[t];const A=e[t+1]>>4,r=15&e[t+1],a=e[t+2];i.componentsOrder.push(s),i.components[s]={h:A,v:r,quantizationIdx:a},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 a=0;for(let A=0;A<16;A++,t++)r[A]=e[t],a+=r[A];const n=new Uint8Array(a);for(let A=0;A<a;A++,t++)n[A]=e[t];A+=17+a,i>>4==0?this.huffmanTablesDC[15&i]=rn(r,n):this.huffmanTablesAC[15&i]=rn(r,n)}break}case 65501:A(),this.resetInterval=A();break;case 65498:{A();const i=e[t++],r=[],a=this.frames[0];for(let A=0;A<i;A++){const A=a.components[e[t++]],i=e[t++];A.huffmanTableDC=this.huffmanTablesDC[i>>4],A.huffmanTableAC=this.huffmanTablesAC[15&i],r.push(A)}const n=e[t++],s=e[t++],o=e[t++],l=an(e,t,a,r,this.resetInterval,n,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 ${a.toString(16)}`)}a=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=[],a=t.samplesPerLine,n=t.scanLines;for(let e=0;e<i.length;e++){const a=A[i[e]];r.push({lines:nn(0,a),scaleX:a.h/t.maxH,scaleY:a.v/t.maxV})}const s=new Uint8Array(a*n*r.length);let o=0;for(let e=0;e<n;++e)for(let t=0;t<a;++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 on=Object.freeze({__proto__:null,default:class extends Ea{constructor(e){super(),this.reader=new sn,e.JPEGTables&&this.reader.parse(e.JPEGTables)}decodeBlock(e){return this.reader.resetFrames(),this.reader.parse(new Uint8Array(e)),this.reader.getResult().buffer}}});
|
|
3
3
|
/*! pako 2.1.0 https://github.com/nodeca/pako @license (MIT AND Zlib) */function ln(e){let t=e.length;for(;--t>=0;)e[t]=0}const gn=256,hn=286,fn=30,cn=15,dn=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]),In=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]),un=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),Bn=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Cn=new Array(576);ln(Cn);const En=new Array(60);ln(En);const wn=new Array(512);ln(wn);const Qn=new Array(256);ln(Qn);const mn=new Array(29);ln(mn);const pn=new Array(fn);function yn(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 _n,bn,Dn;function kn(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}ln(pn);const vn=e=>e<256?wn[e]:wn[256+(e>>>7)],Sn=(e,t)=>{e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255},xn=(e,t,A)=>{e.bi_valid>16-A?(e.bi_buf|=t<<e.bi_valid&65535,Sn(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)},Gn=(e,t,A)=>{xn(e,A[2*t],A[2*t+1])},Un=(e,t)=>{let A=0;do{A|=1&e,e>>>=1,A<<=1}while(--t>0);return A>>>1},Fn=(e,t,A)=>{const i=new Array(16);let r,a,n=0;for(r=1;r<=cn;r++)n=n+A[r-1]<<1,i[r]=n;for(a=0;a<=t;a++){let t=e[2*a+1];0!==t&&(e[2*a]=Un(i[t]++,t))}},Rn=e=>{let t;for(t=0;t<hn;t++)e.dyn_ltree[2*t]=0;for(t=0;t<fn;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},Ln=e=>{e.bi_valid>8?Sn(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0},Mn=(e,t,A,i)=>{const r=2*t,a=2*A;return e[r]<e[a]||e[r]===e[a]&&i[t]<=i[A]},Tn=(e,t,A)=>{const i=e.heap[A];let r=A<<1;for(;r<=e.heap_len&&(r<e.heap_len&&Mn(t,e.heap[r+1],e.heap[r],e.depth)&&r++,!Mn(t,i,e.heap[r],e.depth));)e.heap[A]=e.heap[r],A=r,r<<=1;e.heap[A]=i},Nn=(e,t,A)=>{let i,r,a,n,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?Gn(e,r,t):(a=Qn[r],Gn(e,a+gn+1,t),n=dn[a],0!==n&&(r-=mn[a],xn(e,r,n)),i--,a=vn(i),Gn(e,a,A),n=In[a],0!==n&&(i-=pn[a],xn(e,i,n)))}while(s<e.sym_next);Gn(e,256,t)},On=(e,t)=>{const A=t.dyn_tree,i=t.stat_desc.static_tree,r=t.stat_desc.has_stree,a=t.stat_desc.elems;let n,s,o,l=-1;for(e.heap_len=0,e.heap_max=573,n=0;n<a;n++)0!==A[2*n]?(e.heap[++e.heap_len]=l=n,e.depth[n]=0):A[2*n+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,n=e.heap_len>>1;n>=1;n--)Tn(e,A,n);o=a;do{n=e.heap[1],e.heap[1]=e.heap[e.heap_len--],Tn(e,A,1),s=e.heap[1],e.heap[--e.heap_max]=n,e.heap[--e.heap_max]=s,A[2*o]=A[2*n]+A[2*s],e.depth[o]=(e.depth[n]>=e.depth[s]?e.depth[n]:e.depth[s])+1,A[2*n+1]=A[2*s+1]=o,e.heap[1]=o++,Tn(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,a=t.stat_desc.has_stree,n=t.stat_desc.extra_bits,s=t.stat_desc.extra_base,o=t.stat_desc.max_length;let l,g,h,f,c,d,I=0;for(f=0;f<=cn;f++)e.bl_count[f]=0;for(A[2*e.heap[e.heap_max]+1]=0,l=e.heap_max+1;l<573;l++)g=e.heap[l],f=A[2*A[2*g+1]+1]+1,f>o&&(f=o,I++),A[2*g+1]=f,g>i||(e.bl_count[f]++,c=0,g>=s&&(c=n[g-s]),d=A[2*g],e.opt_len+=d*(f+c),a&&(e.static_len+=d*(r[2*g+1]+c)));if(0!==I){do{for(f=o-1;0===e.bl_count[f];)f--;e.bl_count[f]--,e.bl_count[f+1]+=2,e.bl_count[o]--,I-=2}while(I>0);for(f=o;0!==f;f--)for(g=e.bl_count[f];0!==g;)h=e.heap[--l],h>i||(A[2*h+1]!==f&&(e.opt_len+=(f-A[2*h+1])*A[2*h],A[2*h+1]=f),g--)}})(e,t),Fn(A,l,e.bl_count)},Pn=(e,t,A)=>{let i,r,a=-1,n=t[1],s=0,o=7,l=4;for(0===n&&(o=138,l=3),t[2*(A+1)+1]=65535,i=0;i<=A;i++)r=n,n=t[2*(i+1)+1],++s<o&&r===n||(s<l?e.bl_tree[2*r]+=s:0!==r?(r!==a&&e.bl_tree[2*r]++,e.bl_tree[32]++):s<=10?e.bl_tree[34]++:e.bl_tree[36]++,s=0,a=r,0===n?(o=138,l=3):r===n?(o=6,l=3):(o=7,l=4))},zn=(e,t,A)=>{let i,r,a=-1,n=t[1],s=0,o=7,l=4;for(0===n&&(o=138,l=3),i=0;i<=A;i++)if(r=n,n=t[2*(i+1)+1],!(++s<o&&r===n)){if(s<l)do{Gn(e,r,e.bl_tree)}while(0!=--s);else 0!==r?(r!==a&&(Gn(e,r,e.bl_tree),s--),Gn(e,16,e.bl_tree),xn(e,s-3,2)):s<=10?(Gn(e,17,e.bl_tree),xn(e,s-3,3)):(Gn(e,18,e.bl_tree),xn(e,s-11,7));s=0,a=r,0===n?(o=138,l=3):r===n?(o=6,l=3):(o=7,l=4)}};let Kn=!1;const qn=(e,t,A,i)=>{xn(e,0+(i?1:0),3),Ln(e),Sn(e,A),Sn(e,~A),A&&e.pending_buf.set(e.window.subarray(t,t+A),e.pending),e.pending+=A};var Jn=(e,t,A,i)=>{let r,a,n=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<gn;t++)if(0!==e.dyn_ltree[2*t])return 1;return 0})(e)),On(e,e.l_desc),On(e,e.d_desc),n=(e=>{let t;for(Pn(e,e.dyn_ltree,e.l_desc.max_code),Pn(e,e.dyn_dtree,e.d_desc.max_code),On(e,e.bl_desc),t=18;t>=3&&0===e.bl_tree[2*Bn[t]+1];t--);return e.opt_len+=3*(t+1)+5+5+4,t})(e),r=e.opt_len+3+7>>>3,a=e.static_len+3+7>>>3,a<=r&&(r=a)):r=a=A+5,A+4<=r&&-1!==t?qn(e,t,A,i):4===e.strategy||a===r?(xn(e,2+(i?1:0),3),Nn(e,Cn,En)):(xn(e,4+(i?1:0),3),((e,t,A,i)=>{let r;for(xn(e,t-257,5),xn(e,A-1,5),xn(e,i-4,4),r=0;r<i;r++)xn(e,e.bl_tree[2*Bn[r]+1],3);zn(e,e.dyn_ltree,t-1),zn(e,e.dyn_dtree,A-1)})(e,e.l_desc.max_code+1,e.d_desc.max_code+1,n+1),Nn(e,e.dyn_ltree,e.dyn_dtree)),Rn(e),i&&Ln(e)},Hn={_tr_init:e=>{Kn||((()=>{let e,t,A,i,r;const a=new Array(16);for(A=0,i=0;i<28;i++)for(mn[i]=A,e=0;e<1<<dn[i];e++)Qn[A++]=i;for(Qn[A-1]=i,r=0,i=0;i<16;i++)for(pn[i]=r,e=0;e<1<<In[i];e++)wn[r++]=i;for(r>>=7;i<fn;i++)for(pn[i]=r<<7,e=0;e<1<<In[i]-7;e++)wn[256+r++]=i;for(t=0;t<=cn;t++)a[t]=0;for(e=0;e<=143;)Cn[2*e+1]=8,e++,a[8]++;for(;e<=255;)Cn[2*e+1]=9,e++,a[9]++;for(;e<=279;)Cn[2*e+1]=7,e++,a[7]++;for(;e<=287;)Cn[2*e+1]=8,e++,a[8]++;for(Fn(Cn,287,a),e=0;e<fn;e++)En[2*e+1]=5,En[2*e]=Un(e,5);_n=new yn(Cn,dn,257,hn,cn),bn=new yn(En,In,0,fn,cn),Dn=new yn(new Array(0),un,0,19,7)})(),Kn=!0),e.l_desc=new kn(e.dyn_ltree,_n),e.d_desc=new kn(e.dyn_dtree,bn),e.bl_desc=new kn(e.bl_tree,Dn),e.bi_buf=0,e.bi_valid=0,Rn(e)},_tr_stored_block:qn,_tr_flush_block:Jn,_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*(Qn[A]+gn+1)]++,e.dyn_dtree[2*vn(t)]++),e.sym_next===e.sym_end),_tr_align:e=>{xn(e,2,3),Gn(e,256,Cn),(e=>{16===e.bi_valid?(Sn(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 Yn=(e,t,A,i)=>{let r=65535&e|0,a=e>>>16&65535|0,n=0;for(;0!==A;){n=A>2e3?2e3:A,A-=n;do{r=r+t[i++]|0,a=a+r|0}while(--n);r%=65521,a%=65521}return r|a<<16|0};const Vn=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 Zn=(e,t,A,i)=>{const r=Vn,a=i+A;e^=-1;for(let A=i;A<a;A++)e=e>>>8^r[255&(e^t[A])];return-1^e},jn={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"},Xn={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:Wn,_tr_stored_block:$n,_tr_flush_block:es,_tr_tally:ts,_tr_align:As}=Hn,{Z_NO_FLUSH:is,Z_PARTIAL_FLUSH:rs,Z_FULL_FLUSH:as,Z_FINISH:ns,Z_BLOCK:ss,Z_OK:os,Z_STREAM_END:ls,Z_STREAM_ERROR:gs,Z_DATA_ERROR:hs,Z_BUF_ERROR:fs,Z_DEFAULT_COMPRESSION:cs,Z_FILTERED:ds,Z_HUFFMAN_ONLY:Is,Z_RLE:us,Z_FIXED:Bs,Z_DEFAULT_STRATEGY:Cs,Z_UNKNOWN:Es,Z_DEFLATED:ws}=Xn,Qs=258,ms=262,ps=42,ys=113,_s=666,bs=(e,t)=>(e.msg=jn[t],t),Ds=e=>2*e-(e>4?9:0),ks=e=>{let t=e.length;for(;--t>=0;)e[t]=0},vs=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 Ss=(e,t,A)=>(t<<e.hash_shift^A)&e.hash_mask;const xs=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))},Gs=(e,t)=>{es(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,xs(e.strm)},Us=(e,t)=>{e.pending_buf[e.pending++]=t},Fs=(e,t)=>{e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t},Rs=(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=Yn(e.adler,t,r,A):2===e.state.wrap&&(e.adler=Zn(e.adler,t,r,A)),e.next_in+=r,e.total_in+=r,r)},Ls=(e,t)=>{let A,i,r=e.max_chain_length,a=e.strstart,n=e.prev_length,s=e.nice_match;const o=e.strstart>e.w_size-ms?e.strstart-(e.w_size-ms):0,l=e.window,g=e.w_mask,h=e.prev,f=e.strstart+Qs;let c=l[a+n-1],d=l[a+n];e.prev_length>=e.good_match&&(r>>=2),s>e.lookahead&&(s=e.lookahead);do{if(A=t,l[A+n]===d&&l[A+n-1]===c&&l[A]===l[a]&&l[++A]===l[a+1]){a+=2,A++;do{}while(l[++a]===l[++A]&&l[++a]===l[++A]&&l[++a]===l[++A]&&l[++a]===l[++A]&&l[++a]===l[++A]&&l[++a]===l[++A]&&l[++a]===l[++A]&&l[++a]===l[++A]&&a<f);if(i=Qs-(f-a),a=f-Qs,i>n){if(e.match_start=t,n=i,i>=s)break;c=l[a+n-1],d=l[a+n]}}}while((t=h[t&g])>o&&0!=--r);return n<=e.lookahead?n:e.lookahead},Ms=e=>{const t=e.w_size;let A,i,r;do{if(i=e.window_size-e.lookahead-e.strstart,e.strstart>=t+(t-ms)&&(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),vs(e),i+=t),0===e.strm.avail_in)break;if(A=Rs(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=Ss(e,e.ins_h,e.window[r+1]);e.insert&&(e.ins_h=Ss(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<ms&&0!==e.strm.avail_in)},Ts=(e,t)=>{let A,i,r,a=e.pending_buf_size-5>e.w_size?e.w_size:e.pending_buf_size-5,n=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<a&&(0===A&&t!==ns||t===is||A!==i+e.strm.avail_in))break;n=t===ns&&A===i+e.strm.avail_in?1:0,$n(e,0,0,n),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,xs(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&&(Rs(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===n);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),n?4:t!==is&&t!==ns&&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&&(Rs(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,a=r>e.w_size?e.w_size:r,i=e.strstart-e.block_start,(i>=a||(i||t===ns)&&t!==is&&0===e.strm.avail_in&&i<=r)&&(A=i>r?r:i,n=t===ns&&0===e.strm.avail_in&&A===i?1:0,$n(e,e.block_start,A,n),e.block_start+=A,xs(e.strm)),n?3:1)},Ns=(e,t)=>{let A,i;for(;;){if(e.lookahead<ms){if(Ms(e),e.lookahead<ms&&t===is)return 1;if(0===e.lookahead)break}if(A=0,e.lookahead>=3&&(e.ins_h=Ss(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-ms&&(e.match_length=Ls(e,A)),e.match_length>=3)if(i=ts(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=Ss(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=Ss(e,e.ins_h,e.window[e.strstart+1]);else i=ts(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(i&&(Gs(e,!1),0===e.strm.avail_out))return 1}return e.insert=e.strstart<2?e.strstart:2,t===ns?(Gs(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(Gs(e,!1),0===e.strm.avail_out)?1:2},Os=(e,t)=>{let A,i,r;for(;;){if(e.lookahead<ms){if(Ms(e),e.lookahead<ms&&t===is)return 1;if(0===e.lookahead)break}if(A=0,e.lookahead>=3&&(e.ins_h=Ss(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-ms&&(e.match_length=Ls(e,A),e.match_length<=5&&(e.strategy===ds||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=ts(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=Ss(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&&(Gs(e,!1),0===e.strm.avail_out))return 1}else if(e.match_available){if(i=ts(e,0,e.window[e.strstart-1]),i&&Gs(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=ts(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<2?e.strstart:2,t===ns?(Gs(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(Gs(e,!1),0===e.strm.avail_out)?1:2};function Ps(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 zs=[new Ps(0,0,0,0,Ts),new Ps(4,4,8,4,Ns),new Ps(4,5,16,8,Ns),new Ps(4,6,32,32,Ns),new Ps(4,4,16,16,Os),new Ps(8,16,32,32,Os),new Ps(8,16,128,128,Os),new Ps(8,32,128,256,Os),new Ps(32,128,258,1024,Os),new Ps(32,258,258,4096,Os)];function Ks(){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=ws,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),ks(this.dyn_ltree),ks(this.dyn_dtree),ks(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),ks(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(573),ks(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 qs=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||t.status!==ps&&57!==t.status&&69!==t.status&&73!==t.status&&91!==t.status&&103!==t.status&&t.status!==ys&&t.status!==_s?1:0},Js=e=>{if(qs(e))return bs(e,gs);e.total_in=e.total_out=0,e.data_type=Es;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?ps:ys,e.adler=2===t.wrap?0:1,t.last_flush=-2,Wn(t),os},Hs=e=>{const t=Js(e);var A;return t===os&&((A=e.state).window_size=2*A.w_size,ks(A.head),A.max_lazy_match=zs[A.level].max_lazy,A.good_match=zs[A.level].good_length,A.nice_match=zs[A.level].nice_length,A.max_chain_length=zs[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},Ys=(e,t,A,i,r,a)=>{if(!e)return gs;let n=1;if(t===cs&&(t=6),i<0?(n=0,i=-i):i>15&&(n=2,i-=16),r<1||r>9||A!==ws||i<8||i>15||t<0||t>9||a<0||a>Bs||8===i&&1!==n)return bs(e,gs);8===i&&(i=9);const s=new Ks;return e.state=s,s.strm=e,s.status=ps,s.wrap=n,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=a,s.method=A,Hs(e)};var Vs={deflateInit:(e,t)=>Ys(e,t,ws,15,8,Cs),deflateInit2:Ys,deflateReset:Hs,deflateResetKeep:Js,deflateSetHeader:(e,t)=>qs(e)||2!==e.state.wrap?gs:(e.state.gzhead=t,os),deflate:(e,t)=>{if(qs(e)||t>ss||t<0)return e?bs(e,gs):gs;const A=e.state;if(!e.output||0!==e.avail_in&&!e.input||A.status===_s&&t!==ns)return bs(e,0===e.avail_out?fs:gs);const i=A.last_flush;if(A.last_flush=t,0!==A.pending){if(xs(e),0===e.avail_out)return A.last_flush=-1,os}else if(0===e.avail_in&&Ds(t)<=Ds(i)&&t!==ns)return bs(e,fs);if(A.status===_s&&0!==e.avail_in)return bs(e,fs);if(A.status===ps&&0===A.wrap&&(A.status=ys),A.status===ps){let t=ws+(A.w_bits-8<<4)<<8,i=-1;if(i=A.strategy>=Is||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,Fs(A,t),0!==A.strstart&&(Fs(A,e.adler>>>16),Fs(A,65535&e.adler)),e.adler=1,A.status=ys,xs(e),0!==A.pending)return A.last_flush=-1,os}if(57===A.status)if(e.adler=0,Us(A,31),Us(A,139),Us(A,8),A.gzhead)Us(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)),Us(A,255&A.gzhead.time),Us(A,A.gzhead.time>>8&255),Us(A,A.gzhead.time>>16&255),Us(A,A.gzhead.time>>24&255),Us(A,9===A.level?2:A.strategy>=Is||A.level<2?4:0),Us(A,255&A.gzhead.os),A.gzhead.extra&&A.gzhead.extra.length&&(Us(A,255&A.gzhead.extra.length),Us(A,A.gzhead.extra.length>>8&255)),A.gzhead.hcrc&&(e.adler=Zn(e.adler,A.pending_buf,A.pending,0)),A.gzindex=0,A.status=69;else if(Us(A,0),Us(A,0),Us(A,0),Us(A,0),Us(A,0),Us(A,9===A.level?2:A.strategy>=Is||A.level<2?4:0),Us(A,3),A.status=ys,xs(e),0!==A.pending)return A.last_flush=-1,os;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=Zn(e.adler,A.pending_buf,A.pending-t,t)),A.gzindex+=r,xs(e),0!==A.pending)return A.last_flush=-1,os;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=Zn(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=Zn(e.adler,A.pending_buf,A.pending-i,i)),xs(e),0!==A.pending)return A.last_flush=-1,os;i=0}t=A.gzindex<A.gzhead.name.length?255&A.gzhead.name.charCodeAt(A.gzindex++):0,Us(A,t)}while(0!==t);A.gzhead.hcrc&&A.pending>i&&(e.adler=Zn(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=Zn(e.adler,A.pending_buf,A.pending-i,i)),xs(e),0!==A.pending)return A.last_flush=-1,os;i=0}t=A.gzindex<A.gzhead.comment.length?255&A.gzhead.comment.charCodeAt(A.gzindex++):0,Us(A,t)}while(0!==t);A.gzhead.hcrc&&A.pending>i&&(e.adler=Zn(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&&(xs(e),0!==A.pending))return A.last_flush=-1,os;Us(A,255&e.adler),Us(A,e.adler>>8&255),e.adler=0}if(A.status=ys,xs(e),0!==A.pending)return A.last_flush=-1,os}if(0!==e.avail_in||0!==A.lookahead||t!==is&&A.status!==_s){let i=0===A.level?Ts(A,t):A.strategy===Is?((e,t)=>{let A;for(;;){if(0===e.lookahead&&(Ms(e),0===e.lookahead)){if(t===is)return 1;break}if(e.match_length=0,A=ts(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,A&&(Gs(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,t===ns?(Gs(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(Gs(e,!1),0===e.strm.avail_out)?1:2})(A,t):A.strategy===us?((e,t)=>{let A,i,r,a;const n=e.window;for(;;){if(e.lookahead<=Qs){if(Ms(e),e.lookahead<=Qs&&t===is)return 1;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=3&&e.strstart>0&&(r=e.strstart-1,i=n[r],i===n[++r]&&i===n[++r]&&i===n[++r])){a=e.strstart+Qs;do{}while(i===n[++r]&&i===n[++r]&&i===n[++r]&&i===n[++r]&&i===n[++r]&&i===n[++r]&&i===n[++r]&&i===n[++r]&&r<a);e.match_length=Qs-(a-r),e.match_length>e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=3?(A=ts(e,1,e.match_length-3),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(A=ts(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),A&&(Gs(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,t===ns?(Gs(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(Gs(e,!1),0===e.strm.avail_out)?1:2})(A,t):zs[A.level].func(A,t);if(3!==i&&4!==i||(A.status=_s),1===i||3===i)return 0===e.avail_out&&(A.last_flush=-1),os;if(2===i&&(t===rs?As(A):t!==ss&&($n(A,0,0,!1),t===as&&(ks(A.head),0===A.lookahead&&(A.strstart=0,A.block_start=0,A.insert=0))),xs(e),0===e.avail_out))return A.last_flush=-1,os}return t!==ns?os:A.wrap<=0?ls:(2===A.wrap?(Us(A,255&e.adler),Us(A,e.adler>>8&255),Us(A,e.adler>>16&255),Us(A,e.adler>>24&255),Us(A,255&e.total_in),Us(A,e.total_in>>8&255),Us(A,e.total_in>>16&255),Us(A,e.total_in>>24&255)):(Fs(A,e.adler>>>16),Fs(A,65535&e.adler)),xs(e),A.wrap>0&&(A.wrap=-A.wrap),0!==A.pending?os:ls)},deflateEnd:e=>{if(qs(e))return gs;const t=e.state.status;return e.state=null,t===ys?bs(e,hs):os},deflateSetDictionary:(e,t)=>{let A=t.length;if(qs(e))return gs;const i=e.state,r=i.wrap;if(2===r||1===r&&i.status!==ps||i.lookahead)return gs;if(1===r&&(e.adler=Yn(e.adler,t,A,0)),i.wrap=0,A>=i.w_size){0===r&&(ks(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 a=e.avail_in,n=e.next_in,s=e.input;for(e.avail_in=A,e.next_in=0,e.input=t,Ms(i);i.lookahead>=3;){let e=i.strstart,t=i.lookahead-2;do{i.ins_h=Ss(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,Ms(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=n,e.input=s,e.avail_in=a,i.wrap=r,os},deflateInfo:"pako deflate (from Nodeca project)"};const Zs=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var js={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)Zs(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 Xs=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(e){Xs=!1}const Ws=new Uint8Array(256);for(let e=0;e<256;e++)Ws[e]=e>=252?6:e>=248?5:e>=240?4:e>=224?3:e>=192?2:1;Ws[254]=Ws[254]=1;var $s={string2buf:e=>{if("function"==typeof TextEncoder&&TextEncoder.prototype.encode)return(new TextEncoder).encode(e);let t,A,i,r,a,n=e.length,s=0;for(r=0;r<n;r++)A=e.charCodeAt(r),55296==(64512&A)&&r+1<n&&(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),a=0,r=0;a<s;r++)A=e.charCodeAt(r),55296==(64512&A)&&r+1<n&&(i=e.charCodeAt(r+1),56320==(64512&i)&&(A=65536+(A-55296<<10)+(i-56320),r++)),A<128?t[a++]=A:A<2048?(t[a++]=192|A>>>6,t[a++]=128|63&A):A<65536?(t[a++]=224|A>>>12,t[a++]=128|A>>>6&63,t[a++]=128|63&A):(t[a++]=240|A>>>18,t[a++]=128|A>>>12&63,t[a++]=128|A>>>6&63,t[a++]=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 a=new Array(2*A);for(r=0,i=0;i<A;){let t=e[i++];if(t<128){a[r++]=t;continue}let n=Ws[t];if(n>4)a[r++]=65533,i+=n-1;else{for(t&=2===n?31:3===n?15:7;n>1&&i<A;)t=t<<6|63&e[i++],n--;n>1?a[r++]=65533:t<65536?a[r++]=t:(t-=65536,a[r++]=55296|t>>10&1023,a[r++]=56320|1023&t)}}return((e,t)=>{if(t<65534&&e.subarray&&Xs)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})(a,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+Ws[e[A]]>t?A:t}};var eo=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 to=Object.prototype.toString,{Z_NO_FLUSH:Ao,Z_SYNC_FLUSH:io,Z_FULL_FLUSH:ro,Z_FINISH:ao,Z_OK:no,Z_STREAM_END:so,Z_DEFAULT_COMPRESSION:oo,Z_DEFAULT_STRATEGY:lo,Z_DEFLATED:go}=Xn;function ho(e){this.options=js.assign({level:oo,method:go,chunkSize:16384,windowBits:15,memLevel:8,strategy:lo},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 eo,this.strm.avail_out=0;let A=Vs.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(A!==no)throw new Error(jn[A]);if(t.header&&Vs.deflateSetHeader(this.strm,t.header),t.dictionary){let e;if(e="string"==typeof t.dictionary?$s.string2buf(t.dictionary):"[object ArrayBuffer]"===to.call(t.dictionary)?new Uint8Array(t.dictionary):t.dictionary,A=Vs.deflateSetDictionary(this.strm,e),A!==no)throw new Error(jn[A]);this._dict_set=!0}}ho.prototype.push=function(e,t){const A=this.strm,i=this.options.chunkSize;let r,a;if(this.ended)return!1;for(a=t===~~t?t:!0===t?ao:Ao,"string"==typeof e?A.input=$s.string2buf(e):"[object ArrayBuffer]"===to.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),(a===io||a===ro)&&A.avail_out<=6)this.onData(A.output.subarray(0,A.next_out)),A.avail_out=0;else{if(r=Vs.deflate(A,a),r===so)return A.next_out>0&&this.onData(A.output.subarray(0,A.next_out)),r=Vs.deflateEnd(this.strm),this.onEnd(r),this.ended=!0,r===no;if(0!==A.avail_out){if(a>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},ho.prototype.onData=function(e){this.chunks.push(e)},ho.prototype.onEnd=function(e){e===no&&(this.result=js.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};const fo=16209;var co=function(e,t){let A,i,r,a,n,s,o,l,g,h,f,c,d,I,u,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,a=r-(t-e.avail_out),n=r+(e.avail_out-257),s=b.dmax,o=b.wsize,l=b.whave,g=b.wnext,h=b.window,f=b.hold,c=b.bits,d=b.lencode,I=b.distcode,u=(1<<b.lenbits)-1,B=(1<<b.distbits)-1;e:do{c<15&&(f+=y[A++]<<c,c+=8,f+=y[A++]<<c,c+=8),C=d[f&u];t:for(;;){if(E=C>>>24,f>>>=E,c-=E,E=C>>>16&255,0===E)_[r++]=65535&C;else{if(!(16&E)){if(0==(64&E)){C=d[(65535&C)+(f&(1<<E)-1)];continue t}if(32&E){b.mode=16191;break e}e.msg="invalid literal/length code",b.mode=fo;break e}w=65535&C,E&=15,E&&(c<E&&(f+=y[A++]<<c,c+=8),w+=f&(1<<E)-1,f>>>=E,c-=E),c<15&&(f+=y[A++]<<c,c+=8,f+=y[A++]<<c,c+=8),C=I[f&B];A:for(;;){if(E=C>>>24,f>>>=E,c-=E,E=C>>>16&255,!(16&E)){if(0==(64&E)){C=I[(65535&C)+(f&(1<<E)-1)];continue A}e.msg="invalid distance code",b.mode=fo;break e}if(Q=65535&C,E&=15,c<E&&(f+=y[A++]<<c,c+=8,c<E&&(f+=y[A++]<<c,c+=8)),Q+=f&(1<<E)-1,Q>s){e.msg="invalid distance too far back",b.mode=fo;break e}if(f>>>=E,c-=E,E=r-a,Q>E){if(E=Q-E,E>l&&b.sane){e.msg="invalid distance too far back",b.mode=fo;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<n);w=c>>3,A-=w,c-=w<<3,f&=(1<<c)-1,e.next_in=A,e.next_out=r,e.avail_in=A<i?i-A+5:5-(A-i),e.avail_out=r<n?n-r+257:257-(r-n),b.hold=f,b.bits=c};const Io=15,uo=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]),Bo=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]),Co=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]),Eo=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 wo=(e,t,A,i,r,a,n,s)=>{const o=s.bits;let l,g,h,f,c,d,I=0,u=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,S,x=null;for(I=0;I<=Io;I++)b[I]=0;for(u=0;u<i;u++)b[t[A+u]]++;for(E=o,C=Io;C>=1&&0===b[C];C--);if(E>C&&(E=C),0===C)return r[a++]=20971520,r[a++]=20971520,s.bits=1,0;for(B=1;B<C&&0===b[B];B++);for(E<B&&(E=B),m=1,I=1;I<=Io;I++)if(m<<=1,m-=b[I],m<0)return-1;if(m>0&&(0===e||1!==C))return-1;for(D[1]=0,I=1;I<Io;I++)D[I+1]=D[I]+b[I];for(u=0;u<i;u++)0!==t[A+u]&&(n[D[t[A+u]]++]=u);if(0===e?(_=x=n,d=20):1===e?(_=uo,x=Bo,d=257):(_=Co,x=Eo,d=0),y=0,u=0,I=B,c=a,w=E,Q=0,h=-1,p=1<<E,f=p-1,1===e&&p>852||2===e&&p>592)return 1;for(;;){k=I-Q,n[u]+1<d?(v=0,S=n[u]):n[u]>=d?(v=x[n[u]-d],S=_[n[u]-d]):(v=96,S=0),l=1<<I-Q,g=1<<w,B=g;do{g-=l,r[c+(y>>Q)+g]=k<<24|v<<16|S|0}while(0!==g);for(l=1<<I-1;y&l;)l>>=1;if(0!==l?(y&=l-1,y+=l):y=0,u++,0==--b[I]){if(I===C)break;I=t[A+n[u]]}if(I>E&&(y&f)!==h){for(0===Q&&(Q=E),c+=B,w=I-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&f,r[h]=E<<24|w<<16|c-a|0}}return 0!==y&&(r[c+y]=I-Q<<24|64<<16|0),s.bits=E,0};const{Z_FINISH:Qo,Z_BLOCK:mo,Z_TREES:po,Z_OK:yo,Z_STREAM_END:_o,Z_NEED_DICT:bo,Z_STREAM_ERROR:Do,Z_DATA_ERROR:ko,Z_MEM_ERROR:vo,Z_BUF_ERROR:So,Z_DEFLATED:xo}=Xn,Go=16180,Uo=16190,Fo=16191,Ro=16192,Lo=16194,Mo=16199,To=16200,No=16206,Oo=16209,Po=e=>(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24);function zo(){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 Ko=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||t.mode<Go||t.mode>16211?1:0},qo=e=>{if(Ko(e))return Do;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=Go,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,yo},Jo=e=>{if(Ko(e))return Do;const t=e.state;return t.wsize=0,t.whave=0,t.wnext=0,qo(e)},Ho=(e,t)=>{let A;if(Ko(e))return Do;const i=e.state;return t<0?(A=0,t=-t):(A=5+(t>>4),t<48&&(t&=15)),t&&(t<8||t>15)?Do:(null!==i.window&&i.wbits!==t&&(i.window=null),i.wrap=A,i.wbits=t,Jo(e))},Yo=(e,t)=>{if(!e)return Do;const A=new zo;e.state=A,A.strm=e,A.window=null,A.mode=Go;const i=Ho(e,t);return i!==yo&&(e.state=null),i};let Vo,Zo,jo=!0;const Xo=e=>{if(jo){Vo=new Int32Array(512),Zo=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(wo(1,e.lens,0,288,Vo,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;wo(2,e.lens,0,32,Zo,0,e.work,{bits:5}),jo=!1}e.lencode=Vo,e.lenbits=9,e.distcode=Zo,e.distbits=5},Wo=(e,t,A,i)=>{let r;const a=e.state;return null===a.window&&(a.wsize=1<<a.wbits,a.wnext=0,a.whave=0,a.window=new Uint8Array(a.wsize)),i>=a.wsize?(a.window.set(t.subarray(A-a.wsize,A),0),a.wnext=0,a.whave=a.wsize):(r=a.wsize-a.wnext,r>i&&(r=i),a.window.set(t.subarray(A-i,A-i+r),a.wnext),(i-=r)?(a.window.set(t.subarray(A-i,A),0),a.wnext=i,a.whave=a.wsize):(a.wnext+=r,a.wnext===a.wsize&&(a.wnext=0),a.whave<a.wsize&&(a.whave+=r))),0};var $o={inflateReset:Jo,inflateReset2:Ho,inflateResetKeep:qo,inflateInit:e=>Yo(e,15),inflateInit2:Yo,inflate:(e,t)=>{let A,i,r,a,n,s,o,l,g,h,f,c,d,I,u,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(Ko(e)||!e.output||!e.input&&0!==e.avail_in)return Do;A=e.state,A.mode===Fo&&(A.mode=Ro),n=e.next_out,r=e.output,o=e.avail_out,a=e.next_in,i=e.input,s=e.avail_in,l=A.hold,g=A.bits,h=s,f=o,p=yo;e:for(;;)switch(A.mode){case Go:if(0===A.wrap){A.mode=Ro;break}for(;g<16;){if(0===s)break e;s--,l+=i[a++]<<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=Zn(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=Oo;break}if((15&l)!==xo){e.msg="unknown compression method",A.mode=Oo;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=Oo;break}A.dmax=1<<A.wbits,A.flags=0,e.adler=A.check=1,A.mode=512&l?16189:Fo,l=0,g=0;break;case 16181:for(;g<16;){if(0===s)break e;s--,l+=i[a++]<<g,g+=8}if(A.flags=l,(255&A.flags)!==xo){e.msg="unknown compression method",A.mode=Oo;break}if(57344&A.flags){e.msg="unknown header flags set",A.mode=Oo;break}A.head&&(A.head.text=l>>8&1),512&A.flags&&4&A.wrap&&(_[0]=255&l,_[1]=l>>>8&255,A.check=Zn(A.check,_,2,0)),l=0,g=0,A.mode=16182;case 16182:for(;g<32;){if(0===s)break e;s--,l+=i[a++]<<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=Zn(A.check,_,4,0)),l=0,g=0,A.mode=16183;case 16183:for(;g<16;){if(0===s)break e;s--,l+=i[a++]<<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=Zn(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[a++]<<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=Zn(A.check,_,2,0)),l=0,g=0}else A.head&&(A.head.extra=null);A.mode=16185;case 16185:if(1024&A.flags&&(c=A.length,c>s&&(c=s),c&&(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(a,a+c),m)),512&A.flags&&4&A.wrap&&(A.check=Zn(A.check,i,c,a)),s-=c,a+=c,A.length-=c),A.length))break e;A.length=0,A.mode=16186;case 16186:if(2048&A.flags){if(0===s)break e;c=0;do{m=i[a+c++],A.head&&m&&A.length<65536&&(A.head.name+=String.fromCharCode(m))}while(m&&c<s);if(512&A.flags&&4&A.wrap&&(A.check=Zn(A.check,i,c,a)),s-=c,a+=c,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;c=0;do{m=i[a+c++],A.head&&m&&A.length<65536&&(A.head.comment+=String.fromCharCode(m))}while(m&&c<s);if(512&A.flags&&4&A.wrap&&(A.check=Zn(A.check,i,c,a)),s-=c,a+=c,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[a++]<<g,g+=8}if(4&A.wrap&&l!==(65535&A.check)){e.msg="header crc mismatch",A.mode=Oo;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=Fo;break;case 16189:for(;g<32;){if(0===s)break e;s--,l+=i[a++]<<g,g+=8}e.adler=A.check=Po(l),l=0,g=0,A.mode=Uo;case Uo:if(0===A.havedict)return e.next_out=n,e.avail_out=o,e.next_in=a,e.avail_in=s,A.hold=l,A.bits=g,bo;e.adler=A.check=1,A.mode=Fo;case Fo:if(t===mo||t===po)break e;case Ro:if(A.last){l>>>=7&g,g-=7&g,A.mode=No;break}for(;g<3;){if(0===s)break e;s--,l+=i[a++]<<g,g+=8}switch(A.last=1&l,l>>>=1,g-=1,3&l){case 0:A.mode=16193;break;case 1:if(Xo(A),A.mode=Mo,t===po){l>>>=2,g-=2;break e}break;case 2:A.mode=16196;break;case 3:e.msg="invalid block type",A.mode=Oo}l>>>=2,g-=2;break;case 16193:for(l>>>=7&g,g-=7&g;g<32;){if(0===s)break e;s--,l+=i[a++]<<g,g+=8}if((65535&l)!=(l>>>16^65535)){e.msg="invalid stored block lengths",A.mode=Oo;break}if(A.length=65535&l,l=0,g=0,A.mode=Lo,t===po)break e;case Lo:A.mode=16195;case 16195:if(c=A.length,c){if(c>s&&(c=s),c>o&&(c=o),0===c)break e;r.set(i.subarray(a,a+c),n),s-=c,a+=c,o-=c,n+=c,A.length-=c;break}A.mode=Fo;break;case 16196:for(;g<14;){if(0===s)break e;s--,l+=i[a++]<<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=Oo;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[a++]<<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=wo(0,A.lens,0,19,A.lencode,0,A.work,b),A.lenbits=b.bits,p){e.msg="invalid code lengths set",A.mode=Oo;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],u=y>>>24,B=y>>>16&255,C=65535&y,!(u<=g);){if(0===s)break e;s--,l+=i[a++]<<g,g+=8}if(C<16)l>>>=u,g-=u,A.lens[A.have++]=C;else{if(16===C){for(D=u+2;g<D;){if(0===s)break e;s--,l+=i[a++]<<g,g+=8}if(l>>>=u,g-=u,0===A.have){e.msg="invalid bit length repeat",A.mode=Oo;break}m=A.lens[A.have-1],c=3+(3&l),l>>>=2,g-=2}else if(17===C){for(D=u+3;g<D;){if(0===s)break e;s--,l+=i[a++]<<g,g+=8}l>>>=u,g-=u,m=0,c=3+(7&l),l>>>=3,g-=3}else{for(D=u+7;g<D;){if(0===s)break e;s--,l+=i[a++]<<g,g+=8}l>>>=u,g-=u,m=0,c=11+(127&l),l>>>=7,g-=7}if(A.have+c>A.nlen+A.ndist){e.msg="invalid bit length repeat",A.mode=Oo;break}for(;c--;)A.lens[A.have++]=m}}if(A.mode===Oo)break;if(0===A.lens[256]){e.msg="invalid code -- missing end-of-block",A.mode=Oo;break}if(A.lenbits=9,b={bits:A.lenbits},p=wo(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=Oo;break}if(A.distbits=6,A.distcode=A.distdyn,b={bits:A.distbits},p=wo(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=Oo;break}if(A.mode=Mo,t===po)break e;case Mo:A.mode=To;case To:if(s>=6&&o>=258){e.next_out=n,e.avail_out=o,e.next_in=a,e.avail_in=s,A.hold=l,A.bits=g,co(e,f),n=e.next_out,r=e.output,o=e.avail_out,a=e.next_in,i=e.input,s=e.avail_in,l=A.hold,g=A.bits,A.mode===Fo&&(A.back=-1);break}for(A.back=0;y=A.lencode[l&(1<<A.lenbits)-1],u=y>>>24,B=y>>>16&255,C=65535&y,!(u<=g);){if(0===s)break e;s--,l+=i[a++]<<g,g+=8}if(B&&0==(240&B)){for(E=u,w=B,Q=C;y=A.lencode[Q+((l&(1<<E+w)-1)>>E)],u=y>>>24,B=y>>>16&255,C=65535&y,!(E+u<=g);){if(0===s)break e;s--,l+=i[a++]<<g,g+=8}l>>>=E,g-=E,A.back+=E}if(l>>>=u,g-=u,A.back+=u,A.length=C,0===B){A.mode=16205;break}if(32&B){A.back=-1,A.mode=Fo;break}if(64&B){e.msg="invalid literal/length code",A.mode=Oo;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[a++]<<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],u=y>>>24,B=y>>>16&255,C=65535&y,!(u<=g);){if(0===s)break e;s--,l+=i[a++]<<g,g+=8}if(0==(240&B)){for(E=u,w=B,Q=C;y=A.distcode[Q+((l&(1<<E+w)-1)>>E)],u=y>>>24,B=y>>>16&255,C=65535&y,!(E+u<=g);){if(0===s)break e;s--,l+=i[a++]<<g,g+=8}l>>>=E,g-=E,A.back+=E}if(l>>>=u,g-=u,A.back+=u,64&B){e.msg="invalid distance code",A.mode=Oo;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[a++]<<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=Oo;break}A.mode=16204;case 16204:if(0===o)break e;if(c=f-o,A.offset>c){if(c=A.offset-c,c>A.whave&&A.sane){e.msg="invalid distance too far back",A.mode=Oo;break}c>A.wnext?(c-=A.wnext,d=A.wsize-c):d=A.wnext-c,c>A.length&&(c=A.length),I=A.window}else I=r,d=n-A.offset,c=A.length;c>o&&(c=o),o-=c,A.length-=c;do{r[n++]=I[d++]}while(--c);0===A.length&&(A.mode=To);break;case 16205:if(0===o)break e;r[n++]=A.length,o--,A.mode=To;break;case No:if(A.wrap){for(;g<32;){if(0===s)break e;s--,l|=i[a++]<<g,g+=8}if(f-=o,e.total_out+=f,A.total+=f,4&A.wrap&&f&&(e.adler=A.check=A.flags?Zn(A.check,r,f,n-f):Yn(A.check,r,f,n-f)),f=o,4&A.wrap&&(A.flags?l:Po(l))!==A.check){e.msg="incorrect data check",A.mode=Oo;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[a++]<<g,g+=8}if(4&A.wrap&&l!==(4294967295&A.total)){e.msg="incorrect length check",A.mode=Oo;break}l=0,g=0}A.mode=16208;case 16208:p=_o;break e;case Oo:p=ko;break e;case 16210:return vo;default:return Do}return e.next_out=n,e.avail_out=o,e.next_in=a,e.avail_in=s,A.hold=l,A.bits=g,(A.wsize||f!==e.avail_out&&A.mode<Oo&&(A.mode<No||t!==Qo))&&Wo(e,e.output,e.next_out,f-e.avail_out),h-=e.avail_in,f-=e.avail_out,e.total_in+=h,e.total_out+=f,A.total+=f,4&A.wrap&&f&&(e.adler=A.check=A.flags?Zn(A.check,r,f,e.next_out-f):Yn(A.check,r,f,e.next_out-f)),e.data_type=A.bits+(A.last?64:0)+(A.mode===Fo?128:0)+(A.mode===Mo||A.mode===Lo?256:0),(0===h&&0===f||t===Qo)&&p===yo&&(p=So),p},inflateEnd:e=>{if(Ko(e))return Do;let t=e.state;return t.window&&(t.window=null),e.state=null,yo},inflateGetHeader:(e,t)=>{if(Ko(e))return Do;const A=e.state;return 0==(2&A.wrap)?Do:(A.head=t,t.done=!1,yo)},inflateSetDictionary:(e,t)=>{const A=t.length;let i,r,a;return Ko(e)?Do:(i=e.state,0!==i.wrap&&i.mode!==Uo?Do:i.mode===Uo&&(r=1,r=Yn(r,t,A,0),r!==i.check)?ko:(a=Wo(e,t,A,A),a?(i.mode=16210,vo):(i.havedict=1,yo)))},inflateInfo:"pako inflate (from Nodeca project)"};var el=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 tl=Object.prototype.toString,{Z_NO_FLUSH:Al,Z_FINISH:il,Z_OK:rl,Z_STREAM_END:al,Z_NEED_DICT:nl,Z_STREAM_ERROR:sl,Z_DATA_ERROR:ol,Z_MEM_ERROR:ll}=Xn;function gl(e){this.options=js.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 eo,this.strm.avail_out=0;let A=$o.inflateInit2(this.strm,t.windowBits);if(A!==rl)throw new Error(jn[A]);if(this.header=new el,$o.inflateGetHeader(this.strm,this.header),t.dictionary&&("string"==typeof t.dictionary?t.dictionary=$s.string2buf(t.dictionary):"[object ArrayBuffer]"===tl.call(t.dictionary)&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(A=$o.inflateSetDictionary(this.strm,t.dictionary),A!==rl)))throw new Error(jn[A])}function hl(e,t){const A=new gl(t);if(A.push(e),A.err)throw A.msg||jn[A.err];return A.result}gl.prototype.push=function(e,t){const A=this.strm,i=this.options.chunkSize,r=this.options.dictionary;let a,n,s;if(this.ended)return!1;for(n=t===~~t?t:!0===t?il:Al,"[object ArrayBuffer]"===tl.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),a=$o.inflate(A,n),a===nl&&r&&(a=$o.inflateSetDictionary(A,r),a===rl?a=$o.inflate(A,n):a===ol&&(a=nl));A.avail_in>0&&a===al&&A.state.wrap>0&&0!==e[A.next_in];)$o.inflateReset(A),a=$o.inflate(A,n);switch(a){case sl:case ol:case nl:case ll:return this.onEnd(a),this.ended=!0,!1}if(s=A.avail_out,A.next_out&&(0===A.avail_out||a===al))if("string"===this.options.to){let e=$s.utf8border(A.output,A.next_out),t=A.next_out-e,r=$s.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(a!==rl||0!==s){if(a===al)return a=$o.inflateEnd(this.strm),this.onEnd(a),this.ended=!0,!0;if(0===A.avail_in)break}}return!0},gl.prototype.onData=function(e){this.chunks.push(e)},gl.prototype.onEnd=function(e){e===rl&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=js.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};var fl={Inflate:gl,inflate:hl,inflateRaw:function(e,t){return(t=t||{}).raw=!0,hl(e,t)},ungzip:hl,constants:Xn};const{Inflate:cl,inflate:dl,inflateRaw:Il,ungzip:ul}=fl;var Bl=dl;var Cl=Object.freeze({__proto__:null,default:class extends Ea{decodeBlock(e){return Bl(new Uint8Array(e)).buffer}}});var El=Object.freeze({__proto__:null,default:class extends Ea{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}}}),wl={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
5
|
!function(){var t,A,i,r,a,n,s,o,l,g,h,f,c,d,I,u,B=(t={defaultNoDataValue:-34027999387901484e22,decode:function(e,n){var s=(n=n||{}).encodedMaskData||null===n.encodedMaskData,o=a(e,n.inputOffset||0,s),l=null!==n.noDataValue?n.noDataValue:t.defaultNoDataValue,g=A(o,n.pixelType||Float32Array,n.encodedMaskData,l,n.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),n.returnEncodedMask&&o.mask&&(h.encodedMaskData=o.mask.bitset?o.mask.bitset:null),n.returnFileInfo&&(h.fileInfo=i(o),n.computeUsedBitDepths&&(h.fileInfo.bitDepths=r(o))),h}},A=function(e,t,A,i,r){var a,s,o,l=0,g=e.pixels.numBlocksX,h=e.pixels.numBlocksY,f=Math.floor(e.width/g),c=Math.floor(e.height/h),d=2*e.maxZError,I=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 u,B,C=new Float32Array(f*c),E=0;E<=h;E++){var w=E!==h?c:e.height%h;if(0!==w)for(var Q=0;Q<=g;Q++){var m=Q!==g?f:e.width%g;if(0!==m){var p,y,_,b,D=E*e.width*c+Q*f,k=e.width-m,v=e.pixels.blocks[l];if(v.encoding<2?(0===v.encoding?p=v.rawData:(n(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),u=0;u<m;u++)7&D||(b=A[D>>3]),128&b?(o&&(o[D]=1),I=I>(a=v.encoding<2?p[y++]:_)?a:I,s[D++]=a):(o&&(o[D]=0),s[D++]=i),b<<=1;D+=k}else if(v.encoding<2)for(B=0;B<w;B++){for(u=0;u<m;u++)I=I>(a=p[y++])?a:I,s[D++]=a;D+=k}else for(I=I>_?_:I,B=0;B<w;B++){for(u=0;u<m;u++)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:I}},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)},a=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 a=new DataView(e,t,24);if(i.fileVersion=a.getInt32(0,!0),i.imageType=a.getInt32(4,!0),i.height=a.getUint32(8,!0),i.width=a.getUint32(12,!0),i.maxZError=a.getFloat64(16,!0),t+=24,!A)if(a=new DataView(e,t,16),i.mask={},i.mask.numBlocksY=a.getUint32(0,!0),i.mask.numBlocksX=a.getUint32(4,!0),i.mask.numBytes=a.getUint32(8,!0),i.mask.maxValue=a.getFloat32(12,!0),t+=16,i.mask.numBytes>0){var n=new Uint8Array(Math.ceil(i.width*i.height/8)),s=(a=new DataView(e,t,i.mask.numBytes)).getInt16(0,!0),o=2,l=0;do{if(s>0)for(;s--;)n[l++]=a.getUint8(o++);else{var g=a.getUint8(o++);for(s=-s;s--;)n[l++]=g}s=a.getInt16(o,!0),o+=2}while(o<i.mask.numBytes);if(-32768!==s||l<n.length)throw"Unexpected end of mask RLE encoding";i.mask.bitset=n,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)));a=new DataView(e,t,16),i.pixels={},i.pixels.numBlocksY=a.getUint32(0,!0),i.pixels.numBlocksX=a.getUint32(4,!0),i.pixels.numBytes=a.getUint32(8,!0),i.pixels.maxValue=a.getFloat32(12,!0),t+=16;var h=i.pixels.numBlocksX,f=i.pixels.numBlocksY,c=h+(i.width%h>0?1:0),d=f+(i.height%f>0?1:0);i.pixels.blocks=new Array(c*d);for(var I=0,u=0;u<d;u++)for(var B=0;B<c;B++){var C=0,E=e.byteLength-t;a=new DataView(e,t,Math.min(10,E));var w={};i.pixels.blocks[I++]=w;var Q=a.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=a.getInt8(1),C++;else if(1===Q)w.offset=a.getInt16(1,!0),C+=2;else{if(0!==Q)throw"Invalid block offset type";w.offset=a.getFloat32(1,!0),C+=4}if(1===w.encoding)if(Q=a.getUint8(C),C++,w.bitsPerPixel=63&Q,Q>>=6,w.numValidPixelsType=Q,2===Q)w.numValidPixels=a.getUint8(C),C++;else if(1===Q)w.numValidPixels=a.getUint16(C,!0),C+=2;else{if(0!==Q)throw"Invalid valid pixel count type";w.numValidPixels=a.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},n=function(e,t,A,i,r,a,n){var s,o,l,g=(1<<t)-1,h=0,f=0,c=Math.ceil((n-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===f&&(l=e[h++],f=32),f>=t)o=l>>>f-t&g,f-=t;else{var I=t-f;o=(l&g)<<I&g,o+=(l=e[h++])>>>(f=32-I)}a[s]=o<c?i+o*r:n}return a},t),C=(s=function(e,t,A,i,r,a,n,s){var o,l,g,h,f,c=(1<<A)-1,d=0,I=0,u=4*e.length-Math.ceil(A*i/8);if(e[e.length-1]<<=8*u,r)for(o=0;o<i;o++)0===I&&(g=e[d++],I=32),I>=A?(l=g>>>I-A&c,I-=A):(l=(g&c)<<(h=A-I)&c,l+=(g=e[d++])>>>(I=32-h)),t[o]=r[l];else for(f=Math.ceil((s-a)/n),o=0;o<i;o++)0===I&&(g=e[d++],I=32),I>=A?(l=g>>>I-A&c,I-=A):(l=(g&c)<<(h=A-I)&c,l+=(g=e[d++])>>>(I=32-h)),t[o]=l<f?a+l*n:s},o=function(e,t,A,i,r,a){var n,s=(1<<t)-1,o=0,l=0,g=0,h=0,f=0,c=[],d=4*e.length-Math.ceil(t*A/8);e[e.length-1]<<=8*d;var I=Math.ceil((a-i)/r);for(l=0;l<A;l++)0===h&&(n=e[o++],h=32),h>=t?(f=n>>>h-t&s,h-=t):(f=(n&s)<<(g=t-h)&s,f+=(n=e[o++])>>>(h=32-g)),c[l]=f<I?i+f*r:a;return c.unshift(i),c},l=function(e,t,A,i,r,a,n,s){var o,l,g,h,f=(1<<A)-1,c=0,d=0,I=0;if(r)for(o=0;o<i;o++)0===d&&(g=e[c++],d=32,I=0),d>=A?(l=g>>>I&f,d-=A,I+=A):(l=g>>>I&f,d=32-(h=A-d),l|=((g=e[c++])&(1<<h)-1)<<A-h,I=h),t[o]=r[l];else{var u=Math.ceil((s-a)/n);for(o=0;o<i;o++)0===d&&(g=e[c++],d=32,I=0),d>=A?(l=g>>>I&f,d-=A,I+=A):(l=g>>>I&f,d=32-(h=A-d),l|=((g=e[c++])&(1<<h)-1)<<A-h,I=h),t[o]=l<u?a+l*n:s}return t},g=function(e,t,A,i,r,a){var n,s=(1<<t)-1,o=0,l=0,g=0,h=0,f=0,c=0,d=[],I=Math.ceil((a-i)/r);for(l=0;l<A;l++)0===h&&(n=e[o++],h=32,c=0),h>=t?(f=n>>>c&s,h-=t,c+=t):(f=n>>>c&s,h=32-(g=t-h),f|=((n=e[o++])&(1<<g)-1)<<t-g,c=g),d[l]=f<I?i+f*r:a;return d.unshift(i),d},h=function(e,t,A,i){var r,a,n,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&&(n=e[l++],g=32),g>=A?(a=n>>>g-A&o,g-=A):(a=(n&o)<<(s=A-g)&o,a+=(n=e[l++])>>>(g=32-s)),t[r]=a;return t},f=function(e,t,A,i){var r,a,n,s,o=(1<<A)-1,l=0,g=0,h=0;for(r=0;r<i;r++)0===g&&(n=e[l++],g=32,h=0),g>=A?(a=n>>>h&o,g-=A,h+=A):(a=n>>>h&o,g=32-(s=A-g),a|=((n=e[l++])&(1<<s)-1)<<A-s,h=s),t[r]=a;return t},c={HUFFMAN_LUT_BITS_MAX:12,computeChecksumFletcher32:function(e){for(var t=65535,A=65535,i=e.length,r=Math.floor(i/2),a=0;r;){var n=r>=359?359:r;r-=n;do{t+=e[a++]<<8,A+=t+=e[a++]}while(--n);t=(65535&t)+(t>>>16),A=(65535&A)+(A>>>16)}return 1&i&&(A+=t+=e[a]<<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 a,n=new DataView(e,A,8),s=n.getInt32(0,!0);if(r.fileVersion=s,A+=4,s>=3&&(r.checksum=n.getUint32(4,!0),A+=4),n=new DataView(e,A,12),r.height=n.getUint32(0,!0),r.width=n.getUint32(4,!0),A+=8,s>=4?(r.numDims=n.getUint32(8,!0),A+=4):r.numDims=1,n=new DataView(e,A,40),r.numValidPixel=n.getUint32(0,!0),r.microBlockSize=n.getInt32(4,!0),r.blobSize=n.getInt32(8,!0),r.imageType=n.getInt32(12,!0),r.maxZError=n.getFloat64(16,!0),r.zMin=n.getFloat64(24,!0),r.zMax=n.getFloat64(32,!0),A+=40,t.headerInfo=r,t.ptr=A,s>=3&&(a=s>=4?52:48,this.computeChecksumFletcher32(new Uint8Array(e,A-a,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),a=this.readSubArray(e,t.ptr,i,r),n=this.readSubArray(e,t.ptr+r,i,r);t.ptr+=2*r;var s,o=!0;for(s=0;s<A.numDims;s++)if(a[s]!==n[s]){o=!1;break}return A.minValues=a,A.maxValues=n,o},readSubArray:function(e,t,A,i){var r;if(A===Uint8Array)r=new Uint8Array(e,t,i);else{var a=new ArrayBuffer(i);new Uint8Array(a).set(new Uint8Array(e,t,i)),r=new A(a)}return r},readMask:function(e,t){var A,i,r=t.ptr,a=t.headerInfo,n=a.width*a.height,s=a.numValidPixel,o=new DataView(e,r,4),l={};if(l.numBytes=o.getUint32(0,!0),r+=4,(0===s||n===s)&&0!==l.numBytes)throw"invalid mask";if(0===s)A=new Uint8Array(Math.ceil(n/8)),l.bitset=A,i=new Uint8Array(n),t.pixels.resultMask=i,r+=l.numBytes;else if(l.numBytes>0){A=new Uint8Array(Math.ceil(n/8));var g=(o=new DataView(e,r,l.numBytes)).getInt16(0,!0),h=2,f=0,c=0;do{if(g>0)for(;g--;)A[f++]=o.getUint8(h++);else for(c=o.getUint8(h++),g=-g;g--;)A[f++]=c;g=o.getInt16(h,!0),h+=2}while(h<l.numBytes);if(-32768!==g||f<A.length)throw"Unexpected end of mask RLE encoding";i=new Uint8Array(n);var d=0,I=0;for(I=0;I<n;I++)7&I?(d=A[I>>3],d<<=7&I):d=A[I>>3],128&d&&(i[I]=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,a=t.ptr,n=t.headerInfo,s=n.numDims,o=n.width*n.height,l=n.imageType,g=n.numValidPixel*c.getDataTypeSize(l)*s,h=t.pixels.resultMask;if(A===Uint8Array)r=new Uint8Array(e,a,g);else{var f=new ArrayBuffer(g);new Uint8Array(f).set(new Uint8Array(e,a,g)),r=new A(f)}if(r.length===o*s)t.pixels.resultPixels=i?c.swapDimensionOrder(r,o,s,A,!0):r;else{t.pixels.resultPixels=new A(o*s);var d=0,I=0,u=0,B=0;if(s>1){if(i){for(I=0;I<o;I++)if(h[I])for(B=I,u=0;u<s;u++,B+=o)t.pixels.resultPixels[B]=r[d++]}else for(I=0;I<o;I++)if(h[I])for(B=I*s,u=0;u<s;u++)t.pixels.resultPixels[B+u]=r[d++]}else for(I=0;I<o;I++)h[I]&&(t.pixels.resultPixels[I]=r[d++])}return a+=g,t.ptr=a,!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),a=i.getInt32(8,!0),n=i.getInt32(12,!0);if(a>=n)return!1;var s=new Uint32Array(n-a);c.decodeBits(e,t,s);var o,l,g,h,f=[];for(o=a;o<n;o++)f[l=o-(o<r?0:r)]={first:s[o-a],second:null};var I=e.byteLength-t.ptr,u=Math.ceil(I/4),B=new ArrayBuffer(4*u);new Uint8Array(B).set(new Uint8Array(e,t.ptr,I));var C,E=new Uint32Array(B),w=0,Q=0;for(C=E[0],o=a;o<n;o++)(h=f[l=o-(o<r?0:r)].first)>0&&(f[l].second=C<<w>>>32-h,32-w>=h?32===(w+=h)&&(w=0,C=E[++Q]):(w+=h-32,C=E[++Q],f[l].second|=C>>>32-w));var m=0,p=0,y=new d;for(o=0;o<f.length;o++)void 0!==f[o]&&(m=Math.max(m,f[o].first));p=m>=A?A:m;var _,b,D,k,v,S=[];for(o=a;o<n;o++)if((h=f[l=o-(o<r?0:r)].first)>0)if(_=[h,l],h<=p)for(b=f[l].second<<p-h,D=1<<p-h,g=0;g<D;g++)S[b|g]=_;else for(b=f[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:S,numBitsLUTQick:p,numBitsLUT:m,tree:y,stuffedData:E,srcPtr:Q,bitPos:w}},readHuffman:function(e,t,A,i){var r,a,n,s,o,l,g,h,f,d=t.headerInfo.numDims,I=t.headerInfo.height,u=t.headerInfo.width,B=u*I,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,S=Q[m],x=1===t.encodeMode,G=new A(B*d),U=G;if(d<2||x){for(v=0;v<d;v++)if(d>1&&(U=new A(G.buffer,B*v,B),k=0),t.headerInfo.numValidPixel===u*I)for(h=0,l=0;l<I;l++)for(g=0;g<u;g++,h++){if(a=0,o=s=S<<p>>>32-y,32-p<y&&(o=s|=Q[m+1]>>>64-p-y),E[o])a=E[o][1],p+=E[o][0];else for(o=s=S<<p>>>32-_,32-p<_&&(o=s|=Q[m+1]>>>64-p-_),r=w,f=0;f<_;f++)if(!(r=s>>>_-f-1&1?r.right:r.left).left&&!r.right){a=r.val,p=p+f+1;break}p>=32&&(p-=32,S=Q[++m]),n=a-b,x?(n+=g>0?k:l>0?U[h-u]:k,n&=255,U[h]=n,k=n):U[h]=n}else for(h=0,l=0;l<I;l++)for(g=0;g<u;g++,h++)if(D[h]){if(a=0,o=s=S<<p>>>32-y,32-p<y&&(o=s|=Q[m+1]>>>64-p-y),E[o])a=E[o][1],p+=E[o][0];else for(o=s=S<<p>>>32-_,32-p<_&&(o=s|=Q[m+1]>>>64-p-_),r=w,f=0;f<_;f++)if(!(r=s>>>_-f-1&1?r.right:r.left).left&&!r.right){a=r.val,p=p+f+1;break}p>=32&&(p-=32,S=Q[++m]),n=a-b,x?(g>0&&D[h-1]?n+=k:l>0&&D[h-u]?n+=U[h-u]:n+=k,n&=255,U[h]=n,k=n):U[h]=n}}else for(h=0,l=0;l<I;l++)for(g=0;g<u;g++)if(h=l*u+g,!D||D[h])for(v=0;v<d;v++,h+=B){if(a=0,o=s=S<<p>>>32-y,32-p<y&&(o=s|=Q[m+1]>>>64-p-y),E[o])a=E[o][1],p+=E[o][0];else for(o=s=S<<p>>>32-_,32-p<_&&(o=s|=Q[m+1]>>>64-p-_),r=w,f=0;f<_;f++)if(!(r=s>>>_-f-1&1?r.right:r.left).left&&!r.right){a=r.val,p=p+f+1;break}p>=32&&(p-=32,S=Q[++m]),n=a-b,U[h]=n}t.ptr=t.ptr+4*(m+1)+(p>0?4:0),t.pixels.resultPixels=G,d>1&&!i&&(t.pixels.resultPixels=c.swapDimensionOrder(G,B,d,A))},decodeBits:function(e,t,A,i,r){var a=t.headerInfo,n=a.fileVersion,c=0,d=e.byteLength-t.ptr>=5?5:e.byteLength-t.ptr,I=new DataView(e,t.ptr,d),u=I.getUint8(0);c++;var B=u>>6,C=0===B?4:3-B,E=(32&u)>0,w=31&u,Q=0;if(1===C)Q=I.getUint8(c),c++;else if(2===C)Q=I.getUint16(c,!0),c+=2;else{if(4!==C)throw"Invalid valid pixel count type";Q=I.getUint32(c,!0),c+=4}var m,p,y,_,b,D,k,v,S,x=2*a.maxZError,G=a.numDims>1?a.maxValues[r]:a.zMax;if(E){for(t.counter.lut++,v=I.getUint8(c),c++,_=Math.ceil((v-1)*w/8),b=Math.ceil(_/4),p=new ArrayBuffer(4*b),y=new Uint8Array(p),t.ptr+=c,y.set(new Uint8Array(e,t.ptr,_)),k=new Uint32Array(p),t.ptr+=_,S=0;v-1>>>S;)S++;_=Math.ceil(Q*S/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=n>=3?g(k,w,v-1,i,x,G):o(k,w,v-1,i,x,G),n>=3?l(m,A,S,Q,D):s(m,A,S,Q,D)}else t.counter.bitstuffer++,S=w,t.ptr+=c,S>0&&(_=Math.ceil(Q*S/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+=_,n>=3?null==i?f(m,A,S,Q):l(m,A,S,Q,!1,i,x,G):null==i?h(m,A,S,Q):s(m,A,S,Q,!1,i,x,G))},readTiles:function(e,t,A,i){var r=t.headerInfo,a=r.width,n=r.height,s=a*n,o=r.microBlockSize,l=r.imageType,g=c.getDataTypeSize(l),h=Math.ceil(a/o),f=Math.ceil(n/o);t.pixels.numBlocksY=f,t.pixels.numBlocksX=h,t.pixels.ptr=0;var d,I,u,B,C,E,w,Q,m,p,y=0,_=0,b=0,D=0,k=0,v=0,S=0,x=0,G=0,U=0,F=0,R=0,L=0,M=0,T=0,N=new A(o*o),O=n%o||o,P=a%o||o,z=r.numDims,K=t.pixels.resultMask,q=t.pixels.resultPixels,J=r.fileVersion>=5?14:15,H=r.zMax;for(b=0;b<f;b++)for(k=b!==f-1?o:O,D=0;D<h;D++)for(U=b*a*o+D*o,F=a-(v=D!==h-1?o:P),Q=0;Q<z;Q++){if(z>1?(p=q,U=b*a*o+D*o,q=new A(t.pixels.resultPixels.buffer,s*Q*g,s),H=r.maxValues[Q]):p=null,S=e.byteLength-t.ptr,I={},T=0,x=(d=new DataView(e,t.ptr,Math.min(10,S))).getUint8(0),T++,m=r.fileVersion>=5?4&x:0,G=x>>6&255,(x>>2&J)!=(D*o>>3&J))throw"integrity issue";if(m&&0===Q)throw"integrity issue";if((C=3&x)>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)<(L=e.byteLength-t.ptr)?R:L,u=new ArrayBuffer(R%g==0?R:R+g-R%g),new Uint8Array(u).set(new Uint8Array(e,t.ptr,R)),B=new A(u),M=0,K)for(y=0;y<k;y++){for(_=0;_<v;_++)K[U]&&(q[U]=B[M++]),U++;U+=F}else for(y=0;y<k;y++){for(_=0;_<v;_++)q[U++]=B[M++];U+=F}t.ptr+=M*g}else if(E=c.getDataTypeUsed(m&&l<6?4:l,G),w=c.getOnePixel(I,T,E,d),T+=c.getDataTypeSize(E),3===C)if(t.ptr+=T,t.counter.constantoffset++,K)for(y=0;y<k;y++){for(_=0;_<v;_++)K[U]&&(q[U]=m?Math.min(H,p[U]+w):w),U++;U+=F}else for(y=0;y<k;y++){for(_=0;_<v;_++)q[U]=m?Math.min(H,p[U]+w):w,U++;U+=F}else if(t.ptr+=T,c.decodeBits(e,t,N,w,Q),T=0,m)if(K)for(y=0;y<k;y++){for(_=0;_<v;_++)K[U]&&(q[U]=N[T++]+p[U]),U++;U+=F}else for(y=0;y<k;y++){for(_=0;_<v;_++)q[U]=N[T++]+p[U],U++;U+=F}else if(K)for(y=0;y<k;y++){for(_=0;_<v;_++)K[U]&&(q[U]=N[T++]),U++;U+=F}else for(y=0;y<k;y++){for(_=0;_<v;_++)q[U++]=N[T++];U+=F}else{if(m)if(K)for(y=0;y<k;y++)for(_=0;_<v;_++)K[U]&&(q[U]=p[U]),U++;else for(y=0;y<k;y++)for(_=0;_<v;_++)q[U]=p[U],U++;t.counter.constant++,t.ptr+=T}}z>1&&!i&&(t.pixels.resultPixels=c.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:c.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,a=e.headerInfo.numDims,n=e.headerInfo.height*e.headerInfo.width,s=0,o=0,l=0,g=e.pixels.resultMask,h=e.pixels.resultPixels;if(g)if(a>1){if(t)for(s=0;s<a;s++)for(l=s*n,A=r[s],o=0;o<n;o++)g[o]&&(h[l+o]=A);else for(o=0;o<n;o++)if(g[o])for(l=o*a,s=0;s<a;s++)h[l+a]=r[s]}else for(o=0;o<n;o++)g[o]&&(h[o]=A);else if(a>1&&i!==A)if(t)for(s=0;s<a;s++)for(l=s*n,A=r[s],o=0;o<n;o++)h[l+o]=A;else for(o=0;o<n;o++)for(l=o*a,s=0;s<a;s++)h[l+s]=r[s];else for(o=0;o<n*a;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 a=0,n=0,s=0,o=0,l=e;if(A>1)if(l=new i(t*A),r)for(a=0;a<t;a++)for(o=a,s=0;s<A;s++,o+=t)l[o]=e[n++];else for(a=0;a<t;a++)for(o=a,s=0;s<A;s++,o+=t)l[n++]=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={},c.readHeaderInfo(e,r)){var a=r.headerInfo,n=a.fileVersion,s=c.getDataTypeArray(a.imageType);if(n>5)throw"unsupported lerc version 2."+n;c.readMask(e,r),a.numValidPixel===a.width*a.height||r.pixels.resultMask||(r.pixels.resultMask=t.maskData);var o=a.width*a.height;r.pixels.resultPixels=new s(o*a.numDims),r.counter={onesweep:0,uncompressed:0,lut:0,bitstuffer:0,constant:0,constantoffset:0};var l,g=!t.returnPixelInterleavedDims;if(0!==a.numValidPixel)if(a.zMax===a.zMin)c.constructConstantSurface(r,g);else if(n>=4&&c.checkMinMaxRanges(e,r))c.constructConstantSurface(r,g);else{var h=new DataView(e,r.ptr,2),f=h.getUint8(0);if(r.ptr++,f)c.readDataOneSweep(e,r,s,g);else if(n>1&&a.imageType<=1&&Math.abs(a.maxZError-.5)<1e-5){var d=h.getUint8(1);if(r.ptr++,r.encodeMode=d,d>2||n<4&&d>1)throw"Invalid Huffman flag "+d;d?c.readHuffman(e,r,s,g):c.readTiles(e,r,s,g)}else c.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 I={width:a.width,height:a.height,pixelData:r.pixels.resultPixels,minValue:a.zMin,maxValue:a.zMax,validPixelCount:a.numValidPixel,dimCount:a.numDims,dimStats:{minValues:a.minValues,maxValues:a.maxValues},maskData:r.pixels.resultMask};if(r.pixels.resultMask&&c.isValidPixelValue(a.imageType,A)){var u=r.pixels.resultMask;for(i=0;i<o;i++)u[i]||(I.pixelData[i]=A);I.noDataValue=A}return r.noDataValue=A,t.returnFileInfo&&(I.fileInfo=c.formatFileInfo(r)),I}},getBandCount:function(e){for(var t=0,A=0,i={ptr:0,pixels:{}};A<e.byteLength-58;)c.readHeaderInfo(e,i),A+=i.headerInfo.blobSize,t++,i.ptr=A;return t}}),E=(I=new ArrayBuffer(4),u=new Uint8Array(I),new Uint32Array(I)[0]=1,1===u[0]),w={decode:function(e,t){if(!E)throw"Big endian system is not supported.";var A,i,r=(t=t||{}).inputOffset||0,a=new Uint8Array(e,r,10),n=String.fromCharCode.apply(null,a);if("CntZImage"===n.trim())A=B,i=1;else{if("Lerc2"!==n.substring(0,5))throw"Unexpected file identifier string: "+n;A=C,i=2}for(var s,o,l,g,h,f,c=0,d=e.byteLength-10,I=[],u={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===c,returnEncodedMask:0===c,returnFileInfo:!0,returnPixelInterleavedDims:t.returnPixelInterleavedDims,pixelType:t.pixelType||null,noDataValue:t.noDataValue||null});r=Q.fileInfo.eofOffset,l=Q.maskData,0===c&&(s=Q.encodedMaskData,u.width=Q.width,u.height=Q.height,u.dimCount=Q.dimCount||1,u.pixelType=Q.pixelType||Q.fileInfo.pixelType,u.mask=l),i>1&&(l&&I.push(l),Q.fileInfo.mask&&Q.fileInfo.mask.numBytes>0&&w++),c++,u.pixels.push(Q.pixelData),u.statistics.push({minValue:Q.minValue,maxValue:Q.maxValue,noDataValue:Q.noDataValue,dimStats:Q.dimStats})}if(i>1&&w>1){for(f=u.width*u.height,u.bandMasks=I,(l=new Uint8Array(f)).set(I[0]),g=1;g<I.length;g++)for(o=I[g],h=0;h<f;h++)l[h]=l[h]&o[h];u.maskData=l}return u}};e.exports?e.exports=w:this.Lerc=w}()}(wl);var Ql=ni(wl.exports);let ml,pl,yl;const _l={env:{emscripten_notify_memory_growth:function(e){yl=new Uint8Array(pl.exports.memory.buffer)}}};const bl="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/AX4CJwEDZW52H2Vtc2NyaXB0ZW5fbm90aWZ5X21lbW9yeV9ncm93dGgABANpaAEFAAAFAgEFCwACAQABAgIFBQcAAwABDgsBAQcAEhMHAAUBDAQEAAANBwQCAgYCBAgDAwMDBgEACQkHBgICAAYGAgQUBwYGAwIGAAMCAQgBBwUGCgoEEQAEBAEIAwgDBQgDEA8IAAcABAUBcAECAgUEAQCAAgYJAX8BQaCgwAILB2AHBm1lbW9yeQIABm1hbGxvYwAoBGZyZWUAJgxaU1REX2lzRXJyb3IAaBlaU1REX2ZpbmREZWNvbXByZXNzZWRTaXplAFQPWlNURF9kZWNvbXByZXNzAEoGX3N0YXJ0ACQJBwEAQQELASQKussBaA8AIAAgACgCBCABajYCBAsZACAAKAIAIAAoAgRBH3F0QQAgAWtBH3F2CwgAIABBiH9LC34BBH9BAyEBIAAoAgQiA0EgTQRAIAAoAggiASAAKAIQTwRAIAAQDQ8LIAAoAgwiAiABRgRAQQFBAiADQSBJGw8LIAAgASABIAJrIANBA3YiBCABIARrIAJJIgEbIgJrIgQ2AgggACADIAJBA3RrNgIEIAAgBCgAADYCAAsgAQsUAQF/IAAgARACIQIgACABEAEgAgv3AQECfyACRQRAIABC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IINgIACyACECchAkEAIQFBhCAoAgAhACACDQEgACAAKAIAQX5xNgIAQQAPCyACQQ9qQXhxIgMQHSICQX9GDQIgAkEHakF4cSIAIAJHBEAgACACaxAdQX9GDQMLAkBBhCAoAgAiAUUEQEGAICAANgIADAELIAAgATYCBAtBhCAgADYCACAAIANBAXRBAXI2AgAMAQsgAEUNAQsgAEEIaiEBCyABC7kDAQJ/IAAgA2ohBQJAIANBB0wEQANAIAAgBU8NAiAAIAItAAA6AAAgAEEBaiEAIAJBAWohAgwAAAsACyAEQQFGBEACQCAAIAJrIgZBB00EQCAAIAItAAA6AAAgACACLQABOgABIAAgAi0AAjoAAiAAIAItAAM6AAMgAEEEaiACIAZBAnQiBkHAHmooAgBqIgIQFyACIAZB4B5qKAIAayECDAELIAAgAhAMCyACQQhqIQIgAEEIaiEACwJAAkACQAJAIAUgAU0EQCAAIANqIQEgBEEBRyAAIAJrQQ9Kcg0BA0AgACACEAwgAkEIaiECIABBCGoiACABSQ0ACwwFCyAAIAFLBEAgACEBDAQLIARBAUcgACACa0EPSnINASAAIQMgAiEEA0AgAyAEEAwgBEEIaiEEIANBCGoiAyABSQ0ACwwCCwNAIAAgAhAHIAJBEGohAiAAQRBqIgAgAUkNAAsMAwsgACEDIAIhBANAIAMgBBAHIARBEGohBCADQRBqIgMgAUkNAAsLIAIgASAAa2ohAgsDQCABIAVPDQEgASACLQAAOgAAIAFBAWohASACQQFqIQIMAAALAAsLQQECfyAAIAAoArjgASIDNgLE4AEgACgCvOABIQQgACABNgK84AEgACABIAJqNgK44AEgACABIAQgA2tqNgLA4AELpgEBAX8gACAAKALs4QEQFjYCyOABIABCADcD+OABIABCADcDuOABIABBwOABakIANwMAIABBqNAAaiIBQYyAgOAANgIAIABBADYCmOIBIABCADcDiOEBIABCAzcDgOEBIABBrNABakHgEikCADcCACAAQbTQAWpB6BIoAgA2AgAgACABNgIMIAAgAEGYIGo2AgggACAAQaAwajYCBCAAIABBEGo2AgALYQEBf0G4fyEDAkAg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ACECAgACgCSCACaiEEDAELIAEgAmohAgJ/IAMEQCAAQShqIgQgA2ogAUEgIANrECAgACAAKQMIIAQpAAAQCTcDCCAAIAApAxAgACkAMBAJNwMQIAAgACkDGCAAKQA4EAk3AxggACAAKQMgIABBQGspAAAQCTcDICAAKAJIIQMgAEEANgJIIAEgA2tBIGohAQsgAUEgaiACTQsEQCACQWBqIQMgACkDICEFIAApAxghBiAAKQMQIQcgACkDCCEIA0AgCCABKQAAEAkhCCAHIAEpAAgQCSEHIAYgASkAEBAJIQYgBSABKQAYEAkhBSABQSBqIgEgA00NAAsgACAFNwMgIAAgBjcDGCAAIAc3AxAgACAINwMICyABIAJPDQEgAEEoaiABIAIgAWsiBBAgCyAAIAQ2AkgLCy8BAX8gAEUEQEG2f0EAIAMbDwtBun8hBCADIAFNBH8gACACIAMQEBogAwVBun8LCy8BAX8gAEUEQEG2f0EAIAMbDwtBun8hBCADIAFNBH8gACACIAMQCxogAwVBun8LC6gCAQZ/IwBBEGsiByQAIABB2OABaikDAEKAgIAQViEIQbh/IQUCQCAEQf//B0sNACAAIAMgBBBCIgUQAyIGDQAgACgCnOIBIQkgACAHQQxqIAMgAyAFaiAGGyIKIARBACAFIAYbayIGEEAiAxADBEAgAyEFDAELIAcoAgwhBCABRQRAQbp/IQUgBEEASg0BCyAGIANrIQUgAyAKaiEDAkAgCQRAIABBADYCnOIBDAELAkACQAJAIARBBUgNACAAQdjgAWopAwBCgICACFgNAAwBCyAAQQA2ApziAQwBCyAAKAIIED8hBiAAQQA2ApziASAGQRRPDQELIAAgASACIAMgBSAEIAgQOSEFDAELIAAgASACIAMgBSAEIAgQOiEFCyAHQRBqJAAgBQtnACAAQdDgAWogASACIAAoAuzhARAuIgEQAwRAIAEPC0G4fyECAkAgAQ0AIABB7OABaigCACIBBEBBYCECIAAoApjiASABRw0BC0EAIQIgAEHw4AFqKAIARQ0AIABBkOEBahBDCyACCycBAX8QVyIERQRAQUAPCyAEIAAgASACIAMgBBBLEE8hACAEEF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EBRg0AGiACKQMICyEDIAJBMGokACADC40BAQJ/IwBBMGsiASQAAkAgAEUNACAAKAKI4gENACABIABB/OEBaigCADYCKCABIAApAvThATcDICAAEDAgACgCqOIBIQIgASABKAIoNgIYIAEgASkDIDcDECACIAFBEGoQGyAAQQA2AqjiASABIAEoAig2AgggASABKQMgNwMAIAAgARAbCyABQTBqJAALKgECfyMAQRBrIgAkACAAQQA2AgggAEIANwMAIAAQWCEBIABBEGokACABC4cBAQN/IwBBEGsiAiQAAkAgACgCAEUgACgCBEVzDQAgAiAAKAIINgIIIAIgACkCADcDAAJ/IAIoAgAiAQRAIAIoAghBqOMJIAERBQAMAQtBqOMJECgLIgFFDQAgASAAKQIANwL04QEgAUH84QFqIAAoAgg2AgAgARBZIAEhAwsgAkEQaiQAIAMLywEBAn8jAEEgayIBJAAgAEGBgIDAADYCtOIBIABBADYCiOIBIABBADYC7OEBIABCADcDkOIBIABBADYCpOMJIABBADYC3OIBIABCADcCzOIBIABBADYCvOIBIABBADYCxOABIABCADcCnOIBIABBpOIBakIANwIAIABBrOIBakEANgIAIAFCADcCECABQgA3AhggASABKQMYNwMIIAEgASkDEDcDACABKAIIQQh2QQFxIQIgAEEANgLg4gEgACACNgKM4gEgAUEgaiQAC3YBA38jAEEwayIBJAAgAARAIAEgAEHE0AFqIgIoAgA2AiggASAAKQK80AE3AyAgACgCACEDIAEgAigCADYCGCABIAApArzQATcDECADIAFBEGoQGyABIAEoAig2AgggASABKQMgNwMAIAAgARAbCyABQTBqJAALzAEBAX8gACABKAK00AE2ApjiASAAIAEoAgQiAjYCwOABIAAgAjYCvOABIAAgAiABKAIIaiICNgK44AEgACACNgLE4AEgASgCuNABBEAgAEKBgICAEDcDiOEBIAAgAUGk0ABqNgIMIAAgAUGUIGo2AgggACABQZwwajYCBCAAIAFBDGo2AgAgAEGs0AFqIAFBqNABaigCADYCACAAQbDQAWogAUGs0AFqKAIANgIAIABBtNABaiABQbDQAWooAgA2AgAPCyAAQgA3A4jhAQs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AcAAAAPAAAAHwAAAD8AAAB/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",Dl=new class{init(){return ml||(ml="undefined"!=typeof fetch?fetch("data:application/wasm;base64,"+bl).then((e=>e.arrayBuffer())).then((e=>WebAssembly.instantiate(e,_l))).then(this._init):WebAssembly.instantiate(Buffer.from(bl,"base64"),_l).then(this._init),ml)}_init(e){pl=e.instance,_l.env.emscripten_notify_memory_growth(0)}decode(e,t=0){if(!pl)throw new Error("ZSTDDecoder: Await .init() before decoding.");const A=e.byteLength,i=pl.exports.malloc(A);yl.set(e,i),t=t||Number(pl.exports.ZSTD_findDecompressedSize(i,A));const r=pl.exports.malloc(t),a=pl.exports.ZSTD_decompress(r,t,i,A),n=yl.slice(r,r+a);return pl.exports.free(i),pl.exports.free(r),n}};var kl=Object.freeze({__proto__:null,default:class extends Ea{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[Wr]}decodeBlock(e){switch(this.addCompression){case $r:break;case ea:e=Bl(new Uint8Array(e)).buffer;break;case ta:e=Dl.decode(new Uint8Array(e)).buffer;break;default:throw new Error(`Unsupported LERC additional compression method identifier: ${this.addCompression}`)}return Ql.decode(e,{returnPixelInterleavedDims:1===this.planarConfiguration}).pixels[0].buffer}},zstd:Dl});var vl=Object.freeze({__proto__:null,default:class extends Ea{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 a=r.getContext("2d");return a.drawImage(i,0,0),a.getImageData(0,0,i.width,i.height).data.buffer}}});module.exports=za;
|